From: Cris Di Sclafani Date: Fri, 30 Oct 2020 18:41:26 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=51cde4280450c466a0e7104ae6db70ee2133517a;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 32a6066..356d1e4 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-30T17:12:22.354Z", "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-30T18:32:11.850Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 72f5228..fdfeca3 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-30T17:12:22.354Z", "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-30T18:32:11.850Z", "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 1aaef00..3d6b0e9 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 _0x5d21=['action','STRING','contactManager','motionbar','browser','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)]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x5d21,0xe6));var _0x15d2=function(_0x172da8,_0x584ecd){_0x172da8=_0x172da8-0x0;var _0x32ab6c=_0x5d21[_0x172da8];return _0x32ab6c;};'use strict';var Sequelize=require(_0x15d2('0x0'));module[_0x15d2('0x1')]={'name':{'type':Sequelize[_0x15d2('0x2')],'get':function(_0x693c25){return this[_0x15d2('0x3')](_0x15d2('0x4'));}},'action':{'type':Sequelize[_0x15d2('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x15d2('0x6'),'integration',_0x15d2('0x7'),'jscripty','urlForward',_0x15d2('0x8'),'bot','script']],'msg':_0x15d2('0x9')}},'comment':_0x15d2('0x9')},'data1':{'type':Sequelize[_0x15d2('0x5')](0x1000),'comment':_0x15d2('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x15d2('0x5')](0x1000),'comment':_0x15d2('0xb')},'data4':{'type':Sequelize[_0x15d2('0x5')](0x1000)},'data5':{'type':Sequelize[_0x15d2('0x5')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x15d2('0xc')]}}; \ No newline at end of file +var _0xa422=['TEXT','sequelize','exports','getDataValue','action','STRING','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xa422,0x121));var _0x2a42=function(_0x155f10,_0x21d9e7){_0x155f10=_0x155f10-0x0;var _0x478e14=_0xa422[_0x155f10];return _0x478e14;};'use strict';var Sequelize=require(_0x2a42('0x0'));module[_0x2a42('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x31b477){return this[_0x2a42('0x2')](_0x2a42('0x3'));}},'action':{'type':Sequelize[_0x2a42('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x2a42('0x5'),_0x2a42('0x6'),'jscripty',_0x2a42('0x7'),_0x2a42('0x8'),_0x2a42('0x9'),_0x2a42('0xa')]],'msg':_0x2a42('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x2a42('0x4')](0x1000),'comment':_0x2a42('0xc')},'data2':{'type':Sequelize[_0x2a42('0x4')](0x1000),'comment':_0x2a42('0xd')},'data3':{'type':Sequelize[_0x2a42('0x4')](0x1000),'comment':_0x2a42('0xe')},'data4':{'type':Sequelize[_0x2a42('0x4')](0x1000)},'data5':{'type':Sequelize[_0x2a42('0x4')](0x1000)},'data6':{'type':Sequelize[_0x2a42('0x4')]},'data7':{'type':Sequelize[_0x2a42('0xf')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a4ed29e..277370a 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 _0x2c60=['end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','name','send','body','Action','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus'];(function(_0x2ef990,_0x53a0ce){var _0x57e70c=function(_0x3b2bee){while(--_0x3b2bee){_0x2ef990['push'](_0x2ef990['shift']());}};_0x57e70c(++_0x53a0ce);}(_0x2c60,0x6c));var _0x02c6=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x2c60[_0x58dc25];return _0x21b0a7;};'use strict';var pdf=require(_0x02c6('0x0'));var emlformat=require(_0x02c6('0x1'));var rimraf=require(_0x02c6('0x2'));var zipdir=require(_0x02c6('0x3'));var jsonpatch=require(_0x02c6('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x02c6('0x5'));var util=require(_0x02c6('0x6'));var path=require(_0x02c6('0x7'));var sox=require(_0x02c6('0x8'));var csv=require(_0x02c6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x02c6('0xa'));var squel=require(_0x02c6('0xb'));var crypto=require(_0x02c6('0xc'));var jsforce=require(_0x02c6('0xd'));var deskjs=require(_0x02c6('0xe'));var toCsv=require(_0x02c6('0x9'));var querystring=require(_0x02c6('0xf'));var Papa=require(_0x02c6('0x10'));var Redis=require(_0x02c6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x02c6('0x12'));var as=require(_0x02c6('0x13'));var hardwareService=require(_0x02c6('0x14'));var logger=require(_0x02c6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x02c6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a29cd,_0x564815){_0x564815=_0x564815||0xcc;return function(_0x2058d0){if(_0x2058d0){return _0x3a29cd[_0x02c6('0x17')](_0x564815);}return _0x3a29cd['status'](_0x564815)[_0x02c6('0x18')]();};}function respondWithResult(_0x3aa329,_0x3689ca){_0x3689ca=_0x3689ca||0xc8;return function(_0x6ae321){if(_0x6ae321){return _0x3aa329[_0x02c6('0x19')](_0x3689ca)[_0x02c6('0x1a')](_0x6ae321);}};}function respondWithFilteredResult(_0x254dfa,_0x4d7d1c){return function(_0x3dc4ca){if(_0x3dc4ca){var _0x19ee55=_0x3dc4ca[_0x02c6('0x1b')],_0x397320=_0x4d7d1c[_0x02c6('0x1c')],_0x4a3af2=_0x4d7d1c[_0x02c6('0x1c')]+_0x4d7d1c[_0x02c6('0x1d')],_0x31b222;if(_0x4a3af2>=_0x19ee55){_0x4a3af2=_0x19ee55;_0x31b222=0xc8;}else{_0x31b222=0xce;}_0x254dfa[_0x02c6('0x19')](_0x31b222);return _0x254dfa['set'](_0x02c6('0x1e'),_0x397320+'-'+_0x4a3af2+'/'+_0x19ee55)[_0x02c6('0x1a')](_0x3dc4ca);}return null;};}function patchUpdates(_0x48b7ba){return function(_0x22b9dd){try{jsonpatch[_0x02c6('0x1f')](_0x22b9dd,_0x48b7ba,!![]);}catch(_0xeeb0ce){return BPromise[_0x02c6('0x20')](_0xeeb0ce);}return _0x22b9dd[_0x02c6('0x21')]();};}function saveUpdates(_0x4107df,_0x57ddac){return function(_0x4c23b2){if(_0x4c23b2){return _0x4c23b2[_0x02c6('0x22')](_0x4107df)['then'](function(_0x417253){return _0x417253;});}return null;};}function removeEntity(_0x43b8e7,_0x315057){return function(_0x5a1b5d){if(_0x5a1b5d){return _0x5a1b5d[_0x02c6('0x23')]()[_0x02c6('0x24')](function(){_0x43b8e7[_0x02c6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3edcec,_0x1ac44d){return function(_0x4d25e8){if(!_0x4d25e8){_0x3edcec[_0x02c6('0x17')](0x194);}return _0x4d25e8;};}function handleError(_0x427bba,_0xd0a5a9){_0xd0a5a9=_0xd0a5a9||0x1f4;return function(_0x1a46c2){logger['error'](_0x1a46c2['stack']);if(_0x1a46c2[_0x02c6('0x25')]){delete _0x1a46c2[_0x02c6('0x25')];}_0x427bba['status'](_0xd0a5a9)[_0x02c6('0x26')](_0x1a46c2);};}exports[_0x02c6('0x22')]=function(_0xebc7ac,_0x3ffb52){if(_0xebc7ac['body']['id']){delete _0xebc7ac[_0x02c6('0x27')]['id'];}return db[_0x02c6('0x28')][_0x02c6('0x29')]({'where':{'id':_0xebc7ac[_0x02c6('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3ffb52,null))[_0x02c6('0x24')](saveUpdates(_0xebc7ac[_0x02c6('0x27')],null))[_0x02c6('0x24')](respondWithResult(_0x3ffb52,null))['catch'](handleError(_0x3ffb52,null));};exports[_0x02c6('0x23')]=function(_0x313cb5,_0x280baf){return db[_0x02c6('0x28')][_0x02c6('0x29')]({'where':{'id':_0x313cb5[_0x02c6('0x2a')]['id']}})[_0x02c6('0x24')](handleEntityNotFound(_0x280baf,null))[_0x02c6('0x24')](removeEntity(_0x280baf,null))[_0x02c6('0x2b')](handleError(_0x280baf,null));}; \ No newline at end of file +var _0x1dff=['to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','save','update','then','destroy','error','stack','name','send','Action','params','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x184eb8,_0xda3739){var _0x151d24=function(_0x19fcea){while(--_0x19fcea){_0x184eb8['push'](_0x184eb8['shift']());}};_0x151d24(++_0xda3739);}(_0x1dff,0xfe));var _0xf1df=function(_0x3844ab,_0x461e40){_0x3844ab=_0x3844ab-0x0;var _0x2a3276=_0x1dff[_0x3844ab];return _0x2a3276;};'use strict';var pdf=require(_0xf1df('0x0'));var emlformat=require(_0xf1df('0x1'));var rimraf=require(_0xf1df('0x2'));var zipdir=require(_0xf1df('0x3'));var jsonpatch=require(_0xf1df('0x4'));var rp=require(_0xf1df('0x5'));var moment=require(_0xf1df('0x6'));var BPromise=require(_0xf1df('0x7'));var Mustache=require(_0xf1df('0x8'));var util=require('util');var path=require(_0xf1df('0x9'));var sox=require('sox');var csv=require(_0xf1df('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf1df('0xb'));var crypto=require(_0xf1df('0xc'));var jsforce=require(_0xf1df('0xd'));var deskjs=require(_0xf1df('0xe'));var toCsv=require(_0xf1df('0xa'));var querystring=require(_0xf1df('0xf'));var Papa=require(_0xf1df('0x10'));var Redis=require('ioredis');var authService=require(_0xf1df('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf1df('0x12'));var hardwareService=require(_0xf1df('0x13'));var logger=require(_0xf1df('0x14'))(_0xf1df('0x15'));var utils=require(_0xf1df('0x16'));var config=require(_0xf1df('0x17'));var db=require(_0xf1df('0x18'))['db'];function respondWithStatusCode(_0x3a2bd7,_0x1bbe49){_0x1bbe49=_0x1bbe49||0xcc;return function(_0x44457a){if(_0x44457a){return _0x3a2bd7[_0xf1df('0x19')](_0x1bbe49);}return _0x3a2bd7[_0xf1df('0x1a')](_0x1bbe49)[_0xf1df('0x1b')]();};}function respondWithResult(_0x407d4c,_0x16172e){_0x16172e=_0x16172e||0xc8;return function(_0x2750cd){if(_0x2750cd){return _0x407d4c[_0xf1df('0x1a')](_0x16172e)['json'](_0x2750cd);}};}function respondWithFilteredResult(_0x142ed5,_0x36d7ff){return function(_0x44847a){if(_0x44847a){var _0xedd0d0=_0x44847a['count'],_0x2c9b9b=_0x36d7ff[_0xf1df('0x1c')],_0x2d3778=_0x36d7ff['offset']+_0x36d7ff[_0xf1df('0x1d')],_0x30119e;if(_0x2d3778>=_0xedd0d0){_0x2d3778=_0xedd0d0;_0x30119e=0xc8;}else{_0x30119e=0xce;}_0x142ed5[_0xf1df('0x1a')](_0x30119e);return _0x142ed5[_0xf1df('0x1e')]('Content-Range',_0x2c9b9b+'-'+_0x2d3778+'/'+_0xedd0d0)[_0xf1df('0x1f')](_0x44847a);}return null;};}function patchUpdates(_0x3c26c5){return function(_0x4235c4){try{jsonpatch['apply'](_0x4235c4,_0x3c26c5,!![]);}catch(_0x40761f){return BPromise['reject'](_0x40761f);}return _0x4235c4[_0xf1df('0x20')]();};}function saveUpdates(_0x1de658,_0x2f68fc){return function(_0x2395dc){if(_0x2395dc){return _0x2395dc[_0xf1df('0x21')](_0x1de658)[_0xf1df('0x22')](function(_0x20c843){return _0x20c843;});}return null;};}function removeEntity(_0x132d30,_0x13984f){return function(_0x10dffd){if(_0x10dffd){return _0x10dffd[_0xf1df('0x23')]()[_0xf1df('0x22')](function(){_0x132d30[_0xf1df('0x1a')](0xcc)[_0xf1df('0x1b')]();});}};}function handleEntityNotFound(_0x2769a2,_0x4ceb9f){return function(_0x331077){if(!_0x331077){_0x2769a2[_0xf1df('0x19')](0x194);}return _0x331077;};}function handleError(_0xbe021d,_0xac6e05){_0xac6e05=_0xac6e05||0x1f4;return function(_0x11bef0){logger[_0xf1df('0x24')](_0x11bef0[_0xf1df('0x25')]);if(_0x11bef0[_0xf1df('0x26')]){delete _0x11bef0['name'];}_0xbe021d[_0xf1df('0x1a')](_0xac6e05)[_0xf1df('0x27')](_0x11bef0);};}exports[_0xf1df('0x21')]=function(_0x5c4c9f,_0x5f45d0){if(_0x5c4c9f['body']['id']){delete _0x5c4c9f['body']['id'];}return db[_0xf1df('0x28')]['find']({'where':{'id':_0x5c4c9f[_0xf1df('0x29')]['id']}})['then'](handleEntityNotFound(_0x5f45d0,null))[_0xf1df('0x22')](saveUpdates(_0x5c4c9f[_0xf1df('0x2a')],null))[_0xf1df('0x22')](respondWithResult(_0x5f45d0,null))['catch'](handleError(_0x5f45d0,null));};exports[_0xf1df('0x23')]=function(_0xb12b3b,_0x462dbe){return db[_0xf1df('0x28')][_0xf1df('0x2b')]({'where':{'id':_0xb12b3b[_0xf1df('0x29')]['id']}})[_0xf1df('0x22')](handleEntityNotFound(_0x462dbe,null))['then'](removeEntity(_0x462dbe,null))['catch'](handleError(_0x462dbe,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 8100a1b..52386c9 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 _0x259a=['define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x56d39d,_0x426392){var _0x66cd19=function(_0x59d3f7){while(--_0x59d3f7){_0x56d39d['push'](_0x56d39d['shift']());}};_0x66cd19(++_0x426392);}(_0x259a,0xce));var _0xa259=function(_0x296187,_0x66707b){_0x296187=_0x296187-0x0;var _0x4565d2=_0x259a[_0x296187];return _0x4565d2;};'use strict';var _=require(_0xa259('0x0'));var util=require(_0xa259('0x1'));var logger=require(_0xa259('0x2'))(_0xa259('0x3'));var moment=require(_0xa259('0x4'));var BPromise=require(_0xa259('0x5'));var rp=require(_0xa259('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa259('0x7'));var config=require(_0xa259('0x8'));var attributes=require('./action.attributes');module[_0xa259('0x9')]=function(_0x1d26dd,_0x20a566){return _0x1d26dd[_0xa259('0xa')]('Action',attributes,{'tableName':_0xa259('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4423=['./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5745d2,_0x536b58){var _0xd6df54=function(_0xfc4bad){while(--_0xfc4bad){_0x5745d2['push'](_0x5745d2['shift']());}};_0xd6df54(++_0x536b58);}(_0x4423,0x1ef));var _0x3442=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x4423[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x3442('0x0'));var util=require(_0x3442('0x1'));var logger=require(_0x3442('0x2'))(_0x3442('0x3'));var moment=require(_0x3442('0x4'));var BPromise=require(_0x3442('0x5'));var rp=require(_0x3442('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3442('0x7'));var config=require(_0x3442('0x8'));var attributes=require(_0x3442('0x9'));module[_0x3442('0xa')]=function(_0x196ef3,_0x16701e){return _0x196ef3[_0x3442('0xb')](_0x3442('0xc'),attributes,{'tableName':_0x3442('0xd'),'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 7bf9de6..424161b 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x56ff87,_0x1698f6){var _0x20661d=function(_0x161db3){while(--_0x161db3){_0x56ff87['push'](_0x56ff87['shift']());}};_0x20661d(++_0x1698f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3981e5,_0x248851){var _0x39694d=function(_0x1c4c66){while(--_0x1c4c66){_0x3981e5['push'](_0x3981e5['shift']());}};_0x39694d(++_0x248851);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 05ea4d3..fc44d7c 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 _0x24aa=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','delete','destroy','exports','multer','util','path','express'];(function(_0x5e5172,_0x39fe2f){var _0x4c5674=function(_0x4ff386){while(--_0x4ff386){_0x5e5172['push'](_0x5e5172['shift']());}};_0x4c5674(++_0x39fe2f);}(_0x24aa,0xbf));var _0xa24a=function(_0x43a2ef,_0x31b6c3){_0x43a2ef=_0x43a2ef-0x0;var _0x254191=_0x24aa[_0x43a2ef];return _0x254191;};'use strict';var multer=require(_0xa24a('0x0'));var util=require(_0xa24a('0x1'));var path=require(_0xa24a('0x2'));var timeout=require('connect-timeout');var express=require(_0xa24a('0x3'));var router=express['Router']();var auth=require(_0xa24a('0x4'));var interaction=require(_0xa24a('0x5'));var config=require(_0xa24a('0x6'));var controller=require(_0xa24a('0x7'));router['put']('/:id',auth[_0xa24a('0x8')](),controller[_0xa24a('0x9')]);router[_0xa24a('0xa')]('/:id',auth[_0xa24a('0x8')](),controller[_0xa24a('0xb')]);module[_0xa24a('0xc')]=router; \ No newline at end of file +var _0x3bba=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','destroy'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x3bba,0x7f));var _0xa3bb=function(_0x158dbf,_0x1fa775){_0x158dbf=_0x158dbf-0x0;var _0x766087=_0x3bba[_0x158dbf];return _0x766087;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa3bb('0x0'));var timeout=require(_0xa3bb('0x1'));var express=require(_0xa3bb('0x2'));var router=express[_0xa3bb('0x3')]();var auth=require(_0xa3bb('0x4'));var interaction=require(_0xa3bb('0x5'));var config=require(_0xa3bb('0x6'));var controller=require(_0xa3bb('0x7'));router[_0xa3bb('0x8')]('/:id',auth[_0xa3bb('0x9')](),controller[_0xa3bb('0xa')]);router[_0xa3bb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa3bb('0xc')]);module[_0xa3bb('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index a0ada5c..92784b5 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 _0xa029=['exports','STRING','TEXT','sequelize'];(function(_0x5e14f6,_0x12685b){var _0x24270c=function(_0x53de29){while(--_0x53de29){_0x5e14f6['push'](_0x5e14f6['shift']());}};_0x24270c(++_0x12685b);}(_0xa029,0xa7));var _0x9a02=function(_0x4a8e1d,_0x27bb5e){_0x4a8e1d=_0x4a8e1d-0x0;var _0x482831=_0xa029[_0x4a8e1d];return _0x482831;};'use strict';var Sequelize=require(_0x9a02('0x0'));module[_0x9a02('0x1')]={'name':{'type':Sequelize[_0x9a02('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9a02('0x2')]},'parent':{'type':Sequelize[_0x9a02('0x2')]},'table':{'type':Sequelize[_0x9a02('0x2')]},'conditions':{'type':Sequelize[_0x9a02('0x3')]},'joins':{'type':Sequelize[_0x9a02('0x3')]}}; \ No newline at end of file +var _0x9d0a=['sequelize','exports','STRING','TEXT'];(function(_0x168478,_0x323a27){var _0x29c2f8=function(_0x4f7a8a){while(--_0x4f7a8a){_0x168478['push'](_0x168478['shift']());}};_0x29c2f8(++_0x323a27);}(_0x9d0a,0x74));var _0xa9d0=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x9d0a[_0x151418];return _0x40e29a;};'use strict';var Sequelize=require(_0xa9d0('0x0'));module[_0xa9d0('0x1')]={'name':{'type':Sequelize[_0xa9d0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa9d0('0x2')]},'parent':{'type':Sequelize[_0xa9d0('0x2')]},'table':{'type':Sequelize[_0xa9d0('0x2')]},'conditions':{'type':Sequelize[_0xa9d0('0x3')]},'joins':{'type':Sequelize[_0xa9d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d9c5b42..6f513be 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 _0x8868=['limit','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','options','find','catch','create','body','user','get','role','UserProfileSection','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','cross_join','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','value','select','clone','web','fullPath','%s-%s.%s','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','QueryTypes','runReport','COUNT(DISTINCT\x20%s)','AVG(%s)','getFields','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','dbH','status','count','offset'];(function(_0x2ea2e9,_0x40605e){var _0x2719a9=function(_0x396a76){while(--_0x396a76){_0x2ea2e9['push'](_0x2ea2e9['shift']());}};_0x2719a9(++_0x40605e);}(_0x8868,0x1ca));var _0x8886=function(_0x41e034,_0x439b2d){_0x41e034=_0x41e034-0x0;var _0x397e66=_0x8868[_0x41e034];return _0x397e66;};'use strict';var pdf=require(_0x8886('0x0'));var emlformat=require(_0x8886('0x1'));var rimraf=require(_0x8886('0x2'));var zipdir=require(_0x8886('0x3'));var jsonpatch=require(_0x8886('0x4'));var rp=require(_0x8886('0x5'));var moment=require(_0x8886('0x6'));var BPromise=require(_0x8886('0x7'));var Mustache=require(_0x8886('0x8'));var util=require(_0x8886('0x9'));var path=require(_0x8886('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8886('0xb'));var fs=require('fs');var _=require(_0x8886('0xc'));var squel=require('squel');var crypto=require(_0x8886('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8886('0xe'));var toCsv=require(_0x8886('0xf'));var querystring=require(_0x8886('0x10'));var Papa=require(_0x8886('0x11'));var Redis=require(_0x8886('0x12'));var authService=require(_0x8886('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8886('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8886('0x15'));var utils=require('../../config/utils');var config=require(_0x8886('0x16'));var db=require(_0x8886('0x17'))['db'];var dbH=require(_0x8886('0x17'))[_0x8886('0x18')];function respondWithStatusCode(_0x54cbc9,_0x29fa59){_0x29fa59=_0x29fa59||0xcc;return function(_0x104cb4){if(_0x104cb4){return _0x54cbc9['sendStatus'](_0x29fa59);}return _0x54cbc9[_0x8886('0x19')](_0x29fa59)['end']();};}function respondWithResult(_0x4a339,_0x1110fd){_0x1110fd=_0x1110fd||0xc8;return function(_0x7a4f08){if(_0x7a4f08){return _0x4a339[_0x8886('0x19')](_0x1110fd)['json'](_0x7a4f08);}};}function respondWithFilteredResult(_0x5b6f4b,_0x31dad3){return function(_0x11905e){if(_0x11905e){var _0x4dca44=_0x11905e[_0x8886('0x1a')],_0x53bbd5=_0x31dad3[_0x8886('0x1b')],_0x563a82=_0x31dad3[_0x8886('0x1b')]+_0x31dad3[_0x8886('0x1c')],_0x54659b;if(_0x563a82>=_0x4dca44){_0x563a82=_0x4dca44;_0x54659b=0xc8;}else{_0x54659b=0xce;}_0x5b6f4b[_0x8886('0x19')](_0x54659b);return _0x5b6f4b[_0x8886('0x1d')](_0x8886('0x1e'),_0x53bbd5+'-'+_0x563a82+'/'+_0x4dca44)[_0x8886('0x1f')](_0x11905e);}return null;};}function patchUpdates(_0xbf4367){return function(_0x85abb6){try{jsonpatch[_0x8886('0x20')](_0x85abb6,_0xbf4367,!![]);}catch(_0x3590e7){return BPromise[_0x8886('0x21')](_0x3590e7);}return _0x85abb6[_0x8886('0x22')]();};}function saveUpdates(_0x5103f9,_0x4241d9){return function(_0x595f45){if(_0x595f45){return _0x595f45[_0x8886('0x23')](_0x5103f9)[_0x8886('0x24')](function(_0x48ec2e){return _0x48ec2e;});}return null;};}function removeEntity(_0x3894a0,_0x17163e){return function(_0x34a741){if(_0x34a741){return _0x34a741[_0x8886('0x25')]()[_0x8886('0x24')](function(){var _0x1c4485=_0x34a741['get']({'plain':!![]});var _0x3df299='CustomReports';return db[_0x8886('0x26')][_0x8886('0x25')]({'where':{'type':_0x3df299,'resourceId':_0x1c4485['id']}})[_0x8886('0x24')](function(){return _0x34a741;});})['then'](function(){_0x3894a0[_0x8886('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0c51,_0x127fc9){return function(_0x27ba7d){if(!_0x27ba7d){_0x1b0c51[_0x8886('0x27')](0x194);}return _0x27ba7d;};}function handleError(_0x102adf,_0x42a568){_0x42a568=_0x42a568||0x1f4;return function(_0x2e5070){logger['error'](_0x2e5070['stack']);if(_0x2e5070[_0x8886('0x28')]){delete _0x2e5070[_0x8886('0x28')];}_0x102adf['status'](_0x42a568)[_0x8886('0x29')](_0x2e5070);};}exports[_0x8886('0x2a')]=function(_0x15cc33,_0x4aa414){var _0x5084a4={},_0x439eee={},_0x2148ca={'count':0x0,'rows':[]};var _0x22f32d=_[_0x8886('0x2b')](db[_0x8886('0x2c')][_0x8886('0x2d')],function(_0x1603fb){return{'name':_0x1603fb['fieldName'],'type':_0x1603fb[_0x8886('0x2e')][_0x8886('0x2f')]};});_0x439eee[_0x8886('0x30')]=_['map'](_0x22f32d,_0x8886('0x28'));_0x439eee['query']=_[_0x8886('0x31')](_0x15cc33[_0x8886('0x32')]);_0x439eee['filters']=_[_0x8886('0x33')](_0x439eee[_0x8886('0x30')],_0x439eee[_0x8886('0x32')]);_0x5084a4[_0x8886('0x34')]=_[_0x8886('0x33')](_0x439eee[_0x8886('0x30')],qs[_0x8886('0x35')](_0x15cc33['query'][_0x8886('0x35')]));_0x5084a4[_0x8886('0x34')]=_0x5084a4[_0x8886('0x34')][_0x8886('0x36')]?_0x5084a4[_0x8886('0x34')]:_0x439eee[_0x8886('0x30')];if(!_0x15cc33['query'][_0x8886('0x37')](_0x8886('0x38'))){_0x5084a4[_0x8886('0x1c')]=qs[_0x8886('0x1c')](_0x15cc33[_0x8886('0x32')]['limit']);_0x5084a4[_0x8886('0x1b')]=qs[_0x8886('0x1b')](_0x15cc33[_0x8886('0x32')][_0x8886('0x1b')]);}_0x5084a4[_0x8886('0x39')]=qs[_0x8886('0x3a')](_0x15cc33[_0x8886('0x32')]['sort']);_0x5084a4[_0x8886('0x3b')]=qs[_0x8886('0x3c')](_['pick'](_0x15cc33['query'],_0x439eee[_0x8886('0x3c')]),_0x22f32d);if(_0x15cc33[_0x8886('0x32')]['filter']){_0x5084a4['where']=_[_0x8886('0x3d')](_0x5084a4[_0x8886('0x3b')],{'$or':_[_0x8886('0x2b')](_0x22f32d,function(_0x2125cd){if(_0x2125cd[_0x8886('0x2e')]!==_0x8886('0x3e')){var _0x3bffd6={};_0x3bffd6[_0x2125cd[_0x8886('0x28')]]={'$like':'%'+_0x15cc33['query'][_0x8886('0x3f')]+'%'};return _0x3bffd6;}})});}_0x5084a4=_[_0x8886('0x3d')]({},_0x5084a4,_0x15cc33['options']);var _0xc716b1={'where':_0x5084a4[_0x8886('0x3b')]};return db['AnalyticCustomReport'][_0x8886('0x1a')](_0xc716b1)[_0x8886('0x24')](function(_0x5f265e){_0x2148ca['count']=_0x5f265e;if(_0x15cc33['query'][_0x8886('0x40')]){_0x5084a4[_0x8886('0x41')]=[{'all':!![]}];}return db[_0x8886('0x2c')][_0x8886('0x42')](_0x5084a4);})[_0x8886('0x24')](function(_0xfe4636){_0x2148ca[_0x8886('0x43')]=_0xfe4636;return _0x2148ca;})['then'](respondWithFilteredResult(_0x4aa414,_0x5084a4))['catch'](handleError(_0x4aa414,null));};exports['show']=function(_0x59e3ba,_0x58bdc1){var _0x4401f2={'raw':![],'where':{'id':_0x59e3ba[_0x8886('0x44')]['id']}},_0x19ee27={};_0x19ee27[_0x8886('0x30')]=_[_0x8886('0x31')](db[_0x8886('0x2c')][_0x8886('0x2d')]);_0x19ee27[_0x8886('0x32')]=_['keys'](_0x59e3ba[_0x8886('0x32')]);_0x19ee27[_0x8886('0x3c')]=_[_0x8886('0x33')](_0x19ee27[_0x8886('0x30')],_0x19ee27[_0x8886('0x32')]);_0x4401f2['attributes']=_[_0x8886('0x33')](_0x19ee27['model'],qs[_0x8886('0x35')](_0x59e3ba[_0x8886('0x32')][_0x8886('0x35')]));_0x4401f2[_0x8886('0x34')]=_0x4401f2[_0x8886('0x34')][_0x8886('0x36')]?_0x4401f2[_0x8886('0x34')]:_0x19ee27['model'];if(_0x59e3ba['query'][_0x8886('0x40')]){_0x4401f2[_0x8886('0x41')]=[{'all':!![]}];}_0x4401f2=_[_0x8886('0x3d')]({},_0x4401f2,_0x59e3ba[_0x8886('0x45')]);return db[_0x8886('0x2c')][_0x8886('0x46')](_0x4401f2)[_0x8886('0x24')](handleEntityNotFound(_0x58bdc1,null))[_0x8886('0x24')](respondWithResult(_0x58bdc1,null))[_0x8886('0x47')](handleError(_0x58bdc1,null));};exports[_0x8886('0x48')]=function(_0x443162,_0x103682){return db['AnalyticCustomReport'][_0x8886('0x48')](_0x443162[_0x8886('0x49')],{})[_0x8886('0x24')](function(_0x5775ff){var _0x214c22=_0x443162[_0x8886('0x4a')][_0x8886('0x4b')]({'plain':!![]});if(!_0x214c22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x214c22[_0x8886('0x4c')]===_0x8886('0x4a')){var _0x41562d=_0x5775ff['get']({'plain':!![]});var _0x347961='Reports';return db[_0x8886('0x4d')][_0x8886('0x46')]({'where':{'name':_0x347961,'userProfileId':_0x214c22['userProfileId']},'raw':!![]})[_0x8886('0x24')](function(_0x4b5d13){if(_0x4b5d13&&_0x4b5d13['autoAssociation']===0x0){return db[_0x8886('0x26')][_0x8886('0x48')]({'name':_0x41562d[_0x8886('0x28')],'resourceId':_0x41562d['id'],'type':_0x8886('0x4e'),'sectionId':_0x4b5d13['id']},{})[_0x8886('0x24')](function(){return _0x5775ff;});}else{return _0x5775ff;}})[_0x8886('0x47')](function(_0x5344ac){logger[_0x8886('0x4f')](_0x8886('0x50'),_0x5344ac);throw _0x5344ac;});}return _0x5775ff;})[_0x8886('0x24')](respondWithResult(_0x103682,0xc9))['catch'](handleError(_0x103682,null));};exports[_0x8886('0x23')]=function(_0x362592,_0x363573){if(_0x362592[_0x8886('0x49')]['id']){delete _0x362592[_0x8886('0x49')]['id'];}return db[_0x8886('0x2c')][_0x8886('0x46')]({'where':{'id':_0x362592[_0x8886('0x44')]['id']}})[_0x8886('0x24')](handleEntityNotFound(_0x363573,null))[_0x8886('0x24')](saveUpdates(_0x362592[_0x8886('0x49')],null))[_0x8886('0x24')](respondWithResult(_0x363573,null))[_0x8886('0x47')](handleError(_0x363573,null));};exports[_0x8886('0x25')]=function(_0x52fdb3,_0x508bb3){return db['AnalyticCustomReport']['find']({'where':{'id':_0x52fdb3[_0x8886('0x44')]['id']}})['then'](handleEntityNotFound(_0x508bb3,null))[_0x8886('0x24')](removeEntity(_0x508bb3,null))['catch'](handleError(_0x508bb3,null));};exports[_0x8886('0x51')]=function(_0xc526f9,_0x370856){var _0x20fc92=0xa;var _0x553e52=[_0x8886('0x52'),_0x8886('0x53'),_0x8886('0x54'),'cross_join'];var _0x7c47b5={'SUM':_0x8886('0x55'),'COUNT':_0x8886('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8886('0x57'),'MIN':_0x8886('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x8886('0x59'),'GROUP_CONCAT ASC':_0x8886('0x5a'),'GROUP_CONCAT DESC':_0x8886('0x5b')};var _0x3e2cc9={'SEC_TO_TIME':_0x8886('0x5c'),'DATE':'DATE(%s)','HOUR':_0x8886('0x5d'),'ROUND':_0x8886('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3a1b8e=function(_0x3bd8e9){return!_[_0x8886('0x5f')]([_0x8886('0x60'),'IS\x20NOT\x20NULL',_0x8886('0x61'),'IS\x20NOT\x20EMPTY'],_0x3bd8e9);};var _0x4785d2=function(_0x144015){if(!_0x144015||!_0x144015['rules'][_0x8886('0x36')]){return'';}for(var _0x25e0c0='(',_0x3002db=0x0;_0x3002db<_0x144015[_0x8886('0x62')][_0x8886('0x36')];_0x3002db+=0x1){_0x3002db>0x0&&(_0x25e0c0+='\x20'+_0x144015[_0x8886('0x63')]+'\x20');_0x25e0c0+=_0x144015[_0x8886('0x62')][_0x3002db][_0x8886('0x64')]?_0x4785d2(_0x144015[_0x8886('0x62')][_0x3002db]['group']):_0x144015[_0x8886('0x62')][_0x3002db][_0x8886('0x65')]+'\x20'+_0x144015[_0x8886('0x62')][_0x3002db][_0x8886('0x66')]+(_0x3a1b8e(_0x144015[_0x8886('0x62')][_0x3002db][_0x8886('0x66')])?'\x20'+_0x144015[_0x8886('0x62')][_0x3002db]['value']:'');}return _0x25e0c0+')';};var _0x5b588e={'where':{'id':_0xc526f9[_0x8886('0x44')]['id']}},_0x3f49b1,_0x118f7e,_0x4beda7,_0x489141,_0x452a2c;_0x5b588e=_[_0x8886('0x3d')]({},_0x5b588e,_0xc526f9[_0x8886('0x45')]);return db['AnalyticCustomReport'][_0x8886('0x46')](_0x5b588e)['then'](function(_0x33409d){if(_0x33409d){_0x3f49b1=_0x33409d;return _0x33409d['getFields']();}return null;})[_0x8886('0x24')](function(_0x403b1d){if(_0x403b1d){if(!_0x403b1d[_0x8886('0x36')]){throw new db[(_0x8886('0x67'))][(_0x8886('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x118f7e=_0x403b1d;return db[_0x8886('0x69')][_0x8886('0x42')]({'raw':!![]});}return null;})[_0x8886('0x24')](function(_0x5a049a){if(_0x5a049a){_0x4beda7=_[_0x8886('0x6a')](_0x5a049a,'id');var _0x409028;var _0x2757d5=squel['select']();_0x2757d5[_0x8886('0x6b')](_0x3f49b1[_0x8886('0x6c')]);for(var _0xef08a=0x0;_0xef08a<_0x118f7e[_0x8886('0x36')];_0xef08a+=0x1){_0x409028=_0x118f7e[_0xef08a][_0x8886('0x6d')]?_0x4beda7[_0x118f7e[_0xef08a][_0x8886('0x6d')]][_0x8886('0x6e')]:_0x118f7e[_0xef08a][_0x8886('0x65')];_0x409028=_0x118f7e[_0xef08a][_0x8886('0x6f')]?_['replace'](_0x7c47b5[_0x118f7e[_0xef08a][_0x8886('0x6f')]],'%s',_0x409028):_0x409028;_0x409028=_0x118f7e[_0xef08a][_0x8886('0x70')]?_[_0x8886('0x71')](_0x3e2cc9[_0x118f7e[_0xef08a]['format']],'%s',_0x409028):_0x409028;if(_0x118f7e[_0xef08a][_0x8886('0x72')]){_0x2757d5[_0x8886('0x64')](_0x409028);}_0x118f7e[_0xef08a][_0x8886('0x73')]&&_0x2757d5[_0x8886('0x39')](_0x409028,_0x118f7e[_0xef08a][_0x8886('0x73')]===_0x8886('0x74')?![]:!![]);_0x2757d5[_0x8886('0x65')](_0x409028,_0x118f7e[_0xef08a]['alias']||_0x409028);}if(_0x3f49b1[_0x8886('0x75')]){_0x3f49b1[_0x8886('0x75')]=JSON[_0x8886('0x76')](_0x3f49b1['joins']);for(var _0x3b94db=0x0;_0x3b94db<_0x3f49b1[_0x8886('0x75')][_0x8886('0x36')];_0x3b94db+=0x1){if(_0x3f49b1[_0x8886('0x75')][_0x3b94db]['type']&&_[_0x8886('0x5f')](_0x553e52,_0x3f49b1[_0x8886('0x75')][_0x3b94db][_0x8886('0x2e')])&&_0x3f49b1[_0x8886('0x75')][_0x3b94db]['parentKey']&&_0x3f49b1['joins'][_0x3b94db][_0x8886('0x77')]&&_0x3f49b1[_0x8886('0x75')][_0x3b94db][_0x8886('0x78')]){_0x2757d5[_0x3f49b1['joins'][_0x3b94db][_0x8886('0x2e')]](_0x3f49b1['joins'][_0x3b94db][_0x8886('0x77')],null,util[_0x8886('0x70')](_0x8886('0x79'),_0x3f49b1['table'],_0x3f49b1[_0x8886('0x75')][_0x3b94db][_0x8886('0x7a')],_0x3f49b1[_0x8886('0x75')][_0x3b94db][_0x8886('0x77')],_0x3f49b1[_0x8886('0x75')][_0x3b94db]['foreignKey']));}}}if(_0x3f49b1[_0x8886('0x7b')]){_0x3f49b1[_0x8886('0x7b')]=JSON[_0x8886('0x76')](_0x3f49b1['conditions']);_0x2757d5[_0x8886('0x3b')](_0x4785d2(_0x3f49b1[_0x8886('0x7b')][_0x8886('0x64')]));}_0x452a2c=_0x2757d5['clone']();_0x2757d5[_0x8886('0x1c')](_0x20fc92);_0x2757d5['offset'](0x0);logger[_0x8886('0x7c')](_0x8886('0x7d'),_0x2757d5[_0x8886('0x7e')]());return db[_0x8886('0x7f')][_0x8886('0x32')](_0x2757d5['toString'](),{'type':db[_0x8886('0x7f')]['QueryTypes'][_0x8886('0x80')]});}})[_0x8886('0x24')](respondWithResult(_0x370856,null))[_0x8886('0x47')](handleError(_0x370856,null));};function runReport(_0x245b36,_0x35c36d,_0x12d00c){var _0x12e27b=_0x35c36d['name'];var _0x5ce50c=0xa;var _0x211333=[_0x8886('0x52'),_0x8886('0x53'),_0x8886('0x54'),_0x8886('0x81')];var _0x133ecb={'SUM':_0x8886('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x8886('0x59'),'GROUP_CONCAT ASC':_0x8886('0x5a'),'GROUP_CONCAT DESC':_0x8886('0x5b')};var _0x3ecbbe={'SEC_TO_TIME':_0x8886('0x5c'),'DATE':_0x8886('0x82'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x8886('0x83')};var _0x227d3d=function(_0x5f5cb7){return!_['includes']([_0x8886('0x60'),'IS\x20NOT\x20NULL',_0x8886('0x61'),_0x8886('0x84')],_0x5f5cb7);};var _0x3b6d9b=function(_0x41e8e3){if(!_0x41e8e3||!_0x41e8e3[_0x8886('0x62')][_0x8886('0x36')]){return'';}for(var _0x20703b='(',_0x2644e9=0x0;_0x2644e9<_0x41e8e3[_0x8886('0x62')]['length'];_0x2644e9+=0x1){_0x2644e9>0x0&&(_0x20703b+='\x20'+_0x41e8e3[_0x8886('0x63')]+'\x20');_0x20703b+=_0x41e8e3[_0x8886('0x62')][_0x2644e9][_0x8886('0x64')]?_0x3b6d9b(_0x41e8e3['rules'][_0x2644e9]['group']):_0x41e8e3['rules'][_0x2644e9][_0x8886('0x65')]+'\x20'+_0x41e8e3['rules'][_0x2644e9][_0x8886('0x66')]+(_0x227d3d(_0x41e8e3[_0x8886('0x62')][_0x2644e9]['condition'])?'\x20'+_0x41e8e3[_0x8886('0x62')][_0x2644e9][_0x8886('0x85')]:'');}return _0x20703b+')';};var _0x15cb87={'where':{'id':_0x245b36['id']}},_0x4fc870,_0xc9fb45,_0x2eede3,_0xa1d03c,_0x18011a;_0x15cb87=_[_0x8886('0x3d')]({},_0x15cb87,_0x12d00c);return db['AnalyticCustomReport'][_0x8886('0x46')](_0x15cb87)['then'](function(_0x23b391){if(_0x23b391){_0x4fc870=_0x23b391;return _0x23b391['getFields']();}return null;})[_0x8886('0x24')](function(_0x329274){if(_0x329274){if(!_0x329274[_0x8886('0x36')]){throw new db[(_0x8886('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xc9fb45=_0x329274;return db[_0x8886('0x69')][_0x8886('0x42')]({'raw':!![]});}return null;})[_0x8886('0x24')](function(_0x4bc379){if(_0x4bc379){_0x2eede3=_[_0x8886('0x6a')](_0x4bc379,'id');var _0xe863a;var _0xc2b204=squel[_0x8886('0x86')]();_0xc2b204[_0x8886('0x6b')](_0x4fc870[_0x8886('0x6c')]);for(var _0xa31d55=0x0;_0xa31d55<_0xc9fb45['length'];_0xa31d55+=0x1){_0xe863a=_0xc9fb45[_0xa31d55][_0x8886('0x6d')]?_0x2eede3[_0xc9fb45[_0xa31d55][_0x8886('0x6d')]]['metric']:_0xc9fb45[_0xa31d55][_0x8886('0x65')];_0xe863a=_0xc9fb45[_0xa31d55][_0x8886('0x6f')]?_[_0x8886('0x71')](_0x133ecb[_0xc9fb45[_0xa31d55][_0x8886('0x6f')]],'%s',_0xe863a):_0xe863a;_0xe863a=_0xc9fb45[_0xa31d55]['format']?_['replace'](_0x3ecbbe[_0xc9fb45[_0xa31d55]['format']],'%s',_0xe863a):_0xe863a;if(_0xc9fb45[_0xa31d55][_0x8886('0x72')]){_0xc2b204['group'](_0xe863a);}_0xc9fb45[_0xa31d55][_0x8886('0x73')]&&_0xc2b204[_0x8886('0x39')](_0xe863a,_0xc9fb45[_0xa31d55][_0x8886('0x73')]===_0x8886('0x74')?![]:!![]);_0xc2b204[_0x8886('0x65')](_0xe863a,_0xc9fb45[_0xa31d55]['alias']||_0xe863a);}if(_0x4fc870[_0x8886('0x75')]){_0x4fc870[_0x8886('0x75')]=JSON[_0x8886('0x76')](_0x4fc870['joins']);for(var _0x18f3cf=0x0;_0x18f3cf<_0x4fc870[_0x8886('0x75')][_0x8886('0x36')];_0x18f3cf+=0x1){if(_0x4fc870[_0x8886('0x75')][_0x18f3cf][_0x8886('0x2e')]&&_[_0x8886('0x5f')](_0x211333,_0x4fc870['joins'][_0x18f3cf][_0x8886('0x2e')])&&_0x4fc870[_0x8886('0x75')][_0x18f3cf][_0x8886('0x7a')]&&_0x4fc870[_0x8886('0x75')][_0x18f3cf]['foreignTable']&&_0x4fc870[_0x8886('0x75')][_0x18f3cf][_0x8886('0x78')]){_0xc2b204[_0x4fc870[_0x8886('0x75')][_0x18f3cf][_0x8886('0x2e')]](_0x4fc870[_0x8886('0x75')][_0x18f3cf][_0x8886('0x77')],null,util[_0x8886('0x70')](_0x8886('0x79'),_0x4fc870['table'],_0x4fc870[_0x8886('0x75')][_0x18f3cf][_0x8886('0x7a')],_0x4fc870[_0x8886('0x75')][_0x18f3cf][_0x8886('0x77')],_0x4fc870[_0x8886('0x75')][_0x18f3cf][_0x8886('0x78')]));}}}if(_0x4fc870[_0x8886('0x7b')]){_0x4fc870[_0x8886('0x7b')]=JSON['parse'](_0x4fc870['conditions']);_0xc2b204[_0x8886('0x3b')](_0x3b6d9b(_0x4fc870[_0x8886('0x7b')]['group']));}_0x18011a=_0xc2b204[_0x8886('0x87')]();_0xc2b204[_0x8886('0x1c')](_0x5ce50c);_0xc2b204[_0x8886('0x1b')](0x0);logger['debug'](_0x8886('0x7d'),_0xc2b204[_0x8886('0x7e')]());return db['sequelize'][_0x8886('0x32')](_0xc2b204[_0x8886('0x7e')](),{'type':db[_0x8886('0x7f')]['QueryTypes'][_0x8886('0x80')]});}})[_0x8886('0x24')](function(_0x460900){if(!_0x460900[_0x8886('0x36')]){throw new db[(_0x8886('0x67'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x35c36d['output']===_0x8886('0x88')){return null;}var _0x4be084=_[_0x8886('0x3d')](_0x35c36d,{'name':_0x35c36d[_0x8886('0x89')]||_0x35c36d[_0x8886('0x28')]||_0x4fc870[_0x8886('0x28')],'basename':_0x12e27b,'savename':util[_0x8886('0x70')](_0x8886('0x8a'),_0x35c36d[_0x8886('0x28')]||_0x4fc870['name'],require('randomstring')['generate'](0x4),_0x35c36d[_0x8886('0x8b')]||_0x8886('0x8c')),'reportId':_0x4fc870['id'],'reportType':_0x8886('0x8d')});return db[_0x8886('0x8e')][_0x8886('0x48')](_0x4be084,{'raw':!![]});})[_0x8886('0x24')](function(_0x117113){if(_0x4fc870[_0x8886('0x6c')]===_0x8886('0x8f')){_0x18011a[_0x8886('0x3b')](_0x4fc870[_0x8886('0x6c')]+_0x8886('0x90'),_0x35c36d[_0x8886('0x91')],_0x35c36d[_0x8886('0x92')]);}else{_0x18011a[_0x8886('0x3b')](_0x4fc870[_0x8886('0x6c')]+_0x8886('0x93'),_0x35c36d[_0x8886('0x91')],_0x35c36d[_0x8886('0x92')]);}if(_0x117113){logger[_0x8886('0x94')](_0x8886('0x95'),_0x18011a[_0x8886('0x7e')]());require(_0x8886('0x96'))[_0x8886('0x97')](path['join'](__dirname,_0x8886('0x98'),_0x117113[_0x8886('0x8b')]),[_0x117113['id'],_0x18011a[_0x8886('0x7e')](),path['join'](__dirname,'../../files/reports',_0x117113[_0x8886('0x99')]),_0x12e27b]);return _0x117113;}else{var _0x82c59f=squel[_0x8886('0x86')]();_0x82c59f[_0x8886('0x6b')]('('+_0x18011a[_0x8886('0x7e')]()+')',_0x8886('0x9a'));_0x82c59f[_0x8886('0x65')](_0x8886('0x9b'),_0x8886('0x1a'));_0x18011a[_0x8886('0x1c')](_0x35c36d['limit']||_0x5ce50c);_0x18011a['offset'](_0x35c36d[_0x8886('0x1b')]||0x0);return dbH['sequelize'][_0x8886('0x32')](_0x82c59f[_0x8886('0x7e')](),{'type':dbH[_0x8886('0x7f')][_0x8886('0x9c')][_0x8886('0x80')]})[_0x8886('0x24')](function(_0x50068b){if(!_0x50068b[_0x8886('0x36')]){_0xa1d03c=0x0;}else{_0xa1d03c=_0x50068b[0x0][_0x8886('0x1a')]||0x0;}return dbH['sequelize']['query'](_0x18011a[_0x8886('0x7e')](),{'type':dbH[_0x8886('0x7f')][_0x8886('0x9c')][_0x8886('0x80')]});})[_0x8886('0x24')](function(_0x213f4f){return{'rows':_0x213f4f||[],'count':_0xa1d03c};});}});}exports['run']=function(_0x3799d0,_0x49eecc){return runReport(_0x3799d0[_0x8886('0x44')],_0x3799d0[_0x8886('0x32')],_0x3799d0[_0x8886('0x45')])[_0x8886('0x24')](respondWithResult(_0x49eecc,null))['catch'](handleError(_0x49eecc,null));};exports[_0x8886('0x9d')]=runReport;exports['query']=function(_0x17fae1,_0x117977){var _0x4895a9=0xa;var _0x50c7d4=[_0x8886('0x52'),_0x8886('0x53'),'right_join',_0x8886('0x81')];var _0x500198={'SUM':_0x8886('0x55'),'COUNT':_0x8886('0x56'),'COUNT DISTINCT':_0x8886('0x9e'),'MAX':_0x8886('0x57'),'MIN':'MIN(%s)','AVG':_0x8886('0x9f'),'GROUP_CONCAT':_0x8886('0x59'),'GROUP_CONCAT ASC':_0x8886('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3d8838={'SEC_TO_TIME':_0x8886('0x5c'),'DATE':_0x8886('0x82'),'HOUR':_0x8886('0x5d'),'ROUND':_0x8886('0x5e'),'UNIX_TIMESTAMP':_0x8886('0x83')};var _0x34ebfe=function(_0x1d2db1){return!_[_0x8886('0x5f')]([_0x8886('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x8886('0x84')],_0x1d2db1);};var _0x1c98c1=function(_0x59c6c8){if(!_0x59c6c8||!_0x59c6c8[_0x8886('0x62')][_0x8886('0x36')]){return'';}for(var _0x6d7d83='(',_0x4254e9=0x0;_0x4254e9<_0x59c6c8['rules'][_0x8886('0x36')];_0x4254e9+=0x1){_0x4254e9>0x0&&(_0x6d7d83+='\x20'+_0x59c6c8[_0x8886('0x63')]+'\x20');_0x6d7d83+=_0x59c6c8[_0x8886('0x62')][_0x4254e9][_0x8886('0x64')]?_0x1c98c1(_0x59c6c8[_0x8886('0x62')][_0x4254e9][_0x8886('0x64')]):_0x59c6c8['rules'][_0x4254e9][_0x8886('0x65')]+'\x20'+_0x59c6c8['rules'][_0x4254e9][_0x8886('0x66')]+(_0x34ebfe(_0x59c6c8[_0x8886('0x62')][_0x4254e9][_0x8886('0x66')])?'\x20'+_0x59c6c8[_0x8886('0x62')][_0x4254e9][_0x8886('0x85')]:'');}return _0x6d7d83+')';};var _0xe8221e={'where':{'id':_0x17fae1[_0x8886('0x44')]['id']}},_0x154fa9,_0x1754aa,_0x192377,_0x1e6016,_0x8861cd;_0xe8221e=_[_0x8886('0x3d')]({},_0xe8221e,_0x17fae1['options']);return db[_0x8886('0x2c')]['find'](_0xe8221e)[_0x8886('0x24')](function(_0xba9245){if(_0xba9245){_0x154fa9=_0xba9245;return _0xba9245[_0x8886('0xa0')]();}return null;})[_0x8886('0x24')](function(_0x2f6a6e){if(_0x2f6a6e){if(!_0x2f6a6e[_0x8886('0x36')]){throw new db[(_0x8886('0x67'))][(_0x8886('0x68'))](_0x8886('0xa1'),0x193);}_0x1754aa=_0x2f6a6e;return db['AnalyticMetric'][_0x8886('0x42')]({'raw':!![]});}return null;})[_0x8886('0x24')](function(_0x4d90f3){if(_0x4d90f3){_0x192377=_[_0x8886('0x6a')](_0x4d90f3,'id');var _0xa69acd;var _0x492bd0=squel['select']();_0x492bd0['from'](_0x154fa9['table']);for(var _0x31a4e3=0x0;_0x31a4e3<_0x1754aa[_0x8886('0x36')];_0x31a4e3+=0x1){_0xa69acd=_0x1754aa[_0x31a4e3][_0x8886('0x6d')]?_0x192377[_0x1754aa[_0x31a4e3][_0x8886('0x6d')]][_0x8886('0x6e')]:_0x1754aa[_0x31a4e3][_0x8886('0x65')];_0xa69acd=_0x1754aa[_0x31a4e3]['function']?_[_0x8886('0x71')](_0x500198[_0x1754aa[_0x31a4e3][_0x8886('0x6f')]],'%s',_0xa69acd):_0xa69acd;_0xa69acd=_0x1754aa[_0x31a4e3][_0x8886('0x70')]?_[_0x8886('0x71')](_0x3d8838[_0x1754aa[_0x31a4e3][_0x8886('0x70')]],'%s',_0xa69acd):_0xa69acd;if(_0x1754aa[_0x31a4e3][_0x8886('0x72')]){_0x492bd0[_0x8886('0x64')](_0xa69acd);}_0x1754aa[_0x31a4e3][_0x8886('0x73')]&&_0x492bd0[_0x8886('0x39')](_0xa69acd,_0x1754aa[_0x31a4e3]['orderBy']==='DESC'?![]:!![]);_0x492bd0[_0x8886('0x65')](_0xa69acd,_0x1754aa[_0x31a4e3]['alias']||_0xa69acd);}if(_0x154fa9[_0x8886('0x75')]){_0x154fa9[_0x8886('0x75')]=JSON[_0x8886('0x76')](_0x154fa9[_0x8886('0x75')]);for(var _0x1295bd=0x0;_0x1295bd<_0x154fa9[_0x8886('0x75')][_0x8886('0x36')];_0x1295bd+=0x1){if(_0x154fa9['joins'][_0x1295bd][_0x8886('0x2e')]&&_[_0x8886('0x5f')](_0x50c7d4,_0x154fa9[_0x8886('0x75')][_0x1295bd][_0x8886('0x2e')])&&_0x154fa9[_0x8886('0x75')][_0x1295bd][_0x8886('0x7a')]&&_0x154fa9[_0x8886('0x75')][_0x1295bd][_0x8886('0x77')]&&_0x154fa9[_0x8886('0x75')][_0x1295bd][_0x8886('0x78')]){_0x492bd0[_0x154fa9[_0x8886('0x75')][_0x1295bd][_0x8886('0x2e')]](_0x154fa9[_0x8886('0x75')][_0x1295bd][_0x8886('0x77')],null,util[_0x8886('0x70')]('%s.%s\x20=\x20%s.%s',_0x154fa9[_0x8886('0x6c')],_0x154fa9['joins'][_0x1295bd][_0x8886('0x7a')],_0x154fa9[_0x8886('0x75')][_0x1295bd][_0x8886('0x77')],_0x154fa9[_0x8886('0x75')][_0x1295bd][_0x8886('0x78')]));}}}if(_0x154fa9[_0x8886('0x7b')]){_0x154fa9[_0x8886('0x7b')]=JSON['parse'](_0x154fa9[_0x8886('0x7b')]);_0x492bd0[_0x8886('0x3b')](_0x1c98c1(_0x154fa9[_0x8886('0x7b')][_0x8886('0x64')]));}_0x8861cd=_0x492bd0[_0x8886('0x87')]();_0x492bd0[_0x8886('0x1c')](_0x4895a9);_0x492bd0[_0x8886('0x1b')](0x0);logger[_0x8886('0x7c')](_0x8886('0x7d'),_0x492bd0['toString']());return db[_0x8886('0x7f')][_0x8886('0x32')](_0x492bd0[_0x8886('0x7e')](),{'type':db[_0x8886('0x7f')][_0x8886('0x9c')][_0x8886('0x80')]});}})[_0x8886('0x24')](function(){return{'sql':_0x8861cd[_0x8886('0x7e')]()};})[_0x8886('0x24')](respondWithResult(_0x117977,null))['catch'](handleError(_0x117977,null));}; \ No newline at end of file +var _0x8ccb=['end','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','AnalyticCustomReport','includeAll','include','findAll','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','UNIX_TIMESTAMP(%s)','operator','Sequelize','keyBy','from','alias','No\x20available\x20data','web','fullPath','%s-%s.%s','randomstring','generate','output','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','params','getFields','ValidationErrorItem','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0xa28b1a,_0x384f4b){_0xa28b1a=_0xa28b1a-0x0;var _0x4c9b78=_0x8ccb[_0xa28b1a];return _0x4c9b78;};'use strict';var pdf=require(_0xb8cc('0x0'));var emlformat=require(_0xb8cc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb8cc('0x2'));var jsonpatch=require(_0xb8cc('0x3'));var rp=require(_0xb8cc('0x4'));var moment=require(_0xb8cc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb8cc('0x6'));var path=require(_0xb8cc('0x7'));var sox=require(_0xb8cc('0x8'));var csv=require('to-csv');var ejs=require(_0xb8cc('0x9'));var fs=require('fs');var _=require(_0xb8cc('0xa'));var squel=require(_0xb8cc('0xb'));var crypto=require('crypto');var jsforce=require(_0xb8cc('0xc'));var deskjs=require(_0xb8cc('0xd'));var toCsv=require(_0xb8cc('0xe'));var querystring=require('querystring');var Papa=require(_0xb8cc('0xf'));var Redis=require(_0xb8cc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb8cc('0x11'));var hardwareService=require(_0xb8cc('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb8cc('0x13'));var config=require(_0xb8cc('0x14'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb8cc('0x15'))[_0xb8cc('0x16')];function respondWithStatusCode(_0xfd89e0,_0x2875e0){_0x2875e0=_0x2875e0||0xcc;return function(_0x4157db){if(_0x4157db){return _0xfd89e0[_0xb8cc('0x17')](_0x2875e0);}return _0xfd89e0[_0xb8cc('0x18')](_0x2875e0)['end']();};}function respondWithResult(_0x11ecf2,_0x5ec8a7){_0x5ec8a7=_0x5ec8a7||0xc8;return function(_0x2f876e){if(_0x2f876e){return _0x11ecf2[_0xb8cc('0x18')](_0x5ec8a7)[_0xb8cc('0x19')](_0x2f876e);}};}function respondWithFilteredResult(_0x5f3b91,_0x1f8b8d){return function(_0x274cab){if(_0x274cab){var _0x4663d4=_0x274cab[_0xb8cc('0x1a')],_0x4bc6dd=_0x1f8b8d['offset'],_0x2ba498=_0x1f8b8d[_0xb8cc('0x1b')]+_0x1f8b8d[_0xb8cc('0x1c')],_0x50185a;if(_0x2ba498>=_0x4663d4){_0x2ba498=_0x4663d4;_0x50185a=0xc8;}else{_0x50185a=0xce;}_0x5f3b91[_0xb8cc('0x18')](_0x50185a);return _0x5f3b91[_0xb8cc('0x1d')](_0xb8cc('0x1e'),_0x4bc6dd+'-'+_0x2ba498+'/'+_0x4663d4)['json'](_0x274cab);}return null;};}function patchUpdates(_0x1c1022){return function(_0x1e9769){try{jsonpatch[_0xb8cc('0x1f')](_0x1e9769,_0x1c1022,!![]);}catch(_0x500120){return BPromise[_0xb8cc('0x20')](_0x500120);}return _0x1e9769[_0xb8cc('0x21')]();};}function saveUpdates(_0x4a7aac,_0x9b0aba){return function(_0xe5ad50){if(_0xe5ad50){return _0xe5ad50['update'](_0x4a7aac)[_0xb8cc('0x22')](function(_0xdcb33d){return _0xdcb33d;});}return null;};}function removeEntity(_0xd1c676,_0x1d372c){return function(_0x26fba9){if(_0x26fba9){return _0x26fba9[_0xb8cc('0x23')]()[_0xb8cc('0x22')](function(){var _0x59608c=_0x26fba9['get']({'plain':!![]});var _0x8b6b21='CustomReports';return db[_0xb8cc('0x24')]['destroy']({'where':{'type':_0x8b6b21,'resourceId':_0x59608c['id']}})[_0xb8cc('0x22')](function(){return _0x26fba9;});})[_0xb8cc('0x22')](function(){_0xd1c676[_0xb8cc('0x18')](0xcc)[_0xb8cc('0x25')]();});}};}function handleEntityNotFound(_0x56ed01,_0x2c4aa0){return function(_0x2cc7f3){if(!_0x2cc7f3){_0x56ed01[_0xb8cc('0x17')](0x194);}return _0x2cc7f3;};}function handleError(_0x13acba,_0x22b99a){_0x22b99a=_0x22b99a||0x1f4;return function(_0x491a03){logger['error'](_0x491a03[_0xb8cc('0x26')]);if(_0x491a03[_0xb8cc('0x27')]){delete _0x491a03['name'];}_0x13acba[_0xb8cc('0x18')](_0x22b99a)['send'](_0x491a03);};}exports[_0xb8cc('0x28')]=function(_0x2634a4,_0x1d1514){var _0x118a18={},_0x4e3883={},_0x37daf0={'count':0x0,'rows':[]};var _0x1fc4ac=_[_0xb8cc('0x29')](db['AnalyticCustomReport'][_0xb8cc('0x2a')],function(_0x59e850){return{'name':_0x59e850[_0xb8cc('0x2b')],'type':_0x59e850['type'][_0xb8cc('0x2c')]};});_0x4e3883[_0xb8cc('0x2d')]=_['map'](_0x1fc4ac,_0xb8cc('0x27'));_0x4e3883[_0xb8cc('0x2e')]=_[_0xb8cc('0x2f')](_0x2634a4[_0xb8cc('0x2e')]);_0x4e3883[_0xb8cc('0x30')]=_[_0xb8cc('0x31')](_0x4e3883[_0xb8cc('0x2d')],_0x4e3883['query']);_0x118a18['attributes']=_[_0xb8cc('0x31')](_0x4e3883['model'],qs[_0xb8cc('0x32')](_0x2634a4['query']['fields']));_0x118a18[_0xb8cc('0x33')]=_0x118a18[_0xb8cc('0x33')][_0xb8cc('0x34')]?_0x118a18['attributes']:_0x4e3883[_0xb8cc('0x2d')];if(!_0x2634a4[_0xb8cc('0x2e')][_0xb8cc('0x35')](_0xb8cc('0x36'))){_0x118a18[_0xb8cc('0x1c')]=qs[_0xb8cc('0x1c')](_0x2634a4[_0xb8cc('0x2e')][_0xb8cc('0x1c')]);_0x118a18[_0xb8cc('0x1b')]=qs[_0xb8cc('0x1b')](_0x2634a4[_0xb8cc('0x2e')][_0xb8cc('0x1b')]);}_0x118a18[_0xb8cc('0x37')]=qs[_0xb8cc('0x38')](_0x2634a4[_0xb8cc('0x2e')][_0xb8cc('0x38')]);_0x118a18[_0xb8cc('0x39')]=qs[_0xb8cc('0x30')](_['pick'](_0x2634a4['query'],_0x4e3883[_0xb8cc('0x30')]),_0x1fc4ac);if(_0x2634a4[_0xb8cc('0x2e')][_0xb8cc('0x3a')]){_0x118a18[_0xb8cc('0x39')]=_[_0xb8cc('0x3b')](_0x118a18[_0xb8cc('0x39')],{'$or':_[_0xb8cc('0x29')](_0x1fc4ac,function(_0x1564e9){if(_0x1564e9[_0xb8cc('0x3c')]!=='VIRTUAL'){var _0x5f5b62={};_0x5f5b62[_0x1564e9['name']]={'$like':'%'+_0x2634a4['query'][_0xb8cc('0x3a')]+'%'};return _0x5f5b62;}})});}_0x118a18=_['merge']({},_0x118a18,_0x2634a4[_0xb8cc('0x3d')]);var _0x4affc5={'where':_0x118a18[_0xb8cc('0x39')]};return db[_0xb8cc('0x3e')][_0xb8cc('0x1a')](_0x4affc5)[_0xb8cc('0x22')](function(_0x1d4a83){_0x37daf0['count']=_0x1d4a83;if(_0x2634a4[_0xb8cc('0x2e')][_0xb8cc('0x3f')]){_0x118a18[_0xb8cc('0x40')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xb8cc('0x41')](_0x118a18);})['then'](function(_0x4ba848){_0x37daf0['rows']=_0x4ba848;return _0x37daf0;})[_0xb8cc('0x22')](respondWithFilteredResult(_0x1d1514,_0x118a18))[_0xb8cc('0x42')](handleError(_0x1d1514,null));};exports[_0xb8cc('0x43')]=function(_0x3f3a96,_0x51b0e5){var _0x4ba0ae={'raw':![],'where':{'id':_0x3f3a96['params']['id']}},_0x231d78={};_0x231d78['model']=_[_0xb8cc('0x2f')](db[_0xb8cc('0x3e')][_0xb8cc('0x2a')]);_0x231d78[_0xb8cc('0x2e')]=_['keys'](_0x3f3a96[_0xb8cc('0x2e')]);_0x231d78[_0xb8cc('0x30')]=_['intersection'](_0x231d78[_0xb8cc('0x2d')],_0x231d78[_0xb8cc('0x2e')]);_0x4ba0ae[_0xb8cc('0x33')]=_[_0xb8cc('0x31')](_0x231d78[_0xb8cc('0x2d')],qs[_0xb8cc('0x32')](_0x3f3a96[_0xb8cc('0x2e')]['fields']));_0x4ba0ae[_0xb8cc('0x33')]=_0x4ba0ae[_0xb8cc('0x33')][_0xb8cc('0x34')]?_0x4ba0ae[_0xb8cc('0x33')]:_0x231d78[_0xb8cc('0x2d')];if(_0x3f3a96[_0xb8cc('0x2e')][_0xb8cc('0x3f')]){_0x4ba0ae['include']=[{'all':!![]}];}_0x4ba0ae=_[_0xb8cc('0x3b')]({},_0x4ba0ae,_0x3f3a96['options']);return db['AnalyticCustomReport']['find'](_0x4ba0ae)[_0xb8cc('0x22')](handleEntityNotFound(_0x51b0e5,null))[_0xb8cc('0x22')](respondWithResult(_0x51b0e5,null))[_0xb8cc('0x42')](handleError(_0x51b0e5,null));};exports[_0xb8cc('0x44')]=function(_0x5b4a45,_0x5a91a0){return db[_0xb8cc('0x3e')][_0xb8cc('0x44')](_0x5b4a45[_0xb8cc('0x45')],{})[_0xb8cc('0x22')](function(_0x3216a4){var _0x34a8a5=_0x5b4a45[_0xb8cc('0x46')][_0xb8cc('0x47')]({'plain':!![]});if(!_0x34a8a5)throw new Error(_0xb8cc('0x48'));if(_0x34a8a5[_0xb8cc('0x49')]==='user'){var _0x453af7=_0x3216a4[_0xb8cc('0x47')]({'plain':!![]});var _0x3b1e24=_0xb8cc('0x4a');return db['UserProfileSection'][_0xb8cc('0x4b')]({'where':{'name':_0x3b1e24,'userProfileId':_0x34a8a5[_0xb8cc('0x4c')]},'raw':!![]})[_0xb8cc('0x22')](function(_0x5d22bd){if(_0x5d22bd&&_0x5d22bd[_0xb8cc('0x4d')]===0x0){return db[_0xb8cc('0x24')][_0xb8cc('0x44')]({'name':_0x453af7['name'],'resourceId':_0x453af7['id'],'type':_0xb8cc('0x4e'),'sectionId':_0x5d22bd['id']},{})[_0xb8cc('0x22')](function(){return _0x3216a4;});}else{return _0x3216a4;}})[_0xb8cc('0x42')](function(_0xaeb76){logger[_0xb8cc('0x4f')](_0xb8cc('0x50'),_0xaeb76);throw _0xaeb76;});}return _0x3216a4;})['then'](respondWithResult(_0x5a91a0,0xc9))[_0xb8cc('0x42')](handleError(_0x5a91a0,null));};exports[_0xb8cc('0x51')]=function(_0x2ced82,_0x31b89b){if(_0x2ced82['body']['id']){delete _0x2ced82[_0xb8cc('0x45')]['id'];}return db[_0xb8cc('0x3e')][_0xb8cc('0x4b')]({'where':{'id':_0x2ced82['params']['id']}})[_0xb8cc('0x22')](handleEntityNotFound(_0x31b89b,null))[_0xb8cc('0x22')](saveUpdates(_0x2ced82[_0xb8cc('0x45')],null))[_0xb8cc('0x22')](respondWithResult(_0x31b89b,null))[_0xb8cc('0x42')](handleError(_0x31b89b,null));};exports[_0xb8cc('0x23')]=function(_0x2ac6ba,_0xba1e1b){return db[_0xb8cc('0x3e')]['find']({'where':{'id':_0x2ac6ba['params']['id']}})[_0xb8cc('0x22')](handleEntityNotFound(_0xba1e1b,null))[_0xb8cc('0x22')](removeEntity(_0xba1e1b,null))['catch'](handleError(_0xba1e1b,null));};exports['preview']=function(_0xf8e17,_0xa84996){var _0x3bf493=0xa;var _0x2404e1=[_0xb8cc('0x52'),'left_join',_0xb8cc('0x53'),_0xb8cc('0x54')];var _0x14600c={'SUM':'SUM(%s)','COUNT':_0xb8cc('0x55'),'COUNT DISTINCT':_0xb8cc('0x56'),'MAX':_0xb8cc('0x57'),'MIN':_0xb8cc('0x58'),'AVG':_0xb8cc('0x59'),'GROUP_CONCAT':_0xb8cc('0x5a'),'GROUP_CONCAT ASC':_0xb8cc('0x5b'),'GROUP_CONCAT DESC':_0xb8cc('0x5c')};var _0x142ebf={'SEC_TO_TIME':_0xb8cc('0x5d'),'DATE':_0xb8cc('0x5e'),'HOUR':_0xb8cc('0x5f'),'ROUND':_0xb8cc('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x56aa7d=function(_0x49389d){return!_[_0xb8cc('0x61')]([_0xb8cc('0x62'),_0xb8cc('0x63'),_0xb8cc('0x64'),_0xb8cc('0x65')],_0x49389d);};var _0x175fd4=function(_0x51f7dd){if(!_0x51f7dd||!_0x51f7dd['rules']['length']){return'';}for(var _0x714811='(',_0x3eddf4=0x0;_0x3eddf4<_0x51f7dd[_0xb8cc('0x66')][_0xb8cc('0x34')];_0x3eddf4+=0x1){_0x3eddf4>0x0&&(_0x714811+='\x20'+_0x51f7dd['operator']+'\x20');_0x714811+=_0x51f7dd['rules'][_0x3eddf4][_0xb8cc('0x67')]?_0x175fd4(_0x51f7dd[_0xb8cc('0x66')][_0x3eddf4][_0xb8cc('0x67')]):_0x51f7dd['rules'][_0x3eddf4][_0xb8cc('0x68')]+'\x20'+_0x51f7dd[_0xb8cc('0x66')][_0x3eddf4]['condition']+(_0x56aa7d(_0x51f7dd['rules'][_0x3eddf4][_0xb8cc('0x69')])?'\x20'+_0x51f7dd[_0xb8cc('0x66')][_0x3eddf4][_0xb8cc('0x6a')]:'');}return _0x714811+')';};var _0x10d93a={'where':{'id':_0xf8e17['params']['id']}},_0x2c9ff5,_0x1858e5,_0x7481fd,_0x4eeb36,_0x24491e;_0x10d93a=_['merge']({},_0x10d93a,_0xf8e17[_0xb8cc('0x3d')]);return db['AnalyticCustomReport'][_0xb8cc('0x4b')](_0x10d93a)['then'](function(_0x1a2b54){if(_0x1a2b54){_0x2c9ff5=_0x1a2b54;return _0x1a2b54['getFields']();}return null;})[_0xb8cc('0x22')](function(_0x3eccde){if(_0x3eccde){if(!_0x3eccde[_0xb8cc('0x34')]){throw new db['Sequelize']['ValidationErrorItem'](_0xb8cc('0x6b'),0x193);}_0x1858e5=_0x3eccde;return db[_0xb8cc('0x6c')][_0xb8cc('0x41')]({'raw':!![]});}return null;})[_0xb8cc('0x22')](function(_0x510212){if(_0x510212){_0x7481fd=_['keyBy'](_0x510212,'id');var _0x412d56;var _0x28bfce=squel[_0xb8cc('0x6d')]();_0x28bfce['from'](_0x2c9ff5[_0xb8cc('0x6e')]);for(var _0x4cc4bd=0x0;_0x4cc4bd<_0x1858e5[_0xb8cc('0x34')];_0x4cc4bd+=0x1){_0x412d56=_0x1858e5[_0x4cc4bd]['MetricId']?_0x7481fd[_0x1858e5[_0x4cc4bd][_0xb8cc('0x6f')]][_0xb8cc('0x70')]:_0x1858e5[_0x4cc4bd][_0xb8cc('0x68')];_0x412d56=_0x1858e5[_0x4cc4bd][_0xb8cc('0x71')]?_[_0xb8cc('0x72')](_0x14600c[_0x1858e5[_0x4cc4bd][_0xb8cc('0x71')]],'%s',_0x412d56):_0x412d56;_0x412d56=_0x1858e5[_0x4cc4bd][_0xb8cc('0x73')]?_[_0xb8cc('0x72')](_0x142ebf[_0x1858e5[_0x4cc4bd][_0xb8cc('0x73')]],'%s',_0x412d56):_0x412d56;if(_0x1858e5[_0x4cc4bd][_0xb8cc('0x74')]){_0x28bfce['group'](_0x412d56);}_0x1858e5[_0x4cc4bd]['orderBy']&&_0x28bfce['order'](_0x412d56,_0x1858e5[_0x4cc4bd][_0xb8cc('0x75')]===_0xb8cc('0x76')?![]:!![]);_0x28bfce['field'](_0x412d56,_0x1858e5[_0x4cc4bd]['alias']||_0x412d56);}if(_0x2c9ff5[_0xb8cc('0x77')]){_0x2c9ff5[_0xb8cc('0x77')]=JSON['parse'](_0x2c9ff5[_0xb8cc('0x77')]);for(var _0x4bf010=0x0;_0x4bf010<_0x2c9ff5[_0xb8cc('0x77')]['length'];_0x4bf010+=0x1){if(_0x2c9ff5[_0xb8cc('0x77')][_0x4bf010][_0xb8cc('0x3c')]&&_['includes'](_0x2404e1,_0x2c9ff5[_0xb8cc('0x77')][_0x4bf010][_0xb8cc('0x3c')])&&_0x2c9ff5[_0xb8cc('0x77')][_0x4bf010][_0xb8cc('0x78')]&&_0x2c9ff5[_0xb8cc('0x77')][_0x4bf010]['foreignTable']&&_0x2c9ff5[_0xb8cc('0x77')][_0x4bf010][_0xb8cc('0x79')]){_0x28bfce[_0x2c9ff5['joins'][_0x4bf010][_0xb8cc('0x3c')]](_0x2c9ff5[_0xb8cc('0x77')][_0x4bf010][_0xb8cc('0x7a')],null,util[_0xb8cc('0x73')](_0xb8cc('0x7b'),_0x2c9ff5['table'],_0x2c9ff5[_0xb8cc('0x77')][_0x4bf010][_0xb8cc('0x78')],_0x2c9ff5[_0xb8cc('0x77')][_0x4bf010][_0xb8cc('0x7a')],_0x2c9ff5['joins'][_0x4bf010]['foreignKey']));}}}if(_0x2c9ff5['conditions']){_0x2c9ff5[_0xb8cc('0x7c')]=JSON[_0xb8cc('0x7d')](_0x2c9ff5[_0xb8cc('0x7c')]);_0x28bfce[_0xb8cc('0x39')](_0x175fd4(_0x2c9ff5[_0xb8cc('0x7c')]['group']));}_0x24491e=_0x28bfce[_0xb8cc('0x7e')]();_0x28bfce[_0xb8cc('0x1c')](_0x3bf493);_0x28bfce['offset'](0x0);logger[_0xb8cc('0x7f')](_0xb8cc('0x80'),_0x28bfce[_0xb8cc('0x81')]());return db[_0xb8cc('0x82')][_0xb8cc('0x2e')](_0x28bfce[_0xb8cc('0x81')](),{'type':db[_0xb8cc('0x82')][_0xb8cc('0x83')][_0xb8cc('0x84')]});}})[_0xb8cc('0x22')](respondWithResult(_0xa84996,null))['catch'](handleError(_0xa84996,null));};function runReport(_0x35178a,_0x73e192,_0x2cce64){var _0x270fcc=_0x73e192[_0xb8cc('0x27')];var _0x461b2e=0xa;var _0x1fe714=[_0xb8cc('0x52'),_0xb8cc('0x85'),'right_join','cross_join'];var _0x164b6d={'SUM':'SUM(%s)','COUNT':_0xb8cc('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb8cc('0x57'),'MIN':_0xb8cc('0x58'),'AVG':_0xb8cc('0x59'),'GROUP_CONCAT':_0xb8cc('0x5a'),'GROUP_CONCAT ASC':_0xb8cc('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x37e16f={'SEC_TO_TIME':_0xb8cc('0x5d'),'DATE':_0xb8cc('0x5e'),'HOUR':_0xb8cc('0x5f'),'ROUND':_0xb8cc('0x60'),'UNIX_TIMESTAMP':_0xb8cc('0x86')};var _0x188b18=function(_0x523375){return!_[_0xb8cc('0x61')]([_0xb8cc('0x62'),'IS\x20NOT\x20NULL',_0xb8cc('0x64'),_0xb8cc('0x65')],_0x523375);};var _0x414644=function(_0x4a5b41){if(!_0x4a5b41||!_0x4a5b41[_0xb8cc('0x66')][_0xb8cc('0x34')]){return'';}for(var _0x186e73='(',_0x208713=0x0;_0x208713<_0x4a5b41['rules'][_0xb8cc('0x34')];_0x208713+=0x1){_0x208713>0x0&&(_0x186e73+='\x20'+_0x4a5b41[_0xb8cc('0x87')]+'\x20');_0x186e73+=_0x4a5b41[_0xb8cc('0x66')][_0x208713][_0xb8cc('0x67')]?_0x414644(_0x4a5b41[_0xb8cc('0x66')][_0x208713][_0xb8cc('0x67')]):_0x4a5b41[_0xb8cc('0x66')][_0x208713][_0xb8cc('0x68')]+'\x20'+_0x4a5b41[_0xb8cc('0x66')][_0x208713]['condition']+(_0x188b18(_0x4a5b41[_0xb8cc('0x66')][_0x208713][_0xb8cc('0x69')])?'\x20'+_0x4a5b41[_0xb8cc('0x66')][_0x208713][_0xb8cc('0x6a')]:'');}return _0x186e73+')';};var _0x5e279b={'where':{'id':_0x35178a['id']}},_0x68d624,_0x979f1f,_0x3bebb7,_0x2e6098,_0x2024ad;_0x5e279b=_[_0xb8cc('0x3b')]({},_0x5e279b,_0x2cce64);return db[_0xb8cc('0x3e')]['find'](_0x5e279b)[_0xb8cc('0x22')](function(_0x3927a9){if(_0x3927a9){_0x68d624=_0x3927a9;return _0x3927a9['getFields']();}return null;})['then'](function(_0xd294b5){if(_0xd294b5){if(!_0xd294b5[_0xb8cc('0x34')]){throw new db[(_0xb8cc('0x88'))]['ValidationErrorItem'](_0xb8cc('0x6b'),0x193);}_0x979f1f=_0xd294b5;return db[_0xb8cc('0x6c')][_0xb8cc('0x41')]({'raw':!![]});}return null;})[_0xb8cc('0x22')](function(_0x3286a2){if(_0x3286a2){_0x3bebb7=_[_0xb8cc('0x89')](_0x3286a2,'id');var _0x9dac3a;var _0x677d90=squel[_0xb8cc('0x6d')]();_0x677d90[_0xb8cc('0x8a')](_0x68d624[_0xb8cc('0x6e')]);for(var _0xce02d7=0x0;_0xce02d7<_0x979f1f[_0xb8cc('0x34')];_0xce02d7+=0x1){_0x9dac3a=_0x979f1f[_0xce02d7][_0xb8cc('0x6f')]?_0x3bebb7[_0x979f1f[_0xce02d7]['MetricId']]['metric']:_0x979f1f[_0xce02d7]['field'];_0x9dac3a=_0x979f1f[_0xce02d7]['function']?_[_0xb8cc('0x72')](_0x164b6d[_0x979f1f[_0xce02d7]['function']],'%s',_0x9dac3a):_0x9dac3a;_0x9dac3a=_0x979f1f[_0xce02d7]['format']?_[_0xb8cc('0x72')](_0x37e16f[_0x979f1f[_0xce02d7]['format']],'%s',_0x9dac3a):_0x9dac3a;if(_0x979f1f[_0xce02d7]['groupBy']){_0x677d90['group'](_0x9dac3a);}_0x979f1f[_0xce02d7][_0xb8cc('0x75')]&&_0x677d90[_0xb8cc('0x37')](_0x9dac3a,_0x979f1f[_0xce02d7]['orderBy']===_0xb8cc('0x76')?![]:!![]);_0x677d90[_0xb8cc('0x68')](_0x9dac3a,_0x979f1f[_0xce02d7][_0xb8cc('0x8b')]||_0x9dac3a);}if(_0x68d624[_0xb8cc('0x77')]){_0x68d624['joins']=JSON['parse'](_0x68d624[_0xb8cc('0x77')]);for(var _0x3ef64c=0x0;_0x3ef64c<_0x68d624[_0xb8cc('0x77')]['length'];_0x3ef64c+=0x1){if(_0x68d624[_0xb8cc('0x77')][_0x3ef64c][_0xb8cc('0x3c')]&&_[_0xb8cc('0x61')](_0x1fe714,_0x68d624[_0xb8cc('0x77')][_0x3ef64c]['type'])&&_0x68d624[_0xb8cc('0x77')][_0x3ef64c]['parentKey']&&_0x68d624[_0xb8cc('0x77')][_0x3ef64c][_0xb8cc('0x7a')]&&_0x68d624[_0xb8cc('0x77')][_0x3ef64c][_0xb8cc('0x79')]){_0x677d90[_0x68d624[_0xb8cc('0x77')][_0x3ef64c]['type']](_0x68d624[_0xb8cc('0x77')][_0x3ef64c][_0xb8cc('0x7a')],null,util[_0xb8cc('0x73')]('%s.%s\x20=\x20%s.%s',_0x68d624[_0xb8cc('0x6e')],_0x68d624['joins'][_0x3ef64c][_0xb8cc('0x78')],_0x68d624[_0xb8cc('0x77')][_0x3ef64c]['foreignTable'],_0x68d624['joins'][_0x3ef64c]['foreignKey']));}}}if(_0x68d624[_0xb8cc('0x7c')]){_0x68d624[_0xb8cc('0x7c')]=JSON['parse'](_0x68d624[_0xb8cc('0x7c')]);_0x677d90[_0xb8cc('0x39')](_0x414644(_0x68d624['conditions']['group']));}_0x2024ad=_0x677d90[_0xb8cc('0x7e')]();_0x677d90[_0xb8cc('0x1c')](_0x461b2e);_0x677d90[_0xb8cc('0x1b')](0x0);logger[_0xb8cc('0x7f')](_0xb8cc('0x80'),_0x677d90['toString']());return db[_0xb8cc('0x82')][_0xb8cc('0x2e')](_0x677d90[_0xb8cc('0x81')](),{'type':db[_0xb8cc('0x82')][_0xb8cc('0x83')][_0xb8cc('0x84')]});}})[_0xb8cc('0x22')](function(_0x147590){if(!_0x147590[_0xb8cc('0x34')]){throw new db[(_0xb8cc('0x88'))]['ValidationErrorItem'](_0xb8cc('0x8c'),0xcc);}if(_0x73e192['output']===_0xb8cc('0x8d')){return null;}var _0x2629ab=_['merge'](_0x73e192,{'name':_0x73e192[_0xb8cc('0x8e')]||_0x73e192[_0xb8cc('0x27')]||_0x68d624[_0xb8cc('0x27')],'basename':_0x270fcc,'savename':util[_0xb8cc('0x73')](_0xb8cc('0x8f'),_0x73e192['name']||_0x68d624[_0xb8cc('0x27')],require(_0xb8cc('0x90'))[_0xb8cc('0x91')](0x4),_0x73e192[_0xb8cc('0x92')]||'csv'),'reportId':_0x68d624['id'],'reportType':_0xb8cc('0x93')});return db['AnalyticExtractedReport']['create'](_0x2629ab,{'raw':!![]});})[_0xb8cc('0x22')](function(_0x35ab49){if(_0x68d624[_0xb8cc('0x6e')]===_0xb8cc('0x94')){_0x2024ad['where'](_0x68d624['table']+_0xb8cc('0x95'),_0x73e192['startDate'],_0x73e192['endDate']);}else{_0x2024ad[_0xb8cc('0x39')](_0x68d624[_0xb8cc('0x6e')]+_0xb8cc('0x96'),_0x73e192['startDate'],_0x73e192['endDate']);}if(_0x35ab49){logger[_0xb8cc('0x97')]('Run\x20Query:',_0x2024ad[_0xb8cc('0x81')]());require(_0xb8cc('0x98'))[_0xb8cc('0x99')](path[_0xb8cc('0x52')](__dirname,_0xb8cc('0x9a'),_0x35ab49[_0xb8cc('0x92')]),[_0x35ab49['id'],_0x2024ad['toString'](),path['join'](__dirname,_0xb8cc('0x9b'),_0x35ab49[_0xb8cc('0x9c')]),_0x270fcc]);return _0x35ab49;}else{var _0x4ad416=squel['select']();_0x4ad416[_0xb8cc('0x8a')]('('+_0x2024ad['toString']()+')',_0xb8cc('0x9d'));_0x4ad416[_0xb8cc('0x68')]('COUNT(*)',_0xb8cc('0x1a'));_0x2024ad[_0xb8cc('0x1c')](_0x73e192[_0xb8cc('0x1c')]||_0x461b2e);_0x2024ad[_0xb8cc('0x1b')](_0x73e192[_0xb8cc('0x1b')]||0x0);return dbH['sequelize']['query'](_0x4ad416[_0xb8cc('0x81')](),{'type':dbH[_0xb8cc('0x82')][_0xb8cc('0x83')][_0xb8cc('0x84')]})[_0xb8cc('0x22')](function(_0x178d71){if(!_0x178d71[_0xb8cc('0x34')]){_0x2e6098=0x0;}else{_0x2e6098=_0x178d71[0x0][_0xb8cc('0x1a')]||0x0;}return dbH[_0xb8cc('0x82')][_0xb8cc('0x2e')](_0x2024ad[_0xb8cc('0x81')](),{'type':dbH[_0xb8cc('0x82')]['QueryTypes'][_0xb8cc('0x84')]});})[_0xb8cc('0x22')](function(_0x43fe14){return{'rows':_0x43fe14||[],'count':_0x2e6098};});}});}exports[_0xb8cc('0x9e')]=function(_0x321c71,_0x21d6de){return runReport(_0x321c71['params'],_0x321c71[_0xb8cc('0x2e')],_0x321c71['options'])[_0xb8cc('0x22')](respondWithResult(_0x21d6de,null))[_0xb8cc('0x42')](handleError(_0x21d6de,null));};exports[_0xb8cc('0x9f')]=runReport;exports[_0xb8cc('0x2e')]=function(_0x192d84,_0x3e6f59){var _0x1b4ccc=0xa;var _0x28c09b=[_0xb8cc('0x52'),'left_join',_0xb8cc('0x53'),_0xb8cc('0x54')];var _0x1fcf8d={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb8cc('0x56'),'MAX':'MAX(%s)','MIN':_0xb8cc('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb8cc('0x5a'),'GROUP_CONCAT ASC':_0xb8cc('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x49d0e9={'SEC_TO_TIME':_0xb8cc('0x5d'),'DATE':_0xb8cc('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb8cc('0x86')};var _0x3c9c28=function(_0x5e1383){return!_[_0xb8cc('0x61')]([_0xb8cc('0x62'),_0xb8cc('0x63'),'IS\x20EMPTY',_0xb8cc('0x65')],_0x5e1383);};var _0x5312e5=function(_0x9c4b80){if(!_0x9c4b80||!_0x9c4b80['rules'][_0xb8cc('0x34')]){return'';}for(var _0x3490e5='(',_0x3db420=0x0;_0x3db420<_0x9c4b80['rules']['length'];_0x3db420+=0x1){_0x3db420>0x0&&(_0x3490e5+='\x20'+_0x9c4b80[_0xb8cc('0x87')]+'\x20');_0x3490e5+=_0x9c4b80[_0xb8cc('0x66')][_0x3db420][_0xb8cc('0x67')]?_0x5312e5(_0x9c4b80[_0xb8cc('0x66')][_0x3db420][_0xb8cc('0x67')]):_0x9c4b80[_0xb8cc('0x66')][_0x3db420][_0xb8cc('0x68')]+'\x20'+_0x9c4b80[_0xb8cc('0x66')][_0x3db420][_0xb8cc('0x69')]+(_0x3c9c28(_0x9c4b80['rules'][_0x3db420][_0xb8cc('0x69')])?'\x20'+_0x9c4b80[_0xb8cc('0x66')][_0x3db420][_0xb8cc('0x6a')]:'');}return _0x3490e5+')';};var _0x2c176c={'where':{'id':_0x192d84[_0xb8cc('0xa0')]['id']}},_0x246132,_0xbb2002,_0x5d1f88,_0x2f8bd2,_0x4af102;_0x2c176c=_[_0xb8cc('0x3b')]({},_0x2c176c,_0x192d84[_0xb8cc('0x3d')]);return db[_0xb8cc('0x3e')][_0xb8cc('0x4b')](_0x2c176c)['then'](function(_0x533a75){if(_0x533a75){_0x246132=_0x533a75;return _0x533a75[_0xb8cc('0xa1')]();}return null;})['then'](function(_0x3406a5){if(_0x3406a5){if(!_0x3406a5[_0xb8cc('0x34')]){throw new db[(_0xb8cc('0x88'))][(_0xb8cc('0xa2'))](_0xb8cc('0x6b'),0x193);}_0xbb2002=_0x3406a5;return db[_0xb8cc('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xb8cc('0x22')](function(_0x506050){if(_0x506050){_0x5d1f88=_['keyBy'](_0x506050,'id');var _0x6ccec0;var _0x4405e7=squel[_0xb8cc('0x6d')]();_0x4405e7['from'](_0x246132[_0xb8cc('0x6e')]);for(var _0x53e695=0x0;_0x53e695<_0xbb2002[_0xb8cc('0x34')];_0x53e695+=0x1){_0x6ccec0=_0xbb2002[_0x53e695]['MetricId']?_0x5d1f88[_0xbb2002[_0x53e695]['MetricId']]['metric']:_0xbb2002[_0x53e695][_0xb8cc('0x68')];_0x6ccec0=_0xbb2002[_0x53e695][_0xb8cc('0x71')]?_[_0xb8cc('0x72')](_0x1fcf8d[_0xbb2002[_0x53e695][_0xb8cc('0x71')]],'%s',_0x6ccec0):_0x6ccec0;_0x6ccec0=_0xbb2002[_0x53e695][_0xb8cc('0x73')]?_[_0xb8cc('0x72')](_0x49d0e9[_0xbb2002[_0x53e695][_0xb8cc('0x73')]],'%s',_0x6ccec0):_0x6ccec0;if(_0xbb2002[_0x53e695]['groupBy']){_0x4405e7['group'](_0x6ccec0);}_0xbb2002[_0x53e695][_0xb8cc('0x75')]&&_0x4405e7[_0xb8cc('0x37')](_0x6ccec0,_0xbb2002[_0x53e695]['orderBy']===_0xb8cc('0x76')?![]:!![]);_0x4405e7[_0xb8cc('0x68')](_0x6ccec0,_0xbb2002[_0x53e695][_0xb8cc('0x8b')]||_0x6ccec0);}if(_0x246132[_0xb8cc('0x77')]){_0x246132[_0xb8cc('0x77')]=JSON[_0xb8cc('0x7d')](_0x246132[_0xb8cc('0x77')]);for(var _0x407932=0x0;_0x407932<_0x246132[_0xb8cc('0x77')][_0xb8cc('0x34')];_0x407932+=0x1){if(_0x246132[_0xb8cc('0x77')][_0x407932]['type']&&_[_0xb8cc('0x61')](_0x28c09b,_0x246132['joins'][_0x407932]['type'])&&_0x246132['joins'][_0x407932][_0xb8cc('0x78')]&&_0x246132[_0xb8cc('0x77')][_0x407932][_0xb8cc('0x7a')]&&_0x246132[_0xb8cc('0x77')][_0x407932][_0xb8cc('0x79')]){_0x4405e7[_0x246132['joins'][_0x407932][_0xb8cc('0x3c')]](_0x246132[_0xb8cc('0x77')][_0x407932][_0xb8cc('0x7a')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x246132[_0xb8cc('0x6e')],_0x246132['joins'][_0x407932][_0xb8cc('0x78')],_0x246132['joins'][_0x407932][_0xb8cc('0x7a')],_0x246132['joins'][_0x407932][_0xb8cc('0x79')]));}}}if(_0x246132['conditions']){_0x246132['conditions']=JSON['parse'](_0x246132[_0xb8cc('0x7c')]);_0x4405e7['where'](_0x5312e5(_0x246132[_0xb8cc('0x7c')][_0xb8cc('0x67')]));}_0x4af102=_0x4405e7[_0xb8cc('0x7e')]();_0x4405e7[_0xb8cc('0x1c')](_0x1b4ccc);_0x4405e7[_0xb8cc('0x1b')](0x0);logger[_0xb8cc('0x7f')](_0xb8cc('0x80'),_0x4405e7[_0xb8cc('0x81')]());return db[_0xb8cc('0x82')][_0xb8cc('0x2e')](_0x4405e7[_0xb8cc('0x81')](),{'type':db[_0xb8cc('0x82')][_0xb8cc('0x83')][_0xb8cc('0x84')]});}})[_0xb8cc('0x22')](function(){return{'sql':_0x4af102[_0xb8cc('0x81')]()};})[_0xb8cc('0x22')](respondWithResult(_0x3e6f59,null))[_0xb8cc('0x42')](handleError(_0x3e6f59,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 38ae033..f27626a 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 _0x8084=['path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5ce99b,_0x4eb4c8){var _0x5bd461=function(_0x3a2737){while(--_0x3a2737){_0x5ce99b['push'](_0x5ce99b['shift']());}};_0x5bd461(++_0x4eb4c8);}(_0x8084,0x13b));var _0x4808=function(_0x48a0b9,_0x148bdc){_0x48a0b9=_0x48a0b9-0x0;var _0x3d0e26=_0x8084[_0x48a0b9];return _0x3d0e26;};'use strict';var _=require(_0x4808('0x0'));var util=require(_0x4808('0x1'));var logger=require(_0x4808('0x2'))(_0x4808('0x3'));var moment=require(_0x4808('0x4'));var BPromise=require(_0x4808('0x5'));var rp=require(_0x4808('0x6'));var fs=require('fs');var path=require(_0x4808('0x7'));var rimraf=require(_0x4808('0x8'));var config=require(_0x4808('0x9'));var attributes=require(_0x4808('0xa'));module[_0x4808('0xb')]=function(_0x409ae5,_0x31f3c7){return _0x409ae5[_0x4808('0xc')](_0x4808('0xd'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53a8=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','api','moment','bluebird'];(function(_0x344128,_0x9b9e88){var _0x693fae=function(_0x3e2b2e){while(--_0x3e2b2e){_0x344128['push'](_0x344128['shift']());}};_0x693fae(++_0x9b9e88);}(_0x53a8,0xa5));var _0x853a=function(_0x2577d4,_0x3a5e96){_0x2577d4=_0x2577d4-0x0;var _0x3f53fd=_0x53a8[_0x2577d4];return _0x3f53fd;};'use strict';var _=require(_0x853a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x853a('0x1'));var moment=require(_0x853a('0x2'));var BPromise=require(_0x853a('0x3'));var rp=require(_0x853a('0x4'));var fs=require('fs');var path=require(_0x853a('0x5'));var rimraf=require(_0x853a('0x6'));var config=require(_0x853a('0x7'));var attributes=require(_0x853a('0x8'));module[_0x853a('0x9')]=function(_0x363be6,_0x5a7de0){return _0x363be6[_0x853a('0xa')](_0x853a('0xb'),attributes,{'tableName':_0x853a('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 11a93f3..2738b62 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 _0x106e=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5ea15d,_0x4af291){var _0x26e8da=function(_0x5d67ca){while(--_0x5d67ca){_0x5ea15d['push'](_0x5ea15d['shift']());}};_0x26e8da(++_0x4af291);}(_0x106e,0x10e));var _0xe106=function(_0x4f0c51,_0x18a7d8){_0x4f0c51=_0x4f0c51-0x0;var _0x439525=_0x106e[_0x4f0c51];return _0x439525;};'use strict';var _=require(_0xe106('0x0'));var util=require('util');var moment=require(_0xe106('0x1'));var BPromise=require(_0xe106('0x2'));var rs=require(_0xe106('0x3'));var fs=require('fs');var Redis=require(_0xe106('0x4'));var db=require(_0xe106('0x5'))['db'];var utils=require(_0xe106('0x6'));var logger=require(_0xe106('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe106('0x8'));var client=jayson[_0xe106('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19dce0,_0x4fb830,_0x5e597c){return new BPromise(function(_0x5f1ff6,_0x351575){return client[_0xe106('0xa')](_0x19dce0,_0x5e597c)[_0xe106('0xb')](function(_0x11bc60){logger[_0xe106('0xc')](_0xe106('0xd'),_0x4fb830,_0xe106('0xe'));logger[_0xe106('0xf')](_0xe106('0x10'),_0x4fb830,_0xe106('0xe'),JSON[_0xe106('0x11')](_0x11bc60));if(_0x11bc60[_0xe106('0x12')]){if(_0x11bc60[_0xe106('0x12')]['code']===0x1f4){logger['error'](_0xe106('0xd'),_0x4fb830,_0x11bc60['error']['message']);return _0x351575(_0x11bc60[_0xe106('0x12')]['message']);}logger[_0xe106('0x12')](_0xe106('0xd'),_0x4fb830,_0x11bc60[_0xe106('0x12')][_0xe106('0x13')]);return _0x5f1ff6(_0x11bc60[_0xe106('0x12')]['message']);}else{logger[_0xe106('0xc')](_0xe106('0xd'),_0x4fb830,_0xe106('0xe'));_0x5f1ff6(_0x11bc60[_0xe106('0x14')][_0xe106('0x13')]);}})[_0xe106('0x15')](function(_0x2a804){logger['error'](_0xe106('0xd'),_0x4fb830,_0x2a804);_0x351575(_0x2a804);});});} \ No newline at end of file +var _0x6beb=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3bb280,_0x516ad5){var _0xa15601=function(_0x555604){while(--_0x555604){_0x3bb280['push'](_0x3bb280['shift']());}};_0xa15601(++_0x516ad5);}(_0x6beb,0x1a1));var _0xb6be=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6beb[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xb6be('0x0'));var moment=require(_0xb6be('0x1'));var BPromise=require(_0xb6be('0x2'));var rs=require(_0xb6be('0x3'));var fs=require('fs');var Redis=require(_0xb6be('0x4'));var db=require(_0xb6be('0x5'))['db'];var utils=require(_0xb6be('0x6'));var logger=require(_0xb6be('0x7'))(_0xb6be('0x8'));var config=require(_0xb6be('0x9'));var jayson=require(_0xb6be('0xa'));var client=jayson[_0xb6be('0xb')][_0xb6be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42f466,_0x388cd3,_0x5d7f13){return new BPromise(function(_0x43bc30,_0x29ca02){return client[_0xb6be('0xd')](_0x42f466,_0x5d7f13)[_0xb6be('0xe')](function(_0x747bbc){logger[_0xb6be('0xf')](_0xb6be('0x10'),_0x388cd3,'request\x20sent');logger[_0xb6be('0x11')](_0xb6be('0x12'),_0x388cd3,_0xb6be('0x13'),JSON[_0xb6be('0x14')](_0x747bbc));if(_0x747bbc[_0xb6be('0x15')]){if(_0x747bbc[_0xb6be('0x15')][_0xb6be('0x16')]===0x1f4){logger[_0xb6be('0x15')](_0xb6be('0x10'),_0x388cd3,_0x747bbc[_0xb6be('0x15')][_0xb6be('0x17')]);return _0x29ca02(_0x747bbc['error']['message']);}logger[_0xb6be('0x15')](_0xb6be('0x10'),_0x388cd3,_0x747bbc[_0xb6be('0x15')][_0xb6be('0x17')]);return _0x43bc30(_0x747bbc[_0xb6be('0x15')][_0xb6be('0x17')]);}else{logger[_0xb6be('0xf')](_0xb6be('0x10'),_0x388cd3,_0xb6be('0x13'));_0x43bc30(_0x747bbc[_0xb6be('0x18')][_0xb6be('0x17')]);}})[_0xb6be('0x19')](function(_0x4aa92f){logger[_0xb6be('0x15')](_0xb6be('0x10'),_0x388cd3,_0x4aa92f);_0x29ca02(_0x4aa92f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 9a661a0..c43c498 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 _0xf56d=['express','../../components/interaction/service','get','index','isAuthenticated','show','/:id/preview','preview','run','/:id/query','query','/:id','update','delete','multer','connect-timeout'];(function(_0x54f72b,_0x59fa9){var _0x1adb60=function(_0x1b3882){while(--_0x1b3882){_0x54f72b['push'](_0x54f72b['shift']());}};_0x1adb60(++_0x59fa9);}(_0xf56d,0x17e));var _0xdf56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf56d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdf56('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdf56('0x1'));var express=require(_0xdf56('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdf56('0x3'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xdf56('0x4')]('/',auth['isAuthenticated'](),controller[_0xdf56('0x5')]);router[_0xdf56('0x4')]('/:id',auth[_0xdf56('0x6')](),controller[_0xdf56('0x7')]);router[_0xdf56('0x4')](_0xdf56('0x8'),auth[_0xdf56('0x6')](),controller[_0xdf56('0x9')]);router['get']('/:id/run',auth[_0xdf56('0x6')](),controller[_0xdf56('0xa')]);router[_0xdf56('0x4')](_0xdf56('0xb'),auth[_0xdf56('0x6')](),controller[_0xdf56('0xc')]);router['post']('/',auth[_0xdf56('0x6')](),controller['create']);router['put'](_0xdf56('0xd'),auth[_0xdf56('0x6')](),controller[_0xdf56('0xe')]);router[_0xdf56('0xf')]('/:id',auth[_0xdf56('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdf54=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','put','update','delete','destroy','exports'];(function(_0xa941cd,_0x4cd8c4){var _0x429f5b=function(_0x301141){while(--_0x301141){_0xa941cd['push'](_0xa941cd['shift']());}};_0x429f5b(++_0x4cd8c4);}(_0xdf54,0x1c2));var _0x4df5=function(_0x1916b3,_0x536071){_0x1916b3=_0x1916b3-0x0;var _0x57b327=_0xdf54[_0x1916b3];return _0x57b327;};'use strict';var multer=require(_0x4df5('0x0'));var util=require(_0x4df5('0x1'));var path=require(_0x4df5('0x2'));var timeout=require('connect-timeout');var express=require(_0x4df5('0x3'));var router=express[_0x4df5('0x4')]();var auth=require(_0x4df5('0x5'));var interaction=require(_0x4df5('0x6'));var config=require(_0x4df5('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x4df5('0x8')]('/',auth[_0x4df5('0x9')](),controller[_0x4df5('0xa')]);router[_0x4df5('0x8')](_0x4df5('0xb'),auth[_0x4df5('0x9')](),controller[_0x4df5('0xc')]);router[_0x4df5('0x8')](_0x4df5('0xd'),auth[_0x4df5('0x9')](),controller[_0x4df5('0xe')]);router[_0x4df5('0x8')]('/:id/run',auth[_0x4df5('0x9')](),controller[_0x4df5('0xf')]);router[_0x4df5('0x8')](_0x4df5('0x10'),auth[_0x4df5('0x9')](),controller[_0x4df5('0x11')]);router[_0x4df5('0x12')]('/',auth['isAuthenticated'](),controller[_0x4df5('0x13')]);router[_0x4df5('0x14')](_0x4df5('0xb'),auth[_0x4df5('0x9')](),controller[_0x4df5('0x15')]);router[_0x4df5('0x16')](_0x4df5('0xb'),auth['isAuthenticated'](),controller[_0x4df5('0x17')]);module[_0x4df5('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 00b1cef..bd8281a 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 _0xd7b5=['STRING','sequelize','exports'];(function(_0x5058d4,_0x5c9315){var _0x527bc5=function(_0x52ef4d){while(--_0x52ef4d){_0x5058d4['push'](_0x5058d4['shift']());}};_0x527bc5(++_0x5c9315);}(_0xd7b5,0x16c));var _0x5d7b=function(_0x17b6ee,_0x41f598){_0x17b6ee=_0x17b6ee-0x0;var _0x9818b0=_0xd7b5[_0x17b6ee];return _0x9818b0;};'use strict';var Sequelize=require(_0x5d7b('0x0'));module[_0x5d7b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5d7b('0x2')]},'parent':{'type':Sequelize[_0x5d7b('0x2')]},'table':{'type':Sequelize[_0x5d7b('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7b46=['STRING','TEXT','sequelize','exports'];(function(_0x58acd7,_0x2e44ad){var _0x590fba=function(_0x3007b2){while(--_0x3007b2){_0x58acd7['push'](_0x58acd7['shift']());}};_0x590fba(++_0x2e44ad);}(_0x7b46,0x17e));var _0x67b4=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x7b46[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x67b4('0x0'));module[_0x67b4('0x1')]={'name':{'type':Sequelize[_0x67b4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x67b4('0x2')]},'parent':{'type':Sequelize[_0x67b4('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x67b4('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 1310797..52f8937 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 _0xd243=['metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','cross_join','field','Sequelize','AnalyticMetric','from','toString','No\x20available\x20data','fullPath','%s-%s.%s','generate','output','default','AnalyticExtractedReport','cdr','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','countTable','run','runReport','GROUP_CONCAT(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','MetricId'];(function(_0x4bedce,_0x265ebf){var _0x4fd2fb=function(_0x14122b){while(--_0x14122b){_0x4bedce['push'](_0x4bedce['shift']());}};_0x4fd2fb(++_0x265ebf);}(_0xd243,0x181));var _0x3d24=function(_0x336de3,_0x1e2e3b){_0x336de3=_0x336de3-0x0;var _0x4ede5b=_0xd243[_0x336de3];return _0x4ede5b;};'use strict';var pdf=require(_0x3d24('0x0'));var emlformat=require(_0x3d24('0x1'));var rimraf=require(_0x3d24('0x2'));var zipdir=require(_0x3d24('0x3'));var jsonpatch=require(_0x3d24('0x4'));var rp=require(_0x3d24('0x5'));var moment=require(_0x3d24('0x6'));var BPromise=require(_0x3d24('0x7'));var Mustache=require(_0x3d24('0x8'));var util=require('util');var path=require(_0x3d24('0x9'));var sox=require(_0x3d24('0xa'));var csv=require(_0x3d24('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3d24('0xc'));var squel=require(_0x3d24('0xd'));var crypto=require(_0x3d24('0xe'));var jsforce=require(_0x3d24('0xf'));var deskjs=require(_0x3d24('0x10'));var toCsv=require(_0x3d24('0xb'));var querystring=require(_0x3d24('0x11'));var Papa=require(_0x3d24('0x12'));var Redis=require(_0x3d24('0x13'));var authService=require(_0x3d24('0x14'));var qs=require(_0x3d24('0x15'));var as=require(_0x3d24('0x16'));var hardwareService=require(_0x3d24('0x17'));var logger=require('../../config/logger')(_0x3d24('0x18'));var utils=require(_0x3d24('0x19'));var config=require(_0x3d24('0x1a'));var db=require(_0x3d24('0x1b'))['db'];var dbH=require(_0x3d24('0x1b'))[_0x3d24('0x1c')];function respondWithStatusCode(_0x9d6d35,_0x3195b0){_0x3195b0=_0x3195b0||0xcc;return function(_0x134862){if(_0x134862){return _0x9d6d35[_0x3d24('0x1d')](_0x3195b0);}return _0x9d6d35[_0x3d24('0x1e')](_0x3195b0)[_0x3d24('0x1f')]();};}function respondWithResult(_0x4109a0,_0x4390fb){_0x4390fb=_0x4390fb||0xc8;return function(_0x426d70){if(_0x426d70){return _0x4109a0[_0x3d24('0x1e')](_0x4390fb)['json'](_0x426d70);}};}function respondWithFilteredResult(_0x36530f,_0xaed5ee){return function(_0x910264){if(_0x910264){var _0x336004=_0x910264[_0x3d24('0x20')],_0x442163=_0xaed5ee[_0x3d24('0x21')],_0x2f6695=_0xaed5ee[_0x3d24('0x21')]+_0xaed5ee['limit'],_0x1e1c0c;if(_0x2f6695>=_0x336004){_0x2f6695=_0x336004;_0x1e1c0c=0xc8;}else{_0x1e1c0c=0xce;}_0x36530f[_0x3d24('0x1e')](_0x1e1c0c);return _0x36530f[_0x3d24('0x22')](_0x3d24('0x23'),_0x442163+'-'+_0x2f6695+'/'+_0x336004)[_0x3d24('0x24')](_0x910264);}return null;};}function patchUpdates(_0x103431){return function(_0x293362){try{jsonpatch[_0x3d24('0x25')](_0x293362,_0x103431,!![]);}catch(_0xc0fe8a){return BPromise[_0x3d24('0x26')](_0xc0fe8a);}return _0x293362[_0x3d24('0x27')]();};}function saveUpdates(_0x81a1d6,_0x257ea8){return function(_0x21770b){if(_0x21770b){return _0x21770b['update'](_0x81a1d6)[_0x3d24('0x28')](function(_0x23fe5d){return _0x23fe5d;});}return null;};}function removeEntity(_0x30165b,_0xa805f0){return function(_0x2d9f62){if(_0x2d9f62){return _0x2d9f62['destroy']()[_0x3d24('0x28')](function(){var _0x23d3f5=_0x2d9f62[_0x3d24('0x29')]({'plain':!![]});var _0x240276=_0x3d24('0x2a');return db[_0x3d24('0x2b')][_0x3d24('0x2c')]({'where':{'type':_0x240276,'resourceId':_0x23d3f5['id']}})[_0x3d24('0x28')](function(){return _0x2d9f62;});})[_0x3d24('0x28')](function(){_0x30165b[_0x3d24('0x1e')](0xcc)[_0x3d24('0x1f')]();});}};}function handleEntityNotFound(_0x526fd4,_0x4d0de4){return function(_0x433646){if(!_0x433646){_0x526fd4[_0x3d24('0x1d')](0x194);}return _0x433646;};}function handleError(_0x3c74a1,_0x28416a){_0x28416a=_0x28416a||0x1f4;return function(_0x5f215d){logger[_0x3d24('0x2d')](_0x5f215d[_0x3d24('0x2e')]);if(_0x5f215d[_0x3d24('0x2f')]){delete _0x5f215d['name'];}_0x3c74a1[_0x3d24('0x1e')](_0x28416a)[_0x3d24('0x30')](_0x5f215d);};}exports['index']=function(_0x571feb,_0x3cec53){var _0x5b4929={},_0x10d863={},_0x4bc0c1={'count':0x0,'rows':[]};var _0x1322b7=_[_0x3d24('0x31')](db[_0x3d24('0x32')][_0x3d24('0x33')],function(_0x1257f2){return{'name':_0x1257f2[_0x3d24('0x34')],'type':_0x1257f2['type'][_0x3d24('0x35')]};});_0x10d863[_0x3d24('0x36')]=_['map'](_0x1322b7,_0x3d24('0x2f'));_0x10d863[_0x3d24('0x37')]=_[_0x3d24('0x38')](_0x571feb[_0x3d24('0x37')]);_0x10d863['filters']=_[_0x3d24('0x39')](_0x10d863[_0x3d24('0x36')],_0x10d863['query']);_0x5b4929[_0x3d24('0x3a')]=_['intersection'](_0x10d863[_0x3d24('0x36')],qs['fields'](_0x571feb[_0x3d24('0x37')]['fields']));_0x5b4929[_0x3d24('0x3a')]=_0x5b4929[_0x3d24('0x3a')]['length']?_0x5b4929['attributes']:_0x10d863[_0x3d24('0x36')];if(!_0x571feb[_0x3d24('0x37')][_0x3d24('0x3b')](_0x3d24('0x3c'))){_0x5b4929[_0x3d24('0x3d')]=qs[_0x3d24('0x3d')](_0x571feb['query'][_0x3d24('0x3d')]);_0x5b4929['offset']=qs['offset'](_0x571feb[_0x3d24('0x37')][_0x3d24('0x21')]);}_0x5b4929[_0x3d24('0x3e')]=qs[_0x3d24('0x3f')](_0x571feb[_0x3d24('0x37')][_0x3d24('0x3f')]);_0x5b4929[_0x3d24('0x40')]=qs[_0x3d24('0x41')](_['pick'](_0x571feb[_0x3d24('0x37')],_0x10d863[_0x3d24('0x41')]),_0x1322b7);if(_0x571feb['query'][_0x3d24('0x42')]){_0x5b4929[_0x3d24('0x40')]=_['merge'](_0x5b4929[_0x3d24('0x40')],{'$or':_[_0x3d24('0x31')](_0x1322b7,function(_0x4be7b1){if(_0x4be7b1[_0x3d24('0x43')]!==_0x3d24('0x44')){var _0x5ce267={};_0x5ce267[_0x4be7b1['name']]={'$like':'%'+_0x571feb[_0x3d24('0x37')][_0x3d24('0x42')]+'%'};return _0x5ce267;}})});}_0x5b4929=_[_0x3d24('0x45')]({},_0x5b4929,_0x571feb[_0x3d24('0x46')]);var _0x409394={'where':_0x5b4929[_0x3d24('0x40')]};return db['AnalyticDefaultReport'][_0x3d24('0x20')](_0x409394)['then'](function(_0x3f7ed9){_0x4bc0c1[_0x3d24('0x20')]=_0x3f7ed9;if(_0x571feb[_0x3d24('0x37')]['includeAll']){_0x5b4929[_0x3d24('0x47')]=[{'all':!![]}];}return db[_0x3d24('0x32')][_0x3d24('0x48')](_0x5b4929);})[_0x3d24('0x28')](function(_0x1a532b){_0x4bc0c1[_0x3d24('0x49')]=_0x1a532b;return _0x4bc0c1;})[_0x3d24('0x28')](respondWithFilteredResult(_0x3cec53,_0x5b4929))[_0x3d24('0x4a')](handleError(_0x3cec53,null));};exports[_0x3d24('0x4b')]=function(_0x31560a,_0x4dcece){var _0x17c0f0={'raw':!![],'where':{'id':_0x31560a[_0x3d24('0x4c')]['id']}},_0x1eedfb={};_0x1eedfb[_0x3d24('0x36')]=_[_0x3d24('0x38')](db[_0x3d24('0x32')][_0x3d24('0x33')]);_0x1eedfb['query']=_['keys'](_0x31560a[_0x3d24('0x37')]);_0x1eedfb[_0x3d24('0x41')]=_['intersection'](_0x1eedfb['model'],_0x1eedfb[_0x3d24('0x37')]);_0x17c0f0[_0x3d24('0x3a')]=_['intersection'](_0x1eedfb[_0x3d24('0x36')],qs['fields'](_0x31560a[_0x3d24('0x37')]['fields']));_0x17c0f0[_0x3d24('0x3a')]=_0x17c0f0[_0x3d24('0x3a')][_0x3d24('0x4d')]?_0x17c0f0['attributes']:_0x1eedfb[_0x3d24('0x36')];if(_0x31560a[_0x3d24('0x37')][_0x3d24('0x4e')]){_0x17c0f0['include']=[{'all':!![]}];}_0x17c0f0=_['merge']({},_0x17c0f0,_0x31560a[_0x3d24('0x46')]);return db[_0x3d24('0x32')][_0x3d24('0x4f')](_0x17c0f0)[_0x3d24('0x28')](handleEntityNotFound(_0x4dcece,null))[_0x3d24('0x28')](respondWithResult(_0x4dcece,null))['catch'](handleError(_0x4dcece,null));};exports[_0x3d24('0x50')]=function(_0x4d6d2b,_0x29bbd8){return db[_0x3d24('0x32')][_0x3d24('0x50')](_0x4d6d2b[_0x3d24('0x51')],{})[_0x3d24('0x28')](function(_0x35964b){var _0x45b3f7=_0x4d6d2b[_0x3d24('0x52')][_0x3d24('0x29')]({'plain':!![]});if(!_0x45b3f7)throw new Error(_0x3d24('0x53'));if(_0x45b3f7[_0x3d24('0x54')]===_0x3d24('0x52')){var _0xe478ea=_0x35964b[_0x3d24('0x29')]({'plain':!![]});var _0x3b42f8=_0x3d24('0x55');return db['UserProfileSection'][_0x3d24('0x4f')]({'where':{'name':_0x3b42f8,'userProfileId':_0x45b3f7[_0x3d24('0x56')]},'raw':!![]})[_0x3d24('0x28')](function(_0x280877){if(_0x280877&&_0x280877[_0x3d24('0x57')]===0x0){return db[_0x3d24('0x2b')][_0x3d24('0x50')]({'name':_0xe478ea['name'],'resourceId':_0xe478ea['id'],'type':'DefaultReports','sectionId':_0x280877['id']},{})['then'](function(){return _0x35964b;});}else{return _0x35964b;}})[_0x3d24('0x4a')](function(_0x203f46){logger[_0x3d24('0x2d')](_0x3d24('0x58'),_0x203f46);throw _0x203f46;});}return _0x35964b;})[_0x3d24('0x28')](respondWithResult(_0x29bbd8,0xc9))[_0x3d24('0x4a')](handleError(_0x29bbd8,null));};exports[_0x3d24('0x59')]=function(_0xaa002,_0x50572f){if(_0xaa002[_0x3d24('0x51')]['id']){delete _0xaa002[_0x3d24('0x51')]['id'];}return db[_0x3d24('0x32')]['find']({'where':{'id':_0xaa002['params']['id']}})[_0x3d24('0x28')](handleEntityNotFound(_0x50572f,null))['then'](saveUpdates(_0xaa002[_0x3d24('0x51')],null))[_0x3d24('0x28')](respondWithResult(_0x50572f,null))[_0x3d24('0x4a')](handleError(_0x50572f,null));};exports[_0x3d24('0x2c')]=function(_0x1217a9,_0x589a50){return db['AnalyticDefaultReport'][_0x3d24('0x4f')]({'where':{'id':_0x1217a9[_0x3d24('0x4c')]['id']}})[_0x3d24('0x28')](handleEntityNotFound(_0x589a50,null))['then'](removeEntity(_0x589a50,null))[_0x3d24('0x4a')](handleError(_0x589a50,null));};exports[_0x3d24('0x5a')]=function(_0x228b7b,_0x4d40e6){var _0x368e8c=0xa;var _0x3f8e3c=[_0x3d24('0x5b'),'left_join',_0x3d24('0x5c'),'cross_join'];var _0x3353c8={'SUM':_0x3d24('0x5d'),'COUNT':_0x3d24('0x5e'),'COUNT DISTINCT':_0x3d24('0x5f'),'MAX':_0x3d24('0x60'),'MIN':_0x3d24('0x61'),'AVG':_0x3d24('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x3d24('0x63'),'GROUP_CONCAT DESC':_0x3d24('0x64')};var _0x5bb59a={'SEC_TO_TIME':_0x3d24('0x65'),'DATE':_0x3d24('0x66'),'HOUR':_0x3d24('0x67'),'ROUND':_0x3d24('0x68'),'UNIX_TIMESTAMP':_0x3d24('0x69')};var _0x4429c1=function(_0x4146a0){return!_[_0x3d24('0x6a')]([_0x3d24('0x6b'),_0x3d24('0x6c'),_0x3d24('0x6d'),_0x3d24('0x6e')],_0x4146a0);};var _0x3c6c5c=function(_0x21b763){if(!_0x21b763||!_0x21b763[_0x3d24('0x6f')]['length']){return'';}for(var _0x4a3d44='(',_0x13c16e=0x0;_0x13c16e<_0x21b763[_0x3d24('0x6f')][_0x3d24('0x4d')];_0x13c16e+=0x1){_0x13c16e>0x0&&(_0x4a3d44+='\x20'+_0x21b763[_0x3d24('0x70')]+'\x20');_0x4a3d44+=_0x21b763[_0x3d24('0x6f')][_0x13c16e][_0x3d24('0x71')]?_0x3c6c5c(_0x21b763[_0x3d24('0x6f')][_0x13c16e][_0x3d24('0x71')]):_0x21b763['rules'][_0x13c16e]['field']+'\x20'+_0x21b763[_0x3d24('0x6f')][_0x13c16e][_0x3d24('0x72')]+(_0x4429c1(_0x21b763['rules'][_0x13c16e][_0x3d24('0x72')])?'\x20'+_0x21b763[_0x3d24('0x6f')][_0x13c16e][_0x3d24('0x73')]:'');}return _0x4a3d44+')';};var _0x2fda59={'where':{'id':_0x228b7b[_0x3d24('0x4c')]['id']}},_0xa1aa47,_0x43f5e6,_0x3ea9f9,_0x3c4682,_0x402ad4;_0x2fda59=_[_0x3d24('0x45')]({},_0x2fda59,_0x228b7b[_0x3d24('0x46')]);return db[_0x3d24('0x32')]['find'](_0x2fda59)[_0x3d24('0x28')](function(_0x451942){if(_0x451942){_0xa1aa47=_0x451942;return _0x451942[_0x3d24('0x74')]();}return null;})['then'](function(_0x1cd93d){if(_0x1cd93d){if(!_0x1cd93d[_0x3d24('0x4d')]){throw new db['Sequelize'][(_0x3d24('0x75'))](_0x3d24('0x76'),0x193);}_0x43f5e6=_0x1cd93d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x3d24('0x28')](function(_0x138de3){if(_0x138de3){_0x3ea9f9=_[_0x3d24('0x77')](_0x138de3,'id');var _0x2279ec;var _0x3eae46=squel[_0x3d24('0x78')]();_0x3eae46['from'](_0xa1aa47['table']);for(var _0x33a3d3=0x0;_0x33a3d3<_0x43f5e6[_0x3d24('0x4d')];_0x33a3d3+=0x1){_0x2279ec=_0x43f5e6[_0x33a3d3][_0x3d24('0x79')]?_0x3ea9f9[_0x43f5e6[_0x33a3d3][_0x3d24('0x79')]][_0x3d24('0x7a')]:_0x43f5e6[_0x33a3d3]['field'];_0x2279ec=_0x43f5e6[_0x33a3d3][_0x3d24('0x7b')]?_[_0x3d24('0x7c')](_0x3353c8[_0x43f5e6[_0x33a3d3][_0x3d24('0x7b')]],'%s',_0x2279ec):_0x2279ec;_0x2279ec=_0x43f5e6[_0x33a3d3][_0x3d24('0x7d')]?_['replace'](_0x5bb59a[_0x43f5e6[_0x33a3d3]['format']],'%s',_0x2279ec):_0x2279ec;if(_0x43f5e6[_0x33a3d3][_0x3d24('0x7e')]){_0x3eae46[_0x3d24('0x71')](_0x2279ec);}_0x43f5e6[_0x33a3d3][_0x3d24('0x7f')]&&_0x3eae46['order'](_0x2279ec,_0x43f5e6[_0x33a3d3]['orderBy']===_0x3d24('0x80')?![]:!![]);_0x3eae46['field'](_0x2279ec,_0x43f5e6[_0x33a3d3][_0x3d24('0x81')]||_0x2279ec);}if(_0xa1aa47[_0x3d24('0x82')]){_0xa1aa47[_0x3d24('0x82')]=JSON[_0x3d24('0x83')](_0xa1aa47[_0x3d24('0x82')]);for(var _0x29bbbe=0x0;_0x29bbbe<_0xa1aa47[_0x3d24('0x82')][_0x3d24('0x4d')];_0x29bbbe+=0x1){if(_0xa1aa47[_0x3d24('0x82')][_0x29bbbe][_0x3d24('0x43')]&&_[_0x3d24('0x6a')](_0x3f8e3c,_0xa1aa47['joins'][_0x29bbbe][_0x3d24('0x43')])&&_0xa1aa47['joins'][_0x29bbbe][_0x3d24('0x84')]&&_0xa1aa47[_0x3d24('0x82')][_0x29bbbe][_0x3d24('0x85')]&&_0xa1aa47[_0x3d24('0x82')][_0x29bbbe][_0x3d24('0x86')]){_0x3eae46[_0xa1aa47['joins'][_0x29bbbe]['type']](_0xa1aa47[_0x3d24('0x82')][_0x29bbbe][_0x3d24('0x85')],null,util[_0x3d24('0x7d')](_0x3d24('0x87'),_0xa1aa47[_0x3d24('0x88')],_0xa1aa47[_0x3d24('0x82')][_0x29bbbe][_0x3d24('0x84')],_0xa1aa47[_0x3d24('0x82')][_0x29bbbe][_0x3d24('0x85')],_0xa1aa47[_0x3d24('0x82')][_0x29bbbe][_0x3d24('0x86')]));}}}if(_0xa1aa47[_0x3d24('0x89')]){_0xa1aa47['conditions']=JSON[_0x3d24('0x83')](_0xa1aa47['conditions']);_0x3eae46[_0x3d24('0x40')](_0x3c6c5c(_0xa1aa47['conditions'][_0x3d24('0x71')]));}_0x402ad4=_0x3eae46[_0x3d24('0x8a')]();_0x3eae46['limit'](_0x368e8c);_0x3eae46['offset'](0x0);logger[_0x3d24('0x8b')](_0x3d24('0x8c'),_0x3eae46['toString']());return db[_0x3d24('0x8d')]['query'](_0x3eae46['toString'](),{'type':db[_0x3d24('0x8d')][_0x3d24('0x8e')][_0x3d24('0x8f')]});}})[_0x3d24('0x28')](respondWithResult(_0x4d40e6,null))['catch'](handleError(_0x4d40e6,null));};function runReport(_0x209146,_0x2fe25d,_0x5c2f26){var _0x442407=_0x2fe25d[_0x3d24('0x2f')];var _0x1dd3fc=0xa;var _0x2a4bc1=[_0x3d24('0x5b'),_0x3d24('0x90'),_0x3d24('0x5c'),_0x3d24('0x91')];var _0xaba4df={'SUM':_0x3d24('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3d24('0x5f'),'MAX':_0x3d24('0x60'),'MIN':_0x3d24('0x61'),'AVG':_0x3d24('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x3d24('0x63'),'GROUP_CONCAT DESC':_0x3d24('0x64')};var _0x198294={'SEC_TO_TIME':_0x3d24('0x65'),'DATE':'DATE(%s)','HOUR':_0x3d24('0x67'),'ROUND':_0x3d24('0x68'),'UNIX_TIMESTAMP':_0x3d24('0x69')};var _0x47ea88=function(_0x388066){return!_['includes']([_0x3d24('0x6b'),_0x3d24('0x6c'),_0x3d24('0x6d'),'IS\x20NOT\x20EMPTY'],_0x388066);};var _0x46bb01=function(_0x129322){if(!_0x129322||!_0x129322['rules'][_0x3d24('0x4d')]){return'';}for(var _0x506123='(',_0x1cf420=0x0;_0x1cf420<_0x129322[_0x3d24('0x6f')][_0x3d24('0x4d')];_0x1cf420+=0x1){_0x1cf420>0x0&&(_0x506123+='\x20'+_0x129322[_0x3d24('0x70')]+'\x20');_0x506123+=_0x129322[_0x3d24('0x6f')][_0x1cf420][_0x3d24('0x71')]?_0x46bb01(_0x129322[_0x3d24('0x6f')][_0x1cf420]['group']):_0x129322[_0x3d24('0x6f')][_0x1cf420][_0x3d24('0x92')]+'\x20'+_0x129322[_0x3d24('0x6f')][_0x1cf420][_0x3d24('0x72')]+(_0x47ea88(_0x129322['rules'][_0x1cf420][_0x3d24('0x72')])?'\x20'+_0x129322[_0x3d24('0x6f')][_0x1cf420][_0x3d24('0x73')]:'');}return _0x506123+')';};var _0x3616f9={'where':{'id':_0x209146['id']}},_0x50bffc,_0x2dba88,_0x298f93,_0x395983,_0x40ebdd;_0x3616f9=_['merge']({},_0x3616f9,_0x5c2f26);return db[_0x3d24('0x32')][_0x3d24('0x4f')](_0x3616f9)['then'](function(_0x3c5dda){if(_0x3c5dda){_0x50bffc=_0x3c5dda;return _0x3c5dda[_0x3d24('0x74')]();}return null;})[_0x3d24('0x28')](function(_0x318f76){if(_0x318f76){if(!_0x318f76[_0x3d24('0x4d')]){throw new db[(_0x3d24('0x93'))][(_0x3d24('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2dba88=_0x318f76;return db[_0x3d24('0x94')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x364fd0){if(_0x364fd0){_0x298f93=_[_0x3d24('0x77')](_0x364fd0,'id');var _0x282de8;var _0xf681fa=squel[_0x3d24('0x78')]();_0xf681fa[_0x3d24('0x95')](_0x50bffc[_0x3d24('0x88')]);for(var _0x3d1678=0x0;_0x3d1678<_0x2dba88['length'];_0x3d1678+=0x1){_0x282de8=_0x2dba88[_0x3d1678][_0x3d24('0x79')]?_0x298f93[_0x2dba88[_0x3d1678][_0x3d24('0x79')]][_0x3d24('0x7a')]:_0x2dba88[_0x3d1678]['field'];_0x282de8=_0x2dba88[_0x3d1678][_0x3d24('0x7b')]?_[_0x3d24('0x7c')](_0xaba4df[_0x2dba88[_0x3d1678][_0x3d24('0x7b')]],'%s',_0x282de8):_0x282de8;_0x282de8=_0x2dba88[_0x3d1678]['format']?_[_0x3d24('0x7c')](_0x198294[_0x2dba88[_0x3d1678][_0x3d24('0x7d')]],'%s',_0x282de8):_0x282de8;if(_0x2dba88[_0x3d1678][_0x3d24('0x7e')]){_0xf681fa[_0x3d24('0x71')](_0x282de8);}_0x2dba88[_0x3d1678][_0x3d24('0x7f')]&&_0xf681fa[_0x3d24('0x3e')](_0x282de8,_0x2dba88[_0x3d1678][_0x3d24('0x7f')]===_0x3d24('0x80')?![]:!![]);_0xf681fa[_0x3d24('0x92')](_0x282de8,_0x2dba88[_0x3d1678][_0x3d24('0x81')]||_0x282de8);}if(_0x50bffc['joins']){_0x50bffc[_0x3d24('0x82')]=JSON[_0x3d24('0x83')](_0x50bffc[_0x3d24('0x82')]);for(var _0x25c348=0x0;_0x25c348<_0x50bffc[_0x3d24('0x82')][_0x3d24('0x4d')];_0x25c348+=0x1){if(_0x50bffc[_0x3d24('0x82')][_0x25c348][_0x3d24('0x43')]&&_[_0x3d24('0x6a')](_0x2a4bc1,_0x50bffc[_0x3d24('0x82')][_0x25c348][_0x3d24('0x43')])&&_0x50bffc[_0x3d24('0x82')][_0x25c348][_0x3d24('0x84')]&&_0x50bffc[_0x3d24('0x82')][_0x25c348]['foreignTable']&&_0x50bffc[_0x3d24('0x82')][_0x25c348]['foreignKey']){_0xf681fa[_0x50bffc['joins'][_0x25c348]['type']](_0x50bffc[_0x3d24('0x82')][_0x25c348]['foreignTable'],null,util['format'](_0x3d24('0x87'),_0x50bffc['table'],_0x50bffc[_0x3d24('0x82')][_0x25c348][_0x3d24('0x84')],_0x50bffc['joins'][_0x25c348]['foreignTable'],_0x50bffc[_0x3d24('0x82')][_0x25c348][_0x3d24('0x86')]));}}}if(_0x50bffc[_0x3d24('0x89')]){_0x50bffc[_0x3d24('0x89')]=JSON[_0x3d24('0x83')](_0x50bffc[_0x3d24('0x89')]);_0xf681fa[_0x3d24('0x40')](_0x46bb01(_0x50bffc[_0x3d24('0x89')][_0x3d24('0x71')]));}_0x40ebdd=_0xf681fa[_0x3d24('0x8a')]();_0xf681fa[_0x3d24('0x3d')](_0x1dd3fc);_0xf681fa[_0x3d24('0x21')](0x0);logger[_0x3d24('0x8b')](_0x3d24('0x8c'),_0xf681fa[_0x3d24('0x96')]());return db[_0x3d24('0x8d')][_0x3d24('0x37')](_0xf681fa[_0x3d24('0x96')](),{'type':db[_0x3d24('0x8d')][_0x3d24('0x8e')]['SELECT']});}})[_0x3d24('0x28')](function(_0x338a3f){if(!_0x338a3f['length']){throw new db[(_0x3d24('0x93'))][(_0x3d24('0x75'))](_0x3d24('0x97'),0xcc);}if(_0x2fe25d['output']==='web'){return null;}var _0x8aaa2=_[_0x3d24('0x45')](_0x2fe25d,{'name':_0x2fe25d[_0x3d24('0x98')]||_0x2fe25d[_0x3d24('0x2f')]||_0x50bffc[_0x3d24('0x2f')],'basename':_0x442407,'savename':util[_0x3d24('0x7d')](_0x3d24('0x99'),_0x2fe25d['name']||_0x50bffc[_0x3d24('0x2f')],require('randomstring')[_0x3d24('0x9a')](0x4),_0x2fe25d[_0x3d24('0x9b')]||'csv'),'reportId':_0x50bffc['id'],'reportType':_0x3d24('0x9c')});return db[_0x3d24('0x9d')][_0x3d24('0x50')](_0x8aaa2,{'raw':!![]});})[_0x3d24('0x28')](function(_0x18e618){if(_0x50bffc[_0x3d24('0x88')]===_0x3d24('0x9e')){_0x40ebdd[_0x3d24('0x40')](_0x50bffc[_0x3d24('0x88')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2fe25d[_0x3d24('0x9f')],_0x2fe25d[_0x3d24('0xa0')]);}else{_0x40ebdd[_0x3d24('0x40')](_0x50bffc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2fe25d[_0x3d24('0x9f')],_0x2fe25d[_0x3d24('0xa0')]);}if(_0x18e618){logger['info'](_0x3d24('0xa1'),_0x40ebdd[_0x3d24('0x96')]());require(_0x3d24('0xa2'))[_0x3d24('0xa3')](path['join'](__dirname,_0x3d24('0xa4'),_0x18e618[_0x3d24('0x9b')]),[_0x18e618['id'],_0x40ebdd[_0x3d24('0x96')](),path['join'](__dirname,'../../files/reports',_0x18e618['savename']),_0x442407]);return _0x18e618;}else{var _0x1cb658=squel['select']();_0x1cb658[_0x3d24('0x95')]('('+_0x40ebdd[_0x3d24('0x96')]()+')',_0x3d24('0xa5'));_0x1cb658[_0x3d24('0x92')]('COUNT(*)',_0x3d24('0x20'));_0x40ebdd[_0x3d24('0x3d')](_0x2fe25d[_0x3d24('0x3d')]||_0x1dd3fc);_0x40ebdd['offset'](_0x2fe25d[_0x3d24('0x21')]||0x0);return dbH[_0x3d24('0x8d')][_0x3d24('0x37')](_0x1cb658[_0x3d24('0x96')](),{'type':dbH[_0x3d24('0x8d')][_0x3d24('0x8e')]['SELECT']})[_0x3d24('0x28')](function(_0x59e711){if(!_0x59e711['length']){_0x395983=0x0;}else{_0x395983=_0x59e711[0x0][_0x3d24('0x20')]||0x0;}return dbH[_0x3d24('0x8d')]['query'](_0x40ebdd[_0x3d24('0x96')](),{'type':dbH[_0x3d24('0x8d')]['QueryTypes'][_0x3d24('0x8f')]});})[_0x3d24('0x28')](function(_0x363992){return{'rows':_0x363992||[],'count':_0x395983};});}});}exports[_0x3d24('0xa6')]=function(_0x3e9f5f,_0x2a4a4){return runReport(_0x3e9f5f['params'],_0x3e9f5f[_0x3d24('0x37')],_0x3e9f5f[_0x3d24('0x46')])[_0x3d24('0x28')](respondWithResult(_0x2a4a4,null))[_0x3d24('0x4a')](handleError(_0x2a4a4,null));};exports[_0x3d24('0xa7')]=runReport;exports[_0x3d24('0x37')]=function(_0x558461,_0x4a492a){var _0x5d6bd2=0xa;var _0x1236ec=[_0x3d24('0x5b'),'left_join',_0x3d24('0x5c'),_0x3d24('0x91')];var _0x5a949f={'SUM':_0x3d24('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3d24('0x5f'),'MAX':_0x3d24('0x60'),'MIN':_0x3d24('0x61'),'AVG':_0x3d24('0x62'),'GROUP_CONCAT':_0x3d24('0xa8'),'GROUP_CONCAT ASC':_0x3d24('0x63'),'GROUP_CONCAT DESC':_0x3d24('0x64')};var _0xc46a80={'SEC_TO_TIME':_0x3d24('0x65'),'DATE':_0x3d24('0x66'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3d24('0x69')};var _0x3a9567=function(_0x53b88c){return!_['includes']([_0x3d24('0x6b'),_0x3d24('0x6c'),_0x3d24('0x6d'),_0x3d24('0x6e')],_0x53b88c);};var _0x981faa=function(_0x15d965){if(!_0x15d965||!_0x15d965[_0x3d24('0x6f')][_0x3d24('0x4d')]){return'';}for(var _0x14d493='(',_0x20cd76=0x0;_0x20cd76<_0x15d965[_0x3d24('0x6f')]['length'];_0x20cd76+=0x1){_0x20cd76>0x0&&(_0x14d493+='\x20'+_0x15d965['operator']+'\x20');_0x14d493+=_0x15d965['rules'][_0x20cd76][_0x3d24('0x71')]?_0x981faa(_0x15d965['rules'][_0x20cd76][_0x3d24('0x71')]):_0x15d965[_0x3d24('0x6f')][_0x20cd76][_0x3d24('0x92')]+'\x20'+_0x15d965[_0x3d24('0x6f')][_0x20cd76][_0x3d24('0x72')]+(_0x3a9567(_0x15d965[_0x3d24('0x6f')][_0x20cd76][_0x3d24('0x72')])?'\x20'+_0x15d965[_0x3d24('0x6f')][_0x20cd76][_0x3d24('0x73')]:'');}return _0x14d493+')';};var _0xf2ba7f={'where':{'id':_0x558461[_0x3d24('0x4c')]['id']}},_0x424c8a,_0x17d1ac,_0x1646e8,_0x4b5994,_0x58df5f;_0xf2ba7f=_['merge']({},_0xf2ba7f,_0x558461[_0x3d24('0x46')]);return db[_0x3d24('0x32')][_0x3d24('0x4f')](_0xf2ba7f)[_0x3d24('0x28')](function(_0x5c57c2){if(_0x5c57c2){_0x424c8a=_0x5c57c2;return _0x5c57c2[_0x3d24('0x74')]();}return null;})[_0x3d24('0x28')](function(_0x4ac601){if(_0x4ac601){if(!_0x4ac601[_0x3d24('0x4d')]){throw new db['Sequelize'][(_0x3d24('0x75'))](_0x3d24('0x76'),0x193);}_0x17d1ac=_0x4ac601;return db[_0x3d24('0x94')][_0x3d24('0x48')]({'raw':!![]});}return null;})['then'](function(_0x54c599){if(_0x54c599){_0x1646e8=_[_0x3d24('0x77')](_0x54c599,'id');var _0x42a28e;var _0x4d9729=squel[_0x3d24('0x78')]();_0x4d9729[_0x3d24('0x95')](_0x424c8a[_0x3d24('0x88')]);for(var _0x224445=0x0;_0x224445<_0x17d1ac[_0x3d24('0x4d')];_0x224445+=0x1){_0x42a28e=_0x17d1ac[_0x224445][_0x3d24('0x79')]?_0x1646e8[_0x17d1ac[_0x224445][_0x3d24('0x79')]][_0x3d24('0x7a')]:_0x17d1ac[_0x224445]['field'];_0x42a28e=_0x17d1ac[_0x224445][_0x3d24('0x7b')]?_[_0x3d24('0x7c')](_0x5a949f[_0x17d1ac[_0x224445][_0x3d24('0x7b')]],'%s',_0x42a28e):_0x42a28e;_0x42a28e=_0x17d1ac[_0x224445]['format']?_[_0x3d24('0x7c')](_0xc46a80[_0x17d1ac[_0x224445][_0x3d24('0x7d')]],'%s',_0x42a28e):_0x42a28e;if(_0x17d1ac[_0x224445]['groupBy']){_0x4d9729[_0x3d24('0x71')](_0x42a28e);}_0x17d1ac[_0x224445][_0x3d24('0x7f')]&&_0x4d9729[_0x3d24('0x3e')](_0x42a28e,_0x17d1ac[_0x224445][_0x3d24('0x7f')]===_0x3d24('0x80')?![]:!![]);_0x4d9729[_0x3d24('0x92')](_0x42a28e,_0x17d1ac[_0x224445][_0x3d24('0x81')]||_0x42a28e);}if(_0x424c8a['joins']){_0x424c8a[_0x3d24('0x82')]=JSON[_0x3d24('0x83')](_0x424c8a[_0x3d24('0x82')]);for(var _0x28e213=0x0;_0x28e213<_0x424c8a[_0x3d24('0x82')][_0x3d24('0x4d')];_0x28e213+=0x1){if(_0x424c8a['joins'][_0x28e213][_0x3d24('0x43')]&&_[_0x3d24('0x6a')](_0x1236ec,_0x424c8a['joins'][_0x28e213]['type'])&&_0x424c8a[_0x3d24('0x82')][_0x28e213]['parentKey']&&_0x424c8a[_0x3d24('0x82')][_0x28e213][_0x3d24('0x85')]&&_0x424c8a[_0x3d24('0x82')][_0x28e213]['foreignKey']){_0x4d9729[_0x424c8a[_0x3d24('0x82')][_0x28e213][_0x3d24('0x43')]](_0x424c8a[_0x3d24('0x82')][_0x28e213]['foreignTable'],null,util[_0x3d24('0x7d')]('%s.%s\x20=\x20%s.%s',_0x424c8a[_0x3d24('0x88')],_0x424c8a[_0x3d24('0x82')][_0x28e213][_0x3d24('0x84')],_0x424c8a['joins'][_0x28e213][_0x3d24('0x85')],_0x424c8a[_0x3d24('0x82')][_0x28e213][_0x3d24('0x86')]));}}}if(_0x424c8a['conditions']){_0x424c8a[_0x3d24('0x89')]=JSON[_0x3d24('0x83')](_0x424c8a[_0x3d24('0x89')]);_0x4d9729[_0x3d24('0x40')](_0x981faa(_0x424c8a[_0x3d24('0x89')][_0x3d24('0x71')]));}_0x58df5f=_0x4d9729['clone']();_0x4d9729['limit'](_0x5d6bd2);_0x4d9729[_0x3d24('0x21')](0x0);logger[_0x3d24('0x8b')](_0x3d24('0x8c'),_0x4d9729[_0x3d24('0x96')]());return db[_0x3d24('0x8d')][_0x3d24('0x37')](_0x4d9729[_0x3d24('0x96')](),{'type':db[_0x3d24('0x8d')][_0x3d24('0x8e')][_0x3d24('0x8f')]});}})[_0x3d24('0x28')](function(){return{'sql':_0x58df5f[_0x3d24('0x96')]()};})[_0x3d24('0x28')](respondWithResult(_0x4a492a,null))[_0x3d24('0x4a')](handleError(_0x4a492a,null));}; \ No newline at end of file +var _0xdab6=['zip-dir','fast-json-patch','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','status','json','count','offset','limit','set','reject','save','update','destroy','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','get','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','cross_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','groupBy','DESC','parentKey','SELECT','No\x20available\x20data','output','web','%s-%s.%s','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','COUNT(%s)','operator','metric','%s.%s\x20=\x20%s.%s','html-pdf','eml-format','rimraf'];(function(_0x47aca7,_0x146518){var _0x524aef=function(_0x3ddac1){while(--_0x3ddac1){_0x47aca7['push'](_0x47aca7['shift']());}};_0x524aef(++_0x146518);}(_0xdab6,0x153));var _0x6dab=function(_0x2d243f,_0x47aba5){_0x2d243f=_0x2d243f-0x0;var _0x53c2cf=_0xdab6[_0x2d243f];return _0x53c2cf;};'use strict';var pdf=require(_0x6dab('0x0'));var emlformat=require(_0x6dab('0x1'));var rimraf=require(_0x6dab('0x2'));var zipdir=require(_0x6dab('0x3'));var jsonpatch=require(_0x6dab('0x4'));var rp=require(_0x6dab('0x5'));var moment=require(_0x6dab('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6dab('0x7'));var util=require(_0x6dab('0x8'));var path=require(_0x6dab('0x9'));var sox=require(_0x6dab('0xa'));var csv=require(_0x6dab('0xb'));var ejs=require(_0x6dab('0xc'));var fs=require('fs');var _=require(_0x6dab('0xd'));var squel=require('squel');var crypto=require(_0x6dab('0xe'));var jsforce=require(_0x6dab('0xf'));var deskjs=require(_0x6dab('0x10'));var toCsv=require(_0x6dab('0xb'));var querystring=require(_0x6dab('0x11'));var Papa=require(_0x6dab('0x12'));var Redis=require(_0x6dab('0x13'));var authService=require(_0x6dab('0x14'));var qs=require(_0x6dab('0x15'));var as=require(_0x6dab('0x16'));var hardwareService=require(_0x6dab('0x17'));var logger=require(_0x6dab('0x18'))(_0x6dab('0x19'));var utils=require('../../config/utils');var config=require(_0x6dab('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6dab('0x1b'))[_0x6dab('0x1c')];function respondWithStatusCode(_0x51d444,_0x51afa2){_0x51afa2=_0x51afa2||0xcc;return function(_0x327e76){if(_0x327e76){return _0x51d444['sendStatus'](_0x51afa2);}return _0x51d444[_0x6dab('0x1d')](_0x51afa2)['end']();};}function respondWithResult(_0xc14b45,_0x511d72){_0x511d72=_0x511d72||0xc8;return function(_0x4ec34d){if(_0x4ec34d){return _0xc14b45[_0x6dab('0x1d')](_0x511d72)[_0x6dab('0x1e')](_0x4ec34d);}};}function respondWithFilteredResult(_0x140d2a,_0x5f5d9e){return function(_0xf11c22){if(_0xf11c22){var _0x5bcb8c=_0xf11c22[_0x6dab('0x1f')],_0xa4ac33=_0x5f5d9e[_0x6dab('0x20')],_0x3dfd90=_0x5f5d9e[_0x6dab('0x20')]+_0x5f5d9e[_0x6dab('0x21')],_0x1e416f;if(_0x3dfd90>=_0x5bcb8c){_0x3dfd90=_0x5bcb8c;_0x1e416f=0xc8;}else{_0x1e416f=0xce;}_0x140d2a[_0x6dab('0x1d')](_0x1e416f);return _0x140d2a[_0x6dab('0x22')]('Content-Range',_0xa4ac33+'-'+_0x3dfd90+'/'+_0x5bcb8c)[_0x6dab('0x1e')](_0xf11c22);}return null;};}function patchUpdates(_0x36ee1c){return function(_0x2236db){try{jsonpatch['apply'](_0x2236db,_0x36ee1c,!![]);}catch(_0x153b73){return BPromise[_0x6dab('0x23')](_0x153b73);}return _0x2236db[_0x6dab('0x24')]();};}function saveUpdates(_0x240d1d,_0x4a4f60){return function(_0x444c68){if(_0x444c68){return _0x444c68[_0x6dab('0x25')](_0x240d1d)['then'](function(_0x1c8f27){return _0x1c8f27;});}return null;};}function removeEntity(_0x58b8a2,_0x2d6ea3){return function(_0x2a2afc){if(_0x2a2afc){return _0x2a2afc[_0x6dab('0x26')]()['then'](function(){var _0x49a14a=_0x2a2afc['get']({'plain':!![]});var _0x3d0569='DefaultReports';return db[_0x6dab('0x27')][_0x6dab('0x26')]({'where':{'type':_0x3d0569,'resourceId':_0x49a14a['id']}})[_0x6dab('0x28')](function(){return _0x2a2afc;});})[_0x6dab('0x28')](function(){_0x58b8a2[_0x6dab('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x169cd0,_0x4bba45){return function(_0x3d7d0e){if(!_0x3d7d0e){_0x169cd0[_0x6dab('0x29')](0x194);}return _0x3d7d0e;};}function handleError(_0x2bfac7,_0x4e75ca){_0x4e75ca=_0x4e75ca||0x1f4;return function(_0xacb2d3){logger[_0x6dab('0x2a')](_0xacb2d3[_0x6dab('0x2b')]);if(_0xacb2d3[_0x6dab('0x2c')]){delete _0xacb2d3[_0x6dab('0x2c')];}_0x2bfac7[_0x6dab('0x1d')](_0x4e75ca)[_0x6dab('0x2d')](_0xacb2d3);};}exports[_0x6dab('0x2e')]=function(_0x2c017b,_0x5eeec8){var _0x473d3e={},_0x3d7ce8={},_0x4b118b={'count':0x0,'rows':[]};var _0x28aede=_[_0x6dab('0x2f')](db[_0x6dab('0x30')]['rawAttributes'],function(_0x1120d3){return{'name':_0x1120d3[_0x6dab('0x31')],'type':_0x1120d3[_0x6dab('0x32')][_0x6dab('0x33')]};});_0x3d7ce8['model']=_['map'](_0x28aede,'name');_0x3d7ce8[_0x6dab('0x34')]=_[_0x6dab('0x35')](_0x2c017b[_0x6dab('0x34')]);_0x3d7ce8[_0x6dab('0x36')]=_[_0x6dab('0x37')](_0x3d7ce8[_0x6dab('0x38')],_0x3d7ce8['query']);_0x473d3e[_0x6dab('0x39')]=_[_0x6dab('0x37')](_0x3d7ce8[_0x6dab('0x38')],qs[_0x6dab('0x3a')](_0x2c017b[_0x6dab('0x34')][_0x6dab('0x3a')]));_0x473d3e[_0x6dab('0x39')]=_0x473d3e[_0x6dab('0x39')][_0x6dab('0x3b')]?_0x473d3e[_0x6dab('0x39')]:_0x3d7ce8[_0x6dab('0x38')];if(!_0x2c017b[_0x6dab('0x34')][_0x6dab('0x3c')](_0x6dab('0x3d'))){_0x473d3e['limit']=qs[_0x6dab('0x21')](_0x2c017b['query'][_0x6dab('0x21')]);_0x473d3e[_0x6dab('0x20')]=qs['offset'](_0x2c017b[_0x6dab('0x34')]['offset']);}_0x473d3e[_0x6dab('0x3e')]=qs['sort'](_0x2c017b[_0x6dab('0x34')][_0x6dab('0x3f')]);_0x473d3e[_0x6dab('0x40')]=qs['filters'](_[_0x6dab('0x41')](_0x2c017b[_0x6dab('0x34')],_0x3d7ce8['filters']),_0x28aede);if(_0x2c017b['query'][_0x6dab('0x42')]){_0x473d3e['where']=_[_0x6dab('0x43')](_0x473d3e[_0x6dab('0x40')],{'$or':_[_0x6dab('0x2f')](_0x28aede,function(_0x35213c){if(_0x35213c[_0x6dab('0x32')]!==_0x6dab('0x44')){var _0x503178={};_0x503178[_0x35213c['name']]={'$like':'%'+_0x2c017b['query'][_0x6dab('0x42')]+'%'};return _0x503178;}})});}_0x473d3e=_[_0x6dab('0x43')]({},_0x473d3e,_0x2c017b[_0x6dab('0x45')]);var _0x2b0aa8={'where':_0x473d3e[_0x6dab('0x40')]};return db[_0x6dab('0x30')][_0x6dab('0x1f')](_0x2b0aa8)[_0x6dab('0x28')](function(_0x2dcc8f){_0x4b118b[_0x6dab('0x1f')]=_0x2dcc8f;if(_0x2c017b[_0x6dab('0x34')][_0x6dab('0x46')]){_0x473d3e[_0x6dab('0x47')]=[{'all':!![]}];}return db[_0x6dab('0x30')][_0x6dab('0x48')](_0x473d3e);})[_0x6dab('0x28')](function(_0x22a73d){_0x4b118b[_0x6dab('0x49')]=_0x22a73d;return _0x4b118b;})[_0x6dab('0x28')](respondWithFilteredResult(_0x5eeec8,_0x473d3e))['catch'](handleError(_0x5eeec8,null));};exports[_0x6dab('0x4a')]=function(_0xcfc9c2,_0x48563f){var _0x42e352={'raw':!![],'where':{'id':_0xcfc9c2[_0x6dab('0x4b')]['id']}},_0x5e69a0={};_0x5e69a0[_0x6dab('0x38')]=_[_0x6dab('0x35')](db[_0x6dab('0x30')][_0x6dab('0x4c')]);_0x5e69a0['query']=_[_0x6dab('0x35')](_0xcfc9c2[_0x6dab('0x34')]);_0x5e69a0[_0x6dab('0x36')]=_[_0x6dab('0x37')](_0x5e69a0[_0x6dab('0x38')],_0x5e69a0['query']);_0x42e352[_0x6dab('0x39')]=_[_0x6dab('0x37')](_0x5e69a0[_0x6dab('0x38')],qs[_0x6dab('0x3a')](_0xcfc9c2[_0x6dab('0x34')][_0x6dab('0x3a')]));_0x42e352[_0x6dab('0x39')]=_0x42e352[_0x6dab('0x39')][_0x6dab('0x3b')]?_0x42e352[_0x6dab('0x39')]:_0x5e69a0[_0x6dab('0x38')];if(_0xcfc9c2[_0x6dab('0x34')][_0x6dab('0x46')]){_0x42e352[_0x6dab('0x47')]=[{'all':!![]}];}_0x42e352=_[_0x6dab('0x43')]({},_0x42e352,_0xcfc9c2[_0x6dab('0x45')]);return db[_0x6dab('0x30')][_0x6dab('0x4d')](_0x42e352)[_0x6dab('0x28')](handleEntityNotFound(_0x48563f,null))[_0x6dab('0x28')](respondWithResult(_0x48563f,null))['catch'](handleError(_0x48563f,null));};exports[_0x6dab('0x4e')]=function(_0x4f2066,_0x4ed878){return db[_0x6dab('0x30')][_0x6dab('0x4e')](_0x4f2066[_0x6dab('0x4f')],{})[_0x6dab('0x28')](function(_0x4434a9){var _0x53b259=_0x4f2066['user'][_0x6dab('0x50')]({'plain':!![]});if(!_0x53b259)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53b259[_0x6dab('0x51')]===_0x6dab('0x52')){var _0x530be4=_0x4434a9[_0x6dab('0x50')]({'plain':!![]});var _0x357948=_0x6dab('0x53');return db[_0x6dab('0x54')]['find']({'where':{'name':_0x357948,'userProfileId':_0x53b259[_0x6dab('0x55')]},'raw':!![]})[_0x6dab('0x28')](function(_0x76170e){if(_0x76170e&&_0x76170e[_0x6dab('0x56')]===0x0){return db[_0x6dab('0x27')]['create']({'name':_0x530be4['name'],'resourceId':_0x530be4['id'],'type':'DefaultReports','sectionId':_0x76170e['id']},{})[_0x6dab('0x28')](function(){return _0x4434a9;});}else{return _0x4434a9;}})[_0x6dab('0x57')](function(_0x22a382){logger[_0x6dab('0x2a')](_0x6dab('0x58'),_0x22a382);throw _0x22a382;});}return _0x4434a9;})[_0x6dab('0x28')](respondWithResult(_0x4ed878,0xc9))[_0x6dab('0x57')](handleError(_0x4ed878,null));};exports[_0x6dab('0x25')]=function(_0x5a682b,_0x8b181c){if(_0x5a682b[_0x6dab('0x4f')]['id']){delete _0x5a682b['body']['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x5a682b[_0x6dab('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8b181c,null))[_0x6dab('0x28')](saveUpdates(_0x5a682b['body'],null))[_0x6dab('0x28')](respondWithResult(_0x8b181c,null))[_0x6dab('0x57')](handleError(_0x8b181c,null));};exports['destroy']=function(_0x1de637,_0x3a5c0b){return db['AnalyticDefaultReport'][_0x6dab('0x4d')]({'where':{'id':_0x1de637['params']['id']}})[_0x6dab('0x28')](handleEntityNotFound(_0x3a5c0b,null))['then'](removeEntity(_0x3a5c0b,null))[_0x6dab('0x57')](handleError(_0x3a5c0b,null));};exports[_0x6dab('0x59')]=function(_0x5b11ff,_0x3f5144){var _0x1282af=0xa;var _0x3235c8=[_0x6dab('0x5a'),_0x6dab('0x5b'),_0x6dab('0x5c'),'cross_join'];var _0x192f14={'SUM':_0x6dab('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6dab('0x5e'),'MAX':'MAX(%s)','MIN':_0x6dab('0x5f'),'AVG':_0x6dab('0x60'),'GROUP_CONCAT':_0x6dab('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6dab('0x62')};var _0x4cc1a7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6dab('0x63'),'HOUR':_0x6dab('0x64'),'ROUND':_0x6dab('0x65'),'UNIX_TIMESTAMP':_0x6dab('0x66')};var _0x36cb02=function(_0x4b3bf1){return!_[_0x6dab('0x67')]([_0x6dab('0x68'),_0x6dab('0x69'),_0x6dab('0x6a'),'IS\x20NOT\x20EMPTY'],_0x4b3bf1);};var _0x3a5df3=function(_0x3efe8f){if(!_0x3efe8f||!_0x3efe8f[_0x6dab('0x6b')][_0x6dab('0x3b')]){return'';}for(var _0x5744a7='(',_0x47180f=0x0;_0x47180f<_0x3efe8f['rules']['length'];_0x47180f+=0x1){_0x47180f>0x0&&(_0x5744a7+='\x20'+_0x3efe8f['operator']+'\x20');_0x5744a7+=_0x3efe8f[_0x6dab('0x6b')][_0x47180f][_0x6dab('0x6c')]?_0x3a5df3(_0x3efe8f[_0x6dab('0x6b')][_0x47180f][_0x6dab('0x6c')]):_0x3efe8f['rules'][_0x47180f][_0x6dab('0x6d')]+'\x20'+_0x3efe8f[_0x6dab('0x6b')][_0x47180f][_0x6dab('0x6e')]+(_0x36cb02(_0x3efe8f[_0x6dab('0x6b')][_0x47180f]['condition'])?'\x20'+_0x3efe8f[_0x6dab('0x6b')][_0x47180f][_0x6dab('0x6f')]:'');}return _0x5744a7+')';};var _0x5b2960={'where':{'id':_0x5b11ff['params']['id']}},_0x2d1f6f,_0x3195f7,_0x2eada2,_0x4f8186,_0x27a479;_0x5b2960=_[_0x6dab('0x43')]({},_0x5b2960,_0x5b11ff[_0x6dab('0x45')]);return db[_0x6dab('0x30')][_0x6dab('0x4d')](_0x5b2960)[_0x6dab('0x28')](function(_0x1990c6){if(_0x1990c6){_0x2d1f6f=_0x1990c6;return _0x1990c6[_0x6dab('0x70')]();}return null;})['then'](function(_0x2339da){if(_0x2339da){if(!_0x2339da[_0x6dab('0x3b')]){throw new db[(_0x6dab('0x71'))]['ValidationErrorItem'](_0x6dab('0x72'),0x193);}_0x3195f7=_0x2339da;return db[_0x6dab('0x73')]['findAll']({'raw':!![]});}return null;})[_0x6dab('0x28')](function(_0x3168f7){if(_0x3168f7){_0x2eada2=_[_0x6dab('0x74')](_0x3168f7,'id');var _0x23683b;var _0x3e67c5=squel[_0x6dab('0x75')]();_0x3e67c5[_0x6dab('0x76')](_0x2d1f6f[_0x6dab('0x77')]);for(var _0x464d51=0x0;_0x464d51<_0x3195f7[_0x6dab('0x3b')];_0x464d51+=0x1){_0x23683b=_0x3195f7[_0x464d51][_0x6dab('0x78')]?_0x2eada2[_0x3195f7[_0x464d51][_0x6dab('0x78')]]['metric']:_0x3195f7[_0x464d51]['field'];_0x23683b=_0x3195f7[_0x464d51][_0x6dab('0x79')]?_[_0x6dab('0x7a')](_0x192f14[_0x3195f7[_0x464d51][_0x6dab('0x79')]],'%s',_0x23683b):_0x23683b;_0x23683b=_0x3195f7[_0x464d51]['format']?_[_0x6dab('0x7a')](_0x4cc1a7[_0x3195f7[_0x464d51][_0x6dab('0x7b')]],'%s',_0x23683b):_0x23683b;if(_0x3195f7[_0x464d51]['groupBy']){_0x3e67c5[_0x6dab('0x6c')](_0x23683b);}_0x3195f7[_0x464d51][_0x6dab('0x7c')]&&_0x3e67c5[_0x6dab('0x3e')](_0x23683b,_0x3195f7[_0x464d51][_0x6dab('0x7c')]==='DESC'?![]:!![]);_0x3e67c5[_0x6dab('0x6d')](_0x23683b,_0x3195f7[_0x464d51][_0x6dab('0x7d')]||_0x23683b);}if(_0x2d1f6f[_0x6dab('0x7e')]){_0x2d1f6f[_0x6dab('0x7e')]=JSON[_0x6dab('0x7f')](_0x2d1f6f['joins']);for(var _0x472719=0x0;_0x472719<_0x2d1f6f['joins'][_0x6dab('0x3b')];_0x472719+=0x1){if(_0x2d1f6f[_0x6dab('0x7e')][_0x472719][_0x6dab('0x32')]&&_[_0x6dab('0x67')](_0x3235c8,_0x2d1f6f[_0x6dab('0x7e')][_0x472719][_0x6dab('0x32')])&&_0x2d1f6f[_0x6dab('0x7e')][_0x472719]['parentKey']&&_0x2d1f6f[_0x6dab('0x7e')][_0x472719]['foreignTable']&&_0x2d1f6f[_0x6dab('0x7e')][_0x472719]['foreignKey']){_0x3e67c5[_0x2d1f6f[_0x6dab('0x7e')][_0x472719][_0x6dab('0x32')]](_0x2d1f6f[_0x6dab('0x7e')][_0x472719][_0x6dab('0x80')],null,util[_0x6dab('0x7b')]('%s.%s\x20=\x20%s.%s',_0x2d1f6f['table'],_0x2d1f6f[_0x6dab('0x7e')][_0x472719]['parentKey'],_0x2d1f6f[_0x6dab('0x7e')][_0x472719][_0x6dab('0x80')],_0x2d1f6f[_0x6dab('0x7e')][_0x472719][_0x6dab('0x81')]));}}}if(_0x2d1f6f[_0x6dab('0x82')]){_0x2d1f6f[_0x6dab('0x82')]=JSON[_0x6dab('0x7f')](_0x2d1f6f[_0x6dab('0x82')]);_0x3e67c5[_0x6dab('0x40')](_0x3a5df3(_0x2d1f6f[_0x6dab('0x82')][_0x6dab('0x6c')]));}_0x27a479=_0x3e67c5[_0x6dab('0x83')]();_0x3e67c5[_0x6dab('0x21')](_0x1282af);_0x3e67c5['offset'](0x0);logger[_0x6dab('0x84')](_0x6dab('0x85'),_0x3e67c5[_0x6dab('0x86')]());return db['sequelize']['query'](_0x3e67c5[_0x6dab('0x86')](),{'type':db[_0x6dab('0x87')][_0x6dab('0x88')]['SELECT']});}})[_0x6dab('0x28')](respondWithResult(_0x3f5144,null))[_0x6dab('0x57')](handleError(_0x3f5144,null));};function runReport(_0x354408,_0x38dd3f,_0x56b247){var _0x10db44=_0x38dd3f[_0x6dab('0x2c')];var _0x197c0f=0xa;var _0x4e8ab4=['join','left_join',_0x6dab('0x5c'),_0x6dab('0x89')];var _0x5a1332={'SUM':_0x6dab('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6dab('0x5e'),'MAX':_0x6dab('0x8a'),'MIN':_0x6dab('0x5f'),'AVG':_0x6dab('0x60'),'GROUP_CONCAT':_0x6dab('0x61'),'GROUP_CONCAT ASC':_0x6dab('0x8b'),'GROUP_CONCAT DESC':_0x6dab('0x62')};var _0x5614b7={'SEC_TO_TIME':_0x6dab('0x8c'),'DATE':_0x6dab('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x6dab('0x65'),'UNIX_TIMESTAMP':_0x6dab('0x66')};var _0x2eb14c=function(_0x2e26fd){return!_[_0x6dab('0x67')](['IS\x20NULL',_0x6dab('0x69'),_0x6dab('0x6a'),_0x6dab('0x8d')],_0x2e26fd);};var _0x3d1485=function(_0x282aa9){if(!_0x282aa9||!_0x282aa9['rules']['length']){return'';}for(var _0x14e7d4='(',_0x121b8e=0x0;_0x121b8e<_0x282aa9['rules'][_0x6dab('0x3b')];_0x121b8e+=0x1){_0x121b8e>0x0&&(_0x14e7d4+='\x20'+_0x282aa9['operator']+'\x20');_0x14e7d4+=_0x282aa9['rules'][_0x121b8e][_0x6dab('0x6c')]?_0x3d1485(_0x282aa9[_0x6dab('0x6b')][_0x121b8e]['group']):_0x282aa9[_0x6dab('0x6b')][_0x121b8e][_0x6dab('0x6d')]+'\x20'+_0x282aa9[_0x6dab('0x6b')][_0x121b8e][_0x6dab('0x6e')]+(_0x2eb14c(_0x282aa9['rules'][_0x121b8e][_0x6dab('0x6e')])?'\x20'+_0x282aa9[_0x6dab('0x6b')][_0x121b8e]['value']:'');}return _0x14e7d4+')';};var _0x49c3da={'where':{'id':_0x354408['id']}},_0x4ba271,_0x7036a7,_0x4f1108,_0x2a4fd3,_0x48412b;_0x49c3da=_['merge']({},_0x49c3da,_0x56b247);return db[_0x6dab('0x30')][_0x6dab('0x4d')](_0x49c3da)[_0x6dab('0x28')](function(_0x520160){if(_0x520160){_0x4ba271=_0x520160;return _0x520160[_0x6dab('0x70')]();}return null;})['then'](function(_0x131b1e){if(_0x131b1e){if(!_0x131b1e[_0x6dab('0x3b')]){throw new db[(_0x6dab('0x71'))][(_0x6dab('0x8e'))](_0x6dab('0x72'),0x193);}_0x7036a7=_0x131b1e;return db['AnalyticMetric'][_0x6dab('0x48')]({'raw':!![]});}return null;})[_0x6dab('0x28')](function(_0x211364){if(_0x211364){_0x4f1108=_[_0x6dab('0x74')](_0x211364,'id');var _0x475e22;var _0x2647fd=squel[_0x6dab('0x75')]();_0x2647fd['from'](_0x4ba271['table']);for(var _0x2ea7bf=0x0;_0x2ea7bf<_0x7036a7['length'];_0x2ea7bf+=0x1){_0x475e22=_0x7036a7[_0x2ea7bf][_0x6dab('0x78')]?_0x4f1108[_0x7036a7[_0x2ea7bf][_0x6dab('0x78')]]['metric']:_0x7036a7[_0x2ea7bf][_0x6dab('0x6d')];_0x475e22=_0x7036a7[_0x2ea7bf]['function']?_['replace'](_0x5a1332[_0x7036a7[_0x2ea7bf][_0x6dab('0x79')]],'%s',_0x475e22):_0x475e22;_0x475e22=_0x7036a7[_0x2ea7bf][_0x6dab('0x7b')]?_[_0x6dab('0x7a')](_0x5614b7[_0x7036a7[_0x2ea7bf][_0x6dab('0x7b')]],'%s',_0x475e22):_0x475e22;if(_0x7036a7[_0x2ea7bf][_0x6dab('0x8f')]){_0x2647fd['group'](_0x475e22);}_0x7036a7[_0x2ea7bf][_0x6dab('0x7c')]&&_0x2647fd[_0x6dab('0x3e')](_0x475e22,_0x7036a7[_0x2ea7bf][_0x6dab('0x7c')]===_0x6dab('0x90')?![]:!![]);_0x2647fd[_0x6dab('0x6d')](_0x475e22,_0x7036a7[_0x2ea7bf][_0x6dab('0x7d')]||_0x475e22);}if(_0x4ba271[_0x6dab('0x7e')]){_0x4ba271[_0x6dab('0x7e')]=JSON[_0x6dab('0x7f')](_0x4ba271[_0x6dab('0x7e')]);for(var _0x3afc96=0x0;_0x3afc96<_0x4ba271[_0x6dab('0x7e')]['length'];_0x3afc96+=0x1){if(_0x4ba271[_0x6dab('0x7e')][_0x3afc96][_0x6dab('0x32')]&&_[_0x6dab('0x67')](_0x4e8ab4,_0x4ba271['joins'][_0x3afc96]['type'])&&_0x4ba271[_0x6dab('0x7e')][_0x3afc96][_0x6dab('0x91')]&&_0x4ba271[_0x6dab('0x7e')][_0x3afc96][_0x6dab('0x80')]&&_0x4ba271[_0x6dab('0x7e')][_0x3afc96][_0x6dab('0x81')]){_0x2647fd[_0x4ba271[_0x6dab('0x7e')][_0x3afc96][_0x6dab('0x32')]](_0x4ba271[_0x6dab('0x7e')][_0x3afc96][_0x6dab('0x80')],null,util[_0x6dab('0x7b')]('%s.%s\x20=\x20%s.%s',_0x4ba271[_0x6dab('0x77')],_0x4ba271[_0x6dab('0x7e')][_0x3afc96]['parentKey'],_0x4ba271[_0x6dab('0x7e')][_0x3afc96]['foreignTable'],_0x4ba271['joins'][_0x3afc96][_0x6dab('0x81')]));}}}if(_0x4ba271[_0x6dab('0x82')]){_0x4ba271[_0x6dab('0x82')]=JSON['parse'](_0x4ba271[_0x6dab('0x82')]);_0x2647fd[_0x6dab('0x40')](_0x3d1485(_0x4ba271['conditions'][_0x6dab('0x6c')]));}_0x48412b=_0x2647fd[_0x6dab('0x83')]();_0x2647fd[_0x6dab('0x21')](_0x197c0f);_0x2647fd['offset'](0x0);logger[_0x6dab('0x84')]('Limited\x20Query:',_0x2647fd[_0x6dab('0x86')]());return db['sequelize'][_0x6dab('0x34')](_0x2647fd[_0x6dab('0x86')](),{'type':db[_0x6dab('0x87')][_0x6dab('0x88')][_0x6dab('0x92')]});}})['then'](function(_0x1a60e3){if(!_0x1a60e3[_0x6dab('0x3b')]){throw new db['Sequelize'][(_0x6dab('0x8e'))](_0x6dab('0x93'),0xcc);}if(_0x38dd3f[_0x6dab('0x94')]===_0x6dab('0x95')){return null;}var _0x3f8aed=_[_0x6dab('0x43')](_0x38dd3f,{'name':_0x38dd3f['fullPath']||_0x38dd3f['name']||_0x4ba271['name'],'basename':_0x10db44,'savename':util[_0x6dab('0x7b')](_0x6dab('0x96'),_0x38dd3f[_0x6dab('0x2c')]||_0x4ba271['name'],require('randomstring')[_0x6dab('0x97')](0x4),_0x38dd3f[_0x6dab('0x94')]||_0x6dab('0x98')),'reportId':_0x4ba271['id'],'reportType':_0x6dab('0x99')});return db['AnalyticExtractedReport']['create'](_0x3f8aed,{'raw':!![]});})[_0x6dab('0x28')](function(_0x5ab518){if(_0x4ba271['table']===_0x6dab('0x9a')){_0x48412b[_0x6dab('0x40')](_0x4ba271[_0x6dab('0x77')]+_0x6dab('0x9b'),_0x38dd3f[_0x6dab('0x9c')],_0x38dd3f['endDate']);}else{_0x48412b[_0x6dab('0x40')](_0x4ba271['table']+_0x6dab('0x9d'),_0x38dd3f[_0x6dab('0x9c')],_0x38dd3f[_0x6dab('0x9e')]);}if(_0x5ab518){logger[_0x6dab('0x9f')](_0x6dab('0xa0'),_0x48412b[_0x6dab('0x86')]());require(_0x6dab('0xa1'))['fork'](path[_0x6dab('0x5a')](__dirname,_0x6dab('0xa2'),_0x5ab518[_0x6dab('0x94')]),[_0x5ab518['id'],_0x48412b[_0x6dab('0x86')](),path[_0x6dab('0x5a')](__dirname,'../../files/reports',_0x5ab518[_0x6dab('0xa3')]),_0x10db44]);return _0x5ab518;}else{var _0x59c00d=squel[_0x6dab('0x75')]();_0x59c00d[_0x6dab('0x76')]('('+_0x48412b[_0x6dab('0x86')]()+')',_0x6dab('0xa4'));_0x59c00d[_0x6dab('0x6d')](_0x6dab('0xa5'),_0x6dab('0x1f'));_0x48412b[_0x6dab('0x21')](_0x38dd3f[_0x6dab('0x21')]||_0x197c0f);_0x48412b[_0x6dab('0x20')](_0x38dd3f['offset']||0x0);return dbH['sequelize'][_0x6dab('0x34')](_0x59c00d[_0x6dab('0x86')](),{'type':dbH['sequelize'][_0x6dab('0x88')][_0x6dab('0x92')]})[_0x6dab('0x28')](function(_0x9ae309){if(!_0x9ae309[_0x6dab('0x3b')]){_0x2a4fd3=0x0;}else{_0x2a4fd3=_0x9ae309[0x0][_0x6dab('0x1f')]||0x0;}return dbH[_0x6dab('0x87')]['query'](_0x48412b[_0x6dab('0x86')](),{'type':dbH[_0x6dab('0x87')][_0x6dab('0x88')][_0x6dab('0x92')]});})['then'](function(_0xa330c3){return{'rows':_0xa330c3||[],'count':_0x2a4fd3};});}});}exports[_0x6dab('0xa6')]=function(_0x5ad86d,_0x23dd6d){return runReport(_0x5ad86d['params'],_0x5ad86d['query'],_0x5ad86d['options'])[_0x6dab('0x28')](respondWithResult(_0x23dd6d,null))['catch'](handleError(_0x23dd6d,null));};exports['runReport']=runReport;exports[_0x6dab('0x34')]=function(_0x56ba2c,_0x53d58f){var _0x271600=0xa;var _0x59aea4=[_0x6dab('0x5a'),_0x6dab('0x5b'),_0x6dab('0x5c'),_0x6dab('0x89')];var _0xafb582={'SUM':'SUM(%s)','COUNT':_0x6dab('0xa7'),'COUNT DISTINCT':_0x6dab('0x5e'),'MAX':'MAX(%s)','MIN':_0x6dab('0x5f'),'AVG':_0x6dab('0x60'),'GROUP_CONCAT':_0x6dab('0x61'),'GROUP_CONCAT ASC':_0x6dab('0x8b'),'GROUP_CONCAT DESC':_0x6dab('0x62')};var _0x4d6b79={'SEC_TO_TIME':_0x6dab('0x8c'),'DATE':_0x6dab('0x63'),'HOUR':_0x6dab('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34ca6d=function(_0x36662d){return!_[_0x6dab('0x67')]([_0x6dab('0x68'),_0x6dab('0x69'),_0x6dab('0x6a'),'IS\x20NOT\x20EMPTY'],_0x36662d);};var _0x416035=function(_0x3f872b){if(!_0x3f872b||!_0x3f872b['rules'][_0x6dab('0x3b')]){return'';}for(var _0xf5714='(',_0xdc5153=0x0;_0xdc5153<_0x3f872b[_0x6dab('0x6b')][_0x6dab('0x3b')];_0xdc5153+=0x1){_0xdc5153>0x0&&(_0xf5714+='\x20'+_0x3f872b[_0x6dab('0xa8')]+'\x20');_0xf5714+=_0x3f872b[_0x6dab('0x6b')][_0xdc5153][_0x6dab('0x6c')]?_0x416035(_0x3f872b[_0x6dab('0x6b')][_0xdc5153][_0x6dab('0x6c')]):_0x3f872b[_0x6dab('0x6b')][_0xdc5153][_0x6dab('0x6d')]+'\x20'+_0x3f872b[_0x6dab('0x6b')][_0xdc5153][_0x6dab('0x6e')]+(_0x34ca6d(_0x3f872b[_0x6dab('0x6b')][_0xdc5153][_0x6dab('0x6e')])?'\x20'+_0x3f872b[_0x6dab('0x6b')][_0xdc5153][_0x6dab('0x6f')]:'');}return _0xf5714+')';};var _0x2bd563={'where':{'id':_0x56ba2c['params']['id']}},_0x54b72a,_0x1962f1,_0xf93e19,_0x5d9636,_0x65f6b8;_0x2bd563=_[_0x6dab('0x43')]({},_0x2bd563,_0x56ba2c[_0x6dab('0x45')]);return db[_0x6dab('0x30')][_0x6dab('0x4d')](_0x2bd563)[_0x6dab('0x28')](function(_0x5b4d80){if(_0x5b4d80){_0x54b72a=_0x5b4d80;return _0x5b4d80[_0x6dab('0x70')]();}return null;})[_0x6dab('0x28')](function(_0x404f1f){if(_0x404f1f){if(!_0x404f1f[_0x6dab('0x3b')]){throw new db[(_0x6dab('0x71'))]['ValidationErrorItem'](_0x6dab('0x72'),0x193);}_0x1962f1=_0x404f1f;return db[_0x6dab('0x73')]['findAll']({'raw':!![]});}return null;})[_0x6dab('0x28')](function(_0x1e4389){if(_0x1e4389){_0xf93e19=_[_0x6dab('0x74')](_0x1e4389,'id');var _0x10a743;var _0x2f9e7a=squel['select']();_0x2f9e7a['from'](_0x54b72a[_0x6dab('0x77')]);for(var _0x21a2db=0x0;_0x21a2db<_0x1962f1[_0x6dab('0x3b')];_0x21a2db+=0x1){_0x10a743=_0x1962f1[_0x21a2db][_0x6dab('0x78')]?_0xf93e19[_0x1962f1[_0x21a2db]['MetricId']][_0x6dab('0xa9')]:_0x1962f1[_0x21a2db][_0x6dab('0x6d')];_0x10a743=_0x1962f1[_0x21a2db][_0x6dab('0x79')]?_[_0x6dab('0x7a')](_0xafb582[_0x1962f1[_0x21a2db][_0x6dab('0x79')]],'%s',_0x10a743):_0x10a743;_0x10a743=_0x1962f1[_0x21a2db][_0x6dab('0x7b')]?_['replace'](_0x4d6b79[_0x1962f1[_0x21a2db]['format']],'%s',_0x10a743):_0x10a743;if(_0x1962f1[_0x21a2db]['groupBy']){_0x2f9e7a['group'](_0x10a743);}_0x1962f1[_0x21a2db][_0x6dab('0x7c')]&&_0x2f9e7a[_0x6dab('0x3e')](_0x10a743,_0x1962f1[_0x21a2db]['orderBy']===_0x6dab('0x90')?![]:!![]);_0x2f9e7a[_0x6dab('0x6d')](_0x10a743,_0x1962f1[_0x21a2db][_0x6dab('0x7d')]||_0x10a743);}if(_0x54b72a[_0x6dab('0x7e')]){_0x54b72a[_0x6dab('0x7e')]=JSON[_0x6dab('0x7f')](_0x54b72a[_0x6dab('0x7e')]);for(var _0x14123b=0x0;_0x14123b<_0x54b72a[_0x6dab('0x7e')]['length'];_0x14123b+=0x1){if(_0x54b72a[_0x6dab('0x7e')][_0x14123b][_0x6dab('0x32')]&&_['includes'](_0x59aea4,_0x54b72a[_0x6dab('0x7e')][_0x14123b]['type'])&&_0x54b72a[_0x6dab('0x7e')][_0x14123b]['parentKey']&&_0x54b72a[_0x6dab('0x7e')][_0x14123b]['foreignTable']&&_0x54b72a[_0x6dab('0x7e')][_0x14123b][_0x6dab('0x81')]){_0x2f9e7a[_0x54b72a['joins'][_0x14123b][_0x6dab('0x32')]](_0x54b72a[_0x6dab('0x7e')][_0x14123b][_0x6dab('0x80')],null,util[_0x6dab('0x7b')](_0x6dab('0xaa'),_0x54b72a[_0x6dab('0x77')],_0x54b72a['joins'][_0x14123b][_0x6dab('0x91')],_0x54b72a['joins'][_0x14123b]['foreignTable'],_0x54b72a[_0x6dab('0x7e')][_0x14123b]['foreignKey']));}}}if(_0x54b72a[_0x6dab('0x82')]){_0x54b72a[_0x6dab('0x82')]=JSON[_0x6dab('0x7f')](_0x54b72a[_0x6dab('0x82')]);_0x2f9e7a[_0x6dab('0x40')](_0x416035(_0x54b72a[_0x6dab('0x82')][_0x6dab('0x6c')]));}_0x65f6b8=_0x2f9e7a[_0x6dab('0x83')]();_0x2f9e7a['limit'](_0x271600);_0x2f9e7a[_0x6dab('0x20')](0x0);logger[_0x6dab('0x84')](_0x6dab('0x85'),_0x2f9e7a[_0x6dab('0x86')]());return db[_0x6dab('0x87')][_0x6dab('0x34')](_0x2f9e7a[_0x6dab('0x86')](),{'type':db[_0x6dab('0x87')]['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x65f6b8[_0x6dab('0x86')]()};})[_0x6dab('0x28')](respondWithResult(_0x53d58f,null))[_0x6dab('0x57')](handleError(_0x53d58f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ebf4ed0..a09209f 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 _0x57ca=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x2b39e6,_0x36fdfe){var _0x5c83ac=function(_0x4bc2ed){while(--_0x4bc2ed){_0x2b39e6['push'](_0x2b39e6['shift']());}};_0x5c83ac(++_0x36fdfe);}(_0x57ca,0x108));var _0xa57c=function(_0x19a4aa,_0x2e2822){_0x19a4aa=_0x19a4aa-0x0;var _0x38f792=_0x57ca[_0x19a4aa];return _0x38f792;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d7595,_0x23bf60){var _0x163d06=function(_0x2c3a21){while(--_0x2c3a21){_0x3d7595['push'](_0x3d7595['shift']());}};_0x163d06(++_0x23bf60);}(_0x1967,0x173));var _0x7196=function(_0x4d7d4e,_0x42f570){_0x4d7d4e=_0x4d7d4e-0x0;var _0x5bcd91=_0x1967[_0x4d7d4e];return _0x5bcd91;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 7dcdbb8..eec0fd8 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 _0x777d=['stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x5c9c22,_0x1d5ad6){var _0x309c0a=function(_0x389ac1){while(--_0x389ac1){_0x5c9c22['push'](_0x5c9c22['shift']());}};_0x309c0a(++_0x1d5ad6);}(_0x777d,0xe9));var _0xd777=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x777d[_0xf71120];return _0xbe2fd3;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var moment=require(_0xd777('0x1'));var BPromise=require(_0xd777('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd777('0x3'));var db=require(_0xd777('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd777('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd777('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7c954,_0x5d1a5f,_0x57d67f){return new BPromise(function(_0x49d55d,_0x197296){return client[_0xd777('0x7')](_0xc7c954,_0x57d67f)[_0xd777('0x8')](function(_0x25450d){logger[_0xd777('0x9')](_0xd777('0xa'),_0x5d1a5f,_0xd777('0xb'));logger[_0xd777('0xc')](_0xd777('0xd'),_0x5d1a5f,_0xd777('0xb'),JSON[_0xd777('0xe')](_0x25450d));if(_0x25450d[_0xd777('0xf')]){if(_0x25450d[_0xd777('0xf')]['code']===0x1f4){logger['error'](_0xd777('0xa'),_0x5d1a5f,_0x25450d['error'][_0xd777('0x10')]);return _0x197296(_0x25450d[_0xd777('0xf')][_0xd777('0x10')]);}logger[_0xd777('0xf')](_0xd777('0xa'),_0x5d1a5f,_0x25450d['error'][_0xd777('0x10')]);return _0x49d55d(_0x25450d['error'][_0xd777('0x10')]);}else{logger[_0xd777('0x9')](_0xd777('0xa'),_0x5d1a5f,_0xd777('0xb'));_0x49d55d(_0x25450d[_0xd777('0x11')]['message']);}})[_0xd777('0x12')](function(_0x4b3d52){logger[_0xd777('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5d1a5f,_0x4b3d52);_0x197296(_0x4b3d52);});});} \ No newline at end of file +var _0x4dd2=['../../config/environment','jayson/promise','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0x1e67d0,_0x13b2c1){var _0x54f7de=function(_0x32fa45){while(--_0x32fa45){_0x1e67d0['push'](_0x1e67d0['shift']());}};_0x54f7de(++_0x13b2c1);}(_0x4dd2,0xf1));var _0x24dd=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0x4dd2[_0x2b0bc2];return _0x56e5b9;};'use strict';var _=require('lodash');var util=require(_0x24dd('0x0'));var moment=require(_0x24dd('0x1'));var BPromise=require(_0x24dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x24dd('0x4'));var logger=require('../../config/logger')(_0x24dd('0x5'));var config=require(_0x24dd('0x6'));var jayson=require(_0x24dd('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21b5b4,_0x390472,_0x1dd44c){return new BPromise(function(_0x424e48,_0x312f04){return client['request'](_0x21b5b4,_0x1dd44c)[_0x24dd('0x8')](function(_0x107a09){logger[_0x24dd('0x9')](_0x24dd('0xa'),_0x390472,_0x24dd('0xb'));logger['debug'](_0x24dd('0xc'),_0x390472,_0x24dd('0xb'),JSON[_0x24dd('0xd')](_0x107a09));if(_0x107a09[_0x24dd('0xe')]){if(_0x107a09[_0x24dd('0xe')][_0x24dd('0xf')]===0x1f4){logger[_0x24dd('0xe')](_0x24dd('0xa'),_0x390472,_0x107a09['error'][_0x24dd('0x10')]);return _0x312f04(_0x107a09['error'][_0x24dd('0x10')]);}logger[_0x24dd('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x390472,_0x107a09['error'][_0x24dd('0x10')]);return _0x424e48(_0x107a09[_0x24dd('0xe')][_0x24dd('0x10')]);}else{logger['info'](_0x24dd('0xa'),_0x390472,'request\x20sent');_0x424e48(_0x107a09[_0x24dd('0x11')][_0x24dd('0x10')]);}})[_0x24dd('0x12')](function(_0x25bdf4){logger['error'](_0x24dd('0xa'),_0x390472,_0x25bdf4);_0x312f04(_0x25bdf4);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 9eab287..fadfbab 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 _0x6a17=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','run','query','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x25caec,_0x225163){var _0x386db0=function(_0x4d3acf){while(--_0x4d3acf){_0x25caec['push'](_0x25caec['shift']());}};_0x386db0(++_0x225163);}(_0x6a17,0x1aa));var _0x76a1=function(_0x50bfba,_0x1cbced){_0x50bfba=_0x50bfba-0x0;var _0x26eff2=_0x6a17[_0x50bfba];return _0x26eff2;};'use strict';var multer=require(_0x76a1('0x0'));var util=require(_0x76a1('0x1'));var path=require(_0x76a1('0x2'));var timeout=require(_0x76a1('0x3'));var express=require(_0x76a1('0x4'));var router=express[_0x76a1('0x5')]();var auth=require(_0x76a1('0x6'));var interaction=require(_0x76a1('0x7'));var config=require(_0x76a1('0x8'));var controller=require(_0x76a1('0x9'));router['get']('/',auth[_0x76a1('0xa')](),controller[_0x76a1('0xb')]);router[_0x76a1('0xc')](_0x76a1('0xd'),auth[_0x76a1('0xa')](),controller[_0x76a1('0xe')]);router['get'](_0x76a1('0xf'),auth[_0x76a1('0xa')](),controller[_0x76a1('0x10')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x76a1('0x11')]);router[_0x76a1('0xc')]('/:id/query',auth[_0x76a1('0xa')](),controller[_0x76a1('0x12')]);router[_0x76a1('0x13')]('/',auth[_0x76a1('0xa')](),controller[_0x76a1('0x14')]);router[_0x76a1('0x15')](_0x76a1('0xd'),auth['isAuthenticated'](),controller[_0x76a1('0x16')]);router['delete'](_0x76a1('0xd'),auth['isAuthenticated'](),controller[_0x76a1('0x17')]);module['exports']=router; \ No newline at end of file +var _0x89d3=['./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x89d3,0x1db));var _0x389d=function(_0x27c24d,_0x2b50f1){_0x27c24d=_0x27c24d-0x0;var _0x14e722=_0x89d3[_0x27c24d];return _0x14e722;};'use strict';var multer=require(_0x389d('0x0'));var util=require(_0x389d('0x1'));var path=require(_0x389d('0x2'));var timeout=require(_0x389d('0x3'));var express=require(_0x389d('0x4'));var router=express[_0x389d('0x5')]();var auth=require(_0x389d('0x6'));var interaction=require(_0x389d('0x7'));var config=require('../../config/environment');var controller=require(_0x389d('0x8'));router[_0x389d('0x9')]('/',auth[_0x389d('0xa')](),controller['index']);router[_0x389d('0x9')](_0x389d('0xb'),auth['isAuthenticated'](),controller[_0x389d('0xc')]);router['get'](_0x389d('0xd'),auth[_0x389d('0xa')](),controller[_0x389d('0xe')]);router[_0x389d('0x9')](_0x389d('0xf'),auth['isAuthenticated'](),controller[_0x389d('0x10')]);router[_0x389d('0x9')]('/:id/query',auth['isAuthenticated'](),controller['query']);router[_0x389d('0x11')]('/',auth[_0x389d('0xa')](),controller[_0x389d('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x389d('0x13')]);router[_0x389d('0x14')](_0x389d('0xb'),auth[_0x389d('0xa')](),controller[_0x389d('0x15')]);module[_0x389d('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 62f779a..f2d1602 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 _0xcf00=['STRING','csv','pdf','DATE','Loading','ENUM','manual','INTEGER','UNSIGNED'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xcf00,0xcf));var _0x0cf0=function(_0x5013f2,_0x3d896b){_0x5013f2=_0x5013f2-0x0;var _0x166b9f=_0xcf00[_0x5013f2];return _0x166b9f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x0cf0('0x0')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x0cf0('0x1'),_0x0cf0('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x0cf0('0x1')},'savename':{'type':Sequelize[_0x0cf0('0x0')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0cf0('0x3')]},'endDate':{'type':Sequelize[_0x0cf0('0x3')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x0cf0('0x4')},'type':{'type':Sequelize[_0x0cf0('0x5')](_0x0cf0('0x6'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x0cf0('0x7')](0xb)[_0x0cf0('0x8')]},'reportType':{'type':Sequelize[_0x0cf0('0x0')]}}; \ No newline at end of file +var _0x2660=['manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled'];(function(_0x46e0d2,_0x4585c6){var _0x5c8615=function(_0x105cc5){while(--_0x105cc5){_0x46e0d2['push'](_0x46e0d2['shift']());}};_0x5c8615(++_0x4585c6);}(_0x2660,0xed));var _0x0266=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0x2660[_0x582d0b];return _0x2e93e1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0266('0x0'));module[_0x0266('0x1')]={'name':{'type':Sequelize[_0x0266('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x0266('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x0266('0x3')](_0x0266('0x4'),_0x0266('0x5'),_0x0266('0x6')),'allowNull':![],'defaultValue':_0x0266('0x4')},'savename':{'type':Sequelize[_0x0266('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x0266('0x7')]},'status':{'type':Sequelize[_0x0266('0x2')],'defaultValue':_0x0266('0x8')},'type':{'type':Sequelize[_0x0266('0x3')]('manual',_0x0266('0x9')),'allowNull':![],'defaultValue':_0x0266('0xa')},'reportId':{'type':Sequelize[_0x0266('0xb')](0xb)[_0x0266('0xc')]},'reportType':{'type':Sequelize[_0x0266('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d04bf73..acc0284 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 _0x3ef4=['get','ExtractedReports','UserProfileResource','end','error','name','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy'];(function(_0x1449de,_0x151e8b){var _0x390c3b=function(_0x39e018){while(--_0x39e018){_0x1449de['push'](_0x1449de['shift']());}};_0x390c3b(++_0x151e8b);}(_0x3ef4,0x1a8));var _0x43ef=function(_0x2c654f,_0x11ce94){_0x2c654f=_0x2c654f-0x0;var _0xa53d15=_0x3ef4[_0x2c654f];return _0xa53d15;};'use strict';var pdf=require(_0x43ef('0x0'));var emlformat=require(_0x43ef('0x1'));var rimraf=require(_0x43ef('0x2'));var zipdir=require(_0x43ef('0x3'));var jsonpatch=require(_0x43ef('0x4'));var rp=require('request-promise');var moment=require(_0x43ef('0x5'));var BPromise=require(_0x43ef('0x6'));var Mustache=require('mustache');var util=require(_0x43ef('0x7'));var path=require(_0x43ef('0x8'));var sox=require('sox');var csv=require(_0x43ef('0x9'));var ejs=require(_0x43ef('0xa'));var fs=require('fs');var _=require(_0x43ef('0xb'));var squel=require(_0x43ef('0xc'));var crypto=require(_0x43ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x43ef('0xe'));var toCsv=require('to-csv');var querystring=require(_0x43ef('0xf'));var Papa=require(_0x43ef('0x10'));var Redis=require(_0x43ef('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x43ef('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43ef('0x13'));var logger=require(_0x43ef('0x14'))(_0x43ef('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x43ef('0x16'))['db'];function respondWithStatusCode(_0x571fd5,_0x5054a2){_0x5054a2=_0x5054a2||0xcc;return function(_0x175ccc){if(_0x175ccc){return _0x571fd5[_0x43ef('0x17')](_0x5054a2);}return _0x571fd5[_0x43ef('0x18')](_0x5054a2)['end']();};}function respondWithResult(_0x32e6b7,_0x219970){_0x219970=_0x219970||0xc8;return function(_0x2fb69e){if(_0x2fb69e){return _0x32e6b7[_0x43ef('0x18')](_0x219970)[_0x43ef('0x19')](_0x2fb69e);}};}function respondWithFilteredResult(_0x55bb44,_0xa7b21f){return function(_0x12b37b){if(_0x12b37b){var _0x55a05d=_0x12b37b[_0x43ef('0x1a')],_0x442d90=_0xa7b21f['offset'],_0x4b57e6=_0xa7b21f[_0x43ef('0x1b')]+_0xa7b21f[_0x43ef('0x1c')],_0x5bd790;if(_0x4b57e6>=_0x55a05d){_0x4b57e6=_0x55a05d;_0x5bd790=0xc8;}else{_0x5bd790=0xce;}_0x55bb44[_0x43ef('0x18')](_0x5bd790);return _0x55bb44[_0x43ef('0x1d')](_0x43ef('0x1e'),_0x442d90+'-'+_0x4b57e6+'/'+_0x55a05d)[_0x43ef('0x19')](_0x12b37b);}return null;};}function patchUpdates(_0x50c183){return function(_0x17f574){try{jsonpatch[_0x43ef('0x1f')](_0x17f574,_0x50c183,!![]);}catch(_0xe2e9c5){return BPromise['reject'](_0xe2e9c5);}return _0x17f574[_0x43ef('0x20')]();};}function saveUpdates(_0x5e83d4,_0x38f4bf){return function(_0x58fce1){if(_0x58fce1){return _0x58fce1[_0x43ef('0x21')](_0x5e83d4)[_0x43ef('0x22')](function(_0x1e3d96){return _0x1e3d96;});}return null;};}function removeEntity(_0x4e6570,_0x76b53){return function(_0x5e30b5){if(_0x5e30b5){return _0x5e30b5[_0x43ef('0x23')]()[_0x43ef('0x22')](function(){var _0x20165e=_0x5e30b5[_0x43ef('0x24')]({'plain':!![]});var _0x4c6275=_0x43ef('0x25');return db[_0x43ef('0x26')]['destroy']({'where':{'type':_0x4c6275,'resourceId':_0x20165e['id']}})[_0x43ef('0x22')](function(){return _0x5e30b5;});})[_0x43ef('0x22')](function(){_0x4e6570[_0x43ef('0x18')](0xcc)[_0x43ef('0x27')]();});}};}function handleEntityNotFound(_0x26e8d2,_0x1dabeb){return function(_0xb3ed0c){if(!_0xb3ed0c){_0x26e8d2[_0x43ef('0x17')](0x194);}return _0xb3ed0c;};}function handleError(_0x41d1e5,_0x199503){_0x199503=_0x199503||0x1f4;return function(_0x5dd001){logger[_0x43ef('0x28')](_0x5dd001['stack']);if(_0x5dd001['name']){delete _0x5dd001[_0x43ef('0x29')];}_0x41d1e5['status'](_0x199503)['send'](_0x5dd001);};}exports['index']=function(_0x13eea8,_0x2aa531){var _0x23e01d={},_0x34e71e={},_0x35bb72={'count':0x0,'rows':[]};var _0x3b3501=_[_0x43ef('0x2a')](db[_0x43ef('0x2b')]['rawAttributes'],function(_0x9890d5){return{'name':_0x9890d5[_0x43ef('0x2c')],'type':_0x9890d5[_0x43ef('0x2d')][_0x43ef('0x2e')]};});_0x34e71e[_0x43ef('0x2f')]=_[_0x43ef('0x2a')](_0x3b3501,'name');_0x34e71e[_0x43ef('0x30')]=_[_0x43ef('0x31')](_0x13eea8[_0x43ef('0x30')]);_0x34e71e[_0x43ef('0x32')]=_['intersection'](_0x34e71e[_0x43ef('0x2f')],_0x34e71e['query']);_0x23e01d[_0x43ef('0x33')]=_[_0x43ef('0x34')](_0x34e71e[_0x43ef('0x2f')],qs[_0x43ef('0x35')](_0x13eea8[_0x43ef('0x30')]['fields']));_0x23e01d[_0x43ef('0x33')]=_0x23e01d[_0x43ef('0x33')][_0x43ef('0x36')]?_0x23e01d[_0x43ef('0x33')]:_0x34e71e[_0x43ef('0x2f')];if(!_0x13eea8['query'][_0x43ef('0x37')](_0x43ef('0x38'))){_0x23e01d[_0x43ef('0x1c')]=qs[_0x43ef('0x1c')](_0x13eea8['query']['limit']);_0x23e01d[_0x43ef('0x1b')]=qs['offset'](_0x13eea8[_0x43ef('0x30')][_0x43ef('0x1b')]);}_0x23e01d[_0x43ef('0x39')]=qs['sort'](_0x13eea8[_0x43ef('0x30')][_0x43ef('0x3a')]);_0x23e01d[_0x43ef('0x3b')]=qs[_0x43ef('0x32')](_['pick'](_0x13eea8[_0x43ef('0x30')],_0x34e71e[_0x43ef('0x32')]),_0x3b3501);if(_0x13eea8[_0x43ef('0x30')][_0x43ef('0x3c')]){_0x23e01d['where']=_[_0x43ef('0x3d')](_0x23e01d[_0x43ef('0x3b')],{'$or':_[_0x43ef('0x2a')](_0x3b3501,function(_0x4120f8){if(_0x4120f8[_0x43ef('0x2d')]!=='VIRTUAL'){var _0x57c07d={};_0x57c07d[_0x4120f8[_0x43ef('0x29')]]={'$like':'%'+_0x13eea8[_0x43ef('0x30')][_0x43ef('0x3c')]+'%'};return _0x57c07d;}})});}_0x23e01d=_['merge']({},_0x23e01d,_0x13eea8['options']);var _0xd9fc0e={'where':_0x23e01d[_0x43ef('0x3b')]};return db['AnalyticExtractedReport']['count'](_0xd9fc0e)[_0x43ef('0x22')](function(_0x53ede5){_0x35bb72[_0x43ef('0x1a')]=_0x53ede5;if(_0x13eea8[_0x43ef('0x30')][_0x43ef('0x3e')]){_0x23e01d['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x43ef('0x3f')](_0x23e01d);})[_0x43ef('0x22')](function(_0x24db38){_0x35bb72[_0x43ef('0x40')]=_0x24db38;return _0x35bb72;})[_0x43ef('0x22')](respondWithFilteredResult(_0x2aa531,_0x23e01d))['catch'](handleError(_0x2aa531,null));};exports[_0x43ef('0x41')]=function(_0xfc3874,_0x4e2940){var _0x305ae0={'raw':!![],'where':{'id':_0xfc3874[_0x43ef('0x42')]['id']}},_0x920b9a={};_0x920b9a[_0x43ef('0x2f')]=_[_0x43ef('0x31')](db[_0x43ef('0x2b')][_0x43ef('0x43')]);_0x920b9a[_0x43ef('0x30')]=_['keys'](_0xfc3874[_0x43ef('0x30')]);_0x920b9a[_0x43ef('0x32')]=_[_0x43ef('0x34')](_0x920b9a[_0x43ef('0x2f')],_0x920b9a['query']);_0x305ae0[_0x43ef('0x33')]=_[_0x43ef('0x34')](_0x920b9a[_0x43ef('0x2f')],qs[_0x43ef('0x35')](_0xfc3874[_0x43ef('0x30')]['fields']));_0x305ae0['attributes']=_0x305ae0[_0x43ef('0x33')]['length']?_0x305ae0[_0x43ef('0x33')]:_0x920b9a[_0x43ef('0x2f')];if(_0xfc3874[_0x43ef('0x30')][_0x43ef('0x3e')]){_0x305ae0[_0x43ef('0x44')]=[{'all':!![]}];}_0x305ae0=_[_0x43ef('0x3d')]({},_0x305ae0,_0xfc3874['options']);return db[_0x43ef('0x2b')][_0x43ef('0x45')](_0x305ae0)[_0x43ef('0x22')](handleEntityNotFound(_0x4e2940,null))[_0x43ef('0x22')](respondWithResult(_0x4e2940,null))[_0x43ef('0x46')](handleError(_0x4e2940,null));};exports[_0x43ef('0x47')]=function(_0x4fc019,_0x5846ca){return db['AnalyticExtractedReport'][_0x43ef('0x47')](_0x4fc019['body'],{})[_0x43ef('0x22')](function(_0x5478c2){var _0x50a307=_0x4fc019[_0x43ef('0x48')]['get']({'plain':!![]});if(!_0x50a307)throw new Error(_0x43ef('0x49'));if(_0x50a307[_0x43ef('0x4a')]===_0x43ef('0x48')){var _0x232011=_0x5478c2['get']({'plain':!![]});var _0x301dbc='ExtractedReports';return db[_0x43ef('0x4b')][_0x43ef('0x45')]({'where':{'name':_0x301dbc,'userProfileId':_0x50a307['userProfileId']},'raw':!![]})['then'](function(_0x28adc6){if(_0x28adc6&&_0x28adc6[_0x43ef('0x4c')]===0x0){return db[_0x43ef('0x26')]['create']({'name':_0x232011[_0x43ef('0x29')],'resourceId':_0x232011['id'],'type':_0x28adc6[_0x43ef('0x29')],'sectionId':_0x28adc6['id']},{})[_0x43ef('0x22')](function(){return _0x5478c2;});}else{return _0x5478c2;}})['catch'](function(_0x3a5912){logger['error'](_0x43ef('0x4d'),_0x3a5912);throw _0x3a5912;});}return _0x5478c2;})[_0x43ef('0x22')](respondWithResult(_0x5846ca,0xc9))['catch'](handleError(_0x5846ca,null));};exports[_0x43ef('0x21')]=function(_0x3d142a,_0xb5a23c){if(_0x3d142a['body']['id']){delete _0x3d142a[_0x43ef('0x4e')]['id'];}return db[_0x43ef('0x2b')][_0x43ef('0x45')]({'where':{'id':_0x3d142a[_0x43ef('0x42')]['id']}})[_0x43ef('0x22')](handleEntityNotFound(_0xb5a23c,null))[_0x43ef('0x22')](saveUpdates(_0x3d142a[_0x43ef('0x4e')],null))[_0x43ef('0x22')](respondWithResult(_0xb5a23c,null))[_0x43ef('0x46')](handleError(_0xb5a23c,null));};exports[_0x43ef('0x23')]=function(_0x3e4552,_0x5b8769){return db['AnalyticExtractedReport'][_0x43ef('0x45')]({'where':{'id':_0x3e4552[_0x43ef('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b8769,null))['then'](removeEntity(_0x5b8769,null))[_0x43ef('0x46')](handleError(_0x5b8769,null));};exports[_0x43ef('0x4f')]=function(_0x25893b,_0x3f2998,_0x23fac4){return db['AnalyticExtractedReport'][_0x43ef('0x45')]({'where':{'id':_0x25893b[_0x43ef('0x42')]['id']},'attributes':[_0x43ef('0x29'),'basename',_0x43ef('0x50'),'output'],'raw':!![]})[_0x43ef('0x22')](handleEntityNotFound(_0x3f2998,null))[_0x43ef('0x22')](function(_0x1702df){if(_0x1702df){if(!fs[_0x43ef('0x51')](path[_0x43ef('0x52')](config[_0x43ef('0x53')],_0x43ef('0x54'),_0x1702df[_0x43ef('0x50')]))){throw new db[(_0x43ef('0x55'))][(_0x43ef('0x56'))](_0x43ef('0x57'));}if(_0x25893b[_0x43ef('0x30')][_0x43ef('0x58')]){return _0x3f2998[_0x43ef('0x17')](0xc8);}return _0x3f2998[_0x43ef('0x4f')](path[_0x43ef('0x52')](config[_0x43ef('0x53')],_0x43ef('0x54'),_0x1702df[_0x43ef('0x50')]),util[_0x43ef('0x59')](_0x43ef('0x5a'),_0x1702df['basename']||_0x1702df['name'],_0x1702df['output'][_0x43ef('0x5b')]()));}})[_0x43ef('0x46')](handleError(_0x3f2998,null));}; \ No newline at end of file +var _0xb596=['get','ExtractedReports','UserProfileResource','stack','index','map','AnalyticExtractedReport','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','user','UserProfileSection','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','download','server/files/reports','format','%s.%s','basename','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','destroy','then'];(function(_0x2d5d3c,_0x4e0363){var _0x32725b=function(_0x939891){while(--_0x939891){_0x2d5d3c['push'](_0x2d5d3c['shift']());}};_0x32725b(++_0x4e0363);}(_0xb596,0x15b));var _0x6b59=function(_0x1a15ed,_0x406a1b){_0x1a15ed=_0x1a15ed-0x0;var _0x386fe8=_0xb596[_0x1a15ed];return _0x386fe8;};'use strict';var pdf=require(_0x6b59('0x0'));var emlformat=require(_0x6b59('0x1'));var rimraf=require(_0x6b59('0x2'));var zipdir=require(_0x6b59('0x3'));var jsonpatch=require(_0x6b59('0x4'));var rp=require(_0x6b59('0x5'));var moment=require(_0x6b59('0x6'));var BPromise=require(_0x6b59('0x7'));var Mustache=require('mustache');var util=require(_0x6b59('0x8'));var path=require('path');var sox=require(_0x6b59('0x9'));var csv=require('to-csv');var ejs=require(_0x6b59('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6b59('0xb'));var crypto=require('crypto');var jsforce=require(_0x6b59('0xc'));var deskjs=require(_0x6b59('0xd'));var toCsv=require(_0x6b59('0xe'));var querystring=require(_0x6b59('0xf'));var Papa=require(_0x6b59('0x10'));var Redis=require(_0x6b59('0x11'));var authService=require(_0x6b59('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b59('0x13'));var logger=require(_0x6b59('0x14'))(_0x6b59('0x15'));var utils=require(_0x6b59('0x16'));var config=require(_0x6b59('0x17'));var db=require(_0x6b59('0x18'))['db'];function respondWithStatusCode(_0xd63d1f,_0x3b6aae){_0x3b6aae=_0x3b6aae||0xcc;return function(_0x4aa1aa){if(_0x4aa1aa){return _0xd63d1f[_0x6b59('0x19')](_0x3b6aae);}return _0xd63d1f[_0x6b59('0x1a')](_0x3b6aae)[_0x6b59('0x1b')]();};}function respondWithResult(_0x3ae834,_0x37c07f){_0x37c07f=_0x37c07f||0xc8;return function(_0xbecfc5){if(_0xbecfc5){return _0x3ae834[_0x6b59('0x1a')](_0x37c07f)[_0x6b59('0x1c')](_0xbecfc5);}};}function respondWithFilteredResult(_0x2d3d88,_0x56b584){return function(_0x373ae7){if(_0x373ae7){var _0xb71fd3=_0x373ae7[_0x6b59('0x1d')],_0x24a572=_0x56b584[_0x6b59('0x1e')],_0x3017cf=_0x56b584[_0x6b59('0x1e')]+_0x56b584['limit'],_0x431ceb;if(_0x3017cf>=_0xb71fd3){_0x3017cf=_0xb71fd3;_0x431ceb=0xc8;}else{_0x431ceb=0xce;}_0x2d3d88[_0x6b59('0x1a')](_0x431ceb);return _0x2d3d88['set'](_0x6b59('0x1f'),_0x24a572+'-'+_0x3017cf+'/'+_0xb71fd3)['json'](_0x373ae7);}return null;};}function patchUpdates(_0x530e55){return function(_0x49377b){try{jsonpatch['apply'](_0x49377b,_0x530e55,!![]);}catch(_0x4dcaf9){return BPromise[_0x6b59('0x20')](_0x4dcaf9);}return _0x49377b[_0x6b59('0x21')]();};}function saveUpdates(_0x5b8bcb,_0x22f165){return function(_0x1130b3){if(_0x1130b3){return _0x1130b3[_0x6b59('0x22')](_0x5b8bcb)['then'](function(_0x2703b2){return _0x2703b2;});}return null;};}function removeEntity(_0x48f223,_0x5d101a){return function(_0x319cf7){if(_0x319cf7){return _0x319cf7[_0x6b59('0x23')]()[_0x6b59('0x24')](function(){var _0x2915bf=_0x319cf7[_0x6b59('0x25')]({'plain':!![]});var _0x4c2116=_0x6b59('0x26');return db[_0x6b59('0x27')][_0x6b59('0x23')]({'where':{'type':_0x4c2116,'resourceId':_0x2915bf['id']}})['then'](function(){return _0x319cf7;});})[_0x6b59('0x24')](function(){_0x48f223['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4431cd,_0x2a70f0){return function(_0x1da595){if(!_0x1da595){_0x4431cd[_0x6b59('0x19')](0x194);}return _0x1da595;};}function handleError(_0x205d51,_0x47db5a){_0x47db5a=_0x47db5a||0x1f4;return function(_0x1c75f0){logger['error'](_0x1c75f0[_0x6b59('0x28')]);if(_0x1c75f0['name']){delete _0x1c75f0['name'];}_0x205d51[_0x6b59('0x1a')](_0x47db5a)['send'](_0x1c75f0);};}exports[_0x6b59('0x29')]=function(_0x588f38,_0x515580){var _0x1cc062={},_0x1a9f44={},_0xb306a6={'count':0x0,'rows':[]};var _0x5d2284=_[_0x6b59('0x2a')](db[_0x6b59('0x2b')]['rawAttributes'],function(_0x3a88af){return{'name':_0x3a88af[_0x6b59('0x2c')],'type':_0x3a88af[_0x6b59('0x2d')][_0x6b59('0x2e')]};});_0x1a9f44[_0x6b59('0x2f')]=_[_0x6b59('0x2a')](_0x5d2284,_0x6b59('0x30'));_0x1a9f44[_0x6b59('0x31')]=_[_0x6b59('0x32')](_0x588f38[_0x6b59('0x31')]);_0x1a9f44['filters']=_[_0x6b59('0x33')](_0x1a9f44[_0x6b59('0x2f')],_0x1a9f44[_0x6b59('0x31')]);_0x1cc062['attributes']=_['intersection'](_0x1a9f44[_0x6b59('0x2f')],qs[_0x6b59('0x34')](_0x588f38['query'][_0x6b59('0x34')]));_0x1cc062[_0x6b59('0x35')]=_0x1cc062[_0x6b59('0x35')][_0x6b59('0x36')]?_0x1cc062[_0x6b59('0x35')]:_0x1a9f44[_0x6b59('0x2f')];if(!_0x588f38[_0x6b59('0x31')][_0x6b59('0x37')](_0x6b59('0x38'))){_0x1cc062[_0x6b59('0x39')]=qs[_0x6b59('0x39')](_0x588f38[_0x6b59('0x31')][_0x6b59('0x39')]);_0x1cc062[_0x6b59('0x1e')]=qs[_0x6b59('0x1e')](_0x588f38[_0x6b59('0x31')][_0x6b59('0x1e')]);}_0x1cc062[_0x6b59('0x3a')]=qs[_0x6b59('0x3b')](_0x588f38[_0x6b59('0x31')][_0x6b59('0x3b')]);_0x1cc062[_0x6b59('0x3c')]=qs[_0x6b59('0x3d')](_[_0x6b59('0x3e')](_0x588f38[_0x6b59('0x31')],_0x1a9f44[_0x6b59('0x3d')]),_0x5d2284);if(_0x588f38[_0x6b59('0x31')]['filter']){_0x1cc062[_0x6b59('0x3c')]=_['merge'](_0x1cc062[_0x6b59('0x3c')],{'$or':_['map'](_0x5d2284,function(_0x5e6aa5){if(_0x5e6aa5[_0x6b59('0x2d')]!==_0x6b59('0x3f')){var _0x2f869f={};_0x2f869f[_0x5e6aa5['name']]={'$like':'%'+_0x588f38[_0x6b59('0x31')][_0x6b59('0x40')]+'%'};return _0x2f869f;}})});}_0x1cc062=_[_0x6b59('0x41')]({},_0x1cc062,_0x588f38[_0x6b59('0x42')]);var _0x5d7914={'where':_0x1cc062[_0x6b59('0x3c')]};return db[_0x6b59('0x2b')][_0x6b59('0x1d')](_0x5d7914)[_0x6b59('0x24')](function(_0x3bf9ab){_0xb306a6['count']=_0x3bf9ab;if(_0x588f38[_0x6b59('0x31')][_0x6b59('0x43')]){_0x1cc062[_0x6b59('0x44')]=[{'all':!![]}];}return db[_0x6b59('0x2b')][_0x6b59('0x45')](_0x1cc062);})['then'](function(_0x3d8659){_0xb306a6[_0x6b59('0x46')]=_0x3d8659;return _0xb306a6;})[_0x6b59('0x24')](respondWithFilteredResult(_0x515580,_0x1cc062))[_0x6b59('0x47')](handleError(_0x515580,null));};exports[_0x6b59('0x48')]=function(_0x356957,_0x3282a7){var _0x4f8b70={'raw':!![],'where':{'id':_0x356957[_0x6b59('0x49')]['id']}},_0x3b62f7={};_0x3b62f7[_0x6b59('0x2f')]=_[_0x6b59('0x32')](db[_0x6b59('0x2b')][_0x6b59('0x4a')]);_0x3b62f7[_0x6b59('0x31')]=_['keys'](_0x356957['query']);_0x3b62f7[_0x6b59('0x3d')]=_[_0x6b59('0x33')](_0x3b62f7['model'],_0x3b62f7[_0x6b59('0x31')]);_0x4f8b70[_0x6b59('0x35')]=_['intersection'](_0x3b62f7[_0x6b59('0x2f')],qs[_0x6b59('0x34')](_0x356957[_0x6b59('0x31')][_0x6b59('0x34')]));_0x4f8b70[_0x6b59('0x35')]=_0x4f8b70['attributes']['length']?_0x4f8b70[_0x6b59('0x35')]:_0x3b62f7[_0x6b59('0x2f')];if(_0x356957['query'][_0x6b59('0x43')]){_0x4f8b70[_0x6b59('0x44')]=[{'all':!![]}];}_0x4f8b70=_['merge']({},_0x4f8b70,_0x356957[_0x6b59('0x42')]);return db[_0x6b59('0x2b')][_0x6b59('0x4b')](_0x4f8b70)[_0x6b59('0x24')](handleEntityNotFound(_0x3282a7,null))[_0x6b59('0x24')](respondWithResult(_0x3282a7,null))[_0x6b59('0x47')](handleError(_0x3282a7,null));};exports['create']=function(_0x44d018,_0x26c111){return db['AnalyticExtractedReport']['create'](_0x44d018[_0x6b59('0x4c')],{})[_0x6b59('0x24')](function(_0xbb6f06){var _0x40dbcd=_0x44d018['user'][_0x6b59('0x25')]({'plain':!![]});if(!_0x40dbcd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40dbcd['role']===_0x6b59('0x4d')){var _0x478336=_0xbb6f06[_0x6b59('0x25')]({'plain':!![]});var _0x298118='ExtractedReports';return db[_0x6b59('0x4e')][_0x6b59('0x4b')]({'where':{'name':_0x298118,'userProfileId':_0x40dbcd[_0x6b59('0x4f')]},'raw':!![]})[_0x6b59('0x24')](function(_0x3543a2){if(_0x3543a2&&_0x3543a2['autoAssociation']===0x0){return db[_0x6b59('0x27')][_0x6b59('0x50')]({'name':_0x478336[_0x6b59('0x30')],'resourceId':_0x478336['id'],'type':_0x3543a2['name'],'sectionId':_0x3543a2['id']},{})[_0x6b59('0x24')](function(){return _0xbb6f06;});}else{return _0xbb6f06;}})[_0x6b59('0x47')](function(_0x1bc4e1){logger[_0x6b59('0x51')](_0x6b59('0x52'),_0x1bc4e1);throw _0x1bc4e1;});}return _0xbb6f06;})[_0x6b59('0x24')](respondWithResult(_0x26c111,0xc9))[_0x6b59('0x47')](handleError(_0x26c111,null));};exports[_0x6b59('0x22')]=function(_0x321601,_0x25d556){if(_0x321601['body']['id']){delete _0x321601[_0x6b59('0x4c')]['id'];}return db[_0x6b59('0x2b')][_0x6b59('0x4b')]({'where':{'id':_0x321601[_0x6b59('0x49')]['id']}})['then'](handleEntityNotFound(_0x25d556,null))[_0x6b59('0x24')](saveUpdates(_0x321601[_0x6b59('0x4c')],null))[_0x6b59('0x24')](respondWithResult(_0x25d556,null))[_0x6b59('0x47')](handleError(_0x25d556,null));};exports[_0x6b59('0x23')]=function(_0x1a3099,_0x25cefd){return db['AnalyticExtractedReport'][_0x6b59('0x4b')]({'where':{'id':_0x1a3099[_0x6b59('0x49')]['id']}})['then'](handleEntityNotFound(_0x25cefd,null))[_0x6b59('0x24')](removeEntity(_0x25cefd,null))[_0x6b59('0x47')](handleError(_0x25cefd,null));};exports['download']=function(_0x36fdb0,_0x8046a1,_0x33f8af){return db[_0x6b59('0x2b')]['find']({'where':{'id':_0x36fdb0['params']['id']},'attributes':['name','basename',_0x6b59('0x53'),_0x6b59('0x54')],'raw':!![]})[_0x6b59('0x24')](handleEntityNotFound(_0x8046a1,null))[_0x6b59('0x24')](function(_0x2ca302){if(_0x2ca302){if(!fs[_0x6b59('0x55')](path[_0x6b59('0x56')](config[_0x6b59('0x57')],'server/files/reports',_0x2ca302[_0x6b59('0x53')]))){throw new db[(_0x6b59('0x58'))]['ValidationError'](_0x6b59('0x59'));}if(_0x36fdb0[_0x6b59('0x31')]['exists']){return _0x8046a1[_0x6b59('0x19')](0xc8);}return _0x8046a1[_0x6b59('0x5a')](path[_0x6b59('0x56')](config['root'],_0x6b59('0x5b'),_0x2ca302[_0x6b59('0x53')]),util[_0x6b59('0x5c')](_0x6b59('0x5d'),_0x2ca302[_0x6b59('0x5e')]||_0x2ca302[_0x6b59('0x30')],_0x2ca302[_0x6b59('0x54')][_0x6b59('0x5f')]()));}})[_0x6b59('0x47')](handleError(_0x8046a1,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index bcd7a6f..f5c75b3 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 _0xe08d=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x3428ed,_0x510627){var _0x46c9cf=function(_0x48eaf8){while(--_0x48eaf8){_0x3428ed['push'](_0x3428ed['shift']());}};_0x46c9cf(++_0x510627);}(_0xe08d,0x8e));var _0xde08=function(_0x57b4cf,_0x565772){_0x57b4cf=_0x57b4cf-0x0;var _0x49f8a8=_0xe08d[_0x57b4cf];return _0x49f8a8;};'use strict';var _=require(_0xde08('0x0'));var util=require(_0xde08('0x1'));var logger=require(_0xde08('0x2'))('api');var moment=require(_0xde08('0x3'));var BPromise=require(_0xde08('0x4'));var rp=require(_0xde08('0x5'));var fs=require('fs');var path=require(_0xde08('0x6'));var rimraf=require(_0xde08('0x7'));var config=require(_0xde08('0x8'));var attributes=require(_0xde08('0x9'));module[_0xde08('0xa')]=function(_0x47e406,_0x1d214f){return _0x47e406[_0xde08('0xb')](_0xde08('0xc'),attributes,{'tableName':_0xde08('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2647=['request-promise','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2f483e,_0x4d2161){var _0x29238d=function(_0x28d089){while(--_0x28d089){_0x2f483e['push'](_0x2f483e['shift']());}};_0x29238d(++_0x4d2161);}(_0x2647,0x7f));var _0x7264=function(_0x524e23,_0x1e2aa7){_0x524e23=_0x524e23-0x0;var _0x231413=_0x2647[_0x524e23];return _0x231413;};'use strict';var _=require(_0x7264('0x0'));var util=require(_0x7264('0x1'));var logger=require(_0x7264('0x2'))('api');var moment=require(_0x7264('0x3'));var BPromise=require(_0x7264('0x4'));var rp=require(_0x7264('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7264('0x6'));var config=require('../../config/environment');var attributes=require(_0x7264('0x7'));module[_0x7264('0x8')]=function(_0x22ae89,_0x4a3072){return _0x22ae89[_0x7264('0x9')](_0x7264('0xa'),attributes,{'tableName':_0x7264('0xb'),'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 23cde68..30a1428 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 _0x291a=['result','catch','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x291a,0x66));var _0xa291=function(_0x34fbd4,_0x3b303b){_0x34fbd4=_0x34fbd4-0x0;var _0x5723dc=_0x291a[_0x34fbd4];return _0x5723dc;};'use strict';var _=require('lodash');var util=require(_0xa291('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa291('0x1'));var fs=require('fs');var Redis=require(_0xa291('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa291('0x3'))(_0xa291('0x4'));var config=require(_0xa291('0x5'));var jayson=require(_0xa291('0x6'));var client=jayson['client'][_0xa291('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36459c,_0x8d962d,_0x10c7ea){return new BPromise(function(_0x2456d0,_0x2029eb){return client[_0xa291('0x8')](_0x36459c,_0x10c7ea)[_0xa291('0x9')](function(_0x3beabf){logger['info'](_0xa291('0xa'),_0x8d962d,_0xa291('0xb'));logger['debug'](_0xa291('0xc'),_0x8d962d,_0xa291('0xb'),JSON[_0xa291('0xd')](_0x3beabf));if(_0x3beabf['error']){if(_0x3beabf['error'][_0xa291('0xe')]===0x1f4){logger[_0xa291('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x8d962d,_0x3beabf[_0xa291('0xf')][_0xa291('0x10')]);return _0x2029eb(_0x3beabf[_0xa291('0xf')][_0xa291('0x10')]);}logger[_0xa291('0xf')](_0xa291('0xa'),_0x8d962d,_0x3beabf[_0xa291('0xf')][_0xa291('0x10')]);return _0x2456d0(_0x3beabf[_0xa291('0xf')][_0xa291('0x10')]);}else{logger[_0xa291('0x11')](_0xa291('0xa'),_0x8d962d,_0xa291('0xb'));_0x2456d0(_0x3beabf[_0xa291('0x12')][_0xa291('0x10')]);}})[_0xa291('0x13')](function(_0x3c9ba1){logger[_0xa291('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x8d962d,_0x3c9ba1);_0x2029eb(_0x3c9ba1);});});} \ No newline at end of file +var _0x9335=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util'];(function(_0x1d7cc3,_0x5dfffe){var _0x4468ae=function(_0x4c765f){while(--_0x4c765f){_0x1d7cc3['push'](_0x1d7cc3['shift']());}};_0x4468ae(++_0x5dfffe);}(_0x9335,0x1f2));var _0x5933=function(_0x4b5807,_0x2ba496){_0x4b5807=_0x4b5807-0x0;var _0x420adb=_0x9335[_0x4b5807];return _0x420adb;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var moment=require(_0x5933('0x2'));var BPromise=require(_0x5933('0x3'));var rs=require(_0x5933('0x4'));var fs=require('fs');var Redis=require(_0x5933('0x5'));var db=require(_0x5933('0x6'))['db'];var utils=require(_0x5933('0x7'));var logger=require(_0x5933('0x8'))(_0x5933('0x9'));var config=require(_0x5933('0xa'));var jayson=require(_0x5933('0xb'));var client=jayson[_0x5933('0xc')][_0x5933('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5ee123,_0x198217,_0x5ec1e4){return new BPromise(function(_0x38cdf7,_0x20fe77){return client[_0x5933('0xe')](_0x5ee123,_0x5ec1e4)[_0x5933('0xf')](function(_0x242ead){logger[_0x5933('0x10')](_0x5933('0x11'),_0x198217,'request\x20sent');logger[_0x5933('0x12')](_0x5933('0x13'),_0x198217,'request\x20sent',JSON[_0x5933('0x14')](_0x242ead));if(_0x242ead[_0x5933('0x15')]){if(_0x242ead[_0x5933('0x15')]['code']===0x1f4){logger[_0x5933('0x15')](_0x5933('0x11'),_0x198217,_0x242ead['error'][_0x5933('0x16')]);return _0x20fe77(_0x242ead[_0x5933('0x15')][_0x5933('0x16')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x198217,_0x242ead['error'][_0x5933('0x16')]);return _0x38cdf7(_0x242ead[_0x5933('0x15')][_0x5933('0x16')]);}else{logger[_0x5933('0x10')](_0x5933('0x11'),_0x198217,_0x5933('0x17'));_0x38cdf7(_0x242ead['result']['message']);}})[_0x5933('0x18')](function(_0x17afe7){logger[_0x5933('0x15')](_0x5933('0x11'),_0x198217,_0x17afe7);_0x20fe77(_0x17afe7);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0587963..39b5018 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 _0xa846=['isAuthenticated','index','get','/:id','show','/:id/download','download','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x5812d7,_0x241b39){var _0xb101af=function(_0x22b39c){while(--_0x22b39c){_0x5812d7['push'](_0x5812d7['shift']());}};_0xb101af(++_0x241b39);}(_0xa846,0x70));var _0x6a84=function(_0x326109,_0x2055e0){_0x326109=_0x326109-0x0;var _0x3302d4=_0xa846[_0x326109];return _0x3302d4;};'use strict';var multer=require('multer');var util=require(_0x6a84('0x0'));var path=require(_0x6a84('0x1'));var timeout=require(_0x6a84('0x2'));var express=require(_0x6a84('0x3'));var router=express[_0x6a84('0x4')]();var auth=require(_0x6a84('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6a84('0x6'));var controller=require(_0x6a84('0x7'));router['get']('/',auth[_0x6a84('0x8')](),controller[_0x6a84('0x9')]);router[_0x6a84('0xa')](_0x6a84('0xb'),auth['isAuthenticated'](),controller[_0x6a84('0xc')]);router['get'](_0x6a84('0xd'),auth['isAuthenticated'](),controller[_0x6a84('0xe')]);router['post']('/',auth[_0x6a84('0x8')](),controller[_0x6a84('0xf')]);router[_0x6a84('0x10')](_0x6a84('0xb'),auth[_0x6a84('0x8')](),controller[_0x6a84('0x11')]);router[_0x6a84('0x12')]('/:id',auth[_0x6a84('0x8')](),controller[_0x6a84('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd3ef=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download','create','put','delete','exports','util','path','connect-timeout'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xd3ef,0xce));var _0xfd3e=function(_0x3028b1,_0x5f25f6){_0x3028b1=_0x3028b1-0x0;var _0x48a234=_0xd3ef[_0x3028b1];return _0x48a234;};'use strict';var multer=require('multer');var util=require(_0xfd3e('0x0'));var path=require(_0xfd3e('0x1'));var timeout=require(_0xfd3e('0x2'));var express=require(_0xfd3e('0x3'));var router=express[_0xfd3e('0x4')]();var auth=require(_0xfd3e('0x5'));var interaction=require(_0xfd3e('0x6'));var config=require(_0xfd3e('0x7'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xfd3e('0x8')](),controller[_0xfd3e('0x9')]);router[_0xfd3e('0xa')](_0xfd3e('0xb'),auth[_0xfd3e('0x8')](),controller[_0xfd3e('0xc')]);router[_0xfd3e('0xa')](_0xfd3e('0xd'),auth[_0xfd3e('0x8')](),controller[_0xfd3e('0xe')]);router['post']('/',auth[_0xfd3e('0x8')](),controller[_0xfd3e('0xf')]);router[_0xfd3e('0x10')](_0xfd3e('0xb'),auth[_0xfd3e('0x8')](),controller['update']);router[_0xfd3e('0x11')](_0xfd3e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xfd3e('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8663148..0e7c983 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x18852b,_0x1c8700){var _0x5cf5d6=function(_0xe39163){while(--_0xe39163){_0x18852b['push'](_0x18852b['shift']());}};_0x5cf5d6(++_0x1c8700);}(_0x5fc3,0xa8));var _0x35fc=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x5fc3[_0xf2662b];return _0x257dc7;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING'];(function(_0x5ed1d4,_0x3e2218){var _0x1a85ca=function(_0x384ae3){while(--_0x384ae3){_0x5ed1d4['push'](_0x5ed1d4['shift']());}};_0x1a85ca(++_0x3e2218);}(_0xe14b,0x93));var _0xbe14=function(_0x4ef970,_0x56d3ec){_0x4ef970=_0x4ef970-0x0;var _0x3a29e1=_0xe14b[_0x4ef970];return _0x3a29e1;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ae315ae..1aa86dd 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 _0xaa45=['Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','rows','catch','includeAll','find','create','body','bulkCreate','params','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','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','sendStatus','status','end','offset','limit','set'];(function(_0x3e38fb,_0x3b9176){var _0x54cb5a=function(_0x25e3e4){while(--_0x25e3e4){_0x3e38fb['push'](_0x3e38fb['shift']());}};_0x54cb5a(++_0x3b9176);}(_0xaa45,0x17d));var _0x5aa4=function(_0xc36d01,_0x3bf1a6){_0xc36d01=_0xc36d01-0x0;var _0xecb231=_0xaa45[_0xc36d01];return _0xecb231;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5aa4('0x0'));var rimraf=require(_0x5aa4('0x1'));var zipdir=require(_0x5aa4('0x2'));var jsonpatch=require(_0x5aa4('0x3'));var rp=require(_0x5aa4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5aa4('0x5'));var util=require('util');var path=require(_0x5aa4('0x6'));var sox=require(_0x5aa4('0x7'));var csv=require(_0x5aa4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5aa4('0x9'));var squel=require(_0x5aa4('0xa'));var crypto=require(_0x5aa4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5aa4('0xc'));var toCsv=require(_0x5aa4('0x8'));var querystring=require('querystring');var Papa=require(_0x5aa4('0xd'));var Redis=require(_0x5aa4('0xe'));var authService=require(_0x5aa4('0xf'));var qs=require(_0x5aa4('0x10'));var as=require(_0x5aa4('0x11'));var hardwareService=require(_0x5aa4('0x12'));var logger=require(_0x5aa4('0x13'))(_0x5aa4('0x14'));var utils=require('../../config/utils');var config=require(_0x5aa4('0x15'));var db=require(_0x5aa4('0x16'))['db'];function respondWithStatusCode(_0x157cac,_0x5aba44){_0x5aba44=_0x5aba44||0xcc;return function(_0x466fcf){if(_0x466fcf){return _0x157cac[_0x5aa4('0x17')](_0x5aba44);}return _0x157cac[_0x5aa4('0x18')](_0x5aba44)[_0x5aa4('0x19')]();};}function respondWithResult(_0x29b334,_0x1df98a){_0x1df98a=_0x1df98a||0xc8;return function(_0x31eee8){if(_0x31eee8){return _0x29b334['status'](_0x1df98a)['json'](_0x31eee8);}};}function respondWithFilteredResult(_0x38d7f0,_0x23742d){return function(_0x54d658){if(_0x54d658){var _0xe6a7a5=_0x54d658['count'],_0x26a139=_0x23742d[_0x5aa4('0x1a')],_0x4cee29=_0x23742d[_0x5aa4('0x1a')]+_0x23742d[_0x5aa4('0x1b')],_0x2eed4a;if(_0x4cee29>=_0xe6a7a5){_0x4cee29=_0xe6a7a5;_0x2eed4a=0xc8;}else{_0x2eed4a=0xce;}_0x38d7f0[_0x5aa4('0x18')](_0x2eed4a);return _0x38d7f0[_0x5aa4('0x1c')](_0x5aa4('0x1d'),_0x26a139+'-'+_0x4cee29+'/'+_0xe6a7a5)[_0x5aa4('0x1e')](_0x54d658);}return null;};}function patchUpdates(_0x274a6c){return function(_0x182708){try{jsonpatch[_0x5aa4('0x1f')](_0x182708,_0x274a6c,!![]);}catch(_0x2caf0d){return BPromise[_0x5aa4('0x20')](_0x2caf0d);}return _0x182708[_0x5aa4('0x21')]();};}function saveUpdates(_0x3531be,_0x15714b){return function(_0x29aec7){if(_0x29aec7){return _0x29aec7[_0x5aa4('0x22')](_0x3531be)[_0x5aa4('0x23')](function(_0x1dd718){return _0x1dd718;});}return null;};}function removeEntity(_0x39a73c,_0x1bf85d){return function(_0x254bc4){if(_0x254bc4){return _0x254bc4['destroy']()[_0x5aa4('0x23')](function(){_0x39a73c[_0x5aa4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6d78,_0x183653){return function(_0x414204){if(!_0x414204){_0x1c6d78[_0x5aa4('0x17')](0x194);}return _0x414204;};}function handleError(_0x403980,_0x2275ae){_0x2275ae=_0x2275ae||0x1f4;return function(_0x1a0858){logger[_0x5aa4('0x24')](_0x1a0858['stack']);if(_0x1a0858['name']){delete _0x1a0858[_0x5aa4('0x25')];}_0x403980[_0x5aa4('0x18')](_0x2275ae)[_0x5aa4('0x26')](_0x1a0858);};}exports[_0x5aa4('0x27')]=function(_0x1ee624,_0x46ce15){var _0x1576ce={},_0x41a22f={},_0x29f36e={'count':0x0,'rows':[]};var _0x32999a=_[_0x5aa4('0x28')](db[_0x5aa4('0x29')][_0x5aa4('0x2a')],function(_0x526b67){return{'name':_0x526b67[_0x5aa4('0x2b')],'type':_0x526b67[_0x5aa4('0x2c')]['key']};});_0x41a22f[_0x5aa4('0x2d')]=_['map'](_0x32999a,'name');_0x41a22f[_0x5aa4('0x2e')]=_[_0x5aa4('0x2f')](_0x1ee624[_0x5aa4('0x2e')]);_0x41a22f[_0x5aa4('0x30')]=_[_0x5aa4('0x31')](_0x41a22f[_0x5aa4('0x2d')],_0x41a22f['query']);_0x1576ce[_0x5aa4('0x32')]=_[_0x5aa4('0x31')](_0x41a22f['model'],qs[_0x5aa4('0x33')](_0x1ee624['query'][_0x5aa4('0x33')]));_0x1576ce[_0x5aa4('0x32')]=_0x1576ce[_0x5aa4('0x32')][_0x5aa4('0x34')]?_0x1576ce['attributes']:_0x41a22f['model'];if(!_0x1ee624[_0x5aa4('0x2e')][_0x5aa4('0x35')](_0x5aa4('0x36'))){_0x1576ce[_0x5aa4('0x1b')]=qs[_0x5aa4('0x1b')](_0x1ee624[_0x5aa4('0x2e')][_0x5aa4('0x1b')]);_0x1576ce[_0x5aa4('0x1a')]=qs['offset'](_0x1ee624[_0x5aa4('0x2e')][_0x5aa4('0x1a')]);}_0x1576ce[_0x5aa4('0x37')]=qs[_0x5aa4('0x38')](_0x1ee624['query']['sort']);_0x1576ce[_0x5aa4('0x39')]=qs[_0x5aa4('0x30')](_[_0x5aa4('0x3a')](_0x1ee624[_0x5aa4('0x2e')],_0x41a22f['filters']),_0x32999a);if(_0x1ee624[_0x5aa4('0x2e')][_0x5aa4('0x3b')]){_0x1576ce['where']=_['merge'](_0x1576ce['where'],{'$or':_[_0x5aa4('0x28')](_0x32999a,function(_0x380dff){if(_0x380dff[_0x5aa4('0x2c')]!==_0x5aa4('0x3c')){var _0x1de8c0={};_0x1de8c0[_0x380dff['name']]={'$like':'%'+_0x1ee624[_0x5aa4('0x2e')]['filter']+'%'};return _0x1de8c0;}})});}_0x1576ce=_[_0x5aa4('0x3d')]({},_0x1576ce,_0x1ee624[_0x5aa4('0x3e')]);var _0xb064fa={'where':_0x1576ce[_0x5aa4('0x39')]};return db[_0x5aa4('0x29')][_0x5aa4('0x3f')](_0xb064fa)[_0x5aa4('0x23')](function(_0x4df62c){_0x29f36e[_0x5aa4('0x3f')]=_0x4df62c;if(_0x1ee624[_0x5aa4('0x2e')]['includeAll']){_0x1576ce[_0x5aa4('0x40')]=[{'all':!![]}];}return db[_0x5aa4('0x29')]['findAll'](_0x1576ce);})[_0x5aa4('0x23')](function(_0xbbee3c){_0x29f36e[_0x5aa4('0x41')]=_0xbbee3c;return _0x29f36e;})[_0x5aa4('0x23')](respondWithFilteredResult(_0x46ce15,_0x1576ce))[_0x5aa4('0x42')](handleError(_0x46ce15,null));};exports['show']=function(_0x2a741a,_0x3b1556){var _0x254dd7={'raw':![],'where':{'id':_0x2a741a['params']['id']}},_0x24ede3={};_0x24ede3[_0x5aa4('0x2d')]=_[_0x5aa4('0x2f')](db[_0x5aa4('0x29')][_0x5aa4('0x2a')]);_0x24ede3[_0x5aa4('0x2e')]=_[_0x5aa4('0x2f')](_0x2a741a[_0x5aa4('0x2e')]);_0x24ede3['filters']=_['intersection'](_0x24ede3[_0x5aa4('0x2d')],_0x24ede3[_0x5aa4('0x2e')]);_0x254dd7[_0x5aa4('0x32')]=_[_0x5aa4('0x31')](_0x24ede3[_0x5aa4('0x2d')],qs[_0x5aa4('0x33')](_0x2a741a[_0x5aa4('0x2e')]['fields']));_0x254dd7[_0x5aa4('0x32')]=_0x254dd7[_0x5aa4('0x32')][_0x5aa4('0x34')]?_0x254dd7['attributes']:_0x24ede3[_0x5aa4('0x2d')];if(_0x2a741a[_0x5aa4('0x2e')][_0x5aa4('0x43')]){_0x254dd7[_0x5aa4('0x40')]=[{'all':!![]}];}_0x254dd7=_[_0x5aa4('0x3d')]({},_0x254dd7,_0x2a741a['options']);return db[_0x5aa4('0x29')][_0x5aa4('0x44')](_0x254dd7)[_0x5aa4('0x23')](handleEntityNotFound(_0x3b1556,null))[_0x5aa4('0x23')](respondWithResult(_0x3b1556,null))[_0x5aa4('0x42')](handleError(_0x3b1556,null));};exports[_0x5aa4('0x45')]=function(_0x3341d,_0x2a0d55){return db[_0x5aa4('0x29')][_0x5aa4('0x45')](_0x3341d[_0x5aa4('0x46')],{})[_0x5aa4('0x23')](respondWithResult(_0x2a0d55,0xc9))['catch'](handleError(_0x2a0d55,null));};exports['bulkCreate']=function(_0xb5851b,_0x18f11f){return db['AnalyticFieldReport'][_0x5aa4('0x47')](_0xb5851b[_0x5aa4('0x46')],{'raw':![],'individualHooks':!![]})[_0x5aa4('0x23')](respondWithResult(_0x18f11f,0xc9))['catch'](handleError(_0x18f11f,null));};exports[_0x5aa4('0x22')]=function(_0x2685b5,_0x29d030){if(_0x2685b5[_0x5aa4('0x46')]['id']){delete _0x2685b5[_0x5aa4('0x46')]['id'];}return db[_0x5aa4('0x29')][_0x5aa4('0x44')]({'where':{'id':_0x2685b5[_0x5aa4('0x48')]['id']}})[_0x5aa4('0x23')](handleEntityNotFound(_0x29d030,null))[_0x5aa4('0x23')](saveUpdates(_0x2685b5[_0x5aa4('0x46')],null))['then'](respondWithResult(_0x29d030,null))[_0x5aa4('0x42')](handleError(_0x29d030,null));};exports['destroy']=function(_0x28d29d,_0x52fe7a){return db[_0x5aa4('0x29')][_0x5aa4('0x44')]({'where':{'id':_0x28d29d['params']['id']}})[_0x5aa4('0x23')](handleEntityNotFound(_0x52fe7a,null))[_0x5aa4('0x23')](removeEntity(_0x52fe7a,null))[_0x5aa4('0x42')](handleError(_0x52fe7a,null));};exports[_0x5aa4('0x49')]=function(_0x348491,_0x115502){return db[_0x5aa4('0x29')][_0x5aa4('0x4a')]({'where':{'id':_0x348491[_0x5aa4('0x2e')][_0x5aa4('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x115502,0xcc))[_0x5aa4('0x42')](handleError(_0x115502,null));};exports[_0x5aa4('0x4c')]=function(_0x475b6d,_0x4fc182,_0x13a2d9){return db[_0x5aa4('0x4d')][_0x5aa4('0x4e')]({'where':{'id':_0x475b6d['params']['id']}})[_0x5aa4('0x23')](handleEntityNotFound(_0x4fc182,null))[_0x5aa4('0x23')](function(_0x97def){if(_0x97def){return db[_0x5aa4('0x4f')]['transaction'](function(_0x5212f6){return db[_0x5aa4('0x29')]['destroy']({'where':{'CustomReportId':_0x475b6d[_0x5aa4('0x48')]['id']},'transaction':_0x5212f6})[_0x5aa4('0x23')](function(_0x1f3948){var _0x4f0325=_['map'](_0x475b6d[_0x5aa4('0x46')],function(_0x2c62d1){delete _0x2c62d1['id'];_0x2c62d1[_0x5aa4('0x50')]=_0x475b6d[_0x5aa4('0x48')]['id'];return _0x2c62d1;});return db['AnalyticFieldReport'][_0x5aa4('0x47')](_0x4f0325,{'transaction':_0x5212f6});});})[_0x5aa4('0x23')](function(){return db[_0x5aa4('0x29')][_0x5aa4('0x51')]({'where':{'CustomReportId':_0x475b6d[_0x5aa4('0x48')]['id']}});});}})[_0x5aa4('0x23')](respondWithResult(_0x4fc182,null))[_0x5aa4('0x42')](handleError(_0x4fc182,null));}; \ No newline at end of file +var _0x4b99=['order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','catch','create','body','bulkCreate','find','bulkDestroy','addFields','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','nolimit','limit'];(function(_0x2f843f,_0x4b368c){var _0x6df32d=function(_0x1314f3){while(--_0x1314f3){_0x2f843f['push'](_0x2f843f['shift']());}};_0x6df32d(++_0x4b368c);}(_0x4b99,0x107));var _0x94b9=function(_0x531a72,_0x10922e){_0x531a72=_0x531a72-0x0;var _0x26ccd5=_0x4b99[_0x531a72];return _0x26ccd5;};'use strict';var pdf=require(_0x94b9('0x0'));var emlformat=require(_0x94b9('0x1'));var rimraf=require(_0x94b9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x94b9('0x3'));var moment=require(_0x94b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x94b9('0x5'));var util=require('util');var path=require('path');var sox=require(_0x94b9('0x6'));var csv=require(_0x94b9('0x7'));var ejs=require(_0x94b9('0x8'));var fs=require('fs');var _=require(_0x94b9('0x9'));var squel=require(_0x94b9('0xa'));var crypto=require('crypto');var jsforce=require(_0x94b9('0xb'));var deskjs=require(_0x94b9('0xc'));var toCsv=require(_0x94b9('0x7'));var querystring=require('querystring');var Papa=require(_0x94b9('0xd'));var Redis=require('ioredis');var authService=require(_0x94b9('0xe'));var qs=require(_0x94b9('0xf'));var as=require(_0x94b9('0x10'));var hardwareService=require(_0x94b9('0x11'));var logger=require(_0x94b9('0x12'))(_0x94b9('0x13'));var utils=require(_0x94b9('0x14'));var config=require(_0x94b9('0x15'));var db=require(_0x94b9('0x16'))['db'];function respondWithStatusCode(_0x31fe50,_0xd85cff){_0xd85cff=_0xd85cff||0xcc;return function(_0x8d76a2){if(_0x8d76a2){return _0x31fe50[_0x94b9('0x17')](_0xd85cff);}return _0x31fe50[_0x94b9('0x18')](_0xd85cff)['end']();};}function respondWithResult(_0x4c639f,_0x424934){_0x424934=_0x424934||0xc8;return function(_0x5341e3){if(_0x5341e3){return _0x4c639f[_0x94b9('0x18')](_0x424934)[_0x94b9('0x19')](_0x5341e3);}};}function respondWithFilteredResult(_0x4d37d6,_0x3c9810){return function(_0xf9cf71){if(_0xf9cf71){var _0x5068cf=_0xf9cf71[_0x94b9('0x1a')],_0x47e92e=_0x3c9810[_0x94b9('0x1b')],_0x1d488f=_0x3c9810[_0x94b9('0x1b')]+_0x3c9810['limit'],_0x2c34ae;if(_0x1d488f>=_0x5068cf){_0x1d488f=_0x5068cf;_0x2c34ae=0xc8;}else{_0x2c34ae=0xce;}_0x4d37d6[_0x94b9('0x18')](_0x2c34ae);return _0x4d37d6[_0x94b9('0x1c')]('Content-Range',_0x47e92e+'-'+_0x1d488f+'/'+_0x5068cf)[_0x94b9('0x19')](_0xf9cf71);}return null;};}function patchUpdates(_0x5ad329){return function(_0x3b3e97){try{jsonpatch[_0x94b9('0x1d')](_0x3b3e97,_0x5ad329,!![]);}catch(_0x23b64d){return BPromise[_0x94b9('0x1e')](_0x23b64d);}return _0x3b3e97[_0x94b9('0x1f')]();};}function saveUpdates(_0x389f80,_0x8ed231){return function(_0x4b501c){if(_0x4b501c){return _0x4b501c[_0x94b9('0x20')](_0x389f80)[_0x94b9('0x21')](function(_0x2267fb){return _0x2267fb;});}return null;};}function removeEntity(_0x191b17,_0x209685){return function(_0x511654){if(_0x511654){return _0x511654[_0x94b9('0x22')]()[_0x94b9('0x21')](function(){_0x191b17[_0x94b9('0x18')](0xcc)[_0x94b9('0x23')]();});}};}function handleEntityNotFound(_0x3f0f02,_0x22b3dc){return function(_0x14edb3){if(!_0x14edb3){_0x3f0f02['sendStatus'](0x194);}return _0x14edb3;};}function handleError(_0x422500,_0x11d5f4){_0x11d5f4=_0x11d5f4||0x1f4;return function(_0x356ed9){logger[_0x94b9('0x24')](_0x356ed9[_0x94b9('0x25')]);if(_0x356ed9[_0x94b9('0x26')]){delete _0x356ed9[_0x94b9('0x26')];}_0x422500[_0x94b9('0x18')](_0x11d5f4)['send'](_0x356ed9);};}exports['index']=function(_0x51514e,_0x2cb15b){var _0x3f4846={},_0x5dcc1e={},_0x23bf24={'count':0x0,'rows':[]};var _0x2b5a48=_[_0x94b9('0x27')](db[_0x94b9('0x28')][_0x94b9('0x29')],function(_0xabf559){return{'name':_0xabf559[_0x94b9('0x2a')],'type':_0xabf559[_0x94b9('0x2b')][_0x94b9('0x2c')]};});_0x5dcc1e['model']=_['map'](_0x2b5a48,'name');_0x5dcc1e[_0x94b9('0x2d')]=_['keys'](_0x51514e['query']);_0x5dcc1e['filters']=_[_0x94b9('0x2e')](_0x5dcc1e['model'],_0x5dcc1e['query']);_0x3f4846[_0x94b9('0x2f')]=_[_0x94b9('0x2e')](_0x5dcc1e[_0x94b9('0x30')],qs['fields'](_0x51514e[_0x94b9('0x2d')][_0x94b9('0x31')]));_0x3f4846[_0x94b9('0x2f')]=_0x3f4846[_0x94b9('0x2f')][_0x94b9('0x32')]?_0x3f4846['attributes']:_0x5dcc1e['model'];if(!_0x51514e[_0x94b9('0x2d')]['hasOwnProperty'](_0x94b9('0x33'))){_0x3f4846['limit']=qs[_0x94b9('0x34')](_0x51514e[_0x94b9('0x2d')]['limit']);_0x3f4846[_0x94b9('0x1b')]=qs[_0x94b9('0x1b')](_0x51514e['query'][_0x94b9('0x1b')]);}_0x3f4846[_0x94b9('0x35')]=qs[_0x94b9('0x36')](_0x51514e[_0x94b9('0x2d')][_0x94b9('0x36')]);_0x3f4846[_0x94b9('0x37')]=qs[_0x94b9('0x38')](_[_0x94b9('0x39')](_0x51514e[_0x94b9('0x2d')],_0x5dcc1e[_0x94b9('0x38')]),_0x2b5a48);if(_0x51514e[_0x94b9('0x2d')]['filter']){_0x3f4846[_0x94b9('0x37')]=_['merge'](_0x3f4846['where'],{'$or':_[_0x94b9('0x27')](_0x2b5a48,function(_0x7ad2ab){if(_0x7ad2ab[_0x94b9('0x2b')]!==_0x94b9('0x3a')){var _0x5092ed={};_0x5092ed[_0x7ad2ab[_0x94b9('0x26')]]={'$like':'%'+_0x51514e['query'][_0x94b9('0x3b')]+'%'};return _0x5092ed;}})});}_0x3f4846=_[_0x94b9('0x3c')]({},_0x3f4846,_0x51514e[_0x94b9('0x3d')]);var _0x2a3fe3={'where':_0x3f4846[_0x94b9('0x37')]};return db[_0x94b9('0x28')][_0x94b9('0x1a')](_0x2a3fe3)[_0x94b9('0x21')](function(_0x5a5432){_0x23bf24[_0x94b9('0x1a')]=_0x5a5432;if(_0x51514e[_0x94b9('0x2d')][_0x94b9('0x3e')]){_0x3f4846[_0x94b9('0x3f')]=[{'all':!![]}];}return db[_0x94b9('0x28')][_0x94b9('0x40')](_0x3f4846);})[_0x94b9('0x21')](function(_0x99bd1e){_0x23bf24[_0x94b9('0x41')]=_0x99bd1e;return _0x23bf24;})[_0x94b9('0x21')](respondWithFilteredResult(_0x2cb15b,_0x3f4846))['catch'](handleError(_0x2cb15b,null));};exports['show']=function(_0x12642a,_0x2b988c){var _0x123c34={'raw':![],'where':{'id':_0x12642a[_0x94b9('0x42')]['id']}},_0x31021e={};_0x31021e[_0x94b9('0x30')]=_[_0x94b9('0x43')](db[_0x94b9('0x28')][_0x94b9('0x29')]);_0x31021e['query']=_['keys'](_0x12642a[_0x94b9('0x2d')]);_0x31021e[_0x94b9('0x38')]=_[_0x94b9('0x2e')](_0x31021e[_0x94b9('0x30')],_0x31021e[_0x94b9('0x2d')]);_0x123c34[_0x94b9('0x2f')]=_['intersection'](_0x31021e['model'],qs[_0x94b9('0x31')](_0x12642a[_0x94b9('0x2d')][_0x94b9('0x31')]));_0x123c34['attributes']=_0x123c34[_0x94b9('0x2f')][_0x94b9('0x32')]?_0x123c34[_0x94b9('0x2f')]:_0x31021e[_0x94b9('0x30')];if(_0x12642a['query'][_0x94b9('0x3e')]){_0x123c34[_0x94b9('0x3f')]=[{'all':!![]}];}_0x123c34=_[_0x94b9('0x3c')]({},_0x123c34,_0x12642a[_0x94b9('0x3d')]);return db['AnalyticFieldReport']['find'](_0x123c34)[_0x94b9('0x21')](handleEntityNotFound(_0x2b988c,null))[_0x94b9('0x21')](respondWithResult(_0x2b988c,null))[_0x94b9('0x44')](handleError(_0x2b988c,null));};exports[_0x94b9('0x45')]=function(_0x19530c,_0x24b907){return db[_0x94b9('0x28')][_0x94b9('0x45')](_0x19530c[_0x94b9('0x46')],{})[_0x94b9('0x21')](respondWithResult(_0x24b907,0xc9))['catch'](handleError(_0x24b907,null));};exports[_0x94b9('0x47')]=function(_0x3d6805,_0x4bd04a){return db['AnalyticFieldReport'][_0x94b9('0x47')](_0x3d6805[_0x94b9('0x46')],{'raw':![],'individualHooks':!![]})[_0x94b9('0x21')](respondWithResult(_0x4bd04a,0xc9))[_0x94b9('0x44')](handleError(_0x4bd04a,null));};exports[_0x94b9('0x20')]=function(_0x4e80e4,_0x7cc486){if(_0x4e80e4[_0x94b9('0x46')]['id']){delete _0x4e80e4['body']['id'];}return db['AnalyticFieldReport'][_0x94b9('0x48')]({'where':{'id':_0x4e80e4[_0x94b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x7cc486,null))[_0x94b9('0x21')](saveUpdates(_0x4e80e4[_0x94b9('0x46')],null))[_0x94b9('0x21')](respondWithResult(_0x7cc486,null))[_0x94b9('0x44')](handleError(_0x7cc486,null));};exports[_0x94b9('0x22')]=function(_0x186f1b,_0x1270ea){return db[_0x94b9('0x28')][_0x94b9('0x48')]({'where':{'id':_0x186f1b['params']['id']}})[_0x94b9('0x21')](handleEntityNotFound(_0x1270ea,null))[_0x94b9('0x21')](removeEntity(_0x1270ea,null))[_0x94b9('0x44')](handleError(_0x1270ea,null));};exports[_0x94b9('0x49')]=function(_0x36faac,_0x48f4f8){return db['AnalyticFieldReport'][_0x94b9('0x22')]({'where':{'id':_0x36faac[_0x94b9('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x48f4f8,0xcc))[_0x94b9('0x44')](handleError(_0x48f4f8,null));};exports[_0x94b9('0x4a')]=function(_0x10e95f,_0x523758,_0x3c4432){return db['AnalyticCustomReport'][_0x94b9('0x4b')]({'where':{'id':_0x10e95f[_0x94b9('0x42')]['id']}})[_0x94b9('0x21')](handleEntityNotFound(_0x523758,null))[_0x94b9('0x21')](function(_0x105722){if(_0x105722){return db[_0x94b9('0x4c')][_0x94b9('0x4d')](function(_0x14b3aa){return db[_0x94b9('0x28')][_0x94b9('0x22')]({'where':{'CustomReportId':_0x10e95f[_0x94b9('0x42')]['id']},'transaction':_0x14b3aa})['then'](function(_0x542c96){var _0x5844d2=_[_0x94b9('0x27')](_0x10e95f[_0x94b9('0x46')],function(_0x51e6a7){delete _0x51e6a7['id'];_0x51e6a7[_0x94b9('0x4e')]=_0x10e95f[_0x94b9('0x42')]['id'];return _0x51e6a7;});return db['AnalyticFieldReport']['bulkCreate'](_0x5844d2,{'transaction':_0x14b3aa});});})[_0x94b9('0x21')](function(){return db[_0x94b9('0x28')]['findAll']({'where':{'CustomReportId':_0x10e95f[_0x94b9('0x42')]['id']}});});}})[_0x94b9('0x21')](respondWithResult(_0x523758,null))['catch'](handleError(_0x523758,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 009a737..4197dd7 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 _0xa7f6=['request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','moment','bluebird'];(function(_0xa6f070,_0x3d39f5){var _0x1f45f2=function(_0x3c6e36){while(--_0x3c6e36){_0xa6f070['push'](_0xa6f070['shift']());}};_0x1f45f2(++_0x3d39f5);}(_0xa7f6,0x158));var _0x6a7f=function(_0x2731ea,_0x2d7cd6){_0x2731ea=_0x2731ea-0x0;var _0x3fe2df=_0xa7f6[_0x2731ea];return _0x3fe2df;};'use strict';var _=require(_0x6a7f('0x0'));var util=require(_0x6a7f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6a7f('0x2'));var BPromise=require(_0x6a7f('0x3'));var rp=require(_0x6a7f('0x4'));var fs=require('fs');var path=require(_0x6a7f('0x5'));var rimraf=require(_0x6a7f('0x6'));var config=require(_0x6a7f('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x6a7f('0x8')]=function(_0x2c4f4f,_0x3c1f30){return _0x2c4f4f[_0x6a7f('0x9')](_0x6a7f('0xa'),attributes,{'tableName':_0x6a7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7136=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x5ece6e,_0x3a04e2){var _0x3691f9=function(_0x12a74f){while(--_0x12a74f){_0x5ece6e['push'](_0x5ece6e['shift']());}};_0x3691f9(++_0x3a04e2);}(_0x7136,0x15f));var _0x6713=function(_0x5c9317,_0x38bba4){_0x5c9317=_0x5c9317-0x0;var _0x50ccb4=_0x7136[_0x5c9317];return _0x50ccb4;};'use strict';var _=require(_0x6713('0x0'));var util=require(_0x6713('0x1'));var logger=require(_0x6713('0x2'))(_0x6713('0x3'));var moment=require(_0x6713('0x4'));var BPromise=require(_0x6713('0x5'));var rp=require(_0x6713('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6713('0x7'));var config=require(_0x6713('0x8'));var attributes=require(_0x6713('0x9'));module['exports']=function(_0x238615,_0x271d29){return _0x238615[_0x6713('0xa')](_0x6713('0xb'),attributes,{'tableName':_0x6713('0xc'),'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 e266c0a..ed0fd94 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 _0xf8d0=['then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4d2e99,_0x591f4a){var _0x3a81ba=function(_0x49ecd7){while(--_0x49ecd7){_0x4d2e99['push'](_0x4d2e99['shift']());}};_0x3a81ba(++_0x591f4a);}(_0xf8d0,0x190));var _0x0f8d=function(_0x868a53,_0x451b0c){_0x868a53=_0x868a53-0x0;var _0x4ad583=_0xf8d0[_0x868a53];return _0x4ad583;};'use strict';var _=require(_0x0f8d('0x0'));var util=require(_0x0f8d('0x1'));var moment=require(_0x0f8d('0x2'));var BPromise=require(_0x0f8d('0x3'));var rs=require(_0x0f8d('0x4'));var fs=require('fs');var Redis=require(_0x0f8d('0x5'));var db=require(_0x0f8d('0x6'))['db'];var utils=require(_0x0f8d('0x7'));var logger=require(_0x0f8d('0x8'))(_0x0f8d('0x9'));var config=require(_0x0f8d('0xa'));var jayson=require(_0x0f8d('0xb'));var client=jayson[_0x0f8d('0xc')][_0x0f8d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x251482,_0xe5de2b,_0x507ed9){return new BPromise(function(_0x36a7f5,_0x27a2dd){return client['request'](_0x251482,_0x507ed9)[_0x0f8d('0xe')](function(_0x40a03b){logger[_0x0f8d('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0xe5de2b,_0x0f8d('0x10'));logger['debug'](_0x0f8d('0x11'),_0xe5de2b,_0x0f8d('0x10'),JSON[_0x0f8d('0x12')](_0x40a03b));if(_0x40a03b[_0x0f8d('0x13')]){if(_0x40a03b[_0x0f8d('0x13')][_0x0f8d('0x14')]===0x1f4){logger[_0x0f8d('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0xe5de2b,_0x40a03b[_0x0f8d('0x13')][_0x0f8d('0x15')]);return _0x27a2dd(_0x40a03b[_0x0f8d('0x13')][_0x0f8d('0x15')]);}logger[_0x0f8d('0x13')](_0x0f8d('0x16'),_0xe5de2b,_0x40a03b[_0x0f8d('0x13')][_0x0f8d('0x15')]);return _0x36a7f5(_0x40a03b[_0x0f8d('0x13')][_0x0f8d('0x15')]);}else{logger[_0x0f8d('0xf')](_0x0f8d('0x16'),_0xe5de2b,_0x0f8d('0x10'));_0x36a7f5(_0x40a03b['result'][_0x0f8d('0x15')]);}})['catch'](function(_0x5b8fa2){logger[_0x0f8d('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0xe5de2b,_0x5b8fa2);_0x27a2dd(_0x5b8fa2);});});} \ No newline at end of file +var _0xc5a5=['then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xc5a5,0x1ee));var _0x5c5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc5a5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5c5a('0x0'));var util=require(_0x5c5a('0x1'));var moment=require(_0x5c5a('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c5a('0x3'));var fs=require('fs');var Redis=require(_0x5c5a('0x4'));var db=require(_0x5c5a('0x5'))['db'];var utils=require(_0x5c5a('0x6'));var logger=require(_0x5c5a('0x7'))(_0x5c5a('0x8'));var config=require(_0x5c5a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5c5a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x276a60,_0x59a31e,_0x23f85e){return new BPromise(function(_0x41c8bb,_0x38da76){return client[_0x5c5a('0xb')](_0x276a60,_0x23f85e)[_0x5c5a('0xc')](function(_0x586c0c){logger[_0x5c5a('0xd')](_0x5c5a('0xe'),_0x59a31e,_0x5c5a('0xf'));logger[_0x5c5a('0x10')](_0x5c5a('0x11'),_0x59a31e,_0x5c5a('0xf'),JSON['stringify'](_0x586c0c));if(_0x586c0c['error']){if(_0x586c0c['error']['code']===0x1f4){logger['error'](_0x5c5a('0xe'),_0x59a31e,_0x586c0c[_0x5c5a('0x12')][_0x5c5a('0x13')]);return _0x38da76(_0x586c0c[_0x5c5a('0x12')][_0x5c5a('0x13')]);}logger[_0x5c5a('0x12')](_0x5c5a('0xe'),_0x59a31e,_0x586c0c['error'][_0x5c5a('0x13')]);return _0x41c8bb(_0x586c0c[_0x5c5a('0x12')][_0x5c5a('0x13')]);}else{logger[_0x5c5a('0xd')](_0x5c5a('0xe'),_0x59a31e,_0x5c5a('0xf'));_0x41c8bb(_0x586c0c[_0x5c5a('0x14')]['message']);}})[_0x5c5a('0x15')](function(_0x24ad13){logger[_0x5c5a('0x12')](_0x5c5a('0xe'),_0x59a31e,_0x24ad13);_0x38da76(_0x24ad13);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ed86b83..861e6ec 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(_0x32e43a,_0x19eff3){var _0x218fb9=function(_0x2328c1){while(--_0x2328c1){_0x32e43a['push'](_0x32e43a['shift']());}};_0x218fb9(++_0x19eff3);}(_0x814b,0x1a2));var _0xb814=function(_0x20a822,_0x5dc295){_0x20a822=_0x20a822-0x0;var _0x3775d1=_0x814b[_0x20a822];return _0x3775d1;};'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 _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(_0x4c8ba9,_0x26a343){var _0x3805e0=function(_0xfa7122){while(--_0xfa7122){_0x4c8ba9['push'](_0x4c8ba9['shift']());}};_0x3805e0(++_0x26a343);}(_0x814b,0x1a2));var _0xb814=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0x814b[_0x2c18a8];return _0x1e009a;};'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 diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index aeb3eda..828fdeb 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 _0x6594=['TEXT','STRING'];(function(_0x6f32da,_0xd805cc){var _0xf6b205=function(_0x5d7dae){while(--_0x5d7dae){_0x6f32da['push'](_0x6f32da['shift']());}};_0xf6b205(++_0xd805cc);}(_0x6594,0xcb));var _0x4659=function(_0x2550ce,_0x45209b){_0x2550ce=_0x2550ce-0x0;var _0x25748d=_0x6594[_0x2550ce];return _0x25748d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x4659('0x0')]},'metric':{'type':Sequelize[_0x4659('0x1')]},'description':{'type':Sequelize[_0x4659('0x0')]}}; \ No newline at end of file +var _0x9189=['STRING','name','TEXT'];(function(_0x4c1c9c,_0x4cde28){var _0x456d9f=function(_0x32d3bc){while(--_0x32d3bc){_0x4c1c9c['push'](_0x4c1c9c['shift']());}};_0x456d9f(++_0x4cde28);}(_0x9189,0x1b0));var _0x9918=function(_0x4fc013,_0x40d3fb){_0x4fc013=_0x4fc013-0x0;var _0x15e85a=_0x9189[_0x4fc013];return _0x15e85a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9918('0x0')],'allowNull':![],'unique':_0x9918('0x1')},'table':{'type':Sequelize[_0x9918('0x0')]},'metric':{'type':Sequelize[_0x9918('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0b03e15..8a05ff3 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 _0xd290=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','AnalyticMetric','includeAll','include','findAll','rows','catch','show','params','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','Metrics','UserProfileResource','sendStatus','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields'];(function(_0x34cf18,_0x12faa6){var _0x4376f6=function(_0x3aff87){while(--_0x3aff87){_0x34cf18['push'](_0x34cf18['shift']());}};_0x4376f6(++_0x12faa6);}(_0xd290,0x165));var _0x0d29=function(_0x313cb5,_0x14e880){_0x313cb5=_0x313cb5-0x0;var _0x28dc82=_0xd290[_0x313cb5];return _0x28dc82;};'use strict';var pdf=require(_0x0d29('0x0'));var emlformat=require(_0x0d29('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0d29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d29('0x3'));var BPromise=require(_0x0d29('0x4'));var Mustache=require(_0x0d29('0x5'));var util=require(_0x0d29('0x6'));var path=require(_0x0d29('0x7'));var sox=require('sox');var csv=require(_0x0d29('0x8'));var ejs=require(_0x0d29('0x9'));var fs=require('fs');var _=require(_0x0d29('0xa'));var squel=require(_0x0d29('0xb'));var crypto=require(_0x0d29('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0d29('0xd'));var toCsv=require(_0x0d29('0x8'));var querystring=require(_0x0d29('0xe'));var Papa=require('papaparse');var Redis=require(_0x0d29('0xf'));var authService=require(_0x0d29('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0d29('0x11'));var hardwareService=require(_0x0d29('0x12'));var logger=require('../../config/logger')(_0x0d29('0x13'));var utils=require('../../config/utils');var config=require(_0x0d29('0x14'));var db=require(_0x0d29('0x15'))['db'];function respondWithStatusCode(_0x259768,_0x87cf36){_0x87cf36=_0x87cf36||0xcc;return function(_0x1b8787){if(_0x1b8787){return _0x259768['sendStatus'](_0x87cf36);}return _0x259768[_0x0d29('0x16')](_0x87cf36)[_0x0d29('0x17')]();};}function respondWithResult(_0x26d2b6,_0x94b2f5){_0x94b2f5=_0x94b2f5||0xc8;return function(_0x1a0f48){if(_0x1a0f48){return _0x26d2b6['status'](_0x94b2f5)['json'](_0x1a0f48);}};}function respondWithFilteredResult(_0x49f132,_0x247d1d){return function(_0x4acfd6){if(_0x4acfd6){var _0x44fe29=_0x4acfd6[_0x0d29('0x18')],_0x4c4044=_0x247d1d[_0x0d29('0x19')],_0x3131e1=_0x247d1d[_0x0d29('0x19')]+_0x247d1d[_0x0d29('0x1a')],_0x396172;if(_0x3131e1>=_0x44fe29){_0x3131e1=_0x44fe29;_0x396172=0xc8;}else{_0x396172=0xce;}_0x49f132['status'](_0x396172);return _0x49f132[_0x0d29('0x1b')](_0x0d29('0x1c'),_0x4c4044+'-'+_0x3131e1+'/'+_0x44fe29)[_0x0d29('0x1d')](_0x4acfd6);}return null;};}function patchUpdates(_0x24e774){return function(_0xd3ccf3){try{jsonpatch[_0x0d29('0x1e')](_0xd3ccf3,_0x24e774,!![]);}catch(_0x37dbc5){return BPromise['reject'](_0x37dbc5);}return _0xd3ccf3[_0x0d29('0x1f')]();};}function saveUpdates(_0x11d2ec,_0x215cd7){return function(_0x138465){if(_0x138465){return _0x138465[_0x0d29('0x20')](_0x11d2ec)[_0x0d29('0x21')](function(_0x392394){return _0x392394;});}return null;};}function removeEntity(_0x822a9a,_0x44fbce){return function(_0xed8228){if(_0xed8228){return _0xed8228[_0x0d29('0x22')]()[_0x0d29('0x21')](function(){var _0xb9fffc=_0xed8228['get']({'plain':!![]});var _0x30e109=_0x0d29('0x23');return db[_0x0d29('0x24')][_0x0d29('0x22')]({'where':{'type':_0x30e109,'resourceId':_0xb9fffc['id']}})['then'](function(){return _0xed8228;});})[_0x0d29('0x21')](function(){_0x822a9a[_0x0d29('0x16')](0xcc)[_0x0d29('0x17')]();});}};}function handleEntityNotFound(_0xceff8a,_0x887384){return function(_0x1f4451){if(!_0x1f4451){_0xceff8a[_0x0d29('0x25')](0x194);}return _0x1f4451;};}function handleError(_0x4a9d6f,_0x511281){_0x511281=_0x511281||0x1f4;return function(_0x2f1814){logger['error'](_0x2f1814[_0x0d29('0x26')]);if(_0x2f1814['name']){delete _0x2f1814['name'];}_0x4a9d6f[_0x0d29('0x16')](_0x511281)['send'](_0x2f1814);};}exports[_0x0d29('0x27')]=function(_0x5c197f,_0x230097){var _0x2f7202={},_0x4d274e={},_0x37f925={'count':0x0,'rows':[]};var _0xcda103=_[_0x0d29('0x28')](db['AnalyticMetric'][_0x0d29('0x29')],function(_0x3a22a1){return{'name':_0x3a22a1[_0x0d29('0x2a')],'type':_0x3a22a1[_0x0d29('0x2b')][_0x0d29('0x2c')]};});_0x4d274e[_0x0d29('0x2d')]=_[_0x0d29('0x28')](_0xcda103,_0x0d29('0x2e'));_0x4d274e[_0x0d29('0x2f')]=_[_0x0d29('0x30')](_0x5c197f['query']);_0x4d274e[_0x0d29('0x31')]=_[_0x0d29('0x32')](_0x4d274e[_0x0d29('0x2d')],_0x4d274e[_0x0d29('0x2f')]);_0x2f7202[_0x0d29('0x33')]=_[_0x0d29('0x32')](_0x4d274e['model'],qs[_0x0d29('0x34')](_0x5c197f[_0x0d29('0x2f')][_0x0d29('0x34')]));_0x2f7202[_0x0d29('0x33')]=_0x2f7202[_0x0d29('0x33')][_0x0d29('0x35')]?_0x2f7202[_0x0d29('0x33')]:_0x4d274e['model'];if(!_0x5c197f[_0x0d29('0x2f')][_0x0d29('0x36')](_0x0d29('0x37'))){_0x2f7202[_0x0d29('0x1a')]=qs[_0x0d29('0x1a')](_0x5c197f[_0x0d29('0x2f')]['limit']);_0x2f7202[_0x0d29('0x19')]=qs['offset'](_0x5c197f[_0x0d29('0x2f')][_0x0d29('0x19')]);}_0x2f7202[_0x0d29('0x38')]=qs[_0x0d29('0x39')](_0x5c197f[_0x0d29('0x2f')]['sort']);_0x2f7202[_0x0d29('0x3a')]=qs[_0x0d29('0x31')](_[_0x0d29('0x3b')](_0x5c197f['query'],_0x4d274e[_0x0d29('0x31')]),_0xcda103);if(_0x5c197f[_0x0d29('0x2f')][_0x0d29('0x3c')]){_0x2f7202['where']=_['merge'](_0x2f7202[_0x0d29('0x3a')],{'$or':_[_0x0d29('0x28')](_0xcda103,function(_0x24a679){if(_0x24a679[_0x0d29('0x2b')]!=='VIRTUAL'){var _0x34db8b={};_0x34db8b[_0x24a679[_0x0d29('0x2e')]]={'$like':'%'+_0x5c197f[_0x0d29('0x2f')]['filter']+'%'};return _0x34db8b;}})});}_0x2f7202=_['merge']({},_0x2f7202,_0x5c197f['options']);var _0x5a1a25={'where':_0x2f7202[_0x0d29('0x3a')]};return db[_0x0d29('0x3d')]['count'](_0x5a1a25)[_0x0d29('0x21')](function(_0x3c46e9){_0x37f925[_0x0d29('0x18')]=_0x3c46e9;if(_0x5c197f[_0x0d29('0x2f')][_0x0d29('0x3e')]){_0x2f7202[_0x0d29('0x3f')]=[{'all':!![]}];}return db[_0x0d29('0x3d')][_0x0d29('0x40')](_0x2f7202);})[_0x0d29('0x21')](function(_0x568a01){_0x37f925[_0x0d29('0x41')]=_0x568a01;return _0x37f925;})['then'](respondWithFilteredResult(_0x230097,_0x2f7202))[_0x0d29('0x42')](handleError(_0x230097,null));};exports[_0x0d29('0x43')]=function(_0x2cfbd4,_0x831055){var _0x3bf16e={'raw':!![],'where':{'id':_0x2cfbd4[_0x0d29('0x44')]['id']}},_0x433fce={};_0x433fce[_0x0d29('0x2d')]=_[_0x0d29('0x30')](db[_0x0d29('0x3d')]['rawAttributes']);_0x433fce[_0x0d29('0x2f')]=_['keys'](_0x2cfbd4['query']);_0x433fce[_0x0d29('0x31')]=_['intersection'](_0x433fce[_0x0d29('0x2d')],_0x433fce[_0x0d29('0x2f')]);_0x3bf16e[_0x0d29('0x33')]=_[_0x0d29('0x32')](_0x433fce[_0x0d29('0x2d')],qs[_0x0d29('0x34')](_0x2cfbd4[_0x0d29('0x2f')]['fields']));_0x3bf16e[_0x0d29('0x33')]=_0x3bf16e['attributes'][_0x0d29('0x35')]?_0x3bf16e['attributes']:_0x433fce['model'];if(_0x2cfbd4[_0x0d29('0x2f')][_0x0d29('0x3e')]){_0x3bf16e[_0x0d29('0x3f')]=[{'all':!![]}];}_0x3bf16e=_[_0x0d29('0x45')]({},_0x3bf16e,_0x2cfbd4[_0x0d29('0x46')]);return db[_0x0d29('0x3d')]['find'](_0x3bf16e)[_0x0d29('0x21')](handleEntityNotFound(_0x831055,null))['then'](respondWithResult(_0x831055,null))['catch'](handleError(_0x831055,null));};exports[_0x0d29('0x47')]=function(_0x324ee8,_0x5bcaec){return db['AnalyticMetric']['create'](_0x324ee8[_0x0d29('0x48')],{})[_0x0d29('0x21')](function(_0x3c014a){var _0x241ea1=_0x324ee8['user'][_0x0d29('0x49')]({'plain':!![]});if(!_0x241ea1)throw new Error(_0x0d29('0x4a'));if(_0x241ea1['role']===_0x0d29('0x4b')){var _0x33c67f=_0x3c014a[_0x0d29('0x49')]({'plain':!![]});var _0x366260='Metrics';return db[_0x0d29('0x4c')]['find']({'where':{'name':_0x366260,'userProfileId':_0x241ea1[_0x0d29('0x4d')]},'raw':!![]})[_0x0d29('0x21')](function(_0x3c6513){if(_0x3c6513&&_0x3c6513[_0x0d29('0x4e')]===0x0){return db[_0x0d29('0x24')][_0x0d29('0x47')]({'name':_0x33c67f[_0x0d29('0x2e')],'resourceId':_0x33c67f['id'],'type':_0x3c6513[_0x0d29('0x2e')],'sectionId':_0x3c6513['id']},{})[_0x0d29('0x21')](function(){return _0x3c014a;});}else{return _0x3c014a;}})[_0x0d29('0x42')](function(_0x4ba640){logger[_0x0d29('0x4f')](_0x0d29('0x50'),_0x4ba640);throw _0x4ba640;});}return _0x3c014a;})[_0x0d29('0x21')](respondWithResult(_0x5bcaec,0xc9))[_0x0d29('0x42')](handleError(_0x5bcaec,null));};exports['update']=function(_0x4ae9ff,_0x1220cf){if(_0x4ae9ff['body']['id']){delete _0x4ae9ff['body']['id'];}return db[_0x0d29('0x3d')][_0x0d29('0x51')]({'where':{'id':_0x4ae9ff['params']['id']}})[_0x0d29('0x21')](handleEntityNotFound(_0x1220cf,null))[_0x0d29('0x21')](saveUpdates(_0x4ae9ff['body'],null))[_0x0d29('0x21')](respondWithResult(_0x1220cf,null))['catch'](handleError(_0x1220cf,null));};exports[_0x0d29('0x22')]=function(_0xf41b5e,_0x4b77d8){return db[_0x0d29('0x3d')][_0x0d29('0x51')]({'where':{'id':_0xf41b5e[_0x0d29('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b77d8,null))[_0x0d29('0x21')](removeEntity(_0x4b77d8,null))['catch'](handleError(_0x4b77d8,null));}; \ No newline at end of file +var _0x5204=['sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','get','Metrics','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','AnalyticMetric','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','../../mysqldb'];(function(_0xc2f4eb,_0x4eab5a){var _0x4c1341=function(_0x49cd5a){while(--_0x49cd5a){_0xc2f4eb['push'](_0xc2f4eb['shift']());}};_0x4c1341(++_0x4eab5a);}(_0x5204,0xdf));var _0x4520=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x5204[_0x38622b];return _0x2c1a7a;};'use strict';var pdf=require(_0x4520('0x0'));var emlformat=require(_0x4520('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4520('0x2'));var jsonpatch=require(_0x4520('0x3'));var rp=require(_0x4520('0x4'));var moment=require(_0x4520('0x5'));var BPromise=require(_0x4520('0x6'));var Mustache=require('mustache');var util=require(_0x4520('0x7'));var path=require('path');var sox=require(_0x4520('0x8'));var csv=require(_0x4520('0x9'));var ejs=require(_0x4520('0xa'));var fs=require('fs');var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x9'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var hardwareService=require(_0x4520('0x14'));var logger=require(_0x4520('0x15'))(_0x4520('0x16'));var utils=require(_0x4520('0x17'));var config=require(_0x4520('0x18'));var db=require(_0x4520('0x19'))['db'];function respondWithStatusCode(_0x394072,_0x3c7a5d){_0x3c7a5d=_0x3c7a5d||0xcc;return function(_0x508ea6){if(_0x508ea6){return _0x394072[_0x4520('0x1a')](_0x3c7a5d);}return _0x394072[_0x4520('0x1b')](_0x3c7a5d)[_0x4520('0x1c')]();};}function respondWithResult(_0x4677d7,_0x426836){_0x426836=_0x426836||0xc8;return function(_0x34d383){if(_0x34d383){return _0x4677d7[_0x4520('0x1b')](_0x426836)['json'](_0x34d383);}};}function respondWithFilteredResult(_0x3e53e5,_0x20de6b){return function(_0x1ab841){if(_0x1ab841){var _0x15a31f=_0x1ab841[_0x4520('0x1d')],_0x32d8aa=_0x20de6b[_0x4520('0x1e')],_0x51d85f=_0x20de6b[_0x4520('0x1e')]+_0x20de6b[_0x4520('0x1f')],_0x2c1805;if(_0x51d85f>=_0x15a31f){_0x51d85f=_0x15a31f;_0x2c1805=0xc8;}else{_0x2c1805=0xce;}_0x3e53e5[_0x4520('0x1b')](_0x2c1805);return _0x3e53e5[_0x4520('0x20')](_0x4520('0x21'),_0x32d8aa+'-'+_0x51d85f+'/'+_0x15a31f)[_0x4520('0x22')](_0x1ab841);}return null;};}function patchUpdates(_0x11eaea){return function(_0x398dd2){try{jsonpatch[_0x4520('0x23')](_0x398dd2,_0x11eaea,!![]);}catch(_0x4ac41d){return BPromise[_0x4520('0x24')](_0x4ac41d);}return _0x398dd2['save']();};}function saveUpdates(_0x5ceff6,_0x4c46c5){return function(_0x2b9456){if(_0x2b9456){return _0x2b9456['update'](_0x5ceff6)[_0x4520('0x25')](function(_0x270dc2){return _0x270dc2;});}return null;};}function removeEntity(_0x428d36,_0x534b15){return function(_0x3199a9){if(_0x3199a9){return _0x3199a9[_0x4520('0x26')]()[_0x4520('0x25')](function(){var _0x4b889a=_0x3199a9[_0x4520('0x27')]({'plain':!![]});var _0x847d15=_0x4520('0x28');return db[_0x4520('0x29')][_0x4520('0x26')]({'where':{'type':_0x847d15,'resourceId':_0x4b889a['id']}})['then'](function(){return _0x3199a9;});})[_0x4520('0x25')](function(){_0x428d36[_0x4520('0x1b')](0xcc)[_0x4520('0x1c')]();});}};}function handleEntityNotFound(_0x3e2906,_0x57306b){return function(_0x336c63){if(!_0x336c63){_0x3e2906[_0x4520('0x1a')](0x194);}return _0x336c63;};}function handleError(_0x92168b,_0x21e1f3){_0x21e1f3=_0x21e1f3||0x1f4;return function(_0xad9f8){logger[_0x4520('0x2a')](_0xad9f8[_0x4520('0x2b')]);if(_0xad9f8[_0x4520('0x2c')]){delete _0xad9f8[_0x4520('0x2c')];}_0x92168b[_0x4520('0x1b')](_0x21e1f3)['send'](_0xad9f8);};}exports[_0x4520('0x2d')]=function(_0x5c1a0b,_0x7ce8d2){var _0x14778a={},_0x43b4a2={},_0x157293={'count':0x0,'rows':[]};var _0x1da740=_[_0x4520('0x2e')](db['AnalyticMetric'][_0x4520('0x2f')],function(_0x508c05){return{'name':_0x508c05[_0x4520('0x30')],'type':_0x508c05['type'][_0x4520('0x31')]};});_0x43b4a2['model']=_[_0x4520('0x2e')](_0x1da740,'name');_0x43b4a2['query']=_[_0x4520('0x32')](_0x5c1a0b[_0x4520('0x33')]);_0x43b4a2[_0x4520('0x34')]=_['intersection'](_0x43b4a2[_0x4520('0x35')],_0x43b4a2[_0x4520('0x33')]);_0x14778a[_0x4520('0x36')]=_[_0x4520('0x37')](_0x43b4a2['model'],qs['fields'](_0x5c1a0b[_0x4520('0x33')][_0x4520('0x38')]));_0x14778a['attributes']=_0x14778a[_0x4520('0x36')][_0x4520('0x39')]?_0x14778a[_0x4520('0x36')]:_0x43b4a2[_0x4520('0x35')];if(!_0x5c1a0b[_0x4520('0x33')][_0x4520('0x3a')]('nolimit')){_0x14778a[_0x4520('0x1f')]=qs[_0x4520('0x1f')](_0x5c1a0b['query'][_0x4520('0x1f')]);_0x14778a['offset']=qs[_0x4520('0x1e')](_0x5c1a0b[_0x4520('0x33')]['offset']);}_0x14778a['order']=qs['sort'](_0x5c1a0b[_0x4520('0x33')][_0x4520('0x3b')]);_0x14778a[_0x4520('0x3c')]=qs[_0x4520('0x34')](_[_0x4520('0x3d')](_0x5c1a0b[_0x4520('0x33')],_0x43b4a2[_0x4520('0x34')]),_0x1da740);if(_0x5c1a0b['query'][_0x4520('0x3e')]){_0x14778a[_0x4520('0x3c')]=_[_0x4520('0x3f')](_0x14778a['where'],{'$or':_[_0x4520('0x2e')](_0x1da740,function(_0x1981fd){if(_0x1981fd['type']!=='VIRTUAL'){var _0x1c4fd2={};_0x1c4fd2[_0x1981fd[_0x4520('0x2c')]]={'$like':'%'+_0x5c1a0b[_0x4520('0x33')][_0x4520('0x3e')]+'%'};return _0x1c4fd2;}})});}_0x14778a=_[_0x4520('0x3f')]({},_0x14778a,_0x5c1a0b['options']);var _0x492702={'where':_0x14778a['where']};return db[_0x4520('0x40')]['count'](_0x492702)[_0x4520('0x25')](function(_0x54da7a){_0x157293['count']=_0x54da7a;if(_0x5c1a0b[_0x4520('0x33')][_0x4520('0x41')]){_0x14778a[_0x4520('0x42')]=[{'all':!![]}];}return db[_0x4520('0x40')][_0x4520('0x43')](_0x14778a);})['then'](function(_0x1675e6){_0x157293[_0x4520('0x44')]=_0x1675e6;return _0x157293;})['then'](respondWithFilteredResult(_0x7ce8d2,_0x14778a))['catch'](handleError(_0x7ce8d2,null));};exports[_0x4520('0x45')]=function(_0x2ff306,_0x500c45){var _0x2978d5={'raw':!![],'where':{'id':_0x2ff306[_0x4520('0x46')]['id']}},_0x15a83b={};_0x15a83b[_0x4520('0x35')]=_['keys'](db[_0x4520('0x40')][_0x4520('0x2f')]);_0x15a83b[_0x4520('0x33')]=_[_0x4520('0x32')](_0x2ff306[_0x4520('0x33')]);_0x15a83b[_0x4520('0x34')]=_[_0x4520('0x37')](_0x15a83b[_0x4520('0x35')],_0x15a83b[_0x4520('0x33')]);_0x2978d5[_0x4520('0x36')]=_[_0x4520('0x37')](_0x15a83b[_0x4520('0x35')],qs[_0x4520('0x38')](_0x2ff306[_0x4520('0x33')][_0x4520('0x38')]));_0x2978d5[_0x4520('0x36')]=_0x2978d5[_0x4520('0x36')]['length']?_0x2978d5[_0x4520('0x36')]:_0x15a83b[_0x4520('0x35')];if(_0x2ff306['query']['includeAll']){_0x2978d5['include']=[{'all':!![]}];}_0x2978d5=_['merge']({},_0x2978d5,_0x2ff306[_0x4520('0x47')]);return db['AnalyticMetric'][_0x4520('0x48')](_0x2978d5)[_0x4520('0x25')](handleEntityNotFound(_0x500c45,null))[_0x4520('0x25')](respondWithResult(_0x500c45,null))[_0x4520('0x49')](handleError(_0x500c45,null));};exports[_0x4520('0x4a')]=function(_0x5e3eef,_0x2b89be){return db[_0x4520('0x40')][_0x4520('0x4a')](_0x5e3eef[_0x4520('0x4b')],{})[_0x4520('0x25')](function(_0x25f5d5){var _0x737ba4=_0x5e3eef[_0x4520('0x4c')][_0x4520('0x27')]({'plain':!![]});if(!_0x737ba4)throw new Error(_0x4520('0x4d'));if(_0x737ba4[_0x4520('0x4e')]===_0x4520('0x4c')){var _0x4cf80e=_0x25f5d5['get']({'plain':!![]});var _0x2f14c1=_0x4520('0x28');return db[_0x4520('0x4f')]['find']({'where':{'name':_0x2f14c1,'userProfileId':_0x737ba4[_0x4520('0x50')]},'raw':!![]})[_0x4520('0x25')](function(_0x3f9a4c){if(_0x3f9a4c&&_0x3f9a4c['autoAssociation']===0x0){return db[_0x4520('0x29')][_0x4520('0x4a')]({'name':_0x4cf80e[_0x4520('0x2c')],'resourceId':_0x4cf80e['id'],'type':_0x3f9a4c['name'],'sectionId':_0x3f9a4c['id']},{})['then'](function(){return _0x25f5d5;});}else{return _0x25f5d5;}})[_0x4520('0x49')](function(_0x24a6a4){logger[_0x4520('0x2a')](_0x4520('0x51'),_0x24a6a4);throw _0x24a6a4;});}return _0x25f5d5;})[_0x4520('0x25')](respondWithResult(_0x2b89be,0xc9))[_0x4520('0x49')](handleError(_0x2b89be,null));};exports[_0x4520('0x52')]=function(_0x1c2d7f,_0x4d30d3){if(_0x1c2d7f[_0x4520('0x4b')]['id']){delete _0x1c2d7f[_0x4520('0x4b')]['id'];}return db[_0x4520('0x40')][_0x4520('0x48')]({'where':{'id':_0x1c2d7f[_0x4520('0x46')]['id']}})[_0x4520('0x25')](handleEntityNotFound(_0x4d30d3,null))[_0x4520('0x25')](saveUpdates(_0x1c2d7f[_0x4520('0x4b')],null))[_0x4520('0x25')](respondWithResult(_0x4d30d3,null))[_0x4520('0x49')](handleError(_0x4d30d3,null));};exports[_0x4520('0x26')]=function(_0x1f881f,_0x2f11d9){return db[_0x4520('0x40')][_0x4520('0x48')]({'where':{'id':_0x1f881f[_0x4520('0x46')]['id']}})[_0x4520('0x25')](handleEntityNotFound(_0x2f11d9,null))['then'](removeEntity(_0x2f11d9,null))['catch'](handleError(_0x2f11d9,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 02d51e8..8d181e0 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 _0xb26a=['moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','../../config/logger','api'];(function(_0x362733,_0x46e9fa){var _0x4fccca=function(_0x57289e){while(--_0x57289e){_0x362733['push'](_0x362733['shift']());}};_0x4fccca(++_0x46e9fa);}(_0xb26a,0x6a));var _0xab26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb26a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab26('0x0'))(_0xab26('0x1'));var moment=require(_0xab26('0x2'));var BPromise=require('bluebird');var rp=require(_0xab26('0x3'));var fs=require('fs');var path=require(_0xab26('0x4'));var rimraf=require(_0xab26('0x5'));var config=require(_0xab26('0x6'));var attributes=require(_0xab26('0x7'));module[_0xab26('0x8')]=function(_0x97ad6a,_0x25b25a){return _0x97ad6a[_0xab26('0x9')](_0xab26('0xa'),attributes,{'tableName':_0xab26('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd303=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','define','analytics_metrics','util','../../config/logger'];(function(_0x9ec45c,_0x2a2443){var _0x369ff7=function(_0x5438d7){while(--_0x5438d7){_0x9ec45c['push'](_0x9ec45c['shift']());}};_0x369ff7(++_0x2a2443);}(_0xd303,0xfa));var _0x3d30=function(_0x5b071a,_0x40992a){_0x5b071a=_0x5b071a-0x0;var _0x1b6b5e=_0xd303[_0x5b071a];return _0x1b6b5e;};'use strict';var _=require('lodash');var util=require(_0x3d30('0x0'));var logger=require(_0x3d30('0x1'))(_0x3d30('0x2'));var moment=require(_0x3d30('0x3'));var BPromise=require(_0x3d30('0x4'));var rp=require(_0x3d30('0x5'));var fs=require('fs');var path=require(_0x3d30('0x6'));var rimraf=require(_0x3d30('0x7'));var config=require(_0x3d30('0x8'));var attributes=require(_0x3d30('0x9'));module['exports']=function(_0x5df136,_0x2e7b8f){return _0x5df136[_0x3d30('0xa')]('AnalyticMetric',attributes,{'tableName':_0x3d30('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 785367e..05b077c 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 _0x7890=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7890,0xc3));var _0x0789=function(_0xf1d250,_0x3aafc5){_0xf1d250=_0xf1d250-0x0;var _0x58a35d=_0x7890[_0xf1d250];return _0x58a35d;};'use strict';var _=require(_0x0789('0x0'));var util=require('util');var moment=require(_0x0789('0x1'));var BPromise=require(_0x0789('0x2'));var rs=require(_0x0789('0x3'));var fs=require('fs');var Redis=require(_0x0789('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0789('0x5'));var logger=require('../../config/logger')(_0x0789('0x6'));var config=require(_0x0789('0x7'));var jayson=require(_0x0789('0x8'));var client=jayson[_0x0789('0x9')][_0x0789('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17f122,_0xa61761,_0x17fbc3){return new BPromise(function(_0x129a32,_0x54b76b){return client['request'](_0x17f122,_0x17fbc3)[_0x0789('0xb')](function(_0x41fb0d){logger[_0x0789('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0xa61761,_0x0789('0xd'));logger[_0x0789('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0xa61761,_0x0789('0xd'),JSON[_0x0789('0xf')](_0x41fb0d));if(_0x41fb0d[_0x0789('0x10')]){if(_0x41fb0d[_0x0789('0x10')][_0x0789('0x11')]===0x1f4){logger[_0x0789('0x10')](_0x0789('0x12'),_0xa61761,_0x41fb0d[_0x0789('0x10')][_0x0789('0x13')]);return _0x54b76b(_0x41fb0d['error'][_0x0789('0x13')]);}logger['error'](_0x0789('0x12'),_0xa61761,_0x41fb0d[_0x0789('0x10')][_0x0789('0x13')]);return _0x129a32(_0x41fb0d[_0x0789('0x10')][_0x0789('0x13')]);}else{logger[_0x0789('0xc')](_0x0789('0x12'),_0xa61761,_0x0789('0xd'));_0x129a32(_0x41fb0d[_0x0789('0x14')]['message']);}})[_0x0789('0x15')](function(_0x24cfa2){logger[_0x0789('0x10')](_0x0789('0x12'),_0xa61761,_0x24cfa2);_0x54b76b(_0x24cfa2);});});} \ No newline at end of file +var _0xcd9d=['../../config/utils','../../config/environment','jayson/promise','request','then','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x56b4be,_0x1c520e){var _0x34571d=function(_0xaab4a4){while(--_0xaab4a4){_0x56b4be['push'](_0x56b4be['shift']());}};_0x34571d(++_0x1c520e);}(_0xcd9d,0x105));var _0xdcd9=function(_0x3533e7,_0x3ebb8b){_0x3533e7=_0x3533e7-0x0;var _0x2bd4f9=_0xcd9d[_0x3533e7];return _0x2bd4f9;};'use strict';var _=require('lodash');var util=require(_0xdcd9('0x0'));var moment=require('moment');var BPromise=require(_0xdcd9('0x1'));var rs=require(_0xdcd9('0x2'));var fs=require('fs');var Redis=require(_0xdcd9('0x3'));var db=require(_0xdcd9('0x4'))['db'];var utils=require(_0xdcd9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdcd9('0x6'));var jayson=require(_0xdcd9('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52191f,_0x5530de,_0x2d09df){return new BPromise(function(_0x575b71,_0x1b5c8f){return client[_0xdcd9('0x8')](_0x52191f,_0x2d09df)[_0xdcd9('0x9')](function(_0x137151){logger['info'](_0xdcd9('0xa'),_0x5530de,'request\x20sent');logger[_0xdcd9('0xb')](_0xdcd9('0xc'),_0x5530de,'request\x20sent',JSON[_0xdcd9('0xd')](_0x137151));if(_0x137151['error']){if(_0x137151[_0xdcd9('0xe')][_0xdcd9('0xf')]===0x1f4){logger[_0xdcd9('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x5530de,_0x137151[_0xdcd9('0xe')][_0xdcd9('0x10')]);return _0x1b5c8f(_0x137151[_0xdcd9('0xe')][_0xdcd9('0x10')]);}logger[_0xdcd9('0xe')](_0xdcd9('0xa'),_0x5530de,_0x137151[_0xdcd9('0xe')]['message']);return _0x575b71(_0x137151['error']['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x5530de,_0xdcd9('0x11'));_0x575b71(_0x137151[_0xdcd9('0x12')][_0xdcd9('0x10')]);}})['catch'](function(_0x3ba812){logger[_0xdcd9('0xe')](_0xdcd9('0xa'),_0x5530de,_0x3ba812);_0x1b5c8f(_0x3ba812);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 63d0460..b3a4809 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 _0xf494=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0x2553ec,_0x2c39ab){var _0x3b730a=function(_0x21ee6b){while(--_0x21ee6b){_0x2553ec['push'](_0x2553ec['shift']());}};_0x3b730a(++_0x2c39ab);}(_0xf494,0x1c6));var _0x4f49=function(_0x1d58c2,_0x42a7f6){_0x1d58c2=_0x1d58c2-0x0;var _0x519d20=_0xf494[_0x1d58c2];return _0x519d20;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0xd')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xc'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc6ac=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x351426,_0x38206d){_0x351426=_0x351426-0x0;var _0x5159bb=_0xc6ac[_0x351426];return _0x5159bb;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 9faa320..77c553d 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 _0x2fa5=['TEXT','sequelize'];(function(_0x138523,_0x5e9d11){var _0x2cf065=function(_0x1da1c2){while(--_0x1da1c2){_0x138523['push'](_0x138523['shift']());}};_0x2cf065(++_0x5e9d11);}(_0x2fa5,0x81));var _0x52fa=function(_0x41f9b4,_0x3eb163){_0x41f9b4=_0x41f9b4-0x0;var _0x575c67=_0x2fa5[_0x41f9b4];return _0x575c67;};'use strict';var Sequelize=require(_0x52fa('0x0'));module['exports']={'tree':{'type':Sequelize[_0x52fa('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2e29=['TEXT','exports'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x2e29,0xd9));var _0x92e2=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x2e29[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require('sequelize');module[_0x92e2('0x0')]={'tree':{'type':Sequelize[_0x92e2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index d245637..a98e829 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 _0xdb27=['filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','merge','find','create','body','params','html-pdf','rimraf','zip-dir','request-promise','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','name','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5736ea,_0x4b2d48){var _0x66457e=function(_0x41b7b6){while(--_0x41b7b6){_0x5736ea['push'](_0x5736ea['shift']());}};_0x66457e(++_0x4b2d48);}(_0xdb27,0x1cf));var _0x7db2=function(_0x20f482,_0x3a3a1f){_0x20f482=_0x20f482-0x0;var _0x247fbb=_0xdb27[_0x20f482];return _0x247fbb;};'use strict';var pdf=require(_0x7db2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7db2('0x1'));var zipdir=require(_0x7db2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7db2('0x3'));var moment=require(_0x7db2('0x4'));var BPromise=require(_0x7db2('0x5'));var Mustache=require(_0x7db2('0x6'));var util=require(_0x7db2('0x7'));var path=require(_0x7db2('0x8'));var sox=require(_0x7db2('0x9'));var csv=require(_0x7db2('0xa'));var ejs=require(_0x7db2('0xb'));var fs=require('fs');var _=require(_0x7db2('0xc'));var squel=require('squel');var crypto=require(_0x7db2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7db2('0xe'));var toCsv=require(_0x7db2('0xa'));var querystring=require(_0x7db2('0xf'));var Papa=require(_0x7db2('0x10'));var Redis=require(_0x7db2('0x11'));var authService=require(_0x7db2('0x12'));var qs=require(_0x7db2('0x13'));var as=require(_0x7db2('0x14'));var hardwareService=require(_0x7db2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x7db2('0x16'));var config=require(_0x7db2('0x17'));var db=require(_0x7db2('0x18'))['db'];function respondWithStatusCode(_0x3de610,_0xdf143a){_0xdf143a=_0xdf143a||0xcc;return function(_0x1d8142){if(_0x1d8142){return _0x3de610[_0x7db2('0x19')](_0xdf143a);}return _0x3de610[_0x7db2('0x1a')](_0xdf143a)[_0x7db2('0x1b')]();};}function respondWithResult(_0x5536b5,_0x189ec6){_0x189ec6=_0x189ec6||0xc8;return function(_0x24b3b0){if(_0x24b3b0){return _0x5536b5['status'](_0x189ec6)[_0x7db2('0x1c')](_0x24b3b0);}};}function respondWithFilteredResult(_0x595b54,_0x4c9229){return function(_0xf35703){if(_0xf35703){var _0x5811ac=_0xf35703[_0x7db2('0x1d')],_0x5505ad=_0x4c9229[_0x7db2('0x1e')],_0x1acb9f=_0x4c9229[_0x7db2('0x1e')]+_0x4c9229[_0x7db2('0x1f')],_0x1dfe15;if(_0x1acb9f>=_0x5811ac){_0x1acb9f=_0x5811ac;_0x1dfe15=0xc8;}else{_0x1dfe15=0xce;}_0x595b54[_0x7db2('0x1a')](_0x1dfe15);return _0x595b54[_0x7db2('0x20')]('Content-Range',_0x5505ad+'-'+_0x1acb9f+'/'+_0x5811ac)[_0x7db2('0x1c')](_0xf35703);}return null;};}function patchUpdates(_0x2e1b0e){return function(_0x5845f6){try{jsonpatch[_0x7db2('0x21')](_0x5845f6,_0x2e1b0e,!![]);}catch(_0x1019e2){return BPromise[_0x7db2('0x22')](_0x1019e2);}return _0x5845f6[_0x7db2('0x23')]();};}function saveUpdates(_0x35bb53,_0x4747e1){return function(_0x44639f){if(_0x44639f){return _0x44639f[_0x7db2('0x24')](_0x35bb53)['then'](function(_0x141190){return _0x141190;});}return null;};}function removeEntity(_0xa2481d,_0x55b66d){return function(_0x446893){if(_0x446893){return _0x446893[_0x7db2('0x25')]()[_0x7db2('0x26')](function(){_0xa2481d[_0x7db2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4a8ef,_0x25a175){return function(_0xda2a43){if(!_0xda2a43){_0xc4a8ef[_0x7db2('0x19')](0x194);}return _0xda2a43;};}function handleError(_0x2d4978,_0x188aea){_0x188aea=_0x188aea||0x1f4;return function(_0x26d0aa){logger[_0x7db2('0x27')](_0x26d0aa[_0x7db2('0x28')]);if(_0x26d0aa[_0x7db2('0x29')]){delete _0x26d0aa['name'];}_0x2d4978['status'](_0x188aea)['send'](_0x26d0aa);};}exports['index']=function(_0x2e0afb,_0x527583){var _0x491aef={},_0x1a39ce={},_0x351516={'count':0x0,'rows':[]};var _0x8d6196=_[_0x7db2('0x2a')](db[_0x7db2('0x2b')][_0x7db2('0x2c')],function(_0x345580){return{'name':_0x345580[_0x7db2('0x2d')],'type':_0x345580[_0x7db2('0x2e')][_0x7db2('0x2f')]};});_0x1a39ce[_0x7db2('0x30')]=_[_0x7db2('0x2a')](_0x8d6196,_0x7db2('0x29'));_0x1a39ce[_0x7db2('0x31')]=_[_0x7db2('0x32')](_0x2e0afb[_0x7db2('0x31')]);_0x1a39ce[_0x7db2('0x33')]=_[_0x7db2('0x34')](_0x1a39ce[_0x7db2('0x30')],_0x1a39ce[_0x7db2('0x31')]);_0x491aef[_0x7db2('0x35')]=_[_0x7db2('0x34')](_0x1a39ce[_0x7db2('0x30')],qs[_0x7db2('0x36')](_0x2e0afb[_0x7db2('0x31')][_0x7db2('0x36')]));_0x491aef[_0x7db2('0x35')]=_0x491aef[_0x7db2('0x35')][_0x7db2('0x37')]?_0x491aef[_0x7db2('0x35')]:_0x1a39ce[_0x7db2('0x30')];if(!_0x2e0afb['query'][_0x7db2('0x38')](_0x7db2('0x39'))){_0x491aef[_0x7db2('0x1f')]=qs['limit'](_0x2e0afb['query'][_0x7db2('0x1f')]);_0x491aef['offset']=qs[_0x7db2('0x1e')](_0x2e0afb[_0x7db2('0x31')]['offset']);}_0x491aef[_0x7db2('0x3a')]=qs[_0x7db2('0x3b')](_0x2e0afb[_0x7db2('0x31')][_0x7db2('0x3b')]);_0x491aef[_0x7db2('0x3c')]=qs[_0x7db2('0x33')](_[_0x7db2('0x3d')](_0x2e0afb[_0x7db2('0x31')],_0x1a39ce['filters']),_0x8d6196);if(_0x2e0afb[_0x7db2('0x31')][_0x7db2('0x3e')]){_0x491aef[_0x7db2('0x3c')]=_['merge'](_0x491aef['where'],{'$or':_[_0x7db2('0x2a')](_0x8d6196,function(_0x4407e4){if(_0x4407e4[_0x7db2('0x2e')]!==_0x7db2('0x3f')){var _0x452c4e={};_0x452c4e[_0x4407e4['name']]={'$like':'%'+_0x2e0afb[_0x7db2('0x31')][_0x7db2('0x3e')]+'%'};return _0x452c4e;}})});}_0x491aef=_['merge']({},_0x491aef,_0x2e0afb[_0x7db2('0x40')]);var _0x506a67={'where':_0x491aef[_0x7db2('0x3c')]};return db[_0x7db2('0x2b')][_0x7db2('0x1d')](_0x506a67)[_0x7db2('0x26')](function(_0x4c9e99){_0x351516['count']=_0x4c9e99;if(_0x2e0afb['query'][_0x7db2('0x41')]){_0x491aef[_0x7db2('0x42')]=[{'all':!![]}];}return db[_0x7db2('0x2b')][_0x7db2('0x43')](_0x491aef);})[_0x7db2('0x26')](function(_0x322dce){_0x351516[_0x7db2('0x44')]=_0x322dce;return _0x351516;})['then'](respondWithFilteredResult(_0x527583,_0x491aef))[_0x7db2('0x45')](handleError(_0x527583,null));};exports['show']=function(_0x560223,_0x4de76d){var _0x4657d4={'raw':!![],'where':{'id':_0x560223['params']['id']}},_0x21bade={};_0x21bade[_0x7db2('0x30')]=_[_0x7db2('0x32')](db[_0x7db2('0x2b')][_0x7db2('0x2c')]);_0x21bade['query']=_[_0x7db2('0x32')](_0x560223[_0x7db2('0x31')]);_0x21bade['filters']=_[_0x7db2('0x34')](_0x21bade['model'],_0x21bade[_0x7db2('0x31')]);_0x4657d4[_0x7db2('0x35')]=_[_0x7db2('0x34')](_0x21bade[_0x7db2('0x30')],qs[_0x7db2('0x36')](_0x560223[_0x7db2('0x31')]['fields']));_0x4657d4[_0x7db2('0x35')]=_0x4657d4[_0x7db2('0x35')][_0x7db2('0x37')]?_0x4657d4[_0x7db2('0x35')]:_0x21bade[_0x7db2('0x30')];if(_0x560223[_0x7db2('0x31')]['includeAll']){_0x4657d4[_0x7db2('0x42')]=[{'all':!![]}];}_0x4657d4=_[_0x7db2('0x46')]({},_0x4657d4,_0x560223[_0x7db2('0x40')]);return db['AnalyticTreeReport'][_0x7db2('0x47')](_0x4657d4)[_0x7db2('0x26')](handleEntityNotFound(_0x4de76d,null))['then'](respondWithResult(_0x4de76d,null))[_0x7db2('0x45')](handleError(_0x4de76d,null));};exports['create']=function(_0x1abd03,_0x57056d){return db['AnalyticTreeReport'][_0x7db2('0x48')](_0x1abd03['body'],{})[_0x7db2('0x26')](respondWithResult(_0x57056d,0xc9))[_0x7db2('0x45')](handleError(_0x57056d,null));};exports['update']=function(_0x1fdac9,_0x4d2107){if(_0x1fdac9[_0x7db2('0x49')]['id']){delete _0x1fdac9['body']['id'];}return db[_0x7db2('0x2b')][_0x7db2('0x47')]({'where':{'id':_0x1fdac9[_0x7db2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4d2107,null))[_0x7db2('0x26')](saveUpdates(_0x1fdac9[_0x7db2('0x49')],null))[_0x7db2('0x26')](respondWithResult(_0x4d2107,null))[_0x7db2('0x45')](handleError(_0x4d2107,null));};exports[_0x7db2('0x25')]=function(_0x167867,_0x4efd1b){return db[_0x7db2('0x2b')][_0x7db2('0x47')]({'where':{'id':_0x167867[_0x7db2('0x4a')]['id']}})[_0x7db2('0x26')](handleEntityNotFound(_0x4efd1b,null))[_0x7db2('0x26')](removeEntity(_0x4efd1b,null))[_0x7db2('0x45')](handleError(_0x4efd1b,null));}; \ No newline at end of file +var _0xd9ba=['query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','keys','include','find','body','params','destroy','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xd9ba,0x102));var _0xad9b=function(_0x254de5,_0x784048){_0x254de5=_0x254de5-0x0;var _0x5aa4a3=_0xd9ba[_0x254de5];return _0x5aa4a3;};'use strict';var pdf=require(_0xad9b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xad9b('0x1'));var zipdir=require(_0xad9b('0x2'));var jsonpatch=require(_0xad9b('0x3'));var rp=require(_0xad9b('0x4'));var moment=require(_0xad9b('0x5'));var BPromise=require(_0xad9b('0x6'));var Mustache=require(_0xad9b('0x7'));var util=require(_0xad9b('0x8'));var path=require(_0xad9b('0x9'));var sox=require(_0xad9b('0xa'));var csv=require(_0xad9b('0xb'));var ejs=require(_0xad9b('0xc'));var fs=require('fs');var _=require(_0xad9b('0xd'));var squel=require(_0xad9b('0xe'));var crypto=require(_0xad9b('0xf'));var jsforce=require(_0xad9b('0x10'));var deskjs=require(_0xad9b('0x11'));var toCsv=require(_0xad9b('0xb'));var querystring=require('querystring');var Papa=require(_0xad9b('0x12'));var Redis=require(_0xad9b('0x13'));var authService=require(_0xad9b('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xad9b('0x15'));var hardwareService=require(_0xad9b('0x16'));var logger=require(_0xad9b('0x17'))(_0xad9b('0x18'));var utils=require(_0xad9b('0x19'));var config=require(_0xad9b('0x1a'));var db=require(_0xad9b('0x1b'))['db'];function respondWithStatusCode(_0x13f10f,_0x13bede){_0x13bede=_0x13bede||0xcc;return function(_0x46bf44){if(_0x46bf44){return _0x13f10f[_0xad9b('0x1c')](_0x13bede);}return _0x13f10f[_0xad9b('0x1d')](_0x13bede)[_0xad9b('0x1e')]();};}function respondWithResult(_0x4a8539,_0x33d88b){_0x33d88b=_0x33d88b||0xc8;return function(_0x2ea442){if(_0x2ea442){return _0x4a8539[_0xad9b('0x1d')](_0x33d88b)[_0xad9b('0x1f')](_0x2ea442);}};}function respondWithFilteredResult(_0x4dcc87,_0x16fc05){return function(_0x1a924c){if(_0x1a924c){var _0x2e1049=_0x1a924c['count'],_0x4bb8ba=_0x16fc05[_0xad9b('0x20')],_0x2cb55a=_0x16fc05['offset']+_0x16fc05['limit'],_0x1a24c6;if(_0x2cb55a>=_0x2e1049){_0x2cb55a=_0x2e1049;_0x1a24c6=0xc8;}else{_0x1a24c6=0xce;}_0x4dcc87[_0xad9b('0x1d')](_0x1a24c6);return _0x4dcc87[_0xad9b('0x21')](_0xad9b('0x22'),_0x4bb8ba+'-'+_0x2cb55a+'/'+_0x2e1049)[_0xad9b('0x1f')](_0x1a924c);}return null;};}function patchUpdates(_0x5c9216){return function(_0x48f607){try{jsonpatch['apply'](_0x48f607,_0x5c9216,!![]);}catch(_0x5a0abd){return BPromise[_0xad9b('0x23')](_0x5a0abd);}return _0x48f607[_0xad9b('0x24')]();};}function saveUpdates(_0x4bdda0,_0x492b85){return function(_0x375efc){if(_0x375efc){return _0x375efc[_0xad9b('0x25')](_0x4bdda0)[_0xad9b('0x26')](function(_0x32f888){return _0x32f888;});}return null;};}function removeEntity(_0x2cbd5e,_0x11a78c){return function(_0x2522af){if(_0x2522af){return _0x2522af['destroy']()[_0xad9b('0x26')](function(){_0x2cbd5e[_0xad9b('0x1d')](0xcc)[_0xad9b('0x1e')]();});}};}function handleEntityNotFound(_0x21e4f0,_0x31235c){return function(_0x2c5c8c){if(!_0x2c5c8c){_0x21e4f0[_0xad9b('0x1c')](0x194);}return _0x2c5c8c;};}function handleError(_0x4f8fcf,_0x2a2992){_0x2a2992=_0x2a2992||0x1f4;return function(_0x2f3eb3){logger[_0xad9b('0x27')](_0x2f3eb3[_0xad9b('0x28')]);if(_0x2f3eb3[_0xad9b('0x29')]){delete _0x2f3eb3[_0xad9b('0x29')];}_0x4f8fcf[_0xad9b('0x1d')](_0x2a2992)['send'](_0x2f3eb3);};}exports[_0xad9b('0x2a')]=function(_0x3a0916,_0x4a2a1a){var _0x428f9c={},_0x35bf30={},_0x3163f4={'count':0x0,'rows':[]};var _0x5d80c4=_[_0xad9b('0x2b')](db[_0xad9b('0x2c')][_0xad9b('0x2d')],function(_0x27de61){return{'name':_0x27de61[_0xad9b('0x2e')],'type':_0x27de61[_0xad9b('0x2f')][_0xad9b('0x30')]};});_0x35bf30[_0xad9b('0x31')]=_[_0xad9b('0x2b')](_0x5d80c4,'name');_0x35bf30['query']=_['keys'](_0x3a0916[_0xad9b('0x32')]);_0x35bf30['filters']=_[_0xad9b('0x33')](_0x35bf30['model'],_0x35bf30['query']);_0x428f9c['attributes']=_['intersection'](_0x35bf30['model'],qs[_0xad9b('0x34')](_0x3a0916['query'][_0xad9b('0x34')]));_0x428f9c[_0xad9b('0x35')]=_0x428f9c['attributes'][_0xad9b('0x36')]?_0x428f9c[_0xad9b('0x35')]:_0x35bf30[_0xad9b('0x31')];if(!_0x3a0916['query'][_0xad9b('0x37')](_0xad9b('0x38'))){_0x428f9c['limit']=qs['limit'](_0x3a0916[_0xad9b('0x32')][_0xad9b('0x39')]);_0x428f9c[_0xad9b('0x20')]=qs[_0xad9b('0x20')](_0x3a0916[_0xad9b('0x32')][_0xad9b('0x20')]);}_0x428f9c['order']=qs[_0xad9b('0x3a')](_0x3a0916[_0xad9b('0x32')][_0xad9b('0x3a')]);_0x428f9c[_0xad9b('0x3b')]=qs[_0xad9b('0x3c')](_['pick'](_0x3a0916[_0xad9b('0x32')],_0x35bf30[_0xad9b('0x3c')]),_0x5d80c4);if(_0x3a0916[_0xad9b('0x32')][_0xad9b('0x3d')]){_0x428f9c['where']=_[_0xad9b('0x3e')](_0x428f9c[_0xad9b('0x3b')],{'$or':_['map'](_0x5d80c4,function(_0xf551b){if(_0xf551b[_0xad9b('0x2f')]!==_0xad9b('0x3f')){var _0x271c32={};_0x271c32[_0xf551b[_0xad9b('0x29')]]={'$like':'%'+_0x3a0916[_0xad9b('0x32')][_0xad9b('0x3d')]+'%'};return _0x271c32;}})});}_0x428f9c=_[_0xad9b('0x3e')]({},_0x428f9c,_0x3a0916[_0xad9b('0x40')]);var _0x3335f9={'where':_0x428f9c['where']};return db[_0xad9b('0x2c')][_0xad9b('0x41')](_0x3335f9)[_0xad9b('0x26')](function(_0xade6a1){_0x3163f4[_0xad9b('0x41')]=_0xade6a1;if(_0x3a0916[_0xad9b('0x32')][_0xad9b('0x42')]){_0x428f9c['include']=[{'all':!![]}];}return db[_0xad9b('0x2c')][_0xad9b('0x43')](_0x428f9c);})[_0xad9b('0x26')](function(_0x5e1e50){_0x3163f4[_0xad9b('0x44')]=_0x5e1e50;return _0x3163f4;})[_0xad9b('0x26')](respondWithFilteredResult(_0x4a2a1a,_0x428f9c))[_0xad9b('0x45')](handleError(_0x4a2a1a,null));};exports[_0xad9b('0x46')]=function(_0x113172,_0x818fb8){var _0x692fb3={'raw':!![],'where':{'id':_0x113172['params']['id']}},_0x4cf14c={};_0x4cf14c['model']=_[_0xad9b('0x47')](db[_0xad9b('0x2c')][_0xad9b('0x2d')]);_0x4cf14c['query']=_[_0xad9b('0x47')](_0x113172[_0xad9b('0x32')]);_0x4cf14c[_0xad9b('0x3c')]=_[_0xad9b('0x33')](_0x4cf14c['model'],_0x4cf14c[_0xad9b('0x32')]);_0x692fb3[_0xad9b('0x35')]=_[_0xad9b('0x33')](_0x4cf14c[_0xad9b('0x31')],qs['fields'](_0x113172[_0xad9b('0x32')][_0xad9b('0x34')]));_0x692fb3['attributes']=_0x692fb3[_0xad9b('0x35')]['length']?_0x692fb3['attributes']:_0x4cf14c[_0xad9b('0x31')];if(_0x113172[_0xad9b('0x32')][_0xad9b('0x42')]){_0x692fb3[_0xad9b('0x48')]=[{'all':!![]}];}_0x692fb3=_[_0xad9b('0x3e')]({},_0x692fb3,_0x113172[_0xad9b('0x40')]);return db[_0xad9b('0x2c')][_0xad9b('0x49')](_0x692fb3)[_0xad9b('0x26')](handleEntityNotFound(_0x818fb8,null))['then'](respondWithResult(_0x818fb8,null))['catch'](handleError(_0x818fb8,null));};exports['create']=function(_0x1a0763,_0x23d763){return db['AnalyticTreeReport']['create'](_0x1a0763[_0xad9b('0x4a')],{})['then'](respondWithResult(_0x23d763,0xc9))[_0xad9b('0x45')](handleError(_0x23d763,null));};exports[_0xad9b('0x25')]=function(_0x124a61,_0x43f8ab){if(_0x124a61[_0xad9b('0x4a')]['id']){delete _0x124a61[_0xad9b('0x4a')]['id'];}return db[_0xad9b('0x2c')]['find']({'where':{'id':_0x124a61[_0xad9b('0x4b')]['id']}})[_0xad9b('0x26')](handleEntityNotFound(_0x43f8ab,null))[_0xad9b('0x26')](saveUpdates(_0x124a61[_0xad9b('0x4a')],null))[_0xad9b('0x26')](respondWithResult(_0x43f8ab,null))[_0xad9b('0x45')](handleError(_0x43f8ab,null));};exports[_0xad9b('0x4c')]=function(_0x5ab9ef,_0x1ea818){return db[_0xad9b('0x2c')][_0xad9b('0x49')]({'where':{'id':_0x5ab9ef[_0xad9b('0x4b')]['id']}})[_0xad9b('0x26')](handleEntityNotFound(_0x1ea818,null))['then'](removeEntity(_0x1ea818,null))[_0xad9b('0x45')](handleError(_0x1ea818,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1ee3ed1..7ed3b2f 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 _0x7e2c=['AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','define'];(function(_0x165266,_0xf49880){var _0xf962ca=function(_0x1a5143){while(--_0x1a5143){_0x165266['push'](_0x165266['shift']());}};_0xf962ca(++_0xf49880);}(_0x7e2c,0x1e2));var _0xc7e2=function(_0x26d1a3,_0xdcf5ad){_0x26d1a3=_0x26d1a3-0x0;var _0x1f4f50=_0x7e2c[_0x26d1a3];return _0x1f4f50;};'use strict';var _=require(_0xc7e2('0x0'));var util=require('util');var logger=require(_0xc7e2('0x1'))(_0xc7e2('0x2'));var moment=require(_0xc7e2('0x3'));var BPromise=require(_0xc7e2('0x4'));var rp=require(_0xc7e2('0x5'));var fs=require('fs');var path=require(_0xc7e2('0x6'));var rimraf=require('rimraf');var config=require(_0xc7e2('0x7'));var attributes=require(_0xc7e2('0x8'));module['exports']=function(_0x51ead9,_0x3491f3){return _0x51ead9[_0xc7e2('0x9')](_0xc7e2('0xa'),attributes,{'tableName':_0xc7e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3e5=['api','moment','path','../../config/environment','exports','define'];(function(_0x1e450c,_0xb3cec0){var _0x50c788=function(_0x170fe6){while(--_0x170fe6){_0x1e450c['push'](_0x1e450c['shift']());}};_0x50c788(++_0xb3cec0);}(_0xf3e5,0x1a4));var _0x5f3e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xf3e5[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5f3e('0x0'));var moment=require(_0x5f3e('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f3e('0x2'));var rimraf=require('rimraf');var config=require(_0x5f3e('0x3'));var attributes=require('./analyticTreeReport.attributes');module[_0x5f3e('0x4')]=function(_0x132bd2,_0x5b10e0){return _0x132bd2[_0x5f3e('0x5')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','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 1da1059..2ae9654 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 _0x418b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x166640,_0x5e5d97){var _0x5ddf67=function(_0x4c89c9){while(--_0x4c89c9){_0x166640['push'](_0x166640['shift']());}};_0x5ddf67(++_0x5e5d97);}(_0x418b,0xe0));var _0xb418=function(_0x111c76,_0x3c3df7){_0x111c76=_0x111c76-0x0;var _0x59a18d=_0x418b[_0x111c76];return _0x59a18d;};'use strict';var _=require(_0xb418('0x0'));var util=require(_0xb418('0x1'));var moment=require(_0xb418('0x2'));var BPromise=require(_0xb418('0x3'));var rs=require(_0xb418('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb418('0x5'));var logger=require(_0xb418('0x6'))(_0xb418('0x7'));var config=require(_0xb418('0x8'));var jayson=require(_0xb418('0x9'));var client=jayson[_0xb418('0xa')][_0xb418('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c2379,_0x446c33,_0x5dd64d){return new BPromise(function(_0x206f17,_0x5ddf61){return client[_0xb418('0xc')](_0x3c2379,_0x5dd64d)['then'](function(_0x1e2339){logger['info'](_0xb418('0xd'),_0x446c33,_0xb418('0xe'));logger['debug'](_0xb418('0xf'),_0x446c33,'request\x20sent',JSON[_0xb418('0x10')](_0x1e2339));if(_0x1e2339[_0xb418('0x11')]){if(_0x1e2339[_0xb418('0x11')][_0xb418('0x12')]===0x1f4){logger[_0xb418('0x11')](_0xb418('0xd'),_0x446c33,_0x1e2339[_0xb418('0x11')][_0xb418('0x13')]);return _0x5ddf61(_0x1e2339[_0xb418('0x11')][_0xb418('0x13')]);}logger[_0xb418('0x11')](_0xb418('0xd'),_0x446c33,_0x1e2339[_0xb418('0x11')]['message']);return _0x206f17(_0x1e2339['error']['message']);}else{logger[_0xb418('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x446c33,_0xb418('0xe'));_0x206f17(_0x1e2339[_0xb418('0x15')]['message']);}})[_0xb418('0x16')](function(_0x295192){logger[_0xb418('0x11')](_0xb418('0xd'),_0x446c33,_0x295192);_0x5ddf61(_0x295192);});});} \ No newline at end of file +var _0x4766=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x6c9e12,_0x48328c){var _0x40d1fc=function(_0xb4820f){while(--_0xb4820f){_0x6c9e12['push'](_0x6c9e12['shift']());}};_0x40d1fc(++_0x48328c);}(_0x4766,0xde));var _0x6476=function(_0x5c868,_0xf42eea){_0x5c868=_0x5c868-0x0;var _0xa591e9=_0x4766[_0x5c868];return _0xa591e9;};'use strict';var _=require('lodash');var util=require(_0x6476('0x0'));var moment=require(_0x6476('0x1'));var BPromise=require(_0x6476('0x2'));var rs=require(_0x6476('0x3'));var fs=require('fs');var Redis=require(_0x6476('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6476('0x5'));var logger=require(_0x6476('0x6'))('rpc');var config=require(_0x6476('0x7'));var jayson=require(_0x6476('0x8'));var client=jayson['client'][_0x6476('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x125182,_0x226e31,_0xdc1916){return new BPromise(function(_0x2ad31c,_0xdac681){return client[_0x6476('0xa')](_0x125182,_0xdc1916)['then'](function(_0x5214ce){logger[_0x6476('0xb')](_0x6476('0xc'),_0x226e31,_0x6476('0xd'));logger[_0x6476('0xe')](_0x6476('0xf'),_0x226e31,'request\x20sent',JSON[_0x6476('0x10')](_0x5214ce));if(_0x5214ce[_0x6476('0x11')]){if(_0x5214ce['error'][_0x6476('0x12')]===0x1f4){logger[_0x6476('0x11')](_0x6476('0xc'),_0x226e31,_0x5214ce[_0x6476('0x11')]['message']);return _0xdac681(_0x5214ce['error']['message']);}logger[_0x6476('0x11')](_0x6476('0xc'),_0x226e31,_0x5214ce[_0x6476('0x11')][_0x6476('0x13')]);return _0x2ad31c(_0x5214ce['error'][_0x6476('0x13')]);}else{logger[_0x6476('0xb')](_0x6476('0xc'),_0x226e31,_0x6476('0xd'));_0x2ad31c(_0x5214ce[_0x6476('0x14')][_0x6476('0x13')]);}})[_0x6476('0x15')](function(_0x2d69a1){logger[_0x6476('0x11')](_0x6476('0xc'),_0x226e31,_0x2d69a1);_0xdac681(_0x2d69a1);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 000f61f..4f60016 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 _0x0617=['create','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post'];(function(_0x1ee3e0,_0x275a58){var _0x5ac3f3=function(_0x541001){while(--_0x541001){_0x1ee3e0['push'](_0x1ee3e0['shift']());}};_0x5ac3f3(++_0x275a58);}(_0x0617,0x1ea));var _0x7061=function(_0x2f20b5,_0x211bfb){_0x2f20b5=_0x2f20b5-0x0;var _0xf0b337=_0x0617[_0x2f20b5];return _0xf0b337;};'use strict';var multer=require(_0x7061('0x0'));var util=require(_0x7061('0x1'));var path=require(_0x7061('0x2'));var timeout=require('connect-timeout');var express=require(_0x7061('0x3'));var router=express[_0x7061('0x4')]();var auth=require(_0x7061('0x5'));var interaction=require(_0x7061('0x6'));var config=require(_0x7061('0x7'));var controller=require(_0x7061('0x8'));router[_0x7061('0x9')]('/',auth[_0x7061('0xa')](),controller['index']);router[_0x7061('0x9')](_0x7061('0xb'),auth[_0x7061('0xa')](),controller[_0x7061('0xc')]);router[_0x7061('0xd')]('/',auth['isAuthenticated'](),controller[_0x7061('0xe')]);router[_0x7061('0xf')](_0x7061('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7061('0x10')]('/:id',auth[_0x7061('0xa')](),controller[_0x7061('0x11')]);module['exports']=router; \ No newline at end of file +var _0x42d3=['update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0xf47a36,_0x4b834f){var _0x31ba2b=function(_0x4be052){while(--_0x4be052){_0xf47a36['push'](_0xf47a36['shift']());}};_0x31ba2b(++_0x4b834f);}(_0x42d3,0x19b));var _0x342d=function(_0x10a978,_0x111939){_0x10a978=_0x10a978-0x0;var _0x47b2d6=_0x42d3[_0x10a978];return _0x47b2d6;};'use strict';var multer=require(_0x342d('0x0'));var util=require(_0x342d('0x1'));var path=require(_0x342d('0x2'));var timeout=require('connect-timeout');var express=require(_0x342d('0x3'));var router=express[_0x342d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x342d('0x5'));var config=require('../../config/environment');var controller=require(_0x342d('0x6'));router[_0x342d('0x7')]('/',auth['isAuthenticated'](),controller[_0x342d('0x8')]);router[_0x342d('0x7')](_0x342d('0x9'),auth[_0x342d('0xa')](),controller[_0x342d('0xb')]);router[_0x342d('0xc')]('/',auth[_0x342d('0xa')](),controller['create']);router[_0x342d('0xd')](_0x342d('0x9'),auth[_0x342d('0xa')](),controller[_0x342d('0xe')]);router[_0x342d('0xf')](_0x342d('0x9'),auth[_0x342d('0xa')](),controller[_0x342d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0a128c2..37f3510 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 _0x40d2=['exports','STRING','sequelize'];(function(_0xe31a8,_0x562de4){var _0x4a139c=function(_0x443815){while(--_0x443815){_0xe31a8['push'](_0xe31a8['shift']());}};_0x4a139c(++_0x562de4);}(_0x40d2,0x1e2));var _0x240d=function(_0x4f46f6,_0x54e2ad){_0x4f46f6=_0x4f46f6-0x0;var _0x4f6337=_0x40d2[_0x4f46f6];return _0x4f6337;};'use strict';var Sequelize=require(_0x240d('0x0'));module[_0x240d('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x240d('0x2')]},'type':{'type':Sequelize[_0x240d('0x2')]}}; \ No newline at end of file +var _0xc65b=['sequelize','exports','STRING'];(function(_0x312f81,_0x17916a){var _0x33605b=function(_0x477e22){while(--_0x477e22){_0x312f81['push'](_0x312f81['shift']());}};_0x33605b(++_0x17916a);}(_0xc65b,0x75));var _0xbc65=function(_0x576d5b,_0x1b8b7b){_0x576d5b=_0x576d5b-0x0;var _0x5b1f5e=_0xc65b[_0x576d5b];return _0x5b1f5e;};'use strict';var Sequelize=require(_0xbc65('0x0'));module[_0xbc65('0x1')]={'name':{'type':Sequelize[_0xbc65('0x2')]},'basename':{'type':Sequelize[_0xbc65('0x2')]},'type':{'type':Sequelize[_0xbc65('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 379891c..fa8536b 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 _0x4f3f=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','reject','save','update','destroy','then','end','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','omit','createdAt','body','updatedAt','create','file','filename','download','findOne','join','root','server/files/attachments/','basename','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x53c82f,_0xba415a){var _0x5d1000=function(_0x3ed2cb){while(--_0x3ed2cb){_0x53c82f['push'](_0x53c82f['shift']());}};_0x5d1000(++_0xba415a);}(_0x4f3f,0x14e));var _0xf4f3=function(_0x2362be,_0x43cef1){_0x2362be=_0x2362be-0x0;var _0x42f965=_0x4f3f[_0x2362be];return _0x42f965;};'use strict';var pdf=require(_0xf4f3('0x0'));var emlformat=require(_0xf4f3('0x1'));var rimraf=require(_0xf4f3('0x2'));var zipdir=require(_0xf4f3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4f3('0x4'));var moment=require(_0xf4f3('0x5'));var BPromise=require(_0xf4f3('0x6'));var Mustache=require(_0xf4f3('0x7'));var util=require(_0xf4f3('0x8'));var path=require(_0xf4f3('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf4f3('0xa'));var fs=require('fs');var _=require(_0xf4f3('0xb'));var squel=require(_0xf4f3('0xc'));var crypto=require(_0xf4f3('0xd'));var jsforce=require(_0xf4f3('0xe'));var deskjs=require(_0xf4f3('0xf'));var toCsv=require(_0xf4f3('0x10'));var querystring=require(_0xf4f3('0x11'));var Papa=require(_0xf4f3('0x12'));var Redis=require('ioredis');var authService=require(_0xf4f3('0x13'));var qs=require(_0xf4f3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4f3('0x15'));var logger=require(_0xf4f3('0x16'))(_0xf4f3('0x17'));var utils=require(_0xf4f3('0x18'));var config=require('../../config/environment');var db=require(_0xf4f3('0x19'))['db'];function respondWithStatusCode(_0x1e23a6,_0x22558b){_0x22558b=_0x22558b||0xcc;return function(_0x52d097){if(_0x52d097){return _0x1e23a6[_0xf4f3('0x1a')](_0x22558b);}return _0x1e23a6[_0xf4f3('0x1b')](_0x22558b)['end']();};}function respondWithResult(_0x302c2e,_0x183812){_0x183812=_0x183812||0xc8;return function(_0xb3fd93){if(_0xb3fd93){return _0x302c2e[_0xf4f3('0x1b')](_0x183812)[_0xf4f3('0x1c')](_0xb3fd93);}};}function respondWithFilteredResult(_0x4aa1ef,_0x40ec57){return function(_0x4538eb){if(_0x4538eb){var _0x55f5b3=_0x4538eb['count'],_0x4468de=_0x40ec57[_0xf4f3('0x1d')],_0x3a0974=_0x40ec57['offset']+_0x40ec57[_0xf4f3('0x1e')],_0x1f91f0;if(_0x3a0974>=_0x55f5b3){_0x3a0974=_0x55f5b3;_0x1f91f0=0xc8;}else{_0x1f91f0=0xce;}_0x4aa1ef[_0xf4f3('0x1b')](_0x1f91f0);return _0x4aa1ef[_0xf4f3('0x1f')]('Content-Range',_0x4468de+'-'+_0x3a0974+'/'+_0x55f5b3)[_0xf4f3('0x1c')](_0x4538eb);}return null;};}function patchUpdates(_0xd0cf33){return function(_0x42b36f){try{jsonpatch['apply'](_0x42b36f,_0xd0cf33,!![]);}catch(_0x456e08){return BPromise[_0xf4f3('0x20')](_0x456e08);}return _0x42b36f[_0xf4f3('0x21')]();};}function saveUpdates(_0x5cc3cd,_0x12810a){return function(_0x27d036){if(_0x27d036){return _0x27d036[_0xf4f3('0x22')](_0x5cc3cd)['then'](function(_0x4c6b70){return _0x4c6b70;});}return null;};}function removeEntity(_0x41e39a,_0x2b0639){return function(_0x32a6d5){if(_0x32a6d5){return _0x32a6d5[_0xf4f3('0x23')]()[_0xf4f3('0x24')](function(){_0x41e39a[_0xf4f3('0x1b')](0xcc)[_0xf4f3('0x25')]();});}};}function handleEntityNotFound(_0x2a3efd,_0x331b67){return function(_0x18d8e4){if(!_0x18d8e4){_0x2a3efd[_0xf4f3('0x1a')](0x194);}return _0x18d8e4;};}function handleError(_0x112b4d,_0xd5f4ca){_0xd5f4ca=_0xd5f4ca||0x1f4;return function(_0x5781db){logger[_0xf4f3('0x26')](_0x5781db[_0xf4f3('0x27')]);if(_0x5781db[_0xf4f3('0x28')]){delete _0x5781db['name'];}_0x112b4d[_0xf4f3('0x1b')](_0xd5f4ca)[_0xf4f3('0x29')](_0x5781db);};}exports[_0xf4f3('0x2a')]=function(_0x145e2a,_0x4dd28f){var _0x3433f9={},_0x4ec710={},_0x3fa4c8={'count':0x0,'rows':[]};var _0x1dab34=_['map'](db[_0xf4f3('0x2b')][_0xf4f3('0x2c')],function(_0x2b0763){return{'name':_0x2b0763[_0xf4f3('0x2d')],'type':_0x2b0763[_0xf4f3('0x2e')][_0xf4f3('0x2f')]};});_0x4ec710[_0xf4f3('0x30')]=_[_0xf4f3('0x31')](_0x1dab34,'name');_0x4ec710[_0xf4f3('0x32')]=_[_0xf4f3('0x33')](_0x145e2a[_0xf4f3('0x32')]);_0x4ec710[_0xf4f3('0x34')]=_[_0xf4f3('0x35')](_0x4ec710[_0xf4f3('0x30')],_0x4ec710[_0xf4f3('0x32')]);_0x3433f9[_0xf4f3('0x36')]=_[_0xf4f3('0x35')](_0x4ec710[_0xf4f3('0x30')],qs[_0xf4f3('0x37')](_0x145e2a[_0xf4f3('0x32')][_0xf4f3('0x37')]));_0x3433f9['attributes']=_0x3433f9[_0xf4f3('0x36')][_0xf4f3('0x38')]?_0x3433f9['attributes']:_0x4ec710['model'];if(!_0x145e2a['query'][_0xf4f3('0x39')](_0xf4f3('0x3a'))){_0x3433f9[_0xf4f3('0x1e')]=qs[_0xf4f3('0x1e')](_0x145e2a['query'][_0xf4f3('0x1e')]);_0x3433f9[_0xf4f3('0x1d')]=qs[_0xf4f3('0x1d')](_0x145e2a[_0xf4f3('0x32')]['offset']);}_0x3433f9[_0xf4f3('0x3b')]=qs[_0xf4f3('0x3c')](_0x145e2a[_0xf4f3('0x32')][_0xf4f3('0x3c')]);_0x3433f9[_0xf4f3('0x3d')]=qs['filters'](_[_0xf4f3('0x3e')](_0x145e2a[_0xf4f3('0x32')],_0x4ec710[_0xf4f3('0x34')]),_0x1dab34);if(_0x145e2a[_0xf4f3('0x32')][_0xf4f3('0x3f')]){_0x3433f9[_0xf4f3('0x3d')]=_[_0xf4f3('0x40')](_0x3433f9[_0xf4f3('0x3d')],{'$or':_[_0xf4f3('0x31')](_0x1dab34,function(_0x3d6541){if(_0x3d6541[_0xf4f3('0x2e')]!=='VIRTUAL'){var _0x50d9d9={};_0x50d9d9[_0x3d6541[_0xf4f3('0x28')]]={'$like':'%'+_0x145e2a[_0xf4f3('0x32')][_0xf4f3('0x3f')]+'%'};return _0x50d9d9;}})});}_0x3433f9=_[_0xf4f3('0x40')]({},_0x3433f9,_0x145e2a[_0xf4f3('0x41')]);var _0xd6efa3={'where':_0x3433f9[_0xf4f3('0x3d')]};return db['Attachment']['count'](_0xd6efa3)[_0xf4f3('0x24')](function(_0x5df860){_0x3fa4c8[_0xf4f3('0x42')]=_0x5df860;if(_0x145e2a[_0xf4f3('0x32')][_0xf4f3('0x43')]){_0x3433f9[_0xf4f3('0x44')]=[{'all':!![]}];}return db[_0xf4f3('0x2b')][_0xf4f3('0x45')](_0x3433f9);})[_0xf4f3('0x24')](function(_0xb92905){_0x3fa4c8[_0xf4f3('0x46')]=_0xb92905;return _0x3fa4c8;})[_0xf4f3('0x24')](respondWithFilteredResult(_0x4dd28f,_0x3433f9))[_0xf4f3('0x47')](handleError(_0x4dd28f,null));};exports[_0xf4f3('0x48')]=function(_0x14074a,_0x1460af){var _0x1bd72c={'raw':!![],'where':{'id':_0x14074a[_0xf4f3('0x49')]['id']}},_0x4c248d={};_0x4c248d[_0xf4f3('0x30')]=_[_0xf4f3('0x33')](db[_0xf4f3('0x2b')][_0xf4f3('0x2c')]);_0x4c248d['query']=_[_0xf4f3('0x33')](_0x14074a[_0xf4f3('0x32')]);_0x4c248d[_0xf4f3('0x34')]=_[_0xf4f3('0x35')](_0x4c248d['model'],_0x4c248d[_0xf4f3('0x32')]);_0x1bd72c[_0xf4f3('0x36')]=_[_0xf4f3('0x35')](_0x4c248d[_0xf4f3('0x30')],qs['fields'](_0x14074a[_0xf4f3('0x32')][_0xf4f3('0x37')]));_0x1bd72c[_0xf4f3('0x36')]=_0x1bd72c[_0xf4f3('0x36')][_0xf4f3('0x38')]?_0x1bd72c['attributes']:_0x4c248d[_0xf4f3('0x30')];if(_0x14074a[_0xf4f3('0x32')][_0xf4f3('0x43')]){_0x1bd72c[_0xf4f3('0x44')]=[{'all':!![]}];}_0x1bd72c=_[_0xf4f3('0x40')]({},_0x1bd72c,_0x14074a['options']);return db[_0xf4f3('0x2b')][_0xf4f3('0x4a')](_0x1bd72c)['then'](handleEntityNotFound(_0x1460af,null))['then'](respondWithResult(_0x1460af,null))['catch'](handleError(_0x1460af,null));};exports['clone']=function(_0x5c1ab2,_0x492dd1){var _0x39642f={'where':{'id':_0x5c1ab2[_0xf4f3('0x49')]['id']}},_0x3d7145={};_0x3d7145[_0xf4f3('0x30')]=_['keys'](db[_0xf4f3('0x2b')][_0xf4f3('0x2c')]);_0x39642f[_0xf4f3('0x36')]=_['intersection'](_0x3d7145[_0xf4f3('0x30')],qs[_0xf4f3('0x37')](_0x5c1ab2['query'][_0xf4f3('0x37')]));_0x39642f[_0xf4f3('0x36')]=_0x39642f[_0xf4f3('0x36')]['length']?_0x39642f[_0xf4f3('0x36')]:_0x3d7145[_0xf4f3('0x30')];if(_0x5c1ab2['query'][_0xf4f3('0x43')]){_0x39642f[_0xf4f3('0x44')]=[{'all':!![]}];}_0x39642f=_['merge']({},_0x39642f,_0x5c1ab2['options']);return db[_0xf4f3('0x2b')][_0xf4f3('0x4a')](_0x39642f)[_0xf4f3('0x24')](handleEntityNotFound(_0x492dd1,null))['then'](function(_0x2018b6){if(_0x2018b6){var _0x1fb996=_0x2018b6['get']({'plain':!![]});_0x1fb996=qs[_0xf4f3('0x4b')](_0x1fb996,['id',_0xf4f3('0x4c'),'updatedAt']);_0x5c1ab2[_0xf4f3('0x4d')]=_[_0xf4f3('0x4b')](_0x5c1ab2[_0xf4f3('0x4d')],['id',_0xf4f3('0x4c'),_0xf4f3('0x4e')]);return db['Attachment'][_0xf4f3('0x4f')](_['merge'](_0x1fb996,_0x5c1ab2[_0xf4f3('0x4d')]),{'include':_0x5c1ab2[_0xf4f3('0x32')][_0xf4f3('0x43')]?[{'all':!![]}]:undefined});}})[_0xf4f3('0x24')](respondWithResult(_0x492dd1,0xc9))[_0xf4f3('0x47')](handleError(_0x492dd1,null));};exports[_0xf4f3('0x22')]=function(_0x526d44,_0x5f43ba){if(_0x526d44[_0xf4f3('0x4d')]['id']){delete _0x526d44['body']['id'];}return db[_0xf4f3('0x2b')][_0xf4f3('0x4a')]({'where':{'id':_0x526d44[_0xf4f3('0x49')]['id']}})[_0xf4f3('0x24')](handleEntityNotFound(_0x5f43ba,null))[_0xf4f3('0x24')](saveUpdates(_0x526d44[_0xf4f3('0x4d')],null))[_0xf4f3('0x24')](respondWithResult(_0x5f43ba,null))[_0xf4f3('0x47')](handleError(_0x5f43ba,null));};exports['destroy']=function(_0x3e54ce,_0x374ffd){return db[_0xf4f3('0x2b')][_0xf4f3('0x4a')]({'where':{'id':_0x3e54ce[_0xf4f3('0x49')]['id']}})[_0xf4f3('0x24')](handleEntityNotFound(_0x374ffd,null))[_0xf4f3('0x24')](removeEntity(_0x374ffd,null))['catch'](handleError(_0x374ffd,null));};exports[_0xf4f3('0x4f')]=function(_0x20bb92,_0x4de55b,_0x16098a){_0x20bb92[_0xf4f3('0x4d')]['name']=_0x20bb92[_0xf4f3('0x50')]['originalname'];_0x20bb92[_0xf4f3('0x4d')]['basename']=_0x20bb92[_0xf4f3('0x50')][_0xf4f3('0x51')];_0x20bb92[_0xf4f3('0x4d')][_0xf4f3('0x2e')]=_0x20bb92[_0xf4f3('0x50')]['mimetype'];return db[_0xf4f3('0x2b')][_0xf4f3('0x4f')](_0x20bb92[_0xf4f3('0x4d')])[_0xf4f3('0x24')](respondWithResult(_0x4de55b,0xc9))[_0xf4f3('0x47')](handleError(_0x4de55b,null));};exports[_0xf4f3('0x52')]=function(_0x33e97c,_0x1eadd4,_0x2c34d8){return db[_0xf4f3('0x2b')][_0xf4f3('0x53')]({'where':{'id':_0x33e97c[_0xf4f3('0x49')]['id']},'raw':!![]})[_0xf4f3('0x24')](handleEntityNotFound(_0x1eadd4,null))[_0xf4f3('0x24')](function(_0x3fbd48){if(_0x3fbd48){return _0x1eadd4[_0xf4f3('0x52')](path[_0xf4f3('0x54')](config[_0xf4f3('0x55')],_0xf4f3('0x56'),_0x3fbd48[_0xf4f3('0x57')]));}})['catch'](handleError(_0x1eadd4,null));}; \ No newline at end of file +var _0x7793=['sort','where','pick','filter','VIRTUAL','merge','options','Attachment','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','clone','get','createdAt','updatedAt','body','omit','create','update','destroy','file','originalname','basename','filename','download','join','root','server/files/attachments/','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','apply','save','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order'];(function(_0x517650,_0x26b209){var _0x3bfb7e=function(_0xc11b3d){while(--_0xc11b3d){_0x517650['push'](_0x517650['shift']());}};_0x3bfb7e(++_0x26b209);}(_0x7793,0x79));var _0x3779=function(_0x1cb9c3,_0x115c23){_0x1cb9c3=_0x1cb9c3-0x0;var _0x730f4=_0x7793[_0x1cb9c3];return _0x730f4;};'use strict';var pdf=require(_0x3779('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3779('0x1'));var jsonpatch=require(_0x3779('0x2'));var rp=require('request-promise');var moment=require(_0x3779('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3779('0x4'));var util=require(_0x3779('0x5'));var path=require(_0x3779('0x6'));var sox=require(_0x3779('0x7'));var csv=require('to-csv');var ejs=require(_0x3779('0x8'));var fs=require('fs');var _=require(_0x3779('0x9'));var squel=require(_0x3779('0xa'));var crypto=require(_0x3779('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3779('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3779('0xd'));var Papa=require(_0x3779('0xe'));var Redis=require('ioredis');var authService=require(_0x3779('0xf'));var qs=require(_0x3779('0x10'));var as=require(_0x3779('0x11'));var hardwareService=require(_0x3779('0x12'));var logger=require(_0x3779('0x13'))('api');var utils=require(_0x3779('0x14'));var config=require('../../config/environment');var db=require(_0x3779('0x15'))['db'];function respondWithStatusCode(_0x287b0a,_0x5d824f){_0x5d824f=_0x5d824f||0xcc;return function(_0x895966){if(_0x895966){return _0x287b0a['sendStatus'](_0x5d824f);}return _0x287b0a[_0x3779('0x16')](_0x5d824f)[_0x3779('0x17')]();};}function respondWithResult(_0x14e4ed,_0x5d4bcc){_0x5d4bcc=_0x5d4bcc||0xc8;return function(_0x4cc7aa){if(_0x4cc7aa){return _0x14e4ed[_0x3779('0x16')](_0x5d4bcc)[_0x3779('0x18')](_0x4cc7aa);}};}function respondWithFilteredResult(_0x375c8d,_0x362c33){return function(_0x1ee1c7){if(_0x1ee1c7){var _0x35fa5f=_0x1ee1c7[_0x3779('0x19')],_0x52491e=_0x362c33[_0x3779('0x1a')],_0x265995=_0x362c33[_0x3779('0x1a')]+_0x362c33['limit'],_0x1ff7d5;if(_0x265995>=_0x35fa5f){_0x265995=_0x35fa5f;_0x1ff7d5=0xc8;}else{_0x1ff7d5=0xce;}_0x375c8d[_0x3779('0x16')](_0x1ff7d5);return _0x375c8d['set']('Content-Range',_0x52491e+'-'+_0x265995+'/'+_0x35fa5f)['json'](_0x1ee1c7);}return null;};}function patchUpdates(_0x54e14a){return function(_0xa402c1){try{jsonpatch[_0x3779('0x1b')](_0xa402c1,_0x54e14a,!![]);}catch(_0x26786b){return BPromise['reject'](_0x26786b);}return _0xa402c1[_0x3779('0x1c')]();};}function saveUpdates(_0x188fff,_0x2ffe61){return function(_0x2871ea){if(_0x2871ea){return _0x2871ea['update'](_0x188fff)['then'](function(_0x4aed28){return _0x4aed28;});}return null;};}function removeEntity(_0x5575b0,_0x2d9761){return function(_0xbd96bf){if(_0xbd96bf){return _0xbd96bf['destroy']()[_0x3779('0x1d')](function(){_0x5575b0[_0x3779('0x16')](0xcc)[_0x3779('0x17')]();});}};}function handleEntityNotFound(_0x11ba23,_0xb1413c){return function(_0x31028a){if(!_0x31028a){_0x11ba23[_0x3779('0x1e')](0x194);}return _0x31028a;};}function handleError(_0x4ef5e9,_0x126a47){_0x126a47=_0x126a47||0x1f4;return function(_0x445c2a){logger[_0x3779('0x1f')](_0x445c2a[_0x3779('0x20')]);if(_0x445c2a[_0x3779('0x21')]){delete _0x445c2a['name'];}_0x4ef5e9['status'](_0x126a47)[_0x3779('0x22')](_0x445c2a);};}exports[_0x3779('0x23')]=function(_0x1dd463,_0x39680d){var _0x42459f={},_0x564b23={},_0x9a1b10={'count':0x0,'rows':[]};var _0x479698=_[_0x3779('0x24')](db['Attachment']['rawAttributes'],function(_0x474f2f){return{'name':_0x474f2f[_0x3779('0x25')],'type':_0x474f2f[_0x3779('0x26')][_0x3779('0x27')]};});_0x564b23[_0x3779('0x28')]=_[_0x3779('0x24')](_0x479698,_0x3779('0x21'));_0x564b23[_0x3779('0x29')]=_[_0x3779('0x2a')](_0x1dd463[_0x3779('0x29')]);_0x564b23[_0x3779('0x2b')]=_[_0x3779('0x2c')](_0x564b23['model'],_0x564b23[_0x3779('0x29')]);_0x42459f[_0x3779('0x2d')]=_[_0x3779('0x2c')](_0x564b23[_0x3779('0x28')],qs[_0x3779('0x2e')](_0x1dd463[_0x3779('0x29')]['fields']));_0x42459f[_0x3779('0x2d')]=_0x42459f[_0x3779('0x2d')]['length']?_0x42459f['attributes']:_0x564b23[_0x3779('0x28')];if(!_0x1dd463[_0x3779('0x29')][_0x3779('0x2f')](_0x3779('0x30'))){_0x42459f[_0x3779('0x31')]=qs[_0x3779('0x31')](_0x1dd463[_0x3779('0x29')][_0x3779('0x31')]);_0x42459f[_0x3779('0x1a')]=qs[_0x3779('0x1a')](_0x1dd463[_0x3779('0x29')]['offset']);}_0x42459f[_0x3779('0x32')]=qs[_0x3779('0x33')](_0x1dd463['query'][_0x3779('0x33')]);_0x42459f[_0x3779('0x34')]=qs[_0x3779('0x2b')](_[_0x3779('0x35')](_0x1dd463[_0x3779('0x29')],_0x564b23[_0x3779('0x2b')]),_0x479698);if(_0x1dd463['query'][_0x3779('0x36')]){_0x42459f[_0x3779('0x34')]=_['merge'](_0x42459f[_0x3779('0x34')],{'$or':_['map'](_0x479698,function(_0x3e65b9){if(_0x3e65b9['type']!==_0x3779('0x37')){var _0x1b138f={};_0x1b138f[_0x3e65b9[_0x3779('0x21')]]={'$like':'%'+_0x1dd463['query'][_0x3779('0x36')]+'%'};return _0x1b138f;}})});}_0x42459f=_[_0x3779('0x38')]({},_0x42459f,_0x1dd463[_0x3779('0x39')]);var _0x5ac4f0={'where':_0x42459f[_0x3779('0x34')]};return db[_0x3779('0x3a')][_0x3779('0x19')](_0x5ac4f0)[_0x3779('0x1d')](function(_0x4d895e){_0x9a1b10[_0x3779('0x19')]=_0x4d895e;if(_0x1dd463[_0x3779('0x29')][_0x3779('0x3b')]){_0x42459f[_0x3779('0x3c')]=[{'all':!![]}];}return db[_0x3779('0x3a')][_0x3779('0x3d')](_0x42459f);})['then'](function(_0x521361){_0x9a1b10[_0x3779('0x3e')]=_0x521361;return _0x9a1b10;})[_0x3779('0x1d')](respondWithFilteredResult(_0x39680d,_0x42459f))[_0x3779('0x3f')](handleError(_0x39680d,null));};exports[_0x3779('0x40')]=function(_0x9cfdd6,_0x3fd242){var _0x199d1c={'raw':!![],'where':{'id':_0x9cfdd6[_0x3779('0x41')]['id']}},_0x46f74c={};_0x46f74c[_0x3779('0x28')]=_[_0x3779('0x2a')](db['Attachment'][_0x3779('0x42')]);_0x46f74c[_0x3779('0x29')]=_[_0x3779('0x2a')](_0x9cfdd6[_0x3779('0x29')]);_0x46f74c[_0x3779('0x2b')]=_[_0x3779('0x2c')](_0x46f74c['model'],_0x46f74c[_0x3779('0x29')]);_0x199d1c[_0x3779('0x2d')]=_[_0x3779('0x2c')](_0x46f74c[_0x3779('0x28')],qs[_0x3779('0x2e')](_0x9cfdd6[_0x3779('0x29')]['fields']));_0x199d1c[_0x3779('0x2d')]=_0x199d1c[_0x3779('0x2d')][_0x3779('0x43')]?_0x199d1c['attributes']:_0x46f74c['model'];if(_0x9cfdd6[_0x3779('0x29')][_0x3779('0x3b')]){_0x199d1c['include']=[{'all':!![]}];}_0x199d1c=_[_0x3779('0x38')]({},_0x199d1c,_0x9cfdd6[_0x3779('0x39')]);return db['Attachment'][_0x3779('0x44')](_0x199d1c)[_0x3779('0x1d')](handleEntityNotFound(_0x3fd242,null))[_0x3779('0x1d')](respondWithResult(_0x3fd242,null))[_0x3779('0x3f')](handleError(_0x3fd242,null));};exports[_0x3779('0x45')]=function(_0x43e15b,_0x476825){var _0x44620d={'where':{'id':_0x43e15b[_0x3779('0x41')]['id']}},_0x50cc33={};_0x50cc33['model']=_[_0x3779('0x2a')](db[_0x3779('0x3a')]['rawAttributes']);_0x44620d[_0x3779('0x2d')]=_['intersection'](_0x50cc33['model'],qs[_0x3779('0x2e')](_0x43e15b[_0x3779('0x29')][_0x3779('0x2e')]));_0x44620d[_0x3779('0x2d')]=_0x44620d[_0x3779('0x2d')][_0x3779('0x43')]?_0x44620d[_0x3779('0x2d')]:_0x50cc33[_0x3779('0x28')];if(_0x43e15b[_0x3779('0x29')][_0x3779('0x3b')]){_0x44620d[_0x3779('0x3c')]=[{'all':!![]}];}_0x44620d=_['merge']({},_0x44620d,_0x43e15b['options']);return db[_0x3779('0x3a')][_0x3779('0x44')](_0x44620d)[_0x3779('0x1d')](handleEntityNotFound(_0x476825,null))[_0x3779('0x1d')](function(_0x72e91f){if(_0x72e91f){var _0x50ad06=_0x72e91f[_0x3779('0x46')]({'plain':!![]});_0x50ad06=qs['omit'](_0x50ad06,['id',_0x3779('0x47'),_0x3779('0x48')]);_0x43e15b[_0x3779('0x49')]=_[_0x3779('0x4a')](_0x43e15b[_0x3779('0x49')],['id','createdAt','updatedAt']);return db[_0x3779('0x3a')][_0x3779('0x4b')](_[_0x3779('0x38')](_0x50ad06,_0x43e15b[_0x3779('0x49')]),{'include':_0x43e15b[_0x3779('0x29')][_0x3779('0x3b')]?[{'all':!![]}]:undefined});}})[_0x3779('0x1d')](respondWithResult(_0x476825,0xc9))[_0x3779('0x3f')](handleError(_0x476825,null));};exports[_0x3779('0x4c')]=function(_0x3dfaf9,_0xc55695){if(_0x3dfaf9[_0x3779('0x49')]['id']){delete _0x3dfaf9[_0x3779('0x49')]['id'];}return db['Attachment'][_0x3779('0x44')]({'where':{'id':_0x3dfaf9[_0x3779('0x41')]['id']}})[_0x3779('0x1d')](handleEntityNotFound(_0xc55695,null))[_0x3779('0x1d')](saveUpdates(_0x3dfaf9['body'],null))[_0x3779('0x1d')](respondWithResult(_0xc55695,null))[_0x3779('0x3f')](handleError(_0xc55695,null));};exports[_0x3779('0x4d')]=function(_0x2999a8,_0x5dbd37){return db[_0x3779('0x3a')][_0x3779('0x44')]({'where':{'id':_0x2999a8['params']['id']}})[_0x3779('0x1d')](handleEntityNotFound(_0x5dbd37,null))[_0x3779('0x1d')](removeEntity(_0x5dbd37,null))[_0x3779('0x3f')](handleError(_0x5dbd37,null));};exports['create']=function(_0x472cf1,_0x297811,_0x44b0de){_0x472cf1['body']['name']=_0x472cf1[_0x3779('0x4e')][_0x3779('0x4f')];_0x472cf1[_0x3779('0x49')][_0x3779('0x50')]=_0x472cf1[_0x3779('0x4e')][_0x3779('0x51')];_0x472cf1[_0x3779('0x49')][_0x3779('0x26')]=_0x472cf1[_0x3779('0x4e')]['mimetype'];return db[_0x3779('0x3a')]['create'](_0x472cf1[_0x3779('0x49')])[_0x3779('0x1d')](respondWithResult(_0x297811,0xc9))[_0x3779('0x3f')](handleError(_0x297811,null));};exports[_0x3779('0x52')]=function(_0xd169bc,_0x3a5b81,_0x5e4254){return db[_0x3779('0x3a')]['findOne']({'where':{'id':_0xd169bc['params']['id']},'raw':!![]})[_0x3779('0x1d')](handleEntityNotFound(_0x3a5b81,null))['then'](function(_0x2882ad){if(_0x2882ad){return _0x3a5b81['download'](path[_0x3779('0x53')](config[_0x3779('0x54')],_0x3779('0x55'),_0x2882ad[_0x3779('0x50')]));}})[_0x3779('0x3f')](handleError(_0x3a5b81,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0a12cbf..b40b186 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 _0xb332=['define','lodash','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x320525,_0x45ebc4){var _0x2ffe17=function(_0x2f13fd){while(--_0x2f13fd){_0x320525['push'](_0x320525['shift']());}};_0x2ffe17(++_0x45ebc4);}(_0xb332,0xd9));var _0x2b33=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0xb332[_0x242a98];return _0x580999;};'use strict';var _=require(_0x2b33('0x0'));var util=require('util');var logger=require(_0x2b33('0x1'))(_0x2b33('0x2'));var moment=require('moment');var BPromise=require(_0x2b33('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b33('0x4'));var rimraf=require('rimraf');var config=require(_0x2b33('0x5'));var attributes=require('./attachment.attributes');module[_0x2b33('0x6')]=function(_0x22d66,_0x478214){return _0x22d66[_0x2b33('0x7')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['path','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4b821e,_0x1c2030){var _0x5ea1e6=function(_0x310979){while(--_0x310979){_0x4b821e['push'](_0x4b821e['shift']());}};_0x5ea1e6(++_0x1c2030);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xf3cd[_0x18a436];return _0x5c2cf8;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./attachment.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index f8a0e6d..70774c7 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 _0x6336=['body','options','CreateAttachment','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','code','error','message','Attachment,\x20%s,\x20%s','result','catch','Attachment','create'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x6336,0x6b));var _0x6633=function(_0x3bf5fb,_0x4a9c01){_0x3bf5fb=_0x3bf5fb-0x0;var _0x17c440=_0x6336[_0x3bf5fb];return _0x17c440;};'use strict';var _=require('lodash');var util=require(_0x6633('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6633('0x1'));var db=require(_0x6633('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6633('0x3'))(_0x6633('0x4'));var config=require(_0x6633('0x5'));var jayson=require(_0x6633('0x6'));var client=jayson[_0x6633('0x7')][_0x6633('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x81c981,_0xf7abf1,_0x39e6ad){return new BPromise(function(_0x38f18a,_0x22b484){return client[_0x6633('0x9')](_0x81c981,_0x39e6ad)[_0x6633('0xa')](function(_0x5e5a28){logger[_0x6633('0xb')]('Attachment,\x20%s,\x20%s',_0xf7abf1,_0x6633('0xc'));logger[_0x6633('0xd')]('Attachment,\x20%s,\x20%s,\x20%s',_0xf7abf1,_0x6633('0xc'),JSON[_0x6633('0xe')](_0x5e5a28));if(_0x5e5a28['error']){if(_0x5e5a28['error'][_0x6633('0xf')]===0x1f4){logger[_0x6633('0x10')]('Attachment,\x20%s,\x20%s',_0xf7abf1,_0x5e5a28['error'][_0x6633('0x11')]);return _0x22b484(_0x5e5a28[_0x6633('0x10')][_0x6633('0x11')]);}logger[_0x6633('0x10')](_0x6633('0x12'),_0xf7abf1,_0x5e5a28[_0x6633('0x10')][_0x6633('0x11')]);return _0x38f18a(_0x5e5a28[_0x6633('0x10')][_0x6633('0x11')]);}else{logger[_0x6633('0xb')]('Attachment,\x20%s,\x20%s',_0xf7abf1,_0x6633('0xc'));_0x38f18a(_0x5e5a28[_0x6633('0x13')][_0x6633('0x11')]);}})[_0x6633('0x14')](function(_0x393894){logger[_0x6633('0x10')](_0x6633('0x12'),_0xf7abf1,_0x393894);_0x22b484(_0x393894);});});}exports['CreateAttachment']=function(_0x686c3c){var _0x1954b9=this;return new Promise(function(_0x46a8ff,_0x28679b){return db[_0x6633('0x15')][_0x6633('0x16')](_0x686c3c[_0x6633('0x17')],{'raw':_0x686c3c[_0x6633('0x18')]?_0x686c3c[_0x6633('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6633('0xa')](function(_0x222a93){logger[_0x6633('0xb')](_0x6633('0x19'),_0x686c3c);logger[_0x6633('0xd')](_0x6633('0x19'),_0x686c3c,JSON[_0x6633('0xe')](_0x222a93));_0x46a8ff(_0x222a93);})[_0x6633('0x14')](function(_0x3fdfb2){logger[_0x6633('0x10')](_0x6633('0x19'),_0x3fdfb2[_0x6633('0x11')],_0x686c3c);_0x28679b(_0x1954b9[_0x6633('0x10')](0x1f4,_0x3fdfb2['message']));});});}; \ No newline at end of file +var _0x7115=['then','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateAttachment','create','options','raw','debug','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x466f94,_0x15377d){var _0x188fb3=function(_0x24e14b){while(--_0x24e14b){_0x466f94['push'](_0x466f94['shift']());}};_0x188fb3(++_0x15377d);}(_0x7115,0x16e));var _0x5711=function(_0x1f7df8,_0x260902){_0x1f7df8=_0x1f7df8-0x0;var _0x51f986=_0x7115[_0x1f7df8];return _0x51f986;};'use strict';var _=require(_0x5711('0x0'));var util=require(_0x5711('0x1'));var moment=require('moment');var BPromise=require(_0x5711('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5711('0x3'))['db'];var utils=require(_0x5711('0x4'));var logger=require(_0x5711('0x5'))(_0x5711('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5711('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1419c7,_0x349fc2,_0x5dbe46){return new BPromise(function(_0x6305af,_0x59c602){return client[_0x5711('0x8')](_0x1419c7,_0x5dbe46)[_0x5711('0x9')](function(_0x113ed6){logger['info'](_0x5711('0xa'),_0x349fc2,_0x5711('0xb'));logger['debug'](_0x5711('0xc'),_0x349fc2,_0x5711('0xb'),JSON[_0x5711('0xd')](_0x113ed6));if(_0x113ed6[_0x5711('0xe')]){if(_0x113ed6[_0x5711('0xe')][_0x5711('0xf')]===0x1f4){logger[_0x5711('0xe')](_0x5711('0xa'),_0x349fc2,_0x113ed6[_0x5711('0xe')][_0x5711('0x10')]);return _0x59c602(_0x113ed6[_0x5711('0xe')][_0x5711('0x10')]);}logger[_0x5711('0xe')]('Attachment,\x20%s,\x20%s',_0x349fc2,_0x113ed6[_0x5711('0xe')]['message']);return _0x6305af(_0x113ed6[_0x5711('0xe')]['message']);}else{logger[_0x5711('0x11')](_0x5711('0xa'),_0x349fc2,'request\x20sent');_0x6305af(_0x113ed6[_0x5711('0x12')][_0x5711('0x10')]);}})['catch'](function(_0x250c1b){logger[_0x5711('0xe')](_0x5711('0xa'),_0x349fc2,_0x250c1b);_0x59c602(_0x250c1b);});});}exports[_0x5711('0x13')]=function(_0x1f6134){var _0x350773=this;return new Promise(function(_0x450e4f,_0x1f8181){return db['Attachment'][_0x5711('0x14')](_0x1f6134['body'],{'raw':_0x1f6134['options']?_0x1f6134[_0x5711('0x15')][_0x5711('0x16')]===undefined?!![]:![]:!![]})[_0x5711('0x9')](function(_0x5d35fa){logger[_0x5711('0x11')](_0x5711('0x13'),_0x1f6134);logger[_0x5711('0x17')](_0x5711('0x13'),_0x1f6134,JSON[_0x5711('0xd')](_0x5d35fa));_0x450e4f(_0x5d35fa);})[_0x5711('0x18')](function(_0x246856){logger['error'](_0x5711('0x13'),_0x246856[_0x5711('0x10')],_0x1f6134);_0x1f8181(_0x350773[_0x5711('0xe')](0x1f4,_0x246856[_0x5711('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 63f5481..3c20ba2 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 _0xfef9=['/:id/clone','clone','join','root','server/files/attachments/','format','%s-%s','originalname','replace','single','file','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','post'];(function(_0x518ff9,_0x3c3648){var _0x470dc5=function(_0x569a21){while(--_0x569a21){_0x518ff9['push'](_0x518ff9['shift']());}};_0x470dc5(++_0x3c3648);}(_0xfef9,0xd3));var _0x9fef=function(_0xf20b6,_0x49ddbb){_0xf20b6=_0xf20b6-0x0;var _0x4ff567=_0xfef9[_0xf20b6];return _0x4ff567;};'use strict';var multer=require(_0x9fef('0x0'));var util=require(_0x9fef('0x1'));var path=require('path');var timeout=require(_0x9fef('0x2'));var express=require(_0x9fef('0x3'));var router=express['Router']();var auth=require(_0x9fef('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9fef('0x5'));var controller=require('./attachment.controller');router[_0x9fef('0x6')]('/',auth[_0x9fef('0x7')](),controller['index']);router[_0x9fef('0x6')](_0x9fef('0x8'),auth['isAuthenticated'](),controller[_0x9fef('0x9')]);router[_0x9fef('0x6')](_0x9fef('0xa'),auth['isAuthenticated'](),controller[_0x9fef('0xb')]);router[_0x9fef('0xc')](_0x9fef('0xd'),auth['isAuthenticated'](),controller[_0x9fef('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c7241,_0x34442f,_0x2ff18e){_0x2ff18e(null,path[_0x9fef('0xf')](config[_0x9fef('0x10')],_0x9fef('0x11')));},'filename':function(_0xfd9eec,_0x5ba68a,_0x37640b){_0x37640b(null,util[_0x9fef('0x12')](_0x9fef('0x13'),Date['now'](),_0x5ba68a[_0x9fef('0x14')][_0x9fef('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9fef('0xc')]('/',upload[_0x9fef('0x16')](_0x9fef('0x17')),controller['create']);router[_0x9fef('0x18')]('/:id',auth[_0x9fef('0x7')](),controller['update']);router[_0x9fef('0x19')](_0x9fef('0x8'),auth[_0x9fef('0x7')](),controller[_0x9fef('0x1a')]);module[_0x9fef('0x1b')]=router; \ No newline at end of file +var _0x639a=['get','index','/:id','isAuthenticated','show','/:id/download','download','post','/:id/clone','clone','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./attachment.controller'];(function(_0x554651,_0x33b329){var _0x53fb5a=function(_0x1f8b0a){while(--_0x1f8b0a){_0x554651['push'](_0x554651['shift']());}};_0x53fb5a(++_0x33b329);}(_0x639a,0x1e8));var _0xa639=function(_0x39abd5,_0x170067){_0x39abd5=_0x39abd5-0x0;var _0x13cce2=_0x639a[_0x39abd5];return _0x13cce2;};'use strict';var multer=require(_0xa639('0x0'));var util=require(_0xa639('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa639('0x2'));var router=express[_0xa639('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa639('0x4'));var config=require(_0xa639('0x5'));var controller=require(_0xa639('0x6'));router[_0xa639('0x7')]('/',auth['isAuthenticated'](),controller[_0xa639('0x8')]);router['get'](_0xa639('0x9'),auth[_0xa639('0xa')](),controller[_0xa639('0xb')]);router[_0xa639('0x7')](_0xa639('0xc'),auth['isAuthenticated'](),controller[_0xa639('0xd')]);router[_0xa639('0xe')](_0xa639('0xf'),auth['isAuthenticated'](),controller[_0xa639('0x10')]);var upload=multer({'storage':multer[_0xa639('0x11')]({'destination':function(_0x5a96fb,_0x34a5b1,_0x45b789){_0x45b789(null,path['join'](config[_0xa639('0x12')],_0xa639('0x13')));},'filename':function(_0x51e76a,_0x450aa7,_0x1a666e){_0x1a666e(null,util[_0xa639('0x14')](_0xa639('0x15'),Date[_0xa639('0x16')](),_0x450aa7[_0xa639('0x17')][_0xa639('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0xa639('0x19')](_0xa639('0x1a')),controller[_0xa639('0x1b')]);router[_0xa639('0x1c')](_0xa639('0x9'),auth[_0xa639('0xa')](),controller[_0xa639('0x1d')]);router[_0xa639('0x1e')](_0xa639('0x9'),auth['isAuthenticated'](),controller[_0xa639('0x1f')]);module[_0xa639('0x20')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 91b5bf8..5f978a4 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 _0x0552=['/login','email','callback','google','use','clientID','secret','callbackURL','findOne','allowedLoginAttempts','User','find','map','emails','value','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','clearBlockUser','getLicense','passport','passport-google-oauth20','Strategy','moment','../../config/environment','../../components/auth/service','signToken','login','authenticate'];(function(_0x2ade6d,_0x31ef72){var _0x46f8fb=function(_0x11dda7){while(--_0x11dda7){_0x2ade6d['push'](_0x2ade6d['shift']());}};_0x46f8fb(++_0x31ef72);}(_0x0552,0x1e1));var _0x2055=function(_0x20574c,_0x57b6c7){_0x20574c=_0x20574c-0x0;var _0x44e846=_0x0552[_0x20574c];return _0x44e846;};'use strict';var _=require('lodash');var passport=require(_0x2055('0x0'));var GoogleStrategy=require(_0x2055('0x1'))[_0x2055('0x2')];var moment=require(_0x2055('0x3'));var db=require('../../mysqldb')['db'];var config=require(_0x2055('0x4'));var signToken=require(_0x2055('0x5'))[_0x2055('0x6')];var utils=require('../../config/utils');exports[_0x2055('0x7')]=passport[_0x2055('0x8')]('google',{'failureRedirect':_0x2055('0x9'),'scope':['profile',_0x2055('0xa')],'session':![]});exports[_0x2055('0xb')]=passport[_0x2055('0x8')](_0x2055('0xc'),{'failureRedirect':'/login','session':![]});passport[_0x2055('0xd')](new GoogleStrategy({'clientID':config[_0x2055('0xc')]?config[_0x2055('0xc')][_0x2055('0xe')]:'id','clientSecret':config['google']?config['google']['clientSecret']:_0x2055('0xf'),'callbackURL':config[_0x2055('0xc')]?config[_0x2055('0xc')][_0x2055('0x10')]:''},function(_0x5516ec,_0x5af49a,_0x3ea228,_0x35f7a7){var _0x2c1b6e,_0x2fd555;return db['Setting'][_0x2055('0x11')]({'where':{'id':0x1},'attributes':[_0x2055('0x12'),'blockDuration'],'raw':!![]})['then'](function(_0x3364d0){_0x2c1b6e=_0x3364d0;return db[_0x2055('0x13')][_0x2055('0x14')]({'where':{'email':_[_0x2055('0x15')](_0x3ea228[_0x2055('0x16')],_0x2055('0x17')),'role':{'$or':['admin',_0x2055('0x18'),_0x2055('0x19')]}}});})[_0x2055('0x1a')](function(_0x102e31){_0x2fd555=_0x102e31;if(_0x2fd555){if(_0x2fd555[_0x2055('0x1b')]){return _0x35f7a7(_0x2055('0x1c'));}else if(_0x2c1b6e[_0x2055('0x1d')]>0x0){if(_0x2fd555[_0x2055('0x1e')]){if(moment(_0x2fd555[_0x2055('0x1f')])[_0x2055('0x20')](_0x2c1b6e[_0x2055('0x1d')],'minutes')>moment()){return _0x35f7a7(_0x2055('0x1c'));}else{return utils[_0x2055('0x21')](_0x2fd555,0x0,![],null)[_0x2055('0x1a')](function(){return utils[_0x2055('0x22')](_0x2fd555);})[_0x2055('0x1a')](function(){return _0x35f7a7(null,_0x2fd555);});}}else{return utils['getLicense'](_0x2fd555)['then'](function(){return _0x35f7a7(null,_0x2fd555);});}}else{return utils[_0x2055('0x22')](_0x2fd555)['then'](function(){return _0x35f7a7(null,_0x2fd555);});}}return _0x35f7a7(_0x2055('0x1c'));})['catch'](function(_0x1789e7){_0x35f7a7(_0x1789e7);});})); \ No newline at end of file +var _0x4b6c=['user','agent','disabled','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','login','authenticate','google','/login','profile','use','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','value','admin'];(function(_0x1eee9e,_0x176ffb){var _0x253622=function(_0xa2df16){while(--_0xa2df16){_0x1eee9e['push'](_0x1eee9e['shift']());}};_0x253622(++_0x176ffb);}(_0x4b6c,0x189));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4b6('0x0'));var passport=require(_0xc4b6('0x1'));var GoogleStrategy=require(_0xc4b6('0x2'))[_0xc4b6('0x3')];var moment=require(_0xc4b6('0x4'));var db=require(_0xc4b6('0x5'))['db'];var config=require('../../config/environment');var signToken=require(_0xc4b6('0x6'))['signToken'];var utils=require('../../config/utils');exports[_0xc4b6('0x7')]=passport[_0xc4b6('0x8')](_0xc4b6('0x9'),{'failureRedirect':_0xc4b6('0xa'),'scope':[_0xc4b6('0xb'),'email'],'session':![]});exports['callback']=passport[_0xc4b6('0x8')](_0xc4b6('0x9'),{'failureRedirect':'/login','session':![]});passport[_0xc4b6('0xc')](new GoogleStrategy({'clientID':config[_0xc4b6('0x9')]?config[_0xc4b6('0x9')]['clientID']:'id','clientSecret':config['google']?config[_0xc4b6('0x9')][_0xc4b6('0xd')]:'secret','callbackURL':config[_0xc4b6('0x9')]?config[_0xc4b6('0x9')][_0xc4b6('0xe')]:''},function(_0x4a1766,_0x20ad1b,_0x17ff1f,_0x35357a){var _0x2c9b3c,_0x3f8695;return db[_0xc4b6('0xf')][_0xc4b6('0x10')]({'where':{'id':0x1},'attributes':[_0xc4b6('0x11'),_0xc4b6('0x12')],'raw':!![]})[_0xc4b6('0x13')](function(_0x19e7e4){_0x2c9b3c=_0x19e7e4;return db[_0xc4b6('0x14')]['find']({'where':{'email':_['map'](_0x17ff1f['emails'],_0xc4b6('0x15')),'role':{'$or':[_0xc4b6('0x16'),_0xc4b6('0x17'),_0xc4b6('0x18')]}}});})['then'](function(_0x319c0c){_0x3f8695=_0x319c0c;if(_0x3f8695){if(_0x3f8695[_0xc4b6('0x19')]){return _0x35357a('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x2c9b3c['blockDuration']>0x0){if(_0x3f8695['blocked']){if(moment(_0x3f8695[_0xc4b6('0x1a')])[_0xc4b6('0x1b')](_0x2c9b3c['blockDuration'],_0xc4b6('0x1c'))>moment()){return _0x35357a(_0xc4b6('0x1d'));}else{return utils[_0xc4b6('0x1e')](_0x3f8695,0x0,![],null)[_0xc4b6('0x13')](function(){return utils[_0xc4b6('0x1f')](_0x3f8695);})['then'](function(){return _0x35357a(null,_0x3f8695);});}}else{return utils['getLicense'](_0x3f8695)[_0xc4b6('0x13')](function(){return _0x35357a(null,_0x3f8695);});}}else{return utils['getLicense'](_0x3f8695)[_0xc4b6('0x13')](function(){return _0x35357a(null,_0x3f8695);});}}return _0x35357a(_0xc4b6('0x1d'));})['catch'](function(_0xd7915f){_0x35357a(_0xd7915f);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index d0fd791..81e571c 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 _0x6e77=['../user/user.controller.js','../../components/auth/service','login','get','/callback','setTokenCookie','exports','passport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e77,0xef));var _0x76e7=function(_0x489ba5,_0xa1a03c){_0x489ba5=_0x489ba5-0x0;var _0x3727e9=_0x6e77[_0x489ba5];return _0x3727e9;};'use strict';var express=require('express');var passport=require(_0x76e7('0x0'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x76e7('0x1'));var authService=require(_0x76e7('0x2'));router['get']('/',controller[_0x76e7('0x3')]);router[_0x76e7('0x4')](_0x76e7('0x5'),controller['callback'],authService['isMiddleware'],userController[_0x76e7('0x3')],authService[_0x76e7('0x6')]);module[_0x76e7('0x7')]=router; \ No newline at end of file +var _0x8b2b=['Router','../user/user.controller.js','../../components/auth/service','get','login','/callback','setTokenCookie','exports','express','passport'];(function(_0x37437c,_0x55dacf){var _0x35e1a1=function(_0xdcb380){while(--_0xdcb380){_0x37437c['push'](_0x37437c['shift']());}};_0x35e1a1(++_0x55dacf);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x26cce8,_0x51d16c){_0x26cce8=_0x26cce8-0x0;var _0x3bad2d=_0x8b2b[_0x26cce8];return _0x3bad2d;};'use strict';var express=require(_0xb8b2('0x0'));var passport=require(_0xb8b2('0x1'));var router=express[_0xb8b2('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xb8b2('0x3'));var authService=require(_0xb8b2('0x4'));router[_0xb8b2('0x5')]('/',controller[_0xb8b2('0x6')]);router[_0xb8b2('0x5')](_0xb8b2('0x7'),controller['callback'],authService['isMiddleware'],userController[_0xb8b2('0x6')],authService[_0xb8b2('0x8')]);module[_0xb8b2('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 4e51715..3d265df 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 _0x674b=['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','local','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','securePassword','password','save','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../components/auth/service','client','http','Setting','findOne','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blockDuration','minutes','clearBlockUser','add','getLicense','catch','MailAccount','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','Smtp','host','port','secure','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message'];(function(_0x5cacb7,_0x15f641){var _0x8b049f=function(_0xdbec23){while(--_0xdbec23){_0x5cacb7['push'](_0x5cacb7['shift']());}};_0x8b049f(++_0x15f641);}(_0x674b,0xcd));var _0xb674=function(_0x246f92,_0xcf7bd4){_0x246f92=_0x246f92-0x0;var _0x2b8e7d=_0x674b[_0x246f92];return _0x2b8e7d;};'use strict';var util=require(_0xb674('0x0'));var passport=require(_0xb674('0x1'));var LocalStrategy=require(_0xb674('0x2'))[_0xb674('0x3')];var jayson=require(_0xb674('0x4'));var _=require(_0xb674('0x5'));var rs=require(_0xb674('0x6'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xb674('0x7'));var utils=require('../../config/utils');var client=jayson[_0xb674('0x8')][_0xb674('0x9')]({'port':0x232b});function localAuthenticate(_0x5e738c,_0x20a428,_0x18254b,_0x26f937){var _0x52c102,_0x3d86f3;return db[_0xb674('0xa')][_0xb674('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x4bccd6){_0x52c102=_0x4bccd6;return _0x5e738c[_0xb674('0xb')]({'attributes':['id',_0xb674('0xc'),'password',_0xb674('0xd'),_0xb674('0xe'),_0xb674('0xf'),_0xb674('0x10'),_0xb674('0x11'),_0xb674('0x12')],'where':{'name':_0x20a428,'role':{'$or':[_0xb674('0x13'),_0xb674('0x14'),_0xb674('0x15')]}}});})[_0xb674('0x16')](function(_0x31ed8f){if(!_0x31ed8f||_0x31ed8f&&_0x31ed8f[_0xb674('0xc')]!==_0x20a428){throw new Error(_0xb674('0x17'));}else{_0x3d86f3=_0x31ed8f;return _0x3d86f3;}})[_0xb674('0x16')](function(){_0x3d86f3[_0xb674('0x18')](_0x18254b,function(_0x118cdc,_0x10abce){var _0x3db67f=_0x3d86f3[_0xb674('0x12')]+0x1;if(_0x118cdc){return _0x26f937(_0x118cdc);}else if(!_0x10abce){if(_0x3d86f3[_0xb674('0xf')]){return _0x26f937(null,![],{'message':_0xb674('0x17')});}else if(_0x52c102[_0xb674('0x19')]>0x0){if(_0x3d86f3[_0xb674('0x10')]){if(_0x52c102[_0xb674('0x1a')]>0x0){if(moment(_0x3d86f3[_0xb674('0x11')])['add'](_0x52c102[_0xb674('0x1a')],_0xb674('0x1b'))>moment()){return _0x26f937(null,![],{'message':_0xb674('0x17')});}else{return utils[_0xb674('0x1c')](_0x3d86f3,_0x3db67f,![],null)['then'](function(){return _0x26f937(null,![],{'message':_0xb674('0x17')});});}}else{return _0x26f937(null,![],{'message':_0xb674('0x17')});}}else{if(_0x3db67f>=_0x52c102['allowedLoginAttempts']){return utils[_0xb674('0x1c')](_0x3d86f3,0x0,!![],moment())[_0xb674('0x16')](function(){return _0x26f937(null,![],{'message':_0xb674('0x17')});});}else{return utils[_0xb674('0x1c')](_0x3d86f3,_0x3db67f,![],null)[_0xb674('0x16')](function(){return _0x26f937(null,![],{'message':_0xb674('0x17')});});}}}else{return _0x26f937(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3d86f3[_0xb674('0xf')]){return _0x26f937(null,![],{'message':_0xb674('0x17')});}else if(_0x52c102[_0xb674('0x19')]>0x0){if(_0x3d86f3[_0xb674('0x10')]){if(_0x52c102[_0xb674('0x1a')]>0x0){if(moment(_0x3d86f3['blockedAt'])[_0xb674('0x1d')](_0x52c102[_0xb674('0x1a')],_0xb674('0x1b'))>moment()){return _0x26f937(null,![],{'message':_0xb674('0x17')});}else{return utils[_0xb674('0x1c')](_0x3d86f3,0x0,![],null)[_0xb674('0x16')](function(){return utils[_0xb674('0x1e')](_0x3d86f3);})['then'](function(){return _0x26f937(null,_0x3d86f3);});}}else{return _0x26f937(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xb674('0x1c')](_0x3d86f3,0x0,![],null)[_0xb674('0x16')](function(){return utils[_0xb674('0x1e')](_0x3d86f3);})[_0xb674('0x16')](function(){return _0x26f937(null,_0x3d86f3);})[_0xb674('0x1f')](function(_0x2cd63b){return _0x26f937(null,![],_0x2cd63b);});}}else{if(_0x3d86f3[_0xb674('0x10')]){return _0x26f937(null,![],{'message':_0xb674('0x17')});}else{return utils[_0xb674('0x1e')](_0x3d86f3)[_0xb674('0x16')](function(){return _0x26f937(null,_0x3d86f3);});}}}});})[_0xb674('0x1f')](function(_0x4752e8){return _0x26f937(null,![],_0x4752e8);});}function sendServiceMail(_0x44ae4b){return db[_0xb674('0x20')]['find']({'where':{'service':!![]},'attributes':['id',_0xb674('0xc'),_0xb674('0x21')],'include':[{'model':db[_0xb674('0x22')],'as':'Smtp'}]})['then'](function(_0x13ce60){if(!_0x13ce60){throw new Error(_0xb674('0x23'));}var _0x181d4d={'tls':{'rejectUnauthorized':![]}};if(_0x13ce60['Smtp'][_0xb674('0x24')]){_0x181d4d[_0xb674('0x24')]=_0x13ce60[_0xb674('0x25')][_0xb674('0x24')];}else{_0x181d4d[_0xb674('0x26')]=_0x13ce60[_0xb674('0x25')][_0xb674('0x26')];_0x181d4d[_0xb674('0x27')]=_0x13ce60[_0xb674('0x25')][_0xb674('0x27')];_0x181d4d[_0xb674('0x28')]=_0x13ce60[_0xb674('0x25')][_0xb674('0x28')];}if(_0x13ce60['Smtp']['authentication']){_0x181d4d['auth']={'user':_0x13ce60['Smtp'][_0xb674('0x14')],'pass':_0x13ce60[_0xb674('0x25')][_0xb674('0x29')]};}var _0x35779d={'account':_0x181d4d,'message':_[_0xb674('0x2a')]({'from':util['format'](_0xb674('0x2b'),_0x13ce60[_0xb674('0xc')],_0x13ce60[_0xb674('0x21')]||_0x13ce60[_0xb674('0x25')]['user'])},_0x44ae4b)};return client[_0xb674('0x2c')](_0xb674('0x2d'),_0x35779d);})['then'](function(_0x76eb95){if(_0x76eb95[_0xb674('0x2e')]){throw new Error(util[_0xb674('0x2f')](_0xb674('0x30'),_0x76eb95['error'][_0xb674('0x31')]||JSON[_0xb674('0x32')](_0x76eb95['error'])));}return!![];});}function handleError(_0x404265,_0x356568,_0x526449){return _0x404265[_0xb674('0x33')](_0x356568||0x1f4)[_0xb674('0x34')]({'message':_0x526449?_0x526449[_0xb674('0x31')]||_0x526449:''});}function checkPasswordPattern(_0x288487,_0x5c9721,_0x28c569){if(_0x28c569){var _0x22e67b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22e67b[_0xb674('0x35')](_0x5c9721)){return _0x288487;}else{throw new Error(_0xb674('0x36'));}}else{return _0x288487;}}exports[_0xb674('0x37')]=function(_0x319a01,_0xfedde8,_0x51abd8){passport[_0xb674('0x18')](_0xb674('0x38'),function(_0x11d696,_0x5af02b,_0x336495){var _0x57eec5=_0x11d696||_0x336495;if(_0x57eec5){return handleError(_0xfedde8,0x191,_0x57eec5);}if(!_0x5af02b){return handleError(_0xfedde8,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0xd8c0ce={'payload':{'id':_0x5af02b['id'],'role':_0x5af02b['role']},'options':{'expiresIn':0x15180}};return authService[_0xb674('0x39')](_0xd8c0ce)[_0xb674('0x16')](function(_0x325937){_0xfedde8[_0xb674('0x3a')]({'id':_0x5af02b['id'],'token':_0x325937,'statusCall':'','isAlreadyLogged':_0x5af02b[_0xb674('0x3b')]});});}})(_0x319a01,_0xfedde8,_0x51abd8);};exports[_0xb674('0x3c')]=function(_0x51e6fd,_0x56b251,_0x1c2128){if(!_0x51e6fd[_0xb674('0x3d')][_0xb674('0x21')]){return handleError(_0x56b251,0x1f4,{'message':_0xb674('0x3e')});}var _0x10302a=rs[_0xb674('0x3f')]();_0x51e6fd['body'][_0xb674('0x21')]=_0x51e6fd[_0xb674('0x3d')][_0xb674('0x21')][_0xb674('0x40')]()['toLowerCase']();var _0x2caefc;return db[_0xb674('0xa')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x120fcb){_0x2caefc=_0x120fcb;return db[_0xb674('0x41')][_0xb674('0x42')]({'where':{'email':_0x51e6fd[_0xb674('0x3d')][_0xb674('0x21')]}});})[_0xb674('0x16')](function(_0x4c5596){if(!_0x4c5596){throw new Error(_0xb674('0x43'));}if(_0x4c5596[_0xb674('0xf')]){throw new Error(_0xb674('0x44'));}if(_0x4c5596[_0xb674('0x10')]){if(moment(_0x4c5596['blockedAt'])[_0xb674('0x1d')](_0x2caefc[_0xb674('0x1a')],'minutes')>moment()){throw new Error(_0xb674('0x45'));}else{_0x4c5596[_0xb674('0x10')]=![];_0x4c5596[_0xb674('0x11')]=null;}}_0x4c5596[_0xb674('0x46')]=_0x10302a;_0x4c5596[_0xb674('0x47')]=Date[_0xb674('0x48')]()+0x36ee80;return _0x4c5596['save']();})[_0xb674('0x16')](function(){return sendServiceMail({'to':_0x51e6fd[_0xb674('0x3d')][_0xb674('0x21')],'subject':_0xb674('0x49'),'text':_0xb674('0x4a')+_0xb674('0x4b')+_0xb674('0x4c')+_0x51e6fd[_0xb674('0x4d')][_0xb674('0x26')]+_0xb674('0x4e')+_0x10302a+'\x0a\x0a'+_0xb674('0x4f')});})['then'](function(){_0x56b251[_0xb674('0x33')](0xc8)[_0xb674('0x34')]({'message':'Reset\x20Email\x20sent!'});})[_0xb674('0x1f')](function(_0x14b677){return handleError(_0x56b251,0x1f4,_0x14b677);});};exports[_0xb674('0x50')]=function(_0x440b79,_0x424615,_0x32d1dc){var _0x158be5;return db[_0xb674('0x41')]['find']({'where':{'resetPasswordToken':_0x440b79['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xb674('0x16')](function(_0x3aee8f){_0x158be5=_0x3aee8f;if(!_0x158be5){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xb674('0xa')]['findOne']({'attributes':['id',_0xb674('0x51')]});})[_0xb674('0x16')](function(_0x2ffacd){return checkPasswordPattern(_0x2ffacd,_0x440b79['body'][_0xb674('0x52')],_0x2ffacd[_0xb674('0x51')]);})[_0xb674('0x16')](function(){_0x158be5[_0xb674('0x52')]=_0x440b79[_0xb674('0x3d')][_0xb674('0x52')];_0x158be5['resetPasswordToken']=null;_0x158be5['resetPasswordExpires']=null;return _0x158be5[_0xb674('0x53')]();})[_0xb674('0x16')](function(){_0x424615[_0xb674('0x33')](0xc8)[_0xb674('0x34')]({'message':_0xb674('0x54')});})[_0xb674('0x1f')](function(_0x1f3b72){return handleError(_0x424615,0x1f4,_0x1f3b72);});};passport['use'](new LocalStrategy({'usernameField':_0xb674('0xc'),'passwordField':_0xb674('0x52')},function(_0x1b9a53,_0x2c255a,_0x1ea9b0){return localAuthenticate(db[_0xb674('0x41')],_0x1b9a53,_0x2c255a,_0x1ea9b0);})); \ No newline at end of file +var _0x065f=['http','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','catch','getLicense','MailAccount','find','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','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','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','Setting','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','resetPasswordToken','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client'];(function(_0x3c2d87,_0x623ad){var _0x142d3c=function(_0x3fa5a5){while(--_0x3fa5a5){_0x3c2d87['push'](_0x3c2d87['shift']());}};_0x142d3c(++_0x623ad);}(_0x065f,0x146));var _0xf065=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x065f[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0xf065('0x0'));var passport=require(_0xf065('0x1'));var LocalStrategy=require(_0xf065('0x2'))[_0xf065('0x3')];var jayson=require(_0xf065('0x4'));var _=require('lodash');var rs=require(_0xf065('0x5'));var moment=require(_0xf065('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xf065('0x7'));var utils=require(_0xf065('0x8'));var client=jayson[_0xf065('0x9')][_0xf065('0xa')]({'port':0x232b});function localAuthenticate(_0x38f17c,_0x3aaeab,_0x5b8d3a,_0x49443b){var _0x274e41,_0xf2817d;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xf065('0xb'),_0xf065('0xc')],'raw':!![]})[_0xf065('0xd')](function(_0x8902bd){_0x274e41=_0x8902bd;return _0x38f17c['findOne']({'attributes':['id','name',_0xf065('0xe'),_0xf065('0xf'),_0xf065('0x10'),_0xf065('0x11'),_0xf065('0x12'),_0xf065('0x13'),_0xf065('0x14')],'where':{'name':_0x3aaeab,'role':{'$or':[_0xf065('0x15'),_0xf065('0x16'),_0xf065('0x17')]}}});})[_0xf065('0xd')](function(_0x3af7a0){if(!_0x3af7a0||_0x3af7a0&&_0x3af7a0[_0xf065('0x18')]!==_0x3aaeab){throw new Error(_0xf065('0x19'));}else{_0xf2817d=_0x3af7a0;return _0xf2817d;}})[_0xf065('0xd')](function(){_0xf2817d['authenticate'](_0x5b8d3a,function(_0x7c6173,_0x1917f6){var _0x22eadf=_0xf2817d[_0xf065('0x14')]+0x1;if(_0x7c6173){return _0x49443b(_0x7c6173);}else if(!_0x1917f6){if(_0xf2817d['disabled']){return _0x49443b(null,![],{'message':_0xf065('0x19')});}else if(_0x274e41[_0xf065('0xb')]>0x0){if(_0xf2817d[_0xf065('0x12')]){if(_0x274e41[_0xf065('0xc')]>0x0){if(moment(_0xf2817d['blockedAt'])[_0xf065('0x1a')](_0x274e41[_0xf065('0xc')],_0xf065('0x1b'))>moment()){return _0x49443b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0xf2817d,_0x22eadf,![],null)[_0xf065('0xd')](function(){return _0x49443b(null,![],{'message':_0xf065('0x19')});});}}else{return _0x49443b(null,![],{'message':_0xf065('0x19')});}}else{if(_0x22eadf>=_0x274e41['allowedLoginAttempts']){return utils[_0xf065('0x1c')](_0xf2817d,0x0,!![],moment())[_0xf065('0xd')](function(){return _0x49443b(null,![],{'message':_0xf065('0x19')});});}else{return utils[_0xf065('0x1c')](_0xf2817d,_0x22eadf,![],null)['then'](function(){return _0x49443b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x49443b(null,![],{'message':_0xf065('0x19')});}}else{if(_0xf2817d[_0xf065('0x11')]){return _0x49443b(null,![],{'message':_0xf065('0x19')});}else if(_0x274e41[_0xf065('0xb')]>0x0){if(_0xf2817d['blocked']){if(_0x274e41['blockDuration']>0x0){if(moment(_0xf2817d['blockedAt'])[_0xf065('0x1a')](_0x274e41['blockDuration'],_0xf065('0x1b'))>moment()){return _0x49443b(null,![],{'message':_0xf065('0x19')});}else{return utils[_0xf065('0x1c')](_0xf2817d,0x0,![],null)['then'](function(){return utils['getLicense'](_0xf2817d);})[_0xf065('0xd')](function(){return _0x49443b(null,_0xf2817d);});}}else{return _0x49443b(null,![],{'message':_0xf065('0x19')});}}else{return utils['clearBlockUser'](_0xf2817d,0x0,![],null)[_0xf065('0xd')](function(){return utils['getLicense'](_0xf2817d);})[_0xf065('0xd')](function(){return _0x49443b(null,_0xf2817d);})[_0xf065('0x1d')](function(_0x318dc8){return _0x49443b(null,![],_0x318dc8);});}}else{if(_0xf2817d[_0xf065('0x12')]){return _0x49443b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf065('0x1e')](_0xf2817d)[_0xf065('0xd')](function(){return _0x49443b(null,_0xf2817d);});}}}});})[_0xf065('0x1d')](function(_0x1d27a0){return _0x49443b(null,![],_0x1d27a0);});}function sendServiceMail(_0x52905f){return db[_0xf065('0x1f')][_0xf065('0x20')]({'where':{'service':!![]},'attributes':['id',_0xf065('0x18'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xf065('0x21')}]})[_0xf065('0xd')](function(_0x485136){if(!_0x485136){throw new Error(_0xf065('0x22'));}var _0x5690bb={'tls':{'rejectUnauthorized':![]}};if(_0x485136[_0xf065('0x21')]['service']){_0x5690bb[_0xf065('0x23')]=_0x485136[_0xf065('0x21')]['service'];}else{_0x5690bb['host']=_0x485136['Smtp'][_0xf065('0x24')];_0x5690bb[_0xf065('0x25')]=_0x485136['Smtp'][_0xf065('0x25')];_0x5690bb[_0xf065('0x26')]=_0x485136['Smtp'][_0xf065('0x26')];}if(_0x485136['Smtp'][_0xf065('0x27')]){_0x5690bb[_0xf065('0x28')]={'user':_0x485136[_0xf065('0x21')][_0xf065('0x16')],'pass':_0x485136[_0xf065('0x21')][_0xf065('0x29')]};}var _0x2c06ad={'account':_0x5690bb,'message':_['merge']({'from':util[_0xf065('0x2a')](_0xf065('0x2b'),_0x485136[_0xf065('0x18')],_0x485136[_0xf065('0x2c')]||_0x485136[_0xf065('0x21')][_0xf065('0x16')])},_0x52905f)};return client[_0xf065('0x2d')](_0xf065('0x2e'),_0x2c06ad);})[_0xf065('0xd')](function(_0x106ea1){if(_0x106ea1[_0xf065('0x2f')]){throw new Error(util[_0xf065('0x2a')](_0xf065('0x30'),_0x106ea1['error'][_0xf065('0x31')]||JSON[_0xf065('0x32')](_0x106ea1[_0xf065('0x2f')])));}return!![];});}function handleError(_0x3b8a7a,_0x2d8957,_0x481514){return _0x3b8a7a['status'](_0x2d8957||0x1f4)[_0xf065('0x33')]({'message':_0x481514?_0x481514[_0xf065('0x31')]||_0x481514:''});}function checkPasswordPattern(_0x3a7860,_0x49d97d,_0x128c2e){if(_0x128c2e){var _0x49a2be=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49a2be[_0xf065('0x34')](_0x49d97d)){return _0x3a7860;}else{throw new Error(_0xf065('0x35'));}}else{return _0x3a7860;}}exports[_0xf065('0x36')]=function(_0x38adfd,_0x1bcdeb,_0x329dac){passport['authenticate'](_0xf065('0x37'),function(_0x39bbed,_0x39bf49,_0x22a83d){var _0x5ebf93=_0x39bbed||_0x22a83d;if(_0x5ebf93){return handleError(_0x1bcdeb,0x191,_0x5ebf93);}if(!_0x39bf49){return handleError(_0x1bcdeb,0x194,{'message':_0xf065('0x38')});}else{var _0x34ed35={'payload':{'id':_0x39bf49['id'],'role':_0x39bf49[_0xf065('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xf065('0x39')](_0x34ed35)[_0xf065('0xd')](function(_0x2d171b){_0x1bcdeb[_0xf065('0x3a')]({'id':_0x39bf49['id'],'token':_0x2d171b,'statusCall':'','isAlreadyLogged':_0x39bf49[_0xf065('0x3b')]});});}})(_0x38adfd,_0x1bcdeb,_0x329dac);};exports[_0xf065('0x3c')]=function(_0x185757,_0x3bf678,_0x173443){if(!_0x185757[_0xf065('0x3d')][_0xf065('0x2c')]){return handleError(_0x3bf678,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x12a0cc=rs[_0xf065('0x3e')]();_0x185757['body'][_0xf065('0x2c')]=_0x185757['body'][_0xf065('0x2c')][_0xf065('0x3f')]()[_0xf065('0x40')]();var _0xbcc508;return db[_0xf065('0x41')][_0xf065('0x42')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xf065('0xd')](function(_0x6d38b){_0xbcc508=_0x6d38b;return db[_0xf065('0x43')][_0xf065('0x20')]({'where':{'email':_0x185757[_0xf065('0x3d')][_0xf065('0x2c')]}});})[_0xf065('0xd')](function(_0x8a2f28){if(!_0x8a2f28){throw new Error(_0xf065('0x44'));}if(_0x8a2f28['disabled']){throw new Error(_0xf065('0x45'));}if(_0x8a2f28[_0xf065('0x12')]){if(moment(_0x8a2f28[_0xf065('0x13')])['add'](_0xbcc508[_0xf065('0xc')],_0xf065('0x1b'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x8a2f28[_0xf065('0x12')]=![];_0x8a2f28['blockedAt']=null;}}_0x8a2f28['resetPasswordToken']=_0x12a0cc;_0x8a2f28[_0xf065('0x46')]=Date[_0xf065('0x47')]()+0x36ee80;return _0x8a2f28[_0xf065('0x48')]();})[_0xf065('0xd')](function(){return sendServiceMail({'to':_0x185757['body'][_0xf065('0x2c')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xf065('0x49')+_0xf065('0x4a')+'http://'+_0x185757['headers'][_0xf065('0x24')]+_0xf065('0x4b')+_0x12a0cc+'\x0a\x0a'+_0xf065('0x4c')});})[_0xf065('0xd')](function(){_0x3bf678[_0xf065('0x4d')](0xc8)['send']({'message':_0xf065('0x4e')});})[_0xf065('0x1d')](function(_0x45539c){return handleError(_0x3bf678,0x1f4,_0x45539c);});};exports['reset']=function(_0x527c94,_0x28c9b1,_0x39ef14){var _0x230186;return db[_0xf065('0x43')][_0xf065('0x20')]({'where':{'resetPasswordToken':_0x527c94['params'][_0xf065('0x4f')],'resetPasswordExpires':{'$gt':Date[_0xf065('0x47')]()}}})[_0xf065('0xd')](function(_0x5d77b1){_0x230186=_0x5d77b1;if(!_0x230186){throw new Error(_0xf065('0x50'));}return db[_0xf065('0x41')]['findOne']({'attributes':['id',_0xf065('0x51')]});})['then'](function(_0x356586){return checkPasswordPattern(_0x356586,_0x527c94[_0xf065('0x3d')][_0xf065('0xe')],_0x356586[_0xf065('0x51')]);})[_0xf065('0xd')](function(){_0x230186[_0xf065('0xe')]=_0x527c94[_0xf065('0x3d')][_0xf065('0xe')];_0x230186[_0xf065('0x52')]=null;_0x230186['resetPasswordExpires']=null;return _0x230186[_0xf065('0x48')]();})[_0xf065('0xd')](function(){_0x28c9b1[_0xf065('0x4d')](0xc8)['send']({'message':'Password\x20reset!'});})[_0xf065('0x1d')](function(_0x2ff1b0){return handleError(_0x28c9b1,0x1f4,_0x2ff1b0);});};passport[_0xf065('0x53')](new LocalStrategy({'usernameField':_0xf065('0x18'),'passwordField':_0xf065('0xe')},function(_0x59a1b1,_0x795fcf,_0x244a95){return localAuthenticate(db[_0xf065('0x43')],_0x59a1b1,_0x795fcf,_0x244a95);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index cac14d9..4db3c87 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 _0x67ce=['express','Router','post','/forgot','forgot','reset','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x67ce,0x149));var _0xe67c=function(_0xe6c51b,_0x55e728){_0xe6c51b=_0xe6c51b-0x0;var _0x5d3bef=_0x67ce[_0xe6c51b];return _0x5d3bef;};'use strict';var express=require(_0xe67c('0x0'));var router=express[_0xe67c('0x1')]();var controller=require('./authLocal.controller');router[_0xe67c('0x2')]('/',controller['login']);router['post'](_0xe67c('0x3'),controller[_0xe67c('0x4')]);router[_0xe67c('0x2')]('/reset/:token',controller[_0xe67c('0x5')]);module[_0xe67c('0x6')]=router; \ No newline at end of file +var _0x04c0=['login','/forgot','forgot','/reset/:token','express','Router','./authLocal.controller','post'];(function(_0x27d11f,_0x2c59a8){var _0x36c1a5=function(_0x2334ae){while(--_0x2334ae){_0x27d11f['push'](_0x27d11f['shift']());}};_0x36c1a5(++_0x2c59a8);}(_0x04c0,0xbc));var _0x004c=function(_0x4fe41a,_0x42f5b3){_0x4fe41a=_0x4fe41a-0x0;var _0x39c5ec=_0x04c0[_0x4fe41a];return _0x39c5ec;};'use strict';var express=require(_0x004c('0x0'));var router=express[_0x004c('0x1')]();var controller=require(_0x004c('0x2'));router[_0x004c('0x3')]('/',controller[_0x004c('0x4')]);router['post'](_0x004c('0x5'),controller[_0x004c('0x6')]);router[_0x004c('0x3')](_0x004c('0x7'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 10102c4..efc4ec3 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 _0xd475=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd475,0x1e7));var _0x5d47=function(_0x2867bd,_0x42c92a){_0x2867bd=_0x2867bd-0x0;var _0x55668f=_0xd475[_0x2867bd];return _0x55668f;};'use strict';var Sequelize=require(_0x5d47('0x0'));module[_0x5d47('0x1')]={'name':{'type':Sequelize[_0x5d47('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x5d47('0x2')]},'description':{'type':Sequelize[_0x5d47('0x2')]},'status':{'type':Sequelize[_0x5d47('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5d47('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x506a=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x337da2,_0x39a5be){var _0xf6806c=function(_0x2f49fb){while(--_0x2f49fb){_0x337da2['push'](_0x337da2['shift']());}};_0xf6806c(++_0x39a5be);}(_0x506a,0x12c));var _0xa506=function(_0x2f0f2b,_0x3e2763){_0x2f0f2b=_0x2f0f2b-0x0;var _0x14cfb8=_0x506a[_0x2f0f2b];return _0x14cfb8;};'use strict';var Sequelize=require(_0xa506('0x0'));module[_0xa506('0x1')]={'name':{'type':Sequelize[_0xa506('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xa506('0x2')]},'description':{'type':Sequelize[_0xa506('0x2')]},'status':{'type':Sequelize[_0xa506('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa506('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 1ad775f..2e85e96 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 _0x502f=['body','params','Condition','addConditions','omit','ids','getConditions','findOne','addActions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Automation','includeAll','include','findAll','rows','rawAttributes','find','catch','create'];(function(_0x583fc6,_0x355254){var _0x580750=function(_0xe0cae9){while(--_0xe0cae9){_0x583fc6['push'](_0x583fc6['shift']());}};_0x580750(++_0x355254);}(_0x502f,0xf2));var _0xf502=function(_0x217f8c,_0x52c7ad){_0x217f8c=_0x217f8c-0x0;var _0xa826d2=_0x502f[_0x217f8c];return _0xa826d2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf502('0x0'));var zipdir=require(_0xf502('0x1'));var jsonpatch=require(_0xf502('0x2'));var rp=require(_0xf502('0x3'));var moment=require(_0xf502('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf502('0x5'));var util=require('util');var path=require(_0xf502('0x6'));var sox=require(_0xf502('0x7'));var csv=require(_0xf502('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf502('0x9'));var squel=require(_0xf502('0xa'));var crypto=require('crypto');var jsforce=require(_0xf502('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf502('0x8'));var querystring=require(_0xf502('0xc'));var Papa=require(_0xf502('0xd'));var Redis=require(_0xf502('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf502('0xf'));var logger=require(_0xf502('0x10'))(_0xf502('0x11'));var utils=require(_0xf502('0x12'));var config=require(_0xf502('0x13'));var db=require(_0xf502('0x14'))['db'];function respondWithStatusCode(_0x5c6683,_0x47ecc7){_0x47ecc7=_0x47ecc7||0xcc;return function(_0x317e16){if(_0x317e16){return _0x5c6683[_0xf502('0x15')](_0x47ecc7);}return _0x5c6683[_0xf502('0x16')](_0x47ecc7)[_0xf502('0x17')]();};}function respondWithResult(_0x2b14d5,_0x313780){_0x313780=_0x313780||0xc8;return function(_0x490141){if(_0x490141){return _0x2b14d5[_0xf502('0x16')](_0x313780)['json'](_0x490141);}};}function respondWithFilteredResult(_0xaddece,_0x23ed20){return function(_0x13ac75){if(_0x13ac75){var _0x3d0025=_0x13ac75[_0xf502('0x18')],_0x4cd99b=_0x23ed20[_0xf502('0x19')],_0x123891=_0x23ed20[_0xf502('0x19')]+_0x23ed20['limit'],_0xc726cf;if(_0x123891>=_0x3d0025){_0x123891=_0x3d0025;_0xc726cf=0xc8;}else{_0xc726cf=0xce;}_0xaddece[_0xf502('0x16')](_0xc726cf);return _0xaddece[_0xf502('0x1a')](_0xf502('0x1b'),_0x4cd99b+'-'+_0x123891+'/'+_0x3d0025)['json'](_0x13ac75);}return null;};}function patchUpdates(_0x718e92){return function(_0x1a3b23){try{jsonpatch['apply'](_0x1a3b23,_0x718e92,!![]);}catch(_0x1cd892){return BPromise[_0xf502('0x1c')](_0x1cd892);}return _0x1a3b23[_0xf502('0x1d')]();};}function saveUpdates(_0x4b8266,_0x2b7064){return function(_0x91d42f){if(_0x91d42f){return _0x91d42f['update'](_0x4b8266)[_0xf502('0x1e')](function(_0x33f291){return _0x33f291;});}return null;};}function removeEntity(_0x3d45bd,_0x27c34b){return function(_0x185d50){if(_0x185d50){return _0x185d50[_0xf502('0x1f')]()[_0xf502('0x1e')](function(){_0x3d45bd['status'](0xcc)[_0xf502('0x17')]();});}};}function handleEntityNotFound(_0x489888,_0x1c2a17){return function(_0x158897){if(!_0x158897){_0x489888[_0xf502('0x15')](0x194);}return _0x158897;};}function handleError(_0x51df0c,_0x3aa8c3){_0x3aa8c3=_0x3aa8c3||0x1f4;return function(_0x153a1d){logger[_0xf502('0x20')](_0x153a1d[_0xf502('0x21')]);if(_0x153a1d[_0xf502('0x22')]){delete _0x153a1d[_0xf502('0x22')];}_0x51df0c['status'](_0x3aa8c3)['send'](_0x153a1d);};}exports['index']=function(_0x216b8c,_0xf07538){var _0x46b579={},_0x3c97ff={},_0x2f3d1e={'count':0x0,'rows':[]};var _0xca229d=_[_0xf502('0x23')](db['Automation']['rawAttributes'],function(_0x191621){return{'name':_0x191621[_0xf502('0x24')],'type':_0x191621[_0xf502('0x25')][_0xf502('0x26')]};});_0x3c97ff[_0xf502('0x27')]=_[_0xf502('0x23')](_0xca229d,_0xf502('0x22'));_0x3c97ff[_0xf502('0x28')]=_[_0xf502('0x29')](_0x216b8c[_0xf502('0x28')]);_0x3c97ff['filters']=_[_0xf502('0x2a')](_0x3c97ff[_0xf502('0x27')],_0x3c97ff[_0xf502('0x28')]);_0x46b579['attributes']=_[_0xf502('0x2a')](_0x3c97ff[_0xf502('0x27')],qs[_0xf502('0x2b')](_0x216b8c[_0xf502('0x28')][_0xf502('0x2b')]));_0x46b579[_0xf502('0x2c')]=_0x46b579[_0xf502('0x2c')][_0xf502('0x2d')]?_0x46b579[_0xf502('0x2c')]:_0x3c97ff[_0xf502('0x27')];if(!_0x216b8c[_0xf502('0x28')][_0xf502('0x2e')](_0xf502('0x2f'))){_0x46b579['limit']=qs[_0xf502('0x30')](_0x216b8c[_0xf502('0x28')][_0xf502('0x30')]);_0x46b579[_0xf502('0x19')]=qs[_0xf502('0x19')](_0x216b8c[_0xf502('0x28')]['offset']);}_0x46b579['order']=qs[_0xf502('0x31')](_0x216b8c['query'][_0xf502('0x31')]);_0x46b579[_0xf502('0x32')]=qs[_0xf502('0x33')](_[_0xf502('0x34')](_0x216b8c['query'],_0x3c97ff['filters']),_0xca229d);if(_0x216b8c[_0xf502('0x28')][_0xf502('0x35')]){_0x46b579[_0xf502('0x32')]=_[_0xf502('0x36')](_0x46b579[_0xf502('0x32')],{'$or':_['map'](_0xca229d,function(_0x592b73){if(_0x592b73['type']!==_0xf502('0x37')){var _0x508a3f={};_0x508a3f[_0x592b73[_0xf502('0x22')]]={'$like':'%'+_0x216b8c[_0xf502('0x28')]['filter']+'%'};return _0x508a3f;}})});}_0x46b579=_['merge']({},_0x46b579,_0x216b8c[_0xf502('0x38')]);var _0x4f5138={'where':_0x46b579[_0xf502('0x32')]};return db[_0xf502('0x39')][_0xf502('0x18')](_0x4f5138)[_0xf502('0x1e')](function(_0x40bd55){_0x2f3d1e[_0xf502('0x18')]=_0x40bd55;if(_0x216b8c['query'][_0xf502('0x3a')]){_0x46b579[_0xf502('0x3b')]=[{'all':!![]}];}return db[_0xf502('0x39')][_0xf502('0x3c')](_0x46b579);})[_0xf502('0x1e')](function(_0x14a874){_0x2f3d1e[_0xf502('0x3d')]=_0x14a874;return _0x2f3d1e;})[_0xf502('0x1e')](respondWithFilteredResult(_0xf07538,_0x46b579))['catch'](handleError(_0xf07538,null));};exports['show']=function(_0x4c66ca,_0x2c5a36){var _0xd10940={'raw':![],'where':{'id':_0x4c66ca['params']['id']}},_0x42179b={};_0x42179b['model']=_['keys'](db['Automation'][_0xf502('0x3e')]);_0x42179b[_0xf502('0x28')]=_[_0xf502('0x29')](_0x4c66ca[_0xf502('0x28')]);_0x42179b[_0xf502('0x33')]=_['intersection'](_0x42179b[_0xf502('0x27')],_0x42179b[_0xf502('0x28')]);_0xd10940[_0xf502('0x2c')]=_[_0xf502('0x2a')](_0x42179b['model'],qs[_0xf502('0x2b')](_0x4c66ca[_0xf502('0x28')]['fields']));_0xd10940[_0xf502('0x2c')]=_0xd10940[_0xf502('0x2c')][_0xf502('0x2d')]?_0xd10940['attributes']:_0x42179b[_0xf502('0x27')];if(_0x4c66ca[_0xf502('0x28')][_0xf502('0x3a')]){_0xd10940[_0xf502('0x3b')]=[{'all':!![]}];}_0xd10940=_[_0xf502('0x36')]({},_0xd10940,_0x4c66ca[_0xf502('0x38')]);return db[_0xf502('0x39')][_0xf502('0x3f')](_0xd10940)[_0xf502('0x1e')](handleEntityNotFound(_0x2c5a36,null))['then'](respondWithResult(_0x2c5a36,null))[_0xf502('0x40')](handleError(_0x2c5a36,null));};exports[_0xf502('0x41')]=function(_0x513c60,_0x33d2db){return db['Automation'][_0xf502('0x41')](_0x513c60[_0xf502('0x42')],{})[_0xf502('0x1e')](respondWithResult(_0x33d2db,0xc9))[_0xf502('0x40')](handleError(_0x33d2db,null));};exports['update']=function(_0x5c0044,_0x2e0f10){if(_0x5c0044[_0xf502('0x42')]['id']){delete _0x5c0044['body']['id'];}return db[_0xf502('0x39')][_0xf502('0x3f')]({'where':{'id':_0x5c0044[_0xf502('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e0f10,null))[_0xf502('0x1e')](saveUpdates(_0x5c0044[_0xf502('0x42')],null))[_0xf502('0x1e')](respondWithResult(_0x2e0f10,null))[_0xf502('0x40')](handleError(_0x2e0f10,null));};exports[_0xf502('0x1f')]=function(_0x2f7a6e,_0x13702c){return db[_0xf502('0x39')][_0xf502('0x3f')]({'where':{'id':_0x2f7a6e['params']['id']}})['then'](handleEntityNotFound(_0x13702c,null))[_0xf502('0x1e')](removeEntity(_0x13702c,null))[_0xf502('0x40')](handleError(_0x13702c,null));};exports['addConditions']=function(_0x37a608,_0x18ae39,_0xfec677){return db[_0xf502('0x44')][_0xf502('0x3f')]({'where':{'id':_0x37a608[_0xf502('0x43')]['id']}})['then'](handleEntityNotFound(_0x18ae39,null))[_0xf502('0x1e')](function(_0x1bfde6){if(_0x1bfde6){return _0x1bfde6[_0xf502('0x45')](_0x37a608[_0xf502('0x42')]['ids'],_[_0xf502('0x46')](_0x37a608['body'],[_0xf502('0x47'),'id'])||{});}})[_0xf502('0x1e')](respondWithResult(_0x18ae39,null))['catch'](handleError(_0x18ae39,null));};exports[_0xf502('0x48')]=function(_0x4eca87,_0x3205c4,_0x58b2d3){var _0x2bae17={};var _0x111d64={};var _0x1d1dd9;var _0x51e1bd;return db[_0xf502('0x39')][_0xf502('0x49')]({'where':{'id':_0x4eca87['params']['id']}})[_0xf502('0x1e')](handleEntityNotFound(_0x3205c4,null))[_0xf502('0x1e')](function(_0x5488dc){if(_0x5488dc){_0x1d1dd9=_0x5488dc;_0x111d64[_0xf502('0x27')]=_[_0xf502('0x29')](db[_0xf502('0x44')][_0xf502('0x3e')]);_0x111d64[_0xf502('0x28')]=_[_0xf502('0x29')](_0x4eca87[_0xf502('0x28')]);_0x111d64[_0xf502('0x33')]=_[_0xf502('0x2a')](_0x111d64['model'],_0x111d64[_0xf502('0x28')]);_0x2bae17[_0xf502('0x2c')]=_[_0xf502('0x2a')](_0x111d64[_0xf502('0x27')],qs['fields'](_0x4eca87[_0xf502('0x28')][_0xf502('0x2b')]));_0x2bae17[_0xf502('0x2c')]=_0x2bae17['attributes'][_0xf502('0x2d')]?_0x2bae17[_0xf502('0x2c')]:_0x111d64['model'];_0x2bae17['order']=qs[_0xf502('0x31')](_0x4eca87[_0xf502('0x28')]['sort']);_0x2bae17[_0xf502('0x32')]=qs['filters'](_[_0xf502('0x34')](_0x4eca87[_0xf502('0x28')],_0x111d64[_0xf502('0x33')]));if(_0x4eca87['query'][_0xf502('0x35')]){_0x2bae17[_0xf502('0x32')]=_[_0xf502('0x36')](_0x2bae17['where'],{'$or':_[_0xf502('0x23')](_0x2bae17['attributes'],function(_0x3d3ce2){var _0x2236ac={};_0x2236ac[_0x3d3ce2]={'$like':'%'+_0x4eca87[_0xf502('0x28')][_0xf502('0x35')]+'%'};return _0x2236ac;})});}_0x2bae17=_[_0xf502('0x36')]({},_0x2bae17,_0x4eca87[_0xf502('0x38')]);return _0x1d1dd9['getConditions'](_0x2bae17);}})['then'](function(_0x138f52){if(_0x138f52){_0x51e1bd=_0x138f52[_0xf502('0x2d')];if(!_0x4eca87[_0xf502('0x28')][_0xf502('0x2e')](_0xf502('0x2f'))){_0x2bae17[_0xf502('0x30')]=qs[_0xf502('0x30')](_0x4eca87[_0xf502('0x28')][_0xf502('0x30')]);_0x2bae17['offset']=qs[_0xf502('0x19')](_0x4eca87[_0xf502('0x28')][_0xf502('0x19')]);}return _0x1d1dd9['getConditions'](_0x2bae17);}})[_0xf502('0x1e')](function(_0x5a590f){if(_0x5a590f){return _0x5a590f?{'count':_0x51e1bd,'rows':_0x5a590f}:null;}})[_0xf502('0x1e')](respondWithResult(_0x3205c4,null))[_0xf502('0x40')](handleError(_0x3205c4,null));};exports[_0xf502('0x4a')]=function(_0x2dda02,_0x4e7051,_0x428929){return db[_0xf502('0x4b')][_0xf502('0x3f')]({'where':{'id':_0x2dda02[_0xf502('0x43')]['id']}})[_0xf502('0x1e')](handleEntityNotFound(_0x4e7051,null))['then'](function(_0x596ae0){if(_0x596ae0){return _0x596ae0['addActions'](_0x2dda02['body']['ids'],_[_0xf502('0x46')](_0x2dda02[_0xf502('0x42')],[_0xf502('0x47'),'id'])||{});}})[_0xf502('0x1e')](respondWithResult(_0x4e7051,null))['catch'](handleError(_0x4e7051,null));};exports[_0xf502('0x4c')]=function(_0x366fd4,_0x37ffc6,_0x50501f){var _0xb300c2={};var _0xff1dc0={};var _0xf78867;var _0x558a44;return db['Automation'][_0xf502('0x49')]({'where':{'id':_0x366fd4[_0xf502('0x43')]['id']}})[_0xf502('0x1e')](handleEntityNotFound(_0x37ffc6,null))[_0xf502('0x1e')](function(_0x9a4553){if(_0x9a4553){_0xf78867=_0x9a4553;_0xff1dc0[_0xf502('0x27')]=_[_0xf502('0x29')](db[_0xf502('0x4b')]['rawAttributes']);_0xff1dc0['query']=_[_0xf502('0x29')](_0x366fd4[_0xf502('0x28')]);_0xff1dc0['filters']=_[_0xf502('0x2a')](_0xff1dc0[_0xf502('0x27')],_0xff1dc0[_0xf502('0x28')]);_0xb300c2[_0xf502('0x2c')]=_[_0xf502('0x2a')](_0xff1dc0[_0xf502('0x27')],qs[_0xf502('0x2b')](_0x366fd4[_0xf502('0x28')][_0xf502('0x2b')]));_0xb300c2['attributes']=_0xb300c2[_0xf502('0x2c')][_0xf502('0x2d')]?_0xb300c2['attributes']:_0xff1dc0['model'];_0xb300c2['order']=qs[_0xf502('0x31')](_0x366fd4['query'][_0xf502('0x31')]);_0xb300c2[_0xf502('0x32')]=qs[_0xf502('0x33')](_[_0xf502('0x34')](_0x366fd4[_0xf502('0x28')],_0xff1dc0[_0xf502('0x33')]));if(_0x366fd4[_0xf502('0x28')][_0xf502('0x35')]){_0xb300c2[_0xf502('0x32')]=_[_0xf502('0x36')](_0xb300c2[_0xf502('0x32')],{'$or':_[_0xf502('0x23')](_0xb300c2[_0xf502('0x2c')],function(_0x1360db){var _0x18a16f={};_0x18a16f[_0x1360db]={'$like':'%'+_0x366fd4[_0xf502('0x28')][_0xf502('0x35')]+'%'};return _0x18a16f;})});}_0xb300c2=_[_0xf502('0x36')]({},_0xb300c2,_0x366fd4[_0xf502('0x38')]);return _0xf78867['getActions'](_0xb300c2);}})[_0xf502('0x1e')](function(_0x2fbe0c){if(_0x2fbe0c){_0x558a44=_0x2fbe0c[_0xf502('0x2d')];if(!_0x366fd4[_0xf502('0x28')][_0xf502('0x2e')](_0xf502('0x2f'))){_0xb300c2['limit']=qs[_0xf502('0x30')](_0x366fd4[_0xf502('0x28')][_0xf502('0x30')]);_0xb300c2[_0xf502('0x19')]=qs[_0xf502('0x19')](_0x366fd4[_0xf502('0x28')][_0xf502('0x19')]);}return _0xf78867[_0xf502('0x4c')](_0xb300c2);}})['then'](function(_0x257ea1){if(_0x257ea1){return _0x257ea1?{'count':_0x558a44,'rows':_0x257ea1}:null;}})['then'](respondWithResult(_0x37ffc6,null))['catch'](handleError(_0x37ffc6,null));}; \ No newline at end of file +var _0xcd10=['json','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','addConditions','findOne','Condition','nolimit','addActions','ids','omit','getActions','Action','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x1a3ceb,_0x5e59cf){var _0x2c7290=function(_0x181d41){while(--_0x181d41){_0x1a3ceb['push'](_0x1a3ceb['shift']());}};_0x2c7290(++_0x5e59cf);}(_0xcd10,0x12f));var _0x0cd1=function(_0x55572e,_0x51f52d){_0x55572e=_0x55572e-0x0;var _0x50357c=_0xcd10[_0x55572e];return _0x50357c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0cd1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0cd1('0x1'));var rp=require(_0x0cd1('0x2'));var moment=require(_0x0cd1('0x3'));var BPromise=require(_0x0cd1('0x4'));var Mustache=require(_0x0cd1('0x5'));var util=require('util');var path=require(_0x0cd1('0x6'));var sox=require('sox');var csv=require(_0x0cd1('0x7'));var ejs=require(_0x0cd1('0x8'));var fs=require('fs');var _=require(_0x0cd1('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0cd1('0xa'));var deskjs=require(_0x0cd1('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0cd1('0xc'));var Papa=require(_0x0cd1('0xd'));var Redis=require(_0x0cd1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0cd1('0xf'));var as=require(_0x0cd1('0x10'));var hardwareService=require(_0x0cd1('0x11'));var logger=require('../../config/logger')(_0x0cd1('0x12'));var utils=require(_0x0cd1('0x13'));var config=require(_0x0cd1('0x14'));var db=require(_0x0cd1('0x15'))['db'];function respondWithStatusCode(_0x2900a9,_0x2223c6){_0x2223c6=_0x2223c6||0xcc;return function(_0x3abcd1){if(_0x3abcd1){return _0x2900a9[_0x0cd1('0x16')](_0x2223c6);}return _0x2900a9[_0x0cd1('0x17')](_0x2223c6)[_0x0cd1('0x18')]();};}function respondWithResult(_0x9a07e7,_0x42b4d1){_0x42b4d1=_0x42b4d1||0xc8;return function(_0x1f065){if(_0x1f065){return _0x9a07e7[_0x0cd1('0x17')](_0x42b4d1)[_0x0cd1('0x19')](_0x1f065);}};}function respondWithFilteredResult(_0x2b237f,_0x5443b6){return function(_0x35c786){if(_0x35c786){var _0x11e439=_0x35c786[_0x0cd1('0x1a')],_0x5af6cf=_0x5443b6[_0x0cd1('0x1b')],_0x3b2a81=_0x5443b6[_0x0cd1('0x1b')]+_0x5443b6['limit'],_0x24a2f5;if(_0x3b2a81>=_0x11e439){_0x3b2a81=_0x11e439;_0x24a2f5=0xc8;}else{_0x24a2f5=0xce;}_0x2b237f[_0x0cd1('0x17')](_0x24a2f5);return _0x2b237f[_0x0cd1('0x1c')](_0x0cd1('0x1d'),_0x5af6cf+'-'+_0x3b2a81+'/'+_0x11e439)[_0x0cd1('0x19')](_0x35c786);}return null;};}function patchUpdates(_0x347fcd){return function(_0x5f57fd){try{jsonpatch['apply'](_0x5f57fd,_0x347fcd,!![]);}catch(_0x1e1c76){return BPromise[_0x0cd1('0x1e')](_0x1e1c76);}return _0x5f57fd[_0x0cd1('0x1f')]();};}function saveUpdates(_0x36e1f8,_0x5ac3c7){return function(_0x1e98fc){if(_0x1e98fc){return _0x1e98fc['update'](_0x36e1f8)[_0x0cd1('0x20')](function(_0x3b2f8c){return _0x3b2f8c;});}return null;};}function removeEntity(_0xf4684c,_0x424435){return function(_0x296c84){if(_0x296c84){return _0x296c84[_0x0cd1('0x21')]()[_0x0cd1('0x20')](function(){_0xf4684c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fac2,_0x7ebe03){return function(_0x1fe86b){if(!_0x1fe86b){_0x40fac2['sendStatus'](0x194);}return _0x1fe86b;};}function handleError(_0x250dcf,_0x269825){_0x269825=_0x269825||0x1f4;return function(_0x356868){logger[_0x0cd1('0x22')](_0x356868[_0x0cd1('0x23')]);if(_0x356868[_0x0cd1('0x24')]){delete _0x356868[_0x0cd1('0x24')];}_0x250dcf[_0x0cd1('0x17')](_0x269825)[_0x0cd1('0x25')](_0x356868);};}exports[_0x0cd1('0x26')]=function(_0x46e3a3,_0x310b42){var _0xa6dbe5={},_0x3db9f8={},_0x2d0984={'count':0x0,'rows':[]};var _0x4db79d=_[_0x0cd1('0x27')](db[_0x0cd1('0x28')][_0x0cd1('0x29')],function(_0x599705){return{'name':_0x599705['fieldName'],'type':_0x599705[_0x0cd1('0x2a')][_0x0cd1('0x2b')]};});_0x3db9f8[_0x0cd1('0x2c')]=_[_0x0cd1('0x27')](_0x4db79d,_0x0cd1('0x24'));_0x3db9f8[_0x0cd1('0x2d')]=_['keys'](_0x46e3a3[_0x0cd1('0x2d')]);_0x3db9f8['filters']=_['intersection'](_0x3db9f8[_0x0cd1('0x2c')],_0x3db9f8[_0x0cd1('0x2d')]);_0xa6dbe5[_0x0cd1('0x2e')]=_[_0x0cd1('0x2f')](_0x3db9f8[_0x0cd1('0x2c')],qs[_0x0cd1('0x30')](_0x46e3a3['query'][_0x0cd1('0x30')]));_0xa6dbe5[_0x0cd1('0x2e')]=_0xa6dbe5[_0x0cd1('0x2e')][_0x0cd1('0x31')]?_0xa6dbe5[_0x0cd1('0x2e')]:_0x3db9f8[_0x0cd1('0x2c')];if(!_0x46e3a3['query'][_0x0cd1('0x32')]('nolimit')){_0xa6dbe5[_0x0cd1('0x33')]=qs[_0x0cd1('0x33')](_0x46e3a3['query']['limit']);_0xa6dbe5[_0x0cd1('0x1b')]=qs[_0x0cd1('0x1b')](_0x46e3a3[_0x0cd1('0x2d')][_0x0cd1('0x1b')]);}_0xa6dbe5[_0x0cd1('0x34')]=qs['sort'](_0x46e3a3[_0x0cd1('0x2d')][_0x0cd1('0x35')]);_0xa6dbe5['where']=qs[_0x0cd1('0x36')](_[_0x0cd1('0x37')](_0x46e3a3[_0x0cd1('0x2d')],_0x3db9f8[_0x0cd1('0x36')]),_0x4db79d);if(_0x46e3a3[_0x0cd1('0x2d')][_0x0cd1('0x38')]){_0xa6dbe5[_0x0cd1('0x39')]=_[_0x0cd1('0x3a')](_0xa6dbe5[_0x0cd1('0x39')],{'$or':_[_0x0cd1('0x27')](_0x4db79d,function(_0x2df369){if(_0x2df369[_0x0cd1('0x2a')]!==_0x0cd1('0x3b')){var _0x423918={};_0x423918[_0x2df369[_0x0cd1('0x24')]]={'$like':'%'+_0x46e3a3[_0x0cd1('0x2d')][_0x0cd1('0x38')]+'%'};return _0x423918;}})});}_0xa6dbe5=_[_0x0cd1('0x3a')]({},_0xa6dbe5,_0x46e3a3[_0x0cd1('0x3c')]);var _0x4f6dd2={'where':_0xa6dbe5[_0x0cd1('0x39')]};return db[_0x0cd1('0x28')][_0x0cd1('0x1a')](_0x4f6dd2)['then'](function(_0x33a07c){_0x2d0984[_0x0cd1('0x1a')]=_0x33a07c;if(_0x46e3a3[_0x0cd1('0x2d')][_0x0cd1('0x3d')]){_0xa6dbe5[_0x0cd1('0x3e')]=[{'all':!![]}];}return db['Automation'][_0x0cd1('0x3f')](_0xa6dbe5);})[_0x0cd1('0x20')](function(_0x87250a){_0x2d0984[_0x0cd1('0x40')]=_0x87250a;return _0x2d0984;})['then'](respondWithFilteredResult(_0x310b42,_0xa6dbe5))[_0x0cd1('0x41')](handleError(_0x310b42,null));};exports[_0x0cd1('0x42')]=function(_0x4991f7,_0x4851d1){var _0xd73954={'raw':![],'where':{'id':_0x4991f7[_0x0cd1('0x43')]['id']}},_0x11ba3a={};_0x11ba3a[_0x0cd1('0x2c')]=_[_0x0cd1('0x44')](db['Automation'][_0x0cd1('0x29')]);_0x11ba3a[_0x0cd1('0x2d')]=_[_0x0cd1('0x44')](_0x4991f7[_0x0cd1('0x2d')]);_0x11ba3a[_0x0cd1('0x36')]=_[_0x0cd1('0x2f')](_0x11ba3a[_0x0cd1('0x2c')],_0x11ba3a[_0x0cd1('0x2d')]);_0xd73954[_0x0cd1('0x2e')]=_[_0x0cd1('0x2f')](_0x11ba3a['model'],qs['fields'](_0x4991f7[_0x0cd1('0x2d')]['fields']));_0xd73954[_0x0cd1('0x2e')]=_0xd73954[_0x0cd1('0x2e')][_0x0cd1('0x31')]?_0xd73954[_0x0cd1('0x2e')]:_0x11ba3a[_0x0cd1('0x2c')];if(_0x4991f7[_0x0cd1('0x2d')]['includeAll']){_0xd73954[_0x0cd1('0x3e')]=[{'all':!![]}];}_0xd73954=_['merge']({},_0xd73954,_0x4991f7['options']);return db[_0x0cd1('0x28')][_0x0cd1('0x45')](_0xd73954)['then'](handleEntityNotFound(_0x4851d1,null))[_0x0cd1('0x20')](respondWithResult(_0x4851d1,null))[_0x0cd1('0x41')](handleError(_0x4851d1,null));};exports[_0x0cd1('0x46')]=function(_0x3a1eb6,_0x5cccd3){return db['Automation'][_0x0cd1('0x46')](_0x3a1eb6[_0x0cd1('0x47')],{})[_0x0cd1('0x20')](respondWithResult(_0x5cccd3,0xc9))['catch'](handleError(_0x5cccd3,null));};exports[_0x0cd1('0x48')]=function(_0x19c10f,_0x4854db){if(_0x19c10f[_0x0cd1('0x47')]['id']){delete _0x19c10f[_0x0cd1('0x47')]['id'];}return db[_0x0cd1('0x28')][_0x0cd1('0x45')]({'where':{'id':_0x19c10f[_0x0cd1('0x43')]['id']}})[_0x0cd1('0x20')](handleEntityNotFound(_0x4854db,null))[_0x0cd1('0x20')](saveUpdates(_0x19c10f[_0x0cd1('0x47')],null))[_0x0cd1('0x20')](respondWithResult(_0x4854db,null))['catch'](handleError(_0x4854db,null));};exports[_0x0cd1('0x21')]=function(_0x41df2d,_0x183266){return db[_0x0cd1('0x28')]['find']({'where':{'id':_0x41df2d[_0x0cd1('0x43')]['id']}})[_0x0cd1('0x20')](handleEntityNotFound(_0x183266,null))[_0x0cd1('0x20')](removeEntity(_0x183266,null))[_0x0cd1('0x41')](handleError(_0x183266,null));};exports[_0x0cd1('0x49')]=function(_0xc73966,_0x297cbe,_0x208bc9){return db['Condition']['find']({'where':{'id':_0xc73966[_0x0cd1('0x43')]['id']}})[_0x0cd1('0x20')](handleEntityNotFound(_0x297cbe,null))[_0x0cd1('0x20')](function(_0x51fd96){if(_0x51fd96){return _0x51fd96[_0x0cd1('0x49')](_0xc73966['body']['ids'],_['omit'](_0xc73966[_0x0cd1('0x47')],['ids','id'])||{});}})['then'](respondWithResult(_0x297cbe,null))['catch'](handleError(_0x297cbe,null));};exports['getConditions']=function(_0x26d642,_0x58018d,_0x34f83e){var _0x8f89b1={};var _0x14b322={};var _0x4eab17;var _0x17cbdd;return db[_0x0cd1('0x28')][_0x0cd1('0x4a')]({'where':{'id':_0x26d642[_0x0cd1('0x43')]['id']}})[_0x0cd1('0x20')](handleEntityNotFound(_0x58018d,null))[_0x0cd1('0x20')](function(_0x2d3781){if(_0x2d3781){_0x4eab17=_0x2d3781;_0x14b322[_0x0cd1('0x2c')]=_[_0x0cd1('0x44')](db[_0x0cd1('0x4b')][_0x0cd1('0x29')]);_0x14b322[_0x0cd1('0x2d')]=_[_0x0cd1('0x44')](_0x26d642['query']);_0x14b322[_0x0cd1('0x36')]=_[_0x0cd1('0x2f')](_0x14b322['model'],_0x14b322['query']);_0x8f89b1[_0x0cd1('0x2e')]=_[_0x0cd1('0x2f')](_0x14b322[_0x0cd1('0x2c')],qs[_0x0cd1('0x30')](_0x26d642['query']['fields']));_0x8f89b1['attributes']=_0x8f89b1[_0x0cd1('0x2e')][_0x0cd1('0x31')]?_0x8f89b1[_0x0cd1('0x2e')]:_0x14b322[_0x0cd1('0x2c')];_0x8f89b1[_0x0cd1('0x34')]=qs[_0x0cd1('0x35')](_0x26d642[_0x0cd1('0x2d')]['sort']);_0x8f89b1['where']=qs[_0x0cd1('0x36')](_[_0x0cd1('0x37')](_0x26d642[_0x0cd1('0x2d')],_0x14b322[_0x0cd1('0x36')]));if(_0x26d642[_0x0cd1('0x2d')][_0x0cd1('0x38')]){_0x8f89b1[_0x0cd1('0x39')]=_[_0x0cd1('0x3a')](_0x8f89b1[_0x0cd1('0x39')],{'$or':_[_0x0cd1('0x27')](_0x8f89b1[_0x0cd1('0x2e')],function(_0x3c6040){var _0x12bb5e={};_0x12bb5e[_0x3c6040]={'$like':'%'+_0x26d642['query'][_0x0cd1('0x38')]+'%'};return _0x12bb5e;})});}_0x8f89b1=_[_0x0cd1('0x3a')]({},_0x8f89b1,_0x26d642[_0x0cd1('0x3c')]);return _0x4eab17['getConditions'](_0x8f89b1);}})['then'](function(_0x229a05){if(_0x229a05){_0x17cbdd=_0x229a05['length'];if(!_0x26d642[_0x0cd1('0x2d')][_0x0cd1('0x32')](_0x0cd1('0x4c'))){_0x8f89b1['limit']=qs[_0x0cd1('0x33')](_0x26d642[_0x0cd1('0x2d')][_0x0cd1('0x33')]);_0x8f89b1['offset']=qs[_0x0cd1('0x1b')](_0x26d642[_0x0cd1('0x2d')]['offset']);}return _0x4eab17['getConditions'](_0x8f89b1);}})['then'](function(_0x1c2f3e){if(_0x1c2f3e){return _0x1c2f3e?{'count':_0x17cbdd,'rows':_0x1c2f3e}:null;}})['then'](respondWithResult(_0x58018d,null))['catch'](handleError(_0x58018d,null));};exports[_0x0cd1('0x4d')]=function(_0x23ae70,_0x1e3d95,_0x34c037){return db['Action']['find']({'where':{'id':_0x23ae70['params']['id']}})[_0x0cd1('0x20')](handleEntityNotFound(_0x1e3d95,null))['then'](function(_0x2f6d73){if(_0x2f6d73){return _0x2f6d73['addActions'](_0x23ae70[_0x0cd1('0x47')][_0x0cd1('0x4e')],_[_0x0cd1('0x4f')](_0x23ae70[_0x0cd1('0x47')],[_0x0cd1('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x1e3d95,null))['catch'](handleError(_0x1e3d95,null));};exports[_0x0cd1('0x50')]=function(_0x3a4ed6,_0x4f6280,_0x47ac59){var _0x564e6a={};var _0x1326d8={};var _0x33f2ac;var _0x3eaf91;return db[_0x0cd1('0x28')][_0x0cd1('0x4a')]({'where':{'id':_0x3a4ed6['params']['id']}})[_0x0cd1('0x20')](handleEntityNotFound(_0x4f6280,null))[_0x0cd1('0x20')](function(_0xbc3605){if(_0xbc3605){_0x33f2ac=_0xbc3605;_0x1326d8['model']=_[_0x0cd1('0x44')](db[_0x0cd1('0x51')][_0x0cd1('0x29')]);_0x1326d8['query']=_[_0x0cd1('0x44')](_0x3a4ed6[_0x0cd1('0x2d')]);_0x1326d8[_0x0cd1('0x36')]=_[_0x0cd1('0x2f')](_0x1326d8[_0x0cd1('0x2c')],_0x1326d8['query']);_0x564e6a[_0x0cd1('0x2e')]=_[_0x0cd1('0x2f')](_0x1326d8['model'],qs[_0x0cd1('0x30')](_0x3a4ed6[_0x0cd1('0x2d')][_0x0cd1('0x30')]));_0x564e6a['attributes']=_0x564e6a[_0x0cd1('0x2e')][_0x0cd1('0x31')]?_0x564e6a['attributes']:_0x1326d8[_0x0cd1('0x2c')];_0x564e6a[_0x0cd1('0x34')]=qs['sort'](_0x3a4ed6[_0x0cd1('0x2d')][_0x0cd1('0x35')]);_0x564e6a['where']=qs[_0x0cd1('0x36')](_['pick'](_0x3a4ed6[_0x0cd1('0x2d')],_0x1326d8['filters']));if(_0x3a4ed6[_0x0cd1('0x2d')]['filter']){_0x564e6a[_0x0cd1('0x39')]=_[_0x0cd1('0x3a')](_0x564e6a[_0x0cd1('0x39')],{'$or':_[_0x0cd1('0x27')](_0x564e6a[_0x0cd1('0x2e')],function(_0x40f1df){var _0x3ff3c2={};_0x3ff3c2[_0x40f1df]={'$like':'%'+_0x3a4ed6[_0x0cd1('0x2d')][_0x0cd1('0x38')]+'%'};return _0x3ff3c2;})});}_0x564e6a=_[_0x0cd1('0x3a')]({},_0x564e6a,_0x3a4ed6['options']);return _0x33f2ac['getActions'](_0x564e6a);}})[_0x0cd1('0x20')](function(_0x3b32e2){if(_0x3b32e2){_0x3eaf91=_0x3b32e2[_0x0cd1('0x31')];if(!_0x3a4ed6[_0x0cd1('0x2d')][_0x0cd1('0x32')](_0x0cd1('0x4c'))){_0x564e6a[_0x0cd1('0x33')]=qs[_0x0cd1('0x33')](_0x3a4ed6[_0x0cd1('0x2d')][_0x0cd1('0x33')]);_0x564e6a['offset']=qs[_0x0cd1('0x1b')](_0x3a4ed6[_0x0cd1('0x2d')][_0x0cd1('0x1b')]);}return _0x33f2ac[_0x0cd1('0x50')](_0x564e6a);}})[_0x0cd1('0x20')](function(_0xaac541){if(_0xaac541){return _0xaac541?{'count':_0x3eaf91,'rows':_0xaac541}:null;}})[_0x0cd1('0x20')](respondWithResult(_0x4f6280,null))[_0x0cd1('0x41')](handleError(_0x4f6280,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d5ecf45..6c7c01a 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 _0x5075=['bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash','util','../../config/logger','api','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5075,0x73));var _0x5507=function(_0xeead8a,_0x3d2400){_0xeead8a=_0xeead8a-0x0;var _0x24742c=_0x5075[_0xeead8a];return _0x24742c;};'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 +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x341a8f,_0x42fbcf){var _0x16d587=function(_0x2c8ec9){while(--_0x2c8ec9){_0x341a8f['push'](_0x341a8f['shift']());}};_0x16d587(++_0x42fbcf);}(_0xb138,0x1dd));var _0x8b13=function(_0x4e6ef9,_0x22a04e){_0x4e6ef9=_0x4e6ef9-0x0;var _0x331c37=_0xb138[_0x4e6ef9];return _0x331c37;};'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':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 54fc65d..413fa5a 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 _0x4c20=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x53999b,_0x14a7d6){var _0x4fb77f=function(_0x2d2a27){while(--_0x2d2a27){_0x53999b['push'](_0x53999b['shift']());}};_0x4fb77f(++_0x14a7d6);}(_0x4c20,0x133));var _0x04c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c20[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x04c2('0x0'));var util=require(_0x04c2('0x1'));var moment=require(_0x04c2('0x2'));var BPromise=require(_0x04c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c2('0x4'));var db=require(_0x04c2('0x5'))['db'];var utils=require(_0x04c2('0x6'));var logger=require(_0x04c2('0x7'))(_0x04c2('0x8'));var config=require(_0x04c2('0x9'));var jayson=require(_0x04c2('0xa'));var client=jayson[_0x04c2('0xb')][_0x04c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14ac11,_0x3a9363,_0x48499b){return new BPromise(function(_0x1bffaf,_0x57cfac){return client['request'](_0x14ac11,_0x48499b)[_0x04c2('0xd')](function(_0x12d70f){logger['info'](_0x04c2('0xe'),_0x3a9363,_0x04c2('0xf'));logger[_0x04c2('0x10')](_0x04c2('0x11'),_0x3a9363,_0x04c2('0xf'),JSON[_0x04c2('0x12')](_0x12d70f));if(_0x12d70f[_0x04c2('0x13')]){if(_0x12d70f['error'][_0x04c2('0x14')]===0x1f4){logger[_0x04c2('0x13')](_0x04c2('0xe'),_0x3a9363,_0x12d70f[_0x04c2('0x13')][_0x04c2('0x15')]);return _0x57cfac(_0x12d70f[_0x04c2('0x13')]['message']);}logger[_0x04c2('0x13')](_0x04c2('0xe'),_0x3a9363,_0x12d70f[_0x04c2('0x13')][_0x04c2('0x15')]);return _0x1bffaf(_0x12d70f[_0x04c2('0x13')]['message']);}else{logger['info'](_0x04c2('0xe'),_0x3a9363,_0x04c2('0xf'));_0x1bffaf(_0x12d70f[_0x04c2('0x16')][_0x04c2('0x15')]);}})[_0x04c2('0x17')](function(_0x10e8a1){logger[_0x04c2('0x13')](_0x04c2('0xe'),_0x3a9363,_0x10e8a1);_0x57cfac(_0x10e8a1);});});} \ No newline at end of file +var _0x2a3f=['message','result','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x2a3f,0x10a));var _0xf2a3=function(_0x37ae2e,_0x35be3a){_0x37ae2e=_0x37ae2e-0x0;var _0x19c50f=_0x2a3f[_0x37ae2e];return _0x19c50f;};'use strict';var _=require('lodash');var util=require(_0xf2a3('0x0'));var moment=require(_0xf2a3('0x1'));var BPromise=require(_0xf2a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2a3('0x3'))['db'];var utils=require(_0xf2a3('0x4'));var logger=require('../../config/logger')(_0xf2a3('0x5'));var config=require(_0xf2a3('0x6'));var jayson=require(_0xf2a3('0x7'));var client=jayson[_0xf2a3('0x8')][_0xf2a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x273ba7,_0x4a4bbd,_0x275e98){return new BPromise(function(_0x401cc5,_0x193790){return client[_0xf2a3('0xa')](_0x273ba7,_0x275e98)[_0xf2a3('0xb')](function(_0x5443f7){logger[_0xf2a3('0xc')](_0xf2a3('0xd'),_0x4a4bbd,'request\x20sent');logger[_0xf2a3('0xe')](_0xf2a3('0xf'),_0x4a4bbd,_0xf2a3('0x10'),JSON[_0xf2a3('0x11')](_0x5443f7));if(_0x5443f7[_0xf2a3('0x12')]){if(_0x5443f7[_0xf2a3('0x12')][_0xf2a3('0x13')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x4a4bbd,_0x5443f7[_0xf2a3('0x12')][_0xf2a3('0x14')]);return _0x193790(_0x5443f7[_0xf2a3('0x12')][_0xf2a3('0x14')]);}logger[_0xf2a3('0x12')]('Automation,\x20%s,\x20%s',_0x4a4bbd,_0x5443f7['error'][_0xf2a3('0x14')]);return _0x401cc5(_0x5443f7[_0xf2a3('0x12')][_0xf2a3('0x14')]);}else{logger['info'](_0xf2a3('0xd'),_0x4a4bbd,_0xf2a3('0x10'));_0x401cc5(_0x5443f7[_0xf2a3('0x15')][_0xf2a3('0x14')]);}})['catch'](function(_0x152790){logger[_0xf2a3('0x12')](_0xf2a3('0xd'),_0x4a4bbd,_0x152790);_0x193790(_0x152790);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 7297171..9f192e9 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 _0x5df3=['/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3cb9c0,_0x52ed16){var _0xfb545=function(_0x4f016c){while(--_0x4f016c){_0x3cb9c0['push'](_0x3cb9c0['shift']());}};_0xfb545(++_0x52ed16);}(_0x5df3,0x15f));var _0x35df=function(_0x20a086,_0x15cef2){_0x20a086=_0x20a086-0x0;var _0x379cc3=_0x5df3[_0x20a086];return _0x379cc3;};'use strict';var multer=require(_0x35df('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x35df('0x1'));var express=require(_0x35df('0x2'));var router=express[_0x35df('0x3')]();var auth=require(_0x35df('0x4'));var interaction=require(_0x35df('0x5'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x35df('0x6')]('/',auth[_0x35df('0x7')](),controller[_0x35df('0x8')]);router['get'](_0x35df('0x9'),auth[_0x35df('0x7')](),controller[_0x35df('0xa')]);router[_0x35df('0x6')](_0x35df('0xb'),auth[_0x35df('0x7')](),controller[_0x35df('0xc')]);router[_0x35df('0x6')](_0x35df('0xd'),auth[_0x35df('0x7')](),controller[_0x35df('0xe')]);router[_0x35df('0xf')]('/',auth['isAuthenticated'](),controller[_0x35df('0x10')]);router[_0x35df('0xf')](_0x35df('0xb'),auth[_0x35df('0x7')](),controller[_0x35df('0x11')]);router['post'](_0x35df('0xd'),auth[_0x35df('0x7')](),controller[_0x35df('0x12')]);router[_0x35df('0x13')](_0x35df('0x9'),auth[_0x35df('0x7')](),controller[_0x35df('0x14')]);router[_0x35df('0x15')]('/:id',auth[_0x35df('0x7')](),controller[_0x35df('0x16')]);module[_0x35df('0x17')]=router; \ No newline at end of file +var _0xbff2=['isAuthenticated','show','/:id/conditions','post','create','addConditions','addActions','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x119d0d,_0x1491a2){var _0x26e315=function(_0x31ed47){while(--_0x31ed47){_0x119d0d['push'](_0x119d0d['shift']());}};_0x26e315(++_0x1491a2);}(_0xbff2,0x10e));var _0x2bff=function(_0x4e56db,_0x40d6b0){_0x4e56db=_0x4e56db-0x0;var _0x11575d=_0xbff2[_0x4e56db];return _0x11575d;};'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('./automation.controller');router[_0x2bff('0x9')]('/',auth[_0x2bff('0xa')](),controller['index']);router['get']('/:id',auth[_0x2bff('0xa')](),controller[_0x2bff('0xb')]);router['get'](_0x2bff('0xc'),auth['isAuthenticated'](),controller['getConditions']);router[_0x2bff('0x9')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x2bff('0xd')]('/',auth['isAuthenticated'](),controller[_0x2bff('0xe')]);router[_0x2bff('0xd')]('/:id/conditions',auth[_0x2bff('0xa')](),controller[_0x2bff('0xf')]);router['post']('/:id/actions',auth[_0x2bff('0xa')](),controller[_0x2bff('0x10')]);router['put'](_0x2bff('0x11'),auth[_0x2bff('0xa')](),controller['update']);router[_0x2bff('0x12')](_0x2bff('0x11'),auth[_0x2bff('0xa')](),controller[_0x2bff('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index bd88d3d..eb71409 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 _0xb438=['always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*'];(function(_0x1efbca,_0xa8b72f){var _0x29fc3e=function(_0x46177a){while(--_0x46177a){_0x1efbca['push'](_0x1efbca['shift']());}};_0x29fc3e(++_0xa8b72f);}(_0xb438,0xd8));var _0x8b43=function(_0x537e16,_0x21f9d7){_0x537e16=_0x537e16-0x0;var _0x7bf894=_0xb438[_0x537e16];return _0x7bf894;};'use strict';var Sequelize=require(_0x8b43('0x0'));module[_0x8b43('0x1')]={'name':{'type':Sequelize[_0x8b43('0x2')],'unique':_0x8b43('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8b43('0x4')](_0x8b43('0x5')),'allowNull':![],'defaultValue':_0x8b43('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8b43('0x6')],'defaultValue':0x0,'comment':_0x8b43('0x7')},'limitCalls':{'type':Sequelize[_0x8b43('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8b43('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8b43('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8b43('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x8b43('0xa')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b43('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8b43('0x8')](0x3)[_0x8b43('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b43('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8b43('0x8')](0x5)[_0x8b43('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x8b43('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8b43('0x8')](0x5)[_0x8b43('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b43('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8b43('0x8')](0x3)[_0x8b43('0xa')],'defaultValue':0x3,'comment':_0x8b43('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8b43('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b43('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8b43('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8b43('0x10')},'dialTimezone':{'type':Sequelize[_0x8b43('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8b43('0x2')],'defaultValue':_0x8b43('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8b43('0x12'),_0x8b43('0x13'),'onlyIfOpen'),'defaultValue':_0x8b43('0x12')},'dialAMDActive':{'type':Sequelize[_0x8b43('0x6')],'defaultValue':0x0,'comment':_0x8b43('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8b43('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8b43('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8b43('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8b43('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8b43('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8b43('0x8')](0x9)[_0x8b43('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8b43('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x8b43('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8b43('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8b43('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8b43('0x8')](0x9)[_0x8b43('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8b43('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8b43('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8b43('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8b43('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8b43('0x4')](_0x8b43('0x1d'),'ASC'),'defaultValue':_0x8b43('0x1d')},'dialPrefix':{'type':Sequelize[_0x8b43('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8b43('0x8')](0x3)[_0x8b43('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8b43('0x1e')},'dialCutDigit':{'type':Sequelize[_0x8b43('0x8')](0x3)[_0x8b43('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8b43('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8b43('0x8')](0x3)[_0x8b43('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b43('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8b43('0x8')](0x5)[_0x8b43('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b43('0x21')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8b43('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8b43('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b43('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8b43('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b43('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8b43('0x8')](0x5)[_0x8b43('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x8b43('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b43('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8b43('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b43('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8b43('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b43('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8b43('0x8')](0x5)[_0x8b43('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x724c=['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)','STRING','name','ENUM','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x6b9d70,_0x307b69){var _0x51f266=function(_0x2789e3){while(--_0x2789e3){_0x6b9d70['push'](_0x6b9d70['shift']());}};_0x51f266(++_0x307b69);}(_0x724c,0xcd));var _0xc724=function(_0x2501ad,_0xe24535){_0x2501ad=_0x2501ad-0x0;var _0x5c2d84=_0x724c[_0x2501ad];return _0x5c2d84;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc724('0x0')],'unique':_0xc724('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc724('0x2')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xc724('0x0')]},'active':{'type':Sequelize[_0xc724('0x3')],'defaultValue':0x0,'comment':_0xc724('0x4')},'limitCalls':{'type':Sequelize[_0xc724('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc724('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0xc724('0x5')](0x3)[_0xc724('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xc724('0x5')](0x3)[_0xc724('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc724('0x5')](0x5)[_0xc724('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc724('0x5')](0x3)[_0xc724('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc724('0x7')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc724('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc724('0x5')](0x3)[_0xc724('0x6')],'defaultValue':0x3,'comment':_0xc724('0x8')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc724('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc724('0x9')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc724('0x5')](0x3)[_0xc724('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc724('0xa')},'dialTimezone':{'type':Sequelize[_0xc724('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc724('0x0')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xc724('0x2')]('always',_0xc724('0xb'),'onlyIfOpen'),'defaultValue':_0xc724('0xc')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc724('0xd')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc724('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc724('0x5')](0x9)[_0xc724('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc724('0xe')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc724('0x5')](0x9)[_0xc724('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc724('0xf')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc724('0x5')](0x9)[_0xc724('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc724('0x10')},'dialAMDMinWordLength':{'type':Sequelize[_0xc724('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc724('0x11')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc724('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc724('0x12')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc724('0x5')](0x9)[_0xc724('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc724('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc724('0x13')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc724('0x5')](0x9)[_0xc724('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc724('0x14')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc724('0x2')](_0xc724('0x15'),_0xc724('0x16')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc724('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc724('0x17')},'dialCutDigit':{'type':Sequelize[_0xc724('0x5')](0x3)[_0xc724('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc724('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc724('0x5')](0x3)[_0xc724('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc724('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc724('0x19')},'dialDropMaxRetry':{'type':Sequelize[_0xc724('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc724('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc724('0x1a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc724('0x5')](0x3)[_0xc724('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc724('0x1b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc724('0x5')](0x5)[_0xc724('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc724('0x1c')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc724('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc724('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc724('0x5')](0x5)[_0xc724('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc724('0x1e')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc724('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc724('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc724('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc724('0x20')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4453df7..adca7c3 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 _0x56a6=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','name','map','Campaign','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','updatedAt','omit','user','findOne','CmHopper','hasOwnProperty','nolimit','getHopperHistories','CmHopperHistory','getHopperFinals','CampaignId','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x10291b,_0x518773){var _0x1d5fbe=function(_0x24df58){while(--_0x24df58){_0x10291b['push'](_0x10291b['shift']());}};_0x1d5fbe(++_0x518773);}(_0x56a6,0x17b));var _0x656a=function(_0x2eef50,_0x2df7ee){_0x2eef50=_0x2eef50-0x0;var _0x331663=_0x56a6[_0x2eef50];return _0x331663;};'use strict';var pdf=require(_0x656a('0x0'));var emlformat=require(_0x656a('0x1'));var rimraf=require(_0x656a('0x2'));var zipdir=require(_0x656a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x656a('0x4'));var BPromise=require(_0x656a('0x5'));var Mustache=require(_0x656a('0x6'));var util=require('util');var path=require(_0x656a('0x7'));var sox=require(_0x656a('0x8'));var csv=require(_0x656a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x656a('0xa'));var squel=require(_0x656a('0xb'));var crypto=require(_0x656a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x656a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x656a('0xe'));var Redis=require(_0x656a('0xf'));var authService=require(_0x656a('0x10'));var qs=require(_0x656a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x656a('0x12'));var logger=require(_0x656a('0x13'))(_0x656a('0x14'));var utils=require(_0x656a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cc2ce,_0x16312b){_0x16312b=_0x16312b||0xcc;return function(_0x32a319){if(_0x32a319){return _0x4cc2ce[_0x656a('0x16')](_0x16312b);}return _0x4cc2ce[_0x656a('0x17')](_0x16312b)[_0x656a('0x18')]();};}function respondWithResult(_0x5707b4,_0x30e0ab){_0x30e0ab=_0x30e0ab||0xc8;return function(_0x2721cd){if(_0x2721cd){return _0x5707b4[_0x656a('0x17')](_0x30e0ab)[_0x656a('0x19')](_0x2721cd);}};}function respondWithFilteredResult(_0x3473e1,_0x29f176){return function(_0x55ed){if(_0x55ed){var _0x3c8d71=_0x55ed[_0x656a('0x1a')],_0x552b5b=_0x29f176[_0x656a('0x1b')],_0x1052ca=_0x29f176[_0x656a('0x1b')]+_0x29f176[_0x656a('0x1c')],_0x27a11;if(_0x1052ca>=_0x3c8d71){_0x1052ca=_0x3c8d71;_0x27a11=0xc8;}else{_0x27a11=0xce;}_0x3473e1[_0x656a('0x17')](_0x27a11);return _0x3473e1[_0x656a('0x1d')](_0x656a('0x1e'),_0x552b5b+'-'+_0x1052ca+'/'+_0x3c8d71)['json'](_0x55ed);}return null;};}function patchUpdates(_0x38be9f){return function(_0xe31a24){try{jsonpatch[_0x656a('0x1f')](_0xe31a24,_0x38be9f,!![]);}catch(_0x2affe9){return BPromise[_0x656a('0x20')](_0x2affe9);}return _0xe31a24[_0x656a('0x21')]();};}function saveUpdates(_0x3e1307,_0x1cecf4){return function(_0x53661e){if(_0x53661e){return _0x53661e[_0x656a('0x22')](_0x3e1307)['then'](function(_0x507cad){return _0x507cad;});}return null;};}function removeEntity(_0x5c2e25,_0x53c0b6){return function(_0x124f76){if(_0x124f76){return _0x124f76[_0x656a('0x23')]()['then'](function(){var _0x6bab7f=_0x124f76[_0x656a('0x24')]({'plain':!![]});var _0x39d148='IvrCampaigns';return db[_0x656a('0x25')][_0x656a('0x23')]({'where':{'type':_0x39d148,'resourceId':_0x6bab7f['id']}})[_0x656a('0x26')](function(){return _0x124f76;});})[_0x656a('0x26')](function(){_0x5c2e25[_0x656a('0x17')](0xcc)[_0x656a('0x18')]();});}};}function handleEntityNotFound(_0xa9ec33,_0x15271f){return function(_0x4b4a00){if(!_0x4b4a00){_0xa9ec33[_0x656a('0x16')](0x194);}return _0x4b4a00;};}function handleError(_0x4c79cd,_0x223d67){_0x223d67=_0x223d67||0x1f4;return function(_0x568066){logger[_0x656a('0x27')](_0x568066['stack']);if(_0x568066[_0x656a('0x28')]){delete _0x568066['name'];}_0x4c79cd[_0x656a('0x17')](_0x223d67)['send'](_0x568066);};}exports['index']=function(_0x47bcc0,_0x2a00ba){var _0x49a723={},_0xb19ba7={},_0x5a756c={'count':0x0,'rows':[]};var _0x2ac965=_[_0x656a('0x29')](db[_0x656a('0x2a')][_0x656a('0x2b')],function(_0x551fa6){return{'name':_0x551fa6['fieldName'],'type':_0x551fa6[_0x656a('0x2c')][_0x656a('0x2d')]};});_0xb19ba7['model']=_[_0x656a('0x29')](_0x2ac965,_0x656a('0x28'));_0xb19ba7[_0x656a('0x2e')]=_[_0x656a('0x2f')](_0x47bcc0['query']);_0xb19ba7['filters']=_[_0x656a('0x30')](_0xb19ba7[_0x656a('0x31')],_0xb19ba7['query']);_0x49a723['attributes']=_[_0x656a('0x30')](_0xb19ba7[_0x656a('0x31')],qs[_0x656a('0x32')](_0x47bcc0['query']['fields']));_0x49a723[_0x656a('0x33')]=_0x49a723[_0x656a('0x33')][_0x656a('0x34')]?_0x49a723[_0x656a('0x33')]:_0xb19ba7[_0x656a('0x31')];if(!_0x47bcc0[_0x656a('0x2e')]['hasOwnProperty']('nolimit')){_0x49a723[_0x656a('0x1c')]=qs[_0x656a('0x1c')](_0x47bcc0['query'][_0x656a('0x1c')]);_0x49a723[_0x656a('0x1b')]=qs['offset'](_0x47bcc0[_0x656a('0x2e')][_0x656a('0x1b')]);}_0x49a723[_0x656a('0x35')]=qs[_0x656a('0x36')](_0x47bcc0[_0x656a('0x2e')][_0x656a('0x36')]);_0x49a723[_0x656a('0x37')]=qs[_0x656a('0x38')](_[_0x656a('0x39')](_0x47bcc0['query'],_0xb19ba7['filters']),_0x2ac965);if(_0x47bcc0['query'][_0x656a('0x3a')]){_0x49a723['where']=_[_0x656a('0x3b')](_0x49a723[_0x656a('0x37')],{'$or':_[_0x656a('0x29')](_0x2ac965,function(_0x1372dd){if(_0x1372dd['type']!==_0x656a('0x3c')){var _0x2a693e={};_0x2a693e[_0x1372dd[_0x656a('0x28')]]={'$like':'%'+_0x47bcc0[_0x656a('0x2e')][_0x656a('0x3a')]+'%'};return _0x2a693e;}})});}_0x49a723=_[_0x656a('0x3b')]({},_0x49a723,_0x47bcc0[_0x656a('0x3d')]);var _0x4f5399={'where':_0x49a723[_0x656a('0x37')]};return db[_0x656a('0x2a')][_0x656a('0x1a')](_0x4f5399)[_0x656a('0x26')](function(_0x34efa3){_0x5a756c[_0x656a('0x1a')]=_0x34efa3;if(_0x47bcc0[_0x656a('0x2e')][_0x656a('0x3e')]){_0x49a723[_0x656a('0x3f')]=[{'all':!![]}];}return db[_0x656a('0x2a')][_0x656a('0x40')](_0x49a723);})[_0x656a('0x26')](function(_0x3f969e){_0x5a756c[_0x656a('0x41')]=_0x3f969e;return _0x5a756c;})[_0x656a('0x26')](respondWithFilteredResult(_0x2a00ba,_0x49a723))[_0x656a('0x42')](handleError(_0x2a00ba,null));};exports[_0x656a('0x43')]=function(_0x511e00,_0x17e8fa){var _0x4b823a={'raw':![],'where':{'id':_0x511e00['params']['id']}},_0x5cee3f={};_0x5cee3f['model']=_[_0x656a('0x2f')](db['Campaign'][_0x656a('0x2b')]);_0x5cee3f[_0x656a('0x2e')]=_[_0x656a('0x2f')](_0x511e00[_0x656a('0x2e')]);_0x5cee3f[_0x656a('0x38')]=_[_0x656a('0x30')](_0x5cee3f[_0x656a('0x31')],_0x5cee3f['query']);_0x4b823a[_0x656a('0x33')]=_[_0x656a('0x30')](_0x5cee3f[_0x656a('0x31')],qs[_0x656a('0x32')](_0x511e00[_0x656a('0x2e')]['fields']));_0x4b823a['attributes']=_0x4b823a[_0x656a('0x33')][_0x656a('0x34')]?_0x4b823a[_0x656a('0x33')]:_0x5cee3f['model'];if(_0x511e00['query'][_0x656a('0x3e')]){_0x4b823a[_0x656a('0x3f')]=[{'all':!![]}];}_0x4b823a=_[_0x656a('0x3b')]({},_0x4b823a,_0x511e00[_0x656a('0x3d')]);return db[_0x656a('0x2a')][_0x656a('0x44')](_0x4b823a)[_0x656a('0x26')](handleEntityNotFound(_0x17e8fa,null))[_0x656a('0x26')](respondWithResult(_0x17e8fa,null))[_0x656a('0x42')](handleError(_0x17e8fa,null));};exports[_0x656a('0x45')]=function(_0xd5ad0d,_0x42560d){return db[_0x656a('0x2a')][_0x656a('0x45')](_0xd5ad0d[_0x656a('0x46')],{})['then'](function(_0x1f3b8e){var _0xd6af61=_0xd5ad0d['user']['get']({'plain':!![]});if(!_0xd6af61)throw new Error(_0x656a('0x47'));if(_0xd6af61[_0x656a('0x48')]==='user'){var _0x5167ad=_0x1f3b8e['get']({'plain':!![]});var _0x467016=_0x656a('0x49');return db[_0x656a('0x4a')][_0x656a('0x44')]({'where':{'name':_0x467016,'userProfileId':_0xd6af61[_0x656a('0x4b')]},'raw':!![]})[_0x656a('0x26')](function(_0x25039d){if(_0x25039d&&_0x25039d[_0x656a('0x4c')]===0x0){return db[_0x656a('0x25')]['create']({'name':_0x5167ad[_0x656a('0x28')],'resourceId':_0x5167ad['id'],'type':_0x25039d[_0x656a('0x28')],'sectionId':_0x25039d['id']},{})[_0x656a('0x26')](function(){return _0x1f3b8e;});}else{return _0x1f3b8e;}})[_0x656a('0x42')](function(_0x5b3632){logger[_0x656a('0x27')](_0x656a('0x4d'),_0x5b3632);throw _0x5b3632;});}return _0x1f3b8e;})[_0x656a('0x26')](respondWithResult(_0x42560d,0xc9))[_0x656a('0x42')](handleError(_0x42560d,null));};exports['clone']=function(_0x4d44e3,_0x4e86fc){var _0x136b17={'where':{'id':_0x4d44e3[_0x656a('0x4e')]['id']}},_0x3f3e97={};_0x3f3e97[_0x656a('0x31')]=_[_0x656a('0x2f')](db['Campaign'][_0x656a('0x2b')]);_0x136b17['attributes']=_[_0x656a('0x30')](_0x3f3e97[_0x656a('0x31')],qs[_0x656a('0x32')](_0x4d44e3['query']['fields']));_0x136b17[_0x656a('0x33')]=_0x136b17[_0x656a('0x33')][_0x656a('0x34')]?_0x136b17[_0x656a('0x33')]:_0x3f3e97['model'];if(_0x4d44e3[_0x656a('0x2e')]['includeAll']){_0x136b17[_0x656a('0x3f')]=[{'all':!![]}];}_0x136b17=_[_0x656a('0x3b')]({},_0x136b17,_0x4d44e3[_0x656a('0x3d')]);return db['Campaign']['find'](_0x136b17)[_0x656a('0x26')](handleEntityNotFound(_0x4e86fc,null))[_0x656a('0x26')](function(_0x1c7f00){if(_0x1c7f00){var _0x3f7603=_0x1c7f00[_0x656a('0x24')]({'plain':!![]});_0x3f7603=qs['omit'](_0x3f7603,['id',_0x656a('0x4f'),_0x656a('0x50')]);_0x4d44e3[_0x656a('0x46')]=_[_0x656a('0x51')](_0x4d44e3['body'],['id','createdAt',_0x656a('0x50')]);return db['Campaign']['create'](_['merge'](_0x3f7603,_0x4d44e3[_0x656a('0x46')]),{'include':_0x4d44e3[_0x656a('0x2e')][_0x656a('0x3e')]?[{'all':!![]}]:undefined})[_0x656a('0x26')](function(_0x320dce){var _0x468c18=_0x4d44e3[_0x656a('0x52')][_0x656a('0x24')]({'plain':!![]});if(!_0x468c18)throw new Error(_0x656a('0x47'));if(_0x468c18['role']==='user'){var _0x24ba37=_0x320dce[_0x656a('0x24')]({'plain':!![]});var _0x285f05=_0x656a('0x49');return db[_0x656a('0x4a')][_0x656a('0x44')]({'where':{'name':_0x285f05,'userProfileId':_0x468c18[_0x656a('0x4b')]},'raw':!![]})['then'](function(_0x3321cf){if(_0x3321cf&&_0x3321cf[_0x656a('0x4c')]===0x0){return db[_0x656a('0x25')]['create']({'name':_0x24ba37[_0x656a('0x28')],'resourceId':_0x24ba37['id'],'type':_0x3321cf['name'],'sectionId':_0x3321cf['id']},{})[_0x656a('0x26')](function(){return _0x320dce;});}else{return _0x320dce;}})[_0x656a('0x42')](function(_0x3cc741){logger[_0x656a('0x27')](_0x656a('0x4d'),_0x3cc741);throw _0x3cc741;});}return _0x320dce;});}})[_0x656a('0x26')](respondWithResult(_0x4e86fc,0xc9))[_0x656a('0x42')](handleError(_0x4e86fc,null));};exports[_0x656a('0x22')]=function(_0x29e7b6,_0x34449b){if(_0x29e7b6[_0x656a('0x46')]['id']){delete _0x29e7b6[_0x656a('0x46')]['id'];}return db[_0x656a('0x2a')][_0x656a('0x44')]({'where':{'id':_0x29e7b6[_0x656a('0x4e')]['id']}})[_0x656a('0x26')](handleEntityNotFound(_0x34449b,null))[_0x656a('0x26')](saveUpdates(_0x29e7b6['body'],null))[_0x656a('0x26')](respondWithResult(_0x34449b,null))[_0x656a('0x42')](handleError(_0x34449b,null));};exports[_0x656a('0x23')]=function(_0x4e3ef3,_0x51cbbf){return db[_0x656a('0x2a')][_0x656a('0x44')]({'where':{'id':_0x4e3ef3[_0x656a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x51cbbf,null))[_0x656a('0x26')](removeEntity(_0x51cbbf,null))[_0x656a('0x42')](handleError(_0x51cbbf,null));};exports['getHoppers']=function(_0x12891c,_0xce3544,_0x303713){var _0x4de495={'raw':!![],'where':{}};var _0xaef75b={};var _0x6db27={'count':0x0,'rows':[]};return db[_0x656a('0x2a')][_0x656a('0x53')]({'where':{'id':_0x12891c[_0x656a('0x4e')]['id']}})['then'](handleEntityNotFound(_0xce3544,null))['then'](function(_0x59191f){if(_0x59191f){_0xaef75b[_0x656a('0x31')]=_[_0x656a('0x2f')](db[_0x656a('0x54')]['rawAttributes']);_0xaef75b[_0x656a('0x2e')]=_[_0x656a('0x2f')](_0x12891c[_0x656a('0x2e')]);_0xaef75b[_0x656a('0x38')]=_['intersection'](_0xaef75b[_0x656a('0x31')],_0xaef75b[_0x656a('0x2e')]);_0x4de495[_0x656a('0x33')]=_[_0x656a('0x30')](_0xaef75b[_0x656a('0x31')],qs['fields'](_0x12891c[_0x656a('0x2e')][_0x656a('0x32')]));_0x4de495[_0x656a('0x33')]=_0x4de495[_0x656a('0x33')][_0x656a('0x34')]?_0x4de495['attributes']:_0xaef75b[_0x656a('0x31')];if(!_0x12891c[_0x656a('0x2e')][_0x656a('0x55')](_0x656a('0x56'))){_0x4de495['limit']=qs['limit'](_0x12891c[_0x656a('0x2e')]['limit']);_0x4de495[_0x656a('0x1b')]=qs[_0x656a('0x1b')](_0x12891c[_0x656a('0x2e')][_0x656a('0x1b')]);}_0x4de495[_0x656a('0x35')]=qs[_0x656a('0x36')](_0x12891c[_0x656a('0x2e')][_0x656a('0x36')]);_0x4de495[_0x656a('0x37')]=qs[_0x656a('0x38')](_[_0x656a('0x39')](_0x12891c[_0x656a('0x2e')],_0xaef75b[_0x656a('0x38')]));_0x4de495[_0x656a('0x37')]['CampaignId']=_0x59191f['id'];if(_0x12891c[_0x656a('0x2e')]['filter']){_0x4de495[_0x656a('0x37')]=_['merge'](_0x4de495[_0x656a('0x37')],{'$or':_['map'](_0x4de495[_0x656a('0x33')],function(_0x5d1fef){var _0xdc9451={};_0xdc9451[_0x5d1fef]={'$like':'%'+_0x12891c[_0x656a('0x2e')]['filter']+'%'};return _0xdc9451;})});}_0x4de495=_[_0x656a('0x3b')]({},_0x4de495,_0x12891c['options']);return db[_0x656a('0x54')][_0x656a('0x1a')]({'where':_0x4de495[_0x656a('0x37')]})[_0x656a('0x26')](function(_0x2239a2){_0x6db27['count']=_0x2239a2;if(_0x12891c[_0x656a('0x2e')][_0x656a('0x3e')]){_0x4de495[_0x656a('0x3f')]=[{'all':!![]}];}return db[_0x656a('0x54')]['findAll'](_0x4de495);})[_0x656a('0x26')](function(_0xbc202b){_0x6db27['rows']=_0xbc202b;return _0x6db27;});}})[_0x656a('0x26')](respondWithFilteredResult(_0xce3544,_0x4de495))[_0x656a('0x42')](handleError(_0xce3544,null));};exports[_0x656a('0x57')]=function(_0x5bbe5c,_0x121f7b,_0x153ef5){var _0x139675={'raw':!![],'where':{}};var _0x16d518={};var _0x3134a5={'count':0x0,'rows':[]};return db[_0x656a('0x2a')]['findOne']({'where':{'id':_0x5bbe5c['params']['id']}})[_0x656a('0x26')](handleEntityNotFound(_0x121f7b,null))[_0x656a('0x26')](function(_0x4496b4){if(_0x4496b4){_0x16d518[_0x656a('0x31')]=_[_0x656a('0x2f')](db[_0x656a('0x58')][_0x656a('0x2b')]);_0x16d518[_0x656a('0x2e')]=_[_0x656a('0x2f')](_0x5bbe5c[_0x656a('0x2e')]);_0x16d518[_0x656a('0x38')]=_[_0x656a('0x30')](_0x16d518[_0x656a('0x31')],_0x16d518['query']);_0x139675[_0x656a('0x33')]=_[_0x656a('0x30')](_0x16d518[_0x656a('0x31')],qs[_0x656a('0x32')](_0x5bbe5c[_0x656a('0x2e')]['fields']));_0x139675[_0x656a('0x33')]=_0x139675[_0x656a('0x33')][_0x656a('0x34')]?_0x139675[_0x656a('0x33')]:_0x16d518['model'];if(!_0x5bbe5c[_0x656a('0x2e')][_0x656a('0x55')]('nolimit')){_0x139675[_0x656a('0x1c')]=qs[_0x656a('0x1c')](_0x5bbe5c[_0x656a('0x2e')][_0x656a('0x1c')]);_0x139675[_0x656a('0x1b')]=qs[_0x656a('0x1b')](_0x5bbe5c[_0x656a('0x2e')][_0x656a('0x1b')]);}_0x139675[_0x656a('0x35')]=qs[_0x656a('0x36')](_0x5bbe5c[_0x656a('0x2e')][_0x656a('0x36')]);_0x139675['where']=qs[_0x656a('0x38')](_[_0x656a('0x39')](_0x5bbe5c[_0x656a('0x2e')],_0x16d518[_0x656a('0x38')]));_0x139675[_0x656a('0x37')]['CampaignId']=_0x4496b4['id'];if(_0x5bbe5c['query']['filter']){_0x139675[_0x656a('0x37')]=_['merge'](_0x139675[_0x656a('0x37')],{'$or':_[_0x656a('0x29')](_0x139675[_0x656a('0x33')],function(_0x53cfb1){var _0x3677d9={};_0x3677d9[_0x53cfb1]={'$like':'%'+_0x5bbe5c['query'][_0x656a('0x3a')]+'%'};return _0x3677d9;})});}_0x139675=_[_0x656a('0x3b')]({},_0x139675,_0x5bbe5c['options']);return db[_0x656a('0x58')][_0x656a('0x1a')]({'where':_0x139675[_0x656a('0x37')]})[_0x656a('0x26')](function(_0x442aba){_0x3134a5[_0x656a('0x1a')]=_0x442aba;if(_0x5bbe5c['query'][_0x656a('0x3e')]){_0x139675['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x656a('0x40')](_0x139675);})['then'](function(_0x8168d){_0x3134a5[_0x656a('0x41')]=_0x8168d;return _0x3134a5;});}})['then'](respondWithFilteredResult(_0x121f7b,_0x139675))[_0x656a('0x42')](handleError(_0x121f7b,null));};exports[_0x656a('0x59')]=function(_0x2699de,_0x2bfa72,_0x5acf77){var _0x1c940a={'raw':!![],'where':{}};var _0x2c0f53={};var _0x3ecdd8={'count':0x0,'rows':[]};return db['Campaign'][_0x656a('0x53')]({'where':{'id':_0x2699de[_0x656a('0x4e')]['id']}})[_0x656a('0x26')](handleEntityNotFound(_0x2bfa72,null))[_0x656a('0x26')](function(_0x25bb52){if(_0x25bb52){_0x2c0f53[_0x656a('0x31')]=_[_0x656a('0x2f')](db['CmHopperFinal'][_0x656a('0x2b')]);_0x2c0f53[_0x656a('0x2e')]=_['keys'](_0x2699de[_0x656a('0x2e')]);_0x2c0f53[_0x656a('0x38')]=_[_0x656a('0x30')](_0x2c0f53[_0x656a('0x31')],_0x2c0f53[_0x656a('0x2e')]);_0x1c940a[_0x656a('0x33')]=_[_0x656a('0x30')](_0x2c0f53[_0x656a('0x31')],qs[_0x656a('0x32')](_0x2699de[_0x656a('0x2e')][_0x656a('0x32')]));_0x1c940a[_0x656a('0x33')]=_0x1c940a[_0x656a('0x33')]['length']?_0x1c940a[_0x656a('0x33')]:_0x2c0f53['model'];if(!_0x2699de[_0x656a('0x2e')][_0x656a('0x55')](_0x656a('0x56'))){_0x1c940a[_0x656a('0x1c')]=qs['limit'](_0x2699de[_0x656a('0x2e')]['limit']);_0x1c940a[_0x656a('0x1b')]=qs[_0x656a('0x1b')](_0x2699de[_0x656a('0x2e')][_0x656a('0x1b')]);}_0x1c940a['order']=qs['sort'](_0x2699de[_0x656a('0x2e')][_0x656a('0x36')]);_0x1c940a[_0x656a('0x37')]=qs['filters'](_[_0x656a('0x39')](_0x2699de[_0x656a('0x2e')],_0x2c0f53['filters']));_0x1c940a[_0x656a('0x37')][_0x656a('0x5a')]=_0x25bb52['id'];if(_0x2699de[_0x656a('0x2e')][_0x656a('0x3a')]){_0x1c940a[_0x656a('0x37')]=_[_0x656a('0x3b')](_0x1c940a[_0x656a('0x37')],{'$or':_[_0x656a('0x29')](_0x1c940a[_0x656a('0x33')],function(_0x1dc862){var _0xa262fd={};_0xa262fd[_0x1dc862]={'$like':'%'+_0x2699de[_0x656a('0x2e')][_0x656a('0x3a')]+'%'};return _0xa262fd;})});}_0x1c940a=_[_0x656a('0x3b')]({},_0x1c940a,_0x2699de['options']);return db[_0x656a('0x5b')][_0x656a('0x1a')]({'where':_0x1c940a[_0x656a('0x37')]})[_0x656a('0x26')](function(_0x8bcf82){_0x3ecdd8['count']=_0x8bcf82;if(_0x2699de['query']['includeAll']){_0x1c940a[_0x656a('0x3f')]=[{'all':!![]}];}return db[_0x656a('0x5b')][_0x656a('0x40')](_0x1c940a);})[_0x656a('0x26')](function(_0x1bbbab){_0x3ecdd8[_0x656a('0x41')]=_0x1bbbab;return _0x3ecdd8;});}})[_0x656a('0x26')](respondWithFilteredResult(_0x2bfa72,_0x1c940a))['catch'](handleError(_0x2bfa72,null));};exports['getHopperBlacks']=function(_0x2549a4,_0x2c8871,_0x44ac0b){var _0x16f743={'raw':!![],'where':{}};var _0x16872a={};var _0x383d8a={'count':0x0,'rows':[]};return db[_0x656a('0x2a')]['findOne']({'where':{'id':_0x2549a4[_0x656a('0x4e')]['id']}})[_0x656a('0x26')](handleEntityNotFound(_0x2c8871,null))[_0x656a('0x26')](function(_0x477771){if(_0x477771){_0x16872a[_0x656a('0x31')]=_[_0x656a('0x2f')](db[_0x656a('0x5c')][_0x656a('0x2b')]);_0x16872a[_0x656a('0x2e')]=_['keys'](_0x2549a4[_0x656a('0x2e')]);_0x16872a[_0x656a('0x38')]=_[_0x656a('0x30')](_0x16872a[_0x656a('0x31')],_0x16872a[_0x656a('0x2e')]);_0x16f743[_0x656a('0x33')]=_[_0x656a('0x30')](_0x16872a[_0x656a('0x31')],qs[_0x656a('0x32')](_0x2549a4[_0x656a('0x2e')][_0x656a('0x32')]));_0x16f743[_0x656a('0x33')]=_0x16f743[_0x656a('0x33')]['length']?_0x16f743[_0x656a('0x33')]:_0x16872a[_0x656a('0x31')];if(!_0x2549a4[_0x656a('0x2e')][_0x656a('0x55')](_0x656a('0x56'))){_0x16f743[_0x656a('0x1c')]=qs[_0x656a('0x1c')](_0x2549a4[_0x656a('0x2e')][_0x656a('0x1c')]);_0x16f743[_0x656a('0x1b')]=qs[_0x656a('0x1b')](_0x2549a4['query'][_0x656a('0x1b')]);}_0x16f743[_0x656a('0x35')]=qs[_0x656a('0x36')](_0x2549a4[_0x656a('0x2e')]['sort']);_0x16f743[_0x656a('0x37')]=qs[_0x656a('0x38')](_[_0x656a('0x39')](_0x2549a4[_0x656a('0x2e')],_0x16872a[_0x656a('0x38')]));_0x16f743[_0x656a('0x37')][_0x656a('0x5a')]=_0x477771['id'];if(_0x2549a4['query'][_0x656a('0x3a')]){_0x16f743[_0x656a('0x37')]=_[_0x656a('0x3b')](_0x16f743[_0x656a('0x37')],{'$or':_[_0x656a('0x29')](_0x16f743[_0x656a('0x33')],function(_0x321454){var _0x329e7a={};_0x329e7a[_0x321454]={'$like':'%'+_0x2549a4['query'][_0x656a('0x3a')]+'%'};return _0x329e7a;})});}_0x16f743=_[_0x656a('0x3b')]({},_0x16f743,_0x2549a4[_0x656a('0x3d')]);return db[_0x656a('0x5c')][_0x656a('0x1a')]({'where':_0x16f743[_0x656a('0x37')]})[_0x656a('0x26')](function(_0x2295a1){_0x383d8a[_0x656a('0x1a')]=_0x2295a1;if(_0x2549a4[_0x656a('0x2e')][_0x656a('0x3e')]){_0x16f743[_0x656a('0x3f')]=[{'all':!![]}];}return db[_0x656a('0x5c')][_0x656a('0x40')](_0x16f743);})[_0x656a('0x26')](function(_0x2a8cd2){_0x383d8a[_0x656a('0x41')]=_0x2a8cd2;return _0x383d8a;});}})[_0x656a('0x26')](respondWithFilteredResult(_0x2c8871,_0x16f743))['catch'](handleError(_0x2c8871,null));};exports[_0x656a('0x5d')]=function(_0x5579db,_0x349e53,_0x3ae64d){var _0x25ae81={};var _0x11c9ff={};var _0x5d8d2a;var _0x709242;return db[_0x656a('0x2a')][_0x656a('0x53')]({'where':{'id':_0x5579db[_0x656a('0x4e')]['id']}})[_0x656a('0x26')](handleEntityNotFound(_0x349e53,null))[_0x656a('0x26')](function(_0x838cf0){if(_0x838cf0){_0x5d8d2a=_0x838cf0;_0x11c9ff[_0x656a('0x31')]=_[_0x656a('0x2f')](db[_0x656a('0x5e')]['rawAttributes']);_0x11c9ff[_0x656a('0x2e')]=_[_0x656a('0x2f')](_0x5579db['query']);_0x11c9ff[_0x656a('0x38')]=_['intersection'](_0x11c9ff[_0x656a('0x31')],_0x11c9ff['query']);_0x25ae81[_0x656a('0x33')]=_['intersection'](_0x11c9ff[_0x656a('0x31')],qs[_0x656a('0x32')](_0x5579db[_0x656a('0x2e')][_0x656a('0x32')]));_0x25ae81[_0x656a('0x33')]=_0x25ae81['attributes'][_0x656a('0x34')]?_0x25ae81['attributes']:_0x11c9ff['model'];_0x25ae81[_0x656a('0x35')]=qs[_0x656a('0x36')](_0x5579db['query'][_0x656a('0x36')]);_0x25ae81[_0x656a('0x37')]=qs['filters'](_[_0x656a('0x39')](_0x5579db['query'],_0x11c9ff[_0x656a('0x38')]));if(_0x5579db[_0x656a('0x2e')][_0x656a('0x3a')]){_0x25ae81[_0x656a('0x37')]=_[_0x656a('0x3b')](_0x25ae81['where'],{'$or':_['map'](_0x25ae81[_0x656a('0x33')],function(_0x3d3ddc){var _0x1d6ece={};_0x1d6ece[_0x3d3ddc]={'$like':'%'+_0x5579db[_0x656a('0x2e')][_0x656a('0x3a')]+'%'};return _0x1d6ece;})});}_0x25ae81=_[_0x656a('0x3b')]({},_0x25ae81,_0x5579db[_0x656a('0x3d')]);return _0x5d8d2a['getLists'](_0x25ae81);}})[_0x656a('0x26')](function(_0x35a28b){if(_0x35a28b){_0x709242=_0x35a28b[_0x656a('0x34')];if(!_0x5579db['query']['hasOwnProperty'](_0x656a('0x56'))){_0x25ae81[_0x656a('0x1c')]=qs[_0x656a('0x1c')](_0x5579db['query']['limit']);_0x25ae81[_0x656a('0x1b')]=qs['offset'](_0x5579db[_0x656a('0x2e')][_0x656a('0x1b')]);}return _0x5d8d2a[_0x656a('0x5d')](_0x25ae81);}})['then'](function(_0xa73c7c){if(_0xa73c7c){return _0xa73c7c?{'count':_0x709242,'rows':_0xa73c7c}:null;}})[_0x656a('0x26')](respondWithResult(_0x349e53,null))[_0x656a('0x42')](handleError(_0x349e53,null));};exports['addLists']=function(_0x514606,_0x54c3b1,_0x4e6745){var _0x2c9d86,_0x5e50cd;return db[_0x656a('0x2a')][_0x656a('0x44')]({'where':{'id':_0x514606[_0x656a('0x4e')]['id']}})[_0x656a('0x26')](handleEntityNotFound(_0x54c3b1,null))[_0x656a('0x26')](function(_0x5cabd3){if(_0x5cabd3){_0x5e50cd=_0x5cabd3;return _0x5cabd3[_0x656a('0x5f')](_0x514606[_0x656a('0x46')][_0x656a('0x60')],_[_0x656a('0x51')](_0x514606[_0x656a('0x46')],[_0x656a('0x60'),'id'])||{});}return null;})[_0x656a('0x61')](function(_0x2e893c){var _0x4b3e0c;_0x2c9d86=_0x2e893c||[];var _0x3fa07c=[];if(_0x2e893c){for(var _0x51108c=0x0;_0x51108c<_0x2e893c['length'];_0x51108c+=0x1){var _0x1da17a=_0x2e893c[_0x51108c][_0x656a('0x24')]({'plain':!![]});_0x5e50cd[_0x656a('0x62')]=_0x514606[_0x656a('0x46')][_0x656a('0x62')]?_0x514606[_0x656a('0x46')][_0x656a('0x62')]:_0x5e50cd[_0x656a('0x62')];switch(_0x5e50cd[_0x656a('0x62')]){case'always':_0x4b3e0c=squel[_0x656a('0x63')]()[_0x656a('0x64')](_0x656a('0x65'))[_0x656a('0x66')]([_0x656a('0x67'),_0x656a('0x68'),'ContactId',_0x656a('0x69'),_0x656a('0x5a'),_0x656a('0x4f'),_0x656a('0x50')],squel[_0x656a('0x6a')]()[_0x656a('0x6b')](_0x656a('0x67'),_0x656a('0x67'))['field'](_0x656a('0x6c'),_0x656a('0x68'))[_0x656a('0x6b')]('id',_0x656a('0x6d'))['field'](_0x1da17a[_0x656a('0x6e')][_0x656a('0x6f')](),_0x656a('0x69'))[_0x656a('0x6b')](_0x514606[_0x656a('0x4e')]['id'][_0x656a('0x6f')](),_0x656a('0x5a'))[_0x656a('0x6b')]('NOW()',_0x656a('0x4f'))[_0x656a('0x6b')](_0x656a('0x6c'),_0x656a('0x50'))[_0x656a('0x70')](_0x656a('0x71'))['where'](_0x656a('0x72'))[_0x656a('0x37')]('ListId\x20=\x20?',_0x1da17a[_0x656a('0x6e')][_0x656a('0x6f')]())[_0x656a('0x37')](_0x656a('0x73'))['where'](_0x656a('0x74'),squel[_0x656a('0x6a')]()['field'](_0x656a('0x75'))[_0x656a('0x70')](_0x656a('0x76'))[_0x656a('0x37')]('CampaignId\x20=\x20?',_0x514606[_0x656a('0x4e')]['id']['toString']()))['where'](_0x656a('0x74'),squel[_0x656a('0x6a')]()[_0x656a('0x6b')](_0x656a('0x77'))[_0x656a('0x70')]('cm_hopper')[_0x656a('0x37')](_0x656a('0x78'),_0x514606['params']['id'][_0x656a('0x6f')]())))[_0x656a('0x6f')]();break;case _0x656a('0x79'):_0x4b3e0c=squel[_0x656a('0x63')]()[_0x656a('0x64')](_0x656a('0x65'))[_0x656a('0x66')](['phone',_0x656a('0x68'),_0x656a('0x6d'),_0x656a('0x69'),_0x656a('0x5a'),_0x656a('0x4f'),_0x656a('0x50')],squel[_0x656a('0x6a')]()[_0x656a('0x6b')](_0x656a('0x67'),_0x656a('0x67'))[_0x656a('0x6b')]('NOW()',_0x656a('0x68'))['field']('id','ContactId')['field'](_0x1da17a[_0x656a('0x6e')]['toString'](),'ListId')[_0x656a('0x6b')](_0x514606[_0x656a('0x4e')]['id']['toString'](),_0x656a('0x5a'))[_0x656a('0x6b')](_0x656a('0x6c'),_0x656a('0x4f'))[_0x656a('0x6b')]('NOW()','updatedAt')[_0x656a('0x70')]('cm_contacts')[_0x656a('0x37')](_0x656a('0x72'))[_0x656a('0x37')](_0x656a('0x7a'),_0x1da17a[_0x656a('0x6e')][_0x656a('0x6f')]())['where'](_0x656a('0x73'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x656a('0x6a')]()['field'](_0x656a('0x77'))['from'](_0x656a('0x65'))[_0x656a('0x37')](_0x656a('0x78'),_0x514606[_0x656a('0x4e')]['id'][_0x656a('0x6f')]())))[_0x656a('0x6f')]();break;default:_0x4b3e0c=squel['insert']()['into'](_0x656a('0x65'))[_0x656a('0x66')]([_0x656a('0x67'),'scheduledAt',_0x656a('0x6d'),_0x656a('0x69'),_0x656a('0x5a'),_0x656a('0x4f'),_0x656a('0x50')],squel['select']()[_0x656a('0x6b')](_0x656a('0x67'),_0x656a('0x67'))['field'](_0x656a('0x6c'),_0x656a('0x68'))['field']('id','ContactId')[_0x656a('0x6b')](_0x1da17a[_0x656a('0x6e')][_0x656a('0x6f')](),_0x656a('0x69'))['field'](_0x514606[_0x656a('0x4e')]['id'][_0x656a('0x6f')](),_0x656a('0x5a'))['field']('NOW()',_0x656a('0x4f'))['field'](_0x656a('0x6c'),_0x656a('0x50'))[_0x656a('0x70')](_0x656a('0x71'))[_0x656a('0x37')]('deletedAt\x20IS\x20NULL')[_0x656a('0x37')](_0x656a('0x7a'),_0x1da17a[_0x656a('0x6e')]['toString']())[_0x656a('0x37')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x3fa07c[_0x656a('0x7b')](db['sequelize']['query'](_0x4b3e0c));}return BPromise[_0x656a('0x7c')](_0x3fa07c);}})['then'](function(){return _0x2c9d86;})[_0x656a('0x26')](respondWithResult(_0x54c3b1,null))[_0x656a('0x42')](handleError(_0x54c3b1,null));};exports[_0x656a('0x7d')]=function(_0x2ea63a,_0x883e2a,_0x492f9b){return db[_0x656a('0x2a')]['find']({'where':{'id':_0x2ea63a[_0x656a('0x4e')]['id']}})[_0x656a('0x26')](handleEntityNotFound(_0x883e2a,null))[_0x656a('0x26')](function(_0x3967c5){if(_0x3967c5){return _0x3967c5[_0x656a('0x7d')](_0x2ea63a[_0x656a('0x2e')][_0x656a('0x60')]);}})['then'](function(_0x2a59a6){if(_0x2a59a6){return db[_0x656a('0x54')][_0x656a('0x23')]({'where':{'ListId':_0x2ea63a['query'][_0x656a('0x60')],'CampaignId':_0x2ea63a[_0x656a('0x4e')]['id']}})[_0x656a('0x26')](function(){return _0x2a59a6;});}})[_0x656a('0x26')](respondWithStatusCode(_0x883e2a,null))[_0x656a('0x42')](handleError(_0x883e2a,null));};exports[_0x656a('0x7e')]=function(_0x3c926f,_0x94689a,_0x5754b2){var _0x467d77={'raw':!![],'where':{}};var _0x3ddba0={};var _0x4bd5bc={'count':0x0,'rows':[]};return db[_0x656a('0x2a')][_0x656a('0x53')]({'where':{'id':_0x3c926f['params']['id']}})['then'](handleEntityNotFound(_0x94689a,null))[_0x656a('0x26')](function(_0x1a837d){if(_0x1a837d){_0x3ddba0['model']=_[_0x656a('0x2f')](db['CmList'][_0x656a('0x2b')]);_0x3ddba0[_0x656a('0x2e')]=_[_0x656a('0x2f')](_0x3c926f[_0x656a('0x2e')]);_0x3ddba0['filters']=_['intersection'](_0x3ddba0[_0x656a('0x31')],_0x3ddba0[_0x656a('0x2e')]);_0x467d77['attributes']=_[_0x656a('0x30')](_0x3ddba0[_0x656a('0x31')],qs[_0x656a('0x32')](_0x3c926f[_0x656a('0x2e')][_0x656a('0x32')]));_0x467d77[_0x656a('0x33')]=_0x467d77['attributes'][_0x656a('0x34')]?_0x467d77['attributes']:_0x3ddba0['model'];if(!_0x3c926f[_0x656a('0x2e')][_0x656a('0x55')](_0x656a('0x56'))){_0x467d77['limit']=qs[_0x656a('0x1c')](_0x3c926f[_0x656a('0x2e')][_0x656a('0x1c')]);_0x467d77[_0x656a('0x1b')]=qs[_0x656a('0x1b')](_0x3c926f[_0x656a('0x2e')][_0x656a('0x1b')]);}_0x467d77[_0x656a('0x35')]=qs[_0x656a('0x36')](_0x3c926f['query']['sort']);_0x467d77[_0x656a('0x37')]=qs[_0x656a('0x38')](_[_0x656a('0x39')](_0x3c926f['query'],_0x3ddba0['filters']));_0x467d77[_0x656a('0x37')][_0x656a('0x5a')]=_0x1a837d['id'];if(_0x3c926f[_0x656a('0x2e')][_0x656a('0x3a')]){_0x467d77[_0x656a('0x37')]=_[_0x656a('0x3b')](_0x467d77[_0x656a('0x37')],{'$or':_[_0x656a('0x29')](_0x467d77[_0x656a('0x33')],function(_0x32567f){var _0xfa54f0={};_0xfa54f0[_0x32567f]={'$like':'%'+_0x3c926f['query'][_0x656a('0x3a')]+'%'};return _0xfa54f0;})});}_0x467d77=_[_0x656a('0x3b')]({},_0x467d77,_0x3c926f[_0x656a('0x3d')]);return db['CmList'][_0x656a('0x1a')]({'where':_0x467d77[_0x656a('0x37')]})[_0x656a('0x26')](function(_0x140f75){_0x4bd5bc[_0x656a('0x1a')]=_0x140f75;if(_0x3c926f['query'][_0x656a('0x3e')]){_0x467d77['include']=[{'all':!![]}];}return db[_0x656a('0x5e')][_0x656a('0x40')](_0x467d77);})['then'](function(_0x1d10a6){_0x4bd5bc[_0x656a('0x41')]=_0x1d10a6;return _0x4bd5bc;});}})[_0x656a('0x26')](respondWithFilteredResult(_0x94689a,_0x467d77))[_0x656a('0x42')](handleError(_0x94689a,null));};exports[_0x656a('0x7f')]=function(_0x3c867b,_0x23cfa4,_0x324ef2){var _0xb802fe,_0x29dcda;return db[_0x656a('0x2a')][_0x656a('0x44')]({'where':{'id':_0x3c867b[_0x656a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x23cfa4,null))[_0x656a('0x26')](function(_0x534ce4){if(_0x534ce4){_0x29dcda=_0x534ce4;return _0x534ce4[_0x656a('0x7f')](_0x3c867b[_0x656a('0x46')][_0x656a('0x60')],_['omit'](_0x3c867b[_0x656a('0x46')],[_0x656a('0x60'),'id'])||{});}return null;})['spread'](function(_0x1ebb80){var _0xf2569e;_0xb802fe=_0x1ebb80||[];var _0x26ce9c=[];if(_0x1ebb80){for(var _0x4216e5=0x0;_0x4216e5<_0x1ebb80[_0x656a('0x34')];_0x4216e5+=0x1){var _0x30a60e=_0x1ebb80[_0x4216e5]['get']({'plain':!![]});_0xf2569e=squel[_0x656a('0x63')]()[_0x656a('0x64')](_0x656a('0x80'))[_0x656a('0x66')]([_0x656a('0x67'),'ContactId','ListId',_0x656a('0x5a'),_0x656a('0x4f'),_0x656a('0x50')],squel['select']()['field'](_0x656a('0x67'),'phone')[_0x656a('0x6b')]('id','ContactId')[_0x656a('0x6b')](_0x30a60e[_0x656a('0x6e')][_0x656a('0x6f')](),'ListId')[_0x656a('0x6b')](_0x3c867b[_0x656a('0x4e')]['id']['toString'](),_0x656a('0x5a'))[_0x656a('0x6b')](_0x656a('0x6c'),_0x656a('0x4f'))[_0x656a('0x6b')]('NOW()',_0x656a('0x50'))[_0x656a('0x70')](_0x656a('0x71'))[_0x656a('0x37')]('deletedAt\x20IS\x20NULL')[_0x656a('0x37')](_0x656a('0x7a'),_0x30a60e['CmListId'][_0x656a('0x6f')]())[_0x656a('0x37')](_0x656a('0x73')))[_0x656a('0x6f')]();_0x26ce9c[_0x656a('0x7b')](db[_0x656a('0x81')][_0x656a('0x2e')](_0xf2569e));}return BPromise[_0x656a('0x7c')](_0x26ce9c);}})[_0x656a('0x26')](function(){return _0xb802fe;})['then'](respondWithResult(_0x23cfa4,null))[_0x656a('0x42')](handleError(_0x23cfa4,null));};exports[_0x656a('0x82')]=function(_0x253c06,_0x42de4c,_0x1b99e2){return db['Campaign'][_0x656a('0x44')]({'where':{'id':_0x253c06[_0x656a('0x4e')]['id']}})[_0x656a('0x26')](handleEntityNotFound(_0x42de4c,null))[_0x656a('0x26')](function(_0xbcd8dc){if(_0xbcd8dc){return _0xbcd8dc[_0x656a('0x82')](_0x253c06[_0x656a('0x2e')][_0x656a('0x60')]);}})['then'](function(_0x2cf813){if(_0x2cf813){return db['CmHopperBlack'][_0x656a('0x23')]({'where':{'ListId':_0x253c06[_0x656a('0x2e')][_0x656a('0x60')],'CampaignId':_0x253c06[_0x656a('0x4e')]['id']}})['then'](function(){return _0x2cf813;});}})[_0x656a('0x26')](respondWithStatusCode(_0x42de4c,null))['catch'](handleError(_0x42de4c,null));}; \ No newline at end of file +var _0xa9cd=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','count','includeAll','include','rows','catch','keys','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','update','getHoppers','findOne','CmHopper','filter','getHopperHistories','CmHopperHistory','CampaignId','findAll','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','sequelize','removeBlackLists','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','key','model','query','filters','attributes','intersection'];(function(_0x25e15d,_0x26db82){var _0x5469ec=function(_0x5d95af){while(--_0x5d95af){_0x25e15d['push'](_0x25e15d['shift']());}};_0x5469ec(++_0x26db82);}(_0xa9cd,0x153));var _0xda9c=function(_0x1131b8,_0xf9ce85){_0x1131b8=_0x1131b8-0x0;var _0x2963da=_0xa9cd[_0x1131b8];return _0x2963da;};'use strict';var pdf=require(_0xda9c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xda9c('0x1'));var jsonpatch=require(_0xda9c('0x2'));var rp=require(_0xda9c('0x3'));var moment=require(_0xda9c('0x4'));var BPromise=require(_0xda9c('0x5'));var Mustache=require(_0xda9c('0x6'));var util=require(_0xda9c('0x7'));var path=require(_0xda9c('0x8'));var sox=require(_0xda9c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xda9c('0xa'));var squel=require(_0xda9c('0xb'));var crypto=require('crypto');var jsforce=require(_0xda9c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda9c('0xd'));var Papa=require('papaparse');var Redis=require(_0xda9c('0xe'));var authService=require(_0xda9c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xda9c('0x10'));var hardwareService=require(_0xda9c('0x11'));var logger=require('../../config/logger')(_0xda9c('0x12'));var utils=require(_0xda9c('0x13'));var config=require(_0xda9c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5704e6,_0x25ac61){_0x25ac61=_0x25ac61||0xcc;return function(_0x2c69d8){if(_0x2c69d8){return _0x5704e6['sendStatus'](_0x25ac61);}return _0x5704e6[_0xda9c('0x15')](_0x25ac61)[_0xda9c('0x16')]();};}function respondWithResult(_0x3e61d3,_0x3f99ee){_0x3f99ee=_0x3f99ee||0xc8;return function(_0x3ea53e){if(_0x3ea53e){return _0x3e61d3[_0xda9c('0x15')](_0x3f99ee)[_0xda9c('0x17')](_0x3ea53e);}};}function respondWithFilteredResult(_0x35bc59,_0xc74c80){return function(_0x261a76){if(_0x261a76){var _0x437673=_0x261a76['count'],_0x4f3e2d=_0xc74c80[_0xda9c('0x18')],_0x3a2ea2=_0xc74c80['offset']+_0xc74c80[_0xda9c('0x19')],_0x322758;if(_0x3a2ea2>=_0x437673){_0x3a2ea2=_0x437673;_0x322758=0xc8;}else{_0x322758=0xce;}_0x35bc59[_0xda9c('0x15')](_0x322758);return _0x35bc59[_0xda9c('0x1a')](_0xda9c('0x1b'),_0x4f3e2d+'-'+_0x3a2ea2+'/'+_0x437673)[_0xda9c('0x17')](_0x261a76);}return null;};}function patchUpdates(_0x487860){return function(_0x19103f){try{jsonpatch['apply'](_0x19103f,_0x487860,!![]);}catch(_0x49b0db){return BPromise[_0xda9c('0x1c')](_0x49b0db);}return _0x19103f[_0xda9c('0x1d')]();};}function saveUpdates(_0x1deeac,_0x24ae92){return function(_0x719a95){if(_0x719a95){return _0x719a95['update'](_0x1deeac)[_0xda9c('0x1e')](function(_0x166d0c){return _0x166d0c;});}return null;};}function removeEntity(_0x4bd3ad,_0x520ad7){return function(_0x310f78){if(_0x310f78){return _0x310f78[_0xda9c('0x1f')]()['then'](function(){var _0x6c55a1=_0x310f78[_0xda9c('0x20')]({'plain':!![]});var _0x42674e=_0xda9c('0x21');return db[_0xda9c('0x22')][_0xda9c('0x1f')]({'where':{'type':_0x42674e,'resourceId':_0x6c55a1['id']}})[_0xda9c('0x1e')](function(){return _0x310f78;});})[_0xda9c('0x1e')](function(){_0x4bd3ad[_0xda9c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c5da,_0x274ff9){return function(_0x562312){if(!_0x562312){_0x54c5da['sendStatus'](0x194);}return _0x562312;};}function handleError(_0x31c729,_0x123551){_0x123551=_0x123551||0x1f4;return function(_0x5efb27){logger['error'](_0x5efb27[_0xda9c('0x23')]);if(_0x5efb27['name']){delete _0x5efb27[_0xda9c('0x24')];}_0x31c729[_0xda9c('0x15')](_0x123551)[_0xda9c('0x25')](_0x5efb27);};}exports[_0xda9c('0x26')]=function(_0x1b06d7,_0x5ce362){var _0x2873be={},_0x5dcfe8={},_0x88ecd7={'count':0x0,'rows':[]};var _0x61896a=_[_0xda9c('0x27')](db[_0xda9c('0x28')][_0xda9c('0x29')],function(_0x5c71af){return{'name':_0x5c71af['fieldName'],'type':_0x5c71af['type'][_0xda9c('0x2a')]};});_0x5dcfe8[_0xda9c('0x2b')]=_[_0xda9c('0x27')](_0x61896a,'name');_0x5dcfe8[_0xda9c('0x2c')]=_['keys'](_0x1b06d7[_0xda9c('0x2c')]);_0x5dcfe8[_0xda9c('0x2d')]=_['intersection'](_0x5dcfe8['model'],_0x5dcfe8[_0xda9c('0x2c')]);_0x2873be[_0xda9c('0x2e')]=_[_0xda9c('0x2f')](_0x5dcfe8[_0xda9c('0x2b')],qs[_0xda9c('0x30')](_0x1b06d7[_0xda9c('0x2c')][_0xda9c('0x30')]));_0x2873be['attributes']=_0x2873be[_0xda9c('0x2e')][_0xda9c('0x31')]?_0x2873be['attributes']:_0x5dcfe8[_0xda9c('0x2b')];if(!_0x1b06d7[_0xda9c('0x2c')][_0xda9c('0x32')](_0xda9c('0x33'))){_0x2873be[_0xda9c('0x19')]=qs[_0xda9c('0x19')](_0x1b06d7['query'][_0xda9c('0x19')]);_0x2873be[_0xda9c('0x18')]=qs[_0xda9c('0x18')](_0x1b06d7[_0xda9c('0x2c')][_0xda9c('0x18')]);}_0x2873be[_0xda9c('0x34')]=qs[_0xda9c('0x35')](_0x1b06d7[_0xda9c('0x2c')][_0xda9c('0x35')]);_0x2873be[_0xda9c('0x36')]=qs[_0xda9c('0x2d')](_[_0xda9c('0x37')](_0x1b06d7[_0xda9c('0x2c')],_0x5dcfe8['filters']),_0x61896a);if(_0x1b06d7[_0xda9c('0x2c')]['filter']){_0x2873be['where']=_['merge'](_0x2873be[_0xda9c('0x36')],{'$or':_[_0xda9c('0x27')](_0x61896a,function(_0x34d131){if(_0x34d131['type']!==_0xda9c('0x38')){var _0xb0a5fa={};_0xb0a5fa[_0x34d131[_0xda9c('0x24')]]={'$like':'%'+_0x1b06d7[_0xda9c('0x2c')]['filter']+'%'};return _0xb0a5fa;}})});}_0x2873be=_['merge']({},_0x2873be,_0x1b06d7[_0xda9c('0x39')]);var _0x3aa65c={'where':_0x2873be[_0xda9c('0x36')]};return db[_0xda9c('0x28')][_0xda9c('0x3a')](_0x3aa65c)[_0xda9c('0x1e')](function(_0x5224d1){_0x88ecd7[_0xda9c('0x3a')]=_0x5224d1;if(_0x1b06d7[_0xda9c('0x2c')][_0xda9c('0x3b')]){_0x2873be[_0xda9c('0x3c')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x2873be);})['then'](function(_0x2541ad){_0x88ecd7[_0xda9c('0x3d')]=_0x2541ad;return _0x88ecd7;})[_0xda9c('0x1e')](respondWithFilteredResult(_0x5ce362,_0x2873be))[_0xda9c('0x3e')](handleError(_0x5ce362,null));};exports['show']=function(_0x53630b,_0x129f93){var _0x2d09e3={'raw':![],'where':{'id':_0x53630b['params']['id']}},_0x4b55c1={};_0x4b55c1[_0xda9c('0x2b')]=_[_0xda9c('0x3f')](db[_0xda9c('0x28')][_0xda9c('0x29')]);_0x4b55c1[_0xda9c('0x2c')]=_['keys'](_0x53630b[_0xda9c('0x2c')]);_0x4b55c1[_0xda9c('0x2d')]=_['intersection'](_0x4b55c1['model'],_0x4b55c1[_0xda9c('0x2c')]);_0x2d09e3[_0xda9c('0x2e')]=_[_0xda9c('0x2f')](_0x4b55c1[_0xda9c('0x2b')],qs['fields'](_0x53630b['query']['fields']));_0x2d09e3[_0xda9c('0x2e')]=_0x2d09e3['attributes'][_0xda9c('0x31')]?_0x2d09e3[_0xda9c('0x2e')]:_0x4b55c1[_0xda9c('0x2b')];if(_0x53630b[_0xda9c('0x2c')][_0xda9c('0x3b')]){_0x2d09e3[_0xda9c('0x3c')]=[{'all':!![]}];}_0x2d09e3=_[_0xda9c('0x40')]({},_0x2d09e3,_0x53630b[_0xda9c('0x39')]);return db[_0xda9c('0x28')][_0xda9c('0x41')](_0x2d09e3)['then'](handleEntityNotFound(_0x129f93,null))[_0xda9c('0x1e')](respondWithResult(_0x129f93,null))['catch'](handleError(_0x129f93,null));};exports[_0xda9c('0x42')]=function(_0x3fcdba,_0x3924ac){return db[_0xda9c('0x28')][_0xda9c('0x42')](_0x3fcdba[_0xda9c('0x43')],{})['then'](function(_0x35a008){var _0x485604=_0x3fcdba[_0xda9c('0x44')][_0xda9c('0x20')]({'plain':!![]});if(!_0x485604)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x485604[_0xda9c('0x45')]===_0xda9c('0x44')){var _0x307b7c=_0x35a008[_0xda9c('0x20')]({'plain':!![]});var _0x19d762=_0xda9c('0x21');return db[_0xda9c('0x46')][_0xda9c('0x41')]({'where':{'name':_0x19d762,'userProfileId':_0x485604[_0xda9c('0x47')]},'raw':!![]})[_0xda9c('0x1e')](function(_0x5a306c){if(_0x5a306c&&_0x5a306c[_0xda9c('0x48')]===0x0){return db[_0xda9c('0x22')]['create']({'name':_0x307b7c['name'],'resourceId':_0x307b7c['id'],'type':_0x5a306c[_0xda9c('0x24')],'sectionId':_0x5a306c['id']},{})[_0xda9c('0x1e')](function(){return _0x35a008;});}else{return _0x35a008;}})[_0xda9c('0x3e')](function(_0x500df8){logger[_0xda9c('0x49')](_0xda9c('0x4a'),_0x500df8);throw _0x500df8;});}return _0x35a008;})[_0xda9c('0x1e')](respondWithResult(_0x3924ac,0xc9))[_0xda9c('0x3e')](handleError(_0x3924ac,null));};exports[_0xda9c('0x4b')]=function(_0x381327,_0x35880b){var _0x1d4ff4={'where':{'id':_0x381327[_0xda9c('0x4c')]['id']}},_0x333e58={};_0x333e58[_0xda9c('0x2b')]=_[_0xda9c('0x3f')](db[_0xda9c('0x28')][_0xda9c('0x29')]);_0x1d4ff4['attributes']=_[_0xda9c('0x2f')](_0x333e58['model'],qs[_0xda9c('0x30')](_0x381327[_0xda9c('0x2c')][_0xda9c('0x30')]));_0x1d4ff4[_0xda9c('0x2e')]=_0x1d4ff4[_0xda9c('0x2e')][_0xda9c('0x31')]?_0x1d4ff4[_0xda9c('0x2e')]:_0x333e58[_0xda9c('0x2b')];if(_0x381327[_0xda9c('0x2c')][_0xda9c('0x3b')]){_0x1d4ff4[_0xda9c('0x3c')]=[{'all':!![]}];}_0x1d4ff4=_[_0xda9c('0x40')]({},_0x1d4ff4,_0x381327[_0xda9c('0x39')]);return db[_0xda9c('0x28')][_0xda9c('0x41')](_0x1d4ff4)[_0xda9c('0x1e')](handleEntityNotFound(_0x35880b,null))['then'](function(_0x548608){if(_0x548608){var _0xd2a5e7=_0x548608[_0xda9c('0x20')]({'plain':!![]});_0xd2a5e7=qs[_0xda9c('0x4d')](_0xd2a5e7,['id',_0xda9c('0x4e'),'updatedAt']);_0x381327[_0xda9c('0x43')]=_[_0xda9c('0x4d')](_0x381327['body'],['id',_0xda9c('0x4e'),_0xda9c('0x4f')]);return db[_0xda9c('0x28')][_0xda9c('0x42')](_['merge'](_0xd2a5e7,_0x381327[_0xda9c('0x43')]),{'include':_0x381327[_0xda9c('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0xda9c('0x1e')](function(_0x174e60){var _0x5a72b2=_0x381327[_0xda9c('0x44')]['get']({'plain':!![]});if(!_0x5a72b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a72b2[_0xda9c('0x45')]===_0xda9c('0x44')){var _0x26584a=_0x174e60[_0xda9c('0x20')]({'plain':!![]});var _0x141d0e='IvrCampaigns';return db[_0xda9c('0x46')][_0xda9c('0x41')]({'where':{'name':_0x141d0e,'userProfileId':_0x5a72b2[_0xda9c('0x47')]},'raw':!![]})['then'](function(_0xa47b97){if(_0xa47b97&&_0xa47b97[_0xda9c('0x48')]===0x0){return db[_0xda9c('0x22')][_0xda9c('0x42')]({'name':_0x26584a['name'],'resourceId':_0x26584a['id'],'type':_0xa47b97[_0xda9c('0x24')],'sectionId':_0xa47b97['id']},{})[_0xda9c('0x1e')](function(){return _0x174e60;});}else{return _0x174e60;}})[_0xda9c('0x3e')](function(_0x970431){logger[_0xda9c('0x49')](_0xda9c('0x4a'),_0x970431);throw _0x970431;});}return _0x174e60;});}})[_0xda9c('0x1e')](respondWithResult(_0x35880b,0xc9))[_0xda9c('0x3e')](handleError(_0x35880b,null));};exports[_0xda9c('0x50')]=function(_0x516a1f,_0xcc4be5){if(_0x516a1f[_0xda9c('0x43')]['id']){delete _0x516a1f['body']['id'];}return db[_0xda9c('0x28')]['find']({'where':{'id':_0x516a1f['params']['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0xcc4be5,null))[_0xda9c('0x1e')](saveUpdates(_0x516a1f[_0xda9c('0x43')],null))[_0xda9c('0x1e')](respondWithResult(_0xcc4be5,null))[_0xda9c('0x3e')](handleError(_0xcc4be5,null));};exports['destroy']=function(_0xed511d,_0xe9a3ee){return db['Campaign']['find']({'where':{'id':_0xed511d[_0xda9c('0x4c')]['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0xe9a3ee,null))[_0xda9c('0x1e')](removeEntity(_0xe9a3ee,null))[_0xda9c('0x3e')](handleError(_0xe9a3ee,null));};exports[_0xda9c('0x51')]=function(_0x76f3b0,_0xfd64f,_0x2a7fef){var _0x114135={'raw':!![],'where':{}};var _0x466da9={};var _0x34f8c0={'count':0x0,'rows':[]};return db['Campaign'][_0xda9c('0x52')]({'where':{'id':_0x76f3b0[_0xda9c('0x4c')]['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0xfd64f,null))['then'](function(_0xb86e44){if(_0xb86e44){_0x466da9['model']=_['keys'](db[_0xda9c('0x53')][_0xda9c('0x29')]);_0x466da9[_0xda9c('0x2c')]=_[_0xda9c('0x3f')](_0x76f3b0['query']);_0x466da9[_0xda9c('0x2d')]=_['intersection'](_0x466da9[_0xda9c('0x2b')],_0x466da9['query']);_0x114135['attributes']=_['intersection'](_0x466da9[_0xda9c('0x2b')],qs[_0xda9c('0x30')](_0x76f3b0[_0xda9c('0x2c')][_0xda9c('0x30')]));_0x114135[_0xda9c('0x2e')]=_0x114135[_0xda9c('0x2e')][_0xda9c('0x31')]?_0x114135[_0xda9c('0x2e')]:_0x466da9[_0xda9c('0x2b')];if(!_0x76f3b0[_0xda9c('0x2c')][_0xda9c('0x32')](_0xda9c('0x33'))){_0x114135[_0xda9c('0x19')]=qs[_0xda9c('0x19')](_0x76f3b0['query'][_0xda9c('0x19')]);_0x114135[_0xda9c('0x18')]=qs[_0xda9c('0x18')](_0x76f3b0['query'][_0xda9c('0x18')]);}_0x114135[_0xda9c('0x34')]=qs[_0xda9c('0x35')](_0x76f3b0[_0xda9c('0x2c')][_0xda9c('0x35')]);_0x114135[_0xda9c('0x36')]=qs['filters'](_[_0xda9c('0x37')](_0x76f3b0[_0xda9c('0x2c')],_0x466da9[_0xda9c('0x2d')]));_0x114135[_0xda9c('0x36')]['CampaignId']=_0xb86e44['id'];if(_0x76f3b0[_0xda9c('0x2c')][_0xda9c('0x54')]){_0x114135[_0xda9c('0x36')]=_[_0xda9c('0x40')](_0x114135[_0xda9c('0x36')],{'$or':_[_0xda9c('0x27')](_0x114135['attributes'],function(_0x30cc7a){var _0x49133c={};_0x49133c[_0x30cc7a]={'$like':'%'+_0x76f3b0[_0xda9c('0x2c')][_0xda9c('0x54')]+'%'};return _0x49133c;})});}_0x114135=_[_0xda9c('0x40')]({},_0x114135,_0x76f3b0[_0xda9c('0x39')]);return db[_0xda9c('0x53')][_0xda9c('0x3a')]({'where':_0x114135[_0xda9c('0x36')]})[_0xda9c('0x1e')](function(_0x14f82b){_0x34f8c0[_0xda9c('0x3a')]=_0x14f82b;if(_0x76f3b0[_0xda9c('0x2c')][_0xda9c('0x3b')]){_0x114135[_0xda9c('0x3c')]=[{'all':!![]}];}return db[_0xda9c('0x53')]['findAll'](_0x114135);})['then'](function(_0x1753fb){_0x34f8c0['rows']=_0x1753fb;return _0x34f8c0;});}})[_0xda9c('0x1e')](respondWithFilteredResult(_0xfd64f,_0x114135))['catch'](handleError(_0xfd64f,null));};exports[_0xda9c('0x55')]=function(_0x16ce4e,_0x2ec8cc,_0x54124f){var _0x2b3189={'raw':!![],'where':{}};var _0x185f73={};var _0x3d2e00={'count':0x0,'rows':[]};return db[_0xda9c('0x28')]['findOne']({'where':{'id':_0x16ce4e['params']['id']}})['then'](handleEntityNotFound(_0x2ec8cc,null))[_0xda9c('0x1e')](function(_0xa0a30c){if(_0xa0a30c){_0x185f73[_0xda9c('0x2b')]=_[_0xda9c('0x3f')](db[_0xda9c('0x56')][_0xda9c('0x29')]);_0x185f73[_0xda9c('0x2c')]=_['keys'](_0x16ce4e[_0xda9c('0x2c')]);_0x185f73[_0xda9c('0x2d')]=_[_0xda9c('0x2f')](_0x185f73[_0xda9c('0x2b')],_0x185f73['query']);_0x2b3189['attributes']=_[_0xda9c('0x2f')](_0x185f73[_0xda9c('0x2b')],qs[_0xda9c('0x30')](_0x16ce4e[_0xda9c('0x2c')][_0xda9c('0x30')]));_0x2b3189[_0xda9c('0x2e')]=_0x2b3189[_0xda9c('0x2e')][_0xda9c('0x31')]?_0x2b3189[_0xda9c('0x2e')]:_0x185f73[_0xda9c('0x2b')];if(!_0x16ce4e[_0xda9c('0x2c')][_0xda9c('0x32')](_0xda9c('0x33'))){_0x2b3189[_0xda9c('0x19')]=qs[_0xda9c('0x19')](_0x16ce4e[_0xda9c('0x2c')][_0xda9c('0x19')]);_0x2b3189['offset']=qs[_0xda9c('0x18')](_0x16ce4e[_0xda9c('0x2c')][_0xda9c('0x18')]);}_0x2b3189['order']=qs[_0xda9c('0x35')](_0x16ce4e[_0xda9c('0x2c')]['sort']);_0x2b3189[_0xda9c('0x36')]=qs[_0xda9c('0x2d')](_[_0xda9c('0x37')](_0x16ce4e['query'],_0x185f73[_0xda9c('0x2d')]));_0x2b3189[_0xda9c('0x36')][_0xda9c('0x57')]=_0xa0a30c['id'];if(_0x16ce4e[_0xda9c('0x2c')][_0xda9c('0x54')]){_0x2b3189[_0xda9c('0x36')]=_[_0xda9c('0x40')](_0x2b3189[_0xda9c('0x36')],{'$or':_[_0xda9c('0x27')](_0x2b3189[_0xda9c('0x2e')],function(_0x10f4ac){var _0x5b4ba2={};_0x5b4ba2[_0x10f4ac]={'$like':'%'+_0x16ce4e[_0xda9c('0x2c')][_0xda9c('0x54')]+'%'};return _0x5b4ba2;})});}_0x2b3189=_['merge']({},_0x2b3189,_0x16ce4e[_0xda9c('0x39')]);return db['CmHopperHistory'][_0xda9c('0x3a')]({'where':_0x2b3189[_0xda9c('0x36')]})[_0xda9c('0x1e')](function(_0xe179f3){_0x3d2e00['count']=_0xe179f3;if(_0x16ce4e[_0xda9c('0x2c')][_0xda9c('0x3b')]){_0x2b3189[_0xda9c('0x3c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xda9c('0x58')](_0x2b3189);})[_0xda9c('0x1e')](function(_0x3e64e9){_0x3d2e00[_0xda9c('0x3d')]=_0x3e64e9;return _0x3d2e00;});}})[_0xda9c('0x1e')](respondWithFilteredResult(_0x2ec8cc,_0x2b3189))['catch'](handleError(_0x2ec8cc,null));};exports['getHopperFinals']=function(_0x3514f9,_0x5b17d1,_0x2a36ac){var _0x4ca2b7={'raw':!![],'where':{}};var _0x1428bd={};var _0x5d4c11={'count':0x0,'rows':[]};return db[_0xda9c('0x28')][_0xda9c('0x52')]({'where':{'id':_0x3514f9['params']['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x5b17d1,null))[_0xda9c('0x1e')](function(_0x1436ed){if(_0x1436ed){_0x1428bd[_0xda9c('0x2b')]=_[_0xda9c('0x3f')](db[_0xda9c('0x59')][_0xda9c('0x29')]);_0x1428bd[_0xda9c('0x2c')]=_[_0xda9c('0x3f')](_0x3514f9[_0xda9c('0x2c')]);_0x1428bd[_0xda9c('0x2d')]=_['intersection'](_0x1428bd['model'],_0x1428bd[_0xda9c('0x2c')]);_0x4ca2b7[_0xda9c('0x2e')]=_[_0xda9c('0x2f')](_0x1428bd[_0xda9c('0x2b')],qs[_0xda9c('0x30')](_0x3514f9[_0xda9c('0x2c')][_0xda9c('0x30')]));_0x4ca2b7['attributes']=_0x4ca2b7[_0xda9c('0x2e')][_0xda9c('0x31')]?_0x4ca2b7[_0xda9c('0x2e')]:_0x1428bd[_0xda9c('0x2b')];if(!_0x3514f9[_0xda9c('0x2c')][_0xda9c('0x32')](_0xda9c('0x33'))){_0x4ca2b7[_0xda9c('0x19')]=qs['limit'](_0x3514f9['query'][_0xda9c('0x19')]);_0x4ca2b7[_0xda9c('0x18')]=qs[_0xda9c('0x18')](_0x3514f9['query'][_0xda9c('0x18')]);}_0x4ca2b7[_0xda9c('0x34')]=qs[_0xda9c('0x35')](_0x3514f9[_0xda9c('0x2c')][_0xda9c('0x35')]);_0x4ca2b7['where']=qs[_0xda9c('0x2d')](_['pick'](_0x3514f9[_0xda9c('0x2c')],_0x1428bd[_0xda9c('0x2d')]));_0x4ca2b7[_0xda9c('0x36')]['CampaignId']=_0x1436ed['id'];if(_0x3514f9[_0xda9c('0x2c')]['filter']){_0x4ca2b7[_0xda9c('0x36')]=_[_0xda9c('0x40')](_0x4ca2b7[_0xda9c('0x36')],{'$or':_['map'](_0x4ca2b7[_0xda9c('0x2e')],function(_0x936e3f){var _0x3f8800={};_0x3f8800[_0x936e3f]={'$like':'%'+_0x3514f9[_0xda9c('0x2c')][_0xda9c('0x54')]+'%'};return _0x3f8800;})});}_0x4ca2b7=_[_0xda9c('0x40')]({},_0x4ca2b7,_0x3514f9['options']);return db[_0xda9c('0x59')][_0xda9c('0x3a')]({'where':_0x4ca2b7[_0xda9c('0x36')]})[_0xda9c('0x1e')](function(_0x1ad794){_0x5d4c11[_0xda9c('0x3a')]=_0x1ad794;if(_0x3514f9[_0xda9c('0x2c')][_0xda9c('0x3b')]){_0x4ca2b7[_0xda9c('0x3c')]=[{'all':!![]}];}return db[_0xda9c('0x59')][_0xda9c('0x58')](_0x4ca2b7);})[_0xda9c('0x1e')](function(_0x5b8c3d){_0x5d4c11[_0xda9c('0x3d')]=_0x5b8c3d;return _0x5d4c11;});}})[_0xda9c('0x1e')](respondWithFilteredResult(_0x5b17d1,_0x4ca2b7))[_0xda9c('0x3e')](handleError(_0x5b17d1,null));};exports[_0xda9c('0x5a')]=function(_0x4e3e23,_0x5583e7,_0x5759d9){var _0x4fabf0={'raw':!![],'where':{}};var _0x362112={};var _0x1e5c27={'count':0x0,'rows':[]};return db[_0xda9c('0x28')]['findOne']({'where':{'id':_0x4e3e23[_0xda9c('0x4c')]['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x5583e7,null))[_0xda9c('0x1e')](function(_0x2cbfa6){if(_0x2cbfa6){_0x362112['model']=_[_0xda9c('0x3f')](db[_0xda9c('0x5b')]['rawAttributes']);_0x362112[_0xda9c('0x2c')]=_[_0xda9c('0x3f')](_0x4e3e23[_0xda9c('0x2c')]);_0x362112[_0xda9c('0x2d')]=_[_0xda9c('0x2f')](_0x362112[_0xda9c('0x2b')],_0x362112[_0xda9c('0x2c')]);_0x4fabf0[_0xda9c('0x2e')]=_[_0xda9c('0x2f')](_0x362112[_0xda9c('0x2b')],qs[_0xda9c('0x30')](_0x4e3e23[_0xda9c('0x2c')][_0xda9c('0x30')]));_0x4fabf0[_0xda9c('0x2e')]=_0x4fabf0[_0xda9c('0x2e')][_0xda9c('0x31')]?_0x4fabf0['attributes']:_0x362112[_0xda9c('0x2b')];if(!_0x4e3e23['query'][_0xda9c('0x32')](_0xda9c('0x33'))){_0x4fabf0['limit']=qs[_0xda9c('0x19')](_0x4e3e23[_0xda9c('0x2c')][_0xda9c('0x19')]);_0x4fabf0[_0xda9c('0x18')]=qs[_0xda9c('0x18')](_0x4e3e23[_0xda9c('0x2c')][_0xda9c('0x18')]);}_0x4fabf0['order']=qs[_0xda9c('0x35')](_0x4e3e23[_0xda9c('0x2c')]['sort']);_0x4fabf0[_0xda9c('0x36')]=qs[_0xda9c('0x2d')](_[_0xda9c('0x37')](_0x4e3e23[_0xda9c('0x2c')],_0x362112['filters']));_0x4fabf0[_0xda9c('0x36')][_0xda9c('0x57')]=_0x2cbfa6['id'];if(_0x4e3e23['query'][_0xda9c('0x54')]){_0x4fabf0[_0xda9c('0x36')]=_[_0xda9c('0x40')](_0x4fabf0[_0xda9c('0x36')],{'$or':_['map'](_0x4fabf0[_0xda9c('0x2e')],function(_0xd2d920){var _0x2e88a6={};_0x2e88a6[_0xd2d920]={'$like':'%'+_0x4e3e23['query'][_0xda9c('0x54')]+'%'};return _0x2e88a6;})});}_0x4fabf0=_['merge']({},_0x4fabf0,_0x4e3e23['options']);return db[_0xda9c('0x5b')]['count']({'where':_0x4fabf0[_0xda9c('0x36')]})[_0xda9c('0x1e')](function(_0x33423c){_0x1e5c27[_0xda9c('0x3a')]=_0x33423c;if(_0x4e3e23[_0xda9c('0x2c')][_0xda9c('0x3b')]){_0x4fabf0['include']=[{'all':!![]}];}return db[_0xda9c('0x5b')][_0xda9c('0x58')](_0x4fabf0);})[_0xda9c('0x1e')](function(_0x136062){_0x1e5c27['rows']=_0x136062;return _0x1e5c27;});}})[_0xda9c('0x1e')](respondWithFilteredResult(_0x5583e7,_0x4fabf0))['catch'](handleError(_0x5583e7,null));};exports[_0xda9c('0x5c')]=function(_0x4b7d4f,_0x17c2dc,_0xe3b2c7){var _0x14efe3={};var _0x3320d9={};var _0x139117;var _0x5484d1;return db[_0xda9c('0x28')][_0xda9c('0x52')]({'where':{'id':_0x4b7d4f['params']['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x17c2dc,null))[_0xda9c('0x1e')](function(_0x49ce3b){if(_0x49ce3b){_0x139117=_0x49ce3b;_0x3320d9['model']=_['keys'](db[_0xda9c('0x5d')][_0xda9c('0x29')]);_0x3320d9['query']=_[_0xda9c('0x3f')](_0x4b7d4f['query']);_0x3320d9[_0xda9c('0x2d')]=_['intersection'](_0x3320d9['model'],_0x3320d9[_0xda9c('0x2c')]);_0x14efe3[_0xda9c('0x2e')]=_[_0xda9c('0x2f')](_0x3320d9[_0xda9c('0x2b')],qs[_0xda9c('0x30')](_0x4b7d4f[_0xda9c('0x2c')][_0xda9c('0x30')]));_0x14efe3[_0xda9c('0x2e')]=_0x14efe3[_0xda9c('0x2e')][_0xda9c('0x31')]?_0x14efe3[_0xda9c('0x2e')]:_0x3320d9['model'];_0x14efe3['order']=qs['sort'](_0x4b7d4f[_0xda9c('0x2c')][_0xda9c('0x35')]);_0x14efe3[_0xda9c('0x36')]=qs['filters'](_[_0xda9c('0x37')](_0x4b7d4f[_0xda9c('0x2c')],_0x3320d9['filters']));if(_0x4b7d4f[_0xda9c('0x2c')][_0xda9c('0x54')]){_0x14efe3['where']=_[_0xda9c('0x40')](_0x14efe3['where'],{'$or':_['map'](_0x14efe3['attributes'],function(_0x580d6e){var _0x4c2682={};_0x4c2682[_0x580d6e]={'$like':'%'+_0x4b7d4f[_0xda9c('0x2c')]['filter']+'%'};return _0x4c2682;})});}_0x14efe3=_[_0xda9c('0x40')]({},_0x14efe3,_0x4b7d4f[_0xda9c('0x39')]);return _0x139117[_0xda9c('0x5c')](_0x14efe3);}})[_0xda9c('0x1e')](function(_0x960757){if(_0x960757){_0x5484d1=_0x960757['length'];if(!_0x4b7d4f[_0xda9c('0x2c')][_0xda9c('0x32')]('nolimit')){_0x14efe3[_0xda9c('0x19')]=qs[_0xda9c('0x19')](_0x4b7d4f['query']['limit']);_0x14efe3[_0xda9c('0x18')]=qs['offset'](_0x4b7d4f['query'][_0xda9c('0x18')]);}return _0x139117[_0xda9c('0x5c')](_0x14efe3);}})['then'](function(_0x19149e){if(_0x19149e){return _0x19149e?{'count':_0x5484d1,'rows':_0x19149e}:null;}})[_0xda9c('0x1e')](respondWithResult(_0x17c2dc,null))[_0xda9c('0x3e')](handleError(_0x17c2dc,null));};exports[_0xda9c('0x5e')]=function(_0x374ecc,_0x290b63,_0x49fada){var _0x58c371,_0xc99d28;return db[_0xda9c('0x28')]['find']({'where':{'id':_0x374ecc[_0xda9c('0x4c')]['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x290b63,null))[_0xda9c('0x1e')](function(_0x5eea09){if(_0x5eea09){_0xc99d28=_0x5eea09;return _0x5eea09['addLists'](_0x374ecc[_0xda9c('0x43')][_0xda9c('0x5f')],_[_0xda9c('0x4d')](_0x374ecc[_0xda9c('0x43')],[_0xda9c('0x5f'),'id'])||{});}return null;})[_0xda9c('0x60')](function(_0x499553){var _0x2a5ae0;_0x58c371=_0x499553||[];var _0x36809d=[];if(_0x499553){for(var _0x4f1526=0x0;_0x4f1526<_0x499553[_0xda9c('0x31')];_0x4f1526+=0x1){var _0x1d3876=_0x499553[_0x4f1526][_0xda9c('0x20')]({'plain':!![]});_0xc99d28[_0xda9c('0x61')]=_0x374ecc[_0xda9c('0x43')][_0xda9c('0x61')]?_0x374ecc[_0xda9c('0x43')]['dialCheckDuplicateType']:_0xc99d28[_0xda9c('0x61')];switch(_0xc99d28[_0xda9c('0x61')]){case _0xda9c('0x62'):_0x2a5ae0=squel[_0xda9c('0x63')]()[_0xda9c('0x64')]('cm_hopper')[_0xda9c('0x65')]([_0xda9c('0x66'),_0xda9c('0x67'),_0xda9c('0x68'),_0xda9c('0x69'),_0xda9c('0x57'),_0xda9c('0x4e'),_0xda9c('0x4f')],squel[_0xda9c('0x6a')]()[_0xda9c('0x6b')]('phone','phone')[_0xda9c('0x6b')](_0xda9c('0x6c'),_0xda9c('0x67'))['field']('id','ContactId')[_0xda9c('0x6b')](_0x1d3876[_0xda9c('0x6d')][_0xda9c('0x6e')](),_0xda9c('0x69'))[_0xda9c('0x6b')](_0x374ecc[_0xda9c('0x4c')]['id']['toString'](),_0xda9c('0x57'))[_0xda9c('0x6b')](_0xda9c('0x6c'),_0xda9c('0x4e'))[_0xda9c('0x6b')]('NOW()','updatedAt')[_0xda9c('0x6f')](_0xda9c('0x70'))[_0xda9c('0x36')](_0xda9c('0x71'))[_0xda9c('0x36')](_0xda9c('0x72'),_0x1d3876[_0xda9c('0x6d')][_0xda9c('0x6e')]())[_0xda9c('0x36')](_0xda9c('0x73'))[_0xda9c('0x36')](_0xda9c('0x74'),squel[_0xda9c('0x6a')]()['field'](_0xda9c('0x75'))[_0xda9c('0x6f')]('cm_hopper_final')[_0xda9c('0x36')](_0xda9c('0x76'),_0x374ecc[_0xda9c('0x4c')]['id']['toString']()))[_0xda9c('0x36')](_0xda9c('0x74'),squel['select']()[_0xda9c('0x6b')](_0xda9c('0x77'))[_0xda9c('0x6f')]('cm_hopper')[_0xda9c('0x36')](_0xda9c('0x76'),_0x374ecc[_0xda9c('0x4c')]['id'][_0xda9c('0x6e')]())))['toString']();break;case'onlyIfOpen':_0x2a5ae0=squel[_0xda9c('0x63')]()[_0xda9c('0x64')](_0xda9c('0x78'))[_0xda9c('0x65')]([_0xda9c('0x66'),_0xda9c('0x67'),_0xda9c('0x68'),_0xda9c('0x69'),_0xda9c('0x57'),_0xda9c('0x4e'),_0xda9c('0x4f')],squel[_0xda9c('0x6a')]()[_0xda9c('0x6b')]('phone',_0xda9c('0x66'))['field'](_0xda9c('0x6c'),'scheduledAt')[_0xda9c('0x6b')]('id',_0xda9c('0x68'))[_0xda9c('0x6b')](_0x1d3876[_0xda9c('0x6d')][_0xda9c('0x6e')](),_0xda9c('0x69'))[_0xda9c('0x6b')](_0x374ecc[_0xda9c('0x4c')]['id']['toString'](),_0xda9c('0x57'))[_0xda9c('0x6b')](_0xda9c('0x6c'),'createdAt')['field'](_0xda9c('0x6c'),'updatedAt')[_0xda9c('0x6f')](_0xda9c('0x70'))['where'](_0xda9c('0x71'))[_0xda9c('0x36')](_0xda9c('0x72'),_0x1d3876[_0xda9c('0x6d')][_0xda9c('0x6e')]())['where'](_0xda9c('0x73'))[_0xda9c('0x36')](_0xda9c('0x74'),squel[_0xda9c('0x6a')]()[_0xda9c('0x6b')](_0xda9c('0x77'))['from'](_0xda9c('0x78'))[_0xda9c('0x36')]('CampaignId\x20=\x20?',_0x374ecc[_0xda9c('0x4c')]['id'][_0xda9c('0x6e')]())))[_0xda9c('0x6e')]();break;default:_0x2a5ae0=squel[_0xda9c('0x63')]()[_0xda9c('0x64')](_0xda9c('0x78'))['fromQuery'](['phone',_0xda9c('0x67'),_0xda9c('0x68'),_0xda9c('0x69'),_0xda9c('0x57'),_0xda9c('0x4e'),_0xda9c('0x4f')],squel[_0xda9c('0x6a')]()[_0xda9c('0x6b')](_0xda9c('0x66'),_0xda9c('0x66'))['field'](_0xda9c('0x6c'),'scheduledAt')[_0xda9c('0x6b')]('id',_0xda9c('0x68'))[_0xda9c('0x6b')](_0x1d3876[_0xda9c('0x6d')][_0xda9c('0x6e')](),_0xda9c('0x69'))[_0xda9c('0x6b')](_0x374ecc['params']['id'][_0xda9c('0x6e')](),_0xda9c('0x57'))[_0xda9c('0x6b')]('NOW()',_0xda9c('0x4e'))[_0xda9c('0x6b')](_0xda9c('0x6c'),'updatedAt')[_0xda9c('0x6f')](_0xda9c('0x70'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xda9c('0x72'),_0x1d3876[_0xda9c('0x6d')]['toString']())['where'](_0xda9c('0x73')))[_0xda9c('0x6e')]();}_0x36809d['push'](db['sequelize'][_0xda9c('0x2c')](_0x2a5ae0));}return BPromise[_0xda9c('0x79')](_0x36809d);}})['then'](function(){return _0x58c371;})[_0xda9c('0x1e')](respondWithResult(_0x290b63,null))[_0xda9c('0x3e')](handleError(_0x290b63,null));};exports[_0xda9c('0x7a')]=function(_0x14cfee,_0x2b6012,_0x2ff29f){return db['Campaign'][_0xda9c('0x41')]({'where':{'id':_0x14cfee[_0xda9c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b6012,null))[_0xda9c('0x1e')](function(_0x106dc8){if(_0x106dc8){return _0x106dc8[_0xda9c('0x7a')](_0x14cfee[_0xda9c('0x2c')][_0xda9c('0x5f')]);}})[_0xda9c('0x1e')](function(_0x14d3f4){if(_0x14d3f4){return db['CmHopper'][_0xda9c('0x1f')]({'where':{'ListId':_0x14cfee[_0xda9c('0x2c')][_0xda9c('0x5f')],'CampaignId':_0x14cfee[_0xda9c('0x4c')]['id']}})['then'](function(){return _0x14d3f4;});}})[_0xda9c('0x1e')](respondWithStatusCode(_0x2b6012,null))[_0xda9c('0x3e')](handleError(_0x2b6012,null));};exports[_0xda9c('0x7b')]=function(_0x2e0f5a,_0x14cfe8,_0x390c6e){var _0x6df49b={'raw':!![],'where':{}};var _0x3c7bdb={};var _0x118e93={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x2e0f5a[_0xda9c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x14cfe8,null))[_0xda9c('0x1e')](function(_0x36ffb5){if(_0x36ffb5){_0x3c7bdb[_0xda9c('0x2b')]=_[_0xda9c('0x3f')](db[_0xda9c('0x5d')]['rawAttributes']);_0x3c7bdb[_0xda9c('0x2c')]=_[_0xda9c('0x3f')](_0x2e0f5a['query']);_0x3c7bdb[_0xda9c('0x2d')]=_[_0xda9c('0x2f')](_0x3c7bdb[_0xda9c('0x2b')],_0x3c7bdb[_0xda9c('0x2c')]);_0x6df49b[_0xda9c('0x2e')]=_[_0xda9c('0x2f')](_0x3c7bdb[_0xda9c('0x2b')],qs[_0xda9c('0x30')](_0x2e0f5a[_0xda9c('0x2c')][_0xda9c('0x30')]));_0x6df49b[_0xda9c('0x2e')]=_0x6df49b[_0xda9c('0x2e')][_0xda9c('0x31')]?_0x6df49b['attributes']:_0x3c7bdb[_0xda9c('0x2b')];if(!_0x2e0f5a['query']['hasOwnProperty'](_0xda9c('0x33'))){_0x6df49b['limit']=qs[_0xda9c('0x19')](_0x2e0f5a[_0xda9c('0x2c')][_0xda9c('0x19')]);_0x6df49b[_0xda9c('0x18')]=qs[_0xda9c('0x18')](_0x2e0f5a[_0xda9c('0x2c')][_0xda9c('0x18')]);}_0x6df49b[_0xda9c('0x34')]=qs[_0xda9c('0x35')](_0x2e0f5a[_0xda9c('0x2c')][_0xda9c('0x35')]);_0x6df49b[_0xda9c('0x36')]=qs[_0xda9c('0x2d')](_[_0xda9c('0x37')](_0x2e0f5a[_0xda9c('0x2c')],_0x3c7bdb[_0xda9c('0x2d')]));_0x6df49b[_0xda9c('0x36')][_0xda9c('0x57')]=_0x36ffb5['id'];if(_0x2e0f5a[_0xda9c('0x2c')]['filter']){_0x6df49b[_0xda9c('0x36')]=_[_0xda9c('0x40')](_0x6df49b['where'],{'$or':_[_0xda9c('0x27')](_0x6df49b[_0xda9c('0x2e')],function(_0x2c57d1){var _0x2d9622={};_0x2d9622[_0x2c57d1]={'$like':'%'+_0x2e0f5a['query'][_0xda9c('0x54')]+'%'};return _0x2d9622;})});}_0x6df49b=_[_0xda9c('0x40')]({},_0x6df49b,_0x2e0f5a[_0xda9c('0x39')]);return db[_0xda9c('0x5d')][_0xda9c('0x3a')]({'where':_0x6df49b[_0xda9c('0x36')]})[_0xda9c('0x1e')](function(_0x432b20){_0x118e93['count']=_0x432b20;if(_0x2e0f5a['query'][_0xda9c('0x3b')]){_0x6df49b['include']=[{'all':!![]}];}return db[_0xda9c('0x5d')][_0xda9c('0x58')](_0x6df49b);})[_0xda9c('0x1e')](function(_0x3f9593){_0x118e93[_0xda9c('0x3d')]=_0x3f9593;return _0x118e93;});}})['then'](respondWithFilteredResult(_0x14cfe8,_0x6df49b))[_0xda9c('0x3e')](handleError(_0x14cfe8,null));};exports['addBlackLists']=function(_0x8cfb0f,_0x3ddd70,_0x247686){var _0x290ec6,_0xae103a;return db[_0xda9c('0x28')][_0xda9c('0x41')]({'where':{'id':_0x8cfb0f[_0xda9c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ddd70,null))['then'](function(_0x40edd3){if(_0x40edd3){_0xae103a=_0x40edd3;return _0x40edd3[_0xda9c('0x7c')](_0x8cfb0f[_0xda9c('0x43')]['ids'],_[_0xda9c('0x4d')](_0x8cfb0f[_0xda9c('0x43')],[_0xda9c('0x5f'),'id'])||{});}return null;})[_0xda9c('0x60')](function(_0x6af446){var _0x24e0eb;_0x290ec6=_0x6af446||[];var _0x3a34ed=[];if(_0x6af446){for(var _0x1cb132=0x0;_0x1cb132<_0x6af446[_0xda9c('0x31')];_0x1cb132+=0x1){var _0x42df9d=_0x6af446[_0x1cb132]['get']({'plain':!![]});_0x24e0eb=squel[_0xda9c('0x63')]()[_0xda9c('0x64')](_0xda9c('0x7d'))[_0xda9c('0x65')]([_0xda9c('0x66'),_0xda9c('0x68'),_0xda9c('0x69'),'CampaignId',_0xda9c('0x4e'),_0xda9c('0x4f')],squel['select']()['field'](_0xda9c('0x66'),_0xda9c('0x66'))['field']('id',_0xda9c('0x68'))[_0xda9c('0x6b')](_0x42df9d[_0xda9c('0x6d')][_0xda9c('0x6e')](),'ListId')[_0xda9c('0x6b')](_0x8cfb0f[_0xda9c('0x4c')]['id'][_0xda9c('0x6e')](),_0xda9c('0x57'))[_0xda9c('0x6b')](_0xda9c('0x6c'),'createdAt')['field'](_0xda9c('0x6c'),_0xda9c('0x4f'))[_0xda9c('0x6f')](_0xda9c('0x70'))[_0xda9c('0x36')](_0xda9c('0x71'))[_0xda9c('0x36')](_0xda9c('0x72'),_0x42df9d[_0xda9c('0x6d')][_0xda9c('0x6e')]())[_0xda9c('0x36')](_0xda9c('0x73')))[_0xda9c('0x6e')]();_0x3a34ed[_0xda9c('0x7e')](db[_0xda9c('0x7f')]['query'](_0x24e0eb));}return BPromise[_0xda9c('0x79')](_0x3a34ed);}})[_0xda9c('0x1e')](function(){return _0x290ec6;})[_0xda9c('0x1e')](respondWithResult(_0x3ddd70,null))['catch'](handleError(_0x3ddd70,null));};exports[_0xda9c('0x80')]=function(_0x292a58,_0x5e9687,_0x20d7e0){return db['Campaign'][_0xda9c('0x41')]({'where':{'id':_0x292a58[_0xda9c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e9687,null))[_0xda9c('0x1e')](function(_0x40a9d9){if(_0x40a9d9){return _0x40a9d9[_0xda9c('0x80')](_0x292a58[_0xda9c('0x2c')]['ids']);}})['then'](function(_0x3f8ea2){if(_0x3f8ea2){return db['CmHopperBlack'][_0xda9c('0x1f')]({'where':{'ListId':_0x292a58[_0xda9c('0x2c')]['ids'],'CampaignId':_0x292a58[_0xda9c('0x4c')]['id']}})[_0xda9c('0x1e')](function(){return _0x3f8ea2;});}})[_0xda9c('0x1e')](respondWithStatusCode(_0x5e9687,null))[_0xda9c('0x3e')](handleError(_0x5e9687,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index bf74eb3..fe7ed2a 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(_0x317497,_0x2d6cf7){var _0x3445b0=function(_0x22fe4d){while(--_0x22fe4d){_0x317497['push'](_0x317497['shift']());}};_0x3445b0(++_0x2d6cf7);}(_0xb10b,0x12a));var _0xbb10=function(_0x208b7a,_0x2e3baa){_0x208b7a=_0x208b7a-0x0;var _0x37b7ec=_0xb10b[_0x208b7a];return _0x37b7ec;};'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(_0x3c849d,_0x3468b3){var _0x2c95ad=function(_0x5b8ee5){while(--_0x5b8ee5){_0x3c849d['push'](_0x3c849d['shift']());}};_0x2c95ad(++_0x3468b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 bf65e22..943ba84 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x59c3af,_0x468c29){var _0x1330d9=function(_0x2abcc3){while(--_0x2abcc3){_0x59c3af['push'](_0x59c3af['shift']());}};_0x1330d9(++_0x468c29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3263f0,_0x2d5d22){var _0x367b6f=function(_0xd86d6c){while(--_0xd86d6c){_0x3263f0['push'](_0x3263f0['shift']());}};_0x367b6f(++_0x2d5d22);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 5826cc6..d2a1d3a 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 _0xf6c9=['create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf6c9,0x10b));var _0x9f6c=function(_0x17cfa6,_0x19e94f){_0x17cfa6=_0x17cfa6-0x0;var _0x596517=_0xf6c9[_0x17cfa6];return _0x596517;};'use strict';var multer=require(_0x9f6c('0x0'));var util=require('util');var path=require(_0x9f6c('0x1'));var timeout=require(_0x9f6c('0x2'));var express=require('express');var router=express[_0x9f6c('0x3')]();var auth=require(_0x9f6c('0x4'));var interaction=require(_0x9f6c('0x5'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x9f6c('0x6')]('/',auth[_0x9f6c('0x7')](),controller[_0x9f6c('0x8')]);router[_0x9f6c('0x6')](_0x9f6c('0x9'),auth['isAuthenticated'](),controller[_0x9f6c('0xa')]);router[_0x9f6c('0x6')]('/:id/hoppers',auth[_0x9f6c('0x7')](),controller[_0x9f6c('0xb')]);router['get']('/:id/hopper_histories',auth[_0x9f6c('0x7')](),controller[_0x9f6c('0xc')]);router[_0x9f6c('0x6')](_0x9f6c('0xd'),auth[_0x9f6c('0x7')](),controller['getHopperFinals']);router[_0x9f6c('0x6')](_0x9f6c('0xe'),auth[_0x9f6c('0x7')](),controller[_0x9f6c('0xf')]);router[_0x9f6c('0x6')](_0x9f6c('0x10'),auth['isAuthenticated'](),controller[_0x9f6c('0x11')]);router[_0x9f6c('0x6')](_0x9f6c('0x12'),auth['isAuthenticated'](),controller[_0x9f6c('0x13')]);router[_0x9f6c('0x14')]('/',auth[_0x9f6c('0x7')](),controller[_0x9f6c('0x15')]);router[_0x9f6c('0x14')](_0x9f6c('0x16'),auth[_0x9f6c('0x7')](),controller[_0x9f6c('0x17')]);router[_0x9f6c('0x14')](_0x9f6c('0x10'),auth['isAuthenticated'](),controller[_0x9f6c('0x18')]);router[_0x9f6c('0x14')](_0x9f6c('0x12'),auth['isAuthenticated'](),controller[_0x9f6c('0x19')]);router[_0x9f6c('0x1a')](_0x9f6c('0x9'),auth[_0x9f6c('0x7')](),controller[_0x9f6c('0x1b')]);router[_0x9f6c('0x1c')](_0x9f6c('0x9'),auth[_0x9f6c('0x7')](),controller['destroy']);router[_0x9f6c('0x1c')]('/:id/lists',auth[_0x9f6c('0x7')](),controller[_0x9f6c('0x1d')]);router[_0x9f6c('0x1c')](_0x9f6c('0x12'),auth[_0x9f6c('0x7')](),controller[_0x9f6c('0x1e')]);module[_0x9f6c('0x1f')]=router; \ No newline at end of file +var _0x377c=['getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','/:id/clone','clone','/:id/lists','addLists','post','addBlackLists','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x377c,0xb0));var _0xc377=function(_0x21cefb,_0x12aa66){_0x21cefb=_0x21cefb-0x0;var _0x1a7dc6=_0x377c[_0x21cefb];return _0x1a7dc6;};'use strict';var multer=require(_0xc377('0x0'));var util=require(_0xc377('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc377('0x2'));var router=express[_0xc377('0x3')]();var auth=require(_0xc377('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc377('0x5'));var controller=require(_0xc377('0x6'));router[_0xc377('0x7')]('/',auth['isAuthenticated'](),controller[_0xc377('0x8')]);router[_0xc377('0x7')](_0xc377('0x9'),auth[_0xc377('0xa')](),controller[_0xc377('0xb')]);router[_0xc377('0x7')]('/:id/hoppers',auth[_0xc377('0xa')](),controller[_0xc377('0xc')]);router[_0xc377('0x7')](_0xc377('0xd'),auth['isAuthenticated'](),controller[_0xc377('0xe')]);router['get'](_0xc377('0xf'),auth[_0xc377('0xa')](),controller[_0xc377('0x10')]);router['get']('/:id/hopper_black',auth[_0xc377('0xa')](),controller[_0xc377('0x11')]);router[_0xc377('0x7')]('/:id/lists',auth['isAuthenticated'](),controller[_0xc377('0x12')]);router[_0xc377('0x7')](_0xc377('0x13'),auth[_0xc377('0xa')](),controller[_0xc377('0x14')]);router['post']('/',auth[_0xc377('0xa')](),controller[_0xc377('0x15')]);router['post'](_0xc377('0x16'),auth[_0xc377('0xa')](),controller[_0xc377('0x17')]);router['post'](_0xc377('0x18'),auth['isAuthenticated'](),controller[_0xc377('0x19')]);router[_0xc377('0x1a')](_0xc377('0x13'),auth[_0xc377('0xa')](),controller[_0xc377('0x1b')]);router[_0xc377('0x1c')]('/:id',auth[_0xc377('0xa')](),controller['update']);router[_0xc377('0x1d')](_0xc377('0x9'),auth['isAuthenticated'](),controller[_0xc377('0x1e')]);router[_0xc377('0x1d')]('/:id/lists',auth['isAuthenticated'](),controller['removeLists']);router[_0xc377('0x1d')](_0xc377('0x13'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xc377('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 79dc2ba..a7f91d6 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 _0xebc9=['getDataValue','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xebc9,0x127));var _0x9ebc=function(_0x509867,_0x449160){_0x509867=_0x509867-0x0;var _0x51df03=_0xebc9[_0x509867];return _0x51df03;};'use strict';var Sequelize=require(_0x9ebc('0x0'));module[_0x9ebc('0x1')]={'key':{'type':Sequelize[_0x9ebc('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x9ebc('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x9ebc('0x2')]},'name':{'type':Sequelize[_0x9ebc('0x4')],'get':function(){return this[_0x9ebc('0x5')]('key');}}}; \ No newline at end of file +var _0xe263=['sequelize','exports','TEXT','STRING','key'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xe263,0x140));var _0x3e26=function(_0x2a437d,_0x22ff24){_0x2a437d=_0x2a437d-0x0;var _0x5186f6=_0xe263[_0x2a437d];return _0x5186f6;};'use strict';var Sequelize=require(_0x3e26('0x0'));module[_0x3e26('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x3e26('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3e26('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x3e26('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3b2b5eb..b5ddd5f 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 _0xf42b=['find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include'];(function(_0x15ab46,_0x1b2ab7){var _0x524284=function(_0x384989){while(--_0x384989){_0x15ab46['push'](_0x15ab46['shift']());}};_0x524284(++_0x1b2ab7);}(_0xf42b,0x1b2));var _0xbf42=function(_0x4ba23e,_0x17d90e){_0x4ba23e=_0x4ba23e-0x0;var _0x7e1b98=_0xf42b[_0x4ba23e];return _0x7e1b98;};'use strict';var pdf=require(_0xbf42('0x0'));var emlformat=require(_0xbf42('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf42('0x2'));var BPromise=require(_0xbf42('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbf42('0x4'));var sox=require(_0xbf42('0x5'));var csv=require(_0xbf42('0x6'));var ejs=require(_0xbf42('0x7'));var fs=require('fs');var _=require(_0xbf42('0x8'));var squel=require(_0xbf42('0x9'));var crypto=require(_0xbf42('0xa'));var jsforce=require(_0xbf42('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbf42('0x6'));var querystring=require('querystring');var Papa=require(_0xbf42('0xc'));var Redis=require(_0xbf42('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbf42('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf42('0xf'));var logger=require(_0xbf42('0x10'))(_0xbf42('0x11'));var utils=require(_0xbf42('0x12'));var config=require(_0xbf42('0x13'));var db=require(_0xbf42('0x14'))['db'];function respondWithStatusCode(_0x3cbd32,_0x1f3cb7){_0x1f3cb7=_0x1f3cb7||0xcc;return function(_0x1c4258){if(_0x1c4258){return _0x3cbd32[_0xbf42('0x15')](_0x1f3cb7);}return _0x3cbd32[_0xbf42('0x16')](_0x1f3cb7)[_0xbf42('0x17')]();};}function respondWithResult(_0x4983c8,_0x54beac){_0x54beac=_0x54beac||0xc8;return function(_0x5ee7c0){if(_0x5ee7c0){return _0x4983c8[_0xbf42('0x16')](_0x54beac)[_0xbf42('0x18')](_0x5ee7c0);}};}function respondWithFilteredResult(_0xb06239,_0x81261e){return function(_0x414436){if(_0x414436){var _0x1220a2=_0x414436[_0xbf42('0x19')],_0x48a347=_0x81261e[_0xbf42('0x1a')],_0x5d0440=_0x81261e[_0xbf42('0x1a')]+_0x81261e[_0xbf42('0x1b')],_0x6add59;if(_0x5d0440>=_0x1220a2){_0x5d0440=_0x1220a2;_0x6add59=0xc8;}else{_0x6add59=0xce;}_0xb06239[_0xbf42('0x16')](_0x6add59);return _0xb06239[_0xbf42('0x1c')](_0xbf42('0x1d'),_0x48a347+'-'+_0x5d0440+'/'+_0x1220a2)[_0xbf42('0x18')](_0x414436);}return null;};}function patchUpdates(_0x466e40){return function(_0x52977a){try{jsonpatch[_0xbf42('0x1e')](_0x52977a,_0x466e40,!![]);}catch(_0x50745f){return BPromise[_0xbf42('0x1f')](_0x50745f);}return _0x52977a[_0xbf42('0x20')]();};}function saveUpdates(_0x261bc0,_0x468aef){return function(_0xebef30){if(_0xebef30){return _0xebef30[_0xbf42('0x21')](_0x261bc0)[_0xbf42('0x22')](function(_0x5d7828){return _0x5d7828;});}return null;};}function removeEntity(_0xe4ca04,_0x55a688){return function(_0x4a82f7){if(_0x4a82f7){return _0x4a82f7[_0xbf42('0x23')]()[_0xbf42('0x22')](function(){var _0x1ea3c4=_0x4a82f7[_0xbf42('0x24')]({'plain':!![]});var _0x3299cc=_0xbf42('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x3299cc,'resourceId':_0x1ea3c4['id']}})['then'](function(){return _0x4a82f7;});})[_0xbf42('0x22')](function(){_0xe4ca04[_0xbf42('0x16')](0xcc)[_0xbf42('0x17')]();});}};}function handleEntityNotFound(_0x3820dc,_0x80f411){return function(_0x114bb7){if(!_0x114bb7){_0x3820dc[_0xbf42('0x15')](0x194);}return _0x114bb7;};}function handleError(_0x2b52e8,_0x51d819){_0x51d819=_0x51d819||0x1f4;return function(_0x4bbb0c){logger[_0xbf42('0x26')](_0x4bbb0c[_0xbf42('0x27')]);if(_0x4bbb0c[_0xbf42('0x28')]){delete _0x4bbb0c[_0xbf42('0x28')];}_0x2b52e8['status'](_0x51d819)['send'](_0x4bbb0c);};}exports[_0xbf42('0x29')]=function(_0x5523d0,_0x3fe817){var _0x53339c={},_0x557d42={},_0x102c84={'count':0x0,'rows':[]};var _0x26a8f0=_[_0xbf42('0x2a')](db[_0xbf42('0x2b')][_0xbf42('0x2c')],function(_0x5e565c){return{'name':_0x5e565c[_0xbf42('0x2d')],'type':_0x5e565c[_0xbf42('0x2e')][_0xbf42('0x2f')]};});_0x557d42[_0xbf42('0x30')]=_[_0xbf42('0x2a')](_0x26a8f0,'name');_0x557d42['query']=_[_0xbf42('0x31')](_0x5523d0[_0xbf42('0x32')]);_0x557d42[_0xbf42('0x33')]=_[_0xbf42('0x34')](_0x557d42[_0xbf42('0x30')],_0x557d42[_0xbf42('0x32')]);_0x53339c[_0xbf42('0x35')]=_[_0xbf42('0x34')](_0x557d42[_0xbf42('0x30')],qs[_0xbf42('0x36')](_0x5523d0['query'][_0xbf42('0x36')]));_0x53339c[_0xbf42('0x35')]=_0x53339c['attributes'][_0xbf42('0x37')]?_0x53339c['attributes']:_0x557d42[_0xbf42('0x30')];if(!_0x5523d0['query'][_0xbf42('0x38')](_0xbf42('0x39'))){_0x53339c['limit']=qs[_0xbf42('0x1b')](_0x5523d0[_0xbf42('0x32')][_0xbf42('0x1b')]);_0x53339c[_0xbf42('0x1a')]=qs['offset'](_0x5523d0[_0xbf42('0x32')]['offset']);}_0x53339c[_0xbf42('0x3a')]=qs[_0xbf42('0x3b')](_0x5523d0['query']['sort']);_0x53339c[_0xbf42('0x3c')]=qs[_0xbf42('0x33')](_['pick'](_0x5523d0['query'],_0x557d42[_0xbf42('0x33')]),_0x26a8f0);if(_0x5523d0[_0xbf42('0x32')][_0xbf42('0x3d')]){_0x53339c[_0xbf42('0x3c')]=_[_0xbf42('0x3e')](_0x53339c['where'],{'$or':_['map'](_0x26a8f0,function(_0x192c95){if(_0x192c95['type']!==_0xbf42('0x3f')){var _0x231b74={};_0x231b74[_0x192c95['name']]={'$like':'%'+_0x5523d0[_0xbf42('0x32')][_0xbf42('0x3d')]+'%'};return _0x231b74;}})});}_0x53339c=_[_0xbf42('0x3e')]({},_0x53339c,_0x5523d0['options']);var _0xb64d70={'where':_0x53339c[_0xbf42('0x3c')]};return db[_0xbf42('0x2b')][_0xbf42('0x19')](_0xb64d70)['then'](function(_0x4d873b){_0x102c84[_0xbf42('0x19')]=_0x4d873b;if(_0x5523d0['query'][_0xbf42('0x40')]){_0x53339c['include']=[{'all':!![]}];}return db[_0xbf42('0x2b')][_0xbf42('0x41')](_0x53339c);})['then'](function(_0x3fb76f){_0x102c84['rows']=_0x3fb76f;return _0x102c84;})['then'](respondWithFilteredResult(_0x3fe817,_0x53339c))[_0xbf42('0x42')](handleError(_0x3fe817,null));};exports[_0xbf42('0x43')]=function(_0x39aafc,_0xcfa45f){var _0x40d14b={'raw':!![],'where':{'id':_0x39aafc[_0xbf42('0x44')]['id']}},_0x24b4af={};_0x24b4af[_0xbf42('0x30')]=_[_0xbf42('0x31')](db[_0xbf42('0x2b')][_0xbf42('0x2c')]);_0x24b4af['query']=_[_0xbf42('0x31')](_0x39aafc[_0xbf42('0x32')]);_0x24b4af[_0xbf42('0x33')]=_[_0xbf42('0x34')](_0x24b4af[_0xbf42('0x30')],_0x24b4af['query']);_0x40d14b['attributes']=_[_0xbf42('0x34')](_0x24b4af[_0xbf42('0x30')],qs[_0xbf42('0x36')](_0x39aafc[_0xbf42('0x32')]['fields']));_0x40d14b['attributes']=_0x40d14b[_0xbf42('0x35')][_0xbf42('0x37')]?_0x40d14b[_0xbf42('0x35')]:_0x24b4af['model'];if(_0x39aafc[_0xbf42('0x32')][_0xbf42('0x40')]){_0x40d14b[_0xbf42('0x45')]=[{'all':!![]}];}_0x40d14b=_[_0xbf42('0x3e')]({},_0x40d14b,_0x39aafc['options']);return db['CannedAnswer'][_0xbf42('0x46')](_0x40d14b)[_0xbf42('0x22')](handleEntityNotFound(_0xcfa45f,null))['then'](respondWithResult(_0xcfa45f,null))[_0xbf42('0x42')](handleError(_0xcfa45f,null));};exports[_0xbf42('0x21')]=function(_0x45bac2,_0x10c31e){if(_0x45bac2['body']['id']){delete _0x45bac2[_0xbf42('0x47')]['id'];}return db['CannedAnswer'][_0xbf42('0x46')]({'where':{'id':_0x45bac2[_0xbf42('0x44')]['id']}})['then'](handleEntityNotFound(_0x10c31e,null))[_0xbf42('0x22')](saveUpdates(_0x45bac2[_0xbf42('0x47')],null))[_0xbf42('0x22')](respondWithResult(_0x10c31e,null))[_0xbf42('0x42')](handleError(_0x10c31e,null));};exports[_0xbf42('0x23')]=function(_0x163a08,_0x459df0){return db[_0xbf42('0x2b')][_0xbf42('0x46')]({'where':{'id':_0x163a08[_0xbf42('0x44')]['id']}})[_0xbf42('0x22')](handleEntityNotFound(_0x459df0,null))[_0xbf42('0x22')](removeEntity(_0x459df0,null))[_0xbf42('0x42')](handleError(_0x459df0,null));};exports[_0xbf42('0x48')]=function(_0x5dd22c,_0x380189){var _0x2ee539={'key':_0x5dd22c[_0xbf42('0x47')][_0xbf42('0x2f')]};if(_0x5dd22c['body'][_0xbf42('0x49')]){_0x2ee539['MailAccountId']=_0x5dd22c[_0xbf42('0x47')][_0xbf42('0x49')];}else if(_0x5dd22c['body'][_0xbf42('0x4a')]){_0x2ee539['SmsAccountId']=_0x5dd22c[_0xbf42('0x47')][_0xbf42('0x4a')];}else if(_0x5dd22c['body']['OpenchannelAccountId']){_0x2ee539[_0xbf42('0x4b')]=_0x5dd22c[_0xbf42('0x47')][_0xbf42('0x4b')];}else if(_0x5dd22c['body']['ChatWebsiteId']){_0x2ee539[_0xbf42('0x4c')]=_0x5dd22c[_0xbf42('0x47')][_0xbf42('0x4c')];}return db[_0xbf42('0x2b')]['find']({'where':_0x2ee539})[_0xbf42('0x22')](function(_0x40daab){if(_0x40daab){throw new db['Sequelize'][(_0xbf42('0x4d'))](_0xbf42('0x4e'));}return db[_0xbf42('0x2b')][_0xbf42('0x48')](_0x5dd22c[_0xbf42('0x47')]);})['then'](function(_0x1c56d2){var _0x49acfc=_0x5dd22c[_0xbf42('0x4f')][_0xbf42('0x24')]({'plain':!![]});if(!_0x49acfc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49acfc['role']===_0xbf42('0x4f')){var _0x5b5af0=_0x1c56d2['get']({'plain':!![]});return db[_0xbf42('0x50')]['find']({'where':{'name':_0xbf42('0x25'),'userProfileId':_0x49acfc[_0xbf42('0x51')]},'raw':!![]})[_0xbf42('0x22')](function(_0x53ecda){if(_0x53ecda&&_0x53ecda[_0xbf42('0x52')]===0x0){return db['UserProfileResource'][_0xbf42('0x48')]({'name':_0x5b5af0[_0xbf42('0x28')],'resourceId':_0x5b5af0['id'],'type':_0x53ecda['name'],'sectionId':_0x53ecda['id']},{})[_0xbf42('0x22')](function(){return _0x1c56d2;});}else{return _0x1c56d2;}})[_0xbf42('0x42')](function(_0x5c63b9){logger['error'](_0xbf42('0x53'),_0x5c63b9);throw _0x5c63b9;});}return _0x1c56d2;})['then'](respondWithResult(_0x380189,0xc9))['catch'](handleError(_0x380189,null));}; \ No newline at end of file +var _0xc464=['Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','CannedAnswers','error','stack','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','rows','show','params','include','options','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc464,0xba));var _0x4c46=function(_0xaaea1c,_0x606874){_0xaaea1c=_0xaaea1c-0x0;var _0x4cfd49=_0xc464[_0xaaea1c];return _0x4cfd49;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4c46('0x0'));var rimraf=require(_0x4c46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c46('0x2'));var rp=require(_0x4c46('0x3'));var moment=require(_0x4c46('0x4'));var BPromise=require(_0x4c46('0x5'));var Mustache=require(_0x4c46('0x6'));var util=require(_0x4c46('0x7'));var path=require(_0x4c46('0x8'));var sox=require('sox');var csv=require(_0x4c46('0x9'));var ejs=require(_0x4c46('0xa'));var fs=require('fs');var _=require(_0x4c46('0xb'));var squel=require(_0x4c46('0xc'));var crypto=require(_0x4c46('0xd'));var jsforce=require(_0x4c46('0xe'));var deskjs=require(_0x4c46('0xf'));var toCsv=require(_0x4c46('0x9'));var querystring=require('querystring');var Papa=require(_0x4c46('0x10'));var Redis=require('ioredis');var authService=require(_0x4c46('0x11'));var qs=require(_0x4c46('0x12'));var as=require(_0x4c46('0x13'));var hardwareService=require(_0x4c46('0x14'));var logger=require('../../config/logger')(_0x4c46('0x15'));var utils=require(_0x4c46('0x16'));var config=require('../../config/environment');var db=require(_0x4c46('0x17'))['db'];function respondWithStatusCode(_0x215d3d,_0x3f6104){_0x3f6104=_0x3f6104||0xcc;return function(_0x2b7e44){if(_0x2b7e44){return _0x215d3d[_0x4c46('0x18')](_0x3f6104);}return _0x215d3d['status'](_0x3f6104)[_0x4c46('0x19')]();};}function respondWithResult(_0x55884c,_0x1bfa24){_0x1bfa24=_0x1bfa24||0xc8;return function(_0x40a65a){if(_0x40a65a){return _0x55884c[_0x4c46('0x1a')](_0x1bfa24)[_0x4c46('0x1b')](_0x40a65a);}};}function respondWithFilteredResult(_0x10b4cf,_0x190651){return function(_0x3c1d0e){if(_0x3c1d0e){var _0x512a12=_0x3c1d0e[_0x4c46('0x1c')],_0x5bb9ab=_0x190651[_0x4c46('0x1d')],_0x54437d=_0x190651[_0x4c46('0x1d')]+_0x190651[_0x4c46('0x1e')],_0x3075ec;if(_0x54437d>=_0x512a12){_0x54437d=_0x512a12;_0x3075ec=0xc8;}else{_0x3075ec=0xce;}_0x10b4cf[_0x4c46('0x1a')](_0x3075ec);return _0x10b4cf[_0x4c46('0x1f')]('Content-Range',_0x5bb9ab+'-'+_0x54437d+'/'+_0x512a12)[_0x4c46('0x1b')](_0x3c1d0e);}return null;};}function patchUpdates(_0x59f648){return function(_0x1e93eb){try{jsonpatch[_0x4c46('0x20')](_0x1e93eb,_0x59f648,!![]);}catch(_0x11b37a){return BPromise[_0x4c46('0x21')](_0x11b37a);}return _0x1e93eb[_0x4c46('0x22')]();};}function saveUpdates(_0xb478b8,_0xe75435){return function(_0x33d519){if(_0x33d519){return _0x33d519[_0x4c46('0x23')](_0xb478b8)[_0x4c46('0x24')](function(_0x39b5ff){return _0x39b5ff;});}return null;};}function removeEntity(_0x1c4242,_0x39447f){return function(_0x4fb8de){if(_0x4fb8de){return _0x4fb8de[_0x4c46('0x25')]()[_0x4c46('0x24')](function(){var _0x212b31=_0x4fb8de[_0x4c46('0x26')]({'plain':!![]});var _0x180b03=_0x4c46('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x180b03,'resourceId':_0x212b31['id']}})[_0x4c46('0x24')](function(){return _0x4fb8de;});})[_0x4c46('0x24')](function(){_0x1c4242[_0x4c46('0x1a')](0xcc)[_0x4c46('0x19')]();});}};}function handleEntityNotFound(_0x11b29b,_0xa11b5e){return function(_0xa6fb18){if(!_0xa6fb18){_0x11b29b[_0x4c46('0x18')](0x194);}return _0xa6fb18;};}function handleError(_0x1b7de7,_0x5e0e07){_0x5e0e07=_0x5e0e07||0x1f4;return function(_0xaf7760){logger[_0x4c46('0x28')](_0xaf7760[_0x4c46('0x29')]);if(_0xaf7760['name']){delete _0xaf7760['name'];}_0x1b7de7[_0x4c46('0x1a')](_0x5e0e07)[_0x4c46('0x2a')](_0xaf7760);};}exports[_0x4c46('0x2b')]=function(_0x3bf8f5,_0x1a0d1d){var _0x2fff81={},_0x1a8689={},_0x4c76b9={'count':0x0,'rows':[]};var _0x39c2f0=_[_0x4c46('0x2c')](db[_0x4c46('0x2d')][_0x4c46('0x2e')],function(_0x350bb3){return{'name':_0x350bb3['fieldName'],'type':_0x350bb3[_0x4c46('0x2f')][_0x4c46('0x30')]};});_0x1a8689[_0x4c46('0x31')]=_[_0x4c46('0x2c')](_0x39c2f0,'name');_0x1a8689[_0x4c46('0x32')]=_[_0x4c46('0x33')](_0x3bf8f5[_0x4c46('0x32')]);_0x1a8689[_0x4c46('0x34')]=_[_0x4c46('0x35')](_0x1a8689[_0x4c46('0x31')],_0x1a8689[_0x4c46('0x32')]);_0x2fff81[_0x4c46('0x36')]=_[_0x4c46('0x35')](_0x1a8689[_0x4c46('0x31')],qs[_0x4c46('0x37')](_0x3bf8f5[_0x4c46('0x32')]['fields']));_0x2fff81['attributes']=_0x2fff81['attributes'][_0x4c46('0x38')]?_0x2fff81[_0x4c46('0x36')]:_0x1a8689[_0x4c46('0x31')];if(!_0x3bf8f5[_0x4c46('0x32')][_0x4c46('0x39')](_0x4c46('0x3a'))){_0x2fff81[_0x4c46('0x1e')]=qs[_0x4c46('0x1e')](_0x3bf8f5['query']['limit']);_0x2fff81[_0x4c46('0x1d')]=qs[_0x4c46('0x1d')](_0x3bf8f5[_0x4c46('0x32')]['offset']);}_0x2fff81[_0x4c46('0x3b')]=qs['sort'](_0x3bf8f5[_0x4c46('0x32')][_0x4c46('0x3c')]);_0x2fff81[_0x4c46('0x3d')]=qs['filters'](_[_0x4c46('0x3e')](_0x3bf8f5[_0x4c46('0x32')],_0x1a8689[_0x4c46('0x34')]),_0x39c2f0);if(_0x3bf8f5[_0x4c46('0x32')][_0x4c46('0x3f')]){_0x2fff81[_0x4c46('0x3d')]=_[_0x4c46('0x40')](_0x2fff81[_0x4c46('0x3d')],{'$or':_[_0x4c46('0x2c')](_0x39c2f0,function(_0x4ff6d8){if(_0x4ff6d8[_0x4c46('0x2f')]!==_0x4c46('0x41')){var _0x2179a3={};_0x2179a3[_0x4ff6d8[_0x4c46('0x42')]]={'$like':'%'+_0x3bf8f5[_0x4c46('0x32')][_0x4c46('0x3f')]+'%'};return _0x2179a3;}})});}_0x2fff81=_[_0x4c46('0x40')]({},_0x2fff81,_0x3bf8f5['options']);var _0x5e791b={'where':_0x2fff81['where']};return db[_0x4c46('0x2d')]['count'](_0x5e791b)['then'](function(_0x3d2744){_0x4c76b9[_0x4c46('0x1c')]=_0x3d2744;if(_0x3bf8f5[_0x4c46('0x32')][_0x4c46('0x43')]){_0x2fff81['include']=[{'all':!![]}];}return db[_0x4c46('0x2d')]['findAll'](_0x2fff81);})[_0x4c46('0x24')](function(_0x561210){_0x4c76b9[_0x4c46('0x44')]=_0x561210;return _0x4c76b9;})['then'](respondWithFilteredResult(_0x1a0d1d,_0x2fff81))['catch'](handleError(_0x1a0d1d,null));};exports[_0x4c46('0x45')]=function(_0xb2052e,_0x30343a){var _0x33c7ce={'raw':!![],'where':{'id':_0xb2052e[_0x4c46('0x46')]['id']}},_0x4f6e17={};_0x4f6e17[_0x4c46('0x31')]=_[_0x4c46('0x33')](db[_0x4c46('0x2d')]['rawAttributes']);_0x4f6e17[_0x4c46('0x32')]=_['keys'](_0xb2052e[_0x4c46('0x32')]);_0x4f6e17[_0x4c46('0x34')]=_['intersection'](_0x4f6e17[_0x4c46('0x31')],_0x4f6e17[_0x4c46('0x32')]);_0x33c7ce['attributes']=_[_0x4c46('0x35')](_0x4f6e17[_0x4c46('0x31')],qs[_0x4c46('0x37')](_0xb2052e[_0x4c46('0x32')]['fields']));_0x33c7ce['attributes']=_0x33c7ce[_0x4c46('0x36')][_0x4c46('0x38')]?_0x33c7ce[_0x4c46('0x36')]:_0x4f6e17[_0x4c46('0x31')];if(_0xb2052e[_0x4c46('0x32')]['includeAll']){_0x33c7ce[_0x4c46('0x47')]=[{'all':!![]}];}_0x33c7ce=_[_0x4c46('0x40')]({},_0x33c7ce,_0xb2052e[_0x4c46('0x48')]);return db['CannedAnswer'][_0x4c46('0x49')](_0x33c7ce)[_0x4c46('0x24')](handleEntityNotFound(_0x30343a,null))['then'](respondWithResult(_0x30343a,null))[_0x4c46('0x4a')](handleError(_0x30343a,null));};exports[_0x4c46('0x23')]=function(_0x42234f,_0x4e467f){if(_0x42234f['body']['id']){delete _0x42234f[_0x4c46('0x4b')]['id'];}return db[_0x4c46('0x2d')][_0x4c46('0x49')]({'where':{'id':_0x42234f['params']['id']}})[_0x4c46('0x24')](handleEntityNotFound(_0x4e467f,null))[_0x4c46('0x24')](saveUpdates(_0x42234f['body'],null))[_0x4c46('0x24')](respondWithResult(_0x4e467f,null))[_0x4c46('0x4a')](handleError(_0x4e467f,null));};exports['destroy']=function(_0x797aa4,_0x13468e){return db[_0x4c46('0x2d')][_0x4c46('0x49')]({'where':{'id':_0x797aa4[_0x4c46('0x46')]['id']}})[_0x4c46('0x24')](handleEntityNotFound(_0x13468e,null))[_0x4c46('0x24')](removeEntity(_0x13468e,null))[_0x4c46('0x4a')](handleError(_0x13468e,null));};exports[_0x4c46('0x4c')]=function(_0x5b5671,_0x493a75){var _0x3cc5cf={'key':_0x5b5671[_0x4c46('0x4b')]['key']};if(_0x5b5671[_0x4c46('0x4b')][_0x4c46('0x4d')]){_0x3cc5cf[_0x4c46('0x4d')]=_0x5b5671[_0x4c46('0x4b')][_0x4c46('0x4d')];}else if(_0x5b5671[_0x4c46('0x4b')][_0x4c46('0x4e')]){_0x3cc5cf['SmsAccountId']=_0x5b5671[_0x4c46('0x4b')][_0x4c46('0x4e')];}else if(_0x5b5671[_0x4c46('0x4b')][_0x4c46('0x4f')]){_0x3cc5cf[_0x4c46('0x4f')]=_0x5b5671[_0x4c46('0x4b')]['OpenchannelAccountId'];}else if(_0x5b5671['body']['ChatWebsiteId']){_0x3cc5cf['ChatWebsiteId']=_0x5b5671[_0x4c46('0x4b')][_0x4c46('0x50')];}return db['CannedAnswer'][_0x4c46('0x49')]({'where':_0x3cc5cf})[_0x4c46('0x24')](function(_0x873e3f){if(_0x873e3f){throw new db[(_0x4c46('0x51'))]['ValidationError'](_0x4c46('0x52'));}return db['CannedAnswer']['create'](_0x5b5671[_0x4c46('0x4b')]);})[_0x4c46('0x24')](function(_0x1335b7){var _0x2bbb88=_0x5b5671[_0x4c46('0x53')][_0x4c46('0x26')]({'plain':!![]});if(!_0x2bbb88)throw new Error(_0x4c46('0x54'));if(_0x2bbb88['role']===_0x4c46('0x53')){var _0x361db8=_0x1335b7[_0x4c46('0x26')]({'plain':!![]});return db[_0x4c46('0x55')][_0x4c46('0x49')]({'where':{'name':_0x4c46('0x27'),'userProfileId':_0x2bbb88[_0x4c46('0x56')]},'raw':!![]})[_0x4c46('0x24')](function(_0x1321ba){if(_0x1321ba&&_0x1321ba[_0x4c46('0x57')]===0x0){return db[_0x4c46('0x58')]['create']({'name':_0x361db8[_0x4c46('0x42')],'resourceId':_0x361db8['id'],'type':_0x1321ba[_0x4c46('0x42')],'sectionId':_0x1321ba['id']},{})[_0x4c46('0x24')](function(){return _0x1335b7;});}else{return _0x1335b7;}})['catch'](function(_0x253ed5){logger[_0x4c46('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x253ed5);throw _0x253ed5;});}return _0x1335b7;})[_0x4c46('0x24')](respondWithResult(_0x493a75,0xc9))[_0x4c46('0x4a')](handleError(_0x493a75,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 71d751b..2699f89 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 _0x10dc=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x10dc,0x107));var _0xc10d=function(_0x19aee6,_0xcb2918){_0x19aee6=_0x19aee6-0x0;var _0x511975=_0x10dc[_0x19aee6];return _0x511975;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var logger=require('../../config/logger')(_0xc10d('0x2'));var moment=require('moment');var BPromise=require(_0xc10d('0x3'));var rp=require(_0xc10d('0x4'));var fs=require('fs');var path=require(_0xc10d('0x5'));var rimraf=require(_0xc10d('0x6'));var config=require(_0xc10d('0x7'));var attributes=require(_0xc10d('0x8'));module[_0xc10d('0x9')]=function(_0x25e10c,_0x48baac){return _0x25e10c[_0xc10d('0xa')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc10d('0xb'),'collate':_0xc10d('0xc')});}; \ No newline at end of file +var _0x2086=['./cannedAnswer.attributes','exports','define','tools_canned_answers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4a9f87,_0x5ce674){var _0x3eac3c=function(_0x736aa5){while(--_0x736aa5){_0x4a9f87['push'](_0x4a9f87['shift']());}};_0x3eac3c(++_0x5ce674);}(_0x2086,0x124));var _0x6208=function(_0x525bb3,_0x166833){_0x525bb3=_0x525bb3-0x0;var _0x4a313e=_0x2086[_0x525bb3];return _0x4a313e;};'use strict';var _=require(_0x6208('0x0'));var util=require(_0x6208('0x1'));var logger=require(_0x6208('0x2'))(_0x6208('0x3'));var moment=require(_0x6208('0x4'));var BPromise=require(_0x6208('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6208('0x6'));var rimraf=require(_0x6208('0x7'));var config=require('../../config/environment');var attributes=require(_0x6208('0x8'));module[_0x6208('0x9')]=function(_0x38bc4d,_0xb3cf2a){return _0x38bc4d[_0x6208('0xa')]('CannedAnswer',attributes,{'tableName':_0x6208('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 0306dcb..91efa02 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 _0xde01=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x443ae8,_0x4a0f60){var _0x2fb3d1=function(_0x3aa37f){while(--_0x3aa37f){_0x443ae8['push'](_0x443ae8['shift']());}};_0x2fb3d1(++_0x4a0f60);}(_0xde01,0x1dd));var _0x1de0=function(_0xf20093,_0x325add){_0xf20093=_0xf20093-0x0;var _0x25bd83=_0xde01[_0xf20093];return _0x25bd83;};'use strict';var _=require('lodash');var util=require(_0x1de0('0x0'));var moment=require(_0x1de0('0x1'));var BPromise=require(_0x1de0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1de0('0x3'));var db=require(_0x1de0('0x4'))['db'];var utils=require(_0x1de0('0x5'));var logger=require(_0x1de0('0x6'))(_0x1de0('0x7'));var config=require(_0x1de0('0x8'));var jayson=require(_0x1de0('0x9'));var client=jayson[_0x1de0('0xa')][_0x1de0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5715a6,_0x4f568f,_0x24773d){return new BPromise(function(_0x32f97c,_0x44058e){return client['request'](_0x5715a6,_0x24773d)[_0x1de0('0xc')](function(_0x300319){logger[_0x1de0('0xd')](_0x1de0('0xe'),_0x4f568f,'request\x20sent');logger[_0x1de0('0xf')](_0x1de0('0x10'),_0x4f568f,_0x1de0('0x11'),JSON[_0x1de0('0x12')](_0x300319));if(_0x300319['error']){if(_0x300319[_0x1de0('0x13')][_0x1de0('0x14')]===0x1f4){logger['error'](_0x1de0('0xe'),_0x4f568f,_0x300319[_0x1de0('0x13')][_0x1de0('0x15')]);return _0x44058e(_0x300319['error']['message']);}logger['error'](_0x1de0('0xe'),_0x4f568f,_0x300319['error'][_0x1de0('0x15')]);return _0x32f97c(_0x300319['error'][_0x1de0('0x15')]);}else{logger[_0x1de0('0xd')](_0x1de0('0xe'),_0x4f568f,_0x1de0('0x11'));_0x32f97c(_0x300319[_0x1de0('0x16')][_0x1de0('0x15')]);}})['catch'](function(_0x472c51){logger[_0x1de0('0x13')](_0x1de0('0xe'),_0x4f568f,_0x472c51);_0x44058e(_0x472c51);});});} \ No newline at end of file +var _0x7acf=['request','then','info','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0xf8ca9f,_0x5d65dd){var _0x55a2f6=function(_0x4a956d){while(--_0x4a956d){_0xf8ca9f['push'](_0xf8ca9f['shift']());}};_0x55a2f6(++_0x5d65dd);}(_0x7acf,0x1bd));var _0xf7ac=function(_0x7c2221,_0x43626b){_0x7c2221=_0x7c2221-0x0;var _0x514522=_0x7acf[_0x7c2221];return _0x514522;};'use strict';var _=require(_0xf7ac('0x0'));var util=require(_0xf7ac('0x1'));var moment=require(_0xf7ac('0x2'));var BPromise=require(_0xf7ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7ac('0x4'));var db=require(_0xf7ac('0x5'))['db'];var utils=require(_0xf7ac('0x6'));var logger=require(_0xf7ac('0x7'))(_0xf7ac('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf7ac('0x9')][_0xf7ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x191a5b,_0x2e7d0d,_0xc980d7){return new BPromise(function(_0xd8c62b,_0x2d55d4){return client[_0xf7ac('0xb')](_0x191a5b,_0xc980d7)[_0xf7ac('0xc')](function(_0x4f6ef0){logger[_0xf7ac('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x2e7d0d,'request\x20sent');logger[_0xf7ac('0xe')](_0xf7ac('0xf'),_0x2e7d0d,_0xf7ac('0x10'),JSON[_0xf7ac('0x11')](_0x4f6ef0));if(_0x4f6ef0[_0xf7ac('0x12')]){if(_0x4f6ef0[_0xf7ac('0x12')][_0xf7ac('0x13')]===0x1f4){logger[_0xf7ac('0x12')](_0xf7ac('0x14'),_0x2e7d0d,_0x4f6ef0[_0xf7ac('0x12')][_0xf7ac('0x15')]);return _0x2d55d4(_0x4f6ef0[_0xf7ac('0x12')]['message']);}logger['error'](_0xf7ac('0x14'),_0x2e7d0d,_0x4f6ef0[_0xf7ac('0x12')][_0xf7ac('0x15')]);return _0xd8c62b(_0x4f6ef0[_0xf7ac('0x12')]['message']);}else{logger[_0xf7ac('0xd')](_0xf7ac('0x14'),_0x2e7d0d,_0xf7ac('0x10'));_0xd8c62b(_0x4f6ef0[_0xf7ac('0x16')][_0xf7ac('0x15')]);}})[_0xf7ac('0x17')](function(_0x2c0418){logger[_0xf7ac('0x12')](_0xf7ac('0x14'),_0x2e7d0d,_0x2c0418);_0x2d55d4(_0x2c0418);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 9bd926d..2fb60e2 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 _0x7698=['index','/:id','show','post','create','destroy','multer','util','path','connect-timeout','../../components/interaction/service','get','isAuthenticated'];(function(_0x4fbea3,_0x468a80){var _0x1ea3a4=function(_0x5d0935){while(--_0x5d0935){_0x4fbea3['push'](_0x4fbea3['shift']());}};_0x1ea3a4(++_0x468a80);}(_0x7698,0x7b));var _0x8769=function(_0x471254,_0x231bea){_0x471254=_0x471254-0x0;var _0x239ba4=_0x7698[_0x471254];return _0x239ba4;};'use strict';var multer=require(_0x8769('0x0'));var util=require(_0x8769('0x1'));var path=require(_0x8769('0x2'));var timeout=require(_0x8769('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8769('0x4'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x8769('0x5')]('/',auth[_0x8769('0x6')](),controller[_0x8769('0x7')]);router[_0x8769('0x5')](_0x8769('0x8'),auth[_0x8769('0x6')](),controller[_0x8769('0x9')]);router[_0x8769('0xa')]('/',auth[_0x8769('0x6')](),controller[_0x8769('0xb')]);router['put'](_0x8769('0x8'),auth[_0x8769('0x6')](),controller['update']);router['delete']('/:id',auth[_0x8769('0x6')](),controller[_0x8769('0xc')]);module['exports']=router; \ No newline at end of file +var _0x45ba=['get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x45ba,0x1d7));var _0xa45b=function(_0x13759d,_0x21e1b4){_0x13759d=_0x13759d-0x0;var _0x56ff0b=_0x45ba[_0x13759d];return _0x56ff0b;};'use strict';var multer=require(_0xa45b('0x0'));var util=require(_0xa45b('0x1'));var path=require(_0xa45b('0x2'));var timeout=require(_0xa45b('0x3'));var express=require(_0xa45b('0x4'));var router=express[_0xa45b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa45b('0x6'));var config=require(_0xa45b('0x7'));var controller=require(_0xa45b('0x8'));router[_0xa45b('0x9')]('/',auth[_0xa45b('0xa')](),controller[_0xa45b('0xb')]);router[_0xa45b('0x9')]('/:id',auth[_0xa45b('0xa')](),controller[_0xa45b('0xc')]);router[_0xa45b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa45b('0xe')](_0xa45b('0xf'),auth['isAuthenticated'](),controller[_0xa45b('0x10')]);router[_0xa45b('0x11')]('/:id',auth[_0xa45b('0xa')](),controller[_0xa45b('0x12')]);module[_0xa45b('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 27159ad..715149f 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 _0xa550=['STRING','INTEGER','sequelize','DATE','1970-01-01\x2000:00:01'];(function(_0x3b7b42,_0x31badd){var _0x1ebaad=function(_0x3655d9){while(--_0x3655d9){_0x3b7b42['push'](_0x3b7b42['shift']());}};_0x1ebaad(++_0x31badd);}(_0xa550,0x8e));var _0x0a55=function(_0x5013f2,_0x3d896b){_0x5013f2=_0x5013f2-0x0;var _0x166b9f=_0xa550[_0x5013f2];return _0x166b9f;};'use strict';var Sequelize=require(_0x0a55('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x0a55('0x1')],'allowNull':![],'defaultValue':_0x0a55('0x2')},'clid':{'type':Sequelize[_0x0a55('0x3')]},'src':{'type':Sequelize[_0x0a55('0x3')]},'dst':{'type':Sequelize[_0x0a55('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0a55('0x3')]},'dstchannel':{'type':Sequelize[_0x0a55('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x0a55('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0a55('0x3')]},'amaflags':{'type':Sequelize[_0x0a55('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0a55('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0a55('0x3')]},'linkedid':{'type':Sequelize[_0x0a55('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0a55('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xea1e=['STRING','INTEGER','sequelize','1970-01-01\x2000:00:01'];(function(_0x4aa2d0,_0x57328e){var _0x570f72=function(_0x254be2){while(--_0x254be2){_0x4aa2d0['push'](_0x4aa2d0['shift']());}};_0x570f72(++_0x57328e);}(_0xea1e,0xaa));var _0xeea1=function(_0x37e9ce,_0x1e0fb0){_0x37e9ce=_0x37e9ce-0x0;var _0xe1e628=_0xea1e[_0x37e9ce];return _0xe1e628;};'use strict';var Sequelize=require(_0xeea1('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xeea1('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xeea1('0x2')]},'dcontext':{'type':Sequelize[_0xeea1('0x2')]},'channel':{'type':Sequelize[_0xeea1('0x2')]},'dstchannel':{'type':Sequelize[_0xeea1('0x2')]},'lastapp':{'type':Sequelize[_0xeea1('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xeea1('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xeea1('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xeea1('0x2')]},'userfield':{'type':Sequelize[_0xeea1('0x2')]},'uniqueid':{'type':Sequelize[_0xeea1('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xeea1('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xeea1('0x2')]},'tag':{'type':Sequelize[_0xeea1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 628b4ce..d8e84da 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 _0x7783=['pick','type','filter','options','count','includeAll','include','findAll','rows','catch','params','intersection','length','merge','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','query','keys','filters','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x31bada,_0x346e41){var _0x548bf0=function(_0x3ddcb3){while(--_0x3ddcb3){_0x31bada['push'](_0x31bada['shift']());}};_0x548bf0(++_0x346e41);}(_0x7783,0xa2));var _0x3778=function(_0x2c0019,_0x319d93){_0x2c0019=_0x2c0019-0x0;var _0x1c7ee3=_0x7783[_0x2c0019];return _0x1c7ee3;};'use strict';var pdf=require(_0x3778('0x0'));var emlformat=require(_0x3778('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3778('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3778('0x3'));var moment=require(_0x3778('0x4'));var BPromise=require(_0x3778('0x5'));var Mustache=require('mustache');var util=require(_0x3778('0x6'));var path=require(_0x3778('0x7'));var sox=require(_0x3778('0x8'));var csv=require('to-csv');var ejs=require(_0x3778('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3778('0xa'));var crypto=require('crypto');var jsforce=require(_0x3778('0xb'));var deskjs=require(_0x3778('0xc'));var toCsv=require(_0x3778('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3778('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3778('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3778('0x10'));var logger=require(_0x3778('0x11'))('api');var utils=require(_0x3778('0x12'));var config=require(_0x3778('0x13'));var db=require(_0x3778('0x14'))['db'];function respondWithStatusCode(_0x284969,_0x1fca3f){_0x1fca3f=_0x1fca3f||0xcc;return function(_0x135478){if(_0x135478){return _0x284969[_0x3778('0x15')](_0x1fca3f);}return _0x284969[_0x3778('0x16')](_0x1fca3f)[_0x3778('0x17')]();};}function respondWithResult(_0x2059df,_0x27ad2c){_0x27ad2c=_0x27ad2c||0xc8;return function(_0x41c320){if(_0x41c320){return _0x2059df[_0x3778('0x16')](_0x27ad2c)[_0x3778('0x18')](_0x41c320);}};}function respondWithFilteredResult(_0x6b29fe,_0x23dc14){return function(_0x47954c){if(_0x47954c){var _0x44f072=_0x47954c['count'],_0xf1f1e4=_0x23dc14[_0x3778('0x19')],_0x52e1b0=_0x23dc14[_0x3778('0x19')]+_0x23dc14[_0x3778('0x1a')],_0x131360;if(_0x52e1b0>=_0x44f072){_0x52e1b0=_0x44f072;_0x131360=0xc8;}else{_0x131360=0xce;}_0x6b29fe[_0x3778('0x16')](_0x131360);return _0x6b29fe['set']('Content-Range',_0xf1f1e4+'-'+_0x52e1b0+'/'+_0x44f072)[_0x3778('0x18')](_0x47954c);}return null;};}function patchUpdates(_0x34c634){return function(_0x5e15){try{jsonpatch[_0x3778('0x1b')](_0x5e15,_0x34c634,!![]);}catch(_0x49ede0){return BPromise[_0x3778('0x1c')](_0x49ede0);}return _0x5e15[_0x3778('0x1d')]();};}function saveUpdates(_0x877e94,_0x10d919){return function(_0xcb9da7){if(_0xcb9da7){return _0xcb9da7[_0x3778('0x1e')](_0x877e94)[_0x3778('0x1f')](function(_0x755e54){return _0x755e54;});}return null;};}function removeEntity(_0xf86c55,_0x104056){return function(_0x59c046){if(_0x59c046){return _0x59c046[_0x3778('0x20')]()[_0x3778('0x1f')](function(){_0xf86c55[_0x3778('0x16')](0xcc)[_0x3778('0x17')]();});}};}function handleEntityNotFound(_0x911b13,_0x485c70){return function(_0x31afee){if(!_0x31afee){_0x911b13[_0x3778('0x15')](0x194);}return _0x31afee;};}function handleError(_0x7ab630,_0x174bee){_0x174bee=_0x174bee||0x1f4;return function(_0x5a228a){logger[_0x3778('0x21')](_0x5a228a[_0x3778('0x22')]);if(_0x5a228a[_0x3778('0x23')]){delete _0x5a228a['name'];}_0x7ab630[_0x3778('0x16')](_0x174bee)[_0x3778('0x24')](_0x5a228a);};}exports[_0x3778('0x25')]=function(_0x2dea7f,_0x4aba35){var _0x4cd865={},_0x30323a={},_0x2be275={'count':0x0,'rows':[]};var _0x5db42a=_[_0x3778('0x26')](db[_0x3778('0x27')][_0x3778('0x28')],function(_0x555203){return{'name':_0x555203[_0x3778('0x29')],'type':_0x555203['type'][_0x3778('0x2a')]};});_0x30323a['model']=_[_0x3778('0x26')](_0x5db42a,_0x3778('0x23'));_0x30323a[_0x3778('0x2b')]=_[_0x3778('0x2c')](_0x2dea7f[_0x3778('0x2b')]);_0x30323a[_0x3778('0x2d')]=_['intersection'](_0x30323a['model'],_0x30323a['query']);_0x4cd865[_0x3778('0x2e')]=_['intersection'](_0x30323a[_0x3778('0x2f')],qs['fields'](_0x2dea7f[_0x3778('0x2b')][_0x3778('0x30')]));_0x4cd865[_0x3778('0x2e')]=_0x4cd865[_0x3778('0x2e')]['length']?_0x4cd865[_0x3778('0x2e')]:_0x30323a[_0x3778('0x2f')];if(!_0x2dea7f[_0x3778('0x2b')][_0x3778('0x31')](_0x3778('0x32'))){_0x4cd865[_0x3778('0x1a')]=qs[_0x3778('0x1a')](_0x2dea7f[_0x3778('0x2b')][_0x3778('0x1a')]);_0x4cd865[_0x3778('0x19')]=qs[_0x3778('0x19')](_0x2dea7f['query']['offset']);}_0x4cd865[_0x3778('0x33')]=qs['sort'](_0x2dea7f[_0x3778('0x2b')][_0x3778('0x34')]);_0x4cd865[_0x3778('0x35')]=qs['filters'](_[_0x3778('0x36')](_0x2dea7f[_0x3778('0x2b')],_0x30323a['filters']),_0x5db42a);if(_0x2dea7f[_0x3778('0x2b')]['filter']){_0x4cd865['where']=_['merge'](_0x4cd865[_0x3778('0x35')],{'$or':_['map'](_0x5db42a,function(_0x25027b){if(_0x25027b[_0x3778('0x37')]!=='VIRTUAL'){var _0x4f7091={};_0x4f7091[_0x25027b[_0x3778('0x23')]]={'$like':'%'+_0x2dea7f[_0x3778('0x2b')][_0x3778('0x38')]+'%'};return _0x4f7091;}})});}_0x4cd865=_['merge']({},_0x4cd865,_0x2dea7f[_0x3778('0x39')]);var _0x230e45={'where':_0x4cd865[_0x3778('0x35')]};return db[_0x3778('0x27')][_0x3778('0x3a')](_0x230e45)[_0x3778('0x1f')](function(_0xba0f12){_0x2be275[_0x3778('0x3a')]=_0xba0f12;if(_0x2dea7f[_0x3778('0x2b')][_0x3778('0x3b')]){_0x4cd865[_0x3778('0x3c')]=[{'all':!![]}];}return db[_0x3778('0x27')][_0x3778('0x3d')](_0x4cd865);})['then'](function(_0x1cbf5e){_0x2be275[_0x3778('0x3e')]=_0x1cbf5e;return _0x2be275;})[_0x3778('0x1f')](respondWithFilteredResult(_0x4aba35,_0x4cd865))[_0x3778('0x3f')](handleError(_0x4aba35,null));};exports['show']=function(_0x3bad69,_0x4a27e7){var _0x3a4731={'raw':!![],'where':{'id':_0x3bad69[_0x3778('0x40')]['id']}},_0x3f0bb9={};_0x3f0bb9[_0x3778('0x2f')]=_[_0x3778('0x2c')](db[_0x3778('0x27')]['rawAttributes']);_0x3f0bb9[_0x3778('0x2b')]=_[_0x3778('0x2c')](_0x3bad69[_0x3778('0x2b')]);_0x3f0bb9['filters']=_[_0x3778('0x41')](_0x3f0bb9[_0x3778('0x2f')],_0x3f0bb9['query']);_0x3a4731[_0x3778('0x2e')]=_[_0x3778('0x41')](_0x3f0bb9[_0x3778('0x2f')],qs[_0x3778('0x30')](_0x3bad69['query'][_0x3778('0x30')]));_0x3a4731[_0x3778('0x2e')]=_0x3a4731[_0x3778('0x2e')][_0x3778('0x42')]?_0x3a4731['attributes']:_0x3f0bb9[_0x3778('0x2f')];if(_0x3bad69[_0x3778('0x2b')]['includeAll']){_0x3a4731[_0x3778('0x3c')]=[{'all':!![]}];}_0x3a4731=_[_0x3778('0x43')]({},_0x3a4731,_0x3bad69[_0x3778('0x39')]);return db['Cdr']['find'](_0x3a4731)['then'](handleEntityNotFound(_0x4a27e7,null))['then'](respondWithResult(_0x4a27e7,null))[_0x3778('0x3f')](handleError(_0x4a27e7,null));};exports[_0x3778('0x44')]=function(_0x2b60bf,_0x4fb206){return db[_0x3778('0x27')]['create'](_0x2b60bf[_0x3778('0x45')],{})[_0x3778('0x1f')](respondWithResult(_0x4fb206,0xc9))[_0x3778('0x3f')](handleError(_0x4fb206,null));};exports[_0x3778('0x1e')]=function(_0xa3d55,_0xf9825d){if(_0xa3d55[_0x3778('0x45')]['id']){delete _0xa3d55[_0x3778('0x45')]['id'];}return db[_0x3778('0x27')][_0x3778('0x46')]({'where':{'id':_0xa3d55[_0x3778('0x40')]['id']}})[_0x3778('0x1f')](handleEntityNotFound(_0xf9825d,null))[_0x3778('0x1f')](saveUpdates(_0xa3d55[_0x3778('0x45')],null))['then'](respondWithResult(_0xf9825d,null))[_0x3778('0x3f')](handleError(_0xf9825d,null));};exports['destroy']=function(_0x568b68,_0x1b5818){return db['Cdr'][_0x3778('0x46')]({'where':{'id':_0x568b68[_0x3778('0x40')]['id']}})['then'](handleEntityNotFound(_0x1b5818,null))[_0x3778('0x1f')](removeEntity(_0x1b5818,null))['catch'](handleError(_0x1b5818,null));};exports[_0x3778('0x47')]=function(_0x2f15ab,_0x5070a5){return db[_0x3778('0x27')][_0x3778('0x47')]()[_0x3778('0x1f')](respondWithResult(_0x5070a5,null))['catch'](handleError(_0x5070a5,null));}; \ No newline at end of file +var _0xd7c3=['set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Cdr','rawAttributes','type','query','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset'];(function(_0x72324c,_0x178f26){var _0x2e2bcd=function(_0x1782bc){while(--_0x1782bc){_0x72324c['push'](_0x72324c['shift']());}};_0x2e2bcd(++_0x178f26);}(_0xd7c3,0xc4));var _0x3d7c=function(_0x507526,_0x402649){_0x507526=_0x507526-0x0;var _0x12df4d=_0xd7c3[_0x507526];return _0x12df4d;};'use strict';var pdf=require(_0x3d7c('0x0'));var emlformat=require(_0x3d7c('0x1'));var rimraf=require(_0x3d7c('0x2'));var zipdir=require(_0x3d7c('0x3'));var jsonpatch=require(_0x3d7c('0x4'));var rp=require('request-promise');var moment=require(_0x3d7c('0x5'));var BPromise=require(_0x3d7c('0x6'));var Mustache=require(_0x3d7c('0x7'));var util=require(_0x3d7c('0x8'));var path=require(_0x3d7c('0x9'));var sox=require(_0x3d7c('0xa'));var csv=require('to-csv');var ejs=require(_0x3d7c('0xb'));var fs=require('fs');var _=require(_0x3d7c('0xc'));var squel=require(_0x3d7c('0xd'));var crypto=require('crypto');var jsforce=require(_0x3d7c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3d7c('0xf'));var querystring=require(_0x3d7c('0x10'));var Papa=require(_0x3d7c('0x11'));var Redis=require(_0x3d7c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3d7c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d7c('0x14'))(_0x3d7c('0x15'));var utils=require(_0x3d7c('0x16'));var config=require(_0x3d7c('0x17'));var db=require(_0x3d7c('0x18'))['db'];function respondWithStatusCode(_0x192bc9,_0x345e9f){_0x345e9f=_0x345e9f||0xcc;return function(_0x210a80){if(_0x210a80){return _0x192bc9['sendStatus'](_0x345e9f);}return _0x192bc9[_0x3d7c('0x19')](_0x345e9f)[_0x3d7c('0x1a')]();};}function respondWithResult(_0x26089d,_0x1516c7){_0x1516c7=_0x1516c7||0xc8;return function(_0x1f9ecd){if(_0x1f9ecd){return _0x26089d['status'](_0x1516c7)['json'](_0x1f9ecd);}};}function respondWithFilteredResult(_0xced53,_0x3ad80c){return function(_0x1b2806){if(_0x1b2806){var _0x3260a5=_0x1b2806[_0x3d7c('0x1b')],_0x576207=_0x3ad80c[_0x3d7c('0x1c')],_0x4975fd=_0x3ad80c[_0x3d7c('0x1c')]+_0x3ad80c['limit'],_0x3daa53;if(_0x4975fd>=_0x3260a5){_0x4975fd=_0x3260a5;_0x3daa53=0xc8;}else{_0x3daa53=0xce;}_0xced53[_0x3d7c('0x19')](_0x3daa53);return _0xced53[_0x3d7c('0x1d')](_0x3d7c('0x1e'),_0x576207+'-'+_0x4975fd+'/'+_0x3260a5)['json'](_0x1b2806);}return null;};}function patchUpdates(_0x1073fc){return function(_0x36462c){try{jsonpatch[_0x3d7c('0x1f')](_0x36462c,_0x1073fc,!![]);}catch(_0x589115){return BPromise[_0x3d7c('0x20')](_0x589115);}return _0x36462c[_0x3d7c('0x21')]();};}function saveUpdates(_0x19b5d1,_0x1af850){return function(_0x37a586){if(_0x37a586){return _0x37a586[_0x3d7c('0x22')](_0x19b5d1)[_0x3d7c('0x23')](function(_0x4d730f){return _0x4d730f;});}return null;};}function removeEntity(_0x2a2161,_0x362b4d){return function(_0x1ad2d1){if(_0x1ad2d1){return _0x1ad2d1['destroy']()['then'](function(){_0x2a2161['status'](0xcc)[_0x3d7c('0x1a')]();});}};}function handleEntityNotFound(_0xa7557c,_0x1f7d1d){return function(_0xdab932){if(!_0xdab932){_0xa7557c[_0x3d7c('0x24')](0x194);}return _0xdab932;};}function handleError(_0x563260,_0x34fb46){_0x34fb46=_0x34fb46||0x1f4;return function(_0x1e0640){logger['error'](_0x1e0640[_0x3d7c('0x25')]);if(_0x1e0640[_0x3d7c('0x26')]){delete _0x1e0640[_0x3d7c('0x26')];}_0x563260[_0x3d7c('0x19')](_0x34fb46)[_0x3d7c('0x27')](_0x1e0640);};}exports[_0x3d7c('0x28')]=function(_0x5154b4,_0x45f5d9){var _0x26375f={},_0x366722={},_0x369790={'count':0x0,'rows':[]};var _0x4f25a7=_[_0x3d7c('0x29')](db[_0x3d7c('0x2a')][_0x3d7c('0x2b')],function(_0x1355d6){return{'name':_0x1355d6['fieldName'],'type':_0x1355d6[_0x3d7c('0x2c')]['key']};});_0x366722['model']=_[_0x3d7c('0x29')](_0x4f25a7,_0x3d7c('0x26'));_0x366722[_0x3d7c('0x2d')]=_['keys'](_0x5154b4[_0x3d7c('0x2d')]);_0x366722['filters']=_[_0x3d7c('0x2e')](_0x366722[_0x3d7c('0x2f')],_0x366722[_0x3d7c('0x2d')]);_0x26375f[_0x3d7c('0x30')]=_[_0x3d7c('0x2e')](_0x366722[_0x3d7c('0x2f')],qs['fields'](_0x5154b4[_0x3d7c('0x2d')][_0x3d7c('0x31')]));_0x26375f[_0x3d7c('0x30')]=_0x26375f[_0x3d7c('0x30')][_0x3d7c('0x32')]?_0x26375f[_0x3d7c('0x30')]:_0x366722[_0x3d7c('0x2f')];if(!_0x5154b4[_0x3d7c('0x2d')][_0x3d7c('0x33')]('nolimit')){_0x26375f[_0x3d7c('0x34')]=qs[_0x3d7c('0x34')](_0x5154b4[_0x3d7c('0x2d')][_0x3d7c('0x34')]);_0x26375f[_0x3d7c('0x1c')]=qs[_0x3d7c('0x1c')](_0x5154b4[_0x3d7c('0x2d')][_0x3d7c('0x1c')]);}_0x26375f[_0x3d7c('0x35')]=qs['sort'](_0x5154b4[_0x3d7c('0x2d')][_0x3d7c('0x36')]);_0x26375f[_0x3d7c('0x37')]=qs[_0x3d7c('0x38')](_[_0x3d7c('0x39')](_0x5154b4[_0x3d7c('0x2d')],_0x366722[_0x3d7c('0x38')]),_0x4f25a7);if(_0x5154b4[_0x3d7c('0x2d')][_0x3d7c('0x3a')]){_0x26375f[_0x3d7c('0x37')]=_['merge'](_0x26375f[_0x3d7c('0x37')],{'$or':_[_0x3d7c('0x29')](_0x4f25a7,function(_0x19f933){if(_0x19f933[_0x3d7c('0x2c')]!==_0x3d7c('0x3b')){var _0x3a588d={};_0x3a588d[_0x19f933[_0x3d7c('0x26')]]={'$like':'%'+_0x5154b4[_0x3d7c('0x2d')][_0x3d7c('0x3a')]+'%'};return _0x3a588d;}})});}_0x26375f=_[_0x3d7c('0x3c')]({},_0x26375f,_0x5154b4[_0x3d7c('0x3d')]);var _0x238dfa={'where':_0x26375f[_0x3d7c('0x37')]};return db['Cdr']['count'](_0x238dfa)['then'](function(_0x653d25){_0x369790[_0x3d7c('0x1b')]=_0x653d25;if(_0x5154b4[_0x3d7c('0x2d')][_0x3d7c('0x3e')]){_0x26375f[_0x3d7c('0x3f')]=[{'all':!![]}];}return db[_0x3d7c('0x2a')][_0x3d7c('0x40')](_0x26375f);})[_0x3d7c('0x23')](function(_0x381e08){_0x369790[_0x3d7c('0x41')]=_0x381e08;return _0x369790;})[_0x3d7c('0x23')](respondWithFilteredResult(_0x45f5d9,_0x26375f))['catch'](handleError(_0x45f5d9,null));};exports[_0x3d7c('0x42')]=function(_0x28395c,_0x202cdb){var _0x1acda1={'raw':!![],'where':{'id':_0x28395c[_0x3d7c('0x43')]['id']}},_0x279d7f={};_0x279d7f[_0x3d7c('0x2f')]=_[_0x3d7c('0x44')](db['Cdr']['rawAttributes']);_0x279d7f[_0x3d7c('0x2d')]=_[_0x3d7c('0x44')](_0x28395c[_0x3d7c('0x2d')]);_0x279d7f[_0x3d7c('0x38')]=_['intersection'](_0x279d7f[_0x3d7c('0x2f')],_0x279d7f[_0x3d7c('0x2d')]);_0x1acda1[_0x3d7c('0x30')]=_[_0x3d7c('0x2e')](_0x279d7f[_0x3d7c('0x2f')],qs[_0x3d7c('0x31')](_0x28395c[_0x3d7c('0x2d')][_0x3d7c('0x31')]));_0x1acda1['attributes']=_0x1acda1[_0x3d7c('0x30')]['length']?_0x1acda1[_0x3d7c('0x30')]:_0x279d7f[_0x3d7c('0x2f')];if(_0x28395c[_0x3d7c('0x2d')][_0x3d7c('0x3e')]){_0x1acda1[_0x3d7c('0x3f')]=[{'all':!![]}];}_0x1acda1=_[_0x3d7c('0x3c')]({},_0x1acda1,_0x28395c[_0x3d7c('0x3d')]);return db[_0x3d7c('0x2a')]['find'](_0x1acda1)[_0x3d7c('0x23')](handleEntityNotFound(_0x202cdb,null))[_0x3d7c('0x23')](respondWithResult(_0x202cdb,null))[_0x3d7c('0x45')](handleError(_0x202cdb,null));};exports[_0x3d7c('0x46')]=function(_0x5c0379,_0x534276){return db['Cdr'][_0x3d7c('0x46')](_0x5c0379[_0x3d7c('0x47')],{})[_0x3d7c('0x23')](respondWithResult(_0x534276,0xc9))[_0x3d7c('0x45')](handleError(_0x534276,null));};exports[_0x3d7c('0x22')]=function(_0x1c90ed,_0xdb7c10){if(_0x1c90ed[_0x3d7c('0x47')]['id']){delete _0x1c90ed[_0x3d7c('0x47')]['id'];}return db['Cdr'][_0x3d7c('0x48')]({'where':{'id':_0x1c90ed[_0x3d7c('0x43')]['id']}})[_0x3d7c('0x23')](handleEntityNotFound(_0xdb7c10,null))['then'](saveUpdates(_0x1c90ed[_0x3d7c('0x47')],null))[_0x3d7c('0x23')](respondWithResult(_0xdb7c10,null))[_0x3d7c('0x45')](handleError(_0xdb7c10,null));};exports[_0x3d7c('0x49')]=function(_0x542c0b,_0x673b83){return db[_0x3d7c('0x2a')][_0x3d7c('0x48')]({'where':{'id':_0x542c0b['params']['id']}})[_0x3d7c('0x23')](handleEntityNotFound(_0x673b83,null))[_0x3d7c('0x23')](removeEntity(_0x673b83,null))[_0x3d7c('0x45')](handleError(_0x673b83,null));};exports[_0x3d7c('0x4a')]=function(_0x12595d,_0x36c752){return db[_0x3d7c('0x2a')][_0x3d7c('0x4a')]()[_0x3d7c('0x23')](respondWithResult(_0x36c752,null))['catch'](handleError(_0x36c752,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 797c1f1..f94b6c2 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 _0x48a4=['Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','api','path','../../config/environment','./cdr.attributes','define'];(function(_0x4cb408,_0x2054c9){var _0x28fc52=function(_0x5a2d57){while(--_0x5a2d57){_0x4cb408['push'](_0x4cb408['shift']());}};_0x28fc52(++_0x2054c9);}(_0x48a4,0x86));var _0x448a=function(_0x4bd012,_0x22323d){_0x4bd012=_0x4bd012-0x0;var _0x4813ac=_0x48a4[_0x4bd012];return _0x4813ac;};'use strict';var _=require(_0x448a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x448a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x448a('0x2'));var rimraf=require('rimraf');var config=require(_0x448a('0x3'));var attributes=require(_0x448a('0x4'));module['exports']=function(_0x3d32bb,_0x2251a8){return _0x3d32bb[_0x448a('0x5')](_0x448a('0x6'),attributes,{'tableName':_0x448a('0x7'),'paranoid':![],'indexes':[{'name':_0x448a('0x8'),'fields':['accountcode']},{'name':_0x448a('0x9'),'fields':[_0x448a('0x9')]},{'name':_0x448a('0xa'),'fields':['disposition']},{'name':_0x448a('0xb'),'fields':['dst']},{'name':_0x448a('0xc'),'fields':[_0x448a('0xc')]},{'name':_0x448a('0xd'),'fields':[_0x448a('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf2f3=['moment','bluebird','path','rimraf','../../config/environment','define','Cdr','accountcode','calldate','dst','uniqueid','lodash'];(function(_0x30f0f2,_0x8a4674){var _0x1abc3f=function(_0x1c9f67){while(--_0x1c9f67){_0x30f0f2['push'](_0x30f0f2['shift']());}};_0x1abc3f(++_0x8a4674);}(_0xf2f3,0x83));var _0x3f2f=function(_0x55b7f5,_0x156133){_0x55b7f5=_0x55b7f5-0x0;var _0x16e474=_0xf2f3[_0x55b7f5];return _0x16e474;};'use strict';var _=require(_0x3f2f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3f2f('0x1'));var BPromise=require(_0x3f2f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f2f('0x3'));var rimraf=require(_0x3f2f('0x4'));var config=require(_0x3f2f('0x5'));var attributes=require('./cdr.attributes');module['exports']=function(_0x4d7240,_0x3ccbf6){return _0x4d7240[_0x3f2f('0x6')](_0x3f2f('0x7'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x3f2f('0x8'),'fields':[_0x3f2f('0x8')]},{'name':_0x3f2f('0x9'),'fields':[_0x3f2f('0x9')]},{'name':'disposition','fields':['disposition']},{'name':_0x3f2f('0xa'),'fields':['dst']},{'name':'src','fields':['src']},{'name':_0x3f2f('0xb'),'fields':[_0x3f2f('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 7015511..b4cac63 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 _0xf430=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','moment','bluebird','randomstring','ioredis'];(function(_0x5d860a,_0xe2505b){var _0x2bd13a=function(_0x471d8c){while(--_0x471d8c){_0x5d860a['push'](_0x5d860a['shift']());}};_0x2bd13a(++_0xe2505b);}(_0xf430,0x1f4));var _0x0f43=function(_0x5528c3,_0x35a416){_0x5528c3=_0x5528c3-0x0;var _0x47ec1b=_0xf430[_0x5528c3];return _0x47ec1b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0f43('0x0'));var BPromise=require(_0x0f43('0x1'));var rs=require(_0x0f43('0x2'));var fs=require('fs');var Redis=require(_0x0f43('0x3'));var db=require(_0x0f43('0x4'))['db'];var utils=require(_0x0f43('0x5'));var logger=require(_0x0f43('0x6'))(_0x0f43('0x7'));var config=require(_0x0f43('0x8'));var jayson=require(_0x0f43('0x9'));var client=jayson[_0x0f43('0xa')][_0x0f43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9a0a,_0x48fd76,_0x260758){return new BPromise(function(_0x49ed4a,_0x1023be){return client[_0x0f43('0xc')](_0x3f9a0a,_0x260758)[_0x0f43('0xd')](function(_0x490f4b){logger['info'](_0x0f43('0xe'),_0x48fd76,_0x0f43('0xf'));logger[_0x0f43('0x10')](_0x0f43('0x11'),_0x48fd76,_0x0f43('0xf'),JSON[_0x0f43('0x12')](_0x490f4b));if(_0x490f4b[_0x0f43('0x13')]){if(_0x490f4b[_0x0f43('0x13')][_0x0f43('0x14')]===0x1f4){logger[_0x0f43('0x13')](_0x0f43('0xe'),_0x48fd76,_0x490f4b[_0x0f43('0x13')][_0x0f43('0x15')]);return _0x1023be(_0x490f4b[_0x0f43('0x13')][_0x0f43('0x15')]);}logger['error'](_0x0f43('0xe'),_0x48fd76,_0x490f4b[_0x0f43('0x13')][_0x0f43('0x15')]);return _0x49ed4a(_0x490f4b[_0x0f43('0x13')][_0x0f43('0x15')]);}else{logger[_0x0f43('0x16')](_0x0f43('0xe'),_0x48fd76,'request\x20sent');_0x49ed4a(_0x490f4b['result']['message']);}})[_0x0f43('0x17')](function(_0x49e440){logger[_0x0f43('0x13')](_0x0f43('0xe'),_0x48fd76,_0x49e440);_0x1023be(_0x49e440);});});} \ No newline at end of file +var _0x1898=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x56a116,_0x2856de){var _0x44bc7c=function(_0x479b92){while(--_0x479b92){_0x56a116['push'](_0x56a116['shift']());}};_0x44bc7c(++_0x2856de);}(_0x1898,0xdb));var _0x8189=function(_0x235b23,_0x1e55f2){_0x235b23=_0x235b23-0x0;var _0x166ac5=_0x1898[_0x235b23];return _0x166ac5;};'use strict';var _=require(_0x8189('0x0'));var util=require(_0x8189('0x1'));var moment=require(_0x8189('0x2'));var BPromise=require(_0x8189('0x3'));var rs=require(_0x8189('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8189('0x5'))['db'];var utils=require(_0x8189('0x6'));var logger=require(_0x8189('0x7'))(_0x8189('0x8'));var config=require(_0x8189('0x9'));var jayson=require(_0x8189('0xa'));var client=jayson[_0x8189('0xb')][_0x8189('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x488a96,_0x13ef13,_0x16400b){return new BPromise(function(_0x400089,_0x3a880f){return client[_0x8189('0xd')](_0x488a96,_0x16400b)[_0x8189('0xe')](function(_0x24e517){logger[_0x8189('0xf')]('Cdr,\x20%s,\x20%s',_0x13ef13,_0x8189('0x10'));logger[_0x8189('0x11')](_0x8189('0x12'),_0x13ef13,_0x8189('0x10'),JSON['stringify'](_0x24e517));if(_0x24e517[_0x8189('0x13')]){if(_0x24e517['error'][_0x8189('0x14')]===0x1f4){logger[_0x8189('0x13')](_0x8189('0x15'),_0x13ef13,_0x24e517[_0x8189('0x13')]['message']);return _0x3a880f(_0x24e517[_0x8189('0x13')][_0x8189('0x16')]);}logger[_0x8189('0x13')](_0x8189('0x15'),_0x13ef13,_0x24e517[_0x8189('0x13')]['message']);return _0x400089(_0x24e517[_0x8189('0x13')][_0x8189('0x16')]);}else{logger[_0x8189('0xf')](_0x8189('0x15'),_0x13ef13,_0x8189('0x10'));_0x400089(_0x24e517[_0x8189('0x17')][_0x8189('0x16')]);}})[_0x8189('0x18')](function(_0x2ae2a6){logger[_0x8189('0x13')](_0x8189('0x15'),_0x13ef13,_0x2ae2a6);_0x3a880f(_0x2ae2a6);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ee7fea3..7abc300 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 _0xde89=['show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id'];(function(_0x1367ff,_0x25e6fe){var _0xc253e0=function(_0x1a2859){while(--_0x1a2859){_0x1367ff['push'](_0x1367ff['shift']());}};_0xc253e0(++_0x25e6fe);}(_0xde89,0x1ec));var _0x9de8=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0xde89[_0x237546];return _0x233e29;};'use strict';var multer=require(_0x9de8('0x0'));var util=require(_0x9de8('0x1'));var path=require(_0x9de8('0x2'));var timeout=require(_0x9de8('0x3'));var express=require(_0x9de8('0x4'));var router=express['Router']();var auth=require(_0x9de8('0x5'));var interaction=require(_0x9de8('0x6'));var config=require('../../config/environment');var controller=require('./cdr.controller');router['get']('/',auth[_0x9de8('0x7')](),controller['index']);router[_0x9de8('0x8')](_0x9de8('0x9'),auth[_0x9de8('0x7')](),controller[_0x9de8('0xa')]);router[_0x9de8('0x8')](_0x9de8('0xb'),auth[_0x9de8('0x7')](),controller[_0x9de8('0xc')]);router[_0x9de8('0xd')]('/',auth[_0x9de8('0x7')](),controller[_0x9de8('0xe')]);router['put'](_0x9de8('0xb'),auth[_0x9de8('0x7')](),controller[_0x9de8('0xf')]);router[_0x9de8('0x10')]('/:id',auth[_0x9de8('0x7')](),controller['destroy']);module[_0x9de8('0x11')]=router; \ No newline at end of file +var _0x5393=['isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cdr.controller','get','index','/describe'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5393,0x199));var _0x3539=function(_0x7f974f,_0x1ad3c0){_0x7f974f=_0x7f974f-0x0;var _0x54f616=_0x5393[_0x7f974f];return _0x54f616;};'use strict';var multer=require(_0x3539('0x0'));var util=require(_0x3539('0x1'));var path=require(_0x3539('0x2'));var timeout=require(_0x3539('0x3'));var express=require(_0x3539('0x4'));var router=express[_0x3539('0x5')]();var auth=require(_0x3539('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3539('0x7'));router[_0x3539('0x8')]('/',auth['isAuthenticated'](),controller[_0x3539('0x9')]);router[_0x3539('0x8')](_0x3539('0xa'),auth[_0x3539('0xb')](),controller[_0x3539('0xc')]);router[_0x3539('0x8')](_0x3539('0xd'),auth['isAuthenticated'](),controller[_0x3539('0xe')]);router[_0x3539('0xf')]('/',auth[_0x3539('0xb')](),controller[_0x3539('0x10')]);router[_0x3539('0x11')]('/:id',auth[_0x3539('0xb')](),controller['update']);router[_0x3539('0x12')]('/:id',auth[_0x3539('0xb')](),controller[_0x3539('0x13')]);module[_0x3539('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 43eb232..c745f0e 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 _0xfe3f=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0x570683,_0x1a5200){var _0x1fc920=function(_0x70de15){while(--_0x70de15){_0x570683['push'](_0x570683['shift']());}};_0x1fc920(++_0x1a5200);}(_0xfe3f,0x1ec));var _0xffe3=function(_0x31b111,_0x14ee59){_0x31b111=_0x31b111-0x0;var _0x6deed4=_0xfe3f[_0x31b111];return _0x6deed4;};'use strict';var Sequelize=require('sequelize');module[_0xffe3('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xffe3('0x1')],'allowNull':![],'defaultValue':_0xffe3('0x2')},'appdata':{'type':Sequelize[_0xffe3('0x3')]()},'description':{'type':Sequelize[_0xffe3('0x1')]},'interval':{'type':Sequelize[_0xffe3('0x1')],'defaultValue':_0xffe3('0x4')}}; \ No newline at end of file +var _0xb606=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x51467d,_0x43b2e5){var _0x10f958=function(_0x540278){while(--_0x540278){_0x51467d['push'](_0x51467d['shift']());}};_0x10f958(++_0x43b2e5);}(_0xb606,0x98));var _0x6b60=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0xb606[_0x13f980];return _0x27153c;};'use strict';var Sequelize=require(_0x6b60('0x0'));module[_0x6b60('0x1')]={'priority':{'type':Sequelize[_0x6b60('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6b60('0x3')],'allowNull':![],'defaultValue':_0x6b60('0x4')},'appdata':{'type':Sequelize[_0x6b60('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6b60('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 239b318..d9fa384 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 _0xb708=['count','offset','limit','set','Content-Range','apply','reject','save','then','name','send','show','params','model','keys','query','intersection','attributes','includeAll','include','merge','find','catch','update','body','destroy','ChatApplication','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json'];(function(_0x4a6605,_0x1e0224){var _0x3c3073=function(_0x3b6d9e){while(--_0x3b6d9e){_0x4a6605['push'](_0x4a6605['shift']());}};_0x3c3073(++_0x1e0224);}(_0xb708,0x138));var _0x8b70=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xb708[_0x454165];return _0x56db53;};'use strict';var pdf=require(_0x8b70('0x0'));var emlformat=require(_0x8b70('0x1'));var rimraf=require(_0x8b70('0x2'));var zipdir=require(_0x8b70('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b70('0x4'));var moment=require('moment');var BPromise=require(_0x8b70('0x5'));var Mustache=require(_0x8b70('0x6'));var util=require('util');var path=require(_0x8b70('0x7'));var sox=require(_0x8b70('0x8'));var csv=require(_0x8b70('0x9'));var ejs=require(_0x8b70('0xa'));var fs=require('fs');var _=require(_0x8b70('0xb'));var squel=require('squel');var crypto=require(_0x8b70('0xc'));var jsforce=require(_0x8b70('0xd'));var deskjs=require(_0x8b70('0xe'));var toCsv=require(_0x8b70('0x9'));var querystring=require(_0x8b70('0xf'));var Papa=require(_0x8b70('0x10'));var Redis=require('ioredis');var authService=require(_0x8b70('0x11'));var qs=require(_0x8b70('0x12'));var as=require(_0x8b70('0x13'));var hardwareService=require(_0x8b70('0x14'));var logger=require(_0x8b70('0x15'))(_0x8b70('0x16'));var utils=require(_0x8b70('0x17'));var config=require(_0x8b70('0x18'));var db=require(_0x8b70('0x19'))['db'];function respondWithStatusCode(_0x5c5875,_0x46e69e){_0x46e69e=_0x46e69e||0xcc;return function(_0x2e8f75){if(_0x2e8f75){return _0x5c5875[_0x8b70('0x1a')](_0x46e69e);}return _0x5c5875['status'](_0x46e69e)[_0x8b70('0x1b')]();};}function respondWithResult(_0x3bd574,_0x36d1fe){_0x36d1fe=_0x36d1fe||0xc8;return function(_0x196c94){if(_0x196c94){return _0x3bd574[_0x8b70('0x1c')](_0x36d1fe)[_0x8b70('0x1d')](_0x196c94);}};}function respondWithFilteredResult(_0x15ce14,_0x50e2fb){return function(_0x292493){if(_0x292493){var _0x5eb397=_0x292493[_0x8b70('0x1e')],_0x339194=_0x50e2fb[_0x8b70('0x1f')],_0xe386b=_0x50e2fb['offset']+_0x50e2fb[_0x8b70('0x20')],_0x2b97a7;if(_0xe386b>=_0x5eb397){_0xe386b=_0x5eb397;_0x2b97a7=0xc8;}else{_0x2b97a7=0xce;}_0x15ce14[_0x8b70('0x1c')](_0x2b97a7);return _0x15ce14[_0x8b70('0x21')](_0x8b70('0x22'),_0x339194+'-'+_0xe386b+'/'+_0x5eb397)['json'](_0x292493);}return null;};}function patchUpdates(_0x2d2348){return function(_0x391185){try{jsonpatch[_0x8b70('0x23')](_0x391185,_0x2d2348,!![]);}catch(_0x5a8eda){return BPromise[_0x8b70('0x24')](_0x5a8eda);}return _0x391185[_0x8b70('0x25')]();};}function saveUpdates(_0x5701b4,_0x3bf942){return function(_0x2e76cd){if(_0x2e76cd){return _0x2e76cd['update'](_0x5701b4)[_0x8b70('0x26')](function(_0x45bb5e){return _0x45bb5e;});}return null;};}function removeEntity(_0x27d8ad,_0x1cad97){return function(_0x43de8a){if(_0x43de8a){return _0x43de8a['destroy']()[_0x8b70('0x26')](function(){_0x27d8ad[_0x8b70('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47745e,_0x24abbd){return function(_0x27daa6){if(!_0x27daa6){_0x47745e[_0x8b70('0x1a')](0x194);}return _0x27daa6;};}function handleError(_0x4d5e44,_0xb0cb57){_0xb0cb57=_0xb0cb57||0x1f4;return function(_0x14b71c){logger['error'](_0x14b71c['stack']);if(_0x14b71c[_0x8b70('0x27')]){delete _0x14b71c['name'];}_0x4d5e44[_0x8b70('0x1c')](_0xb0cb57)[_0x8b70('0x28')](_0x14b71c);};}exports[_0x8b70('0x29')]=function(_0x1fd0b5,_0x2845e4){var _0x48ea6a={'raw':!![],'where':{'id':_0x1fd0b5[_0x8b70('0x2a')]['id']}},_0x49ce2a={};_0x49ce2a[_0x8b70('0x2b')]=_[_0x8b70('0x2c')](db['ChatApplication']['rawAttributes']);_0x49ce2a[_0x8b70('0x2d')]=_[_0x8b70('0x2c')](_0x1fd0b5[_0x8b70('0x2d')]);_0x49ce2a['filters']=_['intersection'](_0x49ce2a[_0x8b70('0x2b')],_0x49ce2a[_0x8b70('0x2d')]);_0x48ea6a['attributes']=_[_0x8b70('0x2e')](_0x49ce2a[_0x8b70('0x2b')],qs['fields'](_0x1fd0b5[_0x8b70('0x2d')]['fields']));_0x48ea6a[_0x8b70('0x2f')]=_0x48ea6a[_0x8b70('0x2f')]['length']?_0x48ea6a[_0x8b70('0x2f')]:_0x49ce2a[_0x8b70('0x2b')];if(_0x1fd0b5[_0x8b70('0x2d')][_0x8b70('0x30')]){_0x48ea6a[_0x8b70('0x31')]=[{'all':!![]}];}_0x48ea6a=_[_0x8b70('0x32')]({},_0x48ea6a,_0x1fd0b5['options']);return db['ChatApplication'][_0x8b70('0x33')](_0x48ea6a)[_0x8b70('0x26')](handleEntityNotFound(_0x2845e4,null))[_0x8b70('0x26')](respondWithResult(_0x2845e4,null))[_0x8b70('0x34')](handleError(_0x2845e4,null));};exports[_0x8b70('0x35')]=function(_0x14a81a,_0x329085){if(_0x14a81a[_0x8b70('0x36')]['id']){delete _0x14a81a['body']['id'];}return db['ChatApplication'][_0x8b70('0x33')]({'where':{'id':_0x14a81a[_0x8b70('0x2a')]['id']}})[_0x8b70('0x26')](handleEntityNotFound(_0x329085,null))[_0x8b70('0x26')](saveUpdates(_0x14a81a[_0x8b70('0x36')],null))['then'](respondWithResult(_0x329085,null))[_0x8b70('0x34')](handleError(_0x329085,null));};exports[_0x8b70('0x37')]=function(_0x203347,_0x34b7d4){return db[_0x8b70('0x38')][_0x8b70('0x33')]({'where':{'id':_0x203347[_0x8b70('0x2a')]['id']}})[_0x8b70('0x26')](handleEntityNotFound(_0x34b7d4,null))[_0x8b70('0x26')](removeEntity(_0x34b7d4,null))['catch'](handleError(_0x34b7d4,null));}; \ No newline at end of file +var _0x865f=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','fields','attributes','length','merge','find','catch','eml-format','request-promise','moment','bluebird','mustache','path','sox','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','json','count'];(function(_0x2084b1,_0x29f453){var _0x39ce66=function(_0x36077b){while(--_0x36077b){_0x2084b1['push'](_0x2084b1['shift']());}};_0x39ce66(++_0x29f453);}(_0x865f,0x150));var _0xf865=function(_0x2cb5db,_0xeb8109){_0x2cb5db=_0x2cb5db-0x0;var _0x1ad7fa=_0x865f[_0x2cb5db];return _0x1ad7fa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf865('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf865('0x1'));var moment=require(_0xf865('0x2'));var BPromise=require(_0xf865('0x3'));var Mustache=require(_0xf865('0x4'));var util=require('util');var path=require(_0xf865('0x5'));var sox=require(_0xf865('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf865('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf865('0x8'));var deskjs=require(_0xf865('0x9'));var toCsv=require(_0xf865('0xa'));var querystring=require('querystring');var Papa=require(_0xf865('0xb'));var Redis=require(_0xf865('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xf865('0xd'));var as=require(_0xf865('0xe'));var hardwareService=require(_0xf865('0xf'));var logger=require('../../config/logger')(_0xf865('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf865('0x11'))['db'];function respondWithStatusCode(_0xc4670c,_0x37ada7){_0x37ada7=_0x37ada7||0xcc;return function(_0x265661){if(_0x265661){return _0xc4670c['sendStatus'](_0x37ada7);}return _0xc4670c[_0xf865('0x12')](_0x37ada7)['end']();};}function respondWithResult(_0x5d57ac,_0x1e92b5){_0x1e92b5=_0x1e92b5||0xc8;return function(_0x3c3467){if(_0x3c3467){return _0x5d57ac[_0xf865('0x12')](_0x1e92b5)[_0xf865('0x13')](_0x3c3467);}};}function respondWithFilteredResult(_0x3fac7f,_0x2e1f33){return function(_0x31b814){if(_0x31b814){var _0xb1489b=_0x31b814[_0xf865('0x14')],_0x58d817=_0x2e1f33['offset'],_0x96823c=_0x2e1f33[_0xf865('0x15')]+_0x2e1f33[_0xf865('0x16')],_0x56dccb;if(_0x96823c>=_0xb1489b){_0x96823c=_0xb1489b;_0x56dccb=0xc8;}else{_0x56dccb=0xce;}_0x3fac7f[_0xf865('0x12')](_0x56dccb);return _0x3fac7f[_0xf865('0x17')](_0xf865('0x18'),_0x58d817+'-'+_0x96823c+'/'+_0xb1489b)[_0xf865('0x13')](_0x31b814);}return null;};}function patchUpdates(_0x147ec5){return function(_0x1e0e3a){try{jsonpatch[_0xf865('0x19')](_0x1e0e3a,_0x147ec5,!![]);}catch(_0x18b875){return BPromise[_0xf865('0x1a')](_0x18b875);}return _0x1e0e3a[_0xf865('0x1b')]();};}function saveUpdates(_0x23a46a,_0xbc4f97){return function(_0x351a53){if(_0x351a53){return _0x351a53[_0xf865('0x1c')](_0x23a46a)[_0xf865('0x1d')](function(_0x45bb4e){return _0x45bb4e;});}return null;};}function removeEntity(_0x27e0f0,_0x1226e9){return function(_0x3aa4b8){if(_0x3aa4b8){return _0x3aa4b8[_0xf865('0x1e')]()[_0xf865('0x1d')](function(){_0x27e0f0[_0xf865('0x12')](0xcc)[_0xf865('0x1f')]();});}};}function handleEntityNotFound(_0x226419,_0x1f0119){return function(_0x39e734){if(!_0x39e734){_0x226419['sendStatus'](0x194);}return _0x39e734;};}function handleError(_0x4b780e,_0xbc24aa){_0xbc24aa=_0xbc24aa||0x1f4;return function(_0x25505a){logger[_0xf865('0x20')](_0x25505a[_0xf865('0x21')]);if(_0x25505a[_0xf865('0x22')]){delete _0x25505a[_0xf865('0x22')];}_0x4b780e[_0xf865('0x12')](_0xbc24aa)[_0xf865('0x23')](_0x25505a);};}exports[_0xf865('0x24')]=function(_0x5998d8,_0x21a7fd){var _0x248530={'raw':!![],'where':{'id':_0x5998d8[_0xf865('0x25')]['id']}},_0x5a564b={};_0x5a564b['model']=_[_0xf865('0x26')](db[_0xf865('0x27')][_0xf865('0x28')]);_0x5a564b[_0xf865('0x29')]=_['keys'](_0x5998d8[_0xf865('0x29')]);_0x5a564b[_0xf865('0x2a')]=_[_0xf865('0x2b')](_0x5a564b[_0xf865('0x2c')],_0x5a564b[_0xf865('0x29')]);_0x248530['attributes']=_['intersection'](_0x5a564b[_0xf865('0x2c')],qs[_0xf865('0x2d')](_0x5998d8['query'][_0xf865('0x2d')]));_0x248530[_0xf865('0x2e')]=_0x248530['attributes'][_0xf865('0x2f')]?_0x248530[_0xf865('0x2e')]:_0x5a564b['model'];if(_0x5998d8[_0xf865('0x29')]['includeAll']){_0x248530['include']=[{'all':!![]}];}_0x248530=_[_0xf865('0x30')]({},_0x248530,_0x5998d8['options']);return db[_0xf865('0x27')][_0xf865('0x31')](_0x248530)['then'](handleEntityNotFound(_0x21a7fd,null))['then'](respondWithResult(_0x21a7fd,null))[_0xf865('0x32')](handleError(_0x21a7fd,null));};exports[_0xf865('0x1c')]=function(_0x5bfc57,_0x48ed2e){if(_0x5bfc57['body']['id']){delete _0x5bfc57['body']['id'];}return db[_0xf865('0x27')][_0xf865('0x31')]({'where':{'id':_0x5bfc57[_0xf865('0x25')]['id']}})[_0xf865('0x1d')](handleEntityNotFound(_0x48ed2e,null))['then'](saveUpdates(_0x5bfc57['body'],null))[_0xf865('0x1d')](respondWithResult(_0x48ed2e,null))[_0xf865('0x32')](handleError(_0x48ed2e,null));};exports['destroy']=function(_0x3a71b4,_0xbec2ad){return db['ChatApplication'][_0xf865('0x31')]({'where':{'id':_0x3a71b4['params']['id']}})[_0xf865('0x1d')](handleEntityNotFound(_0xbec2ad,null))[_0xf865('0x1d')](removeEntity(_0xbec2ad,null))[_0xf865('0x32')](handleError(_0xbec2ad,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index cb0b156..2f67470 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 _0x202d=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x202d,0xe2));var _0xd202=function(_0x2d7db6,_0x1cafa5){_0x2d7db6=_0x2d7db6-0x0;var _0x2ce3aa=_0x202d[_0x2d7db6];return _0x2ce3aa;};'use strict';var _=require(_0xd202('0x0'));var util=require(_0xd202('0x1'));var logger=require(_0xd202('0x2'))(_0xd202('0x3'));var moment=require(_0xd202('0x4'));var BPromise=require('bluebird');var rp=require(_0xd202('0x5'));var fs=require('fs');var path=require(_0xd202('0x6'));var rimraf=require('rimraf');var config=require(_0xd202('0x7'));var attributes=require(_0xd202('0x8'));module[_0xd202('0x9')]=function(_0x5101e0,_0x5ed504){return _0x5101e0[_0xd202('0xa')](_0xd202('0xb'),attributes,{'tableName':_0xd202('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd202('0xd'),'collate':_0xd202('0xe')});}; \ No newline at end of file +var _0xd88c=['utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','chat_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd88c,0x1d5));var _0xcd88=function(_0x3d4488,_0x1b2b82){_0x3d4488=_0x3d4488-0x0;var _0x4a0548=_0xd88c[_0x3d4488];return _0x4a0548;};'use strict';var _=require(_0xcd88('0x0'));var util=require(_0xcd88('0x1'));var logger=require(_0xcd88('0x2'))(_0xcd88('0x3'));var moment=require(_0xcd88('0x4'));var BPromise=require('bluebird');var rp=require(_0xcd88('0x5'));var fs=require('fs');var path=require(_0xcd88('0x6'));var rimraf=require(_0xcd88('0x7'));var config=require(_0xcd88('0x8'));var attributes=require('./chatApplication.attributes');module[_0xcd88('0x9')]=function(_0x18ffef,_0x5eba38){return _0x18ffef[_0xcd88('0xa')]('ChatApplication',attributes,{'tableName':_0xcd88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcd88('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 81076d6..37ff329 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 _0x9750=['client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x19536f,_0x5abaad){var _0x2ad248=function(_0x4ca131){while(--_0x4ca131){_0x19536f['push'](_0x19536f['shift']());}};_0x2ad248(++_0x5abaad);}(_0x9750,0xf2));var _0x0975=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x9750[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0975('0x0'));var util=require(_0x0975('0x1'));var moment=require(_0x0975('0x2'));var BPromise=require(_0x0975('0x3'));var rs=require(_0x0975('0x4'));var fs=require('fs');var Redis=require(_0x0975('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0975('0x6'));var logger=require(_0x0975('0x7'))(_0x0975('0x8'));var config=require('../../config/environment');var jayson=require(_0x0975('0x9'));var client=jayson[_0x0975('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x380bd7,_0x4a46c7,_0x4da967){return new BPromise(function(_0x583ddf,_0x56ee85){return client['request'](_0x380bd7,_0x4da967)[_0x0975('0xb')](function(_0x4a0ed2){logger[_0x0975('0xc')](_0x0975('0xd'),_0x4a46c7,_0x0975('0xe'));logger[_0x0975('0xf')](_0x0975('0x10'),_0x4a46c7,_0x0975('0xe'),JSON[_0x0975('0x11')](_0x4a0ed2));if(_0x4a0ed2[_0x0975('0x12')]){if(_0x4a0ed2[_0x0975('0x12')]['code']===0x1f4){logger[_0x0975('0x12')](_0x0975('0xd'),_0x4a46c7,_0x4a0ed2[_0x0975('0x12')][_0x0975('0x13')]);return _0x56ee85(_0x4a0ed2[_0x0975('0x12')][_0x0975('0x13')]);}logger[_0x0975('0x12')](_0x0975('0xd'),_0x4a46c7,_0x4a0ed2[_0x0975('0x12')][_0x0975('0x13')]);return _0x583ddf(_0x4a0ed2[_0x0975('0x12')][_0x0975('0x13')]);}else{logger['info'](_0x0975('0xd'),_0x4a46c7,_0x0975('0xe'));_0x583ddf(_0x4a0ed2[_0x0975('0x14')][_0x0975('0x13')]);}})['catch'](function(_0x479738){logger[_0x0975('0x12')]('ChatApplication,\x20%s,\x20%s',_0x4a46c7,_0x479738);_0x56ee85(_0x479738);});});} \ No newline at end of file +var _0xe952=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment'];(function(_0x181c25,_0x4ae4cc){var _0x3d229a=function(_0x4a16d6){while(--_0x4a16d6){_0x181c25['push'](_0x181c25['shift']());}};_0x3d229a(++_0x4ae4cc);}(_0xe952,0xfa));var _0x2e95=function(_0x2ec35b,_0x3ad085){_0x2ec35b=_0x2ec35b-0x0;var _0xe92fc0=_0xe952[_0x2ec35b];return _0xe92fc0;};'use strict';var _=require('lodash');var util=require(_0x2e95('0x0'));var moment=require(_0x2e95('0x1'));var BPromise=require(_0x2e95('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e95('0x3'))['db'];var utils=require(_0x2e95('0x4'));var logger=require(_0x2e95('0x5'))(_0x2e95('0x6'));var config=require(_0x2e95('0x7'));var jayson=require(_0x2e95('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce659,_0x214a10,_0x55ccfa){return new BPromise(function(_0x3c857b,_0x118160){return client[_0x2e95('0x9')](_0x1ce659,_0x55ccfa)['then'](function(_0x2dde12){logger[_0x2e95('0xa')](_0x2e95('0xb'),_0x214a10,_0x2e95('0xc'));logger[_0x2e95('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x214a10,_0x2e95('0xc'),JSON[_0x2e95('0xe')](_0x2dde12));if(_0x2dde12[_0x2e95('0xf')]){if(_0x2dde12[_0x2e95('0xf')]['code']===0x1f4){logger[_0x2e95('0xf')](_0x2e95('0xb'),_0x214a10,_0x2dde12['error'][_0x2e95('0x10')]);return _0x118160(_0x2dde12['error']['message']);}logger[_0x2e95('0xf')]('ChatApplication,\x20%s,\x20%s',_0x214a10,_0x2dde12[_0x2e95('0xf')]['message']);return _0x3c857b(_0x2dde12['error'][_0x2e95('0x10')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x214a10,_0x2e95('0xc'));_0x3c857b(_0x2dde12['result']['message']);}})[_0x2e95('0x11')](function(_0xafd1b1){logger[_0x2e95('0xf')](_0x2e95('0xb'),_0x214a10,_0xafd1b1);_0x118160(_0xafd1b1);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 2a3a495..287c543 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 _0x38c1=['update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','put','/:id'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x38c1,0xed));var _0x138c=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0x38c1[_0x2eac4f];return _0x58f73b;};'use strict';var multer=require(_0x138c('0x0'));var util=require(_0x138c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x138c('0x2'));var router=express[_0x138c('0x3')]();var auth=require(_0x138c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x138c('0x5'));var controller=require('./chatApplication.controller');router[_0x138c('0x6')]('/:id',auth[_0x138c('0x7')](),controller['show']);router[_0x138c('0x8')](_0x138c('0x9'),auth[_0x138c('0x7')](),controller[_0x138c('0xa')]);router['delete']('/:id',auth[_0x138c('0x7')](),controller[_0x138c('0xb')]);module[_0x138c('0xc')]=router; \ No newline at end of file +var _0xaa6c=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated','update','destroy'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xaa6c,0x12d));var _0xcaa6=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xaa6c[_0x44bcb0];return _0xfaf881;};'use strict';var multer=require(_0xcaa6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcaa6('0x1'));var express=require(_0xcaa6('0x2'));var router=express[_0xcaa6('0x3')]();var auth=require(_0xcaa6('0x4'));var interaction=require(_0xcaa6('0x5'));var config=require(_0xcaa6('0x6'));var controller=require('./chatApplication.controller');router[_0xcaa6('0x7')](_0xcaa6('0x8'),auth['isAuthenticated'](),controller[_0xcaa6('0x9')]);router[_0xcaa6('0xa')](_0xcaa6('0x8'),auth[_0xcaa6('0xb')](),controller[_0xcaa6('0xc')]);router['delete'](_0xcaa6('0x8'),auth['isAuthenticated'](),controller[_0xcaa6('0xd')]);module[_0xcaa6('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 658c6bd..43b4a9d 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 _0xd5c5=['sequelize','STRING','BOOLEAN'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xd5c5,0x156));var _0x5d5c=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xd5c5[_0x3207aa];return _0x51758f;};'use strict';var Sequelize=require(_0x5d5c('0x0'));module['exports']={'name':{'type':Sequelize[_0x5d5c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5d5c('0x1')]},'write':{'type':Sequelize[_0x5d5c('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe351=['BOOLEAN','sequelize','STRING'];(function(_0x57dc39,_0x39ebc7){var _0x2cfaf2=function(_0x1dbf9e){while(--_0x1dbf9e){_0x57dc39['push'](_0x57dc39['shift']());}};_0x2cfaf2(++_0x39ebc7);}(_0xe351,0x11e));var _0x1e35=function(_0x5cecd6,_0x2e85be){_0x5cecd6=_0x5cecd6-0x0;var _0x5364a0=_0xe351[_0x5cecd6];return _0x5364a0;};'use strict';var Sequelize=require(_0x1e35('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e35('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x1e35('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4dff530..4487330 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 _0xea2b=['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','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','set','apply','reject','save','update','stack','name','send','index','map','ChatGroup','rawAttributes','type','query','filters','model','attributes','intersection','fields','hasOwnProperty','limit','offset','order','sort','pick','filter','where','merge','options','includeAll','include','rows','show','params','keys','length','create','body','find','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','User','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','nolimit','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xea2b,0x198));var _0xbea2=function(_0x1b0d2c,_0x17fb0a){_0x1b0d2c=_0x1b0d2c-0x0;var _0x1a49fb=_0xea2b[_0x1b0d2c];return _0x1a49fb;};'use strict';var pdf=require(_0xbea2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbea2('0x1'));var jsonpatch=require(_0xbea2('0x2'));var rp=require(_0xbea2('0x3'));var moment=require(_0xbea2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbea2('0x5'));var util=require('util');var path=require(_0xbea2('0x6'));var sox=require('sox');var csv=require(_0xbea2('0x7'));var ejs=require(_0xbea2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbea2('0x9'));var toCsv=require('to-csv');var querystring=require(_0xbea2('0xa'));var Papa=require(_0xbea2('0xb'));var Redis=require(_0xbea2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbea2('0xd'));var as=require(_0xbea2('0xe'));var hardwareService=require(_0xbea2('0xf'));var logger=require(_0xbea2('0x10'))('api');var utils=require(_0xbea2('0x11'));var config=require(_0xbea2('0x12'));var db=require(_0xbea2('0x13'))['db'];config['redis']=_[_0xbea2('0x14')](config[_0xbea2('0x15')],{'host':_0xbea2('0x16'),'port':0x18eb});var socket=require(_0xbea2('0x17'))(new Redis(config[_0xbea2('0x15')]));require(_0xbea2('0x18'))[_0xbea2('0x19')](socket);var jayson=require(_0xbea2('0x1a'));var client=jayson[_0xbea2('0x1b')][_0xbea2('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x534148,_0x158971,_0x37797b){if(_0x37797b){var _0x320240=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x320240[_0xbea2('0x1d')](_0x158971)){return _0x534148;}else{throw new db['Sequelize'][(_0xbea2('0x1e'))](_0xbea2('0x1f'));}}else{return _0x534148;}}function respondWithRpcPromise(_0x22f219,_0x34911f,_0x3341ed,_0x3f0d54){return new BPromise(function(_0xeebe75,_0x3b2bed){var _0x5d102a=_0x3f0d54||client;return _0x5d102a[_0xbea2('0x20')](_0x22f219,_0x3341ed)[_0xbea2('0x21')](function(_0x2b8edf){logger[_0xbea2('0x22')](_0xbea2('0x23'),_0x34911f,'request\x20sent');logger[_0xbea2('0x24')](_0xbea2('0x25'),_0x34911f,_0xbea2('0x26'),JSON[_0xbea2('0x27')](_0x2b8edf));if(_0x2b8edf[_0xbea2('0x28')]){if(_0x2b8edf[_0xbea2('0x28')][_0xbea2('0x29')]===0x1f4){logger[_0xbea2('0x28')](_0xbea2('0x23'),_0x34911f,_0x2b8edf[_0xbea2('0x28')][_0xbea2('0x2a')]);return _0x3b2bed(_0x2b8edf[_0xbea2('0x28')][_0xbea2('0x2a')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x34911f,_0x2b8edf[_0xbea2('0x28')][_0xbea2('0x2a')]);return _0xeebe75(_0x2b8edf['error'][_0xbea2('0x2a')]);}else{logger[_0xbea2('0x22')](_0xbea2('0x23'),_0x34911f,_0xbea2('0x26'));_0xeebe75(_0x2b8edf[_0xbea2('0x2b')]['message']);}})[_0xbea2('0x2c')](function(_0x55c440){logger[_0xbea2('0x28')]('ChatGroup,\x20%s,\x20%s',_0x34911f,_0x55c440);_0x3b2bed(_0x55c440);});});}function respondWithStatusCode(_0x4160fb,_0x9f060c){_0x9f060c=_0x9f060c||0xcc;return function(_0x358bb3){if(_0x358bb3){return _0x4160fb[_0xbea2('0x2d')](_0x9f060c);}return _0x4160fb[_0xbea2('0x2e')](_0x9f060c)[_0xbea2('0x2f')]();};}function respondWithResult(_0x4d05f4,_0x5734cb){_0x5734cb=_0x5734cb||0xc8;return function(_0x496563){if(_0x496563){return _0x4d05f4[_0xbea2('0x2e')](_0x5734cb)[_0xbea2('0x30')](_0x496563);}};}function respondWithFilteredResult(_0x2d2bf1,_0x4fd8b9){return function(_0x994a8f){if(_0x994a8f){var _0x56581d=_0x994a8f[_0xbea2('0x31')],_0x1f1199=_0x4fd8b9['offset'],_0x5662c2=_0x4fd8b9['offset']+_0x4fd8b9['limit'],_0x5786c6;if(_0x5662c2>=_0x56581d){_0x5662c2=_0x56581d;_0x5786c6=0xc8;}else{_0x5786c6=0xce;}_0x2d2bf1[_0xbea2('0x2e')](_0x5786c6);return _0x2d2bf1[_0xbea2('0x32')]('Content-Range',_0x1f1199+'-'+_0x5662c2+'/'+_0x56581d)[_0xbea2('0x30')](_0x994a8f);}return null;};}function patchUpdates(_0xd3cc29){return function(_0x1e48cc){try{jsonpatch[_0xbea2('0x33')](_0x1e48cc,_0xd3cc29,!![]);}catch(_0x16f991){return BPromise[_0xbea2('0x34')](_0x16f991);}return _0x1e48cc[_0xbea2('0x35')]();};}function saveUpdates(_0x174a36,_0x366686){return function(_0x56020d){if(_0x56020d){return _0x56020d[_0xbea2('0x36')](_0x174a36)[_0xbea2('0x21')](function(_0x1daf9a){return _0x1daf9a;});}return null;};}function removeEntity(_0x40b185,_0x57011d){return function(_0x17893a){if(_0x17893a){return _0x17893a['destroy']()[_0xbea2('0x21')](function(){_0x40b185[_0xbea2('0x2e')](0xcc)[_0xbea2('0x2f')]();});}};}function handleEntityNotFound(_0x4e8088,_0x1fb800){return function(_0x12a13c){if(!_0x12a13c){_0x4e8088['sendStatus'](0x194);}return _0x12a13c;};}function handleError(_0x4ff7da,_0x4b7067){_0x4b7067=_0x4b7067||0x1f4;return function(_0x503c83){logger['error'](_0x503c83[_0xbea2('0x37')]);if(_0x503c83['name']){delete _0x503c83[_0xbea2('0x38')];}_0x4ff7da[_0xbea2('0x2e')](_0x4b7067)[_0xbea2('0x39')](_0x503c83);};}exports[_0xbea2('0x3a')]=function(_0x16db73,_0x517290){var _0x2476e2={},_0x5e3e55={},_0x18b973={'count':0x0,'rows':[]};var _0x29b206=_[_0xbea2('0x3b')](db[_0xbea2('0x3c')][_0xbea2('0x3d')],function(_0x1e53dc){return{'name':_0x1e53dc['fieldName'],'type':_0x1e53dc[_0xbea2('0x3e')]['key']};});_0x5e3e55['model']=_['map'](_0x29b206,'name');_0x5e3e55[_0xbea2('0x3f')]=_['keys'](_0x16db73[_0xbea2('0x3f')]);_0x5e3e55[_0xbea2('0x40')]=_['intersection'](_0x5e3e55[_0xbea2('0x41')],_0x5e3e55[_0xbea2('0x3f')]);_0x2476e2[_0xbea2('0x42')]=_[_0xbea2('0x43')](_0x5e3e55[_0xbea2('0x41')],qs[_0xbea2('0x44')](_0x16db73[_0xbea2('0x3f')][_0xbea2('0x44')]));_0x2476e2[_0xbea2('0x42')]=_0x2476e2['attributes']['length']?_0x2476e2['attributes']:_0x5e3e55[_0xbea2('0x41')];if(!_0x16db73['query'][_0xbea2('0x45')]('nolimit')){_0x2476e2[_0xbea2('0x46')]=qs[_0xbea2('0x46')](_0x16db73[_0xbea2('0x3f')][_0xbea2('0x46')]);_0x2476e2[_0xbea2('0x47')]=qs[_0xbea2('0x47')](_0x16db73[_0xbea2('0x3f')][_0xbea2('0x47')]);}_0x2476e2[_0xbea2('0x48')]=qs[_0xbea2('0x49')](_0x16db73[_0xbea2('0x3f')][_0xbea2('0x49')]);_0x2476e2['where']=qs['filters'](_[_0xbea2('0x4a')](_0x16db73[_0xbea2('0x3f')],_0x5e3e55['filters']),_0x29b206);if(_0x16db73[_0xbea2('0x3f')][_0xbea2('0x4b')]){_0x2476e2[_0xbea2('0x4c')]=_[_0xbea2('0x4d')](_0x2476e2['where'],{'$or':_[_0xbea2('0x3b')](_0x29b206,function(_0x554bab){if(_0x554bab[_0xbea2('0x3e')]!=='VIRTUAL'){var _0x13335a={};_0x13335a[_0x554bab[_0xbea2('0x38')]]={'$like':'%'+_0x16db73[_0xbea2('0x3f')][_0xbea2('0x4b')]+'%'};return _0x13335a;}})});}_0x2476e2=_[_0xbea2('0x4d')]({},_0x2476e2,_0x16db73[_0xbea2('0x4e')]);var _0x557309={'where':_0x2476e2[_0xbea2('0x4c')]};return db[_0xbea2('0x3c')][_0xbea2('0x31')](_0x557309)[_0xbea2('0x21')](function(_0x4d0f85){_0x18b973[_0xbea2('0x31')]=_0x4d0f85;if(_0x16db73[_0xbea2('0x3f')][_0xbea2('0x4f')]){_0x2476e2[_0xbea2('0x50')]=[{'all':!![]}];}return db[_0xbea2('0x3c')]['findAll'](_0x2476e2);})[_0xbea2('0x21')](function(_0x520584){_0x18b973[_0xbea2('0x51')]=_0x520584;return _0x18b973;})[_0xbea2('0x21')](respondWithFilteredResult(_0x517290,_0x2476e2))[_0xbea2('0x2c')](handleError(_0x517290,null));};exports[_0xbea2('0x52')]=function(_0x2e0551,_0x59e2e1){var _0x34ec03={'raw':!![],'where':{'id':_0x2e0551[_0xbea2('0x53')]['id']}},_0x3b54ec={};_0x3b54ec[_0xbea2('0x41')]=_[_0xbea2('0x54')](db[_0xbea2('0x3c')][_0xbea2('0x3d')]);_0x3b54ec[_0xbea2('0x3f')]=_[_0xbea2('0x54')](_0x2e0551['query']);_0x3b54ec[_0xbea2('0x40')]=_['intersection'](_0x3b54ec[_0xbea2('0x41')],_0x3b54ec['query']);_0x34ec03[_0xbea2('0x42')]=_['intersection'](_0x3b54ec['model'],qs[_0xbea2('0x44')](_0x2e0551[_0xbea2('0x3f')]['fields']));_0x34ec03[_0xbea2('0x42')]=_0x34ec03[_0xbea2('0x42')][_0xbea2('0x55')]?_0x34ec03[_0xbea2('0x42')]:_0x3b54ec[_0xbea2('0x41')];if(_0x2e0551['query'][_0xbea2('0x4f')]){_0x34ec03['include']=[{'all':!![]}];}_0x34ec03=_[_0xbea2('0x4d')]({},_0x34ec03,_0x2e0551[_0xbea2('0x4e')]);return db[_0xbea2('0x3c')]['find'](_0x34ec03)[_0xbea2('0x21')](handleEntityNotFound(_0x59e2e1,null))[_0xbea2('0x21')](respondWithResult(_0x59e2e1,null))[_0xbea2('0x2c')](handleError(_0x59e2e1,null));};exports[_0xbea2('0x56')]=function(_0x4ecba4,_0x2961c5){return db[_0xbea2('0x3c')]['create'](_0x4ecba4[_0xbea2('0x57')],{})['then'](respondWithResult(_0x2961c5,0xc9))['catch'](handleError(_0x2961c5,null));};exports['update']=function(_0x51e397,_0xdce6dc){if(_0x51e397[_0xbea2('0x57')]['id']){delete _0x51e397[_0xbea2('0x57')]['id'];}return db[_0xbea2('0x3c')][_0xbea2('0x58')]({'where':{'id':_0x51e397[_0xbea2('0x53')]['id']}})[_0xbea2('0x21')](handleEntityNotFound(_0xdce6dc,null))[_0xbea2('0x21')](saveUpdates(_0x51e397[_0xbea2('0x57')],null))[_0xbea2('0x21')](respondWithResult(_0xdce6dc,null))[_0xbea2('0x2c')](handleError(_0xdce6dc,null));};exports[_0xbea2('0x59')]=function(_0x373a7b,_0x353067){return db[_0xbea2('0x3c')][_0xbea2('0x58')]({'where':{'id':_0x373a7b[_0xbea2('0x53')]['id']}})['then'](handleEntityNotFound(_0x353067,null))[_0xbea2('0x21')](removeEntity(_0x353067,null))[_0xbea2('0x2c')](handleError(_0x353067,null));};exports[_0xbea2('0x5a')]=function(_0x347dea,_0x1b4edb){return db[_0xbea2('0x3c')][_0xbea2('0x5a')]()[_0xbea2('0x21')](respondWithResult(_0x1b4edb,null))[_0xbea2('0x2c')](handleError(_0x1b4edb,null));};exports[_0xbea2('0x5b')]=function(_0x4f6822,_0x355070,_0x3b25f4){return db[_0xbea2('0x5c')][_0xbea2('0x31')]({'where':{'ChatGroupId':_0x4f6822[_0xbea2('0x53')]['id'],'ToId':_0x4f6822[_0xbea2('0x5d')]['id'],'read':![]}})[_0xbea2('0x21')](function(_0x54cf40){return{'id':_[_0xbea2('0x5e')](_0x4f6822[_0xbea2('0x53')]['id']),'count':_0x54cf40};})[_0xbea2('0x21')](respondWithResult(_0x355070,null))[_0xbea2('0x2c')](handleError(_0x355070,null));};exports[_0xbea2('0x5f')]=function(_0x16e524,_0x197399,_0x43f699){return db['ChatGroup']['find']({'where':{'id':_0x16e524['params']['id']}})[_0xbea2('0x21')](handleEntityNotFound(_0x197399,null))[_0xbea2('0x21')](function(_0x16142e){if(_0x16142e){return _0x16142e[_0xbea2('0x5f')](_0x16e524[_0xbea2('0x57')][_0xbea2('0x60')],_[_0xbea2('0x61')](_0x16e524[_0xbea2('0x57')],[_0xbea2('0x60'),'id'])||{});}})[_0xbea2('0x21')](respondWithResult(_0x197399,null))[_0xbea2('0x2c')](handleError(_0x197399,null));};exports[_0xbea2('0x62')]=function(_0x3e2788,_0x4f8b2a,_0x5e15f0){var _0x319e9f={};var _0x3d0575={};var _0x456fd5;var _0x15ed72;return db[_0xbea2('0x3c')]['findOne']({'where':{'id':_0x3e2788[_0xbea2('0x53')]['id']}})['then'](handleEntityNotFound(_0x4f8b2a,null))[_0xbea2('0x21')](function(_0xdbb94b){if(_0xdbb94b){_0x456fd5=_0xdbb94b;_0x3d0575['model']=_['keys'](db[_0xbea2('0x63')][_0xbea2('0x3d')]);_0x3d0575[_0xbea2('0x3f')]=_['keys'](_0x3e2788[_0xbea2('0x3f')]);_0x3d0575[_0xbea2('0x40')]=_[_0xbea2('0x43')](_0x3d0575[_0xbea2('0x41')],_0x3d0575[_0xbea2('0x3f')]);_0x319e9f[_0xbea2('0x42')]=_[_0xbea2('0x43')](_0x3d0575[_0xbea2('0x41')],qs[_0xbea2('0x44')](_0x3e2788[_0xbea2('0x3f')][_0xbea2('0x44')]));_0x319e9f[_0xbea2('0x42')]=_0x319e9f[_0xbea2('0x42')][_0xbea2('0x55')]?_0x319e9f[_0xbea2('0x42')]:_0x3d0575[_0xbea2('0x41')];_0x319e9f[_0xbea2('0x48')]=qs['sort'](_0x3e2788[_0xbea2('0x3f')][_0xbea2('0x49')]);_0x319e9f[_0xbea2('0x4c')]=qs['filters'](_['pick'](_0x3e2788['query'],_0x3d0575[_0xbea2('0x40')]));if(_0x3e2788['query'][_0xbea2('0x4b')]){_0x319e9f['where']=_[_0xbea2('0x4d')](_0x319e9f[_0xbea2('0x4c')],{'$or':_['map'](_0x319e9f[_0xbea2('0x42')],function(_0x58fc94){var _0x1c1dba={};_0x1c1dba[_0x58fc94]={'$like':'%'+_0x3e2788[_0xbea2('0x3f')][_0xbea2('0x4b')]+'%'};return _0x1c1dba;})});}_0x319e9f=_[_0xbea2('0x4d')]({},_0x319e9f,_0x3e2788[_0xbea2('0x4e')]);return _0x456fd5['getMembers'](_0x319e9f);}})['then'](function(_0x2d758f){if(_0x2d758f){_0x15ed72=_0x2d758f[_0xbea2('0x55')];if(!_0x3e2788[_0xbea2('0x3f')]['hasOwnProperty']('nolimit')){_0x319e9f['limit']=qs[_0xbea2('0x46')](_0x3e2788[_0xbea2('0x3f')]['limit']);_0x319e9f[_0xbea2('0x47')]=qs['offset'](_0x3e2788[_0xbea2('0x3f')][_0xbea2('0x47')]);}return _0x456fd5[_0xbea2('0x62')](_0x319e9f);}})['then'](function(_0x975d34){if(_0x975d34){return _0x975d34?{'count':_0x15ed72,'rows':_0x975d34}:null;}})['then'](respondWithResult(_0x4f8b2a,null))[_0xbea2('0x2c')](handleError(_0x4f8b2a,null));};exports[_0xbea2('0x64')]=function(_0x4f948f,_0x3d3436,_0x1b65a5){return db[_0xbea2('0x3c')][_0xbea2('0x58')]({'where':{'id':_0x4f948f[_0xbea2('0x53')]['id']}})[_0xbea2('0x21')](handleEntityNotFound(_0x3d3436,null))[_0xbea2('0x21')](function(_0x3e8218){if(_0x3e8218){return _0x3e8218[_0xbea2('0x64')](_0x4f948f[_0xbea2('0x3f')][_0xbea2('0x60')]);}})[_0xbea2('0x21')](respondWithStatusCode(_0x3d3436,null))['catch'](handleError(_0x3d3436,null));};exports[_0xbea2('0x65')]=function(_0x3ed6b5,_0x2952ad,_0x145c52){if(_0x3ed6b5[_0xbea2('0x57')]['id']){delete _0x3ed6b5[_0xbea2('0x57')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x3ed6b5[_0xbea2('0x53')]['id']}})[_0xbea2('0x21')](handleEntityNotFound(_0x2952ad,null))['then'](function(_0x40e850){if(_0x40e850){_0x3ed6b5[_0xbea2('0x57')][_0xbea2('0x66')]=_0x40e850['id'];return db[_0xbea2('0x5c')][_0xbea2('0x56')](_0x3ed6b5[_0xbea2('0x57')]);}})[_0xbea2('0x21')](respondWithResult(_0x2952ad,null))[_0xbea2('0x2c')](handleError(_0x2952ad,null));};exports[_0xbea2('0x67')]=function(_0x307100,_0x4f10cf,_0x28d9ea){var _0x418986={};var _0x1b90ff={};var _0x250eb3;var _0x61fd84;return db['ChatGroup'][_0xbea2('0x68')]({'where':{'id':_0x307100[_0xbea2('0x53')]['id']}})[_0xbea2('0x21')](handleEntityNotFound(_0x4f10cf,null))[_0xbea2('0x21')](function(_0x4f44e2){if(_0x4f44e2){_0x250eb3=_0x4f44e2;_0x1b90ff[_0xbea2('0x41')]=_[_0xbea2('0x54')](db[_0xbea2('0x5c')][_0xbea2('0x3d')]);_0x1b90ff[_0xbea2('0x3f')]=_['keys'](_0x307100[_0xbea2('0x3f')]);_0x1b90ff[_0xbea2('0x40')]=_[_0xbea2('0x43')](_0x1b90ff[_0xbea2('0x41')],_0x1b90ff[_0xbea2('0x3f')]);_0x418986[_0xbea2('0x42')]=_['intersection'](_0x1b90ff['model'],qs['fields'](_0x307100[_0xbea2('0x3f')]['fields']));_0x418986['attributes']=_0x418986['attributes'][_0xbea2('0x55')]?_0x418986[_0xbea2('0x42')]:_0x1b90ff[_0xbea2('0x41')];_0x418986['order']=qs['sort'](_0x307100[_0xbea2('0x3f')][_0xbea2('0x49')]);_0x418986['where']=qs[_0xbea2('0x40')](_['pick'](_0x307100[_0xbea2('0x3f')],_0x1b90ff[_0xbea2('0x40')]));if(_0x307100[_0xbea2('0x3f')]['filter']){_0x418986[_0xbea2('0x4c')]=_[_0xbea2('0x4d')](_0x418986[_0xbea2('0x4c')],{'$or':_[_0xbea2('0x3b')](_0x418986[_0xbea2('0x42')],function(_0xcb90ab){var _0x45666d={};_0x45666d[_0xcb90ab]={'$like':'%'+_0x307100[_0xbea2('0x3f')][_0xbea2('0x4b')]+'%'};return _0x45666d;})});}if(_0x307100['query'][_0xbea2('0x69')]){var _0x5e2ac1=_0x307100[_0xbea2('0x3f')]['$gte'][_0xbea2('0x6a')](',');var _0x28e96b={};_0x28e96b[_0x5e2ac1[0x0]]={'$gte':moment(_0x5e2ac1[0x1])[_0xbea2('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x418986['where']=_[_0xbea2('0x4d')](_0x418986['where'],_0x28e96b);}_0x418986=_['merge']({},_0x418986,_0x307100[_0xbea2('0x4e')]);return _0x250eb3['getMessages'](_0x418986);}})['then'](function(_0x44094f){if(_0x44094f){_0x61fd84=_0x44094f[_0xbea2('0x55')];if(!_0x307100['query']['hasOwnProperty'](_0xbea2('0x6c'))){_0x418986[_0xbea2('0x46')]=qs[_0xbea2('0x46')](_0x307100[_0xbea2('0x3f')][_0xbea2('0x46')]);_0x418986[_0xbea2('0x47')]=qs[_0xbea2('0x47')](_0x307100[_0xbea2('0x3f')]['offset']);}return _0x250eb3[_0xbea2('0x67')](_0x418986);}})['then'](function(_0x4d5098){if(_0x4d5098){return _0x4d5098?{'count':_0x61fd84,'rows':_0x4d5098}:null;}})[_0xbea2('0x21')](respondWithResult(_0x4f10cf,null))[_0xbea2('0x2c')](handleError(_0x4f10cf,null));}; \ No newline at end of file +var _0x035a=['describe','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','removeMembers','ChatGroupId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','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','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','destroy','end','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','includeAll','find','create','body','params'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x035a,0x76));var _0xa035=function(_0xd924b6,_0x14fb3b){_0xd924b6=_0xd924b6-0x0;var _0x310f57=_0x035a[_0xd924b6];return _0x310f57;};'use strict';var pdf=require(_0xa035('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa035('0x1'));var zipdir=require(_0xa035('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa035('0x3'));var moment=require(_0xa035('0x4'));var BPromise=require(_0xa035('0x5'));var Mustache=require('mustache');var util=require(_0xa035('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa035('0x7'));var ejs=require(_0xa035('0x8'));var fs=require('fs');var _=require(_0xa035('0x9'));var squel=require(_0xa035('0xa'));var crypto=require(_0xa035('0xb'));var jsforce=require(_0xa035('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa035('0x7'));var querystring=require(_0xa035('0xd'));var Papa=require(_0xa035('0xe'));var Redis=require(_0xa035('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa035('0x10'));var as=require(_0xa035('0x11'));var hardwareService=require(_0xa035('0x12'));var logger=require(_0xa035('0x13'))(_0xa035('0x14'));var utils=require('../../config/utils');var config=require(_0xa035('0x15'));var db=require(_0xa035('0x16'))['db'];config[_0xa035('0x17')]=_['defaults'](config['redis'],{'host':_0xa035('0x18'),'port':0x18eb});var socket=require(_0xa035('0x19'))(new Redis(config[_0xa035('0x17')]));require(_0xa035('0x1a'))[_0xa035('0x1b')](socket);var jayson=require(_0xa035('0x1c'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1b6ae4,_0x40a802,_0x7a9049){if(_0x7a9049){var _0x16d9ed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16d9ed[_0xa035('0x1d')](_0x40a802)){return _0x1b6ae4;}else{throw new db['Sequelize'][(_0xa035('0x1e'))](_0xa035('0x1f'));}}else{return _0x1b6ae4;}}function respondWithRpcPromise(_0x11f931,_0x5a542b,_0x4a7906,_0xbf4d8){return new BPromise(function(_0x48a6ba,_0x51f322){var _0x3d9e9b=_0xbf4d8||client;return _0x3d9e9b[_0xa035('0x20')](_0x11f931,_0x4a7906)[_0xa035('0x21')](function(_0xd9da09){logger[_0xa035('0x22')]('ChatGroup,\x20%s,\x20%s',_0x5a542b,'request\x20sent');logger['debug'](_0xa035('0x23'),_0x5a542b,_0xa035('0x24'),JSON[_0xa035('0x25')](_0xd9da09));if(_0xd9da09[_0xa035('0x26')]){if(_0xd9da09['error'][_0xa035('0x27')]===0x1f4){logger['error'](_0xa035('0x28'),_0x5a542b,_0xd9da09['error'][_0xa035('0x29')]);return _0x51f322(_0xd9da09['error']['message']);}logger[_0xa035('0x26')](_0xa035('0x28'),_0x5a542b,_0xd9da09['error'][_0xa035('0x29')]);return _0x48a6ba(_0xd9da09[_0xa035('0x26')][_0xa035('0x29')]);}else{logger[_0xa035('0x22')](_0xa035('0x28'),_0x5a542b,_0xa035('0x24'));_0x48a6ba(_0xd9da09[_0xa035('0x2a')][_0xa035('0x29')]);}})[_0xa035('0x2b')](function(_0x35ba6c){logger[_0xa035('0x26')](_0xa035('0x28'),_0x5a542b,_0x35ba6c);_0x51f322(_0x35ba6c);});});}function respondWithStatusCode(_0x4dda21,_0x81276b){_0x81276b=_0x81276b||0xcc;return function(_0x1d814d){if(_0x1d814d){return _0x4dda21[_0xa035('0x2c')](_0x81276b);}return _0x4dda21[_0xa035('0x2d')](_0x81276b)['end']();};}function respondWithResult(_0x1dd63f,_0x30fd90){_0x30fd90=_0x30fd90||0xc8;return function(_0x2442ff){if(_0x2442ff){return _0x1dd63f[_0xa035('0x2d')](_0x30fd90)[_0xa035('0x2e')](_0x2442ff);}};}function respondWithFilteredResult(_0x53cd0a,_0x1c96ed){return function(_0xa2b0ca){if(_0xa2b0ca){var _0x48d1bc=_0xa2b0ca[_0xa035('0x2f')],_0x49d2b1=_0x1c96ed[_0xa035('0x30')],_0x332523=_0x1c96ed['offset']+_0x1c96ed[_0xa035('0x31')],_0x55da4b;if(_0x332523>=_0x48d1bc){_0x332523=_0x48d1bc;_0x55da4b=0xc8;}else{_0x55da4b=0xce;}_0x53cd0a['status'](_0x55da4b);return _0x53cd0a[_0xa035('0x32')](_0xa035('0x33'),_0x49d2b1+'-'+_0x332523+'/'+_0x48d1bc)['json'](_0xa2b0ca);}return null;};}function patchUpdates(_0x806296){return function(_0xe88d1b){try{jsonpatch['apply'](_0xe88d1b,_0x806296,!![]);}catch(_0x2bfcbe){return BPromise['reject'](_0x2bfcbe);}return _0xe88d1b['save']();};}function saveUpdates(_0x236c3d,_0x21a4ce){return function(_0x36f72c){if(_0x36f72c){return _0x36f72c['update'](_0x236c3d)[_0xa035('0x21')](function(_0x330207){return _0x330207;});}return null;};}function removeEntity(_0x3a14f2,_0x36f355){return function(_0x9da281){if(_0x9da281){return _0x9da281[_0xa035('0x34')]()[_0xa035('0x21')](function(){_0x3a14f2[_0xa035('0x2d')](0xcc)[_0xa035('0x35')]();});}};}function handleEntityNotFound(_0x4d6cc0,_0x10c70e){return function(_0x303bde){if(!_0x303bde){_0x4d6cc0[_0xa035('0x2c')](0x194);}return _0x303bde;};}function handleError(_0x5f5bb3,_0x22f51c){_0x22f51c=_0x22f51c||0x1f4;return function(_0x2cfa29){logger[_0xa035('0x26')](_0x2cfa29[_0xa035('0x36')]);if(_0x2cfa29[_0xa035('0x37')]){delete _0x2cfa29[_0xa035('0x37')];}_0x5f5bb3['status'](_0x22f51c)[_0xa035('0x38')](_0x2cfa29);};}exports[_0xa035('0x39')]=function(_0x4d906f,_0x2a4684){var _0x2a517c={},_0x48c09d={},_0xab742={'count':0x0,'rows':[]};var _0x2a095f=_[_0xa035('0x3a')](db[_0xa035('0x3b')][_0xa035('0x3c')],function(_0x39f15c){return{'name':_0x39f15c[_0xa035('0x3d')],'type':_0x39f15c[_0xa035('0x3e')][_0xa035('0x3f')]};});_0x48c09d[_0xa035('0x40')]=_[_0xa035('0x3a')](_0x2a095f,_0xa035('0x37'));_0x48c09d['query']=_[_0xa035('0x41')](_0x4d906f[_0xa035('0x42')]);_0x48c09d[_0xa035('0x43')]=_[_0xa035('0x44')](_0x48c09d[_0xa035('0x40')],_0x48c09d[_0xa035('0x42')]);_0x2a517c[_0xa035('0x45')]=_[_0xa035('0x44')](_0x48c09d[_0xa035('0x40')],qs['fields'](_0x4d906f[_0xa035('0x42')][_0xa035('0x46')]));_0x2a517c[_0xa035('0x45')]=_0x2a517c[_0xa035('0x45')][_0xa035('0x47')]?_0x2a517c[_0xa035('0x45')]:_0x48c09d[_0xa035('0x40')];if(!_0x4d906f[_0xa035('0x42')][_0xa035('0x48')](_0xa035('0x49'))){_0x2a517c[_0xa035('0x31')]=qs[_0xa035('0x31')](_0x4d906f[_0xa035('0x42')][_0xa035('0x31')]);_0x2a517c[_0xa035('0x30')]=qs['offset'](_0x4d906f['query'][_0xa035('0x30')]);}_0x2a517c[_0xa035('0x4a')]=qs[_0xa035('0x4b')](_0x4d906f[_0xa035('0x42')][_0xa035('0x4b')]);_0x2a517c[_0xa035('0x4c')]=qs[_0xa035('0x43')](_[_0xa035('0x4d')](_0x4d906f[_0xa035('0x42')],_0x48c09d[_0xa035('0x43')]),_0x2a095f);if(_0x4d906f['query'][_0xa035('0x4e')]){_0x2a517c[_0xa035('0x4c')]=_[_0xa035('0x4f')](_0x2a517c['where'],{'$or':_[_0xa035('0x3a')](_0x2a095f,function(_0x424d6a){if(_0x424d6a[_0xa035('0x3e')]!==_0xa035('0x50')){var _0xca9007={};_0xca9007[_0x424d6a['name']]={'$like':'%'+_0x4d906f[_0xa035('0x42')][_0xa035('0x4e')]+'%'};return _0xca9007;}})});}_0x2a517c=_[_0xa035('0x4f')]({},_0x2a517c,_0x4d906f[_0xa035('0x51')]);var _0x529c4f={'where':_0x2a517c['where']};return db['ChatGroup'][_0xa035('0x2f')](_0x529c4f)[_0xa035('0x21')](function(_0x5c0f44){_0xab742[_0xa035('0x2f')]=_0x5c0f44;if(_0x4d906f[_0xa035('0x42')]['includeAll']){_0x2a517c[_0xa035('0x52')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x2a517c);})['then'](function(_0x58be71){_0xab742['rows']=_0x58be71;return _0xab742;})[_0xa035('0x21')](respondWithFilteredResult(_0x2a4684,_0x2a517c))[_0xa035('0x2b')](handleError(_0x2a4684,null));};exports['show']=function(_0x4790db,_0x223e81){var _0x1e5096={'raw':!![],'where':{'id':_0x4790db['params']['id']}},_0x44d1d0={};_0x44d1d0[_0xa035('0x40')]=_['keys'](db[_0xa035('0x3b')]['rawAttributes']);_0x44d1d0['query']=_[_0xa035('0x41')](_0x4790db['query']);_0x44d1d0[_0xa035('0x43')]=_[_0xa035('0x44')](_0x44d1d0[_0xa035('0x40')],_0x44d1d0['query']);_0x1e5096[_0xa035('0x45')]=_['intersection'](_0x44d1d0[_0xa035('0x40')],qs[_0xa035('0x46')](_0x4790db['query'][_0xa035('0x46')]));_0x1e5096[_0xa035('0x45')]=_0x1e5096[_0xa035('0x45')][_0xa035('0x47')]?_0x1e5096['attributes']:_0x44d1d0[_0xa035('0x40')];if(_0x4790db[_0xa035('0x42')][_0xa035('0x53')]){_0x1e5096[_0xa035('0x52')]=[{'all':!![]}];}_0x1e5096=_[_0xa035('0x4f')]({},_0x1e5096,_0x4790db[_0xa035('0x51')]);return db[_0xa035('0x3b')][_0xa035('0x54')](_0x1e5096)[_0xa035('0x21')](handleEntityNotFound(_0x223e81,null))['then'](respondWithResult(_0x223e81,null))['catch'](handleError(_0x223e81,null));};exports[_0xa035('0x55')]=function(_0xa1bdc3,_0x6b4a9){return db['ChatGroup'][_0xa035('0x55')](_0xa1bdc3[_0xa035('0x56')],{})['then'](respondWithResult(_0x6b4a9,0xc9))['catch'](handleError(_0x6b4a9,null));};exports['update']=function(_0x23e87a,_0x2e56db){if(_0x23e87a[_0xa035('0x56')]['id']){delete _0x23e87a[_0xa035('0x56')]['id'];}return db[_0xa035('0x3b')][_0xa035('0x54')]({'where':{'id':_0x23e87a[_0xa035('0x57')]['id']}})[_0xa035('0x21')](handleEntityNotFound(_0x2e56db,null))[_0xa035('0x21')](saveUpdates(_0x23e87a['body'],null))[_0xa035('0x21')](respondWithResult(_0x2e56db,null))[_0xa035('0x2b')](handleError(_0x2e56db,null));};exports['destroy']=function(_0xf5b325,_0x140f8b){return db[_0xa035('0x3b')][_0xa035('0x54')]({'where':{'id':_0xf5b325['params']['id']}})[_0xa035('0x21')](handleEntityNotFound(_0x140f8b,null))[_0xa035('0x21')](removeEntity(_0x140f8b,null))[_0xa035('0x2b')](handleError(_0x140f8b,null));};exports[_0xa035('0x58')]=function(_0x214f95,_0x1047fb){return db[_0xa035('0x3b')][_0xa035('0x58')]()[_0xa035('0x21')](respondWithResult(_0x1047fb,null))[_0xa035('0x2b')](handleError(_0x1047fb,null));};exports['getUnread']=function(_0x3a6d45,_0x4ff450,_0x1702fe){return db[_0xa035('0x59')]['count']({'where':{'ChatGroupId':_0x3a6d45['params']['id'],'ToId':_0x3a6d45[_0xa035('0x5a')]['id'],'read':![]}})[_0xa035('0x21')](function(_0x58e620){return{'id':_['toInteger'](_0x3a6d45[_0xa035('0x57')]['id']),'count':_0x58e620};})[_0xa035('0x21')](respondWithResult(_0x4ff450,null))[_0xa035('0x2b')](handleError(_0x4ff450,null));};exports[_0xa035('0x5b')]=function(_0x3261c5,_0x42fd72,_0xbb281){return db[_0xa035('0x3b')][_0xa035('0x54')]({'where':{'id':_0x3261c5[_0xa035('0x57')]['id']}})[_0xa035('0x21')](handleEntityNotFound(_0x42fd72,null))['then'](function(_0x4d3c4e){if(_0x4d3c4e){return _0x4d3c4e[_0xa035('0x5b')](_0x3261c5[_0xa035('0x56')][_0xa035('0x5c')],_[_0xa035('0x5d')](_0x3261c5[_0xa035('0x56')],[_0xa035('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x42fd72,null))['catch'](handleError(_0x42fd72,null));};exports[_0xa035('0x5e')]=function(_0x52f51d,_0x483ad9,_0x4ac39a){var _0x76165={};var _0x191788={};var _0x2861fb;var _0x18398a;return db[_0xa035('0x3b')][_0xa035('0x5f')]({'where':{'id':_0x52f51d['params']['id']}})[_0xa035('0x21')](handleEntityNotFound(_0x483ad9,null))[_0xa035('0x21')](function(_0x25f5bd){if(_0x25f5bd){_0x2861fb=_0x25f5bd;_0x191788[_0xa035('0x40')]=_[_0xa035('0x41')](db[_0xa035('0x60')]['rawAttributes']);_0x191788['query']=_['keys'](_0x52f51d[_0xa035('0x42')]);_0x191788[_0xa035('0x43')]=_[_0xa035('0x44')](_0x191788[_0xa035('0x40')],_0x191788[_0xa035('0x42')]);_0x76165[_0xa035('0x45')]=_[_0xa035('0x44')](_0x191788['model'],qs[_0xa035('0x46')](_0x52f51d[_0xa035('0x42')][_0xa035('0x46')]));_0x76165[_0xa035('0x45')]=_0x76165['attributes'][_0xa035('0x47')]?_0x76165[_0xa035('0x45')]:_0x191788['model'];_0x76165[_0xa035('0x4a')]=qs[_0xa035('0x4b')](_0x52f51d[_0xa035('0x42')][_0xa035('0x4b')]);_0x76165[_0xa035('0x4c')]=qs['filters'](_[_0xa035('0x4d')](_0x52f51d['query'],_0x191788['filters']));if(_0x52f51d[_0xa035('0x42')]['filter']){_0x76165[_0xa035('0x4c')]=_[_0xa035('0x4f')](_0x76165['where'],{'$or':_[_0xa035('0x3a')](_0x76165[_0xa035('0x45')],function(_0x55768c){var _0x51d216={};_0x51d216[_0x55768c]={'$like':'%'+_0x52f51d['query'][_0xa035('0x4e')]+'%'};return _0x51d216;})});}_0x76165=_[_0xa035('0x4f')]({},_0x76165,_0x52f51d['options']);return _0x2861fb[_0xa035('0x5e')](_0x76165);}})[_0xa035('0x21')](function(_0x3b9913){if(_0x3b9913){_0x18398a=_0x3b9913[_0xa035('0x47')];if(!_0x52f51d[_0xa035('0x42')][_0xa035('0x48')](_0xa035('0x49'))){_0x76165[_0xa035('0x31')]=qs[_0xa035('0x31')](_0x52f51d[_0xa035('0x42')][_0xa035('0x31')]);_0x76165['offset']=qs['offset'](_0x52f51d[_0xa035('0x42')]['offset']);}return _0x2861fb[_0xa035('0x5e')](_0x76165);}})[_0xa035('0x21')](function(_0x2246b4){if(_0x2246b4){return _0x2246b4?{'count':_0x18398a,'rows':_0x2246b4}:null;}})[_0xa035('0x21')](respondWithResult(_0x483ad9,null))[_0xa035('0x2b')](handleError(_0x483ad9,null));};exports['removeMembers']=function(_0x22c595,_0x9d8cbe,_0x45f206){return db[_0xa035('0x3b')][_0xa035('0x54')]({'where':{'id':_0x22c595[_0xa035('0x57')]['id']}})[_0xa035('0x21')](handleEntityNotFound(_0x9d8cbe,null))[_0xa035('0x21')](function(_0x5b392f){if(_0x5b392f){return _0x5b392f[_0xa035('0x61')](_0x22c595[_0xa035('0x42')][_0xa035('0x5c')]);}})[_0xa035('0x21')](respondWithStatusCode(_0x9d8cbe,null))[_0xa035('0x2b')](handleError(_0x9d8cbe,null));};exports['addMessage']=function(_0x4bb1ae,_0x39e04f,_0x52a81f){if(_0x4bb1ae[_0xa035('0x56')]['id']){delete _0x4bb1ae[_0xa035('0x56')]['id'];}return db[_0xa035('0x3b')][_0xa035('0x54')]({'where':{'id':_0x4bb1ae[_0xa035('0x57')]['id']}})['then'](handleEntityNotFound(_0x39e04f,null))[_0xa035('0x21')](function(_0x55148e){if(_0x55148e){_0x4bb1ae[_0xa035('0x56')][_0xa035('0x62')]=_0x55148e['id'];return db[_0xa035('0x59')]['create'](_0x4bb1ae[_0xa035('0x56')]);}})[_0xa035('0x21')](respondWithResult(_0x39e04f,null))[_0xa035('0x2b')](handleError(_0x39e04f,null));};exports['getMessages']=function(_0x2f7474,_0x2d712b,_0x30dfbd){var _0xc9ae39={};var _0x467a67={};var _0x570584;var _0x41df52;return db['ChatGroup'][_0xa035('0x5f')]({'where':{'id':_0x2f7474[_0xa035('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d712b,null))[_0xa035('0x21')](function(_0x19ab09){if(_0x19ab09){_0x570584=_0x19ab09;_0x467a67['model']=_[_0xa035('0x41')](db[_0xa035('0x59')]['rawAttributes']);_0x467a67[_0xa035('0x42')]=_[_0xa035('0x41')](_0x2f7474[_0xa035('0x42')]);_0x467a67[_0xa035('0x43')]=_[_0xa035('0x44')](_0x467a67[_0xa035('0x40')],_0x467a67['query']);_0xc9ae39['attributes']=_[_0xa035('0x44')](_0x467a67[_0xa035('0x40')],qs[_0xa035('0x46')](_0x2f7474[_0xa035('0x42')][_0xa035('0x46')]));_0xc9ae39[_0xa035('0x45')]=_0xc9ae39[_0xa035('0x45')][_0xa035('0x47')]?_0xc9ae39[_0xa035('0x45')]:_0x467a67['model'];_0xc9ae39[_0xa035('0x4a')]=qs[_0xa035('0x4b')](_0x2f7474['query'][_0xa035('0x4b')]);_0xc9ae39[_0xa035('0x4c')]=qs[_0xa035('0x43')](_[_0xa035('0x4d')](_0x2f7474[_0xa035('0x42')],_0x467a67[_0xa035('0x43')]));if(_0x2f7474['query'][_0xa035('0x4e')]){_0xc9ae39[_0xa035('0x4c')]=_[_0xa035('0x4f')](_0xc9ae39[_0xa035('0x4c')],{'$or':_[_0xa035('0x3a')](_0xc9ae39[_0xa035('0x45')],function(_0x154f77){var _0x3eeb53={};_0x3eeb53[_0x154f77]={'$like':'%'+_0x2f7474[_0xa035('0x42')]['filter']+'%'};return _0x3eeb53;})});}if(_0x2f7474[_0xa035('0x42')][_0xa035('0x63')]){var _0x319274=_0x2f7474[_0xa035('0x42')]['$gte'][_0xa035('0x64')](',');var _0x2c30c6={};_0x2c30c6[_0x319274[0x0]]={'$gte':moment(_0x319274[0x1])['format'](_0xa035('0x65'))};_0xc9ae39['where']=_[_0xa035('0x4f')](_0xc9ae39[_0xa035('0x4c')],_0x2c30c6);}_0xc9ae39=_[_0xa035('0x4f')]({},_0xc9ae39,_0x2f7474[_0xa035('0x51')]);return _0x570584['getMessages'](_0xc9ae39);}})['then'](function(_0x5dda77){if(_0x5dda77){_0x41df52=_0x5dda77['length'];if(!_0x2f7474['query'][_0xa035('0x48')](_0xa035('0x49'))){_0xc9ae39[_0xa035('0x31')]=qs['limit'](_0x2f7474[_0xa035('0x42')][_0xa035('0x31')]);_0xc9ae39[_0xa035('0x30')]=qs[_0xa035('0x30')](_0x2f7474[_0xa035('0x42')][_0xa035('0x30')]);}return _0x570584[_0xa035('0x66')](_0xc9ae39);}})[_0xa035('0x21')](function(_0x3e8fbe){if(_0x3e8fbe){return _0x3e8fbe?{'count':_0x41df52,'rows':_0x3e8fbe}:null;}})[_0xa035('0x21')](respondWithResult(_0x2d712b,null))['catch'](handleError(_0x2d712b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index bd81e99..315bfcf 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x153009,_0x2b5fba){var _0x1e2702=function(_0x5e037d){while(--_0x5e037d){_0x153009['push'](_0x153009['shift']());}};_0x1e2702(++_0x2b5fba);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x2032,0xd9));var _0x2203=function(_0x144bcd,_0x218dba){_0x144bcd=_0x144bcd-0x0;var _0x13788a=_0x2032[_0x144bcd];return _0x13788a;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2445be3..12fe736 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 _0xafdd=['request-promise','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a84fb,_0x59b8e4){var _0x7feddb=function(_0x2ad51d){while(--_0x2ad51d){_0x4a84fb['push'](_0x4a84fb['shift']());}};_0x7feddb(++_0x59b8e4);}(_0xafdd,0x19a));var _0xdafd=function(_0x363974,_0x34a5ef){_0x363974=_0x363974-0x0;var _0x524fdc=_0xafdd[_0x363974];return _0x524fdc;};'use strict';var _=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var logger=require(_0xdafd('0x2'))(_0xdafd('0x3'));var moment=require(_0xdafd('0x4'));var BPromise=require(_0xdafd('0x5'));var rp=require(_0xdafd('0x6'));var fs=require('fs');var path=require(_0xdafd('0x7'));var rimraf=require('rimraf');var config=require(_0xdafd('0x8'));var attributes=require(_0xdafd('0x9'));module[_0xdafd('0xa')]=function(_0x37f05a,_0xfa4ad6){return _0x37f05a[_0xdafd('0xb')](_0xdafd('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db9=['ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x1c4b46,_0x26ba44){var _0x32f50c=function(_0x4593f0){while(--_0x4593f0){_0x1c4b46['push'](_0x1c4b46['shift']());}};_0x32f50c(++_0x26ba44);}(_0x1db9,0x176));var _0x91db=function(_0x32da47,_0x295486){_0x32da47=_0x32da47-0x0;var _0x4dde4d=_0x1db9[_0x32da47];return _0x4dde4d;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('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 c13ca53..1217b1b 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 _0x7f78=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','info','ChatGroup,\x20%s,\x20%s','request\x20sent'];(function(_0x2b568f,_0x2071a0){var _0xd385f=function(_0x2ab9d4){while(--_0x2ab9d4){_0x2b568f['push'](_0x2b568f['shift']());}};_0xd385f(++_0x2071a0);}(_0x7f78,0x6a));var _0x87f7=function(_0x4e0de3,_0x306197){_0x4e0de3=_0x4e0de3-0x0;var _0x377965=_0x7f78[_0x4e0de3];return _0x377965;};'use strict';var _=require(_0x87f7('0x0'));var util=require('util');var moment=require(_0x87f7('0x1'));var BPromise=require(_0x87f7('0x2'));var rs=require(_0x87f7('0x3'));var fs=require('fs');var Redis=require(_0x87f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x87f7('0x5'));var config=require(_0x87f7('0x6'));var jayson=require(_0x87f7('0x7'));var client=jayson[_0x87f7('0x8')][_0x87f7('0x9')]({'port':0x232a});config[_0x87f7('0xa')]=_[_0x87f7('0xb')](config[_0x87f7('0xa')],{'host':_0x87f7('0xc'),'port':0x18eb});var socket=require(_0x87f7('0xd'))(new Redis(config[_0x87f7('0xa')]));require(_0x87f7('0xe'))[_0x87f7('0xf')](socket);function respondWithRpcPromise(_0xf5cc14,_0x1415b9,_0x484327){return new BPromise(function(_0x1e1c90,_0x3febda){return client['request'](_0xf5cc14,_0x484327)['then'](function(_0x3d304c){logger[_0x87f7('0x10')](_0x87f7('0x11'),_0x1415b9,_0x87f7('0x12'));logger[_0x87f7('0x13')](_0x87f7('0x14'),_0x1415b9,'request\x20sent',JSON['stringify'](_0x3d304c));if(_0x3d304c[_0x87f7('0x15')]){if(_0x3d304c[_0x87f7('0x15')][_0x87f7('0x16')]===0x1f4){logger['error'](_0x87f7('0x11'),_0x1415b9,_0x3d304c[_0x87f7('0x15')][_0x87f7('0x17')]);return _0x3febda(_0x3d304c[_0x87f7('0x15')][_0x87f7('0x17')]);}logger['error'](_0x87f7('0x11'),_0x1415b9,_0x3d304c['error'][_0x87f7('0x17')]);return _0x1e1c90(_0x3d304c[_0x87f7('0x15')][_0x87f7('0x17')]);}else{logger[_0x87f7('0x10')]('ChatGroup,\x20%s,\x20%s',_0x1415b9,_0x87f7('0x12'));_0x1e1c90(_0x3d304c['result'][_0x87f7('0x17')]);}})[_0x87f7('0x18')](function(_0x13d60){logger[_0x87f7('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1415b9,_0x13d60);_0x3febda(_0x13d60);});});} \ No newline at end of file +var _0xbf84=['socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','localhost'];(function(_0x4a632f,_0x346cf1){var _0x5964df=function(_0x88f8c2){while(--_0x88f8c2){_0x4a632f['push'](_0x4a632f['shift']());}};_0x5964df(++_0x346cf1);}(_0xbf84,0x146));var _0x4bf8=function(_0x1284d0,_0x80ce31){_0x1284d0=_0x1284d0-0x0;var _0x40da88=_0xbf84[_0x1284d0];return _0x40da88;};'use strict';var _=require(_0x4bf8('0x0'));var util=require('util');var moment=require(_0x4bf8('0x1'));var BPromise=require(_0x4bf8('0x2'));var rs=require(_0x4bf8('0x3'));var fs=require('fs');var Redis=require(_0x4bf8('0x4'));var db=require(_0x4bf8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bf8('0x6'))('rpc');var config=require(_0x4bf8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4bf8('0x8')]({'port':0x232a});config[_0x4bf8('0x9')]=_[_0x4bf8('0xa')](config['redis'],{'host':_0x4bf8('0xb'),'port':0x18eb});var socket=require(_0x4bf8('0xc'))(new Redis(config[_0x4bf8('0x9')]));require(_0x4bf8('0xd'))[_0x4bf8('0xe')](socket);function respondWithRpcPromise(_0x1aa394,_0x23ed23,_0x295170){return new BPromise(function(_0x2938fa,_0x4254b4){return client[_0x4bf8('0xf')](_0x1aa394,_0x295170)[_0x4bf8('0x10')](function(_0x210f64){logger[_0x4bf8('0x11')](_0x4bf8('0x12'),_0x23ed23,_0x4bf8('0x13'));logger[_0x4bf8('0x14')](_0x4bf8('0x15'),_0x23ed23,_0x4bf8('0x13'),JSON[_0x4bf8('0x16')](_0x210f64));if(_0x210f64[_0x4bf8('0x17')]){if(_0x210f64['error'][_0x4bf8('0x18')]===0x1f4){logger[_0x4bf8('0x17')]('ChatGroup,\x20%s,\x20%s',_0x23ed23,_0x210f64['error'][_0x4bf8('0x19')]);return _0x4254b4(_0x210f64[_0x4bf8('0x17')][_0x4bf8('0x19')]);}logger['error'](_0x4bf8('0x12'),_0x23ed23,_0x210f64['error'][_0x4bf8('0x19')]);return _0x2938fa(_0x210f64[_0x4bf8('0x17')][_0x4bf8('0x19')]);}else{logger[_0x4bf8('0x11')]('ChatGroup,\x20%s,\x20%s',_0x23ed23,_0x4bf8('0x13'));_0x2938fa(_0x210f64['result'][_0x4bf8('0x19')]);}})['catch'](function(_0x414e50){logger[_0x4bf8('0x17')]('ChatGroup,\x20%s,\x20%s',_0x23ed23,_0x414e50);_0x4254b4(_0x414e50);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 88f16ba..87f6b09 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 _0xe830=['remove','emit','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x2a096e,_0x1653cd){var _0x4eab9f=function(_0x31bee5){while(--_0x31bee5){_0x2a096e['push'](_0x2a096e['shift']());}};_0x4eab9f(++_0x1653cd);}(_0xe830,0xd7));var _0x0e83=function(_0x11c54e,_0x37edfe){_0x11c54e=_0x11c54e-0x0;var _0x46ff45=_0xe830[_0x11c54e];return _0x46ff45;};'use strict';var ChatGroupEvents=require(_0x0e83('0x0'));var events=[_0x0e83('0x1'),_0x0e83('0x2'),'update'];function createListener(_0x2acac6,_0x2be2d3){return function(_0x54185f){_0x2be2d3[_0x0e83('0x3')](_0x2acac6,_0x54185f);};}function removeListener(_0x520a7d,_0x14f2d5){return function(){ChatGroupEvents['removeListener'](_0x520a7d,_0x14f2d5);};}exports[_0x0e83('0x4')]=function(_0x3cefa7){for(var _0x26a77d=0x0,_0xc9adc1=events[_0x0e83('0x5')];_0x26a77d<_0xc9adc1;_0x26a77d++){var _0x57f083=events[_0x26a77d];var _0x313ec6=createListener(_0x0e83('0x6')+_0x57f083,_0x3cefa7);ChatGroupEvents['on'](_0x57f083,_0x313ec6);}}; \ No newline at end of file +var _0x1e5e=['./chatGroup.events','remove','update','removeListener','register','chatGroup:'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x1e5e,0xf6));var _0xe1e5=function(_0x14b8ee,_0x26d31a){_0x14b8ee=_0x14b8ee-0x0;var _0x50ef2b=_0x1e5e[_0x14b8ee];return _0x50ef2b;};'use strict';var ChatGroupEvents=require(_0xe1e5('0x0'));var events=['save',_0xe1e5('0x1'),_0xe1e5('0x2')];function createListener(_0x54a6c2,_0x28de95){return function(_0x42c446){_0x28de95['emit'](_0x54a6c2,_0x42c446);};}function removeListener(_0x310ecc,_0x922436){return function(){ChatGroupEvents[_0xe1e5('0x3')](_0x310ecc,_0x922436);};}exports[_0xe1e5('0x4')]=function(_0x559661){for(var _0x228b39=0x0,_0x4337ba=events['length'];_0x228b39<_0x4337ba;_0x228b39++){var _0x29ac34=events[_0x228b39];var _0x8482d4=createListener(_0xe1e5('0x5')+_0x29ac34,_0x559661);ChatGroupEvents['on'](_0x29ac34,_0x8482d4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9535589..dc00c2c 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 _0x0f8f=['destroy','removeMembers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','put','update','delete'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x0f8f,0x1d3));var _0xf0f8=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0x0f8f[_0x3f25b2];return _0xd8caeb;};'use strict';var multer=require('multer');var util=require(_0xf0f8('0x0'));var path=require(_0xf0f8('0x1'));var timeout=require(_0xf0f8('0x2'));var express=require(_0xf0f8('0x3'));var router=express[_0xf0f8('0x4')]();var auth=require(_0xf0f8('0x5'));var interaction=require(_0xf0f8('0x6'));var config=require('../../config/environment');var controller=require(_0xf0f8('0x7'));router[_0xf0f8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf0f8('0x9'),auth[_0xf0f8('0xa')](),controller[_0xf0f8('0xb')]);router[_0xf0f8('0x8')](_0xf0f8('0xc'),auth[_0xf0f8('0xa')](),controller[_0xf0f8('0xd')]);router[_0xf0f8('0x8')](_0xf0f8('0xe'),auth['isAuthenticated'](),controller[_0xf0f8('0xf')]);router[_0xf0f8('0x8')](_0xf0f8('0x10'),auth[_0xf0f8('0xa')](),controller[_0xf0f8('0x11')]);router[_0xf0f8('0x8')](_0xf0f8('0x12'),auth[_0xf0f8('0xa')](),controller[_0xf0f8('0x13')]);router[_0xf0f8('0x14')]('/',auth[_0xf0f8('0xa')](),controller[_0xf0f8('0x15')]);router[_0xf0f8('0x14')](_0xf0f8('0x10'),auth[_0xf0f8('0xa')](),controller['addMembers']);router[_0xf0f8('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf0f8('0x16')]);router[_0xf0f8('0x17')](_0xf0f8('0xc'),auth[_0xf0f8('0xa')](),controller[_0xf0f8('0x18')]);router[_0xf0f8('0x19')]('/:id',auth[_0xf0f8('0xa')](),controller[_0xf0f8('0x1a')]);router[_0xf0f8('0x19')](_0xf0f8('0x10'),auth[_0xf0f8('0xa')](),controller[_0xf0f8('0x1b')]);module[_0xf0f8('0x1c')]=router; \ No newline at end of file +var _0x3e6b=['/:id/unread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','removeMembers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x36320f,_0x2d368a){var _0x29c875=function(_0x35d738){while(--_0x35d738){_0x36320f['push'](_0x36320f['shift']());}};_0x29c875(++_0x2d368a);}(_0x3e6b,0x1e9));var _0xb3e6=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3e6b[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xb3e6('0x0'));var util=require(_0xb3e6('0x1'));var path=require(_0xb3e6('0x2'));var timeout=require(_0xb3e6('0x3'));var express=require(_0xb3e6('0x4'));var router=express['Router']();var auth=require(_0xb3e6('0x5'));var interaction=require(_0xb3e6('0x6'));var config=require('../../config/environment');var controller=require(_0xb3e6('0x7'));router[_0xb3e6('0x8')]('/',auth[_0xb3e6('0x9')](),controller[_0xb3e6('0xa')]);router[_0xb3e6('0x8')](_0xb3e6('0xb'),auth[_0xb3e6('0x9')](),controller[_0xb3e6('0xc')]);router['get'](_0xb3e6('0xd'),auth[_0xb3e6('0x9')](),controller[_0xb3e6('0xe')]);router['get'](_0xb3e6('0xf'),auth[_0xb3e6('0x9')](),controller['getUnread']);router[_0xb3e6('0x8')]('/:id/members',auth[_0xb3e6('0x9')](),controller['getMembers']);router[_0xb3e6('0x8')](_0xb3e6('0x10'),auth['isAuthenticated'](),controller[_0xb3e6('0x11')]);router[_0xb3e6('0x12')]('/',auth['isAuthenticated'](),controller[_0xb3e6('0x13')]);router[_0xb3e6('0x12')](_0xb3e6('0x14'),auth[_0xb3e6('0x9')](),controller[_0xb3e6('0x15')]);router[_0xb3e6('0x12')](_0xb3e6('0x10'),auth[_0xb3e6('0x9')](),controller[_0xb3e6('0x16')]);router[_0xb3e6('0x17')]('/:id',auth[_0xb3e6('0x9')](),controller[_0xb3e6('0x18')]);router[_0xb3e6('0x19')](_0xb3e6('0xd'),auth[_0xb3e6('0x9')](),controller['destroy']);router[_0xb3e6('0x19')](_0xb3e6('0x14'),auth[_0xb3e6('0x9')](),controller[_0xb3e6('0x1a')]);module[_0xb3e6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6247def..90b3bb2 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 _0x6bd7=['BOOLEAN','INTEGER','star','TEXT','STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x503d2f,_0x4fdc02){var _0x36bbfb=function(_0x462be2){while(--_0x462be2){_0x503d2f['push'](_0x503d2f['shift']());}};_0x36bbfb(++_0x4fdc02);}(_0x6bd7,0xa8));var _0x76bd=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x6bd7[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0x76bd('0x0'));module[_0x76bd('0x1')]={'closed':{'type':Sequelize[_0x76bd('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x76bd('0x3')]},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0x76bd('0x4')},'ratingMessage':{'type':Sequelize[_0x76bd('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x76bd('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x76bd('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x76bd('0x6')]},'osName':{'type':Sequelize[_0x76bd('0x6')]},'osVersion':{'type':Sequelize[_0x76bd('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x76bd('0x5')]},'customerIp':{'type':Sequelize[_0x76bd('0x6')]},'formData':{'type':Sequelize[_0x76bd('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x76bd('0x7')]},'lastMsgAt':{'type':Sequelize[_0x76bd('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x76bd('0x8')]('in',_0x76bd('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x76bd('0x6')]},'customerPort':{'type':Sequelize[_0x76bd('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x76bd('0x5')]}}; \ No newline at end of file +var _0x6cd7=['DATE','ENUM','out','sequelize','exports','BOOLEAN','INTEGER','star','TEXT','STRING'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0x6cd7,0x107));var _0x76cd=function(_0x53a356,_0x9da31a){_0x53a356=_0x53a356-0x0;var _0xc2b531=_0x6cd7[_0x53a356];return _0xc2b531;};'use strict';var Sequelize=require(_0x76cd('0x0'));module[_0x76cd('0x1')]={'closed':{'type':Sequelize[_0x76cd('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x76cd('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x76cd('0x4'),'thumb'),'defaultValue':_0x76cd('0x4')},'ratingMessage':{'type':Sequelize[_0x76cd('0x5')]},'pathTranscript':{'type':Sequelize[_0x76cd('0x5')]},'mailTranscript':{'type':Sequelize[_0x76cd('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x76cd('0x7')]},'disposition':{'type':Sequelize[_0x76cd('0x6')]},'note':{'type':Sequelize[_0x76cd('0x6')]},'browserName':{'type':Sequelize[_0x76cd('0x6')]},'browserVersion':{'type':Sequelize[_0x76cd('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x76cd('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x76cd('0x6')]},'deviceType':{'type':Sequelize[_0x76cd('0x6')]},'referer':{'type':Sequelize[_0x76cd('0x5')]},'customerIp':{'type':Sequelize[_0x76cd('0x6')]},'formData':{'type':Sequelize[_0x76cd('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x76cd('0x7')]},'lastMsgAt':{'type':Sequelize[_0x76cd('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x76cd('0x8')]('in',_0x76cd('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x76cd('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c83f43a..dbfdb42 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 _0x1623=['having','`unreadMessages`\x20>\x200','tag','isArray','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','ChatInteraction','includeAll','include','create','update','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','filename','file','mimetype','Attachment','attachmentDownload','Unauthorized','download','root','server/files/attachments/','close','mailTranscript','format','transcript-%s.txt','now','ChatMessage','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','fullname','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','pass','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','omit','ids','getMessages','pick','filter','options','findAll','getMyMessages','includeAgent','addTags','spread','Tag','emit','removeTags','unix','join','files','attachments','transcript-%d-%s.zip','push','lastName','direction','Account','Owner','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','server','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','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','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','then','end','name','Users','Tags','TagIds','split','forEach','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','field','color','from','tools_tags','select','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','expr','search','parseSearch','conditions','find','unreadMessages','`\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)','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x1623,0xab));var _0x3162=function(_0x1e1e66,_0x1cbf28){_0x1e1e66=_0x1e1e66-0x0;var _0x4673cd=_0x1623[_0x1e1e66];return _0x4673cd;};'use strict';var pdf=require(_0x3162('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3162('0x1'));var jsonpatch=require(_0x3162('0x2'));var rp=require(_0x3162('0x3'));var moment=require(_0x3162('0x4'));var BPromise=require(_0x3162('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3162('0x6'));var sox=require('sox');var csv=require(_0x3162('0x7'));var ejs=require(_0x3162('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0x7'));var querystring=require(_0x3162('0xd'));var Papa=require(_0x3162('0xe'));var Redis=require(_0x3162('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x10'));var hardwareService=require(_0x3162('0x11'));var logger=require(_0x3162('0x12'))(_0x3162('0x13'));var utils=require(_0x3162('0x14'));var config=require(_0x3162('0x15'));var db=require(_0x3162('0x16'))['db'];config[_0x3162('0x17')]=_[_0x3162('0x18')](config['redis'],{'host':_0x3162('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3162('0x17')]));require(_0x3162('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3162('0x1b')][_0x3162('0x1c')]({'port':0x232b});var client9004=jayson[_0x3162('0x1b')]['http']({'port':0x232c});function checkPasswordPattern(_0x15e348,_0x3d0bea,_0x2705d1){if(_0x2705d1){var _0x490371=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x490371[_0x3162('0x1d')](_0x3d0bea)){return _0x15e348;}else{throw new db[(_0x3162('0x1e'))][(_0x3162('0x1f'))](_0x3162('0x20'));}}else{return _0x15e348;}}function respondWithRpcPromise(_0x930415,_0x1eed46,_0x391d97,_0x4b2bf3){return new BPromise(function(_0x42f283,_0x1e3d75){var _0x460b7b=_0x4b2bf3||client;return _0x460b7b[_0x3162('0x21')](_0x930415,_0x391d97)['then'](function(_0x1dfd5c){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x1eed46,_0x3162('0x22'));logger[_0x3162('0x23')](_0x3162('0x24'),_0x1eed46,'request\x20sent',JSON['stringify'](_0x1dfd5c));if(_0x1dfd5c[_0x3162('0x25')]){if(_0x1dfd5c[_0x3162('0x25')][_0x3162('0x26')]===0x1f4){logger[_0x3162('0x25')](_0x3162('0x27'),_0x1eed46,_0x1dfd5c[_0x3162('0x25')][_0x3162('0x28')]);return _0x1e3d75(_0x1dfd5c[_0x3162('0x25')]['message']);}logger[_0x3162('0x25')](_0x3162('0x27'),_0x1eed46,_0x1dfd5c[_0x3162('0x25')][_0x3162('0x28')]);return _0x42f283(_0x1dfd5c[_0x3162('0x25')][_0x3162('0x28')]);}else{logger[_0x3162('0x29')](_0x3162('0x27'),_0x1eed46,_0x3162('0x22'));_0x42f283(_0x1dfd5c[_0x3162('0x2a')][_0x3162('0x28')]);}})[_0x3162('0x2b')](function(_0x1c03a4){logger['error'](_0x3162('0x27'),_0x1eed46,_0x1c03a4);_0x1e3d75(_0x1c03a4);});});}function respondWithStatusCode(_0x552469,_0x37acdd){_0x37acdd=_0x37acdd||0xcc;return function(_0x31f7fd){if(_0x31f7fd){return _0x552469[_0x3162('0x2c')](_0x37acdd);}return _0x552469['status'](_0x37acdd)['end']();};}function respondWithResult(_0xda0389,_0xaa1f35){_0xaa1f35=_0xaa1f35||0xc8;return function(_0x14df16){if(_0x14df16){return _0xda0389[_0x3162('0x2d')](_0xaa1f35)[_0x3162('0x2e')](_0x14df16);}};}function respondWithFilteredResult(_0x5c2d28,_0x8a7bce){return function(_0x4e3cc2){if(_0x4e3cc2){var _0xf11765=_0x4e3cc2[_0x3162('0x2f')],_0x3a188e=_0x8a7bce[_0x3162('0x30')],_0x41e933=_0x8a7bce[_0x3162('0x30')]+_0x8a7bce[_0x3162('0x31')],_0x221b38;if(_0x41e933>=_0xf11765){_0x41e933=_0xf11765;_0x221b38=0xc8;}else{_0x221b38=0xce;}_0x5c2d28['status'](_0x221b38);return _0x5c2d28[_0x3162('0x32')](_0x3162('0x33'),_0x3a188e+'-'+_0x41e933+'/'+_0xf11765)['json'](_0x4e3cc2);}return null;};}function patchUpdates(_0x110bb4){return function(_0x155b78){try{jsonpatch['apply'](_0x155b78,_0x110bb4,!![]);}catch(_0x5b7efb){return BPromise[_0x3162('0x34')](_0x5b7efb);}return _0x155b78['save']();};}function saveUpdates(_0x266aab,_0x47241c){return function(_0x1de909){if(_0x1de909){return _0x1de909['update'](_0x266aab)['then'](function(_0x3bb9d0){return _0x3bb9d0;});}return null;};}function removeEntity(_0x1cf9a6,_0x5d8714){return function(_0x1a79fc){if(_0x1a79fc){return _0x1a79fc['destroy']()[_0x3162('0x35')](function(){_0x1cf9a6[_0x3162('0x2d')](0xcc)[_0x3162('0x36')]();});}};}function handleEntityNotFound(_0x137e9b,_0x435aed){return function(_0x3b6c91){if(!_0x3b6c91){_0x137e9b[_0x3162('0x2c')](0x194);}return _0x3b6c91;};}function handleError(_0x25951b,_0x3ee5f8){_0x3ee5f8=_0x3ee5f8||0x1f4;return function(_0x16c5d6){logger[_0x3162('0x25')](_0x16c5d6['stack']);if(_0x16c5d6[_0x3162('0x37')]){delete _0x16c5d6[_0x3162('0x37')];}_0x25951b[_0x3162('0x2d')](_0x3ee5f8)['send'](_0x16c5d6);};}function getInteractionUsers(_0x59759d,_0x3b0a0b){return new BPromise(function(_0x124c92,_0x2e1ab5){try{if(_0x3b0a0b[_0x59759d['id']]){_0x59759d[_0x3162('0x38')]=_['map'](_0x3b0a0b[_0x59759d['id']],function(_0x4186b6){return{'id':_0x4186b6['id'],'fullname':_0x4186b6['fullname']};});}}catch(_0x59e049){_0x2e1ab5(_0x59e049);}_0x124c92(_0x59759d);});}function getInteractionTags(_0x5dee49,_0x298ed7){return new BPromise(function(_0x3fe4d2,_0x315fdb){try{if(_0x5dee49['TagIds']){_0x5dee49[_0x3162('0x39')]=[];_0x5dee49[_0x3162('0x3a')][_0x3162('0x3b')](',')[_0x3162('0x3c')](function(_0x1e8d5e){_0x5dee49['Tags']['push'](_0x298ed7[_0x1e8d5e]);});}delete _0x5dee49[_0x3162('0x3a')];}catch(_0x3783bd){_0x315fdb(_0x3783bd);}_0x3fe4d2(_0x5dee49);});}function updateChatInteraction(_0x5ae385,_0x5960cd,_0x43f780){return new BPromise(function(_0x32c960,_0x379756){return getInteractionUsers(_0x5ae385,_0x43f780)['then'](function(_0x3502ba){return getInteractionTags(_0x3502ba,_0x5960cd);})[_0x3162('0x35')](function(_0x1831f5){_0x32c960(_0x1831f5);})[_0x3162('0x2b')](function(_0x534708){_0x379756(_0x534708);});});}exports[_0x3162('0x3d')]=function(_0x282e3e,_0x522cce){var _0x1d78de={},_0x337352={},_0x500e6b={'count':0x0,'rows':[]};var _0xbb8846=_[_0x3162('0x3e')](db['ChatInteraction'][_0x3162('0x3f')],function(_0x555d33){return{'name':_0x555d33[_0x3162('0x40')],'type':_0x555d33[_0x3162('0x41')][_0x3162('0x42')]};});_0x337352[_0x3162('0x43')]=_[_0x3162('0x3e')](_0xbb8846,_0x3162('0x37'));_0x337352['query']=_[_0x3162('0x44')](_0x282e3e[_0x3162('0x45')]);_0x337352[_0x3162('0x46')]=_['intersection'](_0x337352[_0x3162('0x43')],_0x337352[_0x3162('0x45')]);_0x1d78de['attributes']=_[_0x3162('0x47')](_0x337352['model'],qs['fields'](_0x282e3e['query'][_0x3162('0x48')]));_0x1d78de[_0x3162('0x49')]=_0x1d78de[_0x3162('0x49')][_0x3162('0x4a')]?_0x1d78de[_0x3162('0x49')]:_0x337352[_0x3162('0x43')];if(!_0x282e3e[_0x3162('0x45')][_0x3162('0x4b')](_0x3162('0x4c'))){_0x1d78de[_0x3162('0x31')]=qs[_0x3162('0x31')](_0x282e3e[_0x3162('0x45')][_0x3162('0x31')]);_0x1d78de['offset']=qs[_0x3162('0x30')](_0x282e3e['query']['offset']);}_0x1d78de[_0x3162('0x4d')]=qs[_0x3162('0x4e')](_0x282e3e[_0x3162('0x45')][_0x3162('0x4e')]);_0x1d78de['where']=qs[_0x3162('0x46')](_['pick'](_0x282e3e[_0x3162('0x45')],_0x337352[_0x3162('0x46')]),_0xbb8846);var _0x4b23e8=[];var _0x146758=squel['select']()['field']('id')[_0x3162('0x4f')](_0x3162('0x37'))[_0x3162('0x4f')](_0x3162('0x50'))[_0x3162('0x51')](_0x3162('0x52'));var _0x871a24=squel[_0x3162('0x53')]()['field']('u.id')['field'](_0x3162('0x54'))[_0x3162('0x4f')](_0x3162('0x55'))[_0x3162('0x51')](_0x3162('0x56'),'ui')[_0x3162('0x57')](_0x3162('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x1f35ae=squel['select']()[_0x3162('0x51')]('chat_interactions','i')[_0x3162('0x57')]('cm_contacts','c',_0x3162('0x59'))[_0x3162('0x57')]('users','o','o.id\x20=\x20i.UserId')[_0x3162('0x57')](_0x3162('0x5a'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x3162('0x57')](_0x3162('0x5b'),'me',_0x3162('0x5c'))[_0x3162('0x57')](_0x3162('0x5d'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x3162('0x57')](_0x3162('0x52'),'t','t.id\x20=\x20it.TagId');var _0x5e1f2b=squel[_0x3162('0x5e')]();var _0x6ed643=[];var _0x27eaba=squel['expr']();var _0xf7d3e1;if(_0x282e3e[_0x3162('0x45')][_0x3162('0x5f')]){_0xf7d3e1=as[_0x3162('0x60')](_0x282e3e['query'][_0x3162('0x5f')]);var _0x286aad=_0xf7d3e1['sqlOperator'];for(var _0x3179a=0x0;_0x3179a<_0xf7d3e1['conditions'][_0x3162('0x4a')];_0x3179a++){var _0x1b0f2b=_0xf7d3e1[_0x3162('0x61')][_0x3179a];var _0x53ad9b='i';var _0x291aa7=_[_0x3162('0x62')](_0xbb8846,[_0x3162('0x37'),_0x1b0f2b[_0x3162('0x4f')]]);if(!_0x291aa7){switch(_0x1b0f2b[_0x3162('0x4f')]){case _0x3162('0x63'):if(_0x1b0f2b['value']==0x1){_0x1f35ae['having']('`'+_0x1b0f2b['field']+_0x3162('0x64'));}else{_0x1f35ae['having']('`'+_0x1b0f2b[_0x3162('0x4f')]+_0x3162('0x65'));}break;case _0x3162('0x66'):if(_0x1b0f2b[_0x3162('0x67')]===_0x3162('0x68')){if(_0x1b0f2b['value']['split']('\x20')[_0x3162('0x4a')]>0x1){_0x5e1f2b[_0x286aad](_0x3162('0x69'),qs['getFullTextValue'](_0x1b0f2b[_0x3162('0x6a')]),null);}else{var _0x2bd1ba='%'+_0x1b0f2b[_0x3162('0x6a')]+'%';_0x5e1f2b[_0x286aad](_0x3162('0x6b'),_0x2bd1ba,_0x2bd1ba,_0x2bd1ba);}}else{_0x291aa7=_[_0x3162('0x62')](_0xbb8846,['name',_0x3162('0x6c')]);_0x1b0f2b[_0x3162('0x4f')]=_0x3162('0x6c');_0x355cae=as[_0x3162('0x6d')](_0x53ad9b,_0x291aa7[_0x3162('0x41')],_0x1b0f2b);_0x5e1f2b[_0x286aad](_0x355cae['text'],_0x355cae[_0x3162('0x6a')][_0x3162('0x6e')],_0x355cae[_0x3162('0x6a')][_0x3162('0x36')]);}break;case'Tag':var _0x134a99=_0x1b0f2b[_0x3162('0x6a')][_0x3162('0x3b')](',')[_0x3162('0x3e')](function(_0x2f6fa2){return Number(_0x2f6fa2);});_0x134a99[_0x3162('0x3c')](function(_0xbc75f){_0x27eaba['or'](_0x3162('0x6f'),'%,'+_0xbc75f+',%');});_0x6ed643=_[_0x3162('0x70')](_0x6ed643,_0x134a99);break;case _0x3162('0x71'):if(_0x1b0f2b['operator']===_0x3162('0x68')){_0x5e1f2b[_0x286aad](_0x3162('0x72'),'%'+_0x1b0f2b['value']+'%',null);}else{_0x291aa7=_[_0x3162('0x62')](_0xbb8846,['name',_0x3162('0x73')]);_0x1b0f2b[_0x3162('0x4f')]=_0x3162('0x73');_0x355cae=as[_0x3162('0x6d')](_0x53ad9b,_0x291aa7[_0x3162('0x41')],_0x1b0f2b);_0x5e1f2b[_0x286aad](_0x355cae[_0x3162('0x74')],_0x355cae['value'][_0x3162('0x6e')],_0x355cae[_0x3162('0x6a')][_0x3162('0x36')]);}break;case _0x3162('0x75'):_0x355cae=as[_0x3162('0x6d')]('me',null,_0x1b0f2b);_0x5e1f2b[_0x286aad](_0x355cae[_0x3162('0x74')],_0x355cae['value'][_0x3162('0x6e')],_0x355cae[_0x3162('0x6a')][_0x3162('0x36')]);break;}}else{var _0x355cae=as[_0x3162('0x6d')](_0x53ad9b,_0x291aa7[_0x3162('0x41')],_0x1b0f2b);_0x5e1f2b[_0x286aad](_0x355cae[_0x3162('0x74')],_0x355cae['value']['start'],_0x355cae['value'][_0x3162('0x36')]);}}}else{var _0x3b4afd=_(_0x282e3e['query'])[_0x3162('0x44')]()[_0x3162('0x3e')](function(_0x4acd77){return _[_0x3162('0x76')](_0xbb8846,['name',_0x4acd77])?_0x4acd77:undefined;})[_0x3162('0x77')]()[_0x3162('0x6a')]();if(!_['isEmpty'](_0x3b4afd)){_0x3b4afd[_0x3162('0x3c')](function(_0x5e5892){if(_0x5e5892===_0x3162('0x78')){_0x1f35ae['where'](_0x3162('0x79'),[]['concat'](_0x282e3e[_0x3162('0x45')][_0x5e5892]));}else if(_0x5e5892===_0x3162('0x7a')){var _0x22c234=JSON[_0x3162('0x7b')](_0x282e3e[_0x3162('0x45')][_0x5e5892])[_0x3162('0x7c')];var _0x5885dd=JSON[_0x3162('0x7b')](_0x282e3e[_0x3162('0x45')][_0x5e5892])[_0x3162('0x7d')];_0x1f35ae['where'](_0x3162('0x7e'),_0x22c234,_0x5885dd);}else{if(_0x282e3e[_0x3162('0x45')][_0x5e5892]===_0x3162('0x7f')){_0x1f35ae[_0x3162('0x80')]('i.'+_0x5e5892+_0x3162('0x81'));}else{_0x1f35ae['where']('i.'+_0x5e5892+_0x3162('0x82'),_0x282e3e[_0x3162('0x45')][_0x5e5892]);}}});}if(_0x282e3e['query']['read']){if(_0x282e3e[_0x3162('0x45')][_0x3162('0x83')]==0x1){_0x1f35ae['having'](_0x3162('0x84'));}else{_0x1f35ae[_0x3162('0x85')](_0x3162('0x86'));}}if(_0x282e3e[_0x3162('0x45')][_0x3162('0x87')]){_0x6ed643=_[_0x3162('0x88')](_0x282e3e[_0x3162('0x45')][_0x3162('0x87')])?_0x282e3e[_0x3162('0x45')]['tag']:new Array(_0x282e3e['query'][_0x3162('0x87')]);_0x6ed643[_0x3162('0x3c')](function(_0x5d9af1){_0x27eaba['or'](_0x3162('0x6f'),'%,'+_0x5d9af1+',%');});}if(_0x282e3e['query']['filter']){var _0x4bc14c=_0x282e3e[_0x3162('0x45')]['filter'][_0x3162('0x89')]('\x5c','\x5c\x5c')[_0x3162('0x89')]('\x27\x27',_0x3162('0x8a'));if(qs[_0x3162('0x8b')](_0x4bc14c)){_0x5e1f2b['or'](_0x3162('0x8c'),_0x4bc14c+'%');}else{_0x5e1f2b['or'](_0x3162('0x8d'),qs[_0x3162('0x8e')](_0x4bc14c))['or'](_0x3162('0x8f'),_0x4bc14c+'%');}}}_0x1f35ae[_0x3162('0x80')](_0x5e1f2b);_0x1f35ae[_0x3162('0x90')](_0x3162('0x91'));var _0x53d6d9={'type':db[_0x3162('0x1e')][_0x3162('0x92')][_0x3162('0x93')],'raw':!![]};var _0x38ac7a=_0x1f35ae[_0x3162('0x94')]();_0x38ac7a[_0x3162('0x4f')](_0x3162('0x91'));_0x38ac7a[_0x3162('0x4f')](_0x3162('0x95'),_0x3162('0x63'));if(_0x1d78de[_0x3162('0x4d')]){_0x1d78de[_0x3162('0x4d')]['forEach'](function(_0x22bfb6){_0x1f35ae[_0x3162('0x4d')]('i.'+_0x22bfb6[0x0],_0x22bfb6[0x1]===_0x3162('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x6ed643)){_0x1f35ae[_0x3162('0x85')](_0x27eaba);_0x38ac7a['where'](_0x3162('0x97'),_0x6ed643);}BPromise[_0x3162('0x98')]()['then'](function(){if(!_0xf7d3e1){if(_0x282e3e['query'][_0x3162('0x78')]||_0x282e3e[_0x3162('0x45')]['journey'])return;_0x38ac7a[_0x3162('0x80')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x1f35ae[_0x3162('0x80')](_0x3162('0x99'));return;}return _0x282e3e[_0x3162('0x9a')][_0x3162('0x9b')]({'attributes':['id'],'raw':!![]})[_0x3162('0x35')](function(_0x32b6cf){if(_[_0x3162('0x9c')](_0x32b6cf)){_0x38ac7a[_0x3162('0x80')](_0x3162('0x9d'));_0x1f35ae['where'](_0x3162('0x9d'));}else{_0x38ac7a['where'](_0x3162('0x79'),_[_0x3162('0x3e')](_0x32b6cf,'id'));_0x1f35ae['where'](_0x3162('0x79'),_[_0x3162('0x3e')](_0x32b6cf,'id'));}});})[_0x3162('0x35')](function(){db[_0x3162('0x9e')][_0x3162('0x45')](_0x38ac7a[_0x3162('0x9f')](),_0x53d6d9)[_0x3162('0x35')](function(_0x59a84b){_0x500e6b[_0x3162('0x2f')]=_0x59a84b[_0x3162('0x4a')];if(_0x500e6b[_0x3162('0x2f')]===0x0)return[];return db['sequelize'][_0x3162('0x45')](_0x146758[_0x3162('0x9f')](),_0x53d6d9)[_0x3162('0x35')](function(_0x2b8e21){_0x4b23e8=_[_0x3162('0xa0')](_0x2b8e21,'id');_0x53d6d9=_[_0x3162('0xa1')](_0x53d6d9,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x282e3e[_0x3162('0x45')][_0x3162('0x48')]){_0x1d78de[_0x3162('0x49')][_0x3162('0x3c')](function(_0x40ae99){_0x1f35ae['field']('i.'+_0x40ae99);});}else{_0x1f35ae[_0x3162('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3162('0x63'));_0x1f35ae[_0x3162('0x4f')]('a.key',_0x3162('0xa2'));_0x1f35ae[_0x3162('0x4f')](_0x3162('0xa3'),'Account.mandatoryDisposition');_0x1f35ae[_0x3162('0x4f')]('i.*');_0x1f35ae['field'](_0x3162('0xa4'),_0x3162('0xa5'));_0x1f35ae[_0x3162('0x4f')](_0x3162('0xa6'),_0x3162('0xa7'));_0x1f35ae[_0x3162('0x4f')](_0x3162('0xa8'),'Contact.email');_0x1f35ae['field']('c.phone',_0x3162('0xa9'));_0x1f35ae[_0x3162('0x4f')]('c.mobile','Contact.mobile');_0x1f35ae[_0x3162('0x4f')]('c.fax',_0x3162('0xaa'));_0x1f35ae[_0x3162('0x4f')](_0x3162('0xab'),_0x3162('0xac'));_0x1f35ae['field'](_0x3162('0xad'),_0x3162('0xae'));_0x1f35ae[_0x3162('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3162('0x3a'));}if(_0x1d78de['limit'])_0x1f35ae[_0x3162('0x31')](_0x1d78de['limit']);if(_0x1d78de[_0x3162('0x30')])_0x1f35ae[_0x3162('0x30')](_0x1d78de[_0x3162('0x30')]);return db['sequelize'][_0x3162('0x45')](_0x1f35ae[_0x3162('0x9f')](),_0x53d6d9);})[_0x3162('0x35')](function(_0x249b87){_0x871a24['where'](_0x3162('0xaf'),_[_0x3162('0x3e')](_0x249b87,'id'));return db['sequelize'][_0x3162('0x45')](_0x871a24[_0x3162('0x9f')](),_0x53d6d9)[_0x3162('0x35')](function(_0x2243b3){var _0xdccc1a=_[_0x3162('0xb0')](_0x2243b3,_0x3162('0xb1'));var _0x3d977b=[];_0x249b87[_0x3162('0x3c')](function(_0xa2b606){_0x3d977b['push'](updateChatInteraction(_0xa2b606,_0x4b23e8,_0xdccc1a));});return BPromise[_0x3162('0xb2')](_0x3d977b);});});})[_0x3162('0x35')](function(_0x1ccb06){_0x500e6b[_0x3162('0xb3')]=_0x1ccb06;return _0x500e6b;})[_0x3162('0x35')](respondWithFilteredResult(_0x522cce,_0x1d78de));})[_0x3162('0x2b')](handleError(_0x522cce,null));};exports[_0x3162('0xb4')]=function(_0x3a103f,_0x49a2fe){var _0x2d179b={'raw':![],'where':{'id':_0x3a103f['params']['id']}},_0x3f0764={};_0x3f0764[_0x3162('0x43')]=_[_0x3162('0x44')](db[_0x3162('0xb5')][_0x3162('0x3f')]);_0x3f0764[_0x3162('0x45')]=_['keys'](_0x3a103f[_0x3162('0x45')]);_0x3f0764[_0x3162('0x46')]=_['intersection'](_0x3f0764[_0x3162('0x43')],_0x3f0764[_0x3162('0x45')]);_0x2d179b[_0x3162('0x49')]=_['intersection'](_0x3f0764['model'],qs[_0x3162('0x48')](_0x3a103f[_0x3162('0x45')]['fields']));_0x2d179b[_0x3162('0x49')]=_0x2d179b[_0x3162('0x49')][_0x3162('0x4a')]?_0x2d179b[_0x3162('0x49')]:_0x3f0764[_0x3162('0x43')];if(_0x3a103f[_0x3162('0x45')][_0x3162('0xb6')]){_0x2d179b[_0x3162('0xb7')]=[{'all':!![]}];}_0x2d179b=_[_0x3162('0xa1')]({},_0x2d179b,_0x3a103f['options']);return db[_0x3162('0xb5')][_0x3162('0x62')](_0x2d179b)['then'](handleEntityNotFound(_0x49a2fe,null))[_0x3162('0x35')](respondWithResult(_0x49a2fe,null))[_0x3162('0x2b')](handleError(_0x49a2fe,null));};exports[_0x3162('0xb8')]=function(_0x21a870,_0x334634){return db[_0x3162('0xb5')][_0x3162('0xb8')](_0x21a870[_0x3162('0x75')],{})[_0x3162('0x35')](respondWithResult(_0x334634,0xc9))[_0x3162('0x2b')](handleError(_0x334634,null));};exports[_0x3162('0xb9')]=function(_0x29b50e,_0x3fdb63){if(_0x29b50e['body']['id']){delete _0x29b50e[_0x3162('0x75')]['id'];}return db[_0x3162('0xb5')]['find']({'where':{'id':_0x29b50e[_0x3162('0xba')]['id']}})['then'](handleEntityNotFound(_0x3fdb63,null))[_0x3162('0x35')](saveUpdates(_0x29b50e[_0x3162('0x75')],null))[_0x3162('0x35')](respondWithResult(_0x3fdb63,null))[_0x3162('0x2b')](handleError(_0x3fdb63,null));};exports['destroy']=function(_0x301b3e,_0x43b706){return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x301b3e[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x43b706,null))[_0x3162('0x35')](removeEntity(_0x43b706,null))[_0x3162('0x2b')](handleError(_0x43b706,null));};exports[_0x3162('0xbb')]=function(_0x185974,_0x448ea9){return db['ChatInteraction'][_0x3162('0xbb')]()[_0x3162('0x35')](respondWithResult(_0x448ea9,null))[_0x3162('0x2b')](handleError(_0x448ea9,null));};exports[_0x3162('0xbc')]=function(_0x543964,_0x1b53ac){var _0xd056ef=_0x543964[_0x3162('0xba')]['id'];var _0x5ab418;var _0xa64510;var _0x411582;return db['ChatInteraction'][_0x3162('0xbd')]({'where':{'id':_0xd056ef}})[_0x3162('0x35')](function(_0x562335){_0x5ab418=_0x562335;return db[_0x3162('0xbe')][_0x3162('0xbd')]({'where':{'id':_0x562335[_0x3162('0x78')]},'attributes':['id',_0x3162('0xbf'),'vidaooEscalation'],'raw':!![]});})[_0x3162('0x35')](function(_0x13f37d){if(_0x13f37d&&_0x13f37d[_0x3162('0xbf')]&&_0x13f37d['vidaooEscalation']){_0xa64510=_0x13f37d;var _0x1dbdcc={'rejectUnauthorized':![],'method':_0x3162('0xc0'),'uri':_0x3162('0xc1'),'headers':{'X-APIKEY':_0x13f37d[_0x3162('0xbf')]},'body':{'name':_0x3162('0xc2')+_0xd056ef},'redirect':_0x3162('0xc3'),'json':!![]};return rp(_0x1dbdcc);}else{throw new db[(_0x3162('0x1e'))]['ValidationError'](_0x3162('0xc4'));}})[_0x3162('0x35')](function(_0x348241){_0x411582=_0x348241;if(_0x411582['id']){var _0x56ba1e={'body':_0x411582[_0x3162('0xc5')],'ChatWebsiteId':_0xa64510['id'],'ChatInteractionId':_0x5ab418['id'],'direction':_0x3162('0xc6'),'UserId':_0x543964[_0x3162('0x9a')]['id']};return db['ChatMessage'][_0x3162('0xb8')](_0x56ba1e,{});}else{throw new db[(_0x3162('0x1e'))][(_0x3162('0x1f'))](_0x3162('0xc7'));}})[_0x3162('0x35')](function(){return _0x5ab418[_0x3162('0xc8')]({'vidaooSessionId':_0x411582['id']});})[_0x3162('0x35')](respondWithResult(_0x1b53ac,null))[_0x3162('0x2b')](handleError(_0x1b53ac,null));};exports[_0x3162('0xc9')]=function(_0x2f1bc1,_0x42c65a){if(_0x2f1bc1[_0x3162('0x75')]['id']){delete _0x2f1bc1[_0x3162('0x75')]['id'];}return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x2f1bc1[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x42c65a,null))[_0x3162('0x35')](saveUpdates(_0x2f1bc1[_0x3162('0x75')],null))[_0x3162('0x35')](respondWithResult(_0x42c65a,null))[_0x3162('0x2b')](handleError(_0x42c65a,null));};exports[_0x3162('0xca')]=function(_0x5f3a9b,_0x13507d,_0x4137cb){if(_0x5f3a9b['body']['id']){delete _0x5f3a9b[_0x3162('0x75')]['id'];}return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x5f3a9b[_0x3162('0xba')]['id']}})[_0x3162('0x35')](function(_0x3bd8e4){if(!_0x3bd8e4){logger['error'](_0x3162('0xcb'),_0x3162('0xca'),0x194,'entity\x20not\x20found');_0x13507d[_0x3162('0x2c')](0x194);}else{if(_0x3bd8e4['UserId']){throw new db[(_0x3162('0x1e'))][(_0x3162('0x1f'))](_0x3162('0xcc'));}}return _0x3bd8e4;})[_0x3162('0x35')](function(_0x545f3e){if(_0x545f3e){return _0x545f3e[_0x3162('0xb9')]({'closed':_0x5f3a9b[_0x3162('0x75')][_0x3162('0xcd')],'disposition':_0x5f3a9b[_0x3162('0x75')][_0x3162('0xce')]})[_0x3162('0x35')](function(_0x4555ec){return _0x4555ec;});}})[_0x3162('0x35')](function(_0x594f55){return respondWithRpcPromise(_0x3162('0xcf'),_0x3162('0xca'),_0x5f3a9b[_0x3162('0x75')],client9004);})[_0x3162('0x35')](respondWithResult(_0x13507d,null))[_0x3162('0x2b')](handleError(_0x13507d,null));};exports[_0x3162('0xd0')]=function(_0x59c60a,_0x12282c,_0x421bb7){_0x59c60a[_0x3162('0x75')][_0x3162('0x37')]=_0x59c60a['file'][_0x3162('0xd1')];_0x59c60a[_0x3162('0x75')][_0x3162('0xd2')]=_0x59c60a['file'][_0x3162('0xd3')];_0x59c60a['body'][_0x3162('0x41')]=_0x59c60a[_0x3162('0xd4')][_0x3162('0xd5')];return db[_0x3162('0xd6')][_0x3162('0xb8')](_0x59c60a[_0x3162('0x75')])[_0x3162('0x35')](respondWithResult(_0x12282c,0xc9))['catch'](handleError(_0x12282c,null));};exports[_0x3162('0xd7')]=function(_0x71b6b9,_0x26a8ff,_0x30e1b7){return db[_0x3162('0xb5')][_0x3162('0xbd')]({'where':{'id':_0x71b6b9['params']['id']},'raw':!![]})[_0x3162('0x35')](handleEntityNotFound(_0x26a8ff,null))[_0x3162('0x35')](function(_0x1cca9a){if(_0x1cca9a){if(_0x1cca9a[_0x3162('0xcd')]){return _0x26a8ff['status'](0x193)[_0x3162('0x2e')]({'status':0x193,'message':_0x3162('0xd8')});}return db[_0x3162('0xd6')][_0x3162('0xbd')]({'where':{'id':_0x71b6b9[_0x3162('0x45')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x26a8ff,null));}})[_0x3162('0x35')](function(_0xc6d3a1){if(_0xc6d3a1){return _0x26a8ff[_0x3162('0xd9')](path['join'](config[_0x3162('0xda')],_0x3162('0xdb'),_0xc6d3a1[_0x3162('0xd2')]));}})[_0x3162('0x2b')](handleError(_0x26a8ff,null));};exports[_0x3162('0xdc')]=function(_0x391873,_0x548926){var _0x2df99e=null;var _0x4a7364=null;var _0x4749ba=null;var _0x468c8d=null;if(_0x391873['body']['id']){delete _0x391873[_0x3162('0x75')]['id'];}if(_0x391873[_0x3162('0x75')][_0x3162('0xdd')]){_0x468c8d=path['join'](config['root'],'server/files/chat/upload/',util[_0x3162('0xde')](_0x3162('0xdf'),Date[_0x3162('0xe0')]()));_0x391873[_0x3162('0x75')]['pathTranscript']=_0x468c8d;}return db['ChatInteraction'][_0x3162('0x62')]({'where':{'id':_0x391873['params']['id']},'include':[{'model':db[_0x3162('0xe1')],'as':_0x3162('0xe2'),'include':[{'model':db[_0x3162('0x71')],'as':_0x3162('0x71')}]}]})[_0x3162('0x35')](handleEntityNotFound(_0x548926,null))[_0x3162('0x35')](saveUpdates(_0x391873['body'],null))[_0x3162('0x35')](function(_0x459392){if(_0x459392){_0x2df99e=_0x459392;return db['ChatWebsite'][_0x3162('0x62')]({'where':{'id':_0x2df99e['ChatWebsiteId']}});}})[_0x3162('0x35')](function(_0x54e1ac){if(_0x54e1ac){_0x4749ba=_0x54e1ac;return db[_0x3162('0xe3')][_0x3162('0x62')]({'where':{'id':_0x2df99e[_0x3162('0x6c')]}});}})['then'](function(_0x332e31){if(_0x332e31){_0x4a7364=_0x332e31;if(_0x468c8d){var _0x505ef9=null;for(var _0x5381bc=0x1;_0x5381bc<_0x2df99e['Messages'][_0x3162('0x4a')];++_0x5381bc){_0x505ef9=_0x2df99e[_0x3162('0xe2')][_0x5381bc];var _0x341b67=_0x505ef9[_0x3162('0x73')]?util[_0x3162('0xde')](_0x3162('0xe4'),_0x4749ba[_0x3162('0xe5')],_0x505ef9[_0x3162('0x73')]):_0x3162('0xe6');var _0x2d298e=_0x391873[_0x3162('0x75')][_0x3162('0xe7')]||util[_0x3162('0xde')](_0x3162('0xe4'),_0x3162('0xe8'),_0x505ef9[_0x3162('0x6c')]);switch(_0x4749ba['agentIdentifier']){case _0x3162('0xe9'):_0x341b67=_0x505ef9['UserId']?util[_0x3162('0xde')](_0x3162('0xe4'),_0x4749ba[_0x3162('0xe5')],_0x505ef9[_0x3162('0x73')]):_0x3162('0xe6');break;case _0x3162('0xea'):_0x341b67=_0x505ef9[_0x3162('0x73')]?_0x505ef9[_0x3162('0x71')][_0x3162('0xeb')]||_0x505ef9[_0x3162('0x71')][_0x3162('0xec')]:_0x3162('0xe6');break;case _0x3162('0xed'):_0x341b67=_0x505ef9['UserId']?_0x505ef9['User'][_0x3162('0xec')]:_0x3162('0xe6');break;default:_0x341b67=_0x505ef9[_0x3162('0x73')]?util['format']('%s%d',_0x4749ba['agentAlias'],_0x505ef9[_0x3162('0x73')]):_0x3162('0xe6');}var _0x39785a=util[_0x3162('0xde')]('[%s]\x20%s:\x20%s\x0a',moment(_0x505ef9[_0x3162('0x7a')])['format'](_0x3162('0xee')),_0x505ef9['direction']==='in'?_0x2d298e:_0x341b67,_0x505ef9[_0x3162('0x75')]);if(!_0x505ef9[_0x3162('0xef')]){fs[_0x3162('0xf0')](_0x468c8d,_0x39785a);}}return db[_0x3162('0xf1')][_0x3162('0xbd')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x3162('0x35')](function(_0x2c485b){if(_0x2c485b&&_0x2c485b[_0x3162('0xf2')]&&_0x391873[_0x3162('0x75')]){var _0x1be5ab={'tls':{'rejectUnauthorized':![]}};if(_0x2c485b['Smtp'][_0x3162('0xf3')]){_0x1be5ab[_0x3162('0xf3')]=_0x2c485b[_0x3162('0xf2')][_0x3162('0xf3')];}else{_0x1be5ab[_0x3162('0xf4')]=_0x2c485b[_0x3162('0xf2')]['host'];_0x1be5ab[_0x3162('0xf5')]=_0x2c485b[_0x3162('0xf2')]['port'];_0x1be5ab[_0x3162('0xf6')]=_0x2c485b['Smtp']['secure'];}if(_0x2c485b['Smtp'][_0x3162('0xf7')]){_0x1be5ab['auth']={'user':_0x2c485b[_0x3162('0xf2')]['user'],'pass':_0x2c485b[_0x3162('0xf2')][_0x3162('0xf8')]};}return respondWithRpcPromise(_0x3162('0xf9'),'sendMail',{'account':_0x1be5ab,'message':{'from':util[_0x3162('0xde')](_0x3162('0xfa'),_0x2c485b[_0x3162('0x37')],_0x2c485b[_0x3162('0xfb')]||_0x2c485b[_0x3162('0xf2')][_0x3162('0x9a')]),'to':_0x391873[_0x3162('0x75')][_0x3162('0xdd')],'subject':_0x3162('0xfc'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x391873['body']['mailTranscript']),'attachments':[{'path':_0x468c8d}]}})[_0x3162('0x35')](function(){return _0x2df99e;})[_0x3162('0x2b')](function(_0x560089){console[_0x3162('0x25')](_0x560089);});}else{return _0x2df99e;}})[_0x3162('0x35')](respondWithStatusCode(_0x548926,0xc8))['catch'](handleError(_0x548926,null));};exports[_0x3162('0xfd')]=function(_0x4e54ed,_0x2b3e5e,_0x58b2c8){return db['ChatMessage']['find']({'where':{'id':_0x4e54ed[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x2b3e5e,null))['then'](function(_0x1d3e81){if(_0x1d3e81){return _0x1d3e81[_0x3162('0xfd')](_0x4e54ed[_0x3162('0x75')]['ids'],_[_0x3162('0xfe')](_0x4e54ed['body'],[_0x3162('0xff'),'id'])||{});}})[_0x3162('0x35')](respondWithResult(_0x2b3e5e,null))[_0x3162('0x2b')](handleError(_0x2b3e5e,null));};exports[_0x3162('0x100')]=function(_0x12e467,_0x26f3ad,_0x5397e2){var _0x8d0df={'raw':![],'where':{}};var _0x167d75={};var _0x2dcc43={'count':0x0,'rows':[]};return db[_0x3162('0xb5')]['findOne']({'where':{'id':_0x12e467[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x26f3ad,null))[_0x3162('0x35')](function(_0x2d7dc2){if(_0x2d7dc2){_0x167d75[_0x3162('0x43')]=_[_0x3162('0x44')](db[_0x3162('0xe1')]['rawAttributes']);_0x167d75[_0x3162('0x45')]=_[_0x3162('0x44')](_0x12e467[_0x3162('0x45')]);_0x167d75[_0x3162('0x46')]=_[_0x3162('0x47')](_0x167d75[_0x3162('0x43')],_0x167d75['query']);_0x8d0df[_0x3162('0x49')]=_['intersection'](_0x167d75[_0x3162('0x43')],qs[_0x3162('0x48')](_0x12e467['query'][_0x3162('0x48')]));_0x8d0df[_0x3162('0x49')]=_0x8d0df[_0x3162('0x49')]['length']?_0x8d0df[_0x3162('0x49')]:_0x167d75['model'];if(!_0x12e467[_0x3162('0x45')][_0x3162('0x4b')](_0x3162('0x4c'))){_0x8d0df[_0x3162('0x31')]=qs[_0x3162('0x31')](_0x12e467[_0x3162('0x45')]['limit']);_0x8d0df[_0x3162('0x30')]=qs['offset'](_0x12e467[_0x3162('0x45')][_0x3162('0x30')]);}_0x8d0df[_0x3162('0x4d')]=qs[_0x3162('0x4e')](_0x12e467['query'][_0x3162('0x4e')]);_0x8d0df[_0x3162('0x80')]=qs[_0x3162('0x46')](_[_0x3162('0x101')](_0x12e467[_0x3162('0x45')],_0x167d75[_0x3162('0x46')]));_0x8d0df[_0x3162('0x80')]['ChatInteractionId']=_0x2d7dc2['id'];if(_0x12e467[_0x3162('0x45')][_0x3162('0x102')]){_0x8d0df[_0x3162('0x80')]=_['merge'](_0x8d0df[_0x3162('0x80')],{'$or':_[_0x3162('0x3e')](_0x8d0df['attributes'],function(_0x109f34){var _0xf633c5={};_0xf633c5[_0x109f34]={'$like':'%'+_0x12e467[_0x3162('0x45')][_0x3162('0x102')]+'%'};return _0xf633c5;})});}if(_0x12e467['query'][_0x3162('0x7c')]){var _0x655e50=_0x12e467[_0x3162('0x45')]['$gte'][_0x3162('0x3b')](',');var _0x1df3ef={};_0x1df3ef[_0x655e50[0x0]]={'$gte':moment(_0x655e50[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x8d0df[_0x3162('0x80')]=_['merge'](_0x8d0df['where'],_0x1df3ef);}_0x8d0df=_[_0x3162('0xa1')]({},_0x8d0df,_0x12e467[_0x3162('0x103')]);return db[_0x3162('0xe1')][_0x3162('0x2f')]({'where':_0x8d0df[_0x3162('0x80')]})[_0x3162('0x35')](function(_0x4db20b){_0x2dcc43[_0x3162('0x2f')]=_0x4db20b;if(_0x12e467[_0x3162('0x45')][_0x3162('0xb6')]){_0x8d0df[_0x3162('0xb7')]=[{'all':!![]}];}return db['ChatMessage'][_0x3162('0x104')](_0x8d0df);})[_0x3162('0x35')](function(_0x25a0b8){_0x2dcc43[_0x3162('0xb3')]=_0x25a0b8;return _0x2dcc43;});}})['then'](respondWithFilteredResult(_0x26f3ad,_0x8d0df))[_0x3162('0x2b')](handleError(_0x26f3ad,null));};exports[_0x3162('0x105')]=function(_0x1f1e55,_0x2aeef7,_0x12655a){var _0x2bd203={'where':{}},_0x579bf2={},_0x1363c8={'count':0x0,'rows':[]};return db[_0x3162('0xb5')][_0x3162('0xbd')]({'where':{'id':_0x1f1e55[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x2aeef7,null))['then'](function(_0x506aad){if(_0x506aad){_0x579bf2[_0x3162('0x43')]=_['keys'](db[_0x3162('0xe1')][_0x3162('0x3f')]);_0x579bf2[_0x3162('0x45')]=_[_0x3162('0x44')](_0x1f1e55['query']);_0x579bf2[_0x3162('0x46')]=_['intersection'](_0x579bf2[_0x3162('0x43')],_0x579bf2[_0x3162('0x45')]);_0x2bd203[_0x3162('0x49')]=_['intersection'](_0x579bf2[_0x3162('0x43')],qs[_0x3162('0x48')](_0x1f1e55[_0x3162('0x45')]['fields']));_0x2bd203[_0x3162('0x49')]=_0x2bd203[_0x3162('0x49')][_0x3162('0x4a')]?_0x2bd203[_0x3162('0x49')]:_0x579bf2[_0x3162('0x43')];if(!_0x1f1e55['query']['hasOwnProperty'](_0x3162('0x4c'))){_0x2bd203['limit']=qs[_0x3162('0x31')](_0x1f1e55['query'][_0x3162('0x31')]);_0x2bd203[_0x3162('0x30')]=qs[_0x3162('0x30')](_0x1f1e55['query'][_0x3162('0x30')]);}_0x2bd203[_0x3162('0x4d')]=qs['sort'](_0x1f1e55[_0x3162('0x45')]['sort']);_0x2bd203[_0x3162('0x80')]=qs[_0x3162('0x46')](_[_0x3162('0x101')](_0x1f1e55[_0x3162('0x45')],_0x579bf2[_0x3162('0x46')]));_0x2bd203[_0x3162('0x80')][_0x3162('0xb1')]=_0x506aad['id'];if(_0x1f1e55[_0x3162('0x45')][_0x3162('0x102')]){_0x2bd203[_0x3162('0x80')]=_['merge'](_0x2bd203[_0x3162('0x80')],{'$or':_[_0x3162('0x3e')](_0x2bd203[_0x3162('0x49')],function(_0x476077){var _0xa09807={};_0xa09807[_0x476077]={'$like':'%'+_0x1f1e55[_0x3162('0x45')]['filter']+'%'};return _0xa09807;})});}_0x2bd203[_0x3162('0x80')][_0x3162('0xef')]=![];if(_0x1f1e55[_0x3162('0x45')]['id']){_0x2bd203['where']['id']={'$gt':_0x1f1e55[_0x3162('0x45')]['id']};}_0x2bd203=_['merge']({},_0x2bd203,_0x1f1e55[_0x3162('0x103')]);return db[_0x3162('0xe1')][_0x3162('0x2f')]({'where':_0x2bd203[_0x3162('0x80')]})['then'](function(_0x548fb5){_0x1363c8[_0x3162('0x2f')]=_0x548fb5;_0x2bd203[_0x3162('0xb7')]=[];if(_0x1f1e55[_0x3162('0x45')][_0x3162('0x106')]){_0x2bd203[_0x3162('0xb7')]['push']({'model':db[_0x3162('0x71')],'as':'User','attributes':['id',_0x3162('0xec'),_0x3162('0xeb')]});}if(_0x1f1e55[_0x3162('0x45')]['includeAll']){_0x2bd203[_0x3162('0xb7')]=[{'all':!![]}];}return db[_0x3162('0xe1')][_0x3162('0x104')](_0x2bd203);})[_0x3162('0x35')](function(_0x201644){_0x1363c8['rows']=_0x201644;return _0x1363c8;});}})[_0x3162('0x35')](respondWithFilteredResult(_0x2aeef7,_0x2bd203))['catch'](handleError(_0x2aeef7,null));};exports[_0x3162('0x107')]=function(_0x491aed,_0x235e9f,_0x3c2e92){return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x491aed[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x235e9f,null))[_0x3162('0x35')](function(_0x26cf0e){if(_0x26cf0e){return _0x26cf0e['setTags'](_0x491aed['body'][_0x3162('0xff')],_[_0x3162('0xfe')](_0x491aed[_0x3162('0x75')],[_0x3162('0xff'),'id'])||{})[_0x3162('0x108')](function(){return db[_0x3162('0x109')]['findAll']({'attributes':['id',_0x3162('0x37'),_0x3162('0x50')],'where':{'id':_0x491aed[_0x3162('0x75')]['ids']}});})[_0x3162('0x35')](function(_0x442122){socket[_0x3162('0x10a')]('chatInteractionTags:save',{'id':Number(_0x491aed[_0x3162('0xba')]['id']),'tags':_0x442122||[]});return{'id':Number(_0x491aed[_0x3162('0xba')]['id']),'tags':_0x442122||[]};});}})['then'](respondWithResult(_0x235e9f,null))[_0x3162('0x2b')](handleError(_0x235e9f,null));};exports[_0x3162('0x10b')]=function(_0x2af795,_0x4d031b,_0x10c3ab){return db['ChatInteraction'][_0x3162('0x62')]({'where':{'id':_0x2af795[_0x3162('0xba')]['id']}})[_0x3162('0x35')](handleEntityNotFound(_0x4d031b,null))[_0x3162('0x35')](function(_0x41f32a){if(_0x41f32a){return _0x41f32a[_0x3162('0x10b')](_0x2af795[_0x3162('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x4d031b,null))['catch'](handleError(_0x4d031b,null));};exports[_0x3162('0xd9')]=function(_0x3dbcbe,_0x39a4b8){var _0x4f9c36=moment()[_0x3162('0x10c')]()['toString']();var _0x35ae89=path[_0x3162('0x10d')](config[_0x3162('0xda')],'server',_0x3162('0x10e'),'tmp');var _0x41500b=path['join'](config[_0x3162('0xda')],'server','files',_0x3162('0x10f'));var _0xe47f9b=path[_0x3162('0x10d')](_0x35ae89,_0x4f9c36);var _0x4f3266=util[_0x3162('0xde')](_0x3162('0x110'),_0x3dbcbe[_0x3162('0xba')]['id'],_0x4f9c36);var _0x478f9f=path[_0x3162('0x10d')](_0x35ae89,_0x4f3266);var _0xfadf2a=[];_0xfadf2a[_0x3162('0x111')]({'model':db[_0x3162('0x71')],'as':_0x3162('0x71'),'attributes':['id','fullname'],'raw':!![]});_0xfadf2a[_0x3162('0x111')]({'model':db['CmContact'],'as':_0x3162('0x66'),'attributes':['id','firstName',_0x3162('0x112')],'raw':!![]});if(_0x3dbcbe['query']['attachments']){_0xfadf2a[_0x3162('0x111')]({'model':db[_0x3162('0xd6')],'as':_0x3162('0xd6'),'raw':!![]});}var _0x238eef=[{'model':db[_0x3162('0xe1')],'as':'Messages','attributes':['id','body',_0x3162('0x7a'),_0x3162('0x113'),_0x3162('0xef'),'read'],'include':_0xfadf2a}];_0x238eef['push']({'model':db[_0x3162('0xbe')],'as':_0x3162('0x114'),'attributes':['id',_0x3162('0x37')]});_0x238eef[_0x3162('0x111')]({'model':db['User'],'as':_0x3162('0x115'),'attributes':['id',_0x3162('0xec')]});return db[_0x3162('0xb5')][_0x3162('0x62')]({'where':{'id':_0x3dbcbe[_0x3162('0xba')]['id']},'include':_0x238eef})['then'](handleEntityNotFound(_0x39a4b8,null))['then'](function(_0x471d89){if(_0x471d89){var _0x4f536c=_0x471d89['get']({'plain':!![]});fs[_0x3162('0x116')](_0xe47f9b);var _0x3d15ec={'format':'A4','border':_0x3162('0x117'),'header':{'height':_0x3162('0x118'),'contents':{'first':_0x3162('0x119')}},'footer':{'height':_0x3162('0x11a'),'contents':{'default':util[_0x3162('0xde')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x3162('0xde')]('%s\x20#%d',_0x3162('0x11b'),_0x4f536c['id']),moment()[_0x3162('0xde')](_0x3162('0x11c'))[_0x3162('0x9f')]())}}};var _0x6023bd={'channel':_0x3162('0x11b'),'account':_0x4f536c['Account'][_0x3162('0x37')],'agent':_0x4f536c[_0x3162('0x115')]?_0x4f536c[_0x3162('0x115')]['fullname']:_0x3162('0x11d'),'createdAt':moment(_0x4f536c[_0x3162('0x7a')])[_0x3162('0xde')](_0x3162('0x11e'))[_0x3162('0x9f')](),'closedAt':_0x4f536c['closed']?moment(_0x4f536c['closedAt'])[_0x3162('0xde')](_0x3162('0x11e'))['toString']():'','disposition':_0x4f536c[_0x3162('0xce')],'chatInfo':{'browser':_0x4f536c[_0x3162('0x11f')],'os':_0x4f536c[_0x3162('0x120')],'referer':_0x4f536c[_0x3162('0x121')],'customerIp':_0x4f536c['customerIp'],'customerPort':_0x4f536c['customerPort']?_0x4f536c[_0x3162('0x122')]:_0x3162('0x11d')},'messages':_(_0x4f536c[_0x3162('0xe2')])[_0x3162('0x123')]()['filter']({'secret':![]})[_0x3162('0x3e')](function(_0x42ce41){if(_0x42ce41[_0x3162('0xd6')]){var _0x5c2208=path[_0x3162('0x10d')](_0x41500b,_0x42ce41[_0x3162('0xd6')][_0x3162('0xd2')]);if(fs[_0x3162('0x124')](_0x5c2208)){fs[_0x3162('0x125')](_0x5c2208)[_0x3162('0x126')](fs[_0x3162('0x127')](path[_0x3162('0x10d')](_0xe47f9b,_0x42ce41[_0x3162('0xd6')][_0x3162('0xd2')])));}}return{'date':moment(_0x42ce41['createdAt'])[_0x3162('0xde')](_0x3162('0x11e'))[_0x3162('0x9f')](),'sender':_0x42ce41[_0x3162('0x113')]===_0x3162('0xc6')?_0x42ce41[_0x3162('0x71')]?_0x42ce41['User'][_0x3162('0xec')]:_0x3162('0xe6'):_0x42ce41[_0x3162('0x66')]['firstName']+(_0x42ce41[_0x3162('0x66')][_0x3162('0x112')]?'\x20'+_0x42ce41[_0x3162('0x66')][_0x3162('0x112')]:''),'body':_0x42ce41[_0x3162('0xd6')]?_0x42ce41[_0x3162('0xd6')][_0x3162('0xd2')]:_0x42ce41[_0x3162('0x75')],'direction':_0x42ce41[_0x3162('0x113')]==='out'?'A':'C','secret':_0x42ce41[_0x3162('0xef')],'read':_0x42ce41['read'],'attachment':_0x42ce41[_0x3162('0xd6')]};})['value']()};return ejs[_0x3162('0x128')](path[_0x3162('0x10d')](config[_0x3162('0xda')],_0x3162('0x129'),'views',_0x3162('0x12a')),{'interaction':_0x6023bd})['then'](function(_0x4d23a9){return new BPromise(function(_0x549a4b,_0x25b697){pdf[_0x3162('0xb8')](_0x4d23a9,_0x3d15ec)[_0x3162('0x12b')](path[_0x3162('0x10d')](_0xe47f9b,'transcript-'+_0x4f536c['id']+'-'+_0x4f9c36+_0x3162('0x12c')),function(_0x8d17c4,_0x52718f){if(_0x8d17c4)return _0x25b697(_0x8d17c4);_0x549a4b(_0x52718f);});});})[_0x3162('0x35')](function(){return new BPromise(function(_0x4ca74a,_0xe54261){zipdir(_0xe47f9b,{'saveTo':_0x478f9f},function(_0x5964b7,_0x19f1d6){if(_0x5964b7)return _0xe54261(_0x5964b7);return _0x4ca74a(_0x19f1d6);});})['then'](function(){return new BPromise(function(_0x4716b2,_0x5b89b7){rimraf(_0xe47f9b,function(_0x1be91b){if(_0x1be91b)_0x5b89b7(_0x1be91b);return _0x4716b2();});});})[_0x3162('0x35')](function(){return _0x39a4b8[_0x3162('0xd9')](_0x478f9f,_0x4f3266,function(_0x8922b5){if(_0x8922b5){console[_0x3162('0x12d')](_0x3162('0x12e'),_0x8922b5);}else{fs[_0x3162('0x12f')](_0x478f9f);}});});});}else{return _0x39a4b8[_0x3162('0x2c')](0xc8);}})[_0x3162('0x2b')](handleError(_0x39a4b8,null));}; \ No newline at end of file +var _0xacf4=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','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','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','forEach','ChatWebsiteId','concat','$gte','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\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.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','push','all','rows','show','params','intersection','include','options','create','body','update','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','download','root','server/files/attachments/','close','mailTranscript','join','server/files/chat/upload/','format','transcript-%s.txt','now','ChatMessage','Messages','CmContact','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','agent_fullname','createdAt','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','auth','sendMail','\x22%s\x22\x20<%s>','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','includeAll','addTags','setTags','spread','findAll','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','firstName','lastName','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Chat','Owner','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','customerPort','tail','createReadStream','pipe','createWriteStream','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatInteraction.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~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','stack','name','send','Users','map','fullname','TagIds','Tags','split','catch','index','ChatInteraction','rawAttributes','key','model','query','keys','filters','fields'];(function(_0x4efd2c,_0x297230){var _0x2d6995=function(_0x405fc8){while(--_0x405fc8){_0x4efd2c['push'](_0x4efd2c['shift']());}};_0x2d6995(++_0x297230);}(_0xacf4,0xe7));var _0x4acf=function(_0x3d73c1,_0x29b1f4){_0x3d73c1=_0x3d73c1-0x0;var _0x1a0f7f=_0xacf4[_0x3d73c1];return _0x1a0f7f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4acf('0x0'));var zipdir=require(_0x4acf('0x1'));var jsonpatch=require(_0x4acf('0x2'));var rp=require(_0x4acf('0x3'));var moment=require(_0x4acf('0x4'));var BPromise=require(_0x4acf('0x5'));var Mustache=require(_0x4acf('0x6'));var util=require('util');var path=require(_0x4acf('0x7'));var sox=require(_0x4acf('0x8'));var csv=require('to-csv');var ejs=require(_0x4acf('0x9'));var fs=require('fs');var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4acf('0x15')](config[_0x4acf('0x16')],{'host':_0x4acf('0x17'),'port':0x18eb});var socket=require(_0x4acf('0x18'))(new Redis(config[_0x4acf('0x16')]));require(_0x4acf('0x19'))[_0x4acf('0x1a')](socket);var jayson=require(_0x4acf('0x1b'));var client=jayson[_0x4acf('0x1c')][_0x4acf('0x1d')]({'port':0x232b});var client9004=jayson[_0x4acf('0x1c')]['http']({'port':0x232c});function checkPasswordPattern(_0x1b584a,_0x57d8e0,_0x34cec1){if(_0x34cec1){var _0x4041c8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4041c8[_0x4acf('0x1e')](_0x57d8e0)){return _0x1b584a;}else{throw new db['Sequelize']['ValidationError'](_0x4acf('0x1f'));}}else{return _0x1b584a;}}function respondWithRpcPromise(_0x40cb8d,_0x240c00,_0x4b1d93,_0x2a678b){return new BPromise(function(_0x137302,_0x30d289){var _0x8b55f8=_0x2a678b||client;return _0x8b55f8[_0x4acf('0x20')](_0x40cb8d,_0x4b1d93)[_0x4acf('0x21')](function(_0x2049ba){logger[_0x4acf('0x22')](_0x4acf('0x23'),_0x240c00,_0x4acf('0x24'));logger[_0x4acf('0x25')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x240c00,_0x4acf('0x24'),JSON[_0x4acf('0x26')](_0x2049ba));if(_0x2049ba['error']){if(_0x2049ba[_0x4acf('0x27')][_0x4acf('0x28')]===0x1f4){logger['error'](_0x4acf('0x23'),_0x240c00,_0x2049ba[_0x4acf('0x27')][_0x4acf('0x29')]);return _0x30d289(_0x2049ba[_0x4acf('0x27')]['message']);}logger[_0x4acf('0x27')](_0x4acf('0x23'),_0x240c00,_0x2049ba['error'][_0x4acf('0x29')]);return _0x137302(_0x2049ba[_0x4acf('0x27')]['message']);}else{logger[_0x4acf('0x22')](_0x4acf('0x23'),_0x240c00,_0x4acf('0x24'));_0x137302(_0x2049ba[_0x4acf('0x2a')]['message']);}})['catch'](function(_0x17a756){logger[_0x4acf('0x27')](_0x4acf('0x23'),_0x240c00,_0x17a756);_0x30d289(_0x17a756);});});}function respondWithStatusCode(_0x42c90c,_0x14086c){_0x14086c=_0x14086c||0xcc;return function(_0x1b4da6){if(_0x1b4da6){return _0x42c90c[_0x4acf('0x2b')](_0x14086c);}return _0x42c90c[_0x4acf('0x2c')](_0x14086c)[_0x4acf('0x2d')]();};}function respondWithResult(_0x2a3830,_0x57989e){_0x57989e=_0x57989e||0xc8;return function(_0x3521c2){if(_0x3521c2){return _0x2a3830[_0x4acf('0x2c')](_0x57989e)[_0x4acf('0x2e')](_0x3521c2);}};}function respondWithFilteredResult(_0x2a5db3,_0x252cf1){return function(_0x28570f){if(_0x28570f){var _0x27384c=_0x28570f[_0x4acf('0x2f')],_0x5d862f=_0x252cf1['offset'],_0x337b3c=_0x252cf1[_0x4acf('0x30')]+_0x252cf1[_0x4acf('0x31')],_0x1d221b;if(_0x337b3c>=_0x27384c){_0x337b3c=_0x27384c;_0x1d221b=0xc8;}else{_0x1d221b=0xce;}_0x2a5db3[_0x4acf('0x2c')](_0x1d221b);return _0x2a5db3[_0x4acf('0x32')]('Content-Range',_0x5d862f+'-'+_0x337b3c+'/'+_0x27384c)[_0x4acf('0x2e')](_0x28570f);}return null;};}function patchUpdates(_0x1bf97e){return function(_0x3f9990){try{jsonpatch['apply'](_0x3f9990,_0x1bf97e,!![]);}catch(_0x31fbce){return BPromise[_0x4acf('0x33')](_0x31fbce);}return _0x3f9990[_0x4acf('0x34')]();};}function saveUpdates(_0x3bb129,_0xd221b7){return function(_0x152d1c){if(_0x152d1c){return _0x152d1c['update'](_0x3bb129)[_0x4acf('0x21')](function(_0x25748e){return _0x25748e;});}return null;};}function removeEntity(_0x550bd6,_0xfd8ab5){return function(_0x543a37){if(_0x543a37){return _0x543a37['destroy']()['then'](function(){_0x550bd6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x562fdc,_0x4a8b5a){return function(_0x3364dd){if(!_0x3364dd){_0x562fdc[_0x4acf('0x2b')](0x194);}return _0x3364dd;};}function handleError(_0x5d6741,_0x13a10e){_0x13a10e=_0x13a10e||0x1f4;return function(_0xbd0f92){logger[_0x4acf('0x27')](_0xbd0f92[_0x4acf('0x35')]);if(_0xbd0f92[_0x4acf('0x36')]){delete _0xbd0f92[_0x4acf('0x36')];}_0x5d6741[_0x4acf('0x2c')](_0x13a10e)[_0x4acf('0x37')](_0xbd0f92);};}function getInteractionUsers(_0x24465b,_0x372bab){return new BPromise(function(_0x4be786,_0x5c449d){try{if(_0x372bab[_0x24465b['id']]){_0x24465b[_0x4acf('0x38')]=_[_0x4acf('0x39')](_0x372bab[_0x24465b['id']],function(_0x4859b6){return{'id':_0x4859b6['id'],'fullname':_0x4859b6[_0x4acf('0x3a')]};});}}catch(_0x40455d){_0x5c449d(_0x40455d);}_0x4be786(_0x24465b);});}function getInteractionTags(_0x43a2ea,_0x3e5d98){return new BPromise(function(_0x556080,_0x528550){try{if(_0x43a2ea[_0x4acf('0x3b')]){_0x43a2ea[_0x4acf('0x3c')]=[];_0x43a2ea[_0x4acf('0x3b')][_0x4acf('0x3d')](',')['forEach'](function(_0x1a1535){_0x43a2ea[_0x4acf('0x3c')]['push'](_0x3e5d98[_0x1a1535]);});}delete _0x43a2ea['TagIds'];}catch(_0x55216a){_0x528550(_0x55216a);}_0x556080(_0x43a2ea);});}function updateChatInteraction(_0x544fe9,_0x1e1f9c,_0x17e5b6){return new BPromise(function(_0x208af3,_0x54e756){return getInteractionUsers(_0x544fe9,_0x17e5b6)[_0x4acf('0x21')](function(_0x3b6574){return getInteractionTags(_0x3b6574,_0x1e1f9c);})[_0x4acf('0x21')](function(_0x3dc9e2){_0x208af3(_0x3dc9e2);})[_0x4acf('0x3e')](function(_0xea75e4){_0x54e756(_0xea75e4);});});}exports[_0x4acf('0x3f')]=function(_0x17d5e9,_0x461547){var _0x3b8cfa={},_0x25d84c={},_0x48be1c={'count':0x0,'rows':[]};var _0x256145=_[_0x4acf('0x39')](db[_0x4acf('0x40')][_0x4acf('0x41')],function(_0xf5ebe3){return{'name':_0xf5ebe3['fieldName'],'type':_0xf5ebe3['type'][_0x4acf('0x42')]};});_0x25d84c[_0x4acf('0x43')]=_[_0x4acf('0x39')](_0x256145,_0x4acf('0x36'));_0x25d84c[_0x4acf('0x44')]=_[_0x4acf('0x45')](_0x17d5e9['query']);_0x25d84c[_0x4acf('0x46')]=_['intersection'](_0x25d84c[_0x4acf('0x43')],_0x25d84c[_0x4acf('0x44')]);_0x3b8cfa['attributes']=_['intersection'](_0x25d84c[_0x4acf('0x43')],qs[_0x4acf('0x47')](_0x17d5e9[_0x4acf('0x44')][_0x4acf('0x47')]));_0x3b8cfa['attributes']=_0x3b8cfa[_0x4acf('0x48')][_0x4acf('0x49')]?_0x3b8cfa[_0x4acf('0x48')]:_0x25d84c[_0x4acf('0x43')];if(!_0x17d5e9[_0x4acf('0x44')][_0x4acf('0x4a')](_0x4acf('0x4b'))){_0x3b8cfa[_0x4acf('0x31')]=qs['limit'](_0x17d5e9['query'][_0x4acf('0x31')]);_0x3b8cfa[_0x4acf('0x30')]=qs[_0x4acf('0x30')](_0x17d5e9[_0x4acf('0x44')][_0x4acf('0x30')]);}_0x3b8cfa[_0x4acf('0x4c')]=qs[_0x4acf('0x4d')](_0x17d5e9[_0x4acf('0x44')][_0x4acf('0x4d')]);_0x3b8cfa[_0x4acf('0x4e')]=qs[_0x4acf('0x46')](_[_0x4acf('0x4f')](_0x17d5e9['query'],_0x25d84c[_0x4acf('0x46')]),_0x256145);var _0x3a09bc=[];var _0x3e8e6f=squel[_0x4acf('0x50')]()[_0x4acf('0x51')]('id')[_0x4acf('0x51')](_0x4acf('0x36'))[_0x4acf('0x51')](_0x4acf('0x52'))[_0x4acf('0x53')](_0x4acf('0x54'));var _0x3ad746=squel[_0x4acf('0x50')]()[_0x4acf('0x51')](_0x4acf('0x55'))[_0x4acf('0x51')]('u.fullname')[_0x4acf('0x51')](_0x4acf('0x56'))[_0x4acf('0x53')]('user_has_chat_interactions','ui')[_0x4acf('0x57')](_0x4acf('0x58'),'u',_0x4acf('0x59'));var _0x3cf3df=squel['select']()['from']('chat_interactions','i')[_0x4acf('0x57')](_0x4acf('0x5a'),'c',_0x4acf('0x5b'))['left_join'](_0x4acf('0x58'),'o',_0x4acf('0x5c'))['left_join'](_0x4acf('0x5d'),'a',_0x4acf('0x5e'))[_0x4acf('0x57')](_0x4acf('0x5f'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x4acf('0x57')](_0x4acf('0x60'),'it',_0x4acf('0x61'))[_0x4acf('0x57')]('tools_tags','t',_0x4acf('0x62'));var _0x536f3e=squel[_0x4acf('0x63')]();var _0x4bc18f=[];var _0x41afd2=squel[_0x4acf('0x63')]();var _0x44561c;if(_0x17d5e9[_0x4acf('0x44')]['search']){_0x44561c=as['parseSearch'](_0x17d5e9['query'][_0x4acf('0x64')]);var _0x5a2ac6=_0x44561c['sqlOperator'];for(var _0x312729=0x0;_0x312729<_0x44561c[_0x4acf('0x65')]['length'];_0x312729++){var _0xd6a3b2=_0x44561c[_0x4acf('0x65')][_0x312729];var _0x4bebb2='i';var _0x2707a9=_[_0x4acf('0x66')](_0x256145,[_0x4acf('0x36'),_0xd6a3b2['field']]);if(!_0x2707a9){switch(_0xd6a3b2[_0x4acf('0x51')]){case _0x4acf('0x67'):if(_0xd6a3b2[_0x4acf('0x68')]==0x1){_0x3cf3df[_0x4acf('0x69')]('`'+_0xd6a3b2['field']+_0x4acf('0x6a'));}else{_0x3cf3df[_0x4acf('0x69')]('`'+_0xd6a3b2[_0x4acf('0x51')]+'`\x20>\x200');}break;case _0x4acf('0x6b'):if(_0xd6a3b2[_0x4acf('0x6c')]===_0x4acf('0x6d')){if(_0xd6a3b2[_0x4acf('0x68')][_0x4acf('0x3d')]('\x20')[_0x4acf('0x49')]>0x1){_0x536f3e[_0x5a2ac6](_0x4acf('0x6e'),qs[_0x4acf('0x6f')](_0xd6a3b2[_0x4acf('0x68')]),null);}else{var _0x31c8dd='%'+_0xd6a3b2[_0x4acf('0x68')]+'%';_0x536f3e[_0x5a2ac6](_0x4acf('0x70'),_0x31c8dd,_0x31c8dd,_0x31c8dd);}}else{_0x2707a9=_[_0x4acf('0x66')](_0x256145,[_0x4acf('0x36'),_0x4acf('0x71')]);_0xd6a3b2['field']=_0x4acf('0x71');_0x46330f=as[_0x4acf('0x72')](_0x4bebb2,_0x2707a9[_0x4acf('0x73')],_0xd6a3b2);_0x536f3e[_0x5a2ac6](_0x46330f[_0x4acf('0x74')],_0x46330f[_0x4acf('0x68')][_0x4acf('0x75')],_0x46330f[_0x4acf('0x68')][_0x4acf('0x2d')]);}break;case'Tag':var _0x540dd5=_0xd6a3b2[_0x4acf('0x68')]['split'](',')[_0x4acf('0x39')](function(_0x4bfd3c){return Number(_0x4bfd3c);});_0x540dd5['forEach'](function(_0x544b08){_0x41afd2['or'](_0x4acf('0x76'),'%,'+_0x544b08+',%');});_0x4bc18f=_[_0x4acf('0x77')](_0x4bc18f,_0x540dd5);break;case _0x4acf('0x78'):if(_0xd6a3b2[_0x4acf('0x6c')]===_0x4acf('0x6d')){_0x536f3e[_0x5a2ac6](_0x4acf('0x79'),'%'+_0xd6a3b2['value']+'%',null);}else{_0x2707a9=_['find'](_0x256145,['name',_0x4acf('0x7a')]);_0xd6a3b2[_0x4acf('0x51')]=_0x4acf('0x7a');_0x46330f=as['buildExpression'](_0x4bebb2,_0x2707a9[_0x4acf('0x73')],_0xd6a3b2);_0x536f3e[_0x5a2ac6](_0x46330f[_0x4acf('0x74')],_0x46330f[_0x4acf('0x68')][_0x4acf('0x75')],_0x46330f[_0x4acf('0x68')][_0x4acf('0x2d')]);}break;case'body':_0x46330f=as[_0x4acf('0x72')]('me',null,_0xd6a3b2);_0x536f3e[_0x5a2ac6](_0x46330f['text'],_0x46330f[_0x4acf('0x68')][_0x4acf('0x75')],_0x46330f[_0x4acf('0x68')][_0x4acf('0x2d')]);break;}}else{var _0x46330f=as[_0x4acf('0x72')](_0x4bebb2,_0x2707a9[_0x4acf('0x73')],_0xd6a3b2);_0x536f3e[_0x5a2ac6](_0x46330f[_0x4acf('0x74')],_0x46330f[_0x4acf('0x68')][_0x4acf('0x75')],_0x46330f[_0x4acf('0x68')][_0x4acf('0x2d')]);}}}else{var _0x5d4a28=_(_0x17d5e9[_0x4acf('0x44')])[_0x4acf('0x45')]()[_0x4acf('0x39')](function(_0x155456){return _[_0x4acf('0x7b')](_0x256145,[_0x4acf('0x36'),_0x155456])?_0x155456:undefined;})[_0x4acf('0x7c')]()[_0x4acf('0x68')]();if(!_[_0x4acf('0x7d')](_0x5d4a28)){_0x5d4a28[_0x4acf('0x7e')](function(_0x59b4e3){if(_0x59b4e3===_0x4acf('0x7f')){_0x3cf3df[_0x4acf('0x4e')]('i.ChatWebsiteId\x20IN\x20?',[][_0x4acf('0x80')](_0x17d5e9[_0x4acf('0x44')][_0x59b4e3]));}else if(_0x59b4e3==='createdAt'){var _0x1fbf31=JSON['parse'](_0x17d5e9['query'][_0x59b4e3])[_0x4acf('0x81')];var _0x50bc20=JSON[_0x4acf('0x82')](_0x17d5e9[_0x4acf('0x44')][_0x59b4e3])[_0x4acf('0x83')];_0x3cf3df[_0x4acf('0x4e')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1fbf31,_0x50bc20);}else{if(_0x17d5e9[_0x4acf('0x44')][_0x59b4e3]===_0x4acf('0x84')){_0x3cf3df['where']('i.'+_0x59b4e3+'\x20IS\x20NULL');}else{_0x3cf3df['where']('i.'+_0x59b4e3+_0x4acf('0x85'),_0x17d5e9['query'][_0x59b4e3]);}}});}if(_0x17d5e9[_0x4acf('0x44')][_0x4acf('0x86')]){if(_0x17d5e9[_0x4acf('0x44')]['read']==0x1){_0x3cf3df[_0x4acf('0x69')](_0x4acf('0x87'));}else{_0x3cf3df['having'](_0x4acf('0x88'));}}if(_0x17d5e9[_0x4acf('0x44')]['tag']){_0x4bc18f=_[_0x4acf('0x89')](_0x17d5e9[_0x4acf('0x44')][_0x4acf('0x8a')])?_0x17d5e9[_0x4acf('0x44')][_0x4acf('0x8a')]:new Array(_0x17d5e9[_0x4acf('0x44')]['tag']);_0x4bc18f[_0x4acf('0x7e')](function(_0x59a1e8){_0x41afd2['or'](_0x4acf('0x76'),'%,'+_0x59a1e8+',%');});}if(_0x17d5e9[_0x4acf('0x44')]['filter']){var _0x51d683=_0x17d5e9['query'][_0x4acf('0x8b')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x4acf('0x8c')](_0x51d683)){_0x536f3e['or']('i.id\x20LIKE\x20?',_0x51d683+'%');}else{_0x536f3e['or'](_0x4acf('0x8d'),qs[_0x4acf('0x6f')](_0x51d683))['or'](_0x4acf('0x8e'),_0x51d683+'%');}}}_0x3cf3df[_0x4acf('0x4e')](_0x536f3e);_0x3cf3df[_0x4acf('0x8f')]('i.id');var _0x4a444b={'type':db[_0x4acf('0x90')][_0x4acf('0x91')][_0x4acf('0x92')],'raw':!![]};var _0x8b52d3=_0x3cf3df[_0x4acf('0x93')]();_0x8b52d3['field'](_0x4acf('0x94'));_0x8b52d3[_0x4acf('0x51')](_0x4acf('0x95'),_0x4acf('0x67'));if(_0x3b8cfa[_0x4acf('0x4c')]){_0x3b8cfa[_0x4acf('0x4c')][_0x4acf('0x7e')](function(_0x5b3925){_0x3cf3df[_0x4acf('0x4c')]('i.'+_0x5b3925[0x0],_0x5b3925[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4acf('0x7d')](_0x4bc18f)){_0x3cf3df[_0x4acf('0x69')](_0x41afd2);_0x8b52d3[_0x4acf('0x4e')](_0x4acf('0x96'),_0x4bc18f);}BPromise[_0x4acf('0x97')]()['then'](function(){if(!_0x44561c){if(_0x17d5e9[_0x4acf('0x44')]['ChatWebsiteId']||_0x17d5e9[_0x4acf('0x44')][_0x4acf('0x98')])return;_0x8b52d3['where'](_0x4acf('0x99'));_0x3cf3df[_0x4acf('0x4e')](_0x4acf('0x99'));return;}return _0x17d5e9[_0x4acf('0x9a')][_0x4acf('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x203f59){if(_['isEmpty'](_0x203f59)){_0x8b52d3['where'](_0x4acf('0x9c'));_0x3cf3df[_0x4acf('0x4e')](_0x4acf('0x9c'));}else{_0x8b52d3[_0x4acf('0x4e')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x203f59,'id'));_0x3cf3df[_0x4acf('0x4e')](_0x4acf('0x9d'),_[_0x4acf('0x39')](_0x203f59,'id'));}});})[_0x4acf('0x21')](function(){db[_0x4acf('0x9e')][_0x4acf('0x44')](_0x8b52d3[_0x4acf('0x9f')](),_0x4a444b)[_0x4acf('0x21')](function(_0x57f0fa){_0x48be1c['count']=_0x57f0fa[_0x4acf('0x49')];if(_0x48be1c[_0x4acf('0x2f')]===0x0)return[];return db[_0x4acf('0x9e')][_0x4acf('0x44')](_0x3e8e6f[_0x4acf('0x9f')](),_0x4a444b)[_0x4acf('0x21')](function(_0x40b639){_0x3a09bc=_[_0x4acf('0xa0')](_0x40b639,'id');_0x4a444b=_[_0x4acf('0xa1')](_0x4a444b,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17d5e9[_0x4acf('0x44')][_0x4acf('0x47')]){_0x3b8cfa[_0x4acf('0x48')][_0x4acf('0x7e')](function(_0x37ecd2){_0x3cf3df[_0x4acf('0x51')]('i.'+_0x37ecd2);});}else{_0x3cf3df[_0x4acf('0x51')](_0x4acf('0x95'),_0x4acf('0x67'));_0x3cf3df[_0x4acf('0x51')](_0x4acf('0xa2'),_0x4acf('0xa3'));_0x3cf3df[_0x4acf('0x51')]('a.mandatoryDisposition',_0x4acf('0xa4'));_0x3cf3df['field'](_0x4acf('0xa5'));_0x3cf3df[_0x4acf('0x51')]('c.firstName',_0x4acf('0xa6'));_0x3cf3df[_0x4acf('0x51')]('c.lastName','Contact.lastName');_0x3cf3df[_0x4acf('0x51')](_0x4acf('0xa7'),'Contact.email');_0x3cf3df['field'](_0x4acf('0xa8'),_0x4acf('0xa9'));_0x3cf3df[_0x4acf('0x51')](_0x4acf('0xaa'),'Contact.mobile');_0x3cf3df[_0x4acf('0x51')](_0x4acf('0xab'),_0x4acf('0xac'));_0x3cf3df[_0x4acf('0x51')](_0x4acf('0xad'),_0x4acf('0xae'));_0x3cf3df[_0x4acf('0x51')]('o.internal',_0x4acf('0xaf'));_0x3cf3df[_0x4acf('0x51')](_0x4acf('0xb0'),'TagIds');}if(_0x3b8cfa[_0x4acf('0x31')])_0x3cf3df[_0x4acf('0x31')](_0x3b8cfa[_0x4acf('0x31')]);if(_0x3b8cfa[_0x4acf('0x30')])_0x3cf3df[_0x4acf('0x30')](_0x3b8cfa[_0x4acf('0x30')]);return db[_0x4acf('0x9e')][_0x4acf('0x44')](_0x3cf3df['toString'](),_0x4a444b);})['then'](function(_0x575189){_0x3ad746['where']('ui.ChatInteractionId\x20IN\x20?',_[_0x4acf('0x39')](_0x575189,'id'));return db['sequelize'][_0x4acf('0x44')](_0x3ad746[_0x4acf('0x9f')](),_0x4a444b)['then'](function(_0x341f2c){var _0x14ef45=_[_0x4acf('0xb1')](_0x341f2c,_0x4acf('0xb2'));var _0x10df25=[];_0x575189[_0x4acf('0x7e')](function(_0x420beb){_0x10df25[_0x4acf('0xb3')](updateChatInteraction(_0x420beb,_0x3a09bc,_0x14ef45));});return BPromise[_0x4acf('0xb4')](_0x10df25);});});})[_0x4acf('0x21')](function(_0x2d2240){_0x48be1c[_0x4acf('0xb5')]=_0x2d2240;return _0x48be1c;})[_0x4acf('0x21')](respondWithFilteredResult(_0x461547,_0x3b8cfa));})[_0x4acf('0x3e')](handleError(_0x461547,null));};exports[_0x4acf('0xb6')]=function(_0x464421,_0x2bb524){var _0x4e6044={'raw':![],'where':{'id':_0x464421[_0x4acf('0xb7')]['id']}},_0x508337={};_0x508337[_0x4acf('0x43')]=_[_0x4acf('0x45')](db[_0x4acf('0x40')][_0x4acf('0x41')]);_0x508337[_0x4acf('0x44')]=_[_0x4acf('0x45')](_0x464421[_0x4acf('0x44')]);_0x508337[_0x4acf('0x46')]=_[_0x4acf('0xb8')](_0x508337[_0x4acf('0x43')],_0x508337[_0x4acf('0x44')]);_0x4e6044['attributes']=_['intersection'](_0x508337[_0x4acf('0x43')],qs[_0x4acf('0x47')](_0x464421[_0x4acf('0x44')][_0x4acf('0x47')]));_0x4e6044[_0x4acf('0x48')]=_0x4e6044[_0x4acf('0x48')]['length']?_0x4e6044[_0x4acf('0x48')]:_0x508337[_0x4acf('0x43')];if(_0x464421[_0x4acf('0x44')]['includeAll']){_0x4e6044[_0x4acf('0xb9')]=[{'all':!![]}];}_0x4e6044=_[_0x4acf('0xa1')]({},_0x4e6044,_0x464421[_0x4acf('0xba')]);return db[_0x4acf('0x40')][_0x4acf('0x66')](_0x4e6044)[_0x4acf('0x21')](handleEntityNotFound(_0x2bb524,null))[_0x4acf('0x21')](respondWithResult(_0x2bb524,null))[_0x4acf('0x3e')](handleError(_0x2bb524,null));};exports[_0x4acf('0xbb')]=function(_0x4eb713,_0x371ab5){return db['ChatInteraction']['create'](_0x4eb713[_0x4acf('0xbc')],{})[_0x4acf('0x21')](respondWithResult(_0x371ab5,0xc9))[_0x4acf('0x3e')](handleError(_0x371ab5,null));};exports[_0x4acf('0xbd')]=function(_0x15ae95,_0x1ab7dd){if(_0x15ae95[_0x4acf('0xbc')]['id']){delete _0x15ae95[_0x4acf('0xbc')]['id'];}return db['ChatInteraction'][_0x4acf('0x66')]({'where':{'id':_0x15ae95[_0x4acf('0xb7')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x1ab7dd,null))[_0x4acf('0x21')](saveUpdates(_0x15ae95[_0x4acf('0xbc')],null))[_0x4acf('0x21')](respondWithResult(_0x1ab7dd,null))['catch'](handleError(_0x1ab7dd,null));};exports[_0x4acf('0xbe')]=function(_0x32e690,_0x3043b3){return db[_0x4acf('0x40')][_0x4acf('0x66')]({'where':{'id':_0x32e690[_0x4acf('0xb7')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3043b3,null))['then'](removeEntity(_0x3043b3,null))[_0x4acf('0x3e')](handleError(_0x3043b3,null));};exports[_0x4acf('0xbf')]=function(_0x49848a,_0x38b796){return db[_0x4acf('0x40')][_0x4acf('0xbf')]()[_0x4acf('0x21')](respondWithResult(_0x38b796,null))['catch'](handleError(_0x38b796,null));};exports[_0x4acf('0xc0')]=function(_0x1ef291,_0x219a3c){var _0x1e2937=_0x1ef291[_0x4acf('0xb7')]['id'];var _0x22613d;var _0x2fdaea;var _0x473250;return db[_0x4acf('0x40')][_0x4acf('0xc1')]({'where':{'id':_0x1e2937}})[_0x4acf('0x21')](function(_0xc0c770){_0x22613d=_0xc0c770;return db[_0x4acf('0xc2')][_0x4acf('0xc1')]({'where':{'id':_0xc0c770[_0x4acf('0x7f')]},'attributes':['id',_0x4acf('0xc3'),'vidaooEscalation'],'raw':!![]});})[_0x4acf('0x21')](function(_0x1df00d){if(_0x1df00d&&_0x1df00d[_0x4acf('0xc3')]&&_0x1df00d[_0x4acf('0xc4')]){_0x2fdaea=_0x1df00d;var _0x1b1e3f={'rejectUnauthorized':![],'method':_0x4acf('0xc5'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x1df00d[_0x4acf('0xc3')]},'body':{'name':'MotionCWB:'+_0x1e2937},'redirect':'follow','json':!![]};return rp(_0x1b1e3f);}else{throw new db[(_0x4acf('0x90'))][(_0x4acf('0xc6'))](_0x4acf('0xc7'));}})[_0x4acf('0x21')](function(_0xbd2f3a){_0x473250=_0xbd2f3a;if(_0x473250['id']){var _0x4533c1={'body':_0x473250[_0x4acf('0xc8')],'ChatWebsiteId':_0x2fdaea['id'],'ChatInteractionId':_0x22613d['id'],'direction':_0x4acf('0xc9'),'UserId':_0x1ef291[_0x4acf('0x9a')]['id']};return db['ChatMessage'][_0x4acf('0xbb')](_0x4533c1,{});}else{throw new db[(_0x4acf('0x90'))][(_0x4acf('0xc6'))](_0x4acf('0xca'));}})[_0x4acf('0x21')](function(){return _0x22613d[_0x4acf('0xcb')]({'vidaooSessionId':_0x473250['id']});})[_0x4acf('0x21')](respondWithResult(_0x219a3c,null))[_0x4acf('0x3e')](handleError(_0x219a3c,null));};exports[_0x4acf('0xcc')]=function(_0x18c345,_0x35a108){if(_0x18c345['body']['id']){delete _0x18c345[_0x4acf('0xbc')]['id'];}return db[_0x4acf('0x40')]['find']({'where':{'id':_0x18c345[_0x4acf('0xb7')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x35a108,null))[_0x4acf('0x21')](saveUpdates(_0x18c345[_0x4acf('0xbc')],null))[_0x4acf('0x21')](respondWithResult(_0x35a108,null))[_0x4acf('0x3e')](handleError(_0x35a108,null));};exports['abandon']=function(_0x27adc1,_0x391a92,_0x529a71){if(_0x27adc1['body']['id']){delete _0x27adc1[_0x4acf('0xbc')]['id'];}return db[_0x4acf('0x40')]['find']({'where':{'id':_0x27adc1[_0x4acf('0xb7')]['id']}})['then'](function(_0xfad128){if(!_0xfad128){logger[_0x4acf('0x27')](_0x4acf('0xcd'),_0x4acf('0xce'),0x194,_0x4acf('0xcf'));_0x391a92[_0x4acf('0x2b')](0x194);}else{if(_0xfad128[_0x4acf('0x7a')]){throw new db[(_0x4acf('0x90'))][(_0x4acf('0xc6'))](_0x4acf('0xd0'));}}return _0xfad128;})[_0x4acf('0x21')](function(_0x46b433){if(_0x46b433){return _0x46b433[_0x4acf('0xbd')]({'closed':_0x27adc1[_0x4acf('0xbc')][_0x4acf('0xd1')],'disposition':_0x27adc1[_0x4acf('0xbc')][_0x4acf('0xd2')]})[_0x4acf('0x21')](function(_0x4d7baf){return _0x4d7baf;});}})[_0x4acf('0x21')](function(_0x423c75){return respondWithRpcPromise(_0x4acf('0xd3'),'abandon',_0x27adc1[_0x4acf('0xbc')],client9004);})[_0x4acf('0x21')](respondWithResult(_0x391a92,null))[_0x4acf('0x3e')](handleError(_0x391a92,null));};exports[_0x4acf('0xd4')]=function(_0x23c6dc,_0x3144c6,_0x23113f){_0x23c6dc[_0x4acf('0xbc')][_0x4acf('0x36')]=_0x23c6dc[_0x4acf('0xd5')][_0x4acf('0xd6')];_0x23c6dc[_0x4acf('0xbc')][_0x4acf('0xd7')]=_0x23c6dc[_0x4acf('0xd5')][_0x4acf('0xd8')];_0x23c6dc[_0x4acf('0xbc')][_0x4acf('0x73')]=_0x23c6dc[_0x4acf('0xd5')][_0x4acf('0xd9')];return db['Attachment']['create'](_0x23c6dc[_0x4acf('0xbc')])[_0x4acf('0x21')](respondWithResult(_0x3144c6,0xc9))[_0x4acf('0x3e')](handleError(_0x3144c6,null));};exports[_0x4acf('0xda')]=function(_0x3cbd6d,_0x4338bf,_0x182c3a){return db['ChatInteraction'][_0x4acf('0xc1')]({'where':{'id':_0x3cbd6d['params']['id']},'raw':!![]})[_0x4acf('0x21')](handleEntityNotFound(_0x4338bf,null))[_0x4acf('0x21')](function(_0x3cd12f){if(_0x3cd12f){if(_0x3cd12f[_0x4acf('0xd1')]){return _0x4338bf[_0x4acf('0x2c')](0x193)[_0x4acf('0x2e')]({'status':0x193,'message':_0x4acf('0xdb')});}return db[_0x4acf('0xdc')][_0x4acf('0xc1')]({'where':{'id':_0x3cbd6d['query'][_0x4acf('0xdd')]},'raw':!![]})['then'](handleEntityNotFound(_0x4338bf,null));}})[_0x4acf('0x21')](function(_0x2471e6){if(_0x2471e6){return _0x4338bf[_0x4acf('0xde')](path['join'](config[_0x4acf('0xdf')],_0x4acf('0xe0'),_0x2471e6[_0x4acf('0xd7')]));}})[_0x4acf('0x3e')](handleError(_0x4338bf,null));};exports[_0x4acf('0xe1')]=function(_0x349a78,_0x29a21f){var _0x468753=null;var _0x125bf2=null;var _0x3b92a1=null;var _0x40b582=null;if(_0x349a78[_0x4acf('0xbc')]['id']){delete _0x349a78['body']['id'];}if(_0x349a78['body'][_0x4acf('0xe2')]){_0x40b582=path[_0x4acf('0xe3')](config[_0x4acf('0xdf')],_0x4acf('0xe4'),util[_0x4acf('0xe5')](_0x4acf('0xe6'),Date[_0x4acf('0xe7')]()));_0x349a78[_0x4acf('0xbc')]['pathTranscript']=_0x40b582;}return db[_0x4acf('0x40')]['find']({'where':{'id':_0x349a78['params']['id']},'include':[{'model':db[_0x4acf('0xe8')],'as':_0x4acf('0xe9'),'include':[{'model':db[_0x4acf('0x78')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x29a21f,null))[_0x4acf('0x21')](saveUpdates(_0x349a78[_0x4acf('0xbc')],null))[_0x4acf('0x21')](function(_0x3ba547){if(_0x3ba547){_0x468753=_0x3ba547;return db['ChatWebsite'][_0x4acf('0x66')]({'where':{'id':_0x468753[_0x4acf('0x7f')]}});}})['then'](function(_0x19bd1c){if(_0x19bd1c){_0x3b92a1=_0x19bd1c;return db[_0x4acf('0xea')][_0x4acf('0x66')]({'where':{'id':_0x468753[_0x4acf('0x71')]}});}})[_0x4acf('0x21')](function(_0x548c74){if(_0x548c74){_0x125bf2=_0x548c74;if(_0x40b582){var _0x41c807=null;for(var _0x371f7e=0x1;_0x371f7e<_0x468753[_0x4acf('0xe9')][_0x4acf('0x49')];++_0x371f7e){_0x41c807=_0x468753['Messages'][_0x371f7e];var _0x7b6ca6=_0x41c807[_0x4acf('0x7a')]?util[_0x4acf('0xe5')](_0x4acf('0xeb'),_0x3b92a1[_0x4acf('0xec')],_0x41c807[_0x4acf('0x7a')]):'System';var _0x31daed=_0x349a78[_0x4acf('0xbc')][_0x4acf('0xed')]||util[_0x4acf('0xe5')](_0x4acf('0xeb'),_0x4acf('0xee'),_0x41c807[_0x4acf('0x71')]);switch(_0x3b92a1[_0x4acf('0xef')]){case _0x4acf('0xf0'):_0x7b6ca6=_0x41c807['UserId']?util[_0x4acf('0xe5')](_0x4acf('0xeb'),_0x3b92a1[_0x4acf('0xec')],_0x41c807['UserId']):_0x4acf('0xf1');break;case _0x4acf('0xf2'):_0x7b6ca6=_0x41c807[_0x4acf('0x7a')]?_0x41c807['User']['alias']||_0x41c807[_0x4acf('0x78')][_0x4acf('0x3a')]:_0x4acf('0xf1');break;case _0x4acf('0xf3'):_0x7b6ca6=_0x41c807[_0x4acf('0x7a')]?_0x41c807[_0x4acf('0x78')]['fullname']:_0x4acf('0xf1');break;default:_0x7b6ca6=_0x41c807[_0x4acf('0x7a')]?util['format']('%s%d',_0x3b92a1['agentAlias'],_0x41c807[_0x4acf('0x7a')]):_0x4acf('0xf1');}var _0x5b7663=util[_0x4acf('0xe5')]('[%s]\x20%s:\x20%s\x0a',moment(_0x41c807[_0x4acf('0xf4')])[_0x4acf('0xe5')]('MM/DD/YYYY\x20HH:mm:ss'),_0x41c807[_0x4acf('0xf5')]==='in'?_0x31daed:_0x7b6ca6,_0x41c807[_0x4acf('0xbc')]);if(!_0x41c807[_0x4acf('0xf6')]){fs[_0x4acf('0xf7')](_0x40b582,_0x5b7663);}}return db['MailAccount'][_0x4acf('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0x4acf('0xf8')],'as':_0x4acf('0xf9'),'raw':!![]}]});}}})[_0x4acf('0x21')](function(_0x5a10bf){if(_0x5a10bf&&_0x5a10bf['Smtp']&&_0x349a78[_0x4acf('0xbc')]){var _0x170eeb={'tls':{'rejectUnauthorized':![]}};if(_0x5a10bf[_0x4acf('0xf9')][_0x4acf('0xfa')]){_0x170eeb['service']=_0x5a10bf[_0x4acf('0xf9')]['service'];}else{_0x170eeb[_0x4acf('0xfb')]=_0x5a10bf[_0x4acf('0xf9')][_0x4acf('0xfb')];_0x170eeb['port']=_0x5a10bf[_0x4acf('0xf9')][_0x4acf('0xfc')];_0x170eeb['secure']=_0x5a10bf['Smtp'][_0x4acf('0xfd')];}if(_0x5a10bf[_0x4acf('0xf9')][_0x4acf('0xfe')]){_0x170eeb[_0x4acf('0xff')]={'user':_0x5a10bf[_0x4acf('0xf9')]['user'],'pass':_0x5a10bf[_0x4acf('0xf9')]['pass']};}return respondWithRpcPromise('SendMail',_0x4acf('0x100'),{'account':_0x170eeb,'message':{'from':util[_0x4acf('0xe5')](_0x4acf('0x101'),_0x5a10bf[_0x4acf('0x36')],_0x5a10bf[_0x4acf('0x102')]||_0x5a10bf[_0x4acf('0xf9')][_0x4acf('0x9a')]),'to':_0x349a78[_0x4acf('0xbc')][_0x4acf('0xe2')],'subject':'Mail\x20Transcript','text':util[_0x4acf('0xe5')](_0x4acf('0x103'),_0x349a78[_0x4acf('0xbc')][_0x4acf('0xe2')]),'attachments':[{'path':_0x40b582}]}})[_0x4acf('0x21')](function(){return _0x468753;})[_0x4acf('0x3e')](function(_0x396047){console['error'](_0x396047);});}else{return _0x468753;}})[_0x4acf('0x21')](respondWithStatusCode(_0x29a21f,0xc8))[_0x4acf('0x3e')](handleError(_0x29a21f,null));};exports[_0x4acf('0x104')]=function(_0x4b4152,_0x94ba70,_0x2c46b9){return db[_0x4acf('0xe8')][_0x4acf('0x66')]({'where':{'id':_0x4b4152[_0x4acf('0xb7')]['id']}})['then'](handleEntityNotFound(_0x94ba70,null))[_0x4acf('0x21')](function(_0x32f951){if(_0x32f951){return _0x32f951['addMessage'](_0x4b4152[_0x4acf('0xbc')][_0x4acf('0x105')],_[_0x4acf('0x106')](_0x4b4152['body'],[_0x4acf('0x105'),'id'])||{});}})[_0x4acf('0x21')](respondWithResult(_0x94ba70,null))[_0x4acf('0x3e')](handleError(_0x94ba70,null));};exports[_0x4acf('0x107')]=function(_0x163a41,_0x36b1e8,_0x55008a){var _0x370667={'raw':![],'where':{}};var _0x3fb99c={};var _0x3323cc={'count':0x0,'rows':[]};return db[_0x4acf('0x40')]['findOne']({'where':{'id':_0x163a41['params']['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x36b1e8,null))[_0x4acf('0x21')](function(_0x3f78cf){if(_0x3f78cf){_0x3fb99c[_0x4acf('0x43')]=_[_0x4acf('0x45')](db['ChatMessage'][_0x4acf('0x41')]);_0x3fb99c[_0x4acf('0x44')]=_[_0x4acf('0x45')](_0x163a41['query']);_0x3fb99c[_0x4acf('0x46')]=_[_0x4acf('0xb8')](_0x3fb99c[_0x4acf('0x43')],_0x3fb99c[_0x4acf('0x44')]);_0x370667[_0x4acf('0x48')]=_[_0x4acf('0xb8')](_0x3fb99c[_0x4acf('0x43')],qs[_0x4acf('0x47')](_0x163a41[_0x4acf('0x44')]['fields']));_0x370667['attributes']=_0x370667['attributes']['length']?_0x370667['attributes']:_0x3fb99c[_0x4acf('0x43')];if(!_0x163a41[_0x4acf('0x44')][_0x4acf('0x4a')](_0x4acf('0x4b'))){_0x370667[_0x4acf('0x31')]=qs[_0x4acf('0x31')](_0x163a41[_0x4acf('0x44')][_0x4acf('0x31')]);_0x370667[_0x4acf('0x30')]=qs[_0x4acf('0x30')](_0x163a41[_0x4acf('0x44')]['offset']);}_0x370667[_0x4acf('0x4c')]=qs[_0x4acf('0x4d')](_0x163a41['query'][_0x4acf('0x4d')]);_0x370667[_0x4acf('0x4e')]=qs[_0x4acf('0x46')](_[_0x4acf('0x4f')](_0x163a41[_0x4acf('0x44')],_0x3fb99c[_0x4acf('0x46')]));_0x370667[_0x4acf('0x4e')][_0x4acf('0xb2')]=_0x3f78cf['id'];if(_0x163a41[_0x4acf('0x44')][_0x4acf('0x8b')]){_0x370667[_0x4acf('0x4e')]=_[_0x4acf('0xa1')](_0x370667['where'],{'$or':_[_0x4acf('0x39')](_0x370667[_0x4acf('0x48')],function(_0x517c00){var _0x265b5f={};_0x265b5f[_0x517c00]={'$like':'%'+_0x163a41[_0x4acf('0x44')][_0x4acf('0x8b')]+'%'};return _0x265b5f;})});}if(_0x163a41[_0x4acf('0x44')]['$gte']){var _0x5aca36=_0x163a41[_0x4acf('0x44')][_0x4acf('0x81')][_0x4acf('0x3d')](',');var _0x4cff5f={};_0x4cff5f[_0x5aca36[0x0]]={'$gte':moment(_0x5aca36[0x1])[_0x4acf('0xe5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x370667[_0x4acf('0x4e')]=_[_0x4acf('0xa1')](_0x370667['where'],_0x4cff5f);}_0x370667=_[_0x4acf('0xa1')]({},_0x370667,_0x163a41['options']);return db[_0x4acf('0xe8')]['count']({'where':_0x370667[_0x4acf('0x4e')]})[_0x4acf('0x21')](function(_0x5c85b5){_0x3323cc['count']=_0x5c85b5;if(_0x163a41[_0x4acf('0x44')][_0x4acf('0x108')]){_0x370667[_0x4acf('0xb9')]=[{'all':!![]}];}return db[_0x4acf('0xe8')]['findAll'](_0x370667);})[_0x4acf('0x21')](function(_0x2a9703){_0x3323cc[_0x4acf('0xb5')]=_0x2a9703;return _0x3323cc;});}})[_0x4acf('0x21')](respondWithFilteredResult(_0x36b1e8,_0x370667))[_0x4acf('0x3e')](handleError(_0x36b1e8,null));};exports['getMyMessages']=function(_0x10bccb,_0x334d4c,_0x24979f){var _0x129787={'where':{}},_0x411e04={},_0x2649eb={'count':0x0,'rows':[]};return db[_0x4acf('0x40')][_0x4acf('0xc1')]({'where':{'id':_0x10bccb[_0x4acf('0xb7')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x334d4c,null))[_0x4acf('0x21')](function(_0x55784d){if(_0x55784d){_0x411e04[_0x4acf('0x43')]=_[_0x4acf('0x45')](db[_0x4acf('0xe8')][_0x4acf('0x41')]);_0x411e04['query']=_['keys'](_0x10bccb[_0x4acf('0x44')]);_0x411e04[_0x4acf('0x46')]=_[_0x4acf('0xb8')](_0x411e04['model'],_0x411e04[_0x4acf('0x44')]);_0x129787[_0x4acf('0x48')]=_[_0x4acf('0xb8')](_0x411e04[_0x4acf('0x43')],qs[_0x4acf('0x47')](_0x10bccb[_0x4acf('0x44')][_0x4acf('0x47')]));_0x129787['attributes']=_0x129787[_0x4acf('0x48')]['length']?_0x129787[_0x4acf('0x48')]:_0x411e04[_0x4acf('0x43')];if(!_0x10bccb[_0x4acf('0x44')][_0x4acf('0x4a')](_0x4acf('0x4b'))){_0x129787[_0x4acf('0x31')]=qs[_0x4acf('0x31')](_0x10bccb[_0x4acf('0x44')][_0x4acf('0x31')]);_0x129787[_0x4acf('0x30')]=qs[_0x4acf('0x30')](_0x10bccb[_0x4acf('0x44')][_0x4acf('0x30')]);}_0x129787[_0x4acf('0x4c')]=qs[_0x4acf('0x4d')](_0x10bccb[_0x4acf('0x44')]['sort']);_0x129787[_0x4acf('0x4e')]=qs['filters'](_[_0x4acf('0x4f')](_0x10bccb['query'],_0x411e04[_0x4acf('0x46')]));_0x129787[_0x4acf('0x4e')][_0x4acf('0xb2')]=_0x55784d['id'];if(_0x10bccb[_0x4acf('0x44')][_0x4acf('0x8b')]){_0x129787['where']=_[_0x4acf('0xa1')](_0x129787[_0x4acf('0x4e')],{'$or':_[_0x4acf('0x39')](_0x129787[_0x4acf('0x48')],function(_0x1baefe){var _0x2e7d18={};_0x2e7d18[_0x1baefe]={'$like':'%'+_0x10bccb['query'][_0x4acf('0x8b')]+'%'};return _0x2e7d18;})});}_0x129787[_0x4acf('0x4e')][_0x4acf('0xf6')]=![];if(_0x10bccb['query']['id']){_0x129787[_0x4acf('0x4e')]['id']={'$gt':_0x10bccb[_0x4acf('0x44')]['id']};}_0x129787=_[_0x4acf('0xa1')]({},_0x129787,_0x10bccb[_0x4acf('0xba')]);return db[_0x4acf('0xe8')][_0x4acf('0x2f')]({'where':_0x129787[_0x4acf('0x4e')]})[_0x4acf('0x21')](function(_0x305b5f){_0x2649eb['count']=_0x305b5f;_0x129787[_0x4acf('0xb9')]=[];if(_0x10bccb[_0x4acf('0x44')]['includeAgent']){_0x129787[_0x4acf('0xb9')][_0x4acf('0xb3')]({'model':db[_0x4acf('0x78')],'as':_0x4acf('0x78'),'attributes':['id',_0x4acf('0x3a'),'alias']});}if(_0x10bccb[_0x4acf('0x44')][_0x4acf('0x108')]){_0x129787[_0x4acf('0xb9')]=[{'all':!![]}];}return db[_0x4acf('0xe8')]['findAll'](_0x129787);})[_0x4acf('0x21')](function(_0x40742b){_0x2649eb[_0x4acf('0xb5')]=_0x40742b;return _0x2649eb;});}})[_0x4acf('0x21')](respondWithFilteredResult(_0x334d4c,_0x129787))[_0x4acf('0x3e')](handleError(_0x334d4c,null));};exports[_0x4acf('0x109')]=function(_0x54da9c,_0x12910f,_0x16a813){return db['ChatInteraction']['find']({'where':{'id':_0x54da9c[_0x4acf('0xb7')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x12910f,null))[_0x4acf('0x21')](function(_0x3e31f2){if(_0x3e31f2){return _0x3e31f2[_0x4acf('0x10a')](_0x54da9c[_0x4acf('0xbc')][_0x4acf('0x105')],_[_0x4acf('0x106')](_0x54da9c[_0x4acf('0xbc')],['ids','id'])||{})[_0x4acf('0x10b')](function(){return db['Tag'][_0x4acf('0x10c')]({'attributes':['id',_0x4acf('0x36'),_0x4acf('0x52')],'where':{'id':_0x54da9c[_0x4acf('0xbc')][_0x4acf('0x105')]}});})[_0x4acf('0x21')](function(_0x814c8b){socket[_0x4acf('0x10d')](_0x4acf('0x10e'),{'id':Number(_0x54da9c[_0x4acf('0xb7')]['id']),'tags':_0x814c8b||[]});return{'id':Number(_0x54da9c[_0x4acf('0xb7')]['id']),'tags':_0x814c8b||[]};});}})[_0x4acf('0x21')](respondWithResult(_0x12910f,null))['catch'](handleError(_0x12910f,null));};exports[_0x4acf('0x10f')]=function(_0xe861ac,_0x4babec,_0x96f8cb){return db['ChatInteraction'][_0x4acf('0x66')]({'where':{'id':_0xe861ac[_0x4acf('0xb7')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x4babec,null))[_0x4acf('0x21')](function(_0x2953a9){if(_0x2953a9){return _0x2953a9[_0x4acf('0x10f')](_0xe861ac[_0x4acf('0x44')]['ids']);}})[_0x4acf('0x21')](respondWithStatusCode(_0x4babec,null))[_0x4acf('0x3e')](handleError(_0x4babec,null));};exports[_0x4acf('0xde')]=function(_0x37b34e,_0x2de030){var _0x1c54bf=moment()[_0x4acf('0x110')]()[_0x4acf('0x9f')]();var _0x5977fa=path[_0x4acf('0xe3')](config[_0x4acf('0xdf')],_0x4acf('0x111'),_0x4acf('0x112'),_0x4acf('0x113'));var _0xb9c0ed=path[_0x4acf('0xe3')](config[_0x4acf('0xdf')],_0x4acf('0x111'),'files',_0x4acf('0x114'));var _0x32c3eb=path[_0x4acf('0xe3')](_0x5977fa,_0x1c54bf);var _0x2cc145=util[_0x4acf('0xe5')]('transcript-%d-%s.zip',_0x37b34e[_0x4acf('0xb7')]['id'],_0x1c54bf);var _0x14da1e=path[_0x4acf('0xe3')](_0x5977fa,_0x2cc145);var _0xcb51af=[];_0xcb51af[_0x4acf('0xb3')]({'model':db[_0x4acf('0x78')],'as':_0x4acf('0x78'),'attributes':['id','fullname'],'raw':!![]});_0xcb51af[_0x4acf('0xb3')]({'model':db[_0x4acf('0xea')],'as':_0x4acf('0x6b'),'attributes':['id',_0x4acf('0x115'),_0x4acf('0x116')],'raw':!![]});if(_0x37b34e[_0x4acf('0x44')][_0x4acf('0x114')]){_0xcb51af['push']({'model':db[_0x4acf('0xdc')],'as':_0x4acf('0xdc'),'raw':!![]});}var _0x508493=[{'model':db[_0x4acf('0xe8')],'as':'Messages','attributes':['id',_0x4acf('0xbc'),'createdAt',_0x4acf('0xf5'),'secret',_0x4acf('0x86')],'include':_0xcb51af}];_0x508493['push']({'model':db[_0x4acf('0xc2')],'as':_0x4acf('0x117'),'attributes':['id','name']});_0x508493[_0x4acf('0xb3')]({'model':db[_0x4acf('0x78')],'as':'Owner','attributes':['id',_0x4acf('0x3a')]});return db[_0x4acf('0x40')][_0x4acf('0x66')]({'where':{'id':_0x37b34e[_0x4acf('0xb7')]['id']},'include':_0x508493})['then'](handleEntityNotFound(_0x2de030,null))[_0x4acf('0x21')](function(_0x3ab3b9){if(_0x3ab3b9){var _0x2c6a1f=_0x3ab3b9[_0x4acf('0x118')]({'plain':!![]});fs[_0x4acf('0x119')](_0x32c3eb);var _0x36d55d={'format':'A4','border':_0x4acf('0x11a'),'header':{'height':_0x4acf('0x11b'),'contents':{'first':_0x4acf('0x11c')}},'footer':{'height':_0x4acf('0x11d'),'contents':{'default':util[_0x4acf('0xe5')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x4acf('0xe5')](_0x4acf('0x11e'),_0x4acf('0x11f'),_0x2c6a1f['id']),moment()[_0x4acf('0xe5')]('YYYY-MM-DD')[_0x4acf('0x9f')]())}}};var _0x2da930={'channel':_0x4acf('0x11f'),'account':_0x2c6a1f[_0x4acf('0x117')][_0x4acf('0x36')],'agent':_0x2c6a1f[_0x4acf('0x120')]?_0x2c6a1f[_0x4acf('0x120')][_0x4acf('0x3a')]:'N.A.','createdAt':moment(_0x2c6a1f[_0x4acf('0xf4')])[_0x4acf('0xe5')](_0x4acf('0x121'))[_0x4acf('0x9f')](),'closedAt':_0x2c6a1f[_0x4acf('0xd1')]?moment(_0x2c6a1f['closedAt'])[_0x4acf('0xe5')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2c6a1f[_0x4acf('0xd2')],'chatInfo':{'browser':_0x2c6a1f[_0x4acf('0x122')],'os':_0x2c6a1f[_0x4acf('0x123')],'referer':_0x2c6a1f['referer'],'customerIp':_0x2c6a1f['customerIp'],'customerPort':_0x2c6a1f['customerPort']?_0x2c6a1f[_0x4acf('0x124')]:'N.A.'},'messages':_(_0x2c6a1f[_0x4acf('0xe9')])[_0x4acf('0x125')]()[_0x4acf('0x8b')]({'secret':![]})[_0x4acf('0x39')](function(_0x3fdcf3){if(_0x3fdcf3[_0x4acf('0xdc')]){var _0x2e2e1f=path[_0x4acf('0xe3')](_0xb9c0ed,_0x3fdcf3[_0x4acf('0xdc')]['basename']);if(fs['existsSync'](_0x2e2e1f)){fs[_0x4acf('0x126')](_0x2e2e1f)[_0x4acf('0x127')](fs[_0x4acf('0x128')](path['join'](_0x32c3eb,_0x3fdcf3[_0x4acf('0xdc')][_0x4acf('0xd7')])));}}return{'date':moment(_0x3fdcf3['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4acf('0x9f')](),'sender':_0x3fdcf3['direction']===_0x4acf('0xc9')?_0x3fdcf3[_0x4acf('0x78')]?_0x3fdcf3['User']['fullname']:_0x4acf('0xf1'):_0x3fdcf3[_0x4acf('0x6b')][_0x4acf('0x115')]+(_0x3fdcf3[_0x4acf('0x6b')][_0x4acf('0x116')]?'\x20'+_0x3fdcf3[_0x4acf('0x6b')][_0x4acf('0x116')]:''),'body':_0x3fdcf3[_0x4acf('0xdc')]?_0x3fdcf3[_0x4acf('0xdc')][_0x4acf('0xd7')]:_0x3fdcf3[_0x4acf('0xbc')],'direction':_0x3fdcf3['direction']===_0x4acf('0xc9')?'A':'C','secret':_0x3fdcf3[_0x4acf('0xf6')],'read':_0x3fdcf3[_0x4acf('0x86')],'attachment':_0x3fdcf3[_0x4acf('0xdc')]};})[_0x4acf('0x68')]()};return ejs['renderFile'](path[_0x4acf('0xe3')](config[_0x4acf('0xdf')],_0x4acf('0x111'),'views',_0x4acf('0x129')),{'interaction':_0x2da930})[_0x4acf('0x21')](function(_0xd382b6){return new BPromise(function(_0x280d9b,_0x3b8cd5){pdf[_0x4acf('0xbb')](_0xd382b6,_0x36d55d)[_0x4acf('0x12a')](path[_0x4acf('0xe3')](_0x32c3eb,_0x4acf('0x12b')+_0x2c6a1f['id']+'-'+_0x1c54bf+'.pdf'),function(_0x5d85e1,_0xe80282){if(_0x5d85e1)return _0x3b8cd5(_0x5d85e1);_0x280d9b(_0xe80282);});});})[_0x4acf('0x21')](function(){return new BPromise(function(_0x25a59f,_0x427bf1){zipdir(_0x32c3eb,{'saveTo':_0x14da1e},function(_0x3a6b54,_0x350e00){if(_0x3a6b54)return _0x427bf1(_0x3a6b54);return _0x25a59f(_0x350e00);});})[_0x4acf('0x21')](function(){return new BPromise(function(_0x35c3d8,_0x2383d6){rimraf(_0x32c3eb,function(_0x5c3d5f){if(_0x5c3d5f)_0x2383d6(_0x5c3d5f);return _0x35c3d8();});});})['then'](function(){return _0x2de030[_0x4acf('0xde')](_0x14da1e,_0x2cc145,function(_0x5255a6){if(_0x5255a6){console[_0x4acf('0x12c')](_0x4acf('0x12d'),_0x5255a6);}else{fs[_0x4acf('0x12e')](_0x14da1e);}});});});}else{return _0x2de030[_0x4acf('0x2b')](0xc8);}})[_0x4acf('0x3e')](handleError(_0x2de030,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9c8a0de..2aedf81 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 _0xf96b=['save','update','remove','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0xf96b,0x109));var _0xbf96=function(_0x1b5bce,_0x8b2c12){_0x1b5bce=_0x1b5bce-0x0;var _0x4fb53c=_0xf96b[_0x1b5bce];return _0x4fb53c;};'use strict';var EventEmitter=require(_0xbf96('0x0'));var ChatInteraction=require(_0xbf96('0x1'))['db'][_0xbf96('0x2')];var ChatMessage=require(_0xbf96('0x1'))['db'][_0xbf96('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xbf96('0x4')](0x0);var events={'afterCreate':_0xbf96('0x5'),'afterUpdate':_0xbf96('0x6'),'afterDestroy':_0xbf96('0x7')};function emitEvent(_0x38565){return function(_0xab8e7,_0xd04324,_0x162c19){_0xab8e7['getUsers']({'attributes':['id'],'raw':!![]})[_0xbf96('0x8')](function(_0x9270ca){_0xab8e7[_0xbf96('0x9')](_0xbf96('0xa'),_0x9270ca['map'](function(_0x337087){return{'id':_0x337087['id']};}));return ChatMessage[_0xbf96('0xb')]({'where':{'ChatInteractionId':_0xab8e7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbf96('0x8')](function(_0x253863){_0xab8e7[_0xbf96('0x9')](_0xbf96('0xc'),_0x253863[_0xbf96('0xd')]);ChatInteractionEvents[_0xbf96('0xe')](_0x38565+':'+_0xab8e7['id'],_0xab8e7);ChatInteractionEvents['emit'](_0x38565,_0xab8e7);_0x162c19(null);})[_0xbf96('0xf')](_0x162c19(null));};}for(var e in events){if(events[_0xbf96('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xbf96('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x5d66=['save','then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','hook','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x3f1ad8,_0x5e0bc5){var _0xee4c33=function(_0x48acb6){while(--_0x48acb6){_0x3f1ad8['push'](_0x3f1ad8['shift']());}};_0xee4c33(++_0x5e0bc5);}(_0x5d66,0xea));var _0x65d6=function(_0x109e23,_0x2bedcd){_0x109e23=_0x109e23-0x0;var _0xd3d3cd=_0x5d66[_0x109e23];return _0xd3d3cd;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x65d6('0x0'))['db'][_0x65d6('0x1')];var ChatMessage=require(_0x65d6('0x0'))['db'][_0x65d6('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x65d6('0x3')](0x0);var events={'afterCreate':_0x65d6('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x31f008){return function(_0x1378c0,_0x5e96ec,_0x269c30){_0x1378c0['getUsers']({'attributes':['id'],'raw':!![]})[_0x65d6('0x5')](function(_0x4e51f8){_0x1378c0[_0x65d6('0x6')](_0x65d6('0x7'),_0x4e51f8[_0x65d6('0x8')](function(_0x385b7f){return{'id':_0x385b7f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1378c0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x65d6('0x5')](function(_0x4da212){_0x1378c0[_0x65d6('0x6')](_0x65d6('0x9'),_0x4da212[_0x65d6('0xa')]);ChatInteractionEvents['emit'](_0x31f008+':'+_0x1378c0['id'],_0x1378c0);ChatInteractionEvents[_0x65d6('0xb')](_0x31f008,_0x1378c0);_0x269c30(null);})['catch'](_0x269c30(null));};}for(var e in events){if(events[_0x65d6('0xc')](e)){var event=events[e];ChatInteraction[_0x65d6('0xd')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 6e3862f..1081502 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 _0x0cb9=['YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed'];(function(_0x30cb74,_0x3baf5f){var _0x1fce6f=function(_0x3e45f3){while(--_0x3e45f3){_0x30cb74['push'](_0x30cb74['shift']());}};_0x1fce6f(++_0x3baf5f);}(_0x0cb9,0xa9));var _0x90cb=function(_0x49420f,_0x453be2){_0x49420f=_0x49420f-0x0;var _0x540633=_0x0cb9[_0x49420f];return _0x540633;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x90cb('0x0'))(_0x90cb('0x1'));var moment=require(_0x90cb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x90cb('0x3'));var rimraf=require(_0x90cb('0x4'));var config=require(_0x90cb('0x5'));var attributes=require(_0x90cb('0x6'));module['exports']=function(_0x216bd3,_0x7ca819){return _0x216bd3[_0x90cb('0x7')](_0x90cb('0x8'),attributes,{'tableName':_0x90cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1b14c5,_0x154a41,_0x1e6016){if(_0x1b14c5[_0x90cb('0xa')]('closed')){_0x1b14c5['closedAt']=moment()['format'](_0x90cb('0xb'));}_0x1e6016(null,_0x1b14c5);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5dfa=['api','bluebird','request-promise','path','../../config/environment','exports','define','chat_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x1eee76,_0x5f4bcf){var _0x49f47e=function(_0x269f3c){while(--_0x269f3c){_0x1eee76['push'](_0x1eee76['shift']());}};_0x49f47e(++_0x5f4bcf);}(_0x5dfa,0x115));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa5df('0x0'));var util=require(_0xa5df('0x1'));var logger=require(_0xa5df('0x2'))(_0xa5df('0x3'));var moment=require('moment');var BPromise=require(_0xa5df('0x4'));var rp=require(_0xa5df('0x5'));var fs=require('fs');var path=require(_0xa5df('0x6'));var rimraf=require('rimraf');var config=require(_0xa5df('0x7'));var attributes=require('./chatInteraction.attributes');module[_0xa5df('0x8')]=function(_0x31e84f,_0x1f56cb){return _0x31e84f[_0xa5df('0x9')]('ChatInteraction',attributes,{'tableName':_0xa5df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45db07,_0x33298d,_0x259950){if(_0x45db07[_0xa5df('0xb')]('closed')){_0x45db07[_0xa5df('0xc')]=moment()['format'](_0xa5df('0xd'));}_0x259950(null,_0x45db07);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 828c0b5..cc6b9cc 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 _0x563d=['raw','where','attributes','limit','AddTagsToChatInteraction','find','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0x563d,0x138));var _0xd563=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0x563d[_0x189d3c];return _0x485959;};'use strict';var _=require(_0xd563('0x0'));var util=require(_0xd563('0x1'));var moment=require(_0xd563('0x2'));var BPromise=require(_0xd563('0x3'));var rs=require(_0xd563('0x4'));var fs=require('fs');var Redis=require(_0xd563('0x5'));var db=require(_0xd563('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd563('0x7'))(_0xd563('0x8'));var config=require(_0xd563('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd563('0xa')][_0xd563('0xb')]({'port':0x232a});config[_0xd563('0xc')]=_[_0xd563('0xd')](config[_0xd563('0xc')],{'host':_0xd563('0xe'),'port':0x18eb});var socket=require(_0xd563('0xf'))(new Redis(config[_0xd563('0xc')]));require('./chatInteraction.socket')[_0xd563('0x10')](socket);function respondWithRpcPromise(_0x406a7d,_0x1c78bd,_0x5eb875){return new BPromise(function(_0x4c6cd5,_0x47128b){return client['request'](_0x406a7d,_0x5eb875)[_0xd563('0x11')](function(_0x1d1fd3){logger[_0xd563('0x12')](_0xd563('0x13'),_0x1c78bd,'request\x20sent');logger[_0xd563('0x14')](_0xd563('0x15'),_0x1c78bd,'request\x20sent',JSON[_0xd563('0x16')](_0x1d1fd3));if(_0x1d1fd3[_0xd563('0x17')]){if(_0x1d1fd3[_0xd563('0x17')][_0xd563('0x18')]===0x1f4){logger[_0xd563('0x17')](_0xd563('0x13'),_0x1c78bd,_0x1d1fd3[_0xd563('0x17')][_0xd563('0x19')]);return _0x47128b(_0x1d1fd3[_0xd563('0x17')]['message']);}logger[_0xd563('0x17')](_0xd563('0x13'),_0x1c78bd,_0x1d1fd3['error'][_0xd563('0x19')]);return _0x4c6cd5(_0x1d1fd3[_0xd563('0x17')][_0xd563('0x19')]);}else{logger[_0xd563('0x12')](_0xd563('0x13'),_0x1c78bd,'request\x20sent');_0x4c6cd5(_0x1d1fd3[_0xd563('0x1a')][_0xd563('0x19')]);}})[_0xd563('0x1b')](function(_0x26b52f){logger['error'](_0xd563('0x13'),_0x1c78bd,_0x26b52f);_0x47128b(_0x26b52f);});});}exports[_0xd563('0x1c')]=function(_0x2183c3){var _0x467482=this;return new Promise(function(_0x969082,_0x26f87a){return db[_0xd563('0x1d')][_0xd563('0x1e')](_0x2183c3['body'],{'raw':_0x2183c3['options']?_0x2183c3[_0xd563('0x1f')][_0xd563('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2183c3[_0xd563('0x1f')]?_0x2183c3[_0xd563('0x1f')][_0xd563('0x21')]||null:null,'attributes':_0x2183c3['options']?_0x2183c3[_0xd563('0x1f')][_0xd563('0x22')]||null:null,'limit':_0x2183c3[_0xd563('0x1f')]?_0x2183c3[_0xd563('0x1f')][_0xd563('0x23')]||null:null})['then'](function(_0x2da4d1){logger['info']('UpdateChatInteraction',_0x2183c3);logger['debug'](_0xd563('0x1c'),_0x2183c3,JSON[_0xd563('0x16')](_0x2da4d1));_0x969082(_0x2da4d1);})[_0xd563('0x1b')](function(_0x56197c){logger['error']('UpdateChatInteraction',_0x56197c['message'],_0x2183c3);_0x26f87a(_0x467482[_0xd563('0x17')](0x1f4,_0x56197c[_0xd563('0x19')]));});});};exports[_0xd563('0x24')]=function(_0x15ddd9){return new Promise(function(_0x5e0675,_0x29718e){return db[_0xd563('0x1d')][_0xd563('0x25')]({'where':_0x15ddd9[_0xd563('0x1f')]?_0x15ddd9[_0xd563('0x1f')][_0xd563('0x21')]||null:null})[_0xd563('0x11')](function(_0x1290e4){if(_0x1290e4){return _0x1290e4['addTags'](_0x15ddd9['body'][_0xd563('0x26')],_[_0xd563('0x27')](_0x15ddd9[_0xd563('0x28')],[_0xd563('0x26'),'id'])||{});}})[_0xd563('0x29')](function(_0x260ed1){logger[_0xd563('0x12')]('AddTags',_0x15ddd9);logger[_0xd563('0x14')](_0xd563('0x2a'),_0x15ddd9,JSON[_0xd563('0x16')](_0x260ed1));_0x5e0675(_0x260ed1);})[_0xd563('0x1b')](function(_0x4e46e9){logger[_0xd563('0x17')]('AddTags',_0x4e46e9[_0xd563('0x19')],_0x15ddd9);_0x29718e(_this['error'](0x1f4,_0x4e46e9[_0xd563('0x19')]));});});}; \ No newline at end of file +var _0xe847=['error','message','info','result','catch','ChatInteraction','body','raw','options','where','attributes','limit','UpdateChatInteraction','debug','stringify','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xe847,0xf0));var _0x7e84=function(_0x1eee82,_0x926df6){_0x1eee82=_0x1eee82-0x0;var _0x2d1c12=_0xe847[_0x1eee82];return _0x2d1c12;};'use strict';var _=require(_0x7e84('0x0'));var util=require(_0x7e84('0x1'));var moment=require('moment');var BPromise=require(_0x7e84('0x2'));var rs=require(_0x7e84('0x3'));var fs=require('fs');var Redis=require(_0x7e84('0x4'));var db=require(_0x7e84('0x5'))['db'];var utils=require(_0x7e84('0x6'));var logger=require('../../config/logger')(_0x7e84('0x7'));var config=require(_0x7e84('0x8'));var jayson=require(_0x7e84('0x9'));var client=jayson[_0x7e84('0xa')][_0x7e84('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7e84('0xc')],{'host':_0x7e84('0xd'),'port':0x18eb});var socket=require(_0x7e84('0xe'))(new Redis(config[_0x7e84('0xc')]));require(_0x7e84('0xf'))['register'](socket);function respondWithRpcPromise(_0x369e33,_0x44f5dd,_0x288316){return new BPromise(function(_0x2eff81,_0x466f95){return client['request'](_0x369e33,_0x288316)[_0x7e84('0x10')](function(_0x5473da){logger['info'](_0x7e84('0x11'),_0x44f5dd,_0x7e84('0x12'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x44f5dd,_0x7e84('0x12'),JSON['stringify'](_0x5473da));if(_0x5473da[_0x7e84('0x13')]){if(_0x5473da[_0x7e84('0x13')]['code']===0x1f4){logger['error'](_0x7e84('0x11'),_0x44f5dd,_0x5473da[_0x7e84('0x13')][_0x7e84('0x14')]);return _0x466f95(_0x5473da[_0x7e84('0x13')]['message']);}logger['error'](_0x7e84('0x11'),_0x44f5dd,_0x5473da['error'][_0x7e84('0x14')]);return _0x2eff81(_0x5473da[_0x7e84('0x13')][_0x7e84('0x14')]);}else{logger[_0x7e84('0x15')](_0x7e84('0x11'),_0x44f5dd,_0x7e84('0x12'));_0x2eff81(_0x5473da[_0x7e84('0x16')][_0x7e84('0x14')]);}})[_0x7e84('0x17')](function(_0x3ee853){logger[_0x7e84('0x13')](_0x7e84('0x11'),_0x44f5dd,_0x3ee853);_0x466f95(_0x3ee853);});});}exports['UpdateChatInteraction']=function(_0x4c5444){var _0xd0fe53=this;return new Promise(function(_0x316838,_0x4fff98){return db[_0x7e84('0x18')]['update'](_0x4c5444[_0x7e84('0x19')],{'raw':_0x4c5444['options']?_0x4c5444['options'][_0x7e84('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c5444[_0x7e84('0x1b')]?_0x4c5444[_0x7e84('0x1b')][_0x7e84('0x1c')]||null:null,'attributes':_0x4c5444[_0x7e84('0x1b')]?_0x4c5444[_0x7e84('0x1b')][_0x7e84('0x1d')]||null:null,'limit':_0x4c5444['options']?_0x4c5444[_0x7e84('0x1b')][_0x7e84('0x1e')]||null:null})['then'](function(_0x2659a6){logger['info'](_0x7e84('0x1f'),_0x4c5444);logger[_0x7e84('0x20')]('UpdateChatInteraction',_0x4c5444,JSON[_0x7e84('0x21')](_0x2659a6));_0x316838(_0x2659a6);})[_0x7e84('0x17')](function(_0x4af2e8){logger[_0x7e84('0x13')](_0x7e84('0x1f'),_0x4af2e8[_0x7e84('0x14')],_0x4c5444);_0x4fff98(_0xd0fe53[_0x7e84('0x13')](0x1f4,_0x4af2e8[_0x7e84('0x14')]));});});};exports['AddTagsToChatInteraction']=function(_0x447ad2){return new Promise(function(_0x2dbd3a,_0x4e647c){return db[_0x7e84('0x18')]['find']({'where':_0x447ad2[_0x7e84('0x1b')]?_0x447ad2[_0x7e84('0x1b')][_0x7e84('0x1c')]||null:null})['then'](function(_0x408605){if(_0x408605){return _0x408605['addTags'](_0x447ad2[_0x7e84('0x19')][_0x7e84('0x22')],_[_0x7e84('0x23')](_0x447ad2[_0x7e84('0x19')],['ids','id'])||{});}})['spread'](function(_0x216c8d){logger['info'](_0x7e84('0x24'),_0x447ad2);logger[_0x7e84('0x20')](_0x7e84('0x24'),_0x447ad2,JSON[_0x7e84('0x21')](_0x216c8d));_0x2dbd3a(_0x216c8d);})[_0x7e84('0x17')](function(_0x416949){logger[_0x7e84('0x13')](_0x7e84('0x24'),_0x416949[_0x7e84('0x14')],_0x447ad2);_0x4e647c(_this[_0x7e84('0x13')](0x1f4,_0x416949[_0x7e84('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1dd1b52..fe8170c 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 _0x7421=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x6c01fc,_0x49da43){var _0x4f6c39=function(_0x4a8b04){while(--_0x4a8b04){_0x6c01fc['push'](_0x6c01fc['shift']());}};_0x4f6c39(++_0x49da43);}(_0x7421,0xe9));var _0x1742=function(_0x22cbfc,_0x2b9ec8){_0x22cbfc=_0x22cbfc-0x0;var _0x441883=_0x7421[_0x22cbfc];return _0x441883;};'use strict';var ChatInteractionEvents=require(_0x1742('0x0'));var events=[_0x1742('0x1'),_0x1742('0x2'),_0x1742('0x3')];function createListener(_0x5a7422,_0xd60d8c){return function(_0x54781d){_0xd60d8c[_0x1742('0x4')](_0x5a7422,_0x54781d);};}function removeListener(_0x2a6346,_0x248fb0){return function(){ChatInteractionEvents[_0x1742('0x5')](_0x2a6346,_0x248fb0);};}exports[_0x1742('0x6')]=function(_0x3ae76c){for(var _0x4166df=0x0,_0x4f1b59=events[_0x1742('0x7')];_0x4166df<_0x4f1b59;_0x4166df++){var _0x459994=events[_0x4166df];var _0x265c00=createListener('chatInteraction:'+_0x459994,_0x3ae76c);ChatInteractionEvents['on'](_0x459994,_0x265c00);}}; \ No newline at end of file +var _0x13e3=['update','emit','removeListener','register','length','chatInteraction:','save','remove'];(function(_0x3814f4,_0x3b1758){var _0x235887=function(_0x42e145){while(--_0x42e145){_0x3814f4['push'](_0x3814f4['shift']());}};_0x235887(++_0x3b1758);}(_0x13e3,0x196));var _0x313e=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x13e3[_0x725b8e];return _0x43ac45;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x313e('0x0'),_0x313e('0x1'),_0x313e('0x2')];function createListener(_0x2529c1,_0x194aba){return function(_0x5823e0){_0x194aba[_0x313e('0x3')](_0x2529c1,_0x5823e0);};}function removeListener(_0x88ea23,_0x42eb24){return function(){ChatInteractionEvents[_0x313e('0x4')](_0x88ea23,_0x42eb24);};}exports[_0x313e('0x5')]=function(_0x23cf36){for(var _0x2cacde=0x0,_0x1963fb=events[_0x313e('0x6')];_0x2cacde<_0x1963fb;_0x2cacde++){var _0x317672=events[_0x2cacde];var _0x1235f2=createListener(_0x313e('0x7')+_0x317672,_0x23cf36);ChatInteractionEvents['on'](_0x317672,_0x1235f2);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1dc18de..cb0477a 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 _0x693f=['delete','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/my_messages','isChatInteractionAuthorized','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','close'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var path=require(_0xf693('0x2'));var timeout=require(_0xf693('0x3'));var express=require('express');var router=express[_0xf693('0x4')]();var auth=require(_0xf693('0x5'));var interaction=require(_0xf693('0x6'));var config=require(_0xf693('0x7'));var controller=require(_0xf693('0x8'));router[_0xf693('0x9')]('/',auth[_0xf693('0xa')](),controller['index']);router[_0xf693('0x9')](_0xf693('0xb'),auth['isAuthenticated'](),controller[_0xf693('0xc')]);router['get'](_0xf693('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xf693('0xe')]);router[_0xf693('0x9')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0xf693('0x9')]('/:id/messages',auth[_0xf693('0xa')](),controller[_0xf693('0xf')]);router[_0xf693('0x9')](_0xf693('0x10'),auth[_0xf693('0x11')](),controller['getMyMessages']);router['get'](_0xf693('0x12'),auth[_0xf693('0xa')](),controller['download']);router[_0xf693('0x13')]('/',auth[_0xf693('0xa')](),controller['create']);router['post'](_0xf693('0x14'),auth[_0xf693('0xa')](),controller[_0xf693('0x15')]);var upload=multer({'storage':multer[_0xf693('0x16')]({'destination':function(_0x36d92c,_0x5541a7,_0x1d9278){_0x1d9278(null,path[_0xf693('0x17')](config[_0xf693('0x18')],_0xf693('0x19')));},'filename':function(_0x345539,_0x19ea07,_0x49fbbb){_0x49fbbb(null,util['format']('%s-%s',Date[_0xf693('0x1a')](),_0x19ea07[_0xf693('0x1b')][_0xf693('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf693('0x13')](_0xf693('0x1d'),upload['single'](_0xf693('0x1e')),controller[_0xf693('0x1f')]);router[_0xf693('0x13')](_0xf693('0x20'),auth[_0xf693('0x11')](),controller[_0xf693('0x21')]);router[_0xf693('0x13')](_0xf693('0x22'),auth['isAuthenticated'](),interaction[_0xf693('0x23')](_0xf693('0x24'),_0xf693('0x25')),controller[_0xf693('0x26')]);router[_0xf693('0x27')](_0xf693('0xd'),auth[_0xf693('0xa')](),interaction['tracked'](_0xf693('0x24'),_0xf693('0x28')),controller[_0xf693('0x29')]);router[_0xf693('0x27')]('/:id/custom_update',controller[_0xf693('0x2a')]);router[_0xf693('0x27')](_0xf693('0x2b'),auth[_0xf693('0x11')](),controller[_0xf693('0x2c')]);router[_0xf693('0x27')](_0xf693('0x2d'),controller[_0xf693('0x2e')]);router[_0xf693('0x2f')](_0xf693('0xd'),auth['isAuthenticated'](),interaction[_0xf693('0x23')](_0xf693('0x24'),_0xf693('0x30')),controller[_0xf693('0x31')]);router[_0xf693('0x2f')](_0xf693('0x22'),auth[_0xf693('0xa')](),controller[_0xf693('0x32')]);module['exports']=router; \ No newline at end of file +var _0x38c9=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','createVidaooSession','join','root','format','%s-%s','originalname','replace','file','attachmentUpload','/:id/tags','chat','addTags','tracked','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','removeTags'];(function(_0x581e8d,_0x530746){var _0x9c0533=function(_0x4a6c2d){while(--_0x4a6c2d){_0x581e8d['push'](_0x581e8d['shift']());}};_0x9c0533(++_0x530746);}(_0x38c9,0x199));var _0x938c=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x38c9[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var path=require(_0x938c('0x2'));var timeout=require('connect-timeout');var express=require(_0x938c('0x3'));var router=express[_0x938c('0x4')]();var auth=require(_0x938c('0x5'));var interaction=require(_0x938c('0x6'));var config=require('../../config/environment');var controller=require(_0x938c('0x7'));router[_0x938c('0x8')]('/',auth[_0x938c('0x9')](),controller[_0x938c('0xa')]);router['get'](_0x938c('0xb'),auth[_0x938c('0x9')](),controller[_0x938c('0xc')]);router[_0x938c('0x8')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x938c('0xd')]);router[_0x938c('0x8')](_0x938c('0xe'),auth[_0x938c('0xf')](),controller[_0x938c('0x10')]);router[_0x938c('0x8')](_0x938c('0x11'),auth[_0x938c('0x9')](),controller[_0x938c('0x12')]);router[_0x938c('0x8')](_0x938c('0x13'),auth[_0x938c('0xf')](),controller[_0x938c('0x14')]);router[_0x938c('0x8')](_0x938c('0x15'),auth['isAuthenticated'](),controller[_0x938c('0x16')]);router['post']('/',auth[_0x938c('0x9')](),controller[_0x938c('0x17')]);router[_0x938c('0x18')]('/:id/vidaoo',auth[_0x938c('0x9')](),controller[_0x938c('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22cc2e,_0x9c469d,_0x9d9f88){_0x9d9f88(null,path[_0x938c('0x1a')](config[_0x938c('0x1b')],'server/files/attachments/'));},'filename':function(_0x23b7d3,_0x472057,_0x492ee2){_0x492ee2(null,util[_0x938c('0x1c')](_0x938c('0x1d'),Date['now'](),_0x472057[_0x938c('0x1e')][_0x938c('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single'](_0x938c('0x20')),controller[_0x938c('0x21')]);router[_0x938c('0x18')](_0x938c('0x11'),auth[_0x938c('0xf')](),controller['addMessage']);router['post'](_0x938c('0x22'),auth[_0x938c('0x9')](),interaction['tracked'](_0x938c('0x23'),'chatinteraction:addtags'),controller[_0x938c('0x24')]);router['put']('/:id',auth[_0x938c('0x9')](),interaction[_0x938c('0x25')](_0x938c('0x23'),_0x938c('0x26')),controller[_0x938c('0x27')]);router[_0x938c('0x28')](_0x938c('0x29'),controller[_0x938c('0x2a')]);router[_0x938c('0x28')](_0x938c('0x2b'),auth[_0x938c('0xf')](),controller['abandon']);router['put'](_0x938c('0x2c'),controller[_0x938c('0x2d')]);router[_0x938c('0x2e')](_0x938c('0x2f'),auth[_0x938c('0x9')](),interaction['tracked']('chat',_0x938c('0x30')),controller['destroy']);router['delete'](_0x938c('0x22'),auth[_0x938c('0x9')](),controller[_0x938c('0x31')]);module[_0x938c('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 5760877..8426ed5 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 _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x1a85,0x178));var _0x51a8=function(_0x4f7a97,_0x14f986){_0x4f7a97=_0x4f7a97-0x0;var _0x2d97cb=_0x1a85[_0x4f7a97];return _0x2d97cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x51a8('0x0')](_0x51a8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2ef3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x570eeb,_0x3c616a){var _0x37ac96=function(_0x50f485){while(--_0x50f485){_0x570eeb['push'](_0x570eeb['shift']());}};_0x37ac96(++_0x3c616a);}(_0x2ef3,0xba));var _0x32ef=function(_0x47ea79,_0x58a9fd){_0x47ea79=_0x47ea79-0x0;var _0x12204c=_0x2ef3[_0x47ea79];return _0x12204c;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'body':{'type':Sequelize[_0x32ef('0x2')](_0x32ef('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x32ef('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ebe1b20..c912468 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 _0x8bfe=['util','sox','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','then','destroy','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','user','fullname','role','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','read','all','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xf5c31b,_0x52c369){var _0xfd1027=function(_0x27b252){while(--_0x27b252){_0xf5c31b['push'](_0xf5c31b['shift']());}};_0xfd1027(++_0x52c369);}(_0x8bfe,0x1a9));var _0xe8bf=function(_0x33c2af,_0x163198){_0x33c2af=_0x33c2af-0x0;var _0x13c04a=_0x8bfe[_0x33c2af];return _0x13c04a;};'use strict';var pdf=require(_0xe8bf('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe8bf('0x1'));var jsonpatch=require(_0xe8bf('0x2'));var rp=require(_0xe8bf('0x3'));var moment=require(_0xe8bf('0x4'));var BPromise=require(_0xe8bf('0x5'));var Mustache=require(_0xe8bf('0x6'));var util=require(_0xe8bf('0x7'));var path=require('path');var sox=require(_0xe8bf('0x8'));var csv=require(_0xe8bf('0x9'));var ejs=require(_0xe8bf('0xa'));var fs=require('fs');var _=require(_0xe8bf('0xb'));var squel=require(_0xe8bf('0xc'));var crypto=require(_0xe8bf('0xd'));var jsforce=require(_0xe8bf('0xe'));var deskjs=require(_0xe8bf('0xf'));var toCsv=require(_0xe8bf('0x9'));var querystring=require('querystring');var Papa=require(_0xe8bf('0x10'));var Redis=require(_0xe8bf('0x11'));var authService=require(_0xe8bf('0x12'));var qs=require(_0xe8bf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8bf('0x14'));var logger=require(_0xe8bf('0x15'))(_0xe8bf('0x16'));var utils=require(_0xe8bf('0x17'));var config=require('../../config/environment');var db=require(_0xe8bf('0x18'))['db'];config[_0xe8bf('0x19')]=_[_0xe8bf('0x1a')](config[_0xe8bf('0x19')],{'host':_0xe8bf('0x1b'),'port':0x18eb});var socket=require(_0xe8bf('0x1c'))(new Redis(config[_0xe8bf('0x19')]));require(_0xe8bf('0x1d'))[_0xe8bf('0x1e')](socket);function respondWithStatusCode(_0x31fc8a,_0x2f6c37){_0x2f6c37=_0x2f6c37||0xcc;return function(_0x56e9f0){if(_0x56e9f0){return _0x31fc8a[_0xe8bf('0x1f')](_0x2f6c37);}return _0x31fc8a['status'](_0x2f6c37)[_0xe8bf('0x20')]();};}function respondWithResult(_0x599724,_0x2b2907){_0x2b2907=_0x2b2907||0xc8;return function(_0x5a74da){if(_0x5a74da){return _0x599724[_0xe8bf('0x21')](_0x2b2907)[_0xe8bf('0x22')](_0x5a74da);}};}function respondWithFilteredResult(_0x55094c,_0x52b035){return function(_0x4da61b){if(_0x4da61b){var _0x3a95d8=_0x4da61b[_0xe8bf('0x23')],_0x595275=_0x52b035['offset'],_0x36b0ad=_0x52b035[_0xe8bf('0x24')]+_0x52b035[_0xe8bf('0x25')],_0x46b287;if(_0x36b0ad>=_0x3a95d8){_0x36b0ad=_0x3a95d8;_0x46b287=0xc8;}else{_0x46b287=0xce;}_0x55094c[_0xe8bf('0x21')](_0x46b287);return _0x55094c['set'](_0xe8bf('0x26'),_0x595275+'-'+_0x36b0ad+'/'+_0x3a95d8)[_0xe8bf('0x22')](_0x4da61b);}return null;};}function patchUpdates(_0xb91d69){return function(_0x38aef3){try{jsonpatch['apply'](_0x38aef3,_0xb91d69,!![]);}catch(_0x2b5904){return BPromise[_0xe8bf('0x27')](_0x2b5904);}return _0x38aef3['save']();};}function saveUpdates(_0x5b3bc6,_0x18085b){return function(_0x2dac8f){if(_0x2dac8f){return _0x2dac8f['update'](_0x5b3bc6)[_0xe8bf('0x28')](function(_0x394961){return _0x394961;});}return null;};}function removeEntity(_0x17a152,_0x2553df){return function(_0x34843a){if(_0x34843a){return _0x34843a[_0xe8bf('0x29')]()[_0xe8bf('0x28')](function(){_0x17a152[_0xe8bf('0x21')](0xcc)[_0xe8bf('0x20')]();});}};}function handleEntityNotFound(_0xcdecae,_0x4a6d8f){return function(_0x23adee){if(!_0x23adee){_0xcdecae[_0xe8bf('0x1f')](0x194);}return _0x23adee;};}function handleError(_0x5e95ff,_0x47ed59){_0x47ed59=_0x47ed59||0x1f4;return function(_0x593c07){logger['error'](_0x593c07[_0xe8bf('0x2a')]);if(_0x593c07[_0xe8bf('0x2b')]){delete _0x593c07['name'];}_0x5e95ff[_0xe8bf('0x21')](_0x47ed59)[_0xe8bf('0x2c')](_0x593c07);};}exports['index']=function(_0x27e0ec,_0x36c013){var _0x3ca8fa={},_0x5d5197={},_0x5d19b0={'count':0x0,'rows':[]};var _0x270ed2=_[_0xe8bf('0x2d')](db[_0xe8bf('0x2e')][_0xe8bf('0x2f')],function(_0x1f83fd){return{'name':_0x1f83fd[_0xe8bf('0x30')],'type':_0x1f83fd[_0xe8bf('0x31')]['key']};});_0x5d5197[_0xe8bf('0x32')]=_[_0xe8bf('0x2d')](_0x270ed2,_0xe8bf('0x2b'));_0x5d5197['query']=_[_0xe8bf('0x33')](_0x27e0ec[_0xe8bf('0x34')]);_0x5d5197[_0xe8bf('0x35')]=_[_0xe8bf('0x36')](_0x5d5197[_0xe8bf('0x32')],_0x5d5197[_0xe8bf('0x34')]);_0x3ca8fa[_0xe8bf('0x37')]=_['intersection'](_0x5d5197['model'],qs[_0xe8bf('0x38')](_0x27e0ec[_0xe8bf('0x34')][_0xe8bf('0x38')]));_0x3ca8fa[_0xe8bf('0x37')]=_0x3ca8fa[_0xe8bf('0x37')][_0xe8bf('0x39')]?_0x3ca8fa[_0xe8bf('0x37')]:_0x5d5197[_0xe8bf('0x32')];if(!_0x27e0ec['query']['hasOwnProperty'](_0xe8bf('0x3a'))){_0x3ca8fa['limit']=qs[_0xe8bf('0x25')](_0x27e0ec[_0xe8bf('0x34')]['limit']);_0x3ca8fa['offset']=qs[_0xe8bf('0x24')](_0x27e0ec[_0xe8bf('0x34')]['offset']);}_0x3ca8fa[_0xe8bf('0x3b')]=qs[_0xe8bf('0x3c')](_0x27e0ec[_0xe8bf('0x34')][_0xe8bf('0x3c')]);_0x3ca8fa[_0xe8bf('0x3d')]=qs[_0xe8bf('0x35')](_[_0xe8bf('0x3e')](_0x27e0ec['query'],_0x5d5197[_0xe8bf('0x35')]),_0x270ed2);if(_0x27e0ec['query'][_0xe8bf('0x3f')]){_0x3ca8fa[_0xe8bf('0x3d')]=_['merge'](_0x3ca8fa[_0xe8bf('0x3d')],{'$or':_[_0xe8bf('0x2d')](_0x270ed2,function(_0x3f8e8e){if(_0x3f8e8e[_0xe8bf('0x31')]!==_0xe8bf('0x40')){var _0x3d65ab={};_0x3d65ab[_0x3f8e8e[_0xe8bf('0x2b')]]={'$like':'%'+_0x27e0ec[_0xe8bf('0x34')][_0xe8bf('0x3f')]+'%'};return _0x3d65ab;}})});}_0x3ca8fa=_[_0xe8bf('0x41')]({},_0x3ca8fa,_0x27e0ec[_0xe8bf('0x42')]);var _0x2b5a35={'where':_0x3ca8fa[_0xe8bf('0x3d')]};return db[_0xe8bf('0x2e')][_0xe8bf('0x23')](_0x2b5a35)[_0xe8bf('0x28')](function(_0x38881a){_0x5d19b0[_0xe8bf('0x23')]=_0x38881a;if(_0x27e0ec[_0xe8bf('0x34')][_0xe8bf('0x43')]){_0x3ca8fa[_0xe8bf('0x44')]=[{'all':!![]}];}return db[_0xe8bf('0x2e')][_0xe8bf('0x45')](_0x3ca8fa);})[_0xe8bf('0x28')](function(_0x4e5252){_0x5d19b0['rows']=_0x4e5252;return _0x5d19b0;})[_0xe8bf('0x28')](respondWithFilteredResult(_0x36c013,_0x3ca8fa))[_0xe8bf('0x46')](handleError(_0x36c013,null));};exports[_0xe8bf('0x47')]=function(_0x575417,_0x526715){var _0x7ed9b5={'raw':!![],'where':{'id':_0x575417[_0xe8bf('0x48')]['id']}},_0x5f03a7={};_0x5f03a7['model']=_[_0xe8bf('0x33')](db[_0xe8bf('0x2e')][_0xe8bf('0x2f')]);_0x5f03a7[_0xe8bf('0x34')]=_[_0xe8bf('0x33')](_0x575417[_0xe8bf('0x34')]);_0x5f03a7[_0xe8bf('0x35')]=_['intersection'](_0x5f03a7[_0xe8bf('0x32')],_0x5f03a7[_0xe8bf('0x34')]);_0x7ed9b5[_0xe8bf('0x37')]=_[_0xe8bf('0x36')](_0x5f03a7[_0xe8bf('0x32')],qs[_0xe8bf('0x38')](_0x575417[_0xe8bf('0x34')][_0xe8bf('0x38')]));_0x7ed9b5[_0xe8bf('0x37')]=_0x7ed9b5[_0xe8bf('0x37')][_0xe8bf('0x39')]?_0x7ed9b5['attributes']:_0x5f03a7[_0xe8bf('0x32')];if(_0x575417[_0xe8bf('0x34')][_0xe8bf('0x43')]){_0x7ed9b5[_0xe8bf('0x44')]=[{'all':!![]}];}_0x7ed9b5=_[_0xe8bf('0x41')]({},_0x7ed9b5,_0x575417['options']);return db['ChatInternalMessage'][_0xe8bf('0x49')](_0x7ed9b5)[_0xe8bf('0x28')](handleEntityNotFound(_0x526715,null))[_0xe8bf('0x28')](respondWithResult(_0x526715,null))[_0xe8bf('0x46')](handleError(_0x526715,null));};exports['create']=function(_0x445736,_0x1370af){return db['ChatInternalMessage'][_0xe8bf('0x4a')](_0x445736[_0xe8bf('0x4b')],{})[_0xe8bf('0x28')](respondWithResult(_0x1370af,0xc9))[_0xe8bf('0x46')](handleError(_0x1370af,null));};exports['update']=function(_0x1045b6,_0x49c603){if(_0x1045b6['body']['id']){delete _0x1045b6[_0xe8bf('0x4b')]['id'];}return db[_0xe8bf('0x2e')]['find']({'where':{'id':_0x1045b6[_0xe8bf('0x48')]['id']}})[_0xe8bf('0x28')](handleEntityNotFound(_0x49c603,null))['then'](saveUpdates(_0x1045b6[_0xe8bf('0x4b')],null))[_0xe8bf('0x28')](respondWithResult(_0x49c603,null))[_0xe8bf('0x46')](handleError(_0x49c603,null));};exports[_0xe8bf('0x29')]=function(_0x3b519f,_0x48d900){return db['ChatInternalMessage'][_0xe8bf('0x49')]({'where':{'id':_0x3b519f[_0xe8bf('0x48')]['id']}})['then'](handleEntityNotFound(_0x48d900,null))[_0xe8bf('0x28')](removeEntity(_0x48d900,null))[_0xe8bf('0x46')](handleError(_0x48d900,null));};exports[_0xe8bf('0x4c')]=function(_0x28c300,_0x42b6dd){return db[_0xe8bf('0x2e')][_0xe8bf('0x4c')]()[_0xe8bf('0x28')](respondWithResult(_0x42b6dd,null))[_0xe8bf('0x46')](handleError(_0x42b6dd,null));};function wrapUser(_0x230044){return function(_0x344b87){var _0x1399ae=_0x230044[_0xe8bf('0x4d')]({'plain':!![]});_0x1399ae[_0xe8bf('0x4e')]=[];if(_0x344b87){_0x1399ae[_0xe8bf('0x4f')]=_0x344b87[_0xe8bf('0x50')];_0x1399ae[_0xe8bf('0x51')]=_0x344b87;}else{_0x1399ae[_0xe8bf('0x4f')]=moment(0x0)[_0xe8bf('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x1399ae[_0xe8bf('0x51')]={};}return _0x1399ae;};}exports[_0xe8bf('0x53')]=function(_0x264f58,_0x2822ab,_0x32fd69){var _0x59d11c=[];return db[_0xe8bf('0x54')][_0xe8bf('0x45')]({'where':{'role':[_0xe8bf('0x55'),'admin',_0xe8bf('0x56')]},'attributes':['id',_0xe8bf('0x57'),_0xe8bf('0x2b'),_0xe8bf('0x58'),_0xe8bf('0x59'),_0xe8bf('0x5a'),_0xe8bf('0x5b'),_0xe8bf('0x5c'),'allowmessenger',_0xe8bf('0x5d')],'order':qs[_0xe8bf('0x3c')](_0xe8bf('0x5e')),'include':[{'model':db[_0xe8bf('0x5f')],'as':_0xe8bf('0x60'),'attributes':['id',_0xe8bf('0x2b'),'type'],'through':{'attributes':[]}}]})[_0xe8bf('0x28')](function(_0x1e8ea5){if(_0x1e8ea5){var _0x4951e1=_0x264f58['user'][_0xe8bf('0x4d')]({'plain':!![]});if(!_0x4951e1)throw new Error(_0xe8bf('0x61'));if(_0x4951e1['role']===_0xe8bf('0x56')){return db[_0xe8bf('0x62')]['find']({'where':{'name':_0xe8bf('0x63'),'userProfileId':_0x4951e1[_0xe8bf('0x64')]},'raw':!![]})[_0xe8bf('0x28')](function(_0x3371d1){if(_0x3371d1){if(_0x3371d1['autoAssociation']===0x0){return db[_0xe8bf('0x65')]['findAll']({'where':{'sectionId':_0x3371d1['id']},'raw':!![]})[_0xe8bf('0x28')](function(_0x5131a2){var _0x499474=[];if(_[_0xe8bf('0x66')](_0x5131a2)){_0x499474=_['filter'](_0x1e8ea5,function(_0x532c09){if(_0x532c09[_0xe8bf('0x58')]!==_0xe8bf('0x55')){return _0x532c09;}});return _0x499474;}else{for(var _0x24dd87=0x0;_0x24dd87<_0x1e8ea5['length'];_0x24dd87++){var _0x4b61e6=_0x1e8ea5[_0x24dd87];if(_0x4b61e6[_0xe8bf('0x58')]===_0xe8bf('0x55')){var _0x332dc6=_[_0xe8bf('0x49')](_0x5131a2,function(_0x2c5c4){return _0x2c5c4[_0xe8bf('0x67')]===_0x4b61e6['id'];});if(_0x332dc6)_0x499474[_0xe8bf('0x68')](_0x4b61e6);}else{_0x499474[_0xe8bf('0x68')](_0x4b61e6);}}return _0x499474;}});}else{return _0x1e8ea5;}}else{var _0x197665=_['filter'](_0x1e8ea5,function(_0x257142){if(_0x257142['role']!==_0xe8bf('0x55')){return _0x257142;}});return _0x197665;}});}else{return _0x1e8ea5;}}})[_0xe8bf('0x28')](function(_0x5a30bc){var _0x1edf39=[];if(_0x5a30bc){_0x59d11c=_0x5a30bc;for(var _0x4b0944=0x0;_0x4b0944<_0x5a30bc[_0xe8bf('0x39')];_0x4b0944+=0x1){_0x59d11c[_0x4b0944][_0xe8bf('0x4e')]=[];_0x1edf39[_0xe8bf('0x68')](db['ChatInternalMessage'][_0xe8bf('0x49')]({'where':{'FromId':[_0x264f58[_0xe8bf('0x56')]['id'],_0x5a30bc[_0x4b0944]['id']],'ToId':[_0x264f58['user']['id'],_0x5a30bc[_0x4b0944]['id']],'ChatGroupId':null},'attributes':['id',_0xe8bf('0x50'),_0xe8bf('0x69'),'ToId',_0xe8bf('0x6a'),'body'],'order':qs[_0xe8bf('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe8bf('0x28')](wrapUser(_0x5a30bc[_0x4b0944])));}return BPromise[_0xe8bf('0x6b')](_0x1edf39);}return[];})[_0xe8bf('0x28')](function(_0x4fbd90){return{'rows':_0x4fbd90,'count':_0x4fbd90['length']};})[_0xe8bf('0x28')](respondWithResult(_0x2822ab,null))[_0xe8bf('0x46')](handleError(_0x2822ab,null));}; \ No newline at end of file +var _0x04a4=['filter','merge','ChatInternalMessage','then','includeAll','rows','catch','show','params','include','find','create','body','destroy','describe','messages','lastMessageAt','createdAt','lastMessage','getUsers','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','findAll','isEmpty','push','FromId','read','all','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x04a4,0x95));var _0x404a=function(_0x2ae444,_0x5e9881){_0x2ae444=_0x2ae444-0x0;var _0x4d8790=_0x04a4[_0x2ae444];return _0x4d8790;};'use strict';var pdf=require(_0x404a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x404a('0x1'));var jsonpatch=require(_0x404a('0x2'));var rp=require('request-promise');var moment=require(_0x404a('0x3'));var BPromise=require(_0x404a('0x4'));var Mustache=require(_0x404a('0x5'));var util=require('util');var path=require(_0x404a('0x6'));var sox=require(_0x404a('0x7'));var csv=require(_0x404a('0x8'));var ejs=require(_0x404a('0x9'));var fs=require('fs');var _=require(_0x404a('0xa'));var squel=require('squel');var crypto=require(_0x404a('0xb'));var jsforce=require(_0x404a('0xc'));var deskjs=require(_0x404a('0xd'));var toCsv=require(_0x404a('0x8'));var querystring=require(_0x404a('0xe'));var Papa=require('papaparse');var Redis=require(_0x404a('0xf'));var authService=require(_0x404a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x404a('0x11'));var logger=require(_0x404a('0x12'))(_0x404a('0x13'));var utils=require(_0x404a('0x14'));var config=require(_0x404a('0x15'));var db=require(_0x404a('0x16'))['db'];config['redis']=_['defaults'](config[_0x404a('0x17')],{'host':_0x404a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x404a('0x17')]));require(_0x404a('0x19'))[_0x404a('0x1a')](socket);function respondWithStatusCode(_0x1d877d,_0x9b67a){_0x9b67a=_0x9b67a||0xcc;return function(_0x40de8b){if(_0x40de8b){return _0x1d877d[_0x404a('0x1b')](_0x9b67a);}return _0x1d877d['status'](_0x9b67a)[_0x404a('0x1c')]();};}function respondWithResult(_0x3fc5e6,_0x9bffb5){_0x9bffb5=_0x9bffb5||0xc8;return function(_0x79111b){if(_0x79111b){return _0x3fc5e6[_0x404a('0x1d')](_0x9bffb5)[_0x404a('0x1e')](_0x79111b);}};}function respondWithFilteredResult(_0x588486,_0x4b18aa){return function(_0x3da300){if(_0x3da300){var _0x2174f4=_0x3da300[_0x404a('0x1f')],_0x459452=_0x4b18aa[_0x404a('0x20')],_0x2059e6=_0x4b18aa[_0x404a('0x20')]+_0x4b18aa[_0x404a('0x21')],_0x26df1e;if(_0x2059e6>=_0x2174f4){_0x2059e6=_0x2174f4;_0x26df1e=0xc8;}else{_0x26df1e=0xce;}_0x588486['status'](_0x26df1e);return _0x588486[_0x404a('0x22')](_0x404a('0x23'),_0x459452+'-'+_0x2059e6+'/'+_0x2174f4)[_0x404a('0x1e')](_0x3da300);}return null;};}function patchUpdates(_0x40d956){return function(_0x4a6799){try{jsonpatch[_0x404a('0x24')](_0x4a6799,_0x40d956,!![]);}catch(_0x389fb1){return BPromise['reject'](_0x389fb1);}return _0x4a6799[_0x404a('0x25')]();};}function saveUpdates(_0x3ca95b,_0x48dcc9){return function(_0x16dc87){if(_0x16dc87){return _0x16dc87[_0x404a('0x26')](_0x3ca95b)['then'](function(_0x4d3778){return _0x4d3778;});}return null;};}function removeEntity(_0x1e3ce3,_0x40bcac){return function(_0x349cbc){if(_0x349cbc){return _0x349cbc['destroy']()['then'](function(){_0x1e3ce3[_0x404a('0x1d')](0xcc)[_0x404a('0x1c')]();});}};}function handleEntityNotFound(_0x189fff,_0x24196b){return function(_0x495ba4){if(!_0x495ba4){_0x189fff[_0x404a('0x1b')](0x194);}return _0x495ba4;};}function handleError(_0x3ffc87,_0x474d4e){_0x474d4e=_0x474d4e||0x1f4;return function(_0x225590){logger['error'](_0x225590[_0x404a('0x27')]);if(_0x225590[_0x404a('0x28')]){delete _0x225590['name'];}_0x3ffc87[_0x404a('0x1d')](_0x474d4e)[_0x404a('0x29')](_0x225590);};}exports[_0x404a('0x2a')]=function(_0x3be345,_0x544045){var _0xa3afb8={},_0x527248={},_0x5072ba={'count':0x0,'rows':[]};var _0x5491a9=_[_0x404a('0x2b')](db['ChatInternalMessage'][_0x404a('0x2c')],function(_0x5ae57c){return{'name':_0x5ae57c[_0x404a('0x2d')],'type':_0x5ae57c[_0x404a('0x2e')]['key']};});_0x527248[_0x404a('0x2f')]=_['map'](_0x5491a9,_0x404a('0x28'));_0x527248[_0x404a('0x30')]=_[_0x404a('0x31')](_0x3be345[_0x404a('0x30')]);_0x527248['filters']=_[_0x404a('0x32')](_0x527248[_0x404a('0x2f')],_0x527248[_0x404a('0x30')]);_0xa3afb8[_0x404a('0x33')]=_[_0x404a('0x32')](_0x527248[_0x404a('0x2f')],qs['fields'](_0x3be345[_0x404a('0x30')][_0x404a('0x34')]));_0xa3afb8[_0x404a('0x33')]=_0xa3afb8['attributes'][_0x404a('0x35')]?_0xa3afb8[_0x404a('0x33')]:_0x527248[_0x404a('0x2f')];if(!_0x3be345['query'][_0x404a('0x36')](_0x404a('0x37'))){_0xa3afb8[_0x404a('0x21')]=qs['limit'](_0x3be345[_0x404a('0x30')][_0x404a('0x21')]);_0xa3afb8[_0x404a('0x20')]=qs['offset'](_0x3be345[_0x404a('0x30')][_0x404a('0x20')]);}_0xa3afb8[_0x404a('0x38')]=qs['sort'](_0x3be345[_0x404a('0x30')][_0x404a('0x39')]);_0xa3afb8[_0x404a('0x3a')]=qs['filters'](_[_0x404a('0x3b')](_0x3be345[_0x404a('0x30')],_0x527248[_0x404a('0x3c')]),_0x5491a9);if(_0x3be345[_0x404a('0x30')][_0x404a('0x3d')]){_0xa3afb8['where']=_[_0x404a('0x3e')](_0xa3afb8[_0x404a('0x3a')],{'$or':_[_0x404a('0x2b')](_0x5491a9,function(_0x97dfa3){if(_0x97dfa3[_0x404a('0x2e')]!=='VIRTUAL'){var _0x361b02={};_0x361b02[_0x97dfa3['name']]={'$like':'%'+_0x3be345['query'][_0x404a('0x3d')]+'%'};return _0x361b02;}})});}_0xa3afb8=_['merge']({},_0xa3afb8,_0x3be345['options']);var _0x2c9d18={'where':_0xa3afb8[_0x404a('0x3a')]};return db[_0x404a('0x3f')][_0x404a('0x1f')](_0x2c9d18)[_0x404a('0x40')](function(_0x15f663){_0x5072ba[_0x404a('0x1f')]=_0x15f663;if(_0x3be345[_0x404a('0x30')][_0x404a('0x41')]){_0xa3afb8['include']=[{'all':!![]}];}return db[_0x404a('0x3f')]['findAll'](_0xa3afb8);})[_0x404a('0x40')](function(_0x501e91){_0x5072ba[_0x404a('0x42')]=_0x501e91;return _0x5072ba;})['then'](respondWithFilteredResult(_0x544045,_0xa3afb8))[_0x404a('0x43')](handleError(_0x544045,null));};exports[_0x404a('0x44')]=function(_0x41b77e,_0x27f574){var _0x587e05={'raw':!![],'where':{'id':_0x41b77e[_0x404a('0x45')]['id']}},_0x5a101a={};_0x5a101a['model']=_[_0x404a('0x31')](db[_0x404a('0x3f')][_0x404a('0x2c')]);_0x5a101a['query']=_[_0x404a('0x31')](_0x41b77e[_0x404a('0x30')]);_0x5a101a['filters']=_[_0x404a('0x32')](_0x5a101a[_0x404a('0x2f')],_0x5a101a[_0x404a('0x30')]);_0x587e05[_0x404a('0x33')]=_[_0x404a('0x32')](_0x5a101a[_0x404a('0x2f')],qs[_0x404a('0x34')](_0x41b77e[_0x404a('0x30')][_0x404a('0x34')]));_0x587e05['attributes']=_0x587e05[_0x404a('0x33')][_0x404a('0x35')]?_0x587e05['attributes']:_0x5a101a[_0x404a('0x2f')];if(_0x41b77e['query'][_0x404a('0x41')]){_0x587e05[_0x404a('0x46')]=[{'all':!![]}];}_0x587e05=_[_0x404a('0x3e')]({},_0x587e05,_0x41b77e['options']);return db[_0x404a('0x3f')][_0x404a('0x47')](_0x587e05)['then'](handleEntityNotFound(_0x27f574,null))['then'](respondWithResult(_0x27f574,null))[_0x404a('0x43')](handleError(_0x27f574,null));};exports[_0x404a('0x48')]=function(_0x286602,_0x4cf0a2){return db[_0x404a('0x3f')]['create'](_0x286602[_0x404a('0x49')],{})[_0x404a('0x40')](respondWithResult(_0x4cf0a2,0xc9))[_0x404a('0x43')](handleError(_0x4cf0a2,null));};exports[_0x404a('0x26')]=function(_0x3fc331,_0xbf7a62){if(_0x3fc331[_0x404a('0x49')]['id']){delete _0x3fc331['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x3fc331[_0x404a('0x45')]['id']}})[_0x404a('0x40')](handleEntityNotFound(_0xbf7a62,null))[_0x404a('0x40')](saveUpdates(_0x3fc331['body'],null))[_0x404a('0x40')](respondWithResult(_0xbf7a62,null))[_0x404a('0x43')](handleError(_0xbf7a62,null));};exports[_0x404a('0x4a')]=function(_0x5c3308,_0x7fd865){return db[_0x404a('0x3f')][_0x404a('0x47')]({'where':{'id':_0x5c3308[_0x404a('0x45')]['id']}})['then'](handleEntityNotFound(_0x7fd865,null))[_0x404a('0x40')](removeEntity(_0x7fd865,null))[_0x404a('0x43')](handleError(_0x7fd865,null));};exports[_0x404a('0x4b')]=function(_0x496d6e,_0x3c505a){return db[_0x404a('0x3f')]['describe']()[_0x404a('0x40')](respondWithResult(_0x3c505a,null))[_0x404a('0x43')](handleError(_0x3c505a,null));};function wrapUser(_0x2f7960){return function(_0x22ed80){var _0x5bf438=_0x2f7960['get']({'plain':!![]});_0x5bf438[_0x404a('0x4c')]=[];if(_0x22ed80){_0x5bf438[_0x404a('0x4d')]=_0x22ed80[_0x404a('0x4e')];_0x5bf438['lastMessage']=_0x22ed80;}else{_0x5bf438[_0x404a('0x4d')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5bf438[_0x404a('0x4f')]={};}return _0x5bf438;};}exports[_0x404a('0x50')]=function(_0x53e06e,_0x1ce936,_0x1d89c8){var _0x131dd0=[];return db['User']['findAll']({'where':{'role':[_0x404a('0x51'),_0x404a('0x52'),_0x404a('0x53')]},'attributes':['id',_0x404a('0x54'),_0x404a('0x28'),_0x404a('0x55'),_0x404a('0x56'),_0x404a('0x57'),_0x404a('0x58'),_0x404a('0x59'),_0x404a('0x5a'),_0x404a('0x5b')],'order':qs[_0x404a('0x39')](_0x404a('0x5c')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x404a('0x28'),_0x404a('0x2e')],'through':{'attributes':[]}}]})[_0x404a('0x40')](function(_0x21c86d){if(_0x21c86d){var _0x4976b9=_0x53e06e[_0x404a('0x53')][_0x404a('0x5d')]({'plain':!![]});if(!_0x4976b9)throw new Error(_0x404a('0x5e'));if(_0x4976b9[_0x404a('0x55')]===_0x404a('0x53')){return db[_0x404a('0x5f')][_0x404a('0x47')]({'where':{'name':_0x404a('0x60'),'userProfileId':_0x4976b9[_0x404a('0x61')]},'raw':!![]})[_0x404a('0x40')](function(_0xffd7a){if(_0xffd7a){if(_0xffd7a['autoAssociation']===0x0){return db[_0x404a('0x62')][_0x404a('0x63')]({'where':{'sectionId':_0xffd7a['id']},'raw':!![]})['then'](function(_0x3b42ba){var _0x210745=[];if(_[_0x404a('0x64')](_0x3b42ba)){_0x210745=_[_0x404a('0x3d')](_0x21c86d,function(_0x68dbda){if(_0x68dbda[_0x404a('0x55')]!==_0x404a('0x51')){return _0x68dbda;}});return _0x210745;}else{for(var _0x2bd4e1=0x0;_0x2bd4e1<_0x21c86d[_0x404a('0x35')];_0x2bd4e1++){var _0x26d363=_0x21c86d[_0x2bd4e1];if(_0x26d363[_0x404a('0x55')]==='agent'){var _0x4e9f9f=_[_0x404a('0x47')](_0x3b42ba,function(_0x4692c7){return _0x4692c7['resourceId']===_0x26d363['id'];});if(_0x4e9f9f)_0x210745[_0x404a('0x65')](_0x26d363);}else{_0x210745['push'](_0x26d363);}}return _0x210745;}});}else{return _0x21c86d;}}else{var _0x16939b=_[_0x404a('0x3d')](_0x21c86d,function(_0x16e170){if(_0x16e170[_0x404a('0x55')]!=='agent'){return _0x16e170;}});return _0x16939b;}});}else{return _0x21c86d;}}})['then'](function(_0x300235){var _0x4f17a6=[];if(_0x300235){_0x131dd0=_0x300235;for(var _0x274439=0x0;_0x274439<_0x300235[_0x404a('0x35')];_0x274439+=0x1){_0x131dd0[_0x274439][_0x404a('0x4c')]=[];_0x4f17a6['push'](db[_0x404a('0x3f')][_0x404a('0x47')]({'where':{'FromId':[_0x53e06e[_0x404a('0x53')]['id'],_0x300235[_0x274439]['id']],'ToId':[_0x53e06e[_0x404a('0x53')]['id'],_0x300235[_0x274439]['id']],'ChatGroupId':null},'attributes':['id',_0x404a('0x4e'),_0x404a('0x66'),'ToId',_0x404a('0x67'),_0x404a('0x49')],'order':qs[_0x404a('0x39')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x300235[_0x274439])));}return BPromise[_0x404a('0x68')](_0x4f17a6);}return[];})['then'](function(_0x18b9b2){return{'rows':_0x18b9b2,'count':_0x18b9b2[_0x404a('0x35')]};})[_0x404a('0x40')](respondWithResult(_0x1ce936,null))['catch'](handleError(_0x1ce936,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 22df35e..33b77cb 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 _0x036b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','save','update'];(function(_0x2cd71a,_0x4038f3){var _0x2b2331=function(_0x1cffd3){while(--_0x1cffd3){_0x2cd71a['push'](_0x2cd71a['shift']());}};_0x2b2331(++_0x4038f3);}(_0x036b,0x145));var _0xb036=function(_0x190c49,_0x103457){_0x190c49=_0x190c49-0x0;var _0x475b9a=_0x036b[_0x190c49];return _0x475b9a;};'use strict';var EventEmitter=require(_0xb036('0x0'));var ChatInternalMessage=require(_0xb036('0x1'))['db'][_0xb036('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb036('0x3'),'afterUpdate':_0xb036('0x4'),'afterDestroy':_0xb036('0x5')};function emitEvent(_0xef47db){return function(_0x392829,_0x523abc,_0x14b834){ChatInternalMessageEvents[_0xb036('0x6')](_0xef47db+':'+_0x392829['id'],_0x392829);ChatInternalMessageEvents[_0xb036('0x6')](_0xef47db,_0x392829);_0x14b834(null);};}for(var e in events){if(events[_0xb036('0x7')](e)){var event=events[e];ChatInternalMessage[_0xb036('0x8')](e,emitEvent(event));}}module[_0xb036('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xcee8=['hasOwnProperty','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit'];(function(_0x49a5f6,_0x2eea42){var _0x22fe92=function(_0x4ed337){while(--_0x4ed337){_0x49a5f6['push'](_0x49a5f6['shift']());}};_0x22fe92(++_0x2eea42);}(_0xcee8,0xb1));var _0x8cee=function(_0x1618f0,_0x3eaebe){_0x1618f0=_0x1618f0-0x0;var _0xb6de7e=_0xcee8[_0x1618f0];return _0xb6de7e;};'use strict';var EventEmitter=require(_0x8cee('0x0'));var ChatInternalMessage=require(_0x8cee('0x1'))['db'][_0x8cee('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8cee('0x3')](0x0);var events={'afterCreate':_0x8cee('0x4'),'afterUpdate':_0x8cee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x127360){return function(_0x4e4143,_0xffd42d,_0x1ec415){ChatInternalMessageEvents['emit'](_0x127360+':'+_0x4e4143['id'],_0x4e4143);ChatInternalMessageEvents[_0x8cee('0x6')](_0x127360,_0x4e4143);_0x1ec415(null);};}for(var e in events){if(events[_0x8cee('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 902b775..1bcd84b 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 _0x69b7=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0x69b7,0x1f1));var _0x769b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x69b7[_0x432682];return _0x463d05;};'use strict';var _=require(_0x769b('0x0'));var util=require('util');var logger=require(_0x769b('0x1'))('api');var moment=require(_0x769b('0x2'));var BPromise=require('bluebird');var rp=require(_0x769b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x769b('0x4'));var config=require(_0x769b('0x5'));var attributes=require(_0x769b('0x6'));module[_0x769b('0x7')]=function(_0x6ec1ef,_0x500a96){return _0x6ec1ef[_0x769b('0x8')](_0x769b('0x9'),attributes,{'tableName':_0x769b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x769b('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xffd5=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x2a1f92,_0x4800bf){var _0x4e4962=function(_0x27e672){while(--_0x27e672){_0x2a1f92['push'](_0x2a1f92['shift']());}};_0x4e4962(++_0x4800bf);}(_0xffd5,0xd8));var _0x5ffd=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xffd5[_0x484c03];return _0x294127;};'use strict';var _=require(_0x5ffd('0x0'));var util=require(_0x5ffd('0x1'));var logger=require(_0x5ffd('0x2'))(_0x5ffd('0x3'));var moment=require(_0x5ffd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ffd('0x5'));var rimraf=require(_0x5ffd('0x6'));var config=require(_0x5ffd('0x7'));var attributes=require(_0x5ffd('0x8'));module[_0x5ffd('0x9')]=function(_0x21cfbd,_0x4ea06c){return _0x21cfbd[_0x5ffd('0xa')](_0x5ffd('0xb'),attributes,{'tableName':_0x5ffd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ffd('0xd'),'collate':_0x5ffd('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 8f86f15..9a94525 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 _0x6888=['../../mysqldb','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x6888,0x91));var _0x8688=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x6888[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x8688('0x0'));var util=require(_0x8688('0x1'));var moment=require(_0x8688('0x2'));var BPromise=require(_0x8688('0x3'));var rs=require(_0x8688('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8688('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8688('0x6'));var jayson=require(_0x8688('0x7'));var client=jayson['client'][_0x8688('0x8')]({'port':0x232a});config['redis']=_[_0x8688('0x9')](config[_0x8688('0xa')],{'host':_0x8688('0xb'),'port':0x18eb});var socket=require(_0x8688('0xc'))(new Redis(config[_0x8688('0xa')]));require(_0x8688('0xd'))[_0x8688('0xe')](socket);function respondWithRpcPromise(_0x3678a7,_0x35b167,_0x57ab83){return new BPromise(function(_0x42b374,_0x1fa4b0){return client[_0x8688('0xf')](_0x3678a7,_0x57ab83)[_0x8688('0x10')](function(_0x33832d){logger[_0x8688('0x11')](_0x8688('0x12'),_0x35b167,_0x8688('0x13'));logger['debug'](_0x8688('0x14'),_0x35b167,'request\x20sent',JSON['stringify'](_0x33832d));if(_0x33832d[_0x8688('0x15')]){if(_0x33832d['error']['code']===0x1f4){logger[_0x8688('0x15')](_0x8688('0x12'),_0x35b167,_0x33832d[_0x8688('0x15')][_0x8688('0x16')]);return _0x1fa4b0(_0x33832d[_0x8688('0x15')][_0x8688('0x16')]);}logger[_0x8688('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x35b167,_0x33832d[_0x8688('0x15')][_0x8688('0x16')]);return _0x42b374(_0x33832d[_0x8688('0x15')][_0x8688('0x16')]);}else{logger[_0x8688('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x35b167,_0x8688('0x13'));_0x42b374(_0x33832d[_0x8688('0x17')][_0x8688('0x16')]);}})[_0x8688('0x18')](function(_0x259348){logger['error'](_0x8688('0x12'),_0x35b167,_0x259348);_0x1fa4b0(_0x259348);});});} \ No newline at end of file +var _0x618f=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c6d35,_0x40d855){var _0x16510e=function(_0x347d16){while(--_0x347d16){_0x3c6d35['push'](_0x3c6d35['shift']());}};_0x16510e(++_0x40d855);}(_0x618f,0x1b9));var _0xf618=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x618f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf618('0x0'));var moment=require(_0xf618('0x1'));var BPromise=require(_0xf618('0x2'));var rs=require(_0xf618('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf618('0x4'))['db'];var utils=require(_0xf618('0x5'));var logger=require(_0xf618('0x6'))(_0xf618('0x7'));var config=require('../../config/environment');var jayson=require(_0xf618('0x8'));var client=jayson[_0xf618('0x9')][_0xf618('0xa')]({'port':0x232a});config[_0xf618('0xb')]=_[_0xf618('0xc')](config['redis'],{'host':_0xf618('0xd'),'port':0x18eb});var socket=require(_0xf618('0xe'))(new Redis(config[_0xf618('0xb')]));require(_0xf618('0xf'))[_0xf618('0x10')](socket);function respondWithRpcPromise(_0x29c3cb,_0x45b37b,_0x4d9d66){return new BPromise(function(_0x155948,_0x29ae7f){return client[_0xf618('0x11')](_0x29c3cb,_0x4d9d66)[_0xf618('0x12')](function(_0x1ee5e5){logger[_0xf618('0x13')](_0xf618('0x14'),_0x45b37b,_0xf618('0x15'));logger[_0xf618('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x45b37b,'request\x20sent',JSON[_0xf618('0x17')](_0x1ee5e5));if(_0x1ee5e5[_0xf618('0x18')]){if(_0x1ee5e5[_0xf618('0x18')][_0xf618('0x19')]===0x1f4){logger[_0xf618('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x45b37b,_0x1ee5e5[_0xf618('0x18')]['message']);return _0x29ae7f(_0x1ee5e5[_0xf618('0x18')]['message']);}logger[_0xf618('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x45b37b,_0x1ee5e5[_0xf618('0x18')][_0xf618('0x1a')]);return _0x155948(_0x1ee5e5[_0xf618('0x18')][_0xf618('0x1a')]);}else{logger['info'](_0xf618('0x14'),_0x45b37b,_0xf618('0x15'));_0x155948(_0x1ee5e5[_0xf618('0x1b')]['message']);}})[_0xf618('0x1c')](function(_0x356918){logger[_0xf618('0x18')](_0xf618('0x14'),_0x45b37b,_0x356918);_0x29ae7f(_0x356918);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0905a16..67e51f0 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 _0x01fe=['./chatInternalMessage.events','remove','update','emit','register','length'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x01fe,0x102));var _0xe01f=function(_0x31b4a6,_0x2b1369){_0x31b4a6=_0x31b4a6-0x0;var _0x51cfde=_0x01fe[_0x31b4a6];return _0x51cfde;};'use strict';var ChatInternalMessageEvents=require(_0xe01f('0x0'));var events=['save',_0xe01f('0x1'),_0xe01f('0x2')];function createListener(_0x4a9e90,_0x577c82){return function(_0x15f6ba){_0x577c82[_0xe01f('0x3')](_0x4a9e90,_0x15f6ba);};}function removeListener(_0x9505fa,_0x92b885){return function(){ChatInternalMessageEvents['removeListener'](_0x9505fa,_0x92b885);};}exports[_0xe01f('0x4')]=function(_0x574969){for(var _0x3effc4=0x0,_0x3b754f=events[_0xe01f('0x5')];_0x3effc4<_0x3b754f;_0x3effc4++){var _0x40376f=events[_0x3effc4];var _0x377881=createListener('chatInternalMessage:'+_0x40376f,_0x574969);ChatInternalMessageEvents['on'](_0x40376f,_0x377881);}}; \ No newline at end of file +var _0x3379=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3379,0x115));var _0x9337=function(_0x63257c,_0x5df8d0){_0x63257c=_0x63257c-0x0;var _0x47cc3e=_0x3379[_0x63257c];return _0x47cc3e;};'use strict';var ChatInternalMessageEvents=require(_0x9337('0x0'));var events=[_0x9337('0x1'),_0x9337('0x2'),_0x9337('0x3')];function createListener(_0x5a6194,_0x369104){return function(_0x39545){_0x369104[_0x9337('0x4')](_0x5a6194,_0x39545);};}function removeListener(_0x30dcfe,_0x49ce9a){return function(){ChatInternalMessageEvents[_0x9337('0x5')](_0x30dcfe,_0x49ce9a);};}exports[_0x9337('0x6')]=function(_0x390772){for(var _0x677c38=0x0,_0x5a59ab=events[_0x9337('0x7')];_0x677c38<_0x5a59ab;_0x677c38++){var _0x5b1986=events[_0x677c38];var _0x268943=createListener(_0x9337('0x8')+_0x5b1986,_0x390772);ChatInternalMessageEvents['on'](_0x5b1986,_0x268943);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 04eb757..ccf65c2 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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x5c1b05,_0x4510fd){var _0x417d35=function(_0x1d73e2){while(--_0x1d73e2){_0x5c1b05['push'](_0x5c1b05['shift']());}};_0x417d35(++_0x4510fd);}(_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')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x1a0f5f,_0x3950d4){var _0x3ac228=function(_0x240389){while(--_0x240389){_0x1a0f5f['push'](_0x1a0f5f['shift']());}};_0x3ac228(++_0x3950d4);}(_0xe706,0xa3));var _0x6e70=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xe706[_0x266618];return _0x54dbf5;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['put']('/:id',controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);module[_0x6e70('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 5d37e4c..cb23ab9 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 _0xa4ce=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x54417c,_0x155f01){var _0x1462c0=function(_0x5d8c0f){while(--_0x5d8c0f){_0x54417c['push'](_0x54417c['shift']());}};_0x1462c0(++_0x155f01);}(_0xa4ce,0x7f));var _0xea4c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa4ce[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0xea4c('0x0'));module[_0xea4c('0x1')]={'body':{'type':Sequelize[_0xea4c('0x2')](_0xea4c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xea4c('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xea4c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xea4c('0x5')]('in',_0xea4c('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xea4c('0x7')]}}; \ No newline at end of file +var _0x5627=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x30af4b,_0x34f893){var _0x575e4f=function(_0x2a87a3){while(--_0x2a87a3){_0x30af4b['push'](_0x30af4b['shift']());}};_0x575e4f(++_0x34f893);}(_0x5627,0xad));var _0x7562=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5627[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x7562('0x0')]={'body':{'type':Sequelize[_0x7562('0x1')](_0x7562('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7562('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7562('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7562('0x4')]('in',_0x7562('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x7562('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 9c82b40..7cedc85 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 _0x044f=['fields','length','hasOwnProperty','offset','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','intersection','find','create','body','describe','accept','chat','readAt','format','UserId','user','CmContact','Contact','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','reject','agent','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','sendStatus','status','end','json','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','keys','query','filters','attributes'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x044f,0xb8));var _0xf044=function(_0x23d160,_0x15e4dc){_0x23d160=_0x23d160-0x0;var _0x5df430=_0x044f[_0x23d160];return _0x5df430;};'use strict';var pdf=require(_0xf044('0x0'));var emlformat=require(_0xf044('0x1'));var rimraf=require(_0xf044('0x2'));var zipdir=require(_0xf044('0x3'));var jsonpatch=require(_0xf044('0x4'));var rp=require(_0xf044('0x5'));var moment=require(_0xf044('0x6'));var BPromise=require(_0xf044('0x7'));var Mustache=require(_0xf044('0x8'));var util=require(_0xf044('0x9'));var path=require('path');var sox=require(_0xf044('0xa'));var csv=require('to-csv');var ejs=require(_0xf044('0xb'));var fs=require('fs');var _=require(_0xf044('0xc'));var squel=require(_0xf044('0xd'));var crypto=require(_0xf044('0xe'));var jsforce=require(_0xf044('0xf'));var deskjs=require(_0xf044('0x10'));var toCsv=require(_0xf044('0x11'));var querystring=require('querystring');var Papa=require(_0xf044('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf044('0x13'));var as=require(_0xf044('0x14'));var hardwareService=require(_0xf044('0x15'));var logger=require(_0xf044('0x16'))(_0xf044('0x17'));var utils=require(_0xf044('0x18'));var config=require(_0xf044('0x19'));var db=require(_0xf044('0x1a'))['db'];config[_0xf044('0x1b')]=_['defaults'](config[_0xf044('0x1b')],{'host':_0xf044('0x1c'),'port':0x18eb});var socket=require(_0xf044('0x1d'))(new Redis(config[_0xf044('0x1b')]));require('./chatMessage.socket')[_0xf044('0x1e')](socket);var jayson=require(_0xf044('0x1f'));var client=jayson[_0xf044('0x20')][_0xf044('0x21')]({'port':0x232c});var client9002=jayson[_0xf044('0x20')][_0xf044('0x21')]({'port':0x232a});function checkPasswordPattern(_0x2831f9,_0x30aea0,_0x38f572){if(_0x38f572){var _0x2a7c2d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a7c2d['test'](_0x30aea0)){return _0x2831f9;}else{throw new db[(_0xf044('0x22'))][(_0xf044('0x23'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2831f9;}}function respondWithRpcPromise(_0x2d6a18,_0x1c661e,_0x4d999b,_0x436b87){return new BPromise(function(_0x2cf155,_0x8adbfe){var _0x1a6d44=_0x436b87||client;return _0x1a6d44[_0xf044('0x24')](_0x2d6a18,_0x4d999b)[_0xf044('0x25')](function(_0x2cffee){logger['info'](_0xf044('0x26'),_0x1c661e,_0xf044('0x27'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1c661e,_0xf044('0x27'),JSON['stringify'](_0x2cffee));if(_0x2cffee[_0xf044('0x28')]){if(_0x2cffee[_0xf044('0x28')]['code']===0x1f4){logger[_0xf044('0x28')](_0xf044('0x26'),_0x1c661e,_0x2cffee[_0xf044('0x28')][_0xf044('0x29')]);return _0x8adbfe(_0x2cffee[_0xf044('0x28')][_0xf044('0x29')]);}logger[_0xf044('0x28')](_0xf044('0x26'),_0x1c661e,_0x2cffee['error']['message']);return _0x2cf155(_0x2cffee[_0xf044('0x28')][_0xf044('0x29')]);}else{logger[_0xf044('0x2a')](_0xf044('0x26'),_0x1c661e,_0xf044('0x27'));_0x2cf155(_0x2cffee[_0xf044('0x2b')][_0xf044('0x29')]);}})[_0xf044('0x2c')](function(_0x1e574f){logger[_0xf044('0x28')](_0xf044('0x26'),_0x1c661e,_0x1e574f);_0x8adbfe(_0x1e574f);});});}function respondWithStatusCode(_0x172995,_0xeac6f0){_0xeac6f0=_0xeac6f0||0xcc;return function(_0x51a0ad){if(_0x51a0ad){return _0x172995[_0xf044('0x2d')](_0xeac6f0);}return _0x172995[_0xf044('0x2e')](_0xeac6f0)[_0xf044('0x2f')]();};}function respondWithResult(_0xc3bf4,_0x3cf1ce){_0x3cf1ce=_0x3cf1ce||0xc8;return function(_0x3cee08){if(_0x3cee08){return _0xc3bf4[_0xf044('0x2e')](_0x3cf1ce)[_0xf044('0x30')](_0x3cee08);}};}function respondWithFilteredResult(_0x1716c7,_0x43d9ce){return function(_0x1adaa5){if(_0x1adaa5){var _0x16a503=_0x1adaa5['count'],_0x491232=_0x43d9ce['offset'],_0x16baab=_0x43d9ce['offset']+_0x43d9ce[_0xf044('0x31')],_0x495c1d;if(_0x16baab>=_0x16a503){_0x16baab=_0x16a503;_0x495c1d=0xc8;}else{_0x495c1d=0xce;}_0x1716c7[_0xf044('0x2e')](_0x495c1d);return _0x1716c7[_0xf044('0x32')](_0xf044('0x33'),_0x491232+'-'+_0x16baab+'/'+_0x16a503)[_0xf044('0x30')](_0x1adaa5);}return null;};}function patchUpdates(_0x1961e6){return function(_0x161048){try{jsonpatch[_0xf044('0x34')](_0x161048,_0x1961e6,!![]);}catch(_0x105368){return BPromise['reject'](_0x105368);}return _0x161048[_0xf044('0x35')]();};}function saveUpdates(_0x22059a,_0x33d901){return function(_0x56951a){if(_0x56951a){return _0x56951a[_0xf044('0x36')](_0x22059a)['then'](function(_0x16acbb){return _0x16acbb;});}return null;};}function removeEntity(_0x3be50a,_0x5bcdd6){return function(_0x5e495b){if(_0x5e495b){return _0x5e495b[_0xf044('0x37')]()[_0xf044('0x25')](function(){_0x3be50a[_0xf044('0x2e')](0xcc)[_0xf044('0x2f')]();});}};}function handleEntityNotFound(_0x32e496,_0x4df2e6){return function(_0x23101b){if(!_0x23101b){_0x32e496[_0xf044('0x2d')](0x194);}return _0x23101b;};}function handleError(_0x2f6be0,_0xdc7002){_0xdc7002=_0xdc7002||0x1f4;return function(_0x54127d){logger['error'](_0x54127d[_0xf044('0x38')]);if(_0x54127d[_0xf044('0x39')]){delete _0x54127d[_0xf044('0x39')];}_0x2f6be0[_0xf044('0x2e')](_0xdc7002)[_0xf044('0x3a')](_0x54127d);};}exports[_0xf044('0x3b')]=function(_0x45ae37,_0x4165c4){var _0x5c09c1={},_0x563478={},_0x3121c1={'count':0x0,'rows':[]};var _0x5ae182=_[_0xf044('0x3c')](db[_0xf044('0x3d')][_0xf044('0x3e')],function(_0x5130c7){return{'name':_0x5130c7[_0xf044('0x3f')],'type':_0x5130c7['type'][_0xf044('0x40')]};});_0x563478[_0xf044('0x41')]=_[_0xf044('0x3c')](_0x5ae182,_0xf044('0x39'));_0x563478['query']=_[_0xf044('0x42')](_0x45ae37[_0xf044('0x43')]);_0x563478[_0xf044('0x44')]=_['intersection'](_0x563478[_0xf044('0x41')],_0x563478[_0xf044('0x43')]);_0x5c09c1[_0xf044('0x45')]=_['intersection'](_0x563478['model'],qs[_0xf044('0x46')](_0x45ae37[_0xf044('0x43')][_0xf044('0x46')]));_0x5c09c1[_0xf044('0x45')]=_0x5c09c1[_0xf044('0x45')][_0xf044('0x47')]?_0x5c09c1[_0xf044('0x45')]:_0x563478['model'];if(!_0x45ae37[_0xf044('0x43')][_0xf044('0x48')]('nolimit')){_0x5c09c1[_0xf044('0x31')]=qs[_0xf044('0x31')](_0x45ae37[_0xf044('0x43')][_0xf044('0x31')]);_0x5c09c1[_0xf044('0x49')]=qs[_0xf044('0x49')](_0x45ae37[_0xf044('0x43')][_0xf044('0x49')]);}_0x5c09c1['order']=qs[_0xf044('0x4a')](_0x45ae37[_0xf044('0x43')][_0xf044('0x4a')]);_0x5c09c1['where']=qs[_0xf044('0x44')](_[_0xf044('0x4b')](_0x45ae37[_0xf044('0x43')],_0x563478['filters']),_0x5ae182);if(_0x45ae37['query'][_0xf044('0x4c')]){_0x5c09c1[_0xf044('0x4d')]=_[_0xf044('0x4e')](_0x5c09c1[_0xf044('0x4d')],{'$or':_[_0xf044('0x3c')](_0x5ae182,function(_0x4b01a5){if(_0x4b01a5[_0xf044('0x4f')]!==_0xf044('0x50')){var _0x485337={};_0x485337[_0x4b01a5[_0xf044('0x39')]]={'$like':'%'+_0x45ae37[_0xf044('0x43')][_0xf044('0x4c')]+'%'};return _0x485337;}})});}_0x5c09c1=_[_0xf044('0x4e')]({},_0x5c09c1,_0x45ae37[_0xf044('0x51')]);var _0x19ec6f={'where':_0x5c09c1['where']};return db['ChatMessage'][_0xf044('0x52')](_0x19ec6f)['then'](function(_0x356c86){_0x3121c1[_0xf044('0x52')]=_0x356c86;if(_0x45ae37['query'][_0xf044('0x53')]){_0x5c09c1[_0xf044('0x54')]=[{'all':!![]}];}return db[_0xf044('0x3d')][_0xf044('0x55')](_0x5c09c1);})['then'](function(_0x1b9a10){_0x3121c1['rows']=_0x1b9a10;return _0x3121c1;})[_0xf044('0x25')](respondWithFilteredResult(_0x4165c4,_0x5c09c1))[_0xf044('0x2c')](handleError(_0x4165c4,null));};exports[_0xf044('0x56')]=function(_0x491cf0,_0x5a1dfc){var _0x401b89={'raw':!![],'where':{'id':_0x491cf0[_0xf044('0x57')]['id']}},_0x2bd83b={};_0x2bd83b['model']=_['keys'](db[_0xf044('0x3d')][_0xf044('0x3e')]);_0x2bd83b[_0xf044('0x43')]=_[_0xf044('0x42')](_0x491cf0[_0xf044('0x43')]);_0x2bd83b['filters']=_[_0xf044('0x58')](_0x2bd83b[_0xf044('0x41')],_0x2bd83b[_0xf044('0x43')]);_0x401b89[_0xf044('0x45')]=_[_0xf044('0x58')](_0x2bd83b[_0xf044('0x41')],qs[_0xf044('0x46')](_0x491cf0[_0xf044('0x43')][_0xf044('0x46')]));_0x401b89[_0xf044('0x45')]=_0x401b89[_0xf044('0x45')][_0xf044('0x47')]?_0x401b89[_0xf044('0x45')]:_0x2bd83b[_0xf044('0x41')];if(_0x491cf0[_0xf044('0x43')][_0xf044('0x53')]){_0x401b89[_0xf044('0x54')]=[{'all':!![]}];}_0x401b89=_[_0xf044('0x4e')]({},_0x401b89,_0x491cf0['options']);return db[_0xf044('0x3d')][_0xf044('0x59')](_0x401b89)[_0xf044('0x25')](handleEntityNotFound(_0x5a1dfc,null))['then'](respondWithResult(_0x5a1dfc,null))[_0xf044('0x2c')](handleError(_0x5a1dfc,null));};exports['create']=function(_0x45f77c,_0x297e8c){return db['ChatMessage'][_0xf044('0x5a')](_0x45f77c['body'],{})[_0xf044('0x25')](respondWithResult(_0x297e8c,0xc9))['catch'](handleError(_0x297e8c,null));};exports[_0xf044('0x36')]=function(_0x47857e,_0x1dd9a3){if(_0x47857e[_0xf044('0x5b')]['id']){delete _0x47857e[_0xf044('0x5b')]['id'];}return db[_0xf044('0x3d')][_0xf044('0x59')]({'where':{'id':_0x47857e[_0xf044('0x57')]['id']}})[_0xf044('0x25')](handleEntityNotFound(_0x1dd9a3,null))[_0xf044('0x25')](saveUpdates(_0x47857e[_0xf044('0x5b')],null))[_0xf044('0x25')](respondWithResult(_0x1dd9a3,null))[_0xf044('0x2c')](handleError(_0x1dd9a3,null));};exports[_0xf044('0x37')]=function(_0x5db2a6,_0x1ef73f){return db[_0xf044('0x3d')][_0xf044('0x59')]({'where':{'id':_0x5db2a6[_0xf044('0x57')]['id']}})[_0xf044('0x25')](handleEntityNotFound(_0x1ef73f,null))[_0xf044('0x25')](removeEntity(_0x1ef73f,null))[_0xf044('0x2c')](handleError(_0x1ef73f,null));};exports[_0xf044('0x5c')]=function(_0x9e1e0,_0xbb367f){return db[_0xf044('0x3d')][_0xf044('0x5c')]()[_0xf044('0x25')](respondWithResult(_0xbb367f,null))['catch'](handleError(_0xbb367f,null));};var interaction_log=require(_0xf044('0x16'))('chat-interactions');exports[_0xf044('0x5d')]=function(_0x2dadb3,_0x503188,_0x19600c){var _0x23d642={'channel':_0xf044('0x5e')};if(_0x2dadb3[_0xf044('0x5b')]['id']){delete _0x2dadb3['body']['id'];}_0x2dadb3[_0xf044('0x5b')]['read']=!![];_0x2dadb3[_0xf044('0x5b')][_0xf044('0x5f')]=moment()[_0xf044('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x2dadb3['body'][_0xf044('0x61')]=_0x2dadb3[_0xf044('0x5b')][_0xf044('0x61')]||_0x2dadb3[_0xf044('0x62')]['id'];return db[_0xf044('0x3d')][_0xf044('0x59')]({'where':{'id':_0x2dadb3[_0xf044('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xf044('0x63')],'as':_0xf044('0x64')}]})[_0xf044('0x25')](handleEntityNotFound(_0x503188,null))[_0xf044('0x25')](saveUpdates(_0x2dadb3[_0xf044('0x5b')],null))[_0xf044('0x25')](function(_0x5c0f93){if(_0x5c0f93){_0x23d642['message']=_0x5c0f93['get']({'plain':!![]});return db[_0xf044('0x65')][_0xf044('0x59')]({'where':{'id':_0x5c0f93[_0xf044('0x66')]}});}return null;})[_0xf044('0x25')](handleEntityNotFound(_0x503188,null))[_0xf044('0x25')](function(_0x7c75ec){if(_0x7c75ec){return _0x7c75ec[_0xf044('0x36')]({'UserId':_0x2dadb3['body']['UserId'],'read1stAt':_[_0xf044('0x67')](_0x7c75ec[_0xf044('0x68')])?moment()[_0xf044('0x60')](_0xf044('0x69')):undefined});}return null;})[_0xf044('0x25')](function(_0x456760){if(_0x456760){_0x23d642[_0xf044('0x6a')]=_0x456760[_0xf044('0x6b')]({'plain':!![]});interaction_log[_0xf044('0x2a')](_0xf044('0x6c'),_0x2dadb3[_0xf044('0x62')]['id'],_0x2dadb3[_0xf044('0x62')][_0xf044('0x39')],_0x2dadb3[_0xf044('0x62')][_0xf044('0x6d')],_0x23d642[_0xf044('0x6a')]['id'],_0x2dadb3[_0xf044('0x5b')]?JSON[_0xf044('0x6e')](_0x2dadb3[_0xf044('0x5b')]):_0xf044('0x6f'));return respondWithRpcPromise('AcceptMessage',_0xf044('0x70'),_0x23d642);}return null;})['then'](function(_0x31cb4a){if(_0x31cb4a){if(_0x2dadb3[_0xf044('0x5b')][_0xf044('0x71')]){_0x23d642[_0xf044('0x29')]['interface']=util[_0xf044('0x60')](_0xf044('0x72'),_0x2dadb3[_0xf044('0x62')][_0xf044('0x39')]);_0x23d642['message'][_0xf044('0x73')]=_0x23d642[_0xf044('0x73')];_0x23d642[_0xf044('0x29')][_0xf044('0x74')]=_0xf044('0x5d');return respondWithRpcPromise('EventManager',_0xf044('0x75'),{'event':_0xf044('0x76'),'message':_[_0xf044('0x4e')](_0x23d642['message'],JSON[_0xf044('0x77')](_0x23d642[_0xf044('0x6a')][_0xf044('0x78')]))},client9002)['then'](function(){return _0x23d642;});}return _0x23d642;}return null;})[_0xf044('0x25')](respondWithResult(_0x503188,null))[_0xf044('0x2c')](handleError(_0x503188,null));};var interaction_log=require('../../config/logger')(_0xf044('0x79'));exports[_0xf044('0x7a')]=function(_0x42569d,_0x4da254,_0x11a5fd){var _0x25ab85={'agent':{},'channel':'chat'};if(_0x42569d[_0xf044('0x5b')]['id']){delete _0x42569d['body']['id'];}_0x42569d[_0xf044('0x5b')][_0xf044('0x61')]=_0x42569d[_0xf044('0x5b')][_0xf044('0x61')]||_0x42569d[_0xf044('0x62')]['id'];_0x25ab85[_0xf044('0x7b')]['id']=_0x42569d['body'][_0xf044('0x61')];return db[_0xf044('0x3d')][_0xf044('0x59')]({'where':{'id':_0x42569d[_0xf044('0x57')]['id'],'UserId':null}})[_0xf044('0x25')](handleEntityNotFound(_0x4da254,null))[_0xf044('0x25')](function(_0x219937){if(_0x219937){_0x25ab85['message']=_0x219937[_0xf044('0x6b')]({'plain':!![]});return db['ChatInteraction'][_0xf044('0x59')]({'where':{'id':_0x219937[_0xf044('0x66')]}});}return null;})[_0xf044('0x25')](handleEntityNotFound(_0x4da254,null))[_0xf044('0x25')](function(_0x1b3be7){if(_0x1b3be7){_0x25ab85[_0xf044('0x6a')]=_0x1b3be7[_0xf044('0x6b')]({'plain':!![]});interaction_log[_0xf044('0x2a')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x42569d[_0xf044('0x62')]['id'],_0x42569d[_0xf044('0x62')]['name'],_0x42569d[_0xf044('0x62')][_0xf044('0x6d')],_0x25ab85[_0xf044('0x6a')]['id'],_0x42569d[_0xf044('0x5b')]?JSON[_0xf044('0x6e')](_0x42569d[_0xf044('0x5b')]):_0xf044('0x6f'));return respondWithRpcPromise('RejectMessage',_0xf044('0x7c'),_0x25ab85);}return null;})[_0xf044('0x25')](function(_0x18ff98){if(_0x18ff98){_0x18ff98[_0xf044('0x29')][_0xf044('0x7d')]=util[_0xf044('0x60')](_0xf044('0x72'),_0x42569d['user']['name']);_0x18ff98[_0xf044('0x29')][_0xf044('0x73')]=_0x25ab85['channel'];_0x18ff98[_0xf044('0x29')]['event']=_0xf044('0x7a');respondWithRpcPromise(_0xf044('0x75'),_0xf044('0x75'),{'event':_0xf044('0x7e'),'message':_0x18ff98['message']},client9002);return _0x25ab85;}return null;})[_0xf044('0x25')](respondWithResult(_0x4da254,null))[_0xf044('0x2c')](handleError(_0x4da254,null));}; \ No newline at end of file +var _0xae85=['agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','end','status','json','count','offset','Content-Range','apply','reject','update','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','find','catch','create','body','destroy','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','parse','formData'];(function(_0x11dcc9,_0x377efb){var _0x54f643=function(_0x3b5644){while(--_0x3b5644){_0x11dcc9['push'](_0x11dcc9['shift']());}};_0x54f643(++_0x377efb);}(_0xae85,0x17b));var _0x5ae8=function(_0x489608,_0x4f157f){_0x489608=_0x489608-0x0;var _0x25632c=_0xae85[_0x489608];return _0x25632c;};'use strict';var pdf=require(_0x5ae8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5ae8('0x1'));var zipdir=require(_0x5ae8('0x2'));var jsonpatch=require(_0x5ae8('0x3'));var rp=require(_0x5ae8('0x4'));var moment=require(_0x5ae8('0x5'));var BPromise=require(_0x5ae8('0x6'));var Mustache=require(_0x5ae8('0x7'));var util=require(_0x5ae8('0x8'));var path=require(_0x5ae8('0x9'));var sox=require(_0x5ae8('0xa'));var csv=require('to-csv');var ejs=require(_0x5ae8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5ae8('0xc'));var crypto=require(_0x5ae8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5ae8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5ae8('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ae8('0x10'));var authService=require(_0x5ae8('0x11'));var qs=require(_0x5ae8('0x12'));var as=require(_0x5ae8('0x13'));var hardwareService=require(_0x5ae8('0x14'));var logger=require(_0x5ae8('0x15'))('api');var utils=require(_0x5ae8('0x16'));var config=require(_0x5ae8('0x17'));var db=require('../../mysqldb')['db'];config[_0x5ae8('0x18')]=_[_0x5ae8('0x19')](config['redis'],{'host':_0x5ae8('0x1a'),'port':0x18eb});var socket=require(_0x5ae8('0x1b'))(new Redis(config[_0x5ae8('0x18')]));require(_0x5ae8('0x1c'))[_0x5ae8('0x1d')](socket);var jayson=require(_0x5ae8('0x1e'));var client=jayson['client'][_0x5ae8('0x1f')]({'port':0x232c});var client9002=jayson[_0x5ae8('0x20')][_0x5ae8('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x187b59,_0x283e44,_0x41382e){if(_0x41382e){var _0x37af66=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37af66[_0x5ae8('0x21')](_0x283e44)){return _0x187b59;}else{throw new db[(_0x5ae8('0x22'))][(_0x5ae8('0x23'))](_0x5ae8('0x24'));}}else{return _0x187b59;}}function respondWithRpcPromise(_0x2ebca1,_0x3540a1,_0x1d4f2c,_0x1326ec){return new BPromise(function(_0x924fa7,_0x2411c1){var _0x1328da=_0x1326ec||client;return _0x1328da[_0x5ae8('0x25')](_0x2ebca1,_0x1d4f2c)[_0x5ae8('0x26')](function(_0x1abf7f){logger[_0x5ae8('0x27')](_0x5ae8('0x28'),_0x3540a1,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3540a1,_0x5ae8('0x29'),JSON[_0x5ae8('0x2a')](_0x1abf7f));if(_0x1abf7f[_0x5ae8('0x2b')]){if(_0x1abf7f[_0x5ae8('0x2b')][_0x5ae8('0x2c')]===0x1f4){logger['error'](_0x5ae8('0x28'),_0x3540a1,_0x1abf7f['error'][_0x5ae8('0x2d')]);return _0x2411c1(_0x1abf7f[_0x5ae8('0x2b')][_0x5ae8('0x2d')]);}logger['error'](_0x5ae8('0x28'),_0x3540a1,_0x1abf7f['error'][_0x5ae8('0x2d')]);return _0x924fa7(_0x1abf7f['error'][_0x5ae8('0x2d')]);}else{logger[_0x5ae8('0x27')]('ChatMessage,\x20%s,\x20%s',_0x3540a1,_0x5ae8('0x29'));_0x924fa7(_0x1abf7f[_0x5ae8('0x2e')][_0x5ae8('0x2d')]);}})['catch'](function(_0x5e044b){logger['error'](_0x5ae8('0x28'),_0x3540a1,_0x5e044b);_0x2411c1(_0x5e044b);});});}function respondWithStatusCode(_0x2febaa,_0x56dafc){_0x56dafc=_0x56dafc||0xcc;return function(_0x28ddb1){if(_0x28ddb1){return _0x2febaa['sendStatus'](_0x56dafc);}return _0x2febaa['status'](_0x56dafc)[_0x5ae8('0x2f')]();};}function respondWithResult(_0x1fb87b,_0x3a52df){_0x3a52df=_0x3a52df||0xc8;return function(_0x51dd63){if(_0x51dd63){return _0x1fb87b[_0x5ae8('0x30')](_0x3a52df)[_0x5ae8('0x31')](_0x51dd63);}};}function respondWithFilteredResult(_0x4118ff,_0x3aa395){return function(_0x172651){if(_0x172651){var _0x4fc007=_0x172651[_0x5ae8('0x32')],_0x32894c=_0x3aa395[_0x5ae8('0x33')],_0x14a924=_0x3aa395[_0x5ae8('0x33')]+_0x3aa395['limit'],_0x4bade9;if(_0x14a924>=_0x4fc007){_0x14a924=_0x4fc007;_0x4bade9=0xc8;}else{_0x4bade9=0xce;}_0x4118ff[_0x5ae8('0x30')](_0x4bade9);return _0x4118ff['set'](_0x5ae8('0x34'),_0x32894c+'-'+_0x14a924+'/'+_0x4fc007)[_0x5ae8('0x31')](_0x172651);}return null;};}function patchUpdates(_0x9ff84c){return function(_0x58eeda){try{jsonpatch[_0x5ae8('0x35')](_0x58eeda,_0x9ff84c,!![]);}catch(_0x2e66fc){return BPromise[_0x5ae8('0x36')](_0x2e66fc);}return _0x58eeda['save']();};}function saveUpdates(_0x4fe14f,_0x2022a3){return function(_0x204d04){if(_0x204d04){return _0x204d04[_0x5ae8('0x37')](_0x4fe14f)['then'](function(_0x42c491){return _0x42c491;});}return null;};}function removeEntity(_0x16a31f,_0x7107b1){return function(_0x5e8d76){if(_0x5e8d76){return _0x5e8d76['destroy']()['then'](function(){_0x16a31f[_0x5ae8('0x30')](0xcc)[_0x5ae8('0x2f')]();});}};}function handleEntityNotFound(_0x2e6382,_0x918d77){return function(_0x5e95b4){if(!_0x5e95b4){_0x2e6382[_0x5ae8('0x38')](0x194);}return _0x5e95b4;};}function handleError(_0x1bad19,_0x387a86){_0x387a86=_0x387a86||0x1f4;return function(_0x15b05a){logger[_0x5ae8('0x2b')](_0x15b05a[_0x5ae8('0x39')]);if(_0x15b05a[_0x5ae8('0x3a')]){delete _0x15b05a[_0x5ae8('0x3a')];}_0x1bad19[_0x5ae8('0x30')](_0x387a86)[_0x5ae8('0x3b')](_0x15b05a);};}exports['index']=function(_0x42f3ba,_0x48a23b){var _0x3aaef5={},_0x36e14f={},_0x2ddba0={'count':0x0,'rows':[]};var _0x4d765e=_[_0x5ae8('0x3c')](db[_0x5ae8('0x3d')][_0x5ae8('0x3e')],function(_0x3a4b56){return{'name':_0x3a4b56[_0x5ae8('0x3f')],'type':_0x3a4b56['type'][_0x5ae8('0x40')]};});_0x36e14f[_0x5ae8('0x41')]=_[_0x5ae8('0x3c')](_0x4d765e,_0x5ae8('0x3a'));_0x36e14f[_0x5ae8('0x42')]=_[_0x5ae8('0x43')](_0x42f3ba['query']);_0x36e14f[_0x5ae8('0x44')]=_['intersection'](_0x36e14f['model'],_0x36e14f[_0x5ae8('0x42')]);_0x3aaef5[_0x5ae8('0x45')]=_[_0x5ae8('0x46')](_0x36e14f[_0x5ae8('0x41')],qs[_0x5ae8('0x47')](_0x42f3ba[_0x5ae8('0x42')][_0x5ae8('0x47')]));_0x3aaef5[_0x5ae8('0x45')]=_0x3aaef5[_0x5ae8('0x45')][_0x5ae8('0x48')]?_0x3aaef5[_0x5ae8('0x45')]:_0x36e14f['model'];if(!_0x42f3ba[_0x5ae8('0x42')]['hasOwnProperty'](_0x5ae8('0x49'))){_0x3aaef5[_0x5ae8('0x4a')]=qs[_0x5ae8('0x4a')](_0x42f3ba[_0x5ae8('0x42')][_0x5ae8('0x4a')]);_0x3aaef5[_0x5ae8('0x33')]=qs[_0x5ae8('0x33')](_0x42f3ba[_0x5ae8('0x42')][_0x5ae8('0x33')]);}_0x3aaef5[_0x5ae8('0x4b')]=qs[_0x5ae8('0x4c')](_0x42f3ba[_0x5ae8('0x42')][_0x5ae8('0x4c')]);_0x3aaef5[_0x5ae8('0x4d')]=qs[_0x5ae8('0x44')](_[_0x5ae8('0x4e')](_0x42f3ba[_0x5ae8('0x42')],_0x36e14f[_0x5ae8('0x44')]),_0x4d765e);if(_0x42f3ba[_0x5ae8('0x42')]['filter']){_0x3aaef5[_0x5ae8('0x4d')]=_[_0x5ae8('0x4f')](_0x3aaef5[_0x5ae8('0x4d')],{'$or':_['map'](_0x4d765e,function(_0x263df6){if(_0x263df6['type']!==_0x5ae8('0x50')){var _0x15d81e={};_0x15d81e[_0x263df6[_0x5ae8('0x3a')]]={'$like':'%'+_0x42f3ba[_0x5ae8('0x42')][_0x5ae8('0x51')]+'%'};return _0x15d81e;}})});}_0x3aaef5=_[_0x5ae8('0x4f')]({},_0x3aaef5,_0x42f3ba[_0x5ae8('0x52')]);var _0xb18c47={'where':_0x3aaef5[_0x5ae8('0x4d')]};return db['ChatMessage']['count'](_0xb18c47)[_0x5ae8('0x26')](function(_0x179db9){_0x2ddba0[_0x5ae8('0x32')]=_0x179db9;if(_0x42f3ba[_0x5ae8('0x42')][_0x5ae8('0x53')]){_0x3aaef5[_0x5ae8('0x54')]=[{'all':!![]}];}return db[_0x5ae8('0x3d')]['findAll'](_0x3aaef5);})[_0x5ae8('0x26')](function(_0x219d9a){_0x2ddba0[_0x5ae8('0x55')]=_0x219d9a;return _0x2ddba0;})[_0x5ae8('0x26')](respondWithFilteredResult(_0x48a23b,_0x3aaef5))['catch'](handleError(_0x48a23b,null));};exports['show']=function(_0x154b13,_0xcbbd2d){var _0x517466={'raw':!![],'where':{'id':_0x154b13[_0x5ae8('0x56')]['id']}},_0x379f45={};_0x379f45[_0x5ae8('0x41')]=_[_0x5ae8('0x43')](db[_0x5ae8('0x3d')][_0x5ae8('0x3e')]);_0x379f45[_0x5ae8('0x42')]=_['keys'](_0x154b13[_0x5ae8('0x42')]);_0x379f45['filters']=_[_0x5ae8('0x46')](_0x379f45[_0x5ae8('0x41')],_0x379f45[_0x5ae8('0x42')]);_0x517466[_0x5ae8('0x45')]=_[_0x5ae8('0x46')](_0x379f45[_0x5ae8('0x41')],qs[_0x5ae8('0x47')](_0x154b13[_0x5ae8('0x42')]['fields']));_0x517466[_0x5ae8('0x45')]=_0x517466['attributes'][_0x5ae8('0x48')]?_0x517466['attributes']:_0x379f45[_0x5ae8('0x41')];if(_0x154b13['query']['includeAll']){_0x517466['include']=[{'all':!![]}];}_0x517466=_[_0x5ae8('0x4f')]({},_0x517466,_0x154b13['options']);return db[_0x5ae8('0x3d')][_0x5ae8('0x57')](_0x517466)['then'](handleEntityNotFound(_0xcbbd2d,null))[_0x5ae8('0x26')](respondWithResult(_0xcbbd2d,null))[_0x5ae8('0x58')](handleError(_0xcbbd2d,null));};exports[_0x5ae8('0x59')]=function(_0x123f69,_0x1fc162){return db[_0x5ae8('0x3d')][_0x5ae8('0x59')](_0x123f69['body'],{})[_0x5ae8('0x26')](respondWithResult(_0x1fc162,0xc9))['catch'](handleError(_0x1fc162,null));};exports['update']=function(_0x5bbef3,_0x4974d3){if(_0x5bbef3['body']['id']){delete _0x5bbef3[_0x5ae8('0x5a')]['id'];}return db[_0x5ae8('0x3d')][_0x5ae8('0x57')]({'where':{'id':_0x5bbef3[_0x5ae8('0x56')]['id']}})[_0x5ae8('0x26')](handleEntityNotFound(_0x4974d3,null))[_0x5ae8('0x26')](saveUpdates(_0x5bbef3[_0x5ae8('0x5a')],null))[_0x5ae8('0x26')](respondWithResult(_0x4974d3,null))[_0x5ae8('0x58')](handleError(_0x4974d3,null));};exports[_0x5ae8('0x5b')]=function(_0x1bfa1c,_0x27a768){return db[_0x5ae8('0x3d')][_0x5ae8('0x57')]({'where':{'id':_0x1bfa1c[_0x5ae8('0x56')]['id']}})[_0x5ae8('0x26')](handleEntityNotFound(_0x27a768,null))['then'](removeEntity(_0x27a768,null))[_0x5ae8('0x58')](handleError(_0x27a768,null));};exports[_0x5ae8('0x5c')]=function(_0x39b55e,_0x11211a){return db[_0x5ae8('0x3d')][_0x5ae8('0x5c')]()[_0x5ae8('0x26')](respondWithResult(_0x11211a,null))['catch'](handleError(_0x11211a,null));};var interaction_log=require(_0x5ae8('0x15'))(_0x5ae8('0x5d'));exports[_0x5ae8('0x5e')]=function(_0x23c77c,_0x55b480,_0x5a48be){var _0x45e25b={'channel':_0x5ae8('0x5f')};if(_0x23c77c[_0x5ae8('0x5a')]['id']){delete _0x23c77c[_0x5ae8('0x5a')]['id'];}_0x23c77c[_0x5ae8('0x5a')][_0x5ae8('0x60')]=!![];_0x23c77c[_0x5ae8('0x5a')][_0x5ae8('0x61')]=moment()[_0x5ae8('0x62')](_0x5ae8('0x63'));_0x23c77c[_0x5ae8('0x5a')][_0x5ae8('0x64')]=_0x23c77c[_0x5ae8('0x5a')][_0x5ae8('0x64')]||_0x23c77c[_0x5ae8('0x65')]['id'];return db[_0x5ae8('0x3d')][_0x5ae8('0x57')]({'where':{'id':_0x23c77c[_0x5ae8('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x5ae8('0x66')}]})[_0x5ae8('0x26')](handleEntityNotFound(_0x55b480,null))[_0x5ae8('0x26')](saveUpdates(_0x23c77c[_0x5ae8('0x5a')],null))[_0x5ae8('0x26')](function(_0x68f439){if(_0x68f439){_0x45e25b[_0x5ae8('0x2d')]=_0x68f439[_0x5ae8('0x67')]({'plain':!![]});return db[_0x5ae8('0x68')][_0x5ae8('0x57')]({'where':{'id':_0x68f439[_0x5ae8('0x69')]}});}return null;})[_0x5ae8('0x26')](handleEntityNotFound(_0x55b480,null))['then'](function(_0x181728){if(_0x181728){return _0x181728[_0x5ae8('0x37')]({'UserId':_0x23c77c['body'][_0x5ae8('0x64')],'read1stAt':_[_0x5ae8('0x6a')](_0x181728[_0x5ae8('0x6b')])?moment()[_0x5ae8('0x62')](_0x5ae8('0x63')):undefined});}return null;})[_0x5ae8('0x26')](function(_0x103549){if(_0x103549){_0x45e25b[_0x5ae8('0x6c')]=_0x103549[_0x5ae8('0x67')]({'plain':!![]});interaction_log['info'](_0x5ae8('0x6d'),_0x23c77c[_0x5ae8('0x65')]['id'],_0x23c77c[_0x5ae8('0x65')][_0x5ae8('0x3a')],_0x23c77c[_0x5ae8('0x65')][_0x5ae8('0x6e')],_0x45e25b[_0x5ae8('0x6c')]['id'],_0x23c77c[_0x5ae8('0x5a')]?JSON[_0x5ae8('0x2a')](_0x23c77c['body']):_0x5ae8('0x6f'));return respondWithRpcPromise(_0x5ae8('0x70'),'acceptMessage',_0x45e25b);}return null;})['then'](function(_0xd36ce0){if(_0xd36ce0){if(_0x23c77c['body'][_0x5ae8('0x71')]){_0x45e25b[_0x5ae8('0x2d')][_0x5ae8('0x72')]=util[_0x5ae8('0x62')](_0x5ae8('0x73'),_0x23c77c[_0x5ae8('0x65')]['name']);_0x45e25b[_0x5ae8('0x2d')][_0x5ae8('0x74')]=_0x45e25b[_0x5ae8('0x74')];_0x45e25b[_0x5ae8('0x2d')][_0x5ae8('0x75')]=_0x5ae8('0x5e');return respondWithRpcPromise(_0x5ae8('0x76'),_0x5ae8('0x76'),{'event':'acceptmessage','message':_[_0x5ae8('0x4f')](_0x45e25b[_0x5ae8('0x2d')],JSON[_0x5ae8('0x77')](_0x45e25b[_0x5ae8('0x6c')][_0x5ae8('0x78')]))},client9002)[_0x5ae8('0x26')](function(){return _0x45e25b;});}return _0x45e25b;}return null;})['then'](respondWithResult(_0x55b480,null))['catch'](handleError(_0x55b480,null));};var interaction_log=require('../../config/logger')(_0x5ae8('0x5d'));exports[_0x5ae8('0x36')]=function(_0x2162f1,_0x4cd6c9,_0x39a693){var _0x4bd390={'agent':{},'channel':'chat'};if(_0x2162f1[_0x5ae8('0x5a')]['id']){delete _0x2162f1[_0x5ae8('0x5a')]['id'];}_0x2162f1['body']['UserId']=_0x2162f1[_0x5ae8('0x5a')][_0x5ae8('0x64')]||_0x2162f1[_0x5ae8('0x65')]['id'];_0x4bd390[_0x5ae8('0x79')]['id']=_0x2162f1[_0x5ae8('0x5a')]['UserId'];return db[_0x5ae8('0x3d')][_0x5ae8('0x57')]({'where':{'id':_0x2162f1[_0x5ae8('0x56')]['id'],'UserId':null}})[_0x5ae8('0x26')](handleEntityNotFound(_0x4cd6c9,null))[_0x5ae8('0x26')](function(_0x20427d){if(_0x20427d){_0x4bd390[_0x5ae8('0x2d')]=_0x20427d[_0x5ae8('0x67')]({'plain':!![]});return db[_0x5ae8('0x68')][_0x5ae8('0x57')]({'where':{'id':_0x20427d['ChatInteractionId']}});}return null;})[_0x5ae8('0x26')](handleEntityNotFound(_0x4cd6c9,null))['then'](function(_0x2fb7f1){if(_0x2fb7f1){_0x4bd390['interaction']=_0x2fb7f1['get']({'plain':!![]});interaction_log[_0x5ae8('0x27')](_0x5ae8('0x7a'),_0x2162f1['user']['id'],_0x2162f1['user'][_0x5ae8('0x3a')],_0x2162f1[_0x5ae8('0x65')][_0x5ae8('0x6e')],_0x4bd390['interaction']['id'],_0x2162f1[_0x5ae8('0x5a')]?JSON[_0x5ae8('0x2a')](_0x2162f1[_0x5ae8('0x5a')]):_0x5ae8('0x6f'));return respondWithRpcPromise('RejectMessage',_0x5ae8('0x7b'),_0x4bd390);}return null;})[_0x5ae8('0x26')](function(_0x36d324){if(_0x36d324){_0x36d324[_0x5ae8('0x2d')][_0x5ae8('0x72')]=util[_0x5ae8('0x62')](_0x5ae8('0x73'),_0x2162f1['user'][_0x5ae8('0x3a')]);_0x36d324[_0x5ae8('0x2d')]['channel']=_0x4bd390[_0x5ae8('0x74')];_0x36d324[_0x5ae8('0x2d')][_0x5ae8('0x75')]=_0x5ae8('0x36');respondWithRpcPromise(_0x5ae8('0x76'),_0x5ae8('0x76'),{'event':_0x5ae8('0x7c'),'message':_0x36d324[_0x5ae8('0x2d')]},client9002);return _0x4bd390;}return null;})['then'](respondWithResult(_0x4cd6c9,null))['catch'](handleError(_0x4cd6c9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 3b2ae90..c061a16 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 _0x54b1=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0x54b1,0x151));var _0x154b=function(_0x2d2c60,_0x29e1ea){_0x2d2c60=_0x2d2c60-0x0;var _0x1b9816=_0x54b1[_0x2d2c60];return _0x1b9816;};'use strict';var EventEmitter=require(_0x154b('0x0'));var ChatMessage=require(_0x154b('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x154b('0x2')](0x0);var events={'afterCreate':_0x154b('0x3'),'afterUpdate':_0x154b('0x4'),'afterDestroy':_0x154b('0x5')};function emitEvent(_0x116fcf){return function(_0x31e508,_0x5dc792,_0x284f71){ChatMessageEvents['emit'](_0x116fcf+':'+_0x31e508['id'],_0x31e508);ChatMessageEvents[_0x154b('0x6')](_0x116fcf,_0x31e508);_0x284f71(null);};}for(var e in events){if(events[_0x154b('0x7')](e)){var event=events[e];ChatMessage[_0x154b('0x8')](e,emitEvent(event));}}module[_0x154b('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x7310=['hook','events','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x7310,0x119));var _0x0731=function(_0x1e7732,_0x4f8002){_0x1e7732=_0x1e7732-0x0;var _0x36266c=_0x7310[_0x1e7732];return _0x36266c;};'use strict';var EventEmitter=require(_0x0731('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x0731('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0731('0x2')](0x0);var events={'afterCreate':_0x0731('0x3'),'afterUpdate':_0x0731('0x4'),'afterDestroy':_0x0731('0x5')};function emitEvent(_0x499208){return function(_0x3860d5,_0x21652b,_0x10bda0){ChatMessageEvents[_0x0731('0x6')](_0x499208+':'+_0x3860d5['id'],_0x3860d5);ChatMessageEvents[_0x0731('0x6')](_0x499208,_0x3860d5);_0x10bda0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x0731('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c16b3e9..eee5972 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 _0x090a=['../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x090a,0x1cf));var _0xa090=function(_0x580f53,_0x634e22){_0x580f53=_0x580f53-0x0;var _0x12c8fc=_0x090a[_0x580f53];return _0x12c8fc;};'use strict';var _=require(_0xa090('0x0'));var util=require(_0xa090('0x1'));var logger=require(_0xa090('0x2'))(_0xa090('0x3'));var moment=require(_0xa090('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa090('0x5'));var rimraf=require(_0xa090('0x6'));var config=require(_0xa090('0x7'));var attributes=require('./chatMessage.attributes');module[_0xa090('0x8')]=function(_0x55a9f3,_0x382efc){return _0x55a9f3[_0xa090('0x9')](_0xa090('0xa'),attributes,{'tableName':_0xa090('0xb'),'paranoid':![],'indexes':[{'name':_0xa090('0xc'),'fields':[_0xa090('0xd')],'type':_0xa090('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x212e97,_0x56092a,_0x16fd0e){var _0x7a03d3=_0x55a9f3['models'];var _0x46353c=_0x212e97[_0xa090('0xf')]({'plain':!![]});if(_0x46353c[_0xa090('0x10')][_0xa090('0x11')]()==='in'||_0x46353c['direction'][_0xa090('0x11')]()==='out'&&!_0x46353c[_0xa090('0x12')]&&!_[_0xa090('0x13')](_0x46353c[_0xa090('0x14')])){_0x7a03d3[_0xa090('0x15')][_0xa090('0x16')]({'where':{'id':_0x46353c[_0xa090('0x17')]}})[_0xa090('0x18')](function(_0x460d18){if(_0x460d18){_0x460d18[_0xa090('0x19')]({'lastMsgAt':_0x46353c[_0xa090('0x1a')],'lastMsgDirection':_0x46353c[_0xa090('0x10')][_0xa090('0x11')]()});}})[_0xa090('0x1b')](function(_0x252838){console[_0xa090('0x1c')](_0x252838);});}_0x16fd0e();}},'charset':_0xa090('0x1d'),'collate':_0xa090('0x1e')});}; \ No newline at end of file +var _0xfd85=['FULLTEXT','get','direction','toLowerCase','out','secret','isNil','findOne','ChatInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages'];(function(_0x4b1d79,_0xcb5943){var _0x3f2b39=function(_0x2a4396){while(--_0x2a4396){_0x4b1d79['push'](_0x4b1d79['shift']());}};_0x3f2b39(++_0xcb5943);}(_0xfd85,0x16c));var _0x5fd8=function(_0x52282a,_0x45aef7){_0x52282a=_0x52282a-0x0;var _0x3c66b4=_0xfd85[_0x52282a];return _0x3c66b4;};'use strict';var _=require(_0x5fd8('0x0'));var util=require(_0x5fd8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5fd8('0x2'));var BPromise=require('bluebird');var rp=require(_0x5fd8('0x3'));var fs=require('fs');var path=require(_0x5fd8('0x4'));var rimraf=require(_0x5fd8('0x5'));var config=require(_0x5fd8('0x6'));var attributes=require('./chatMessage.attributes');module[_0x5fd8('0x7')]=function(_0x2d82e9,_0x38b22e){return _0x2d82e9[_0x5fd8('0x8')]('ChatMessage',attributes,{'tableName':_0x5fd8('0x9'),'paranoid':![],'indexes':[{'name':_0x5fd8('0xa'),'fields':['body'],'type':_0x5fd8('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42581d,_0x55c16e,_0x27bafb){var _0x4c532c=_0x2d82e9['models'];var _0x58d474=_0x42581d[_0x5fd8('0xc')]({'plain':!![]});if(_0x58d474[_0x5fd8('0xd')][_0x5fd8('0xe')]()==='in'||_0x58d474[_0x5fd8('0xd')][_0x5fd8('0xe')]()===_0x5fd8('0xf')&&!_0x58d474[_0x5fd8('0x10')]&&!_[_0x5fd8('0x11')](_0x58d474['UserId'])){_0x4c532c['ChatInteraction'][_0x5fd8('0x12')]({'where':{'id':_0x58d474[_0x5fd8('0x13')]}})[_0x5fd8('0x14')](function(_0x3e8b16){if(_0x3e8b16){_0x3e8b16['update']({'lastMsgAt':_0x58d474[_0x5fd8('0x15')],'lastMsgDirection':_0x58d474['direction'][_0x5fd8('0xe')]()});}})['catch'](function(_0x2ba09a){console[_0x5fd8('0x16')](_0x2ba09a);});}_0x27bafb();}},'charset':_0x5fd8('0x17'),'collate':_0x5fd8('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4d268dc..c01766f 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 _0x1cba=['then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateChatMessage','ChatMessage','body','options','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','localhost','./chatMessage.socket','register','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1cba,0x188));var _0xa1cb=function(_0x36a560,_0x57378b){_0x36a560=_0x36a560-0x0;var _0x10923a=_0x1cba[_0x36a560];return _0x10923a;};'use strict';var _=require(_0xa1cb('0x0'));var util=require(_0xa1cb('0x1'));var moment=require('moment');var BPromise=require(_0xa1cb('0x2'));var rs=require(_0xa1cb('0x3'));var fs=require('fs');var Redis=require(_0xa1cb('0x4'));var db=require(_0xa1cb('0x5'))['db'];var utils=require(_0xa1cb('0x6'));var logger=require('../../config/logger')(_0xa1cb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa1cb('0x8')]({'port':0x232a});config[_0xa1cb('0x9')]=_['defaults'](config['redis'],{'host':_0xa1cb('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa1cb('0xb'))[_0xa1cb('0xc')](socket);function respondWithRpcPromise(_0x249872,_0x43995f,_0x4ce661){return new BPromise(function(_0x9edae,_0x4df8ae){return client[_0xa1cb('0xd')](_0x249872,_0x4ce661)[_0xa1cb('0xe')](function(_0x216a83){logger[_0xa1cb('0xf')](_0xa1cb('0x10'),_0x43995f,'request\x20sent');logger[_0xa1cb('0x11')](_0xa1cb('0x12'),_0x43995f,_0xa1cb('0x13'),JSON[_0xa1cb('0x14')](_0x216a83));if(_0x216a83[_0xa1cb('0x15')]){if(_0x216a83[_0xa1cb('0x15')]['code']===0x1f4){logger[_0xa1cb('0x15')](_0xa1cb('0x10'),_0x43995f,_0x216a83['error'][_0xa1cb('0x16')]);return _0x4df8ae(_0x216a83[_0xa1cb('0x15')][_0xa1cb('0x16')]);}logger[_0xa1cb('0x15')](_0xa1cb('0x10'),_0x43995f,_0x216a83[_0xa1cb('0x15')][_0xa1cb('0x16')]);return _0x9edae(_0x216a83[_0xa1cb('0x15')][_0xa1cb('0x16')]);}else{logger['info'](_0xa1cb('0x10'),_0x43995f,_0xa1cb('0x13'));_0x9edae(_0x216a83[_0xa1cb('0x17')][_0xa1cb('0x16')]);}})['catch'](function(_0x1ca435){logger[_0xa1cb('0x15')](_0xa1cb('0x10'),_0x43995f,_0x1ca435);_0x4df8ae(_0x1ca435);});});}exports[_0xa1cb('0x18')]=function(_0xae928a){var _0x2da30c=this;return new Promise(function(_0x12dc8b,_0xeb5ad3){return db[_0xa1cb('0x19')]['create'](_0xae928a[_0xa1cb('0x1a')],{'raw':_0xae928a[_0xa1cb('0x1b')]?_0xae928a[_0xa1cb('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xa1cb('0xe')](function(_0x3d7eec){logger[_0xa1cb('0xf')](_0xa1cb('0x18'),_0xae928a);logger[_0xa1cb('0x11')](_0xa1cb('0x18'),_0xae928a,JSON[_0xa1cb('0x14')](_0x3d7eec));_0x12dc8b(_0x3d7eec);})[_0xa1cb('0x1c')](function(_0xb9f9a4){logger[_0xa1cb('0x15')]('CreateChatMessage',_0xb9f9a4[_0xa1cb('0x16')],_0xae928a);_0xeb5ad3(_0x2da30c['error'](0x1f4,_0xb9f9a4[_0xa1cb('0x16')]));});});}; \ No newline at end of file +var _0x81f1=['jayson/promise','client','http','redis','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x81f1,0x129));var _0x181f=function(_0x5c63a4,_0x496024){_0x5c63a4=_0x5c63a4-0x0;var _0x557ae1=_0x81f1[_0x5c63a4];return _0x557ae1;};'use strict';var _=require(_0x181f('0x0'));var util=require(_0x181f('0x1'));var moment=require(_0x181f('0x2'));var BPromise=require(_0x181f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x181f('0x4'))['db'];var utils=require(_0x181f('0x5'));var logger=require(_0x181f('0x6'))(_0x181f('0x7'));var config=require(_0x181f('0x8'));var jayson=require(_0x181f('0x9'));var client=jayson[_0x181f('0xa')][_0x181f('0xb')]({'port':0x232a});config[_0x181f('0xc')]=_['defaults'](config[_0x181f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x181f('0xd'))(new Redis(config['redis']));require(_0x181f('0xe'))[_0x181f('0xf')](socket);function respondWithRpcPromise(_0x5e7462,_0xb7451,_0x23c983){return new BPromise(function(_0x138dab,_0x2b70aa){return client[_0x181f('0x10')](_0x5e7462,_0x23c983)[_0x181f('0x11')](function(_0x94bd12){logger[_0x181f('0x12')]('ChatMessage,\x20%s,\x20%s',_0xb7451,_0x181f('0x13'));logger['debug'](_0x181f('0x14'),_0xb7451,_0x181f('0x13'),JSON[_0x181f('0x15')](_0x94bd12));if(_0x94bd12[_0x181f('0x16')]){if(_0x94bd12[_0x181f('0x16')][_0x181f('0x17')]===0x1f4){logger[_0x181f('0x16')](_0x181f('0x18'),_0xb7451,_0x94bd12[_0x181f('0x16')][_0x181f('0x19')]);return _0x2b70aa(_0x94bd12['error']['message']);}logger[_0x181f('0x16')](_0x181f('0x18'),_0xb7451,_0x94bd12[_0x181f('0x16')][_0x181f('0x19')]);return _0x138dab(_0x94bd12['error'][_0x181f('0x19')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0xb7451,'request\x20sent');_0x138dab(_0x94bd12[_0x181f('0x1a')][_0x181f('0x19')]);}})[_0x181f('0x1b')](function(_0x47d686){logger[_0x181f('0x16')](_0x181f('0x18'),_0xb7451,_0x47d686);_0x2b70aa(_0x47d686);});});}exports[_0x181f('0x1c')]=function(_0x4cdca7){var _0x3dd6ff=this;return new Promise(function(_0x27e8ed,_0xdd604){return db[_0x181f('0x1d')][_0x181f('0x1e')](_0x4cdca7[_0x181f('0x1f')],{'raw':_0x4cdca7[_0x181f('0x20')]?_0x4cdca7['options'][_0x181f('0x21')]===undefined?!![]:![]:!![]})[_0x181f('0x11')](function(_0x5f1eb7){logger[_0x181f('0x12')](_0x181f('0x1c'),_0x4cdca7);logger['debug'](_0x181f('0x1c'),_0x4cdca7,JSON['stringify'](_0x5f1eb7));_0x27e8ed(_0x5f1eb7);})['catch'](function(_0x2e654b){logger[_0x181f('0x16')](_0x181f('0x1c'),_0x2e654b[_0x181f('0x19')],_0x4cdca7);_0xdd604(_0x3dd6ff['error'](0x1f4,_0x2e654b[_0x181f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6bc43a1..d855e2a 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 _0xd117=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x1e7ffa,_0x21f9e4){var _0x5dbae8=function(_0x13c2da){while(--_0x13c2da){_0x1e7ffa['push'](_0x1e7ffa['shift']());}};_0x5dbae8(++_0x21f9e4);}(_0xd117,0x182));var _0x7d11=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xd117[_0xf73c09];return _0xa8923c;};'use strict';var ChatMessageEvents=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(){ChatMessageEvents[_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);ChatMessageEvents['on'](_0x47b5e6,_0x3803b5);}}; \ No newline at end of file +var _0x781d=['chatMessage:','./chatMessage.events','save','emit','removeListener','register','length'];(function(_0x454fb2,_0x3531af){var _0x521faa=function(_0xc0b7af){while(--_0xc0b7af){_0x454fb2['push'](_0x454fb2['shift']());}};_0x521faa(++_0x3531af);}(_0x781d,0x14a));var _0xd781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x781d[_0x618414];return _0x21c19a;};'use strict';var ChatMessageEvents=require(_0xd781('0x0'));var events=[_0xd781('0x1'),'remove','update'];function createListener(_0xb125bf,_0x44a72d){return function(_0x3cd308){_0x44a72d[_0xd781('0x2')](_0xb125bf,_0x3cd308);};}function removeListener(_0xfd915d,_0x42258e){return function(){ChatMessageEvents[_0xd781('0x3')](_0xfd915d,_0x42258e);};}exports[_0xd781('0x4')]=function(_0x830b){for(var _0x2f98ee=0x0,_0x5a07f0=events[_0xd781('0x5')];_0x2f98ee<_0x5a07f0;_0x2f98ee++){var _0x1a242d=events[_0x2f98ee];var _0x50610d=createListener(_0xd781('0x6')+_0x1a242d,_0x830b);ChatMessageEvents['on'](_0x1a242d,_0x50610d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 84ca741..e7862f1 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 _0x29db=['show','post','tracked','chat','chatmessage:create','update','put','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4d40a2,_0x46f6bd){var _0x3d8c00=function(_0x419cb6){while(--_0x419cb6){_0x4d40a2['push'](_0x4d40a2['shift']());}};_0x3d8c00(++_0x46f6bd);}(_0x29db,0x1c5));var _0xb29d=function(_0x2ec0f,_0x256d14){_0x2ec0f=_0x2ec0f-0x0;var _0x2f0861=_0x29db[_0x2ec0f];return _0x2f0861;};'use strict';var multer=require(_0xb29d('0x0'));var util=require(_0xb29d('0x1'));var path=require(_0xb29d('0x2'));var timeout=require(_0xb29d('0x3'));var express=require('express');var router=express[_0xb29d('0x4')]();var auth=require(_0xb29d('0x5'));var interaction=require(_0xb29d('0x6'));var config=require(_0xb29d('0x7'));var controller=require(_0xb29d('0x8'));router[_0xb29d('0x9')]('/',auth[_0xb29d('0xa')](),controller[_0xb29d('0xb')]);router[_0xb29d('0x9')](_0xb29d('0xc'),auth[_0xb29d('0xa')](),controller[_0xb29d('0xd')]);router[_0xb29d('0x9')](_0xb29d('0xe'),auth[_0xb29d('0xa')](),controller[_0xb29d('0xf')]);router[_0xb29d('0x10')]('/',auth[_0xb29d('0xa')](),interaction[_0xb29d('0x11')](_0xb29d('0x12'),_0xb29d('0x13')),controller['create']);router['put']('/:id',controller[_0xb29d('0x14')]);router[_0xb29d('0x15')]('/:id/accept',auth[_0xb29d('0xa')](),controller['accept']);router[_0xb29d('0x15')]('/:id/reject',auth[_0xb29d('0xa')](),controller[_0xb29d('0x16')]);router[_0xb29d('0x17')](_0xb29d('0xe'),auth[_0xb29d('0xa')](),controller[_0xb29d('0x18')]);module[_0xb29d('0x19')]=router; \ No newline at end of file +var _0x35fe=['put','update','/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chatmessage:create'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x35fe,0xb7));var _0xe35f=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x35fe[_0x817d9b];return _0x2752e1;};'use strict';var multer=require(_0xe35f('0x0'));var util=require(_0xe35f('0x1'));var path=require(_0xe35f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe35f('0x3'));var config=require(_0xe35f('0x4'));var controller=require('./chatMessage.controller');router[_0xe35f('0x5')]('/',auth[_0xe35f('0x6')](),controller[_0xe35f('0x7')]);router[_0xe35f('0x5')](_0xe35f('0x8'),auth[_0xe35f('0x6')](),controller[_0xe35f('0x9')]);router['get'](_0xe35f('0xa'),auth[_0xe35f('0x6')](),controller[_0xe35f('0xb')]);router[_0xe35f('0xc')]('/',auth[_0xe35f('0x6')](),interaction[_0xe35f('0xd')]('chat',_0xe35f('0xe')),controller['create']);router[_0xe35f('0xf')](_0xe35f('0xa'),controller[_0xe35f('0x10')]);router[_0xe35f('0xf')](_0xe35f('0x11'),auth[_0xe35f('0x6')](),controller[_0xe35f('0x12')]);router[_0xe35f('0xf')](_0xe35f('0x13'),auth[_0xe35f('0x6')](),controller[_0xe35f('0x14')]);router['delete'](_0xe35f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xe35f('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 3eaae24..2917ae9 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 _0x838b=['sequelize','exports','medium'];(function(_0x16880b,_0x297ccb){var _0x2f9c97=function(_0xb1534f){while(--_0xb1534f){_0x16880b['push'](_0x16880b['shift']());}};_0x2f9c97(++_0x297ccb);}(_0x838b,0x15c));var _0xb838=function(_0x302180,_0x398873){_0x302180=_0x302180-0x0;var _0x14634b=_0x838b[_0x302180];return _0x14634b;};'use strict';var Sequelize=require(_0xb838('0x0'));module[_0xb838('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb838('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xcc66=['medium','sequelize','exports'];(function(_0x1fe64f,_0x479dfb){var _0x45fdf5=function(_0x284cb9){while(--_0x284cb9){_0x1fe64f['push'](_0x1fe64f['shift']());}};_0x45fdf5(++_0x479dfb);}(_0xcc66,0x121));var _0x6cc6=function(_0x33e396,_0x2645eb){_0x33e396=_0x33e396-0x0;var _0x53d012=_0xcc66[_0x33e396];return _0x53d012;};'use strict';var Sequelize=require(_0x6cc6('0x0'));module[_0x6cc6('0x1')]={'body':{'type':Sequelize['TEXT'](_0x6cc6('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 624d810..49fc0fb 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 _0xf2ca=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','keys','find','create','body','describe','html-pdf','eml-format','rimraf'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x80bea0,_0x4c30f4){_0x80bea0=_0x80bea0-0x0;var _0x50fb90=_0xf2ca[_0x80bea0];return _0x50fb90;};'use strict';var pdf=require(_0xaf2c('0x0'));var emlformat=require(_0xaf2c('0x1'));var rimraf=require(_0xaf2c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf2c('0x3'));var rp=require(_0xaf2c('0x4'));var moment=require(_0xaf2c('0x5'));var BPromise=require(_0xaf2c('0x6'));var Mustache=require(_0xaf2c('0x7'));var util=require(_0xaf2c('0x8'));var path=require('path');var sox=require(_0xaf2c('0x9'));var csv=require(_0xaf2c('0xa'));var ejs=require(_0xaf2c('0xb'));var fs=require('fs');var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0xa'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var db=require(_0xaf2c('0x16'))['db'];function respondWithStatusCode(_0xd56a5d,_0x285dac){_0x285dac=_0x285dac||0xcc;return function(_0x59a59b){if(_0x59a59b){return _0xd56a5d['sendStatus'](_0x285dac);}return _0xd56a5d[_0xaf2c('0x17')](_0x285dac)[_0xaf2c('0x18')]();};}function respondWithResult(_0x935959,_0x18a8a5){_0x18a8a5=_0x18a8a5||0xc8;return function(_0x293ca6){if(_0x293ca6){return _0x935959[_0xaf2c('0x17')](_0x18a8a5)[_0xaf2c('0x19')](_0x293ca6);}};}function respondWithFilteredResult(_0x3c1088,_0x2119c8){return function(_0x1d0633){if(_0x1d0633){var _0x6ac8e=_0x1d0633[_0xaf2c('0x1a')],_0x2b4d13=_0x2119c8['offset'],_0x26bf7b=_0x2119c8[_0xaf2c('0x1b')]+_0x2119c8['limit'],_0x3432e4;if(_0x26bf7b>=_0x6ac8e){_0x26bf7b=_0x6ac8e;_0x3432e4=0xc8;}else{_0x3432e4=0xce;}_0x3c1088[_0xaf2c('0x17')](_0x3432e4);return _0x3c1088[_0xaf2c('0x1c')](_0xaf2c('0x1d'),_0x2b4d13+'-'+_0x26bf7b+'/'+_0x6ac8e)['json'](_0x1d0633);}return null;};}function patchUpdates(_0x28ae7b){return function(_0x297bcd){try{jsonpatch[_0xaf2c('0x1e')](_0x297bcd,_0x28ae7b,!![]);}catch(_0x20000b){return BPromise[_0xaf2c('0x1f')](_0x20000b);}return _0x297bcd[_0xaf2c('0x20')]();};}function saveUpdates(_0x531609,_0x35e712){return function(_0x164bcb){if(_0x164bcb){return _0x164bcb[_0xaf2c('0x21')](_0x531609)[_0xaf2c('0x22')](function(_0x237318){return _0x237318;});}return null;};}function removeEntity(_0x486de2,_0x396646){return function(_0xbf6f62){if(_0xbf6f62){return _0xbf6f62[_0xaf2c('0x23')]()['then'](function(){_0x486de2['status'](0xcc)[_0xaf2c('0x18')]();});}};}function handleEntityNotFound(_0x303546,_0x1cafad){return function(_0x99f78d){if(!_0x99f78d){_0x303546['sendStatus'](0x194);}return _0x99f78d;};}function handleError(_0x2b8f1a,_0xf1a7cf){_0xf1a7cf=_0xf1a7cf||0x1f4;return function(_0x3a0145){logger[_0xaf2c('0x24')](_0x3a0145[_0xaf2c('0x25')]);if(_0x3a0145[_0xaf2c('0x26')]){delete _0x3a0145[_0xaf2c('0x26')];}_0x2b8f1a['status'](_0xf1a7cf)[_0xaf2c('0x27')](_0x3a0145);};}exports[_0xaf2c('0x28')]=function(_0x36f37c,_0x410536){var _0x4b7cf2={},_0x3fb190={},_0x589d47={'count':0x0,'rows':[]};var _0x38db1b=_[_0xaf2c('0x29')](db[_0xaf2c('0x2a')]['rawAttributes'],function(_0x2747bb){return{'name':_0x2747bb[_0xaf2c('0x2b')],'type':_0x2747bb[_0xaf2c('0x2c')]['key']};});_0x3fb190[_0xaf2c('0x2d')]=_[_0xaf2c('0x29')](_0x38db1b,_0xaf2c('0x26'));_0x3fb190[_0xaf2c('0x2e')]=_['keys'](_0x36f37c[_0xaf2c('0x2e')]);_0x3fb190[_0xaf2c('0x2f')]=_[_0xaf2c('0x30')](_0x3fb190['model'],_0x3fb190['query']);_0x4b7cf2[_0xaf2c('0x31')]=_['intersection'](_0x3fb190[_0xaf2c('0x2d')],qs['fields'](_0x36f37c[_0xaf2c('0x2e')][_0xaf2c('0x32')]));_0x4b7cf2['attributes']=_0x4b7cf2[_0xaf2c('0x31')][_0xaf2c('0x33')]?_0x4b7cf2['attributes']:_0x3fb190[_0xaf2c('0x2d')];if(!_0x36f37c[_0xaf2c('0x2e')][_0xaf2c('0x34')](_0xaf2c('0x35'))){_0x4b7cf2[_0xaf2c('0x36')]=qs[_0xaf2c('0x36')](_0x36f37c['query'][_0xaf2c('0x36')]);_0x4b7cf2['offset']=qs[_0xaf2c('0x1b')](_0x36f37c['query'][_0xaf2c('0x1b')]);}_0x4b7cf2['order']=qs[_0xaf2c('0x37')](_0x36f37c['query'][_0xaf2c('0x37')]);_0x4b7cf2['where']=qs[_0xaf2c('0x2f')](_[_0xaf2c('0x38')](_0x36f37c[_0xaf2c('0x2e')],_0x3fb190[_0xaf2c('0x2f')]),_0x38db1b);if(_0x36f37c[_0xaf2c('0x2e')]['filter']){_0x4b7cf2['where']=_[_0xaf2c('0x39')](_0x4b7cf2[_0xaf2c('0x3a')],{'$or':_[_0xaf2c('0x29')](_0x38db1b,function(_0xa44813){if(_0xa44813[_0xaf2c('0x2c')]!==_0xaf2c('0x3b')){var _0x573db3={};_0x573db3[_0xa44813[_0xaf2c('0x26')]]={'$like':'%'+_0x36f37c[_0xaf2c('0x2e')]['filter']+'%'};return _0x573db3;}})});}_0x4b7cf2=_[_0xaf2c('0x39')]({},_0x4b7cf2,_0x36f37c[_0xaf2c('0x3c')]);var _0x25bebd={'where':_0x4b7cf2[_0xaf2c('0x3a')]};return db[_0xaf2c('0x2a')][_0xaf2c('0x1a')](_0x25bebd)[_0xaf2c('0x22')](function(_0x310d3b){_0x589d47[_0xaf2c('0x1a')]=_0x310d3b;if(_0x36f37c[_0xaf2c('0x2e')][_0xaf2c('0x3d')]){_0x4b7cf2[_0xaf2c('0x3e')]=[{'all':!![]}];}return db[_0xaf2c('0x2a')]['findAll'](_0x4b7cf2);})['then'](function(_0x4db7d0){_0x589d47[_0xaf2c('0x3f')]=_0x4db7d0;return _0x589d47;})[_0xaf2c('0x22')](respondWithFilteredResult(_0x410536,_0x4b7cf2))[_0xaf2c('0x40')](handleError(_0x410536,null));};exports[_0xaf2c('0x41')]=function(_0x715f39,_0x29460c){var _0x51c441={'raw':!![],'where':{'id':_0x715f39[_0xaf2c('0x42')]['id']}},_0x1d58bd={};_0x1d58bd[_0xaf2c('0x2d')]=_['keys'](db['ChatOfflineMessage'][_0xaf2c('0x43')]);_0x1d58bd['query']=_[_0xaf2c('0x44')](_0x715f39[_0xaf2c('0x2e')]);_0x1d58bd[_0xaf2c('0x2f')]=_[_0xaf2c('0x30')](_0x1d58bd['model'],_0x1d58bd[_0xaf2c('0x2e')]);_0x51c441['attributes']=_[_0xaf2c('0x30')](_0x1d58bd[_0xaf2c('0x2d')],qs['fields'](_0x715f39[_0xaf2c('0x2e')]['fields']));_0x51c441[_0xaf2c('0x31')]=_0x51c441[_0xaf2c('0x31')][_0xaf2c('0x33')]?_0x51c441[_0xaf2c('0x31')]:_0x1d58bd[_0xaf2c('0x2d')];if(_0x715f39[_0xaf2c('0x2e')][_0xaf2c('0x3d')]){_0x51c441[_0xaf2c('0x3e')]=[{'all':!![]}];}_0x51c441=_[_0xaf2c('0x39')]({},_0x51c441,_0x715f39['options']);return db['ChatOfflineMessage'][_0xaf2c('0x45')](_0x51c441)['then'](handleEntityNotFound(_0x29460c,null))['then'](respondWithResult(_0x29460c,null))['catch'](handleError(_0x29460c,null));};exports[_0xaf2c('0x46')]=function(_0x964b76,_0x3cabd4){return db[_0xaf2c('0x2a')]['create'](_0x964b76[_0xaf2c('0x47')],{})['then'](respondWithResult(_0x3cabd4,0xc9))[_0xaf2c('0x40')](handleError(_0x3cabd4,null));};exports['update']=function(_0x166c26,_0x133e8c){if(_0x166c26[_0xaf2c('0x47')]['id']){delete _0x166c26[_0xaf2c('0x47')]['id'];}return db[_0xaf2c('0x2a')]['find']({'where':{'id':_0x166c26[_0xaf2c('0x42')]['id']}})[_0xaf2c('0x22')](handleEntityNotFound(_0x133e8c,null))['then'](saveUpdates(_0x166c26['body'],null))[_0xaf2c('0x22')](respondWithResult(_0x133e8c,null))['catch'](handleError(_0x133e8c,null));};exports[_0xaf2c('0x23')]=function(_0x23642b,_0x17b9ec){return db[_0xaf2c('0x2a')][_0xaf2c('0x45')]({'where':{'id':_0x23642b[_0xaf2c('0x42')]['id']}})[_0xaf2c('0x22')](handleEntityNotFound(_0x17b9ec,null))[_0xaf2c('0x22')](removeEntity(_0x17b9ec,null))[_0xaf2c('0x40')](handleError(_0x17b9ec,null));};exports[_0xaf2c('0x48')]=function(_0x371486,_0x5bf349){return db[_0xaf2c('0x2a')][_0xaf2c('0x48')]()['then'](respondWithResult(_0x5bf349,null))['catch'](handleError(_0x5bf349,null));}; \ No newline at end of file +var _0x7da7=['api','../../config/utils','../../mysqldb','status','end','json','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','filter','where','VIRTUAL','merge','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','ChatOfflineMessage','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x13a01d,_0x553459){var _0xd5383e=function(_0x136b7b){while(--_0x136b7b){_0x13a01d['push'](_0x13a01d['shift']());}};_0xd5383e(++_0x553459);}(_0x7da7,0x10d));var _0x77da=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x7da7[_0x10f6e8];return _0x35bb3c;};'use strict';var pdf=require(_0x77da('0x0'));var emlformat=require(_0x77da('0x1'));var rimraf=require(_0x77da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77da('0x3'));var moment=require(_0x77da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77da('0x5'));var util=require(_0x77da('0x6'));var path=require('path');var sox=require(_0x77da('0x7'));var csv=require(_0x77da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x8'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var db=require(_0x77da('0x15'))['db'];function respondWithStatusCode(_0x3bcea0,_0x2acc65){_0x2acc65=_0x2acc65||0xcc;return function(_0x5d6e2f){if(_0x5d6e2f){return _0x3bcea0['sendStatus'](_0x2acc65);}return _0x3bcea0[_0x77da('0x16')](_0x2acc65)[_0x77da('0x17')]();};}function respondWithResult(_0x589aa1,_0x3b0ff2){_0x3b0ff2=_0x3b0ff2||0xc8;return function(_0x369df0){if(_0x369df0){return _0x589aa1[_0x77da('0x16')](_0x3b0ff2)[_0x77da('0x18')](_0x369df0);}};}function respondWithFilteredResult(_0x519253,_0x2172d0){return function(_0x4e130c){if(_0x4e130c){var _0x29cd7b=_0x4e130c['count'],_0x366443=_0x2172d0['offset'],_0x1b0e17=_0x2172d0['offset']+_0x2172d0['limit'],_0x4500c4;if(_0x1b0e17>=_0x29cd7b){_0x1b0e17=_0x29cd7b;_0x4500c4=0xc8;}else{_0x4500c4=0xce;}_0x519253[_0x77da('0x16')](_0x4500c4);return _0x519253[_0x77da('0x19')](_0x77da('0x1a'),_0x366443+'-'+_0x1b0e17+'/'+_0x29cd7b)[_0x77da('0x18')](_0x4e130c);}return null;};}function patchUpdates(_0x19a00c){return function(_0x12d2b1){try{jsonpatch[_0x77da('0x1b')](_0x12d2b1,_0x19a00c,!![]);}catch(_0x3b6dde){return BPromise['reject'](_0x3b6dde);}return _0x12d2b1['save']();};}function saveUpdates(_0xd5a809,_0x4d1512){return function(_0x507979){if(_0x507979){return _0x507979[_0x77da('0x1c')](_0xd5a809)[_0x77da('0x1d')](function(_0x24aa8a){return _0x24aa8a;});}return null;};}function removeEntity(_0x5ab79a,_0x58270c){return function(_0x3e6cfe){if(_0x3e6cfe){return _0x3e6cfe['destroy']()[_0x77da('0x1d')](function(){_0x5ab79a[_0x77da('0x16')](0xcc)[_0x77da('0x17')]();});}};}function handleEntityNotFound(_0x27b6c7,_0x10399a){return function(_0x270318){if(!_0x270318){_0x27b6c7[_0x77da('0x1e')](0x194);}return _0x270318;};}function handleError(_0x50799d,_0x4885ec){_0x4885ec=_0x4885ec||0x1f4;return function(_0xfd160){logger[_0x77da('0x1f')](_0xfd160[_0x77da('0x20')]);if(_0xfd160[_0x77da('0x21')]){delete _0xfd160['name'];}_0x50799d[_0x77da('0x16')](_0x4885ec)[_0x77da('0x22')](_0xfd160);};}exports[_0x77da('0x23')]=function(_0x36115b,_0x446ae7){var _0x5997b6={},_0xce24b8={},_0x3e090d={'count':0x0,'rows':[]};var _0x1f2279=_[_0x77da('0x24')](db['ChatOfflineMessage']['rawAttributes'],function(_0x4d395a){return{'name':_0x4d395a[_0x77da('0x25')],'type':_0x4d395a[_0x77da('0x26')][_0x77da('0x27')]};});_0xce24b8[_0x77da('0x28')]=_[_0x77da('0x24')](_0x1f2279,'name');_0xce24b8[_0x77da('0x29')]=_[_0x77da('0x2a')](_0x36115b[_0x77da('0x29')]);_0xce24b8[_0x77da('0x2b')]=_[_0x77da('0x2c')](_0xce24b8[_0x77da('0x28')],_0xce24b8['query']);_0x5997b6[_0x77da('0x2d')]=_[_0x77da('0x2c')](_0xce24b8[_0x77da('0x28')],qs[_0x77da('0x2e')](_0x36115b[_0x77da('0x29')][_0x77da('0x2e')]));_0x5997b6[_0x77da('0x2d')]=_0x5997b6[_0x77da('0x2d')]['length']?_0x5997b6['attributes']:_0xce24b8[_0x77da('0x28')];if(!_0x36115b[_0x77da('0x29')]['hasOwnProperty'](_0x77da('0x2f'))){_0x5997b6[_0x77da('0x30')]=qs[_0x77da('0x30')](_0x36115b[_0x77da('0x29')][_0x77da('0x30')]);_0x5997b6[_0x77da('0x31')]=qs[_0x77da('0x31')](_0x36115b['query'][_0x77da('0x31')]);}_0x5997b6['order']=qs['sort'](_0x36115b['query'][_0x77da('0x32')]);_0x5997b6['where']=qs[_0x77da('0x2b')](_[_0x77da('0x33')](_0x36115b[_0x77da('0x29')],_0xce24b8[_0x77da('0x2b')]),_0x1f2279);if(_0x36115b[_0x77da('0x29')][_0x77da('0x34')]){_0x5997b6[_0x77da('0x35')]=_['merge'](_0x5997b6[_0x77da('0x35')],{'$or':_[_0x77da('0x24')](_0x1f2279,function(_0x1ca53a){if(_0x1ca53a[_0x77da('0x26')]!==_0x77da('0x36')){var _0x188284={};_0x188284[_0x1ca53a['name']]={'$like':'%'+_0x36115b[_0x77da('0x29')][_0x77da('0x34')]+'%'};return _0x188284;}})});}_0x5997b6=_[_0x77da('0x37')]({},_0x5997b6,_0x36115b['options']);var _0xc5f0b8={'where':_0x5997b6['where']};return db['ChatOfflineMessage']['count'](_0xc5f0b8)['then'](function(_0x19f9f7){_0x3e090d[_0x77da('0x38')]=_0x19f9f7;if(_0x36115b[_0x77da('0x29')]['includeAll']){_0x5997b6[_0x77da('0x39')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x77da('0x3a')](_0x5997b6);})['then'](function(_0x3c216f){_0x3e090d[_0x77da('0x3b')]=_0x3c216f;return _0x3e090d;})[_0x77da('0x1d')](respondWithFilteredResult(_0x446ae7,_0x5997b6))[_0x77da('0x3c')](handleError(_0x446ae7,null));};exports[_0x77da('0x3d')]=function(_0x5ecf12,_0x759b86){var _0x1f48bd={'raw':!![],'where':{'id':_0x5ecf12[_0x77da('0x3e')]['id']}},_0x44717a={};_0x44717a[_0x77da('0x28')]=_[_0x77da('0x2a')](db['ChatOfflineMessage'][_0x77da('0x3f')]);_0x44717a[_0x77da('0x29')]=_[_0x77da('0x2a')](_0x5ecf12[_0x77da('0x29')]);_0x44717a[_0x77da('0x2b')]=_[_0x77da('0x2c')](_0x44717a['model'],_0x44717a[_0x77da('0x29')]);_0x1f48bd['attributes']=_[_0x77da('0x2c')](_0x44717a[_0x77da('0x28')],qs[_0x77da('0x2e')](_0x5ecf12['query'][_0x77da('0x2e')]));_0x1f48bd[_0x77da('0x2d')]=_0x1f48bd[_0x77da('0x2d')][_0x77da('0x40')]?_0x1f48bd[_0x77da('0x2d')]:_0x44717a[_0x77da('0x28')];if(_0x5ecf12[_0x77da('0x29')][_0x77da('0x41')]){_0x1f48bd[_0x77da('0x39')]=[{'all':!![]}];}_0x1f48bd=_['merge']({},_0x1f48bd,_0x5ecf12[_0x77da('0x42')]);return db[_0x77da('0x43')][_0x77da('0x44')](_0x1f48bd)[_0x77da('0x1d')](handleEntityNotFound(_0x759b86,null))[_0x77da('0x1d')](respondWithResult(_0x759b86,null))[_0x77da('0x3c')](handleError(_0x759b86,null));};exports['create']=function(_0x54f88c,_0x240d7b){return db[_0x77da('0x43')][_0x77da('0x45')](_0x54f88c[_0x77da('0x46')],{})[_0x77da('0x1d')](respondWithResult(_0x240d7b,0xc9))[_0x77da('0x3c')](handleError(_0x240d7b,null));};exports['update']=function(_0x6ccb8f,_0x357ee4){if(_0x6ccb8f[_0x77da('0x46')]['id']){delete _0x6ccb8f[_0x77da('0x46')]['id'];}return db['ChatOfflineMessage'][_0x77da('0x44')]({'where':{'id':_0x6ccb8f['params']['id']}})['then'](handleEntityNotFound(_0x357ee4,null))[_0x77da('0x1d')](saveUpdates(_0x6ccb8f[_0x77da('0x46')],null))[_0x77da('0x1d')](respondWithResult(_0x357ee4,null))[_0x77da('0x3c')](handleError(_0x357ee4,null));};exports['destroy']=function(_0x16bf4b,_0x1e36ee){return db['ChatOfflineMessage'][_0x77da('0x44')]({'where':{'id':_0x16bf4b[_0x77da('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e36ee,null))[_0x77da('0x1d')](removeEntity(_0x1e36ee,null))[_0x77da('0x3c')](handleError(_0x1e36ee,null));};exports[_0x77da('0x47')]=function(_0xef2496,_0xfc13ed){return db[_0x77da('0x43')][_0x77da('0x47')]()[_0x77da('0x1d')](respondWithResult(_0xfc13ed,null))[_0x77da('0x3c')](handleError(_0xfc13ed,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 162b8d2..e74df34 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 _0x8897=['./chatOfflineMessage.attributes','chat_offline_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0x8897,0x157));var _0x7889=function(_0x3179ee,_0x332f7d){_0x3179ee=_0x3179ee-0x0;var _0x56b59=_0x8897[_0x3179ee];return _0x56b59;};'use strict';var _=require('lodash');var util=require(_0x7889('0x0'));var logger=require(_0x7889('0x1'))(_0x7889('0x2'));var moment=require(_0x7889('0x3'));var BPromise=require(_0x7889('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7889('0x5'));var rimraf=require(_0x7889('0x6'));var config=require('../../config/environment');var attributes=require(_0x7889('0x7'));module['exports']=function(_0x1b9e89,_0x30e435){return _0x1b9e89['define']('ChatOfflineMessage',attributes,{'tableName':_0x7889('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7889('0x9')});}; \ No newline at end of file +var _0xaffb=['utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x3db597,_0x12ea74){var _0x1aaf0b=function(_0x54c2fd){while(--_0x54c2fd){_0x3db597['push'](_0x3db597['shift']());}};_0x1aaf0b(++_0x12ea74);}(_0xaffb,0xcd));var _0xbaff=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xaffb[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xbaff('0x0'));var util=require(_0xbaff('0x1'));var logger=require(_0xbaff('0x2'))(_0xbaff('0x3'));var moment=require('moment');var BPromise=require(_0xbaff('0x4'));var rp=require(_0xbaff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbaff('0x6'));var attributes=require(_0xbaff('0x7'));module[_0xbaff('0x8')]=function(_0x584708,_0x5717ed){return _0x584708[_0xbaff('0x9')](_0xbaff('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbaff('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2de5eb6..93598a5 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 _0xaa1f=['http','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xaa1f,0x146));var _0xfaa1=function(_0x1592c8,_0x44cc37){_0x1592c8=_0x1592c8-0x0;var _0x36f59d=_0xaa1f[_0x1592c8];return _0x36f59d;};'use strict';var _=require('lodash');var util=require(_0xfaa1('0x0'));var moment=require(_0xfaa1('0x1'));var BPromise=require('bluebird');var rs=require(_0xfaa1('0x2'));var fs=require('fs');var Redis=require(_0xfaa1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfaa1('0x4'));var logger=require(_0xfaa1('0x5'))(_0xfaa1('0x6'));var config=require(_0xfaa1('0x7'));var jayson=require(_0xfaa1('0x8'));var client=jayson[_0xfaa1('0x9')][_0xfaa1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e5b06,_0x3816b8,_0xf40a57){return new BPromise(function(_0x238f6a,_0x5879f3){return client['request'](_0x5e5b06,_0xf40a57)[_0xfaa1('0xb')](function(_0x4f0ea9){logger[_0xfaa1('0xc')](_0xfaa1('0xd'),_0x3816b8,'request\x20sent');logger[_0xfaa1('0xe')](_0xfaa1('0xf'),_0x3816b8,'request\x20sent',JSON['stringify'](_0x4f0ea9));if(_0x4f0ea9[_0xfaa1('0x10')]){if(_0x4f0ea9[_0xfaa1('0x10')]['code']===0x1f4){logger[_0xfaa1('0x10')](_0xfaa1('0xd'),_0x3816b8,_0x4f0ea9[_0xfaa1('0x10')][_0xfaa1('0x11')]);return _0x5879f3(_0x4f0ea9[_0xfaa1('0x10')][_0xfaa1('0x11')]);}logger[_0xfaa1('0x10')](_0xfaa1('0xd'),_0x3816b8,_0x4f0ea9['error'][_0xfaa1('0x11')]);return _0x238f6a(_0x4f0ea9[_0xfaa1('0x10')][_0xfaa1('0x11')]);}else{logger[_0xfaa1('0xc')](_0xfaa1('0xd'),_0x3816b8,_0xfaa1('0x12'));_0x238f6a(_0x4f0ea9[_0xfaa1('0x13')][_0xfaa1('0x11')]);}})[_0xfaa1('0x14')](function(_0x3d3e18){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3816b8,_0x3d3e18);_0x5879f3(_0x3d3e18);});});} \ No newline at end of file +var _0xe8ed=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x809dbd,_0xf5f241){var _0x5497bf=function(_0x4642bf){while(--_0x4642bf){_0x809dbd['push'](_0x809dbd['shift']());}};_0x5497bf(++_0xf5f241);}(_0xe8ed,0x140));var _0xde8e=function(_0x20767c,_0x570769){_0x20767c=_0x20767c-0x0;var _0x2a16f1=_0xe8ed[_0x20767c];return _0x2a16f1;};'use strict';var _=require(_0xde8e('0x0'));var util=require(_0xde8e('0x1'));var moment=require(_0xde8e('0x2'));var BPromise=require('bluebird');var rs=require(_0xde8e('0x3'));var fs=require('fs');var Redis=require(_0xde8e('0x4'));var db=require(_0xde8e('0x5'))['db'];var utils=require(_0xde8e('0x6'));var logger=require(_0xde8e('0x7'))(_0xde8e('0x8'));var config=require(_0xde8e('0x9'));var jayson=require(_0xde8e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4994,_0x2db6eb,_0x498282){return new BPromise(function(_0x1e6319,_0x40bdfd){return client[_0xde8e('0xb')](_0x3c4994,_0x498282)[_0xde8e('0xc')](function(_0x14606e){logger[_0xde8e('0xd')](_0xde8e('0xe'),_0x2db6eb,'request\x20sent');logger[_0xde8e('0xf')](_0xde8e('0x10'),_0x2db6eb,_0xde8e('0x11'),JSON[_0xde8e('0x12')](_0x14606e));if(_0x14606e[_0xde8e('0x13')]){if(_0x14606e['error'][_0xde8e('0x14')]===0x1f4){logger[_0xde8e('0x13')](_0xde8e('0xe'),_0x2db6eb,_0x14606e[_0xde8e('0x13')][_0xde8e('0x15')]);return _0x40bdfd(_0x14606e['error']['message']);}logger[_0xde8e('0x13')](_0xde8e('0xe'),_0x2db6eb,_0x14606e[_0xde8e('0x13')][_0xde8e('0x15')]);return _0x1e6319(_0x14606e[_0xde8e('0x13')][_0xde8e('0x15')]);}else{logger[_0xde8e('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2db6eb,'request\x20sent');_0x1e6319(_0x14606e['result']['message']);}})[_0xde8e('0x16')](function(_0x1c82a9){logger['error'](_0xde8e('0xe'),_0x2db6eb,_0x1c82a9);_0x40bdfd(_0x1c82a9);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f5d5058..f784bdd 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 _0xdaa8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1e1838,_0x22e4f3){var _0x3d4c54=function(_0x57274e){while(--_0x57274e){_0x1e1838['push'](_0x1e1838['shift']());}};_0x3d4c54(++_0x22e4f3);}(_0xdaa8,0x188));var _0x8daa=function(_0x15d1a7,_0x550c26){_0x15d1a7=_0x15d1a7-0x0;var _0x35b219=_0xdaa8[_0x15d1a7];return _0x35b219;};'use strict';var multer=require(_0x8daa('0x0'));var util=require(_0x8daa('0x1'));var path=require(_0x8daa('0x2'));var timeout=require(_0x8daa('0x3'));var express=require(_0x8daa('0x4'));var router=express[_0x8daa('0x5')]();var auth=require(_0x8daa('0x6'));var interaction=require(_0x8daa('0x7'));var config=require(_0x8daa('0x8'));var controller=require(_0x8daa('0x9'));router[_0x8daa('0xa')]('/',auth['isAuthenticated'](),controller[_0x8daa('0xb')]);router['get'](_0x8daa('0xc'),auth[_0x8daa('0xd')](),controller['describe']);router[_0x8daa('0xa')](_0x8daa('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x8daa('0xf')]('/',auth[_0x8daa('0xd')](),controller[_0x8daa('0x10')]);router[_0x8daa('0x11')](_0x8daa('0xe'),auth[_0x8daa('0xd')](),controller[_0x8daa('0x12')]);router[_0x8daa('0x13')](_0x8daa('0xe'),auth[_0x8daa('0xd')](),controller[_0x8daa('0x14')]);module[_0x8daa('0x15')]=router; \ No newline at end of file +var _0x3927=['Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer','path'];(function(_0x4cca7f,_0x2d83a2){var _0x5de513=function(_0x43eb53){while(--_0x43eb53){_0x4cca7f['push'](_0x4cca7f['shift']());}};_0x5de513(++_0x2d83a2);}(_0x3927,0xa0));var _0x7392=function(_0x51c9d2,_0x2364a8){_0x51c9d2=_0x51c9d2-0x0;var _0x2af9db=_0x3927[_0x51c9d2];return _0x2af9db;};'use strict';var multer=require(_0x7392('0x0'));var util=require('util');var path=require(_0x7392('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7392('0x2')]();var auth=require(_0x7392('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7392('0x4'));var controller=require(_0x7392('0x5'));router[_0x7392('0x6')]('/',auth[_0x7392('0x7')](),controller[_0x7392('0x8')]);router['get'](_0x7392('0x9'),auth[_0x7392('0x7')](),controller[_0x7392('0xa')]);router[_0x7392('0x6')](_0x7392('0xb'),auth[_0x7392('0x7')](),controller[_0x7392('0xc')]);router[_0x7392('0xd')]('/',auth[_0x7392('0x7')](),controller[_0x7392('0xe')]);router[_0x7392('0xf')](_0x7392('0xb'),auth[_0x7392('0x7')](),controller['update']);router[_0x7392('0x10')](_0x7392('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7392('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 2de4cf0..2df41a5 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 _0x2b33=['mouseOver','INTEGER','sequelize','exports','STRING','timeout'];(function(_0xbbe604,_0x38ab7b){var _0x16b8cf=function(_0x507564){while(--_0x507564){_0xbbe604['push'](_0xbbe604['shift']());}};_0x16b8cf(++_0x38ab7b);}(_0x2b33,0xfe));var _0x32b3=function(_0xc52898,_0x165722){_0xc52898=_0xc52898-0x0;var _0x1941d7=_0x2b33[_0xc52898];return _0x1941d7;};'use strict';var Sequelize=require(_0x32b3('0x0'));module[_0x32b3('0x1')]={'name':{'type':Sequelize[_0x32b3('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x32b3('0x3')),'defaultValue':_0x32b3('0x4')},'selector':{'type':Sequelize[_0x32b3('0x2')]},'timeout':{'type':Sequelize[_0x32b3('0x5')]}}; \ No newline at end of file +var _0x7bbb=['INTEGER','sequelize','exports','STRING','mouseOver','timeout'];(function(_0x4c3951,_0x425873){var _0x15caee=function(_0x4b5466){while(--_0x4b5466){_0x4c3951['push'](_0x4c3951['shift']());}};_0x15caee(++_0x425873);}(_0x7bbb,0x79));var _0xb7bb=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7bbb[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0xb7bb('0x0'));module[_0xb7bb('0x1')]={'name':{'type':Sequelize[_0xb7bb('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb7bb('0x3'),_0xb7bb('0x4')),'defaultValue':_0xb7bb('0x3')},'selector':{'type':Sequelize[_0xb7bb('0x2')]},'timeout':{'type':Sequelize[_0xb7bb('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index f579af6..6581d27 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','options','catch','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x42f313,_0x318de0){var _0x5b4e78=function(_0x4f28f6){while(--_0x4f28f6){_0x42f313['push'](_0x42f313['shift']());}};_0x5b4e78(++_0x318de0);}(_0x70e0,0x17b));var _0x070e=function(_0x5dc77f,_0x217e36){_0x5dc77f=_0x5dc77f-0x0;var _0x10b602=_0x70e0[_0x5dc77f];return _0x10b602;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={'raw':!![],'where':{'id':_0x1743cc[_0x070e('0x26')]['id']}},_0x374c54={};_0x374c54[_0x070e('0x27')]=_[_0x070e('0x28')](db[_0x070e('0x29')][_0x070e('0x2a')]);_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x28')](_0x1743cc['query']);_0x374c54[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],_0x374c54['query']);_0x497f58['attributes']=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],qs[_0x070e('0x2e')](_0x1743cc['query'][_0x070e('0x2e')]));_0x497f58[_0x070e('0x2f')]=_0x497f58[_0x070e('0x2f')][_0x070e('0x30')]?_0x497f58['attributes']:_0x374c54['model'];if(_0x1743cc['query']['includeAll']){_0x497f58[_0x070e('0x31')]=[{'all':!![]}];}_0x497f58=_['merge']({},_0x497f58,_0x1743cc[_0x070e('0x32')]);return db[_0x070e('0x29')]['find'](_0x497f58)['then'](handleEntityNotFound(_0x4763c6,null))[_0x070e('0x20')](respondWithResult(_0x4763c6,null))[_0x070e('0x33')](handleError(_0x4763c6,null));};exports['create']=function(_0x546a16,_0x41ade4){return db[_0x070e('0x29')][_0x070e('0x34')](_0x546a16[_0x070e('0x35')],{})[_0x070e('0x20')](respondWithResult(_0x41ade4,0xc9))['catch'](handleError(_0x41ade4,null));};exports['update']=function(_0x24d17d,_0x3011c4){if(_0x24d17d[_0x070e('0x35')]['id']){delete _0x24d17d[_0x070e('0x35')]['id'];}return db[_0x070e('0x29')]['find']({'where':{'id':_0x24d17d[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x3011c4,null))['then'](saveUpdates(_0x24d17d[_0x070e('0x35')],null))[_0x070e('0x20')](respondWithResult(_0x3011c4,null))['catch'](handleError(_0x3011c4,null));};exports['destroy']=function(_0x5ddbe9,_0x363bff){return db[_0x070e('0x29')][_0x070e('0x36')]({'where':{'id':_0x5ddbe9[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x363bff,null))['then'](removeEntity(_0x363bff,null))[_0x070e('0x33')](handleError(_0x363bff,null));}; \ No newline at end of file +var _0xedd9=['offset','limit','Content-Range','reject','update','then','destroy','error','stack','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','include','merge','options','find','catch','create','ChatProactiveAction','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xedd9,0xfc));var _0x9edd=function(_0x45c80d,_0x3dc7c5){_0x45c80d=_0x45c80d-0x0;var _0x168e33=_0xedd9[_0x45c80d];return _0x168e33;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(!_0x339a0d){_0x44a6c1['sendStatus'](0x194);}return _0x339a0d;};}function handleError(_0x46c383,_0xeaf55a){_0xeaf55a=_0xeaf55a||0x1f4;return function(_0x3a1ea5){logger[_0x9edd('0x23')](_0x3a1ea5[_0x9edd('0x24')]);if(_0x3a1ea5['name']){delete _0x3a1ea5['name'];}_0x46c383[_0x9edd('0x18')](_0xeaf55a)[_0x9edd('0x25')](_0x3a1ea5);};}exports[_0x9edd('0x26')]=function(_0x25e135,_0x3c2227){var _0x4fe471={'raw':!![],'where':{'id':_0x25e135[_0x9edd('0x27')]['id']}},_0x57a2cc={};_0x57a2cc[_0x9edd('0x28')]=_[_0x9edd('0x29')](db['ChatProactiveAction'][_0x9edd('0x2a')]);_0x57a2cc[_0x9edd('0x2b')]=_[_0x9edd('0x29')](_0x25e135[_0x9edd('0x2b')]);_0x57a2cc['filters']=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],_0x57a2cc[_0x9edd('0x2b')]);_0x4fe471[_0x9edd('0x2d')]=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],qs[_0x9edd('0x2e')](_0x25e135[_0x9edd('0x2b')][_0x9edd('0x2e')]));_0x4fe471[_0x9edd('0x2d')]=_0x4fe471[_0x9edd('0x2d')][_0x9edd('0x2f')]?_0x4fe471[_0x9edd('0x2d')]:_0x57a2cc[_0x9edd('0x28')];if(_0x25e135[_0x9edd('0x2b')]['includeAll']){_0x4fe471[_0x9edd('0x30')]=[{'all':!![]}];}_0x4fe471=_[_0x9edd('0x31')]({},_0x4fe471,_0x25e135[_0x9edd('0x32')]);return db['ChatProactiveAction'][_0x9edd('0x33')](_0x4fe471)[_0x9edd('0x21')](handleEntityNotFound(_0x3c2227,null))[_0x9edd('0x21')](respondWithResult(_0x3c2227,null))[_0x9edd('0x34')](handleError(_0x3c2227,null));};exports[_0x9edd('0x35')]=function(_0x2bc4ed,_0x473068){return db[_0x9edd('0x36')][_0x9edd('0x35')](_0x2bc4ed[_0x9edd('0x37')],{})[_0x9edd('0x21')](respondWithResult(_0x473068,0xc9))[_0x9edd('0x34')](handleError(_0x473068,null));};exports[_0x9edd('0x20')]=function(_0x14f780,_0x5757fc){if(_0x14f780[_0x9edd('0x37')]['id']){delete _0x14f780['body']['id'];}return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x14f780[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x5757fc,null))[_0x9edd('0x21')](saveUpdates(_0x14f780['body'],null))[_0x9edd('0x21')](respondWithResult(_0x5757fc,null))[_0x9edd('0x34')](handleError(_0x5757fc,null));};exports[_0x9edd('0x22')]=function(_0x38e9be,_0x1be77f){return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x38e9be[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x1be77f,null))[_0x9edd('0x21')](removeEntity(_0x1be77f,null))['catch'](handleError(_0x1be77f,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6d9d7b4..49e8466 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 _0xd81c=['bluebird','rimraf','../../config/environment','exports','define','chat_proactive_actions','lodash','api','moment'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xd81c,0xba));var _0xcd81=function(_0x236de3,_0x150c42){_0x236de3=_0x236de3-0x0;var _0x2a741a=_0xd81c[_0x236de3];return _0x2a741a;};'use strict';var _=require(_0xcd81('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcd81('0x1'));var moment=require(_0xcd81('0x2'));var BPromise=require(_0xcd81('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcd81('0x4'));var config=require(_0xcd81('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0xcd81('0x6')]=function(_0x123159,_0x35f2a3){return _0x123159[_0xcd81('0x7')]('ChatProactiveAction',attributes,{'tableName':_0xcd81('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8b6=['moment','path','../../config/environment','exports','define','ChatProactiveAction','lodash','../../config/logger'];(function(_0x5049c9,_0xf3d6b1){var _0x41a43d=function(_0x1d8dd9){while(--_0x1d8dd9){_0x5049c9['push'](_0x5049c9['shift']());}};_0x41a43d(++_0xf3d6b1);}(_0xc8b6,0x17e));var _0x6c8b=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xc8b6[_0x4de586];return _0x46baf5;};'use strict';var _=require(_0x6c8b('0x0'));var util=require('util');var logger=require(_0x6c8b('0x1'))('api');var moment=require(_0x6c8b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c8b('0x3'));var rimraf=require('rimraf');var config=require(_0x6c8b('0x4'));var attributes=require('./chatProactiveAction.attributes');module[_0x6c8b('0x5')]=function(_0x9fe2e1,_0x384693){return _0x9fe2e1[_0x6c8b('0x6')](_0x6c8b('0x7'),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 2d56bed..7e88ebc 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 _0xa432=['client','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3a6144,_0xb18290){var _0xc8fad4=function(_0x3a19d2){while(--_0x3a19d2){_0x3a6144['push'](_0x3a6144['shift']());}};_0xc8fad4(++_0xb18290);}(_0xa432,0x125));var _0x2a43=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xa432[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x2a43('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2a43('0x1'));var fs=require('fs');var Redis=require(_0x2a43('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a43('0x3'));var logger=require(_0x2a43('0x4'))(_0x2a43('0x5'));var config=require(_0x2a43('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2a43('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48d040,_0x176050,_0x180d56){return new BPromise(function(_0x564ed5,_0x2a1af1){return client[_0x2a43('0x8')](_0x48d040,_0x180d56)['then'](function(_0x1e672d){logger['info'](_0x2a43('0x9'),_0x176050,_0x2a43('0xa'));logger[_0x2a43('0xb')](_0x2a43('0xc'),_0x176050,'request\x20sent',JSON[_0x2a43('0xd')](_0x1e672d));if(_0x1e672d['error']){if(_0x1e672d[_0x2a43('0xe')][_0x2a43('0xf')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x176050,_0x1e672d[_0x2a43('0xe')]['message']);return _0x2a1af1(_0x1e672d[_0x2a43('0xe')]['message']);}logger[_0x2a43('0xe')](_0x2a43('0x9'),_0x176050,_0x1e672d[_0x2a43('0xe')]['message']);return _0x564ed5(_0x1e672d[_0x2a43('0xe')][_0x2a43('0x10')]);}else{logger[_0x2a43('0x11')](_0x2a43('0x9'),_0x176050,_0x2a43('0xa'));_0x564ed5(_0x1e672d[_0x2a43('0x12')][_0x2a43('0x10')]);}})[_0x2a43('0x13')](function(_0x35c939){logger[_0x2a43('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x176050,_0x35c939);_0x2a1af1(_0x35c939);});});} \ No newline at end of file +var _0xf933=['ChatProactiveAction,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0xc55a01,_0x6464c6){var _0x2311e6=function(_0x24db41){while(--_0x24db41){_0xc55a01['push'](_0xc55a01['shift']());}};_0x2311e6(++_0x6464c6);}(_0xf933,0xc0));var _0x3f93=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xf933[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f93('0x0'));var BPromise=require(_0x3f93('0x1'));var rs=require(_0x3f93('0x2'));var fs=require('fs');var Redis=require(_0x3f93('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f93('0x4'));var logger=require(_0x3f93('0x5'))('rpc');var config=require(_0x3f93('0x6'));var jayson=require(_0x3f93('0x7'));var client=jayson[_0x3f93('0x8')][_0x3f93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc901,_0x4b732f,_0x515ed7){return new BPromise(function(_0x29ce69,_0x234355){return client['request'](_0x2fc901,_0x515ed7)[_0x3f93('0xa')](function(_0x54fef8){logger[_0x3f93('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x4b732f,_0x3f93('0xc'));logger[_0x3f93('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4b732f,_0x3f93('0xc'),JSON[_0x3f93('0xe')](_0x54fef8));if(_0x54fef8[_0x3f93('0xf')]){if(_0x54fef8['error'][_0x3f93('0x10')]===0x1f4){logger[_0x3f93('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x4b732f,_0x54fef8[_0x3f93('0xf')][_0x3f93('0x11')]);return _0x234355(_0x54fef8[_0x3f93('0xf')][_0x3f93('0x11')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4b732f,_0x54fef8[_0x3f93('0xf')]['message']);return _0x29ce69(_0x54fef8[_0x3f93('0xf')][_0x3f93('0x11')]);}else{logger[_0x3f93('0xb')](_0x3f93('0x12'),_0x4b732f,_0x3f93('0xc'));_0x29ce69(_0x54fef8[_0x3f93('0x13')]['message']);}})[_0x3f93('0x14')](function(_0x3e33d2){logger[_0x3f93('0xf')](_0x3f93('0x12'),_0x4b732f,_0x3e33d2);_0x234355(_0x3e33d2);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f00f9ab..94be240 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 _0x4fb6=['exports','path','connect-timeout','express','Router','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','update','/:id','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fb6,0x15f));var _0x64fb=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0x4fb6[_0x4169d8];return _0x32084a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x64fb('0x0'));var timeout=require(_0x64fb('0x1'));var express=require(_0x64fb('0x2'));var router=express[_0x64fb('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x64fb('0x4'));router['get']('/:id',auth[_0x64fb('0x5')](),controller[_0x64fb('0x6')]);router[_0x64fb('0x7')]('/',auth[_0x64fb('0x5')](),controller[_0x64fb('0x8')]);router[_0x64fb('0x9')]('/:id',auth[_0x64fb('0x5')](),controller[_0x64fb('0xa')]);router['delete'](_0x64fb('0xb'),auth['isAuthenticated'](),controller[_0x64fb('0xc')]);module[_0x64fb('0xd')]=router; \ No newline at end of file +var _0x9658=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x9658,0x6f));var _0x8965=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x9658[_0x58e469];return _0x4c01c5;};'use strict';var multer=require(_0x8965('0x0'));var util=require('util');var path=require(_0x8965('0x1'));var timeout=require(_0x8965('0x2'));var express=require('express');var router=express[_0x8965('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8965('0x4'));var config=require(_0x8965('0x5'));var controller=require(_0x8965('0x6'));router['get'](_0x8965('0x7'),auth[_0x8965('0x8')](),controller[_0x8965('0x9')]);router[_0x8965('0xa')]('/',auth[_0x8965('0x8')](),controller[_0x8965('0xb')]);router[_0x8965('0xc')](_0x8965('0x7'),auth[_0x8965('0x8')](),controller[_0x8965('0xd')]);router[_0x8965('0xe')](_0x8965('0x7'),auth[_0x8965('0x8')](),controller[_0x8965('0xf')]);module[_0x8965('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 9c123aa..978294b 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 _0xf934=['name','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x192b50,_0x523f5b){var _0x3054fb=function(_0x42aef2){while(--_0x42aef2){_0x192b50['push'](_0x192b50['shift']());}};_0x3054fb(++_0x523f5b);}(_0xf934,0xca));var _0x4f93=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xf934[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0x4f93('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4f93('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4f93('0x2')]},'timeout':{'type':Sequelize[_0x4f93('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4f93('0x4')]('rrmemory',_0x4f93('0x5'),_0x4f93('0x6'))}}; \ No newline at end of file +var _0x717a=['roundrobin','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x717a,0x1b7));var _0xa717=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0x717a[_0x46a671];return _0x526d75;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa717('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa717('0x0')]},'timeout':{'type':Sequelize[_0xa717('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa717('0x2')](_0xa717('0x3'),_0xa717('0x4'),_0xa717('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 3f0bd5e..c0d9849 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 _0xc4f4=['Team','pick','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserChatQueue','findOrCreate','forEach','emit','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','every','includes','all','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./chatQueue.socket','register','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','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','set','Content-Range','json','apply','update','destroy','get','UserProfileResource','send','index','map','ChatQueue','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','rawAttributes','fields','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','ChatQueueId','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams'];(function(_0x572b13,_0x5e0103){var _0x51aa20=function(_0x180542){while(--_0x180542){_0x572b13['push'](_0x572b13['shift']());}};_0x51aa20(++_0x5e0103);}(_0xc4f4,0xba));var _0x4c4f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc4f4[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x4c4f('0x0'));var emlformat=require(_0x4c4f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4c4f('0x2'));var moment=require(_0x4c4f('0x3'));var BPromise=require(_0x4c4f('0x4'));var Mustache=require(_0x4c4f('0x5'));var util=require(_0x4c4f('0x6'));var path=require(_0x4c4f('0x7'));var sox=require(_0x4c4f('0x8'));var csv=require(_0x4c4f('0x9'));var ejs=require(_0x4c4f('0xa'));var fs=require('fs');var _=require(_0x4c4f('0xb'));var squel=require(_0x4c4f('0xc'));var crypto=require(_0x4c4f('0xd'));var jsforce=require(_0x4c4f('0xe'));var deskjs=require(_0x4c4f('0xf'));var toCsv=require(_0x4c4f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4c4f('0x10'));var authService=require(_0x4c4f('0x11'));var qs=require(_0x4c4f('0x12'));var as=require(_0x4c4f('0x13'));var hardwareService=require(_0x4c4f('0x14'));var logger=require(_0x4c4f('0x15'))(_0x4c4f('0x16'));var utils=require(_0x4c4f('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4c4f('0x18')]=_['defaults'](config['redis'],{'host':_0x4c4f('0x19'),'port':0x18eb});var socket=require(_0x4c4f('0x1a'))(new Redis(config[_0x4c4f('0x18')]));require(_0x4c4f('0x1b'))[_0x4c4f('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4c4f('0x1d')][_0x4c4f('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x331afd,_0x438c30,_0x40ade0){if(_0x40ade0){var _0x1beb98=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1beb98['test'](_0x438c30)){return _0x331afd;}else{throw new db[(_0x4c4f('0x1f'))]['ValidationError'](_0x4c4f('0x20'));}}else{return _0x331afd;}}function respondWithRpcPromise(_0x4f96bb,_0x14c376,_0x59fc41,_0x24696b){return new BPromise(function(_0x4992a8,_0x4398e8){var _0x194e4f=_0x24696b||client;return _0x194e4f[_0x4c4f('0x21')](_0x4f96bb,_0x59fc41)[_0x4c4f('0x22')](function(_0x4e0290){logger[_0x4c4f('0x23')](_0x4c4f('0x24'),_0x14c376,_0x4c4f('0x25'));logger[_0x4c4f('0x26')](_0x4c4f('0x27'),_0x14c376,'request\x20sent',JSON[_0x4c4f('0x28')](_0x4e0290));if(_0x4e0290[_0x4c4f('0x29')]){if(_0x4e0290['error'][_0x4c4f('0x2a')]===0x1f4){logger[_0x4c4f('0x29')](_0x4c4f('0x24'),_0x14c376,_0x4e0290[_0x4c4f('0x29')][_0x4c4f('0x2b')]);return _0x4398e8(_0x4e0290[_0x4c4f('0x29')][_0x4c4f('0x2b')]);}logger[_0x4c4f('0x29')](_0x4c4f('0x24'),_0x14c376,_0x4e0290[_0x4c4f('0x29')][_0x4c4f('0x2b')]);return _0x4992a8(_0x4e0290[_0x4c4f('0x29')][_0x4c4f('0x2b')]);}else{logger['info'](_0x4c4f('0x24'),_0x14c376,_0x4c4f('0x25'));_0x4992a8(_0x4e0290[_0x4c4f('0x2c')]['message']);}})[_0x4c4f('0x2d')](function(_0x1cc761){logger['error'](_0x4c4f('0x24'),_0x14c376,_0x1cc761);_0x4398e8(_0x1cc761);});});}function respondWithStatusCode(_0x341441,_0x35e0e3){_0x35e0e3=_0x35e0e3||0xcc;return function(_0x103ef4){if(_0x103ef4){return _0x341441[_0x4c4f('0x2e')](_0x35e0e3);}return _0x341441['status'](_0x35e0e3)[_0x4c4f('0x2f')]();};}function respondWithResult(_0x279a7d,_0x157d96){_0x157d96=_0x157d96||0xc8;return function(_0x481290){if(_0x481290){return _0x279a7d[_0x4c4f('0x30')](_0x157d96)['json'](_0x481290);}};}function respondWithFilteredResult(_0x1c0244,_0x120931){return function(_0x321164){if(_0x321164){var _0x5d1027=_0x321164['count'],_0x17234c=_0x120931[_0x4c4f('0x31')],_0x4dadf6=_0x120931[_0x4c4f('0x31')]+_0x120931['limit'],_0x42af35;if(_0x4dadf6>=_0x5d1027){_0x4dadf6=_0x5d1027;_0x42af35=0xc8;}else{_0x42af35=0xce;}_0x1c0244[_0x4c4f('0x30')](_0x42af35);return _0x1c0244[_0x4c4f('0x32')](_0x4c4f('0x33'),_0x17234c+'-'+_0x4dadf6+'/'+_0x5d1027)[_0x4c4f('0x34')](_0x321164);}return null;};}function patchUpdates(_0x42efe6){return function(_0x250150){try{jsonpatch[_0x4c4f('0x35')](_0x250150,_0x42efe6,!![]);}catch(_0xbbbe74){return BPromise['reject'](_0xbbbe74);}return _0x250150['save']();};}function saveUpdates(_0x438365,_0x3a85ff){return function(_0x597862){if(_0x597862){return _0x597862[_0x4c4f('0x36')](_0x438365)[_0x4c4f('0x22')](function(_0x408db9){return _0x408db9;});}return null;};}function removeEntity(_0x37b6a6,_0x42622e){return function(_0x292bac){if(_0x292bac){return _0x292bac[_0x4c4f('0x37')]()[_0x4c4f('0x22')](function(){var _0x28dd91=_0x292bac[_0x4c4f('0x38')]({'plain':!![]});var _0x20e4a4='ChatQueues';return db[_0x4c4f('0x39')][_0x4c4f('0x37')]({'where':{'type':_0x20e4a4,'resourceId':_0x28dd91['id']}})[_0x4c4f('0x22')](function(){return _0x292bac;});})[_0x4c4f('0x22')](function(){_0x37b6a6['status'](0xcc)[_0x4c4f('0x2f')]();});}};}function handleEntityNotFound(_0x3e41ee,_0x283fce){return function(_0x8d22f8){if(!_0x8d22f8){_0x3e41ee[_0x4c4f('0x2e')](0x194);}return _0x8d22f8;};}function handleError(_0x5ccae5,_0x1126ad){_0x1126ad=_0x1126ad||0x1f4;return function(_0xa3b783){logger[_0x4c4f('0x29')](_0xa3b783['stack']);if(_0xa3b783['name']){delete _0xa3b783['name'];}_0x5ccae5['status'](_0x1126ad)[_0x4c4f('0x3a')](_0xa3b783);};}exports[_0x4c4f('0x3b')]=function(_0x416f61,_0x3e5587){var _0x14c369={},_0x5aef53={},_0x52d71d={'count':0x0,'rows':[]};var _0xf9775c=_[_0x4c4f('0x3c')](db[_0x4c4f('0x3d')]['rawAttributes'],function(_0x3d0155){return{'name':_0x3d0155[_0x4c4f('0x3e')],'type':_0x3d0155[_0x4c4f('0x3f')][_0x4c4f('0x40')]};});_0x5aef53[_0x4c4f('0x41')]=_[_0x4c4f('0x3c')](_0xf9775c,_0x4c4f('0x42'));_0x5aef53['query']=_[_0x4c4f('0x43')](_0x416f61[_0x4c4f('0x44')]);_0x5aef53[_0x4c4f('0x45')]=_[_0x4c4f('0x46')](_0x5aef53[_0x4c4f('0x41')],_0x5aef53[_0x4c4f('0x44')]);_0x14c369['attributes']=_[_0x4c4f('0x46')](_0x5aef53[_0x4c4f('0x41')],qs['fields'](_0x416f61[_0x4c4f('0x44')]['fields']));_0x14c369[_0x4c4f('0x47')]=_0x14c369[_0x4c4f('0x47')]['length']?_0x14c369['attributes']:_0x5aef53['model'];if(!_0x416f61[_0x4c4f('0x44')]['hasOwnProperty'](_0x4c4f('0x48'))){_0x14c369[_0x4c4f('0x49')]=qs['limit'](_0x416f61[_0x4c4f('0x44')][_0x4c4f('0x49')]);_0x14c369[_0x4c4f('0x31')]=qs[_0x4c4f('0x31')](_0x416f61[_0x4c4f('0x44')][_0x4c4f('0x31')]);}_0x14c369[_0x4c4f('0x4a')]=qs[_0x4c4f('0x4b')](_0x416f61['query'][_0x4c4f('0x4b')]);_0x14c369[_0x4c4f('0x4c')]=qs[_0x4c4f('0x45')](_['pick'](_0x416f61['query'],_0x5aef53[_0x4c4f('0x45')]),_0xf9775c);if(_0x416f61[_0x4c4f('0x44')][_0x4c4f('0x4d')]){_0x14c369['where']=_[_0x4c4f('0x4e')](_0x14c369['where'],{'$or':_[_0x4c4f('0x3c')](_0xf9775c,function(_0x3783d6){if(_0x3783d6['type']!==_0x4c4f('0x4f')){var _0x6b4cb3={};_0x6b4cb3[_0x3783d6['name']]={'$like':'%'+_0x416f61[_0x4c4f('0x44')]['filter']+'%'};return _0x6b4cb3;}})});}_0x14c369=_[_0x4c4f('0x4e')]({},_0x14c369,_0x416f61[_0x4c4f('0x50')]);var _0x195399={'where':_0x14c369['where']};return db[_0x4c4f('0x3d')][_0x4c4f('0x51')](_0x195399)[_0x4c4f('0x22')](function(_0x5de0db){_0x52d71d['count']=_0x5de0db;if(_0x416f61['query']['includeAll']){_0x14c369[_0x4c4f('0x52')]=[{'all':!![]}];}return db[_0x4c4f('0x3d')][_0x4c4f('0x53')](_0x14c369);})[_0x4c4f('0x22')](function(_0x269295){_0x52d71d[_0x4c4f('0x54')]=_0x269295;return _0x52d71d;})[_0x4c4f('0x22')](respondWithFilteredResult(_0x3e5587,_0x14c369))['catch'](handleError(_0x3e5587,null));};exports[_0x4c4f('0x55')]=function(_0xdc9e86,_0x34e0cd){var _0x592470={'raw':!![],'where':{'id':_0xdc9e86[_0x4c4f('0x56')]['id']}},_0x5e74ad={};_0x5e74ad[_0x4c4f('0x41')]=_[_0x4c4f('0x43')](db['ChatQueue'][_0x4c4f('0x57')]);_0x5e74ad[_0x4c4f('0x44')]=_['keys'](_0xdc9e86[_0x4c4f('0x44')]);_0x5e74ad[_0x4c4f('0x45')]=_['intersection'](_0x5e74ad[_0x4c4f('0x41')],_0x5e74ad[_0x4c4f('0x44')]);_0x592470['attributes']=_['intersection'](_0x5e74ad['model'],qs[_0x4c4f('0x58')](_0xdc9e86[_0x4c4f('0x44')][_0x4c4f('0x58')]));_0x592470[_0x4c4f('0x47')]=_0x592470[_0x4c4f('0x47')][_0x4c4f('0x59')]?_0x592470['attributes']:_0x5e74ad[_0x4c4f('0x41')];if(_0xdc9e86[_0x4c4f('0x44')]['includeAll']){_0x592470[_0x4c4f('0x52')]=[{'all':!![]}];}_0x592470=_[_0x4c4f('0x4e')]({},_0x592470,_0xdc9e86[_0x4c4f('0x50')]);return db[_0x4c4f('0x3d')][_0x4c4f('0x5a')](_0x592470)['then'](handleEntityNotFound(_0x34e0cd,null))['then'](respondWithResult(_0x34e0cd,null))[_0x4c4f('0x2d')](handleError(_0x34e0cd,null));};exports[_0x4c4f('0x5b')]=function(_0x3694ab,_0x5c8adf){return db[_0x4c4f('0x3d')][_0x4c4f('0x5b')](_0x3694ab[_0x4c4f('0x5c')],{})['then'](function(_0x5d56e4){var _0x1fd67c=_0x3694ab['user']['get']({'plain':!![]});if(!_0x1fd67c)throw new Error(_0x4c4f('0x5d'));if(_0x1fd67c['role']===_0x4c4f('0x5e')){var _0x298f67=_0x5d56e4[_0x4c4f('0x38')]({'plain':!![]});var _0x4a1f72='ChatQueues';return db[_0x4c4f('0x5f')]['find']({'where':{'name':_0x4a1f72,'userProfileId':_0x1fd67c[_0x4c4f('0x60')]},'raw':!![]})[_0x4c4f('0x22')](function(_0x25c79c){if(_0x25c79c&&_0x25c79c['autoAssociation']===0x0){return db[_0x4c4f('0x39')][_0x4c4f('0x5b')]({'name':_0x298f67[_0x4c4f('0x42')],'resourceId':_0x298f67['id'],'type':_0x25c79c[_0x4c4f('0x42')],'sectionId':_0x25c79c['id']},{})[_0x4c4f('0x22')](function(){return _0x5d56e4;});}else{return _0x5d56e4;}})['catch'](function(_0x5e7171){logger[_0x4c4f('0x29')](_0x4c4f('0x61'),_0x5e7171);throw _0x5e7171;});}return _0x5d56e4;})[_0x4c4f('0x22')](respondWithResult(_0x5c8adf,0xc9))[_0x4c4f('0x2d')](handleError(_0x5c8adf,null));};exports['update']=function(_0x3b881b,_0x142380){if(_0x3b881b['body']['id']){delete _0x3b881b[_0x4c4f('0x5c')]['id'];}return db[_0x4c4f('0x3d')][_0x4c4f('0x5a')]({'where':{'id':_0x3b881b[_0x4c4f('0x56')]['id']}})[_0x4c4f('0x22')](handleEntityNotFound(_0x142380,null))['then'](saveUpdates(_0x3b881b['body'],null))[_0x4c4f('0x22')](respondWithResult(_0x142380,null))[_0x4c4f('0x2d')](handleError(_0x142380,null));};exports[_0x4c4f('0x37')]=function(_0x411899,_0x53d2f9){return db['ChatQueue'][_0x4c4f('0x5a')]({'where':{'id':_0x411899[_0x4c4f('0x56')]['id']}})['then'](handleEntityNotFound(_0x53d2f9,null))['then'](removeEntity(_0x53d2f9,null))[_0x4c4f('0x2d')](handleError(_0x53d2f9,null));};exports[_0x4c4f('0x62')]=function(_0x3a5de3,_0x2609cc){return db[_0x4c4f('0x3d')][_0x4c4f('0x62')]()[_0x4c4f('0x22')](respondWithResult(_0x2609cc,null))[_0x4c4f('0x2d')](handleError(_0x2609cc,null));};exports[_0x4c4f('0x63')]=function(_0x188fb6,_0x52c280,_0x5e16b1){var _0x3c0c78={'raw':!![],'where':{}},_0x5cc115={},_0x3d9e73;return db[_0x4c4f('0x3d')][_0x4c4f('0x64')]({'where':{'id':_0x188fb6[_0x4c4f('0x56')]['id']}})[_0x4c4f('0x22')](handleEntityNotFound(_0x52c280,null))[_0x4c4f('0x22')](function(_0x472764){if(_0x472764){_0x3d9e73=_0x472764[_0x4c4f('0x38')]({'plain':!![]});_0x5cc115[_0x4c4f('0x41')]=_['keys'](db['UserChatQueue'][_0x4c4f('0x57')]);_0x5cc115[_0x4c4f('0x44')]=_[_0x4c4f('0x43')](_0x188fb6[_0x4c4f('0x44')]);_0x5cc115[_0x4c4f('0x45')]=_[_0x4c4f('0x46')](_0x5cc115[_0x4c4f('0x41')],_0x5cc115[_0x4c4f('0x44')]);_0x3c0c78[_0x4c4f('0x47')]=_['intersection'](_0x5cc115[_0x4c4f('0x41')],qs[_0x4c4f('0x58')](_0x188fb6[_0x4c4f('0x44')]['fields']));_0x3c0c78[_0x4c4f('0x47')]=_0x3c0c78[_0x4c4f('0x47')]['length']?_0x3c0c78[_0x4c4f('0x47')]:_0x5cc115['model'];if(!_0x188fb6['query'][_0x4c4f('0x65')]('nolimit')){_0x3c0c78[_0x4c4f('0x49')]=qs[_0x4c4f('0x49')](_0x188fb6[_0x4c4f('0x44')]['limit']);_0x3c0c78['offset']=qs[_0x4c4f('0x31')](_0x188fb6[_0x4c4f('0x44')][_0x4c4f('0x31')]);}_0x3c0c78['order']=qs[_0x4c4f('0x4b')](_0x188fb6['query'][_0x4c4f('0x4b')]);_0x3c0c78[_0x4c4f('0x4c')]=qs['filters'](_['pick'](_0x188fb6['query'],_0x5cc115[_0x4c4f('0x45')]));_0x3c0c78['where'][_0x4c4f('0x66')]=_0x472764['id'];if(_0x188fb6[_0x4c4f('0x44')][_0x4c4f('0x4d')]){_0x3c0c78[_0x4c4f('0x4c')]=_[_0x4c4f('0x4e')](_0x3c0c78[_0x4c4f('0x4c')],{'$or':_['map'](_0x3c0c78[_0x4c4f('0x47')],function(_0x258cd7){var _0x56f5fd={};_0x56f5fd[_0x258cd7]={'$like':'%'+_0x188fb6[_0x4c4f('0x44')][_0x4c4f('0x4d')]+'%'};return _0x56f5fd;})});}_0x3c0c78=_[_0x4c4f('0x4e')]({},_0x3c0c78,_0x188fb6[_0x4c4f('0x50')]);return db['UserChatQueue'][_0x4c4f('0x53')](_0x3c0c78);}})[_0x4c4f('0x22')](function(_0x3efba7){if(_0x3efba7){return db[_0x4c4f('0x67')]['findAndCountAll']({'where':{'id':_['map'](_0x3efba7,_0x4c4f('0x68')),'role':_0x4c4f('0x69')},'attributes':['id','name',_0x4c4f('0x6a'),_0x4c4f('0x6b'),_0x4c4f('0x6c')]});}})[_0x4c4f('0x22')](function(_0x37491c){if(_0x37491c){return{'count':_0x37491c[_0x4c4f('0x51')],'rows':_[_0x4c4f('0x3c')](_0x37491c['rows'],function(_0x196157){return{'membername':_0x196157[_0x4c4f('0x42')],'UserId':_0x196157['id'],'queue_name':_0x3d9e73['name'],'ChatQueueId':_0x3d9e73['id'],'interface':util[_0x4c4f('0x6d')](_0x4c4f('0x6e'),'SIP',_0x196157[_0x4c4f('0x42')]),'penalty':0x0,'paused':_0x196157[_0x4c4f('0x6a')],'createdAt':_0x196157[_0x4c4f('0x6c')],'updatedAt':_0x196157['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x52c280,_0x3c0c78))[_0x4c4f('0x2d')](handleError(_0x52c280,null));};exports[_0x4c4f('0x6f')]=function(_0x108d5e,_0x4f5af5,_0x412a55){var _0x361ac6={};var _0x462477={};var _0x1e1f1c;var _0x25f607;return db[_0x4c4f('0x3d')][_0x4c4f('0x64')]({'where':{'id':_0x108d5e['params']['id']}})[_0x4c4f('0x22')](handleEntityNotFound(_0x4f5af5,null))['then'](function(_0xb3b093){if(_0xb3b093){_0x1e1f1c=_0xb3b093;_0x462477[_0x4c4f('0x41')]=_[_0x4c4f('0x43')](db[_0x4c4f('0x70')][_0x4c4f('0x57')]);_0x462477[_0x4c4f('0x44')]=_[_0x4c4f('0x43')](_0x108d5e[_0x4c4f('0x44')]);_0x462477[_0x4c4f('0x45')]=_[_0x4c4f('0x46')](_0x462477[_0x4c4f('0x41')],_0x462477[_0x4c4f('0x44')]);_0x361ac6[_0x4c4f('0x47')]=_[_0x4c4f('0x46')](_0x462477[_0x4c4f('0x41')],qs[_0x4c4f('0x58')](_0x108d5e['query'][_0x4c4f('0x58')]));_0x361ac6['attributes']=_0x361ac6[_0x4c4f('0x47')][_0x4c4f('0x59')]?_0x361ac6[_0x4c4f('0x47')]:_0x462477[_0x4c4f('0x41')];_0x361ac6[_0x4c4f('0x4a')]=qs[_0x4c4f('0x4b')](_0x108d5e[_0x4c4f('0x44')][_0x4c4f('0x4b')]);_0x361ac6[_0x4c4f('0x4c')]=qs[_0x4c4f('0x45')](_[_0x4c4f('0x71')](_0x108d5e['query'],_0x462477[_0x4c4f('0x45')]));if(_0x108d5e[_0x4c4f('0x44')][_0x4c4f('0x4d')]){_0x361ac6['where']=_[_0x4c4f('0x4e')](_0x361ac6['where'],{'$or':_[_0x4c4f('0x3c')](_0x361ac6[_0x4c4f('0x47')],function(_0x2a0480){var _0x3d3079={};_0x3d3079[_0x2a0480]={'$like':'%'+_0x108d5e['query'][_0x4c4f('0x4d')]+'%'};return _0x3d3079;})});}_0x361ac6=_[_0x4c4f('0x4e')]({},_0x361ac6,_0x108d5e[_0x4c4f('0x50')]);return _0x1e1f1c[_0x4c4f('0x6f')](_0x361ac6);}})[_0x4c4f('0x22')](function(_0xf0de19){if(_0xf0de19){_0x25f607=_0xf0de19[_0x4c4f('0x59')];if(!_0x108d5e[_0x4c4f('0x44')]['hasOwnProperty'](_0x4c4f('0x48'))){_0x361ac6['limit']=qs[_0x4c4f('0x49')](_0x108d5e['query'][_0x4c4f('0x49')]);_0x361ac6[_0x4c4f('0x31')]=qs[_0x4c4f('0x31')](_0x108d5e['query'][_0x4c4f('0x31')]);}return _0x1e1f1c[_0x4c4f('0x6f')](_0x361ac6);}})[_0x4c4f('0x22')](function(_0x3b62a9){if(_0x3b62a9){return _0x3b62a9?{'count':_0x25f607,'rows':_0x3b62a9}:null;}})['then'](respondWithResult(_0x4f5af5,null))[_0x4c4f('0x2d')](handleError(_0x4f5af5,null));};exports[_0x4c4f('0x72')]=function(_0x47dc44,_0x4726ef,_0xf8bf07){var _0x29a8a1=_0x47dc44[_0x4c4f('0x5c')][_0x4c4f('0x73')];return db[_0x4c4f('0x70')][_0x4c4f('0x53')]({'where':{'id':_0x29a8a1},'attributes':['id'],'include':[{'model':db[_0x4c4f('0x67')],'as':_0x4c4f('0x74'),'attributes':['id',_0x4c4f('0x42'),'online',_0x4c4f('0x75'),_0x4c4f('0x76')],'raw':!![]}]})[_0x4c4f('0x22')](function(_0x222e5b){if(_0x222e5b){var _0x5b5d8c=_[_0x4c4f('0x77')](_0x222e5b,function(_0x38c875){var _0x59e308=_0x38c875[_0x4c4f('0x38')]({'plain':!![]});return _0x59e308[_0x4c4f('0x74')];});return db[_0x4c4f('0x3d')][_0x4c4f('0x5a')]({'where':{'id':_0x47dc44[_0x4c4f('0x56')]['id']}})[_0x4c4f('0x22')](function(_0x166314){return db[_0x4c4f('0x78')][_0x4c4f('0x79')](function(_0xc28224){return _0x166314[_0x4c4f('0x72')](_0x29a8a1,{'transaction':_0xc28224})[_0x4c4f('0x22')](function(){return BPromise[_0x4c4f('0x7a')](_0x5b5d8c,function(_0x41cda2){return db[_0x4c4f('0x7b')][_0x4c4f('0x7c')]({'where':{'UserId':_0x41cda2['id'],'ChatQueueId':_0x47dc44['params']['id']},'transaction':_0xc28224});});})[_0x4c4f('0x22')](function(){_0x5b5d8c[_0x4c4f('0x7d')](function(_0x2b7db8){socket[_0x4c4f('0x7e')]('userChatQueue:save',{'UserId':_0x2b7db8['id'],'ChatQueueId':_0x166314['id']});});});});});}})[_0x4c4f('0x22')](respondWithStatusCode(_0x4726ef,null))[_0x4c4f('0x2d')](handleError(_0x4726ef,null));};exports[_0x4c4f('0x7f')]=function(_0x3fd433,_0x5674e7,_0x34dc67){return db[_0x4c4f('0x70')][_0x4c4f('0x53')]({'where':{'id':_0x3fd433[_0x4c4f('0x44')][_0x4c4f('0x73')]},'attributes':['id'],'include':[{'model':db[_0x4c4f('0x67')],'as':_0x4c4f('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5674e7,null))['then'](function(_0xd633e9){var _0x103f14=_[_0x4c4f('0x3c')](_0xd633e9,'id');var _0x3ad49=[];var _0x5b7f7d=[];var _0x43c860=squel[_0x4c4f('0x80')]();_0x43c860[_0x4c4f('0x81')]('tq.TeamId')[_0x4c4f('0x82')]('team_has_chat_queues','tq')[_0x4c4f('0x83')](_0x4c4f('0x84'),'ut',_0x4c4f('0x85'))['where']('ChatQueueId\x20=\x20?',_0x3fd433[_0x4c4f('0x56')]['id']);for(var _0x432863=0x0;_0x432863<_0xd633e9['length'];_0x432863+=0x1){let _0x5f1eba=_0xd633e9[_0x432863];for(var _0x3ff1c7=0x0;_0x3ff1c7<_0x5f1eba[_0x4c4f('0x74')][_0x4c4f('0x59')];_0x3ff1c7+=0x1){let _0x4aacfa=_0x5f1eba[_0x4c4f('0x74')][_0x3ff1c7];var _0x14732b=_0x43c860['clone']();_0x14732b[_0x4c4f('0x4c')]('ut.UserId\x20=\x20?',_0x4aacfa['id']);_0x5b7f7d[_0x4c4f('0x86')](db[_0x4c4f('0x78')][_0x4c4f('0x44')](_0x14732b[_0x4c4f('0x87')](),{'type':db[_0x4c4f('0x78')][_0x4c4f('0x88')]['SELECT']})[_0x4c4f('0x22')](function(_0x4c9ac4){if(_0x4c9ac4[_0x4c4f('0x59')]===0x1){return _0x4aacfa['id'];}else{var _0x2d5cda=_[_0x4c4f('0x89')](_['map'](_0x4c9ac4,'TeamId'),function(_0x2bcac1){return _[_0x4c4f('0x8a')](_0x103f14,_0x2bcac1);});if(_0x2d5cda){return _0x4aacfa['id'];}}}));}}return BPromise[_0x4c4f('0x8b')](_0x5b7f7d)[_0x4c4f('0x22')](function(_0x226450){_0x3ad49=_(_0x3ad49)['union'](_0x226450)[_0x4c4f('0x8c')]()['value']();return db[_0x4c4f('0x3d')][_0x4c4f('0x5a')]({'where':{'id':_0x3fd433[_0x4c4f('0x56')]['id']}})[_0x4c4f('0x22')](function(_0x46b9f3){return db[_0x4c4f('0x78')]['transaction'](function(_0x3f653a){return _0x46b9f3[_0x4c4f('0x7f')](_0x3fd433[_0x4c4f('0x44')]['ids'],{'transaction':_0x3f653a})[_0x4c4f('0x22')](function(){if(!_[_0x4c4f('0x8d')](_0x3ad49)){return _0x46b9f3[_0x4c4f('0x8e')](_0x3ad49,{'transaction':_0x3f653a});}})[_0x4c4f('0x22')](function(){_0x3ad49[_0x4c4f('0x7d')](function(_0x579f20){socket[_0x4c4f('0x7e')](_0x4c4f('0x8f'),{'UserId':_0x579f20,'ChatQueueId':_0x46b9f3['id']});});});});});});})[_0x4c4f('0x22')](respondWithStatusCode(_0x5674e7,null))[_0x4c4f('0x2d')](handleError(_0x5674e7,null));};exports[_0x4c4f('0x90')]=function(_0x31f572,_0x3b9b6e,_0x591d0e){return db['ChatQueue']['find']({'where':{'id':_0x31f572[_0x4c4f('0x56')]['id']}})[_0x4c4f('0x22')](handleEntityNotFound(_0x3b9b6e,null))[_0x4c4f('0x22')](function(_0x3774b2){if(_0x3774b2){return _0x3774b2['addAgents'](_0x31f572['body'][_0x4c4f('0x73')],_[_0x4c4f('0x91')](_0x31f572[_0x4c4f('0x5c')],['ids','id'])||{})[_0x4c4f('0x92')](function(_0x3bc687){for(var _0x3fd868=0x0;_0x3fd868<_0x31f572[_0x4c4f('0x5c')]['ids'][_0x4c4f('0x59')];_0x3fd868+=0x1){socket['emit'](_0x4c4f('0x93'),{'UserId':_0x31f572['body'][_0x4c4f('0x73')][_0x3fd868],'ChatQueueId':_0x31f572[_0x4c4f('0x56')]['id']});}return _0x3bc687;});}})[_0x4c4f('0x22')](respondWithResult(_0x3b9b6e,null))['catch'](handleError(_0x3b9b6e,null));};exports[_0x4c4f('0x8e')]=function(_0x568b71,_0x37ef9d,_0x29104b){return db[_0x4c4f('0x3d')][_0x4c4f('0x5a')]({'where':{'id':_0x568b71[_0x4c4f('0x56')]['id']}})['then'](handleEntityNotFound(_0x37ef9d,null))[_0x4c4f('0x22')](function(_0x1ff514){if(_0x1ff514){return _0x1ff514[_0x4c4f('0x8e')](_0x568b71['query'][_0x4c4f('0x73')])['then'](function(){if(_['isArray'](_0x568b71[_0x4c4f('0x44')][_0x4c4f('0x73')])){for(var _0x2b124f=0x0;_0x2b124f<_0x568b71['query'][_0x4c4f('0x73')][_0x4c4f('0x59')];_0x2b124f+=0x1){socket[_0x4c4f('0x7e')](_0x4c4f('0x8f'),{'UserId':Number(_0x568b71[_0x4c4f('0x44')][_0x4c4f('0x73')][_0x2b124f]),'ChatQueueId':Number(_0x568b71['params']['id'])});}}else{socket[_0x4c4f('0x7e')](_0x4c4f('0x8f'),{'UserId':Number(_0x568b71[_0x4c4f('0x44')][_0x4c4f('0x73')]),'ChatQueueId':Number(_0x568b71['params']['id'])});}});}})[_0x4c4f('0x22')](respondWithStatusCode(_0x37ef9d,null))['catch'](handleError(_0x37ef9d,null));};exports[_0x4c4f('0x94')]=function(_0x35ff85,_0x1cd245,_0x210603){var _0x3630c2={};var _0x54df02={};var _0x137f64;var _0x30a7a1;return db['ChatQueue']['findOne']({'where':{'id':_0x35ff85['params']['id']}})[_0x4c4f('0x22')](handleEntityNotFound(_0x1cd245,null))[_0x4c4f('0x22')](function(_0x29edf7){if(_0x29edf7){_0x137f64=_0x29edf7;_0x54df02['model']=_['keys'](db['User'][_0x4c4f('0x57')]);_0x54df02['query']=_[_0x4c4f('0x43')](_0x35ff85[_0x4c4f('0x44')]);_0x54df02[_0x4c4f('0x45')]=_[_0x4c4f('0x46')](_0x54df02['model'],_0x54df02[_0x4c4f('0x44')]);_0x3630c2[_0x4c4f('0x47')]=_[_0x4c4f('0x46')](_0x54df02[_0x4c4f('0x41')],qs[_0x4c4f('0x58')](_0x35ff85[_0x4c4f('0x44')]['fields']));_0x3630c2[_0x4c4f('0x47')]=_0x3630c2[_0x4c4f('0x47')][_0x4c4f('0x59')]?_0x3630c2[_0x4c4f('0x47')]:_0x54df02[_0x4c4f('0x41')];_0x3630c2[_0x4c4f('0x4a')]=qs[_0x4c4f('0x4b')](_0x35ff85[_0x4c4f('0x44')]['sort']);_0x3630c2[_0x4c4f('0x4c')]=qs[_0x4c4f('0x45')](_[_0x4c4f('0x71')](_0x35ff85[_0x4c4f('0x44')],_0x54df02[_0x4c4f('0x45')]));if(_0x35ff85[_0x4c4f('0x44')][_0x4c4f('0x4d')]){_0x3630c2[_0x4c4f('0x4c')]=_[_0x4c4f('0x4e')](_0x3630c2[_0x4c4f('0x4c')],{'$or':_[_0x4c4f('0x3c')](_0x3630c2['attributes'],function(_0x188dd6){var _0x17b5eb={};_0x17b5eb[_0x188dd6]={'$like':'%'+_0x35ff85[_0x4c4f('0x44')]['filter']+'%'};return _0x17b5eb;})});}_0x3630c2=_[_0x4c4f('0x4e')]({},_0x3630c2,_0x35ff85['options']);return _0x137f64[_0x4c4f('0x94')](_0x3630c2);}})['then'](function(_0x45c162){if(_0x45c162){_0x30a7a1=_0x45c162[_0x4c4f('0x59')];if(!_0x35ff85['query'][_0x4c4f('0x65')](_0x4c4f('0x48'))){_0x3630c2[_0x4c4f('0x49')]=qs['limit'](_0x35ff85[_0x4c4f('0x44')][_0x4c4f('0x49')]);_0x3630c2[_0x4c4f('0x31')]=qs[_0x4c4f('0x31')](_0x35ff85['query']['offset']);}return _0x137f64[_0x4c4f('0x94')](_0x3630c2);}})[_0x4c4f('0x22')](function(_0x21a243){if(_0x21a243){return _0x21a243?{'count':_0x30a7a1,'rows':_0x21a243}:null;}})[_0x4c4f('0x22')](respondWithResult(_0x1cd245,null))[_0x4c4f('0x2d')](handleError(_0x1cd245,null));}; \ No newline at end of file +var _0xf8ec=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','ChatQueues','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','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','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','options','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x3e9c83,_0x14f335){var _0x21bfed=function(_0x40363e){while(--_0x40363e){_0x3e9c83['push'](_0x3e9c83['shift']());}};_0x21bfed(++_0x14f335);}(_0xf8ec,0x11e));var _0xcf8e=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xf8ec[_0x2d89ce];return _0x3fad10;};'use strict';var pdf=require(_0xcf8e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcf8e('0x1'));var jsonpatch=require(_0xcf8e('0x2'));var rp=require(_0xcf8e('0x3'));var moment=require(_0xcf8e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcf8e('0x5'));var util=require(_0xcf8e('0x6'));var path=require(_0xcf8e('0x7'));var sox=require('sox');var csv=require(_0xcf8e('0x8'));var ejs=require(_0xcf8e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcf8e('0xa'));var crypto=require(_0xcf8e('0xb'));var jsforce=require(_0xcf8e('0xc'));var deskjs=require(_0xcf8e('0xd'));var toCsv=require(_0xcf8e('0x8'));var querystring=require(_0xcf8e('0xe'));var Papa=require(_0xcf8e('0xf'));var Redis=require(_0xcf8e('0x10'));var authService=require(_0xcf8e('0x11'));var qs=require(_0xcf8e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf8e('0x13'));var logger=require('../../config/logger')(_0xcf8e('0x14'));var utils=require(_0xcf8e('0x15'));var config=require('../../config/environment');var db=require(_0xcf8e('0x16'))['db'];config['redis']=_[_0xcf8e('0x17')](config[_0xcf8e('0x18')],{'host':_0xcf8e('0x19'),'port':0x18eb});var socket=require(_0xcf8e('0x1a'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);var jayson=require(_0xcf8e('0x1b'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x49d72c,_0x1e6c64,_0x1fbe52){if(_0x1fbe52){var _0x331d85=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x331d85[_0xcf8e('0x1c')](_0x1e6c64)){return _0x49d72c;}else{throw new db[(_0xcf8e('0x1d'))][(_0xcf8e('0x1e'))](_0xcf8e('0x1f'));}}else{return _0x49d72c;}}function respondWithRpcPromise(_0x47854e,_0x201a5e,_0x10d6f8,_0x1aa6a4){return new BPromise(function(_0x1d0c1f,_0x13ef5a){var _0xff8936=_0x1aa6a4||client;return _0xff8936[_0xcf8e('0x20')](_0x47854e,_0x10d6f8)[_0xcf8e('0x21')](function(_0x52a97a){logger[_0xcf8e('0x22')](_0xcf8e('0x23'),_0x201a5e,_0xcf8e('0x24'));logger[_0xcf8e('0x25')](_0xcf8e('0x26'),_0x201a5e,_0xcf8e('0x24'),JSON[_0xcf8e('0x27')](_0x52a97a));if(_0x52a97a[_0xcf8e('0x28')]){if(_0x52a97a[_0xcf8e('0x28')]['code']===0x1f4){logger['error'](_0xcf8e('0x23'),_0x201a5e,_0x52a97a[_0xcf8e('0x28')][_0xcf8e('0x29')]);return _0x13ef5a(_0x52a97a[_0xcf8e('0x28')][_0xcf8e('0x29')]);}logger[_0xcf8e('0x28')](_0xcf8e('0x23'),_0x201a5e,_0x52a97a[_0xcf8e('0x28')][_0xcf8e('0x29')]);return _0x1d0c1f(_0x52a97a[_0xcf8e('0x28')][_0xcf8e('0x29')]);}else{logger[_0xcf8e('0x22')]('ChatQueue,\x20%s,\x20%s',_0x201a5e,_0xcf8e('0x24'));_0x1d0c1f(_0x52a97a[_0xcf8e('0x2a')][_0xcf8e('0x29')]);}})[_0xcf8e('0x2b')](function(_0x568d89){logger['error'](_0xcf8e('0x23'),_0x201a5e,_0x568d89);_0x13ef5a(_0x568d89);});});}function respondWithStatusCode(_0x3e27d1,_0x1d4619){_0x1d4619=_0x1d4619||0xcc;return function(_0x5ee9f0){if(_0x5ee9f0){return _0x3e27d1[_0xcf8e('0x2c')](_0x1d4619);}return _0x3e27d1['status'](_0x1d4619)[_0xcf8e('0x2d')]();};}function respondWithResult(_0x5c9561,_0x2c9144){_0x2c9144=_0x2c9144||0xc8;return function(_0x36126c){if(_0x36126c){return _0x5c9561[_0xcf8e('0x2e')](_0x2c9144)[_0xcf8e('0x2f')](_0x36126c);}};}function respondWithFilteredResult(_0xf421f,_0x1c5bea){return function(_0x479a57){if(_0x479a57){var _0x126ff6=_0x479a57[_0xcf8e('0x30')],_0x184720=_0x1c5bea[_0xcf8e('0x31')],_0x44aac9=_0x1c5bea[_0xcf8e('0x31')]+_0x1c5bea[_0xcf8e('0x32')],_0x170e7a;if(_0x44aac9>=_0x126ff6){_0x44aac9=_0x126ff6;_0x170e7a=0xc8;}else{_0x170e7a=0xce;}_0xf421f[_0xcf8e('0x2e')](_0x170e7a);return _0xf421f[_0xcf8e('0x33')](_0xcf8e('0x34'),_0x184720+'-'+_0x44aac9+'/'+_0x126ff6)['json'](_0x479a57);}return null;};}function patchUpdates(_0x2b68a6){return function(_0x58188e){try{jsonpatch[_0xcf8e('0x35')](_0x58188e,_0x2b68a6,!![]);}catch(_0x5c5b43){return BPromise[_0xcf8e('0x36')](_0x5c5b43);}return _0x58188e[_0xcf8e('0x37')]();};}function saveUpdates(_0x20d1d1,_0x23e3e7){return function(_0x4411b9){if(_0x4411b9){return _0x4411b9[_0xcf8e('0x38')](_0x20d1d1)[_0xcf8e('0x21')](function(_0x2f51c8){return _0x2f51c8;});}return null;};}function removeEntity(_0x52087c,_0x19a561){return function(_0x286c08){if(_0x286c08){return _0x286c08['destroy']()[_0xcf8e('0x21')](function(){var _0x5d8da0=_0x286c08['get']({'plain':!![]});var _0x3c3baa=_0xcf8e('0x39');return db['UserProfileResource'][_0xcf8e('0x3a')]({'where':{'type':_0x3c3baa,'resourceId':_0x5d8da0['id']}})[_0xcf8e('0x21')](function(){return _0x286c08;});})[_0xcf8e('0x21')](function(){_0x52087c[_0xcf8e('0x2e')](0xcc)[_0xcf8e('0x2d')]();});}};}function handleEntityNotFound(_0x440093,_0x54de5b){return function(_0x5eea4d){if(!_0x5eea4d){_0x440093[_0xcf8e('0x2c')](0x194);}return _0x5eea4d;};}function handleError(_0x165e6e,_0x52caba){_0x52caba=_0x52caba||0x1f4;return function(_0xbcebf8){logger['error'](_0xbcebf8[_0xcf8e('0x3b')]);if(_0xbcebf8[_0xcf8e('0x3c')]){delete _0xbcebf8[_0xcf8e('0x3c')];}_0x165e6e[_0xcf8e('0x2e')](_0x52caba)[_0xcf8e('0x3d')](_0xbcebf8);};}exports[_0xcf8e('0x3e')]=function(_0x4a6051,_0x4a8c14){var _0x189bd7={},_0x4620ec={},_0x52d457={'count':0x0,'rows':[]};var _0x31cd12=_[_0xcf8e('0x3f')](db[_0xcf8e('0x40')][_0xcf8e('0x41')],function(_0x160acb){return{'name':_0x160acb[_0xcf8e('0x42')],'type':_0x160acb[_0xcf8e('0x43')]['key']};});_0x4620ec[_0xcf8e('0x44')]=_[_0xcf8e('0x3f')](_0x31cd12,_0xcf8e('0x3c'));_0x4620ec[_0xcf8e('0x45')]=_[_0xcf8e('0x46')](_0x4a6051[_0xcf8e('0x45')]);_0x4620ec[_0xcf8e('0x47')]=_[_0xcf8e('0x48')](_0x4620ec[_0xcf8e('0x44')],_0x4620ec[_0xcf8e('0x45')]);_0x189bd7['attributes']=_[_0xcf8e('0x48')](_0x4620ec['model'],qs[_0xcf8e('0x49')](_0x4a6051[_0xcf8e('0x45')][_0xcf8e('0x49')]));_0x189bd7[_0xcf8e('0x4a')]=_0x189bd7[_0xcf8e('0x4a')][_0xcf8e('0x4b')]?_0x189bd7['attributes']:_0x4620ec['model'];if(!_0x4a6051[_0xcf8e('0x45')][_0xcf8e('0x4c')](_0xcf8e('0x4d'))){_0x189bd7[_0xcf8e('0x32')]=qs[_0xcf8e('0x32')](_0x4a6051[_0xcf8e('0x45')][_0xcf8e('0x32')]);_0x189bd7[_0xcf8e('0x31')]=qs[_0xcf8e('0x31')](_0x4a6051[_0xcf8e('0x45')][_0xcf8e('0x31')]);}_0x189bd7[_0xcf8e('0x4e')]=qs[_0xcf8e('0x4f')](_0x4a6051['query'][_0xcf8e('0x4f')]);_0x189bd7[_0xcf8e('0x50')]=qs[_0xcf8e('0x47')](_[_0xcf8e('0x51')](_0x4a6051['query'],_0x4620ec[_0xcf8e('0x47')]),_0x31cd12);if(_0x4a6051['query'][_0xcf8e('0x52')]){_0x189bd7['where']=_[_0xcf8e('0x53')](_0x189bd7[_0xcf8e('0x50')],{'$or':_[_0xcf8e('0x3f')](_0x31cd12,function(_0xe8063e){if(_0xe8063e[_0xcf8e('0x43')]!=='VIRTUAL'){var _0x53a5d5={};_0x53a5d5[_0xe8063e[_0xcf8e('0x3c')]]={'$like':'%'+_0x4a6051['query'][_0xcf8e('0x52')]+'%'};return _0x53a5d5;}})});}_0x189bd7=_['merge']({},_0x189bd7,_0x4a6051['options']);var _0x21935b={'where':_0x189bd7[_0xcf8e('0x50')]};return db[_0xcf8e('0x40')][_0xcf8e('0x30')](_0x21935b)['then'](function(_0x303db4){_0x52d457[_0xcf8e('0x30')]=_0x303db4;if(_0x4a6051[_0xcf8e('0x45')][_0xcf8e('0x54')]){_0x189bd7[_0xcf8e('0x55')]=[{'all':!![]}];}return db[_0xcf8e('0x40')][_0xcf8e('0x56')](_0x189bd7);})[_0xcf8e('0x21')](function(_0x2a5faa){_0x52d457[_0xcf8e('0x57')]=_0x2a5faa;return _0x52d457;})[_0xcf8e('0x21')](respondWithFilteredResult(_0x4a8c14,_0x189bd7))[_0xcf8e('0x2b')](handleError(_0x4a8c14,null));};exports['show']=function(_0x51e0cc,_0x4d46e7){var _0x17d108={'raw':!![],'where':{'id':_0x51e0cc[_0xcf8e('0x58')]['id']}},_0x2b4337={};_0x2b4337['model']=_[_0xcf8e('0x46')](db[_0xcf8e('0x40')]['rawAttributes']);_0x2b4337[_0xcf8e('0x45')]=_[_0xcf8e('0x46')](_0x51e0cc['query']);_0x2b4337[_0xcf8e('0x47')]=_[_0xcf8e('0x48')](_0x2b4337[_0xcf8e('0x44')],_0x2b4337[_0xcf8e('0x45')]);_0x17d108['attributes']=_[_0xcf8e('0x48')](_0x2b4337[_0xcf8e('0x44')],qs[_0xcf8e('0x49')](_0x51e0cc[_0xcf8e('0x45')][_0xcf8e('0x49')]));_0x17d108['attributes']=_0x17d108[_0xcf8e('0x4a')]['length']?_0x17d108[_0xcf8e('0x4a')]:_0x2b4337[_0xcf8e('0x44')];if(_0x51e0cc['query'][_0xcf8e('0x54')]){_0x17d108[_0xcf8e('0x55')]=[{'all':!![]}];}_0x17d108=_['merge']({},_0x17d108,_0x51e0cc['options']);return db[_0xcf8e('0x40')][_0xcf8e('0x59')](_0x17d108)[_0xcf8e('0x21')](handleEntityNotFound(_0x4d46e7,null))[_0xcf8e('0x21')](respondWithResult(_0x4d46e7,null))['catch'](handleError(_0x4d46e7,null));};exports[_0xcf8e('0x5a')]=function(_0x3bde12,_0x16e4b2){return db['ChatQueue']['create'](_0x3bde12[_0xcf8e('0x5b')],{})['then'](function(_0x54d4c8){var _0x418e14=_0x3bde12[_0xcf8e('0x5c')][_0xcf8e('0x5d')]({'plain':!![]});if(!_0x418e14)throw new Error(_0xcf8e('0x5e'));if(_0x418e14[_0xcf8e('0x5f')]===_0xcf8e('0x5c')){var _0x2d1949=_0x54d4c8[_0xcf8e('0x5d')]({'plain':!![]});var _0x3ec9c6=_0xcf8e('0x39');return db[_0xcf8e('0x60')][_0xcf8e('0x59')]({'where':{'name':_0x3ec9c6,'userProfileId':_0x418e14[_0xcf8e('0x61')]},'raw':!![]})[_0xcf8e('0x21')](function(_0x2ec6e3){if(_0x2ec6e3&&_0x2ec6e3[_0xcf8e('0x62')]===0x0){return db[_0xcf8e('0x63')][_0xcf8e('0x5a')]({'name':_0x2d1949[_0xcf8e('0x3c')],'resourceId':_0x2d1949['id'],'type':_0x2ec6e3[_0xcf8e('0x3c')],'sectionId':_0x2ec6e3['id']},{})['then'](function(){return _0x54d4c8;});}else{return _0x54d4c8;}})[_0xcf8e('0x2b')](function(_0x2094a8){logger[_0xcf8e('0x28')](_0xcf8e('0x64'),_0x2094a8);throw _0x2094a8;});}return _0x54d4c8;})[_0xcf8e('0x21')](respondWithResult(_0x16e4b2,0xc9))[_0xcf8e('0x2b')](handleError(_0x16e4b2,null));};exports[_0xcf8e('0x38')]=function(_0x7db42d,_0x25f45f){if(_0x7db42d[_0xcf8e('0x5b')]['id']){delete _0x7db42d['body']['id'];}return db['ChatQueue'][_0xcf8e('0x59')]({'where':{'id':_0x7db42d[_0xcf8e('0x58')]['id']}})[_0xcf8e('0x21')](handleEntityNotFound(_0x25f45f,null))[_0xcf8e('0x21')](saveUpdates(_0x7db42d[_0xcf8e('0x5b')],null))[_0xcf8e('0x21')](respondWithResult(_0x25f45f,null))[_0xcf8e('0x2b')](handleError(_0x25f45f,null));};exports[_0xcf8e('0x3a')]=function(_0x519033,_0x3a6567){return db[_0xcf8e('0x40')][_0xcf8e('0x59')]({'where':{'id':_0x519033['params']['id']}})[_0xcf8e('0x21')](handleEntityNotFound(_0x3a6567,null))[_0xcf8e('0x21')](removeEntity(_0x3a6567,null))['catch'](handleError(_0x3a6567,null));};exports[_0xcf8e('0x65')]=function(_0x1b21ee,_0x5f2a09){return db['ChatQueue'][_0xcf8e('0x65')]()[_0xcf8e('0x21')](respondWithResult(_0x5f2a09,null))[_0xcf8e('0x2b')](handleError(_0x5f2a09,null));};exports[_0xcf8e('0x66')]=function(_0xffe69,_0x585c81,_0x16456f){var _0x4d3c54={'raw':!![],'where':{}},_0x28cee2={},_0x460c0f;return db['ChatQueue'][_0xcf8e('0x67')]({'where':{'id':_0xffe69[_0xcf8e('0x58')]['id']}})[_0xcf8e('0x21')](handleEntityNotFound(_0x585c81,null))[_0xcf8e('0x21')](function(_0x2536e8){if(_0x2536e8){_0x460c0f=_0x2536e8[_0xcf8e('0x5d')]({'plain':!![]});_0x28cee2[_0xcf8e('0x44')]=_[_0xcf8e('0x46')](db[_0xcf8e('0x68')][_0xcf8e('0x41')]);_0x28cee2[_0xcf8e('0x45')]=_['keys'](_0xffe69['query']);_0x28cee2['filters']=_['intersection'](_0x28cee2[_0xcf8e('0x44')],_0x28cee2['query']);_0x4d3c54[_0xcf8e('0x4a')]=_['intersection'](_0x28cee2[_0xcf8e('0x44')],qs['fields'](_0xffe69[_0xcf8e('0x45')][_0xcf8e('0x49')]));_0x4d3c54[_0xcf8e('0x4a')]=_0x4d3c54[_0xcf8e('0x4a')][_0xcf8e('0x4b')]?_0x4d3c54['attributes']:_0x28cee2[_0xcf8e('0x44')];if(!_0xffe69[_0xcf8e('0x45')][_0xcf8e('0x4c')](_0xcf8e('0x4d'))){_0x4d3c54[_0xcf8e('0x32')]=qs[_0xcf8e('0x32')](_0xffe69[_0xcf8e('0x45')][_0xcf8e('0x32')]);_0x4d3c54[_0xcf8e('0x31')]=qs[_0xcf8e('0x31')](_0xffe69['query'][_0xcf8e('0x31')]);}_0x4d3c54[_0xcf8e('0x4e')]=qs[_0xcf8e('0x4f')](_0xffe69[_0xcf8e('0x45')][_0xcf8e('0x4f')]);_0x4d3c54[_0xcf8e('0x50')]=qs[_0xcf8e('0x47')](_['pick'](_0xffe69[_0xcf8e('0x45')],_0x28cee2[_0xcf8e('0x47')]));_0x4d3c54[_0xcf8e('0x50')][_0xcf8e('0x69')]=_0x2536e8['id'];if(_0xffe69[_0xcf8e('0x45')]['filter']){_0x4d3c54['where']=_[_0xcf8e('0x53')](_0x4d3c54['where'],{'$or':_[_0xcf8e('0x3f')](_0x4d3c54[_0xcf8e('0x4a')],function(_0x2b02f9){var _0x49c864={};_0x49c864[_0x2b02f9]={'$like':'%'+_0xffe69[_0xcf8e('0x45')]['filter']+'%'};return _0x49c864;})});}_0x4d3c54=_[_0xcf8e('0x53')]({},_0x4d3c54,_0xffe69['options']);return db['UserChatQueue'][_0xcf8e('0x56')](_0x4d3c54);}})[_0xcf8e('0x21')](function(_0x49a194){if(_0x49a194){return db[_0xcf8e('0x6a')][_0xcf8e('0x6b')]({'where':{'id':_['map'](_0x49a194,_0xcf8e('0x6c')),'role':_0xcf8e('0x6d')},'attributes':['id',_0xcf8e('0x3c'),_0xcf8e('0x6e'),_0xcf8e('0x6f'),_0xcf8e('0x70')]});}})[_0xcf8e('0x21')](function(_0x1506b7){if(_0x1506b7){return{'count':_0x1506b7['count'],'rows':_[_0xcf8e('0x3f')](_0x1506b7['rows'],function(_0x15e4be){return{'membername':_0x15e4be[_0xcf8e('0x3c')],'UserId':_0x15e4be['id'],'queue_name':_0x460c0f[_0xcf8e('0x3c')],'ChatQueueId':_0x460c0f['id'],'interface':util[_0xcf8e('0x71')]('%s/%s',_0xcf8e('0x72'),_0x15e4be[_0xcf8e('0x3c')]),'penalty':0x0,'paused':_0x15e4be[_0xcf8e('0x6e')],'createdAt':_0x15e4be['createdAt'],'updatedAt':_0x15e4be['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xcf8e('0x21')](respondWithFilteredResult(_0x585c81,_0x4d3c54))['catch'](handleError(_0x585c81,null));};exports[_0xcf8e('0x73')]=function(_0x5505d7,_0x45056e,_0x5e664f){var _0x22c0e2={};var _0x1f051c={};var _0x2521aa;var _0x3b4bbd;return db[_0xcf8e('0x40')][_0xcf8e('0x67')]({'where':{'id':_0x5505d7[_0xcf8e('0x58')]['id']}})[_0xcf8e('0x21')](handleEntityNotFound(_0x45056e,null))[_0xcf8e('0x21')](function(_0x15d72f){if(_0x15d72f){_0x2521aa=_0x15d72f;_0x1f051c[_0xcf8e('0x44')]=_[_0xcf8e('0x46')](db['Team']['rawAttributes']);_0x1f051c[_0xcf8e('0x45')]=_[_0xcf8e('0x46')](_0x5505d7[_0xcf8e('0x45')]);_0x1f051c[_0xcf8e('0x47')]=_[_0xcf8e('0x48')](_0x1f051c[_0xcf8e('0x44')],_0x1f051c[_0xcf8e('0x45')]);_0x22c0e2[_0xcf8e('0x4a')]=_['intersection'](_0x1f051c[_0xcf8e('0x44')],qs['fields'](_0x5505d7['query'][_0xcf8e('0x49')]));_0x22c0e2[_0xcf8e('0x4a')]=_0x22c0e2[_0xcf8e('0x4a')]['length']?_0x22c0e2[_0xcf8e('0x4a')]:_0x1f051c[_0xcf8e('0x44')];_0x22c0e2[_0xcf8e('0x4e')]=qs[_0xcf8e('0x4f')](_0x5505d7[_0xcf8e('0x45')][_0xcf8e('0x4f')]);_0x22c0e2[_0xcf8e('0x50')]=qs[_0xcf8e('0x47')](_[_0xcf8e('0x51')](_0x5505d7[_0xcf8e('0x45')],_0x1f051c['filters']));if(_0x5505d7['query'][_0xcf8e('0x52')]){_0x22c0e2[_0xcf8e('0x50')]=_[_0xcf8e('0x53')](_0x22c0e2['where'],{'$or':_[_0xcf8e('0x3f')](_0x22c0e2[_0xcf8e('0x4a')],function(_0x172908){var _0x305703={};_0x305703[_0x172908]={'$like':'%'+_0x5505d7[_0xcf8e('0x45')][_0xcf8e('0x52')]+'%'};return _0x305703;})});}_0x22c0e2=_[_0xcf8e('0x53')]({},_0x22c0e2,_0x5505d7[_0xcf8e('0x74')]);return _0x2521aa[_0xcf8e('0x73')](_0x22c0e2);}})[_0xcf8e('0x21')](function(_0x2f8782){if(_0x2f8782){_0x3b4bbd=_0x2f8782[_0xcf8e('0x4b')];if(!_0x5505d7['query'][_0xcf8e('0x4c')](_0xcf8e('0x4d'))){_0x22c0e2[_0xcf8e('0x32')]=qs[_0xcf8e('0x32')](_0x5505d7['query'][_0xcf8e('0x32')]);_0x22c0e2[_0xcf8e('0x31')]=qs[_0xcf8e('0x31')](_0x5505d7['query'][_0xcf8e('0x31')]);}return _0x2521aa[_0xcf8e('0x73')](_0x22c0e2);}})['then'](function(_0x423058){if(_0x423058){return _0x423058?{'count':_0x3b4bbd,'rows':_0x423058}:null;}})[_0xcf8e('0x21')](respondWithResult(_0x45056e,null))[_0xcf8e('0x2b')](handleError(_0x45056e,null));};exports[_0xcf8e('0x75')]=function(_0x8daf3,_0x1a8be5,_0x1aeb58){var _0x420efc=_0x8daf3[_0xcf8e('0x5b')][_0xcf8e('0x76')];return db['Team']['findAll']({'where':{'id':_0x420efc},'attributes':['id'],'include':[{'model':db[_0xcf8e('0x6a')],'as':'Agents','attributes':['id','name',_0xcf8e('0x77'),_0xcf8e('0x78'),_0xcf8e('0x79')],'raw':!![]}]})[_0xcf8e('0x21')](function(_0x3834ae){if(_0x3834ae){var _0x2eb9f9=_[_0xcf8e('0x7a')](_0x3834ae,function(_0x37b02e){var _0x303df9=_0x37b02e[_0xcf8e('0x5d')]({'plain':!![]});return _0x303df9[_0xcf8e('0x7b')];});return db[_0xcf8e('0x40')][_0xcf8e('0x59')]({'where':{'id':_0x8daf3[_0xcf8e('0x58')]['id']}})[_0xcf8e('0x21')](function(_0x3ef37c){return db[_0xcf8e('0x7c')]['transaction'](function(_0x2da733){return _0x3ef37c[_0xcf8e('0x75')](_0x420efc,{'transaction':_0x2da733})[_0xcf8e('0x21')](function(){return BPromise[_0xcf8e('0x7d')](_0x2eb9f9,function(_0x217fd6){return db[_0xcf8e('0x68')][_0xcf8e('0x7e')]({'where':{'UserId':_0x217fd6['id'],'ChatQueueId':_0x8daf3[_0xcf8e('0x58')]['id']},'transaction':_0x2da733});});})[_0xcf8e('0x21')](function(){_0x2eb9f9[_0xcf8e('0x7f')](function(_0x2be106){socket[_0xcf8e('0x80')](_0xcf8e('0x81'),{'UserId':_0x2be106['id'],'ChatQueueId':_0x3ef37c['id']});});});});});}})[_0xcf8e('0x21')](respondWithStatusCode(_0x1a8be5,null))[_0xcf8e('0x2b')](handleError(_0x1a8be5,null));};exports[_0xcf8e('0x82')]=function(_0x42d47c,_0x98404f,_0x5bfe06){return db['Team'][_0xcf8e('0x56')]({'where':{'id':_0x42d47c[_0xcf8e('0x45')][_0xcf8e('0x76')]},'attributes':['id'],'include':[{'model':db[_0xcf8e('0x6a')],'as':_0xcf8e('0x7b'),'attributes':['id'],'raw':!![]}]})[_0xcf8e('0x21')](handleEntityNotFound(_0x98404f,null))['then'](function(_0x4aef0e){var _0x5edb43=_[_0xcf8e('0x3f')](_0x4aef0e,'id');var _0x22d8d8=[];var _0x2a383f=[];var _0x57afc9=squel[_0xcf8e('0x83')]();_0x57afc9[_0xcf8e('0x84')](_0xcf8e('0x85'))['from']('team_has_chat_queues','tq')['join'](_0xcf8e('0x86'),'ut',_0xcf8e('0x87'))['where'](_0xcf8e('0x88'),_0x42d47c[_0xcf8e('0x58')]['id']);for(var _0x9efdcb=0x0;_0x9efdcb<_0x4aef0e['length'];_0x9efdcb+=0x1){let _0x1fa66f=_0x4aef0e[_0x9efdcb];for(var _0x4f8b0f=0x0;_0x4f8b0f<_0x1fa66f[_0xcf8e('0x7b')][_0xcf8e('0x4b')];_0x4f8b0f+=0x1){let _0x398121=_0x1fa66f['Agents'][_0x4f8b0f];var _0x173f5f=_0x57afc9[_0xcf8e('0x89')]();_0x173f5f[_0xcf8e('0x50')]('ut.UserId\x20=\x20?',_0x398121['id']);_0x2a383f[_0xcf8e('0x8a')](db[_0xcf8e('0x7c')]['query'](_0x173f5f[_0xcf8e('0x8b')](),{'type':db[_0xcf8e('0x7c')][_0xcf8e('0x8c')][_0xcf8e('0x8d')]})[_0xcf8e('0x21')](function(_0x45c647){if(_0x45c647[_0xcf8e('0x4b')]===0x1){return _0x398121['id'];}else{var _0x460467=_['every'](_['map'](_0x45c647,_0xcf8e('0x8e')),function(_0x4e5713){return _[_0xcf8e('0x8f')](_0x5edb43,_0x4e5713);});if(_0x460467){return _0x398121['id'];}}}));}}return BPromise[_0xcf8e('0x90')](_0x2a383f)[_0xcf8e('0x21')](function(_0x20a242){_0x22d8d8=_(_0x22d8d8)[_0xcf8e('0x91')](_0x20a242)[_0xcf8e('0x92')]()['value']();return db[_0xcf8e('0x40')][_0xcf8e('0x59')]({'where':{'id':_0x42d47c[_0xcf8e('0x58')]['id']}})[_0xcf8e('0x21')](function(_0x1bc7ce){return db['sequelize'][_0xcf8e('0x93')](function(_0xd01ee0){return _0x1bc7ce[_0xcf8e('0x82')](_0x42d47c[_0xcf8e('0x45')][_0xcf8e('0x76')],{'transaction':_0xd01ee0})[_0xcf8e('0x21')](function(){if(!_['isEmpty'](_0x22d8d8)){return _0x1bc7ce['removeAgents'](_0x22d8d8,{'transaction':_0xd01ee0});}})['then'](function(){_0x22d8d8['forEach'](function(_0x527243){socket[_0xcf8e('0x80')](_0xcf8e('0x94'),{'UserId':_0x527243,'ChatQueueId':_0x1bc7ce['id']});});});});});});})[_0xcf8e('0x21')](respondWithStatusCode(_0x98404f,null))[_0xcf8e('0x2b')](handleError(_0x98404f,null));};exports[_0xcf8e('0x95')]=function(_0x138a9e,_0x476206,_0x7c094b){return db[_0xcf8e('0x40')]['find']({'where':{'id':_0x138a9e[_0xcf8e('0x58')]['id']}})[_0xcf8e('0x21')](handleEntityNotFound(_0x476206,null))[_0xcf8e('0x21')](function(_0x25d9ff){if(_0x25d9ff){return _0x25d9ff[_0xcf8e('0x95')](_0x138a9e[_0xcf8e('0x5b')][_0xcf8e('0x76')],_[_0xcf8e('0x96')](_0x138a9e[_0xcf8e('0x5b')],[_0xcf8e('0x76'),'id'])||{})[_0xcf8e('0x97')](function(_0x2f86b7){for(var _0x4c816b=0x0;_0x4c816b<_0x138a9e[_0xcf8e('0x5b')][_0xcf8e('0x76')]['length'];_0x4c816b+=0x1){socket[_0xcf8e('0x80')](_0xcf8e('0x81'),{'UserId':_0x138a9e[_0xcf8e('0x5b')][_0xcf8e('0x76')][_0x4c816b],'ChatQueueId':_0x138a9e[_0xcf8e('0x58')]['id']});}return _0x2f86b7;});}})[_0xcf8e('0x21')](respondWithResult(_0x476206,null))[_0xcf8e('0x2b')](handleError(_0x476206,null));};exports['removeAgents']=function(_0x305bf2,_0x43f4cb,_0x39b12b){return db[_0xcf8e('0x40')][_0xcf8e('0x59')]({'where':{'id':_0x305bf2[_0xcf8e('0x58')]['id']}})['then'](handleEntityNotFound(_0x43f4cb,null))[_0xcf8e('0x21')](function(_0x3af5e7){if(_0x3af5e7){return _0x3af5e7[_0xcf8e('0x98')](_0x305bf2[_0xcf8e('0x45')][_0xcf8e('0x76')])['then'](function(){if(_['isArray'](_0x305bf2[_0xcf8e('0x45')][_0xcf8e('0x76')])){for(var _0x5947cd=0x0;_0x5947cd<_0x305bf2[_0xcf8e('0x45')]['ids']['length'];_0x5947cd+=0x1){socket[_0xcf8e('0x80')]('userChatQueue:remove',{'UserId':Number(_0x305bf2[_0xcf8e('0x45')]['ids'][_0x5947cd]),'ChatQueueId':Number(_0x305bf2[_0xcf8e('0x58')]['id'])});}}else{socket['emit'](_0xcf8e('0x94'),{'UserId':Number(_0x305bf2['query'][_0xcf8e('0x76')]),'ChatQueueId':Number(_0x305bf2[_0xcf8e('0x58')]['id'])});}});}})[_0xcf8e('0x21')](respondWithStatusCode(_0x43f4cb,null))['catch'](handleError(_0x43f4cb,null));};exports[_0xcf8e('0x99')]=function(_0x4a790a,_0x377a46,_0x14faa6){var _0x5a2255={};var _0x1061a={};var _0x2b6db4;var _0x56feeb;return db[_0xcf8e('0x40')][_0xcf8e('0x67')]({'where':{'id':_0x4a790a[_0xcf8e('0x58')]['id']}})['then'](handleEntityNotFound(_0x377a46,null))[_0xcf8e('0x21')](function(_0x42d533){if(_0x42d533){_0x2b6db4=_0x42d533;_0x1061a['model']=_['keys'](db[_0xcf8e('0x6a')]['rawAttributes']);_0x1061a[_0xcf8e('0x45')]=_[_0xcf8e('0x46')](_0x4a790a['query']);_0x1061a[_0xcf8e('0x47')]=_[_0xcf8e('0x48')](_0x1061a['model'],_0x1061a['query']);_0x5a2255['attributes']=_[_0xcf8e('0x48')](_0x1061a[_0xcf8e('0x44')],qs['fields'](_0x4a790a[_0xcf8e('0x45')]['fields']));_0x5a2255[_0xcf8e('0x4a')]=_0x5a2255['attributes'][_0xcf8e('0x4b')]?_0x5a2255[_0xcf8e('0x4a')]:_0x1061a[_0xcf8e('0x44')];_0x5a2255[_0xcf8e('0x4e')]=qs['sort'](_0x4a790a['query']['sort']);_0x5a2255[_0xcf8e('0x50')]=qs[_0xcf8e('0x47')](_['pick'](_0x4a790a[_0xcf8e('0x45')],_0x1061a[_0xcf8e('0x47')]));if(_0x4a790a['query']['filter']){_0x5a2255[_0xcf8e('0x50')]=_[_0xcf8e('0x53')](_0x5a2255[_0xcf8e('0x50')],{'$or':_[_0xcf8e('0x3f')](_0x5a2255[_0xcf8e('0x4a')],function(_0x4a7502){var _0x1be0b4={};_0x1be0b4[_0x4a7502]={'$like':'%'+_0x4a790a[_0xcf8e('0x45')][_0xcf8e('0x52')]+'%'};return _0x1be0b4;})});}_0x5a2255=_[_0xcf8e('0x53')]({},_0x5a2255,_0x4a790a[_0xcf8e('0x74')]);return _0x2b6db4[_0xcf8e('0x99')](_0x5a2255);}})[_0xcf8e('0x21')](function(_0x30c972){if(_0x30c972){_0x56feeb=_0x30c972[_0xcf8e('0x4b')];if(!_0x4a790a[_0xcf8e('0x45')]['hasOwnProperty']('nolimit')){_0x5a2255[_0xcf8e('0x32')]=qs[_0xcf8e('0x32')](_0x4a790a[_0xcf8e('0x45')][_0xcf8e('0x32')]);_0x5a2255[_0xcf8e('0x31')]=qs[_0xcf8e('0x31')](_0x4a790a[_0xcf8e('0x45')]['offset']);}return _0x2b6db4['getAgents'](_0x5a2255);}})[_0xcf8e('0x21')](function(_0x411499){if(_0x411499){return _0x411499?{'count':_0x56feeb,'rows':_0x411499}:null;}})['then'](respondWithResult(_0x377a46,null))[_0xcf8e('0x2b')](handleError(_0x377a46,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d8526a7..3420ce7 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x45de70,_0x48e967){var _0x21ea23=function(_0x45a8e8){while(--_0x45a8e8){_0x45de70['push'](_0x45de70['shift']());}};_0x21ea23(++_0x48e967);}(_0xb10b,0x12a));var _0xbb10=function(_0x48b00c,_0x16690b){_0x48b00c=_0x48b00c-0x0;var _0x55d181=_0xb10b[_0x48b00c];return _0x55d181;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x117683,_0x3fd082){var _0x1fe2b2=function(_0x356f64){while(--_0x356f64){_0x117683['push'](_0x117683['shift']());}};_0x1fe2b2(++_0x3fd082);}(_0xb10b,0x12a));var _0xbb10=function(_0x21eacf,_0x1d1f5b){_0x21eacf=_0x21eacf-0x0;var _0xbae3e=_0xb10b[_0x21eacf];return _0xbae3e;};'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 77644d6..6b3c805 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 _0x5327=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5327,0xd1));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7532('0x0'));var util=require(_0x7532('0x1'));var logger=require(_0x7532('0x2'))(_0x7532('0x3'));var moment=require(_0x7532('0x4'));var BPromise=require(_0x7532('0x5'));var rp=require(_0x7532('0x6'));var fs=require('fs');var path=require(_0x7532('0x7'));var rimraf=require(_0x7532('0x8'));var config=require(_0x7532('0x9'));var attributes=require(_0x7532('0xa'));module[_0x7532('0xb')]=function(_0x5d3be9,_0x4b9a21){return _0x5d3be9['define'](_0x7532('0xc'),attributes,{'tableName':_0x7532('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe176=['api','moment','bluebird','request-promise','path','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger'];(function(_0x132c05,_0x445e31){var _0x43f2c4=function(_0x411b40){while(--_0x411b40){_0x132c05['push'](_0x132c05['shift']());}};_0x43f2c4(++_0x445e31);}(_0xe176,0x1c4));var _0x6e17=function(_0x470a01,_0x1ef188){_0x470a01=_0x470a01-0x0;var _0x5df181=_0xe176[_0x470a01];return _0x5df181;};'use strict';var _=require(_0x6e17('0x0'));var util=require(_0x6e17('0x1'));var logger=require(_0x6e17('0x2'))(_0x6e17('0x3'));var moment=require(_0x6e17('0x4'));var BPromise=require(_0x6e17('0x5'));var rp=require(_0x6e17('0x6'));var fs=require('fs');var path=require(_0x6e17('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e17('0x8'));module[_0x6e17('0x9')]=function(_0x45a777,_0xd67742){return _0x45a777[_0x6e17('0xa')](_0x6e17('0xb'),attributes,{'tableName':_0x6e17('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 4bb4d81..8452eda 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 _0x7543=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','message','error','info','result','catch','ChatQueue','findAll','options','where','attributes','limit','include','map','model','GetChatQueue','stringify','find','raw','ShowChatQueue','util','moment','bluebird'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x7543,0xca));var _0x3754=function(_0x4df20d,_0x239ad9){_0x4df20d=_0x4df20d-0x0;var _0x553659=_0x7543[_0x4df20d];return _0x553659;};'use strict';var _=require('lodash');var util=require(_0x3754('0x0'));var moment=require(_0x3754('0x1'));var BPromise=require(_0x3754('0x2'));var rs=require(_0x3754('0x3'));var fs=require('fs');var Redis=require(_0x3754('0x4'));var db=require(_0x3754('0x5'))['db'];var utils=require(_0x3754('0x6'));var logger=require(_0x3754('0x7'))(_0x3754('0x8'));var config=require(_0x3754('0x9'));var jayson=require(_0x3754('0xa'));var client=jayson[_0x3754('0xb')]['http']({'port':0x232a});config[_0x3754('0xc')]=_[_0x3754('0xd')](config[_0x3754('0xc')],{'host':_0x3754('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3754('0xc')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x323b21,_0x3efe5b,_0x5210aa){return new BPromise(function(_0x2e92ee,_0x456b40){return client[_0x3754('0xf')](_0x323b21,_0x5210aa)[_0x3754('0x10')](function(_0x77549b){logger['info'](_0x3754('0x11'),_0x3efe5b,'request\x20sent');logger[_0x3754('0x12')](_0x3754('0x13'),_0x3efe5b,_0x3754('0x14'),JSON['stringify'](_0x77549b));if(_0x77549b['error']){if(_0x77549b['error'][_0x3754('0x15')]===0x1f4){logger['error'](_0x3754('0x11'),_0x3efe5b,_0x77549b['error'][_0x3754('0x16')]);return _0x456b40(_0x77549b[_0x3754('0x17')]['message']);}logger[_0x3754('0x17')]('ChatQueue,\x20%s,\x20%s',_0x3efe5b,_0x77549b[_0x3754('0x17')][_0x3754('0x16')]);return _0x2e92ee(_0x77549b[_0x3754('0x17')][_0x3754('0x16')]);}else{logger[_0x3754('0x18')](_0x3754('0x11'),_0x3efe5b,'request\x20sent');_0x2e92ee(_0x77549b[_0x3754('0x19')]['message']);}})[_0x3754('0x1a')](function(_0x52a811){logger[_0x3754('0x17')](_0x3754('0x11'),_0x3efe5b,_0x52a811);_0x456b40(_0x52a811);});});}exports['GetChatQueue']=function(_0x3e6e12){var _0x3562d8=this;return new Promise(function(_0x3149eb,_0x5762cc){return db[_0x3754('0x1b')][_0x3754('0x1c')]({'raw':_0x3e6e12[_0x3754('0x1d')]?_0x3e6e12[_0x3754('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3e6e12[_0x3754('0x1d')]?_0x3e6e12[_0x3754('0x1d')][_0x3754('0x1e')]||null:null,'attributes':_0x3e6e12[_0x3754('0x1d')]?_0x3e6e12[_0x3754('0x1d')][_0x3754('0x1f')]||null:null,'limit':_0x3e6e12[_0x3754('0x1d')]?_0x3e6e12['options'][_0x3754('0x20')]||null:null,'include':_0x3e6e12[_0x3754('0x1d')]?_0x3e6e12['options'][_0x3754('0x21')]?_[_0x3754('0x22')](_0x3e6e12[_0x3754('0x1d')][_0x3754('0x21')],function(_0x132a34){return{'model':db[_0x132a34[_0x3754('0x23')]],'as':_0x132a34['as'],'attributes':_0x132a34[_0x3754('0x1f')],'include':_0x132a34['include']?_[_0x3754('0x22')](_0x132a34[_0x3754('0x21')],function(_0x78f082){return{'model':db[_0x78f082[_0x3754('0x23')]],'as':_0x78f082['as'],'attributes':_0x78f082['attributes'],'include':_0x78f082[_0x3754('0x21')]?_[_0x3754('0x22')](_0x78f082[_0x3754('0x21')],function(_0x27a327){return{'model':db[_0x27a327[_0x3754('0x23')]],'as':_0x27a327['as'],'attributes':_0x27a327[_0x3754('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45215e){logger[_0x3754('0x18')](_0x3754('0x24'),_0x3e6e12);logger[_0x3754('0x12')](_0x3754('0x24'),_0x3e6e12,JSON[_0x3754('0x25')](_0x45215e));_0x3149eb(_0x45215e);})['catch'](function(_0x578958){logger[_0x3754('0x17')](_0x3754('0x24'),_0x578958[_0x3754('0x16')],_0x3e6e12);_0x5762cc(_0x3562d8['error'](0x1f4,_0x578958[_0x3754('0x16')]));});});};exports['ShowChatQueue']=function(_0x198532){var _0x136172=this;return new Promise(function(_0x8b4fc7,_0x2dff32){return db[_0x3754('0x1b')][_0x3754('0x26')]({'raw':_0x198532[_0x3754('0x1d')]?_0x198532['options'][_0x3754('0x27')]===undefined?!![]:![]:!![],'where':_0x198532['options']?_0x198532[_0x3754('0x1d')]['where']||null:null,'attributes':_0x198532[_0x3754('0x1d')]?_0x198532[_0x3754('0x1d')][_0x3754('0x1f')]||null:null,'include':_0x198532[_0x3754('0x1d')]?_0x198532[_0x3754('0x1d')]['include']?_[_0x3754('0x22')](_0x198532[_0x3754('0x1d')][_0x3754('0x21')],function(_0x45bcba){return{'model':db[_0x45bcba[_0x3754('0x23')]],'as':_0x45bcba['as'],'attributes':_0x45bcba[_0x3754('0x1f')],'include':_0x45bcba[_0x3754('0x21')]?_[_0x3754('0x22')](_0x45bcba[_0x3754('0x21')],function(_0xbef4d0){return{'model':db[_0xbef4d0[_0x3754('0x23')]],'as':_0xbef4d0['as'],'attributes':_0xbef4d0['attributes'],'include':_0xbef4d0[_0x3754('0x21')]?_[_0x3754('0x22')](_0xbef4d0[_0x3754('0x21')],function(_0x2d2353){return{'model':db[_0x2d2353[_0x3754('0x23')]],'as':_0x2d2353['as'],'attributes':_0x2d2353[_0x3754('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3754('0x10')](function(_0x988157){logger[_0x3754('0x18')](_0x3754('0x28'),_0x198532);logger[_0x3754('0x12')](_0x3754('0x28'),_0x198532,JSON[_0x3754('0x25')](_0x988157));_0x8b4fc7(_0x988157);})[_0x3754('0x1a')](function(_0x12d4ef){logger['error'](_0x3754('0x28'),_0x12d4ef[_0x3754('0x16')],_0x198532);_0x2dff32(_0x136172[_0x3754('0x17')](0x1f4,_0x12d4ef['message']));});});}; \ No newline at end of file +var _0xa693=['where','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','findAll','options','raw','attributes','limit','include','model','map','GetChatQueue','ShowChatQueue','ChatQueue','find'];(function(_0x4a2198,_0x2caa94){var _0x50d366=function(_0x35137e){while(--_0x35137e){_0x4a2198['push'](_0x4a2198['shift']());}};_0x50d366(++_0x2caa94);}(_0xa693,0xf1));var _0x3a69=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0xa693[_0x38af48];return _0x445384;};'use strict';var _=require(_0x3a69('0x0'));var util=require(_0x3a69('0x1'));var moment=require(_0x3a69('0x2'));var BPromise=require(_0x3a69('0x3'));var rs=require(_0x3a69('0x4'));var fs=require('fs');var Redis=require(_0x3a69('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a69('0x6'));var config=require(_0x3a69('0x7'));var jayson=require(_0x3a69('0x8'));var client=jayson[_0x3a69('0x9')][_0x3a69('0xa')]({'port':0x232a});config[_0x3a69('0xb')]=_[_0x3a69('0xc')](config['redis'],{'host':_0x3a69('0xd'),'port':0x18eb});var socket=require(_0x3a69('0xe'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x30b7ad,_0x4826b5,_0x68fa91){return new BPromise(function(_0x44b8b2,_0x21142a){return client[_0x3a69('0xf')](_0x30b7ad,_0x68fa91)[_0x3a69('0x10')](function(_0x59f5aa){logger[_0x3a69('0x11')](_0x3a69('0x12'),_0x4826b5,'request\x20sent');logger[_0x3a69('0x13')](_0x3a69('0x14'),_0x4826b5,_0x3a69('0x15'),JSON[_0x3a69('0x16')](_0x59f5aa));if(_0x59f5aa[_0x3a69('0x17')]){if(_0x59f5aa[_0x3a69('0x17')][_0x3a69('0x18')]===0x1f4){logger[_0x3a69('0x17')](_0x3a69('0x12'),_0x4826b5,_0x59f5aa[_0x3a69('0x17')][_0x3a69('0x19')]);return _0x21142a(_0x59f5aa[_0x3a69('0x17')]['message']);}logger['error'](_0x3a69('0x12'),_0x4826b5,_0x59f5aa[_0x3a69('0x17')][_0x3a69('0x19')]);return _0x44b8b2(_0x59f5aa[_0x3a69('0x17')][_0x3a69('0x19')]);}else{logger[_0x3a69('0x11')](_0x3a69('0x12'),_0x4826b5,_0x3a69('0x15'));_0x44b8b2(_0x59f5aa[_0x3a69('0x1a')][_0x3a69('0x19')]);}})['catch'](function(_0x4101ac){logger[_0x3a69('0x17')](_0x3a69('0x12'),_0x4826b5,_0x4101ac);_0x21142a(_0x4101ac);});});}exports['GetChatQueue']=function(_0x3af6c5){var _0x352799=this;return new Promise(function(_0x5090a8,_0x59f565){return db['ChatQueue'][_0x3a69('0x1b')]({'raw':_0x3af6c5[_0x3a69('0x1c')]?_0x3af6c5['options'][_0x3a69('0x1d')]===undefined?!![]:![]:!![],'where':_0x3af6c5['options']?_0x3af6c5[_0x3a69('0x1c')]['where']||null:null,'attributes':_0x3af6c5[_0x3a69('0x1c')]?_0x3af6c5[_0x3a69('0x1c')][_0x3a69('0x1e')]||null:null,'limit':_0x3af6c5['options']?_0x3af6c5[_0x3a69('0x1c')][_0x3a69('0x1f')]||null:null,'include':_0x3af6c5[_0x3a69('0x1c')]?_0x3af6c5['options']['include']?_['map'](_0x3af6c5[_0x3a69('0x1c')][_0x3a69('0x20')],function(_0x525019){return{'model':db[_0x525019[_0x3a69('0x21')]],'as':_0x525019['as'],'attributes':_0x525019[_0x3a69('0x1e')],'include':_0x525019[_0x3a69('0x20')]?_[_0x3a69('0x22')](_0x525019[_0x3a69('0x20')],function(_0x207ae1){return{'model':db[_0x207ae1['model']],'as':_0x207ae1['as'],'attributes':_0x207ae1[_0x3a69('0x1e')],'include':_0x207ae1[_0x3a69('0x20')]?_[_0x3a69('0x22')](_0x207ae1[_0x3a69('0x20')],function(_0x2af120){return{'model':db[_0x2af120[_0x3a69('0x21')]],'as':_0x2af120['as'],'attributes':_0x2af120[_0x3a69('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x586d3f){logger['info'](_0x3a69('0x23'),_0x3af6c5);logger[_0x3a69('0x13')](_0x3a69('0x23'),_0x3af6c5,JSON[_0x3a69('0x16')](_0x586d3f));_0x5090a8(_0x586d3f);})['catch'](function(_0x1bd299){logger[_0x3a69('0x17')]('GetChatQueue',_0x1bd299[_0x3a69('0x19')],_0x3af6c5);_0x59f565(_0x352799[_0x3a69('0x17')](0x1f4,_0x1bd299[_0x3a69('0x19')]));});});};exports[_0x3a69('0x24')]=function(_0x379eff){var _0x33eed8=this;return new Promise(function(_0x34e34b,_0x3cce53){return db[_0x3a69('0x25')][_0x3a69('0x26')]({'raw':_0x379eff[_0x3a69('0x1c')]?_0x379eff['options'][_0x3a69('0x1d')]===undefined?!![]:![]:!![],'where':_0x379eff[_0x3a69('0x1c')]?_0x379eff[_0x3a69('0x1c')][_0x3a69('0x27')]||null:null,'attributes':_0x379eff[_0x3a69('0x1c')]?_0x379eff[_0x3a69('0x1c')][_0x3a69('0x1e')]||null:null,'include':_0x379eff[_0x3a69('0x1c')]?_0x379eff[_0x3a69('0x1c')][_0x3a69('0x20')]?_['map'](_0x379eff[_0x3a69('0x1c')][_0x3a69('0x20')],function(_0x9552ae){return{'model':db[_0x9552ae[_0x3a69('0x21')]],'as':_0x9552ae['as'],'attributes':_0x9552ae[_0x3a69('0x1e')],'include':_0x9552ae[_0x3a69('0x20')]?_[_0x3a69('0x22')](_0x9552ae['include'],function(_0x58ff11){return{'model':db[_0x58ff11['model']],'as':_0x58ff11['as'],'attributes':_0x58ff11[_0x3a69('0x1e')],'include':_0x58ff11[_0x3a69('0x20')]?_[_0x3a69('0x22')](_0x58ff11[_0x3a69('0x20')],function(_0x8f728b){return{'model':db[_0x8f728b[_0x3a69('0x21')]],'as':_0x8f728b['as'],'attributes':_0x8f728b[_0x3a69('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3a69('0x10')](function(_0xe5a64b){logger[_0x3a69('0x11')](_0x3a69('0x24'),_0x379eff);logger[_0x3a69('0x13')]('ShowChatQueue',_0x379eff,JSON['stringify'](_0xe5a64b));_0x34e34b(_0xe5a64b);})['catch'](function(_0x10820a){logger[_0x3a69('0x17')](_0x3a69('0x24'),_0x10820a[_0x3a69('0x19')],_0x379eff);_0x3cce53(_0x33eed8[_0x3a69('0x17')](0x1f4,_0x10820a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 031ece9..945bbde 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x4e6fc7,_0x6b9a5d){var _0x3c2ef6=function(_0x3907ed){while(--_0x3907ed){_0x4e6fc7['push'](_0x4e6fc7['shift']());}};_0x3c2ef6(++_0x6b9a5d);}(_0xb10b,0x12a));var _0xbb10=function(_0x11f1cf,_0x4cee87){_0x11f1cf=_0x11f1cf-0x0;var _0x22695a=_0xb10b[_0x11f1cf];return _0x22695a;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x1cfc39,_0x1d3913){var _0x957a28=function(_0x2be930){while(--_0x2be930){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x957a28(++_0x1d3913);}(_0xb10b,0x12a));var _0xbb10=function(_0x11df66,_0x9eabf){_0x11df66=_0x11df66-0x0;var _0xc2dca1=_0xb10b[_0x11df66];return _0xc2dca1;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index aae4ede..bce84d3 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 _0xd68a=['../../config/environment','./chatQueue.controller','get','index','/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','update','destroy','removeTeams','delete','/:id/users','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e5ebc,_0x3c48bc){var _0x4de422=function(_0x1ff877){while(--_0x1ff877){_0x4e5ebc['push'](_0x4e5ebc['shift']());}};_0x4de422(++_0x3c48bc);}(_0xd68a,0xc3));var _0xad68=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xd68a[_0x1fc122];return _0xa2cb13;};'use strict';var multer=require(_0xad68('0x0'));var util=require(_0xad68('0x1'));var path=require(_0xad68('0x2'));var timeout=require(_0xad68('0x3'));var express=require(_0xad68('0x4'));var router=express[_0xad68('0x5')]();var auth=require(_0xad68('0x6'));var interaction=require(_0xad68('0x7'));var config=require(_0xad68('0x8'));var controller=require(_0xad68('0x9'));router[_0xad68('0xa')]('/',auth['isAuthenticated'](),controller[_0xad68('0xb')]);router[_0xad68('0xa')](_0xad68('0xc'),auth[_0xad68('0xd')](),controller['describe']);router[_0xad68('0xa')](_0xad68('0xe'),auth['isAuthenticated'](),controller[_0xad68('0xf')]);router[_0xad68('0xa')]('/:id/members',auth[_0xad68('0xd')](),controller[_0xad68('0x10')]);router[_0xad68('0xa')](_0xad68('0x11'),auth[_0xad68('0xd')](),controller[_0xad68('0x12')]);router[_0xad68('0xa')]('/:id/users',auth[_0xad68('0xd')](),controller[_0xad68('0x13')]);router[_0xad68('0x14')]('/',auth[_0xad68('0xd')](),controller[_0xad68('0x15')]);router[_0xad68('0x14')]('/:id/teams',auth[_0xad68('0xd')](),controller[_0xad68('0x16')]);router[_0xad68('0x14')]('/:id/users',auth[_0xad68('0xd')](),controller['addAgents']);router['put'](_0xad68('0xe'),auth['isAuthenticated'](),controller[_0xad68('0x17')]);router['delete'](_0xad68('0xe'),auth[_0xad68('0xd')](),controller[_0xad68('0x18')]);router['delete'](_0xad68('0x11'),auth[_0xad68('0xd')](),controller[_0xad68('0x19')]);router[_0xad68('0x1a')](_0xad68('0x1b'),auth[_0xad68('0xd')](),controller['removeAgents']);module[_0xad68('0x1c')]=router; \ No newline at end of file +var _0xf3aa=['exports','multer','util','path','connect-timeout','Router','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','delete','destroy','removeAgents'];(function(_0x4a891a,_0x91c52e){var _0x1efd64=function(_0x57c502){while(--_0x57c502){_0x4a891a['push'](_0x4a891a['shift']());}};_0x1efd64(++_0x91c52e);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x274939,_0x2a2cb8){_0x274939=_0x274939-0x0;var _0x28478e=_0xf3aa[_0x274939];return _0x28478e;};'use strict';var multer=require(_0xaf3a('0x0'));var util=require(_0xaf3a('0x1'));var path=require(_0xaf3a('0x2'));var timeout=require(_0xaf3a('0x3'));var express=require('express');var router=express[_0xaf3a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf3a('0x5'));var controller=require(_0xaf3a('0x6'));router[_0xaf3a('0x7')]('/',auth[_0xaf3a('0x8')](),controller[_0xaf3a('0x9')]);router[_0xaf3a('0x7')](_0xaf3a('0xa'),auth[_0xaf3a('0x8')](),controller['describe']);router['get'](_0xaf3a('0xb'),auth[_0xaf3a('0x8')](),controller[_0xaf3a('0xc')]);router['get']('/:id/members',auth[_0xaf3a('0x8')](),controller[_0xaf3a('0xd')]);router[_0xaf3a('0x7')](_0xaf3a('0xe'),auth[_0xaf3a('0x8')](),controller['getTeams']);router[_0xaf3a('0x7')](_0xaf3a('0xf'),auth['isAuthenticated'](),controller[_0xaf3a('0x10')]);router[_0xaf3a('0x11')]('/',auth[_0xaf3a('0x8')](),controller['create']);router[_0xaf3a('0x11')](_0xaf3a('0xe'),auth['isAuthenticated'](),controller[_0xaf3a('0x12')]);router['post']('/:id/users',auth[_0xaf3a('0x8')](),controller[_0xaf3a('0x13')]);router['put'](_0xaf3a('0xb'),auth[_0xaf3a('0x8')](),controller['update']);router[_0xaf3a('0x14')](_0xaf3a('0xb'),auth[_0xaf3a('0x8')](),controller[_0xaf3a('0x15')]);router['delete'](_0xaf3a('0xe'),auth[_0xaf3a('0x8')](),controller['removeTeams']);router['delete'](_0xaf3a('0xf'),auth['isAuthenticated'](),controller[_0xaf3a('0x16')]);module[_0xaf3a('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index dd84288..8adb61d 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 _0xddea=['exports','STRING','DATE','sequelize'];(function(_0x241d9c,_0x37d233){var _0x3783d4=function(_0x3f466e){while(--_0x3f466e){_0x241d9c['push'](_0x241d9c['shift']());}};_0x3783d4(++_0x37d233);}(_0xddea,0x1bb));var _0xadde=function(_0x45d9ad,_0x552dfd){_0x45d9ad=_0x45d9ad-0x0;var _0x41c3bc=_0xddea[_0x45d9ad];return _0x41c3bc;};'use strict';var moment=require('moment');var Sequelize=require(_0xadde('0x0'));module[_0xadde('0x1')]={'uniqueid':{'type':Sequelize[_0xadde('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xadde('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xadde('0x3')]},'acceptAt':{'type':Sequelize[_0xadde('0x3')]},'exitAt':{'type':Sequelize[_0xadde('0x3')]},'reason':{'type':Sequelize[_0xadde('0x2')]}}; \ No newline at end of file +var _0xa87b=['DATE','moment','exports','STRING'];(function(_0x1d443b,_0x441a65){var _0x552361=function(_0x272ff4){while(--_0x272ff4){_0x1d443b['push'](_0x1d443b['shift']());}};_0x552361(++_0x441a65);}(_0xa87b,0x1d9));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xba87('0x0'));var Sequelize=require('sequelize');module[_0xba87('0x1')]={'uniqueid':{'type':Sequelize[_0xba87('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xba87('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xba87('0x3')]},'acceptAt':{'type':Sequelize[_0xba87('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xba87('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2a081fa..fa1d146 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(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x757a,0xde));var _0xa757=function(_0x14880b,_0x469d19){_0x14880b=_0x14880b-0x0;var _0x3330ee=_0x757a[_0x14880b];return _0x3330ee;};'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 _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1e0bc8,_0xb2f1b8){var _0x3c190a=function(_0x5adc7a){while(--_0x5adc7a){_0x1e0bc8['push'](_0x1e0bc8['shift']());}};_0x3c190a(++_0xb2f1b8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['ChatQueueReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['ChatQueueReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index bc8f89a..f331a71 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 _0x6b16=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','uniqueid'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x6b16,0x1c3));var _0x66b1=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x6b16[_0x531d15];return _0x271a18;};'use strict';var _=require(_0x66b1('0x0'));var util=require(_0x66b1('0x1'));var logger=require(_0x66b1('0x2'))(_0x66b1('0x3'));var moment=require('moment');var BPromise=require(_0x66b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x66b1('0x5'));var rimraf=require(_0x66b1('0x6'));var config=require(_0x66b1('0x7'));var attributes=require('./chatQueueReport.attributes');module[_0x66b1('0x8')]=function(_0xb96e49,_0x597402){return _0xb96e49[_0x66b1('0x9')]('ChatQueueReport',attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x66b1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc04=['report_chat_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueueReport'];(function(_0x46796c,_0x5c060d){var _0x5a71e4=function(_0x117fc8){while(--_0x117fc8){_0x46796c['push'](_0x46796c['shift']());}};_0x5a71e4(++_0x5c060d);}(_0xbc04,0xaa));var _0x4bc0=function(_0x1200c4,_0x5c84fd){_0x1200c4=_0x1200c4-0x0;var _0x1cf050=_0xbc04[_0x1200c4];return _0x1cf050;};'use strict';var _=require(_0x4bc0('0x0'));var util=require(_0x4bc0('0x1'));var logger=require(_0x4bc0('0x2'))('api');var moment=require(_0x4bc0('0x3'));var BPromise=require(_0x4bc0('0x4'));var rp=require(_0x4bc0('0x5'));var fs=require('fs');var path=require(_0x4bc0('0x6'));var rimraf=require(_0x4bc0('0x7'));var config=require(_0x4bc0('0x8'));var attributes=require('./chatQueueReport.attributes');module[_0x4bc0('0x9')]=function(_0x2c779a,_0x46b348){return _0x2c779a[_0x4bc0('0xa')](_0x4bc0('0xb'),attributes,{'tableName':_0x4bc0('0xc'),'paranoid':![],'indexes':[{'name':_0x4bc0('0xd'),'fields':[_0x4bc0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 48727d2..08eeba6 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 _0x68e4=['UpdateChatQueueReport','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateChatQueueReport','ChatQueueReport','options','raw','stringify','catch','update','where'];(function(_0x27bfef,_0x10fe6e){var _0x3c67c6=function(_0x5d894e){while(--_0x5d894e){_0x27bfef['push'](_0x27bfef['shift']());}};_0x3c67c6(++_0x10fe6e);}(_0x68e4,0x97));var _0x468e=function(_0x3bb25a,_0x38441f){_0x3bb25a=_0x3bb25a-0x0;var _0xa89ae4=_0x68e4[_0x3bb25a];return _0xa89ae4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x468e('0x0'));var BPromise=require(_0x468e('0x1'));var rs=require(_0x468e('0x2'));var fs=require('fs');var Redis=require(_0x468e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x468e('0x4'));var logger=require('../../config/logger')(_0x468e('0x5'));var config=require(_0x468e('0x6'));var jayson=require(_0x468e('0x7'));var client=jayson[_0x468e('0x8')][_0x468e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a3eee,_0x24bdcd,_0x429cf5){return new BPromise(function(_0x9200f8,_0x4dadd8){return client[_0x468e('0xa')](_0x5a3eee,_0x429cf5)[_0x468e('0xb')](function(_0x5d78a7){logger[_0x468e('0xc')](_0x468e('0xd'),_0x24bdcd,_0x468e('0xe'));logger[_0x468e('0xf')](_0x468e('0x10'),_0x24bdcd,'request\x20sent',JSON['stringify'](_0x5d78a7));if(_0x5d78a7[_0x468e('0x11')]){if(_0x5d78a7[_0x468e('0x11')][_0x468e('0x12')]===0x1f4){logger[_0x468e('0x11')](_0x468e('0xd'),_0x24bdcd,_0x5d78a7[_0x468e('0x11')][_0x468e('0x13')]);return _0x4dadd8(_0x5d78a7['error'][_0x468e('0x13')]);}logger[_0x468e('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x24bdcd,_0x5d78a7[_0x468e('0x11')][_0x468e('0x13')]);return _0x9200f8(_0x5d78a7[_0x468e('0x11')][_0x468e('0x13')]);}else{logger[_0x468e('0xc')](_0x468e('0xd'),_0x24bdcd,_0x468e('0xe'));_0x9200f8(_0x5d78a7[_0x468e('0x14')][_0x468e('0x13')]);}})['catch'](function(_0x3bbe0b){logger[_0x468e('0x11')](_0x468e('0xd'),_0x24bdcd,_0x3bbe0b);_0x4dadd8(_0x3bbe0b);});});}exports[_0x468e('0x15')]=function(_0x2aba78){var _0x5a1e2c=this;return new Promise(function(_0x3e2a4c,_0x3ee86d){return db[_0x468e('0x16')]['create'](_0x2aba78['body'],{'raw':_0x2aba78[_0x468e('0x17')]?_0x2aba78['options'][_0x468e('0x18')]===undefined?!![]:![]:!![]})[_0x468e('0xb')](function(_0x2c02f6){logger[_0x468e('0xc')]('CreateChatQueueReport',_0x2aba78);logger[_0x468e('0xf')]('CreateChatQueueReport',_0x2aba78,JSON[_0x468e('0x19')](_0x2c02f6));_0x3e2a4c(_0x2c02f6);})[_0x468e('0x1a')](function(_0x18a86a){logger['error']('CreateChatQueueReport',_0x18a86a[_0x468e('0x13')],_0x2aba78);_0x3ee86d(_0x5a1e2c[_0x468e('0x11')](0x1f4,_0x18a86a[_0x468e('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0xbdbd4c){var _0x515930=this;return new Promise(function(_0xf68387,_0x45daf3){return db[_0x468e('0x16')][_0x468e('0x1b')](_0xbdbd4c['body'],{'raw':_0xbdbd4c[_0x468e('0x17')]?_0xbdbd4c[_0x468e('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbdbd4c[_0x468e('0x17')]?_0xbdbd4c['options'][_0x468e('0x1c')]||null:null,'attributes':_0xbdbd4c[_0x468e('0x17')]?_0xbdbd4c['options']['attributes']||null:null,'limit':_0xbdbd4c['options']?_0xbdbd4c[_0x468e('0x17')]['limit']||null:null})[_0x468e('0xb')](function(_0x1c52c3){logger[_0x468e('0xc')](_0x468e('0x1d'),_0xbdbd4c);logger[_0x468e('0xf')]('UpdateChatQueueReport',_0xbdbd4c,JSON[_0x468e('0x19')](_0x1c52c3));_0xf68387(_0x1c52c3);})['catch'](function(_0x5eb998){logger[_0x468e('0x11')](_0x468e('0x1d'),_0x5eb998['message'],_0xbdbd4c);_0x45daf3(_0x515930[_0x468e('0x11')](0x1f4,_0x5eb998[_0x468e('0x13')]));});});}; \ No newline at end of file +var _0xa300=['debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit'];(function(_0x229ba7,_0x23aff8){var _0x5bae2c=function(_0x2c2ce3){while(--_0x2c2ce3){_0x229ba7['push'](_0x229ba7['shift']());}};_0x5bae2c(++_0x23aff8);}(_0xa300,0x12a));var _0x0a30=function(_0x28793f,_0xf8c52e){_0x28793f=_0x28793f-0x0;var _0x14ee3a=_0xa300[_0x28793f];return _0x14ee3a;};'use strict';var _=require('lodash');var util=require(_0x0a30('0x0'));var moment=require(_0x0a30('0x1'));var BPromise=require(_0x0a30('0x2'));var rs=require(_0x0a30('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a30('0x4'))['db'];var utils=require(_0x0a30('0x5'));var logger=require(_0x0a30('0x6'))(_0x0a30('0x7'));var config=require(_0x0a30('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0a30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d969,_0x1d9a07,_0x377323){return new BPromise(function(_0x306984,_0x479b12){return client[_0x0a30('0xa')](_0x52d969,_0x377323)[_0x0a30('0xb')](function(_0x5d995e){logger[_0x0a30('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x1d9a07,_0x0a30('0xd'));logger['debug'](_0x0a30('0xe'),_0x1d9a07,_0x0a30('0xd'),JSON[_0x0a30('0xf')](_0x5d995e));if(_0x5d995e[_0x0a30('0x10')]){if(_0x5d995e[_0x0a30('0x10')]['code']===0x1f4){logger['error'](_0x0a30('0x11'),_0x1d9a07,_0x5d995e['error']['message']);return _0x479b12(_0x5d995e[_0x0a30('0x10')][_0x0a30('0x12')]);}logger[_0x0a30('0x10')](_0x0a30('0x11'),_0x1d9a07,_0x5d995e[_0x0a30('0x10')][_0x0a30('0x12')]);return _0x306984(_0x5d995e[_0x0a30('0x10')][_0x0a30('0x12')]);}else{logger['info'](_0x0a30('0x11'),_0x1d9a07,_0x0a30('0xd'));_0x306984(_0x5d995e[_0x0a30('0x13')][_0x0a30('0x12')]);}})[_0x0a30('0x14')](function(_0x43af2d){logger[_0x0a30('0x10')](_0x0a30('0x11'),_0x1d9a07,_0x43af2d);_0x479b12(_0x43af2d);});});}exports['CreateChatQueueReport']=function(_0x4ddb32){var _0x3faff1=this;return new Promise(function(_0x297528,_0x55558a){return db['ChatQueueReport'][_0x0a30('0x15')](_0x4ddb32[_0x0a30('0x16')],{'raw':_0x4ddb32[_0x0a30('0x17')]?_0x4ddb32['options'][_0x0a30('0x18')]===undefined?!![]:![]:!![]})[_0x0a30('0xb')](function(_0x427bc5){logger[_0x0a30('0xc')](_0x0a30('0x19'),_0x4ddb32);logger['debug']('CreateChatQueueReport',_0x4ddb32,JSON[_0x0a30('0xf')](_0x427bc5));_0x297528(_0x427bc5);})[_0x0a30('0x14')](function(_0x19760f){logger[_0x0a30('0x10')](_0x0a30('0x19'),_0x19760f[_0x0a30('0x12')],_0x4ddb32);_0x55558a(_0x3faff1['error'](0x1f4,_0x19760f['message']));});});};exports[_0x0a30('0x1a')]=function(_0x2ffa34){var _0x3e7f9b=this;return new Promise(function(_0x3d0259,_0x19bf97){return db[_0x0a30('0x1b')][_0x0a30('0x1c')](_0x2ffa34['body'],{'raw':_0x2ffa34[_0x0a30('0x17')]?_0x2ffa34[_0x0a30('0x17')][_0x0a30('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ffa34[_0x0a30('0x17')]?_0x2ffa34[_0x0a30('0x17')][_0x0a30('0x1d')]||null:null,'attributes':_0x2ffa34[_0x0a30('0x17')]?_0x2ffa34[_0x0a30('0x17')][_0x0a30('0x1e')]||null:null,'limit':_0x2ffa34[_0x0a30('0x17')]?_0x2ffa34['options'][_0x0a30('0x1f')]||null:null})[_0x0a30('0xb')](function(_0x73f5ce){logger[_0x0a30('0xc')](_0x0a30('0x1a'),_0x2ffa34);logger[_0x0a30('0x20')](_0x0a30('0x1a'),_0x2ffa34,JSON['stringify'](_0x73f5ce));_0x3d0259(_0x73f5ce);})['catch'](function(_0x4ea00a){logger[_0x0a30('0x10')](_0x0a30('0x1a'),_0x4ea00a[_0x0a30('0x12')],_0x2ffa34);_0x19bf97(_0x3e7f9b['error'](0x1f4,_0x4ea00a[_0x0a30('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 64437c5..45edc45 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 _0x52ee=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1cc8a2,_0x5dce88){var _0xadb7a6=function(_0x385f03){while(--_0x385f03){_0x1cc8a2['push'](_0x1cc8a2['shift']());}};_0xadb7a6(++_0x5dce88);}(_0x52ee,0x118));var _0xe52e=function(_0xf97eb0,_0x1578b7){_0xf97eb0=_0xf97eb0-0x0;var _0xea70f4=_0x52ee[_0xf97eb0];return _0xea70f4;};'use strict';var multer=require(_0xe52e('0x0'));var util=require(_0xe52e('0x1'));var path=require(_0xe52e('0x2'));var timeout=require(_0xe52e('0x3'));var express=require(_0xe52e('0x4'));var router=express[_0xe52e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe52e('0x6'));var config=require(_0xe52e('0x7'));var controller=require(_0xe52e('0x8'));router[_0xe52e('0x9')]('/',auth['isAuthenticated'](),controller[_0xe52e('0xa')]);router[_0xe52e('0x9')](_0xe52e('0xb'),auth[_0xe52e('0xc')](),controller[_0xe52e('0xd')]);router['get'](_0xe52e('0xe'),auth['isAuthenticated'](),controller[_0xe52e('0xf')]);router[_0xe52e('0x10')]('/',auth[_0xe52e('0xc')](),controller[_0xe52e('0x11')]);router[_0xe52e('0x12')](_0xe52e('0xe'),auth[_0xe52e('0xc')](),controller['update']);router[_0xe52e('0x13')](_0xe52e('0xe'),auth[_0xe52e('0xc')](),controller[_0xe52e('0x14')]);module[_0xe52e('0x15')]=router; \ No newline at end of file +var _0x104c=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create'];(function(_0xe972f5,_0x126e04){var _0x2f213a=function(_0x5df8e4){while(--_0x5df8e4){_0xe972f5['push'](_0xe972f5['shift']());}};_0x2f213a(++_0x126e04);}(_0x104c,0x123));var _0xc104=function(_0x176cb8,_0x1c7ab3){_0x176cb8=_0x176cb8-0x0;var _0x41c08b=_0x104c[_0x176cb8];return _0x41c08b;};'use strict';var multer=require('multer');var util=require(_0xc104('0x0'));var path=require(_0xc104('0x1'));var timeout=require(_0xc104('0x2'));var express=require(_0xc104('0x3'));var router=express[_0xc104('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc104('0x5'));var config=require(_0xc104('0x6'));var controller=require(_0xc104('0x7'));router['get']('/',auth[_0xc104('0x8')](),controller[_0xc104('0x9')]);router[_0xc104('0xa')](_0xc104('0xb'),auth[_0xc104('0x8')](),controller[_0xc104('0xc')]);router['get'](_0xc104('0xd'),auth[_0xc104('0x8')](),controller[_0xc104('0xe')]);router[_0xc104('0xf')]('/',auth[_0xc104('0x8')](),controller[_0xc104('0x10')]);router[_0xc104('0x11')](_0xc104('0xd'),auth[_0xc104('0x8')](),controller[_0xc104('0x12')]);router[_0xc104('0x13')](_0xc104('0xd'),auth['isAuthenticated'](),controller[_0xc104('0x14')]);module[_0xc104('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index dbcc16f..4cae2b1 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 _0x38f1=['sequelize','ENUM','agent','queue','DATE','NOW'];(function(_0x2697c0,_0x4efeff){var _0x421db=function(_0x158293){while(--_0x158293){_0x2697c0['push'](_0x2697c0['shift']());}};_0x421db(++_0x4efeff);}(_0x38f1,0xb4));var _0x138f=function(_0x1633b3,_0x2d84af){_0x1633b3=_0x1633b3-0x0;var _0x149a74=_0x38f1[_0x1633b3];return _0x149a74;};'use strict';var moment=require('moment');var Sequelize=require(_0x138f('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x138f('0x1')]('account',_0x138f('0x2'),_0x138f('0x3')),'allowNull':![],'defaultValue':_0x138f('0x3')},'transferredAt':{'type':Sequelize[_0x138f('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x138f('0x5')]}}; \ No newline at end of file +var _0xe94b=['ENUM','account','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1d3a1e,_0x6a0a91){var _0x3f18c=function(_0x6e46bc){while(--_0x6e46bc){_0x1d3a1e['push'](_0x1d3a1e['shift']());}};_0x3f18c(++_0x6a0a91);}(_0xe94b,0xe7));var _0xbe94=function(_0x4813c3,_0x1ceeb3){_0x4813c3=_0x4813c3-0x0;var _0x4803d2=_0xe94b[_0x4813c3];return _0x4803d2;};'use strict';var moment=require(_0xbe94('0x0'));var Sequelize=require(_0xbe94('0x1'));module[_0xbe94('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbe94('0x3')](_0xbe94('0x4'),_0xbe94('0x5'),_0xbe94('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbe94('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xbe94('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5389ed2..973fa72 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 _0xed54=['sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x265b74,_0x48f89d){var _0x2676b1=function(_0x3db713){while(--_0x3db713){_0x265b74['push'](_0x265b74['shift']());}};_0x2676b1(++_0x48f89d);}(_0xed54,0x198));var _0x4ed5=function(_0x1a5d6b,_0x5b14e1){_0x1a5d6b=_0x1a5d6b-0x0;var _0x5c80ee=_0xed54[_0x1a5d6b];return _0x5c80ee;};'use strict';var pdf=require(_0x4ed5('0x0'));var emlformat=require(_0x4ed5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4ed5('0x2'));var jsonpatch=require(_0x4ed5('0x3'));var rp=require(_0x4ed5('0x4'));var moment=require(_0x4ed5('0x5'));var BPromise=require(_0x4ed5('0x6'));var Mustache=require(_0x4ed5('0x7'));var util=require('util');var path=require(_0x4ed5('0x8'));var sox=require(_0x4ed5('0x9'));var csv=require(_0x4ed5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ed5('0xb'));var squel=require(_0x4ed5('0xc'));var crypto=require(_0x4ed5('0xd'));var jsforce=require(_0x4ed5('0xe'));var deskjs=require(_0x4ed5('0xf'));var toCsv=require(_0x4ed5('0xa'));var querystring=require(_0x4ed5('0x10'));var Papa=require(_0x4ed5('0x11'));var Redis=require(_0x4ed5('0x12'));var authService=require(_0x4ed5('0x13'));var qs=require(_0x4ed5('0x14'));var as=require(_0x4ed5('0x15'));var hardwareService=require(_0x4ed5('0x16'));var logger=require(_0x4ed5('0x17'))(_0x4ed5('0x18'));var utils=require(_0x4ed5('0x19'));var config=require('../../config/environment');var db=require(_0x4ed5('0x1a'))['db'];function respondWithStatusCode(_0x271d5f,_0x199074){_0x199074=_0x199074||0xcc;return function(_0x1d7925){if(_0x1d7925){return _0x271d5f[_0x4ed5('0x1b')](_0x199074);}return _0x271d5f[_0x4ed5('0x1c')](_0x199074)[_0x4ed5('0x1d')]();};}function respondWithResult(_0x4cc88e,_0x4379ed){_0x4379ed=_0x4379ed||0xc8;return function(_0x4dd089){if(_0x4dd089){return _0x4cc88e['status'](_0x4379ed)[_0x4ed5('0x1e')](_0x4dd089);}};}function respondWithFilteredResult(_0x44e6d7,_0x25e337){return function(_0xe8b1dc){if(_0xe8b1dc){var _0x53058d=_0xe8b1dc[_0x4ed5('0x1f')],_0x445946=_0x25e337[_0x4ed5('0x20')],_0x2458f7=_0x25e337[_0x4ed5('0x20')]+_0x25e337[_0x4ed5('0x21')],_0x2da38d;if(_0x2458f7>=_0x53058d){_0x2458f7=_0x53058d;_0x2da38d=0xc8;}else{_0x2da38d=0xce;}_0x44e6d7[_0x4ed5('0x1c')](_0x2da38d);return _0x44e6d7[_0x4ed5('0x22')](_0x4ed5('0x23'),_0x445946+'-'+_0x2458f7+'/'+_0x53058d)[_0x4ed5('0x1e')](_0xe8b1dc);}return null;};}function patchUpdates(_0x563c4a){return function(_0xa70222){try{jsonpatch[_0x4ed5('0x24')](_0xa70222,_0x563c4a,!![]);}catch(_0xf27cc2){return BPromise[_0x4ed5('0x25')](_0xf27cc2);}return _0xa70222[_0x4ed5('0x26')]();};}function saveUpdates(_0x2c2854,_0x4ff642){return function(_0x3aa782){if(_0x3aa782){return _0x3aa782[_0x4ed5('0x27')](_0x2c2854)[_0x4ed5('0x28')](function(_0x18007d){return _0x18007d;});}return null;};}function removeEntity(_0x4e1533,_0x449676){return function(_0x4b6eff){if(_0x4b6eff){return _0x4b6eff[_0x4ed5('0x29')]()[_0x4ed5('0x28')](function(){_0x4e1533[_0x4ed5('0x1c')](0xcc)[_0x4ed5('0x1d')]();});}};}function handleEntityNotFound(_0x313a5d,_0x153219){return function(_0x51a864){if(!_0x51a864){_0x313a5d[_0x4ed5('0x1b')](0x194);}return _0x51a864;};}function handleError(_0x33e428,_0x3d32c5){_0x3d32c5=_0x3d32c5||0x1f4;return function(_0x13ccdc){logger[_0x4ed5('0x2a')](_0x13ccdc[_0x4ed5('0x2b')]);if(_0x13ccdc['name']){delete _0x13ccdc[_0x4ed5('0x2c')];}_0x33e428['status'](_0x3d32c5)[_0x4ed5('0x2d')](_0x13ccdc);};}exports[_0x4ed5('0x2e')]=function(_0x5ca132,_0x5ebceb){var _0x582a6e={},_0x4bc4b6={},_0x3c510f={'count':0x0,'rows':[]};var _0x2f0663=_[_0x4ed5('0x2f')](db[_0x4ed5('0x30')]['rawAttributes'],function(_0x481224){return{'name':_0x481224[_0x4ed5('0x31')],'type':_0x481224['type']['key']};});_0x4bc4b6[_0x4ed5('0x32')]=_[_0x4ed5('0x2f')](_0x2f0663,'name');_0x4bc4b6[_0x4ed5('0x33')]=_[_0x4ed5('0x34')](_0x5ca132[_0x4ed5('0x33')]);_0x4bc4b6[_0x4ed5('0x35')]=_['intersection'](_0x4bc4b6[_0x4ed5('0x32')],_0x4bc4b6['query']);_0x582a6e[_0x4ed5('0x36')]=_[_0x4ed5('0x37')](_0x4bc4b6[_0x4ed5('0x32')],qs[_0x4ed5('0x38')](_0x5ca132[_0x4ed5('0x33')][_0x4ed5('0x38')]));_0x582a6e[_0x4ed5('0x36')]=_0x582a6e[_0x4ed5('0x36')][_0x4ed5('0x39')]?_0x582a6e[_0x4ed5('0x36')]:_0x4bc4b6['model'];if(!_0x5ca132[_0x4ed5('0x33')][_0x4ed5('0x3a')](_0x4ed5('0x3b'))){_0x582a6e[_0x4ed5('0x21')]=qs[_0x4ed5('0x21')](_0x5ca132['query'][_0x4ed5('0x21')]);_0x582a6e['offset']=qs[_0x4ed5('0x20')](_0x5ca132[_0x4ed5('0x33')][_0x4ed5('0x20')]);}_0x582a6e['order']=qs[_0x4ed5('0x3c')](_0x5ca132[_0x4ed5('0x33')][_0x4ed5('0x3c')]);_0x582a6e[_0x4ed5('0x3d')]=qs['filters'](_[_0x4ed5('0x3e')](_0x5ca132[_0x4ed5('0x33')],_0x4bc4b6[_0x4ed5('0x35')]),_0x2f0663);if(_0x5ca132[_0x4ed5('0x33')][_0x4ed5('0x3f')]){_0x582a6e['where']=_[_0x4ed5('0x40')](_0x582a6e[_0x4ed5('0x3d')],{'$or':_[_0x4ed5('0x2f')](_0x2f0663,function(_0x1bc12c){if(_0x1bc12c[_0x4ed5('0x41')]!=='VIRTUAL'){var _0x165c76={};_0x165c76[_0x1bc12c['name']]={'$like':'%'+_0x5ca132[_0x4ed5('0x33')][_0x4ed5('0x3f')]+'%'};return _0x165c76;}})});}_0x582a6e=_[_0x4ed5('0x40')]({},_0x582a6e,_0x5ca132[_0x4ed5('0x42')]);var _0x1175a5={'where':_0x582a6e['where']};return db[_0x4ed5('0x30')][_0x4ed5('0x1f')](_0x1175a5)[_0x4ed5('0x28')](function(_0x7a2952){_0x3c510f['count']=_0x7a2952;if(_0x5ca132[_0x4ed5('0x33')][_0x4ed5('0x43')]){_0x582a6e[_0x4ed5('0x44')]=[{'all':!![]}];}return db[_0x4ed5('0x30')][_0x4ed5('0x45')](_0x582a6e);})['then'](function(_0x4c1956){_0x3c510f[_0x4ed5('0x46')]=_0x4c1956;return _0x3c510f;})['then'](respondWithFilteredResult(_0x5ebceb,_0x582a6e))['catch'](handleError(_0x5ebceb,null));};exports['show']=function(_0x224578,_0x684e){var _0x6cfd34={'raw':!![],'where':{'id':_0x224578[_0x4ed5('0x47')]['id']}},_0x2fb4bd={};_0x2fb4bd['model']=_[_0x4ed5('0x34')](db[_0x4ed5('0x30')][_0x4ed5('0x48')]);_0x2fb4bd['query']=_[_0x4ed5('0x34')](_0x224578[_0x4ed5('0x33')]);_0x2fb4bd[_0x4ed5('0x35')]=_[_0x4ed5('0x37')](_0x2fb4bd['model'],_0x2fb4bd['query']);_0x6cfd34[_0x4ed5('0x36')]=_[_0x4ed5('0x37')](_0x2fb4bd[_0x4ed5('0x32')],qs[_0x4ed5('0x38')](_0x224578[_0x4ed5('0x33')][_0x4ed5('0x38')]));_0x6cfd34[_0x4ed5('0x36')]=_0x6cfd34[_0x4ed5('0x36')][_0x4ed5('0x39')]?_0x6cfd34[_0x4ed5('0x36')]:_0x2fb4bd[_0x4ed5('0x32')];if(_0x224578[_0x4ed5('0x33')][_0x4ed5('0x43')]){_0x6cfd34[_0x4ed5('0x44')]=[{'all':!![]}];}_0x6cfd34=_[_0x4ed5('0x40')]({},_0x6cfd34,_0x224578[_0x4ed5('0x42')]);return db[_0x4ed5('0x30')][_0x4ed5('0x49')](_0x6cfd34)[_0x4ed5('0x28')](handleEntityNotFound(_0x684e,null))[_0x4ed5('0x28')](respondWithResult(_0x684e,null))[_0x4ed5('0x4a')](handleError(_0x684e,null));};exports[_0x4ed5('0x4b')]=function(_0x187d16,_0x28f738){return db['ChatTransferReport'][_0x4ed5('0x4b')](_0x187d16[_0x4ed5('0x4c')],{})[_0x4ed5('0x28')](respondWithResult(_0x28f738,0xc9))[_0x4ed5('0x4a')](handleError(_0x28f738,null));};exports[_0x4ed5('0x27')]=function(_0x5da586,_0x6307a4){if(_0x5da586[_0x4ed5('0x4c')]['id']){delete _0x5da586[_0x4ed5('0x4c')]['id'];}return db[_0x4ed5('0x30')][_0x4ed5('0x49')]({'where':{'id':_0x5da586['params']['id']}})[_0x4ed5('0x28')](handleEntityNotFound(_0x6307a4,null))[_0x4ed5('0x28')](saveUpdates(_0x5da586[_0x4ed5('0x4c')],null))[_0x4ed5('0x28')](respondWithResult(_0x6307a4,null))['catch'](handleError(_0x6307a4,null));};exports[_0x4ed5('0x29')]=function(_0x537ac5,_0x283b51){return db[_0x4ed5('0x30')]['find']({'where':{'id':_0x537ac5['params']['id']}})[_0x4ed5('0x28')](handleEntityNotFound(_0x283b51,null))[_0x4ed5('0x28')](removeEntity(_0x283b51,null))[_0x4ed5('0x4a')](handleError(_0x283b51,null));};exports[_0x4ed5('0x4d')]=function(_0x44e604,_0x3a7238){return db[_0x4ed5('0x30')]['describe']()[_0x4ed5('0x28')](respondWithResult(_0x3a7238,null))[_0x4ed5('0x4a')](handleError(_0x3a7238,null));}; \ No newline at end of file +var _0x4f60=['show','params','include','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','findAll','rows','catch'];(function(_0xbce8bd,_0xc2544b){var _0xbb54b2=function(_0x502ebc){while(--_0x502ebc){_0xbce8bd['push'](_0xbce8bd['shift']());}};_0xbb54b2(++_0xc2544b);}(_0x4f60,0xa4));var _0x04f6=function(_0x43f413,_0x393f08){_0x43f413=_0x43f413-0x0;var _0x59b841=_0x4f60[_0x43f413];return _0x59b841;};'use strict';var pdf=require(_0x04f6('0x0'));var emlformat=require(_0x04f6('0x1'));var rimraf=require(_0x04f6('0x2'));var zipdir=require(_0x04f6('0x3'));var jsonpatch=require(_0x04f6('0x4'));var rp=require('request-promise');var moment=require(_0x04f6('0x5'));var BPromise=require(_0x04f6('0x6'));var Mustache=require(_0x04f6('0x7'));var util=require(_0x04f6('0x8'));var path=require('path');var sox=require(_0x04f6('0x9'));var csv=require(_0x04f6('0xa'));var ejs=require(_0x04f6('0xb'));var fs=require('fs');var _=require(_0x04f6('0xc'));var squel=require(_0x04f6('0xd'));var crypto=require(_0x04f6('0xe'));var jsforce=require(_0x04f6('0xf'));var deskjs=require(_0x04f6('0x10'));var toCsv=require(_0x04f6('0xa'));var querystring=require(_0x04f6('0x11'));var Papa=require(_0x04f6('0x12'));var Redis=require(_0x04f6('0x13'));var authService=require(_0x04f6('0x14'));var qs=require(_0x04f6('0x15'));var as=require(_0x04f6('0x16'));var hardwareService=require(_0x04f6('0x17'));var logger=require('../../config/logger')(_0x04f6('0x18'));var utils=require(_0x04f6('0x19'));var config=require(_0x04f6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e4712,_0x502a58){_0x502a58=_0x502a58||0xcc;return function(_0x2d5b75){if(_0x2d5b75){return _0x1e4712[_0x04f6('0x1b')](_0x502a58);}return _0x1e4712[_0x04f6('0x1c')](_0x502a58)[_0x04f6('0x1d')]();};}function respondWithResult(_0x3a96a8,_0x14c077){_0x14c077=_0x14c077||0xc8;return function(_0x5c2f99){if(_0x5c2f99){return _0x3a96a8[_0x04f6('0x1c')](_0x14c077)['json'](_0x5c2f99);}};}function respondWithFilteredResult(_0x1bf11b,_0x4bf9e9){return function(_0x36192e){if(_0x36192e){var _0x3f5e44=_0x36192e[_0x04f6('0x1e')],_0x3baf62=_0x4bf9e9[_0x04f6('0x1f')],_0x1db291=_0x4bf9e9[_0x04f6('0x1f')]+_0x4bf9e9[_0x04f6('0x20')],_0x5db6e9;if(_0x1db291>=_0x3f5e44){_0x1db291=_0x3f5e44;_0x5db6e9=0xc8;}else{_0x5db6e9=0xce;}_0x1bf11b['status'](_0x5db6e9);return _0x1bf11b[_0x04f6('0x21')](_0x04f6('0x22'),_0x3baf62+'-'+_0x1db291+'/'+_0x3f5e44)[_0x04f6('0x23')](_0x36192e);}return null;};}function patchUpdates(_0x125c68){return function(_0x37c940){try{jsonpatch[_0x04f6('0x24')](_0x37c940,_0x125c68,!![]);}catch(_0x14feeb){return BPromise[_0x04f6('0x25')](_0x14feeb);}return _0x37c940['save']();};}function saveUpdates(_0x2ce1ea,_0x9161b5){return function(_0x39829c){if(_0x39829c){return _0x39829c[_0x04f6('0x26')](_0x2ce1ea)['then'](function(_0x215100){return _0x215100;});}return null;};}function removeEntity(_0x1372f8,_0x33f68a){return function(_0x3224fb){if(_0x3224fb){return _0x3224fb[_0x04f6('0x27')]()[_0x04f6('0x28')](function(){_0x1372f8[_0x04f6('0x1c')](0xcc)[_0x04f6('0x1d')]();});}};}function handleEntityNotFound(_0x19cf25,_0x24f637){return function(_0x40522d){if(!_0x40522d){_0x19cf25['sendStatus'](0x194);}return _0x40522d;};}function handleError(_0x1c84dc,_0x21bcc2){_0x21bcc2=_0x21bcc2||0x1f4;return function(_0x59976c){logger[_0x04f6('0x29')](_0x59976c[_0x04f6('0x2a')]);if(_0x59976c[_0x04f6('0x2b')]){delete _0x59976c[_0x04f6('0x2b')];}_0x1c84dc[_0x04f6('0x1c')](_0x21bcc2)[_0x04f6('0x2c')](_0x59976c);};}exports['index']=function(_0x502dad,_0x311735){var _0x97cee={},_0x50a8ed={},_0x287824={'count':0x0,'rows':[]};var _0x15f742=_[_0x04f6('0x2d')](db[_0x04f6('0x2e')][_0x04f6('0x2f')],function(_0x4d3454){return{'name':_0x4d3454[_0x04f6('0x30')],'type':_0x4d3454[_0x04f6('0x31')][_0x04f6('0x32')]};});_0x50a8ed[_0x04f6('0x33')]=_[_0x04f6('0x2d')](_0x15f742,_0x04f6('0x2b'));_0x50a8ed[_0x04f6('0x34')]=_[_0x04f6('0x35')](_0x502dad[_0x04f6('0x34')]);_0x50a8ed[_0x04f6('0x36')]=_['intersection'](_0x50a8ed[_0x04f6('0x33')],_0x50a8ed[_0x04f6('0x34')]);_0x97cee[_0x04f6('0x37')]=_[_0x04f6('0x38')](_0x50a8ed[_0x04f6('0x33')],qs[_0x04f6('0x39')](_0x502dad[_0x04f6('0x34')][_0x04f6('0x39')]));_0x97cee[_0x04f6('0x37')]=_0x97cee[_0x04f6('0x37')]['length']?_0x97cee[_0x04f6('0x37')]:_0x50a8ed[_0x04f6('0x33')];if(!_0x502dad[_0x04f6('0x34')][_0x04f6('0x3a')](_0x04f6('0x3b'))){_0x97cee[_0x04f6('0x20')]=qs[_0x04f6('0x20')](_0x502dad['query'][_0x04f6('0x20')]);_0x97cee[_0x04f6('0x1f')]=qs[_0x04f6('0x1f')](_0x502dad['query']['offset']);}_0x97cee[_0x04f6('0x3c')]=qs[_0x04f6('0x3d')](_0x502dad[_0x04f6('0x34')][_0x04f6('0x3d')]);_0x97cee[_0x04f6('0x3e')]=qs[_0x04f6('0x36')](_[_0x04f6('0x3f')](_0x502dad['query'],_0x50a8ed[_0x04f6('0x36')]),_0x15f742);if(_0x502dad[_0x04f6('0x34')]['filter']){_0x97cee[_0x04f6('0x3e')]=_[_0x04f6('0x40')](_0x97cee[_0x04f6('0x3e')],{'$or':_[_0x04f6('0x2d')](_0x15f742,function(_0x1fa81){if(_0x1fa81[_0x04f6('0x31')]!==_0x04f6('0x41')){var _0x434873={};_0x434873[_0x1fa81[_0x04f6('0x2b')]]={'$like':'%'+_0x502dad['query']['filter']+'%'};return _0x434873;}})});}_0x97cee=_[_0x04f6('0x40')]({},_0x97cee,_0x502dad['options']);var _0x52ef16={'where':_0x97cee[_0x04f6('0x3e')]};return db[_0x04f6('0x2e')][_0x04f6('0x1e')](_0x52ef16)[_0x04f6('0x28')](function(_0x4d9b61){_0x287824[_0x04f6('0x1e')]=_0x4d9b61;if(_0x502dad['query'][_0x04f6('0x42')]){_0x97cee['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x04f6('0x43')](_0x97cee);})[_0x04f6('0x28')](function(_0x306d8e){_0x287824[_0x04f6('0x44')]=_0x306d8e;return _0x287824;})['then'](respondWithFilteredResult(_0x311735,_0x97cee))[_0x04f6('0x45')](handleError(_0x311735,null));};exports[_0x04f6('0x46')]=function(_0x29f663,_0x188656){var _0x3a33d0={'raw':!![],'where':{'id':_0x29f663[_0x04f6('0x47')]['id']}},_0x2ab7d4={};_0x2ab7d4[_0x04f6('0x33')]=_[_0x04f6('0x35')](db[_0x04f6('0x2e')]['rawAttributes']);_0x2ab7d4[_0x04f6('0x34')]=_[_0x04f6('0x35')](_0x29f663[_0x04f6('0x34')]);_0x2ab7d4[_0x04f6('0x36')]=_[_0x04f6('0x38')](_0x2ab7d4['model'],_0x2ab7d4[_0x04f6('0x34')]);_0x3a33d0[_0x04f6('0x37')]=_[_0x04f6('0x38')](_0x2ab7d4[_0x04f6('0x33')],qs[_0x04f6('0x39')](_0x29f663[_0x04f6('0x34')][_0x04f6('0x39')]));_0x3a33d0[_0x04f6('0x37')]=_0x3a33d0[_0x04f6('0x37')]['length']?_0x3a33d0[_0x04f6('0x37')]:_0x2ab7d4[_0x04f6('0x33')];if(_0x29f663[_0x04f6('0x34')]['includeAll']){_0x3a33d0[_0x04f6('0x48')]=[{'all':!![]}];}_0x3a33d0=_[_0x04f6('0x40')]({},_0x3a33d0,_0x29f663[_0x04f6('0x49')]);return db[_0x04f6('0x2e')]['find'](_0x3a33d0)[_0x04f6('0x28')](handleEntityNotFound(_0x188656,null))[_0x04f6('0x28')](respondWithResult(_0x188656,null))['catch'](handleError(_0x188656,null));};exports['create']=function(_0x37b05b,_0xdc7813){return db[_0x04f6('0x2e')][_0x04f6('0x4a')](_0x37b05b[_0x04f6('0x4b')],{})['then'](respondWithResult(_0xdc7813,0xc9))[_0x04f6('0x45')](handleError(_0xdc7813,null));};exports[_0x04f6('0x26')]=function(_0x1ac70c,_0x500496){if(_0x1ac70c[_0x04f6('0x4b')]['id']){delete _0x1ac70c['body']['id'];}return db[_0x04f6('0x2e')][_0x04f6('0x4c')]({'where':{'id':_0x1ac70c[_0x04f6('0x47')]['id']}})['then'](handleEntityNotFound(_0x500496,null))[_0x04f6('0x28')](saveUpdates(_0x1ac70c[_0x04f6('0x4b')],null))[_0x04f6('0x28')](respondWithResult(_0x500496,null))[_0x04f6('0x45')](handleError(_0x500496,null));};exports[_0x04f6('0x27')]=function(_0x297c30,_0x91c3f2){return db[_0x04f6('0x2e')][_0x04f6('0x4c')]({'where':{'id':_0x297c30[_0x04f6('0x47')]['id']}})[_0x04f6('0x28')](handleEntityNotFound(_0x91c3f2,null))[_0x04f6('0x28')](removeEntity(_0x91c3f2,null))[_0x04f6('0x45')](handleError(_0x91c3f2,null));};exports[_0x04f6('0x4d')]=function(_0x485d10,_0x4dd84d){return db[_0x04f6('0x2e')]['describe']()[_0x04f6('0x28')](respondWithResult(_0x4dd84d,null))['catch'](handleError(_0x4dd84d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b7ed165..81386ef 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 _0xf3cd=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x6b6340,_0x6302c4){_0x6b6340=_0x6b6340-0x0;var _0x3609bf=_0xf3cd[_0x6b6340];return _0x3609bf;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdf3c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x34e8,0x12c));var _0x834e=function(_0xaeb12f,_0x330ccd){_0xaeb12f=_0xaeb12f-0x0;var _0x1ee3bb=_0x34e8[_0xaeb12f];return _0x1ee3bb;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index b3cfe11..fd85888 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 _0x907c=['client','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4f6c8f,_0x2735b0){var _0x308297=function(_0x2e1782){while(--_0x2e1782){_0x4f6c8f['push'](_0x4f6c8f['shift']());}};_0x308297(++_0x2735b0);}(_0x907c,0x98));var _0xc907=function(_0x3edc8f,_0xac527e){_0x3edc8f=_0x3edc8f-0x0;var _0x34f402=_0x907c[_0x3edc8f];return _0x34f402;};'use strict';var _=require(_0xc907('0x0'));var util=require(_0xc907('0x1'));var moment=require(_0xc907('0x2'));var BPromise=require(_0xc907('0x3'));var rs=require(_0xc907('0x4'));var fs=require('fs');var Redis=require(_0xc907('0x5'));var db=require(_0xc907('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc907('0x7'))(_0xc907('0x8'));var config=require(_0xc907('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc907('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eaded,_0x1ee3fa,_0x5608c4){return new BPromise(function(_0x46f1a3,_0x44946c){return client['request'](_0x3eaded,_0x5608c4)['then'](function(_0x44e40d){logger['info'](_0xc907('0xb'),_0x1ee3fa,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x1ee3fa,_0xc907('0xc'),JSON[_0xc907('0xd')](_0x44e40d));if(_0x44e40d['error']){if(_0x44e40d['error']['code']===0x1f4){logger[_0xc907('0xe')](_0xc907('0xb'),_0x1ee3fa,_0x44e40d[_0xc907('0xe')][_0xc907('0xf')]);return _0x44946c(_0x44e40d[_0xc907('0xe')][_0xc907('0xf')]);}logger[_0xc907('0xe')](_0xc907('0xb'),_0x1ee3fa,_0x44e40d['error']['message']);return _0x46f1a3(_0x44e40d['error'][_0xc907('0xf')]);}else{logger['info'](_0xc907('0xb'),_0x1ee3fa,_0xc907('0xc'));_0x46f1a3(_0x44e40d[_0xc907('0x10')][_0xc907('0xf')]);}})[_0xc907('0x11')](function(_0x4c3649){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x1ee3fa,_0x4c3649);_0x44946c(_0x4c3649);});});} \ No newline at end of file +var _0x5a0f=['message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s'];(function(_0x55803a,_0x1e521c){var _0x2b9355=function(_0xb4ef06){while(--_0xb4ef06){_0x55803a['push'](_0x55803a['shift']());}};_0x2b9355(++_0x1e521c);}(_0x5a0f,0x18f));var _0xf5a0=function(_0x3b1dbf,_0x54e7ff){_0x3b1dbf=_0x3b1dbf-0x0;var _0x3e1498=_0x5a0f[_0x3b1dbf];return _0x3e1498;};'use strict';var _=require('lodash');var util=require(_0xf5a0('0x0'));var moment=require(_0xf5a0('0x1'));var BPromise=require(_0xf5a0('0x2'));var rs=require(_0xf5a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5a0('0x4'))['db'];var utils=require(_0xf5a0('0x5'));var logger=require('../../config/logger')(_0xf5a0('0x6'));var config=require(_0xf5a0('0x7'));var jayson=require(_0xf5a0('0x8'));var client=jayson['client'][_0xf5a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18e8e7,_0x578b81,_0x172a1f){return new BPromise(function(_0x25b446,_0x44a9e9){return client[_0xf5a0('0xa')](_0x18e8e7,_0x172a1f)[_0xf5a0('0xb')](function(_0x4edf75){logger[_0xf5a0('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x578b81,_0xf5a0('0xd'));logger['debug'](_0xf5a0('0xe'),_0x578b81,_0xf5a0('0xd'),JSON[_0xf5a0('0xf')](_0x4edf75));if(_0x4edf75[_0xf5a0('0x10')]){if(_0x4edf75[_0xf5a0('0x10')][_0xf5a0('0x11')]===0x1f4){logger[_0xf5a0('0x10')](_0xf5a0('0x12'),_0x578b81,_0x4edf75[_0xf5a0('0x10')]['message']);return _0x44a9e9(_0x4edf75[_0xf5a0('0x10')]['message']);}logger['error'](_0xf5a0('0x12'),_0x578b81,_0x4edf75['error'][_0xf5a0('0x13')]);return _0x25b446(_0x4edf75[_0xf5a0('0x10')][_0xf5a0('0x13')]);}else{logger[_0xf5a0('0xc')](_0xf5a0('0x12'),_0x578b81,_0xf5a0('0xd'));_0x25b446(_0x4edf75[_0xf5a0('0x14')][_0xf5a0('0x13')]);}})[_0xf5a0('0x15')](function(_0x38cdbb){logger[_0xf5a0('0x10')](_0xf5a0('0x12'),_0x578b81,_0x38cdbb);_0x44a9e9(_0x38cdbb);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 806e2d8..9200b25 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 _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x27d638,_0x4f8f75){var _0x4ebdc9=function(_0x12f931){while(--_0x12f931){_0x27d638['push'](_0x27d638['shift']());}};_0x4ebdc9(++_0x4f8f75);}(_0x2032,0xd9));var _0x2203=function(_0x25f8b5,_0x326035){_0x25f8b5=_0x25f8b5-0x0;var _0x594923=_0x2032[_0x25f8b5];return _0x594923;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=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(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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 b9b8166..9a995b5 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 _0xa680=['Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','thumb','stringify','input','name','getDataValue','onlineForm','setDataValue','TEXT','email','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','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:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','address','Agent','#011F6A','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'];(function(_0x1d32db,_0x12ffc4){var _0x240aba=function(_0x37b362){while(--_0x37b362){_0x1d32db['push'](_0x1d32db['shift']());}};_0x240aba(++_0x12ffc4);}(_0xa680,0xb0));var _0x0a68=function(_0x2dfb0d,_0x761023){_0x2dfb0d=_0x2dfb0d-0x0;var _0x2ca23f=_0xa680[_0x2dfb0d];return _0x2ca23f;};'use strict';var Sequelize=require(_0x0a68('0x0'));var rs=require(_0x0a68('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x0a68('0x2')],'allowNull':![],'unique':_0x0a68('0x3')},'description':{'type':Sequelize[_0x0a68('0x2')]},'mapKey':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0a68('0x4')},'customerAlias':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0a68('0x2')],'allowNull':![],'defaultValue':_0x0a68('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0a68('0x2')],'allowNull':![],'defaultValue':_0x0a68('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0a68('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0a68('0x2')]},'animation':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0a68('0x7')](_0x0a68('0x8'),_0x0a68('0x9')),'defaultValue':_0x0a68('0x8')},'header_online':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0xa')},'start_chat_button':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0xb')},'header_offline':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0xc')},'download_transcript':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0a68('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0x10')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0a68('0x11')},'closingMessage':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0x12')},'closingMessageButton':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0xb')},'skipMessageButton':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x0a68('0x13'),_0x0a68('0x14')),'defaultValue':_0x0a68('0x13')},'ratingStarsNumber':{'type':Sequelize[_0x0a68('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0a68('0x15')]({'items':[{'type':_0x0a68('0x16'),'variable':null,'config':{'placeholder':_0x0a68('0x17'),'type':'text','required':!![]},'props':{'title':_0x0a68('0x17'),'helpText':''}},{'type':_0x0a68('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0a68('0x18')](_0x0a68('0x19'))?JSON['parse'](this['getDataValue'](_0x0a68('0x19'))):{};},'set':function(_0x4fc58e){return this[_0x0a68('0x1a')]('onlineForm',JSON[_0x0a68('0x15')](_0x4fc58e));}},'offlineForm':{'type':Sequelize[_0x0a68('0x1b')],'defaultValue':function(){return JSON[_0x0a68('0x15')]({'items':[{'type':_0x0a68('0x16'),'props':{'title':_0x0a68('0x1c'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0a68('0x1c')},'variable':null},{'type':_0x0a68('0x1d'),'config':{'placeholder':_0x0a68('0x1e')},'props':{'title':'Comments','helpText':_0x0a68('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x0a68('0x18')]('offlineForm')?JSON[_0x0a68('0x20')](this[_0x0a68('0x18')]('offlineForm')):{};},'set':function(_0x3349b2){return this[_0x0a68('0x1a')](_0x0a68('0x21'),JSON[_0x0a68('0x15')](_0x3349b2));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0a68('0x2')]},'forwardOffline':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0a68('0x2')]},'waitingTitle':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0a68('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0x23')},'offlineMessageBody':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0x24')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0x25')},'sendUnmanaged':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0a68('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0a68('0x1b')],'defaultValue':function(){return _0x0a68('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0a68('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0x29')},'defaultTitle':{'type':Sequelize[_0x0a68('0x2')]},'customerAvatar':{'type':Sequelize[_0x0a68('0x1b')]},'showCustomerAvatar':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0a68('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0a68('0x2')],'allowNull':![],'defaultValue':_0x0a68('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0a68('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0a68('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':_0x0a68('0x2b')},'systemAvatar':{'type':Sequelize[_0x0a68('0x1b')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0a68('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![],'comment':_0x0a68('0x2d'),'set':function(_0x2ee8dd){if(!_0x2ee8dd)this[_0x0a68('0x1a')](_0x0a68('0x2e'),null);this[_0x0a68('0x1a')](_0x0a68('0x2f'),_0x2ee8dd);}},'vidaooEscalation':{'type':Sequelize[_0x0a68('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0a68('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x971d=['Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','thumb','star','INTEGER','stringify','input','name','text','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.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send'];(function(_0x550552,_0x911116){var _0x2486df=function(_0x1a6bbc){while(--_0x1a6bbc){_0x550552['push'](_0x550552['shift']());}};_0x2486df(++_0x911116);}(_0x971d,0xc5));var _0xd971=function(_0x3730ba,_0x4d3cc7){_0x3730ba=_0x3730ba-0x0;var _0x3ee6e5=_0x971d[_0x3730ba];return _0x3ee6e5;};'use strict';var Sequelize=require(_0xd971('0x0'));var rs=require(_0xd971('0x1'));module[_0xd971('0x2')]={'name':{'type':Sequelize[_0xd971('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd971('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x5')},'mapKeyOffline':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x5')},'key':{'type':Sequelize[_0xd971('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x6')},'customerAlias':{'type':Sequelize[_0xd971('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd971('0x3')],'allowNull':![],'defaultValue':_0xd971('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd971('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd971('0x3')],'allowNull':![],'defaultValue':_0xd971('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd971('0x3')]},'animation':{'type':Sequelize[_0xd971('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd971('0xa')](_0xd971('0xb'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0xc')},'start_chat_button':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xd971('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xd971('0xf')},'download_transcript':{'type':Sequelize[_0xd971('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd971('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xd971('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd971('0x10')]},'closingQuestion':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd971('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xd971('0x14')},'placeholderMessage':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd971('0x16')},'closingMessageButton':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0xe')},'skipMessageButton':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd971('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xd971('0xa')]('star',_0xd971('0x18')),'defaultValue':_0xd971('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xd971('0x1a')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd971('0x10')],'defaultValue':function(){return JSON[_0xd971('0x1b')]({'items':[{'type':_0xd971('0x1c'),'variable':null,'config':{'placeholder':_0xd971('0x1d'),'type':_0xd971('0x1e'),'required':!![]},'props':{'title':_0xd971('0x1d'),'helpText':''}},{'type':_0xd971('0x1c'),'props':{'title':_0xd971('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xd971('0x5'),'type':_0xd971('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd971('0x1f')](_0xd971('0x20'))?JSON[_0xd971('0x21')](this[_0xd971('0x1f')](_0xd971('0x20'))):{};},'set':function(_0x4d0c81){return this[_0xd971('0x22')](_0xd971('0x20'),JSON[_0xd971('0x1b')](_0x4d0c81));}},'offlineForm':{'type':Sequelize[_0xd971('0x10')],'defaultValue':function(){return JSON[_0xd971('0x1b')]({'items':[{'type':_0xd971('0x1c'),'props':{'title':_0xd971('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xd971('0x5'),'type':_0xd971('0x5')},'variable':null},{'type':_0xd971('0x23'),'config':{'placeholder':_0xd971('0x24')},'props':{'title':_0xd971('0x24'),'helpText':_0xd971('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0xd971('0x1f')]('offlineForm')?JSON['parse'](this[_0xd971('0x1f')](_0xd971('0x26'))):{};},'set':function(_0x52973c){return this['setDataValue'](_0xd971('0x26'),JSON[_0xd971('0x1b')](_0x52973c));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd971('0x27')]();}},'autoclose':{'type':Sequelize[_0xd971('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd971('0x3')]},'forwardOffline':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x28')},'waitingMessage':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x29')},'offlineMessageSubject':{'type':Sequelize[_0xd971('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xd971('0x2a')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x2b')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xd971('0x17')},'sendUnmanaged':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd971('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xd971('0x10')],'defaultValue':function(){return _0xd971('0x2c');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd971('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xd971('0x1a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x2d')},'verticalAlignment':{'type':Sequelize[_0xd971('0x1a')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x2e')},'defaultTitle':{'type':Sequelize[_0xd971('0x3')]},'customerAvatar':{'type':Sequelize[_0xd971('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xd971('0x1a')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd971('0x3')],'allowNull':![],'defaultValue':_0xd971('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd971('0x1a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd971('0x3')],'defaultValue':_0xd971('0x30')},'systemAvatar':{'type':Sequelize[_0xd971('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd971('0x1a')],'comment':_0xd971('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![],'comment':_0xd971('0x32'),'set':function(_0x516337){if(!_0x516337)this[_0xd971('0x22')](_0xd971('0x33'),null);this[_0xd971('0x22')](_0xd971('0x34'),_0x516337);}},'vidaooEscalation':{'type':Sequelize[_0xd971('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd971('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index c6e4b00..14e01ca 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 _0xe72f=['tag','Command','iftime\x20%s,%s','timezone','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','readFileSync','server/files/chat/iframe.js','remote','connection','referer','replace','alignment','verticalAlignment','color','textColor','addApplications','sequelize','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','ChatWebsite','fieldName','type','key','map','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','Pause','mandatoryDispositionPause','rawAttributes','intersection','find','create','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','findOne','length','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','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','from','List','Contacts','ChatApplication','Applications','account','list','applications','orderBy','priority','asc','contact','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','browser','version','%s\x20%s','unknown','format','vendor','device','stringify','threadId','ChatInteraction','externalUrl','interaction','firstName','messageId','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','unshift','startRouting','EventManager','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','spread','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','User','Owner','internal','Tag','Tags'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0xe72f,0x14b));var _0xfe72=function(_0x3c1871,_0x497b6a){_0x3c1871=_0x3c1871-0x0;var _0x1b47d4=_0xe72f[_0x3c1871];return _0x1b47d4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfe72('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe72('0x1'));var rp=require(_0xfe72('0x2'));var moment=require(_0xfe72('0x3'));var BPromise=require(_0xfe72('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfe72('0x5'));var sox=require(_0xfe72('0x6'));var csv=require(_0xfe72('0x7'));var ejs=require(_0xfe72('0x8'));var fs=require('fs');var _=require(_0xfe72('0x9'));var squel=require(_0xfe72('0xa'));var crypto=require(_0xfe72('0xb'));var jsforce=require(_0xfe72('0xc'));var deskjs=require(_0xfe72('0xd'));var toCsv=require(_0xfe72('0x7'));var querystring=require(_0xfe72('0xe'));var Papa=require(_0xfe72('0xf'));var Redis=require(_0xfe72('0x10'));var authService=require(_0xfe72('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe72('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfe72('0x13'));var db=require(_0xfe72('0x14'))['db'];config[_0xfe72('0x15')]=_[_0xfe72('0x16')](config['redis'],{'host':_0xfe72('0x17'),'port':0x18eb});var socket=require(_0xfe72('0x18'))(new Redis(config['redis']));require(_0xfe72('0x19'))[_0xfe72('0x1a')](socket);var jayson=require(_0xfe72('0x1b'));var client=jayson[_0xfe72('0x1c')][_0xfe72('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xfe72('0x1d')]({'port':0x232a});var client9003=jayson[_0xfe72('0x1c')]['http']({'port':0x232b});function checkPasswordPattern(_0x2d43d1,_0x1d3998,_0x250691){if(_0x250691){var _0x1d8ae5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d8ae5['test'](_0x1d3998)){return _0x2d43d1;}else{throw new db[(_0xfe72('0x1e'))][(_0xfe72('0x1f'))](_0xfe72('0x20'));}}else{return _0x2d43d1;}}function respondWithRpcPromise(_0x338914,_0x42f7a3,_0x5dbdd2,_0x1b6b23){return new BPromise(function(_0x124d31,_0x368db3){var _0x17469b=_0x1b6b23||client;return _0x17469b[_0xfe72('0x21')](_0x338914,_0x5dbdd2)[_0xfe72('0x22')](function(_0x5ac82c){logger['info'](_0xfe72('0x23'),_0x42f7a3,_0xfe72('0x24'));logger[_0xfe72('0x25')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x42f7a3,_0xfe72('0x24'),JSON['stringify'](_0x5ac82c));if(_0x5ac82c[_0xfe72('0x26')]){if(_0x5ac82c[_0xfe72('0x26')][_0xfe72('0x27')]===0x1f4){logger[_0xfe72('0x26')](_0xfe72('0x23'),_0x42f7a3,_0x5ac82c[_0xfe72('0x26')][_0xfe72('0x28')]);return _0x368db3(_0x5ac82c['error']['message']);}logger[_0xfe72('0x26')](_0xfe72('0x23'),_0x42f7a3,_0x5ac82c[_0xfe72('0x26')][_0xfe72('0x28')]);return _0x124d31(_0x5ac82c[_0xfe72('0x26')][_0xfe72('0x28')]);}else{logger[_0xfe72('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x42f7a3,'request\x20sent');_0x124d31(_0x5ac82c[_0xfe72('0x2a')][_0xfe72('0x28')]);}})[_0xfe72('0x2b')](function(_0x2d12ec){logger[_0xfe72('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x42f7a3,_0x2d12ec);_0x368db3(_0x2d12ec);});});}function respondWithStatusCode(_0x21aab9,_0x130488){_0x130488=_0x130488||0xcc;return function(_0x2dc9ad){if(_0x2dc9ad){return _0x21aab9['sendStatus'](_0x130488);}return _0x21aab9['status'](_0x130488)[_0xfe72('0x2c')]();};}function respondWithResult(_0x4698af,_0x53b61f){_0x53b61f=_0x53b61f||0xc8;return function(_0x4d0326){if(_0x4d0326){return _0x4698af[_0xfe72('0x2d')](_0x53b61f)[_0xfe72('0x2e')](_0x4d0326);}};}function respondWithFilteredResult(_0x3d7786,_0x4ab2f3){return function(_0xfccbb2){if(_0xfccbb2){var _0x542293=_0xfccbb2[_0xfe72('0x2f')],_0x2e235e=_0x4ab2f3[_0xfe72('0x30')],_0x104c2d=_0x4ab2f3[_0xfe72('0x30')]+_0x4ab2f3[_0xfe72('0x31')],_0xa6eb;if(_0x104c2d>=_0x542293){_0x104c2d=_0x542293;_0xa6eb=0xc8;}else{_0xa6eb=0xce;}_0x3d7786[_0xfe72('0x2d')](_0xa6eb);return _0x3d7786[_0xfe72('0x32')](_0xfe72('0x33'),_0x2e235e+'-'+_0x104c2d+'/'+_0x542293)['json'](_0xfccbb2);}return null;};}function patchUpdates(_0x12f57a){return function(_0x218a88){try{jsonpatch[_0xfe72('0x34')](_0x218a88,_0x12f57a,!![]);}catch(_0x41735c){return BPromise['reject'](_0x41735c);}return _0x218a88[_0xfe72('0x35')]();};}function saveUpdates(_0x332d44,_0x4a57ae){return function(_0x4dd65d){if(_0x4dd65d){return _0x4dd65d[_0xfe72('0x36')](_0x332d44)[_0xfe72('0x22')](function(_0x8e619d){return _0x8e619d;});}return null;};}function removeEntity(_0x1082c0,_0x2b8e15){return function(_0x41eb71){if(_0x41eb71){return _0x41eb71[_0xfe72('0x37')]()[_0xfe72('0x22')](function(){var _0x231969=_0x41eb71['get']({'plain':!![]});var _0x24277a=_0xfe72('0x38');return db[_0xfe72('0x39')]['destroy']({'where':{'type':_0x24277a,'resourceId':_0x231969['id']}})[_0xfe72('0x22')](function(){return _0x41eb71;});})[_0xfe72('0x22')](function(){_0x1082c0['status'](0xcc)[_0xfe72('0x2c')]();});}};}function handleEntityNotFound(_0xb762d,_0x2a0da0){return function(_0x1b3597){if(!_0x1b3597){_0xb762d[_0xfe72('0x3a')](0x194);}return _0x1b3597;};}function handleError(_0x36bff2,_0x6ae79a){_0x6ae79a=_0x6ae79a||0x1f4;return function(_0x163ccc){logger[_0xfe72('0x26')](_0x163ccc[_0xfe72('0x3b')]);if(_0x163ccc[_0xfe72('0x3c')]){delete _0x163ccc[_0xfe72('0x3c')];}_0x36bff2[_0xfe72('0x2d')](_0x6ae79a)[_0xfe72('0x3d')](_0x163ccc);};}exports[_0xfe72('0x3e')]=function(_0xba2056,_0x58e241){var _0xbc4a8={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x9f2e9={},_0x5c514e={'count':0x0,'rows':[]};var _0x19e2f4=_['map'](db[_0xfe72('0x3f')]['rawAttributes'],function(_0x342748){return{'name':_0x342748[_0xfe72('0x40')],'type':_0x342748[_0xfe72('0x41')][_0xfe72('0x42')]};});_0x9f2e9['model']=_[_0xfe72('0x43')](_0x19e2f4,'name');_0x9f2e9[_0xfe72('0x44')]=_[_0xfe72('0x45')](_0xba2056[_0xfe72('0x44')]);_0x9f2e9[_0xfe72('0x46')]=_['intersection'](_0x9f2e9[_0xfe72('0x47')],_0x9f2e9[_0xfe72('0x44')]);_0xbc4a8[_0xfe72('0x48')]=_['intersection'](_0x9f2e9[_0xfe72('0x47')],qs[_0xfe72('0x49')](_0xba2056[_0xfe72('0x44')][_0xfe72('0x49')]));_0xbc4a8['attributes']=_0xbc4a8[_0xfe72('0x48')]['length']?_0xbc4a8['attributes']:_0x9f2e9[_0xfe72('0x47')];if(!_0xba2056[_0xfe72('0x44')][_0xfe72('0x4a')](_0xfe72('0x4b'))){_0xbc4a8['limit']=qs[_0xfe72('0x31')](_0xba2056[_0xfe72('0x44')][_0xfe72('0x31')]);_0xbc4a8[_0xfe72('0x30')]=qs[_0xfe72('0x30')](_0xba2056[_0xfe72('0x44')]['offset']);}_0xbc4a8[_0xfe72('0x4c')]=qs[_0xfe72('0x4d')](_0xba2056[_0xfe72('0x44')][_0xfe72('0x4d')]);_0xbc4a8['where']=qs[_0xfe72('0x46')](_[_0xfe72('0x4e')](_0xba2056[_0xfe72('0x44')],_0x9f2e9[_0xfe72('0x46')]),_0x19e2f4);if(_0xba2056[_0xfe72('0x44')][_0xfe72('0x4f')]){_0xbc4a8[_0xfe72('0x50')]=_[_0xfe72('0x51')](_0xbc4a8[_0xfe72('0x50')],{'$or':_[_0xfe72('0x43')](_0x19e2f4,function(_0x5a7d85){if(_0x5a7d85['type']!==_0xfe72('0x52')){var _0x3cc02d={};_0x3cc02d[_0x5a7d85[_0xfe72('0x3c')]]={'$like':'%'+_0xba2056[_0xfe72('0x44')]['filter']+'%'};return _0x3cc02d;}})});}_0xbc4a8=_[_0xfe72('0x51')]({},_0xbc4a8,_0xba2056[_0xfe72('0x53')]);var _0x1a4d76={'where':_0xbc4a8['where']};return db[_0xfe72('0x3f')]['count'](_0x1a4d76)[_0xfe72('0x22')](function(_0x31b27a){_0x5c514e[_0xfe72('0x2f')]=_0x31b27a;if(_0xba2056['query'][_0xfe72('0x54')]){_0xbc4a8[_0xfe72('0x55')]=[{'all':!![]}];}return db['ChatWebsite'][_0xfe72('0x56')](_0xbc4a8);})[_0xfe72('0x22')](function(_0x18567d){_0x5c514e[_0xfe72('0x57')]=_0x18567d;return _0x5c514e;})[_0xfe72('0x22')](respondWithFilteredResult(_0x58e241,_0xbc4a8))[_0xfe72('0x2b')](handleError(_0x58e241,null));};exports['show']=function(_0x2e8366,_0x160cc0){var _0x4bb19f={'raw':![],'where':{'id':_0x2e8366[_0xfe72('0x58')]['id']},'include':[{'model':db[_0xfe72('0x59')],'as':_0xfe72('0x5a')}]},_0x534323={};_0x534323['model']=_[_0xfe72('0x45')](db['ChatWebsite'][_0xfe72('0x5b')]);_0x534323[_0xfe72('0x44')]=_['keys'](_0x2e8366['query']);_0x534323[_0xfe72('0x46')]=_[_0xfe72('0x5c')](_0x534323[_0xfe72('0x47')],_0x534323[_0xfe72('0x44')]);_0x4bb19f[_0xfe72('0x48')]=_['intersection'](_0x534323[_0xfe72('0x47')],qs['fields'](_0x2e8366[_0xfe72('0x44')][_0xfe72('0x49')]));_0x4bb19f[_0xfe72('0x48')]=_0x4bb19f[_0xfe72('0x48')]['length']?_0x4bb19f['attributes']:_0x534323[_0xfe72('0x47')];if(_0x2e8366[_0xfe72('0x44')][_0xfe72('0x54')]){_0x4bb19f[_0xfe72('0x55')]=[{'all':!![]}];}_0x4bb19f=_[_0xfe72('0x51')]({},_0x4bb19f,_0x2e8366['options']);return db[_0xfe72('0x3f')][_0xfe72('0x5d')](_0x4bb19f)[_0xfe72('0x22')](handleEntityNotFound(_0x160cc0,null))[_0xfe72('0x22')](respondWithResult(_0x160cc0,null))[_0xfe72('0x2b')](handleError(_0x160cc0,null));};exports[_0xfe72('0x5e')]=function(_0x504323,_0x2aab3f){return db[_0xfe72('0x3f')][_0xfe72('0x5e')](_0x504323['body'],{})[_0xfe72('0x22')](function(_0x447c59){var _0x22c603=_0x504323[_0xfe72('0x5f')][_0xfe72('0x60')]({'plain':!![]});if(!_0x22c603)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22c603[_0xfe72('0x61')]===_0xfe72('0x5f')){var _0x11f757=_0x447c59[_0xfe72('0x60')]({'plain':!![]});var _0x111bf7=_0xfe72('0x38');return db[_0xfe72('0x62')][_0xfe72('0x5d')]({'where':{'name':_0x111bf7,'userProfileId':_0x22c603['userProfileId']},'raw':!![]})[_0xfe72('0x22')](function(_0x5f4c19){if(_0x5f4c19&&_0x5f4c19[_0xfe72('0x63')]===0x0){return db['UserProfileResource'][_0xfe72('0x5e')]({'name':_0x11f757['name'],'resourceId':_0x11f757['id'],'type':_0x5f4c19['name'],'sectionId':_0x5f4c19['id']},{})['then'](function(){return _0x447c59;});}else{return _0x447c59;}})[_0xfe72('0x2b')](function(_0xff5839){logger[_0xfe72('0x26')](_0xfe72('0x64'),_0xff5839);throw _0xff5839;});}return _0x447c59;})[_0xfe72('0x22')](respondWithResult(_0x2aab3f,0xc9))['catch'](handleError(_0x2aab3f,null));};exports[_0xfe72('0x36')]=function(_0x99d811,_0x1fdb9a){if(_0x99d811[_0xfe72('0x65')]['id']){delete _0x99d811[_0xfe72('0x65')]['id'];}return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x99d811[_0xfe72('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xfe72('0x5a')}]})['then'](handleEntityNotFound(_0x1fdb9a,null))['then'](saveUpdates(_0x99d811[_0xfe72('0x65')],null))[_0xfe72('0x22')](respondWithResult(_0x1fdb9a,null))['catch'](handleError(_0x1fdb9a,null));};exports[_0xfe72('0x37')]=function(_0x45d82b,_0x3fbf6a){return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x45d82b[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x3fbf6a,null))['then'](removeEntity(_0x3fbf6a,null))['catch'](handleError(_0x3fbf6a,null));};exports[_0xfe72('0x66')]=function(_0x2feca9,_0x5b27e1){return db[_0xfe72('0x3f')][_0xfe72('0x66')]()[_0xfe72('0x22')](respondWithResult(_0x5b27e1,null))[_0xfe72('0x2b')](handleError(_0x5b27e1,null));};exports[_0xfe72('0x67')]=function(_0x41c4b5,_0x5c70f1,_0x3513a7){if(_0x41c4b5['body']['id']){delete _0x41c4b5['body']['id'];}return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x41c4b5[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x5c70f1,null))[_0xfe72('0x22')](function(_0xab9c47){if(_0xab9c47){_0x41c4b5[_0xfe72('0x65')][_0xfe72('0x68')]=_0xab9c47['id'];return db['Disposition'][_0xfe72('0x5e')](_0x41c4b5[_0xfe72('0x65')]);}})['then'](respondWithResult(_0x5c70f1,null))[_0xfe72('0x2b')](handleError(_0x5c70f1,null));};exports['getDispositions']=function(_0x52935e,_0x429524,_0x459307){var _0x50c3b4={'raw':![],'where':{}};var _0x47d3a5={};var _0x30b2e5={'count':0x0,'rows':[]};return db[_0xfe72('0x3f')][_0xfe72('0x69')]({'where':{'id':_0x52935e[_0xfe72('0x58')]['id']}})['then'](handleEntityNotFound(_0x429524,null))[_0xfe72('0x22')](function(_0x209150){if(_0x209150){_0x47d3a5[_0xfe72('0x47')]=_[_0xfe72('0x45')](db['Disposition'][_0xfe72('0x5b')]);_0x47d3a5['query']=_[_0xfe72('0x45')](_0x52935e[_0xfe72('0x44')]);_0x47d3a5[_0xfe72('0x46')]=_[_0xfe72('0x5c')](_0x47d3a5['model'],_0x47d3a5[_0xfe72('0x44')]);_0x50c3b4[_0xfe72('0x48')]=_[_0xfe72('0x5c')](_0x47d3a5[_0xfe72('0x47')],qs['fields'](_0x52935e[_0xfe72('0x44')][_0xfe72('0x49')]));_0x50c3b4[_0xfe72('0x48')]=_0x50c3b4[_0xfe72('0x48')][_0xfe72('0x6a')]?_0x50c3b4[_0xfe72('0x48')]:_0x47d3a5[_0xfe72('0x47')];if(!_0x52935e[_0xfe72('0x44')]['hasOwnProperty'](_0xfe72('0x4b'))){_0x50c3b4[_0xfe72('0x31')]=qs['limit'](_0x52935e[_0xfe72('0x44')]['limit']);_0x50c3b4[_0xfe72('0x30')]=qs['offset'](_0x52935e[_0xfe72('0x44')][_0xfe72('0x30')]);}_0x50c3b4[_0xfe72('0x4c')]=qs[_0xfe72('0x4d')](_0x52935e[_0xfe72('0x44')]['sort']);_0x50c3b4[_0xfe72('0x50')]=qs[_0xfe72('0x46')](_['pick'](_0x52935e[_0xfe72('0x44')],_0x47d3a5['filters']));_0x50c3b4['where'][_0xfe72('0x68')]=_0x209150['id'];if(_0x52935e['query']['filter']){_0x50c3b4[_0xfe72('0x50')]=_[_0xfe72('0x51')](_0x50c3b4[_0xfe72('0x50')],{'$or':_[_0xfe72('0x43')](_0x50c3b4[_0xfe72('0x48')],function(_0x629eca){var _0x725bd2={};_0x725bd2[_0x629eca]={'$like':'%'+_0x52935e[_0xfe72('0x44')][_0xfe72('0x4f')]+'%'};return _0x725bd2;})});}_0x50c3b4=_[_0xfe72('0x51')]({},_0x50c3b4,_0x52935e[_0xfe72('0x53')]);return db[_0xfe72('0x6b')][_0xfe72('0x2f')]({'where':_0x50c3b4[_0xfe72('0x50')]})[_0xfe72('0x22')](function(_0x56ac2e){_0x30b2e5[_0xfe72('0x2f')]=_0x56ac2e;if(_0x52935e[_0xfe72('0x44')][_0xfe72('0x54')]){_0x50c3b4[_0xfe72('0x55')]=[{'all':!![]}];}return db[_0xfe72('0x6b')]['findAll'](_0x50c3b4);})[_0xfe72('0x22')](function(_0x43e7f0){_0x30b2e5[_0xfe72('0x57')]=_0x43e7f0;return _0x30b2e5;});}})[_0xfe72('0x22')](respondWithFilteredResult(_0x429524,_0x50c3b4))[_0xfe72('0x2b')](handleError(_0x429524,null));};exports[_0xfe72('0x6c')]=function(_0x182592,_0x2b4a57,_0x3f9bac){return db['ChatWebsite'][_0xfe72('0x5d')]({'where':{'id':_0x182592[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x2b4a57,null))[_0xfe72('0x22')](function(_0x434419){if(_0x434419){return _0x434419['removeDispositions'](_0x182592[_0xfe72('0x44')][_0xfe72('0x6d')]);}})[_0xfe72('0x22')](respondWithStatusCode(_0x2b4a57,null))[_0xfe72('0x2b')](handleError(_0x2b4a57,null));};exports[_0xfe72('0x6e')]=function(_0x38ea50,_0x47abd8,_0x422f10){if(_0x38ea50['body']['id']){delete _0x38ea50[_0xfe72('0x65')]['id'];}return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x38ea50['params']['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x47abd8,null))[_0xfe72('0x22')](function(_0x2fd18a){if(_0x2fd18a){_0x38ea50[_0xfe72('0x65')][_0xfe72('0x68')]=_0x2fd18a['id'];return db[_0xfe72('0x6f')][_0xfe72('0x5e')](_0x38ea50[_0xfe72('0x65')]);}})[_0xfe72('0x22')](respondWithResult(_0x47abd8,null))[_0xfe72('0x2b')](handleError(_0x47abd8,null));};exports['getAnswers']=function(_0x5f2721,_0x2934b7,_0x598c3b){var _0x1867c8={'raw':![],'where':{}};var _0x4c99b1={};var _0x1481e9={'count':0x0,'rows':[]};return db[_0xfe72('0x3f')]['findOne']({'where':{'id':_0x5f2721['params']['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x2934b7,null))['then'](function(_0x3ed6a0){if(_0x3ed6a0){_0x4c99b1['model']=_[_0xfe72('0x45')](db['CannedAnswer']['rawAttributes']);_0x4c99b1[_0xfe72('0x44')]=_[_0xfe72('0x45')](_0x5f2721[_0xfe72('0x44')]);_0x4c99b1[_0xfe72('0x46')]=_[_0xfe72('0x5c')](_0x4c99b1[_0xfe72('0x47')],_0x4c99b1['query']);_0x1867c8[_0xfe72('0x48')]=_[_0xfe72('0x5c')](_0x4c99b1['model'],qs['fields'](_0x5f2721[_0xfe72('0x44')][_0xfe72('0x49')]));_0x1867c8[_0xfe72('0x48')]=_0x1867c8['attributes']['length']?_0x1867c8[_0xfe72('0x48')]:_0x4c99b1[_0xfe72('0x47')];if(!_0x5f2721[_0xfe72('0x44')]['hasOwnProperty'](_0xfe72('0x4b'))){_0x1867c8[_0xfe72('0x31')]=qs['limit'](_0x5f2721[_0xfe72('0x44')][_0xfe72('0x31')]);_0x1867c8[_0xfe72('0x30')]=qs[_0xfe72('0x30')](_0x5f2721[_0xfe72('0x44')][_0xfe72('0x30')]);}_0x1867c8[_0xfe72('0x4c')]=qs['sort'](_0x5f2721[_0xfe72('0x44')]['sort']);_0x1867c8[_0xfe72('0x50')]=qs[_0xfe72('0x46')](_[_0xfe72('0x4e')](_0x5f2721[_0xfe72('0x44')],_0x4c99b1[_0xfe72('0x46')]));_0x1867c8[_0xfe72('0x50')][_0xfe72('0x68')]=_0x3ed6a0['id'];if(_0x5f2721[_0xfe72('0x44')][_0xfe72('0x4f')]){_0x1867c8[_0xfe72('0x50')]=_[_0xfe72('0x51')](_0x1867c8[_0xfe72('0x50')],{'$or':_[_0xfe72('0x43')](_0x1867c8[_0xfe72('0x48')],function(_0x57768d){var _0x4cd036={};_0x4cd036[_0x57768d]={'$like':'%'+_0x5f2721[_0xfe72('0x44')][_0xfe72('0x4f')]+'%'};return _0x4cd036;})});}_0x1867c8=_[_0xfe72('0x51')]({},_0x1867c8,_0x5f2721[_0xfe72('0x53')]);return db[_0xfe72('0x6f')]['count']({'where':_0x1867c8['where']})['then'](function(_0x2817f5){_0x1481e9[_0xfe72('0x2f')]=_0x2817f5;if(_0x5f2721['query'][_0xfe72('0x54')]){_0x1867c8[_0xfe72('0x55')]=[{'all':!![]}];}return db[_0xfe72('0x6f')][_0xfe72('0x56')](_0x1867c8);})[_0xfe72('0x22')](function(_0x1e65e0){_0x1481e9['rows']=_0x1e65e0;return _0x1481e9;});}})[_0xfe72('0x22')](respondWithFilteredResult(_0x2934b7,_0x1867c8))[_0xfe72('0x2b')](handleError(_0x2934b7,null));};exports[_0xfe72('0x70')]=function(_0x167ee8,_0x25c9c5,_0x2bb51c){return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x167ee8[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x25c9c5,null))[_0xfe72('0x22')](function(_0x3f4a57){if(_0x3f4a57){return _0x3f4a57['removeAnswers'](_0x167ee8[_0xfe72('0x44')][_0xfe72('0x6d')]);}})['then'](respondWithStatusCode(_0x25c9c5,null))[_0xfe72('0x2b')](handleError(_0x25c9c5,null));};exports[_0xfe72('0x71')]=function(_0x535de1,_0x5a9643,_0x5d17d8){_0x535de1[_0xfe72('0x65')][_0xfe72('0x72')]=_0x535de1['file'][_0xfe72('0x73')];return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x535de1[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x5a9643,null))[_0xfe72('0x22')](saveUpdates(_0x535de1[_0xfe72('0x65')],null))[_0xfe72('0x22')](respondWithResult(_0x5a9643,null))[_0xfe72('0x2b')](handleError(_0x5a9643,null));};exports[_0xfe72('0x74')]=function(_0x4eff8,_0x878b69,_0x12b8cd){_0x4eff8[_0xfe72('0x65')][_0xfe72('0x75')]=_0x4eff8[_0xfe72('0x76')][_0xfe72('0x73')];return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x4eff8[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x878b69,null))['then'](saveUpdates(_0x4eff8['body'],null))[_0xfe72('0x22')](respondWithResult(_0x878b69,null))['catch'](handleError(_0x878b69,null));};exports['addCustomerAvatar']=function(_0x14a37f,_0x26f8d0,_0x7d90de){_0x14a37f[_0xfe72('0x65')][_0xfe72('0x77')]=_0x14a37f[_0xfe72('0x76')][_0xfe72('0x73')];return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x14a37f[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x26f8d0,null))['then'](saveUpdates(_0x14a37f['body'],null))['then'](respondWithResult(_0x26f8d0,null))[_0xfe72('0x2b')](handleError(_0x26f8d0,null));};exports[_0xfe72('0x78')]=function(_0x4cad12,_0x13ac04,_0x474403){_0x4cad12['body'][_0xfe72('0x79')]=_0x4cad12[_0xfe72('0x76')]['filename'];return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x4cad12['params']['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x13ac04,null))[_0xfe72('0x22')](saveUpdates(_0x4cad12[_0xfe72('0x65')],null))['then'](respondWithResult(_0x13ac04,null))[_0xfe72('0x2b')](handleError(_0x13ac04,null));};exports[_0xfe72('0x7a')]=function(_0x3ca504,_0x8c5636,_0x282316){var _0x25fd1c=path[_0xfe72('0x7b')](config['root'],_0xfe72('0x7c'));var _0x1a4270={'where':{'id':_0x3ca504[_0xfe72('0x58')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x121500=![];return require(_0xfe72('0x7d'))[_0xfe72('0x7e')]()['then'](function(_0x32834e){if(_0x32834e){_0x121500=_0x32834e[_0xfe72('0x7f')];}})['then'](function(){return db['ChatWebsite']['find'](_0x1a4270);})[_0xfe72('0x22')](handleEntityNotFound(_0x8c5636,null))[_0xfe72('0x22')](function(_0x34b541){if(_0x34b541){if(!_[_0xfe72('0x80')](_0x34b541[_0xfe72('0x72')])){if(fs[_0xfe72('0x81')](path[_0xfe72('0x7b')](config[_0xfe72('0x82')],_0xfe72('0x83'),_0x34b541[_0xfe72('0x72')]))&&_0x121500){_0x25fd1c=path[_0xfe72('0x7b')](config[_0xfe72('0x82')],_0xfe72('0x83'),_0x34b541['sitepic']);}}return _0x8c5636[_0xfe72('0x84')](_0x25fd1c);}})[_0xfe72('0x2b')](handleError(_0x8c5636,null));};exports[_0xfe72('0x85')]=function(_0x7c64f1,_0x4d8156,_0x44e4fc){var _0x3f1435=path[_0xfe72('0x7b')](config[_0xfe72('0x82')],'server/files/images/avatars/default_avatar.png');var _0x453593={'where':{'id':_0x7c64f1['params']['id']},'attributes':['id',_0xfe72('0x75')],'raw':!![]};return db[_0xfe72('0x3f')][_0xfe72('0x5d')](_0x453593)[_0xfe72('0x22')](handleEntityNotFound(_0x4d8156,null))[_0xfe72('0x22')](function(_0x3552b2){if(_0x3552b2){if(!_['isNil'](_0x3552b2[_0xfe72('0x75')])){if(fs[_0xfe72('0x81')](path[_0xfe72('0x7b')](config['root'],'server/files/images/avatars/',_0x3552b2[_0xfe72('0x75')]))){_0x3f1435=path[_0xfe72('0x7b')](config[_0xfe72('0x82')],'server/files/images/avatars/',_0x3552b2[_0xfe72('0x75')]);}}return _0x4d8156['download'](_0x3f1435);}})[_0xfe72('0x2b')](handleError(_0x4d8156,null));};exports[_0xfe72('0x86')]=function(_0x41ad4f,_0x44016d,_0x4635e5){var _0x5eb55c=path['join'](config[_0xfe72('0x82')],_0xfe72('0x87'));var _0x2b6233={'where':{'id':_0x41ad4f[_0xfe72('0x58')]['id']},'attributes':['id','customerAvatar',_0xfe72('0x88')],'raw':!![]};return db[_0xfe72('0x3f')]['find'](_0x2b6233)['then'](handleEntityNotFound(_0x44016d,null))[_0xfe72('0x22')](function(_0x166b1a){if(_0x166b1a){if(!_[_0xfe72('0x80')](_0x166b1a[_0xfe72('0x77')])){if(fs[_0xfe72('0x81')](path[_0xfe72('0x7b')](config['root'],_0xfe72('0x89'),_0x166b1a[_0xfe72('0x77')]))&&_0x166b1a[_0xfe72('0x88')]){_0x5eb55c=path[_0xfe72('0x7b')](config[_0xfe72('0x82')],_0xfe72('0x89'),_0x166b1a['customerAvatar']);}}return _0x44016d[_0xfe72('0x84')](_0x5eb55c);}})[_0xfe72('0x2b')](handleError(_0x44016d,null));};exports[_0xfe72('0x8a')]=function(_0x41ca42,_0x47a3a7,_0x1235ad){var _0x155c6d=path[_0xfe72('0x7b')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x2296b2={'where':{'id':_0x41ca42[_0xfe72('0x58')]['id']},'attributes':['id',_0xfe72('0x79')],'raw':!![]};return db[_0xfe72('0x3f')][_0xfe72('0x5d')](_0x2296b2)[_0xfe72('0x22')](handleEntityNotFound(_0x47a3a7,null))[_0xfe72('0x22')](function(_0x563738){if(_0x563738){if(!_[_0xfe72('0x80')](_0x563738[_0xfe72('0x79')])){if(fs[_0xfe72('0x81')](path[_0xfe72('0x7b')](config['root'],_0xfe72('0x89'),_0x563738[_0xfe72('0x79')]))){_0x155c6d=path[_0xfe72('0x7b')](config[_0xfe72('0x82')],_0xfe72('0x89'),_0x563738['systemAvatar']);}}return _0x47a3a7[_0xfe72('0x84')](_0x155c6d);}})[_0xfe72('0x2b')](handleError(_0x47a3a7,null));};exports[_0xfe72('0x8b')]=function(_0x1681b5,_0x2fe802,_0x2aa603){var _0x578363=require(_0xfe72('0x8c'));var _0xabaa1d=new _0x578363();var _0x43344f=_0xabaa1d[_0xfe72('0x8d')](_0x1681b5[_0xfe72('0x8e')][_0xfe72('0x8f')])[_0xfe72('0x90')]();var _0x30317f={'body':_0x1681b5['body'],'channel':'chat'};var _0x1ec99b=[];var _0x2e7141=[];var _0x47ec06={};var _0x3bfdd7=![];return db[_0xfe72('0x91')][_0xfe72('0x66')]()['then'](function(_0x2787c0){if(!_0x2787c0){throw new db['Sequelize']['ValidationError'](_0xfe72('0x92'));}_0x1ec99b=_[_0xfe72('0x93')](_['keys'](_0x2787c0),[_0xfe72('0x94'),_0xfe72('0x95')]);_0x2e7141=_[_0xfe72('0x93')](_[_0xfe72('0x45')](_0x2787c0),[_0xfe72('0x94'),_0xfe72('0x95'),_0xfe72('0x96'),_0xfe72('0x97')]);if(_0x1681b5['body']['id']){delete _0x1681b5[_0xfe72('0x65')]['id'];}if(_[_0xfe72('0x80')](_0x1681b5[_0xfe72('0x65')]['from'])){throw new db[(_0xfe72('0x1e'))][(_0xfe72('0x1f'))]('from\x20is\x20mandatory');}if(_[_0xfe72('0x80')](_0x1681b5[_0xfe72('0x65')][_0xfe72('0x65')])||_0x1681b5[_0xfe72('0x65')][_0xfe72('0x65')]===''){throw new db[(_0xfe72('0x1e'))][(_0xfe72('0x1f'))](_0xfe72('0x98'));}if(_[_0xfe72('0x80')](_0x1681b5[_0xfe72('0x65')]['mapKey'])){throw new db['Sequelize'][(_0xfe72('0x1f'))](_0xfe72('0x99')+_0x2e7141);}if(!_[_0xfe72('0x9a')](_0x2e7141,_0x1681b5['body'][_0xfe72('0x9b')])){throw new db[(_0xfe72('0x1e'))][(_0xfe72('0x1f'))](_0xfe72('0x9c')+_0x2e7141);}_0x47ec06[_0x1681b5[_0xfe72('0x65')][_0xfe72('0x9b')]]=_0x1681b5['body'][_0xfe72('0x9d')];})[_0xfe72('0x22')](function(){return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x1681b5['params']['id']},'include':[{'model':db['CmList'],'as':_0xfe72('0x9e'),'include':[{'model':db[_0xfe72('0x91')],'as':_0xfe72('0x9f'),'where':_0x47ec06,'limit':0x1,'order':[[_0xfe72('0x95'),'DESC']]}]},{'model':db[_0xfe72('0xa0')],'as':_0xfe72('0xa1')}]});})['then'](handleEntityNotFound(_0x2fe802,null))[_0xfe72('0x22')](function(_0x52d3a7){if(_0x52d3a7&&_0x52d3a7[_0xfe72('0x9e')]){_0x30317f[_0xfe72('0xa2')]=_0x52d3a7;_0x30317f['applications']=_0x52d3a7[_0xfe72('0xa1')];_0x30317f[_0xfe72('0xa3')]=_0x52d3a7[_0xfe72('0x9e')];_0x30317f[_0xfe72('0xa4')]=_[_0xfe72('0xa5')](_0x30317f[_0xfe72('0xa4')],[_0xfe72('0xa6')],[_0xfe72('0xa7')]);if(_0x30317f['account']['Applications']){delete _0x30317f['account']['Applications'];}if(_0x30317f[_0xfe72('0xa2')][_0xfe72('0x9e')]&&_0x30317f[_0xfe72('0xa2')][_0xfe72('0x9e')][_0xfe72('0x9f')][_0xfe72('0x6a')]){return _0x30317f['account'][_0xfe72('0x9e')]['Contacts'][0x0];}var _0x3f06ce=_[_0xfe72('0x16')](_0x1681b5['body'],{'firstName':_0x1681b5[_0xfe72('0x65')]['from'],'ListId':_0x52d3a7[_0xfe72('0x97')]});_0x3f06ce[_0x1681b5[_0xfe72('0x65')]['mapKey']]=_0x1681b5[_0xfe72('0x65')]['from'];return db['CmContact'][_0xfe72('0x5e')](_0x3f06ce,{'fields':_0x1ec99b,'raw':!![]});}})[_0xfe72('0x22')](handleEntityNotFound(_0x2fe802,null))[_0xfe72('0x22')](function(_0x31ea86){_0x30317f[_0xfe72('0xa8')]=_0x31ea86;var _0x574209=_0x1681b5['body']['customerIp'];if(_0x1681b5[_0xfe72('0x8e')][_0xfe72('0xa9')]){_0x574209=_0x1681b5[_0xfe72('0x8e')][_0xfe72('0xa9')];}else if(_0x1681b5['headers'][_0xfe72('0xaa')]){_0x574209=_[_0xfe72('0xab')](_0x1681b5[_0xfe72('0x8e')][_0xfe72('0xaa')][_0xfe72('0xac')](','));}if(_0x31ea86){var _0x5ae455={'ContactId':_0x31ea86['id'],'ChatWebsiteId':_0x1681b5[_0xfe72('0x58')]['id'],'from':(_0x31ea86['firstName']||'')+'\x20'+(_0x31ea86[_0xfe72('0xad')]||''),'customerIp':_0x574209,'customerPort':_0x1681b5[_0xfe72('0x8e')][_0xfe72('0xae')]?_0x1681b5[_0xfe72('0x8e')][_0xfe72('0xae')]:null,'referer':_0x1681b5['body']['referer'],'browserName':_0x43344f[_0xfe72('0xaf')]['name']&&_0x43344f['browser'][_0xfe72('0xb0')]?util['format'](_0xfe72('0xb1'),_0x43344f[_0xfe72('0xaf')][_0xfe72('0x3c')],_0x43344f[_0xfe72('0xaf')][_0xfe72('0xb0')]):'unknown','browserVersion':_0x43344f[_0xfe72('0xaf')][_0xfe72('0xb0')]||_0xfe72('0xb2'),'osName':util[_0xfe72('0xb3')](_0xfe72('0xb1'),_0x43344f['os']['name'],_0x43344f['os']['version']),'osVersion':_0x43344f['os']['version'],'deviceModel':_0x43344f['device'][_0xfe72('0x47')]&&_0x43344f['device'][_0xfe72('0xb4')]?util[_0xfe72('0xb3')]('%s\x20%s\x20%s',_0x43344f[_0xfe72('0xb5')][_0xfe72('0x47')],_0x43344f['device'][_0xfe72('0xb4')],_0x43344f[_0xfe72('0xb5')][_0xfe72('0x41')]):null,'deviceVendor':_0x43344f[_0xfe72('0xb5')][_0xfe72('0xb4')],'deviceType':_0x43344f[_0xfe72('0xb5')][_0xfe72('0x41')],'formData':JSON[_0xfe72('0xb6')](_0x1681b5[_0xfe72('0x65')])};var _0x36480e={'ChatWebsiteId':_0x1681b5['params']['id'],'closed':![]};if(_0x1681b5[_0xfe72('0x65')][_0xfe72('0xb7')]){_0x36480e[_0xfe72('0xb7')]=_0x1681b5[_0xfe72('0x65')]['threadId'];return db[_0xfe72('0xb8')][_0xfe72('0x5d')]({'where':_0x36480e})[_0xfe72('0x22')](function(_0x31c3e0){if(_0x31c3e0){return[_0x31c3e0,![]];}_0x5ae455[_0xfe72('0xb7')]=_0x1681b5[_0xfe72('0x65')][_0xfe72('0xb7')];_0x5ae455[_0xfe72('0xb9')]=_0x1681b5['body'][_0xfe72('0xb9')];return db[_0xfe72('0xb8')][_0xfe72('0x5e')](_0x5ae455)['then'](function(_0xffd8b6){return[_0xffd8b6,!![]];});});}_0x36480e['ContactId']=_0x31ea86['id'];if(_0x1681b5[_0xfe72('0x65')][_0xfe72('0xba')]&&_0x1681b5[_0xfe72('0x65')][_0xfe72('0xba')]['id']){_0x36480e['id']=_0x1681b5[_0xfe72('0x65')][_0xfe72('0xba')]['id'];return db[_0xfe72('0xb8')]['find']({'where':_0x36480e})[_0xfe72('0x22')](function(_0x5c5e4d){if(_0x5c5e4d){return[_0x5c5e4d,![]];}return db[_0xfe72('0xb8')][_0xfe72('0x5e')](_0x5ae455)[_0xfe72('0x22')](function(_0x5b4120){return[_0x5b4120,!![]];});});}return db[_0xfe72('0xb8')][_0xfe72('0x5e')](_0x5ae455)[_0xfe72('0x22')](function(_0x1b048c){return[_0x1b048c,!![]];});}})['spread'](function(_0x5246e6,_0x3b0897){if(_0x5246e6){_0x3bfdd7=_0x3b0897;if(!_0x3b0897){var _0x55e141={'from':(_0x30317f[_0xfe72('0xa8')][_0xfe72('0xbb')]||'')+'\x20'+(_0x30317f['contact'][_0xfe72('0xad')]||'')};if(_0x1681b5['body'][_0xfe72('0xb7')]&&_0x1681b5[_0xfe72('0x65')][_0xfe72('0xbc')]&&_0x1681b5[_0xfe72('0x65')]['threadId']!=_0x1681b5[_0xfe72('0x65')][_0xfe72('0xbc')]){_0x55e141[_0xfe72('0xb7')]=_0x1681b5[_0xfe72('0x65')]['messageId'];}return _0x5246e6[_0xfe72('0x36')](_0x55e141);}else{return _0x5246e6;}}})[_0xfe72('0x22')](function(_0x4a555d){_0x30317f['interaction']=_0x4a555d[_0xfe72('0x60')]({'plain':!![]});_0x30317f[_0xfe72('0xba')]['created']=_0x3bfdd7;if(_0x30317f[_0xfe72('0xba')]['created']){if(_0x30317f[_0xfe72('0xa2')][_0xfe72('0xbd')]){_0x30317f[_0xfe72('0xa4')][_0xfe72('0xbe')]({'id':0x0,'priority':_0x30317f[_0xfe72('0xa4')][_0xfe72('0x6a')]+0x1,'app':_0xfe72('0xbf'),'appdata':_0xfe72('0xc0'),'interval':'*,*,*,*'});}}return db[_0xfe72('0xc1')][_0xfe72('0x5e')]({'body':_0x1681b5[_0xfe72('0x65')][_0xfe72('0x65')],'ChatWebsiteId':_0x1681b5[_0xfe72('0x58')]['id'],'ChatInteractionId':_0x4a555d['id'],'direction':'in','ContactId':_0x30317f[_0xfe72('0xa8')]['id'],'AttachmentId':_0x1681b5['body'][_0xfe72('0xc2')]});})[_0xfe72('0x22')](function(_0x296efc){_0x30317f[_0xfe72('0x28')]=_0x296efc;if(_0x30317f[_0xfe72('0xba')]['UserId']){return db['User']['find']({'attributes':['id',_0xfe72('0x3c')],'where':{'id':_0x30317f[_0xfe72('0xba')][_0xfe72('0xc3')]}})['then'](function(_0x1f12b9){if(_0x1f12b9){_0x30317f[_0xfe72('0xa4')][_0xfe72('0xc4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1f12b9[_0xfe72('0x3c')]+','+(_0x30317f[_0xfe72('0xa2')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x30317f['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xfe72('0xc5'),_0x30317f);});}return respondWithRpcPromise('Start','startRouting',_0x30317f);})[_0xfe72('0x22')](function(_0x2ce346){respondWithRpcPromise('EventManager',_0xfe72('0xc6'),{'event':_0xfe72('0x8b'),'message':_0x2ce346},client9002);return _0x2ce346;})[_0xfe72('0x22')](respondWithResult(_0x2fe802,null))[_0xfe72('0x2b')](handleError(_0x2fe802,null));};exports['offline']=function(_0x29352f,_0x3c10f4,_0x130895){var _0x28166a,_0x277e3e,_0x347918;var _0x318e96=[];var _0x43aeca=[];var _0x189253={};return db['CmContact'][_0xfe72('0x66')]()[_0xfe72('0x22')](function(_0x7e6122){if(!_0x7e6122){throw new db[(_0xfe72('0x1e'))][(_0xfe72('0x1f'))](_0xfe72('0x92'));}_0x43aeca=_[_0xfe72('0x93')](_[_0xfe72('0x45')](_0x7e6122),[_0xfe72('0x94'),_0xfe72('0x95')]);_0x318e96=_[_0xfe72('0x93')](_[_0xfe72('0x45')](_0x7e6122),[_0xfe72('0x94'),_0xfe72('0x95'),_0xfe72('0x96'),'ListId']);if(_0x29352f[_0xfe72('0x65')]['id']){delete _0x29352f[_0xfe72('0x65')]['id'];}if(_[_0xfe72('0x80')](_0x29352f[_0xfe72('0x65')][_0xfe72('0x9d')])){throw _0x3c10f4['status'](0x1f4)[_0xfe72('0x3d')](new db[(_0xfe72('0x1e'))][(_0xfe72('0x1f'))](_0xfe72('0xc7')));}if(_[_0xfe72('0x80')](_0x29352f['body'][_0xfe72('0x65')])||_0x29352f[_0xfe72('0x65')][_0xfe72('0x65')]===''){throw _0x3c10f4[_0xfe72('0x2d')](0x1f4)['send'](new db[(_0xfe72('0x1e'))]['ValidationError'](_0xfe72('0x98')));}if(_[_0xfe72('0x80')](_0x29352f[_0xfe72('0x65')][_0xfe72('0xc8')])){throw _0x3c10f4[_0xfe72('0x2d')](0x1f4)[_0xfe72('0x3d')](new db['Sequelize'][(_0xfe72('0x1f'))](_0xfe72('0xc9')+_0x318e96));}if(!_['includes'](_0x318e96,_0x29352f[_0xfe72('0x65')][_0xfe72('0xc8')])){throw _0x3c10f4[_0xfe72('0x2d')](0x1f4)[_0xfe72('0x3d')](new db[(_0xfe72('0x1e'))][(_0xfe72('0x1f'))](_0xfe72('0xca')+_0x318e96));}_0x189253[_0x29352f[_0xfe72('0x65')]['mapKeyOffline']]=_0x29352f[_0xfe72('0x65')][_0xfe72('0x9d')];})['then'](function(){return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x29352f[_0xfe72('0x58')]['id']},'include':[{'model':db[_0xfe72('0xcb')],'as':_0xfe72('0x9e')}]});})[_0xfe72('0x22')](handleEntityNotFound(_0x3c10f4,null))[_0xfe72('0x22')](function(_0x12dc57){if(_0x12dc57&&_0x12dc57[_0xfe72('0x9e')]){_0x277e3e=_0x12dc57;var _0x2d1b30=_[_0xfe72('0x16')](_0x29352f[_0xfe72('0x65')],{'firstName':_0x29352f[_0xfe72('0x65')][_0xfe72('0x9d')],'phone':_0x29352f['body'][_0xfe72('0x9d')],'ListId':_0x12dc57[_0xfe72('0x97')]});_0x2d1b30[_0x29352f['body']['mapKeyOffline']]=_0x29352f['body'][_0xfe72('0x9d')];return db[_0xfe72('0x91')][_0xfe72('0xcc')]({'where':_0x189253,'defaults':_0x2d1b30});}})[_0xfe72('0xcd')](function(_0x51cbc0){if(_0x51cbc0){_0x347918=_0x51cbc0;var _0x1f4053=fs['readFileSync'](path[_0xfe72('0x7b')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0xfe72('0xce'));var _0x5be0a4=ejs[_0xfe72('0xcf')](_0x1f4053,{'body':_[_0xfe72('0xd0')](_0x29352f['body']['body']),'bodyTitle':_0x277e3e[_0xfe72('0xd1')]});return db[_0xfe72('0xd2')][_0xfe72('0x5e')]({'body':_0x5be0a4,'ContactId':_0x51cbc0['id'],'ChatWebsiteId':_0x277e3e['id']});}})[_0xfe72('0x22')](function(_0x2b7cf4){if(_0x2b7cf4){_0x28166a=_0x2b7cf4;return db[_0xfe72('0xd3')][_0xfe72('0x69')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xfe72('0xd4'),'raw':!![]}]});}})['then'](function(_0x50eaf1){if(_0x50eaf1&&_0x50eaf1[_0xfe72('0xd4')]&&_0x277e3e[_0xfe72('0xd5')]){var _0x35f4cc={'tls':{'rejectUnauthorized':![]}};if(_0x50eaf1['Smtp'][_0xfe72('0xd6')]){_0x35f4cc[_0xfe72('0xd6')]=_0x50eaf1['Smtp'][_0xfe72('0xd6')];}else{_0x35f4cc['host']=_0x50eaf1[_0xfe72('0xd4')]['host'];_0x35f4cc[_0xfe72('0xd7')]=_0x50eaf1[_0xfe72('0xd4')][_0xfe72('0xd7')];_0x35f4cc[_0xfe72('0xd8')]=_0x50eaf1['Smtp']['secure'];}if(_0x50eaf1[_0xfe72('0xd4')][_0xfe72('0xd9')]){_0x35f4cc[_0xfe72('0xda')]={'user':_0x50eaf1[_0xfe72('0xd4')]['user'],'pass':_0x50eaf1['Smtp'][_0xfe72('0xdb')]};}return respondWithRpcPromise(_0xfe72('0xdc'),'sendMail',{'account':_0x35f4cc,'message':{'from':util[_0xfe72('0xb3')](_0xfe72('0xdd'),_0x50eaf1[_0xfe72('0x3c')],_0x50eaf1[_0xfe72('0xde')]||_0x50eaf1['Smtp'][_0xfe72('0x5f')]),'to':_0x277e3e['forwardOfflineAddress'],'subject':_0x277e3e[_0xfe72('0xdf')],'text':_0x28166a[_0xfe72('0x65')]}},client9003)['then'](function(){return _0x28166a;})[_0xfe72('0x2b')](function(_0x51175f){console[_0xfe72('0x26')](_0x51175f);});}})[_0xfe72('0x22')](function(){if(_0x28166a){return _0x28166a;}})['then'](respondWithResult(_0x3c10f4,null))[_0xfe72('0x2b')](handleError(_0x3c10f4,null));};exports[_0xfe72('0xe0')]=function(_0x3f8e2c,_0x4c3cb3,_0x422ac9){return db[_0xfe72('0xb8')][_0xfe72('0x5d')]({'where':{'id':_0x3f8e2c['params']['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x4c3cb3,null))[_0xfe72('0x22')](function(_0x540cea){if(_0x540cea){return _0x540cea[_0xfe72('0xe0')](_0x3f8e2c['body'][_0xfe72('0x6d')],_[_0xfe72('0xe1')](_0x3f8e2c['body'],['ids','id'])||{});}})[_0xfe72('0x22')](respondWithResult(_0x4c3cb3,null))['catch'](handleError(_0x4c3cb3,null));};exports[_0xfe72('0xe2')]=function(_0x206baa,_0x419695,_0x33d58a){var _0x43c2ce={'raw':![],'where':{}};var _0x3e1f8d={};var _0x59a618={'count':0x0,'rows':[]};return db[_0xfe72('0x3f')][_0xfe72('0x69')]({'where':{'id':_0x206baa[_0xfe72('0x58')]['id']}})['then'](handleEntityNotFound(_0x419695,null))[_0xfe72('0x22')](function(_0x1df3c2){if(_0x1df3c2){_0x3e1f8d[_0xfe72('0x47')]=_['keys'](db[_0xfe72('0xb8')][_0xfe72('0x5b')]);_0x3e1f8d[_0xfe72('0x44')]=_[_0xfe72('0x45')](_0x206baa[_0xfe72('0x44')]);_0x3e1f8d[_0xfe72('0x46')]=_[_0xfe72('0x5c')](_0x3e1f8d[_0xfe72('0x47')],_0x3e1f8d[_0xfe72('0x44')]);_0x43c2ce[_0xfe72('0x48')]=_[_0xfe72('0x5c')](_0x3e1f8d['model'],qs[_0xfe72('0x49')](_0x206baa[_0xfe72('0x44')][_0xfe72('0x49')]));_0x43c2ce[_0xfe72('0x48')]=_0x43c2ce[_0xfe72('0x48')][_0xfe72('0x6a')]?_0x43c2ce[_0xfe72('0x48')]:_0x3e1f8d[_0xfe72('0x47')];if(!_0x206baa['query']['hasOwnProperty'](_0xfe72('0x4b'))){_0x43c2ce[_0xfe72('0x31')]=qs['limit'](_0x206baa[_0xfe72('0x44')][_0xfe72('0x31')]);_0x43c2ce[_0xfe72('0x30')]=qs[_0xfe72('0x30')](_0x206baa[_0xfe72('0x44')][_0xfe72('0x30')]);}_0x43c2ce[_0xfe72('0x4c')]=qs['sort'](_0x206baa[_0xfe72('0x44')]['sort']);_0x43c2ce[_0xfe72('0x50')]=qs[_0xfe72('0x46')](_[_0xfe72('0x4e')](_0x206baa['query'],_0x3e1f8d[_0xfe72('0x46')]));_0x43c2ce[_0xfe72('0x50')][_0xfe72('0x68')]=_0x1df3c2['id'];if(_0x206baa[_0xfe72('0x44')][_0xfe72('0x4f')]){_0x43c2ce[_0xfe72('0x50')]=_[_0xfe72('0x51')](_0x43c2ce[_0xfe72('0x50')],{'$or':_['map'](_0x43c2ce[_0xfe72('0x48')],function(_0x1fdc8e){var _0x27a803={};_0x27a803[_0x1fdc8e]={'$like':'%'+_0x206baa[_0xfe72('0x44')][_0xfe72('0x4f')]+'%'};return _0x27a803;})});}_0x43c2ce=_['merge']({},_0x43c2ce,_0x206baa['options']);return db[_0xfe72('0xb8')][_0xfe72('0x2f')]({'where':_0x43c2ce['where']})[_0xfe72('0x22')](function(_0x175812){_0x59a618[_0xfe72('0x2f')]=_0x175812;if(_0x206baa[_0xfe72('0x44')][_0xfe72('0x54')]){_0x43c2ce[_0xfe72('0x55')]=[{'model':db[_0xfe72('0x91')],'as':_0xfe72('0xe3'),'required':![]},{'model':db[_0xfe72('0xe4')],'as':_0xfe72('0xe5'),'attributes':[_0xfe72('0x3c'),'fullname',_0xfe72('0xe6')],'required':![]},{'model':db[_0xfe72('0xe7')],'as':_0xfe72('0xe8'),'attributes':['id',_0xfe72('0x3c'),'color'],'where':_0x206baa['query'][_0xfe72('0xe9')]?{'id':_0x206baa['query'][_0xfe72('0xe9')]}:undefined,'required':_0x206baa['query'][_0xfe72('0xe9')]?!![]:![]}];}return db['ChatInteraction'][_0xfe72('0x56')](_0x43c2ce);})[_0xfe72('0x22')](function(_0x5e284b){_0x59a618[_0xfe72('0x57')]=_0x5e284b;return _0x59a618;});}})['then'](respondWithFilteredResult(_0x419695,_0x43c2ce))[_0xfe72('0x2b')](handleError(_0x419695,null));};function iftimePromise(_0x534e7d,_0x19363b){return respondWithRpcPromise(_0xfe72('0xea'),'getSnippet',{'command':_0x19363b['timezone']?util[_0xfe72('0xb3')](_0xfe72('0xeb'),_0x534e7d['interval'],_0x19363b[_0xfe72('0xec')]):util[_0xfe72('0xb3')](_0xfe72('0xed'),_0x534e7d['interval'])},client9002)[_0xfe72('0x22')](function(_0x8da166){var _0x53d291=_0x8da166&&_0x8da166[_0xfe72('0xee')]('true')>=0x0?!![]:![];logger['info'](_0xfe72('0xef'),_0x19363b['id'],_0x534e7d['id'],_0x534e7d[_0xfe72('0xf0')],_0x53d291?'ONLINE':_0xfe72('0xf1'),_0x19363b['timezone']?_0x19363b[_0xfe72('0xec')]:_0xfe72('0xf2'));return _0x53d291;})[_0xfe72('0x2b')](function(_0xdcad8e){logger[_0xfe72('0x26')](_0xfe72('0xef'),_0x19363b['id'],_0x534e7d['id'],_0x534e7d['interval'],util[_0xfe72('0xf3')](_0xdcad8e,{'showHidden':![],'depth':null}),_0x19363b['timezone']?_0x19363b[_0xfe72('0xec')]:_0xfe72('0xf2'));return![];});}exports[_0xfe72('0xf4')]=function(_0x10d3b4,_0x2803f3,_0x513b56){var _0x4a3c69=0x0;var _0x5aba7e=0x0;var _0x1055c4=![];var _0x437c1c;var _0x1bf572;return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x10d3b4[_0xfe72('0x58')]['id']},'include':[{'model':db[_0xfe72('0xf5')],'as':_0xfe72('0xf5'),'include':[{'model':db[_0xfe72('0xf5')],'as':'Intervals','attributes':['id',_0xfe72('0xf0')],'raw':!![]}]}]})[_0xfe72('0x22')](handleEntityNotFound(_0x2803f3,null))['then'](function(_0x18b33e){if(_0x18b33e){_0x437c1c=_0x18b33e;return _0x18b33e[_0xfe72('0xf6')]({'raw':!![]});}})['then'](function(_0x41cb49){if(_0x437c1c){if(_0x41cb49){_0x1bf572=_0x41cb49;}}return require('../../config/license/util')[_0xfe72('0x7e')]();})[_0xfe72('0x22')](function(_0x3c50f2){if(_0x3c50f2){_0x5aba7e=_0x3c50f2[_0xfe72('0xf7')];_0x1055c4=_0x3c50f2[_0xfe72('0x7f')];}})[_0xfe72('0x22')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xfe72('0x22')](function(_0x5e6cb2){_0x4a3c69=_0x5e6cb2;if(_0x5aba7e&&_0x5e6cb2>_0x5aba7e){return db[_0xfe72('0xf8')][_0xfe72('0x69')]({'where':{'id':0x1}})[_0xfe72('0x22')](function(_0x3d02a6){if(_0x3d02a6){_0x3d02a6[_0xfe72('0xf9')](_0xfe72('0xfa'));}});}})['then'](function(){if(_0x437c1c['Interval']&&_0x437c1c[_0xfe72('0xf5')][_0xfe72('0xfb')]){var _0x59dc35=[];for(var _0x4df302=0x0;_0x4df302<_0x437c1c[_0xfe72('0xf5')][_0xfe72('0xfb')][_0xfe72('0x6a')];_0x4df302++){var _0x2d2b4d=_0x437c1c[_0xfe72('0xf5')][_0xfe72('0xfb')][_0x4df302][_0xfe72('0x60')]({'plain':!![]});_0x59dc35[_0xfe72('0xbe')](iftimePromise(_0x2d2b4d,_0x437c1c));}return BPromise[_0xfe72('0xfc')](_0x59dc35)[_0xfe72('0x22')](function(_0x4b5a4a){return _[_0xfe72('0xfd')](_0x4b5a4a);});}else{return!![];}})['then'](function(_0x570fef){var _0x1fc681=fs[_0xfe72('0xfe')](path[_0xfe72('0x7b')](config['root'],_0xfe72('0xff')),_0xfe72('0xce'));var _0x36915d={'remote':_0x437c1c[_0xfe72('0x100')],'query':querystring[_0xfe72('0xb6')](_[_0xfe72('0x51')](_0x437c1c[_0xfe72('0x60')]({'plain':!![]}),{'customerIp':_0x10d3b4[_0xfe72('0x8e')][_0xfe72('0xaa')]||_0x10d3b4['headers']['x-real-ip']||_0x10d3b4[_0xfe72('0x101')]['remoteAddress']||_0x10d3b4['ip'],'referer':_0x10d3b4[_0xfe72('0x8e')][_0xfe72('0x102')],'openedInteractions':_0x4a3c69,'maxInteractions':_0x5aba7e,'virtual':_0x1055c4[_0xfe72('0xf7')],'online':_0x570fef,'custom':_0x1055c4}))[_0xfe72('0x103')](/'/g,'\x5c\x27')};_0x2803f3[_0xfe72('0x3d')](ejs[_0xfe72('0xcf')](Mustache[_0xfe72('0xcf')](_0x1fc681,_0x36915d),{'proactiveActions':_0x1bf572,'alignment':_0x437c1c[_0xfe72('0x104')],'verticalAlignment':_0x437c1c[_0xfe72('0x105')],'div_color':_0x437c1c[_0xfe72('0x106')],'text_color':_0x437c1c[_0xfe72('0x107')]}));})[_0xfe72('0x2b')](handleError(_0x2803f3,null));};exports[_0xfe72('0x108')]=function(_0x2a5e9d,_0x40997f,_0x264b17){return db[_0xfe72('0x3f')]['findOne']({'where':{'id':_0x2a5e9d['params']['id']}})['then'](handleEntityNotFound(_0x40997f,null))['then'](function(_0xa75eb8){if(_0xa75eb8){return db[_0xfe72('0x109')]['transaction'](function(_0x53facb){return db['ChatApplication'][_0xfe72('0x37')]({'where':{'ChatWebsiteId':_0x2a5e9d['params']['id']},'transaction':_0x53facb})[_0xfe72('0x22')](function(_0xa6e6c){var _0x205406=_[_0xfe72('0x43')](_0x2a5e9d[_0xfe72('0x65')],function(_0x479335){_0x479335[_0xfe72('0x68')]=_0x2a5e9d[_0xfe72('0x58')]['id'];return _0x479335;});return db[_0xfe72('0xa0')]['bulkCreate'](_0x205406,{'transaction':_0x53facb});});})[_0xfe72('0x22')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x2a5e9d['params']['id']},'order':_0xfe72('0xa6')});});}})[_0xfe72('0x22')](respondWithResult(_0x40997f,null))['catch'](handleError(_0x40997f,null));};exports[_0xfe72('0x10a')]=function(_0x3dbba6,_0x5b462f,_0x477ba1){var _0x21a134={};var _0x2ff78b={};var _0x405d2b;var _0x4fe95b;return db[_0xfe72('0x3f')][_0xfe72('0x69')]({'where':{'id':_0x3dbba6['params']['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x5b462f,null))['then'](function(_0x18d3e4){if(_0x18d3e4){_0x405d2b=_0x18d3e4;_0x2ff78b['model']=_[_0xfe72('0x45')](db['ChatApplication'][_0xfe72('0x5b')]);_0x2ff78b[_0xfe72('0x44')]=_[_0xfe72('0x45')](_0x3dbba6['query']);_0x2ff78b[_0xfe72('0x46')]=_['intersection'](_0x2ff78b[_0xfe72('0x47')],_0x2ff78b[_0xfe72('0x44')]);_0x21a134['attributes']=_['intersection'](_0x2ff78b[_0xfe72('0x47')],qs[_0xfe72('0x49')](_0x3dbba6[_0xfe72('0x44')]['fields']));_0x21a134['attributes']=_0x21a134['attributes'][_0xfe72('0x6a')]?_0x21a134['attributes']:_0x2ff78b['model'];_0x21a134[_0xfe72('0x4c')]=qs[_0xfe72('0x4d')](_0x3dbba6[_0xfe72('0x44')][_0xfe72('0x4d')]);_0x21a134['where']=qs[_0xfe72('0x46')](_[_0xfe72('0x4e')](_0x3dbba6[_0xfe72('0x44')],_0x2ff78b[_0xfe72('0x46')]));if(_0x3dbba6[_0xfe72('0x44')][_0xfe72('0x4f')]){_0x21a134[_0xfe72('0x50')]=_['merge'](_0x21a134[_0xfe72('0x50')],{'$or':_[_0xfe72('0x43')](_0x21a134[_0xfe72('0x48')],function(_0x54001e){var _0x283fd4={};_0x283fd4[_0x54001e]={'$like':'%'+_0x3dbba6[_0xfe72('0x44')][_0xfe72('0x4f')]+'%'};return _0x283fd4;})});}_0x21a134=_[_0xfe72('0x51')]({},_0x21a134,_0x3dbba6[_0xfe72('0x53')]);return _0x405d2b[_0xfe72('0x10a')](_0x21a134);}})[_0xfe72('0x22')](function(_0x5daad9){if(_0x5daad9){_0x4fe95b=_0x5daad9[_0xfe72('0x6a')];if(!_0x3dbba6['query']['hasOwnProperty'](_0xfe72('0x4b'))){_0x21a134['limit']=qs[_0xfe72('0x31')](_0x3dbba6['query'][_0xfe72('0x31')]);_0x21a134[_0xfe72('0x30')]=qs['offset'](_0x3dbba6[_0xfe72('0x44')][_0xfe72('0x30')]);}return _0x405d2b['getApplications'](_0x21a134);}})[_0xfe72('0x22')](function(_0x400b9b){if(_0x400b9b){return _0x400b9b?{'count':_0x4fe95b,'rows':_0x400b9b}:null;}})[_0xfe72('0x22')](respondWithResult(_0x5b462f,null))['catch'](handleError(_0x5b462f,null));};exports[_0xfe72('0x10b')]=function(_0x32d550,_0x55d2ad,_0x239455){return db[_0xfe72('0x10c')][_0xfe72('0x5d')]({'where':{'id':_0x32d550[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x55d2ad,null))['then'](function(_0x28ec02){if(_0x28ec02){return _0x28ec02[_0xfe72('0x10b')](_0x32d550[_0xfe72('0x65')][_0xfe72('0x6d')],_[_0xfe72('0xe1')](_0x32d550[_0xfe72('0x65')],[_0xfe72('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x55d2ad,null))['catch'](handleError(_0x55d2ad,null));};exports[_0xfe72('0xf6')]=function(_0x109c22,_0x270f80,_0x670c6d){var _0x1e119e={};var _0x5af163={};var _0x371e12;var _0x513e6a;return db[_0xfe72('0x3f')][_0xfe72('0x69')]({'where':{'id':_0x109c22[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x270f80,null))['then'](function(_0x33afd9){if(_0x33afd9){_0x371e12=_0x33afd9;_0x5af163[_0xfe72('0x47')]=_[_0xfe72('0x45')](db[_0xfe72('0x10d')][_0xfe72('0x5b')]);_0x5af163['query']=_[_0xfe72('0x45')](_0x109c22[_0xfe72('0x44')]);_0x5af163[_0xfe72('0x46')]=_['intersection'](_0x5af163[_0xfe72('0x47')],_0x5af163['query']);_0x1e119e['attributes']=_[_0xfe72('0x5c')](_0x5af163[_0xfe72('0x47')],qs[_0xfe72('0x49')](_0x109c22[_0xfe72('0x44')][_0xfe72('0x49')]));_0x1e119e[_0xfe72('0x48')]=_0x1e119e[_0xfe72('0x48')][_0xfe72('0x6a')]?_0x1e119e['attributes']:_0x5af163[_0xfe72('0x47')];_0x1e119e[_0xfe72('0x4c')]=qs[_0xfe72('0x4d')](_0x109c22[_0xfe72('0x44')]['sort']);_0x1e119e[_0xfe72('0x50')]=qs[_0xfe72('0x46')](_[_0xfe72('0x4e')](_0x109c22[_0xfe72('0x44')],_0x5af163[_0xfe72('0x46')]));if(_0x109c22[_0xfe72('0x44')][_0xfe72('0x4f')]){_0x1e119e[_0xfe72('0x50')]=_[_0xfe72('0x51')](_0x1e119e[_0xfe72('0x50')],{'$or':_[_0xfe72('0x43')](_0x1e119e['attributes'],function(_0x411195){var _0x3cac05={};_0x3cac05[_0x411195]={'$like':'%'+_0x109c22[_0xfe72('0x44')][_0xfe72('0x4f')]+'%'};return _0x3cac05;})});}_0x1e119e=_[_0xfe72('0x51')]({},_0x1e119e,_0x109c22['options']);return _0x371e12[_0xfe72('0xf6')](_0x1e119e);}})[_0xfe72('0x22')](function(_0x38c09b){if(_0x38c09b){_0x513e6a=_0x38c09b[_0xfe72('0x6a')];if(!_0x109c22['query']['hasOwnProperty'](_0xfe72('0x4b'))){_0x1e119e[_0xfe72('0x31')]=qs['limit'](_0x109c22['query'][_0xfe72('0x31')]);_0x1e119e[_0xfe72('0x30')]=qs[_0xfe72('0x30')](_0x109c22[_0xfe72('0x44')]['offset']);}return _0x371e12[_0xfe72('0xf6')](_0x1e119e);}})[_0xfe72('0x22')](function(_0x8439e){if(_0x8439e){return _0x8439e?{'count':_0x513e6a,'rows':_0x8439e}:null;}})[_0xfe72('0x22')](respondWithResult(_0x270f80,null))['catch'](handleError(_0x270f80,null));};exports['getFields']=function(_0x4f9d4e,_0x36f26c,_0x424b47){var _0x4d5166=_0x4f9d4e[_0xfe72('0x44')][_0xfe72('0x10e')]===_0xfe72('0x10f')?_0xfe72('0x110'):'onlineForm';return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'attributes':['id',_0x4d5166],'where':{'id':_0x4f9d4e[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x36f26c,null))['then'](function(_0x464623){if(_0x464623){var _0xf268c9=_0x464623[_0x4d5166];var _0x3b60a7=_0xf268c9&&_0xf268c9[_0xfe72('0x111')]?_0xf268c9['items']:[];_0x36f26c[_0xfe72('0x3d')]({'fromKey':_[_0xfe72('0x80')](_0xf268c9[_0xfe72('0x112')])?undefined:_0xf268c9[_0xfe72('0x112')],'count':_0x3b60a7[_0xfe72('0x6a')],'rows':_0x3b60a7});}})[_0xfe72('0x2b')](handleError(_0x36f26c,null));};exports[_0xfe72('0x113')]=function(_0x1fa975,_0x54c6f7,_0x2cf070){var _0x7e32d8={'raw':![],'where':{}};var _0x87f484={};var _0x3dc1d0={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfe72('0x69')]({'where':{'id':_0x1fa975[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x54c6f7,null))[_0xfe72('0x22')](function(_0x7a26dc){if(_0x7a26dc){_0x87f484[_0xfe72('0x47')]=_[_0xfe72('0x45')](db['ChatOfflineMessage'][_0xfe72('0x5b')]);_0x87f484[_0xfe72('0x44')]=_[_0xfe72('0x45')](_0x1fa975[_0xfe72('0x44')]);_0x87f484[_0xfe72('0x46')]=_[_0xfe72('0x5c')](_0x87f484[_0xfe72('0x47')],_0x87f484['query']);_0x7e32d8[_0xfe72('0x48')]=_[_0xfe72('0x5c')](_0x87f484[_0xfe72('0x47')],qs[_0xfe72('0x49')](_0x1fa975[_0xfe72('0x44')][_0xfe72('0x49')]));_0x7e32d8[_0xfe72('0x48')]=_0x7e32d8[_0xfe72('0x48')][_0xfe72('0x6a')]?_0x7e32d8[_0xfe72('0x48')]:_0x87f484[_0xfe72('0x47')];if(!_0x1fa975[_0xfe72('0x44')][_0xfe72('0x4a')]('nolimit')){_0x7e32d8[_0xfe72('0x31')]=qs[_0xfe72('0x31')](_0x1fa975['query'][_0xfe72('0x31')]);_0x7e32d8['offset']=qs['offset'](_0x1fa975[_0xfe72('0x44')][_0xfe72('0x30')]);}_0x7e32d8[_0xfe72('0x4c')]=qs[_0xfe72('0x4d')](_0x1fa975[_0xfe72('0x44')][_0xfe72('0x4d')]);_0x7e32d8[_0xfe72('0x50')]=qs['filters'](_[_0xfe72('0x4e')](_0x1fa975[_0xfe72('0x44')],_0x87f484[_0xfe72('0x46')]));_0x7e32d8[_0xfe72('0x50')]['ChatWebsiteId']=_0x7a26dc['id'];if(_0x1fa975['query']['filter']){_0x7e32d8[_0xfe72('0x50')]=_[_0xfe72('0x51')](_0x7e32d8['where'],{'$or':_[_0xfe72('0x43')](_0x7e32d8[_0xfe72('0x48')],function(_0x58f49a){var _0x337cd0={};_0x337cd0[_0x58f49a]={'$like':'%'+_0x1fa975['query'][_0xfe72('0x4f')]+'%'};return _0x337cd0;})});}_0x7e32d8=_[_0xfe72('0x51')]({},_0x7e32d8,_0x1fa975[_0xfe72('0x53')]);return db[_0xfe72('0xd2')][_0xfe72('0x2f')]({'where':_0x7e32d8[_0xfe72('0x50')]})[_0xfe72('0x22')](function(_0x3179ed){_0x3dc1d0['count']=_0x3179ed;if(_0x1fa975[_0xfe72('0x44')]['includeAll']){_0x7e32d8[_0xfe72('0x55')]=[{'all':!![]}];}else{_0x7e32d8[_0xfe72('0x55')]=[{'model':db['CmContact'],'as':_0xfe72('0xe3'),'required':![]}];}return db[_0xfe72('0xd2')][_0xfe72('0x56')](_0x7e32d8);})[_0xfe72('0x22')](function(_0x19bfda){_0x3dc1d0[_0xfe72('0x57')]=_0x19bfda;return _0x3dc1d0;});}})[_0xfe72('0x22')](respondWithFilteredResult(_0x54c6f7,_0x7e32d8))['catch'](handleError(_0x54c6f7,null));};exports['addAgents']=function(_0x16c555,_0x4f4108,_0x1682f3){return db[_0xfe72('0x3f')]['find']({'where':{'id':_0x16c555[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x4f4108,null))[_0xfe72('0x22')](function(_0x3f80e5){if(_0x3f80e5){return _0x3f80e5[_0xfe72('0x114')](_0x16c555[_0xfe72('0x65')][_0xfe72('0x6d')],_[_0xfe72('0xe1')](_0x16c555[_0xfe72('0x65')],['ids','id'])||{})[_0xfe72('0xcd')](function(_0x5647cd){for(var _0x2fc2fe=0x0;_0x2fc2fe<_0x16c555['body']['ids'][_0xfe72('0x6a')];_0x2fc2fe+=0x1){socket[_0xfe72('0x115')](_0xfe72('0x116'),{'UserId':_0x16c555['body'][_0xfe72('0x6d')][_0x2fc2fe],'ChatWebsiteId':_0x16c555[_0xfe72('0x58')]['id']});}return _0x5647cd;});}})[_0xfe72('0x22')](respondWithResult(_0x4f4108,null))[_0xfe72('0x2b')](handleError(_0x4f4108,null));};exports[_0xfe72('0x117')]=function(_0x2e298e,_0x1bd630,_0x498ab5){return db[_0xfe72('0x3f')][_0xfe72('0x5d')]({'where':{'id':_0x2e298e['params']['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x1bd630,null))['then'](function(_0x53fb50){if(_0x53fb50){return _0x53fb50[_0xfe72('0x117')](_0x2e298e[_0xfe72('0x44')][_0xfe72('0x6d')])[_0xfe72('0x22')](function(){if(_[_0xfe72('0x118')](_0x2e298e[_0xfe72('0x44')]['ids'])){for(var _0x54a981=0x0;_0x54a981<_0x2e298e[_0xfe72('0x44')][_0xfe72('0x6d')][_0xfe72('0x6a')];_0x54a981+=0x1){socket[_0xfe72('0x115')]('userChatWebsite:remove',{'UserId':Number(_0x2e298e[_0xfe72('0x44')][_0xfe72('0x6d')][_0x54a981]),'ChatWebsiteId':Number(_0x2e298e[_0xfe72('0x58')]['id'])});}}else{socket['emit'](_0xfe72('0x119'),{'UserId':Number(_0x2e298e[_0xfe72('0x44')][_0xfe72('0x6d')]),'ChatWebsiteId':Number(_0x2e298e[_0xfe72('0x58')]['id'])});}});}})[_0xfe72('0x22')](respondWithStatusCode(_0x1bd630,null))[_0xfe72('0x2b')](handleError(_0x1bd630,null));};exports['getAgents']=function(_0x49c1c4,_0x54b32e,_0x2f53d2){var _0xc48b2a={};var _0xfb111e={};var _0x817968;var _0x2a17e2;return db['ChatWebsite'][_0xfe72('0x69')]({'where':{'id':_0x49c1c4[_0xfe72('0x58')]['id']}})[_0xfe72('0x22')](handleEntityNotFound(_0x54b32e,null))[_0xfe72('0x22')](function(_0x2c8bfd){if(_0x2c8bfd){_0x817968=_0x2c8bfd;_0xfb111e['model']=_[_0xfe72('0x45')](db['User'][_0xfe72('0x5b')]);_0xfb111e[_0xfe72('0x44')]=_[_0xfe72('0x45')](_0x49c1c4[_0xfe72('0x44')]);_0xfb111e[_0xfe72('0x46')]=_[_0xfe72('0x5c')](_0xfb111e[_0xfe72('0x47')],_0xfb111e[_0xfe72('0x44')]);_0xc48b2a[_0xfe72('0x48')]=_['intersection'](_0xfb111e[_0xfe72('0x47')],qs[_0xfe72('0x49')](_0x49c1c4[_0xfe72('0x44')][_0xfe72('0x49')]));_0xc48b2a[_0xfe72('0x48')]=_0xc48b2a['attributes'][_0xfe72('0x6a')]?_0xc48b2a[_0xfe72('0x48')]:_0xfb111e[_0xfe72('0x47')];_0xc48b2a[_0xfe72('0x4c')]=qs[_0xfe72('0x4d')](_0x49c1c4[_0xfe72('0x44')][_0xfe72('0x4d')]);_0xc48b2a[_0xfe72('0x50')]=qs[_0xfe72('0x46')](_['pick'](_0x49c1c4['query'],_0xfb111e[_0xfe72('0x46')]));if(_0x49c1c4[_0xfe72('0x44')][_0xfe72('0x4f')]){_0xc48b2a[_0xfe72('0x50')]=_[_0xfe72('0x51')](_0xc48b2a[_0xfe72('0x50')],{'$or':_[_0xfe72('0x43')](_0xc48b2a[_0xfe72('0x48')],function(_0x43c489){var _0x4e8252={};_0x4e8252[_0x43c489]={'$like':'%'+_0x49c1c4[_0xfe72('0x44')][_0xfe72('0x4f')]+'%'};return _0x4e8252;})});}_0xc48b2a=_['merge']({},_0xc48b2a,_0x49c1c4['options']);return _0x817968['getAgents'](_0xc48b2a);}})[_0xfe72('0x22')](function(_0x4af8d0){if(_0x4af8d0){_0x2a17e2=_0x4af8d0[_0xfe72('0x6a')];if(!_0x49c1c4[_0xfe72('0x44')][_0xfe72('0x4a')]('nolimit')){_0xc48b2a[_0xfe72('0x31')]=qs[_0xfe72('0x31')](_0x49c1c4[_0xfe72('0x44')][_0xfe72('0x31')]);_0xc48b2a['offset']=qs[_0xfe72('0x30')](_0x49c1c4[_0xfe72('0x44')]['offset']);}return _0x817968['getAgents'](_0xc48b2a);}})[_0xfe72('0x22')](function(_0x2b9b74){if(_0x2b9b74){return _0x2b9b74?{'count':_0x2a17e2,'rows':_0x2b9b74}:null;}})[_0xfe72('0x22')](respondWithResult(_0x54b32e,null))[_0xfe72('0x2b')](handleError(_0x54b32e,null));}; \ No newline at end of file +var _0x2f57=['existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','Contacts','updatedAt','ChatApplication','Applications','account','applications','list','orderBy','asc','defaults','contact','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','notify','offline','ListId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','No\x20timezone','inspect','Interval','Intervals','../../config/license/util','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','utf8','remote','x-real-ip','remoteAddress','replace','render','alignment','verticalAlignment','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','ValidationError','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','reject','save','update','destroy','then','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getDispositions','findOne','order','removeDispositions','ids','ChatWebsiteId','getAnswers','CannedAnswer','removeAnswers','addLogo','file','addAvatar','filename','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','sitepic','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','root','agentAvatar'];(function(_0x1233ca,_0x5a0687){var _0x4a4489=function(_0x1a1478){while(--_0x1a1478){_0x1233ca['push'](_0x1233ca['shift']());}};_0x4a4489(++_0x5a0687);}(_0x2f57,0x1ba));var _0x72f5=function(_0x1d3e5a,_0x246d70){_0x1d3e5a=_0x1d3e5a-0x0;var _0x9ed39f=_0x2f57[_0x1d3e5a];return _0x9ed39f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x72f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72f5('0x1'));var jsonpatch=require(_0x72f5('0x2'));var rp=require(_0x72f5('0x3'));var moment=require('moment');var BPromise=require(_0x72f5('0x4'));var Mustache=require(_0x72f5('0x5'));var util=require('util');var path=require(_0x72f5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x72f5('0x7'));var fs=require('fs');var _=require(_0x72f5('0x8'));var squel=require(_0x72f5('0x9'));var crypto=require(_0x72f5('0xa'));var jsforce=require(_0x72f5('0xb'));var deskjs=require(_0x72f5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x72f5('0xd'));var Redis=require(_0x72f5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x72f5('0xf'));var as=require(_0x72f5('0x10'));var hardwareService=require(_0x72f5('0x11'));var logger=require(_0x72f5('0x12'))(_0x72f5('0x13'));var utils=require(_0x72f5('0x14'));var config=require(_0x72f5('0x15'));var db=require(_0x72f5('0x16'))['db'];config[_0x72f5('0x17')]=_['defaults'](config['redis'],{'host':_0x72f5('0x18'),'port':0x18eb});var socket=require(_0x72f5('0x19'))(new Redis(config['redis']));require(_0x72f5('0x1a'))['register'](socket);var jayson=require(_0x72f5('0x1b'));var client=jayson[_0x72f5('0x1c')][_0x72f5('0x1d')]({'port':0x232c});var client9002=jayson[_0x72f5('0x1c')][_0x72f5('0x1d')]({'port':0x232a});var client9003=jayson[_0x72f5('0x1c')]['http']({'port':0x232b});function checkPasswordPattern(_0x985595,_0x290195,_0xc3798c){if(_0xc3798c){var _0x261e26=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x261e26['test'](_0x290195)){return _0x985595;}else{throw new db['Sequelize'][(_0x72f5('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 _0x985595;}}function respondWithRpcPromise(_0x58eb87,_0x122ea8,_0x19255c,_0x24e837){return new BPromise(function(_0x34780b,_0x314d77){var _0x566f09=_0x24e837||client;return _0x566f09[_0x72f5('0x1f')](_0x58eb87,_0x19255c)['then'](function(_0x18308b){logger[_0x72f5('0x20')](_0x72f5('0x21'),_0x122ea8,_0x72f5('0x22'));logger[_0x72f5('0x23')](_0x72f5('0x24'),_0x122ea8,'request\x20sent',JSON[_0x72f5('0x25')](_0x18308b));if(_0x18308b[_0x72f5('0x26')]){if(_0x18308b['error'][_0x72f5('0x27')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x122ea8,_0x18308b[_0x72f5('0x26')][_0x72f5('0x28')]);return _0x314d77(_0x18308b[_0x72f5('0x26')][_0x72f5('0x28')]);}logger[_0x72f5('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x122ea8,_0x18308b[_0x72f5('0x26')][_0x72f5('0x28')]);return _0x34780b(_0x18308b[_0x72f5('0x26')]['message']);}else{logger['info'](_0x72f5('0x21'),_0x122ea8,_0x72f5('0x22'));_0x34780b(_0x18308b[_0x72f5('0x29')][_0x72f5('0x28')]);}})[_0x72f5('0x2a')](function(_0x882e5a){logger[_0x72f5('0x26')](_0x72f5('0x21'),_0x122ea8,_0x882e5a);_0x314d77(_0x882e5a);});});}function respondWithStatusCode(_0x58bfa5,_0xdec09f){_0xdec09f=_0xdec09f||0xcc;return function(_0x507360){if(_0x507360){return _0x58bfa5[_0x72f5('0x2b')](_0xdec09f);}return _0x58bfa5[_0x72f5('0x2c')](_0xdec09f)[_0x72f5('0x2d')]();};}function respondWithResult(_0x29aacd,_0x2d6723){_0x2d6723=_0x2d6723||0xc8;return function(_0x1921c5){if(_0x1921c5){return _0x29aacd[_0x72f5('0x2c')](_0x2d6723)['json'](_0x1921c5);}};}function respondWithFilteredResult(_0x209458,_0x539fe3){return function(_0x419f2b){if(_0x419f2b){var _0x264f1a=_0x419f2b[_0x72f5('0x2e')],_0x410767=_0x539fe3[_0x72f5('0x2f')],_0x9d1e91=_0x539fe3[_0x72f5('0x2f')]+_0x539fe3['limit'],_0x125ba2;if(_0x9d1e91>=_0x264f1a){_0x9d1e91=_0x264f1a;_0x125ba2=0xc8;}else{_0x125ba2=0xce;}_0x209458['status'](_0x125ba2);return _0x209458[_0x72f5('0x30')]('Content-Range',_0x410767+'-'+_0x9d1e91+'/'+_0x264f1a)['json'](_0x419f2b);}return null;};}function patchUpdates(_0x439ffc){return function(_0x367b51){try{jsonpatch['apply'](_0x367b51,_0x439ffc,!![]);}catch(_0x51e4e4){return BPromise[_0x72f5('0x31')](_0x51e4e4);}return _0x367b51[_0x72f5('0x32')]();};}function saveUpdates(_0x218216,_0x4d1031){return function(_0x2dc180){if(_0x2dc180){return _0x2dc180[_0x72f5('0x33')](_0x218216)['then'](function(_0x478171){return _0x478171;});}return null;};}function removeEntity(_0xf7fec6,_0x47d50b){return function(_0x26dfc5){if(_0x26dfc5){return _0x26dfc5[_0x72f5('0x34')]()[_0x72f5('0x35')](function(){var _0x244282=_0x26dfc5['get']({'plain':!![]});var _0x116a10=_0x72f5('0x36');return db[_0x72f5('0x37')][_0x72f5('0x34')]({'where':{'type':_0x116a10,'resourceId':_0x244282['id']}})[_0x72f5('0x35')](function(){return _0x26dfc5;});})[_0x72f5('0x35')](function(){_0xf7fec6[_0x72f5('0x2c')](0xcc)[_0x72f5('0x2d')]();});}};}function handleEntityNotFound(_0x1818fd,_0x499313){return function(_0x3d68ca){if(!_0x3d68ca){_0x1818fd[_0x72f5('0x2b')](0x194);}return _0x3d68ca;};}function handleError(_0x4aa750,_0x36c927){_0x36c927=_0x36c927||0x1f4;return function(_0x14fd55){logger['error'](_0x14fd55[_0x72f5('0x38')]);if(_0x14fd55[_0x72f5('0x39')]){delete _0x14fd55[_0x72f5('0x39')];}_0x4aa750[_0x72f5('0x2c')](_0x36c927)[_0x72f5('0x3a')](_0x14fd55);};}exports[_0x72f5('0x3b')]=function(_0x17026e,_0x5ab22b){var _0x117d5d={'include':[{'model':db[_0x72f5('0x3c')],'as':_0x72f5('0x3d')}]},_0x367965={},_0x4a7b63={'count':0x0,'rows':[]};var _0xd863da=_[_0x72f5('0x3e')](db[_0x72f5('0x3f')]['rawAttributes'],function(_0x16e961){return{'name':_0x16e961[_0x72f5('0x40')],'type':_0x16e961[_0x72f5('0x41')][_0x72f5('0x42')]};});_0x367965[_0x72f5('0x43')]=_[_0x72f5('0x3e')](_0xd863da,'name');_0x367965[_0x72f5('0x44')]=_[_0x72f5('0x45')](_0x17026e['query']);_0x367965['filters']=_['intersection'](_0x367965[_0x72f5('0x43')],_0x367965[_0x72f5('0x44')]);_0x117d5d[_0x72f5('0x46')]=_['intersection'](_0x367965[_0x72f5('0x43')],qs['fields'](_0x17026e[_0x72f5('0x44')][_0x72f5('0x47')]));_0x117d5d[_0x72f5('0x46')]=_0x117d5d[_0x72f5('0x46')][_0x72f5('0x48')]?_0x117d5d[_0x72f5('0x46')]:_0x367965[_0x72f5('0x43')];if(!_0x17026e[_0x72f5('0x44')][_0x72f5('0x49')](_0x72f5('0x4a'))){_0x117d5d[_0x72f5('0x4b')]=qs['limit'](_0x17026e[_0x72f5('0x44')][_0x72f5('0x4b')]);_0x117d5d[_0x72f5('0x2f')]=qs[_0x72f5('0x2f')](_0x17026e[_0x72f5('0x44')][_0x72f5('0x2f')]);}_0x117d5d['order']=qs[_0x72f5('0x4c')](_0x17026e['query'][_0x72f5('0x4c')]);_0x117d5d[_0x72f5('0x4d')]=qs[_0x72f5('0x4e')](_[_0x72f5('0x4f')](_0x17026e[_0x72f5('0x44')],_0x367965[_0x72f5('0x4e')]),_0xd863da);if(_0x17026e[_0x72f5('0x44')][_0x72f5('0x50')]){_0x117d5d[_0x72f5('0x4d')]=_[_0x72f5('0x51')](_0x117d5d[_0x72f5('0x4d')],{'$or':_[_0x72f5('0x3e')](_0xd863da,function(_0x257055){if(_0x257055[_0x72f5('0x41')]!=='VIRTUAL'){var _0x3623f9={};_0x3623f9[_0x257055['name']]={'$like':'%'+_0x17026e[_0x72f5('0x44')][_0x72f5('0x50')]+'%'};return _0x3623f9;}})});}_0x117d5d=_['merge']({},_0x117d5d,_0x17026e[_0x72f5('0x52')]);var _0x3bdb9b={'where':_0x117d5d[_0x72f5('0x4d')]};return db[_0x72f5('0x3f')][_0x72f5('0x2e')](_0x3bdb9b)[_0x72f5('0x35')](function(_0x5345f6){_0x4a7b63[_0x72f5('0x2e')]=_0x5345f6;if(_0x17026e[_0x72f5('0x44')][_0x72f5('0x53')]){_0x117d5d[_0x72f5('0x54')]=[{'all':!![]}];}return db[_0x72f5('0x3f')][_0x72f5('0x55')](_0x117d5d);})['then'](function(_0x50ea00){_0x4a7b63[_0x72f5('0x56')]=_0x50ea00;return _0x4a7b63;})['then'](respondWithFilteredResult(_0x5ab22b,_0x117d5d))[_0x72f5('0x2a')](handleError(_0x5ab22b,null));};exports['show']=function(_0x16af1e,_0x2e0dd3){var _0x5765a6={'raw':![],'where':{'id':_0x16af1e[_0x72f5('0x57')]['id']},'include':[{'model':db[_0x72f5('0x3c')],'as':_0x72f5('0x3d')}]},_0x40aff1={};_0x40aff1[_0x72f5('0x43')]=_[_0x72f5('0x45')](db['ChatWebsite'][_0x72f5('0x58')]);_0x40aff1['query']=_[_0x72f5('0x45')](_0x16af1e[_0x72f5('0x44')]);_0x40aff1[_0x72f5('0x4e')]=_[_0x72f5('0x59')](_0x40aff1['model'],_0x40aff1['query']);_0x5765a6[_0x72f5('0x46')]=_[_0x72f5('0x59')](_0x40aff1['model'],qs['fields'](_0x16af1e[_0x72f5('0x44')][_0x72f5('0x47')]));_0x5765a6['attributes']=_0x5765a6[_0x72f5('0x46')][_0x72f5('0x48')]?_0x5765a6[_0x72f5('0x46')]:_0x40aff1[_0x72f5('0x43')];if(_0x16af1e['query'][_0x72f5('0x53')]){_0x5765a6[_0x72f5('0x54')]=[{'all':!![]}];}_0x5765a6=_[_0x72f5('0x51')]({},_0x5765a6,_0x16af1e[_0x72f5('0x52')]);return db[_0x72f5('0x3f')][_0x72f5('0x5a')](_0x5765a6)['then'](handleEntityNotFound(_0x2e0dd3,null))[_0x72f5('0x35')](respondWithResult(_0x2e0dd3,null))[_0x72f5('0x2a')](handleError(_0x2e0dd3,null));};exports['create']=function(_0x41a5d5,_0x40bd8b){return db[_0x72f5('0x3f')][_0x72f5('0x5b')](_0x41a5d5['body'],{})['then'](function(_0x2b7558){var _0x489b25=_0x41a5d5[_0x72f5('0x5c')]['get']({'plain':!![]});if(!_0x489b25)throw new Error(_0x72f5('0x5d'));if(_0x489b25[_0x72f5('0x5e')]===_0x72f5('0x5c')){var _0x5b727d=_0x2b7558[_0x72f5('0x5f')]({'plain':!![]});var _0x5f400b=_0x72f5('0x36');return db['UserProfileSection']['find']({'where':{'name':_0x5f400b,'userProfileId':_0x489b25[_0x72f5('0x60')]},'raw':!![]})[_0x72f5('0x35')](function(_0x2d8c9a){if(_0x2d8c9a&&_0x2d8c9a[_0x72f5('0x61')]===0x0){return db['UserProfileResource'][_0x72f5('0x5b')]({'name':_0x5b727d[_0x72f5('0x39')],'resourceId':_0x5b727d['id'],'type':_0x2d8c9a[_0x72f5('0x39')],'sectionId':_0x2d8c9a['id']},{})['then'](function(){return _0x2b7558;});}else{return _0x2b7558;}})[_0x72f5('0x2a')](function(_0x3be8dc){logger[_0x72f5('0x26')](_0x72f5('0x62'),_0x3be8dc);throw _0x3be8dc;});}return _0x2b7558;})[_0x72f5('0x35')](respondWithResult(_0x40bd8b,0xc9))[_0x72f5('0x2a')](handleError(_0x40bd8b,null));};exports[_0x72f5('0x33')]=function(_0x430e4e,_0x272806){if(_0x430e4e['body']['id']){delete _0x430e4e[_0x72f5('0x63')]['id'];}return db['ChatWebsite'][_0x72f5('0x5a')]({'where':{'id':_0x430e4e[_0x72f5('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x72f5('0x3d')}]})[_0x72f5('0x35')](handleEntityNotFound(_0x272806,null))[_0x72f5('0x35')](saveUpdates(_0x430e4e[_0x72f5('0x63')],null))[_0x72f5('0x35')](respondWithResult(_0x272806,null))[_0x72f5('0x2a')](handleError(_0x272806,null));};exports[_0x72f5('0x34')]=function(_0x5b3cc3,_0x2d9bb6){return db[_0x72f5('0x3f')]['find']({'where':{'id':_0x5b3cc3[_0x72f5('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d9bb6,null))['then'](removeEntity(_0x2d9bb6,null))[_0x72f5('0x2a')](handleError(_0x2d9bb6,null));};exports['describe']=function(_0x525642,_0x39c059){return db[_0x72f5('0x3f')][_0x72f5('0x64')]()[_0x72f5('0x35')](respondWithResult(_0x39c059,null))[_0x72f5('0x2a')](handleError(_0x39c059,null));};exports['addDisposition']=function(_0x1ac65f,_0x16694e,_0x171e36){if(_0x1ac65f[_0x72f5('0x63')]['id']){delete _0x1ac65f['body']['id'];}return db[_0x72f5('0x3f')]['find']({'where':{'id':_0x1ac65f[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x16694e,null))[_0x72f5('0x35')](function(_0x230ad7){if(_0x230ad7){_0x1ac65f[_0x72f5('0x63')]['ChatWebsiteId']=_0x230ad7['id'];return db['Disposition'][_0x72f5('0x5b')](_0x1ac65f[_0x72f5('0x63')]);}})[_0x72f5('0x35')](respondWithResult(_0x16694e,null))['catch'](handleError(_0x16694e,null));};exports[_0x72f5('0x65')]=function(_0x315a9b,_0x5b6980,_0x4b7f77){var _0x44eb12={'raw':![],'where':{}};var _0x31f518={};var _0x3e77c4={'count':0x0,'rows':[]};return db[_0x72f5('0x3f')][_0x72f5('0x66')]({'where':{'id':_0x315a9b[_0x72f5('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b6980,null))[_0x72f5('0x35')](function(_0x4a19fd){if(_0x4a19fd){_0x31f518[_0x72f5('0x43')]=_['keys'](db['Disposition'][_0x72f5('0x58')]);_0x31f518[_0x72f5('0x44')]=_[_0x72f5('0x45')](_0x315a9b['query']);_0x31f518[_0x72f5('0x4e')]=_['intersection'](_0x31f518[_0x72f5('0x43')],_0x31f518[_0x72f5('0x44')]);_0x44eb12['attributes']=_[_0x72f5('0x59')](_0x31f518[_0x72f5('0x43')],qs['fields'](_0x315a9b[_0x72f5('0x44')][_0x72f5('0x47')]));_0x44eb12[_0x72f5('0x46')]=_0x44eb12[_0x72f5('0x46')][_0x72f5('0x48')]?_0x44eb12[_0x72f5('0x46')]:_0x31f518[_0x72f5('0x43')];if(!_0x315a9b[_0x72f5('0x44')][_0x72f5('0x49')](_0x72f5('0x4a'))){_0x44eb12[_0x72f5('0x4b')]=qs[_0x72f5('0x4b')](_0x315a9b['query'][_0x72f5('0x4b')]);_0x44eb12[_0x72f5('0x2f')]=qs[_0x72f5('0x2f')](_0x315a9b[_0x72f5('0x44')][_0x72f5('0x2f')]);}_0x44eb12[_0x72f5('0x67')]=qs[_0x72f5('0x4c')](_0x315a9b[_0x72f5('0x44')][_0x72f5('0x4c')]);_0x44eb12['where']=qs[_0x72f5('0x4e')](_[_0x72f5('0x4f')](_0x315a9b[_0x72f5('0x44')],_0x31f518[_0x72f5('0x4e')]));_0x44eb12[_0x72f5('0x4d')]['ChatWebsiteId']=_0x4a19fd['id'];if(_0x315a9b[_0x72f5('0x44')][_0x72f5('0x50')]){_0x44eb12['where']=_[_0x72f5('0x51')](_0x44eb12[_0x72f5('0x4d')],{'$or':_['map'](_0x44eb12[_0x72f5('0x46')],function(_0x2309ae){var _0xa58a63={};_0xa58a63[_0x2309ae]={'$like':'%'+_0x315a9b[_0x72f5('0x44')][_0x72f5('0x50')]+'%'};return _0xa58a63;})});}_0x44eb12=_[_0x72f5('0x51')]({},_0x44eb12,_0x315a9b[_0x72f5('0x52')]);return db['Disposition'][_0x72f5('0x2e')]({'where':_0x44eb12[_0x72f5('0x4d')]})[_0x72f5('0x35')](function(_0x3b8d1f){_0x3e77c4['count']=_0x3b8d1f;if(_0x315a9b['query'][_0x72f5('0x53')]){_0x44eb12[_0x72f5('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x72f5('0x55')](_0x44eb12);})['then'](function(_0x310672){_0x3e77c4[_0x72f5('0x56')]=_0x310672;return _0x3e77c4;});}})['then'](respondWithFilteredResult(_0x5b6980,_0x44eb12))['catch'](handleError(_0x5b6980,null));};exports['removeDispositions']=function(_0x54ec3d,_0x1d49ec,_0x468f09){return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0x54ec3d[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x1d49ec,null))['then'](function(_0x410512){if(_0x410512){return _0x410512[_0x72f5('0x68')](_0x54ec3d['query'][_0x72f5('0x69')]);}})['then'](respondWithStatusCode(_0x1d49ec,null))[_0x72f5('0x2a')](handleError(_0x1d49ec,null));};exports['addAnswer']=function(_0xbbf3f,_0x821164,_0x5e37c7){if(_0xbbf3f[_0x72f5('0x63')]['id']){delete _0xbbf3f[_0x72f5('0x63')]['id'];}return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0xbbf3f[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x821164,null))[_0x72f5('0x35')](function(_0x521408){if(_0x521408){_0xbbf3f[_0x72f5('0x63')][_0x72f5('0x6a')]=_0x521408['id'];return db['CannedAnswer'][_0x72f5('0x5b')](_0xbbf3f[_0x72f5('0x63')]);}})['then'](respondWithResult(_0x821164,null))[_0x72f5('0x2a')](handleError(_0x821164,null));};exports[_0x72f5('0x6b')]=function(_0xba80d0,_0x272ae4,_0x49e1e8){var _0x37a9de={'raw':![],'where':{}};var _0x77e493={};var _0x10ffdd={'count':0x0,'rows':[]};return db[_0x72f5('0x3f')]['findOne']({'where':{'id':_0xba80d0['params']['id']}})['then'](handleEntityNotFound(_0x272ae4,null))['then'](function(_0xeae6a0){if(_0xeae6a0){_0x77e493[_0x72f5('0x43')]=_['keys'](db[_0x72f5('0x6c')][_0x72f5('0x58')]);_0x77e493[_0x72f5('0x44')]=_[_0x72f5('0x45')](_0xba80d0['query']);_0x77e493['filters']=_[_0x72f5('0x59')](_0x77e493[_0x72f5('0x43')],_0x77e493['query']);_0x37a9de[_0x72f5('0x46')]=_[_0x72f5('0x59')](_0x77e493[_0x72f5('0x43')],qs[_0x72f5('0x47')](_0xba80d0[_0x72f5('0x44')]['fields']));_0x37a9de['attributes']=_0x37a9de['attributes'][_0x72f5('0x48')]?_0x37a9de['attributes']:_0x77e493[_0x72f5('0x43')];if(!_0xba80d0[_0x72f5('0x44')]['hasOwnProperty'](_0x72f5('0x4a'))){_0x37a9de[_0x72f5('0x4b')]=qs[_0x72f5('0x4b')](_0xba80d0[_0x72f5('0x44')]['limit']);_0x37a9de['offset']=qs[_0x72f5('0x2f')](_0xba80d0[_0x72f5('0x44')][_0x72f5('0x2f')]);}_0x37a9de[_0x72f5('0x67')]=qs[_0x72f5('0x4c')](_0xba80d0['query']['sort']);_0x37a9de[_0x72f5('0x4d')]=qs[_0x72f5('0x4e')](_[_0x72f5('0x4f')](_0xba80d0[_0x72f5('0x44')],_0x77e493[_0x72f5('0x4e')]));_0x37a9de[_0x72f5('0x4d')]['ChatWebsiteId']=_0xeae6a0['id'];if(_0xba80d0[_0x72f5('0x44')][_0x72f5('0x50')]){_0x37a9de[_0x72f5('0x4d')]=_[_0x72f5('0x51')](_0x37a9de['where'],{'$or':_[_0x72f5('0x3e')](_0x37a9de['attributes'],function(_0x5367f1){var _0x4a6d89={};_0x4a6d89[_0x5367f1]={'$like':'%'+_0xba80d0[_0x72f5('0x44')][_0x72f5('0x50')]+'%'};return _0x4a6d89;})});}_0x37a9de=_[_0x72f5('0x51')]({},_0x37a9de,_0xba80d0['options']);return db[_0x72f5('0x6c')][_0x72f5('0x2e')]({'where':_0x37a9de['where']})['then'](function(_0x5621d0){_0x10ffdd[_0x72f5('0x2e')]=_0x5621d0;if(_0xba80d0['query'][_0x72f5('0x53')]){_0x37a9de['include']=[{'all':!![]}];}return db[_0x72f5('0x6c')][_0x72f5('0x55')](_0x37a9de);})['then'](function(_0x34537e){_0x10ffdd[_0x72f5('0x56')]=_0x34537e;return _0x10ffdd;});}})[_0x72f5('0x35')](respondWithFilteredResult(_0x272ae4,_0x37a9de))['catch'](handleError(_0x272ae4,null));};exports[_0x72f5('0x6d')]=function(_0x594409,_0x431c8f,_0x349f5c){return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0x594409[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x431c8f,null))[_0x72f5('0x35')](function(_0x15a5d6){if(_0x15a5d6){return _0x15a5d6[_0x72f5('0x6d')](_0x594409[_0x72f5('0x44')][_0x72f5('0x69')]);}})[_0x72f5('0x35')](respondWithStatusCode(_0x431c8f,null))['catch'](handleError(_0x431c8f,null));};exports[_0x72f5('0x6e')]=function(_0x436250,_0x1af178,_0x5989da){_0x436250['body']['sitepic']=_0x436250[_0x72f5('0x6f')]['filename'];return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0x436250[_0x72f5('0x57')]['id']}})['then'](handleEntityNotFound(_0x1af178,null))[_0x72f5('0x35')](saveUpdates(_0x436250[_0x72f5('0x63')],null))[_0x72f5('0x35')](respondWithResult(_0x1af178,null))['catch'](handleError(_0x1af178,null));};exports[_0x72f5('0x70')]=function(_0x160277,_0x26125d,_0x42cba2){_0x160277[_0x72f5('0x63')]['agentAvatar']=_0x160277['file'][_0x72f5('0x71')];return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0x160277[_0x72f5('0x57')]['id']}})['then'](handleEntityNotFound(_0x26125d,null))[_0x72f5('0x35')](saveUpdates(_0x160277[_0x72f5('0x63')],null))[_0x72f5('0x35')](respondWithResult(_0x26125d,null))[_0x72f5('0x2a')](handleError(_0x26125d,null));};exports[_0x72f5('0x72')]=function(_0x46f8f0,_0x40aaac,_0x36a8c8){_0x46f8f0['body'][_0x72f5('0x73')]=_0x46f8f0['file'][_0x72f5('0x71')];return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0x46f8f0['params']['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x40aaac,null))[_0x72f5('0x35')](saveUpdates(_0x46f8f0['body'],null))[_0x72f5('0x35')](respondWithResult(_0x40aaac,null))[_0x72f5('0x2a')](handleError(_0x40aaac,null));};exports['addSystemAvatar']=function(_0x50f9bc,_0x4bec7f,_0x331ff2){_0x50f9bc[_0x72f5('0x63')][_0x72f5('0x74')]=_0x50f9bc[_0x72f5('0x6f')][_0x72f5('0x71')];return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0x50f9bc[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x4bec7f,null))[_0x72f5('0x35')](saveUpdates(_0x50f9bc[_0x72f5('0x63')],null))[_0x72f5('0x35')](respondWithResult(_0x4bec7f,null))[_0x72f5('0x2a')](handleError(_0x4bec7f,null));};exports[_0x72f5('0x75')]=function(_0x3ee089,_0x5c5941,_0x5190e3){var _0x1de492=path[_0x72f5('0x76')](config['root'],'server/files/images/logos/default_logo.svg');var _0x22f8da={'where':{'id':_0x3ee089[_0x72f5('0x57')]['id']},'attributes':['id',_0x72f5('0x77')],'raw':!![]};var _0x580a24=![];return require('../../config/license/util')[_0x72f5('0x78')]()['then'](function(_0x3aca1c){if(_0x3aca1c){_0x580a24=_0x3aca1c[_0x72f5('0x79')];}})['then'](function(){return db['ChatWebsite']['find'](_0x22f8da);})[_0x72f5('0x35')](handleEntityNotFound(_0x5c5941,null))[_0x72f5('0x35')](function(_0x419043){if(_0x419043){if(!_[_0x72f5('0x7a')](_0x419043['sitepic'])){if(fs['existsSync'](path[_0x72f5('0x76')](config['root'],_0x72f5('0x7b'),_0x419043['sitepic']))&&_0x580a24){_0x1de492=path['join'](config['root'],'server/files/images/logos/',_0x419043[_0x72f5('0x77')]);}}return _0x5c5941[_0x72f5('0x7c')](_0x1de492);}})['catch'](handleError(_0x5c5941,null));};exports[_0x72f5('0x7d')]=function(_0x464970,_0x3a4839,_0x4dc696){var _0xd7b661=path[_0x72f5('0x76')](config[_0x72f5('0x7e')],'server/files/images/avatars/default_avatar.png');var _0x3a4709={'where':{'id':_0x464970[_0x72f5('0x57')]['id']},'attributes':['id',_0x72f5('0x7f')],'raw':!![]};return db['ChatWebsite'][_0x72f5('0x5a')](_0x3a4709)[_0x72f5('0x35')](handleEntityNotFound(_0x3a4839,null))['then'](function(_0x57426b){if(_0x57426b){if(!_[_0x72f5('0x7a')](_0x57426b[_0x72f5('0x7f')])){if(fs[_0x72f5('0x80')](path[_0x72f5('0x76')](config[_0x72f5('0x7e')],_0x72f5('0x81'),_0x57426b[_0x72f5('0x7f')]))){_0xd7b661=path[_0x72f5('0x76')](config[_0x72f5('0x7e')],_0x72f5('0x81'),_0x57426b[_0x72f5('0x7f')]);}}return _0x3a4839[_0x72f5('0x7c')](_0xd7b661);}})[_0x72f5('0x2a')](handleError(_0x3a4839,null));};exports[_0x72f5('0x82')]=function(_0x46b27c,_0x487340,_0x37194d){var _0x19c687=path[_0x72f5('0x76')](config['root'],_0x72f5('0x83'));var _0x953deb={'where':{'id':_0x46b27c[_0x72f5('0x57')]['id']},'attributes':['id',_0x72f5('0x73'),'showCustomerAvatar'],'raw':!![]};return db[_0x72f5('0x3f')][_0x72f5('0x5a')](_0x953deb)[_0x72f5('0x35')](handleEntityNotFound(_0x487340,null))['then'](function(_0x341b82){if(_0x341b82){if(!_['isNil'](_0x341b82['customerAvatar'])){if(fs['existsSync'](path[_0x72f5('0x76')](config[_0x72f5('0x7e')],_0x72f5('0x81'),_0x341b82[_0x72f5('0x73')]))&&_0x341b82[_0x72f5('0x84')]){_0x19c687=path[_0x72f5('0x76')](config[_0x72f5('0x7e')],_0x72f5('0x81'),_0x341b82[_0x72f5('0x73')]);}}return _0x487340[_0x72f5('0x7c')](_0x19c687);}})[_0x72f5('0x2a')](handleError(_0x487340,null));};exports[_0x72f5('0x85')]=function(_0x5258ed,_0x241880,_0x4c76e7){var _0x127a65=path[_0x72f5('0x76')](config[_0x72f5('0x7e')],_0x72f5('0x86'));var _0x5a23ee={'where':{'id':_0x5258ed[_0x72f5('0x57')]['id']},'attributes':['id',_0x72f5('0x74')],'raw':!![]};return db[_0x72f5('0x3f')][_0x72f5('0x5a')](_0x5a23ee)['then'](handleEntityNotFound(_0x241880,null))[_0x72f5('0x35')](function(_0x3893f2){if(_0x3893f2){if(!_[_0x72f5('0x7a')](_0x3893f2[_0x72f5('0x74')])){if(fs[_0x72f5('0x80')](path[_0x72f5('0x76')](config[_0x72f5('0x7e')],_0x72f5('0x81'),_0x3893f2[_0x72f5('0x74')]))){_0x127a65=path[_0x72f5('0x76')](config['root'],_0x72f5('0x81'),_0x3893f2[_0x72f5('0x74')]);}}return _0x241880[_0x72f5('0x7c')](_0x127a65);}})['catch'](handleError(_0x241880,null));};exports['notify']=function(_0x37b188,_0x4af82f,_0x109577){var _0x375f65=require(_0x72f5('0x87'));var _0x396692=new _0x375f65();var _0x543625=_0x396692[_0x72f5('0x88')](_0x37b188['headers'][_0x72f5('0x89')])[_0x72f5('0x8a')]();var _0x2e1cf3={'body':_0x37b188[_0x72f5('0x63')],'channel':_0x72f5('0x8b')};var _0x5120fb=[];var _0x3b221e=[];var _0x24e84d={};var _0x4e6664=![];return db[_0x72f5('0x8c')][_0x72f5('0x64')]()[_0x72f5('0x35')](function(_0x261b1c){if(!_0x261b1c){throw new db[(_0x72f5('0x8d'))][(_0x72f5('0x1e'))](_0x72f5('0x8e'));}_0x5120fb=_[_0x72f5('0x8f')](_[_0x72f5('0x45')](_0x261b1c),[_0x72f5('0x90'),'updatedAt']);_0x3b221e=_['difference'](_[_0x72f5('0x45')](_0x261b1c),[_0x72f5('0x90'),'updatedAt','CompanyId','ListId']);if(_0x37b188[_0x72f5('0x63')]['id']){delete _0x37b188[_0x72f5('0x63')]['id'];}if(_['isNil'](_0x37b188[_0x72f5('0x63')][_0x72f5('0x91')])){throw new db[(_0x72f5('0x8d'))][(_0x72f5('0x1e'))](_0x72f5('0x92'));}if(_['isNil'](_0x37b188['body'][_0x72f5('0x63')])||_0x37b188['body']['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x72f5('0x7a')](_0x37b188['body']['mapKey'])){throw new db[(_0x72f5('0x8d'))][(_0x72f5('0x1e'))](_0x72f5('0x93')+_0x3b221e);}if(!_['includes'](_0x3b221e,_0x37b188['body']['mapKey'])){throw new db[(_0x72f5('0x8d'))][(_0x72f5('0x1e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b221e);}_0x24e84d[_0x37b188[_0x72f5('0x63')][_0x72f5('0x94')]]=_0x37b188[_0x72f5('0x63')][_0x72f5('0x91')];})[_0x72f5('0x35')](function(){return db['ChatWebsite'][_0x72f5('0x5a')]({'where':{'id':_0x37b188[_0x72f5('0x57')]['id']},'include':[{'model':db[_0x72f5('0x95')],'as':_0x72f5('0x96'),'include':[{'model':db['CmContact'],'as':_0x72f5('0x97'),'where':_0x24e84d,'limit':0x1,'order':[[_0x72f5('0x98'),'DESC']]}]},{'model':db[_0x72f5('0x99')],'as':_0x72f5('0x9a')}]});})[_0x72f5('0x35')](handleEntityNotFound(_0x4af82f,null))['then'](function(_0x447d78){if(_0x447d78&&_0x447d78[_0x72f5('0x96')]){_0x2e1cf3[_0x72f5('0x9b')]=_0x447d78;_0x2e1cf3[_0x72f5('0x9c')]=_0x447d78[_0x72f5('0x9a')];_0x2e1cf3[_0x72f5('0x9d')]=_0x447d78['List'];_0x2e1cf3[_0x72f5('0x9c')]=_[_0x72f5('0x9e')](_0x2e1cf3['applications'],['priority'],[_0x72f5('0x9f')]);if(_0x2e1cf3[_0x72f5('0x9b')]['Applications']){delete _0x2e1cf3[_0x72f5('0x9b')][_0x72f5('0x9a')];}if(_0x2e1cf3[_0x72f5('0x9b')][_0x72f5('0x96')]&&_0x2e1cf3['account'][_0x72f5('0x96')][_0x72f5('0x97')][_0x72f5('0x48')]){return _0x2e1cf3[_0x72f5('0x9b')][_0x72f5('0x96')]['Contacts'][0x0];}var _0x54ad3c=_[_0x72f5('0xa0')](_0x37b188[_0x72f5('0x63')],{'firstName':_0x37b188[_0x72f5('0x63')][_0x72f5('0x91')],'ListId':_0x447d78['ListId']});_0x54ad3c[_0x37b188['body'][_0x72f5('0x94')]]=_0x37b188[_0x72f5('0x63')][_0x72f5('0x91')];return db[_0x72f5('0x8c')][_0x72f5('0x5b')](_0x54ad3c,{'fields':_0x5120fb,'raw':!![]});}})[_0x72f5('0x35')](handleEntityNotFound(_0x4af82f,null))[_0x72f5('0x35')](function(_0x27ec82){_0x2e1cf3[_0x72f5('0xa1')]=_0x27ec82;var _0x56483b=_0x37b188['body']['customerIp'];if(_0x37b188[_0x72f5('0xa2')][_0x72f5('0xa3')]){_0x56483b=_0x37b188[_0x72f5('0xa2')]['cf-connecting-ip'];}else if(_0x37b188[_0x72f5('0xa2')][_0x72f5('0xa4')]){_0x56483b=_[_0x72f5('0xa5')](_0x37b188['headers'][_0x72f5('0xa4')][_0x72f5('0xa6')](','));}if(_0x27ec82){var _0x40d0cd={'ContactId':_0x27ec82['id'],'ChatWebsiteId':_0x37b188[_0x72f5('0x57')]['id'],'from':(_0x27ec82[_0x72f5('0xa7')]||'')+'\x20'+(_0x27ec82[_0x72f5('0xa8')]||''),'customerIp':_0x56483b,'customerPort':_0x37b188[_0x72f5('0xa2')][_0x72f5('0xa9')]?_0x37b188['headers'][_0x72f5('0xa9')]:null,'referer':_0x37b188['body'][_0x72f5('0xaa')],'browserName':_0x543625[_0x72f5('0xab')][_0x72f5('0x39')]&&_0x543625[_0x72f5('0xab')][_0x72f5('0xac')]?util[_0x72f5('0xad')](_0x72f5('0xae'),_0x543625['browser'][_0x72f5('0x39')],_0x543625[_0x72f5('0xab')][_0x72f5('0xac')]):_0x72f5('0xaf'),'browserVersion':_0x543625[_0x72f5('0xab')][_0x72f5('0xac')]||_0x72f5('0xaf'),'osName':util[_0x72f5('0xad')](_0x72f5('0xae'),_0x543625['os']['name'],_0x543625['os'][_0x72f5('0xac')]),'osVersion':_0x543625['os'][_0x72f5('0xac')],'deviceModel':_0x543625['device'][_0x72f5('0x43')]&&_0x543625[_0x72f5('0xb0')][_0x72f5('0xb1')]?util[_0x72f5('0xad')]('%s\x20%s\x20%s',_0x543625[_0x72f5('0xb0')][_0x72f5('0x43')],_0x543625[_0x72f5('0xb0')]['vendor'],_0x543625[_0x72f5('0xb0')][_0x72f5('0x41')]):null,'deviceVendor':_0x543625[_0x72f5('0xb0')]['vendor'],'deviceType':_0x543625['device']['type'],'formData':JSON[_0x72f5('0x25')](_0x37b188[_0x72f5('0x63')])};var _0x211279={'ChatWebsiteId':_0x37b188['params']['id'],'closed':![]};if(_0x37b188[_0x72f5('0x63')]['threadId']){_0x211279[_0x72f5('0xb2')]=_0x37b188['body'][_0x72f5('0xb2')];return db[_0x72f5('0xb3')][_0x72f5('0x5a')]({'where':_0x211279})[_0x72f5('0x35')](function(_0x2689a5){if(_0x2689a5){return[_0x2689a5,![]];}_0x40d0cd[_0x72f5('0xb2')]=_0x37b188[_0x72f5('0x63')]['threadId'];_0x40d0cd['externalUrl']=_0x37b188[_0x72f5('0x63')][_0x72f5('0xb4')];return db[_0x72f5('0xb3')][_0x72f5('0x5b')](_0x40d0cd)[_0x72f5('0x35')](function(_0x697b10){return[_0x697b10,!![]];});});}_0x211279['ContactId']=_0x27ec82['id'];if(_0x37b188[_0x72f5('0x63')][_0x72f5('0xb5')]&&_0x37b188[_0x72f5('0x63')][_0x72f5('0xb5')]['id']){_0x211279['id']=_0x37b188[_0x72f5('0x63')][_0x72f5('0xb5')]['id'];return db[_0x72f5('0xb3')][_0x72f5('0x5a')]({'where':_0x211279})['then'](function(_0x2efbc4){if(_0x2efbc4){return[_0x2efbc4,![]];}return db[_0x72f5('0xb3')][_0x72f5('0x5b')](_0x40d0cd)[_0x72f5('0x35')](function(_0x41e063){return[_0x41e063,!![]];});});}return db[_0x72f5('0xb3')][_0x72f5('0x5b')](_0x40d0cd)[_0x72f5('0x35')](function(_0x12bfdb){return[_0x12bfdb,!![]];});}})[_0x72f5('0xb6')](function(_0x442d74,_0x3bc005){if(_0x442d74){_0x4e6664=_0x3bc005;if(!_0x3bc005){var _0x38fc53={'from':(_0x2e1cf3[_0x72f5('0xa1')][_0x72f5('0xa7')]||'')+'\x20'+(_0x2e1cf3['contact'][_0x72f5('0xa8')]||'')};if(_0x37b188[_0x72f5('0x63')]['threadId']&&_0x37b188['body'][_0x72f5('0xb7')]&&_0x37b188['body'][_0x72f5('0xb2')]!=_0x37b188[_0x72f5('0x63')][_0x72f5('0xb7')]){_0x38fc53['threadId']=_0x37b188[_0x72f5('0x63')]['messageId'];}return _0x442d74[_0x72f5('0x33')](_0x38fc53);}else{return _0x442d74;}}})[_0x72f5('0x35')](function(_0x5f4f78){_0x2e1cf3[_0x72f5('0xb5')]=_0x5f4f78[_0x72f5('0x5f')]({'plain':!![]});_0x2e1cf3[_0x72f5('0xb5')][_0x72f5('0xb8')]=_0x4e6664;if(_0x2e1cf3[_0x72f5('0xb5')][_0x72f5('0xb8')]){if(_0x2e1cf3[_0x72f5('0x9b')]['autoclose']){_0x2e1cf3['applications']['push']({'id':0x0,'priority':_0x2e1cf3[_0x72f5('0x9c')][_0x72f5('0x48')]+0x1,'app':_0x72f5('0xb9'),'appdata':_0x72f5('0xba'),'interval':_0x72f5('0xbb')});}}return db[_0x72f5('0xbc')][_0x72f5('0x5b')]({'body':_0x37b188[_0x72f5('0x63')][_0x72f5('0x63')],'ChatWebsiteId':_0x37b188[_0x72f5('0x57')]['id'],'ChatInteractionId':_0x5f4f78['id'],'direction':'in','ContactId':_0x2e1cf3[_0x72f5('0xa1')]['id'],'AttachmentId':_0x37b188[_0x72f5('0x63')][_0x72f5('0xbd')]});})[_0x72f5('0x35')](function(_0x1f203b){_0x2e1cf3['message']=_0x1f203b;if(_0x2e1cf3[_0x72f5('0xb5')][_0x72f5('0xbe')]){return db['User'][_0x72f5('0x5a')]({'attributes':['id',_0x72f5('0x39')],'where':{'id':_0x2e1cf3['interaction']['UserId']}})[_0x72f5('0x35')](function(_0x735c03){if(_0x735c03){_0x2e1cf3[_0x72f5('0x9c')][_0x72f5('0xbf')]({'id':0x0,'priority':0x0,'app':_0x72f5('0xc0'),'appdata':_0x735c03[_0x72f5('0x39')]+','+(_0x2e1cf3[_0x72f5('0x9b')][_0x72f5('0xc1')]||0xa),'interval':_0x72f5('0xbb')});_0x2e1cf3['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x72f5('0xc2'),_0x2e1cf3);});}return respondWithRpcPromise(_0x72f5('0xc3'),_0x72f5('0xc2'),_0x2e1cf3);})[_0x72f5('0x35')](function(_0x1fd6b5){respondWithRpcPromise(_0x72f5('0xc4'),_0x72f5('0xc4'),{'event':_0x72f5('0xc5'),'message':_0x1fd6b5},client9002);return _0x1fd6b5;})[_0x72f5('0x35')](respondWithResult(_0x4af82f,null))[_0x72f5('0x2a')](handleError(_0x4af82f,null));};exports[_0x72f5('0xc6')]=function(_0x130a48,_0x2afd24,_0xeef33c){var _0x590266,_0x3abe11,_0x97b3dc;var _0x2156a9=[];var _0x19a89e=[];var _0x2cb3e5={};return db[_0x72f5('0x8c')][_0x72f5('0x64')]()['then'](function(_0x2837f9){if(!_0x2837f9){throw new db['Sequelize'][(_0x72f5('0x1e'))](_0x72f5('0x8e'));}_0x19a89e=_[_0x72f5('0x8f')](_[_0x72f5('0x45')](_0x2837f9),['createdAt',_0x72f5('0x98')]);_0x2156a9=_[_0x72f5('0x8f')](_['keys'](_0x2837f9),['createdAt',_0x72f5('0x98'),'CompanyId',_0x72f5('0xc7')]);if(_0x130a48[_0x72f5('0x63')]['id']){delete _0x130a48[_0x72f5('0x63')]['id'];}if(_[_0x72f5('0x7a')](_0x130a48[_0x72f5('0x63')][_0x72f5('0x91')])){throw _0x2afd24[_0x72f5('0x2c')](0x1f4)['send'](new db[(_0x72f5('0x8d'))]['ValidationError'](_0x72f5('0x92')));}if(_[_0x72f5('0x7a')](_0x130a48[_0x72f5('0x63')][_0x72f5('0x63')])||_0x130a48[_0x72f5('0x63')]['body']===''){throw _0x2afd24['status'](0x1f4)[_0x72f5('0x3a')](new db[(_0x72f5('0x8d'))][(_0x72f5('0x1e'))](_0x72f5('0xc8')));}if(_[_0x72f5('0x7a')](_0x130a48[_0x72f5('0x63')]['mapKeyOffline'])){throw _0x2afd24[_0x72f5('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0x72f5('0x1e'))](_0x72f5('0xc9')+_0x2156a9));}if(!_['includes'](_0x2156a9,_0x130a48[_0x72f5('0x63')][_0x72f5('0xca')])){throw _0x2afd24[_0x72f5('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0x72f5('0x1e'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2156a9));}_0x2cb3e5[_0x130a48[_0x72f5('0x63')]['mapKeyOffline']]=_0x130a48[_0x72f5('0x63')][_0x72f5('0x91')];})[_0x72f5('0x35')](function(){return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0x130a48['params']['id']},'include':[{'model':db[_0x72f5('0x95')],'as':'List'}]});})[_0x72f5('0x35')](handleEntityNotFound(_0x2afd24,null))[_0x72f5('0x35')](function(_0x130a4a){if(_0x130a4a&&_0x130a4a['List']){_0x3abe11=_0x130a4a;var _0x181b4a=_[_0x72f5('0xa0')](_0x130a48[_0x72f5('0x63')],{'firstName':_0x130a48[_0x72f5('0x63')][_0x72f5('0x91')],'phone':_0x130a48['body'][_0x72f5('0x91')],'ListId':_0x130a4a[_0x72f5('0xc7')]});_0x181b4a[_0x130a48['body'][_0x72f5('0xca')]]=_0x130a48[_0x72f5('0x63')][_0x72f5('0x91')];return db[_0x72f5('0x8c')]['findOrCreate']({'where':_0x2cb3e5,'defaults':_0x181b4a});}})[_0x72f5('0xb6')](function(_0x549532){if(_0x549532){_0x97b3dc=_0x549532;var _0x2c1b25=fs[_0x72f5('0xcb')](path[_0x72f5('0x76')](config[_0x72f5('0x7e')],_0x72f5('0xcc')),'utf8');var _0x5c9cb8=ejs['render'](_0x2c1b25,{'body':_[_0x72f5('0xcd')](_0x130a48[_0x72f5('0x63')][_0x72f5('0x63')]),'bodyTitle':_0x3abe11[_0x72f5('0xce')]});return db[_0x72f5('0xcf')][_0x72f5('0x5b')]({'body':_0x5c9cb8,'ContactId':_0x549532['id'],'ChatWebsiteId':_0x3abe11['id']});}})[_0x72f5('0x35')](function(_0x4add4b){if(_0x4add4b){_0x590266=_0x4add4b;return db[_0x72f5('0xd0')][_0x72f5('0x66')]({'where':{'service':!![]},'include':[{'model':db[_0x72f5('0xd1')],'as':_0x72f5('0xd2'),'raw':!![]}]});}})[_0x72f5('0x35')](function(_0xe5b806){if(_0xe5b806&&_0xe5b806[_0x72f5('0xd2')]&&_0x3abe11[_0x72f5('0xd3')]){var _0x2696f2={'tls':{'rejectUnauthorized':![]}};if(_0xe5b806[_0x72f5('0xd2')][_0x72f5('0xd4')]){_0x2696f2[_0x72f5('0xd4')]=_0xe5b806[_0x72f5('0xd2')][_0x72f5('0xd4')];}else{_0x2696f2[_0x72f5('0xd5')]=_0xe5b806[_0x72f5('0xd2')][_0x72f5('0xd5')];_0x2696f2['port']=_0xe5b806[_0x72f5('0xd2')][_0x72f5('0xd6')];_0x2696f2[_0x72f5('0xd7')]=_0xe5b806[_0x72f5('0xd2')][_0x72f5('0xd7')];}if(_0xe5b806[_0x72f5('0xd2')][_0x72f5('0xd8')]){_0x2696f2[_0x72f5('0xd9')]={'user':_0xe5b806[_0x72f5('0xd2')][_0x72f5('0x5c')],'pass':_0xe5b806[_0x72f5('0xd2')][_0x72f5('0xda')]};}return respondWithRpcPromise(_0x72f5('0xdb'),'sendMail',{'account':_0x2696f2,'message':{'from':util[_0x72f5('0xad')]('\x22%s\x22\x20<%s>',_0xe5b806[_0x72f5('0x39')],_0xe5b806[_0x72f5('0xdc')]||_0xe5b806[_0x72f5('0xd2')]['user']),'to':_0x3abe11[_0x72f5('0xd3')],'subject':_0x3abe11[_0x72f5('0xdd')],'text':_0x590266[_0x72f5('0x63')]}},client9003)[_0x72f5('0x35')](function(){return _0x590266;})['catch'](function(_0x5a9c33){console[_0x72f5('0x26')](_0x5a9c33);});}})[_0x72f5('0x35')](function(){if(_0x590266){return _0x590266;}})[_0x72f5('0x35')](respondWithResult(_0x2afd24,null))[_0x72f5('0x2a')](handleError(_0x2afd24,null));};exports[_0x72f5('0xde')]=function(_0x99d1e0,_0x1f414a,_0x5553ea){return db[_0x72f5('0xb3')][_0x72f5('0x5a')]({'where':{'id':_0x99d1e0[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x1f414a,null))['then'](function(_0x59cd61){if(_0x59cd61){return _0x59cd61[_0x72f5('0xde')](_0x99d1e0[_0x72f5('0x63')][_0x72f5('0x69')],_[_0x72f5('0xdf')](_0x99d1e0[_0x72f5('0x63')],[_0x72f5('0x69'),'id'])||{});}})[_0x72f5('0x35')](respondWithResult(_0x1f414a,null))[_0x72f5('0x2a')](handleError(_0x1f414a,null));};exports[_0x72f5('0xe0')]=function(_0x248c3f,_0x3c8170,_0x3cbf22){var _0x15f28e={'raw':![],'where':{}};var _0x370c0b={};var _0x403342={'count':0x0,'rows':[]};return db[_0x72f5('0x3f')]['findOne']({'where':{'id':_0x248c3f['params']['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x3c8170,null))[_0x72f5('0x35')](function(_0x321065){if(_0x321065){_0x370c0b[_0x72f5('0x43')]=_[_0x72f5('0x45')](db['ChatInteraction'][_0x72f5('0x58')]);_0x370c0b['query']=_[_0x72f5('0x45')](_0x248c3f[_0x72f5('0x44')]);_0x370c0b['filters']=_[_0x72f5('0x59')](_0x370c0b['model'],_0x370c0b[_0x72f5('0x44')]);_0x15f28e[_0x72f5('0x46')]=_['intersection'](_0x370c0b[_0x72f5('0x43')],qs[_0x72f5('0x47')](_0x248c3f[_0x72f5('0x44')][_0x72f5('0x47')]));_0x15f28e['attributes']=_0x15f28e[_0x72f5('0x46')][_0x72f5('0x48')]?_0x15f28e[_0x72f5('0x46')]:_0x370c0b['model'];if(!_0x248c3f[_0x72f5('0x44')]['hasOwnProperty'](_0x72f5('0x4a'))){_0x15f28e[_0x72f5('0x4b')]=qs[_0x72f5('0x4b')](_0x248c3f[_0x72f5('0x44')][_0x72f5('0x4b')]);_0x15f28e['offset']=qs[_0x72f5('0x2f')](_0x248c3f[_0x72f5('0x44')]['offset']);}_0x15f28e[_0x72f5('0x67')]=qs[_0x72f5('0x4c')](_0x248c3f[_0x72f5('0x44')]['sort']);_0x15f28e['where']=qs['filters'](_[_0x72f5('0x4f')](_0x248c3f[_0x72f5('0x44')],_0x370c0b[_0x72f5('0x4e')]));_0x15f28e[_0x72f5('0x4d')][_0x72f5('0x6a')]=_0x321065['id'];if(_0x248c3f['query'][_0x72f5('0x50')]){_0x15f28e['where']=_['merge'](_0x15f28e[_0x72f5('0x4d')],{'$or':_['map'](_0x15f28e[_0x72f5('0x46')],function(_0x1be6f9){var _0x4487fb={};_0x4487fb[_0x1be6f9]={'$like':'%'+_0x248c3f[_0x72f5('0x44')][_0x72f5('0x50')]+'%'};return _0x4487fb;})});}_0x15f28e=_['merge']({},_0x15f28e,_0x248c3f[_0x72f5('0x52')]);return db[_0x72f5('0xb3')][_0x72f5('0x2e')]({'where':_0x15f28e[_0x72f5('0x4d')]})['then'](function(_0x142d37){_0x403342['count']=_0x142d37;if(_0x248c3f[_0x72f5('0x44')][_0x72f5('0x53')]){_0x15f28e[_0x72f5('0x54')]=[{'model':db[_0x72f5('0x8c')],'as':_0x72f5('0xe1'),'required':![]},{'model':db[_0x72f5('0xe2')],'as':_0x72f5('0xe3'),'attributes':[_0x72f5('0x39'),_0x72f5('0xe4'),_0x72f5('0xe5')],'required':![]},{'model':db[_0x72f5('0xe6')],'as':_0x72f5('0xe7'),'attributes':['id',_0x72f5('0x39'),_0x72f5('0xe8')],'where':_0x248c3f[_0x72f5('0x44')]['tag']?{'id':_0x248c3f['query']['tag']}:undefined,'required':_0x248c3f[_0x72f5('0x44')][_0x72f5('0xe9')]?!![]:![]}];}return db[_0x72f5('0xb3')][_0x72f5('0x55')](_0x15f28e);})[_0x72f5('0x35')](function(_0x23047e){_0x403342['rows']=_0x23047e;return _0x403342;});}})[_0x72f5('0x35')](respondWithFilteredResult(_0x3c8170,_0x15f28e))[_0x72f5('0x2a')](handleError(_0x3c8170,null));};function iftimePromise(_0x4d1882,_0x185faf){return respondWithRpcPromise('Command',_0x72f5('0xea'),{'command':_0x185faf[_0x72f5('0xeb')]?util[_0x72f5('0xad')](_0x72f5('0xec'),_0x4d1882['interval'],_0x185faf['timezone']):util[_0x72f5('0xad')](_0x72f5('0xed'),_0x4d1882['interval'])},client9002)[_0x72f5('0x35')](function(_0x29a360){var _0x6f7753=_0x29a360&&_0x29a360['indexOf'](_0x72f5('0xee'))>=0x0?!![]:![];logger[_0x72f5('0x20')](_0x72f5('0xef'),_0x185faf['id'],_0x4d1882['id'],_0x4d1882[_0x72f5('0xf0')],_0x6f7753?_0x72f5('0xf1'):'OFFLINE',_0x185faf[_0x72f5('0xeb')]?_0x185faf[_0x72f5('0xeb')]:_0x72f5('0xf2'));return _0x6f7753;})[_0x72f5('0x2a')](function(_0x8ef1d8){logger['error'](_0x72f5('0xef'),_0x185faf['id'],_0x4d1882['id'],_0x4d1882[_0x72f5('0xf0')],util[_0x72f5('0xf3')](_0x8ef1d8,{'showHidden':![],'depth':null}),_0x185faf[_0x72f5('0xeb')]?_0x185faf['timezone']:_0x72f5('0xf2'));return![];});}exports['getSnippet']=function(_0x24da08,_0x54c76d,_0x58b46a){var _0x400ab4=0x0;var _0x6ec811=0x0;var _0x2d013d=![];var _0x76f06d;var _0x379df6;return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0x24da08[_0x72f5('0x57')]['id']},'include':[{'model':db[_0x72f5('0xf4')],'as':_0x72f5('0xf4'),'include':[{'model':db[_0x72f5('0xf4')],'as':_0x72f5('0xf5'),'attributes':['id',_0x72f5('0xf0')],'raw':!![]}]}]})[_0x72f5('0x35')](handleEntityNotFound(_0x54c76d,null))[_0x72f5('0x35')](function(_0x37c441){if(_0x37c441){_0x76f06d=_0x37c441;return _0x37c441['getProactiveActions']({'raw':!![]});}})[_0x72f5('0x35')](function(_0x6ff5d){if(_0x76f06d){if(_0x6ff5d){_0x379df6=_0x6ff5d;}}return require(_0x72f5('0xf6'))[_0x72f5('0x78')]();})[_0x72f5('0x35')](function(_0x2ae050){if(_0x2ae050){_0x6ec811=_0x2ae050[_0x72f5('0xf7')];_0x2d013d=_0x2ae050[_0x72f5('0x79')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x72f5('0x35')](function(_0x596694){_0x400ab4=_0x596694;if(_0x6ec811&&_0x596694>_0x6ec811){return db['License'][_0x72f5('0x66')]({'where':{'id':0x1}})[_0x72f5('0x35')](function(_0x3e0b26){if(_0x3e0b26){_0x3e0b26[_0x72f5('0xf8')](_0x72f5('0xf9'));}});}})['then'](function(){if(_0x76f06d[_0x72f5('0xf4')]&&_0x76f06d['Interval'][_0x72f5('0xf5')]){var _0x4ff845=[];for(var _0x27b265=0x0;_0x27b265<_0x76f06d[_0x72f5('0xf4')][_0x72f5('0xf5')][_0x72f5('0x48')];_0x27b265++){var _0x547f8b=_0x76f06d[_0x72f5('0xf4')][_0x72f5('0xf5')][_0x27b265]['get']({'plain':!![]});_0x4ff845['push'](iftimePromise(_0x547f8b,_0x76f06d));}return BPromise[_0x72f5('0xfa')](_0x4ff845)['then'](function(_0x4d503b){return _[_0x72f5('0xfb')](_0x4d503b);});}else{return!![];}})[_0x72f5('0x35')](function(_0x4ea239){var _0x5a596f=fs['readFileSync'](path[_0x72f5('0x76')](config[_0x72f5('0x7e')],_0x72f5('0xfc')),_0x72f5('0xfd'));var _0x49f9d8={'remote':_0x76f06d[_0x72f5('0xfe')],'query':querystring[_0x72f5('0x25')](_[_0x72f5('0x51')](_0x76f06d[_0x72f5('0x5f')]({'plain':!![]}),{'customerIp':_0x24da08[_0x72f5('0xa2')]['x-forwarded-for']||_0x24da08[_0x72f5('0xa2')][_0x72f5('0xff')]||_0x24da08['connection'][_0x72f5('0x100')]||_0x24da08['ip'],'referer':_0x24da08['headers'][_0x72f5('0xaa')],'openedInteractions':_0x400ab4,'maxInteractions':_0x6ec811,'virtual':_0x2d013d[_0x72f5('0xf7')],'online':_0x4ea239,'custom':_0x2d013d}))[_0x72f5('0x101')](/'/g,'\x5c\x27')};_0x54c76d['send'](ejs[_0x72f5('0x102')](Mustache['render'](_0x5a596f,_0x49f9d8),{'proactiveActions':_0x379df6,'alignment':_0x76f06d[_0x72f5('0x103')],'verticalAlignment':_0x76f06d[_0x72f5('0x104')],'div_color':_0x76f06d[_0x72f5('0xe8')],'text_color':_0x76f06d['textColor']}));})[_0x72f5('0x2a')](handleError(_0x54c76d,null));};exports[_0x72f5('0x105')]=function(_0x1bac82,_0x449c26,_0x42b2a5){return db[_0x72f5('0x3f')][_0x72f5('0x66')]({'where':{'id':_0x1bac82[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x449c26,null))[_0x72f5('0x35')](function(_0x4f87e8){if(_0x4f87e8){return db[_0x72f5('0x106')][_0x72f5('0x107')](function(_0x569d15){return db[_0x72f5('0x99')][_0x72f5('0x34')]({'where':{'ChatWebsiteId':_0x1bac82[_0x72f5('0x57')]['id']},'transaction':_0x569d15})['then'](function(_0x47e530){var _0x3ee5f3=_[_0x72f5('0x3e')](_0x1bac82[_0x72f5('0x63')],function(_0x2f2fdc){_0x2f2fdc['ChatWebsiteId']=_0x1bac82[_0x72f5('0x57')]['id'];return _0x2f2fdc;});return db[_0x72f5('0x99')][_0x72f5('0x108')](_0x3ee5f3,{'transaction':_0x569d15});});})['then'](function(){return db[_0x72f5('0x99')][_0x72f5('0x109')]({'where':{'ChatWebsiteId':_0x1bac82[_0x72f5('0x57')]['id']},'order':_0x72f5('0x10a')});});}})[_0x72f5('0x35')](respondWithResult(_0x449c26,null))[_0x72f5('0x2a')](handleError(_0x449c26,null));};exports['getApplications']=function(_0x325dd7,_0x3b510e,_0x39b966){var _0x255fc8={};var _0x5524aa={};var _0xf123d6;var _0x4c0369;return db[_0x72f5('0x3f')]['findOne']({'where':{'id':_0x325dd7['params']['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x3b510e,null))[_0x72f5('0x35')](function(_0x454e38){if(_0x454e38){_0xf123d6=_0x454e38;_0x5524aa[_0x72f5('0x43')]=_[_0x72f5('0x45')](db[_0x72f5('0x99')]['rawAttributes']);_0x5524aa[_0x72f5('0x44')]=_[_0x72f5('0x45')](_0x325dd7[_0x72f5('0x44')]);_0x5524aa['filters']=_[_0x72f5('0x59')](_0x5524aa[_0x72f5('0x43')],_0x5524aa[_0x72f5('0x44')]);_0x255fc8[_0x72f5('0x46')]=_[_0x72f5('0x59')](_0x5524aa[_0x72f5('0x43')],qs[_0x72f5('0x47')](_0x325dd7[_0x72f5('0x44')][_0x72f5('0x47')]));_0x255fc8[_0x72f5('0x46')]=_0x255fc8[_0x72f5('0x46')][_0x72f5('0x48')]?_0x255fc8[_0x72f5('0x46')]:_0x5524aa[_0x72f5('0x43')];_0x255fc8[_0x72f5('0x67')]=qs[_0x72f5('0x4c')](_0x325dd7['query'][_0x72f5('0x4c')]);_0x255fc8[_0x72f5('0x4d')]=qs[_0x72f5('0x4e')](_[_0x72f5('0x4f')](_0x325dd7['query'],_0x5524aa[_0x72f5('0x4e')]));if(_0x325dd7[_0x72f5('0x44')][_0x72f5('0x50')]){_0x255fc8[_0x72f5('0x4d')]=_[_0x72f5('0x51')](_0x255fc8['where'],{'$or':_[_0x72f5('0x3e')](_0x255fc8['attributes'],function(_0x3b5663){var _0x3b892f={};_0x3b892f[_0x3b5663]={'$like':'%'+_0x325dd7[_0x72f5('0x44')][_0x72f5('0x50')]+'%'};return _0x3b892f;})});}_0x255fc8=_['merge']({},_0x255fc8,_0x325dd7[_0x72f5('0x52')]);return _0xf123d6[_0x72f5('0x10b')](_0x255fc8);}})[_0x72f5('0x35')](function(_0x4472fb){if(_0x4472fb){_0x4c0369=_0x4472fb[_0x72f5('0x48')];if(!_0x325dd7[_0x72f5('0x44')]['hasOwnProperty'](_0x72f5('0x4a'))){_0x255fc8[_0x72f5('0x4b')]=qs[_0x72f5('0x4b')](_0x325dd7[_0x72f5('0x44')][_0x72f5('0x4b')]);_0x255fc8[_0x72f5('0x2f')]=qs['offset'](_0x325dd7[_0x72f5('0x44')][_0x72f5('0x2f')]);}return _0xf123d6['getApplications'](_0x255fc8);}})['then'](function(_0x5583ff){if(_0x5583ff){return _0x5583ff?{'count':_0x4c0369,'rows':_0x5583ff}:null;}})['then'](respondWithResult(_0x3b510e,null))[_0x72f5('0x2a')](handleError(_0x3b510e,null));};exports['addProactiveActions']=function(_0x1f1a4e,_0x556bd7,_0x433642){return db[_0x72f5('0x10c')][_0x72f5('0x5a')]({'where':{'id':_0x1f1a4e[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x556bd7,null))[_0x72f5('0x35')](function(_0x500901){if(_0x500901){return _0x500901[_0x72f5('0x10d')](_0x1f1a4e[_0x72f5('0x63')][_0x72f5('0x69')],_['omit'](_0x1f1a4e[_0x72f5('0x63')],[_0x72f5('0x69'),'id'])||{});}})[_0x72f5('0x35')](respondWithResult(_0x556bd7,null))[_0x72f5('0x2a')](handleError(_0x556bd7,null));};exports[_0x72f5('0x10e')]=function(_0x3ef988,_0x50c162,_0x55828e){var _0x39576c={};var _0x10fe71={};var _0xa8fde2;var _0x269015;return db['ChatWebsite'][_0x72f5('0x66')]({'where':{'id':_0x3ef988['params']['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x50c162,null))[_0x72f5('0x35')](function(_0x424945){if(_0x424945){_0xa8fde2=_0x424945;_0x10fe71['model']=_[_0x72f5('0x45')](db[_0x72f5('0x10f')][_0x72f5('0x58')]);_0x10fe71[_0x72f5('0x44')]=_[_0x72f5('0x45')](_0x3ef988[_0x72f5('0x44')]);_0x10fe71[_0x72f5('0x4e')]=_[_0x72f5('0x59')](_0x10fe71[_0x72f5('0x43')],_0x10fe71['query']);_0x39576c[_0x72f5('0x46')]=_[_0x72f5('0x59')](_0x10fe71['model'],qs[_0x72f5('0x47')](_0x3ef988[_0x72f5('0x44')][_0x72f5('0x47')]));_0x39576c[_0x72f5('0x46')]=_0x39576c[_0x72f5('0x46')][_0x72f5('0x48')]?_0x39576c[_0x72f5('0x46')]:_0x10fe71[_0x72f5('0x43')];_0x39576c[_0x72f5('0x67')]=qs[_0x72f5('0x4c')](_0x3ef988['query'][_0x72f5('0x4c')]);_0x39576c[_0x72f5('0x4d')]=qs[_0x72f5('0x4e')](_[_0x72f5('0x4f')](_0x3ef988['query'],_0x10fe71[_0x72f5('0x4e')]));if(_0x3ef988[_0x72f5('0x44')][_0x72f5('0x50')]){_0x39576c[_0x72f5('0x4d')]=_['merge'](_0x39576c[_0x72f5('0x4d')],{'$or':_['map'](_0x39576c[_0x72f5('0x46')],function(_0x40669c){var _0x14c21a={};_0x14c21a[_0x40669c]={'$like':'%'+_0x3ef988['query']['filter']+'%'};return _0x14c21a;})});}_0x39576c=_[_0x72f5('0x51')]({},_0x39576c,_0x3ef988[_0x72f5('0x52')]);return _0xa8fde2['getProactiveActions'](_0x39576c);}})[_0x72f5('0x35')](function(_0x53e363){if(_0x53e363){_0x269015=_0x53e363[_0x72f5('0x48')];if(!_0x3ef988[_0x72f5('0x44')]['hasOwnProperty'](_0x72f5('0x4a'))){_0x39576c[_0x72f5('0x4b')]=qs['limit'](_0x3ef988[_0x72f5('0x44')][_0x72f5('0x4b')]);_0x39576c['offset']=qs[_0x72f5('0x2f')](_0x3ef988[_0x72f5('0x44')][_0x72f5('0x2f')]);}return _0xa8fde2[_0x72f5('0x10e')](_0x39576c);}})['then'](function(_0x5b92e2){if(_0x5b92e2){return _0x5b92e2?{'count':_0x269015,'rows':_0x5b92e2}:null;}})['then'](respondWithResult(_0x50c162,null))[_0x72f5('0x2a')](handleError(_0x50c162,null));};exports[_0x72f5('0x110')]=function(_0x46c220,_0x3285e1,_0x22d532){var _0x2caf57=_0x46c220[_0x72f5('0x44')][_0x72f5('0x111')]==='false'?_0x72f5('0x112'):_0x72f5('0x113');return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'attributes':['id',_0x2caf57],'where':{'id':_0x46c220[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x3285e1,null))[_0x72f5('0x35')](function(_0x463784){if(_0x463784){var _0x4169df=_0x463784[_0x2caf57];var _0x5d4bf0=_0x4169df&&_0x4169df['items']?_0x4169df[_0x72f5('0x114')]:[];_0x3285e1['send']({'fromKey':_[_0x72f5('0x7a')](_0x4169df[_0x72f5('0x115')])?undefined:_0x4169df['fromKey'],'count':_0x5d4bf0[_0x72f5('0x48')],'rows':_0x5d4bf0});}})['catch'](handleError(_0x3285e1,null));};exports[_0x72f5('0x116')]=function(_0x4d5241,_0x4ed235,_0x3cc578){var _0x3abafd={'raw':![],'where':{}};var _0x17ac70={};var _0x2672cc={'count':0x0,'rows':[]};return db[_0x72f5('0x3f')][_0x72f5('0x66')]({'where':{'id':_0x4d5241[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x4ed235,null))[_0x72f5('0x35')](function(_0x485e0a){if(_0x485e0a){_0x17ac70['model']=_[_0x72f5('0x45')](db[_0x72f5('0xcf')][_0x72f5('0x58')]);_0x17ac70[_0x72f5('0x44')]=_['keys'](_0x4d5241[_0x72f5('0x44')]);_0x17ac70['filters']=_[_0x72f5('0x59')](_0x17ac70[_0x72f5('0x43')],_0x17ac70[_0x72f5('0x44')]);_0x3abafd[_0x72f5('0x46')]=_[_0x72f5('0x59')](_0x17ac70[_0x72f5('0x43')],qs[_0x72f5('0x47')](_0x4d5241[_0x72f5('0x44')][_0x72f5('0x47')]));_0x3abafd[_0x72f5('0x46')]=_0x3abafd[_0x72f5('0x46')][_0x72f5('0x48')]?_0x3abafd[_0x72f5('0x46')]:_0x17ac70[_0x72f5('0x43')];if(!_0x4d5241[_0x72f5('0x44')]['hasOwnProperty'](_0x72f5('0x4a'))){_0x3abafd['limit']=qs['limit'](_0x4d5241['query']['limit']);_0x3abafd['offset']=qs[_0x72f5('0x2f')](_0x4d5241[_0x72f5('0x44')][_0x72f5('0x2f')]);}_0x3abafd[_0x72f5('0x67')]=qs[_0x72f5('0x4c')](_0x4d5241[_0x72f5('0x44')][_0x72f5('0x4c')]);_0x3abafd[_0x72f5('0x4d')]=qs[_0x72f5('0x4e')](_['pick'](_0x4d5241['query'],_0x17ac70['filters']));_0x3abafd[_0x72f5('0x4d')][_0x72f5('0x6a')]=_0x485e0a['id'];if(_0x4d5241[_0x72f5('0x44')][_0x72f5('0x50')]){_0x3abafd[_0x72f5('0x4d')]=_[_0x72f5('0x51')](_0x3abafd[_0x72f5('0x4d')],{'$or':_[_0x72f5('0x3e')](_0x3abafd[_0x72f5('0x46')],function(_0x55d75a){var _0x2921e6={};_0x2921e6[_0x55d75a]={'$like':'%'+_0x4d5241[_0x72f5('0x44')][_0x72f5('0x50')]+'%'};return _0x2921e6;})});}_0x3abafd=_[_0x72f5('0x51')]({},_0x3abafd,_0x4d5241[_0x72f5('0x52')]);return db[_0x72f5('0xcf')][_0x72f5('0x2e')]({'where':_0x3abafd[_0x72f5('0x4d')]})[_0x72f5('0x35')](function(_0x41b716){_0x2672cc['count']=_0x41b716;if(_0x4d5241['query'][_0x72f5('0x53')]){_0x3abafd[_0x72f5('0x54')]=[{'all':!![]}];}else{_0x3abafd[_0x72f5('0x54')]=[{'model':db[_0x72f5('0x8c')],'as':_0x72f5('0xe1'),'required':![]}];}return db['ChatOfflineMessage'][_0x72f5('0x55')](_0x3abafd);})[_0x72f5('0x35')](function(_0x2e2e5f){_0x2672cc[_0x72f5('0x56')]=_0x2e2e5f;return _0x2672cc;});}})[_0x72f5('0x35')](respondWithFilteredResult(_0x4ed235,_0x3abafd))[_0x72f5('0x2a')](handleError(_0x4ed235,null));};exports[_0x72f5('0x117')]=function(_0xf2b1f1,_0x17bf05,_0x5e2040){return db[_0x72f5('0x3f')]['find']({'where':{'id':_0xf2b1f1[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x17bf05,null))['then'](function(_0xe1b626){if(_0xe1b626){return _0xe1b626['addAgents'](_0xf2b1f1[_0x72f5('0x63')][_0x72f5('0x69')],_[_0x72f5('0xdf')](_0xf2b1f1[_0x72f5('0x63')],[_0x72f5('0x69'),'id'])||{})[_0x72f5('0xb6')](function(_0x4b3565){for(var _0x296f74=0x0;_0x296f74<_0xf2b1f1[_0x72f5('0x63')]['ids'][_0x72f5('0x48')];_0x296f74+=0x1){socket[_0x72f5('0x118')](_0x72f5('0x119'),{'UserId':_0xf2b1f1['body'][_0x72f5('0x69')][_0x296f74],'ChatWebsiteId':_0xf2b1f1[_0x72f5('0x57')]['id']});}return _0x4b3565;});}})[_0x72f5('0x35')](respondWithResult(_0x17bf05,null))['catch'](handleError(_0x17bf05,null));};exports['removeAgents']=function(_0xa21a1,_0x332d6f,_0x134e62){return db[_0x72f5('0x3f')][_0x72f5('0x5a')]({'where':{'id':_0xa21a1[_0x72f5('0x57')]['id']}})[_0x72f5('0x35')](handleEntityNotFound(_0x332d6f,null))[_0x72f5('0x35')](function(_0x3e1c8b){if(_0x3e1c8b){return _0x3e1c8b['removeAgents'](_0xa21a1['query']['ids'])[_0x72f5('0x35')](function(){if(_[_0x72f5('0x11a')](_0xa21a1[_0x72f5('0x44')][_0x72f5('0x69')])){for(var _0x43d62e=0x0;_0x43d62e<_0xa21a1[_0x72f5('0x44')]['ids'][_0x72f5('0x48')];_0x43d62e+=0x1){socket[_0x72f5('0x118')](_0x72f5('0x11b'),{'UserId':Number(_0xa21a1[_0x72f5('0x44')][_0x72f5('0x69')][_0x43d62e]),'ChatWebsiteId':Number(_0xa21a1[_0x72f5('0x57')]['id'])});}}else{socket[_0x72f5('0x118')](_0x72f5('0x11b'),{'UserId':Number(_0xa21a1[_0x72f5('0x44')][_0x72f5('0x69')]),'ChatWebsiteId':Number(_0xa21a1['params']['id'])});}});}})['then'](respondWithStatusCode(_0x332d6f,null))[_0x72f5('0x2a')](handleError(_0x332d6f,null));};exports[_0x72f5('0x11c')]=function(_0xc6c9ab,_0x45ce3c,_0x265c4d){var _0x4bd144={};var _0x2cf231={};var _0x10d899;var _0x112c75;return db['ChatWebsite'][_0x72f5('0x66')]({'where':{'id':_0xc6c9ab['params']['id']}})['then'](handleEntityNotFound(_0x45ce3c,null))[_0x72f5('0x35')](function(_0xcfd23d){if(_0xcfd23d){_0x10d899=_0xcfd23d;_0x2cf231[_0x72f5('0x43')]=_[_0x72f5('0x45')](db['User'][_0x72f5('0x58')]);_0x2cf231[_0x72f5('0x44')]=_['keys'](_0xc6c9ab[_0x72f5('0x44')]);_0x2cf231[_0x72f5('0x4e')]=_[_0x72f5('0x59')](_0x2cf231[_0x72f5('0x43')],_0x2cf231[_0x72f5('0x44')]);_0x4bd144[_0x72f5('0x46')]=_['intersection'](_0x2cf231['model'],qs['fields'](_0xc6c9ab[_0x72f5('0x44')][_0x72f5('0x47')]));_0x4bd144[_0x72f5('0x46')]=_0x4bd144[_0x72f5('0x46')][_0x72f5('0x48')]?_0x4bd144[_0x72f5('0x46')]:_0x2cf231['model'];_0x4bd144['order']=qs[_0x72f5('0x4c')](_0xc6c9ab[_0x72f5('0x44')]['sort']);_0x4bd144[_0x72f5('0x4d')]=qs[_0x72f5('0x4e')](_[_0x72f5('0x4f')](_0xc6c9ab['query'],_0x2cf231['filters']));if(_0xc6c9ab[_0x72f5('0x44')]['filter']){_0x4bd144[_0x72f5('0x4d')]=_[_0x72f5('0x51')](_0x4bd144[_0x72f5('0x4d')],{'$or':_[_0x72f5('0x3e')](_0x4bd144[_0x72f5('0x46')],function(_0x38301c){var _0x2b7fd9={};_0x2b7fd9[_0x38301c]={'$like':'%'+_0xc6c9ab['query'][_0x72f5('0x50')]+'%'};return _0x2b7fd9;})});}_0x4bd144=_[_0x72f5('0x51')]({},_0x4bd144,_0xc6c9ab['options']);return _0x10d899[_0x72f5('0x11c')](_0x4bd144);}})[_0x72f5('0x35')](function(_0xbbabff){if(_0xbbabff){_0x112c75=_0xbbabff['length'];if(!_0xc6c9ab[_0x72f5('0x44')][_0x72f5('0x49')](_0x72f5('0x4a'))){_0x4bd144['limit']=qs['limit'](_0xc6c9ab[_0x72f5('0x44')][_0x72f5('0x4b')]);_0x4bd144[_0x72f5('0x2f')]=qs[_0x72f5('0x2f')](_0xc6c9ab['query'][_0x72f5('0x2f')]);}return _0x10d899['getAgents'](_0x4bd144);}})[_0x72f5('0x35')](function(_0x28fe0f){if(_0x28fe0f){return _0x28fe0f?{'count':_0x112c75,'rows':_0x28fe0f}:null;}})[_0x72f5('0x35')](respondWithResult(_0x45ce3c,null))['catch'](handleError(_0x45ce3c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 1d5e1d0..8b1a0c5 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 _0x7b47=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2bba14,_0x463a51){var _0x308039=function(_0x32a3da){while(--_0x32a3da){_0x2bba14['push'](_0x2bba14['shift']());}};_0x308039(++_0x463a51);}(_0x7b47,0x118));var _0x77b4=function(_0x3c9017,_0x1241c1){_0x3c9017=_0x3c9017-0x0;var _0x489f02=_0x7b47[_0x3c9017];return _0x489f02;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x77b4('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x77b4('0x1')](0x0);var events={'afterCreate':_0x77b4('0x2'),'afterUpdate':_0x77b4('0x3'),'afterDestroy':_0x77b4('0x4')};function emitEvent(_0x5257c1){return function(_0x3dd6f5,_0x55c9b4,_0x23f1f6){ChatWebsiteEvents[_0x77b4('0x5')](_0x5257c1+':'+_0x3dd6f5['id'],_0x3dd6f5);ChatWebsiteEvents[_0x77b4('0x5')](_0x5257c1,_0x3dd6f5);_0x23f1f6(null);};}for(var e in events){if(events[_0x77b4('0x6')](e)){var event=events[e];ChatWebsite[_0x77b4('0x7')](e,emitEvent(event));}}module[_0x77b4('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x86f4=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x86f4,0x18a));var _0x486f=function(_0x279bf3,_0x498d42){_0x279bf3=_0x279bf3-0x0;var _0x2d8685=_0x86f4[_0x279bf3];return _0x2d8685;};'use strict';var EventEmitter=require(_0x486f('0x0'));var ChatWebsite=require(_0x486f('0x1'))['db'][_0x486f('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x486f('0x3')](0x0);var events={'afterCreate':_0x486f('0x4'),'afterUpdate':_0x486f('0x5'),'afterDestroy':_0x486f('0x6')};function emitEvent(_0x53305d){return function(_0xf8d50f,_0x1539b1,_0x583729){ChatWebsiteEvents[_0x486f('0x7')](_0x53305d+':'+_0xf8d50f['id'],_0xf8d50f);ChatWebsiteEvents[_0x486f('0x7')](_0x53305d,_0xf8d50f);_0x583729(null);};}for(var e in events){if(events[_0x486f('0x8')](e)){var event=events[e];ChatWebsite[_0x486f('0x9')](e,emitEvent(event));}}module[_0x486f('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 5dbea93..41bfc9e 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 _0x4ea3=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','bluebird','path','./chatWebsite.attributes','exports','define'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0x4ea3,0x70));var _0x34ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4ea3[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var moment=require('moment');var BPromise=require(_0x34ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ea('0x6'));module[_0x34ea('0x7')]=function(_0x962596,_0x123d48){return _0x962596[_0x34ea('0x8')](_0x34ea('0x9'),attributes,{'tableName':_0x34ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa44a=['rimraf','exports','define','chat_websites','lodash','api','moment','bluebird','request-promise','path'];(function(_0x5848b7,_0x42f972){var _0x22ab05=function(_0x1f7cb3){while(--_0x1f7cb3){_0x5848b7['push'](_0x5848b7['shift']());}};_0x22ab05(++_0x42f972);}(_0xa44a,0x9a));var _0xaa44=function(_0x149635,_0x5ad796){_0x149635=_0x149635-0x0;var _0x3ec953=_0xa44a[_0x149635];return _0x3ec953;};'use strict';var _=require(_0xaa44('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa44('0x1'));var moment=require(_0xaa44('0x2'));var BPromise=require(_0xaa44('0x3'));var rp=require(_0xaa44('0x4'));var fs=require('fs');var path=require(_0xaa44('0x5'));var rimraf=require(_0xaa44('0x6'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0xaa44('0x7')]=function(_0x39a3f6,_0x4979e3){return _0x39a3f6[_0xaa44('0x8')]('ChatWebsite',attributes,{'tableName':_0xaa44('0x9'),'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 1610e9d..87d5ed0 100644 --- a/server/api/chatWebsite/chatWebsite.rpc.js +++ b/server/api/chatWebsite/chatWebsite.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c3c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util'];(function(_0x23639b,_0x45f15e){var _0x6b0cca=function(_0x4af5d9){while(--_0x4af5d9){_0x23639b['push'](_0x23639b['shift']());}};_0x6b0cca(++_0x45f15e);}(_0x5c3c,0x132));var _0xc5c3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5c3c[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc5c3('0xd'),'port':0x18eb});var socket=require(_0xc5c3('0xe'))(new Redis(config['redis']));require(_0xc5c3('0xf'))[_0xc5c3('0x10')](socket);function respondWithRpcPromise(_0x52f3eb,_0x14140f,_0x2a1d19){return new BPromise(function(_0x4e329f,_0x1f2e34){return client[_0xc5c3('0x11')](_0x52f3eb,_0x2a1d19)[_0xc5c3('0x12')](function(_0x59fb60){logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,'request\x20sent');logger[_0xc5c3('0x15')](_0xc5c3('0x16'),_0x14140f,_0xc5c3('0x17'),JSON['stringify'](_0x59fb60));if(_0x59fb60[_0xc5c3('0x18')]){if(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x1f2e34(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x1a')]);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x4e329f(_0x59fb60[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,_0xc5c3('0x17'));_0x4e329f(_0x59fb60[_0xc5c3('0x1b')][_0xc5c3('0x1a')]);}})['catch'](function(_0x364f42){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x364f42);_0x1f2e34(_0x364f42);});});} \ No newline at end of file +var _0x1a37=['rpc','jayson/promise','http','redis','defaults','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb9d880,_0x5c83f4){var _0x1a9d6f=function(_0x49cfcf){while(--_0x49cfcf){_0xb9d880['push'](_0xb9d880['shift']());}};_0x1a9d6f(++_0x5c83f4);}(_0x1a37,0xb4));var _0x71a3=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x1a37[_0x543084];return _0x306a57;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});config[_0x71a3('0xc')]=_[_0x71a3('0xd')](config[_0x71a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x71a3('0xe')](socket);function respondWithRpcPromise(_0x18320a,_0x3709bc,_0x3aeb48){return new BPromise(function(_0x3a7fc1,_0x2215f2){return client[_0x71a3('0xf')](_0x18320a,_0x3aeb48)[_0x71a3('0x10')](function(_0x5c464c){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x71a3('0x11'));logger[_0x71a3('0x12')](_0x71a3('0x13'),_0x3709bc,_0x71a3('0x11'),JSON[_0x71a3('0x14')](_0x5c464c));if(_0x5c464c[_0x71a3('0x15')]){if(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x16')]===0x1f4){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5c464c[_0x71a3('0x15')]['message']);return _0x2215f2(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);return _0x3a7fc1(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}else{logger[_0x71a3('0x19')](_0x71a3('0x17'),_0x3709bc,'request\x20sent');_0x3a7fc1(_0x5c464c[_0x71a3('0x1a')][_0x71a3('0x18')]);}})['catch'](function(_0x5f4562){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5f4562);_0x2215f2(_0x5f4562);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 342e538..8a00673 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x51244e,_0x24c7e6){var _0x58d71c=function(_0x3a8ea5){while(--_0x3a8ea5){_0x51244e['push'](_0x51244e['shift']());}};_0x58d71c(++_0x24c7e6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5402f4,_0x2d0eab){_0x5402f4=_0x5402f4-0x0;var _0x1aaa2f=_0x5f2f[_0x5402f4];return _0x1aaa2f;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x595086,_0x41b5da){var _0x143cb5=function(_0x56a6e){while(--_0x56a6e){_0x595086['push'](_0x595086['shift']());}};_0x143cb5(++_0x41b5da);}(_0x7a54,0x106));var _0x47a5=function(_0x58640b,_0x2b1c2b){_0x58640b=_0x58640b-0x0;var _0x2e88ae=_0x7a54[_0x58640b];return _0x2e88ae;};'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 da8396d..ea42520 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 _0x6ee1=['server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','addLogo','root','server/files/images/avatars/','file','/:id/notify','notify','offline','addInteraction','addProactiveActions','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join'];(function(_0x22420f,_0x536255){var _0x4204b0=function(_0x4c3a14){while(--_0x4c3a14){_0x22420f['push'](_0x22420f['shift']());}};_0x4204b0(++_0x536255);}(_0x6ee1,0x16c));var _0x16ee=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x6ee1[_0x385c76];return _0x5c8367;};'use strict';var multer=require(_0x16ee('0x0'));var util=require(_0x16ee('0x1'));var path=require('path');var timeout=require(_0x16ee('0x2'));var express=require(_0x16ee('0x3'));var router=express[_0x16ee('0x4')]();var auth=require(_0x16ee('0x5'));var interaction=require(_0x16ee('0x6'));var config=require(_0x16ee('0x7'));var controller=require(_0x16ee('0x8'));router[_0x16ee('0x9')]('/',auth[_0x16ee('0xa')](),controller[_0x16ee('0xb')]);router[_0x16ee('0x9')]('/describe',auth[_0x16ee('0xa')](),controller[_0x16ee('0xc')]);router[_0x16ee('0x9')](_0x16ee('0xd'),auth['isAuthenticated'](),controller[_0x16ee('0xe')]);router[_0x16ee('0x9')](_0x16ee('0xf'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x10')]);router['get'](_0x16ee('0x11'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x12')]);router[_0x16ee('0x9')]('/:id/logo',controller[_0x16ee('0x13')]);router[_0x16ee('0x9')](_0x16ee('0x14'),controller['getAvatar']);router[_0x16ee('0x9')](_0x16ee('0x15'),controller[_0x16ee('0x16')]);router[_0x16ee('0x9')](_0x16ee('0x17'),controller[_0x16ee('0x18')]);router[_0x16ee('0x9')](_0x16ee('0x19'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x1a')]);router['get'](_0x16ee('0x1b'),controller[_0x16ee('0x1c')]);router[_0x16ee('0x9')](_0x16ee('0x1d'),auth['isAuthenticated'](),controller[_0x16ee('0x1e')]);router[_0x16ee('0x9')](_0x16ee('0x1f'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x20')]);router[_0x16ee('0x9')](_0x16ee('0x21'),controller[_0x16ee('0x22')]);router['get']('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x16ee('0x23')]);router[_0x16ee('0x9')](_0x16ee('0x24'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x25')]);router[_0x16ee('0x26')]('/',auth['isAuthenticated'](),controller[_0x16ee('0x27')]);router['post'](_0x16ee('0xf'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x28')]);router[_0x16ee('0x26')](_0x16ee('0x11'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x29')]);var upload=multer({'storage':multer[_0x16ee('0x2a')]({'destination':function(_0x3aaf15,_0x47b123,_0x4eb430){_0x4eb430(null,path[_0x16ee('0x2b')](config['root'],_0x16ee('0x2c')));},'filename':function(_0x5bb448,_0x3da784,_0x38ed95){_0x38ed95(null,util[_0x16ee('0x2d')](_0x16ee('0x2e'),Date[_0x16ee('0x2f')](),_0x3da784[_0x16ee('0x30')]));}})});router[_0x16ee('0x26')](_0x16ee('0x31'),upload[_0x16ee('0x32')]('file'),controller[_0x16ee('0x33')]);var upload=multer({'storage':multer[_0x16ee('0x2a')]({'destination':function(_0x99edb3,_0x10ef73,_0x3ba5e7){_0x3ba5e7(null,path[_0x16ee('0x2b')](config[_0x16ee('0x34')],_0x16ee('0x35')));},'filename':function(_0x327d1d,_0x48b529,_0x4d936a){_0x4d936a(null,util['format'](_0x16ee('0x2e'),Date[_0x16ee('0x2f')](),_0x48b529[_0x16ee('0x30')]));}})});router[_0x16ee('0x26')](_0x16ee('0x14'),upload['single']('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2bf91f,_0x3b5026,_0x33944f){_0x33944f(null,path[_0x16ee('0x2b')](config['root'],_0x16ee('0x35')));},'filename':function(_0x89e790,_0x523433,_0x2edf76){_0x2edf76(null,util[_0x16ee('0x2d')](_0x16ee('0x2e'),Date[_0x16ee('0x2f')](),_0x523433[_0x16ee('0x30')]));}})});router[_0x16ee('0x26')](_0x16ee('0x15'),upload[_0x16ee('0x32')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x16ee('0x2a')]({'destination':function(_0x1b2826,_0x5959ac,_0x10434d){_0x10434d(null,path[_0x16ee('0x2b')](config[_0x16ee('0x34')],'server/files/images/avatars/'));},'filename':function(_0x2c5376,_0x212ceb,_0x33dc6b){_0x33dc6b(null,util[_0x16ee('0x2d')](_0x16ee('0x2e'),Date[_0x16ee('0x2f')](),_0x212ceb[_0x16ee('0x30')]));}})});router['post'](_0x16ee('0x17'),upload['single'](_0x16ee('0x36')),controller['addSystemAvatar']);router[_0x16ee('0x26')](_0x16ee('0x37'),controller[_0x16ee('0x38')]);router[_0x16ee('0x26')]('/:id/offline',controller[_0x16ee('0x39')]);router['post'](_0x16ee('0x19'),auth['isAuthenticated'](),controller[_0x16ee('0x3a')]);router[_0x16ee('0x26')](_0x16ee('0x1d'),auth['isAuthenticated'](),controller['addApplications']);router[_0x16ee('0x26')](_0x16ee('0x1f'),auth['isAuthenticated'](),controller[_0x16ee('0x3b')]);router[_0x16ee('0x26')](_0x16ee('0x24'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x3c')]);router[_0x16ee('0x3d')](_0x16ee('0xd'),auth[_0x16ee('0xa')](),controller['update']);router[_0x16ee('0x3e')](_0x16ee('0xd'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x3f')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x16ee('0x40')]);router['delete']('/:id/canned_answers',auth[_0x16ee('0xa')](),controller[_0x16ee('0x41')]);router[_0x16ee('0x3e')](_0x16ee('0x24'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x42')]);module[_0x16ee('0x43')]=router; \ No newline at end of file +var _0x095f=['/:id/proactive_actions','getProactiveActions','getFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','join','root','format','%s-%s','now','originalname','file','addLogo','single','addAvatar','diskStorage','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','/:id','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','getApplications'];(function(_0x1b2944,_0x5d1ca4){var _0x25e677=function(_0x5558a5){while(--_0x5558a5){_0x1b2944['push'](_0x1b2944['shift']());}};_0x25e677(++_0x5d1ca4);}(_0x095f,0x6e));var _0xf095=function(_0x3626fe,_0xc971fc){_0x3626fe=_0x3626fe-0x0;var _0x19e511=_0x095f[_0x3626fe];return _0x19e511;};'use strict';var multer=require(_0xf095('0x0'));var util=require(_0xf095('0x1'));var path=require(_0xf095('0x2'));var timeout=require(_0xf095('0x3'));var express=require(_0xf095('0x4'));var router=express[_0xf095('0x5')]();var auth=require(_0xf095('0x6'));var interaction=require(_0xf095('0x7'));var config=require(_0xf095('0x8'));var controller=require(_0xf095('0x9'));router[_0xf095('0xa')]('/',auth[_0xf095('0xb')](),controller[_0xf095('0xc')]);router[_0xf095('0xa')](_0xf095('0xd'),auth[_0xf095('0xb')](),controller[_0xf095('0xe')]);router[_0xf095('0xa')]('/:id',auth[_0xf095('0xb')](),controller[_0xf095('0xf')]);router[_0xf095('0xa')]('/:id/dispositions',auth[_0xf095('0xb')](),controller[_0xf095('0x10')]);router[_0xf095('0xa')](_0xf095('0x11'),auth[_0xf095('0xb')](),controller[_0xf095('0x12')]);router[_0xf095('0xa')](_0xf095('0x13'),controller[_0xf095('0x14')]);router[_0xf095('0xa')](_0xf095('0x15'),controller[_0xf095('0x16')]);router[_0xf095('0xa')](_0xf095('0x17'),controller['getCustomerAvatar']);router[_0xf095('0xa')](_0xf095('0x18'),controller[_0xf095('0x19')]);router[_0xf095('0xa')](_0xf095('0x1a'),auth[_0xf095('0xb')](),controller[_0xf095('0x1b')]);router[_0xf095('0xa')]('/:id/snippet',controller[_0xf095('0x1c')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xf095('0x1d')]);router[_0xf095('0xa')](_0xf095('0x1e'),auth[_0xf095('0xb')](),controller[_0xf095('0x1f')]);router[_0xf095('0xa')]('/:id/fields',controller[_0xf095('0x20')]);router['get']('/:id/offline_messages',auth[_0xf095('0xb')](),controller['getOfflineMessages']);router[_0xf095('0xa')](_0xf095('0x21'),auth[_0xf095('0xb')](),controller[_0xf095('0x22')]);router[_0xf095('0x23')]('/',auth[_0xf095('0xb')](),controller['create']);router[_0xf095('0x23')](_0xf095('0x24'),auth['isAuthenticated'](),controller[_0xf095('0x25')]);router[_0xf095('0x23')]('/:id/canned_answers',auth[_0xf095('0xb')](),controller[_0xf095('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2f56c2,_0x17ea8e,_0x4bd799){_0x4bd799(null,path[_0xf095('0x27')](config[_0xf095('0x28')],'server/files/images/logos/'));},'filename':function(_0x1692fd,_0x3ec3ab,_0x5ef01d){_0x5ef01d(null,util[_0xf095('0x29')](_0xf095('0x2a'),Date[_0xf095('0x2b')](),_0x3ec3ab[_0xf095('0x2c')]));}})});router[_0xf095('0x23')]('/:id/logo',upload['single'](_0xf095('0x2d')),controller[_0xf095('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x57e043,_0x2d402a,_0x170620){_0x170620(null,path[_0xf095('0x27')](config[_0xf095('0x28')],'server/files/images/avatars/'));},'filename':function(_0x20d440,_0x32d358,_0x250213){_0x250213(null,util[_0xf095('0x29')]('%s-%s',Date[_0xf095('0x2b')](),_0x32d358[_0xf095('0x2c')]));}})});router[_0xf095('0x23')](_0xf095('0x15'),upload[_0xf095('0x2f')](_0xf095('0x2d')),controller[_0xf095('0x30')]);var upload=multer({'storage':multer[_0xf095('0x31')]({'destination':function(_0x47d7c9,_0x549dd7,_0x32ff40){_0x32ff40(null,path['join'](config[_0xf095('0x28')],_0xf095('0x32')));},'filename':function(_0xb08cd3,_0x5c7f8a,_0x510a3f){_0x510a3f(null,util[_0xf095('0x29')](_0xf095('0x2a'),Date[_0xf095('0x2b')](),_0x5c7f8a[_0xf095('0x2c')]));}})});router['post'](_0xf095('0x17'),upload[_0xf095('0x2f')](_0xf095('0x2d')),controller[_0xf095('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d2c71,_0x21683b,_0xe8597a){_0xe8597a(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4e8642,_0x50e592,_0x5b1423){_0x5b1423(null,util[_0xf095('0x29')]('%s-%s',Date['now'](),_0x50e592[_0xf095('0x2c')]));}})});router[_0xf095('0x23')](_0xf095('0x18'),upload[_0xf095('0x2f')](_0xf095('0x2d')),controller[_0xf095('0x34')]);router[_0xf095('0x23')](_0xf095('0x35'),controller[_0xf095('0x36')]);router[_0xf095('0x23')](_0xf095('0x37'),controller[_0xf095('0x38')]);router[_0xf095('0x23')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf095('0x39')]);router['post'](_0xf095('0x3a'),auth[_0xf095('0xb')](),controller[_0xf095('0x3b')]);router['post'](_0xf095('0x1e'),auth[_0xf095('0xb')](),controller[_0xf095('0x3c')]);router[_0xf095('0x23')]('/:id/users',auth[_0xf095('0xb')](),controller[_0xf095('0x3d')]);router[_0xf095('0x3e')]('/:id',auth[_0xf095('0xb')](),controller[_0xf095('0x3f')]);router[_0xf095('0x40')](_0xf095('0x41'),auth[_0xf095('0xb')](),controller['destroy']);router['delete'](_0xf095('0x24'),auth[_0xf095('0xb')](),controller[_0xf095('0x42')]);router[_0xf095('0x40')](_0xf095('0x11'),auth[_0xf095('0xb')](),controller[_0xf095('0x43')]);router[_0xf095('0x40')](_0xf095('0x21'),auth['isAuthenticated'](),controller[_0xf095('0x44')]);module[_0xf095('0x45')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index cdc63e9..5a7283e 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 _0x8b8e=['sequelize','STRING','AmazonAWS'];(function(_0x524916,_0x3394bb){var _0xbc2dac=function(_0x1d6840){while(--_0x1d6840){_0x524916['push'](_0x524916['shift']());}};_0xbc2dac(++_0x3394bb);}(_0x8b8e,0x108));var _0xe8b8=function(_0x3f86aa,_0x306778){_0x3f86aa=_0x3f86aa-0x0;var _0x5e60e1=_0x8b8e[_0x3f86aa];return _0x5e60e1;};'use strict';var Sequelize=require(_0xe8b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xe8b8('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xe8b8('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xe8b8('0x1')]}}; \ No newline at end of file +var _0x8958=['STRING','exports'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x8958,0x93));var _0x8895=function(_0xa9b556,_0x4b4afc){_0xa9b556=_0xa9b556-0x0;var _0x1dfb34=_0x8958[_0xa9b556];return _0x1dfb34;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS','Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x8895('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 22ce4a6..73f150d 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 _0x72a8=['body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','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','save','update','then','destroy','error','stack','name','send','index','CloudProvider','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','VIRTUAL','filter','options','where','includeAll','rows','catch','show','params','fields','include','merge','find','create'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x72a8,0x182));var _0x872a=function(_0x3ab565,_0x93c0c1){_0x3ab565=_0x3ab565-0x0;var _0x3f01a9=_0x72a8[_0x3ab565];return _0x3f01a9;};'use strict';var pdf=require(_0x872a('0x0'));var emlformat=require(_0x872a('0x1'));var rimraf=require(_0x872a('0x2'));var zipdir=require(_0x872a('0x3'));var jsonpatch=require(_0x872a('0x4'));var rp=require(_0x872a('0x5'));var moment=require(_0x872a('0x6'));var BPromise=require(_0x872a('0x7'));var Mustache=require(_0x872a('0x8'));var util=require('util');var path=require(_0x872a('0x9'));var sox=require(_0x872a('0xa'));var csv=require('to-csv');var ejs=require(_0x872a('0xb'));var fs=require('fs');var _=require(_0x872a('0xc'));var squel=require(_0x872a('0xd'));var crypto=require(_0x872a('0xe'));var jsforce=require(_0x872a('0xf'));var deskjs=require(_0x872a('0x10'));var toCsv=require(_0x872a('0x11'));var querystring=require(_0x872a('0x12'));var Papa=require('papaparse');var Redis=require(_0x872a('0x13'));var authService=require(_0x872a('0x14'));var qs=require(_0x872a('0x15'));var as=require(_0x872a('0x16'));var hardwareService=require(_0x872a('0x17'));var logger=require(_0x872a('0x18'))(_0x872a('0x19'));var utils=require(_0x872a('0x1a'));var config=require(_0x872a('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54ec3c,_0x18dedb){_0x18dedb=_0x18dedb||0xcc;return function(_0x4da851){if(_0x4da851){return _0x54ec3c[_0x872a('0x1c')](_0x18dedb);}return _0x54ec3c[_0x872a('0x1d')](_0x18dedb)[_0x872a('0x1e')]();};}function respondWithResult(_0x220fdd,_0x5d51f0){_0x5d51f0=_0x5d51f0||0xc8;return function(_0x1e1f2f){if(_0x1e1f2f){return _0x220fdd[_0x872a('0x1d')](_0x5d51f0)[_0x872a('0x1f')](_0x1e1f2f);}};}function respondWithFilteredResult(_0x18e5b7,_0xb3f3d3){return function(_0x5cd129){if(_0x5cd129){var _0x28f44f=_0x5cd129[_0x872a('0x20')],_0x61c957=_0xb3f3d3[_0x872a('0x21')],_0x444f36=_0xb3f3d3[_0x872a('0x21')]+_0xb3f3d3[_0x872a('0x22')],_0x29f018;if(_0x444f36>=_0x28f44f){_0x444f36=_0x28f44f;_0x29f018=0xc8;}else{_0x29f018=0xce;}_0x18e5b7[_0x872a('0x1d')](_0x29f018);return _0x18e5b7[_0x872a('0x23')](_0x872a('0x24'),_0x61c957+'-'+_0x444f36+'/'+_0x28f44f)['json'](_0x5cd129);}return null;};}function patchUpdates(_0x25bf81){return function(_0x2ff51d){try{jsonpatch[_0x872a('0x25')](_0x2ff51d,_0x25bf81,!![]);}catch(_0x117363){return BPromise['reject'](_0x117363);}return _0x2ff51d[_0x872a('0x26')]();};}function saveUpdates(_0x1f4be5,_0x2c31b6){return function(_0x2a57e0){if(_0x2a57e0){return _0x2a57e0[_0x872a('0x27')](_0x1f4be5)[_0x872a('0x28')](function(_0x40cc2c){return _0x40cc2c;});}return null;};}function removeEntity(_0x51def5,_0x340075){return function(_0x1d9485){if(_0x1d9485){return _0x1d9485[_0x872a('0x29')]()[_0x872a('0x28')](function(){_0x51def5[_0x872a('0x1d')](0xcc)[_0x872a('0x1e')]();});}};}function handleEntityNotFound(_0x1596b7,_0x1c7419){return function(_0x3257a8){if(!_0x3257a8){_0x1596b7[_0x872a('0x1c')](0x194);}return _0x3257a8;};}function handleError(_0x45f6d8,_0x547771){_0x547771=_0x547771||0x1f4;return function(_0x1a2d50){logger[_0x872a('0x2a')](_0x1a2d50[_0x872a('0x2b')]);if(_0x1a2d50[_0x872a('0x2c')]){delete _0x1a2d50[_0x872a('0x2c')];}_0x45f6d8[_0x872a('0x1d')](_0x547771)[_0x872a('0x2d')](_0x1a2d50);};}exports[_0x872a('0x2e')]=function(_0x57eece,_0x27585f){var _0x3df339={},_0x5e0342={},_0x53dda9={'count':0x0,'rows':[]};var _0x28cd4f=_['map'](db[_0x872a('0x2f')][_0x872a('0x30')],function(_0x214f3d){return{'name':_0x214f3d['fieldName'],'type':_0x214f3d[_0x872a('0x31')]['key']};});_0x5e0342[_0x872a('0x32')]=_[_0x872a('0x33')](_0x28cd4f,_0x872a('0x2c'));_0x5e0342[_0x872a('0x34')]=_[_0x872a('0x35')](_0x57eece[_0x872a('0x34')]);_0x5e0342[_0x872a('0x36')]=_[_0x872a('0x37')](_0x5e0342[_0x872a('0x32')],_0x5e0342['query']);_0x3df339['attributes']=_[_0x872a('0x37')](_0x5e0342['model'],qs['fields'](_0x57eece[_0x872a('0x34')]['fields']));_0x3df339[_0x872a('0x38')]=_0x3df339['attributes'][_0x872a('0x39')]?_0x3df339[_0x872a('0x38')]:_0x5e0342[_0x872a('0x32')];if(!_0x57eece[_0x872a('0x34')][_0x872a('0x3a')](_0x872a('0x3b'))){_0x3df339[_0x872a('0x22')]=qs[_0x872a('0x22')](_0x57eece[_0x872a('0x34')]['limit']);_0x3df339[_0x872a('0x21')]=qs[_0x872a('0x21')](_0x57eece[_0x872a('0x34')][_0x872a('0x21')]);}_0x3df339[_0x872a('0x3c')]=qs['sort'](_0x57eece['query'][_0x872a('0x3d')]);_0x3df339['where']=qs[_0x872a('0x36')](_['pick'](_0x57eece[_0x872a('0x34')],_0x5e0342[_0x872a('0x36')]),_0x28cd4f);if(_0x57eece['query']['filter']){_0x3df339['where']=_['merge'](_0x3df339['where'],{'$or':_[_0x872a('0x33')](_0x28cd4f,function(_0x48e82a){if(_0x48e82a[_0x872a('0x31')]!==_0x872a('0x3e')){var _0x59a5a6={};_0x59a5a6[_0x48e82a[_0x872a('0x2c')]]={'$like':'%'+_0x57eece[_0x872a('0x34')][_0x872a('0x3f')]+'%'};return _0x59a5a6;}})});}_0x3df339=_['merge']({},_0x3df339,_0x57eece[_0x872a('0x40')]);var _0xd67280={'where':_0x3df339[_0x872a('0x41')]};return db[_0x872a('0x2f')][_0x872a('0x20')](_0xd67280)['then'](function(_0x40f235){_0x53dda9[_0x872a('0x20')]=_0x40f235;if(_0x57eece[_0x872a('0x34')][_0x872a('0x42')]){_0x3df339['include']=[{'all':!![]}];}return db[_0x872a('0x2f')]['findAll'](_0x3df339);})[_0x872a('0x28')](function(_0x567016){_0x53dda9[_0x872a('0x43')]=_0x567016;return _0x53dda9;})[_0x872a('0x28')](respondWithFilteredResult(_0x27585f,_0x3df339))[_0x872a('0x44')](handleError(_0x27585f,null));};exports[_0x872a('0x45')]=function(_0x5453c1,_0x4c540c){var _0x54f7c6={'raw':!![],'where':{'id':_0x5453c1[_0x872a('0x46')]['id']}},_0x1d2565={};_0x1d2565[_0x872a('0x32')]=_[_0x872a('0x35')](db['CloudProvider'][_0x872a('0x30')]);_0x1d2565[_0x872a('0x34')]=_[_0x872a('0x35')](_0x5453c1[_0x872a('0x34')]);_0x1d2565[_0x872a('0x36')]=_[_0x872a('0x37')](_0x1d2565['model'],_0x1d2565[_0x872a('0x34')]);_0x54f7c6[_0x872a('0x38')]=_[_0x872a('0x37')](_0x1d2565['model'],qs[_0x872a('0x47')](_0x5453c1[_0x872a('0x34')][_0x872a('0x47')]));_0x54f7c6[_0x872a('0x38')]=_0x54f7c6[_0x872a('0x38')][_0x872a('0x39')]?_0x54f7c6['attributes']:_0x1d2565[_0x872a('0x32')];if(_0x5453c1[_0x872a('0x34')][_0x872a('0x42')]){_0x54f7c6[_0x872a('0x48')]=[{'all':!![]}];}_0x54f7c6=_[_0x872a('0x49')]({},_0x54f7c6,_0x5453c1['options']);return db[_0x872a('0x2f')][_0x872a('0x4a')](_0x54f7c6)['then'](handleEntityNotFound(_0x4c540c,null))['then'](respondWithResult(_0x4c540c,null))[_0x872a('0x44')](handleError(_0x4c540c,null));};exports[_0x872a('0x4b')]=function(_0x266686,_0x2d0f2){return db['CloudProvider'][_0x872a('0x4b')](_0x266686[_0x872a('0x4c')],{})[_0x872a('0x28')](respondWithResult(_0x2d0f2,0xc9))[_0x872a('0x44')](handleError(_0x2d0f2,null));};exports[_0x872a('0x27')]=function(_0x29d09e,_0x2953c1){if(_0x29d09e['body']['id']){delete _0x29d09e[_0x872a('0x4c')]['id'];}return db[_0x872a('0x2f')][_0x872a('0x4a')]({'where':{'id':_0x29d09e['params']['id']}})[_0x872a('0x28')](handleEntityNotFound(_0x2953c1,null))[_0x872a('0x28')](saveUpdates(_0x29d09e['body'],null))[_0x872a('0x28')](respondWithResult(_0x2953c1,null))['catch'](handleError(_0x2953c1,null));};exports[_0x872a('0x29')]=function(_0x529e36,_0x39ea34){return db['CloudProvider'][_0x872a('0x4a')]({'where':{'id':_0x529e36[_0x872a('0x46')]['id']}})[_0x872a('0x28')](handleEntityNotFound(_0x39ea34,null))[_0x872a('0x28')](removeEntity(_0x39ea34,null))['catch'](handleError(_0x39ea34,null));}; \ No newline at end of file +var _0x6e64=['options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x5218c0,_0x2591df){var _0xc5dba=function(_0x54f32d){while(--_0x54f32d){_0x5218c0['push'](_0x5218c0['shift']());}};_0xc5dba(++_0x2591df);}(_0x6e64,0x187));var _0x46e6=function(_0x3b1d81,_0x21ffbf){_0x3b1d81=_0x3b1d81-0x0;var _0x1e38aa=_0x6e64[_0x3b1d81];return _0x1e38aa;};'use strict';var pdf=require(_0x46e6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x46e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46e6('0x2'));var rp=require(_0x46e6('0x3'));var moment=require(_0x46e6('0x4'));var BPromise=require(_0x46e6('0x5'));var Mustache=require(_0x46e6('0x6'));var util=require(_0x46e6('0x7'));var path=require('path');var sox=require(_0x46e6('0x8'));var csv=require(_0x46e6('0x9'));var ejs=require(_0x46e6('0xa'));var fs=require('fs');var _=require(_0x46e6('0xb'));var squel=require(_0x46e6('0xc'));var crypto=require(_0x46e6('0xd'));var jsforce=require(_0x46e6('0xe'));var deskjs=require(_0x46e6('0xf'));var toCsv=require(_0x46e6('0x9'));var querystring=require(_0x46e6('0x10'));var Papa=require(_0x46e6('0x11'));var Redis=require(_0x46e6('0x12'));var authService=require(_0x46e6('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46e6('0x14'));var logger=require(_0x46e6('0x15'))(_0x46e6('0x16'));var utils=require(_0x46e6('0x17'));var config=require(_0x46e6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x926af4,_0x287544){_0x287544=_0x287544||0xcc;return function(_0x252504){if(_0x252504){return _0x926af4[_0x46e6('0x19')](_0x287544);}return _0x926af4[_0x46e6('0x1a')](_0x287544)[_0x46e6('0x1b')]();};}function respondWithResult(_0x1f9d89,_0x4f6880){_0x4f6880=_0x4f6880||0xc8;return function(_0x20b7d2){if(_0x20b7d2){return _0x1f9d89[_0x46e6('0x1a')](_0x4f6880)[_0x46e6('0x1c')](_0x20b7d2);}};}function respondWithFilteredResult(_0x85f2ab,_0x3caec5){return function(_0x386341){if(_0x386341){var _0x1bdaeb=_0x386341[_0x46e6('0x1d')],_0x39c36f=_0x3caec5[_0x46e6('0x1e')],_0x5e52c9=_0x3caec5[_0x46e6('0x1e')]+_0x3caec5[_0x46e6('0x1f')],_0x20502e;if(_0x5e52c9>=_0x1bdaeb){_0x5e52c9=_0x1bdaeb;_0x20502e=0xc8;}else{_0x20502e=0xce;}_0x85f2ab[_0x46e6('0x1a')](_0x20502e);return _0x85f2ab['set'](_0x46e6('0x20'),_0x39c36f+'-'+_0x5e52c9+'/'+_0x1bdaeb)[_0x46e6('0x1c')](_0x386341);}return null;};}function patchUpdates(_0x40da02){return function(_0xa3b523){try{jsonpatch[_0x46e6('0x21')](_0xa3b523,_0x40da02,!![]);}catch(_0x3d212e){return BPromise['reject'](_0x3d212e);}return _0xa3b523[_0x46e6('0x22')]();};}function saveUpdates(_0x261fd9,_0x2cdab5){return function(_0x5e4644){if(_0x5e4644){return _0x5e4644[_0x46e6('0x23')](_0x261fd9)['then'](function(_0x2efd57){return _0x2efd57;});}return null;};}function removeEntity(_0x1fa009,_0x17f342){return function(_0x5378f4){if(_0x5378f4){return _0x5378f4[_0x46e6('0x24')]()[_0x46e6('0x25')](function(){_0x1fa009[_0x46e6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd8f383,_0x57b40e){return function(_0x11fbf4){if(!_0x11fbf4){_0xd8f383[_0x46e6('0x19')](0x194);}return _0x11fbf4;};}function handleError(_0x207b12,_0x31920d){_0x31920d=_0x31920d||0x1f4;return function(_0x3ed7fa){logger[_0x46e6('0x26')](_0x3ed7fa[_0x46e6('0x27')]);if(_0x3ed7fa[_0x46e6('0x28')]){delete _0x3ed7fa['name'];}_0x207b12[_0x46e6('0x1a')](_0x31920d)[_0x46e6('0x29')](_0x3ed7fa);};}exports['index']=function(_0x30d050,_0x50c3cc){var _0xebf657={},_0x808034={},_0x984533={'count':0x0,'rows':[]};var _0xd961cd=_[_0x46e6('0x2a')](db[_0x46e6('0x2b')][_0x46e6('0x2c')],function(_0x530d0a){return{'name':_0x530d0a[_0x46e6('0x2d')],'type':_0x530d0a[_0x46e6('0x2e')][_0x46e6('0x2f')]};});_0x808034['model']=_['map'](_0xd961cd,'name');_0x808034[_0x46e6('0x30')]=_[_0x46e6('0x31')](_0x30d050[_0x46e6('0x30')]);_0x808034[_0x46e6('0x32')]=_[_0x46e6('0x33')](_0x808034['model'],_0x808034[_0x46e6('0x30')]);_0xebf657[_0x46e6('0x34')]=_[_0x46e6('0x33')](_0x808034[_0x46e6('0x35')],qs[_0x46e6('0x36')](_0x30d050[_0x46e6('0x30')][_0x46e6('0x36')]));_0xebf657['attributes']=_0xebf657['attributes'][_0x46e6('0x37')]?_0xebf657[_0x46e6('0x34')]:_0x808034[_0x46e6('0x35')];if(!_0x30d050[_0x46e6('0x30')][_0x46e6('0x38')](_0x46e6('0x39'))){_0xebf657[_0x46e6('0x1f')]=qs['limit'](_0x30d050['query'][_0x46e6('0x1f')]);_0xebf657['offset']=qs['offset'](_0x30d050['query']['offset']);}_0xebf657[_0x46e6('0x3a')]=qs['sort'](_0x30d050[_0x46e6('0x30')][_0x46e6('0x3b')]);_0xebf657[_0x46e6('0x3c')]=qs[_0x46e6('0x32')](_[_0x46e6('0x3d')](_0x30d050['query'],_0x808034['filters']),_0xd961cd);if(_0x30d050[_0x46e6('0x30')][_0x46e6('0x3e')]){_0xebf657[_0x46e6('0x3c')]=_[_0x46e6('0x3f')](_0xebf657[_0x46e6('0x3c')],{'$or':_[_0x46e6('0x2a')](_0xd961cd,function(_0x5b5230){if(_0x5b5230['type']!==_0x46e6('0x40')){var _0x4f4201={};_0x4f4201[_0x5b5230[_0x46e6('0x28')]]={'$like':'%'+_0x30d050[_0x46e6('0x30')][_0x46e6('0x3e')]+'%'};return _0x4f4201;}})});}_0xebf657=_[_0x46e6('0x3f')]({},_0xebf657,_0x30d050[_0x46e6('0x41')]);var _0x2e1895={'where':_0xebf657['where']};return db[_0x46e6('0x2b')][_0x46e6('0x1d')](_0x2e1895)[_0x46e6('0x25')](function(_0x1aa9c8){_0x984533[_0x46e6('0x1d')]=_0x1aa9c8;if(_0x30d050['query'][_0x46e6('0x42')]){_0xebf657[_0x46e6('0x43')]=[{'all':!![]}];}return db[_0x46e6('0x2b')][_0x46e6('0x44')](_0xebf657);})[_0x46e6('0x25')](function(_0x3efa27){_0x984533[_0x46e6('0x45')]=_0x3efa27;return _0x984533;})[_0x46e6('0x25')](respondWithFilteredResult(_0x50c3cc,_0xebf657))[_0x46e6('0x46')](handleError(_0x50c3cc,null));};exports[_0x46e6('0x47')]=function(_0x3d6e06,_0x354ca0){var _0x91a06d={'raw':!![],'where':{'id':_0x3d6e06[_0x46e6('0x48')]['id']}},_0x117fde={};_0x117fde[_0x46e6('0x35')]=_[_0x46e6('0x31')](db[_0x46e6('0x2b')][_0x46e6('0x2c')]);_0x117fde['query']=_[_0x46e6('0x31')](_0x3d6e06['query']);_0x117fde['filters']=_[_0x46e6('0x33')](_0x117fde['model'],_0x117fde[_0x46e6('0x30')]);_0x91a06d[_0x46e6('0x34')]=_[_0x46e6('0x33')](_0x117fde['model'],qs[_0x46e6('0x36')](_0x3d6e06[_0x46e6('0x30')][_0x46e6('0x36')]));_0x91a06d['attributes']=_0x91a06d[_0x46e6('0x34')][_0x46e6('0x37')]?_0x91a06d[_0x46e6('0x34')]:_0x117fde[_0x46e6('0x35')];if(_0x3d6e06['query'][_0x46e6('0x42')]){_0x91a06d['include']=[{'all':!![]}];}_0x91a06d=_[_0x46e6('0x3f')]({},_0x91a06d,_0x3d6e06['options']);return db[_0x46e6('0x2b')][_0x46e6('0x49')](_0x91a06d)['then'](handleEntityNotFound(_0x354ca0,null))[_0x46e6('0x25')](respondWithResult(_0x354ca0,null))[_0x46e6('0x46')](handleError(_0x354ca0,null));};exports[_0x46e6('0x4a')]=function(_0x2d4afa,_0x22b096){return db[_0x46e6('0x2b')][_0x46e6('0x4a')](_0x2d4afa[_0x46e6('0x4b')],{})[_0x46e6('0x25')](respondWithResult(_0x22b096,0xc9))[_0x46e6('0x46')](handleError(_0x22b096,null));};exports[_0x46e6('0x23')]=function(_0x4bbb91,_0x5c906d){if(_0x4bbb91[_0x46e6('0x4b')]['id']){delete _0x4bbb91[_0x46e6('0x4b')]['id'];}return db[_0x46e6('0x2b')]['find']({'where':{'id':_0x4bbb91['params']['id']}})['then'](handleEntityNotFound(_0x5c906d,null))[_0x46e6('0x25')](saveUpdates(_0x4bbb91[_0x46e6('0x4b')],null))['then'](respondWithResult(_0x5c906d,null))[_0x46e6('0x46')](handleError(_0x5c906d,null));};exports[_0x46e6('0x24')]=function(_0x5c1aa9,_0x2348f4){return db[_0x46e6('0x2b')][_0x46e6('0x49')]({'where':{'id':_0x5c1aa9['params']['id']}})['then'](handleEntityNotFound(_0x2348f4,null))[_0x46e6('0x25')](removeEntity(_0x2348f4,null))['catch'](handleError(_0x2348f4,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2f971f5..58b7c31 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 _0x1c03=['path','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird'];(function(_0x5541f3,_0x266df7){var _0xe30f20=function(_0x5498af){while(--_0x5498af){_0x5541f3['push'](_0x5541f3['shift']());}};_0xe30f20(++_0x266df7);}(_0x1c03,0x7f));var _0x31c0=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x1c03[_0x254076];return _0x21a93e;};'use strict';var _=require('lodash');var util=require(_0x31c0('0x0'));var logger=require(_0x31c0('0x1'))(_0x31c0('0x2'));var moment=require(_0x31c0('0x3'));var BPromise=require(_0x31c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31c0('0x5'));var rimraf=require('rimraf');var config=require(_0x31c0('0x6'));var attributes=require(_0x31c0('0x7'));module['exports']=function(_0x22a6a6,_0x1b294c){return _0x22a6a6[_0x31c0('0x8')](_0x31c0('0x9'),attributes,{'tableName':_0x31c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3952=['CloudProvider','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x194a43,_0xd60a78){var _0x3c8901=function(_0x45b145){while(--_0x45b145){_0x194a43['push'](_0x194a43['shift']());}};_0x3c8901(++_0xd60a78);}(_0x3952,0x18d));var _0x2395=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x3952[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0x2395('0x0'));var util=require(_0x2395('0x1'));var logger=require('../../config/logger')(_0x2395('0x2'));var moment=require(_0x2395('0x3'));var BPromise=require(_0x2395('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2395('0x5'));var rimraf=require(_0x2395('0x6'));var config=require(_0x2395('0x7'));var attributes=require(_0x2395('0x8'));module[_0x2395('0x9')]=function(_0x377ef8,_0xd4736a){return _0x377ef8['define'](_0x2395('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 8231251..9186cb8 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 _0x0792=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','error','code','CloudProvider,\x20%s,\x20%s','message','catch'];(function(_0x5697d6,_0x43bbc6){var _0x6e6b3=function(_0x350baf){while(--_0x350baf){_0x5697d6['push'](_0x5697d6['shift']());}};_0x6e6b3(++_0x43bbc6);}(_0x0792,0x140));var _0x2079=function(_0xbeab9,_0x37ec4a){_0xbeab9=_0xbeab9-0x0;var _0x27650c=_0x0792[_0xbeab9];return _0x27650c;};'use strict';var _=require(_0x2079('0x0'));var util=require('util');var moment=require(_0x2079('0x1'));var BPromise=require(_0x2079('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2079('0x3'));var db=require(_0x2079('0x4'))['db'];var utils=require(_0x2079('0x5'));var logger=require(_0x2079('0x6'))(_0x2079('0x7'));var config=require(_0x2079('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2079('0x9')][_0x2079('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e871d,_0x54f145,_0x43139b){return new BPromise(function(_0x50d196,_0x3b4f5d){return client[_0x2079('0xb')](_0x3e871d,_0x43139b)[_0x2079('0xc')](function(_0x49066c){logger[_0x2079('0xd')]('CloudProvider,\x20%s,\x20%s',_0x54f145,_0x2079('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x54f145,_0x2079('0xe'),JSON['stringify'](_0x49066c));if(_0x49066c[_0x2079('0xf')]){if(_0x49066c[_0x2079('0xf')][_0x2079('0x10')]===0x1f4){logger[_0x2079('0xf')](_0x2079('0x11'),_0x54f145,_0x49066c[_0x2079('0xf')][_0x2079('0x12')]);return _0x3b4f5d(_0x49066c[_0x2079('0xf')][_0x2079('0x12')]);}logger[_0x2079('0xf')](_0x2079('0x11'),_0x54f145,_0x49066c[_0x2079('0xf')]['message']);return _0x50d196(_0x49066c[_0x2079('0xf')][_0x2079('0x12')]);}else{logger[_0x2079('0xd')](_0x2079('0x11'),_0x54f145,_0x2079('0xe'));_0x50d196(_0x49066c['result'][_0x2079('0x12')]);}})[_0x2079('0x13')](function(_0x5db8fb){logger[_0x2079('0xf')](_0x2079('0x11'),_0x54f145,_0x5db8fb);_0x3b4f5d(_0x5db8fb);});});} \ No newline at end of file +var _0x9908=['CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CloudProvider,\x20%s,\x20%s','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','info','request\x20sent','debug'];(function(_0x26ab34,_0x282fa9){var _0x2e0d50=function(_0x2dcea1){while(--_0x2dcea1){_0x26ab34['push'](_0x26ab34['shift']());}};_0x2e0d50(++_0x282fa9);}(_0x9908,0xb3));var _0x8990=function(_0x10ec0f,_0x5ece09){_0x10ec0f=_0x10ec0f-0x0;var _0x1587ee=_0x9908[_0x10ec0f];return _0x1587ee;};'use strict';var _=require(_0x8990('0x0'));var util=require(_0x8990('0x1'));var moment=require('moment');var BPromise=require(_0x8990('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8990('0x3'));var db=require(_0x8990('0x4'))['db'];var utils=require(_0x8990('0x5'));var logger=require(_0x8990('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4880dd,_0x3dc12b,_0x50dccb){return new BPromise(function(_0x106c84,_0x52d13a){return client[_0x8990('0x7')](_0x4880dd,_0x50dccb)['then'](function(_0x30fc19){logger[_0x8990('0x8')]('CloudProvider,\x20%s,\x20%s',_0x3dc12b,_0x8990('0x9'));logger[_0x8990('0xa')](_0x8990('0xb'),_0x3dc12b,_0x8990('0x9'),JSON[_0x8990('0xc')](_0x30fc19));if(_0x30fc19[_0x8990('0xd')]){if(_0x30fc19[_0x8990('0xd')][_0x8990('0xe')]===0x1f4){logger[_0x8990('0xd')]('CloudProvider,\x20%s,\x20%s',_0x3dc12b,_0x30fc19['error'][_0x8990('0xf')]);return _0x52d13a(_0x30fc19[_0x8990('0xd')]['message']);}logger[_0x8990('0xd')]('CloudProvider,\x20%s,\x20%s',_0x3dc12b,_0x30fc19[_0x8990('0xd')]['message']);return _0x106c84(_0x30fc19[_0x8990('0xd')]['message']);}else{logger[_0x8990('0x8')]('CloudProvider,\x20%s,\x20%s',_0x3dc12b,_0x8990('0x9'));_0x106c84(_0x30fc19[_0x8990('0x10')][_0x8990('0xf')]);}})[_0x8990('0x11')](function(_0x862dab){logger['error'](_0x8990('0x12'),_0x3dc12b,_0x862dab);_0x52d13a(_0x862dab);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f790e4b..b366490 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 _0x4f03=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','get','/:id','isAuthenticated','show','post','create','put','destroy'];(function(_0x202f15,_0x57be77){var _0x11f74=function(_0x25e59f){while(--_0x25e59f){_0x202f15['push'](_0x202f15['shift']());}};_0x11f74(++_0x57be77);}(_0x4f03,0xb0));var _0x34f0=function(_0x39914e,_0x1ec745){_0x39914e=_0x39914e-0x0;var _0x56350b=_0x4f03[_0x39914e];return _0x56350b;};'use strict';var multer=require(_0x34f0('0x0'));var util=require('util');var path=require(_0x34f0('0x1'));var timeout=require(_0x34f0('0x2'));var express=require(_0x34f0('0x3'));var router=express[_0x34f0('0x4')]();var auth=require(_0x34f0('0x5'));var interaction=require(_0x34f0('0x6'));var config=require('../../config/environment');var controller=require(_0x34f0('0x7'));router[_0x34f0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x34f0('0x8')](_0x34f0('0x9'),auth[_0x34f0('0xa')](),controller[_0x34f0('0xb')]);router[_0x34f0('0xc')]('/',auth[_0x34f0('0xa')](),controller[_0x34f0('0xd')]);router[_0x34f0('0xe')]('/:id',auth[_0x34f0('0xa')](),controller['update']);router['delete'](_0x34f0('0x9'),auth['isAuthenticated'](),controller[_0x34f0('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb868=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated','post','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb868,0x8b));var _0x8b86=function(_0xe3362a,_0x50e069){_0xe3362a=_0xe3362a-0x0;var _0x5153d5=_0xb868[_0xe3362a];return _0x5153d5;};'use strict';var multer=require(_0x8b86('0x0'));var util=require(_0x8b86('0x1'));var path=require(_0x8b86('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b86('0x3'));var router=express[_0x8b86('0x4')]();var auth=require(_0x8b86('0x5'));var interaction=require(_0x8b86('0x6'));var config=require(_0x8b86('0x7'));var controller=require(_0x8b86('0x8'));router[_0x8b86('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b86('0xa')]);router[_0x8b86('0x9')](_0x8b86('0xb'),auth[_0x8b86('0xc')](),controller['show']);router[_0x8b86('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8b86('0xc')](),controller[_0x8b86('0xe')]);router[_0x8b86('0xf')](_0x8b86('0xb'),auth[_0x8b86('0xc')](),controller[_0x8b86('0x10')]);module[_0x8b86('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f61bbf4..4bbdbc7 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 _0xb3db=['name','STRING','sequelize','exports'];(function(_0x400d6,_0x2aa11f){var _0x2f9d71=function(_0x243fa2){while(--_0x243fa2){_0x400d6['push'](_0x400d6['shift']());}};_0x2f9d71(++_0x2aa11f);}(_0xb3db,0xd2));var _0xbb3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb3db[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xbb3d('0x0'));module[_0xbb3d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbb3d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbb3d('0x3')]},'companyId':{'type':Sequelize[_0xbb3d('0x3')]},'website':{'type':Sequelize[_0xbb3d('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbb3d('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xbb3d('0x3')]},'postalCode':{'type':Sequelize[_0xbb3d('0x3')]},'city':{'type':Sequelize[_0xbb3d('0x3')]},'country':{'type':Sequelize[_0xbb3d('0x3')]},'email':{'type':Sequelize[_0xbb3d('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xbb3d('0x3')]},'sPostalCode':{'type':Sequelize[_0xbb3d('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xbb3d('0x3')]},'description':{'type':Sequelize[_0xbb3d('0x3')]}}; \ No newline at end of file +var _0x022e=['sequelize','exports','STRING'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x022e,0x17a));var _0xe022=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x022e[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0xe022('0x0'));module[_0xe022('0x1')]={'name':{'type':Sequelize[_0xe022('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe022('0x2')]},'companyId':{'type':Sequelize[_0xe022('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe022('0x2')]},'fax':{'type':Sequelize[_0xe022('0x2')]},'type':{'type':Sequelize[_0xe022('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xe022('0x2')]},'city':{'type':Sequelize[_0xe022('0x2')]},'country':{'type':Sequelize[_0xe022('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe022('0x2')]},'sStreet':{'type':Sequelize[_0xe022('0x2')]},'sPostalCode':{'type':Sequelize[_0xe022('0x2')]},'sCity':{'type':Sequelize[_0xe022('0x2')]},'sCountry':{'type':Sequelize[_0xe022('0x2')]},'description':{'type':Sequelize[_0xe022('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2f0706d..ece3563 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 _0xad9e=['intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','merge','map','filter','options','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','addContacts','ids','getContacts','pick','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','count','offset','status','set','json','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','name','send','index','CmCompany','describe','model','query','filters'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0xad9e,0x76));var _0xead9=function(_0x4a187e,_0x4c4b8c){_0x4a187e=_0x4a187e-0x0;var _0xa2600=_0xad9e[_0x4a187e];return _0xa2600;};'use strict';var pdf=require(_0xead9('0x0'));var emlformat=require(_0xead9('0x1'));var rimraf=require(_0xead9('0x2'));var zipdir=require(_0xead9('0x3'));var jsonpatch=require(_0xead9('0x4'));var rp=require(_0xead9('0x5'));var moment=require('moment');var BPromise=require(_0xead9('0x6'));var Mustache=require(_0xead9('0x7'));var util=require(_0xead9('0x8'));var path=require(_0xead9('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xead9('0xa'));var squel=require(_0xead9('0xb'));var crypto=require(_0xead9('0xc'));var jsforce=require(_0xead9('0xd'));var deskjs=require(_0xead9('0xe'));var toCsv=require(_0xead9('0xf'));var querystring=require(_0xead9('0x10'));var Papa=require('papaparse');var Redis=require(_0xead9('0x11'));var authService=require(_0xead9('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xead9('0x13'));var logger=require(_0xead9('0x14'))(_0xead9('0x15'));var utils=require('../../config/utils');var config=require(_0xead9('0x16'));var db=require(_0xead9('0x17'))['db'];function respondWithStatusCode(_0xcf116d,_0x48b23b){_0x48b23b=_0x48b23b||0xcc;return function(_0x6140d3){if(_0x6140d3){return _0xcf116d[_0xead9('0x18')](_0x48b23b);}return _0xcf116d['status'](_0x48b23b)['end']();};}function respondWithResult(_0x1c28d7,_0xfd1f8){_0xfd1f8=_0xfd1f8||0xc8;return function(_0x400e5d){if(_0x400e5d){return _0x1c28d7['status'](_0xfd1f8)['json'](_0x400e5d);}};}function respondWithFilteredResult(_0x5db0ae,_0x3bb850){return function(_0x1c756e){if(_0x1c756e){var _0x6ddc7a=_0x1c756e[_0xead9('0x19')],_0x3c2bdd=_0x3bb850['offset'],_0xca0895=_0x3bb850[_0xead9('0x1a')]+_0x3bb850['limit'],_0xfc44a6;if(_0xca0895>=_0x6ddc7a){_0xca0895=_0x6ddc7a;_0xfc44a6=0xc8;}else{_0xfc44a6=0xce;}_0x5db0ae[_0xead9('0x1b')](_0xfc44a6);return _0x5db0ae[_0xead9('0x1c')]('Content-Range',_0x3c2bdd+'-'+_0xca0895+'/'+_0x6ddc7a)[_0xead9('0x1d')](_0x1c756e);}return null;};}function patchUpdates(_0x18f964){return function(_0x1883c4){try{jsonpatch['apply'](_0x1883c4,_0x18f964,!![]);}catch(_0x5dee17){return BPromise[_0xead9('0x1e')](_0x5dee17);}return _0x1883c4[_0xead9('0x1f')]();};}function saveUpdates(_0x57a093,_0x56c398){return function(_0x4501f8){if(_0x4501f8){return _0x4501f8[_0xead9('0x20')](_0x57a093)[_0xead9('0x21')](function(_0xd5d559){return _0xd5d559;});}return null;};}function removeEntity(_0x381272,_0x335588){return function(_0x138448){if(_0x138448){return _0x138448[_0xead9('0x22')]()[_0xead9('0x21')](function(){var _0x4653e5=_0x138448[_0xead9('0x23')]({'plain':!![]});var _0x3d2efb=_0xead9('0x24');return db[_0xead9('0x25')][_0xead9('0x22')]({'where':{'type':_0x3d2efb,'resourceId':_0x4653e5['id']}})[_0xead9('0x21')](function(){return _0x138448;});})[_0xead9('0x21')](function(){_0x381272[_0xead9('0x1b')](0xcc)[_0xead9('0x26')]();});}};}function handleEntityNotFound(_0x513ff7,_0x484106){return function(_0x4d0fe4){if(!_0x4d0fe4){_0x513ff7[_0xead9('0x18')](0x194);}return _0x4d0fe4;};}function handleError(_0x47bfee,_0x1d115d){_0x1d115d=_0x1d115d||0x1f4;return function(_0x395186){logger[_0xead9('0x27')](_0x395186['stack']);if(_0x395186[_0xead9('0x28')]){delete _0x395186[_0xead9('0x28')];}_0x47bfee[_0xead9('0x1b')](_0x1d115d)[_0xead9('0x29')](_0x395186);};}exports[_0xead9('0x2a')]=function(_0x4a7958,_0x28705d){var _0x183d34={},_0x5b4647={},_0xdee249={'count':0x0,'rows':[]};return db[_0xead9('0x2b')][_0xead9('0x2c')]()[_0xead9('0x21')](function(_0x3b2b20){_0x5b4647[_0xead9('0x2d')]=_['keys'](_0x3b2b20);_0x5b4647[_0xead9('0x2e')]=_['keys'](_0x4a7958['query']);_0x5b4647[_0xead9('0x2f')]=_[_0xead9('0x30')](_0x5b4647[_0xead9('0x2d')],_0x5b4647[_0xead9('0x2e')]);_0x183d34[_0xead9('0x31')]=_[_0xead9('0x30')](_0x5b4647['model'],qs[_0xead9('0x32')](_0x4a7958[_0xead9('0x2e')][_0xead9('0x32')]));_0x183d34[_0xead9('0x31')]=_0x183d34[_0xead9('0x31')][_0xead9('0x33')]?_0x183d34[_0xead9('0x31')]:_0x5b4647[_0xead9('0x2d')];if(!_0x4a7958[_0xead9('0x2e')][_0xead9('0x34')]('nolimit')){_0x183d34[_0xead9('0x35')]=qs[_0xead9('0x35')](_0x4a7958[_0xead9('0x2e')][_0xead9('0x35')]);_0x183d34[_0xead9('0x1a')]=qs[_0xead9('0x1a')](_0x4a7958[_0xead9('0x2e')][_0xead9('0x1a')]);}_0x183d34[_0xead9('0x36')]=qs[_0xead9('0x37')](_0x4a7958[_0xead9('0x2e')][_0xead9('0x37')]);_0x183d34['where']=qs['filters'](_['pick'](_0x4a7958[_0xead9('0x2e')],_0x5b4647[_0xead9('0x2f')]),_0x3b2b20);if(_0x4a7958[_0xead9('0x2e')]['filter']){_0x183d34['where']=_[_0xead9('0x38')](_0x183d34['where'],{'$or':_[_0xead9('0x39')](_0x183d34[_0xead9('0x31')],function(_0x46646f){var _0x23d987={};_0x23d987[_0x46646f]={'$like':'%'+_0x4a7958['query'][_0xead9('0x3a')]+'%'};return _0x23d987;})});}_0x183d34=_['merge']({},_0x183d34,_0x4a7958[_0xead9('0x3b')]);var _0x1a7ead={'where':_0x183d34[_0xead9('0x3c')]};return db[_0xead9('0x2b')][_0xead9('0x19')](_0x1a7ead)[_0xead9('0x21')](function(_0xf7c6ec){_0xdee249[_0xead9('0x19')]=_0xf7c6ec;if(_0x4a7958[_0xead9('0x2e')][_0xead9('0x3d')]){_0x183d34[_0xead9('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0xead9('0x3f')](_0x183d34);})[_0xead9('0x21')](function(_0x4e7411){_0xdee249[_0xead9('0x40')]=_0x4e7411;return _0xdee249;})[_0xead9('0x21')](respondWithFilteredResult(_0x28705d,_0x183d34))[_0xead9('0x41')](handleError(_0x28705d,null));})['catch'](handleError(_0x28705d,null));};exports[_0xead9('0x42')]=function(_0x561f1b,_0x64af25){var _0x2ab9d9={'raw':![],'where':{'id':_0x561f1b[_0xead9('0x43')]['id']}},_0x48dba4={};_0x48dba4['model']=_['keys'](db['CmCompany'][_0xead9('0x44')]);_0x48dba4['query']=_[_0xead9('0x45')](_0x561f1b[_0xead9('0x2e')]);_0x48dba4[_0xead9('0x2f')]=_[_0xead9('0x30')](_0x48dba4[_0xead9('0x2d')],_0x48dba4[_0xead9('0x2e')]);_0x2ab9d9['attributes']=_[_0xead9('0x30')](_0x48dba4[_0xead9('0x2d')],qs[_0xead9('0x32')](_0x561f1b[_0xead9('0x2e')][_0xead9('0x32')]));_0x2ab9d9[_0xead9('0x31')]=_0x2ab9d9[_0xead9('0x31')][_0xead9('0x33')]?_0x2ab9d9[_0xead9('0x31')]:_0x48dba4[_0xead9('0x2d')];if(_0x561f1b['query'][_0xead9('0x3d')]){_0x2ab9d9[_0xead9('0x3e')]=[{'all':!![]}];}_0x2ab9d9=_[_0xead9('0x38')]({},_0x2ab9d9,_0x561f1b[_0xead9('0x3b')]);return db[_0xead9('0x2b')][_0xead9('0x46')](_0x2ab9d9)['then'](handleEntityNotFound(_0x64af25,null))['then'](respondWithResult(_0x64af25,null))['catch'](handleError(_0x64af25,null));};exports[_0xead9('0x47')]=function(_0x13ea5b,_0x565892){return db[_0xead9('0x2b')][_0xead9('0x47')](_0x13ea5b[_0xead9('0x48')],{})[_0xead9('0x21')](function(_0x51525c){var _0x975e2=_0x13ea5b[_0xead9('0x49')][_0xead9('0x23')]({'plain':!![]});if(!_0x975e2)throw new Error(_0xead9('0x4a'));if(_0x975e2[_0xead9('0x4b')]==='user'){var _0x35491e=_0x51525c['get']({'plain':!![]});var _0x4fe95a=_0xead9('0x24');return db['UserProfileSection'][_0xead9('0x46')]({'where':{'name':_0x4fe95a,'userProfileId':_0x975e2[_0xead9('0x4c')]},'raw':!![]})['then'](function(_0x33ea57){if(_0x33ea57&&_0x33ea57[_0xead9('0x4d')]===0x0){return db[_0xead9('0x25')][_0xead9('0x47')]({'name':_0x35491e[_0xead9('0x28')],'resourceId':_0x35491e['id'],'type':_0x33ea57[_0xead9('0x28')],'sectionId':_0x33ea57['id']},{})[_0xead9('0x21')](function(){return _0x51525c;});}else{return _0x51525c;}})['catch'](function(_0x48e57c){logger[_0xead9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48e57c);throw _0x48e57c;});}return _0x51525c;})[_0xead9('0x21')](respondWithResult(_0x565892,0xc9))[_0xead9('0x41')](handleError(_0x565892,null));};exports['update']=function(_0x5beb89,_0x3cc7a5){if(_0x5beb89[_0xead9('0x48')]['id']){delete _0x5beb89['body']['id'];}return db[_0xead9('0x2b')]['find']({'where':{'id':_0x5beb89['params']['id']}})['then'](handleEntityNotFound(_0x3cc7a5,null))[_0xead9('0x21')](saveUpdates(_0x5beb89[_0xead9('0x48')],null))[_0xead9('0x21')](respondWithResult(_0x3cc7a5,null))[_0xead9('0x41')](handleError(_0x3cc7a5,null));};exports[_0xead9('0x22')]=function(_0x366578,_0x1aa2ab){return db['CmCompany']['find']({'where':{'id':_0x366578[_0xead9('0x43')]['id']}})[_0xead9('0x21')](handleEntityNotFound(_0x1aa2ab,null))['then'](removeEntity(_0x1aa2ab,null))[_0xead9('0x41')](handleError(_0x1aa2ab,null));};exports[_0xead9('0x2c')]=function(_0x2a43f7,_0x1b01ab){return db[_0xead9('0x2b')]['describe']()['then'](respondWithResult(_0x1b01ab,null))['catch'](handleError(_0x1b01ab,null));};exports[_0xead9('0x4e')]=function(_0x3ae7d,_0x423bd2,_0x5eb7f1){return db['CmContact'][_0xead9('0x46')]({'where':{'id':_0x3ae7d[_0xead9('0x43')]['id']}})[_0xead9('0x21')](handleEntityNotFound(_0x423bd2,null))[_0xead9('0x21')](function(_0x4bdd5d){if(_0x4bdd5d){return _0x4bdd5d[_0xead9('0x4e')](_0x3ae7d['body'][_0xead9('0x4f')],_['omit'](_0x3ae7d[_0xead9('0x48')],['ids','id'])||{});}})[_0xead9('0x21')](respondWithResult(_0x423bd2,null))[_0xead9('0x41')](handleError(_0x423bd2,null));};exports[_0xead9('0x50')]=function(_0x1ab2eb,_0x3b3b1f,_0x263f45){var _0x4413ea={};var _0x4f64bf={};var _0x10ffd8;var _0x2dcefa;return db[_0xead9('0x2b')]['findOne']({'where':{'id':_0x1ab2eb[_0xead9('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b3b1f,null))[_0xead9('0x21')](function(_0x4a3ca6){if(_0x4a3ca6){_0x10ffd8=_0x4a3ca6;_0x4f64bf['model']=_[_0xead9('0x45')](db['CmContact'][_0xead9('0x44')]);_0x4f64bf['query']=_[_0xead9('0x45')](_0x1ab2eb[_0xead9('0x2e')]);_0x4f64bf[_0xead9('0x2f')]=_[_0xead9('0x30')](_0x4f64bf['model'],_0x4f64bf[_0xead9('0x2e')]);_0x4413ea['attributes']=_[_0xead9('0x30')](_0x4f64bf[_0xead9('0x2d')],qs['fields'](_0x1ab2eb[_0xead9('0x2e')][_0xead9('0x32')]));_0x4413ea[_0xead9('0x31')]=_0x4413ea['attributes'][_0xead9('0x33')]?_0x4413ea[_0xead9('0x31')]:_0x4f64bf[_0xead9('0x2d')];_0x4413ea[_0xead9('0x36')]=qs[_0xead9('0x37')](_0x1ab2eb[_0xead9('0x2e')][_0xead9('0x37')]);_0x4413ea[_0xead9('0x3c')]=qs[_0xead9('0x2f')](_[_0xead9('0x51')](_0x1ab2eb[_0xead9('0x2e')],_0x4f64bf[_0xead9('0x2f')]));if(_0x1ab2eb['query'][_0xead9('0x3a')]){_0x4413ea[_0xead9('0x3c')]=_[_0xead9('0x38')](_0x4413ea[_0xead9('0x3c')],{'$or':_['map'](_0x4413ea[_0xead9('0x31')],function(_0x219203){var _0x353c34={};_0x353c34[_0x219203]={'$like':'%'+_0x1ab2eb[_0xead9('0x2e')]['filter']+'%'};return _0x353c34;})});}_0x4413ea=_['merge']({},_0x4413ea,_0x1ab2eb[_0xead9('0x3b')]);return _0x10ffd8[_0xead9('0x50')](_0x4413ea);}})[_0xead9('0x21')](function(_0x2d2ca8){if(_0x2d2ca8){_0x2dcefa=_0x2d2ca8[_0xead9('0x33')];if(!_0x1ab2eb['query'][_0xead9('0x34')](_0xead9('0x52'))){_0x4413ea[_0xead9('0x35')]=qs['limit'](_0x1ab2eb[_0xead9('0x2e')][_0xead9('0x35')]);_0x4413ea['offset']=qs['offset'](_0x1ab2eb[_0xead9('0x2e')][_0xead9('0x1a')]);}return _0x10ffd8[_0xead9('0x50')](_0x4413ea);}})[_0xead9('0x21')](function(_0x5274ca){if(_0x5274ca){return _0x5274ca?{'count':_0x2dcefa,'rows':_0x5274ca}:null;}})[_0xead9('0x21')](respondWithResult(_0x3b3b1f,null))[_0xead9('0x41')](handleError(_0x3b3b1f,null));}; \ No newline at end of file +var _0xcb4b=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','stack','name','send','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','CmCompany','count','includeAll','include','findAll','catch','show','params','intersection','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','describe','CmContact','addContacts','ids','omit','getContacts','findOne','rawAttributes','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1f0367,_0x586ed4){var _0x40aad5=function(_0x333cff){while(--_0x333cff){_0x1f0367['push'](_0x1f0367['shift']());}};_0x40aad5(++_0x586ed4);}(_0xcb4b,0xa6));var _0xbcb4=function(_0x454fd1,_0x35af51){_0x454fd1=_0x454fd1-0x0;var _0x3a0aad=_0xcb4b[_0x454fd1];return _0x3a0aad;};'use strict';var pdf=require(_0xbcb4('0x0'));var emlformat=require(_0xbcb4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbcb4('0x2'));var moment=require(_0xbcb4('0x3'));var BPromise=require(_0xbcb4('0x4'));var Mustache=require(_0xbcb4('0x5'));var util=require(_0xbcb4('0x6'));var path=require(_0xbcb4('0x7'));var sox=require(_0xbcb4('0x8'));var csv=require(_0xbcb4('0x9'));var ejs=require(_0xbcb4('0xa'));var fs=require('fs');var _=require(_0xbcb4('0xb'));var squel=require(_0xbcb4('0xc'));var crypto=require(_0xbcb4('0xd'));var jsforce=require(_0xbcb4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbcb4('0x9'));var querystring=require(_0xbcb4('0xf'));var Papa=require('papaparse');var Redis=require(_0xbcb4('0x10'));var authService=require(_0xbcb4('0x11'));var qs=require(_0xbcb4('0x12'));var as=require(_0xbcb4('0x13'));var hardwareService=require(_0xbcb4('0x14'));var logger=require('../../config/logger')(_0xbcb4('0x15'));var utils=require(_0xbcb4('0x16'));var config=require(_0xbcb4('0x17'));var db=require(_0xbcb4('0x18'))['db'];function respondWithStatusCode(_0x2ab411,_0x56be15){_0x56be15=_0x56be15||0xcc;return function(_0x5a3482){if(_0x5a3482){return _0x2ab411['sendStatus'](_0x56be15);}return _0x2ab411['status'](_0x56be15)[_0xbcb4('0x19')]();};}function respondWithResult(_0x2983d9,_0x450d77){_0x450d77=_0x450d77||0xc8;return function(_0x45084f){if(_0x45084f){return _0x2983d9['status'](_0x450d77)[_0xbcb4('0x1a')](_0x45084f);}};}function respondWithFilteredResult(_0x18b0fd,_0x401978){return function(_0x5264f0){if(_0x5264f0){var _0x393b5d=_0x5264f0['count'],_0x28c92b=_0x401978['offset'],_0xb2e565=_0x401978[_0xbcb4('0x1b')]+_0x401978[_0xbcb4('0x1c')],_0x573b50;if(_0xb2e565>=_0x393b5d){_0xb2e565=_0x393b5d;_0x573b50=0xc8;}else{_0x573b50=0xce;}_0x18b0fd[_0xbcb4('0x1d')](_0x573b50);return _0x18b0fd[_0xbcb4('0x1e')](_0xbcb4('0x1f'),_0x28c92b+'-'+_0xb2e565+'/'+_0x393b5d)['json'](_0x5264f0);}return null;};}function patchUpdates(_0x58c35a){return function(_0x218388){try{jsonpatch[_0xbcb4('0x20')](_0x218388,_0x58c35a,!![]);}catch(_0x1c4565){return BPromise[_0xbcb4('0x21')](_0x1c4565);}return _0x218388[_0xbcb4('0x22')]();};}function saveUpdates(_0xbeef7a,_0x48eccf){return function(_0x3c9d5a){if(_0x3c9d5a){return _0x3c9d5a[_0xbcb4('0x23')](_0xbeef7a)[_0xbcb4('0x24')](function(_0x1bd11b){return _0x1bd11b;});}return null;};}function removeEntity(_0x3ed0e8,_0x3ce9ad){return function(_0x42963f){if(_0x42963f){return _0x42963f[_0xbcb4('0x25')]()[_0xbcb4('0x24')](function(){var _0x843f49=_0x42963f[_0xbcb4('0x26')]({'plain':!![]});var _0x24ab69=_0xbcb4('0x27');return db[_0xbcb4('0x28')][_0xbcb4('0x25')]({'where':{'type':_0x24ab69,'resourceId':_0x843f49['id']}})[_0xbcb4('0x24')](function(){return _0x42963f;});})[_0xbcb4('0x24')](function(){_0x3ed0e8[_0xbcb4('0x1d')](0xcc)[_0xbcb4('0x19')]();});}};}function handleEntityNotFound(_0xf7397f,_0x48df76){return function(_0x57795a){if(!_0x57795a){_0xf7397f['sendStatus'](0x194);}return _0x57795a;};}function handleError(_0x4ffd45,_0xfe007){_0xfe007=_0xfe007||0x1f4;return function(_0x351208){logger['error'](_0x351208[_0xbcb4('0x29')]);if(_0x351208['name']){delete _0x351208[_0xbcb4('0x2a')];}_0x4ffd45[_0xbcb4('0x1d')](_0xfe007)[_0xbcb4('0x2b')](_0x351208);};}exports['index']=function(_0x3aebdb,_0x1cb967){var _0x4ebaf0={},_0x11db16={},_0x42b4e7={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0xbcb4('0x24')](function(_0x549b0b){_0x11db16[_0xbcb4('0x2c')]=_['keys'](_0x549b0b);_0x11db16['query']=_[_0xbcb4('0x2d')](_0x3aebdb['query']);_0x11db16[_0xbcb4('0x2e')]=_['intersection'](_0x11db16[_0xbcb4('0x2c')],_0x11db16[_0xbcb4('0x2f')]);_0x4ebaf0[_0xbcb4('0x30')]=_['intersection'](_0x11db16['model'],qs[_0xbcb4('0x31')](_0x3aebdb[_0xbcb4('0x2f')][_0xbcb4('0x31')]));_0x4ebaf0[_0xbcb4('0x30')]=_0x4ebaf0[_0xbcb4('0x30')][_0xbcb4('0x32')]?_0x4ebaf0[_0xbcb4('0x30')]:_0x11db16[_0xbcb4('0x2c')];if(!_0x3aebdb[_0xbcb4('0x2f')][_0xbcb4('0x33')](_0xbcb4('0x34'))){_0x4ebaf0['limit']=qs['limit'](_0x3aebdb[_0xbcb4('0x2f')]['limit']);_0x4ebaf0['offset']=qs['offset'](_0x3aebdb[_0xbcb4('0x2f')][_0xbcb4('0x1b')]);}_0x4ebaf0[_0xbcb4('0x35')]=qs[_0xbcb4('0x36')](_0x3aebdb[_0xbcb4('0x2f')]['sort']);_0x4ebaf0[_0xbcb4('0x37')]=qs[_0xbcb4('0x2e')](_[_0xbcb4('0x38')](_0x3aebdb['query'],_0x11db16['filters']),_0x549b0b);if(_0x3aebdb['query'][_0xbcb4('0x39')]){_0x4ebaf0[_0xbcb4('0x37')]=_[_0xbcb4('0x3a')](_0x4ebaf0[_0xbcb4('0x37')],{'$or':_[_0xbcb4('0x3b')](_0x4ebaf0[_0xbcb4('0x30')],function(_0x4c0bf5){var _0x58a72e={};_0x58a72e[_0x4c0bf5]={'$like':'%'+_0x3aebdb[_0xbcb4('0x2f')]['filter']+'%'};return _0x58a72e;})});}_0x4ebaf0=_[_0xbcb4('0x3a')]({},_0x4ebaf0,_0x3aebdb[_0xbcb4('0x3c')]);var _0x974e3b={'where':_0x4ebaf0[_0xbcb4('0x37')]};return db[_0xbcb4('0x3d')]['count'](_0x974e3b)[_0xbcb4('0x24')](function(_0xea8c00){_0x42b4e7[_0xbcb4('0x3e')]=_0xea8c00;if(_0x3aebdb[_0xbcb4('0x2f')][_0xbcb4('0x3f')]){_0x4ebaf0[_0xbcb4('0x40')]=[{'all':!![]}];}return db[_0xbcb4('0x3d')][_0xbcb4('0x41')](_0x4ebaf0);})[_0xbcb4('0x24')](function(_0x47d610){_0x42b4e7['rows']=_0x47d610;return _0x42b4e7;})[_0xbcb4('0x24')](respondWithFilteredResult(_0x1cb967,_0x4ebaf0))[_0xbcb4('0x42')](handleError(_0x1cb967,null));})[_0xbcb4('0x42')](handleError(_0x1cb967,null));};exports[_0xbcb4('0x43')]=function(_0x2e3279,_0x36e0c9){var _0x58eede={'raw':![],'where':{'id':_0x2e3279[_0xbcb4('0x44')]['id']}},_0x2c2b27={};_0x2c2b27[_0xbcb4('0x2c')]=_[_0xbcb4('0x2d')](db[_0xbcb4('0x3d')]['rawAttributes']);_0x2c2b27[_0xbcb4('0x2f')]=_[_0xbcb4('0x2d')](_0x2e3279[_0xbcb4('0x2f')]);_0x2c2b27[_0xbcb4('0x2e')]=_['intersection'](_0x2c2b27[_0xbcb4('0x2c')],_0x2c2b27[_0xbcb4('0x2f')]);_0x58eede[_0xbcb4('0x30')]=_[_0xbcb4('0x45')](_0x2c2b27[_0xbcb4('0x2c')],qs[_0xbcb4('0x31')](_0x2e3279['query'][_0xbcb4('0x31')]));_0x58eede[_0xbcb4('0x30')]=_0x58eede['attributes'][_0xbcb4('0x32')]?_0x58eede['attributes']:_0x2c2b27[_0xbcb4('0x2c')];if(_0x2e3279[_0xbcb4('0x2f')][_0xbcb4('0x3f')]){_0x58eede[_0xbcb4('0x40')]=[{'all':!![]}];}_0x58eede=_['merge']({},_0x58eede,_0x2e3279['options']);return db['CmCompany'][_0xbcb4('0x46')](_0x58eede)[_0xbcb4('0x24')](handleEntityNotFound(_0x36e0c9,null))[_0xbcb4('0x24')](respondWithResult(_0x36e0c9,null))[_0xbcb4('0x42')](handleError(_0x36e0c9,null));};exports['create']=function(_0x1528b5,_0x51b5a0){return db['CmCompany']['create'](_0x1528b5[_0xbcb4('0x47')],{})[_0xbcb4('0x24')](function(_0x1f4002){var _0x49e976=_0x1528b5[_0xbcb4('0x48')][_0xbcb4('0x26')]({'plain':!![]});if(!_0x49e976)throw new Error(_0xbcb4('0x49'));if(_0x49e976[_0xbcb4('0x4a')]===_0xbcb4('0x48')){var _0x4eadd0=_0x1f4002[_0xbcb4('0x26')]({'plain':!![]});var _0x2b2364=_0xbcb4('0x27');return db[_0xbcb4('0x4b')][_0xbcb4('0x46')]({'where':{'name':_0x2b2364,'userProfileId':_0x49e976[_0xbcb4('0x4c')]},'raw':!![]})[_0xbcb4('0x24')](function(_0x4396fb){if(_0x4396fb&&_0x4396fb[_0xbcb4('0x4d')]===0x0){return db[_0xbcb4('0x28')][_0xbcb4('0x4e')]({'name':_0x4eadd0[_0xbcb4('0x2a')],'resourceId':_0x4eadd0['id'],'type':_0x4396fb['name'],'sectionId':_0x4396fb['id']},{})[_0xbcb4('0x24')](function(){return _0x1f4002;});}else{return _0x1f4002;}})['catch'](function(_0xa69520){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa69520);throw _0xa69520;});}return _0x1f4002;})['then'](respondWithResult(_0x51b5a0,0xc9))[_0xbcb4('0x42')](handleError(_0x51b5a0,null));};exports[_0xbcb4('0x23')]=function(_0x2ace9d,_0xf95049){if(_0x2ace9d['body']['id']){delete _0x2ace9d[_0xbcb4('0x47')]['id'];}return db['CmCompany'][_0xbcb4('0x46')]({'where':{'id':_0x2ace9d[_0xbcb4('0x44')]['id']}})[_0xbcb4('0x24')](handleEntityNotFound(_0xf95049,null))[_0xbcb4('0x24')](saveUpdates(_0x2ace9d[_0xbcb4('0x47')],null))[_0xbcb4('0x24')](respondWithResult(_0xf95049,null))[_0xbcb4('0x42')](handleError(_0xf95049,null));};exports['destroy']=function(_0x1dafc3,_0x5c305e){return db['CmCompany'][_0xbcb4('0x46')]({'where':{'id':_0x1dafc3['params']['id']}})[_0xbcb4('0x24')](handleEntityNotFound(_0x5c305e,null))[_0xbcb4('0x24')](removeEntity(_0x5c305e,null))[_0xbcb4('0x42')](handleError(_0x5c305e,null));};exports[_0xbcb4('0x4f')]=function(_0x5addea,_0xa96541){return db[_0xbcb4('0x3d')][_0xbcb4('0x4f')]()[_0xbcb4('0x24')](respondWithResult(_0xa96541,null))[_0xbcb4('0x42')](handleError(_0xa96541,null));};exports['addContacts']=function(_0x3c2026,_0x57a8b4,_0x3e25fe){return db[_0xbcb4('0x50')][_0xbcb4('0x46')]({'where':{'id':_0x3c2026[_0xbcb4('0x44')]['id']}})['then'](handleEntityNotFound(_0x57a8b4,null))[_0xbcb4('0x24')](function(_0x31b758){if(_0x31b758){return _0x31b758[_0xbcb4('0x51')](_0x3c2026[_0xbcb4('0x47')][_0xbcb4('0x52')],_[_0xbcb4('0x53')](_0x3c2026[_0xbcb4('0x47')],[_0xbcb4('0x52'),'id'])||{});}})[_0xbcb4('0x24')](respondWithResult(_0x57a8b4,null))[_0xbcb4('0x42')](handleError(_0x57a8b4,null));};exports[_0xbcb4('0x54')]=function(_0x64979f,_0x4219b2,_0x4d26d1){var _0x161b4e={};var _0x53d7b2={};var _0x515e41;var _0xbd796b;return db[_0xbcb4('0x3d')][_0xbcb4('0x55')]({'where':{'id':_0x64979f[_0xbcb4('0x44')]['id']}})[_0xbcb4('0x24')](handleEntityNotFound(_0x4219b2,null))['then'](function(_0x5b2106){if(_0x5b2106){_0x515e41=_0x5b2106;_0x53d7b2[_0xbcb4('0x2c')]=_[_0xbcb4('0x2d')](db[_0xbcb4('0x50')][_0xbcb4('0x56')]);_0x53d7b2[_0xbcb4('0x2f')]=_[_0xbcb4('0x2d')](_0x64979f[_0xbcb4('0x2f')]);_0x53d7b2[_0xbcb4('0x2e')]=_[_0xbcb4('0x45')](_0x53d7b2['model'],_0x53d7b2[_0xbcb4('0x2f')]);_0x161b4e['attributes']=_[_0xbcb4('0x45')](_0x53d7b2[_0xbcb4('0x2c')],qs['fields'](_0x64979f[_0xbcb4('0x2f')][_0xbcb4('0x31')]));_0x161b4e[_0xbcb4('0x30')]=_0x161b4e['attributes']['length']?_0x161b4e[_0xbcb4('0x30')]:_0x53d7b2[_0xbcb4('0x2c')];_0x161b4e['order']=qs['sort'](_0x64979f[_0xbcb4('0x2f')]['sort']);_0x161b4e[_0xbcb4('0x37')]=qs[_0xbcb4('0x2e')](_['pick'](_0x64979f['query'],_0x53d7b2[_0xbcb4('0x2e')]));if(_0x64979f[_0xbcb4('0x2f')][_0xbcb4('0x39')]){_0x161b4e[_0xbcb4('0x37')]=_['merge'](_0x161b4e[_0xbcb4('0x37')],{'$or':_['map'](_0x161b4e[_0xbcb4('0x30')],function(_0x166619){var _0x704371={};_0x704371[_0x166619]={'$like':'%'+_0x64979f[_0xbcb4('0x2f')][_0xbcb4('0x39')]+'%'};return _0x704371;})});}_0x161b4e=_['merge']({},_0x161b4e,_0x64979f['options']);return _0x515e41[_0xbcb4('0x54')](_0x161b4e);}})[_0xbcb4('0x24')](function(_0x206ac6){if(_0x206ac6){_0xbd796b=_0x206ac6[_0xbcb4('0x32')];if(!_0x64979f['query'][_0xbcb4('0x33')](_0xbcb4('0x34'))){_0x161b4e[_0xbcb4('0x1c')]=qs[_0xbcb4('0x1c')](_0x64979f[_0xbcb4('0x2f')][_0xbcb4('0x1c')]);_0x161b4e[_0xbcb4('0x1b')]=qs[_0xbcb4('0x1b')](_0x64979f['query'][_0xbcb4('0x1b')]);}return _0x515e41[_0xbcb4('0x54')](_0x161b4e);}})[_0xbcb4('0x24')](function(_0x2520e6){if(_0x2520e6){return _0x2520e6?{'count':_0xbd796b,'rows':_0x2520e6}:null;}})['then'](respondWithResult(_0x4219b2,null))[_0xbcb4('0x42')](handleError(_0x4219b2,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6d45829..137bdd2 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 _0xf081=['lodash','../../config/logger','api','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xf081,0xc8));var _0x1f08=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xf081[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x1f08('0x0'));var util=require('util');var logger=require(_0x1f08('0x1'))(_0x1f08('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1f08('0x3'));var config=require(_0x1f08('0x4'));var attributes=require(_0x1f08('0x5'));module[_0x1f08('0x6')]=function(_0x870b79,_0xb9125c){return _0x870b79[_0x1f08('0x7')](_0x1f08('0x8'),attributes,{'tableName':_0x1f08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99e3=['rimraf','./cmCompany.attributes','exports','define','CmCompany','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x99e3,0x1b5));var _0x399e=function(_0x13a6b2,_0x44736a){_0x13a6b2=_0x13a6b2-0x0;var _0x329bcf=_0x99e3[_0x13a6b2];return _0x329bcf;};'use strict';var _=require(_0x399e('0x0'));var util=require(_0x399e('0x1'));var logger=require(_0x399e('0x2'))(_0x399e('0x3'));var moment=require('moment');var BPromise=require(_0x399e('0x4'));var rp=require(_0x399e('0x5'));var fs=require('fs');var path=require(_0x399e('0x6'));var rimraf=require(_0x399e('0x7'));var config=require('../../config/environment');var attributes=require(_0x399e('0x8'));module[_0x399e('0x9')]=function(_0x280375,_0x16be2d){return _0x280375[_0x399e('0xa')](_0x399e('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 5673ed7..9856a31 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 _0x02d2=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x4e95fb,_0x50c9b2){var _0x167bc7=function(_0x56c97d){while(--_0x56c97d){_0x4e95fb['push'](_0x4e95fb['shift']());}};_0x167bc7(++_0x50c9b2);}(_0x02d2,0x18a));var _0x202d=function(_0x3216d1,_0x247e46){_0x3216d1=_0x3216d1-0x0;var _0x4a231c=_0x02d2[_0x3216d1];return _0x4a231c;};'use strict';var _=require(_0x202d('0x0'));var util=require(_0x202d('0x1'));var moment=require(_0x202d('0x2'));var BPromise=require('bluebird');var rs=require(_0x202d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x202d('0x4'))['db'];var utils=require(_0x202d('0x5'));var logger=require('../../config/logger')(_0x202d('0x6'));var config=require(_0x202d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x202d('0x8')][_0x202d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c2e11,_0x22cee9,_0x497ead){return new BPromise(function(_0x184007,_0x288e43){return client[_0x202d('0xa')](_0x4c2e11,_0x497ead)[_0x202d('0xb')](function(_0x46918c){logger['info'](_0x202d('0xc'),_0x22cee9,_0x202d('0xd'));logger[_0x202d('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x22cee9,_0x202d('0xd'),JSON[_0x202d('0xf')](_0x46918c));if(_0x46918c[_0x202d('0x10')]){if(_0x46918c['error'][_0x202d('0x11')]===0x1f4){logger[_0x202d('0x10')]('CmCompany,\x20%s,\x20%s',_0x22cee9,_0x46918c[_0x202d('0x10')][_0x202d('0x12')]);return _0x288e43(_0x46918c['error']['message']);}logger[_0x202d('0x10')]('CmCompany,\x20%s,\x20%s',_0x22cee9,_0x46918c[_0x202d('0x10')][_0x202d('0x12')]);return _0x184007(_0x46918c[_0x202d('0x10')][_0x202d('0x12')]);}else{logger[_0x202d('0x13')](_0x202d('0xc'),_0x22cee9,_0x202d('0xd'));_0x184007(_0x46918c[_0x202d('0x14')][_0x202d('0x12')]);}})[_0x202d('0x15')](function(_0x260766){logger['error'](_0x202d('0xc'),_0x22cee9,_0x260766);_0x288e43(_0x260766);});});} \ No newline at end of file +var _0x479c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x479c,0x15e));var _0xc479=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x479c[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xc479('0x0'));var util=require(_0xc479('0x1'));var moment=require(_0xc479('0x2'));var BPromise=require(_0xc479('0x3'));var rs=require(_0xc479('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc479('0x5'))['db'];var utils=require(_0xc479('0x6'));var logger=require(_0xc479('0x7'))(_0xc479('0x8'));var config=require('../../config/environment');var jayson=require(_0xc479('0x9'));var client=jayson['client'][_0xc479('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9adf,_0x10b2bc,_0x43f20b){return new BPromise(function(_0x83fd93,_0x4d49af){return client[_0xc479('0xb')](_0x3d9adf,_0x43f20b)[_0xc479('0xc')](function(_0x403f6f){logger[_0xc479('0xd')](_0xc479('0xe'),_0x10b2bc,_0xc479('0xf'));logger['debug'](_0xc479('0x10'),_0x10b2bc,'request\x20sent',JSON[_0xc479('0x11')](_0x403f6f));if(_0x403f6f[_0xc479('0x12')]){if(_0x403f6f[_0xc479('0x12')][_0xc479('0x13')]===0x1f4){logger[_0xc479('0x12')](_0xc479('0xe'),_0x10b2bc,_0x403f6f[_0xc479('0x12')][_0xc479('0x14')]);return _0x4d49af(_0x403f6f[_0xc479('0x12')][_0xc479('0x14')]);}logger['error'](_0xc479('0xe'),_0x10b2bc,_0x403f6f['error'][_0xc479('0x14')]);return _0x83fd93(_0x403f6f[_0xc479('0x12')][_0xc479('0x14')]);}else{logger[_0xc479('0xd')](_0xc479('0xe'),_0x10b2bc,_0xc479('0xf'));_0x83fd93(_0x403f6f[_0xc479('0x15')][_0xc479('0x14')]);}})['catch'](function(_0x195ef3){logger[_0xc479('0x12')](_0xc479('0xe'),_0x10b2bc,_0x195ef3);_0x4d49af(_0x195ef3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8a1b6b7..51d180d 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(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','addContacts','put','update','destroy','exports','path','connect-timeout'];(function(_0x164ebe,_0x1f6a00){var _0x170934=function(_0x26dac2){while(--_0x26dac2){_0x164ebe['push'](_0x164ebe['shift']());}};_0x170934(++_0x1f6a00);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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('./cmCompany.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('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0xe')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);router['delete'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);module[_0x49c4('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 82cfcec..88710fd 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 _0xcaf0=['INTEGER','DATE','NOW','lodash','STRING','TEXT'];(function(_0xcf1ad7,_0x329d48){var _0x20d6e4=function(_0x3ad117){while(--_0x3ad117){_0xcf1ad7['push'](_0xcf1ad7['shift']());}};_0x20d6e4(++_0x329d48);}(_0xcaf0,0xf9));var _0x0caf=function(_0x2adad8,_0x2215b3){_0x2adad8=_0x2adad8-0x0;var _0x25cc90=_0xcaf0[_0x2adad8];return _0x25cc90;};'use strict';var _=require(_0x0caf('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x0caf('0x1')]},'postalCode':{'type':Sequelize[_0x0caf('0x1')]},'city':{'type':Sequelize[_0x0caf('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x0caf('0x1')]},'description':{'type':Sequelize[_0x0caf('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x0caf('0x1')]},'email':{'type':Sequelize[_0x0caf('0x1')]},'url':{'type':Sequelize[_0x0caf('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x0caf('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x0caf('0x1')]},'teams':{'type':Sequelize[_0x0caf('0x1')]},'viber':{'type':Sequelize[_0x0caf('0x1')]},'line':{'type':Sequelize[_0x0caf('0x1')]},'wechat':{'type':Sequelize[_0x0caf('0x1')]},'telegram':{'type':Sequelize[_0x0caf('0x1')]},'UserId':{'type':Sequelize[_0x0caf('0x3')]},'priority':{'type':Sequelize[_0x0caf('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0caf('0x4')],'defaultValue':Sequelize[_0x0caf('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x0caf('0x3')]}}; \ No newline at end of file +var _0x0854=['lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','NOW'];(function(_0x4e0dd6,_0x3c28bc){var _0x59ff85=function(_0x217af5){while(--_0x217af5){_0x4e0dd6['push'](_0x4e0dd6['shift']());}};_0x59ff85(++_0x3c28bc);}(_0x0854,0xd9));var _0x4085=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0854[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4085('0x0'));var Sequelize=require('sequelize');module[_0x4085('0x1')]={'firstName':{'type':Sequelize[_0x4085('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x4085('0x2')]},'postalCode':{'type':Sequelize[_0x4085('0x2')]},'city':{'type':Sequelize[_0x4085('0x2')]},'country':{'type':Sequelize[_0x4085('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4085('0x3')]},'phone':{'type':Sequelize[_0x4085('0x2')]},'mobile':{'type':Sequelize[_0x4085('0x2')]},'fax':{'type':Sequelize[_0x4085('0x2')]},'email':{'type':Sequelize[_0x4085('0x2')]},'url':{'type':Sequelize[_0x4085('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x4085('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x4085('0x2')]},'viber':{'type':Sequelize[_0x4085('0x2')]},'line':{'type':Sequelize[_0x4085('0x2')]},'wechat':{'type':Sequelize[_0x4085('0x2')]},'telegram':{'type':Sequelize[_0x4085('0x2')]},'UserId':{'type':Sequelize[_0x4085('0x4')]},'priority':{'type':Sequelize[_0x4085('0x4')](0x2)[_0x4085('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x4085('0x6')]},'dialTimezone':{'type':Sequelize[_0x4085('0x2')]},'utcOffset':{'type':Sequelize[_0x4085('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 00a5eff..4806439 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 _0xf8e8=['rows','CmHopperHistory','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','firstName','No\x20firstName\x20column\x20specified','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','localhost','./cmContact.socket','register','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','push','CmCustomField','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','where','field','color','from','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','expr','search','parseSearch','sqlOperator','conditions','Tag','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','datetime','castTo','DATE','buildExpression','text','start','map','filter','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','having','t.id\x20IN\x20?','resolve','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','toString','sequelize','merge','c.firstName','c.fax','c.email','c.ListId','c.deletedAt','TagIds','Tags','catch','find','params','columnName','displayName','alias','body','get','mergeWith','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','update','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','join','create','each','duplicates','$or','findOrCreate','spread','show','$and','findAll','format','cf_%d','omit','pickBy','setFields','id\x20=\x20?','toParam','phone','findOne','sort','pick','options','getTags','nolimit','setTags','ids','getHoppers','rawAttributes','ContactId','includeAll','include'];(function(_0x14eeb6,_0x7a6352){var _0x34e036=function(_0x49422f){while(--_0x49422f){_0x14eeb6['push'](_0x14eeb6['shift']());}};_0x34e036(++_0x7a6352);}(_0xf8e8,0x10d));var _0x8f8e=function(_0x178fbe,_0x33f0df){_0x178fbe=_0x178fbe-0x0;var _0x3fb21e=_0xf8e8[_0x178fbe];return _0x3fb21e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8f8e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f8e('0x1'));var jsonpatch=require(_0x8f8e('0x2'));var rp=require(_0x8f8e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8f8e('0x4'));var path=require(_0x8f8e('0x5'));var sox=require(_0x8f8e('0x6'));var csv=require(_0x8f8e('0x7'));var ejs=require(_0x8f8e('0x8'));var fs=require('fs');var _=require(_0x8f8e('0x9'));var squel=require(_0x8f8e('0xa'));var crypto=require(_0x8f8e('0xb'));var jsforce=require(_0x8f8e('0xc'));var deskjs=require(_0x8f8e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8f8e('0xe'));var Papa=require(_0x8f8e('0xf'));var Redis=require(_0x8f8e('0x10'));var authService=require(_0x8f8e('0x11'));var qs=require(_0x8f8e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f8e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8f8e('0x14'));var config=require(_0x8f8e('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8f8e('0x16')](config[_0x8f8e('0x17')],{'host':_0x8f8e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f8e('0x17')]));require(_0x8f8e('0x19'))[_0x8f8e('0x1a')](socket);function respondWithStatusCode(_0x313483,_0x42d721){_0x42d721=_0x42d721||0xcc;return function(_0x19ac1c){if(_0x19ac1c){return _0x313483['sendStatus'](_0x42d721);}return _0x313483[_0x8f8e('0x1b')](_0x42d721)[_0x8f8e('0x1c')]();};}function respondWithResult(_0x26ec22,_0x5518a0){_0x5518a0=_0x5518a0||0xc8;return function(_0x2a1213){if(_0x2a1213){return _0x26ec22[_0x8f8e('0x1b')](_0x5518a0)[_0x8f8e('0x1d')](_0x2a1213);}};}function respondWithFilteredResult(_0xa997a9,_0x2d7f8a){return function(_0x54e226){if(_0x54e226){var _0x84a4e4=_0x54e226[_0x8f8e('0x1e')],_0x5052ed=_0x2d7f8a[_0x8f8e('0x1f')],_0x1d3322=_0x2d7f8a[_0x8f8e('0x1f')]+_0x2d7f8a[_0x8f8e('0x20')],_0x412639;if(_0x1d3322>=_0x84a4e4){_0x1d3322=_0x84a4e4;_0x412639=0xc8;}else{_0x412639=0xce;}_0xa997a9[_0x8f8e('0x1b')](_0x412639);return _0xa997a9[_0x8f8e('0x21')]('Content-Range',_0x5052ed+'-'+_0x1d3322+'/'+_0x84a4e4)[_0x8f8e('0x1d')](_0x54e226);}return null;};}function patchUpdates(_0x3f18df){return function(_0x137e31){try{jsonpatch[_0x8f8e('0x22')](_0x137e31,_0x3f18df,!![]);}catch(_0x874869){return BPromise[_0x8f8e('0x23')](_0x874869);}return _0x137e31[_0x8f8e('0x24')]();};}function saveUpdates(_0xa20c09,_0x48e714){return function(_0x34a205){if(_0x34a205){return _0x34a205['update'](_0xa20c09)[_0x8f8e('0x25')](function(_0x23d389){return _0x23d389;});}return null;};}function removeEntity(_0x5ce41b,_0x4653d6){return function(_0x38382f){if(_0x38382f){return _0x38382f[_0x8f8e('0x26')]()[_0x8f8e('0x25')](function(){_0x5ce41b['status'](0xcc)[_0x8f8e('0x1c')]();});}};}function handleEntityNotFound(_0x3b2b25,_0x4279a1){return function(_0x5d808a){if(!_0x5d808a){_0x3b2b25[_0x8f8e('0x27')](0x194);}return _0x5d808a;};}function handleError(_0x540d3b,_0x4d54fb){_0x4d54fb=_0x4d54fb||0x1f4;return function(_0x24974d){logger['error'](_0x24974d[_0x8f8e('0x28')]);if(_0x24974d[_0x8f8e('0x29')]){delete _0x24974d[_0x8f8e('0x29')];}_0x540d3b['status'](_0x4d54fb)[_0x8f8e('0x2a')](_0x24974d);};}exports[_0x8f8e('0x2b')]=function(_0x38d3b7,_0xd456b8){var _0x4524a8={},_0x307159={},_0x274825={'count':0x0,'rows':[]};return db[_0x8f8e('0x2c')][_0x8f8e('0x2d')]()[_0x8f8e('0x25')](function(_0x4788c4){var _0x3bd348=[];for(var _0x516f25=0x0;_0x516f250x1){_0xd2efb9['or'](_0x8f8e('0x66'),qs[_0x8f8e('0x67')](_0x501e92),null);}else{if(qs[_0x8f8e('0x68')](_0x501e92)){_0xd2efb9['or'](_0x8f8e('0x69'),_0x501e92+'%');_0xd2efb9['or']('c.phone\x20LIKE\x20?',_0x501e92+'%');_0xd2efb9['or'](_0x8f8e('0x6a'),_0x501e92+'%');_0xd2efb9['or']('c.fax\x20LIKE\x20?',_0x501e92+'%');}else if(qs[_0x8f8e('0x6b')](_0x501e92)){_0xd2efb9['or']('c.email\x20LIKE\x20?',_0x501e92+'%');}else{_0xd2efb9['or'](_0x8f8e('0x6c'),'%'+_0x501e92+'%');_0xd2efb9['or'](_0x8f8e('0x6d'),'%'+_0x501e92+'%');_0xd2efb9['or'](_0x8f8e('0x6e'),'%'+_0x501e92+'%');}}}}_0xa80475[_0x8f8e('0x3e')](_0xd2efb9);_0xa80475[_0x8f8e('0x6f')](_0x8f8e('0x70'));var _0x4c0397={'type':db[_0x8f8e('0x71')][_0x8f8e('0x72')][_0x8f8e('0x73')],'raw':!![]};var _0x4f5561=_0xa80475[_0x8f8e('0x74')]()[_0x8f8e('0x3f')](_0x8f8e('0x70'));if(_0x4524a8[_0x8f8e('0x75')]){_0x4524a8[_0x8f8e('0x75')][_0x8f8e('0x50')](function(_0x1cc720){_0xa80475['order']('c.'+_0x1cc720[0x0],_0x1cc720[0x1]===_0x8f8e('0x76')?![]:!![]);});}if(!_['isEmpty'](_0xf467c4)){_0xa80475[_0x8f8e('0x77')](_0xcc5105);_0x4f5561[_0x8f8e('0x3e')](_0x8f8e('0x78'),_0xf467c4);}BPromise[_0x8f8e('0x79')]()[_0x8f8e('0x25')](function(){if(_0x369914&&!_[_0x8f8e('0x7a')](_0x369914[_0x8f8e('0x4c')],[_0x8f8e('0x3f'),_0x8f8e('0x52')])){return _0x38d3b7['user'][_0x8f8e('0x7b')]({'attributes':['id'],'raw':!![]})[_0x8f8e('0x25')](function(_0x14faf1){if(_[_0x8f8e('0x5e')](_0x14faf1)){_0x4f5561[_0x8f8e('0x3e')]('c.ListId\x20IS\x20NULL');_0xa80475[_0x8f8e('0x3e')](_0x8f8e('0x7c'));}else{_0x4f5561[_0x8f8e('0x3e')](_0x8f8e('0x7d'),_['map'](_0x14faf1,'id'));_0xa80475[_0x8f8e('0x3e')](_0x8f8e('0x7d'),_['map'](_0x14faf1,'id'));}});}else{return;}})['then'](function(){db['sequelize'][_0x8f8e('0x38')](_0x4f5561[_0x8f8e('0x7e')](),_0x4c0397)[_0x8f8e('0x25')](function(_0x12f7ee){_0x274825['count']=_0x12f7ee[_0x8f8e('0x2f')];if(_0x274825[_0x8f8e('0x1e')]===0x0)return[];return db[_0x8f8e('0x7f')][_0x8f8e('0x38')](_0x5d270c['toString'](),_0x4c0397);})[_0x8f8e('0x25')](function(_0x52a51a){_0x46bd54=_['keyBy'](_0x52a51a,'id');_0x4c0397=_[_0x8f8e('0x80')](_0x4c0397,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x38d3b7[_0x8f8e('0x38')][_0x8f8e('0x3c')]){_0x4524a8[_0x8f8e('0x3b')][_0x8f8e('0x50')](function(_0x21e1e1){_0xa80475[_0x8f8e('0x3f')]('c.'+_0x21e1e1);});}else{_0xa80475['field'](_0x8f8e('0x70'));_0xa80475[_0x8f8e('0x3f')](_0x8f8e('0x81'));_0xa80475['field']('c.lastName');_0xa80475[_0x8f8e('0x3f')]('c.phone');_0xa80475[_0x8f8e('0x3f')]('c.mobile');_0xa80475[_0x8f8e('0x3f')](_0x8f8e('0x82'));_0xa80475[_0x8f8e('0x3f')](_0x8f8e('0x83'));_0xa80475[_0x8f8e('0x3f')](_0x8f8e('0x84'));_0xa80475[_0x8f8e('0x3f')](_0x8f8e('0x85'));_0xa80475['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8f8e('0x86'));}if(_0x4524a8['limit'])_0xa80475['limit'](_0x4524a8[_0x8f8e('0x20')]);if(_0x4524a8[_0x8f8e('0x1f')])_0xa80475[_0x8f8e('0x1f')](_0x4524a8[_0x8f8e('0x1f')]);return db['sequelize'][_0x8f8e('0x38')](_0xa80475[_0x8f8e('0x7e')](),_0x4c0397);})['then'](function(_0x22d0da){_0x22d0da['forEach'](function(_0x5ceee7){if(_0x5ceee7[_0x8f8e('0x86')]){_0x5ceee7[_0x8f8e('0x87')]=[];_0x5ceee7['TagIds'][_0x8f8e('0x4f')](',')[_0x8f8e('0x50')](function(_0x39e172){_0x5ceee7['Tags'][_0x8f8e('0x32')](_0x46bd54[_0x39e172]);});}delete _0x5ceee7[_0x8f8e('0x86')];});_0x274825['rows']=_0x22d0da;return _0x274825;})[_0x8f8e('0x25')](respondWithFilteredResult(_0xd456b8,_0x4524a8));});})[_0x8f8e('0x88')](handleError(_0xd456b8,null));};exports[_0x8f8e('0x26')]=function(_0x1e2ef5,_0x22da85){return db[_0x8f8e('0x2c')][_0x8f8e('0x89')]({'where':{'id':_0x1e2ef5[_0x8f8e('0x8a')]['id']}})['then'](handleEntityNotFound(_0x22da85,null))['then'](removeEntity(_0x22da85,null))[_0x8f8e('0x88')](handleError(_0x22da85,null));};exports[_0x8f8e('0x2d')]=function(_0x361a32,_0xd32c76){return db[_0x8f8e('0x2c')][_0x8f8e('0x2d')]()[_0x8f8e('0x25')](function(_0x48a88d){delete _0x48a88d['tags'];for(var _0x2dfc70=0x0;_0x2dfc70=_0x59b1c3){_0xf3b206=_0x59b1c3;_0x388cfc=0xc8;}else{_0x388cfc=0xce;}_0x1ed025[_0x17fc('0x1f')](_0x388cfc);return _0x1ed025[_0x17fc('0x24')](_0x17fc('0x25'),_0x4959e8+'-'+_0xf3b206+'/'+_0x59b1c3)['json'](_0x2da25e);}return null;};}function patchUpdates(_0x94de9a){return function(_0x5b6cc8){try{jsonpatch[_0x17fc('0x26')](_0x5b6cc8,_0x94de9a,!![]);}catch(_0x317e3b){return BPromise[_0x17fc('0x27')](_0x317e3b);}return _0x5b6cc8[_0x17fc('0x28')]();};}function saveUpdates(_0x3cfc81,_0x1a6b27){return function(_0xaa2bea){if(_0xaa2bea){return _0xaa2bea[_0x17fc('0x29')](_0x3cfc81)[_0x17fc('0x2a')](function(_0x444cf8){return _0x444cf8;});}return null;};}function removeEntity(_0x3143c0,_0x17da30){return function(_0x1c4047){if(_0x1c4047){return _0x1c4047[_0x17fc('0x2b')]()['then'](function(){_0x3143c0[_0x17fc('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b89c4,_0x164bef){return function(_0xd17f06){if(!_0xd17f06){_0x5b89c4['sendStatus'](0x194);}return _0xd17f06;};}function handleError(_0x5a7b75,_0x2d6165){_0x2d6165=_0x2d6165||0x1f4;return function(_0x374950){logger[_0x17fc('0x2c')](_0x374950[_0x17fc('0x2d')]);if(_0x374950['name']){delete _0x374950[_0x17fc('0x2e')];}_0x5a7b75['status'](_0x2d6165)['send'](_0x374950);};}exports['index']=function(_0x86a9a6,_0x24092c){var _0x35bab5={},_0x2bf794={},_0x509649={'count':0x0,'rows':[]};return db[_0x17fc('0x2f')][_0x17fc('0x30')]()[_0x17fc('0x2a')](function(_0x3683bf){var _0x140048=[];for(var _0x207eca=0x0;_0x207eca0x1){_0x4b9d1e['or'](_0x17fc('0x70'),qs[_0x17fc('0x71')](_0x40de5f),null);}else{if(qs[_0x17fc('0x72')](_0x40de5f)){_0x4b9d1e['or'](_0x17fc('0x73'),_0x40de5f+'%');_0x4b9d1e['or'](_0x17fc('0x74'),_0x40de5f+'%');_0x4b9d1e['or']('c.mobile\x20LIKE\x20?',_0x40de5f+'%');_0x4b9d1e['or'](_0x17fc('0x75'),_0x40de5f+'%');}else if(qs[_0x17fc('0x76')](_0x40de5f)){_0x4b9d1e['or'](_0x17fc('0x77'),_0x40de5f+'%');}else{_0x4b9d1e['or'](_0x17fc('0x78'),'%'+_0x40de5f+'%');_0x4b9d1e['or'](_0x17fc('0x79'),'%'+_0x40de5f+'%');_0x4b9d1e['or'](_0x17fc('0x77'),'%'+_0x40de5f+'%');}}}}_0x836b9d[_0x17fc('0x43')](_0x4b9d1e);_0x836b9d[_0x17fc('0x7a')](_0x17fc('0x7b'));var _0x58b530={'type':db['Sequelize']['QueryTypes'][_0x17fc('0x7c')],'raw':!![]};var _0x31f7fc=_0x836b9d[_0x17fc('0x7d')]()[_0x17fc('0x46')](_0x17fc('0x7b'));if(_0x35bab5['order']){_0x35bab5['order']['forEach'](function(_0x5c7fff){_0x836b9d[_0x17fc('0x7e')]('c.'+_0x5c7fff[0x0],_0x5c7fff[0x1]==='DESC'?![]:!![]);});}if(!_[_0x17fc('0x67')](_0x2e3395)){_0x836b9d['having'](_0x52abca);_0x31f7fc['where'](_0x17fc('0x7f'),_0x2e3395);}BPromise[_0x17fc('0x80')]()[_0x17fc('0x2a')](function(){if(_0x29367f&&!_[_0x17fc('0x81')](_0x29367f[_0x17fc('0x55')],[_0x17fc('0x46'),'User'])){return _0x86a9a6['user'][_0x17fc('0x82')]({'attributes':['id'],'raw':!![]})[_0x17fc('0x2a')](function(_0x156ea5){if(_[_0x17fc('0x67')](_0x156ea5)){_0x31f7fc[_0x17fc('0x43')](_0x17fc('0x83'));_0x836b9d[_0x17fc('0x43')](_0x17fc('0x83'));}else{_0x31f7fc[_0x17fc('0x43')](_0x17fc('0x69'),_[_0x17fc('0x58')](_0x156ea5,'id'));_0x836b9d[_0x17fc('0x43')]('c.ListId\x20IN\x20?',_[_0x17fc('0x58')](_0x156ea5,'id'));}});}else{return;}})['then'](function(){db[_0x17fc('0x84')]['query'](_0x31f7fc[_0x17fc('0x85')](),_0x58b530)[_0x17fc('0x2a')](function(_0x3b2702){_0x509649[_0x17fc('0x21')]=_0x3b2702['length'];if(_0x509649[_0x17fc('0x21')]===0x0)return[];return db[_0x17fc('0x84')]['query'](_0x3bbe0f[_0x17fc('0x85')](),_0x58b530);})[_0x17fc('0x2a')](function(_0x1caad6){_0xa72d9f=_['keyBy'](_0x1caad6,'id');_0x58b530=_['merge'](_0x58b530,{'model':db[_0x17fc('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x86a9a6[_0x17fc('0x3b')][_0x17fc('0x3f')]){_0x35bab5[_0x17fc('0x3e')]['forEach'](function(_0x57fdd1){_0x836b9d[_0x17fc('0x46')]('c.'+_0x57fdd1);});}else{_0x836b9d[_0x17fc('0x46')](_0x17fc('0x7b'));_0x836b9d['field'](_0x17fc('0x86'));_0x836b9d[_0x17fc('0x46')]('c.lastName');_0x836b9d[_0x17fc('0x46')](_0x17fc('0x87'));_0x836b9d['field']('c.mobile');_0x836b9d[_0x17fc('0x46')]('c.fax');_0x836b9d[_0x17fc('0x46')](_0x17fc('0x88'));_0x836b9d[_0x17fc('0x46')](_0x17fc('0x89'));_0x836b9d[_0x17fc('0x46')]('c.deletedAt');_0x836b9d[_0x17fc('0x46')](_0x17fc('0x8a'),_0x17fc('0x8b'));}if(_0x35bab5[_0x17fc('0x23')])_0x836b9d[_0x17fc('0x23')](_0x35bab5[_0x17fc('0x23')]);if(_0x35bab5['offset'])_0x836b9d['offset'](_0x35bab5['offset']);return db[_0x17fc('0x84')]['query'](_0x836b9d['toString'](),_0x58b530);})[_0x17fc('0x2a')](function(_0x285ff0){_0x285ff0[_0x17fc('0x68')](function(_0x40bfc7){if(_0x40bfc7[_0x17fc('0x8b')]){_0x40bfc7[_0x17fc('0x8c')]=[];_0x40bfc7[_0x17fc('0x8b')][_0x17fc('0x57')](',')[_0x17fc('0x68')](function(_0x20be05){_0x40bfc7[_0x17fc('0x8c')][_0x17fc('0x34')](_0xa72d9f[_0x20be05]);});}delete _0x40bfc7['TagIds'];});_0x509649[_0x17fc('0x8d')]=_0x285ff0;return _0x509649;})[_0x17fc('0x2a')](respondWithFilteredResult(_0x24092c,_0x35bab5));});})[_0x17fc('0x8e')](handleError(_0x24092c,null));};exports[_0x17fc('0x2b')]=function(_0xc795dd,_0x1f1ebf){return db[_0x17fc('0x2f')]['find']({'where':{'id':_0xc795dd[_0x17fc('0x8f')]['id']}})[_0x17fc('0x2a')](handleEntityNotFound(_0x1f1ebf,null))['then'](removeEntity(_0x1f1ebf,null))[_0x17fc('0x8e')](handleError(_0x1f1ebf,null));};exports[_0x17fc('0x30')]=function(_0x9b1a95,_0x1dfc4f){return db[_0x17fc('0x2f')][_0x17fc('0x30')]()[_0x17fc('0x2a')](function(_0x3e433e){delete _0x3e433e[_0x17fc('0x90')];for(var _0x57d738=0x0;_0x57d738{}\s\\|]/g,'-');_0x1f692b(null,util['format'](_0xaa41('0x20'),path[_0xaa41('0x21')](_0x2bf794[_0xaa41('0x22')],path[_0xaa41('0x23')](_0x2bf794[_0xaa41('0x22')])),Date['now'](),path[_0xaa41('0x23')](_0x2bf794[_0xaa41('0x22')])));}})});router[_0xaa41('0x14')](_0xaa41('0x24'),upload[_0xaa41('0x25')](_0xaa41('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16aec5,_0x527cac,_0x493a10){_0x493a10(null,path[_0xaa41('0x1c')](config['root'],'server/files/tmp'));},'filename':function(_0x2d0ac0,_0x9c8c21,_0x392214){_0x9c8c21[_0xaa41('0x22')]=_0x9c8c21[_0xaa41('0x22')][_0xaa41('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x392214(null,util['format'](_0xaa41('0x20'),path[_0xaa41('0x21')](_0x9c8c21[_0xaa41('0x22')],path[_0xaa41('0x23')](_0x9c8c21[_0xaa41('0x22')])),Date[_0xaa41('0x27')](),path[_0xaa41('0x23')](_0x9c8c21[_0xaa41('0x22')])));}})});router['post'](_0xaa41('0x28'),upload['single']('file'),controller[_0xaa41('0x29')]);router[_0xaa41('0x14')]('/upload/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0x2a')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaa41('0x2b')]);router[_0xaa41('0x2c')](_0xaa41('0x2d'),auth[_0xaa41('0xc')](),controller['destroy']);module[_0xaa41('0x2e')]=router; \ No newline at end of file +var _0x4b84=['express','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/jscripty_sessions','getJscriptySessions','merge','post','setTags','diskStorage','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','now','extname','single','uploadCsv','/upload','file','upload','/upload/:id','import','put','/:id','update','delete','exports','multer','util'];(function(_0x4aa7b8,_0xc69b67){var _0x310986=function(_0x1d18e7){while(--_0x1d18e7){_0x4aa7b8['push'](_0x4aa7b8['shift']());}};_0x310986(++_0xc69b67);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x4b84[_0x5da0d9];return _0x4b6d2f;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/describe',auth[_0x44b8('0x7')](),controller['describe']);router[_0x44b8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router[_0x44b8('0x6')](_0x44b8('0x9'),auth['isAuthenticated'](),controller[_0x44b8('0xa')]);router[_0x44b8('0x6')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller[_0x44b8('0xc')]);router[_0x44b8('0x6')](_0x44b8('0xd'),auth['isAuthenticated'](),controller[_0x44b8('0xe')]);router[_0x44b8('0x6')]('/:id/hopper_finals',auth[_0x44b8('0x7')](),controller['getHopperFinals']);router[_0x44b8('0x6')](_0x44b8('0xf'),auth['isAuthenticated'](),controller[_0x44b8('0x10')]);router['post']('/merge',auth[_0x44b8('0x7')](),controller[_0x44b8('0x11')]);router[_0x44b8('0x12')]('/',auth[_0x44b8('0x7')](),controller['create']);router['post']('/create_many',auth[_0x44b8('0x7')](),controller['bulkCreate']);router[_0x44b8('0x12')](_0x44b8('0x9'),auth['isAuthenticated'](),controller[_0x44b8('0x13')]);var upload=multer({'storage':multer[_0x44b8('0x14')]({'destination':function(_0x5103f5,_0x89bc30,_0x3f4688){_0x3f4688(null,path['join'](config[_0x44b8('0x15')],_0x44b8('0x16')));},'filename':function(_0xebfe79,_0x235bdc,_0x102ef9){_0x235bdc[_0x44b8('0x17')]=_0x235bdc[_0x44b8('0x17')][_0x44b8('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x102ef9(null,util[_0x44b8('0x19')](_0x44b8('0x1a'),path[_0x44b8('0x1b')](_0x235bdc[_0x44b8('0x17')],path['extname'](_0x235bdc[_0x44b8('0x17')])),Date[_0x44b8('0x1c')](),path[_0x44b8('0x1d')](_0x235bdc[_0x44b8('0x17')])));}})});router[_0x44b8('0x12')]('/csv',upload[_0x44b8('0x1e')]('file'),controller[_0x44b8('0x1f')]);var upload=multer({'storage':multer[_0x44b8('0x14')]({'destination':function(_0x25a0c1,_0x47689e,_0x230a3d){_0x230a3d(null,path['join'](config[_0x44b8('0x15')],'server/files/tmp'));},'filename':function(_0x41d673,_0x350482,_0x549a26){_0x350482[_0x44b8('0x17')]=_0x350482[_0x44b8('0x17')][_0x44b8('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x549a26(null,util['format'](_0x44b8('0x1a'),path[_0x44b8('0x1b')](_0x350482['originalname'],path[_0x44b8('0x1d')](_0x350482['originalname'])),Date[_0x44b8('0x1c')](),path['extname'](_0x350482['originalname'])));}})});router['post'](_0x44b8('0x20'),upload[_0x44b8('0x1e')](_0x44b8('0x21')),controller[_0x44b8('0x22')]);router[_0x44b8('0x12')](_0x44b8('0x23'),auth[_0x44b8('0x7')](),controller[_0x44b8('0x24')]);router[_0x44b8('0x25')](_0x44b8('0x26'),auth[_0x44b8('0x7')](),controller[_0x44b8('0x27')]);router[_0x44b8('0x28')]('/:id',auth[_0x44b8('0x7')](),controller['destroy']);module[_0x44b8('0x29')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 2f414ac..b586660 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 _0x432b=['INTEGER','STRING','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb432('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xb432('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xb432('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xb432('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xb432('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0xd9c8=['STRING','INTEGER','PHONE','sequelize','exports'];(function(_0x55a76a,_0x2d0203){var _0x45885a=function(_0x4348d5){while(--_0x4348d5){_0x55a76a['push'](_0x55a76a['shift']());}};_0x45885a(++_0x2d0203);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xd9c8[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x8d9c('0x0'));module[_0x8d9c('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x8d9c('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x8d9c('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x8d9c('0x2')],'defaultValue':_0x8d9c('0x4')},'OrderBy':{'type':Sequelize[_0x8d9c('0x3')],'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 e3657ee..a9e3cb9 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 _0xc4bf=['intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','fields','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','map','CmContactHasItem','rawAttributes','fieldName','type','key','keys','query','filters'];(function(_0x345f45,_0x4c7a5a){var _0x278bab=function(_0x53a96c){while(--_0x53a96c){_0x345f45['push'](_0x345f45['shift']());}};_0x278bab(++_0x4c7a5a);}(_0xc4bf,0x65));var _0xfc4b=function(_0x5d81a9,_0x5aaedd){_0x5d81a9=_0x5d81a9-0x0;var _0x1ceac5=_0xc4bf[_0x5d81a9];return _0x1ceac5;};'use strict';var pdf=require(_0xfc4b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfc4b('0x1'));var zipdir=require(_0xfc4b('0x2'));var jsonpatch=require(_0xfc4b('0x3'));var rp=require(_0xfc4b('0x4'));var moment=require('moment');var BPromise=require(_0xfc4b('0x5'));var Mustache=require(_0xfc4b('0x6'));var util=require('util');var path=require(_0xfc4b('0x7'));var sox=require(_0xfc4b('0x8'));var csv=require(_0xfc4b('0x9'));var ejs=require(_0xfc4b('0xa'));var fs=require('fs');var _=require(_0xfc4b('0xb'));var squel=require('squel');var crypto=require(_0xfc4b('0xc'));var jsforce=require(_0xfc4b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc4b('0xe'));var Papa=require(_0xfc4b('0xf'));var Redis=require(_0xfc4b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfc4b('0x11'));var as=require(_0xfc4b('0x12'));var hardwareService=require(_0xfc4b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfc4b('0x14'));var config=require(_0xfc4b('0x15'));var db=require(_0xfc4b('0x16'))['db'];function respondWithStatusCode(_0x1cacbd,_0x2e5ab6){_0x2e5ab6=_0x2e5ab6||0xcc;return function(_0x4f6266){if(_0x4f6266){return _0x1cacbd[_0xfc4b('0x17')](_0x2e5ab6);}return _0x1cacbd[_0xfc4b('0x18')](_0x2e5ab6)[_0xfc4b('0x19')]();};}function respondWithResult(_0x231744,_0x2835d3){_0x2835d3=_0x2835d3||0xc8;return function(_0x13ab2a){if(_0x13ab2a){return _0x231744[_0xfc4b('0x18')](_0x2835d3)[_0xfc4b('0x1a')](_0x13ab2a);}};}function respondWithFilteredResult(_0x5c361d,_0x5b7ae9){return function(_0x225043){if(_0x225043){var _0x47b946=_0x225043[_0xfc4b('0x1b')],_0x34ca80=_0x5b7ae9['offset'],_0x1e28d6=_0x5b7ae9[_0xfc4b('0x1c')]+_0x5b7ae9[_0xfc4b('0x1d')],_0x5ea51f;if(_0x1e28d6>=_0x47b946){_0x1e28d6=_0x47b946;_0x5ea51f=0xc8;}else{_0x5ea51f=0xce;}_0x5c361d['status'](_0x5ea51f);return _0x5c361d[_0xfc4b('0x1e')](_0xfc4b('0x1f'),_0x34ca80+'-'+_0x1e28d6+'/'+_0x47b946)['json'](_0x225043);}return null;};}function patchUpdates(_0x259404){return function(_0x4de0e3){try{jsonpatch[_0xfc4b('0x20')](_0x4de0e3,_0x259404,!![]);}catch(_0xdfb5a8){return BPromise[_0xfc4b('0x21')](_0xdfb5a8);}return _0x4de0e3[_0xfc4b('0x22')]();};}function saveUpdates(_0x30d7db,_0x58967e){return function(_0x1f5ef9){if(_0x1f5ef9){return _0x1f5ef9[_0xfc4b('0x23')](_0x30d7db)['then'](function(_0x304c58){return _0x304c58;});}return null;};}function removeEntity(_0x504176,_0x8ba450){return function(_0xa1edfb){if(_0xa1edfb){return _0xa1edfb[_0xfc4b('0x24')]()[_0xfc4b('0x25')](function(){var _0xa2c6d0=_0xa1edfb[_0xfc4b('0x26')]({'plain':!![]});var _0x166061='CmContactHasItems';return db[_0xfc4b('0x27')][_0xfc4b('0x24')]({'where':{'type':_0x166061,'resourceId':_0xa2c6d0['id']}})[_0xfc4b('0x25')](function(){return _0xa1edfb;});})[_0xfc4b('0x25')](function(){_0x504176[_0xfc4b('0x18')](0xcc)[_0xfc4b('0x19')]();});}};}function handleEntityNotFound(_0x55f5af,_0x27648b){return function(_0x9482c){if(!_0x9482c){_0x55f5af['sendStatus'](0x194);}return _0x9482c;};}function handleError(_0x10a203,_0x19005a){_0x19005a=_0x19005a||0x1f4;return function(_0x4a5aab){logger[_0xfc4b('0x28')](_0x4a5aab['stack']);if(_0x4a5aab[_0xfc4b('0x29')]){delete _0x4a5aab['name'];}_0x10a203['status'](_0x19005a)['send'](_0x4a5aab);};}exports['index']=function(_0x40a643,_0x38bc77){var _0x91dbe={},_0x46e0de={},_0x5e3b4a={'count':0x0,'rows':[]};var _0x37fb78=_[_0xfc4b('0x2a')](db[_0xfc4b('0x2b')][_0xfc4b('0x2c')],function(_0x2a92f0){return{'name':_0x2a92f0[_0xfc4b('0x2d')],'type':_0x2a92f0[_0xfc4b('0x2e')][_0xfc4b('0x2f')]};});_0x46e0de['model']=_['map'](_0x37fb78,_0xfc4b('0x29'));_0x46e0de['query']=_[_0xfc4b('0x30')](_0x40a643[_0xfc4b('0x31')]);_0x46e0de[_0xfc4b('0x32')]=_[_0xfc4b('0x33')](_0x46e0de[_0xfc4b('0x34')],_0x46e0de['query']);_0x91dbe[_0xfc4b('0x35')]=_[_0xfc4b('0x33')](_0x46e0de[_0xfc4b('0x34')],qs['fields'](_0x40a643[_0xfc4b('0x31')]['fields']));_0x91dbe[_0xfc4b('0x35')]=_0x91dbe[_0xfc4b('0x35')][_0xfc4b('0x36')]?_0x91dbe[_0xfc4b('0x35')]:_0x46e0de[_0xfc4b('0x34')];if(!_0x40a643['query'][_0xfc4b('0x37')](_0xfc4b('0x38'))){_0x91dbe[_0xfc4b('0x1d')]=qs['limit'](_0x40a643[_0xfc4b('0x31')][_0xfc4b('0x1d')]);_0x91dbe[_0xfc4b('0x1c')]=qs[_0xfc4b('0x1c')](_0x40a643[_0xfc4b('0x31')][_0xfc4b('0x1c')]);}_0x91dbe[_0xfc4b('0x39')]=qs[_0xfc4b('0x3a')](_0x40a643[_0xfc4b('0x31')]['sort']);_0x91dbe[_0xfc4b('0x3b')]=qs[_0xfc4b('0x32')](_[_0xfc4b('0x3c')](_0x40a643[_0xfc4b('0x31')],_0x46e0de['filters']),_0x37fb78);if(_0x40a643[_0xfc4b('0x31')][_0xfc4b('0x3d')]){_0x91dbe[_0xfc4b('0x3b')]=_[_0xfc4b('0x3e')](_0x91dbe['where'],{'$or':_[_0xfc4b('0x2a')](_0x37fb78,function(_0x5b7e08){if(_0x5b7e08['type']!=='VIRTUAL'){var _0x4b2952={};_0x4b2952[_0x5b7e08[_0xfc4b('0x29')]]={'$like':'%'+_0x40a643[_0xfc4b('0x31')][_0xfc4b('0x3d')]+'%'};return _0x4b2952;}})});}_0x91dbe=_[_0xfc4b('0x3e')]({},_0x91dbe,_0x40a643['options']);var _0x1ffb0e={'where':_0x91dbe[_0xfc4b('0x3b')]};return db[_0xfc4b('0x2b')]['count'](_0x1ffb0e)[_0xfc4b('0x25')](function(_0x340c1f){_0x5e3b4a['count']=_0x340c1f;if(_0x40a643['query'][_0xfc4b('0x3f')]){_0x91dbe[_0xfc4b('0x40')]=[{'all':!![]}];}return db[_0xfc4b('0x2b')]['findAll'](_0x91dbe);})[_0xfc4b('0x25')](function(_0x4d200a){_0x5e3b4a[_0xfc4b('0x41')]=_0x4d200a;return _0x5e3b4a;})['then'](respondWithFilteredResult(_0x38bc77,_0x91dbe))[_0xfc4b('0x42')](handleError(_0x38bc77,null));};exports['show']=function(_0x559fa2,_0x59258c){var _0x357f4c={'raw':!![],'where':{'id':_0x559fa2['params']['id']}},_0x409937={};_0x409937[_0xfc4b('0x34')]=_[_0xfc4b('0x30')](db[_0xfc4b('0x2b')]['rawAttributes']);_0x409937[_0xfc4b('0x31')]=_['keys'](_0x559fa2[_0xfc4b('0x31')]);_0x409937[_0xfc4b('0x32')]=_[_0xfc4b('0x33')](_0x409937['model'],_0x409937[_0xfc4b('0x31')]);_0x357f4c[_0xfc4b('0x35')]=_[_0xfc4b('0x33')](_0x409937[_0xfc4b('0x34')],qs[_0xfc4b('0x43')](_0x559fa2[_0xfc4b('0x31')][_0xfc4b('0x43')]));_0x357f4c[_0xfc4b('0x35')]=_0x357f4c[_0xfc4b('0x35')][_0xfc4b('0x36')]?_0x357f4c[_0xfc4b('0x35')]:_0x409937[_0xfc4b('0x34')];if(_0x559fa2['query'][_0xfc4b('0x3f')]){_0x357f4c['include']=[{'all':!![]}];}_0x357f4c=_[_0xfc4b('0x3e')]({},_0x357f4c,_0x559fa2[_0xfc4b('0x44')]);return db[_0xfc4b('0x2b')][_0xfc4b('0x45')](_0x357f4c)[_0xfc4b('0x25')](handleEntityNotFound(_0x59258c,null))[_0xfc4b('0x25')](respondWithResult(_0x59258c,null))[_0xfc4b('0x42')](handleError(_0x59258c,null));};exports[_0xfc4b('0x46')]=function(_0x1465cd,_0x155df7){return db['CmContactHasItem'][_0xfc4b('0x46')](_0x1465cd['body'],{})[_0xfc4b('0x25')](function(_0x51e9f9){var _0x51da12=_0x1465cd['user']['get']({'plain':!![]});if(!_0x51da12)throw new Error(_0xfc4b('0x47'));if(_0x51da12[_0xfc4b('0x48')]==='user'){var _0x212183=_0x51e9f9[_0xfc4b('0x26')]({'plain':!![]});var _0x21dfb1='CmContactHasItems';return db['UserProfileSection'][_0xfc4b('0x45')]({'where':{'name':_0x21dfb1,'userProfileId':_0x51da12['userProfileId']},'raw':!![]})[_0xfc4b('0x25')](function(_0x829056){if(_0x829056&&_0x829056[_0xfc4b('0x49')]===0x0){return db[_0xfc4b('0x27')][_0xfc4b('0x46')]({'name':_0x212183[_0xfc4b('0x29')],'resourceId':_0x212183['id'],'type':_0x829056['name'],'sectionId':_0x829056['id']},{})[_0xfc4b('0x25')](function(){return _0x51e9f9;});}else{return _0x51e9f9;}})[_0xfc4b('0x42')](function(_0x115bc7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x115bc7);throw _0x115bc7;});}return _0x51e9f9;})['then'](respondWithResult(_0x155df7,0xc9))[_0xfc4b('0x42')](handleError(_0x155df7,null));};exports[_0xfc4b('0x23')]=function(_0x3dfa12,_0x1611cb){if(_0x3dfa12[_0xfc4b('0x4a')]['id']){delete _0x3dfa12[_0xfc4b('0x4a')]['id'];}return db[_0xfc4b('0x2b')][_0xfc4b('0x45')]({'where':{'id':_0x3dfa12[_0xfc4b('0x4b')]['id']}})[_0xfc4b('0x25')](handleEntityNotFound(_0x1611cb,null))[_0xfc4b('0x25')](saveUpdates(_0x3dfa12['body'],null))['then'](respondWithResult(_0x1611cb,null))[_0xfc4b('0x42')](handleError(_0x1611cb,null));};exports[_0xfc4b('0x24')]=function(_0x1b27d3,_0x4dd943){return db[_0xfc4b('0x2b')][_0xfc4b('0x45')]({'where':{'id':_0x1b27d3[_0xfc4b('0x4b')]['id']}})[_0xfc4b('0x25')](handleEntityNotFound(_0x4dd943,null))[_0xfc4b('0x25')](removeEntity(_0x4dd943,null))[_0xfc4b('0x42')](handleError(_0x4dd943,null));}; \ No newline at end of file +var _0x6e1a=['findAll','rows','catch','length','includeAll','find','create','body','user','role','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','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','CmContactHasItem','count'];(function(_0x431e8a,_0x38a16a){var _0x39ee78=function(_0x2e9766){while(--_0x2e9766){_0x431e8a['push'](_0x431e8a['shift']());}};_0x39ee78(++_0x38a16a);}(_0x6e1a,0xfa));var _0xa6e1=function(_0x137487,_0x3010cb){_0x137487=_0x137487-0x0;var _0x5ee9b6=_0x6e1a[_0x137487];return _0x5ee9b6;};'use strict';var pdf=require(_0xa6e1('0x0'));var emlformat=require(_0xa6e1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa6e1('0x2'));var jsonpatch=require(_0xa6e1('0x3'));var rp=require(_0xa6e1('0x4'));var moment=require(_0xa6e1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa6e1('0x6'));var util=require(_0xa6e1('0x7'));var path=require(_0xa6e1('0x8'));var sox=require('sox');var csv=require(_0xa6e1('0x9'));var ejs=require(_0xa6e1('0xa'));var fs=require('fs');var _=require(_0xa6e1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa6e1('0xc'));var deskjs=require(_0xa6e1('0xd'));var toCsv=require(_0xa6e1('0x9'));var querystring=require(_0xa6e1('0xe'));var Papa=require('papaparse');var Redis=require(_0xa6e1('0xf'));var authService=require(_0xa6e1('0x10'));var qs=require(_0xa6e1('0x11'));var as=require(_0xa6e1('0x12'));var hardwareService=require(_0xa6e1('0x13'));var logger=require(_0xa6e1('0x14'))(_0xa6e1('0x15'));var utils=require(_0xa6e1('0x16'));var config=require(_0xa6e1('0x17'));var db=require(_0xa6e1('0x18'))['db'];function respondWithStatusCode(_0x3ba027,_0x3d2b5d){_0x3d2b5d=_0x3d2b5d||0xcc;return function(_0x2fdb3b){if(_0x2fdb3b){return _0x3ba027['sendStatus'](_0x3d2b5d);}return _0x3ba027[_0xa6e1('0x19')](_0x3d2b5d)[_0xa6e1('0x1a')]();};}function respondWithResult(_0x147736,_0x2aeefa){_0x2aeefa=_0x2aeefa||0xc8;return function(_0x5a2d6c){if(_0x5a2d6c){return _0x147736[_0xa6e1('0x19')](_0x2aeefa)[_0xa6e1('0x1b')](_0x5a2d6c);}};}function respondWithFilteredResult(_0x5bc684,_0x130fd4){return function(_0x48f8e5){if(_0x48f8e5){var _0x254c19=_0x48f8e5['count'],_0xc8615c=_0x130fd4['offset'],_0x3f4be4=_0x130fd4[_0xa6e1('0x1c')]+_0x130fd4[_0xa6e1('0x1d')],_0x1964af;if(_0x3f4be4>=_0x254c19){_0x3f4be4=_0x254c19;_0x1964af=0xc8;}else{_0x1964af=0xce;}_0x5bc684[_0xa6e1('0x19')](_0x1964af);return _0x5bc684[_0xa6e1('0x1e')]('Content-Range',_0xc8615c+'-'+_0x3f4be4+'/'+_0x254c19)[_0xa6e1('0x1b')](_0x48f8e5);}return null;};}function patchUpdates(_0xd2f9ac){return function(_0x1b42aa){try{jsonpatch[_0xa6e1('0x1f')](_0x1b42aa,_0xd2f9ac,!![]);}catch(_0x443cfb){return BPromise[_0xa6e1('0x20')](_0x443cfb);}return _0x1b42aa[_0xa6e1('0x21')]();};}function saveUpdates(_0x4e3a21,_0x814e84){return function(_0x497483){if(_0x497483){return _0x497483[_0xa6e1('0x22')](_0x4e3a21)['then'](function(_0x3965f0){return _0x3965f0;});}return null;};}function removeEntity(_0x37f7a2,_0x59686a){return function(_0x576550){if(_0x576550){return _0x576550[_0xa6e1('0x23')]()[_0xa6e1('0x24')](function(){var _0x4b1b5d=_0x576550[_0xa6e1('0x25')]({'plain':!![]});var _0x3e7bc2=_0xa6e1('0x26');return db[_0xa6e1('0x27')][_0xa6e1('0x23')]({'where':{'type':_0x3e7bc2,'resourceId':_0x4b1b5d['id']}})[_0xa6e1('0x24')](function(){return _0x576550;});})[_0xa6e1('0x24')](function(){_0x37f7a2[_0xa6e1('0x19')](0xcc)[_0xa6e1('0x1a')]();});}};}function handleEntityNotFound(_0x30d7e4,_0xa74933){return function(_0x1d3d86){if(!_0x1d3d86){_0x30d7e4['sendStatus'](0x194);}return _0x1d3d86;};}function handleError(_0x593720,_0x5fe9a5){_0x5fe9a5=_0x5fe9a5||0x1f4;return function(_0x11df67){logger[_0xa6e1('0x28')](_0x11df67[_0xa6e1('0x29')]);if(_0x11df67[_0xa6e1('0x2a')]){delete _0x11df67[_0xa6e1('0x2a')];}_0x593720[_0xa6e1('0x19')](_0x5fe9a5)[_0xa6e1('0x2b')](_0x11df67);};}exports['index']=function(_0x3ec183,_0x583c1e){var _0x59a98c={},_0x2fa8cd={},_0x4a0566={'count':0x0,'rows':[]};var _0x427ada=_[_0xa6e1('0x2c')](db['CmContactHasItem'][_0xa6e1('0x2d')],function(_0x48cd64){return{'name':_0x48cd64[_0xa6e1('0x2e')],'type':_0x48cd64[_0xa6e1('0x2f')][_0xa6e1('0x30')]};});_0x2fa8cd[_0xa6e1('0x31')]=_[_0xa6e1('0x2c')](_0x427ada,_0xa6e1('0x2a'));_0x2fa8cd[_0xa6e1('0x32')]=_[_0xa6e1('0x33')](_0x3ec183['query']);_0x2fa8cd[_0xa6e1('0x34')]=_[_0xa6e1('0x35')](_0x2fa8cd[_0xa6e1('0x31')],_0x2fa8cd[_0xa6e1('0x32')]);_0x59a98c[_0xa6e1('0x36')]=_[_0xa6e1('0x35')](_0x2fa8cd[_0xa6e1('0x31')],qs[_0xa6e1('0x37')](_0x3ec183[_0xa6e1('0x32')][_0xa6e1('0x37')]));_0x59a98c[_0xa6e1('0x36')]=_0x59a98c[_0xa6e1('0x36')]['length']?_0x59a98c['attributes']:_0x2fa8cd[_0xa6e1('0x31')];if(!_0x3ec183['query'][_0xa6e1('0x38')](_0xa6e1('0x39'))){_0x59a98c[_0xa6e1('0x1d')]=qs[_0xa6e1('0x1d')](_0x3ec183[_0xa6e1('0x32')][_0xa6e1('0x1d')]);_0x59a98c[_0xa6e1('0x1c')]=qs[_0xa6e1('0x1c')](_0x3ec183[_0xa6e1('0x32')][_0xa6e1('0x1c')]);}_0x59a98c['order']=qs[_0xa6e1('0x3a')](_0x3ec183[_0xa6e1('0x32')]['sort']);_0x59a98c[_0xa6e1('0x3b')]=qs['filters'](_['pick'](_0x3ec183[_0xa6e1('0x32')],_0x2fa8cd[_0xa6e1('0x34')]),_0x427ada);if(_0x3ec183[_0xa6e1('0x32')][_0xa6e1('0x3c')]){_0x59a98c[_0xa6e1('0x3b')]=_[_0xa6e1('0x3d')](_0x59a98c[_0xa6e1('0x3b')],{'$or':_[_0xa6e1('0x2c')](_0x427ada,function(_0x5d79be){if(_0x5d79be['type']!==_0xa6e1('0x3e')){var _0x281fca={};_0x281fca[_0x5d79be['name']]={'$like':'%'+_0x3ec183[_0xa6e1('0x32')]['filter']+'%'};return _0x281fca;}})});}_0x59a98c=_[_0xa6e1('0x3d')]({},_0x59a98c,_0x3ec183[_0xa6e1('0x3f')]);var _0x4a2652={'where':_0x59a98c[_0xa6e1('0x3b')]};return db[_0xa6e1('0x40')][_0xa6e1('0x41')](_0x4a2652)['then'](function(_0x1f401b){_0x4a0566['count']=_0x1f401b;if(_0x3ec183[_0xa6e1('0x32')]['includeAll']){_0x59a98c['include']=[{'all':!![]}];}return db[_0xa6e1('0x40')][_0xa6e1('0x42')](_0x59a98c);})[_0xa6e1('0x24')](function(_0xac62b3){_0x4a0566[_0xa6e1('0x43')]=_0xac62b3;return _0x4a0566;})['then'](respondWithFilteredResult(_0x583c1e,_0x59a98c))[_0xa6e1('0x44')](handleError(_0x583c1e,null));};exports['show']=function(_0x585ae6,_0x24abdf){var _0x170d8d={'raw':!![],'where':{'id':_0x585ae6['params']['id']}},_0x5549ad={};_0x5549ad[_0xa6e1('0x31')]=_[_0xa6e1('0x33')](db[_0xa6e1('0x40')][_0xa6e1('0x2d')]);_0x5549ad[_0xa6e1('0x32')]=_['keys'](_0x585ae6[_0xa6e1('0x32')]);_0x5549ad[_0xa6e1('0x34')]=_['intersection'](_0x5549ad[_0xa6e1('0x31')],_0x5549ad['query']);_0x170d8d[_0xa6e1('0x36')]=_[_0xa6e1('0x35')](_0x5549ad[_0xa6e1('0x31')],qs['fields'](_0x585ae6['query'][_0xa6e1('0x37')]));_0x170d8d['attributes']=_0x170d8d['attributes'][_0xa6e1('0x45')]?_0x170d8d[_0xa6e1('0x36')]:_0x5549ad[_0xa6e1('0x31')];if(_0x585ae6[_0xa6e1('0x32')][_0xa6e1('0x46')]){_0x170d8d['include']=[{'all':!![]}];}_0x170d8d=_[_0xa6e1('0x3d')]({},_0x170d8d,_0x585ae6[_0xa6e1('0x3f')]);return db[_0xa6e1('0x40')][_0xa6e1('0x47')](_0x170d8d)['then'](handleEntityNotFound(_0x24abdf,null))[_0xa6e1('0x24')](respondWithResult(_0x24abdf,null))['catch'](handleError(_0x24abdf,null));};exports[_0xa6e1('0x48')]=function(_0x5467b1,_0x4e4d5c){return db[_0xa6e1('0x40')][_0xa6e1('0x48')](_0x5467b1[_0xa6e1('0x49')],{})[_0xa6e1('0x24')](function(_0x2d1b70){var _0x291a2f=_0x5467b1[_0xa6e1('0x4a')][_0xa6e1('0x25')]({'plain':!![]});if(!_0x291a2f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x291a2f[_0xa6e1('0x4b')]===_0xa6e1('0x4a')){var _0x5b7e81=_0x2d1b70[_0xa6e1('0x25')]({'plain':!![]});var _0x41b163=_0xa6e1('0x26');return db['UserProfileSection'][_0xa6e1('0x47')]({'where':{'name':_0x41b163,'userProfileId':_0x291a2f['userProfileId']},'raw':!![]})[_0xa6e1('0x24')](function(_0x2670d4){if(_0x2670d4&&_0x2670d4[_0xa6e1('0x4c')]===0x0){return db[_0xa6e1('0x27')][_0xa6e1('0x48')]({'name':_0x5b7e81[_0xa6e1('0x2a')],'resourceId':_0x5b7e81['id'],'type':_0x2670d4[_0xa6e1('0x2a')],'sectionId':_0x2670d4['id']},{})[_0xa6e1('0x24')](function(){return _0x2d1b70;});}else{return _0x2d1b70;}})[_0xa6e1('0x44')](function(_0x590299){logger[_0xa6e1('0x28')](_0xa6e1('0x4d'),_0x590299);throw _0x590299;});}return _0x2d1b70;})['then'](respondWithResult(_0x4e4d5c,0xc9))[_0xa6e1('0x44')](handleError(_0x4e4d5c,null));};exports[_0xa6e1('0x22')]=function(_0x1de410,_0x1de310){if(_0x1de410['body']['id']){delete _0x1de410[_0xa6e1('0x49')]['id'];}return db[_0xa6e1('0x40')][_0xa6e1('0x47')]({'where':{'id':_0x1de410['params']['id']}})[_0xa6e1('0x24')](handleEntityNotFound(_0x1de310,null))[_0xa6e1('0x24')](saveUpdates(_0x1de410[_0xa6e1('0x49')],null))['then'](respondWithResult(_0x1de310,null))['catch'](handleError(_0x1de310,null));};exports[_0xa6e1('0x23')]=function(_0x496bf0,_0x1d2f4c){return db['CmContactHasItem'][_0xa6e1('0x47')]({'where':{'id':_0x496bf0[_0xa6e1('0x4e')]['id']}})[_0xa6e1('0x24')](handleEntityNotFound(_0x1d2f4c,null))['then'](removeEntity(_0x1d2f4c,null))[_0xa6e1('0x44')](handleError(_0x1d2f4c,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index fec64d3..8c8dd28 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 _0x4975=['./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ee030,_0x17c9e3){var _0x213134=function(_0x56fa4a){while(--_0x56fa4a){_0x5ee030['push'](_0x5ee030['shift']());}};_0x213134(++_0x17c9e3);}(_0x4975,0x86));var _0x5497=function(_0x2c6354,_0x3c6a08){_0x2c6354=_0x2c6354-0x0;var _0x2c4c89=_0x4975[_0x2c6354];return _0x2c4c89;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5162=['bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x3358d6,_0x27b73e){var _0x11b227=function(_0x56230d){while(--_0x56230d){_0x3358d6['push'](_0x3358d6['shift']());}};_0x11b227(++_0x27b73e);}(_0x5162,0x103));var _0x2516=function(_0xc9df8b,_0x21744d){_0xc9df8b=_0xc9df8b-0x0;var _0x35ca5d=_0x5162[_0xc9df8b];return _0x35ca5d;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2516('0x1'));var rp=require(_0x2516('0x2'));var fs=require('fs');var path=require(_0x2516('0x3'));var rimraf=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));module[_0x2516('0x7')]=function(_0x5b71b5,_0x48f411){return _0x5b71b5['define'](_0x2516('0x8'),attributes,{'tableName':_0x2516('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index a11d770..edbdad9 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 _0xbf1e=['result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xbf1e,0x75));var _0xebf1=function(_0x43b13a,_0x19bf83){_0x43b13a=_0x43b13a-0x0;var _0x10f606=_0xbf1e[_0x43b13a];return _0x10f606;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebf1('0x0'));var BPromise=require('bluebird');var rs=require(_0xebf1('0x1'));var fs=require('fs');var Redis=require(_0xebf1('0x2'));var db=require(_0xebf1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xebf1('0x4'))(_0xebf1('0x5'));var config=require(_0xebf1('0x6'));var jayson=require(_0xebf1('0x7'));var client=jayson[_0xebf1('0x8')][_0xebf1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3019ec,_0x1dd664,_0x5d58a7){return new BPromise(function(_0x3a5521,_0x2ea308){return client[_0xebf1('0xa')](_0x3019ec,_0x5d58a7)[_0xebf1('0xb')](function(_0x5ae3a4){logger[_0xebf1('0xc')](_0xebf1('0xd'),_0x1dd664,_0xebf1('0xe'));logger[_0xebf1('0xf')](_0xebf1('0x10'),_0x1dd664,_0xebf1('0xe'),JSON[_0xebf1('0x11')](_0x5ae3a4));if(_0x5ae3a4[_0xebf1('0x12')]){if(_0x5ae3a4[_0xebf1('0x12')][_0xebf1('0x13')]===0x1f4){logger[_0xebf1('0x12')](_0xebf1('0xd'),_0x1dd664,_0x5ae3a4[_0xebf1('0x12')][_0xebf1('0x14')]);return _0x2ea308(_0x5ae3a4[_0xebf1('0x12')][_0xebf1('0x14')]);}logger[_0xebf1('0x12')](_0xebf1('0xd'),_0x1dd664,_0x5ae3a4[_0xebf1('0x12')][_0xebf1('0x14')]);return _0x3a5521(_0x5ae3a4['error'][_0xebf1('0x14')]);}else{logger['info'](_0xebf1('0xd'),_0x1dd664,_0xebf1('0xe'));_0x3a5521(_0x5ae3a4[_0xebf1('0x15')][_0xebf1('0x14')]);}})[_0xebf1('0x16')](function(_0x33a233){logger[_0xebf1('0x12')](_0xebf1('0xd'),_0x1dd664,_0x33a233);_0x2ea308(_0x33a233);});});} \ No newline at end of file +var _0xeb6a=['rpc','jayson/promise','client','http','then','info','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x2a9400,_0x1140c2){var _0x1936e6=function(_0x14bbfe){while(--_0x14bbfe){_0x2a9400['push'](_0x2a9400['shift']());}};_0x1936e6(++_0x1140c2);}(_0xeb6a,0x1f4));var _0xaeb6=function(_0x49710a,_0xb6de7c){_0x49710a=_0x49710a-0x0;var _0x2e483f=_0xeb6a[_0x49710a];return _0x2e483f;};'use strict';var _=require(_0xaeb6('0x0'));var util=require(_0xaeb6('0x1'));var moment=require(_0xaeb6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaeb6('0x3'));var db=require(_0xaeb6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaeb6('0x5'))(_0xaeb6('0x6'));var config=require('../../config/environment');var jayson=require(_0xaeb6('0x7'));var client=jayson[_0xaeb6('0x8')][_0xaeb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fa527,_0x953300,_0x2c7c55){return new BPromise(function(_0x5bb3a9,_0x27d84b){return client['request'](_0x2fa527,_0x2c7c55)[_0xaeb6('0xa')](function(_0x49cf0e){logger[_0xaeb6('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x953300,'request\x20sent');logger[_0xaeb6('0xc')](_0xaeb6('0xd'),_0x953300,_0xaeb6('0xe'),JSON[_0xaeb6('0xf')](_0x49cf0e));if(_0x49cf0e[_0xaeb6('0x10')]){if(_0x49cf0e[_0xaeb6('0x10')][_0xaeb6('0x11')]===0x1f4){logger[_0xaeb6('0x10')](_0xaeb6('0x12'),_0x953300,_0x49cf0e[_0xaeb6('0x10')]['message']);return _0x27d84b(_0x49cf0e[_0xaeb6('0x10')]['message']);}logger['error'](_0xaeb6('0x12'),_0x953300,_0x49cf0e[_0xaeb6('0x10')][_0xaeb6('0x13')]);return _0x5bb3a9(_0x49cf0e[_0xaeb6('0x10')]['message']);}else{logger[_0xaeb6('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x953300,_0xaeb6('0xe'));_0x5bb3a9(_0x49cf0e[_0xaeb6('0x14')]['message']);}})[_0xaeb6('0x15')](function(_0x158642){logger['error'](_0xaeb6('0x12'),_0x953300,_0x158642);_0x27d84b(_0x158642);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 6bc3a88..9b86be3 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 _0xa8af=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','isAuthenticated','show','create','put','/:id','update','exports','util'];(function(_0x4e0d9d,_0xc84dba){var _0x54addc=function(_0xe1e7cd){while(--_0xe1e7cd){_0x4e0d9d['push'](_0x4e0d9d['shift']());}};_0x54addc(++_0xc84dba);}(_0xa8af,0xfe));var _0xfa8a=function(_0x4c9939,_0xb2ae08){_0x4c9939=_0x4c9939-0x0;var _0x11495b=_0xa8af[_0x4c9939];return _0x11495b;};'use strict';var multer=require('multer');var util=require(_0xfa8a('0x0'));var path=require(_0xfa8a('0x1'));var timeout=require(_0xfa8a('0x2'));var express=require(_0xfa8a('0x3'));var router=express['Router']();var auth=require(_0xfa8a('0x4'));var interaction=require(_0xfa8a('0x5'));var config=require(_0xfa8a('0x6'));var controller=require(_0xfa8a('0x7'));router[_0xfa8a('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa8a('0x9')]);router[_0xfa8a('0x8')]('/:id',auth[_0xfa8a('0xa')](),controller[_0xfa8a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa8a('0xc')]);router[_0xfa8a('0xd')](_0xfa8a('0xe'),auth[_0xfa8a('0xa')](),controller[_0xfa8a('0xf')]);router['delete'](_0xfa8a('0xe'),auth[_0xfa8a('0xa')](),controller['destroy']);module[_0xfa8a('0x10')]=router; \ No newline at end of file +var _0x0b4b=['./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x34889b,_0x5b6d76){var _0x5289a6=function(_0xac841c){while(--_0xac841c){_0x34889b['push'](_0x34889b['shift']());}};_0x5289a6(++_0x5b6d76);}(_0x0b4b,0x174));var _0xb0b4=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x0b4b[_0x2ae2ad];return _0x26dbd7;};'use strict';var multer=require(_0xb0b4('0x0'));var util=require(_0xb0b4('0x1'));var path=require(_0xb0b4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0b4('0x3'));var router=express[_0xb0b4('0x4')]();var auth=require(_0xb0b4('0x5'));var interaction=require(_0xb0b4('0x6'));var config=require(_0xb0b4('0x7'));var controller=require(_0xb0b4('0x8'));router[_0xb0b4('0x9')]('/',auth[_0xb0b4('0xa')](),controller[_0xb0b4('0xb')]);router[_0xb0b4('0x9')](_0xb0b4('0xc'),auth[_0xb0b4('0xa')](),controller['show']);router[_0xb0b4('0xd')]('/',auth['isAuthenticated'](),controller[_0xb0b4('0xe')]);router[_0xb0b4('0xf')](_0xb0b4('0xc'),auth[_0xb0b4('0xa')](),controller[_0xb0b4('0x10')]);router['delete'](_0xb0b4('0xc'),auth[_0xb0b4('0xa')](),controller[_0xb0b4('0x11')]);module[_0xb0b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 88767f0..afda530 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 _0x0cc7=['INTEGER','sequelize','exports'];(function(_0x2e10ec,_0x1e6bd2){var _0x20c62b=function(_0x37f540){while(--_0x37f540){_0x2e10ec['push'](_0x2e10ec['shift']());}};_0x20c62b(++_0x1e6bd2);}(_0x0cc7,0x1e7));var _0x70cc=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x0cc7[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0x70cc('0x0'));module[_0x70cc('0x1')]={'CmContactId':{'type':Sequelize[_0x70cc('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x418d=['INTEGER','sequelize'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x418d,0x1a9));var _0xd418=function(_0x5e4cfa,_0x374000){_0x5e4cfa=_0x5e4cfa-0x0;var _0x516c65=_0x418d[_0x5e4cfa];return _0x516c65;};'use strict';var Sequelize=require(_0xd418('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xd418('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 420cff3..3400ba2 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 _0x321f=['UserProfileResource','error','name','send','index','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','CmContactHasPhone','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','CmContactHasPhones'];(function(_0x39e869,_0x2d7972){var _0x508ddd=function(_0x117815){while(--_0x117815){_0x39e869['push'](_0x39e869['shift']());}};_0x508ddd(++_0x2d7972);}(_0x321f,0x78));var _0xf321=function(_0x3f57db,_0x10e075){_0x3f57db=_0x3f57db-0x0;var _0x8cc430=_0x321f[_0x3f57db];return _0x8cc430;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf321('0x0'));var rimraf=require(_0xf321('0x1'));var zipdir=require(_0xf321('0x2'));var jsonpatch=require(_0xf321('0x3'));var rp=require(_0xf321('0x4'));var moment=require(_0xf321('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf321('0x6'));var util=require('util');var path=require(_0xf321('0x7'));var sox=require('sox');var csv=require(_0xf321('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf321('0x9'));var crypto=require(_0xf321('0xa'));var jsforce=require(_0xf321('0xb'));var deskjs=require(_0xf321('0xc'));var toCsv=require(_0xf321('0x8'));var querystring=require(_0xf321('0xd'));var Papa=require(_0xf321('0xe'));var Redis=require(_0xf321('0xf'));var authService=require(_0xf321('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf321('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf321('0x12'))(_0xf321('0x13'));var utils=require(_0xf321('0x14'));var config=require(_0xf321('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46b899,_0x4b1b5d){_0x4b1b5d=_0x4b1b5d||0xcc;return function(_0x5f4df2){if(_0x5f4df2){return _0x46b899[_0xf321('0x16')](_0x4b1b5d);}return _0x46b899['status'](_0x4b1b5d)[_0xf321('0x17')]();};}function respondWithResult(_0x4228c1,_0x1b0d99){_0x1b0d99=_0x1b0d99||0xc8;return function(_0x33e33b){if(_0x33e33b){return _0x4228c1[_0xf321('0x18')](_0x1b0d99)[_0xf321('0x19')](_0x33e33b);}};}function respondWithFilteredResult(_0x4c645c,_0x20f7d0){return function(_0x10509c){if(_0x10509c){var _0x1c6d5e=_0x10509c[_0xf321('0x1a')],_0x49fbb6=_0x20f7d0[_0xf321('0x1b')],_0x5032df=_0x20f7d0[_0xf321('0x1b')]+_0x20f7d0[_0xf321('0x1c')],_0x5ce4e9;if(_0x5032df>=_0x1c6d5e){_0x5032df=_0x1c6d5e;_0x5ce4e9=0xc8;}else{_0x5ce4e9=0xce;}_0x4c645c['status'](_0x5ce4e9);return _0x4c645c[_0xf321('0x1d')]('Content-Range',_0x49fbb6+'-'+_0x5032df+'/'+_0x1c6d5e)[_0xf321('0x19')](_0x10509c);}return null;};}function patchUpdates(_0x39126c){return function(_0xa8be93){try{jsonpatch[_0xf321('0x1e')](_0xa8be93,_0x39126c,!![]);}catch(_0x1f2b64){return BPromise[_0xf321('0x1f')](_0x1f2b64);}return _0xa8be93[_0xf321('0x20')]();};}function saveUpdates(_0x4cfda3,_0x344af3){return function(_0x4ca000){if(_0x4ca000){return _0x4ca000[_0xf321('0x21')](_0x4cfda3)[_0xf321('0x22')](function(_0x4d376f){return _0x4d376f;});}return null;};}function removeEntity(_0x1653e2,_0x14b33d){return function(_0x5d56e0){if(_0x5d56e0){return _0x5d56e0[_0xf321('0x23')]()[_0xf321('0x22')](function(){var _0x52248b=_0x5d56e0[_0xf321('0x24')]({'plain':!![]});var _0x420873=_0xf321('0x25');return db[_0xf321('0x26')][_0xf321('0x23')]({'where':{'type':_0x420873,'resourceId':_0x52248b['id']}})[_0xf321('0x22')](function(){return _0x5d56e0;});})[_0xf321('0x22')](function(){_0x1653e2[_0xf321('0x18')](0xcc)[_0xf321('0x17')]();});}};}function handleEntityNotFound(_0x487b0b,_0x145417){return function(_0x3335ca){if(!_0x3335ca){_0x487b0b[_0xf321('0x16')](0x194);}return _0x3335ca;};}function handleError(_0x218ae1,_0x4834c6){_0x4834c6=_0x4834c6||0x1f4;return function(_0x155efd){logger[_0xf321('0x27')](_0x155efd['stack']);if(_0x155efd[_0xf321('0x28')]){delete _0x155efd[_0xf321('0x28')];}_0x218ae1[_0xf321('0x18')](_0x4834c6)[_0xf321('0x29')](_0x155efd);};}exports[_0xf321('0x2a')]=function(_0x571561,_0x31a1f0){var _0x81380d={},_0x156fc9={},_0xfa54ec={'count':0x0,'rows':[]};var _0x354001=_['map'](db['CmContactHasPhone'][_0xf321('0x2b')],function(_0x5d8cf6){return{'name':_0x5d8cf6['fieldName'],'type':_0x5d8cf6['type'][_0xf321('0x2c')]};});_0x156fc9[_0xf321('0x2d')]=_[_0xf321('0x2e')](_0x354001,_0xf321('0x28'));_0x156fc9['query']=_[_0xf321('0x2f')](_0x571561[_0xf321('0x30')]);_0x156fc9[_0xf321('0x31')]=_[_0xf321('0x32')](_0x156fc9[_0xf321('0x2d')],_0x156fc9[_0xf321('0x30')]);_0x81380d[_0xf321('0x33')]=_[_0xf321('0x32')](_0x156fc9[_0xf321('0x2d')],qs[_0xf321('0x34')](_0x571561['query'][_0xf321('0x34')]));_0x81380d[_0xf321('0x33')]=_0x81380d['attributes'][_0xf321('0x35')]?_0x81380d[_0xf321('0x33')]:_0x156fc9['model'];if(!_0x571561[_0xf321('0x30')][_0xf321('0x36')]('nolimit')){_0x81380d[_0xf321('0x1c')]=qs[_0xf321('0x1c')](_0x571561[_0xf321('0x30')][_0xf321('0x1c')]);_0x81380d[_0xf321('0x1b')]=qs['offset'](_0x571561[_0xf321('0x30')][_0xf321('0x1b')]);}_0x81380d[_0xf321('0x37')]=qs['sort'](_0x571561[_0xf321('0x30')][_0xf321('0x38')]);_0x81380d[_0xf321('0x39')]=qs[_0xf321('0x31')](_[_0xf321('0x3a')](_0x571561[_0xf321('0x30')],_0x156fc9[_0xf321('0x31')]),_0x354001);if(_0x571561[_0xf321('0x30')][_0xf321('0x3b')]){_0x81380d[_0xf321('0x39')]=_[_0xf321('0x3c')](_0x81380d[_0xf321('0x39')],{'$or':_[_0xf321('0x2e')](_0x354001,function(_0x29f953){if(_0x29f953[_0xf321('0x3d')]!=='VIRTUAL'){var _0x3c969e={};_0x3c969e[_0x29f953[_0xf321('0x28')]]={'$like':'%'+_0x571561[_0xf321('0x30')]['filter']+'%'};return _0x3c969e;}})});}_0x81380d=_[_0xf321('0x3c')]({},_0x81380d,_0x571561[_0xf321('0x3e')]);var _0x1efc56={'where':_0x81380d[_0xf321('0x39')]};return db['CmContactHasPhone'][_0xf321('0x1a')](_0x1efc56)[_0xf321('0x22')](function(_0x33761a){_0xfa54ec['count']=_0x33761a;if(_0x571561['query'][_0xf321('0x3f')]){_0x81380d[_0xf321('0x40')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xf321('0x41')](_0x81380d);})['then'](function(_0x20beaa){_0xfa54ec[_0xf321('0x42')]=_0x20beaa;return _0xfa54ec;})[_0xf321('0x22')](respondWithFilteredResult(_0x31a1f0,_0x81380d))['catch'](handleError(_0x31a1f0,null));};exports[_0xf321('0x43')]=function(_0x54b048,_0x185b30){var _0x1b2a77={'raw':!![],'where':{'id':_0x54b048[_0xf321('0x44')]['id']}},_0x51c848={};_0x51c848[_0xf321('0x2d')]=_[_0xf321('0x2f')](db[_0xf321('0x45')][_0xf321('0x2b')]);_0x51c848[_0xf321('0x30')]=_[_0xf321('0x2f')](_0x54b048['query']);_0x51c848['filters']=_[_0xf321('0x32')](_0x51c848[_0xf321('0x2d')],_0x51c848['query']);_0x1b2a77[_0xf321('0x33')]=_[_0xf321('0x32')](_0x51c848[_0xf321('0x2d')],qs[_0xf321('0x34')](_0x54b048['query'][_0xf321('0x34')]));_0x1b2a77['attributes']=_0x1b2a77[_0xf321('0x33')][_0xf321('0x35')]?_0x1b2a77['attributes']:_0x51c848[_0xf321('0x2d')];if(_0x54b048[_0xf321('0x30')][_0xf321('0x3f')]){_0x1b2a77['include']=[{'all':!![]}];}_0x1b2a77=_[_0xf321('0x3c')]({},_0x1b2a77,_0x54b048[_0xf321('0x3e')]);return db[_0xf321('0x45')]['find'](_0x1b2a77)[_0xf321('0x22')](handleEntityNotFound(_0x185b30,null))['then'](respondWithResult(_0x185b30,null))[_0xf321('0x46')](handleError(_0x185b30,null));};exports[_0xf321('0x47')]=function(_0x4939a6,_0x4e3795){return db[_0xf321('0x45')][_0xf321('0x47')](_0x4939a6[_0xf321('0x48')],{})['then'](function(_0x1e5138){var _0x5b0415=_0x4939a6[_0xf321('0x49')]['get']({'plain':!![]});if(!_0x5b0415)throw new Error(_0xf321('0x4a'));if(_0x5b0415['role']===_0xf321('0x49')){var _0x2fbb93=_0x1e5138[_0xf321('0x24')]({'plain':!![]});var _0x34e18b='CmContactHasPhones';return db['UserProfileSection'][_0xf321('0x4b')]({'where':{'name':_0x34e18b,'userProfileId':_0x5b0415[_0xf321('0x4c')]},'raw':!![]})['then'](function(_0x5f41b1){if(_0x5f41b1&&_0x5f41b1[_0xf321('0x4d')]===0x0){return db['UserProfileResource'][_0xf321('0x47')]({'name':_0x2fbb93[_0xf321('0x28')],'resourceId':_0x2fbb93['id'],'type':_0x5f41b1[_0xf321('0x28')],'sectionId':_0x5f41b1['id']},{})[_0xf321('0x22')](function(){return _0x1e5138;});}else{return _0x1e5138;}})['catch'](function(_0x113dfe){logger[_0xf321('0x27')](_0xf321('0x4e'),_0x113dfe);throw _0x113dfe;});}return _0x1e5138;})['then'](respondWithResult(_0x4e3795,0xc9))[_0xf321('0x46')](handleError(_0x4e3795,null));};exports[_0xf321('0x21')]=function(_0x3affff,_0x5771f0){if(_0x3affff[_0xf321('0x48')]['id']){delete _0x3affff[_0xf321('0x48')]['id'];}return db[_0xf321('0x45')][_0xf321('0x4b')]({'where':{'id':_0x3affff[_0xf321('0x44')]['id']}})['then'](handleEntityNotFound(_0x5771f0,null))[_0xf321('0x22')](saveUpdates(_0x3affff[_0xf321('0x48')],null))[_0xf321('0x22')](respondWithResult(_0x5771f0,null))[_0xf321('0x46')](handleError(_0x5771f0,null));};exports[_0xf321('0x23')]=function(_0x350bbe,_0x3ac524){return db['CmContactHasPhone'][_0xf321('0x4b')]({'where':{'id':_0x350bbe['params']['id']}})[_0xf321('0x22')](handleEntityNotFound(_0x3ac524,null))[_0xf321('0x22')](removeEntity(_0x3ac524,null))['catch'](handleError(_0x3ac524,null));}; \ No newline at end of file +var _0x86b6=['status','json','count','offset','apply','save','update','destroy','then','get','CmContactHasPhones','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','CmContactHasPhone','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0x86b6,0x86));var _0x686b=function(_0x10b986,_0x284bba){_0x10b986=_0x10b986-0x0;var _0x1c3e54=_0x86b6[_0x10b986];return _0x1c3e54;};'use strict';var pdf=require(_0x686b('0x0'));var emlformat=require(_0x686b('0x1'));var rimraf=require(_0x686b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x686b('0x3'));var rp=require(_0x686b('0x4'));var moment=require(_0x686b('0x5'));var BPromise=require(_0x686b('0x6'));var Mustache=require(_0x686b('0x7'));var util=require('util');var path=require(_0x686b('0x8'));var sox=require(_0x686b('0x9'));var csv=require('to-csv');var ejs=require(_0x686b('0xa'));var fs=require('fs');var _=require(_0x686b('0xb'));var squel=require(_0x686b('0xc'));var crypto=require(_0x686b('0xd'));var jsforce=require(_0x686b('0xe'));var deskjs=require(_0x686b('0xf'));var toCsv=require(_0x686b('0x10'));var querystring=require(_0x686b('0x11'));var Papa=require(_0x686b('0x12'));var Redis=require(_0x686b('0x13'));var authService=require(_0x686b('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x686b('0x15'));var logger=require('../../config/logger')(_0x686b('0x16'));var utils=require(_0x686b('0x17'));var config=require(_0x686b('0x18'));var db=require(_0x686b('0x19'))['db'];function respondWithStatusCode(_0x36ef09,_0x18ddda){_0x18ddda=_0x18ddda||0xcc;return function(_0x47bf3a){if(_0x47bf3a){return _0x36ef09[_0x686b('0x1a')](_0x18ddda);}return _0x36ef09['status'](_0x18ddda)[_0x686b('0x1b')]();};}function respondWithResult(_0x2942c4,_0x5b636f){_0x5b636f=_0x5b636f||0xc8;return function(_0x56eba9){if(_0x56eba9){return _0x2942c4[_0x686b('0x1c')](_0x5b636f)[_0x686b('0x1d')](_0x56eba9);}};}function respondWithFilteredResult(_0x2d1047,_0x49ec1b){return function(_0x160649){if(_0x160649){var _0x393e7f=_0x160649[_0x686b('0x1e')],_0x574a59=_0x49ec1b[_0x686b('0x1f')],_0x141cec=_0x49ec1b[_0x686b('0x1f')]+_0x49ec1b['limit'],_0x142065;if(_0x141cec>=_0x393e7f){_0x141cec=_0x393e7f;_0x142065=0xc8;}else{_0x142065=0xce;}_0x2d1047[_0x686b('0x1c')](_0x142065);return _0x2d1047['set']('Content-Range',_0x574a59+'-'+_0x141cec+'/'+_0x393e7f)[_0x686b('0x1d')](_0x160649);}return null;};}function patchUpdates(_0x3b8000){return function(_0x2a31f4){try{jsonpatch[_0x686b('0x20')](_0x2a31f4,_0x3b8000,!![]);}catch(_0x1e4293){return BPromise['reject'](_0x1e4293);}return _0x2a31f4[_0x686b('0x21')]();};}function saveUpdates(_0x30b3b4,_0x5a28f2){return function(_0x511541){if(_0x511541){return _0x511541[_0x686b('0x22')](_0x30b3b4)['then'](function(_0x2ed6ea){return _0x2ed6ea;});}return null;};}function removeEntity(_0x3b28d2,_0x5f5775){return function(_0x44c755){if(_0x44c755){return _0x44c755[_0x686b('0x23')]()[_0x686b('0x24')](function(){var _0x1cb39b=_0x44c755[_0x686b('0x25')]({'plain':!![]});var _0xbd9374=_0x686b('0x26');return db[_0x686b('0x27')][_0x686b('0x23')]({'where':{'type':_0xbd9374,'resourceId':_0x1cb39b['id']}})[_0x686b('0x24')](function(){return _0x44c755;});})['then'](function(){_0x3b28d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c1636,_0x433b1d){return function(_0x3cdffa){if(!_0x3cdffa){_0x5c1636[_0x686b('0x1a')](0x194);}return _0x3cdffa;};}function handleError(_0x3d178a,_0x3ba2ff){_0x3ba2ff=_0x3ba2ff||0x1f4;return function(_0x4d59d4){logger[_0x686b('0x28')](_0x4d59d4[_0x686b('0x29')]);if(_0x4d59d4[_0x686b('0x2a')]){delete _0x4d59d4['name'];}_0x3d178a[_0x686b('0x1c')](_0x3ba2ff)[_0x686b('0x2b')](_0x4d59d4);};}exports[_0x686b('0x2c')]=function(_0x2d0b1c,_0xf995fa){var _0x4f1ba3={},_0x38343d={},_0x247aff={'count':0x0,'rows':[]};var _0x491150=_['map'](db['CmContactHasPhone'][_0x686b('0x2d')],function(_0x50ba4c){return{'name':_0x50ba4c[_0x686b('0x2e')],'type':_0x50ba4c[_0x686b('0x2f')][_0x686b('0x30')]};});_0x38343d[_0x686b('0x31')]=_[_0x686b('0x32')](_0x491150,_0x686b('0x2a'));_0x38343d[_0x686b('0x33')]=_[_0x686b('0x34')](_0x2d0b1c[_0x686b('0x33')]);_0x38343d[_0x686b('0x35')]=_[_0x686b('0x36')](_0x38343d['model'],_0x38343d['query']);_0x4f1ba3['attributes']=_[_0x686b('0x36')](_0x38343d['model'],qs[_0x686b('0x37')](_0x2d0b1c[_0x686b('0x33')][_0x686b('0x37')]));_0x4f1ba3[_0x686b('0x38')]=_0x4f1ba3[_0x686b('0x38')]['length']?_0x4f1ba3[_0x686b('0x38')]:_0x38343d['model'];if(!_0x2d0b1c['query']['hasOwnProperty'](_0x686b('0x39'))){_0x4f1ba3[_0x686b('0x3a')]=qs['limit'](_0x2d0b1c['query'][_0x686b('0x3a')]);_0x4f1ba3[_0x686b('0x1f')]=qs[_0x686b('0x1f')](_0x2d0b1c[_0x686b('0x33')][_0x686b('0x1f')]);}_0x4f1ba3['order']=qs[_0x686b('0x3b')](_0x2d0b1c['query']['sort']);_0x4f1ba3[_0x686b('0x3c')]=qs[_0x686b('0x35')](_[_0x686b('0x3d')](_0x2d0b1c['query'],_0x38343d[_0x686b('0x35')]),_0x491150);if(_0x2d0b1c['query']['filter']){_0x4f1ba3[_0x686b('0x3c')]=_[_0x686b('0x3e')](_0x4f1ba3[_0x686b('0x3c')],{'$or':_[_0x686b('0x32')](_0x491150,function(_0x152ce8){if(_0x152ce8[_0x686b('0x2f')]!==_0x686b('0x3f')){var _0x520495={};_0x520495[_0x152ce8['name']]={'$like':'%'+_0x2d0b1c[_0x686b('0x33')][_0x686b('0x40')]+'%'};return _0x520495;}})});}_0x4f1ba3=_[_0x686b('0x3e')]({},_0x4f1ba3,_0x2d0b1c[_0x686b('0x41')]);var _0x15ccf1={'where':_0x4f1ba3[_0x686b('0x3c')]};return db['CmContactHasPhone']['count'](_0x15ccf1)[_0x686b('0x24')](function(_0x2945c3){_0x247aff[_0x686b('0x1e')]=_0x2945c3;if(_0x2d0b1c['query'][_0x686b('0x42')]){_0x4f1ba3[_0x686b('0x43')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0x686b('0x44')](_0x4f1ba3);})['then'](function(_0x1e0411){_0x247aff['rows']=_0x1e0411;return _0x247aff;})[_0x686b('0x24')](respondWithFilteredResult(_0xf995fa,_0x4f1ba3))[_0x686b('0x45')](handleError(_0xf995fa,null));};exports[_0x686b('0x46')]=function(_0x3e08b4,_0x278169){var _0x48f4f8={'raw':!![],'where':{'id':_0x3e08b4['params']['id']}},_0x39e452={};_0x39e452[_0x686b('0x31')]=_['keys'](db[_0x686b('0x47')][_0x686b('0x2d')]);_0x39e452[_0x686b('0x33')]=_[_0x686b('0x34')](_0x3e08b4[_0x686b('0x33')]);_0x39e452['filters']=_[_0x686b('0x36')](_0x39e452['model'],_0x39e452[_0x686b('0x33')]);_0x48f4f8[_0x686b('0x38')]=_[_0x686b('0x36')](_0x39e452[_0x686b('0x31')],qs['fields'](_0x3e08b4[_0x686b('0x33')][_0x686b('0x37')]));_0x48f4f8[_0x686b('0x38')]=_0x48f4f8[_0x686b('0x38')][_0x686b('0x48')]?_0x48f4f8['attributes']:_0x39e452[_0x686b('0x31')];if(_0x3e08b4[_0x686b('0x33')][_0x686b('0x42')]){_0x48f4f8[_0x686b('0x43')]=[{'all':!![]}];}_0x48f4f8=_[_0x686b('0x3e')]({},_0x48f4f8,_0x3e08b4[_0x686b('0x41')]);return db[_0x686b('0x47')]['find'](_0x48f4f8)[_0x686b('0x24')](handleEntityNotFound(_0x278169,null))['then'](respondWithResult(_0x278169,null))['catch'](handleError(_0x278169,null));};exports['create']=function(_0x255272,_0x39e080){return db[_0x686b('0x47')][_0x686b('0x49')](_0x255272[_0x686b('0x4a')],{})[_0x686b('0x24')](function(_0x294272){var _0x3114a1=_0x255272['user']['get']({'plain':!![]});if(!_0x3114a1)throw new Error(_0x686b('0x4b'));if(_0x3114a1['role']===_0x686b('0x4c')){var _0x422b03=_0x294272[_0x686b('0x25')]({'plain':!![]});var _0x3ceea6=_0x686b('0x26');return db[_0x686b('0x4d')][_0x686b('0x4e')]({'where':{'name':_0x3ceea6,'userProfileId':_0x3114a1[_0x686b('0x4f')]},'raw':!![]})[_0x686b('0x24')](function(_0x1ffaeb){if(_0x1ffaeb&&_0x1ffaeb[_0x686b('0x50')]===0x0){return db[_0x686b('0x27')]['create']({'name':_0x422b03[_0x686b('0x2a')],'resourceId':_0x422b03['id'],'type':_0x1ffaeb['name'],'sectionId':_0x1ffaeb['id']},{})[_0x686b('0x24')](function(){return _0x294272;});}else{return _0x294272;}})[_0x686b('0x45')](function(_0x452590){logger[_0x686b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x452590);throw _0x452590;});}return _0x294272;})[_0x686b('0x24')](respondWithResult(_0x39e080,0xc9))[_0x686b('0x45')](handleError(_0x39e080,null));};exports['update']=function(_0x1241c2,_0x5bc753){if(_0x1241c2[_0x686b('0x4a')]['id']){delete _0x1241c2[_0x686b('0x4a')]['id'];}return db[_0x686b('0x47')][_0x686b('0x4e')]({'where':{'id':_0x1241c2['params']['id']}})[_0x686b('0x24')](handleEntityNotFound(_0x5bc753,null))['then'](saveUpdates(_0x1241c2[_0x686b('0x4a')],null))[_0x686b('0x24')](respondWithResult(_0x5bc753,null))[_0x686b('0x45')](handleError(_0x5bc753,null));};exports[_0x686b('0x23')]=function(_0x497a74,_0x5b6baa){return db[_0x686b('0x47')][_0x686b('0x4e')]({'where':{'id':_0x497a74['params']['id']}})['then'](handleEntityNotFound(_0x5b6baa,null))[_0x686b('0x24')](removeEntity(_0x5b6baa,null))['catch'](handleError(_0x5b6baa,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 4066149..e7e24e8 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 _0x579b=['moment','bluebird','request-promise','../../config/environment','./cmContactHasPhone.attributes','exports','CmContactHasPhone','cm_contact_has_phones','util'];(function(_0x2e7f07,_0x4cbab5){var _0x530477=function(_0x20c704){while(--_0x20c704){_0x2e7f07['push'](_0x2e7f07['shift']());}};_0x530477(++_0x4cbab5);}(_0x579b,0xbc));var _0xb579=function(_0x5c7e53,_0x174ce5){_0x5c7e53=_0x5c7e53-0x0;var _0x1c9af9=_0x579b[_0x5c7e53];return _0x1c9af9;};'use strict';var _=require('lodash');var util=require(_0xb579('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb579('0x1'));var BPromise=require(_0xb579('0x2'));var rp=require(_0xb579('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb579('0x4'));var attributes=require(_0xb579('0x5'));module[_0xb579('0x6')]=function(_0x593cda,_0x289c41){return _0x593cda['define'](_0xb579('0x7'),attributes,{'tableName':_0xb579('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3617=['../../config/environment','./cmContactHasPhone.attributes','exports','define','cm_contact_has_phones','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5204f9,_0x1c6b99){var _0x5b29b1=function(_0x1af220){while(--_0x1af220){_0x5204f9['push'](_0x5204f9['shift']());}};_0x5b29b1(++_0x1c6b99);}(_0x3617,0xec));var _0x7361=function(_0x4fb1da,_0x2a7935){_0x4fb1da=_0x4fb1da-0x0;var _0x2970f8=_0x3617[_0x4fb1da];return _0x2970f8;};'use strict';var _=require(_0x7361('0x0'));var util=require(_0x7361('0x1'));var logger=require(_0x7361('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7361('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7361('0x4'));var rimraf=require(_0x7361('0x5'));var config=require(_0x7361('0x6'));var attributes=require(_0x7361('0x7'));module[_0x7361('0x8')]=function(_0x5de3a6,_0x414815){return _0x5de3a6[_0x7361('0x9')]('CmContactHasPhone',attributes,{'tableName':_0x7361('0xa'),'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 1f7d7bd..773e1ed 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 _0x0d64=['error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x44fd42,_0x452c59){var _0x3ee59f=function(_0x194690){while(--_0x194690){_0x44fd42['push'](_0x44fd42['shift']());}};_0x3ee59f(++_0x452c59);}(_0x0d64,0xad));var _0x40d6=function(_0x1d8b31,_0xef220e){_0x1d8b31=_0x1d8b31-0x0;var _0x2548ce=_0x0d64[_0x1d8b31];return _0x2548ce;};'use strict';var _=require(_0x40d6('0x0'));var util=require(_0x40d6('0x1'));var moment=require(_0x40d6('0x2'));var BPromise=require(_0x40d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x40d6('0x5'));var logger=require(_0x40d6('0x6'))(_0x40d6('0x7'));var config=require(_0x40d6('0x8'));var jayson=require(_0x40d6('0x9'));var client=jayson[_0x40d6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283147,_0x1ae4fa,_0x2da2b4){return new BPromise(function(_0x21685a,_0x55a9f9){return client[_0x40d6('0xb')](_0x283147,_0x2da2b4)[_0x40d6('0xc')](function(_0x53d005){logger['info'](_0x40d6('0xd'),_0x1ae4fa,_0x40d6('0xe'));logger[_0x40d6('0xf')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x1ae4fa,_0x40d6('0xe'),JSON['stringify'](_0x53d005));if(_0x53d005[_0x40d6('0x10')]){if(_0x53d005[_0x40d6('0x10')]['code']===0x1f4){logger[_0x40d6('0x10')](_0x40d6('0xd'),_0x1ae4fa,_0x53d005[_0x40d6('0x10')][_0x40d6('0x11')]);return _0x55a9f9(_0x53d005[_0x40d6('0x10')]['message']);}logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x1ae4fa,_0x53d005[_0x40d6('0x10')][_0x40d6('0x11')]);return _0x21685a(_0x53d005[_0x40d6('0x10')][_0x40d6('0x11')]);}else{logger[_0x40d6('0x12')](_0x40d6('0xd'),_0x1ae4fa,_0x40d6('0xe'));_0x21685a(_0x53d005[_0x40d6('0x13')][_0x40d6('0x11')]);}})[_0x40d6('0x14')](function(_0x4092f3){logger[_0x40d6('0x10')](_0x40d6('0xd'),_0x1ae4fa,_0x4092f3);_0x55a9f9(_0x4092f3);});});} \ No newline at end of file +var _0x96e1=['CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','error','message','result','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x39f15c,_0x4e4da2){var _0xe7e43c=function(_0x3e7292){while(--_0x3e7292){_0x39f15c['push'](_0x39f15c['shift']());}};_0xe7e43c(++_0x4e4da2);}(_0x96e1,0x186));var _0x196e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x96e1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x196e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x196e('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x196e('0x2'));var logger=require(_0x196e('0x3'))(_0x196e('0x4'));var config=require(_0x196e('0x5'));var jayson=require(_0x196e('0x6'));var client=jayson[_0x196e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ef8c9,_0x541561,_0x43664c){return new BPromise(function(_0x5c3c1e,_0x40496e){return client[_0x196e('0x8')](_0x5ef8c9,_0x43664c)['then'](function(_0xc61562){logger[_0x196e('0x9')](_0x196e('0xa'),_0x541561,_0x196e('0xb'));logger[_0x196e('0xc')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x541561,_0x196e('0xb'),JSON['stringify'](_0xc61562));if(_0xc61562['error']){if(_0xc61562[_0x196e('0xd')]['code']===0x1f4){logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x541561,_0xc61562['error']['message']);return _0x40496e(_0xc61562[_0x196e('0xd')][_0x196e('0xe')]);}logger[_0x196e('0xd')](_0x196e('0xa'),_0x541561,_0xc61562[_0x196e('0xd')][_0x196e('0xe')]);return _0x5c3c1e(_0xc61562[_0x196e('0xd')][_0x196e('0xe')]);}else{logger['info']('CmContactHasPhone,\x20%s,\x20%s',_0x541561,_0x196e('0xb'));_0x5c3c1e(_0xc61562[_0x196e('0xf')][_0x196e('0xe')]);}})['catch'](function(_0x393c9f){logger[_0x196e('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x541561,_0x393c9f);_0x40496e(_0x393c9f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 088c823..afbd026 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 _0x4d89=['connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','destroy','exports','multer','util','path'];(function(_0x56a803,_0x43cc5b){var _0x58fc48=function(_0x2fe19c){while(--_0x2fe19c){_0x56a803['push'](_0x56a803['shift']());}};_0x58fc48(++_0x43cc5b);}(_0x4d89,0xdd));var _0x94d8=function(_0x3d5a2a,_0x1e9dec){_0x3d5a2a=_0x3d5a2a-0x0;var _0x2820ca=_0x4d89[_0x3d5a2a];return _0x2820ca;};'use strict';var multer=require(_0x94d8('0x0'));var util=require(_0x94d8('0x1'));var path=require(_0x94d8('0x2'));var timeout=require(_0x94d8('0x3'));var express=require(_0x94d8('0x4'));var router=express[_0x94d8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x94d8('0x6'));var config=require('../../config/environment');var controller=require('./cmContactHasPhone.controller');router[_0x94d8('0x7')]('/',auth[_0x94d8('0x8')](),controller[_0x94d8('0x9')]);router[_0x94d8('0x7')](_0x94d8('0xa'),auth[_0x94d8('0x8')](),controller[_0x94d8('0xb')]);router['post']('/',auth[_0x94d8('0x8')](),controller[_0x94d8('0xc')]);router[_0x94d8('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x94d8('0xe')]);module[_0x94d8('0xf')]=router; \ No newline at end of file +var _0xea08=['get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x13b70f,_0x5c1116){var _0x51427c=function(_0x54bb0b){while(--_0x54bb0b){_0x13b70f['push'](_0x13b70f['shift']());}};_0x51427c(++_0x5c1116);}(_0xea08,0x1bd));var _0x8ea0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xea08[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x8ea0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ea0('0x1'));var express=require(_0x8ea0('0x2'));var router=express['Router']();var auth=require(_0x8ea0('0x3'));var interaction=require(_0x8ea0('0x4'));var config=require('../../config/environment');var controller=require('./cmContactHasPhone.controller');router[_0x8ea0('0x5')]('/',auth[_0x8ea0('0x6')](),controller['index']);router[_0x8ea0('0x5')](_0x8ea0('0x7'),auth[_0x8ea0('0x6')](),controller[_0x8ea0('0x8')]);router[_0x8ea0('0x9')]('/',auth[_0x8ea0('0x6')](),controller['create']);router[_0x8ea0('0xa')](_0x8ea0('0x7'),auth[_0x8ea0('0x6')](),controller[_0x8ea0('0xb')]);router[_0x8ea0('0xc')](_0x8ea0('0x7'),auth[_0x8ea0('0x6')](),controller[_0x8ea0('0xd')]);module[_0x8ea0('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index fcc924e..9c0a1bd 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 _0x4273=['name','long','select','parse','values','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0x4273,0x7d));var _0x3427=function(_0x5c8226,_0x43eff3){_0x5c8226=_0x5c8226-0x0;var _0xe07bfc=_0x4273[_0x5c8226];return _0xe07bfc;};'use strict';var Sequelize=require(_0x3427('0x0'));var _=require(_0x3427('0x1'));module['exports']={'name':{'type':Sequelize[_0x3427('0x2')],'get':function(_0x47fe60){return this[_0x3427('0x3')](_0x3427('0x4'));}},'alias':{'type':Sequelize[_0x3427('0x5')],'allowNull':![],'set':function(_0x50bad6){this[_0x3427('0x6')](_0x3427('0x4'),_0x50bad6?_0x50bad6:this[_0x3427('0x3')](_0x3427('0x7')));}},'type':{'type':Sequelize[_0x3427('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x3427('0x8')),'get':function(){if(this[_0x3427('0x3')]('type')===_0x3427('0x9')){return JSON[_0x3427('0xa')](this[_0x3427('0x3')](_0x3427('0xb')));}else{return this[_0x3427('0x3')]('values');}},'set':function(_0x2b19db){if(Array['isArray'](_0x2b19db)){this[_0x3427('0x6')](_0x3427('0xb'),JSON['stringify'](_0x2b19db));}else{this[_0x3427('0x6')]('values',_0x2b19db);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x278c=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT','type','values','isArray','setDataValue','stringify'];(function(_0x24e2a3,_0x534875){var _0x3e82f4=function(_0x48a8ee){while(--_0x48a8ee){_0x24e2a3['push'](_0x24e2a3['shift']());}};_0x3e82f4(++_0x534875);}(_0x278c,0x1b2));var _0xc278=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x278c[_0x1bf809];return _0x1caa4e;};'use strict';var Sequelize=require(_0xc278('0x0'));var _=require(_0xc278('0x1'));module[_0xc278('0x2')]={'name':{'type':Sequelize[_0xc278('0x3')],'get':function(_0x344514){return this[_0xc278('0x4')](_0xc278('0x5'));}},'alias':{'type':Sequelize[_0xc278('0x6')],'allowNull':![],'set':function(_0x4524b3){this['setDataValue'](_0xc278('0x5'),_0x4524b3?_0x4524b3:this[_0xc278('0x4')](_0xc278('0x7')));}},'type':{'type':Sequelize[_0xc278('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xc278('0x8')]('long'),'get':function(){if(this[_0xc278('0x4')](_0xc278('0x9'))==='select'){return JSON['parse'](this[_0xc278('0x4')](_0xc278('0xa')));}else{return this[_0xc278('0x4')](_0xc278('0xa'));}},'set':function(_0xe91216){if(Array[_0xc278('0xb')](_0xe91216)){this[_0xc278('0xc')](_0xc278('0xa'),JSON[_0xc278('0xd')](_0xe91216));}else{this[_0xc278('0xc')]('values',_0xe91216);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f876625..9073dd1 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 _0x050e=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','CmCustomField','include','findAll','rows','catch','show','params','includeAll','find','body','destroy','create','transaction','TEXT','text','Sequelize','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','differenceBy','keys','query','intersection','model','attributes'];(function(_0xfeaa2d,_0x5d864d){var _0x4a8441=function(_0x39133f){while(--_0x39133f){_0xfeaa2d['push'](_0xfeaa2d['shift']());}};_0x4a8441(++_0x5d864d);}(_0x050e,0x12d));var _0xe050=function(_0x4e8079,_0x34f064){_0x4e8079=_0x4e8079-0x0;var _0x3a2069=_0x050e[_0x4e8079];return _0x3a2069;};'use strict';var pdf=require(_0xe050('0x0'));var emlformat=require(_0xe050('0x1'));var rimraf=require(_0xe050('0x2'));var zipdir=require(_0xe050('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe050('0x4'));var BPromise=require(_0xe050('0x5'));var Mustache=require(_0xe050('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe050('0x7'));var csv=require('to-csv');var ejs=require(_0xe050('0x8'));var fs=require('fs');var _=require(_0xe050('0x9'));var squel=require(_0xe050('0xa'));var crypto=require('crypto');var jsforce=require(_0xe050('0xb'));var deskjs=require(_0xe050('0xc'));var toCsv=require(_0xe050('0xd'));var querystring=require(_0xe050('0xe'));var Papa=require(_0xe050('0xf'));var Redis=require(_0xe050('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe050('0x11'));var as=require(_0xe050('0x12'));var hardwareService=require(_0xe050('0x13'));var logger=require(_0xe050('0x14'))(_0xe050('0x15'));var utils=require('../../config/utils');var config=require(_0xe050('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d6c75,_0x5e4e5a){_0x5e4e5a=_0x5e4e5a||0xcc;return function(_0x45d5d3){if(_0x45d5d3){return _0x5d6c75[_0xe050('0x17')](_0x5e4e5a);}return _0x5d6c75[_0xe050('0x18')](_0x5e4e5a)['end']();};}function respondWithResult(_0x203a20,_0x59f210){_0x59f210=_0x59f210||0xc8;return function(_0x5dc4ad){if(_0x5dc4ad){return _0x203a20[_0xe050('0x18')](_0x59f210)[_0xe050('0x19')](_0x5dc4ad);}};}function respondWithFilteredResult(_0x58fecf,_0x520b89){return function(_0x320752){if(_0x320752){var _0x1adec1=_0x320752[_0xe050('0x1a')],_0x18afa0=_0x520b89[_0xe050('0x1b')],_0x48ba76=_0x520b89['offset']+_0x520b89[_0xe050('0x1c')],_0x5abc72;if(_0x48ba76>=_0x1adec1){_0x48ba76=_0x1adec1;_0x5abc72=0xc8;}else{_0x5abc72=0xce;}_0x58fecf[_0xe050('0x18')](_0x5abc72);return _0x58fecf[_0xe050('0x1d')]('Content-Range',_0x18afa0+'-'+_0x48ba76+'/'+_0x1adec1)['json'](_0x320752);}return null;};}function patchUpdates(_0x4654ee){return function(_0x3052f2){try{jsonpatch[_0xe050('0x1e')](_0x3052f2,_0x4654ee,!![]);}catch(_0x3245d7){return BPromise['reject'](_0x3245d7);}return _0x3052f2[_0xe050('0x1f')]();};}function saveUpdates(_0xf605d0,_0x56afd0){return function(_0x4acf37){if(_0x4acf37){return _0x4acf37[_0xe050('0x20')](_0xf605d0)[_0xe050('0x21')](function(_0x36ae16){return _0x36ae16;});}return null;};}function removeEntity(_0x23098b,_0x41be92){return function(_0x317338){if(_0x317338){return _0x317338['destroy']()[_0xe050('0x21')](function(){_0x23098b['status'](0xcc)[_0xe050('0x22')]();});}};}function handleEntityNotFound(_0x382239,_0x59b09f){return function(_0xdd2f4e){if(!_0xdd2f4e){_0x382239['sendStatus'](0x194);}return _0xdd2f4e;};}function handleError(_0x39fc5a,_0x41190b){_0x41190b=_0x41190b||0x1f4;return function(_0x54f3cb){logger[_0xe050('0x23')](_0x54f3cb[_0xe050('0x24')]);if(_0x54f3cb[_0xe050('0x25')]){delete _0x54f3cb[_0xe050('0x25')];}_0x39fc5a[_0xe050('0x18')](_0x41190b)[_0xe050('0x26')](_0x54f3cb);};}exports[_0xe050('0x27')]=function(_0x117944,_0xd903a){var _0xd50f8e={},_0x8773d1={},_0x1a2e2a={'count':0x0,'rows':[]};var _0x4dc412=_[_0xe050('0x28')](db['CmCustomField'][_0xe050('0x29')],function(_0x4c0f17){return{'name':_0x4c0f17[_0xe050('0x2a')],'type':_0x4c0f17[_0xe050('0x2b')][_0xe050('0x2c')]};});_0x8773d1['model']=_[_0xe050('0x2d')](_[_0xe050('0x28')](_0x4dc412,_0xe050('0x25')),[_0xe050('0x25')]);_0x8773d1['query']=_[_0xe050('0x2e')](_0x117944[_0xe050('0x2f')]);_0x8773d1['filters']=_[_0xe050('0x30')](_0x8773d1[_0xe050('0x31')],_0x8773d1[_0xe050('0x2f')]);_0xd50f8e[_0xe050('0x32')]=_['intersection'](_0x8773d1['model'],qs[_0xe050('0x33')](_0x117944[_0xe050('0x2f')][_0xe050('0x33')]));_0xd50f8e[_0xe050('0x32')]=_0xd50f8e['attributes'][_0xe050('0x34')]?_0xd50f8e[_0xe050('0x32')]:_0x8773d1[_0xe050('0x31')];if(!_0x117944[_0xe050('0x2f')][_0xe050('0x35')](_0xe050('0x36'))){_0xd50f8e[_0xe050('0x1c')]=qs[_0xe050('0x1c')](_0x117944['query'][_0xe050('0x1c')]);_0xd50f8e[_0xe050('0x1b')]=qs[_0xe050('0x1b')](_0x117944[_0xe050('0x2f')][_0xe050('0x1b')]);}_0xd50f8e[_0xe050('0x37')]=qs[_0xe050('0x38')](_0x117944['query'][_0xe050('0x38')]);_0xd50f8e[_0xe050('0x39')]=qs[_0xe050('0x3a')](_['pick'](_0x117944[_0xe050('0x2f')],_0x8773d1['filters']),_0x4dc412);if(_0x117944[_0xe050('0x2f')][_0xe050('0x3b')]){_0xd50f8e[_0xe050('0x39')]=_[_0xe050('0x3c')](_0xd50f8e[_0xe050('0x39')],{'$or':_[_0xe050('0x28')](_0x4dc412,function(_0x13cb94){if(_0x13cb94[_0xe050('0x2b')]!==_0xe050('0x3d')){var _0x21e28b={};_0x21e28b[_0x13cb94[_0xe050('0x25')]]={'$like':'%'+_0x117944[_0xe050('0x2f')][_0xe050('0x3b')]+'%'};return _0x21e28b;}})});}_0xd50f8e=_['merge']({},_0xd50f8e,_0x117944[_0xe050('0x3e')]);var _0x4ff52f={'where':_0xd50f8e[_0xe050('0x39')]};return db[_0xe050('0x3f')][_0xe050('0x1a')](_0x4ff52f)[_0xe050('0x21')](function(_0x37e1f0){_0x1a2e2a[_0xe050('0x1a')]=_0x37e1f0;if(_0x117944[_0xe050('0x2f')]['includeAll']){_0xd50f8e[_0xe050('0x40')]=[{'all':!![]}];}return db['CmCustomField'][_0xe050('0x41')](_0xd50f8e);})['then'](function(_0x11b623){_0x1a2e2a[_0xe050('0x42')]=_0x11b623;return _0x1a2e2a;})[_0xe050('0x21')](respondWithFilteredResult(_0xd903a,_0xd50f8e))[_0xe050('0x43')](handleError(_0xd903a,null));};exports[_0xe050('0x44')]=function(_0x247c8c,_0x89b2d2){var _0x599f0a={'raw':!![],'where':{'id':_0x247c8c[_0xe050('0x45')]['id']}},_0x149e27={};_0x149e27[_0xe050('0x31')]=_[_0xe050('0x2e')](db[_0xe050('0x3f')][_0xe050('0x29')]);_0x149e27[_0xe050('0x2f')]=_[_0xe050('0x2e')](_0x247c8c[_0xe050('0x2f')]);_0x149e27[_0xe050('0x3a')]=_[_0xe050('0x30')](_0x149e27[_0xe050('0x31')],_0x149e27['query']);_0x599f0a[_0xe050('0x32')]=_[_0xe050('0x30')](_0x149e27[_0xe050('0x31')],qs[_0xe050('0x33')](_0x247c8c[_0xe050('0x2f')][_0xe050('0x33')]));_0x599f0a[_0xe050('0x32')]=_0x599f0a[_0xe050('0x32')][_0xe050('0x34')]?_0x599f0a['attributes']:_0x149e27[_0xe050('0x31')];if(_0x247c8c[_0xe050('0x2f')][_0xe050('0x46')]){_0x599f0a[_0xe050('0x40')]=[{'all':!![]}];}_0x599f0a=_[_0xe050('0x3c')]({},_0x599f0a,_0x247c8c[_0xe050('0x3e')]);return db[_0xe050('0x3f')][_0xe050('0x47')](_0x599f0a)[_0xe050('0x21')](handleEntityNotFound(_0x89b2d2,null))[_0xe050('0x21')](respondWithResult(_0x89b2d2,null))[_0xe050('0x43')](handleError(_0x89b2d2,null));};exports[_0xe050('0x20')]=function(_0x6a31b2,_0x394a9c){if(_0x6a31b2[_0xe050('0x48')]['id']){delete _0x6a31b2[_0xe050('0x48')]['id'];}return db[_0xe050('0x3f')][_0xe050('0x47')]({'where':{'id':_0x6a31b2[_0xe050('0x45')]['id']}})[_0xe050('0x21')](handleEntityNotFound(_0x394a9c,null))[_0xe050('0x21')](saveUpdates(_0x6a31b2[_0xe050('0x48')],null))[_0xe050('0x21')](respondWithResult(_0x394a9c,null))[_0xe050('0x43')](handleError(_0x394a9c,null));};exports[_0xe050('0x49')]=function(_0x3ac594,_0x5043d3){return db[_0xe050('0x3f')]['find']({'where':{'id':_0x3ac594[_0xe050('0x45')]['id']}})['then'](handleEntityNotFound(_0x5043d3,null))[_0xe050('0x21')](removeEntity(_0x5043d3,null))[_0xe050('0x43')](handleError(_0x5043d3,null));};exports[_0xe050('0x4a')]=function(_0x2905fe,_0x3cc036){var _0x431e94;return db['sequelize'][_0xe050('0x4b')](function(_0x267bae){return db[_0xe050('0x3f')][_0xe050('0x4a')](_0x2905fe[_0xe050('0x48')],{'transaction':_0x267bae})[_0xe050('0x21')](function(_0x3cf871){_0x431e94=_0x3cf871;var _0x237f15={'type':db['Sequelize'][_0xe050('0x4c')],'transaction':_0x267bae};switch(_0x2905fe[_0xe050('0x48')][_0xe050('0x2b')]){case _0xe050('0x4d'):_0x237f15[_0xe050('0x2b')]=db[_0xe050('0x4e')][_0xe050('0x4c')];break;case _0xe050('0x4f'):_0x237f15[_0xe050('0x2b')]=db[_0xe050('0x4e')][_0xe050('0x50')];break;case'switch':_0x237f15[_0xe050('0x2b')]=db['Sequelize'][_0xe050('0x51')];_0x237f15[_0xe050('0x52')]=![];break;default:}return db[_0xe050('0x53')][_0xe050('0x54')][_0xe050('0x55')]('cm_contacts',util[_0xe050('0x56')](_0xe050('0x57'),_0x431e94['id']),_0x237f15);})[_0xe050('0x21')](function(){return _0x431e94;});})['then'](respondWithResult(_0x3cc036,0xc9))[_0xe050('0x43')](handleError(_0x3cc036,null));}; \ No newline at end of file +var _0x9cde=['queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','sendStatus','error','stack','name','index','map','CmCustomField','rawAttributes','type','model','differenceBy','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','rows','show','params','length','includeAll','include','find','catch','body','destroy','transaction','create','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x9cde,0x1c7));var _0xe9cd=function(_0x426711,_0x12264c){_0x426711=_0x426711-0x0;var _0x592991=_0x9cde[_0x426711];return _0x592991;};'use strict';var pdf=require(_0xe9cd('0x0'));var emlformat=require(_0xe9cd('0x1'));var rimraf=require(_0xe9cd('0x2'));var zipdir=require(_0xe9cd('0x3'));var jsonpatch=require(_0xe9cd('0x4'));var rp=require(_0xe9cd('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9cd('0x6'));var path=require(_0xe9cd('0x7'));var sox=require('sox');var csv=require(_0xe9cd('0x8'));var ejs=require(_0xe9cd('0x9'));var fs=require('fs');var _=require(_0xe9cd('0xa'));var squel=require(_0xe9cd('0xb'));var crypto=require('crypto');var jsforce=require(_0xe9cd('0xc'));var deskjs=require(_0xe9cd('0xd'));var toCsv=require(_0xe9cd('0x8'));var querystring=require(_0xe9cd('0xe'));var Papa=require(_0xe9cd('0xf'));var Redis=require(_0xe9cd('0x10'));var authService=require(_0xe9cd('0x11'));var qs=require(_0xe9cd('0x12'));var as=require(_0xe9cd('0x13'));var hardwareService=require(_0xe9cd('0x14'));var logger=require(_0xe9cd('0x15'))(_0xe9cd('0x16'));var utils=require(_0xe9cd('0x17'));var config=require('../../config/environment');var db=require(_0xe9cd('0x18'))['db'];function respondWithStatusCode(_0x43fb12,_0x213c93){_0x213c93=_0x213c93||0xcc;return function(_0x4ac7e6){if(_0x4ac7e6){return _0x43fb12['sendStatus'](_0x213c93);}return _0x43fb12['status'](_0x213c93)[_0xe9cd('0x19')]();};}function respondWithResult(_0x19b9bc,_0x201f0d){_0x201f0d=_0x201f0d||0xc8;return function(_0x14fa92){if(_0x14fa92){return _0x19b9bc[_0xe9cd('0x1a')](_0x201f0d)['json'](_0x14fa92);}};}function respondWithFilteredResult(_0x4efaee,_0x376496){return function(_0x3e05ca){if(_0x3e05ca){var _0x2f0b46=_0x3e05ca[_0xe9cd('0x1b')],_0x80f91c=_0x376496[_0xe9cd('0x1c')],_0x3519f2=_0x376496['offset']+_0x376496[_0xe9cd('0x1d')],_0x16667d;if(_0x3519f2>=_0x2f0b46){_0x3519f2=_0x2f0b46;_0x16667d=0xc8;}else{_0x16667d=0xce;}_0x4efaee[_0xe9cd('0x1a')](_0x16667d);return _0x4efaee[_0xe9cd('0x1e')](_0xe9cd('0x1f'),_0x80f91c+'-'+_0x3519f2+'/'+_0x2f0b46)[_0xe9cd('0x20')](_0x3e05ca);}return null;};}function patchUpdates(_0x23700b){return function(_0x1c05e8){try{jsonpatch['apply'](_0x1c05e8,_0x23700b,!![]);}catch(_0xce93bb){return BPromise[_0xe9cd('0x21')](_0xce93bb);}return _0x1c05e8[_0xe9cd('0x22')]();};}function saveUpdates(_0xe18c8a,_0x5a9b2b){return function(_0x3687a8){if(_0x3687a8){return _0x3687a8[_0xe9cd('0x23')](_0xe18c8a)[_0xe9cd('0x24')](function(_0x396358){return _0x396358;});}return null;};}function removeEntity(_0x56db7c,_0x38e337){return function(_0x423312){if(_0x423312){return _0x423312['destroy']()[_0xe9cd('0x24')](function(){_0x56db7c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ce805,_0x3c8b5f){return function(_0x3fecde){if(!_0x3fecde){_0x1ce805[_0xe9cd('0x25')](0x194);}return _0x3fecde;};}function handleError(_0x74e515,_0x9dd144){_0x9dd144=_0x9dd144||0x1f4;return function(_0x7b53ca){logger[_0xe9cd('0x26')](_0x7b53ca[_0xe9cd('0x27')]);if(_0x7b53ca[_0xe9cd('0x28')]){delete _0x7b53ca[_0xe9cd('0x28')];}_0x74e515[_0xe9cd('0x1a')](_0x9dd144)['send'](_0x7b53ca);};}exports[_0xe9cd('0x29')]=function(_0x2bb07d,_0x4271ea){var _0x389139={},_0x44616b={},_0xe6db58={'count':0x0,'rows':[]};var _0x336ccf=_[_0xe9cd('0x2a')](db[_0xe9cd('0x2b')][_0xe9cd('0x2c')],function(_0x350500){return{'name':_0x350500['fieldName'],'type':_0x350500[_0xe9cd('0x2d')]['key']};});_0x44616b[_0xe9cd('0x2e')]=_[_0xe9cd('0x2f')](_[_0xe9cd('0x2a')](_0x336ccf,_0xe9cd('0x28')),[_0xe9cd('0x28')]);_0x44616b[_0xe9cd('0x30')]=_[_0xe9cd('0x31')](_0x2bb07d[_0xe9cd('0x30')]);_0x44616b['filters']=_['intersection'](_0x44616b[_0xe9cd('0x2e')],_0x44616b[_0xe9cd('0x30')]);_0x389139[_0xe9cd('0x32')]=_[_0xe9cd('0x33')](_0x44616b[_0xe9cd('0x2e')],qs[_0xe9cd('0x34')](_0x2bb07d[_0xe9cd('0x30')][_0xe9cd('0x34')]));_0x389139[_0xe9cd('0x32')]=_0x389139['attributes']['length']?_0x389139['attributes']:_0x44616b[_0xe9cd('0x2e')];if(!_0x2bb07d['query'][_0xe9cd('0x35')](_0xe9cd('0x36'))){_0x389139[_0xe9cd('0x1d')]=qs['limit'](_0x2bb07d[_0xe9cd('0x30')][_0xe9cd('0x1d')]);_0x389139[_0xe9cd('0x1c')]=qs['offset'](_0x2bb07d[_0xe9cd('0x30')][_0xe9cd('0x1c')]);}_0x389139[_0xe9cd('0x37')]=qs[_0xe9cd('0x38')](_0x2bb07d[_0xe9cd('0x30')][_0xe9cd('0x38')]);_0x389139['where']=qs[_0xe9cd('0x39')](_[_0xe9cd('0x3a')](_0x2bb07d['query'],_0x44616b['filters']),_0x336ccf);if(_0x2bb07d[_0xe9cd('0x30')]['filter']){_0x389139[_0xe9cd('0x3b')]=_[_0xe9cd('0x3c')](_0x389139[_0xe9cd('0x3b')],{'$or':_[_0xe9cd('0x2a')](_0x336ccf,function(_0x5a362d){if(_0x5a362d[_0xe9cd('0x2d')]!==_0xe9cd('0x3d')){var _0x610553={};_0x610553[_0x5a362d[_0xe9cd('0x28')]]={'$like':'%'+_0x2bb07d[_0xe9cd('0x30')][_0xe9cd('0x3e')]+'%'};return _0x610553;}})});}_0x389139=_[_0xe9cd('0x3c')]({},_0x389139,_0x2bb07d[_0xe9cd('0x3f')]);var _0x5ee682={'where':_0x389139[_0xe9cd('0x3b')]};return db[_0xe9cd('0x2b')][_0xe9cd('0x1b')](_0x5ee682)['then'](function(_0x3f391f){_0xe6db58['count']=_0x3f391f;if(_0x2bb07d[_0xe9cd('0x30')]['includeAll']){_0x389139['include']=[{'all':!![]}];}return db[_0xe9cd('0x2b')]['findAll'](_0x389139);})[_0xe9cd('0x24')](function(_0x17a5c0){_0xe6db58[_0xe9cd('0x40')]=_0x17a5c0;return _0xe6db58;})['then'](respondWithFilteredResult(_0x4271ea,_0x389139))['catch'](handleError(_0x4271ea,null));};exports[_0xe9cd('0x41')]=function(_0x4d4ac2,_0x511f33){var _0x53b5bb={'raw':!![],'where':{'id':_0x4d4ac2[_0xe9cd('0x42')]['id']}},_0x3ca6cc={};_0x3ca6cc[_0xe9cd('0x2e')]=_[_0xe9cd('0x31')](db[_0xe9cd('0x2b')][_0xe9cd('0x2c')]);_0x3ca6cc[_0xe9cd('0x30')]=_[_0xe9cd('0x31')](_0x4d4ac2[_0xe9cd('0x30')]);_0x3ca6cc[_0xe9cd('0x39')]=_[_0xe9cd('0x33')](_0x3ca6cc[_0xe9cd('0x2e')],_0x3ca6cc[_0xe9cd('0x30')]);_0x53b5bb[_0xe9cd('0x32')]=_[_0xe9cd('0x33')](_0x3ca6cc[_0xe9cd('0x2e')],qs['fields'](_0x4d4ac2[_0xe9cd('0x30')]['fields']));_0x53b5bb[_0xe9cd('0x32')]=_0x53b5bb[_0xe9cd('0x32')][_0xe9cd('0x43')]?_0x53b5bb['attributes']:_0x3ca6cc[_0xe9cd('0x2e')];if(_0x4d4ac2[_0xe9cd('0x30')][_0xe9cd('0x44')]){_0x53b5bb[_0xe9cd('0x45')]=[{'all':!![]}];}_0x53b5bb=_[_0xe9cd('0x3c')]({},_0x53b5bb,_0x4d4ac2[_0xe9cd('0x3f')]);return db[_0xe9cd('0x2b')][_0xe9cd('0x46')](_0x53b5bb)[_0xe9cd('0x24')](handleEntityNotFound(_0x511f33,null))[_0xe9cd('0x24')](respondWithResult(_0x511f33,null))[_0xe9cd('0x47')](handleError(_0x511f33,null));};exports[_0xe9cd('0x23')]=function(_0x30c46e,_0x5301ab){if(_0x30c46e[_0xe9cd('0x48')]['id']){delete _0x30c46e['body']['id'];}return db[_0xe9cd('0x2b')][_0xe9cd('0x46')]({'where':{'id':_0x30c46e[_0xe9cd('0x42')]['id']}})[_0xe9cd('0x24')](handleEntityNotFound(_0x5301ab,null))[_0xe9cd('0x24')](saveUpdates(_0x30c46e[_0xe9cd('0x48')],null))['then'](respondWithResult(_0x5301ab,null))['catch'](handleError(_0x5301ab,null));};exports[_0xe9cd('0x49')]=function(_0x119800,_0x1afb51){return db[_0xe9cd('0x2b')][_0xe9cd('0x46')]({'where':{'id':_0x119800[_0xe9cd('0x42')]['id']}})['then'](handleEntityNotFound(_0x1afb51,null))[_0xe9cd('0x24')](removeEntity(_0x1afb51,null))[_0xe9cd('0x47')](handleError(_0x1afb51,null));};exports['create']=function(_0x230bfe,_0x49463d){var _0x3e1385;return db['sequelize'][_0xe9cd('0x4a')](function(_0x32da52){return db[_0xe9cd('0x2b')][_0xe9cd('0x4b')](_0x230bfe[_0xe9cd('0x48')],{'transaction':_0x32da52})[_0xe9cd('0x24')](function(_0x586ab1){_0x3e1385=_0x586ab1;var _0x3f5e57={'type':db['Sequelize'][_0xe9cd('0x4c')],'transaction':_0x32da52};switch(_0x230bfe[_0xe9cd('0x48')][_0xe9cd('0x2d')]){case _0xe9cd('0x4d'):_0x3f5e57['type']=db[_0xe9cd('0x4e')]['TEXT'];break;case _0xe9cd('0x4f'):_0x3f5e57[_0xe9cd('0x2d')]=db['Sequelize'][_0xe9cd('0x50')];break;case _0xe9cd('0x51'):_0x3f5e57['type']=db['Sequelize'][_0xe9cd('0x52')];_0x3f5e57[_0xe9cd('0x53')]=![];break;default:}return db[_0xe9cd('0x54')][_0xe9cd('0x55')][_0xe9cd('0x56')](_0xe9cd('0x57'),util[_0xe9cd('0x58')](_0xe9cd('0x59'),_0x3e1385['id']),_0x3f5e57);})[_0xe9cd('0x24')](function(){return _0x3e1385;});})[_0xe9cd('0x24')](respondWithResult(_0x49463d,0xc9))[_0xe9cd('0x47')](handleError(_0x49463d,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9f9cd2f..85c9ae4 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 _0xb350=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x1f8a2a,_0x906b0f){var _0x4dcaa7=function(_0x55098d){while(--_0x55098d){_0x1f8a2a['push'](_0x1f8a2a['shift']());}};_0x4dcaa7(++_0x906b0f);}(_0xb350,0x6f));var _0x0b35=function(_0x453c8,_0xd0e4b5){_0x453c8=_0x453c8-0x0;var _0x10ff7b=_0xb350[_0x453c8];return _0x10ff7b;};'use strict';var _=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var logger=require(_0x0b35('0x2'))(_0x0b35('0x3'));var moment=require('moment');var BPromise=require(_0x0b35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b35('0x5'));var rimraf=require('rimraf');var config=require(_0x0b35('0x6'));var attributes=require(_0x0b35('0x7'));module[_0x0b35('0x8')]=function(_0x1218c3,_0x417722){return _0x1218c3[_0x0b35('0x9')](_0x0b35('0xa'),attributes,{'tableName':_0x0b35('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b70=['./cmCustomField.attributes','define','cm_custom_fields','util','api','moment','request-promise','path','rimraf'];(function(_0x3b0d98,_0x346f06){var _0x296885=function(_0x8b1247){while(--_0x8b1247){_0x3b0d98['push'](_0x3b0d98['shift']());}};_0x296885(++_0x346f06);}(_0x0b70,0x159));var _0x00b7=function(_0x29a6b6,_0x3dd139){_0x29a6b6=_0x29a6b6-0x0;var _0x3458c5=_0x0b70[_0x29a6b6];return _0x3458c5;};'use strict';var _=require('lodash');var util=require(_0x00b7('0x0'));var logger=require('../../config/logger')(_0x00b7('0x1'));var moment=require(_0x00b7('0x2'));var BPromise=require('bluebird');var rp=require(_0x00b7('0x3'));var fs=require('fs');var path=require(_0x00b7('0x4'));var rimraf=require(_0x00b7('0x5'));var config=require('../../config/environment');var attributes=require(_0x00b7('0x6'));module['exports']=function(_0x81e64,_0x54332d){return _0x81e64[_0x00b7('0x7')]('CmCustomField',attributes,{'tableName':_0x00b7('0x8'),'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 5a92ff5..0b508a0 100644 --- a/server/api/cmCustomField/cmCustomField.rpc.js +++ b/server/api/cmCustomField/cmCustomField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x43c168,_0xe52541){var _0x233b90=function(_0x4111c2){while(--_0x4111c2){_0x43c168['push'](_0x43c168['shift']());}};_0x233b90(++_0xe52541);}(_0xb821,0xa7));var _0x1b82=function(_0x5aa424,_0x5afd70){_0x5aa424=_0x5aa424-0x0;var _0x135d46=_0xb821[_0x5aa424];return _0x135d46;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0xf021=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CmCustomField,\x20%s,\x20%s','result','catch'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xf021,0x18f));var _0x1f02=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xf021[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var moment=require(_0x1f02('0x2'));var BPromise=require(_0x1f02('0x3'));var rs=require(_0x1f02('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f02('0x6'))(_0x1f02('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f02('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383d0b,_0x257d6a,_0x2a6c50){return new BPromise(function(_0x4193d2,_0x1f1cec){return client['request'](_0x383d0b,_0x2a6c50)[_0x1f02('0x9')](function(_0x5dc295){logger['info']('CmCustomField,\x20%s,\x20%s',_0x257d6a,_0x1f02('0xa'));logger[_0x1f02('0xb')](_0x1f02('0xc'),_0x257d6a,_0x1f02('0xa'),JSON[_0x1f02('0xd')](_0x5dc295));if(_0x5dc295['error']){if(_0x5dc295[_0x1f02('0xe')][_0x1f02('0xf')]===0x1f4){logger[_0x1f02('0xe')]('CmCustomField,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x1f1cec(_0x5dc295[_0x1f02('0xe')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x4193d2(_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);}else{logger[_0x1f02('0x11')](_0x1f02('0x12'),_0x257d6a,_0x1f02('0xa'));_0x4193d2(_0x5dc295[_0x1f02('0x13')]['message']);}})[_0x1f02('0x14')](function(_0x5cca16){logger['error']('CmCustomField,\x20%s,\x20%s',_0x257d6a,_0x5cca16);_0x1f1cec(_0x5cca16);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e98dfe4..dba1b1c 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 _0xfaa3=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','put','exports','multer','connect-timeout','express','Router'];(function(_0x1eb856,_0x17f105){var _0x5a4b05=function(_0x572a42){while(--_0x572a42){_0x1eb856['push'](_0x1eb856['shift']());}};_0x5a4b05(++_0x17f105);}(_0xfaa3,0x137));var _0x3faa=function(_0x4aad3a,_0x3cc97b){_0x4aad3a=_0x4aad3a-0x0;var _0x380ed1=_0xfaa3[_0x4aad3a];return _0x380ed1;};'use strict';var multer=require(_0x3faa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3faa('0x1'));var express=require(_0x3faa('0x2'));var router=express[_0x3faa('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3faa('0x4'));var config=require(_0x3faa('0x5'));var controller=require(_0x3faa('0x6'));router[_0x3faa('0x7')]('/',auth[_0x3faa('0x8')](),controller['index']);router['get'](_0x3faa('0x9'),auth[_0x3faa('0x8')](),controller[_0x3faa('0xa')]);router[_0x3faa('0xb')]('/',auth[_0x3faa('0x8')](),controller[_0x3faa('0xc')]);router[_0x3faa('0xd')](_0x3faa('0x9'),auth[_0x3faa('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3faa('0xe')]=router; \ No newline at end of file +var _0xe1c3=['isAuthenticated','index','/:id','show','post','create','put','update','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x200db1,_0x94fb33){var _0x25f499=function(_0x5317f9){while(--_0x5317f9){_0x200db1['push'](_0x200db1['shift']());}};_0x25f499(++_0x94fb33);}(_0xe1c3,0x116));var _0x3e1c=function(_0x127d97,_0x2c0773){_0x127d97=_0x127d97-0x0;var _0x3a1083=_0xe1c3[_0x127d97];return _0x3a1083;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3e1c('0x0'));var timeout=require(_0x3e1c('0x1'));var express=require(_0x3e1c('0x2'));var router=express['Router']();var auth=require(_0x3e1c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3e1c('0x4'));var controller=require(_0x3e1c('0x5'));router[_0x3e1c('0x6')]('/',auth[_0x3e1c('0x7')](),controller[_0x3e1c('0x8')]);router[_0x3e1c('0x6')](_0x3e1c('0x9'),auth[_0x3e1c('0x7')](),controller[_0x3e1c('0xa')]);router[_0x3e1c('0xb')]('/',auth[_0x3e1c('0x7')](),controller[_0x3e1c('0xc')]);router[_0x3e1c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3e1c('0xe')]);router['delete']('/:id',auth[_0x3e1c('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 03fe5f0..9f475ba 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 _0x4975=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','DATE','format'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0x4975,0x86));var _0x5497=function(_0x543dcf,_0x302e45){_0x543dcf=_0x543dcf-0x0;var _0x575a6f=_0x4975[_0x543dcf];return _0x575a6f;};'use strict';var moment=require(_0x5497('0x0'));var Sequelize=require('sequelize');module[_0x5497('0x1')]={'phone':{'type':Sequelize[_0x5497('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5497('0x4')],'defaultValue':moment()[_0x5497('0x5')](_0x5497('0x6'))},'countbusyretry':{'type':Sequelize[_0x5497('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5497('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5497('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5497('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x5497('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5497('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x5497('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x5497('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x5497('0x7')],'unique':_0x5497('0x9')},'CampaignId':{'type':Sequelize[_0x5497('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x5497('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5497('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5497('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5497('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc4aa=['exports','STRING','BOOLEAN','DATE','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x8900bc,_0x1fa648){var _0x57973f=function(_0x9d4d6){while(--_0x9d4d6){_0x8900bc['push'](_0x8900bc['shift']());}};_0x57973f(++_0x1fa648);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var moment=require(_0xac4a('0x0'));var Sequelize=require(_0xac4a('0x1'));module[_0xac4a('0x2')]={'phone':{'type':Sequelize[_0xac4a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xac4a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xac4a('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xac4a('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xac4a('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xac4a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xac4a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xac4a('0x5')]},'priority':{'type':Sequelize[_0xac4a('0x6')](0x2)[_0xac4a('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xac4a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xac4a('0x6')],'unique':_0xac4a('0x8')},'UserId':{'type':Sequelize[_0xac4a('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xac4a('0x8')},'CampaignId':{'type':Sequelize[_0xac4a('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xac4a('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xac4a('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xac4a('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index df8fb76..d772c0d 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 _0xc9de=['scheduledAt','DESC','ASC','literal','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','List','dialActive','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','show','params','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','getPreview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds'];(function(_0x16af01,_0x9c623c){var _0x4d4b9a=function(_0x26019f){while(--_0x26019f){_0x16af01['push'](_0x16af01['shift']());}};_0x4d4b9a(++_0x9c623c);}(_0xc9de,0x1f0));var _0xec9d=function(_0x2cae77,_0x1a445e){_0x2cae77=_0x2cae77-0x0;var _0x41116c=_0xc9de[_0x2cae77];return _0x41116c;};'use strict';var pdf=require(_0xec9d('0x0'));var emlformat=require(_0xec9d('0x1'));var rimraf=require(_0xec9d('0x2'));var zipdir=require(_0xec9d('0x3'));var jsonpatch=require(_0xec9d('0x4'));var rp=require(_0xec9d('0x5'));var moment=require(_0xec9d('0x6'));var BPromise=require(_0xec9d('0x7'));var Mustache=require(_0xec9d('0x8'));var util=require(_0xec9d('0x9'));var path=require(_0xec9d('0xa'));var sox=require(_0xec9d('0xb'));var csv=require(_0xec9d('0xc'));var ejs=require(_0xec9d('0xd'));var fs=require('fs');var _=require(_0xec9d('0xe'));var squel=require(_0xec9d('0xf'));var crypto=require(_0xec9d('0x10'));var jsforce=require(_0xec9d('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xec9d('0xc'));var querystring=require(_0xec9d('0x12'));var Papa=require(_0xec9d('0x13'));var Redis=require(_0xec9d('0x14'));var shared=require('../../config/environment');var authService=require('../../components/auth/service');var qs=require(_0xec9d('0x15'));var as=require(_0xec9d('0x16'));var hardwareService=require(_0xec9d('0x17'));var logger=require('../../config/logger')(_0xec9d('0x18'));var utils=require('../../config/utils');var config=require(_0xec9d('0x19'));var db=require(_0xec9d('0x1a'))['db'];function respondWithStatusCode(_0x3b779f,_0x46e8ee){_0x46e8ee=_0x46e8ee||0xcc;return function(_0x301623){if(_0x301623){return _0x3b779f['sendStatus'](_0x46e8ee);}return _0x3b779f['status'](_0x46e8ee)[_0xec9d('0x1b')]();};}function respondWithResult(_0x5a92cc,_0x110291){_0x110291=_0x110291||0xc8;return function(_0x315c88){if(_0x315c88){return _0x5a92cc[_0xec9d('0x1c')](_0x110291)[_0xec9d('0x1d')](_0x315c88);}};}function respondWithFilteredResult(_0x46342d,_0x40fb52){return function(_0x5b4a21){if(_0x5b4a21){var _0x584fb3=_0x5b4a21['count'],_0x2c73ec=_0x40fb52['offset'],_0x4fbaf1=_0x40fb52[_0xec9d('0x1e')]+_0x40fb52['limit'],_0x2626ac;if(_0x4fbaf1>=_0x584fb3){_0x4fbaf1=_0x584fb3;_0x2626ac=0xc8;}else{_0x2626ac=0xce;}_0x46342d[_0xec9d('0x1c')](_0x2626ac);return _0x46342d[_0xec9d('0x1f')](_0xec9d('0x20'),_0x2c73ec+'-'+_0x4fbaf1+'/'+_0x584fb3)[_0xec9d('0x1d')](_0x5b4a21);}return null;};}function patchUpdates(_0xc95a38){return function(_0x4062a2){try{jsonpatch[_0xec9d('0x21')](_0x4062a2,_0xc95a38,!![]);}catch(_0xc68ca0){return BPromise['reject'](_0xc68ca0);}return _0x4062a2[_0xec9d('0x22')]();};}function saveUpdates(_0x2c36cd,_0x27d018){return function(_0x49aba2){if(_0x49aba2){return _0x49aba2[_0xec9d('0x23')](_0x2c36cd)[_0xec9d('0x24')](function(_0xb0ad66){return _0xb0ad66;});}return null;};}function removeEntity(_0x14406f,_0x1a1740){return function(_0x178406){if(_0x178406){return _0x178406['destroy']()[_0xec9d('0x24')](function(){_0x14406f[_0xec9d('0x1c')](0xcc)[_0xec9d('0x1b')]();});}};}function handleEntityNotFound(_0x5e6484,_0xd9acbd){return function(_0x5dacec){if(!_0x5dacec){_0x5e6484['sendStatus'](0x194);}return _0x5dacec;};}function handleError(_0x5eed36,_0x730929){_0x730929=_0x730929||0x1f4;return function(_0x14d2a1){logger[_0xec9d('0x25')](_0x14d2a1[_0xec9d('0x26')]);if(_0x14d2a1[_0xec9d('0x27')]){delete _0x14d2a1['name'];}_0x5eed36[_0xec9d('0x1c')](_0x730929)[_0xec9d('0x28')](_0x14d2a1);};}exports[_0xec9d('0x29')]=function(_0x3fa048,_0x3c7820){var _0x5c4875={},_0x49c1d4={},_0x59398c={'count':0x0,'rows':[]};var _0x2ed9a1=_[_0xec9d('0x2a')](db[_0xec9d('0x2b')][_0xec9d('0x2c')],function(_0x4b333f){return{'name':_0x4b333f[_0xec9d('0x2d')],'type':_0x4b333f[_0xec9d('0x2e')][_0xec9d('0x2f')]};});_0x49c1d4[_0xec9d('0x30')]=_['map'](_0x2ed9a1,'name');_0x49c1d4['query']=_[_0xec9d('0x31')](_0x3fa048[_0xec9d('0x32')]);_0x49c1d4[_0xec9d('0x33')]=_[_0xec9d('0x34')](_0x49c1d4[_0xec9d('0x30')],_0x49c1d4[_0xec9d('0x32')]);_0x49c1d4[_0xec9d('0x33')]=_['concat'](_0x49c1d4['filters'],[_0xec9d('0x35'),_0xec9d('0x36'),_0xec9d('0x37'),_0xec9d('0x38'),_0xec9d('0x39'),'$lte',_0xec9d('0x3a'),_0xec9d('0x3b'),_0xec9d('0x3c'),'$between',_0xec9d('0x3d'),_0xec9d('0x3e'),_0xec9d('0x3f'),_0xec9d('0x40'),_0xec9d('0x41'),_0xec9d('0x42'),'$notILike',_0xec9d('0x40'),_0xec9d('0x43'),_0xec9d('0x44'),_0xec9d('0x45'),_0xec9d('0x46')]);_0x5c4875[_0xec9d('0x47')]=_[_0xec9d('0x34')](_0x49c1d4[_0xec9d('0x30')],qs[_0xec9d('0x48')](_0x3fa048[_0xec9d('0x32')][_0xec9d('0x48')]));_0x5c4875['attributes']=_0x5c4875[_0xec9d('0x47')][_0xec9d('0x49')]?_0x5c4875[_0xec9d('0x47')]:_0x49c1d4[_0xec9d('0x30')];if(!_0x3fa048[_0xec9d('0x32')]['hasOwnProperty'](_0xec9d('0x4a'))){_0x5c4875[_0xec9d('0x4b')]=qs['limit'](_0x3fa048[_0xec9d('0x32')][_0xec9d('0x4b')]);_0x5c4875[_0xec9d('0x1e')]=qs['offset'](_0x3fa048[_0xec9d('0x32')][_0xec9d('0x1e')]);}_0x5c4875[_0xec9d('0x4c')]=qs[_0xec9d('0x4d')](_0x3fa048[_0xec9d('0x32')][_0xec9d('0x4d')]);_0x5c4875[_0xec9d('0x4e')]=qs['filters'](_[_0xec9d('0x4f')](_0x3fa048['query'],_0x49c1d4[_0xec9d('0x33')]),_0x2ed9a1);if(_0x3fa048[_0xec9d('0x32')][_0xec9d('0x50')]){_0x5c4875['where']=_[_0xec9d('0x51')](_0x5c4875[_0xec9d('0x4e')],{'$or':_[_0xec9d('0x2a')](_0x2ed9a1,function(_0x592d0e){if(_0x592d0e[_0xec9d('0x2e')]!=='VIRTUAL'){var _0x2739a6={};_0x2739a6[_0x592d0e[_0xec9d('0x27')]]={'$like':'%'+_0x3fa048[_0xec9d('0x32')][_0xec9d('0x50')]+'%'};return _0x2739a6;}})});}_0x5c4875=_[_0xec9d('0x51')]({},_0x5c4875,_0x3fa048[_0xec9d('0x52')]);var _0x229bea={'where':_0x5c4875['where']};return db['CmHopper'][_0xec9d('0x53')](_0x229bea)[_0xec9d('0x24')](function(_0x4f8445){_0x59398c[_0xec9d('0x53')]=_0x4f8445;if(_0x3fa048[_0xec9d('0x32')][_0xec9d('0x54')]){_0x5c4875[_0xec9d('0x55')]=[{'all':!![]}];}return db[_0xec9d('0x2b')]['findAll'](_0x5c4875);})['then'](function(_0x3f6360){_0x59398c[_0xec9d('0x56')]=_0x3f6360;return _0x59398c;})[_0xec9d('0x24')](respondWithFilteredResult(_0x3c7820,_0x5c4875))[_0xec9d('0x57')](handleError(_0x3c7820,null));};exports[_0xec9d('0x58')]=function(_0x4b1dfa,_0x1cb9bf){var _0x6cd981={'raw':!![],'where':{'id':_0x4b1dfa[_0xec9d('0x59')]['id']}},_0x5aa00d={};_0x5aa00d[_0xec9d('0x30')]=_[_0xec9d('0x31')](db['CmHopper'][_0xec9d('0x2c')]);_0x5aa00d[_0xec9d('0x32')]=_[_0xec9d('0x31')](_0x4b1dfa[_0xec9d('0x32')]);_0x5aa00d[_0xec9d('0x33')]=_[_0xec9d('0x34')](_0x5aa00d[_0xec9d('0x30')],_0x5aa00d[_0xec9d('0x32')]);_0x6cd981[_0xec9d('0x47')]=_[_0xec9d('0x34')](_0x5aa00d[_0xec9d('0x30')],qs[_0xec9d('0x48')](_0x4b1dfa[_0xec9d('0x32')]['fields']));_0x6cd981[_0xec9d('0x47')]=_0x6cd981['attributes'][_0xec9d('0x49')]?_0x6cd981[_0xec9d('0x47')]:_0x5aa00d[_0xec9d('0x30')];if(_0x4b1dfa['query'][_0xec9d('0x54')]){_0x6cd981['include']=[{'all':!![]}];}_0x6cd981=_[_0xec9d('0x51')]({},_0x6cd981,_0x4b1dfa['options']);return db[_0xec9d('0x2b')]['find'](_0x6cd981)[_0xec9d('0x24')](handleEntityNotFound(_0x1cb9bf,null))['then'](respondWithResult(_0x1cb9bf,null))[_0xec9d('0x57')](handleError(_0x1cb9bf,null));};exports[_0xec9d('0x5a')]=function(_0x58c934,_0x2e37d3){return db[_0xec9d('0x2b')]['create'](_0x58c934['body'],{})['then'](respondWithResult(_0x2e37d3,0xc9))['catch'](handleError(_0x2e37d3,null));};exports['update']=function(_0x5163c5,_0xdd82a0){if(_0x5163c5[_0xec9d('0x5b')]['id']){delete _0x5163c5[_0xec9d('0x5b')]['id'];}return db[_0xec9d('0x2b')][_0xec9d('0x5c')]({'where':{'id':_0x5163c5['params']['id']}})[_0xec9d('0x24')](handleEntityNotFound(_0xdd82a0,null))[_0xec9d('0x24')](saveUpdates(_0x5163c5[_0xec9d('0x5b')],null))[_0xec9d('0x24')](respondWithResult(_0xdd82a0,null))[_0xec9d('0x57')](handleError(_0xdd82a0,null));};exports['describe']=function(_0x2ecc54,_0x34cf38){return db[_0xec9d('0x2b')][_0xec9d('0x5d')]()[_0xec9d('0x24')](respondWithResult(_0x34cf38,null))[_0xec9d('0x57')](handleError(_0x34cf38,null));};exports[_0xec9d('0x5e')]=function(_0xdb09b1,_0x82f9f4){var _0x3aaa0d;return db[_0xec9d('0x2b')][_0xec9d('0x5c')]({'where':{'id':_0xdb09b1[_0xec9d('0x59')]['id']}})['then'](handleEntityNotFound(_0x82f9f4,null))[_0xec9d('0x24')](function(_0x402ce6){if(_0x402ce6){return _0x402ce6[_0xec9d('0x5e')]()[_0xec9d('0x24')](function(_0x9c4701){return _0x9c4701;});}})['then'](function(_0x570d8c){_0x3aaa0d=_0x570d8c;if(_0x570d8c){if(_0x570d8c[_0xec9d('0x5f')]||_0x570d8c[_0xec9d('0x60')]){return db[_0x570d8c[_0xec9d('0x5f')]?_0xec9d('0x61'):_0xec9d('0x62')][_0xec9d('0x5c')]({'where':{'id':_0x570d8c['VoiceQueueId']?_0x570d8c['VoiceQueueId']:_0x570d8c[_0xec9d('0x60')]},'attributes':['id',_0xec9d('0x27')],'raw':!![]});}}})[_0xec9d('0x24')](function(_0x149843){var _0x12f616={};if(_0x149843){_[_0xec9d('0x51')](_0x12f616,_[_0xec9d('0x63')](_0x3aaa0d[_0xec9d('0x64')],[_0xec9d('0x65'),_0xec9d('0x66'),'id']));_0x12f616[_0xec9d('0x67')]=0x15;_0x12f616[_0xec9d('0x68')]=_0xec9d('0x69');_0x12f616[_0xec9d('0x6a')]=_0x149843[_0xec9d('0x27')];_0x12f616[_0xec9d('0x6b')]=_0xdb09b1[_0xec9d('0x6c')][_0xec9d('0x27')];_0x12f616[_0xec9d('0x6d')]=_0xdb09b1[_0xec9d('0x6c')]['id'];_0x12f616[_0xec9d('0x69')]=!![];_0x12f616[_0xec9d('0x6e')]=moment()[_0xec9d('0x6f')]('YYYY-MM-DD\x20HH:mm:ss');_0x12f616[_0xec9d('0x70')]=_0x3aaa0d[_0xec9d('0x71')];_0x12f616[_0xec9d('0x72')]=_0x3aaa0d[_0xec9d('0x5f')]?'queue':_0xec9d('0x73');return db[_0xec9d('0x74')]['find']({'where':{'id':_0x12f616[_0xec9d('0x75')]},'attributes':[_0xec9d('0x76'),'lastName']})[_0xec9d('0x24')](function(_0x5aa329){if(!_[_0xec9d('0x77')](_0x82f9f4)&&!_['isNil'](_0x5aa329[_0xec9d('0x76')])){_0x12f616[_0xec9d('0x78')]=_0x5aa329['firstName'];if(!_[_0xec9d('0x77')](_0x5aa329[_0xec9d('0x79')])){_0x12f616[_0xec9d('0x78')]+='\x20'+_0x5aa329[_0xec9d('0x79')];}}})[_0xec9d('0x7a')](function(){return db['CmHopperFinal'][_0xec9d('0x5a')](_0x12f616);});}})[_0xec9d('0x24')](function(){return _0x82f9f4[_0xec9d('0x1c')](0xcc)[_0xec9d('0x1b')]();})['catch'](handleError(_0x82f9f4,null));};exports[_0xec9d('0x7b')]=function(_0x56c45e,_0x1cca29,_0x14db6e){var _0x49f9c7=[];return db[_0xec9d('0x74')][_0xec9d('0x5d')]()['then'](function(_0x2690b6){_0x49f9c7=_[_0xec9d('0x31')](_0x2690b6);return _0x56c45e['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xec9d('0x7c')],'raw':!![]});})['then'](function(_0x11f75a){if(_0x11f75a&&_0x11f75a['length']){return db[_0xec9d('0x7d')][_0xec9d('0x7e')](function(_0x1be0ce){var _0x1534fe={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xec9d('0x6f')](_0xec9d('0x7f'))},'VoiceQueueId':{'$in':_[_0xec9d('0x2a')](_0x11f75a,'id')},'$or':[{'UserId':null},{'UserId':_0x56c45e[_0xec9d('0x6c')]['id']}]};var _0x25362e=[];if(_0x56c45e[_0xec9d('0x5b')]['direction']&&_0x56c45e[_0xec9d('0x5b')][_0xec9d('0x80')]===_0xec9d('0x81')){if(!_[_0xec9d('0x82')](_0x56c45e['body'][_0xec9d('0x83')])){_0x1534fe['id']={'$in':_0x56c45e[_0xec9d('0x5b')][_0xec9d('0x83')]};}_0x25362e=[['priority','ASC'],[_0xec9d('0x84'),_0x11f75a[0x0][_0xec9d('0x7c')]==='ASC'?_0xec9d('0x85'):_0xec9d('0x86')],db[_0xec9d('0x7d')][_0xec9d('0x87')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x56c45e[_0xec9d('0x5b')]['hopperIds'])){_0x1534fe['id']={'$notIn':_0x56c45e['body'][_0xec9d('0x83')]};}_0x25362e=[[_0xec9d('0x88'),_0xec9d('0x85')],[_0xec9d('0x84'),_0x11f75a[0x0][_0xec9d('0x7c')]],db['sequelize']['literal'](_0xec9d('0x89')),['id',_0xec9d('0x86')]];}return db[_0xec9d('0x2b')][_0xec9d('0x8a')]({'attributes':['id',_0xec9d('0x8b')],'where':_0x1534fe,'order':_0x25362e,'transaction':_0x1be0ce,'lock':_0x1be0ce[_0xec9d('0x8c')][_0xec9d('0x8d')],'include':[{'model':db[_0xec9d('0x74')],'as':_0xec9d('0x8e'),'attributes':_0x49f9c7,'include':[{'model':db['CmCompany'],'as':_0xec9d('0x8f'),'attributes':['id',_0xec9d('0x27')]}]},{'model':db['CmList'],'as':_0xec9d('0x90'),'attributes':['id',_0xec9d('0x27')]},{'model':db[_0xec9d('0x61')],'as':'Queue','attributes':['id',_0xec9d('0x27'),_0xec9d('0x91')]}]})['then'](function(_0xfb1df6){if(_0xfb1df6){return _0xfb1df6[_0xec9d('0x23')]({'UserId':_0x56c45e[_0xec9d('0x6c')]['id']},{'transaction':_0x1be0ce});}});});}})[_0xec9d('0x24')](handleEntityNotFound(_0x1cca29,null))['then'](respondWithResult(_0x1cca29,null))[_0xec9d('0x57')](handleError(_0x1cca29,null));};exports[_0xec9d('0x92')]=function(_0x4dc072,_0x286d2c,_0x58c9af){return _0x4dc072[_0xec9d('0x6c')]['getVoiceQueues']({'where':{'type':_0xec9d('0x93'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xec9d('0x24')](function(_0x263c72){if(_0x263c72&&_0x263c72[_0xec9d('0x49')]){return db[_0xec9d('0x2b')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xec9d('0x6f')](_0xec9d('0x7f'))},'VoiceQueueId':{'$in':_[_0xec9d('0x2a')](_0x263c72,'id')},'$or':[{'UserId':null},{'UserId':_0x4dc072['user']['id']}]}});}return 0x0;})[_0xec9d('0x24')](function(_0x588b84){if(!_[_0xec9d('0x77')](_0x588b84)&&_[_0xec9d('0x94')](_0x588b84)){return _0x286d2c[_0xec9d('0x1c')](0xc8)[_0xec9d('0x1d')]({'contacts':_0x588b84});}else{logger[_0xec9d('0x25')](_0xec9d('0x95'),'getOpenContacts',0x194,_0xec9d('0x96'));_0x286d2c[_0xec9d('0x97')](0x194);}})[_0xec9d('0x57')](handleError(_0x286d2c,null));};exports[_0xec9d('0x98')]=function(_0x3094a4,_0x451315,_0x26e0a0){var _0x577ba3=shared[_0xec9d('0x99')];var _0x2ec5fd=[];_[_0xec9d('0x2a')](_0x577ba3,function(_0x11df7d){_0x2ec5fd[_0xec9d('0x9a')]({'id':_0x11df7d[_0xec9d('0x27')],'name':_0x11df7d['name'],'utcOffset':_0x11df7d[_0xec9d('0x9b')]});});return _0x451315[_0xec9d('0x1c')](0xc8)[_0xec9d('0x1d')]({'tz':_0x2ec5fd});};exports[_0xec9d('0x9c')]=function(_0x5438f8,_0x4596a9,_0x244a58){var _0x414ef7=shared[_0xec9d('0x99')];var _0x5958e2={};if(!_[_0xec9d('0x77')](_0x414ef7[_0x5438f8[_0xec9d('0x5b')]['id']]))_0x5958e2=_0x414ef7[_0x5438f8[_0xec9d('0x5b')]['id']];return _0x4596a9[_0xec9d('0x1c')](0xc8)[_0xec9d('0x1d')](_0x5958e2);}; \ No newline at end of file +var _0xd67d=['deleted','membername','user','deletedat','format','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','getPreview','keys','outbound','preview','dialOrderByScheduledAt','sequelize','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','dialActive','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','getTimezone','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/environment','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopper','fieldName','key','model','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$ne','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','statedesc'];(function(_0xfcf1ff,_0x1453ba){var _0x118b0a=function(_0x15be1f){while(--_0x15be1f){_0xfcf1ff['push'](_0xfcf1ff['shift']());}};_0x118b0a(++_0x1453ba);}(_0xd67d,0xc9));var _0xdd67=function(_0x1e1d07,_0x299b1e){_0x1e1d07=_0x1e1d07-0x0;var _0x225dce=_0xd67d[_0x1e1d07];return _0x225dce;};'use strict';var pdf=require(_0xdd67('0x0'));var emlformat=require(_0xdd67('0x1'));var rimraf=require(_0xdd67('0x2'));var zipdir=require(_0xdd67('0x3'));var jsonpatch=require(_0xdd67('0x4'));var rp=require(_0xdd67('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdd67('0x6'));var util=require(_0xdd67('0x7'));var path=require(_0xdd67('0x8'));var sox=require(_0xdd67('0x9'));var csv=require(_0xdd67('0xa'));var ejs=require(_0xdd67('0xb'));var fs=require('fs');var _=require(_0xdd67('0xc'));var squel=require('squel');var crypto=require(_0xdd67('0xd'));var jsforce=require(_0xdd67('0xe'));var deskjs=require(_0xdd67('0xf'));var toCsv=require(_0xdd67('0xa'));var querystring=require(_0xdd67('0x10'));var Papa=require(_0xdd67('0x11'));var Redis=require(_0xdd67('0x12'));var shared=require(_0xdd67('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd67('0x14'));var logger=require(_0xdd67('0x15'))(_0xdd67('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a0c69,_0x50ca34){_0x50ca34=_0x50ca34||0xcc;return function(_0x5df909){if(_0x5df909){return _0x3a0c69[_0xdd67('0x17')](_0x50ca34);}return _0x3a0c69[_0xdd67('0x18')](_0x50ca34)[_0xdd67('0x19')]();};}function respondWithResult(_0x250333,_0x2edeff){_0x2edeff=_0x2edeff||0xc8;return function(_0x33d486){if(_0x33d486){return _0x250333[_0xdd67('0x18')](_0x2edeff)[_0xdd67('0x1a')](_0x33d486);}};}function respondWithFilteredResult(_0x1b928f,_0x52756d){return function(_0x56a949){if(_0x56a949){var _0x3ee232=_0x56a949[_0xdd67('0x1b')],_0x363925=_0x52756d[_0xdd67('0x1c')],_0x1a3ce2=_0x52756d[_0xdd67('0x1c')]+_0x52756d[_0xdd67('0x1d')],_0x492e28;if(_0x1a3ce2>=_0x3ee232){_0x1a3ce2=_0x3ee232;_0x492e28=0xc8;}else{_0x492e28=0xce;}_0x1b928f[_0xdd67('0x18')](_0x492e28);return _0x1b928f[_0xdd67('0x1e')]('Content-Range',_0x363925+'-'+_0x1a3ce2+'/'+_0x3ee232)[_0xdd67('0x1a')](_0x56a949);}return null;};}function patchUpdates(_0x550fd6){return function(_0x3717fa){try{jsonpatch[_0xdd67('0x1f')](_0x3717fa,_0x550fd6,!![]);}catch(_0x36d47e){return BPromise[_0xdd67('0x20')](_0x36d47e);}return _0x3717fa['save']();};}function saveUpdates(_0x1de8df,_0x421f1e){return function(_0x277796){if(_0x277796){return _0x277796[_0xdd67('0x21')](_0x1de8df)[_0xdd67('0x22')](function(_0x1f5376){return _0x1f5376;});}return null;};}function removeEntity(_0xb27bbf,_0x583038){return function(_0x15e5fb){if(_0x15e5fb){return _0x15e5fb[_0xdd67('0x23')]()[_0xdd67('0x22')](function(){_0xb27bbf[_0xdd67('0x18')](0xcc)[_0xdd67('0x19')]();});}};}function handleEntityNotFound(_0x2cd3af,_0x2ed86c){return function(_0xa6aa26){if(!_0xa6aa26){_0x2cd3af[_0xdd67('0x17')](0x194);}return _0xa6aa26;};}function handleError(_0x186e29,_0x124ae9){_0x124ae9=_0x124ae9||0x1f4;return function(_0x501762){logger[_0xdd67('0x24')](_0x501762[_0xdd67('0x25')]);if(_0x501762[_0xdd67('0x26')]){delete _0x501762[_0xdd67('0x26')];}_0x186e29[_0xdd67('0x18')](_0x124ae9)[_0xdd67('0x27')](_0x501762);};}exports[_0xdd67('0x28')]=function(_0x1f0ef8,_0x2f2b8b){var _0x37b58a={},_0x38014c={},_0x3ac312={'count':0x0,'rows':[]};var _0x444e99=_[_0xdd67('0x29')](db[_0xdd67('0x2a')]['rawAttributes'],function(_0x1d64d1){return{'name':_0x1d64d1[_0xdd67('0x2b')],'type':_0x1d64d1['type'][_0xdd67('0x2c')]};});_0x38014c[_0xdd67('0x2d')]=_[_0xdd67('0x29')](_0x444e99,'name');_0x38014c[_0xdd67('0x2e')]=_['keys'](_0x1f0ef8[_0xdd67('0x2e')]);_0x38014c[_0xdd67('0x2f')]=_[_0xdd67('0x30')](_0x38014c[_0xdd67('0x2d')],_0x38014c['query']);_0x38014c[_0xdd67('0x2f')]=_[_0xdd67('0x31')](_0x38014c[_0xdd67('0x2f')],[_0xdd67('0x32'),_0xdd67('0x33'),_0xdd67('0x34'),_0xdd67('0x35'),_0xdd67('0x36'),'$lte',_0xdd67('0x37'),'$eq','$not',_0xdd67('0x38'),_0xdd67('0x39'),_0xdd67('0x3a'),_0xdd67('0x3b'),_0xdd67('0x3c'),_0xdd67('0x3d'),_0xdd67('0x3e'),'$notILike',_0xdd67('0x3c'),_0xdd67('0x3f'),_0xdd67('0x40'),_0xdd67('0x41'),_0xdd67('0x42')]);_0x37b58a[_0xdd67('0x43')]=_[_0xdd67('0x30')](_0x38014c[_0xdd67('0x2d')],qs[_0xdd67('0x44')](_0x1f0ef8[_0xdd67('0x2e')]['fields']));_0x37b58a[_0xdd67('0x43')]=_0x37b58a[_0xdd67('0x43')][_0xdd67('0x45')]?_0x37b58a[_0xdd67('0x43')]:_0x38014c[_0xdd67('0x2d')];if(!_0x1f0ef8[_0xdd67('0x2e')][_0xdd67('0x46')](_0xdd67('0x47'))){_0x37b58a[_0xdd67('0x1d')]=qs[_0xdd67('0x1d')](_0x1f0ef8[_0xdd67('0x2e')]['limit']);_0x37b58a[_0xdd67('0x1c')]=qs[_0xdd67('0x1c')](_0x1f0ef8[_0xdd67('0x2e')][_0xdd67('0x1c')]);}_0x37b58a['order']=qs['sort'](_0x1f0ef8[_0xdd67('0x2e')][_0xdd67('0x48')]);_0x37b58a[_0xdd67('0x49')]=qs[_0xdd67('0x2f')](_[_0xdd67('0x4a')](_0x1f0ef8['query'],_0x38014c[_0xdd67('0x2f')]),_0x444e99);if(_0x1f0ef8[_0xdd67('0x2e')][_0xdd67('0x4b')]){_0x37b58a[_0xdd67('0x49')]=_['merge'](_0x37b58a[_0xdd67('0x49')],{'$or':_[_0xdd67('0x29')](_0x444e99,function(_0x32c2b6){if(_0x32c2b6['type']!==_0xdd67('0x4c')){var _0x28321d={};_0x28321d[_0x32c2b6[_0xdd67('0x26')]]={'$like':'%'+_0x1f0ef8[_0xdd67('0x2e')][_0xdd67('0x4b')]+'%'};return _0x28321d;}})});}_0x37b58a=_[_0xdd67('0x4d')]({},_0x37b58a,_0x1f0ef8[_0xdd67('0x4e')]);var _0xfec8e1={'where':_0x37b58a[_0xdd67('0x49')]};return db[_0xdd67('0x2a')][_0xdd67('0x1b')](_0xfec8e1)[_0xdd67('0x22')](function(_0x2da8e3){_0x3ac312[_0xdd67('0x1b')]=_0x2da8e3;if(_0x1f0ef8['query']['includeAll']){_0x37b58a['include']=[{'all':!![]}];}return db[_0xdd67('0x2a')]['findAll'](_0x37b58a);})[_0xdd67('0x22')](function(_0xf659c){_0x3ac312[_0xdd67('0x4f')]=_0xf659c;return _0x3ac312;})[_0xdd67('0x22')](respondWithFilteredResult(_0x2f2b8b,_0x37b58a))[_0xdd67('0x50')](handleError(_0x2f2b8b,null));};exports[_0xdd67('0x51')]=function(_0x8b6b6,_0x5ae12b){var _0x3e2cd7={'raw':!![],'where':{'id':_0x8b6b6[_0xdd67('0x52')]['id']}},_0x1dc4f4={};_0x1dc4f4['model']=_['keys'](db[_0xdd67('0x2a')][_0xdd67('0x53')]);_0x1dc4f4[_0xdd67('0x2e')]=_['keys'](_0x8b6b6[_0xdd67('0x2e')]);_0x1dc4f4[_0xdd67('0x2f')]=_[_0xdd67('0x30')](_0x1dc4f4[_0xdd67('0x2d')],_0x1dc4f4[_0xdd67('0x2e')]);_0x3e2cd7[_0xdd67('0x43')]=_[_0xdd67('0x30')](_0x1dc4f4['model'],qs[_0xdd67('0x44')](_0x8b6b6[_0xdd67('0x2e')][_0xdd67('0x44')]));_0x3e2cd7[_0xdd67('0x43')]=_0x3e2cd7['attributes'][_0xdd67('0x45')]?_0x3e2cd7[_0xdd67('0x43')]:_0x1dc4f4['model'];if(_0x8b6b6['query'][_0xdd67('0x54')]){_0x3e2cd7[_0xdd67('0x55')]=[{'all':!![]}];}_0x3e2cd7=_[_0xdd67('0x4d')]({},_0x3e2cd7,_0x8b6b6[_0xdd67('0x4e')]);return db['CmHopper'][_0xdd67('0x56')](_0x3e2cd7)['then'](handleEntityNotFound(_0x5ae12b,null))[_0xdd67('0x22')](respondWithResult(_0x5ae12b,null))[_0xdd67('0x50')](handleError(_0x5ae12b,null));};exports[_0xdd67('0x57')]=function(_0x1ccb05,_0x3826e0){return db[_0xdd67('0x2a')][_0xdd67('0x57')](_0x1ccb05[_0xdd67('0x58')],{})[_0xdd67('0x22')](respondWithResult(_0x3826e0,0xc9))[_0xdd67('0x50')](handleError(_0x3826e0,null));};exports[_0xdd67('0x21')]=function(_0x5924db,_0x502f3a){if(_0x5924db[_0xdd67('0x58')]['id']){delete _0x5924db['body']['id'];}return db[_0xdd67('0x2a')][_0xdd67('0x56')]({'where':{'id':_0x5924db[_0xdd67('0x52')]['id']}})[_0xdd67('0x22')](handleEntityNotFound(_0x502f3a,null))[_0xdd67('0x22')](saveUpdates(_0x5924db[_0xdd67('0x58')],null))[_0xdd67('0x22')](respondWithResult(_0x502f3a,null))['catch'](handleError(_0x502f3a,null));};exports['describe']=function(_0x37fcf2,_0x847398){return db[_0xdd67('0x2a')][_0xdd67('0x59')]()[_0xdd67('0x22')](respondWithResult(_0x847398,null))['catch'](handleError(_0x847398,null));};exports[_0xdd67('0x23')]=function(_0x22cc23,_0x52cdeb){var _0x31d3a2;return db['CmHopper'][_0xdd67('0x56')]({'where':{'id':_0x22cc23['params']['id']}})[_0xdd67('0x22')](handleEntityNotFound(_0x52cdeb,null))[_0xdd67('0x22')](function(_0x144751){if(_0x144751){return _0x144751[_0xdd67('0x23')]()[_0xdd67('0x22')](function(_0x15aea9){return _0x15aea9;});}})['then'](function(_0x46631c){_0x31d3a2=_0x46631c;if(_0x46631c){if(_0x46631c[_0xdd67('0x5a')]||_0x46631c[_0xdd67('0x5b')]){return db[_0x46631c['VoiceQueueId']?_0xdd67('0x5c'):'Campaign'][_0xdd67('0x56')]({'where':{'id':_0x46631c[_0xdd67('0x5a')]?_0x46631c[_0xdd67('0x5a')]:_0x46631c['CampaignId']},'attributes':['id',_0xdd67('0x26')],'raw':!![]});}}})[_0xdd67('0x22')](function(_0xcad0b7){var _0x2f40f4={};if(_0xcad0b7){_['merge'](_0x2f40f4,_[_0xdd67('0x5d')](_0x31d3a2['dataValues'],[_0xdd67('0x5e'),_0xdd67('0x5f'),'id']));_0x2f40f4['state']=0x15;_0x2f40f4[_0xdd67('0x60')]=_0xdd67('0x61');_0x2f40f4['campaign']=_0xcad0b7['name'];_0x2f40f4[_0xdd67('0x62')]=_0x22cc23[_0xdd67('0x63')]['name'];_0x2f40f4['UserId']=_0x22cc23[_0xdd67('0x63')]['id'];_0x2f40f4[_0xdd67('0x61')]=!![];_0x2f40f4[_0xdd67('0x64')]=moment()[_0xdd67('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f40f4[_0xdd67('0x66')]=_0x31d3a2[_0xdd67('0x67')];_0x2f40f4[_0xdd67('0x68')]=_0x31d3a2[_0xdd67('0x5a')]?_0xdd67('0x69'):_0xdd67('0x6a');return db[_0xdd67('0x6b')][_0xdd67('0x56')]({'where':{'id':_0x2f40f4[_0xdd67('0x6c')]},'attributes':['firstName','lastName']})['then'](function(_0x338195){if(!_[_0xdd67('0x6d')](_0x52cdeb)&&!_[_0xdd67('0x6d')](_0x338195[_0xdd67('0x6e')])){_0x2f40f4[_0xdd67('0x6f')]=_0x338195[_0xdd67('0x6e')];if(!_[_0xdd67('0x6d')](_0x338195[_0xdd67('0x70')])){_0x2f40f4['calleridname']+='\x20'+_0x338195[_0xdd67('0x70')];}}})[_0xdd67('0x71')](function(){return db['CmHopperFinal']['create'](_0x2f40f4);});}})[_0xdd67('0x22')](function(){return _0x52cdeb[_0xdd67('0x18')](0xcc)[_0xdd67('0x19')]();})[_0xdd67('0x50')](handleError(_0x52cdeb,null));};exports[_0xdd67('0x72')]=function(_0x23767e,_0x12b298,_0x3862f2){var _0x4637ec=[];return db[_0xdd67('0x6b')][_0xdd67('0x59')]()[_0xdd67('0x22')](function(_0x52ec04){_0x4637ec=_[_0xdd67('0x73')](_0x52ec04);return _0x23767e[_0xdd67('0x63')]['getVoiceQueues']({'where':{'type':_0xdd67('0x74'),'dialActive':!![],'dialMethod':_0xdd67('0x75')},'attributes':['id',_0xdd67('0x76')],'raw':!![]});})[_0xdd67('0x22')](function(_0x4d2177){if(_0x4d2177&&_0x4d2177[_0xdd67('0x45')]){return db[_0xdd67('0x77')]['transaction'](function(_0x8ae46b){var _0x1ebcaf={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xdd67('0x78'))},'VoiceQueueId':{'$in':_[_0xdd67('0x29')](_0x4d2177,'id')},'$or':[{'UserId':null},{'UserId':_0x23767e['user']['id']}]};var _0x26013b=[];if(_0x23767e[_0xdd67('0x58')]['direction']&&_0x23767e[_0xdd67('0x58')][_0xdd67('0x79')]===_0xdd67('0x7a')){if(!_[_0xdd67('0x7b')](_0x23767e[_0xdd67('0x58')][_0xdd67('0x7c')])){_0x1ebcaf['id']={'$in':_0x23767e[_0xdd67('0x58')]['hopperIds']};}_0x26013b=[[_0xdd67('0x7d'),_0xdd67('0x7e')],[_0xdd67('0x7f'),_0x4d2177[0x0][_0xdd67('0x76')]===_0xdd67('0x7e')?_0xdd67('0x80'):'ASC'],db['sequelize']['literal'](_0xdd67('0x81')),['id',_0xdd67('0x80')]];}else{if(!_[_0xdd67('0x7b')](_0x23767e[_0xdd67('0x58')][_0xdd67('0x7c')])){_0x1ebcaf['id']={'$notIn':_0x23767e[_0xdd67('0x58')]['hopperIds']};}_0x26013b=[[_0xdd67('0x7d'),'DESC'],[_0xdd67('0x7f'),_0x4d2177[0x0][_0xdd67('0x76')]],db[_0xdd67('0x77')][_0xdd67('0x82')](_0xdd67('0x83')),['id','ASC']];}return db[_0xdd67('0x2a')][_0xdd67('0x84')]({'attributes':['id',_0xdd67('0x85')],'where':_0x1ebcaf,'order':_0x26013b,'transaction':_0x8ae46b,'lock':_0x8ae46b[_0xdd67('0x86')]['UPDATE'],'include':[{'model':db[_0xdd67('0x6b')],'as':_0xdd67('0x87'),'attributes':_0x4637ec,'include':[{'model':db[_0xdd67('0x88')],'as':_0xdd67('0x89'),'attributes':['id',_0xdd67('0x26')]}]},{'model':db[_0xdd67('0x8a')],'as':'List','attributes':['id',_0xdd67('0x26')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0xdd67('0x8b')]}]})[_0xdd67('0x22')](function(_0x459501){if(_0x459501){return _0x459501[_0xdd67('0x21')]({'UserId':_0x23767e[_0xdd67('0x63')]['id']},{'transaction':_0x8ae46b});}});});}})['then'](handleEntityNotFound(_0x12b298,null))[_0xdd67('0x22')](respondWithResult(_0x12b298,null))[_0xdd67('0x50')](handleError(_0x12b298,null));};exports[_0xdd67('0x8c')]=function(_0xae5c19,_0x256392,_0xc4dfbd){return _0xae5c19[_0xdd67('0x63')][_0xdd67('0x8d')]({'where':{'type':_0xdd67('0x74'),'dialActive':!![],'dialMethod':_0xdd67('0x75')},'attributes':['id'],'raw':!![]})[_0xdd67('0x22')](function(_0x3bf9e3){if(_0x3bf9e3&&_0x3bf9e3[_0xdd67('0x45')]){return db[_0xdd67('0x2a')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xdd67('0x78'))},'VoiceQueueId':{'$in':_[_0xdd67('0x29')](_0x3bf9e3,'id')},'$or':[{'UserId':null},{'UserId':_0xae5c19[_0xdd67('0x63')]['id']}]}});}return 0x0;})['then'](function(_0x4cf662){if(!_[_0xdd67('0x6d')](_0x4cf662)&&_[_0xdd67('0x8e')](_0x4cf662)){return _0x256392['status'](0xc8)[_0xdd67('0x1a')]({'contacts':_0x4cf662});}else{logger[_0xdd67('0x24')](_0xdd67('0x8f'),_0xdd67('0x8c'),0x194,_0xdd67('0x90'));_0x256392[_0xdd67('0x17')](0x194);}})[_0xdd67('0x50')](handleError(_0x256392,null));};exports[_0xdd67('0x91')]=function(_0xe35af0,_0x2883c5,_0x2d162e){var _0x35ab48=shared[_0xdd67('0x92')];var _0x24665d=[];_['map'](_0x35ab48,function(_0x4b2482){_0x24665d[_0xdd67('0x93')]({'id':_0x4b2482[_0xdd67('0x26')],'name':_0x4b2482['name'],'utcOffset':_0x4b2482['utcOffset']});});return _0x2883c5[_0xdd67('0x18')](0xc8)['json']({'tz':_0x24665d});};exports[_0xdd67('0x94')]=function(_0x404eca,_0x291c43,_0xc62401){var _0x15a89a=shared['timezones'];var _0x15aa92={};if(!_[_0xdd67('0x6d')](_0x15a89a[_0x404eca[_0xdd67('0x58')]['id']]))_0x15aa92=_0x15a89a[_0x404eca[_0xdd67('0x58')]['id']];return _0x291c43[_0xdd67('0x18')](0xc8)[_0xdd67('0x1a')](_0x15aa92);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 1e862d5..ee6ee5b 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 _0x11b0=['rimraf','../../config/environment','exports','scheduledat','phone','lodash','util','api','bluebird','path'];(function(_0x101af5,_0x3bead5){var _0x4c383f=function(_0xcc338f){while(--_0xcc338f){_0x101af5['push'](_0x101af5['shift']());}};_0x4c383f(++_0x3bead5);}(_0x11b0,0x69));var _0x011b=function(_0xf182ad,_0x1d6947){_0xf182ad=_0xf182ad-0x0;var _0x3f42e1=_0x11b0[_0xf182ad];return _0x3f42e1;};'use strict';var _=require(_0x011b('0x0'));var util=require(_0x011b('0x1'));var logger=require('../../config/logger')(_0x011b('0x2'));var moment=require('moment');var BPromise=require(_0x011b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x011b('0x4'));var rimraf=require(_0x011b('0x5'));var config=require(_0x011b('0x6'));var attributes=require('./cmHopper.attributes');module[_0x011b('0x7')]=function(_0x5aa6f1,_0x5d143f){return _0x5aa6f1['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x011b('0x8'),'fields':['scheduledat']},{'name':_0x011b('0x9'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8030=['moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','util','../../config/logger','api'];(function(_0x427486,_0x16f799){var _0x531478=function(_0x47e8f4){while(--_0x47e8f4){_0x427486['push'](_0x427486['shift']());}};_0x531478(++_0x16f799);}(_0x8030,0x185));var _0x0803=function(_0x497d8c,_0x2904c9){_0x497d8c=_0x497d8c-0x0;var _0xeafed7=_0x8030[_0x497d8c];return _0xeafed7;};'use strict';var _=require('lodash');var util=require(_0x0803('0x0'));var logger=require(_0x0803('0x1'))(_0x0803('0x2'));var moment=require(_0x0803('0x3'));var BPromise=require('bluebird');var rp=require(_0x0803('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0803('0x5'));var config=require(_0x0803('0x6'));var attributes=require(_0x0803('0x7'));module[_0x0803('0x8')]=function(_0x55dc6f,_0x3f5600){return _0x55dc6f[_0x0803('0x9')](_0x0803('0xa'),attributes,{'tableName':_0x0803('0xb'),'paranoid':![],'indexes':[{'name':_0x0803('0xc'),'fields':[_0x0803('0xc')]},{'name':_0x0803('0xd'),'fields':[_0x0803('0xd')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 246b1df..66ac905 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 _0xf403=['CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UPDATE','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','log','req\x20value','phone','findOne','dialTimezone','DESC','getcontactbyohone','getContactByPhone','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','code','error','CmHopper,\x20%s,\x20%s','message','result','catch','options','where','attributes','limit','include','map','model','GetCmHopper','debug','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','raw','UpdateCmHopper','update','DestroyCmHopper','destroy','describe','sequelize','transaction','findAll','LOCK','CmContact','Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal'];(function(_0x435611,_0x4b5eb5){var _0x2a03d5=function(_0x28d07e){while(--_0x28d07e){_0x435611['push'](_0x435611['shift']());}};_0x2a03d5(++_0x4b5eb5);}(_0xf403,0x158));var _0x3f40=function(_0x3f8767,_0x1e8437){_0x3f8767=_0x3f8767-0x0;var _0x1b822a=_0xf403[_0x3f8767];return _0x1b822a;};'use strict';var _=require('lodash');var util=require(_0x3f40('0x0'));var moment=require(_0x3f40('0x1'));var BPromise=require(_0x3f40('0x2'));var rs=require(_0x3f40('0x3'));var fs=require('fs');var Redis=require(_0x3f40('0x4'));var db=require(_0x3f40('0x5'))['db'];var utils=require(_0x3f40('0x6'));var logger=require('../../config/logger')(_0x3f40('0x7'));var config=require(_0x3f40('0x8'));var jayson=require(_0x3f40('0x9'));var client=jayson['client'][_0x3f40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x294b87,_0x542e89,_0xa4334a){return new BPromise(function(_0x2dd895,_0xa7c3a7){return client[_0x3f40('0xb')](_0x294b87,_0xa4334a)[_0x3f40('0xc')](function(_0x19146f){logger[_0x3f40('0xd')]('CmHopper,\x20%s,\x20%s',_0x542e89,_0x3f40('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x542e89,_0x3f40('0xe'),JSON[_0x3f40('0xf')](_0x19146f));if(_0x19146f['error']){if(_0x19146f['error'][_0x3f40('0x10')]===0x1f4){logger[_0x3f40('0x11')](_0x3f40('0x12'),_0x542e89,_0x19146f[_0x3f40('0x11')]['message']);return _0xa7c3a7(_0x19146f[_0x3f40('0x11')][_0x3f40('0x13')]);}logger[_0x3f40('0x11')]('CmHopper,\x20%s,\x20%s',_0x542e89,_0x19146f[_0x3f40('0x11')]['message']);return _0x2dd895(_0x19146f[_0x3f40('0x11')][_0x3f40('0x13')]);}else{logger[_0x3f40('0xd')]('CmHopper,\x20%s,\x20%s',_0x542e89,_0x3f40('0xe'));_0x2dd895(_0x19146f[_0x3f40('0x14')][_0x3f40('0x13')]);}})[_0x3f40('0x15')](function(_0x5287ca){logger[_0x3f40('0x11')](_0x3f40('0x12'),_0x542e89,_0x5287ca);_0xa7c3a7(_0x5287ca);});});}exports['GetCmHopper']=function(_0x424359){var _0x59f6ee=this;return new Promise(function(_0xf57c88,_0x22783c){return db['CmHopper']['findAll']({'raw':_0x424359[_0x3f40('0x16')]?_0x424359[_0x3f40('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x424359[_0x3f40('0x16')]?_0x424359[_0x3f40('0x16')][_0x3f40('0x17')]||null:null,'attributes':_0x424359[_0x3f40('0x16')]?_0x424359[_0x3f40('0x16')][_0x3f40('0x18')]||null:null,'limit':_0x424359[_0x3f40('0x16')]?_0x424359[_0x3f40('0x16')][_0x3f40('0x19')]||null:null,'include':_0x424359[_0x3f40('0x16')]?_0x424359[_0x3f40('0x16')][_0x3f40('0x1a')]?_[_0x3f40('0x1b')](_0x424359[_0x3f40('0x16')]['include'],function(_0x838c6f){return{'model':db[_0x838c6f[_0x3f40('0x1c')]],'as':_0x838c6f['as'],'attributes':_0x838c6f[_0x3f40('0x18')],'include':_0x838c6f[_0x3f40('0x1a')]?_[_0x3f40('0x1b')](_0x838c6f[_0x3f40('0x1a')],function(_0x172baf){return{'model':db[_0x172baf['model']],'as':_0x172baf['as'],'attributes':_0x172baf[_0x3f40('0x18')],'include':_0x172baf[_0x3f40('0x1a')]?_['map'](_0x172baf[_0x3f40('0x1a')],function(_0x40255b){return{'model':db[_0x40255b['model']],'as':_0x40255b['as'],'attributes':_0x40255b[_0x3f40('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19bc2c){logger[_0x3f40('0xd')](_0x3f40('0x1d'),_0x424359);logger[_0x3f40('0x1e')](_0x3f40('0x1d'),_0x424359,JSON[_0x3f40('0xf')](_0x19bc2c));_0xf57c88(_0x19bc2c);})[_0x3f40('0x15')](function(_0x527b89){logger[_0x3f40('0x11')](_0x3f40('0x1d'),_0x527b89[_0x3f40('0x13')],_0x424359);_0x22783c(_0x59f6ee[_0x3f40('0x11')](0x1f4,_0x527b89[_0x3f40('0x13')]));});});};exports[_0x3f40('0x1f')]=function(_0x29ab9f){var _0x408a4d=this;return new Promise(function(_0x3ec025,_0x2ae718){return db[_0x3f40('0x20')][_0x3f40('0x21')]({'raw':_0x29ab9f[_0x3f40('0x16')]?_0x29ab9f[_0x3f40('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x29ab9f[_0x3f40('0x16')]?_0x29ab9f[_0x3f40('0x16')][_0x3f40('0x17')]||null:null,'attributes':_0x29ab9f[_0x3f40('0x16')]?_0x29ab9f[_0x3f40('0x16')][_0x3f40('0x18')]||null:null,'include':_0x29ab9f[_0x3f40('0x16')]?_0x29ab9f[_0x3f40('0x16')][_0x3f40('0x1a')]?_[_0x3f40('0x1b')](_0x29ab9f[_0x3f40('0x16')][_0x3f40('0x1a')],function(_0xb9333d){return{'model':db[_0xb9333d[_0x3f40('0x1c')]],'as':_0xb9333d['as'],'attributes':_0xb9333d[_0x3f40('0x18')],'include':_0xb9333d[_0x3f40('0x1a')]?_[_0x3f40('0x1b')](_0xb9333d[_0x3f40('0x1a')],function(_0x3298dd){return{'model':db[_0x3298dd[_0x3f40('0x1c')]],'as':_0x3298dd['as'],'attributes':_0x3298dd[_0x3f40('0x18')],'include':_0x3298dd[_0x3f40('0x1a')]?_[_0x3f40('0x1b')](_0x3298dd[_0x3f40('0x1a')],function(_0x4b9aea){return{'model':db[_0x4b9aea['model']],'as':_0x4b9aea['as'],'attributes':_0x4b9aea[_0x3f40('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e5016){logger[_0x3f40('0xd')](_0x3f40('0x1f'),_0x29ab9f);logger[_0x3f40('0x1e')](_0x3f40('0x1f'),_0x29ab9f,JSON[_0x3f40('0xf')](_0x5e5016));_0x3ec025(_0x5e5016);})[_0x3f40('0x15')](function(_0x2b5639){logger[_0x3f40('0x11')](_0x3f40('0x1f'),_0x2b5639[_0x3f40('0x13')],_0x29ab9f);_0x2ae718(_0x408a4d[_0x3f40('0x11')](0x1f4,_0x2b5639['message']));});});};exports[_0x3f40('0x22')]=function(_0x3c15da){var _0x3c2d42=this;return new Promise(function(_0x18afe1,_0x2a1c08){return db[_0x3f40('0x20')][_0x3f40('0x23')](_0x3c15da[_0x3f40('0x24')],{'raw':_0x3c15da[_0x3f40('0x16')]?_0x3c15da[_0x3f40('0x16')][_0x3f40('0x25')]===undefined?!![]:![]:!![]})[_0x3f40('0xc')](function(_0x5a20ae){logger[_0x3f40('0xd')](_0x3f40('0x22'),_0x3c15da);logger[_0x3f40('0x1e')](_0x3f40('0x22'),_0x3c15da,JSON[_0x3f40('0xf')](_0x5a20ae));_0x18afe1(_0x5a20ae);})['catch'](function(_0x3b091e){logger[_0x3f40('0x11')](_0x3f40('0x22'),_0x3b091e[_0x3f40('0x13')],_0x3c15da);_0x2a1c08(_0x3c2d42[_0x3f40('0x11')](0x1f4,_0x3b091e[_0x3f40('0x13')]));});});};exports[_0x3f40('0x26')]=function(_0x581f96){var _0x135cb8=this;return new Promise(function(_0x3c9037,_0x4e1fc9){return db[_0x3f40('0x20')][_0x3f40('0x27')](_0x581f96['body'],{'raw':_0x581f96['options']?_0x581f96[_0x3f40('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x581f96[_0x3f40('0x16')]?_0x581f96[_0x3f40('0x16')][_0x3f40('0x17')]||null:null,'attributes':_0x581f96[_0x3f40('0x16')]?_0x581f96[_0x3f40('0x16')]['attributes']||null:null,'limit':_0x581f96[_0x3f40('0x16')]?_0x581f96['options'][_0x3f40('0x19')]||null:null})[_0x3f40('0xc')](function(_0x6f508d){logger['info'](_0x3f40('0x26'),_0x581f96);logger[_0x3f40('0x1e')](_0x3f40('0x26'),_0x581f96,JSON['stringify'](_0x6f508d));_0x3c9037(_0x6f508d);})[_0x3f40('0x15')](function(_0xb57340){logger[_0x3f40('0x11')]('UpdateCmHopper',_0xb57340[_0x3f40('0x13')],_0x581f96);_0x4e1fc9(_0x135cb8[_0x3f40('0x11')](0x1f4,_0xb57340[_0x3f40('0x13')]));});});};exports[_0x3f40('0x28')]=function(_0x3e0bb8){var _0x188f8a=this;return new Promise(function(_0x4eb1f5,_0x25df1b){return db[_0x3f40('0x20')][_0x3f40('0x29')]({'where':_0x3e0bb8[_0x3f40('0x16')]?_0x3e0bb8[_0x3f40('0x16')][_0x3f40('0x17')]||null:null})[_0x3f40('0xc')](function(_0x51f41b){logger[_0x3f40('0xd')](_0x3f40('0x28'),_0x3e0bb8);logger[_0x3f40('0x1e')](_0x3f40('0x28'),_0x3e0bb8,JSON[_0x3f40('0xf')](_0x51f41b));_0x4eb1f5(_0x51f41b);})[_0x3f40('0x15')](function(_0x566de4){logger['error'](_0x3f40('0x28'),_0x566de4[_0x3f40('0x13')],_0x3e0bb8);_0x25df1b(_0x188f8a[_0x3f40('0x11')](0x1f4,_0x566de4['message']));});});};exports['GetContactDialer']=function(_0x1229d2){var _0x1cbedc=this;return new Promise(function(_0x55d907,_0x4f6e9f){return db['CmContact'][_0x3f40('0x2a')]()['then'](function(_0x285069){return db[_0x3f40('0x2b')][_0x3f40('0x2c')](function(_0x3662c7){return db[_0x3f40('0x20')][_0x3f40('0x2d')]({'where':_0x1229d2[_0x3f40('0x16')]?_0x1229d2[_0x3f40('0x16')][_0x3f40('0x17')]||null:null,'attributes':_0x1229d2[_0x3f40('0x16')]?_0x1229d2['options'][_0x3f40('0x18')]||null:null,'limit':_0x1229d2[_0x3f40('0x16')]?_0x1229d2[_0x3f40('0x16')][_0x3f40('0x19')]||null:null,'order':_0x1229d2[_0x3f40('0x16')]?_0x1229d2['options']['order']||null:null,'transaction':_0x3662c7,'lock':_0x3662c7[_0x3f40('0x2e')]['UPDATE'],'include':[{'model':db[_0x3f40('0x2f')],'as':_0x3f40('0x30'),'attributes':_[_0x3f40('0x31')](_0x285069)},{'model':db[_0x3f40('0x32')],'as':_0x3f40('0x33'),'attributes':['id',_0x3f40('0x34'),_0x3f40('0x35')]}]})[_0x3f40('0xc')](function(_0x45399c){var _0x4a347a=[];var _0x351453=[];for(var _0x22c7da=0x0;_0x22c7da<_0x45399c[_0x3f40('0x36')];_0x22c7da+=0x1){if(!_0x351453['includes'](_0x45399c[_0x22c7da][_0x3f40('0x37')])){_0x351453[_0x3f40('0x38')](_0x45399c[_0x22c7da][_0x3f40('0x37')]);_0x4a347a[_0x3f40('0x38')](_0x45399c[_0x22c7da]['update'](_0x1229d2[_0x3f40('0x24')],{'transaction':_0x3662c7}));}}return BPromise[_0x3f40('0x39')](_0x4a347a);});})[_0x3f40('0xc')](function(_0xb97e27){logger[_0x3f40('0xd')](_0x3f40('0x3a'),_0x1229d2);logger[_0x3f40('0x1e')](_0x3f40('0x3a'),_0x1229d2,JSON[_0x3f40('0xf')](_0xb97e27));_0x55d907(_0xb97e27);})[_0x3f40('0x15')](function(_0xe4676e){logger[_0x3f40('0x11')](_0x3f40('0x3a'),_0xe4676e[_0x3f40('0x13')],_0x1229d2);_0x4f6e9f(_0x1cbedc[_0x3f40('0x11')](0x1f4,_0xe4676e[_0x3f40('0x13')]));});});});};exports[_0x3f40('0x3b')]=function(_0x3d1e22){var _0x28e01d=this;return new Promise(function(_0x3b7217,_0x589359){return db[_0x3f40('0x2b')][_0x3f40('0x2c')](function(_0x2c0411){return db[_0x3f40('0x3c')]['create'](_0x3d1e22[_0x3f40('0x24')],{'raw':_0x3d1e22[_0x3f40('0x16')]?_0x3d1e22['options'][_0x3f40('0x25')]===undefined?!![]:![]:!![],'transaction':_0x2c0411})[_0x3f40('0xc')](function(){return db[_0x3f40('0x20')][_0x3f40('0x29')]({'where':_0x3d1e22['options']?_0x3d1e22[_0x3f40('0x16')][_0x3f40('0x17')]||null:null,'transaction':_0x2c0411});});})[_0x3f40('0xc')](function(_0x28bfec){logger[_0x3f40('0xd')](_0x3f40('0x3b'),_0x3d1e22);logger[_0x3f40('0x1e')](_0x3f40('0x3b'),_0x3d1e22,JSON[_0x3f40('0xf')](_0x28bfec));_0x3b7217(_0x28bfec);})[_0x3f40('0x15')](function(_0x221635){logger[_0x3f40('0x11')](_0x3f40('0x3b'),_0x221635[_0x3f40('0x13')],_0x3d1e22);_0x589359(_0x28e01d['error'](0x1f4,_0x221635[_0x3f40('0x13')]));});});};exports[_0x3f40('0x3d')]=function(_0x4eee1d){var _0x42294f=this;return new Promise(function(_0x40aff9,_0x4261e0){return db[_0x3f40('0x20')][_0x3f40('0x2d')]({'raw':_0x4eee1d['options']?_0x4eee1d[_0x3f40('0x16')][_0x3f40('0x25')]===undefined?!![]:![]:!![],'where':_0x4eee1d[_0x3f40('0x16')]?_0x4eee1d[_0x3f40('0x16')]['where']||null:null,'attributes':[[db[_0x3f40('0x2b')]['fn'](_0x3f40('0x3e'),db[_0x3f40('0x2b')]['fn']('IF',db['sequelize'][_0x3f40('0x3f')](_0x3f40('0x40')+util['format']('\x22%s\x22',moment()[_0x3f40('0x41')](_0x3f40('0x42')))+_0x3f40('0x43')))),_0x3f40('0x44')]]})['then'](function(_0x1bbb98){logger[_0x3f40('0xd')](_0x3f40('0x3d'),_0x4eee1d);logger['debug'](_0x3f40('0x3d'),_0x4eee1d,JSON[_0x3f40('0xf')](_0x1bbb98));_0x40aff9(_0x1bbb98);})[_0x3f40('0x15')](function(_0x3a1544){logger[_0x3f40('0x11')](_0x3f40('0x3d'),_0x3a1544[_0x3f40('0x13')],_0x4eee1d);_0x4261e0(_0x42294f[_0x3f40('0x11')](0x1f4,_0x3a1544['message']));});});};exports['GetContactRecallMe']=function(_0x11fa28){var _0x25ba5b=this;return new Promise(function(_0x4766e4,_0x49a5e5){return db[_0x3f40('0x2f')][_0x3f40('0x2a')]()[_0x3f40('0xc')](function(_0x163e54){return db[_0x3f40('0x2b')][_0x3f40('0x2c')](function(_0xc40ba8){return db[_0x3f40('0x20')]['findAll']({'where':_0x11fa28[_0x3f40('0x16')]?_0x11fa28[_0x3f40('0x16')][_0x3f40('0x17')]||null:null,'attributes':_0x11fa28['options']?_0x11fa28['options']['attributes']||null:null,'limit':0x1,'order':_0x11fa28[_0x3f40('0x16')]?_0x11fa28[_0x3f40('0x16')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0xc40ba8,'lock':_0xc40ba8[_0x3f40('0x2e')][_0x3f40('0x45')],'include':_0x11fa28['options']?_0x11fa28['options'][_0x3f40('0x1a')]?_['map'](_0x11fa28[_0x3f40('0x16')][_0x3f40('0x1a')],function(_0x52b7af){return{'model':db[_0x52b7af[_0x3f40('0x1c')]],'as':_0x52b7af['as'],'attributes':_0x52b7af['attributes'],'include':_0x52b7af[_0x3f40('0x1a')]?_['map'](_0x52b7af[_0x3f40('0x1a')],function(_0x654d6a){return{'model':db[_0x654d6a[_0x3f40('0x1c')]],'as':_0x654d6a['as'],'attributes':_0x654d6a[_0x3f40('0x18')],'include':_0x654d6a[_0x3f40('0x1a')]?_[_0x3f40('0x1b')](_0x654d6a[_0x3f40('0x1a')],function(_0x3d2871){return{'model':db[_0x3d2871['model']],'as':_0x3d2871['as'],'attributes':_0x3d2871['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f40('0xc')](function(_0x49038a){var _0x3dcb66=[];for(var _0x3a3d5d=0x0;_0x3a3d5d<_0x49038a['length'];_0x3a3d5d+=0x1){_0x3dcb66[_0x3f40('0x38')](_0x49038a[_0x3a3d5d][_0x3f40('0x27')](_0x11fa28[_0x3f40('0x24')],{'transaction':_0xc40ba8}));}return BPromise['all'](_0x3dcb66);});})[_0x3f40('0xc')](function(_0x4f5023){logger[_0x3f40('0xd')](_0x3f40('0x46'),_0x11fa28);logger[_0x3f40('0x1e')]('GetContactRecallMe',_0x11fa28,JSON[_0x3f40('0xf')](_0x4f5023));_0x4766e4(_0x4f5023);})[_0x3f40('0x15')](function(_0x56fc4e){logger['error'](_0x3f40('0x46'),_0x56fc4e['message'],_0x11fa28);_0x49a5e5(_0x25ba5b[_0x3f40('0x11')](0x1f4,_0x56fc4e[_0x3f40('0x13')]));});});});};exports[_0x3f40('0x47')]=function(_0x57ec4a){var _0x21ee89=this;return new Promise(function(_0x1511c4,_0xedceeb){db[_0x3f40('0x2f')][_0x3f40('0x2a')]()[_0x3f40('0xc')](function(_0x11a0be){return db[_0x3f40('0x20')][_0x3f40('0x2d')]({'raw':_0x57ec4a[_0x3f40('0x16')]?_0x57ec4a['options']['raw']===undefined?!![]:![]:!![],'where':_0x57ec4a[_0x3f40('0x16')]?_0x57ec4a[_0x3f40('0x16')][_0x3f40('0x17')]||null:null,'attributes':_0x57ec4a['options']?_0x57ec4a[_0x3f40('0x16')][_0x3f40('0x18')]||null:null,'limit':_0x57ec4a[_0x3f40('0x16')]?_0x57ec4a[_0x3f40('0x16')][_0x3f40('0x19')]||null:null,'include':_0x57ec4a[_0x3f40('0x16')]?_0x57ec4a['options'][_0x3f40('0x1a')]?_['map'](_0x57ec4a['options'][_0x3f40('0x1a')],function(_0x5331a0){return{'model':db[_0x5331a0[_0x3f40('0x1c')]],'as':_0x5331a0['as'],'attributes':_0x5331a0['as']==='Contact'?_['keys'](_0x11a0be):_0x5331a0[_0x3f40('0x18')],'include':_0x5331a0[_0x3f40('0x1a')]?_[_0x3f40('0x1b')](_0x5331a0[_0x3f40('0x1a')],function(_0x20c75f){return{'model':db[_0x20c75f[_0x3f40('0x1c')]],'as':_0x20c75f['as'],'attributes':_0x20c75f[_0x3f40('0x18')],'include':_0x20c75f['include']?_[_0x3f40('0x1b')](_0x20c75f[_0x3f40('0x1a')],function(_0x480b1a){return{'model':db[_0x480b1a['model']],'as':_0x480b1a['as'],'attributes':_0x480b1a[_0x3f40('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3f40('0xc')](function(_0x4f1fe1){logger['info'](_0x3f40('0x1d'),_0x57ec4a);logger[_0x3f40('0x1e')](_0x3f40('0x1d'),_0x57ec4a,JSON[_0x3f40('0xf')](_0x4f1fe1));_0x1511c4(_0x4f1fe1);})['catch'](function(_0x217d46){logger[_0x3f40('0x11')](_0x3f40('0x1d'),_0x217d46['message'],_0x57ec4a);_0xedceeb(_0x21ee89['error'](0x1f4,_0x217d46[_0x3f40('0x13')]));});});});};exports[_0x3f40('0x48')]=function(_0x56f245){console[_0x3f40('0x49')](_0x3f40('0x4a'),_0x56f245);console[_0x3f40('0x49')]('phone\x20value',_0x56f245[_0x3f40('0x16')][_0x3f40('0x17')][_0x3f40('0x4b')]);_this=this;return new Promise(function(_0x1642f3,_0x369cf5){return db['CmContact'][_0x3f40('0x4c')]({'raw':!![],'where':{'phone':_0x56f245[_0x3f40('0x16')][_0x3f40('0x17')][_0x3f40('0x4b')]},'attributes':['id',_0x3f40('0x4d')],'order':[['id',_0x3f40('0x4e')]]})[_0x3f40('0xc')](function(_0x5acdfe){console['log'](_0x3f40('0x4f'),_0x5acdfe);logger[_0x3f40('0xd')](_0x3f40('0x50'),_0x56f245);logger[_0x3f40('0x1e')](_0x3f40('0x50'),_0x56f245,JSON[_0x3f40('0xf')](_0x5acdfe));_0x1642f3(_0x5acdfe);})['catch'](function(_0x422031){logger['error']('getContactByPhone',_0x422031[_0x3f40('0x13')],_0x56f245);_0x369cf5(_this[_0x3f40('0x11')](0x1f4,_0x422031['message']));});});}; \ No newline at end of file +var _0x1a22=['info','result','catch','GetCmHopper','findAll','options','raw','attributes','limit','include','map','model','debug','CmHopper','find','ShowCmHopper','create','body','CreateCmHopper','update','where','UpdateCmHopper','DestroyCmHopper','describe','sequelize','transaction','order','LOCK','UPDATE','CmContact','keys','User','name','voicePause','length','UserId','all','GetContactDialer','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','push','GetCmHopperPreview','Contact','GetContactByPhone','log','req\x20value','findOne','dialTimezone','DESC','getContactByPhone','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4c5ae2,_0xcfb7c5){var _0x562717=function(_0x26a4af){while(--_0x26a4af){_0x4c5ae2['push'](_0x4c5ae2['shift']());}};_0x562717(++_0xcfb7c5);}(_0x1a22,0x125));var _0x21a2=function(_0x5953cb,_0x37147e){_0x5953cb=_0x5953cb-0x0;var _0x2e352e=_0x1a22[_0x5953cb];return _0x2e352e;};'use strict';var _=require(_0x21a2('0x0'));var util=require(_0x21a2('0x1'));var moment=require('moment');var BPromise=require(_0x21a2('0x2'));var rs=require(_0x21a2('0x3'));var fs=require('fs');var Redis=require(_0x21a2('0x4'));var db=require(_0x21a2('0x5'))['db'];var utils=require(_0x21a2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x21a2('0x7'));var jayson=require(_0x21a2('0x8'));var client=jayson[_0x21a2('0x9')][_0x21a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fe145,_0x56b7c3,_0x1c3305){return new BPromise(function(_0x50aa61,_0x260ad5){return client[_0x21a2('0xb')](_0x1fe145,_0x1c3305)[_0x21a2('0xc')](function(_0xcecbf){logger['info'](_0x21a2('0xd'),_0x56b7c3,_0x21a2('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x56b7c3,_0x21a2('0xe'),JSON[_0x21a2('0xf')](_0xcecbf));if(_0xcecbf[_0x21a2('0x10')]){if(_0xcecbf[_0x21a2('0x10')][_0x21a2('0x11')]===0x1f4){logger['error'](_0x21a2('0xd'),_0x56b7c3,_0xcecbf[_0x21a2('0x10')][_0x21a2('0x12')]);return _0x260ad5(_0xcecbf['error'][_0x21a2('0x12')]);}logger[_0x21a2('0x10')]('CmHopper,\x20%s,\x20%s',_0x56b7c3,_0xcecbf['error'][_0x21a2('0x12')]);return _0x50aa61(_0xcecbf[_0x21a2('0x10')][_0x21a2('0x12')]);}else{logger[_0x21a2('0x13')](_0x21a2('0xd'),_0x56b7c3,_0x21a2('0xe'));_0x50aa61(_0xcecbf[_0x21a2('0x14')][_0x21a2('0x12')]);}})[_0x21a2('0x15')](function(_0x4b02a9){logger[_0x21a2('0x10')](_0x21a2('0xd'),_0x56b7c3,_0x4b02a9);_0x260ad5(_0x4b02a9);});});}exports[_0x21a2('0x16')]=function(_0x1c160c){var _0x368792=this;return new Promise(function(_0x1e6dd1,_0x6d0610){return db['CmHopper'][_0x21a2('0x17')]({'raw':_0x1c160c[_0x21a2('0x18')]?_0x1c160c['options'][_0x21a2('0x19')]===undefined?!![]:![]:!![],'where':_0x1c160c[_0x21a2('0x18')]?_0x1c160c[_0x21a2('0x18')]['where']||null:null,'attributes':_0x1c160c['options']?_0x1c160c['options'][_0x21a2('0x1a')]||null:null,'limit':_0x1c160c['options']?_0x1c160c['options'][_0x21a2('0x1b')]||null:null,'include':_0x1c160c[_0x21a2('0x18')]?_0x1c160c[_0x21a2('0x18')][_0x21a2('0x1c')]?_['map'](_0x1c160c[_0x21a2('0x18')][_0x21a2('0x1c')],function(_0x1eeff4){return{'model':db[_0x1eeff4['model']],'as':_0x1eeff4['as'],'attributes':_0x1eeff4[_0x21a2('0x1a')],'include':_0x1eeff4[_0x21a2('0x1c')]?_[_0x21a2('0x1d')](_0x1eeff4[_0x21a2('0x1c')],function(_0xd62b1b){return{'model':db[_0xd62b1b[_0x21a2('0x1e')]],'as':_0xd62b1b['as'],'attributes':_0xd62b1b[_0x21a2('0x1a')],'include':_0xd62b1b[_0x21a2('0x1c')]?_[_0x21a2('0x1d')](_0xd62b1b['include'],function(_0x5e943d){return{'model':db[_0x5e943d[_0x21a2('0x1e')]],'as':_0x5e943d['as'],'attributes':_0x5e943d[_0x21a2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49d056){logger[_0x21a2('0x13')](_0x21a2('0x16'),_0x1c160c);logger[_0x21a2('0x1f')]('GetCmHopper',_0x1c160c,JSON[_0x21a2('0xf')](_0x49d056));_0x1e6dd1(_0x49d056);})['catch'](function(_0x95fd19){logger[_0x21a2('0x10')]('GetCmHopper',_0x95fd19[_0x21a2('0x12')],_0x1c160c);_0x6d0610(_0x368792[_0x21a2('0x10')](0x1f4,_0x95fd19['message']));});});};exports['ShowCmHopper']=function(_0x2def83){var _0x1e55a4=this;return new Promise(function(_0x314b5b,_0x38fb9d){return db[_0x21a2('0x20')][_0x21a2('0x21')]({'raw':_0x2def83['options']?_0x2def83[_0x21a2('0x18')][_0x21a2('0x19')]===undefined?!![]:![]:!![],'where':_0x2def83[_0x21a2('0x18')]?_0x2def83[_0x21a2('0x18')]['where']||null:null,'attributes':_0x2def83[_0x21a2('0x18')]?_0x2def83[_0x21a2('0x18')]['attributes']||null:null,'include':_0x2def83[_0x21a2('0x18')]?_0x2def83['options']['include']?_['map'](_0x2def83[_0x21a2('0x18')][_0x21a2('0x1c')],function(_0x2757a7){return{'model':db[_0x2757a7[_0x21a2('0x1e')]],'as':_0x2757a7['as'],'attributes':_0x2757a7[_0x21a2('0x1a')],'include':_0x2757a7[_0x21a2('0x1c')]?_[_0x21a2('0x1d')](_0x2757a7[_0x21a2('0x1c')],function(_0xd5f7e6){return{'model':db[_0xd5f7e6[_0x21a2('0x1e')]],'as':_0xd5f7e6['as'],'attributes':_0xd5f7e6[_0x21a2('0x1a')],'include':_0xd5f7e6[_0x21a2('0x1c')]?_[_0x21a2('0x1d')](_0xd5f7e6[_0x21a2('0x1c')],function(_0x548d3e){return{'model':db[_0x548d3e[_0x21a2('0x1e')]],'as':_0x548d3e['as'],'attributes':_0x548d3e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d75bc){logger[_0x21a2('0x13')](_0x21a2('0x22'),_0x2def83);logger[_0x21a2('0x1f')](_0x21a2('0x22'),_0x2def83,JSON[_0x21a2('0xf')](_0x2d75bc));_0x314b5b(_0x2d75bc);})[_0x21a2('0x15')](function(_0x327607){logger[_0x21a2('0x10')](_0x21a2('0x22'),_0x327607[_0x21a2('0x12')],_0x2def83);_0x38fb9d(_0x1e55a4[_0x21a2('0x10')](0x1f4,_0x327607[_0x21a2('0x12')]));});});};exports['CreateCmHopper']=function(_0x5633f1){var _0x505367=this;return new Promise(function(_0xd1b320,_0x274d0c){return db[_0x21a2('0x20')][_0x21a2('0x23')](_0x5633f1[_0x21a2('0x24')],{'raw':_0x5633f1[_0x21a2('0x18')]?_0x5633f1[_0x21a2('0x18')][_0x21a2('0x19')]===undefined?!![]:![]:!![]})[_0x21a2('0xc')](function(_0x3fb1b0){logger['info'](_0x21a2('0x25'),_0x5633f1);logger[_0x21a2('0x1f')]('CreateCmHopper',_0x5633f1,JSON[_0x21a2('0xf')](_0x3fb1b0));_0xd1b320(_0x3fb1b0);})[_0x21a2('0x15')](function(_0x5222f8){logger[_0x21a2('0x10')]('CreateCmHopper',_0x5222f8[_0x21a2('0x12')],_0x5633f1);_0x274d0c(_0x505367['error'](0x1f4,_0x5222f8[_0x21a2('0x12')]));});});};exports['UpdateCmHopper']=function(_0x40f6ea){var _0x1153bd=this;return new Promise(function(_0x3299d9,_0x329835){return db[_0x21a2('0x20')][_0x21a2('0x26')](_0x40f6ea[_0x21a2('0x24')],{'raw':_0x40f6ea[_0x21a2('0x18')]?_0x40f6ea['options'][_0x21a2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40f6ea[_0x21a2('0x18')]?_0x40f6ea[_0x21a2('0x18')][_0x21a2('0x27')]||null:null,'attributes':_0x40f6ea[_0x21a2('0x18')]?_0x40f6ea[_0x21a2('0x18')]['attributes']||null:null,'limit':_0x40f6ea[_0x21a2('0x18')]?_0x40f6ea['options'][_0x21a2('0x1b')]||null:null})['then'](function(_0x558363){logger[_0x21a2('0x13')]('UpdateCmHopper',_0x40f6ea);logger[_0x21a2('0x1f')]('UpdateCmHopper',_0x40f6ea,JSON[_0x21a2('0xf')](_0x558363));_0x3299d9(_0x558363);})[_0x21a2('0x15')](function(_0x1381dc){logger[_0x21a2('0x10')](_0x21a2('0x28'),_0x1381dc[_0x21a2('0x12')],_0x40f6ea);_0x329835(_0x1153bd[_0x21a2('0x10')](0x1f4,_0x1381dc[_0x21a2('0x12')]));});});};exports['DestroyCmHopper']=function(_0xd30937){var _0x32f616=this;return new Promise(function(_0x288bef,_0x22cf41){return db[_0x21a2('0x20')]['destroy']({'where':_0xd30937['options']?_0xd30937['options']['where']||null:null})['then'](function(_0x5be48e){logger[_0x21a2('0x13')]('DestroyCmHopper',_0xd30937);logger['debug']('DestroyCmHopper',_0xd30937,JSON['stringify'](_0x5be48e));_0x288bef(_0x5be48e);})['catch'](function(_0x5e6ac6){logger[_0x21a2('0x10')](_0x21a2('0x29'),_0x5e6ac6[_0x21a2('0x12')],_0xd30937);_0x22cf41(_0x32f616[_0x21a2('0x10')](0x1f4,_0x5e6ac6[_0x21a2('0x12')]));});});};exports['GetContactDialer']=function(_0x520928){var _0x284f62=this;return new Promise(function(_0x534ff5,_0x223571){return db['CmContact'][_0x21a2('0x2a')]()['then'](function(_0x3cf734){return db[_0x21a2('0x2b')][_0x21a2('0x2c')](function(_0x12a1cd){return db['CmHopper']['findAll']({'where':_0x520928[_0x21a2('0x18')]?_0x520928[_0x21a2('0x18')][_0x21a2('0x27')]||null:null,'attributes':_0x520928['options']?_0x520928[_0x21a2('0x18')][_0x21a2('0x1a')]||null:null,'limit':_0x520928['options']?_0x520928['options'][_0x21a2('0x1b')]||null:null,'order':_0x520928[_0x21a2('0x18')]?_0x520928[_0x21a2('0x18')][_0x21a2('0x2d')]||null:null,'transaction':_0x12a1cd,'lock':_0x12a1cd[_0x21a2('0x2e')][_0x21a2('0x2f')],'include':[{'model':db[_0x21a2('0x30')],'as':'Contact','attributes':_[_0x21a2('0x31')](_0x3cf734)},{'model':db[_0x21a2('0x32')],'as':'Agent','attributes':['id',_0x21a2('0x33'),_0x21a2('0x34')]}]})[_0x21a2('0xc')](function(_0xcee4c6){var _0x22c5f8=[];var _0x325f1f=[];for(var _0xf52735=0x0;_0xf52735<_0xcee4c6[_0x21a2('0x35')];_0xf52735+=0x1){if(!_0x325f1f['includes'](_0xcee4c6[_0xf52735]['UserId'])){_0x325f1f['push'](_0xcee4c6[_0xf52735][_0x21a2('0x36')]);_0x22c5f8['push'](_0xcee4c6[_0xf52735]['update'](_0x520928[_0x21a2('0x24')],{'transaction':_0x12a1cd}));}}return BPromise[_0x21a2('0x37')](_0x22c5f8);});})[_0x21a2('0xc')](function(_0x16f137){logger[_0x21a2('0x13')](_0x21a2('0x38'),_0x520928);logger[_0x21a2('0x1f')](_0x21a2('0x38'),_0x520928,JSON['stringify'](_0x16f137));_0x534ff5(_0x16f137);})['catch'](function(_0x18aaef){logger['error'](_0x21a2('0x38'),_0x18aaef[_0x21a2('0x12')],_0x520928);_0x223571(_0x284f62['error'](0x1f4,_0x18aaef['message']));});});});};exports['MoveContactManagedDialer']=function(_0x5c592b){var _0x2ad8a9=this;return new Promise(function(_0x593800,_0x498194){return db[_0x21a2('0x2b')][_0x21a2('0x2c')](function(_0x1ecb66){return db[_0x21a2('0x39')][_0x21a2('0x23')](_0x5c592b['body'],{'raw':_0x5c592b[_0x21a2('0x18')]?_0x5c592b[_0x21a2('0x18')][_0x21a2('0x19')]===undefined?!![]:![]:!![],'transaction':_0x1ecb66})[_0x21a2('0xc')](function(){return db[_0x21a2('0x20')]['destroy']({'where':_0x5c592b['options']?_0x5c592b[_0x21a2('0x18')][_0x21a2('0x27')]||null:null,'transaction':_0x1ecb66});});})['then'](function(_0x1c2dae){logger[_0x21a2('0x13')]('MoveContactManagedDialer',_0x5c592b);logger[_0x21a2('0x1f')](_0x21a2('0x3a'),_0x5c592b,JSON[_0x21a2('0xf')](_0x1c2dae));_0x593800(_0x1c2dae);})['catch'](function(_0x4af987){logger[_0x21a2('0x10')]('MoveContactManagedDialer',_0x4af987[_0x21a2('0x12')],_0x5c592b);_0x498194(_0x2ad8a9[_0x21a2('0x10')](0x1f4,_0x4af987['message']));});});};exports[_0x21a2('0x3b')]=function(_0x32ce82){var _0x143f68=this;return new Promise(function(_0x516163,_0x230937){return db[_0x21a2('0x20')]['findAll']({'raw':_0x32ce82[_0x21a2('0x18')]?_0x32ce82['options'][_0x21a2('0x19')]===undefined?!![]:![]:!![],'where':_0x32ce82[_0x21a2('0x18')]?_0x32ce82['options']['where']||null:null,'attributes':[[db[_0x21a2('0x2b')]['fn'](_0x21a2('0x3c'),db[_0x21a2('0x2b')]['fn']('IF',db[_0x21a2('0x2b')][_0x21a2('0x3d')](_0x21a2('0x3e')+util[_0x21a2('0x3f')]('\x22%s\x22',moment()[_0x21a2('0x3f')](_0x21a2('0x40')))+_0x21a2('0x41')))),_0x21a2('0x42')]]})[_0x21a2('0xc')](function(_0x5848c0){logger[_0x21a2('0x13')](_0x21a2('0x3b'),_0x32ce82);logger[_0x21a2('0x1f')](_0x21a2('0x3b'),_0x32ce82,JSON[_0x21a2('0xf')](_0x5848c0));_0x516163(_0x5848c0);})[_0x21a2('0x15')](function(_0x529be8){logger[_0x21a2('0x10')]('CountReScheduled',_0x529be8['message'],_0x32ce82);_0x230937(_0x143f68[_0x21a2('0x10')](0x1f4,_0x529be8[_0x21a2('0x12')]));});});};exports[_0x21a2('0x43')]=function(_0x2cf404){var _0x3de957=this;return new Promise(function(_0x131a43,_0x944e05){return db['CmContact'][_0x21a2('0x2a')]()[_0x21a2('0xc')](function(_0x4be77f){return db[_0x21a2('0x2b')]['transaction'](function(_0xd90cca){return db[_0x21a2('0x20')]['findAll']({'where':_0x2cf404[_0x21a2('0x18')]?_0x2cf404[_0x21a2('0x18')][_0x21a2('0x27')]||null:null,'attributes':_0x2cf404[_0x21a2('0x18')]?_0x2cf404[_0x21a2('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x2cf404[_0x21a2('0x18')]?_0x2cf404[_0x21a2('0x18')][_0x21a2('0x2d')]||null:null,'group':db['CmHopper'][_0x21a2('0x36')],'transaction':_0xd90cca,'lock':_0xd90cca[_0x21a2('0x2e')]['UPDATE'],'include':_0x2cf404[_0x21a2('0x18')]?_0x2cf404[_0x21a2('0x18')][_0x21a2('0x1c')]?_[_0x21a2('0x1d')](_0x2cf404[_0x21a2('0x18')][_0x21a2('0x1c')],function(_0x25603b){return{'model':db[_0x25603b[_0x21a2('0x1e')]],'as':_0x25603b['as'],'attributes':_0x25603b[_0x21a2('0x1a')],'include':_0x25603b[_0x21a2('0x1c')]?_[_0x21a2('0x1d')](_0x25603b[_0x21a2('0x1c')],function(_0x139d25){return{'model':db[_0x139d25[_0x21a2('0x1e')]],'as':_0x139d25['as'],'attributes':_0x139d25[_0x21a2('0x1a')],'include':_0x139d25[_0x21a2('0x1c')]?_[_0x21a2('0x1d')](_0x139d25[_0x21a2('0x1c')],function(_0x191ef3){return{'model':db[_0x191ef3[_0x21a2('0x1e')]],'as':_0x191ef3['as'],'attributes':_0x191ef3[_0x21a2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x21a2('0xc')](function(_0x17e81a){var _0x1f3bef=[];for(var _0x33bec7=0x0;_0x33bec7<_0x17e81a[_0x21a2('0x35')];_0x33bec7+=0x1){_0x1f3bef[_0x21a2('0x44')](_0x17e81a[_0x33bec7][_0x21a2('0x26')](_0x2cf404[_0x21a2('0x24')],{'transaction':_0xd90cca}));}return BPromise[_0x21a2('0x37')](_0x1f3bef);});})['then'](function(_0x23332b){logger[_0x21a2('0x13')](_0x21a2('0x43'),_0x2cf404);logger[_0x21a2('0x1f')](_0x21a2('0x43'),_0x2cf404,JSON[_0x21a2('0xf')](_0x23332b));_0x131a43(_0x23332b);})[_0x21a2('0x15')](function(_0x124ad2){logger[_0x21a2('0x10')]('GetContactRecallMe',_0x124ad2[_0x21a2('0x12')],_0x2cf404);_0x944e05(_0x3de957[_0x21a2('0x10')](0x1f4,_0x124ad2[_0x21a2('0x12')]));});});});};exports[_0x21a2('0x45')]=function(_0x444bc6){var _0x156bd9=this;return new Promise(function(_0x45089c,_0x1fd3a2){db['CmContact'][_0x21a2('0x2a')]()[_0x21a2('0xc')](function(_0x11d150){return db[_0x21a2('0x20')][_0x21a2('0x17')]({'raw':_0x444bc6[_0x21a2('0x18')]?_0x444bc6['options']['raw']===undefined?!![]:![]:!![],'where':_0x444bc6[_0x21a2('0x18')]?_0x444bc6[_0x21a2('0x18')]['where']||null:null,'attributes':_0x444bc6[_0x21a2('0x18')]?_0x444bc6[_0x21a2('0x18')]['attributes']||null:null,'limit':_0x444bc6[_0x21a2('0x18')]?_0x444bc6[_0x21a2('0x18')][_0x21a2('0x1b')]||null:null,'include':_0x444bc6[_0x21a2('0x18')]?_0x444bc6[_0x21a2('0x18')][_0x21a2('0x1c')]?_[_0x21a2('0x1d')](_0x444bc6['options'][_0x21a2('0x1c')],function(_0x5cd99a){return{'model':db[_0x5cd99a[_0x21a2('0x1e')]],'as':_0x5cd99a['as'],'attributes':_0x5cd99a['as']===_0x21a2('0x46')?_['keys'](_0x11d150):_0x5cd99a[_0x21a2('0x1a')],'include':_0x5cd99a[_0x21a2('0x1c')]?_[_0x21a2('0x1d')](_0x5cd99a[_0x21a2('0x1c')],function(_0x5297df){return{'model':db[_0x5297df[_0x21a2('0x1e')]],'as':_0x5297df['as'],'attributes':_0x5297df[_0x21a2('0x1a')],'include':_0x5297df['include']?_[_0x21a2('0x1d')](_0x5297df[_0x21a2('0x1c')],function(_0x3af631){return{'model':db[_0x3af631[_0x21a2('0x1e')]],'as':_0x3af631['as'],'attributes':_0x3af631[_0x21a2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x21a2('0xc')](function(_0x49f975){logger[_0x21a2('0x13')](_0x21a2('0x16'),_0x444bc6);logger[_0x21a2('0x1f')](_0x21a2('0x16'),_0x444bc6,JSON['stringify'](_0x49f975));_0x45089c(_0x49f975);})[_0x21a2('0x15')](function(_0x3a6116){logger['error'](_0x21a2('0x16'),_0x3a6116[_0x21a2('0x12')],_0x444bc6);_0x1fd3a2(_0x156bd9[_0x21a2('0x10')](0x1f4,_0x3a6116[_0x21a2('0x12')]));});});});};exports[_0x21a2('0x47')]=function(_0x176903){console[_0x21a2('0x48')](_0x21a2('0x49'),_0x176903);console[_0x21a2('0x48')]('phone\x20value',_0x176903['options'][_0x21a2('0x27')]['phone']);_this=this;return new Promise(function(_0x145219,_0x47bd4d){return db[_0x21a2('0x30')][_0x21a2('0x4a')]({'raw':!![],'where':{'phone':_0x176903['options'][_0x21a2('0x27')]['phone']},'attributes':['id',_0x21a2('0x4b')],'order':[['id',_0x21a2('0x4c')]]})['then'](function(_0x89a828){console[_0x21a2('0x48')]('getcontactbyohone',_0x89a828);logger['info'](_0x21a2('0x4d'),_0x176903);logger[_0x21a2('0x1f')]('getContactByPhone',_0x176903,JSON[_0x21a2('0xf')](_0x89a828));_0x145219(_0x89a828);})['catch'](function(_0x26f348){logger[_0x21a2('0x10')](_0x21a2('0x4d'),_0x26f348['message'],_0x176903);_0x47bd4d(_this['error'](0x1f4,_0x26f348[_0x21a2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 64edc57..455d9aa 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 _0xac31=['/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','post','create','/preview','/timezone','getTimezone','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopper.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x5a57fc,_0x532520){var _0x36eb8a=function(_0x5837f3){while(--_0x5837f3){_0x5a57fc['push'](_0x5a57fc['shift']());}};_0x36eb8a(++_0x532520);}(_0xac31,0xca));var _0x1ac3=function(_0x529ace,_0x2c4ab8){_0x529ace=_0x529ace-0x0;var _0x511430=_0xac31[_0x529ace];return _0x511430;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var auth=require(_0x1ac3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1ac3('0x7'));var controller=require(_0x1ac3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ac3('0x9')]);router[_0x1ac3('0xa')](_0x1ac3('0xb'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0xd')]);router['get'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0xa')](_0x1ac3('0x10'),auth['isAuthenticated'](),controller[_0x1ac3('0x11')]);router[_0x1ac3('0xa')](_0x1ac3('0x12'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x13')]);router[_0x1ac3('0x14')]('/',auth['isAuthenticated'](),controller[_0x1ac3('0x15')]);router[_0x1ac3('0x14')](_0x1ac3('0x16'),auth[_0x1ac3('0xc')](),controller['getPreview']);router[_0x1ac3('0x14')](_0x1ac3('0x17'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x18')]);router['put'](_0x1ac3('0x12'),auth[_0x1ac3('0xc')](),controller['update']);router[_0x1ac3('0x19')](_0x1ac3('0x12'),auth[_0x1ac3('0xc')](),controller['destroy']);module[_0x1ac3('0x1a')]=router; \ No newline at end of file +var _0x032e=['../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','/:id','show','post','create','/preview','getPreview','getTimezone','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x032e,0x124));var _0xe032=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x032e[_0x5ddb1c];return _0x354adc;};'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('0x7')](_0xe032('0xc'),auth[_0xe032('0x8')](),controller[_0xe032('0xd')]);router[_0xe032('0x7')](_0xe032('0xe'),auth[_0xe032('0x8')](),controller['getTimezones']);router[_0xe032('0x7')](_0xe032('0xf'),auth[_0xe032('0x8')](),controller[_0xe032('0x10')]);router[_0xe032('0x11')]('/',auth[_0xe032('0x8')](),controller[_0xe032('0x12')]);router['post'](_0xe032('0x13'),auth[_0xe032('0x8')](),controller[_0xe032('0x14')]);router[_0xe032('0x11')]('/timezone',auth[_0xe032('0x8')](),controller[_0xe032('0x15')]);router[_0xe032('0x16')](_0xe032('0xf'),auth[_0xe032('0x8')](),controller[_0xe032('0x17')]);router[_0xe032('0x18')]('/:id',auth[_0xe032('0x8')](),controller[_0xe032('0x19')]);module[_0xe032('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 06039bf..0dab496 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 _0x990a=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','STRING','INTEGER'];(function(_0xa4d02a,_0x2111b1){var _0x4cb1fd=function(_0x28b6e3){while(--_0x28b6e3){_0xa4d02a['push'](_0xa4d02a['shift']());}};_0x4cb1fd(++_0x2111b1);}(_0x990a,0x113));var _0xa990=function(_0x2a7e37,_0x327aca){_0x2a7e37=_0x2a7e37-0x0;var _0x18f97a=_0x990a[_0x2a7e37];return _0x18f97a;};'use strict';var moment=require(_0xa990('0x0'));var Sequelize=require(_0xa990('0x1'));module[_0xa990('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xa990('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa990('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa990('0x5')],'defaultValue':moment()[_0xa990('0x6')](_0xa990('0x7'))},'countbusyretry':{'type':Sequelize[_0xa990('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa990('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa990('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa990('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa990('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa990('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8f02=['DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING'];(function(_0x11c6b8,_0x5b2d7b){var _0x38b38f=function(_0x641ad0){while(--_0x641ad0){_0x11c6b8['push'](_0x11c6b8['shift']());}};_0x38b38f(++_0x5b2d7b);}(_0x8f02,0x13d));var _0x28f0=function(_0x4e721b,_0xc21d93){_0x4e721b=_0x4e721b-0x0;var _0x75927f=_0x8f02[_0x4e721b];return _0x75927f;};'use strict';var moment=require(_0x28f0('0x0'));var Sequelize=require(_0x28f0('0x1'));module[_0x28f0('0x2')]={'CmHopperId':{'type':Sequelize[_0x28f0('0x3')]},'phone':{'type':Sequelize[_0x28f0('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x28f0('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x28f0('0x5')],'defaultValue':moment()['format'](_0x28f0('0x6'))},'countbusyretry':{'type':Sequelize[_0x28f0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x28f0('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x28f0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x28f0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x28f0('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 9e58594..bc0b804 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 _0x8ab4=['error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','VIRTUAL','merge','CmHopperAdditionalPhone','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource'];(function(_0x541f4f,_0xe378b3){var _0x24f033=function(_0x381c16){while(--_0x381c16){_0x541f4f['push'](_0x541f4f['shift']());}};_0x24f033(++_0xe378b3);}(_0x8ab4,0xc6));var _0x48ab=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8ab4[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require(_0x48ab('0x0'));var emlformat=require(_0x48ab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x48ab('0x2'));var jsonpatch=require(_0x48ab('0x3'));var rp=require(_0x48ab('0x4'));var moment=require(_0x48ab('0x5'));var BPromise=require(_0x48ab('0x6'));var Mustache=require(_0x48ab('0x7'));var util=require(_0x48ab('0x8'));var path=require(_0x48ab('0x9'));var sox=require('sox');var csv=require(_0x48ab('0xa'));var ejs=require(_0x48ab('0xb'));var fs=require('fs');var _=require(_0x48ab('0xc'));var squel=require(_0x48ab('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x48ab('0xe'));var toCsv=require(_0x48ab('0xa'));var querystring=require('querystring');var Papa=require(_0x48ab('0xf'));var Redis=require(_0x48ab('0x10'));var authService=require(_0x48ab('0x11'));var qs=require(_0x48ab('0x12'));var as=require(_0x48ab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48ab('0x14'))(_0x48ab('0x15'));var utils=require(_0x48ab('0x16'));var config=require(_0x48ab('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251651,_0x6a7e9f){_0x6a7e9f=_0x6a7e9f||0xcc;return function(_0x569296){if(_0x569296){return _0x251651[_0x48ab('0x18')](_0x6a7e9f);}return _0x251651['status'](_0x6a7e9f)[_0x48ab('0x19')]();};}function respondWithResult(_0x17cfbd,_0x289732){_0x289732=_0x289732||0xc8;return function(_0x3e2744){if(_0x3e2744){return _0x17cfbd[_0x48ab('0x1a')](_0x289732)[_0x48ab('0x1b')](_0x3e2744);}};}function respondWithFilteredResult(_0x3cf859,_0x37eccb){return function(_0x12bae7){if(_0x12bae7){var _0x258881=_0x12bae7[_0x48ab('0x1c')],_0x120343=_0x37eccb[_0x48ab('0x1d')],_0x30ac7b=_0x37eccb[_0x48ab('0x1d')]+_0x37eccb[_0x48ab('0x1e')],_0x3b1a14;if(_0x30ac7b>=_0x258881){_0x30ac7b=_0x258881;_0x3b1a14=0xc8;}else{_0x3b1a14=0xce;}_0x3cf859['status'](_0x3b1a14);return _0x3cf859[_0x48ab('0x1f')]('Content-Range',_0x120343+'-'+_0x30ac7b+'/'+_0x258881)[_0x48ab('0x1b')](_0x12bae7);}return null;};}function patchUpdates(_0x2d0523){return function(_0x282d89){try{jsonpatch[_0x48ab('0x20')](_0x282d89,_0x2d0523,!![]);}catch(_0x59ac2a){return BPromise['reject'](_0x59ac2a);}return _0x282d89[_0x48ab('0x21')]();};}function saveUpdates(_0x2fa4f6,_0xbd5a76){return function(_0x189e0a){if(_0x189e0a){return _0x189e0a[_0x48ab('0x22')](_0x2fa4f6)[_0x48ab('0x23')](function(_0x32fbf3){return _0x32fbf3;});}return null;};}function removeEntity(_0x11ba6e,_0x9109ec){return function(_0x5157b0){if(_0x5157b0){return _0x5157b0[_0x48ab('0x24')]()['then'](function(){var _0xa47508=_0x5157b0['get']({'plain':!![]});var _0x3cbc95=_0x48ab('0x25');return db[_0x48ab('0x26')][_0x48ab('0x24')]({'where':{'type':_0x3cbc95,'resourceId':_0xa47508['id']}})['then'](function(){return _0x5157b0;});})[_0x48ab('0x23')](function(){_0x11ba6e[_0x48ab('0x1a')](0xcc)[_0x48ab('0x19')]();});}};}function handleEntityNotFound(_0x1c8015,_0x2119ce){return function(_0x54ff05){if(!_0x54ff05){_0x1c8015[_0x48ab('0x18')](0x194);}return _0x54ff05;};}function handleError(_0x5085cd,_0x4e3181){_0x4e3181=_0x4e3181||0x1f4;return function(_0xe1c68d){logger[_0x48ab('0x27')](_0xe1c68d[_0x48ab('0x28')]);if(_0xe1c68d[_0x48ab('0x29')]){delete _0xe1c68d['name'];}_0x5085cd[_0x48ab('0x1a')](_0x4e3181)[_0x48ab('0x2a')](_0xe1c68d);};}exports[_0x48ab('0x2b')]=function(_0x1b03fe,_0x26f41b){var _0x5df41d={},_0x4af7db={},_0x371cb7={'count':0x0,'rows':[]};var _0x468419=_[_0x48ab('0x2c')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x4f88b2){return{'name':_0x4f88b2[_0x48ab('0x2d')],'type':_0x4f88b2[_0x48ab('0x2e')]['key']};});_0x4af7db['model']=_[_0x48ab('0x2c')](_0x468419,_0x48ab('0x29'));_0x4af7db[_0x48ab('0x2f')]=_[_0x48ab('0x30')](_0x1b03fe[_0x48ab('0x2f')]);_0x4af7db[_0x48ab('0x31')]=_[_0x48ab('0x32')](_0x4af7db[_0x48ab('0x33')],_0x4af7db['query']);_0x5df41d['attributes']=_['intersection'](_0x4af7db[_0x48ab('0x33')],qs[_0x48ab('0x34')](_0x1b03fe[_0x48ab('0x2f')][_0x48ab('0x34')]));_0x5df41d[_0x48ab('0x35')]=_0x5df41d[_0x48ab('0x35')]['length']?_0x5df41d[_0x48ab('0x35')]:_0x4af7db['model'];if(!_0x1b03fe['query']['hasOwnProperty'](_0x48ab('0x36'))){_0x5df41d['limit']=qs['limit'](_0x1b03fe[_0x48ab('0x2f')][_0x48ab('0x1e')]);_0x5df41d[_0x48ab('0x1d')]=qs[_0x48ab('0x1d')](_0x1b03fe['query'][_0x48ab('0x1d')]);}_0x5df41d[_0x48ab('0x37')]=qs[_0x48ab('0x38')](_0x1b03fe[_0x48ab('0x2f')][_0x48ab('0x38')]);_0x5df41d[_0x48ab('0x39')]=qs[_0x48ab('0x31')](_[_0x48ab('0x3a')](_0x1b03fe[_0x48ab('0x2f')],_0x4af7db['filters']),_0x468419);if(_0x1b03fe[_0x48ab('0x2f')]['filter']){_0x5df41d[_0x48ab('0x39')]=_['merge'](_0x5df41d[_0x48ab('0x39')],{'$or':_[_0x48ab('0x2c')](_0x468419,function(_0x22c0c1){if(_0x22c0c1[_0x48ab('0x2e')]!==_0x48ab('0x3b')){var _0x93f623={};_0x93f623[_0x22c0c1['name']]={'$like':'%'+_0x1b03fe['query']['filter']+'%'};return _0x93f623;}})});}_0x5df41d=_[_0x48ab('0x3c')]({},_0x5df41d,_0x1b03fe['options']);var _0x301e60={'where':_0x5df41d[_0x48ab('0x39')]};return db[_0x48ab('0x3d')][_0x48ab('0x1c')](_0x301e60)[_0x48ab('0x23')](function(_0x2fedaf){_0x371cb7[_0x48ab('0x1c')]=_0x2fedaf;if(_0x1b03fe[_0x48ab('0x2f')][_0x48ab('0x3e')]){_0x5df41d[_0x48ab('0x3f')]=[{'all':!![]}];}return db[_0x48ab('0x3d')]['findAll'](_0x5df41d);})[_0x48ab('0x23')](function(_0x5c02fd){_0x371cb7['rows']=_0x5c02fd;return _0x371cb7;})[_0x48ab('0x23')](respondWithFilteredResult(_0x26f41b,_0x5df41d))[_0x48ab('0x40')](handleError(_0x26f41b,null));};exports[_0x48ab('0x41')]=function(_0x24b8a8,_0x3055d8){var _0x15a51c={'raw':!![],'where':{'id':_0x24b8a8[_0x48ab('0x42')]['id']}},_0x400d5a={};_0x400d5a[_0x48ab('0x33')]=_[_0x48ab('0x30')](db[_0x48ab('0x3d')][_0x48ab('0x43')]);_0x400d5a[_0x48ab('0x2f')]=_[_0x48ab('0x30')](_0x24b8a8[_0x48ab('0x2f')]);_0x400d5a['filters']=_[_0x48ab('0x32')](_0x400d5a[_0x48ab('0x33')],_0x400d5a[_0x48ab('0x2f')]);_0x15a51c[_0x48ab('0x35')]=_[_0x48ab('0x32')](_0x400d5a[_0x48ab('0x33')],qs['fields'](_0x24b8a8[_0x48ab('0x2f')][_0x48ab('0x34')]));_0x15a51c[_0x48ab('0x35')]=_0x15a51c[_0x48ab('0x35')]['length']?_0x15a51c['attributes']:_0x400d5a[_0x48ab('0x33')];if(_0x24b8a8[_0x48ab('0x2f')][_0x48ab('0x3e')]){_0x15a51c['include']=[{'all':!![]}];}_0x15a51c=_[_0x48ab('0x3c')]({},_0x15a51c,_0x24b8a8[_0x48ab('0x44')]);return db[_0x48ab('0x3d')][_0x48ab('0x45')](_0x15a51c)['then'](handleEntityNotFound(_0x3055d8,null))[_0x48ab('0x23')](respondWithResult(_0x3055d8,null))[_0x48ab('0x40')](handleError(_0x3055d8,null));};exports[_0x48ab('0x46')]=function(_0x254bfc,_0x519492){return db['CmHopperAdditionalPhone'][_0x48ab('0x46')](_0x254bfc[_0x48ab('0x47')],{})[_0x48ab('0x23')](function(_0x365398){var _0x295efc=_0x254bfc[_0x48ab('0x48')][_0x48ab('0x49')]({'plain':!![]});if(!_0x295efc)throw new Error(_0x48ab('0x4a'));if(_0x295efc[_0x48ab('0x4b')]===_0x48ab('0x48')){var _0x4ec265=_0x365398[_0x48ab('0x49')]({'plain':!![]});var _0x4805cd=_0x48ab('0x25');return db[_0x48ab('0x4c')]['find']({'where':{'name':_0x4805cd,'userProfileId':_0x295efc[_0x48ab('0x4d')]},'raw':!![]})[_0x48ab('0x23')](function(_0x1558aa){if(_0x1558aa&&_0x1558aa[_0x48ab('0x4e')]===0x0){return db[_0x48ab('0x26')][_0x48ab('0x46')]({'name':_0x4ec265[_0x48ab('0x29')],'resourceId':_0x4ec265['id'],'type':_0x1558aa['name'],'sectionId':_0x1558aa['id']},{})[_0x48ab('0x23')](function(){return _0x365398;});}else{return _0x365398;}})['catch'](function(_0x994212){logger[_0x48ab('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x994212);throw _0x994212;});}return _0x365398;})[_0x48ab('0x23')](respondWithResult(_0x519492,0xc9))['catch'](handleError(_0x519492,null));};exports[_0x48ab('0x22')]=function(_0x4cc29b,_0x108ef4){if(_0x4cc29b[_0x48ab('0x47')]['id']){delete _0x4cc29b[_0x48ab('0x47')]['id'];}return db[_0x48ab('0x3d')]['find']({'where':{'id':_0x4cc29b[_0x48ab('0x42')]['id']}})[_0x48ab('0x23')](handleEntityNotFound(_0x108ef4,null))[_0x48ab('0x23')](saveUpdates(_0x4cc29b['body'],null))['then'](respondWithResult(_0x108ef4,null))[_0x48ab('0x40')](handleError(_0x108ef4,null));};exports[_0x48ab('0x24')]=function(_0x17ccbb,_0x4c40a6){return db[_0x48ab('0x3d')]['find']({'where':{'id':_0x17ccbb['params']['id']}})[_0x48ab('0x23')](handleEntityNotFound(_0x4c40a6,null))[_0x48ab('0x23')](removeEntity(_0x4c40a6,null))[_0x48ab('0x40')](handleError(_0x4c40a6,null));}; \ No newline at end of file +var _0x4ba6=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','map','CmHopperAdditionalPhone','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','show','params','rawAttributes','length','include','find','create','body','user'];(function(_0x4f52a0,_0x4fbe9f){var _0x1009f4=function(_0x1a194f){while(--_0x1a194f){_0x4f52a0['push'](_0x4f52a0['shift']());}};_0x1009f4(++_0x4fbe9f);}(_0x4ba6,0x100));var _0x64ba=function(_0x1d5cfa,_0x57efb0){_0x1d5cfa=_0x1d5cfa-0x0;var _0x19a273=_0x4ba6[_0x1d5cfa];return _0x19a273;};'use strict';var pdf=require(_0x64ba('0x0'));var emlformat=require(_0x64ba('0x1'));var rimraf=require(_0x64ba('0x2'));var zipdir=require(_0x64ba('0x3'));var jsonpatch=require(_0x64ba('0x4'));var rp=require(_0x64ba('0x5'));var moment=require(_0x64ba('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x64ba('0x7'));var util=require(_0x64ba('0x8'));var path=require(_0x64ba('0x9'));var sox=require(_0x64ba('0xa'));var csv=require(_0x64ba('0xb'));var ejs=require(_0x64ba('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x64ba('0xd'));var crypto=require(_0x64ba('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x64ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0x64ba('0x10'));var Papa=require('papaparse');var Redis=require(_0x64ba('0x11'));var authService=require(_0x64ba('0x12'));var qs=require(_0x64ba('0x13'));var as=require(_0x64ba('0x14'));var hardwareService=require(_0x64ba('0x15'));var logger=require('../../config/logger')(_0x64ba('0x16'));var utils=require(_0x64ba('0x17'));var config=require(_0x64ba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18dd3d,_0x4cfab8){_0x4cfab8=_0x4cfab8||0xcc;return function(_0x3bbdb8){if(_0x3bbdb8){return _0x18dd3d[_0x64ba('0x19')](_0x4cfab8);}return _0x18dd3d['status'](_0x4cfab8)[_0x64ba('0x1a')]();};}function respondWithResult(_0x20fda4,_0x1a0537){_0x1a0537=_0x1a0537||0xc8;return function(_0x2a2bc5){if(_0x2a2bc5){return _0x20fda4[_0x64ba('0x1b')](_0x1a0537)[_0x64ba('0x1c')](_0x2a2bc5);}};}function respondWithFilteredResult(_0x4605b1,_0x48fb83){return function(_0x4a432b){if(_0x4a432b){var _0x46e0ae=_0x4a432b[_0x64ba('0x1d')],_0x357354=_0x48fb83[_0x64ba('0x1e')],_0x223fc9=_0x48fb83[_0x64ba('0x1e')]+_0x48fb83[_0x64ba('0x1f')],_0x4d3b65;if(_0x223fc9>=_0x46e0ae){_0x223fc9=_0x46e0ae;_0x4d3b65=0xc8;}else{_0x4d3b65=0xce;}_0x4605b1[_0x64ba('0x1b')](_0x4d3b65);return _0x4605b1[_0x64ba('0x20')]('Content-Range',_0x357354+'-'+_0x223fc9+'/'+_0x46e0ae)[_0x64ba('0x1c')](_0x4a432b);}return null;};}function patchUpdates(_0x3227fc){return function(_0x1b851e){try{jsonpatch[_0x64ba('0x21')](_0x1b851e,_0x3227fc,!![]);}catch(_0x3c5a09){return BPromise[_0x64ba('0x22')](_0x3c5a09);}return _0x1b851e[_0x64ba('0x23')]();};}function saveUpdates(_0xa87ba0,_0x82a103){return function(_0x3a9de0){if(_0x3a9de0){return _0x3a9de0[_0x64ba('0x24')](_0xa87ba0)[_0x64ba('0x25')](function(_0x48ab04){return _0x48ab04;});}return null;};}function removeEntity(_0x768605,_0xca3263){return function(_0x363d0c){if(_0x363d0c){return _0x363d0c[_0x64ba('0x26')]()[_0x64ba('0x25')](function(){var _0x681741=_0x363d0c['get']({'plain':!![]});var _0x503179=_0x64ba('0x27');return db[_0x64ba('0x28')][_0x64ba('0x26')]({'where':{'type':_0x503179,'resourceId':_0x681741['id']}})[_0x64ba('0x25')](function(){return _0x363d0c;});})[_0x64ba('0x25')](function(){_0x768605[_0x64ba('0x1b')](0xcc)[_0x64ba('0x1a')]();});}};}function handleEntityNotFound(_0xe56064,_0x32f079){return function(_0xd81373){if(!_0xd81373){_0xe56064['sendStatus'](0x194);}return _0xd81373;};}function handleError(_0x21e440,_0x592b69){_0x592b69=_0x592b69||0x1f4;return function(_0x1d807c){logger[_0x64ba('0x29')](_0x1d807c['stack']);if(_0x1d807c[_0x64ba('0x2a')]){delete _0x1d807c[_0x64ba('0x2a')];}_0x21e440[_0x64ba('0x1b')](_0x592b69)[_0x64ba('0x2b')](_0x1d807c);};}exports[_0x64ba('0x2c')]=function(_0x31de7b,_0x10aee0){var _0x3f3c8a={},_0xb4d644={},_0x3ed42f={'count':0x0,'rows':[]};var _0x20b62d=_[_0x64ba('0x2d')](db[_0x64ba('0x2e')]['rawAttributes'],function(_0x1bda8e){return{'name':_0x1bda8e['fieldName'],'type':_0x1bda8e[_0x64ba('0x2f')][_0x64ba('0x30')]};});_0xb4d644[_0x64ba('0x31')]=_[_0x64ba('0x2d')](_0x20b62d,_0x64ba('0x2a'));_0xb4d644[_0x64ba('0x32')]=_[_0x64ba('0x33')](_0x31de7b[_0x64ba('0x32')]);_0xb4d644[_0x64ba('0x34')]=_[_0x64ba('0x35')](_0xb4d644[_0x64ba('0x31')],_0xb4d644[_0x64ba('0x32')]);_0x3f3c8a[_0x64ba('0x36')]=_[_0x64ba('0x35')](_0xb4d644['model'],qs[_0x64ba('0x37')](_0x31de7b[_0x64ba('0x32')]['fields']));_0x3f3c8a[_0x64ba('0x36')]=_0x3f3c8a[_0x64ba('0x36')]['length']?_0x3f3c8a[_0x64ba('0x36')]:_0xb4d644[_0x64ba('0x31')];if(!_0x31de7b[_0x64ba('0x32')][_0x64ba('0x38')](_0x64ba('0x39'))){_0x3f3c8a[_0x64ba('0x1f')]=qs[_0x64ba('0x1f')](_0x31de7b[_0x64ba('0x32')][_0x64ba('0x1f')]);_0x3f3c8a[_0x64ba('0x1e')]=qs[_0x64ba('0x1e')](_0x31de7b[_0x64ba('0x32')]['offset']);}_0x3f3c8a[_0x64ba('0x3a')]=qs['sort'](_0x31de7b[_0x64ba('0x32')]['sort']);_0x3f3c8a[_0x64ba('0x3b')]=qs[_0x64ba('0x34')](_[_0x64ba('0x3c')](_0x31de7b['query'],_0xb4d644[_0x64ba('0x34')]),_0x20b62d);if(_0x31de7b[_0x64ba('0x32')][_0x64ba('0x3d')]){_0x3f3c8a[_0x64ba('0x3b')]=_['merge'](_0x3f3c8a[_0x64ba('0x3b')],{'$or':_['map'](_0x20b62d,function(_0x293a9a){if(_0x293a9a['type']!==_0x64ba('0x3e')){var _0x3da843={};_0x3da843[_0x293a9a[_0x64ba('0x2a')]]={'$like':'%'+_0x31de7b['query'][_0x64ba('0x3d')]+'%'};return _0x3da843;}})});}_0x3f3c8a=_[_0x64ba('0x3f')]({},_0x3f3c8a,_0x31de7b[_0x64ba('0x40')]);var _0x5bbb77={'where':_0x3f3c8a['where']};return db[_0x64ba('0x2e')][_0x64ba('0x1d')](_0x5bbb77)[_0x64ba('0x25')](function(_0x448fa7){_0x3ed42f[_0x64ba('0x1d')]=_0x448fa7;if(_0x31de7b[_0x64ba('0x32')][_0x64ba('0x41')]){_0x3f3c8a['include']=[{'all':!![]}];}return db[_0x64ba('0x2e')]['findAll'](_0x3f3c8a);})[_0x64ba('0x25')](function(_0xcd3420){_0x3ed42f['rows']=_0xcd3420;return _0x3ed42f;})[_0x64ba('0x25')](respondWithFilteredResult(_0x10aee0,_0x3f3c8a))[_0x64ba('0x42')](handleError(_0x10aee0,null));};exports[_0x64ba('0x43')]=function(_0x523705,_0x1fcffe){var _0x309922={'raw':!![],'where':{'id':_0x523705[_0x64ba('0x44')]['id']}},_0x374783={};_0x374783[_0x64ba('0x31')]=_[_0x64ba('0x33')](db['CmHopperAdditionalPhone'][_0x64ba('0x45')]);_0x374783[_0x64ba('0x32')]=_[_0x64ba('0x33')](_0x523705['query']);_0x374783[_0x64ba('0x34')]=_[_0x64ba('0x35')](_0x374783[_0x64ba('0x31')],_0x374783[_0x64ba('0x32')]);_0x309922[_0x64ba('0x36')]=_[_0x64ba('0x35')](_0x374783[_0x64ba('0x31')],qs[_0x64ba('0x37')](_0x523705[_0x64ba('0x32')]['fields']));_0x309922[_0x64ba('0x36')]=_0x309922['attributes'][_0x64ba('0x46')]?_0x309922[_0x64ba('0x36')]:_0x374783[_0x64ba('0x31')];if(_0x523705[_0x64ba('0x32')][_0x64ba('0x41')]){_0x309922[_0x64ba('0x47')]=[{'all':!![]}];}_0x309922=_[_0x64ba('0x3f')]({},_0x309922,_0x523705[_0x64ba('0x40')]);return db[_0x64ba('0x2e')][_0x64ba('0x48')](_0x309922)[_0x64ba('0x25')](handleEntityNotFound(_0x1fcffe,null))[_0x64ba('0x25')](respondWithResult(_0x1fcffe,null))[_0x64ba('0x42')](handleError(_0x1fcffe,null));};exports[_0x64ba('0x49')]=function(_0x28f39a,_0x5efcf0){return db[_0x64ba('0x2e')][_0x64ba('0x49')](_0x28f39a[_0x64ba('0x4a')],{})[_0x64ba('0x25')](function(_0x4f5a0c){var _0x48b5a7=_0x28f39a[_0x64ba('0x4b')][_0x64ba('0x4c')]({'plain':!![]});if(!_0x48b5a7)throw new Error(_0x64ba('0x4d'));if(_0x48b5a7[_0x64ba('0x4e')]===_0x64ba('0x4b')){var _0x55f69c=_0x4f5a0c[_0x64ba('0x4c')]({'plain':!![]});var _0x2d239c=_0x64ba('0x27');return db[_0x64ba('0x4f')][_0x64ba('0x48')]({'where':{'name':_0x2d239c,'userProfileId':_0x48b5a7[_0x64ba('0x50')]},'raw':!![]})[_0x64ba('0x25')](function(_0x144382){if(_0x144382&&_0x144382[_0x64ba('0x51')]===0x0){return db['UserProfileResource'][_0x64ba('0x49')]({'name':_0x55f69c[_0x64ba('0x2a')],'resourceId':_0x55f69c['id'],'type':_0x144382['name'],'sectionId':_0x144382['id']},{})[_0x64ba('0x25')](function(){return _0x4f5a0c;});}else{return _0x4f5a0c;}})[_0x64ba('0x42')](function(_0x3c62d2){logger['error'](_0x64ba('0x52'),_0x3c62d2);throw _0x3c62d2;});}return _0x4f5a0c;})[_0x64ba('0x25')](respondWithResult(_0x5efcf0,0xc9))['catch'](handleError(_0x5efcf0,null));};exports[_0x64ba('0x24')]=function(_0x24e5e6,_0x876da0){if(_0x24e5e6['body']['id']){delete _0x24e5e6[_0x64ba('0x4a')]['id'];}return db[_0x64ba('0x2e')][_0x64ba('0x48')]({'where':{'id':_0x24e5e6[_0x64ba('0x44')]['id']}})[_0x64ba('0x25')](handleEntityNotFound(_0x876da0,null))[_0x64ba('0x25')](saveUpdates(_0x24e5e6[_0x64ba('0x4a')],null))[_0x64ba('0x25')](respondWithResult(_0x876da0,null))['catch'](handleError(_0x876da0,null));};exports[_0x64ba('0x26')]=function(_0x44463e,_0x259a4b){return db[_0x64ba('0x2e')][_0x64ba('0x48')]({'where':{'id':_0x44463e[_0x64ba('0x44')]['id']}})['then'](handleEntityNotFound(_0x259a4b,null))[_0x64ba('0x25')](removeEntity(_0x259a4b,null))[_0x64ba('0x42')](handleError(_0x259a4b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index ab7bda3..6464f3a 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 _0x9475=['./cmHopperAdditionalPhone.attributes','cm_hopper_additional_phones','lodash','util','api','path','rimraf','../../config/environment'];(function(_0x4babeb,_0x28aaa){var _0x40bc6f=function(_0x29559e){while(--_0x29559e){_0x4babeb['push'](_0x4babeb['shift']());}};_0x40bc6f(++_0x28aaa);}(_0x9475,0x172));var _0x5947=function(_0x4053ca,_0x25b1fd){_0x4053ca=_0x4053ca-0x0;var _0x364f65=_0x9475[_0x4053ca];return _0x364f65;};'use strict';var _=require(_0x5947('0x0'));var util=require(_0x5947('0x1'));var logger=require('../../config/logger')(_0x5947('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5947('0x3'));var rimraf=require(_0x5947('0x4'));var config=require(_0x5947('0x5'));var attributes=require(_0x5947('0x6'));module['exports']=function(_0x333a14,_0x5549e3){return _0x333a14['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x5947('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56ff=['api','moment','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','lodash','util','../../config/logger'];(function(_0x48b3c1,_0x412059){var _0x303d08=function(_0x19329d){while(--_0x19329d){_0x48b3c1['push'](_0x48b3c1['shift']());}};_0x303d08(++_0x412059);}(_0x56ff,0x11b));var _0xf56f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56ff[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf56f('0x0'));var util=require(_0xf56f('0x1'));var logger=require(_0xf56f('0x2'))(_0xf56f('0x3'));var moment=require(_0xf56f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf56f('0x5'));var rimraf=require(_0xf56f('0x6'));var config=require(_0xf56f('0x7'));var attributes=require(_0xf56f('0x8'));module['exports']=function(_0x27fe29,_0x2e3162){return _0x27fe29[_0xf56f('0x9')](_0xf56f('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','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 eb64e6b..bd1a441 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 _0x2f6b=['minutes','phone','isNil','createdAt','updatedAt','hopperToAdd','additionalToHop','transaction','update','IncrementPreviewCounters','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countnoanswerretry','countdropretry','countagentrejectretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add'];(function(_0x27d724,_0x48f7a6){var _0x423a52=function(_0x3c7d1d){while(--_0x3c7d1d){_0x27d724['push'](_0x27d724['shift']());}};_0x423a52(++_0x48f7a6);}(_0x2f6b,0x172));var _0xb2f6=function(_0x21481c,_0x1b51ba){_0x21481c=_0x21481c-0x0;var _0x5dd77a=_0x2f6b[_0x21481c];return _0x5dd77a;};'use strict';var _=require('lodash');var util=require(_0xb2f6('0x0'));var moment=require(_0xb2f6('0x1'));var BPromise=require(_0xb2f6('0x2'));var rs=require(_0xb2f6('0x3'));var fs=require('fs');var Redis=require(_0xb2f6('0x4'));var db=require(_0xb2f6('0x5'))['db'];var utils=require(_0xb2f6('0x6'));var logger=require(_0xb2f6('0x7'))(_0xb2f6('0x8'));var config=require(_0xb2f6('0x9'));var jayson=require(_0xb2f6('0xa'));var client=jayson[_0xb2f6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9f27,_0x4123c6,_0x330b28){return new BPromise(function(_0x21ab5b,_0x4a63f4){return client[_0xb2f6('0xc')](_0x4e9f27,_0x330b28)['then'](function(_0x15c15a){logger[_0xb2f6('0xd')](_0xb2f6('0xe'),_0x4123c6,_0xb2f6('0xf'));logger[_0xb2f6('0x10')](_0xb2f6('0x11'),_0x4123c6,_0xb2f6('0xf'),JSON[_0xb2f6('0x12')](_0x15c15a));if(_0x15c15a[_0xb2f6('0x13')]){if(_0x15c15a['error'][_0xb2f6('0x14')]===0x1f4){logger[_0xb2f6('0x13')](_0xb2f6('0xe'),_0x4123c6,_0x15c15a[_0xb2f6('0x13')]['message']);return _0x4a63f4(_0x15c15a[_0xb2f6('0x13')]['message']);}logger['error'](_0xb2f6('0xe'),_0x4123c6,_0x15c15a[_0xb2f6('0x13')]['message']);return _0x21ab5b(_0x15c15a[_0xb2f6('0x13')][_0xb2f6('0x15')]);}else{logger[_0xb2f6('0xd')](_0xb2f6('0xe'),_0x4123c6,_0xb2f6('0xf'));_0x21ab5b(_0x15c15a['result'][_0xb2f6('0x15')]);}})[_0xb2f6('0x16')](function(_0x53df3f){logger[_0xb2f6('0x13')](_0xb2f6('0xe'),_0x4123c6,_0x53df3f);_0x4a63f4(_0x53df3f);});});}exports[_0xb2f6('0x17')]=function(_0x1fc9ac){var _0x170f27=this;return new Promise(function(_0x339675,_0x567eb4){return db[_0xb2f6('0x18')][_0xb2f6('0x19')]({'raw':!![],'where':{'ContactId':_0x1fc9ac[_0xb2f6('0x1a')][_0xb2f6('0x1b')],'ListId':_0x1fc9ac[_0xb2f6('0x1a')][_0xb2f6('0x1c')],'VoiceQueueId':_0x1fc9ac[_0xb2f6('0x1a')][_0xb2f6('0x1d')]===undefined?null:_0x1fc9ac[_0xb2f6('0x1a')][_0xb2f6('0x1d')],'CampaignId':_0x1fc9ac[_0xb2f6('0x1a')][_0xb2f6('0x1e')]===undefined?null:_0x1fc9ac['body'][_0xb2f6('0x1e')]}})[_0xb2f6('0x1f')](function(_0x5bb946){if(_0x5bb946!=null){return db[_0xb2f6('0x20')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5bb946['id'],'OrderBy':{'$gt':_0x5bb946[_0xb2f6('0x21')]}},'order':[[_0xb2f6('0x21'),_0xb2f6('0x22')]]})['then'](function(_0x44dd7e){var _0x4d2c24=0x0;if(_0x44dd7e){if(_0x44dd7e[_0xb2f6('0x23')]+_0x44dd7e[_0xb2f6('0x24')]+_0x44dd7e['countnoanswerretry']+_0x44dd7e[_0xb2f6('0x25')]+_0x44dd7e['countdropretry']+_0x44dd7e[_0xb2f6('0x26')]+_0x44dd7e[_0xb2f6('0x27')]+_0x44dd7e['countagentrejectretry']<_0x1fc9ac[_0xb2f6('0x28')][_0xb2f6('0x29')])_0x4d2c24=0x1;_0x339675({'additional':_0x4d2c24});}else{return db[_0xb2f6('0x20')][_0xb2f6('0x19')]({'raw':!![],'where':{'CmHopperId':_0x5bb946['id']},'order':[[_0xb2f6('0x21'),_0xb2f6('0x22')]]})['then'](function(_0x5f18e2){var _0x11fe23=0x0;if(_0x5f18e2){if(_0x5f18e2[_0xb2f6('0x23')]+_0x5f18e2[_0xb2f6('0x24')]+_0x5f18e2[_0xb2f6('0x2a')]+_0x5f18e2[_0xb2f6('0x25')]+_0x5f18e2[_0xb2f6('0x2b')]+_0x5f18e2[_0xb2f6('0x26')]+_0x5f18e2['countmachineretry']+_0x5f18e2[_0xb2f6('0x2c')]<_0x1fc9ac[_0xb2f6('0x28')][_0xb2f6('0x29')])_0x11fe23=0x1;_0x339675({'additional':_0x11fe23});}else{_0x339675({'additional':0x0});}})[_0xb2f6('0x16')](function(_0x16d956){logger['error'](_0xb2f6('0x17'),_0x16d956[_0xb2f6('0x15')],_0x1fc9ac);_0x567eb4(_0x170f27[_0xb2f6('0x13')](0x1f4,_0x16d956[_0xb2f6('0x15')]));});}})[_0xb2f6('0x16')](function(_0x11feaa){logger[_0xb2f6('0x13')](_0xb2f6('0x17'),_0x11feaa[_0xb2f6('0x15')],_0x1fc9ac);_0x567eb4(_0x170f27['error'](0x1f4,_0x11feaa[_0xb2f6('0x15')]));});}else _0x339675({'additional':0x0});});});};exports[_0xb2f6('0x2d')]=function(_0x2d8262){var _0x174227=this;return new Promise(function(_0x36ce31,_0x2b3780){return db['CmHopper'][_0xb2f6('0x19')]({'raw':!![],'where':{'ContactId':_0x2d8262['body'][_0xb2f6('0x1b')],'ListId':_0x2d8262[_0xb2f6('0x1a')][_0xb2f6('0x1c')],'VoiceQueueId':_0x2d8262['body'][_0xb2f6('0x1d')]===undefined?null:_0x2d8262[_0xb2f6('0x1a')][_0xb2f6('0x1d')],'CampaignId':_0x2d8262[_0xb2f6('0x1a')][_0xb2f6('0x1e')]===undefined?null:_0x2d8262['body']['CampaignId']}})[_0xb2f6('0x1f')](function(_0x48805d){if(_0x48805d!=null){return db[_0xb2f6('0x20')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x48805d['id'],'OrderBy':{'$gt':_0x48805d[_0xb2f6('0x21')]}},'order':[[_0xb2f6('0x21'),_0xb2f6('0x22')]]})[_0xb2f6('0x1f')](function(_0x44385f){if(_0x44385f)return activateAdditionalPhone(_0x48805d,_0x2d8262[_0xb2f6('0x1a')],_0x44385f,_0x2d8262[_0xb2f6('0x2e')],_0x2d8262[_0xb2f6('0x2f')])['then'](function(_0x33d3d6){_0x36ce31(_0x33d3d6);});else{return db[_0xb2f6('0x20')][_0xb2f6('0x19')]({'raw':!![],'where':{'CmHopperId':_0x48805d['id']},'order':[[_0xb2f6('0x21'),'ASC']]})[_0xb2f6('0x1f')](function(_0x29eaff){if(_0x29eaff)return activateAdditionalPhone(_0x48805d,_0x2d8262[_0xb2f6('0x1a')],_0x29eaff,_0x2d8262[_0xb2f6('0x2e')],_0x2d8262[_0xb2f6('0x2f')])['then'](function(_0x48f9c7){_0x36ce31(_0x48f9c7);});else{_0x36ce31({'id':_0x48805d['id'],'phone':''});}})[_0xb2f6('0x16')](function(_0xfa9206){logger[_0xb2f6('0x13')](_0xb2f6('0x17'),_0xfa9206[_0xb2f6('0x15')],_0x2d8262);_0x2b3780(_0x174227['error'](0x1f4,_0xfa9206[_0xb2f6('0x15')]));});}})[_0xb2f6('0x16')](function(_0x10da01){logger[_0xb2f6('0x13')]('VerifyAdditionalPhones',_0x10da01[_0xb2f6('0x15')],_0x2d8262);_0x2b3780(_0x174227[_0xb2f6('0x13')](0x1f4,_0x10da01[_0xb2f6('0x15')]));});}else _0x36ce31(0x1);});});};function activateAdditionalPhone(_0x237f46,_0x24f4ff,_0x3806c9,_0x104096,_0x3b2a4d){return new Promise(function(_0x520e7d,_0x2618d1){logger[_0xb2f6('0xd')](_0xb2f6('0x17'),_0x3806c9);var _0xc2bbf8;if(moment()>moment(_0x3806c9[_0xb2f6('0x30')])){_0xc2bbf8=moment()[_0xb2f6('0x31')](_0x3b2a4d||0x3,_0xb2f6('0x32'));}else{if(_0x3806c9[_0xb2f6('0x21')]==0x0){_0xc2bbf8=moment(_0x3806c9[_0xb2f6('0x30')]);}else{_0xc2bbf8=moment()[_0xb2f6('0x31')](_0x3b2a4d||0x3,_0xb2f6('0x32'));}}var _0x41e341={'phone':_0x237f46[_0xb2f6('0x33')],'active':0x0,'OrderBy':_[_0xb2f6('0x34')](_0x237f46[_0xb2f6('0x21')])?0x0:_0x237f46['OrderBy'],'scheduledat':moment()[_0xb2f6('0x31')](_0x104096||0x1,_0xb2f6('0x32')),'countbusyretry':_0x24f4ff[_0xb2f6('0x23')],'countcongestionretry':_0x24f4ff[_0xb2f6('0x24')],'countnoanswerretry':_0x24f4ff[_0xb2f6('0x2a')],'countnosuchnumberretry':_0x24f4ff[_0xb2f6('0x25')],'countdropretry':_0x24f4ff[_0xb2f6('0x2b')],'countabandonedretry':_0x24f4ff[_0xb2f6('0x26')],'countmachineretry':_0x24f4ff[_0xb2f6('0x27')],'countagentrejectretry':_0x24f4ff['countagentrejectretry'],'createdAt':_0x24f4ff[_0xb2f6('0x35')],'updatedAt':_0x24f4ff[_0xb2f6('0x36')]};var _0x526c97={'CmHopperId':_0x237f46['id'],'phone':_0x3806c9['phone'],'active':0x0,'OrderBy':_[_0xb2f6('0x34')](_0x3806c9[_0xb2f6('0x21')])?0x0:_0x3806c9['OrderBy'],'scheduledat':_0xc2bbf8,'countbusyretry':_0x3806c9[_0xb2f6('0x23')],'countcongestionretry':_0x3806c9[_0xb2f6('0x24')],'countnoanswerretry':_0x3806c9[_0xb2f6('0x2a')],'countnosuchnumberretry':_0x24f4ff['countnosuchnumberretry'],'countdropretry':_0x24f4ff[_0xb2f6('0x2b')],'countabandonedretry':_0x24f4ff[_0xb2f6('0x26')],'countmachineretry':_0x24f4ff[_0xb2f6('0x27')],'countagentrejectretry':_0x24f4ff[_0xb2f6('0x2c')],'createdAt':_0x3806c9['createdAt'],'updatedAt':_0x3806c9[_0xb2f6('0x36')]};logger[_0xb2f6('0xd')](_0xb2f6('0x37'),_0x41e341);logger['info'](_0xb2f6('0x38'),_0x526c97);return db['sequelize'][_0xb2f6('0x39')](function(_0x3ef998){return db['CmHopperAdditionalPhone'][_0xb2f6('0x3a')](_0x41e341,{'where':{'id':_0x3806c9['id']}},{'transaction':_0x3ef998})[_0xb2f6('0x1f')](function(){return db[_0xb2f6('0x18')][_0xb2f6('0x3a')](_0x526c97,{'where':{'id':_0x237f46['id']}},{'transaction':_0x3ef998});});})[_0xb2f6('0x1f')](function(_0x3811a0){_0x520e7d({'id':_0x237f46['id'],'phone':_0x3806c9[_0xb2f6('0x33')]});})[_0xb2f6('0x16')](function(_0x309a81){logger['error'](_0xb2f6('0x17'),_0x309a81[_0xb2f6('0x15')],req);_0x2618d1(_this[_0xb2f6('0x13')](0x1f4,_0x309a81[_0xb2f6('0x15')]));});});}exports[_0xb2f6('0x3b')]=function(_0x15710c){var _0x597c2d=this;return new Promise(function(_0x254882,_0x517d11){return db[_0xb2f6('0x18')]['update'](_0x15710c['body']['field'],{'where':{'id':_0x15710c[_0xb2f6('0x1a')]['id']}})['then'](function(_0xa07c8e){_0x254882(_0xa07c8e);})['catch'](function(_0x2e1835){logger['error'](_0xb2f6('0x3b'),_0x2e1835[_0xb2f6('0x15')],_0x15710c);_0x517d11(_0x597c2d[_0xb2f6('0x13')](0x1f4,_0x2e1835[_0xb2f6('0x15')]));});});}; \ No newline at end of file +var _0xa785=['catch','VerifyAdditionalPhones','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','CmHopper','ContactId','duration','waitTime','ASC','scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','hopperToAdd','update','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xa785,0xcd));var _0x5a78=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0xa785[_0x46428c];return _0x16a677;};'use strict';var _=require(_0x5a78('0x0'));var util=require(_0x5a78('0x1'));var moment=require(_0x5a78('0x2'));var BPromise=require(_0x5a78('0x3'));var rs=require(_0x5a78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a78('0x5'))['db'];var utils=require(_0x5a78('0x6'));var logger=require(_0x5a78('0x7'))(_0x5a78('0x8'));var config=require(_0x5a78('0x9'));var jayson=require(_0x5a78('0xa'));var client=jayson[_0x5a78('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369e1d,_0x189cb2,_0x2db6ee){return new BPromise(function(_0x583807,_0x359e31){return client[_0x5a78('0xc')](_0x369e1d,_0x2db6ee)[_0x5a78('0xd')](function(_0x2a057d){logger[_0x5a78('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x189cb2,_0x5a78('0xf'));logger[_0x5a78('0x10')](_0x5a78('0x11'),_0x189cb2,'request\x20sent',JSON[_0x5a78('0x12')](_0x2a057d));if(_0x2a057d[_0x5a78('0x13')]){if(_0x2a057d[_0x5a78('0x13')]['code']===0x1f4){logger[_0x5a78('0x13')](_0x5a78('0x14'),_0x189cb2,_0x2a057d[_0x5a78('0x13')][_0x5a78('0x15')]);return _0x359e31(_0x2a057d[_0x5a78('0x13')][_0x5a78('0x15')]);}logger[_0x5a78('0x13')](_0x5a78('0x14'),_0x189cb2,_0x2a057d[_0x5a78('0x13')][_0x5a78('0x15')]);return _0x583807(_0x2a057d[_0x5a78('0x13')]['message']);}else{logger['info'](_0x5a78('0x14'),_0x189cb2,_0x5a78('0xf'));_0x583807(_0x2a057d[_0x5a78('0x16')]['message']);}})[_0x5a78('0x17')](function(_0x13d80){logger[_0x5a78('0x13')](_0x5a78('0x14'),_0x189cb2,_0x13d80);_0x359e31(_0x13d80);});});}exports[_0x5a78('0x18')]=function(_0x1ca682){var _0x44f9ae=this;return new Promise(function(_0x2bd667,_0x2900d3){return db['CmHopper'][_0x5a78('0x19')]({'raw':!![],'where':{'ContactId':_0x1ca682[_0x5a78('0x1a')]['ContactId'],'ListId':_0x1ca682[_0x5a78('0x1a')][_0x5a78('0x1b')],'VoiceQueueId':_0x1ca682[_0x5a78('0x1a')][_0x5a78('0x1c')]===undefined?null:_0x1ca682[_0x5a78('0x1a')][_0x5a78('0x1c')],'CampaignId':_0x1ca682[_0x5a78('0x1a')][_0x5a78('0x1d')]===undefined?null:_0x1ca682[_0x5a78('0x1a')][_0x5a78('0x1d')]}})[_0x5a78('0xd')](function(_0x49f324){if(_0x49f324!=null){return db[_0x5a78('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x49f324['id'],'OrderBy':{'$gt':_0x49f324[_0x5a78('0x1f')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x56d4e7){var _0x1c2696=0x0;if(_0x56d4e7){if(_0x56d4e7['countbusyretry']+_0x56d4e7[_0x5a78('0x20')]+_0x56d4e7[_0x5a78('0x21')]+_0x56d4e7[_0x5a78('0x22')]+_0x56d4e7[_0x5a78('0x23')]+_0x56d4e7[_0x5a78('0x24')]+_0x56d4e7[_0x5a78('0x25')]+_0x56d4e7[_0x5a78('0x26')]<_0x1ca682[_0x5a78('0x27')][_0x5a78('0x28')])_0x1c2696=0x1;_0x2bd667({'additional':_0x1c2696});}else{return db[_0x5a78('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x49f324['id']},'order':[[_0x5a78('0x1f'),'ASC']]})[_0x5a78('0xd')](function(_0x467e0a){var _0x9ab2c7=0x0;if(_0x467e0a){if(_0x467e0a[_0x5a78('0x29')]+_0x467e0a['countcongestionretry']+_0x467e0a[_0x5a78('0x21')]+_0x467e0a[_0x5a78('0x22')]+_0x467e0a[_0x5a78('0x23')]+_0x467e0a[_0x5a78('0x24')]+_0x467e0a[_0x5a78('0x25')]+_0x467e0a['countagentrejectretry']<_0x1ca682[_0x5a78('0x27')][_0x5a78('0x28')])_0x9ab2c7=0x1;_0x2bd667({'additional':_0x9ab2c7});}else{_0x2bd667({'additional':0x0});}})[_0x5a78('0x17')](function(_0xe806c0){logger['error'](_0x5a78('0x18'),_0xe806c0[_0x5a78('0x15')],_0x1ca682);_0x2900d3(_0x44f9ae[_0x5a78('0x13')](0x1f4,_0xe806c0[_0x5a78('0x15')]));});}})[_0x5a78('0x17')](function(_0x5770d6){logger[_0x5a78('0x13')](_0x5a78('0x18'),_0x5770d6[_0x5a78('0x15')],_0x1ca682);_0x2900d3(_0x44f9ae[_0x5a78('0x13')](0x1f4,_0x5770d6[_0x5a78('0x15')]));});}else _0x2bd667({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x50797c){var _0x2b56d3=this;return new Promise(function(_0x4f2a96,_0x31e226){return db[_0x5a78('0x2a')][_0x5a78('0x19')]({'raw':!![],'where':{'ContactId':_0x50797c[_0x5a78('0x1a')][_0x5a78('0x2b')],'ListId':_0x50797c[_0x5a78('0x1a')][_0x5a78('0x1b')],'VoiceQueueId':_0x50797c[_0x5a78('0x1a')][_0x5a78('0x1c')]===undefined?null:_0x50797c[_0x5a78('0x1a')]['VoiceQueueId'],'CampaignId':_0x50797c['body'][_0x5a78('0x1d')]===undefined?null:_0x50797c[_0x5a78('0x1a')][_0x5a78('0x1d')]}})['then'](function(_0x3cc4f3){if(_0x3cc4f3!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x3cc4f3['id'],'OrderBy':{'$gt':_0x3cc4f3[_0x5a78('0x1f')]}},'order':[[_0x5a78('0x1f'),'ASC']]})[_0x5a78('0xd')](function(_0x123800){if(_0x123800)return activateAdditionalPhone(_0x3cc4f3,_0x50797c[_0x5a78('0x1a')],_0x123800,_0x50797c[_0x5a78('0x2c')],_0x50797c[_0x5a78('0x2d')])[_0x5a78('0xd')](function(_0x4d374a){_0x4f2a96(_0x4d374a);});else{return db[_0x5a78('0x1e')][_0x5a78('0x19')]({'raw':!![],'where':{'CmHopperId':_0x3cc4f3['id']},'order':[[_0x5a78('0x1f'),_0x5a78('0x2e')]]})[_0x5a78('0xd')](function(_0x318ce5){if(_0x318ce5)return activateAdditionalPhone(_0x3cc4f3,_0x50797c[_0x5a78('0x1a')],_0x318ce5,_0x50797c[_0x5a78('0x2c')],_0x50797c[_0x5a78('0x2d')])[_0x5a78('0xd')](function(_0x572f99){_0x4f2a96(_0x572f99);});else{_0x4f2a96({'id':_0x3cc4f3['id'],'phone':''});}})[_0x5a78('0x17')](function(_0x238107){logger[_0x5a78('0x13')](_0x5a78('0x18'),_0x238107[_0x5a78('0x15')],_0x50797c);_0x31e226(_0x2b56d3[_0x5a78('0x13')](0x1f4,_0x238107[_0x5a78('0x15')]));});}})[_0x5a78('0x17')](function(_0x4a6b2f){logger[_0x5a78('0x13')](_0x5a78('0x18'),_0x4a6b2f[_0x5a78('0x15')],_0x50797c);_0x31e226(_0x2b56d3[_0x5a78('0x13')](0x1f4,_0x4a6b2f[_0x5a78('0x15')]));});}else _0x4f2a96(0x1);});});};function activateAdditionalPhone(_0x3552c1,_0x2f8758,_0x499348,_0x540dd8,_0x1b78bb){return new Promise(function(_0x1da87e,_0x157858){logger[_0x5a78('0xe')](_0x5a78('0x18'),_0x499348);var _0x1de8bd;if(moment()>moment(_0x499348[_0x5a78('0x2f')])){_0x1de8bd=moment()[_0x5a78('0x30')](_0x1b78bb||0x3,'minutes');}else{if(_0x499348[_0x5a78('0x1f')]==0x0){_0x1de8bd=moment(_0x499348[_0x5a78('0x2f')]);}else{_0x1de8bd=moment()[_0x5a78('0x30')](_0x1b78bb||0x3,_0x5a78('0x31'));}}var _0x4a6b52={'phone':_0x3552c1[_0x5a78('0x32')],'active':0x0,'OrderBy':_[_0x5a78('0x33')](_0x3552c1['OrderBy'])?0x0:_0x3552c1[_0x5a78('0x1f')],'scheduledat':moment()[_0x5a78('0x30')](_0x540dd8||0x1,_0x5a78('0x31')),'countbusyretry':_0x2f8758[_0x5a78('0x29')],'countcongestionretry':_0x2f8758[_0x5a78('0x20')],'countnoanswerretry':_0x2f8758['countnoanswerretry'],'countnosuchnumberretry':_0x2f8758[_0x5a78('0x22')],'countdropretry':_0x2f8758[_0x5a78('0x23')],'countabandonedretry':_0x2f8758['countabandonedretry'],'countmachineretry':_0x2f8758['countmachineretry'],'countagentrejectretry':_0x2f8758[_0x5a78('0x26')],'createdAt':_0x2f8758[_0x5a78('0x34')],'updatedAt':_0x2f8758[_0x5a78('0x35')]};var _0x2b2a0f={'CmHopperId':_0x3552c1['id'],'phone':_0x499348[_0x5a78('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x499348[_0x5a78('0x1f')])?0x0:_0x499348[_0x5a78('0x1f')],'scheduledat':_0x1de8bd,'countbusyretry':_0x499348[_0x5a78('0x29')],'countcongestionretry':_0x499348['countcongestionretry'],'countnoanswerretry':_0x499348[_0x5a78('0x21')],'countnosuchnumberretry':_0x2f8758[_0x5a78('0x22')],'countdropretry':_0x2f8758[_0x5a78('0x23')],'countabandonedretry':_0x2f8758[_0x5a78('0x24')],'countmachineretry':_0x2f8758[_0x5a78('0x25')],'countagentrejectretry':_0x2f8758[_0x5a78('0x26')],'createdAt':_0x499348[_0x5a78('0x34')],'updatedAt':_0x499348[_0x5a78('0x35')]};logger['info'](_0x5a78('0x36'),_0x4a6b52);logger[_0x5a78('0xe')]('additionalToHop',_0x2b2a0f);return db['sequelize']['transaction'](function(_0x3e6a8){return db[_0x5a78('0x1e')]['update'](_0x4a6b52,{'where':{'id':_0x499348['id']}},{'transaction':_0x3e6a8})[_0x5a78('0xd')](function(){return db[_0x5a78('0x2a')][_0x5a78('0x37')](_0x2b2a0f,{'where':{'id':_0x3552c1['id']}},{'transaction':_0x3e6a8});});})[_0x5a78('0xd')](function(_0x26cb92){_0x1da87e({'id':_0x3552c1['id'],'phone':_0x499348[_0x5a78('0x32')]});})[_0x5a78('0x17')](function(_0x384029){logger[_0x5a78('0x13')](_0x5a78('0x18'),_0x384029['message'],req);_0x157858(_this[_0x5a78('0x13')](0x1f4,_0x384029[_0x5a78('0x15')]));});});}exports[_0x5a78('0x38')]=function(_0x37b31b){var _0x3b65d3=this;return new Promise(function(_0x19ad64,_0x2558c7){return db[_0x5a78('0x2a')][_0x5a78('0x37')](_0x37b31b[_0x5a78('0x1a')]['field'],{'where':{'id':_0x37b31b['body']['id']}})[_0x5a78('0xd')](function(_0x2b8e67){_0x19ad64(_0x2b8e67);})[_0x5a78('0x17')](function(_0x4c11b2){logger[_0x5a78('0x13')](_0x5a78('0x38'),_0x4c11b2[_0x5a78('0x15')],_0x37b31b);_0x2558c7(_0x3b65d3[_0x5a78('0x13')](0x1f4,_0x4c11b2[_0x5a78('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 390032f..6ba1784 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 _0x8bea=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x8bea,0x96));var _0xa8be=function(_0x1d78bd,_0x55da95){_0x1d78bd=_0x1d78bd-0x0;var _0x51fc0e=_0x8bea[_0x1d78bd];return _0x51fc0e;};'use strict';var multer=require(_0xa8be('0x0'));var util=require(_0xa8be('0x1'));var path=require(_0xa8be('0x2'));var timeout=require(_0xa8be('0x3'));var express=require('express');var router=express[_0xa8be('0x4')]();var auth=require(_0xa8be('0x5'));var interaction=require(_0xa8be('0x6'));var config=require(_0xa8be('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xa8be('0x8')]('/',auth[_0xa8be('0x9')](),controller[_0xa8be('0xa')]);router['get']('/:id',auth[_0xa8be('0x9')](),controller['show']);router[_0xa8be('0xb')]('/',auth[_0xa8be('0x9')](),controller[_0xa8be('0xc')]);router[_0xa8be('0xd')]('/:id',auth[_0xa8be('0x9')](),controller[_0xa8be('0xe')]);router[_0xa8be('0xf')](_0xa8be('0x10'),auth[_0xa8be('0x9')](),controller[_0xa8be('0x11')]);module[_0xa8be('0x12')]=router; \ No newline at end of file +var _0x465e=['Router','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x515487,_0x21f28b){var _0x56e18a=function(_0x132301){while(--_0x132301){_0x515487['push'](_0x515487['shift']());}};_0x56e18a(++_0x21f28b);}(_0x465e,0x1b1));var _0xe465=function(_0x5a9fb9,_0xb126c4){_0x5a9fb9=_0x5a9fb9-0x0;var _0x110430=_0x465e[_0x5a9fb9];return _0x110430;};'use strict';var multer=require(_0xe465('0x0'));var util=require(_0xe465('0x1'));var path=require(_0xe465('0x2'));var timeout=require(_0xe465('0x3'));var express=require('express');var router=express[_0xe465('0x4')]();var auth=require(_0xe465('0x5'));var interaction=require(_0xe465('0x6'));var config=require('../../config/environment');var controller=require(_0xe465('0x7'));router['get']('/',auth[_0xe465('0x8')](),controller[_0xe465('0x9')]);router[_0xe465('0xa')](_0xe465('0xb'),auth[_0xe465('0x8')](),controller[_0xe465('0xc')]);router[_0xe465('0xd')]('/',auth[_0xe465('0x8')](),controller[_0xe465('0xe')]);router[_0xe465('0xf')]('/:id',auth[_0xe465('0x8')](),controller[_0xe465('0x10')]);router[_0xe465('0x11')](_0xe465('0xb'),auth[_0xe465('0x8')](),controller[_0xe465('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f4938ca..1001907 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 _0x13d5=['contactListQueue','sequelize','exports','INTEGER'];(function(_0x9366b5,_0x2f67c4){var _0x34334b=function(_0x14c5e6){while(--_0x14c5e6){_0x9366b5['push'](_0x9366b5['shift']());}};_0x34334b(++_0x2f67c4);}(_0x13d5,0xc1));var _0x513d=function(_0x15ab72,_0x1be302){_0x15ab72=_0x15ab72-0x0;var _0x45eee1=_0x13d5[_0x15ab72];return _0x45eee1;};'use strict';var moment=require('moment');var Sequelize=require(_0x513d('0x0'));module[_0x513d('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x513d('0x2')],'unique':_0x513d('0x3')},'ListId':{'type':Sequelize[_0x513d('0x2')],'unique':_0x513d('0x3')},'VoiceQueueId':{'type':Sequelize[_0x513d('0x2')],'unique':_0x513d('0x3')}}; \ No newline at end of file +var _0x75fa=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x4d94d6,_0xae1107){var _0x394d51=function(_0x315137){while(--_0x315137){_0x4d94d6['push'](_0x4d94d6['shift']());}};_0x394d51(++_0xae1107);}(_0x75fa,0x1d8));var _0xa75f=function(_0x25c47d,_0x112792){_0x25c47d=_0x25c47d-0x0;var _0x24c2ca=_0x75fa[_0x25c47d];return _0x24c2ca;};'use strict';var moment=require('moment');var Sequelize=require(_0xa75f('0x0'));module[_0xa75f('0x1')]={'phone':{'type':Sequelize[_0xa75f('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa75f('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xa75f('0x3')],'unique':_0xa75f('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa75f('0x3')],'unique':_0xa75f('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c4cfe8c..4b8ad00 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(_0x3f9570,_0x3b0ee3){var _0x79e824=function(_0x217bb7){while(--_0x217bb7){_0x3f9570['push'](_0x3f9570['shift']());}};_0x79e824(++_0x3b0ee3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x212c7a,_0x3b5448){var _0x3316e2=function(_0xf1e5dc){while(--_0xf1e5dc){_0x212c7a['push'](_0x212c7a['shift']());}};_0x3316e2(++_0x3b5448);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('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 6a56e7b..457a99c 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5f3ec0,_0x2e5727){var _0x4fc278=function(_0x467657){while(--_0x467657){_0x5f3ec0['push'](_0x5f3ec0['shift']());}};_0x4fc278(++_0x2e5727);}(_0xe706,0xa3));var _0x6e70=function(_0x2d04a6,_0x5bbf0a){_0x2d04a6=_0x2d04a6-0x0;var _0x3cd00e=_0xe706[_0x2d04a6];return _0x3cd00e;};'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':!![]});}; \ No newline at end of file +var _0x70e0=['cm_hopper_black','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes'];(function(_0x5e4134,_0x1a1c27){var _0x529994=function(_0x40956b){while(--_0x40956b){_0x5e4134['push'](_0x5e4134['shift']());}};_0x529994(++_0x1a1c27);}(_0x70e0,0x17b));var _0x070e=function(_0x38308f,_0x159a7e){_0x38308f=_0x38308f-0x0;var _0x2658e7=_0x70e0[_0x38308f];return _0x2658e7;};'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 ac59d6a..fed1d04 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 _0xc200=['map','model','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','util','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include'];(function(_0x3267d8,_0x79830b){var _0xbc0cfa=function(_0x6c1f2a){while(--_0x6c1f2a){_0x3267d8['push'](_0x3267d8['shift']());}};_0xbc0cfa(++_0x79830b);}(_0xc200,0xbb));var _0x0c20=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc200[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x0c20('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c20('0x1'));var fs=require('fs');var Redis=require(_0x0c20('0x2'));var db=require(_0x0c20('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0c20('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x0c20('0x5')][_0x0c20('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x7c8bdb,_0x297a9a,_0x5e85d1){return new BPromise(function(_0x3882a7,_0x4ab901){return client['request'](_0x7c8bdb,_0x5e85d1)[_0x0c20('0x7')](function(_0x2406ab){logger[_0x0c20('0x8')](_0x0c20('0x9'),_0x297a9a,_0x0c20('0xa'));logger[_0x0c20('0xb')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x297a9a,_0x0c20('0xa'),JSON[_0x0c20('0xc')](_0x2406ab));if(_0x2406ab[_0x0c20('0xd')]){if(_0x2406ab[_0x0c20('0xd')]['code']===0x1f4){logger[_0x0c20('0xd')](_0x0c20('0x9'),_0x297a9a,_0x2406ab[_0x0c20('0xd')]['message']);return _0x4ab901(_0x2406ab[_0x0c20('0xd')][_0x0c20('0xe')]);}logger[_0x0c20('0xd')](_0x0c20('0x9'),_0x297a9a,_0x2406ab[_0x0c20('0xd')][_0x0c20('0xe')]);return _0x3882a7(_0x2406ab[_0x0c20('0xd')][_0x0c20('0xe')]);}else{logger[_0x0c20('0x8')]('CmHopperBlack,\x20%s,\x20%s',_0x297a9a,_0x0c20('0xa'));_0x3882a7(_0x2406ab['result'][_0x0c20('0xe')]);}})['catch'](function(_0x1bb0fb){logger[_0x0c20('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x297a9a,_0x1bb0fb);_0x4ab901(_0x1bb0fb);});});}exports[_0x0c20('0xf')]=function(_0xbce952){var _0x5155bc=this;return new Promise(function(_0x2cb3f1,_0x1f1dc9){return db[_0x0c20('0x10')]['findAll']({'raw':_0xbce952[_0x0c20('0x11')]?_0xbce952[_0x0c20('0x11')][_0x0c20('0x12')]===undefined?!![]:![]:!![],'where':_0xbce952[_0x0c20('0x11')]?_0xbce952[_0x0c20('0x11')][_0x0c20('0x13')]||null:null,'attributes':_0xbce952[_0x0c20('0x11')]?_0xbce952['options'][_0x0c20('0x14')]||null:null,'limit':_0xbce952[_0x0c20('0x11')]?_0xbce952[_0x0c20('0x11')][_0x0c20('0x15')]||null:null,'include':_0xbce952['options']?_0xbce952[_0x0c20('0x11')][_0x0c20('0x16')]?_[_0x0c20('0x17')](_0xbce952[_0x0c20('0x11')][_0x0c20('0x16')],function(_0x4818fd){return{'model':db[_0x4818fd['model']],'as':_0x4818fd['as'],'attributes':_0x4818fd[_0x0c20('0x14')],'include':_0x4818fd['include']?_[_0x0c20('0x17')](_0x4818fd[_0x0c20('0x16')],function(_0x4e08e7){return{'model':db[_0x4e08e7[_0x0c20('0x18')]],'as':_0x4e08e7['as'],'attributes':_0x4e08e7[_0x0c20('0x14')],'include':_0x4e08e7[_0x0c20('0x16')]?_[_0x0c20('0x17')](_0x4e08e7['include'],function(_0x77e18f){return{'model':db[_0x77e18f['model']],'as':_0x77e18f['as'],'attributes':_0x77e18f[_0x0c20('0x14')]};}):[]};}):[]};}):[]:[]})[_0x0c20('0x7')](function(_0x52f217){logger['info'](_0x0c20('0xf'),_0xbce952);logger[_0x0c20('0xb')](_0x0c20('0xf'),_0xbce952,JSON[_0x0c20('0xc')](_0x52f217));_0x2cb3f1(_0x52f217);})[_0x0c20('0x19')](function(_0x561101){logger[_0x0c20('0xd')](_0x0c20('0xf'),_0x561101[_0x0c20('0xe')],_0xbce952);_0x1f1dc9(_0x5155bc[_0x0c20('0xd')](0x1f4,_0x561101[_0x0c20('0xe')]));});});};exports[_0x0c20('0x1a')]=function(_0x17d141){var _0x4d7ee3=this;return new Promise(function(_0x5d0956,_0x34cd3d){return db[_0x0c20('0x10')][_0x0c20('0x1b')](_0x17d141[_0x0c20('0x1c')],{'raw':_0x17d141[_0x0c20('0x11')]?_0x17d141[_0x0c20('0x11')][_0x0c20('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17d141[_0x0c20('0x11')]?_0x17d141[_0x0c20('0x11')]['where']||null:null,'attributes':_0x17d141[_0x0c20('0x11')]?_0x17d141['options']['attributes']||null:null,'limit':_0x17d141[_0x0c20('0x11')]?_0x17d141[_0x0c20('0x11')]['limit']||null:null})[_0x0c20('0x7')](function(_0x445c7c){logger[_0x0c20('0x8')](_0x0c20('0x1a'),_0x17d141);logger[_0x0c20('0xb')]('UpdateCmHopperBlack',_0x17d141,JSON[_0x0c20('0xc')](_0x445c7c));_0x5d0956(_0x445c7c);})[_0x0c20('0x19')](function(_0x55ad2d){logger[_0x0c20('0xd')](_0x0c20('0x1a'),_0x55ad2d['message'],_0x17d141);_0x34cd3d(_0x4d7ee3['error'](0x1f4,_0x55ad2d['message']));});});};exports[_0x0c20('0x1d')]=function(_0x4b0c17){var _0x2a54d1=this;return new Promise(function(_0x3a81ca,_0xdc7d60){return db[_0x0c20('0x10')]['destroy']({'where':_0x4b0c17[_0x0c20('0x11')]?_0x4b0c17[_0x0c20('0x11')]['where']||null:null})[_0x0c20('0x7')](function(_0xe12be7){logger[_0x0c20('0x8')](_0x0c20('0x1d'),_0x4b0c17);logger[_0x0c20('0xb')](_0x0c20('0x1d'),_0x4b0c17,JSON[_0x0c20('0xc')](_0xe12be7));_0x3a81ca(_0xe12be7);})[_0x0c20('0x19')](function(_0x143754){logger[_0x0c20('0xd')](_0x0c20('0x1d'),_0x143754[_0x0c20('0xe')],_0x4b0c17);_0xdc7d60(_0x2a54d1[_0x0c20('0xd')](0x1f4,_0x143754[_0x0c20('0xe')]));});});}; \ No newline at end of file +var _0x4926=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','map','model','attributes','include','debug','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack'];(function(_0x4e8821,_0x41bde4){var _0x353b80=function(_0x9a9aec){while(--_0x9a9aec){_0x4e8821['push'](_0x4e8821['shift']());}};_0x353b80(++_0x41bde4);}(_0x4926,0xbe));var _0x6492=function(_0xb99421,_0xaab133){_0xb99421=_0xb99421-0x0;var _0x4b3ec7=_0x4926[_0xb99421];return _0x4b3ec7;};'use strict';var _=require(_0x6492('0x0'));var util=require(_0x6492('0x1'));var moment=require(_0x6492('0x2'));var BPromise=require(_0x6492('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6492('0x4'))['db'];var utils=require(_0x6492('0x5'));var logger=require(_0x6492('0x6'))(_0x6492('0x7'));var config=require(_0x6492('0x8'));var jayson=require(_0x6492('0x9'));var client=jayson[_0x6492('0xa')][_0x6492('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x537d8b,_0x334953,_0x17b63f){return new BPromise(function(_0x901fb2,_0x5ac831){return client[_0x6492('0xc')](_0x537d8b,_0x17b63f)[_0x6492('0xd')](function(_0x365a2c){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x334953,_0x6492('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x334953,'request\x20sent',JSON[_0x6492('0xf')](_0x365a2c));if(_0x365a2c[_0x6492('0x10')]){if(_0x365a2c[_0x6492('0x10')][_0x6492('0x11')]===0x1f4){logger[_0x6492('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x334953,_0x365a2c[_0x6492('0x10')][_0x6492('0x12')]);return _0x5ac831(_0x365a2c['error'][_0x6492('0x12')]);}logger[_0x6492('0x10')](_0x6492('0x13'),_0x334953,_0x365a2c[_0x6492('0x10')][_0x6492('0x12')]);return _0x901fb2(_0x365a2c[_0x6492('0x10')]['message']);}else{logger[_0x6492('0x14')](_0x6492('0x13'),_0x334953,'request\x20sent');_0x901fb2(_0x365a2c[_0x6492('0x15')][_0x6492('0x12')]);}})[_0x6492('0x16')](function(_0x425609){logger[_0x6492('0x10')](_0x6492('0x13'),_0x334953,_0x425609);_0x5ac831(_0x425609);});});}exports[_0x6492('0x17')]=function(_0x3b1bd8){var _0xb734c4=this;return new Promise(function(_0x5c0f71,_0x384f7e){return db[_0x6492('0x18')][_0x6492('0x19')]({'raw':_0x3b1bd8[_0x6492('0x1a')]?_0x3b1bd8[_0x6492('0x1a')][_0x6492('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b1bd8[_0x6492('0x1a')]?_0x3b1bd8[_0x6492('0x1a')]['where']||null:null,'attributes':_0x3b1bd8['options']?_0x3b1bd8['options']['attributes']||null:null,'limit':_0x3b1bd8[_0x6492('0x1a')]?_0x3b1bd8[_0x6492('0x1a')][_0x6492('0x1c')]||null:null,'include':_0x3b1bd8[_0x6492('0x1a')]?_0x3b1bd8[_0x6492('0x1a')]['include']?_[_0x6492('0x1d')](_0x3b1bd8['options']['include'],function(_0x2f685d){return{'model':db[_0x2f685d[_0x6492('0x1e')]],'as':_0x2f685d['as'],'attributes':_0x2f685d[_0x6492('0x1f')],'include':_0x2f685d[_0x6492('0x20')]?_[_0x6492('0x1d')](_0x2f685d[_0x6492('0x20')],function(_0x2b9b31){return{'model':db[_0x2b9b31[_0x6492('0x1e')]],'as':_0x2b9b31['as'],'attributes':_0x2b9b31['attributes'],'include':_0x2b9b31[_0x6492('0x20')]?_[_0x6492('0x1d')](_0x2b9b31[_0x6492('0x20')],function(_0xc28ae5){return{'model':db[_0xc28ae5[_0x6492('0x1e')]],'as':_0xc28ae5['as'],'attributes':_0xc28ae5[_0x6492('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6492('0xd')](function(_0x5ccd2e){logger[_0x6492('0x14')](_0x6492('0x17'),_0x3b1bd8);logger[_0x6492('0x21')]('GetCmHopperBlack',_0x3b1bd8,JSON[_0x6492('0xf')](_0x5ccd2e));_0x5c0f71(_0x5ccd2e);})['catch'](function(_0x1054c6){logger[_0x6492('0x10')]('GetCmHopperBlack',_0x1054c6[_0x6492('0x12')],_0x3b1bd8);_0x384f7e(_0xb734c4[_0x6492('0x10')](0x1f4,_0x1054c6['message']));});});};exports['UpdateCmHopperBlack']=function(_0x3fb3df){var _0x53abc9=this;return new Promise(function(_0x3de77a,_0x2c9132){return db['CmHopperBlack'][_0x6492('0x22')](_0x3fb3df[_0x6492('0x23')],{'raw':_0x3fb3df[_0x6492('0x1a')]?_0x3fb3df[_0x6492('0x1a')][_0x6492('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb3df[_0x6492('0x1a')]?_0x3fb3df[_0x6492('0x1a')]['where']||null:null,'attributes':_0x3fb3df[_0x6492('0x1a')]?_0x3fb3df[_0x6492('0x1a')][_0x6492('0x1f')]||null:null,'limit':_0x3fb3df['options']?_0x3fb3df[_0x6492('0x1a')]['limit']||null:null})['then'](function(_0x3c6d51){logger['info'](_0x6492('0x24'),_0x3fb3df);logger[_0x6492('0x21')](_0x6492('0x24'),_0x3fb3df,JSON[_0x6492('0xf')](_0x3c6d51));_0x3de77a(_0x3c6d51);})[_0x6492('0x16')](function(_0x43b8df){logger['error'](_0x6492('0x24'),_0x43b8df[_0x6492('0x12')],_0x3fb3df);_0x2c9132(_0x53abc9[_0x6492('0x10')](0x1f4,_0x43b8df[_0x6492('0x12')]));});});};exports[_0x6492('0x25')]=function(_0x532c38){var _0x4087b0=this;return new Promise(function(_0x1bd1d8,_0x3fb56f){return db[_0x6492('0x18')]['destroy']({'where':_0x532c38[_0x6492('0x1a')]?_0x532c38['options']['where']||null:null})[_0x6492('0xd')](function(_0x1bc9ab){logger[_0x6492('0x14')](_0x6492('0x25'),_0x532c38);logger['debug'](_0x6492('0x25'),_0x532c38,JSON[_0x6492('0xf')](_0x1bc9ab));_0x1bd1d8(_0x1bc9ab);})[_0x6492('0x16')](function(_0x35201d){logger[_0x6492('0x10')]('DestroyCmHopperBlack',_0x35201d[_0x6492('0x12')],_0x532c38);_0x3fb56f(_0x4087b0[_0x6492('0x10')](0x1f4,_0x35201d[_0x6492('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 6d602f7..e74f6a9 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 _0xfd28=['index','/describe','/:id','put','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1ab16a,_0x3ba5c9){var _0x28cf50=function(_0x442a55){while(--_0x442a55){_0x1ab16a['push'](_0x1ab16a['shift']());}};_0x28cf50(++_0x3ba5c9);}(_0xfd28,0x148));var _0x8fd2=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xfd28[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var auth=require(_0x8fd2('0x3'));var interaction=require(_0x8fd2('0x4'));var config=require(_0x8fd2('0x5'));var controller=require('./cmHopperBlack.controller');router[_0x8fd2('0x6')]('/',auth[_0x8fd2('0x7')](),controller[_0x8fd2('0x8')]);router[_0x8fd2('0x6')](_0x8fd2('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x8fd2('0x6')](_0x8fd2('0xa'),auth[_0x8fd2('0x7')](),controller['show']);router[_0x8fd2('0xb')]('/:id',auth[_0x8fd2('0x7')](),controller['update']);router[_0x8fd2('0xc')]('/:id',auth[_0x8fd2('0x7')](),controller['destroy']);module[_0x8fd2('0xd')]=router; \ No newline at end of file +var _0x54ef=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated','show','/:id'];(function(_0x19f733,_0x332935){var _0x5795e8=function(_0x2bf841){while(--_0x2bf841){_0x19f733['push'](_0x19f733['shift']());}};_0x5795e8(++_0x332935);}(_0x54ef,0x112));var _0xf54e=function(_0x34e006,_0x334ac4){_0x34e006=_0x34e006-0x0;var _0x57d7b2=_0x54ef[_0x34e006];return _0x57d7b2;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var auth=require(_0xf54e('0x5'));var interaction=require(_0xf54e('0x6'));var config=require(_0xf54e('0x7'));var controller=require(_0xf54e('0x8'));router[_0xf54e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf54e('0x9')](_0xf54e('0xa'),auth[_0xf54e('0xb')](),controller['describe']);router[_0xf54e('0x9')]('/:id',auth[_0xf54e('0xb')](),controller[_0xf54e('0xc')]);router['put'](_0xf54e('0xd'),auth[_0xf54e('0xb')](),controller[_0xf54e('0xe')]);router[_0xf54e('0xf')]('/:id',auth[_0xf54e('0xb')](),controller[_0xf54e('0x10')]);module[_0xf54e('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 6b08ec6..9804d9b 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 _0x5a60=['diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING','setDataValue'];(function(_0xee80d5,_0x2f261f){var _0x409f0a=function(_0x117cc1){while(--_0x117cc1){_0xee80d5['push'](_0xee80d5['shift']());}};_0x409f0a(++_0x2f261f);}(_0x5a60,0x19d));var _0x05a6=function(_0x40d58a,_0x58d61e){_0x40d58a=_0x40d58a-0x0;var _0x221ee8=_0x5a60[_0x40d58a];return _0x221ee8;};'use strict';var Sequelize=require(_0x05a6('0x0'));var moment=require(_0x05a6('0x1'));module[_0x05a6('0x2')]={'state':{'type':Sequelize[_0x05a6('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x05a6('0x4')]},'countbusyretry':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x05a6('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x05a6('0x5')]},'originatecalleridname':{'type':Sequelize[_0x05a6('0x5')]},'calleridnum':{'type':Sequelize[_0x05a6('0x5')]},'calleridname':{'type':Sequelize[_0x05a6('0x5')]},'starttime':{'type':Sequelize[_0x05a6('0x4')]},'responsetime':{'type':Sequelize[_0x05a6('0x4')]},'answertime':{'type':Sequelize[_0x05a6('0x4')]},'droptime':{'type':Sequelize[_0x05a6('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x05a6('0x5')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x05a6('0x5')]},'membername':{'type':Sequelize[_0x05a6('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x05a6('0x5')]},'dispositionat':{'type':Sequelize[_0x05a6('0x4')],'set':function(_0x15775e){var _0x471e32=this['getDataValue']('endtime');if(_0x471e32&&_0x15775e){this[_0x05a6('0x6')]('followuptime',moment(_0x15775e)[_0x05a6('0x7')](moment(_0x471e32),_0x05a6('0x8')));}return this[_0x05a6('0x6')]('dispositionat',_0x15775e);}},'amd':{'type':Sequelize[_0x05a6('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x05a6('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x05a6('0x4')]},'callback':{'type':Sequelize[_0x05a6('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x05a6('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x05a6('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x05a6('0x4')]},'recallme':{'type':Sequelize[_0x05a6('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x05a6('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x64f8=['diff','seconds','dispositionat','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x5a5f05,_0x234d2a){var _0x52a1d4=function(_0x4d9e7c){while(--_0x4d9e7c){_0x5a5f05['push'](_0x5a5f05['shift']());}};_0x52a1d4(++_0x234d2a);}(_0x64f8,0x1f2));var _0x864f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64f8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x864f('0x0'));var moment=require('moment');module[_0x864f('0x1')]={'state':{'type':Sequelize[_0x864f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x864f('0x3')]},'scheduledat':{'type':Sequelize[_0x864f('0x4')]},'countbusyretry':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x864f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x864f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x864f('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x864f('0x4')]},'answertime':{'type':Sequelize[_0x864f('0x4')]},'droptime':{'type':Sequelize[_0x864f('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x864f('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x864f('0x3')]},'membername':{'type':Sequelize[_0x864f('0x3')]},'reason':{'type':Sequelize[_0x864f('0x3')]},'disposition':{'type':Sequelize[_0x864f('0x3')]},'dispositionat':{'type':Sequelize[_0x864f('0x4')],'set':function(_0xea39a5){var _0x10d113=this[_0x864f('0x5')](_0x864f('0x6'));if(_0x10d113&&_0xea39a5){this[_0x864f('0x7')](_0x864f('0x8'),moment(_0xea39a5)[_0x864f('0x9')](moment(_0x10d113),_0x864f('0xa')));}return this[_0x864f('0x7')](_0x864f('0xb'),_0xea39a5);}},'amd':{'type':Sequelize[_0x864f('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x864f('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x864f('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x864f('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x864f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x864f('0x4')]},'deleted':{'type':Sequelize[_0x864f('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x864f('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x864f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x864f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index bb7e03f..772cfd1 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 _0x7880=['CampaignId\x20=\x20?','state','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','status','error','stack','send','map','CmHopperFinal','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','order','sort','filter','merge','where','VIRTUAL','count','include','findAll','catch','show','params','describe','body','uniqueid','find','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','literal','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x7880,0x1f4));var _0x0788=function(_0x2cad63,_0x15a505){_0x2cad63=_0x2cad63-0x0;var _0x2ac69e=_0x7880[_0x2cad63];return _0x2ac69e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0788('0x0'));var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0788('0x6'));var util=require(_0x0788('0x7'));var path=require(_0x0788('0x8'));var sox=require(_0x0788('0x9'));var csv=require(_0x0788('0xa'));var ejs=require(_0x0788('0xb'));var fs=require('fs');var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0xa'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var db=require(_0x0788('0x18'))['db'];function respondWithStatusCode(_0x2d8568,_0x311729){_0x311729=_0x311729||0xcc;return function(_0xce4342){if(_0xce4342){return _0x2d8568[_0x0788('0x19')](_0x311729);}return _0x2d8568['status'](_0x311729)[_0x0788('0x1a')]();};}function respondWithResult(_0x7e3407,_0x3bdcdf){_0x3bdcdf=_0x3bdcdf||0xc8;return function(_0x13cf07){if(_0x13cf07){return _0x7e3407['status'](_0x3bdcdf)[_0x0788('0x1b')](_0x13cf07);}};}function respondWithFilteredResult(_0x4ed024,_0x195f14){return function(_0x170d56){if(_0x170d56){var _0x3fd1e4=_0x170d56['count'],_0xb406fb=_0x195f14['offset'],_0x2ddd1a=_0x195f14[_0x0788('0x1c')]+_0x195f14[_0x0788('0x1d')],_0x430e34;if(_0x2ddd1a>=_0x3fd1e4){_0x2ddd1a=_0x3fd1e4;_0x430e34=0xc8;}else{_0x430e34=0xce;}_0x4ed024['status'](_0x430e34);return _0x4ed024[_0x0788('0x1e')](_0x0788('0x1f'),_0xb406fb+'-'+_0x2ddd1a+'/'+_0x3fd1e4)[_0x0788('0x1b')](_0x170d56);}return null;};}function patchUpdates(_0x52c339){return function(_0x42fe14){try{jsonpatch[_0x0788('0x20')](_0x42fe14,_0x52c339,!![]);}catch(_0x492c2c){return BPromise[_0x0788('0x21')](_0x492c2c);}return _0x42fe14['save']();};}function saveUpdates(_0x7d0869,_0x48bc5f){return function(_0x17cca3){if(_0x17cca3){return _0x17cca3[_0x0788('0x22')](_0x7d0869)[_0x0788('0x23')](function(_0x3cd197){return _0x3cd197;});}return null;};}function removeEntity(_0x3aa142,_0x4f0005){return function(_0x48ec43){if(_0x48ec43){return _0x48ec43[_0x0788('0x24')]()[_0x0788('0x23')](function(){_0x3aa142[_0x0788('0x25')](0xcc)[_0x0788('0x1a')]();});}};}function handleEntityNotFound(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(!_0x79204e){_0x5ba1da[_0x0788('0x19')](0x194);}return _0x79204e;};}function handleError(_0x40309d,_0x50b65c){_0x50b65c=_0x50b65c||0x1f4;return function(_0x4b2693){logger[_0x0788('0x26')](_0x4b2693[_0x0788('0x27')]);if(_0x4b2693['name']){delete _0x4b2693['name'];}_0x40309d[_0x0788('0x25')](_0x50b65c)[_0x0788('0x28')](_0x4b2693);};}exports['index']=function(_0x286730,_0x40e7a6){var _0x467d52={},_0x18fc0e={},_0xf9ba32={'count':0x0,'rows':[]};var _0xb2f4a5=_[_0x0788('0x29')](db[_0x0788('0x2a')]['rawAttributes'],function(_0x5a5178){return{'name':_0x5a5178[_0x0788('0x2b')],'type':_0x5a5178[_0x0788('0x2c')]['key']};});_0x18fc0e['model']=_[_0x0788('0x29')](_0xb2f4a5,_0x0788('0x2d'));_0x18fc0e[_0x0788('0x2e')]=_[_0x0788('0x2f')](_0x286730[_0x0788('0x2e')]);_0x18fc0e[_0x0788('0x30')]=_[_0x0788('0x31')](_0x18fc0e[_0x0788('0x32')],_0x18fc0e[_0x0788('0x2e')]);_0x467d52[_0x0788('0x33')]=_['intersection'](_0x18fc0e[_0x0788('0x32')],qs[_0x0788('0x34')](_0x286730[_0x0788('0x2e')][_0x0788('0x34')]));_0x467d52[_0x0788('0x33')]=_0x467d52[_0x0788('0x33')][_0x0788('0x35')]?_0x467d52[_0x0788('0x33')]:_0x18fc0e[_0x0788('0x32')];if(!_0x286730[_0x0788('0x2e')]['hasOwnProperty']('nolimit')){_0x467d52['limit']=qs['limit'](_0x286730['query']['limit']);_0x467d52[_0x0788('0x1c')]=qs[_0x0788('0x1c')](_0x286730[_0x0788('0x2e')]['offset']);}_0x467d52[_0x0788('0x36')]=qs[_0x0788('0x37')](_0x286730[_0x0788('0x2e')][_0x0788('0x37')]);_0x467d52['where']=qs[_0x0788('0x30')](_['pick'](_0x286730[_0x0788('0x2e')],_0x18fc0e['filters']),_0xb2f4a5);if(_0x286730[_0x0788('0x2e')][_0x0788('0x38')]){_0x467d52['where']=_[_0x0788('0x39')](_0x467d52[_0x0788('0x3a')],{'$or':_['map'](_0xb2f4a5,function(_0x17240e){if(_0x17240e['type']!==_0x0788('0x3b')){var _0x5576c4={};_0x5576c4[_0x17240e[_0x0788('0x2d')]]={'$like':'%'+_0x286730['query'][_0x0788('0x38')]+'%'};return _0x5576c4;}})});}_0x467d52=_['merge']({},_0x467d52,_0x286730['options']);var _0x3e31f8={'where':_0x467d52[_0x0788('0x3a')]};return db[_0x0788('0x2a')][_0x0788('0x3c')](_0x3e31f8)[_0x0788('0x23')](function(_0x53da74){_0xf9ba32['count']=_0x53da74;if(_0x286730['query']['includeAll']){_0x467d52[_0x0788('0x3d')]=[{'all':!![]}];}return db[_0x0788('0x2a')][_0x0788('0x3e')](_0x467d52);})[_0x0788('0x23')](function(_0x362c49){_0xf9ba32['rows']=_0x362c49;return _0xf9ba32;})['then'](respondWithFilteredResult(_0x40e7a6,_0x467d52))[_0x0788('0x3f')](handleError(_0x40e7a6,null));};exports[_0x0788('0x40')]=function(_0x330421,_0x29e09a){var _0x236b63={'raw':!![],'where':{'id':_0x330421[_0x0788('0x41')]['id']}},_0x4316aa={};_0x4316aa[_0x0788('0x32')]=_[_0x0788('0x2f')](db['CmHopperFinal']['rawAttributes']);_0x4316aa[_0x0788('0x2e')]=_[_0x0788('0x2f')](_0x330421[_0x0788('0x2e')]);_0x4316aa['filters']=_['intersection'](_0x4316aa['model'],_0x4316aa[_0x0788('0x2e')]);_0x236b63[_0x0788('0x33')]=_[_0x0788('0x31')](_0x4316aa[_0x0788('0x32')],qs[_0x0788('0x34')](_0x330421[_0x0788('0x2e')][_0x0788('0x34')]));_0x236b63[_0x0788('0x33')]=_0x236b63['attributes'][_0x0788('0x35')]?_0x236b63[_0x0788('0x33')]:_0x4316aa[_0x0788('0x32')];if(_0x330421[_0x0788('0x2e')]['includeAll']){_0x236b63[_0x0788('0x3d')]=[{'all':!![]}];}_0x236b63=_[_0x0788('0x39')]({},_0x236b63,_0x330421['options']);return db['CmHopperFinal']['find'](_0x236b63)[_0x0788('0x23')](handleEntityNotFound(_0x29e09a,null))['then'](respondWithResult(_0x29e09a,null))[_0x0788('0x3f')](handleError(_0x29e09a,null));};exports[_0x0788('0x42')]=function(_0x127ab4,_0x329508){return db[_0x0788('0x2a')][_0x0788('0x42')]()[_0x0788('0x23')](respondWithResult(_0x329508,null))[_0x0788('0x3f')](handleError(_0x329508,null));};exports['update']=function(_0x4c6366,_0x39c3cc){if(_0x4c6366[_0x0788('0x43')][_0x0788('0x44')]){delete _0x4c6366['body'][_0x0788('0x44')];}return db[_0x0788('0x2a')][_0x0788('0x45')]({'where':{'uniqueid':_0x4c6366[_0x0788('0x41')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x39c3cc,null))['then'](saveUpdates(_0x4c6366['body'],null))[_0x0788('0x23')](respondWithResult(_0x39c3cc,null))[_0x0788('0x3f')](handleError(_0x39c3cc,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x2b1479,_0x4a6cde,_0x2103aa){return db[_0x0788('0x2a')][_0x0788('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x2b1479[_0x0788('0x41')]['id']},'attributes':[[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x48')))),_0x0788('0x49')],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x4a')))),_0x0788('0x4b')],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x0788('0x4c')],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x4e')))),_0x0788('0x4f')],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x50')))),_0x0788('0x51')],[db['sequelize']['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x52')))),_0x0788('0x53')],[db['sequelize']['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x0788('0x23')](handleEntityNotFound(_0x4a6cde,null))['then'](respondWithResult(_0x4a6cde,null))[_0x0788('0x3f')](handleError(_0x4a6cde,null));};exports[_0x0788('0x56')]=function(_0x223767,_0x13a021,_0x101e8b){return db[_0x0788('0x2a')][_0x0788('0x3e')]({'raw':![],'where':{'CampaignId':_0x223767[_0x0788('0x41')]['id']},'attributes':[[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db['sequelize']['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x48')))),_0x0788('0x49')],[db['sequelize']['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x4a')))),'noAnswerContacts'],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x57')))),_0x0788('0x4c')],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x4e')))),_0x0788('0x4f')],[db[_0x0788('0x46')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x50')))),'dropContacts'],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db['sequelize']['literal'](_0x0788('0x54')))),'reCallContacts'],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x58')))),_0x0788('0x59')]]})[_0x0788('0x23')](handleEntityNotFound(_0x13a021,null))[_0x0788('0x23')](respondWithResult(_0x13a021,null))[_0x0788('0x3f')](handleError(_0x13a021,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x240210,_0x30248c,_0x52926f){return db['VoiceQueue'][_0x0788('0x45')]({'where':{'id':_0x240210[_0x0788('0x41')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x30248c,null))[_0x0788('0x23')](function(_0x3628d6){var _0x192798;if(_0x3628d6){_0x192798=squel['insert']()[_0x0788('0x5a')](_0x0788('0x5b'))[_0x0788('0x5c')]([_0x0788('0x5d'),'scheduledAt',_0x0788('0x5e'),_0x0788('0x5f'),_0x0788('0x60'),_0x0788('0x61'),'updatedAt'],squel['select']()[_0x0788('0x62')](_0x0788('0x63'),_0x0788('0x5d'))[_0x0788('0x62')](_0x0788('0x64'),_0x0788('0x65'))[_0x0788('0x62')](_0x0788('0x66'),_0x0788('0x5e'))['field'](_0x0788('0x67'),_0x0788('0x5f'))[_0x0788('0x62')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x0788('0x62')]('NOW()',_0x0788('0x61'))[_0x0788('0x62')](_0x0788('0x64'),_0x0788('0x68'))[_0x0788('0x69')](_0x0788('0x6a'))[_0x0788('0x3a')](_0x0788('0x6b'),_0x240210[_0x0788('0x41')]['id']['toString']())[_0x0788('0x3a')](_0x0788('0x6c'),_0x240210[_0x0788('0x43')]['state'][_0x0788('0x6d')]())[_0x0788('0x3a')](_0x0788('0x6e'))['where'](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x5d'))[_0x0788('0x69')](_0x0788('0x5b'))[_0x0788('0x3a')](_0x0788('0x6b'),_0x240210[_0x0788('0x41')]['id']['toString']()))[_0x0788('0x3a')](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x71'))['from'](_0x0788('0x6a'))[_0x0788('0x3a')](_0x0788('0x6b'),_0x240210['params']['id'][_0x0788('0x6d')]())[_0x0788('0x3a')](_0x0788('0x72')))[_0x0788('0x73')](_0x0788('0x5e')))['toString']();return db[_0x0788('0x46')][_0x0788('0x2e')](_0x192798);}return[];})['then'](respondWithResult(_0x30248c,null))[_0x0788('0x3f')](handleError(_0x30248c,null));};exports[_0x0788('0x74')]=function(_0x537a69,_0xc597d7,_0xe14a8e){return db[_0x0788('0x75')]['find']({'where':{'id':_0x537a69[_0x0788('0x41')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0xc597d7,null))[_0x0788('0x23')](function(_0x53730a){var _0xddfb97;if(_0x53730a){_0xddfb97=squel[_0x0788('0x76')]()[_0x0788('0x5a')](_0x0788('0x5b'))[_0x0788('0x5c')]([_0x0788('0x5d'),_0x0788('0x65'),_0x0788('0x5e'),'ListId',_0x0788('0x77'),_0x0788('0x61'),_0x0788('0x68')],squel[_0x0788('0x70')]()['field']('ANY_VALUE(calleridnum)',_0x0788('0x5d'))[_0x0788('0x62')]('NOW()',_0x0788('0x65'))[_0x0788('0x62')](_0x0788('0x66'),'ContactId')['field'](_0x0788('0x67'),_0x0788('0x5f'))['field']('ANY_VALUE(CampaignId)','CampaignId')[_0x0788('0x62')](_0x0788('0x64'),'createdAt')[_0x0788('0x62')](_0x0788('0x64'),_0x0788('0x68'))[_0x0788('0x69')](_0x0788('0x6a'))['where'](_0x0788('0x78'),_0x537a69['params']['id'][_0x0788('0x6d')]())['where'](_0x0788('0x6c'),_0x537a69[_0x0788('0x43')][_0x0788('0x79')][_0x0788('0x6d')]())[_0x0788('0x3a')](_0x0788('0x6e'))[_0x0788('0x3a')](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x5d'))[_0x0788('0x69')](_0x0788('0x5b'))['where']('CampaignId\x20=\x20?',_0x537a69['params']['id'][_0x0788('0x6d')]()))[_0x0788('0x3a')](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x71'))[_0x0788('0x69')](_0x0788('0x6a'))[_0x0788('0x3a')](_0x0788('0x78'),_0x537a69[_0x0788('0x41')]['id']['toString']())['where'](_0x0788('0x72')))[_0x0788('0x73')](_0x0788('0x5e')))[_0x0788('0x6d')]();return db[_0x0788('0x46')][_0x0788('0x2e')](_0xddfb97);}return[];})[_0x0788('0x23')](respondWithResult(_0xc597d7,null))[_0x0788('0x3f')](handleError(_0xc597d7,null));};exports['checkContactHopper']=function(_0x48b82c,_0x3b5c80,_0x22e770){return db[_0x0788('0x7a')][_0x0788('0x7b')]({'where':{'VoiceQueueId':_0x48b82c[_0x0788('0x43')][_0x0788('0x60')],'CampaignId':_0x48b82c['body'][_0x0788('0x77')],'ContactId':_0x48b82c[_0x0788('0x43')][_0x0788('0x5e')]}})[_0x0788('0x23')](handleEntityNotFound(_0x3b5c80,null))[_0x0788('0x23')](function(_0x1191e7){if(_0x1191e7){return _0x1191e7;}return null;})[_0x0788('0x23')](respondWithResult(_0x3b5c80,null))[_0x0788('0x3f')](handleError(_0x3b5c80,null));}; \ No newline at end of file +var _0x7880=['state','calleridnum\x20NOT\x20IN\x20(?)','toString','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','select','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperFinal','type','key','keys','filters','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','rawAttributes','intersection','length','describe','uniqueid','body','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?'];(function(_0xc52550,_0x53feb1){var _0x30605b=function(_0x2fcdf8){while(--_0x2fcdf8){_0xc52550['push'](_0xc52550['shift']());}};_0x30605b(++_0x53feb1);}(_0x7880,0x10f));var _0x0788=function(_0x21c3ac,_0x2a46bb){_0x21c3ac=_0x21c3ac-0x0;var _0x3c45ad=_0x7880[_0x21c3ac];return _0x3c45ad;};'use strict';var pdf=require(_0x0788('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require('path');var sox=require(_0x0788('0x7'));var csv=require(_0x0788('0x8'));var ejs=require(_0x0788('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0788('0xa'));var crypto=require(_0x0788('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0788('0xc'));var toCsv=require(_0x0788('0x8'));var querystring=require(_0x0788('0xd'));var Papa=require(_0x0788('0xe'));var Redis=require(_0x0788('0xf'));var authService=require(_0x0788('0x10'));var qs=require(_0x0788('0x11'));var as=require(_0x0788('0x12'));var hardwareService=require(_0x0788('0x13'));var logger=require(_0x0788('0x14'))(_0x0788('0x15'));var utils=require('../../config/utils');var config=require(_0x0788('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x423e99,_0x9d3024){_0x9d3024=_0x9d3024||0xcc;return function(_0x107260){if(_0x107260){return _0x423e99[_0x0788('0x17')](_0x9d3024);}return _0x423e99[_0x0788('0x18')](_0x9d3024)['end']();};}function respondWithResult(_0x2c4682,_0x4b379e){_0x4b379e=_0x4b379e||0xc8;return function(_0x3efcc8){if(_0x3efcc8){return _0x2c4682['status'](_0x4b379e)['json'](_0x3efcc8);}};}function respondWithFilteredResult(_0x1fedd1,_0x8a7e08){return function(_0x32eae1){if(_0x32eae1){var _0x57a803=_0x32eae1[_0x0788('0x19')],_0x12553c=_0x8a7e08[_0x0788('0x1a')],_0x2d68b0=_0x8a7e08[_0x0788('0x1a')]+_0x8a7e08['limit'],_0x57ac4e;if(_0x2d68b0>=_0x57a803){_0x2d68b0=_0x57a803;_0x57ac4e=0xc8;}else{_0x57ac4e=0xce;}_0x1fedd1['status'](_0x57ac4e);return _0x1fedd1[_0x0788('0x1b')](_0x0788('0x1c'),_0x12553c+'-'+_0x2d68b0+'/'+_0x57a803)['json'](_0x32eae1);}return null;};}function patchUpdates(_0x3f0de9){return function(_0x3e0ad7){try{jsonpatch[_0x0788('0x1d')](_0x3e0ad7,_0x3f0de9,!![]);}catch(_0xd5e0a6){return BPromise[_0x0788('0x1e')](_0xd5e0a6);}return _0x3e0ad7[_0x0788('0x1f')]();};}function saveUpdates(_0x364d7e,_0x3e383b){return function(_0x494a02){if(_0x494a02){return _0x494a02[_0x0788('0x20')](_0x364d7e)[_0x0788('0x21')](function(_0x12aa6a){return _0x12aa6a;});}return null;};}function removeEntity(_0x3f1de2,_0x2444fc){return function(_0x467856){if(_0x467856){return _0x467856[_0x0788('0x22')]()['then'](function(){_0x3f1de2[_0x0788('0x18')](0xcc)[_0x0788('0x23')]();});}};}function handleEntityNotFound(_0x2525f7,_0xefb51d){return function(_0x5e27a5){if(!_0x5e27a5){_0x2525f7['sendStatus'](0x194);}return _0x5e27a5;};}function handleError(_0x2820e4,_0x40bbaf){_0x40bbaf=_0x40bbaf||0x1f4;return function(_0x4cfd91){logger[_0x0788('0x24')](_0x4cfd91[_0x0788('0x25')]);if(_0x4cfd91['name']){delete _0x4cfd91[_0x0788('0x26')];}_0x2820e4[_0x0788('0x18')](_0x40bbaf)[_0x0788('0x27')](_0x4cfd91);};}exports[_0x0788('0x28')]=function(_0x4bfc25,_0x2c3cd0){var _0x5eed61={},_0x497af4={},_0xcd2266={'count':0x0,'rows':[]};var _0xf8d02f=_[_0x0788('0x29')](db[_0x0788('0x2a')]['rawAttributes'],function(_0x54878c){return{'name':_0x54878c['fieldName'],'type':_0x54878c[_0x0788('0x2b')][_0x0788('0x2c')]};});_0x497af4['model']=_[_0x0788('0x29')](_0xf8d02f,_0x0788('0x26'));_0x497af4['query']=_[_0x0788('0x2d')](_0x4bfc25['query']);_0x497af4[_0x0788('0x2e')]=_['intersection'](_0x497af4[_0x0788('0x2f')],_0x497af4[_0x0788('0x30')]);_0x5eed61[_0x0788('0x31')]=_['intersection'](_0x497af4['model'],qs[_0x0788('0x32')](_0x4bfc25[_0x0788('0x30')][_0x0788('0x32')]));_0x5eed61['attributes']=_0x5eed61[_0x0788('0x31')]['length']?_0x5eed61[_0x0788('0x31')]:_0x497af4[_0x0788('0x2f')];if(!_0x4bfc25[_0x0788('0x30')][_0x0788('0x33')](_0x0788('0x34'))){_0x5eed61[_0x0788('0x35')]=qs['limit'](_0x4bfc25[_0x0788('0x30')][_0x0788('0x35')]);_0x5eed61[_0x0788('0x1a')]=qs[_0x0788('0x1a')](_0x4bfc25[_0x0788('0x30')][_0x0788('0x1a')]);}_0x5eed61[_0x0788('0x36')]=qs[_0x0788('0x37')](_0x4bfc25[_0x0788('0x30')][_0x0788('0x37')]);_0x5eed61[_0x0788('0x38')]=qs['filters'](_[_0x0788('0x39')](_0x4bfc25[_0x0788('0x30')],_0x497af4[_0x0788('0x2e')]),_0xf8d02f);if(_0x4bfc25[_0x0788('0x30')][_0x0788('0x3a')]){_0x5eed61[_0x0788('0x38')]=_['merge'](_0x5eed61[_0x0788('0x38')],{'$or':_['map'](_0xf8d02f,function(_0x377ba1){if(_0x377ba1[_0x0788('0x2b')]!==_0x0788('0x3b')){var _0x4fbbfd={};_0x4fbbfd[_0x377ba1[_0x0788('0x26')]]={'$like':'%'+_0x4bfc25[_0x0788('0x30')]['filter']+'%'};return _0x4fbbfd;}})});}_0x5eed61=_[_0x0788('0x3c')]({},_0x5eed61,_0x4bfc25[_0x0788('0x3d')]);var _0x72750f={'where':_0x5eed61[_0x0788('0x38')]};return db[_0x0788('0x2a')][_0x0788('0x19')](_0x72750f)[_0x0788('0x21')](function(_0xd13e15){_0xcd2266['count']=_0xd13e15;if(_0x4bfc25[_0x0788('0x30')][_0x0788('0x3e')]){_0x5eed61[_0x0788('0x3f')]=[{'all':!![]}];}return db[_0x0788('0x2a')]['findAll'](_0x5eed61);})[_0x0788('0x21')](function(_0x2c0319){_0xcd2266[_0x0788('0x40')]=_0x2c0319;return _0xcd2266;})[_0x0788('0x21')](respondWithFilteredResult(_0x2c3cd0,_0x5eed61))[_0x0788('0x41')](handleError(_0x2c3cd0,null));};exports['show']=function(_0x281b07,_0x5cbc08){var _0x45f948={'raw':!![],'where':{'id':_0x281b07['params']['id']}},_0x4e0206={};_0x4e0206['model']=_[_0x0788('0x2d')](db[_0x0788('0x2a')][_0x0788('0x42')]);_0x4e0206[_0x0788('0x30')]=_[_0x0788('0x2d')](_0x281b07[_0x0788('0x30')]);_0x4e0206[_0x0788('0x2e')]=_[_0x0788('0x43')](_0x4e0206[_0x0788('0x2f')],_0x4e0206[_0x0788('0x30')]);_0x45f948[_0x0788('0x31')]=_[_0x0788('0x43')](_0x4e0206[_0x0788('0x2f')],qs[_0x0788('0x32')](_0x281b07[_0x0788('0x30')][_0x0788('0x32')]));_0x45f948[_0x0788('0x31')]=_0x45f948[_0x0788('0x31')][_0x0788('0x44')]?_0x45f948[_0x0788('0x31')]:_0x4e0206[_0x0788('0x2f')];if(_0x281b07['query'][_0x0788('0x3e')]){_0x45f948[_0x0788('0x3f')]=[{'all':!![]}];}_0x45f948=_[_0x0788('0x3c')]({},_0x45f948,_0x281b07[_0x0788('0x3d')]);return db['CmHopperFinal']['find'](_0x45f948)[_0x0788('0x21')](handleEntityNotFound(_0x5cbc08,null))[_0x0788('0x21')](respondWithResult(_0x5cbc08,null))[_0x0788('0x41')](handleError(_0x5cbc08,null));};exports[_0x0788('0x45')]=function(_0x166c16,_0x39a636){return db[_0x0788('0x2a')][_0x0788('0x45')]()['then'](respondWithResult(_0x39a636,null))[_0x0788('0x41')](handleError(_0x39a636,null));};exports[_0x0788('0x20')]=function(_0x31a409,_0x58ea4a){if(_0x31a409['body'][_0x0788('0x46')]){delete _0x31a409[_0x0788('0x47')][_0x0788('0x46')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x31a409[_0x0788('0x48')]['id']}})[_0x0788('0x21')](handleEntityNotFound(_0x58ea4a,null))[_0x0788('0x21')](saveUpdates(_0x31a409[_0x0788('0x47')],null))[_0x0788('0x21')](respondWithResult(_0x58ea4a,null))['catch'](handleError(_0x58ea4a,null));};exports[_0x0788('0x49')]=function(_0x4d217c,_0x2c12b3,_0x1d64ec){return db[_0x0788('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x4d217c['params']['id']},'attributes':[[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db['sequelize']['fn']('IF',db[_0x0788('0x4a')]['literal'](_0x0788('0x4c')))),_0x0788('0x4d')],[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db['sequelize']['fn']('IF',db[_0x0788('0x4a')][_0x0788('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x0788('0x4f')],[db[_0x0788('0x4a')]['fn']('COUNT',db[_0x0788('0x4a')]['fn']('IF',db[_0x0788('0x4a')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db['sequelize']['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db[_0x0788('0x4a')]['literal'](_0x0788('0x50')))),'congestionContacts'],[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db[_0x0788('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0788('0x51')],[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db[_0x0788('0x4a')][_0x0788('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0788('0x52')],[db['sequelize']['fn']('COUNT',db[_0x0788('0x4a')]['fn']('IF',db['sequelize'][_0x0788('0x4e')](_0x0788('0x53')))),_0x0788('0x54')],[db['sequelize']['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db['sequelize'][_0x0788('0x4e')](_0x0788('0x55')))),_0x0788('0x56')]]})[_0x0788('0x21')](handleEntityNotFound(_0x2c12b3,null))[_0x0788('0x21')](respondWithResult(_0x2c12b3,null))[_0x0788('0x41')](handleError(_0x2c12b3,null));};exports[_0x0788('0x57')]=function(_0x3859cf,_0x349440,_0x1d2695){return db[_0x0788('0x2a')][_0x0788('0x58')]({'raw':![],'where':{'CampaignId':_0x3859cf[_0x0788('0x48')]['id']},'attributes':[[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x0788('0x4c')))),_0x0788('0x4d')],[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db[_0x0788('0x4a')][_0x0788('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x0788('0x4f')],[db[_0x0788('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0788('0x4a')][_0x0788('0x4e')](_0x0788('0x59')))),_0x0788('0x5a')],[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db[_0x0788('0x4a')][_0x0788('0x4e')](_0x0788('0x50')))),_0x0788('0x5b')],[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db[_0x0788('0x4a')][_0x0788('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0788('0x51')],[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db['sequelize'][_0x0788('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0788('0x52')],[db['sequelize']['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db[_0x0788('0x4a')]['literal'](_0x0788('0x53')))),_0x0788('0x54')],[db[_0x0788('0x4a')]['fn'](_0x0788('0x4b'),db[_0x0788('0x4a')]['fn']('IF',db[_0x0788('0x4a')][_0x0788('0x4e')](_0x0788('0x55')))),'answeringMachine']]})[_0x0788('0x21')](handleEntityNotFound(_0x349440,null))[_0x0788('0x21')](respondWithResult(_0x349440,null))[_0x0788('0x41')](handleError(_0x349440,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x46c9b8,_0x4ac48f,_0x477a8a){return db[_0x0788('0x5c')][_0x0788('0x5d')]({'where':{'id':_0x46c9b8[_0x0788('0x48')]['id']}})[_0x0788('0x21')](handleEntityNotFound(_0x4ac48f,null))[_0x0788('0x21')](function(_0x37f57a){var _0x31faa4;if(_0x37f57a){_0x31faa4=squel[_0x0788('0x5e')]()['into'](_0x0788('0x5f'))[_0x0788('0x60')]([_0x0788('0x61'),'scheduledAt','ContactId',_0x0788('0x62'),_0x0788('0x63'),_0x0788('0x64'),_0x0788('0x65')],squel['select']()[_0x0788('0x66')](_0x0788('0x67'),_0x0788('0x61'))[_0x0788('0x66')]('NOW()',_0x0788('0x68'))[_0x0788('0x66')](_0x0788('0x69'),_0x0788('0x6a'))['field'](_0x0788('0x6b'),_0x0788('0x62'))[_0x0788('0x66')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x0788('0x66')](_0x0788('0x6c'),_0x0788('0x64'))['field'](_0x0788('0x6c'),'updatedAt')[_0x0788('0x6d')](_0x0788('0x6e'))[_0x0788('0x38')](_0x0788('0x6f'),_0x46c9b8[_0x0788('0x48')]['id']['toString']())['where'](_0x0788('0x70'),_0x46c9b8[_0x0788('0x47')][_0x0788('0x71')]['toString']())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x0788('0x38')](_0x0788('0x72'),squel['select']()[_0x0788('0x66')](_0x0788('0x61'))[_0x0788('0x6d')](_0x0788('0x5f'))[_0x0788('0x38')](_0x0788('0x6f'),_0x46c9b8['params']['id'][_0x0788('0x73')]()))[_0x0788('0x38')](_0x0788('0x72'),squel['select']()[_0x0788('0x66')]('calleridnum')[_0x0788('0x6d')](_0x0788('0x6e'))['where']('VoiceQueueId\x20=\x20?',_0x46c9b8[_0x0788('0x48')]['id'][_0x0788('0x73')]())['where'](_0x0788('0x74')))[_0x0788('0x75')](_0x0788('0x6a')))[_0x0788('0x73')]();return db[_0x0788('0x4a')]['query'](_0x31faa4);}return[];})['then'](respondWithResult(_0x4ac48f,null))[_0x0788('0x41')](handleError(_0x4ac48f,null));};exports[_0x0788('0x76')]=function(_0x307666,_0x187e03,_0x1ad272){return db[_0x0788('0x77')][_0x0788('0x5d')]({'where':{'id':_0x307666[_0x0788('0x48')]['id']}})[_0x0788('0x21')](handleEntityNotFound(_0x187e03,null))[_0x0788('0x21')](function(_0x5b130f){var _0x387f5c;if(_0x5b130f){_0x387f5c=squel[_0x0788('0x5e')]()[_0x0788('0x78')]('cm_hopper')[_0x0788('0x60')]([_0x0788('0x61'),_0x0788('0x68'),_0x0788('0x6a'),_0x0788('0x62'),_0x0788('0x79'),'createdAt',_0x0788('0x65')],squel[_0x0788('0x7a')]()[_0x0788('0x66')](_0x0788('0x67'),_0x0788('0x61'))[_0x0788('0x66')](_0x0788('0x6c'),_0x0788('0x68'))[_0x0788('0x66')](_0x0788('0x69'),_0x0788('0x6a'))['field'](_0x0788('0x6b'),'ListId')[_0x0788('0x66')](_0x0788('0x7b'),_0x0788('0x79'))['field'](_0x0788('0x6c'),'createdAt')[_0x0788('0x66')](_0x0788('0x6c'),_0x0788('0x65'))['from']('cm_hopper_final')[_0x0788('0x38')](_0x0788('0x7c'),_0x307666['params']['id']['toString']())['where'](_0x0788('0x70'),_0x307666[_0x0788('0x47')][_0x0788('0x71')][_0x0788('0x73')]())[_0x0788('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x0788('0x38')](_0x0788('0x72'),squel[_0x0788('0x7a')]()[_0x0788('0x66')](_0x0788('0x61'))[_0x0788('0x6d')]('cm_hopper')[_0x0788('0x38')](_0x0788('0x7c'),_0x307666[_0x0788('0x48')]['id'][_0x0788('0x73')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x0788('0x7a')]()['field'](_0x0788('0x7d'))[_0x0788('0x6d')](_0x0788('0x6e'))[_0x0788('0x38')](_0x0788('0x7c'),_0x307666[_0x0788('0x48')]['id'][_0x0788('0x73')]())[_0x0788('0x38')](_0x0788('0x74')))[_0x0788('0x75')](_0x0788('0x6a')))[_0x0788('0x73')]();return db[_0x0788('0x4a')][_0x0788('0x30')](_0x387f5c);}return[];})[_0x0788('0x21')](respondWithResult(_0x187e03,null))['catch'](handleError(_0x187e03,null));};exports['checkContactHopper']=function(_0x3b5f18,_0x8fb858,_0x826fad){return db[_0x0788('0x7e')][_0x0788('0x7f')]({'where':{'VoiceQueueId':_0x3b5f18[_0x0788('0x47')][_0x0788('0x63')],'CampaignId':_0x3b5f18[_0x0788('0x47')]['CampaignId'],'ContactId':_0x3b5f18[_0x0788('0x47')][_0x0788('0x6a')]}})[_0x0788('0x21')](handleEntityNotFound(_0x8fb858,null))[_0x0788('0x21')](function(_0x5754bb){if(_0x5754bb){return _0x5754bb;}return null;})[_0x0788('0x21')](respondWithResult(_0x8fb858,null))['catch'](handleError(_0x8fb858,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index f1d2e66..183cf40 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 _0xf874=['cm_hopper_final','calleridnum','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define'];(function(_0x5f019e,_0x5b7d59){var _0x5a980b=function(_0x120aa9){while(--_0x120aa9){_0x5f019e['push'](_0x5f019e['shift']());}};_0x5a980b(++_0x5b7d59);}(_0xf874,0xed));var _0x4f87=function(_0x11225d,_0x3d68ad){_0x11225d=_0x11225d-0x0;var _0x266c57=_0xf874[_0x11225d];return _0x266c57;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f87('0x0'))(_0x4f87('0x1'));var moment=require(_0x4f87('0x2'));var BPromise=require(_0x4f87('0x3'));var rp=require(_0x4f87('0x4'));var fs=require('fs');var path=require(_0x4f87('0x5'));var rimraf=require('rimraf');var config=require(_0x4f87('0x6'));var attributes=require(_0x4f87('0x7'));module[_0x4f87('0x8')]=function(_0xf0ffb3,_0x104682){return _0xf0ffb3[_0x4f87('0x9')]('CmHopperFinal',attributes,{'tableName':_0x4f87('0xa'),'paranoid':![],'indexes':[{'name':_0x4f87('0xb'),'fields':['calleridnum']},{'name':_0x4f87('0xc'),'fields':[_0x4f87('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa73a=['api','moment','bluebird','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger'];(function(_0x95f477,_0x147d31){var _0x558c53=function(_0x4d5213){while(--_0x4d5213){_0x95f477['push'](_0x95f477['shift']());}};_0x558c53(++_0x147d31);}(_0xa73a,0x82));var _0xaa73=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0xa73a[_0x3d9176];return _0x12adc5;};'use strict';var _=require('lodash');var util=require(_0xaa73('0x0'));var logger=require(_0xaa73('0x1'))(_0xaa73('0x2'));var moment=require(_0xaa73('0x3'));var BPromise=require(_0xaa73('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa73('0x5'));var attributes=require(_0xaa73('0x6'));module[_0xaa73('0x7')]=function(_0x15d1c6,_0xf84c2e){return _0x15d1c6[_0xaa73('0x8')](_0xaa73('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xaa73('0xa')]},{'name':_0xaa73('0xb'),'fields':[_0xaa73('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 e954082..07a1e8d 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 _0x6b76=['create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','catch','CreateCmHopperFinal','CmHopperFinal'];(function(_0x1984b9,_0x28cc6e){var _0x3949ca=function(_0x2c4b69){while(--_0x2c4b69){_0x1984b9['push'](_0x1984b9['shift']());}};_0x3949ca(++_0x28cc6e);}(_0x6b76,0xa5));var _0x66b7=function(_0x4369f2,_0x2b7fe6){_0x4369f2=_0x4369f2-0x0;var _0x102739=_0x6b76[_0x4369f2];return _0x102739;};'use strict';var _=require(_0x66b7('0x0'));var util=require('util');var moment=require(_0x66b7('0x1'));var BPromise=require(_0x66b7('0x2'));var rs=require(_0x66b7('0x3'));var fs=require('fs');var Redis=require(_0x66b7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x66b7('0x5'));var logger=require(_0x66b7('0x6'))(_0x66b7('0x7'));var config=require(_0x66b7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x66b7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a2a77,_0x132ac0,_0x5931d7){return new BPromise(function(_0x265780,_0x39ca87){return client[_0x66b7('0xa')](_0x2a2a77,_0x5931d7)[_0x66b7('0xb')](function(_0x4944e1){logger[_0x66b7('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x132ac0,_0x66b7('0xd'));logger[_0x66b7('0xe')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x132ac0,_0x66b7('0xd'),JSON[_0x66b7('0xf')](_0x4944e1));if(_0x4944e1[_0x66b7('0x10')]){if(_0x4944e1[_0x66b7('0x10')][_0x66b7('0x11')]===0x1f4){logger[_0x66b7('0x10')](_0x66b7('0x12'),_0x132ac0,_0x4944e1[_0x66b7('0x10')][_0x66b7('0x13')]);return _0x39ca87(_0x4944e1[_0x66b7('0x10')]['message']);}logger[_0x66b7('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x132ac0,_0x4944e1[_0x66b7('0x10')][_0x66b7('0x13')]);return _0x265780(_0x4944e1[_0x66b7('0x10')][_0x66b7('0x13')]);}else{logger[_0x66b7('0xc')](_0x66b7('0x12'),_0x132ac0,_0x66b7('0xd'));_0x265780(_0x4944e1[_0x66b7('0x14')][_0x66b7('0x13')]);}})[_0x66b7('0x15')](function(_0x1e12f2){logger['error'](_0x66b7('0x12'),_0x132ac0,_0x1e12f2);_0x39ca87(_0x1e12f2);});});}exports[_0x66b7('0x16')]=function(_0x41fc88){var _0x36c2b8=this;return new Promise(function(_0x500490,_0x3b661b){return db[_0x66b7('0x17')][_0x66b7('0x18')](_0x41fc88['body'],{'raw':_0x41fc88[_0x66b7('0x19')]?_0x41fc88[_0x66b7('0x19')][_0x66b7('0x1a')]===undefined?!![]:![]:!![]})[_0x66b7('0xb')](function(_0x5dd4c4){logger[_0x66b7('0xc')](_0x66b7('0x16'),_0x41fc88);logger['debug'](_0x66b7('0x16'),_0x41fc88,JSON[_0x66b7('0xf')](_0x5dd4c4));_0x500490(_0x5dd4c4);})[_0x66b7('0x15')](function(_0x3e14f9){logger[_0x66b7('0x10')](_0x66b7('0x16'),_0x3e14f9[_0x66b7('0x13')],_0x41fc88);_0x3b661b(_0x36c2b8[_0x66b7('0x10')](0x1f4,_0x3e14f9[_0x66b7('0x13')]));});});}; \ No newline at end of file +var _0x56e6=['request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CmHopperFinal','options','raw','CreateCmHopperFinal','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x36a5c2,_0x1674d5){var _0x4692e9=function(_0x1877e5){while(--_0x1877e5){_0x36a5c2['push'](_0x36a5c2['shift']());}};_0x4692e9(++_0x1674d5);}(_0x56e6,0x6b));var _0x656e=function(_0x424cc2,_0x521786){_0x424cc2=_0x424cc2-0x0;var _0x5aaef4=_0x56e6[_0x424cc2];return _0x5aaef4;};'use strict';var _=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var moment=require(_0x656e('0x2'));var BPromise=require(_0x656e('0x3'));var rs=require(_0x656e('0x4'));var fs=require('fs');var Redis=require(_0x656e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x656e('0x6'));var logger=require(_0x656e('0x7'))(_0x656e('0x8'));var config=require(_0x656e('0x9'));var jayson=require(_0x656e('0xa'));var client=jayson[_0x656e('0xb')][_0x656e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54eddb,_0x35d629,_0x1538a5){return new BPromise(function(_0x1dad4e,_0x2fc011){return client[_0x656e('0xd')](_0x54eddb,_0x1538a5)[_0x656e('0xe')](function(_0x30d78c){logger[_0x656e('0xf')](_0x656e('0x10'),_0x35d629,_0x656e('0x11'));logger[_0x656e('0x12')](_0x656e('0x13'),_0x35d629,_0x656e('0x11'),JSON[_0x656e('0x14')](_0x30d78c));if(_0x30d78c['error']){if(_0x30d78c['error'][_0x656e('0x15')]===0x1f4){logger[_0x656e('0x16')](_0x656e('0x10'),_0x35d629,_0x30d78c[_0x656e('0x16')]['message']);return _0x2fc011(_0x30d78c['error'][_0x656e('0x17')]);}logger[_0x656e('0x16')]('CmHopperFinal,\x20%s,\x20%s',_0x35d629,_0x30d78c[_0x656e('0x16')]['message']);return _0x1dad4e(_0x30d78c[_0x656e('0x16')][_0x656e('0x17')]);}else{logger[_0x656e('0xf')](_0x656e('0x10'),_0x35d629,'request\x20sent');_0x1dad4e(_0x30d78c[_0x656e('0x18')][_0x656e('0x17')]);}})[_0x656e('0x19')](function(_0x3a6cf8){logger[_0x656e('0x16')]('CmHopperFinal,\x20%s,\x20%s',_0x35d629,_0x3a6cf8);_0x2fc011(_0x3a6cf8);});});}exports['CreateCmHopperFinal']=function(_0x526b83){var _0x4318d1=this;return new Promise(function(_0x1b0fdd,_0x577deb){return db[_0x656e('0x1a')]['create'](_0x526b83['body'],{'raw':_0x526b83['options']?_0x526b83[_0x656e('0x1b')][_0x656e('0x1c')]===undefined?!![]:![]:!![]})[_0x656e('0xe')](function(_0x141587){logger['info'](_0x656e('0x1d'),_0x526b83);logger[_0x656e('0x12')](_0x656e('0x1d'),_0x526b83,JSON['stringify'](_0x141587));_0x1b0fdd(_0x141587);})[_0x656e('0x19')](function(_0x1acca5){logger[_0x656e('0x16')](_0x656e('0x1d'),_0x1acca5[_0x656e('0x17')],_0x526b83);_0x577deb(_0x4318d1[_0x656e('0x16')](0x1f4,_0x1acca5[_0x656e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 649a658..6bf711a 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 _0x3701=['moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','put','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id'];(function(_0x3b0de,_0x2513d4){var _0x4277f1=function(_0x37bf59){while(--_0x37bf59){_0x3b0de['push'](_0x3b0de['shift']());}};_0x4277f1(++_0x2513d4);}(_0x3701,0xb4));var _0x1370=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3701[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1370('0x0'));var util=require(_0x1370('0x1'));var path=require(_0x1370('0x2'));var timeout=require(_0x1370('0x3'));var express=require(_0x1370('0x4'));var router=express['Router']();var auth=require(_0x1370('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1370('0x6'));var controller=require(_0x1370('0x7'));router[_0x1370('0x8')]('/',auth[_0x1370('0x9')](),controller['index']);router[_0x1370('0x8')](_0x1370('0xa'),auth[_0x1370('0x9')](),controller[_0x1370('0xb')]);router['get'](_0x1370('0xc'),auth[_0x1370('0x9')](),controller['show']);router['get'](_0x1370('0xd'),auth[_0x1370('0x9')](),controller[_0x1370('0xe')]);router['get'](_0x1370('0xf'),auth[_0x1370('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x1370('0x10')](_0x1370('0x11'),auth[_0x1370('0x9')](),controller[_0x1370('0x12')]);router[_0x1370('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x1370('0x9')](),controller[_0x1370('0x13')]);router[_0x1370('0x10')]('/checkContactHopper',auth[_0x1370('0x9')](),controller['checkContactHopper']);router[_0x1370('0x14')](_0x1370('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x1370('0x15')]=router; \ No newline at end of file +var _0xabb5=['put','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xabb5,0x179));var _0x5abb=function(_0x54776d,_0x19b575){_0x54776d=_0x54776d-0x0;var _0x2c0d6d=_0xabb5[_0x54776d];return _0x2c0d6d;};'use strict';var multer=require(_0x5abb('0x0'));var util=require(_0x5abb('0x1'));var path=require(_0x5abb('0x2'));var timeout=require(_0x5abb('0x3'));var express=require(_0x5abb('0x4'));var router=express[_0x5abb('0x5')]();var auth=require(_0x5abb('0x6'));var interaction=require(_0x5abb('0x7'));var config=require(_0x5abb('0x8'));var controller=require(_0x5abb('0x9'));router[_0x5abb('0xa')]('/',auth[_0x5abb('0xb')](),controller[_0x5abb('0xc')]);router[_0x5abb('0xa')](_0x5abb('0xd'),auth[_0x5abb('0xb')](),controller[_0x5abb('0xe')]);router[_0x5abb('0xa')](_0x5abb('0xf'),auth[_0x5abb('0xb')](),controller[_0x5abb('0x10')]);router[_0x5abb('0xa')]('/voice/queue/countAttributes/:id',auth[_0x5abb('0xb')](),controller[_0x5abb('0x11')]);router[_0x5abb('0xa')]('/campaign/countAttributes/:id',auth[_0x5abb('0xb')](),controller[_0x5abb('0x12')]);router[_0x5abb('0x13')]('/voice/queue/moveContacts/:id',auth[_0x5abb('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x5abb('0x13')](_0x5abb('0x14'),auth[_0x5abb('0xb')](),controller[_0x5abb('0x15')]);router[_0x5abb('0x13')]('/checkContactHopper',auth[_0x5abb('0xb')](),controller[_0x5abb('0x16')]);router[_0x5abb('0x17')](_0x5abb('0xf'),auth[_0x5abb('0xb')](),controller['update']);module[_0x5abb('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 5b68764..900e390 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 _0x28c6=['DATE','BOOLEAN','exports','STRING','INTEGER'];(function(_0x585caa,_0x2b459e){var _0x2c7dc6=function(_0x5a590b){while(--_0x5a590b){_0x585caa['push'](_0x585caa['shift']());}};_0x2c7dc6(++_0x2b459e);}(_0x28c6,0x147));var _0x628c=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x28c6[_0x2f9467];return _0x39894c;};'use strict';var Sequelize=require('sequelize');module[_0x628c('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x628c('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x628c('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x628c('0x1')]},'originatecalleridname':{'type':Sequelize[_0x628c('0x1')]},'calleridnum':{'type':Sequelize[_0x628c('0x1')]},'calleridname':{'type':Sequelize[_0x628c('0x1')]},'starttime':{'type':Sequelize[_0x628c('0x3')]},'responsetime':{'type':Sequelize[_0x628c('0x3')]},'answertime':{'type':Sequelize[_0x628c('0x3')]},'droptime':{'type':Sequelize[_0x628c('0x3')]},'endtime':{'type':Sequelize[_0x628c('0x3')]},'ringtime':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x628c('0x1')]},'campaign':{'type':Sequelize[_0x628c('0x1')]},'campaigntype':{'type':Sequelize[_0x628c('0x1')]},'membername':{'type':Sequelize[_0x628c('0x1')]},'reason':{'type':Sequelize[_0x628c('0x1')]},'amd':{'type':Sequelize[_0x628c('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x628c('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x628c('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x628c('0x3')]},'recallme':{'type':Sequelize[_0x628c('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x628c('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x628c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x628c('0x1')]}}; \ No newline at end of file +var _0x675e=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x434903,_0x2bae84){var _0x31021e=function(_0x176a5f){while(--_0x176a5f){_0x434903['push'](_0x434903['shift']());}};_0x31021e(++_0x2bae84);}(_0x675e,0x17a));var _0xe675=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0x675e[_0x53c4f8];return _0x416458;};'use strict';var Sequelize=require(_0xe675('0x0'));module['exports']={'state':{'type':Sequelize[_0xe675('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe675('0x2')]},'scheduledat':{'type':Sequelize[_0xe675('0x3')]},'countbusyretry':{'type':Sequelize[_0xe675('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe675('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe675('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe675('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe675('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xe675('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe675('0x2')]},'calleridname':{'type':Sequelize[_0xe675('0x2')]},'starttime':{'type':Sequelize[_0xe675('0x3')]},'responsetime':{'type':Sequelize[_0xe675('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe675('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe675('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe675('0x2')]},'membername':{'type':Sequelize[_0xe675('0x2')]},'reason':{'type':Sequelize[_0xe675('0x2')]},'amd':{'type':Sequelize[_0xe675('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe675('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe675('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe675('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe675('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xe675('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe675('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe675('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe675('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe675('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 50cf86b..5306b25 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 _0x0089=['path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','apply','reject','save','then','destroy','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','include','find','create','describe','update','body','uniqueid','rimraf','zip-dir','fast-json-patch','mustache','util'];(function(_0x1482d9,_0x267672){var _0x4383b4=function(_0x302db1){while(--_0x302db1){_0x1482d9['push'](_0x1482d9['shift']());}};_0x4383b4(++_0x267672);}(_0x0089,0x14f));var _0x9008=function(_0x36b9cb,_0x5a9a26){_0x36b9cb=_0x36b9cb-0x0;var _0x1d94e3=_0x0089[_0x36b9cb];return _0x1d94e3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9008('0x0'));var zipdir=require(_0x9008('0x1'));var jsonpatch=require(_0x9008('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9008('0x3'));var util=require(_0x9008('0x4'));var path=require(_0x9008('0x5'));var sox=require('sox');var csv=require(_0x9008('0x6'));var ejs=require(_0x9008('0x7'));var fs=require('fs');var _=require(_0x9008('0x8'));var squel=require(_0x9008('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9008('0x6'));var querystring=require(_0x9008('0xa'));var Papa=require(_0x9008('0xb'));var Redis=require(_0x9008('0xc'));var authService=require(_0x9008('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9008('0xe'));var logger=require(_0x9008('0xf'))('api');var utils=require(_0x9008('0x10'));var config=require(_0x9008('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x587e45,_0xa280d1){_0xa280d1=_0xa280d1||0xcc;return function(_0x1382eb){if(_0x1382eb){return _0x587e45[_0x9008('0x12')](_0xa280d1);}return _0x587e45[_0x9008('0x13')](_0xa280d1)[_0x9008('0x14')]();};}function respondWithResult(_0x1baee9,_0x492283){_0x492283=_0x492283||0xc8;return function(_0x3a2cce){if(_0x3a2cce){return _0x1baee9['status'](_0x492283)[_0x9008('0x15')](_0x3a2cce);}};}function respondWithFilteredResult(_0x1f4ebf,_0x212a3d){return function(_0x3f7d94){if(_0x3f7d94){var _0xee3088=_0x3f7d94['count'],_0xb618ab=_0x212a3d[_0x9008('0x16')],_0x42e1d7=_0x212a3d[_0x9008('0x16')]+_0x212a3d[_0x9008('0x17')],_0x3e5586;if(_0x42e1d7>=_0xee3088){_0x42e1d7=_0xee3088;_0x3e5586=0xc8;}else{_0x3e5586=0xce;}_0x1f4ebf[_0x9008('0x13')](_0x3e5586);return _0x1f4ebf[_0x9008('0x18')]('Content-Range',_0xb618ab+'-'+_0x42e1d7+'/'+_0xee3088)[_0x9008('0x15')](_0x3f7d94);}return null;};}function patchUpdates(_0x4c1f53){return function(_0x563153){try{jsonpatch[_0x9008('0x19')](_0x563153,_0x4c1f53,!![]);}catch(_0x17fa6e){return BPromise[_0x9008('0x1a')](_0x17fa6e);}return _0x563153[_0x9008('0x1b')]();};}function saveUpdates(_0x26b5ce,_0x539392){return function(_0x5bfe0b){if(_0x5bfe0b){return _0x5bfe0b['update'](_0x26b5ce)[_0x9008('0x1c')](function(_0xfd770){return _0xfd770;});}return null;};}function removeEntity(_0x597eb7,_0x3355b8){return function(_0x397eed){if(_0x397eed){return _0x397eed[_0x9008('0x1d')]()[_0x9008('0x1c')](function(){_0x597eb7[_0x9008('0x13')](0xcc)[_0x9008('0x14')]();});}};}function handleEntityNotFound(_0x1e24da,_0x4416d3){return function(_0x32cae1){if(!_0x32cae1){_0x1e24da[_0x9008('0x12')](0x194);}return _0x32cae1;};}function handleError(_0x285bc8,_0x400238){_0x400238=_0x400238||0x1f4;return function(_0x1d875c){logger['error'](_0x1d875c['stack']);if(_0x1d875c[_0x9008('0x1e')]){delete _0x1d875c[_0x9008('0x1e')];}_0x285bc8[_0x9008('0x13')](_0x400238)[_0x9008('0x1f')](_0x1d875c);};}exports['index']=function(_0x368a73,_0x1dfabf){var _0x5bfd04={},_0x54e98d={},_0x39eb68={'count':0x0,'rows':[]};var _0x1b8b0d=_[_0x9008('0x20')](db[_0x9008('0x21')][_0x9008('0x22')],function(_0x5b9363){return{'name':_0x5b9363[_0x9008('0x23')],'type':_0x5b9363[_0x9008('0x24')]['key']};});_0x54e98d['model']=_[_0x9008('0x20')](_0x1b8b0d,'name');_0x54e98d[_0x9008('0x25')]=_[_0x9008('0x26')](_0x368a73[_0x9008('0x25')]);_0x54e98d[_0x9008('0x27')]=_[_0x9008('0x28')](_0x54e98d[_0x9008('0x29')],_0x54e98d['query']);_0x5bfd04['attributes']=_['intersection'](_0x54e98d[_0x9008('0x29')],qs[_0x9008('0x2a')](_0x368a73[_0x9008('0x25')][_0x9008('0x2a')]));_0x5bfd04['attributes']=_0x5bfd04['attributes'][_0x9008('0x2b')]?_0x5bfd04[_0x9008('0x2c')]:_0x54e98d[_0x9008('0x29')];if(!_0x368a73['query'][_0x9008('0x2d')](_0x9008('0x2e'))){_0x5bfd04['limit']=qs['limit'](_0x368a73[_0x9008('0x25')]['limit']);_0x5bfd04[_0x9008('0x16')]=qs[_0x9008('0x16')](_0x368a73[_0x9008('0x25')][_0x9008('0x16')]);}_0x5bfd04[_0x9008('0x2f')]=qs[_0x9008('0x30')](_0x368a73[_0x9008('0x25')]['sort']);_0x5bfd04[_0x9008('0x31')]=qs[_0x9008('0x27')](_[_0x9008('0x32')](_0x368a73[_0x9008('0x25')],_0x54e98d[_0x9008('0x27')]),_0x1b8b0d);if(_0x368a73[_0x9008('0x25')][_0x9008('0x33')]){_0x5bfd04[_0x9008('0x31')]=_[_0x9008('0x34')](_0x5bfd04[_0x9008('0x31')],{'$or':_[_0x9008('0x20')](_0x1b8b0d,function(_0x28a201){if(_0x28a201[_0x9008('0x24')]!==_0x9008('0x35')){var _0x20e6d4={};_0x20e6d4[_0x28a201[_0x9008('0x1e')]]={'$like':'%'+_0x368a73['query']['filter']+'%'};return _0x20e6d4;}})});}_0x5bfd04=_['merge']({},_0x5bfd04,_0x368a73[_0x9008('0x36')]);var _0x1d8b1c={'where':_0x5bfd04[_0x9008('0x31')]};return db[_0x9008('0x21')][_0x9008('0x37')](_0x1d8b1c)[_0x9008('0x1c')](function(_0x525b51){_0x39eb68[_0x9008('0x37')]=_0x525b51;if(_0x368a73['query'][_0x9008('0x38')]){_0x5bfd04['include']=[{'all':!![]}];}return db[_0x9008('0x21')][_0x9008('0x39')](_0x5bfd04);})['then'](function(_0x51851){_0x39eb68[_0x9008('0x3a')]=_0x51851;return _0x39eb68;})[_0x9008('0x1c')](respondWithFilteredResult(_0x1dfabf,_0x5bfd04))[_0x9008('0x3b')](handleError(_0x1dfabf,null));};exports['show']=function(_0x34d7f7,_0x50ce21){var _0x575871={'raw':!![],'where':{'id':_0x34d7f7[_0x9008('0x3c')]['id']}},_0x4de5ff={};_0x4de5ff[_0x9008('0x29')]=_[_0x9008('0x26')](db['CmHopperHistory'][_0x9008('0x22')]);_0x4de5ff[_0x9008('0x25')]=_[_0x9008('0x26')](_0x34d7f7[_0x9008('0x25')]);_0x4de5ff[_0x9008('0x27')]=_[_0x9008('0x28')](_0x4de5ff[_0x9008('0x29')],_0x4de5ff[_0x9008('0x25')]);_0x575871[_0x9008('0x2c')]=_[_0x9008('0x28')](_0x4de5ff[_0x9008('0x29')],qs['fields'](_0x34d7f7[_0x9008('0x25')]['fields']));_0x575871['attributes']=_0x575871[_0x9008('0x2c')][_0x9008('0x2b')]?_0x575871[_0x9008('0x2c')]:_0x4de5ff[_0x9008('0x29')];if(_0x34d7f7[_0x9008('0x25')][_0x9008('0x38')]){_0x575871[_0x9008('0x3d')]=[{'all':!![]}];}_0x575871=_[_0x9008('0x34')]({},_0x575871,_0x34d7f7[_0x9008('0x36')]);return db[_0x9008('0x21')][_0x9008('0x3e')](_0x575871)[_0x9008('0x1c')](handleEntityNotFound(_0x50ce21,null))[_0x9008('0x1c')](respondWithResult(_0x50ce21,null))[_0x9008('0x3b')](handleError(_0x50ce21,null));};exports[_0x9008('0x3f')]=function(_0x4559bc,_0x3fdffc){return db[_0x9008('0x21')]['create'](_0x4559bc['body'],{})[_0x9008('0x1c')](respondWithResult(_0x3fdffc,0xc9))[_0x9008('0x3b')](handleError(_0x3fdffc,null));};exports[_0x9008('0x40')]=function(_0x36b958,_0x54c7f6){return db[_0x9008('0x21')]['describe']()['then'](respondWithResult(_0x54c7f6,null))[_0x9008('0x3b')](handleError(_0x54c7f6,null));};exports[_0x9008('0x41')]=function(_0x59eb22,_0x263635){if(_0x59eb22[_0x9008('0x42')][_0x9008('0x43')]){delete _0x59eb22[_0x9008('0x42')][_0x9008('0x43')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x59eb22[_0x9008('0x3c')]['id']}})['then'](handleEntityNotFound(_0x263635,null))['then'](saveUpdates(_0x59eb22[_0x9008('0x42')],null))[_0x9008('0x1c')](respondWithResult(_0x263635,null))[_0x9008('0x3b')](handleError(_0x263635,null));}; \ No newline at end of file +var _0x62d7=['find','create','describe','body','uniqueid','html-pdf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params'];(function(_0x6aaf7a,_0x2ddf35){var _0x522e20=function(_0x5b6e19){while(--_0x5b6e19){_0x6aaf7a['push'](_0x6aaf7a['shift']());}};_0x522e20(++_0x2ddf35);}(_0x62d7,0x172));var _0x762d=function(_0xe7a2e7,_0xd8f8c5){_0xe7a2e7=_0xe7a2e7-0x0;var _0x1b4096=_0x62d7[_0xe7a2e7];return _0x1b4096;};'use strict';var pdf=require(_0x762d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x762d('0x1'));var jsonpatch=require(_0x762d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x762d('0x3'));var Mustache=require('mustache');var util=require(_0x762d('0x4'));var path=require(_0x762d('0x5'));var sox=require(_0x762d('0x6'));var csv=require(_0x762d('0x7'));var ejs=require(_0x762d('0x8'));var fs=require('fs');var _=require(_0x762d('0x9'));var squel=require(_0x762d('0xa'));var crypto=require(_0x762d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x762d('0xc'));var toCsv=require(_0x762d('0x7'));var querystring=require(_0x762d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x762d('0xe'));var qs=require(_0x762d('0xf'));var as=require(_0x762d('0x10'));var hardwareService=require(_0x762d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x762d('0x12'));var config=require(_0x762d('0x13'));var db=require(_0x762d('0x14'))['db'];function respondWithStatusCode(_0x3f6258,_0x16cfe9){_0x16cfe9=_0x16cfe9||0xcc;return function(_0x49232a){if(_0x49232a){return _0x3f6258[_0x762d('0x15')](_0x16cfe9);}return _0x3f6258[_0x762d('0x16')](_0x16cfe9)[_0x762d('0x17')]();};}function respondWithResult(_0x272f48,_0x19ab68){_0x19ab68=_0x19ab68||0xc8;return function(_0x253d78){if(_0x253d78){return _0x272f48[_0x762d('0x16')](_0x19ab68)[_0x762d('0x18')](_0x253d78);}};}function respondWithFilteredResult(_0x4330c6,_0x1eda39){return function(_0x37b5ba){if(_0x37b5ba){var _0x5dca41=_0x37b5ba[_0x762d('0x19')],_0x33de9e=_0x1eda39[_0x762d('0x1a')],_0x15fdaf=_0x1eda39[_0x762d('0x1a')]+_0x1eda39[_0x762d('0x1b')],_0x497073;if(_0x15fdaf>=_0x5dca41){_0x15fdaf=_0x5dca41;_0x497073=0xc8;}else{_0x497073=0xce;}_0x4330c6['status'](_0x497073);return _0x4330c6[_0x762d('0x1c')](_0x762d('0x1d'),_0x33de9e+'-'+_0x15fdaf+'/'+_0x5dca41)[_0x762d('0x18')](_0x37b5ba);}return null;};}function patchUpdates(_0x4136f1){return function(_0xa1a276){try{jsonpatch[_0x762d('0x1e')](_0xa1a276,_0x4136f1,!![]);}catch(_0x479bf3){return BPromise[_0x762d('0x1f')](_0x479bf3);}return _0xa1a276['save']();};}function saveUpdates(_0x576e30,_0x268bc5){return function(_0x59574d){if(_0x59574d){return _0x59574d[_0x762d('0x20')](_0x576e30)[_0x762d('0x21')](function(_0x47659b){return _0x47659b;});}return null;};}function removeEntity(_0x4338f1,_0xb044a1){return function(_0x598cab){if(_0x598cab){return _0x598cab[_0x762d('0x22')]()[_0x762d('0x21')](function(){_0x4338f1[_0x762d('0x16')](0xcc)[_0x762d('0x17')]();});}};}function handleEntityNotFound(_0x48d6ea,_0x295f39){return function(_0x57a7e1){if(!_0x57a7e1){_0x48d6ea[_0x762d('0x15')](0x194);}return _0x57a7e1;};}function handleError(_0x40e2ed,_0x2e0330){_0x2e0330=_0x2e0330||0x1f4;return function(_0x2e4467){logger[_0x762d('0x23')](_0x2e4467[_0x762d('0x24')]);if(_0x2e4467['name']){delete _0x2e4467['name'];}_0x40e2ed['status'](_0x2e0330)[_0x762d('0x25')](_0x2e4467);};}exports[_0x762d('0x26')]=function(_0xdd98a1,_0x3030dc){var _0x3a7a6c={},_0x242ecf={},_0x387648={'count':0x0,'rows':[]};var _0x4e35c6=_[_0x762d('0x27')](db[_0x762d('0x28')][_0x762d('0x29')],function(_0xbe2f5e){return{'name':_0xbe2f5e[_0x762d('0x2a')],'type':_0xbe2f5e[_0x762d('0x2b')][_0x762d('0x2c')]};});_0x242ecf[_0x762d('0x2d')]=_[_0x762d('0x27')](_0x4e35c6,'name');_0x242ecf[_0x762d('0x2e')]=_[_0x762d('0x2f')](_0xdd98a1['query']);_0x242ecf[_0x762d('0x30')]=_[_0x762d('0x31')](_0x242ecf[_0x762d('0x2d')],_0x242ecf[_0x762d('0x2e')]);_0x3a7a6c['attributes']=_[_0x762d('0x31')](_0x242ecf[_0x762d('0x2d')],qs[_0x762d('0x32')](_0xdd98a1['query']['fields']));_0x3a7a6c['attributes']=_0x3a7a6c[_0x762d('0x33')][_0x762d('0x34')]?_0x3a7a6c[_0x762d('0x33')]:_0x242ecf[_0x762d('0x2d')];if(!_0xdd98a1[_0x762d('0x2e')][_0x762d('0x35')](_0x762d('0x36'))){_0x3a7a6c[_0x762d('0x1b')]=qs[_0x762d('0x1b')](_0xdd98a1[_0x762d('0x2e')][_0x762d('0x1b')]);_0x3a7a6c['offset']=qs[_0x762d('0x1a')](_0xdd98a1[_0x762d('0x2e')][_0x762d('0x1a')]);}_0x3a7a6c['order']=qs[_0x762d('0x37')](_0xdd98a1[_0x762d('0x2e')][_0x762d('0x37')]);_0x3a7a6c[_0x762d('0x38')]=qs[_0x762d('0x30')](_[_0x762d('0x39')](_0xdd98a1[_0x762d('0x2e')],_0x242ecf[_0x762d('0x30')]),_0x4e35c6);if(_0xdd98a1[_0x762d('0x2e')]['filter']){_0x3a7a6c['where']=_[_0x762d('0x3a')](_0x3a7a6c[_0x762d('0x38')],{'$or':_[_0x762d('0x27')](_0x4e35c6,function(_0x4bb3c8){if(_0x4bb3c8['type']!==_0x762d('0x3b')){var _0x59e52c={};_0x59e52c[_0x4bb3c8['name']]={'$like':'%'+_0xdd98a1[_0x762d('0x2e')][_0x762d('0x3c')]+'%'};return _0x59e52c;}})});}_0x3a7a6c=_[_0x762d('0x3a')]({},_0x3a7a6c,_0xdd98a1[_0x762d('0x3d')]);var _0x420355={'where':_0x3a7a6c[_0x762d('0x38')]};return db['CmHopperHistory'][_0x762d('0x19')](_0x420355)[_0x762d('0x21')](function(_0x3e0447){_0x387648[_0x762d('0x19')]=_0x3e0447;if(_0xdd98a1[_0x762d('0x2e')][_0x762d('0x3e')]){_0x3a7a6c[_0x762d('0x3f')]=[{'all':!![]}];}return db[_0x762d('0x28')][_0x762d('0x40')](_0x3a7a6c);})[_0x762d('0x21')](function(_0xf04429){_0x387648['rows']=_0xf04429;return _0x387648;})[_0x762d('0x21')](respondWithFilteredResult(_0x3030dc,_0x3a7a6c))[_0x762d('0x41')](handleError(_0x3030dc,null));};exports[_0x762d('0x42')]=function(_0x332a9d,_0x2c848d){var _0x54995c={'raw':!![],'where':{'id':_0x332a9d[_0x762d('0x43')]['id']}},_0x183bc0={};_0x183bc0['model']=_[_0x762d('0x2f')](db[_0x762d('0x28')][_0x762d('0x29')]);_0x183bc0[_0x762d('0x2e')]=_['keys'](_0x332a9d['query']);_0x183bc0['filters']=_[_0x762d('0x31')](_0x183bc0[_0x762d('0x2d')],_0x183bc0[_0x762d('0x2e')]);_0x54995c[_0x762d('0x33')]=_[_0x762d('0x31')](_0x183bc0['model'],qs[_0x762d('0x32')](_0x332a9d[_0x762d('0x2e')]['fields']));_0x54995c[_0x762d('0x33')]=_0x54995c[_0x762d('0x33')][_0x762d('0x34')]?_0x54995c[_0x762d('0x33')]:_0x183bc0[_0x762d('0x2d')];if(_0x332a9d[_0x762d('0x2e')][_0x762d('0x3e')]){_0x54995c[_0x762d('0x3f')]=[{'all':!![]}];}_0x54995c=_[_0x762d('0x3a')]({},_0x54995c,_0x332a9d[_0x762d('0x3d')]);return db['CmHopperHistory'][_0x762d('0x44')](_0x54995c)['then'](handleEntityNotFound(_0x2c848d,null))[_0x762d('0x21')](respondWithResult(_0x2c848d,null))['catch'](handleError(_0x2c848d,null));};exports[_0x762d('0x45')]=function(_0x5c3243,_0x3c95a0){return db[_0x762d('0x28')]['create'](_0x5c3243['body'],{})[_0x762d('0x21')](respondWithResult(_0x3c95a0,0xc9))[_0x762d('0x41')](handleError(_0x3c95a0,null));};exports['describe']=function(_0x50f2a6,_0x17bc1c){return db[_0x762d('0x28')][_0x762d('0x46')]()[_0x762d('0x21')](respondWithResult(_0x17bc1c,null))[_0x762d('0x41')](handleError(_0x17bc1c,null));};exports['update']=function(_0x23c02b,_0x25284f){if(_0x23c02b[_0x762d('0x47')]['uniqueid']){delete _0x23c02b[_0x762d('0x47')][_0x762d('0x48')];}return db[_0x762d('0x28')][_0x762d('0x44')]({'where':{'uniqueid':_0x23c02b[_0x762d('0x43')]['id']}})[_0x762d('0x21')](handleEntityNotFound(_0x25284f,null))[_0x762d('0x21')](saveUpdates(_0x23c02b['body'],null))[_0x762d('0x21')](respondWithResult(_0x25284f,null))[_0x762d('0x41')](handleError(_0x25284f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 405b8a1..297c552 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 _0x65c6=['endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','define','cm_hopper_history'];(function(_0x1b28a1,_0x29c65e){var _0x36c1be=function(_0x4ac8cb){while(--_0x4ac8cb){_0x1b28a1['push'](_0x1b28a1['shift']());}};_0x36c1be(++_0x29c65e);}(_0x65c6,0x198));var _0x665c=function(_0x1f1402,_0x498b4b){_0x1f1402=_0x1f1402-0x0;var _0x53759a=_0x65c6[_0x1f1402];return _0x53759a;};'use strict';var _=require(_0x665c('0x0'));var util=require(_0x665c('0x1'));var logger=require(_0x665c('0x2'))(_0x665c('0x3'));var moment=require(_0x665c('0x4'));var BPromise=require(_0x665c('0x5'));var rp=require(_0x665c('0x6'));var fs=require('fs');var path=require(_0x665c('0x7'));var rimraf=require(_0x665c('0x8'));var config=require('../../config/environment');var attributes=require(_0x665c('0x9'));module['exports']=function(_0x549c82,_0x257d1f){return _0x549c82[_0x665c('0xa')]('CmHopperHistory',attributes,{'tableName':_0x665c('0xb'),'paranoid':![],'indexes':[{'name':_0x665c('0xc'),'fields':[_0x665c('0xc')]},{'name':_0x665c('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e61=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory'];(function(_0x149ac2,_0x5d0c52){var _0x17470d=function(_0x322a7e){while(--_0x322a7e){_0x149ac2['push'](_0x149ac2['shift']());}};_0x17470d(++_0x5d0c52);}(_0x0e61,0x137));var _0x10e6=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0x0e61[_0x4c3070];return _0x536a44;};'use strict';var _=require(_0x10e6('0x0'));var util=require(_0x10e6('0x1'));var logger=require(_0x10e6('0x2'))(_0x10e6('0x3'));var moment=require('moment');var BPromise=require(_0x10e6('0x4'));var rp=require(_0x10e6('0x5'));var fs=require('fs');var path=require(_0x10e6('0x6'));var rimraf=require(_0x10e6('0x7'));var config=require(_0x10e6('0x8'));var attributes=require(_0x10e6('0x9'));module['exports']=function(_0x13a570,_0x3c78f8){return _0x13a570['define'](_0x10e6('0xa'),attributes,{'tableName':_0x10e6('0xb'),'paranoid':![],'indexes':[{'name':_0x10e6('0xc'),'fields':[_0x10e6('0xc')]},{'name':_0x10e6('0xd'),'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 a216944..76c27f1 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 _0xd64b=['`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','name','col','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','then','debug','AvgHandleTime','findAll','raw','where','sequelize','literal','predictiveIntervalAnsweredCalls','COUNT','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay'];(function(_0x480df8,_0x2d8f90){var _0x3dc854=function(_0x1ce48c){while(--_0x1ce48c){_0x480df8['push'](_0x480df8['shift']());}};_0x3dc854(++_0x2d8f90);}(_0xd64b,0xc1));var _0xbd64=function(_0x5777ff,_0x41bcaf){_0x5777ff=_0x5777ff-0x0;var _0x147704=_0xd64b[_0x5777ff];return _0x147704;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var moment=require(_0xbd64('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd64('0x2'));var fs=require('fs');var Redis=require(_0xbd64('0x3'));var db=require(_0xbd64('0x4'))['db'];var utils=require(_0xbd64('0x5'));var logger=require(_0xbd64('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32995f,_0x3e700e,_0x38204e){return new BPromise(function(_0x3f1f17,_0x2b8543){return client[_0xbd64('0x8')](_0x32995f,_0x38204e)['then'](function(_0x5ae70c){logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));logger['debug'](_0xbd64('0xc'),_0x3e700e,_0xbd64('0xb'),JSON[_0xbd64('0xd')](_0x5ae70c));if(_0x5ae70c[_0xbd64('0xe')]){if(_0x5ae70c['error'][_0xbd64('0xf')]===0x1f4){logger['error'](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x2b8543(_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);}logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x3f1f17(_0x5ae70c['error'][_0xbd64('0x10')]);}else{logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));_0x3f1f17(_0x5ae70c[_0xbd64('0x11')]['message']);}})[_0xbd64('0x12')](function(_0x5332e0){logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5332e0);_0x2b8543(_0x5332e0);});});}exports[_0xbd64('0x13')]=function(_0x1d7a14){var _0x17d015=this;return new Promise(function(_0x2f4554,_0xa5491d){return db[_0xbd64('0x14')]['create'](_0x1d7a14[_0xbd64('0x15')],{'raw':_0x1d7a14[_0xbd64('0x16')]?_0x1d7a14['options']['raw']===undefined?!![]:![]:!![]})[_0xbd64('0x17')](function(_0x42b328){logger[_0xbd64('0x9')](_0xbd64('0x13'),_0x1d7a14);logger[_0xbd64('0x18')](_0xbd64('0x13'),_0x1d7a14,JSON['stringify'](_0x42b328));_0x2f4554(_0x42b328);})['catch'](function(_0x6038f){logger[_0xbd64('0xe')](_0xbd64('0x13'),_0x6038f[_0xbd64('0x10')],_0x1d7a14);_0xa5491d(_0x17d015['error'](0x1f4,_0x6038f['message']));});});};exports[_0xbd64('0x19')]=function(_0x4afaff){var _0x46ab38=this;return new Promise(function(_0x5b356b,_0x33452d){return db[_0xbd64('0x14')][_0xbd64('0x1a')]({'raw':_0x4afaff[_0xbd64('0x16')]?_0x4afaff['options'][_0xbd64('0x1b')]===undefined?!![]:![]:!![],'where':_0x4afaff[_0xbd64('0x16')]?_0x4afaff[_0xbd64('0x16')][_0xbd64('0x1c')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xbd64('0x1d')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xbd64('0x1d')]['fn']('COUNT',db[_0xbd64('0x1d')]['fn']('IF',db['sequelize'][_0xbd64('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xbd64('0x1f')],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')]('`state`\x20=\x2010,\x201,\x20null'))),_0xbd64('0x21')],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xbd64('0x1d')]['fn']('AVG',db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xbd64('0x22')],[db['sequelize']['fn']('AVG',db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xbd64('0x23')]]})['then'](function(_0x1fc9cf){logger[_0xbd64('0x9')](_0xbd64('0x19'),_0x4afaff);logger[_0xbd64('0x18')](_0xbd64('0x19'),_0x4afaff,JSON[_0xbd64('0xd')](_0x1fc9cf));_0x5b356b(_0x1fc9cf);})['catch'](function(_0x4d870e){logger[_0xbd64('0xe')](_0xbd64('0x19'),_0x4d870e[_0xbd64('0x10')],_0x4afaff);_0x33452d(_0x46ab38[_0xbd64('0xe')](0x1f4,_0x4d870e[_0xbd64('0x10')]));});});};exports[_0xbd64('0x24')]=function(_0x54784f){var _0x5a74a9=this;return new Promise(function(_0x1db1fa,_0x1bcd4c){return db[_0xbd64('0x14')]['findAll']({'raw':_0x54784f['options']?_0x54784f[_0xbd64('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x54784f[_0xbd64('0x16')]?_0x54784f['options'][_0xbd64('0x1c')]||null:null,'attributes':[[_0xbd64('0x25'),'name'],[db[_0xbd64('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')](_0xbd64('0x26')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')]['literal'](_0xbd64('0x27')))),_0xbd64('0x28')],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xbd64('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')](_0xbd64('0x29')))),_0xbd64('0x2a')],[db[_0xbd64('0x1d')]['fn']('COUNT',db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')]['literal'](_0xbd64('0x2b')))),_0xbd64('0x2c')],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xbd64('0x2d')],[db['sequelize']['fn'](_0xbd64('0x20'),db['sequelize']['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')](_0xbd64('0x2e')))),'outboundDropCallsDayCallersExit'],[db[_0xbd64('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xbd64('0x1e')](_0xbd64('0x2f')))),_0xbd64('0x30')],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')]['literal'](_0xbd64('0x31')))),_0xbd64('0x32')],[db[_0xbd64('0x1d')]['fn']('COUNT',db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')](_0xbd64('0x33')))),_0xbd64('0x34')],[db['sequelize']['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')](_0xbd64('0x35')))),_0xbd64('0x36')],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')](_0xbd64('0x37')))),_0xbd64('0x38')],[db[_0xbd64('0x1d')]['fn']('COUNT',db[_0xbd64('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0xbd64('0x25')]})[_0xbd64('0x17')](function(_0x5480f5){logger[_0xbd64('0x9')](_0xbd64('0x24'),_0x54784f);logger[_0xbd64('0x18')]('GetVoiceQueueHopperHistory',_0x54784f,JSON[_0xbd64('0xd')](_0x5480f5));_0x1db1fa(_0x5480f5);})[_0xbd64('0x12')](function(_0x44cd4f){logger[_0xbd64('0xe')](_0xbd64('0x24'),_0x44cd4f[_0xbd64('0x10')],_0x54784f);_0x1bcd4c(_0x5a74a9['error'](0x1f4,_0x44cd4f['message']));});});};exports['GetCampaignHopperHistory']=function(_0x11c50e){var _0x15c0de=this;return new Promise(function(_0x3548fe,_0x958272){return db['CmHopperHistory'][_0xbd64('0x1a')]({'raw':_0x11c50e[_0xbd64('0x16')]?_0x11c50e[_0xbd64('0x16')][_0xbd64('0x1b')]===undefined?!![]:![]:!![],'where':_0x11c50e[_0xbd64('0x16')]?_0x11c50e[_0xbd64('0x16')]['where']||null:null,'attributes':[[_0xbd64('0x25'),_0xbd64('0x39')],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')][_0xbd64('0x3a')]('id')),_0xbd64('0x3b')],[db[_0xbd64('0x1d')]['fn'](_0xbd64('0x20'),db[_0xbd64('0x1d')]['fn']('IF',db[_0xbd64('0x1d')][_0xbd64('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xbd64('0x25')]})[_0xbd64('0x17')](function(_0x5ab7b3){logger['info'](_0xbd64('0x3c'),_0x11c50e);logger[_0xbd64('0x18')]('GetCampaignHopperHistory',_0x11c50e,JSON[_0xbd64('0xd')](_0x5ab7b3));_0x3548fe(_0x5ab7b3);})[_0xbd64('0x12')](function(_0x45573c){logger[_0xbd64('0xe')](_0xbd64('0x3c'),_0x45573c[_0xbd64('0x10')],_0x11c50e);_0x958272(_0x15c0de[_0xbd64('0xe')](0x1f4,_0x45573c[_0xbd64('0x10')]));});});}; \ No newline at end of file +var _0x6f7a=['outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','request\x20sent','result','catch','CmHopperHistory','body','options','raw','CreateCmHopperHistory','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x13d603,_0x46f391){var _0x47a4c3=function(_0x2c76ed){while(--_0x2c76ed){_0x13d603['push'](_0x13d603['shift']());}};_0x47a4c3(++_0x46f391);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x246107,_0x1bf721){_0x246107=_0x246107-0x0;var _0x1a1662=_0x6f7a[_0x246107];return _0x1a1662;};'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')]('CmHopperHistory,\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['CreateCmHopperHistory']=function(_0x4a8827){var _0xba7755=this;return new Promise(function(_0x5298ba,_0x378967){return db[_0xa6f7('0x1a')]['create'](_0x4a8827[_0xa6f7('0x1b')],{'raw':_0x4a8827[_0xa6f7('0x1c')]?_0x4a8827[_0xa6f7('0x1c')][_0xa6f7('0x1d')]===undefined?!![]:![]:!![]})[_0xa6f7('0xe')](function(_0x1aa8dc){logger['info'](_0xa6f7('0x1e'),_0x4a8827);logger[_0xa6f7('0x10')]('CreateCmHopperHistory',_0x4a8827,JSON['stringify'](_0x1aa8dc));_0x5298ba(_0x1aa8dc);})['catch'](function(_0x1de6c9){logger[_0xa6f7('0x13')]('CreateCmHopperHistory',_0x1de6c9['message'],_0x4a8827);_0x378967(_0xba7755['error'](0x1f4,_0x1de6c9[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x1f')]=function(_0x28263e){var _0x5baaa9=this;return new Promise(function(_0x484874,_0x2f4907){return db['CmHopperHistory']['findAll']({'raw':_0x28263e[_0xa6f7('0x1c')]?_0x28263e['options'][_0xa6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x28263e[_0xa6f7('0x1c')]?_0x28263e[_0xa6f7('0x1c')][_0xa6f7('0x20')]||null:null,'attributes':[[db[_0xa6f7('0x21')]['fn']('COUNT',db['sequelize'][_0xa6f7('0x22')]('id')),_0xa6f7('0x23')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x26')))),_0xa6f7('0x27')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x29'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0xa6f7('0x21')]['fn']('AVG',db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x2a')))),_0xa6f7('0x2b')]]})[_0xa6f7('0xe')](function(_0x4d2d38){logger[_0xa6f7('0xf')](_0xa6f7('0x1f'),_0x28263e);logger[_0xa6f7('0x10')]('AvgHandleTime',_0x28263e,JSON[_0xa6f7('0x12')](_0x4d2d38));_0x484874(_0x4d2d38);})['catch'](function(_0x1170c4){logger[_0xa6f7('0x13')](_0xa6f7('0x1f'),_0x1170c4['message'],_0x28263e);_0x2f4907(_0x5baaa9[_0xa6f7('0x13')](0x1f4,_0x1170c4[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x2c')]=function(_0x37b833){var _0x14444c=this;return new Promise(function(_0x28490e,_0x4a28a7){return db[_0xa6f7('0x1a')][_0xa6f7('0x2d')]({'raw':_0x37b833[_0xa6f7('0x1c')]?_0x37b833[_0xa6f7('0x1c')][_0xa6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x37b833[_0xa6f7('0x1c')]?_0x37b833[_0xa6f7('0x1c')][_0xa6f7('0x20')]||null:null,'attributes':[['campaign',_0xa6f7('0x2e')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x200,\x201,\x20null'))),_0xa6f7('0x2f')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x30')))),_0xa6f7('0x31')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x26')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x32')))),_0xa6f7('0x33')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x34')))),_0xa6f7('0x35')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa6f7('0x36')],[db['sequelize']['fn']('COUNT',db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x37')))),_0xa6f7('0x38')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa6f7('0x39')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x3a')))),_0xa6f7('0x3b')],[db[_0xa6f7('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x3c')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x3d')))),_0xa6f7('0x3e')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db['sequelize'][_0xa6f7('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0xa6f7('0x3f')],[db['sequelize']['fn']('COUNT',db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x40')))),_0xa6f7('0x3e')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db['sequelize'][_0xa6f7('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xa6f7('0x41')]],'group':[_0xa6f7('0x42')]})[_0xa6f7('0xe')](function(_0x55369a){logger[_0xa6f7('0xf')]('GetVoiceQueueHopperHistory',_0x37b833);logger[_0xa6f7('0x10')](_0xa6f7('0x2c'),_0x37b833,JSON[_0xa6f7('0x12')](_0x55369a));_0x28490e(_0x55369a);})[_0xa6f7('0x19')](function(_0xa6bff9){logger['error']('GetVoiceQueueHopperHistory',_0xa6bff9[_0xa6f7('0x16')],_0x37b833);_0x4a28a7(_0x14444c[_0xa6f7('0x13')](0x1f4,_0xa6bff9[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x43')]=function(_0x5931e9){var _0x9d901e=this;return new Promise(function(_0x2105dd,_0x14d841){return db[_0xa6f7('0x1a')][_0xa6f7('0x2d')]({'raw':_0x5931e9[_0xa6f7('0x1c')]?_0x5931e9['options'][_0xa6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x5931e9[_0xa6f7('0x1c')]?_0x5931e9[_0xa6f7('0x1c')]['where']||null:null,'attributes':[[_0xa6f7('0x42'),_0xa6f7('0x2e')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['col']('id')),_0xa6f7('0x44')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x26')))),'ivrAnswerCallsDay']],'group':[_0xa6f7('0x42')]})[_0xa6f7('0xe')](function(_0x2f131c){logger[_0xa6f7('0xf')](_0xa6f7('0x43'),_0x5931e9);logger[_0xa6f7('0x10')](_0xa6f7('0x43'),_0x5931e9,JSON[_0xa6f7('0x12')](_0x2f131c));_0x2105dd(_0x2f131c);})[_0xa6f7('0x19')](function(_0x186956){logger[_0xa6f7('0x13')]('GetCampaignHopperHistory',_0x186956[_0xa6f7('0x16')],_0x5931e9);_0x14d841(_0x9d901e['error'](0x1f4,_0x186956[_0xa6f7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 098707d..b74e8df 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 _0x0b70=['show','post','create','put','update','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x44b533,_0x221c8d){var _0x42325b=function(_0x309350){while(--_0x309350){_0x44b533['push'](_0x44b533['shift']());}};_0x42325b(++_0x221c8d);}(_0x0b70,0x159));var _0x00b7=function(_0x528885,_0x620238){_0x528885=_0x528885-0x0;var _0x472e4d=_0x0b70[_0x528885];return _0x472e4d;};'use strict';var multer=require('multer');var util=require(_0x00b7('0x0'));var path=require('path');var timeout=require(_0x00b7('0x1'));var express=require(_0x00b7('0x2'));var router=express['Router']();var auth=require(_0x00b7('0x3'));var interaction=require(_0x00b7('0x4'));var config=require(_0x00b7('0x5'));var controller=require('./cmHopperHistory.controller');router[_0x00b7('0x6')]('/',auth['isAuthenticated'](),controller[_0x00b7('0x7')]);router['get'](_0x00b7('0x8'),auth['isAuthenticated'](),controller[_0x00b7('0x9')]);router['get'](_0x00b7('0xa'),auth[_0x00b7('0xb')](),controller[_0x00b7('0xc')]);router[_0x00b7('0xd')]('/',auth['isAuthenticated'](),controller[_0x00b7('0xe')]);router[_0x00b7('0xf')](_0x00b7('0xa'),auth['isAuthenticated'](),controller[_0x00b7('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3925=['post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0xbb2e42,_0xbc3ea7){var _0xf938b4=function(_0x4bc20a){while(--_0x4bc20a){_0xbb2e42['push'](_0xbb2e42['shift']());}};_0xf938b4(++_0xbc3ea7);}(_0x3925,0x1ba));var _0x5392=function(_0x21f089,_0x5ebacd){_0x21f089=_0x21f089-0x0;var _0x59c5e7=_0x3925[_0x21f089];return _0x59c5e7;};'use strict';var multer=require(_0x5392('0x0'));var util=require(_0x5392('0x1'));var path=require(_0x5392('0x2'));var timeout=require(_0x5392('0x3'));var express=require(_0x5392('0x4'));var router=express[_0x5392('0x5')]();var auth=require(_0x5392('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5392('0x7'));router[_0x5392('0x8')]('/',auth[_0x5392('0x9')](),controller[_0x5392('0xa')]);router['get'](_0x5392('0xb'),auth[_0x5392('0x9')](),controller[_0x5392('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5392('0xd')]);router[_0x5392('0xe')]('/',auth[_0x5392('0x9')](),controller[_0x5392('0xf')]);router[_0x5392('0x10')]('/:id',auth[_0x5392('0x9')](),controller[_0x5392('0x11')]);module[_0x5392('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a0cd361..3c8d285 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 _0xed3c=['STRING','name','sequelize'];(function(_0xe402ea,_0x594695){var _0xb3c0d4=function(_0x5192a5){while(--_0x5192a5){_0xe402ea['push'](_0xe402ea['shift']());}};_0xb3c0d4(++_0x594695);}(_0xed3c,0xa1));var _0xced3=function(_0x40bdbc,_0x3fabcd){_0x40bdbc=_0x40bdbc-0x0;var _0xc603a8=_0xed3c[_0x40bdbc];return _0xc603a8;};'use strict';var Sequelize=require(_0xced3('0x0'));module['exports']={'name':{'type':Sequelize[_0xced3('0x1')],'unique':_0xced3('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xced3('0x1')]},'dialPrefix':{'type':Sequelize[_0xced3('0x1')]}}; \ No newline at end of file +var _0x7698=['exports','STRING','name','sequelize'];(function(_0x431103,_0x2e7fa4){var _0x57c172=function(_0x27609c){while(--_0x27609c){_0x431103['push'](_0x431103['shift']());}};_0x57c172(++_0x2e7fa4);}(_0x7698,0x1e3));var _0x8769=function(_0xdf796c,_0x47a5ab){_0xdf796c=_0xdf796c-0x0;var _0x5779c0=_0x7698[_0xdf796c];return _0x5779c0;};'use strict';var Sequelize=require(_0x8769('0x0'));module[_0x8769('0x1')]={'name':{'type':Sequelize[_0x8769('0x2')],'unique':_0x8769('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8769('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 cd86b68..a8be5ca 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 _0x5a3f=['moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','then','destroy','get','Lists','error','stack','name','send','CmList','fieldName','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','findOne','length','pick','removeDispositions','ids','CmContact','tags','isArray','join','each','omit','success','errors','push','message','CmCustomField','CustomFields','concat','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','setHeader','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x32997b,_0x314a66){var _0x55995a=function(_0x41665c){while(--_0x41665c){_0x32997b['push'](_0x32997b['shift']());}};_0x55995a(++_0x314a66);}(_0x5a3f,0x117));var _0xf5a3=function(_0x58b299,_0x27b68c){_0x58b299=_0x58b299-0x0;var _0x25752e=_0x5a3f[_0x58b299];return _0x25752e;};'use strict';var pdf=require(_0xf5a3('0x0'));var emlformat=require(_0xf5a3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf5a3('0x2'));var jsonpatch=require(_0xf5a3('0x3'));var rp=require(_0xf5a3('0x4'));var moment=require(_0xf5a3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf5a3('0x6'));var util=require('util');var path=require(_0xf5a3('0x7'));var sox=require('sox');var csv=require(_0xf5a3('0x8'));var ejs=require(_0xf5a3('0x9'));var fs=require('fs');var _=require(_0xf5a3('0xa'));var squel=require(_0xf5a3('0xb'));var crypto=require('crypto');var jsforce=require(_0xf5a3('0xc'));var deskjs=require(_0xf5a3('0xd'));var toCsv=require(_0xf5a3('0x8'));var querystring=require(_0xf5a3('0xe'));var Papa=require(_0xf5a3('0xf'));var Redis=require(_0xf5a3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf5a3('0x11'));var as=require(_0xf5a3('0x12'));var hardwareService=require(_0xf5a3('0x13'));var logger=require(_0xf5a3('0x14'))(_0xf5a3('0x15'));var utils=require(_0xf5a3('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5a3('0x17')]=_[_0xf5a3('0x18')](config[_0xf5a3('0x17')],{'host':_0xf5a3('0x19'),'port':0x18eb});var socket=require(_0xf5a3('0x1a'))(new Redis(config[_0xf5a3('0x17')]));require(_0xf5a3('0x1b'))[_0xf5a3('0x1c')](socket);function respondWithStatusCode(_0x4fd38c,_0x2e838e){_0x2e838e=_0x2e838e||0xcc;return function(_0xdc4163){if(_0xdc4163){return _0x4fd38c[_0xf5a3('0x1d')](_0x2e838e);}return _0x4fd38c[_0xf5a3('0x1e')](_0x2e838e)[_0xf5a3('0x1f')]();};}function respondWithResult(_0x494008,_0x2150f4){_0x2150f4=_0x2150f4||0xc8;return function(_0x55186c){if(_0x55186c){return _0x494008[_0xf5a3('0x1e')](_0x2150f4)['json'](_0x55186c);}};}function respondWithFilteredResult(_0x5824b1,_0x282d0e){return function(_0x75bb60){if(_0x75bb60){var _0x5260fd=_0x75bb60[_0xf5a3('0x20')],_0x24cbc3=_0x282d0e[_0xf5a3('0x21')],_0x9f25e2=_0x282d0e[_0xf5a3('0x21')]+_0x282d0e[_0xf5a3('0x22')],_0x3a0eb5;if(_0x9f25e2>=_0x5260fd){_0x9f25e2=_0x5260fd;_0x3a0eb5=0xc8;}else{_0x3a0eb5=0xce;}_0x5824b1[_0xf5a3('0x1e')](_0x3a0eb5);return _0x5824b1[_0xf5a3('0x23')](_0xf5a3('0x24'),_0x24cbc3+'-'+_0x9f25e2+'/'+_0x5260fd)[_0xf5a3('0x25')](_0x75bb60);}return null;};}function patchUpdates(_0x356258){return function(_0x4df083){try{jsonpatch['apply'](_0x4df083,_0x356258,!![]);}catch(_0x1cade0){return BPromise['reject'](_0x1cade0);}return _0x4df083[_0xf5a3('0x26')]();};}function saveUpdates(_0x250452,_0x378504){return function(_0x11a330){if(_0x11a330){return _0x11a330[_0xf5a3('0x27')](_0x250452)[_0xf5a3('0x28')](function(_0x434ec8){return _0x434ec8;});}return null;};}function removeEntity(_0x2ef6f1,_0x4ad4b7){return function(_0x1bd9aa){if(_0x1bd9aa){return _0x1bd9aa[_0xf5a3('0x29')]()[_0xf5a3('0x28')](function(){var _0x575472=_0x1bd9aa[_0xf5a3('0x2a')]({'plain':!![]});var _0x3f32ca=_0xf5a3('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x3f32ca,'resourceId':_0x575472['id']}})[_0xf5a3('0x28')](function(){return _0x1bd9aa;});})[_0xf5a3('0x28')](function(){_0x2ef6f1[_0xf5a3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c85c2,_0x654dcc){return function(_0x1dc5c7){if(!_0x1dc5c7){_0x3c85c2[_0xf5a3('0x1d')](0x194);}return _0x1dc5c7;};}function handleError(_0x5988b9,_0x1b9816){_0x1b9816=_0x1b9816||0x1f4;return function(_0x453856){logger[_0xf5a3('0x2c')](_0x453856[_0xf5a3('0x2d')]);if(_0x453856[_0xf5a3('0x2e')]){delete _0x453856['name'];}_0x5988b9[_0xf5a3('0x1e')](_0x1b9816)[_0xf5a3('0x2f')](_0x453856);};}exports['index']=function(_0x39e9e2,_0x5bb63e){var _0x5ab64e={},_0x1edf88={},_0x340904={'count':0x0,'rows':[]};var _0x1315dc=_['map'](db[_0xf5a3('0x30')]['rawAttributes'],function(_0x3d1a82){return{'name':_0x3d1a82[_0xf5a3('0x31')],'type':_0x3d1a82['type'][_0xf5a3('0x32')]};});_0x1edf88[_0xf5a3('0x33')]=_[_0xf5a3('0x34')](_0x1315dc,'name');_0x1edf88[_0xf5a3('0x35')]=_['keys'](_0x39e9e2['query']);_0x1edf88['filters']=_[_0xf5a3('0x36')](_0x1edf88[_0xf5a3('0x33')],_0x1edf88[_0xf5a3('0x35')]);_0x5ab64e[_0xf5a3('0x37')]=_[_0xf5a3('0x36')](_0x1edf88[_0xf5a3('0x33')],qs[_0xf5a3('0x38')](_0x39e9e2[_0xf5a3('0x35')][_0xf5a3('0x38')]));_0x5ab64e[_0xf5a3('0x37')]=_0x5ab64e[_0xf5a3('0x37')]['length']?_0x5ab64e['attributes']:_0x1edf88[_0xf5a3('0x33')];if(!_0x39e9e2['query'][_0xf5a3('0x39')](_0xf5a3('0x3a'))){_0x5ab64e[_0xf5a3('0x22')]=qs[_0xf5a3('0x22')](_0x39e9e2[_0xf5a3('0x35')][_0xf5a3('0x22')]);_0x5ab64e[_0xf5a3('0x21')]=qs[_0xf5a3('0x21')](_0x39e9e2['query'][_0xf5a3('0x21')]);}_0x5ab64e[_0xf5a3('0x3b')]=qs[_0xf5a3('0x3c')](_0x39e9e2['query'][_0xf5a3('0x3c')]);_0x5ab64e['where']=qs['filters'](_['pick'](_0x39e9e2[_0xf5a3('0x35')],_0x1edf88[_0xf5a3('0x3d')]),_0x1315dc);if(_0x39e9e2['query'][_0xf5a3('0x3e')]){_0x5ab64e['where']=_[_0xf5a3('0x3f')](_0x5ab64e['where'],{'$or':_[_0xf5a3('0x34')](_0x1315dc,function(_0x2d9887){if(_0x2d9887['type']!==_0xf5a3('0x40')){var _0x7cc353={};_0x7cc353[_0x2d9887[_0xf5a3('0x2e')]]={'$like':'%'+_0x39e9e2[_0xf5a3('0x35')][_0xf5a3('0x3e')]+'%'};return _0x7cc353;}})});}_0x5ab64e=_['merge']({},_0x5ab64e,_0x39e9e2[_0xf5a3('0x41')]);var _0x3215f8={'where':_0x5ab64e[_0xf5a3('0x42')]};return db[_0xf5a3('0x30')][_0xf5a3('0x20')](_0x3215f8)[_0xf5a3('0x28')](function(_0x3c44ad){_0x340904[_0xf5a3('0x20')]=_0x3c44ad;if(_0x39e9e2[_0xf5a3('0x35')][_0xf5a3('0x43')]){_0x5ab64e[_0xf5a3('0x44')]=[{'all':!![]}];}return db[_0xf5a3('0x30')][_0xf5a3('0x45')](_0x5ab64e);})[_0xf5a3('0x28')](function(_0x44798d){_0x340904[_0xf5a3('0x46')]=_0x44798d;return _0x340904;})[_0xf5a3('0x28')](respondWithFilteredResult(_0x5bb63e,_0x5ab64e))[_0xf5a3('0x47')](handleError(_0x5bb63e,null));};exports['show']=function(_0x471cba,_0xe4319a){var _0x310ed5={'raw':![],'where':{'id':_0x471cba[_0xf5a3('0x48')]['id']}},_0x20af74={};_0x20af74['model']=_['keys'](db[_0xf5a3('0x30')][_0xf5a3('0x49')]);_0x20af74[_0xf5a3('0x35')]=_[_0xf5a3('0x4a')](_0x471cba['query']);_0x20af74['filters']=_['intersection'](_0x20af74['model'],_0x20af74[_0xf5a3('0x35')]);_0x310ed5[_0xf5a3('0x37')]=_[_0xf5a3('0x36')](_0x20af74['model'],qs[_0xf5a3('0x38')](_0x471cba[_0xf5a3('0x35')][_0xf5a3('0x38')]));_0x310ed5['attributes']=_0x310ed5[_0xf5a3('0x37')]['length']?_0x310ed5[_0xf5a3('0x37')]:_0x20af74[_0xf5a3('0x33')];if(_0x471cba['query'][_0xf5a3('0x43')]){_0x310ed5[_0xf5a3('0x44')]=[{'all':!![]}];}_0x310ed5=_[_0xf5a3('0x3f')]({},_0x310ed5,_0x471cba[_0xf5a3('0x41')]);return db[_0xf5a3('0x30')][_0xf5a3('0x4b')](_0x310ed5)['then'](handleEntityNotFound(_0xe4319a,null))[_0xf5a3('0x28')](respondWithResult(_0xe4319a,null))[_0xf5a3('0x47')](handleError(_0xe4319a,null));};exports['create']=function(_0x35e2b3,_0x2c5f9f){return db['CmList'][_0xf5a3('0x4c')](_0x35e2b3['body'],{})[_0xf5a3('0x28')](function(_0x37c5cc){var _0x30c73f=_0x35e2b3['user']['get']({'plain':!![]});if(!_0x30c73f)throw new Error(_0xf5a3('0x4d'));if(_0x30c73f[_0xf5a3('0x4e')]==='user'){var _0x2b1bc9=_0x37c5cc['get']({'plain':!![]});var _0xd6c83c=_0xf5a3('0x2b');return db[_0xf5a3('0x4f')]['find']({'where':{'name':_0xd6c83c,'userProfileId':_0x30c73f['userProfileId']},'raw':!![]})[_0xf5a3('0x28')](function(_0x130a5c){if(_0x130a5c&&_0x130a5c['autoAssociation']===0x0){return db[_0xf5a3('0x50')][_0xf5a3('0x4c')]({'name':_0x2b1bc9[_0xf5a3('0x2e')],'resourceId':_0x2b1bc9['id'],'type':_0x130a5c[_0xf5a3('0x2e')],'sectionId':_0x130a5c['id']},{})[_0xf5a3('0x28')](function(){return _0x37c5cc;});}else{return _0x37c5cc;}})[_0xf5a3('0x47')](function(_0x5a6ee0){logger['error'](_0xf5a3('0x51'),_0x5a6ee0);throw _0x5a6ee0;});}return _0x37c5cc;})[_0xf5a3('0x28')](respondWithResult(_0x2c5f9f,0xc9))[_0xf5a3('0x47')](handleError(_0x2c5f9f,null));};exports['update']=function(_0x5c60c4,_0x1e851c){if(_0x5c60c4[_0xf5a3('0x52')]['id']){delete _0x5c60c4['body']['id'];}return db[_0xf5a3('0x30')][_0xf5a3('0x4b')]({'where':{'id':_0x5c60c4[_0xf5a3('0x48')]['id']}})[_0xf5a3('0x28')](handleEntityNotFound(_0x1e851c,null))['then'](saveUpdates(_0x5c60c4[_0xf5a3('0x52')],null))['then'](respondWithResult(_0x1e851c,null))['catch'](handleError(_0x1e851c,null));};exports['destroy']=function(_0x50b5c9,_0x7712d0){return db[_0xf5a3('0x30')]['find']({'where':{'id':_0x50b5c9[_0xf5a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x7712d0,null))['then'](removeEntity(_0x7712d0,null))['catch'](handleError(_0x7712d0,null));};exports[_0xf5a3('0x53')]=function(_0x5946f5,_0x3d6974){return db['CmList'][_0xf5a3('0x53')]()[_0xf5a3('0x28')](respondWithResult(_0x3d6974,null))[_0xf5a3('0x47')](handleError(_0x3d6974,null));};exports[_0xf5a3('0x54')]=function(_0x382a30,_0x35b056,_0x1f84f6){if(_0x382a30[_0xf5a3('0x52')]['id']){delete _0x382a30[_0xf5a3('0x52')]['id'];}return db['CmList']['find']({'where':{'id':_0x382a30[_0xf5a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x35b056,null))[_0xf5a3('0x28')](function(_0x10e6f7){if(_0x10e6f7){_0x382a30[_0xf5a3('0x52')][_0xf5a3('0x55')]=_0x10e6f7['id'];return db[_0xf5a3('0x56')]['create'](_0x382a30[_0xf5a3('0x52')]);}})[_0xf5a3('0x28')](respondWithResult(_0x35b056,null))[_0xf5a3('0x47')](handleError(_0x35b056,null));};exports['getDispositions']=function(_0x3948ce,_0x2c4bca,_0x2a7432){var _0x2f4ebd={'raw':![],'where':{}};var _0x5c0c52={};var _0x152569={'count':0x0,'rows':[]};return db[_0xf5a3('0x30')][_0xf5a3('0x57')]({'where':{'id':_0x3948ce[_0xf5a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c4bca,null))[_0xf5a3('0x28')](function(_0x45d44d){if(_0x45d44d){_0x5c0c52[_0xf5a3('0x33')]=_[_0xf5a3('0x4a')](db[_0xf5a3('0x56')][_0xf5a3('0x49')]);_0x5c0c52[_0xf5a3('0x35')]=_[_0xf5a3('0x4a')](_0x3948ce[_0xf5a3('0x35')]);_0x5c0c52[_0xf5a3('0x3d')]=_['intersection'](_0x5c0c52[_0xf5a3('0x33')],_0x5c0c52[_0xf5a3('0x35')]);_0x2f4ebd[_0xf5a3('0x37')]=_[_0xf5a3('0x36')](_0x5c0c52[_0xf5a3('0x33')],qs['fields'](_0x3948ce[_0xf5a3('0x35')][_0xf5a3('0x38')]));_0x2f4ebd[_0xf5a3('0x37')]=_0x2f4ebd[_0xf5a3('0x37')][_0xf5a3('0x58')]?_0x2f4ebd[_0xf5a3('0x37')]:_0x5c0c52[_0xf5a3('0x33')];if(!_0x3948ce[_0xf5a3('0x35')][_0xf5a3('0x39')]('nolimit')){_0x2f4ebd[_0xf5a3('0x22')]=qs[_0xf5a3('0x22')](_0x3948ce[_0xf5a3('0x35')]['limit']);_0x2f4ebd[_0xf5a3('0x21')]=qs[_0xf5a3('0x21')](_0x3948ce['query']['offset']);}_0x2f4ebd[_0xf5a3('0x3b')]=qs['sort'](_0x3948ce['query'][_0xf5a3('0x3c')]);_0x2f4ebd['where']=qs['filters'](_[_0xf5a3('0x59')](_0x3948ce[_0xf5a3('0x35')],_0x5c0c52[_0xf5a3('0x3d')]));_0x2f4ebd[_0xf5a3('0x42')]['ListId']=_0x45d44d['id'];if(_0x3948ce[_0xf5a3('0x35')][_0xf5a3('0x3e')]){_0x2f4ebd[_0xf5a3('0x42')]=_[_0xf5a3('0x3f')](_0x2f4ebd['where'],{'$or':_[_0xf5a3('0x34')](_0x2f4ebd['attributes'],function(_0x4f1d03){var _0x43b715={};_0x43b715[_0x4f1d03]={'$like':'%'+_0x3948ce[_0xf5a3('0x35')][_0xf5a3('0x3e')]+'%'};return _0x43b715;})});}_0x2f4ebd=_[_0xf5a3('0x3f')]({},_0x2f4ebd,_0x3948ce['options']);return db['Disposition']['count']({'where':_0x2f4ebd[_0xf5a3('0x42')]})[_0xf5a3('0x28')](function(_0x4a288c){_0x152569['count']=_0x4a288c;if(_0x3948ce[_0xf5a3('0x35')]['includeAll']){_0x2f4ebd[_0xf5a3('0x44')]=[{'all':!![]}];}return db[_0xf5a3('0x56')][_0xf5a3('0x45')](_0x2f4ebd);})[_0xf5a3('0x28')](function(_0x3a0d14){_0x152569[_0xf5a3('0x46')]=_0x3a0d14;return _0x152569;});}})['then'](respondWithFilteredResult(_0x2c4bca,_0x2f4ebd))[_0xf5a3('0x47')](handleError(_0x2c4bca,null));};exports['removeDispositions']=function(_0x35aefb,_0x1cf572,_0x23882e){return db[_0xf5a3('0x30')][_0xf5a3('0x4b')]({'where':{'id':_0x35aefb[_0xf5a3('0x48')]['id']}})[_0xf5a3('0x28')](handleEntityNotFound(_0x1cf572,null))[_0xf5a3('0x28')](function(_0x29291f){if(_0x29291f){return _0x29291f[_0xf5a3('0x5a')](_0x35aefb[_0xf5a3('0x35')][_0xf5a3('0x5b')]);}})[_0xf5a3('0x28')](respondWithStatusCode(_0x1cf572,null))['catch'](handleError(_0x1cf572,null));};exports['addContacts']=function(_0x3f6583,_0x15406c,_0x4f573c){return db[_0xf5a3('0x30')][_0xf5a3('0x4b')]({'where':{'id':_0x3f6583['params']['id']}})['then'](handleEntityNotFound(_0x15406c,null))[_0xf5a3('0x28')](function(_0x2a8bf2){if(_0x2a8bf2){var _0x559c9f=[];var _0x7b0519={'success':[],'errors':[]};return db[_0xf5a3('0x5c')][_0xf5a3('0x53')]()[_0xf5a3('0x28')](function(_0x407572){if(_0x3f6583['body'][_0xf5a3('0x5d')]&&_[_0xf5a3('0x5e')](_0x3f6583[_0xf5a3('0x52')][_0xf5a3('0x5d')])){if(_0x3f6583['body'][_0xf5a3('0x5d')]['length']){_0x3f6583['body'][_0xf5a3('0x5d')]=_0x3f6583[_0xf5a3('0x52')][_0xf5a3('0x5d')][_0xf5a3('0x5f')](';')+';';}else{_0x3f6583[_0xf5a3('0x52')]['tags']=null;}}else{_0x3f6583[_0xf5a3('0x52')]['tags']=null;}if(_0x3f6583[_0xf5a3('0x52')]&&_[_0xf5a3('0x5e')](_0x3f6583[_0xf5a3('0x52')])){for(var _0x5b8598=0x0;_0x5b8598<_0x3f6583[_0xf5a3('0x52')]['length'];_0x5b8598+=0x1){_0x3f6583[_0xf5a3('0x52')][_0x5b8598][_0xf5a3('0x55')]=_0x3f6583[_0xf5a3('0x48')]['id'];_0x559c9f['push'](_0x3f6583['body'][_0x5b8598]);}return BPromise[_0xf5a3('0x60')](_0x559c9f,function(_0x28811f){return db[_0xf5a3('0x5c')][_0xf5a3('0x4c')](_[_0xf5a3('0x61')](_0x28811f,[_0xf5a3('0x5b'),'id'])||{},{'fields':_[_0xf5a3('0x4a')](_0x407572),'raw':!![]})[_0xf5a3('0x28')](function(_0x465e94){_0x7b0519[_0xf5a3('0x62')]['push'](_0x465e94['dataValues']);})['catch'](function(_0x3e9ac1){_0x7b0519[_0xf5a3('0x63')][_0xf5a3('0x64')]({'data':_0x28811f,'error':_0x3e9ac1[_0xf5a3('0x65')]});});})[_0xf5a3('0x28')](function(_0x258839){return _0x7b0519;})['catch'](function(_0x8a3f23){return _0x8a3f23;});}else{_0x15406c[_0xf5a3('0x1e')](0x190)[_0xf5a3('0x25')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x15406c,null))[_0xf5a3('0x47')](handleError(_0x15406c,null));};exports['getContacts']=function(_0x1d47d5,_0x3c8b5f,_0x3d3f9f){var _0x3b51df;return db[_0xf5a3('0x30')][_0xf5a3('0x4b')]({'where':{'id':_0x1d47d5['params']['id']},'include':[{'model':db[_0xf5a3('0x66')],'as':_0xf5a3('0x67')}]})[_0xf5a3('0x28')](handleEntityNotFound(_0x3c8b5f,null))['then'](function(_0x569145){if(_0x569145){_0x3b51df=_0x569145;return db[_0xf5a3('0x5c')][_0xf5a3('0x49')];}})['then'](function(_0x4b22d6){if(_0x4b22d6){var _0x2c121a={};var _0x4f661d={};_0x4f661d['model']=_[_0xf5a3('0x68')](_['keys'](_0x4b22d6),_[_0xf5a3('0x34')](_0x3b51df[_0xf5a3('0x67')],function(_0x10dabe){return util['format'](_0xf5a3('0x69'),_0x10dabe['id']);}));_0x4f661d[_0xf5a3('0x35')]=_[_0xf5a3('0x4a')](_0x1d47d5[_0xf5a3('0x35')]);_0x4f661d[_0xf5a3('0x3d')]=_[_0xf5a3('0x36')](_0x4f661d['model'],_0x4f661d[_0xf5a3('0x35')]);_0x2c121a[_0xf5a3('0x37')]=_['intersection'](_0x4f661d[_0xf5a3('0x33')],qs[_0xf5a3('0x38')](_0x1d47d5[_0xf5a3('0x35')][_0xf5a3('0x38')]));_0x2c121a[_0xf5a3('0x37')]=_0x2c121a[_0xf5a3('0x37')][_0xf5a3('0x58')]?_0x2c121a['attributes']:_0x4f661d[_0xf5a3('0x33')];if(!_0x1d47d5[_0xf5a3('0x35')][_0xf5a3('0x39')](_0xf5a3('0x3a'))){_0x2c121a[_0xf5a3('0x22')]=qs[_0xf5a3('0x22')](_0x1d47d5[_0xf5a3('0x35')][_0xf5a3('0x22')]);_0x2c121a['offset']=qs[_0xf5a3('0x21')](_0x1d47d5['query'][_0xf5a3('0x21')]);}_0x2c121a['order']=qs[_0xf5a3('0x3c')](_0x1d47d5[_0xf5a3('0x35')][_0xf5a3('0x3c')]);_0x2c121a[_0xf5a3('0x42')]=qs[_0xf5a3('0x3d')](_[_0xf5a3('0x59')](_0x1d47d5[_0xf5a3('0x35')],_0x4f661d['filters']));_0x2c121a[_0xf5a3('0x6a')]=!![];if(_0x1d47d5[_0xf5a3('0x35')][_0xf5a3('0x3e')]){_0x2c121a[_0xf5a3('0x42')]=_['merge'](_0x2c121a[_0xf5a3('0x42')],{'$or':_[_0xf5a3('0x34')](_0x2c121a[_0xf5a3('0x37')],function(_0x5f6d64){var _0x149798={};_0x149798[_0x5f6d64]={'$like':'%'+_0x1d47d5[_0xf5a3('0x35')][_0xf5a3('0x3e')]+'%'};return _0x149798;})});}_0x2c121a=_[_0xf5a3('0x3f')]({},_0x2c121a,_0x1d47d5[_0xf5a3('0x41')]);return _0x3b51df[_0xf5a3('0x6b')](_0x2c121a);}})['then'](respondWithResult(_0x3c8b5f,null))['catch'](handleError(_0x3c8b5f,null));};exports[_0xf5a3('0x6c')]=function(_0x3fba6b,_0x5ba488,_0x2347cd){var _0x53a9ed;return db[_0xf5a3('0x30')][_0xf5a3('0x4b')]({'where':{'id':_0x3fba6b['params']['id']},'include':[{'model':db[_0xf5a3('0x66')],'as':_0xf5a3('0x67')}]})[_0xf5a3('0x28')](handleEntityNotFound(_0x5ba488,null))[_0xf5a3('0x28')](function(_0x5b429d){if(_0x5b429d){_0x53a9ed=_0x5b429d;return db[_0xf5a3('0x5c')][_0xf5a3('0x49')];}})[_0xf5a3('0x28')](function(_0x407007){if(_0x407007){var _0x3236ec={};var _0x4ab18d={};_0x4ab18d['model']=_[_0xf5a3('0x68')](_[_0xf5a3('0x4a')](_0x407007),_[_0xf5a3('0x34')](_0x53a9ed[_0xf5a3('0x67')],function(_0x437111){return util['format'](_0xf5a3('0x69'),_0x437111['id']);}));_0x4ab18d['query']=_[_0xf5a3('0x4a')](_0x3fba6b[_0xf5a3('0x35')]);_0x4ab18d[_0xf5a3('0x3d')]=_[_0xf5a3('0x36')](_0x4ab18d[_0xf5a3('0x33')],_0x4ab18d[_0xf5a3('0x35')]);_0x3236ec[_0xf5a3('0x37')]=_[_0xf5a3('0x36')](_0x4ab18d[_0xf5a3('0x33')],qs[_0xf5a3('0x38')](_0x3fba6b['query']['fields']));_0x3236ec[_0xf5a3('0x37')]=_0x3236ec[_0xf5a3('0x37')][_0xf5a3('0x58')]?_0x3236ec[_0xf5a3('0x37')]:_0x4ab18d['model'];if(!_0x3fba6b[_0xf5a3('0x35')][_0xf5a3('0x39')](_0xf5a3('0x3a'))){_0x3236ec[_0xf5a3('0x22')]=qs['limit'](_0x3fba6b[_0xf5a3('0x35')][_0xf5a3('0x22')]);_0x3236ec['offset']=qs[_0xf5a3('0x21')](_0x3fba6b['query']['offset']);}_0x3236ec['order']=qs['sort'](_0x3fba6b[_0xf5a3('0x35')][_0xf5a3('0x3c')]);_0x3236ec['where']=qs[_0xf5a3('0x3d')](_['pick'](_0x3fba6b[_0xf5a3('0x35')],_0x4ab18d[_0xf5a3('0x3d')]));_0x3236ec[_0xf5a3('0x6a')]=!![];if(_0x3fba6b[_0xf5a3('0x35')]['filter']){_0x3236ec[_0xf5a3('0x42')]=_[_0xf5a3('0x3f')](_0x3236ec[_0xf5a3('0x42')],{'$or':_['map'](_0x3236ec['attributes'],function(_0x4de262){var _0x3c910c={};_0x3c910c[_0x4de262]={'$like':'%'+_0x3fba6b[_0xf5a3('0x35')][_0xf5a3('0x3e')]+'%'};return _0x3c910c;})});}_0x3236ec=_[_0xf5a3('0x3f')]({},_0x3236ec,_0x3fba6b[_0xf5a3('0x41')]);return _0x53a9ed[_0xf5a3('0x6b')](_0x3236ec);}})['then'](function(_0x37c2d2){if(!_[_0xf5a3('0x6d')](_0x37c2d2)){var _0x2316d2=toCsv(_0x37c2d2);var _0x947fb4=Date[_0xf5a3('0x6e')]();fs[_0xf5a3('0x6f')](util[_0xf5a3('0x70')](_0xf5a3('0x71'),_0x53a9ed['id'],_0x947fb4),_0x2316d2);_0x5ba488['setHeader'](_0xf5a3('0x72'),'attachment;\x20filename='+util[_0xf5a3('0x70')](_0xf5a3('0x73'),_0x53a9ed['id'],_0x947fb4));_0x5ba488[_0xf5a3('0x74')]('Content-type',_0xf5a3('0x75'));return _0x5ba488[_0xf5a3('0x76')](util['format'](_0xf5a3('0x71'),_0x53a9ed['id'],_0x947fb4));}else{return _0x5ba488['sendStatus'](0xcc);}})[_0xf5a3('0x47')](handleError(_0x5ba488,null));};exports['addCustomField']=function(_0x4125c5,_0x2d5400,_0x1502c4){var _0x21239d;delete _0x4125c5[_0xf5a3('0x52')]['id'];return db[_0xf5a3('0x30')][_0xf5a3('0x57')]({'where':{'id':_0x4125c5[_0xf5a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d5400,null))[_0xf5a3('0x28')](function(_0x6dcc9){if(_0x6dcc9){return db[_0xf5a3('0x77')][_0xf5a3('0x78')](function(_0x50d164){return db[_0xf5a3('0x66')]['create'](_0x4125c5[_0xf5a3('0x52')],{'transaction':_0x50d164})[_0xf5a3('0x28')](function(_0x12881e){_0x21239d=_0x12881e;return _0x6dcc9[_0xf5a3('0x79')](_0x12881e,{'transaction':_0x50d164});})[_0xf5a3('0x28')](function(){var _0x43f341={'type':db[_0xf5a3('0x7a')][_0xf5a3('0x7b')],'transaction':_0x50d164};switch(_0x4125c5[_0xf5a3('0x52')][_0xf5a3('0x7c')]){case _0xf5a3('0x7d'):_0x43f341[_0xf5a3('0x7c')]=db[_0xf5a3('0x7a')][_0xf5a3('0x7b')];break;case _0xf5a3('0x7e'):_0x43f341[_0xf5a3('0x7c')]=db['Sequelize'][_0xf5a3('0x7f')];break;case _0xf5a3('0x80'):_0x43f341[_0xf5a3('0x7c')]=db['Sequelize'][_0xf5a3('0x81')];_0x43f341[_0xf5a3('0x82')]=![];break;default:}return db[_0xf5a3('0x77')][_0xf5a3('0x83')][_0xf5a3('0x84')]('cm_contacts',util[_0xf5a3('0x70')](_0xf5a3('0x85'),_0x21239d['id']),_0x43f341);})[_0xf5a3('0x28')](function(){return _0x21239d;});});}})[_0xf5a3('0x28')](respondWithResult(_0x2d5400,null))['catch'](handleError(_0x2d5400,null));};exports[_0xf5a3('0x86')]=function(_0x45d7a4,_0x5c4746,_0x2d946c){var _0xd82b={};var _0x17a629={};var _0x16e991;var _0x3dceea;return db['CmList'][_0xf5a3('0x57')]({'where':{'id':_0x45d7a4['params']['id']}})['then'](handleEntityNotFound(_0x5c4746,null))[_0xf5a3('0x28')](function(_0x14202a){if(_0x14202a){_0x16e991=_0x14202a;_0x17a629[_0xf5a3('0x33')]=_[_0xf5a3('0x4a')](db[_0xf5a3('0x66')][_0xf5a3('0x49')]);_0x17a629[_0xf5a3('0x35')]=_[_0xf5a3('0x4a')](_0x45d7a4[_0xf5a3('0x35')]);_0x17a629[_0xf5a3('0x3d')]=_['intersection'](_0x17a629[_0xf5a3('0x33')],_0x17a629['query']);_0xd82b[_0xf5a3('0x37')]=_[_0xf5a3('0x36')](_0x17a629['model'],qs[_0xf5a3('0x38')](_0x45d7a4[_0xf5a3('0x35')]['fields']));_0xd82b['attributes']=_0xd82b[_0xf5a3('0x37')][_0xf5a3('0x58')]?_0xd82b[_0xf5a3('0x37')]:_0x17a629[_0xf5a3('0x33')];_0xd82b[_0xf5a3('0x3b')]=qs[_0xf5a3('0x3c')](_0x45d7a4[_0xf5a3('0x35')][_0xf5a3('0x3c')]);_0xd82b[_0xf5a3('0x42')]=qs[_0xf5a3('0x3d')](_[_0xf5a3('0x59')](_0x45d7a4[_0xf5a3('0x35')],_0x17a629[_0xf5a3('0x3d')]));_0xd82b['where']=_[_0xf5a3('0x3f')](_0xd82b[_0xf5a3('0x42')],{'$or':[{'ListId':_0x14202a['id']},{'ListId':null}]});if(_0x45d7a4[_0xf5a3('0x35')][_0xf5a3('0x3e')]){_0xd82b['where']=_[_0xf5a3('0x3f')](_0xd82b['where'],{'$or':_[_0xf5a3('0x34')](_0xd82b[_0xf5a3('0x37')],function(_0x56dc54){var _0x4fdf16={};_0x4fdf16[_0x56dc54]={'$like':'%'+_0x45d7a4['query'][_0xf5a3('0x3e')]+'%'};return _0x4fdf16;})});}_0xd82b=_[_0xf5a3('0x3f')]({},_0xd82b,_0x45d7a4[_0xf5a3('0x41')]);return db[_0xf5a3('0x66')][_0xf5a3('0x87')](_0xd82b);}})[_0xf5a3('0x28')](respondWithResult(_0x5c4746,null))['catch'](handleError(_0x5c4746,null));};exports[_0xf5a3('0x88')]=function(_0x2109b4,_0x4b0414,_0x1b335f){return db[_0xf5a3('0x30')]['find']({'where':{'id':_0x2109b4[_0xf5a3('0x48')]['id']}})[_0xf5a3('0x28')](handleEntityNotFound(_0x4b0414,null))[_0xf5a3('0x28')](function(_0x36a21b){if(_0x36a21b){return _0x36a21b[_0xf5a3('0x88')](_0x2109b4[_0xf5a3('0x52')][_0xf5a3('0x5b')],_['omit'](_0x2109b4[_0xf5a3('0x52')],['ids','id'])||{})[_0xf5a3('0x89')](function(_0x43cf23){for(var _0x29d7cc=0x0;_0x29d7cc<_0x2109b4[_0xf5a3('0x52')]['ids'][_0xf5a3('0x58')];_0x29d7cc+=0x1){socket[_0xf5a3('0x8a')]('userCmList:save',{'UserId':_0x2109b4[_0xf5a3('0x52')][_0xf5a3('0x5b')][_0x29d7cc],'CmListId':_0x2109b4[_0xf5a3('0x48')]['id']});}return _0x43cf23;});}})[_0xf5a3('0x28')](respondWithResult(_0x4b0414,null))['catch'](handleError(_0x4b0414,null));};exports[_0xf5a3('0x8b')]=function(_0x179c84,_0x18b17b,_0x5334dd){return db[_0xf5a3('0x30')][_0xf5a3('0x4b')]({'where':{'id':_0x179c84['params']['id']}})[_0xf5a3('0x28')](handleEntityNotFound(_0x18b17b,null))['then'](function(_0x3fc403){if(_0x3fc403){return _0x3fc403[_0xf5a3('0x8b')](_0x179c84[_0xf5a3('0x35')][_0xf5a3('0x5b')])[_0xf5a3('0x28')](function(){if(_[_0xf5a3('0x5e')](_0x179c84[_0xf5a3('0x35')][_0xf5a3('0x5b')])){for(var _0x5b7f43=0x0;_0x5b7f43<_0x179c84[_0xf5a3('0x35')][_0xf5a3('0x5b')]['length'];_0x5b7f43+=0x1){socket[_0xf5a3('0x8a')](_0xf5a3('0x8c'),{'UserId':Number(_0x179c84[_0xf5a3('0x35')]['ids'][_0x5b7f43]),'CmListId':Number(_0x179c84[_0xf5a3('0x48')]['id'])});}}else{socket[_0xf5a3('0x8a')](_0xf5a3('0x8c'),{'UserId':Number(_0x179c84[_0xf5a3('0x35')]['ids']),'CmListId':Number(_0x179c84['params']['id'])});}});}})[_0xf5a3('0x28')](respondWithStatusCode(_0x18b17b,null))['catch'](handleError(_0x18b17b,null));};exports[_0xf5a3('0x8d')]=function(_0x4cb0e9,_0x1a36ab,_0x551507){var _0x4d82d1={};var _0x357537={};var _0x46308f;var _0x1d4ec4;return db[_0xf5a3('0x30')][_0xf5a3('0x57')]({'where':{'id':_0x4cb0e9[_0xf5a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a36ab,null))['then'](function(_0x95b04c){if(_0x95b04c){_0x46308f=_0x95b04c;_0x357537[_0xf5a3('0x33')]=_[_0xf5a3('0x4a')](db['User'][_0xf5a3('0x49')]);_0x357537[_0xf5a3('0x35')]=_[_0xf5a3('0x4a')](_0x4cb0e9[_0xf5a3('0x35')]);_0x357537['filters']=_['intersection'](_0x357537[_0xf5a3('0x33')],_0x357537[_0xf5a3('0x35')]);_0x4d82d1['attributes']=_['intersection'](_0x357537[_0xf5a3('0x33')],qs[_0xf5a3('0x38')](_0x4cb0e9[_0xf5a3('0x35')][_0xf5a3('0x38')]));_0x4d82d1[_0xf5a3('0x37')]=_0x4d82d1['attributes']['length']?_0x4d82d1[_0xf5a3('0x37')]:_0x357537['model'];_0x4d82d1[_0xf5a3('0x3b')]=qs['sort'](_0x4cb0e9[_0xf5a3('0x35')][_0xf5a3('0x3c')]);_0x4d82d1[_0xf5a3('0x42')]=qs[_0xf5a3('0x3d')](_[_0xf5a3('0x59')](_0x4cb0e9[_0xf5a3('0x35')],_0x357537[_0xf5a3('0x3d')]));if(_0x4cb0e9[_0xf5a3('0x35')][_0xf5a3('0x3e')]){_0x4d82d1['where']=_['merge'](_0x4d82d1[_0xf5a3('0x42')],{'$or':_['map'](_0x4d82d1[_0xf5a3('0x37')],function(_0x116cd){var _0x1349d9={};_0x1349d9[_0x116cd]={'$like':'%'+_0x4cb0e9[_0xf5a3('0x35')][_0xf5a3('0x3e')]+'%'};return _0x1349d9;})});}_0x4d82d1=_[_0xf5a3('0x3f')]({},_0x4d82d1,_0x4cb0e9['options']);return _0x46308f[_0xf5a3('0x8d')](_0x4d82d1);}})[_0xf5a3('0x28')](function(_0x183adf){if(_0x183adf){_0x1d4ec4=_0x183adf[_0xf5a3('0x58')];if(!_0x4cb0e9[_0xf5a3('0x35')][_0xf5a3('0x39')](_0xf5a3('0x3a'))){_0x4d82d1[_0xf5a3('0x22')]=qs[_0xf5a3('0x22')](_0x4cb0e9[_0xf5a3('0x35')][_0xf5a3('0x22')]);_0x4d82d1[_0xf5a3('0x21')]=qs[_0xf5a3('0x21')](_0x4cb0e9[_0xf5a3('0x35')][_0xf5a3('0x21')]);}return _0x46308f[_0xf5a3('0x8d')](_0x4d82d1);}})[_0xf5a3('0x28')](function(_0x18415c){if(_0x18415c){return _0x18415c?{'count':_0x1d4ec4,'rows':_0x18415c}:null;}})['then'](respondWithResult(_0x1a36ab,null))[_0xf5a3('0x47')](handleError(_0x1a36ab,null));}; \ No newline at end of file +var _0xda05=['end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','sendStatus','error','stack','name','index','map','CmList','fieldName','key','keys','filters','intersection','query','attributes','model','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','success','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','format','raw','concat','isEmpty','now','writeFileSync','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status'];(function(_0x1764be,_0x42e773){var _0x55427b=function(_0x40b78b){while(--_0x40b78b){_0x1764be['push'](_0x1764be['shift']());}};_0x55427b(++_0x42e773);}(_0xda05,0xff));var _0x5da0=function(_0x3ec2b7,_0xace775){_0x3ec2b7=_0x3ec2b7-0x0;var _0x279e2c=_0xda05[_0x3ec2b7];return _0x279e2c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5da0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5da0('0x1'));var jsonpatch=require(_0x5da0('0x2'));var rp=require(_0x5da0('0x3'));var moment=require(_0x5da0('0x4'));var BPromise=require(_0x5da0('0x5'));var Mustache=require(_0x5da0('0x6'));var util=require(_0x5da0('0x7'));var path=require('path');var sox=require(_0x5da0('0x8'));var csv=require('to-csv');var ejs=require(_0x5da0('0x9'));var fs=require('fs');var _=require(_0x5da0('0xa'));var squel=require('squel');var crypto=require(_0x5da0('0xb'));var jsforce=require(_0x5da0('0xc'));var deskjs=require(_0x5da0('0xd'));var toCsv=require(_0x5da0('0xe'));var querystring=require(_0x5da0('0xf'));var Papa=require(_0x5da0('0x10'));var Redis=require(_0x5da0('0x11'));var authService=require(_0x5da0('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5da0('0x13'));var logger=require(_0x5da0('0x14'))('api');var utils=require(_0x5da0('0x15'));var config=require(_0x5da0('0x16'));var db=require(_0x5da0('0x17'))['db'];config[_0x5da0('0x18')]=_[_0x5da0('0x19')](config[_0x5da0('0x18')],{'host':_0x5da0('0x1a'),'port':0x18eb});var socket=require(_0x5da0('0x1b'))(new Redis(config[_0x5da0('0x18')]));require(_0x5da0('0x1c'))[_0x5da0('0x1d')](socket);function respondWithStatusCode(_0x217a1f,_0x44bf7d){_0x44bf7d=_0x44bf7d||0xcc;return function(_0x1672bf){if(_0x1672bf){return _0x217a1f['sendStatus'](_0x44bf7d);}return _0x217a1f[_0x5da0('0x1e')](_0x44bf7d)[_0x5da0('0x1f')]();};}function respondWithResult(_0x1f2443,_0x3ff3d1){_0x3ff3d1=_0x3ff3d1||0xc8;return function(_0x58c336){if(_0x58c336){return _0x1f2443['status'](_0x3ff3d1)['json'](_0x58c336);}};}function respondWithFilteredResult(_0x65fd80,_0x2353a7){return function(_0x581275){if(_0x581275){var _0x168eff=_0x581275[_0x5da0('0x20')],_0x328527=_0x2353a7[_0x5da0('0x21')],_0x129719=_0x2353a7[_0x5da0('0x21')]+_0x2353a7['limit'],_0x2e7a7c;if(_0x129719>=_0x168eff){_0x129719=_0x168eff;_0x2e7a7c=0xc8;}else{_0x2e7a7c=0xce;}_0x65fd80[_0x5da0('0x1e')](_0x2e7a7c);return _0x65fd80[_0x5da0('0x22')](_0x5da0('0x23'),_0x328527+'-'+_0x129719+'/'+_0x168eff)[_0x5da0('0x24')](_0x581275);}return null;};}function patchUpdates(_0x2a3e55){return function(_0x176b85){try{jsonpatch[_0x5da0('0x25')](_0x176b85,_0x2a3e55,!![]);}catch(_0x277852){return BPromise[_0x5da0('0x26')](_0x277852);}return _0x176b85[_0x5da0('0x27')]();};}function saveUpdates(_0x1be9b4,_0x50a9ab){return function(_0x149a0d){if(_0x149a0d){return _0x149a0d[_0x5da0('0x28')](_0x1be9b4)[_0x5da0('0x29')](function(_0x110f09){return _0x110f09;});}return null;};}function removeEntity(_0x46fbb9,_0x53694c){return function(_0x500cc3){if(_0x500cc3){return _0x500cc3[_0x5da0('0x2a')]()[_0x5da0('0x29')](function(){var _0x37104c=_0x500cc3[_0x5da0('0x2b')]({'plain':!![]});var _0x156cde=_0x5da0('0x2c');return db['UserProfileResource'][_0x5da0('0x2a')]({'where':{'type':_0x156cde,'resourceId':_0x37104c['id']}})['then'](function(){return _0x500cc3;});})[_0x5da0('0x29')](function(){_0x46fbb9[_0x5da0('0x1e')](0xcc)[_0x5da0('0x1f')]();});}};}function handleEntityNotFound(_0x57c22b,_0x10344c){return function(_0x57357d){if(!_0x57357d){_0x57c22b[_0x5da0('0x2d')](0x194);}return _0x57357d;};}function handleError(_0x22c981,_0xb5edea){_0xb5edea=_0xb5edea||0x1f4;return function(_0x35881d){logger[_0x5da0('0x2e')](_0x35881d[_0x5da0('0x2f')]);if(_0x35881d[_0x5da0('0x30')]){delete _0x35881d['name'];}_0x22c981[_0x5da0('0x1e')](_0xb5edea)['send'](_0x35881d);};}exports[_0x5da0('0x31')]=function(_0x276ed2,_0x28e0df){var _0x102c53={},_0x5d38ae={},_0x37066d={'count':0x0,'rows':[]};var _0x411a89=_[_0x5da0('0x32')](db[_0x5da0('0x33')]['rawAttributes'],function(_0x48451c){return{'name':_0x48451c[_0x5da0('0x34')],'type':_0x48451c['type'][_0x5da0('0x35')]};});_0x5d38ae['model']=_[_0x5da0('0x32')](_0x411a89,'name');_0x5d38ae['query']=_[_0x5da0('0x36')](_0x276ed2['query']);_0x5d38ae[_0x5da0('0x37')]=_[_0x5da0('0x38')](_0x5d38ae['model'],_0x5d38ae[_0x5da0('0x39')]);_0x102c53[_0x5da0('0x3a')]=_[_0x5da0('0x38')](_0x5d38ae[_0x5da0('0x3b')],qs[_0x5da0('0x3c')](_0x276ed2[_0x5da0('0x39')][_0x5da0('0x3c')]));_0x102c53[_0x5da0('0x3a')]=_0x102c53['attributes'][_0x5da0('0x3d')]?_0x102c53[_0x5da0('0x3a')]:_0x5d38ae['model'];if(!_0x276ed2[_0x5da0('0x39')]['hasOwnProperty'](_0x5da0('0x3e'))){_0x102c53[_0x5da0('0x3f')]=qs['limit'](_0x276ed2[_0x5da0('0x39')][_0x5da0('0x3f')]);_0x102c53[_0x5da0('0x21')]=qs[_0x5da0('0x21')](_0x276ed2[_0x5da0('0x39')]['offset']);}_0x102c53[_0x5da0('0x40')]=qs['sort'](_0x276ed2[_0x5da0('0x39')][_0x5da0('0x41')]);_0x102c53[_0x5da0('0x42')]=qs[_0x5da0('0x37')](_[_0x5da0('0x43')](_0x276ed2[_0x5da0('0x39')],_0x5d38ae[_0x5da0('0x37')]),_0x411a89);if(_0x276ed2[_0x5da0('0x39')][_0x5da0('0x44')]){_0x102c53[_0x5da0('0x42')]=_[_0x5da0('0x45')](_0x102c53['where'],{'$or':_[_0x5da0('0x32')](_0x411a89,function(_0xc5f536){if(_0xc5f536[_0x5da0('0x46')]!==_0x5da0('0x47')){var _0x513571={};_0x513571[_0xc5f536['name']]={'$like':'%'+_0x276ed2['query']['filter']+'%'};return _0x513571;}})});}_0x102c53=_[_0x5da0('0x45')]({},_0x102c53,_0x276ed2[_0x5da0('0x48')]);var _0x3f3a90={'where':_0x102c53[_0x5da0('0x42')]};return db[_0x5da0('0x33')][_0x5da0('0x20')](_0x3f3a90)[_0x5da0('0x29')](function(_0x36e4ac){_0x37066d['count']=_0x36e4ac;if(_0x276ed2[_0x5da0('0x39')][_0x5da0('0x49')]){_0x102c53[_0x5da0('0x4a')]=[{'all':!![]}];}return db[_0x5da0('0x33')][_0x5da0('0x4b')](_0x102c53);})[_0x5da0('0x29')](function(_0x949621){_0x37066d[_0x5da0('0x4c')]=_0x949621;return _0x37066d;})[_0x5da0('0x29')](respondWithFilteredResult(_0x28e0df,_0x102c53))[_0x5da0('0x4d')](handleError(_0x28e0df,null));};exports[_0x5da0('0x4e')]=function(_0x14d49b,_0x348ff8){var _0x38e9cc={'raw':![],'where':{'id':_0x14d49b[_0x5da0('0x4f')]['id']}},_0x335226={};_0x335226['model']=_[_0x5da0('0x36')](db['CmList'][_0x5da0('0x50')]);_0x335226[_0x5da0('0x39')]=_[_0x5da0('0x36')](_0x14d49b[_0x5da0('0x39')]);_0x335226['filters']=_[_0x5da0('0x38')](_0x335226['model'],_0x335226[_0x5da0('0x39')]);_0x38e9cc[_0x5da0('0x3a')]=_['intersection'](_0x335226[_0x5da0('0x3b')],qs[_0x5da0('0x3c')](_0x14d49b[_0x5da0('0x39')][_0x5da0('0x3c')]));_0x38e9cc[_0x5da0('0x3a')]=_0x38e9cc[_0x5da0('0x3a')]['length']?_0x38e9cc[_0x5da0('0x3a')]:_0x335226['model'];if(_0x14d49b[_0x5da0('0x39')]['includeAll']){_0x38e9cc[_0x5da0('0x4a')]=[{'all':!![]}];}_0x38e9cc=_[_0x5da0('0x45')]({},_0x38e9cc,_0x14d49b[_0x5da0('0x48')]);return db['CmList'][_0x5da0('0x51')](_0x38e9cc)['then'](handleEntityNotFound(_0x348ff8,null))[_0x5da0('0x29')](respondWithResult(_0x348ff8,null))['catch'](handleError(_0x348ff8,null));};exports[_0x5da0('0x52')]=function(_0x4389db,_0x52260d){return db[_0x5da0('0x33')][_0x5da0('0x52')](_0x4389db['body'],{})[_0x5da0('0x29')](function(_0x7f2f8e){var _0x192e39=_0x4389db['user'][_0x5da0('0x2b')]({'plain':!![]});if(!_0x192e39)throw new Error(_0x5da0('0x53'));if(_0x192e39['role']==='user'){var _0x3508b7=_0x7f2f8e[_0x5da0('0x2b')]({'plain':!![]});var _0x20efa9=_0x5da0('0x2c');return db[_0x5da0('0x54')]['find']({'where':{'name':_0x20efa9,'userProfileId':_0x192e39['userProfileId']},'raw':!![]})[_0x5da0('0x29')](function(_0x291c35){if(_0x291c35&&_0x291c35[_0x5da0('0x55')]===0x0){return db[_0x5da0('0x56')][_0x5da0('0x52')]({'name':_0x3508b7[_0x5da0('0x30')],'resourceId':_0x3508b7['id'],'type':_0x291c35[_0x5da0('0x30')],'sectionId':_0x291c35['id']},{})[_0x5da0('0x29')](function(){return _0x7f2f8e;});}else{return _0x7f2f8e;}})[_0x5da0('0x4d')](function(_0x2874ae){logger['error'](_0x5da0('0x57'),_0x2874ae);throw _0x2874ae;});}return _0x7f2f8e;})[_0x5da0('0x29')](respondWithResult(_0x52260d,0xc9))[_0x5da0('0x4d')](handleError(_0x52260d,null));};exports[_0x5da0('0x28')]=function(_0x56578e,_0x521538){if(_0x56578e[_0x5da0('0x58')]['id']){delete _0x56578e[_0x5da0('0x58')]['id'];}return db['CmList'][_0x5da0('0x51')]({'where':{'id':_0x56578e['params']['id']}})[_0x5da0('0x29')](handleEntityNotFound(_0x521538,null))[_0x5da0('0x29')](saveUpdates(_0x56578e[_0x5da0('0x58')],null))[_0x5da0('0x29')](respondWithResult(_0x521538,null))[_0x5da0('0x4d')](handleError(_0x521538,null));};exports[_0x5da0('0x2a')]=function(_0x1a755b,_0x51c4b9){return db[_0x5da0('0x33')]['find']({'where':{'id':_0x1a755b[_0x5da0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x51c4b9,null))[_0x5da0('0x29')](removeEntity(_0x51c4b9,null))['catch'](handleError(_0x51c4b9,null));};exports['describe']=function(_0x14d012,_0xb58040){return db[_0x5da0('0x33')][_0x5da0('0x59')]()[_0x5da0('0x29')](respondWithResult(_0xb58040,null))[_0x5da0('0x4d')](handleError(_0xb58040,null));};exports[_0x5da0('0x5a')]=function(_0x461fc7,_0x4e353e,_0x4ed497){if(_0x461fc7['body']['id']){delete _0x461fc7['body']['id'];}return db[_0x5da0('0x33')]['find']({'where':{'id':_0x461fc7[_0x5da0('0x4f')]['id']}})[_0x5da0('0x29')](handleEntityNotFound(_0x4e353e,null))[_0x5da0('0x29')](function(_0x1ead5a){if(_0x1ead5a){_0x461fc7[_0x5da0('0x58')][_0x5da0('0x5b')]=_0x1ead5a['id'];return db[_0x5da0('0x5c')][_0x5da0('0x52')](_0x461fc7['body']);}})[_0x5da0('0x29')](respondWithResult(_0x4e353e,null))[_0x5da0('0x4d')](handleError(_0x4e353e,null));};exports['getDispositions']=function(_0x292513,_0x1b02d4,_0xd7bb26){var _0xb8cc6e={'raw':![],'where':{}};var _0x152ca7={};var _0x2fb0fb={'count':0x0,'rows':[]};return db[_0x5da0('0x33')][_0x5da0('0x5d')]({'where':{'id':_0x292513[_0x5da0('0x4f')]['id']}})[_0x5da0('0x29')](handleEntityNotFound(_0x1b02d4,null))[_0x5da0('0x29')](function(_0x3b6f0b){if(_0x3b6f0b){_0x152ca7[_0x5da0('0x3b')]=_[_0x5da0('0x36')](db['Disposition'][_0x5da0('0x50')]);_0x152ca7['query']=_[_0x5da0('0x36')](_0x292513[_0x5da0('0x39')]);_0x152ca7['filters']=_[_0x5da0('0x38')](_0x152ca7['model'],_0x152ca7[_0x5da0('0x39')]);_0xb8cc6e[_0x5da0('0x3a')]=_[_0x5da0('0x38')](_0x152ca7[_0x5da0('0x3b')],qs[_0x5da0('0x3c')](_0x292513[_0x5da0('0x39')][_0x5da0('0x3c')]));_0xb8cc6e[_0x5da0('0x3a')]=_0xb8cc6e[_0x5da0('0x3a')][_0x5da0('0x3d')]?_0xb8cc6e['attributes']:_0x152ca7[_0x5da0('0x3b')];if(!_0x292513[_0x5da0('0x39')][_0x5da0('0x5e')](_0x5da0('0x3e'))){_0xb8cc6e[_0x5da0('0x3f')]=qs[_0x5da0('0x3f')](_0x292513['query'][_0x5da0('0x3f')]);_0xb8cc6e['offset']=qs[_0x5da0('0x21')](_0x292513[_0x5da0('0x39')][_0x5da0('0x21')]);}_0xb8cc6e['order']=qs[_0x5da0('0x41')](_0x292513[_0x5da0('0x39')][_0x5da0('0x41')]);_0xb8cc6e[_0x5da0('0x42')]=qs[_0x5da0('0x37')](_[_0x5da0('0x43')](_0x292513[_0x5da0('0x39')],_0x152ca7[_0x5da0('0x37')]));_0xb8cc6e[_0x5da0('0x42')][_0x5da0('0x5b')]=_0x3b6f0b['id'];if(_0x292513[_0x5da0('0x39')][_0x5da0('0x44')]){_0xb8cc6e['where']=_[_0x5da0('0x45')](_0xb8cc6e[_0x5da0('0x42')],{'$or':_[_0x5da0('0x32')](_0xb8cc6e[_0x5da0('0x3a')],function(_0x3ad0b9){var _0x41d663={};_0x41d663[_0x3ad0b9]={'$like':'%'+_0x292513[_0x5da0('0x39')][_0x5da0('0x44')]+'%'};return _0x41d663;})});}_0xb8cc6e=_[_0x5da0('0x45')]({},_0xb8cc6e,_0x292513[_0x5da0('0x48')]);return db[_0x5da0('0x5c')][_0x5da0('0x20')]({'where':_0xb8cc6e[_0x5da0('0x42')]})[_0x5da0('0x29')](function(_0x2032e5){_0x2fb0fb[_0x5da0('0x20')]=_0x2032e5;if(_0x292513['query'][_0x5da0('0x49')]){_0xb8cc6e['include']=[{'all':!![]}];}return db[_0x5da0('0x5c')]['findAll'](_0xb8cc6e);})[_0x5da0('0x29')](function(_0x169b5a){_0x2fb0fb[_0x5da0('0x4c')]=_0x169b5a;return _0x2fb0fb;});}})[_0x5da0('0x29')](respondWithFilteredResult(_0x1b02d4,_0xb8cc6e))[_0x5da0('0x4d')](handleError(_0x1b02d4,null));};exports[_0x5da0('0x5f')]=function(_0x35edba,_0x5b9f81,_0x519924){return db['CmList'][_0x5da0('0x51')]({'where':{'id':_0x35edba[_0x5da0('0x4f')]['id']}})[_0x5da0('0x29')](handleEntityNotFound(_0x5b9f81,null))[_0x5da0('0x29')](function(_0x4eafb3){if(_0x4eafb3){return _0x4eafb3[_0x5da0('0x5f')](_0x35edba[_0x5da0('0x39')][_0x5da0('0x60')]);}})[_0x5da0('0x29')](respondWithStatusCode(_0x5b9f81,null))[_0x5da0('0x4d')](handleError(_0x5b9f81,null));};exports['addContacts']=function(_0xf295f2,_0x28609d,_0x440513){return db[_0x5da0('0x33')][_0x5da0('0x51')]({'where':{'id':_0xf295f2[_0x5da0('0x4f')]['id']}})[_0x5da0('0x29')](handleEntityNotFound(_0x28609d,null))['then'](function(_0x644434){if(_0x644434){var _0x3a630b=[];var _0x2e42be={'success':[],'errors':[]};return db[_0x5da0('0x61')]['describe']()['then'](function(_0x186f5d){if(_0xf295f2[_0x5da0('0x58')][_0x5da0('0x62')]&&_[_0x5da0('0x63')](_0xf295f2[_0x5da0('0x58')][_0x5da0('0x62')])){if(_0xf295f2[_0x5da0('0x58')][_0x5da0('0x62')][_0x5da0('0x3d')]){_0xf295f2[_0x5da0('0x58')][_0x5da0('0x62')]=_0xf295f2[_0x5da0('0x58')]['tags'][_0x5da0('0x64')](';')+';';}else{_0xf295f2['body'][_0x5da0('0x62')]=null;}}else{_0xf295f2[_0x5da0('0x58')][_0x5da0('0x62')]=null;}if(_0xf295f2[_0x5da0('0x58')]&&_['isArray'](_0xf295f2['body'])){for(var _0x40f431=0x0;_0x40f431<_0xf295f2[_0x5da0('0x58')][_0x5da0('0x3d')];_0x40f431+=0x1){_0xf295f2[_0x5da0('0x58')][_0x40f431][_0x5da0('0x5b')]=_0xf295f2[_0x5da0('0x4f')]['id'];_0x3a630b[_0x5da0('0x65')](_0xf295f2['body'][_0x40f431]);}return BPromise[_0x5da0('0x66')](_0x3a630b,function(_0x591945){return db[_0x5da0('0x61')][_0x5da0('0x52')](_[_0x5da0('0x67')](_0x591945,[_0x5da0('0x60'),'id'])||{},{'fields':_[_0x5da0('0x36')](_0x186f5d),'raw':!![]})[_0x5da0('0x29')](function(_0xd3a783){_0x2e42be[_0x5da0('0x68')][_0x5da0('0x65')](_0xd3a783['dataValues']);})[_0x5da0('0x4d')](function(_0x1d2ee2){_0x2e42be[_0x5da0('0x69')][_0x5da0('0x65')]({'data':_0x591945,'error':_0x1d2ee2['message']});});})['then'](function(_0x4d1d5d){return _0x2e42be;})['catch'](function(_0x3833e5){return _0x3833e5;});}else{_0x28609d['status'](0x190)[_0x5da0('0x24')]({'message':_0x5da0('0x6a')});}});}})[_0x5da0('0x29')](respondWithResult(_0x28609d,null))['catch'](handleError(_0x28609d,null));};exports[_0x5da0('0x6b')]=function(_0x5688e6,_0x37379f,_0x4292e9){var _0x2ffb7e;return db['CmList']['find']({'where':{'id':_0x5688e6[_0x5da0('0x4f')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x5da0('0x6c')}]})[_0x5da0('0x29')](handleEntityNotFound(_0x37379f,null))[_0x5da0('0x29')](function(_0x53b3db){if(_0x53b3db){_0x2ffb7e=_0x53b3db;return db[_0x5da0('0x61')][_0x5da0('0x50')];}})['then'](function(_0x58fa65){if(_0x58fa65){var _0x2f87b6={};var _0x18ce8f={};_0x18ce8f[_0x5da0('0x3b')]=_['concat'](_[_0x5da0('0x36')](_0x58fa65),_[_0x5da0('0x32')](_0x2ffb7e[_0x5da0('0x6c')],function(_0x462e5f){return util[_0x5da0('0x6d')]('cf_%d',_0x462e5f['id']);}));_0x18ce8f['query']=_[_0x5da0('0x36')](_0x5688e6[_0x5da0('0x39')]);_0x18ce8f[_0x5da0('0x37')]=_['intersection'](_0x18ce8f[_0x5da0('0x3b')],_0x18ce8f[_0x5da0('0x39')]);_0x2f87b6[_0x5da0('0x3a')]=_[_0x5da0('0x38')](_0x18ce8f[_0x5da0('0x3b')],qs[_0x5da0('0x3c')](_0x5688e6[_0x5da0('0x39')][_0x5da0('0x3c')]));_0x2f87b6[_0x5da0('0x3a')]=_0x2f87b6['attributes']['length']?_0x2f87b6[_0x5da0('0x3a')]:_0x18ce8f[_0x5da0('0x3b')];if(!_0x5688e6[_0x5da0('0x39')][_0x5da0('0x5e')](_0x5da0('0x3e'))){_0x2f87b6[_0x5da0('0x3f')]=qs[_0x5da0('0x3f')](_0x5688e6['query'][_0x5da0('0x3f')]);_0x2f87b6[_0x5da0('0x21')]=qs['offset'](_0x5688e6[_0x5da0('0x39')][_0x5da0('0x21')]);}_0x2f87b6[_0x5da0('0x40')]=qs[_0x5da0('0x41')](_0x5688e6['query']['sort']);_0x2f87b6[_0x5da0('0x42')]=qs['filters'](_[_0x5da0('0x43')](_0x5688e6[_0x5da0('0x39')],_0x18ce8f['filters']));_0x2f87b6[_0x5da0('0x6e')]=!![];if(_0x5688e6[_0x5da0('0x39')][_0x5da0('0x44')]){_0x2f87b6[_0x5da0('0x42')]=_['merge'](_0x2f87b6['where'],{'$or':_['map'](_0x2f87b6['attributes'],function(_0x42fdc5){var _0x6e13ee={};_0x6e13ee[_0x42fdc5]={'$like':'%'+_0x5688e6[_0x5da0('0x39')]['filter']+'%'};return _0x6e13ee;})});}_0x2f87b6=_[_0x5da0('0x45')]({},_0x2f87b6,_0x5688e6['options']);return _0x2ffb7e['getContacts'](_0x2f87b6);}})[_0x5da0('0x29')](respondWithResult(_0x37379f,null))[_0x5da0('0x4d')](handleError(_0x37379f,null));};exports['getContactsCsv']=function(_0x191a70,_0x1812bf,_0x20cb9e){var _0x34b805;return db[_0x5da0('0x33')]['find']({'where':{'id':_0x191a70['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x5da0('0x6c')}]})['then'](handleEntityNotFound(_0x1812bf,null))[_0x5da0('0x29')](function(_0x47eac0){if(_0x47eac0){_0x34b805=_0x47eac0;return db[_0x5da0('0x61')][_0x5da0('0x50')];}})[_0x5da0('0x29')](function(_0x1b5e84){if(_0x1b5e84){var _0x5d7610={};var _0x9ae2f5={};_0x9ae2f5[_0x5da0('0x3b')]=_[_0x5da0('0x6f')](_['keys'](_0x1b5e84),_['map'](_0x34b805[_0x5da0('0x6c')],function(_0x465bbf){return util[_0x5da0('0x6d')]('cf_%d',_0x465bbf['id']);}));_0x9ae2f5[_0x5da0('0x39')]=_[_0x5da0('0x36')](_0x191a70[_0x5da0('0x39')]);_0x9ae2f5[_0x5da0('0x37')]=_['intersection'](_0x9ae2f5[_0x5da0('0x3b')],_0x9ae2f5[_0x5da0('0x39')]);_0x5d7610[_0x5da0('0x3a')]=_[_0x5da0('0x38')](_0x9ae2f5[_0x5da0('0x3b')],qs[_0x5da0('0x3c')](_0x191a70[_0x5da0('0x39')][_0x5da0('0x3c')]));_0x5d7610[_0x5da0('0x3a')]=_0x5d7610[_0x5da0('0x3a')][_0x5da0('0x3d')]?_0x5d7610['attributes']:_0x9ae2f5[_0x5da0('0x3b')];if(!_0x191a70['query'][_0x5da0('0x5e')](_0x5da0('0x3e'))){_0x5d7610[_0x5da0('0x3f')]=qs['limit'](_0x191a70[_0x5da0('0x39')][_0x5da0('0x3f')]);_0x5d7610['offset']=qs[_0x5da0('0x21')](_0x191a70['query'][_0x5da0('0x21')]);}_0x5d7610[_0x5da0('0x40')]=qs[_0x5da0('0x41')](_0x191a70[_0x5da0('0x39')][_0x5da0('0x41')]);_0x5d7610['where']=qs['filters'](_['pick'](_0x191a70[_0x5da0('0x39')],_0x9ae2f5[_0x5da0('0x37')]));_0x5d7610['raw']=!![];if(_0x191a70[_0x5da0('0x39')][_0x5da0('0x44')]){_0x5d7610[_0x5da0('0x42')]=_['merge'](_0x5d7610[_0x5da0('0x42')],{'$or':_['map'](_0x5d7610[_0x5da0('0x3a')],function(_0x120ec7){var _0x2f6e7e={};_0x2f6e7e[_0x120ec7]={'$like':'%'+_0x191a70['query'][_0x5da0('0x44')]+'%'};return _0x2f6e7e;})});}_0x5d7610=_[_0x5da0('0x45')]({},_0x5d7610,_0x191a70[_0x5da0('0x48')]);return _0x34b805[_0x5da0('0x6b')](_0x5d7610);}})['then'](function(_0xd25818){if(!_[_0x5da0('0x70')](_0xd25818)){var _0x401880=toCsv(_0xd25818);var _0x3c6fe2=Date[_0x5da0('0x71')]();fs[_0x5da0('0x72')](util[_0x5da0('0x6d')]('/tmp/list_%d_%s.csv',_0x34b805['id'],_0x3c6fe2),_0x401880);_0x1812bf['setHeader'](_0x5da0('0x73'),'attachment;\x20filename='+util[_0x5da0('0x6d')](_0x5da0('0x74'),_0x34b805['id'],_0x3c6fe2));_0x1812bf['setHeader'](_0x5da0('0x75'),_0x5da0('0x76'));return _0x1812bf[_0x5da0('0x77')](util[_0x5da0('0x6d')](_0x5da0('0x78'),_0x34b805['id'],_0x3c6fe2));}else{return _0x1812bf['sendStatus'](0xcc);}})['catch'](handleError(_0x1812bf,null));};exports[_0x5da0('0x79')]=function(_0x5d9519,_0x170212,_0x4f94a3){var _0x4e6751;delete _0x5d9519[_0x5da0('0x58')]['id'];return db[_0x5da0('0x33')]['findOne']({'where':{'id':_0x5d9519[_0x5da0('0x4f')]['id']}})[_0x5da0('0x29')](handleEntityNotFound(_0x170212,null))['then'](function(_0x105f76){if(_0x105f76){return db[_0x5da0('0x7a')][_0x5da0('0x7b')](function(_0x1fbaea){return db[_0x5da0('0x7c')][_0x5da0('0x52')](_0x5d9519[_0x5da0('0x58')],{'transaction':_0x1fbaea})[_0x5da0('0x29')](function(_0x11438e){_0x4e6751=_0x11438e;return _0x105f76[_0x5da0('0x7d')](_0x11438e,{'transaction':_0x1fbaea});})[_0x5da0('0x29')](function(){var _0x2ed46b={'type':db[_0x5da0('0x7e')][_0x5da0('0x7f')],'transaction':_0x1fbaea};switch(_0x5d9519[_0x5da0('0x58')][_0x5da0('0x46')]){case'text':_0x2ed46b['type']=db[_0x5da0('0x7e')]['TEXT'];break;case'number':_0x2ed46b[_0x5da0('0x46')]=db[_0x5da0('0x7e')]['INTEGER'];break;case _0x5da0('0x80'):_0x2ed46b['type']=db[_0x5da0('0x7e')][_0x5da0('0x81')];_0x2ed46b[_0x5da0('0x82')]=![];break;default:}return db[_0x5da0('0x7a')][_0x5da0('0x83')][_0x5da0('0x84')]('cm_contacts',util['format']('cf_%s',_0x4e6751['id']),_0x2ed46b);})[_0x5da0('0x29')](function(){return _0x4e6751;});});}})['then'](respondWithResult(_0x170212,null))[_0x5da0('0x4d')](handleError(_0x170212,null));};exports[_0x5da0('0x85')]=function(_0x1c5232,_0x896c5f,_0x54d1c9){var _0x149d85={};var _0x4b959f={};var _0x29c6a0;var _0x2253c0;return db[_0x5da0('0x33')]['findOne']({'where':{'id':_0x1c5232[_0x5da0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x896c5f,null))[_0x5da0('0x29')](function(_0x1dde93){if(_0x1dde93){_0x29c6a0=_0x1dde93;_0x4b959f[_0x5da0('0x3b')]=_[_0x5da0('0x36')](db[_0x5da0('0x7c')][_0x5da0('0x50')]);_0x4b959f[_0x5da0('0x39')]=_[_0x5da0('0x36')](_0x1c5232[_0x5da0('0x39')]);_0x4b959f[_0x5da0('0x37')]=_[_0x5da0('0x38')](_0x4b959f[_0x5da0('0x3b')],_0x4b959f[_0x5da0('0x39')]);_0x149d85[_0x5da0('0x3a')]=_[_0x5da0('0x38')](_0x4b959f[_0x5da0('0x3b')],qs[_0x5da0('0x3c')](_0x1c5232[_0x5da0('0x39')][_0x5da0('0x3c')]));_0x149d85['attributes']=_0x149d85['attributes'][_0x5da0('0x3d')]?_0x149d85[_0x5da0('0x3a')]:_0x4b959f[_0x5da0('0x3b')];_0x149d85[_0x5da0('0x40')]=qs[_0x5da0('0x41')](_0x1c5232[_0x5da0('0x39')][_0x5da0('0x41')]);_0x149d85['where']=qs[_0x5da0('0x37')](_[_0x5da0('0x43')](_0x1c5232['query'],_0x4b959f['filters']));_0x149d85[_0x5da0('0x42')]=_['merge'](_0x149d85[_0x5da0('0x42')],{'$or':[{'ListId':_0x1dde93['id']},{'ListId':null}]});if(_0x1c5232[_0x5da0('0x39')][_0x5da0('0x44')]){_0x149d85[_0x5da0('0x42')]=_[_0x5da0('0x45')](_0x149d85[_0x5da0('0x42')],{'$or':_[_0x5da0('0x32')](_0x149d85[_0x5da0('0x3a')],function(_0x46d994){var _0x22f866={};_0x22f866[_0x46d994]={'$like':'%'+_0x1c5232[_0x5da0('0x39')][_0x5da0('0x44')]+'%'};return _0x22f866;})});}_0x149d85=_[_0x5da0('0x45')]({},_0x149d85,_0x1c5232['options']);return db[_0x5da0('0x7c')][_0x5da0('0x86')](_0x149d85);}})[_0x5da0('0x29')](respondWithResult(_0x896c5f,null))['catch'](handleError(_0x896c5f,null));};exports[_0x5da0('0x87')]=function(_0x2b90cd,_0x443236,_0x36664f){return db[_0x5da0('0x33')][_0x5da0('0x51')]({'where':{'id':_0x2b90cd['params']['id']}})[_0x5da0('0x29')](handleEntityNotFound(_0x443236,null))[_0x5da0('0x29')](function(_0x2b5f6e){if(_0x2b5f6e){return _0x2b5f6e[_0x5da0('0x87')](_0x2b90cd[_0x5da0('0x58')][_0x5da0('0x60')],_[_0x5da0('0x67')](_0x2b90cd[_0x5da0('0x58')],[_0x5da0('0x60'),'id'])||{})[_0x5da0('0x88')](function(_0x286789){for(var _0x59342d=0x0;_0x59342d<_0x2b90cd[_0x5da0('0x58')]['ids']['length'];_0x59342d+=0x1){socket[_0x5da0('0x89')](_0x5da0('0x8a'),{'UserId':_0x2b90cd['body'][_0x5da0('0x60')][_0x59342d],'CmListId':_0x2b90cd[_0x5da0('0x4f')]['id']});}return _0x286789;});}})[_0x5da0('0x29')](respondWithResult(_0x443236,null))[_0x5da0('0x4d')](handleError(_0x443236,null));};exports[_0x5da0('0x8b')]=function(_0x1b6a00,_0x4bc5b8,_0x446f12){return db[_0x5da0('0x33')][_0x5da0('0x51')]({'where':{'id':_0x1b6a00[_0x5da0('0x4f')]['id']}})[_0x5da0('0x29')](handleEntityNotFound(_0x4bc5b8,null))[_0x5da0('0x29')](function(_0x53ea3e){if(_0x53ea3e){return _0x53ea3e['removeAgents'](_0x1b6a00['query'][_0x5da0('0x60')])[_0x5da0('0x29')](function(){if(_['isArray'](_0x1b6a00['query'][_0x5da0('0x60')])){for(var _0x98ba68=0x0;_0x98ba68<_0x1b6a00[_0x5da0('0x39')]['ids'][_0x5da0('0x3d')];_0x98ba68+=0x1){socket['emit'](_0x5da0('0x8c'),{'UserId':Number(_0x1b6a00[_0x5da0('0x39')][_0x5da0('0x60')][_0x98ba68]),'CmListId':Number(_0x1b6a00[_0x5da0('0x4f')]['id'])});}}else{socket['emit'](_0x5da0('0x8c'),{'UserId':Number(_0x1b6a00['query'][_0x5da0('0x60')]),'CmListId':Number(_0x1b6a00[_0x5da0('0x4f')]['id'])});}});}})[_0x5da0('0x29')](respondWithStatusCode(_0x4bc5b8,null))[_0x5da0('0x4d')](handleError(_0x4bc5b8,null));};exports['getAgents']=function(_0x31a918,_0x388c5e,_0x1c634d){var _0x289eef={};var _0x49f698={};var _0x261e0d;var _0x43346b;return db[_0x5da0('0x33')]['findOne']({'where':{'id':_0x31a918['params']['id']}})['then'](handleEntityNotFound(_0x388c5e,null))['then'](function(_0x2ab88b){if(_0x2ab88b){_0x261e0d=_0x2ab88b;_0x49f698['model']=_[_0x5da0('0x36')](db[_0x5da0('0x8d')][_0x5da0('0x50')]);_0x49f698[_0x5da0('0x39')]=_[_0x5da0('0x36')](_0x31a918[_0x5da0('0x39')]);_0x49f698[_0x5da0('0x37')]=_[_0x5da0('0x38')](_0x49f698['model'],_0x49f698[_0x5da0('0x39')]);_0x289eef[_0x5da0('0x3a')]=_[_0x5da0('0x38')](_0x49f698[_0x5da0('0x3b')],qs['fields'](_0x31a918[_0x5da0('0x39')][_0x5da0('0x3c')]));_0x289eef[_0x5da0('0x3a')]=_0x289eef[_0x5da0('0x3a')][_0x5da0('0x3d')]?_0x289eef[_0x5da0('0x3a')]:_0x49f698[_0x5da0('0x3b')];_0x289eef[_0x5da0('0x40')]=qs['sort'](_0x31a918['query']['sort']);_0x289eef[_0x5da0('0x42')]=qs[_0x5da0('0x37')](_[_0x5da0('0x43')](_0x31a918[_0x5da0('0x39')],_0x49f698[_0x5da0('0x37')]));if(_0x31a918[_0x5da0('0x39')][_0x5da0('0x44')]){_0x289eef['where']=_['merge'](_0x289eef[_0x5da0('0x42')],{'$or':_['map'](_0x289eef[_0x5da0('0x3a')],function(_0x10e962){var _0x2e0ebb={};_0x2e0ebb[_0x10e962]={'$like':'%'+_0x31a918['query'][_0x5da0('0x44')]+'%'};return _0x2e0ebb;})});}_0x289eef=_[_0x5da0('0x45')]({},_0x289eef,_0x31a918[_0x5da0('0x48')]);return _0x261e0d[_0x5da0('0x8e')](_0x289eef);}})[_0x5da0('0x29')](function(_0x4f8f7b){if(_0x4f8f7b){_0x43346b=_0x4f8f7b['length'];if(!_0x31a918[_0x5da0('0x39')][_0x5da0('0x5e')]('nolimit')){_0x289eef[_0x5da0('0x3f')]=qs[_0x5da0('0x3f')](_0x31a918[_0x5da0('0x39')][_0x5da0('0x3f')]);_0x289eef[_0x5da0('0x21')]=qs[_0x5da0('0x21')](_0x31a918[_0x5da0('0x39')][_0x5da0('0x21')]);}return _0x261e0d[_0x5da0('0x8e')](_0x289eef);}})['then'](function(_0x498ec9){if(_0x498ec9){return _0x498ec9?{'count':_0x43346b,'rows':_0x498ec9}:null;}})[_0x5da0('0x29')](respondWithResult(_0x388c5e,null))[_0x5da0('0x4d')](handleError(_0x388c5e,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 98185b2..bd9ca1b 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 _0xf1ba=['exports','events','CmList','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf1ba,0x17b));var _0xaf1b=function(_0x8e5112,_0x7cab1f){_0x8e5112=_0x8e5112-0x0;var _0x2f1f31=_0xf1ba[_0x8e5112];return _0x2f1f31;};'use strict';var EventEmitter=require(_0xaf1b('0x0'));var CmList=require('../../mysqldb')['db'][_0xaf1b('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0xaf1b('0x2')](0x0);var events={'afterCreate':_0xaf1b('0x3'),'afterUpdate':_0xaf1b('0x4'),'afterDestroy':_0xaf1b('0x5')};function emitEvent(_0x5c1e42){return function(_0x2fe656,_0x559e50,_0x1962cc){CmListEvents[_0xaf1b('0x6')](_0x5c1e42+':'+_0x2fe656['id'],_0x2fe656);CmListEvents[_0xaf1b('0x6')](_0x5c1e42,_0x2fe656);_0x1962cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xaf1b('0x7')](e,emitEvent(event));}}module[_0xaf1b('0x8')]=CmListEvents; \ No newline at end of file +var _0xa249=['emit','hasOwnProperty','hook','exports','../../mysqldb','CmList','setMaxListeners','update','remove'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xa249,0x109));var _0x9a24=function(_0x5f1a94,_0x55307d){_0x5f1a94=_0x5f1a94-0x0;var _0x3f8287=_0xa249[_0x5f1a94];return _0x3f8287;};'use strict';var EventEmitter=require('events');var CmList=require(_0x9a24('0x0'))['db'][_0x9a24('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x9a24('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a24('0x3'),'afterDestroy':_0x9a24('0x4')};function emitEvent(_0x4be3ed){return function(_0x49c825,_0x525d99,_0x591076){CmListEvents[_0x9a24('0x5')](_0x4be3ed+':'+_0x49c825['id'],_0x49c825);CmListEvents[_0x9a24('0x5')](_0x4be3ed,_0x49c825);_0x591076(null);};}for(var e in events){if(events[_0x9a24('0x6')](e)){var event=events[e];CmList[_0x9a24('0x7')](e,emitEvent(event));}}module[_0x9a24('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 82db37a..b6a8a60 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 _0xf820=['define','CmList','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf820,0x86));var _0x0f82=function(_0x1902d8,_0x2927c4){_0x1902d8=_0x1902d8-0x0;var _0x29b5e1=_0xf820[_0x1902d8];return _0x29b5e1;};'use strict';var _=require(_0x0f82('0x0'));var util=require(_0x0f82('0x1'));var logger=require(_0x0f82('0x2'))('api');var moment=require(_0x0f82('0x3'));var BPromise=require(_0x0f82('0x4'));var rp=require(_0x0f82('0x5'));var fs=require('fs');var path=require(_0x0f82('0x6'));var rimraf=require(_0x0f82('0x7'));var config=require(_0x0f82('0x8'));var attributes=require(_0x0f82('0x9'));module['exports']=function(_0x169e1c,_0x3c8dd5){return _0x169e1c[_0x0f82('0xa')](_0x0f82('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe74b=['bluebird','path','rimraf','./cmList.attributes','exports','define','CmList','../../config/logger','moment'];(function(_0x4e10e9,_0x557389){var _0x27e73c=function(_0x2e0009){while(--_0x2e0009){_0x4e10e9['push'](_0x4e10e9['shift']());}};_0x27e73c(++_0x557389);}(_0xe74b,0xd6));var _0xbe74=function(_0x6efe75,_0x465b7b){_0x6efe75=_0x6efe75-0x0;var _0x2d349c=_0xe74b[_0x6efe75];return _0x2d349c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbe74('0x0'))('api');var moment=require(_0xbe74('0x1'));var BPromise=require(_0xbe74('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe74('0x3'));var rimraf=require(_0xbe74('0x4'));var config=require('../../config/environment');var attributes=require(_0xbe74('0x5'));module[_0xbe74('0x6')]=function(_0x3fe249,_0xd61b91){return _0x3fe249[_0xbe74('0x7')](_0xbe74('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 4508362..d8618a6 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 _0xa038=['redis','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter'];(function(_0x2f9b44,_0x6b2a92){var _0x7bdfd0=function(_0x1c109d){while(--_0x1c109d){_0x2f9b44['push'](_0x2f9b44['shift']());}};_0x7bdfd0(++_0x6b2a92);}(_0xa038,0x197));var _0x8a03=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xa038[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x8a03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a03('0x1'));var rs=require(_0x8a03('0x2'));var fs=require('fs');var Redis=require(_0x8a03('0x3'));var db=require(_0x8a03('0x4'))['db'];var utils=require(_0x8a03('0x5'));var logger=require(_0x8a03('0x6'))(_0x8a03('0x7'));var config=require(_0x8a03('0x8'));var jayson=require(_0x8a03('0x9'));var client=jayson['client'][_0x8a03('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x8a03('0xb'),'port':0x18eb});var socket=require(_0x8a03('0xc'))(new Redis(config[_0x8a03('0xd')]));require(_0x8a03('0xe'))[_0x8a03('0xf')](socket);function respondWithRpcPromise(_0x40954b,_0x446ccd,_0x8736fc){return new BPromise(function(_0x2fb62d,_0x4f6b64){return client[_0x8a03('0x10')](_0x40954b,_0x8736fc)[_0x8a03('0x11')](function(_0x52d606){logger[_0x8a03('0x12')]('CmList,\x20%s,\x20%s',_0x446ccd,_0x8a03('0x13'));logger[_0x8a03('0x14')](_0x8a03('0x15'),_0x446ccd,'request\x20sent',JSON[_0x8a03('0x16')](_0x52d606));if(_0x52d606[_0x8a03('0x17')]){if(_0x52d606['error'][_0x8a03('0x18')]===0x1f4){logger[_0x8a03('0x17')](_0x8a03('0x19'),_0x446ccd,_0x52d606[_0x8a03('0x17')][_0x8a03('0x1a')]);return _0x4f6b64(_0x52d606[_0x8a03('0x17')][_0x8a03('0x1a')]);}logger[_0x8a03('0x17')](_0x8a03('0x19'),_0x446ccd,_0x52d606['error'][_0x8a03('0x1a')]);return _0x2fb62d(_0x52d606[_0x8a03('0x17')][_0x8a03('0x1a')]);}else{logger[_0x8a03('0x12')](_0x8a03('0x19'),_0x446ccd,_0x8a03('0x13'));_0x2fb62d(_0x52d606['result'][_0x8a03('0x1a')]);}})[_0x8a03('0x1b')](function(_0x50b94b){logger[_0x8a03('0x17')](_0x8a03('0x19'),_0x446ccd,_0x50b94b);_0x4f6b64(_0x50b94b);});});} \ No newline at end of file +var _0x1b3d=['stringify','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x1b3d,0x18c));var _0xd1b3=function(_0x4b4340,_0x13e6df){_0x4b4340=_0x4b4340-0x0;var _0x4346c4=_0x1b3d[_0x4b4340];return _0x4346c4;};'use strict';var _=require(_0xd1b3('0x0'));var util=require(_0xd1b3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd1b3('0x2'));var fs=require('fs');var Redis=require(_0xd1b3('0x3'));var db=require(_0xd1b3('0x4'))['db'];var utils=require(_0xd1b3('0x5'));var logger=require(_0xd1b3('0x6'))(_0xd1b3('0x7'));var config=require(_0xd1b3('0x8'));var jayson=require(_0xd1b3('0x9'));var client=jayson[_0xd1b3('0xa')][_0xd1b3('0xb')]({'port':0x232a});config['redis']=_[_0xd1b3('0xc')](config[_0xd1b3('0xd')],{'host':_0xd1b3('0xe'),'port':0x18eb});var socket=require(_0xd1b3('0xf'))(new Redis(config['redis']));require(_0xd1b3('0x10'))[_0xd1b3('0x11')](socket);function respondWithRpcPromise(_0x526b73,_0x430429,_0x4a76df){return new BPromise(function(_0x2e59b7,_0xc2217f){return client[_0xd1b3('0x12')](_0x526b73,_0x4a76df)[_0xd1b3('0x13')](function(_0x522c5e){logger[_0xd1b3('0x14')](_0xd1b3('0x15'),_0x430429,_0xd1b3('0x16'));logger[_0xd1b3('0x17')]('CmList,\x20%s,\x20%s,\x20%s',_0x430429,_0xd1b3('0x16'),JSON[_0xd1b3('0x18')](_0x522c5e));if(_0x522c5e['error']){if(_0x522c5e[_0xd1b3('0x19')]['code']===0x1f4){logger[_0xd1b3('0x19')]('CmList,\x20%s,\x20%s',_0x430429,_0x522c5e['error']['message']);return _0xc2217f(_0x522c5e[_0xd1b3('0x19')]['message']);}logger[_0xd1b3('0x19')]('CmList,\x20%s,\x20%s',_0x430429,_0x522c5e['error'][_0xd1b3('0x1a')]);return _0x2e59b7(_0x522c5e[_0xd1b3('0x19')]['message']);}else{logger[_0xd1b3('0x14')](_0xd1b3('0x15'),_0x430429,_0xd1b3('0x16'));_0x2e59b7(_0x522c5e['result']['message']);}})[_0xd1b3('0x1b')](function(_0x5dfbe2){logger[_0xd1b3('0x19')](_0xd1b3('0x15'),_0x430429,_0x5dfbe2);_0xc2217f(_0x5dfbe2);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index dbbdbcb..ac3fdc4 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 _0x5549=['emit','removeListener','length','cmList:','./cmList.events','save','remove','update'];(function(_0x44718d,_0x2b7280){var _0x1232b0=function(_0x1ca2c4){while(--_0x1ca2c4){_0x44718d['push'](_0x44718d['shift']());}};_0x1232b0(++_0x2b7280);}(_0x5549,0x1f4));var _0x9554=function(_0x4dc318,_0x348f33){_0x4dc318=_0x4dc318-0x0;var _0x1842a1=_0x5549[_0x4dc318];return _0x1842a1;};'use strict';var CmListEvents=require(_0x9554('0x0'));var events=[_0x9554('0x1'),_0x9554('0x2'),_0x9554('0x3')];function createListener(_0x153cf2,_0x53ff34){return function(_0x1a31f7){_0x53ff34[_0x9554('0x4')](_0x153cf2,_0x1a31f7);};}function removeListener(_0x244b13,_0x36fc55){return function(){CmListEvents[_0x9554('0x5')](_0x244b13,_0x36fc55);};}exports['register']=function(_0x3a0631){for(var _0x4e8442=0x0,_0x456914=events[_0x9554('0x6')];_0x4e8442<_0x456914;_0x4e8442++){var _0xac6b80=events[_0x4e8442];var _0x5afdf7=createListener(_0x9554('0x7')+_0xac6b80,_0x3a0631);CmListEvents['on'](_0xac6b80,_0x5afdf7);}}; \ No newline at end of file +var _0xa1f6=['save','remove','update','register','length','./cmList.events'];(function(_0x29db25,_0x457467){var _0x48b1a5=function(_0x5cb05f){while(--_0x5cb05f){_0x29db25['push'](_0x29db25['shift']());}};_0x48b1a5(++_0x457467);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0xa1f6[_0x45aa72];return _0x75adaa;};'use strict';var CmListEvents=require(_0x6a1f('0x0'));var events=[_0x6a1f('0x1'),_0x6a1f('0x2'),_0x6a1f('0x3')];function createListener(_0x198e14,_0x123ad4){return function(_0x5cf561){_0x123ad4['emit'](_0x198e14,_0x5cf561);};}function removeListener(_0x521944,_0x5d4ad7){return function(){CmListEvents['removeListener'](_0x521944,_0x5d4ad7);};}exports[_0x6a1f('0x4')]=function(_0x426ae1){for(var _0xa1c928=0x0,_0x3a772b=events[_0x6a1f('0x5')];_0xa1c928<_0x3a772b;_0xa1c928++){var _0x3ecd63=events[_0xa1c928];var _0x36c00b=createListener('cmList:'+_0x3ecd63,_0x426ae1);CmListEvents['on'](_0x3ecd63,_0x36c00b);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a613290..c839ce8 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 _0x4421=['./cmList.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','/:id/contacts','addContacts','addCustomField','/:id/users','addAgents','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b3d12,_0x1d4133){var _0x104e8c=function(_0x55db69){while(--_0x55db69){_0x4b3d12['push'](_0x4b3d12['shift']());}};_0x104e8c(++_0x1d4133);}(_0x4421,0x163));var _0x1442=function(_0x121c8d,_0x5d71b9){_0x121c8d=_0x121c8d-0x0;var _0x46cb16=_0x4421[_0x121c8d];return _0x46cb16;};'use strict';var multer=require('multer');var util=require(_0x1442('0x0'));var path=require(_0x1442('0x1'));var timeout=require(_0x1442('0x2'));var express=require(_0x1442('0x3'));var router=express[_0x1442('0x4')]();var auth=require(_0x1442('0x5'));var interaction=require(_0x1442('0x6'));var config=require(_0x1442('0x7'));var controller=require(_0x1442('0x8'));router[_0x1442('0x9')]('/',auth[_0x1442('0xa')](),controller[_0x1442('0xb')]);router[_0x1442('0x9')](_0x1442('0xc'),auth[_0x1442('0xa')](),controller['describe']);router[_0x1442('0x9')](_0x1442('0xd'),auth[_0x1442('0xa')](),controller[_0x1442('0xe')]);router[_0x1442('0x9')](_0x1442('0xf'),auth[_0x1442('0xa')](),controller[_0x1442('0x10')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x1442('0x11')]);router[_0x1442('0x9')]('/:id/contacts/csv',auth[_0x1442('0xa')](),controller[_0x1442('0x12')]);router[_0x1442('0x9')](_0x1442('0x13'),auth['isAuthenticated'](),controller[_0x1442('0x14')]);router[_0x1442('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x1442('0x15')]);router[_0x1442('0x16')]('/',auth[_0x1442('0xa')](),controller[_0x1442('0x17')]);router[_0x1442('0x16')]('/:id/dispositions',auth[_0x1442('0xa')](),controller['addDisposition']);router[_0x1442('0x16')](_0x1442('0x18'),auth[_0x1442('0xa')](),controller[_0x1442('0x19')]);router[_0x1442('0x16')]('/:id/fields',auth[_0x1442('0xa')](),controller[_0x1442('0x1a')]);router[_0x1442('0x16')](_0x1442('0x1b'),auth[_0x1442('0xa')](),controller[_0x1442('0x1c')]);router[_0x1442('0x1d')](_0x1442('0xd'),auth[_0x1442('0xa')](),controller['update']);router[_0x1442('0x1e')](_0x1442('0xd'),auth[_0x1442('0xa')](),controller[_0x1442('0x1f')]);router[_0x1442('0x1e')](_0x1442('0xf'),auth[_0x1442('0xa')](),controller['removeDispositions']);router[_0x1442('0x1e')](_0x1442('0x1b'),auth[_0x1442('0xa')](),controller['removeAgents']);module[_0x1442('0x20')]=router; \ No newline at end of file +var _0x8e30=['update','delete','destroy','removeDispositions','removeAgents','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put'];(function(_0x421881,_0x3698ae){var _0x2be303=function(_0x4abaec){while(--_0x4abaec){_0x421881['push'](_0x421881['shift']());}};_0x2be303(++_0x3698ae);}(_0x8e30,0x1a9));var _0x08e3=function(_0x279dff,_0x22c86e){_0x279dff=_0x279dff-0x0;var _0x1b0e60=_0x8e30[_0x279dff];return _0x1b0e60;};'use strict';var multer=require('multer');var util=require(_0x08e3('0x0'));var path=require(_0x08e3('0x1'));var timeout=require('connect-timeout');var express=require(_0x08e3('0x2'));var router=express['Router']();var auth=require(_0x08e3('0x3'));var interaction=require(_0x08e3('0x4'));var config=require(_0x08e3('0x5'));var controller=require('./cmList.controller');router['get']('/',auth[_0x08e3('0x6')](),controller[_0x08e3('0x7')]);router[_0x08e3('0x8')](_0x08e3('0x9'),auth[_0x08e3('0x6')](),controller[_0x08e3('0xa')]);router['get'](_0x08e3('0xb'),auth[_0x08e3('0x6')](),controller[_0x08e3('0xc')]);router[_0x08e3('0x8')](_0x08e3('0xd'),auth[_0x08e3('0x6')](),controller[_0x08e3('0xe')]);router['get']('/:id/contacts',auth[_0x08e3('0x6')](),controller[_0x08e3('0xf')]);router[_0x08e3('0x8')](_0x08e3('0x10'),auth[_0x08e3('0x6')](),controller[_0x08e3('0x11')]);router['get'](_0x08e3('0x12'),auth[_0x08e3('0x6')](),controller[_0x08e3('0x13')]);router[_0x08e3('0x8')](_0x08e3('0x14'),auth['isAuthenticated'](),controller[_0x08e3('0x15')]);router[_0x08e3('0x16')]('/',auth[_0x08e3('0x6')](),controller[_0x08e3('0x17')]);router[_0x08e3('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x08e3('0x18')]);router[_0x08e3('0x16')](_0x08e3('0x19'),auth[_0x08e3('0x6')](),controller[_0x08e3('0x1a')]);router[_0x08e3('0x16')]('/:id/fields',auth['isAuthenticated'](),controller[_0x08e3('0x1b')]);router[_0x08e3('0x16')](_0x08e3('0x14'),auth[_0x08e3('0x6')](),controller[_0x08e3('0x1c')]);router[_0x08e3('0x1d')](_0x08e3('0xb'),auth[_0x08e3('0x6')](),controller[_0x08e3('0x1e')]);router[_0x08e3('0x1f')](_0x08e3('0xb'),auth[_0x08e3('0x6')](),controller[_0x08e3('0x20')]);router[_0x08e3('0x1f')](_0x08e3('0xd'),auth[_0x08e3('0x6')](),controller[_0x08e3('0x21')]);router[_0x08e3('0x1f')](_0x08e3('0x14'),auth[_0x08e3('0x6')](),controller[_0x08e3('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 8512555..1cfcff7 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(_0x1cfcc0,_0x4f6b24){var _0x50a426=function(_0x461e4d){while(--_0x461e4d){_0x1cfcc0['push'](_0x1cfcc0['shift']());}};_0x50a426(++_0x4f6b24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x41563b,_0x291690){var _0x42b3b2=function(_0x562ad7){while(--_0x562ad7){_0x41563b['push'](_0x41563b['shift']());}};_0x42b3b2(++_0x291690);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 8cbdad8..55e7534 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 _0x9bc8=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','then','error','stack','name','send','update','body','Condition','find','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x533e7f,_0x1abe38){var _0x121a9e=function(_0x8a44a6){while(--_0x8a44a6){_0x533e7f['push'](_0x533e7f['shift']());}};_0x121a9e(++_0x1abe38);}(_0x9bc8,0xa6));var _0x89bc=function(_0x4708de,_0x49f913){_0x4708de=_0x4708de-0x0;var _0x36fe33=_0x9bc8[_0x4708de];return _0x36fe33;};'use strict';var pdf=require(_0x89bc('0x0'));var emlformat=require(_0x89bc('0x1'));var rimraf=require(_0x89bc('0x2'));var zipdir=require(_0x89bc('0x3'));var jsonpatch=require(_0x89bc('0x4'));var rp=require(_0x89bc('0x5'));var moment=require(_0x89bc('0x6'));var BPromise=require(_0x89bc('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x89bc('0x8'));var csv=require(_0x89bc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x89bc('0xa'));var squel=require(_0x89bc('0xb'));var crypto=require(_0x89bc('0xc'));var jsforce=require(_0x89bc('0xd'));var deskjs=require(_0x89bc('0xe'));var toCsv=require(_0x89bc('0x9'));var querystring=require('querystring');var Papa=require(_0x89bc('0xf'));var Redis=require(_0x89bc('0x10'));var authService=require(_0x89bc('0x11'));var qs=require(_0x89bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89bc('0x13'));var logger=require(_0x89bc('0x14'))(_0x89bc('0x15'));var utils=require(_0x89bc('0x16'));var config=require('../../config/environment');var db=require(_0x89bc('0x17'))['db'];function respondWithStatusCode(_0x3e149b,_0x5712e0){_0x5712e0=_0x5712e0||0xcc;return function(_0x10642d){if(_0x10642d){return _0x3e149b[_0x89bc('0x18')](_0x5712e0);}return _0x3e149b['status'](_0x5712e0)[_0x89bc('0x19')]();};}function respondWithResult(_0x1a0900,_0x148c1d){_0x148c1d=_0x148c1d||0xc8;return function(_0x5460fc){if(_0x5460fc){return _0x1a0900[_0x89bc('0x1a')](_0x148c1d)[_0x89bc('0x1b')](_0x5460fc);}};}function respondWithFilteredResult(_0x5b8d25,_0x1a04e8){return function(_0x9c8a2){if(_0x9c8a2){var _0x46dc91=_0x9c8a2[_0x89bc('0x1c')],_0x1f9d95=_0x1a04e8[_0x89bc('0x1d')],_0x13b0a3=_0x1a04e8['offset']+_0x1a04e8[_0x89bc('0x1e')],_0xa4f0a0;if(_0x13b0a3>=_0x46dc91){_0x13b0a3=_0x46dc91;_0xa4f0a0=0xc8;}else{_0xa4f0a0=0xce;}_0x5b8d25[_0x89bc('0x1a')](_0xa4f0a0);return _0x5b8d25[_0x89bc('0x1f')](_0x89bc('0x20'),_0x1f9d95+'-'+_0x13b0a3+'/'+_0x46dc91)[_0x89bc('0x1b')](_0x9c8a2);}return null;};}function patchUpdates(_0x3346e4){return function(_0x2c183f){try{jsonpatch['apply'](_0x2c183f,_0x3346e4,!![]);}catch(_0x5db3a1){return BPromise[_0x89bc('0x21')](_0x5db3a1);}return _0x2c183f['save']();};}function saveUpdates(_0x4d5611,_0xae8f32){return function(_0x4e7abf){if(_0x4e7abf){return _0x4e7abf['update'](_0x4d5611)[_0x89bc('0x22')](function(_0x5cf839){return _0x5cf839;});}return null;};}function removeEntity(_0x5b3dc2,_0x226776){return function(_0x2809ab){if(_0x2809ab){return _0x2809ab['destroy']()['then'](function(){_0x5b3dc2[_0x89bc('0x1a')](0xcc)[_0x89bc('0x19')]();});}};}function handleEntityNotFound(_0xd23bd6,_0x59e314){return function(_0x1320eb){if(!_0x1320eb){_0xd23bd6[_0x89bc('0x18')](0x194);}return _0x1320eb;};}function handleError(_0x5c7884,_0x135bf3){_0x135bf3=_0x135bf3||0x1f4;return function(_0x5cc033){logger[_0x89bc('0x23')](_0x5cc033[_0x89bc('0x24')]);if(_0x5cc033[_0x89bc('0x25')]){delete _0x5cc033[_0x89bc('0x25')];}_0x5c7884[_0x89bc('0x1a')](_0x135bf3)[_0x89bc('0x26')](_0x5cc033);};}exports[_0x89bc('0x27')]=function(_0x3d7c1e,_0x8c1108){if(_0x3d7c1e[_0x89bc('0x28')]['id']){delete _0x3d7c1e[_0x89bc('0x28')]['id'];}return db[_0x89bc('0x29')][_0x89bc('0x2a')]({'where':{'id':_0x3d7c1e['params']['id']}})['then'](handleEntityNotFound(_0x8c1108,null))[_0x89bc('0x22')](saveUpdates(_0x3d7c1e[_0x89bc('0x28')],null))['then'](respondWithResult(_0x8c1108,null))['catch'](handleError(_0x8c1108,null));};exports[_0x89bc('0x2b')]=function(_0x2fee35,_0x2ab99c){return db[_0x89bc('0x29')][_0x89bc('0x2a')]({'where':{'id':_0x2fee35[_0x89bc('0x2c')]['id']}})[_0x89bc('0x22')](handleEntityNotFound(_0x2ab99c,null))['then'](removeEntity(_0x2ab99c,null))['catch'](handleError(_0x2ab99c,null));}; \ No newline at end of file +var _0x184d=['save','update','destroy','then','error','stack','name','send','body','Condition','find','params','catch','eml-format','moment','bluebird','mustache','util','path','sox','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','set','Content-Range','apply','reject'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x184d,0x1d0));var _0xd184=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x184d[_0x11c573];return _0x6b72de;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd184('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd184('0x1'));var BPromise=require(_0xd184('0x2'));var Mustache=require(_0xd184('0x3'));var util=require(_0xd184('0x4'));var path=require(_0xd184('0x5'));var sox=require(_0xd184('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd184('0x7'));var crypto=require(_0xd184('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xd184('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd184('0xa'));var Redis=require(_0xd184('0xb'));var authService=require(_0xd184('0xc'));var qs=require(_0xd184('0xd'));var as=require(_0xd184('0xe'));var hardwareService=require(_0xd184('0xf'));var logger=require('../../config/logger')(_0xd184('0x10'));var utils=require(_0xd184('0x11'));var config=require(_0xd184('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9cb460,_0x5e5585){_0x5e5585=_0x5e5585||0xcc;return function(_0x33b94c){if(_0x33b94c){return _0x9cb460[_0xd184('0x13')](_0x5e5585);}return _0x9cb460[_0xd184('0x14')](_0x5e5585)[_0xd184('0x15')]();};}function respondWithResult(_0x11cb5a,_0x7dc346){_0x7dc346=_0x7dc346||0xc8;return function(_0x5a13eb){if(_0x5a13eb){return _0x11cb5a[_0xd184('0x14')](_0x7dc346)[_0xd184('0x16')](_0x5a13eb);}};}function respondWithFilteredResult(_0x32df27,_0x313c07){return function(_0x712577){if(_0x712577){var _0x316f4a=_0x712577[_0xd184('0x17')],_0x3fe670=_0x313c07['offset'],_0x296db8=_0x313c07['offset']+_0x313c07['limit'],_0x28447b;if(_0x296db8>=_0x316f4a){_0x296db8=_0x316f4a;_0x28447b=0xc8;}else{_0x28447b=0xce;}_0x32df27[_0xd184('0x14')](_0x28447b);return _0x32df27[_0xd184('0x18')](_0xd184('0x19'),_0x3fe670+'-'+_0x296db8+'/'+_0x316f4a)[_0xd184('0x16')](_0x712577);}return null;};}function patchUpdates(_0x23d0cf){return function(_0x20267a){try{jsonpatch[_0xd184('0x1a')](_0x20267a,_0x23d0cf,!![]);}catch(_0x56dab8){return BPromise[_0xd184('0x1b')](_0x56dab8);}return _0x20267a[_0xd184('0x1c')]();};}function saveUpdates(_0xd4190c,_0x38bbaf){return function(_0x92a5f9){if(_0x92a5f9){return _0x92a5f9[_0xd184('0x1d')](_0xd4190c)['then'](function(_0x3e60c4){return _0x3e60c4;});}return null;};}function removeEntity(_0x565c38,_0x1318a7){return function(_0x2fc10d){if(_0x2fc10d){return _0x2fc10d[_0xd184('0x1e')]()[_0xd184('0x1f')](function(){_0x565c38[_0xd184('0x14')](0xcc)[_0xd184('0x15')]();});}};}function handleEntityNotFound(_0x52b84b,_0x5398b5){return function(_0x466307){if(!_0x466307){_0x52b84b['sendStatus'](0x194);}return _0x466307;};}function handleError(_0x5e4f98,_0xcb670d){_0xcb670d=_0xcb670d||0x1f4;return function(_0x4b5169){logger[_0xd184('0x20')](_0x4b5169[_0xd184('0x21')]);if(_0x4b5169[_0xd184('0x22')]){delete _0x4b5169['name'];}_0x5e4f98[_0xd184('0x14')](_0xcb670d)[_0xd184('0x23')](_0x4b5169);};}exports[_0xd184('0x1d')]=function(_0x40c4e6,_0x1cdd3e){if(_0x40c4e6[_0xd184('0x24')]['id']){delete _0x40c4e6[_0xd184('0x24')]['id'];}return db[_0xd184('0x25')][_0xd184('0x26')]({'where':{'id':_0x40c4e6[_0xd184('0x27')]['id']}})['then'](handleEntityNotFound(_0x1cdd3e,null))[_0xd184('0x1f')](saveUpdates(_0x40c4e6['body'],null))[_0xd184('0x1f')](respondWithResult(_0x1cdd3e,null))[_0xd184('0x28')](handleError(_0x1cdd3e,null));};exports['destroy']=function(_0x31477a,_0x339018){return db[_0xd184('0x25')][_0xd184('0x26')]({'where':{'id':_0x31477a[_0xd184('0x27')]['id']}})['then'](handleEntityNotFound(_0x339018,null))[_0xd184('0x1f')](removeEntity(_0x339018,null))[_0xd184('0x28')](handleError(_0x339018,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index eaa138c..3bd4402 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 _0xb82a=['api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xb82a,0x175));var _0xab82=function(_0x430fbe,_0x1a02c9){_0x430fbe=_0x430fbe-0x0;var _0x3af098=_0xb82a[_0x430fbe];return _0x3af098;};'use strict';var _=require(_0xab82('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xab82('0x1'));var moment=require(_0xab82('0x2'));var BPromise=require(_0xab82('0x3'));var rp=require(_0xab82('0x4'));var fs=require('fs');var path=require(_0xab82('0x5'));var rimraf=require('rimraf');var config=require(_0xab82('0x6'));var attributes=require(_0xab82('0x7'));module[_0xab82('0x8')]=function(_0x1c3067,_0x6a9bd4){return _0x1c3067['define'](_0xab82('0x9'),attributes,{'tableName':_0xab82('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c71=['exports','Condition','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x40d494,_0x247d47){var _0x18650e=function(_0x1fdf6d){while(--_0x1fdf6d){_0x40d494['push'](_0x40d494['shift']());}};_0x18650e(++_0x247d47);}(_0x0c71,0xf2));var _0x10c7=function(_0x474439,_0x301772){_0x474439=_0x474439-0x0;var _0x5667f3=_0x0c71[_0x474439];return _0x5667f3;};'use strict';var _=require(_0x10c7('0x0'));var util=require(_0x10c7('0x1'));var logger=require('../../config/logger')(_0x10c7('0x2'));var moment=require('moment');var BPromise=require(_0x10c7('0x3'));var rp=require(_0x10c7('0x4'));var fs=require('fs');var path=require(_0x10c7('0x5'));var rimraf=require(_0x10c7('0x6'));var config=require(_0x10c7('0x7'));var attributes=require('./condition.attributes');module[_0x10c7('0x8')]=function(_0xaa7056,_0x330f25){return _0xaa7056['define'](_0x10c7('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index b578c73..5a3e96a 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 _0x2f20=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x2f20,0x12c));var _0x02f2=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x2f20[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x02f2('0x0'));var util=require(_0x02f2('0x1'));var moment=require(_0x02f2('0x2'));var BPromise=require(_0x02f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02f2('0x4'));var db=require(_0x02f2('0x5'))['db'];var utils=require(_0x02f2('0x6'));var logger=require(_0x02f2('0x7'))(_0x02f2('0x8'));var config=require(_0x02f2('0x9'));var jayson=require(_0x02f2('0xa'));var client=jayson['client'][_0x02f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b85fd,_0x45c511,_0xb12972){return new BPromise(function(_0x228719,_0x35eff9){return client[_0x02f2('0xc')](_0x3b85fd,_0xb12972)[_0x02f2('0xd')](function(_0x36efe2){logger[_0x02f2('0xe')](_0x02f2('0xf'),_0x45c511,_0x02f2('0x10'));logger[_0x02f2('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0x45c511,_0x02f2('0x10'),JSON[_0x02f2('0x12')](_0x36efe2));if(_0x36efe2[_0x02f2('0x13')]){if(_0x36efe2[_0x02f2('0x13')][_0x02f2('0x14')]===0x1f4){logger['error'](_0x02f2('0xf'),_0x45c511,_0x36efe2[_0x02f2('0x13')][_0x02f2('0x15')]);return _0x35eff9(_0x36efe2[_0x02f2('0x13')][_0x02f2('0x15')]);}logger[_0x02f2('0x13')]('Condition,\x20%s,\x20%s',_0x45c511,_0x36efe2[_0x02f2('0x13')][_0x02f2('0x15')]);return _0x228719(_0x36efe2[_0x02f2('0x13')][_0x02f2('0x15')]);}else{logger[_0x02f2('0xe')]('Condition,\x20%s,\x20%s',_0x45c511,'request\x20sent');_0x228719(_0x36efe2['result'][_0x02f2('0x15')]);}})[_0x02f2('0x16')](function(_0x3ae908){logger['error'](_0x02f2('0xf'),_0x45c511,_0x3ae908);_0x35eff9(_0x3ae908);});});} \ No newline at end of file +var _0x0565=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird','ioredis'];(function(_0x139c0c,_0x5180ae){var _0x3f6866=function(_0x576d25){while(--_0x576d25){_0x139c0c['push'](_0x139c0c['shift']());}};_0x3f6866(++_0x5180ae);}(_0x0565,0x150));var _0x5056=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x0565[_0x344a3f];return _0x264712;};'use strict';var _=require('lodash');var util=require(_0x5056('0x0'));var moment=require(_0x5056('0x1'));var BPromise=require(_0x5056('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5056('0x3'));var db=require(_0x5056('0x4'))['db'];var utils=require(_0x5056('0x5'));var logger=require(_0x5056('0x6'))(_0x5056('0x7'));var config=require(_0x5056('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5056('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12b5bd,_0x2f193b,_0x410188){return new BPromise(function(_0x4dde2c,_0x4f92bc){return client[_0x5056('0xa')](_0x12b5bd,_0x410188)[_0x5056('0xb')](function(_0x421c0d){logger['info'](_0x5056('0xc'),_0x2f193b,'request\x20sent');logger[_0x5056('0xd')](_0x5056('0xe'),_0x2f193b,_0x5056('0xf'),JSON['stringify'](_0x421c0d));if(_0x421c0d['error']){if(_0x421c0d[_0x5056('0x10')][_0x5056('0x11')]===0x1f4){logger[_0x5056('0x10')]('Condition,\x20%s,\x20%s',_0x2f193b,_0x421c0d['error'][_0x5056('0x12')]);return _0x4f92bc(_0x421c0d[_0x5056('0x10')][_0x5056('0x12')]);}logger[_0x5056('0x10')]('Condition,\x20%s,\x20%s',_0x2f193b,_0x421c0d[_0x5056('0x10')]['message']);return _0x4dde2c(_0x421c0d['error'][_0x5056('0x12')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x2f193b,_0x5056('0xf'));_0x4dde2c(_0x421c0d['result'][_0x5056('0x12')]);}})[_0x5056('0x13')](function(_0x22fc94){logger[_0x5056('0x10')](_0x5056('0xc'),_0x2f193b,_0x22fc94);_0x4f92bc(_0x22fc94);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 15a4b67..0d5bcb2 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 _0xc854=['isAuthenticated','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','update','delete','/:id'];(function(_0x46ea7f,_0x2b133f){var _0x46b623=function(_0x438494){while(--_0x438494){_0x46ea7f['push'](_0x46ea7f['shift']());}};_0x46b623(++_0x2b133f);}(_0xc854,0x7b));var _0x4c85=function(_0x5a3fd7,_0x5919da){_0x5a3fd7=_0x5a3fd7-0x0;var _0x572299=_0xc854[_0x5a3fd7];return _0x572299;};'use strict';var multer=require(_0x4c85('0x0'));var util=require('util');var path=require(_0x4c85('0x1'));var timeout=require(_0x4c85('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4c85('0x3'));var interaction=require(_0x4c85('0x4'));var config=require(_0x4c85('0x5'));var controller=require('./condition.controller');router['put']('/:id',auth['isAuthenticated'](),controller[_0x4c85('0x6')]);router[_0x4c85('0x7')](_0x4c85('0x8'),auth[_0x4c85('0x9')](),controller[_0x4c85('0xa')]);module['exports']=router; \ No newline at end of file +var _0x79f2=['path','Router','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util'];(function(_0x26c840,_0xd1af3d){var _0x18238c=function(_0x11c73c){while(--_0x11c73c){_0x26c840['push'](_0x26c840['shift']());}};_0x18238c(++_0xd1af3d);}(_0x79f2,0x102));var _0x279f=function(_0x417525,_0x4e32f1){_0x417525=_0x417525-0x0;var _0x35fb93=_0x79f2[_0x417525];return _0x35fb93;};'use strict';var multer=require(_0x279f('0x0'));var util=require(_0x279f('0x1'));var path=require(_0x279f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x279f('0x3')]();var auth=require(_0x279f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x279f('0x5'));var controller=require(_0x279f('0x6'));router[_0x279f('0x7')](_0x279f('0x8'),auth[_0x279f('0x9')](),controller[_0x279f('0xa')]);router[_0x279f('0xb')](_0x279f('0x8'),auth[_0x279f('0x9')](),controller['destroy']);module[_0x279f('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 583f5dc..3f39863 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 _0xaab2=['name','exports','STRING'];(function(_0x1801e7,_0x140713){var _0x3a449b=function(_0x14739a){while(--_0x14739a){_0x1801e7['push'](_0x1801e7['shift']());}};_0x3a449b(++_0x140713);}(_0xaab2,0xca));var _0x2aab=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xaab2[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require('sequelize');module[_0x2aab('0x0')]={'name':{'type':Sequelize[_0x2aab('0x1')],'allowNull':![],'unique':_0x2aab('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x2aab('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xb0d9=['STRING','name','INTEGER','sequelize','exports'];(function(_0x1ec99f,_0x43f218){var _0x52dd54=function(_0x1718b6){while(--_0x1718b6){_0x1ec99f['push'](_0x1ec99f['shift']());}};_0x52dd54(++_0x43f218);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x21b3e4,_0x33cb68){_0x21b3e4=_0x21b3e4-0x0;var _0x58bb85=_0xb0d9[_0x21b3e4];return _0x58bb85;};'use strict';var Sequelize=require(_0x9b0d('0x0'));module[_0x9b0d('0x1')]={'name':{'type':Sequelize[_0x9b0d('0x2')],'allowNull':![],'unique':_0x9b0d('0x3')},'OrderBy':{'type':Sequelize[_0x9b0d('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9b0d('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 a52c504..8eb55ec 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 _0x4b84=['fast-json-patch','bluebird','mustache','util','ejs','squel','jsforce','querystring','papaparse','ioredis','../../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','get','ContactItemTypes','destroy','status','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','error','html-pdf','eml-format'];(function(_0x3e5742,_0x5df524){var _0xd16f96=function(_0x3aa8a1){while(--_0x3aa8a1){_0x3e5742['push'](_0x3e5742['shift']());}};_0xd16f96(++_0x5df524);}(_0x4b84,0x1cc));var _0x44b8=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0x4b84[_0x175e89];return _0x2ed996;};'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(){var _0x3a8aa4=_0x14996c[_0x44b8('0x1e')]({'plain':!![]});var _0x1418db=_0x44b8('0x1f');return db['UserProfileResource'][_0x44b8('0x20')]({'where':{'type':_0x1418db,'resourceId':_0x3a8aa4['id']}})['then'](function(){return _0x14996c;});})[_0x44b8('0x1d')](function(){_0x1e0f2d[_0x44b8('0x21')](0xcc)[_0x44b8('0x14')]();});}};}function handleEntityNotFound(_0x47689e,_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x47689e[_0x44b8('0x13')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x22')]);if(_0x350482[_0x44b8('0x23')]){delete _0x350482[_0x44b8('0x23')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x24')](_0x350482);};}exports[_0x44b8('0x25')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={},_0xfb0028={},_0x5a544c={'count':0x0,'rows':[]};var _0x559f0b=_['map'](db[_0x44b8('0x26')][_0x44b8('0x27')],function(_0x44ce5a){return{'name':_0x44ce5a[_0x44b8('0x28')],'type':_0x44ce5a[_0x44b8('0x29')][_0x44b8('0x2a')]};});_0xfb0028[_0x44b8('0x2b')]=_[_0x44b8('0x2c')](_0x559f0b,_0x44b8('0x23'));_0xfb0028[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x53d9c7[_0x44b8('0x2d')]);_0xfb0028[_0x44b8('0x2f')]=_['intersection'](_0xfb0028[_0x44b8('0x2b')],_0xfb0028['query']);_0x4a182d[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0xfb0028[_0x44b8('0x2b')],qs[_0x44b8('0x32')](_0x53d9c7[_0x44b8('0x2d')]['fields']));_0x4a182d[_0x44b8('0x30')]=_0x4a182d[_0x44b8('0x30')][_0x44b8('0x33')]?_0x4a182d[_0x44b8('0x30')]:_0xfb0028[_0x44b8('0x2b')];if(!_0x53d9c7['query'][_0x44b8('0x34')](_0x44b8('0x35'))){_0x4a182d[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x17')]);_0x4a182d[_0x44b8('0x16')]=qs[_0x44b8('0x16')](_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x16')]);}_0x4a182d[_0x44b8('0x36')]=qs[_0x44b8('0x37')](_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x37')]);_0x4a182d[_0x44b8('0x38')]=qs[_0x44b8('0x2f')](_[_0x44b8('0x39')](_0x53d9c7[_0x44b8('0x2d')],_0xfb0028[_0x44b8('0x2f')]),_0x559f0b);if(_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x3a')]){_0x4a182d[_0x44b8('0x38')]=_['merge'](_0x4a182d[_0x44b8('0x38')],{'$or':_[_0x44b8('0x2c')](_0x559f0b,function(_0x4fcfa0){if(_0x4fcfa0[_0x44b8('0x29')]!==_0x44b8('0x3b')){var _0x6658be={};_0x6658be[_0x4fcfa0[_0x44b8('0x23')]]={'$like':'%'+_0x53d9c7['query'][_0x44b8('0x3a')]+'%'};return _0x6658be;}})});}_0x4a182d=_[_0x44b8('0x3c')]({},_0x4a182d,_0x53d9c7[_0x44b8('0x3d')]);var _0x1ee3cc={'where':_0x4a182d[_0x44b8('0x38')]};return db[_0x44b8('0x26')][_0x44b8('0x15')](_0x1ee3cc)[_0x44b8('0x1d')](function(_0x209039){_0x5a544c[_0x44b8('0x15')]=_0x209039;if(_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x3e')]){_0x4a182d[_0x44b8('0x3f')]=[{'all':!![]}];}return db[_0x44b8('0x26')][_0x44b8('0x40')](_0x4a182d);})[_0x44b8('0x1d')](function(_0x57d8c4){_0x5a544c[_0x44b8('0x41')]=_0x57d8c4;return _0x5a544c;})[_0x44b8('0x1d')](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x42')](handleError(_0x2e0174,null));};exports['show']=function(_0xd424f8,_0x1054c5){var _0x229cc9={'raw':!![],'where':{'id':_0xd424f8[_0x44b8('0x43')]['id']}},_0x585a16={};_0x585a16[_0x44b8('0x2b')]=_[_0x44b8('0x2e')](db[_0x44b8('0x26')][_0x44b8('0x27')]);_0x585a16['query']=_['keys'](_0xd424f8[_0x44b8('0x2d')]);_0x585a16[_0x44b8('0x2f')]=_[_0x44b8('0x31')](_0x585a16[_0x44b8('0x2b')],_0x585a16[_0x44b8('0x2d')]);_0x229cc9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x585a16[_0x44b8('0x2b')],qs[_0x44b8('0x32')](_0xd424f8[_0x44b8('0x2d')][_0x44b8('0x32')]));_0x229cc9[_0x44b8('0x30')]=_0x229cc9[_0x44b8('0x30')][_0x44b8('0x33')]?_0x229cc9[_0x44b8('0x30')]:_0x585a16[_0x44b8('0x2b')];if(_0xd424f8[_0x44b8('0x2d')][_0x44b8('0x3e')]){_0x229cc9[_0x44b8('0x3f')]=[{'all':!![]}];}_0x229cc9=_['merge']({},_0x229cc9,_0xd424f8['options']);return db[_0x44b8('0x26')][_0x44b8('0x44')](_0x229cc9)[_0x44b8('0x1d')](handleEntityNotFound(_0x1054c5,null))[_0x44b8('0x1d')](respondWithResult(_0x1054c5,null))[_0x44b8('0x42')](handleError(_0x1054c5,null));};exports[_0x44b8('0x45')]=function(_0x411ed6,_0x4fe73f){return db[_0x44b8('0x26')]['create'](_0x411ed6[_0x44b8('0x46')],{})[_0x44b8('0x1d')](function(_0x1dbc28){var _0x9207bf=_0x411ed6[_0x44b8('0x47')][_0x44b8('0x1e')]({'plain':!![]});if(!_0x9207bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9207bf[_0x44b8('0x48')]===_0x44b8('0x47')){var _0x10602c=_0x1dbc28[_0x44b8('0x1e')]({'plain':!![]});var _0x4ccc77=_0x44b8('0x1f');return db[_0x44b8('0x49')][_0x44b8('0x44')]({'where':{'name':_0x4ccc77,'userProfileId':_0x9207bf[_0x44b8('0x4a')]},'raw':!![]})[_0x44b8('0x1d')](function(_0x470ebb){if(_0x470ebb&&_0x470ebb['autoAssociation']===0x0){return db[_0x44b8('0x4b')][_0x44b8('0x45')]({'name':_0x10602c[_0x44b8('0x23')],'resourceId':_0x10602c['id'],'type':_0x470ebb[_0x44b8('0x23')],'sectionId':_0x470ebb['id']},{})[_0x44b8('0x1d')](function(){return _0x1dbc28;});}else{return _0x1dbc28;}})['catch'](function(_0x493840){logger[_0x44b8('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x493840);throw _0x493840;});}return _0x1dbc28;})[_0x44b8('0x1d')](respondWithResult(_0x4fe73f,0xc9))['catch'](handleError(_0x4fe73f,null));};exports[_0x44b8('0x1c')]=function(_0x434d6a,_0x1a29f6){if(_0x434d6a[_0x44b8('0x46')]['id']){delete _0x434d6a[_0x44b8('0x46')]['id'];}return db[_0x44b8('0x26')][_0x44b8('0x44')]({'where':{'id':_0x434d6a['params']['id']}})[_0x44b8('0x1d')](handleEntityNotFound(_0x1a29f6,null))[_0x44b8('0x1d')](saveUpdates(_0x434d6a[_0x44b8('0x46')],null))['then'](respondWithResult(_0x1a29f6,null))[_0x44b8('0x42')](handleError(_0x1a29f6,null));};exports[_0x44b8('0x20')]=function(_0x45f9a0,_0x2b256b){return db['ContactItemType'][_0x44b8('0x44')]({'where':{'id':_0x45f9a0[_0x44b8('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b256b,null))[_0x44b8('0x1d')](removeEntity(_0x2b256b,null))[_0x44b8('0x42')](handleError(_0x2b256b,null));}; \ No newline at end of file +var _0x9c44=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','error','name','send','map','ContactItemType','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','order','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation'];(function(_0x34c460,_0x13ef3b){var _0x2b0a9f=function(_0x5b4442){while(--_0x5b4442){_0x34c460['push'](_0x34c460['shift']());}};_0x2b0a9f(++_0x13ef3b);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){var _0x4f0b62=_0x527126['get']({'plain':!![]});var _0x2263ae=_0x49c4('0x21');return db[_0x49c4('0x22')][_0x49c4('0x23')]({'where':{'type':_0x2263ae,'resourceId':_0x4f0b62['id']}})['then'](function(){return _0x527126;});})['then'](function(){_0x2197d2[_0x49c4('0x16')](0xcc)[_0x49c4('0x15')]();});}};}function handleEntityNotFound(_0x565423,_0x207358){return function(_0x43e014){if(!_0x43e014){_0x565423[_0x49c4('0x14')](0x194);}return _0x43e014;};}function handleError(_0xa7a826,_0x531d92){_0x531d92=_0x531d92||0x1f4;return function(_0x543ea2){logger[_0x49c4('0x24')](_0x543ea2['stack']);if(_0x543ea2[_0x49c4('0x25')]){delete _0x543ea2[_0x49c4('0x25')];}_0xa7a826[_0x49c4('0x16')](_0x531d92)[_0x49c4('0x26')](_0x543ea2);};}exports['index']=function(_0x889909,_0x2b2793){var _0x46e04d={},_0x4f28a2={},_0x6329b3={'count':0x0,'rows':[]};var _0x29f835=_[_0x49c4('0x27')](db[_0x49c4('0x28')][_0x49c4('0x29')],function(_0x2cbd88){return{'name':_0x2cbd88[_0x49c4('0x2a')],'type':_0x2cbd88['type']['key']};});_0x4f28a2['model']=_[_0x49c4('0x27')](_0x29f835,_0x49c4('0x25'));_0x4f28a2[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x889909[_0x49c4('0x2b')]);_0x4f28a2['filters']=_[_0x49c4('0x2d')](_0x4f28a2[_0x49c4('0x2e')],_0x4f28a2[_0x49c4('0x2b')]);_0x46e04d[_0x49c4('0x2f')]=_['intersection'](_0x4f28a2['model'],qs[_0x49c4('0x30')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x46e04d[_0x49c4('0x2f')]=_0x46e04d[_0x49c4('0x2f')]['length']?_0x46e04d[_0x49c4('0x2f')]:_0x4f28a2[_0x49c4('0x2e')];if(!_0x889909[_0x49c4('0x2b')]['hasOwnProperty']('nolimit')){_0x46e04d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x1a')]);_0x46e04d[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x46e04d[_0x49c4('0x31')]=qs['sort'](_0x889909[_0x49c4('0x2b')]['sort']);_0x46e04d[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x889909[_0x49c4('0x2b')],_0x4f28a2['filters']),_0x29f835);if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x46e04d[_0x49c4('0x32')]=_['merge'](_0x46e04d[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x29f835,function(_0x178987){if(_0x178987[_0x49c4('0x36')]!==_0x49c4('0x37')){var _0x24c177={};_0x24c177[_0x178987[_0x49c4('0x25')]]={'$like':'%'+_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x24c177;}})});}_0x46e04d=_[_0x49c4('0x38')]({},_0x46e04d,_0x889909[_0x49c4('0x39')]);var _0x4e0663={'where':_0x46e04d[_0x49c4('0x32')]};return db[_0x49c4('0x28')][_0x49c4('0x18')](_0x4e0663)[_0x49c4('0x20')](function(_0x41ad28){_0x6329b3[_0x49c4('0x18')]=_0x41ad28;if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x46e04d[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x28')][_0x49c4('0x3c')](_0x46e04d);})[_0x49c4('0x20')](function(_0x326142){_0x6329b3['rows']=_0x326142;return _0x6329b3;})[_0x49c4('0x20')](respondWithFilteredResult(_0x2b2793,_0x46e04d))['catch'](handleError(_0x2b2793,null));};exports[_0x49c4('0x3d')]=function(_0x4915bc,_0x28d4fb){var _0x1480da={'raw':!![],'where':{'id':_0x4915bc[_0x49c4('0x3e')]['id']}},_0x239327={};_0x239327['model']=_['keys'](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x239327[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x4915bc['query']);_0x239327[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],_0x239327[_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x4915bc[_0x49c4('0x2b')]['fields']));_0x1480da[_0x49c4('0x2f')]=_0x1480da['attributes'][_0x49c4('0x3f')]?_0x1480da[_0x49c4('0x2f')]:_0x239327[_0x49c4('0x2e')];if(_0x4915bc[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x1480da['include']=[{'all':!![]}];}_0x1480da=_[_0x49c4('0x38')]({},_0x1480da,_0x4915bc[_0x49c4('0x39')]);return db[_0x49c4('0x28')][_0x49c4('0x40')](_0x1480da)[_0x49c4('0x20')](handleEntityNotFound(_0x28d4fb,null))[_0x49c4('0x20')](respondWithResult(_0x28d4fb,null))[_0x49c4('0x41')](handleError(_0x28d4fb,null));};exports['create']=function(_0x3bac1b,_0x5cfff9){return db[_0x49c4('0x28')][_0x49c4('0x42')](_0x3bac1b[_0x49c4('0x43')],{})[_0x49c4('0x20')](function(_0x2d8087){var _0x30bea5=_0x3bac1b[_0x49c4('0x44')]['get']({'plain':!![]});if(!_0x30bea5)throw new Error(_0x49c4('0x45'));if(_0x30bea5[_0x49c4('0x46')]==='user'){var _0x1e1ac4=_0x2d8087[_0x49c4('0x47')]({'plain':!![]});var _0xfbe179=_0x49c4('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xfbe179,'userProfileId':_0x30bea5[_0x49c4('0x48')]},'raw':!![]})['then'](function(_0x4597c3){if(_0x4597c3&&_0x4597c3[_0x49c4('0x49')]===0x0){return db[_0x49c4('0x22')][_0x49c4('0x42')]({'name':_0x1e1ac4[_0x49c4('0x25')],'resourceId':_0x1e1ac4['id'],'type':_0x4597c3[_0x49c4('0x25')],'sectionId':_0x4597c3['id']},{})[_0x49c4('0x20')](function(){return _0x2d8087;});}else{return _0x2d8087;}})['catch'](function(_0x1f26c2){logger[_0x49c4('0x24')](_0x49c4('0x4a'),_0x1f26c2);throw _0x1f26c2;});}return _0x2d8087;})[_0x49c4('0x20')](respondWithResult(_0x5cfff9,0xc9))[_0x49c4('0x41')](handleError(_0x5cfff9,null));};exports[_0x49c4('0x1f')]=function(_0x156748,_0x25d174){if(_0x156748[_0x49c4('0x43')]['id']){delete _0x156748[_0x49c4('0x43')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x156748[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x25d174,null))['then'](saveUpdates(_0x156748['body'],null))[_0x49c4('0x20')](respondWithResult(_0x25d174,null))['catch'](handleError(_0x25d174,null));};exports['destroy']=function(_0x3208c2,_0x4081a5){return db[_0x49c4('0x28')][_0x49c4('0x40')]({'where':{'id':_0x3208c2[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x4081a5,null))[_0x49c4('0x20')](removeEntity(_0x4081a5,null))['catch'](handleError(_0x4081a5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index abb86bf..62211af 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 _0x0324=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types'];(function(_0x246b5a,_0x4fd53d){var _0x352d9e=function(_0x4ad8d9){while(--_0x4ad8d9){_0x246b5a['push'](_0x246b5a['shift']());}};_0x352d9e(++_0x4fd53d);}(_0x0324,0x90));var _0x4032=function(_0x3f0fb4,_0x5d7940){_0x3f0fb4=_0x3f0fb4-0x0;var _0x32130f=_0x0324[_0x3f0fb4];return _0x32130f;};'use strict';var _=require('lodash');var util=require(_0x4032('0x0'));var logger=require(_0x4032('0x1'))(_0x4032('0x2'));var moment=require(_0x4032('0x3'));var BPromise=require(_0x4032('0x4'));var rp=require(_0x4032('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4032('0x6'));var config=require(_0x4032('0x7'));var attributes=require(_0x4032('0x8'));module[_0x4032('0x9')]=function(_0x77ac4c,_0xa41e9c){return _0x77ac4c['define'](_0x4032('0xa'),attributes,{'tableName':_0x4032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0024=['util','api','bluebird','rimraf','../../config/environment','define','ContactItemType'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0x0024,0xa8));var _0x4002=function(_0x308817,_0x269bbb){_0x308817=_0x308817-0x0;var _0x2992b8=_0x0024[_0x308817];return _0x2992b8;};'use strict';var _=require('lodash');var util=require(_0x4002('0x0'));var logger=require('../../config/logger')(_0x4002('0x1'));var moment=require('moment');var BPromise=require(_0x4002('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4002('0x3'));var config=require(_0x4002('0x4'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x36c011,_0x144717){return _0x36c011[_0x4002('0x5')](_0x4002('0x6'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index f169f00..79c02da 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 _0x049e=['then','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','ContactItemType,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0x049e,0x16a));var _0xe049=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x049e[_0xf34109];return _0x570bfc;};'use strict';var _=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var moment=require('moment');var BPromise=require(_0xe049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe049('0x3'));var db=require(_0xe049('0x4'))['db'];var utils=require(_0xe049('0x5'));var logger=require(_0xe049('0x6'))(_0xe049('0x7'));var config=require('../../config/environment');var jayson=require(_0xe049('0x8'));var client=jayson[_0xe049('0x9')][_0xe049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221a5f,_0x1d4fc6,_0x17945b){return new BPromise(function(_0x22abb2,_0x515823){return client[_0xe049('0xb')](_0x221a5f,_0x17945b)[_0xe049('0xc')](function(_0x6d04ed){logger['info']('ContactItemType,\x20%s,\x20%s',_0x1d4fc6,_0xe049('0xd'));logger[_0xe049('0xe')](_0xe049('0xf'),_0x1d4fc6,'request\x20sent',JSON['stringify'](_0x6d04ed));if(_0x6d04ed['error']){if(_0x6d04ed[_0xe049('0x10')][_0xe049('0x11')]===0x1f4){logger[_0xe049('0x10')](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x515823(_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);}logger['error'](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x22abb2(_0x6d04ed[_0xe049('0x10')]['message']);}else{logger[_0xe049('0x14')](_0xe049('0x12'),_0x1d4fc6,'request\x20sent');_0x22abb2(_0x6d04ed[_0xe049('0x15')][_0xe049('0x13')]);}})['catch'](function(_0x8b9bfe){logger[_0xe049('0x10')]('ContactItemType,\x20%s,\x20%s',_0x1d4fc6,_0x8b9bfe);_0x515823(_0x8b9bfe);});});} \ No newline at end of file +var _0x8128=['message','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x17b8a9,_0x3bbf58){var _0x4add80=function(_0x683126){while(--_0x683126){_0x17b8a9['push'](_0x17b8a9['shift']());}};_0x4add80(++_0x3bbf58);}(_0x8128,0x1b1));var _0x8812=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x8128[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x8812('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8812('0x1'));var rs=require(_0x8812('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8812('0x3'));var logger=require(_0x8812('0x4'))(_0x8812('0x5'));var config=require('../../config/environment');var jayson=require(_0x8812('0x6'));var client=jayson[_0x8812('0x7')][_0x8812('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16bafa,_0x480d1f,_0xfdd696){return new BPromise(function(_0x3d030b,_0x4e5012){return client['request'](_0x16bafa,_0xfdd696)['then'](function(_0x2bc882){logger[_0x8812('0x9')](_0x8812('0xa'),_0x480d1f,_0x8812('0xb'));logger[_0x8812('0xc')](_0x8812('0xd'),_0x480d1f,_0x8812('0xb'),JSON[_0x8812('0xe')](_0x2bc882));if(_0x2bc882[_0x8812('0xf')]){if(_0x2bc882['error'][_0x8812('0x10')]===0x1f4){logger[_0x8812('0xf')](_0x8812('0xa'),_0x480d1f,_0x2bc882[_0x8812('0xf')][_0x8812('0x11')]);return _0x4e5012(_0x2bc882[_0x8812('0xf')]['message']);}logger[_0x8812('0xf')](_0x8812('0xa'),_0x480d1f,_0x2bc882[_0x8812('0xf')]['message']);return _0x3d030b(_0x2bc882['error'][_0x8812('0x11')]);}else{logger[_0x8812('0x9')]('ContactItemType,\x20%s,\x20%s',_0x480d1f,'request\x20sent');_0x3d030b(_0x2bc882['result']['message']);}})['catch'](function(_0xa2a8cc){logger['error'](_0x8812('0xa'),_0x480d1f,_0xa2a8cc);_0x4e5012(_0xa2a8cc);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 5799045..a882106 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 _0x1d00=['express','Router','../../components/interaction/service','./contactItemType.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1ed034,_0x5d495d){var _0x4a82b7=function(_0x348231){while(--_0x348231){_0x1ed034['push'](_0x1ed034['shift']());}};_0x4a82b7(++_0x5d495d);}(_0x1d00,0x12c));var _0x01d0=function(_0x4cf3fa,_0x3aa06e){_0x4cf3fa=_0x4cf3fa-0x0;var _0x1f61d7=_0x1d00[_0x4cf3fa];return _0x1f61d7;};'use strict';var multer=require(_0x01d0('0x0'));var util=require(_0x01d0('0x1'));var path=require(_0x01d0('0x2'));var timeout=require(_0x01d0('0x3'));var express=require(_0x01d0('0x4'));var router=express[_0x01d0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x01d0('0x6'));var config=require('../../config/environment');var controller=require(_0x01d0('0x7'));router[_0x01d0('0x8')]('/',auth['isAuthenticated'](),controller[_0x01d0('0x9')]);router[_0x01d0('0x8')](_0x01d0('0xa'),auth[_0x01d0('0xb')](),controller[_0x01d0('0xc')]);router[_0x01d0('0xd')]('/',auth[_0x01d0('0xb')](),controller[_0x01d0('0xe')]);router['put'](_0x01d0('0xa'),auth['isAuthenticated'](),controller[_0x01d0('0xf')]);router[_0x01d0('0x10')]('/:id',auth[_0x01d0('0xb')](),controller[_0x01d0('0x11')]);module[_0x01d0('0x12')]=router; \ No newline at end of file +var _0xae99=['../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xfad925,_0x96bd76){var _0x2e6967=function(_0x2e99d5){while(--_0x2e99d5){_0xfad925['push'](_0xfad925['shift']());}};_0x2e6967(++_0x96bd76);}(_0xae99,0x82));var _0x9ae9=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xae99[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x9ae9('0x0'));var util=require(_0x9ae9('0x1'));var path=require(_0x9ae9('0x2'));var timeout=require(_0x9ae9('0x3'));var express=require(_0x9ae9('0x4'));var router=express['Router']();var auth=require(_0x9ae9('0x5'));var interaction=require(_0x9ae9('0x6'));var config=require('../../config/environment');var controller=require(_0x9ae9('0x7'));router[_0x9ae9('0x8')]('/',auth[_0x9ae9('0x9')](),controller[_0x9ae9('0xa')]);router[_0x9ae9('0x8')](_0x9ae9('0xb'),auth[_0x9ae9('0x9')](),controller[_0x9ae9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9ae9('0xb'),auth[_0x9ae9('0x9')](),controller[_0x9ae9('0xd')]);router[_0x9ae9('0xe')](_0x9ae9('0xb'),auth['isAuthenticated'](),controller[_0x9ae9('0xf')]);module[_0x9ae9('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5f8e130..b4e5632 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 _0x7f94=['STRING','name','sequelize'];(function(_0x1aafe2,_0x5b3f46){var _0x40060e=function(_0x2f4c51){while(--_0x2f4c51){_0x1aafe2['push'](_0x1aafe2['shift']());}};_0x40060e(++_0x5b3f46);}(_0x7f94,0x65));var _0x47f9=function(_0xf0b052,_0x5c5a8b){_0xf0b052=_0xf0b052-0x0;var _0x3f486a=_0x7f94[_0xf0b052];return _0x3f486a;};'use strict';var Sequelize=require(_0x47f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x47f9('0x1')],'allowNull':![],'unique':_0x47f9('0x2')},'description':{'type':Sequelize[_0x47f9('0x1')]}}; \ No newline at end of file +var _0xaa3f=['exports','STRING','name','sequelize'];(function(_0x9c5d49,_0x248bcc){var _0x289098=function(_0x1fbcf8){while(--_0x1fbcf8){_0x9c5d49['push'](_0x9c5d49['shift']());}};_0x289098(++_0x248bcc);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x3a8e0e,_0x4f120d){_0x3a8e0e=_0x3a8e0e-0x0;var _0xf75a3b=_0xaa3f[_0x3a8e0e];return _0xf75a3b;};'use strict';var Sequelize=require(_0xfaa3('0x0'));module[_0xfaa3('0x1')]={'name':{'type':Sequelize[_0xfaa3('0x2')],'allowNull':![],'unique':_0xfaa3('0x3')},'description':{'type':Sequelize[_0xfaa3('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 1bac105..6ab8024 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 _0xb4b2=['attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','pick','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','count','offset','limit','Content-Range','json','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','merge','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','Dashboard','find','create','body','user','UserProfileSection','autoAssociation','clone','include','createdAt','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3e8be9,_0x50ab41){var _0x5f083e=function(_0x386ce0){while(--_0x386ce0){_0x3e8be9['push'](_0x3e8be9['shift']());}};_0x5f083e(++_0x50ab41);}(_0xb4b2,0x9e));var _0x2b4b=function(_0x2f0d37,_0x1cc0ce){_0x2f0d37=_0x2f0d37-0x0;var _0x1c0a00=_0xb4b2[_0x2f0d37];return _0x1c0a00;};'use strict';var pdf=require(_0x2b4b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2b4b('0x1'));var zipdir=require(_0x2b4b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b4b('0x3'));var moment=require(_0x2b4b('0x4'));var BPromise=require(_0x2b4b('0x5'));var Mustache=require(_0x2b4b('0x6'));var util=require(_0x2b4b('0x7'));var path=require(_0x2b4b('0x8'));var sox=require(_0x2b4b('0x9'));var csv=require(_0x2b4b('0xa'));var ejs=require(_0x2b4b('0xb'));var fs=require('fs');var _=require(_0x2b4b('0xc'));var squel=require(_0x2b4b('0xd'));var crypto=require('crypto');var jsforce=require(_0x2b4b('0xe'));var deskjs=require(_0x2b4b('0xf'));var toCsv=require(_0x2b4b('0xa'));var querystring=require(_0x2b4b('0x10'));var Papa=require(_0x2b4b('0x11'));var Redis=require(_0x2b4b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2b4b('0x13'));var as=require(_0x2b4b('0x14'));var hardwareService=require(_0x2b4b('0x15'));var logger=require(_0x2b4b('0x16'))(_0x2b4b('0x17'));var utils=require(_0x2b4b('0x18'));var config=require(_0x2b4b('0x19'));var db=require(_0x2b4b('0x1a'))['db'];config[_0x2b4b('0x1b')]=_[_0x2b4b('0x1c')](config[_0x2b4b('0x1b')],{'host':_0x2b4b('0x1d'),'port':0x18eb});var socket=require(_0x2b4b('0x1e'))(new Redis(config['redis']));require(_0x2b4b('0x1f'))['register'](socket);function respondWithStatusCode(_0xd580d0,_0x2bd706){_0x2bd706=_0x2bd706||0xcc;return function(_0x1fb735){if(_0x1fb735){return _0xd580d0[_0x2b4b('0x20')](_0x2bd706);}return _0xd580d0[_0x2b4b('0x21')](_0x2bd706)['end']();};}function respondWithResult(_0x49b598,_0x541f3c){_0x541f3c=_0x541f3c||0xc8;return function(_0x58f3cb){if(_0x58f3cb){return _0x49b598[_0x2b4b('0x21')](_0x541f3c)['json'](_0x58f3cb);}};}function respondWithFilteredResult(_0x166fa0,_0xbd74ef){return function(_0x44f581){if(_0x44f581){var _0x526e7e=_0x44f581[_0x2b4b('0x22')],_0x307c20=_0xbd74ef['offset'],_0x23014b=_0xbd74ef[_0x2b4b('0x23')]+_0xbd74ef[_0x2b4b('0x24')],_0x20a2a8;if(_0x23014b>=_0x526e7e){_0x23014b=_0x526e7e;_0x20a2a8=0xc8;}else{_0x20a2a8=0xce;}_0x166fa0[_0x2b4b('0x21')](_0x20a2a8);return _0x166fa0['set'](_0x2b4b('0x25'),_0x307c20+'-'+_0x23014b+'/'+_0x526e7e)[_0x2b4b('0x26')](_0x44f581);}return null;};}function patchUpdates(_0x31d663){return function(_0x341cbc){try{jsonpatch['apply'](_0x341cbc,_0x31d663,!![]);}catch(_0x4865e6){return BPromise['reject'](_0x4865e6);}return _0x341cbc[_0x2b4b('0x27')]();};}function saveUpdates(_0x38dc4b,_0x3f030e){return function(_0x19fc8a){if(_0x19fc8a){return _0x19fc8a[_0x2b4b('0x28')](_0x38dc4b)[_0x2b4b('0x29')](function(_0x32ae72){return _0x32ae72;});}return null;};}function removeEntity(_0x256994,_0x36ea63){return function(_0xf45ac1){if(_0xf45ac1){return _0xf45ac1[_0x2b4b('0x2a')]()[_0x2b4b('0x29')](function(){var _0x4acf9f=_0xf45ac1[_0x2b4b('0x2b')]({'plain':!![]});var _0xc04689=_0x2b4b('0x2c');return db[_0x2b4b('0x2d')][_0x2b4b('0x2a')]({'where':{'type':_0xc04689,'resourceId':_0x4acf9f['id']}})[_0x2b4b('0x29')](function(){return _0xf45ac1;});})[_0x2b4b('0x29')](function(){_0x256994[_0x2b4b('0x21')](0xcc)[_0x2b4b('0x2e')]();});}};}function handleEntityNotFound(_0x478328,_0x5468b7){return function(_0x1ebf2a){if(!_0x1ebf2a){_0x478328[_0x2b4b('0x20')](0x194);}return _0x1ebf2a;};}function handleError(_0x51b1cf,_0x20baaa){_0x20baaa=_0x20baaa||0x1f4;return function(_0x3e276e){logger[_0x2b4b('0x2f')](_0x3e276e[_0x2b4b('0x30')]);if(_0x3e276e[_0x2b4b('0x31')]){delete _0x3e276e[_0x2b4b('0x31')];}_0x51b1cf[_0x2b4b('0x21')](_0x20baaa)[_0x2b4b('0x32')](_0x3e276e);};}exports[_0x2b4b('0x33')]=function(_0xafe645,_0x3cce9d){var _0x1da8d3={},_0x1d6bfa={},_0x501cc2={'count':0x0,'rows':[]};var _0x176482=_[_0x2b4b('0x34')](db['Dashboard'][_0x2b4b('0x35')],function(_0x11382d){return{'name':_0x11382d['fieldName'],'type':_0x11382d[_0x2b4b('0x36')]['key']};});_0x1d6bfa[_0x2b4b('0x37')]=_[_0x2b4b('0x34')](_0x176482,_0x2b4b('0x31'));_0x1d6bfa[_0x2b4b('0x38')]=_[_0x2b4b('0x39')](_0xafe645[_0x2b4b('0x38')]);_0x1d6bfa['filters']=_[_0x2b4b('0x3a')](_0x1d6bfa[_0x2b4b('0x37')],_0x1d6bfa[_0x2b4b('0x38')]);_0x1da8d3[_0x2b4b('0x3b')]=_[_0x2b4b('0x3a')](_0x1d6bfa[_0x2b4b('0x37')],qs[_0x2b4b('0x3c')](_0xafe645['query'][_0x2b4b('0x3c')]));_0x1da8d3[_0x2b4b('0x3b')]=_0x1da8d3[_0x2b4b('0x3b')][_0x2b4b('0x3d')]?_0x1da8d3[_0x2b4b('0x3b')]:_0x1d6bfa['model'];if(!_0xafe645[_0x2b4b('0x38')][_0x2b4b('0x3e')](_0x2b4b('0x3f'))){_0x1da8d3[_0x2b4b('0x24')]=qs[_0x2b4b('0x24')](_0xafe645[_0x2b4b('0x38')][_0x2b4b('0x24')]);_0x1da8d3[_0x2b4b('0x23')]=qs[_0x2b4b('0x23')](_0xafe645[_0x2b4b('0x38')][_0x2b4b('0x23')]);}_0x1da8d3['order']=qs[_0x2b4b('0x40')](_0xafe645[_0x2b4b('0x38')][_0x2b4b('0x40')]);_0x1da8d3['where']=qs[_0x2b4b('0x41')](_['pick'](_0xafe645[_0x2b4b('0x38')],_0x1d6bfa[_0x2b4b('0x41')]),_0x176482);if(_0xafe645[_0x2b4b('0x38')]['filter']){_0x1da8d3['where']=_[_0x2b4b('0x42')](_0x1da8d3[_0x2b4b('0x43')],{'$or':_[_0x2b4b('0x34')](_0x176482,function(_0x3fc30b){if(_0x3fc30b[_0x2b4b('0x36')]!==_0x2b4b('0x44')){var _0x275a0a={};_0x275a0a[_0x3fc30b[_0x2b4b('0x31')]]={'$like':'%'+_0xafe645['query'][_0x2b4b('0x45')]+'%'};return _0x275a0a;}})});}_0x1da8d3=_[_0x2b4b('0x42')]({},_0x1da8d3,_0xafe645[_0x2b4b('0x46')]);var _0x131d3b={'where':_0x1da8d3[_0x2b4b('0x43')]};return db['Dashboard']['count'](_0x131d3b)[_0x2b4b('0x29')](function(_0xdca9c1){_0x501cc2[_0x2b4b('0x22')]=_0xdca9c1;if(_0xafe645[_0x2b4b('0x38')][_0x2b4b('0x47')]){_0x1da8d3['include']=[{'all':!![]}];}return db['Dashboard'][_0x2b4b('0x48')](_0x1da8d3);})['then'](function(_0x4fad13){_0x501cc2[_0x2b4b('0x49')]=_0x4fad13;return _0x501cc2;})[_0x2b4b('0x29')](respondWithFilteredResult(_0x3cce9d,_0x1da8d3))[_0x2b4b('0x4a')](handleError(_0x3cce9d,null));};exports['show']=function(_0x48d25e,_0x47cb77){var _0x2be41e={'raw':![],'where':{'id':_0x48d25e[_0x2b4b('0x4b')]['id']}},_0x54f8c1={};_0x54f8c1[_0x2b4b('0x37')]=_['keys'](db['Dashboard'][_0x2b4b('0x35')]);_0x54f8c1[_0x2b4b('0x38')]=_['keys'](_0x48d25e[_0x2b4b('0x38')]);_0x54f8c1[_0x2b4b('0x41')]=_[_0x2b4b('0x3a')](_0x54f8c1['model'],_0x54f8c1[_0x2b4b('0x38')]);_0x2be41e[_0x2b4b('0x3b')]=_[_0x2b4b('0x3a')](_0x54f8c1[_0x2b4b('0x37')],qs['fields'](_0x48d25e[_0x2b4b('0x38')][_0x2b4b('0x3c')]));_0x2be41e[_0x2b4b('0x3b')]=_0x2be41e[_0x2b4b('0x3b')][_0x2b4b('0x3d')]?_0x2be41e[_0x2b4b('0x3b')]:_0x54f8c1[_0x2b4b('0x37')];if(_0x48d25e[_0x2b4b('0x38')][_0x2b4b('0x47')]){_0x2be41e['include']=[{'all':!![]}];}_0x2be41e=_[_0x2b4b('0x42')]({},_0x2be41e,_0x48d25e[_0x2b4b('0x46')]);return db[_0x2b4b('0x4c')][_0x2b4b('0x4d')](_0x2be41e)[_0x2b4b('0x29')](handleEntityNotFound(_0x47cb77,null))[_0x2b4b('0x29')](respondWithResult(_0x47cb77,null))[_0x2b4b('0x4a')](handleError(_0x47cb77,null));};exports['create']=function(_0x3ebd99,_0x1f829f){return db[_0x2b4b('0x4c')][_0x2b4b('0x4e')](_0x3ebd99[_0x2b4b('0x4f')],{})[_0x2b4b('0x29')](function(_0x21cb46){var _0x412736=_0x3ebd99[_0x2b4b('0x50')]['get']({'plain':!![]});if(!_0x412736)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x412736['role']===_0x2b4b('0x50')){var _0x462a56=_0x21cb46[_0x2b4b('0x2b')]({'plain':!![]});var _0x478867=_0x2b4b('0x2c');return db[_0x2b4b('0x51')][_0x2b4b('0x4d')]({'where':{'name':_0x478867,'userProfileId':_0x412736['userProfileId']},'raw':!![]})[_0x2b4b('0x29')](function(_0x59c9ac){if(_0x59c9ac&&_0x59c9ac[_0x2b4b('0x52')]===0x0){return db[_0x2b4b('0x2d')][_0x2b4b('0x4e')]({'name':_0x462a56['name'],'resourceId':_0x462a56['id'],'type':_0x59c9ac[_0x2b4b('0x31')],'sectionId':_0x59c9ac['id']},{})[_0x2b4b('0x29')](function(){return _0x21cb46;});}else{return _0x21cb46;}})[_0x2b4b('0x4a')](function(_0x502a98){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x502a98);throw _0x502a98;});}return _0x21cb46;})['then'](respondWithResult(_0x1f829f,0xc9))[_0x2b4b('0x4a')](handleError(_0x1f829f,null));};exports[_0x2b4b('0x53')]=function(_0x18b27a,_0x2144f9){var _0x1e1c83={'where':{'id':_0x18b27a[_0x2b4b('0x4b')]['id']}},_0x25de2d={};_0x25de2d[_0x2b4b('0x37')]=_[_0x2b4b('0x39')](db[_0x2b4b('0x4c')]['rawAttributes']);_0x1e1c83[_0x2b4b('0x3b')]=_['intersection'](_0x25de2d['model'],qs[_0x2b4b('0x3c')](_0x18b27a[_0x2b4b('0x38')][_0x2b4b('0x3c')]));_0x1e1c83['attributes']=_0x1e1c83[_0x2b4b('0x3b')][_0x2b4b('0x3d')]?_0x1e1c83[_0x2b4b('0x3b')]:_0x25de2d['model'];if(_0x18b27a[_0x2b4b('0x38')][_0x2b4b('0x47')]){_0x1e1c83[_0x2b4b('0x54')]=[{'all':!![]}];}_0x1e1c83=_[_0x2b4b('0x42')]({},_0x1e1c83,_0x18b27a[_0x2b4b('0x46')]);return db[_0x2b4b('0x4c')][_0x2b4b('0x4d')](_0x1e1c83)[_0x2b4b('0x29')](handleEntityNotFound(_0x2144f9,null))[_0x2b4b('0x29')](function(_0x3d9e6b){if(_0x3d9e6b){var _0x1a6714=_0x3d9e6b[_0x2b4b('0x2b')]({'plain':!![]});_0x1a6714=qs['omit'](_0x1a6714,['id',_0x2b4b('0x55'),'updatedAt']);_0x18b27a['body']=_[_0x2b4b('0x56')](_0x18b27a[_0x2b4b('0x4f')],['id',_0x2b4b('0x55'),_0x2b4b('0x57')]);return db['Dashboard']['create'](_[_0x2b4b('0x42')](_0x1a6714,_0x18b27a[_0x2b4b('0x4f')]),{'include':_0x18b27a['query']['includeAll']?[{'all':!![]}]:undefined})[_0x2b4b('0x29')](function(_0x1b4f32){var _0x136fe6=_0x18b27a[_0x2b4b('0x50')][_0x2b4b('0x2b')]({'plain':!![]});if(!_0x136fe6)throw new Error(_0x2b4b('0x58'));if(_0x136fe6[_0x2b4b('0x59')]===_0x2b4b('0x50')){var _0xf1fbac=_0x1b4f32[_0x2b4b('0x2b')]({'plain':!![]});var _0x51178b=_0x2b4b('0x2c');return db[_0x2b4b('0x51')][_0x2b4b('0x4d')]({'where':{'name':_0x51178b,'userProfileId':_0x136fe6[_0x2b4b('0x5a')]},'raw':!![]})[_0x2b4b('0x29')](function(_0x4c1df0){if(_0x4c1df0&&_0x4c1df0['autoAssociation']===0x0){return db[_0x2b4b('0x2d')][_0x2b4b('0x4e')]({'name':_0xf1fbac[_0x2b4b('0x31')],'resourceId':_0xf1fbac['id'],'type':_0x4c1df0[_0x2b4b('0x31')],'sectionId':_0x4c1df0['id']},{})[_0x2b4b('0x29')](function(){return _0x1b4f32;});}else{return _0x1b4f32;}})[_0x2b4b('0x4a')](function(_0x514069){logger['error'](_0x2b4b('0x5b'),_0x514069);throw _0x514069;});}return _0x1b4f32;});}})[_0x2b4b('0x29')](respondWithResult(_0x2144f9,0xc9))[_0x2b4b('0x4a')](handleError(_0x2144f9,null));};exports[_0x2b4b('0x28')]=function(_0x348e90,_0x271b65){if(_0x348e90['body']['id']){delete _0x348e90['body']['id'];}return db[_0x2b4b('0x4c')][_0x2b4b('0x4d')]({'where':{'id':_0x348e90[_0x2b4b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x271b65,null))[_0x2b4b('0x29')](saveUpdates(_0x348e90[_0x2b4b('0x4f')],null))[_0x2b4b('0x29')](respondWithResult(_0x271b65,null))['catch'](handleError(_0x271b65,null));};exports[_0x2b4b('0x2a')]=function(_0x5032b3,_0x2a1d74){return db['Dashboard'][_0x2b4b('0x4d')]({'where':{'id':_0x5032b3[_0x2b4b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2a1d74,null))[_0x2b4b('0x29')](removeEntity(_0x2a1d74,null))[_0x2b4b('0x4a')](handleError(_0x2a1d74,null));};function widgetAttributes(_0x429f52){try{switch(_0x429f52['type']){case'iframe':return[{'name':'attrUrl','value':_0x429f52[_0x2b4b('0x5c')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52[_0x2b4b('0x5d')][0x0]?_0x429f52[_0x2b4b('0x5d')][0x0][_0x2b4b('0x5e')]:undefined)||_0x2b4b('0x5f')}];case _0x2b4b('0x60'):return[{'name':_0x2b4b('0x61'),'value':_0x429f52[_0x2b4b('0x61')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52[_0x2b4b('0x5d')][0x0]?_0x429f52[_0x2b4b('0x5d')][0x0][_0x2b4b('0x5e')]:undefined)||''}];case _0x2b4b('0x62'):return[{'name':_0x2b4b('0x63'),'value':_0x429f52['attrHourFormat']||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52['attrs'][0x0]?_0x429f52[_0x2b4b('0x5d')][0x0]['value']:undefined)||_0x2b4b('0x64')},{'name':_0x2b4b('0x65'),'value':_0x429f52[_0x2b4b('0x65')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52[_0x2b4b('0x5d')][0x1]?_0x429f52[_0x2b4b('0x5d')][0x1]['value']:undefined)||_0x2b4b('0x66')},{'name':_0x2b4b('0x67'),'value':_0x429f52[_0x2b4b('0x67')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52[_0x2b4b('0x5d')][0x2]?_0x429f52[_0x2b4b('0x5d')][0x2][_0x2b4b('0x5e')]:undefined)||0xc}];case _0x2b4b('0x68'):return[{'name':'attrMetric','value':_0x429f52[_0x2b4b('0x69')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52['attrs'][0x0]?_0x429f52['attrs'][0x0][_0x2b4b('0x5e')]:undefined)||_0x2b4b('0x6a')},{'name':_0x2b4b('0x6b'),'value':_0x429f52[_0x2b4b('0x6b')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52[_0x2b4b('0x5d')][0x1]?_0x429f52[_0x2b4b('0x5d')][0x1][_0x2b4b('0x5e')]:undefined)||[]},{'name':_0x2b4b('0x67'),'value':_0x429f52[_0x2b4b('0x67')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52['attrs'][0x2]?_0x429f52[_0x2b4b('0x5d')][0x2]['value']:undefined)||0x14}];case _0x2b4b('0x6c'):case _0x2b4b('0x6d'):return[{'name':_0x2b4b('0x6e'),'value':_0x429f52['attrSerie1']||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52[_0x2b4b('0x5d')][0x0]?_0x429f52['attrs'][0x0][_0x2b4b('0x5e')]:undefined)||_0x2b4b('0x6a')},{'name':_0x2b4b('0x6f'),'value':_0x429f52[_0x2b4b('0x6f')]||(_0x429f52['attrs']&&_0x429f52[_0x2b4b('0x5d')][0x1]?_0x429f52[_0x2b4b('0x5d')][0x1]['value']:undefined)||null},{'name':_0x2b4b('0x70'),'value':_0x429f52[_0x2b4b('0x70')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52[_0x2b4b('0x5d')][0x2]?_0x429f52[_0x2b4b('0x5d')][0x2][_0x2b4b('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x429f52[_0x2b4b('0x6b')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52[_0x2b4b('0x5d')][0x3]?_0x429f52['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x429f52[_0x2b4b('0x71')]||(_0x429f52['attrs']&&_0x429f52[_0x2b4b('0x5d')][0x0]?_0x429f52[_0x2b4b('0x5d')][0x0][_0x2b4b('0x36')]:undefined)||null,'value':_0x429f52[_0x2b4b('0x72')]||(_0x429f52['attrs']&&_0x429f52[_0x2b4b('0x5d')][0x0]?_0x429f52['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x429f52[_0x2b4b('0x73')]||(_0x429f52[_0x2b4b('0x5d')]&&_0x429f52[_0x2b4b('0x5d')][0x1]?_0x429f52[_0x2b4b('0x5d')][0x1][_0x2b4b('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x1898aa){logger[_0x2b4b('0x2f')](_0x2b4b('0x74'),JSON[_0x2b4b('0x75')](_0x1898aa));return[];}}exports[_0x2b4b('0x76')]=function(_0x89ed58,_0x544845,_0xdf348c){if(_0x89ed58['body']['id']){delete _0x89ed58[_0x2b4b('0x4f')]['id'];}return db[_0x2b4b('0x4c')]['find']({'where':{'id':_0x89ed58[_0x2b4b('0x4b')]['id']}})[_0x2b4b('0x29')](handleEntityNotFound(_0x544845,null))[_0x2b4b('0x29')](function(_0x42bbb6){if(_0x42bbb6){_0x89ed58[_0x2b4b('0x4f')][_0x2b4b('0x77')]=_0x42bbb6['id'];_0x89ed58[_0x2b4b('0x4f')][_0x2b4b('0x5d')]=widgetAttributes(_0x89ed58['body']);return db[_0x2b4b('0x78')]['create'](_0x89ed58['body']);}})['then'](respondWithResult(_0x544845,null))[_0x2b4b('0x4a')](handleError(_0x544845,null));};exports[_0x2b4b('0x79')]=function(_0x4f1cb1,_0xf5423f,_0xea44df){var _0x42c595={};var _0x294890={};var _0x1ca22b;var _0x2521c2;return db[_0x2b4b('0x4c')][_0x2b4b('0x7a')]({'where':{'id':_0x4f1cb1[_0x2b4b('0x4b')]['id']}})[_0x2b4b('0x29')](handleEntityNotFound(_0xf5423f,null))[_0x2b4b('0x29')](function(_0x1765a2){if(_0x1765a2){_0x1ca22b=_0x1765a2;_0x294890[_0x2b4b('0x37')]=_[_0x2b4b('0x39')](db[_0x2b4b('0x78')]['rawAttributes']);_0x294890['query']=_[_0x2b4b('0x39')](_0x4f1cb1[_0x2b4b('0x38')]);_0x294890[_0x2b4b('0x41')]=_[_0x2b4b('0x3a')](_0x294890[_0x2b4b('0x37')],_0x294890['query']);_0x42c595[_0x2b4b('0x3b')]=_['intersection'](_0x294890[_0x2b4b('0x37')],qs[_0x2b4b('0x3c')](_0x4f1cb1['query'][_0x2b4b('0x3c')]));_0x42c595[_0x2b4b('0x3b')]=_0x42c595['attributes']['length']?_0x42c595[_0x2b4b('0x3b')]:_0x294890[_0x2b4b('0x37')];_0x42c595[_0x2b4b('0x7b')]=qs['sort'](_0x4f1cb1['query'][_0x2b4b('0x40')]);_0x42c595[_0x2b4b('0x43')]=qs[_0x2b4b('0x41')](_[_0x2b4b('0x7c')](_0x4f1cb1[_0x2b4b('0x38')],_0x294890[_0x2b4b('0x41')]));if(_0x4f1cb1[_0x2b4b('0x38')][_0x2b4b('0x45')]){_0x42c595[_0x2b4b('0x43')]=_['merge'](_0x42c595['where'],{'$or':_[_0x2b4b('0x34')](_0x42c595[_0x2b4b('0x3b')],function(_0x3b2ebb){var _0x1d2449={};_0x1d2449[_0x3b2ebb]={'$like':'%'+_0x4f1cb1[_0x2b4b('0x38')][_0x2b4b('0x45')]+'%'};return _0x1d2449;})});}_0x42c595=_[_0x2b4b('0x42')]({},_0x42c595,_0x4f1cb1[_0x2b4b('0x46')]);return _0x1ca22b[_0x2b4b('0x79')](_0x42c595);}})['then'](function(_0x5e4642){if(_0x5e4642){_0x2521c2=_0x5e4642[_0x2b4b('0x3d')];if(!_0x4f1cb1[_0x2b4b('0x38')][_0x2b4b('0x3e')](_0x2b4b('0x3f'))){_0x42c595['limit']=qs[_0x2b4b('0x24')](_0x4f1cb1['query'][_0x2b4b('0x24')]);_0x42c595['offset']=qs[_0x2b4b('0x23')](_0x4f1cb1[_0x2b4b('0x38')][_0x2b4b('0x23')]);}return _0x1ca22b[_0x2b4b('0x79')](_0x42c595);}})[_0x2b4b('0x29')](function(_0x39b81b){if(_0x39b81b){return _0x39b81b?{'count':_0x2521c2,'rows':_0x39b81b}:null;}})['then'](respondWithResult(_0xf5423f,null))[_0x2b4b('0x4a')](handleError(_0xf5423f,null));}; \ No newline at end of file +var _0x9f2c=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','Dashboard','includeAll','findAll','catch','show','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','updatedAt','createdAt','CustomDashboards','UserProfileSection','autoAssociation','params','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','getItems','order','html-pdf','eml-format'];(function(_0x15e02c,_0x37db6a){var _0x4cdb3f=function(_0x5148a5){while(--_0x5148a5){_0x15e02c['push'](_0x15e02c['shift']());}};_0x4cdb3f(++_0x37db6a);}(_0x9f2c,0xe8));var _0xc9f2=function(_0x5b2809,_0x48b226){_0x5b2809=_0x5b2809-0x0;var _0x572dee=_0x9f2c[_0x5b2809];return _0x572dee;};'use strict';var pdf=require(_0xc9f2('0x0'));var emlformat=require(_0xc9f2('0x1'));var rimraf=require(_0xc9f2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9f2('0x3'));var rp=require(_0xc9f2('0x4'));var moment=require(_0xc9f2('0x5'));var BPromise=require(_0xc9f2('0x6'));var Mustache=require(_0xc9f2('0x7'));var util=require(_0xc9f2('0x8'));var path=require(_0xc9f2('0x9'));var sox=require(_0xc9f2('0xa'));var csv=require(_0xc9f2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc9f2('0xc'));var squel=require(_0xc9f2('0xd'));var crypto=require(_0xc9f2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc9f2('0xf'));var toCsv=require(_0xc9f2('0xb'));var querystring=require(_0xc9f2('0x10'));var Papa=require(_0xc9f2('0x11'));var Redis=require(_0xc9f2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc9f2('0x13'));var as=require(_0xc9f2('0x14'));var hardwareService=require(_0xc9f2('0x15'));var logger=require(_0xc9f2('0x16'))('api');var utils=require(_0xc9f2('0x17'));var config=require(_0xc9f2('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc9f2('0x19')](config[_0xc9f2('0x1a')],{'host':_0xc9f2('0x1b'),'port':0x18eb});var socket=require(_0xc9f2('0x1c'))(new Redis(config[_0xc9f2('0x1a')]));require(_0xc9f2('0x1d'))[_0xc9f2('0x1e')](socket);function respondWithStatusCode(_0x1c3db3,_0xe30a68){_0xe30a68=_0xe30a68||0xcc;return function(_0x125921){if(_0x125921){return _0x1c3db3['sendStatus'](_0xe30a68);}return _0x1c3db3['status'](_0xe30a68)[_0xc9f2('0x1f')]();};}function respondWithResult(_0x340198,_0x34ecdc){_0x34ecdc=_0x34ecdc||0xc8;return function(_0x6917b5){if(_0x6917b5){return _0x340198[_0xc9f2('0x20')](_0x34ecdc)[_0xc9f2('0x21')](_0x6917b5);}};}function respondWithFilteredResult(_0x83f72a,_0x139257){return function(_0x2c5396){if(_0x2c5396){var _0x5dab1c=_0x2c5396[_0xc9f2('0x22')],_0x19f10d=_0x139257[_0xc9f2('0x23')],_0x83f2d1=_0x139257[_0xc9f2('0x23')]+_0x139257[_0xc9f2('0x24')],_0x1caef6;if(_0x83f2d1>=_0x5dab1c){_0x83f2d1=_0x5dab1c;_0x1caef6=0xc8;}else{_0x1caef6=0xce;}_0x83f72a['status'](_0x1caef6);return _0x83f72a[_0xc9f2('0x25')](_0xc9f2('0x26'),_0x19f10d+'-'+_0x83f2d1+'/'+_0x5dab1c)[_0xc9f2('0x21')](_0x2c5396);}return null;};}function patchUpdates(_0x23930a){return function(_0x5b3cfc){try{jsonpatch[_0xc9f2('0x27')](_0x5b3cfc,_0x23930a,!![]);}catch(_0x2f75f6){return BPromise['reject'](_0x2f75f6);}return _0x5b3cfc[_0xc9f2('0x28')]();};}function saveUpdates(_0x259357,_0x1749f4){return function(_0x19a4e1){if(_0x19a4e1){return _0x19a4e1[_0xc9f2('0x29')](_0x259357)[_0xc9f2('0x2a')](function(_0x1b1bdc){return _0x1b1bdc;});}return null;};}function removeEntity(_0x406190,_0x4629eb){return function(_0x31e5f9){if(_0x31e5f9){return _0x31e5f9[_0xc9f2('0x2b')]()[_0xc9f2('0x2a')](function(){var _0x59042f=_0x31e5f9[_0xc9f2('0x2c')]({'plain':!![]});var _0x8782df='CustomDashboards';return db[_0xc9f2('0x2d')][_0xc9f2('0x2b')]({'where':{'type':_0x8782df,'resourceId':_0x59042f['id']}})[_0xc9f2('0x2a')](function(){return _0x31e5f9;});})[_0xc9f2('0x2a')](function(){_0x406190[_0xc9f2('0x20')](0xcc)[_0xc9f2('0x1f')]();});}};}function handleEntityNotFound(_0x2e0f24,_0xf0f0c8){return function(_0x3b7691){if(!_0x3b7691){_0x2e0f24[_0xc9f2('0x2e')](0x194);}return _0x3b7691;};}function handleError(_0x4203a7,_0x1f6605){_0x1f6605=_0x1f6605||0x1f4;return function(_0x2c792d){logger[_0xc9f2('0x2f')](_0x2c792d[_0xc9f2('0x30')]);if(_0x2c792d['name']){delete _0x2c792d[_0xc9f2('0x31')];}_0x4203a7[_0xc9f2('0x20')](_0x1f6605)[_0xc9f2('0x32')](_0x2c792d);};}exports[_0xc9f2('0x33')]=function(_0x187ca3,_0x5c2cb2){var _0x17b1ec={},_0x2f35a9={},_0x50d291={'count':0x0,'rows':[]};var _0x59821c=_['map'](db['Dashboard']['rawAttributes'],function(_0xa7f3a5){return{'name':_0xa7f3a5[_0xc9f2('0x34')],'type':_0xa7f3a5[_0xc9f2('0x35')][_0xc9f2('0x36')]};});_0x2f35a9[_0xc9f2('0x37')]=_['map'](_0x59821c,_0xc9f2('0x31'));_0x2f35a9[_0xc9f2('0x38')]=_[_0xc9f2('0x39')](_0x187ca3[_0xc9f2('0x38')]);_0x2f35a9['filters']=_[_0xc9f2('0x3a')](_0x2f35a9['model'],_0x2f35a9[_0xc9f2('0x38')]);_0x17b1ec['attributes']=_[_0xc9f2('0x3a')](_0x2f35a9[_0xc9f2('0x37')],qs[_0xc9f2('0x3b')](_0x187ca3['query'][_0xc9f2('0x3b')]));_0x17b1ec[_0xc9f2('0x3c')]=_0x17b1ec[_0xc9f2('0x3c')]['length']?_0x17b1ec[_0xc9f2('0x3c')]:_0x2f35a9[_0xc9f2('0x37')];if(!_0x187ca3[_0xc9f2('0x38')][_0xc9f2('0x3d')](_0xc9f2('0x3e'))){_0x17b1ec[_0xc9f2('0x24')]=qs[_0xc9f2('0x24')](_0x187ca3[_0xc9f2('0x38')]['limit']);_0x17b1ec[_0xc9f2('0x23')]=qs['offset'](_0x187ca3[_0xc9f2('0x38')][_0xc9f2('0x23')]);}_0x17b1ec['order']=qs[_0xc9f2('0x3f')](_0x187ca3[_0xc9f2('0x38')][_0xc9f2('0x3f')]);_0x17b1ec[_0xc9f2('0x40')]=qs[_0xc9f2('0x41')](_[_0xc9f2('0x42')](_0x187ca3[_0xc9f2('0x38')],_0x2f35a9[_0xc9f2('0x41')]),_0x59821c);if(_0x187ca3[_0xc9f2('0x38')][_0xc9f2('0x43')]){_0x17b1ec[_0xc9f2('0x40')]=_[_0xc9f2('0x44')](_0x17b1ec['where'],{'$or':_[_0xc9f2('0x45')](_0x59821c,function(_0x2c52c4){if(_0x2c52c4[_0xc9f2('0x35')]!==_0xc9f2('0x46')){var _0x59913a={};_0x59913a[_0x2c52c4[_0xc9f2('0x31')]]={'$like':'%'+_0x187ca3[_0xc9f2('0x38')][_0xc9f2('0x43')]+'%'};return _0x59913a;}})});}_0x17b1ec=_[_0xc9f2('0x44')]({},_0x17b1ec,_0x187ca3[_0xc9f2('0x47')]);var _0x57323e={'where':_0x17b1ec[_0xc9f2('0x40')]};return db[_0xc9f2('0x48')][_0xc9f2('0x22')](_0x57323e)[_0xc9f2('0x2a')](function(_0x39e864){_0x50d291[_0xc9f2('0x22')]=_0x39e864;if(_0x187ca3['query'][_0xc9f2('0x49')]){_0x17b1ec['include']=[{'all':!![]}];}return db[_0xc9f2('0x48')][_0xc9f2('0x4a')](_0x17b1ec);})[_0xc9f2('0x2a')](function(_0x3a3bba){_0x50d291['rows']=_0x3a3bba;return _0x50d291;})['then'](respondWithFilteredResult(_0x5c2cb2,_0x17b1ec))[_0xc9f2('0x4b')](handleError(_0x5c2cb2,null));};exports[_0xc9f2('0x4c')]=function(_0x1040cd,_0x2b8884){var _0x145231={'raw':![],'where':{'id':_0x1040cd['params']['id']}},_0x58afb3={};_0x58afb3['model']=_[_0xc9f2('0x39')](db[_0xc9f2('0x48')]['rawAttributes']);_0x58afb3[_0xc9f2('0x38')]=_[_0xc9f2('0x39')](_0x1040cd[_0xc9f2('0x38')]);_0x58afb3[_0xc9f2('0x41')]=_[_0xc9f2('0x3a')](_0x58afb3[_0xc9f2('0x37')],_0x58afb3[_0xc9f2('0x38')]);_0x145231[_0xc9f2('0x3c')]=_[_0xc9f2('0x3a')](_0x58afb3[_0xc9f2('0x37')],qs[_0xc9f2('0x3b')](_0x1040cd[_0xc9f2('0x38')][_0xc9f2('0x3b')]));_0x145231[_0xc9f2('0x3c')]=_0x145231[_0xc9f2('0x3c')][_0xc9f2('0x4d')]?_0x145231[_0xc9f2('0x3c')]:_0x58afb3[_0xc9f2('0x37')];if(_0x1040cd['query'][_0xc9f2('0x49')]){_0x145231[_0xc9f2('0x4e')]=[{'all':!![]}];}_0x145231=_[_0xc9f2('0x44')]({},_0x145231,_0x1040cd[_0xc9f2('0x47')]);return db[_0xc9f2('0x48')][_0xc9f2('0x4f')](_0x145231)[_0xc9f2('0x2a')](handleEntityNotFound(_0x2b8884,null))[_0xc9f2('0x2a')](respondWithResult(_0x2b8884,null))[_0xc9f2('0x4b')](handleError(_0x2b8884,null));};exports[_0xc9f2('0x50')]=function(_0x4b40ea,_0x47c7bc){return db[_0xc9f2('0x48')][_0xc9f2('0x50')](_0x4b40ea[_0xc9f2('0x51')],{})[_0xc9f2('0x2a')](function(_0x3f4c19){var _0xf40c33=_0x4b40ea[_0xc9f2('0x52')][_0xc9f2('0x2c')]({'plain':!![]});if(!_0xf40c33)throw new Error(_0xc9f2('0x53'));if(_0xf40c33[_0xc9f2('0x54')]===_0xc9f2('0x52')){var _0x191a47=_0x3f4c19['get']({'plain':!![]});var _0x4df610='CustomDashboards';return db['UserProfileSection'][_0xc9f2('0x4f')]({'where':{'name':_0x4df610,'userProfileId':_0xf40c33['userProfileId']},'raw':!![]})[_0xc9f2('0x2a')](function(_0x263a17){if(_0x263a17&&_0x263a17['autoAssociation']===0x0){return db['UserProfileResource'][_0xc9f2('0x50')]({'name':_0x191a47['name'],'resourceId':_0x191a47['id'],'type':_0x263a17['name'],'sectionId':_0x263a17['id']},{})[_0xc9f2('0x2a')](function(){return _0x3f4c19;});}else{return _0x3f4c19;}})[_0xc9f2('0x4b')](function(_0x24ed86){logger['error'](_0xc9f2('0x55'),_0x24ed86);throw _0x24ed86;});}return _0x3f4c19;})[_0xc9f2('0x2a')](respondWithResult(_0x47c7bc,0xc9))[_0xc9f2('0x4b')](handleError(_0x47c7bc,null));};exports['clone']=function(_0x4cc2c5,_0x50b3c7){var _0x2c91fb={'where':{'id':_0x4cc2c5['params']['id']}},_0x41674a={};_0x41674a[_0xc9f2('0x37')]=_[_0xc9f2('0x39')](db[_0xc9f2('0x48')][_0xc9f2('0x56')]);_0x2c91fb[_0xc9f2('0x3c')]=_[_0xc9f2('0x3a')](_0x41674a[_0xc9f2('0x37')],qs['fields'](_0x4cc2c5[_0xc9f2('0x38')][_0xc9f2('0x3b')]));_0x2c91fb[_0xc9f2('0x3c')]=_0x2c91fb[_0xc9f2('0x3c')][_0xc9f2('0x4d')]?_0x2c91fb[_0xc9f2('0x3c')]:_0x41674a[_0xc9f2('0x37')];if(_0x4cc2c5[_0xc9f2('0x38')][_0xc9f2('0x49')]){_0x2c91fb[_0xc9f2('0x4e')]=[{'all':!![]}];}_0x2c91fb=_[_0xc9f2('0x44')]({},_0x2c91fb,_0x4cc2c5[_0xc9f2('0x47')]);return db[_0xc9f2('0x48')][_0xc9f2('0x4f')](_0x2c91fb)['then'](handleEntityNotFound(_0x50b3c7,null))[_0xc9f2('0x2a')](function(_0xa9eda2){if(_0xa9eda2){var _0x35c560=_0xa9eda2['get']({'plain':!![]});_0x35c560=qs['omit'](_0x35c560,['id','createdAt',_0xc9f2('0x57')]);_0x4cc2c5[_0xc9f2('0x51')]=_['omit'](_0x4cc2c5[_0xc9f2('0x51')],['id',_0xc9f2('0x58'),'updatedAt']);return db[_0xc9f2('0x48')]['create'](_[_0xc9f2('0x44')](_0x35c560,_0x4cc2c5[_0xc9f2('0x51')]),{'include':_0x4cc2c5[_0xc9f2('0x38')][_0xc9f2('0x49')]?[{'all':!![]}]:undefined})[_0xc9f2('0x2a')](function(_0x65b0){var _0x59e649=_0x4cc2c5[_0xc9f2('0x52')][_0xc9f2('0x2c')]({'plain':!![]});if(!_0x59e649)throw new Error(_0xc9f2('0x53'));if(_0x59e649[_0xc9f2('0x54')]===_0xc9f2('0x52')){var _0x44581c=_0x65b0['get']({'plain':!![]});var _0x5f20bc=_0xc9f2('0x59');return db[_0xc9f2('0x5a')][_0xc9f2('0x4f')]({'where':{'name':_0x5f20bc,'userProfileId':_0x59e649['userProfileId']},'raw':!![]})['then'](function(_0x4c7e19){if(_0x4c7e19&&_0x4c7e19[_0xc9f2('0x5b')]===0x0){return db[_0xc9f2('0x2d')][_0xc9f2('0x50')]({'name':_0x44581c['name'],'resourceId':_0x44581c['id'],'type':_0x4c7e19[_0xc9f2('0x31')],'sectionId':_0x4c7e19['id']},{})[_0xc9f2('0x2a')](function(){return _0x65b0;});}else{return _0x65b0;}})['catch'](function(_0x1e1eb8){logger[_0xc9f2('0x2f')](_0xc9f2('0x55'),_0x1e1eb8);throw _0x1e1eb8;});}return _0x65b0;});}})['then'](respondWithResult(_0x50b3c7,0xc9))[_0xc9f2('0x4b')](handleError(_0x50b3c7,null));};exports[_0xc9f2('0x29')]=function(_0xd82c9,_0x1941e9){if(_0xd82c9['body']['id']){delete _0xd82c9[_0xc9f2('0x51')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xd82c9[_0xc9f2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1941e9,null))[_0xc9f2('0x2a')](saveUpdates(_0xd82c9[_0xc9f2('0x51')],null))[_0xc9f2('0x2a')](respondWithResult(_0x1941e9,null))[_0xc9f2('0x4b')](handleError(_0x1941e9,null));};exports[_0xc9f2('0x2b')]=function(_0xe2f227,_0x14cb53){return db[_0xc9f2('0x48')][_0xc9f2('0x4f')]({'where':{'id':_0xe2f227[_0xc9f2('0x5c')]['id']}})[_0xc9f2('0x2a')](handleEntityNotFound(_0x14cb53,null))[_0xc9f2('0x2a')](removeEntity(_0x14cb53,null))[_0xc9f2('0x4b')](handleError(_0x14cb53,null));};function widgetAttributes(_0x5f1f9d){try{switch(_0x5f1f9d['type']){case'iframe':return[{'name':_0xc9f2('0x5d'),'value':_0x5f1f9d[_0xc9f2('0x5d')]||(_0x5f1f9d[_0xc9f2('0x5e')]&&_0x5f1f9d['attrs'][0x0]?_0x5f1f9d['attrs'][0x0][_0xc9f2('0x5f')]:undefined)||_0xc9f2('0x60')}];case'custom':return[{'name':_0xc9f2('0x61'),'value':_0x5f1f9d[_0xc9f2('0x61')]||(_0x5f1f9d[_0xc9f2('0x5e')]&&_0x5f1f9d[_0xc9f2('0x5e')][0x0]?_0x5f1f9d[_0xc9f2('0x5e')][0x0][_0xc9f2('0x5f')]:undefined)||''}];case _0xc9f2('0x62'):return[{'name':_0xc9f2('0x63'),'value':_0x5f1f9d[_0xc9f2('0x63')]||(_0x5f1f9d[_0xc9f2('0x5e')]&&_0x5f1f9d[_0xc9f2('0x5e')][0x0]?_0x5f1f9d[_0xc9f2('0x5e')][0x0][_0xc9f2('0x5f')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x5f1f9d[_0xc9f2('0x64')]||(_0x5f1f9d['attrs']&&_0x5f1f9d[_0xc9f2('0x5e')][0x1]?_0x5f1f9d[_0xc9f2('0x5e')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5f1f9d[_0xc9f2('0x65')]||(_0x5f1f9d[_0xc9f2('0x5e')]&&_0x5f1f9d[_0xc9f2('0x5e')][0x2]?_0x5f1f9d[_0xc9f2('0x5e')][0x2][_0xc9f2('0x5f')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x5f1f9d[_0xc9f2('0x66')]||(_0x5f1f9d['attrs']&&_0x5f1f9d[_0xc9f2('0x5e')][0x0]?_0x5f1f9d[_0xc9f2('0x5e')][0x0][_0xc9f2('0x5f')]:undefined)||_0xc9f2('0x67')},{'name':_0xc9f2('0x68'),'value':_0x5f1f9d[_0xc9f2('0x68')]||(_0x5f1f9d[_0xc9f2('0x5e')]&&_0x5f1f9d['attrs'][0x1]?_0x5f1f9d[_0xc9f2('0x5e')][0x1][_0xc9f2('0x5f')]:undefined)||[]},{'name':_0xc9f2('0x65'),'value':_0x5f1f9d['attrFontSize']||(_0x5f1f9d[_0xc9f2('0x5e')]&&_0x5f1f9d['attrs'][0x2]?_0x5f1f9d[_0xc9f2('0x5e')][0x2][_0xc9f2('0x5f')]:undefined)||0x14}];case _0xc9f2('0x69'):case'pie-chart':return[{'name':_0xc9f2('0x6a'),'value':_0x5f1f9d[_0xc9f2('0x6a')]||(_0x5f1f9d['attrs']&&_0x5f1f9d['attrs'][0x0]?_0x5f1f9d['attrs'][0x0][_0xc9f2('0x5f')]:undefined)||_0xc9f2('0x67')},{'name':_0xc9f2('0x6b'),'value':_0x5f1f9d[_0xc9f2('0x6b')]||(_0x5f1f9d['attrs']&&_0x5f1f9d[_0xc9f2('0x5e')][0x1]?_0x5f1f9d[_0xc9f2('0x5e')][0x1][_0xc9f2('0x5f')]:undefined)||null},{'name':_0xc9f2('0x6c'),'value':_0x5f1f9d[_0xc9f2('0x6c')]||(_0x5f1f9d['attrs']&&_0x5f1f9d[_0xc9f2('0x5e')][0x2]?_0x5f1f9d[_0xc9f2('0x5e')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5f1f9d[_0xc9f2('0x68')]||(_0x5f1f9d['attrs']&&_0x5f1f9d[_0xc9f2('0x5e')][0x3]?_0x5f1f9d[_0xc9f2('0x5e')][0x3][_0xc9f2('0x5f')]:undefined)||[]}];case'web-report':return[{'name':_0xc9f2('0x6d'),'type':_0x5f1f9d[_0xc9f2('0x6e')]||(_0x5f1f9d[_0xc9f2('0x5e')]&&_0x5f1f9d[_0xc9f2('0x5e')][0x0]?_0x5f1f9d[_0xc9f2('0x5e')][0x0][_0xc9f2('0x35')]:undefined)||null,'value':_0x5f1f9d['attrReport']||(_0x5f1f9d['attrs']&&_0x5f1f9d['attrs'][0x0]?_0x5f1f9d[_0xc9f2('0x5e')][0x0][_0xc9f2('0x5f')]:undefined)||null},{'name':'attrRefresh','value':_0x5f1f9d[_0xc9f2('0x6f')]||(_0x5f1f9d['attrs']&&_0x5f1f9d[_0xc9f2('0x5e')][0x1]?_0x5f1f9d['attrs'][0x1][_0xc9f2('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0xcbea9b){logger[_0xc9f2('0x2f')](_0xc9f2('0x70'),JSON['stringify'](_0xcbea9b));return[];}}exports[_0xc9f2('0x71')]=function(_0x2e6ec5,_0x199f6c,_0x46c3c2){if(_0x2e6ec5[_0xc9f2('0x51')]['id']){delete _0x2e6ec5[_0xc9f2('0x51')]['id'];}return db['Dashboard'][_0xc9f2('0x4f')]({'where':{'id':_0x2e6ec5[_0xc9f2('0x5c')]['id']}})[_0xc9f2('0x2a')](handleEntityNotFound(_0x199f6c,null))[_0xc9f2('0x2a')](function(_0x3dae72){if(_0x3dae72){_0x2e6ec5[_0xc9f2('0x51')][_0xc9f2('0x72')]=_0x3dae72['id'];_0x2e6ec5[_0xc9f2('0x51')][_0xc9f2('0x5e')]=widgetAttributes(_0x2e6ec5['body']);return db['DashboardItem'][_0xc9f2('0x50')](_0x2e6ec5[_0xc9f2('0x51')]);}})[_0xc9f2('0x2a')](respondWithResult(_0x199f6c,null))[_0xc9f2('0x4b')](handleError(_0x199f6c,null));};exports[_0xc9f2('0x73')]=function(_0x486fd1,_0x217c2f,_0x3de5c6){var _0xad5570={};var _0x1e2559={};var _0x45ce24;var _0x2d866b;return db[_0xc9f2('0x48')]['findOne']({'where':{'id':_0x486fd1['params']['id']}})[_0xc9f2('0x2a')](handleEntityNotFound(_0x217c2f,null))[_0xc9f2('0x2a')](function(_0x7b6d49){if(_0x7b6d49){_0x45ce24=_0x7b6d49;_0x1e2559['model']=_['keys'](db['DashboardItem'][_0xc9f2('0x56')]);_0x1e2559[_0xc9f2('0x38')]=_['keys'](_0x486fd1[_0xc9f2('0x38')]);_0x1e2559['filters']=_[_0xc9f2('0x3a')](_0x1e2559[_0xc9f2('0x37')],_0x1e2559[_0xc9f2('0x38')]);_0xad5570[_0xc9f2('0x3c')]=_[_0xc9f2('0x3a')](_0x1e2559[_0xc9f2('0x37')],qs[_0xc9f2('0x3b')](_0x486fd1[_0xc9f2('0x38')][_0xc9f2('0x3b')]));_0xad5570['attributes']=_0xad5570[_0xc9f2('0x3c')][_0xc9f2('0x4d')]?_0xad5570[_0xc9f2('0x3c')]:_0x1e2559['model'];_0xad5570[_0xc9f2('0x74')]=qs[_0xc9f2('0x3f')](_0x486fd1[_0xc9f2('0x38')][_0xc9f2('0x3f')]);_0xad5570[_0xc9f2('0x40')]=qs[_0xc9f2('0x41')](_[_0xc9f2('0x42')](_0x486fd1[_0xc9f2('0x38')],_0x1e2559[_0xc9f2('0x41')]));if(_0x486fd1[_0xc9f2('0x38')][_0xc9f2('0x43')]){_0xad5570[_0xc9f2('0x40')]=_[_0xc9f2('0x44')](_0xad5570[_0xc9f2('0x40')],{'$or':_[_0xc9f2('0x45')](_0xad5570[_0xc9f2('0x3c')],function(_0x1c0db3){var _0x47a215={};_0x47a215[_0x1c0db3]={'$like':'%'+_0x486fd1[_0xc9f2('0x38')][_0xc9f2('0x43')]+'%'};return _0x47a215;})});}_0xad5570=_['merge']({},_0xad5570,_0x486fd1[_0xc9f2('0x47')]);return _0x45ce24[_0xc9f2('0x73')](_0xad5570);}})[_0xc9f2('0x2a')](function(_0x3aa369){if(_0x3aa369){_0x2d866b=_0x3aa369['length'];if(!_0x486fd1[_0xc9f2('0x38')]['hasOwnProperty'](_0xc9f2('0x3e'))){_0xad5570[_0xc9f2('0x24')]=qs['limit'](_0x486fd1[_0xc9f2('0x38')][_0xc9f2('0x24')]);_0xad5570[_0xc9f2('0x23')]=qs['offset'](_0x486fd1['query'][_0xc9f2('0x23')]);}return _0x45ce24['getItems'](_0xad5570);}})[_0xc9f2('0x2a')](function(_0x120320){if(_0x120320){return _0x120320?{'count':_0x2d866b,'rows':_0x120320}:null;}})['then'](respondWithResult(_0x217c2f,null))[_0xc9f2('0x4b')](handleError(_0x217c2f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 5301900..e13e6cc 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 _0x5543=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x5543,0x1d2));var _0x3554=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x5543[_0x5b34c0];return _0x242bd3;};'use strict';var EventEmitter=require(_0x3554('0x0'));var Dashboard=require(_0x3554('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3554('0x2')](0x0);var events={'afterCreate':_0x3554('0x3'),'afterUpdate':_0x3554('0x4'),'afterDestroy':'remove'};function emitEvent(_0x197cf3){return function(_0x3e544e,_0x38d6ff,_0x59647a){DashboardEvents[_0x3554('0x5')](_0x197cf3+':'+_0x3e544e['id'],_0x3e544e);DashboardEvents[_0x3554('0x5')](_0x197cf3,_0x3e544e);_0x59647a(null);};}for(var e in events){if(events[_0x3554('0x6')](e)){var event=events[e];Dashboard[_0x3554('0x7')](e,emitEvent(event));}}module[_0x3554('0x8')]=DashboardEvents; \ No newline at end of file +var _0x5bc2=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x577c95,_0x2d9874){var _0x5aeb44=function(_0x5069c0){while(--_0x5069c0){_0x577c95['push'](_0x577c95['shift']());}};_0x5aeb44(++_0x2d9874);}(_0x5bc2,0xbb));var _0x25bc=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x5bc2[_0x2d344f];return _0x2e796b;};'use strict';var EventEmitter=require(_0x25bc('0x0'));var Dashboard=require(_0x25bc('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x25bc('0x2')](0x0);var events={'afterCreate':_0x25bc('0x3'),'afterUpdate':'update','afterDestroy':_0x25bc('0x4')};function emitEvent(_0x11da33){return function(_0x3d5597,_0x2ad910,_0x17db84){DashboardEvents['emit'](_0x11da33+':'+_0x3d5597['id'],_0x3d5597);DashboardEvents[_0x25bc('0x5')](_0x11da33,_0x3d5597);_0x17db84(null);};}for(var e in events){if(events[_0x25bc('0x6')](e)){var event=events[e];Dashboard[_0x25bc('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 1a6334b..e8149b4 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 _0x9560=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util'];(function(_0x4526de,_0x2b4f4b){var _0x531a05=function(_0x1820f5){while(--_0x1820f5){_0x4526de['push'](_0x4526de['shift']());}};_0x531a05(++_0x2b4f4b);}(_0x9560,0x76));var _0x0956=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0x9560[_0x45aa72];return _0x75adaa;};'use strict';var _=require(_0x0956('0x0'));var util=require(_0x0956('0x1'));var logger=require(_0x0956('0x2'))(_0x0956('0x3'));var moment=require(_0x0956('0x4'));var BPromise=require(_0x0956('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0956('0x6'));var config=require(_0x0956('0x7'));var attributes=require(_0x0956('0x8'));module[_0x0956('0x9')]=function(_0x365e91,_0xbc3774){return _0x365e91[_0x0956('0xa')]('Dashboard',attributes,{'tableName':_0x0956('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05be=['../../config/logger','moment','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','dashboards','util'];(function(_0x1e54a2,_0x2d8fd5){var _0x5ed556=function(_0x221b0e){while(--_0x221b0e){_0x1e54a2['push'](_0x1e54a2['shift']());}};_0x5ed556(++_0x2d8fd5);}(_0x05be,0xf9));var _0xe05b=function(_0x14d857,_0x28f91f){_0x14d857=_0x14d857-0x0;var _0x31ae29=_0x05be[_0x14d857];return _0x31ae29;};'use strict';var _=require('lodash');var util=require(_0xe05b('0x0'));var logger=require(_0xe05b('0x1'))('api');var moment=require(_0xe05b('0x2'));var BPromise=require('bluebird');var rp=require(_0xe05b('0x3'));var fs=require('fs');var path=require(_0xe05b('0x4'));var rimraf=require('rimraf');var config=require(_0xe05b('0x5'));var attributes=require(_0xe05b('0x6'));module[_0xe05b('0x7')]=function(_0x54f638,_0x8c7a1e){return _0x54f638[_0xe05b('0x8')]('Dashboard',attributes,{'tableName':_0xe05b('0x9'),'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 4a266a8..f903a7a 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 _0x84ff=['request\x20sent','debug','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x84ff,0x156));var _0xf84f=function(_0x1cf830,_0x1740b7){_0x1cf830=_0x1cf830-0x0;var _0x10aa0f=_0x84ff[_0x1cf830];return _0x10aa0f;};'use strict';var _=require('lodash');var util=require(_0xf84f('0x0'));var moment=require('moment');var BPromise=require(_0xf84f('0x1'));var rs=require(_0xf84f('0x2'));var fs=require('fs');var Redis=require(_0xf84f('0x3'));var db=require(_0xf84f('0x4'))['db'];var utils=require(_0xf84f('0x5'));var logger=require(_0xf84f('0x6'))('rpc');var config=require(_0xf84f('0x7'));var jayson=require(_0xf84f('0x8'));var client=jayson[_0xf84f('0x9')][_0xf84f('0xa')]({'port':0x232a});config[_0xf84f('0xb')]=_[_0xf84f('0xc')](config[_0xf84f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf84f('0xb')]));require('./dashboard.socket')[_0xf84f('0xd')](socket);function respondWithRpcPromise(_0x1be5c4,_0xa04e60,_0x5babf9){return new BPromise(function(_0xec4af,_0x10dc7d){return client[_0xf84f('0xe')](_0x1be5c4,_0x5babf9)[_0xf84f('0xf')](function(_0x157433){logger[_0xf84f('0x10')](_0xf84f('0x11'),_0xa04e60,_0xf84f('0x12'));logger[_0xf84f('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xa04e60,_0xf84f('0x12'),JSON['stringify'](_0x157433));if(_0x157433[_0xf84f('0x14')]){if(_0x157433[_0xf84f('0x14')][_0xf84f('0x15')]===0x1f4){logger[_0xf84f('0x14')](_0xf84f('0x11'),_0xa04e60,_0x157433[_0xf84f('0x14')][_0xf84f('0x16')]);return _0x10dc7d(_0x157433[_0xf84f('0x14')]['message']);}logger[_0xf84f('0x14')](_0xf84f('0x11'),_0xa04e60,_0x157433[_0xf84f('0x14')][_0xf84f('0x16')]);return _0xec4af(_0x157433[_0xf84f('0x14')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0xa04e60,_0xf84f('0x12'));_0xec4af(_0x157433[_0xf84f('0x17')][_0xf84f('0x16')]);}})['catch'](function(_0x95cc5){logger[_0xf84f('0x14')]('Dashboard,\x20%s,\x20%s',_0xa04e60,_0x95cc5);_0x10dc7d(_0x95cc5);});});} \ No newline at end of file +var _0x116d=['redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x438ad7,_0x4ed557){var _0x5eca56=function(_0x3a7c67){while(--_0x3a7c67){_0x438ad7['push'](_0x438ad7['shift']());}};_0x5eca56(++_0x4ed557);}(_0x116d,0x16d));var _0xd116=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x116d[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xd116('0x0'));var util=require(_0xd116('0x1'));var moment=require(_0xd116('0x2'));var BPromise=require(_0xd116('0x3'));var rs=require(_0xd116('0x4'));var fs=require('fs');var Redis=require(_0xd116('0x5'));var db=require(_0xd116('0x6'))['db'];var utils=require(_0xd116('0x7'));var logger=require('../../config/logger')(_0xd116('0x8'));var config=require(_0xd116('0x9'));var jayson=require(_0xd116('0xa'));var client=jayson['client'][_0xd116('0xb')]({'port':0x232a});config[_0xd116('0xc')]=_[_0xd116('0xd')](config[_0xd116('0xc')],{'host':_0xd116('0xe'),'port':0x18eb});var socket=require(_0xd116('0xf'))(new Redis(config[_0xd116('0xc')]));require(_0xd116('0x10'))[_0xd116('0x11')](socket);function respondWithRpcPromise(_0x21ed6b,_0x24a5b6,_0x6ae3f5){return new BPromise(function(_0x5ef24c,_0x2325a7){return client[_0xd116('0x12')](_0x21ed6b,_0x6ae3f5)['then'](function(_0x4d1c26){logger[_0xd116('0x13')](_0xd116('0x14'),_0x24a5b6,_0xd116('0x15'));logger[_0xd116('0x16')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x24a5b6,_0xd116('0x15'),JSON[_0xd116('0x17')](_0x4d1c26));if(_0x4d1c26[_0xd116('0x18')]){if(_0x4d1c26['error'][_0xd116('0x19')]===0x1f4){logger['error'](_0xd116('0x14'),_0x24a5b6,_0x4d1c26['error'][_0xd116('0x1a')]);return _0x2325a7(_0x4d1c26[_0xd116('0x18')]['message']);}logger[_0xd116('0x18')]('Dashboard,\x20%s,\x20%s',_0x24a5b6,_0x4d1c26[_0xd116('0x18')][_0xd116('0x1a')]);return _0x5ef24c(_0x4d1c26[_0xd116('0x18')][_0xd116('0x1a')]);}else{logger[_0xd116('0x13')]('Dashboard,\x20%s,\x20%s',_0x24a5b6,_0xd116('0x15'));_0x5ef24c(_0x4d1c26[_0xd116('0x1b')][_0xd116('0x1a')]);}})[_0xd116('0x1c')](function(_0x34cc7f){logger['error'](_0xd116('0x14'),_0x24a5b6,_0x34cc7f);_0x2325a7(_0x34cc7f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 05295bd..5d98139 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 _0x3223=['update','emit','removeListener','length','dashboard:','./dashboard.events','remove'];(function(_0x20678c,_0x1d31cc){var _0x51d614=function(_0x3cf99){while(--_0x3cf99){_0x20678c['push'](_0x20678c['shift']());}};_0x51d614(++_0x1d31cc);}(_0x3223,0x124));var _0x3322=function(_0x18bbc8,_0x4ef946){_0x18bbc8=_0x18bbc8-0x0;var _0x4e3316=_0x3223[_0x18bbc8];return _0x4e3316;};'use strict';var DashboardEvents=require(_0x3322('0x0'));var events=['save',_0x3322('0x1'),_0x3322('0x2')];function createListener(_0x2b8074,_0x3dab32){return function(_0x4d2221){_0x3dab32[_0x3322('0x3')](_0x2b8074,_0x4d2221);};}function removeListener(_0x4e50b4,_0x151630){return function(){DashboardEvents[_0x3322('0x4')](_0x4e50b4,_0x151630);};}exports['register']=function(_0x2ee966){for(var _0x41bd60=0x0,_0x43b1dd=events[_0x3322('0x5')];_0x41bd60<_0x43b1dd;_0x41bd60++){var _0xc455d=events[_0x41bd60];var _0x19f341=createListener(_0x3322('0x6')+_0xc455d,_0x2ee966);DashboardEvents['on'](_0xc455d,_0x19f341);}}; \ No newline at end of file +var _0xc561=['update','emit','removeListener','save'];(function(_0x4471ff,_0x4bb7de){var _0xe723ca=function(_0xf3cc76){while(--_0xf3cc76){_0x4471ff['push'](_0x4471ff['shift']());}};_0xe723ca(++_0x4bb7de);}(_0xc561,0x1cf));var _0x1c56=function(_0x555aa9,_0x3a607f){_0x555aa9=_0x555aa9-0x0;var _0x20aecd=_0xc561[_0x555aa9];return _0x20aecd;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x1c56('0x0'),'remove',_0x1c56('0x1')];function createListener(_0x1e6e5b,_0x4059aa){return function(_0x27e1a6){_0x4059aa[_0x1c56('0x2')](_0x1e6e5b,_0x27e1a6);};}function removeListener(_0x443310,_0x9da537){return function(){DashboardEvents[_0x1c56('0x3')](_0x443310,_0x9da537);};}exports['register']=function(_0x58e99f){for(var _0x111e9e=0x0,_0xb50610=events['length'];_0x111e9e<_0xb50610;_0x111e9e++){var _0x841b76=events[_0x111e9e];var _0x3e1cdf=createListener('dashboard:'+_0x841b76,_0x58e99f);DashboardEvents['on'](_0x841b76,_0x3e1cdf);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1103e96..62b3808 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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x77a1f4,_0xe7f54f){var _0x5f182f=function(_0x81a9d5){while(--_0x81a9d5){_0x77a1f4['push'](_0x77a1f4['shift']());}};_0x5f182f(++_0xe7f54f);}(_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')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','destroy','exports','path','connect-timeout'];(function(_0x4c2a02,_0x39c88b){var _0x14b7cc=function(_0x2e170c){while(--_0x2e170c){_0x4c2a02['push'](_0x4c2a02['shift']());}};_0x14b7cc(++_0x39c88b);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'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('./dashboard.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('0xe'),auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0xd')]('/:id/items',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index ba2a47e..026ceb8 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 _0x51b1=['INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify'];(function(_0x38cd4b,_0x5727af){var _0x18f4f0=function(_0x40fab6){while(--_0x40fab6){_0x38cd4b['push'](_0x38cd4b['shift']());}};_0x18f4f0(++_0x5727af);}(_0x51b1,0xab));var _0x151b=function(_0x292ed7,_0x4fe68e){_0x292ed7=_0x292ed7-0x0;var _0xcfb8a0=_0x51b1[_0x292ed7];return _0xcfb8a0;};'use strict';var Sequelize=require(_0x151b('0x0'));var squel=require(_0x151b('0x1'));var _=require(_0x151b('0x2'));module[_0x151b('0x3')]={'title':{'type':Sequelize[_0x151b('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x151b('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x151b('0x5')](_0x151b('0x6')),'get':function(){try{return JSON[_0x151b('0x7')](this['getDataValue'](_0x151b('0x8')));}catch(_0x1487ea){return[];}},'set':function(_0xe81931){try{this[_0x151b('0x9')](_0x151b('0x8'),JSON[_0x151b('0xa')](_0xe81931));}catch(_0x35e454){this[_0x151b('0x9')]('attrs',JSON[_0x151b('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x151b('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x151b('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x151b('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x151b('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x151b('0x4')],'allowNull':![],'defaultValue':_0x151b('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x151b('0x4')]}}; \ No newline at end of file +var _0x0353=['stringify','INTEGER','#2196f3','sequelize','squel','lodash','STRING','TEXT','parse','attrs','setDataValue'];(function(_0x2146dc,_0x5736a0){var _0x958647=function(_0xca09d){while(--_0xca09d){_0x2146dc['push'](_0x2146dc['shift']());}};_0x958647(++_0x5736a0);}(_0x0353,0x1dc));var _0x3035=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x0353[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x3035('0x0'));var squel=require(_0x3035('0x1'));var _=require(_0x3035('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3035('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3035('0x4')]('long'),'get':function(){try{return JSON[_0x3035('0x5')](this['getDataValue'](_0x3035('0x6')));}catch(_0xdd85d){return[];}},'set':function(_0xe74af0){try{this[_0x3035('0x7')](_0x3035('0x6'),JSON[_0x3035('0x8')](_0xe74af0));}catch(_0x3e68e5){this[_0x3035('0x7')](_0x3035('0x6'),JSON[_0x3035('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x3035('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3035('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3035('0x9')]},'col':{'type':Sequelize[_0x3035('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3035('0x3')],'allowNull':![],'defaultValue':_0x3035('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3035('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index da82ccb..b4f4809 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 _0x9f94=['stringify','body','create','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','json','offset','status','set','Content-Range','apply','save','then','error','name','send','params','model','DashboardItem','query','keys','filters','intersection','attributes','fields','length','include','merge','options','find','catch','type','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s'];(function(_0x11167c,_0xb0ff07){var _0x34bdb0=function(_0x34f17f){while(--_0x34f17f){_0x11167c['push'](_0x11167c['shift']());}};_0x34bdb0(++_0xb0ff07);}(_0x9f94,0x154));var _0x49f9=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9f94[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0x49f9('0x0'));var emlformat=require(_0x49f9('0x1'));var rimraf=require(_0x49f9('0x2'));var zipdir=require(_0x49f9('0x3'));var jsonpatch=require(_0x49f9('0x4'));var rp=require(_0x49f9('0x5'));var moment=require(_0x49f9('0x6'));var BPromise=require(_0x49f9('0x7'));var Mustache=require(_0x49f9('0x8'));var util=require(_0x49f9('0x9'));var path=require('path');var sox=require(_0x49f9('0xa'));var csv=require(_0x49f9('0xb'));var ejs=require(_0x49f9('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x49f9('0xd'));var deskjs=require(_0x49f9('0xe'));var toCsv=require(_0x49f9('0xb'));var querystring=require(_0x49f9('0xf'));var Papa=require(_0x49f9('0x10'));var Redis=require('ioredis');var authService=require(_0x49f9('0x11'));var qs=require(_0x49f9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49f9('0x13'));var logger=require(_0x49f9('0x14'))(_0x49f9('0x15'));var utils=require(_0x49f9('0x16'));var config=require(_0x49f9('0x17'));var db=require(_0x49f9('0x18'))['db'];config[_0x49f9('0x19')]=_['defaults'](config[_0x49f9('0x19')],{'host':_0x49f9('0x1a'),'port':0x18eb});var socket=require(_0x49f9('0x1b'))(new Redis(config[_0x49f9('0x19')]));require(_0x49f9('0x1c'))[_0x49f9('0x1d')](socket);function respondWithStatusCode(_0x3b5608,_0x3af611){_0x3af611=_0x3af611||0xcc;return function(_0x424b3a){if(_0x424b3a){return _0x3b5608[_0x49f9('0x1e')](_0x3af611);}return _0x3b5608['status'](_0x3af611)[_0x49f9('0x1f')]();};}function respondWithResult(_0x3a0a70,_0xf846ca){_0xf846ca=_0xf846ca||0xc8;return function(_0x53917d){if(_0x53917d){return _0x3a0a70['status'](_0xf846ca)[_0x49f9('0x20')](_0x53917d);}};}function respondWithFilteredResult(_0x528760,_0x411d6f){return function(_0x4d3503){if(_0x4d3503){var _0x55048c=_0x4d3503['count'],_0x454b79=_0x411d6f['offset'],_0x1d49d8=_0x411d6f[_0x49f9('0x21')]+_0x411d6f['limit'],_0x1588ce;if(_0x1d49d8>=_0x55048c){_0x1d49d8=_0x55048c;_0x1588ce=0xc8;}else{_0x1588ce=0xce;}_0x528760[_0x49f9('0x22')](_0x1588ce);return _0x528760[_0x49f9('0x23')](_0x49f9('0x24'),_0x454b79+'-'+_0x1d49d8+'/'+_0x55048c)['json'](_0x4d3503);}return null;};}function patchUpdates(_0x37f0de){return function(_0x2f107c){try{jsonpatch[_0x49f9('0x25')](_0x2f107c,_0x37f0de,!![]);}catch(_0x5d2f4b){return BPromise['reject'](_0x5d2f4b);}return _0x2f107c[_0x49f9('0x26')]();};}function saveUpdates(_0x5752c1,_0x286eeb){return function(_0x1a7b1a){if(_0x1a7b1a){return _0x1a7b1a['update'](_0x5752c1)[_0x49f9('0x27')](function(_0x2d5af0){return _0x2d5af0;});}return null;};}function removeEntity(_0x42ce1f,_0x28baf3){return function(_0x4c4bcd){if(_0x4c4bcd){return _0x4c4bcd['destroy']()[_0x49f9('0x27')](function(){_0x42ce1f[_0x49f9('0x22')](0xcc)[_0x49f9('0x1f')]();});}};}function handleEntityNotFound(_0x4f7bd3,_0x32f68a){return function(_0x5dacd4){if(!_0x5dacd4){_0x4f7bd3[_0x49f9('0x1e')](0x194);}return _0x5dacd4;};}function handleError(_0x3120dc,_0x167232){_0x167232=_0x167232||0x1f4;return function(_0x2f821a){logger[_0x49f9('0x28')](_0x2f821a['stack']);if(_0x2f821a['name']){delete _0x2f821a[_0x49f9('0x29')];}_0x3120dc[_0x49f9('0x22')](_0x167232)[_0x49f9('0x2a')](_0x2f821a);};}exports['show']=function(_0xa4d524,_0x231b9e){var _0x4190f5={'raw':![],'where':{'id':_0xa4d524[_0x49f9('0x2b')]['id']}},_0xfad46c={};_0xfad46c[_0x49f9('0x2c')]=_['keys'](db[_0x49f9('0x2d')]['rawAttributes']);_0xfad46c[_0x49f9('0x2e')]=_[_0x49f9('0x2f')](_0xa4d524[_0x49f9('0x2e')]);_0xfad46c[_0x49f9('0x30')]=_[_0x49f9('0x31')](_0xfad46c[_0x49f9('0x2c')],_0xfad46c['query']);_0x4190f5[_0x49f9('0x32')]=_[_0x49f9('0x31')](_0xfad46c[_0x49f9('0x2c')],qs[_0x49f9('0x33')](_0xa4d524[_0x49f9('0x2e')][_0x49f9('0x33')]));_0x4190f5['attributes']=_0x4190f5['attributes'][_0x49f9('0x34')]?_0x4190f5[_0x49f9('0x32')]:_0xfad46c[_0x49f9('0x2c')];if(_0xa4d524[_0x49f9('0x2e')]['includeAll']){_0x4190f5[_0x49f9('0x35')]=[{'all':!![]}];}_0x4190f5=_[_0x49f9('0x36')]({},_0x4190f5,_0xa4d524[_0x49f9('0x37')]);return db['DashboardItem'][_0x49f9('0x38')](_0x4190f5)['then'](handleEntityNotFound(_0x231b9e,null))[_0x49f9('0x27')](respondWithResult(_0x231b9e,null))[_0x49f9('0x39')](handleError(_0x231b9e,null));};exports['destroy']=function(_0x39d1e0,_0x1f8113){return db[_0x49f9('0x2d')][_0x49f9('0x38')]({'where':{'id':_0x39d1e0['params']['id']}})[_0x49f9('0x27')](handleEntityNotFound(_0x1f8113,null))[_0x49f9('0x27')](removeEntity(_0x1f8113,null))[_0x49f9('0x39')](handleError(_0x1f8113,null));};function widgetAttributes(_0x46bca3){try{switch(_0x46bca3[_0x49f9('0x3a')]){case'iframe':return[{'name':_0x49f9('0x3b'),'value':_0x46bca3[_0x49f9('0x3b')]||(_0x46bca3[_0x49f9('0x3c')]&&_0x46bca3['attrs'][0x0]?_0x46bca3[_0x49f9('0x3c')][0x0][_0x49f9('0x3d')]:undefined)||'https://'}];case _0x49f9('0x3e'):return[{'name':_0x49f9('0x3f'),'value':_0x46bca3[_0x49f9('0x3f')]||(_0x46bca3[_0x49f9('0x3c')]&&_0x46bca3[_0x49f9('0x3c')][0x0]?_0x46bca3[_0x49f9('0x3c')][0x0][_0x49f9('0x3d')]:undefined)||''}];case'clock':return[{'name':_0x49f9('0x40'),'value':_0x46bca3[_0x49f9('0x40')]||(_0x46bca3[_0x49f9('0x3c')]&&_0x46bca3[_0x49f9('0x3c')][0x0]?_0x46bca3['attrs'][0x0][_0x49f9('0x3d')]:undefined)||_0x49f9('0x41')},{'name':_0x49f9('0x42'),'value':_0x46bca3[_0x49f9('0x42')]||(_0x46bca3['attrs']&&_0x46bca3['attrs'][0x1]?_0x46bca3['attrs'][0x1][_0x49f9('0x3d')]:undefined)||_0x49f9('0x43')},{'name':_0x49f9('0x44'),'value':_0x46bca3[_0x49f9('0x44')]||(_0x46bca3[_0x49f9('0x3c')]&&_0x46bca3[_0x49f9('0x3c')][0x2]?_0x46bca3[_0x49f9('0x3c')][0x2][_0x49f9('0x3d')]:undefined)||0xc}];case'counter':return[{'name':_0x49f9('0x45'),'value':_0x46bca3[_0x49f9('0x45')]||(_0x46bca3[_0x49f9('0x3c')]&&_0x46bca3[_0x49f9('0x3c')][0x0]?_0x46bca3[_0x49f9('0x3c')][0x0][_0x49f9('0x3d')]:undefined)||_0x49f9('0x46')},{'name':'attrVoiceQueues','value':_0x46bca3[_0x49f9('0x47')]||(_0x46bca3['attrs']&&_0x46bca3['attrs'][0x1]?_0x46bca3[_0x49f9('0x3c')][0x1][_0x49f9('0x3d')]:undefined)||[]},{'name':_0x49f9('0x44'),'value':_0x46bca3[_0x49f9('0x44')]||(_0x46bca3['attrs']&&_0x46bca3[_0x49f9('0x3c')][0x2]?_0x46bca3[_0x49f9('0x3c')][0x2][_0x49f9('0x3d')]:undefined)||0x14}];case _0x49f9('0x48'):case'pie-chart':return[{'name':_0x49f9('0x49'),'value':_0x46bca3[_0x49f9('0x49')]||(_0x46bca3['attrs']&&_0x46bca3[_0x49f9('0x3c')][0x0]?_0x46bca3['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x46bca3['attrSerie2']||(_0x46bca3[_0x49f9('0x3c')]&&_0x46bca3[_0x49f9('0x3c')][0x1]?_0x46bca3[_0x49f9('0x3c')][0x1]['value']:undefined)||null},{'name':_0x49f9('0x4a'),'value':_0x46bca3[_0x49f9('0x4a')]||(_0x46bca3['attrs']&&_0x46bca3['attrs'][0x2]?_0x46bca3[_0x49f9('0x3c')][0x2][_0x49f9('0x3d')]:undefined)||null},{'name':_0x49f9('0x47'),'value':_0x46bca3[_0x49f9('0x47')]||(_0x46bca3['attrs']&&_0x46bca3[_0x49f9('0x3c')][0x3]?_0x46bca3[_0x49f9('0x3c')][0x3][_0x49f9('0x3d')]:undefined)||[]}];case _0x49f9('0x4b'):return[{'name':_0x49f9('0x4c'),'type':_0x46bca3[_0x49f9('0x4d')]||(_0x46bca3[_0x49f9('0x3c')]&&_0x46bca3[_0x49f9('0x3c')][0x0]?_0x46bca3[_0x49f9('0x3c')][0x0]['type']:undefined)||null,'value':_0x46bca3[_0x49f9('0x4c')]||(_0x46bca3[_0x49f9('0x3c')]&&_0x46bca3['attrs'][0x0]?_0x46bca3['attrs'][0x0][_0x49f9('0x3d')]:undefined)||null},{'name':'attrRefresh','value':_0x46bca3[_0x49f9('0x4e')]||(_0x46bca3[_0x49f9('0x3c')]&&_0x46bca3[_0x49f9('0x3c')][0x1]?_0x46bca3[_0x49f9('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x204386){logger[_0x49f9('0x28')](_0x49f9('0x4f'),JSON[_0x49f9('0x50')](_0x204386));return[];}}exports['create']=function(_0x4e13d3,_0x522997){if(_0x4e13d3[_0x49f9('0x51')]){_0x4e13d3[_0x49f9('0x51')][_0x49f9('0x3c')]=widgetAttributes(_0x4e13d3['body']);}return db[_0x49f9('0x2d')][_0x49f9('0x52')](_0x4e13d3[_0x49f9('0x51')],{})['then'](respondWithResult(_0x522997,0xc9))[_0x49f9('0x39')](handleError(_0x522997,null));};exports[_0x49f9('0x53')]=function(_0x432dc0,_0xf9c654){if(_0x432dc0['body']['id']){delete _0x432dc0['body']['id'];}_0x432dc0['body'][_0x49f9('0x3c')]=widgetAttributes(_0x432dc0[_0x49f9('0x51')]);return db[_0x49f9('0x2d')]['find']({'where':{'id':_0x432dc0['params']['id']}})[_0x49f9('0x27')](handleEntityNotFound(_0xf9c654,null))[_0x49f9('0x27')](saveUpdates(_0x432dc0[_0x49f9('0x51')],null))[_0x49f9('0x27')](respondWithResult(_0xf9c654,null))['catch'](handleError(_0xf9c654,null));}; \ No newline at end of file +var _0xa4ea=['localhost','./dashboardItem.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','model','intersection','fields','attributes','length','includeAll','include','merge','options','catch','find','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0x156768,_0xc971a9){var _0x3715e9=function(_0x4487c9){while(--_0x4487c9){_0x156768['push'](_0x156768['shift']());}};_0x3715e9(++_0xc971a9);}(_0xa4ea,0x94));var _0xaa4e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa4ea[_0x139a3c];return _0x2b375b;};'use strict';var pdf=require(_0xaa4e('0x0'));var emlformat=require(_0xaa4e('0x1'));var rimraf=require(_0xaa4e('0x2'));var zipdir=require(_0xaa4e('0x3'));var jsonpatch=require(_0xaa4e('0x4'));var rp=require(_0xaa4e('0x5'));var moment=require('moment');var BPromise=require(_0xaa4e('0x6'));var Mustache=require(_0xaa4e('0x7'));var util=require(_0xaa4e('0x8'));var path=require('path');var sox=require(_0xaa4e('0x9'));var csv=require(_0xaa4e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa4e('0xb'));var squel=require(_0xaa4e('0xc'));var crypto=require('crypto');var jsforce=require(_0xaa4e('0xd'));var deskjs=require(_0xaa4e('0xe'));var toCsv=require(_0xaa4e('0xa'));var querystring=require(_0xaa4e('0xf'));var Papa=require(_0xaa4e('0x10'));var Redis=require(_0xaa4e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa4e('0x12'));var hardwareService=require(_0xaa4e('0x13'));var logger=require(_0xaa4e('0x14'))(_0xaa4e('0x15'));var utils=require(_0xaa4e('0x16'));var config=require(_0xaa4e('0x17'));var db=require(_0xaa4e('0x18'))['db'];config['redis']=_['defaults'](config[_0xaa4e('0x19')],{'host':_0xaa4e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa4e('0x19')]));require(_0xaa4e('0x1b'))['register'](socket);function respondWithStatusCode(_0x4dc35e,_0x464c0a){_0x464c0a=_0x464c0a||0xcc;return function(_0x6cb0f3){if(_0x6cb0f3){return _0x4dc35e[_0xaa4e('0x1c')](_0x464c0a);}return _0x4dc35e[_0xaa4e('0x1d')](_0x464c0a)[_0xaa4e('0x1e')]();};}function respondWithResult(_0x5146d0,_0x23a182){_0x23a182=_0x23a182||0xc8;return function(_0x27e3dc){if(_0x27e3dc){return _0x5146d0['status'](_0x23a182)[_0xaa4e('0x1f')](_0x27e3dc);}};}function respondWithFilteredResult(_0x41a4ea,_0x2caefd){return function(_0x404a53){if(_0x404a53){var _0x24d54b=_0x404a53[_0xaa4e('0x20')],_0x23bc2f=_0x2caefd[_0xaa4e('0x21')],_0x7e9706=_0x2caefd[_0xaa4e('0x21')]+_0x2caefd[_0xaa4e('0x22')],_0x384672;if(_0x7e9706>=_0x24d54b){_0x7e9706=_0x24d54b;_0x384672=0xc8;}else{_0x384672=0xce;}_0x41a4ea[_0xaa4e('0x1d')](_0x384672);return _0x41a4ea[_0xaa4e('0x23')]('Content-Range',_0x23bc2f+'-'+_0x7e9706+'/'+_0x24d54b)[_0xaa4e('0x1f')](_0x404a53);}return null;};}function patchUpdates(_0x3f3ee8){return function(_0x56a409){try{jsonpatch[_0xaa4e('0x24')](_0x56a409,_0x3f3ee8,!![]);}catch(_0x13944a){return BPromise[_0xaa4e('0x25')](_0x13944a);}return _0x56a409[_0xaa4e('0x26')]();};}function saveUpdates(_0x2bc6f4,_0x407e60){return function(_0x11195b){if(_0x11195b){return _0x11195b['update'](_0x2bc6f4)[_0xaa4e('0x27')](function(_0x10b1b2){return _0x10b1b2;});}return null;};}function removeEntity(_0x38f6b1,_0x5bcf5c){return function(_0x2567d0){if(_0x2567d0){return _0x2567d0[_0xaa4e('0x28')]()[_0xaa4e('0x27')](function(){_0x38f6b1[_0xaa4e('0x1d')](0xcc)[_0xaa4e('0x1e')]();});}};}function handleEntityNotFound(_0x3f5e3a,_0xb3d826){return function(_0x357d23){if(!_0x357d23){_0x3f5e3a[_0xaa4e('0x1c')](0x194);}return _0x357d23;};}function handleError(_0x4ee064,_0x1e7cd1){_0x1e7cd1=_0x1e7cd1||0x1f4;return function(_0x1d8102){logger[_0xaa4e('0x29')](_0x1d8102[_0xaa4e('0x2a')]);if(_0x1d8102[_0xaa4e('0x2b')]){delete _0x1d8102['name'];}_0x4ee064[_0xaa4e('0x1d')](_0x1e7cd1)[_0xaa4e('0x2c')](_0x1d8102);};}exports[_0xaa4e('0x2d')]=function(_0x2902d1,_0x3a78e0){var _0xfabb6a={'raw':![],'where':{'id':_0x2902d1[_0xaa4e('0x2e')]['id']}},_0xc7b928={};_0xc7b928['model']=_[_0xaa4e('0x2f')](db[_0xaa4e('0x30')][_0xaa4e('0x31')]);_0xc7b928[_0xaa4e('0x32')]=_[_0xaa4e('0x2f')](_0x2902d1['query']);_0xc7b928['filters']=_['intersection'](_0xc7b928[_0xaa4e('0x33')],_0xc7b928[_0xaa4e('0x32')]);_0xfabb6a['attributes']=_[_0xaa4e('0x34')](_0xc7b928[_0xaa4e('0x33')],qs[_0xaa4e('0x35')](_0x2902d1[_0xaa4e('0x32')][_0xaa4e('0x35')]));_0xfabb6a[_0xaa4e('0x36')]=_0xfabb6a[_0xaa4e('0x36')][_0xaa4e('0x37')]?_0xfabb6a['attributes']:_0xc7b928['model'];if(_0x2902d1[_0xaa4e('0x32')][_0xaa4e('0x38')]){_0xfabb6a[_0xaa4e('0x39')]=[{'all':!![]}];}_0xfabb6a=_[_0xaa4e('0x3a')]({},_0xfabb6a,_0x2902d1[_0xaa4e('0x3b')]);return db[_0xaa4e('0x30')]['find'](_0xfabb6a)['then'](handleEntityNotFound(_0x3a78e0,null))['then'](respondWithResult(_0x3a78e0,null))[_0xaa4e('0x3c')](handleError(_0x3a78e0,null));};exports['destroy']=function(_0x50cfcc,_0x441834){return db[_0xaa4e('0x30')][_0xaa4e('0x3d')]({'where':{'id':_0x50cfcc[_0xaa4e('0x2e')]['id']}})[_0xaa4e('0x27')](handleEntityNotFound(_0x441834,null))['then'](removeEntity(_0x441834,null))[_0xaa4e('0x3c')](handleError(_0x441834,null));};function widgetAttributes(_0x4e626f){try{switch(_0x4e626f['type']){case _0xaa4e('0x3e'):return[{'name':_0xaa4e('0x3f'),'value':_0x4e626f[_0xaa4e('0x3f')]||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x0]?_0x4e626f['attrs'][0x0][_0xaa4e('0x41')]:undefined)||'https://'}];case _0xaa4e('0x42'):return[{'name':_0xaa4e('0x43'),'value':_0x4e626f[_0xaa4e('0x43')]||(_0x4e626f['attrs']&&_0x4e626f[_0xaa4e('0x40')][0x0]?_0x4e626f[_0xaa4e('0x40')][0x0][_0xaa4e('0x41')]:undefined)||''}];case'clock':return[{'name':_0xaa4e('0x44'),'value':_0x4e626f[_0xaa4e('0x44')]||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x0]?_0x4e626f['attrs'][0x0][_0xaa4e('0x41')]:undefined)||_0xaa4e('0x45')},{'name':_0xaa4e('0x46'),'value':_0x4e626f[_0xaa4e('0x46')]||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f['attrs'][0x1]?_0x4e626f[_0xaa4e('0x40')][0x1][_0xaa4e('0x41')]:undefined)||_0xaa4e('0x47')},{'name':_0xaa4e('0x48'),'value':_0x4e626f['attrFontSize']||(_0x4e626f['attrs']&&_0x4e626f[_0xaa4e('0x40')][0x2]?_0x4e626f[_0xaa4e('0x40')][0x2]['value']:undefined)||0xc}];case _0xaa4e('0x49'):return[{'name':_0xaa4e('0x4a'),'value':_0x4e626f['attrMetric']||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x0]?_0x4e626f[_0xaa4e('0x40')][0x0][_0xaa4e('0x41')]:undefined)||_0xaa4e('0x4b')},{'name':_0xaa4e('0x4c'),'value':_0x4e626f[_0xaa4e('0x4c')]||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x1]?_0x4e626f[_0xaa4e('0x40')][0x1][_0xaa4e('0x41')]:undefined)||[]},{'name':_0xaa4e('0x48'),'value':_0x4e626f[_0xaa4e('0x48')]||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f['attrs'][0x2]?_0x4e626f['attrs'][0x2][_0xaa4e('0x41')]:undefined)||0x14}];case'multibar-chart':case _0xaa4e('0x4d'):return[{'name':_0xaa4e('0x4e'),'value':_0x4e626f[_0xaa4e('0x4e')]||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x0]?_0x4e626f[_0xaa4e('0x40')][0x0][_0xaa4e('0x41')]:undefined)||_0xaa4e('0x4b')},{'name':_0xaa4e('0x4f'),'value':_0x4e626f[_0xaa4e('0x4f')]||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x1]?_0x4e626f['attrs'][0x1][_0xaa4e('0x41')]:undefined)||null},{'name':_0xaa4e('0x50'),'value':_0x4e626f[_0xaa4e('0x50')]||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x2]?_0x4e626f[_0xaa4e('0x40')][0x2][_0xaa4e('0x41')]:undefined)||null},{'name':_0xaa4e('0x4c'),'value':_0x4e626f['attrVoiceQueues']||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x3]?_0x4e626f['attrs'][0x3][_0xaa4e('0x41')]:undefined)||[]}];case'web-report':return[{'name':_0xaa4e('0x51'),'type':_0x4e626f['reportType']||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x0]?_0x4e626f[_0xaa4e('0x40')][0x0]['type']:undefined)||null,'value':_0x4e626f['attrReport']||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f['attrs'][0x0]?_0x4e626f[_0xaa4e('0x40')][0x0]['value']:undefined)||null},{'name':_0xaa4e('0x52'),'value':_0x4e626f[_0xaa4e('0x52')]||(_0x4e626f[_0xaa4e('0x40')]&&_0x4e626f[_0xaa4e('0x40')][0x1]?_0x4e626f[_0xaa4e('0x40')][0x1][_0xaa4e('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x42fe36){logger[_0xaa4e('0x29')](_0xaa4e('0x53'),JSON[_0xaa4e('0x54')](_0x42fe36));return[];}}exports[_0xaa4e('0x55')]=function(_0x3d1db8,_0x486b41){if(_0x3d1db8['body']){_0x3d1db8[_0xaa4e('0x56')][_0xaa4e('0x40')]=widgetAttributes(_0x3d1db8[_0xaa4e('0x56')]);}return db[_0xaa4e('0x30')][_0xaa4e('0x55')](_0x3d1db8[_0xaa4e('0x56')],{})[_0xaa4e('0x27')](respondWithResult(_0x486b41,0xc9))[_0xaa4e('0x3c')](handleError(_0x486b41,null));};exports['update']=function(_0x4c618c,_0x2c89e6){if(_0x4c618c[_0xaa4e('0x56')]['id']){delete _0x4c618c['body']['id'];}_0x4c618c[_0xaa4e('0x56')][_0xaa4e('0x40')]=widgetAttributes(_0x4c618c['body']);return db[_0xaa4e('0x30')]['find']({'where':{'id':_0x4c618c[_0xaa4e('0x2e')]['id']}})[_0xaa4e('0x27')](handleEntityNotFound(_0x2c89e6,null))[_0xaa4e('0x27')](saveUpdates(_0x4c618c[_0xaa4e('0x56')],null))['then'](respondWithResult(_0x2c89e6,null))[_0xaa4e('0x3c')](handleError(_0x2c89e6,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0cfda4e..79564d6 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 _0x7f81=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x129c3c,_0x49f558){var _0x26d66c=function(_0x4bdb3d){while(--_0x4bdb3d){_0x129c3c['push'](_0x129c3c['shift']());}};_0x26d66c(++_0x49f558);}(_0x7f81,0x185));var _0x17f8=function(_0x3333a0,_0x411efa){_0x3333a0=_0x3333a0-0x0;var _0x383426=_0x7f81[_0x3333a0];return _0x383426;};'use strict';var EventEmitter=require(_0x17f8('0x0'));var DashboardItem=require(_0x17f8('0x1'))['db'][_0x17f8('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x17f8('0x3')](0x0);var events={'afterCreate':_0x17f8('0x4'),'afterUpdate':_0x17f8('0x5'),'afterDestroy':_0x17f8('0x6')};function emitEvent(_0x1e2e35){return function(_0x531c72,_0x13545f,_0x13937c){DashboardItemEvents[_0x17f8('0x7')](_0x1e2e35+':'+_0x531c72['id'],_0x531c72);DashboardItemEvents[_0x17f8('0x7')](_0x1e2e35,_0x531c72);_0x13937c(null);};}for(var e in events){if(events[_0x17f8('0x8')](e)){var event=events[e];DashboardItem[_0x17f8('0x9')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x99a3=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5f07a0,_0x197e17){var _0x1130b0=function(_0x5aa22c){while(--_0x5aa22c){_0x5f07a0['push'](_0x5f07a0['shift']());}};_0x1130b0(++_0x197e17);}(_0x99a3,0x14b));var _0x399a=function(_0x486404,_0x4ea3df){_0x486404=_0x486404-0x0;var _0x4643c7=_0x99a3[_0x486404];return _0x4643c7;};'use strict';var EventEmitter=require(_0x399a('0x0'));var DashboardItem=require(_0x399a('0x1'))['db'][_0x399a('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x399a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x399a('0x4'),'afterDestroy':_0x399a('0x5')};function emitEvent(_0x2e355f){return function(_0x4bf134,_0x438271,_0x4f61f8){DashboardItemEvents[_0x399a('0x6')](_0x2e355f+':'+_0x4bf134['id'],_0x4bf134);DashboardItemEvents[_0x399a('0x6')](_0x2e355f,_0x4bf134);_0x4f61f8(null);};}for(var e in events){if(events[_0x399a('0x7')](e)){var event=events[e];DashboardItem[_0x399a('0x8')](e,emitEvent(event));}}module[_0x399a('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index de95ce8..6f809e9 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 _0x8a2a=['rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x44b410,_0x25262e){var _0x74977e=function(_0x303f10){while(--_0x303f10){_0x44b410['push'](_0x44b410['shift']());}};_0x74977e(++_0x25262e);}(_0x8a2a,0xfd));var _0xa8a2=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x8a2a[_0x409353];return _0x4f4b59;};'use strict';var _=require('lodash');var util=require(_0xa8a2('0x0'));var logger=require(_0xa8a2('0x1'))(_0xa8a2('0x2'));var moment=require(_0xa8a2('0x3'));var BPromise=require(_0xa8a2('0x4'));var rp=require(_0xa8a2('0x5'));var fs=require('fs');var path=require(_0xa8a2('0x6'));var rimraf=require(_0xa8a2('0x7'));var config=require(_0xa8a2('0x8'));var attributes=require(_0xa8a2('0x9'));module[_0xa8a2('0xa')]=function(_0x44f1e6,_0x2688c1){return _0x44f1e6['define'](_0xa8a2('0xb'),attributes,{'tableName':_0xa8a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca3e=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','lodash'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xca3e,0xbf));var _0xeca3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xca3e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xeca3('0x0'));var util=require(_0xeca3('0x1'));var logger=require(_0xeca3('0x2'))(_0xeca3('0x3'));var moment=require(_0xeca3('0x4'));var BPromise=require('bluebird');var rp=require(_0xeca3('0x5'));var fs=require('fs');var path=require(_0xeca3('0x6'));var rimraf=require(_0xeca3('0x7'));var config=require(_0xeca3('0x8'));var attributes=require(_0xeca3('0x9'));module[_0xeca3('0xa')]=function(_0x1210ff,_0x1082a4){return _0x1210ff['define'](_0xeca3('0xb'),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 82e3649..0a48e85 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 _0x1805=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./dashboardItem.socket','register','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x187d33,_0x8a8c38){var _0x3d4258=function(_0x6ea673){while(--_0x6ea673){_0x187d33['push'](_0x187d33['shift']());}};_0x3d4258(++_0x8a8c38);}(_0x1805,0xd1));var _0x5180=function(_0x53f29b,_0x22cf73){_0x53f29b=_0x53f29b-0x0;var _0x18b486=_0x1805[_0x53f29b];return _0x18b486;};'use strict';var _=require(_0x5180('0x0'));var util=require(_0x5180('0x1'));var moment=require(_0x5180('0x2'));var BPromise=require(_0x5180('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5180('0x4'));var db=require(_0x5180('0x5'))['db'];var utils=require(_0x5180('0x6'));var logger=require(_0x5180('0x7'))(_0x5180('0x8'));var config=require(_0x5180('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5180('0xa')][_0x5180('0xb')]({'port':0x232a});config[_0x5180('0xc')]=_['defaults'](config[_0x5180('0xc')],{'host':_0x5180('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5180('0xc')]));require(_0x5180('0xe'))[_0x5180('0xf')](socket);function respondWithRpcPromise(_0x29d45a,_0x3c83a5,_0x58190c){return new BPromise(function(_0x414a8b,_0x41c9f9){return client['request'](_0x29d45a,_0x58190c)['then'](function(_0x102e52){logger['info'](_0x5180('0x10'),_0x3c83a5,_0x5180('0x11'));logger[_0x5180('0x12')](_0x5180('0x13'),_0x3c83a5,_0x5180('0x11'),JSON[_0x5180('0x14')](_0x102e52));if(_0x102e52[_0x5180('0x15')]){if(_0x102e52[_0x5180('0x15')]['code']===0x1f4){logger[_0x5180('0x15')](_0x5180('0x10'),_0x3c83a5,_0x102e52[_0x5180('0x15')][_0x5180('0x16')]);return _0x41c9f9(_0x102e52['error']['message']);}logger['error'](_0x5180('0x10'),_0x3c83a5,_0x102e52[_0x5180('0x15')][_0x5180('0x16')]);return _0x414a8b(_0x102e52[_0x5180('0x15')][_0x5180('0x16')]);}else{logger[_0x5180('0x17')](_0x5180('0x10'),_0x3c83a5,_0x5180('0x11'));_0x414a8b(_0x102e52[_0x5180('0x18')][_0x5180('0x16')]);}})[_0x5180('0x19')](function(_0x4fd1b0){logger[_0x5180('0x15')](_0x5180('0x10'),_0x3c83a5,_0x4fd1b0);_0x41c9f9(_0x4fd1b0);});});} \ No newline at end of file +var _0x404a=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x3fa70a,_0x2edd99){var _0x30175c=function(_0x46a062){while(--_0x46a062){_0x3fa70a['push'](_0x3fa70a['shift']());}};_0x30175c(++_0x2edd99);}(_0x404a,0x67));var _0xa404=function(_0x29306c,_0x56158d){_0x29306c=_0x29306c-0x0;var _0x105e1b=_0x404a[_0x29306c];return _0x105e1b;};'use strict';var _=require(_0xa404('0x0'));var util=require('util');var moment=require(_0xa404('0x1'));var BPromise=require('bluebird');var rs=require(_0xa404('0x2'));var fs=require('fs');var Redis=require(_0xa404('0x3'));var db=require(_0xa404('0x4'))['db'];var utils=require(_0xa404('0x5'));var logger=require(_0xa404('0x6'))(_0xa404('0x7'));var config=require('../../config/environment');var jayson=require(_0xa404('0x8'));var client=jayson[_0xa404('0x9')][_0xa404('0xa')]({'port':0x232a});config['redis']=_[_0xa404('0xb')](config[_0xa404('0xc')],{'host':_0xa404('0xd'),'port':0x18eb});var socket=require(_0xa404('0xe'))(new Redis(config[_0xa404('0xc')]));require(_0xa404('0xf'))['register'](socket);function respondWithRpcPromise(_0x474e76,_0x3c6f88,_0x178999){return new BPromise(function(_0x4abb91,_0x4af168){return client[_0xa404('0x10')](_0x474e76,_0x178999)['then'](function(_0x1b9e32){logger['info']('DashboardItem,\x20%s,\x20%s',_0x3c6f88,_0xa404('0x11'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x3c6f88,'request\x20sent',JSON[_0xa404('0x12')](_0x1b9e32));if(_0x1b9e32[_0xa404('0x13')]){if(_0x1b9e32['error'][_0xa404('0x14')]===0x1f4){logger[_0xa404('0x13')](_0xa404('0x15'),_0x3c6f88,_0x1b9e32[_0xa404('0x13')][_0xa404('0x16')]);return _0x4af168(_0x1b9e32[_0xa404('0x13')][_0xa404('0x16')]);}logger[_0xa404('0x13')](_0xa404('0x15'),_0x3c6f88,_0x1b9e32['error'][_0xa404('0x16')]);return _0x4abb91(_0x1b9e32['error'][_0xa404('0x16')]);}else{logger[_0xa404('0x17')](_0xa404('0x15'),_0x3c6f88,'request\x20sent');_0x4abb91(_0x1b9e32[_0xa404('0x18')]['message']);}})[_0xa404('0x19')](function(_0x152bba){logger[_0xa404('0x13')](_0xa404('0x15'),_0x3c6f88,_0x152bba);_0x4af168(_0x152bba);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ea68955..10750f6 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 _0x0f91=['update','removeListener','register','length','./dashboardItem.events','save','remove'];(function(_0x59b4d6,_0x155065){var _0x22161a=function(_0x15ce1b){while(--_0x15ce1b){_0x59b4d6['push'](_0x59b4d6['shift']());}};_0x22161a(++_0x155065);}(_0x0f91,0x19a));var _0x10f9=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x0f91[_0x358806];return _0x19fdcb;};'use strict';var DashboardItemEvents=require(_0x10f9('0x0'));var events=[_0x10f9('0x1'),_0x10f9('0x2'),_0x10f9('0x3')];function createListener(_0x4b745d,_0x1ada94){return function(_0x4b749b){_0x1ada94['emit'](_0x4b745d,_0x4b749b);};}function removeListener(_0x30fb7f,_0x5c1d7c){return function(){DashboardItemEvents[_0x10f9('0x4')](_0x30fb7f,_0x5c1d7c);};}exports[_0x10f9('0x5')]=function(_0x327278){for(var _0x1842b7=0x0,_0x460838=events[_0x10f9('0x6')];_0x1842b7<_0x460838;_0x1842b7++){var _0x516ce3=events[_0x1842b7];var _0x57a9cd=createListener('dashboardItem:'+_0x516ce3,_0x327278);DashboardItemEvents['on'](_0x516ce3,_0x57a9cd);}}; \ No newline at end of file +var _0xbe04=['remove','update','emit','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x426ab0,_0x13c67d){var _0x3bdb3d=function(_0x14f669){while(--_0x14f669){_0x426ab0['push'](_0x426ab0['shift']());}};_0x3bdb3d(++_0x13c67d);}(_0xbe04,0x133));var _0x4be0=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xbe04[_0x5c6994];return _0x1d5c84;};'use strict';var DashboardItemEvents=require(_0x4be0('0x0'));var events=['save',_0x4be0('0x1'),_0x4be0('0x2')];function createListener(_0x5ba827,_0x4bee9f){return function(_0xf9479){_0x4bee9f[_0x4be0('0x3')](_0x5ba827,_0xf9479);};}function removeListener(_0x17572e,_0x116b97){return function(){DashboardItemEvents['removeListener'](_0x17572e,_0x116b97);};}exports[_0x4be0('0x4')]=function(_0x52b7d0){for(var _0xf8709f=0x0,_0x41d851=events[_0x4be0('0x5')];_0xf8709f<_0x41d851;_0xf8709f++){var _0x457e5d=events[_0xf8709f];var _0x11112e=createListener(_0x4be0('0x6')+_0x457e5d,_0x52b7d0);DashboardItemEvents['on'](_0x457e5d,_0x11112e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index af12df0..2758c5c 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 _0x7fbe=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','exports','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x37f212,_0x9bf1b2){_0x37f212=_0x37f212-0x0;var _0x57ba32=_0x7fbe[_0x37f212];return _0x57ba32;};'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')](_0xe7fb('0x9'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0xc')]('/',auth[_0xe7fb('0xa')](),controller['create']);router[_0xe7fb('0xd')](_0xe7fb('0x9'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xe')]);router['delete']('/:id',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);module[_0xe7fb('0x10')]=router; \ No newline at end of file +var _0x5fab=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4c1ad8,_0x55e28d){var _0x2c617b=function(_0x5f80df){while(--_0x5f80df){_0x4c1ad8['push'](_0x4c1ad8['shift']());}};_0x2c617b(++_0x55e28d);}(_0x5fab,0x177));var _0xb5fa=function(_0x4e6eac,_0x3f4365){_0x4e6eac=_0x4e6eac-0x0;var _0x79f963=_0x5fab[_0x4e6eac];return _0x79f963;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')](_0xb5fa('0xa'),auth[_0xb5fa('0xb')](),controller['show']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0xd')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xe')]);router[_0xb5fa('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);module[_0xb5fa('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d4eaf3e..a84a737 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 _0x780e=['exports','STRING'];(function(_0x3e2465,_0x211e58){var _0x12df6c=function(_0x307aff){while(--_0x307aff){_0x3e2465['push'](_0x3e2465['shift']());}};_0x12df6c(++_0x211e58);}(_0x780e,0x78));var _0xe780=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x780e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe780('0x0')]={'name':{'type':Sequelize[_0xe780('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0342=['exports','sequelize'];(function(_0x265b51,_0x4415ec){var _0x38cd6d=function(_0x3ec0d9){while(--_0x3ec0d9){_0x265b51['push'](_0x265b51['shift']());}};_0x38cd6d(++_0x4415ec);}(_0x0342,0xf5));var _0x2034=function(_0x486f1d,_0x90c2b5){_0x486f1d=_0x486f1d-0x0;var _0x5a2c2d=_0x0342[_0x486f1d];return _0x5a2c2d;};'use strict';var Sequelize=require(_0x2034('0x0'));module[_0x2034('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index ffec59d..3fd7d07 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 _0x2c4d=['count','includeAll','rows','catch','fields','include','merge','body','user','role','Dispositions','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','update','then','destroy','get','error','name','send','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options'];(function(_0xce5e10,_0x2bc043){var _0x1145f9=function(_0x1594d8){while(--_0x1594d8){_0xce5e10['push'](_0xce5e10['shift']());}};_0x1145f9(++_0x2bc043);}(_0x2c4d,0xa9));var _0xd2c4=function(_0x55754e,_0x286388){_0x55754e=_0x55754e-0x0;var _0x2e9948=_0x2c4d[_0x55754e];return _0x2e9948;};'use strict';var pdf=require(_0xd2c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd2c4('0x1'));var zipdir=require(_0xd2c4('0x2'));var jsonpatch=require(_0xd2c4('0x3'));var rp=require(_0xd2c4('0x4'));var moment=require('moment');var BPromise=require(_0xd2c4('0x5'));var Mustache=require(_0xd2c4('0x6'));var util=require('util');var path=require(_0xd2c4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd2c4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd2c4('0x9'));var crypto=require(_0xd2c4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd2c4('0xb'));var toCsv=require(_0xd2c4('0xc'));var querystring=require(_0xd2c4('0xd'));var Papa=require(_0xd2c4('0xe'));var Redis=require(_0xd2c4('0xf'));var authService=require(_0xd2c4('0x10'));var qs=require(_0xd2c4('0x11'));var as=require(_0xd2c4('0x12'));var hardwareService=require(_0xd2c4('0x13'));var logger=require(_0xd2c4('0x14'))(_0xd2c4('0x15'));var utils=require('../../config/utils');var config=require(_0xd2c4('0x16'));var db=require(_0xd2c4('0x17'))['db'];function respondWithStatusCode(_0x24003f,_0x467f0e){_0x467f0e=_0x467f0e||0xcc;return function(_0x2a3575){if(_0x2a3575){return _0x24003f[_0xd2c4('0x18')](_0x467f0e);}return _0x24003f[_0xd2c4('0x19')](_0x467f0e)[_0xd2c4('0x1a')]();};}function respondWithResult(_0x45fcae,_0x4c1d4a){_0x4c1d4a=_0x4c1d4a||0xc8;return function(_0x116a46){if(_0x116a46){return _0x45fcae['status'](_0x4c1d4a)[_0xd2c4('0x1b')](_0x116a46);}};}function respondWithFilteredResult(_0x357a2e,_0x37db0e){return function(_0x37af8f){if(_0x37af8f){var _0x4be650=_0x37af8f['count'],_0xf94fbb=_0x37db0e[_0xd2c4('0x1c')],_0x2ac5e7=_0x37db0e['offset']+_0x37db0e[_0xd2c4('0x1d')],_0x1ee720;if(_0x2ac5e7>=_0x4be650){_0x2ac5e7=_0x4be650;_0x1ee720=0xc8;}else{_0x1ee720=0xce;}_0x357a2e['status'](_0x1ee720);return _0x357a2e['set']('Content-Range',_0xf94fbb+'-'+_0x2ac5e7+'/'+_0x4be650)[_0xd2c4('0x1b')](_0x37af8f);}return null;};}function patchUpdates(_0x28831c){return function(_0x50a4de){try{jsonpatch[_0xd2c4('0x1e')](_0x50a4de,_0x28831c,!![]);}catch(_0x522558){return BPromise[_0xd2c4('0x1f')](_0x522558);}return _0x50a4de['save']();};}function saveUpdates(_0x5f134a,_0x5ab24a){return function(_0x16d4e7){if(_0x16d4e7){return _0x16d4e7[_0xd2c4('0x20')](_0x5f134a)[_0xd2c4('0x21')](function(_0x2e6d94){return _0x2e6d94;});}return null;};}function removeEntity(_0x25e6e5,_0x25ba48){return function(_0x5b069a){if(_0x5b069a){return _0x5b069a[_0xd2c4('0x22')]()['then'](function(){var _0x348d44=_0x5b069a[_0xd2c4('0x23')]({'plain':!![]});var _0x334fab='Dispositions';return db['UserProfileResource'][_0xd2c4('0x22')]({'where':{'type':_0x334fab,'resourceId':_0x348d44['id']}})[_0xd2c4('0x21')](function(){return _0x5b069a;});})['then'](function(){_0x25e6e5['status'](0xcc)[_0xd2c4('0x1a')]();});}};}function handleEntityNotFound(_0x43293d,_0x3731ef){return function(_0x518a6c){if(!_0x518a6c){_0x43293d[_0xd2c4('0x18')](0x194);}return _0x518a6c;};}function handleError(_0x314076,_0xf1c593){_0xf1c593=_0xf1c593||0x1f4;return function(_0x5ec9ce){logger[_0xd2c4('0x24')](_0x5ec9ce['stack']);if(_0x5ec9ce[_0xd2c4('0x25')]){delete _0x5ec9ce[_0xd2c4('0x25')];}_0x314076[_0xd2c4('0x19')](_0xf1c593)[_0xd2c4('0x26')](_0x5ec9ce);};}exports['index']=function(_0x5cdc8f,_0x57b362){var _0x429ce2={},_0x3742df={},_0x1ac64d={'count':0x0,'rows':[]};var _0x26efee=_[_0xd2c4('0x27')](db[_0xd2c4('0x28')][_0xd2c4('0x29')],function(_0x175e49){return{'name':_0x175e49[_0xd2c4('0x2a')],'type':_0x175e49['type'][_0xd2c4('0x2b')]};});_0x3742df[_0xd2c4('0x2c')]=_['map'](_0x26efee,_0xd2c4('0x25'));_0x3742df[_0xd2c4('0x2d')]=_[_0xd2c4('0x2e')](_0x5cdc8f[_0xd2c4('0x2d')]);_0x3742df[_0xd2c4('0x2f')]=_['intersection'](_0x3742df['model'],_0x3742df[_0xd2c4('0x2d')]);_0x429ce2[_0xd2c4('0x30')]=_[_0xd2c4('0x31')](_0x3742df[_0xd2c4('0x2c')],qs['fields'](_0x5cdc8f['query']['fields']));_0x429ce2[_0xd2c4('0x30')]=_0x429ce2[_0xd2c4('0x30')][_0xd2c4('0x32')]?_0x429ce2[_0xd2c4('0x30')]:_0x3742df['model'];if(!_0x5cdc8f[_0xd2c4('0x2d')][_0xd2c4('0x33')](_0xd2c4('0x34'))){_0x429ce2['limit']=qs[_0xd2c4('0x1d')](_0x5cdc8f[_0xd2c4('0x2d')][_0xd2c4('0x1d')]);_0x429ce2[_0xd2c4('0x1c')]=qs[_0xd2c4('0x1c')](_0x5cdc8f['query'][_0xd2c4('0x1c')]);}_0x429ce2['order']=qs[_0xd2c4('0x35')](_0x5cdc8f[_0xd2c4('0x2d')][_0xd2c4('0x35')]);_0x429ce2[_0xd2c4('0x36')]=qs[_0xd2c4('0x2f')](_[_0xd2c4('0x37')](_0x5cdc8f[_0xd2c4('0x2d')],_0x3742df['filters']),_0x26efee);if(_0x5cdc8f['query'][_0xd2c4('0x38')]){_0x429ce2[_0xd2c4('0x36')]=_['merge'](_0x429ce2[_0xd2c4('0x36')],{'$or':_[_0xd2c4('0x27')](_0x26efee,function(_0x390654){if(_0x390654['type']!==_0xd2c4('0x39')){var _0x2cbc00={};_0x2cbc00[_0x390654['name']]={'$like':'%'+_0x5cdc8f[_0xd2c4('0x2d')][_0xd2c4('0x38')]+'%'};return _0x2cbc00;}})});}_0x429ce2=_['merge']({},_0x429ce2,_0x5cdc8f[_0xd2c4('0x3a')]);var _0x30fe37={'where':_0x429ce2[_0xd2c4('0x36')]};return db[_0xd2c4('0x28')][_0xd2c4('0x3b')](_0x30fe37)[_0xd2c4('0x21')](function(_0xe039dd){_0x1ac64d['count']=_0xe039dd;if(_0x5cdc8f[_0xd2c4('0x2d')][_0xd2c4('0x3c')]){_0x429ce2['include']=[{'all':!![]}];}return db[_0xd2c4('0x28')]['findAll'](_0x429ce2);})[_0xd2c4('0x21')](function(_0x3da458){_0x1ac64d[_0xd2c4('0x3d')]=_0x3da458;return _0x1ac64d;})[_0xd2c4('0x21')](respondWithFilteredResult(_0x57b362,_0x429ce2))[_0xd2c4('0x3e')](handleError(_0x57b362,null));};exports['show']=function(_0x1acd18,_0x3c1fea){var _0x1f8089={'raw':!![],'where':{'id':_0x1acd18['params']['id']}},_0x1e1140={};_0x1e1140[_0xd2c4('0x2c')]=_['keys'](db['Disposition'][_0xd2c4('0x29')]);_0x1e1140[_0xd2c4('0x2d')]=_[_0xd2c4('0x2e')](_0x1acd18[_0xd2c4('0x2d')]);_0x1e1140['filters']=_[_0xd2c4('0x31')](_0x1e1140[_0xd2c4('0x2c')],_0x1e1140[_0xd2c4('0x2d')]);_0x1f8089[_0xd2c4('0x30')]=_[_0xd2c4('0x31')](_0x1e1140[_0xd2c4('0x2c')],qs[_0xd2c4('0x3f')](_0x1acd18['query'][_0xd2c4('0x3f')]));_0x1f8089[_0xd2c4('0x30')]=_0x1f8089[_0xd2c4('0x30')]['length']?_0x1f8089[_0xd2c4('0x30')]:_0x1e1140['model'];if(_0x1acd18[_0xd2c4('0x2d')][_0xd2c4('0x3c')]){_0x1f8089[_0xd2c4('0x40')]=[{'all':!![]}];}_0x1f8089=_[_0xd2c4('0x41')]({},_0x1f8089,_0x1acd18[_0xd2c4('0x3a')]);return db[_0xd2c4('0x28')]['find'](_0x1f8089)['then'](handleEntityNotFound(_0x3c1fea,null))[_0xd2c4('0x21')](respondWithResult(_0x3c1fea,null))[_0xd2c4('0x3e')](handleError(_0x3c1fea,null));};exports['create']=function(_0x17d655,_0x3e78c4){return db[_0xd2c4('0x28')]['create'](_0x17d655[_0xd2c4('0x42')],{})['then'](function(_0xbe7161){var _0x32ae45=_0x17d655[_0xd2c4('0x43')][_0xd2c4('0x23')]({'plain':!![]});if(!_0x32ae45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32ae45[_0xd2c4('0x44')]===_0xd2c4('0x43')){var _0x1dc20e=_0xbe7161['get']({'plain':!![]});var _0x3b99d9=_0xd2c4('0x45');return db['UserProfileSection'][_0xd2c4('0x46')]({'where':{'name':_0x3b99d9,'userProfileId':_0x32ae45[_0xd2c4('0x47')]},'raw':!![]})['then'](function(_0x9c9d40){if(_0x9c9d40&&_0x9c9d40[_0xd2c4('0x48')]===0x0){return db[_0xd2c4('0x49')]['create']({'name':_0x1dc20e[_0xd2c4('0x25')],'resourceId':_0x1dc20e['id'],'type':_0x9c9d40['name'],'sectionId':_0x9c9d40['id']},{})[_0xd2c4('0x21')](function(){return _0xbe7161;});}else{return _0xbe7161;}})['catch'](function(_0x252f2d){logger[_0xd2c4('0x24')](_0xd2c4('0x4a'),_0x252f2d);throw _0x252f2d;});}return _0xbe7161;})[_0xd2c4('0x21')](respondWithResult(_0x3e78c4,0xc9))[_0xd2c4('0x3e')](handleError(_0x3e78c4,null));};exports[_0xd2c4('0x20')]=function(_0x5e7d44,_0x57af13){if(_0x5e7d44['body']['id']){delete _0x5e7d44['body']['id'];}return db[_0xd2c4('0x28')]['find']({'where':{'id':_0x5e7d44[_0xd2c4('0x4b')]['id']}})[_0xd2c4('0x21')](handleEntityNotFound(_0x57af13,null))[_0xd2c4('0x21')](saveUpdates(_0x5e7d44[_0xd2c4('0x42')],null))['then'](respondWithResult(_0x57af13,null))['catch'](handleError(_0x57af13,null));};exports[_0xd2c4('0x22')]=function(_0x4d6dae,_0x3c5be3){return db['Disposition'][_0xd2c4('0x46')]({'where':{'id':_0x4d6dae['params']['id']}})['then'](handleEntityNotFound(_0x3c5be3,null))[_0xd2c4('0x21')](removeEntity(_0x3c5be3,null))['catch'](handleError(_0x3c5be3,null));}; \ No newline at end of file +var _0x9a3e=['querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','update','then','get','Dispositions','UserProfileResource','destroy','error','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','rows','catch','params','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','desk.js'];(function(_0x1fbf22,_0x464e82){var _0x4849fc=function(_0x200b44){while(--_0x200b44){_0x1fbf22['push'](_0x1fbf22['shift']());}};_0x4849fc(++_0x464e82);}(_0x9a3e,0x1f3));var _0xe9a3=function(_0x2b71e1,_0x3f1f9e){_0x2b71e1=_0x2b71e1-0x0;var _0x27de10=_0x9a3e[_0x2b71e1];return _0x27de10;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9a3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe9a3('0x1'));var rp=require(_0xe9a3('0x2'));var moment=require(_0xe9a3('0x3'));var BPromise=require(_0xe9a3('0x4'));var Mustache=require('mustache');var util=require(_0xe9a3('0x5'));var path=require(_0xe9a3('0x6'));var sox=require(_0xe9a3('0x7'));var csv=require(_0xe9a3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9a3('0x9'));var squel=require('squel');var crypto=require(_0xe9a3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe9a3('0xb'));var toCsv=require(_0xe9a3('0x8'));var querystring=require(_0xe9a3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe9a3('0xd'));var qs=require(_0xe9a3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9a3('0xf'));var logger=require('../../config/logger')(_0xe9a3('0x10'));var utils=require('../../config/utils');var config=require(_0xe9a3('0x11'));var db=require(_0xe9a3('0x12'))['db'];function respondWithStatusCode(_0x216225,_0xdcaf7d){_0xdcaf7d=_0xdcaf7d||0xcc;return function(_0x175899){if(_0x175899){return _0x216225[_0xe9a3('0x13')](_0xdcaf7d);}return _0x216225[_0xe9a3('0x14')](_0xdcaf7d)[_0xe9a3('0x15')]();};}function respondWithResult(_0x26f968,_0x277b22){_0x277b22=_0x277b22||0xc8;return function(_0x4e3aca){if(_0x4e3aca){return _0x26f968[_0xe9a3('0x14')](_0x277b22)['json'](_0x4e3aca);}};}function respondWithFilteredResult(_0x3e7070,_0x524f75){return function(_0x264bbe){if(_0x264bbe){var _0x4c847f=_0x264bbe[_0xe9a3('0x16')],_0x1ae02a=_0x524f75[_0xe9a3('0x17')],_0x55ac03=_0x524f75[_0xe9a3('0x17')]+_0x524f75[_0xe9a3('0x18')],_0x562d26;if(_0x55ac03>=_0x4c847f){_0x55ac03=_0x4c847f;_0x562d26=0xc8;}else{_0x562d26=0xce;}_0x3e7070['status'](_0x562d26);return _0x3e7070['set'](_0xe9a3('0x19'),_0x1ae02a+'-'+_0x55ac03+'/'+_0x4c847f)[_0xe9a3('0x1a')](_0x264bbe);}return null;};}function patchUpdates(_0x34f571){return function(_0x1a23d1){try{jsonpatch['apply'](_0x1a23d1,_0x34f571,!![]);}catch(_0x4589e2){return BPromise[_0xe9a3('0x1b')](_0x4589e2);}return _0x1a23d1['save']();};}function saveUpdates(_0x35ce6a,_0x55cd75){return function(_0x1b3ff7){if(_0x1b3ff7){return _0x1b3ff7[_0xe9a3('0x1c')](_0x35ce6a)[_0xe9a3('0x1d')](function(_0x236fda){return _0x236fda;});}return null;};}function removeEntity(_0x3f5fb5,_0x5142c7){return function(_0x21cf65){if(_0x21cf65){return _0x21cf65['destroy']()[_0xe9a3('0x1d')](function(){var _0x18fc5c=_0x21cf65[_0xe9a3('0x1e')]({'plain':!![]});var _0x233b9a=_0xe9a3('0x1f');return db[_0xe9a3('0x20')][_0xe9a3('0x21')]({'where':{'type':_0x233b9a,'resourceId':_0x18fc5c['id']}})['then'](function(){return _0x21cf65;});})[_0xe9a3('0x1d')](function(){_0x3f5fb5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x300eba,_0x1dca40){return function(_0xbeb8ed){if(!_0xbeb8ed){_0x300eba[_0xe9a3('0x13')](0x194);}return _0xbeb8ed;};}function handleError(_0x4daf51,_0x36058f){_0x36058f=_0x36058f||0x1f4;return function(_0xdc428f){logger[_0xe9a3('0x22')](_0xdc428f['stack']);if(_0xdc428f[_0xe9a3('0x23')]){delete _0xdc428f[_0xe9a3('0x23')];}_0x4daf51['status'](_0x36058f)[_0xe9a3('0x24')](_0xdc428f);};}exports[_0xe9a3('0x25')]=function(_0x2b6510,_0xcbb41a){var _0x375372={},_0x39e46d={},_0x20cc97={'count':0x0,'rows':[]};var _0x583396=_['map'](db[_0xe9a3('0x26')][_0xe9a3('0x27')],function(_0x3e7049){return{'name':_0x3e7049[_0xe9a3('0x28')],'type':_0x3e7049[_0xe9a3('0x29')][_0xe9a3('0x2a')]};});_0x39e46d[_0xe9a3('0x2b')]=_[_0xe9a3('0x2c')](_0x583396,_0xe9a3('0x23'));_0x39e46d[_0xe9a3('0x2d')]=_[_0xe9a3('0x2e')](_0x2b6510[_0xe9a3('0x2d')]);_0x39e46d[_0xe9a3('0x2f')]=_[_0xe9a3('0x30')](_0x39e46d['model'],_0x39e46d[_0xe9a3('0x2d')]);_0x375372[_0xe9a3('0x31')]=_['intersection'](_0x39e46d[_0xe9a3('0x2b')],qs[_0xe9a3('0x32')](_0x2b6510[_0xe9a3('0x2d')][_0xe9a3('0x32')]));_0x375372[_0xe9a3('0x31')]=_0x375372[_0xe9a3('0x31')]['length']?_0x375372[_0xe9a3('0x31')]:_0x39e46d[_0xe9a3('0x2b')];if(!_0x2b6510['query'][_0xe9a3('0x33')]('nolimit')){_0x375372[_0xe9a3('0x18')]=qs[_0xe9a3('0x18')](_0x2b6510[_0xe9a3('0x2d')]['limit']);_0x375372[_0xe9a3('0x17')]=qs[_0xe9a3('0x17')](_0x2b6510[_0xe9a3('0x2d')]['offset']);}_0x375372[_0xe9a3('0x34')]=qs['sort'](_0x2b6510[_0xe9a3('0x2d')]['sort']);_0x375372[_0xe9a3('0x35')]=qs['filters'](_[_0xe9a3('0x36')](_0x2b6510[_0xe9a3('0x2d')],_0x39e46d[_0xe9a3('0x2f')]),_0x583396);if(_0x2b6510[_0xe9a3('0x2d')][_0xe9a3('0x37')]){_0x375372[_0xe9a3('0x35')]=_[_0xe9a3('0x38')](_0x375372['where'],{'$or':_[_0xe9a3('0x2c')](_0x583396,function(_0x4326be){if(_0x4326be['type']!=='VIRTUAL'){var _0x55c5b5={};_0x55c5b5[_0x4326be[_0xe9a3('0x23')]]={'$like':'%'+_0x2b6510[_0xe9a3('0x2d')][_0xe9a3('0x37')]+'%'};return _0x55c5b5;}})});}_0x375372=_[_0xe9a3('0x38')]({},_0x375372,_0x2b6510[_0xe9a3('0x39')]);var _0x1fe2b6={'where':_0x375372[_0xe9a3('0x35')]};return db[_0xe9a3('0x26')][_0xe9a3('0x16')](_0x1fe2b6)['then'](function(_0x3ae52b){_0x20cc97['count']=_0x3ae52b;if(_0x2b6510[_0xe9a3('0x2d')][_0xe9a3('0x3a')]){_0x375372[_0xe9a3('0x3b')]=[{'all':!![]}];}return db[_0xe9a3('0x26')]['findAll'](_0x375372);})[_0xe9a3('0x1d')](function(_0x4d72cd){_0x20cc97[_0xe9a3('0x3c')]=_0x4d72cd;return _0x20cc97;})[_0xe9a3('0x1d')](respondWithFilteredResult(_0xcbb41a,_0x375372))[_0xe9a3('0x3d')](handleError(_0xcbb41a,null));};exports['show']=function(_0x3fe114,_0x198729){var _0x425f27={'raw':!![],'where':{'id':_0x3fe114[_0xe9a3('0x3e')]['id']}},_0x52a339={};_0x52a339['model']=_[_0xe9a3('0x2e')](db[_0xe9a3('0x26')][_0xe9a3('0x27')]);_0x52a339['query']=_[_0xe9a3('0x2e')](_0x3fe114[_0xe9a3('0x2d')]);_0x52a339[_0xe9a3('0x2f')]=_[_0xe9a3('0x30')](_0x52a339[_0xe9a3('0x2b')],_0x52a339['query']);_0x425f27['attributes']=_[_0xe9a3('0x30')](_0x52a339['model'],qs[_0xe9a3('0x32')](_0x3fe114[_0xe9a3('0x2d')][_0xe9a3('0x32')]));_0x425f27['attributes']=_0x425f27[_0xe9a3('0x31')][_0xe9a3('0x3f')]?_0x425f27['attributes']:_0x52a339['model'];if(_0x3fe114[_0xe9a3('0x2d')]['includeAll']){_0x425f27['include']=[{'all':!![]}];}_0x425f27=_['merge']({},_0x425f27,_0x3fe114['options']);return db[_0xe9a3('0x26')]['find'](_0x425f27)['then'](handleEntityNotFound(_0x198729,null))[_0xe9a3('0x1d')](respondWithResult(_0x198729,null))[_0xe9a3('0x3d')](handleError(_0x198729,null));};exports[_0xe9a3('0x40')]=function(_0x30e1a1,_0x372f02){return db[_0xe9a3('0x26')][_0xe9a3('0x40')](_0x30e1a1['body'],{})['then'](function(_0x143e48){var _0x5f3773=_0x30e1a1['user'][_0xe9a3('0x1e')]({'plain':!![]});if(!_0x5f3773)throw new Error(_0xe9a3('0x41'));if(_0x5f3773[_0xe9a3('0x42')]==='user'){var _0x1554ab=_0x143e48[_0xe9a3('0x1e')]({'plain':!![]});var _0x523a93=_0xe9a3('0x1f');return db[_0xe9a3('0x43')][_0xe9a3('0x44')]({'where':{'name':_0x523a93,'userProfileId':_0x5f3773[_0xe9a3('0x45')]},'raw':!![]})[_0xe9a3('0x1d')](function(_0x27645b){if(_0x27645b&&_0x27645b[_0xe9a3('0x46')]===0x0){return db[_0xe9a3('0x20')][_0xe9a3('0x40')]({'name':_0x1554ab[_0xe9a3('0x23')],'resourceId':_0x1554ab['id'],'type':_0x27645b[_0xe9a3('0x23')],'sectionId':_0x27645b['id']},{})[_0xe9a3('0x1d')](function(){return _0x143e48;});}else{return _0x143e48;}})['catch'](function(_0x416af1){logger[_0xe9a3('0x22')](_0xe9a3('0x47'),_0x416af1);throw _0x416af1;});}return _0x143e48;})[_0xe9a3('0x1d')](respondWithResult(_0x372f02,0xc9))[_0xe9a3('0x3d')](handleError(_0x372f02,null));};exports[_0xe9a3('0x1c')]=function(_0x3ccc7f,_0x4466f7){if(_0x3ccc7f[_0xe9a3('0x48')]['id']){delete _0x3ccc7f[_0xe9a3('0x48')]['id'];}return db[_0xe9a3('0x26')][_0xe9a3('0x44')]({'where':{'id':_0x3ccc7f[_0xe9a3('0x3e')]['id']}})[_0xe9a3('0x1d')](handleEntityNotFound(_0x4466f7,null))['then'](saveUpdates(_0x3ccc7f[_0xe9a3('0x48')],null))[_0xe9a3('0x1d')](respondWithResult(_0x4466f7,null))[_0xe9a3('0x3d')](handleError(_0x4466f7,null));};exports[_0xe9a3('0x21')]=function(_0x1bc7e5,_0x369ab7){return db[_0xe9a3('0x26')]['find']({'where':{'id':_0x1bc7e5[_0xe9a3('0x3e')]['id']}})['then'](handleEntityNotFound(_0x369ab7,null))[_0xe9a3('0x1d')](removeEntity(_0x369ab7,null))[_0xe9a3('0x3d')](handleError(_0x369ab7,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 719f7b3..d62d6c0 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 _0x24ab=['api','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','lodash','util','../../config/logger'];(function(_0x3304fa,_0x5000e2){var _0x1117bb=function(_0x1dddc5){while(--_0x1dddc5){_0x3304fa['push'](_0x3304fa['shift']());}};_0x1117bb(++_0x5000e2);}(_0x24ab,0x135));var _0xb24a=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x24ab[_0x95942];return _0x6d7f81;};'use strict';var _=require(_0xb24a('0x0'));var util=require(_0xb24a('0x1'));var logger=require(_0xb24a('0x2'))(_0xb24a('0x3'));var moment=require('moment');var BPromise=require(_0xb24a('0x4'));var rp=require(_0xb24a('0x5'));var fs=require('fs');var path=require(_0xb24a('0x6'));var rimraf=require(_0xb24a('0x7'));var config=require(_0xb24a('0x8'));var attributes=require(_0xb24a('0x9'));module[_0xb24a('0xa')]=function(_0x14658c,_0x57fa99){return _0x14658c[_0xb24a('0xb')](_0xb24a('0xc'),attributes,{'tableName':_0xb24a('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xb24a('0xe'),'fields':[_0xb24a('0xf'),_0xb24a('0x10')]},{'unique':!![],'name':_0xb24a('0x11'),'fields':['name',_0xb24a('0x12')]},{'unique':!![],'name':'name_mail','fields':[_0xb24a('0xf'),_0xb24a('0x13')]},{'unique':!![],'name':_0xb24a('0x14'),'fields':['name',_0xb24a('0x15')]},{'unique':!![],'name':_0xb24a('0x16'),'fields':[_0xb24a('0xf'),_0xb24a('0x17')]},{'unique':!![],'name':_0xb24a('0x18'),'fields':[_0xb24a('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':_0xb24a('0x19'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c67=['FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./disposition.attributes','exports','define','Disposition','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax'];(function(_0x56131c,_0x251b1f){var _0x40d1f0=function(_0x46d116){while(--_0x46d116){_0x56131c['push'](_0x56131c['shift']());}};_0x40d1f0(++_0x251b1f);}(_0x9c67,0xf5));var _0x79c6=function(_0x126a6f,_0x390a17){_0x126a6f=_0x126a6f-0x0;var _0x3988db=_0x9c67[_0x126a6f];return _0x3988db;};'use strict';var _=require('lodash');var util=require(_0x79c6('0x0'));var logger=require(_0x79c6('0x1'))(_0x79c6('0x2'));var moment=require(_0x79c6('0x3'));var BPromise=require(_0x79c6('0x4'));var rp=require(_0x79c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79c6('0x6'));var config=require('../../config/environment');var attributes=require(_0x79c6('0x7'));module[_0x79c6('0x8')]=function(_0x56c8ea,_0x233e9d){return _0x56c8ea[_0x79c6('0x9')](_0x79c6('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x79c6('0xb'),_0x79c6('0xc')]},{'unique':!![],'name':_0x79c6('0xd'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x79c6('0xe'),'fields':[_0x79c6('0xb'),_0x79c6('0xf')]},{'unique':!![],'name':_0x79c6('0x10'),'fields':['name',_0x79c6('0x11')]},{'unique':!![],'name':_0x79c6('0x12'),'fields':[_0x79c6('0xb'),_0x79c6('0x13')]},{'unique':!![],'name':_0x79c6('0x14'),'fields':[_0x79c6('0xb'),_0x79c6('0x15')]},{'unique':!![],'name':_0x79c6('0x16'),'fields':['name',_0x79c6('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 62ec9cb..6f33816 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 _0x20d9=['error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xcf31f3,_0x4517db){var _0x362842=function(_0x273529){while(--_0x273529){_0xcf31f3['push'](_0xcf31f3['shift']());}};_0x362842(++_0x4517db);}(_0x20d9,0x88));var _0x920d=function(_0x35a2ea,_0x1c44af){_0x35a2ea=_0x35a2ea-0x0;var _0x9cc255=_0x20d9[_0x35a2ea];return _0x9cc255;};'use strict';var _=require(_0x920d('0x0'));var util=require(_0x920d('0x1'));var moment=require('moment');var BPromise=require(_0x920d('0x2'));var rs=require(_0x920d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x920d('0x4'));var logger=require(_0x920d('0x5'))(_0x920d('0x6'));var config=require(_0x920d('0x7'));var jayson=require(_0x920d('0x8'));var client=jayson[_0x920d('0x9')][_0x920d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12d6c2,_0x47ad40,_0x24feba){return new BPromise(function(_0x21662e,_0x1d2f9a){return client[_0x920d('0xb')](_0x12d6c2,_0x24feba)[_0x920d('0xc')](function(_0x40a28d){logger[_0x920d('0xd')](_0x920d('0xe'),_0x47ad40,'request\x20sent');logger[_0x920d('0xf')](_0x920d('0x10'),_0x47ad40,_0x920d('0x11'),JSON['stringify'](_0x40a28d));if(_0x40a28d[_0x920d('0x12')]){if(_0x40a28d[_0x920d('0x12')][_0x920d('0x13')]===0x1f4){logger[_0x920d('0x12')](_0x920d('0xe'),_0x47ad40,_0x40a28d[_0x920d('0x12')]['message']);return _0x1d2f9a(_0x40a28d[_0x920d('0x12')][_0x920d('0x14')]);}logger[_0x920d('0x12')]('Disposition,\x20%s,\x20%s',_0x47ad40,_0x40a28d['error'][_0x920d('0x14')]);return _0x21662e(_0x40a28d[_0x920d('0x12')][_0x920d('0x14')]);}else{logger['info'](_0x920d('0xe'),_0x47ad40,'request\x20sent');_0x21662e(_0x40a28d['result'][_0x920d('0x14')]);}})[_0x920d('0x15')](function(_0x27810d){logger['error']('Disposition,\x20%s,\x20%s',_0x47ad40,_0x27810d);_0x1d2f9a(_0x27810d);});});} \ No newline at end of file +var _0xb6ee=['Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','Disposition,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0xaf365b,_0x3b1ee2){var _0x608a9d=function(_0x2f0ab7){while(--_0x2f0ab7){_0xaf365b['push'](_0xaf365b['shift']());}};_0x608a9d(++_0x3b1ee2);}(_0xb6ee,0x68));var _0xeb6e=function(_0x22e5af,_0x5c91f4){_0x22e5af=_0x22e5af-0x0;var _0x1a23ed=_0xb6ee[_0x22e5af];return _0x1a23ed;};'use strict';var _=require('lodash');var util=require(_0xeb6e('0x0'));var moment=require(_0xeb6e('0x1'));var BPromise=require(_0xeb6e('0x2'));var rs=require(_0xeb6e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb6e('0x4'))['db'];var utils=require(_0xeb6e('0x5'));var logger=require(_0xeb6e('0x6'))(_0xeb6e('0x7'));var config=require(_0xeb6e('0x8'));var jayson=require(_0xeb6e('0x9'));var client=jayson[_0xeb6e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x566bb8,_0x280daf,_0x210672){return new BPromise(function(_0xec67bc,_0x2c2c8a){return client[_0xeb6e('0xb')](_0x566bb8,_0x210672)[_0xeb6e('0xc')](function(_0x5c331a){logger[_0xeb6e('0xd')]('Disposition,\x20%s,\x20%s',_0x280daf,_0xeb6e('0xe'));logger[_0xeb6e('0xf')](_0xeb6e('0x10'),_0x280daf,_0xeb6e('0xe'),JSON[_0xeb6e('0x11')](_0x5c331a));if(_0x5c331a[_0xeb6e('0x12')]){if(_0x5c331a[_0xeb6e('0x12')][_0xeb6e('0x13')]===0x1f4){logger[_0xeb6e('0x12')](_0xeb6e('0x14'),_0x280daf,_0x5c331a['error'][_0xeb6e('0x15')]);return _0x2c2c8a(_0x5c331a[_0xeb6e('0x12')][_0xeb6e('0x15')]);}logger[_0xeb6e('0x12')](_0xeb6e('0x14'),_0x280daf,_0x5c331a['error'][_0xeb6e('0x15')]);return _0xec67bc(_0x5c331a[_0xeb6e('0x12')][_0xeb6e('0x15')]);}else{logger[_0xeb6e('0xd')](_0xeb6e('0x14'),_0x280daf,_0xeb6e('0xe'));_0xec67bc(_0x5c331a[_0xeb6e('0x16')][_0xeb6e('0x15')]);}})[_0xeb6e('0x17')](function(_0x3f9a6a){logger['error'](_0xeb6e('0x14'),_0x280daf,_0x3f9a6a);_0x2c2c8a(_0x3f9a6a);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 382a5f3..bb44f53 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 _0x500c=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5d6a67,_0x15db02){var _0x18369a=function(_0x333e9f){while(--_0x333e9f){_0x5d6a67['push'](_0x5d6a67['shift']());}};_0x18369a(++_0x15db02);}(_0x500c,0x188));var _0xc500=function(_0x48f4d8,_0x20203c){_0x48f4d8=_0x48f4d8-0x0;var _0x3a6f7e=_0x500c[_0x48f4d8];return _0x3a6f7e;};'use strict';var multer=require(_0xc500('0x0'));var util=require(_0xc500('0x1'));var path=require(_0xc500('0x2'));var timeout=require(_0xc500('0x3'));var express=require(_0xc500('0x4'));var router=express[_0xc500('0x5')]();var auth=require(_0xc500('0x6'));var interaction=require(_0xc500('0x7'));var config=require(_0xc500('0x8'));var controller=require(_0xc500('0x9'));router[_0xc500('0xa')]('/',auth[_0xc500('0xb')](),controller[_0xc500('0xc')]);router[_0xc500('0xa')](_0xc500('0xd'),auth['isAuthenticated'](),controller[_0xc500('0xe')]);router['post']('/',auth[_0xc500('0xb')](),controller[_0xc500('0xf')]);router[_0xc500('0x10')](_0xc500('0xd'),auth[_0xc500('0xb')](),controller[_0xc500('0x11')]);router['delete'](_0xc500('0xd'),auth['isAuthenticated'](),controller[_0xc500('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe35d=['get','isAuthenticated','index','show','post','create','/:id','update','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller'];(function(_0x58b571,_0x585a32){var _0x32f892=function(_0x5ab55e){while(--_0x5ab55e){_0x58b571['push'](_0x58b571['shift']());}};_0x32f892(++_0x585a32);}(_0xe35d,0xd5));var _0xde35=function(_0x5edfc5,_0x1563ab){_0x5edfc5=_0x5edfc5-0x0;var _0x35a64a=_0xe35d[_0x5edfc5];return _0x35a64a;};'use strict';var multer=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde35('0x2'));var router=express[_0xde35('0x3')]();var auth=require(_0xde35('0x4'));var interaction=require(_0xde35('0x5'));var config=require(_0xde35('0x6'));var controller=require(_0xde35('0x7'));router[_0xde35('0x8')]('/',auth[_0xde35('0x9')](),controller[_0xde35('0xa')]);router[_0xde35('0x8')]('/:id',auth[_0xde35('0x9')](),controller[_0xde35('0xb')]);router[_0xde35('0xc')]('/',auth[_0xde35('0x9')](),controller[_0xde35('0xd')]);router['put'](_0xde35('0xe'),auth[_0xde35('0x9')](),controller[_0xde35('0xf')]);router['delete'](_0xde35('0xe'),auth[_0xde35('0x9')](),controller['destroy']);module[_0xde35('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 41da520..1e76a54 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 _0x9501=['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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','12000','DADHI','KHOMP'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0x9501,0x11d));var _0x1950=function(_0x5c9781,_0x4c20c0){_0x5c9781=_0x5c9781-0x0;var _0x4db976=_0x9501[_0x5c9781];return _0x4db976;};'use strict';var Sequelize=require(_0x1950('0x0'));module[_0x1950('0x1')]={'name':{'type':Sequelize[_0x1950('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1950('0x2')]},'ecm':{'type':Sequelize[_0x1950('0x3')]('yes','no'),'defaultValue':_0x1950('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x1950('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x1950('0x6')},'minrate':{'type':Sequelize[_0x1950('0x3')](_0x1950('0x7'),_0x1950('0x8'),'7200',_0x1950('0x9'),'12000',_0x1950('0xa')),'defaultValue':_0x1950('0x8')},'maxrate':{'type':Sequelize[_0x1950('0x3')]('2400','4800','7200',_0x1950('0x9'),_0x1950('0xb'),_0x1950('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x1950('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1950('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1950('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1950('0x3')]('SIP','IAX',_0x1950('0xc'),_0x1950('0xd')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1950('0xe')],'defaultValue':function(){return _0x1950('0xf');}},'notificationSound':{'type':Sequelize[_0x1950('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1950('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1950('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1950('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1950('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1950('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x1950('0x10')],'defaultValue':![],'comment':_0x1950('0x13'),'set':function(_0x42fff4){if(!_0x42fff4)this['setDataValue'](_0x1950('0x14'),null);this[_0x1950('0x15')](_0x1950('0x16'),_0x42fff4);}}}; \ No newline at end of file +var _0xf4a0=['14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf4a0,0xf3));var _0x0f4a=function(_0x197043,_0x3ebf47){_0x197043=_0x197043-0x0;var _0x233e33=_0xf4a0[_0x197043];return _0x233e33;};'use strict';var Sequelize=require('sequelize');module[_0x0f4a('0x0')]={'name':{'type':Sequelize[_0x0f4a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0f4a('0x1')]},'ecm':{'type':Sequelize[_0x0f4a('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x0f4a('0x3')},'localstationid':{'type':Sequelize[_0x0f4a('0x1')],'unique':_0x0f4a('0x4')},'minrate':{'type':Sequelize[_0x0f4a('0x2')](_0x0f4a('0x5'),_0x0f4a('0x6'),_0x0f4a('0x7'),_0x0f4a('0x8'),_0x0f4a('0x9'),_0x0f4a('0xa')),'defaultValue':_0x0f4a('0x6')},'maxrate':{'type':Sequelize[_0x0f4a('0x2')](_0x0f4a('0x5'),_0x0f4a('0x6'),_0x0f4a('0x7'),_0x0f4a('0x8'),'12000',_0x0f4a('0xa')),'defaultValue':_0x0f4a('0xa')},'modem':{'type':Sequelize[_0x0f4a('0x1')],'defaultValue':_0x0f4a('0xb')},'gateway':{'type':Sequelize[_0x0f4a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0f4a('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x0f4a('0xd'),_0x0f4a('0xe'),'DADHI',_0x0f4a('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x0f4a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0f4a('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0f4a('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0f4a('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0f4a('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0f4a('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0f4a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0f4a('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x0f4a('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0f4a('0x13'),'set':function(_0x334e20){if(!_0x334e20)this['setDataValue'](_0x0f4a('0x14'),null);this[_0x0f4a('0x15')](_0x0f4a('0x16'),_0x334e20);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 96f5c1a..d68d5c3 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 _0x97ca=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','limit','set','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','ids','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','tech','TrunkId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','out','Messages','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x97ca,0x172));var _0xa97c=function(_0x25d403,_0x5612bb){_0x25d403=_0x25d403-0x0;var _0x3f3b24=_0x97ca[_0x25d403];return _0x3f3b24;};'use strict';var pdf=require(_0xa97c('0x0'));var emlformat=require(_0xa97c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa97c('0x2'));var jsonpatch=require(_0xa97c('0x3'));var rp=require('request-promise');var moment=require(_0xa97c('0x4'));var BPromise=require(_0xa97c('0x5'));var Mustache=require(_0xa97c('0x6'));var util=require(_0xa97c('0x7'));var path=require(_0xa97c('0x8'));var sox=require('sox');var csv=require(_0xa97c('0x9'));var ejs=require(_0xa97c('0xa'));var fs=require('fs');var _=require(_0xa97c('0xb'));var squel=require(_0xa97c('0xc'));var crypto=require(_0xa97c('0xd'));var jsforce=require(_0xa97c('0xe'));var deskjs=require(_0xa97c('0xf'));var toCsv=require(_0xa97c('0x9'));var querystring=require(_0xa97c('0x10'));var Papa=require(_0xa97c('0x11'));var Redis=require(_0xa97c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa97c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa97c('0x14'));var logger=require('../../config/logger')(_0xa97c('0x15'));var utils=require(_0xa97c('0x16'));var config=require(_0xa97c('0x17'));var db=require(_0xa97c('0x18'))['db'];config[_0xa97c('0x19')]=_[_0xa97c('0x1a')](config[_0xa97c('0x19')],{'host':_0xa97c('0x1b'),'port':0x18eb});var socket=require(_0xa97c('0x1c'))(new Redis(config[_0xa97c('0x19')]));require(_0xa97c('0x1d'))[_0xa97c('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa97c('0x1f')][_0xa97c('0x20')]({'port':0x232c});var client9002=jayson[_0xa97c('0x1f')][_0xa97c('0x20')]({'port':0x232a});function checkPasswordPattern(_0x569dff,_0x335e2f,_0x3beb60){if(_0x3beb60){var _0x3bfa79=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3bfa79[_0xa97c('0x21')](_0x335e2f)){return _0x569dff;}else{throw new db[(_0xa97c('0x22'))]['ValidationError'](_0xa97c('0x23'));}}else{return _0x569dff;}}function respondWithRpcPromise(_0x59736d,_0x3dda1f,_0x202d16,_0x1710bb){return new BPromise(function(_0x1160ec,_0x42413d){var _0x22ee44=_0x1710bb||client;return _0x22ee44[_0xa97c('0x24')](_0x59736d,_0x202d16)[_0xa97c('0x25')](function(_0x1f3990){logger[_0xa97c('0x26')](_0xa97c('0x27'),_0x3dda1f,'request\x20sent');logger['debug'](_0xa97c('0x28'),_0x3dda1f,'request\x20sent',JSON[_0xa97c('0x29')](_0x1f3990));if(_0x1f3990[_0xa97c('0x2a')]){if(_0x1f3990[_0xa97c('0x2a')]['code']===0x1f4){logger[_0xa97c('0x2a')](_0xa97c('0x27'),_0x3dda1f,_0x1f3990[_0xa97c('0x2a')][_0xa97c('0x2b')]);return _0x42413d(_0x1f3990[_0xa97c('0x2a')][_0xa97c('0x2b')]);}logger[_0xa97c('0x2a')](_0xa97c('0x27'),_0x3dda1f,_0x1f3990[_0xa97c('0x2a')][_0xa97c('0x2b')]);return _0x1160ec(_0x1f3990[_0xa97c('0x2a')][_0xa97c('0x2b')]);}else{logger['info'](_0xa97c('0x27'),_0x3dda1f,'request\x20sent');_0x1160ec(_0x1f3990[_0xa97c('0x2c')][_0xa97c('0x2b')]);}})['catch'](function(_0x5684ad){logger[_0xa97c('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x3dda1f,_0x5684ad);_0x42413d(_0x5684ad);});});}function respondWithStatusCode(_0x2016c0,_0x48539d){_0x48539d=_0x48539d||0xcc;return function(_0x3e5daf){if(_0x3e5daf){return _0x2016c0[_0xa97c('0x2d')](_0x48539d);}return _0x2016c0[_0xa97c('0x2e')](_0x48539d)[_0xa97c('0x2f')]();};}function respondWithResult(_0x5cad3d,_0x7abd0f){_0x7abd0f=_0x7abd0f||0xc8;return function(_0xc9d739){if(_0xc9d739){return _0x5cad3d[_0xa97c('0x2e')](_0x7abd0f)['json'](_0xc9d739);}};}function respondWithFilteredResult(_0xd5dce9,_0x59ffd9){return function(_0x34f8fc){if(_0x34f8fc){var _0x4cc5d2=_0x34f8fc['count'],_0x253915=_0x59ffd9['offset'],_0x54c2f5=_0x59ffd9[_0xa97c('0x30')]+_0x59ffd9[_0xa97c('0x31')],_0x1a0739;if(_0x54c2f5>=_0x4cc5d2){_0x54c2f5=_0x4cc5d2;_0x1a0739=0xc8;}else{_0x1a0739=0xce;}_0xd5dce9[_0xa97c('0x2e')](_0x1a0739);return _0xd5dce9[_0xa97c('0x32')]('Content-Range',_0x253915+'-'+_0x54c2f5+'/'+_0x4cc5d2)['json'](_0x34f8fc);}return null;};}function patchUpdates(_0x241477){return function(_0x5960b7){try{jsonpatch[_0xa97c('0x33')](_0x5960b7,_0x241477,!![]);}catch(_0x830798){return BPromise[_0xa97c('0x34')](_0x830798);}return _0x5960b7[_0xa97c('0x35')]();};}function saveUpdates(_0x3f35bf,_0x152d74){return function(_0x3fd143){if(_0x3fd143){return _0x3fd143[_0xa97c('0x36')](_0x3f35bf)[_0xa97c('0x25')](function(_0x3f8649){return _0x3f8649;});}return null;};}function removeEntity(_0x4ddce0,_0x36910c){return function(_0x4b65a6){if(_0x4b65a6){return _0x4b65a6[_0xa97c('0x37')]()['then'](function(){var _0x2a980f=_0x4b65a6[_0xa97c('0x38')]({'plain':!![]});var _0x7b33f5=_0xa97c('0x39');return db[_0xa97c('0x3a')][_0xa97c('0x37')]({'where':{'type':_0x7b33f5,'resourceId':_0x2a980f['id']}})[_0xa97c('0x25')](function(){return _0x4b65a6;});})[_0xa97c('0x25')](function(){_0x4ddce0['status'](0xcc)[_0xa97c('0x2f')]();});}};}function handleEntityNotFound(_0x367a35,_0x2df476){return function(_0x46c2ab){if(!_0x46c2ab){_0x367a35[_0xa97c('0x2d')](0x194);}return _0x46c2ab;};}function handleError(_0x3e55e1,_0x4dffde){_0x4dffde=_0x4dffde||0x1f4;return function(_0x49e4fd){logger['error'](_0x49e4fd['stack']);if(_0x49e4fd['name']){delete _0x49e4fd[_0xa97c('0x3b')];}_0x3e55e1[_0xa97c('0x2e')](_0x4dffde)[_0xa97c('0x3c')](_0x49e4fd);};}exports[_0xa97c('0x3d')]=function(_0x18f839,_0x306f69){var _0xb20520={'include':[{'model':db[_0xa97c('0x3e')],'as':_0xa97c('0x3f')}]},_0x27db2d={},_0x54e9a2={'count':0x0,'rows':[]};var _0x46369a=_['map'](db[_0xa97c('0x40')][_0xa97c('0x41')],function(_0xec25be){return{'name':_0xec25be[_0xa97c('0x42')],'type':_0xec25be[_0xa97c('0x43')][_0xa97c('0x44')]};});_0x27db2d['model']=_[_0xa97c('0x45')](_0x46369a,_0xa97c('0x3b'));_0x27db2d[_0xa97c('0x46')]=_[_0xa97c('0x47')](_0x18f839[_0xa97c('0x46')]);_0x27db2d[_0xa97c('0x48')]=_[_0xa97c('0x49')](_0x27db2d[_0xa97c('0x4a')],_0x27db2d[_0xa97c('0x46')]);_0xb20520[_0xa97c('0x4b')]=_[_0xa97c('0x49')](_0x27db2d[_0xa97c('0x4a')],qs[_0xa97c('0x4c')](_0x18f839[_0xa97c('0x46')]['fields']));_0xb20520[_0xa97c('0x4b')]=_0xb20520['attributes']['length']?_0xb20520['attributes']:_0x27db2d[_0xa97c('0x4a')];if(!_0x18f839[_0xa97c('0x46')][_0xa97c('0x4d')](_0xa97c('0x4e'))){_0xb20520[_0xa97c('0x31')]=qs['limit'](_0x18f839['query'][_0xa97c('0x31')]);_0xb20520[_0xa97c('0x30')]=qs['offset'](_0x18f839['query'][_0xa97c('0x30')]);}_0xb20520[_0xa97c('0x4f')]=qs['sort'](_0x18f839[_0xa97c('0x46')][_0xa97c('0x50')]);_0xb20520[_0xa97c('0x51')]=qs[_0xa97c('0x48')](_[_0xa97c('0x52')](_0x18f839[_0xa97c('0x46')],_0x27db2d[_0xa97c('0x48')]),_0x46369a);if(_0x18f839[_0xa97c('0x46')]['filter']){_0xb20520['where']=_['merge'](_0xb20520[_0xa97c('0x51')],{'$or':_[_0xa97c('0x45')](_0x46369a,function(_0x31dcaa){if(_0x31dcaa['type']!==_0xa97c('0x53')){var _0x355b1c={};_0x355b1c[_0x31dcaa[_0xa97c('0x3b')]]={'$like':'%'+_0x18f839[_0xa97c('0x46')][_0xa97c('0x54')]+'%'};return _0x355b1c;}})});}_0xb20520=_[_0xa97c('0x55')]({},_0xb20520,_0x18f839[_0xa97c('0x56')]);var _0x317733={'where':_0xb20520[_0xa97c('0x51')]};return db['FaxAccount']['count'](_0x317733)[_0xa97c('0x25')](function(_0x3e9268){_0x54e9a2[_0xa97c('0x57')]=_0x3e9268;if(_0x18f839[_0xa97c('0x46')][_0xa97c('0x58')]){_0xb20520[_0xa97c('0x59')]=[{'all':!![]}];}return db[_0xa97c('0x40')][_0xa97c('0x5a')](_0xb20520);})[_0xa97c('0x25')](function(_0x26e18f){_0x54e9a2[_0xa97c('0x5b')]=_0x26e18f;return _0x54e9a2;})['then'](respondWithFilteredResult(_0x306f69,_0xb20520))[_0xa97c('0x5c')](handleError(_0x306f69,null));};exports['show']=function(_0x1c6eaa,_0x4be84f){var _0x1e2e39={'raw':![],'where':{'id':_0x1c6eaa[_0xa97c('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xa97c('0x3f')}]},_0x1caad1={};_0x1caad1[_0xa97c('0x4a')]=_[_0xa97c('0x47')](db[_0xa97c('0x40')]['rawAttributes']);_0x1caad1[_0xa97c('0x46')]=_[_0xa97c('0x47')](_0x1c6eaa[_0xa97c('0x46')]);_0x1caad1[_0xa97c('0x48')]=_[_0xa97c('0x49')](_0x1caad1['model'],_0x1caad1['query']);_0x1e2e39[_0xa97c('0x4b')]=_['intersection'](_0x1caad1[_0xa97c('0x4a')],qs[_0xa97c('0x4c')](_0x1c6eaa[_0xa97c('0x46')][_0xa97c('0x4c')]));_0x1e2e39['attributes']=_0x1e2e39[_0xa97c('0x4b')][_0xa97c('0x5e')]?_0x1e2e39[_0xa97c('0x4b')]:_0x1caad1[_0xa97c('0x4a')];if(_0x1c6eaa[_0xa97c('0x46')][_0xa97c('0x58')]){_0x1e2e39[_0xa97c('0x59')]=[{'all':!![]}];}_0x1e2e39=_[_0xa97c('0x55')]({},_0x1e2e39,_0x1c6eaa['options']);return db[_0xa97c('0x40')]['find'](_0x1e2e39)[_0xa97c('0x25')](handleEntityNotFound(_0x4be84f,null))[_0xa97c('0x25')](respondWithResult(_0x4be84f,null))[_0xa97c('0x5c')](handleError(_0x4be84f,null));};exports[_0xa97c('0x5f')]=function(_0xb810f8,_0xa6dbdb){return db['FaxAccount']['create'](_0xb810f8[_0xa97c('0x60')],{})[_0xa97c('0x25')](function(_0x525678){var _0x49587f=_0xb810f8[_0xa97c('0x61')][_0xa97c('0x38')]({'plain':!![]});if(!_0x49587f)throw new Error(_0xa97c('0x62'));if(_0x49587f[_0xa97c('0x63')]===_0xa97c('0x61')){var _0x3d15aa=_0x525678['get']({'plain':!![]});var _0x2ad9d7=_0xa97c('0x39');return db[_0xa97c('0x64')]['find']({'where':{'name':_0x2ad9d7,'userProfileId':_0x49587f[_0xa97c('0x65')]},'raw':!![]})['then'](function(_0x357a11){if(_0x357a11&&_0x357a11[_0xa97c('0x66')]===0x0){return db['UserProfileResource']['create']({'name':_0x3d15aa[_0xa97c('0x3b')],'resourceId':_0x3d15aa['id'],'type':_0x357a11[_0xa97c('0x3b')],'sectionId':_0x357a11['id']},{})[_0xa97c('0x25')](function(){return _0x525678;});}else{return _0x525678;}})[_0xa97c('0x5c')](function(_0x4c74b4){logger[_0xa97c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c74b4);throw _0x4c74b4;});}return _0x525678;})['then'](respondWithResult(_0xa6dbdb,0xc9))[_0xa97c('0x5c')](handleError(_0xa6dbdb,null));};exports[_0xa97c('0x36')]=function(_0xcb58fa,_0x1383a4){if(_0xcb58fa[_0xa97c('0x60')]['id']){delete _0xcb58fa[_0xa97c('0x60')]['id'];}return db[_0xa97c('0x40')][_0xa97c('0x67')]({'where':{'id':_0xcb58fa['params']['id']},'include':[{'model':db['Pause'],'as':_0xa97c('0x3f')}]})[_0xa97c('0x25')](handleEntityNotFound(_0x1383a4,null))[_0xa97c('0x25')](saveUpdates(_0xcb58fa['body'],null))[_0xa97c('0x25')](respondWithResult(_0x1383a4,null))[_0xa97c('0x5c')](handleError(_0x1383a4,null));};exports['destroy']=function(_0x4471b9,_0x5b5585){return db[_0xa97c('0x40')]['find']({'where':{'id':_0x4471b9['params']['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x5b5585,null))[_0xa97c('0x25')](removeEntity(_0x5b5585,null))[_0xa97c('0x5c')](handleError(_0x5b5585,null));};exports['describe']=function(_0x56c995,_0x5d68d8){return db['FaxAccount'][_0xa97c('0x68')]()['then'](respondWithResult(_0x5d68d8,null))['catch'](handleError(_0x5d68d8,null));};exports[_0xa97c('0x69')]=function(_0x4a8d79,_0x4ec1d8,_0x31b299){if(_0x4a8d79[_0xa97c('0x60')]['id']){delete _0x4a8d79['body']['id'];}return db['FaxAccount'][_0xa97c('0x67')]({'where':{'id':_0x4a8d79[_0xa97c('0x5d')]['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x4ec1d8,null))[_0xa97c('0x25')](function(_0x28b9ab){if(_0x28b9ab){_0x4a8d79[_0xa97c('0x60')][_0xa97c('0x6a')]=_0x28b9ab['id'];return db['Disposition'][_0xa97c('0x5f')](_0x4a8d79[_0xa97c('0x60')]);}})['then'](respondWithResult(_0x4ec1d8,null))['catch'](handleError(_0x4ec1d8,null));};exports[_0xa97c('0x6b')]=function(_0x488709,_0x1f5273,_0x14da2a){var _0x2111e5={'raw':![],'where':{}};var _0x586521={};var _0xc0297a={'count':0x0,'rows':[]};return db[_0xa97c('0x40')][_0xa97c('0x6c')]({'where':{'id':_0x488709[_0xa97c('0x5d')]['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x1f5273,null))[_0xa97c('0x25')](function(_0x2e661e){if(_0x2e661e){_0x586521[_0xa97c('0x4a')]=_['keys'](db[_0xa97c('0x6d')]['rawAttributes']);_0x586521['query']=_['keys'](_0x488709[_0xa97c('0x46')]);_0x586521[_0xa97c('0x48')]=_[_0xa97c('0x49')](_0x586521[_0xa97c('0x4a')],_0x586521[_0xa97c('0x46')]);_0x2111e5[_0xa97c('0x4b')]=_[_0xa97c('0x49')](_0x586521[_0xa97c('0x4a')],qs[_0xa97c('0x4c')](_0x488709[_0xa97c('0x46')][_0xa97c('0x4c')]));_0x2111e5[_0xa97c('0x4b')]=_0x2111e5[_0xa97c('0x4b')]['length']?_0x2111e5[_0xa97c('0x4b')]:_0x586521['model'];if(!_0x488709[_0xa97c('0x46')]['hasOwnProperty'](_0xa97c('0x4e'))){_0x2111e5['limit']=qs[_0xa97c('0x31')](_0x488709[_0xa97c('0x46')][_0xa97c('0x31')]);_0x2111e5[_0xa97c('0x30')]=qs[_0xa97c('0x30')](_0x488709[_0xa97c('0x46')][_0xa97c('0x30')]);}_0x2111e5[_0xa97c('0x4f')]=qs[_0xa97c('0x50')](_0x488709[_0xa97c('0x46')][_0xa97c('0x50')]);_0x2111e5['where']=qs[_0xa97c('0x48')](_['pick'](_0x488709[_0xa97c('0x46')],_0x586521[_0xa97c('0x48')]));_0x2111e5[_0xa97c('0x51')]['FaxAccountId']=_0x2e661e['id'];if(_0x488709[_0xa97c('0x46')][_0xa97c('0x54')]){_0x2111e5['where']=_[_0xa97c('0x55')](_0x2111e5[_0xa97c('0x51')],{'$or':_[_0xa97c('0x45')](_0x2111e5[_0xa97c('0x4b')],function(_0x309740){var _0x34d5f3={};_0x34d5f3[_0x309740]={'$like':'%'+_0x488709['query']['filter']+'%'};return _0x34d5f3;})});}_0x2111e5=_[_0xa97c('0x55')]({},_0x2111e5,_0x488709[_0xa97c('0x56')]);return db['Disposition']['count']({'where':_0x2111e5[_0xa97c('0x51')]})[_0xa97c('0x25')](function(_0x1d7bcc){_0xc0297a['count']=_0x1d7bcc;if(_0x488709[_0xa97c('0x46')]['includeAll']){_0x2111e5[_0xa97c('0x59')]=[{'all':!![]}];}return db[_0xa97c('0x6d')]['findAll'](_0x2111e5);})[_0xa97c('0x25')](function(_0x368678){_0xc0297a[_0xa97c('0x5b')]=_0x368678;return _0xc0297a;});}})[_0xa97c('0x25')](respondWithFilteredResult(_0x1f5273,_0x2111e5))[_0xa97c('0x5c')](handleError(_0x1f5273,null));};exports[_0xa97c('0x6e')]=function(_0x165fb1,_0x428da2,_0x268892){return db[_0xa97c('0x40')][_0xa97c('0x67')]({'where':{'id':_0x165fb1[_0xa97c('0x5d')]['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x428da2,null))[_0xa97c('0x25')](function(_0x51c2bd){if(_0x51c2bd){return _0x51c2bd[_0xa97c('0x6e')](_0x165fb1[_0xa97c('0x46')]['ids']);}})[_0xa97c('0x25')](respondWithStatusCode(_0x428da2,null))['catch'](handleError(_0x428da2,null));};exports[_0xa97c('0x6f')]=function(_0x5452f0,_0x5d38b5,_0x55f6da){if(_0x5452f0[_0xa97c('0x60')]['id']){delete _0x5452f0[_0xa97c('0x60')]['id'];}return db[_0xa97c('0x40')][_0xa97c('0x67')]({'where':{'id':_0x5452f0[_0xa97c('0x5d')]['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x5d38b5,null))[_0xa97c('0x25')](function(_0x4fcd27){if(_0x4fcd27){_0x5452f0[_0xa97c('0x60')][_0xa97c('0x6a')]=_0x4fcd27['id'];return db[_0xa97c('0x70')][_0xa97c('0x5f')](_0x5452f0['body']);}})[_0xa97c('0x25')](respondWithResult(_0x5d38b5,null))[_0xa97c('0x5c')](handleError(_0x5d38b5,null));};exports[_0xa97c('0x71')]=function(_0x1b2147,_0x14f5fc,_0x437539){var _0x20dae7={'raw':![],'where':{}};var _0x1512d3={};var _0x4fe26e={'count':0x0,'rows':[]};return db[_0xa97c('0x40')][_0xa97c('0x6c')]({'where':{'id':_0x1b2147[_0xa97c('0x5d')]['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x14f5fc,null))[_0xa97c('0x25')](function(_0xd74a16){if(_0xd74a16){_0x1512d3[_0xa97c('0x4a')]=_[_0xa97c('0x47')](db[_0xa97c('0x70')][_0xa97c('0x41')]);_0x1512d3[_0xa97c('0x46')]=_['keys'](_0x1b2147[_0xa97c('0x46')]);_0x1512d3['filters']=_['intersection'](_0x1512d3[_0xa97c('0x4a')],_0x1512d3[_0xa97c('0x46')]);_0x20dae7[_0xa97c('0x4b')]=_[_0xa97c('0x49')](_0x1512d3[_0xa97c('0x4a')],qs[_0xa97c('0x4c')](_0x1b2147[_0xa97c('0x46')][_0xa97c('0x4c')]));_0x20dae7['attributes']=_0x20dae7['attributes'][_0xa97c('0x5e')]?_0x20dae7[_0xa97c('0x4b')]:_0x1512d3['model'];if(!_0x1b2147[_0xa97c('0x46')]['hasOwnProperty']('nolimit')){_0x20dae7['limit']=qs[_0xa97c('0x31')](_0x1b2147[_0xa97c('0x46')][_0xa97c('0x31')]);_0x20dae7[_0xa97c('0x30')]=qs[_0xa97c('0x30')](_0x1b2147[_0xa97c('0x46')]['offset']);}_0x20dae7[_0xa97c('0x4f')]=qs[_0xa97c('0x50')](_0x1b2147['query'][_0xa97c('0x50')]);_0x20dae7[_0xa97c('0x51')]=qs[_0xa97c('0x48')](_['pick'](_0x1b2147['query'],_0x1512d3[_0xa97c('0x48')]));_0x20dae7[_0xa97c('0x51')][_0xa97c('0x6a')]=_0xd74a16['id'];if(_0x1b2147[_0xa97c('0x46')]['filter']){_0x20dae7[_0xa97c('0x51')]=_['merge'](_0x20dae7['where'],{'$or':_['map'](_0x20dae7['attributes'],function(_0x3776e8){var _0x48a708={};_0x48a708[_0x3776e8]={'$like':'%'+_0x1b2147['query'][_0xa97c('0x54')]+'%'};return _0x48a708;})});}_0x20dae7=_['merge']({},_0x20dae7,_0x1b2147['options']);return db['CannedAnswer'][_0xa97c('0x57')]({'where':_0x20dae7['where']})[_0xa97c('0x25')](function(_0x45c2fd){_0x4fe26e[_0xa97c('0x57')]=_0x45c2fd;if(_0x1b2147['query']['includeAll']){_0x20dae7['include']=[{'all':!![]}];}return db[_0xa97c('0x70')]['findAll'](_0x20dae7);})['then'](function(_0x551c79){_0x4fe26e[_0xa97c('0x5b')]=_0x551c79;return _0x4fe26e;});}})[_0xa97c('0x25')](respondWithFilteredResult(_0x14f5fc,_0x20dae7))[_0xa97c('0x5c')](handleError(_0x14f5fc,null));};exports[_0xa97c('0x72')]=function(_0x4180a4,_0x450ec4,_0x3e7210){return db[_0xa97c('0x40')][_0xa97c('0x67')]({'where':{'id':_0x4180a4[_0xa97c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x450ec4,null))[_0xa97c('0x25')](function(_0x303677){if(_0x303677){return _0x303677['removeAnswers'](_0x4180a4[_0xa97c('0x46')]['ids']);}})[_0xa97c('0x25')](respondWithStatusCode(_0x450ec4,null))[_0xa97c('0x5c')](handleError(_0x450ec4,null));};exports[_0xa97c('0x73')]=function(_0x371748,_0x3a7643,_0x3283ae){return db['FaxInteraction'][_0xa97c('0x67')]({'where':{'id':_0x371748[_0xa97c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3a7643,null))['then'](function(_0x4fabe2){if(_0x4fabe2){return _0x4fabe2[_0xa97c('0x73')](_0x371748['body']['ids'],_[_0xa97c('0x74')](_0x371748[_0xa97c('0x60')],[_0xa97c('0x75'),'id'])||{});}})[_0xa97c('0x25')](respondWithResult(_0x3a7643,null))[_0xa97c('0x5c')](handleError(_0x3a7643,null));};exports[_0xa97c('0x76')]=function(_0x389cbe,_0x254572,_0x581902){var _0x5a0ae9={'raw':![],'where':{}};var _0x1f415b={};var _0x57963f={'count':0x0,'rows':[]};return db[_0xa97c('0x40')][_0xa97c('0x6c')]({'where':{'id':_0x389cbe['params']['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x254572,null))[_0xa97c('0x25')](function(_0x4abb2d){if(_0x4abb2d){_0x1f415b['model']=_[_0xa97c('0x47')](db[_0xa97c('0x77')][_0xa97c('0x41')]);_0x1f415b[_0xa97c('0x46')]=_['keys'](_0x389cbe[_0xa97c('0x46')]);_0x1f415b[_0xa97c('0x48')]=_['intersection'](_0x1f415b[_0xa97c('0x4a')],_0x1f415b[_0xa97c('0x46')]);_0x5a0ae9['attributes']=_['intersection'](_0x1f415b['model'],qs['fields'](_0x389cbe['query'][_0xa97c('0x4c')]));_0x5a0ae9[_0xa97c('0x4b')]=_0x5a0ae9[_0xa97c('0x4b')][_0xa97c('0x5e')]?_0x5a0ae9[_0xa97c('0x4b')]:_0x1f415b[_0xa97c('0x4a')];if(!_0x389cbe[_0xa97c('0x46')][_0xa97c('0x4d')](_0xa97c('0x4e'))){_0x5a0ae9[_0xa97c('0x31')]=qs[_0xa97c('0x31')](_0x389cbe[_0xa97c('0x46')][_0xa97c('0x31')]);_0x5a0ae9[_0xa97c('0x30')]=qs['offset'](_0x389cbe[_0xa97c('0x46')]['offset']);}_0x5a0ae9['order']=qs[_0xa97c('0x50')](_0x389cbe[_0xa97c('0x46')][_0xa97c('0x50')]);_0x5a0ae9[_0xa97c('0x51')]=qs[_0xa97c('0x48')](_[_0xa97c('0x52')](_0x389cbe[_0xa97c('0x46')],_0x1f415b[_0xa97c('0x48')]));_0x5a0ae9[_0xa97c('0x51')][_0xa97c('0x6a')]=_0x4abb2d['id'];if(_0x389cbe['query'][_0xa97c('0x54')]){_0x5a0ae9['where']=_['merge'](_0x5a0ae9[_0xa97c('0x51')],{'$or':_[_0xa97c('0x45')](_0x5a0ae9[_0xa97c('0x4b')],function(_0x41882d){var _0x32c963={};_0x32c963[_0x41882d]={'$like':'%'+_0x389cbe[_0xa97c('0x46')][_0xa97c('0x54')]+'%'};return _0x32c963;})});}_0x5a0ae9=_[_0xa97c('0x55')]({},_0x5a0ae9,_0x389cbe[_0xa97c('0x56')]);return db['FaxInteraction'][_0xa97c('0x57')]({'where':_0x5a0ae9[_0xa97c('0x51')]})[_0xa97c('0x25')](function(_0x38633d){_0x57963f[_0xa97c('0x57')]=_0x38633d;if(_0x389cbe[_0xa97c('0x46')]['includeAll']){_0x5a0ae9[_0xa97c('0x59')]=[{'model':db[_0xa97c('0x78')],'as':_0xa97c('0x79'),'required':![]},{'model':db[_0xa97c('0x7a')],'as':_0xa97c('0x7b'),'attributes':[_0xa97c('0x3b'),'fullname','internal'],'required':![]},{'model':db[_0xa97c('0x7c')],'as':_0xa97c('0x7d'),'attributes':['id',_0xa97c('0x3b'),_0xa97c('0x7e')],'where':_0x389cbe[_0xa97c('0x46')][_0xa97c('0x7f')]?{'id':_0x389cbe[_0xa97c('0x46')]['tag']}:undefined,'required':_0x389cbe[_0xa97c('0x46')][_0xa97c('0x7f')]?!![]:![]}];}return db[_0xa97c('0x77')][_0xa97c('0x5a')](_0x5a0ae9);})[_0xa97c('0x25')](function(_0x38a0dc){_0x57963f[_0xa97c('0x5b')]=_0x38a0dc;return _0x57963f;});}})[_0xa97c('0x25')](respondWithFilteredResult(_0x254572,_0x5a0ae9))[_0xa97c('0x5c')](handleError(_0x254572,null));};exports[_0xa97c('0x80')]=function(_0x481fc7,_0x5cc743,_0x2562dd){return db[_0xa97c('0x40')][_0xa97c('0x6c')]({'where':{'id':_0x481fc7[_0xa97c('0x5d')]['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x5cc743,null))[_0xa97c('0x25')](function(_0x4dadef){if(_0x4dadef){return db[_0xa97c('0x81')][_0xa97c('0x82')](function(_0x2529b9){return db[_0xa97c('0x83')][_0xa97c('0x37')]({'where':{'FaxAccountId':_0x481fc7[_0xa97c('0x5d')]['id']},'transaction':_0x2529b9})[_0xa97c('0x25')](function(_0x409b2e){var _0x2a2639=_[_0xa97c('0x45')](_0x481fc7['body'],function(_0x2eb4e5){_0x2eb4e5['FaxAccountId']=_0x481fc7[_0xa97c('0x5d')]['id'];return _0x2eb4e5;});return db['FaxApplication'][_0xa97c('0x84')](_0x2a2639,{'transaction':_0x2529b9});});})[_0xa97c('0x25')](function(){return db[_0xa97c('0x83')][_0xa97c('0x85')]({'where':{'FaxAccountId':_0x481fc7['params']['id']},'order':_0xa97c('0x86')});});}})['then'](respondWithResult(_0x5cc743,null))[_0xa97c('0x5c')](handleError(_0x5cc743,null));};exports['getApplications']=function(_0x29e158,_0x4373bb,_0x2315b3){var _0x398917={};var _0x336ac7={};var _0x9fa7ab;var _0xbbac3c;return db[_0xa97c('0x40')][_0xa97c('0x6c')]({'where':{'id':_0x29e158[_0xa97c('0x5d')]['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x4373bb,null))[_0xa97c('0x25')](function(_0x3ae4c7){if(_0x3ae4c7){_0x9fa7ab=_0x3ae4c7;_0x336ac7[_0xa97c('0x4a')]=_[_0xa97c('0x47')](db[_0xa97c('0x83')][_0xa97c('0x41')]);_0x336ac7[_0xa97c('0x46')]=_[_0xa97c('0x47')](_0x29e158[_0xa97c('0x46')]);_0x336ac7['filters']=_[_0xa97c('0x49')](_0x336ac7['model'],_0x336ac7['query']);_0x398917['attributes']=_['intersection'](_0x336ac7[_0xa97c('0x4a')],qs[_0xa97c('0x4c')](_0x29e158[_0xa97c('0x46')]['fields']));_0x398917[_0xa97c('0x4b')]=_0x398917[_0xa97c('0x4b')]['length']?_0x398917[_0xa97c('0x4b')]:_0x336ac7['model'];_0x398917[_0xa97c('0x4f')]=qs[_0xa97c('0x50')](_0x29e158[_0xa97c('0x46')][_0xa97c('0x50')]);_0x398917[_0xa97c('0x51')]=qs[_0xa97c('0x48')](_[_0xa97c('0x52')](_0x29e158[_0xa97c('0x46')],_0x336ac7['filters']));if(_0x29e158[_0xa97c('0x46')]['filter']){_0x398917['where']=_[_0xa97c('0x55')](_0x398917[_0xa97c('0x51')],{'$or':_['map'](_0x398917[_0xa97c('0x4b')],function(_0x9625e){var _0x147545={};_0x147545[_0x9625e]={'$like':'%'+_0x29e158['query'][_0xa97c('0x54')]+'%'};return _0x147545;})});}_0x398917=_[_0xa97c('0x55')]({},_0x398917,_0x29e158['options']);return _0x9fa7ab[_0xa97c('0x87')](_0x398917);}})[_0xa97c('0x25')](function(_0x65d44b){if(_0x65d44b){_0xbbac3c=_0x65d44b[_0xa97c('0x5e')];if(!_0x29e158['query'][_0xa97c('0x4d')](_0xa97c('0x4e'))){_0x398917[_0xa97c('0x31')]=qs[_0xa97c('0x31')](_0x29e158[_0xa97c('0x46')]['limit']);_0x398917[_0xa97c('0x30')]=qs[_0xa97c('0x30')](_0x29e158['query'][_0xa97c('0x30')]);}return _0x9fa7ab[_0xa97c('0x87')](_0x398917);}})['then'](function(_0x130b92){if(_0x130b92){return _0x130b92?{'count':_0xbbac3c,'rows':_0x130b92}:null;}})[_0xa97c('0x25')](respondWithResult(_0x4373bb,null))[_0xa97c('0x5c')](handleError(_0x4373bb,null));};function Extension(_0x402293,_0xaadf5e,_0x453c24,_0x270405){this[_0xa97c('0x88')]=_0xa97c('0x89');this[_0xa97c('0x8a')]=_0x402293[_0xa97c('0x8b')];this['app']=_0x270405;this['type']='system';this[_0xa97c('0x8c')]=_0xa97c('0x8d');this['FaxAccountId']=_0x402293['id'];this[_0xa97c('0x86')]=_0xaadf5e;this[_0xa97c('0x8e')]=_0x453c24;}function createExtensionsReciveFax(_0x5e5eea){var _0x3e7507=0x1;var _0x467761=[];_0x467761[_0xa97c('0x8f')](new Extension(_0x5e5eea,_0x3e7507,'','Answer'));_0x3e7507+=0x1;_0x467761[_0xa97c('0x8f')](new Extension(_0x5e5eea,_0x3e7507,_0xa97c('0x90'),_0xa97c('0x91')));_0x3e7507+=0x1;for(var _0x2cb119 in _0x5e5eea){if(_0x5e5eea[_0xa97c('0x4d')](_0x2cb119)&&(_0x2cb119===_0xa97c('0x92')||_0x2cb119===_0xa97c('0x8b')||_0x2cb119==='gateway'||_0x2cb119==='faxdetect'||_0x2cb119===_0xa97c('0x93')||_0x2cb119===_0xa97c('0x94')||_0x2cb119===_0xa97c('0x95')||_0x2cb119===_0xa97c('0x96')||_0x2cb119===_0xa97c('0x97'))){_0x467761[_0xa97c('0x8f')](new Extension(_0x5e5eea,_0x3e7507,_0xa97c('0x98')+_0x2cb119+')='+_0x5e5eea[_0x2cb119],_0xa97c('0x91')));_0x3e7507+=0x1;}}_0x467761[_0xa97c('0x8f')](new Extension(_0x5e5eea,_0x3e7507,'6',_0xa97c('0x99')));_0x3e7507+=0x1;_0x467761[_0xa97c('0x8f')](new Extension(_0x5e5eea,_0x3e7507,_0xa97c('0x9a'),'ReceiveFax'));_0x3e7507=0x0;return _0x467761;}exports[_0xa97c('0x9b')]=function(_0x4bec46,_0x311dad,_0x350b90){var _0x40e922;return db[_0xa97c('0x81')][_0xa97c('0x82')](function(_0x1d9fc9){return db[_0xa97c('0x40')][_0xa97c('0x5f')](_0x4bec46[_0xa97c('0x60')],{'transaction':_0x1d9fc9})[_0xa97c('0x25')](function(_0x19b304){_0x40e922=_0x19b304[_0xa97c('0x38')]({'plain':!![]});return db['VoiceExtension'][_0xa97c('0x84')](createExtensionsReciveFax(_0x40e922),{'transaction':_0x1d9fc9});});})[_0xa97c('0x25')](function(){return _0x40e922;})['then'](respondWithResult(_0x311dad,null))[_0xa97c('0x5c')](handleError(_0x311dad,null));};exports['updateAccountApplications']=function(_0x5bdba4,_0x1ef77f,_0x2ac211){var _0x1e535e;return db[_0xa97c('0x81')]['transaction'](function(_0x2ac559){return db[_0xa97c('0x40')][_0xa97c('0x36')](_0x5bdba4['body'],{'where':{'id':_0x5bdba4['body']['id']},'transaction':_0x2ac559})['then'](function(_0x50ff23){return db[_0xa97c('0x9c')]['destroy']({'where':{'FaxAccountId':_0x5bdba4[_0xa97c('0x60')]['id']},'transaction':_0x2ac559})[_0xa97c('0x25')](function(_0xcfcad1){return db[_0xa97c('0x9c')]['bulkCreate'](createExtensionsReciveFax(_[_0xa97c('0x74')](_0x5bdba4['body'],[_0xa97c('0x9d'),'key','createdAt','updatedAt',_0xa97c('0x9e'),'ListId'])),{'transaction':_0x2ac559});});});})[_0xa97c('0x25')](function(){return db[_0xa97c('0x40')][_0xa97c('0x9f')](_0x5bdba4[_0xa97c('0x60')]['id']);})[_0xa97c('0x25')](respondWithResult(_0x1ef77f,null))['catch'](handleError(_0x1ef77f,null));};exports['getMessages']=function(_0x28063c,_0x56fef5,_0x327aeb){var _0x5c9601={'raw':!![],'where':{}};var _0x1452ec={};var _0x4228e6={'count':0x0,'rows':[]};return db[_0xa97c('0x40')][_0xa97c('0x6c')]({'where':{'id':_0x28063c[_0xa97c('0x5d')]['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x56fef5,null))[_0xa97c('0x25')](function(_0x33581a){if(_0x33581a){_0x1452ec[_0xa97c('0x4a')]=_[_0xa97c('0x47')](db[_0xa97c('0xa0')][_0xa97c('0x41')]);_0x1452ec['query']=_[_0xa97c('0x47')](_0x28063c[_0xa97c('0x46')]);_0x1452ec[_0xa97c('0x48')]=_[_0xa97c('0x49')](_0x1452ec[_0xa97c('0x4a')],_0x1452ec[_0xa97c('0x46')]);_0x5c9601[_0xa97c('0x4b')]=_[_0xa97c('0x49')](_0x1452ec[_0xa97c('0x4a')],qs['fields'](_0x28063c[_0xa97c('0x46')][_0xa97c('0x4c')]));_0x5c9601[_0xa97c('0x4b')]=_0x5c9601[_0xa97c('0x4b')][_0xa97c('0x5e')]?_0x5c9601[_0xa97c('0x4b')]:_0x1452ec[_0xa97c('0x4a')];if(!_0x28063c[_0xa97c('0x46')][_0xa97c('0x4d')](_0xa97c('0x4e'))){_0x5c9601[_0xa97c('0x31')]=qs[_0xa97c('0x31')](_0x28063c[_0xa97c('0x46')][_0xa97c('0x31')]);_0x5c9601[_0xa97c('0x30')]=qs[_0xa97c('0x30')](_0x28063c[_0xa97c('0x46')]['offset']);}_0x5c9601['order']=qs[_0xa97c('0x50')](_0x28063c[_0xa97c('0x46')][_0xa97c('0x50')]);_0x5c9601[_0xa97c('0x51')]=qs[_0xa97c('0x48')](_['pick'](_0x28063c['query'],_0x1452ec[_0xa97c('0x48')]));_0x5c9601[_0xa97c('0x51')][_0xa97c('0x6a')]=_0x33581a['id'];if(_0x28063c[_0xa97c('0x46')][_0xa97c('0x54')]){_0x5c9601[_0xa97c('0x51')]=_[_0xa97c('0x55')](_0x5c9601['where'],{'$or':_['map'](_0x5c9601[_0xa97c('0x4b')],function(_0x4f4c13){var _0xebbd25={};_0xebbd25[_0x4f4c13]={'$like':'%'+_0x28063c[_0xa97c('0x46')]['filter']+'%'};return _0xebbd25;})});}if(_0x28063c['query'][_0xa97c('0xa1')]){var _0x26373b=_0x28063c[_0xa97c('0x46')][_0xa97c('0xa1')][_0xa97c('0xa2')](',');var _0x43ece3={};_0x43ece3[_0x26373b[0x0]]={'$gte':moment(_0x26373b[0x1])[_0xa97c('0xa3')](_0xa97c('0xa4'))};_0x5c9601[_0xa97c('0x51')]=_[_0xa97c('0x55')](_0x5c9601[_0xa97c('0x51')],_0x43ece3);}_0x5c9601=_['merge']({},_0x5c9601,_0x28063c[_0xa97c('0x56')]);return db[_0xa97c('0xa0')]['count']({'where':_0x5c9601['where']})[_0xa97c('0x25')](function(_0x1c6e8f){_0x4228e6['count']=_0x1c6e8f;if(_0x28063c[_0xa97c('0x46')][_0xa97c('0x58')]){_0x5c9601[_0xa97c('0x59')]=[{'all':!![]}];}return db[_0xa97c('0xa0')][_0xa97c('0x5a')](_0x5c9601);})[_0xa97c('0x25')](function(_0x31c16d){_0x4228e6['rows']=_0x31c16d;return _0x4228e6;});}})[_0xa97c('0x25')](respondWithFilteredResult(_0x56fef5,_0x5c9601))['catch'](handleError(_0x56fef5,null));};exports['send']=function(_0x1890ed,_0x1ba4ea,_0x4486ef){var _0x5e6050,_0x16cfd6={},_0x3b4424;if(_0x1890ed['body']['to']){_0x3b4424=_0x1890ed[_0xa97c('0x60')]['to'][0x0];}return db[_0xa97c('0x40')][_0xa97c('0x67')]({'where':{'id':_0x1890ed[_0xa97c('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0xa97c('0xa5'),'include':[{'model':db[_0xa97c('0x78')],'as':_0xa97c('0xa6'),'where':{'fax':_0x3b4424},'limit':0x1,'order':[[_0xa97c('0xa7'),_0xa97c('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x1ba4ea,null))[_0xa97c('0x25')](function(_0x192de5){_0x5e6050=_0x192de5;if(_0x1890ed[_0xa97c('0x60')]['attachments']&&_0x1890ed['body'][_0xa97c('0xa9')][_0xa97c('0x5e')]){for(var _0x4b3890=0x0;_0x4b3890<_0x1890ed[_0xa97c('0x60')]['attachments']['length'];_0x4b3890+=0x1){_0x1890ed['body'][_0xa97c('0xa9')][_0x4b3890]={'filename':_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][_0x4b3890][_0xa97c('0x3b')],'id':_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][_0x4b3890]['id'],'path':path['join'](config[_0xa97c('0xaa')],_0xa97c('0xab'),_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][_0x4b3890][_0xa97c('0xac')])};}}return respondWithRpcPromise(_0xa97c('0xad'),_0xa97c('0xad'),{'FaxAccountId':_[_0xa97c('0xae')](_0x1890ed[_0xa97c('0x5d')]['id'])?undefined:_0x1890ed['params']['id'],'path':_['isNil'](_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][0x0][_0xa97c('0x8')])?undefined:_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][0x0][_0xa97c('0x8')],'fax':_[_0xa97c('0xae')](_0x1890ed[_0xa97c('0x60')]['to'][0x0])?undefined:_0x1890ed[_0xa97c('0x60')]['to'][0x0]},client9002);})[_0xa97c('0x25')](function(){if(_0x5e6050){if(_['isNil'](_0x1890ed[_0xa97c('0x60')][_0xa97c('0xaf')])){_0x1890ed[_0xa97c('0x60')][_0xa97c('0xaf')]=util[_0xa97c('0xa3')](_0xa97c('0xb0'),_0x5e6050['name'],_0x5e6050[_0xa97c('0xb1')]);}if(_0x5e6050[_0xa97c('0xa5')]){if(_0x5e6050['List'][_0xa97c('0xa6')][_0xa97c('0x5e')]){return _0x5e6050[_0xa97c('0xa5')][_0xa97c('0xa6')][0x0];}else{return db[_0xa97c('0x78')][_0xa97c('0x5f')](_[_0xa97c('0x1a')](_0x1890ed[_0xa97c('0x60')],{'firstName':_0x1890ed['body']['to'][0x0],'phone':_0x1890ed['body']['to'][0x0],'fax':_0x1890ed[_0xa97c('0x60')]['to'][0x0],'ListId':_0x5e6050[_0xa97c('0xb2')]}));}}else{throw new Error(_0xa97c('0xb3'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xa97c('0x25')](function(_0x5c72f0){if(_0x5c72f0){return db[_0xa97c('0x77')]['find']({'where':{'ContactId':_0x5c72f0['id'],'closed':![],'FaxAccountId':_0x5e6050['id']}})[_0xa97c('0x25')](function(_0x513260){if(_0x513260){return[_0x513260,![]];}return db[_0xa97c('0x77')][_0xa97c('0x5f')]({'UserId':_0x1890ed[_0xa97c('0x61')]['id'],'ContactId':_0x5c72f0['id'],'FaxAccountId':_0x5e6050['id'],'fax':_0x1890ed['body']['to'][0x0],'firstMsgDirection':_0xa97c('0xb4'),'Messages':[_[_0xa97c('0x55')](_0x1890ed[_0xa97c('0x60')],{'read':![],'body':_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][0x0]['filename'],'FaxAccountId':_0x5e6050['id'],'UserId':_0x1890ed[_0xa97c('0x61')]['id'],'ContactId':_0x5c72f0['id'],'AttachmentId':_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xa97c('0xa0')],'as':_0xa97c('0xb5')}]})['then'](function(_0x18f8ca){return[_0x18f8ca,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa97c('0xb6')](function(_0x504a10,_0x35de07){if(_0x35de07){return _0x504a10;}return db['FaxMessage'][_0xa97c('0x5f')]({'direction':'out','read':![],'body':_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][0x0][_0xa97c('0xb7')],'FaxAccountId':_0x5e6050['id'],'FaxInteractionId':_0x504a10['id'],'UserId':_0x1890ed['user']['id'],'ContactId':_0x504a10[_0xa97c('0xb8')],'AttachmentId':_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][0x0]['id']})[_0xa97c('0x25')](function(_0x348d94){_0x504a10[_0xa97c('0xb9')][_0xa97c('0xb5')]=[];_0x504a10[_0xa97c('0xb9')][_0xa97c('0xb5')][_0xa97c('0x8f')](_0x348d94[_0xa97c('0xb9')]);return _0x504a10;});})[_0xa97c('0x25')](function(_0xa0ee99){respondWithRpcPromise('SendFax',_0xa97c('0xba'),{'FaxAccountId':_[_0xa97c('0xae')](_0x1890ed[_0xa97c('0x5d')]['id'])?undefined:_0x1890ed[_0xa97c('0x5d')]['id'],'path':_[_0xa97c('0xae')](_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][0x0][_0xa97c('0x8')])?undefined:_0x1890ed[_0xa97c('0x60')]['attachments'][0x0][_0xa97c('0x8')],'fax':_[_0xa97c('0xae')](_0x1890ed[_0xa97c('0x60')]['to'][0x0])?undefined:_0x1890ed[_0xa97c('0x60')]['to'][0x0],'AttachmentId':_0x1890ed[_0xa97c('0x60')][_0xa97c('0xa9')][0x0]['id']},client9002)[_0xa97c('0x25')](function(_0xfffb93){logger[_0xa97c('0x26')]('SendFaxRpc,\x20%s',_0xfffb93);})['catch'](function(_0x5155c5){logger[_0xa97c('0x26')](_0xa97c('0xbb'),_0x5155c5);});return _0xa0ee99;})[_0xa97c('0x25')](respondWithResult(_0x1ba4ea,null))[_0xa97c('0x5c')](handleError(_0x1ba4ea,null));};exports[_0xa97c('0xbc')]=function(_0x13a091,_0x121877,_0x6e994e){return db[_0xa97c('0x40')][_0xa97c('0x67')]({'where':{'id':_0x13a091['params']['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x121877,null))['then'](function(_0x1c0cb0){if(_0x1c0cb0){return _0x1c0cb0[_0xa97c('0xbc')](_0x13a091[_0xa97c('0x60')][_0xa97c('0x75')],_[_0xa97c('0x74')](_0x13a091[_0xa97c('0x60')],['ids','id'])||{})[_0xa97c('0xb6')](function(_0xf2e16b){for(var _0x1f1999=0x0;_0x1f1999<_0x13a091['body'][_0xa97c('0x75')][_0xa97c('0x5e')];_0x1f1999+=0x1){socket['emit'](_0xa97c('0xbd'),{'UserId':_0x13a091[_0xa97c('0x60')][_0xa97c('0x75')][_0x1f1999],'FaxAccountId':_0x13a091['params']['id']});}return _0xf2e16b;});}})[_0xa97c('0x25')](respondWithResult(_0x121877,null))[_0xa97c('0x5c')](handleError(_0x121877,null));};exports[_0xa97c('0xbe')]=function(_0x351de9,_0x3bee44,_0x1238a1){return db[_0xa97c('0x40')]['find']({'where':{'id':_0x351de9[_0xa97c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3bee44,null))[_0xa97c('0x25')](function(_0x5d33d8){if(_0x5d33d8){return _0x5d33d8[_0xa97c('0xbe')](_0x351de9['query'][_0xa97c('0x75')])[_0xa97c('0x25')](function(){if(_[_0xa97c('0xbf')](_0x351de9[_0xa97c('0x46')]['ids'])){for(var _0x5c2076=0x0;_0x5c2076<_0x351de9[_0xa97c('0x46')][_0xa97c('0x75')][_0xa97c('0x5e')];_0x5c2076+=0x1){socket['emit'](_0xa97c('0xc0'),{'UserId':Number(_0x351de9[_0xa97c('0x46')]['ids'][_0x5c2076]),'FaxAccountId':Number(_0x351de9[_0xa97c('0x5d')]['id'])});}}else{socket[_0xa97c('0xc1')](_0xa97c('0xc0'),{'UserId':Number(_0x351de9[_0xa97c('0x46')][_0xa97c('0x75')]),'FaxAccountId':Number(_0x351de9[_0xa97c('0x5d')]['id'])});}});}})[_0xa97c('0x25')](respondWithStatusCode(_0x3bee44,null))[_0xa97c('0x5c')](handleError(_0x3bee44,null));};exports[_0xa97c('0xc2')]=function(_0xab84f,_0x107fa8,_0x1fab85){var _0x5227dc={};var _0x1f698e={};var _0x38a414;var _0x21161b;return db[_0xa97c('0x40')]['findOne']({'where':{'id':_0xab84f[_0xa97c('0x5d')]['id']}})[_0xa97c('0x25')](handleEntityNotFound(_0x107fa8,null))[_0xa97c('0x25')](function(_0x21cc34){if(_0x21cc34){_0x38a414=_0x21cc34;_0x1f698e[_0xa97c('0x4a')]=_[_0xa97c('0x47')](db[_0xa97c('0x7a')][_0xa97c('0x41')]);_0x1f698e[_0xa97c('0x46')]=_[_0xa97c('0x47')](_0xab84f['query']);_0x1f698e[_0xa97c('0x48')]=_[_0xa97c('0x49')](_0x1f698e[_0xa97c('0x4a')],_0x1f698e['query']);_0x5227dc[_0xa97c('0x4b')]=_[_0xa97c('0x49')](_0x1f698e[_0xa97c('0x4a')],qs['fields'](_0xab84f[_0xa97c('0x46')]['fields']));_0x5227dc[_0xa97c('0x4b')]=_0x5227dc[_0xa97c('0x4b')]['length']?_0x5227dc[_0xa97c('0x4b')]:_0x1f698e[_0xa97c('0x4a')];_0x5227dc['order']=qs[_0xa97c('0x50')](_0xab84f[_0xa97c('0x46')][_0xa97c('0x50')]);_0x5227dc[_0xa97c('0x51')]=qs['filters'](_['pick'](_0xab84f['query'],_0x1f698e[_0xa97c('0x48')]));if(_0xab84f[_0xa97c('0x46')]['filter']){_0x5227dc['where']=_[_0xa97c('0x55')](_0x5227dc[_0xa97c('0x51')],{'$or':_['map'](_0x5227dc[_0xa97c('0x4b')],function(_0x395f60){var _0x2803f5={};_0x2803f5[_0x395f60]={'$like':'%'+_0xab84f[_0xa97c('0x46')][_0xa97c('0x54')]+'%'};return _0x2803f5;})});}_0x5227dc=_[_0xa97c('0x55')]({},_0x5227dc,_0xab84f[_0xa97c('0x56')]);return _0x38a414['getAgents'](_0x5227dc);}})[_0xa97c('0x25')](function(_0x23cf09){if(_0x23cf09){_0x21161b=_0x23cf09[_0xa97c('0x5e')];if(!_0xab84f[_0xa97c('0x46')][_0xa97c('0x4d')]('nolimit')){_0x5227dc[_0xa97c('0x31')]=qs[_0xa97c('0x31')](_0xab84f[_0xa97c('0x46')][_0xa97c('0x31')]);_0x5227dc[_0xa97c('0x30')]=qs[_0xa97c('0x30')](_0xab84f[_0xa97c('0x46')][_0xa97c('0x30')]);}return _0x38a414['getAgents'](_0x5227dc);}})['then'](function(_0x36fc80){if(_0x36fc80){return _0x36fc80?{'count':_0x21161b,'rows':_0x36fc80}:null;}})['then'](respondWithResult(_0x107fa8,null))[_0xa97c('0x5c')](handleError(_0x107fa8,null));}; \ No newline at end of file +var _0x1dca=['maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','omit','createdAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','userFaxAccount:remove','emit','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','save','then','destroy','get','FaxAccounts','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','rows','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','options','findAll','removeDispositions','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','hasOwnProperty','getApplications','context','from-voip-provider','localstationid','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect'];(function(_0x267eba,_0x24353e){var _0x464b25=function(_0x435e4f){while(--_0x435e4f){_0x267eba['push'](_0x267eba['shift']());}};_0x464b25(++_0x24353e);}(_0x1dca,0xea));var _0xa1dc=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x1dca[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0xa1dc('0x0'));var emlformat=require(_0xa1dc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa1dc('0x2'));var rp=require(_0xa1dc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1dc('0x4'));var util=require('util');var path=require(_0xa1dc('0x5'));var sox=require(_0xa1dc('0x6'));var csv=require(_0xa1dc('0x7'));var ejs=require(_0xa1dc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa1dc('0x9'));var jsforce=require(_0xa1dc('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa1dc('0x7'));var querystring=require(_0xa1dc('0xb'));var Papa=require(_0xa1dc('0xc'));var Redis=require(_0xa1dc('0xd'));var authService=require(_0xa1dc('0xe'));var qs=require(_0xa1dc('0xf'));var as=require(_0xa1dc('0x10'));var hardwareService=require(_0xa1dc('0x11'));var logger=require(_0xa1dc('0x12'))(_0xa1dc('0x13'));var utils=require(_0xa1dc('0x14'));var config=require('../../config/environment');var db=require(_0xa1dc('0x15'))['db'];config[_0xa1dc('0x16')]=_['defaults'](config[_0xa1dc('0x16')],{'host':_0xa1dc('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1dc('0x16')]));require(_0xa1dc('0x18'))[_0xa1dc('0x19')](socket);var jayson=require(_0xa1dc('0x1a'));var client=jayson[_0xa1dc('0x1b')][_0xa1dc('0x1c')]({'port':0x232c});var client9002=jayson[_0xa1dc('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x4d4dfb,_0x5c44f3,_0x1703e5){if(_0x1703e5){var _0x28281e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28281e['test'](_0x5c44f3)){return _0x4d4dfb;}else{throw new db[(_0xa1dc('0x1d'))][(_0xa1dc('0x1e'))](_0xa1dc('0x1f'));}}else{return _0x4d4dfb;}}function respondWithRpcPromise(_0x132f51,_0xd5982f,_0x334fe4,_0x5a8bab){return new BPromise(function(_0x21a9af,_0x2f3130){var _0x15fd7e=_0x5a8bab||client;return _0x15fd7e[_0xa1dc('0x20')](_0x132f51,_0x334fe4)['then'](function(_0x408034){logger[_0xa1dc('0x21')]('FaxAccount,\x20%s,\x20%s',_0xd5982f,'request\x20sent');logger[_0xa1dc('0x22')](_0xa1dc('0x23'),_0xd5982f,'request\x20sent',JSON[_0xa1dc('0x24')](_0x408034));if(_0x408034[_0xa1dc('0x25')]){if(_0x408034['error']['code']===0x1f4){logger['error'](_0xa1dc('0x26'),_0xd5982f,_0x408034[_0xa1dc('0x25')]['message']);return _0x2f3130(_0x408034[_0xa1dc('0x25')][_0xa1dc('0x27')]);}logger[_0xa1dc('0x25')]('FaxAccount,\x20%s,\x20%s',_0xd5982f,_0x408034[_0xa1dc('0x25')]['message']);return _0x21a9af(_0x408034['error']['message']);}else{logger[_0xa1dc('0x21')](_0xa1dc('0x26'),_0xd5982f,_0xa1dc('0x28'));_0x21a9af(_0x408034[_0xa1dc('0x29')][_0xa1dc('0x27')]);}})[_0xa1dc('0x2a')](function(_0x287fe1){logger['error'](_0xa1dc('0x26'),_0xd5982f,_0x287fe1);_0x2f3130(_0x287fe1);});});}function respondWithStatusCode(_0x229c50,_0x266327){_0x266327=_0x266327||0xcc;return function(_0x103d57){if(_0x103d57){return _0x229c50[_0xa1dc('0x2b')](_0x266327);}return _0x229c50[_0xa1dc('0x2c')](_0x266327)[_0xa1dc('0x2d')]();};}function respondWithResult(_0x5a15e7,_0x5130c6){_0x5130c6=_0x5130c6||0xc8;return function(_0x254c3e){if(_0x254c3e){return _0x5a15e7[_0xa1dc('0x2c')](_0x5130c6)[_0xa1dc('0x2e')](_0x254c3e);}};}function respondWithFilteredResult(_0x4503df,_0x515e8d){return function(_0x535550){if(_0x535550){var _0x3a49c6=_0x535550[_0xa1dc('0x2f')],_0x5af157=_0x515e8d['offset'],_0x49d392=_0x515e8d[_0xa1dc('0x30')]+_0x515e8d['limit'],_0x2ade29;if(_0x49d392>=_0x3a49c6){_0x49d392=_0x3a49c6;_0x2ade29=0xc8;}else{_0x2ade29=0xce;}_0x4503df[_0xa1dc('0x2c')](_0x2ade29);return _0x4503df['set'](_0xa1dc('0x31'),_0x5af157+'-'+_0x49d392+'/'+_0x3a49c6)['json'](_0x535550);}return null;};}function patchUpdates(_0x4b8ed9){return function(_0x2321e6){try{jsonpatch[_0xa1dc('0x32')](_0x2321e6,_0x4b8ed9,!![]);}catch(_0x4e688c){return BPromise['reject'](_0x4e688c);}return _0x2321e6[_0xa1dc('0x33')]();};}function saveUpdates(_0x11232c,_0x5cf714){return function(_0x1d8aad){if(_0x1d8aad){return _0x1d8aad['update'](_0x11232c)[_0xa1dc('0x34')](function(_0x4421a3){return _0x4421a3;});}return null;};}function removeEntity(_0x45ae0d,_0x194702){return function(_0x1c6b02){if(_0x1c6b02){return _0x1c6b02[_0xa1dc('0x35')]()[_0xa1dc('0x34')](function(){var _0x441dfc=_0x1c6b02[_0xa1dc('0x36')]({'plain':!![]});var _0x30d47c=_0xa1dc('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x30d47c,'resourceId':_0x441dfc['id']}})[_0xa1dc('0x34')](function(){return _0x1c6b02;});})['then'](function(){_0x45ae0d[_0xa1dc('0x2c')](0xcc)[_0xa1dc('0x2d')]();});}};}function handleEntityNotFound(_0x57088a,_0x33a7c5){return function(_0x577921){if(!_0x577921){_0x57088a[_0xa1dc('0x2b')](0x194);}return _0x577921;};}function handleError(_0xf48ba1,_0x128b62){_0x128b62=_0x128b62||0x1f4;return function(_0x216835){logger['error'](_0x216835[_0xa1dc('0x38')]);if(_0x216835[_0xa1dc('0x39')]){delete _0x216835[_0xa1dc('0x39')];}_0xf48ba1['status'](_0x128b62)[_0xa1dc('0x3a')](_0x216835);};}exports['index']=function(_0x100758,_0x85029){var _0x20051c={'include':[{'model':db[_0xa1dc('0x3b')],'as':_0xa1dc('0x3c')}]},_0x167bc1={},_0xe7c0c3={'count':0x0,'rows':[]};var _0x4629bb=_[_0xa1dc('0x3d')](db[_0xa1dc('0x3e')]['rawAttributes'],function(_0x194530){return{'name':_0x194530[_0xa1dc('0x3f')],'type':_0x194530[_0xa1dc('0x40')][_0xa1dc('0x41')]};});_0x167bc1[_0xa1dc('0x42')]=_[_0xa1dc('0x3d')](_0x4629bb,_0xa1dc('0x39'));_0x167bc1[_0xa1dc('0x43')]=_[_0xa1dc('0x44')](_0x100758[_0xa1dc('0x43')]);_0x167bc1[_0xa1dc('0x45')]=_['intersection'](_0x167bc1[_0xa1dc('0x42')],_0x167bc1[_0xa1dc('0x43')]);_0x20051c[_0xa1dc('0x46')]=_[_0xa1dc('0x47')](_0x167bc1['model'],qs[_0xa1dc('0x48')](_0x100758['query']['fields']));_0x20051c[_0xa1dc('0x46')]=_0x20051c['attributes'][_0xa1dc('0x49')]?_0x20051c[_0xa1dc('0x46')]:_0x167bc1['model'];if(!_0x100758[_0xa1dc('0x43')]['hasOwnProperty'](_0xa1dc('0x4a'))){_0x20051c['limit']=qs[_0xa1dc('0x4b')](_0x100758[_0xa1dc('0x43')][_0xa1dc('0x4b')]);_0x20051c[_0xa1dc('0x30')]=qs[_0xa1dc('0x30')](_0x100758[_0xa1dc('0x43')][_0xa1dc('0x30')]);}_0x20051c[_0xa1dc('0x4c')]=qs[_0xa1dc('0x4d')](_0x100758[_0xa1dc('0x43')][_0xa1dc('0x4d')]);_0x20051c[_0xa1dc('0x4e')]=qs[_0xa1dc('0x45')](_['pick'](_0x100758['query'],_0x167bc1[_0xa1dc('0x45')]),_0x4629bb);if(_0x100758[_0xa1dc('0x43')][_0xa1dc('0x4f')]){_0x20051c['where']=_['merge'](_0x20051c[_0xa1dc('0x4e')],{'$or':_[_0xa1dc('0x3d')](_0x4629bb,function(_0x284fde){if(_0x284fde[_0xa1dc('0x40')]!==_0xa1dc('0x50')){var _0x5547fa={};_0x5547fa[_0x284fde[_0xa1dc('0x39')]]={'$like':'%'+_0x100758[_0xa1dc('0x43')][_0xa1dc('0x4f')]+'%'};return _0x5547fa;}})});}_0x20051c=_[_0xa1dc('0x51')]({},_0x20051c,_0x100758['options']);var _0xd3a85c={'where':_0x20051c[_0xa1dc('0x4e')]};return db[_0xa1dc('0x3e')][_0xa1dc('0x2f')](_0xd3a85c)[_0xa1dc('0x34')](function(_0x4a3b87){_0xe7c0c3['count']=_0x4a3b87;if(_0x100758['query'][_0xa1dc('0x52')]){_0x20051c[_0xa1dc('0x53')]=[{'all':!![]}];}return db[_0xa1dc('0x3e')]['findAll'](_0x20051c);})[_0xa1dc('0x34')](function(_0x58812a){_0xe7c0c3[_0xa1dc('0x54')]=_0x58812a;return _0xe7c0c3;})['then'](respondWithFilteredResult(_0x85029,_0x20051c))['catch'](handleError(_0x85029,null));};exports['show']=function(_0x5f00fd,_0xa78484){var _0x3c5bf8={'raw':![],'where':{'id':_0x5f00fd[_0xa1dc('0x55')]['id']},'include':[{'model':db[_0xa1dc('0x3b')],'as':_0xa1dc('0x3c')}]},_0x173d3b={};_0x173d3b[_0xa1dc('0x42')]=_['keys'](db[_0xa1dc('0x3e')][_0xa1dc('0x56')]);_0x173d3b[_0xa1dc('0x43')]=_[_0xa1dc('0x44')](_0x5f00fd['query']);_0x173d3b[_0xa1dc('0x45')]=_['intersection'](_0x173d3b['model'],_0x173d3b[_0xa1dc('0x43')]);_0x3c5bf8['attributes']=_['intersection'](_0x173d3b[_0xa1dc('0x42')],qs[_0xa1dc('0x48')](_0x5f00fd[_0xa1dc('0x43')][_0xa1dc('0x48')]));_0x3c5bf8['attributes']=_0x3c5bf8[_0xa1dc('0x46')][_0xa1dc('0x49')]?_0x3c5bf8[_0xa1dc('0x46')]:_0x173d3b['model'];if(_0x5f00fd['query'][_0xa1dc('0x52')]){_0x3c5bf8[_0xa1dc('0x53')]=[{'all':!![]}];}_0x3c5bf8=_[_0xa1dc('0x51')]({},_0x3c5bf8,_0x5f00fd['options']);return db[_0xa1dc('0x3e')][_0xa1dc('0x57')](_0x3c5bf8)[_0xa1dc('0x34')](handleEntityNotFound(_0xa78484,null))[_0xa1dc('0x34')](respondWithResult(_0xa78484,null))[_0xa1dc('0x2a')](handleError(_0xa78484,null));};exports[_0xa1dc('0x58')]=function(_0x3fe50b,_0x39e108){return db[_0xa1dc('0x3e')][_0xa1dc('0x58')](_0x3fe50b[_0xa1dc('0x59')],{})[_0xa1dc('0x34')](function(_0x22455c){var _0x133e0c=_0x3fe50b['user']['get']({'plain':!![]});if(!_0x133e0c)throw new Error(_0xa1dc('0x5a'));if(_0x133e0c['role']===_0xa1dc('0x5b')){var _0x59fb81=_0x22455c['get']({'plain':!![]});var _0x28bcd6='FaxAccounts';return db[_0xa1dc('0x5c')][_0xa1dc('0x57')]({'where':{'name':_0x28bcd6,'userProfileId':_0x133e0c[_0xa1dc('0x5d')]},'raw':!![]})[_0xa1dc('0x34')](function(_0x5bcd67){if(_0x5bcd67&&_0x5bcd67[_0xa1dc('0x5e')]===0x0){return db['UserProfileResource'][_0xa1dc('0x58')]({'name':_0x59fb81[_0xa1dc('0x39')],'resourceId':_0x59fb81['id'],'type':_0x5bcd67[_0xa1dc('0x39')],'sectionId':_0x5bcd67['id']},{})[_0xa1dc('0x34')](function(){return _0x22455c;});}else{return _0x22455c;}})[_0xa1dc('0x2a')](function(_0x3a3274){logger[_0xa1dc('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a3274);throw _0x3a3274;});}return _0x22455c;})[_0xa1dc('0x34')](respondWithResult(_0x39e108,0xc9))[_0xa1dc('0x2a')](handleError(_0x39e108,null));};exports[_0xa1dc('0x5f')]=function(_0x3f6de4,_0x454993){if(_0x3f6de4[_0xa1dc('0x59')]['id']){delete _0x3f6de4[_0xa1dc('0x59')]['id'];}return db[_0xa1dc('0x3e')][_0xa1dc('0x57')]({'where':{'id':_0x3f6de4[_0xa1dc('0x55')]['id']},'include':[{'model':db[_0xa1dc('0x3b')],'as':_0xa1dc('0x3c')}]})['then'](handleEntityNotFound(_0x454993,null))[_0xa1dc('0x34')](saveUpdates(_0x3f6de4[_0xa1dc('0x59')],null))[_0xa1dc('0x34')](respondWithResult(_0x454993,null))[_0xa1dc('0x2a')](handleError(_0x454993,null));};exports[_0xa1dc('0x35')]=function(_0x393077,_0x4f7198){return db['FaxAccount'][_0xa1dc('0x57')]({'where':{'id':_0x393077[_0xa1dc('0x55')]['id']}})['then'](handleEntityNotFound(_0x4f7198,null))[_0xa1dc('0x34')](removeEntity(_0x4f7198,null))[_0xa1dc('0x2a')](handleError(_0x4f7198,null));};exports['describe']=function(_0x4d2a2b,_0x438383){return db['FaxAccount'][_0xa1dc('0x60')]()['then'](respondWithResult(_0x438383,null))[_0xa1dc('0x2a')](handleError(_0x438383,null));};exports[_0xa1dc('0x61')]=function(_0x1ae300,_0x4e8d84,_0x2b49b2){if(_0x1ae300[_0xa1dc('0x59')]['id']){delete _0x1ae300['body']['id'];}return db[_0xa1dc('0x3e')][_0xa1dc('0x57')]({'where':{'id':_0x1ae300['params']['id']}})[_0xa1dc('0x34')](handleEntityNotFound(_0x4e8d84,null))[_0xa1dc('0x34')](function(_0x67481d){if(_0x67481d){_0x1ae300[_0xa1dc('0x59')][_0xa1dc('0x62')]=_0x67481d['id'];return db[_0xa1dc('0x63')][_0xa1dc('0x58')](_0x1ae300[_0xa1dc('0x59')]);}})[_0xa1dc('0x34')](respondWithResult(_0x4e8d84,null))[_0xa1dc('0x2a')](handleError(_0x4e8d84,null));};exports[_0xa1dc('0x64')]=function(_0x2908c5,_0x539cc6,_0x3148e4){var _0x17b26b={'raw':![],'where':{}};var _0x5e56ec={};var _0x5bb83b={'count':0x0,'rows':[]};return db[_0xa1dc('0x3e')][_0xa1dc('0x65')]({'where':{'id':_0x2908c5[_0xa1dc('0x55')]['id']}})['then'](handleEntityNotFound(_0x539cc6,null))['then'](function(_0x3fa4f2){if(_0x3fa4f2){_0x5e56ec[_0xa1dc('0x42')]=_[_0xa1dc('0x44')](db[_0xa1dc('0x63')][_0xa1dc('0x56')]);_0x5e56ec[_0xa1dc('0x43')]=_[_0xa1dc('0x44')](_0x2908c5[_0xa1dc('0x43')]);_0x5e56ec['filters']=_[_0xa1dc('0x47')](_0x5e56ec['model'],_0x5e56ec['query']);_0x17b26b[_0xa1dc('0x46')]=_['intersection'](_0x5e56ec[_0xa1dc('0x42')],qs[_0xa1dc('0x48')](_0x2908c5[_0xa1dc('0x43')][_0xa1dc('0x48')]));_0x17b26b['attributes']=_0x17b26b[_0xa1dc('0x46')][_0xa1dc('0x49')]?_0x17b26b[_0xa1dc('0x46')]:_0x5e56ec['model'];if(!_0x2908c5[_0xa1dc('0x43')]['hasOwnProperty'](_0xa1dc('0x4a'))){_0x17b26b[_0xa1dc('0x4b')]=qs['limit'](_0x2908c5[_0xa1dc('0x43')][_0xa1dc('0x4b')]);_0x17b26b[_0xa1dc('0x30')]=qs[_0xa1dc('0x30')](_0x2908c5[_0xa1dc('0x43')][_0xa1dc('0x30')]);}_0x17b26b[_0xa1dc('0x4c')]=qs['sort'](_0x2908c5[_0xa1dc('0x43')][_0xa1dc('0x4d')]);_0x17b26b['where']=qs[_0xa1dc('0x45')](_[_0xa1dc('0x66')](_0x2908c5[_0xa1dc('0x43')],_0x5e56ec[_0xa1dc('0x45')]));_0x17b26b[_0xa1dc('0x4e')][_0xa1dc('0x62')]=_0x3fa4f2['id'];if(_0x2908c5['query']['filter']){_0x17b26b[_0xa1dc('0x4e')]=_[_0xa1dc('0x51')](_0x17b26b['where'],{'$or':_[_0xa1dc('0x3d')](_0x17b26b[_0xa1dc('0x46')],function(_0x303f2e){var _0x34cd29={};_0x34cd29[_0x303f2e]={'$like':'%'+_0x2908c5['query'][_0xa1dc('0x4f')]+'%'};return _0x34cd29;})});}_0x17b26b=_[_0xa1dc('0x51')]({},_0x17b26b,_0x2908c5[_0xa1dc('0x67')]);return db['Disposition'][_0xa1dc('0x2f')]({'where':_0x17b26b[_0xa1dc('0x4e')]})[_0xa1dc('0x34')](function(_0xf8fb9d){_0x5bb83b[_0xa1dc('0x2f')]=_0xf8fb9d;if(_0x2908c5[_0xa1dc('0x43')][_0xa1dc('0x52')]){_0x17b26b[_0xa1dc('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xa1dc('0x68')](_0x17b26b);})['then'](function(_0xce0b17){_0x5bb83b['rows']=_0xce0b17;return _0x5bb83b;});}})[_0xa1dc('0x34')](respondWithFilteredResult(_0x539cc6,_0x17b26b))[_0xa1dc('0x2a')](handleError(_0x539cc6,null));};exports[_0xa1dc('0x69')]=function(_0x3cfddd,_0x19353d,_0x222550){return db[_0xa1dc('0x3e')][_0xa1dc('0x57')]({'where':{'id':_0x3cfddd[_0xa1dc('0x55')]['id']}})[_0xa1dc('0x34')](handleEntityNotFound(_0x19353d,null))['then'](function(_0x544cb8){if(_0x544cb8){return _0x544cb8[_0xa1dc('0x69')](_0x3cfddd[_0xa1dc('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x19353d,null))['catch'](handleError(_0x19353d,null));};exports['addAnswer']=function(_0x481da4,_0x56ce41,_0x4a9a57){if(_0x481da4['body']['id']){delete _0x481da4[_0xa1dc('0x59')]['id'];}return db['FaxAccount'][_0xa1dc('0x57')]({'where':{'id':_0x481da4[_0xa1dc('0x55')]['id']}})['then'](handleEntityNotFound(_0x56ce41,null))[_0xa1dc('0x34')](function(_0x108c2a){if(_0x108c2a){_0x481da4[_0xa1dc('0x59')]['FaxAccountId']=_0x108c2a['id'];return db[_0xa1dc('0x6a')][_0xa1dc('0x58')](_0x481da4[_0xa1dc('0x59')]);}})[_0xa1dc('0x34')](respondWithResult(_0x56ce41,null))['catch'](handleError(_0x56ce41,null));};exports['getAnswers']=function(_0x1cec02,_0x306edd,_0x1218ea){var _0x54056e={'raw':![],'where':{}};var _0x11e165={};var _0x9fc3e1={'count':0x0,'rows':[]};return db[_0xa1dc('0x3e')][_0xa1dc('0x65')]({'where':{'id':_0x1cec02['params']['id']}})[_0xa1dc('0x34')](handleEntityNotFound(_0x306edd,null))['then'](function(_0x3931fe){if(_0x3931fe){_0x11e165['model']=_[_0xa1dc('0x44')](db[_0xa1dc('0x6a')]['rawAttributes']);_0x11e165[_0xa1dc('0x43')]=_[_0xa1dc('0x44')](_0x1cec02[_0xa1dc('0x43')]);_0x11e165[_0xa1dc('0x45')]=_[_0xa1dc('0x47')](_0x11e165['model'],_0x11e165[_0xa1dc('0x43')]);_0x54056e[_0xa1dc('0x46')]=_[_0xa1dc('0x47')](_0x11e165[_0xa1dc('0x42')],qs[_0xa1dc('0x48')](_0x1cec02['query']['fields']));_0x54056e[_0xa1dc('0x46')]=_0x54056e[_0xa1dc('0x46')][_0xa1dc('0x49')]?_0x54056e[_0xa1dc('0x46')]:_0x11e165[_0xa1dc('0x42')];if(!_0x1cec02[_0xa1dc('0x43')]['hasOwnProperty']('nolimit')){_0x54056e[_0xa1dc('0x4b')]=qs[_0xa1dc('0x4b')](_0x1cec02['query']['limit']);_0x54056e[_0xa1dc('0x30')]=qs[_0xa1dc('0x30')](_0x1cec02[_0xa1dc('0x43')][_0xa1dc('0x30')]);}_0x54056e[_0xa1dc('0x4c')]=qs[_0xa1dc('0x4d')](_0x1cec02[_0xa1dc('0x43')][_0xa1dc('0x4d')]);_0x54056e[_0xa1dc('0x4e')]=qs['filters'](_['pick'](_0x1cec02[_0xa1dc('0x43')],_0x11e165[_0xa1dc('0x45')]));_0x54056e[_0xa1dc('0x4e')]['FaxAccountId']=_0x3931fe['id'];if(_0x1cec02[_0xa1dc('0x43')][_0xa1dc('0x4f')]){_0x54056e['where']=_[_0xa1dc('0x51')](_0x54056e[_0xa1dc('0x4e')],{'$or':_[_0xa1dc('0x3d')](_0x54056e[_0xa1dc('0x46')],function(_0x408ea5){var _0x539f7e={};_0x539f7e[_0x408ea5]={'$like':'%'+_0x1cec02[_0xa1dc('0x43')]['filter']+'%'};return _0x539f7e;})});}_0x54056e=_[_0xa1dc('0x51')]({},_0x54056e,_0x1cec02[_0xa1dc('0x67')]);return db[_0xa1dc('0x6a')][_0xa1dc('0x2f')]({'where':_0x54056e['where']})[_0xa1dc('0x34')](function(_0x4e89e4){_0x9fc3e1[_0xa1dc('0x2f')]=_0x4e89e4;if(_0x1cec02[_0xa1dc('0x43')][_0xa1dc('0x52')]){_0x54056e[_0xa1dc('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x54056e);})[_0xa1dc('0x34')](function(_0x4213c8){_0x9fc3e1['rows']=_0x4213c8;return _0x9fc3e1;});}})[_0xa1dc('0x34')](respondWithFilteredResult(_0x306edd,_0x54056e))['catch'](handleError(_0x306edd,null));};exports['removeAnswers']=function(_0x52927d,_0x5855dd,_0x31d8d8){return db[_0xa1dc('0x3e')][_0xa1dc('0x57')]({'where':{'id':_0x52927d['params']['id']}})[_0xa1dc('0x34')](handleEntityNotFound(_0x5855dd,null))['then'](function(_0x284893){if(_0x284893){return _0x284893[_0xa1dc('0x6b')](_0x52927d['query'][_0xa1dc('0x6c')]);}})['then'](respondWithStatusCode(_0x5855dd,null))[_0xa1dc('0x2a')](handleError(_0x5855dd,null));};exports[_0xa1dc('0x6d')]=function(_0x38d714,_0x39b768,_0x4d7b39){return db[_0xa1dc('0x6e')][_0xa1dc('0x57')]({'where':{'id':_0x38d714[_0xa1dc('0x55')]['id']}})[_0xa1dc('0x34')](handleEntityNotFound(_0x39b768,null))[_0xa1dc('0x34')](function(_0x45e1f8){if(_0x45e1f8){return _0x45e1f8[_0xa1dc('0x6d')](_0x38d714[_0xa1dc('0x59')][_0xa1dc('0x6c')],_['omit'](_0x38d714[_0xa1dc('0x59')],[_0xa1dc('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x39b768,null))[_0xa1dc('0x2a')](handleError(_0x39b768,null));};exports[_0xa1dc('0x6f')]=function(_0x166620,_0x1c4b6d,_0x86e036){var _0xfd8446={'raw':![],'where':{}};var _0x34bb55={};var _0x5e8504={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x166620['params']['id']}})['then'](handleEntityNotFound(_0x1c4b6d,null))[_0xa1dc('0x34')](function(_0x29af9b){if(_0x29af9b){_0x34bb55[_0xa1dc('0x42')]=_[_0xa1dc('0x44')](db['FaxInteraction'][_0xa1dc('0x56')]);_0x34bb55['query']=_['keys'](_0x166620[_0xa1dc('0x43')]);_0x34bb55[_0xa1dc('0x45')]=_[_0xa1dc('0x47')](_0x34bb55[_0xa1dc('0x42')],_0x34bb55['query']);_0xfd8446['attributes']=_[_0xa1dc('0x47')](_0x34bb55[_0xa1dc('0x42')],qs['fields'](_0x166620[_0xa1dc('0x43')][_0xa1dc('0x48')]));_0xfd8446[_0xa1dc('0x46')]=_0xfd8446[_0xa1dc('0x46')][_0xa1dc('0x49')]?_0xfd8446[_0xa1dc('0x46')]:_0x34bb55[_0xa1dc('0x42')];if(!_0x166620['query']['hasOwnProperty'](_0xa1dc('0x4a'))){_0xfd8446[_0xa1dc('0x4b')]=qs[_0xa1dc('0x4b')](_0x166620[_0xa1dc('0x43')][_0xa1dc('0x4b')]);_0xfd8446[_0xa1dc('0x30')]=qs[_0xa1dc('0x30')](_0x166620['query']['offset']);}_0xfd8446['order']=qs[_0xa1dc('0x4d')](_0x166620[_0xa1dc('0x43')]['sort']);_0xfd8446['where']=qs[_0xa1dc('0x45')](_[_0xa1dc('0x66')](_0x166620['query'],_0x34bb55['filters']));_0xfd8446[_0xa1dc('0x4e')]['FaxAccountId']=_0x29af9b['id'];if(_0x166620[_0xa1dc('0x43')][_0xa1dc('0x4f')]){_0xfd8446[_0xa1dc('0x4e')]=_[_0xa1dc('0x51')](_0xfd8446[_0xa1dc('0x4e')],{'$or':_['map'](_0xfd8446[_0xa1dc('0x46')],function(_0x5abd87){var _0x32cca9={};_0x32cca9[_0x5abd87]={'$like':'%'+_0x166620[_0xa1dc('0x43')][_0xa1dc('0x4f')]+'%'};return _0x32cca9;})});}_0xfd8446=_[_0xa1dc('0x51')]({},_0xfd8446,_0x166620[_0xa1dc('0x67')]);return db[_0xa1dc('0x6e')][_0xa1dc('0x2f')]({'where':_0xfd8446[_0xa1dc('0x4e')]})[_0xa1dc('0x34')](function(_0x4d7f81){_0x5e8504[_0xa1dc('0x2f')]=_0x4d7f81;if(_0x166620['query'][_0xa1dc('0x52')]){_0xfd8446[_0xa1dc('0x53')]=[{'model':db[_0xa1dc('0x70')],'as':_0xa1dc('0x71'),'required':![]},{'model':db[_0xa1dc('0x72')],'as':'Owner','attributes':[_0xa1dc('0x39'),_0xa1dc('0x73'),_0xa1dc('0x74')],'required':![]},{'model':db[_0xa1dc('0x75')],'as':_0xa1dc('0x76'),'attributes':['id','name',_0xa1dc('0x77')],'where':_0x166620[_0xa1dc('0x43')][_0xa1dc('0x78')]?{'id':_0x166620[_0xa1dc('0x43')][_0xa1dc('0x78')]}:undefined,'required':_0x166620[_0xa1dc('0x43')][_0xa1dc('0x78')]?!![]:![]}];}return db[_0xa1dc('0x6e')][_0xa1dc('0x68')](_0xfd8446);})[_0xa1dc('0x34')](function(_0x369afb){_0x5e8504[_0xa1dc('0x54')]=_0x369afb;return _0x5e8504;});}})[_0xa1dc('0x34')](respondWithFilteredResult(_0x1c4b6d,_0xfd8446))[_0xa1dc('0x2a')](handleError(_0x1c4b6d,null));};exports['addApplications']=function(_0xba0fb0,_0x5ac82e,_0x5f216a){return db['FaxAccount'][_0xa1dc('0x65')]({'where':{'id':_0xba0fb0[_0xa1dc('0x55')]['id']}})[_0xa1dc('0x34')](handleEntityNotFound(_0x5ac82e,null))[_0xa1dc('0x34')](function(_0x2c5967){if(_0x2c5967){return db[_0xa1dc('0x79')][_0xa1dc('0x7a')](function(_0x143909){return db['FaxApplication'][_0xa1dc('0x35')]({'where':{'FaxAccountId':_0xba0fb0['params']['id']},'transaction':_0x143909})[_0xa1dc('0x34')](function(_0x5ee79a){var _0x890a96=_['map'](_0xba0fb0[_0xa1dc('0x59')],function(_0x5d4fa4){_0x5d4fa4['FaxAccountId']=_0xba0fb0['params']['id'];return _0x5d4fa4;});return db[_0xa1dc('0x7b')][_0xa1dc('0x7c')](_0x890a96,{'transaction':_0x143909});});})[_0xa1dc('0x34')](function(){return db[_0xa1dc('0x7b')][_0xa1dc('0x7d')]({'where':{'FaxAccountId':_0xba0fb0[_0xa1dc('0x55')]['id']},'order':_0xa1dc('0x7e')});});}})[_0xa1dc('0x34')](respondWithResult(_0x5ac82e,null))['catch'](handleError(_0x5ac82e,null));};exports['getApplications']=function(_0x58ef5e,_0x176127,_0x1ffc72){var _0x53e2ce={};var _0x627cad={};var _0x1e3efd;var _0xcb4457;return db['FaxAccount'][_0xa1dc('0x65')]({'where':{'id':_0x58ef5e[_0xa1dc('0x55')]['id']}})[_0xa1dc('0x34')](handleEntityNotFound(_0x176127,null))[_0xa1dc('0x34')](function(_0x159f72){if(_0x159f72){_0x1e3efd=_0x159f72;_0x627cad[_0xa1dc('0x42')]=_[_0xa1dc('0x44')](db[_0xa1dc('0x7b')][_0xa1dc('0x56')]);_0x627cad[_0xa1dc('0x43')]=_[_0xa1dc('0x44')](_0x58ef5e['query']);_0x627cad[_0xa1dc('0x45')]=_[_0xa1dc('0x47')](_0x627cad[_0xa1dc('0x42')],_0x627cad[_0xa1dc('0x43')]);_0x53e2ce[_0xa1dc('0x46')]=_[_0xa1dc('0x47')](_0x627cad['model'],qs['fields'](_0x58ef5e[_0xa1dc('0x43')][_0xa1dc('0x48')]));_0x53e2ce[_0xa1dc('0x46')]=_0x53e2ce['attributes'][_0xa1dc('0x49')]?_0x53e2ce[_0xa1dc('0x46')]:_0x627cad[_0xa1dc('0x42')];_0x53e2ce[_0xa1dc('0x4c')]=qs[_0xa1dc('0x4d')](_0x58ef5e['query'][_0xa1dc('0x4d')]);_0x53e2ce[_0xa1dc('0x4e')]=qs[_0xa1dc('0x45')](_[_0xa1dc('0x66')](_0x58ef5e[_0xa1dc('0x43')],_0x627cad[_0xa1dc('0x45')]));if(_0x58ef5e['query']['filter']){_0x53e2ce['where']=_[_0xa1dc('0x51')](_0x53e2ce[_0xa1dc('0x4e')],{'$or':_['map'](_0x53e2ce['attributes'],function(_0x26ff02){var _0x1be001={};_0x1be001[_0x26ff02]={'$like':'%'+_0x58ef5e[_0xa1dc('0x43')][_0xa1dc('0x4f')]+'%'};return _0x1be001;})});}_0x53e2ce=_['merge']({},_0x53e2ce,_0x58ef5e[_0xa1dc('0x67')]);return _0x1e3efd['getApplications'](_0x53e2ce);}})[_0xa1dc('0x34')](function(_0x242a20){if(_0x242a20){_0xcb4457=_0x242a20[_0xa1dc('0x49')];if(!_0x58ef5e[_0xa1dc('0x43')][_0xa1dc('0x7f')](_0xa1dc('0x4a'))){_0x53e2ce[_0xa1dc('0x4b')]=qs[_0xa1dc('0x4b')](_0x58ef5e[_0xa1dc('0x43')][_0xa1dc('0x4b')]);_0x53e2ce[_0xa1dc('0x30')]=qs[_0xa1dc('0x30')](_0x58ef5e[_0xa1dc('0x43')]['offset']);}return _0x1e3efd[_0xa1dc('0x80')](_0x53e2ce);}})[_0xa1dc('0x34')](function(_0x5d54b6){if(_0x5d54b6){return _0x5d54b6?{'count':_0xcb4457,'rows':_0x5d54b6}:null;}})[_0xa1dc('0x34')](respondWithResult(_0x176127,null))[_0xa1dc('0x2a')](handleError(_0x176127,null));};function Extension(_0x760171,_0x131a87,_0xedf999,_0x3358e1){this[_0xa1dc('0x81')]=_0xa1dc('0x82');this['exten']=_0x760171[_0xa1dc('0x83')];this['app']=_0x3358e1;this[_0xa1dc('0x40')]='system';this[_0xa1dc('0x84')]=_0xa1dc('0x85');this['FaxAccountId']=_0x760171['id'];this[_0xa1dc('0x7e')]=_0x131a87;this['appdata']=_0xedf999;}function createExtensionsReciveFax(_0x3e8c66){var _0x500d32=0x1;var _0x3a1959=[];_0x3a1959[_0xa1dc('0x86')](new Extension(_0x3e8c66,_0x500d32,'',_0xa1dc('0x87')));_0x500d32+=0x1;_0x3a1959[_0xa1dc('0x86')](new Extension(_0x3e8c66,_0x500d32,_0xa1dc('0x88'),'Set'));_0x500d32+=0x1;for(var _0x2a8265 in _0x3e8c66){if(_0x3e8c66['hasOwnProperty'](_0x2a8265)&&(_0x2a8265===_0xa1dc('0x89')||_0x2a8265===_0xa1dc('0x83')||_0x2a8265===_0xa1dc('0x8a')||_0x2a8265===_0xa1dc('0x8b')||_0x2a8265==='headerinfo'||_0x2a8265===_0xa1dc('0x8c')||_0x2a8265===_0xa1dc('0x8d')||_0x2a8265===_0xa1dc('0x8e')||_0x2a8265===_0xa1dc('0x8f'))){_0x3a1959['push'](new Extension(_0x3e8c66,_0x500d32,_0xa1dc('0x90')+_0x2a8265+')='+_0x3e8c66[_0x2a8265],_0xa1dc('0x91')));_0x500d32+=0x1;}}_0x3a1959[_0xa1dc('0x86')](new Extension(_0x3e8c66,_0x500d32,'6',_0xa1dc('0x92')));_0x500d32+=0x1;_0x3a1959[_0xa1dc('0x86')](new Extension(_0x3e8c66,_0x500d32,_0xa1dc('0x93'),'ReceiveFax'));_0x500d32=0x0;return _0x3a1959;}exports['addAccountApplications']=function(_0x5a37a4,_0x313d93,_0x563551){var _0x374545;return db[_0xa1dc('0x79')][_0xa1dc('0x7a')](function(_0x2fe7fd){return db[_0xa1dc('0x3e')][_0xa1dc('0x58')](_0x5a37a4[_0xa1dc('0x59')],{'transaction':_0x2fe7fd})[_0xa1dc('0x34')](function(_0x521ed3){_0x374545=_0x521ed3[_0xa1dc('0x36')]({'plain':!![]});return db['VoiceExtension'][_0xa1dc('0x7c')](createExtensionsReciveFax(_0x374545),{'transaction':_0x2fe7fd});});})[_0xa1dc('0x34')](function(){return _0x374545;})[_0xa1dc('0x34')](respondWithResult(_0x313d93,null))[_0xa1dc('0x2a')](handleError(_0x313d93,null));};exports['updateAccountApplications']=function(_0x330758,_0x24ed01,_0x16b454){var _0xd0766c;return db[_0xa1dc('0x79')][_0xa1dc('0x7a')](function(_0x40c1f4){return db[_0xa1dc('0x3e')][_0xa1dc('0x5f')](_0x330758[_0xa1dc('0x59')],{'where':{'id':_0x330758[_0xa1dc('0x59')]['id']},'transaction':_0x40c1f4})['then'](function(_0x7cedda){return db['VoiceExtension'][_0xa1dc('0x35')]({'where':{'FaxAccountId':_0x330758['body']['id']},'transaction':_0x40c1f4})[_0xa1dc('0x34')](function(_0x5c6f0f){return db[_0xa1dc('0x94')][_0xa1dc('0x7c')](createExtensionsReciveFax(_[_0xa1dc('0x95')](_0x330758[_0xa1dc('0x59')],['tech',_0xa1dc('0x41'),_0xa1dc('0x96'),'updatedAt','TrunkId',_0xa1dc('0x97')])),{'transaction':_0x40c1f4});});});})['then'](function(){return db['FaxAccount'][_0xa1dc('0x98')](_0x330758[_0xa1dc('0x59')]['id']);})[_0xa1dc('0x34')](respondWithResult(_0x24ed01,null))['catch'](handleError(_0x24ed01,null));};exports[_0xa1dc('0x99')]=function(_0x319e9a,_0x1dbb76,_0x5f56a4){var _0x3db78c={'raw':!![],'where':{}};var _0x57bdf7={};var _0x56cde3={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa1dc('0x65')]({'where':{'id':_0x319e9a[_0xa1dc('0x55')]['id']}})[_0xa1dc('0x34')](handleEntityNotFound(_0x1dbb76,null))[_0xa1dc('0x34')](function(_0xa06853){if(_0xa06853){_0x57bdf7['model']=_[_0xa1dc('0x44')](db[_0xa1dc('0x9a')][_0xa1dc('0x56')]);_0x57bdf7[_0xa1dc('0x43')]=_[_0xa1dc('0x44')](_0x319e9a['query']);_0x57bdf7[_0xa1dc('0x45')]=_[_0xa1dc('0x47')](_0x57bdf7['model'],_0x57bdf7[_0xa1dc('0x43')]);_0x3db78c[_0xa1dc('0x46')]=_[_0xa1dc('0x47')](_0x57bdf7[_0xa1dc('0x42')],qs[_0xa1dc('0x48')](_0x319e9a[_0xa1dc('0x43')]['fields']));_0x3db78c[_0xa1dc('0x46')]=_0x3db78c[_0xa1dc('0x46')][_0xa1dc('0x49')]?_0x3db78c['attributes']:_0x57bdf7['model'];if(!_0x319e9a[_0xa1dc('0x43')][_0xa1dc('0x7f')](_0xa1dc('0x4a'))){_0x3db78c[_0xa1dc('0x4b')]=qs['limit'](_0x319e9a['query'][_0xa1dc('0x4b')]);_0x3db78c[_0xa1dc('0x30')]=qs['offset'](_0x319e9a['query'][_0xa1dc('0x30')]);}_0x3db78c[_0xa1dc('0x4c')]=qs[_0xa1dc('0x4d')](_0x319e9a[_0xa1dc('0x43')]['sort']);_0x3db78c['where']=qs[_0xa1dc('0x45')](_[_0xa1dc('0x66')](_0x319e9a[_0xa1dc('0x43')],_0x57bdf7[_0xa1dc('0x45')]));_0x3db78c[_0xa1dc('0x4e')][_0xa1dc('0x62')]=_0xa06853['id'];if(_0x319e9a['query']['filter']){_0x3db78c[_0xa1dc('0x4e')]=_[_0xa1dc('0x51')](_0x3db78c[_0xa1dc('0x4e')],{'$or':_['map'](_0x3db78c[_0xa1dc('0x46')],function(_0x21e8fb){var _0x5d724b={};_0x5d724b[_0x21e8fb]={'$like':'%'+_0x319e9a[_0xa1dc('0x43')][_0xa1dc('0x4f')]+'%'};return _0x5d724b;})});}if(_0x319e9a[_0xa1dc('0x43')][_0xa1dc('0x9b')]){var _0x503d21=_0x319e9a['query'][_0xa1dc('0x9b')][_0xa1dc('0x9c')](',');var _0x5055b6={};_0x5055b6[_0x503d21[0x0]]={'$gte':moment(_0x503d21[0x1])[_0xa1dc('0x9d')](_0xa1dc('0x9e'))};_0x3db78c[_0xa1dc('0x4e')]=_[_0xa1dc('0x51')](_0x3db78c['where'],_0x5055b6);}_0x3db78c=_['merge']({},_0x3db78c,_0x319e9a[_0xa1dc('0x67')]);return db[_0xa1dc('0x9a')][_0xa1dc('0x2f')]({'where':_0x3db78c[_0xa1dc('0x4e')]})[_0xa1dc('0x34')](function(_0x2ef24b){_0x56cde3['count']=_0x2ef24b;if(_0x319e9a[_0xa1dc('0x43')][_0xa1dc('0x52')]){_0x3db78c[_0xa1dc('0x53')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3db78c);})[_0xa1dc('0x34')](function(_0x1110a3){_0x56cde3[_0xa1dc('0x54')]=_0x1110a3;return _0x56cde3;});}})[_0xa1dc('0x34')](respondWithFilteredResult(_0x1dbb76,_0x3db78c))[_0xa1dc('0x2a')](handleError(_0x1dbb76,null));};exports['send']=function(_0x5b7d10,_0xc8740e,_0x156440){var _0x2901f7,_0x2cb670={},_0x5223bd;if(_0x5b7d10[_0xa1dc('0x59')]['to']){_0x5223bd=_0x5b7d10[_0xa1dc('0x59')]['to'][0x0];}return db[_0xa1dc('0x3e')][_0xa1dc('0x57')]({'where':{'id':_0x5b7d10[_0xa1dc('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xa1dc('0x9f'),'include':[{'model':db[_0xa1dc('0x70')],'as':_0xa1dc('0xa0'),'where':{'fax':_0x5223bd},'limit':0x1,'order':[[_0xa1dc('0xa1'),_0xa1dc('0xa2')]]}]}]})['then'](handleEntityNotFound(_0xc8740e,null))[_0xa1dc('0x34')](function(_0x2e7a50){_0x2901f7=_0x2e7a50;if(_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')]&&_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][_0xa1dc('0x49')]){for(var _0x5b0eb5=0x0;_0x5b0eb5<_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][_0xa1dc('0x49')];_0x5b0eb5+=0x1){_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][_0x5b0eb5]={'filename':_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][_0x5b0eb5]['name'],'id':_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][_0x5b0eb5]['id'],'path':path[_0xa1dc('0xa4')](config['root'],_0xa1dc('0xa5'),_0x5b7d10[_0xa1dc('0x59')]['attachments'][_0x5b0eb5]['basename'])};}}return respondWithRpcPromise(_0xa1dc('0xa6'),_0xa1dc('0xa6'),{'FaxAccountId':_[_0xa1dc('0xa7')](_0x5b7d10[_0xa1dc('0x55')]['id'])?undefined:_0x5b7d10[_0xa1dc('0x55')]['id'],'path':_['isNil'](_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][0x0][_0xa1dc('0x5')])?undefined:_0x5b7d10[_0xa1dc('0x59')]['attachments'][0x0][_0xa1dc('0x5')],'fax':_[_0xa1dc('0xa7')](_0x5b7d10[_0xa1dc('0x59')]['to'][0x0])?undefined:_0x5b7d10[_0xa1dc('0x59')]['to'][0x0]},client9002);})[_0xa1dc('0x34')](function(){if(_0x2901f7){if(_[_0xa1dc('0xa7')](_0x5b7d10[_0xa1dc('0x59')]['from'])){_0x5b7d10['body'][_0xa1dc('0xa8')]=util['format'](_0xa1dc('0xa9'),_0x2901f7['name'],_0x2901f7[_0xa1dc('0xaa')]);}if(_0x2901f7[_0xa1dc('0x9f')]){if(_0x2901f7['List'][_0xa1dc('0xa0')]['length']){return _0x2901f7['List'][_0xa1dc('0xa0')][0x0];}else{return db[_0xa1dc('0x70')][_0xa1dc('0x58')](_[_0xa1dc('0xab')](_0x5b7d10[_0xa1dc('0x59')],{'firstName':_0x5b7d10[_0xa1dc('0x59')]['to'][0x0],'phone':_0x5b7d10[_0xa1dc('0x59')]['to'][0x0],'fax':_0x5b7d10[_0xa1dc('0x59')]['to'][0x0],'ListId':_0x2901f7[_0xa1dc('0x97')]}));}}else{throw new Error(_0xa1dc('0xac'));}}else{throw new Error(_0xa1dc('0xad'));}})['then'](function(_0x3251ee){if(_0x3251ee){return db[_0xa1dc('0x6e')][_0xa1dc('0x57')]({'where':{'ContactId':_0x3251ee['id'],'closed':![],'FaxAccountId':_0x2901f7['id']}})[_0xa1dc('0x34')](function(_0x36eaa0){if(_0x36eaa0){return[_0x36eaa0,![]];}return db[_0xa1dc('0x6e')][_0xa1dc('0x58')]({'UserId':_0x5b7d10[_0xa1dc('0x5b')]['id'],'ContactId':_0x3251ee['id'],'FaxAccountId':_0x2901f7['id'],'fax':_0x5b7d10[_0xa1dc('0x59')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x5b7d10[_0xa1dc('0x59')],{'read':![],'body':_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][0x0][_0xa1dc('0xae')],'FaxAccountId':_0x2901f7['id'],'UserId':_0x5b7d10[_0xa1dc('0x5b')]['id'],'ContactId':_0x3251ee['id'],'AttachmentId':_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0xa1dc('0x9a')],'as':_0xa1dc('0xaf')}]})[_0xa1dc('0x34')](function(_0x1b7cf9){return[_0x1b7cf9,!![]];});});}else{throw new Error(_0xa1dc('0xb0'));}})['spread'](function(_0xd80797,_0x15b85d){if(_0x15b85d){return _0xd80797;}return db[_0xa1dc('0x9a')][_0xa1dc('0x58')]({'direction':_0xa1dc('0xb1'),'read':![],'body':_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][0x0]['filename'],'FaxAccountId':_0x2901f7['id'],'FaxInteractionId':_0xd80797['id'],'UserId':_0x5b7d10[_0xa1dc('0x5b')]['id'],'ContactId':_0xd80797['ContactId'],'AttachmentId':_0x5b7d10[_0xa1dc('0x59')]['attachments'][0x0]['id']})[_0xa1dc('0x34')](function(_0x3defdf){_0xd80797[_0xa1dc('0xb2')]['Messages']=[];_0xd80797[_0xa1dc('0xb2')][_0xa1dc('0xaf')][_0xa1dc('0x86')](_0x3defdf['dataValues']);return _0xd80797;});})[_0xa1dc('0x34')](function(_0x2942fc){respondWithRpcPromise(_0xa1dc('0xb3'),'SendFax',{'FaxAccountId':_[_0xa1dc('0xa7')](_0x5b7d10[_0xa1dc('0x55')]['id'])?undefined:_0x5b7d10['params']['id'],'path':_['isNil'](_0x5b7d10[_0xa1dc('0x59')][_0xa1dc('0xa3')][0x0][_0xa1dc('0x5')])?undefined:_0x5b7d10['body'][_0xa1dc('0xa3')][0x0]['path'],'fax':_[_0xa1dc('0xa7')](_0x5b7d10['body']['to'][0x0])?undefined:_0x5b7d10[_0xa1dc('0x59')]['to'][0x0],'AttachmentId':_0x5b7d10['body'][_0xa1dc('0xa3')][0x0]['id']},client9002)[_0xa1dc('0x34')](function(_0x1fe9f9){logger['info'](_0xa1dc('0xb4'),_0x1fe9f9);})[_0xa1dc('0x2a')](function(_0x1caacc){logger[_0xa1dc('0x21')](_0xa1dc('0xb4'),_0x1caacc);});return _0x2942fc;})[_0xa1dc('0x34')](respondWithResult(_0xc8740e,null))[_0xa1dc('0x2a')](handleError(_0xc8740e,null));};exports['addAgents']=function(_0x26c452,_0x382688,_0x20b5bc){return db[_0xa1dc('0x3e')][_0xa1dc('0x57')]({'where':{'id':_0x26c452[_0xa1dc('0x55')]['id']}})[_0xa1dc('0x34')](handleEntityNotFound(_0x382688,null))[_0xa1dc('0x34')](function(_0xbf0ac4){if(_0xbf0ac4){return _0xbf0ac4[_0xa1dc('0xb5')](_0x26c452[_0xa1dc('0x59')]['ids'],_[_0xa1dc('0x95')](_0x26c452['body'],[_0xa1dc('0x6c'),'id'])||{})['spread'](function(_0x285dce){for(var _0x572acf=0x0;_0x572acf<_0x26c452['body']['ids'][_0xa1dc('0x49')];_0x572acf+=0x1){socket['emit'](_0xa1dc('0xb6'),{'UserId':_0x26c452[_0xa1dc('0x59')]['ids'][_0x572acf],'FaxAccountId':_0x26c452[_0xa1dc('0x55')]['id']});}return _0x285dce;});}})[_0xa1dc('0x34')](respondWithResult(_0x382688,null))[_0xa1dc('0x2a')](handleError(_0x382688,null));};exports[_0xa1dc('0xb7')]=function(_0x100885,_0x15f38c,_0x59ba89){return db[_0xa1dc('0x3e')]['find']({'where':{'id':_0x100885[_0xa1dc('0x55')]['id']}})['then'](handleEntityNotFound(_0x15f38c,null))[_0xa1dc('0x34')](function(_0x1f7f2f){if(_0x1f7f2f){return _0x1f7f2f[_0xa1dc('0xb7')](_0x100885[_0xa1dc('0x43')][_0xa1dc('0x6c')])[_0xa1dc('0x34')](function(){if(_['isArray'](_0x100885[_0xa1dc('0x43')]['ids'])){for(var _0x11f7db=0x0;_0x11f7db<_0x100885[_0xa1dc('0x43')][_0xa1dc('0x6c')][_0xa1dc('0x49')];_0x11f7db+=0x1){socket['emit'](_0xa1dc('0xb8'),{'UserId':Number(_0x100885['query'][_0xa1dc('0x6c')][_0x11f7db]),'FaxAccountId':Number(_0x100885[_0xa1dc('0x55')]['id'])});}}else{socket[_0xa1dc('0xb9')](_0xa1dc('0xb8'),{'UserId':Number(_0x100885[_0xa1dc('0x43')][_0xa1dc('0x6c')]),'FaxAccountId':Number(_0x100885['params']['id'])});}});}})[_0xa1dc('0x34')](respondWithStatusCode(_0x15f38c,null))[_0xa1dc('0x2a')](handleError(_0x15f38c,null));};exports[_0xa1dc('0xba')]=function(_0x58aaab,_0x207212,_0x4eaf81){var _0x3f01c4={};var _0x36fac2={};var _0x573949;var _0x584581;return db[_0xa1dc('0x3e')][_0xa1dc('0x65')]({'where':{'id':_0x58aaab[_0xa1dc('0x55')]['id']}})['then'](handleEntityNotFound(_0x207212,null))['then'](function(_0x1778f1){if(_0x1778f1){_0x573949=_0x1778f1;_0x36fac2['model']=_[_0xa1dc('0x44')](db[_0xa1dc('0x72')][_0xa1dc('0x56')]);_0x36fac2[_0xa1dc('0x43')]=_[_0xa1dc('0x44')](_0x58aaab[_0xa1dc('0x43')]);_0x36fac2[_0xa1dc('0x45')]=_[_0xa1dc('0x47')](_0x36fac2[_0xa1dc('0x42')],_0x36fac2[_0xa1dc('0x43')]);_0x3f01c4['attributes']=_[_0xa1dc('0x47')](_0x36fac2[_0xa1dc('0x42')],qs[_0xa1dc('0x48')](_0x58aaab[_0xa1dc('0x43')][_0xa1dc('0x48')]));_0x3f01c4[_0xa1dc('0x46')]=_0x3f01c4[_0xa1dc('0x46')][_0xa1dc('0x49')]?_0x3f01c4[_0xa1dc('0x46')]:_0x36fac2['model'];_0x3f01c4[_0xa1dc('0x4c')]=qs[_0xa1dc('0x4d')](_0x58aaab[_0xa1dc('0x43')][_0xa1dc('0x4d')]);_0x3f01c4[_0xa1dc('0x4e')]=qs[_0xa1dc('0x45')](_[_0xa1dc('0x66')](_0x58aaab['query'],_0x36fac2[_0xa1dc('0x45')]));if(_0x58aaab[_0xa1dc('0x43')][_0xa1dc('0x4f')]){_0x3f01c4[_0xa1dc('0x4e')]=_['merge'](_0x3f01c4['where'],{'$or':_[_0xa1dc('0x3d')](_0x3f01c4['attributes'],function(_0x1bc732){var _0xd5e386={};_0xd5e386[_0x1bc732]={'$like':'%'+_0x58aaab[_0xa1dc('0x43')][_0xa1dc('0x4f')]+'%'};return _0xd5e386;})});}_0x3f01c4=_[_0xa1dc('0x51')]({},_0x3f01c4,_0x58aaab[_0xa1dc('0x67')]);return _0x573949[_0xa1dc('0xba')](_0x3f01c4);}})[_0xa1dc('0x34')](function(_0x209b3c){if(_0x209b3c){_0x584581=_0x209b3c[_0xa1dc('0x49')];if(!_0x58aaab[_0xa1dc('0x43')][_0xa1dc('0x7f')](_0xa1dc('0x4a'))){_0x3f01c4[_0xa1dc('0x4b')]=qs['limit'](_0x58aaab[_0xa1dc('0x43')][_0xa1dc('0x4b')]);_0x3f01c4[_0xa1dc('0x30')]=qs[_0xa1dc('0x30')](_0x58aaab['query'][_0xa1dc('0x30')]);}return _0x573949[_0xa1dc('0xba')](_0x3f01c4);}})[_0xa1dc('0x34')](function(_0x161804){if(_0x161804){return _0x161804?{'count':_0x584581,'rows':_0x161804}:null;}})['then'](respondWithResult(_0x207212,null))[_0xa1dc('0x2a')](handleError(_0x207212,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 69b13d2..306b581 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 _0x0517=['emit','hasOwnProperty','hook','../../mysqldb','FaxAccount','setMaxListeners','update','remove'];(function(_0x4adff1,_0x4a8cbe){var _0x318759=function(_0x32faef){while(--_0x32faef){_0x4adff1['push'](_0x4adff1['shift']());}};_0x318759(++_0x4a8cbe);}(_0x0517,0x1a3));var _0x7051=function(_0x2e5fb8,_0x1460c0){_0x2e5fb8=_0x2e5fb8-0x0;var _0x303036=_0x0517[_0x2e5fb8];return _0x303036;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x7051('0x0'))['db'][_0x7051('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x7051('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7051('0x3'),'afterDestroy':_0x7051('0x4')};function emitEvent(_0x31197f){return function(_0x51f167,_0x25a608,_0x1ff676){FaxAccountEvents[_0x7051('0x5')](_0x31197f+':'+_0x51f167['id'],_0x51f167);FaxAccountEvents[_0x7051('0x5')](_0x31197f,_0x51f167);_0x1ff676(null);};}for(var e in events){if(events[_0x7051('0x6')](e)){var event=events[e];FaxAccount[_0x7051('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xaa29=['events','FaxAccount','save','emit','hasOwnProperty','hook'];(function(_0x11fbaa,_0x52dc16){var _0x1831fd=function(_0x2bbced){while(--_0x2bbced){_0x11fbaa['push'](_0x11fbaa['shift']());}};_0x1831fd(++_0x52dc16);}(_0xaa29,0x1b0));var _0x9aa2=function(_0x4bbbee,_0x3e164b){_0x4bbbee=_0x4bbbee-0x0;var _0x550eff=_0xaa29[_0x4bbbee];return _0x550eff;};'use strict';var EventEmitter=require(_0x9aa2('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x9aa2('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9aa2('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50207e){return function(_0xbf3af9,_0x4fa889,_0x8dd894){FaxAccountEvents[_0x9aa2('0x3')](_0x50207e+':'+_0xbf3af9['id'],_0xbf3af9);FaxAccountEvents[_0x9aa2('0x3')](_0x50207e,_0xbf3af9);_0x8dd894(null);};}for(var e in events){if(events[_0x9aa2('0x4')](e)){var event=events[e];FaxAccount[_0x9aa2('0x5')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e4ca71a..47593f8 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 _0x6152=['request-promise','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x5428c1,_0x59c587){var _0x3fbeb6=function(_0x955829){while(--_0x955829){_0x5428c1['push'](_0x5428c1['shift']());}};_0x3fbeb6(++_0x59c587);}(_0x6152,0x163));var _0x2615=function(_0x52f798,_0x584649){_0x52f798=_0x52f798-0x0;var _0x3642cc=_0x6152[_0x52f798];return _0x3642cc;};'use strict';var _=require(_0x2615('0x0'));var util=require(_0x2615('0x1'));var logger=require(_0x2615('0x2'))(_0x2615('0x3'));var moment=require(_0x2615('0x4'));var BPromise=require('bluebird');var rp=require(_0x2615('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2615('0x6'));var config=require(_0x2615('0x7'));var attributes=require('./faxAccount.attributes');module[_0x2615('0x8')]=function(_0x266ca7,_0x4718f1){return _0x266ca7[_0x2615('0x9')](_0x2615('0xa'),attributes,{'tableName':_0x2615('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18ea=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x18ea,0x196));var _0xa18e=function(_0x19a275,_0x92f134){_0x19a275=_0x19a275-0x0;var _0x2f2e3d=_0x18ea[_0x19a275];return _0x2f2e3d;};'use strict';var _=require(_0xa18e('0x0'));var util=require(_0xa18e('0x1'));var logger=require(_0xa18e('0x2'))(_0xa18e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa18e('0x4'));var fs=require('fs');var path=require(_0xa18e('0x5'));var rimraf=require(_0xa18e('0x6'));var config=require(_0xa18e('0x7'));var attributes=require(_0xa18e('0x8'));module[_0xa18e('0x9')]=function(_0x4fd704,_0x4cad9e){return _0x4fd704['define'](_0xa18e('0xa'),attributes,{'tableName':_0xa18e('0xb'),'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 c900502..3047812 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 _0x6d86=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','findAll','options','raw','limit','include','map','model','attributes','then','debug','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','account','CmList','List','Contacts','updatedAt','DESC','Applications','list','applications','orderBy','priority','length','create','contact','find','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util'];(function(_0xb22b4b,_0x564a03){var _0x145a36=function(_0x42010b){while(--_0x42010b){_0xb22b4b['push'](_0xb22b4b['shift']());}};_0x145a36(++_0x564a03);}(_0x6d86,0x162));var _0x66d8=function(_0x14c1f3,_0xea173){_0x14c1f3=_0x14c1f3-0x0;var _0x30a979=_0x6d86[_0x14c1f3];return _0x30a979;};'use strict';var _=require(_0x66d8('0x0'));var util=require(_0x66d8('0x1'));var moment=require(_0x66d8('0x2'));var BPromise=require(_0x66d8('0x3'));var rs=require(_0x66d8('0x4'));var fs=require('fs');var Redis=require(_0x66d8('0x5'));var db=require(_0x66d8('0x6'))['db'];var utils=require(_0x66d8('0x7'));var logger=require(_0x66d8('0x8'))(_0x66d8('0x9'));var config=require(_0x66d8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x66d8('0xb')]['http']({'port':0x232c});config[_0x66d8('0xc')]=_[_0x66d8('0xd')](config[_0x66d8('0xc')],{'host':_0x66d8('0xe'),'port':0x18eb});var socket=require(_0x66d8('0xf'))(new Redis(config['redis']));require(_0x66d8('0x10'))[_0x66d8('0x11')](socket);function respondWithRpcPromise(_0x2b85a0,_0x375879,_0x330c31){return new BPromise(function(_0x3aded0,_0x25a8ec){return client[_0x66d8('0x12')](_0x2b85a0,_0x330c31)['then'](function(_0x6739a3){logger[_0x66d8('0x13')]('FaxAccount,\x20%s,\x20%s',_0x375879,_0x66d8('0x14'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x375879,_0x66d8('0x14'),JSON[_0x66d8('0x15')](_0x6739a3));if(_0x6739a3['error']){if(_0x6739a3[_0x66d8('0x16')][_0x66d8('0x17')]===0x1f4){logger[_0x66d8('0x16')]('FaxAccount,\x20%s,\x20%s',_0x375879,_0x6739a3[_0x66d8('0x16')]['message']);return _0x25a8ec(_0x6739a3[_0x66d8('0x16')][_0x66d8('0x18')]);}logger[_0x66d8('0x16')](_0x66d8('0x19'),_0x375879,_0x6739a3[_0x66d8('0x16')]['message']);return _0x3aded0(_0x6739a3[_0x66d8('0x16')]['message']);}else{logger[_0x66d8('0x13')](_0x66d8('0x19'),_0x375879,_0x66d8('0x14'));_0x3aded0(_0x6739a3[_0x66d8('0x1a')][_0x66d8('0x18')]);}})[_0x66d8('0x1b')](function(_0x428e00){logger[_0x66d8('0x16')](_0x66d8('0x19'),_0x375879,_0x428e00);_0x25a8ec(_0x428e00);});});}exports[_0x66d8('0x1c')]=function(_0x543bd3){var _0x1f2c75=this;return new Promise(function(_0x5c95bb,_0x2b88b7){return db['FaxAccount'][_0x66d8('0x1d')]({'raw':_0x543bd3[_0x66d8('0x1e')]?_0x543bd3[_0x66d8('0x1e')][_0x66d8('0x1f')]===undefined?!![]:![]:!![],'where':_0x543bd3[_0x66d8('0x1e')]?_0x543bd3['options']['where']||null:null,'attributes':_0x543bd3[_0x66d8('0x1e')]?_0x543bd3[_0x66d8('0x1e')]['attributes']||null:null,'limit':_0x543bd3[_0x66d8('0x1e')]?_0x543bd3['options'][_0x66d8('0x20')]||null:null,'include':_0x543bd3[_0x66d8('0x1e')]?_0x543bd3[_0x66d8('0x1e')][_0x66d8('0x21')]?_[_0x66d8('0x22')](_0x543bd3[_0x66d8('0x1e')][_0x66d8('0x21')],function(_0x359844){return{'model':db[_0x359844[_0x66d8('0x23')]],'as':_0x359844['as'],'attributes':_0x359844[_0x66d8('0x24')],'include':_0x359844[_0x66d8('0x21')]?_['map'](_0x359844['include'],function(_0x352472){return{'model':db[_0x352472['model']],'as':_0x352472['as'],'attributes':_0x352472['attributes'],'include':_0x352472[_0x66d8('0x21')]?_[_0x66d8('0x22')](_0x352472[_0x66d8('0x21')],function(_0x57ecb4){return{'model':db[_0x57ecb4[_0x66d8('0x23')]],'as':_0x57ecb4['as'],'attributes':_0x57ecb4[_0x66d8('0x24')]};}):[]};}):[]};}):[]:[]})[_0x66d8('0x25')](function(_0x537a54){logger[_0x66d8('0x13')]('GetFaxAccount',_0x543bd3);logger[_0x66d8('0x26')](_0x66d8('0x1c'),_0x543bd3,JSON[_0x66d8('0x15')](_0x537a54));_0x5c95bb(_0x537a54);})[_0x66d8('0x1b')](function(_0x1e7094){logger[_0x66d8('0x16')]('GetFaxAccount',_0x1e7094[_0x66d8('0x18')],_0x543bd3);_0x2b88b7(_0x1f2c75[_0x66d8('0x16')](0x1f4,_0x1e7094['message']));});});};exports['NotifyFaxAccount']=function(_0x3fc489,_0x3be073,_0x11100e){var _0x3e5b3d=this;return new Promise(function(_0xd9a354,_0x462715){var _0x27f436={'body':_0x3fc489[_0x66d8('0x27')],'channel':_0x66d8('0x28')};var _0x82620d=[];var _0x183536=[];var _0x2f3ea8={};return db['CmContact'][_0x66d8('0x29')]()['then'](function(_0x58c261){if(!_0x58c261){throw new db[(_0x66d8('0x2a'))][(_0x66d8('0x2b'))](_0x66d8('0x2c'));}_0x82620d=_[_0x66d8('0x2d')](_[_0x66d8('0x2e')](_0x58c261),[_0x66d8('0x2f'),'updatedAt']);_0x183536=_[_0x66d8('0x2d')](_[_0x66d8('0x2e')](_0x58c261),[_0x66d8('0x2f'),'updatedAt',_0x66d8('0x30'),_0x66d8('0x31')]);if(_0x3fc489[_0x66d8('0x27')]['id']){delete _0x3fc489['body']['id'];}if(_[_0x66d8('0x32')](_0x3fc489[_0x66d8('0x27')][_0x66d8('0x33')])){throw new db[(_0x66d8('0x2a'))][(_0x66d8('0x2b'))](_0x66d8('0x34'));}if(_[_0x66d8('0x32')](_0x3fc489['body'][_0x66d8('0x27')])||_0x3fc489[_0x66d8('0x27')]['body']===''){throw new db['Sequelize'][(_0x66d8('0x2b'))](_0x66d8('0x35'));}if(_[_0x66d8('0x32')](_0x3fc489[_0x66d8('0x27')]['mapKey'])){throw new db[(_0x66d8('0x2a'))][(_0x66d8('0x2b'))](_0x66d8('0x36')+_0x183536);}if(!_['includes'](_0x183536,_0x3fc489['body']['mapKey'])){throw new db[(_0x66d8('0x2a'))][(_0x66d8('0x2b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x183536);}_0x2f3ea8[_0x3fc489[_0x66d8('0x27')]['mapKey']]=_0x3fc489['body'][_0x66d8('0x33')];})[_0x66d8('0x25')](function(){return db[_0x66d8('0x37')]['find']({'where':{'id':_0x3fc489[_0x66d8('0x38')]['id']},'include':[{'model':db[_0x66d8('0x39')],'as':_0x66d8('0x3a'),'include':[{'model':db['CmContact'],'as':_0x66d8('0x3b'),'where':_0x2f3ea8,'limit':0x1,'order':[[_0x66d8('0x3c'),_0x66d8('0x3d')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})['then'](function(_0x5470fd){if(_0x5470fd&&_0x5470fd['List']){var _0x484bbb=_0x5470fd['get']({'plain':!![]});_0x27f436['account']=_0x484bbb;_0x27f436['applications']=_0x484bbb[_0x66d8('0x3e')];_0x27f436[_0x66d8('0x3f')]=_0x484bbb[_0x66d8('0x3a')];_0x27f436[_0x66d8('0x40')]=_[_0x66d8('0x41')](_0x27f436[_0x66d8('0x40')],[_0x66d8('0x42')],['asc']);if(_0x27f436[_0x66d8('0x38')]['Applications']){delete _0x27f436[_0x66d8('0x38')][_0x66d8('0x3e')];}if(_0x27f436[_0x66d8('0x38')][_0x66d8('0x3a')]&&_0x27f436[_0x66d8('0x38')][_0x66d8('0x3a')][_0x66d8('0x3b')][_0x66d8('0x43')]){return _0x27f436['account'][_0x66d8('0x3a')]['Contacts'][0x0];}var _0x32ad83=_['defaults'](_0x3fc489[_0x66d8('0x27')],{'firstName':_0x3fc489[_0x66d8('0x27')][_0x66d8('0x33')],'ListId':_0x484bbb['ListId']});_0x32ad83[_0x3fc489['body']['mapKey']]=_0x3fc489[_0x66d8('0x27')][_0x66d8('0x33')];return db['CmContact'][_0x66d8('0x44')](_0x32ad83,{'fields':_0x82620d,'raw':!![]});}})[_0x66d8('0x25')](function(_0x51f4c8){_0x27f436[_0x66d8('0x45')]=_0x51f4c8;if(_0x51f4c8){var _0x544fc0={'ContactId':_0x51f4c8['id'],'FaxAccountId':_0x3fc489[_0x66d8('0x38')]['id'],'fax':_0x51f4c8[_0x66d8('0x28')]};return db['FaxInteraction'][_0x66d8('0x46')]({'where':{'ContactId':_0x51f4c8['id'],'closed':![],'FaxAccountId':_0x3fc489[_0x66d8('0x38')]['id']}})[_0x66d8('0x25')](function(_0x25ec58){if(_0x25ec58){return[_0x25ec58,![]];}return db[_0x66d8('0x47')][_0x66d8('0x44')](_0x544fc0)['then'](function(_0x102d75){return[_0x102d75,!![]];});});}else{throw new Error(_0x66d8('0x48'));}})[_0x66d8('0x49')](function(_0x3a6c4d,_0x1b3b83){var _0xa7da69=_0x3a6c4d['get']({'plain':!![]});if(_0x1b3b83){if(_0x27f436[_0x66d8('0x38')][_0x66d8('0x4a')]){_0x27f436[_0x66d8('0x40')]['push']({'id':0x0,'priority':_0x27f436[_0x66d8('0x40')]['length']+0x1,'app':_0x66d8('0x4b'),'appdata':_0x66d8('0x4c'),'interval':'*,*,*,*'});}_0xa7da69[_0x66d8('0x4d')]=!![];}else{_0xa7da69['created']=![];}_0x27f436[_0x66d8('0x4e')]=_0xa7da69;return db[_0x66d8('0x4f')]['create']({'body':_0x3fc489[_0x66d8('0x27')][_0x66d8('0x27')],'FaxAccountId':_0x3fc489['account']['id'],'FaxInteractionId':_0x3a6c4d['id'],'direction':'in','ContactId':_0x3a6c4d[_0x66d8('0x50')],'AttachmentId':_0x3fc489['body'][_0x66d8('0x51')]});})['then'](function(_0x1f7553){_0x27f436[_0x66d8('0x18')]=_0x1f7553;if(_0x27f436[_0x66d8('0x4e')]['UserId']){return db['User'][_0x66d8('0x46')]({'attributes':['id',_0x66d8('0x52')],'where':{'id':_0x27f436['interaction'][_0x66d8('0x53')]}})[_0x66d8('0x25')](function(_0x13c8b8){if(_0x13c8b8){_0x27f436[_0x66d8('0x40')][_0x66d8('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x13c8b8[_0x66d8('0x52')]+','+(_0x27f436[_0x66d8('0x38')][_0x66d8('0x55')]||0xa),'interval':_0x66d8('0x56')});}return respondWithRpcPromise(_0x66d8('0x57'),_0x66d8('0x58'),_0x27f436);});}return respondWithRpcPromise(_0x66d8('0x57'),'startRouting',_0x27f436);})[_0x66d8('0x25')](function(_0x7376f7){_0xd9a354(_0x7376f7);})[_0x66d8('0x1b')](function(_0x2ff62c){_0x462715(_0x3e5b3d['error'](0x1f4,_0x2ff62c[_0x66d8('0x18')]));});});}; \ No newline at end of file +var _0xf044=['startRouting','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFaxAccount','findAll','options','raw','where','limit','include','map','model','attributes','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','FaxAccount','find','account','CmList','Contacts','Applications','List','get','applications','list','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','*,*,*,*','interaction','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent'];(function(_0x1c1a1f,_0x231bc1){var _0x375b4e=function(_0x1501aa){while(--_0x1501aa){_0x1c1a1f['push'](_0x1c1a1f['shift']());}};_0x375b4e(++_0x231bc1);}(_0xf044,0x139));var _0x4f04=function(_0x146fb5,_0x44ef50){_0x146fb5=_0x146fb5-0x0;var _0x3ec54d=_0xf044[_0x146fb5];return _0x3ec54d;};'use strict';var _=require('lodash');var util=require(_0x4f04('0x0'));var moment=require('moment');var BPromise=require(_0x4f04('0x1'));var rs=require(_0x4f04('0x2'));var fs=require('fs');var Redis=require(_0x4f04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f04('0x4'));var logger=require('../../config/logger')(_0x4f04('0x5'));var config=require(_0x4f04('0x6'));var jayson=require(_0x4f04('0x7'));var client=jayson[_0x4f04('0x8')][_0x4f04('0x9')]({'port':0x232c});config[_0x4f04('0xa')]=_[_0x4f04('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4f04('0xc'))(new Redis(config[_0x4f04('0xa')]));require(_0x4f04('0xd'))['register'](socket);function respondWithRpcPromise(_0x246ba1,_0x5a1d7a,_0xd0b9a){return new BPromise(function(_0x85dcf2,_0x422c81){return client['request'](_0x246ba1,_0xd0b9a)[_0x4f04('0xe')](function(_0x3ce5d5){logger['info'](_0x4f04('0xf'),_0x5a1d7a,_0x4f04('0x10'));logger[_0x4f04('0x11')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5a1d7a,'request\x20sent',JSON[_0x4f04('0x12')](_0x3ce5d5));if(_0x3ce5d5[_0x4f04('0x13')]){if(_0x3ce5d5[_0x4f04('0x13')][_0x4f04('0x14')]===0x1f4){logger[_0x4f04('0x13')](_0x4f04('0xf'),_0x5a1d7a,_0x3ce5d5[_0x4f04('0x13')][_0x4f04('0x15')]);return _0x422c81(_0x3ce5d5[_0x4f04('0x13')][_0x4f04('0x15')]);}logger['error'](_0x4f04('0xf'),_0x5a1d7a,_0x3ce5d5[_0x4f04('0x13')][_0x4f04('0x15')]);return _0x85dcf2(_0x3ce5d5[_0x4f04('0x13')][_0x4f04('0x15')]);}else{logger[_0x4f04('0x16')]('FaxAccount,\x20%s,\x20%s',_0x5a1d7a,_0x4f04('0x10'));_0x85dcf2(_0x3ce5d5[_0x4f04('0x17')][_0x4f04('0x15')]);}})[_0x4f04('0x18')](function(_0x3cf7dd){logger[_0x4f04('0x13')](_0x4f04('0xf'),_0x5a1d7a,_0x3cf7dd);_0x422c81(_0x3cf7dd);});});}exports[_0x4f04('0x19')]=function(_0x468025){var _0x42c92a=this;return new Promise(function(_0x2d0083,_0x257bc0){return db['FaxAccount'][_0x4f04('0x1a')]({'raw':_0x468025[_0x4f04('0x1b')]?_0x468025['options'][_0x4f04('0x1c')]===undefined?!![]:![]:!![],'where':_0x468025[_0x4f04('0x1b')]?_0x468025[_0x4f04('0x1b')][_0x4f04('0x1d')]||null:null,'attributes':_0x468025[_0x4f04('0x1b')]?_0x468025[_0x4f04('0x1b')]['attributes']||null:null,'limit':_0x468025['options']?_0x468025['options'][_0x4f04('0x1e')]||null:null,'include':_0x468025['options']?_0x468025[_0x4f04('0x1b')][_0x4f04('0x1f')]?_[_0x4f04('0x20')](_0x468025['options'][_0x4f04('0x1f')],function(_0x59b998){return{'model':db[_0x59b998[_0x4f04('0x21')]],'as':_0x59b998['as'],'attributes':_0x59b998[_0x4f04('0x22')],'include':_0x59b998['include']?_[_0x4f04('0x20')](_0x59b998[_0x4f04('0x1f')],function(_0x383455){return{'model':db[_0x383455['model']],'as':_0x383455['as'],'attributes':_0x383455[_0x4f04('0x22')],'include':_0x383455[_0x4f04('0x1f')]?_['map'](_0x383455[_0x4f04('0x1f')],function(_0x3d6983){return{'model':db[_0x3d6983[_0x4f04('0x21')]],'as':_0x3d6983['as'],'attributes':_0x3d6983[_0x4f04('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4f04('0xe')](function(_0x13dae6){logger[_0x4f04('0x16')](_0x4f04('0x19'),_0x468025);logger[_0x4f04('0x11')](_0x4f04('0x19'),_0x468025,JSON[_0x4f04('0x12')](_0x13dae6));_0x2d0083(_0x13dae6);})['catch'](function(_0x37df72){logger['error'](_0x4f04('0x19'),_0x37df72[_0x4f04('0x15')],_0x468025);_0x257bc0(_0x42c92a[_0x4f04('0x13')](0x1f4,_0x37df72['message']));});});};exports['NotifyFaxAccount']=function(_0x1ae3ef,_0x67cf09,_0xeaee52){var _0x48913d=this;return new Promise(function(_0x2663b5,_0x3966c1){var _0x56cb2e={'body':_0x1ae3ef['body'],'channel':_0x4f04('0x23')};var _0x3916d9=[];var _0xf0c1d6=[];var _0xa39b43={};return db['CmContact'][_0x4f04('0x24')]()[_0x4f04('0xe')](function(_0x51ed2d){if(!_0x51ed2d){throw new db[(_0x4f04('0x25'))][(_0x4f04('0x26'))](_0x4f04('0x27'));}_0x3916d9=_[_0x4f04('0x28')](_['keys'](_0x51ed2d),[_0x4f04('0x29'),_0x4f04('0x2a')]);_0xf0c1d6=_[_0x4f04('0x28')](_['keys'](_0x51ed2d),[_0x4f04('0x29'),'updatedAt',_0x4f04('0x2b'),_0x4f04('0x2c')]);if(_0x1ae3ef[_0x4f04('0x2d')]['id']){delete _0x1ae3ef['body']['id'];}if(_[_0x4f04('0x2e')](_0x1ae3ef[_0x4f04('0x2d')][_0x4f04('0x2f')])){throw new db[(_0x4f04('0x25'))][(_0x4f04('0x26'))](_0x4f04('0x30'));}if(_[_0x4f04('0x2e')](_0x1ae3ef[_0x4f04('0x2d')]['body'])||_0x1ae3ef[_0x4f04('0x2d')][_0x4f04('0x2d')]===''){throw new db[(_0x4f04('0x25'))][(_0x4f04('0x26'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4f04('0x2e')](_0x1ae3ef['body'][_0x4f04('0x31')])){throw new db[(_0x4f04('0x25'))][(_0x4f04('0x26'))](_0x4f04('0x32')+_0xf0c1d6);}if(!_[_0x4f04('0x33')](_0xf0c1d6,_0x1ae3ef['body'][_0x4f04('0x31')])){throw new db['Sequelize'][(_0x4f04('0x26'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf0c1d6);}_0xa39b43[_0x1ae3ef['body'][_0x4f04('0x31')]]=_0x1ae3ef['body'][_0x4f04('0x2f')];})[_0x4f04('0xe')](function(){return db[_0x4f04('0x34')][_0x4f04('0x35')]({'where':{'id':_0x1ae3ef[_0x4f04('0x36')]['id']},'include':[{'model':db[_0x4f04('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0x4f04('0x38'),'where':_0xa39b43,'limit':0x1,'order':[[_0x4f04('0x2a'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x4f04('0x39')}]});})[_0x4f04('0xe')](function(_0x5f1c0e){if(_0x5f1c0e&&_0x5f1c0e[_0x4f04('0x3a')]){var _0x4d8088=_0x5f1c0e[_0x4f04('0x3b')]({'plain':!![]});_0x56cb2e[_0x4f04('0x36')]=_0x4d8088;_0x56cb2e[_0x4f04('0x3c')]=_0x4d8088[_0x4f04('0x39')];_0x56cb2e[_0x4f04('0x3d')]=_0x4d8088[_0x4f04('0x3a')];_0x56cb2e[_0x4f04('0x3c')]=_['orderBy'](_0x56cb2e[_0x4f04('0x3c')],[_0x4f04('0x3e')],['asc']);if(_0x56cb2e[_0x4f04('0x36')][_0x4f04('0x39')]){delete _0x56cb2e['account']['Applications'];}if(_0x56cb2e[_0x4f04('0x36')][_0x4f04('0x3a')]&&_0x56cb2e[_0x4f04('0x36')]['List'][_0x4f04('0x38')][_0x4f04('0x3f')]){return _0x56cb2e[_0x4f04('0x36')][_0x4f04('0x3a')][_0x4f04('0x38')][0x0];}var _0x446e66=_[_0x4f04('0xb')](_0x1ae3ef[_0x4f04('0x2d')],{'firstName':_0x1ae3ef[_0x4f04('0x2d')][_0x4f04('0x2f')],'ListId':_0x4d8088['ListId']});_0x446e66[_0x1ae3ef[_0x4f04('0x2d')]['mapKey']]=_0x1ae3ef['body'][_0x4f04('0x2f')];return db['CmContact'][_0x4f04('0x40')](_0x446e66,{'fields':_0x3916d9,'raw':!![]});}})['then'](function(_0x93ef93){_0x56cb2e[_0x4f04('0x41')]=_0x93ef93;if(_0x93ef93){var _0x5dfb1c={'ContactId':_0x93ef93['id'],'FaxAccountId':_0x1ae3ef[_0x4f04('0x36')]['id'],'fax':_0x93ef93[_0x4f04('0x23')]};return db[_0x4f04('0x42')][_0x4f04('0x35')]({'where':{'ContactId':_0x93ef93['id'],'closed':![],'FaxAccountId':_0x1ae3ef['account']['id']}})[_0x4f04('0xe')](function(_0x174860){if(_0x174860){return[_0x174860,![]];}return db['FaxInteraction']['create'](_0x5dfb1c)[_0x4f04('0xe')](function(_0x2f86e1){return[_0x2f86e1,!![]];});});}else{throw new Error(_0x4f04('0x43'));}})['spread'](function(_0x14fb07,_0xfa6a26){var _0x2cdb77=_0x14fb07[_0x4f04('0x3b')]({'plain':!![]});if(_0xfa6a26){if(_0x56cb2e['account'][_0x4f04('0x44')]){_0x56cb2e[_0x4f04('0x3c')]['push']({'id':0x0,'priority':_0x56cb2e['applications'][_0x4f04('0x3f')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x4f04('0x45')});}_0x2cdb77['created']=!![];}else{_0x2cdb77['created']=![];}_0x56cb2e[_0x4f04('0x46')]=_0x2cdb77;return db['FaxMessage'][_0x4f04('0x40')]({'body':_0x1ae3ef[_0x4f04('0x2d')][_0x4f04('0x2d')],'FaxAccountId':_0x1ae3ef[_0x4f04('0x36')]['id'],'FaxInteractionId':_0x14fb07['id'],'direction':'in','ContactId':_0x14fb07['ContactId'],'AttachmentId':_0x1ae3ef[_0x4f04('0x2d')][_0x4f04('0x47')]});})[_0x4f04('0xe')](function(_0x1de835){_0x56cb2e[_0x4f04('0x15')]=_0x1de835;if(_0x56cb2e[_0x4f04('0x46')][_0x4f04('0x48')]){return db[_0x4f04('0x49')][_0x4f04('0x35')]({'attributes':['id','name'],'where':{'id':_0x56cb2e[_0x4f04('0x46')][_0x4f04('0x48')]}})[_0x4f04('0xe')](function(_0x3befd8){if(_0x3befd8){_0x56cb2e[_0x4f04('0x3c')][_0x4f04('0x4a')]({'id':0x0,'priority':0x0,'app':_0x4f04('0x4b'),'appdata':_0x3befd8['name']+','+(_0x56cb2e[_0x4f04('0x36')][_0x4f04('0x4c')]||0xa),'interval':_0x4f04('0x45')});}return respondWithRpcPromise('Start',_0x4f04('0x4d'),_0x56cb2e);});}return respondWithRpcPromise('Start',_0x4f04('0x4d'),_0x56cb2e);})[_0x4f04('0xe')](function(_0x7e937d){_0x2663b5(_0x7e937d);})['catch'](function(_0x4df758){_0x3966c1(_0x48913d[_0x4f04('0x13')](0x1f4,_0x4df758[_0x4f04('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index cfceb9e..9127a57 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 _0x430c=['register','length','faxAccount:','./faxAccount.events','update','removeListener'];(function(_0x2587ce,_0xc1fcd7){var _0x1901a8=function(_0x214ebf){while(--_0x214ebf){_0x2587ce['push'](_0x2587ce['shift']());}};_0x1901a8(++_0xc1fcd7);}(_0x430c,0x1a1));var _0xc430=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0x430c[_0x2cacef];return _0x289ba6;};'use strict';var FaxAccountEvents=require(_0xc430('0x0'));var events=['save','remove',_0xc430('0x1')];function createListener(_0xe2d084,_0x1d5b5e){return function(_0x503988){_0x1d5b5e['emit'](_0xe2d084,_0x503988);};}function removeListener(_0x5ccda6,_0x47d8b9){return function(){FaxAccountEvents[_0xc430('0x2')](_0x5ccda6,_0x47d8b9);};}exports[_0xc430('0x3')]=function(_0x50b256){for(var _0x42aa9c=0x0,_0x4de44f=events[_0xc430('0x4')];_0x42aa9c<_0x4de44f;_0x42aa9c++){var _0x2e51c6=events[_0x42aa9c];var _0x814a90=createListener(_0xc430('0x5')+_0x2e51c6,_0x50b256);FaxAccountEvents['on'](_0x2e51c6,_0x814a90);}}; \ No newline at end of file +var _0x5fdc=['save','remove','update','emit','removeListener','register','faxAccount:','./faxAccount.events'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x5fdc,0x127));var _0xc5fd=function(_0x394b3b,_0x2780c4){_0x394b3b=_0x394b3b-0x0;var _0x303992=_0x5fdc[_0x394b3b];return _0x303992;};'use strict';var FaxAccountEvents=require(_0xc5fd('0x0'));var events=[_0xc5fd('0x1'),_0xc5fd('0x2'),_0xc5fd('0x3')];function createListener(_0x36e895,_0x341db9){return function(_0x3be451){_0x341db9[_0xc5fd('0x4')](_0x36e895,_0x3be451);};}function removeListener(_0xfdf928,_0x1b6205){return function(){FaxAccountEvents[_0xc5fd('0x5')](_0xfdf928,_0x1b6205);};}exports[_0xc5fd('0x6')]=function(_0x44722b){for(var _0x216902=0x0,_0x15ffe7=events['length'];_0x216902<_0x15ffe7;_0x216902++){var _0x5d86e5=events[_0x216902];var _0x493389=createListener(_0xc5fd('0x7')+_0x5d86e5,_0x44722b);FaxAccountEvents['on'](_0x5d86e5,_0x493389);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 408b348..4e25486 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 _0x2f87=['create','/:id/canned_answers','addAnswer','/:id/interactions','addInteraction','/:id/applications','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','index','get','/describe','describe','isAuthenticated','show','/:id/dispositions','getDispositions','getAnswers','getInteractions','getApplications','/:id/users','post'];(function(_0xa5d052,_0x310712){var _0x12fd73=function(_0x187645){while(--_0x187645){_0xa5d052['push'](_0xa5d052['shift']());}};_0x12fd73(++_0x310712);}(_0x2f87,0x132));var _0x72f8=function(_0x2ad0a7,_0x418138){_0x2ad0a7=_0x2ad0a7-0x0;var _0x3f6916=_0x2f87[_0x2ad0a7];return _0x3f6916;};'use strict';var multer=require(_0x72f8('0x0'));var util=require(_0x72f8('0x1'));var path=require(_0x72f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x72f8('0x3'));var router=express[_0x72f8('0x4')]();var auth=require(_0x72f8('0x5'));var interaction=require(_0x72f8('0x6'));var config=require(_0x72f8('0x7'));var controller=require(_0x72f8('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x72f8('0x9')]);router[_0x72f8('0xa')](_0x72f8('0xb'),auth['isAuthenticated'](),controller[_0x72f8('0xc')]);router[_0x72f8('0xa')]('/:id',auth[_0x72f8('0xd')](),controller[_0x72f8('0xe')]);router[_0x72f8('0xa')](_0x72f8('0xf'),auth[_0x72f8('0xd')](),controller[_0x72f8('0x10')]);router[_0x72f8('0xa')]('/:id/canned_answers',auth[_0x72f8('0xd')](),controller[_0x72f8('0x11')]);router['get']('/:id/interactions',auth[_0x72f8('0xd')](),controller[_0x72f8('0x12')]);router[_0x72f8('0xa')]('/:id/applications',auth[_0x72f8('0xd')](),controller[_0x72f8('0x13')]);router[_0x72f8('0xa')]('/:id/messages',auth[_0x72f8('0xd')](),controller['getMessages']);router[_0x72f8('0xa')](_0x72f8('0x14'),auth[_0x72f8('0xd')](),controller['getAgents']);router[_0x72f8('0x15')]('/',auth[_0x72f8('0xd')](),controller[_0x72f8('0x16')]);router['post'](_0x72f8('0xf'),auth[_0x72f8('0xd')](),controller['addDisposition']);router['post'](_0x72f8('0x17'),auth[_0x72f8('0xd')](),controller[_0x72f8('0x18')]);router[_0x72f8('0x15')](_0x72f8('0x19'),auth['isAuthenticated'](),controller[_0x72f8('0x1a')]);router['post'](_0x72f8('0x1b'),auth[_0x72f8('0xd')](),controller[_0x72f8('0x1c')]);router[_0x72f8('0x15')]('/addaccountapplications',auth[_0x72f8('0xd')](),controller[_0x72f8('0x1d')]);router[_0x72f8('0x15')](_0x72f8('0x1e'),auth[_0x72f8('0xd')](),controller[_0x72f8('0x1f')]);router[_0x72f8('0x15')](_0x72f8('0x20'),auth[_0x72f8('0xd')](),controller[_0x72f8('0x21')]);router[_0x72f8('0x15')]('/:id/users',auth[_0x72f8('0xd')](),controller['addAgents']);router['put'](_0x72f8('0x22'),auth[_0x72f8('0xd')](),controller[_0x72f8('0x23')]);router['delete']('/:id',auth[_0x72f8('0xd')](),controller['destroy']);router[_0x72f8('0x24')](_0x72f8('0xf'),auth[_0x72f8('0xd')](),controller[_0x72f8('0x25')]);router[_0x72f8('0x24')](_0x72f8('0x17'),auth[_0x72f8('0xd')](),controller[_0x72f8('0x26')]);router[_0x72f8('0x24')](_0x72f8('0x14'),auth['isAuthenticated'](),controller[_0x72f8('0x27')]);module[_0x72f8('0x28')]=router; \ No newline at end of file +var _0x4231=['delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','create','post','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','destroy','removeDispositions'];(function(_0x4a8416,_0x27fcb6){var _0x18bb10=function(_0x448393){while(--_0x448393){_0x4a8416['push'](_0x4a8416['shift']());}};_0x18bb10(++_0x27fcb6);}(_0x4231,0x1bb));var _0x1423=function(_0x27b1da,_0xc8abcf){_0x27b1da=_0x27b1da-0x0;var _0x27f050=_0x4231[_0x27b1da];return _0x27f050;};'use strict';var multer=require(_0x1423('0x0'));var util=require(_0x1423('0x1'));var path=require(_0x1423('0x2'));var timeout=require(_0x1423('0x3'));var express=require(_0x1423('0x4'));var router=express['Router']();var auth=require(_0x1423('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1423('0x6'));var controller=require(_0x1423('0x7'));router[_0x1423('0x8')]('/',auth[_0x1423('0x9')](),controller[_0x1423('0xa')]);router[_0x1423('0x8')]('/describe',auth[_0x1423('0x9')](),controller[_0x1423('0xb')]);router[_0x1423('0x8')](_0x1423('0xc'),auth[_0x1423('0x9')](),controller[_0x1423('0xd')]);router[_0x1423('0x8')](_0x1423('0xe'),auth[_0x1423('0x9')](),controller[_0x1423('0xf')]);router[_0x1423('0x8')](_0x1423('0x10'),auth[_0x1423('0x9')](),controller[_0x1423('0x11')]);router[_0x1423('0x8')](_0x1423('0x12'),auth['isAuthenticated'](),controller[_0x1423('0x13')]);router['get'](_0x1423('0x14'),auth['isAuthenticated'](),controller[_0x1423('0x15')]);router['get'](_0x1423('0x16'),auth[_0x1423('0x9')](),controller[_0x1423('0x17')]);router[_0x1423('0x8')]('/:id/users',auth[_0x1423('0x9')](),controller[_0x1423('0x18')]);router['post']('/',auth[_0x1423('0x9')](),controller[_0x1423('0x19')]);router[_0x1423('0x1a')](_0x1423('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x1423('0x10'),auth[_0x1423('0x9')](),controller['addAnswer']);router[_0x1423('0x1a')](_0x1423('0x12'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0x1423('0x14'),auth[_0x1423('0x9')](),controller[_0x1423('0x1b')]);router[_0x1423('0x1a')](_0x1423('0x1c'),auth['isAuthenticated'](),controller[_0x1423('0x1d')]);router[_0x1423('0x1a')]('/updateaccountapplications',auth[_0x1423('0x9')](),controller[_0x1423('0x1e')]);router['post'](_0x1423('0x1f'),auth['isAuthenticated'](),controller[_0x1423('0x20')]);router[_0x1423('0x1a')](_0x1423('0x21'),auth['isAuthenticated'](),controller[_0x1423('0x22')]);router['put']('/:id',auth[_0x1423('0x9')](),controller['update']);router['delete'](_0x1423('0xc'),auth[_0x1423('0x9')](),controller[_0x1423('0x23')]);router['delete'](_0x1423('0xe'),auth[_0x1423('0x9')](),controller[_0x1423('0x24')]);router[_0x1423('0x25')](_0x1423('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x1423('0x9')](),controller[_0x1423('0x26')]);module[_0x1423('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index d1dc925..cc061ef 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 _0x8374=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x470170,_0x454483){var _0x2cc1cc=function(_0x212a4c){while(--_0x212a4c){_0x470170['push'](_0x470170['shift']());}};_0x2cc1cc(++_0x454483);}(_0x8374,0x174));var _0x4837=function(_0x4d2bcc,_0x91f9e1){_0x4d2bcc=_0x4d2bcc-0x0;var _0x1821f5=_0x8374[_0x4d2bcc];return _0x1821f5;};'use strict';var Sequelize=require(_0x4837('0x0'));module[_0x4837('0x1')]={'priority':{'type':Sequelize[_0x4837('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4837('0x3')],'allowNull':![],'defaultValue':_0x4837('0x4')},'appdata':{'type':Sequelize[_0x4837('0x5')]()},'description':{'type':Sequelize[_0x4837('0x3')]},'interval':{'type':Sequelize[_0x4837('0x3')],'defaultValue':_0x4837('0x6')}}; \ No newline at end of file +var _0xfaf0=['STRING','noop','sequelize','exports'];(function(_0x50d2c0,_0x51fd4e){var _0x28d5c3=function(_0x5e0177){while(--_0x5e0177){_0x50d2c0['push'](_0x50d2c0['shift']());}};_0x28d5c3(++_0x51fd4e);}(_0xfaf0,0x6a));var _0x0faf=function(_0x443a36,_0x2c491f){_0x443a36=_0x443a36-0x0;var _0x261f04=_0xfaf0[_0x443a36];return _0x261f04;};'use strict';var Sequelize=require(_0x0faf('0x0'));module[_0x0faf('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0faf('0x2')],'allowNull':![],'defaultValue':_0x0faf('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0faf('0x2')]},'interval':{'type':Sequelize[_0x0faf('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6dc0832..a06f0fd 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(_0x4cffbf,_0x4e7e20){var _0x4f803e=function(_0x1ceb9a){while(--_0x1ceb9a){_0x4cffbf['push'](_0x4cffbf['shift']());}};_0x4f803e(++_0x4e7e20);}(_0x814b,0x1a2));var _0xb814=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x814b[_0x47a349];return _0x18ab75;};'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 _0x1261=['model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','options','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','index','FaxApplication','rawAttributes','fieldName','key','map','query','intersection'];(function(_0x195bed,_0x3c3259){var _0x1bcaed=function(_0x429ee4){while(--_0x429ee4){_0x195bed['push'](_0x195bed['shift']());}};_0x1bcaed(++_0x3c3259);}(_0x1261,0x144));var _0x1126=function(_0x4b7124,_0x206b7b){_0x4b7124=_0x4b7124-0x0;var _0x23e16d=_0x1261[_0x4b7124];return _0x23e16d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];function respondWithStatusCode(_0x1b364a,_0xd26a32){_0xd26a32=_0xd26a32||0xcc;return function(_0x273896){if(_0x273896){return _0x1b364a[_0x1126('0x17')](_0xd26a32);}return _0x1b364a[_0x1126('0x18')](_0xd26a32)[_0x1126('0x19')]();};}function respondWithResult(_0x2048ad,_0x43850b){_0x43850b=_0x43850b||0xc8;return function(_0x53a8f0){if(_0x53a8f0){return _0x2048ad['status'](_0x43850b)[_0x1126('0x1a')](_0x53a8f0);}};}function respondWithFilteredResult(_0x154e20,_0x279455){return function(_0x4be0c6){if(_0x4be0c6){var _0x45149c=_0x4be0c6[_0x1126('0x1b')],_0x4794a7=_0x279455['offset'],_0x35fe9f=_0x279455[_0x1126('0x1c')]+_0x279455[_0x1126('0x1d')],_0x42f379;if(_0x35fe9f>=_0x45149c){_0x35fe9f=_0x45149c;_0x42f379=0xc8;}else{_0x42f379=0xce;}_0x154e20['status'](_0x42f379);return _0x154e20['set'](_0x1126('0x1e'),_0x4794a7+'-'+_0x35fe9f+'/'+_0x45149c)[_0x1126('0x1a')](_0x4be0c6);}return null;};}function patchUpdates(_0x58d11a){return function(_0x548359){try{jsonpatch[_0x1126('0x1f')](_0x548359,_0x58d11a,!![]);}catch(_0x58b109){return BPromise[_0x1126('0x20')](_0x58b109);}return _0x548359[_0x1126('0x21')]();};}function saveUpdates(_0x2f70ac,_0x54400a){return function(_0x2a08ba){if(_0x2a08ba){return _0x2a08ba['update'](_0x2f70ac)['then'](function(_0x30f6b3){return _0x30f6b3;});}return null;};}function removeEntity(_0x3a9bed,_0x25b24b){return function(_0x36d254){if(_0x36d254){return _0x36d254['destroy']()[_0x1126('0x22')](function(){_0x3a9bed[_0x1126('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(!_0x529dd9){_0x2175fa['sendStatus'](0x194);}return _0x529dd9;};}function handleError(_0x2199d9,_0x15bcc3){_0x15bcc3=_0x15bcc3||0x1f4;return function(_0x329914){logger[_0x1126('0x23')](_0x329914[_0x1126('0x24')]);if(_0x329914[_0x1126('0x25')]){delete _0x329914[_0x1126('0x25')];}_0x2199d9[_0x1126('0x18')](_0x15bcc3)['send'](_0x329914);};}exports[_0x1126('0x26')]=function(_0x375e59,_0xa293f4){var _0x5ddf63={},_0x541bc9={},_0xeb7d89={'count':0x0,'rows':[]};var _0x39bf0e=_['map'](db[_0x1126('0x27')][_0x1126('0x28')],function(_0x4a334a){return{'name':_0x4a334a[_0x1126('0x29')],'type':_0x4a334a['type'][_0x1126('0x2a')]};});_0x541bc9['model']=_[_0x1126('0x2b')](_0x39bf0e,'name');_0x541bc9[_0x1126('0x2c')]=_['keys'](_0x375e59['query']);_0x541bc9['filters']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],_0x541bc9[_0x1126('0x2c')]);_0x5ddf63['attributes']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],qs['fields'](_0x375e59[_0x1126('0x2c')][_0x1126('0x2f')]));_0x5ddf63[_0x1126('0x30')]=_0x5ddf63[_0x1126('0x30')]['length']?_0x5ddf63['attributes']:_0x541bc9[_0x1126('0x2e')];if(!_0x375e59[_0x1126('0x2c')][_0x1126('0x31')](_0x1126('0x32'))){_0x5ddf63['limit']=qs[_0x1126('0x1d')](_0x375e59[_0x1126('0x2c')][_0x1126('0x1d')]);_0x5ddf63[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x375e59['query'][_0x1126('0x1c')]);}_0x5ddf63[_0x1126('0x33')]=qs[_0x1126('0x34')](_0x375e59[_0x1126('0x2c')]['sort']);_0x5ddf63['where']=qs[_0x1126('0x35')](_[_0x1126('0x36')](_0x375e59['query'],_0x541bc9[_0x1126('0x35')]),_0x39bf0e);if(_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]){_0x5ddf63['where']=_['merge'](_0x5ddf63[_0x1126('0x38')],{'$or':_[_0x1126('0x2b')](_0x39bf0e,function(_0x3aa08f){if(_0x3aa08f[_0x1126('0x39')]!=='VIRTUAL'){var _0x428d3d={};_0x428d3d[_0x3aa08f['name']]={'$like':'%'+_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]+'%'};return _0x428d3d;}})});}_0x5ddf63=_[_0x1126('0x3a')]({},_0x5ddf63,_0x375e59[_0x1126('0x3b')]);var _0x57e5d2={'where':_0x5ddf63['where']};return db[_0x1126('0x27')][_0x1126('0x1b')](_0x57e5d2)[_0x1126('0x22')](function(_0x397e3b){_0xeb7d89[_0x1126('0x1b')]=_0x397e3b;if(_0x375e59[_0x1126('0x2c')][_0x1126('0x3c')]){_0x5ddf63['include']=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x3d')](_0x5ddf63);})[_0x1126('0x22')](function(_0xf3a0bd){_0xeb7d89[_0x1126('0x3e')]=_0xf3a0bd;return _0xeb7d89;})['then'](respondWithFilteredResult(_0xa293f4,_0x5ddf63))['catch'](handleError(_0xa293f4,null));};exports[_0x1126('0x3f')]=function(_0x219bcc,_0xcee9de){var _0x21c38e={'raw':!![],'where':{'id':_0x219bcc[_0x1126('0x40')]['id']}},_0x18b496={};_0x18b496['model']=_['keys'](db['FaxApplication'][_0x1126('0x28')]);_0x18b496['query']=_[_0x1126('0x41')](_0x219bcc[_0x1126('0x2c')]);_0x18b496[_0x1126('0x35')]=_[_0x1126('0x2d')](_0x18b496['model'],_0x18b496['query']);_0x21c38e[_0x1126('0x30')]=_[_0x1126('0x2d')](_0x18b496[_0x1126('0x2e')],qs['fields'](_0x219bcc[_0x1126('0x2c')]['fields']));_0x21c38e[_0x1126('0x30')]=_0x21c38e['attributes'][_0x1126('0x42')]?_0x21c38e[_0x1126('0x30')]:_0x18b496[_0x1126('0x2e')];if(_0x219bcc['query'][_0x1126('0x3c')]){_0x21c38e[_0x1126('0x43')]=[{'all':!![]}];}_0x21c38e=_[_0x1126('0x3a')]({},_0x21c38e,_0x219bcc['options']);return db['FaxApplication']['find'](_0x21c38e)[_0x1126('0x22')](handleEntityNotFound(_0xcee9de,null))['then'](respondWithResult(_0xcee9de,null))[_0x1126('0x44')](handleError(_0xcee9de,null));};exports['create']=function(_0x2f45b9,_0x323499){return db[_0x1126('0x27')][_0x1126('0x45')](_0x2f45b9[_0x1126('0x46')],{})['then'](respondWithResult(_0x323499,0xc9))[_0x1126('0x44')](handleError(_0x323499,null));};exports[_0x1126('0x47')]=function(_0x5111d3,_0x1a15f8){if(_0x5111d3[_0x1126('0x46')]['id']){delete _0x5111d3['body']['id'];}return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x5111d3['params']['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x1a15f8,null))[_0x1126('0x22')](saveUpdates(_0x5111d3[_0x1126('0x46')],null))['then'](respondWithResult(_0x1a15f8,null))[_0x1126('0x44')](handleError(_0x1a15f8,null));};exports[_0x1126('0x49')]=function(_0x411c89,_0x5878bb){return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x411c89[_0x1126('0x40')]['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x5878bb,null))['then'](removeEntity(_0x5878bb,null))[_0x1126('0x44')](handleError(_0x5878bb,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b2cc5b3..61e167a 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 _0xbb04=['define','FaxApplication','fax_applications','utf8mb4','lodash','api','bluebird','path','rimraf','exports'];(function(_0xe636b5,_0x36a86b){var _0x455ca9=function(_0x4aead3){while(--_0x4aead3){_0xe636b5['push'](_0xe636b5['shift']());}};_0x455ca9(++_0x36a86b);}(_0xbb04,0x9a));var _0x4bb0=function(_0x158ab3,_0x4b5908){_0x158ab3=_0x158ab3-0x0;var _0x302830=_0xbb04[_0x158ab3];return _0x302830;};'use strict';var _=require(_0x4bb0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4bb0('0x1'));var moment=require('moment');var BPromise=require(_0x4bb0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bb0('0x3'));var rimraf=require(_0x4bb0('0x4'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x4bb0('0x5')]=function(_0x972398,_0x2c09d0){return _0x972398[_0x4bb0('0x6')](_0x4bb0('0x7'),attributes,{'tableName':_0x4bb0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4bb0('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x61ee=['fax_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','define'];(function(_0x55482d,_0x48a4af){var _0x119c0b=function(_0x19f1f7){while(--_0x19f1f7){_0x55482d['push'](_0x55482d['shift']());}};_0x119c0b(++_0x48a4af);}(_0x61ee,0x1ba));var _0xe61e=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x61ee[_0x3c4062];return _0x3f5bf3;};'use strict';var _=require(_0xe61e('0x0'));var util=require('util');var logger=require(_0xe61e('0x1'))(_0xe61e('0x2'));var moment=require(_0xe61e('0x3'));var BPromise=require(_0xe61e('0x4'));var rp=require(_0xe61e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe61e('0x6'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module['exports']=function(_0x270813,_0xc02a6f){return _0x270813[_0xe61e('0x7')]('FaxApplication',attributes,{'tableName':_0xe61e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe61e('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index dabf762..a9f8a71 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 _0x4d20=['options','raw','where','attributes','limit','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateFaxApplication','FaxApplication','body'];(function(_0x43ad57,_0x463504){var _0x38c75f=function(_0x4c0185){while(--_0x4c0185){_0x43ad57['push'](_0x43ad57['shift']());}};_0x38c75f(++_0x463504);}(_0x4d20,0x18c));var _0x04d2=function(_0xa821d4,_0x575d04){_0xa821d4=_0xa821d4-0x0;var _0x4f9f8a=_0x4d20[_0xa821d4];return _0x4f9f8a;};'use strict';var _=require(_0x04d2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x04d2('0x1'));var rs=require(_0x04d2('0x2'));var fs=require('fs');var Redis=require(_0x04d2('0x3'));var db=require(_0x04d2('0x4'))['db'];var utils=require(_0x04d2('0x5'));var logger=require(_0x04d2('0x6'))(_0x04d2('0x7'));var config=require(_0x04d2('0x8'));var jayson=require(_0x04d2('0x9'));var client=jayson[_0x04d2('0xa')][_0x04d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x315655,_0x567c8b,_0x87fd8b){return new BPromise(function(_0x3c5ad9,_0x1b9538){return client['request'](_0x315655,_0x87fd8b)[_0x04d2('0xc')](function(_0xb67063){logger[_0x04d2('0xd')](_0x04d2('0xe'),_0x567c8b,_0x04d2('0xf'));logger[_0x04d2('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x567c8b,_0x04d2('0xf'),JSON['stringify'](_0xb67063));if(_0xb67063[_0x04d2('0x11')]){if(_0xb67063['error'][_0x04d2('0x12')]===0x1f4){logger[_0x04d2('0x11')](_0x04d2('0xe'),_0x567c8b,_0xb67063[_0x04d2('0x11')]['message']);return _0x1b9538(_0xb67063[_0x04d2('0x11')][_0x04d2('0x13')]);}logger[_0x04d2('0x11')](_0x04d2('0xe'),_0x567c8b,_0xb67063['error'][_0x04d2('0x13')]);return _0x3c5ad9(_0xb67063[_0x04d2('0x11')][_0x04d2('0x13')]);}else{logger[_0x04d2('0xd')](_0x04d2('0xe'),_0x567c8b,_0x04d2('0xf'));_0x3c5ad9(_0xb67063[_0x04d2('0x14')]['message']);}})['catch'](function(_0x745571){logger[_0x04d2('0x11')](_0x04d2('0xe'),_0x567c8b,_0x745571);_0x1b9538(_0x745571);});});}exports[_0x04d2('0x15')]=function(_0x49eac9){var _0x43247e=this;return new Promise(function(_0xba6637,_0x38e5d3){return db[_0x04d2('0x16')]['update'](_0x49eac9[_0x04d2('0x17')],{'raw':_0x49eac9[_0x04d2('0x18')]?_0x49eac9[_0x04d2('0x18')][_0x04d2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49eac9[_0x04d2('0x18')]?_0x49eac9['options'][_0x04d2('0x1a')]||null:null,'attributes':_0x49eac9[_0x04d2('0x18')]?_0x49eac9[_0x04d2('0x18')][_0x04d2('0x1b')]||null:null,'limit':_0x49eac9[_0x04d2('0x18')]?_0x49eac9[_0x04d2('0x18')][_0x04d2('0x1c')]||null:null})[_0x04d2('0xc')](function(_0x473a51){logger[_0x04d2('0xd')](_0x04d2('0x15'),_0x49eac9);logger[_0x04d2('0x10')]('UpdateFaxApplication',_0x49eac9,JSON[_0x04d2('0x1d')](_0x473a51));_0xba6637(_0x473a51);})['catch'](function(_0x1d7a18){logger[_0x04d2('0x11')](_0x04d2('0x15'),_0x1d7a18[_0x04d2('0x13')],_0x49eac9);_0x38e5d3(_0x43247e['error'](0x1f4,_0x1d7a18[_0x04d2('0x13')]));});});}; \ No newline at end of file +var _0x8185=['debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','update','body','options','raw','where','attributes','UpdateFaxApplication','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8185,0x108));var _0x5818=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x8185[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x5818('0x0'));var util=require('util');var moment=require(_0x5818('0x1'));var BPromise=require(_0x5818('0x2'));var rs=require(_0x5818('0x3'));var fs=require('fs');var Redis=require(_0x5818('0x4'));var db=require(_0x5818('0x5'))['db'];var utils=require(_0x5818('0x6'));var logger=require(_0x5818('0x7'))(_0x5818('0x8'));var config=require('../../config/environment');var jayson=require(_0x5818('0x9'));var client=jayson[_0x5818('0xa')][_0x5818('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x270321,_0x34a31b,_0x2c9193){return new BPromise(function(_0x1d58a4,_0x5eec85){return client['request'](_0x270321,_0x2c9193)[_0x5818('0xc')](function(_0x45899b){logger[_0x5818('0xd')]('FaxApplication,\x20%s,\x20%s',_0x34a31b,_0x5818('0xe'));logger[_0x5818('0xf')](_0x5818('0x10'),_0x34a31b,_0x5818('0xe'),JSON[_0x5818('0x11')](_0x45899b));if(_0x45899b[_0x5818('0x12')]){if(_0x45899b[_0x5818('0x12')][_0x5818('0x13')]===0x1f4){logger[_0x5818('0x12')](_0x5818('0x14'),_0x34a31b,_0x45899b[_0x5818('0x12')]['message']);return _0x5eec85(_0x45899b[_0x5818('0x12')][_0x5818('0x15')]);}logger[_0x5818('0x12')](_0x5818('0x14'),_0x34a31b,_0x45899b[_0x5818('0x12')][_0x5818('0x15')]);return _0x1d58a4(_0x45899b['error'][_0x5818('0x15')]);}else{logger[_0x5818('0xd')](_0x5818('0x14'),_0x34a31b,_0x5818('0xe'));_0x1d58a4(_0x45899b[_0x5818('0x16')][_0x5818('0x15')]);}})['catch'](function(_0x330a91){logger[_0x5818('0x12')](_0x5818('0x14'),_0x34a31b,_0x330a91);_0x5eec85(_0x330a91);});});}exports['UpdateFaxApplication']=function(_0xeded68){var _0x1b0e6f=this;return new Promise(function(_0x4cc431,_0x1577b1){return db['FaxApplication'][_0x5818('0x17')](_0xeded68[_0x5818('0x18')],{'raw':_0xeded68[_0x5818('0x19')]?_0xeded68[_0x5818('0x19')][_0x5818('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeded68[_0x5818('0x19')]?_0xeded68[_0x5818('0x19')][_0x5818('0x1b')]||null:null,'attributes':_0xeded68[_0x5818('0x19')]?_0xeded68[_0x5818('0x19')][_0x5818('0x1c')]||null:null,'limit':_0xeded68[_0x5818('0x19')]?_0xeded68[_0x5818('0x19')]['limit']||null:null})['then'](function(_0x357c52){logger[_0x5818('0xd')]('UpdateFaxApplication',_0xeded68);logger['debug'](_0x5818('0x1d'),_0xeded68,JSON[_0x5818('0x11')](_0x357c52));_0x4cc431(_0x357c52);})[_0x5818('0x1e')](function(_0x577983){logger[_0x5818('0x12')](_0x5818('0x1d'),_0x577983['message'],_0xeded68);_0x1577b1(_0x1b0e6f[_0x5818('0x12')](0x1f4,_0x577983['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3b63986..b6a33b3 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 _0xafc4=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','put','update','exports'];(function(_0xb6c0ae,_0x29c677){var _0x55b0f1=function(_0x1e2ff8){while(--_0x1e2ff8){_0xb6c0ae['push'](_0xb6c0ae['shift']());}};_0x55b0f1(++_0x29c677);}(_0xafc4,0x69));var _0x4afc=function(_0xc1ca83,_0xe01079){_0xc1ca83=_0xc1ca83-0x0;var _0x344ed3=_0xafc4[_0xc1ca83];return _0x344ed3;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var auth=require(_0x4afc('0x4'));var interaction=require(_0x4afc('0x5'));var config=require('../../config/environment');var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0x7')]);router[_0x4afc('0x8')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xa')]);router['post']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xd')]);router['delete']('/:id',auth[_0x4afc('0x6')](),controller['destroy']);module[_0x4afc('0xe')]=router; \ No newline at end of file +var _0x8ef6=['Router','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1a3e33,_0xe419f4){var _0x545085=function(_0x563f55){while(--_0x563f55){_0x1a3e33['push'](_0x1a3e33['shift']());}};_0x545085(++_0xe419f4);}(_0x8ef6,0xf2));var _0x68ef=function(_0x18bd6b,_0x339e04){_0x18bd6b=_0x18bd6b-0x0;var _0x3391b7=_0x8ef6[_0x18bd6b];return _0x3391b7;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['post']('/',auth[_0x68ef('0xa')](),controller[_0x68ef('0xd')]);router[_0x68ef('0xe')](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xf')]);router[_0x68ef('0x10')](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x11')]);module[_0x68ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 35fdb15..c10527c 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 _0x897a=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x55206a,_0x2b0787){var _0xd365be=function(_0x194445){while(--_0x194445){_0x55206a['push'](_0x55206a['shift']());}};_0xd365be(++_0x2b0787);}(_0x897a,0xa9));var _0xa897=function(_0x354126,_0xcd682b){_0x354126=_0x354126-0x0;var _0x19c269=_0x897a[_0x354126];return _0x19c269;};'use strict';var Sequelize=require(_0xa897('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa897('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa897('0x2')]},'disposition':{'type':Sequelize[_0xa897('0x3')]},'note':{'type':Sequelize[_0xa897('0x3')]},'read1stAt':{'type':Sequelize[_0xa897('0x2')]},'fax':{'type':Sequelize[_0xa897('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa897('0x4')]('in',_0xa897('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa897('0x4')]('in',_0xa897('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6b9e=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x5ec924,_0x1fde7b){var _0xbb930e=function(_0x16cb8f){while(--_0x16cb8f){_0x5ec924['push'](_0x5ec924['shift']());}};_0xbb930e(++_0x1fde7b);}(_0x6b9e,0x80));var _0xe6b9=function(_0xe803e2,_0x540d22){_0xe803e2=_0xe803e2-0x0;var _0x209b83=_0x6b9e[_0xe803e2];return _0x209b83;};'use strict';var Sequelize=require(_0xe6b9('0x0'));module[_0xe6b9('0x1')]={'closed':{'type':Sequelize[_0xe6b9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe6b9('0x3')]},'disposition':{'type':Sequelize[_0xe6b9('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xe6b9('0x3')]},'fax':{'type':Sequelize[_0xe6b9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe6b9('0x5')]('in',_0xe6b9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe6b9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe6b9('0x5')]('in','out'),'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 ea21b46..7c53ae5 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 _0x5a13=['null','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','FaxInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','merge','options','create','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','field','color','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\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','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','body','compact','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a13,0x145));var _0x35a1=function(_0x8545fd,_0x3e7705){_0x8545fd=_0x8545fd-0x0;var _0x341b08=_0x5a13[_0x8545fd];return _0x341b08;};'use strict';var pdf=require(_0x35a1('0x0'));var emlformat=require(_0x35a1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35a1('0x2'));var jsonpatch=require(_0x35a1('0x3'));var rp=require(_0x35a1('0x4'));var moment=require(_0x35a1('0x5'));var BPromise=require(_0x35a1('0x6'));var Mustache=require(_0x35a1('0x7'));var util=require(_0x35a1('0x8'));var path=require(_0x35a1('0x9'));var sox=require(_0x35a1('0xa'));var csv=require(_0x35a1('0xb'));var ejs=require(_0x35a1('0xc'));var fs=require('fs');var _=require(_0x35a1('0xd'));var squel=require(_0x35a1('0xe'));var crypto=require(_0x35a1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35a1('0x10'));var Papa=require(_0x35a1('0x11'));var Redis=require('ioredis');var authService=require(_0x35a1('0x12'));var qs=require(_0x35a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a1('0x14'))(_0x35a1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x35a1('0x16'))['db'];config['redis']=_[_0x35a1('0x17')](config['redis'],{'host':_0x35a1('0x18'),'port':0x18eb});var socket=require(_0x35a1('0x19'))(new Redis(config[_0x35a1('0x1a')]));require(_0x35a1('0x1b'))[_0x35a1('0x1c')](socket);function respondWithStatusCode(_0xa149d0,_0x20d868){_0x20d868=_0x20d868||0xcc;return function(_0x42de36){if(_0x42de36){return _0xa149d0[_0x35a1('0x1d')](_0x20d868);}return _0xa149d0[_0x35a1('0x1e')](_0x20d868)[_0x35a1('0x1f')]();};}function respondWithResult(_0x41939f,_0x2f93be){_0x2f93be=_0x2f93be||0xc8;return function(_0x44c755){if(_0x44c755){return _0x41939f[_0x35a1('0x1e')](_0x2f93be)[_0x35a1('0x20')](_0x44c755);}};}function respondWithFilteredResult(_0x9bdc,_0x2b22b4){return function(_0x3e7b28){if(_0x3e7b28){var _0x1de373=_0x3e7b28[_0x35a1('0x21')],_0x5e4317=_0x2b22b4[_0x35a1('0x22')],_0x3b17dc=_0x2b22b4[_0x35a1('0x22')]+_0x2b22b4[_0x35a1('0x23')],_0xbeb751;if(_0x3b17dc>=_0x1de373){_0x3b17dc=_0x1de373;_0xbeb751=0xc8;}else{_0xbeb751=0xce;}_0x9bdc[_0x35a1('0x1e')](_0xbeb751);return _0x9bdc[_0x35a1('0x24')](_0x35a1('0x25'),_0x5e4317+'-'+_0x3b17dc+'/'+_0x1de373)['json'](_0x3e7b28);}return null;};}function patchUpdates(_0x473186){return function(_0xf089dd){try{jsonpatch['apply'](_0xf089dd,_0x473186,!![]);}catch(_0xfce076){return BPromise[_0x35a1('0x26')](_0xfce076);}return _0xf089dd['save']();};}function saveUpdates(_0xc13bad,_0x5a1742){return function(_0x28af51){if(_0x28af51){return _0x28af51[_0x35a1('0x27')](_0xc13bad)[_0x35a1('0x28')](function(_0x5e42cf){return _0x5e42cf;});}return null;};}function removeEntity(_0x1ced16,_0x2b87a1){return function(_0x48f1bd){if(_0x48f1bd){return _0x48f1bd['destroy']()['then'](function(){_0x1ced16[_0x35a1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5408a7,_0x52d22b){return function(_0x2ee03c){if(!_0x2ee03c){_0x5408a7[_0x35a1('0x1d')](0x194);}return _0x2ee03c;};}function handleError(_0x39248b,_0x3f1563){_0x3f1563=_0x3f1563||0x1f4;return function(_0x536394){logger[_0x35a1('0x29')](_0x536394[_0x35a1('0x2a')]);if(_0x536394[_0x35a1('0x2b')]){delete _0x536394[_0x35a1('0x2b')];}_0x39248b[_0x35a1('0x1e')](_0x3f1563)[_0x35a1('0x2c')](_0x536394);};}function getInteractionUsers(_0x3d3453,_0x24bb2d){return new BPromise(function(_0x243841,_0x381bcc){try{if(_0x24bb2d[_0x3d3453['id']]){_0x3d3453[_0x35a1('0x2d')]=_[_0x35a1('0x2e')](_0x24bb2d[_0x3d3453['id']],function(_0xacadf2){return{'id':_0xacadf2['id'],'fullname':_0xacadf2[_0x35a1('0x2f')]};});}}catch(_0x2ae0ca){_0x381bcc(_0x2ae0ca);}_0x243841(_0x3d3453);});}function getInteractionTags(_0x4b74b3,_0x9720a4){return new BPromise(function(_0x379819,_0x10b65e){try{if(_0x4b74b3[_0x35a1('0x30')]){_0x4b74b3[_0x35a1('0x31')]=[];_0x4b74b3[_0x35a1('0x30')][_0x35a1('0x32')](',')[_0x35a1('0x33')](function(_0x2609ab){_0x4b74b3[_0x35a1('0x31')][_0x35a1('0x34')](_0x9720a4[_0x2609ab]);});}delete _0x4b74b3['TagIds'];}catch(_0x581740){_0x10b65e(_0x581740);}_0x379819(_0x4b74b3);});}function updateFaxInteraction(_0x351894,_0x5e1dad,_0x192dce){return new BPromise(function(_0x5756bb,_0x8c37b0){return getInteractionUsers(_0x351894,_0x192dce)[_0x35a1('0x28')](function(_0x42c365){return getInteractionTags(_0x42c365,_0x5e1dad);})[_0x35a1('0x28')](function(_0x7b0d18){_0x5756bb(_0x7b0d18);})[_0x35a1('0x35')](function(_0x316b10){_0x8c37b0(_0x316b10);});});}exports[_0x35a1('0x36')]=function(_0x2e9d35,_0x44ed30){var _0x25d757={},_0x4a4903={},_0x227856={'count':0x0,'rows':[]};var _0x2f5248=_[_0x35a1('0x2e')](db['FaxInteraction']['rawAttributes'],function(_0x5d947d){return{'name':_0x5d947d['fieldName'],'type':_0x5d947d['type']['key']};});_0x4a4903[_0x35a1('0x37')]=_[_0x35a1('0x2e')](_0x2f5248,_0x35a1('0x2b'));_0x4a4903[_0x35a1('0x38')]=_[_0x35a1('0x39')](_0x2e9d35[_0x35a1('0x38')]);_0x4a4903[_0x35a1('0x3a')]=_[_0x35a1('0x3b')](_0x4a4903['model'],_0x4a4903[_0x35a1('0x38')]);_0x25d757['attributes']=_[_0x35a1('0x3b')](_0x4a4903[_0x35a1('0x37')],qs[_0x35a1('0x3c')](_0x2e9d35[_0x35a1('0x38')][_0x35a1('0x3c')]));_0x25d757['attributes']=_0x25d757[_0x35a1('0x3d')][_0x35a1('0x3e')]?_0x25d757[_0x35a1('0x3d')]:_0x4a4903['model'];if(!_0x2e9d35['query'][_0x35a1('0x3f')](_0x35a1('0x40'))){_0x25d757[_0x35a1('0x23')]=qs[_0x35a1('0x23')](_0x2e9d35['query'][_0x35a1('0x23')]);_0x25d757['offset']=qs[_0x35a1('0x22')](_0x2e9d35['query'][_0x35a1('0x22')]);}_0x25d757[_0x35a1('0x41')]=qs['sort'](_0x2e9d35['query'][_0x35a1('0x42')]);_0x25d757['where']=qs[_0x35a1('0x3a')](_[_0x35a1('0x43')](_0x2e9d35['query'],_0x4a4903[_0x35a1('0x3a')]),_0x2f5248);var _0x502695=[];var _0xb1c14c=squel['select']()[_0x35a1('0x44')]('id')['field'](_0x35a1('0x2b'))['field'](_0x35a1('0x45'))['from'](_0x35a1('0x46'));var _0x260f29=squel[_0x35a1('0x47')]()[_0x35a1('0x44')](_0x35a1('0x48'))[_0x35a1('0x44')](_0x35a1('0x49'))['field'](_0x35a1('0x4a'))[_0x35a1('0x4b')](_0x35a1('0x4c'),'ui')[_0x35a1('0x4d')](_0x35a1('0x4e'),'u',_0x35a1('0x4f'));var _0x5e0898=squel[_0x35a1('0x47')]()[_0x35a1('0x4b')](_0x35a1('0x50'),'i')[_0x35a1('0x4d')](_0x35a1('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x35a1('0x4d')](_0x35a1('0x4e'),'o',_0x35a1('0x52'))[_0x35a1('0x4d')]('fax_accounts','a',_0x35a1('0x53'))[_0x35a1('0x4d')](_0x35a1('0x54'),'me',_0x35a1('0x55'))[_0x35a1('0x4d')](_0x35a1('0x56'),'it',_0x35a1('0x57'))['left_join']('tools_tags','t',_0x35a1('0x58'));var _0x34805f=squel[_0x35a1('0x59')]();var _0x2e9351=[];var _0x5a2f0b=squel['expr']();var _0x18e1dd;if(_0x2e9d35[_0x35a1('0x38')][_0x35a1('0x5a')]){_0x18e1dd=as[_0x35a1('0x5b')](_0x2e9d35['query']['search']);var _0x5a2ee8=_0x18e1dd[_0x35a1('0x5c')];for(var _0x5d7f55=0x0;_0x5d7f55<_0x18e1dd[_0x35a1('0x5d')][_0x35a1('0x3e')];_0x5d7f55++){var _0xce6489=_0x18e1dd[_0x35a1('0x5d')][_0x5d7f55];var _0x1415bc='i';var _0x18329f=_[_0x35a1('0x5e')](_0x2f5248,[_0x35a1('0x2b'),_0xce6489['field']]);if(!_0x18329f){switch(_0xce6489[_0x35a1('0x44')]){case _0x35a1('0x5f'):if(_0xce6489[_0x35a1('0x60')]==0x1){_0x5e0898['having']('`'+_0xce6489['field']+'`\x20=\x200');}else{_0x5e0898['having']('`'+_0xce6489[_0x35a1('0x44')]+_0x35a1('0x61'));}break;case _0x35a1('0x62'):if(_0xce6489[_0x35a1('0x63')]===_0x35a1('0x64')){if(_0xce6489[_0x35a1('0x60')][_0x35a1('0x32')]('\x20')[_0x35a1('0x3e')]>0x1){_0x34805f[_0x5a2ee8](_0x35a1('0x65'),qs[_0x35a1('0x66')](_0xce6489['value']),null);}else{var _0x3ca42a='%'+_0xce6489[_0x35a1('0x60')]+'%';_0x34805f[_0x5a2ee8](_0x35a1('0x67'),_0x3ca42a,_0x3ca42a,_0x3ca42a);}}else{_0x18329f=_['find'](_0x2f5248,['name',_0x35a1('0x68')]);_0xce6489['field']=_0x35a1('0x68');_0x3b2412=as[_0x35a1('0x69')](_0x1415bc,_0x18329f[_0x35a1('0x6a')],_0xce6489);_0x34805f[_0x5a2ee8](_0x3b2412['text'],_0x3b2412['value'][_0x35a1('0x6b')],_0x3b2412['value']['end']);}break;case _0x35a1('0x6c'):var _0x4b3e29=_0xce6489[_0x35a1('0x60')][_0x35a1('0x32')](',')[_0x35a1('0x2e')](function(_0x413861){return Number(_0x413861);});_0x4b3e29[_0x35a1('0x33')](function(_0x1c0b1e){_0x5a2f0b['or'](_0x35a1('0x6d'),'%,'+_0x1c0b1e+',%');});_0x2e9351=_[_0x35a1('0x6e')](_0x2e9351,_0x4b3e29);break;case _0x35a1('0x6f'):if(_0xce6489[_0x35a1('0x63')]===_0x35a1('0x64')){_0x34805f[_0x5a2ee8]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xce6489[_0x35a1('0x60')]+'%',null);}else{_0x18329f=_[_0x35a1('0x5e')](_0x2f5248,[_0x35a1('0x2b'),'UserId']);_0xce6489[_0x35a1('0x44')]=_0x35a1('0x70');_0x3b2412=as[_0x35a1('0x69')](_0x1415bc,_0x18329f[_0x35a1('0x6a')],_0xce6489);_0x34805f[_0x5a2ee8](_0x3b2412[_0x35a1('0x71')],_0x3b2412[_0x35a1('0x60')][_0x35a1('0x6b')],_0x3b2412[_0x35a1('0x60')][_0x35a1('0x1f')]);}break;case _0x35a1('0x72'):_0x3b2412=as[_0x35a1('0x69')]('me',null,_0xce6489);_0x34805f[_0x5a2ee8](_0x3b2412[_0x35a1('0x71')],_0x3b2412['value'][_0x35a1('0x6b')],_0x3b2412[_0x35a1('0x60')][_0x35a1('0x1f')]);break;}}else{var _0x3b2412=as['buildExpression'](_0x1415bc,_0x18329f['type'],_0xce6489);_0x34805f[_0x5a2ee8](_0x3b2412[_0x35a1('0x71')],_0x3b2412[_0x35a1('0x60')][_0x35a1('0x6b')],_0x3b2412[_0x35a1('0x60')][_0x35a1('0x1f')]);}}}else{var _0x2e8c75=_(_0x2e9d35[_0x35a1('0x38')])['keys']()[_0x35a1('0x2e')](function(_0x506794){return _['some'](_0x2f5248,[_0x35a1('0x2b'),_0x506794])?_0x506794:undefined;})[_0x35a1('0x73')]()['value']();if(!_['isEmpty'](_0x2e8c75)){_0x2e8c75[_0x35a1('0x33')](function(_0x203b96){if(_0x203b96===_0x35a1('0x74')){_0x5e0898[_0x35a1('0x75')](_0x35a1('0x76'),[][_0x35a1('0x77')](_0x2e9d35[_0x35a1('0x38')][_0x203b96]));}else if(_0x203b96===_0x35a1('0x78')){var _0x578a95=JSON[_0x35a1('0x79')](_0x2e9d35[_0x35a1('0x38')][_0x203b96])[_0x35a1('0x7a')];var _0x114667=JSON[_0x35a1('0x79')](_0x2e9d35[_0x35a1('0x38')][_0x203b96])[_0x35a1('0x7b')];_0x5e0898[_0x35a1('0x75')](_0x35a1('0x7c'),_0x578a95,_0x114667);}else{if(_0x2e9d35[_0x35a1('0x38')][_0x203b96]===_0x35a1('0x7d')){_0x5e0898['where']('i.'+_0x203b96+_0x35a1('0x7e'));}else{_0x5e0898[_0x35a1('0x75')]('i.'+_0x203b96+'\x20=\x20?',_0x2e9d35[_0x35a1('0x38')][_0x203b96]);}}});}if(_0x2e9d35[_0x35a1('0x38')][_0x35a1('0x7f')]){if(_0x2e9d35[_0x35a1('0x38')][_0x35a1('0x7f')]==0x1){_0x5e0898[_0x35a1('0x80')](_0x35a1('0x81'));}else{_0x5e0898[_0x35a1('0x80')](_0x35a1('0x82'));}}if(_0x2e9d35['query']['tag']){_0x2e9351=_[_0x35a1('0x83')](_0x2e9d35[_0x35a1('0x38')][_0x35a1('0x84')])?_0x2e9d35[_0x35a1('0x38')]['tag']:new Array(_0x2e9d35[_0x35a1('0x38')][_0x35a1('0x84')]);_0x2e9351[_0x35a1('0x33')](function(_0x3ed836){_0x5a2f0b['or'](_0x35a1('0x6d'),'%,'+_0x3ed836+',%');});}if(_0x2e9d35[_0x35a1('0x38')][_0x35a1('0x85')]){var _0xa8bb13=_0x2e9d35[_0x35a1('0x38')][_0x35a1('0x85')][_0x35a1('0x86')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x35a1('0x87'));if(qs[_0x35a1('0x88')](_0xa8bb13)){_0x34805f['or']('i.id\x20LIKE\x20?',_0xa8bb13+'%')['or'](_0x35a1('0x89'),_0xa8bb13+'%');}_0x34805f['or'](_0x35a1('0x8a'),_0xa8bb13+'%');}}_0x5e0898[_0x35a1('0x75')](_0x34805f);_0x5e0898[_0x35a1('0x8b')]('i.id');var _0xe4fe48={'type':db[_0x35a1('0x8c')][_0x35a1('0x8d')][_0x35a1('0x8e')],'raw':!![]};var _0x301961=_0x5e0898[_0x35a1('0x8f')]();_0x301961[_0x35a1('0x44')](_0x35a1('0x90'));_0x301961[_0x35a1('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x25d757['order']){_0x25d757[_0x35a1('0x41')][_0x35a1('0x33')](function(_0x76c11b){_0x5e0898[_0x35a1('0x41')]('i.'+_0x76c11b[0x0],_0x76c11b[0x1]===_0x35a1('0x91')?![]:!![]);});}if(!_[_0x35a1('0x92')](_0x2e9351)){_0x5e0898['having'](_0x5a2f0b);_0x301961['where'](_0x35a1('0x93'),_0x2e9351);}BPromise[_0x35a1('0x94')]()[_0x35a1('0x28')](function(){if(!_0x18e1dd){if(_0x2e9d35['query'][_0x35a1('0x74')]||_0x2e9d35[_0x35a1('0x38')][_0x35a1('0x95')])return;_0x301961[_0x35a1('0x75')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x5e0898['where'](_0x35a1('0x96'));return;}return _0x2e9d35[_0x35a1('0x97')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x35a1('0x28')](function(_0x441130){if(_[_0x35a1('0x92')](_0x441130)){_0x301961[_0x35a1('0x75')]('i.FaxAccountId\x20IS\x20NULL');_0x5e0898[_0x35a1('0x75')](_0x35a1('0x98'));}else{_0x301961['where'](_0x35a1('0x76'),_[_0x35a1('0x2e')](_0x441130,'id'));_0x5e0898[_0x35a1('0x75')]('i.FaxAccountId\x20IN\x20?',_[_0x35a1('0x2e')](_0x441130,'id'));}});})[_0x35a1('0x28')](function(){db[_0x35a1('0x99')][_0x35a1('0x38')](_0x301961[_0x35a1('0x9a')](),_0xe4fe48)[_0x35a1('0x28')](function(_0x37e2ce){_0x227856[_0x35a1('0x21')]=_0x37e2ce[_0x35a1('0x3e')];if(_0x227856[_0x35a1('0x21')]===0x0)return[];return db[_0x35a1('0x99')][_0x35a1('0x38')](_0xb1c14c[_0x35a1('0x9a')](),_0xe4fe48)[_0x35a1('0x28')](function(_0xd1c6d7){_0x502695=_[_0x35a1('0x9b')](_0xd1c6d7,'id');_0xe4fe48=_['merge'](_0xe4fe48,{'model':db[_0x35a1('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e9d35['query'][_0x35a1('0x3c')]){_0x25d757[_0x35a1('0x3d')]['forEach'](function(_0x1ec6e5){_0x5e0898['field']('i.'+_0x1ec6e5);});}else{_0x5e0898['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x35a1('0x5f'));_0x5e0898[_0x35a1('0x44')]('a.key',_0x35a1('0x9d'));_0x5e0898[_0x35a1('0x44')](_0x35a1('0x9e'),_0x35a1('0x9f'));_0x5e0898[_0x35a1('0x44')](_0x35a1('0xa0'));_0x5e0898[_0x35a1('0x44')](_0x35a1('0xa1'),_0x35a1('0xa2'));_0x5e0898[_0x35a1('0x44')]('c.lastName',_0x35a1('0xa3'));_0x5e0898['field'](_0x35a1('0xa4'),_0x35a1('0xa5'));_0x5e0898[_0x35a1('0x44')](_0x35a1('0xa6'),_0x35a1('0xa7'));_0x5e0898[_0x35a1('0x44')](_0x35a1('0xa8'),_0x35a1('0xa9'));_0x5e0898[_0x35a1('0x44')](_0x35a1('0xaa'),_0x35a1('0xab'));_0x5e0898[_0x35a1('0x44')](_0x35a1('0xac'),'Owner.fullname');_0x5e0898['field'](_0x35a1('0xad'),'Owner.internal');_0x5e0898[_0x35a1('0x44')](_0x35a1('0xae'),_0x35a1('0x30'));}if(_0x25d757[_0x35a1('0x23')])_0x5e0898['limit'](_0x25d757['limit']);if(_0x25d757['offset'])_0x5e0898[_0x35a1('0x22')](_0x25d757[_0x35a1('0x22')]);return db[_0x35a1('0x99')][_0x35a1('0x38')](_0x5e0898[_0x35a1('0x9a')](),_0xe4fe48);})[_0x35a1('0x28')](function(_0x5af910){_0x260f29[_0x35a1('0x75')](_0x35a1('0xaf'),_[_0x35a1('0x2e')](_0x5af910,'id'));return db[_0x35a1('0x99')][_0x35a1('0x38')](_0x260f29['toString'](),_0xe4fe48)[_0x35a1('0x28')](function(_0x56087c){var _0x2a7646=_[_0x35a1('0xb0')](_0x56087c,_0x35a1('0xb1'));var _0x563505=[];_0x5af910[_0x35a1('0x33')](function(_0x4ca0f5){_0x563505[_0x35a1('0x34')](updateFaxInteraction(_0x4ca0f5,_0x502695,_0x2a7646));});return BPromise[_0x35a1('0xb2')](_0x563505);});});})[_0x35a1('0x28')](function(_0x21449e){_0x227856[_0x35a1('0xb3')]=_0x21449e;return _0x227856;})[_0x35a1('0x28')](respondWithFilteredResult(_0x44ed30,_0x25d757));})[_0x35a1('0x35')](handleError(_0x44ed30,null));};exports[_0x35a1('0xb4')]=function(_0x5c4d94,_0x5725d9){var _0x54ce40={'raw':![],'where':{'id':_0x5c4d94[_0x35a1('0xb5')]['id']}},_0xa5544e={};_0xa5544e[_0x35a1('0x37')]=_[_0x35a1('0x39')](db[_0x35a1('0x9c')]['rawAttributes']);_0xa5544e['query']=_[_0x35a1('0x39')](_0x5c4d94[_0x35a1('0x38')]);_0xa5544e[_0x35a1('0x3a')]=_[_0x35a1('0x3b')](_0xa5544e['model'],_0xa5544e['query']);_0x54ce40[_0x35a1('0x3d')]=_[_0x35a1('0x3b')](_0xa5544e[_0x35a1('0x37')],qs[_0x35a1('0x3c')](_0x5c4d94[_0x35a1('0x38')][_0x35a1('0x3c')]));_0x54ce40[_0x35a1('0x3d')]=_0x54ce40[_0x35a1('0x3d')][_0x35a1('0x3e')]?_0x54ce40[_0x35a1('0x3d')]:_0xa5544e[_0x35a1('0x37')];if(_0x5c4d94[_0x35a1('0x38')][_0x35a1('0xb6')]){_0x54ce40[_0x35a1('0xb7')]=[{'all':!![]}];}_0x54ce40=_[_0x35a1('0xb8')]({},_0x54ce40,_0x5c4d94[_0x35a1('0xb9')]);return db['FaxInteraction'][_0x35a1('0x5e')](_0x54ce40)[_0x35a1('0x28')](handleEntityNotFound(_0x5725d9,null))[_0x35a1('0x28')](respondWithResult(_0x5725d9,null))['catch'](handleError(_0x5725d9,null));};exports[_0x35a1('0xba')]=function(_0x27f1f7,_0x348c87){return db[_0x35a1('0x9c')]['create'](_0x27f1f7[_0x35a1('0x72')],{})[_0x35a1('0x28')](respondWithResult(_0x348c87,0xc9))[_0x35a1('0x35')](handleError(_0x348c87,null));};exports[_0x35a1('0x27')]=function(_0x525467,_0x29fad2){if(_0x525467[_0x35a1('0x72')]['id']){delete _0x525467['body']['id'];}return db[_0x35a1('0x9c')]['find']({'where':{'id':_0x525467[_0x35a1('0xb5')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x29fad2,null))[_0x35a1('0x28')](saveUpdates(_0x525467[_0x35a1('0x72')],null))[_0x35a1('0x28')](respondWithResult(_0x29fad2,null))[_0x35a1('0x35')](handleError(_0x29fad2,null));};exports[_0x35a1('0xbb')]=function(_0x83d3f7,_0x3766db){return db[_0x35a1('0x9c')][_0x35a1('0x5e')]({'where':{'id':_0x83d3f7[_0x35a1('0xb5')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x3766db,null))[_0x35a1('0x28')](removeEntity(_0x3766db,null))[_0x35a1('0x35')](handleError(_0x3766db,null));};exports[_0x35a1('0xbc')]=function(_0xa94fd,_0x562db2){return db[_0x35a1('0x9c')]['describe']()[_0x35a1('0x28')](respondWithResult(_0x562db2,null))['catch'](handleError(_0x562db2,null));};exports[_0x35a1('0xbd')]=function(_0x42e1c8,_0x30b832,_0x156960){return db[_0x35a1('0xbe')][_0x35a1('0x5e')]({'where':{'id':_0x42e1c8[_0x35a1('0xb5')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x30b832,null))[_0x35a1('0x28')](function(_0x366512){if(_0x366512){return _0x366512[_0x35a1('0xbd')](_0x42e1c8['body'][_0x35a1('0xbf')],_[_0x35a1('0xc0')](_0x42e1c8['body'],['ids','id'])||{});}})[_0x35a1('0x28')](respondWithResult(_0x30b832,null))[_0x35a1('0x35')](handleError(_0x30b832,null));};exports[_0x35a1('0xc1')]=function(_0x48e853,_0x146c7a,_0x5654a3){var _0x27c943={'raw':![],'where':{}};var _0x30aea4={};var _0x9fce29={'count':0x0,'rows':[]};return db[_0x35a1('0x9c')][_0x35a1('0xc2')]({'where':{'id':_0x48e853[_0x35a1('0xb5')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x146c7a,null))[_0x35a1('0x28')](function(_0x16baa2){if(_0x16baa2){_0x30aea4['model']=_[_0x35a1('0x39')](db[_0x35a1('0xbe')][_0x35a1('0xc3')]);_0x30aea4['query']=_['keys'](_0x48e853[_0x35a1('0x38')]);_0x30aea4[_0x35a1('0x3a')]=_[_0x35a1('0x3b')](_0x30aea4['model'],_0x30aea4[_0x35a1('0x38')]);_0x27c943['attributes']=_[_0x35a1('0x3b')](_0x30aea4[_0x35a1('0x37')],qs[_0x35a1('0x3c')](_0x48e853[_0x35a1('0x38')]['fields']));_0x27c943[_0x35a1('0x3d')]=_0x27c943['attributes'][_0x35a1('0x3e')]?_0x27c943['attributes']:_0x30aea4[_0x35a1('0x37')];if(!_0x48e853[_0x35a1('0x38')][_0x35a1('0x3f')](_0x35a1('0x40'))){_0x27c943[_0x35a1('0x23')]=qs['limit'](_0x48e853[_0x35a1('0x38')][_0x35a1('0x23')]);_0x27c943['offset']=qs['offset'](_0x48e853[_0x35a1('0x38')][_0x35a1('0x22')]);}_0x27c943[_0x35a1('0x41')]=qs[_0x35a1('0x42')](_0x48e853[_0x35a1('0x38')][_0x35a1('0x42')]);_0x27c943[_0x35a1('0x75')]=qs[_0x35a1('0x3a')](_[_0x35a1('0x43')](_0x48e853[_0x35a1('0x38')],_0x30aea4['filters']));_0x27c943[_0x35a1('0x75')][_0x35a1('0xb1')]=_0x16baa2['id'];if(_0x48e853['query']['filter']){_0x27c943[_0x35a1('0x75')]=_[_0x35a1('0xb8')](_0x27c943['where'],{'$or':_[_0x35a1('0x2e')](_0x27c943[_0x35a1('0x3d')],function(_0x306669){var _0x1ac121={};_0x1ac121[_0x306669]={'$like':'%'+_0x48e853[_0x35a1('0x38')][_0x35a1('0x85')]+'%'};return _0x1ac121;})});}if(_0x48e853['query'][_0x35a1('0x7a')]){var _0x20492b=_0x48e853['query']['$gte'][_0x35a1('0x32')](',');var _0x5605d6={};_0x5605d6[_0x20492b[0x0]]={'$gte':moment(_0x20492b[0x1])[_0x35a1('0xc4')](_0x35a1('0xc5'))};_0x27c943[_0x35a1('0x75')]=_[_0x35a1('0xb8')](_0x27c943[_0x35a1('0x75')],_0x5605d6);}_0x27c943=_[_0x35a1('0xb8')]({},_0x27c943,_0x48e853[_0x35a1('0xb9')]);return db[_0x35a1('0xbe')][_0x35a1('0x21')]({'where':_0x27c943[_0x35a1('0x75')]})[_0x35a1('0x28')](function(_0x1eef50){_0x9fce29['count']=_0x1eef50;if(_0x48e853[_0x35a1('0x38')]['includeAll']){_0x27c943[_0x35a1('0xb7')]=[{'all':!![]}];}return db[_0x35a1('0xbe')][_0x35a1('0xc6')](_0x27c943);})['then'](function(_0x34a619){_0x9fce29[_0x35a1('0xb3')]=_0x34a619;return _0x9fce29;});}})[_0x35a1('0x28')](respondWithFilteredResult(_0x146c7a,_0x27c943))[_0x35a1('0x35')](handleError(_0x146c7a,null));};exports[_0x35a1('0xc7')]=function(_0x424352,_0x3c32b1,_0x446795){return db[_0x35a1('0x9c')]['find']({'where':{'id':_0x424352[_0x35a1('0xb5')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x3c32b1,null))[_0x35a1('0x28')](function(_0x3d7823){if(_0x3d7823){return _0x3d7823[_0x35a1('0xc8')](_0x424352[_0x35a1('0x72')][_0x35a1('0xbf')],_[_0x35a1('0xc0')](_0x424352[_0x35a1('0x72')],[_0x35a1('0xbf'),'id'])||{})[_0x35a1('0xc9')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x424352[_0x35a1('0x72')][_0x35a1('0xbf')]}});})[_0x35a1('0x28')](function(_0x5bb908){socket[_0x35a1('0xca')](_0x35a1('0xcb'),{'id':Number(_0x424352['params']['id']),'tags':_0x5bb908||[]});return{'id':Number(_0x424352[_0x35a1('0xb5')]['id']),'tags':_0x5bb908||[]};});}})[_0x35a1('0x28')](respondWithResult(_0x3c32b1,null))[_0x35a1('0x35')](handleError(_0x3c32b1,null));};exports[_0x35a1('0xcc')]=function(_0x3426c7,_0x41243c,_0xec6cb6){return db[_0x35a1('0x9c')][_0x35a1('0x5e')]({'where':{'id':_0x3426c7[_0x35a1('0xb5')]['id']}})['then'](handleEntityNotFound(_0x41243c,null))['then'](function(_0x19cf5e){if(_0x19cf5e){return _0x19cf5e[_0x35a1('0xcc')](_0x3426c7[_0x35a1('0x38')][_0x35a1('0xbf')]);}})[_0x35a1('0x28')](respondWithStatusCode(_0x41243c,null))['catch'](handleError(_0x41243c,null));};exports[_0x35a1('0xcd')]=function(_0x43eeb0,_0x2d0d7e){var _0xb3da4d=moment()[_0x35a1('0xce')]()[_0x35a1('0x9a')]();var _0x526683=path[_0x35a1('0xcf')](config[_0x35a1('0xd0')],'server',_0x35a1('0xd1'),_0x35a1('0xd2'));var _0x4d7511=path[_0x35a1('0xcf')](config[_0x35a1('0xd0')],_0x35a1('0xd3'),_0x35a1('0xd1'),_0x35a1('0xd4'));var _0x20c22b=path[_0x35a1('0xcf')](_0x526683,_0xb3da4d);var _0x47726f=util['format'](_0x35a1('0xd5'),_0x43eeb0[_0x35a1('0xb5')]['id'],_0xb3da4d);var _0x1deab9=path[_0x35a1('0xcf')](_0x526683,_0x47726f);var _0x79f8cd=[];_0x79f8cd['push']({'model':db[_0x35a1('0xd6')],'as':'Attachment','raw':!![]});var _0xd2fcbe=[{'model':db[_0x35a1('0xbe')],'as':'Messages','attributes':['id',_0x35a1('0x72'),'createdAt'],'include':_0x79f8cd}];return db[_0x35a1('0x9c')][_0x35a1('0x5e')]({'where':{'id':_0x43eeb0[_0x35a1('0xb5')]['id']},'include':_0xd2fcbe})[_0x35a1('0x28')](handleEntityNotFound(_0x2d0d7e,null))[_0x35a1('0x28')](function(_0x133fd2){if(_0x133fd2&&_0x133fd2[_0x35a1('0xd7')]){var _0x199246=_0x133fd2[_0x35a1('0xd8')]({'plain':!![]});fs[_0x35a1('0xd9')](_0x20c22b);for(var _0x38e125=0x0;_0x38e125<_0x199246[_0x35a1('0xd7')][_0x35a1('0x3e')];_0x38e125++){var _0x525fed=_0x199246['Messages'][_0x38e125]['Attachment'];if(_0x525fed){var _0xbc9306=path[_0x35a1('0xcf')](_0x4d7511,_0x525fed[_0x35a1('0xda')]);if(fs[_0x35a1('0xdb')](_0xbc9306)){fs['createReadStream'](_0xbc9306)[_0x35a1('0xdc')](fs[_0x35a1('0xdd')](path[_0x35a1('0xcf')](_0x20c22b,_0x525fed[_0x35a1('0xda')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x59bb95,_0x22bf57){zipdir(_0x20c22b,{'saveTo':_0x1deab9},function(_0x207a94,_0xf3a311){if(_0x207a94)return _0x22bf57(_0x207a94);return _0x59bb95(_0xf3a311);});})[_0x35a1('0x28')](function(){return new BPromise(function(_0x2c4305,_0xb89740){rimraf(_0x20c22b,function(_0x3f1a27){if(_0x3f1a27)_0xb89740(_0x3f1a27);return _0x2c4305();});});})[_0x35a1('0x28')](function(){return _0x2d0d7e['download'](_0x1deab9,_0x47726f,function(_0x150a57){if(_0x150a57){console[_0x35a1('0xde')](_0x35a1('0xdf'),_0x150a57);}else{fs[_0x35a1('0xe0')](_0x1deab9);}});});});}else{return _0x2d0d7e[_0x35a1('0x1d')](0xc8);}})[_0x35a1('0x35')](handleError(_0x2d0d7e,null));}; \ No newline at end of file +var _0xab95=['user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','toString','groupBy','FaxInteractionId','all','rows','show','params','include','options','create','describe','addMessage','FaxMessage','ids','omit','findOne','rawAttributes','hasOwnProperty','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','emit','faxInteractionTags:save','download','unix','join','root','server','files','tmp','attachments','Attachment','Messages','get','mkdirSync','basename','pipe','createWriteStream','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxInteraction.socket','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','fieldName','type','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','fax_accounts','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','start','body','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL'];(function(_0x48c31c,_0x409bfc){var _0x232404=function(_0x6069dc){while(--_0x6069dc){_0x48c31c['push'](_0x48c31c['shift']());}};_0x232404(++_0x409bfc);}(_0xab95,0x1d5));var _0x5ab9=function(_0x2b61ad,_0x54fe85){_0x2b61ad=_0x2b61ad-0x0;var _0x5a4b56=_0xab95[_0x2b61ad];return _0x5a4b56;};'use strict';var pdf=require(_0x5ab9('0x0'));var emlformat=require(_0x5ab9('0x1'));var rimraf=require(_0x5ab9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ab9('0x3'));var rp=require(_0x5ab9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5ab9('0x5'));var util=require(_0x5ab9('0x6'));var path=require('path');var sox=require(_0x5ab9('0x7'));var csv=require(_0x5ab9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ab9('0x9'));var squel=require(_0x5ab9('0xa'));var crypto=require('crypto');var jsforce=require(_0x5ab9('0xb'));var deskjs=require(_0x5ab9('0xc'));var toCsv=require(_0x5ab9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5ab9('0xd'));var authService=require(_0x5ab9('0xe'));var qs=require(_0x5ab9('0xf'));var as=require(_0x5ab9('0x10'));var hardwareService=require(_0x5ab9('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5ab9('0x12'));var config=require(_0x5ab9('0x13'));var db=require('../../mysqldb')['db'];config[_0x5ab9('0x14')]=_['defaults'](config[_0x5ab9('0x14')],{'host':_0x5ab9('0x15'),'port':0x18eb});var socket=require(_0x5ab9('0x16'))(new Redis(config[_0x5ab9('0x14')]));require(_0x5ab9('0x17'))['register'](socket);function respondWithStatusCode(_0xec9e3c,_0x161c4c){_0x161c4c=_0x161c4c||0xcc;return function(_0x49ce14){if(_0x49ce14){return _0xec9e3c['sendStatus'](_0x161c4c);}return _0xec9e3c[_0x5ab9('0x18')](_0x161c4c)['end']();};}function respondWithResult(_0x4bcf18,_0x249172){_0x249172=_0x249172||0xc8;return function(_0x185056){if(_0x185056){return _0x4bcf18[_0x5ab9('0x18')](_0x249172)[_0x5ab9('0x19')](_0x185056);}};}function respondWithFilteredResult(_0x109a84,_0x23bddf){return function(_0x3e186f){if(_0x3e186f){var _0x49970d=_0x3e186f[_0x5ab9('0x1a')],_0x123145=_0x23bddf[_0x5ab9('0x1b')],_0x274383=_0x23bddf['offset']+_0x23bddf[_0x5ab9('0x1c')],_0x5865ea;if(_0x274383>=_0x49970d){_0x274383=_0x49970d;_0x5865ea=0xc8;}else{_0x5865ea=0xce;}_0x109a84[_0x5ab9('0x18')](_0x5865ea);return _0x109a84[_0x5ab9('0x1d')](_0x5ab9('0x1e'),_0x123145+'-'+_0x274383+'/'+_0x49970d)[_0x5ab9('0x19')](_0x3e186f);}return null;};}function patchUpdates(_0x10d90f){return function(_0x3de20a){try{jsonpatch[_0x5ab9('0x1f')](_0x3de20a,_0x10d90f,!![]);}catch(_0x2cac9f){return BPromise[_0x5ab9('0x20')](_0x2cac9f);}return _0x3de20a[_0x5ab9('0x21')]();};}function saveUpdates(_0x1ee365,_0x4c31e6){return function(_0x560d7a){if(_0x560d7a){return _0x560d7a[_0x5ab9('0x22')](_0x1ee365)['then'](function(_0x451da3){return _0x451da3;});}return null;};}function removeEntity(_0xdecd3d,_0x1c45db){return function(_0x1e1ab9){if(_0x1e1ab9){return _0x1e1ab9[_0x5ab9('0x23')]()[_0x5ab9('0x24')](function(){_0xdecd3d[_0x5ab9('0x18')](0xcc)[_0x5ab9('0x25')]();});}};}function handleEntityNotFound(_0x333f52,_0x15bd3c){return function(_0x5a95e5){if(!_0x5a95e5){_0x333f52['sendStatus'](0x194);}return _0x5a95e5;};}function handleError(_0x2c65d2,_0x120c92){_0x120c92=_0x120c92||0x1f4;return function(_0x3303a5){logger[_0x5ab9('0x26')](_0x3303a5[_0x5ab9('0x27')]);if(_0x3303a5[_0x5ab9('0x28')]){delete _0x3303a5['name'];}_0x2c65d2[_0x5ab9('0x18')](_0x120c92)[_0x5ab9('0x29')](_0x3303a5);};}function getInteractionUsers(_0x50a386,_0x2e492b){return new BPromise(function(_0x302a6c,_0x4fccdf){try{if(_0x2e492b[_0x50a386['id']]){_0x50a386[_0x5ab9('0x2a')]=_[_0x5ab9('0x2b')](_0x2e492b[_0x50a386['id']],function(_0x130826){return{'id':_0x130826['id'],'fullname':_0x130826[_0x5ab9('0x2c')]};});}}catch(_0x342ae5){_0x4fccdf(_0x342ae5);}_0x302a6c(_0x50a386);});}function getInteractionTags(_0xf5c162,_0x3da00d){return new BPromise(function(_0x5da406,_0x5528b3){try{if(_0xf5c162[_0x5ab9('0x2d')]){_0xf5c162[_0x5ab9('0x2e')]=[];_0xf5c162[_0x5ab9('0x2d')][_0x5ab9('0x2f')](',')[_0x5ab9('0x30')](function(_0x4ba1ec){_0xf5c162[_0x5ab9('0x2e')][_0x5ab9('0x31')](_0x3da00d[_0x4ba1ec]);});}delete _0xf5c162[_0x5ab9('0x2d')];}catch(_0x55e362){_0x5528b3(_0x55e362);}_0x5da406(_0xf5c162);});}function updateFaxInteraction(_0x3278ee,_0x42f1d6,_0xe42dd9){return new BPromise(function(_0x1a3e0c,_0x127732){return getInteractionUsers(_0x3278ee,_0xe42dd9)[_0x5ab9('0x24')](function(_0x42cb5c){return getInteractionTags(_0x42cb5c,_0x42f1d6);})[_0x5ab9('0x24')](function(_0x490d2f){_0x1a3e0c(_0x490d2f);})[_0x5ab9('0x32')](function(_0x214602){_0x127732(_0x214602);});});}exports[_0x5ab9('0x33')]=function(_0x143be9,_0x2e0623){var _0x51808={},_0x1f0984={},_0x1de418={'count':0x0,'rows':[]};var _0x6fa551=_[_0x5ab9('0x2b')](db[_0x5ab9('0x34')]['rawAttributes'],function(_0x242ff6){return{'name':_0x242ff6[_0x5ab9('0x35')],'type':_0x242ff6[_0x5ab9('0x36')]['key']};});_0x1f0984[_0x5ab9('0x37')]=_[_0x5ab9('0x2b')](_0x6fa551,_0x5ab9('0x28'));_0x1f0984[_0x5ab9('0x38')]=_[_0x5ab9('0x39')](_0x143be9[_0x5ab9('0x38')]);_0x1f0984[_0x5ab9('0x3a')]=_[_0x5ab9('0x3b')](_0x1f0984['model'],_0x1f0984[_0x5ab9('0x38')]);_0x51808[_0x5ab9('0x3c')]=_[_0x5ab9('0x3b')](_0x1f0984[_0x5ab9('0x37')],qs['fields'](_0x143be9[_0x5ab9('0x38')]['fields']));_0x51808['attributes']=_0x51808['attributes'][_0x5ab9('0x3d')]?_0x51808[_0x5ab9('0x3c')]:_0x1f0984[_0x5ab9('0x37')];if(!_0x143be9[_0x5ab9('0x38')]['hasOwnProperty']('nolimit')){_0x51808[_0x5ab9('0x1c')]=qs[_0x5ab9('0x1c')](_0x143be9[_0x5ab9('0x38')][_0x5ab9('0x1c')]);_0x51808[_0x5ab9('0x1b')]=qs[_0x5ab9('0x1b')](_0x143be9[_0x5ab9('0x38')]['offset']);}_0x51808[_0x5ab9('0x3e')]=qs[_0x5ab9('0x3f')](_0x143be9[_0x5ab9('0x38')][_0x5ab9('0x3f')]);_0x51808[_0x5ab9('0x40')]=qs['filters'](_[_0x5ab9('0x41')](_0x143be9[_0x5ab9('0x38')],_0x1f0984[_0x5ab9('0x3a')]),_0x6fa551);var _0xf1f964=[];var _0x535478=squel[_0x5ab9('0x42')]()[_0x5ab9('0x43')]('id')['field']('name')[_0x5ab9('0x43')](_0x5ab9('0x44'))['from'](_0x5ab9('0x45'));var _0x4f9a73=squel['select']()['field'](_0x5ab9('0x46'))[_0x5ab9('0x43')](_0x5ab9('0x47'))[_0x5ab9('0x43')]('ui.FaxInteractionId')['from']('user_has_fax_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x3c6b4c=squel[_0x5ab9('0x42')]()['from']('fax_interactions','i')[_0x5ab9('0x48')](_0x5ab9('0x49'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5ab9('0x48')](_0x5ab9('0x4a'),'o',_0x5ab9('0x4b'))[_0x5ab9('0x48')](_0x5ab9('0x4c'),'a','a.id\x20=\x20i.FaxAccountId')[_0x5ab9('0x48')]('fax_messages','me',_0x5ab9('0x4d'))['left_join'](_0x5ab9('0x4e'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x5ab9('0x48')](_0x5ab9('0x45'),'t',_0x5ab9('0x4f'));var _0x13daa8=squel[_0x5ab9('0x50')]();var _0x571328=[];var _0x13a8eb=squel['expr']();var _0x3e7571;if(_0x143be9[_0x5ab9('0x38')]['search']){_0x3e7571=as[_0x5ab9('0x51')](_0x143be9['query'][_0x5ab9('0x52')]);var _0x58e043=_0x3e7571[_0x5ab9('0x53')];for(var _0x2fbfb8=0x0;_0x2fbfb8<_0x3e7571[_0x5ab9('0x54')][_0x5ab9('0x3d')];_0x2fbfb8++){var _0x5caa29=_0x3e7571[_0x5ab9('0x54')][_0x2fbfb8];var _0x37c4a6='i';var _0x1cb565=_['find'](_0x6fa551,[_0x5ab9('0x28'),_0x5caa29[_0x5ab9('0x43')]]);if(!_0x1cb565){switch(_0x5caa29['field']){case _0x5ab9('0x55'):if(_0x5caa29[_0x5ab9('0x56')]==0x1){_0x3c6b4c[_0x5ab9('0x57')]('`'+_0x5caa29[_0x5ab9('0x43')]+'`\x20=\x200');}else{_0x3c6b4c[_0x5ab9('0x57')]('`'+_0x5caa29[_0x5ab9('0x43')]+_0x5ab9('0x58'));}break;case _0x5ab9('0x59'):if(_0x5caa29['operator']===_0x5ab9('0x5a')){if(_0x5caa29[_0x5ab9('0x56')][_0x5ab9('0x2f')]('\x20')[_0x5ab9('0x3d')]>0x1){_0x13daa8[_0x58e043]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5ab9('0x5b')](_0x5caa29['value']),null);}else{var _0xec78bc='%'+_0x5caa29['value']+'%';_0x13daa8[_0x58e043](_0x5ab9('0x5c'),_0xec78bc,_0xec78bc,_0xec78bc);}}else{_0x1cb565=_[_0x5ab9('0x5d')](_0x6fa551,[_0x5ab9('0x28'),'ContactId']);_0x5caa29[_0x5ab9('0x43')]=_0x5ab9('0x5e');_0x203b49=as[_0x5ab9('0x5f')](_0x37c4a6,_0x1cb565['type'],_0x5caa29);_0x13daa8[_0x58e043](_0x203b49[_0x5ab9('0x60')],_0x203b49[_0x5ab9('0x56')]['start'],_0x203b49[_0x5ab9('0x56')][_0x5ab9('0x25')]);}break;case'Tag':var _0x18acc4=_0x5caa29[_0x5ab9('0x56')][_0x5ab9('0x2f')](',')[_0x5ab9('0x2b')](function(_0x5e1634){return Number(_0x5e1634);});_0x18acc4['forEach'](function(_0x22266e){_0x13a8eb['or'](_0x5ab9('0x61'),'%,'+_0x22266e+',%');});_0x571328=_[_0x5ab9('0x62')](_0x571328,_0x18acc4);break;case _0x5ab9('0x63'):if(_0x5caa29[_0x5ab9('0x64')]===_0x5ab9('0x5a')){_0x13daa8[_0x58e043]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5caa29[_0x5ab9('0x56')]+'%',null);}else{_0x1cb565=_[_0x5ab9('0x5d')](_0x6fa551,[_0x5ab9('0x28'),_0x5ab9('0x65')]);_0x5caa29['field']=_0x5ab9('0x65');_0x203b49=as[_0x5ab9('0x5f')](_0x37c4a6,_0x1cb565[_0x5ab9('0x36')],_0x5caa29);_0x13daa8[_0x58e043](_0x203b49[_0x5ab9('0x60')],_0x203b49[_0x5ab9('0x56')][_0x5ab9('0x66')],_0x203b49[_0x5ab9('0x56')][_0x5ab9('0x25')]);}break;case _0x5ab9('0x67'):_0x203b49=as['buildExpression']('me',null,_0x5caa29);_0x13daa8[_0x58e043](_0x203b49[_0x5ab9('0x60')],_0x203b49[_0x5ab9('0x56')][_0x5ab9('0x66')],_0x203b49[_0x5ab9('0x56')][_0x5ab9('0x25')]);break;}}else{var _0x203b49=as[_0x5ab9('0x5f')](_0x37c4a6,_0x1cb565[_0x5ab9('0x36')],_0x5caa29);_0x13daa8[_0x58e043](_0x203b49['text'],_0x203b49[_0x5ab9('0x56')][_0x5ab9('0x66')],_0x203b49[_0x5ab9('0x56')]['end']);}}}else{var _0x5586f1=_(_0x143be9[_0x5ab9('0x38')])[_0x5ab9('0x39')]()['map'](function(_0x53b92f){return _['some'](_0x6fa551,[_0x5ab9('0x28'),_0x53b92f])?_0x53b92f:undefined;})[_0x5ab9('0x68')]()[_0x5ab9('0x56')]();if(!_['isEmpty'](_0x5586f1)){_0x5586f1['forEach'](function(_0x15b6bd){if(_0x15b6bd===_0x5ab9('0x69')){_0x3c6b4c[_0x5ab9('0x40')](_0x5ab9('0x6a'),[][_0x5ab9('0x6b')](_0x143be9[_0x5ab9('0x38')][_0x15b6bd]));}else if(_0x15b6bd===_0x5ab9('0x6c')){var _0x342985=JSON['parse'](_0x143be9[_0x5ab9('0x38')][_0x15b6bd])[_0x5ab9('0x6d')];var _0x39894f=JSON[_0x5ab9('0x6e')](_0x143be9['query'][_0x15b6bd])[_0x5ab9('0x6f')];_0x3c6b4c[_0x5ab9('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x342985,_0x39894f);}else{if(_0x143be9[_0x5ab9('0x38')][_0x15b6bd]==='null'){_0x3c6b4c[_0x5ab9('0x40')]('i.'+_0x15b6bd+_0x5ab9('0x70'));}else{_0x3c6b4c[_0x5ab9('0x40')]('i.'+_0x15b6bd+_0x5ab9('0x71'),_0x143be9[_0x5ab9('0x38')][_0x15b6bd]);}}});}if(_0x143be9['query'][_0x5ab9('0x72')]){if(_0x143be9['query'][_0x5ab9('0x72')]==0x1){_0x3c6b4c[_0x5ab9('0x57')](_0x5ab9('0x73'));}else{_0x3c6b4c[_0x5ab9('0x57')](_0x5ab9('0x74'));}}if(_0x143be9[_0x5ab9('0x38')][_0x5ab9('0x75')]){_0x571328=_[_0x5ab9('0x76')](_0x143be9[_0x5ab9('0x38')][_0x5ab9('0x75')])?_0x143be9[_0x5ab9('0x38')]['tag']:new Array(_0x143be9[_0x5ab9('0x38')][_0x5ab9('0x75')]);_0x571328['forEach'](function(_0x1efdfd){_0x13a8eb['or'](_0x5ab9('0x61'),'%,'+_0x1efdfd+',%');});}if(_0x143be9[_0x5ab9('0x38')][_0x5ab9('0x77')]){var _0x6ae8d0=_0x143be9[_0x5ab9('0x38')][_0x5ab9('0x77')][_0x5ab9('0x78')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x5ab9('0x79'));if(qs[_0x5ab9('0x7a')](_0x6ae8d0)){_0x13daa8['or']('i.id\x20LIKE\x20?',_0x6ae8d0+'%')['or'](_0x5ab9('0x7b'),_0x6ae8d0+'%');}_0x13daa8['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x6ae8d0+'%');}}_0x3c6b4c[_0x5ab9('0x40')](_0x13daa8);_0x3c6b4c['group']('i.id');var _0x2d9fc3={'type':db[_0x5ab9('0x7c')][_0x5ab9('0x7d')][_0x5ab9('0x7e')],'raw':!![]};var _0xf75283=_0x3c6b4c['clone']();_0xf75283[_0x5ab9('0x43')](_0x5ab9('0x7f'));_0xf75283[_0x5ab9('0x43')](_0x5ab9('0x80'),_0x5ab9('0x55'));if(_0x51808['order']){_0x51808[_0x5ab9('0x3e')]['forEach'](function(_0x2569d6){_0x3c6b4c[_0x5ab9('0x3e')]('i.'+_0x2569d6[0x0],_0x2569d6[0x1]===_0x5ab9('0x81')?![]:!![]);});}if(!_[_0x5ab9('0x82')](_0x571328)){_0x3c6b4c[_0x5ab9('0x57')](_0x13a8eb);_0xf75283[_0x5ab9('0x40')]('t.id\x20IN\x20?',_0x571328);}BPromise[_0x5ab9('0x83')]()[_0x5ab9('0x24')](function(){if(!_0x3e7571){if(_0x143be9[_0x5ab9('0x38')]['FaxAccountId']||_0x143be9[_0x5ab9('0x38')][_0x5ab9('0x84')])return;_0xf75283[_0x5ab9('0x40')](_0x5ab9('0x85'));_0x3c6b4c['where'](_0x5ab9('0x85'));return;}return _0x143be9[_0x5ab9('0x86')][_0x5ab9('0x87')]({'attributes':['id'],'raw':!![]})['then'](function(_0x8a630a){if(_[_0x5ab9('0x82')](_0x8a630a)){_0xf75283['where'](_0x5ab9('0x88'));_0x3c6b4c[_0x5ab9('0x40')]('i.FaxAccountId\x20IS\x20NULL');}else{_0xf75283['where'](_0x5ab9('0x6a'),_[_0x5ab9('0x2b')](_0x8a630a,'id'));_0x3c6b4c[_0x5ab9('0x40')](_0x5ab9('0x6a'),_[_0x5ab9('0x2b')](_0x8a630a,'id'));}});})[_0x5ab9('0x24')](function(){db[_0x5ab9('0x89')]['query'](_0xf75283['toString'](),_0x2d9fc3)[_0x5ab9('0x24')](function(_0x26a8ea){_0x1de418[_0x5ab9('0x1a')]=_0x26a8ea['length'];if(_0x1de418[_0x5ab9('0x1a')]===0x0)return[];return db[_0x5ab9('0x89')][_0x5ab9('0x38')](_0x535478['toString'](),_0x2d9fc3)[_0x5ab9('0x24')](function(_0x4e296a){_0xf1f964=_['keyBy'](_0x4e296a,'id');_0x2d9fc3=_[_0x5ab9('0x8a')](_0x2d9fc3,{'model':db[_0x5ab9('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x143be9['query'][_0x5ab9('0x8b')]){_0x51808[_0x5ab9('0x3c')]['forEach'](function(_0x24468f){_0x3c6b4c['field']('i.'+_0x24468f);});}else{_0x3c6b4c[_0x5ab9('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5ab9('0x55'));_0x3c6b4c['field'](_0x5ab9('0x8c'),_0x5ab9('0x8d'));_0x3c6b4c[_0x5ab9('0x43')](_0x5ab9('0x8e'),_0x5ab9('0x8f'));_0x3c6b4c['field']('i.*');_0x3c6b4c[_0x5ab9('0x43')]('c.firstName',_0x5ab9('0x90'));_0x3c6b4c['field'](_0x5ab9('0x91'),_0x5ab9('0x92'));_0x3c6b4c[_0x5ab9('0x43')]('c.email',_0x5ab9('0x93'));_0x3c6b4c[_0x5ab9('0x43')](_0x5ab9('0x94'),_0x5ab9('0x95'));_0x3c6b4c[_0x5ab9('0x43')]('c.mobile',_0x5ab9('0x96'));_0x3c6b4c[_0x5ab9('0x43')](_0x5ab9('0x97'),_0x5ab9('0x98'));_0x3c6b4c[_0x5ab9('0x43')](_0x5ab9('0x99'),'Owner.fullname');_0x3c6b4c['field']('o.internal','Owner.internal');_0x3c6b4c['field'](_0x5ab9('0x9a'),_0x5ab9('0x2d'));}if(_0x51808[_0x5ab9('0x1c')])_0x3c6b4c[_0x5ab9('0x1c')](_0x51808[_0x5ab9('0x1c')]);if(_0x51808['offset'])_0x3c6b4c['offset'](_0x51808[_0x5ab9('0x1b')]);return db[_0x5ab9('0x89')][_0x5ab9('0x38')](_0x3c6b4c['toString'](),_0x2d9fc3);})[_0x5ab9('0x24')](function(_0x409042){_0x4f9a73['where'](_0x5ab9('0x9b'),_['map'](_0x409042,'id'));return db['sequelize'][_0x5ab9('0x38')](_0x4f9a73[_0x5ab9('0x9c')](),_0x2d9fc3)[_0x5ab9('0x24')](function(_0x5d11ac){var _0x9cb174=_[_0x5ab9('0x9d')](_0x5d11ac,_0x5ab9('0x9e'));var _0x29c0ca=[];_0x409042[_0x5ab9('0x30')](function(_0xfb25a2){_0x29c0ca[_0x5ab9('0x31')](updateFaxInteraction(_0xfb25a2,_0xf1f964,_0x9cb174));});return BPromise[_0x5ab9('0x9f')](_0x29c0ca);});});})[_0x5ab9('0x24')](function(_0x14398b){_0x1de418[_0x5ab9('0xa0')]=_0x14398b;return _0x1de418;})[_0x5ab9('0x24')](respondWithFilteredResult(_0x2e0623,_0x51808));})[_0x5ab9('0x32')](handleError(_0x2e0623,null));};exports[_0x5ab9('0xa1')]=function(_0x51a148,_0x14665b){var _0x3d4a47={'raw':![],'where':{'id':_0x51a148[_0x5ab9('0xa2')]['id']}},_0x1da635={};_0x1da635[_0x5ab9('0x37')]=_[_0x5ab9('0x39')](db[_0x5ab9('0x34')]['rawAttributes']);_0x1da635['query']=_['keys'](_0x51a148[_0x5ab9('0x38')]);_0x1da635['filters']=_[_0x5ab9('0x3b')](_0x1da635['model'],_0x1da635[_0x5ab9('0x38')]);_0x3d4a47[_0x5ab9('0x3c')]=_[_0x5ab9('0x3b')](_0x1da635[_0x5ab9('0x37')],qs[_0x5ab9('0x8b')](_0x51a148[_0x5ab9('0x38')]['fields']));_0x3d4a47[_0x5ab9('0x3c')]=_0x3d4a47[_0x5ab9('0x3c')][_0x5ab9('0x3d')]?_0x3d4a47[_0x5ab9('0x3c')]:_0x1da635[_0x5ab9('0x37')];if(_0x51a148[_0x5ab9('0x38')]['includeAll']){_0x3d4a47[_0x5ab9('0xa3')]=[{'all':!![]}];}_0x3d4a47=_[_0x5ab9('0x8a')]({},_0x3d4a47,_0x51a148[_0x5ab9('0xa4')]);return db[_0x5ab9('0x34')][_0x5ab9('0x5d')](_0x3d4a47)[_0x5ab9('0x24')](handleEntityNotFound(_0x14665b,null))[_0x5ab9('0x24')](respondWithResult(_0x14665b,null))['catch'](handleError(_0x14665b,null));};exports[_0x5ab9('0xa5')]=function(_0x4a1b39,_0x37bbc7){return db[_0x5ab9('0x34')]['create'](_0x4a1b39[_0x5ab9('0x67')],{})['then'](respondWithResult(_0x37bbc7,0xc9))[_0x5ab9('0x32')](handleError(_0x37bbc7,null));};exports[_0x5ab9('0x22')]=function(_0x5d9279,_0x5d4e33){if(_0x5d9279[_0x5ab9('0x67')]['id']){delete _0x5d9279['body']['id'];}return db[_0x5ab9('0x34')][_0x5ab9('0x5d')]({'where':{'id':_0x5d9279[_0x5ab9('0xa2')]['id']}})[_0x5ab9('0x24')](handleEntityNotFound(_0x5d4e33,null))[_0x5ab9('0x24')](saveUpdates(_0x5d9279[_0x5ab9('0x67')],null))['then'](respondWithResult(_0x5d4e33,null))[_0x5ab9('0x32')](handleError(_0x5d4e33,null));};exports['destroy']=function(_0x255e74,_0x485c7a){return db[_0x5ab9('0x34')][_0x5ab9('0x5d')]({'where':{'id':_0x255e74[_0x5ab9('0xa2')]['id']}})[_0x5ab9('0x24')](handleEntityNotFound(_0x485c7a,null))[_0x5ab9('0x24')](removeEntity(_0x485c7a,null))['catch'](handleError(_0x485c7a,null));};exports[_0x5ab9('0xa6')]=function(_0xaf30ff,_0x3c9bf4){return db[_0x5ab9('0x34')]['describe']()[_0x5ab9('0x24')](respondWithResult(_0x3c9bf4,null))[_0x5ab9('0x32')](handleError(_0x3c9bf4,null));};exports[_0x5ab9('0xa7')]=function(_0x1a4709,_0x1fdaa5,_0x34063e){return db[_0x5ab9('0xa8')][_0x5ab9('0x5d')]({'where':{'id':_0x1a4709[_0x5ab9('0xa2')]['id']}})[_0x5ab9('0x24')](handleEntityNotFound(_0x1fdaa5,null))['then'](function(_0x3479a9){if(_0x3479a9){return _0x3479a9['addMessage'](_0x1a4709[_0x5ab9('0x67')][_0x5ab9('0xa9')],_[_0x5ab9('0xaa')](_0x1a4709['body'],[_0x5ab9('0xa9'),'id'])||{});}})['then'](respondWithResult(_0x1fdaa5,null))['catch'](handleError(_0x1fdaa5,null));};exports['getMessages']=function(_0x47ab3b,_0x41a320,_0x3cbdd2){var _0x54963b={'raw':![],'where':{}};var _0x4b50f2={};var _0x61fe20={'count':0x0,'rows':[]};return db[_0x5ab9('0x34')][_0x5ab9('0xab')]({'where':{'id':_0x47ab3b['params']['id']}})[_0x5ab9('0x24')](handleEntityNotFound(_0x41a320,null))[_0x5ab9('0x24')](function(_0x3ef04e){if(_0x3ef04e){_0x4b50f2[_0x5ab9('0x37')]=_['keys'](db[_0x5ab9('0xa8')][_0x5ab9('0xac')]);_0x4b50f2[_0x5ab9('0x38')]=_[_0x5ab9('0x39')](_0x47ab3b[_0x5ab9('0x38')]);_0x4b50f2[_0x5ab9('0x3a')]=_[_0x5ab9('0x3b')](_0x4b50f2['model'],_0x4b50f2[_0x5ab9('0x38')]);_0x54963b[_0x5ab9('0x3c')]=_[_0x5ab9('0x3b')](_0x4b50f2[_0x5ab9('0x37')],qs[_0x5ab9('0x8b')](_0x47ab3b['query'][_0x5ab9('0x8b')]));_0x54963b['attributes']=_0x54963b['attributes'][_0x5ab9('0x3d')]?_0x54963b[_0x5ab9('0x3c')]:_0x4b50f2[_0x5ab9('0x37')];if(!_0x47ab3b['query'][_0x5ab9('0xad')](_0x5ab9('0xae'))){_0x54963b[_0x5ab9('0x1c')]=qs[_0x5ab9('0x1c')](_0x47ab3b[_0x5ab9('0x38')][_0x5ab9('0x1c')]);_0x54963b[_0x5ab9('0x1b')]=qs[_0x5ab9('0x1b')](_0x47ab3b['query']['offset']);}_0x54963b[_0x5ab9('0x3e')]=qs['sort'](_0x47ab3b['query']['sort']);_0x54963b[_0x5ab9('0x40')]=qs[_0x5ab9('0x3a')](_['pick'](_0x47ab3b[_0x5ab9('0x38')],_0x4b50f2[_0x5ab9('0x3a')]));_0x54963b['where'][_0x5ab9('0x9e')]=_0x3ef04e['id'];if(_0x47ab3b['query'][_0x5ab9('0x77')]){_0x54963b[_0x5ab9('0x40')]=_[_0x5ab9('0x8a')](_0x54963b[_0x5ab9('0x40')],{'$or':_[_0x5ab9('0x2b')](_0x54963b['attributes'],function(_0x58fa3e){var _0x43ce95={};_0x43ce95[_0x58fa3e]={'$like':'%'+_0x47ab3b['query'][_0x5ab9('0x77')]+'%'};return _0x43ce95;})});}if(_0x47ab3b[_0x5ab9('0x38')][_0x5ab9('0x6d')]){var _0x23f35d=_0x47ab3b[_0x5ab9('0x38')][_0x5ab9('0x6d')][_0x5ab9('0x2f')](',');var _0x415ab5={};_0x415ab5[_0x23f35d[0x0]]={'$gte':moment(_0x23f35d[0x1])[_0x5ab9('0xaf')](_0x5ab9('0xb0'))};_0x54963b[_0x5ab9('0x40')]=_['merge'](_0x54963b[_0x5ab9('0x40')],_0x415ab5);}_0x54963b=_[_0x5ab9('0x8a')]({},_0x54963b,_0x47ab3b[_0x5ab9('0xa4')]);return db['FaxMessage'][_0x5ab9('0x1a')]({'where':_0x54963b[_0x5ab9('0x40')]})['then'](function(_0x56987b){_0x61fe20[_0x5ab9('0x1a')]=_0x56987b;if(_0x47ab3b['query']['includeAll']){_0x54963b[_0x5ab9('0xa3')]=[{'all':!![]}];}return db[_0x5ab9('0xa8')][_0x5ab9('0xb1')](_0x54963b);})['then'](function(_0x13d402){_0x61fe20['rows']=_0x13d402;return _0x61fe20;});}})[_0x5ab9('0x24')](respondWithFilteredResult(_0x41a320,_0x54963b))[_0x5ab9('0x32')](handleError(_0x41a320,null));};exports[_0x5ab9('0xb2')]=function(_0x5030d8,_0x532c44,_0x1e7b41){return db[_0x5ab9('0x34')][_0x5ab9('0x5d')]({'where':{'id':_0x5030d8[_0x5ab9('0xa2')]['id']}})[_0x5ab9('0x24')](handleEntityNotFound(_0x532c44,null))[_0x5ab9('0x24')](function(_0x467ec8){if(_0x467ec8){return _0x467ec8[_0x5ab9('0xb3')](_0x5030d8[_0x5ab9('0x67')][_0x5ab9('0xa9')],_[_0x5ab9('0xaa')](_0x5030d8[_0x5ab9('0x67')],['ids','id'])||{})[_0x5ab9('0xb4')](function(){return db[_0x5ab9('0xb5')][_0x5ab9('0xb1')]({'attributes':['id','name',_0x5ab9('0x44')],'where':{'id':_0x5030d8[_0x5ab9('0x67')][_0x5ab9('0xa9')]}});})[_0x5ab9('0x24')](function(_0x22bfd5){socket[_0x5ab9('0xb6')](_0x5ab9('0xb7'),{'id':Number(_0x5030d8[_0x5ab9('0xa2')]['id']),'tags':_0x22bfd5||[]});return{'id':Number(_0x5030d8[_0x5ab9('0xa2')]['id']),'tags':_0x22bfd5||[]};});}})[_0x5ab9('0x24')](respondWithResult(_0x532c44,null))[_0x5ab9('0x32')](handleError(_0x532c44,null));};exports['removeTags']=function(_0x8f17a8,_0x564b80,_0x2990c9){return db[_0x5ab9('0x34')][_0x5ab9('0x5d')]({'where':{'id':_0x8f17a8[_0x5ab9('0xa2')]['id']}})[_0x5ab9('0x24')](handleEntityNotFound(_0x564b80,null))[_0x5ab9('0x24')](function(_0x5db3b6){if(_0x5db3b6){return _0x5db3b6['removeTags'](_0x8f17a8[_0x5ab9('0x38')][_0x5ab9('0xa9')]);}})['then'](respondWithStatusCode(_0x564b80,null))[_0x5ab9('0x32')](handleError(_0x564b80,null));};exports[_0x5ab9('0xb8')]=function(_0x299fce,_0x4f565b){var _0x90266c=moment()[_0x5ab9('0xb9')]()[_0x5ab9('0x9c')]();var _0x43b0b3=path[_0x5ab9('0xba')](config[_0x5ab9('0xbb')],_0x5ab9('0xbc'),_0x5ab9('0xbd'),_0x5ab9('0xbe'));var _0x4c45cb=path[_0x5ab9('0xba')](config['root'],_0x5ab9('0xbc'),_0x5ab9('0xbd'),_0x5ab9('0xbf'));var _0x345f9e=path['join'](_0x43b0b3,_0x90266c);var _0x314656=util[_0x5ab9('0xaf')]('transcript-%d-%s.zip',_0x299fce[_0x5ab9('0xa2')]['id'],_0x90266c);var _0x2ade7a=path['join'](_0x43b0b3,_0x314656);var _0x50e21a=[];_0x50e21a[_0x5ab9('0x31')]({'model':db['Attachment'],'as':_0x5ab9('0xc0'),'raw':!![]});var _0x4df1ba=[{'model':db['FaxMessage'],'as':_0x5ab9('0xc1'),'attributes':['id',_0x5ab9('0x67'),_0x5ab9('0x6c')],'include':_0x50e21a}];return db[_0x5ab9('0x34')][_0x5ab9('0x5d')]({'where':{'id':_0x299fce[_0x5ab9('0xa2')]['id']},'include':_0x4df1ba})[_0x5ab9('0x24')](handleEntityNotFound(_0x4f565b,null))[_0x5ab9('0x24')](function(_0x1fff66){if(_0x1fff66&&_0x1fff66[_0x5ab9('0xc1')]){var _0x5d7aa7=_0x1fff66[_0x5ab9('0xc2')]({'plain':!![]});fs[_0x5ab9('0xc3')](_0x345f9e);for(var _0x490a79=0x0;_0x490a79<_0x5d7aa7[_0x5ab9('0xc1')][_0x5ab9('0x3d')];_0x490a79++){var _0x2bd7c1=_0x5d7aa7['Messages'][_0x490a79][_0x5ab9('0xc0')];if(_0x2bd7c1){var _0x481431=path[_0x5ab9('0xba')](_0x4c45cb,_0x2bd7c1[_0x5ab9('0xc4')]);if(fs['existsSync'](_0x481431)){fs['createReadStream'](_0x481431)[_0x5ab9('0xc5')](fs[_0x5ab9('0xc6')](path[_0x5ab9('0xba')](_0x345f9e,_0x2bd7c1[_0x5ab9('0xc4')])));}}}return BPromise[_0x5ab9('0x83')]()[_0x5ab9('0x24')](function(){return new BPromise(function(_0x233684,_0x393e20){zipdir(_0x345f9e,{'saveTo':_0x2ade7a},function(_0x390b69,_0x722345){if(_0x390b69)return _0x393e20(_0x390b69);return _0x233684(_0x722345);});})['then'](function(){return new BPromise(function(_0x2c2cfc,_0x3c1275){rimraf(_0x345f9e,function(_0x52cd8b){if(_0x52cd8b)_0x3c1275(_0x52cd8b);return _0x2c2cfc();});});})[_0x5ab9('0x24')](function(){return _0x4f565b['download'](_0x2ade7a,_0x314656,function(_0x23cd24){if(_0x23cd24){console['log']('err',_0x23cd24);}else{fs[_0x5ab9('0xc7')](_0x2ade7a);}});});});}else{return _0x4f565b[_0x5ab9('0xc8')](0xc8);}})['catch'](handleError(_0x4f565b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 1daf30b..36839a7 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 _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x57be88,_0x27e0c0){var _0x48c988=function(_0x486021){while(--_0x486021){_0x57be88['push'](_0x57be88['shift']());}};_0x48c988(++_0x27e0c0);}(_0x1261,0x144));var _0x1126=function(_0x1436d8,_0x5135aa){_0x1436d8=_0x1436d8-0x0;var _0x252c31=_0x1261[_0x1436d8];return _0x252c31;};'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 +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x98cceb,_0x1d7a9d){var _0x51a7ec=function(_0xb00029){while(--_0xb00029){_0x98cceb['push'](_0x98cceb['shift']());}};_0x51a7ec(++_0x1d7a9d);}(_0x1261,0x144));var _0x1126=function(_0xc20f22,_0x49698f){_0xc20f22=_0xc20f22-0x0;var _0x1535d5=_0x1261[_0xc20f22];return _0x1535d5;};'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 f9f2f12..a732bd6 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 _0xb821=['../../config/logger','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x4f7365,_0x197f0a){var _0x1a04a6=function(_0x1dd51d){while(--_0x1dd51d){_0x4f7365['push'](_0x4f7365['shift']());}};_0x1a04a6(++_0x197f0a);}(_0xb821,0xa7));var _0x1b82=function(_0x41f709,_0x1b5c71){_0x41f709=_0x41f709-0x0;var _0x279af4=_0xb821[_0x41f709];return _0x279af4;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18f45f,_0x7b87e8,_0x161155){if(_0x18f45f[_0x1b82('0xa')](_0x1b82('0xb'))){_0x18f45f['closedAt']=moment()[_0x1b82('0xc')](_0x1b82('0xd'));}_0x161155(null,_0x18f45f);}}});}; \ No newline at end of file +var _0x9bde=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt'];(function(_0x2461b7,_0xc02dd3){var _0x23b464=function(_0x46b695){while(--_0x46b695){_0x2461b7['push'](_0x2461b7['shift']());}};_0x23b464(++_0xc02dd3);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4eded9,_0x7fd677){_0x4eded9=_0x4eded9-0x0;var _0x4e9d1f=_0x9bde[_0x4eded9];return _0x4e9d1f;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d5c75,_0x3ef9e3,_0x29bc2b){if(_0x2d5c75[_0xe9bd('0xc')](_0xe9bd('0xd'))){_0x2d5c75[_0xe9bd('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x29bc2b(null,_0x2d5c75);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 43fb80f..bae57c9 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 _0x82cf=['spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','stringify','AddTagsToFaxInteraction','addTags','ids','omit'];(function(_0x472511,_0xdd8699){var _0x46878e=function(_0x3a1811){while(--_0x3a1811){_0x472511['push'](_0x472511['shift']());}};_0x46878e(++_0xdd8699);}(_0x82cf,0x1db));var _0xf82c=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x82cf[_0x149ca0];return _0x56b6b9;};'use strict';var _=require('lodash');var util=require(_0xf82c('0x0'));var moment=require(_0xf82c('0x1'));var BPromise=require(_0xf82c('0x2'));var rs=require(_0xf82c('0x3'));var fs=require('fs');var Redis=require(_0xf82c('0x4'));var db=require(_0xf82c('0x5'))['db'];var utils=require(_0xf82c('0x6'));var logger=require(_0xf82c('0x7'))(_0xf82c('0x8'));var config=require(_0xf82c('0x9'));var jayson=require(_0xf82c('0xa'));var client=jayson['client'][_0xf82c('0xb')]({'port':0x232a});config[_0xf82c('0xc')]=_[_0xf82c('0xd')](config[_0xf82c('0xc')],{'host':_0xf82c('0xe'),'port':0x18eb});var socket=require(_0xf82c('0xf'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xf82c('0x10')](socket);function respondWithRpcPromise(_0x2600c1,_0x444320,_0x38dfa6){return new BPromise(function(_0x315e5d,_0x1912f4){return client[_0xf82c('0x11')](_0x2600c1,_0x38dfa6)[_0xf82c('0x12')](function(_0x5909f4){logger[_0xf82c('0x13')](_0xf82c('0x14'),_0x444320,_0xf82c('0x15'));logger[_0xf82c('0x16')](_0xf82c('0x17'),_0x444320,_0xf82c('0x15'),JSON['stringify'](_0x5909f4));if(_0x5909f4['error']){if(_0x5909f4[_0xf82c('0x18')][_0xf82c('0x19')]===0x1f4){logger['error'](_0xf82c('0x14'),_0x444320,_0x5909f4[_0xf82c('0x18')][_0xf82c('0x1a')]);return _0x1912f4(_0x5909f4[_0xf82c('0x18')][_0xf82c('0x1a')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x444320,_0x5909f4[_0xf82c('0x18')][_0xf82c('0x1a')]);return _0x315e5d(_0x5909f4[_0xf82c('0x18')][_0xf82c('0x1a')]);}else{logger['info'](_0xf82c('0x14'),_0x444320,'request\x20sent');_0x315e5d(_0x5909f4['result'][_0xf82c('0x1a')]);}})[_0xf82c('0x1b')](function(_0x5f21c1){logger[_0xf82c('0x18')](_0xf82c('0x14'),_0x444320,_0x5f21c1);_0x1912f4(_0x5f21c1);});});}exports[_0xf82c('0x1c')]=function(_0x2e7ae9){var _0x343850=this;return new Promise(function(_0x1b789e,_0xdc249c){return db[_0xf82c('0x1d')][_0xf82c('0x1e')](_0x2e7ae9[_0xf82c('0x1f')],{'raw':_0x2e7ae9[_0xf82c('0x20')]?_0x2e7ae9[_0xf82c('0x20')][_0xf82c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e7ae9[_0xf82c('0x20')]?_0x2e7ae9[_0xf82c('0x20')]['where']||null:null,'attributes':_0x2e7ae9[_0xf82c('0x20')]?_0x2e7ae9['options'][_0xf82c('0x22')]||null:null,'limit':_0x2e7ae9['options']?_0x2e7ae9['options'][_0xf82c('0x23')]||null:null})['then'](function(_0x2cb59e){logger[_0xf82c('0x13')]('UpdateFaxInteraction',_0x2e7ae9);logger[_0xf82c('0x16')]('UpdateFaxInteraction',_0x2e7ae9,JSON[_0xf82c('0x24')](_0x2cb59e));_0x1b789e(_0x2cb59e);})[_0xf82c('0x1b')](function(_0x365a71){logger['error'](_0xf82c('0x1c'),_0x365a71['message'],_0x2e7ae9);_0xdc249c(_0x343850[_0xf82c('0x18')](0x1f4,_0x365a71[_0xf82c('0x1a')]));});});};exports[_0xf82c('0x25')]=function(_0x6c4812){return new Promise(function(_0x2319f3,_0x413853){return db[_0xf82c('0x1d')]['find']({'where':_0x6c4812['options']?_0x6c4812['options']['where']||null:null})[_0xf82c('0x12')](function(_0x4c83b3){if(_0x4c83b3){return _0x4c83b3[_0xf82c('0x26')](_0x6c4812[_0xf82c('0x1f')][_0xf82c('0x27')],_[_0xf82c('0x28')](_0x6c4812['body'],[_0xf82c('0x27'),'id'])||{});}})[_0xf82c('0x29')](function(_0x6f898e){logger[_0xf82c('0x13')](_0xf82c('0x2a'),_0x6c4812);logger['debug'](_0xf82c('0x2a'),_0x6c4812,JSON['stringify'](_0x6f898e));_0x2319f3(_0x6f898e);})[_0xf82c('0x1b')](function(_0x51bd06){logger['error'](_0xf82c('0x2a'),_0x51bd06[_0xf82c('0x1a')],_0x6c4812);_0x413853(_this[_0xf82c('0x18')](0x1f4,_0x51bd06['message']));});});}; \ No newline at end of file +var _0x8b63=['socket.io-emitter','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','stringify','find','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2f2cd0,_0x50b51c){var _0x2cf068=function(_0x460659){while(--_0x460659){_0x2f2cd0['push'](_0x2f2cd0['shift']());}};_0x2cf068(++_0x50b51c);}(_0x8b63,0x1b3));var _0x38b6=function(_0x4f3410,_0x544be2){_0x4f3410=_0x4f3410-0x0;var _0x58031c=_0x8b63[_0x4f3410];return _0x58031c;};'use strict';var _=require(_0x38b6('0x0'));var util=require(_0x38b6('0x1'));var moment=require(_0x38b6('0x2'));var BPromise=require(_0x38b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38b6('0x4'));var db=require(_0x38b6('0x5'))['db'];var utils=require(_0x38b6('0x6'));var logger=require(_0x38b6('0x7'))(_0x38b6('0x8'));var config=require(_0x38b6('0x9'));var jayson=require(_0x38b6('0xa'));var client=jayson[_0x38b6('0xb')][_0x38b6('0xc')]({'port':0x232a});config[_0x38b6('0xd')]=_[_0x38b6('0xe')](config[_0x38b6('0xd')],{'host':_0x38b6('0xf'),'port':0x18eb});var socket=require(_0x38b6('0x10'))(new Redis(config[_0x38b6('0xd')]));require(_0x38b6('0x11'))['register'](socket);function respondWithRpcPromise(_0x53c54c,_0x337ca5,_0xd52e01){return new BPromise(function(_0x512150,_0x30ebd7){return client['request'](_0x53c54c,_0xd52e01)[_0x38b6('0x12')](function(_0xcf07){logger[_0x38b6('0x13')](_0x38b6('0x14'),_0x337ca5,_0x38b6('0x15'));logger[_0x38b6('0x16')](_0x38b6('0x17'),_0x337ca5,_0x38b6('0x15'),JSON['stringify'](_0xcf07));if(_0xcf07[_0x38b6('0x18')]){if(_0xcf07[_0x38b6('0x18')][_0x38b6('0x19')]===0x1f4){logger[_0x38b6('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x337ca5,_0xcf07[_0x38b6('0x18')][_0x38b6('0x1a')]);return _0x30ebd7(_0xcf07[_0x38b6('0x18')][_0x38b6('0x1a')]);}logger['error'](_0x38b6('0x14'),_0x337ca5,_0xcf07[_0x38b6('0x18')][_0x38b6('0x1a')]);return _0x512150(_0xcf07[_0x38b6('0x18')][_0x38b6('0x1a')]);}else{logger[_0x38b6('0x13')](_0x38b6('0x14'),_0x337ca5,_0x38b6('0x15'));_0x512150(_0xcf07['result'][_0x38b6('0x1a')]);}})[_0x38b6('0x1b')](function(_0x2e7cad){logger[_0x38b6('0x18')](_0x38b6('0x14'),_0x337ca5,_0x2e7cad);_0x30ebd7(_0x2e7cad);});});}exports[_0x38b6('0x1c')]=function(_0x47a463){var _0x4880f1=this;return new Promise(function(_0xa52781,_0x23ed3b){return db[_0x38b6('0x1d')][_0x38b6('0x1e')](_0x47a463[_0x38b6('0x1f')],{'raw':_0x47a463[_0x38b6('0x20')]?_0x47a463[_0x38b6('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47a463[_0x38b6('0x20')]?_0x47a463[_0x38b6('0x20')][_0x38b6('0x21')]||null:null,'attributes':_0x47a463['options']?_0x47a463[_0x38b6('0x20')][_0x38b6('0x22')]||null:null,'limit':_0x47a463[_0x38b6('0x20')]?_0x47a463[_0x38b6('0x20')][_0x38b6('0x23')]||null:null})[_0x38b6('0x12')](function(_0x2f6b93){logger[_0x38b6('0x13')](_0x38b6('0x1c'),_0x47a463);logger[_0x38b6('0x16')](_0x38b6('0x1c'),_0x47a463,JSON[_0x38b6('0x24')](_0x2f6b93));_0xa52781(_0x2f6b93);})['catch'](function(_0x401705){logger[_0x38b6('0x18')]('UpdateFaxInteraction',_0x401705[_0x38b6('0x1a')],_0x47a463);_0x23ed3b(_0x4880f1[_0x38b6('0x18')](0x1f4,_0x401705[_0x38b6('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x398b52){return new Promise(function(_0x4f1d83,_0x2b62bb){return db['FaxInteraction'][_0x38b6('0x25')]({'where':_0x398b52[_0x38b6('0x20')]?_0x398b52[_0x38b6('0x20')][_0x38b6('0x21')]||null:null})[_0x38b6('0x12')](function(_0x25242f){if(_0x25242f){return _0x25242f['addTags'](_0x398b52[_0x38b6('0x1f')][_0x38b6('0x26')],_[_0x38b6('0x27')](_0x398b52['body'],['ids','id'])||{});}})['spread'](function(_0x245221){logger[_0x38b6('0x13')](_0x38b6('0x28'),_0x398b52);logger[_0x38b6('0x16')]('AddTags',_0x398b52,JSON[_0x38b6('0x24')](_0x245221));_0x4f1d83(_0x245221);})[_0x38b6('0x1b')](function(_0x4ac1aa){logger[_0x38b6('0x18')](_0x38b6('0x28'),_0x4ac1aa[_0x38b6('0x1a')],_0x398b52);_0x2b62bb(_this[_0x38b6('0x18')](0x1f4,_0x4ac1aa[_0x38b6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 90c32c8..54aa39d 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 _0x0ff9=['removeListener','register','./faxInteraction.events','save','remove','update'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x0ff9,0x1ee));var _0x90ff=function(_0x2c636b,_0x244f49){_0x2c636b=_0x2c636b-0x0;var _0x48fa49=_0x0ff9[_0x2c636b];return _0x48fa49;};'use strict';var FaxInteractionEvents=require(_0x90ff('0x0'));var events=[_0x90ff('0x1'),_0x90ff('0x2'),_0x90ff('0x3')];function createListener(_0x34297a,_0x3de446){return function(_0x5098d2){_0x3de446['emit'](_0x34297a,_0x5098d2);};}function removeListener(_0x28db47,_0x405aee){return function(){FaxInteractionEvents[_0x90ff('0x4')](_0x28db47,_0x405aee);};}exports[_0x90ff('0x5')]=function(_0x5d1158){for(var _0x17766c=0x0,_0x4eaf26=events['length'];_0x17766c<_0x4eaf26;_0x17766c++){var _0xe04b69=events[_0x17766c];var _0x24b241=createListener('faxInteraction:'+_0xe04b69,_0x5d1158);FaxInteractionEvents['on'](_0xe04b69,_0x24b241);}}; \ No newline at end of file +var _0x0c3f=['length','faxInteraction:','./faxInteraction.events','save','remove','update','removeListener','register'];(function(_0x1080e8,_0x24e9e3){var _0x30071b=function(_0x4e86f9){while(--_0x4e86f9){_0x1080e8['push'](_0x1080e8['shift']());}};_0x30071b(++_0x24e9e3);}(_0x0c3f,0x17a));var _0xf0c3=function(_0x4c7145,_0x2df4f8){_0x4c7145=_0x4c7145-0x0;var _0x13fe00=_0x0c3f[_0x4c7145];return _0x13fe00;};'use strict';var FaxInteractionEvents=require(_0xf0c3('0x0'));var events=[_0xf0c3('0x1'),_0xf0c3('0x2'),_0xf0c3('0x3')];function createListener(_0x53338e,_0x3c10b1){return function(_0x1814ec){_0x3c10b1['emit'](_0x53338e,_0x1814ec);};}function removeListener(_0xab64c2,_0xefcb38){return function(){FaxInteractionEvents[_0xf0c3('0x4')](_0xab64c2,_0xefcb38);};}exports[_0xf0c3('0x5')]=function(_0x5d1d59){for(var _0x11f3e7=0x0,_0x29458f=events[_0xf0c3('0x6')];_0x11f3e7<_0x29458f;_0x11f3e7++){var _0x3636d8=events[_0x11f3e7];var _0x44d123=createListener(_0xf0c3('0x7')+_0x3636d8,_0x5d1d59);FaxInteractionEvents['on'](_0x3636d8,_0x44d123);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 5cf06fc..1d4b5f2 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 _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(_0x5c2757,_0x473b6b){var _0x321fd8=function(_0x3d4ca4){while(--_0x3d4ca4){_0x5c2757['push'](_0x5c2757['shift']());}};_0x321fd8(++_0x473b6b);}(_0x9362,0x169));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'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 +var _0x09f1=['describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x2bd0dd,_0x167fb0){var _0x4637bb=function(_0x1bf601){while(--_0x1bf601){_0x2bd0dd['push'](_0x2bd0dd['shift']());}};_0x4637bb(++_0x167fb0);}(_0x09f1,0xbf));var _0x109f=function(_0x28bf05,_0x34631b){_0x28bf05=_0x28bf05-0x0;var _0x1cf312=_0x09f1[_0x28bf05];return _0x1cf312;};'use strict';var multer=require(_0x109f('0x0'));var util=require(_0x109f('0x1'));var path=require('path');var timeout=require(_0x109f('0x2'));var express=require(_0x109f('0x3'));var router=express[_0x109f('0x4')]();var auth=require(_0x109f('0x5'));var interaction=require(_0x109f('0x6'));var config=require(_0x109f('0x7'));var controller=require(_0x109f('0x8'));router[_0x109f('0x9')]('/',auth[_0x109f('0xa')](),controller[_0x109f('0xb')]);router['get'](_0x109f('0xc'),auth[_0x109f('0xa')](),controller[_0x109f('0xd')]);router[_0x109f('0x9')](_0x109f('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x109f('0xf'),auth[_0x109f('0xa')](),controller[_0x109f('0x10')]);router[_0x109f('0x9')](_0x109f('0x11'),auth[_0x109f('0xa')](),controller[_0x109f('0x12')]);router['post']('/',auth[_0x109f('0xa')](),controller['create']);router[_0x109f('0x13')]('/:id/messages',auth[_0x109f('0xa')](),controller[_0x109f('0x14')]);router['post'](_0x109f('0x15'),auth[_0x109f('0xa')](),interaction['tracked'](_0x109f('0x16'),_0x109f('0x17')),controller[_0x109f('0x18')]);router[_0x109f('0x19')](_0x109f('0xe'),auth['isAuthenticated'](),interaction[_0x109f('0x1a')](_0x109f('0x16'),_0x109f('0x1b')),controller[_0x109f('0x1c')]);router[_0x109f('0x1d')]('/:id',auth[_0x109f('0xa')](),interaction[_0x109f('0x1a')](_0x109f('0x16'),_0x109f('0x1e')),controller[_0x109f('0x1f')]);router[_0x109f('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller[_0x109f('0x20')]);module[_0x109f('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b4b0f0f..f85c88c 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 _0xecb9=['out','medium','BOOLEAN'];(function(_0x247031,_0x3948d4){var _0x4e6a28=function(_0x1395ea){while(--_0x1395ea){_0x247031['push'](_0x247031['shift']());}};_0x4e6a28(++_0x3948d4);}(_0xecb9,0x8b));var _0x9ecb=function(_0xdfcf22,_0x322509){_0xdfcf22=_0xdfcf22-0x0;var _0x59b62f=_0xecb9[_0xdfcf22];return _0x59b62f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x9ecb('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x9ecb('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9ecb('0x2')),'defaultValue':_0x9ecb('0x2'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x4a74=['out','DATE','sequelize','exports','TEXT','medium','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a74,0xbf));var _0x44a7=function(_0x3784ac,_0x506ec6){_0x3784ac=_0x3784ac-0x0;var _0x331a51=_0x4a74[_0x3784ac];return _0x331a51;};'use strict';var Sequelize=require(_0x44a7('0x0'));module[_0x44a7('0x1')]={'body':{'type':Sequelize[_0x44a7('0x2')](_0x44a7('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x44a7('0x4')]('in',_0x44a7('0x5')),'defaultValue':_0x44a7('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x44a7('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x44a7('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8fd3ca8..ea11c98 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 _0xd782=['interface','SIP/%s','channel','event','EventManager','fax-interactions','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','create','findOne','ContactId','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','attachments','Attachment','join','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','destroy','end','name','send','index','fieldName','key','map','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','FaxMessage','findAll','rows','show','rawAttributes','find','update','body','params','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteractionId','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual'];(function(_0x4fa91c,_0x135497){var _0xf0f4bb=function(_0xe80efb){while(--_0xe80efb){_0x4fa91c['push'](_0x4fa91c['shift']());}};_0xf0f4bb(++_0x135497);}(_0xd782,0xa4));var _0x2d78=function(_0xc94429,_0x56d676){_0xc94429=_0xc94429-0x0;var _0x3aad6c=_0xd782[_0xc94429];return _0x3aad6c;};'use strict';var pdf=require(_0x2d78('0x0'));var emlformat=require(_0x2d78('0x1'));var rimraf=require(_0x2d78('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2d78('0x3'));var moment=require(_0x2d78('0x4'));var BPromise=require(_0x2d78('0x5'));var Mustache=require(_0x2d78('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2d78('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2d78('0x8'));var squel=require(_0x2d78('0x9'));var crypto=require(_0x2d78('0xa'));var jsforce=require(_0x2d78('0xb'));var deskjs=require(_0x2d78('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2d78('0xd'));var Redis=require(_0x2d78('0xe'));var authService=require(_0x2d78('0xf'));var qs=require(_0x2d78('0x10'));var as=require(_0x2d78('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d78('0x12'))(_0x2d78('0x13'));var utils=require('../../config/utils');var config=require(_0x2d78('0x14'));var db=require(_0x2d78('0x15'))['db'];config[_0x2d78('0x16')]=_[_0x2d78('0x17')](config[_0x2d78('0x16')],{'host':_0x2d78('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2d78('0x19'))[_0x2d78('0x1a')](socket);var jayson=require(_0x2d78('0x1b'));var client=jayson[_0x2d78('0x1c')][_0x2d78('0x1d')]({'port':0x232c});var client9002=jayson[_0x2d78('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x1d1ff0,_0x49ddab,_0x3b80e6){if(_0x3b80e6){var _0x4cf909=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cf909['test'](_0x49ddab)){return _0x1d1ff0;}else{throw new db[(_0x2d78('0x1e'))][(_0x2d78('0x1f'))](_0x2d78('0x20'));}}else{return _0x1d1ff0;}}function respondWithRpcPromise(_0x42b459,_0xe9a02a,_0x31ba26,_0x5a49f6){return new BPromise(function(_0x1e185e,_0x135265){var _0x5e1f4b=_0x5a49f6||client;return _0x5e1f4b[_0x2d78('0x21')](_0x42b459,_0x31ba26)[_0x2d78('0x22')](function(_0x30de27){logger['info'](_0x2d78('0x23'),_0xe9a02a,_0x2d78('0x24'));logger[_0x2d78('0x25')](_0x2d78('0x26'),_0xe9a02a,_0x2d78('0x24'),JSON[_0x2d78('0x27')](_0x30de27));if(_0x30de27['error']){if(_0x30de27[_0x2d78('0x28')]['code']===0x1f4){logger[_0x2d78('0x28')](_0x2d78('0x23'),_0xe9a02a,_0x30de27[_0x2d78('0x28')][_0x2d78('0x29')]);return _0x135265(_0x30de27[_0x2d78('0x28')][_0x2d78('0x29')]);}logger[_0x2d78('0x28')](_0x2d78('0x23'),_0xe9a02a,_0x30de27['error'][_0x2d78('0x29')]);return _0x1e185e(_0x30de27[_0x2d78('0x28')][_0x2d78('0x29')]);}else{logger[_0x2d78('0x2a')](_0x2d78('0x23'),_0xe9a02a,'request\x20sent');_0x1e185e(_0x30de27[_0x2d78('0x2b')][_0x2d78('0x29')]);}})[_0x2d78('0x2c')](function(_0x430aec){logger[_0x2d78('0x28')](_0x2d78('0x23'),_0xe9a02a,_0x430aec);_0x135265(_0x430aec);});});}function respondWithStatusCode(_0x19a6c3,_0x3c7b8e){_0x3c7b8e=_0x3c7b8e||0xcc;return function(_0x36915f){if(_0x36915f){return _0x19a6c3[_0x2d78('0x2d')](_0x3c7b8e);}return _0x19a6c3[_0x2d78('0x2e')](_0x3c7b8e)['end']();};}function respondWithResult(_0x59f287,_0x5789db){_0x5789db=_0x5789db||0xc8;return function(_0xb58f56){if(_0xb58f56){return _0x59f287[_0x2d78('0x2e')](_0x5789db)[_0x2d78('0x2f')](_0xb58f56);}};}function respondWithFilteredResult(_0x1af55f,_0x5946b4){return function(_0x11a58b){if(_0x11a58b){var _0x22341e=_0x11a58b[_0x2d78('0x30')],_0x29f84b=_0x5946b4[_0x2d78('0x31')],_0x33534e=_0x5946b4[_0x2d78('0x31')]+_0x5946b4[_0x2d78('0x32')],_0x4a1158;if(_0x33534e>=_0x22341e){_0x33534e=_0x22341e;_0x4a1158=0xc8;}else{_0x4a1158=0xce;}_0x1af55f[_0x2d78('0x2e')](_0x4a1158);return _0x1af55f[_0x2d78('0x33')](_0x2d78('0x34'),_0x29f84b+'-'+_0x33534e+'/'+_0x22341e)[_0x2d78('0x2f')](_0x11a58b);}return null;};}function patchUpdates(_0x5ec945){return function(_0x2e1da2){try{jsonpatch[_0x2d78('0x35')](_0x2e1da2,_0x5ec945,!![]);}catch(_0x288f8e){return BPromise[_0x2d78('0x36')](_0x288f8e);}return _0x2e1da2['save']();};}function saveUpdates(_0xd6a377,_0xd914a8){return function(_0x1a8335){if(_0x1a8335){return _0x1a8335['update'](_0xd6a377)['then'](function(_0x426855){return _0x426855;});}return null;};}function removeEntity(_0x1f06eb,_0x2d9c8c){return function(_0x3fded5){if(_0x3fded5){return _0x3fded5[_0x2d78('0x37')]()[_0x2d78('0x22')](function(){_0x1f06eb['status'](0xcc)[_0x2d78('0x38')]();});}};}function handleEntityNotFound(_0x157959,_0x59e32d){return function(_0x5e76bb){if(!_0x5e76bb){_0x157959[_0x2d78('0x2d')](0x194);}return _0x5e76bb;};}function handleError(_0x4c3f7d,_0x325acd){_0x325acd=_0x325acd||0x1f4;return function(_0x31ea30){logger[_0x2d78('0x28')](_0x31ea30['stack']);if(_0x31ea30[_0x2d78('0x39')]){delete _0x31ea30['name'];}_0x4c3f7d[_0x2d78('0x2e')](_0x325acd)[_0x2d78('0x3a')](_0x31ea30);};}exports[_0x2d78('0x3b')]=function(_0x2a0c56,_0x554f49){var _0x31e205={},_0x39e988={},_0x57dfa1={'count':0x0,'rows':[]};var _0xfadd0e=_['map'](db['FaxMessage']['rawAttributes'],function(_0x7d76ab){return{'name':_0x7d76ab[_0x2d78('0x3c')],'type':_0x7d76ab['type'][_0x2d78('0x3d')]};});_0x39e988['model']=_[_0x2d78('0x3e')](_0xfadd0e,_0x2d78('0x39'));_0x39e988['query']=_[_0x2d78('0x3f')](_0x2a0c56['query']);_0x39e988['filters']=_[_0x2d78('0x40')](_0x39e988[_0x2d78('0x41')],_0x39e988[_0x2d78('0x42')]);_0x31e205[_0x2d78('0x43')]=_['intersection'](_0x39e988['model'],qs[_0x2d78('0x44')](_0x2a0c56[_0x2d78('0x42')][_0x2d78('0x44')]));_0x31e205[_0x2d78('0x43')]=_0x31e205[_0x2d78('0x43')][_0x2d78('0x45')]?_0x31e205[_0x2d78('0x43')]:_0x39e988[_0x2d78('0x41')];if(!_0x2a0c56[_0x2d78('0x42')][_0x2d78('0x46')](_0x2d78('0x47'))){_0x31e205[_0x2d78('0x32')]=qs['limit'](_0x2a0c56[_0x2d78('0x42')][_0x2d78('0x32')]);_0x31e205['offset']=qs['offset'](_0x2a0c56[_0x2d78('0x42')]['offset']);}_0x31e205[_0x2d78('0x48')]=qs[_0x2d78('0x49')](_0x2a0c56[_0x2d78('0x42')]['sort']);_0x31e205[_0x2d78('0x4a')]=qs['filters'](_['pick'](_0x2a0c56['query'],_0x39e988[_0x2d78('0x4b')]),_0xfadd0e);if(_0x2a0c56[_0x2d78('0x42')]['filter']){_0x31e205['where']=_[_0x2d78('0x4c')](_0x31e205[_0x2d78('0x4a')],{'$or':_[_0x2d78('0x3e')](_0xfadd0e,function(_0x45967e){if(_0x45967e[_0x2d78('0x4d')]!==_0x2d78('0x4e')){var _0x33fdc1={};_0x33fdc1[_0x45967e[_0x2d78('0x39')]]={'$like':'%'+_0x2a0c56[_0x2d78('0x42')][_0x2d78('0x4f')]+'%'};return _0x33fdc1;}})});}_0x31e205=_[_0x2d78('0x4c')]({},_0x31e205,_0x2a0c56[_0x2d78('0x50')]);var _0x82fd90={'where':_0x31e205[_0x2d78('0x4a')]};return db['FaxMessage'][_0x2d78('0x30')](_0x82fd90)['then'](function(_0x1ef960){_0x57dfa1[_0x2d78('0x30')]=_0x1ef960;if(_0x2a0c56[_0x2d78('0x42')][_0x2d78('0x51')]){_0x31e205['include']=[{'all':!![]}];}return db[_0x2d78('0x52')][_0x2d78('0x53')](_0x31e205);})[_0x2d78('0x22')](function(_0x4299fe){_0x57dfa1[_0x2d78('0x54')]=_0x4299fe;return _0x57dfa1;})[_0x2d78('0x22')](respondWithFilteredResult(_0x554f49,_0x31e205))[_0x2d78('0x2c')](handleError(_0x554f49,null));};exports[_0x2d78('0x55')]=function(_0x5571bb,_0x15f4ea){var _0x49bdda={'raw':!![],'where':{'id':_0x5571bb['params']['id']}},_0x1be132={};_0x1be132['model']=_[_0x2d78('0x3f')](db[_0x2d78('0x52')][_0x2d78('0x56')]);_0x1be132[_0x2d78('0x42')]=_[_0x2d78('0x3f')](_0x5571bb[_0x2d78('0x42')]);_0x1be132[_0x2d78('0x4b')]=_[_0x2d78('0x40')](_0x1be132['model'],_0x1be132['query']);_0x49bdda[_0x2d78('0x43')]=_[_0x2d78('0x40')](_0x1be132[_0x2d78('0x41')],qs[_0x2d78('0x44')](_0x5571bb[_0x2d78('0x42')][_0x2d78('0x44')]));_0x49bdda[_0x2d78('0x43')]=_0x49bdda[_0x2d78('0x43')]['length']?_0x49bdda['attributes']:_0x1be132[_0x2d78('0x41')];if(_0x5571bb[_0x2d78('0x42')]['includeAll']){_0x49bdda['include']=[{'all':!![]}];}_0x49bdda=_['merge']({},_0x49bdda,_0x5571bb[_0x2d78('0x50')]);return db[_0x2d78('0x52')][_0x2d78('0x57')](_0x49bdda)[_0x2d78('0x22')](handleEntityNotFound(_0x15f4ea,null))[_0x2d78('0x22')](respondWithResult(_0x15f4ea,null))['catch'](handleError(_0x15f4ea,null));};exports[_0x2d78('0x58')]=function(_0x705790,_0x98c5c2){if(_0x705790[_0x2d78('0x59')]['id']){delete _0x705790[_0x2d78('0x59')]['id'];}return db[_0x2d78('0x52')][_0x2d78('0x57')]({'where':{'id':_0x705790[_0x2d78('0x5a')]['id']}})[_0x2d78('0x22')](handleEntityNotFound(_0x98c5c2,null))[_0x2d78('0x22')](saveUpdates(_0x705790[_0x2d78('0x59')],null))[_0x2d78('0x22')](respondWithResult(_0x98c5c2,null))[_0x2d78('0x2c')](handleError(_0x98c5c2,null));};exports[_0x2d78('0x37')]=function(_0x58ec56,_0x1d7904){return db[_0x2d78('0x52')][_0x2d78('0x57')]({'where':{'id':_0x58ec56['params']['id']}})[_0x2d78('0x22')](handleEntityNotFound(_0x1d7904,null))['then'](removeEntity(_0x1d7904,null))['catch'](handleError(_0x1d7904,null));};exports[_0x2d78('0x5b')]=function(_0x2b2baf,_0x5ef852){return db[_0x2d78('0x52')][_0x2d78('0x5b')]()[_0x2d78('0x22')](respondWithResult(_0x5ef852,null))['catch'](handleError(_0x5ef852,null));};var interaction_log=require(_0x2d78('0x12'))('fax-interactions');exports[_0x2d78('0x5c')]=function(_0x1be9b4,_0x2a0b6a,_0x4ee663){var _0xc60c6d={'channel':_0x2d78('0x5d')};if(_0x1be9b4['body']['id']){delete _0x1be9b4['body']['id'];}_0x1be9b4[_0x2d78('0x59')][_0x2d78('0x5e')]=!![];_0x1be9b4[_0x2d78('0x59')][_0x2d78('0x5f')]=moment()[_0x2d78('0x60')](_0x2d78('0x61'));_0x1be9b4[_0x2d78('0x59')]['UserId']=_0x1be9b4['body'][_0x2d78('0x62')]||_0x1be9b4[_0x2d78('0x63')]['id'];return db[_0x2d78('0x52')][_0x2d78('0x57')]({'where':{'id':_0x1be9b4['params']['id'],'UserId':null},'include':[{'model':db[_0x2d78('0x64')],'as':_0x2d78('0x65')}]})[_0x2d78('0x22')](handleEntityNotFound(_0x2a0b6a,null))[_0x2d78('0x22')](saveUpdates(_0x1be9b4['body'],null))[_0x2d78('0x22')](function(_0xb20d05){if(_0xb20d05){_0xc60c6d['message']=_0xb20d05[_0x2d78('0x66')]({'plain':!![]});return db['FaxInteraction'][_0x2d78('0x57')]({'where':{'id':_0xb20d05[_0x2d78('0x67')]}});}return null;})[_0x2d78('0x22')](handleEntityNotFound(_0x2a0b6a,null))[_0x2d78('0x22')](function(_0x155f92){if(_0x155f92){return _0x155f92['update']({'UserId':_0x1be9b4[_0x2d78('0x59')][_0x2d78('0x62')],'read1stAt':_['isNil'](_0x155f92[_0x2d78('0x68')])?moment()[_0x2d78('0x60')](_0x2d78('0x61')):undefined});}return null;})[_0x2d78('0x22')](function(_0x490e13){if(_0x490e13){_0xc60c6d['interaction']=_0x490e13['get']({'plain':!![]});interaction_log['info'](_0x2d78('0x69'),_0x1be9b4['user']['id'],_0x1be9b4[_0x2d78('0x63')]['name'],_0x1be9b4[_0x2d78('0x63')][_0x2d78('0x6a')],_0xc60c6d[_0x2d78('0x6b')]['id'],_0x1be9b4[_0x2d78('0x59')]?JSON['stringify'](_0x1be9b4[_0x2d78('0x59')]):_0x2d78('0x6c'));return respondWithRpcPromise(_0x2d78('0x6d'),_0x2d78('0x6e'),_0xc60c6d);}return null;})[_0x2d78('0x22')](function(_0x1461a2){if(_0x1461a2){if(_0x1be9b4[_0x2d78('0x59')][_0x2d78('0x6f')]){_0xc60c6d[_0x2d78('0x29')][_0x2d78('0x70')]=util[_0x2d78('0x60')](_0x2d78('0x71'),_0x1be9b4[_0x2d78('0x63')]['name']);_0xc60c6d[_0x2d78('0x29')]['channel']=_0xc60c6d[_0x2d78('0x72')];_0xc60c6d[_0x2d78('0x29')][_0x2d78('0x73')]=_0x2d78('0x5c');return respondWithRpcPromise(_0x2d78('0x74'),_0x2d78('0x74'),{'event':'acceptmessage','message':_0xc60c6d[_0x2d78('0x29')]},client9002)['then'](function(){return _0xc60c6d;});}return _0xc60c6d;}return null;})[_0x2d78('0x22')](respondWithResult(_0x2a0b6a,null))['catch'](handleError(_0x2a0b6a,null));};var interaction_log=require(_0x2d78('0x12'))(_0x2d78('0x75'));exports['reject']=function(_0x5ef632,_0x190225,_0x42b618){var _0x4ca2c8={'agent':{},'channel':_0x2d78('0x5d')};if(_0x5ef632[_0x2d78('0x59')]['id']){delete _0x5ef632[_0x2d78('0x59')]['id'];}_0x5ef632[_0x2d78('0x59')][_0x2d78('0x62')]=_0x5ef632[_0x2d78('0x59')][_0x2d78('0x62')]||_0x5ef632[_0x2d78('0x63')]['id'];_0x4ca2c8[_0x2d78('0x76')]['id']=_0x5ef632[_0x2d78('0x59')][_0x2d78('0x62')];return db[_0x2d78('0x52')][_0x2d78('0x57')]({'where':{'id':_0x5ef632[_0x2d78('0x5a')]['id'],'UserId':null}})[_0x2d78('0x22')](handleEntityNotFound(_0x190225,null))['then'](function(_0x30f89d){if(_0x30f89d){_0x4ca2c8['message']=_0x30f89d['get']({'plain':!![]});return db[_0x2d78('0x77')]['find']({'where':{'id':_0x30f89d[_0x2d78('0x67')]}});}return null;})[_0x2d78('0x22')](handleEntityNotFound(_0x190225,null))[_0x2d78('0x22')](function(_0x4d15e2){if(_0x4d15e2){_0x4ca2c8[_0x2d78('0x6b')]=_0x4d15e2[_0x2d78('0x66')]({'plain':!![]});interaction_log[_0x2d78('0x2a')](_0x2d78('0x78'),_0x5ef632[_0x2d78('0x63')]['id'],_0x5ef632['user'][_0x2d78('0x39')],_0x5ef632['user'][_0x2d78('0x6a')],_0x4ca2c8[_0x2d78('0x6b')]['id'],_0x5ef632['body']?JSON[_0x2d78('0x27')](_0x5ef632[_0x2d78('0x59')]):_0x2d78('0x6c'));return respondWithRpcPromise(_0x2d78('0x79'),'rejectMessage',_0x4ca2c8);}return null;})[_0x2d78('0x22')](function(_0x29593e){if(_0x29593e){_0x29593e[_0x2d78('0x29')][_0x2d78('0x70')]=util[_0x2d78('0x60')](_0x2d78('0x71'),_0x5ef632['user'][_0x2d78('0x39')]);_0x29593e[_0x2d78('0x29')][_0x2d78('0x72')]=_0x4ca2c8[_0x2d78('0x72')];_0x29593e['message']['event']=_0x2d78('0x36');respondWithRpcPromise(_0x2d78('0x74'),'EventManager',{'event':_0x2d78('0x7a'),'message':_0x29593e[_0x2d78('0x29')]},client9002);return _0x4ca2c8;}return null;})[_0x2d78('0x22')](respondWithResult(_0x190225,null))[_0x2d78('0x2c')](handleError(_0x190225,null));};exports[_0x2d78('0x7b')]=function(_0x58d3eb,_0x54348f){var _0x2bb11f;return db[_0x2d78('0x52')]['create'](_0x58d3eb[_0x2d78('0x59')],{})['then'](function(_0x44fd6c){_0x2bb11f=_0x44fd6c;return db[_0x2d78('0x64')][_0x2d78('0x7c')]({'where':{'id':_0x2bb11f[_0x2d78('0x7d')]}});})['then'](function(_0x12b7f8){if(_['isNil'](_0x12b7f8)){return;}else{_0x2bb11f[_0x2d78('0x5d')]=_0x12b7f8[_0x2d78('0x5d')];return db['Attachment'][_0x2d78('0x7c')]({'where':{'id':_0x2bb11f['AttachmentId']}});}})[_0x2d78('0x22')](function(_0xf9274){return respondWithRpcPromise(_0x2d78('0x7e'),_0x2d78('0x7e'),{'FaxAccountId':_[_0x2d78('0x7f')](_0x58d3eb[_0x2d78('0x59')])?undefined:_0x58d3eb[_0x2d78('0x59')]['FaxAccountId'],'path':_[_0x2d78('0x7f')](_0xf9274)?undefined:util[_0x2d78('0x60')](_0x2d78('0x80'),_0xf9274[_0x2d78('0x81')]),'fax':_['isNil'](_0x2bb11f['fax'])?undefined:_0x2bb11f[_0x2d78('0x5d')],'AttachmentId':_0x2bb11f[_0x2d78('0x82')]},client9002);})[_0x2d78('0x22')](respondWithResult(_0x54348f,0xc9))[_0x2d78('0x2c')](handleError(_0x54348f,null));};exports[_0x2d78('0x83')]=function(_0x92adc4,_0x41619e){var _0x3d117f=path['join'](config[_0x2d78('0x84')],_0x2d78('0x85'),_0x2d78('0x86'),_0x2d78('0x87'));return db['FaxMessage'][_0x2d78('0x57')]({'where':{'id':_0x92adc4['params']['id']},'include':[{'model':db[_0x2d78('0x88')],'as':'Attachment'}]})[_0x2d78('0x22')](handleEntityNotFound(_0x41619e,null))[_0x2d78('0x22')](function(_0x271bec){if(_0x271bec){return _0x41619e[_0x2d78('0x83')](path[_0x2d78('0x89')](_0x3d117f,_0x271bec[_0x2d78('0x88')][_0x2d78('0x81')]));}})[_0x2d78('0x2c')](handleError(_0x41619e,null));}; \ No newline at end of file +var _0x481f=['body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','acceptmessage','../../config/logger','fax-interactions','fax','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','SIP/%s','rejectmessage','create','ContactId','Attachment','findOne','AttachmentId','FaxAccountId','basename','download','join','root','server','attachments','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','map','FaxMessage','fieldName','type','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','catch','destroy','describe','accept'];(function(_0x504f7b,_0x1ac4e0){var _0x2b0904=function(_0x28e51d){while(--_0x28e51d){_0x504f7b['push'](_0x504f7b['shift']());}};_0x2b0904(++_0x1ac4e0);}(_0x481f,0x1bb));var _0xf481=function(_0x222ac1,_0x1da40b){_0x222ac1=_0x222ac1-0x0;var _0x5e22d1=_0x481f[_0x222ac1];return _0x5e22d1;};'use strict';var pdf=require(_0xf481('0x0'));var emlformat=require(_0xf481('0x1'));var rimraf=require(_0xf481('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf481('0x3'));var rp=require(_0xf481('0x4'));var moment=require(_0xf481('0x5'));var BPromise=require(_0xf481('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf481('0x7'));var sox=require(_0xf481('0x8'));var csv=require(_0xf481('0x9'));var ejs=require(_0xf481('0xa'));var fs=require('fs');var _=require(_0xf481('0xb'));var squel=require(_0xf481('0xc'));var crypto=require('crypto');var jsforce=require(_0xf481('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf481('0x9'));var querystring=require(_0xf481('0xe'));var Papa=require('papaparse');var Redis=require(_0xf481('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf481('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf481('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf481('0x12'));var config=require('../../config/environment');var db=require(_0xf481('0x13'))['db'];config[_0xf481('0x14')]=_['defaults'](config['redis'],{'host':_0xf481('0x15'),'port':0x18eb});var socket=require(_0xf481('0x16'))(new Redis(config['redis']));require(_0xf481('0x17'))[_0xf481('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf481('0x19')][_0xf481('0x1a')]({'port':0x232c});var client9002=jayson[_0xf481('0x19')][_0xf481('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x271183,_0x4732e7,_0x1bad15){if(_0x1bad15){var _0x95df5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x95df5c[_0xf481('0x1b')](_0x4732e7)){return _0x271183;}else{throw new db[(_0xf481('0x1c'))][(_0xf481('0x1d'))](_0xf481('0x1e'));}}else{return _0x271183;}}function respondWithRpcPromise(_0x346e4f,_0x42c305,_0x5f38bc,_0x53c5a1){return new BPromise(function(_0x4d8684,_0x3dbe51){var _0x38797f=_0x53c5a1||client;return _0x38797f[_0xf481('0x1f')](_0x346e4f,_0x5f38bc)[_0xf481('0x20')](function(_0x47dddc){logger[_0xf481('0x21')]('FaxMessage,\x20%s,\x20%s',_0x42c305,_0xf481('0x22'));logger[_0xf481('0x23')](_0xf481('0x24'),_0x42c305,_0xf481('0x22'),JSON[_0xf481('0x25')](_0x47dddc));if(_0x47dddc['error']){if(_0x47dddc[_0xf481('0x26')]['code']===0x1f4){logger[_0xf481('0x26')](_0xf481('0x27'),_0x42c305,_0x47dddc[_0xf481('0x26')][_0xf481('0x28')]);return _0x3dbe51(_0x47dddc[_0xf481('0x26')][_0xf481('0x28')]);}logger[_0xf481('0x26')](_0xf481('0x27'),_0x42c305,_0x47dddc[_0xf481('0x26')][_0xf481('0x28')]);return _0x4d8684(_0x47dddc[_0xf481('0x26')][_0xf481('0x28')]);}else{logger[_0xf481('0x21')](_0xf481('0x27'),_0x42c305,_0xf481('0x22'));_0x4d8684(_0x47dddc[_0xf481('0x29')][_0xf481('0x28')]);}})['catch'](function(_0x504111){logger[_0xf481('0x26')](_0xf481('0x27'),_0x42c305,_0x504111);_0x3dbe51(_0x504111);});});}function respondWithStatusCode(_0x4f285a,_0x27d0b6){_0x27d0b6=_0x27d0b6||0xcc;return function(_0x39bf47){if(_0x39bf47){return _0x4f285a[_0xf481('0x2a')](_0x27d0b6);}return _0x4f285a[_0xf481('0x2b')](_0x27d0b6)[_0xf481('0x2c')]();};}function respondWithResult(_0x3ed12b,_0x3294db){_0x3294db=_0x3294db||0xc8;return function(_0x5db895){if(_0x5db895){return _0x3ed12b[_0xf481('0x2b')](_0x3294db)['json'](_0x5db895);}};}function respondWithFilteredResult(_0x51a100,_0x323055){return function(_0xec71fd){if(_0xec71fd){var _0xc83b0c=_0xec71fd[_0xf481('0x2d')],_0x2dcac9=_0x323055[_0xf481('0x2e')],_0x3e1d47=_0x323055[_0xf481('0x2e')]+_0x323055[_0xf481('0x2f')],_0x4a5e31;if(_0x3e1d47>=_0xc83b0c){_0x3e1d47=_0xc83b0c;_0x4a5e31=0xc8;}else{_0x4a5e31=0xce;}_0x51a100[_0xf481('0x2b')](_0x4a5e31);return _0x51a100[_0xf481('0x30')](_0xf481('0x31'),_0x2dcac9+'-'+_0x3e1d47+'/'+_0xc83b0c)['json'](_0xec71fd);}return null;};}function patchUpdates(_0x1da733){return function(_0x6720b){try{jsonpatch[_0xf481('0x32')](_0x6720b,_0x1da733,!![]);}catch(_0x2fd044){return BPromise[_0xf481('0x33')](_0x2fd044);}return _0x6720b[_0xf481('0x34')]();};}function saveUpdates(_0x5c2254,_0x28a957){return function(_0x507a4e){if(_0x507a4e){return _0x507a4e[_0xf481('0x35')](_0x5c2254)[_0xf481('0x20')](function(_0x1bcaa1){return _0x1bcaa1;});}return null;};}function removeEntity(_0x289f6d,_0x3e672a){return function(_0x5637d1){if(_0x5637d1){return _0x5637d1['destroy']()[_0xf481('0x20')](function(){_0x289f6d[_0xf481('0x2b')](0xcc)[_0xf481('0x2c')]();});}};}function handleEntityNotFound(_0x5273eb,_0x34a798){return function(_0x5f3530){if(!_0x5f3530){_0x5273eb[_0xf481('0x2a')](0x194);}return _0x5f3530;};}function handleError(_0x4ef0fb,_0x2b8ddc){_0x2b8ddc=_0x2b8ddc||0x1f4;return function(_0x6b65e1){logger['error'](_0x6b65e1[_0xf481('0x36')]);if(_0x6b65e1['name']){delete _0x6b65e1[_0xf481('0x37')];}_0x4ef0fb[_0xf481('0x2b')](_0x2b8ddc)['send'](_0x6b65e1);};}exports['index']=function(_0x501e41,_0x3f0e1e){var _0x4ffcce={},_0x5a7a33={},_0x36f639={'count':0x0,'rows':[]};var _0x14485a=_[_0xf481('0x38')](db[_0xf481('0x39')]['rawAttributes'],function(_0x561bd8){return{'name':_0x561bd8[_0xf481('0x3a')],'type':_0x561bd8[_0xf481('0x3b')]['key']};});_0x5a7a33[_0xf481('0x3c')]=_[_0xf481('0x38')](_0x14485a,_0xf481('0x37'));_0x5a7a33['query']=_[_0xf481('0x3d')](_0x501e41['query']);_0x5a7a33[_0xf481('0x3e')]=_['intersection'](_0x5a7a33[_0xf481('0x3c')],_0x5a7a33[_0xf481('0x3f')]);_0x4ffcce[_0xf481('0x40')]=_[_0xf481('0x41')](_0x5a7a33[_0xf481('0x3c')],qs[_0xf481('0x42')](_0x501e41[_0xf481('0x3f')][_0xf481('0x42')]));_0x4ffcce['attributes']=_0x4ffcce[_0xf481('0x40')]['length']?_0x4ffcce[_0xf481('0x40')]:_0x5a7a33[_0xf481('0x3c')];if(!_0x501e41[_0xf481('0x3f')][_0xf481('0x43')]('nolimit')){_0x4ffcce[_0xf481('0x2f')]=qs[_0xf481('0x2f')](_0x501e41[_0xf481('0x3f')]['limit']);_0x4ffcce[_0xf481('0x2e')]=qs[_0xf481('0x2e')](_0x501e41['query']['offset']);}_0x4ffcce['order']=qs[_0xf481('0x44')](_0x501e41[_0xf481('0x3f')]['sort']);_0x4ffcce['where']=qs[_0xf481('0x3e')](_[_0xf481('0x45')](_0x501e41['query'],_0x5a7a33['filters']),_0x14485a);if(_0x501e41[_0xf481('0x3f')][_0xf481('0x46')]){_0x4ffcce[_0xf481('0x47')]=_[_0xf481('0x48')](_0x4ffcce[_0xf481('0x47')],{'$or':_['map'](_0x14485a,function(_0x30d0e3){if(_0x30d0e3['type']!==_0xf481('0x49')){var _0x234124={};_0x234124[_0x30d0e3[_0xf481('0x37')]]={'$like':'%'+_0x501e41['query'][_0xf481('0x46')]+'%'};return _0x234124;}})});}_0x4ffcce=_[_0xf481('0x48')]({},_0x4ffcce,_0x501e41[_0xf481('0x4a')]);var _0x3d44d5={'where':_0x4ffcce[_0xf481('0x47')]};return db[_0xf481('0x39')][_0xf481('0x2d')](_0x3d44d5)[_0xf481('0x20')](function(_0x2239eb){_0x36f639[_0xf481('0x2d')]=_0x2239eb;if(_0x501e41[_0xf481('0x3f')][_0xf481('0x4b')]){_0x4ffcce[_0xf481('0x4c')]=[{'all':!![]}];}return db[_0xf481('0x39')][_0xf481('0x4d')](_0x4ffcce);})['then'](function(_0x183e7e){_0x36f639[_0xf481('0x4e')]=_0x183e7e;return _0x36f639;})[_0xf481('0x20')](respondWithFilteredResult(_0x3f0e1e,_0x4ffcce))['catch'](handleError(_0x3f0e1e,null));};exports['show']=function(_0x3407f3,_0x33a3e5){var _0x148db3={'raw':!![],'where':{'id':_0x3407f3[_0xf481('0x4f')]['id']}},_0x7a854={};_0x7a854['model']=_[_0xf481('0x3d')](db[_0xf481('0x39')]['rawAttributes']);_0x7a854['query']=_[_0xf481('0x3d')](_0x3407f3[_0xf481('0x3f')]);_0x7a854['filters']=_[_0xf481('0x41')](_0x7a854['model'],_0x7a854[_0xf481('0x3f')]);_0x148db3[_0xf481('0x40')]=_[_0xf481('0x41')](_0x7a854['model'],qs['fields'](_0x3407f3[_0xf481('0x3f')][_0xf481('0x42')]));_0x148db3['attributes']=_0x148db3[_0xf481('0x40')][_0xf481('0x50')]?_0x148db3[_0xf481('0x40')]:_0x7a854[_0xf481('0x3c')];if(_0x3407f3[_0xf481('0x3f')][_0xf481('0x4b')]){_0x148db3[_0xf481('0x4c')]=[{'all':!![]}];}_0x148db3=_[_0xf481('0x48')]({},_0x148db3,_0x3407f3[_0xf481('0x4a')]);return db[_0xf481('0x39')]['find'](_0x148db3)['then'](handleEntityNotFound(_0x33a3e5,null))[_0xf481('0x20')](respondWithResult(_0x33a3e5,null))['catch'](handleError(_0x33a3e5,null));};exports[_0xf481('0x35')]=function(_0x17c682,_0x5ca001){if(_0x17c682['body']['id']){delete _0x17c682['body']['id'];}return db[_0xf481('0x39')]['find']({'where':{'id':_0x17c682['params']['id']}})[_0xf481('0x20')](handleEntityNotFound(_0x5ca001,null))[_0xf481('0x20')](saveUpdates(_0x17c682['body'],null))[_0xf481('0x20')](respondWithResult(_0x5ca001,null))[_0xf481('0x51')](handleError(_0x5ca001,null));};exports[_0xf481('0x52')]=function(_0x17c1c5,_0x4fa890){return db[_0xf481('0x39')]['find']({'where':{'id':_0x17c1c5[_0xf481('0x4f')]['id']}})[_0xf481('0x20')](handleEntityNotFound(_0x4fa890,null))[_0xf481('0x20')](removeEntity(_0x4fa890,null))['catch'](handleError(_0x4fa890,null));};exports['describe']=function(_0x1b17cf,_0x113c45){return db[_0xf481('0x39')][_0xf481('0x53')]()['then'](respondWithResult(_0x113c45,null))[_0xf481('0x51')](handleError(_0x113c45,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xf481('0x54')]=function(_0x51b5b2,_0x1397cb,_0x1d26c5){var _0x45f291={'channel':'fax'};if(_0x51b5b2[_0xf481('0x55')]['id']){delete _0x51b5b2[_0xf481('0x55')]['id'];}_0x51b5b2[_0xf481('0x55')][_0xf481('0x56')]=!![];_0x51b5b2[_0xf481('0x55')][_0xf481('0x57')]=moment()[_0xf481('0x58')](_0xf481('0x59'));_0x51b5b2[_0xf481('0x55')]['UserId']=_0x51b5b2[_0xf481('0x55')][_0xf481('0x5a')]||_0x51b5b2[_0xf481('0x5b')]['id'];return db['FaxMessage'][_0xf481('0x5c')]({'where':{'id':_0x51b5b2[_0xf481('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0xf481('0x5d')],'as':_0xf481('0x5e')}]})[_0xf481('0x20')](handleEntityNotFound(_0x1397cb,null))['then'](saveUpdates(_0x51b5b2['body'],null))[_0xf481('0x20')](function(_0x4a8212){if(_0x4a8212){_0x45f291['message']=_0x4a8212[_0xf481('0x5f')]({'plain':!![]});return db[_0xf481('0x60')][_0xf481('0x5c')]({'where':{'id':_0x4a8212[_0xf481('0x61')]}});}return null;})[_0xf481('0x20')](handleEntityNotFound(_0x1397cb,null))[_0xf481('0x20')](function(_0x3aa88c){if(_0x3aa88c){return _0x3aa88c[_0xf481('0x35')]({'UserId':_0x51b5b2[_0xf481('0x55')][_0xf481('0x5a')],'read1stAt':_[_0xf481('0x62')](_0x3aa88c[_0xf481('0x63')])?moment()['format'](_0xf481('0x59')):undefined});}return null;})['then'](function(_0x33d8e9){if(_0x33d8e9){_0x45f291['interaction']=_0x33d8e9['get']({'plain':!![]});interaction_log[_0xf481('0x21')](_0xf481('0x64'),_0x51b5b2[_0xf481('0x5b')]['id'],_0x51b5b2[_0xf481('0x5b')][_0xf481('0x37')],_0x51b5b2['user'][_0xf481('0x65')],_0x45f291[_0xf481('0x66')]['id'],_0x51b5b2[_0xf481('0x55')]?JSON[_0xf481('0x25')](_0x51b5b2[_0xf481('0x55')]):_0xf481('0x67'));return respondWithRpcPromise(_0xf481('0x68'),_0xf481('0x69'),_0x45f291);}return null;})[_0xf481('0x20')](function(_0x58d9d1){if(_0x58d9d1){if(_0x51b5b2[_0xf481('0x55')][_0xf481('0x6a')]){_0x45f291[_0xf481('0x28')]['interface']=util[_0xf481('0x58')]('SIP/%s',_0x51b5b2['user'][_0xf481('0x37')]);_0x45f291[_0xf481('0x28')][_0xf481('0x6b')]=_0x45f291[_0xf481('0x6b')];_0x45f291[_0xf481('0x28')][_0xf481('0x6c')]=_0xf481('0x54');return respondWithRpcPromise(_0xf481('0x6d'),_0xf481('0x6d'),{'event':_0xf481('0x6e'),'message':_0x45f291['message']},client9002)['then'](function(){return _0x45f291;});}return _0x45f291;}return null;})[_0xf481('0x20')](respondWithResult(_0x1397cb,null))[_0xf481('0x51')](handleError(_0x1397cb,null));};var interaction_log=require(_0xf481('0x6f'))(_0xf481('0x70'));exports[_0xf481('0x33')]=function(_0x45665e,_0x48b5d0,_0x2566af){var _0x257362={'agent':{},'channel':_0xf481('0x71')};if(_0x45665e[_0xf481('0x55')]['id']){delete _0x45665e[_0xf481('0x55')]['id'];}_0x45665e[_0xf481('0x55')][_0xf481('0x5a')]=_0x45665e[_0xf481('0x55')][_0xf481('0x5a')]||_0x45665e[_0xf481('0x5b')]['id'];_0x257362[_0xf481('0x72')]['id']=_0x45665e[_0xf481('0x55')][_0xf481('0x5a')];return db['FaxMessage'][_0xf481('0x5c')]({'where':{'id':_0x45665e['params']['id'],'UserId':null}})[_0xf481('0x20')](handleEntityNotFound(_0x48b5d0,null))['then'](function(_0x4759a1){if(_0x4759a1){_0x257362[_0xf481('0x28')]=_0x4759a1['get']({'plain':!![]});return db[_0xf481('0x60')][_0xf481('0x5c')]({'where':{'id':_0x4759a1[_0xf481('0x61')]}});}return null;})[_0xf481('0x20')](handleEntityNotFound(_0x48b5d0,null))['then'](function(_0xd14385){if(_0xd14385){_0x257362[_0xf481('0x66')]=_0xd14385['get']({'plain':!![]});interaction_log[_0xf481('0x21')](_0xf481('0x73'),_0x45665e[_0xf481('0x5b')]['id'],_0x45665e[_0xf481('0x5b')][_0xf481('0x37')],_0x45665e[_0xf481('0x5b')][_0xf481('0x65')],_0x257362[_0xf481('0x66')]['id'],_0x45665e[_0xf481('0x55')]?JSON['stringify'](_0x45665e[_0xf481('0x55')]):_0xf481('0x67'));return respondWithRpcPromise('RejectMessage',_0xf481('0x74'),_0x257362);}return null;})[_0xf481('0x20')](function(_0x3479b3){if(_0x3479b3){_0x3479b3[_0xf481('0x28')][_0xf481('0x75')]=util[_0xf481('0x58')](_0xf481('0x76'),_0x45665e[_0xf481('0x5b')][_0xf481('0x37')]);_0x3479b3[_0xf481('0x28')][_0xf481('0x6b')]=_0x257362[_0xf481('0x6b')];_0x3479b3[_0xf481('0x28')][_0xf481('0x6c')]=_0xf481('0x33');respondWithRpcPromise(_0xf481('0x6d'),_0xf481('0x6d'),{'event':_0xf481('0x77'),'message':_0x3479b3[_0xf481('0x28')]},client9002);return _0x257362;}return null;})['then'](respondWithResult(_0x48b5d0,null))[_0xf481('0x51')](handleError(_0x48b5d0,null));};exports[_0xf481('0x78')]=function(_0x221e4a,_0x509425){var _0x434d37;return db[_0xf481('0x39')][_0xf481('0x78')](_0x221e4a[_0xf481('0x55')],{})[_0xf481('0x20')](function(_0x5a399b){_0x434d37=_0x5a399b;return db[_0xf481('0x5d')]['findOne']({'where':{'id':_0x434d37[_0xf481('0x79')]}});})[_0xf481('0x20')](function(_0x3be57d){if(_[_0xf481('0x62')](_0x3be57d)){return;}else{_0x434d37['fax']=_0x3be57d[_0xf481('0x71')];return db[_0xf481('0x7a')][_0xf481('0x7b')]({'where':{'id':_0x434d37[_0xf481('0x7c')]}});}})[_0xf481('0x20')](function(_0x4f6eea){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xf481('0x62')](_0x221e4a[_0xf481('0x55')])?undefined:_0x221e4a[_0xf481('0x55')][_0xf481('0x7d')],'path':_[_0xf481('0x62')](_0x4f6eea)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x4f6eea[_0xf481('0x7e')]),'fax':_[_0xf481('0x62')](_0x434d37[_0xf481('0x71')])?undefined:_0x434d37[_0xf481('0x71')],'AttachmentId':_0x434d37[_0xf481('0x7c')]},client9002);})[_0xf481('0x20')](respondWithResult(_0x509425,0xc9))[_0xf481('0x51')](handleError(_0x509425,null));};exports[_0xf481('0x7f')]=function(_0x31050a,_0xf7ca9e){var _0x3ec63e=path[_0xf481('0x80')](config[_0xf481('0x81')],_0xf481('0x82'),'files',_0xf481('0x83'));return db[_0xf481('0x39')][_0xf481('0x5c')]({'where':{'id':_0x31050a[_0xf481('0x4f')]['id']},'include':[{'model':db[_0xf481('0x7a')],'as':_0xf481('0x7a')}]})[_0xf481('0x20')](handleEntityNotFound(_0xf7ca9e,null))[_0xf481('0x20')](function(_0x125cdf){if(_0x125cdf){return _0xf7ca9e[_0xf481('0x7f')](path['join'](_0x3ec63e,_0x125cdf[_0xf481('0x7a')][_0xf481('0x7e')]));}})[_0xf481('0x51')](handleError(_0xf7ca9e,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c9842b9..4ab58ab 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(_0x4492a7,_0x34d6ad){var _0x523950=function(_0x1312d6){while(--_0x1312d6){_0x4492a7['push'](_0x4492a7['shift']());}};_0x523950(++_0x34d6ad);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x21cf92,_0x538a58){var _0x343164=function(_0x494669){while(--_0x494669){_0x21cf92['push'](_0x21cf92['shift']());}};_0x343164(++_0x538a58);}(_0x008c,0x188));var _0xc008=function(_0x50d0dc,_0x23bcb0){_0x50d0dc=_0x50d0dc-0x0;var _0x49f2a9=_0x008c[_0x50d0dc];return _0x49f2a9;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c6a9de6..5885cdf 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 _0xbb72=['out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x3330a1,_0x559d05){var _0x2004d1=function(_0x24d02e){while(--_0x24d02e){_0x3330a1['push'](_0x3330a1['shift']());}};_0x2004d1(++_0x559d05);}(_0xbb72,0x123));var _0x2bb7=function(_0x4498cd,_0x437daa){_0x4498cd=_0x4498cd-0x0;var _0xa2bec1=_0xbb72[_0x4498cd];return _0xa2bec1;};'use strict';var _=require(_0x2bb7('0x0'));var util=require(_0x2bb7('0x1'));var logger=require('../../config/logger')(_0x2bb7('0x2'));var moment=require(_0x2bb7('0x3'));var BPromise=require('bluebird');var rp=require(_0x2bb7('0x4'));var fs=require('fs');var path=require(_0x2bb7('0x5'));var rimraf=require('rimraf');var config=require(_0x2bb7('0x6'));var attributes=require(_0x2bb7('0x7'));module[_0x2bb7('0x8')]=function(_0x4fd9ad,_0x36730b){return _0x4fd9ad[_0x2bb7('0x9')](_0x2bb7('0xa'),attributes,{'tableName':_0x2bb7('0xb'),'paranoid':![],'indexes':[{'name':_0x2bb7('0xc'),'fields':[_0x2bb7('0xd')],'type':_0x2bb7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4452d2,_0x453f15,_0x5dec47){var _0x2f3713=_0x4fd9ad[_0x2bb7('0xf')];var _0x527449=_0x4452d2[_0x2bb7('0x10')]({'plain':!![]});if(_0x527449[_0x2bb7('0x11')][_0x2bb7('0x12')]()==='in'||_0x527449[_0x2bb7('0x11')][_0x2bb7('0x12')]()===_0x2bb7('0x13')&&!_0x527449['secret']&&!_[_0x2bb7('0x14')](_0x527449[_0x2bb7('0x15')])){_0x2f3713[_0x2bb7('0x16')][_0x2bb7('0x17')]({'where':{'id':_0x527449[_0x2bb7('0x18')]}})['then'](function(_0xd9e525){if(_0xd9e525){_0xd9e525[_0x2bb7('0x19')]({'lastMsgAt':_0x527449[_0x2bb7('0x1a')],'lastMsgDirection':_0x527449[_0x2bb7('0x11')][_0x2bb7('0x12')]()});}})[_0x2bb7('0x1b')](function(_0x4d9f8e){console[_0x2bb7('0x1c')](_0x4d9f8e);});}_0x5dec47();}},'charset':_0x2bb7('0x1d'),'collate':_0x2bb7('0x1e')});}; \ No newline at end of file +var _0x22a2=['utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','createdAt','direction','catch','error','utf8mb4'];(function(_0x5c8c5d,_0x572915){var _0x175898=function(_0x19f531){while(--_0x19f531){_0x5c8c5d['push'](_0x5c8c5d['shift']());}};_0x175898(++_0x572915);}(_0x22a2,0xaf));var _0x222a=function(_0x2a0185,_0x572386){_0x2a0185=_0x2a0185-0x0;var _0x13af99=_0x22a2[_0x2a0185];return _0x13af99;};'use strict';var _=require('lodash');var util=require(_0x222a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x222a('0x1'));var BPromise=require(_0x222a('0x2'));var rp=require(_0x222a('0x3'));var fs=require('fs');var path=require(_0x222a('0x4'));var rimraf=require(_0x222a('0x5'));var config=require(_0x222a('0x6'));var attributes=require(_0x222a('0x7'));module['exports']=function(_0x3f7ba6,_0x5b7dee){return _0x3f7ba6[_0x222a('0x8')](_0x222a('0x9'),attributes,{'tableName':_0x222a('0xa'),'paranoid':![],'indexes':[{'name':_0x222a('0xb'),'fields':[_0x222a('0xc')],'type':_0x222a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a3bbb,_0x15176f,_0xe8df20){var _0x1d6307=_0x3f7ba6[_0x222a('0xe')];var _0x4a2209=_0x5a3bbb['get']({'plain':!![]});if(_0x4a2209['direction'][_0x222a('0xf')]()==='in'||_0x4a2209['direction'][_0x222a('0xf')]()===_0x222a('0x10')&&!_0x4a2209[_0x222a('0x11')]&&!_[_0x222a('0x12')](_0x4a2209[_0x222a('0x13')])){_0x1d6307[_0x222a('0x14')]['findOne']({'where':{'id':_0x4a2209[_0x222a('0x15')]}})[_0x222a('0x16')](function(_0x5606a6){if(_0x5606a6){_0x5606a6['update']({'lastMsgAt':_0x4a2209[_0x222a('0x17')],'lastMsgDirection':_0x4a2209[_0x222a('0x18')][_0x222a('0xf')]()});}})[_0x222a('0x19')](function(_0x335e13){console[_0x222a('0x1a')](_0x335e13);});}_0xe8df20();}},'charset':_0x222a('0x1b'),'collate':_0x222a('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 0f81282..0682880 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 _0x403c=['FaxMessage','body','raw','UpdateFaxMessage','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x403c,0x112));var _0xc403=function(_0x39289c,_0x127635){_0x39289c=_0x39289c-0x0;var _0x2736a9=_0x403c[_0x39289c];return _0x2736a9;};'use strict';var _=require(_0xc403('0x0'));var util=require(_0xc403('0x1'));var moment=require(_0xc403('0x2'));var BPromise=require(_0xc403('0x3'));var rs=require(_0xc403('0x4'));var fs=require('fs');var Redis=require(_0xc403('0x5'));var db=require(_0xc403('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc403('0x7'))(_0xc403('0x8'));var config=require(_0xc403('0x9'));var jayson=require(_0xc403('0xa'));var client=jayson[_0xc403('0xb')][_0xc403('0xc')]({'port':0x232a});config[_0xc403('0xd')]=_[_0xc403('0xe')](config['redis'],{'host':_0xc403('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc403('0x10'))[_0xc403('0x11')](socket);function respondWithRpcPromise(_0xace1e7,_0x5ca2c1,_0x5db74e){return new BPromise(function(_0xdbf5ad,_0x43231f){return client['request'](_0xace1e7,_0x5db74e)[_0xc403('0x12')](function(_0x1bcac7){logger[_0xc403('0x13')]('FaxMessage,\x20%s,\x20%s',_0x5ca2c1,_0xc403('0x14'));logger[_0xc403('0x15')](_0xc403('0x16'),_0x5ca2c1,_0xc403('0x14'),JSON[_0xc403('0x17')](_0x1bcac7));if(_0x1bcac7[_0xc403('0x18')]){if(_0x1bcac7['error']['code']===0x1f4){logger['error'](_0xc403('0x19'),_0x5ca2c1,_0x1bcac7['error'][_0xc403('0x1a')]);return _0x43231f(_0x1bcac7[_0xc403('0x18')][_0xc403('0x1a')]);}logger[_0xc403('0x18')](_0xc403('0x19'),_0x5ca2c1,_0x1bcac7[_0xc403('0x18')][_0xc403('0x1a')]);return _0xdbf5ad(_0x1bcac7[_0xc403('0x18')][_0xc403('0x1a')]);}else{logger[_0xc403('0x13')](_0xc403('0x19'),_0x5ca2c1,_0xc403('0x14'));_0xdbf5ad(_0x1bcac7[_0xc403('0x1b')][_0xc403('0x1a')]);}})[_0xc403('0x1c')](function(_0x4e5de9){logger[_0xc403('0x18')](_0xc403('0x19'),_0x5ca2c1,_0x4e5de9);_0x43231f(_0x4e5de9);});});}exports[_0xc403('0x1d')]=function(_0x428468){var _0x152850=this;return new Promise(function(_0x5335ac,_0x563b0e){return db[_0xc403('0x1e')]['create'](_0x428468[_0xc403('0x1f')],{'raw':_0x428468['options']?_0x428468['options'][_0xc403('0x20')]===undefined?!![]:![]:!![]})[_0xc403('0x12')](function(_0x2cf582){logger['info'](_0xc403('0x1d'),_0x428468);logger[_0xc403('0x15')](_0xc403('0x1d'),_0x428468,JSON[_0xc403('0x17')](_0x2cf582));_0x5335ac(_0x2cf582);})['catch'](function(_0x4c37e7){logger[_0xc403('0x18')]('CreateFaxMessage',_0x4c37e7[_0xc403('0x1a')],_0x428468);_0x563b0e(_0x152850[_0xc403('0x18')](0x1f4,_0x4c37e7[_0xc403('0x1a')]));});});};exports[_0xc403('0x21')]=function(_0x503176){var _0xfd6012=this;return new Promise(function(_0x3c2a14,_0xd856c5){return db[_0xc403('0x1e')][_0xc403('0x22')](_0x503176['body'],{'raw':_0x503176['options']?_0x503176['options'][_0xc403('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503176[_0xc403('0x23')]?_0x503176[_0xc403('0x23')][_0xc403('0x24')]||null:null,'attributes':_0x503176[_0xc403('0x23')]?_0x503176[_0xc403('0x23')][_0xc403('0x25')]||null:null,'limit':_0x503176[_0xc403('0x23')]?_0x503176[_0xc403('0x23')]['limit']||null:null})[_0xc403('0x12')](function(_0x39c563){logger['info'](_0xc403('0x21'),_0x503176);logger[_0xc403('0x15')](_0xc403('0x21'),_0x503176,JSON[_0xc403('0x17')](_0x39c563));_0x3c2a14(_0x39c563);})[_0xc403('0x1c')](function(_0x341809){logger[_0xc403('0x18')](_0xc403('0x21'),_0x341809[_0xc403('0x1a')],_0x503176);_0xd856c5(_0xfd6012[_0xc403('0x18')](0x1f4,_0x341809['message']));});});}; \ No newline at end of file +var _0x2934=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxMessage','create','options','raw','CreateFaxMessage','stringify','UpdateFaxMessage','update','body','where','attributes','limit','lodash','util','moment','randomstring'];(function(_0x367fb2,_0xe4392c){var _0x2ab0bd=function(_0x2810d1){while(--_0x2810d1){_0x367fb2['push'](_0x367fb2['shift']());}};_0x2ab0bd(++_0xe4392c);}(_0x2934,0x74));var _0x4293=function(_0x5f26b7,_0x5cb63e){_0x5f26b7=_0x5f26b7-0x0;var _0x41dddd=_0x2934[_0x5f26b7];return _0x41dddd;};'use strict';var _=require(_0x4293('0x0'));var util=require(_0x4293('0x1'));var moment=require(_0x4293('0x2'));var BPromise=require('bluebird');var rs=require(_0x4293('0x3'));var fs=require('fs');var Redis=require(_0x4293('0x4'));var db=require(_0x4293('0x5'))['db'];var utils=require(_0x4293('0x6'));var logger=require(_0x4293('0x7'))(_0x4293('0x8'));var config=require('../../config/environment');var jayson=require(_0x4293('0x9'));var client=jayson[_0x4293('0xa')]['http']({'port':0x232a});config[_0x4293('0xb')]=_[_0x4293('0xc')](config[_0x4293('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4293('0xd'))(new Redis(config[_0x4293('0xb')]));require(_0x4293('0xe'))[_0x4293('0xf')](socket);function respondWithRpcPromise(_0x209bcf,_0x2fe3d3,_0x51128b){return new BPromise(function(_0x611302,_0x494d0d){return client[_0x4293('0x10')](_0x209bcf,_0x51128b)[_0x4293('0x11')](function(_0x2202ae){logger[_0x4293('0x12')](_0x4293('0x13'),_0x2fe3d3,_0x4293('0x14'));logger[_0x4293('0x15')](_0x4293('0x16'),_0x2fe3d3,'request\x20sent',JSON['stringify'](_0x2202ae));if(_0x2202ae[_0x4293('0x17')]){if(_0x2202ae[_0x4293('0x17')][_0x4293('0x18')]===0x1f4){logger[_0x4293('0x17')](_0x4293('0x13'),_0x2fe3d3,_0x2202ae['error'][_0x4293('0x19')]);return _0x494d0d(_0x2202ae[_0x4293('0x17')][_0x4293('0x19')]);}logger[_0x4293('0x17')](_0x4293('0x13'),_0x2fe3d3,_0x2202ae[_0x4293('0x17')][_0x4293('0x19')]);return _0x611302(_0x2202ae[_0x4293('0x17')][_0x4293('0x19')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2fe3d3,_0x4293('0x14'));_0x611302(_0x2202ae[_0x4293('0x1a')][_0x4293('0x19')]);}})[_0x4293('0x1b')](function(_0x38a534){logger[_0x4293('0x17')](_0x4293('0x13'),_0x2fe3d3,_0x38a534);_0x494d0d(_0x38a534);});});}exports['CreateFaxMessage']=function(_0x416db6){var _0x401dde=this;return new Promise(function(_0x3d6fb5,_0x8a2e1a){return db[_0x4293('0x1c')][_0x4293('0x1d')](_0x416db6['body'],{'raw':_0x416db6[_0x4293('0x1e')]?_0x416db6['options'][_0x4293('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x24e39b){logger[_0x4293('0x12')]('CreateFaxMessage',_0x416db6);logger[_0x4293('0x15')](_0x4293('0x20'),_0x416db6,JSON[_0x4293('0x21')](_0x24e39b));_0x3d6fb5(_0x24e39b);})[_0x4293('0x1b')](function(_0x22fb44){logger[_0x4293('0x17')](_0x4293('0x20'),_0x22fb44['message'],_0x416db6);_0x8a2e1a(_0x401dde[_0x4293('0x17')](0x1f4,_0x22fb44[_0x4293('0x19')]));});});};exports[_0x4293('0x22')]=function(_0x1bb008){var _0xc5a8b8=this;return new Promise(function(_0x316925,_0x3848be){return db[_0x4293('0x1c')][_0x4293('0x23')](_0x1bb008[_0x4293('0x24')],{'raw':_0x1bb008['options']?_0x1bb008[_0x4293('0x1e')][_0x4293('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bb008[_0x4293('0x1e')]?_0x1bb008[_0x4293('0x1e')][_0x4293('0x25')]||null:null,'attributes':_0x1bb008['options']?_0x1bb008['options'][_0x4293('0x26')]||null:null,'limit':_0x1bb008[_0x4293('0x1e')]?_0x1bb008[_0x4293('0x1e')][_0x4293('0x27')]||null:null})[_0x4293('0x11')](function(_0x909f31){logger['info'](_0x4293('0x22'),_0x1bb008);logger[_0x4293('0x15')](_0x4293('0x22'),_0x1bb008,JSON[_0x4293('0x21')](_0x909f31));_0x316925(_0x909f31);})['catch'](function(_0x37f55b){logger[_0x4293('0x17')](_0x4293('0x22'),_0x37f55b[_0x4293('0x19')],_0x1bb008);_0x3848be(_0xc5a8b8['error'](0x1f4,_0x37f55b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b610ba4..2bbf771 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 5aefead..05805c9 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 _0xdd8e=['update','/:id/accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','download','post','tracked','fax','faxmessage:create','put'];(function(_0xd097d3,_0x2d6030){var _0x22f399=function(_0x42be13){while(--_0x42be13){_0xd097d3['push'](_0xd097d3['shift']());}};_0x22f399(++_0x2d6030);}(_0xdd8e,0x1f4));var _0xedd8=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xdd8e[_0x376db5];return _0x304c17;};'use strict';var multer=require(_0xedd8('0x0'));var util=require('util');var path=require(_0xedd8('0x1'));var timeout=require(_0xedd8('0x2'));var express=require(_0xedd8('0x3'));var router=express[_0xedd8('0x4')]();var auth=require(_0xedd8('0x5'));var interaction=require(_0xedd8('0x6'));var config=require(_0xedd8('0x7'));var controller=require(_0xedd8('0x8'));router[_0xedd8('0x9')]('/',auth[_0xedd8('0xa')](),controller[_0xedd8('0xb')]);router[_0xedd8('0x9')](_0xedd8('0xc'),auth[_0xedd8('0xa')](),controller['describe']);router[_0xedd8('0x9')](_0xedd8('0xd'),auth[_0xedd8('0xa')](),controller['show']);router[_0xedd8('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xedd8('0xe')]);router[_0xedd8('0xf')]('/',auth[_0xedd8('0xa')](),interaction[_0xedd8('0x10')](_0xedd8('0x11'),_0xedd8('0x12')),controller['create']);router[_0xedd8('0x13')](_0xedd8('0xd'),auth['isAuthenticated'](),controller[_0xedd8('0x14')]);router[_0xedd8('0x13')](_0xedd8('0x15'),auth[_0xedd8('0xa')](),controller['accept']);router[_0xedd8('0x13')](_0xedd8('0x16'),auth[_0xedd8('0xa')](),controller['reject']);router[_0xedd8('0x17')](_0xedd8('0xd'),auth[_0xedd8('0xa')](),controller[_0xedd8('0x18')]);module[_0xedd8('0x19')]=router; \ No newline at end of file +var _0x843b=['download','post','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','../../components/auth/service','../../config/environment','./faxMessage.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x3de98b,_0x486e36){var _0x2c1995=function(_0x645048){while(--_0x645048){_0x3de98b['push'](_0x3de98b['shift']());}};_0x2c1995(++_0x486e36);}(_0x843b,0xae));var _0xb843=function(_0x11f026,_0x2a82ac){_0x11f026=_0x11f026-0x0;var _0x9e15c1=_0x843b[_0x11f026];return _0x9e15c1;};'use strict';var multer=require(_0xb843('0x0'));var util=require(_0xb843('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xb843('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xb843('0x3'));var controller=require(_0xb843('0x4'));router[_0xb843('0x5')]('/',auth['isAuthenticated'](),controller[_0xb843('0x6')]);router[_0xb843('0x5')]('/describe',auth[_0xb843('0x7')](),controller[_0xb843('0x8')]);router[_0xb843('0x5')](_0xb843('0x9'),auth[_0xb843('0x7')](),controller['show']);router[_0xb843('0x5')]('/:id/download',auth[_0xb843('0x7')](),controller[_0xb843('0xa')]);router[_0xb843('0xb')]('/',auth[_0xb843('0x7')](),interaction[_0xb843('0xc')](_0xb843('0xd'),'faxmessage:create'),controller[_0xb843('0xe')]);router[_0xb843('0xf')]('/:id',auth[_0xb843('0x7')](),controller[_0xb843('0x10')]);router[_0xb843('0xf')](_0xb843('0x11'),auth[_0xb843('0x7')](),controller[_0xb843('0x12')]);router[_0xb843('0xf')](_0xb843('0x13'),auth['isAuthenticated'](),controller[_0xb843('0x14')]);router[_0xb843('0x15')](_0xb843('0x9'),auth[_0xb843('0x7')](),controller['destroy']);module[_0xb843('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a331a0d..ce3b8af 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 _0x7501=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x331085,_0x46ef3b){var _0x1547f4=function(_0x549b5d){while(--_0x549b5d){_0x331085['push'](_0x331085['shift']());}};_0x1547f4(++_0x46ef3b);}(_0x7501,0xcc));var _0x1750=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x7501[_0x231e16];return _0x570a7c;};'use strict';var Sequelize=require(_0x1750('0x0'));module[_0x1750('0x1')]={'name':{'type':Sequelize[_0x1750('0x2')],'unique':_0x1750('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1750('0x2')]},'timeout':{'type':Sequelize[_0x1750('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1750('0x5')]('rrmemory',_0x1750('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x1750('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa854=['sequelize','exports','STRING','name','ENUM','beepall','INTEGER'];(function(_0x3572e5,_0x5893d8){var _0x2073f6=function(_0x136543){while(--_0x136543){_0x3572e5['push'](_0x3572e5['shift']());}};_0x2073f6(++_0x5893d8);}(_0xa854,0x103));var _0x4a85=function(_0x3daa94,_0x342c15){_0x3daa94=_0x3daa94-0x0;var _0x588069=_0xa854[_0x3daa94];return _0x588069;};'use strict';var Sequelize=require(_0x4a85('0x0'));module[_0x4a85('0x1')]={'name':{'type':Sequelize[_0x4a85('0x2')],'unique':_0x4a85('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4a85('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4a85('0x4')]('rrmemory',_0x4a85('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4a85('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 35956c8..ac09822 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 _0xf9ae=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','hasOwnProperty','nolimit','addTeams','ids','User','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','transaction','removeAgents','forEach','addAgents','omit','isArray','userFaxQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel'];(function(_0x218cb5,_0x46e4f5){var _0x2b419d=function(_0x55b5bc){while(--_0x55b5bc){_0x218cb5['push'](_0x218cb5['shift']());}};_0x2b419d(++_0x46e4f5);}(_0xf9ae,0x85));var _0xef9a=function(_0x172fc4,_0x53df31){_0x172fc4=_0x172fc4-0x0;var _0x42ca0a=_0xf9ae[_0x172fc4];return _0x42ca0a;};'use strict';var pdf=require(_0xef9a('0x0'));var emlformat=require(_0xef9a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xef9a('0x2'));var jsonpatch=require(_0xef9a('0x3'));var rp=require(_0xef9a('0x4'));var moment=require(_0xef9a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xef9a('0x6'));var util=require(_0xef9a('0x7'));var path=require('path');var sox=require(_0xef9a('0x8'));var csv=require(_0xef9a('0x9'));var ejs=require(_0xef9a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xef9a('0xb'));var crypto=require(_0xef9a('0xc'));var jsforce=require(_0xef9a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xef9a('0x9'));var querystring=require(_0xef9a('0xe'));var Papa=require('papaparse');var Redis=require(_0xef9a('0xf'));var authService=require(_0xef9a('0x10'));var qs=require(_0xef9a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef9a('0x12'));var logger=require('../../config/logger')(_0xef9a('0x13'));var utils=require(_0xef9a('0x14'));var config=require(_0xef9a('0x15'));var db=require(_0xef9a('0x16'))['db'];config['redis']=_[_0xef9a('0x17')](config['redis'],{'host':_0xef9a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef9a('0x19')]));require(_0xef9a('0x1a'))[_0xef9a('0x1b')](socket);function respondWithStatusCode(_0x464288,_0x5ec28b){_0x5ec28b=_0x5ec28b||0xcc;return function(_0x1491a3){if(_0x1491a3){return _0x464288[_0xef9a('0x1c')](_0x5ec28b);}return _0x464288[_0xef9a('0x1d')](_0x5ec28b)[_0xef9a('0x1e')]();};}function respondWithResult(_0x352427,_0x4306f9){_0x4306f9=_0x4306f9||0xc8;return function(_0x476941){if(_0x476941){return _0x352427['status'](_0x4306f9)[_0xef9a('0x1f')](_0x476941);}};}function respondWithFilteredResult(_0x284fda,_0x4821be){return function(_0x14b38b){if(_0x14b38b){var _0x454c2c=_0x14b38b[_0xef9a('0x20')],_0x1b286c=_0x4821be[_0xef9a('0x21')],_0x428b31=_0x4821be[_0xef9a('0x21')]+_0x4821be[_0xef9a('0x22')],_0x24034b;if(_0x428b31>=_0x454c2c){_0x428b31=_0x454c2c;_0x24034b=0xc8;}else{_0x24034b=0xce;}_0x284fda['status'](_0x24034b);return _0x284fda[_0xef9a('0x23')](_0xef9a('0x24'),_0x1b286c+'-'+_0x428b31+'/'+_0x454c2c)[_0xef9a('0x1f')](_0x14b38b);}return null;};}function patchUpdates(_0x266b79){return function(_0xf17902){try{jsonpatch[_0xef9a('0x25')](_0xf17902,_0x266b79,!![]);}catch(_0xaf563d){return BPromise[_0xef9a('0x26')](_0xaf563d);}return _0xf17902[_0xef9a('0x27')]();};}function saveUpdates(_0x14640a,_0x5523e8){return function(_0x5e9932){if(_0x5e9932){return _0x5e9932[_0xef9a('0x28')](_0x14640a)['then'](function(_0x37b666){return _0x37b666;});}return null;};}function removeEntity(_0x21c221,_0x2cf102){return function(_0x530bf8){if(_0x530bf8){return _0x530bf8[_0xef9a('0x29')]()[_0xef9a('0x2a')](function(){var _0x51ddae=_0x530bf8[_0xef9a('0x2b')]({'plain':!![]});var _0x4a16b8='FaxQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x4a16b8,'resourceId':_0x51ddae['id']}})['then'](function(){return _0x530bf8;});})['then'](function(){_0x21c221[_0xef9a('0x1d')](0xcc)[_0xef9a('0x1e')]();});}};}function handleEntityNotFound(_0x4731ba,_0x58f0ec){return function(_0x570c4a){if(!_0x570c4a){_0x4731ba[_0xef9a('0x1c')](0x194);}return _0x570c4a;};}function handleError(_0x15f806,_0x3050cf){_0x3050cf=_0x3050cf||0x1f4;return function(_0x44a212){logger['error'](_0x44a212[_0xef9a('0x2c')]);if(_0x44a212[_0xef9a('0x2d')]){delete _0x44a212[_0xef9a('0x2d')];}_0x15f806['status'](_0x3050cf)[_0xef9a('0x2e')](_0x44a212);};}exports[_0xef9a('0x2f')]=function(_0x2e5a2e,_0x3f65b6){var _0x5f5c6a={},_0x5914c7={},_0x17883d={'count':0x0,'rows':[]};var _0x10a605=_['map'](db[_0xef9a('0x30')][_0xef9a('0x31')],function(_0x448e51){return{'name':_0x448e51[_0xef9a('0x32')],'type':_0x448e51[_0xef9a('0x33')][_0xef9a('0x34')]};});_0x5914c7[_0xef9a('0x35')]=_[_0xef9a('0x36')](_0x10a605,_0xef9a('0x2d'));_0x5914c7[_0xef9a('0x37')]=_[_0xef9a('0x38')](_0x2e5a2e['query']);_0x5914c7['filters']=_[_0xef9a('0x39')](_0x5914c7['model'],_0x5914c7[_0xef9a('0x37')]);_0x5f5c6a[_0xef9a('0x3a')]=_[_0xef9a('0x39')](_0x5914c7[_0xef9a('0x35')],qs[_0xef9a('0x3b')](_0x2e5a2e[_0xef9a('0x37')][_0xef9a('0x3b')]));_0x5f5c6a[_0xef9a('0x3a')]=_0x5f5c6a[_0xef9a('0x3a')][_0xef9a('0x3c')]?_0x5f5c6a[_0xef9a('0x3a')]:_0x5914c7[_0xef9a('0x35')];if(!_0x2e5a2e['query']['hasOwnProperty']('nolimit')){_0x5f5c6a[_0xef9a('0x22')]=qs[_0xef9a('0x22')](_0x2e5a2e['query'][_0xef9a('0x22')]);_0x5f5c6a['offset']=qs[_0xef9a('0x21')](_0x2e5a2e['query'][_0xef9a('0x21')]);}_0x5f5c6a['order']=qs[_0xef9a('0x3d')](_0x2e5a2e[_0xef9a('0x37')]['sort']);_0x5f5c6a[_0xef9a('0x3e')]=qs[_0xef9a('0x3f')](_[_0xef9a('0x40')](_0x2e5a2e[_0xef9a('0x37')],_0x5914c7[_0xef9a('0x3f')]),_0x10a605);if(_0x2e5a2e[_0xef9a('0x37')]['filter']){_0x5f5c6a['where']=_['merge'](_0x5f5c6a[_0xef9a('0x3e')],{'$or':_[_0xef9a('0x36')](_0x10a605,function(_0x2b816b){if(_0x2b816b['type']!==_0xef9a('0x41')){var _0x1a5aeb={};_0x1a5aeb[_0x2b816b[_0xef9a('0x2d')]]={'$like':'%'+_0x2e5a2e[_0xef9a('0x37')][_0xef9a('0x42')]+'%'};return _0x1a5aeb;}})});}_0x5f5c6a=_['merge']({},_0x5f5c6a,_0x2e5a2e[_0xef9a('0x43')]);var _0x1890ab={'where':_0x5f5c6a[_0xef9a('0x3e')]};return db[_0xef9a('0x30')][_0xef9a('0x20')](_0x1890ab)[_0xef9a('0x2a')](function(_0x539fe0){_0x17883d[_0xef9a('0x20')]=_0x539fe0;if(_0x2e5a2e[_0xef9a('0x37')][_0xef9a('0x44')]){_0x5f5c6a[_0xef9a('0x45')]=[{'all':!![]}];}return db[_0xef9a('0x30')][_0xef9a('0x46')](_0x5f5c6a);})[_0xef9a('0x2a')](function(_0x2f8fc3){_0x17883d[_0xef9a('0x47')]=_0x2f8fc3;return _0x17883d;})['then'](respondWithFilteredResult(_0x3f65b6,_0x5f5c6a))['catch'](handleError(_0x3f65b6,null));};exports[_0xef9a('0x48')]=function(_0xfcd62d,_0x2b47c1){var _0x4468ba={'raw':!![],'where':{'id':_0xfcd62d[_0xef9a('0x49')]['id']}},_0x5c60e7={};_0x5c60e7[_0xef9a('0x35')]=_[_0xef9a('0x38')](db[_0xef9a('0x30')][_0xef9a('0x31')]);_0x5c60e7[_0xef9a('0x37')]=_[_0xef9a('0x38')](_0xfcd62d[_0xef9a('0x37')]);_0x5c60e7['filters']=_[_0xef9a('0x39')](_0x5c60e7[_0xef9a('0x35')],_0x5c60e7[_0xef9a('0x37')]);_0x4468ba[_0xef9a('0x3a')]=_[_0xef9a('0x39')](_0x5c60e7['model'],qs[_0xef9a('0x3b')](_0xfcd62d[_0xef9a('0x37')][_0xef9a('0x3b')]));_0x4468ba[_0xef9a('0x3a')]=_0x4468ba[_0xef9a('0x3a')][_0xef9a('0x3c')]?_0x4468ba[_0xef9a('0x3a')]:_0x5c60e7['model'];if(_0xfcd62d[_0xef9a('0x37')][_0xef9a('0x44')]){_0x4468ba[_0xef9a('0x45')]=[{'all':!![]}];}_0x4468ba=_[_0xef9a('0x4a')]({},_0x4468ba,_0xfcd62d[_0xef9a('0x43')]);return db[_0xef9a('0x30')][_0xef9a('0x4b')](_0x4468ba)[_0xef9a('0x2a')](handleEntityNotFound(_0x2b47c1,null))[_0xef9a('0x2a')](respondWithResult(_0x2b47c1,null))[_0xef9a('0x4c')](handleError(_0x2b47c1,null));};exports[_0xef9a('0x4d')]=function(_0x427244,_0x3f285e){return db['FaxQueue'][_0xef9a('0x4d')](_0x427244[_0xef9a('0x4e')],{})[_0xef9a('0x2a')](function(_0x30c3ed){var _0x100362=_0x427244[_0xef9a('0x4f')][_0xef9a('0x2b')]({'plain':!![]});if(!_0x100362)throw new Error(_0xef9a('0x50'));if(_0x100362[_0xef9a('0x51')]===_0xef9a('0x4f')){var _0x430b49=_0x30c3ed[_0xef9a('0x2b')]({'plain':!![]});var _0x1cc870=_0xef9a('0x52');return db[_0xef9a('0x53')][_0xef9a('0x4b')]({'where':{'name':_0x1cc870,'userProfileId':_0x100362[_0xef9a('0x54')]},'raw':!![]})[_0xef9a('0x2a')](function(_0x2b4d0c){if(_0x2b4d0c&&_0x2b4d0c[_0xef9a('0x55')]===0x0){return db[_0xef9a('0x56')]['create']({'name':_0x430b49['name'],'resourceId':_0x430b49['id'],'type':_0x2b4d0c[_0xef9a('0x2d')],'sectionId':_0x2b4d0c['id']},{})[_0xef9a('0x2a')](function(){return _0x30c3ed;});}else{return _0x30c3ed;}})['catch'](function(_0x35fb8f){logger['error'](_0xef9a('0x57'),_0x35fb8f);throw _0x35fb8f;});}return _0x30c3ed;})[_0xef9a('0x2a')](respondWithResult(_0x3f285e,0xc9))[_0xef9a('0x4c')](handleError(_0x3f285e,null));};exports['update']=function(_0x3762fd,_0x1a5699){if(_0x3762fd['body']['id']){delete _0x3762fd['body']['id'];}return db[_0xef9a('0x30')][_0xef9a('0x4b')]({'where':{'id':_0x3762fd[_0xef9a('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a5699,null))[_0xef9a('0x2a')](saveUpdates(_0x3762fd['body'],null))[_0xef9a('0x2a')](respondWithResult(_0x1a5699,null))['catch'](handleError(_0x1a5699,null));};exports[_0xef9a('0x29')]=function(_0x242e85,_0x125871){return db[_0xef9a('0x30')][_0xef9a('0x4b')]({'where':{'id':_0x242e85[_0xef9a('0x49')]['id']}})[_0xef9a('0x2a')](handleEntityNotFound(_0x125871,null))[_0xef9a('0x2a')](removeEntity(_0x125871,null))[_0xef9a('0x4c')](handleError(_0x125871,null));};exports[_0xef9a('0x58')]=function(_0x563b11,_0x2e9aa0){return db['FaxQueue'][_0xef9a('0x58')]()[_0xef9a('0x2a')](respondWithResult(_0x2e9aa0,null))['catch'](handleError(_0x2e9aa0,null));};exports[_0xef9a('0x59')]=function(_0x68d652,_0x54318b,_0x4b82e4){var _0x158eab={'raw':!![],'where':{}},_0x14fba8={},_0x251ac1;return db['FaxQueue'][_0xef9a('0x5a')]({'where':{'id':_0x68d652['params']['id']}})[_0xef9a('0x2a')](handleEntityNotFound(_0x54318b,null))[_0xef9a('0x2a')](function(_0x188ad8){if(_0x188ad8){_0x251ac1=_0x188ad8[_0xef9a('0x2b')]({'plain':!![]});_0x14fba8[_0xef9a('0x35')]=_[_0xef9a('0x38')](db[_0xef9a('0x5b')][_0xef9a('0x31')]);_0x14fba8[_0xef9a('0x37')]=_[_0xef9a('0x38')](_0x68d652['query']);_0x14fba8[_0xef9a('0x3f')]=_[_0xef9a('0x39')](_0x14fba8['model'],_0x14fba8[_0xef9a('0x37')]);_0x158eab[_0xef9a('0x3a')]=_['intersection'](_0x14fba8['model'],qs[_0xef9a('0x3b')](_0x68d652[_0xef9a('0x37')][_0xef9a('0x3b')]));_0x158eab['attributes']=_0x158eab[_0xef9a('0x3a')]['length']?_0x158eab[_0xef9a('0x3a')]:_0x14fba8[_0xef9a('0x35')];if(!_0x68d652['query']['hasOwnProperty']('nolimit')){_0x158eab[_0xef9a('0x22')]=qs[_0xef9a('0x22')](_0x68d652[_0xef9a('0x37')][_0xef9a('0x22')]);_0x158eab[_0xef9a('0x21')]=qs['offset'](_0x68d652[_0xef9a('0x37')][_0xef9a('0x21')]);}_0x158eab['order']=qs[_0xef9a('0x3d')](_0x68d652[_0xef9a('0x37')][_0xef9a('0x3d')]);_0x158eab[_0xef9a('0x3e')]=qs[_0xef9a('0x3f')](_[_0xef9a('0x40')](_0x68d652[_0xef9a('0x37')],_0x14fba8['filters']));_0x158eab['where'][_0xef9a('0x5c')]=_0x188ad8['id'];if(_0x68d652[_0xef9a('0x37')]['filter']){_0x158eab['where']=_[_0xef9a('0x4a')](_0x158eab['where'],{'$or':_[_0xef9a('0x36')](_0x158eab[_0xef9a('0x3a')],function(_0x25f164){var _0x15c5ef={};_0x15c5ef[_0x25f164]={'$like':'%'+_0x68d652[_0xef9a('0x37')][_0xef9a('0x42')]+'%'};return _0x15c5ef;})});}_0x158eab=_[_0xef9a('0x4a')]({},_0x158eab,_0x68d652[_0xef9a('0x43')]);return db[_0xef9a('0x5b')]['findAll'](_0x158eab);}})['then'](function(_0x3bf7f2){if(_0x3bf7f2){return db['User']['findAndCountAll']({'where':{'id':_[_0xef9a('0x36')](_0x3bf7f2,_0xef9a('0x5d')),'role':_0xef9a('0x5e')},'attributes':['id','name',_0xef9a('0x5f'),_0xef9a('0x60'),_0xef9a('0x61')]});}})['then'](function(_0xdaaeae){if(_0xdaaeae){return{'count':_0xdaaeae['count'],'rows':_[_0xef9a('0x36')](_0xdaaeae[_0xef9a('0x47')],function(_0x7b19ff){return{'membername':_0x7b19ff[_0xef9a('0x2d')],'UserId':_0x7b19ff['id'],'queue_name':_0x251ac1[_0xef9a('0x2d')],'FaxQueueId':_0x251ac1['id'],'interface':util[_0xef9a('0x62')](_0xef9a('0x63'),_0xef9a('0x64'),_0x7b19ff[_0xef9a('0x2d')]),'penalty':0x0,'paused':_0x7b19ff[_0xef9a('0x5f')],'createdAt':_0x7b19ff['createdAt'],'updatedAt':_0x7b19ff[_0xef9a('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xef9a('0x2a')](respondWithFilteredResult(_0x54318b,_0x158eab))[_0xef9a('0x4c')](handleError(_0x54318b,null));};exports[_0xef9a('0x65')]=function(_0x2a828e,_0x362fe4,_0x489748){var _0x374c0b={};var _0x333b08={};var _0x103910;var _0x2e0174;return db[_0xef9a('0x30')][_0xef9a('0x5a')]({'where':{'id':_0x2a828e[_0xef9a('0x49')]['id']}})[_0xef9a('0x2a')](handleEntityNotFound(_0x362fe4,null))[_0xef9a('0x2a')](function(_0x65b3e2){if(_0x65b3e2){_0x103910=_0x65b3e2;_0x333b08['model']=_[_0xef9a('0x38')](db[_0xef9a('0x66')]['rawAttributes']);_0x333b08['query']=_[_0xef9a('0x38')](_0x2a828e['query']);_0x333b08[_0xef9a('0x3f')]=_['intersection'](_0x333b08['model'],_0x333b08[_0xef9a('0x37')]);_0x374c0b[_0xef9a('0x3a')]=_[_0xef9a('0x39')](_0x333b08[_0xef9a('0x35')],qs[_0xef9a('0x3b')](_0x2a828e[_0xef9a('0x37')]['fields']));_0x374c0b[_0xef9a('0x3a')]=_0x374c0b[_0xef9a('0x3a')]['length']?_0x374c0b[_0xef9a('0x3a')]:_0x333b08[_0xef9a('0x35')];_0x374c0b[_0xef9a('0x67')]=qs[_0xef9a('0x3d')](_0x2a828e[_0xef9a('0x37')][_0xef9a('0x3d')]);_0x374c0b[_0xef9a('0x3e')]=qs['filters'](_[_0xef9a('0x40')](_0x2a828e['query'],_0x333b08[_0xef9a('0x3f')]));if(_0x2a828e[_0xef9a('0x37')][_0xef9a('0x42')]){_0x374c0b[_0xef9a('0x3e')]=_[_0xef9a('0x4a')](_0x374c0b[_0xef9a('0x3e')],{'$or':_[_0xef9a('0x36')](_0x374c0b['attributes'],function(_0x235cbb){var _0x5b575b={};_0x5b575b[_0x235cbb]={'$like':'%'+_0x2a828e[_0xef9a('0x37')][_0xef9a('0x42')]+'%'};return _0x5b575b;})});}_0x374c0b=_['merge']({},_0x374c0b,_0x2a828e[_0xef9a('0x43')]);return _0x103910[_0xef9a('0x65')](_0x374c0b);}})[_0xef9a('0x2a')](function(_0x2e9f59){if(_0x2e9f59){_0x2e0174=_0x2e9f59['length'];if(!_0x2a828e[_0xef9a('0x37')][_0xef9a('0x68')](_0xef9a('0x69'))){_0x374c0b['limit']=qs[_0xef9a('0x22')](_0x2a828e[_0xef9a('0x37')][_0xef9a('0x22')]);_0x374c0b['offset']=qs[_0xef9a('0x21')](_0x2a828e[_0xef9a('0x37')]['offset']);}return _0x103910[_0xef9a('0x65')](_0x374c0b);}})[_0xef9a('0x2a')](function(_0x52d046){if(_0x52d046){return _0x52d046?{'count':_0x2e0174,'rows':_0x52d046}:null;}})[_0xef9a('0x2a')](respondWithResult(_0x362fe4,null))['catch'](handleError(_0x362fe4,null));};exports[_0xef9a('0x6a')]=function(_0x1363cb,_0x33da13,_0x35650e){var _0x200e0e=_0x1363cb[_0xef9a('0x4e')][_0xef9a('0x6b')];return db[_0xef9a('0x66')][_0xef9a('0x46')]({'where':{'id':_0x200e0e},'attributes':['id'],'include':[{'model':db[_0xef9a('0x6c')],'as':'Agents','attributes':['id','name',_0xef9a('0x6d'),_0xef9a('0x6e'),_0xef9a('0x6f')],'raw':!![]}]})[_0xef9a('0x2a')](function(_0x27efb2){if(_0x27efb2){var _0x4ddd3f=_[_0xef9a('0x70')](_0x27efb2,function(_0x191195){var _0x15fa69=_0x191195[_0xef9a('0x2b')]({'plain':!![]});return _0x15fa69['Agents'];});return db[_0xef9a('0x30')][_0xef9a('0x4b')]({'where':{'id':_0x1363cb[_0xef9a('0x49')]['id']}})['then'](function(_0x5d85bc){return db[_0xef9a('0x71')]['transaction'](function(_0xdc45e3){return _0x5d85bc[_0xef9a('0x6a')](_0x200e0e,{'transaction':_0xdc45e3})['then'](function(){return BPromise[_0xef9a('0x72')](_0x4ddd3f,function(_0x5bb77d){return db['UserFaxQueue'][_0xef9a('0x73')]({'where':{'UserId':_0x5bb77d['id'],'FaxQueueId':_0x1363cb[_0xef9a('0x49')]['id']},'transaction':_0xdc45e3});});})[_0xef9a('0x2a')](function(){_0x4ddd3f['forEach'](function(_0x4ac9c6){socket[_0xef9a('0x74')](_0xef9a('0x75'),{'UserId':_0x4ac9c6['id'],'FaxQueueId':_0x5d85bc['id']});});});});});}})[_0xef9a('0x2a')](respondWithStatusCode(_0x33da13,null))[_0xef9a('0x4c')](handleError(_0x33da13,null));};exports[_0xef9a('0x76')]=function(_0x5bc86d,_0x580557,_0x585205){return db[_0xef9a('0x66')][_0xef9a('0x46')]({'where':{'id':_0x5bc86d[_0xef9a('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xef9a('0x6c')],'as':_0xef9a('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x580557,null))['then'](function(_0x422114){var _0x57b81b=_[_0xef9a('0x36')](_0x422114,'id');var _0x2b1594=[];var _0x70b9df=[];var _0x151a5f=squel[_0xef9a('0x78')]();_0x151a5f[_0xef9a('0x79')](_0xef9a('0x7a'))[_0xef9a('0x7b')](_0xef9a('0x7c'),'tq')[_0xef9a('0x7d')](_0xef9a('0x7e'),'ut',_0xef9a('0x7f'))['where']('FaxQueueId\x20=\x20?',_0x5bc86d['params']['id']);for(var _0x5efade=0x0;_0x5efade<_0x422114['length'];_0x5efade+=0x1){let _0x18a149=_0x422114[_0x5efade];for(var _0x1025fe=0x0;_0x1025fe<_0x18a149['Agents'][_0xef9a('0x3c')];_0x1025fe+=0x1){let _0x1765e9=_0x18a149['Agents'][_0x1025fe];var _0x360b8e=_0x151a5f['clone']();_0x360b8e[_0xef9a('0x3e')](_0xef9a('0x80'),_0x1765e9['id']);_0x70b9df['push'](db[_0xef9a('0x71')]['query'](_0x360b8e[_0xef9a('0x81')](),{'type':db[_0xef9a('0x71')][_0xef9a('0x82')][_0xef9a('0x83')]})[_0xef9a('0x2a')](function(_0x4bf122){if(_0x4bf122['length']===0x1){return _0x1765e9['id'];}else{var _0x2d5301=_[_0xef9a('0x84')](_['map'](_0x4bf122,'TeamId'),function(_0x2c69bf){return _[_0xef9a('0x85')](_0x57b81b,_0x2c69bf);});if(_0x2d5301){return _0x1765e9['id'];}}}));}}return BPromise[_0xef9a('0x86')](_0x70b9df)[_0xef9a('0x2a')](function(_0x42e065){_0x2b1594=_(_0x2b1594)['union'](_0x42e065)[_0xef9a('0x87')]()[_0xef9a('0x88')]();return db[_0xef9a('0x30')][_0xef9a('0x4b')]({'where':{'id':_0x5bc86d[_0xef9a('0x49')]['id']}})[_0xef9a('0x2a')](function(_0x26d17c){return db[_0xef9a('0x71')][_0xef9a('0x89')](function(_0x38edf3){return _0x26d17c['removeTeams'](_0x5bc86d[_0xef9a('0x37')][_0xef9a('0x6b')],{'transaction':_0x38edf3})[_0xef9a('0x2a')](function(){if(!_['isEmpty'](_0x2b1594)){return _0x26d17c[_0xef9a('0x8a')](_0x2b1594,{'transaction':_0x38edf3});}})['then'](function(){_0x2b1594[_0xef9a('0x8b')](function(_0x48dd22){socket[_0xef9a('0x74')]('userFaxQueue:remove',{'UserId':_0x48dd22,'FaxQueueId':_0x26d17c['id']});});});});});});})[_0xef9a('0x2a')](respondWithStatusCode(_0x580557,null))['catch'](handleError(_0x580557,null));};exports[_0xef9a('0x8c')]=function(_0x489973,_0x16b717,_0x5c3c79){return db[_0xef9a('0x30')][_0xef9a('0x4b')]({'where':{'id':_0x489973[_0xef9a('0x49')]['id']}})[_0xef9a('0x2a')](handleEntityNotFound(_0x16b717,null))[_0xef9a('0x2a')](function(_0x521151){if(_0x521151){return _0x521151[_0xef9a('0x8c')](_0x489973[_0xef9a('0x4e')][_0xef9a('0x6b')],_[_0xef9a('0x8d')](_0x489973[_0xef9a('0x4e')],[_0xef9a('0x6b'),'id'])||{})['spread'](function(_0x5a0eab){for(var _0x3db43e=0x0;_0x3db43e<_0x489973[_0xef9a('0x4e')]['ids'][_0xef9a('0x3c')];_0x3db43e+=0x1){socket['emit']('userFaxQueue:save',{'UserId':_0x489973[_0xef9a('0x4e')][_0xef9a('0x6b')][_0x3db43e],'FaxQueueId':_0x489973[_0xef9a('0x49')]['id']});}return _0x5a0eab;});}})[_0xef9a('0x2a')](respondWithResult(_0x16b717,null))[_0xef9a('0x4c')](handleError(_0x16b717,null));};exports[_0xef9a('0x8a')]=function(_0x581d72,_0x3dff91,_0x2206a7){return db[_0xef9a('0x30')][_0xef9a('0x4b')]({'where':{'id':_0x581d72['params']['id']}})[_0xef9a('0x2a')](handleEntityNotFound(_0x3dff91,null))[_0xef9a('0x2a')](function(_0x8dd476){if(_0x8dd476){return _0x8dd476[_0xef9a('0x8a')](_0x581d72[_0xef9a('0x37')][_0xef9a('0x6b')])['then'](function(){if(_[_0xef9a('0x8e')](_0x581d72[_0xef9a('0x37')]['ids'])){for(var _0x47c627=0x0;_0x47c627<_0x581d72[_0xef9a('0x37')][_0xef9a('0x6b')]['length'];_0x47c627+=0x1){socket[_0xef9a('0x74')](_0xef9a('0x8f'),{'UserId':Number(_0x581d72[_0xef9a('0x37')][_0xef9a('0x6b')][_0x47c627]),'FaxQueueId':Number(_0x581d72[_0xef9a('0x49')]['id'])});}}else{socket['emit'](_0xef9a('0x8f'),{'UserId':Number(_0x581d72[_0xef9a('0x37')][_0xef9a('0x6b')]),'FaxQueueId':Number(_0x581d72['params']['id'])});}});}})[_0xef9a('0x2a')](respondWithStatusCode(_0x3dff91,null))[_0xef9a('0x4c')](handleError(_0x3dff91,null));};exports[_0xef9a('0x90')]=function(_0x2ab118,_0x536fd6,_0x21c564){var _0x588294={};var _0x33efe6={};var _0x54b8c0;var _0x21c248;return db[_0xef9a('0x30')][_0xef9a('0x5a')]({'where':{'id':_0x2ab118[_0xef9a('0x49')]['id']}})[_0xef9a('0x2a')](handleEntityNotFound(_0x536fd6,null))['then'](function(_0x2404ca){if(_0x2404ca){_0x54b8c0=_0x2404ca;_0x33efe6[_0xef9a('0x35')]=_['keys'](db[_0xef9a('0x6c')][_0xef9a('0x31')]);_0x33efe6['query']=_[_0xef9a('0x38')](_0x2ab118[_0xef9a('0x37')]);_0x33efe6['filters']=_[_0xef9a('0x39')](_0x33efe6[_0xef9a('0x35')],_0x33efe6[_0xef9a('0x37')]);_0x588294['attributes']=_['intersection'](_0x33efe6['model'],qs[_0xef9a('0x3b')](_0x2ab118['query'][_0xef9a('0x3b')]));_0x588294[_0xef9a('0x3a')]=_0x588294[_0xef9a('0x3a')][_0xef9a('0x3c')]?_0x588294['attributes']:_0x33efe6[_0xef9a('0x35')];_0x588294[_0xef9a('0x67')]=qs[_0xef9a('0x3d')](_0x2ab118[_0xef9a('0x37')][_0xef9a('0x3d')]);_0x588294[_0xef9a('0x3e')]=qs[_0xef9a('0x3f')](_[_0xef9a('0x40')](_0x2ab118[_0xef9a('0x37')],_0x33efe6[_0xef9a('0x3f')]));if(_0x2ab118[_0xef9a('0x37')][_0xef9a('0x42')]){_0x588294['where']=_[_0xef9a('0x4a')](_0x588294['where'],{'$or':_[_0xef9a('0x36')](_0x588294[_0xef9a('0x3a')],function(_0x574b9a){var _0x3da08f={};_0x3da08f[_0x574b9a]={'$like':'%'+_0x2ab118[_0xef9a('0x37')][_0xef9a('0x42')]+'%'};return _0x3da08f;})});}_0x588294=_[_0xef9a('0x4a')]({},_0x588294,_0x2ab118[_0xef9a('0x43')]);return _0x54b8c0[_0xef9a('0x90')](_0x588294);}})[_0xef9a('0x2a')](function(_0x174f01){if(_0x174f01){_0x21c248=_0x174f01['length'];if(!_0x2ab118[_0xef9a('0x37')][_0xef9a('0x68')](_0xef9a('0x69'))){_0x588294[_0xef9a('0x22')]=qs['limit'](_0x2ab118[_0xef9a('0x37')][_0xef9a('0x22')]);_0x588294[_0xef9a('0x21')]=qs[_0xef9a('0x21')](_0x2ab118[_0xef9a('0x37')][_0xef9a('0x21')]);}return _0x54b8c0[_0xef9a('0x90')](_0x588294);}})[_0xef9a('0x2a')](function(_0x211d30){if(_0x211d30){return _0x211d30?{'count':_0x21c248,'rows':_0x211d30}:null;}})['then'](respondWithResult(_0x536fd6,null))[_0xef9a('0x4c')](handleError(_0x536fd6,null));}; \ No newline at end of file +var _0xeeeb=['sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','status','end','json','count','offset','limit','Content-Range','save','update','then','destroy','get','sendStatus','error','name','send','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','FaxQueue','includeAll','rows','catch','show','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','params','UserFaxQueue','nolimit','pick','FaxQueueId','findAll','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','Agents'];(function(_0xacf8c,_0x1d484b){var _0x21fd7b=function(_0x10b1bf){while(--_0x10b1bf){_0xacf8c['push'](_0xacf8c['shift']());}};_0x21fd7b(++_0x1d484b);}(_0xeeeb,0x1bb));var _0xbeee=function(_0x32856b,_0x100a97){_0x32856b=_0x32856b-0x0;var _0x34848c=_0xeeeb[_0x32856b];return _0x34848c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbeee('0x0'));var rimraf=require(_0xbeee('0x1'));var zipdir=require(_0xbeee('0x2'));var jsonpatch=require(_0xbeee('0x3'));var rp=require(_0xbeee('0x4'));var moment=require('moment');var BPromise=require(_0xbeee('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbeee('0x6'));var csv=require(_0xbeee('0x7'));var ejs=require(_0xbeee('0x8'));var fs=require('fs');var _=require(_0xbeee('0x9'));var squel=require(_0xbeee('0xa'));var crypto=require(_0xbeee('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbeee('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbeee('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbeee('0xe'));var as=require(_0xbeee('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbeee('0x10'))(_0xbeee('0x11'));var utils=require(_0xbeee('0x12'));var config=require(_0xbeee('0x13'));var db=require(_0xbeee('0x14'))['db'];config[_0xbeee('0x15')]=_[_0xbeee('0x16')](config[_0xbeee('0x15')],{'host':_0xbeee('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbeee('0x15')]));require(_0xbeee('0x18'))['register'](socket);function respondWithStatusCode(_0x3777ca,_0x4b7b6d){_0x4b7b6d=_0x4b7b6d||0xcc;return function(_0x13b691){if(_0x13b691){return _0x3777ca['sendStatus'](_0x4b7b6d);}return _0x3777ca[_0xbeee('0x19')](_0x4b7b6d)[_0xbeee('0x1a')]();};}function respondWithResult(_0x1dd019,_0x377a78){_0x377a78=_0x377a78||0xc8;return function(_0x4fcea7){if(_0x4fcea7){return _0x1dd019['status'](_0x377a78)[_0xbeee('0x1b')](_0x4fcea7);}};}function respondWithFilteredResult(_0x122992,_0x4e5c6e){return function(_0x570533){if(_0x570533){var _0xa31be2=_0x570533[_0xbeee('0x1c')],_0x954568=_0x4e5c6e[_0xbeee('0x1d')],_0x41e86a=_0x4e5c6e[_0xbeee('0x1d')]+_0x4e5c6e[_0xbeee('0x1e')],_0x89ef63;if(_0x41e86a>=_0xa31be2){_0x41e86a=_0xa31be2;_0x89ef63=0xc8;}else{_0x89ef63=0xce;}_0x122992[_0xbeee('0x19')](_0x89ef63);return _0x122992['set'](_0xbeee('0x1f'),_0x954568+'-'+_0x41e86a+'/'+_0xa31be2)['json'](_0x570533);}return null;};}function patchUpdates(_0x5c882c){return function(_0x2d2c79){try{jsonpatch['apply'](_0x2d2c79,_0x5c882c,!![]);}catch(_0x383c33){return BPromise['reject'](_0x383c33);}return _0x2d2c79[_0xbeee('0x20')]();};}function saveUpdates(_0x32fa75,_0x522ce2){return function(_0x547fd8){if(_0x547fd8){return _0x547fd8[_0xbeee('0x21')](_0x32fa75)[_0xbeee('0x22')](function(_0x13e823){return _0x13e823;});}return null;};}function removeEntity(_0x21cb84,_0x2953a4){return function(_0xf60f9b){if(_0xf60f9b){return _0xf60f9b[_0xbeee('0x23')]()[_0xbeee('0x22')](function(){var _0x947a83=_0xf60f9b[_0xbeee('0x24')]({'plain':!![]});var _0x2e6610='FaxQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x2e6610,'resourceId':_0x947a83['id']}})[_0xbeee('0x22')](function(){return _0xf60f9b;});})[_0xbeee('0x22')](function(){_0x21cb84[_0xbeee('0x19')](0xcc)[_0xbeee('0x1a')]();});}};}function handleEntityNotFound(_0x1361c2,_0x4f8e4e){return function(_0x40bebb){if(!_0x40bebb){_0x1361c2[_0xbeee('0x25')](0x194);}return _0x40bebb;};}function handleError(_0x2472db,_0x11d692){_0x11d692=_0x11d692||0x1f4;return function(_0x56c852){logger[_0xbeee('0x26')](_0x56c852['stack']);if(_0x56c852['name']){delete _0x56c852[_0xbeee('0x27')];}_0x2472db[_0xbeee('0x19')](_0x11d692)[_0xbeee('0x28')](_0x56c852);};}exports[_0xbeee('0x29')]=function(_0x3b3bde,_0x5d3ec1){var _0x239e1d={},_0x37a90d={},_0xe9e233={'count':0x0,'rows':[]};var _0x5b4d49=_[_0xbeee('0x2a')](db['FaxQueue'][_0xbeee('0x2b')],function(_0x24c38e){return{'name':_0x24c38e[_0xbeee('0x2c')],'type':_0x24c38e['type']['key']};});_0x37a90d[_0xbeee('0x2d')]=_[_0xbeee('0x2a')](_0x5b4d49,_0xbeee('0x27'));_0x37a90d['query']=_[_0xbeee('0x2e')](_0x3b3bde[_0xbeee('0x2f')]);_0x37a90d[_0xbeee('0x30')]=_[_0xbeee('0x31')](_0x37a90d[_0xbeee('0x2d')],_0x37a90d[_0xbeee('0x2f')]);_0x239e1d[_0xbeee('0x32')]=_[_0xbeee('0x31')](_0x37a90d[_0xbeee('0x2d')],qs['fields'](_0x3b3bde[_0xbeee('0x2f')][_0xbeee('0x33')]));_0x239e1d[_0xbeee('0x32')]=_0x239e1d[_0xbeee('0x32')]['length']?_0x239e1d['attributes']:_0x37a90d[_0xbeee('0x2d')];if(!_0x3b3bde[_0xbeee('0x2f')][_0xbeee('0x34')]('nolimit')){_0x239e1d['limit']=qs[_0xbeee('0x1e')](_0x3b3bde[_0xbeee('0x2f')]['limit']);_0x239e1d[_0xbeee('0x1d')]=qs[_0xbeee('0x1d')](_0x3b3bde[_0xbeee('0x2f')][_0xbeee('0x1d')]);}_0x239e1d[_0xbeee('0x35')]=qs['sort'](_0x3b3bde[_0xbeee('0x2f')][_0xbeee('0x36')]);_0x239e1d['where']=qs[_0xbeee('0x30')](_['pick'](_0x3b3bde[_0xbeee('0x2f')],_0x37a90d[_0xbeee('0x30')]),_0x5b4d49);if(_0x3b3bde['query'][_0xbeee('0x37')]){_0x239e1d[_0xbeee('0x38')]=_[_0xbeee('0x39')](_0x239e1d[_0xbeee('0x38')],{'$or':_[_0xbeee('0x2a')](_0x5b4d49,function(_0x4e2754){if(_0x4e2754[_0xbeee('0x3a')]!==_0xbeee('0x3b')){var _0x22a414={};_0x22a414[_0x4e2754[_0xbeee('0x27')]]={'$like':'%'+_0x3b3bde[_0xbeee('0x2f')]['filter']+'%'};return _0x22a414;}})});}_0x239e1d=_[_0xbeee('0x39')]({},_0x239e1d,_0x3b3bde[_0xbeee('0x3c')]);var _0x1941ac={'where':_0x239e1d[_0xbeee('0x38')]};return db[_0xbeee('0x3d')][_0xbeee('0x1c')](_0x1941ac)['then'](function(_0x517883){_0xe9e233[_0xbeee('0x1c')]=_0x517883;if(_0x3b3bde['query'][_0xbeee('0x3e')]){_0x239e1d['include']=[{'all':!![]}];}return db[_0xbeee('0x3d')]['findAll'](_0x239e1d);})[_0xbeee('0x22')](function(_0x254e53){_0xe9e233[_0xbeee('0x3f')]=_0x254e53;return _0xe9e233;})[_0xbeee('0x22')](respondWithFilteredResult(_0x5d3ec1,_0x239e1d))[_0xbeee('0x40')](handleError(_0x5d3ec1,null));};exports[_0xbeee('0x41')]=function(_0x3b1610,_0x114bed){var _0x1c35ab={'raw':!![],'where':{'id':_0x3b1610['params']['id']}},_0x1eecf8={};_0x1eecf8[_0xbeee('0x2d')]=_[_0xbeee('0x2e')](db[_0xbeee('0x3d')][_0xbeee('0x2b')]);_0x1eecf8[_0xbeee('0x2f')]=_[_0xbeee('0x2e')](_0x3b1610[_0xbeee('0x2f')]);_0x1eecf8['filters']=_['intersection'](_0x1eecf8['model'],_0x1eecf8['query']);_0x1c35ab[_0xbeee('0x32')]=_['intersection'](_0x1eecf8['model'],qs[_0xbeee('0x33')](_0x3b1610[_0xbeee('0x2f')][_0xbeee('0x33')]));_0x1c35ab['attributes']=_0x1c35ab[_0xbeee('0x32')][_0xbeee('0x42')]?_0x1c35ab[_0xbeee('0x32')]:_0x1eecf8[_0xbeee('0x2d')];if(_0x3b1610[_0xbeee('0x2f')]['includeAll']){_0x1c35ab[_0xbeee('0x43')]=[{'all':!![]}];}_0x1c35ab=_[_0xbeee('0x39')]({},_0x1c35ab,_0x3b1610[_0xbeee('0x3c')]);return db['FaxQueue'][_0xbeee('0x44')](_0x1c35ab)[_0xbeee('0x22')](handleEntityNotFound(_0x114bed,null))[_0xbeee('0x22')](respondWithResult(_0x114bed,null))['catch'](handleError(_0x114bed,null));};exports[_0xbeee('0x45')]=function(_0x2d2bb0,_0x3092fc){return db['FaxQueue']['create'](_0x2d2bb0[_0xbeee('0x46')],{})[_0xbeee('0x22')](function(_0x31caba){var _0x45a9ae=_0x2d2bb0['user'][_0xbeee('0x24')]({'plain':!![]});if(!_0x45a9ae)throw new Error(_0xbeee('0x47'));if(_0x45a9ae[_0xbeee('0x48')]===_0xbeee('0x49')){var _0x174822=_0x31caba[_0xbeee('0x24')]({'plain':!![]});var _0xcc80d8=_0xbeee('0x4a');return db[_0xbeee('0x4b')][_0xbeee('0x44')]({'where':{'name':_0xcc80d8,'userProfileId':_0x45a9ae[_0xbeee('0x4c')]},'raw':!![]})[_0xbeee('0x22')](function(_0x2308d4){if(_0x2308d4&&_0x2308d4['autoAssociation']===0x0){return db[_0xbeee('0x4d')][_0xbeee('0x45')]({'name':_0x174822['name'],'resourceId':_0x174822['id'],'type':_0x2308d4[_0xbeee('0x27')],'sectionId':_0x2308d4['id']},{})[_0xbeee('0x22')](function(){return _0x31caba;});}else{return _0x31caba;}})['catch'](function(_0x1bdcb3){logger[_0xbeee('0x26')](_0xbeee('0x4e'),_0x1bdcb3);throw _0x1bdcb3;});}return _0x31caba;})[_0xbeee('0x22')](respondWithResult(_0x3092fc,0xc9))[_0xbeee('0x40')](handleError(_0x3092fc,null));};exports[_0xbeee('0x21')]=function(_0x1ba970,_0x40b8c7){if(_0x1ba970[_0xbeee('0x46')]['id']){delete _0x1ba970[_0xbeee('0x46')]['id'];}return db[_0xbeee('0x3d')]['find']({'where':{'id':_0x1ba970['params']['id']}})['then'](handleEntityNotFound(_0x40b8c7,null))['then'](saveUpdates(_0x1ba970['body'],null))['then'](respondWithResult(_0x40b8c7,null))[_0xbeee('0x40')](handleError(_0x40b8c7,null));};exports[_0xbeee('0x23')]=function(_0x395db2,_0x431d5b){return db[_0xbeee('0x3d')][_0xbeee('0x44')]({'where':{'id':_0x395db2['params']['id']}})[_0xbeee('0x22')](handleEntityNotFound(_0x431d5b,null))['then'](removeEntity(_0x431d5b,null))[_0xbeee('0x40')](handleError(_0x431d5b,null));};exports[_0xbeee('0x4f')]=function(_0x614e39,_0x3b5d){return db[_0xbeee('0x3d')]['describe']()[_0xbeee('0x22')](respondWithResult(_0x3b5d,null))[_0xbeee('0x40')](handleError(_0x3b5d,null));};exports[_0xbeee('0x50')]=function(_0x17e98f,_0x3bcdc9,_0x4e6893){var _0x154ac0={'raw':!![],'where':{}},_0x4cc6b6={},_0x11c45b;return db['FaxQueue'][_0xbeee('0x51')]({'where':{'id':_0x17e98f[_0xbeee('0x52')]['id']}})[_0xbeee('0x22')](handleEntityNotFound(_0x3bcdc9,null))[_0xbeee('0x22')](function(_0x1ed05d){if(_0x1ed05d){_0x11c45b=_0x1ed05d['get']({'plain':!![]});_0x4cc6b6[_0xbeee('0x2d')]=_[_0xbeee('0x2e')](db[_0xbeee('0x53')]['rawAttributes']);_0x4cc6b6[_0xbeee('0x2f')]=_[_0xbeee('0x2e')](_0x17e98f[_0xbeee('0x2f')]);_0x4cc6b6[_0xbeee('0x30')]=_[_0xbeee('0x31')](_0x4cc6b6['model'],_0x4cc6b6['query']);_0x154ac0[_0xbeee('0x32')]=_['intersection'](_0x4cc6b6[_0xbeee('0x2d')],qs[_0xbeee('0x33')](_0x17e98f[_0xbeee('0x2f')][_0xbeee('0x33')]));_0x154ac0[_0xbeee('0x32')]=_0x154ac0['attributes'][_0xbeee('0x42')]?_0x154ac0[_0xbeee('0x32')]:_0x4cc6b6[_0xbeee('0x2d')];if(!_0x17e98f[_0xbeee('0x2f')][_0xbeee('0x34')](_0xbeee('0x54'))){_0x154ac0['limit']=qs[_0xbeee('0x1e')](_0x17e98f['query'][_0xbeee('0x1e')]);_0x154ac0[_0xbeee('0x1d')]=qs['offset'](_0x17e98f[_0xbeee('0x2f')][_0xbeee('0x1d')]);}_0x154ac0[_0xbeee('0x35')]=qs[_0xbeee('0x36')](_0x17e98f[_0xbeee('0x2f')][_0xbeee('0x36')]);_0x154ac0[_0xbeee('0x38')]=qs['filters'](_[_0xbeee('0x55')](_0x17e98f[_0xbeee('0x2f')],_0x4cc6b6[_0xbeee('0x30')]));_0x154ac0[_0xbeee('0x38')][_0xbeee('0x56')]=_0x1ed05d['id'];if(_0x17e98f[_0xbeee('0x2f')][_0xbeee('0x37')]){_0x154ac0['where']=_[_0xbeee('0x39')](_0x154ac0[_0xbeee('0x38')],{'$or':_[_0xbeee('0x2a')](_0x154ac0[_0xbeee('0x32')],function(_0x375786){var _0x4d2911={};_0x4d2911[_0x375786]={'$like':'%'+_0x17e98f[_0xbeee('0x2f')][_0xbeee('0x37')]+'%'};return _0x4d2911;})});}_0x154ac0=_[_0xbeee('0x39')]({},_0x154ac0,_0x17e98f['options']);return db[_0xbeee('0x53')][_0xbeee('0x57')](_0x154ac0);}})[_0xbeee('0x22')](function(_0x2c389e){if(_0x2c389e){return db[_0xbeee('0x58')][_0xbeee('0x59')]({'where':{'id':_['map'](_0x2c389e,'UserId'),'role':_0xbeee('0x5a')},'attributes':['id',_0xbeee('0x27'),_0xbeee('0x5b'),_0xbeee('0x5c'),_0xbeee('0x5d')]});}})['then'](function(_0x2bbb30){if(_0x2bbb30){return{'count':_0x2bbb30[_0xbeee('0x1c')],'rows':_[_0xbeee('0x2a')](_0x2bbb30[_0xbeee('0x3f')],function(_0x1b123c){return{'membername':_0x1b123c[_0xbeee('0x27')],'UserId':_0x1b123c['id'],'queue_name':_0x11c45b['name'],'FaxQueueId':_0x11c45b['id'],'interface':util[_0xbeee('0x5e')](_0xbeee('0x5f'),_0xbeee('0x60'),_0x1b123c['name']),'penalty':0x0,'paused':_0x1b123c[_0xbeee('0x5b')],'createdAt':_0x1b123c[_0xbeee('0x5d')],'updatedAt':_0x1b123c[_0xbeee('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbeee('0x22')](respondWithFilteredResult(_0x3bcdc9,_0x154ac0))['catch'](handleError(_0x3bcdc9,null));};exports['getTeams']=function(_0xf58d50,_0x5816ac,_0x2d0782){var _0x268e46={};var _0x2e1716={};var _0x530fc0;var _0x476f26;return db['FaxQueue'][_0xbeee('0x51')]({'where':{'id':_0xf58d50[_0xbeee('0x52')]['id']}})[_0xbeee('0x22')](handleEntityNotFound(_0x5816ac,null))[_0xbeee('0x22')](function(_0x276885){if(_0x276885){_0x530fc0=_0x276885;_0x2e1716['model']=_[_0xbeee('0x2e')](db[_0xbeee('0x61')]['rawAttributes']);_0x2e1716[_0xbeee('0x2f')]=_[_0xbeee('0x2e')](_0xf58d50[_0xbeee('0x2f')]);_0x2e1716[_0xbeee('0x30')]=_[_0xbeee('0x31')](_0x2e1716[_0xbeee('0x2d')],_0x2e1716['query']);_0x268e46['attributes']=_[_0xbeee('0x31')](_0x2e1716['model'],qs[_0xbeee('0x33')](_0xf58d50[_0xbeee('0x2f')]['fields']));_0x268e46[_0xbeee('0x32')]=_0x268e46[_0xbeee('0x32')][_0xbeee('0x42')]?_0x268e46[_0xbeee('0x32')]:_0x2e1716[_0xbeee('0x2d')];_0x268e46['order']=qs[_0xbeee('0x36')](_0xf58d50[_0xbeee('0x2f')][_0xbeee('0x36')]);_0x268e46['where']=qs[_0xbeee('0x30')](_[_0xbeee('0x55')](_0xf58d50[_0xbeee('0x2f')],_0x2e1716[_0xbeee('0x30')]));if(_0xf58d50[_0xbeee('0x2f')][_0xbeee('0x37')]){_0x268e46[_0xbeee('0x38')]=_['merge'](_0x268e46[_0xbeee('0x38')],{'$or':_[_0xbeee('0x2a')](_0x268e46[_0xbeee('0x32')],function(_0x509208){var _0x272c08={};_0x272c08[_0x509208]={'$like':'%'+_0xf58d50['query'][_0xbeee('0x37')]+'%'};return _0x272c08;})});}_0x268e46=_['merge']({},_0x268e46,_0xf58d50[_0xbeee('0x3c')]);return _0x530fc0[_0xbeee('0x62')](_0x268e46);}})[_0xbeee('0x22')](function(_0x10ac68){if(_0x10ac68){_0x476f26=_0x10ac68[_0xbeee('0x42')];if(!_0xf58d50[_0xbeee('0x2f')][_0xbeee('0x34')]('nolimit')){_0x268e46[_0xbeee('0x1e')]=qs[_0xbeee('0x1e')](_0xf58d50[_0xbeee('0x2f')][_0xbeee('0x1e')]);_0x268e46[_0xbeee('0x1d')]=qs[_0xbeee('0x1d')](_0xf58d50[_0xbeee('0x2f')]['offset']);}return _0x530fc0[_0xbeee('0x62')](_0x268e46);}})['then'](function(_0x1e4e6d){if(_0x1e4e6d){return _0x1e4e6d?{'count':_0x476f26,'rows':_0x1e4e6d}:null;}})[_0xbeee('0x22')](respondWithResult(_0x5816ac,null))['catch'](handleError(_0x5816ac,null));};exports[_0xbeee('0x63')]=function(_0x2cc52c,_0x36e224,_0x3313f2){var _0x5632fd=_0x2cc52c[_0xbeee('0x46')][_0xbeee('0x64')];return db[_0xbeee('0x61')]['findAll']({'where':{'id':_0x5632fd},'attributes':['id'],'include':[{'model':db[_0xbeee('0x58')],'as':'Agents','attributes':['id',_0xbeee('0x27'),_0xbeee('0x65'),_0xbeee('0x66'),_0xbeee('0x67')],'raw':!![]}]})[_0xbeee('0x22')](function(_0x320c0f){if(_0x320c0f){var _0x99693=_['flatMap'](_0x320c0f,function(_0x58288a){var _0x15ccde=_0x58288a[_0xbeee('0x24')]({'plain':!![]});return _0x15ccde[_0xbeee('0x68')];});return db[_0xbeee('0x3d')][_0xbeee('0x44')]({'where':{'id':_0x2cc52c[_0xbeee('0x52')]['id']}})['then'](function(_0x104d93){return db[_0xbeee('0x69')][_0xbeee('0x6a')](function(_0x439042){return _0x104d93[_0xbeee('0x63')](_0x5632fd,{'transaction':_0x439042})[_0xbeee('0x22')](function(){return BPromise[_0xbeee('0x6b')](_0x99693,function(_0x26d7df){return db['UserFaxQueue'][_0xbeee('0x6c')]({'where':{'UserId':_0x26d7df['id'],'FaxQueueId':_0x2cc52c[_0xbeee('0x52')]['id']},'transaction':_0x439042});});})['then'](function(){_0x99693[_0xbeee('0x6d')](function(_0x286092){socket['emit'](_0xbeee('0x6e'),{'UserId':_0x286092['id'],'FaxQueueId':_0x104d93['id']});});});});});}})[_0xbeee('0x22')](respondWithStatusCode(_0x36e224,null))[_0xbeee('0x40')](handleError(_0x36e224,null));};exports[_0xbeee('0x6f')]=function(_0x45a9e5,_0x52b2b2,_0x43f6e1){return db[_0xbeee('0x61')][_0xbeee('0x57')]({'where':{'id':_0x45a9e5[_0xbeee('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbeee('0x68'),'attributes':['id'],'raw':!![]}]})[_0xbeee('0x22')](handleEntityNotFound(_0x52b2b2,null))[_0xbeee('0x22')](function(_0x3a3c48){var _0x231375=_['map'](_0x3a3c48,'id');var _0x45dfda=[];var _0x108d73=[];var _0x2665d0=squel['select']();_0x2665d0[_0xbeee('0x70')](_0xbeee('0x71'))[_0xbeee('0x72')](_0xbeee('0x73'),'tq')['join'](_0xbeee('0x74'),'ut',_0xbeee('0x75'))[_0xbeee('0x38')]('FaxQueueId\x20=\x20?',_0x45a9e5[_0xbeee('0x52')]['id']);for(var _0x26aaaa=0x0;_0x26aaaa<_0x3a3c48[_0xbeee('0x42')];_0x26aaaa+=0x1){let _0x579ce2=_0x3a3c48[_0x26aaaa];for(var _0x514a8f=0x0;_0x514a8f<_0x579ce2[_0xbeee('0x68')][_0xbeee('0x42')];_0x514a8f+=0x1){let _0x14cf31=_0x579ce2['Agents'][_0x514a8f];var _0x426601=_0x2665d0[_0xbeee('0x76')]();_0x426601[_0xbeee('0x38')](_0xbeee('0x77'),_0x14cf31['id']);_0x108d73[_0xbeee('0x78')](db[_0xbeee('0x69')]['query'](_0x426601[_0xbeee('0x79')](),{'type':db[_0xbeee('0x69')][_0xbeee('0x7a')]['SELECT']})['then'](function(_0x6904c2){if(_0x6904c2['length']===0x1){return _0x14cf31['id'];}else{var _0x90443c=_[_0xbeee('0x7b')](_['map'](_0x6904c2,'TeamId'),function(_0x2dadc6){return _[_0xbeee('0x7c')](_0x231375,_0x2dadc6);});if(_0x90443c){return _0x14cf31['id'];}}}));}}return BPromise[_0xbeee('0x7d')](_0x108d73)[_0xbeee('0x22')](function(_0x1f7823){_0x45dfda=_(_0x45dfda)[_0xbeee('0x7e')](_0x1f7823)[_0xbeee('0x7f')]()['value']();return db[_0xbeee('0x3d')]['find']({'where':{'id':_0x45a9e5[_0xbeee('0x52')]['id']}})[_0xbeee('0x22')](function(_0x44b0eb){return db['sequelize'][_0xbeee('0x6a')](function(_0x1530f2){return _0x44b0eb[_0xbeee('0x6f')](_0x45a9e5[_0xbeee('0x2f')][_0xbeee('0x64')],{'transaction':_0x1530f2})['then'](function(){if(!_[_0xbeee('0x80')](_0x45dfda)){return _0x44b0eb[_0xbeee('0x81')](_0x45dfda,{'transaction':_0x1530f2});}})['then'](function(){_0x45dfda[_0xbeee('0x6d')](function(_0x3ae423){socket[_0xbeee('0x82')](_0xbeee('0x83'),{'UserId':_0x3ae423,'FaxQueueId':_0x44b0eb['id']});});});});});});})[_0xbeee('0x22')](respondWithStatusCode(_0x52b2b2,null))['catch'](handleError(_0x52b2b2,null));};exports[_0xbeee('0x84')]=function(_0x3e38c0,_0x1d8078,_0x474464){return db[_0xbeee('0x3d')][_0xbeee('0x44')]({'where':{'id':_0x3e38c0[_0xbeee('0x52')]['id']}})['then'](handleEntityNotFound(_0x1d8078,null))[_0xbeee('0x22')](function(_0x594f7b){if(_0x594f7b){return _0x594f7b[_0xbeee('0x84')](_0x3e38c0[_0xbeee('0x46')]['ids'],_[_0xbeee('0x85')](_0x3e38c0[_0xbeee('0x46')],[_0xbeee('0x64'),'id'])||{})[_0xbeee('0x86')](function(_0x18bc14){for(var _0x2e04bb=0x0;_0x2e04bb<_0x3e38c0[_0xbeee('0x46')][_0xbeee('0x64')][_0xbeee('0x42')];_0x2e04bb+=0x1){socket[_0xbeee('0x82')](_0xbeee('0x6e'),{'UserId':_0x3e38c0[_0xbeee('0x46')]['ids'][_0x2e04bb],'FaxQueueId':_0x3e38c0[_0xbeee('0x52')]['id']});}return _0x18bc14;});}})['then'](respondWithResult(_0x1d8078,null))[_0xbeee('0x40')](handleError(_0x1d8078,null));};exports[_0xbeee('0x81')]=function(_0xab08eb,_0x119bb3,_0xb4e81){return db['FaxQueue'][_0xbeee('0x44')]({'where':{'id':_0xab08eb[_0xbeee('0x52')]['id']}})['then'](handleEntityNotFound(_0x119bb3,null))[_0xbeee('0x22')](function(_0x3bbaf1){if(_0x3bbaf1){return _0x3bbaf1[_0xbeee('0x81')](_0xab08eb['query'][_0xbeee('0x64')])[_0xbeee('0x22')](function(){if(_[_0xbeee('0x87')](_0xab08eb[_0xbeee('0x2f')]['ids'])){for(var _0x3ed4d1=0x0;_0x3ed4d1<_0xab08eb[_0xbeee('0x2f')][_0xbeee('0x64')]['length'];_0x3ed4d1+=0x1){socket[_0xbeee('0x82')]('userFaxQueue:remove',{'UserId':Number(_0xab08eb[_0xbeee('0x2f')][_0xbeee('0x64')][_0x3ed4d1]),'FaxQueueId':Number(_0xab08eb[_0xbeee('0x52')]['id'])});}}else{socket[_0xbeee('0x82')](_0xbeee('0x83'),{'UserId':Number(_0xab08eb[_0xbeee('0x2f')][_0xbeee('0x64')]),'FaxQueueId':Number(_0xab08eb[_0xbeee('0x52')]['id'])});}});}})[_0xbeee('0x22')](respondWithStatusCode(_0x119bb3,null))['catch'](handleError(_0x119bb3,null));};exports[_0xbeee('0x88')]=function(_0x7e17aa,_0x4359cd,_0x34550b){var _0x2360c5={};var _0xf17688={};var _0x2cd8bd;var _0x142725;return db['FaxQueue'][_0xbeee('0x51')]({'where':{'id':_0x7e17aa['params']['id']}})['then'](handleEntityNotFound(_0x4359cd,null))[_0xbeee('0x22')](function(_0x30494c){if(_0x30494c){_0x2cd8bd=_0x30494c;_0xf17688[_0xbeee('0x2d')]=_[_0xbeee('0x2e')](db['User'][_0xbeee('0x2b')]);_0xf17688[_0xbeee('0x2f')]=_[_0xbeee('0x2e')](_0x7e17aa[_0xbeee('0x2f')]);_0xf17688[_0xbeee('0x30')]=_[_0xbeee('0x31')](_0xf17688['model'],_0xf17688[_0xbeee('0x2f')]);_0x2360c5[_0xbeee('0x32')]=_[_0xbeee('0x31')](_0xf17688[_0xbeee('0x2d')],qs[_0xbeee('0x33')](_0x7e17aa[_0xbeee('0x2f')][_0xbeee('0x33')]));_0x2360c5[_0xbeee('0x32')]=_0x2360c5[_0xbeee('0x32')]['length']?_0x2360c5[_0xbeee('0x32')]:_0xf17688[_0xbeee('0x2d')];_0x2360c5[_0xbeee('0x35')]=qs[_0xbeee('0x36')](_0x7e17aa[_0xbeee('0x2f')][_0xbeee('0x36')]);_0x2360c5[_0xbeee('0x38')]=qs[_0xbeee('0x30')](_['pick'](_0x7e17aa['query'],_0xf17688[_0xbeee('0x30')]));if(_0x7e17aa[_0xbeee('0x2f')][_0xbeee('0x37')]){_0x2360c5[_0xbeee('0x38')]=_[_0xbeee('0x39')](_0x2360c5[_0xbeee('0x38')],{'$or':_[_0xbeee('0x2a')](_0x2360c5[_0xbeee('0x32')],function(_0x46b9b9){var _0x173e46={};_0x173e46[_0x46b9b9]={'$like':'%'+_0x7e17aa[_0xbeee('0x2f')]['filter']+'%'};return _0x173e46;})});}_0x2360c5=_[_0xbeee('0x39')]({},_0x2360c5,_0x7e17aa[_0xbeee('0x3c')]);return _0x2cd8bd[_0xbeee('0x88')](_0x2360c5);}})[_0xbeee('0x22')](function(_0x495357){if(_0x495357){_0x142725=_0x495357[_0xbeee('0x42')];if(!_0x7e17aa[_0xbeee('0x2f')][_0xbeee('0x34')](_0xbeee('0x54'))){_0x2360c5[_0xbeee('0x1e')]=qs[_0xbeee('0x1e')](_0x7e17aa[_0xbeee('0x2f')][_0xbeee('0x1e')]);_0x2360c5[_0xbeee('0x1d')]=qs['offset'](_0x7e17aa[_0xbeee('0x2f')]['offset']);}return _0x2cd8bd[_0xbeee('0x88')](_0x2360c5);}})[_0xbeee('0x22')](function(_0x21bac4){if(_0x21bac4){return _0x21bac4?{'count':_0x142725,'rows':_0x21bac4}:null;}})['then'](respondWithResult(_0x4359cd,null))[_0xbeee('0x40')](handleError(_0x4359cd,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 24e556d..2aca9f8 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 _0xdd56=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x486f48,_0x23528f){var _0x5668eb=function(_0x1b570f){while(--_0x1b570f){_0x486f48['push'](_0x486f48['shift']());}};_0x5668eb(++_0x23528f);}(_0xdd56,0xc9));var _0x6dd5=function(_0x1baecc,_0x38bce1){_0x1baecc=_0x1baecc-0x0;var _0x4ab1d1=_0xdd56[_0x1baecc];return _0x4ab1d1;};'use strict';var EventEmitter=require(_0x6dd5('0x0'));var FaxQueue=require(_0x6dd5('0x1'))['db'][_0x6dd5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6dd5('0x3')](0x0);var events={'afterCreate':_0x6dd5('0x4'),'afterUpdate':_0x6dd5('0x5'),'afterDestroy':_0x6dd5('0x6')};function emitEvent(_0x53c44f){return function(_0x5254bc,_0x187b3a,_0x37dac5){FaxQueueEvents[_0x6dd5('0x7')](_0x53c44f+':'+_0x5254bc['id'],_0x5254bc);FaxQueueEvents[_0x6dd5('0x7')](_0x53c44f,_0x5254bc);_0x37dac5(null);};}for(var e in events){if(events[_0x6dd5('0x8')](e)){var event=events[e];FaxQueue[_0x6dd5('0x9')](e,emitEvent(event));}}module[_0x6dd5('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0x3bda=['update','remove','emit','hook','events','../../mysqldb','FaxQueue','save'];(function(_0x2bf1d6,_0x410efd){var _0x1be08a=function(_0x39c3a2){while(--_0x39c3a2){_0x2bf1d6['push'](_0x2bf1d6['shift']());}};_0x1be08a(++_0x410efd);}(_0x3bda,0x13c));var _0xa3bd=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x3bda[_0xda464c];return _0x19e222;};'use strict';var EventEmitter=require(_0xa3bd('0x0'));var FaxQueue=require(_0xa3bd('0x1'))['db'][_0xa3bd('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa3bd('0x3'),'afterUpdate':_0xa3bd('0x4'),'afterDestroy':_0xa3bd('0x5')};function emitEvent(_0x2a49b4){return function(_0x5502fa,_0x1f834b,_0x5008df){FaxQueueEvents[_0xa3bd('0x6')](_0x2a49b4+':'+_0x5502fa['id'],_0x5502fa);FaxQueueEvents[_0xa3bd('0x6')](_0x2a49b4,_0x5502fa);_0x5008df(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xa3bd('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d5a5114..676a608 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 _0x5b46=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x2a4b4a,_0xc869f0){var _0x1d4bc2=function(_0x24392e){while(--_0x24392e){_0x2a4b4a['push'](_0x2a4b4a['shift']());}};_0x1d4bc2(++_0xc869f0);}(_0x5b46,0x1f1));var _0x65b4=function(_0xb35802,_0xa3d53f){_0xb35802=_0xb35802-0x0;var _0x11e6a3=_0x5b46[_0xb35802];return _0x11e6a3;};'use strict';var _=require(_0x65b4('0x0'));var util=require(_0x65b4('0x1'));var logger=require(_0x65b4('0x2'))(_0x65b4('0x3'));var moment=require(_0x65b4('0x4'));var BPromise=require(_0x65b4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x65b4('0x6'));var config=require(_0x65b4('0x7'));var attributes=require(_0x65b4('0x8'));module[_0x65b4('0x9')]=function(_0x4929a0,_0x4d3deb){return _0x4929a0[_0x65b4('0xa')](_0x65b4('0xb'),attributes,{'tableName':_0x65b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cc1=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util'];(function(_0xe2c6e0,_0x1bab13){var _0x2a0e10=function(_0x4dfd5f){while(--_0x4dfd5f){_0xe2c6e0['push'](_0xe2c6e0['shift']());}};_0x2a0e10(++_0x1bab13);}(_0x1cc1,0x9a));var _0x11cc=function(_0xee4e35,_0x250540){_0xee4e35=_0xee4e35-0x0;var _0x4d52dd=_0x1cc1[_0xee4e35];return _0x4d52dd;};'use strict';var _=require(_0x11cc('0x0'));var util=require(_0x11cc('0x1'));var logger=require(_0x11cc('0x2'))(_0x11cc('0x3'));var moment=require('moment');var BPromise=require(_0x11cc('0x4'));var rp=require(_0x11cc('0x5'));var fs=require('fs');var path=require(_0x11cc('0x6'));var rimraf=require(_0x11cc('0x7'));var config=require(_0x11cc('0x8'));var attributes=require(_0x11cc('0x9'));module[_0x11cc('0xa')]=function(_0x22eab8,_0x16cb52){return _0x22eab8[_0x11cc('0xb')]('FaxQueue',attributes,{'tableName':_0x11cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 51e1130..428030c 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 _0x597b=['stringify','code','error','message','FaxQueue,\x20%s,\x20%s','info','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowFaxQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','request','then','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x89f89e,_0x5cbab5){var _0x1a9625=function(_0xc86b16){while(--_0xc86b16){_0x89f89e['push'](_0x89f89e['shift']());}};_0x1a9625(++_0x5cbab5);}(_0x597b,0x1d8));var _0xb597=function(_0xe278b9,_0x551708){_0xe278b9=_0xe278b9-0x0;var _0x2609a9=_0x597b[_0xe278b9];return _0x2609a9;};'use strict';var _=require(_0xb597('0x0'));var util=require(_0xb597('0x1'));var moment=require('moment');var BPromise=require(_0xb597('0x2'));var rs=require(_0xb597('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb597('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb597('0x5'))(_0xb597('0x6'));var config=require(_0xb597('0x7'));var jayson=require(_0xb597('0x8'));var client=jayson[_0xb597('0x9')][_0xb597('0xa')]({'port':0x232a});config['redis']=_[_0xb597('0xb')](config[_0xb597('0xc')],{'host':_0xb597('0xd'),'port':0x18eb});var socket=require(_0xb597('0xe'))(new Redis(config[_0xb597('0xc')]));require(_0xb597('0xf'))['register'](socket);function respondWithRpcPromise(_0xe1336c,_0x1e526d,_0x9fd7f7){return new BPromise(function(_0x38a790,_0x47e44c){return client[_0xb597('0x10')](_0xe1336c,_0x9fd7f7)[_0xb597('0x11')](function(_0x5df99e){logger['info']('FaxQueue,\x20%s,\x20%s',_0x1e526d,_0xb597('0x12'));logger['debug'](_0xb597('0x13'),_0x1e526d,_0xb597('0x12'),JSON[_0xb597('0x14')](_0x5df99e));if(_0x5df99e['error']){if(_0x5df99e['error'][_0xb597('0x15')]===0x1f4){logger[_0xb597('0x16')]('FaxQueue,\x20%s,\x20%s',_0x1e526d,_0x5df99e[_0xb597('0x16')][_0xb597('0x17')]);return _0x47e44c(_0x5df99e[_0xb597('0x16')][_0xb597('0x17')]);}logger[_0xb597('0x16')](_0xb597('0x18'),_0x1e526d,_0x5df99e[_0xb597('0x16')][_0xb597('0x17')]);return _0x38a790(_0x5df99e[_0xb597('0x16')]['message']);}else{logger[_0xb597('0x19')]('FaxQueue,\x20%s,\x20%s',_0x1e526d,_0xb597('0x12'));_0x38a790(_0x5df99e[_0xb597('0x1a')][_0xb597('0x17')]);}})[_0xb597('0x1b')](function(_0x3a911f){logger[_0xb597('0x16')](_0xb597('0x18'),_0x1e526d,_0x3a911f);_0x47e44c(_0x3a911f);});});}exports[_0xb597('0x1c')]=function(_0x4caf49){var _0x4be26d=this;return new Promise(function(_0x32fae4,_0xe4718e){return db['FaxQueue'][_0xb597('0x1d')]({'raw':_0x4caf49[_0xb597('0x1e')]?_0x4caf49['options'][_0xb597('0x1f')]===undefined?!![]:![]:!![],'where':_0x4caf49[_0xb597('0x1e')]?_0x4caf49[_0xb597('0x1e')][_0xb597('0x20')]||null:null,'attributes':_0x4caf49[_0xb597('0x1e')]?_0x4caf49['options'][_0xb597('0x21')]||null:null,'limit':_0x4caf49[_0xb597('0x1e')]?_0x4caf49['options'][_0xb597('0x22')]||null:null,'include':_0x4caf49['options']?_0x4caf49[_0xb597('0x1e')][_0xb597('0x23')]?_[_0xb597('0x24')](_0x4caf49[_0xb597('0x1e')][_0xb597('0x23')],function(_0x3f033f){return{'model':db[_0x3f033f[_0xb597('0x25')]],'as':_0x3f033f['as'],'attributes':_0x3f033f[_0xb597('0x21')],'include':_0x3f033f[_0xb597('0x23')]?_[_0xb597('0x24')](_0x3f033f[_0xb597('0x23')],function(_0x38f16f){return{'model':db[_0x38f16f[_0xb597('0x25')]],'as':_0x38f16f['as'],'attributes':_0x38f16f[_0xb597('0x21')],'include':_0x38f16f[_0xb597('0x23')]?_[_0xb597('0x24')](_0x38f16f['include'],function(_0x2e131b){return{'model':db[_0x2e131b[_0xb597('0x25')]],'as':_0x2e131b['as'],'attributes':_0x2e131b['attributes']};}):[]};}):[]};}):[]:[]})[_0xb597('0x11')](function(_0x42e7e4){logger[_0xb597('0x19')](_0xb597('0x1c'),_0x4caf49);logger[_0xb597('0x26')](_0xb597('0x1c'),_0x4caf49,JSON['stringify'](_0x42e7e4));_0x32fae4(_0x42e7e4);})[_0xb597('0x1b')](function(_0x5c7308){logger['error']('GetFaxQueue',_0x5c7308[_0xb597('0x17')],_0x4caf49);_0xe4718e(_0x4be26d[_0xb597('0x16')](0x1f4,_0x5c7308[_0xb597('0x17')]));});});};exports[_0xb597('0x27')]=function(_0x541f81){var _0xb32346=this;return new Promise(function(_0x8472e9,_0x3dad86){return db['FaxQueue'][_0xb597('0x28')]({'raw':_0x541f81[_0xb597('0x1e')]?_0x541f81[_0xb597('0x1e')][_0xb597('0x1f')]===undefined?!![]:![]:!![],'where':_0x541f81[_0xb597('0x1e')]?_0x541f81[_0xb597('0x1e')][_0xb597('0x20')]||null:null,'attributes':_0x541f81[_0xb597('0x1e')]?_0x541f81['options'][_0xb597('0x21')]||null:null,'include':_0x541f81['options']?_0x541f81[_0xb597('0x1e')][_0xb597('0x23')]?_[_0xb597('0x24')](_0x541f81[_0xb597('0x1e')][_0xb597('0x23')],function(_0x467ddb){return{'model':db[_0x467ddb[_0xb597('0x25')]],'as':_0x467ddb['as'],'attributes':_0x467ddb[_0xb597('0x21')],'include':_0x467ddb[_0xb597('0x23')]?_['map'](_0x467ddb['include'],function(_0x34a565){return{'model':db[_0x34a565[_0xb597('0x25')]],'as':_0x34a565['as'],'attributes':_0x34a565[_0xb597('0x21')],'include':_0x34a565[_0xb597('0x23')]?_[_0xb597('0x24')](_0x34a565[_0xb597('0x23')],function(_0x4922ae){return{'model':db[_0x4922ae['model']],'as':_0x4922ae['as'],'attributes':_0x4922ae[_0xb597('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb597('0x11')](function(_0x4ccb84){logger[_0xb597('0x19')]('ShowFaxQueue',_0x541f81);logger[_0xb597('0x26')](_0xb597('0x27'),_0x541f81,JSON[_0xb597('0x14')](_0x4ccb84));_0x8472e9(_0x4ccb84);})[_0xb597('0x1b')](function(_0x149062){logger[_0xb597('0x16')](_0xb597('0x27'),_0x149062[_0xb597('0x17')],_0x541f81);_0x3dad86(_0xb32346[_0xb597('0x16')](0x1f4,_0x149062[_0xb597('0x17')]));});});}; \ No newline at end of file +var _0x0f3c=['../../config/environment','client','redis','defaults','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowFaxQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x25859c,_0x5d7375){var _0x59a306=function(_0x2ed4d4){while(--_0x2ed4d4){_0x25859c['push'](_0x25859c['shift']());}};_0x59a306(++_0x5d7375);}(_0x0f3c,0x91));var _0xc0f3=function(_0x4b90ac,_0x1fa2f6){_0x4b90ac=_0x4b90ac-0x0;var _0x32c1e6=_0x0f3c[_0x4b90ac];return _0x32c1e6;};'use strict';var _=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var moment=require('moment');var BPromise=require(_0xc0f3('0x2'));var rs=require(_0xc0f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0f3('0x4'))['db'];var utils=require(_0xc0f3('0x5'));var logger=require('../../config/logger')(_0xc0f3('0x6'));var config=require(_0xc0f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc0f3('0x8')]['http']({'port':0x232a});config[_0xc0f3('0x9')]=_[_0xc0f3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc0f3('0xb'))(new Redis(config['redis']));require(_0xc0f3('0xc'))[_0xc0f3('0xd')](socket);function respondWithRpcPromise(_0x27a7e2,_0x49959e,_0x508694){return new BPromise(function(_0x46a554,_0x5c6947){return client['request'](_0x27a7e2,_0x508694)[_0xc0f3('0xe')](function(_0x5950f3){logger[_0xc0f3('0xf')](_0xc0f3('0x10'),_0x49959e,_0xc0f3('0x11'));logger[_0xc0f3('0x12')](_0xc0f3('0x13'),_0x49959e,_0xc0f3('0x11'),JSON['stringify'](_0x5950f3));if(_0x5950f3[_0xc0f3('0x14')]){if(_0x5950f3[_0xc0f3('0x14')][_0xc0f3('0x15')]===0x1f4){logger[_0xc0f3('0x14')](_0xc0f3('0x10'),_0x49959e,_0x5950f3[_0xc0f3('0x14')][_0xc0f3('0x16')]);return _0x5c6947(_0x5950f3[_0xc0f3('0x14')][_0xc0f3('0x16')]);}logger[_0xc0f3('0x14')](_0xc0f3('0x10'),_0x49959e,_0x5950f3['error'][_0xc0f3('0x16')]);return _0x46a554(_0x5950f3['error']['message']);}else{logger[_0xc0f3('0xf')](_0xc0f3('0x10'),_0x49959e,_0xc0f3('0x11'));_0x46a554(_0x5950f3['result'][_0xc0f3('0x16')]);}})[_0xc0f3('0x17')](function(_0x302595){logger['error'](_0xc0f3('0x10'),_0x49959e,_0x302595);_0x5c6947(_0x302595);});});}exports[_0xc0f3('0x18')]=function(_0x4beae0){var _0x212698=this;return new Promise(function(_0xcff27,_0x49d47e){return db[_0xc0f3('0x19')][_0xc0f3('0x1a')]({'raw':_0x4beae0[_0xc0f3('0x1b')]?_0x4beae0[_0xc0f3('0x1b')][_0xc0f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x4beae0[_0xc0f3('0x1b')]?_0x4beae0['options'][_0xc0f3('0x1d')]||null:null,'attributes':_0x4beae0[_0xc0f3('0x1b')]?_0x4beae0[_0xc0f3('0x1b')][_0xc0f3('0x1e')]||null:null,'limit':_0x4beae0[_0xc0f3('0x1b')]?_0x4beae0['options'][_0xc0f3('0x1f')]||null:null,'include':_0x4beae0[_0xc0f3('0x1b')]?_0x4beae0['options'][_0xc0f3('0x20')]?_['map'](_0x4beae0[_0xc0f3('0x1b')][_0xc0f3('0x20')],function(_0x2b5337){return{'model':db[_0x2b5337['model']],'as':_0x2b5337['as'],'attributes':_0x2b5337[_0xc0f3('0x1e')],'include':_0x2b5337[_0xc0f3('0x20')]?_['map'](_0x2b5337[_0xc0f3('0x20')],function(_0x5a0a95){return{'model':db[_0x5a0a95[_0xc0f3('0x21')]],'as':_0x5a0a95['as'],'attributes':_0x5a0a95['attributes'],'include':_0x5a0a95[_0xc0f3('0x20')]?_[_0xc0f3('0x22')](_0x5a0a95['include'],function(_0x180865){return{'model':db[_0x180865[_0xc0f3('0x21')]],'as':_0x180865['as'],'attributes':_0x180865[_0xc0f3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31711f){logger[_0xc0f3('0xf')](_0xc0f3('0x18'),_0x4beae0);logger[_0xc0f3('0x12')](_0xc0f3('0x18'),_0x4beae0,JSON[_0xc0f3('0x23')](_0x31711f));_0xcff27(_0x31711f);})[_0xc0f3('0x17')](function(_0x506b8b){logger['error'](_0xc0f3('0x18'),_0x506b8b[_0xc0f3('0x16')],_0x4beae0);_0x49d47e(_0x212698[_0xc0f3('0x14')](0x1f4,_0x506b8b[_0xc0f3('0x16')]));});});};exports[_0xc0f3('0x24')]=function(_0x1ca053){var _0xc499c1=this;return new Promise(function(_0x364091,_0x7849b1){return db['FaxQueue'][_0xc0f3('0x25')]({'raw':_0x1ca053[_0xc0f3('0x1b')]?_0x1ca053[_0xc0f3('0x1b')][_0xc0f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ca053[_0xc0f3('0x1b')]?_0x1ca053[_0xc0f3('0x1b')][_0xc0f3('0x1d')]||null:null,'attributes':_0x1ca053['options']?_0x1ca053[_0xc0f3('0x1b')][_0xc0f3('0x1e')]||null:null,'include':_0x1ca053[_0xc0f3('0x1b')]?_0x1ca053['options'][_0xc0f3('0x20')]?_[_0xc0f3('0x22')](_0x1ca053[_0xc0f3('0x1b')]['include'],function(_0x1298e9){return{'model':db[_0x1298e9[_0xc0f3('0x21')]],'as':_0x1298e9['as'],'attributes':_0x1298e9[_0xc0f3('0x1e')],'include':_0x1298e9['include']?_['map'](_0x1298e9[_0xc0f3('0x20')],function(_0x4a1d06){return{'model':db[_0x4a1d06[_0xc0f3('0x21')]],'as':_0x4a1d06['as'],'attributes':_0x4a1d06[_0xc0f3('0x1e')],'include':_0x4a1d06[_0xc0f3('0x20')]?_['map'](_0x4a1d06['include'],function(_0xedc01){return{'model':db[_0xedc01['model']],'as':_0xedc01['as'],'attributes':_0xedc01[_0xc0f3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc0f3('0xe')](function(_0x5865a5){logger['info']('ShowFaxQueue',_0x1ca053);logger[_0xc0f3('0x12')]('ShowFaxQueue',_0x1ca053,JSON[_0xc0f3('0x23')](_0x5865a5));_0x364091(_0x5865a5);})[_0xc0f3('0x17')](function(_0x409133){logger[_0xc0f3('0x14')](_0xc0f3('0x24'),_0x409133[_0xc0f3('0x16')],_0x1ca053);_0x7849b1(_0xc499c1[_0xc0f3('0x14')](0x1f4,_0x409133[_0xc0f3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index a1ebf04..cfe4e1e 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 _0xf8b2=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf8b2,0x1a9));var _0x2f8b=function(_0x149225,_0x5869e2){_0x149225=_0x149225-0x0;var _0x21e6ac=_0xf8b2[_0x149225];return _0x21e6ac;};'use strict';var FaxQueueEvents=require(_0x2f8b('0x0'));var events=[_0x2f8b('0x1'),_0x2f8b('0x2'),_0x2f8b('0x3')];function createListener(_0x5714ba,_0x4dfef5){return function(_0x1a593a){_0x4dfef5[_0x2f8b('0x4')](_0x5714ba,_0x1a593a);};}function removeListener(_0x2f325f,_0x23e3df){return function(){FaxQueueEvents[_0x2f8b('0x5')](_0x2f325f,_0x23e3df);};}exports[_0x2f8b('0x6')]=function(_0x5075a8){for(var _0xc9accf=0x0,_0x2b210d=events[_0x2f8b('0x7')];_0xc9accf<_0x2b210d;_0xc9accf++){var _0x525e2e=events[_0xc9accf];var _0x36d6a6=createListener(_0x2f8b('0x8')+_0x525e2e,_0x5075a8);FaxQueueEvents['on'](_0x525e2e,_0x36d6a6);}}; \ No newline at end of file +var _0xb127=['./faxQueue.events','save','emit','removeListener','length','faxQueue:'];(function(_0x1b7285,_0x2fe93c){var _0x54abf5=function(_0x51f56c){while(--_0x51f56c){_0x1b7285['push'](_0x1b7285['shift']());}};_0x54abf5(++_0x2fe93c);}(_0xb127,0x7e));var _0x7b12=function(_0x477558,_0x16da52){_0x477558=_0x477558-0x0;var _0x234e84=_0xb127[_0x477558];return _0x234e84;};'use strict';var FaxQueueEvents=require(_0x7b12('0x0'));var events=[_0x7b12('0x1'),'remove','update'];function createListener(_0x2306a1,_0x25bf81){return function(_0x29c4f4){_0x25bf81[_0x7b12('0x2')](_0x2306a1,_0x29c4f4);};}function removeListener(_0x3be353,_0x4b18a8){return function(){FaxQueueEvents[_0x7b12('0x3')](_0x3be353,_0x4b18a8);};}exports['register']=function(_0x14317b){for(var _0x55f778=0x0,_0x5d60cd=events[_0x7b12('0x4')];_0x55f778<_0x5d60cd;_0x55f778++){var _0x3c368=events[_0x55f778];var _0x1e752d=createListener(_0x7b12('0x5')+_0x3c368,_0x14317b);FaxQueueEvents['on'](_0x3c368,_0x1e752d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index f802c4d..237c021 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20e764,_0x19811d){_0x20e764=_0x20e764-0x0;var _0x4ebc22=_0x0b0e[_0x20e764];return _0x4ebc22;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file +var _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(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b6ccc,_0x146dc3){_0x4b6ccc=_0x4b6ccc-0x0;var _0x15e250=_0xb10b[_0x4b6ccc];return _0x15e250;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 9916ae8..a865a8b 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 _0x0917=['STRING','DATE','moment','exports'];(function(_0x2b37b5,_0x4f677b){var _0x36df6d=function(_0x501dc7){while(--_0x501dc7){_0x2b37b5['push'](_0x2b37b5['shift']());}};_0x36df6d(++_0x4f677b);}(_0x0917,0x17e));var _0x7091=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0x0917[_0x448f8];return _0xa73126;};'use strict';var moment=require(_0x7091('0x0'));var Sequelize=require('sequelize');module[_0x7091('0x1')]={'uniqueid':{'type':Sequelize[_0x7091('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7091('0x2')]},'joinAt':{'type':Sequelize[_0x7091('0x3')]},'leaveAt':{'type':Sequelize[_0x7091('0x3')]},'acceptAt':{'type':Sequelize[_0x7091('0x3')]},'exitAt':{'type':Sequelize[_0x7091('0x3')]},'reason':{'type':Sequelize[_0x7091('0x2')]}}; \ No newline at end of file +var _0x5b39=['sequelize','exports','STRING','DATE'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5b39,0x1f4));var _0x95b3=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x5b39[_0x474bc0];return _0x4b24cf;};'use strict';var moment=require('moment');var Sequelize=require(_0x95b3('0x0'));module[_0x95b3('0x1')]={'uniqueid':{'type':Sequelize[_0x95b3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x95b3('0x2')]},'joinAt':{'type':Sequelize[_0x95b3('0x3')]},'leaveAt':{'type':Sequelize[_0x95b3('0x3')]},'acceptAt':{'type':Sequelize[_0x95b3('0x3')]},'exitAt':{'type':Sequelize[_0x95b3('0x3')]},'reason':{'type':Sequelize[_0x95b3('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8fa5791..7c51328 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 _0x4bbf=['describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','FaxQueueReport','includeAll','include','rows','catch','show','params','create','body','find'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4bbf,0x139));var _0xf4bb=function(_0x45543b,_0x56411d){_0x45543b=_0x45543b-0x0;var _0x492993=_0x4bbf[_0x45543b];return _0x492993;};'use strict';var pdf=require(_0xf4bb('0x0'));var emlformat=require(_0xf4bb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf4bb('0x2'));var jsonpatch=require(_0xf4bb('0x3'));var rp=require(_0xf4bb('0x4'));var moment=require(_0xf4bb('0x5'));var BPromise=require(_0xf4bb('0x6'));var Mustache=require(_0xf4bb('0x7'));var util=require(_0xf4bb('0x8'));var path=require(_0xf4bb('0x9'));var sox=require(_0xf4bb('0xa'));var csv=require(_0xf4bb('0xb'));var ejs=require(_0xf4bb('0xc'));var fs=require('fs');var _=require(_0xf4bb('0xd'));var squel=require(_0xf4bb('0xe'));var crypto=require(_0xf4bb('0xf'));var jsforce=require(_0xf4bb('0x10'));var deskjs=require(_0xf4bb('0x11'));var toCsv=require(_0xf4bb('0xb'));var querystring=require('querystring');var Papa=require(_0xf4bb('0x12'));var Redis=require('ioredis');var authService=require(_0xf4bb('0x13'));var qs=require(_0xf4bb('0x14'));var as=require(_0xf4bb('0x15'));var hardwareService=require(_0xf4bb('0x16'));var logger=require(_0xf4bb('0x17'))(_0xf4bb('0x18'));var utils=require(_0xf4bb('0x19'));var config=require(_0xf4bb('0x1a'));var db=require(_0xf4bb('0x1b'))['db'];function respondWithStatusCode(_0x2cd510,_0x9e7440){_0x9e7440=_0x9e7440||0xcc;return function(_0x4ae835){if(_0x4ae835){return _0x2cd510[_0xf4bb('0x1c')](_0x9e7440);}return _0x2cd510[_0xf4bb('0x1d')](_0x9e7440)[_0xf4bb('0x1e')]();};}function respondWithResult(_0x20a6ff,_0x376880){_0x376880=_0x376880||0xc8;return function(_0x486193){if(_0x486193){return _0x20a6ff[_0xf4bb('0x1d')](_0x376880)['json'](_0x486193);}};}function respondWithFilteredResult(_0x3ba39d,_0x291b6b){return function(_0x110632){if(_0x110632){var _0x5264fc=_0x110632[_0xf4bb('0x1f')],_0x16cc39=_0x291b6b[_0xf4bb('0x20')],_0x9d7c33=_0x291b6b[_0xf4bb('0x20')]+_0x291b6b[_0xf4bb('0x21')],_0x5024f4;if(_0x9d7c33>=_0x5264fc){_0x9d7c33=_0x5264fc;_0x5024f4=0xc8;}else{_0x5024f4=0xce;}_0x3ba39d[_0xf4bb('0x1d')](_0x5024f4);return _0x3ba39d[_0xf4bb('0x22')](_0xf4bb('0x23'),_0x16cc39+'-'+_0x9d7c33+'/'+_0x5264fc)[_0xf4bb('0x24')](_0x110632);}return null;};}function patchUpdates(_0x3b5913){return function(_0x5e8fdf){try{jsonpatch[_0xf4bb('0x25')](_0x5e8fdf,_0x3b5913,!![]);}catch(_0x2813fb){return BPromise[_0xf4bb('0x26')](_0x2813fb);}return _0x5e8fdf['save']();};}function saveUpdates(_0x509a64,_0x348ce2){return function(_0x36dfc2){if(_0x36dfc2){return _0x36dfc2[_0xf4bb('0x27')](_0x509a64)[_0xf4bb('0x28')](function(_0x4245b4){return _0x4245b4;});}return null;};}function removeEntity(_0x2f21ea,_0xc91a92){return function(_0x3c4808){if(_0x3c4808){return _0x3c4808['destroy']()['then'](function(){_0x2f21ea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x68e997,_0x17dc1d){return function(_0x31e2ef){if(!_0x31e2ef){_0x68e997[_0xf4bb('0x1c')](0x194);}return _0x31e2ef;};}function handleError(_0x35fe96,_0x7df78c){_0x7df78c=_0x7df78c||0x1f4;return function(_0x8b95a2){logger[_0xf4bb('0x29')](_0x8b95a2[_0xf4bb('0x2a')]);if(_0x8b95a2['name']){delete _0x8b95a2[_0xf4bb('0x2b')];}_0x35fe96['status'](_0x7df78c)[_0xf4bb('0x2c')](_0x8b95a2);};}exports[_0xf4bb('0x2d')]=function(_0x432d27,_0x498880){var _0x30b9dd={},_0x40d0e3={},_0x136583={'count':0x0,'rows':[]};var _0x5658d0=_[_0xf4bb('0x2e')](db['FaxQueueReport'][_0xf4bb('0x2f')],function(_0x2dc27a){return{'name':_0x2dc27a[_0xf4bb('0x30')],'type':_0x2dc27a[_0xf4bb('0x31')][_0xf4bb('0x32')]};});_0x40d0e3[_0xf4bb('0x33')]=_['map'](_0x5658d0,_0xf4bb('0x2b'));_0x40d0e3[_0xf4bb('0x34')]=_[_0xf4bb('0x35')](_0x432d27[_0xf4bb('0x34')]);_0x40d0e3['filters']=_[_0xf4bb('0x36')](_0x40d0e3[_0xf4bb('0x33')],_0x40d0e3[_0xf4bb('0x34')]);_0x30b9dd['attributes']=_[_0xf4bb('0x36')](_0x40d0e3[_0xf4bb('0x33')],qs[_0xf4bb('0x37')](_0x432d27['query'][_0xf4bb('0x37')]));_0x30b9dd['attributes']=_0x30b9dd[_0xf4bb('0x38')][_0xf4bb('0x39')]?_0x30b9dd[_0xf4bb('0x38')]:_0x40d0e3[_0xf4bb('0x33')];if(!_0x432d27[_0xf4bb('0x34')]['hasOwnProperty'](_0xf4bb('0x3a'))){_0x30b9dd[_0xf4bb('0x21')]=qs[_0xf4bb('0x21')](_0x432d27[_0xf4bb('0x34')]['limit']);_0x30b9dd['offset']=qs[_0xf4bb('0x20')](_0x432d27['query'][_0xf4bb('0x20')]);}_0x30b9dd[_0xf4bb('0x3b')]=qs[_0xf4bb('0x3c')](_0x432d27[_0xf4bb('0x34')][_0xf4bb('0x3c')]);_0x30b9dd[_0xf4bb('0x3d')]=qs['filters'](_[_0xf4bb('0x3e')](_0x432d27[_0xf4bb('0x34')],_0x40d0e3[_0xf4bb('0x3f')]),_0x5658d0);if(_0x432d27[_0xf4bb('0x34')][_0xf4bb('0x40')]){_0x30b9dd['where']=_[_0xf4bb('0x41')](_0x30b9dd['where'],{'$or':_['map'](_0x5658d0,function(_0x11c787){if(_0x11c787[_0xf4bb('0x31')]!==_0xf4bb('0x42')){var _0x5ef4f5={};_0x5ef4f5[_0x11c787[_0xf4bb('0x2b')]]={'$like':'%'+_0x432d27[_0xf4bb('0x34')][_0xf4bb('0x40')]+'%'};return _0x5ef4f5;}})});}_0x30b9dd=_[_0xf4bb('0x41')]({},_0x30b9dd,_0x432d27['options']);var _0x45819c={'where':_0x30b9dd[_0xf4bb('0x3d')]};return db[_0xf4bb('0x43')][_0xf4bb('0x1f')](_0x45819c)['then'](function(_0x5222a4){_0x136583[_0xf4bb('0x1f')]=_0x5222a4;if(_0x432d27[_0xf4bb('0x34')][_0xf4bb('0x44')]){_0x30b9dd[_0xf4bb('0x45')]=[{'all':!![]}];}return db[_0xf4bb('0x43')]['findAll'](_0x30b9dd);})[_0xf4bb('0x28')](function(_0x51df0c){_0x136583[_0xf4bb('0x46')]=_0x51df0c;return _0x136583;})['then'](respondWithFilteredResult(_0x498880,_0x30b9dd))[_0xf4bb('0x47')](handleError(_0x498880,null));};exports[_0xf4bb('0x48')]=function(_0x31de5d,_0x4f2a29){var _0x4b25d2={'raw':!![],'where':{'id':_0x31de5d[_0xf4bb('0x49')]['id']}},_0x20e224={};_0x20e224[_0xf4bb('0x33')]=_[_0xf4bb('0x35')](db[_0xf4bb('0x43')][_0xf4bb('0x2f')]);_0x20e224[_0xf4bb('0x34')]=_[_0xf4bb('0x35')](_0x31de5d[_0xf4bb('0x34')]);_0x20e224[_0xf4bb('0x3f')]=_[_0xf4bb('0x36')](_0x20e224[_0xf4bb('0x33')],_0x20e224['query']);_0x4b25d2['attributes']=_[_0xf4bb('0x36')](_0x20e224[_0xf4bb('0x33')],qs['fields'](_0x31de5d['query'][_0xf4bb('0x37')]));_0x4b25d2[_0xf4bb('0x38')]=_0x4b25d2[_0xf4bb('0x38')][_0xf4bb('0x39')]?_0x4b25d2[_0xf4bb('0x38')]:_0x20e224[_0xf4bb('0x33')];if(_0x31de5d['query'][_0xf4bb('0x44')]){_0x4b25d2[_0xf4bb('0x45')]=[{'all':!![]}];}_0x4b25d2=_[_0xf4bb('0x41')]({},_0x4b25d2,_0x31de5d['options']);return db[_0xf4bb('0x43')]['find'](_0x4b25d2)[_0xf4bb('0x28')](handleEntityNotFound(_0x4f2a29,null))[_0xf4bb('0x28')](respondWithResult(_0x4f2a29,null))['catch'](handleError(_0x4f2a29,null));};exports[_0xf4bb('0x4a')]=function(_0x232f47,_0x534192){return db['FaxQueueReport'][_0xf4bb('0x4a')](_0x232f47[_0xf4bb('0x4b')],{})[_0xf4bb('0x28')](respondWithResult(_0x534192,0xc9))['catch'](handleError(_0x534192,null));};exports[_0xf4bb('0x27')]=function(_0x42f4e4,_0x95b7e5){if(_0x42f4e4[_0xf4bb('0x4b')]['id']){delete _0x42f4e4['body']['id'];}return db[_0xf4bb('0x43')]['find']({'where':{'id':_0x42f4e4[_0xf4bb('0x49')]['id']}})[_0xf4bb('0x28')](handleEntityNotFound(_0x95b7e5,null))[_0xf4bb('0x28')](saveUpdates(_0x42f4e4['body'],null))['then'](respondWithResult(_0x95b7e5,null))[_0xf4bb('0x47')](handleError(_0x95b7e5,null));};exports['destroy']=function(_0x577193,_0x2a996c){return db[_0xf4bb('0x43')][_0xf4bb('0x4c')]({'where':{'id':_0x577193[_0xf4bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x2a996c,null))[_0xf4bb('0x28')](removeEntity(_0x2a996c,null))['catch'](handleError(_0x2a996c,null));};exports[_0xf4bb('0x4d')]=function(_0x344c4f,_0x3b8ee5){return db[_0xf4bb('0x43')]['describe']()['then'](respondWithResult(_0x3b8ee5,null))[_0xf4bb('0x47')](handleError(_0x3b8ee5,null));}; \ No newline at end of file +var _0x614e=['sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','includeAll','findAll','catch','show','params','keys','include','options','find','body','update','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x2f44fa,_0x2fad79){var _0x51c848=function(_0x2fe6f9){while(--_0x2fe6f9){_0x2f44fa['push'](_0x2f44fa['shift']());}};_0x51c848(++_0x2fad79);}(_0x614e,0x7a));var _0xe614=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x614e[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0xe614('0x0'));var emlformat=require(_0xe614('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe614('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe614('0x3'));var moment=require(_0xe614('0x4'));var BPromise=require(_0xe614('0x5'));var Mustache=require('mustache');var util=require(_0xe614('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe614('0x7'));var ejs=require(_0xe614('0x8'));var fs=require('fs');var _=require(_0xe614('0x9'));var squel=require(_0xe614('0xa'));var crypto=require(_0xe614('0xb'));var jsforce=require(_0xe614('0xc'));var deskjs=require(_0xe614('0xd'));var toCsv=require(_0xe614('0x7'));var querystring=require(_0xe614('0xe'));var Papa=require(_0xe614('0xf'));var Redis=require(_0xe614('0x10'));var authService=require(_0xe614('0x11'));var qs=require(_0xe614('0x12'));var as=require(_0xe614('0x13'));var hardwareService=require(_0xe614('0x14'));var logger=require(_0xe614('0x15'))(_0xe614('0x16'));var utils=require('../../config/utils');var config=require(_0xe614('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19f375,_0x12b391){_0x12b391=_0x12b391||0xcc;return function(_0x53e7b9){if(_0x53e7b9){return _0x19f375[_0xe614('0x18')](_0x12b391);}return _0x19f375[_0xe614('0x19')](_0x12b391)['end']();};}function respondWithResult(_0x2b26de,_0x79ee98){_0x79ee98=_0x79ee98||0xc8;return function(_0x78c96a){if(_0x78c96a){return _0x2b26de[_0xe614('0x19')](_0x79ee98)[_0xe614('0x1a')](_0x78c96a);}};}function respondWithFilteredResult(_0x5a758d,_0x55851f){return function(_0x195ed6){if(_0x195ed6){var _0x2e0606=_0x195ed6[_0xe614('0x1b')],_0x3627bf=_0x55851f[_0xe614('0x1c')],_0x4aaf23=_0x55851f[_0xe614('0x1c')]+_0x55851f['limit'],_0x3aefb1;if(_0x4aaf23>=_0x2e0606){_0x4aaf23=_0x2e0606;_0x3aefb1=0xc8;}else{_0x3aefb1=0xce;}_0x5a758d[_0xe614('0x19')](_0x3aefb1);return _0x5a758d[_0xe614('0x1d')](_0xe614('0x1e'),_0x3627bf+'-'+_0x4aaf23+'/'+_0x2e0606)[_0xe614('0x1a')](_0x195ed6);}return null;};}function patchUpdates(_0xae3fbd){return function(_0x4fdba1){try{jsonpatch[_0xe614('0x1f')](_0x4fdba1,_0xae3fbd,!![]);}catch(_0x17e973){return BPromise[_0xe614('0x20')](_0x17e973);}return _0x4fdba1[_0xe614('0x21')]();};}function saveUpdates(_0x74990a,_0x5a135a){return function(_0x356cf3){if(_0x356cf3){return _0x356cf3['update'](_0x74990a)[_0xe614('0x22')](function(_0x36cfb1){return _0x36cfb1;});}return null;};}function removeEntity(_0x767ceb,_0x382281){return function(_0x1f1f4d){if(_0x1f1f4d){return _0x1f1f4d[_0xe614('0x23')]()['then'](function(){_0x767ceb[_0xe614('0x19')](0xcc)[_0xe614('0x24')]();});}};}function handleEntityNotFound(_0x12514a,_0x3b31a3){return function(_0x1b029c){if(!_0x1b029c){_0x12514a[_0xe614('0x18')](0x194);}return _0x1b029c;};}function handleError(_0x2b505a,_0x286bd2){_0x286bd2=_0x286bd2||0x1f4;return function(_0x41b50a){logger[_0xe614('0x25')](_0x41b50a[_0xe614('0x26')]);if(_0x41b50a[_0xe614('0x27')]){delete _0x41b50a['name'];}_0x2b505a[_0xe614('0x19')](_0x286bd2)['send'](_0x41b50a);};}exports[_0xe614('0x28')]=function(_0x347d5b,_0x43cc10){var _0xe1e76d={},_0x1650f8={},_0x4453bd={'count':0x0,'rows':[]};var _0x2a2224=_[_0xe614('0x29')](db[_0xe614('0x2a')][_0xe614('0x2b')],function(_0x1a90ff){return{'name':_0x1a90ff[_0xe614('0x2c')],'type':_0x1a90ff[_0xe614('0x2d')][_0xe614('0x2e')]};});_0x1650f8[_0xe614('0x2f')]=_[_0xe614('0x29')](_0x2a2224,_0xe614('0x27'));_0x1650f8[_0xe614('0x30')]=_['keys'](_0x347d5b[_0xe614('0x30')]);_0x1650f8[_0xe614('0x31')]=_['intersection'](_0x1650f8[_0xe614('0x2f')],_0x1650f8[_0xe614('0x30')]);_0xe1e76d['attributes']=_[_0xe614('0x32')](_0x1650f8['model'],qs[_0xe614('0x33')](_0x347d5b['query'][_0xe614('0x33')]));_0xe1e76d[_0xe614('0x34')]=_0xe1e76d['attributes'][_0xe614('0x35')]?_0xe1e76d[_0xe614('0x34')]:_0x1650f8[_0xe614('0x2f')];if(!_0x347d5b[_0xe614('0x30')]['hasOwnProperty'](_0xe614('0x36'))){_0xe1e76d[_0xe614('0x37')]=qs[_0xe614('0x37')](_0x347d5b[_0xe614('0x30')]['limit']);_0xe1e76d[_0xe614('0x1c')]=qs[_0xe614('0x1c')](_0x347d5b[_0xe614('0x30')]['offset']);}_0xe1e76d[_0xe614('0x38')]=qs['sort'](_0x347d5b[_0xe614('0x30')][_0xe614('0x39')]);_0xe1e76d[_0xe614('0x3a')]=qs[_0xe614('0x31')](_['pick'](_0x347d5b[_0xe614('0x30')],_0x1650f8[_0xe614('0x31')]),_0x2a2224);if(_0x347d5b[_0xe614('0x30')][_0xe614('0x3b')]){_0xe1e76d['where']=_[_0xe614('0x3c')](_0xe1e76d[_0xe614('0x3a')],{'$or':_[_0xe614('0x29')](_0x2a2224,function(_0x343efe){if(_0x343efe[_0xe614('0x2d')]!=='VIRTUAL'){var _0x191994={};_0x191994[_0x343efe[_0xe614('0x27')]]={'$like':'%'+_0x347d5b[_0xe614('0x30')][_0xe614('0x3b')]+'%'};return _0x191994;}})});}_0xe1e76d=_[_0xe614('0x3c')]({},_0xe1e76d,_0x347d5b['options']);var _0x20ad3c={'where':_0xe1e76d[_0xe614('0x3a')]};return db[_0xe614('0x2a')]['count'](_0x20ad3c)[_0xe614('0x22')](function(_0x31717d){_0x4453bd[_0xe614('0x1b')]=_0x31717d;if(_0x347d5b['query'][_0xe614('0x3d')]){_0xe1e76d['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xe614('0x3e')](_0xe1e76d);})[_0xe614('0x22')](function(_0x49c66c){_0x4453bd['rows']=_0x49c66c;return _0x4453bd;})[_0xe614('0x22')](respondWithFilteredResult(_0x43cc10,_0xe1e76d))[_0xe614('0x3f')](handleError(_0x43cc10,null));};exports[_0xe614('0x40')]=function(_0x3ea092,_0x305842){var _0x5d2bb7={'raw':!![],'where':{'id':_0x3ea092[_0xe614('0x41')]['id']}},_0x62557f={};_0x62557f[_0xe614('0x2f')]=_[_0xe614('0x42')](db[_0xe614('0x2a')][_0xe614('0x2b')]);_0x62557f[_0xe614('0x30')]=_[_0xe614('0x42')](_0x3ea092[_0xe614('0x30')]);_0x62557f[_0xe614('0x31')]=_[_0xe614('0x32')](_0x62557f[_0xe614('0x2f')],_0x62557f[_0xe614('0x30')]);_0x5d2bb7['attributes']=_[_0xe614('0x32')](_0x62557f[_0xe614('0x2f')],qs[_0xe614('0x33')](_0x3ea092['query']['fields']));_0x5d2bb7['attributes']=_0x5d2bb7[_0xe614('0x34')][_0xe614('0x35')]?_0x5d2bb7['attributes']:_0x62557f['model'];if(_0x3ea092[_0xe614('0x30')][_0xe614('0x3d')]){_0x5d2bb7[_0xe614('0x43')]=[{'all':!![]}];}_0x5d2bb7=_[_0xe614('0x3c')]({},_0x5d2bb7,_0x3ea092[_0xe614('0x44')]);return db[_0xe614('0x2a')][_0xe614('0x45')](_0x5d2bb7)[_0xe614('0x22')](handleEntityNotFound(_0x305842,null))[_0xe614('0x22')](respondWithResult(_0x305842,null))[_0xe614('0x3f')](handleError(_0x305842,null));};exports['create']=function(_0x16b062,_0x3b11e6){return db[_0xe614('0x2a')]['create'](_0x16b062[_0xe614('0x46')],{})['then'](respondWithResult(_0x3b11e6,0xc9))[_0xe614('0x3f')](handleError(_0x3b11e6,null));};exports[_0xe614('0x47')]=function(_0x27dcad,_0x1403dc){if(_0x27dcad[_0xe614('0x46')]['id']){delete _0x27dcad['body']['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x27dcad[_0xe614('0x41')]['id']}})[_0xe614('0x22')](handleEntityNotFound(_0x1403dc,null))[_0xe614('0x22')](saveUpdates(_0x27dcad[_0xe614('0x46')],null))['then'](respondWithResult(_0x1403dc,null))[_0xe614('0x3f')](handleError(_0x1403dc,null));};exports[_0xe614('0x23')]=function(_0x2633ee,_0x1d64ae){return db[_0xe614('0x2a')][_0xe614('0x45')]({'where':{'id':_0x2633ee[_0xe614('0x41')]['id']}})['then'](handleEntityNotFound(_0x1d64ae,null))[_0xe614('0x22')](removeEntity(_0x1d64ae,null))[_0xe614('0x3f')](handleError(_0x1d64ae,null));};exports[_0xe614('0x48')]=function(_0x1c6faf,_0x28a30a){return db['FaxQueueReport']['describe']()[_0xe614('0x22')](respondWithResult(_0x28a30a,null))[_0xe614('0x3f')](handleError(_0x28a30a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2e6160a..7c4cc56 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 _0x761c=['api','bluebird','request-promise','path','../../config/environment','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0xf4946d,_0x19f222){var _0x328d8e=function(_0x5d001f){while(--_0x5d001f){_0xf4946d['push'](_0xf4946d['shift']());}};_0x328d8e(++_0x19f222);}(_0x761c,0x18a));var _0xc761=function(_0xf98303,_0x767b37){_0xf98303=_0xf98303-0x0;var _0x7837e8=_0x761c[_0xf98303];return _0x7837e8;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var logger=require(_0xc761('0x1'))(_0xc761('0x2'));var moment=require('moment');var BPromise=require(_0xc761('0x3'));var rp=require(_0xc761('0x4'));var fs=require('fs');var path=require(_0xc761('0x5'));var rimraf=require('rimraf');var config=require(_0xc761('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0xc761('0x7')]=function(_0x468f51,_0x23ba0b){return _0x468f51[_0xc761('0x8')](_0xc761('0x9'),attributes,{'tableName':_0xc761('0xa'),'paranoid':![],'indexes':[{'name':_0xc761('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x17a7=['rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','api','moment','bluebird','request-promise'];(function(_0xfff93c,_0x2b4e2b){var _0x4e8fee=function(_0x595cd4){while(--_0x595cd4){_0xfff93c['push'](_0xfff93c['shift']());}};_0x4e8fee(++_0x2b4e2b);}(_0x17a7,0xc2));var _0x717a=function(_0xa59c46,_0x2e3496){_0xa59c46=_0xa59c46-0x0;var _0x183645=_0x17a7[_0xa59c46];return _0x183645;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x717a('0x0'));var moment=require(_0x717a('0x1'));var BPromise=require(_0x717a('0x2'));var rp=require(_0x717a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x717a('0x4'));var config=require('../../config/environment');var attributes=require(_0x717a('0x5'));module[_0x717a('0x6')]=function(_0x4dd8c3,_0x232539){return _0x4dd8c3[_0x717a('0x7')](_0x717a('0x8'),attributes,{'tableName':_0x717a('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x717a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8740e97..541d796 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 _0x0954=['CreateFaxQueueReport','FaxQueueReport','options','update','raw','attributes','limit','UpdateFaxQueueReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch'];(function(_0x3323ce,_0x31152d){var _0x112db1=function(_0x2ddf4d){while(--_0x2ddf4d){_0x3323ce['push'](_0x3323ce['shift']());}};_0x112db1(++_0x31152d);}(_0x0954,0x15d));var _0x4095=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0x0954[_0x8cb2f9];return _0x164887;};'use strict';var _=require('lodash');var util=require(_0x4095('0x0'));var moment=require(_0x4095('0x1'));var BPromise=require('bluebird');var rs=require(_0x4095('0x2'));var fs=require('fs');var Redis=require(_0x4095('0x3'));var db=require(_0x4095('0x4'))['db'];var utils=require(_0x4095('0x5'));var logger=require('../../config/logger')(_0x4095('0x6'));var config=require(_0x4095('0x7'));var jayson=require(_0x4095('0x8'));var client=jayson[_0x4095('0x9')][_0x4095('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23b203,_0x71b73b,_0x1541bf){return new BPromise(function(_0x3ff92e,_0x109e18){return client[_0x4095('0xb')](_0x23b203,_0x1541bf)[_0x4095('0xc')](function(_0x31e57e){logger['info'](_0x4095('0xd'),_0x71b73b,'request\x20sent');logger[_0x4095('0xe')](_0x4095('0xf'),_0x71b73b,_0x4095('0x10'),JSON[_0x4095('0x11')](_0x31e57e));if(_0x31e57e[_0x4095('0x12')]){if(_0x31e57e[_0x4095('0x12')][_0x4095('0x13')]===0x1f4){logger['error'](_0x4095('0xd'),_0x71b73b,_0x31e57e['error'][_0x4095('0x14')]);return _0x109e18(_0x31e57e[_0x4095('0x12')][_0x4095('0x14')]);}logger['error'](_0x4095('0xd'),_0x71b73b,_0x31e57e[_0x4095('0x12')][_0x4095('0x14')]);return _0x3ff92e(_0x31e57e[_0x4095('0x12')]['message']);}else{logger[_0x4095('0x15')](_0x4095('0xd'),_0x71b73b,_0x4095('0x10'));_0x3ff92e(_0x31e57e['result'][_0x4095('0x14')]);}})[_0x4095('0x16')](function(_0x4aca7b){logger[_0x4095('0x12')](_0x4095('0xd'),_0x71b73b,_0x4aca7b);_0x109e18(_0x4aca7b);});});}exports[_0x4095('0x17')]=function(_0x409081){var _0x271048=this;return new Promise(function(_0x1dae17,_0x5bb773){return db[_0x4095('0x18')]['create'](_0x409081['body'],{'raw':_0x409081[_0x4095('0x19')]?_0x409081[_0x4095('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4095('0xc')](function(_0x429cc6){logger[_0x4095('0x15')]('CreateFaxQueueReport',_0x409081);logger[_0x4095('0xe')](_0x4095('0x17'),_0x409081,JSON[_0x4095('0x11')](_0x429cc6));_0x1dae17(_0x429cc6);})[_0x4095('0x16')](function(_0x480be6){logger['error'](_0x4095('0x17'),_0x480be6[_0x4095('0x14')],_0x409081);_0x5bb773(_0x271048[_0x4095('0x12')](0x1f4,_0x480be6[_0x4095('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x4eab6c){var _0x59d906=this;return new Promise(function(_0x32e44b,_0xac54d0){return db[_0x4095('0x18')][_0x4095('0x1a')](_0x4eab6c['body'],{'raw':_0x4eab6c['options']?_0x4eab6c[_0x4095('0x19')][_0x4095('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eab6c[_0x4095('0x19')]?_0x4eab6c['options']['where']||null:null,'attributes':_0x4eab6c[_0x4095('0x19')]?_0x4eab6c[_0x4095('0x19')][_0x4095('0x1c')]||null:null,'limit':_0x4eab6c[_0x4095('0x19')]?_0x4eab6c[_0x4095('0x19')][_0x4095('0x1d')]||null:null})['then'](function(_0x30e02a){logger[_0x4095('0x15')]('UpdateFaxQueueReport',_0x4eab6c);logger[_0x4095('0xe')](_0x4095('0x1e'),_0x4eab6c,JSON[_0x4095('0x11')](_0x30e02a));_0x32e44b(_0x30e02a);})['catch'](function(_0x1b29fa){logger[_0x4095('0x12')](_0x4095('0x1e'),_0x1b29fa[_0x4095('0x14')],_0x4eab6c);_0xac54d0(_0x59d906[_0x4095('0x12')](0x1f4,_0x1b29fa['message']));});});}; \ No newline at end of file +var _0xd8ff=['lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','request\x20sent','result','CreateFaxQueueReport','FaxQueueReport','create','options','raw','catch','UpdateFaxQueueReport','body','where','attributes'];(function(_0x331bb2,_0x2ee749){var _0x462c7a=function(_0x25b3b8){while(--_0x25b3b8){_0x331bb2['push'](_0x331bb2['shift']());}};_0x462c7a(++_0x2ee749);}(_0xd8ff,0xae));var _0xfd8f=function(_0x42879f,_0x3b68ed){_0x42879f=_0x42879f-0x0;var _0x328d93=_0xd8ff[_0x42879f];return _0x328d93;};'use strict';var _=require(_0xfd8f('0x0'));var util=require(_0xfd8f('0x1'));var moment=require('moment');var BPromise=require(_0xfd8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd8f('0x3'));var db=require(_0xfd8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfd8f('0x5'));var config=require(_0xfd8f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfd8f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42be7e,_0x560af7,_0x40b245){return new BPromise(function(_0x10631a,_0x3977c4){return client['request'](_0x42be7e,_0x40b245)[_0xfd8f('0x8')](function(_0x5435a2){logger[_0xfd8f('0x9')]('FaxQueueReport,\x20%s,\x20%s',_0x560af7,'request\x20sent');logger[_0xfd8f('0xa')](_0xfd8f('0xb'),_0x560af7,'request\x20sent',JSON[_0xfd8f('0xc')](_0x5435a2));if(_0x5435a2['error']){if(_0x5435a2[_0xfd8f('0xd')][_0xfd8f('0xe')]===0x1f4){logger[_0xfd8f('0xd')](_0xfd8f('0xf'),_0x560af7,_0x5435a2[_0xfd8f('0xd')]['message']);return _0x3977c4(_0x5435a2[_0xfd8f('0xd')]['message']);}logger[_0xfd8f('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x560af7,_0x5435a2[_0xfd8f('0xd')][_0xfd8f('0x10')]);return _0x10631a(_0x5435a2['error'][_0xfd8f('0x10')]);}else{logger[_0xfd8f('0x9')](_0xfd8f('0xf'),_0x560af7,_0xfd8f('0x11'));_0x10631a(_0x5435a2[_0xfd8f('0x12')][_0xfd8f('0x10')]);}})['catch'](function(_0x488377){logger[_0xfd8f('0xd')](_0xfd8f('0xf'),_0x560af7,_0x488377);_0x3977c4(_0x488377);});});}exports[_0xfd8f('0x13')]=function(_0x56a53e){var _0x4a5965=this;return new Promise(function(_0x13e544,_0x37ae70){return db[_0xfd8f('0x14')][_0xfd8f('0x15')](_0x56a53e['body'],{'raw':_0x56a53e[_0xfd8f('0x16')]?_0x56a53e['options'][_0xfd8f('0x17')]===undefined?!![]:![]:!![]})[_0xfd8f('0x8')](function(_0x4033f6){logger[_0xfd8f('0x9')](_0xfd8f('0x13'),_0x56a53e);logger[_0xfd8f('0xa')](_0xfd8f('0x13'),_0x56a53e,JSON[_0xfd8f('0xc')](_0x4033f6));_0x13e544(_0x4033f6);})[_0xfd8f('0x18')](function(_0x146f7b){logger[_0xfd8f('0xd')](_0xfd8f('0x13'),_0x146f7b['message'],_0x56a53e);_0x37ae70(_0x4a5965[_0xfd8f('0xd')](0x1f4,_0x146f7b[_0xfd8f('0x10')]));});});};exports[_0xfd8f('0x19')]=function(_0x408dfa){var _0x5ed00e=this;return new Promise(function(_0x314005,_0x49631b){return db['FaxQueueReport']['update'](_0x408dfa[_0xfd8f('0x1a')],{'raw':_0x408dfa[_0xfd8f('0x16')]?_0x408dfa[_0xfd8f('0x16')][_0xfd8f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x408dfa[_0xfd8f('0x16')]?_0x408dfa[_0xfd8f('0x16')][_0xfd8f('0x1b')]||null:null,'attributes':_0x408dfa['options']?_0x408dfa[_0xfd8f('0x16')][_0xfd8f('0x1c')]||null:null,'limit':_0x408dfa[_0xfd8f('0x16')]?_0x408dfa['options']['limit']||null:null})[_0xfd8f('0x8')](function(_0x4bdddc){logger[_0xfd8f('0x9')]('UpdateFaxQueueReport',_0x408dfa);logger[_0xfd8f('0xa')](_0xfd8f('0x19'),_0x408dfa,JSON[_0xfd8f('0xc')](_0x4bdddc));_0x314005(_0x4bdddc);})[_0xfd8f('0x18')](function(_0x5bbd3c){logger[_0xfd8f('0xd')](_0xfd8f('0x19'),_0x5bbd3c['message'],_0x408dfa);_0x49631b(_0x5ed00e[_0xfd8f('0xd')](0x1f4,_0x5bbd3c[_0xfd8f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 558f5e0..4ab100b 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 _0x33ea=['../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x33ea,0xcc));var _0xa33e=function(_0x20f1a0,_0x46469c){_0x20f1a0=_0x20f1a0-0x0;var _0x9e6b01=_0x33ea[_0x20f1a0];return _0x9e6b01;};'use strict';var multer=require(_0xa33e('0x0'));var util=require('util');var path=require(_0xa33e('0x1'));var timeout=require(_0xa33e('0x2'));var express=require(_0xa33e('0x3'));var router=express[_0xa33e('0x4')]();var auth=require(_0xa33e('0x5'));var interaction=require(_0xa33e('0x6'));var config=require(_0xa33e('0x7'));var controller=require(_0xa33e('0x8'));router['get']('/',auth[_0xa33e('0x9')](),controller['index']);router[_0xa33e('0xa')](_0xa33e('0xb'),auth[_0xa33e('0x9')](),controller['describe']);router[_0xa33e('0xa')](_0xa33e('0xc'),auth[_0xa33e('0x9')](),controller[_0xa33e('0xd')]);router[_0xa33e('0xe')]('/',auth[_0xa33e('0x9')](),controller[_0xa33e('0xf')]);router[_0xa33e('0x10')](_0xa33e('0xc'),auth[_0xa33e('0x9')](),controller[_0xa33e('0x11')]);router[_0xa33e('0x12')](_0xa33e('0xc'),auth[_0xa33e('0x9')](),controller[_0xa33e('0x13')]);module[_0xa33e('0x14')]=router; \ No newline at end of file +var _0x9a87=['express','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x1efdbd,_0x5977e8){var _0x1534a5=function(_0x5311aa){while(--_0x5311aa){_0x1efdbd['push'](_0x1efdbd['shift']());}};_0x1534a5(++_0x5977e8);}(_0x9a87,0xf9));var _0x79a8=function(_0xd0baae,_0x3020f4){_0xd0baae=_0xd0baae-0x0;var _0x538549=_0x9a87[_0xd0baae];return _0x538549;};'use strict';var multer=require(_0x79a8('0x0'));var util=require(_0x79a8('0x1'));var path=require('path');var timeout=require(_0x79a8('0x2'));var express=require(_0x79a8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x79a8('0x4'));var config=require(_0x79a8('0x5'));var controller=require(_0x79a8('0x6'));router[_0x79a8('0x7')]('/',auth[_0x79a8('0x8')](),controller['index']);router[_0x79a8('0x7')](_0x79a8('0x9'),auth[_0x79a8('0x8')](),controller[_0x79a8('0xa')]);router['get'](_0x79a8('0xb'),auth['isAuthenticated'](),controller[_0x79a8('0xc')]);router[_0x79a8('0xd')]('/',auth[_0x79a8('0x8')](),controller['create']);router['put']('/:id',auth[_0x79a8('0x8')](),controller[_0x79a8('0xe')]);router[_0x79a8('0xf')]('/:id',auth[_0x79a8('0x8')](),controller[_0x79a8('0x10')]);module[_0x79a8('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 1e7c65e..74cca2d 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 _0x290a=['sequelize','exports','STRING','account','agent','queue','DATE','NOW','moment'];(function(_0x4e8eed,_0xcd56a3){var _0x17bdfa=function(_0x4664bc){while(--_0x4664bc){_0x4e8eed['push'](_0x4e8eed['shift']());}};_0x17bdfa(++_0xcd56a3);}(_0x290a,0x131));var _0xa290=function(_0x5c067c,_0x4a1d18){_0x5c067c=_0x5c067c-0x0;var _0x1b27f2=_0x290a[_0x5c067c];return _0x1b27f2;};'use strict';var moment=require(_0xa290('0x0'));var Sequelize=require(_0xa290('0x1'));module[_0xa290('0x2')]={'uniqueid':{'type':Sequelize[_0xa290('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa290('0x4'),_0xa290('0x5'),'queue'),'allowNull':![],'defaultValue':_0xa290('0x6')},'transferredAt':{'type':Sequelize[_0xa290('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xa290('0x8')]}}; \ No newline at end of file +var _0x7815=['agent','queue','DATE','exports','STRING','ENUM','account'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0x7815,0x1ca));var _0x5781=function(_0x298e28,_0x2d6d9f){_0x298e28=_0x298e28-0x0;var _0x1433ac=_0x7815[_0x298e28];return _0x1433ac;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x5781('0x0')]={'uniqueid':{'type':Sequelize[_0x5781('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5781('0x2')](_0x5781('0x3'),_0x5781('0x4'),'queue'),'allowNull':![],'defaultValue':_0x5781('0x5')},'transferredAt':{'type':Sequelize[_0x5781('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index aa1098d..a0ac4de 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5f2f,0x73));var _0xf5f2=function(_0x58b4cc,_0x22a59d){_0x58b4cc=_0x58b4cc-0x0;var _0x3f355b=_0x5f2f[_0x58b4cc];return _0x3f355b;};'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 _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x5b70c1,_0x5f42ef){var _0x2b24b2=function(_0x37740f){while(--_0x37740f){_0x5b70c1['push'](_0x5b70c1['shift']());}};_0x2b24b2(++_0x5f42ef);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 63d4f8f..be15c28 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 _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0x2da823,_0xb1f692){var _0x4ce20e=function(_0x3b4953){while(--_0x3b4953){_0x2da823['push'](_0x2da823['shift']());}};_0x4ce20e(++_0xb1f692);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2dac35,_0x159b5a){_0x2dac35=_0x2dac35-0x0;var _0x5bf548=_0xee5b[_0x2dac35];return _0x5bf548;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc21=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xbc21,0xcd));var _0x1bc2=function(_0xc5a41c,_0x4bd1bf){_0xc5a41c=_0xc5a41c-0x0;var _0x7b3250=_0xbc21[_0xc5a41c];return _0x7b3250;};'use strict';var _=require(_0x1bc2('0x0'));var util=require(_0x1bc2('0x1'));var logger=require(_0x1bc2('0x2'))('api');var moment=require(_0x1bc2('0x3'));var BPromise=require(_0x1bc2('0x4'));var rp=require(_0x1bc2('0x5'));var fs=require('fs');var path=require(_0x1bc2('0x6'));var rimraf=require(_0x1bc2('0x7'));var config=require(_0x1bc2('0x8'));var attributes=require(_0x1bc2('0x9'));module[_0x1bc2('0xa')]=function(_0x464edc,_0x56733c){return _0x464edc[_0x1bc2('0xb')](_0x1bc2('0xc'),attributes,{'tableName':_0x1bc2('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1bc2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 7d18ebb..921072c 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 _0xdf0b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xdf0b,0xe4));var _0xbdf0=function(_0x286e93,_0x3d58fb){_0x286e93=_0x286e93-0x0;var _0x26caf3=_0xdf0b[_0x286e93];return _0x26caf3;};'use strict';var _=require(_0xbdf0('0x0'));var util=require(_0xbdf0('0x1'));var moment=require(_0xbdf0('0x2'));var BPromise=require(_0xbdf0('0x3'));var rs=require(_0xbdf0('0x4'));var fs=require('fs');var Redis=require(_0xbdf0('0x5'));var db=require(_0xbdf0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdf0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbdf0('0x8'));var client=jayson[_0xbdf0('0x9')][_0xbdf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x455ce8,_0x5da6fc,_0x17b56f){return new BPromise(function(_0x2299cb,_0x5d8df){return client[_0xbdf0('0xb')](_0x455ce8,_0x17b56f)['then'](function(_0x27b471){logger[_0xbdf0('0xc')](_0xbdf0('0xd'),_0x5da6fc,_0xbdf0('0xe'));logger[_0xbdf0('0xf')](_0xbdf0('0x10'),_0x5da6fc,_0xbdf0('0xe'),JSON[_0xbdf0('0x11')](_0x27b471));if(_0x27b471[_0xbdf0('0x12')]){if(_0x27b471[_0xbdf0('0x12')][_0xbdf0('0x13')]===0x1f4){logger[_0xbdf0('0x12')](_0xbdf0('0xd'),_0x5da6fc,_0x27b471['error'][_0xbdf0('0x14')]);return _0x5d8df(_0x27b471['error'][_0xbdf0('0x14')]);}logger['error'](_0xbdf0('0xd'),_0x5da6fc,_0x27b471[_0xbdf0('0x12')][_0xbdf0('0x14')]);return _0x2299cb(_0x27b471[_0xbdf0('0x12')][_0xbdf0('0x14')]);}else{logger[_0xbdf0('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x5da6fc,_0xbdf0('0xe'));_0x2299cb(_0x27b471[_0xbdf0('0x15')][_0xbdf0('0x14')]);}})[_0xbdf0('0x16')](function(_0x47d802){logger[_0xbdf0('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5da6fc,_0x47d802);_0x5d8df(_0x47d802);});});} \ No newline at end of file +var _0x1e7d=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x256fa5,_0x1881e9){var _0x5836e4=function(_0x3d4231){while(--_0x3d4231){_0x256fa5['push'](_0x256fa5['shift']());}};_0x5836e4(++_0x1881e9);}(_0x1e7d,0xdf));var _0xd1e7=function(_0xa347de,_0x3b6d48){_0xa347de=_0xa347de-0x0;var _0xbb1894=_0x1e7d[_0xa347de];return _0xbb1894;};'use strict';var _=require(_0xd1e7('0x0'));var util=require(_0xd1e7('0x1'));var moment=require(_0xd1e7('0x2'));var BPromise=require(_0xd1e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1e7('0x4'));var db=require(_0xd1e7('0x5'))['db'];var utils=require(_0xd1e7('0x6'));var logger=require(_0xd1e7('0x7'))(_0xd1e7('0x8'));var config=require(_0xd1e7('0x9'));var jayson=require(_0xd1e7('0xa'));var client=jayson[_0xd1e7('0xb')][_0xd1e7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a3514,_0x14098b,_0xe9988b){return new BPromise(function(_0x36d000,_0x365df0){return client[_0xd1e7('0xd')](_0x4a3514,_0xe9988b)['then'](function(_0x1b017c){logger[_0xd1e7('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x14098b,_0xd1e7('0xf'));logger[_0xd1e7('0x10')](_0xd1e7('0x11'),_0x14098b,'request\x20sent',JSON[_0xd1e7('0x12')](_0x1b017c));if(_0x1b017c['error']){if(_0x1b017c[_0xd1e7('0x13')][_0xd1e7('0x14')]===0x1f4){logger[_0xd1e7('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x14098b,_0x1b017c[_0xd1e7('0x13')][_0xd1e7('0x15')]);return _0x365df0(_0x1b017c[_0xd1e7('0x13')][_0xd1e7('0x15')]);}logger[_0xd1e7('0x13')](_0xd1e7('0x16'),_0x14098b,_0x1b017c[_0xd1e7('0x13')][_0xd1e7('0x15')]);return _0x36d000(_0x1b017c[_0xd1e7('0x13')][_0xd1e7('0x15')]);}else{logger['info'](_0xd1e7('0x16'),_0x14098b,_0xd1e7('0xf'));_0x36d000(_0x1b017c['result'][_0xd1e7('0x15')]);}})[_0xd1e7('0x17')](function(_0x572569){logger[_0xd1e7('0x13')](_0xd1e7('0x16'),_0x14098b,_0x572569);_0x365df0(_0x572569);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e2966d3..f933e4d 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 _0x1e6a=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer'];(function(_0x362285,_0x4ade35){var _0x1bed24=function(_0x33bbd3){while(--_0x33bbd3){_0x362285['push'](_0x362285['shift']());}};_0x1bed24(++_0x4ade35);}(_0x1e6a,0xbc));var _0xa1e6=function(_0x2988f9,_0x3eb9d4){_0x2988f9=_0x2988f9-0x0;var _0x58cd2d=_0x1e6a[_0x2988f9];return _0x58cd2d;};'use strict';var multer=require(_0xa1e6('0x0'));var util=require(_0xa1e6('0x1'));var path=require(_0xa1e6('0x2'));var timeout=require(_0xa1e6('0x3'));var express=require('express');var router=express[_0xa1e6('0x4')]();var auth=require(_0xa1e6('0x5'));var interaction=require(_0xa1e6('0x6'));var config=require(_0xa1e6('0x7'));var controller=require(_0xa1e6('0x8'));router['get']('/',auth[_0xa1e6('0x9')](),controller[_0xa1e6('0xa')]);router[_0xa1e6('0xb')](_0xa1e6('0xc'),auth[_0xa1e6('0x9')](),controller[_0xa1e6('0xd')]);router[_0xa1e6('0xb')](_0xa1e6('0xe'),auth[_0xa1e6('0x9')](),controller[_0xa1e6('0xf')]);router['post']('/',auth[_0xa1e6('0x9')](),controller['create']);router[_0xa1e6('0x10')](_0xa1e6('0xe'),auth[_0xa1e6('0x9')](),controller[_0xa1e6('0x11')]);router[_0xa1e6('0x12')](_0xa1e6('0xe'),auth['isAuthenticated'](),controller[_0xa1e6('0x13')]);module[_0xa1e6('0x14')]=router; \ No newline at end of file +var _0xca04=['Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','multer','util','path'];(function(_0x3773ff,_0x8eed70){var _0x1c966f=function(_0x5cbe46){while(--_0x5cbe46){_0x3773ff['push'](_0x3773ff['shift']());}};_0x1c966f(++_0x8eed70);}(_0xca04,0x96));var _0x4ca0=function(_0x245c14,_0x462b6c){_0x245c14=_0x245c14-0x0;var _0x13c7d7=_0xca04[_0x245c14];return _0x13c7d7;};'use strict';var multer=require(_0x4ca0('0x0'));var util=require(_0x4ca0('0x1'));var path=require(_0x4ca0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4ca0('0x3')]();var auth=require(_0x4ca0('0x4'));var interaction=require(_0x4ca0('0x5'));var config=require('../../config/environment');var controller=require(_0x4ca0('0x6'));router[_0x4ca0('0x7')]('/',auth['isAuthenticated'](),controller[_0x4ca0('0x8')]);router[_0x4ca0('0x7')](_0x4ca0('0x9'),auth[_0x4ca0('0xa')](),controller['describe']);router[_0x4ca0('0x7')](_0x4ca0('0xb'),auth['isAuthenticated'](),controller[_0x4ca0('0xc')]);router[_0x4ca0('0xd')]('/',auth[_0x4ca0('0xa')](),controller['create']);router[_0x4ca0('0xe')]('/:id',auth[_0x4ca0('0xa')](),controller[_0x4ca0('0xf')]);router[_0x4ca0('0x10')]('/:id',auth[_0x4ca0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2161f32..76d2e18 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 _0xe198=['getFields','post','create','addConfiguration','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x3fb080,_0x1783cf){var _0x18e86d=function(_0x465017){while(--_0x465017){_0x3fb080['push'](_0x3fb080['shift']());}};_0x18e86d(++_0x1783cf);}(_0xe198,0x6f));var _0x8e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe198[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8e19('0x2'));var router=express[_0x8e19('0x3')]();var auth=require(_0x8e19('0x4'));var interaction=require(_0x8e19('0x5'));var config=require(_0x8e19('0x6'));var controller=require('./intDeskAccount.controller');router[_0x8e19('0x7')]('/',auth[_0x8e19('0x8')](),controller[_0x8e19('0x9')]);router[_0x8e19('0x7')](_0x8e19('0xa'),auth[_0x8e19('0x8')](),controller[_0x8e19('0xb')]);router[_0x8e19('0x7')](_0x8e19('0xc'),auth[_0x8e19('0x8')](),controller[_0x8e19('0xd')]);router[_0x8e19('0x7')](_0x8e19('0xe'),auth['isAuthenticated'](),controller[_0x8e19('0xf')]);router[_0x8e19('0x10')]('/',auth[_0x8e19('0x8')](),controller[_0x8e19('0x11')]);router[_0x8e19('0x10')](_0x8e19('0xc'),auth[_0x8e19('0x8')](),controller[_0x8e19('0x12')]);router['put']('/:id',auth[_0x8e19('0x8')](),controller['update']);router['delete'](_0x8e19('0xa'),auth[_0x8e19('0x8')](),controller[_0x8e19('0x13')]);module[_0x8e19('0x14')]=router; \ No newline at end of file +var _0xbd50=['show','getConfigurations','getFields','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x1336c6,_0x5c30b0){var _0x442c9f=function(_0x1bf76e){while(--_0x1bf76e){_0x1336c6['push'](_0x1336c6['shift']());}};_0x442c9f(++_0x5c30b0);}(_0xbd50,0x196));var _0x0bd5=function(_0xe63ca1,_0x38dbee){_0xe63ca1=_0xe63ca1-0x0;var _0x3a2983=_0xbd50[_0xe63ca1];return _0x3a2983;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var auth=require(_0x0bd5('0x5'));var interaction=require(_0x0bd5('0x6'));var config=require(_0x0bd5('0x7'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0bd5('0x8')]);router[_0x0bd5('0x9')](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xc')]);router['get']('/:id/configurations',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0x9')]('/:id/fields',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xe')]);router['post']('/',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xf')]);router['post'](_0x0bd5('0x10'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x11')]);router['put'](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x12')]);router[_0x0bd5('0x13')](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x14')]);module[_0x0bd5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 0d5d789..0a8c9ea 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 _0x77f1=['STRING','ENUM','basic','integrationTab','newTab','sequelize','exports'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x77f1,0x7c));var _0x177f=function(_0x33bd8c,_0x342fbb){_0x33bd8c=_0x33bd8c-0x0;var _0x9e78b0=_0x77f1[_0x33bd8c];return _0x9e78b0;};'use strict';var Sequelize=require(_0x177f('0x0'));module[_0x177f('0x1')]={'name':{'type':Sequelize[_0x177f('0x2')]},'description':{'type':Sequelize[_0x177f('0x2')]},'username':{'type':Sequelize[_0x177f('0x2')]},'remoteUri':{'type':Sequelize[_0x177f('0x2')]},'authType':{'type':Sequelize[_0x177f('0x3')]('basic'),'defaultValue':_0x177f('0x4')},'password':{'type':Sequelize[_0x177f('0x2')]},'consumerKey':{'type':Sequelize[_0x177f('0x2')]},'consumerSecret':{'type':Sequelize[_0x177f('0x2')]},'token':{'type':Sequelize[_0x177f('0x2')]},'tokenSecret':{'type':Sequelize[_0x177f('0x2')]},'serverUrl':{'type':Sequelize[_0x177f('0x2')]},'type':{'type':Sequelize[_0x177f('0x3')](_0x177f('0x5'),_0x177f('0x6')),'defaultValue':_0x177f('0x5')}}; \ No newline at end of file +var _0xe242=['ENUM','integrationTab','newTab','exports','STRING','basic'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xe242,0x9f));var _0x2e24=function(_0x575af6,_0x571f0f){_0x575af6=_0x575af6-0x0;var _0x1c28ca=_0xe242[_0x575af6];return _0x1c28ca;};'use strict';var Sequelize=require('sequelize');module[_0x2e24('0x0')]={'name':{'type':Sequelize[_0x2e24('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2e24('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x2e24('0x2')),'defaultValue':_0x2e24('0x2')},'password':{'type':Sequelize[_0x2e24('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2e24('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2e24('0x3')](_0x2e24('0x4'),_0x2e24('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 71e9e39..e230e33 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 _0x6ee9=['params','findOne','DeskConfiguration','keys','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','priority','remoteUri','username','password','consumerKey','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','%s:%s','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','ValidationError','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','show','intersection','find','create','body'];(function(_0x481812,_0x599a09){var _0xeadbb3=function(_0x48b22e){while(--_0x48b22e){_0x481812['push'](_0x481812['shift']());}};_0xeadbb3(++_0x599a09);}(_0x6ee9,0x18f));var _0x96ee=function(_0x104740,_0x71c28f){_0x104740=_0x104740-0x0;var _0x3ab618=_0x6ee9[_0x104740];return _0x3ab618;};'use strict';var pdf=require(_0x96ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x96ee('0x1'));var zipdir=require(_0x96ee('0x2'));var jsonpatch=require(_0x96ee('0x3'));var rp=require(_0x96ee('0x4'));var moment=require(_0x96ee('0x5'));var BPromise=require(_0x96ee('0x6'));var Mustache=require(_0x96ee('0x7'));var util=require(_0x96ee('0x8'));var path=require(_0x96ee('0x9'));var sox=require(_0x96ee('0xa'));var csv=require(_0x96ee('0xb'));var ejs=require(_0x96ee('0xc'));var fs=require('fs');var _=require(_0x96ee('0xd'));var squel=require('squel');var crypto=require(_0x96ee('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x96ee('0xb'));var querystring=require(_0x96ee('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x96ee('0x10'));var qs=require(_0x96ee('0x11'));var as=require(_0x96ee('0x12'));var hardwareService=require(_0x96ee('0x13'));var logger=require(_0x96ee('0x14'))('api');var utils=require(_0x96ee('0x15'));var config=require('../../config/environment');var db=require(_0x96ee('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x96ee('0x17'));var client=jayson[_0x96ee('0x18')][_0x96ee('0x19')]({'port':0x232a});function checkPasswordPattern(_0x20a8ea,_0x14df0d,_0x21a5b8){if(_0x21a5b8){var _0x11dad4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11dad4['test'](_0x14df0d)){return _0x20a8ea;}else{throw new db['Sequelize'][(_0x96ee('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 _0x20a8ea;}}function respondWithRpcPromise(_0x568b8e,_0x118b3b,_0x3c67a7,_0x3b5b14){return new BPromise(function(_0x1da937,_0x57d721){var _0x406d60=_0x3b5b14||client;return _0x406d60[_0x96ee('0x1b')](_0x568b8e,_0x3c67a7)[_0x96ee('0x1c')](function(_0x3007ff){logger[_0x96ee('0x1d')](_0x96ee('0x1e'),_0x118b3b,'request\x20sent');logger[_0x96ee('0x1f')](_0x96ee('0x20'),_0x118b3b,_0x96ee('0x21'),JSON[_0x96ee('0x22')](_0x3007ff));if(_0x3007ff[_0x96ee('0x23')]){if(_0x3007ff[_0x96ee('0x23')][_0x96ee('0x24')]===0x1f4){logger['error'](_0x96ee('0x1e'),_0x118b3b,_0x3007ff[_0x96ee('0x23')][_0x96ee('0x25')]);return _0x57d721(_0x3007ff[_0x96ee('0x23')]['message']);}logger[_0x96ee('0x23')]('DeskAccount,\x20%s,\x20%s',_0x118b3b,_0x3007ff[_0x96ee('0x23')][_0x96ee('0x25')]);return _0x1da937(_0x3007ff[_0x96ee('0x23')]['message']);}else{logger[_0x96ee('0x1d')]('DeskAccount,\x20%s,\x20%s',_0x118b3b,_0x96ee('0x21'));_0x1da937(_0x3007ff[_0x96ee('0x26')][_0x96ee('0x25')]);}})[_0x96ee('0x27')](function(_0x2ad52b){logger[_0x96ee('0x23')](_0x96ee('0x1e'),_0x118b3b,_0x2ad52b);_0x57d721(_0x2ad52b);});});}function respondWithStatusCode(_0xc65c87,_0x5e3206){_0x5e3206=_0x5e3206||0xcc;return function(_0x16ff0a){if(_0x16ff0a){return _0xc65c87[_0x96ee('0x28')](_0x5e3206);}return _0xc65c87[_0x96ee('0x29')](_0x5e3206)[_0x96ee('0x2a')]();};}function respondWithResult(_0x2ae8ab,_0x132d43){_0x132d43=_0x132d43||0xc8;return function(_0x126a40){if(_0x126a40){return _0x2ae8ab[_0x96ee('0x29')](_0x132d43)[_0x96ee('0x2b')](_0x126a40);}};}function respondWithFilteredResult(_0x180f42,_0x3ccbcb){return function(_0x460c92){if(_0x460c92){var _0x56037a=_0x460c92[_0x96ee('0x2c')],_0x52541c=_0x3ccbcb[_0x96ee('0x2d')],_0x2f22b0=_0x3ccbcb[_0x96ee('0x2d')]+_0x3ccbcb[_0x96ee('0x2e')],_0x2e31a8;if(_0x2f22b0>=_0x56037a){_0x2f22b0=_0x56037a;_0x2e31a8=0xc8;}else{_0x2e31a8=0xce;}_0x180f42[_0x96ee('0x29')](_0x2e31a8);return _0x180f42[_0x96ee('0x2f')](_0x96ee('0x30'),_0x52541c+'-'+_0x2f22b0+'/'+_0x56037a)[_0x96ee('0x2b')](_0x460c92);}return null;};}function patchUpdates(_0x3ec6f4){return function(_0x4955c2){try{jsonpatch[_0x96ee('0x31')](_0x4955c2,_0x3ec6f4,!![]);}catch(_0x41155f){return BPromise['reject'](_0x41155f);}return _0x4955c2[_0x96ee('0x32')]();};}function saveUpdates(_0x366959,_0x40e86e){return function(_0x5b96c5){if(_0x5b96c5){return _0x5b96c5['update'](_0x366959)[_0x96ee('0x1c')](function(_0x2f5ae5){return _0x2f5ae5;});}return null;};}function removeEntity(_0x5ac325,_0x3c043d){return function(_0x3fbc6c){if(_0x3fbc6c){return _0x3fbc6c[_0x96ee('0x33')]()[_0x96ee('0x1c')](function(){_0x5ac325['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3088c5,_0xe42312){return function(_0x5df7f9){if(!_0x5df7f9){_0x3088c5[_0x96ee('0x28')](0x194);}return _0x5df7f9;};}function handleError(_0x358115,_0x86faf7){_0x86faf7=_0x86faf7||0x1f4;return function(_0x38acf3){logger[_0x96ee('0x23')](_0x38acf3[_0x96ee('0x34')]);if(_0x38acf3[_0x96ee('0x35')]){delete _0x38acf3[_0x96ee('0x35')];}_0x358115['status'](_0x86faf7)['send'](_0x38acf3);};}exports[_0x96ee('0x36')]=function(_0x4307d4,_0x2e34eb){var _0x3ff902={},_0x3946b0={},_0x3c38c8={'count':0x0,'rows':[]};var _0x554d2d=_[_0x96ee('0x37')](db[_0x96ee('0x38')][_0x96ee('0x39')],function(_0x389ccb){return{'name':_0x389ccb[_0x96ee('0x3a')],'type':_0x389ccb['type'][_0x96ee('0x3b')]};});_0x3946b0[_0x96ee('0x3c')]=_[_0x96ee('0x37')](_0x554d2d,_0x96ee('0x35'));_0x3946b0[_0x96ee('0x3d')]=_['keys'](_0x4307d4[_0x96ee('0x3d')]);_0x3946b0[_0x96ee('0x3e')]=_['intersection'](_0x3946b0[_0x96ee('0x3c')],_0x3946b0[_0x96ee('0x3d')]);_0x3ff902['attributes']=_['intersection'](_0x3946b0[_0x96ee('0x3c')],qs['fields'](_0x4307d4[_0x96ee('0x3d')][_0x96ee('0x3f')]));_0x3ff902[_0x96ee('0x40')]=_0x3ff902['attributes'][_0x96ee('0x41')]?_0x3ff902['attributes']:_0x3946b0['model'];if(!_0x4307d4['query'][_0x96ee('0x42')](_0x96ee('0x43'))){_0x3ff902['limit']=qs[_0x96ee('0x2e')](_0x4307d4[_0x96ee('0x3d')][_0x96ee('0x2e')]);_0x3ff902[_0x96ee('0x2d')]=qs[_0x96ee('0x2d')](_0x4307d4[_0x96ee('0x3d')][_0x96ee('0x2d')]);}_0x3ff902[_0x96ee('0x44')]=qs[_0x96ee('0x45')](_0x4307d4[_0x96ee('0x3d')]['sort']);_0x3ff902['where']=qs[_0x96ee('0x3e')](_[_0x96ee('0x46')](_0x4307d4[_0x96ee('0x3d')],_0x3946b0[_0x96ee('0x3e')]),_0x554d2d);if(_0x4307d4[_0x96ee('0x3d')][_0x96ee('0x47')]){_0x3ff902[_0x96ee('0x48')]=_[_0x96ee('0x49')](_0x3ff902[_0x96ee('0x48')],{'$or':_[_0x96ee('0x37')](_0x554d2d,function(_0x7f9904){if(_0x7f9904[_0x96ee('0x4a')]!=='VIRTUAL'){var _0x1937e8={};_0x1937e8[_0x7f9904[_0x96ee('0x35')]]={'$like':'%'+_0x4307d4[_0x96ee('0x3d')]['filter']+'%'};return _0x1937e8;}})});}_0x3ff902=_[_0x96ee('0x49')]({},_0x3ff902,_0x4307d4[_0x96ee('0x4b')]);var _0x2a4072={'where':_0x3ff902[_0x96ee('0x48')]};return db[_0x96ee('0x38')][_0x96ee('0x2c')](_0x2a4072)[_0x96ee('0x1c')](function(_0x1cdb82){_0x3c38c8[_0x96ee('0x2c')]=_0x1cdb82;if(_0x4307d4[_0x96ee('0x3d')][_0x96ee('0x4c')]){_0x3ff902[_0x96ee('0x4d')]=[{'all':!![]}];}return db[_0x96ee('0x38')][_0x96ee('0x4e')](_0x3ff902);})['then'](function(_0x207b8f){_0x3c38c8[_0x96ee('0x4f')]=_0x207b8f;return _0x3c38c8;})[_0x96ee('0x1c')](respondWithFilteredResult(_0x2e34eb,_0x3ff902))[_0x96ee('0x27')](handleError(_0x2e34eb,null));};exports[_0x96ee('0x50')]=function(_0x2a858c,_0x1d89ab){var _0x2a8f1={'raw':![],'where':{'id':_0x2a858c['params']['id']}},_0x4a9bfa={};_0x4a9bfa[_0x96ee('0x3c')]=_['keys'](db[_0x96ee('0x38')][_0x96ee('0x39')]);_0x4a9bfa[_0x96ee('0x3d')]=_['keys'](_0x2a858c['query']);_0x4a9bfa['filters']=_[_0x96ee('0x51')](_0x4a9bfa[_0x96ee('0x3c')],_0x4a9bfa[_0x96ee('0x3d')]);_0x2a8f1[_0x96ee('0x40')]=_[_0x96ee('0x51')](_0x4a9bfa['model'],qs[_0x96ee('0x3f')](_0x2a858c[_0x96ee('0x3d')][_0x96ee('0x3f')]));_0x2a8f1[_0x96ee('0x40')]=_0x2a8f1[_0x96ee('0x40')]['length']?_0x2a8f1[_0x96ee('0x40')]:_0x4a9bfa[_0x96ee('0x3c')];if(_0x2a858c[_0x96ee('0x3d')][_0x96ee('0x4c')]){_0x2a8f1[_0x96ee('0x4d')]=[{'all':!![]}];}_0x2a8f1=_[_0x96ee('0x49')]({},_0x2a8f1,_0x2a858c[_0x96ee('0x4b')]);return db[_0x96ee('0x38')][_0x96ee('0x52')](_0x2a8f1)[_0x96ee('0x1c')](handleEntityNotFound(_0x1d89ab,null))[_0x96ee('0x1c')](respondWithResult(_0x1d89ab,null))[_0x96ee('0x27')](handleError(_0x1d89ab,null));};exports['create']=function(_0x164db1,_0x36e452){return db[_0x96ee('0x38')][_0x96ee('0x53')](_0x164db1[_0x96ee('0x54')],{})[_0x96ee('0x1c')](respondWithResult(_0x36e452,0xc9))[_0x96ee('0x27')](handleError(_0x36e452,null));};exports['update']=function(_0x485358,_0x3304a4){if(_0x485358[_0x96ee('0x54')]['id']){delete _0x485358['body']['id'];}return db[_0x96ee('0x38')][_0x96ee('0x52')]({'where':{'id':_0x485358['params']['id']}})[_0x96ee('0x1c')](handleEntityNotFound(_0x3304a4,null))[_0x96ee('0x1c')](saveUpdates(_0x485358[_0x96ee('0x54')],null))['then'](respondWithResult(_0x3304a4,null))[_0x96ee('0x27')](handleError(_0x3304a4,null));};exports[_0x96ee('0x33')]=function(_0xfce2e,_0x3d9995){return db['DeskAccount'][_0x96ee('0x52')]({'where':{'id':_0xfce2e[_0x96ee('0x55')]['id']}})[_0x96ee('0x1c')](handleEntityNotFound(_0x3d9995,null))[_0x96ee('0x1c')](removeEntity(_0x3d9995,null))[_0x96ee('0x27')](handleError(_0x3d9995,null));};exports['getConfigurations']=function(_0x470575,_0x1263a5,_0x380367){var _0x1ca283={};var _0x2dc6a9={};var _0x53b15c;var _0xf4ced1;return db['DeskAccount'][_0x96ee('0x56')]({'where':{'id':_0x470575['params']['id']}})[_0x96ee('0x1c')](handleEntityNotFound(_0x1263a5,null))[_0x96ee('0x1c')](function(_0x442345){if(_0x442345){_0x53b15c=_0x442345;_0x2dc6a9['model']=_['keys'](db[_0x96ee('0x57')][_0x96ee('0x39')]);_0x2dc6a9['query']=_[_0x96ee('0x58')](_0x470575['query']);_0x2dc6a9[_0x96ee('0x3e')]=_['intersection'](_0x2dc6a9[_0x96ee('0x3c')],_0x2dc6a9[_0x96ee('0x3d')]);_0x1ca283[_0x96ee('0x40')]=_[_0x96ee('0x51')](_0x2dc6a9['model'],qs[_0x96ee('0x3f')](_0x470575[_0x96ee('0x3d')]['fields']));_0x1ca283[_0x96ee('0x40')]=_0x1ca283[_0x96ee('0x40')][_0x96ee('0x41')]?_0x1ca283[_0x96ee('0x40')]:_0x2dc6a9[_0x96ee('0x3c')];_0x1ca283[_0x96ee('0x44')]=qs[_0x96ee('0x45')](_0x470575['query'][_0x96ee('0x45')]);_0x1ca283[_0x96ee('0x48')]=qs[_0x96ee('0x3e')](_['pick'](_0x470575['query'],_0x2dc6a9[_0x96ee('0x3e')]));if(_0x470575[_0x96ee('0x3d')][_0x96ee('0x47')]){_0x1ca283[_0x96ee('0x48')]=_[_0x96ee('0x49')](_0x1ca283['where'],{'$or':_[_0x96ee('0x37')](_0x1ca283[_0x96ee('0x40')],function(_0x1f9b7b){var _0x2cc0c7={};_0x2cc0c7[_0x1f9b7b]={'$like':'%'+_0x470575[_0x96ee('0x3d')][_0x96ee('0x47')]+'%'};return _0x2cc0c7;})});}_0x1ca283=_[_0x96ee('0x49')]({},_0x1ca283,_0x470575[_0x96ee('0x4b')]);return _0x53b15c[_0x96ee('0x59')](_0x1ca283);}})[_0x96ee('0x1c')](function(_0x6a2dca){if(_0x6a2dca){_0xf4ced1=_0x6a2dca[_0x96ee('0x41')];if(!_0x470575['query'][_0x96ee('0x42')](_0x96ee('0x43'))){_0x1ca283[_0x96ee('0x2e')]=qs[_0x96ee('0x2e')](_0x470575[_0x96ee('0x3d')][_0x96ee('0x2e')]);_0x1ca283[_0x96ee('0x2d')]=qs[_0x96ee('0x2d')](_0x470575[_0x96ee('0x3d')][_0x96ee('0x2d')]);}return _0x53b15c[_0x96ee('0x59')](_0x1ca283);}})[_0x96ee('0x1c')](function(_0xc6cf25){if(_0xc6cf25){return _0xc6cf25?{'count':_0xf4ced1,'rows':_0xc6cf25}:null;}})[_0x96ee('0x1c')](respondWithResult(_0x1263a5,null))[_0x96ee('0x27')](handleError(_0x1263a5,null));};exports[_0x96ee('0x5a')]=function(_0x2e170c,_0x5c8ed8,_0x5e77a0){if(_0x2e170c[_0x96ee('0x54')]['id']){delete _0x2e170c[_0x96ee('0x54')]['id'];}return db['DeskAccount'][_0x96ee('0x56')]({'where':{'id':_0x2e170c[_0x96ee('0x55')]['id']}})[_0x96ee('0x1c')](handleEntityNotFound(_0x5c8ed8,null))['then'](function(_0x392ec0){if(_0x392ec0){_0x2e170c['body'][_0x96ee('0x5b')]=_0x392ec0['id'];_0x2e170c[_0x96ee('0x54')][_0x96ee('0x5c')]=integrations[_0x96ee('0x5d')](_0x2e170c['body'][_0x96ee('0x5e')],_0x2e170c[_0x96ee('0x54')]['type']);_0x2e170c['body'][_0x96ee('0x5f')]=integrations['getDescriptions'](_0x2e170c[_0x96ee('0x54')][_0x96ee('0x5e')],_0x2e170c[_0x96ee('0x54')][_0x96ee('0x4a')]);return db[_0x96ee('0x57')][_0x96ee('0x53')](_0x2e170c[_0x96ee('0x54')],{'include':[{'model':db[_0x96ee('0x60')],'as':_0x96ee('0x5c')},{'model':db[_0x96ee('0x60')],'as':'Descriptions'}]});}return null;})[_0x96ee('0x1c')](respondWithResult(_0x5c8ed8,null))[_0x96ee('0x27')](handleError(_0x5c8ed8,null));};exports['getFields']=function(_0x4fb38a,_0x141251,_0x13a3c6){var _0x583e9e=[{'name':_0x96ee('0x61'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x48709c='';return db[_0x96ee('0x38')]['findOne']({'where':{'id':_0x4fb38a['params']['id']},'attributes':['id',_0x96ee('0x62'),'authType',_0x96ee('0x63'),_0x96ee('0x64'),_0x96ee('0x65'),'consumerSecret',_0x96ee('0x66'),_0x96ee('0x67')]})[_0x96ee('0x1c')](handleEntityNotFound(_0x141251,null))[_0x96ee('0x1c')](function(_0x5567e6){if(_0x5567e6){_0x48709c=_0x5567e6[_0x96ee('0x62')];var _0x2276f5=_0x48709c[_0x96ee('0x68')](-0x1);if(_0x2276f5==='/'){_0x48709c=_0x48709c['substring'](0x0,_0x48709c[_0x96ee('0x69')](_0x2276f5));}var _0x15dd4c={'method':_0x96ee('0x6a'),'uri':util[_0x96ee('0x6b')](_0x96ee('0x6c'),_0x48709c),'headers':{'Content-Type':_0x96ee('0x6d'),'Accept':_0x96ee('0x6d')},'json':!![]};if(_0x5567e6['authType']==='basic'){_0x15dd4c[_0x96ee('0x6e')][_0x96ee('0x6f')]=util[_0x96ee('0x6b')]('Basic\x20%s',new Buffer(util[_0x96ee('0x6b')](_0x96ee('0x70'),_0x5567e6[_0x96ee('0x63')],_0x5567e6[_0x96ee('0x64')]))['toString']('base64'));}return rp(_0x15dd4c)[_0x96ee('0x1c')](function(_0x383658){return _0x583e9e[_0x96ee('0x71')](_[_0x96ee('0x37')](_0x383658[_0x96ee('0x72')][_0x96ee('0x73')],function(_0x2bf045){return{'id':_0x2bf045[_0x96ee('0x35')],'name':_0x2bf045[_0x96ee('0x35')],'type':_0x2bf045['type'],'active':_0x2bf045[_0x96ee('0x74')],'label':_0x2bf045[_0x96ee('0x75')],'custom':!![]};}));});}})[_0x96ee('0x1c')](function(_0x191048){return{'count':_0x191048[_0x96ee('0x41')],'rows':_0x191048};})[_0x96ee('0x1c')](respondWithResult(_0x141251,null))[_0x96ee('0x27')](function(_0x34c9ff){var _0x2ff208=_0x4fb38a[_0x96ee('0x3d')][_0x96ee('0x76')]?0x1f4:_0x34c9ff['statusCode']||0x1f4;logger[_0x96ee('0x23')](_0x96ee('0x77'),'getFields',_0x2ff208,JSON['stringify'](_0x34c9ff));delete _0x34c9ff[_0x96ee('0x35')];if(_0x2ff208===0x191){_0x2ff208=0x190;}_0x141251[_0x96ee('0x29')](_0x2ff208)[_0x96ee('0x78')](_0x4fb38a['query'][_0x96ee('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x34c9ff['statusCode']}:_0x34c9ff);});}; \ No newline at end of file +var _0xac11=['GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','concat','_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','length','create','body','find','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','findOne','authType','username','consumerKey','consumerSecret','token','remoteUri','substring','lastIndexOf'];(function(_0x2d8649,_0x304d4a){var _0x347e76=function(_0x348851){while(--_0x348851){_0x2d8649['push'](_0x2d8649['shift']());}};_0x347e76(++_0x304d4a);}(_0xac11,0x195));var _0x1ac1=function(_0x289a1a,_0x31db32){_0x289a1a=_0x289a1a-0x0;var _0x445de3=_0xac11[_0x289a1a];return _0x445de3;};'use strict';var pdf=require(_0x1ac1('0x0'));var emlformat=require(_0x1ac1('0x1'));var rimraf=require(_0x1ac1('0x2'));var zipdir=require(_0x1ac1('0x3'));var jsonpatch=require(_0x1ac1('0x4'));var rp=require(_0x1ac1('0x5'));var moment=require(_0x1ac1('0x6'));var BPromise=require(_0x1ac1('0x7'));var Mustache=require(_0x1ac1('0x8'));var util=require(_0x1ac1('0x9'));var path=require(_0x1ac1('0xa'));var sox=require(_0x1ac1('0xb'));var csv=require('to-csv');var ejs=require(_0x1ac1('0xc'));var fs=require('fs');var _=require(_0x1ac1('0xd'));var squel=require(_0x1ac1('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ac1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1ac1('0x10'));var Papa=require(_0x1ac1('0x11'));var Redis=require(_0x1ac1('0x12'));var authService=require(_0x1ac1('0x13'));var qs=require(_0x1ac1('0x14'));var as=require(_0x1ac1('0x15'));var hardwareService=require(_0x1ac1('0x16'));var logger=require(_0x1ac1('0x17'))(_0x1ac1('0x18'));var utils=require('../../config/utils');var config=require(_0x1ac1('0x19'));var db=require(_0x1ac1('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x1ac1('0x1b')][_0x1ac1('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4b2f79,_0x451aea,_0x4ded37){if(_0x4ded37){var _0x5ef200=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ef200[_0x1ac1('0x1d')](_0x451aea)){return _0x4b2f79;}else{throw new db[(_0x1ac1('0x1e'))][(_0x1ac1('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 _0x4b2f79;}}function respondWithRpcPromise(_0x41008c,_0x32270e,_0x431cd5,_0x328096){return new BPromise(function(_0x3c5d38,_0x2e2525){var _0x2b3128=_0x328096||client;return _0x2b3128[_0x1ac1('0x20')](_0x41008c,_0x431cd5)[_0x1ac1('0x21')](function(_0x56b7fa){logger['info'](_0x1ac1('0x22'),_0x32270e,_0x1ac1('0x23'));logger[_0x1ac1('0x24')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x32270e,_0x1ac1('0x23'),JSON['stringify'](_0x56b7fa));if(_0x56b7fa[_0x1ac1('0x25')]){if(_0x56b7fa['error']['code']===0x1f4){logger[_0x1ac1('0x25')](_0x1ac1('0x22'),_0x32270e,_0x56b7fa['error']['message']);return _0x2e2525(_0x56b7fa[_0x1ac1('0x25')][_0x1ac1('0x26')]);}logger[_0x1ac1('0x25')](_0x1ac1('0x22'),_0x32270e,_0x56b7fa[_0x1ac1('0x25')][_0x1ac1('0x26')]);return _0x3c5d38(_0x56b7fa['error']['message']);}else{logger['info'](_0x1ac1('0x22'),_0x32270e,_0x1ac1('0x23'));_0x3c5d38(_0x56b7fa[_0x1ac1('0x27')][_0x1ac1('0x26')]);}})[_0x1ac1('0x28')](function(_0x42cbc8){logger[_0x1ac1('0x25')]('DeskAccount,\x20%s,\x20%s',_0x32270e,_0x42cbc8);_0x2e2525(_0x42cbc8);});});}function respondWithStatusCode(_0x48178b,_0xbccdb){_0xbccdb=_0xbccdb||0xcc;return function(_0x4fffe5){if(_0x4fffe5){return _0x48178b['sendStatus'](_0xbccdb);}return _0x48178b['status'](_0xbccdb)[_0x1ac1('0x29')]();};}function respondWithResult(_0x447f1b,_0x5e76fd){_0x5e76fd=_0x5e76fd||0xc8;return function(_0xb95a4a){if(_0xb95a4a){return _0x447f1b[_0x1ac1('0x2a')](_0x5e76fd)[_0x1ac1('0x2b')](_0xb95a4a);}};}function respondWithFilteredResult(_0x14ca6e,_0x4f1d1d){return function(_0x3523ba){if(_0x3523ba){var _0x30d5dc=_0x3523ba['count'],_0x584642=_0x4f1d1d[_0x1ac1('0x2c')],_0x1b5190=_0x4f1d1d[_0x1ac1('0x2c')]+_0x4f1d1d['limit'],_0x5298ba;if(_0x1b5190>=_0x30d5dc){_0x1b5190=_0x30d5dc;_0x5298ba=0xc8;}else{_0x5298ba=0xce;}_0x14ca6e[_0x1ac1('0x2a')](_0x5298ba);return _0x14ca6e[_0x1ac1('0x2d')](_0x1ac1('0x2e'),_0x584642+'-'+_0x1b5190+'/'+_0x30d5dc)[_0x1ac1('0x2b')](_0x3523ba);}return null;};}function patchUpdates(_0x1dea0d){return function(_0xeb14f){try{jsonpatch[_0x1ac1('0x2f')](_0xeb14f,_0x1dea0d,!![]);}catch(_0x528599){return BPromise[_0x1ac1('0x30')](_0x528599);}return _0xeb14f[_0x1ac1('0x31')]();};}function saveUpdates(_0x120eb8,_0x5be17f){return function(_0x38cd11){if(_0x38cd11){return _0x38cd11[_0x1ac1('0x32')](_0x120eb8)[_0x1ac1('0x21')](function(_0x3d3363){return _0x3d3363;});}return null;};}function removeEntity(_0x776f2b,_0x125fa6){return function(_0x4da947){if(_0x4da947){return _0x4da947[_0x1ac1('0x33')]()[_0x1ac1('0x21')](function(){_0x776f2b[_0x1ac1('0x2a')](0xcc)[_0x1ac1('0x29')]();});}};}function handleEntityNotFound(_0x5c2be1,_0x3eceaa){return function(_0x38113f){if(!_0x38113f){_0x5c2be1[_0x1ac1('0x34')](0x194);}return _0x38113f;};}function handleError(_0x433204,_0x576be1){_0x576be1=_0x576be1||0x1f4;return function(_0x15ae38){logger[_0x1ac1('0x25')](_0x15ae38['stack']);if(_0x15ae38['name']){delete _0x15ae38[_0x1ac1('0x35')];}_0x433204[_0x1ac1('0x2a')](_0x576be1)['send'](_0x15ae38);};}exports[_0x1ac1('0x36')]=function(_0x398bb9,_0x3c88c9){var _0x1be879={},_0x42c0e1={},_0x490258={'count':0x0,'rows':[]};var _0x29befb=_[_0x1ac1('0x37')](db[_0x1ac1('0x38')][_0x1ac1('0x39')],function(_0x12d002){return{'name':_0x12d002[_0x1ac1('0x3a')],'type':_0x12d002['type'][_0x1ac1('0x3b')]};});_0x42c0e1[_0x1ac1('0x3c')]=_[_0x1ac1('0x37')](_0x29befb,_0x1ac1('0x35'));_0x42c0e1[_0x1ac1('0x3d')]=_['keys'](_0x398bb9[_0x1ac1('0x3d')]);_0x42c0e1[_0x1ac1('0x3e')]=_[_0x1ac1('0x3f')](_0x42c0e1[_0x1ac1('0x3c')],_0x42c0e1['query']);_0x1be879['attributes']=_[_0x1ac1('0x3f')](_0x42c0e1[_0x1ac1('0x3c')],qs['fields'](_0x398bb9[_0x1ac1('0x3d')][_0x1ac1('0x40')]));_0x1be879['attributes']=_0x1be879[_0x1ac1('0x41')]['length']?_0x1be879[_0x1ac1('0x41')]:_0x42c0e1[_0x1ac1('0x3c')];if(!_0x398bb9[_0x1ac1('0x3d')][_0x1ac1('0x42')](_0x1ac1('0x43'))){_0x1be879[_0x1ac1('0x44')]=qs[_0x1ac1('0x44')](_0x398bb9[_0x1ac1('0x3d')][_0x1ac1('0x44')]);_0x1be879[_0x1ac1('0x2c')]=qs['offset'](_0x398bb9[_0x1ac1('0x3d')][_0x1ac1('0x2c')]);}_0x1be879[_0x1ac1('0x45')]=qs['sort'](_0x398bb9[_0x1ac1('0x3d')][_0x1ac1('0x46')]);_0x1be879[_0x1ac1('0x47')]=qs[_0x1ac1('0x3e')](_[_0x1ac1('0x48')](_0x398bb9['query'],_0x42c0e1['filters']),_0x29befb);if(_0x398bb9[_0x1ac1('0x3d')][_0x1ac1('0x49')]){_0x1be879['where']=_[_0x1ac1('0x4a')](_0x1be879[_0x1ac1('0x47')],{'$or':_['map'](_0x29befb,function(_0x4cf94e){if(_0x4cf94e[_0x1ac1('0x4b')]!==_0x1ac1('0x4c')){var _0x35c558={};_0x35c558[_0x4cf94e[_0x1ac1('0x35')]]={'$like':'%'+_0x398bb9[_0x1ac1('0x3d')]['filter']+'%'};return _0x35c558;}})});}_0x1be879=_[_0x1ac1('0x4a')]({},_0x1be879,_0x398bb9[_0x1ac1('0x4d')]);var _0x861081={'where':_0x1be879[_0x1ac1('0x47')]};return db[_0x1ac1('0x38')][_0x1ac1('0x4e')](_0x861081)['then'](function(_0xc9ae02){_0x490258[_0x1ac1('0x4e')]=_0xc9ae02;if(_0x398bb9[_0x1ac1('0x3d')][_0x1ac1('0x4f')]){_0x1be879[_0x1ac1('0x50')]=[{'all':!![]}];}return db[_0x1ac1('0x38')][_0x1ac1('0x51')](_0x1be879);})[_0x1ac1('0x21')](function(_0x8e6412){_0x490258[_0x1ac1('0x52')]=_0x8e6412;return _0x490258;})[_0x1ac1('0x21')](respondWithFilteredResult(_0x3c88c9,_0x1be879))['catch'](handleError(_0x3c88c9,null));};exports[_0x1ac1('0x53')]=function(_0x5c5016,_0x5e7a7a){var _0x16cf62={'raw':![],'where':{'id':_0x5c5016[_0x1ac1('0x54')]['id']}},_0x421163={};_0x421163[_0x1ac1('0x3c')]=_[_0x1ac1('0x55')](db['DeskAccount']['rawAttributes']);_0x421163[_0x1ac1('0x3d')]=_[_0x1ac1('0x55')](_0x5c5016['query']);_0x421163[_0x1ac1('0x3e')]=_['intersection'](_0x421163[_0x1ac1('0x3c')],_0x421163[_0x1ac1('0x3d')]);_0x16cf62[_0x1ac1('0x41')]=_[_0x1ac1('0x3f')](_0x421163[_0x1ac1('0x3c')],qs['fields'](_0x5c5016['query'][_0x1ac1('0x40')]));_0x16cf62[_0x1ac1('0x41')]=_0x16cf62[_0x1ac1('0x41')][_0x1ac1('0x56')]?_0x16cf62[_0x1ac1('0x41')]:_0x421163[_0x1ac1('0x3c')];if(_0x5c5016[_0x1ac1('0x3d')][_0x1ac1('0x4f')]){_0x16cf62[_0x1ac1('0x50')]=[{'all':!![]}];}_0x16cf62=_[_0x1ac1('0x4a')]({},_0x16cf62,_0x5c5016[_0x1ac1('0x4d')]);return db[_0x1ac1('0x38')]['find'](_0x16cf62)[_0x1ac1('0x21')](handleEntityNotFound(_0x5e7a7a,null))[_0x1ac1('0x21')](respondWithResult(_0x5e7a7a,null))[_0x1ac1('0x28')](handleError(_0x5e7a7a,null));};exports[_0x1ac1('0x57')]=function(_0x2186f8,_0x15ddc8){return db[_0x1ac1('0x38')][_0x1ac1('0x57')](_0x2186f8[_0x1ac1('0x58')],{})[_0x1ac1('0x21')](respondWithResult(_0x15ddc8,0xc9))['catch'](handleError(_0x15ddc8,null));};exports['update']=function(_0x1ae047,_0x3fc1c9){if(_0x1ae047[_0x1ac1('0x58')]['id']){delete _0x1ae047['body']['id'];}return db[_0x1ac1('0x38')][_0x1ac1('0x59')]({'where':{'id':_0x1ae047[_0x1ac1('0x54')]['id']}})['then'](handleEntityNotFound(_0x3fc1c9,null))[_0x1ac1('0x21')](saveUpdates(_0x1ae047[_0x1ac1('0x58')],null))['then'](respondWithResult(_0x3fc1c9,null))[_0x1ac1('0x28')](handleError(_0x3fc1c9,null));};exports[_0x1ac1('0x33')]=function(_0x2c9801,_0x4c101e){return db[_0x1ac1('0x38')][_0x1ac1('0x59')]({'where':{'id':_0x2c9801[_0x1ac1('0x54')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x4c101e,null))[_0x1ac1('0x21')](removeEntity(_0x4c101e,null))[_0x1ac1('0x28')](handleError(_0x4c101e,null));};exports[_0x1ac1('0x5a')]=function(_0x237387,_0x126099,_0x9aa7bf){var _0x20fad4={};var _0x414001={};var _0x112b79;var _0x49447b;return db[_0x1ac1('0x38')]['findOne']({'where':{'id':_0x237387[_0x1ac1('0x54')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x126099,null))[_0x1ac1('0x21')](function(_0x277686){if(_0x277686){_0x112b79=_0x277686;_0x414001[_0x1ac1('0x3c')]=_[_0x1ac1('0x55')](db['DeskConfiguration'][_0x1ac1('0x39')]);_0x414001[_0x1ac1('0x3d')]=_['keys'](_0x237387[_0x1ac1('0x3d')]);_0x414001['filters']=_[_0x1ac1('0x3f')](_0x414001['model'],_0x414001[_0x1ac1('0x3d')]);_0x20fad4[_0x1ac1('0x41')]=_[_0x1ac1('0x3f')](_0x414001[_0x1ac1('0x3c')],qs[_0x1ac1('0x40')](_0x237387['query']['fields']));_0x20fad4['attributes']=_0x20fad4[_0x1ac1('0x41')][_0x1ac1('0x56')]?_0x20fad4['attributes']:_0x414001[_0x1ac1('0x3c')];_0x20fad4[_0x1ac1('0x45')]=qs[_0x1ac1('0x46')](_0x237387[_0x1ac1('0x3d')]['sort']);_0x20fad4[_0x1ac1('0x47')]=qs[_0x1ac1('0x3e')](_[_0x1ac1('0x48')](_0x237387[_0x1ac1('0x3d')],_0x414001[_0x1ac1('0x3e')]));if(_0x237387[_0x1ac1('0x3d')][_0x1ac1('0x49')]){_0x20fad4['where']=_['merge'](_0x20fad4[_0x1ac1('0x47')],{'$or':_['map'](_0x20fad4[_0x1ac1('0x41')],function(_0x10ff28){var _0x51fec4={};_0x51fec4[_0x10ff28]={'$like':'%'+_0x237387['query'][_0x1ac1('0x49')]+'%'};return _0x51fec4;})});}_0x20fad4=_[_0x1ac1('0x4a')]({},_0x20fad4,_0x237387['options']);return _0x112b79['getConfigurations'](_0x20fad4);}})['then'](function(_0x5a4bd1){if(_0x5a4bd1){_0x49447b=_0x5a4bd1[_0x1ac1('0x56')];if(!_0x237387[_0x1ac1('0x3d')]['hasOwnProperty'](_0x1ac1('0x43'))){_0x20fad4[_0x1ac1('0x44')]=qs[_0x1ac1('0x44')](_0x237387[_0x1ac1('0x3d')][_0x1ac1('0x44')]);_0x20fad4['offset']=qs[_0x1ac1('0x2c')](_0x237387[_0x1ac1('0x3d')][_0x1ac1('0x2c')]);}return _0x112b79['getConfigurations'](_0x20fad4);}})[_0x1ac1('0x21')](function(_0x5a0b39){if(_0x5a0b39){return _0x5a0b39?{'count':_0x49447b,'rows':_0x5a0b39}:null;}})[_0x1ac1('0x21')](respondWithResult(_0x126099,null))['catch'](handleError(_0x126099,null));};exports[_0x1ac1('0x5b')]=function(_0x22d915,_0x29f9a1,_0x3e52db){if(_0x22d915[_0x1ac1('0x58')]['id']){delete _0x22d915[_0x1ac1('0x58')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x22d915[_0x1ac1('0x54')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x29f9a1,null))[_0x1ac1('0x21')](function(_0x3fb5b4){if(_0x3fb5b4){_0x22d915[_0x1ac1('0x58')][_0x1ac1('0x5c')]=_0x3fb5b4['id'];_0x22d915[_0x1ac1('0x58')][_0x1ac1('0x5d')]=integrations[_0x1ac1('0x5e')](_0x22d915['body'][_0x1ac1('0x5f')],_0x22d915['body'][_0x1ac1('0x4b')]);_0x22d915['body'][_0x1ac1('0x60')]=integrations[_0x1ac1('0x61')](_0x22d915['body']['channel'],_0x22d915[_0x1ac1('0x58')][_0x1ac1('0x4b')]);return db[_0x1ac1('0x62')][_0x1ac1('0x57')](_0x22d915['body'],{'include':[{'model':db[_0x1ac1('0x63')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x1ac1('0x60')}]});}return null;})[_0x1ac1('0x21')](respondWithResult(_0x29f9a1,null))[_0x1ac1('0x28')](handleError(_0x29f9a1,null));};exports[_0x1ac1('0x64')]=function(_0x121a1e,_0xfec64a,_0x3c0027){var _0x16d369=[{'name':_0x1ac1('0x65'),'label':_0x1ac1('0x65'),'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 _0x1d010f='';return db[_0x1ac1('0x38')][_0x1ac1('0x66')]({'where':{'id':_0x121a1e[_0x1ac1('0x54')]['id']},'attributes':['id','remoteUri',_0x1ac1('0x67'),_0x1ac1('0x68'),'password',_0x1ac1('0x69'),_0x1ac1('0x6a'),_0x1ac1('0x6b'),'tokenSecret']})[_0x1ac1('0x21')](handleEntityNotFound(_0xfec64a,null))[_0x1ac1('0x21')](function(_0x2d0ce7){if(_0x2d0ce7){_0x1d010f=_0x2d0ce7[_0x1ac1('0x6c')];var _0x387152=_0x1d010f['slice'](-0x1);if(_0x387152==='/'){_0x1d010f=_0x1d010f[_0x1ac1('0x6d')](0x0,_0x1d010f[_0x1ac1('0x6e')](_0x387152));}var _0x4d016b={'method':_0x1ac1('0x6f'),'uri':util[_0x1ac1('0x70')](_0x1ac1('0x71'),_0x1d010f),'headers':{'Content-Type':_0x1ac1('0x72'),'Accept':'application/json'},'json':!![]};if(_0x2d0ce7[_0x1ac1('0x67')]===_0x1ac1('0x73')){_0x4d016b[_0x1ac1('0x74')][_0x1ac1('0x75')]=util['format'](_0x1ac1('0x76'),new Buffer(util[_0x1ac1('0x70')](_0x1ac1('0x77'),_0x2d0ce7[_0x1ac1('0x68')],_0x2d0ce7[_0x1ac1('0x78')]))['toString']('base64'));}return rp(_0x4d016b)[_0x1ac1('0x21')](function(_0x49df42){return _0x16d369[_0x1ac1('0x79')](_['map'](_0x49df42[_0x1ac1('0x7a')][_0x1ac1('0x7b')],function(_0x2f971c){return{'id':_0x2f971c[_0x1ac1('0x35')],'name':_0x2f971c[_0x1ac1('0x35')],'type':_0x2f971c['type'],'active':_0x2f971c['active'],'label':_0x2f971c[_0x1ac1('0x7c')],'custom':!![]};}));});}})[_0x1ac1('0x21')](function(_0x11b8a7){return{'count':_0x11b8a7[_0x1ac1('0x56')],'rows':_0x11b8a7};})[_0x1ac1('0x21')](respondWithResult(_0xfec64a,null))[_0x1ac1('0x28')](function(_0x5c6678){var _0x157600=_0x121a1e['query']['test']?0x1f4:_0x5c6678[_0x1ac1('0x7d')]||0x1f4;logger[_0x1ac1('0x25')](_0x1ac1('0x7e'),_0x1ac1('0x64'),_0x157600,JSON[_0x1ac1('0x7f')](_0x5c6678));delete _0x5c6678['name'];if(_0x157600===0x191){_0x157600=0x190;}_0xfec64a[_0x1ac1('0x2a')](_0x157600)[_0x1ac1('0x80')](_0x121a1e[_0x1ac1('0x3d')][_0x1ac1('0x1d')]?{'message':'Wrong\x20credentials','statusCode':_0x5c6678['statusCode']}:_0x5c6678);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 0094bb1..ddc03e0 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 _0x9b34=['path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','moment','bluebird','request-promise'];(function(_0x3e451f,_0x10500d){var _0x57978f=function(_0x52f960){while(--_0x52f960){_0x3e451f['push'](_0x3e451f['shift']());}};_0x57978f(++_0x10500d);}(_0x9b34,0xd4));var _0x49b3=function(_0x6d6332,_0x36425f){_0x6d6332=_0x6d6332-0x0;var _0x2d354e=_0x9b34[_0x6d6332];return _0x2d354e;};'use strict';var _=require('lodash');var util=require(_0x49b3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x49b3('0x1'));var BPromise=require(_0x49b3('0x2'));var rp=require(_0x49b3('0x3'));var fs=require('fs');var path=require(_0x49b3('0x4'));var rimraf=require(_0x49b3('0x5'));var config=require('../../config/environment');var attributes=require(_0x49b3('0x6'));var integrations=require(_0x49b3('0x7'));module[_0x49b3('0x8')]=function(_0x4a6716,_0x3ea3ed){return _0x4a6716[_0x49b3('0x9')](_0x49b3('0xa'),attributes,{'tableName':_0x49b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8766=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x246584,_0x4836c2){var _0x5a94c1=function(_0x288bc1){while(--_0x288bc1){_0x246584['push'](_0x246584['shift']());}};_0x5a94c1(++_0x4836c2);}(_0x8766,0x7b));var _0x6876=function(_0x49c0aa,_0xe1de48){_0x49c0aa=_0x49c0aa-0x0;var _0x1fec56=_0x8766[_0x49c0aa];return _0x1fec56;};'use strict';var _=require(_0x6876('0x0'));var util=require(_0x6876('0x1'));var logger=require(_0x6876('0x2'))('api');var moment=require(_0x6876('0x3'));var BPromise=require(_0x6876('0x4'));var rp=require(_0x6876('0x5'));var fs=require('fs');var path=require(_0x6876('0x6'));var rimraf=require(_0x6876('0x7'));var config=require(_0x6876('0x8'));var attributes=require(_0x6876('0x9'));var integrations=require(_0x6876('0xa'));module[_0x6876('0xb')]=function(_0x579b6b,_0xb584fb){return _0x579b6b['define'](_0x6876('0xc'),attributes,{'tableName':_0x6876('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index f5d591e..4564d47 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 _0x5778=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','attributes','limit','include','map','model','ShowDeskAccount','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','then'];(function(_0x157241,_0x2cc891){var _0x4d85bc=function(_0x146a9b){while(--_0x146a9b){_0x157241['push'](_0x157241['shift']());}};_0x4d85bc(++_0x2cc891);}(_0x5778,0x196));var _0x8577=function(_0x29fc26,_0x2d112a){_0x29fc26=_0x29fc26-0x0;var _0x21a90c=_0x5778[_0x29fc26];return _0x21a90c;};'use strict';var _=require(_0x8577('0x0'));var util=require(_0x8577('0x1'));var moment=require(_0x8577('0x2'));var BPromise=require('bluebird');var rs=require(_0x8577('0x3'));var fs=require('fs');var Redis=require(_0x8577('0x4'));var db=require(_0x8577('0x5'))['db'];var utils=require(_0x8577('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8577('0x7'));var client=jayson['client'][_0x8577('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b1366,_0x6866af,_0xa2853d){return new BPromise(function(_0xbce25f,_0x5021fa){return client['request'](_0x4b1366,_0xa2853d)[_0x8577('0x9')](function(_0x27d35f){logger['info']('DeskAccount,\x20%s,\x20%s',_0x6866af,_0x8577('0xa'));logger[_0x8577('0xb')](_0x8577('0xc'),_0x6866af,_0x8577('0xa'),JSON[_0x8577('0xd')](_0x27d35f));if(_0x27d35f[_0x8577('0xe')]){if(_0x27d35f[_0x8577('0xe')][_0x8577('0xf')]===0x1f4){logger[_0x8577('0xe')]('DeskAccount,\x20%s,\x20%s',_0x6866af,_0x27d35f[_0x8577('0xe')]['message']);return _0x5021fa(_0x27d35f[_0x8577('0xe')][_0x8577('0x10')]);}logger['error'](_0x8577('0x11'),_0x6866af,_0x27d35f[_0x8577('0xe')][_0x8577('0x10')]);return _0xbce25f(_0x27d35f['error'][_0x8577('0x10')]);}else{logger[_0x8577('0x12')](_0x8577('0x11'),_0x6866af,_0x8577('0xa'));_0xbce25f(_0x27d35f[_0x8577('0x13')][_0x8577('0x10')]);}})[_0x8577('0x14')](function(_0x775ddc){logger[_0x8577('0xe')](_0x8577('0x11'),_0x6866af,_0x775ddc);_0x5021fa(_0x775ddc);});});}exports[_0x8577('0x15')]=function(_0x22ca57){var _0x446f5d=this;return new Promise(function(_0x4df3f1,_0x149194){return db[_0x8577('0x16')][_0x8577('0x17')]({'raw':_0x22ca57[_0x8577('0x18')]?_0x22ca57[_0x8577('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x22ca57[_0x8577('0x18')]?_0x22ca57[_0x8577('0x18')]['where']||null:null,'attributes':_0x22ca57['options']?_0x22ca57[_0x8577('0x18')][_0x8577('0x19')]||null:null,'limit':_0x22ca57[_0x8577('0x18')]?_0x22ca57[_0x8577('0x18')][_0x8577('0x1a')]||null:null,'include':_0x22ca57[_0x8577('0x18')]?_0x22ca57[_0x8577('0x18')][_0x8577('0x1b')]?_[_0x8577('0x1c')](_0x22ca57['options']['include'],function(_0xe0605b){return{'model':db[_0xe0605b[_0x8577('0x1d')]],'as':_0xe0605b['as'],'attributes':_0xe0605b[_0x8577('0x19')],'include':_0xe0605b[_0x8577('0x1b')]?_[_0x8577('0x1c')](_0xe0605b[_0x8577('0x1b')],function(_0x16c753){return{'model':db[_0x16c753[_0x8577('0x1d')]],'as':_0x16c753['as'],'attributes':_0x16c753[_0x8577('0x19')],'include':_0x16c753['include']?_[_0x8577('0x1c')](_0x16c753[_0x8577('0x1b')],function(_0x620bd0){return{'model':db[_0x620bd0[_0x8577('0x1d')]],'as':_0x620bd0['as'],'attributes':_0x620bd0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c3018){logger[_0x8577('0x12')]('GetDeskAccount',_0x22ca57);logger[_0x8577('0xb')]('GetDeskAccount',_0x22ca57,JSON[_0x8577('0xd')](_0x4c3018));_0x4df3f1(_0x4c3018);})[_0x8577('0x14')](function(_0x46c704){logger[_0x8577('0xe')](_0x8577('0x15'),_0x46c704[_0x8577('0x10')],_0x22ca57);_0x149194(_0x446f5d[_0x8577('0xe')](0x1f4,_0x46c704[_0x8577('0x10')]));});});};exports[_0x8577('0x1e')]=function(_0x6e5c29){var _0x4d04eb=this;return new Promise(function(_0xd93355,_0x27316a){return db[_0x8577('0x16')]['find']({'raw':_0x6e5c29[_0x8577('0x18')]?_0x6e5c29['options'][_0x8577('0x1f')]===undefined?!![]:![]:!![],'where':_0x6e5c29[_0x8577('0x18')]?_0x6e5c29[_0x8577('0x18')]['where']||null:null,'attributes':_0x6e5c29[_0x8577('0x18')]?_0x6e5c29[_0x8577('0x18')][_0x8577('0x19')]||null:null,'include':_0x6e5c29['options']?_0x6e5c29[_0x8577('0x18')][_0x8577('0x1b')]?_[_0x8577('0x1c')](_0x6e5c29[_0x8577('0x18')][_0x8577('0x1b')],function(_0x53d479){return{'model':db[_0x53d479['model']],'as':_0x53d479['as'],'attributes':_0x53d479[_0x8577('0x19')],'include':_0x53d479[_0x8577('0x1b')]?_[_0x8577('0x1c')](_0x53d479[_0x8577('0x1b')],function(_0x20ac82){return{'model':db[_0x20ac82[_0x8577('0x1d')]],'as':_0x20ac82['as'],'attributes':_0x20ac82[_0x8577('0x19')],'include':_0x20ac82['include']?_[_0x8577('0x1c')](_0x20ac82[_0x8577('0x1b')],function(_0xa7bb2a){return{'model':db[_0xa7bb2a[_0x8577('0x1d')]],'as':_0xa7bb2a['as'],'attributes':_0xa7bb2a[_0x8577('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8577('0x9')](function(_0x1fd1cb){logger['info'](_0x8577('0x1e'),_0x6e5c29);logger[_0x8577('0xb')](_0x8577('0x1e'),_0x6e5c29,JSON['stringify'](_0x1fd1cb));_0xd93355(_0x1fd1cb);})[_0x8577('0x14')](function(_0x1c454a){logger['error']('ShowDeskAccount',_0x1c454a[_0x8577('0x10')],_0x6e5c29);_0x27316a(_0x4d04eb[_0x8577('0xe')](0x1f4,_0x1c454a['message']));});});}; \ No newline at end of file +var _0x3b42=['http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','DeskAccount','findAll','options','raw','where','attributes','include','model','map','GetDeskAccount','catch','find','ShowDeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x383433,_0x13850f){var _0x3f91ca=function(_0x249f67){while(--_0x249f67){_0x383433['push'](_0x383433['shift']());}};_0x3f91ca(++_0x13850f);}(_0x3b42,0xa5));var _0x23b4=function(_0x2849a3,_0x3c7913){_0x2849a3=_0x2849a3-0x0;var _0x525541=_0x3b42[_0x2849a3];return _0x525541;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x23b4('0x0'));var BPromise=require(_0x23b4('0x1'));var rs=require(_0x23b4('0x2'));var fs=require('fs');var Redis=require(_0x23b4('0x3'));var db=require(_0x23b4('0x4'))['db'];var utils=require(_0x23b4('0x5'));var logger=require('../../config/logger')(_0x23b4('0x6'));var config=require(_0x23b4('0x7'));var jayson=require(_0x23b4('0x8'));var client=jayson[_0x23b4('0x9')][_0x23b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b63ce,_0x1523a5,_0xceef95){return new BPromise(function(_0x4ee558,_0x33f831){return client[_0x23b4('0xb')](_0x3b63ce,_0xceef95)[_0x23b4('0xc')](function(_0x5833e0){logger[_0x23b4('0xd')]('DeskAccount,\x20%s,\x20%s',_0x1523a5,_0x23b4('0xe'));logger[_0x23b4('0xf')](_0x23b4('0x10'),_0x1523a5,'request\x20sent',JSON[_0x23b4('0x11')](_0x5833e0));if(_0x5833e0['error']){if(_0x5833e0[_0x23b4('0x12')]['code']===0x1f4){logger['error'](_0x23b4('0x13'),_0x1523a5,_0x5833e0['error'][_0x23b4('0x14')]);return _0x33f831(_0x5833e0[_0x23b4('0x12')][_0x23b4('0x14')]);}logger[_0x23b4('0x12')](_0x23b4('0x13'),_0x1523a5,_0x5833e0[_0x23b4('0x12')][_0x23b4('0x14')]);return _0x4ee558(_0x5833e0['error'][_0x23b4('0x14')]);}else{logger[_0x23b4('0xd')]('DeskAccount,\x20%s,\x20%s',_0x1523a5,_0x23b4('0xe'));_0x4ee558(_0x5833e0[_0x23b4('0x15')][_0x23b4('0x14')]);}})['catch'](function(_0x49d2ae){logger[_0x23b4('0x12')](_0x23b4('0x13'),_0x1523a5,_0x49d2ae);_0x33f831(_0x49d2ae);});});}exports['GetDeskAccount']=function(_0x31e452){var _0x18ce43=this;return new Promise(function(_0x5c01d1,_0x567382){return db[_0x23b4('0x16')][_0x23b4('0x17')]({'raw':_0x31e452[_0x23b4('0x18')]?_0x31e452[_0x23b4('0x18')][_0x23b4('0x19')]===undefined?!![]:![]:!![],'where':_0x31e452[_0x23b4('0x18')]?_0x31e452['options'][_0x23b4('0x1a')]||null:null,'attributes':_0x31e452[_0x23b4('0x18')]?_0x31e452['options'][_0x23b4('0x1b')]||null:null,'limit':_0x31e452[_0x23b4('0x18')]?_0x31e452[_0x23b4('0x18')]['limit']||null:null,'include':_0x31e452[_0x23b4('0x18')]?_0x31e452[_0x23b4('0x18')][_0x23b4('0x1c')]?_['map'](_0x31e452[_0x23b4('0x18')][_0x23b4('0x1c')],function(_0x5c881a){return{'model':db[_0x5c881a[_0x23b4('0x1d')]],'as':_0x5c881a['as'],'attributes':_0x5c881a[_0x23b4('0x1b')],'include':_0x5c881a['include']?_[_0x23b4('0x1e')](_0x5c881a[_0x23b4('0x1c')],function(_0x3c5a78){return{'model':db[_0x3c5a78[_0x23b4('0x1d')]],'as':_0x3c5a78['as'],'attributes':_0x3c5a78[_0x23b4('0x1b')],'include':_0x3c5a78['include']?_[_0x23b4('0x1e')](_0x3c5a78[_0x23b4('0x1c')],function(_0x35d4d5){return{'model':db[_0x35d4d5[_0x23b4('0x1d')]],'as':_0x35d4d5['as'],'attributes':_0x35d4d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x23b4('0xc')](function(_0x55d137){logger[_0x23b4('0xd')]('GetDeskAccount',_0x31e452);logger[_0x23b4('0xf')](_0x23b4('0x1f'),_0x31e452,JSON[_0x23b4('0x11')](_0x55d137));_0x5c01d1(_0x55d137);})[_0x23b4('0x20')](function(_0x26d820){logger[_0x23b4('0x12')](_0x23b4('0x1f'),_0x26d820['message'],_0x31e452);_0x567382(_0x18ce43[_0x23b4('0x12')](0x1f4,_0x26d820[_0x23b4('0x14')]));});});};exports['ShowDeskAccount']=function(_0x2c6fd8){var _0x4b6f4a=this;return new Promise(function(_0x23b656,_0x327505){return db[_0x23b4('0x16')][_0x23b4('0x21')]({'raw':_0x2c6fd8[_0x23b4('0x18')]?_0x2c6fd8[_0x23b4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2c6fd8[_0x23b4('0x18')]?_0x2c6fd8['options'][_0x23b4('0x1a')]||null:null,'attributes':_0x2c6fd8[_0x23b4('0x18')]?_0x2c6fd8[_0x23b4('0x18')][_0x23b4('0x1b')]||null:null,'include':_0x2c6fd8[_0x23b4('0x18')]?_0x2c6fd8[_0x23b4('0x18')][_0x23b4('0x1c')]?_[_0x23b4('0x1e')](_0x2c6fd8[_0x23b4('0x18')][_0x23b4('0x1c')],function(_0x279045){return{'model':db[_0x279045[_0x23b4('0x1d')]],'as':_0x279045['as'],'attributes':_0x279045[_0x23b4('0x1b')],'include':_0x279045[_0x23b4('0x1c')]?_[_0x23b4('0x1e')](_0x279045[_0x23b4('0x1c')],function(_0x24dbc7){return{'model':db[_0x24dbc7['model']],'as':_0x24dbc7['as'],'attributes':_0x24dbc7['attributes'],'include':_0x24dbc7['include']?_[_0x23b4('0x1e')](_0x24dbc7[_0x23b4('0x1c')],function(_0x461739){return{'model':db[_0x461739[_0x23b4('0x1d')]],'as':_0x461739['as'],'attributes':_0x461739[_0x23b4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x23b4('0xc')](function(_0x4270c9){logger[_0x23b4('0xd')](_0x23b4('0x22'),_0x2c6fd8);logger[_0x23b4('0xf')](_0x23b4('0x22'),_0x2c6fd8,JSON[_0x23b4('0x11')](_0x4270c9));_0x23b656(_0x4270c9);})[_0x23b4('0x20')](function(_0x1f55e2){logger[_0x23b4('0x12')](_0x23b4('0x22'),_0x1f55e2[_0x23b4('0x14')],_0x2c6fd8);_0x327505(_0x4b6f4a['error'](0x1f4,_0x1f55e2[_0x23b4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 0e8b48f..ecb8957 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 _0x199c=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','/:id','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','show','get','/:id/fields','getFields'];(function(_0x3a1859,_0x596127){var _0x1cfab7=function(_0x558c0a){while(--_0x558c0a){_0x3a1859['push'](_0x3a1859['shift']());}};_0x1cfab7(++_0x596127);}(_0x199c,0x1d8));var _0xc199=function(_0x4f35c1,_0x1dbab0){_0x4f35c1=_0x4f35c1-0x0;var _0x42db7f=_0x199c[_0x4f35c1];return _0x42db7f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc199('0x0'));var timeout=require(_0xc199('0x1'));var express=require(_0xc199('0x2'));var router=express[_0xc199('0x3')]();var auth=require(_0xc199('0x4'));var interaction=require(_0xc199('0x5'));var config=require(_0xc199('0x6'));var controller=require(_0xc199('0x7'));router['get']('/',auth[_0xc199('0x8')](),controller[_0xc199('0x9')]);router['get']('/:id',auth[_0xc199('0x8')](),controller[_0xc199('0xa')]);router[_0xc199('0xb')](_0xc199('0xc'),auth[_0xc199('0x8')](),controller[_0xc199('0xd')]);router[_0xc199('0xb')](_0xc199('0xe'),auth['isAuthenticated'](),controller[_0xc199('0xf')]);router[_0xc199('0xb')](_0xc199('0x10'),auth[_0xc199('0x8')](),controller[_0xc199('0x11')]);router[_0xc199('0xb')]('/:id/tags',auth[_0xc199('0x8')](),controller[_0xc199('0x12')]);router[_0xc199('0x13')]('/',auth[_0xc199('0x8')](),controller[_0xc199('0x14')]);router['post'](_0xc199('0x15'),auth[_0xc199('0x8')](),controller[_0xc199('0x16')]);router[_0xc199('0x17')](_0xc199('0x18'),auth['isAuthenticated'](),controller['update']);router[_0xc199('0x19')]('/:id',auth[_0xc199('0x8')](),controller[_0xc199('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x4489=['show','get','/:id/fields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','index','/:id'];(function(_0x416035,_0x22bd42){var _0x1b3759=function(_0x58accb){while(--_0x58accb){_0x416035['push'](_0x416035['shift']());}};_0x1b3759(++_0x22bd42);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9448('0x0'));var util=require(_0x9448('0x1'));var path=require('path');var timeout=require(_0x9448('0x2'));var express=require(_0x9448('0x3'));var router=express[_0x9448('0x4')]();var auth=require(_0x9448('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9448('0x6')]);router['get'](_0x9448('0x7'),auth['isAuthenticated'](),controller[_0x9448('0x8')]);router[_0x9448('0x9')](_0x9448('0xa'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x9448('0xb'),auth[_0x9448('0xc')](),controller[_0x9448('0xd')]);router[_0x9448('0x9')](_0x9448('0xe'),auth['isAuthenticated'](),controller[_0x9448('0xf')]);router[_0x9448('0x9')](_0x9448('0x10'),auth[_0x9448('0xc')](),controller[_0x9448('0x11')]);router[_0x9448('0x12')]('/',auth[_0x9448('0xc')](),controller[_0x9448('0x13')]);router['post'](_0x9448('0x10'),auth['isAuthenticated'](),controller[_0x9448('0x14')]);router[_0x9448('0x15')]('/:id',auth[_0x9448('0xc')](),controller[_0x9448('0x16')]);router[_0x9448('0x17')](_0x9448('0x7'),auth[_0x9448('0xc')](),controller[_0x9448('0x18')]);module[_0x9448('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d095e63..d0f493e 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 _0x54c9=['exports','STRING','sequelize'];(function(_0x36cbd7,_0x233bff){var _0x1562fd=function(_0x1a0335){while(--_0x1a0335){_0x36cbd7['push'](_0x36cbd7['shift']());}};_0x1562fd(++_0x233bff);}(_0x54c9,0x1a3));var _0x954c=function(_0x2cdc65,_0x1898ea){_0x2cdc65=_0x2cdc65-0x0;var _0x4f875b=_0x54c9[_0x2cdc65];return _0x4f875b;};'use strict';var Sequelize=require(_0x954c('0x0'));module[_0x954c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x954c('0x2')]}}; \ No newline at end of file +var _0x5237=['STRING','sequelize','exports'];(function(_0x35e484,_0x754272){var _0x4f28a1=function(_0x12d8c1){while(--_0x12d8c1){_0x35e484['push'](_0x35e484['shift']());}};_0x4f28a1(++_0x754272);}(_0x5237,0x169));var _0x7523=function(_0x3a3ec1,_0x3d7e5a){_0x3a3ec1=_0x3a3ec1-0x0;var _0x40547e=_0x5237[_0x3a3ec1];return _0x40547e;};'use strict';var Sequelize=require(_0x7523('0x0'));module[_0x7523('0x1')]={'name':{'type':Sequelize[_0x7523('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 17b7322..f0d72fd 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 _0xd0b5=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','destroy','stack','DeskConfiguration','rawAttributes','fieldName','key','model','map','name','query','keys','filters','fields','attributes','length','order','sort','pick','filter','type','VIRTUAL','options','where','count','includeAll','include','rows','catch','show','params','intersection','merge','find','create','body','update','getFields','findOne','hasOwnProperty','getSubjects','DeskField','getDescriptions','getTags','nolimit','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','Sequelize','ValidationError','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x1c17ed,_0x3f9764){_0x1c17ed=_0x1c17ed-0x0;var _0xc3e653=_0xd0b5[_0x1c17ed];return _0xc3e653;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5d0b('0x0'));var zipdir=require(_0x5d0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d0b('0x2'));var moment=require(_0x5d0b('0x3'));var BPromise=require(_0x5d0b('0x4'));var Mustache=require(_0x5d0b('0x5'));var util=require(_0x5d0b('0x6'));var path=require(_0x5d0b('0x7'));var sox=require(_0x5d0b('0x8'));var csv=require(_0x5d0b('0x9'));var ejs=require(_0x5d0b('0xa'));var fs=require('fs');var _=require(_0x5d0b('0xb'));var squel=require(_0x5d0b('0xc'));var crypto=require(_0x5d0b('0xd'));var jsforce=require(_0x5d0b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5d0b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5d0b('0xf'));var authService=require(_0x5d0b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5d0b('0x11'));var hardwareService=require(_0x5d0b('0x12'));var logger=require('../../config/logger')(_0x5d0b('0x13'));var utils=require(_0x5d0b('0x14'));var config=require(_0x5d0b('0x15'));var db=require(_0x5d0b('0x16'))['db'];var jayson=require(_0x5d0b('0x17'));var client=jayson[_0x5d0b('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x1894d4,_0x10da29,_0x10d9aa){if(_0x10d9aa){var _0x263300=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x263300['test'](_0x10da29)){return _0x1894d4;}else{throw new db[(_0x5d0b('0x19'))][(_0x5d0b('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 _0x1894d4;}}function respondWithRpcPromise(_0x1274e2,_0x4d5256,_0x4ef01f,_0x2956ef){return new BPromise(function(_0x411ed2,_0x3bd719){var _0x2937db=_0x2956ef||client;return _0x2937db['request'](_0x1274e2,_0x4ef01f)[_0x5d0b('0x1b')](function(_0x4732d8){logger[_0x5d0b('0x1c')](_0x5d0b('0x1d'),_0x4d5256,_0x5d0b('0x1e'));logger[_0x5d0b('0x1f')](_0x5d0b('0x20'),_0x4d5256,_0x5d0b('0x1e'),JSON[_0x5d0b('0x21')](_0x4732d8));if(_0x4732d8[_0x5d0b('0x22')]){if(_0x4732d8[_0x5d0b('0x22')][_0x5d0b('0x23')]===0x1f4){logger[_0x5d0b('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x4d5256,_0x4732d8['error'][_0x5d0b('0x24')]);return _0x3bd719(_0x4732d8[_0x5d0b('0x22')][_0x5d0b('0x24')]);}logger[_0x5d0b('0x22')](_0x5d0b('0x1d'),_0x4d5256,_0x4732d8['error'][_0x5d0b('0x24')]);return _0x411ed2(_0x4732d8[_0x5d0b('0x22')]['message']);}else{logger[_0x5d0b('0x1c')](_0x5d0b('0x1d'),_0x4d5256,_0x5d0b('0x1e'));_0x411ed2(_0x4732d8[_0x5d0b('0x25')][_0x5d0b('0x24')]);}})['catch'](function(_0x2c0928){logger[_0x5d0b('0x22')](_0x5d0b('0x1d'),_0x4d5256,_0x2c0928);_0x3bd719(_0x2c0928);});});}function respondWithStatusCode(_0x2bdf03,_0x2d9d8b){_0x2d9d8b=_0x2d9d8b||0xcc;return function(_0x45c97f){if(_0x45c97f){return _0x2bdf03[_0x5d0b('0x26')](_0x2d9d8b);}return _0x2bdf03['status'](_0x2d9d8b)[_0x5d0b('0x27')]();};}function respondWithResult(_0x5b2adc,_0x4f0196){_0x4f0196=_0x4f0196||0xc8;return function(_0x40c6e2){if(_0x40c6e2){return _0x5b2adc[_0x5d0b('0x28')](_0x4f0196)[_0x5d0b('0x29')](_0x40c6e2);}};}function respondWithFilteredResult(_0x53b080,_0x33e3e1){return function(_0x29d194){if(_0x29d194){var _0x4bfcc2=_0x29d194['count'],_0x20e28b=_0x33e3e1[_0x5d0b('0x2a')],_0x15e418=_0x33e3e1[_0x5d0b('0x2a')]+_0x33e3e1[_0x5d0b('0x2b')],_0x2504b8;if(_0x15e418>=_0x4bfcc2){_0x15e418=_0x4bfcc2;_0x2504b8=0xc8;}else{_0x2504b8=0xce;}_0x53b080[_0x5d0b('0x28')](_0x2504b8);return _0x53b080[_0x5d0b('0x2c')](_0x5d0b('0x2d'),_0x20e28b+'-'+_0x15e418+'/'+_0x4bfcc2)['json'](_0x29d194);}return null;};}function patchUpdates(_0x1fcdaf){return function(_0x42ef84){try{jsonpatch['apply'](_0x42ef84,_0x1fcdaf,!![]);}catch(_0x11a58e){return BPromise[_0x5d0b('0x2e')](_0x11a58e);}return _0x42ef84[_0x5d0b('0x2f')]();};}function saveUpdates(_0x30adb0,_0x1a51fb){return function(_0x2f325f){if(_0x2f325f){return _0x2f325f['update'](_0x30adb0)[_0x5d0b('0x1b')](function(_0x13372b){return _0x13372b;});}return null;};}function removeEntity(_0x3e5d8f,_0x4e7048){return function(_0x561a6c){if(_0x561a6c){return _0x561a6c[_0x5d0b('0x30')]()[_0x5d0b('0x1b')](function(){_0x3e5d8f['status'](0xcc)[_0x5d0b('0x27')]();});}};}function handleEntityNotFound(_0xbdd1ee,_0x3b5f75){return function(_0x437de8){if(!_0x437de8){_0xbdd1ee[_0x5d0b('0x26')](0x194);}return _0x437de8;};}function handleError(_0x2dd746,_0x43ebc8){_0x43ebc8=_0x43ebc8||0x1f4;return function(_0xe4267a){logger['error'](_0xe4267a[_0x5d0b('0x31')]);if(_0xe4267a['name']){delete _0xe4267a['name'];}_0x2dd746['status'](_0x43ebc8)['send'](_0xe4267a);};}exports['index']=function(_0x14f3b2,_0x26e3cd){var _0x48432e={},_0x1b5a09={},_0x3ea09a={'count':0x0,'rows':[]};var _0x9265c7=_['map'](db[_0x5d0b('0x32')][_0x5d0b('0x33')],function(_0x2c3a48){return{'name':_0x2c3a48[_0x5d0b('0x34')],'type':_0x2c3a48['type'][_0x5d0b('0x35')]};});_0x1b5a09[_0x5d0b('0x36')]=_[_0x5d0b('0x37')](_0x9265c7,_0x5d0b('0x38'));_0x1b5a09[_0x5d0b('0x39')]=_[_0x5d0b('0x3a')](_0x14f3b2['query']);_0x1b5a09[_0x5d0b('0x3b')]=_['intersection'](_0x1b5a09['model'],_0x1b5a09[_0x5d0b('0x39')]);_0x48432e['attributes']=_['intersection'](_0x1b5a09['model'],qs[_0x5d0b('0x3c')](_0x14f3b2['query']['fields']));_0x48432e['attributes']=_0x48432e[_0x5d0b('0x3d')][_0x5d0b('0x3e')]?_0x48432e[_0x5d0b('0x3d')]:_0x1b5a09[_0x5d0b('0x36')];if(!_0x14f3b2[_0x5d0b('0x39')]['hasOwnProperty']('nolimit')){_0x48432e[_0x5d0b('0x2b')]=qs[_0x5d0b('0x2b')](_0x14f3b2[_0x5d0b('0x39')][_0x5d0b('0x2b')]);_0x48432e[_0x5d0b('0x2a')]=qs['offset'](_0x14f3b2[_0x5d0b('0x39')]['offset']);}_0x48432e[_0x5d0b('0x3f')]=qs[_0x5d0b('0x40')](_0x14f3b2['query'][_0x5d0b('0x40')]);_0x48432e['where']=qs['filters'](_[_0x5d0b('0x41')](_0x14f3b2['query'],_0x1b5a09[_0x5d0b('0x3b')]),_0x9265c7);if(_0x14f3b2['query'][_0x5d0b('0x42')]){_0x48432e['where']=_['merge'](_0x48432e['where'],{'$or':_['map'](_0x9265c7,function(_0x44bd03){if(_0x44bd03[_0x5d0b('0x43')]!==_0x5d0b('0x44')){var _0x204938={};_0x204938[_0x44bd03[_0x5d0b('0x38')]]={'$like':'%'+_0x14f3b2[_0x5d0b('0x39')][_0x5d0b('0x42')]+'%'};return _0x204938;}})});}_0x48432e=_['merge']({},_0x48432e,_0x14f3b2[_0x5d0b('0x45')]);var _0x55a11d={'where':_0x48432e[_0x5d0b('0x46')]};return db[_0x5d0b('0x32')]['count'](_0x55a11d)['then'](function(_0x47dac6){_0x3ea09a[_0x5d0b('0x47')]=_0x47dac6;if(_0x14f3b2[_0x5d0b('0x39')][_0x5d0b('0x48')]){_0x48432e[_0x5d0b('0x49')]=[{'all':!![]}];}return db[_0x5d0b('0x32')]['findAll'](_0x48432e);})[_0x5d0b('0x1b')](function(_0x212366){_0x3ea09a[_0x5d0b('0x4a')]=_0x212366;return _0x3ea09a;})[_0x5d0b('0x1b')](respondWithFilteredResult(_0x26e3cd,_0x48432e))[_0x5d0b('0x4b')](handleError(_0x26e3cd,null));};exports[_0x5d0b('0x4c')]=function(_0x429709,_0x3e62cd){var _0x1f107e={'raw':![],'where':{'id':_0x429709[_0x5d0b('0x4d')]['id']}},_0x250abf={};_0x250abf[_0x5d0b('0x36')]=_['keys'](db[_0x5d0b('0x32')][_0x5d0b('0x33')]);_0x250abf['query']=_[_0x5d0b('0x3a')](_0x429709['query']);_0x250abf[_0x5d0b('0x3b')]=_['intersection'](_0x250abf['model'],_0x250abf[_0x5d0b('0x39')]);_0x1f107e[_0x5d0b('0x3d')]=_[_0x5d0b('0x4e')](_0x250abf['model'],qs['fields'](_0x429709[_0x5d0b('0x39')][_0x5d0b('0x3c')]));_0x1f107e['attributes']=_0x1f107e[_0x5d0b('0x3d')][_0x5d0b('0x3e')]?_0x1f107e[_0x5d0b('0x3d')]:_0x250abf[_0x5d0b('0x36')];if(_0x429709[_0x5d0b('0x39')][_0x5d0b('0x48')]){_0x1f107e[_0x5d0b('0x49')]=[{'all':!![]}];}_0x1f107e=_[_0x5d0b('0x4f')]({},_0x1f107e,_0x429709[_0x5d0b('0x45')]);return db[_0x5d0b('0x32')][_0x5d0b('0x50')](_0x1f107e)[_0x5d0b('0x1b')](handleEntityNotFound(_0x3e62cd,null))['then'](respondWithResult(_0x3e62cd,null))[_0x5d0b('0x4b')](handleError(_0x3e62cd,null));};exports[_0x5d0b('0x51')]=function(_0x41a6fd,_0x332f61){return db[_0x5d0b('0x32')][_0x5d0b('0x51')](_0x41a6fd[_0x5d0b('0x52')],{})[_0x5d0b('0x1b')](respondWithResult(_0x332f61,0xc9))[_0x5d0b('0x4b')](handleError(_0x332f61,null));};exports[_0x5d0b('0x53')]=function(_0x24bdd0,_0x58f54f){if(_0x24bdd0[_0x5d0b('0x52')]['id']){delete _0x24bdd0[_0x5d0b('0x52')]['id'];}return db[_0x5d0b('0x32')][_0x5d0b('0x50')]({'where':{'id':_0x24bdd0[_0x5d0b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x58f54f,null))[_0x5d0b('0x1b')](saveUpdates(_0x24bdd0[_0x5d0b('0x52')],null))[_0x5d0b('0x1b')](respondWithResult(_0x58f54f,null))[_0x5d0b('0x4b')](handleError(_0x58f54f,null));};exports[_0x5d0b('0x30')]=function(_0x290dbd,_0x549ad1){return db[_0x5d0b('0x32')][_0x5d0b('0x50')]({'where':{'id':_0x290dbd['params']['id']}})[_0x5d0b('0x1b')](handleEntityNotFound(_0x549ad1,null))[_0x5d0b('0x1b')](removeEntity(_0x549ad1,null))[_0x5d0b('0x4b')](handleError(_0x549ad1,null));};exports[_0x5d0b('0x54')]=function(_0xfda652,_0xd8a0b9,_0x3a043e){var _0x248165={};var _0x4647b4={};var _0xfdc093;var _0x5d1364;return db['DeskConfiguration'][_0x5d0b('0x55')]({'where':{'id':_0xfda652[_0x5d0b('0x4d')]['id']}})[_0x5d0b('0x1b')](handleEntityNotFound(_0xd8a0b9,null))[_0x5d0b('0x1b')](function(_0x1ab7dc){if(_0x1ab7dc){_0xfdc093=_0x1ab7dc;_0x4647b4[_0x5d0b('0x36')]=_['keys'](db['DeskField'][_0x5d0b('0x33')]);_0x4647b4[_0x5d0b('0x39')]=_[_0x5d0b('0x3a')](_0xfda652['query']);_0x4647b4[_0x5d0b('0x3b')]=_[_0x5d0b('0x4e')](_0x4647b4[_0x5d0b('0x36')],_0x4647b4[_0x5d0b('0x39')]);_0x248165[_0x5d0b('0x3d')]=_[_0x5d0b('0x4e')](_0x4647b4['model'],qs[_0x5d0b('0x3c')](_0xfda652[_0x5d0b('0x39')][_0x5d0b('0x3c')]));_0x248165[_0x5d0b('0x3d')]=_0x248165[_0x5d0b('0x3d')][_0x5d0b('0x3e')]?_0x248165[_0x5d0b('0x3d')]:_0x4647b4[_0x5d0b('0x36')];_0x248165[_0x5d0b('0x3f')]=qs[_0x5d0b('0x40')](_0xfda652[_0x5d0b('0x39')]['sort']);_0x248165[_0x5d0b('0x46')]=qs[_0x5d0b('0x3b')](_[_0x5d0b('0x41')](_0xfda652[_0x5d0b('0x39')],_0x4647b4[_0x5d0b('0x3b')]));if(_0xfda652[_0x5d0b('0x39')]['filter']){_0x248165['where']=_[_0x5d0b('0x4f')](_0x248165[_0x5d0b('0x46')],{'$or':_[_0x5d0b('0x37')](_0x248165[_0x5d0b('0x3d')],function(_0x424cfa){var _0x42837a={};_0x42837a[_0x424cfa]={'$like':'%'+_0xfda652['query'][_0x5d0b('0x42')]+'%'};return _0x42837a;})});}_0x248165=_[_0x5d0b('0x4f')]({},_0x248165,_0xfda652['options']);return _0xfdc093[_0x5d0b('0x54')](_0x248165);}})[_0x5d0b('0x1b')](function(_0x48d53e){if(_0x48d53e){_0x5d1364=_0x48d53e['length'];if(!_0xfda652[_0x5d0b('0x39')][_0x5d0b('0x56')]('nolimit')){_0x248165[_0x5d0b('0x2b')]=qs['limit'](_0xfda652[_0x5d0b('0x39')][_0x5d0b('0x2b')]);_0x248165[_0x5d0b('0x2a')]=qs[_0x5d0b('0x2a')](_0xfda652['query'][_0x5d0b('0x2a')]);}return _0xfdc093[_0x5d0b('0x54')](_0x248165);}})[_0x5d0b('0x1b')](function(_0x3f465d){if(_0x3f465d){return _0x3f465d?{'count':_0x5d1364,'rows':_0x3f465d}:null;}})[_0x5d0b('0x1b')](respondWithResult(_0xd8a0b9,null))[_0x5d0b('0x4b')](handleError(_0xd8a0b9,null));};exports[_0x5d0b('0x57')]=function(_0x45da44,_0x1f37d4,_0x312e92){var _0x536575={};var _0x5392d5={};var _0x124915;var _0x14038f;return db[_0x5d0b('0x32')][_0x5d0b('0x55')]({'where':{'id':_0x45da44['params']['id']}})[_0x5d0b('0x1b')](handleEntityNotFound(_0x1f37d4,null))[_0x5d0b('0x1b')](function(_0x45a7e1){if(_0x45a7e1){_0x124915=_0x45a7e1;_0x5392d5[_0x5d0b('0x36')]=_['keys'](db[_0x5d0b('0x58')][_0x5d0b('0x33')]);_0x5392d5[_0x5d0b('0x39')]=_[_0x5d0b('0x3a')](_0x45da44[_0x5d0b('0x39')]);_0x5392d5[_0x5d0b('0x3b')]=_[_0x5d0b('0x4e')](_0x5392d5[_0x5d0b('0x36')],_0x5392d5[_0x5d0b('0x39')]);_0x536575[_0x5d0b('0x3d')]=_[_0x5d0b('0x4e')](_0x5392d5['model'],qs['fields'](_0x45da44[_0x5d0b('0x39')][_0x5d0b('0x3c')]));_0x536575[_0x5d0b('0x3d')]=_0x536575[_0x5d0b('0x3d')][_0x5d0b('0x3e')]?_0x536575['attributes']:_0x5392d5['model'];_0x536575['order']=qs[_0x5d0b('0x40')](_0x45da44['query'][_0x5d0b('0x40')]);_0x536575[_0x5d0b('0x46')]=qs[_0x5d0b('0x3b')](_['pick'](_0x45da44['query'],_0x5392d5[_0x5d0b('0x3b')]));if(_0x45da44['query'][_0x5d0b('0x42')]){_0x536575['where']=_[_0x5d0b('0x4f')](_0x536575['where'],{'$or':_[_0x5d0b('0x37')](_0x536575[_0x5d0b('0x3d')],function(_0x5014df){var _0x53a95f={};_0x53a95f[_0x5014df]={'$like':'%'+_0x45da44['query'][_0x5d0b('0x42')]+'%'};return _0x53a95f;})});}_0x536575=_[_0x5d0b('0x4f')]({},_0x536575,_0x45da44[_0x5d0b('0x45')]);return _0x124915[_0x5d0b('0x57')](_0x536575);}})[_0x5d0b('0x1b')](function(_0x1a01d9){if(_0x1a01d9){_0x14038f=_0x1a01d9[_0x5d0b('0x3e')];if(!_0x45da44[_0x5d0b('0x39')][_0x5d0b('0x56')]('nolimit')){_0x536575['limit']=qs[_0x5d0b('0x2b')](_0x45da44[_0x5d0b('0x39')]['limit']);_0x536575[_0x5d0b('0x2a')]=qs['offset'](_0x45da44['query'][_0x5d0b('0x2a')]);}return _0x124915[_0x5d0b('0x57')](_0x536575);}})[_0x5d0b('0x1b')](function(_0x5afe25){if(_0x5afe25){return _0x5afe25?{'count':_0x14038f,'rows':_0x5afe25}:null;}})[_0x5d0b('0x1b')](respondWithResult(_0x1f37d4,null))['catch'](handleError(_0x1f37d4,null));};exports[_0x5d0b('0x59')]=function(_0x427abd,_0x5ced0f,_0x867205){var _0x3cc485={};var _0x589a2f={};var _0x6077c;var _0x298cad;return db[_0x5d0b('0x32')][_0x5d0b('0x55')]({'where':{'id':_0x427abd[_0x5d0b('0x4d')]['id']}})[_0x5d0b('0x1b')](handleEntityNotFound(_0x5ced0f,null))[_0x5d0b('0x1b')](function(_0x360c4b){if(_0x360c4b){_0x6077c=_0x360c4b;_0x589a2f[_0x5d0b('0x36')]=_[_0x5d0b('0x3a')](db['DeskField']['rawAttributes']);_0x589a2f[_0x5d0b('0x39')]=_['keys'](_0x427abd[_0x5d0b('0x39')]);_0x589a2f[_0x5d0b('0x3b')]=_['intersection'](_0x589a2f[_0x5d0b('0x36')],_0x589a2f['query']);_0x3cc485['attributes']=_['intersection'](_0x589a2f['model'],qs[_0x5d0b('0x3c')](_0x427abd['query'][_0x5d0b('0x3c')]));_0x3cc485[_0x5d0b('0x3d')]=_0x3cc485[_0x5d0b('0x3d')][_0x5d0b('0x3e')]?_0x3cc485[_0x5d0b('0x3d')]:_0x589a2f['model'];_0x3cc485[_0x5d0b('0x3f')]=qs[_0x5d0b('0x40')](_0x427abd['query'][_0x5d0b('0x40')]);_0x3cc485[_0x5d0b('0x46')]=qs[_0x5d0b('0x3b')](_[_0x5d0b('0x41')](_0x427abd[_0x5d0b('0x39')],_0x589a2f[_0x5d0b('0x3b')]));if(_0x427abd[_0x5d0b('0x39')][_0x5d0b('0x42')]){_0x3cc485[_0x5d0b('0x46')]=_[_0x5d0b('0x4f')](_0x3cc485[_0x5d0b('0x46')],{'$or':_[_0x5d0b('0x37')](_0x3cc485[_0x5d0b('0x3d')],function(_0x101da0){var _0x9c7445={};_0x9c7445[_0x101da0]={'$like':'%'+_0x427abd[_0x5d0b('0x39')][_0x5d0b('0x42')]+'%'};return _0x9c7445;})});}_0x3cc485=_[_0x5d0b('0x4f')]({},_0x3cc485,_0x427abd['options']);return _0x6077c['getDescriptions'](_0x3cc485);}})['then'](function(_0x47d94c){if(_0x47d94c){_0x298cad=_0x47d94c[_0x5d0b('0x3e')];if(!_0x427abd[_0x5d0b('0x39')][_0x5d0b('0x56')]('nolimit')){_0x3cc485[_0x5d0b('0x2b')]=qs[_0x5d0b('0x2b')](_0x427abd[_0x5d0b('0x39')][_0x5d0b('0x2b')]);_0x3cc485[_0x5d0b('0x2a')]=qs[_0x5d0b('0x2a')](_0x427abd[_0x5d0b('0x39')]['offset']);}return _0x6077c[_0x5d0b('0x59')](_0x3cc485);}})[_0x5d0b('0x1b')](function(_0xb0b6a8){if(_0xb0b6a8){return _0xb0b6a8?{'count':_0x298cad,'rows':_0xb0b6a8}:null;}})[_0x5d0b('0x1b')](respondWithResult(_0x5ced0f,null))[_0x5d0b('0x4b')](handleError(_0x5ced0f,null));};exports['getTags']=function(_0x613c53,_0x35ebed,_0x41372d){var _0x3faf6d={};var _0x40f562={};var _0x404293;var _0xd00b90;return db[_0x5d0b('0x32')][_0x5d0b('0x55')]({'where':{'id':_0x613c53[_0x5d0b('0x4d')]['id']}})[_0x5d0b('0x1b')](handleEntityNotFound(_0x35ebed,null))['then'](function(_0x222417){if(_0x222417){_0x404293=_0x222417;_0x40f562[_0x5d0b('0x36')]=_[_0x5d0b('0x3a')](db['Tag']['rawAttributes']);_0x40f562[_0x5d0b('0x39')]=_[_0x5d0b('0x3a')](_0x613c53[_0x5d0b('0x39')]);_0x40f562[_0x5d0b('0x3b')]=_[_0x5d0b('0x4e')](_0x40f562[_0x5d0b('0x36')],_0x40f562[_0x5d0b('0x39')]);_0x3faf6d[_0x5d0b('0x3d')]=_[_0x5d0b('0x4e')](_0x40f562[_0x5d0b('0x36')],qs['fields'](_0x613c53['query'][_0x5d0b('0x3c')]));_0x3faf6d[_0x5d0b('0x3d')]=_0x3faf6d['attributes'][_0x5d0b('0x3e')]?_0x3faf6d['attributes']:_0x40f562[_0x5d0b('0x36')];_0x3faf6d[_0x5d0b('0x3f')]=qs[_0x5d0b('0x40')](_0x613c53['query']['sort']);_0x3faf6d[_0x5d0b('0x46')]=qs[_0x5d0b('0x3b')](_[_0x5d0b('0x41')](_0x613c53['query'],_0x40f562['filters']));if(_0x613c53[_0x5d0b('0x39')][_0x5d0b('0x42')]){_0x3faf6d['where']=_[_0x5d0b('0x4f')](_0x3faf6d[_0x5d0b('0x46')],{'$or':_['map'](_0x3faf6d['attributes'],function(_0x49d354){var _0x5e499e={};_0x5e499e[_0x49d354]={'$like':'%'+_0x613c53['query'][_0x5d0b('0x42')]+'%'};return _0x5e499e;})});}_0x3faf6d=_[_0x5d0b('0x4f')]({},_0x3faf6d,_0x613c53[_0x5d0b('0x45')]);return _0x404293[_0x5d0b('0x5a')](_0x3faf6d);}})[_0x5d0b('0x1b')](function(_0x199c7a){if(_0x199c7a){_0xd00b90=_0x199c7a[_0x5d0b('0x3e')];if(!_0x613c53[_0x5d0b('0x39')][_0x5d0b('0x56')](_0x5d0b('0x5b'))){_0x3faf6d['limit']=qs[_0x5d0b('0x2b')](_0x613c53[_0x5d0b('0x39')][_0x5d0b('0x2b')]);_0x3faf6d['offset']=qs[_0x5d0b('0x2a')](_0x613c53[_0x5d0b('0x39')]['offset']);}return _0x404293[_0x5d0b('0x5a')](_0x3faf6d);}})[_0x5d0b('0x1b')](function(_0x1f567b){if(_0x1f567b){return _0x1f567b?{'count':_0xd00b90,'rows':_0x1f567b}:null;}})['then'](respondWithResult(_0x35ebed,null))['catch'](handleError(_0x35ebed,null));};exports['setTags']=function(_0x3413b0,_0x5de1c4,_0x5cab28){if(_0x3413b0['body']['id']){delete _0x3413b0[_0x5d0b('0x52')]['id'];}return db[_0x5d0b('0x32')][_0x5d0b('0x55')]({'where':{'id':_0x3413b0['params']['id']}})[_0x5d0b('0x1b')](handleEntityNotFound(_0x5de1c4,null))[_0x5d0b('0x1b')](function(_0x16fa1d){if(_0x16fa1d){return _0x16fa1d[_0x5d0b('0x5c')](_0x3413b0[_0x5d0b('0x52')][_0x5d0b('0x5d')]||[]);}return null;})[_0x5d0b('0x1b')](respondWithResult(_0x5de1c4,null))['catch'](handleError(_0x5de1c4,null));}; \ No newline at end of file +var _0x0b40=['mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','stack','send','index','map','DeskConfiguration','fieldName','key','name','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','keys','rawAttributes','length','find','catch','create','update','body','params','getFields','findOne','DeskField','order','pick','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3725ab,_0x40907f){var _0x2c117b=function(_0x43d9d8){while(--_0x43d9d8){_0x3725ab['push'](_0x3725ab['shift']());}};_0x2c117b(++_0x40907f);}(_0x0b40,0xba));var _0x00b4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0b40[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x00b4('0x0'));var rimraf=require(_0x00b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00b4('0x2'));var rp=require(_0x00b4('0x3'));var moment=require(_0x00b4('0x4'));var BPromise=require(_0x00b4('0x5'));var Mustache=require(_0x00b4('0x6'));var util=require(_0x00b4('0x7'));var path=require('path');var sox=require(_0x00b4('0x8'));var csv=require(_0x00b4('0x9'));var ejs=require(_0x00b4('0xa'));var fs=require('fs');var _=require(_0x00b4('0xb'));var squel=require('squel');var crypto=require(_0x00b4('0xc'));var jsforce=require(_0x00b4('0xd'));var deskjs=require(_0x00b4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x00b4('0xf'));var Papa=require(_0x00b4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x00b4('0x11'));var as=require(_0x00b4('0x12'));var hardwareService=require(_0x00b4('0x13'));var logger=require(_0x00b4('0x14'))(_0x00b4('0x15'));var utils=require(_0x00b4('0x16'));var config=require(_0x00b4('0x17'));var db=require(_0x00b4('0x18'))['db'];var jayson=require(_0x00b4('0x19'));var client=jayson[_0x00b4('0x1a')][_0x00b4('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3704e8,_0x51c6b4,_0x4f70ae){if(_0x4f70ae){var _0xc5fad4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc5fad4[_0x00b4('0x1c')](_0x51c6b4)){return _0x3704e8;}else{throw new db[(_0x00b4('0x1d'))][(_0x00b4('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 _0x3704e8;}}function respondWithRpcPromise(_0x21b816,_0x204bbe,_0x36832c,_0x3f1e81){return new BPromise(function(_0x1ba0b0,_0x11983e){var _0xb13dae=_0x3f1e81||client;return _0xb13dae['request'](_0x21b816,_0x36832c)[_0x00b4('0x1f')](function(_0xaa8b09){logger[_0x00b4('0x20')](_0x00b4('0x21'),_0x204bbe,_0x00b4('0x22'));logger['debug'](_0x00b4('0x23'),_0x204bbe,_0x00b4('0x22'),JSON[_0x00b4('0x24')](_0xaa8b09));if(_0xaa8b09['error']){if(_0xaa8b09[_0x00b4('0x25')][_0x00b4('0x26')]===0x1f4){logger[_0x00b4('0x25')](_0x00b4('0x21'),_0x204bbe,_0xaa8b09[_0x00b4('0x25')]['message']);return _0x11983e(_0xaa8b09['error'][_0x00b4('0x27')]);}logger[_0x00b4('0x25')](_0x00b4('0x21'),_0x204bbe,_0xaa8b09[_0x00b4('0x25')][_0x00b4('0x27')]);return _0x1ba0b0(_0xaa8b09['error'][_0x00b4('0x27')]);}else{logger[_0x00b4('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x204bbe,_0x00b4('0x22'));_0x1ba0b0(_0xaa8b09[_0x00b4('0x28')][_0x00b4('0x27')]);}})['catch'](function(_0x130984){logger[_0x00b4('0x25')](_0x00b4('0x21'),_0x204bbe,_0x130984);_0x11983e(_0x130984);});});}function respondWithStatusCode(_0x50d48d,_0x59347e){_0x59347e=_0x59347e||0xcc;return function(_0xc695ca){if(_0xc695ca){return _0x50d48d[_0x00b4('0x29')](_0x59347e);}return _0x50d48d[_0x00b4('0x2a')](_0x59347e)[_0x00b4('0x2b')]();};}function respondWithResult(_0x3cf0ff,_0x3f2e95){_0x3f2e95=_0x3f2e95||0xc8;return function(_0x591363){if(_0x591363){return _0x3cf0ff[_0x00b4('0x2a')](_0x3f2e95)[_0x00b4('0x2c')](_0x591363);}};}function respondWithFilteredResult(_0x19fda1,_0x1f43d9){return function(_0x1e4e77){if(_0x1e4e77){var _0x21cc39=_0x1e4e77[_0x00b4('0x2d')],_0x13e6f8=_0x1f43d9[_0x00b4('0x2e')],_0x8081ef=_0x1f43d9['offset']+_0x1f43d9[_0x00b4('0x2f')],_0x3d3684;if(_0x8081ef>=_0x21cc39){_0x8081ef=_0x21cc39;_0x3d3684=0xc8;}else{_0x3d3684=0xce;}_0x19fda1[_0x00b4('0x2a')](_0x3d3684);return _0x19fda1[_0x00b4('0x30')](_0x00b4('0x31'),_0x13e6f8+'-'+_0x8081ef+'/'+_0x21cc39)[_0x00b4('0x2c')](_0x1e4e77);}return null;};}function patchUpdates(_0x573bb7){return function(_0x3cb548){try{jsonpatch['apply'](_0x3cb548,_0x573bb7,!![]);}catch(_0x37aafb){return BPromise[_0x00b4('0x32')](_0x37aafb);}return _0x3cb548['save']();};}function saveUpdates(_0x2d62d1,_0x4d65df){return function(_0x4d26c0){if(_0x4d26c0){return _0x4d26c0['update'](_0x2d62d1)[_0x00b4('0x1f')](function(_0x1e6c68){return _0x1e6c68;});}return null;};}function removeEntity(_0x438660,_0x411b54){return function(_0x5687ff){if(_0x5687ff){return _0x5687ff['destroy']()[_0x00b4('0x1f')](function(){_0x438660[_0x00b4('0x2a')](0xcc)[_0x00b4('0x2b')]();});}};}function handleEntityNotFound(_0x2cc7b5,_0x2531fd){return function(_0x44b63f){if(!_0x44b63f){_0x2cc7b5['sendStatus'](0x194);}return _0x44b63f;};}function handleError(_0xd1cf3d,_0x2cc619){_0x2cc619=_0x2cc619||0x1f4;return function(_0x576464){logger['error'](_0x576464[_0x00b4('0x33')]);if(_0x576464['name']){delete _0x576464['name'];}_0xd1cf3d[_0x00b4('0x2a')](_0x2cc619)[_0x00b4('0x34')](_0x576464);};}exports[_0x00b4('0x35')]=function(_0x4b77fc,_0x11f076){var _0x5a4e6={},_0x171aa3={},_0x43eb92={'count':0x0,'rows':[]};var _0x59c22c=_[_0x00b4('0x36')](db[_0x00b4('0x37')]['rawAttributes'],function(_0x2e77d9){return{'name':_0x2e77d9[_0x00b4('0x38')],'type':_0x2e77d9['type'][_0x00b4('0x39')]};});_0x171aa3['model']=_[_0x00b4('0x36')](_0x59c22c,_0x00b4('0x3a'));_0x171aa3[_0x00b4('0x3b')]=_['keys'](_0x4b77fc['query']);_0x171aa3[_0x00b4('0x3c')]=_['intersection'](_0x171aa3[_0x00b4('0x3d')],_0x171aa3[_0x00b4('0x3b')]);_0x5a4e6[_0x00b4('0x3e')]=_[_0x00b4('0x3f')](_0x171aa3['model'],qs[_0x00b4('0x40')](_0x4b77fc[_0x00b4('0x3b')][_0x00b4('0x40')]));_0x5a4e6[_0x00b4('0x3e')]=_0x5a4e6[_0x00b4('0x3e')]['length']?_0x5a4e6['attributes']:_0x171aa3[_0x00b4('0x3d')];if(!_0x4b77fc[_0x00b4('0x3b')][_0x00b4('0x41')](_0x00b4('0x42'))){_0x5a4e6[_0x00b4('0x2f')]=qs[_0x00b4('0x2f')](_0x4b77fc[_0x00b4('0x3b')][_0x00b4('0x2f')]);_0x5a4e6['offset']=qs[_0x00b4('0x2e')](_0x4b77fc[_0x00b4('0x3b')][_0x00b4('0x2e')]);}_0x5a4e6['order']=qs[_0x00b4('0x43')](_0x4b77fc[_0x00b4('0x3b')][_0x00b4('0x43')]);_0x5a4e6[_0x00b4('0x44')]=qs[_0x00b4('0x3c')](_['pick'](_0x4b77fc[_0x00b4('0x3b')],_0x171aa3[_0x00b4('0x3c')]),_0x59c22c);if(_0x4b77fc[_0x00b4('0x3b')][_0x00b4('0x45')]){_0x5a4e6[_0x00b4('0x44')]=_[_0x00b4('0x46')](_0x5a4e6[_0x00b4('0x44')],{'$or':_[_0x00b4('0x36')](_0x59c22c,function(_0x3f03d9){if(_0x3f03d9[_0x00b4('0x47')]!==_0x00b4('0x48')){var _0x1ad51b={};_0x1ad51b[_0x3f03d9[_0x00b4('0x3a')]]={'$like':'%'+_0x4b77fc[_0x00b4('0x3b')][_0x00b4('0x45')]+'%'};return _0x1ad51b;}})});}_0x5a4e6=_[_0x00b4('0x46')]({},_0x5a4e6,_0x4b77fc[_0x00b4('0x49')]);var _0x1cc7f9={'where':_0x5a4e6[_0x00b4('0x44')]};return db['DeskConfiguration'][_0x00b4('0x2d')](_0x1cc7f9)['then'](function(_0x17a94f){_0x43eb92[_0x00b4('0x2d')]=_0x17a94f;if(_0x4b77fc[_0x00b4('0x3b')][_0x00b4('0x4a')]){_0x5a4e6[_0x00b4('0x4b')]=[{'all':!![]}];}return db[_0x00b4('0x37')][_0x00b4('0x4c')](_0x5a4e6);})[_0x00b4('0x1f')](function(_0x1df1e6){_0x43eb92[_0x00b4('0x4d')]=_0x1df1e6;return _0x43eb92;})[_0x00b4('0x1f')](respondWithFilteredResult(_0x11f076,_0x5a4e6))['catch'](handleError(_0x11f076,null));};exports['show']=function(_0x247566,_0x47f40a){var _0xe53320={'raw':![],'where':{'id':_0x247566['params']['id']}},_0x434716={};_0x434716[_0x00b4('0x3d')]=_[_0x00b4('0x4e')](db[_0x00b4('0x37')][_0x00b4('0x4f')]);_0x434716[_0x00b4('0x3b')]=_['keys'](_0x247566[_0x00b4('0x3b')]);_0x434716[_0x00b4('0x3c')]=_[_0x00b4('0x3f')](_0x434716[_0x00b4('0x3d')],_0x434716[_0x00b4('0x3b')]);_0xe53320[_0x00b4('0x3e')]=_[_0x00b4('0x3f')](_0x434716['model'],qs[_0x00b4('0x40')](_0x247566[_0x00b4('0x3b')][_0x00b4('0x40')]));_0xe53320[_0x00b4('0x3e')]=_0xe53320[_0x00b4('0x3e')][_0x00b4('0x50')]?_0xe53320[_0x00b4('0x3e')]:_0x434716['model'];if(_0x247566[_0x00b4('0x3b')][_0x00b4('0x4a')]){_0xe53320[_0x00b4('0x4b')]=[{'all':!![]}];}_0xe53320=_[_0x00b4('0x46')]({},_0xe53320,_0x247566[_0x00b4('0x49')]);return db[_0x00b4('0x37')][_0x00b4('0x51')](_0xe53320)[_0x00b4('0x1f')](handleEntityNotFound(_0x47f40a,null))[_0x00b4('0x1f')](respondWithResult(_0x47f40a,null))[_0x00b4('0x52')](handleError(_0x47f40a,null));};exports[_0x00b4('0x53')]=function(_0x3fb99f,_0x250e59){return db[_0x00b4('0x37')][_0x00b4('0x53')](_0x3fb99f['body'],{})[_0x00b4('0x1f')](respondWithResult(_0x250e59,0xc9))[_0x00b4('0x52')](handleError(_0x250e59,null));};exports[_0x00b4('0x54')]=function(_0x4b4821,_0x473e0c){if(_0x4b4821[_0x00b4('0x55')]['id']){delete _0x4b4821[_0x00b4('0x55')]['id'];}return db['DeskConfiguration'][_0x00b4('0x51')]({'where':{'id':_0x4b4821[_0x00b4('0x56')]['id']}})['then'](handleEntityNotFound(_0x473e0c,null))[_0x00b4('0x1f')](saveUpdates(_0x4b4821[_0x00b4('0x55')],null))[_0x00b4('0x1f')](respondWithResult(_0x473e0c,null))[_0x00b4('0x52')](handleError(_0x473e0c,null));};exports['destroy']=function(_0x4b82b6,_0x19524f){return db['DeskConfiguration'][_0x00b4('0x51')]({'where':{'id':_0x4b82b6[_0x00b4('0x56')]['id']}})[_0x00b4('0x1f')](handleEntityNotFound(_0x19524f,null))[_0x00b4('0x1f')](removeEntity(_0x19524f,null))[_0x00b4('0x52')](handleError(_0x19524f,null));};exports[_0x00b4('0x57')]=function(_0x45ea6a,_0x3f2543,_0x225a30){var _0x57e9e4={};var _0x522640={};var _0x22dbb7;var _0x1e21ef;return db['DeskConfiguration'][_0x00b4('0x58')]({'where':{'id':_0x45ea6a[_0x00b4('0x56')]['id']}})[_0x00b4('0x1f')](handleEntityNotFound(_0x3f2543,null))[_0x00b4('0x1f')](function(_0x1ac847){if(_0x1ac847){_0x22dbb7=_0x1ac847;_0x522640['model']=_[_0x00b4('0x4e')](db[_0x00b4('0x59')]['rawAttributes']);_0x522640[_0x00b4('0x3b')]=_[_0x00b4('0x4e')](_0x45ea6a[_0x00b4('0x3b')]);_0x522640['filters']=_['intersection'](_0x522640[_0x00b4('0x3d')],_0x522640[_0x00b4('0x3b')]);_0x57e9e4[_0x00b4('0x3e')]=_[_0x00b4('0x3f')](_0x522640[_0x00b4('0x3d')],qs[_0x00b4('0x40')](_0x45ea6a[_0x00b4('0x3b')][_0x00b4('0x40')]));_0x57e9e4['attributes']=_0x57e9e4[_0x00b4('0x3e')][_0x00b4('0x50')]?_0x57e9e4[_0x00b4('0x3e')]:_0x522640['model'];_0x57e9e4[_0x00b4('0x5a')]=qs['sort'](_0x45ea6a[_0x00b4('0x3b')][_0x00b4('0x43')]);_0x57e9e4[_0x00b4('0x44')]=qs[_0x00b4('0x3c')](_[_0x00b4('0x5b')](_0x45ea6a[_0x00b4('0x3b')],_0x522640[_0x00b4('0x3c')]));if(_0x45ea6a[_0x00b4('0x3b')][_0x00b4('0x45')]){_0x57e9e4[_0x00b4('0x44')]=_[_0x00b4('0x46')](_0x57e9e4['where'],{'$or':_[_0x00b4('0x36')](_0x57e9e4[_0x00b4('0x3e')],function(_0x2e6ea3){var _0x8ebd59={};_0x8ebd59[_0x2e6ea3]={'$like':'%'+_0x45ea6a['query'][_0x00b4('0x45')]+'%'};return _0x8ebd59;})});}_0x57e9e4=_[_0x00b4('0x46')]({},_0x57e9e4,_0x45ea6a[_0x00b4('0x49')]);return _0x22dbb7[_0x00b4('0x57')](_0x57e9e4);}})['then'](function(_0x474d44){if(_0x474d44){_0x1e21ef=_0x474d44[_0x00b4('0x50')];if(!_0x45ea6a[_0x00b4('0x3b')][_0x00b4('0x41')](_0x00b4('0x42'))){_0x57e9e4[_0x00b4('0x2f')]=qs[_0x00b4('0x2f')](_0x45ea6a[_0x00b4('0x3b')][_0x00b4('0x2f')]);_0x57e9e4[_0x00b4('0x2e')]=qs[_0x00b4('0x2e')](_0x45ea6a['query']['offset']);}return _0x22dbb7[_0x00b4('0x57')](_0x57e9e4);}})[_0x00b4('0x1f')](function(_0x3d92f9){if(_0x3d92f9){return _0x3d92f9?{'count':_0x1e21ef,'rows':_0x3d92f9}:null;}})[_0x00b4('0x1f')](respondWithResult(_0x3f2543,null))[_0x00b4('0x52')](handleError(_0x3f2543,null));};exports[_0x00b4('0x5c')]=function(_0x50ddb6,_0x1fc37b,_0x283933){var _0x8e7da1={};var _0x8ecc1b={};var _0x1a468a;var _0x4f2935;return db['DeskConfiguration'][_0x00b4('0x58')]({'where':{'id':_0x50ddb6[_0x00b4('0x56')]['id']}})[_0x00b4('0x1f')](handleEntityNotFound(_0x1fc37b,null))['then'](function(_0x1ff528){if(_0x1ff528){_0x1a468a=_0x1ff528;_0x8ecc1b[_0x00b4('0x3d')]=_[_0x00b4('0x4e')](db[_0x00b4('0x59')]['rawAttributes']);_0x8ecc1b[_0x00b4('0x3b')]=_[_0x00b4('0x4e')](_0x50ddb6[_0x00b4('0x3b')]);_0x8ecc1b[_0x00b4('0x3c')]=_['intersection'](_0x8ecc1b[_0x00b4('0x3d')],_0x8ecc1b['query']);_0x8e7da1[_0x00b4('0x3e')]=_[_0x00b4('0x3f')](_0x8ecc1b[_0x00b4('0x3d')],qs[_0x00b4('0x40')](_0x50ddb6[_0x00b4('0x3b')][_0x00b4('0x40')]));_0x8e7da1[_0x00b4('0x3e')]=_0x8e7da1[_0x00b4('0x3e')][_0x00b4('0x50')]?_0x8e7da1['attributes']:_0x8ecc1b[_0x00b4('0x3d')];_0x8e7da1[_0x00b4('0x5a')]=qs[_0x00b4('0x43')](_0x50ddb6['query']['sort']);_0x8e7da1['where']=qs[_0x00b4('0x3c')](_[_0x00b4('0x5b')](_0x50ddb6[_0x00b4('0x3b')],_0x8ecc1b[_0x00b4('0x3c')]));if(_0x50ddb6['query']['filter']){_0x8e7da1['where']=_[_0x00b4('0x46')](_0x8e7da1[_0x00b4('0x44')],{'$or':_['map'](_0x8e7da1[_0x00b4('0x3e')],function(_0x539713){var _0x2caa0c={};_0x2caa0c[_0x539713]={'$like':'%'+_0x50ddb6[_0x00b4('0x3b')][_0x00b4('0x45')]+'%'};return _0x2caa0c;})});}_0x8e7da1=_[_0x00b4('0x46')]({},_0x8e7da1,_0x50ddb6[_0x00b4('0x49')]);return _0x1a468a[_0x00b4('0x5c')](_0x8e7da1);}})[_0x00b4('0x1f')](function(_0x48883c){if(_0x48883c){_0x4f2935=_0x48883c['length'];if(!_0x50ddb6[_0x00b4('0x3b')][_0x00b4('0x41')](_0x00b4('0x42'))){_0x8e7da1[_0x00b4('0x2f')]=qs[_0x00b4('0x2f')](_0x50ddb6[_0x00b4('0x3b')][_0x00b4('0x2f')]);_0x8e7da1['offset']=qs[_0x00b4('0x2e')](_0x50ddb6[_0x00b4('0x3b')]['offset']);}return _0x1a468a[_0x00b4('0x5c')](_0x8e7da1);}})[_0x00b4('0x1f')](function(_0x523678){if(_0x523678){return _0x523678?{'count':_0x4f2935,'rows':_0x523678}:null;}})[_0x00b4('0x1f')](respondWithResult(_0x1fc37b,null))['catch'](handleError(_0x1fc37b,null));};exports[_0x00b4('0x5d')]=function(_0x50c156,_0x5c7f4b,_0x5b9f74){var _0xd6e56c={};var _0x357559={};var _0x358e40;var _0x878333;return db[_0x00b4('0x37')][_0x00b4('0x58')]({'where':{'id':_0x50c156[_0x00b4('0x56')]['id']}})[_0x00b4('0x1f')](handleEntityNotFound(_0x5c7f4b,null))[_0x00b4('0x1f')](function(_0x59fc4d){if(_0x59fc4d){_0x358e40=_0x59fc4d;_0x357559[_0x00b4('0x3d')]=_[_0x00b4('0x4e')](db['DeskField'][_0x00b4('0x4f')]);_0x357559['query']=_['keys'](_0x50c156[_0x00b4('0x3b')]);_0x357559[_0x00b4('0x3c')]=_[_0x00b4('0x3f')](_0x357559[_0x00b4('0x3d')],_0x357559[_0x00b4('0x3b')]);_0xd6e56c[_0x00b4('0x3e')]=_[_0x00b4('0x3f')](_0x357559[_0x00b4('0x3d')],qs['fields'](_0x50c156[_0x00b4('0x3b')][_0x00b4('0x40')]));_0xd6e56c[_0x00b4('0x3e')]=_0xd6e56c['attributes'][_0x00b4('0x50')]?_0xd6e56c[_0x00b4('0x3e')]:_0x357559[_0x00b4('0x3d')];_0xd6e56c[_0x00b4('0x5a')]=qs[_0x00b4('0x43')](_0x50c156[_0x00b4('0x3b')][_0x00b4('0x43')]);_0xd6e56c['where']=qs[_0x00b4('0x3c')](_['pick'](_0x50c156[_0x00b4('0x3b')],_0x357559[_0x00b4('0x3c')]));if(_0x50c156[_0x00b4('0x3b')][_0x00b4('0x45')]){_0xd6e56c[_0x00b4('0x44')]=_[_0x00b4('0x46')](_0xd6e56c[_0x00b4('0x44')],{'$or':_['map'](_0xd6e56c['attributes'],function(_0x125dbe){var _0xe66c2c={};_0xe66c2c[_0x125dbe]={'$like':'%'+_0x50c156[_0x00b4('0x3b')][_0x00b4('0x45')]+'%'};return _0xe66c2c;})});}_0xd6e56c=_['merge']({},_0xd6e56c,_0x50c156[_0x00b4('0x49')]);return _0x358e40[_0x00b4('0x5d')](_0xd6e56c);}})['then'](function(_0x3cf799){if(_0x3cf799){_0x878333=_0x3cf799[_0x00b4('0x50')];if(!_0x50c156[_0x00b4('0x3b')][_0x00b4('0x41')](_0x00b4('0x42'))){_0xd6e56c['limit']=qs[_0x00b4('0x2f')](_0x50c156[_0x00b4('0x3b')][_0x00b4('0x2f')]);_0xd6e56c[_0x00b4('0x2e')]=qs['offset'](_0x50c156[_0x00b4('0x3b')][_0x00b4('0x2e')]);}return _0x358e40[_0x00b4('0x5d')](_0xd6e56c);}})[_0x00b4('0x1f')](function(_0x230310){if(_0x230310){return _0x230310?{'count':_0x878333,'rows':_0x230310}:null;}})[_0x00b4('0x1f')](respondWithResult(_0x5c7f4b,null))[_0x00b4('0x52')](handleError(_0x5c7f4b,null));};exports[_0x00b4('0x5e')]=function(_0x26aff0,_0x3af3cf,_0x582f5e){var _0x303bd0={};var _0xf3e33e={};var _0x206b1b;var _0x4bf91a;return db[_0x00b4('0x37')][_0x00b4('0x58')]({'where':{'id':_0x26aff0[_0x00b4('0x56')]['id']}})[_0x00b4('0x1f')](handleEntityNotFound(_0x3af3cf,null))[_0x00b4('0x1f')](function(_0x34b8ff){if(_0x34b8ff){_0x206b1b=_0x34b8ff;_0xf3e33e[_0x00b4('0x3d')]=_[_0x00b4('0x4e')](db['Tag'][_0x00b4('0x4f')]);_0xf3e33e[_0x00b4('0x3b')]=_[_0x00b4('0x4e')](_0x26aff0[_0x00b4('0x3b')]);_0xf3e33e[_0x00b4('0x3c')]=_[_0x00b4('0x3f')](_0xf3e33e['model'],_0xf3e33e[_0x00b4('0x3b')]);_0x303bd0[_0x00b4('0x3e')]=_[_0x00b4('0x3f')](_0xf3e33e[_0x00b4('0x3d')],qs[_0x00b4('0x40')](_0x26aff0[_0x00b4('0x3b')][_0x00b4('0x40')]));_0x303bd0['attributes']=_0x303bd0[_0x00b4('0x3e')]['length']?_0x303bd0[_0x00b4('0x3e')]:_0xf3e33e[_0x00b4('0x3d')];_0x303bd0[_0x00b4('0x5a')]=qs[_0x00b4('0x43')](_0x26aff0[_0x00b4('0x3b')][_0x00b4('0x43')]);_0x303bd0[_0x00b4('0x44')]=qs[_0x00b4('0x3c')](_[_0x00b4('0x5b')](_0x26aff0[_0x00b4('0x3b')],_0xf3e33e[_0x00b4('0x3c')]));if(_0x26aff0[_0x00b4('0x3b')][_0x00b4('0x45')]){_0x303bd0[_0x00b4('0x44')]=_[_0x00b4('0x46')](_0x303bd0[_0x00b4('0x44')],{'$or':_['map'](_0x303bd0[_0x00b4('0x3e')],function(_0x24ff4b){var _0x3411b5={};_0x3411b5[_0x24ff4b]={'$like':'%'+_0x26aff0[_0x00b4('0x3b')][_0x00b4('0x45')]+'%'};return _0x3411b5;})});}_0x303bd0=_[_0x00b4('0x46')]({},_0x303bd0,_0x26aff0['options']);return _0x206b1b[_0x00b4('0x5e')](_0x303bd0);}})[_0x00b4('0x1f')](function(_0x3199ef){if(_0x3199ef){_0x4bf91a=_0x3199ef[_0x00b4('0x50')];if(!_0x26aff0['query'][_0x00b4('0x41')](_0x00b4('0x42'))){_0x303bd0[_0x00b4('0x2f')]=qs['limit'](_0x26aff0[_0x00b4('0x3b')][_0x00b4('0x2f')]);_0x303bd0['offset']=qs[_0x00b4('0x2e')](_0x26aff0[_0x00b4('0x3b')]['offset']);}return _0x206b1b['getTags'](_0x303bd0);}})[_0x00b4('0x1f')](function(_0x4c410){if(_0x4c410){return _0x4c410?{'count':_0x4bf91a,'rows':_0x4c410}:null;}})[_0x00b4('0x1f')](respondWithResult(_0x3af3cf,null))[_0x00b4('0x52')](handleError(_0x3af3cf,null));};exports[_0x00b4('0x5f')]=function(_0x140455,_0xba88f3,_0x5ddbbc){if(_0x140455[_0x00b4('0x55')]['id']){delete _0x140455['body']['id'];}return db[_0x00b4('0x37')][_0x00b4('0x58')]({'where':{'id':_0x140455[_0x00b4('0x56')]['id']}})[_0x00b4('0x1f')](handleEntityNotFound(_0xba88f3,null))[_0x00b4('0x1f')](function(_0x326814){if(_0x326814){return _0x326814[_0x00b4('0x5f')](_0x140455[_0x00b4('0x55')]['ids']||[]);}return null;})[_0x00b4('0x1f')](respondWithResult(_0xba88f3,null))[_0x00b4('0x52')](handleError(_0xba88f3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 1174c85..8d2992c 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 _0x580e=['exports','define','DeskConfiguration','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x2df403,_0x5e84ad){var _0x258ce1=function(_0x3bc8d1){while(--_0x3bc8d1){_0x2df403['push'](_0x2df403['shift']());}};_0x258ce1(++_0x5e84ad);}(_0x580e,0x183));var _0xe580=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x580e[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xe580('0x0'));var util=require(_0xe580('0x1'));var logger=require(_0xe580('0x2'))(_0xe580('0x3'));var moment=require(_0xe580('0x4'));var BPromise=require('bluebird');var rp=require(_0xe580('0x5'));var fs=require('fs');var path=require(_0xe580('0x6'));var rimraf=require('rimraf');var config=require(_0xe580('0x7'));var attributes=require(_0xe580('0x8'));module[_0xe580('0x9')]=function(_0x441dd3,_0x27a949){return _0x441dd3[_0xe580('0xa')](_0xe580('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0779=['../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x42b71b,_0x350b37){var _0x664480=function(_0x39c411){while(--_0x39c411){_0x42b71b['push'](_0x42b71b['shift']());}};_0x664480(++_0x350b37);}(_0x0779,0x170));var _0x9077=function(_0x17dde1,_0x30e262){_0x17dde1=_0x17dde1-0x0;var _0x98ed15=_0x0779[_0x17dde1];return _0x98ed15;};'use strict';var _=require('lodash');var util=require(_0x9077('0x0'));var logger=require(_0x9077('0x1'))(_0x9077('0x2'));var moment=require(_0x9077('0x3'));var BPromise=require('bluebird');var rp=require(_0x9077('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9077('0x5'));var config=require(_0x9077('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x9077('0x7')]=function(_0x21c98f,_0x115e15){return _0x21c98f[_0x9077('0x8')](_0x9077('0x9'),attributes,{'tableName':_0x9077('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 e2588fe..73b6b0b 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 _0xe062=['client','http','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xe062,0xd5));var _0x2e06=function(_0x575a03,_0x555ecb){_0x575a03=_0x575a03-0x0;var _0x440412=_0xe062[_0x575a03];return _0x440412;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var moment=require('moment');var BPromise=require(_0x2e06('0x2'));var rs=require(_0x2e06('0x3'));var fs=require('fs');var Redis=require(_0x2e06('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e06('0x5'))(_0x2e06('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e06('0x7')][_0x2e06('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52bf0a,_0x5747de,_0x255317){return new BPromise(function(_0x31645b,_0x8ede0e){return client[_0x2e06('0x9')](_0x52bf0a,_0x255317)[_0x2e06('0xa')](function(_0x2a2ee4){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x5747de,_0x2e06('0xb'));logger[_0x2e06('0xc')](_0x2e06('0xd'),_0x5747de,'request\x20sent',JSON[_0x2e06('0xe')](_0x2a2ee4));if(_0x2a2ee4[_0x2e06('0xf')]){if(_0x2a2ee4[_0x2e06('0xf')][_0x2e06('0x10')]===0x1f4){logger['error'](_0x2e06('0x11'),_0x5747de,_0x2a2ee4[_0x2e06('0xf')]['message']);return _0x8ede0e(_0x2a2ee4[_0x2e06('0xf')][_0x2e06('0x12')]);}logger['error'](_0x2e06('0x11'),_0x5747de,_0x2a2ee4[_0x2e06('0xf')][_0x2e06('0x12')]);return _0x31645b(_0x2a2ee4[_0x2e06('0xf')][_0x2e06('0x12')]);}else{logger[_0x2e06('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x5747de,_0x2e06('0xb'));_0x31645b(_0x2a2ee4[_0x2e06('0x14')][_0x2e06('0x12')]);}})[_0x2e06('0x15')](function(_0x41d1fc){logger[_0x2e06('0xf')](_0x2e06('0x11'),_0x5747de,_0x41d1fc);_0x8ede0e(_0x41d1fc);});});} \ No newline at end of file +var _0x2f38=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x5f15e4,_0x245d95){var _0x1ab9ac=function(_0x13cc7e){while(--_0x13cc7e){_0x5f15e4['push'](_0x5f15e4['shift']());}};_0x1ab9ac(++_0x245d95);}(_0x2f38,0x1a7));var _0x82f3=function(_0x5b7154,_0x2157ae){_0x5b7154=_0x5b7154-0x0;var _0x36494f=_0x2f38[_0x5b7154];return _0x36494f;};'use strict';var _=require('lodash');var util=require(_0x82f3('0x0'));var moment=require('moment');var BPromise=require(_0x82f3('0x1'));var rs=require(_0x82f3('0x2'));var fs=require('fs');var Redis=require(_0x82f3('0x3'));var db=require(_0x82f3('0x4'))['db'];var utils=require(_0x82f3('0x5'));var logger=require(_0x82f3('0x6'))('rpc');var config=require(_0x82f3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x82f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c09a0,_0x28c7f0,_0x2c69d2){return new BPromise(function(_0x659a85,_0x427ef6){return client[_0x82f3('0x9')](_0x1c09a0,_0x2c69d2)[_0x82f3('0xa')](function(_0xb445a3){logger[_0x82f3('0xb')](_0x82f3('0xc'),_0x28c7f0,_0x82f3('0xd'));logger[_0x82f3('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x28c7f0,_0x82f3('0xd'),JSON[_0x82f3('0xf')](_0xb445a3));if(_0xb445a3[_0x82f3('0x10')]){if(_0xb445a3[_0x82f3('0x10')][_0x82f3('0x11')]===0x1f4){logger[_0x82f3('0x10')](_0x82f3('0xc'),_0x28c7f0,_0xb445a3['error']['message']);return _0x427ef6(_0xb445a3[_0x82f3('0x10')][_0x82f3('0x12')]);}logger['error'](_0x82f3('0xc'),_0x28c7f0,_0xb445a3[_0x82f3('0x10')][_0x82f3('0x12')]);return _0x659a85(_0xb445a3[_0x82f3('0x10')][_0x82f3('0x12')]);}else{logger[_0x82f3('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x28c7f0,_0x82f3('0xd'));_0x659a85(_0xb445a3[_0x82f3('0x13')][_0x82f3('0x12')]);}})[_0x82f3('0x14')](function(_0x4d1a2d){logger[_0x82f3('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x28c7f0,_0x4d1a2d);_0x427ef6(_0x4d1a2d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 1f06ee2..152ece3 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 _0xc853=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x987742,_0x41d7f1){var _0x355e18=function(_0x5bce7a){while(--_0x5bce7a){_0x987742['push'](_0x987742['shift']());}};_0x355e18(++_0x41d7f1);}(_0xc853,0x16f));var _0x3c85=function(_0x31ef02,_0xf6122a){_0x31ef02=_0x31ef02-0x0;var _0x1e1ee6=_0xc853[_0x31ef02];return _0x1e1ee6;};'use strict';var multer=require(_0x3c85('0x0'));var util=require(_0x3c85('0x1'));var path=require('path');var timeout=require(_0x3c85('0x2'));var express=require(_0x3c85('0x3'));var router=express[_0x3c85('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3c85('0x5'));var config=require(_0x3c85('0x6'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0x3c85('0x7')](),controller[_0x3c85('0x8')]);router[_0x3c85('0x9')](_0x3c85('0xa'),auth[_0x3c85('0x7')](),controller[_0x3c85('0xb')]);router[_0x3c85('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c85('0xd')]);router[_0x3c85('0xe')](_0x3c85('0xa'),auth[_0x3c85('0x7')](),controller[_0x3c85('0xf')]);router[_0x3c85('0x10')](_0x3c85('0xa'),auth[_0x3c85('0x7')](),controller[_0x3c85('0x11')]);module['exports']=router; \ No newline at end of file +var _0x866c=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDeskField.controller','index'];(function(_0x3f23f9,_0x1e7cd3){var _0x5a8479=function(_0x761d54){while(--_0x761d54){_0x3f23f9['push'](_0x3f23f9['shift']());}};_0x5a8479(++_0x1e7cd3);}(_0x866c,0xee));var _0xc866=function(_0x29be9a,_0x5e23e6){_0x29be9a=_0x29be9a-0x0;var _0x9e98b3=_0x866c[_0x29be9a];return _0x9e98b3;};'use strict';var multer=require(_0xc866('0x0'));var util=require(_0xc866('0x1'));var path=require(_0xc866('0x2'));var timeout=require(_0xc866('0x3'));var express=require(_0xc866('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc866('0x5'));var config=require(_0xc866('0x6'));var controller=require(_0xc866('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc866('0x8')]);router['get'](_0xc866('0x9'),auth['isAuthenticated'](),controller[_0xc866('0xa')]);router[_0xc866('0xb')]('/',auth[_0xc866('0xc')](),controller[_0xc866('0xd')]);router[_0xc866('0xe')]('/:id',auth[_0xc866('0xc')](),controller[_0xc866('0xf')]);router[_0xc866('0x10')](_0xc866('0x9'),auth[_0xc866('0xc')](),controller[_0xc866('0x11')]);module[_0xc866('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 5744671..0cda0e9 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 _0xc0af=['BOOLEAN','sequelize','exports','keyValue','STRING','ENUM','string','variable'];(function(_0x3258b6,_0x2d7ae1){var _0x54f732=function(_0x925439){while(--_0x925439){_0x3258b6['push'](_0x3258b6['shift']());}};_0x54f732(++_0x2d7ae1);}(_0xc0af,0x139));var _0xfc0a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0af[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xfc0a('0x0'));module[_0xfc0a('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0xfc0a('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfc0a('0x3')]},'key':{'type':Sequelize[_0xfc0a('0x3')]},'keyType':{'type':Sequelize[_0xfc0a('0x4')](_0xfc0a('0x5'),_0xfc0a('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xfc0a('0x3')]},'idField':{'type':Sequelize[_0xfc0a('0x3')]},'nameField':{'type':Sequelize[_0xfc0a('0x3')]},'customField':{'type':Sequelize[_0xfc0a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfc0a('0x3')]}}; \ No newline at end of file +var _0xd093=['variable','ENUM','string','customVariable','keyValue','STRING'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0xd093,0x13f));var _0x3d09=function(_0x3e95e2,_0x2bf791){_0x3e95e2=_0x3e95e2-0x0;var _0x5bda64=_0xd093[_0x3e95e2];return _0x5bda64;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3d09('0x0')](_0x3d09('0x1'),'variable',_0x3d09('0x2'),_0x3d09('0x3')),'defaultValue':_0x3d09('0x1')},'content':{'type':Sequelize[_0x3d09('0x4')]},'key':{'type':Sequelize[_0x3d09('0x4')]},'keyType':{'type':Sequelize[_0x3d09('0x0')](_0x3d09('0x1'),_0x3d09('0x5'),_0x3d09('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3d09('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3d09('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 3c0a048..9dcd182 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 _0x36a9=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','merge','where','filter','options','count','include','findAll','rows','params','keys','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x468493,_0x475605){var _0x4164dd=function(_0xf865cb){while(--_0xf865cb){_0x468493['push'](_0x468493['shift']());}};_0x4164dd(++_0x475605);}(_0x36a9,0x8e));var _0x936a=function(_0x4d32d3,_0x287c07){_0x4d32d3=_0x4d32d3-0x0;var _0x2d759c=_0x36a9[_0x4d32d3];return _0x2d759c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x936a('0x0'));var rimraf=require(_0x936a('0x1'));var zipdir=require(_0x936a('0x2'));var jsonpatch=require(_0x936a('0x3'));var rp=require(_0x936a('0x4'));var moment=require('moment');var BPromise=require(_0x936a('0x5'));var Mustache=require(_0x936a('0x6'));var util=require(_0x936a('0x7'));var path=require(_0x936a('0x8'));var sox=require(_0x936a('0x9'));var csv=require(_0x936a('0xa'));var ejs=require(_0x936a('0xb'));var fs=require('fs');var _=require(_0x936a('0xc'));var squel=require(_0x936a('0xd'));var crypto=require(_0x936a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x936a('0xa'));var querystring=require(_0x936a('0xf'));var Papa=require(_0x936a('0x10'));var Redis=require(_0x936a('0x11'));var authService=require(_0x936a('0x12'));var qs=require(_0x936a('0x13'));var as=require(_0x936a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x936a('0x15'));var config=require(_0x936a('0x16'));var db=require(_0x936a('0x17'))['db'];function respondWithStatusCode(_0x5089d2,_0x197209){_0x197209=_0x197209||0xcc;return function(_0x4c3685){if(_0x4c3685){return _0x5089d2[_0x936a('0x18')](_0x197209);}return _0x5089d2[_0x936a('0x19')](_0x197209)['end']();};}function respondWithResult(_0x5d5829,_0x3032b8){_0x3032b8=_0x3032b8||0xc8;return function(_0x3f198d){if(_0x3f198d){return _0x5d5829[_0x936a('0x19')](_0x3032b8)[_0x936a('0x1a')](_0x3f198d);}};}function respondWithFilteredResult(_0x57552a,_0x505fa8){return function(_0x408211){if(_0x408211){var _0x1909de=_0x408211['count'],_0x415a7c=_0x505fa8[_0x936a('0x1b')],_0x1fe7ee=_0x505fa8['offset']+_0x505fa8['limit'],_0x488e5d;if(_0x1fe7ee>=_0x1909de){_0x1fe7ee=_0x1909de;_0x488e5d=0xc8;}else{_0x488e5d=0xce;}_0x57552a[_0x936a('0x19')](_0x488e5d);return _0x57552a[_0x936a('0x1c')]('Content-Range',_0x415a7c+'-'+_0x1fe7ee+'/'+_0x1909de)[_0x936a('0x1a')](_0x408211);}return null;};}function patchUpdates(_0x4d6a5e){return function(_0x5d91c2){try{jsonpatch[_0x936a('0x1d')](_0x5d91c2,_0x4d6a5e,!![]);}catch(_0x2960f9){return BPromise[_0x936a('0x1e')](_0x2960f9);}return _0x5d91c2[_0x936a('0x1f')]();};}function saveUpdates(_0x2868bf,_0x3f02d7){return function(_0x7f1165){if(_0x7f1165){return _0x7f1165[_0x936a('0x20')](_0x2868bf)[_0x936a('0x21')](function(_0x302aaf){return _0x302aaf;});}return null;};}function removeEntity(_0x136f0e,_0x55bd64){return function(_0x193d30){if(_0x193d30){return _0x193d30['destroy']()['then'](function(){_0x136f0e['status'](0xcc)[_0x936a('0x22')]();});}};}function handleEntityNotFound(_0x1b437f,_0x10a6e8){return function(_0x874386){if(!_0x874386){_0x1b437f[_0x936a('0x18')](0x194);}return _0x874386;};}function handleError(_0x42080d,_0x54da6b){_0x54da6b=_0x54da6b||0x1f4;return function(_0x485540){logger[_0x936a('0x23')](_0x485540[_0x936a('0x24')]);if(_0x485540[_0x936a('0x25')]){delete _0x485540[_0x936a('0x25')];}_0x42080d[_0x936a('0x19')](_0x54da6b)[_0x936a('0x26')](_0x485540);};}exports[_0x936a('0x27')]=function(_0x3dc7f6,_0x40d5ff){var _0x30c683={},_0x12136f={},_0x1b8061={'count':0x0,'rows':[]};var _0x3b3eb5=_[_0x936a('0x28')](db[_0x936a('0x29')][_0x936a('0x2a')],function(_0x3cb632){return{'name':_0x3cb632[_0x936a('0x2b')],'type':_0x3cb632[_0x936a('0x2c')][_0x936a('0x2d')]};});_0x12136f['model']=_[_0x936a('0x28')](_0x3b3eb5,_0x936a('0x25'));_0x12136f[_0x936a('0x2e')]=_['keys'](_0x3dc7f6[_0x936a('0x2e')]);_0x12136f[_0x936a('0x2f')]=_[_0x936a('0x30')](_0x12136f['model'],_0x12136f[_0x936a('0x2e')]);_0x30c683[_0x936a('0x31')]=_[_0x936a('0x30')](_0x12136f[_0x936a('0x32')],qs[_0x936a('0x33')](_0x3dc7f6['query'][_0x936a('0x33')]));_0x30c683[_0x936a('0x31')]=_0x30c683['attributes'][_0x936a('0x34')]?_0x30c683['attributes']:_0x12136f[_0x936a('0x32')];if(!_0x3dc7f6[_0x936a('0x2e')][_0x936a('0x35')](_0x936a('0x36'))){_0x30c683[_0x936a('0x37')]=qs['limit'](_0x3dc7f6[_0x936a('0x2e')][_0x936a('0x37')]);_0x30c683[_0x936a('0x1b')]=qs[_0x936a('0x1b')](_0x3dc7f6['query'][_0x936a('0x1b')]);}_0x30c683[_0x936a('0x38')]=qs[_0x936a('0x39')](_0x3dc7f6[_0x936a('0x2e')]['sort']);_0x30c683['where']=qs[_0x936a('0x2f')](_[_0x936a('0x3a')](_0x3dc7f6[_0x936a('0x2e')],_0x12136f[_0x936a('0x2f')]),_0x3b3eb5);if(_0x3dc7f6['query']['filter']){_0x30c683['where']=_[_0x936a('0x3b')](_0x30c683[_0x936a('0x3c')],{'$or':_[_0x936a('0x28')](_0x3b3eb5,function(_0x83232d){if(_0x83232d[_0x936a('0x2c')]!=='VIRTUAL'){var _0x5cc737={};_0x5cc737[_0x83232d['name']]={'$like':'%'+_0x3dc7f6[_0x936a('0x2e')][_0x936a('0x3d')]+'%'};return _0x5cc737;}})});}_0x30c683=_[_0x936a('0x3b')]({},_0x30c683,_0x3dc7f6[_0x936a('0x3e')]);var _0x3eddd9={'where':_0x30c683[_0x936a('0x3c')]};return db[_0x936a('0x29')][_0x936a('0x3f')](_0x3eddd9)[_0x936a('0x21')](function(_0x17f945){_0x1b8061[_0x936a('0x3f')]=_0x17f945;if(_0x3dc7f6[_0x936a('0x2e')]['includeAll']){_0x30c683[_0x936a('0x40')]=[{'all':!![]}];}return db['DeskField'][_0x936a('0x41')](_0x30c683);})[_0x936a('0x21')](function(_0x5ed5ce){_0x1b8061[_0x936a('0x42')]=_0x5ed5ce;return _0x1b8061;})[_0x936a('0x21')](respondWithFilteredResult(_0x40d5ff,_0x30c683))['catch'](handleError(_0x40d5ff,null));};exports['show']=function(_0x13bc36,_0x435eb2){var _0x262430={'raw':!![],'where':{'id':_0x13bc36[_0x936a('0x43')]['id']}},_0x5cdf77={};_0x5cdf77[_0x936a('0x32')]=_[_0x936a('0x44')](db[_0x936a('0x29')][_0x936a('0x2a')]);_0x5cdf77[_0x936a('0x2e')]=_[_0x936a('0x44')](_0x13bc36[_0x936a('0x2e')]);_0x5cdf77['filters']=_[_0x936a('0x30')](_0x5cdf77['model'],_0x5cdf77[_0x936a('0x2e')]);_0x262430[_0x936a('0x31')]=_[_0x936a('0x30')](_0x5cdf77[_0x936a('0x32')],qs[_0x936a('0x33')](_0x13bc36[_0x936a('0x2e')][_0x936a('0x33')]));_0x262430['attributes']=_0x262430[_0x936a('0x31')]['length']?_0x262430[_0x936a('0x31')]:_0x5cdf77[_0x936a('0x32')];if(_0x13bc36[_0x936a('0x2e')][_0x936a('0x45')]){_0x262430[_0x936a('0x40')]=[{'all':!![]}];}_0x262430=_[_0x936a('0x3b')]({},_0x262430,_0x13bc36[_0x936a('0x3e')]);return db['DeskField'][_0x936a('0x46')](_0x262430)[_0x936a('0x21')](handleEntityNotFound(_0x435eb2,null))[_0x936a('0x21')](respondWithResult(_0x435eb2,null))[_0x936a('0x47')](handleError(_0x435eb2,null));};exports[_0x936a('0x48')]=function(_0x420cd5,_0x396e6f){return db['DeskField'][_0x936a('0x48')](_0x420cd5['body'],{})[_0x936a('0x21')](respondWithResult(_0x396e6f,0xc9))[_0x936a('0x47')](handleError(_0x396e6f,null));};exports['update']=function(_0x1caf62,_0x200d06){if(_0x1caf62[_0x936a('0x49')]['id']){delete _0x1caf62['body']['id'];}return db[_0x936a('0x29')][_0x936a('0x46')]({'where':{'id':_0x1caf62[_0x936a('0x43')]['id']}})[_0x936a('0x21')](handleEntityNotFound(_0x200d06,null))[_0x936a('0x21')](saveUpdates(_0x1caf62['body'],null))['then'](respondWithResult(_0x200d06,null))[_0x936a('0x47')](handleError(_0x200d06,null));};exports['destroy']=function(_0x308319,_0x29789d){return db[_0x936a('0x29')]['find']({'where':{'id':_0x308319[_0x936a('0x43')]['id']}})[_0x936a('0x21')](handleEntityNotFound(_0x29789d,null))[_0x936a('0x21')](removeEntity(_0x29789d,null))[_0x936a('0x47')](handleError(_0x29789d,null));}; \ No newline at end of file +var _0x9244=['where','pick','merge','filter','DeskField','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0x9244,0xf0));var _0x4924=function(_0x30e6c4,_0x4887de){_0x30e6c4=_0x30e6c4-0x0;var _0x548945=_0x9244[_0x30e6c4];return _0x548945;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4924('0x0'));var rimraf=require(_0x4924('0x1'));var zipdir=require(_0x4924('0x2'));var jsonpatch=require(_0x4924('0x3'));var rp=require(_0x4924('0x4'));var moment=require(_0x4924('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4924('0x6'));var path=require(_0x4924('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4924('0x8'));var fs=require('fs');var _=require(_0x4924('0x9'));var squel=require(_0x4924('0xa'));var crypto=require(_0x4924('0xb'));var jsforce=require(_0x4924('0xc'));var deskjs=require(_0x4924('0xd'));var toCsv=require(_0x4924('0xe'));var querystring=require(_0x4924('0xf'));var Papa=require('papaparse');var Redis=require(_0x4924('0x10'));var authService=require(_0x4924('0x11'));var qs=require(_0x4924('0x12'));var as=require(_0x4924('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4924('0x14'))(_0x4924('0x15'));var utils=require(_0x4924('0x16'));var config=require(_0x4924('0x17'));var db=require(_0x4924('0x18'))['db'];function respondWithStatusCode(_0x15709a,_0x57a87c){_0x57a87c=_0x57a87c||0xcc;return function(_0x5bce17){if(_0x5bce17){return _0x15709a[_0x4924('0x19')](_0x57a87c);}return _0x15709a[_0x4924('0x1a')](_0x57a87c)['end']();};}function respondWithResult(_0x56a872,_0x22bf75){_0x22bf75=_0x22bf75||0xc8;return function(_0x597013){if(_0x597013){return _0x56a872[_0x4924('0x1a')](_0x22bf75)[_0x4924('0x1b')](_0x597013);}};}function respondWithFilteredResult(_0x189372,_0x45d0cc){return function(_0x266101){if(_0x266101){var _0xb3dcdb=_0x266101[_0x4924('0x1c')],_0x1caeba=_0x45d0cc[_0x4924('0x1d')],_0x29f0be=_0x45d0cc[_0x4924('0x1d')]+_0x45d0cc['limit'],_0x3004b1;if(_0x29f0be>=_0xb3dcdb){_0x29f0be=_0xb3dcdb;_0x3004b1=0xc8;}else{_0x3004b1=0xce;}_0x189372[_0x4924('0x1a')](_0x3004b1);return _0x189372['set'](_0x4924('0x1e'),_0x1caeba+'-'+_0x29f0be+'/'+_0xb3dcdb)['json'](_0x266101);}return null;};}function patchUpdates(_0x208eeb){return function(_0x4d2e70){try{jsonpatch['apply'](_0x4d2e70,_0x208eeb,!![]);}catch(_0x4d5525){return BPromise[_0x4924('0x1f')](_0x4d5525);}return _0x4d2e70[_0x4924('0x20')]();};}function saveUpdates(_0x5b5588,_0x56767a){return function(_0x5a61ba){if(_0x5a61ba){return _0x5a61ba[_0x4924('0x21')](_0x5b5588)[_0x4924('0x22')](function(_0x3ce8ed){return _0x3ce8ed;});}return null;};}function removeEntity(_0x143e81,_0x2c0973){return function(_0x3626c7){if(_0x3626c7){return _0x3626c7[_0x4924('0x23')]()[_0x4924('0x22')](function(){_0x143e81['status'](0xcc)[_0x4924('0x24')]();});}};}function handleEntityNotFound(_0x48ba3b,_0x42e24e){return function(_0xfd3aa9){if(!_0xfd3aa9){_0x48ba3b['sendStatus'](0x194);}return _0xfd3aa9;};}function handleError(_0x318152,_0x28fb8a){_0x28fb8a=_0x28fb8a||0x1f4;return function(_0x2f38fa){logger[_0x4924('0x25')](_0x2f38fa[_0x4924('0x26')]);if(_0x2f38fa[_0x4924('0x27')]){delete _0x2f38fa[_0x4924('0x27')];}_0x318152['status'](_0x28fb8a)['send'](_0x2f38fa);};}exports[_0x4924('0x28')]=function(_0x210c41,_0x3d3192){var _0x2beade={},_0x233809={},_0x21a5a8={'count':0x0,'rows':[]};var _0x207615=_[_0x4924('0x29')](db['DeskField']['rawAttributes'],function(_0x10a352){return{'name':_0x10a352[_0x4924('0x2a')],'type':_0x10a352[_0x4924('0x2b')]['key']};});_0x233809[_0x4924('0x2c')]=_[_0x4924('0x29')](_0x207615,_0x4924('0x27'));_0x233809[_0x4924('0x2d')]=_[_0x4924('0x2e')](_0x210c41['query']);_0x233809[_0x4924('0x2f')]=_[_0x4924('0x30')](_0x233809[_0x4924('0x2c')],_0x233809[_0x4924('0x2d')]);_0x2beade[_0x4924('0x31')]=_[_0x4924('0x30')](_0x233809[_0x4924('0x2c')],qs[_0x4924('0x32')](_0x210c41[_0x4924('0x2d')][_0x4924('0x32')]));_0x2beade[_0x4924('0x31')]=_0x2beade[_0x4924('0x31')]['length']?_0x2beade[_0x4924('0x31')]:_0x233809['model'];if(!_0x210c41['query'][_0x4924('0x33')](_0x4924('0x34'))){_0x2beade[_0x4924('0x35')]=qs['limit'](_0x210c41[_0x4924('0x2d')][_0x4924('0x35')]);_0x2beade[_0x4924('0x1d')]=qs['offset'](_0x210c41[_0x4924('0x2d')][_0x4924('0x1d')]);}_0x2beade[_0x4924('0x36')]=qs[_0x4924('0x37')](_0x210c41[_0x4924('0x2d')][_0x4924('0x37')]);_0x2beade[_0x4924('0x38')]=qs[_0x4924('0x2f')](_[_0x4924('0x39')](_0x210c41[_0x4924('0x2d')],_0x233809[_0x4924('0x2f')]),_0x207615);if(_0x210c41['query']['filter']){_0x2beade['where']=_[_0x4924('0x3a')](_0x2beade['where'],{'$or':_[_0x4924('0x29')](_0x207615,function(_0x3005d6){if(_0x3005d6['type']!=='VIRTUAL'){var _0x5c9051={};_0x5c9051[_0x3005d6[_0x4924('0x27')]]={'$like':'%'+_0x210c41[_0x4924('0x2d')][_0x4924('0x3b')]+'%'};return _0x5c9051;}})});}_0x2beade=_[_0x4924('0x3a')]({},_0x2beade,_0x210c41['options']);var _0x368d31={'where':_0x2beade[_0x4924('0x38')]};return db[_0x4924('0x3c')][_0x4924('0x1c')](_0x368d31)[_0x4924('0x22')](function(_0x518b8e){_0x21a5a8['count']=_0x518b8e;if(_0x210c41[_0x4924('0x2d')][_0x4924('0x3d')]){_0x2beade['include']=[{'all':!![]}];}return db[_0x4924('0x3c')][_0x4924('0x3e')](_0x2beade);})['then'](function(_0x1be03a){_0x21a5a8[_0x4924('0x3f')]=_0x1be03a;return _0x21a5a8;})['then'](respondWithFilteredResult(_0x3d3192,_0x2beade))[_0x4924('0x40')](handleError(_0x3d3192,null));};exports[_0x4924('0x41')]=function(_0x148939,_0x33aa9b){var _0x45b19b={'raw':!![],'where':{'id':_0x148939[_0x4924('0x42')]['id']}},_0x1dbe91={};_0x1dbe91['model']=_[_0x4924('0x2e')](db['DeskField'][_0x4924('0x43')]);_0x1dbe91[_0x4924('0x2d')]=_[_0x4924('0x2e')](_0x148939[_0x4924('0x2d')]);_0x1dbe91[_0x4924('0x2f')]=_['intersection'](_0x1dbe91['model'],_0x1dbe91['query']);_0x45b19b[_0x4924('0x31')]=_['intersection'](_0x1dbe91[_0x4924('0x2c')],qs[_0x4924('0x32')](_0x148939[_0x4924('0x2d')][_0x4924('0x32')]));_0x45b19b[_0x4924('0x31')]=_0x45b19b[_0x4924('0x31')][_0x4924('0x44')]?_0x45b19b[_0x4924('0x31')]:_0x1dbe91[_0x4924('0x2c')];if(_0x148939[_0x4924('0x2d')][_0x4924('0x3d')]){_0x45b19b[_0x4924('0x45')]=[{'all':!![]}];}_0x45b19b=_[_0x4924('0x3a')]({},_0x45b19b,_0x148939[_0x4924('0x46')]);return db[_0x4924('0x3c')][_0x4924('0x47')](_0x45b19b)[_0x4924('0x22')](handleEntityNotFound(_0x33aa9b,null))[_0x4924('0x22')](respondWithResult(_0x33aa9b,null))[_0x4924('0x40')](handleError(_0x33aa9b,null));};exports[_0x4924('0x48')]=function(_0x3d602c,_0x1321cd){return db[_0x4924('0x3c')][_0x4924('0x48')](_0x3d602c[_0x4924('0x49')],{})['then'](respondWithResult(_0x1321cd,0xc9))['catch'](handleError(_0x1321cd,null));};exports[_0x4924('0x21')]=function(_0x551a53,_0x4942b7){if(_0x551a53[_0x4924('0x49')]['id']){delete _0x551a53[_0x4924('0x49')]['id'];}return db[_0x4924('0x3c')][_0x4924('0x47')]({'where':{'id':_0x551a53['params']['id']}})['then'](handleEntityNotFound(_0x4942b7,null))['then'](saveUpdates(_0x551a53[_0x4924('0x49')],null))['then'](respondWithResult(_0x4942b7,null))[_0x4924('0x40')](handleError(_0x4942b7,null));};exports['destroy']=function(_0x4d48e8,_0x9523ee){return db['DeskField']['find']({'where':{'id':_0x4d48e8['params']['id']}})['then'](handleEntityNotFound(_0x9523ee,null))['then'](removeEntity(_0x9523ee,null))[_0x4924('0x40')](handleError(_0x9523ee,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 2bfa347..e793652 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 _0x72dd=['../../config/environment','./intDeskField.attributes','define','DeskField','desk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x568d4c,_0x1dfaf2){var _0x486e05=function(_0x1fc9f1){while(--_0x1fc9f1){_0x568d4c['push'](_0x568d4c['shift']());}};_0x486e05(++_0x1dfaf2);}(_0x72dd,0xd7));var _0xd72d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x72dd[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd72d('0x0'))(_0xd72d('0x1'));var moment=require(_0xd72d('0x2'));var BPromise=require(_0xd72d('0x3'));var rp=require(_0xd72d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd72d('0x5'));var config=require(_0xd72d('0x6'));var attributes=require(_0xd72d('0x7'));module['exports']=function(_0x28521b,_0x4fabf9){return _0x28521b[_0xd72d('0x8')](_0xd72d('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xd72d('0xa'),'fields':[_0xd72d('0xb'),_0xd72d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b89=['moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','desk_unique_index','FieldId','util','../../config/logger','api'];(function(_0x1b71f3,_0x22201d){var _0x26a72d=function(_0x25ca45){while(--_0x25ca45){_0x1b71f3['push'](_0x1b71f3['shift']());}};_0x26a72d(++_0x22201d);}(_0x7b89,0xa6));var _0x97b8=function(_0x3558e6,_0x34c925){_0x3558e6=_0x3558e6-0x0;var _0x1be21e=_0x7b89[_0x3558e6];return _0x1be21e;};'use strict';var _=require('lodash');var util=require(_0x97b8('0x0'));var logger=require(_0x97b8('0x1'))(_0x97b8('0x2'));var moment=require(_0x97b8('0x3'));var BPromise=require(_0x97b8('0x4'));var rp=require(_0x97b8('0x5'));var fs=require('fs');var path=require(_0x97b8('0x6'));var rimraf=require(_0x97b8('0x7'));var config=require('../../config/environment');var attributes=require(_0x97b8('0x8'));module[_0x97b8('0x9')]=function(_0x47c0b9,_0x5acbde){return _0x47c0b9[_0x97b8('0xa')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x97b8('0xb'),'fields':['idField',_0x97b8('0xc')],'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 2f9a301..dd4713f 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 _0x5d34=['http','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5e52f5,_0x1e2674){var _0xfc3428=function(_0x4c1f46){while(--_0x4c1f46){_0x5e52f5['push'](_0x5e52f5['shift']());}};_0xfc3428(++_0x1e2674);}(_0x5d34,0x64));var _0x45d3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5d34[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x45d3('0x0'));var moment=require('moment');var BPromise=require(_0x45d3('0x1'));var rs=require(_0x45d3('0x2'));var fs=require('fs');var Redis=require(_0x45d3('0x3'));var db=require(_0x45d3('0x4'))['db'];var utils=require(_0x45d3('0x5'));var logger=require('../../config/logger')(_0x45d3('0x6'));var config=require(_0x45d3('0x7'));var jayson=require(_0x45d3('0x8'));var client=jayson[_0x45d3('0x9')][_0x45d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x364df6,_0x480966,_0x28183f){return new BPromise(function(_0x29bd8d,_0x35e306){return client['request'](_0x364df6,_0x28183f)[_0x45d3('0xb')](function(_0x3610e6){logger[_0x45d3('0xc')]('DeskField,\x20%s,\x20%s',_0x480966,_0x45d3('0xd'));logger[_0x45d3('0xe')](_0x45d3('0xf'),_0x480966,_0x45d3('0xd'),JSON[_0x45d3('0x10')](_0x3610e6));if(_0x3610e6[_0x45d3('0x11')]){if(_0x3610e6['error'][_0x45d3('0x12')]===0x1f4){logger[_0x45d3('0x11')]('DeskField,\x20%s,\x20%s',_0x480966,_0x3610e6[_0x45d3('0x11')]['message']);return _0x35e306(_0x3610e6[_0x45d3('0x11')]['message']);}logger[_0x45d3('0x11')](_0x45d3('0x13'),_0x480966,_0x3610e6[_0x45d3('0x11')][_0x45d3('0x14')]);return _0x29bd8d(_0x3610e6[_0x45d3('0x11')][_0x45d3('0x14')]);}else{logger[_0x45d3('0xc')](_0x45d3('0x13'),_0x480966,'request\x20sent');_0x29bd8d(_0x3610e6[_0x45d3('0x15')][_0x45d3('0x14')]);}})['catch'](function(_0x25b1a8){logger[_0x45d3('0x11')](_0x45d3('0x13'),_0x480966,_0x25b1a8);_0x35e306(_0x25b1a8);});});} \ No newline at end of file +var _0xf1e2=['message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e7ba5,_0xbeebf){var _0x326474=function(_0x500d51){while(--_0x500d51){_0x1e7ba5['push'](_0x1e7ba5['shift']());}};_0x326474(++_0xbeebf);}(_0xf1e2,0x1b7));var _0x2f1e=function(_0xb8c43b,_0x36f526){_0xb8c43b=_0xb8c43b-0x0;var _0x24df7c=_0xf1e2[_0xb8c43b];return _0x24df7c;};'use strict';var _=require('lodash');var util=require(_0x2f1e('0x0'));var moment=require('moment');var BPromise=require(_0x2f1e('0x1'));var rs=require(_0x2f1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f1e('0x3'))['db'];var utils=require(_0x2f1e('0x4'));var logger=require(_0x2f1e('0x5'))(_0x2f1e('0x6'));var config=require(_0x2f1e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d698a,_0x14b68e,_0x37dd47){return new BPromise(function(_0x4fdfb7,_0x495ce6){return client[_0x2f1e('0x9')](_0x5d698a,_0x37dd47)['then'](function(_0x3102cd){logger[_0x2f1e('0xa')](_0x2f1e('0xb'),_0x14b68e,_0x2f1e('0xc'));logger[_0x2f1e('0xd')](_0x2f1e('0xe'),_0x14b68e,_0x2f1e('0xc'),JSON[_0x2f1e('0xf')](_0x3102cd));if(_0x3102cd[_0x2f1e('0x10')]){if(_0x3102cd[_0x2f1e('0x10')]['code']===0x1f4){logger[_0x2f1e('0x10')](_0x2f1e('0xb'),_0x14b68e,_0x3102cd[_0x2f1e('0x10')]['message']);return _0x495ce6(_0x3102cd[_0x2f1e('0x10')][_0x2f1e('0x11')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x14b68e,_0x3102cd[_0x2f1e('0x10')]['message']);return _0x4fdfb7(_0x3102cd[_0x2f1e('0x10')][_0x2f1e('0x11')]);}else{logger[_0x2f1e('0xa')](_0x2f1e('0xb'),_0x14b68e,'request\x20sent');_0x4fdfb7(_0x3102cd[_0x2f1e('0x12')][_0x2f1e('0x11')]);}})['catch'](function(_0x171f8b){logger[_0x2f1e('0x10')](_0x2f1e('0xb'),_0x14b68e,_0x171f8b);_0x495ce6(_0x171f8b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1cea6fe..2697597 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 _0xda6f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x3ae3e2,_0x7aa47a){var _0x47d3b5=function(_0xc3fcd9){while(--_0xc3fcd9){_0x3ae3e2['push'](_0x3ae3e2['shift']());}};_0x47d3b5(++_0x7aa47a);}(_0xda6f,0xb4));var _0xfda6=function(_0x4ee791,_0x5897f6){_0x4ee791=_0x4ee791-0x0;var _0x3b6f42=_0xda6f[_0x4ee791];return _0x3b6f42;};'use strict';var multer=require(_0xfda6('0x0'));var util=require(_0xfda6('0x1'));var path=require(_0xfda6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfda6('0x3')]();var auth=require(_0xfda6('0x4'));var interaction=require(_0xfda6('0x5'));var config=require(_0xfda6('0x6'));var controller=require(_0xfda6('0x7'));router[_0xfda6('0x8')]('/',auth[_0xfda6('0x9')](),controller[_0xfda6('0xa')]);router[_0xfda6('0x8')](_0xfda6('0xb'),auth[_0xfda6('0x9')](),controller['show']);router['get'](_0xfda6('0xc'),auth['isAuthenticated'](),controller[_0xfda6('0xd')]);router[_0xfda6('0x8')](_0xfda6('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xfda6('0xf')]('/',auth[_0xfda6('0x9')](),controller[_0xfda6('0x10')]);router[_0xfda6('0xf')](_0xfda6('0xc'),auth['isAuthenticated'](),controller[_0xfda6('0x11')]);router[_0xfda6('0x12')](_0xfda6('0xb'),auth[_0xfda6('0x9')](),controller[_0xfda6('0x13')]);router[_0xfda6('0x14')](_0xfda6('0xb'),auth[_0xfda6('0x9')](),controller[_0xfda6('0x15')]);module[_0xfda6('0x16')]=router; \ No newline at end of file +var _0x4695=['index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','destroy','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x492302,_0x505dde){var _0x1b1951=function(_0x303f12){while(--_0x303f12){_0x492302['push'](_0x492302['shift']());}};_0x1b1951(++_0x505dde);}(_0x4695,0xca));var _0x5469=function(_0x1efb4d,_0x2b222d){_0x1efb4d=_0x1efb4d-0x0;var _0x56b368=_0x4695[_0x1efb4d];return _0x56b368;};'use strict';var multer=require('multer');var util=require(_0x5469('0x0'));var path=require('path');var timeout=require(_0x5469('0x1'));var express=require('express');var router=express[_0x5469('0x2')]();var auth=require(_0x5469('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5469('0x4'));var controller=require(_0x5469('0x5'));router[_0x5469('0x6')]('/',auth[_0x5469('0x7')](),controller[_0x5469('0x8')]);router[_0x5469('0x6')](_0x5469('0x9'),auth[_0x5469('0x7')](),controller[_0x5469('0xa')]);router['get'](_0x5469('0xb'),auth[_0x5469('0x7')](),controller[_0x5469('0xc')]);router[_0x5469('0x6')]('/:id/fields',auth[_0x5469('0x7')](),controller[_0x5469('0xd')]);router['post']('/',auth[_0x5469('0x7')](),controller[_0x5469('0xe')]);router[_0x5469('0xf')]('/:id/configurations',auth[_0x5469('0x7')](),controller[_0x5469('0x10')]);router[_0x5469('0x11')](_0x5469('0x9'),auth[_0x5469('0x7')](),controller[_0x5469('0x12')]);router[_0x5469('0x13')](_0x5469('0x9'),auth[_0x5469('0x7')](),controller[_0x5469('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index c50d7a3..56e33d2 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 _0x8e0b=['exports','STRING','sequelize'];(function(_0x311944,_0x27cbdb){var _0x4ea10b=function(_0x500078){while(--_0x500078){_0x311944['push'](_0x311944['shift']());}};_0x4ea10b(++_0x27cbdb);}(_0x8e0b,0x140));var _0xb8e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e0b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb8e0('0x0'));module[_0xb8e0('0x1')]={'name':{'type':Sequelize[_0xb8e0('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb8e0('0x2')]},'remoteUri':{'type':Sequelize[_0xb8e0('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb8e0('0x2')]},'clientSecret':{'type':Sequelize[_0xb8e0('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb8e0('0x2')]}}; \ No newline at end of file +var _0x09c2=['STRING'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x09c2,0xb1));var _0x209c=function(_0x9cf14e,_0x57d04f){_0x9cf14e=_0x9cf14e-0x0;var _0x14877a=_0x09c2[_0x9cf14e];return _0x14877a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x209c('0x0')]},'username':{'type':Sequelize[_0x209c('0x0')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x209c('0x0')]},'clientId':{'type':Sequelize[_0x209c('0x0')]},'clientSecret':{'type':Sequelize[_0x209c('0x0')]},'serverUrl':{'type':Sequelize[_0x209c('0x0')]},'description':{'type':Sequelize[_0x209c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1faf5ef..ed6b421 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 _0xb385=['filters','model','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','keys','fields','length','find','create','body','params','destroy','getConfigurations','Dynamics365Configuration','addConfiguration','AccountId','getSubjects','Descriptions','channel','Dynamics365Field','Subjects','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','findOne','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','POST','/oauth2/token','username','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','json','count','offset','limit','status','apply','reject','save','update','stack','name','send','index','Dynamics365Account','rawAttributes','type','key','query'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0xb385,0xa1));var _0x5b38=function(_0x26cd81,_0x5e8ea2){_0x26cd81=_0x26cd81-0x0;var _0x502ca1=_0xb385[_0x26cd81];return _0x502ca1;};'use strict';var pdf=require(_0x5b38('0x0'));var emlformat=require(_0x5b38('0x1'));var rimraf=require(_0x5b38('0x2'));var zipdir=require(_0x5b38('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b38('0x4'));var moment=require('moment');var BPromise=require(_0x5b38('0x5'));var Mustache=require(_0x5b38('0x6'));var util=require(_0x5b38('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5b38('0x8'));var ejs=require(_0x5b38('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5b38('0xa'));var crypto=require(_0x5b38('0xb'));var jsforce=require(_0x5b38('0xc'));var deskjs=require(_0x5b38('0xd'));var toCsv=require(_0x5b38('0x8'));var querystring=require(_0x5b38('0xe'));var Papa=require(_0x5b38('0xf'));var Redis=require(_0x5b38('0x10'));var authService=require(_0x5b38('0x11'));var qs=require(_0x5b38('0x12'));var as=require(_0x5b38('0x13'));var hardwareService=require(_0x5b38('0x14'));var logger=require(_0x5b38('0x15'))(_0x5b38('0x16'));var utils=require(_0x5b38('0x17'));var config=require(_0x5b38('0x18'));var db=require(_0x5b38('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x5b38('0x1a'));var client=jayson[_0x5b38('0x1b')][_0x5b38('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2f8ce0,_0x1eec16,_0x3edbce){if(_0x3edbce){var _0x30fc8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30fc8d[_0x5b38('0x1d')](_0x1eec16)){return _0x2f8ce0;}else{throw new db[(_0x5b38('0x1e'))][(_0x5b38('0x1f'))](_0x5b38('0x20'));}}else{return _0x2f8ce0;}}function respondWithRpcPromise(_0x497543,_0x3fc1a9,_0x31d310,_0x6deb5f){return new BPromise(function(_0x8c4a32,_0x821afb){var _0x442678=_0x6deb5f||client;return _0x442678[_0x5b38('0x21')](_0x497543,_0x31d310)[_0x5b38('0x22')](function(_0x5ae2c7){logger[_0x5b38('0x23')](_0x5b38('0x24'),_0x3fc1a9,_0x5b38('0x25'));logger[_0x5b38('0x26')](_0x5b38('0x27'),_0x3fc1a9,_0x5b38('0x25'),JSON['stringify'](_0x5ae2c7));if(_0x5ae2c7['error']){if(_0x5ae2c7[_0x5b38('0x28')][_0x5b38('0x29')]===0x1f4){logger['error'](_0x5b38('0x24'),_0x3fc1a9,_0x5ae2c7['error']['message']);return _0x821afb(_0x5ae2c7[_0x5b38('0x28')][_0x5b38('0x2a')]);}logger['error'](_0x5b38('0x24'),_0x3fc1a9,_0x5ae2c7[_0x5b38('0x28')]['message']);return _0x8c4a32(_0x5ae2c7['error'][_0x5b38('0x2a')]);}else{logger[_0x5b38('0x23')](_0x5b38('0x24'),_0x3fc1a9,_0x5b38('0x25'));_0x8c4a32(_0x5ae2c7['result']['message']);}})[_0x5b38('0x2b')](function(_0x33fdd8){logger[_0x5b38('0x28')](_0x5b38('0x24'),_0x3fc1a9,_0x33fdd8);_0x821afb(_0x33fdd8);});});}function respondWithStatusCode(_0x4d4055,_0x4281be){_0x4281be=_0x4281be||0xcc;return function(_0x25c1c0){if(_0x25c1c0){return _0x4d4055[_0x5b38('0x2c')](_0x4281be);}return _0x4d4055['status'](_0x4281be)[_0x5b38('0x2d')]();};}function respondWithResult(_0x17dfb0,_0x142f4a){_0x142f4a=_0x142f4a||0xc8;return function(_0x3df5a0){if(_0x3df5a0){return _0x17dfb0['status'](_0x142f4a)[_0x5b38('0x2e')](_0x3df5a0);}};}function respondWithFilteredResult(_0x59e001,_0x63bc95){return function(_0x5434dd){if(_0x5434dd){var _0x154f70=_0x5434dd[_0x5b38('0x2f')],_0x5bb0d7=_0x63bc95[_0x5b38('0x30')],_0x3e3065=_0x63bc95['offset']+_0x63bc95[_0x5b38('0x31')],_0x292810;if(_0x3e3065>=_0x154f70){_0x3e3065=_0x154f70;_0x292810=0xc8;}else{_0x292810=0xce;}_0x59e001[_0x5b38('0x32')](_0x292810);return _0x59e001['set']('Content-Range',_0x5bb0d7+'-'+_0x3e3065+'/'+_0x154f70)[_0x5b38('0x2e')](_0x5434dd);}return null;};}function patchUpdates(_0x3d8707){return function(_0xd7cd6f){try{jsonpatch[_0x5b38('0x33')](_0xd7cd6f,_0x3d8707,!![]);}catch(_0x3b16e3){return BPromise[_0x5b38('0x34')](_0x3b16e3);}return _0xd7cd6f[_0x5b38('0x35')]();};}function saveUpdates(_0x41cbf5,_0x19187b){return function(_0x3d9838){if(_0x3d9838){return _0x3d9838[_0x5b38('0x36')](_0x41cbf5)[_0x5b38('0x22')](function(_0x450312){return _0x450312;});}return null;};}function removeEntity(_0x2d43ad,_0x37730f){return function(_0x2c2fc4){if(_0x2c2fc4){return _0x2c2fc4['destroy']()[_0x5b38('0x22')](function(){_0x2d43ad[_0x5b38('0x32')](0xcc)[_0x5b38('0x2d')]();});}};}function handleEntityNotFound(_0x31be43,_0xf625b7){return function(_0x3701d4){if(!_0x3701d4){_0x31be43[_0x5b38('0x2c')](0x194);}return _0x3701d4;};}function handleError(_0x2d91a6,_0xc1cd19){_0xc1cd19=_0xc1cd19||0x1f4;return function(_0x57cf6a){logger[_0x5b38('0x28')](_0x57cf6a[_0x5b38('0x37')]);if(_0x57cf6a[_0x5b38('0x38')]){delete _0x57cf6a[_0x5b38('0x38')];}_0x2d91a6[_0x5b38('0x32')](_0xc1cd19)[_0x5b38('0x39')](_0x57cf6a);};}exports[_0x5b38('0x3a')]=function(_0x261da0,_0x75a90a){var _0xa5eae0={},_0x5db70f={},_0x5917d8={'count':0x0,'rows':[]};var _0x343278=_['map'](db[_0x5b38('0x3b')][_0x5b38('0x3c')],function(_0x273853){return{'name':_0x273853['fieldName'],'type':_0x273853[_0x5b38('0x3d')][_0x5b38('0x3e')]};});_0x5db70f['model']=_['map'](_0x343278,_0x5b38('0x38'));_0x5db70f[_0x5b38('0x3f')]=_['keys'](_0x261da0[_0x5b38('0x3f')]);_0x5db70f[_0x5b38('0x40')]=_['intersection'](_0x5db70f[_0x5b38('0x41')],_0x5db70f[_0x5b38('0x3f')]);_0xa5eae0['attributes']=_[_0x5b38('0x42')](_0x5db70f[_0x5b38('0x41')],qs['fields'](_0x261da0['query']['fields']));_0xa5eae0[_0x5b38('0x43')]=_0xa5eae0[_0x5b38('0x43')]['length']?_0xa5eae0[_0x5b38('0x43')]:_0x5db70f[_0x5b38('0x41')];if(!_0x261da0['query'][_0x5b38('0x44')](_0x5b38('0x45'))){_0xa5eae0[_0x5b38('0x31')]=qs['limit'](_0x261da0[_0x5b38('0x3f')][_0x5b38('0x31')]);_0xa5eae0['offset']=qs[_0x5b38('0x30')](_0x261da0[_0x5b38('0x3f')][_0x5b38('0x30')]);}_0xa5eae0[_0x5b38('0x46')]=qs[_0x5b38('0x47')](_0x261da0[_0x5b38('0x3f')][_0x5b38('0x47')]);_0xa5eae0[_0x5b38('0x48')]=qs['filters'](_[_0x5b38('0x49')](_0x261da0[_0x5b38('0x3f')],_0x5db70f[_0x5b38('0x40')]),_0x343278);if(_0x261da0[_0x5b38('0x3f')][_0x5b38('0x4a')]){_0xa5eae0[_0x5b38('0x48')]=_[_0x5b38('0x4b')](_0xa5eae0[_0x5b38('0x48')],{'$or':_[_0x5b38('0x4c')](_0x343278,function(_0x5d0385){if(_0x5d0385[_0x5b38('0x3d')]!==_0x5b38('0x4d')){var _0x401eab={};_0x401eab[_0x5d0385[_0x5b38('0x38')]]={'$like':'%'+_0x261da0[_0x5b38('0x3f')][_0x5b38('0x4a')]+'%'};return _0x401eab;}})});}_0xa5eae0=_[_0x5b38('0x4b')]({},_0xa5eae0,_0x261da0[_0x5b38('0x4e')]);var _0x5320d4={'where':_0xa5eae0[_0x5b38('0x48')]};return db['Dynamics365Account'][_0x5b38('0x2f')](_0x5320d4)[_0x5b38('0x22')](function(_0xd76082){_0x5917d8[_0x5b38('0x2f')]=_0xd76082;if(_0x261da0[_0x5b38('0x3f')][_0x5b38('0x4f')]){_0xa5eae0[_0x5b38('0x50')]=[{'all':!![]}];}return db[_0x5b38('0x3b')][_0x5b38('0x51')](_0xa5eae0);})[_0x5b38('0x22')](function(_0x203a3d){_0x5917d8[_0x5b38('0x52')]=_0x203a3d;return _0x5917d8;})[_0x5b38('0x22')](respondWithFilteredResult(_0x75a90a,_0xa5eae0))[_0x5b38('0x2b')](handleError(_0x75a90a,null));};exports['show']=function(_0x4dbeb,_0x257e73){var _0xd5c6cd={'raw':![],'where':{'id':_0x4dbeb['params']['id']}},_0x46d879={};_0x46d879[_0x5b38('0x41')]=_[_0x5b38('0x53')](db[_0x5b38('0x3b')][_0x5b38('0x3c')]);_0x46d879[_0x5b38('0x3f')]=_[_0x5b38('0x53')](_0x4dbeb[_0x5b38('0x3f')]);_0x46d879[_0x5b38('0x40')]=_['intersection'](_0x46d879[_0x5b38('0x41')],_0x46d879[_0x5b38('0x3f')]);_0xd5c6cd[_0x5b38('0x43')]=_['intersection'](_0x46d879[_0x5b38('0x41')],qs[_0x5b38('0x54')](_0x4dbeb[_0x5b38('0x3f')]['fields']));_0xd5c6cd['attributes']=_0xd5c6cd['attributes'][_0x5b38('0x55')]?_0xd5c6cd[_0x5b38('0x43')]:_0x46d879['model'];if(_0x4dbeb[_0x5b38('0x3f')][_0x5b38('0x4f')]){_0xd5c6cd[_0x5b38('0x50')]=[{'all':!![]}];}_0xd5c6cd=_[_0x5b38('0x4b')]({},_0xd5c6cd,_0x4dbeb[_0x5b38('0x4e')]);return db[_0x5b38('0x3b')][_0x5b38('0x56')](_0xd5c6cd)['then'](handleEntityNotFound(_0x257e73,null))[_0x5b38('0x22')](respondWithResult(_0x257e73,null))[_0x5b38('0x2b')](handleError(_0x257e73,null));};exports[_0x5b38('0x57')]=function(_0x51fdbe,_0x12c788){return db[_0x5b38('0x3b')][_0x5b38('0x57')](_0x51fdbe[_0x5b38('0x58')],{})['then'](respondWithResult(_0x12c788,0xc9))[_0x5b38('0x2b')](handleError(_0x12c788,null));};exports['update']=function(_0x3cca8d,_0xff59d0){if(_0x3cca8d[_0x5b38('0x58')]['id']){delete _0x3cca8d[_0x5b38('0x58')]['id'];}return db['Dynamics365Account'][_0x5b38('0x56')]({'where':{'id':_0x3cca8d[_0x5b38('0x59')]['id']}})[_0x5b38('0x22')](handleEntityNotFound(_0xff59d0,null))[_0x5b38('0x22')](saveUpdates(_0x3cca8d[_0x5b38('0x58')],null))[_0x5b38('0x22')](respondWithResult(_0xff59d0,null))[_0x5b38('0x2b')](handleError(_0xff59d0,null));};exports[_0x5b38('0x5a')]=function(_0x20434e,_0x4ef9fc){return db[_0x5b38('0x3b')]['find']({'where':{'id':_0x20434e[_0x5b38('0x59')]['id']}})[_0x5b38('0x22')](handleEntityNotFound(_0x4ef9fc,null))[_0x5b38('0x22')](removeEntity(_0x4ef9fc,null))[_0x5b38('0x2b')](handleError(_0x4ef9fc,null));};exports[_0x5b38('0x5b')]=function(_0x1c2ad7,_0x29513f,_0x2e6bb5){var _0x2f9877={};var _0x502ee3={};var _0x5ea059;var _0x397ee5;return db[_0x5b38('0x3b')]['findOne']({'where':{'id':_0x1c2ad7[_0x5b38('0x59')]['id']}})[_0x5b38('0x22')](handleEntityNotFound(_0x29513f,null))[_0x5b38('0x22')](function(_0x3ab822){if(_0x3ab822){_0x5ea059=_0x3ab822;_0x502ee3[_0x5b38('0x41')]=_[_0x5b38('0x53')](db[_0x5b38('0x5c')][_0x5b38('0x3c')]);_0x502ee3['query']=_['keys'](_0x1c2ad7[_0x5b38('0x3f')]);_0x502ee3['filters']=_[_0x5b38('0x42')](_0x502ee3[_0x5b38('0x41')],_0x502ee3[_0x5b38('0x3f')]);_0x2f9877[_0x5b38('0x43')]=_[_0x5b38('0x42')](_0x502ee3['model'],qs['fields'](_0x1c2ad7[_0x5b38('0x3f')][_0x5b38('0x54')]));_0x2f9877[_0x5b38('0x43')]=_0x2f9877[_0x5b38('0x43')][_0x5b38('0x55')]?_0x2f9877[_0x5b38('0x43')]:_0x502ee3['model'];_0x2f9877['order']=qs[_0x5b38('0x47')](_0x1c2ad7[_0x5b38('0x3f')][_0x5b38('0x47')]);_0x2f9877[_0x5b38('0x48')]=qs[_0x5b38('0x40')](_[_0x5b38('0x49')](_0x1c2ad7[_0x5b38('0x3f')],_0x502ee3[_0x5b38('0x40')]));if(_0x1c2ad7[_0x5b38('0x3f')]['filter']){_0x2f9877[_0x5b38('0x48')]=_['merge'](_0x2f9877[_0x5b38('0x48')],{'$or':_[_0x5b38('0x4c')](_0x2f9877['attributes'],function(_0x5d3647){var _0x5029be={};_0x5029be[_0x5d3647]={'$like':'%'+_0x1c2ad7[_0x5b38('0x3f')][_0x5b38('0x4a')]+'%'};return _0x5029be;})});}_0x2f9877=_[_0x5b38('0x4b')]({},_0x2f9877,_0x1c2ad7[_0x5b38('0x4e')]);return _0x5ea059[_0x5b38('0x5b')](_0x2f9877);}})[_0x5b38('0x22')](function(_0x50399f){if(_0x50399f){_0x397ee5=_0x50399f['length'];if(!_0x1c2ad7[_0x5b38('0x3f')][_0x5b38('0x44')](_0x5b38('0x45'))){_0x2f9877[_0x5b38('0x31')]=qs[_0x5b38('0x31')](_0x1c2ad7[_0x5b38('0x3f')]['limit']);_0x2f9877[_0x5b38('0x30')]=qs['offset'](_0x1c2ad7['query'][_0x5b38('0x30')]);}return _0x5ea059[_0x5b38('0x5b')](_0x2f9877);}})[_0x5b38('0x22')](function(_0x46412e){if(_0x46412e){return _0x46412e?{'count':_0x397ee5,'rows':_0x46412e}:null;}})['then'](respondWithResult(_0x29513f,null))[_0x5b38('0x2b')](handleError(_0x29513f,null));};exports[_0x5b38('0x5d')]=function(_0x17f1d6,_0x3f4ef8,_0x35d8fa){if(_0x17f1d6[_0x5b38('0x58')]['id']){delete _0x17f1d6['body']['id'];}return db[_0x5b38('0x3b')]['findOne']({'where':{'id':_0x17f1d6[_0x5b38('0x59')]['id']}})[_0x5b38('0x22')](handleEntityNotFound(_0x3f4ef8,null))[_0x5b38('0x22')](function(_0x1df354){if(_0x1df354){_0x17f1d6[_0x5b38('0x58')][_0x5b38('0x5e')]=_0x1df354['id'];_0x17f1d6[_0x5b38('0x58')]['Subjects']=integrations[_0x5b38('0x5f')](_0x17f1d6[_0x5b38('0x58')]['channel'],_0x17f1d6[_0x5b38('0x58')][_0x5b38('0x3d')]);_0x17f1d6['body'][_0x5b38('0x60')]=integrations['getDescriptions'](_0x17f1d6[_0x5b38('0x58')][_0x5b38('0x61')],_0x17f1d6[_0x5b38('0x58')][_0x5b38('0x3d')]);return db[_0x5b38('0x5c')][_0x5b38('0x57')](_0x17f1d6[_0x5b38('0x58')],{'include':[{'model':db[_0x5b38('0x62')],'as':_0x5b38('0x63')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x5b38('0x22')](respondWithResult(_0x3f4ef8,null))[_0x5b38('0x2b')](handleError(_0x3f4ef8,null));};exports[_0x5b38('0x64')]=function(_0x177232,_0x380981,_0x1b7f86){var _0x109349=_0x177232[_0x5b38('0x3f')][_0x5b38('0x65')];var _0x3130cd=_0x109349===_0x5b38('0x66')?_0x5b38('0x67'):_0x5b38('0x68');var _0x19f4dd='';var _0x444496='';var _0x20ffc7='';var _0x205025='';var _0x51c6f3='';var _0x278ac7='';var _0x156024='';var _0x174f20='';var _0xaf099e=[_0x5b38('0x69'),'description',_0x5b38('0x6a'),_0x5b38('0x6b'),_0x5b38('0x6c'),_0x5b38('0x6d'),'phonenumber','regardingobjectid',_0x5b38('0x6e'),'phonecall_activity_parties'];var _0x419c48=[_0x5b38('0x6f'),_0x5b38('0x70'),_0x5b38('0x71'),_0x5b38('0x72'),'contactidname',_0x5b38('0x73'),_0x5b38('0x74'),_0x5b38('0x75'),_0x5b38('0x76'),_0x5b38('0x77'),'createdbyname',_0x5b38('0x78'),_0x5b38('0x79'),_0x5b38('0x7a'),_0x5b38('0x7b'),_0x5b38('0x7c'),_0x5b38('0x7d'),_0x5b38('0x7e'),_0x5b38('0x7f'),_0x5b38('0x80'),_0x5b38('0x81'),_0x5b38('0x82'),_0x5b38('0x83'),_0x5b38('0x84'),_0x5b38('0x85'),'followupby',_0x5b38('0x86'),_0x5b38('0x87'),_0x5b38('0x88'),_0x5b38('0x89'),_0x5b38('0x8a'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x5b38('0x8b'),_0x5b38('0x8c'),'modifiedon',_0x5b38('0x8d'),'modifiedonbehalfbyyominame',_0x5b38('0x8e'),_0x5b38('0x8f'),_0x5b38('0x90'),_0x5b38('0x91'),_0x5b38('0x92'),_0x5b38('0x93'),'owneridtype',_0x5b38('0x94'),_0x5b38('0x95'),_0x5b38('0x96'),'primarycontactidyominame',_0x5b38('0x97'),_0x5b38('0x98'),_0x5b38('0x99'),_0x5b38('0x9a'),_0x5b38('0x9b'),_0x5b38('0x9c'),_0x5b38('0x9d'),_0x5b38('0x9e'),_0x5b38('0x9f'),'slainvokedidname',_0x5b38('0xa0'),_0x5b38('0xa1'),'statecode',_0x5b38('0xa2'),_0x5b38('0xa3'),_0x5b38('0xa4'),_0x5b38('0xa5'),_0x5b38('0xa6'),_0x5b38('0xa7'),'utcconversiontimezonecode',_0x5b38('0xa8')];var _0x157248=_0xaf099e[_0x5b38('0xa9')](_0x419c48);return db[_0x5b38('0x3b')][_0x5b38('0xaa')]({'where':{'id':_0x177232[_0x5b38('0x59')]['id']},'attributes':['id','username','password',_0x5b38('0xab'),_0x5b38('0xac'),_0x5b38('0xad'),_0x5b38('0xae')]})[_0x5b38('0x22')](handleEntityNotFound(_0x380981,null))[_0x5b38('0x22')](function(_0x3ef3cf){if(_0x3ef3cf){_0x174f20=_0x3ef3cf['remoteUri'];var _0x532d02=_0x174f20[_0x5b38('0xaf')](-0x1);if(_0x532d02==='/'){_0x174f20=_0x174f20[_0x5b38('0xb0')](0x0,_0x174f20[_0x5b38('0xb1')](_0x532d02));}_0x156024=util[_0x5b38('0xb2')]('%s/api/data/v9.0/',_0x174f20);var _0x6cfefc={'method':_0x5b38('0xb3'),'uri':'https://login.microsoftonline.com/'+_0x3ef3cf[_0x5b38('0xac')]+_0x5b38('0xb4'),'form':{'client_id':_0x3ef3cf[_0x5b38('0xad')],'resource':_0x174f20,'username':_0x3ef3cf[_0x5b38('0xb5')],'password':_0x3ef3cf[_0x5b38('0xb6')],'grant_type':'password','client_secret':_0x3ef3cf[_0x5b38('0xae')]},'json':!![]};return rp(_0x6cfefc);}})['then'](function(_0x32d4f9){_0x278ac7=_0x32d4f9[_0x5b38('0xb7')];var _0xe2ce38={'method':_0x5b38('0xb8'),'uri':encodeURI(_0x156024+_0x5b38('0xb9')+_0x3130cd+'\x27'),'headers':{'Authorization':_0x5b38('0xba')+_0x278ac7,'If-None-Match':null,'OData-Version':_0x5b38('0xbb')},'json':!![]};return rp(_0xe2ce38);})[_0x5b38('0x22')](function(_0x46eda9){var _0x155639=_0x46eda9[_0x5b38('0xbc')][0x0];var _0x5b75ee=_0x155639[_0x5b38('0xbd')];var _0x35ad78={'method':_0x5b38('0xb8'),'uri':_0x156024+_0x5b38('0xbe')+_0x5b75ee+_0x5b38('0xbf'),'headers':{'Authorization':_0x5b38('0xba')+_0x278ac7,'If-None-Match':null,'OData-Version':_0x5b38('0xbb')},'json':!![]};return rp(_0x35ad78);})[_0x5b38('0x22')](function(_0x233812){_0x19f4dd=_0x233812;_0x444496=_0x19f4dd[_0x5b38('0xc0')];_0x444496=_[_0x5b38('0xc1')](_0x444496,function(_0x377cab){return!_0x157248[_0x5b38('0xc2')](_0x377cab[_0x5b38('0xc3')]);});var _0x2a6a88=[];var _0x809928=[];_0x444496['forEach'](function(_0x5d5f34){if(_0x5d5f34['@odata.type']){var _0xe0652a=_0x5d5f34[_0x5b38('0xc4')][_0x5b38('0xb0')](_0x5d5f34[_0x5b38('0xc4')][_0x5b38('0xb1')]('.')+0x1);if(_0xe0652a===_0x5b38('0xc5')){_0x2a6a88[_0x5b38('0xc6')](getSelectList(_0x156024,_0x109349,_0x809928,_0x19f4dd[_0x5b38('0xbd')],_0x5d5f34[_0x5b38('0xbd')],_0x278ac7));}}});return Promise[_0x5b38('0xc7')](_0x2a6a88);})[_0x5b38('0x22')](function(_0x215b95){_0x20ffc7=_0x215b95[0x0];var _0x483bca=[];var _0x369afd=[];_0x444496[_0x5b38('0xc8')](function(_0xc704e4){if(!_[_0x5b38('0xc9')](_0xc704e4['@odata.type'])){var _0x3e9fa1=_0xc704e4[_0x5b38('0xc4')][_0x5b38('0xb0')](_0xc704e4[_0x5b38('0xc4')][_0x5b38('0xb1')]('.')+0x1);if(_0x3e9fa1==='BooleanAttributeMetadata'){_0x483bca['push'](getBooleanList(_0x156024,_0x109349,_0x369afd,_0x19f4dd[_0x5b38('0xbd')],_0xc704e4[_0x5b38('0xbd')],_0x278ac7));}}});return Promise[_0x5b38('0xc7')](_0x483bca);})[_0x5b38('0x22')](function(_0x2e2a96){_0x205025=_0x2e2a96[0x0];var _0x254dc9=[];var _0x19ebe7=[];_0x444496[_0x5b38('0xc8')](function(_0x3cfb45){if(_0x3cfb45[_0x5b38('0xc4')]){var _0x53c998=_0x3cfb45[_0x5b38('0xc4')]['substring'](_0x3cfb45[_0x5b38('0xc4')][_0x5b38('0xb1')]('.')+0x1);if(_0x53c998==='StringAttributeMetadata'||_0x53c998==='DoubleAttributeMetadata'||_0x53c998===_0x5b38('0xca')||_0x53c998===_0x5b38('0xcb')||_0x53c998===_0x5b38('0xcc')||_0x53c998===_0x5b38('0xcd')||_0x53c998===_0x5b38('0xce')||_0x53c998==='EntityNameAttributeMetadata'||_0x53c998===_0x5b38('0xcf')||_0x53c998===_0x5b38('0xd0')){_0x254dc9[_0x5b38('0xc6')](getInputList(_0x156024,_0x109349,_0x53c998,_0x19ebe7,_0x19f4dd[_0x5b38('0xbd')],_0x3cfb45[_0x5b38('0xbd')],_0x278ac7));}}});return Promise[_0x5b38('0xc7')](_0x254dc9);})['then'](function(_0x3960fb){_0x51c6f3=_0x3960fb[0x0];var _0x2c17bc=_0x20ffc7[_0x5b38('0xa9')](_0x205025)[_0x5b38('0xa9')](_0x51c6f3);var _0xcb2a63={'count':_0x2c17bc[_0x5b38('0x55')],'rows':_0x2c17bc};return _0xcb2a63;})['then'](respondWithResult(_0x380981,null))['catch'](function(_0x2e272f){var _0x348f64=_0x177232['query'][_0x5b38('0x1d')]?0x1f4:_0x2e272f[_0x5b38('0xd1')]||0x1f4;logger['error'](_0x2e272f['stack']);delete _0x2e272f[_0x5b38('0x38')];if(_0x348f64===0x191){_0x348f64=0x190;}_0x380981[_0x5b38('0x32')](_0x348f64)[_0x5b38('0x39')](_0x177232['query'][_0x5b38('0x1d')]?{'message':_0x5b38('0xd2'),'statusCode':_0x2e272f[_0x5b38('0xd1')]}:_0x2e272f);});};function getSelectList(_0x47de2c,_0x2c9497,_0x31cd2e,_0x135e5d,_0xbfefa3,_0x585a4a){var _0x4b864c={'method':'GET','uri':_0x47de2c+_0x5b38('0xbe')+_0x135e5d+_0x5b38('0xd3')+_0xbfefa3+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x5b38('0xd4'),'headers':{'Authorization':'Bearer\x20'+_0x585a4a,'If-None-Match':null,'OData-Version':_0x5b38('0xbb')},'json':!![]};return rp(_0x4b864c)[_0x5b38('0x22')](function(_0x51ecc8){var _0x9e832b=[];var _0x284e53=_0x51ecc8[_0x5b38('0xd5')][_0x5b38('0xd6')];_0x284e53[_0x5b38('0xc8')](function(_0x1ebce4){_0x9e832b[_0x5b38('0xc6')]({'name':_0x1ebce4[_0x5b38('0xd7')][_0x5b38('0xd8')][_0x5b38('0xd7')],'value':String(_0x1ebce4[_0x5b38('0xd9')])});});var _0x491813={'id':_0x2c9497+'_'+_0x51ecc8['LogicalName'],'name':_0x51ecc8['DisplayName'][_0x5b38('0xd8')][_0x5b38('0xd7')],'custom':![],'options':_0x9e832b};_0x31cd2e[_0x5b38('0xc6')](_0x491813);return _0x31cd2e;});}function getBooleanList(_0x4dde43,_0x5b2d25,_0x431e38,_0xd43c28,_0x2ad631,_0x2dc719){var _0x239da6={'method':'GET','uri':_0x4dde43+'EntityDefinitions('+_0xd43c28+_0x5b38('0xd3')+_0x2ad631+_0x5b38('0xda'),'headers':{'Authorization':_0x5b38('0xba')+_0x2dc719,'If-None-Match':null,'OData-Version':_0x5b38('0xbb')},'json':!![]};return rp(_0x239da6)[_0x5b38('0x22')](function(_0x24455a){var _0xac67bd=[];_0xac67bd[_0x5b38('0xc6')]({'name':_0x24455a[_0x5b38('0xd5')][_0x5b38('0xdb')]['Label']['UserLocalizedLabel'][_0x5b38('0xd7')],'value':_0x5b38('0xdc')},{'name':_0x24455a[_0x5b38('0xd5')][_0x5b38('0xdd')][_0x5b38('0xd7')]['UserLocalizedLabel'][_0x5b38('0xd7')],'value':'false'});var _0x57c3a3={'id':_0x5b2d25+'_'+_0x24455a[_0x5b38('0xc3')],'name':_0x24455a[_0x5b38('0xde')][_0x5b38('0xd8')][_0x5b38('0xd7')],'custom':![],'options':_0xac67bd};_0x431e38[_0x5b38('0xc6')](_0x57c3a3);return _0x431e38;});}function getInputList(_0x39d1f9,_0x52b59b,_0x17a290,_0x51ba31,_0x2a6daf,_0x566d30,_0x378d4c){var _0x57a5bd={'method':_0x5b38('0xb8'),'uri':_0x39d1f9+_0x5b38('0xbe')+_0x2a6daf+')/Attributes('+_0x566d30+_0x5b38('0xdf')+_0x17a290+_0x5b38('0xe0'),'headers':{'Authorization':_0x5b38('0xba')+_0x378d4c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x57a5bd)[_0x5b38('0x22')](function(_0x51310c){var _0x310431={'id':_0x52b59b+'_'+_0x51310c[_0x5b38('0xc3')],'name':_0x51310c[_0x5b38('0xde')][_0x5b38('0xd8')]?_0x51310c[_0x5b38('0xde')][_0x5b38('0xd8')]['Label']:_0x51310c[_0x5b38('0xc3')],'custom':![],'options':[]};_0x51ba31[_0x5b38('0xc6')](_0x310431);return _0x51ba31;});} \ No newline at end of file +var _0x9772=['createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','slice','substring','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','DisplayName','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','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','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','count','offset','limit','set','Content-Range','apply','save','update','sendStatus','stack','name','send','index','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','Dynamics365Account','includeAll','findAll','rows','show','params','keys','include','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','Dynamics365Field','getFields','ticketType','Incident','description','customerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x9772,0x135));var _0x2977=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x9772[_0x819464];return _0x49dcc0;};'use strict';var pdf=require(_0x2977('0x0'));var emlformat=require(_0x2977('0x1'));var rimraf=require(_0x2977('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2977('0x3'));var rp=require('request-promise');var moment=require(_0x2977('0x4'));var BPromise=require(_0x2977('0x5'));var Mustache=require(_0x2977('0x6'));var util=require(_0x2977('0x7'));var path=require(_0x2977('0x8'));var sox=require(_0x2977('0x9'));var csv=require(_0x2977('0xa'));var ejs=require(_0x2977('0xb'));var fs=require('fs');var _=require(_0x2977('0xc'));var squel=require(_0x2977('0xd'));var crypto=require(_0x2977('0xe'));var jsforce=require(_0x2977('0xf'));var deskjs=require(_0x2977('0x10'));var toCsv=require(_0x2977('0xa'));var querystring=require(_0x2977('0x11'));var Papa=require('papaparse');var Redis=require(_0x2977('0x12'));var authService=require(_0x2977('0x13'));var qs=require(_0x2977('0x14'));var as=require(_0x2977('0x15'));var hardwareService=require(_0x2977('0x16'));var logger=require('../../config/logger')(_0x2977('0x17'));var utils=require(_0x2977('0x18'));var config=require(_0x2977('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2977('0x1a'));var jayson=require(_0x2977('0x1b'));var client=jayson[_0x2977('0x1c')][_0x2977('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x54a562,_0x15de93,_0x1c252d){if(_0x1c252d){var _0x108964=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x108964[_0x2977('0x1e')](_0x15de93)){return _0x54a562;}else{throw new db['Sequelize'][(_0x2977('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 _0x54a562;}}function respondWithRpcPromise(_0x280622,_0x153fe0,_0x557c9f,_0x1289d9){return new BPromise(function(_0x47cf19,_0x4ab71b){var _0x5623d6=_0x1289d9||client;return _0x5623d6[_0x2977('0x20')](_0x280622,_0x557c9f)[_0x2977('0x21')](function(_0x7862d5){logger[_0x2977('0x22')](_0x2977('0x23'),_0x153fe0,_0x2977('0x24'));logger['debug'](_0x2977('0x25'),_0x153fe0,_0x2977('0x24'),JSON[_0x2977('0x26')](_0x7862d5));if(_0x7862d5['error']){if(_0x7862d5[_0x2977('0x27')]['code']===0x1f4){logger[_0x2977('0x27')](_0x2977('0x23'),_0x153fe0,_0x7862d5['error'][_0x2977('0x28')]);return _0x4ab71b(_0x7862d5['error']['message']);}logger[_0x2977('0x27')](_0x2977('0x23'),_0x153fe0,_0x7862d5[_0x2977('0x27')]['message']);return _0x47cf19(_0x7862d5[_0x2977('0x27')][_0x2977('0x28')]);}else{logger[_0x2977('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x153fe0,'request\x20sent');_0x47cf19(_0x7862d5[_0x2977('0x29')]['message']);}})[_0x2977('0x2a')](function(_0x1bb223){logger['error'](_0x2977('0x23'),_0x153fe0,_0x1bb223);_0x4ab71b(_0x1bb223);});});}function respondWithStatusCode(_0x31d4dc,_0x56eb06){_0x56eb06=_0x56eb06||0xcc;return function(_0x1d846a){if(_0x1d846a){return _0x31d4dc['sendStatus'](_0x56eb06);}return _0x31d4dc['status'](_0x56eb06)[_0x2977('0x2b')]();};}function respondWithResult(_0x20e9e7,_0x2a8ec6){_0x2a8ec6=_0x2a8ec6||0xc8;return function(_0x321432){if(_0x321432){return _0x20e9e7[_0x2977('0x2c')](_0x2a8ec6)['json'](_0x321432);}};}function respondWithFilteredResult(_0x2102a1,_0xad29f2){return function(_0x7130b3){if(_0x7130b3){var _0x15f87d=_0x7130b3[_0x2977('0x2d')],_0x4ac5bd=_0xad29f2[_0x2977('0x2e')],_0x30c5ef=_0xad29f2[_0x2977('0x2e')]+_0xad29f2[_0x2977('0x2f')],_0x4fa28b;if(_0x30c5ef>=_0x15f87d){_0x30c5ef=_0x15f87d;_0x4fa28b=0xc8;}else{_0x4fa28b=0xce;}_0x2102a1[_0x2977('0x2c')](_0x4fa28b);return _0x2102a1[_0x2977('0x30')](_0x2977('0x31'),_0x4ac5bd+'-'+_0x30c5ef+'/'+_0x15f87d)['json'](_0x7130b3);}return null;};}function patchUpdates(_0x4ed94e){return function(_0xd25c6){try{jsonpatch[_0x2977('0x32')](_0xd25c6,_0x4ed94e,!![]);}catch(_0xb37069){return BPromise['reject'](_0xb37069);}return _0xd25c6[_0x2977('0x33')]();};}function saveUpdates(_0x121565,_0x4cdc23){return function(_0x52cd83){if(_0x52cd83){return _0x52cd83[_0x2977('0x34')](_0x121565)[_0x2977('0x21')](function(_0x4be722){return _0x4be722;});}return null;};}function removeEntity(_0x2b7299,_0x420559){return function(_0x2baa4a){if(_0x2baa4a){return _0x2baa4a['destroy']()['then'](function(){_0x2b7299[_0x2977('0x2c')](0xcc)[_0x2977('0x2b')]();});}};}function handleEntityNotFound(_0x4cd924,_0x3184e1){return function(_0x5bdbf0){if(!_0x5bdbf0){_0x4cd924[_0x2977('0x35')](0x194);}return _0x5bdbf0;};}function handleError(_0x79d81,_0x32995c){_0x32995c=_0x32995c||0x1f4;return function(_0x1fdbca){logger[_0x2977('0x27')](_0x1fdbca[_0x2977('0x36')]);if(_0x1fdbca['name']){delete _0x1fdbca[_0x2977('0x37')];}_0x79d81['status'](_0x32995c)[_0x2977('0x38')](_0x1fdbca);};}exports[_0x2977('0x39')]=function(_0x382029,_0x511014){var _0x114287={},_0x37aa1f={},_0x7b4423={'count':0x0,'rows':[]};var _0x52b898=_['map'](db['Dynamics365Account'][_0x2977('0x3a')],function(_0x2e1bb5){return{'name':_0x2e1bb5['fieldName'],'type':_0x2e1bb5[_0x2977('0x3b')][_0x2977('0x3c')]};});_0x37aa1f[_0x2977('0x3d')]=_['map'](_0x52b898,'name');_0x37aa1f[_0x2977('0x3e')]=_['keys'](_0x382029[_0x2977('0x3e')]);_0x37aa1f[_0x2977('0x3f')]=_[_0x2977('0x40')](_0x37aa1f[_0x2977('0x3d')],_0x37aa1f[_0x2977('0x3e')]);_0x114287['attributes']=_[_0x2977('0x40')](_0x37aa1f[_0x2977('0x3d')],qs[_0x2977('0x41')](_0x382029['query'][_0x2977('0x41')]));_0x114287['attributes']=_0x114287[_0x2977('0x42')][_0x2977('0x43')]?_0x114287[_0x2977('0x42')]:_0x37aa1f[_0x2977('0x3d')];if(!_0x382029[_0x2977('0x3e')][_0x2977('0x44')](_0x2977('0x45'))){_0x114287['limit']=qs['limit'](_0x382029[_0x2977('0x3e')]['limit']);_0x114287['offset']=qs['offset'](_0x382029[_0x2977('0x3e')][_0x2977('0x2e')]);}_0x114287[_0x2977('0x46')]=qs[_0x2977('0x47')](_0x382029[_0x2977('0x3e')][_0x2977('0x47')]);_0x114287[_0x2977('0x48')]=qs[_0x2977('0x3f')](_['pick'](_0x382029['query'],_0x37aa1f[_0x2977('0x3f')]),_0x52b898);if(_0x382029[_0x2977('0x3e')][_0x2977('0x49')]){_0x114287[_0x2977('0x48')]=_[_0x2977('0x4a')](_0x114287['where'],{'$or':_[_0x2977('0x4b')](_0x52b898,function(_0x20e90d){if(_0x20e90d[_0x2977('0x3b')]!==_0x2977('0x4c')){var _0x1b1664={};_0x1b1664[_0x20e90d['name']]={'$like':'%'+_0x382029[_0x2977('0x3e')]['filter']+'%'};return _0x1b1664;}})});}_0x114287=_['merge']({},_0x114287,_0x382029[_0x2977('0x4d')]);var _0x2e811d={'where':_0x114287[_0x2977('0x48')]};return db[_0x2977('0x4e')][_0x2977('0x2d')](_0x2e811d)[_0x2977('0x21')](function(_0x41f6ea){_0x7b4423[_0x2977('0x2d')]=_0x41f6ea;if(_0x382029[_0x2977('0x3e')][_0x2977('0x4f')]){_0x114287['include']=[{'all':!![]}];}return db[_0x2977('0x4e')][_0x2977('0x50')](_0x114287);})[_0x2977('0x21')](function(_0x589617){_0x7b4423[_0x2977('0x51')]=_0x589617;return _0x7b4423;})[_0x2977('0x21')](respondWithFilteredResult(_0x511014,_0x114287))[_0x2977('0x2a')](handleError(_0x511014,null));};exports[_0x2977('0x52')]=function(_0x18ca14,_0x5b84f7){var _0x21b382={'raw':![],'where':{'id':_0x18ca14[_0x2977('0x53')]['id']}},_0x26efeb={};_0x26efeb[_0x2977('0x3d')]=_[_0x2977('0x54')](db['Dynamics365Account']['rawAttributes']);_0x26efeb[_0x2977('0x3e')]=_['keys'](_0x18ca14['query']);_0x26efeb['filters']=_[_0x2977('0x40')](_0x26efeb[_0x2977('0x3d')],_0x26efeb[_0x2977('0x3e')]);_0x21b382['attributes']=_[_0x2977('0x40')](_0x26efeb[_0x2977('0x3d')],qs[_0x2977('0x41')](_0x18ca14[_0x2977('0x3e')]['fields']));_0x21b382[_0x2977('0x42')]=_0x21b382[_0x2977('0x42')][_0x2977('0x43')]?_0x21b382[_0x2977('0x42')]:_0x26efeb['model'];if(_0x18ca14[_0x2977('0x3e')]['includeAll']){_0x21b382[_0x2977('0x55')]=[{'all':!![]}];}_0x21b382=_[_0x2977('0x4a')]({},_0x21b382,_0x18ca14[_0x2977('0x4d')]);return db[_0x2977('0x4e')][_0x2977('0x56')](_0x21b382)[_0x2977('0x21')](handleEntityNotFound(_0x5b84f7,null))['then'](respondWithResult(_0x5b84f7,null))[_0x2977('0x2a')](handleError(_0x5b84f7,null));};exports[_0x2977('0x57')]=function(_0x3b2d0e,_0x216594){return db[_0x2977('0x4e')][_0x2977('0x57')](_0x3b2d0e[_0x2977('0x58')],{})[_0x2977('0x21')](respondWithResult(_0x216594,0xc9))[_0x2977('0x2a')](handleError(_0x216594,null));};exports[_0x2977('0x34')]=function(_0x635c44,_0x4b6dc8){if(_0x635c44[_0x2977('0x58')]['id']){delete _0x635c44['body']['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x635c44[_0x2977('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b6dc8,null))[_0x2977('0x21')](saveUpdates(_0x635c44[_0x2977('0x58')],null))[_0x2977('0x21')](respondWithResult(_0x4b6dc8,null))[_0x2977('0x2a')](handleError(_0x4b6dc8,null));};exports[_0x2977('0x59')]=function(_0x380ac5,_0x100746){return db[_0x2977('0x4e')][_0x2977('0x56')]({'where':{'id':_0x380ac5[_0x2977('0x53')]['id']}})[_0x2977('0x21')](handleEntityNotFound(_0x100746,null))[_0x2977('0x21')](removeEntity(_0x100746,null))[_0x2977('0x2a')](handleError(_0x100746,null));};exports[_0x2977('0x5a')]=function(_0x13d0e8,_0x1f3690,_0x30ecbe){var _0x418f6e={};var _0x25fa9c={};var _0x54ce72;var _0x3b8a71;return db['Dynamics365Account'][_0x2977('0x5b')]({'where':{'id':_0x13d0e8[_0x2977('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f3690,null))[_0x2977('0x21')](function(_0x1260c1){if(_0x1260c1){_0x54ce72=_0x1260c1;_0x25fa9c[_0x2977('0x3d')]=_[_0x2977('0x54')](db[_0x2977('0x5c')]['rawAttributes']);_0x25fa9c[_0x2977('0x3e')]=_[_0x2977('0x54')](_0x13d0e8['query']);_0x25fa9c[_0x2977('0x3f')]=_['intersection'](_0x25fa9c[_0x2977('0x3d')],_0x25fa9c['query']);_0x418f6e[_0x2977('0x42')]=_[_0x2977('0x40')](_0x25fa9c[_0x2977('0x3d')],qs[_0x2977('0x41')](_0x13d0e8[_0x2977('0x3e')]['fields']));_0x418f6e['attributes']=_0x418f6e['attributes'][_0x2977('0x43')]?_0x418f6e[_0x2977('0x42')]:_0x25fa9c['model'];_0x418f6e[_0x2977('0x46')]=qs[_0x2977('0x47')](_0x13d0e8['query']['sort']);_0x418f6e['where']=qs[_0x2977('0x3f')](_[_0x2977('0x5d')](_0x13d0e8[_0x2977('0x3e')],_0x25fa9c[_0x2977('0x3f')]));if(_0x13d0e8[_0x2977('0x3e')][_0x2977('0x49')]){_0x418f6e[_0x2977('0x48')]=_['merge'](_0x418f6e[_0x2977('0x48')],{'$or':_['map'](_0x418f6e[_0x2977('0x42')],function(_0x4dc0b9){var _0x3b9c4a={};_0x3b9c4a[_0x4dc0b9]={'$like':'%'+_0x13d0e8[_0x2977('0x3e')][_0x2977('0x49')]+'%'};return _0x3b9c4a;})});}_0x418f6e=_[_0x2977('0x4a')]({},_0x418f6e,_0x13d0e8[_0x2977('0x4d')]);return _0x54ce72[_0x2977('0x5a')](_0x418f6e);}})[_0x2977('0x21')](function(_0x3f7512){if(_0x3f7512){_0x3b8a71=_0x3f7512[_0x2977('0x43')];if(!_0x13d0e8[_0x2977('0x3e')][_0x2977('0x44')](_0x2977('0x45'))){_0x418f6e['limit']=qs[_0x2977('0x2f')](_0x13d0e8[_0x2977('0x3e')][_0x2977('0x2f')]);_0x418f6e[_0x2977('0x2e')]=qs[_0x2977('0x2e')](_0x13d0e8[_0x2977('0x3e')][_0x2977('0x2e')]);}return _0x54ce72['getConfigurations'](_0x418f6e);}})[_0x2977('0x21')](function(_0x34906d){if(_0x34906d){return _0x34906d?{'count':_0x3b8a71,'rows':_0x34906d}:null;}})[_0x2977('0x21')](respondWithResult(_0x1f3690,null))['catch'](handleError(_0x1f3690,null));};exports[_0x2977('0x5e')]=function(_0x4c39a6,_0x3b0cd4,_0x93f2d8){if(_0x4c39a6[_0x2977('0x58')]['id']){delete _0x4c39a6[_0x2977('0x58')]['id'];}return db['Dynamics365Account'][_0x2977('0x5b')]({'where':{'id':_0x4c39a6[_0x2977('0x53')]['id']}})[_0x2977('0x21')](handleEntityNotFound(_0x3b0cd4,null))[_0x2977('0x21')](function(_0x438c37){if(_0x438c37){_0x4c39a6[_0x2977('0x58')][_0x2977('0x5f')]=_0x438c37['id'];_0x4c39a6[_0x2977('0x58')][_0x2977('0x60')]=integrations['getSubjects'](_0x4c39a6[_0x2977('0x58')][_0x2977('0x61')],_0x4c39a6[_0x2977('0x58')]['type']);_0x4c39a6[_0x2977('0x58')][_0x2977('0x62')]=integrations['getDescriptions'](_0x4c39a6[_0x2977('0x58')][_0x2977('0x61')],_0x4c39a6[_0x2977('0x58')][_0x2977('0x3b')]);return db[_0x2977('0x5c')][_0x2977('0x57')](_0x4c39a6['body'],{'include':[{'model':db[_0x2977('0x63')],'as':_0x2977('0x60')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x2977('0x21')](respondWithResult(_0x3b0cd4,null))[_0x2977('0x2a')](handleError(_0x3b0cd4,null));};exports[_0x2977('0x64')]=function(_0x4e037b,_0xe3248b,_0x31e91f){var _0x1f1ce7=_0x4e037b[_0x2977('0x3e')][_0x2977('0x65')];var _0x5a8674=_0x1f1ce7==='incident'?_0x2977('0x66'):'PhoneCall';var _0x4ee1e1='';var _0x41e426='';var _0x2ce630='';var _0x418304='';var _0x719a8='';var _0x39867d='';var _0x1cf822='';var _0x36bef9='';var _0x2d1ab2=['title',_0x2977('0x67'),_0x2977('0x68'),'ownerid',_0x2977('0x69'),_0x2977('0x6a'),_0x2977('0x6b'),'regardingobjectid',_0x2977('0x6c'),_0x2977('0x6d')];var _0x1e9b06=[_0x2977('0x6e'),_0x2977('0x6f'),_0x2977('0x70'),_0x2977('0x71'),_0x2977('0x72'),_0x2977('0x73'),_0x2977('0x74'),'contractidname',_0x2977('0x75'),'createdbyexternalpartyyominame',_0x2977('0x76'),'createdbyyominame',_0x2977('0x77'),_0x2977('0x78'),_0x2977('0x79'),'customeridname',_0x2977('0x7a'),_0x2977('0x7b'),_0x2977('0x7c'),_0x2977('0x7d'),_0x2977('0x7e'),_0x2977('0x7f'),_0x2977('0x80'),_0x2977('0x81'),'firstresponsebykpiidname',_0x2977('0x82'),_0x2977('0x83'),_0x2977('0x84'),_0x2977('0x85'),'lastonholdtime',_0x2977('0x86'),'modifiedbyexternalpartyname',_0x2977('0x87'),_0x2977('0x88'),_0x2977('0x89'),_0x2977('0x8a'),_0x2977('0x8b'),_0x2977('0x8c'),_0x2977('0x8d'),_0x2977('0x8e'),_0x2977('0x8f'),'onholdtime','overriddencreatedon','owneridname','owneridtype',_0x2977('0x90'),_0x2977('0x91'),_0x2977('0x92'),'primarycontactidyominame','prioritycodename',_0x2977('0x93'),_0x2977('0x94'),_0x2977('0x95'),_0x2977('0x96'),'responseby',_0x2977('0x97'),_0x2977('0x98'),_0x2977('0x99'),_0x2977('0x9a'),'slaname','socialprofileidname','statecode',_0x2977('0x9b'),_0x2977('0x9c'),_0x2977('0x9d'),_0x2977('0x9e'),'transactioncurrencyidname',_0x2977('0x9f'),_0x2977('0xa0'),_0x2977('0xa1')];var _0x1f8649=_0x2d1ab2[_0x2977('0xa2')](_0x1e9b06);return db[_0x2977('0x4e')][_0x2977('0x5b')]({'where':{'id':_0x4e037b['params']['id']},'attributes':['id',_0x2977('0xa3'),_0x2977('0xa4'),_0x2977('0xa5'),'tenantId',_0x2977('0xa6'),_0x2977('0xa7')]})[_0x2977('0x21')](handleEntityNotFound(_0xe3248b,null))['then'](function(_0x5cab44){if(_0x5cab44){_0x36bef9=_0x5cab44[_0x2977('0xa5')];var _0x11e99c=_0x36bef9[_0x2977('0xa8')](-0x1);if(_0x11e99c==='/'){_0x36bef9=_0x36bef9[_0x2977('0xa9')](0x0,_0x36bef9['lastIndexOf'](_0x11e99c));}_0x1cf822=util[_0x2977('0xaa')](_0x2977('0xab'),_0x36bef9);var _0x4768f3={'method':'POST','uri':_0x2977('0xac')+_0x5cab44['tenantId']+_0x2977('0xad'),'form':{'client_id':_0x5cab44['clientId'],'resource':_0x36bef9,'username':_0x5cab44[_0x2977('0xa3')],'password':_0x5cab44[_0x2977('0xa4')],'grant_type':_0x2977('0xa4'),'client_secret':_0x5cab44[_0x2977('0xa7')]},'json':!![]};return rp(_0x4768f3);}})['then'](function(_0x2fb333){_0x39867d=_0x2fb333[_0x2977('0xae')];var _0x1a0f95={'method':'GET','uri':encodeURI(_0x1cf822+_0x2977('0xaf')+_0x5a8674+'\x27'),'headers':{'Authorization':_0x2977('0xb0')+_0x39867d,'If-None-Match':null,'OData-Version':_0x2977('0xb1')},'json':!![]};return rp(_0x1a0f95);})['then'](function(_0x33a1a3){var _0x2b3e8b=_0x33a1a3[_0x2977('0xb2')][0x0];var _0x2a4223=_0x2b3e8b[_0x2977('0xb3')];var _0x211346={'method':_0x2977('0xb4'),'uri':_0x1cf822+'EntityDefinitions('+_0x2a4223+_0x2977('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x39867d,'If-None-Match':null,'OData-Version':_0x2977('0xb1')},'json':!![]};return rp(_0x211346);})['then'](function(_0x395a82){_0x4ee1e1=_0x395a82;_0x41e426=_0x4ee1e1[_0x2977('0xb6')];_0x41e426=_[_0x2977('0xb7')](_0x41e426,function(_0x3a684b){return!_0x1f8649[_0x2977('0xb8')](_0x3a684b[_0x2977('0xb9')]);});var _0xec5d53=[];var _0x2f4c4c=[];_0x41e426[_0x2977('0xba')](function(_0x550b8f){if(_0x550b8f[_0x2977('0xbb')]){var _0x179904=_0x550b8f[_0x2977('0xbb')][_0x2977('0xa9')](_0x550b8f[_0x2977('0xbb')][_0x2977('0xbc')]('.')+0x1);if(_0x179904===_0x2977('0xbd')){_0xec5d53[_0x2977('0xbe')](getSelectList(_0x1cf822,_0x1f1ce7,_0x2f4c4c,_0x4ee1e1[_0x2977('0xb3')],_0x550b8f[_0x2977('0xb3')],_0x39867d));}}});return Promise[_0x2977('0xbf')](_0xec5d53);})[_0x2977('0x21')](function(_0x149b49){_0x2ce630=_0x149b49[0x0];var _0x2baf19=[];var _0x4691aa=[];_0x41e426[_0x2977('0xba')](function(_0x3f6f56){if(!_[_0x2977('0xc0')](_0x3f6f56[_0x2977('0xbb')])){var _0x4b33bd=_0x3f6f56[_0x2977('0xbb')][_0x2977('0xa9')](_0x3f6f56['@odata.type'][_0x2977('0xbc')]('.')+0x1);if(_0x4b33bd==='BooleanAttributeMetadata'){_0x2baf19[_0x2977('0xbe')](getBooleanList(_0x1cf822,_0x1f1ce7,_0x4691aa,_0x4ee1e1['MetadataId'],_0x3f6f56[_0x2977('0xb3')],_0x39867d));}}});return Promise['all'](_0x2baf19);})[_0x2977('0x21')](function(_0x423791){_0x418304=_0x423791[0x0];var _0x2dbd9c=[];var _0x28fa61=[];_0x41e426[_0x2977('0xba')](function(_0x4b6e13){if(_0x4b6e13[_0x2977('0xbb')]){var _0x248db0=_0x4b6e13[_0x2977('0xbb')][_0x2977('0xa9')](_0x4b6e13[_0x2977('0xbb')]['lastIndexOf']('.')+0x1);if(_0x248db0===_0x2977('0xc1')||_0x248db0===_0x2977('0xc2')||_0x248db0===_0x2977('0xc3')||_0x248db0==='IntegerAttributeMetadata'||_0x248db0===_0x2977('0xc4')||_0x248db0===_0x2977('0xc5')||_0x248db0===_0x2977('0xc6')||_0x248db0==='EntityNameAttributeMetadata'||_0x248db0==='StateAttributeMetadata'||_0x248db0===_0x2977('0xc7')){_0x2dbd9c[_0x2977('0xbe')](getInputList(_0x1cf822,_0x1f1ce7,_0x248db0,_0x28fa61,_0x4ee1e1['MetadataId'],_0x4b6e13['MetadataId'],_0x39867d));}}});return Promise['all'](_0x2dbd9c);})[_0x2977('0x21')](function(_0x4991ff){_0x719a8=_0x4991ff[0x0];var _0x41f1c6=_0x2ce630[_0x2977('0xa2')](_0x418304)['concat'](_0x719a8);var _0x36c262={'count':_0x41f1c6[_0x2977('0x43')],'rows':_0x41f1c6};return _0x36c262;})[_0x2977('0x21')](respondWithResult(_0xe3248b,null))[_0x2977('0x2a')](function(_0x24f770){var _0x2feae6=_0x4e037b[_0x2977('0x3e')][_0x2977('0x1e')]?0x1f4:_0x24f770[_0x2977('0xc8')]||0x1f4;logger['error'](_0x24f770[_0x2977('0x36')]);delete _0x24f770[_0x2977('0x37')];if(_0x2feae6===0x191){_0x2feae6=0x190;}_0xe3248b[_0x2977('0x2c')](_0x2feae6)['send'](_0x4e037b[_0x2977('0x3e')][_0x2977('0x1e')]?{'message':'Wrong\x20credentials','statusCode':_0x24f770[_0x2977('0xc8')]}:_0x24f770);});};function getSelectList(_0x7d770f,_0x3cfd25,_0x3c915e,_0x140440,_0xb16846,_0x3c0cbf){var _0x45099f={'method':_0x2977('0xb4'),'uri':_0x7d770f+_0x2977('0xc9')+_0x140440+_0x2977('0xca')+_0xb16846+_0x2977('0xcb')+_0x2977('0xcc'),'headers':{'Authorization':_0x2977('0xb0')+_0x3c0cbf,'If-None-Match':null,'OData-Version':_0x2977('0xb1')},'json':!![]};return rp(_0x45099f)[_0x2977('0x21')](function(_0x3e6287){var _0x43a457=[];var _0x364d2d=_0x3e6287[_0x2977('0xcd')][_0x2977('0xce')];_0x364d2d[_0x2977('0xba')](function(_0x440403){_0x43a457[_0x2977('0xbe')]({'name':_0x440403[_0x2977('0xcf')][_0x2977('0xd0')]['Label'],'value':String(_0x440403[_0x2977('0xd1')])});});var _0x4b32f8={'id':_0x3cfd25+'_'+_0x3e6287[_0x2977('0xb9')],'name':_0x3e6287['DisplayName']['UserLocalizedLabel'][_0x2977('0xcf')],'custom':![],'options':_0x43a457};_0x3c915e[_0x2977('0xbe')](_0x4b32f8);return _0x3c915e;});}function getBooleanList(_0x50d0a4,_0x47d2a9,_0x41f74b,_0x20ec17,_0x58c729,_0x547c81){var _0x1ed05b={'method':_0x2977('0xb4'),'uri':_0x50d0a4+_0x2977('0xc9')+_0x20ec17+')/Attributes('+_0x58c729+_0x2977('0xd2'),'headers':{'Authorization':'Bearer\x20'+_0x547c81,'If-None-Match':null,'OData-Version':_0x2977('0xb1')},'json':!![]};return rp(_0x1ed05b)[_0x2977('0x21')](function(_0x2b8062){var _0x2daa02=[];_0x2daa02[_0x2977('0xbe')]({'name':_0x2b8062[_0x2977('0xcd')][_0x2977('0xd3')][_0x2977('0xcf')][_0x2977('0xd0')]['Label'],'value':_0x2977('0xd4')},{'name':_0x2b8062['OptionSet']['FalseOption'][_0x2977('0xcf')][_0x2977('0xd0')][_0x2977('0xcf')],'value':'false'});var _0x8c8501={'id':_0x47d2a9+'_'+_0x2b8062[_0x2977('0xb9')],'name':_0x2b8062[_0x2977('0xd5')]['UserLocalizedLabel'][_0x2977('0xcf')],'custom':![],'options':_0x2daa02};_0x41f74b[_0x2977('0xbe')](_0x8c8501);return _0x41f74b;});}function getInputList(_0x5fc57e,_0x15a30c,_0x3834c8,_0x5f215d,_0x113d20,_0x51da69,_0x289548){var _0x45f00f={'method':'GET','uri':_0x5fc57e+'EntityDefinitions('+_0x113d20+')/Attributes('+_0x51da69+')/Microsoft.Dynamics.CRM.'+_0x3834c8+_0x2977('0xd6'),'headers':{'Authorization':'Bearer\x20'+_0x289548,'If-None-Match':null,'OData-Version':_0x2977('0xb1')},'json':!![]};return rp(_0x45f00f)[_0x2977('0x21')](function(_0x500135){var _0x25f24b={'id':_0x15a30c+'_'+_0x500135[_0x2977('0xb9')],'name':_0x500135[_0x2977('0xd5')][_0x2977('0xd0')]?_0x500135[_0x2977('0xd5')][_0x2977('0xd0')]['Label']:_0x500135[_0x2977('0xb9')],'custom':![],'options':[]};_0x5f215d[_0x2977('0xbe')](_0x25f24b);return _0x5f215d;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6477d9c..739cafa 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 _0xe24e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','Dynamics365Account','lodash'];(function(_0x1adf4a,_0x55d81f){var _0x20c377=function(_0x484abb){while(--_0x484abb){_0x1adf4a['push'](_0x1adf4a['shift']());}};_0x20c377(++_0x55d81f);}(_0xe24e,0x15f));var _0xee24=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe24e[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xee24('0x0'));var util=require(_0xee24('0x1'));var logger=require(_0xee24('0x2'))(_0xee24('0x3'));var moment=require(_0xee24('0x4'));var BPromise=require(_0xee24('0x5'));var rp=require(_0xee24('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee24('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0xee24('0x8')]=function(_0x20c8a0,_0x44f46c){return _0x20c8a0[_0xee24('0x9')](_0xee24('0xa'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a15=['request-promise','path','rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1894e7,_0x1253e6){var _0x5e857f=function(_0x1b47c3){while(--_0x1b47c3){_0x1894e7['push'](_0x1894e7['shift']());}};_0x5e857f(++_0x1253e6);}(_0x1a15,0x103));var _0x51a1=function(_0x584f81,_0x26fa78){_0x584f81=_0x584f81-0x0;var _0x3896a3=_0x1a15[_0x584f81];return _0x3896a3;};'use strict';var _=require(_0x51a1('0x0'));var util=require(_0x51a1('0x1'));var logger=require(_0x51a1('0x2'))('api');var moment=require(_0x51a1('0x3'));var BPromise=require(_0x51a1('0x4'));var rp=require(_0x51a1('0x5'));var fs=require('fs');var path=require(_0x51a1('0x6'));var rimraf=require(_0x51a1('0x7'));var config=require('../../config/environment');var attributes=require(_0x51a1('0x8'));var integrations=require(_0x51a1('0x9'));module[_0x51a1('0xa')]=function(_0x4d8db0,_0x395039){return _0x4d8db0[_0x51a1('0xb')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 67eadb1..b085a33 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 _0xe55d=['map','model','attributes','then','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','request\x20sent','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','limit','include'];(function(_0x13f1eb,_0x141549){var _0x27fded=function(_0xb12a78){while(--_0xb12a78){_0x13f1eb['push'](_0x13f1eb['shift']());}};_0x27fded(++_0x141549);}(_0xe55d,0x126));var _0xde55=function(_0x5f58c2,_0x20129d){_0x5f58c2=_0x5f58c2-0x0;var _0x15c13c=_0xe55d[_0x5f58c2];return _0x15c13c;};'use strict';var _=require(_0xde55('0x0'));var util=require(_0xde55('0x1'));var moment=require('moment');var BPromise=require(_0xde55('0x2'));var rs=require(_0xde55('0x3'));var fs=require('fs');var Redis=require(_0xde55('0x4'));var db=require(_0xde55('0x5'))['db'];var utils=require(_0xde55('0x6'));var logger=require(_0xde55('0x7'))('rpc');var config=require(_0xde55('0x8'));var jayson=require(_0xde55('0x9'));var client=jayson[_0xde55('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e7b53,_0x1468f2,_0x1e342e){return new BPromise(function(_0x2094bb,_0x22cbd8){return client[_0xde55('0xb')](_0x1e7b53,_0x1e342e)['then'](function(_0x11aa16){logger[_0xde55('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x1468f2,'request\x20sent');logger[_0xde55('0xd')](_0xde55('0xe'),_0x1468f2,'request\x20sent',JSON[_0xde55('0xf')](_0x11aa16));if(_0x11aa16[_0xde55('0x10')]){if(_0x11aa16['error'][_0xde55('0x11')]===0x1f4){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16['error'][_0xde55('0x13')]);return _0x22cbd8(_0x11aa16[_0xde55('0x10')][_0xde55('0x13')]);}logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16[_0xde55('0x10')]['message']);return _0x2094bb(_0x11aa16['error'][_0xde55('0x13')]);}else{logger[_0xde55('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x1468f2,_0xde55('0x14'));_0x2094bb(_0x11aa16[_0xde55('0x15')][_0xde55('0x13')]);}})[_0xde55('0x16')](function(_0x2f4a77){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x2f4a77);_0x22cbd8(_0x2f4a77);});});}exports[_0xde55('0x17')]=function(_0x4a97e2){var _0x1abffb=this;return new Promise(function(_0x42b6e4,_0x13551d){return db[_0xde55('0x18')]['findAll']({'raw':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2['options'][_0xde55('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2['options'][_0xde55('0x1b')]||null:null,'attributes':_0x4a97e2['options']?_0x4a97e2[_0xde55('0x19')]['attributes']||null:null,'limit':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2['options'][_0xde55('0x1c')]||null:null,'include':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2[_0xde55('0x19')][_0xde55('0x1d')]?_[_0xde55('0x1e')](_0x4a97e2[_0xde55('0x19')][_0xde55('0x1d')],function(_0x2e7607){return{'model':db[_0x2e7607[_0xde55('0x1f')]],'as':_0x2e7607['as'],'attributes':_0x2e7607['attributes'],'include':_0x2e7607['include']?_[_0xde55('0x1e')](_0x2e7607[_0xde55('0x1d')],function(_0x15a04b){return{'model':db[_0x15a04b[_0xde55('0x1f')]],'as':_0x15a04b['as'],'attributes':_0x15a04b[_0xde55('0x20')],'include':_0x15a04b[_0xde55('0x1d')]?_[_0xde55('0x1e')](_0x15a04b[_0xde55('0x1d')],function(_0x35f246){return{'model':db[_0x35f246[_0xde55('0x1f')]],'as':_0x35f246['as'],'attributes':_0x35f246[_0xde55('0x20')]};}):[]};}):[]};}):[]:[]})[_0xde55('0x21')](function(_0x43c1f4){logger['info']('GetDynamics365Account',_0x4a97e2);logger[_0xde55('0xd')]('GetDynamics365Account',_0x4a97e2,JSON[_0xde55('0xf')](_0x43c1f4));_0x42b6e4(_0x43c1f4);})[_0xde55('0x16')](function(_0x2c42a2){logger['error'](_0xde55('0x17'),_0x2c42a2[_0xde55('0x13')],_0x4a97e2);_0x13551d(_0x1abffb['error'](0x1f4,_0x2c42a2[_0xde55('0x13')]));});});};exports[_0xde55('0x22')]=function(_0x76b11f){var _0x513eb5=this;return new Promise(function(_0x586008,_0x2629ea){return db[_0xde55('0x18')][_0xde55('0x23')]({'raw':_0x76b11f[_0xde55('0x19')]?_0x76b11f[_0xde55('0x19')][_0xde55('0x1a')]===undefined?!![]:![]:!![],'where':_0x76b11f['options']?_0x76b11f[_0xde55('0x19')][_0xde55('0x1b')]||null:null,'attributes':_0x76b11f[_0xde55('0x19')]?_0x76b11f['options'][_0xde55('0x20')]||null:null,'include':_0x76b11f[_0xde55('0x19')]?_0x76b11f[_0xde55('0x19')][_0xde55('0x1d')]?_[_0xde55('0x1e')](_0x76b11f[_0xde55('0x19')][_0xde55('0x1d')],function(_0x58bac3){return{'model':db[_0x58bac3[_0xde55('0x1f')]],'as':_0x58bac3['as'],'attributes':_0x58bac3[_0xde55('0x20')],'include':_0x58bac3[_0xde55('0x1d')]?_['map'](_0x58bac3[_0xde55('0x1d')],function(_0x4e50dd){return{'model':db[_0x4e50dd[_0xde55('0x1f')]],'as':_0x4e50dd['as'],'attributes':_0x4e50dd['attributes'],'include':_0x4e50dd[_0xde55('0x1d')]?_[_0xde55('0x1e')](_0x4e50dd['include'],function(_0x4836de){return{'model':db[_0x4836de['model']],'as':_0x4836de['as'],'attributes':_0x4836de[_0xde55('0x20')]};}):[]};}):[]};}):[]:[]})[_0xde55('0x21')](function(_0x414502){logger[_0xde55('0xc')](_0xde55('0x22'),_0x76b11f);logger[_0xde55('0xd')](_0xde55('0x22'),_0x76b11f,JSON[_0xde55('0xf')](_0x414502));_0x586008(_0x414502);})['catch'](function(_0x59c82f){logger[_0xde55('0x10')](_0xde55('0x22'),_0x59c82f[_0xde55('0x13')],_0x76b11f);_0x2629ea(_0x513eb5[_0xde55('0x10')](0x1f4,_0x59c82f[_0xde55('0x13')]));});});}; \ No newline at end of file +var _0xcf98=['find','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x28dcf6,_0x4057fd){var _0x3702e9=function(_0xd71f62){while(--_0xd71f62){_0x28dcf6['push'](_0x28dcf6['shift']());}};_0x3702e9(++_0x4057fd);}(_0xcf98,0x8d));var _0x8cf9=function(_0x4c8d88,_0x2ae759){_0x4c8d88=_0x4c8d88-0x0;var _0x1e2c47=_0xcf98[_0x4c8d88];return _0x1e2c47;};'use strict';var _=require('lodash');var util=require(_0x8cf9('0x0'));var moment=require(_0x8cf9('0x1'));var BPromise=require(_0x8cf9('0x2'));var rs=require(_0x8cf9('0x3'));var fs=require('fs');var Redis=require(_0x8cf9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8cf9('0x5'))(_0x8cf9('0x6'));var config=require(_0x8cf9('0x7'));var jayson=require(_0x8cf9('0x8'));var client=jayson[_0x8cf9('0x9')][_0x8cf9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23114d,_0x29fb1e,_0x11c3b5){return new BPromise(function(_0x136309,_0x7d48dc){return client['request'](_0x23114d,_0x11c3b5)[_0x8cf9('0xb')](function(_0x982c65){logger['info'](_0x8cf9('0xc'),_0x29fb1e,'request\x20sent');logger[_0x8cf9('0xd')](_0x8cf9('0xe'),_0x29fb1e,_0x8cf9('0xf'),JSON[_0x8cf9('0x10')](_0x982c65));if(_0x982c65[_0x8cf9('0x11')]){if(_0x982c65[_0x8cf9('0x11')][_0x8cf9('0x12')]===0x1f4){logger['error'](_0x8cf9('0xc'),_0x29fb1e,_0x982c65['error']['message']);return _0x7d48dc(_0x982c65['error'][_0x8cf9('0x13')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x29fb1e,_0x982c65[_0x8cf9('0x11')][_0x8cf9('0x13')]);return _0x136309(_0x982c65[_0x8cf9('0x11')]['message']);}else{logger[_0x8cf9('0x14')](_0x8cf9('0xc'),_0x29fb1e,'request\x20sent');_0x136309(_0x982c65[_0x8cf9('0x15')][_0x8cf9('0x13')]);}})[_0x8cf9('0x16')](function(_0x46a573){logger[_0x8cf9('0x11')](_0x8cf9('0xc'),_0x29fb1e,_0x46a573);_0x7d48dc(_0x46a573);});});}exports[_0x8cf9('0x17')]=function(_0x21efd3){var _0x309866=this;return new Promise(function(_0x3a13b7,_0x873fec){return db[_0x8cf9('0x18')][_0x8cf9('0x19')]({'raw':_0x21efd3[_0x8cf9('0x1a')]?_0x21efd3[_0x8cf9('0x1a')][_0x8cf9('0x1b')]===undefined?!![]:![]:!![],'where':_0x21efd3['options']?_0x21efd3['options'][_0x8cf9('0x1c')]||null:null,'attributes':_0x21efd3['options']?_0x21efd3[_0x8cf9('0x1a')][_0x8cf9('0x1d')]||null:null,'limit':_0x21efd3[_0x8cf9('0x1a')]?_0x21efd3[_0x8cf9('0x1a')][_0x8cf9('0x1e')]||null:null,'include':_0x21efd3[_0x8cf9('0x1a')]?_0x21efd3[_0x8cf9('0x1a')][_0x8cf9('0x1f')]?_['map'](_0x21efd3[_0x8cf9('0x1a')]['include'],function(_0x5be3ae){return{'model':db[_0x5be3ae[_0x8cf9('0x20')]],'as':_0x5be3ae['as'],'attributes':_0x5be3ae[_0x8cf9('0x1d')],'include':_0x5be3ae['include']?_[_0x8cf9('0x21')](_0x5be3ae['include'],function(_0x4d07fa){return{'model':db[_0x4d07fa[_0x8cf9('0x20')]],'as':_0x4d07fa['as'],'attributes':_0x4d07fa[_0x8cf9('0x1d')],'include':_0x4d07fa['include']?_[_0x8cf9('0x21')](_0x4d07fa[_0x8cf9('0x1f')],function(_0x170414){return{'model':db[_0x170414[_0x8cf9('0x20')]],'as':_0x170414['as'],'attributes':_0x170414[_0x8cf9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53b580){logger[_0x8cf9('0x14')](_0x8cf9('0x17'),_0x21efd3);logger[_0x8cf9('0xd')](_0x8cf9('0x17'),_0x21efd3,JSON[_0x8cf9('0x10')](_0x53b580));_0x3a13b7(_0x53b580);})[_0x8cf9('0x16')](function(_0x13fa60){logger[_0x8cf9('0x11')](_0x8cf9('0x17'),_0x13fa60['message'],_0x21efd3);_0x873fec(_0x309866['error'](0x1f4,_0x13fa60[_0x8cf9('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x2716c8){var _0x2c2e6e=this;return new Promise(function(_0x2bbd81,_0x443ca1){return db['Dynamics365Account'][_0x8cf9('0x22')]({'raw':_0x2716c8[_0x8cf9('0x1a')]?_0x2716c8[_0x8cf9('0x1a')][_0x8cf9('0x1b')]===undefined?!![]:![]:!![],'where':_0x2716c8[_0x8cf9('0x1a')]?_0x2716c8[_0x8cf9('0x1a')][_0x8cf9('0x1c')]||null:null,'attributes':_0x2716c8['options']?_0x2716c8['options'][_0x8cf9('0x1d')]||null:null,'include':_0x2716c8[_0x8cf9('0x1a')]?_0x2716c8[_0x8cf9('0x1a')][_0x8cf9('0x1f')]?_[_0x8cf9('0x21')](_0x2716c8[_0x8cf9('0x1a')]['include'],function(_0x288990){return{'model':db[_0x288990[_0x8cf9('0x20')]],'as':_0x288990['as'],'attributes':_0x288990[_0x8cf9('0x1d')],'include':_0x288990[_0x8cf9('0x1f')]?_[_0x8cf9('0x21')](_0x288990[_0x8cf9('0x1f')],function(_0x1d37a3){return{'model':db[_0x1d37a3[_0x8cf9('0x20')]],'as':_0x1d37a3['as'],'attributes':_0x1d37a3['attributes'],'include':_0x1d37a3[_0x8cf9('0x1f')]?_[_0x8cf9('0x21')](_0x1d37a3[_0x8cf9('0x1f')],function(_0x4b9cb8){return{'model':db[_0x4b9cb8[_0x8cf9('0x20')]],'as':_0x4b9cb8['as'],'attributes':_0x4b9cb8['attributes']};}):[]};}):[]};}):[]:[]})[_0x8cf9('0xb')](function(_0x5a8c30){logger[_0x8cf9('0x14')]('ShowDynamics365Account',_0x2716c8);logger[_0x8cf9('0xd')]('ShowDynamics365Account',_0x2716c8,JSON[_0x8cf9('0x10')](_0x5a8c30));_0x2bbd81(_0x5a8c30);})['catch'](function(_0x4f318c){logger[_0x8cf9('0x11')]('ShowDynamics365Account',_0x4f318c[_0x8cf9('0x13')],_0x2716c8);_0x443ca1(_0x2c2e6e['error'](0x1f4,_0x4f318c[_0x8cf9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e2ff3a0..0ba18af 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 _0xd46a=['show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','util','path','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller','get','/:id','isAuthenticated'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd46a,0xbf));var _0xad46=function(_0x1a1ba8,_0x52a437){_0x1a1ba8=_0x1a1ba8-0x0;var _0x3c5118=_0xd46a[_0x1a1ba8];return _0x3c5118;};'use strict';var multer=require('multer');var util=require(_0xad46('0x0'));var path=require(_0xad46('0x1'));var timeout=require('connect-timeout');var express=require(_0xad46('0x2'));var router=express[_0xad46('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xad46('0x4'));var config=require('../../config/environment');var controller=require(_0xad46('0x5'));router[_0xad46('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xad46('0x6')](_0xad46('0x7'),auth[_0xad46('0x8')](),controller[_0xad46('0x9')]);router['get'](_0xad46('0xa'),auth['isAuthenticated'](),controller[_0xad46('0xb')]);router['get']('/:id/subjects',auth[_0xad46('0x8')](),controller['getSubjects']);router[_0xad46('0x6')](_0xad46('0xc'),auth['isAuthenticated'](),controller[_0xad46('0xd')]);router[_0xad46('0xe')]('/',auth[_0xad46('0x8')](),controller[_0xad46('0xf')]);router[_0xad46('0x10')](_0xad46('0x7'),auth[_0xad46('0x8')](),controller[_0xad46('0x11')]);router[_0xad46('0x12')](_0xad46('0x7'),auth[_0xad46('0x8')](),controller[_0xad46('0x13')]);module['exports']=router; \ No newline at end of file +var _0x907a=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x1f31d3,_0x111697){var _0x578c07=function(_0x8e02f){while(--_0x8e02f){_0x1f31d3['push'](_0x1f31d3['shift']());}};_0x578c07(++_0x111697);}(_0x907a,0x192));var _0xa907=function(_0x386d6b,_0x37e050){_0x386d6b=_0x386d6b-0x0;var _0x17190d=_0x907a[_0x386d6b];return _0x17190d;};'use strict';var multer=require(_0xa907('0x0'));var util=require(_0xa907('0x1'));var path=require('path');var timeout=require(_0xa907('0x2'));var express=require(_0xa907('0x3'));var router=express['Router']();var auth=require(_0xa907('0x4'));var interaction=require(_0xa907('0x5'));var config=require(_0xa907('0x6'));var controller=require(_0xa907('0x7'));router[_0xa907('0x8')]('/',auth[_0xa907('0x9')](),controller[_0xa907('0xa')]);router[_0xa907('0x8')]('/:id',auth[_0xa907('0x9')](),controller[_0xa907('0xb')]);router[_0xa907('0x8')](_0xa907('0xc'),auth[_0xa907('0x9')](),controller[_0xa907('0xd')]);router[_0xa907('0x8')](_0xa907('0xe'),auth['isAuthenticated'](),controller[_0xa907('0xf')]);router[_0xa907('0x8')](_0xa907('0x10'),auth['isAuthenticated'](),controller[_0xa907('0x11')]);router[_0xa907('0x12')]('/',auth[_0xa907('0x9')](),controller[_0xa907('0x13')]);router[_0xa907('0x14')](_0xa907('0x15'),auth[_0xa907('0x9')](),controller[_0xa907('0x16')]);router[_0xa907('0x17')](_0xa907('0x15'),auth['isAuthenticated'](),controller[_0xa907('0x18')]);module[_0xa907('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 3c9955e..7cb5215 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 _0x87e4=['sequelize','exports','STRING','ENUM','phonecall','incident'];(function(_0x544fad,_0x47d1c4){var _0x160a0a=function(_0x11dc45){while(--_0x11dc45){_0x544fad['push'](_0x544fad['shift']());}};_0x160a0a(++_0x47d1c4);}(_0x87e4,0x1d4));var _0x487e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x87e4[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x487e('0x0'));module[_0x487e('0x1')]={'name':{'type':Sequelize[_0x487e('0x2')]},'description':{'type':Sequelize[_0x487e('0x2')]},'ticketType':{'type':Sequelize[_0x487e('0x3')]('incident',_0x487e('0x4')),'defaultValue':_0x487e('0x5')}}; \ No newline at end of file +var _0xe392=['incident','phonecall','sequelize','exports','STRING'];(function(_0xfa3460,_0x3061d4){var _0x428991=function(_0x2b8759){while(--_0x2b8759){_0xfa3460['push'](_0xfa3460['shift']());}};_0x428991(++_0x3061d4);}(_0xe392,0x18d));var _0x2e39=function(_0x4c879c,_0x49276d){_0x4c879c=_0x4c879c-0x0;var _0x172ac7=_0xe392[_0x4c879c];return _0x172ac7;};'use strict';var Sequelize=require(_0x2e39('0x0'));module[_0x2e39('0x1')]={'name':{'type':Sequelize[_0x2e39('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x2e39('0x3'),_0x2e39('0x4')),'defaultValue':_0x2e39('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 98cfd24..e79e0a7 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 _0x7ee5=['message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','findAll','rows','show','params','include','find','body','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','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','jayson/promise','http','test','Sequelize','ValidationError','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x48cb70,_0x721318){var _0x85b5e8=function(_0x13f33a){while(--_0x13f33a){_0x48cb70['push'](_0x48cb70['shift']());}};_0x85b5e8(++_0x721318);}(_0x7ee5,0x1bd));var _0x57ee=function(_0x4d77b8,_0x208e64){_0x4d77b8=_0x4d77b8-0x0;var _0x82da62=_0x7ee5[_0x4d77b8];return _0x82da62;};'use strict';var pdf=require(_0x57ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x57ee('0x1'));var zipdir=require(_0x57ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57ee('0x3'));var moment=require(_0x57ee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57ee('0x5'));var util=require(_0x57ee('0x6'));var path=require(_0x57ee('0x7'));var sox=require(_0x57ee('0x8'));var csv=require('to-csv');var ejs=require(_0x57ee('0x9'));var fs=require('fs');var _=require(_0x57ee('0xa'));var squel=require(_0x57ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x57ee('0xc'));var deskjs=require(_0x57ee('0xd'));var toCsv=require(_0x57ee('0xe'));var querystring=require(_0x57ee('0xf'));var Papa=require(_0x57ee('0x10'));var Redis=require(_0x57ee('0x11'));var authService=require(_0x57ee('0x12'));var qs=require(_0x57ee('0x13'));var as=require(_0x57ee('0x14'));var hardwareService=require(_0x57ee('0x15'));var logger=require(_0x57ee('0x16'))(_0x57ee('0x17'));var utils=require(_0x57ee('0x18'));var config=require(_0x57ee('0x19'));var db=require(_0x57ee('0x1a'))['db'];var jayson=require(_0x57ee('0x1b'));var client=jayson['client'][_0x57ee('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x52a8ec,_0x105ab1,_0x9d1f2f){if(_0x9d1f2f){var _0x1ece3a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ece3a[_0x57ee('0x1d')](_0x105ab1)){return _0x52a8ec;}else{throw new db[(_0x57ee('0x1e'))][(_0x57ee('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 _0x52a8ec;}}function respondWithRpcPromise(_0x3cb9f3,_0x6d6bcf,_0x57e558,_0x48b858){return new BPromise(function(_0x44f71a,_0x3d1e5b){var _0x1e6f3c=_0x48b858||client;return _0x1e6f3c[_0x57ee('0x20')](_0x3cb9f3,_0x57e558)['then'](function(_0x32e0c8){logger[_0x57ee('0x21')](_0x57ee('0x22'),_0x6d6bcf,_0x57ee('0x23'));logger['debug'](_0x57ee('0x24'),_0x6d6bcf,_0x57ee('0x23'),JSON[_0x57ee('0x25')](_0x32e0c8));if(_0x32e0c8[_0x57ee('0x26')]){if(_0x32e0c8[_0x57ee('0x26')][_0x57ee('0x27')]===0x1f4){logger[_0x57ee('0x26')](_0x57ee('0x22'),_0x6d6bcf,_0x32e0c8[_0x57ee('0x26')][_0x57ee('0x28')]);return _0x3d1e5b(_0x32e0c8[_0x57ee('0x26')][_0x57ee('0x28')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x6d6bcf,_0x32e0c8[_0x57ee('0x26')][_0x57ee('0x28')]);return _0x44f71a(_0x32e0c8[_0x57ee('0x26')][_0x57ee('0x28')]);}else{logger[_0x57ee('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x6d6bcf,'request\x20sent');_0x44f71a(_0x32e0c8[_0x57ee('0x29')]['message']);}})[_0x57ee('0x2a')](function(_0x19b401){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x6d6bcf,_0x19b401);_0x3d1e5b(_0x19b401);});});}function respondWithStatusCode(_0x1c0b27,_0x37e984){_0x37e984=_0x37e984||0xcc;return function(_0x12b626){if(_0x12b626){return _0x1c0b27[_0x57ee('0x2b')](_0x37e984);}return _0x1c0b27[_0x57ee('0x2c')](_0x37e984)[_0x57ee('0x2d')]();};}function respondWithResult(_0x3822bf,_0x3dc93f){_0x3dc93f=_0x3dc93f||0xc8;return function(_0x22251a){if(_0x22251a){return _0x3822bf[_0x57ee('0x2c')](_0x3dc93f)[_0x57ee('0x2e')](_0x22251a);}};}function respondWithFilteredResult(_0x28419b,_0x58aa78){return function(_0x109630){if(_0x109630){var _0x5a9d8f=_0x109630[_0x57ee('0x2f')],_0x33fd13=_0x58aa78[_0x57ee('0x30')],_0x2a3bf8=_0x58aa78[_0x57ee('0x30')]+_0x58aa78[_0x57ee('0x31')],_0x1ac0af;if(_0x2a3bf8>=_0x5a9d8f){_0x2a3bf8=_0x5a9d8f;_0x1ac0af=0xc8;}else{_0x1ac0af=0xce;}_0x28419b[_0x57ee('0x2c')](_0x1ac0af);return _0x28419b[_0x57ee('0x32')](_0x57ee('0x33'),_0x33fd13+'-'+_0x2a3bf8+'/'+_0x5a9d8f)[_0x57ee('0x2e')](_0x109630);}return null;};}function patchUpdates(_0x4152e6){return function(_0xbcb9d){try{jsonpatch[_0x57ee('0x34')](_0xbcb9d,_0x4152e6,!![]);}catch(_0x54975e){return BPromise[_0x57ee('0x35')](_0x54975e);}return _0xbcb9d[_0x57ee('0x36')]();};}function saveUpdates(_0x506bf1,_0x29e153){return function(_0x91d50e){if(_0x91d50e){return _0x91d50e[_0x57ee('0x37')](_0x506bf1)[_0x57ee('0x38')](function(_0x4da51c){return _0x4da51c;});}return null;};}function removeEntity(_0x19c54f,_0x42554c){return function(_0x5b3738){if(_0x5b3738){return _0x5b3738[_0x57ee('0x39')]()[_0x57ee('0x38')](function(){_0x19c54f[_0x57ee('0x2c')](0xcc)[_0x57ee('0x2d')]();});}};}function handleEntityNotFound(_0x46fa2d,_0x2e487a){return function(_0x46ed15){if(!_0x46ed15){_0x46fa2d['sendStatus'](0x194);}return _0x46ed15;};}function handleError(_0x1c29d1,_0x6b95b2){_0x6b95b2=_0x6b95b2||0x1f4;return function(_0x4bdf2d){logger['error'](_0x4bdf2d[_0x57ee('0x3a')]);if(_0x4bdf2d[_0x57ee('0x3b')]){delete _0x4bdf2d[_0x57ee('0x3b')];}_0x1c29d1[_0x57ee('0x2c')](_0x6b95b2)['send'](_0x4bdf2d);};}exports[_0x57ee('0x3c')]=function(_0xe8619a,_0x1ee9c){var _0x50d0b2={},_0x4f0ed0={},_0xaab20={'count':0x0,'rows':[]};var _0xeb6aa1=_['map'](db['Dynamics365Configuration'][_0x57ee('0x3d')],function(_0x4d428d){return{'name':_0x4d428d['fieldName'],'type':_0x4d428d[_0x57ee('0x3e')][_0x57ee('0x3f')]};});_0x4f0ed0['model']=_[_0x57ee('0x40')](_0xeb6aa1,_0x57ee('0x3b'));_0x4f0ed0[_0x57ee('0x41')]=_[_0x57ee('0x42')](_0xe8619a[_0x57ee('0x41')]);_0x4f0ed0['filters']=_[_0x57ee('0x43')](_0x4f0ed0['model'],_0x4f0ed0[_0x57ee('0x41')]);_0x50d0b2[_0x57ee('0x44')]=_[_0x57ee('0x43')](_0x4f0ed0['model'],qs[_0x57ee('0x45')](_0xe8619a['query']['fields']));_0x50d0b2[_0x57ee('0x44')]=_0x50d0b2[_0x57ee('0x44')][_0x57ee('0x46')]?_0x50d0b2[_0x57ee('0x44')]:_0x4f0ed0[_0x57ee('0x47')];if(!_0xe8619a[_0x57ee('0x41')][_0x57ee('0x48')](_0x57ee('0x49'))){_0x50d0b2[_0x57ee('0x31')]=qs['limit'](_0xe8619a[_0x57ee('0x41')][_0x57ee('0x31')]);_0x50d0b2['offset']=qs[_0x57ee('0x30')](_0xe8619a['query'][_0x57ee('0x30')]);}_0x50d0b2[_0x57ee('0x4a')]=qs[_0x57ee('0x4b')](_0xe8619a[_0x57ee('0x41')][_0x57ee('0x4b')]);_0x50d0b2[_0x57ee('0x4c')]=qs[_0x57ee('0x4d')](_[_0x57ee('0x4e')](_0xe8619a[_0x57ee('0x41')],_0x4f0ed0[_0x57ee('0x4d')]),_0xeb6aa1);if(_0xe8619a[_0x57ee('0x41')][_0x57ee('0x4f')]){_0x50d0b2[_0x57ee('0x4c')]=_[_0x57ee('0x50')](_0x50d0b2[_0x57ee('0x4c')],{'$or':_[_0x57ee('0x40')](_0xeb6aa1,function(_0x48de76){if(_0x48de76[_0x57ee('0x3e')]!==_0x57ee('0x51')){var _0x2211ad={};_0x2211ad[_0x48de76[_0x57ee('0x3b')]]={'$like':'%'+_0xe8619a[_0x57ee('0x41')]['filter']+'%'};return _0x2211ad;}})});}_0x50d0b2=_[_0x57ee('0x50')]({},_0x50d0b2,_0xe8619a[_0x57ee('0x52')]);var _0x42f8fe={'where':_0x50d0b2['where']};return db[_0x57ee('0x53')][_0x57ee('0x2f')](_0x42f8fe)[_0x57ee('0x38')](function(_0x24f02f){_0xaab20[_0x57ee('0x2f')]=_0x24f02f;if(_0xe8619a[_0x57ee('0x41')][_0x57ee('0x54')]){_0x50d0b2['include']=[{'all':!![]}];}return db[_0x57ee('0x53')][_0x57ee('0x55')](_0x50d0b2);})[_0x57ee('0x38')](function(_0x5c319e){_0xaab20[_0x57ee('0x56')]=_0x5c319e;return _0xaab20;})['then'](respondWithFilteredResult(_0x1ee9c,_0x50d0b2))[_0x57ee('0x2a')](handleError(_0x1ee9c,null));};exports[_0x57ee('0x57')]=function(_0xc83e0d,_0x55ff02){var _0x4f85e9={'raw':![],'where':{'id':_0xc83e0d[_0x57ee('0x58')]['id']}},_0x17dc73={};_0x17dc73[_0x57ee('0x47')]=_['keys'](db[_0x57ee('0x53')][_0x57ee('0x3d')]);_0x17dc73[_0x57ee('0x41')]=_[_0x57ee('0x42')](_0xc83e0d['query']);_0x17dc73[_0x57ee('0x4d')]=_['intersection'](_0x17dc73[_0x57ee('0x47')],_0x17dc73[_0x57ee('0x41')]);_0x4f85e9[_0x57ee('0x44')]=_[_0x57ee('0x43')](_0x17dc73[_0x57ee('0x47')],qs['fields'](_0xc83e0d[_0x57ee('0x41')][_0x57ee('0x45')]));_0x4f85e9['attributes']=_0x4f85e9[_0x57ee('0x44')][_0x57ee('0x46')]?_0x4f85e9[_0x57ee('0x44')]:_0x17dc73[_0x57ee('0x47')];if(_0xc83e0d[_0x57ee('0x41')][_0x57ee('0x54')]){_0x4f85e9[_0x57ee('0x59')]=[{'all':!![]}];}_0x4f85e9=_[_0x57ee('0x50')]({},_0x4f85e9,_0xc83e0d[_0x57ee('0x52')]);return db['Dynamics365Configuration'][_0x57ee('0x5a')](_0x4f85e9)[_0x57ee('0x38')](handleEntityNotFound(_0x55ff02,null))['then'](respondWithResult(_0x55ff02,null))['catch'](handleError(_0x55ff02,null));};exports['create']=function(_0x4422a0,_0x48e1be){return db[_0x57ee('0x53')]['create'](_0x4422a0[_0x57ee('0x5b')],{})['then'](respondWithResult(_0x48e1be,0xc9))[_0x57ee('0x2a')](handleError(_0x48e1be,null));};exports[_0x57ee('0x37')]=function(_0xa30253,_0x17b1a1){if(_0xa30253[_0x57ee('0x5b')]['id']){delete _0xa30253[_0x57ee('0x5b')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0xa30253[_0x57ee('0x58')]['id']}})[_0x57ee('0x38')](handleEntityNotFound(_0x17b1a1,null))[_0x57ee('0x38')](saveUpdates(_0xa30253[_0x57ee('0x5b')],null))[_0x57ee('0x38')](respondWithResult(_0x17b1a1,null))[_0x57ee('0x2a')](handleError(_0x17b1a1,null));};exports['destroy']=function(_0x2fab47,_0x16f31e){return db[_0x57ee('0x53')]['find']({'where':{'id':_0x2fab47[_0x57ee('0x58')]['id']}})['then'](handleEntityNotFound(_0x16f31e,null))[_0x57ee('0x38')](removeEntity(_0x16f31e,null))['catch'](handleError(_0x16f31e,null));};exports[_0x57ee('0x5c')]=function(_0x1bb220,_0x197a08,_0x51d2f5){var _0x1b7b45={};var _0x3eb1f7={};var _0x13339e;var _0x2d204c;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x1bb220[_0x57ee('0x58')]['id']}})[_0x57ee('0x38')](handleEntityNotFound(_0x197a08,null))['then'](function(_0x5c1c5c){if(_0x5c1c5c){_0x13339e=_0x5c1c5c;_0x3eb1f7[_0x57ee('0x47')]=_[_0x57ee('0x42')](db[_0x57ee('0x5d')]['rawAttributes']);_0x3eb1f7[_0x57ee('0x41')]=_[_0x57ee('0x42')](_0x1bb220[_0x57ee('0x41')]);_0x3eb1f7['filters']=_[_0x57ee('0x43')](_0x3eb1f7[_0x57ee('0x47')],_0x3eb1f7['query']);_0x1b7b45[_0x57ee('0x44')]=_[_0x57ee('0x43')](_0x3eb1f7['model'],qs[_0x57ee('0x45')](_0x1bb220[_0x57ee('0x41')]['fields']));_0x1b7b45[_0x57ee('0x44')]=_0x1b7b45['attributes'][_0x57ee('0x46')]?_0x1b7b45[_0x57ee('0x44')]:_0x3eb1f7[_0x57ee('0x47')];_0x1b7b45[_0x57ee('0x4a')]=qs[_0x57ee('0x4b')](_0x1bb220[_0x57ee('0x41')][_0x57ee('0x4b')]);_0x1b7b45[_0x57ee('0x4c')]=qs['filters'](_['pick'](_0x1bb220[_0x57ee('0x41')],_0x3eb1f7[_0x57ee('0x4d')]));if(_0x1bb220[_0x57ee('0x41')][_0x57ee('0x4f')]){_0x1b7b45[_0x57ee('0x4c')]=_[_0x57ee('0x50')](_0x1b7b45[_0x57ee('0x4c')],{'$or':_[_0x57ee('0x40')](_0x1b7b45[_0x57ee('0x44')],function(_0x42d32e){var _0xa9619e={};_0xa9619e[_0x42d32e]={'$like':'%'+_0x1bb220['query'][_0x57ee('0x4f')]+'%'};return _0xa9619e;})});}_0x1b7b45=_[_0x57ee('0x50')]({},_0x1b7b45,_0x1bb220[_0x57ee('0x52')]);return _0x13339e[_0x57ee('0x5c')](_0x1b7b45);}})[_0x57ee('0x38')](function(_0x1b6b7f){if(_0x1b6b7f){_0x2d204c=_0x1b6b7f[_0x57ee('0x46')];if(!_0x1bb220['query'][_0x57ee('0x48')](_0x57ee('0x49'))){_0x1b7b45[_0x57ee('0x31')]=qs[_0x57ee('0x31')](_0x1bb220[_0x57ee('0x41')][_0x57ee('0x31')]);_0x1b7b45[_0x57ee('0x30')]=qs[_0x57ee('0x30')](_0x1bb220['query'][_0x57ee('0x30')]);}return _0x13339e[_0x57ee('0x5c')](_0x1b7b45);}})[_0x57ee('0x38')](function(_0x110b9e){if(_0x110b9e){return _0x110b9e?{'count':_0x2d204c,'rows':_0x110b9e}:null;}})['then'](respondWithResult(_0x197a08,null))[_0x57ee('0x2a')](handleError(_0x197a08,null));};exports[_0x57ee('0x5e')]=function(_0x2062c8,_0x4b088f,_0xf80fbc){var _0x33f397={};var _0x3f8ed6={};var _0x134920;var _0x4bf654;return db[_0x57ee('0x53')][_0x57ee('0x5f')]({'where':{'id':_0x2062c8[_0x57ee('0x58')]['id']}})[_0x57ee('0x38')](handleEntityNotFound(_0x4b088f,null))[_0x57ee('0x38')](function(_0x30dd05){if(_0x30dd05){_0x134920=_0x30dd05;_0x3f8ed6[_0x57ee('0x47')]=_['keys'](db[_0x57ee('0x5d')][_0x57ee('0x3d')]);_0x3f8ed6['query']=_['keys'](_0x2062c8[_0x57ee('0x41')]);_0x3f8ed6[_0x57ee('0x4d')]=_[_0x57ee('0x43')](_0x3f8ed6[_0x57ee('0x47')],_0x3f8ed6[_0x57ee('0x41')]);_0x33f397['attributes']=_[_0x57ee('0x43')](_0x3f8ed6['model'],qs[_0x57ee('0x45')](_0x2062c8[_0x57ee('0x41')][_0x57ee('0x45')]));_0x33f397[_0x57ee('0x44')]=_0x33f397[_0x57ee('0x44')][_0x57ee('0x46')]?_0x33f397[_0x57ee('0x44')]:_0x3f8ed6[_0x57ee('0x47')];_0x33f397[_0x57ee('0x4a')]=qs[_0x57ee('0x4b')](_0x2062c8['query'][_0x57ee('0x4b')]);_0x33f397['where']=qs[_0x57ee('0x4d')](_['pick'](_0x2062c8['query'],_0x3f8ed6['filters']));if(_0x2062c8[_0x57ee('0x41')][_0x57ee('0x4f')]){_0x33f397[_0x57ee('0x4c')]=_[_0x57ee('0x50')](_0x33f397['where'],{'$or':_[_0x57ee('0x40')](_0x33f397[_0x57ee('0x44')],function(_0x28e3af){var _0x45e068={};_0x45e068[_0x28e3af]={'$like':'%'+_0x2062c8[_0x57ee('0x41')][_0x57ee('0x4f')]+'%'};return _0x45e068;})});}_0x33f397=_['merge']({},_0x33f397,_0x2062c8[_0x57ee('0x52')]);return _0x134920['getSubjects'](_0x33f397);}})[_0x57ee('0x38')](function(_0x370130){if(_0x370130){_0x4bf654=_0x370130[_0x57ee('0x46')];if(!_0x2062c8[_0x57ee('0x41')][_0x57ee('0x48')](_0x57ee('0x49'))){_0x33f397[_0x57ee('0x31')]=qs[_0x57ee('0x31')](_0x2062c8['query']['limit']);_0x33f397[_0x57ee('0x30')]=qs[_0x57ee('0x30')](_0x2062c8['query'][_0x57ee('0x30')]);}return _0x134920['getSubjects'](_0x33f397);}})[_0x57ee('0x38')](function(_0x50d376){if(_0x50d376){return _0x50d376?{'count':_0x4bf654,'rows':_0x50d376}:null;}})[_0x57ee('0x38')](respondWithResult(_0x4b088f,null))['catch'](handleError(_0x4b088f,null));};exports[_0x57ee('0x60')]=function(_0x15c011,_0x16a2ff,_0x58e630){var _0x77160e={};var _0x2b2a8e={};var _0x425cd7;var _0x260963;return db[_0x57ee('0x53')]['findOne']({'where':{'id':_0x15c011[_0x57ee('0x58')]['id']}})[_0x57ee('0x38')](handleEntityNotFound(_0x16a2ff,null))['then'](function(_0x1aa6a6){if(_0x1aa6a6){_0x425cd7=_0x1aa6a6;_0x2b2a8e[_0x57ee('0x47')]=_[_0x57ee('0x42')](db[_0x57ee('0x5d')][_0x57ee('0x3d')]);_0x2b2a8e[_0x57ee('0x41')]=_[_0x57ee('0x42')](_0x15c011['query']);_0x2b2a8e[_0x57ee('0x4d')]=_[_0x57ee('0x43')](_0x2b2a8e['model'],_0x2b2a8e['query']);_0x77160e[_0x57ee('0x44')]=_[_0x57ee('0x43')](_0x2b2a8e[_0x57ee('0x47')],qs['fields'](_0x15c011[_0x57ee('0x41')][_0x57ee('0x45')]));_0x77160e['attributes']=_0x77160e[_0x57ee('0x44')][_0x57ee('0x46')]?_0x77160e['attributes']:_0x2b2a8e[_0x57ee('0x47')];_0x77160e[_0x57ee('0x4a')]=qs[_0x57ee('0x4b')](_0x15c011[_0x57ee('0x41')][_0x57ee('0x4b')]);_0x77160e[_0x57ee('0x4c')]=qs[_0x57ee('0x4d')](_['pick'](_0x15c011[_0x57ee('0x41')],_0x2b2a8e[_0x57ee('0x4d')]));if(_0x15c011['query'][_0x57ee('0x4f')]){_0x77160e['where']=_[_0x57ee('0x50')](_0x77160e['where'],{'$or':_[_0x57ee('0x40')](_0x77160e['attributes'],function(_0x3bb8cc){var _0x45197c={};_0x45197c[_0x3bb8cc]={'$like':'%'+_0x15c011[_0x57ee('0x41')][_0x57ee('0x4f')]+'%'};return _0x45197c;})});}_0x77160e=_[_0x57ee('0x50')]({},_0x77160e,_0x15c011[_0x57ee('0x52')]);return _0x425cd7['getDescriptions'](_0x77160e);}})[_0x57ee('0x38')](function(_0x1bca77){if(_0x1bca77){_0x260963=_0x1bca77['length'];if(!_0x15c011[_0x57ee('0x41')][_0x57ee('0x48')]('nolimit')){_0x77160e['limit']=qs[_0x57ee('0x31')](_0x15c011[_0x57ee('0x41')][_0x57ee('0x31')]);_0x77160e['offset']=qs['offset'](_0x15c011[_0x57ee('0x41')]['offset']);}return _0x425cd7[_0x57ee('0x60')](_0x77160e);}})[_0x57ee('0x38')](function(_0x1b82cd){if(_0x1b82cd){return _0x1b82cd?{'count':_0x260963,'rows':_0x1b82cd}:null;}})[_0x57ee('0x38')](respondWithResult(_0x16a2ff,null))[_0x57ee('0x2a')](handleError(_0x16a2ff,null));}; \ No newline at end of file +var _0x50d6=['request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','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','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Dynamics365Configuration','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','rawAttributes','filter','hasOwnProperty','Dynamics365Field','getSubjects','getDescriptions','html-pdf','zip-dir','fast-json-patch'];(function(_0x1cbf5e,_0x66bf96){var _0xa4c95b=function(_0x1a498b){while(--_0x1a498b){_0x1cbf5e['push'](_0x1cbf5e['shift']());}};_0xa4c95b(++_0x66bf96);}(_0x50d6,0xb7));var _0x650d=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x50d6[_0x28b0a1];return _0x21470c;};'use strict';var pdf=require(_0x650d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x650d('0x1'));var jsonpatch=require(_0x650d('0x2'));var rp=require(_0x650d('0x3'));var moment=require('moment');var BPromise=require(_0x650d('0x4'));var Mustache=require(_0x650d('0x5'));var util=require(_0x650d('0x6'));var path=require(_0x650d('0x7'));var sox=require(_0x650d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x650d('0x9'));var squel=require(_0x650d('0xa'));var crypto=require('crypto');var jsforce=require(_0x650d('0xb'));var deskjs=require(_0x650d('0xc'));var toCsv=require(_0x650d('0xd'));var querystring=require(_0x650d('0xe'));var Papa=require('papaparse');var Redis=require(_0x650d('0xf'));var authService=require(_0x650d('0x10'));var qs=require(_0x650d('0x11'));var as=require(_0x650d('0x12'));var hardwareService=require(_0x650d('0x13'));var logger=require(_0x650d('0x14'))(_0x650d('0x15'));var utils=require(_0x650d('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x650d('0x17'));var client=jayson['client'][_0x650d('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4eda2d,_0x244c5c,_0x2545d3){if(_0x2545d3){var _0xa80052=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa80052[_0x650d('0x19')](_0x244c5c)){return _0x4eda2d;}else{throw new db[(_0x650d('0x1a'))][(_0x650d('0x1b'))](_0x650d('0x1c'));}}else{return _0x4eda2d;}}function respondWithRpcPromise(_0x263ac9,_0x34f753,_0x307523,_0x14abee){return new BPromise(function(_0xbffa8d,_0x5e2f7c){var _0x26f693=_0x14abee||client;return _0x26f693[_0x650d('0x1d')](_0x263ac9,_0x307523)[_0x650d('0x1e')](function(_0x476e6b){logger[_0x650d('0x1f')](_0x650d('0x20'),_0x34f753,_0x650d('0x21'));logger['debug'](_0x650d('0x22'),_0x34f753,_0x650d('0x21'),JSON[_0x650d('0x23')](_0x476e6b));if(_0x476e6b[_0x650d('0x24')]){if(_0x476e6b[_0x650d('0x24')]['code']===0x1f4){logger[_0x650d('0x24')](_0x650d('0x20'),_0x34f753,_0x476e6b[_0x650d('0x24')][_0x650d('0x25')]);return _0x5e2f7c(_0x476e6b[_0x650d('0x24')][_0x650d('0x25')]);}logger[_0x650d('0x24')](_0x650d('0x20'),_0x34f753,_0x476e6b[_0x650d('0x24')][_0x650d('0x25')]);return _0xbffa8d(_0x476e6b[_0x650d('0x24')][_0x650d('0x25')]);}else{logger[_0x650d('0x1f')](_0x650d('0x20'),_0x34f753,_0x650d('0x21'));_0xbffa8d(_0x476e6b[_0x650d('0x26')][_0x650d('0x25')]);}})['catch'](function(_0x2b55ae){logger['error'](_0x650d('0x20'),_0x34f753,_0x2b55ae);_0x5e2f7c(_0x2b55ae);});});}function respondWithStatusCode(_0x79836f,_0x297eb4){_0x297eb4=_0x297eb4||0xcc;return function(_0x2e0a8a){if(_0x2e0a8a){return _0x79836f[_0x650d('0x27')](_0x297eb4);}return _0x79836f[_0x650d('0x28')](_0x297eb4)[_0x650d('0x29')]();};}function respondWithResult(_0x58454e,_0x554cfc){_0x554cfc=_0x554cfc||0xc8;return function(_0x32b059){if(_0x32b059){return _0x58454e['status'](_0x554cfc)[_0x650d('0x2a')](_0x32b059);}};}function respondWithFilteredResult(_0x2e3be4,_0x4eec65){return function(_0x1e746e){if(_0x1e746e){var _0x50a0fa=_0x1e746e[_0x650d('0x2b')],_0x569293=_0x4eec65[_0x650d('0x2c')],_0x436187=_0x4eec65[_0x650d('0x2c')]+_0x4eec65[_0x650d('0x2d')],_0x340614;if(_0x436187>=_0x50a0fa){_0x436187=_0x50a0fa;_0x340614=0xc8;}else{_0x340614=0xce;}_0x2e3be4[_0x650d('0x28')](_0x340614);return _0x2e3be4['set'](_0x650d('0x2e'),_0x569293+'-'+_0x436187+'/'+_0x50a0fa)[_0x650d('0x2a')](_0x1e746e);}return null;};}function patchUpdates(_0x1c4ca8){return function(_0x5bef12){try{jsonpatch[_0x650d('0x2f')](_0x5bef12,_0x1c4ca8,!![]);}catch(_0x314048){return BPromise[_0x650d('0x30')](_0x314048);}return _0x5bef12[_0x650d('0x31')]();};}function saveUpdates(_0x14e978,_0x5f0bd6){return function(_0x1ddaac){if(_0x1ddaac){return _0x1ddaac[_0x650d('0x32')](_0x14e978)[_0x650d('0x1e')](function(_0x3f9bf5){return _0x3f9bf5;});}return null;};}function removeEntity(_0x57e39d,_0x11067e){return function(_0x530d77){if(_0x530d77){return _0x530d77[_0x650d('0x33')]()['then'](function(){_0x57e39d[_0x650d('0x28')](0xcc)[_0x650d('0x29')]();});}};}function handleEntityNotFound(_0x4c5498,_0x10fc1e){return function(_0x32a2b7){if(!_0x32a2b7){_0x4c5498[_0x650d('0x27')](0x194);}return _0x32a2b7;};}function handleError(_0x3a7aa4,_0x66289a){_0x66289a=_0x66289a||0x1f4;return function(_0x5d86b4){logger['error'](_0x5d86b4[_0x650d('0x34')]);if(_0x5d86b4[_0x650d('0x35')]){delete _0x5d86b4['name'];}_0x3a7aa4['status'](_0x66289a)['send'](_0x5d86b4);};}exports[_0x650d('0x36')]=function(_0x577237,_0x42101c){var _0x34a833={},_0x5d81ac={},_0x5dfa5c={'count':0x0,'rows':[]};var _0x2966a5=_[_0x650d('0x37')](db[_0x650d('0x38')]['rawAttributes'],function(_0x2471cc){return{'name':_0x2471cc['fieldName'],'type':_0x2471cc[_0x650d('0x39')][_0x650d('0x3a')]};});_0x5d81ac[_0x650d('0x3b')]=_[_0x650d('0x37')](_0x2966a5,'name');_0x5d81ac[_0x650d('0x3c')]=_[_0x650d('0x3d')](_0x577237['query']);_0x5d81ac[_0x650d('0x3e')]=_['intersection'](_0x5d81ac['model'],_0x5d81ac[_0x650d('0x3c')]);_0x34a833[_0x650d('0x3f')]=_[_0x650d('0x40')](_0x5d81ac['model'],qs['fields'](_0x577237[_0x650d('0x3c')][_0x650d('0x41')]));_0x34a833[_0x650d('0x3f')]=_0x34a833['attributes']['length']?_0x34a833[_0x650d('0x3f')]:_0x5d81ac[_0x650d('0x3b')];if(!_0x577237[_0x650d('0x3c')]['hasOwnProperty'](_0x650d('0x42'))){_0x34a833[_0x650d('0x2d')]=qs['limit'](_0x577237[_0x650d('0x3c')][_0x650d('0x2d')]);_0x34a833[_0x650d('0x2c')]=qs[_0x650d('0x2c')](_0x577237[_0x650d('0x3c')][_0x650d('0x2c')]);}_0x34a833[_0x650d('0x43')]=qs[_0x650d('0x44')](_0x577237['query']['sort']);_0x34a833['where']=qs[_0x650d('0x3e')](_[_0x650d('0x45')](_0x577237[_0x650d('0x3c')],_0x5d81ac['filters']),_0x2966a5);if(_0x577237[_0x650d('0x3c')]['filter']){_0x34a833[_0x650d('0x46')]=_['merge'](_0x34a833['where'],{'$or':_['map'](_0x2966a5,function(_0x524260){if(_0x524260[_0x650d('0x39')]!==_0x650d('0x47')){var _0x5de4db={};_0x5de4db[_0x524260[_0x650d('0x35')]]={'$like':'%'+_0x577237[_0x650d('0x3c')]['filter']+'%'};return _0x5de4db;}})});}_0x34a833=_[_0x650d('0x48')]({},_0x34a833,_0x577237[_0x650d('0x49')]);var _0x4b758c={'where':_0x34a833[_0x650d('0x46')]};return db[_0x650d('0x38')]['count'](_0x4b758c)[_0x650d('0x1e')](function(_0x34d85e){_0x5dfa5c[_0x650d('0x2b')]=_0x34d85e;if(_0x577237[_0x650d('0x3c')][_0x650d('0x4a')]){_0x34a833[_0x650d('0x4b')]=[{'all':!![]}];}return db[_0x650d('0x38')][_0x650d('0x4c')](_0x34a833);})[_0x650d('0x1e')](function(_0x4af620){_0x5dfa5c[_0x650d('0x4d')]=_0x4af620;return _0x5dfa5c;})[_0x650d('0x1e')](respondWithFilteredResult(_0x42101c,_0x34a833))[_0x650d('0x4e')](handleError(_0x42101c,null));};exports[_0x650d('0x4f')]=function(_0x51f600,_0x277747){var _0x3fdeec={'raw':![],'where':{'id':_0x51f600[_0x650d('0x50')]['id']}},_0x361250={};_0x361250[_0x650d('0x3b')]=_['keys'](db[_0x650d('0x38')]['rawAttributes']);_0x361250['query']=_[_0x650d('0x3d')](_0x51f600[_0x650d('0x3c')]);_0x361250[_0x650d('0x3e')]=_[_0x650d('0x40')](_0x361250[_0x650d('0x3b')],_0x361250[_0x650d('0x3c')]);_0x3fdeec['attributes']=_[_0x650d('0x40')](_0x361250[_0x650d('0x3b')],qs['fields'](_0x51f600[_0x650d('0x3c')][_0x650d('0x41')]));_0x3fdeec[_0x650d('0x3f')]=_0x3fdeec[_0x650d('0x3f')][_0x650d('0x51')]?_0x3fdeec[_0x650d('0x3f')]:_0x361250[_0x650d('0x3b')];if(_0x51f600['query'][_0x650d('0x4a')]){_0x3fdeec[_0x650d('0x4b')]=[{'all':!![]}];}_0x3fdeec=_[_0x650d('0x48')]({},_0x3fdeec,_0x51f600['options']);return db[_0x650d('0x38')][_0x650d('0x52')](_0x3fdeec)[_0x650d('0x1e')](handleEntityNotFound(_0x277747,null))[_0x650d('0x1e')](respondWithResult(_0x277747,null))[_0x650d('0x4e')](handleError(_0x277747,null));};exports[_0x650d('0x53')]=function(_0x322de7,_0x74ae28){return db[_0x650d('0x38')]['create'](_0x322de7[_0x650d('0x54')],{})['then'](respondWithResult(_0x74ae28,0xc9))[_0x650d('0x4e')](handleError(_0x74ae28,null));};exports['update']=function(_0x5be53b,_0x42484b){if(_0x5be53b[_0x650d('0x54')]['id']){delete _0x5be53b['body']['id'];}return db[_0x650d('0x38')][_0x650d('0x52')]({'where':{'id':_0x5be53b[_0x650d('0x50')]['id']}})[_0x650d('0x1e')](handleEntityNotFound(_0x42484b,null))[_0x650d('0x1e')](saveUpdates(_0x5be53b[_0x650d('0x54')],null))[_0x650d('0x1e')](respondWithResult(_0x42484b,null))['catch'](handleError(_0x42484b,null));};exports[_0x650d('0x33')]=function(_0x3627dd,_0x459e32){return db[_0x650d('0x38')]['find']({'where':{'id':_0x3627dd[_0x650d('0x50')]['id']}})[_0x650d('0x1e')](handleEntityNotFound(_0x459e32,null))['then'](removeEntity(_0x459e32,null))[_0x650d('0x4e')](handleError(_0x459e32,null));};exports[_0x650d('0x55')]=function(_0x2ad35c,_0x3afbe6,_0x17d549){var _0x5043d8={};var _0x5e4fd2={};var _0x29f65a;var _0xf92685;return db[_0x650d('0x38')][_0x650d('0x56')]({'where':{'id':_0x2ad35c[_0x650d('0x50')]['id']}})['then'](handleEntityNotFound(_0x3afbe6,null))[_0x650d('0x1e')](function(_0x2ecc5b){if(_0x2ecc5b){_0x29f65a=_0x2ecc5b;_0x5e4fd2[_0x650d('0x3b')]=_[_0x650d('0x3d')](db['Dynamics365Field'][_0x650d('0x57')]);_0x5e4fd2[_0x650d('0x3c')]=_[_0x650d('0x3d')](_0x2ad35c[_0x650d('0x3c')]);_0x5e4fd2[_0x650d('0x3e')]=_[_0x650d('0x40')](_0x5e4fd2['model'],_0x5e4fd2[_0x650d('0x3c')]);_0x5043d8[_0x650d('0x3f')]=_[_0x650d('0x40')](_0x5e4fd2[_0x650d('0x3b')],qs['fields'](_0x2ad35c[_0x650d('0x3c')][_0x650d('0x41')]));_0x5043d8[_0x650d('0x3f')]=_0x5043d8[_0x650d('0x3f')][_0x650d('0x51')]?_0x5043d8[_0x650d('0x3f')]:_0x5e4fd2['model'];_0x5043d8[_0x650d('0x43')]=qs['sort'](_0x2ad35c[_0x650d('0x3c')]['sort']);_0x5043d8['where']=qs[_0x650d('0x3e')](_[_0x650d('0x45')](_0x2ad35c[_0x650d('0x3c')],_0x5e4fd2['filters']));if(_0x2ad35c[_0x650d('0x3c')][_0x650d('0x58')]){_0x5043d8[_0x650d('0x46')]=_[_0x650d('0x48')](_0x5043d8['where'],{'$or':_[_0x650d('0x37')](_0x5043d8['attributes'],function(_0xdef4ce){var _0x11f051={};_0x11f051[_0xdef4ce]={'$like':'%'+_0x2ad35c[_0x650d('0x3c')][_0x650d('0x58')]+'%'};return _0x11f051;})});}_0x5043d8=_[_0x650d('0x48')]({},_0x5043d8,_0x2ad35c[_0x650d('0x49')]);return _0x29f65a['getFields'](_0x5043d8);}})[_0x650d('0x1e')](function(_0x1def35){if(_0x1def35){_0xf92685=_0x1def35[_0x650d('0x51')];if(!_0x2ad35c[_0x650d('0x3c')][_0x650d('0x59')](_0x650d('0x42'))){_0x5043d8[_0x650d('0x2d')]=qs[_0x650d('0x2d')](_0x2ad35c['query'][_0x650d('0x2d')]);_0x5043d8[_0x650d('0x2c')]=qs[_0x650d('0x2c')](_0x2ad35c[_0x650d('0x3c')][_0x650d('0x2c')]);}return _0x29f65a['getFields'](_0x5043d8);}})[_0x650d('0x1e')](function(_0x5bde01){if(_0x5bde01){return _0x5bde01?{'count':_0xf92685,'rows':_0x5bde01}:null;}})[_0x650d('0x1e')](respondWithResult(_0x3afbe6,null))[_0x650d('0x4e')](handleError(_0x3afbe6,null));};exports['getSubjects']=function(_0xb13ddf,_0x337cf2,_0x1d4016){var _0x8886e6={};var _0xb692e1={};var _0xc8a684;var _0xbac172;return db[_0x650d('0x38')][_0x650d('0x56')]({'where':{'id':_0xb13ddf['params']['id']}})[_0x650d('0x1e')](handleEntityNotFound(_0x337cf2,null))[_0x650d('0x1e')](function(_0x48559c){if(_0x48559c){_0xc8a684=_0x48559c;_0xb692e1[_0x650d('0x3b')]=_[_0x650d('0x3d')](db[_0x650d('0x5a')][_0x650d('0x57')]);_0xb692e1['query']=_['keys'](_0xb13ddf['query']);_0xb692e1['filters']=_['intersection'](_0xb692e1[_0x650d('0x3b')],_0xb692e1[_0x650d('0x3c')]);_0x8886e6[_0x650d('0x3f')]=_[_0x650d('0x40')](_0xb692e1[_0x650d('0x3b')],qs[_0x650d('0x41')](_0xb13ddf[_0x650d('0x3c')][_0x650d('0x41')]));_0x8886e6[_0x650d('0x3f')]=_0x8886e6[_0x650d('0x3f')][_0x650d('0x51')]?_0x8886e6[_0x650d('0x3f')]:_0xb692e1[_0x650d('0x3b')];_0x8886e6[_0x650d('0x43')]=qs[_0x650d('0x44')](_0xb13ddf[_0x650d('0x3c')][_0x650d('0x44')]);_0x8886e6[_0x650d('0x46')]=qs['filters'](_['pick'](_0xb13ddf['query'],_0xb692e1[_0x650d('0x3e')]));if(_0xb13ddf[_0x650d('0x3c')][_0x650d('0x58')]){_0x8886e6['where']=_[_0x650d('0x48')](_0x8886e6['where'],{'$or':_[_0x650d('0x37')](_0x8886e6['attributes'],function(_0x5f1707){var _0x382b9b={};_0x382b9b[_0x5f1707]={'$like':'%'+_0xb13ddf[_0x650d('0x3c')][_0x650d('0x58')]+'%'};return _0x382b9b;})});}_0x8886e6=_[_0x650d('0x48')]({},_0x8886e6,_0xb13ddf['options']);return _0xc8a684[_0x650d('0x5b')](_0x8886e6);}})[_0x650d('0x1e')](function(_0x560852){if(_0x560852){_0xbac172=_0x560852[_0x650d('0x51')];if(!_0xb13ddf[_0x650d('0x3c')][_0x650d('0x59')](_0x650d('0x42'))){_0x8886e6['limit']=qs[_0x650d('0x2d')](_0xb13ddf[_0x650d('0x3c')][_0x650d('0x2d')]);_0x8886e6[_0x650d('0x2c')]=qs['offset'](_0xb13ddf[_0x650d('0x3c')]['offset']);}return _0xc8a684[_0x650d('0x5b')](_0x8886e6);}})[_0x650d('0x1e')](function(_0x4094cc){if(_0x4094cc){return _0x4094cc?{'count':_0xbac172,'rows':_0x4094cc}:null;}})[_0x650d('0x1e')](respondWithResult(_0x337cf2,null))[_0x650d('0x4e')](handleError(_0x337cf2,null));};exports[_0x650d('0x5c')]=function(_0x4daad,_0x4ca822,_0x56e296){var _0x55a86e={};var _0x7f6b86={};var _0x1bf546;var _0x459baf;return db[_0x650d('0x38')]['findOne']({'where':{'id':_0x4daad[_0x650d('0x50')]['id']}})[_0x650d('0x1e')](handleEntityNotFound(_0x4ca822,null))[_0x650d('0x1e')](function(_0x2255c7){if(_0x2255c7){_0x1bf546=_0x2255c7;_0x7f6b86[_0x650d('0x3b')]=_['keys'](db[_0x650d('0x5a')][_0x650d('0x57')]);_0x7f6b86[_0x650d('0x3c')]=_['keys'](_0x4daad['query']);_0x7f6b86[_0x650d('0x3e')]=_[_0x650d('0x40')](_0x7f6b86[_0x650d('0x3b')],_0x7f6b86[_0x650d('0x3c')]);_0x55a86e[_0x650d('0x3f')]=_[_0x650d('0x40')](_0x7f6b86[_0x650d('0x3b')],qs['fields'](_0x4daad[_0x650d('0x3c')][_0x650d('0x41')]));_0x55a86e[_0x650d('0x3f')]=_0x55a86e[_0x650d('0x3f')][_0x650d('0x51')]?_0x55a86e[_0x650d('0x3f')]:_0x7f6b86[_0x650d('0x3b')];_0x55a86e[_0x650d('0x43')]=qs[_0x650d('0x44')](_0x4daad['query'][_0x650d('0x44')]);_0x55a86e[_0x650d('0x46')]=qs[_0x650d('0x3e')](_[_0x650d('0x45')](_0x4daad['query'],_0x7f6b86[_0x650d('0x3e')]));if(_0x4daad[_0x650d('0x3c')][_0x650d('0x58')]){_0x55a86e[_0x650d('0x46')]=_[_0x650d('0x48')](_0x55a86e[_0x650d('0x46')],{'$or':_['map'](_0x55a86e['attributes'],function(_0x35c8c9){var _0x5cacbe={};_0x5cacbe[_0x35c8c9]={'$like':'%'+_0x4daad['query'][_0x650d('0x58')]+'%'};return _0x5cacbe;})});}_0x55a86e=_[_0x650d('0x48')]({},_0x55a86e,_0x4daad[_0x650d('0x49')]);return _0x1bf546[_0x650d('0x5c')](_0x55a86e);}})[_0x650d('0x1e')](function(_0xf620a){if(_0xf620a){_0x459baf=_0xf620a['length'];if(!_0x4daad['query'][_0x650d('0x59')]('nolimit')){_0x55a86e['limit']=qs[_0x650d('0x2d')](_0x4daad[_0x650d('0x3c')][_0x650d('0x2d')]);_0x55a86e[_0x650d('0x2c')]=qs[_0x650d('0x2c')](_0x4daad['query']['offset']);}return _0x1bf546[_0x650d('0x5c')](_0x55a86e);}})[_0x650d('0x1e')](function(_0xb3ae21){if(_0xb3ae21){return _0xb3ae21?{'count':_0x459baf,'rows':_0xb3ae21}:null;}})[_0x650d('0x1e')](respondWithResult(_0x4ca822,null))[_0x650d('0x4e')](handleError(_0x4ca822,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 53a0f90..b476e9f 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 _0xaa16=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intDynamics365Configuration.attributes','define','int_dynamics365_configurations','lodash'];(function(_0xf37530,_0x34789e){var _0x3660ac=function(_0x5da7e2){while(--_0x5da7e2){_0xf37530['push'](_0xf37530['shift']());}};_0x3660ac(++_0x34789e);}(_0xaa16,0x15d));var _0x6aa1=function(_0x383929,_0x373985){_0x383929=_0x383929-0x0;var _0x2703fe=_0xaa16[_0x383929];return _0x2703fe;};'use strict';var _=require(_0x6aa1('0x0'));var util=require(_0x6aa1('0x1'));var logger=require(_0x6aa1('0x2'))('api');var moment=require(_0x6aa1('0x3'));var BPromise=require(_0x6aa1('0x4'));var rp=require(_0x6aa1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6aa1('0x6'));var attributes=require(_0x6aa1('0x7'));module['exports']=function(_0x5cf7c1,_0x3ff314){return _0x5cf7c1[_0x6aa1('0x8')]('Dynamics365Configuration',attributes,{'tableName':_0x6aa1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aed=['bluebird','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','moment'];(function(_0x12ea96,_0x59e405){var _0x201861=function(_0x1ad830){while(--_0x1ad830){_0x12ea96['push'](_0x12ea96['shift']());}};_0x201861(++_0x59e405);}(_0x8aed,0x193));var _0xd8ae=function(_0x1a9d11,_0x3a0842){_0x1a9d11=_0x1a9d11-0x0;var _0x563f06=_0x8aed[_0x1a9d11];return _0x563f06;};'use strict';var _=require(_0xd8ae('0x0'));var util=require(_0xd8ae('0x1'));var logger=require(_0xd8ae('0x2'))('api');var moment=require(_0xd8ae('0x3'));var BPromise=require(_0xd8ae('0x4'));var rp=require(_0xd8ae('0x5'));var fs=require('fs');var path=require(_0xd8ae('0x6'));var rimraf=require('rimraf');var config=require(_0xd8ae('0x7'));var attributes=require(_0xd8ae('0x8'));module[_0xd8ae('0x9')]=function(_0x4902dd,_0x5cfe3c){return _0x4902dd['define'](_0xd8ae('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 9349f0b..504ad71 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 _0x6034=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch'];(function(_0x1785a2,_0x15d901){var _0x58380c=function(_0x2739e8){while(--_0x2739e8){_0x1785a2['push'](_0x1785a2['shift']());}};_0x58380c(++_0x15d901);}(_0x6034,0x1f4));var _0x4603=function(_0x4ecd5f,_0x40c2cf){_0x4ecd5f=_0x4ecd5f-0x0;var _0xab6c7=_0x6034[_0x4ecd5f];return _0xab6c7;};'use strict';var _=require('lodash');var util=require(_0x4603('0x0'));var moment=require(_0x4603('0x1'));var BPromise=require(_0x4603('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4603('0x3'));var db=require(_0x4603('0x4'))['db'];var utils=require(_0x4603('0x5'));var logger=require(_0x4603('0x6'))(_0x4603('0x7'));var config=require(_0x4603('0x8'));var jayson=require(_0x4603('0x9'));var client=jayson[_0x4603('0xa')][_0x4603('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x316b78,_0x3666dd,_0x5a9622){return new BPromise(function(_0x4d0abf,_0x149045){return client[_0x4603('0xc')](_0x316b78,_0x5a9622)[_0x4603('0xd')](function(_0x57b578){logger['info'](_0x4603('0xe'),_0x3666dd,'request\x20sent');logger[_0x4603('0xf')](_0x4603('0x10'),_0x3666dd,'request\x20sent',JSON[_0x4603('0x11')](_0x57b578));if(_0x57b578[_0x4603('0x12')]){if(_0x57b578[_0x4603('0x12')][_0x4603('0x13')]===0x1f4){logger[_0x4603('0x12')](_0x4603('0xe'),_0x3666dd,_0x57b578[_0x4603('0x12')]['message']);return _0x149045(_0x57b578[_0x4603('0x12')]['message']);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3666dd,_0x57b578[_0x4603('0x12')][_0x4603('0x14')]);return _0x4d0abf(_0x57b578[_0x4603('0x12')][_0x4603('0x14')]);}else{logger[_0x4603('0x15')](_0x4603('0xe'),_0x3666dd,_0x4603('0x16'));_0x4d0abf(_0x57b578[_0x4603('0x17')][_0x4603('0x14')]);}})[_0x4603('0x18')](function(_0xbaa02b){logger[_0x4603('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3666dd,_0xbaa02b);_0x149045(_0xbaa02b);});});} \ No newline at end of file +var _0x80ee=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x16e0f5,_0x4ec0f3){var _0x4839d5=function(_0x296b8f){while(--_0x296b8f){_0x16e0f5['push'](_0x16e0f5['shift']());}};_0x4839d5(++_0x4ec0f3);}(_0x80ee,0x78));var _0xe80e=function(_0x49684e,_0x9a24fb){_0x49684e=_0x49684e-0x0;var _0x54062f=_0x80ee[_0x49684e];return _0x54062f;};'use strict';var _=require(_0xe80e('0x0'));var util=require(_0xe80e('0x1'));var moment=require(_0xe80e('0x2'));var BPromise=require('bluebird');var rs=require(_0xe80e('0x3'));var fs=require('fs');var Redis=require(_0xe80e('0x4'));var db=require(_0xe80e('0x5'))['db'];var utils=require(_0xe80e('0x6'));var logger=require(_0xe80e('0x7'))('rpc');var config=require(_0xe80e('0x8'));var jayson=require(_0xe80e('0x9'));var client=jayson[_0xe80e('0xa')][_0xe80e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21a318,_0x1d7b5a,_0x17c642){return new BPromise(function(_0x48e7a2,_0x1d7925){return client['request'](_0x21a318,_0x17c642)[_0xe80e('0xc')](function(_0x13f017){logger[_0xe80e('0xd')](_0xe80e('0xe'),_0x1d7b5a,'request\x20sent');logger[_0xe80e('0xf')](_0xe80e('0x10'),_0x1d7b5a,_0xe80e('0x11'),JSON['stringify'](_0x13f017));if(_0x13f017[_0xe80e('0x12')]){if(_0x13f017['error'][_0xe80e('0x13')]===0x1f4){logger[_0xe80e('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1d7b5a,_0x13f017['error'][_0xe80e('0x14')]);return _0x1d7925(_0x13f017['error']['message']);}logger[_0xe80e('0x12')](_0xe80e('0xe'),_0x1d7b5a,_0x13f017[_0xe80e('0x12')][_0xe80e('0x14')]);return _0x48e7a2(_0x13f017[_0xe80e('0x12')][_0xe80e('0x14')]);}else{logger['info'](_0xe80e('0xe'),_0x1d7b5a,_0xe80e('0x11'));_0x48e7a2(_0x13f017[_0xe80e('0x15')]['message']);}})[_0xe80e('0x16')](function(_0x403cd2){logger[_0xe80e('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1d7b5a,_0x403cd2);_0x1d7925(_0x403cd2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 4680f95..c7c4c82 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 _0xa74f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','update','exports','path','Router'];(function(_0x376024,_0x219bc2){var _0x4c9609=function(_0x1b78fa){while(--_0x1b78fa){_0x376024['push'](_0x376024['shift']());}};_0x4c9609(++_0x219bc2);}(_0xa74f,0x9a));var _0xfa74=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0xa74f[_0x23c73d];return _0x36ba47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var auth=require(_0xfa74('0x2'));var interaction=require(_0xfa74('0x3'));var config=require(_0xfa74('0x4'));var controller=require('./intDynamics365Field.controller');router[_0xfa74('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfa74('0x5')](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0x8')]);router[_0xfa74('0x9')]('/',auth[_0xfa74('0x7')](),controller['create']);router[_0xfa74('0xa')](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0xb')]);router['delete'](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller['destroy']);module[_0xfa74('0xc')]=router; \ No newline at end of file +var _0xb43b=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x103bcc,_0x2dff82){var _0xbcd001=function(_0x46c658){while(--_0x46c658){_0x103bcc['push'](_0x103bcc['shift']());}};_0xbcd001(++_0x2dff82);}(_0xb43b,0xbf));var _0xbb43=function(_0x987817,_0x4fe2d8){_0x987817=_0x987817-0x0;var _0x42524e=_0xb43b[_0x987817];return _0x42524e;};'use strict';var multer=require(_0xbb43('0x0'));var util=require('util');var path=require(_0xbb43('0x1'));var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router[_0xbb43('0x9')]('/',auth[_0xbb43('0xa')](),controller[_0xbb43('0xb')]);router['get'](_0xbb43('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbb43('0xd')]('/',auth[_0xbb43('0xa')](),controller[_0xbb43('0xe')]);router[_0xbb43('0xf')](_0xbb43('0xc'),auth['isAuthenticated'](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),controller['destroy']);module[_0xbb43('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index cd710e3..51bd1f9 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 _0x57a0=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x1ea57a,_0x920358){var _0x1be668=function(_0x592021){while(--_0x592021){_0x1ea57a['push'](_0x1ea57a['shift']());}};_0x1be668(++_0x920358);}(_0x57a0,0x7b));var _0x057a=function(_0x51ae98,_0x26fe66){_0x51ae98=_0x51ae98-0x0;var _0x5e3cec=_0x57a0[_0x51ae98];return _0x5e3cec;};'use strict';var Sequelize=require(_0x057a('0x0'));module['exports']={'type':{'type':Sequelize[_0x057a('0x1')](_0x057a('0x2'),'variable',_0x057a('0x3'),_0x057a('0x4')),'defaultValue':_0x057a('0x2')},'content':{'type':Sequelize[_0x057a('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x057a('0x1')](_0x057a('0x2'),'variable',_0x057a('0x3'))},'keyContent':{'type':Sequelize[_0x057a('0x5')]},'idField':{'type':Sequelize[_0x057a('0x5')]},'nameField':{'type':Sequelize[_0x057a('0x5')]},'customField':{'type':Sequelize[_0x057a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x057a('0x5')]}}; \ No newline at end of file +var _0x2188=['BOOLEAN','sequelize','string','variable','keyValue','STRING','customVariable'];(function(_0x4bb6b9,_0x5cda80){var _0x536b01=function(_0x12eaab){while(--_0x12eaab){_0x4bb6b9['push'](_0x4bb6b9['shift']());}};_0x536b01(++_0x5cda80);}(_0x2188,0x1d6));var _0x8218=function(_0x324b6e,_0x32078d){_0x324b6e=_0x324b6e-0x0;var _0x33b5dc=_0x2188[_0x324b6e];return _0x33b5dc;};'use strict';var Sequelize=require(_0x8218('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x8218('0x1'),_0x8218('0x2'),'customVariable',_0x8218('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8218('0x4')]},'key':{'type':Sequelize[_0x8218('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0x8218('0x2'),_0x8218('0x5'))},'keyContent':{'type':Sequelize[_0x8218('0x4')]},'idField':{'type':Sequelize[_0x8218('0x4')]},'nameField':{'type':Sequelize[_0x8218('0x4')]},'customField':{'type':Sequelize[_0x8218('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8218('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b569c2b..8b2f15d 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 _0xa459=['squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','update','then','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','merge','create','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0xa459,0x1d8));var _0x9a45=function(_0xda302e,_0xc8df91){_0xda302e=_0xda302e-0x0;var _0x16e42e=_0xa459[_0xda302e];return _0x16e42e;};'use strict';var pdf=require(_0x9a45('0x0'));var emlformat=require(_0x9a45('0x1'));var rimraf=require(_0x9a45('0x2'));var zipdir=require(_0x9a45('0x3'));var jsonpatch=require(_0x9a45('0x4'));var rp=require(_0x9a45('0x5'));var moment=require(_0x9a45('0x6'));var BPromise=require(_0x9a45('0x7'));var Mustache=require(_0x9a45('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9a45('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a45('0xa'));var squel=require(_0x9a45('0xb'));var crypto=require(_0x9a45('0xc'));var jsforce=require(_0x9a45('0xd'));var deskjs=require(_0x9a45('0xe'));var toCsv=require(_0x9a45('0x9'));var querystring=require('querystring');var Papa=require(_0x9a45('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9a45('0x10'));var hardwareService=require(_0x9a45('0x11'));var logger=require(_0x9a45('0x12'))('api');var utils=require(_0x9a45('0x13'));var config=require(_0x9a45('0x14'));var db=require(_0x9a45('0x15'))['db'];function respondWithStatusCode(_0x30bdf2,_0x3d0a8f){_0x3d0a8f=_0x3d0a8f||0xcc;return function(_0x463d99){if(_0x463d99){return _0x30bdf2[_0x9a45('0x16')](_0x3d0a8f);}return _0x30bdf2[_0x9a45('0x17')](_0x3d0a8f)[_0x9a45('0x18')]();};}function respondWithResult(_0x557e7b,_0x99c111){_0x99c111=_0x99c111||0xc8;return function(_0x435f90){if(_0x435f90){return _0x557e7b[_0x9a45('0x17')](_0x99c111)['json'](_0x435f90);}};}function respondWithFilteredResult(_0x403e2d,_0x59f693){return function(_0x38e771){if(_0x38e771){var _0x546495=_0x38e771[_0x9a45('0x19')],_0x18b793=_0x59f693[_0x9a45('0x1a')],_0x43fdfb=_0x59f693[_0x9a45('0x1a')]+_0x59f693['limit'],_0x1adce2;if(_0x43fdfb>=_0x546495){_0x43fdfb=_0x546495;_0x1adce2=0xc8;}else{_0x1adce2=0xce;}_0x403e2d[_0x9a45('0x17')](_0x1adce2);return _0x403e2d[_0x9a45('0x1b')](_0x9a45('0x1c'),_0x18b793+'-'+_0x43fdfb+'/'+_0x546495)[_0x9a45('0x1d')](_0x38e771);}return null;};}function patchUpdates(_0x31ca24){return function(_0x4d58af){try{jsonpatch[_0x9a45('0x1e')](_0x4d58af,_0x31ca24,!![]);}catch(_0x139842){return BPromise['reject'](_0x139842);}return _0x4d58af['save']();};}function saveUpdates(_0x5913b9,_0x1c662f){return function(_0x56428a){if(_0x56428a){return _0x56428a[_0x9a45('0x1f')](_0x5913b9)[_0x9a45('0x20')](function(_0x4c6f4c){return _0x4c6f4c;});}return null;};}function removeEntity(_0x44fe60,_0x48b3c3){return function(_0x4ccb7e){if(_0x4ccb7e){return _0x4ccb7e['destroy']()['then'](function(){_0x44fe60[_0x9a45('0x17')](0xcc)[_0x9a45('0x18')]();});}};}function handleEntityNotFound(_0x1b7a69,_0x285563){return function(_0x20dd61){if(!_0x20dd61){_0x1b7a69[_0x9a45('0x16')](0x194);}return _0x20dd61;};}function handleError(_0x14193b,_0x1f664f){_0x1f664f=_0x1f664f||0x1f4;return function(_0x1d1d26){logger[_0x9a45('0x21')](_0x1d1d26[_0x9a45('0x22')]);if(_0x1d1d26[_0x9a45('0x23')]){delete _0x1d1d26['name'];}_0x14193b[_0x9a45('0x17')](_0x1f664f)[_0x9a45('0x24')](_0x1d1d26);};}exports['index']=function(_0x106bfb,_0x454998){var _0x583d4c={},_0x7e9378={},_0x587b09={'count':0x0,'rows':[]};var _0x2a9aaa=_[_0x9a45('0x25')](db[_0x9a45('0x26')][_0x9a45('0x27')],function(_0x8cbaf){return{'name':_0x8cbaf[_0x9a45('0x28')],'type':_0x8cbaf[_0x9a45('0x29')]['key']};});_0x7e9378[_0x9a45('0x2a')]=_['map'](_0x2a9aaa,_0x9a45('0x23'));_0x7e9378[_0x9a45('0x2b')]=_[_0x9a45('0x2c')](_0x106bfb[_0x9a45('0x2b')]);_0x7e9378[_0x9a45('0x2d')]=_[_0x9a45('0x2e')](_0x7e9378['model'],_0x7e9378[_0x9a45('0x2b')]);_0x583d4c['attributes']=_[_0x9a45('0x2e')](_0x7e9378['model'],qs[_0x9a45('0x2f')](_0x106bfb[_0x9a45('0x2b')][_0x9a45('0x2f')]));_0x583d4c['attributes']=_0x583d4c[_0x9a45('0x30')]['length']?_0x583d4c[_0x9a45('0x30')]:_0x7e9378[_0x9a45('0x2a')];if(!_0x106bfb['query']['hasOwnProperty'](_0x9a45('0x31'))){_0x583d4c[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x106bfb[_0x9a45('0x2b')][_0x9a45('0x32')]);_0x583d4c[_0x9a45('0x1a')]=qs['offset'](_0x106bfb[_0x9a45('0x2b')][_0x9a45('0x1a')]);}_0x583d4c[_0x9a45('0x33')]=qs[_0x9a45('0x34')](_0x106bfb['query'][_0x9a45('0x34')]);_0x583d4c[_0x9a45('0x35')]=qs[_0x9a45('0x2d')](_[_0x9a45('0x36')](_0x106bfb[_0x9a45('0x2b')],_0x7e9378[_0x9a45('0x2d')]),_0x2a9aaa);if(_0x106bfb['query'][_0x9a45('0x37')]){_0x583d4c['where']=_['merge'](_0x583d4c[_0x9a45('0x35')],{'$or':_[_0x9a45('0x25')](_0x2a9aaa,function(_0x4a31a4){if(_0x4a31a4[_0x9a45('0x29')]!==_0x9a45('0x38')){var _0x5914fd={};_0x5914fd[_0x4a31a4[_0x9a45('0x23')]]={'$like':'%'+_0x106bfb[_0x9a45('0x2b')][_0x9a45('0x37')]+'%'};return _0x5914fd;}})});}_0x583d4c=_['merge']({},_0x583d4c,_0x106bfb[_0x9a45('0x39')]);var _0x3e994b={'where':_0x583d4c[_0x9a45('0x35')]};return db['Dynamics365Field'][_0x9a45('0x19')](_0x3e994b)[_0x9a45('0x20')](function(_0x203dd7){_0x587b09[_0x9a45('0x19')]=_0x203dd7;if(_0x106bfb['query'][_0x9a45('0x3a')]){_0x583d4c['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x9a45('0x3b')](_0x583d4c);})[_0x9a45('0x20')](function(_0x5e4a4e){_0x587b09[_0x9a45('0x3c')]=_0x5e4a4e;return _0x587b09;})[_0x9a45('0x20')](respondWithFilteredResult(_0x454998,_0x583d4c))[_0x9a45('0x3d')](handleError(_0x454998,null));};exports[_0x9a45('0x3e')]=function(_0x42ae3f,_0x57e9f4){var _0x3b13a9={'raw':!![],'where':{'id':_0x42ae3f[_0x9a45('0x3f')]['id']}},_0x18e873={};_0x18e873[_0x9a45('0x2a')]=_[_0x9a45('0x2c')](db['Dynamics365Field'][_0x9a45('0x27')]);_0x18e873[_0x9a45('0x2b')]=_[_0x9a45('0x2c')](_0x42ae3f['query']);_0x18e873[_0x9a45('0x2d')]=_[_0x9a45('0x2e')](_0x18e873[_0x9a45('0x2a')],_0x18e873['query']);_0x3b13a9[_0x9a45('0x30')]=_[_0x9a45('0x2e')](_0x18e873[_0x9a45('0x2a')],qs[_0x9a45('0x2f')](_0x42ae3f[_0x9a45('0x2b')][_0x9a45('0x2f')]));_0x3b13a9[_0x9a45('0x30')]=_0x3b13a9['attributes']['length']?_0x3b13a9['attributes']:_0x18e873['model'];if(_0x42ae3f[_0x9a45('0x2b')][_0x9a45('0x3a')]){_0x3b13a9['include']=[{'all':!![]}];}_0x3b13a9=_[_0x9a45('0x40')]({},_0x3b13a9,_0x42ae3f[_0x9a45('0x39')]);return db[_0x9a45('0x26')]['find'](_0x3b13a9)['then'](handleEntityNotFound(_0x57e9f4,null))[_0x9a45('0x20')](respondWithResult(_0x57e9f4,null))[_0x9a45('0x3d')](handleError(_0x57e9f4,null));};exports[_0x9a45('0x41')]=function(_0x15b3d3,_0x5d812a){return db[_0x9a45('0x26')][_0x9a45('0x41')](_0x15b3d3[_0x9a45('0x42')],{})[_0x9a45('0x20')](respondWithResult(_0x5d812a,0xc9))['catch'](handleError(_0x5d812a,null));};exports['update']=function(_0x22d850,_0x263eee){if(_0x22d850[_0x9a45('0x42')]['id']){delete _0x22d850['body']['id'];}return db['Dynamics365Field'][_0x9a45('0x43')]({'where':{'id':_0x22d850[_0x9a45('0x3f')]['id']}})[_0x9a45('0x20')](handleEntityNotFound(_0x263eee,null))[_0x9a45('0x20')](saveUpdates(_0x22d850[_0x9a45('0x42')],null))['then'](respondWithResult(_0x263eee,null))['catch'](handleError(_0x263eee,null));};exports[_0x9a45('0x44')]=function(_0x4fef78,_0x436482){return db[_0x9a45('0x26')][_0x9a45('0x43')]({'where':{'id':_0x4fef78[_0x9a45('0x3f')]['id']}})[_0x9a45('0x20')](handleEntityNotFound(_0x436482,null))[_0x9a45('0x20')](removeEntity(_0x436482,null))[_0x9a45('0x3d')](handleError(_0x436482,null));}; \ No newline at end of file +var _0x3422=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','Dynamics365Field','rows','catch','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x530810,_0x1fc9ce){var _0x4c293f=function(_0x3767cc){while(--_0x3767cc){_0x530810['push'](_0x530810['shift']());}};_0x4c293f(++_0x1fc9ce);}(_0x3422,0x118));var _0x2342=function(_0x4f9ef1,_0x3cead7){_0x4f9ef1=_0x4f9ef1-0x0;var _0x3d3573=_0x3422[_0x4f9ef1];return _0x3d3573;};'use strict';var pdf=require(_0x2342('0x0'));var emlformat=require(_0x2342('0x1'));var rimraf=require(_0x2342('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2342('0x3'));var rp=require(_0x2342('0x4'));var moment=require('moment');var BPromise=require(_0x2342('0x5'));var Mustache=require('mustache');var util=require(_0x2342('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2342('0x7'));var ejs=require(_0x2342('0x8'));var fs=require('fs');var _=require(_0x2342('0x9'));var squel=require('squel');var crypto=require(_0x2342('0xa'));var jsforce=require(_0x2342('0xb'));var deskjs=require(_0x2342('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2342('0xd'));var Papa=require(_0x2342('0xe'));var Redis=require(_0x2342('0xf'));var authService=require(_0x2342('0x10'));var qs=require(_0x2342('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2342('0x12'));var logger=require(_0x2342('0x13'))(_0x2342('0x14'));var utils=require(_0x2342('0x15'));var config=require(_0x2342('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1166a4,_0x4d1ff7){_0x4d1ff7=_0x4d1ff7||0xcc;return function(_0x5bac9){if(_0x5bac9){return _0x1166a4[_0x2342('0x17')](_0x4d1ff7);}return _0x1166a4[_0x2342('0x18')](_0x4d1ff7)[_0x2342('0x19')]();};}function respondWithResult(_0x11e71d,_0xfe60d9){_0xfe60d9=_0xfe60d9||0xc8;return function(_0x578242){if(_0x578242){return _0x11e71d[_0x2342('0x18')](_0xfe60d9)['json'](_0x578242);}};}function respondWithFilteredResult(_0xb3d373,_0x4e3b33){return function(_0x558947){if(_0x558947){var _0x346098=_0x558947['count'],_0x70a175=_0x4e3b33['offset'],_0x570fd1=_0x4e3b33[_0x2342('0x1a')]+_0x4e3b33[_0x2342('0x1b')],_0x83337;if(_0x570fd1>=_0x346098){_0x570fd1=_0x346098;_0x83337=0xc8;}else{_0x83337=0xce;}_0xb3d373[_0x2342('0x18')](_0x83337);return _0xb3d373['set']('Content-Range',_0x70a175+'-'+_0x570fd1+'/'+_0x346098)[_0x2342('0x1c')](_0x558947);}return null;};}function patchUpdates(_0x41fed0){return function(_0x57af02){try{jsonpatch[_0x2342('0x1d')](_0x57af02,_0x41fed0,!![]);}catch(_0x583fa3){return BPromise[_0x2342('0x1e')](_0x583fa3);}return _0x57af02[_0x2342('0x1f')]();};}function saveUpdates(_0x379794,_0xe62a4f){return function(_0x553589){if(_0x553589){return _0x553589[_0x2342('0x20')](_0x379794)[_0x2342('0x21')](function(_0x839fa0){return _0x839fa0;});}return null;};}function removeEntity(_0x2f0d82,_0x228164){return function(_0x1fd955){if(_0x1fd955){return _0x1fd955[_0x2342('0x22')]()[_0x2342('0x21')](function(){_0x2f0d82['status'](0xcc)[_0x2342('0x19')]();});}};}function handleEntityNotFound(_0x2cc068,_0x5dacc5){return function(_0x4b76e0){if(!_0x4b76e0){_0x2cc068[_0x2342('0x17')](0x194);}return _0x4b76e0;};}function handleError(_0x4cf9c6,_0xe6a837){_0xe6a837=_0xe6a837||0x1f4;return function(_0xbee717){logger[_0x2342('0x23')](_0xbee717[_0x2342('0x24')]);if(_0xbee717[_0x2342('0x25')]){delete _0xbee717[_0x2342('0x25')];}_0x4cf9c6['status'](_0xe6a837)[_0x2342('0x26')](_0xbee717);};}exports[_0x2342('0x27')]=function(_0xb29497,_0x560bd7){var _0x1ffbd6={},_0x1b5448={},_0x10ed17={'count':0x0,'rows':[]};var _0x52e8e6=_[_0x2342('0x28')](db['Dynamics365Field'][_0x2342('0x29')],function(_0x3aae5f){return{'name':_0x3aae5f[_0x2342('0x2a')],'type':_0x3aae5f[_0x2342('0x2b')][_0x2342('0x2c')]};});_0x1b5448[_0x2342('0x2d')]=_['map'](_0x52e8e6,'name');_0x1b5448[_0x2342('0x2e')]=_[_0x2342('0x2f')](_0xb29497[_0x2342('0x2e')]);_0x1b5448[_0x2342('0x30')]=_[_0x2342('0x31')](_0x1b5448[_0x2342('0x2d')],_0x1b5448['query']);_0x1ffbd6['attributes']=_['intersection'](_0x1b5448['model'],qs[_0x2342('0x32')](_0xb29497['query'][_0x2342('0x32')]));_0x1ffbd6[_0x2342('0x33')]=_0x1ffbd6[_0x2342('0x33')][_0x2342('0x34')]?_0x1ffbd6[_0x2342('0x33')]:_0x1b5448[_0x2342('0x2d')];if(!_0xb29497['query'][_0x2342('0x35')](_0x2342('0x36'))){_0x1ffbd6[_0x2342('0x1b')]=qs[_0x2342('0x1b')](_0xb29497[_0x2342('0x2e')][_0x2342('0x1b')]);_0x1ffbd6[_0x2342('0x1a')]=qs[_0x2342('0x1a')](_0xb29497['query']['offset']);}_0x1ffbd6[_0x2342('0x37')]=qs[_0x2342('0x38')](_0xb29497[_0x2342('0x2e')][_0x2342('0x38')]);_0x1ffbd6[_0x2342('0x39')]=qs[_0x2342('0x30')](_[_0x2342('0x3a')](_0xb29497[_0x2342('0x2e')],_0x1b5448[_0x2342('0x30')]),_0x52e8e6);if(_0xb29497[_0x2342('0x2e')]['filter']){_0x1ffbd6[_0x2342('0x39')]=_[_0x2342('0x3b')](_0x1ffbd6[_0x2342('0x39')],{'$or':_[_0x2342('0x28')](_0x52e8e6,function(_0x159aa5){if(_0x159aa5[_0x2342('0x2b')]!==_0x2342('0x3c')){var _0x3ff7b5={};_0x3ff7b5[_0x159aa5[_0x2342('0x25')]]={'$like':'%'+_0xb29497[_0x2342('0x2e')][_0x2342('0x3d')]+'%'};return _0x3ff7b5;}})});}_0x1ffbd6=_[_0x2342('0x3b')]({},_0x1ffbd6,_0xb29497[_0x2342('0x3e')]);var _0x34af02={'where':_0x1ffbd6[_0x2342('0x39')]};return db['Dynamics365Field'][_0x2342('0x3f')](_0x34af02)[_0x2342('0x21')](function(_0xcc9876){_0x10ed17[_0x2342('0x3f')]=_0xcc9876;if(_0xb29497[_0x2342('0x2e')][_0x2342('0x40')]){_0x1ffbd6[_0x2342('0x41')]=[{'all':!![]}];}return db[_0x2342('0x42')]['findAll'](_0x1ffbd6);})['then'](function(_0x2c9131){_0x10ed17[_0x2342('0x43')]=_0x2c9131;return _0x10ed17;})['then'](respondWithFilteredResult(_0x560bd7,_0x1ffbd6))[_0x2342('0x44')](handleError(_0x560bd7,null));};exports['show']=function(_0x4b0fee,_0x3eeae6){var _0x1139b8={'raw':!![],'where':{'id':_0x4b0fee[_0x2342('0x45')]['id']}},_0x2faccc={};_0x2faccc[_0x2342('0x2d')]=_['keys'](db['Dynamics365Field'][_0x2342('0x29')]);_0x2faccc[_0x2342('0x2e')]=_['keys'](_0x4b0fee[_0x2342('0x2e')]);_0x2faccc['filters']=_['intersection'](_0x2faccc[_0x2342('0x2d')],_0x2faccc[_0x2342('0x2e')]);_0x1139b8['attributes']=_[_0x2342('0x31')](_0x2faccc[_0x2342('0x2d')],qs[_0x2342('0x32')](_0x4b0fee['query'][_0x2342('0x32')]));_0x1139b8[_0x2342('0x33')]=_0x1139b8[_0x2342('0x33')][_0x2342('0x34')]?_0x1139b8['attributes']:_0x2faccc[_0x2342('0x2d')];if(_0x4b0fee[_0x2342('0x2e')][_0x2342('0x40')]){_0x1139b8[_0x2342('0x41')]=[{'all':!![]}];}_0x1139b8=_[_0x2342('0x3b')]({},_0x1139b8,_0x4b0fee['options']);return db[_0x2342('0x42')][_0x2342('0x46')](_0x1139b8)[_0x2342('0x21')](handleEntityNotFound(_0x3eeae6,null))[_0x2342('0x21')](respondWithResult(_0x3eeae6,null))[_0x2342('0x44')](handleError(_0x3eeae6,null));};exports[_0x2342('0x47')]=function(_0x2ff184,_0x1a3cff){return db[_0x2342('0x42')]['create'](_0x2ff184[_0x2342('0x48')],{})[_0x2342('0x21')](respondWithResult(_0x1a3cff,0xc9))[_0x2342('0x44')](handleError(_0x1a3cff,null));};exports['update']=function(_0x578a2a,_0x19ad86){if(_0x578a2a['body']['id']){delete _0x578a2a[_0x2342('0x48')]['id'];}return db[_0x2342('0x42')][_0x2342('0x46')]({'where':{'id':_0x578a2a[_0x2342('0x45')]['id']}})[_0x2342('0x21')](handleEntityNotFound(_0x19ad86,null))['then'](saveUpdates(_0x578a2a[_0x2342('0x48')],null))[_0x2342('0x21')](respondWithResult(_0x19ad86,null))[_0x2342('0x44')](handleError(_0x19ad86,null));};exports[_0x2342('0x22')]=function(_0x382b91,_0x14fa24){return db[_0x2342('0x42')][_0x2342('0x46')]({'where':{'id':_0x382b91[_0x2342('0x45')]['id']}})[_0x2342('0x21')](handleEntityNotFound(_0x14fa24,null))[_0x2342('0x21')](removeEntity(_0x14fa24,null))[_0x2342('0x44')](handleError(_0x14fa24,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d9d2c5a..5039db1 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 _0xf3b3=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xf3b3,0x1f1));var _0x3f3b=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xf3b3[_0x383356];return _0x32ee5a;};'use strict';var _=require('lodash');var util=require(_0x3f3b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3f3b('0x1'));var BPromise=require('bluebird');var rp=require(_0x3f3b('0x2'));var fs=require('fs');var path=require(_0x3f3b('0x3'));var rimraf=require(_0x3f3b('0x4'));var config=require(_0x3f3b('0x5'));var attributes=require(_0x3f3b('0x6'));module[_0x3f3b('0x7')]=function(_0x2517a5,_0x239756){return _0x2517a5[_0x3f3b('0x8')](_0x3f3b('0x9'),attributes,{'tableName':_0x3f3b('0xa'),'paranoid':![],'indexes':[{'name':_0x3f3b('0xb'),'fields':[_0x3f3b('0xc'),_0x3f3b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66d8=['idField','FieldId','lodash','util','../../config/logger','moment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x28fe98,_0x36592a){var _0x3b482d=function(_0x30405c){while(--_0x30405c){_0x28fe98['push'](_0x28fe98['shift']());}};_0x3b482d(++_0x36592a);}(_0x66d8,0x178));var _0x866d=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x66d8[_0x28611e];return _0x530f69;};'use strict';var _=require(_0x866d('0x0'));var util=require(_0x866d('0x1'));var logger=require(_0x866d('0x2'))('api');var moment=require(_0x866d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x866d('0x4')]=function(_0x3afb06,_0x2d7b61){return _0x3afb06[_0x866d('0x5')](_0x866d('0x6'),attributes,{'tableName':_0x866d('0x7'),'paranoid':![],'indexes':[{'name':_0x866d('0x8'),'fields':[_0x866d('0x9'),_0x866d('0xa')],'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 21b94bc..1f109e1 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 _0x80c3=['message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s'];(function(_0x423a30,_0x591f95){var _0x237086=function(_0x3ff512){while(--_0x3ff512){_0x423a30['push'](_0x423a30['shift']());}};_0x237086(++_0x591f95);}(_0x80c3,0x18f));var _0x380c=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x80c3[_0x56756b];return _0xa3002;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x380c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x380c('0x2'));var db=require(_0x380c('0x3'))['db'];var utils=require(_0x380c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x380c('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x332ed3,_0x395efa,_0x1cdbad){return new BPromise(function(_0x59445f,_0x1d853e){return client[_0x380c('0x6')](_0x332ed3,_0x1cdbad)['then'](function(_0xdd635d){logger[_0x380c('0x7')]('Dynamics365Field,\x20%s,\x20%s',_0x395efa,_0x380c('0x8'));logger[_0x380c('0x9')](_0x380c('0xa'),_0x395efa,'request\x20sent',JSON[_0x380c('0xb')](_0xdd635d));if(_0xdd635d[_0x380c('0xc')]){if(_0xdd635d[_0x380c('0xc')][_0x380c('0xd')]===0x1f4){logger[_0x380c('0xc')](_0x380c('0xe'),_0x395efa,_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);return _0x1d853e(_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);}logger['error'](_0x380c('0xe'),_0x395efa,_0xdd635d[_0x380c('0xc')]['message']);return _0x59445f(_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);}else{logger[_0x380c('0x7')](_0x380c('0xe'),_0x395efa,_0x380c('0x8'));_0x59445f(_0xdd635d[_0x380c('0x10')][_0x380c('0xf')]);}})[_0x380c('0x11')](function(_0x3022e6){logger['error'](_0x380c('0xe'),_0x395efa,_0x3022e6);_0x1d853e(_0x3022e6);});});} \ No newline at end of file +var _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x545bea,_0x10927b){var _0x5d3cfc=function(_0xc9696){while(--_0xc9696){_0x545bea['push'](_0x545bea['shift']());}};_0x5d3cfc(++_0x10927b);}(_0x5496,0x175));var _0x6549=function(_0x31f9a6,_0x27ac6e){_0x31f9a6=_0x31f9a6-0x0;var _0x4db2b7=_0x5496[_0x31f9a6];return _0x4db2b7;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 8cce865..0023121 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 _0x7ce8=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7ce8,0x15d));var _0x87ce=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0x7ce8[_0x1d94d1];return _0x23c397;};'use strict';var multer=require(_0x87ce('0x0'));var util=require(_0x87ce('0x1'));var path=require(_0x87ce('0x2'));var timeout=require(_0x87ce('0x3'));var express=require(_0x87ce('0x4'));var router=express[_0x87ce('0x5')]();var auth=require(_0x87ce('0x6'));var interaction=require(_0x87ce('0x7'));var config=require(_0x87ce('0x8'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x87ce('0x9')](),controller[_0x87ce('0xa')]);router[_0x87ce('0xb')]('/:id',auth[_0x87ce('0x9')](),controller[_0x87ce('0xc')]);router[_0x87ce('0xb')](_0x87ce('0xd'),auth[_0x87ce('0x9')](),controller[_0x87ce('0xe')]);router['get'](_0x87ce('0xf'),auth[_0x87ce('0x9')](),controller[_0x87ce('0x10')]);router['post']('/',auth[_0x87ce('0x9')](),controller['create']);router[_0x87ce('0x11')](_0x87ce('0xd'),auth[_0x87ce('0x9')](),controller[_0x87ce('0x12')]);router[_0x87ce('0x13')](_0x87ce('0x14'),auth['isAuthenticated'](),controller[_0x87ce('0x15')]);router[_0x87ce('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x87ce('0x17')]);module[_0x87ce('0x18')]=router; \ No newline at end of file +var _0xf9eb=['create','/:id/configurations','addConfiguration','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x3fb67d,_0x100c5a){var _0x455b22=function(_0x5b5eb3){while(--_0x5b5eb3){_0x3fb67d['push'](_0x3fb67d['shift']());}};_0x455b22(++_0x100c5a);}(_0xf9eb,0x10e));var _0xbf9e=function(_0x451aa7,_0x192266){_0x451aa7=_0x451aa7-0x0;var _0x1f03c8=_0xf9eb[_0x451aa7];return _0x1f03c8;};'use strict';var multer=require(_0xbf9e('0x0'));var util=require(_0xbf9e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbf9e('0x2'));var router=express[_0xbf9e('0x3')]();var auth=require(_0xbf9e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbf9e('0x5'));var controller=require(_0xbf9e('0x6'));router['get']('/',auth[_0xbf9e('0x7')](),controller[_0xbf9e('0x8')]);router[_0xbf9e('0x9')](_0xbf9e('0xa'),auth[_0xbf9e('0x7')](),controller[_0xbf9e('0xb')]);router[_0xbf9e('0x9')]('/:id/configurations',auth[_0xbf9e('0x7')](),controller[_0xbf9e('0xc')]);router[_0xbf9e('0x9')](_0xbf9e('0xd'),auth[_0xbf9e('0x7')](),controller[_0xbf9e('0xe')]);router[_0xbf9e('0xf')]('/',auth[_0xbf9e('0x7')](),controller[_0xbf9e('0x10')]);router['post'](_0xbf9e('0x11'),auth[_0xbf9e('0x7')](),controller[_0xbf9e('0x12')]);router['put'](_0xbf9e('0xa'),auth['isAuthenticated'](),controller[_0xbf9e('0x13')]);router[_0xbf9e('0x14')](_0xbf9e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf9e('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 0e7a36f..817c443 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 _0xe785=['sequelize','exports','STRING','username'];(function(_0x13bafa,_0x56918c){var _0x3c317f=function(_0x171f70){while(--_0x171f70){_0x13bafa['push'](_0x13bafa['shift']());}};_0x3c317f(++_0x56918c);}(_0xe785,0x128));var _0x5e78=function(_0x5ca471,_0x2fb4de){_0x5ca471=_0x5ca471-0x0;var _0x1025c3=_0xe785[_0x5ca471];return _0x1025c3;};'use strict';var Sequelize=require(_0x5e78('0x0'));module[_0x5e78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5e78('0x2')]},'username':{'type':Sequelize[_0x5e78('0x2')],'unique':_0x5e78('0x3')},'apiKey':{'type':Sequelize[_0x5e78('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x5e78('0x2')]}}; \ No newline at end of file +var _0x5f66=['STRING','username','exports'];(function(_0x4897c8,_0xaa604d){var _0xc17b85=function(_0x4a4a87){while(--_0x4a4a87){_0x4897c8['push'](_0x4897c8['shift']());}};_0xc17b85(++_0xaa604d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x65f6('0x1')]},'username':{'type':Sequelize[_0x65f6('0x1')],'unique':_0x65f6('0x2')},'apiKey':{'type':Sequelize[_0x65f6('0x1')]},'remoteUri':{'type':Sequelize[_0x65f6('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x65f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index e0538c4..b90605f 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 _0x5fc3=['params','includeAll','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','description','group','company','remove','includes','default','custom_text','label','choices','capitalize','statusCode','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','client','test','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','filters','filter','where','merge','FreshdeskAccount','include','findAll','rows','show'];(function(_0x2c6d13,_0x55a2ed){var _0x4163a1=function(_0x574863){while(--_0x574863){_0x2c6d13['push'](_0x2c6d13['shift']());}};_0x4163a1(++_0x55a2ed);}(_0x5fc3,0xa8));var _0x35fc=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x5fc3[_0xcda377];return _0x1c024f;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var db=require(_0x35fc('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x35fc('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x397738,_0x22055e,_0x2a6ad2){if(_0x2a6ad2){var _0x29730f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29730f[_0x35fc('0x19')](_0x22055e)){return _0x397738;}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 _0x397738;}}function respondWithRpcPromise(_0x558364,_0x398b67,_0x229d56,_0x53b898){return new BPromise(function(_0x154958,_0x227a49){var _0x1121fa=_0x53b898||client;return _0x1121fa['request'](_0x558364,_0x229d56)[_0x35fc('0x1a')](function(_0x45c8b7){logger['info'](_0x35fc('0x1b'),_0x398b67,_0x35fc('0x1c'));logger[_0x35fc('0x1d')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x398b67,_0x35fc('0x1c'),JSON[_0x35fc('0x1e')](_0x45c8b7));if(_0x45c8b7[_0x35fc('0x1f')]){if(_0x45c8b7['error'][_0x35fc('0x20')]===0x1f4){logger[_0x35fc('0x1f')](_0x35fc('0x1b'),_0x398b67,_0x45c8b7[_0x35fc('0x1f')][_0x35fc('0x21')]);return _0x227a49(_0x45c8b7[_0x35fc('0x1f')][_0x35fc('0x21')]);}logger[_0x35fc('0x1f')](_0x35fc('0x1b'),_0x398b67,_0x45c8b7[_0x35fc('0x1f')]['message']);return _0x154958(_0x45c8b7[_0x35fc('0x1f')][_0x35fc('0x21')]);}else{logger[_0x35fc('0x22')](_0x35fc('0x1b'),_0x398b67,_0x35fc('0x1c'));_0x154958(_0x45c8b7['result'][_0x35fc('0x21')]);}})[_0x35fc('0x23')](function(_0x561bf8){logger[_0x35fc('0x1f')](_0x35fc('0x1b'),_0x398b67,_0x561bf8);_0x227a49(_0x561bf8);});});}function respondWithStatusCode(_0x3d4a98,_0x51cfec){_0x51cfec=_0x51cfec||0xcc;return function(_0x4086e9){if(_0x4086e9){return _0x3d4a98['sendStatus'](_0x51cfec);}return _0x3d4a98[_0x35fc('0x24')](_0x51cfec)[_0x35fc('0x25')]();};}function respondWithResult(_0x5cb986,_0x519264){_0x519264=_0x519264||0xc8;return function(_0x47774c){if(_0x47774c){return _0x5cb986['status'](_0x519264)[_0x35fc('0x26')](_0x47774c);}};}function respondWithFilteredResult(_0x1a5d92,_0x57001c){return function(_0x26b7cb){if(_0x26b7cb){var _0x645eac=_0x26b7cb[_0x35fc('0x27')],_0x383837=_0x57001c[_0x35fc('0x28')],_0x9f3c8a=_0x57001c[_0x35fc('0x28')]+_0x57001c['limit'],_0x3735da;if(_0x9f3c8a>=_0x645eac){_0x9f3c8a=_0x645eac;_0x3735da=0xc8;}else{_0x3735da=0xce;}_0x1a5d92[_0x35fc('0x24')](_0x3735da);return _0x1a5d92[_0x35fc('0x29')](_0x35fc('0x2a'),_0x383837+'-'+_0x9f3c8a+'/'+_0x645eac)['json'](_0x26b7cb);}return null;};}function patchUpdates(_0xe79f52){return function(_0x16f067){try{jsonpatch[_0x35fc('0x2b')](_0x16f067,_0xe79f52,!![]);}catch(_0xe6e4ba){return BPromise[_0x35fc('0x2c')](_0xe6e4ba);}return _0x16f067[_0x35fc('0x2d')]();};}function saveUpdates(_0x222ddb,_0x37b435){return function(_0xf4dfab){if(_0xf4dfab){return _0xf4dfab[_0x35fc('0x2e')](_0x222ddb)['then'](function(_0x5e0313){return _0x5e0313;});}return null;};}function removeEntity(_0x114bc1,_0x4af5fe){return function(_0x37b394){if(_0x37b394){return _0x37b394[_0x35fc('0x2f')]()[_0x35fc('0x1a')](function(){_0x114bc1[_0x35fc('0x24')](0xcc)[_0x35fc('0x25')]();});}};}function handleEntityNotFound(_0x12e78f,_0x4e43b4){return function(_0x3fe193){if(!_0x3fe193){_0x12e78f[_0x35fc('0x30')](0x194);}return _0x3fe193;};}function handleError(_0x46b9ef,_0x4441d8){_0x4441d8=_0x4441d8||0x1f4;return function(_0x2bbd36){logger[_0x35fc('0x1f')](_0x2bbd36['stack']);if(_0x2bbd36[_0x35fc('0x31')]){delete _0x2bbd36[_0x35fc('0x31')];}_0x46b9ef[_0x35fc('0x24')](_0x4441d8)['send'](_0x2bbd36);};}exports[_0x35fc('0x32')]=function(_0x48d223,_0x2ecb2e){var _0x33a377={},_0x266a11={},_0x2e00e3={'count':0x0,'rows':[]};var _0x4de4b7=_['map'](db['FreshdeskAccount'][_0x35fc('0x33')],function(_0x56c06c){return{'name':_0x56c06c[_0x35fc('0x34')],'type':_0x56c06c['type'][_0x35fc('0x35')]};});_0x266a11[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0x4de4b7,_0x35fc('0x31'));_0x266a11[_0x35fc('0x38')]=_[_0x35fc('0x39')](_0x48d223[_0x35fc('0x38')]);_0x266a11['filters']=_[_0x35fc('0x3a')](_0x266a11[_0x35fc('0x36')],_0x266a11['query']);_0x33a377[_0x35fc('0x3b')]=_[_0x35fc('0x3a')](_0x266a11[_0x35fc('0x36')],qs[_0x35fc('0x3c')](_0x48d223[_0x35fc('0x38')][_0x35fc('0x3c')]));_0x33a377['attributes']=_0x33a377[_0x35fc('0x3b')][_0x35fc('0x3d')]?_0x33a377[_0x35fc('0x3b')]:_0x266a11['model'];if(!_0x48d223[_0x35fc('0x38')][_0x35fc('0x3e')]('nolimit')){_0x33a377[_0x35fc('0x3f')]=qs[_0x35fc('0x3f')](_0x48d223[_0x35fc('0x38')][_0x35fc('0x3f')]);_0x33a377[_0x35fc('0x28')]=qs[_0x35fc('0x28')](_0x48d223[_0x35fc('0x38')][_0x35fc('0x28')]);}_0x33a377['order']=qs['sort'](_0x48d223[_0x35fc('0x38')][_0x35fc('0x40')]);_0x33a377['where']=qs['filters'](_['pick'](_0x48d223[_0x35fc('0x38')],_0x266a11[_0x35fc('0x41')]),_0x4de4b7);if(_0x48d223['query'][_0x35fc('0x42')]){_0x33a377[_0x35fc('0x43')]=_[_0x35fc('0x44')](_0x33a377[_0x35fc('0x43')],{'$or':_['map'](_0x4de4b7,function(_0x57105c){if(_0x57105c['type']!=='VIRTUAL'){var _0x56bdb9={};_0x56bdb9[_0x57105c[_0x35fc('0x31')]]={'$like':'%'+_0x48d223[_0x35fc('0x38')]['filter']+'%'};return _0x56bdb9;}})});}_0x33a377=_[_0x35fc('0x44')]({},_0x33a377,_0x48d223['options']);var _0x13d16c={'where':_0x33a377[_0x35fc('0x43')]};return db[_0x35fc('0x45')][_0x35fc('0x27')](_0x13d16c)[_0x35fc('0x1a')](function(_0x5d3d0f){_0x2e00e3[_0x35fc('0x27')]=_0x5d3d0f;if(_0x48d223[_0x35fc('0x38')]['includeAll']){_0x33a377[_0x35fc('0x46')]=[{'all':!![]}];}return db[_0x35fc('0x45')][_0x35fc('0x47')](_0x33a377);})[_0x35fc('0x1a')](function(_0x5bc8c3){_0x2e00e3[_0x35fc('0x48')]=_0x5bc8c3;return _0x2e00e3;})['then'](respondWithFilteredResult(_0x2ecb2e,_0x33a377))['catch'](handleError(_0x2ecb2e,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){var _0xca8aef={'raw':![],'where':{'id':_0x9db7e8[_0x35fc('0x4a')]['id']}},_0xf2ca20={};_0xf2ca20[_0x35fc('0x36')]=_[_0x35fc('0x39')](db['FreshdeskAccount'][_0x35fc('0x33')]);_0xf2ca20[_0x35fc('0x38')]=_[_0x35fc('0x39')](_0x9db7e8[_0x35fc('0x38')]);_0xf2ca20[_0x35fc('0x41')]=_[_0x35fc('0x3a')](_0xf2ca20[_0x35fc('0x36')],_0xf2ca20[_0x35fc('0x38')]);_0xca8aef[_0x35fc('0x3b')]=_[_0x35fc('0x3a')](_0xf2ca20[_0x35fc('0x36')],qs[_0x35fc('0x3c')](_0x9db7e8[_0x35fc('0x38')][_0x35fc('0x3c')]));_0xca8aef['attributes']=_0xca8aef['attributes'][_0x35fc('0x3d')]?_0xca8aef[_0x35fc('0x3b')]:_0xf2ca20[_0x35fc('0x36')];if(_0x9db7e8[_0x35fc('0x38')][_0x35fc('0x4b')]){_0xca8aef[_0x35fc('0x46')]=[{'all':!![]}];}_0xca8aef=_['merge']({},_0xca8aef,_0x9db7e8['options']);return db[_0x35fc('0x45')][_0x35fc('0x4c')](_0xca8aef)[_0x35fc('0x1a')](handleEntityNotFound(_0x18dc78,null))[_0x35fc('0x1a')](respondWithResult(_0x18dc78,null))['catch'](handleError(_0x18dc78,null));};exports[_0x35fc('0x4d')]=function(_0x13281f,_0x4965d2){return db[_0x35fc('0x45')][_0x35fc('0x4d')](_0x13281f['body'],{})[_0x35fc('0x1a')](respondWithResult(_0x4965d2,0xc9))[_0x35fc('0x23')](handleError(_0x4965d2,null));};exports[_0x35fc('0x2e')]=function(_0x18f18b,_0x5e4018){if(_0x18f18b['body']['id']){delete _0x18f18b['body']['id'];}return db[_0x35fc('0x45')][_0x35fc('0x4c')]({'where':{'id':_0x18f18b['params']['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x5e4018,null))[_0x35fc('0x1a')](saveUpdates(_0x18f18b[_0x35fc('0x4e')],null))[_0x35fc('0x1a')](respondWithResult(_0x5e4018,null))[_0x35fc('0x23')](handleError(_0x5e4018,null));};exports['destroy']=function(_0x2d9d45,_0x757aa6){return db[_0x35fc('0x45')]['find']({'where':{'id':_0x2d9d45[_0x35fc('0x4a')]['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x757aa6,null))['then'](removeEntity(_0x757aa6,null))[_0x35fc('0x23')](handleError(_0x757aa6,null));};exports[_0x35fc('0x4f')]=function(_0x1c46b1,_0x1c4c33,_0x314666){var _0x41453b={};var _0x8501d1={};var _0x998fd9;var _0x53a79d;return db[_0x35fc('0x45')][_0x35fc('0x50')]({'where':{'id':_0x1c46b1[_0x35fc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c4c33,null))[_0x35fc('0x1a')](function(_0x559d2b){if(_0x559d2b){_0x998fd9=_0x559d2b;_0x8501d1['model']=_['keys'](db[_0x35fc('0x51')][_0x35fc('0x33')]);_0x8501d1[_0x35fc('0x38')]=_[_0x35fc('0x39')](_0x1c46b1[_0x35fc('0x38')]);_0x8501d1['filters']=_['intersection'](_0x8501d1['model'],_0x8501d1['query']);_0x41453b['attributes']=_[_0x35fc('0x3a')](_0x8501d1[_0x35fc('0x36')],qs[_0x35fc('0x3c')](_0x1c46b1[_0x35fc('0x38')]['fields']));_0x41453b[_0x35fc('0x3b')]=_0x41453b[_0x35fc('0x3b')][_0x35fc('0x3d')]?_0x41453b[_0x35fc('0x3b')]:_0x8501d1[_0x35fc('0x36')];_0x41453b[_0x35fc('0x52')]=qs[_0x35fc('0x40')](_0x1c46b1[_0x35fc('0x38')][_0x35fc('0x40')]);_0x41453b['where']=qs[_0x35fc('0x41')](_['pick'](_0x1c46b1[_0x35fc('0x38')],_0x8501d1[_0x35fc('0x41')]));if(_0x1c46b1[_0x35fc('0x38')][_0x35fc('0x42')]){_0x41453b['where']=_[_0x35fc('0x44')](_0x41453b['where'],{'$or':_['map'](_0x41453b['attributes'],function(_0x10dd1a){var _0x5dfeb7={};_0x5dfeb7[_0x10dd1a]={'$like':'%'+_0x1c46b1[_0x35fc('0x38')]['filter']+'%'};return _0x5dfeb7;})});}_0x41453b=_[_0x35fc('0x44')]({},_0x41453b,_0x1c46b1['options']);return _0x998fd9[_0x35fc('0x4f')](_0x41453b);}})[_0x35fc('0x1a')](function(_0x3400f0){if(_0x3400f0){_0x53a79d=_0x3400f0[_0x35fc('0x3d')];if(!_0x1c46b1['query'][_0x35fc('0x3e')](_0x35fc('0x53'))){_0x41453b[_0x35fc('0x3f')]=qs['limit'](_0x1c46b1[_0x35fc('0x38')][_0x35fc('0x3f')]);_0x41453b[_0x35fc('0x28')]=qs[_0x35fc('0x28')](_0x1c46b1[_0x35fc('0x38')][_0x35fc('0x28')]);}return _0x998fd9[_0x35fc('0x4f')](_0x41453b);}})[_0x35fc('0x1a')](function(_0x5159a0){if(_0x5159a0){return _0x5159a0?{'count':_0x53a79d,'rows':_0x5159a0}:null;}})[_0x35fc('0x1a')](respondWithResult(_0x1c4c33,null))[_0x35fc('0x23')](handleError(_0x1c4c33,null));};exports[_0x35fc('0x54')]=function(_0x4a926d,_0x1c88d8,_0x1b76f0){if(_0x4a926d['body']['id']){delete _0x4a926d['body']['id'];}return db[_0x35fc('0x45')]['findOne']({'where':{'id':_0x4a926d[_0x35fc('0x4a')]['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x1c88d8,null))[_0x35fc('0x1a')](function(_0x10952a){if(_0x10952a){_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x55')]=_0x10952a['id'];_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x56')]=integrations[_0x35fc('0x57')](_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x58')],_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x59')]);_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x5a')]=integrations[_0x35fc('0x5b')](_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x58')],_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x59')]);return db['FreshdeskConfiguration'][_0x35fc('0x4d')](_0x4a926d['body'],{'include':[{'model':db[_0x35fc('0x5c')],'as':_0x35fc('0x56')},{'model':db[_0x35fc('0x5c')],'as':_0x35fc('0x5a')}]});}return null;})[_0x35fc('0x1a')](respondWithResult(_0x1c88d8,null))[_0x35fc('0x23')](handleError(_0x1c88d8,null));};exports[_0x35fc('0x5d')]=function(_0x32023a,_0x2fed7b,_0x2656e5){var _0x2ee880='';return db['FreshdeskAccount'][_0x35fc('0x50')]({'where':{'id':_0x32023a[_0x35fc('0x4a')]['id']},'attributes':['id',_0x35fc('0x5e'),_0x35fc('0x5f')]})[_0x35fc('0x1a')](handleEntityNotFound(_0x2fed7b,null))[_0x35fc('0x1a')](function(_0x5416cd){if(_0x5416cd){_0x2ee880=_0x5416cd[_0x35fc('0x5e')];var _0x3353e0=_0x2ee880[_0x35fc('0x60')](-0x1);if(_0x3353e0==='/'){_0x2ee880=_0x2ee880[_0x35fc('0x61')](0x0,_0x2ee880[_0x35fc('0x62')](_0x3353e0));}return rp({'method':_0x35fc('0x63'),'uri':util[_0x35fc('0x64')](_0x35fc('0x65'),_0x2ee880,_0x35fc('0x66')),'headers':{'Authorization':util['format'](_0x35fc('0x67'),new Buffer(util['format'](_0x35fc('0x68'),_0x5416cd[_0x35fc('0x5f')]))['toString'](_0x35fc('0x69')))},'json':!![]});}})[_0x35fc('0x1a')](function(_0xcaa49){if(_0xcaa49){var _0x4274d6=[_0x35fc('0x6a'),_0x35fc('0x6b'),_0x35fc('0x6c'),_0x35fc('0x6d'),_0x35fc('0x24'),'priority','group','source','ticket_type',_0x35fc('0x6e'),_0x35fc('0x6f')];_[_0x35fc('0x70')](_0xcaa49,function(_0x1f5cbc){return _0x4274d6[_0x35fc('0x71')](_0x1f5cbc['name'])||!_0x1f5cbc[_0x35fc('0x72')]&&_0x1f5cbc[_0x35fc('0x59')]!==_0x35fc('0x73')&&_0x1f5cbc[_0x35fc('0x59')]!=='custom_dropdown';});return{'count':_0xcaa49[_0x35fc('0x3d')],'rows':_[_0x35fc('0x37')](_0xcaa49,function(_0x32b2df){return{'id':_0x32b2df['name'],'name':_0x32b2df[_0x35fc('0x74')],'custom':!_0x32b2df[_0x35fc('0x72')],'options':_0x32b2df[_0x35fc('0x75')]?_[_0x35fc('0x37')](_0x32b2df[_0x35fc('0x75')],function(_0x31d276){return{'name':_[_0x35fc('0x76')](_0x31d276),'value':_0x31d276};}):[]};})};}})[_0x35fc('0x1a')](respondWithResult(_0x2fed7b,null))['catch'](function(_0x2faff7){var _0xa2c5f8=_0x32023a[_0x35fc('0x38')][_0x35fc('0x19')]?0x1f4:_0x2faff7[_0x35fc('0x77')]||0x1f4;logger[_0x35fc('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x35fc('0x5d'),_0xa2c5f8,JSON['stringify'](_0x2faff7));delete _0x2faff7['name'];if(_0xa2c5f8===0x191){_0xa2c5f8=0x190;}_0x2fed7b[_0x35fc('0x24')](_0xa2c5f8)['send'](_0x32023a[_0x35fc('0x38')][_0x35fc('0x19')]?{'message':_0x35fc('0x78'),'statusCode':_0x2faff7['statusCode']}:_0x2faff7);});}; \ No newline at end of file +var _0x326f=['offset','limit','set','Content-Range','json','apply','reject','then','destroy','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','merge','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','options','addConfiguration','AccountId','getSubjects','Descriptions','FreshdeskField','Subjects','getFields','apiKey','remoteUri','slice','substring','GET','api/v2/ticket_fields','format','base64','requester','subject','description','source','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','Sequelize','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count'];(function(_0x4a457b,_0x369991){var _0x1abd41=function(_0x268b16){while(--_0x268b16){_0x4a457b['push'](_0x4a457b['shift']());}};_0x1abd41(++_0x369991);}(_0x326f,0xd1));var _0xf326=function(_0x26e748,_0x185bc1){_0x26e748=_0x26e748-0x0;var _0x67e5d1=_0x326f[_0x26e748];return _0x67e5d1;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var db=require(_0xf326('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xf326('0x17'));var client=jayson[_0xf326('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x342fe5,_0x472632,_0x3504eb){if(_0x3504eb){var _0x17a098=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17a098['test'](_0x472632)){return _0x342fe5;}else{throw new db[(_0xf326('0x19'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x342fe5;}}function respondWithRpcPromise(_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return new BPromise(function(_0x292f4b,_0x287a2a){var _0x34128e=_0xa63d1a||client;return _0x34128e[_0xf326('0x1a')](_0xdf21d9,_0x1f2e5a)['then'](function(_0x3ad7da){logger[_0xf326('0x1b')](_0xf326('0x1c'),_0x11f6d2,_0xf326('0x1d'));logger[_0xf326('0x1e')](_0xf326('0x1f'),_0x11f6d2,'request\x20sent',JSON['stringify'](_0x3ad7da));if(_0x3ad7da['error']){if(_0x3ad7da[_0xf326('0x20')][_0xf326('0x21')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x11f6d2,_0x3ad7da[_0xf326('0x20')]['message']);return _0x287a2a(_0x3ad7da['error'][_0xf326('0x22')]);}logger[_0xf326('0x20')]('FreshdeskAccount,\x20%s,\x20%s',_0x11f6d2,_0x3ad7da['error'][_0xf326('0x22')]);return _0x292f4b(_0x3ad7da[_0xf326('0x20')]['message']);}else{logger[_0xf326('0x1b')](_0xf326('0x1c'),_0x11f6d2,_0xf326('0x1d'));_0x292f4b(_0x3ad7da[_0xf326('0x23')][_0xf326('0x22')]);}})[_0xf326('0x24')](function(_0x5ce532){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x11f6d2,_0x5ce532);_0x287a2a(_0x5ce532);});});}function respondWithStatusCode(_0x520d85,_0x1a2c4e){_0x1a2c4e=_0x1a2c4e||0xcc;return function(_0x2cd45a){if(_0x2cd45a){return _0x520d85[_0xf326('0x25')](_0x1a2c4e);}return _0x520d85[_0xf326('0x26')](_0x1a2c4e)[_0xf326('0x27')]();};}function respondWithResult(_0x5217d4,_0x201d28){_0x201d28=_0x201d28||0xc8;return function(_0xa3c0b){if(_0xa3c0b){return _0x5217d4[_0xf326('0x26')](_0x201d28)['json'](_0xa3c0b);}};}function respondWithFilteredResult(_0x1617d2,_0x55ad0f){return function(_0x4a9abf){if(_0x4a9abf){var _0x6a8e89=_0x4a9abf[_0xf326('0x28')],_0x1ae23a=_0x55ad0f[_0xf326('0x29')],_0x2fa28e=_0x55ad0f['offset']+_0x55ad0f[_0xf326('0x2a')],_0x5dbe63;if(_0x2fa28e>=_0x6a8e89){_0x2fa28e=_0x6a8e89;_0x5dbe63=0xc8;}else{_0x5dbe63=0xce;}_0x1617d2[_0xf326('0x26')](_0x5dbe63);return _0x1617d2[_0xf326('0x2b')](_0xf326('0x2c'),_0x1ae23a+'-'+_0x2fa28e+'/'+_0x6a8e89)[_0xf326('0x2d')](_0x4a9abf);}return null;};}function patchUpdates(_0x269be9){return function(_0x161143){try{jsonpatch[_0xf326('0x2e')](_0x161143,_0x269be9,!![]);}catch(_0x43b951){return BPromise[_0xf326('0x2f')](_0x43b951);}return _0x161143['save']();};}function saveUpdates(_0x1035ed,_0x424104){return function(_0x21b23d){if(_0x21b23d){return _0x21b23d['update'](_0x1035ed)[_0xf326('0x30')](function(_0x1721fd){return _0x1721fd;});}return null;};}function removeEntity(_0x303dc6,_0x4df451){return function(_0x5b101d){if(_0x5b101d){return _0x5b101d[_0xf326('0x31')]()[_0xf326('0x30')](function(){_0x303dc6[_0xf326('0x26')](0xcc)[_0xf326('0x27')]();});}};}function handleEntityNotFound(_0x30694f,_0x2e8a64){return function(_0x62585a){if(!_0x62585a){_0x30694f[_0xf326('0x25')](0x194);}return _0x62585a;};}function handleError(_0x580374,_0x461e93){_0x461e93=_0x461e93||0x1f4;return function(_0x1981bc){logger['error'](_0x1981bc[_0xf326('0x32')]);if(_0x1981bc['name']){delete _0x1981bc[_0xf326('0x33')];}_0x580374['status'](_0x461e93)['send'](_0x1981bc);};}exports[_0xf326('0x34')]=function(_0x4d8eac,_0x40dcb4){var _0x57aa27={},_0x310dbb={},_0x409260={'count':0x0,'rows':[]};var _0x2750ae=_['map'](db[_0xf326('0x35')][_0xf326('0x36')],function(_0x48525a){return{'name':_0x48525a[_0xf326('0x37')],'type':_0x48525a[_0xf326('0x38')][_0xf326('0x39')]};});_0x310dbb[_0xf326('0x3a')]=_['map'](_0x2750ae,_0xf326('0x33'));_0x310dbb[_0xf326('0x3b')]=_[_0xf326('0x3c')](_0x4d8eac[_0xf326('0x3b')]);_0x310dbb[_0xf326('0x3d')]=_['intersection'](_0x310dbb[_0xf326('0x3a')],_0x310dbb[_0xf326('0x3b')]);_0x57aa27['attributes']=_['intersection'](_0x310dbb[_0xf326('0x3a')],qs['fields'](_0x4d8eac['query'][_0xf326('0x3e')]));_0x57aa27['attributes']=_0x57aa27[_0xf326('0x3f')][_0xf326('0x40')]?_0x57aa27[_0xf326('0x3f')]:_0x310dbb[_0xf326('0x3a')];if(!_0x4d8eac['query'][_0xf326('0x41')](_0xf326('0x42'))){_0x57aa27[_0xf326('0x2a')]=qs[_0xf326('0x2a')](_0x4d8eac[_0xf326('0x3b')][_0xf326('0x2a')]);_0x57aa27[_0xf326('0x29')]=qs[_0xf326('0x29')](_0x4d8eac[_0xf326('0x3b')][_0xf326('0x29')]);}_0x57aa27[_0xf326('0x43')]=qs[_0xf326('0x44')](_0x4d8eac['query'][_0xf326('0x44')]);_0x57aa27[_0xf326('0x45')]=qs[_0xf326('0x3d')](_[_0xf326('0x46')](_0x4d8eac[_0xf326('0x3b')],_0x310dbb[_0xf326('0x3d')]),_0x2750ae);if(_0x4d8eac['query'][_0xf326('0x47')]){_0x57aa27[_0xf326('0x45')]=_['merge'](_0x57aa27[_0xf326('0x45')],{'$or':_[_0xf326('0x48')](_0x2750ae,function(_0x130c56){if(_0x130c56[_0xf326('0x38')]!==_0xf326('0x49')){var _0x55361f={};_0x55361f[_0x130c56['name']]={'$like':'%'+_0x4d8eac[_0xf326('0x3b')][_0xf326('0x47')]+'%'};return _0x55361f;}})});}_0x57aa27=_['merge']({},_0x57aa27,_0x4d8eac['options']);var _0x8e318d={'where':_0x57aa27[_0xf326('0x45')]};return db[_0xf326('0x35')]['count'](_0x8e318d)[_0xf326('0x30')](function(_0xe96e1e){_0x409260[_0xf326('0x28')]=_0xe96e1e;if(_0x4d8eac[_0xf326('0x3b')][_0xf326('0x4a')]){_0x57aa27[_0xf326('0x4b')]=[{'all':!![]}];}return db[_0xf326('0x35')][_0xf326('0x4c')](_0x57aa27);})[_0xf326('0x30')](function(_0x27ced1){_0x409260[_0xf326('0x4d')]=_0x27ced1;return _0x409260;})[_0xf326('0x30')](respondWithFilteredResult(_0x40dcb4,_0x57aa27))[_0xf326('0x24')](handleError(_0x40dcb4,null));};exports[_0xf326('0x4e')]=function(_0xeac1a1,_0x59f9a7){var _0x199f8b={'raw':![],'where':{'id':_0xeac1a1[_0xf326('0x4f')]['id']}},_0x1b0e03={};_0x1b0e03[_0xf326('0x3a')]=_['keys'](db[_0xf326('0x35')][_0xf326('0x36')]);_0x1b0e03[_0xf326('0x3b')]=_[_0xf326('0x3c')](_0xeac1a1['query']);_0x1b0e03[_0xf326('0x3d')]=_[_0xf326('0x50')](_0x1b0e03[_0xf326('0x3a')],_0x1b0e03[_0xf326('0x3b')]);_0x199f8b[_0xf326('0x3f')]=_['intersection'](_0x1b0e03['model'],qs[_0xf326('0x3e')](_0xeac1a1[_0xf326('0x3b')][_0xf326('0x3e')]));_0x199f8b['attributes']=_0x199f8b[_0xf326('0x3f')][_0xf326('0x40')]?_0x199f8b[_0xf326('0x3f')]:_0x1b0e03['model'];if(_0xeac1a1['query'][_0xf326('0x4a')]){_0x199f8b['include']=[{'all':!![]}];}_0x199f8b=_[_0xf326('0x51')]({},_0x199f8b,_0xeac1a1['options']);return db[_0xf326('0x35')][_0xf326('0x52')](_0x199f8b)[_0xf326('0x30')](handleEntityNotFound(_0x59f9a7,null))[_0xf326('0x30')](respondWithResult(_0x59f9a7,null))[_0xf326('0x24')](handleError(_0x59f9a7,null));};exports[_0xf326('0x53')]=function(_0x7f7ece,_0x495a16){return db[_0xf326('0x35')][_0xf326('0x53')](_0x7f7ece[_0xf326('0x54')],{})['then'](respondWithResult(_0x495a16,0xc9))[_0xf326('0x24')](handleError(_0x495a16,null));};exports[_0xf326('0x55')]=function(_0x3b8635,_0x16c578){if(_0x3b8635[_0xf326('0x54')]['id']){delete _0x3b8635['body']['id'];}return db[_0xf326('0x35')][_0xf326('0x52')]({'where':{'id':_0x3b8635[_0xf326('0x4f')]['id']}})[_0xf326('0x30')](handleEntityNotFound(_0x16c578,null))['then'](saveUpdates(_0x3b8635[_0xf326('0x54')],null))[_0xf326('0x30')](respondWithResult(_0x16c578,null))[_0xf326('0x24')](handleError(_0x16c578,null));};exports[_0xf326('0x31')]=function(_0x4d3b9e,_0x5be2b1){return db[_0xf326('0x35')][_0xf326('0x52')]({'where':{'id':_0x4d3b9e['params']['id']}})[_0xf326('0x30')](handleEntityNotFound(_0x5be2b1,null))[_0xf326('0x30')](removeEntity(_0x5be2b1,null))[_0xf326('0x24')](handleError(_0x5be2b1,null));};exports[_0xf326('0x56')]=function(_0x5765b0,_0xb1c18c,_0x5657b7){var _0x5dbeb9={};var _0x9d84c3={};var _0x51d466;var _0x173760;return db[_0xf326('0x35')][_0xf326('0x57')]({'where':{'id':_0x5765b0['params']['id']}})['then'](handleEntityNotFound(_0xb1c18c,null))[_0xf326('0x30')](function(_0xa85a42){if(_0xa85a42){_0x51d466=_0xa85a42;_0x9d84c3[_0xf326('0x3a')]=_['keys'](db[_0xf326('0x58')]['rawAttributes']);_0x9d84c3[_0xf326('0x3b')]=_[_0xf326('0x3c')](_0x5765b0[_0xf326('0x3b')]);_0x9d84c3[_0xf326('0x3d')]=_[_0xf326('0x50')](_0x9d84c3[_0xf326('0x3a')],_0x9d84c3[_0xf326('0x3b')]);_0x5dbeb9[_0xf326('0x3f')]=_[_0xf326('0x50')](_0x9d84c3[_0xf326('0x3a')],qs[_0xf326('0x3e')](_0x5765b0[_0xf326('0x3b')][_0xf326('0x3e')]));_0x5dbeb9['attributes']=_0x5dbeb9[_0xf326('0x3f')]['length']?_0x5dbeb9[_0xf326('0x3f')]:_0x9d84c3[_0xf326('0x3a')];_0x5dbeb9['order']=qs[_0xf326('0x44')](_0x5765b0['query'][_0xf326('0x44')]);_0x5dbeb9[_0xf326('0x45')]=qs[_0xf326('0x3d')](_[_0xf326('0x46')](_0x5765b0[_0xf326('0x3b')],_0x9d84c3['filters']));if(_0x5765b0['query'][_0xf326('0x47')]){_0x5dbeb9[_0xf326('0x45')]=_[_0xf326('0x51')](_0x5dbeb9[_0xf326('0x45')],{'$or':_[_0xf326('0x48')](_0x5dbeb9['attributes'],function(_0x28c4f2){var _0x471da8={};_0x471da8[_0x28c4f2]={'$like':'%'+_0x5765b0['query']['filter']+'%'};return _0x471da8;})});}_0x5dbeb9=_['merge']({},_0x5dbeb9,_0x5765b0[_0xf326('0x59')]);return _0x51d466[_0xf326('0x56')](_0x5dbeb9);}})[_0xf326('0x30')](function(_0x235525){if(_0x235525){_0x173760=_0x235525[_0xf326('0x40')];if(!_0x5765b0[_0xf326('0x3b')][_0xf326('0x41')]('nolimit')){_0x5dbeb9[_0xf326('0x2a')]=qs[_0xf326('0x2a')](_0x5765b0[_0xf326('0x3b')][_0xf326('0x2a')]);_0x5dbeb9['offset']=qs[_0xf326('0x29')](_0x5765b0['query']['offset']);}return _0x51d466[_0xf326('0x56')](_0x5dbeb9);}})['then'](function(_0x78ba34){if(_0x78ba34){return _0x78ba34?{'count':_0x173760,'rows':_0x78ba34}:null;}})[_0xf326('0x30')](respondWithResult(_0xb1c18c,null))[_0xf326('0x24')](handleError(_0xb1c18c,null));};exports[_0xf326('0x5a')]=function(_0x17cd36,_0x541491,_0x4a053c){if(_0x17cd36['body']['id']){delete _0x17cd36[_0xf326('0x54')]['id'];}return db[_0xf326('0x35')][_0xf326('0x57')]({'where':{'id':_0x17cd36[_0xf326('0x4f')]['id']}})[_0xf326('0x30')](handleEntityNotFound(_0x541491,null))['then'](function(_0x1ed961){if(_0x1ed961){_0x17cd36[_0xf326('0x54')][_0xf326('0x5b')]=_0x1ed961['id'];_0x17cd36['body']['Subjects']=integrations[_0xf326('0x5c')](_0x17cd36[_0xf326('0x54')]['channel'],_0x17cd36['body'][_0xf326('0x38')]);_0x17cd36['body'][_0xf326('0x5d')]=integrations['getDescriptions'](_0x17cd36['body']['channel'],_0x17cd36[_0xf326('0x54')][_0xf326('0x38')]);return db[_0xf326('0x58')]['create'](_0x17cd36[_0xf326('0x54')],{'include':[{'model':db[_0xf326('0x5e')],'as':_0xf326('0x5f')},{'model':db[_0xf326('0x5e')],'as':_0xf326('0x5d')}]});}return null;})[_0xf326('0x30')](respondWithResult(_0x541491,null))[_0xf326('0x24')](handleError(_0x541491,null));};exports[_0xf326('0x60')]=function(_0x3855a4,_0x5290da,_0x34c3cf){var _0x5b1494='';return db[_0xf326('0x35')][_0xf326('0x57')]({'where':{'id':_0x3855a4[_0xf326('0x4f')]['id']},'attributes':['id','remoteUri',_0xf326('0x61')]})[_0xf326('0x30')](handleEntityNotFound(_0x5290da,null))[_0xf326('0x30')](function(_0x4dc8d7){if(_0x4dc8d7){_0x5b1494=_0x4dc8d7[_0xf326('0x62')];var _0x4057e1=_0x5b1494[_0xf326('0x63')](-0x1);if(_0x4057e1==='/'){_0x5b1494=_0x5b1494[_0xf326('0x64')](0x0,_0x5b1494['lastIndexOf'](_0x4057e1));}return rp({'method':_0xf326('0x65'),'uri':util['format']('%s/%s',_0x5b1494,_0xf326('0x66')),'headers':{'Authorization':util[_0xf326('0x67')]('Basic\x20%s',new Buffer(util['format']('%s:X',_0x4dc8d7[_0xf326('0x61')]))['toString'](_0xf326('0x68')))},'json':!![]});}})[_0xf326('0x30')](function(_0x3434b2){if(_0x3434b2){var _0x2ec314=[_0xf326('0x69'),_0xf326('0x6a'),'agent',_0xf326('0x6b'),_0xf326('0x26'),'priority','group',_0xf326('0x6c'),'ticket_type',_0xf326('0x6d'),_0xf326('0x6e')];_[_0xf326('0x6f')](_0x3434b2,function(_0x363e64){return _0x2ec314[_0xf326('0x70')](_0x363e64[_0xf326('0x33')])||!_0x363e64[_0xf326('0x71')]&&_0x363e64[_0xf326('0x38')]!==_0xf326('0x72')&&_0x363e64['type']!==_0xf326('0x73');});return{'count':_0x3434b2[_0xf326('0x40')],'rows':_['map'](_0x3434b2,function(_0x3c82cf){return{'id':_0x3c82cf['name'],'name':_0x3c82cf[_0xf326('0x74')],'custom':!_0x3c82cf[_0xf326('0x71')],'options':_0x3c82cf[_0xf326('0x75')]?_['map'](_0x3c82cf[_0xf326('0x75')],function(_0x1c86c8){return{'name':_[_0xf326('0x76')](_0x1c86c8),'value':_0x1c86c8};}):[]};})};}})[_0xf326('0x30')](respondWithResult(_0x5290da,null))[_0xf326('0x24')](function(_0x1e50aa){var _0x148779=_0x3855a4[_0xf326('0x3b')][_0xf326('0x77')]?0x1f4:_0x1e50aa[_0xf326('0x78')]||0x1f4;logger[_0xf326('0x20')](_0xf326('0x79'),_0xf326('0x60'),_0x148779,JSON[_0xf326('0x7a')](_0x1e50aa));delete _0x1e50aa[_0xf326('0x33')];if(_0x148779===0x191){_0x148779=0x190;}_0x5290da['status'](_0x148779)[_0xf326('0x7b')](_0x3855a4[_0xf326('0x3b')]['test']?{'message':_0xf326('0x7c'),'statusCode':_0x1e50aa[_0xf326('0x78')]}:_0x1e50aa);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 483b9c4..e21458e 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 _0x0f05=['FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0f05,0x1e3));var _0x50f0=function(_0x47c454,_0x256ebc){_0x47c454=_0x47c454-0x0;var _0x2bb87e=_0x0f05[_0x47c454];return _0x2bb87e;};'use strict';var _=require(_0x50f0('0x0'));var util=require('util');var logger=require(_0x50f0('0x1'))(_0x50f0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x50f0('0x3'));var fs=require('fs');var path=require(_0x50f0('0x4'));var rimraf=require(_0x50f0('0x5'));var config=require(_0x50f0('0x6'));var attributes=require(_0x50f0('0x7'));var integrations=require(_0x50f0('0x8'));module[_0x50f0('0x9')]=function(_0x229976,_0x2bdd8a){return _0x229976[_0x50f0('0xa')](_0x50f0('0xb'),attributes,{'tableName':_0x50f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2354=['../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x2354,0x198));var _0x4235=function(_0x376418,_0x621d4c){_0x376418=_0x376418-0x0;var _0x2d60e3=_0x2354[_0x376418];return _0x2d60e3;};'use strict';var _=require(_0x4235('0x0'));var util=require('util');var logger=require(_0x4235('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4235('0x2'));var rp=require(_0x4235('0x3'));var fs=require('fs');var path=require(_0x4235('0x4'));var rimraf=require(_0x4235('0x5'));var config=require(_0x4235('0x6'));var attributes=require(_0x4235('0x7'));var integrations=require(_0x4235('0x8'));module[_0x4235('0x9')]=function(_0x2cd615,_0x3e7cd3){return _0x2cd615[_0x4235('0xa')](_0x4235('0xb'),attributes,{'tableName':_0x4235('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 2e4172c..8c581d1 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 _0x0667=['find','where','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','include','map','model','attributes','stringify','ShowFreshdeskAccount'];(function(_0x414a1e,_0x28cb45){var _0x17c34b=function(_0x4ebbb8){while(--_0x4ebbb8){_0x414a1e['push'](_0x414a1e['shift']());}};_0x17c34b(++_0x28cb45);}(_0x0667,0xe9));var _0x7066=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0667[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x7066('0x0'));var moment=require(_0x7066('0x1'));var BPromise=require(_0x7066('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7066('0x3'))['db'];var utils=require(_0x7066('0x4'));var logger=require(_0x7066('0x5'))(_0x7066('0x6'));var config=require(_0x7066('0x7'));var jayson=require(_0x7066('0x8'));var client=jayson[_0x7066('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c5cec,_0x9b1f1b,_0x483c64){return new BPromise(function(_0x48cef7,_0x487bcf){return client[_0x7066('0xa')](_0x1c5cec,_0x483c64)[_0x7066('0xb')](function(_0x3d5d9f){logger[_0x7066('0xc')](_0x7066('0xd'),_0x9b1f1b,_0x7066('0xe'));logger[_0x7066('0xf')](_0x7066('0x10'),_0x9b1f1b,_0x7066('0xe'),JSON['stringify'](_0x3d5d9f));if(_0x3d5d9f[_0x7066('0x11')]){if(_0x3d5d9f[_0x7066('0x11')][_0x7066('0x12')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x9b1f1b,_0x3d5d9f['error'][_0x7066('0x13')]);return _0x487bcf(_0x3d5d9f[_0x7066('0x11')][_0x7066('0x13')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x9b1f1b,_0x3d5d9f[_0x7066('0x11')][_0x7066('0x13')]);return _0x48cef7(_0x3d5d9f[_0x7066('0x11')][_0x7066('0x13')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x9b1f1b,_0x7066('0xe'));_0x48cef7(_0x3d5d9f['result'][_0x7066('0x13')]);}})[_0x7066('0x14')](function(_0xd464ae){logger[_0x7066('0x11')](_0x7066('0xd'),_0x9b1f1b,_0xd464ae);_0x487bcf(_0xd464ae);});});}exports[_0x7066('0x15')]=function(_0x565e93){var _0x30747c=this;return new Promise(function(_0x163476,_0x269182){return db[_0x7066('0x16')][_0x7066('0x17')]({'raw':_0x565e93[_0x7066('0x18')]?_0x565e93[_0x7066('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x565e93[_0x7066('0x18')]?_0x565e93['options']['where']||null:null,'attributes':_0x565e93['options']?_0x565e93[_0x7066('0x18')]['attributes']||null:null,'limit':_0x565e93[_0x7066('0x18')]?_0x565e93['options']['limit']||null:null,'include':_0x565e93[_0x7066('0x18')]?_0x565e93[_0x7066('0x18')][_0x7066('0x19')]?_[_0x7066('0x1a')](_0x565e93[_0x7066('0x18')][_0x7066('0x19')],function(_0x2c5c73){return{'model':db[_0x2c5c73[_0x7066('0x1b')]],'as':_0x2c5c73['as'],'attributes':_0x2c5c73[_0x7066('0x1c')],'include':_0x2c5c73[_0x7066('0x19')]?_[_0x7066('0x1a')](_0x2c5c73[_0x7066('0x19')],function(_0x1f4626){return{'model':db[_0x1f4626[_0x7066('0x1b')]],'as':_0x1f4626['as'],'attributes':_0x1f4626[_0x7066('0x1c')],'include':_0x1f4626[_0x7066('0x19')]?_['map'](_0x1f4626[_0x7066('0x19')],function(_0x4be617){return{'model':db[_0x4be617[_0x7066('0x1b')]],'as':_0x4be617['as'],'attributes':_0x4be617['attributes']};}):[]};}):[]};}):[]:[]})[_0x7066('0xb')](function(_0x1dfdc5){logger['info'](_0x7066('0x15'),_0x565e93);logger[_0x7066('0xf')](_0x7066('0x15'),_0x565e93,JSON[_0x7066('0x1d')](_0x1dfdc5));_0x163476(_0x1dfdc5);})[_0x7066('0x14')](function(_0x2d1573){logger[_0x7066('0x11')](_0x7066('0x15'),_0x2d1573['message'],_0x565e93);_0x269182(_0x30747c[_0x7066('0x11')](0x1f4,_0x2d1573[_0x7066('0x13')]));});});};exports[_0x7066('0x1e')]=function(_0x20e539){var _0x3a40dc=this;return new Promise(function(_0x1bd216,_0x180b98){return db[_0x7066('0x16')][_0x7066('0x1f')]({'raw':_0x20e539[_0x7066('0x18')]?_0x20e539['options']['raw']===undefined?!![]:![]:!![],'where':_0x20e539[_0x7066('0x18')]?_0x20e539[_0x7066('0x18')][_0x7066('0x20')]||null:null,'attributes':_0x20e539[_0x7066('0x18')]?_0x20e539[_0x7066('0x18')]['attributes']||null:null,'include':_0x20e539[_0x7066('0x18')]?_0x20e539[_0x7066('0x18')]['include']?_[_0x7066('0x1a')](_0x20e539[_0x7066('0x18')][_0x7066('0x19')],function(_0x27f6e4){return{'model':db[_0x27f6e4['model']],'as':_0x27f6e4['as'],'attributes':_0x27f6e4[_0x7066('0x1c')],'include':_0x27f6e4['include']?_[_0x7066('0x1a')](_0x27f6e4['include'],function(_0xf64868){return{'model':db[_0xf64868[_0x7066('0x1b')]],'as':_0xf64868['as'],'attributes':_0xf64868[_0x7066('0x1c')],'include':_0xf64868[_0x7066('0x19')]?_['map'](_0xf64868[_0x7066('0x19')],function(_0x5a3573){return{'model':db[_0x5a3573[_0x7066('0x1b')]],'as':_0x5a3573['as'],'attributes':_0x5a3573[_0x7066('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36ff15){logger[_0x7066('0xc')](_0x7066('0x1e'),_0x20e539);logger[_0x7066('0xf')](_0x7066('0x1e'),_0x20e539,JSON[_0x7066('0x1d')](_0x36ff15));_0x1bd216(_0x36ff15);})[_0x7066('0x14')](function(_0x1b1864){logger['error'](_0x7066('0x1e'),_0x1b1864['message'],_0x20e539);_0x180b98(_0x3a40dc['error'](0x1f4,_0x1b1864[_0x7066('0x13')]));});});}; \ No newline at end of file +var _0x0fa0=['include','map','model','attributes','GetFreshdeskAccount','stringify','find','raw','ShowFreshdeskAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','FreshdeskAccount','findAll','options','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0fa0,0x157));var _0x00fa=function(_0x43198b,_0x2ce6dc){_0x43198b=_0x43198b-0x0;var _0x241ef7=_0x0fa0[_0x43198b];return _0x241ef7;};'use strict';var _=require(_0x00fa('0x0'));var util=require(_0x00fa('0x1'));var moment=require(_0x00fa('0x2'));var BPromise=require(_0x00fa('0x3'));var rs=require(_0x00fa('0x4'));var fs=require('fs');var Redis=require(_0x00fa('0x5'));var db=require(_0x00fa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x00fa('0x7'))(_0x00fa('0x8'));var config=require('../../config/environment');var jayson=require(_0x00fa('0x9'));var client=jayson[_0x00fa('0xa')][_0x00fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x382500,_0x3e083f,_0x43cc25){return new BPromise(function(_0x391772,_0xaf1ef8){return client[_0x00fa('0xc')](_0x382500,_0x43cc25)[_0x00fa('0xd')](function(_0x2d4e37){logger[_0x00fa('0xe')](_0x00fa('0xf'),_0x3e083f,_0x00fa('0x10'));logger[_0x00fa('0x11')](_0x00fa('0x12'),_0x3e083f,'request\x20sent',JSON['stringify'](_0x2d4e37));if(_0x2d4e37[_0x00fa('0x13')]){if(_0x2d4e37[_0x00fa('0x13')][_0x00fa('0x14')]===0x1f4){logger[_0x00fa('0x13')](_0x00fa('0xf'),_0x3e083f,_0x2d4e37[_0x00fa('0x13')][_0x00fa('0x15')]);return _0xaf1ef8(_0x2d4e37[_0x00fa('0x13')][_0x00fa('0x15')]);}logger[_0x00fa('0x13')](_0x00fa('0xf'),_0x3e083f,_0x2d4e37['error'][_0x00fa('0x15')]);return _0x391772(_0x2d4e37[_0x00fa('0x13')]['message']);}else{logger['info'](_0x00fa('0xf'),_0x3e083f,'request\x20sent');_0x391772(_0x2d4e37[_0x00fa('0x16')][_0x00fa('0x15')]);}})['catch'](function(_0x2d4ff0){logger[_0x00fa('0x13')](_0x00fa('0xf'),_0x3e083f,_0x2d4ff0);_0xaf1ef8(_0x2d4ff0);});});}exports['GetFreshdeskAccount']=function(_0x490f03){var _0x1dcd82=this;return new Promise(function(_0xe9c997,_0x92a932){return db[_0x00fa('0x17')][_0x00fa('0x18')]({'raw':_0x490f03['options']?_0x490f03[_0x00fa('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x490f03['options']?_0x490f03[_0x00fa('0x19')][_0x00fa('0x1a')]||null:null,'attributes':_0x490f03[_0x00fa('0x19')]?_0x490f03['options']['attributes']||null:null,'limit':_0x490f03[_0x00fa('0x19')]?_0x490f03[_0x00fa('0x19')]['limit']||null:null,'include':_0x490f03['options']?_0x490f03['options'][_0x00fa('0x1b')]?_[_0x00fa('0x1c')](_0x490f03[_0x00fa('0x19')]['include'],function(_0x198329){return{'model':db[_0x198329[_0x00fa('0x1d')]],'as':_0x198329['as'],'attributes':_0x198329[_0x00fa('0x1e')],'include':_0x198329[_0x00fa('0x1b')]?_[_0x00fa('0x1c')](_0x198329[_0x00fa('0x1b')],function(_0x1b9dd2){return{'model':db[_0x1b9dd2[_0x00fa('0x1d')]],'as':_0x1b9dd2['as'],'attributes':_0x1b9dd2[_0x00fa('0x1e')],'include':_0x1b9dd2['include']?_['map'](_0x1b9dd2[_0x00fa('0x1b')],function(_0x3796ea){return{'model':db[_0x3796ea['model']],'as':_0x3796ea['as'],'attributes':_0x3796ea['attributes']};}):[]};}):[]};}):[]:[]})[_0x00fa('0xd')](function(_0x50af5a){logger['info']('GetFreshdeskAccount',_0x490f03);logger[_0x00fa('0x11')](_0x00fa('0x1f'),_0x490f03,JSON[_0x00fa('0x20')](_0x50af5a));_0xe9c997(_0x50af5a);})['catch'](function(_0x30b2ba){logger[_0x00fa('0x13')](_0x00fa('0x1f'),_0x30b2ba['message'],_0x490f03);_0x92a932(_0x1dcd82[_0x00fa('0x13')](0x1f4,_0x30b2ba['message']));});});};exports['ShowFreshdeskAccount']=function(_0x58415b){var _0x931d7d=this;return new Promise(function(_0x245f33,_0x18f9d2){return db[_0x00fa('0x17')][_0x00fa('0x21')]({'raw':_0x58415b[_0x00fa('0x19')]?_0x58415b[_0x00fa('0x19')][_0x00fa('0x22')]===undefined?!![]:![]:!![],'where':_0x58415b[_0x00fa('0x19')]?_0x58415b[_0x00fa('0x19')]['where']||null:null,'attributes':_0x58415b[_0x00fa('0x19')]?_0x58415b['options'][_0x00fa('0x1e')]||null:null,'include':_0x58415b[_0x00fa('0x19')]?_0x58415b['options'][_0x00fa('0x1b')]?_[_0x00fa('0x1c')](_0x58415b[_0x00fa('0x19')][_0x00fa('0x1b')],function(_0x1f0a89){return{'model':db[_0x1f0a89[_0x00fa('0x1d')]],'as':_0x1f0a89['as'],'attributes':_0x1f0a89[_0x00fa('0x1e')],'include':_0x1f0a89['include']?_[_0x00fa('0x1c')](_0x1f0a89[_0x00fa('0x1b')],function(_0x31b7be){return{'model':db[_0x31b7be[_0x00fa('0x1d')]],'as':_0x31b7be['as'],'attributes':_0x31b7be[_0x00fa('0x1e')],'include':_0x31b7be['include']?_[_0x00fa('0x1c')](_0x31b7be[_0x00fa('0x1b')],function(_0x2bca21){return{'model':db[_0x2bca21['model']],'as':_0x2bca21['as'],'attributes':_0x2bca21['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xee35ed){logger[_0x00fa('0xe')](_0x00fa('0x23'),_0x58415b);logger[_0x00fa('0x11')](_0x00fa('0x23'),_0x58415b,JSON['stringify'](_0xee35ed));_0x245f33(_0xee35ed);})[_0x00fa('0x24')](function(_0x571871){logger[_0x00fa('0x13')](_0x00fa('0x23'),_0x571871['message'],_0x58415b);_0x18f9d2(_0x931d7d[_0x00fa('0x13')](0x1f4,_0x571871[_0x00fa('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7ddb37c..a687f16 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 _0xdd59=['/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5e70c9,_0x20238b){var _0x422dc6=function(_0x330fb9){while(--_0x330fb9){_0x5e70c9['push'](_0x5e70c9['shift']());}};_0x422dc6(++_0x20238b);}(_0xdd59,0xa3));var _0x9dd5=function(_0x1fe346,_0x137578){_0x1fe346=_0x1fe346-0x0;var _0x2e2415=_0xdd59[_0x1fe346];return _0x2e2415;};'use strict';var multer=require(_0x9dd5('0x0'));var util=require(_0x9dd5('0x1'));var path=require(_0x9dd5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9dd5('0x3')]();var auth=require(_0x9dd5('0x4'));var interaction=require(_0x9dd5('0x5'));var config=require(_0x9dd5('0x6'));var controller=require(_0x9dd5('0x7'));router[_0x9dd5('0x8')]('/',auth[_0x9dd5('0x9')](),controller[_0x9dd5('0xa')]);router[_0x9dd5('0x8')](_0x9dd5('0xb'),auth[_0x9dd5('0x9')](),controller['show']);router[_0x9dd5('0x8')](_0x9dd5('0xc'),auth[_0x9dd5('0x9')](),controller[_0x9dd5('0xd')]);router[_0x9dd5('0x8')](_0x9dd5('0xe'),auth[_0x9dd5('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x9dd5('0x9')](),controller[_0x9dd5('0xf')]);router[_0x9dd5('0x8')](_0x9dd5('0x10'),auth[_0x9dd5('0x9')](),controller[_0x9dd5('0x11')]);router['post']('/',auth[_0x9dd5('0x9')](),controller['create']);router[_0x9dd5('0x12')]('/:id/tags',auth[_0x9dd5('0x9')](),controller[_0x9dd5('0x13')]);router[_0x9dd5('0x14')](_0x9dd5('0xb'),auth[_0x9dd5('0x9')](),controller[_0x9dd5('0x15')]);router[_0x9dd5('0x16')](_0x9dd5('0xb'),auth[_0x9dd5('0x9')](),controller[_0x9dd5('0x17')]);module[_0x9dd5('0x18')]=router; \ No newline at end of file +var _0xb8be=['put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0xb8be,0x1f3));var _0xeb8b=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0xb8be[_0x1488cd];return _0x63fa13;};'use strict';var multer=require(_0xeb8b('0x0'));var util=require(_0xeb8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeb8b('0x2'));var router=express[_0xeb8b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xeb8b('0x4'));var config=require(_0xeb8b('0x5'));var controller=require(_0xeb8b('0x6'));router[_0xeb8b('0x7')]('/',auth[_0xeb8b('0x8')](),controller[_0xeb8b('0x9')]);router['get'](_0xeb8b('0xa'),auth[_0xeb8b('0x8')](),controller[_0xeb8b('0xb')]);router[_0xeb8b('0x7')](_0xeb8b('0xc'),auth[_0xeb8b('0x8')](),controller[_0xeb8b('0xd')]);router[_0xeb8b('0x7')](_0xeb8b('0xe'),auth['isAuthenticated'](),controller[_0xeb8b('0xf')]);router[_0xeb8b('0x7')](_0xeb8b('0x10'),auth['isAuthenticated'](),controller[_0xeb8b('0x11')]);router[_0xeb8b('0x7')](_0xeb8b('0x12'),auth[_0xeb8b('0x8')](),controller[_0xeb8b('0x13')]);router[_0xeb8b('0x14')]('/',auth[_0xeb8b('0x8')](),controller['create']);router[_0xeb8b('0x14')](_0xeb8b('0x12'),auth[_0xeb8b('0x8')](),controller['setTags']);router[_0xeb8b('0x15')](_0xeb8b('0xa'),auth[_0xeb8b('0x8')](),controller[_0xeb8b('0x16')]);router[_0xeb8b('0x17')](_0xeb8b('0xa'),auth[_0xeb8b('0x8')](),controller[_0xeb8b('0x18')]);module[_0xeb8b('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 19cac63..2940de8 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 _0xf064=['sequelize','exports','STRING'];(function(_0xe77b5d,_0x2a6f59){var _0x111ba2=function(_0x514163){while(--_0x514163){_0xe77b5d['push'](_0xe77b5d['shift']());}};_0x111ba2(++_0x2a6f59);}(_0xf064,0x144));var _0x4f06=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0xf064[_0x2181fc];return _0x315da1;};'use strict';var Sequelize=require(_0x4f06('0x0'));module[_0x4f06('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4f06('0x2')]}}; \ No newline at end of file +var _0x016f=['STRING','sequelize','exports'];(function(_0x4f6f44,_0x545a2b){var _0x4c0d29=function(_0x1d2d7f){while(--_0x1d2d7f){_0x4f6f44['push'](_0x4f6f44['shift']());}};_0x4c0d29(++_0x545a2b);}(_0x016f,0xe5));var _0xf016=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x016f[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0xf016('0x0'));module[_0xf016('0x1')]={'name':{'type':Sequelize[_0xf016('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e6d1ce8..4e573c1 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 _0x43fd=['catch','show','length','create','body','find','params','getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','request\x20sent','debug','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','info','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','keys','intersection','attributes','fields','query','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','FreshdeskConfiguration','includeAll','include','findAll','rows'];(function(_0x5dc7bb,_0x3c2edc){var _0x3569c3=function(_0x13eb1d){while(--_0x13eb1d){_0x5dc7bb['push'](_0x5dc7bb['shift']());}};_0x3569c3(++_0x3c2edc);}(_0x43fd,0x1ec));var _0xd43f=function(_0x830bff,_0x1c0595){_0x830bff=_0x830bff-0x0;var _0x51ad06=_0x43fd[_0x830bff];return _0x51ad06;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd43f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd43f('0x1'));var rp=require(_0xd43f('0x2'));var moment=require('moment');var BPromise=require(_0xd43f('0x3'));var Mustache=require('mustache');var util=require(_0xd43f('0x4'));var path=require(_0xd43f('0x5'));var sox=require(_0xd43f('0x6'));var csv=require(_0xd43f('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd43f('0x8'));var squel=require(_0xd43f('0x9'));var crypto=require(_0xd43f('0xa'));var jsforce=require(_0xd43f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd43f('0x7'));var querystring=require(_0xd43f('0xc'));var Papa=require('papaparse');var Redis=require(_0xd43f('0xd'));var authService=require(_0xd43f('0xe'));var qs=require(_0xd43f('0xf'));var as=require(_0xd43f('0x10'));var hardwareService=require(_0xd43f('0x11'));var logger=require('../../config/logger')(_0xd43f('0x12'));var utils=require(_0xd43f('0x13'));var config=require(_0xd43f('0x14'));var db=require(_0xd43f('0x15'))['db'];var jayson=require(_0xd43f('0x16'));var client=jayson[_0xd43f('0x17')][_0xd43f('0x18')]({'port':0x232a});function checkPasswordPattern(_0x1a72f1,_0x2b4549,_0x1bed70){if(_0x1bed70){var _0x1eba90=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1eba90['test'](_0x2b4549)){return _0x1a72f1;}else{throw new db[(_0xd43f('0x19'))][(_0xd43f('0x1a'))](_0xd43f('0x1b'));}}else{return _0x1a72f1;}}function respondWithRpcPromise(_0x5802f2,_0x4c576e,_0x4a2b49,_0x1c729a){return new BPromise(function(_0x3ca2d4,_0x4f8862){var _0x3c0953=_0x1c729a||client;return _0x3c0953[_0xd43f('0x1c')](_0x5802f2,_0x4a2b49)['then'](function(_0x5ced70){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4c576e,_0xd43f('0x1d'));logger[_0xd43f('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4c576e,_0xd43f('0x1d'),JSON[_0xd43f('0x1f')](_0x5ced70));if(_0x5ced70[_0xd43f('0x20')]){if(_0x5ced70[_0xd43f('0x20')]['code']===0x1f4){logger[_0xd43f('0x20')](_0xd43f('0x21'),_0x4c576e,_0x5ced70[_0xd43f('0x20')]['message']);return _0x4f8862(_0x5ced70['error']['message']);}logger[_0xd43f('0x20')](_0xd43f('0x21'),_0x4c576e,_0x5ced70[_0xd43f('0x20')][_0xd43f('0x22')]);return _0x3ca2d4(_0x5ced70[_0xd43f('0x20')][_0xd43f('0x22')]);}else{logger[_0xd43f('0x23')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4c576e,_0xd43f('0x1d'));_0x3ca2d4(_0x5ced70['result'][_0xd43f('0x22')]);}})['catch'](function(_0x5ab88f){logger[_0xd43f('0x20')](_0xd43f('0x21'),_0x4c576e,_0x5ab88f);_0x4f8862(_0x5ab88f);});});}function respondWithStatusCode(_0x2a9ce4,_0x2a38f6){_0x2a38f6=_0x2a38f6||0xcc;return function(_0x35acd0){if(_0x35acd0){return _0x2a9ce4[_0xd43f('0x24')](_0x2a38f6);}return _0x2a9ce4[_0xd43f('0x25')](_0x2a38f6)[_0xd43f('0x26')]();};}function respondWithResult(_0x2dcbf2,_0x49d043){_0x49d043=_0x49d043||0xc8;return function(_0x26a6c9){if(_0x26a6c9){return _0x2dcbf2[_0xd43f('0x25')](_0x49d043)[_0xd43f('0x27')](_0x26a6c9);}};}function respondWithFilteredResult(_0x2d54a7,_0x209ccd){return function(_0x4a8b4d){if(_0x4a8b4d){var _0x161540=_0x4a8b4d[_0xd43f('0x28')],_0x7b6761=_0x209ccd[_0xd43f('0x29')],_0x285b86=_0x209ccd['offset']+_0x209ccd[_0xd43f('0x2a')],_0x1dd81f;if(_0x285b86>=_0x161540){_0x285b86=_0x161540;_0x1dd81f=0xc8;}else{_0x1dd81f=0xce;}_0x2d54a7[_0xd43f('0x25')](_0x1dd81f);return _0x2d54a7['set'](_0xd43f('0x2b'),_0x7b6761+'-'+_0x285b86+'/'+_0x161540)['json'](_0x4a8b4d);}return null;};}function patchUpdates(_0x53aae7){return function(_0x45e84a){try{jsonpatch[_0xd43f('0x2c')](_0x45e84a,_0x53aae7,!![]);}catch(_0x29e123){return BPromise['reject'](_0x29e123);}return _0x45e84a[_0xd43f('0x2d')]();};}function saveUpdates(_0x23c4f7,_0x5bba3d){return function(_0x557a96){if(_0x557a96){return _0x557a96[_0xd43f('0x2e')](_0x23c4f7)[_0xd43f('0x2f')](function(_0xb9e156){return _0xb9e156;});}return null;};}function removeEntity(_0x202a05,_0x49ff92){return function(_0x2bfdea){if(_0x2bfdea){return _0x2bfdea[_0xd43f('0x30')]()[_0xd43f('0x2f')](function(){_0x202a05[_0xd43f('0x25')](0xcc)[_0xd43f('0x26')]();});}};}function handleEntityNotFound(_0x2461bc,_0x434b36){return function(_0x5c407c){if(!_0x5c407c){_0x2461bc[_0xd43f('0x24')](0x194);}return _0x5c407c;};}function handleError(_0x57ac0f,_0xd75865){_0xd75865=_0xd75865||0x1f4;return function(_0x645677){logger[_0xd43f('0x20')](_0x645677['stack']);if(_0x645677[_0xd43f('0x31')]){delete _0x645677[_0xd43f('0x31')];}_0x57ac0f['status'](_0xd75865)[_0xd43f('0x32')](_0x645677);};}exports[_0xd43f('0x33')]=function(_0x16c1f6,_0x4ed4eb){var _0x291f05={},_0x13f996={},_0x1c0d7f={'count':0x0,'rows':[]};var _0x20682d=_[_0xd43f('0x34')](db['FreshdeskConfiguration'][_0xd43f('0x35')],function(_0x4b1c73){return{'name':_0x4b1c73[_0xd43f('0x36')],'type':_0x4b1c73[_0xd43f('0x37')][_0xd43f('0x38')]};});_0x13f996['model']=_[_0xd43f('0x34')](_0x20682d,_0xd43f('0x31'));_0x13f996['query']=_[_0xd43f('0x39')](_0x16c1f6['query']);_0x13f996['filters']=_[_0xd43f('0x3a')](_0x13f996['model'],_0x13f996['query']);_0x291f05[_0xd43f('0x3b')]=_['intersection'](_0x13f996['model'],qs[_0xd43f('0x3c')](_0x16c1f6[_0xd43f('0x3d')][_0xd43f('0x3c')]));_0x291f05[_0xd43f('0x3b')]=_0x291f05[_0xd43f('0x3b')]['length']?_0x291f05[_0xd43f('0x3b')]:_0x13f996[_0xd43f('0x3e')];if(!_0x16c1f6[_0xd43f('0x3d')][_0xd43f('0x3f')](_0xd43f('0x40'))){_0x291f05[_0xd43f('0x2a')]=qs[_0xd43f('0x2a')](_0x16c1f6[_0xd43f('0x3d')][_0xd43f('0x2a')]);_0x291f05[_0xd43f('0x29')]=qs[_0xd43f('0x29')](_0x16c1f6['query'][_0xd43f('0x29')]);}_0x291f05[_0xd43f('0x41')]=qs['sort'](_0x16c1f6['query'][_0xd43f('0x42')]);_0x291f05[_0xd43f('0x43')]=qs[_0xd43f('0x44')](_['pick'](_0x16c1f6[_0xd43f('0x3d')],_0x13f996[_0xd43f('0x44')]),_0x20682d);if(_0x16c1f6[_0xd43f('0x3d')][_0xd43f('0x45')]){_0x291f05['where']=_['merge'](_0x291f05[_0xd43f('0x43')],{'$or':_[_0xd43f('0x34')](_0x20682d,function(_0x156e8a){if(_0x156e8a['type']!==_0xd43f('0x46')){var _0x710b1e={};_0x710b1e[_0x156e8a[_0xd43f('0x31')]]={'$like':'%'+_0x16c1f6[_0xd43f('0x3d')][_0xd43f('0x45')]+'%'};return _0x710b1e;}})});}_0x291f05=_[_0xd43f('0x47')]({},_0x291f05,_0x16c1f6[_0xd43f('0x48')]);var _0xadbc59={'where':_0x291f05['where']};return db[_0xd43f('0x49')][_0xd43f('0x28')](_0xadbc59)[_0xd43f('0x2f')](function(_0x400273){_0x1c0d7f[_0xd43f('0x28')]=_0x400273;if(_0x16c1f6[_0xd43f('0x3d')][_0xd43f('0x4a')]){_0x291f05[_0xd43f('0x4b')]=[{'all':!![]}];}return db[_0xd43f('0x49')][_0xd43f('0x4c')](_0x291f05);})[_0xd43f('0x2f')](function(_0x517509){_0x1c0d7f[_0xd43f('0x4d')]=_0x517509;return _0x1c0d7f;})[_0xd43f('0x2f')](respondWithFilteredResult(_0x4ed4eb,_0x291f05))[_0xd43f('0x4e')](handleError(_0x4ed4eb,null));};exports[_0xd43f('0x4f')]=function(_0x45207d,_0x4763b7){var _0x54eaa2={'raw':![],'where':{'id':_0x45207d['params']['id']}},_0x9e1727={};_0x9e1727[_0xd43f('0x3e')]=_['keys'](db[_0xd43f('0x49')][_0xd43f('0x35')]);_0x9e1727[_0xd43f('0x3d')]=_[_0xd43f('0x39')](_0x45207d[_0xd43f('0x3d')]);_0x9e1727[_0xd43f('0x44')]=_[_0xd43f('0x3a')](_0x9e1727[_0xd43f('0x3e')],_0x9e1727[_0xd43f('0x3d')]);_0x54eaa2['attributes']=_[_0xd43f('0x3a')](_0x9e1727[_0xd43f('0x3e')],qs[_0xd43f('0x3c')](_0x45207d[_0xd43f('0x3d')][_0xd43f('0x3c')]));_0x54eaa2[_0xd43f('0x3b')]=_0x54eaa2[_0xd43f('0x3b')][_0xd43f('0x50')]?_0x54eaa2[_0xd43f('0x3b')]:_0x9e1727[_0xd43f('0x3e')];if(_0x45207d[_0xd43f('0x3d')]['includeAll']){_0x54eaa2['include']=[{'all':!![]}];}_0x54eaa2=_[_0xd43f('0x47')]({},_0x54eaa2,_0x45207d[_0xd43f('0x48')]);return db[_0xd43f('0x49')]['find'](_0x54eaa2)['then'](handleEntityNotFound(_0x4763b7,null))[_0xd43f('0x2f')](respondWithResult(_0x4763b7,null))[_0xd43f('0x4e')](handleError(_0x4763b7,null));};exports[_0xd43f('0x51')]=function(_0x20e2e6,_0x1221b0){return db['FreshdeskConfiguration'][_0xd43f('0x51')](_0x20e2e6[_0xd43f('0x52')],{})[_0xd43f('0x2f')](respondWithResult(_0x1221b0,0xc9))[_0xd43f('0x4e')](handleError(_0x1221b0,null));};exports[_0xd43f('0x2e')]=function(_0x39f640,_0x481977){if(_0x39f640[_0xd43f('0x52')]['id']){delete _0x39f640[_0xd43f('0x52')]['id'];}return db[_0xd43f('0x49')][_0xd43f('0x53')]({'where':{'id':_0x39f640[_0xd43f('0x54')]['id']}})[_0xd43f('0x2f')](handleEntityNotFound(_0x481977,null))[_0xd43f('0x2f')](saveUpdates(_0x39f640[_0xd43f('0x52')],null))['then'](respondWithResult(_0x481977,null))[_0xd43f('0x4e')](handleError(_0x481977,null));};exports[_0xd43f('0x30')]=function(_0x60a5d2,_0x5c5a8a){return db[_0xd43f('0x49')][_0xd43f('0x53')]({'where':{'id':_0x60a5d2[_0xd43f('0x54')]['id']}})[_0xd43f('0x2f')](handleEntityNotFound(_0x5c5a8a,null))[_0xd43f('0x2f')](removeEntity(_0x5c5a8a,null))[_0xd43f('0x4e')](handleError(_0x5c5a8a,null));};exports[_0xd43f('0x55')]=function(_0x32590d,_0x1c1fd5,_0x418af0){var _0x4ca871={};var _0x1398ef={};var _0x340d13;var _0x52ac79;return db[_0xd43f('0x49')][_0xd43f('0x56')]({'where':{'id':_0x32590d[_0xd43f('0x54')]['id']}})['then'](handleEntityNotFound(_0x1c1fd5,null))[_0xd43f('0x2f')](function(_0x598609){if(_0x598609){_0x340d13=_0x598609;_0x1398ef[_0xd43f('0x3e')]=_['keys'](db[_0xd43f('0x57')]['rawAttributes']);_0x1398ef[_0xd43f('0x3d')]=_[_0xd43f('0x39')](_0x32590d[_0xd43f('0x3d')]);_0x1398ef['filters']=_['intersection'](_0x1398ef[_0xd43f('0x3e')],_0x1398ef[_0xd43f('0x3d')]);_0x4ca871['attributes']=_[_0xd43f('0x3a')](_0x1398ef[_0xd43f('0x3e')],qs['fields'](_0x32590d[_0xd43f('0x3d')][_0xd43f('0x3c')]));_0x4ca871[_0xd43f('0x3b')]=_0x4ca871[_0xd43f('0x3b')][_0xd43f('0x50')]?_0x4ca871[_0xd43f('0x3b')]:_0x1398ef[_0xd43f('0x3e')];_0x4ca871['order']=qs[_0xd43f('0x42')](_0x32590d[_0xd43f('0x3d')][_0xd43f('0x42')]);_0x4ca871[_0xd43f('0x43')]=qs[_0xd43f('0x44')](_[_0xd43f('0x58')](_0x32590d[_0xd43f('0x3d')],_0x1398ef['filters']));if(_0x32590d[_0xd43f('0x3d')][_0xd43f('0x45')]){_0x4ca871['where']=_[_0xd43f('0x47')](_0x4ca871[_0xd43f('0x43')],{'$or':_[_0xd43f('0x34')](_0x4ca871[_0xd43f('0x3b')],function(_0x2e87fa){var _0xd40a7b={};_0xd40a7b[_0x2e87fa]={'$like':'%'+_0x32590d[_0xd43f('0x3d')]['filter']+'%'};return _0xd40a7b;})});}_0x4ca871=_[_0xd43f('0x47')]({},_0x4ca871,_0x32590d[_0xd43f('0x48')]);return _0x340d13['getFields'](_0x4ca871);}})[_0xd43f('0x2f')](function(_0x5108e0){if(_0x5108e0){_0x52ac79=_0x5108e0[_0xd43f('0x50')];if(!_0x32590d[_0xd43f('0x3d')][_0xd43f('0x3f')](_0xd43f('0x40'))){_0x4ca871[_0xd43f('0x2a')]=qs[_0xd43f('0x2a')](_0x32590d[_0xd43f('0x3d')][_0xd43f('0x2a')]);_0x4ca871[_0xd43f('0x29')]=qs[_0xd43f('0x29')](_0x32590d[_0xd43f('0x3d')][_0xd43f('0x29')]);}return _0x340d13[_0xd43f('0x55')](_0x4ca871);}})[_0xd43f('0x2f')](function(_0x53b22b){if(_0x53b22b){return _0x53b22b?{'count':_0x52ac79,'rows':_0x53b22b}:null;}})[_0xd43f('0x2f')](respondWithResult(_0x1c1fd5,null))[_0xd43f('0x4e')](handleError(_0x1c1fd5,null));};exports[_0xd43f('0x59')]=function(_0x4ec758,_0x3a4086,_0x5211ee){var _0x16a2bf={};var _0xa317f2={};var _0x2096eb;var _0x3af7db;return db['FreshdeskConfiguration'][_0xd43f('0x56')]({'where':{'id':_0x4ec758[_0xd43f('0x54')]['id']}})[_0xd43f('0x2f')](handleEntityNotFound(_0x3a4086,null))['then'](function(_0x321cea){if(_0x321cea){_0x2096eb=_0x321cea;_0xa317f2['model']=_[_0xd43f('0x39')](db[_0xd43f('0x57')][_0xd43f('0x35')]);_0xa317f2[_0xd43f('0x3d')]=_['keys'](_0x4ec758[_0xd43f('0x3d')]);_0xa317f2['filters']=_[_0xd43f('0x3a')](_0xa317f2['model'],_0xa317f2[_0xd43f('0x3d')]);_0x16a2bf[_0xd43f('0x3b')]=_['intersection'](_0xa317f2[_0xd43f('0x3e')],qs[_0xd43f('0x3c')](_0x4ec758[_0xd43f('0x3d')][_0xd43f('0x3c')]));_0x16a2bf['attributes']=_0x16a2bf[_0xd43f('0x3b')][_0xd43f('0x50')]?_0x16a2bf[_0xd43f('0x3b')]:_0xa317f2[_0xd43f('0x3e')];_0x16a2bf['order']=qs[_0xd43f('0x42')](_0x4ec758[_0xd43f('0x3d')]['sort']);_0x16a2bf['where']=qs[_0xd43f('0x44')](_[_0xd43f('0x58')](_0x4ec758[_0xd43f('0x3d')],_0xa317f2['filters']));if(_0x4ec758[_0xd43f('0x3d')]['filter']){_0x16a2bf[_0xd43f('0x43')]=_[_0xd43f('0x47')](_0x16a2bf['where'],{'$or':_[_0xd43f('0x34')](_0x16a2bf[_0xd43f('0x3b')],function(_0x2d6b29){var _0x4564ed={};_0x4564ed[_0x2d6b29]={'$like':'%'+_0x4ec758[_0xd43f('0x3d')][_0xd43f('0x45')]+'%'};return _0x4564ed;})});}_0x16a2bf=_[_0xd43f('0x47')]({},_0x16a2bf,_0x4ec758[_0xd43f('0x48')]);return _0x2096eb[_0xd43f('0x59')](_0x16a2bf);}})[_0xd43f('0x2f')](function(_0x3703b5){if(_0x3703b5){_0x3af7db=_0x3703b5['length'];if(!_0x4ec758[_0xd43f('0x3d')]['hasOwnProperty'](_0xd43f('0x40'))){_0x16a2bf[_0xd43f('0x2a')]=qs[_0xd43f('0x2a')](_0x4ec758[_0xd43f('0x3d')]['limit']);_0x16a2bf['offset']=qs[_0xd43f('0x29')](_0x4ec758[_0xd43f('0x3d')]['offset']);}return _0x2096eb[_0xd43f('0x59')](_0x16a2bf);}})[_0xd43f('0x2f')](function(_0x3a5420){if(_0x3a5420){return _0x3a5420?{'count':_0x3af7db,'rows':_0x3a5420}:null;}})[_0xd43f('0x2f')](respondWithResult(_0x3a4086,null))[_0xd43f('0x4e')](handleError(_0x3a4086,null));};exports[_0xd43f('0x5a')]=function(_0x49a6b4,_0x6149b4,_0x37f6af){var _0xb888eb={};var _0x1c97c3={};var _0x282b84;var _0x21efee;return db[_0xd43f('0x49')][_0xd43f('0x56')]({'where':{'id':_0x49a6b4[_0xd43f('0x54')]['id']}})['then'](handleEntityNotFound(_0x6149b4,null))['then'](function(_0x40e75c){if(_0x40e75c){_0x282b84=_0x40e75c;_0x1c97c3[_0xd43f('0x3e')]=_['keys'](db[_0xd43f('0x57')][_0xd43f('0x35')]);_0x1c97c3['query']=_[_0xd43f('0x39')](_0x49a6b4[_0xd43f('0x3d')]);_0x1c97c3[_0xd43f('0x44')]=_['intersection'](_0x1c97c3['model'],_0x1c97c3[_0xd43f('0x3d')]);_0xb888eb[_0xd43f('0x3b')]=_[_0xd43f('0x3a')](_0x1c97c3[_0xd43f('0x3e')],qs[_0xd43f('0x3c')](_0x49a6b4[_0xd43f('0x3d')][_0xd43f('0x3c')]));_0xb888eb[_0xd43f('0x3b')]=_0xb888eb[_0xd43f('0x3b')][_0xd43f('0x50')]?_0xb888eb[_0xd43f('0x3b')]:_0x1c97c3[_0xd43f('0x3e')];_0xb888eb['order']=qs[_0xd43f('0x42')](_0x49a6b4[_0xd43f('0x3d')][_0xd43f('0x42')]);_0xb888eb[_0xd43f('0x43')]=qs[_0xd43f('0x44')](_[_0xd43f('0x58')](_0x49a6b4[_0xd43f('0x3d')],_0x1c97c3['filters']));if(_0x49a6b4[_0xd43f('0x3d')][_0xd43f('0x45')]){_0xb888eb[_0xd43f('0x43')]=_[_0xd43f('0x47')](_0xb888eb['where'],{'$or':_[_0xd43f('0x34')](_0xb888eb[_0xd43f('0x3b')],function(_0x37474c){var _0x13dd7f={};_0x13dd7f[_0x37474c]={'$like':'%'+_0x49a6b4[_0xd43f('0x3d')][_0xd43f('0x45')]+'%'};return _0x13dd7f;})});}_0xb888eb=_[_0xd43f('0x47')]({},_0xb888eb,_0x49a6b4[_0xd43f('0x48')]);return _0x282b84[_0xd43f('0x5a')](_0xb888eb);}})['then'](function(_0xd253bd){if(_0xd253bd){_0x21efee=_0xd253bd['length'];if(!_0x49a6b4[_0xd43f('0x3d')][_0xd43f('0x3f')](_0xd43f('0x40'))){_0xb888eb[_0xd43f('0x2a')]=qs['limit'](_0x49a6b4[_0xd43f('0x3d')][_0xd43f('0x2a')]);_0xb888eb['offset']=qs[_0xd43f('0x29')](_0x49a6b4[_0xd43f('0x3d')][_0xd43f('0x29')]);}return _0x282b84[_0xd43f('0x5a')](_0xb888eb);}})[_0xd43f('0x2f')](function(_0x1174a8){if(_0x1174a8){return _0x1174a8?{'count':_0x21efee,'rows':_0x1174a8}:null;}})['then'](respondWithResult(_0x6149b4,null))['catch'](handleError(_0x6149b4,null));};exports['getTags']=function(_0x40d6d3,_0x542ded,_0x10187c){var _0x569e74={};var _0x24fc08={};var _0x4fb4c5;var _0x16f95d;return db[_0xd43f('0x49')][_0xd43f('0x56')]({'where':{'id':_0x40d6d3[_0xd43f('0x54')]['id']}})[_0xd43f('0x2f')](handleEntityNotFound(_0x542ded,null))[_0xd43f('0x2f')](function(_0x17115b){if(_0x17115b){_0x4fb4c5=_0x17115b;_0x24fc08[_0xd43f('0x3e')]=_[_0xd43f('0x39')](db[_0xd43f('0x5b')][_0xd43f('0x35')]);_0x24fc08['query']=_[_0xd43f('0x39')](_0x40d6d3[_0xd43f('0x3d')]);_0x24fc08[_0xd43f('0x44')]=_[_0xd43f('0x3a')](_0x24fc08[_0xd43f('0x3e')],_0x24fc08['query']);_0x569e74[_0xd43f('0x3b')]=_[_0xd43f('0x3a')](_0x24fc08[_0xd43f('0x3e')],qs[_0xd43f('0x3c')](_0x40d6d3[_0xd43f('0x3d')][_0xd43f('0x3c')]));_0x569e74[_0xd43f('0x3b')]=_0x569e74['attributes']['length']?_0x569e74[_0xd43f('0x3b')]:_0x24fc08[_0xd43f('0x3e')];_0x569e74[_0xd43f('0x41')]=qs[_0xd43f('0x42')](_0x40d6d3['query']['sort']);_0x569e74['where']=qs['filters'](_[_0xd43f('0x58')](_0x40d6d3[_0xd43f('0x3d')],_0x24fc08[_0xd43f('0x44')]));if(_0x40d6d3[_0xd43f('0x3d')][_0xd43f('0x45')]){_0x569e74[_0xd43f('0x43')]=_['merge'](_0x569e74[_0xd43f('0x43')],{'$or':_[_0xd43f('0x34')](_0x569e74['attributes'],function(_0x4d93ba){var _0x557c13={};_0x557c13[_0x4d93ba]={'$like':'%'+_0x40d6d3[_0xd43f('0x3d')][_0xd43f('0x45')]+'%'};return _0x557c13;})});}_0x569e74=_['merge']({},_0x569e74,_0x40d6d3[_0xd43f('0x48')]);return _0x4fb4c5['getTags'](_0x569e74);}})[_0xd43f('0x2f')](function(_0x4c975e){if(_0x4c975e){_0x16f95d=_0x4c975e[_0xd43f('0x50')];if(!_0x40d6d3[_0xd43f('0x3d')]['hasOwnProperty'](_0xd43f('0x40'))){_0x569e74[_0xd43f('0x2a')]=qs[_0xd43f('0x2a')](_0x40d6d3['query']['limit']);_0x569e74[_0xd43f('0x29')]=qs['offset'](_0x40d6d3[_0xd43f('0x3d')][_0xd43f('0x29')]);}return _0x4fb4c5[_0xd43f('0x5c')](_0x569e74);}})[_0xd43f('0x2f')](function(_0x136422){if(_0x136422){return _0x136422?{'count':_0x16f95d,'rows':_0x136422}:null;}})['then'](respondWithResult(_0x542ded,null))[_0xd43f('0x4e')](handleError(_0x542ded,null));};exports['setTags']=function(_0x3dfe5b,_0x3bd29e,_0x547185){if(_0x3dfe5b[_0xd43f('0x52')]['id']){delete _0x3dfe5b[_0xd43f('0x52')]['id'];}return db['FreshdeskConfiguration'][_0xd43f('0x56')]({'where':{'id':_0x3dfe5b['params']['id']}})[_0xd43f('0x2f')](handleEntityNotFound(_0x3bd29e,null))[_0xd43f('0x2f')](function(_0x4a99c4){if(_0x4a99c4){return _0x4a99c4[_0xd43f('0x5d')](_0x3dfe5b[_0xd43f('0x52')][_0xd43f('0x5e')]||[]);}return null;})[_0xd43f('0x2f')](respondWithResult(_0x3bd29e,null))[_0xd43f('0x4e')](handleError(_0x3bd29e,null));}; \ No newline at end of file +var _0xaf3e=['options','find','create','body','getFields','findOne','FreshdeskField','length','nolimit','getDescriptions','getTags','Tag','ids','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','params'];(function(_0x415183,_0xedf18f){var _0x23678f=function(_0x196729){while(--_0x196729){_0x415183['push'](_0x415183['shift']());}};_0x23678f(++_0xedf18f);}(_0xaf3e,0xcf));var _0xeaf3=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xaf3e[_0x4ea413];return _0x51cf25;};'use strict';var pdf=require(_0xeaf3('0x0'));var emlformat=require(_0xeaf3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeaf3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeaf3('0x3'));var moment=require(_0xeaf3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeaf3('0x5'));var util=require(_0xeaf3('0x6'));var path=require(_0xeaf3('0x7'));var sox=require(_0xeaf3('0x8'));var csv=require(_0xeaf3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeaf3('0xa'));var squel=require(_0xeaf3('0xb'));var crypto=require(_0xeaf3('0xc'));var jsforce=require(_0xeaf3('0xd'));var deskjs=require(_0xeaf3('0xe'));var toCsv=require(_0xeaf3('0x9'));var querystring=require('querystring');var Papa=require(_0xeaf3('0xf'));var Redis=require('ioredis');var authService=require(_0xeaf3('0x10'));var qs=require(_0xeaf3('0x11'));var as=require(_0xeaf3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaf3('0x13'))(_0xeaf3('0x14'));var utils=require('../../config/utils');var config=require(_0xeaf3('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xeaf3('0x16'));var client=jayson[_0xeaf3('0x17')][_0xeaf3('0x18')]({'port':0x232a});function checkPasswordPattern(_0x203902,_0x5349bf,_0x470165){if(_0x470165){var _0x105c7e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x105c7e[_0xeaf3('0x19')](_0x5349bf)){return _0x203902;}else{throw new db[(_0xeaf3('0x1a'))]['ValidationError'](_0xeaf3('0x1b'));}}else{return _0x203902;}}function respondWithRpcPromise(_0x551b2c,_0x156f63,_0x5468f2,_0x568b43){return new BPromise(function(_0xf647fd,_0x1ae7c3){var _0xf5baba=_0x568b43||client;return _0xf5baba[_0xeaf3('0x1c')](_0x551b2c,_0x5468f2)[_0xeaf3('0x1d')](function(_0x8a8a04){logger['info'](_0xeaf3('0x1e'),_0x156f63,'request\x20sent');logger[_0xeaf3('0x1f')](_0xeaf3('0x20'),_0x156f63,'request\x20sent',JSON[_0xeaf3('0x21')](_0x8a8a04));if(_0x8a8a04[_0xeaf3('0x22')]){if(_0x8a8a04[_0xeaf3('0x22')][_0xeaf3('0x23')]===0x1f4){logger[_0xeaf3('0x22')](_0xeaf3('0x1e'),_0x156f63,_0x8a8a04[_0xeaf3('0x22')][_0xeaf3('0x24')]);return _0x1ae7c3(_0x8a8a04[_0xeaf3('0x22')][_0xeaf3('0x24')]);}logger[_0xeaf3('0x22')](_0xeaf3('0x1e'),_0x156f63,_0x8a8a04[_0xeaf3('0x22')]['message']);return _0xf647fd(_0x8a8a04['error'][_0xeaf3('0x24')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x156f63,_0xeaf3('0x25'));_0xf647fd(_0x8a8a04[_0xeaf3('0x26')][_0xeaf3('0x24')]);}})['catch'](function(_0x5bc55c){logger[_0xeaf3('0x22')](_0xeaf3('0x1e'),_0x156f63,_0x5bc55c);_0x1ae7c3(_0x5bc55c);});});}function respondWithStatusCode(_0x5bedab,_0x1d2377){_0x1d2377=_0x1d2377||0xcc;return function(_0x446056){if(_0x446056){return _0x5bedab[_0xeaf3('0x27')](_0x1d2377);}return _0x5bedab[_0xeaf3('0x28')](_0x1d2377)[_0xeaf3('0x29')]();};}function respondWithResult(_0x179376,_0x5a69d2){_0x5a69d2=_0x5a69d2||0xc8;return function(_0x4de831){if(_0x4de831){return _0x179376[_0xeaf3('0x28')](_0x5a69d2)[_0xeaf3('0x2a')](_0x4de831);}};}function respondWithFilteredResult(_0x2fe525,_0x2f0880){return function(_0x22034b){if(_0x22034b){var _0x29f2e4=_0x22034b['count'],_0x5a0c96=_0x2f0880['offset'],_0x14f689=_0x2f0880[_0xeaf3('0x2b')]+_0x2f0880[_0xeaf3('0x2c')],_0x379cf5;if(_0x14f689>=_0x29f2e4){_0x14f689=_0x29f2e4;_0x379cf5=0xc8;}else{_0x379cf5=0xce;}_0x2fe525[_0xeaf3('0x28')](_0x379cf5);return _0x2fe525[_0xeaf3('0x2d')](_0xeaf3('0x2e'),_0x5a0c96+'-'+_0x14f689+'/'+_0x29f2e4)[_0xeaf3('0x2a')](_0x22034b);}return null;};}function patchUpdates(_0x937b6f){return function(_0x38a81a){try{jsonpatch[_0xeaf3('0x2f')](_0x38a81a,_0x937b6f,!![]);}catch(_0x2489d0){return BPromise[_0xeaf3('0x30')](_0x2489d0);}return _0x38a81a[_0xeaf3('0x31')]();};}function saveUpdates(_0x56d202,_0x15d834){return function(_0x4eec11){if(_0x4eec11){return _0x4eec11[_0xeaf3('0x32')](_0x56d202)[_0xeaf3('0x1d')](function(_0x178de0){return _0x178de0;});}return null;};}function removeEntity(_0x3f6c37,_0x40b430){return function(_0x578ed3){if(_0x578ed3){return _0x578ed3[_0xeaf3('0x33')]()['then'](function(){_0x3f6c37['status'](0xcc)[_0xeaf3('0x29')]();});}};}function handleEntityNotFound(_0x55bf35,_0x5f319c){return function(_0xefa82a){if(!_0xefa82a){_0x55bf35[_0xeaf3('0x27')](0x194);}return _0xefa82a;};}function handleError(_0x21d1cc,_0x1e2f64){_0x1e2f64=_0x1e2f64||0x1f4;return function(_0xda4de2){logger['error'](_0xda4de2[_0xeaf3('0x34')]);if(_0xda4de2[_0xeaf3('0x35')]){delete _0xda4de2[_0xeaf3('0x35')];}_0x21d1cc[_0xeaf3('0x28')](_0x1e2f64)[_0xeaf3('0x36')](_0xda4de2);};}exports[_0xeaf3('0x37')]=function(_0x2c8144,_0x30d353){var _0xc4d4f9={},_0x223142={},_0xe5ca22={'count':0x0,'rows':[]};var _0xee05a=_[_0xeaf3('0x38')](db[_0xeaf3('0x39')][_0xeaf3('0x3a')],function(_0x269f6c){return{'name':_0x269f6c[_0xeaf3('0x3b')],'type':_0x269f6c[_0xeaf3('0x3c')][_0xeaf3('0x3d')]};});_0x223142[_0xeaf3('0x3e')]=_[_0xeaf3('0x38')](_0xee05a,'name');_0x223142[_0xeaf3('0x3f')]=_[_0xeaf3('0x40')](_0x2c8144[_0xeaf3('0x3f')]);_0x223142[_0xeaf3('0x41')]=_[_0xeaf3('0x42')](_0x223142[_0xeaf3('0x3e')],_0x223142['query']);_0xc4d4f9[_0xeaf3('0x43')]=_['intersection'](_0x223142[_0xeaf3('0x3e')],qs[_0xeaf3('0x44')](_0x2c8144['query'][_0xeaf3('0x44')]));_0xc4d4f9[_0xeaf3('0x43')]=_0xc4d4f9[_0xeaf3('0x43')]['length']?_0xc4d4f9['attributes']:_0x223142[_0xeaf3('0x3e')];if(!_0x2c8144[_0xeaf3('0x3f')][_0xeaf3('0x45')]('nolimit')){_0xc4d4f9[_0xeaf3('0x2c')]=qs[_0xeaf3('0x2c')](_0x2c8144['query'][_0xeaf3('0x2c')]);_0xc4d4f9[_0xeaf3('0x2b')]=qs[_0xeaf3('0x2b')](_0x2c8144[_0xeaf3('0x3f')][_0xeaf3('0x2b')]);}_0xc4d4f9[_0xeaf3('0x46')]=qs[_0xeaf3('0x47')](_0x2c8144[_0xeaf3('0x3f')][_0xeaf3('0x47')]);_0xc4d4f9[_0xeaf3('0x48')]=qs[_0xeaf3('0x41')](_[_0xeaf3('0x49')](_0x2c8144[_0xeaf3('0x3f')],_0x223142[_0xeaf3('0x41')]),_0xee05a);if(_0x2c8144[_0xeaf3('0x3f')][_0xeaf3('0x4a')]){_0xc4d4f9[_0xeaf3('0x48')]=_[_0xeaf3('0x4b')](_0xc4d4f9[_0xeaf3('0x48')],{'$or':_[_0xeaf3('0x38')](_0xee05a,function(_0x1cae31){if(_0x1cae31[_0xeaf3('0x3c')]!==_0xeaf3('0x4c')){var _0x3cd057={};_0x3cd057[_0x1cae31['name']]={'$like':'%'+_0x2c8144[_0xeaf3('0x3f')][_0xeaf3('0x4a')]+'%'};return _0x3cd057;}})});}_0xc4d4f9=_['merge']({},_0xc4d4f9,_0x2c8144['options']);var _0x276796={'where':_0xc4d4f9[_0xeaf3('0x48')]};return db[_0xeaf3('0x39')][_0xeaf3('0x4d')](_0x276796)['then'](function(_0x4e5cf3){_0xe5ca22['count']=_0x4e5cf3;if(_0x2c8144[_0xeaf3('0x3f')]['includeAll']){_0xc4d4f9[_0xeaf3('0x4e')]=[{'all':!![]}];}return db[_0xeaf3('0x39')][_0xeaf3('0x4f')](_0xc4d4f9);})[_0xeaf3('0x1d')](function(_0x184d1d){_0xe5ca22[_0xeaf3('0x50')]=_0x184d1d;return _0xe5ca22;})['then'](respondWithFilteredResult(_0x30d353,_0xc4d4f9))[_0xeaf3('0x51')](handleError(_0x30d353,null));};exports[_0xeaf3('0x52')]=function(_0x4e56a7,_0x471b28){var _0x5791b9={'raw':![],'where':{'id':_0x4e56a7[_0xeaf3('0x53')]['id']}},_0x11542b={};_0x11542b['model']=_[_0xeaf3('0x40')](db[_0xeaf3('0x39')][_0xeaf3('0x3a')]);_0x11542b[_0xeaf3('0x3f')]=_[_0xeaf3('0x40')](_0x4e56a7[_0xeaf3('0x3f')]);_0x11542b['filters']=_[_0xeaf3('0x42')](_0x11542b[_0xeaf3('0x3e')],_0x11542b['query']);_0x5791b9[_0xeaf3('0x43')]=_[_0xeaf3('0x42')](_0x11542b['model'],qs[_0xeaf3('0x44')](_0x4e56a7[_0xeaf3('0x3f')][_0xeaf3('0x44')]));_0x5791b9['attributes']=_0x5791b9[_0xeaf3('0x43')]['length']?_0x5791b9[_0xeaf3('0x43')]:_0x11542b[_0xeaf3('0x3e')];if(_0x4e56a7['query']['includeAll']){_0x5791b9['include']=[{'all':!![]}];}_0x5791b9=_['merge']({},_0x5791b9,_0x4e56a7[_0xeaf3('0x54')]);return db[_0xeaf3('0x39')][_0xeaf3('0x55')](_0x5791b9)['then'](handleEntityNotFound(_0x471b28,null))['then'](respondWithResult(_0x471b28,null))[_0xeaf3('0x51')](handleError(_0x471b28,null));};exports[_0xeaf3('0x56')]=function(_0x5309f8,_0x143237){return db[_0xeaf3('0x39')][_0xeaf3('0x56')](_0x5309f8[_0xeaf3('0x57')],{})[_0xeaf3('0x1d')](respondWithResult(_0x143237,0xc9))[_0xeaf3('0x51')](handleError(_0x143237,null));};exports['update']=function(_0x4645a6,_0xfb2c87){if(_0x4645a6['body']['id']){delete _0x4645a6[_0xeaf3('0x57')]['id'];}return db[_0xeaf3('0x39')]['find']({'where':{'id':_0x4645a6[_0xeaf3('0x53')]['id']}})['then'](handleEntityNotFound(_0xfb2c87,null))[_0xeaf3('0x1d')](saveUpdates(_0x4645a6[_0xeaf3('0x57')],null))['then'](respondWithResult(_0xfb2c87,null))['catch'](handleError(_0xfb2c87,null));};exports['destroy']=function(_0x3b5849,_0x33b100){return db['FreshdeskConfiguration'][_0xeaf3('0x55')]({'where':{'id':_0x3b5849['params']['id']}})[_0xeaf3('0x1d')](handleEntityNotFound(_0x33b100,null))[_0xeaf3('0x1d')](removeEntity(_0x33b100,null))[_0xeaf3('0x51')](handleError(_0x33b100,null));};exports[_0xeaf3('0x58')]=function(_0x53f5a4,_0x1509ce,_0xc56f4b){var _0x33023d={};var _0x47374f={};var _0x19b686;var _0x3bc1bb;return db[_0xeaf3('0x39')][_0xeaf3('0x59')]({'where':{'id':_0x53f5a4[_0xeaf3('0x53')]['id']}})[_0xeaf3('0x1d')](handleEntityNotFound(_0x1509ce,null))[_0xeaf3('0x1d')](function(_0x29805a){if(_0x29805a){_0x19b686=_0x29805a;_0x47374f[_0xeaf3('0x3e')]=_[_0xeaf3('0x40')](db[_0xeaf3('0x5a')][_0xeaf3('0x3a')]);_0x47374f['query']=_[_0xeaf3('0x40')](_0x53f5a4[_0xeaf3('0x3f')]);_0x47374f['filters']=_[_0xeaf3('0x42')](_0x47374f[_0xeaf3('0x3e')],_0x47374f['query']);_0x33023d[_0xeaf3('0x43')]=_[_0xeaf3('0x42')](_0x47374f[_0xeaf3('0x3e')],qs['fields'](_0x53f5a4[_0xeaf3('0x3f')]['fields']));_0x33023d[_0xeaf3('0x43')]=_0x33023d[_0xeaf3('0x43')][_0xeaf3('0x5b')]?_0x33023d[_0xeaf3('0x43')]:_0x47374f[_0xeaf3('0x3e')];_0x33023d[_0xeaf3('0x46')]=qs[_0xeaf3('0x47')](_0x53f5a4[_0xeaf3('0x3f')]['sort']);_0x33023d[_0xeaf3('0x48')]=qs[_0xeaf3('0x41')](_[_0xeaf3('0x49')](_0x53f5a4[_0xeaf3('0x3f')],_0x47374f[_0xeaf3('0x41')]));if(_0x53f5a4[_0xeaf3('0x3f')][_0xeaf3('0x4a')]){_0x33023d[_0xeaf3('0x48')]=_['merge'](_0x33023d[_0xeaf3('0x48')],{'$or':_[_0xeaf3('0x38')](_0x33023d[_0xeaf3('0x43')],function(_0x48d9ad){var _0xf7be13={};_0xf7be13[_0x48d9ad]={'$like':'%'+_0x53f5a4['query'][_0xeaf3('0x4a')]+'%'};return _0xf7be13;})});}_0x33023d=_[_0xeaf3('0x4b')]({},_0x33023d,_0x53f5a4[_0xeaf3('0x54')]);return _0x19b686['getFields'](_0x33023d);}})[_0xeaf3('0x1d')](function(_0x3e5115){if(_0x3e5115){_0x3bc1bb=_0x3e5115[_0xeaf3('0x5b')];if(!_0x53f5a4[_0xeaf3('0x3f')][_0xeaf3('0x45')](_0xeaf3('0x5c'))){_0x33023d[_0xeaf3('0x2c')]=qs[_0xeaf3('0x2c')](_0x53f5a4[_0xeaf3('0x3f')][_0xeaf3('0x2c')]);_0x33023d['offset']=qs[_0xeaf3('0x2b')](_0x53f5a4[_0xeaf3('0x3f')][_0xeaf3('0x2b')]);}return _0x19b686[_0xeaf3('0x58')](_0x33023d);}})[_0xeaf3('0x1d')](function(_0xd85160){if(_0xd85160){return _0xd85160?{'count':_0x3bc1bb,'rows':_0xd85160}:null;}})['then'](respondWithResult(_0x1509ce,null))[_0xeaf3('0x51')](handleError(_0x1509ce,null));};exports['getSubjects']=function(_0x4bc7cb,_0x4c044e,_0x121774){var _0x576064={};var _0x27bcc1={};var _0x4c4586;var _0x1037ce;return db[_0xeaf3('0x39')][_0xeaf3('0x59')]({'where':{'id':_0x4bc7cb[_0xeaf3('0x53')]['id']}})[_0xeaf3('0x1d')](handleEntityNotFound(_0x4c044e,null))[_0xeaf3('0x1d')](function(_0x10919c){if(_0x10919c){_0x4c4586=_0x10919c;_0x27bcc1[_0xeaf3('0x3e')]=_[_0xeaf3('0x40')](db[_0xeaf3('0x5a')][_0xeaf3('0x3a')]);_0x27bcc1[_0xeaf3('0x3f')]=_['keys'](_0x4bc7cb[_0xeaf3('0x3f')]);_0x27bcc1[_0xeaf3('0x41')]=_[_0xeaf3('0x42')](_0x27bcc1[_0xeaf3('0x3e')],_0x27bcc1[_0xeaf3('0x3f')]);_0x576064[_0xeaf3('0x43')]=_[_0xeaf3('0x42')](_0x27bcc1[_0xeaf3('0x3e')],qs[_0xeaf3('0x44')](_0x4bc7cb[_0xeaf3('0x3f')][_0xeaf3('0x44')]));_0x576064['attributes']=_0x576064[_0xeaf3('0x43')][_0xeaf3('0x5b')]?_0x576064[_0xeaf3('0x43')]:_0x27bcc1[_0xeaf3('0x3e')];_0x576064[_0xeaf3('0x46')]=qs[_0xeaf3('0x47')](_0x4bc7cb[_0xeaf3('0x3f')][_0xeaf3('0x47')]);_0x576064[_0xeaf3('0x48')]=qs[_0xeaf3('0x41')](_[_0xeaf3('0x49')](_0x4bc7cb[_0xeaf3('0x3f')],_0x27bcc1['filters']));if(_0x4bc7cb[_0xeaf3('0x3f')][_0xeaf3('0x4a')]){_0x576064[_0xeaf3('0x48')]=_[_0xeaf3('0x4b')](_0x576064['where'],{'$or':_[_0xeaf3('0x38')](_0x576064[_0xeaf3('0x43')],function(_0x35fff2){var _0x1822a7={};_0x1822a7[_0x35fff2]={'$like':'%'+_0x4bc7cb[_0xeaf3('0x3f')][_0xeaf3('0x4a')]+'%'};return _0x1822a7;})});}_0x576064=_[_0xeaf3('0x4b')]({},_0x576064,_0x4bc7cb[_0xeaf3('0x54')]);return _0x4c4586['getSubjects'](_0x576064);}})[_0xeaf3('0x1d')](function(_0x59950d){if(_0x59950d){_0x1037ce=_0x59950d[_0xeaf3('0x5b')];if(!_0x4bc7cb[_0xeaf3('0x3f')][_0xeaf3('0x45')](_0xeaf3('0x5c'))){_0x576064[_0xeaf3('0x2c')]=qs[_0xeaf3('0x2c')](_0x4bc7cb[_0xeaf3('0x3f')][_0xeaf3('0x2c')]);_0x576064[_0xeaf3('0x2b')]=qs[_0xeaf3('0x2b')](_0x4bc7cb[_0xeaf3('0x3f')][_0xeaf3('0x2b')]);}return _0x4c4586['getSubjects'](_0x576064);}})[_0xeaf3('0x1d')](function(_0x325846){if(_0x325846){return _0x325846?{'count':_0x1037ce,'rows':_0x325846}:null;}})[_0xeaf3('0x1d')](respondWithResult(_0x4c044e,null))[_0xeaf3('0x51')](handleError(_0x4c044e,null));};exports[_0xeaf3('0x5d')]=function(_0x3cf485,_0x548297,_0x4cdf45){var _0x2236e2={};var _0x4f5054={};var _0x4ca24f;var _0x443222;return db[_0xeaf3('0x39')][_0xeaf3('0x59')]({'where':{'id':_0x3cf485[_0xeaf3('0x53')]['id']}})[_0xeaf3('0x1d')](handleEntityNotFound(_0x548297,null))[_0xeaf3('0x1d')](function(_0x66744f){if(_0x66744f){_0x4ca24f=_0x66744f;_0x4f5054[_0xeaf3('0x3e')]=_['keys'](db[_0xeaf3('0x5a')]['rawAttributes']);_0x4f5054[_0xeaf3('0x3f')]=_[_0xeaf3('0x40')](_0x3cf485[_0xeaf3('0x3f')]);_0x4f5054['filters']=_[_0xeaf3('0x42')](_0x4f5054[_0xeaf3('0x3e')],_0x4f5054[_0xeaf3('0x3f')]);_0x2236e2[_0xeaf3('0x43')]=_['intersection'](_0x4f5054['model'],qs[_0xeaf3('0x44')](_0x3cf485[_0xeaf3('0x3f')][_0xeaf3('0x44')]));_0x2236e2['attributes']=_0x2236e2[_0xeaf3('0x43')][_0xeaf3('0x5b')]?_0x2236e2[_0xeaf3('0x43')]:_0x4f5054[_0xeaf3('0x3e')];_0x2236e2[_0xeaf3('0x46')]=qs['sort'](_0x3cf485[_0xeaf3('0x3f')][_0xeaf3('0x47')]);_0x2236e2['where']=qs[_0xeaf3('0x41')](_[_0xeaf3('0x49')](_0x3cf485[_0xeaf3('0x3f')],_0x4f5054['filters']));if(_0x3cf485[_0xeaf3('0x3f')][_0xeaf3('0x4a')]){_0x2236e2[_0xeaf3('0x48')]=_[_0xeaf3('0x4b')](_0x2236e2['where'],{'$or':_[_0xeaf3('0x38')](_0x2236e2[_0xeaf3('0x43')],function(_0x166c98){var _0xb364d0={};_0xb364d0[_0x166c98]={'$like':'%'+_0x3cf485[_0xeaf3('0x3f')][_0xeaf3('0x4a')]+'%'};return _0xb364d0;})});}_0x2236e2=_['merge']({},_0x2236e2,_0x3cf485[_0xeaf3('0x54')]);return _0x4ca24f[_0xeaf3('0x5d')](_0x2236e2);}})[_0xeaf3('0x1d')](function(_0x253209){if(_0x253209){_0x443222=_0x253209[_0xeaf3('0x5b')];if(!_0x3cf485[_0xeaf3('0x3f')][_0xeaf3('0x45')](_0xeaf3('0x5c'))){_0x2236e2[_0xeaf3('0x2c')]=qs[_0xeaf3('0x2c')](_0x3cf485['query'][_0xeaf3('0x2c')]);_0x2236e2[_0xeaf3('0x2b')]=qs[_0xeaf3('0x2b')](_0x3cf485[_0xeaf3('0x3f')]['offset']);}return _0x4ca24f[_0xeaf3('0x5d')](_0x2236e2);}})['then'](function(_0x53b25b){if(_0x53b25b){return _0x53b25b?{'count':_0x443222,'rows':_0x53b25b}:null;}})[_0xeaf3('0x1d')](respondWithResult(_0x548297,null))[_0xeaf3('0x51')](handleError(_0x548297,null));};exports[_0xeaf3('0x5e')]=function(_0x16980d,_0x220250,_0x4c53d7){var _0x532470={};var _0x5283c1={};var _0x8f74b8;var _0x1cb7dd;return db['FreshdeskConfiguration'][_0xeaf3('0x59')]({'where':{'id':_0x16980d[_0xeaf3('0x53')]['id']}})['then'](handleEntityNotFound(_0x220250,null))[_0xeaf3('0x1d')](function(_0x23a5e5){if(_0x23a5e5){_0x8f74b8=_0x23a5e5;_0x5283c1['model']=_['keys'](db[_0xeaf3('0x5f')][_0xeaf3('0x3a')]);_0x5283c1[_0xeaf3('0x3f')]=_[_0xeaf3('0x40')](_0x16980d[_0xeaf3('0x3f')]);_0x5283c1['filters']=_['intersection'](_0x5283c1[_0xeaf3('0x3e')],_0x5283c1[_0xeaf3('0x3f')]);_0x532470['attributes']=_[_0xeaf3('0x42')](_0x5283c1[_0xeaf3('0x3e')],qs[_0xeaf3('0x44')](_0x16980d['query']['fields']));_0x532470[_0xeaf3('0x43')]=_0x532470[_0xeaf3('0x43')]['length']?_0x532470['attributes']:_0x5283c1[_0xeaf3('0x3e')];_0x532470[_0xeaf3('0x46')]=qs[_0xeaf3('0x47')](_0x16980d['query'][_0xeaf3('0x47')]);_0x532470[_0xeaf3('0x48')]=qs[_0xeaf3('0x41')](_[_0xeaf3('0x49')](_0x16980d[_0xeaf3('0x3f')],_0x5283c1[_0xeaf3('0x41')]));if(_0x16980d['query'][_0xeaf3('0x4a')]){_0x532470['where']=_[_0xeaf3('0x4b')](_0x532470['where'],{'$or':_['map'](_0x532470['attributes'],function(_0x105d95){var _0x137342={};_0x137342[_0x105d95]={'$like':'%'+_0x16980d[_0xeaf3('0x3f')]['filter']+'%'};return _0x137342;})});}_0x532470=_[_0xeaf3('0x4b')]({},_0x532470,_0x16980d[_0xeaf3('0x54')]);return _0x8f74b8[_0xeaf3('0x5e')](_0x532470);}})[_0xeaf3('0x1d')](function(_0x475140){if(_0x475140){_0x1cb7dd=_0x475140[_0xeaf3('0x5b')];if(!_0x16980d[_0xeaf3('0x3f')]['hasOwnProperty']('nolimit')){_0x532470[_0xeaf3('0x2c')]=qs[_0xeaf3('0x2c')](_0x16980d[_0xeaf3('0x3f')]['limit']);_0x532470[_0xeaf3('0x2b')]=qs[_0xeaf3('0x2b')](_0x16980d[_0xeaf3('0x3f')][_0xeaf3('0x2b')]);}return _0x8f74b8[_0xeaf3('0x5e')](_0x532470);}})['then'](function(_0x7b6c7e){if(_0x7b6c7e){return _0x7b6c7e?{'count':_0x1cb7dd,'rows':_0x7b6c7e}:null;}})['then'](respondWithResult(_0x220250,null))['catch'](handleError(_0x220250,null));};exports['setTags']=function(_0x4e0e27,_0x517fde,_0x1e90bb){if(_0x4e0e27[_0xeaf3('0x57')]['id']){delete _0x4e0e27[_0xeaf3('0x57')]['id'];}return db[_0xeaf3('0x39')][_0xeaf3('0x59')]({'where':{'id':_0x4e0e27['params']['id']}})[_0xeaf3('0x1d')](handleEntityNotFound(_0x517fde,null))[_0xeaf3('0x1d')](function(_0x51d0e4){if(_0x51d0e4){return _0x51d0e4['setTags'](_0x4e0e27[_0xeaf3('0x57')][_0xeaf3('0x60')]||[]);}return null;})[_0xeaf3('0x1d')](respondWithResult(_0x517fde,null))[_0xeaf3('0x51')](handleError(_0x517fde,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index c3c9de1..ddc244c 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 _0x1cb9=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1e5db1,_0x3ad8f8){var _0x48e72e=function(_0x14dc1e){while(--_0x14dc1e){_0x1e5db1['push'](_0x1e5db1['shift']());}};_0x48e72e(++_0x3ad8f8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3fdc35,_0x4ee7dd){_0x3fdc35=_0x3fdc35-0x0;var _0x57a98a=_0x1cb9[_0x3fdc35];return _0x57a98a;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x57c7db,_0x3e73d1){var _0xcd192b=function(_0x1aadb8){while(--_0x1aadb8){_0x57c7db['push'](_0x57c7db['shift']());}};_0xcd192b(++_0x3e73d1);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1b5369,_0x2e31a0){_0x1b5369=_0x1b5369-0x0;var _0x410a5b=_0x1cb9[_0x1b5369];return _0x410a5b;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 793d0fe..c80c31b 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 _0xf723=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5ce2cc,_0x91fffb){var _0x267775=function(_0x1a8cc3){while(--_0x1a8cc3){_0x5ce2cc['push'](_0x5ce2cc['shift']());}};_0x267775(++_0x91fffb);}(_0xf723,0x12e));var _0x3f72=function(_0x5d85ec,_0x4f6f1c){_0x5d85ec=_0x5d85ec-0x0;var _0xa01f0d=_0xf723[_0x5d85ec];return _0xa01f0d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f72('0x0'));var BPromise=require(_0x3f72('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f72('0x2'));var db=require(_0x3f72('0x3'))['db'];var utils=require(_0x3f72('0x4'));var logger=require('../../config/logger')(_0x3f72('0x5'));var config=require(_0x3f72('0x6'));var jayson=require(_0x3f72('0x7'));var client=jayson[_0x3f72('0x8')][_0x3f72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41058e,_0x161c7e,_0x7104d){return new BPromise(function(_0x3b1501,_0x5c03f6){return client['request'](_0x41058e,_0x7104d)['then'](function(_0x5900c8){logger['info'](_0x3f72('0xa'),_0x161c7e,_0x3f72('0xb'));logger['debug'](_0x3f72('0xc'),_0x161c7e,_0x3f72('0xb'),JSON[_0x3f72('0xd')](_0x5900c8));if(_0x5900c8[_0x3f72('0xe')]){if(_0x5900c8['error'][_0x3f72('0xf')]===0x1f4){logger[_0x3f72('0xe')](_0x3f72('0xa'),_0x161c7e,_0x5900c8[_0x3f72('0xe')][_0x3f72('0x10')]);return _0x5c03f6(_0x5900c8['error'][_0x3f72('0x10')]);}logger[_0x3f72('0xe')](_0x3f72('0xa'),_0x161c7e,_0x5900c8[_0x3f72('0xe')][_0x3f72('0x10')]);return _0x3b1501(_0x5900c8[_0x3f72('0xe')]['message']);}else{logger['info'](_0x3f72('0xa'),_0x161c7e,'request\x20sent');_0x3b1501(_0x5900c8['result'][_0x3f72('0x10')]);}})['catch'](function(_0x3a1d9b){logger[_0x3f72('0xe')](_0x3f72('0xa'),_0x161c7e,_0x3a1d9b);_0x5c03f6(_0x3a1d9b);});});} \ No newline at end of file +var _0x7fb0=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x32ab87,_0x5803d0){var _0x5ae2b0=function(_0x3af5d3){while(--_0x3af5d3){_0x32ab87['push'](_0x32ab87['shift']());}};_0x5ae2b0(++_0x5803d0);}(_0x7fb0,0x1ea));var _0x07fb=function(_0x119652,_0x35ceea){_0x119652=_0x119652-0x0;var _0x26f512=_0x7fb0[_0x119652];return _0x26f512;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x07fb('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07fb('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x07fb('0x2'))(_0x07fb('0x3'));var config=require(_0x07fb('0x4'));var jayson=require(_0x07fb('0x5'));var client=jayson[_0x07fb('0x6')][_0x07fb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c4bf5,_0x382eeb,_0x546e63){return new BPromise(function(_0x490e77,_0x2676c6){return client[_0x07fb('0x8')](_0x4c4bf5,_0x546e63)[_0x07fb('0x9')](function(_0x271fe7){logger['info'](_0x07fb('0xa'),_0x382eeb,_0x07fb('0xb'));logger[_0x07fb('0xc')](_0x07fb('0xd'),_0x382eeb,'request\x20sent',JSON[_0x07fb('0xe')](_0x271fe7));if(_0x271fe7[_0x07fb('0xf')]){if(_0x271fe7['error'][_0x07fb('0x10')]===0x1f4){logger[_0x07fb('0xf')](_0x07fb('0xa'),_0x382eeb,_0x271fe7[_0x07fb('0xf')]['message']);return _0x2676c6(_0x271fe7[_0x07fb('0xf')]['message']);}logger[_0x07fb('0xf')](_0x07fb('0xa'),_0x382eeb,_0x271fe7[_0x07fb('0xf')][_0x07fb('0x11')]);return _0x490e77(_0x271fe7[_0x07fb('0xf')][_0x07fb('0x11')]);}else{logger[_0x07fb('0x12')](_0x07fb('0xa'),_0x382eeb,_0x07fb('0xb'));_0x490e77(_0x271fe7['result']['message']);}})[_0x07fb('0x13')](function(_0x274532){logger[_0x07fb('0xf')](_0x07fb('0xa'),_0x382eeb,_0x274532);_0x2676c6(_0x274532);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 085ef7b..485cd42 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 _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x34e8,0x12c));var _0x834e=function(_0x42ffa9,_0x4693a){_0x42ffa9=_0x42ffa9-0x0;var _0x57c3ab=_0x34e8[_0x42ffa9];return _0x57c3ab;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x27062d,_0x24b179){var _0x4f1478=function(_0x3b4489){while(--_0x3b4489){_0x27062d['push'](_0x27062d['shift']());}};_0x4f1478(++_0x24b179);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index c8cb39b..de83d3b 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 _0x3fe7=['exports','ENUM','string','customVariable','STRING','variable','BOOLEAN','sequelize'];(function(_0x3f3a92,_0xb232c){var _0x52727a=function(_0x5f1191){while(--_0x5f1191){_0x3f3a92['push'](_0x3f3a92['shift']());}};_0x52727a(++_0xb232c);}(_0x3fe7,0x97));var _0x73fe=function(_0x4df69e,_0x5131d5){_0x4df69e=_0x4df69e-0x0;var _0x1f9041=_0x3fe7[_0x4df69e];return _0x1f9041;};'use strict';var Sequelize=require(_0x73fe('0x0'));module[_0x73fe('0x1')]={'type':{'type':Sequelize[_0x73fe('0x2')](_0x73fe('0x3'),'variable',_0x73fe('0x4'),'keyValue'),'defaultValue':_0x73fe('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x73fe('0x5')]},'keyType':{'type':Sequelize[_0x73fe('0x2')]('string',_0x73fe('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x73fe('0x5')]},'idField':{'type':Sequelize[_0x73fe('0x5')]},'nameField':{'type':Sequelize[_0x73fe('0x5')]},'customField':{'type':Sequelize[_0x73fe('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x73fe('0x5')]}}; \ No newline at end of file +var _0x2dab=['sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN'];(function(_0x1deb8c,_0x5e4103){var _0x1b460c=function(_0x2f7535){while(--_0x2f7535){_0x1deb8c['push'](_0x1deb8c['shift']());}};_0x1b460c(++_0x5e4103);}(_0x2dab,0x120));var _0xb2da=function(_0x18521a,_0x3da414){_0x18521a=_0x18521a-0x0;var _0x54d249=_0x2dab[_0x18521a];return _0x54d249;};'use strict';var Sequelize=require(_0xb2da('0x0'));module[_0xb2da('0x1')]={'type':{'type':Sequelize[_0xb2da('0x2')](_0xb2da('0x3'),_0xb2da('0x4'),'customVariable',_0xb2da('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb2da('0x6')]},'key':{'type':Sequelize[_0xb2da('0x6')]},'keyType':{'type':Sequelize[_0xb2da('0x2')](_0xb2da('0x3'),_0xb2da('0x4'),_0xb2da('0x7'))},'keyContent':{'type':Sequelize[_0xb2da('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb2da('0x6')]},'customField':{'type':Sequelize[_0xb2da('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb2da('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index cb4ddca..487327c 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 _0xecaa=['json','apply','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskField','include','findAll','rows','includeAll','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','count','offset','limit','Content-Range'];(function(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0xecaa,0x182));var _0xaeca=function(_0x1092d5,_0x3978cf){_0x1092d5=_0x1092d5-0x0;var _0x38a6aa=_0xecaa[_0x1092d5];return _0x38a6aa;};'use strict';var pdf=require(_0xaeca('0x0'));var emlformat=require(_0xaeca('0x1'));var rimraf=require(_0xaeca('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaeca('0x3'));var rp=require(_0xaeca('0x4'));var moment=require('moment');var BPromise=require(_0xaeca('0x5'));var Mustache=require(_0xaeca('0x6'));var util=require(_0xaeca('0x7'));var path=require(_0xaeca('0x8'));var sox=require(_0xaeca('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xaeca('0xa'));var squel=require(_0xaeca('0xb'));var crypto=require(_0xaeca('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaeca('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaeca('0xe'));var Papa=require('papaparse');var Redis=require(_0xaeca('0xf'));var authService=require(_0xaeca('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaeca('0x11'));var hardwareService=require(_0xaeca('0x12'));var logger=require(_0xaeca('0x13'))('api');var utils=require(_0xaeca('0x14'));var config=require(_0xaeca('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259773,_0x3fa679){_0x3fa679=_0x3fa679||0xcc;return function(_0x5c30a4){if(_0x5c30a4){return _0x259773['sendStatus'](_0x3fa679);}return _0x259773[_0xaeca('0x16')](_0x3fa679)[_0xaeca('0x17')]();};}function respondWithResult(_0x2e9eac,_0x14266a){_0x14266a=_0x14266a||0xc8;return function(_0x32c12f){if(_0x32c12f){return _0x2e9eac[_0xaeca('0x16')](_0x14266a)['json'](_0x32c12f);}};}function respondWithFilteredResult(_0x167f57,_0x2adeaa){return function(_0x5cbb3e){if(_0x5cbb3e){var _0x4d1942=_0x5cbb3e[_0xaeca('0x18')],_0x2d2585=_0x2adeaa[_0xaeca('0x19')],_0x48dff6=_0x2adeaa[_0xaeca('0x19')]+_0x2adeaa[_0xaeca('0x1a')],_0x15609;if(_0x48dff6>=_0x4d1942){_0x48dff6=_0x4d1942;_0x15609=0xc8;}else{_0x15609=0xce;}_0x167f57['status'](_0x15609);return _0x167f57['set'](_0xaeca('0x1b'),_0x2d2585+'-'+_0x48dff6+'/'+_0x4d1942)[_0xaeca('0x1c')](_0x5cbb3e);}return null;};}function patchUpdates(_0x369f9e){return function(_0x3e1bda){try{jsonpatch[_0xaeca('0x1d')](_0x3e1bda,_0x369f9e,!![]);}catch(_0x27a538){return BPromise[_0xaeca('0x1e')](_0x27a538);}return _0x3e1bda[_0xaeca('0x1f')]();};}function saveUpdates(_0x3db3e2,_0x175804){return function(_0x1cf733){if(_0x1cf733){return _0x1cf733[_0xaeca('0x20')](_0x3db3e2)[_0xaeca('0x21')](function(_0x4bb675){return _0x4bb675;});}return null;};}function removeEntity(_0x4690da,_0x40230d){return function(_0x16a7f2){if(_0x16a7f2){return _0x16a7f2['destroy']()[_0xaeca('0x21')](function(){_0x4690da[_0xaeca('0x16')](0xcc)[_0xaeca('0x17')]();});}};}function handleEntityNotFound(_0x368a0c,_0x151102){return function(_0x2018e0){if(!_0x2018e0){_0x368a0c[_0xaeca('0x22')](0x194);}return _0x2018e0;};}function handleError(_0x299d4b,_0x34dde6){_0x34dde6=_0x34dde6||0x1f4;return function(_0xd900f){logger[_0xaeca('0x23')](_0xd900f['stack']);if(_0xd900f[_0xaeca('0x24')]){delete _0xd900f['name'];}_0x299d4b[_0xaeca('0x16')](_0x34dde6)[_0xaeca('0x25')](_0xd900f);};}exports[_0xaeca('0x26')]=function(_0x48eae0,_0x23179d){var _0x218860={},_0x3408fb={},_0x1bdba0={'count':0x0,'rows':[]};var _0x42d6f7=_[_0xaeca('0x27')](db['FreshdeskField'][_0xaeca('0x28')],function(_0x1682c5){return{'name':_0x1682c5[_0xaeca('0x29')],'type':_0x1682c5['type']['key']};});_0x3408fb[_0xaeca('0x2a')]=_[_0xaeca('0x27')](_0x42d6f7,_0xaeca('0x24'));_0x3408fb['query']=_[_0xaeca('0x2b')](_0x48eae0[_0xaeca('0x2c')]);_0x3408fb[_0xaeca('0x2d')]=_[_0xaeca('0x2e')](_0x3408fb['model'],_0x3408fb[_0xaeca('0x2c')]);_0x218860[_0xaeca('0x2f')]=_[_0xaeca('0x2e')](_0x3408fb[_0xaeca('0x2a')],qs[_0xaeca('0x30')](_0x48eae0['query'][_0xaeca('0x30')]));_0x218860[_0xaeca('0x2f')]=_0x218860[_0xaeca('0x2f')][_0xaeca('0x31')]?_0x218860[_0xaeca('0x2f')]:_0x3408fb['model'];if(!_0x48eae0[_0xaeca('0x2c')][_0xaeca('0x32')]('nolimit')){_0x218860[_0xaeca('0x1a')]=qs[_0xaeca('0x1a')](_0x48eae0[_0xaeca('0x2c')][_0xaeca('0x1a')]);_0x218860[_0xaeca('0x19')]=qs['offset'](_0x48eae0['query']['offset']);}_0x218860['order']=qs[_0xaeca('0x33')](_0x48eae0[_0xaeca('0x2c')][_0xaeca('0x33')]);_0x218860[_0xaeca('0x34')]=qs['filters'](_[_0xaeca('0x35')](_0x48eae0[_0xaeca('0x2c')],_0x3408fb[_0xaeca('0x2d')]),_0x42d6f7);if(_0x48eae0[_0xaeca('0x2c')][_0xaeca('0x36')]){_0x218860[_0xaeca('0x34')]=_[_0xaeca('0x37')](_0x218860['where'],{'$or':_[_0xaeca('0x27')](_0x42d6f7,function(_0xde3a9e){if(_0xde3a9e['type']!==_0xaeca('0x38')){var _0x5b668d={};_0x5b668d[_0xde3a9e[_0xaeca('0x24')]]={'$like':'%'+_0x48eae0[_0xaeca('0x2c')]['filter']+'%'};return _0x5b668d;}})});}_0x218860=_['merge']({},_0x218860,_0x48eae0[_0xaeca('0x39')]);var _0xe99660={'where':_0x218860[_0xaeca('0x34')]};return db[_0xaeca('0x3a')][_0xaeca('0x18')](_0xe99660)[_0xaeca('0x21')](function(_0x2ffbc8){_0x1bdba0[_0xaeca('0x18')]=_0x2ffbc8;if(_0x48eae0[_0xaeca('0x2c')]['includeAll']){_0x218860[_0xaeca('0x3b')]=[{'all':!![]}];}return db[_0xaeca('0x3a')][_0xaeca('0x3c')](_0x218860);})[_0xaeca('0x21')](function(_0x1e60d1){_0x1bdba0[_0xaeca('0x3d')]=_0x1e60d1;return _0x1bdba0;})['then'](respondWithFilteredResult(_0x23179d,_0x218860))['catch'](handleError(_0x23179d,null));};exports['show']=function(_0x5371e1,_0x145689){var _0x7ebe67={'raw':!![],'where':{'id':_0x5371e1['params']['id']}},_0x2c81f3={};_0x2c81f3[_0xaeca('0x2a')]=_[_0xaeca('0x2b')](db[_0xaeca('0x3a')][_0xaeca('0x28')]);_0x2c81f3[_0xaeca('0x2c')]=_[_0xaeca('0x2b')](_0x5371e1[_0xaeca('0x2c')]);_0x2c81f3['filters']=_[_0xaeca('0x2e')](_0x2c81f3[_0xaeca('0x2a')],_0x2c81f3['query']);_0x7ebe67['attributes']=_[_0xaeca('0x2e')](_0x2c81f3[_0xaeca('0x2a')],qs[_0xaeca('0x30')](_0x5371e1[_0xaeca('0x2c')][_0xaeca('0x30')]));_0x7ebe67[_0xaeca('0x2f')]=_0x7ebe67['attributes']['length']?_0x7ebe67[_0xaeca('0x2f')]:_0x2c81f3[_0xaeca('0x2a')];if(_0x5371e1[_0xaeca('0x2c')][_0xaeca('0x3e')]){_0x7ebe67[_0xaeca('0x3b')]=[{'all':!![]}];}_0x7ebe67=_[_0xaeca('0x37')]({},_0x7ebe67,_0x5371e1[_0xaeca('0x39')]);return db[_0xaeca('0x3a')][_0xaeca('0x3f')](_0x7ebe67)[_0xaeca('0x21')](handleEntityNotFound(_0x145689,null))[_0xaeca('0x21')](respondWithResult(_0x145689,null))[_0xaeca('0x40')](handleError(_0x145689,null));};exports[_0xaeca('0x41')]=function(_0x3f82f3,_0x46aeaf){return db[_0xaeca('0x3a')]['create'](_0x3f82f3[_0xaeca('0x42')],{})[_0xaeca('0x21')](respondWithResult(_0x46aeaf,0xc9))['catch'](handleError(_0x46aeaf,null));};exports[_0xaeca('0x20')]=function(_0x1a3d2a,_0x1532b9){if(_0x1a3d2a[_0xaeca('0x42')]['id']){delete _0x1a3d2a['body']['id'];}return db['FreshdeskField'][_0xaeca('0x3f')]({'where':{'id':_0x1a3d2a[_0xaeca('0x43')]['id']}})[_0xaeca('0x21')](handleEntityNotFound(_0x1532b9,null))['then'](saveUpdates(_0x1a3d2a[_0xaeca('0x42')],null))[_0xaeca('0x21')](respondWithResult(_0x1532b9,null))[_0xaeca('0x40')](handleError(_0x1532b9,null));};exports[_0xaeca('0x44')]=function(_0x48616a,_0x1257ad){return db['FreshdeskField'][_0xaeca('0x3f')]({'where':{'id':_0x48616a[_0xaeca('0x43')]['id']}})[_0xaeca('0x21')](handleEntityNotFound(_0x1257ad,null))[_0xaeca('0x21')](removeEntity(_0x1257ad,null))['catch'](handleError(_0x1257ad,null));}; \ No newline at end of file +var _0xb513=['body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create'];(function(_0x3ed92d,_0x122c7d){var _0x42376d=function(_0x440d96){while(--_0x440d96){_0x3ed92d['push'](_0x3ed92d['shift']());}};_0x42376d(++_0x122c7d);}(_0xb513,0xd3));var _0x3b51=function(_0x104c9b,_0x56944d){_0x104c9b=_0x104c9b-0x0;var _0x39ba4d=_0xb513[_0x104c9b];return _0x39ba4d;};'use strict';var pdf=require(_0x3b51('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3b51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b51('0x2'));var rp=require(_0x3b51('0x3'));var moment=require(_0x3b51('0x4'));var BPromise=require(_0x3b51('0x5'));var Mustache=require(_0x3b51('0x6'));var util=require(_0x3b51('0x7'));var path=require(_0x3b51('0x8'));var sox=require('sox');var csv=require(_0x3b51('0x9'));var ejs=require(_0x3b51('0xa'));var fs=require('fs');var _=require(_0x3b51('0xb'));var squel=require('squel');var crypto=require(_0x3b51('0xc'));var jsforce=require(_0x3b51('0xd'));var deskjs=require(_0x3b51('0xe'));var toCsv=require(_0x3b51('0x9'));var querystring=require(_0x3b51('0xf'));var Papa=require(_0x3b51('0x10'));var Redis=require('ioredis');var authService=require(_0x3b51('0x11'));var qs=require(_0x3b51('0x12'));var as=require(_0x3b51('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3b51('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d6b63,_0x271e9a){_0x271e9a=_0x271e9a||0xcc;return function(_0x58a755){if(_0x58a755){return _0x1d6b63['sendStatus'](_0x271e9a);}return _0x1d6b63[_0x3b51('0x15')](_0x271e9a)[_0x3b51('0x16')]();};}function respondWithResult(_0x3e484b,_0x5bc417){_0x5bc417=_0x5bc417||0xc8;return function(_0x53a9b5){if(_0x53a9b5){return _0x3e484b[_0x3b51('0x15')](_0x5bc417)[_0x3b51('0x17')](_0x53a9b5);}};}function respondWithFilteredResult(_0x144d33,_0x58c263){return function(_0x192740){if(_0x192740){var _0x515f80=_0x192740[_0x3b51('0x18')],_0x382457=_0x58c263[_0x3b51('0x19')],_0x6371e4=_0x58c263['offset']+_0x58c263['limit'],_0x54bff3;if(_0x6371e4>=_0x515f80){_0x6371e4=_0x515f80;_0x54bff3=0xc8;}else{_0x54bff3=0xce;}_0x144d33[_0x3b51('0x15')](_0x54bff3);return _0x144d33[_0x3b51('0x1a')](_0x3b51('0x1b'),_0x382457+'-'+_0x6371e4+'/'+_0x515f80)[_0x3b51('0x17')](_0x192740);}return null;};}function patchUpdates(_0x374968){return function(_0x383571){try{jsonpatch[_0x3b51('0x1c')](_0x383571,_0x374968,!![]);}catch(_0x563783){return BPromise[_0x3b51('0x1d')](_0x563783);}return _0x383571[_0x3b51('0x1e')]();};}function saveUpdates(_0x334115,_0x19f4ff){return function(_0x3a9623){if(_0x3a9623){return _0x3a9623[_0x3b51('0x1f')](_0x334115)[_0x3b51('0x20')](function(_0x24935a){return _0x24935a;});}return null;};}function removeEntity(_0x1fb481,_0x12c3e3){return function(_0x4d75c8){if(_0x4d75c8){return _0x4d75c8[_0x3b51('0x21')]()[_0x3b51('0x20')](function(){_0x1fb481[_0x3b51('0x15')](0xcc)[_0x3b51('0x16')]();});}};}function handleEntityNotFound(_0x2e9c1e,_0x49dc07){return function(_0x3839aa){if(!_0x3839aa){_0x2e9c1e[_0x3b51('0x22')](0x194);}return _0x3839aa;};}function handleError(_0x503ae7,_0x22eae7){_0x22eae7=_0x22eae7||0x1f4;return function(_0x22f915){logger[_0x3b51('0x23')](_0x22f915[_0x3b51('0x24')]);if(_0x22f915['name']){delete _0x22f915[_0x3b51('0x25')];}_0x503ae7[_0x3b51('0x15')](_0x22eae7)[_0x3b51('0x26')](_0x22f915);};}exports[_0x3b51('0x27')]=function(_0x45af9c,_0x34a164){var _0x3267a4={},_0x39b194={},_0x2e8123={'count':0x0,'rows':[]};var _0x5745ab=_[_0x3b51('0x28')](db[_0x3b51('0x29')][_0x3b51('0x2a')],function(_0x1ba589){return{'name':_0x1ba589[_0x3b51('0x2b')],'type':_0x1ba589[_0x3b51('0x2c')]['key']};});_0x39b194[_0x3b51('0x2d')]=_['map'](_0x5745ab,_0x3b51('0x25'));_0x39b194[_0x3b51('0x2e')]=_[_0x3b51('0x2f')](_0x45af9c['query']);_0x39b194[_0x3b51('0x30')]=_[_0x3b51('0x31')](_0x39b194['model'],_0x39b194[_0x3b51('0x2e')]);_0x3267a4[_0x3b51('0x32')]=_[_0x3b51('0x31')](_0x39b194['model'],qs[_0x3b51('0x33')](_0x45af9c[_0x3b51('0x2e')][_0x3b51('0x33')]));_0x3267a4[_0x3b51('0x32')]=_0x3267a4['attributes'][_0x3b51('0x34')]?_0x3267a4[_0x3b51('0x32')]:_0x39b194[_0x3b51('0x2d')];if(!_0x45af9c[_0x3b51('0x2e')][_0x3b51('0x35')]('nolimit')){_0x3267a4[_0x3b51('0x36')]=qs[_0x3b51('0x36')](_0x45af9c['query']['limit']);_0x3267a4['offset']=qs[_0x3b51('0x19')](_0x45af9c[_0x3b51('0x2e')][_0x3b51('0x19')]);}_0x3267a4['order']=qs['sort'](_0x45af9c['query'][_0x3b51('0x37')]);_0x3267a4[_0x3b51('0x38')]=qs[_0x3b51('0x30')](_['pick'](_0x45af9c['query'],_0x39b194[_0x3b51('0x30')]),_0x5745ab);if(_0x45af9c[_0x3b51('0x2e')][_0x3b51('0x39')]){_0x3267a4[_0x3b51('0x38')]=_[_0x3b51('0x3a')](_0x3267a4[_0x3b51('0x38')],{'$or':_[_0x3b51('0x28')](_0x5745ab,function(_0x5e21e8){if(_0x5e21e8['type']!==_0x3b51('0x3b')){var _0x4edc6d={};_0x4edc6d[_0x5e21e8['name']]={'$like':'%'+_0x45af9c[_0x3b51('0x2e')][_0x3b51('0x39')]+'%'};return _0x4edc6d;}})});}_0x3267a4=_['merge']({},_0x3267a4,_0x45af9c[_0x3b51('0x3c')]);var _0x2ef049={'where':_0x3267a4[_0x3b51('0x38')]};return db['FreshdeskField'][_0x3b51('0x18')](_0x2ef049)[_0x3b51('0x20')](function(_0x8d85b){_0x2e8123[_0x3b51('0x18')]=_0x8d85b;if(_0x45af9c[_0x3b51('0x2e')][_0x3b51('0x3d')]){_0x3267a4['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x3b51('0x3e')](_0x3267a4);})[_0x3b51('0x20')](function(_0x66d99a){_0x2e8123[_0x3b51('0x3f')]=_0x66d99a;return _0x2e8123;})[_0x3b51('0x20')](respondWithFilteredResult(_0x34a164,_0x3267a4))[_0x3b51('0x40')](handleError(_0x34a164,null));};exports['show']=function(_0x55c38b,_0xc29726){var _0x1a3d60={'raw':!![],'where':{'id':_0x55c38b[_0x3b51('0x41')]['id']}},_0x122fcc={};_0x122fcc[_0x3b51('0x2d')]=_[_0x3b51('0x2f')](db[_0x3b51('0x29')][_0x3b51('0x2a')]);_0x122fcc[_0x3b51('0x2e')]=_[_0x3b51('0x2f')](_0x55c38b['query']);_0x122fcc[_0x3b51('0x30')]=_[_0x3b51('0x31')](_0x122fcc[_0x3b51('0x2d')],_0x122fcc['query']);_0x1a3d60[_0x3b51('0x32')]=_[_0x3b51('0x31')](_0x122fcc['model'],qs[_0x3b51('0x33')](_0x55c38b[_0x3b51('0x2e')][_0x3b51('0x33')]));_0x1a3d60['attributes']=_0x1a3d60['attributes'][_0x3b51('0x34')]?_0x1a3d60[_0x3b51('0x32')]:_0x122fcc[_0x3b51('0x2d')];if(_0x55c38b[_0x3b51('0x2e')][_0x3b51('0x3d')]){_0x1a3d60[_0x3b51('0x42')]=[{'all':!![]}];}_0x1a3d60=_[_0x3b51('0x3a')]({},_0x1a3d60,_0x55c38b['options']);return db[_0x3b51('0x29')][_0x3b51('0x43')](_0x1a3d60)[_0x3b51('0x20')](handleEntityNotFound(_0xc29726,null))[_0x3b51('0x20')](respondWithResult(_0xc29726,null))['catch'](handleError(_0xc29726,null));};exports[_0x3b51('0x44')]=function(_0x208a79,_0x1c36ec){return db[_0x3b51('0x29')][_0x3b51('0x44')](_0x208a79['body'],{})[_0x3b51('0x20')](respondWithResult(_0x1c36ec,0xc9))[_0x3b51('0x40')](handleError(_0x1c36ec,null));};exports[_0x3b51('0x1f')]=function(_0x13dd0d,_0x43a9f7){if(_0x13dd0d[_0x3b51('0x45')]['id']){delete _0x13dd0d[_0x3b51('0x45')]['id'];}return db[_0x3b51('0x29')][_0x3b51('0x43')]({'where':{'id':_0x13dd0d[_0x3b51('0x41')]['id']}})[_0x3b51('0x20')](handleEntityNotFound(_0x43a9f7,null))[_0x3b51('0x20')](saveUpdates(_0x13dd0d['body'],null))[_0x3b51('0x20')](respondWithResult(_0x43a9f7,null))[_0x3b51('0x40')](handleError(_0x43a9f7,null));};exports['destroy']=function(_0x5ee9d7,_0x438d3f){return db[_0x3b51('0x29')][_0x3b51('0x43')]({'where':{'id':_0x5ee9d7[_0x3b51('0x41')]['id']}})[_0x3b51('0x20')](handleEntityNotFound(_0x438d3f,null))[_0x3b51('0x20')](removeEntity(_0x438d3f,null))['catch'](handleError(_0x438d3f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 181e96a..91d4acb 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 _0x071e=['moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x553a87,_0x1d621f){var _0x12d1e6=function(_0x41ae48){while(--_0x41ae48){_0x553a87['push'](_0x553a87['shift']());}};_0x12d1e6(++_0x1d621f);}(_0x071e,0x16a));var _0xe071=function(_0x27b7d2,_0x56c091){_0x27b7d2=_0x27b7d2-0x0;var _0x3ef6be=_0x071e[_0x27b7d2];return _0x3ef6be;};'use strict';var _=require('lodash');var util=require(_0xe071('0x0'));var logger=require(_0xe071('0x1'))('api');var moment=require(_0xe071('0x2'));var BPromise=require(_0xe071('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe071('0x4'));var rimraf=require(_0xe071('0x5'));var config=require(_0xe071('0x6'));var attributes=require(_0xe071('0x7'));module[_0xe071('0x8')]=function(_0x5a42a5,_0x42220c){return _0x5a42a5['define'](_0xe071('0x9'),attributes,{'tableName':_0xe071('0xa'),'paranoid':![],'indexes':[{'name':_0xe071('0xb'),'fields':[_0xe071('0xc'),_0xe071('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a0=['../../config/environment','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0xc7c9e2,_0x45f092){var _0x4a9eaa=function(_0x127507){while(--_0x127507){_0xc7c9e2['push'](_0xc7c9e2['shift']());}};_0x4a9eaa(++_0x45f092);}(_0xb8a0,0x149));var _0x0b8a=function(_0x22444e,_0x120202){_0x22444e=_0x22444e-0x0;var _0x2b9115=_0xb8a0[_0x22444e];return _0x2b9115;};'use strict';var _=require(_0x0b8a('0x0'));var util=require(_0x0b8a('0x1'));var logger=require('../../config/logger')(_0x0b8a('0x2'));var moment=require(_0x0b8a('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b8a('0x4'));var fs=require('fs');var path=require(_0x0b8a('0x5'));var rimraf=require(_0x0b8a('0x6'));var config=require(_0x0b8a('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x0b8a('0x8')]=function(_0x3c7d96,_0x5159d8){return _0x3c7d96['define'](_0x0b8a('0x9'),attributes,{'tableName':_0x0b8a('0xa'),'paranoid':![],'indexes':[{'name':_0x0b8a('0xb'),'fields':[_0x0b8a('0xc'),_0x0b8a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 529cb9c..e9d47e7 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x46a267,_0x5c4dc8){_0x46a267=_0x46a267-0x0;var _0x530b42=_0x7a54[_0x46a267];return _0x530b42;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x4658dd,_0x193b64){var _0x2e194e=function(_0x406e24){while(--_0x406e24){_0x4658dd['push'](_0x4658dd['shift']());}};_0x2e194e(++_0x193b64);}(_0xb10b,0x12a));var _0xbb10=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0xb10b[_0x50b1c5];return _0x344f99;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 77fafbe..614ae58 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 _0x86cf=['update','destroy','exports','multer','util','express','Router','../../components/auth/service','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration'];(function(_0x4251cb,_0x426439){var _0x4d5697=function(_0x392992){while(--_0x392992){_0x4251cb['push'](_0x4251cb['shift']());}};_0x4d5697(++_0x426439);}(_0x86cf,0xb7));var _0xf86c=function(_0x1e3224,_0x532acd){_0x1e3224=_0x1e3224-0x0;var _0x17e692=_0x86cf[_0x1e3224];return _0x17e692;};'use strict';var multer=require(_0xf86c('0x0'));var util=require(_0xf86c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf86c('0x2'));var router=express[_0xf86c('0x3')]();var auth=require(_0xf86c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf86c('0x5'));router[_0xf86c('0x6')]('/',auth['isAuthenticated'](),controller[_0xf86c('0x7')]);router[_0xf86c('0x6')](_0xf86c('0x8'),auth[_0xf86c('0x9')](),controller[_0xf86c('0xa')]);router[_0xf86c('0x6')](_0xf86c('0xb'),auth[_0xf86c('0x9')](),controller[_0xf86c('0xc')]);router['get'](_0xf86c('0xd'),auth[_0xf86c('0x9')](),controller['getFields']);router[_0xf86c('0xe')]('/',auth[_0xf86c('0x9')](),controller[_0xf86c('0xf')]);router[_0xf86c('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xf86c('0x10')]);router['put'](_0xf86c('0x8'),auth[_0xf86c('0x9')](),controller[_0xf86c('0x11')]);router['delete'](_0xf86c('0x8'),auth[_0xf86c('0x9')](),controller[_0xf86c('0x12')]);module[_0xf86c('0x13')]=router; \ No newline at end of file +var _0xd0f5=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','addConfiguration','put','update','util','path','express'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xd0f5,0x12f));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x5d0f('0x0'));var path=require(_0x5d0f('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d0f('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5d0f('0x3'));var config=require(_0x5d0f('0x4'));var controller=require(_0x5d0f('0x5'));router[_0x5d0f('0x6')]('/',auth[_0x5d0f('0x7')](),controller[_0x5d0f('0x8')]);router[_0x5d0f('0x6')](_0x5d0f('0x9'),auth[_0x5d0f('0x7')](),controller[_0x5d0f('0xa')]);router['get'](_0x5d0f('0xb'),auth[_0x5d0f('0x7')](),controller['getConfigurations']);router[_0x5d0f('0x6')](_0x5d0f('0xc'),auth['isAuthenticated'](),controller[_0x5d0f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5d0f('0xe')]);router['post']('/:id/configurations',auth[_0x5d0f('0x7')](),controller[_0x5d0f('0xf')]);router[_0x5d0f('0x10')](_0x5d0f('0x9'),auth[_0x5d0f('0x7')](),controller[_0x5d0f('0x11')]);router['delete'](_0x5d0f('0x9'),auth[_0x5d0f('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index c272a44..c93ed2a 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 _0x7af9=['remoteUri','sequelize','STRING','username'];(function(_0x53dc2f,_0x352f5f){var _0x2db8b6=function(_0x1c82c9){while(--_0x1c82c9){_0x53dc2f['push'](_0x53dc2f['shift']());}};_0x2db8b6(++_0x352f5f);}(_0x7af9,0x95));var _0x97af=function(_0x9a3357,_0x269e27){_0x9a3357=_0x9a3357-0x0;var _0xf895ed=_0x7af9[_0x9a3357];return _0xf895ed;};'use strict';var Sequelize=require(_0x97af('0x0'));module['exports']={'name':{'type':Sequelize[_0x97af('0x1')]},'description':{'type':Sequelize[_0x97af('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x97af('0x2')},'apiKey':{'type':Sequelize[_0x97af('0x1')]},'remoteUri':{'type':Sequelize[_0x97af('0x1')],'unique':_0x97af('0x3')},'serverUrl':{'type':Sequelize[_0x97af('0x1')]}}; \ No newline at end of file +var _0xb296=['STRING','username','remoteUri','sequelize','exports'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xb296,0xa3));var _0x6b29=function(_0x51d5ee,_0x13e49a){_0x51d5ee=_0x51d5ee-0x0;var _0x4e7f5d=_0xb296[_0x51d5ee];return _0x4e7f5d;};'use strict';var Sequelize=require(_0x6b29('0x0'));module[_0x6b29('0x1')]={'name':{'type':Sequelize[_0x6b29('0x2')]},'description':{'type':Sequelize[_0x6b29('0x2')]},'username':{'type':Sequelize[_0x6b29('0x2')],'unique':_0x6b29('0x3')},'apiKey':{'type':Sequelize[_0x6b29('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x6b29('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 1543c16..f61f4a7 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 _0x0335=['type','VIRTUAL','merge','options','where','includeAll','findAll','rows','show','params','keys','include','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','ValidationError','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter'];(function(_0x34a6e9,_0x25cabe){var _0x11015c=function(_0x5c2ced){while(--_0x5c2ced){_0x34a6e9['push'](_0x34a6e9['shift']());}};_0x11015c(++_0x25cabe);}(_0x0335,0x183));var _0x5033=function(_0x2e617d,_0x17c590){_0x2e617d=_0x2e617d-0x0;var _0x34c295=_0x0335[_0x2e617d];return _0x34c295;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5033('0x0'));var rimraf=require(_0x5033('0x1'));var zipdir=require(_0x5033('0x2'));var jsonpatch=require(_0x5033('0x3'));var rp=require(_0x5033('0x4'));var moment=require(_0x5033('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5033('0x6'));var util=require(_0x5033('0x7'));var path=require(_0x5033('0x8'));var sox=require('sox');var csv=require(_0x5033('0x9'));var ejs=require(_0x5033('0xa'));var fs=require('fs');var _=require(_0x5033('0xb'));var squel=require(_0x5033('0xc'));var crypto=require(_0x5033('0xd'));var jsforce=require(_0x5033('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5033('0x9'));var querystring=require(_0x5033('0xf'));var Papa=require('papaparse');var Redis=require(_0x5033('0x10'));var authService=require(_0x5033('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5033('0x12'));var logger=require(_0x5033('0x13'))(_0x5033('0x14'));var utils=require(_0x5033('0x15'));var config=require('../../config/environment');var db=require(_0x5033('0x16'))['db'];var integrations=require(_0x5033('0x17'));var jayson=require(_0x5033('0x18'));var client=jayson['client'][_0x5033('0x19')]({'port':0x232a});function checkPasswordPattern(_0x50808d,_0x5b26ac,_0x318f3f){if(_0x318f3f){var _0x43dd14=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43dd14[_0x5033('0x1a')](_0x5b26ac)){return _0x50808d;}else{throw new db['Sequelize'][(_0x5033('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 _0x50808d;}}function respondWithRpcPromise(_0x17f0be,_0x2f0b72,_0x4406fe,_0x106c74){return new BPromise(function(_0xf193c6,_0x5db946){var _0x815c57=_0x106c74||client;return _0x815c57['request'](_0x17f0be,_0x4406fe)[_0x5033('0x1c')](function(_0x2f26dc){logger[_0x5033('0x1d')](_0x5033('0x1e'),_0x2f0b72,_0x5033('0x1f'));logger[_0x5033('0x20')](_0x5033('0x21'),_0x2f0b72,_0x5033('0x1f'),JSON[_0x5033('0x22')](_0x2f26dc));if(_0x2f26dc['error']){if(_0x2f26dc[_0x5033('0x23')][_0x5033('0x24')]===0x1f4){logger[_0x5033('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x2f0b72,_0x2f26dc['error'][_0x5033('0x25')]);return _0x5db946(_0x2f26dc['error']['message']);}logger[_0x5033('0x23')](_0x5033('0x1e'),_0x2f0b72,_0x2f26dc['error']['message']);return _0xf193c6(_0x2f26dc[_0x5033('0x23')][_0x5033('0x25')]);}else{logger[_0x5033('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x2f0b72,_0x5033('0x1f'));_0xf193c6(_0x2f26dc[_0x5033('0x26')]['message']);}})[_0x5033('0x27')](function(_0x242e6e){logger[_0x5033('0x23')](_0x5033('0x1e'),_0x2f0b72,_0x242e6e);_0x5db946(_0x242e6e);});});}function respondWithStatusCode(_0x2d89bd,_0x9e3010){_0x9e3010=_0x9e3010||0xcc;return function(_0x49b7ec){if(_0x49b7ec){return _0x2d89bd[_0x5033('0x28')](_0x9e3010);}return _0x2d89bd[_0x5033('0x29')](_0x9e3010)[_0x5033('0x2a')]();};}function respondWithResult(_0x4c1f91,_0x423a49){_0x423a49=_0x423a49||0xc8;return function(_0x349e5f){if(_0x349e5f){return _0x4c1f91['status'](_0x423a49)[_0x5033('0x2b')](_0x349e5f);}};}function respondWithFilteredResult(_0x6ed2d8,_0x18e3e6){return function(_0x55a840){if(_0x55a840){var _0x31c9e6=_0x55a840[_0x5033('0x2c')],_0x8065d9=_0x18e3e6[_0x5033('0x2d')],_0x6f6ab6=_0x18e3e6['offset']+_0x18e3e6[_0x5033('0x2e')],_0x4ced42;if(_0x6f6ab6>=_0x31c9e6){_0x6f6ab6=_0x31c9e6;_0x4ced42=0xc8;}else{_0x4ced42=0xce;}_0x6ed2d8[_0x5033('0x29')](_0x4ced42);return _0x6ed2d8[_0x5033('0x2f')]('Content-Range',_0x8065d9+'-'+_0x6f6ab6+'/'+_0x31c9e6)[_0x5033('0x2b')](_0x55a840);}return null;};}function patchUpdates(_0x4f9746){return function(_0x21d461){try{jsonpatch[_0x5033('0x30')](_0x21d461,_0x4f9746,!![]);}catch(_0x3e1702){return BPromise[_0x5033('0x31')](_0x3e1702);}return _0x21d461[_0x5033('0x32')]();};}function saveUpdates(_0x3e70cd,_0x306d98){return function(_0x4ae10e){if(_0x4ae10e){return _0x4ae10e[_0x5033('0x33')](_0x3e70cd)['then'](function(_0x1600fd){return _0x1600fd;});}return null;};}function removeEntity(_0x1900af,_0x41e850){return function(_0x4e49ce){if(_0x4e49ce){return _0x4e49ce[_0x5033('0x34')]()[_0x5033('0x1c')](function(){_0x1900af[_0x5033('0x29')](0xcc)[_0x5033('0x2a')]();});}};}function handleEntityNotFound(_0x4c40e4,_0x514440){return function(_0x332329){if(!_0x332329){_0x4c40e4['sendStatus'](0x194);}return _0x332329;};}function handleError(_0x12d2e9,_0x18836a){_0x18836a=_0x18836a||0x1f4;return function(_0x3c2f5d){logger['error'](_0x3c2f5d[_0x5033('0x35')]);if(_0x3c2f5d[_0x5033('0x36')]){delete _0x3c2f5d['name'];}_0x12d2e9[_0x5033('0x29')](_0x18836a)[_0x5033('0x37')](_0x3c2f5d);};}exports['index']=function(_0x1afc28,_0x5b5f31){var _0x4a2192={},_0x11f3e6={},_0x2cd030={'count':0x0,'rows':[]};var _0x29b2db=_[_0x5033('0x38')](db[_0x5033('0x39')][_0x5033('0x3a')],function(_0x3d52c9){return{'name':_0x3d52c9[_0x5033('0x3b')],'type':_0x3d52c9['type'][_0x5033('0x3c')]};});_0x11f3e6[_0x5033('0x3d')]=_[_0x5033('0x38')](_0x29b2db,_0x5033('0x36'));_0x11f3e6[_0x5033('0x3e')]=_['keys'](_0x1afc28[_0x5033('0x3e')]);_0x11f3e6[_0x5033('0x3f')]=_[_0x5033('0x40')](_0x11f3e6[_0x5033('0x3d')],_0x11f3e6[_0x5033('0x3e')]);_0x4a2192[_0x5033('0x41')]=_[_0x5033('0x40')](_0x11f3e6[_0x5033('0x3d')],qs[_0x5033('0x42')](_0x1afc28[_0x5033('0x3e')][_0x5033('0x42')]));_0x4a2192[_0x5033('0x41')]=_0x4a2192[_0x5033('0x41')][_0x5033('0x43')]?_0x4a2192[_0x5033('0x41')]:_0x11f3e6[_0x5033('0x3d')];if(!_0x1afc28[_0x5033('0x3e')][_0x5033('0x44')]('nolimit')){_0x4a2192[_0x5033('0x2e')]=qs[_0x5033('0x2e')](_0x1afc28[_0x5033('0x3e')][_0x5033('0x2e')]);_0x4a2192['offset']=qs[_0x5033('0x2d')](_0x1afc28['query'][_0x5033('0x2d')]);}_0x4a2192[_0x5033('0x45')]=qs[_0x5033('0x46')](_0x1afc28[_0x5033('0x3e')]['sort']);_0x4a2192['where']=qs[_0x5033('0x3f')](_[_0x5033('0x47')](_0x1afc28[_0x5033('0x3e')],_0x11f3e6['filters']),_0x29b2db);if(_0x1afc28[_0x5033('0x3e')][_0x5033('0x48')]){_0x4a2192['where']=_['merge'](_0x4a2192['where'],{'$or':_[_0x5033('0x38')](_0x29b2db,function(_0x15380d){if(_0x15380d[_0x5033('0x49')]!==_0x5033('0x4a')){var _0xafae16={};_0xafae16[_0x15380d[_0x5033('0x36')]]={'$like':'%'+_0x1afc28['query'][_0x5033('0x48')]+'%'};return _0xafae16;}})});}_0x4a2192=_[_0x5033('0x4b')]({},_0x4a2192,_0x1afc28[_0x5033('0x4c')]);var _0x4cd760={'where':_0x4a2192[_0x5033('0x4d')]};return db[_0x5033('0x39')]['count'](_0x4cd760)['then'](function(_0xb142dc){_0x2cd030[_0x5033('0x2c')]=_0xb142dc;if(_0x1afc28[_0x5033('0x3e')][_0x5033('0x4e')]){_0x4a2192['include']=[{'all':!![]}];}return db[_0x5033('0x39')][_0x5033('0x4f')](_0x4a2192);})['then'](function(_0x4573ed){_0x2cd030[_0x5033('0x50')]=_0x4573ed;return _0x2cd030;})[_0x5033('0x1c')](respondWithFilteredResult(_0x5b5f31,_0x4a2192))[_0x5033('0x27')](handleError(_0x5b5f31,null));};exports[_0x5033('0x51')]=function(_0x381c73,_0x645796){var _0xa90d00={'raw':![],'where':{'id':_0x381c73[_0x5033('0x52')]['id']}},_0x309baf={};_0x309baf[_0x5033('0x3d')]=_['keys'](db['FreshsalesAccount'][_0x5033('0x3a')]);_0x309baf[_0x5033('0x3e')]=_[_0x5033('0x53')](_0x381c73['query']);_0x309baf[_0x5033('0x3f')]=_['intersection'](_0x309baf['model'],_0x309baf['query']);_0xa90d00['attributes']=_['intersection'](_0x309baf[_0x5033('0x3d')],qs['fields'](_0x381c73[_0x5033('0x3e')][_0x5033('0x42')]));_0xa90d00[_0x5033('0x41')]=_0xa90d00[_0x5033('0x41')][_0x5033('0x43')]?_0xa90d00['attributes']:_0x309baf['model'];if(_0x381c73[_0x5033('0x3e')]['includeAll']){_0xa90d00[_0x5033('0x54')]=[{'all':!![]}];}_0xa90d00=_['merge']({},_0xa90d00,_0x381c73['options']);return db['FreshsalesAccount'][_0x5033('0x55')](_0xa90d00)[_0x5033('0x1c')](handleEntityNotFound(_0x645796,null))['then'](respondWithResult(_0x645796,null))[_0x5033('0x27')](handleError(_0x645796,null));};exports['create']=function(_0x54f7b3,_0x17d625){return db[_0x5033('0x39')][_0x5033('0x56')](_0x54f7b3[_0x5033('0x57')],{})[_0x5033('0x1c')](respondWithResult(_0x17d625,0xc9))[_0x5033('0x27')](handleError(_0x17d625,null));};exports['update']=function(_0x29a446,_0x34ad5b){if(_0x29a446[_0x5033('0x57')]['id']){delete _0x29a446[_0x5033('0x57')]['id'];}return db['FreshsalesAccount'][_0x5033('0x55')]({'where':{'id':_0x29a446['params']['id']}})[_0x5033('0x1c')](handleEntityNotFound(_0x34ad5b,null))[_0x5033('0x1c')](saveUpdates(_0x29a446[_0x5033('0x57')],null))[_0x5033('0x1c')](respondWithResult(_0x34ad5b,null))[_0x5033('0x27')](handleError(_0x34ad5b,null));};exports[_0x5033('0x34')]=function(_0x4897eb,_0x3498ed){return db[_0x5033('0x39')]['find']({'where':{'id':_0x4897eb[_0x5033('0x52')]['id']}})[_0x5033('0x1c')](handleEntityNotFound(_0x3498ed,null))['then'](removeEntity(_0x3498ed,null))['catch'](handleError(_0x3498ed,null));};exports[_0x5033('0x58')]=function(_0xef6d11,_0x1cdde3,_0x290150){var _0x119d64={};var _0xb2fff2={};var _0x890165;var _0x2ff4d7;return db[_0x5033('0x39')][_0x5033('0x59')]({'where':{'id':_0xef6d11['params']['id']}})[_0x5033('0x1c')](handleEntityNotFound(_0x1cdde3,null))['then'](function(_0x258f96){if(_0x258f96){_0x890165=_0x258f96;_0xb2fff2[_0x5033('0x3d')]=_[_0x5033('0x53')](db['FreshsalesConfiguration'][_0x5033('0x3a')]);_0xb2fff2[_0x5033('0x3e')]=_['keys'](_0xef6d11[_0x5033('0x3e')]);_0xb2fff2[_0x5033('0x3f')]=_[_0x5033('0x40')](_0xb2fff2[_0x5033('0x3d')],_0xb2fff2['query']);_0x119d64[_0x5033('0x41')]=_[_0x5033('0x40')](_0xb2fff2[_0x5033('0x3d')],qs[_0x5033('0x42')](_0xef6d11[_0x5033('0x3e')][_0x5033('0x42')]));_0x119d64[_0x5033('0x41')]=_0x119d64[_0x5033('0x41')][_0x5033('0x43')]?_0x119d64[_0x5033('0x41')]:_0xb2fff2[_0x5033('0x3d')];_0x119d64[_0x5033('0x45')]=qs[_0x5033('0x46')](_0xef6d11[_0x5033('0x3e')][_0x5033('0x46')]);_0x119d64[_0x5033('0x4d')]=qs[_0x5033('0x3f')](_[_0x5033('0x47')](_0xef6d11[_0x5033('0x3e')],_0xb2fff2[_0x5033('0x3f')]));if(_0xef6d11[_0x5033('0x3e')][_0x5033('0x48')]){_0x119d64[_0x5033('0x4d')]=_['merge'](_0x119d64[_0x5033('0x4d')],{'$or':_[_0x5033('0x38')](_0x119d64[_0x5033('0x41')],function(_0x13ae2f){var _0x24a399={};_0x24a399[_0x13ae2f]={'$like':'%'+_0xef6d11[_0x5033('0x3e')]['filter']+'%'};return _0x24a399;})});}_0x119d64=_[_0x5033('0x4b')]({},_0x119d64,_0xef6d11['options']);return _0x890165[_0x5033('0x58')](_0x119d64);}})[_0x5033('0x1c')](function(_0xb1bbcd){if(_0xb1bbcd){_0x2ff4d7=_0xb1bbcd[_0x5033('0x43')];if(!_0xef6d11[_0x5033('0x3e')][_0x5033('0x44')]('nolimit')){_0x119d64['limit']=qs[_0x5033('0x2e')](_0xef6d11[_0x5033('0x3e')][_0x5033('0x2e')]);_0x119d64['offset']=qs[_0x5033('0x2d')](_0xef6d11[_0x5033('0x3e')][_0x5033('0x2d')]);}return _0x890165['getConfigurations'](_0x119d64);}})[_0x5033('0x1c')](function(_0x1f9a00){if(_0x1f9a00){return _0x1f9a00?{'count':_0x2ff4d7,'rows':_0x1f9a00}:null;}})['then'](respondWithResult(_0x1cdde3,null))['catch'](handleError(_0x1cdde3,null));};exports[_0x5033('0x5a')]=function(_0x1c25a9,_0x28204a,_0x435558){if(_0x1c25a9[_0x5033('0x57')]['id']){delete _0x1c25a9[_0x5033('0x57')]['id'];}return db[_0x5033('0x39')][_0x5033('0x59')]({'where':{'id':_0x1c25a9[_0x5033('0x52')]['id']}})[_0x5033('0x1c')](handleEntityNotFound(_0x28204a,null))[_0x5033('0x1c')](function(_0x2d6029){if(_0x2d6029){_0x1c25a9[_0x5033('0x57')][_0x5033('0x5b')]=_0x2d6029['id'];_0x1c25a9['body'][_0x5033('0x5c')]=integrations['getSubjects'](_0x1c25a9['body']['channel'],_0x1c25a9[_0x5033('0x57')][_0x5033('0x49')]);_0x1c25a9[_0x5033('0x57')][_0x5033('0x5d')]=integrations[_0x5033('0x5e')](_0x1c25a9[_0x5033('0x57')][_0x5033('0x5f')],_0x1c25a9['body'][_0x5033('0x49')]);return db[_0x5033('0x60')]['create'](_0x1c25a9[_0x5033('0x57')],{'include':[{'model':db[_0x5033('0x61')],'as':_0x5033('0x5c')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x5033('0x1c')](respondWithResult(_0x28204a,null))[_0x5033('0x27')](handleError(_0x28204a,null));};exports[_0x5033('0x62')]=function(_0x32aaf0,_0x4cba62,_0x385475){var _0x1a464f='';var _0x6867fb='';return db['FreshsalesAccount'][_0x5033('0x59')]({'where':{'id':_0x32aaf0[_0x5033('0x52')]['id']},'attributes':['id',_0x5033('0x63'),'remoteUri','apiKey']})[_0x5033('0x1c')](handleEntityNotFound(_0x4cba62,null))['then'](function(_0x53f5b9){if(_0x53f5b9){_0x6867fb=_0x53f5b9[_0x5033('0x63')];_0x1a464f=_0x53f5b9['remoteUri'];var _0x55c6ca=_0x53f5b9[_0x5033('0x64')][_0x5033('0x65')](-0x1);if(_0x55c6ca==='/'){_0x1a464f=_0x1a464f[_0x5033('0x66')](0x0,_0x1a464f[_0x5033('0x67')](_0x55c6ca));}return rp({'method':_0x5033('0x68'),'uri':util[_0x5033('0x69')](_0x5033('0x6a'),_0x1a464f,_0x5033('0x6b')),'headers':{'Authorization':_0x5033('0x6c')+_0x53f5b9['apiKey']},'json':!![]});}})[_0x5033('0x1c')](function(_0x44020d){if(_0x44020d){var _0x54fa37=_0x44020d[_0x5033('0x6d')];var _0x1e53b2=![];var _0x405db7=null;for(_0x405db7=0x0;_0x405db7<_0x54fa37[_0x5033('0x43')];_0x405db7++){if(_0x54fa37[_0x405db7][_0x5033('0x6e')]===_0x6867fb){_0x1e53b2=!![];}}if(_0x1e53b2){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5033('0x6f')});}}})[_0x5033('0x1c')](respondWithResult(_0x4cba62,null))[_0x5033('0x27')](function(_0x5b1901){var _0xec2566=_0x32aaf0[_0x5033('0x3e')]['test']?0x1f4:_0x5b1901[_0x5033('0x70')]||0x1f4;logger[_0x5033('0x23')](_0x5033('0x71'),_0x5033('0x62'),_0xec2566,JSON[_0x5033('0x22')](_0x5b1901));delete _0x5b1901[_0x5033('0x36')];if(_0xec2566===0x191){_0xec2566=0x190;}_0x4cba62[_0x5033('0x29')](_0xec2566)[_0x5033('0x37')](_0x32aaf0['query'][_0x5033('0x1a')]?{'message':_0x5033('0x72'),'statusCode':_0x5b1901[_0x5033('0x70')]}:_0x5b1901);});}; \ No newline at end of file +var _0x67ba=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','client','http','test','Sequelize','ValidationError','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','VIRTUAL','options','where','include','findAll','params','rawAttributes','intersection','includeAll','find','create','body','update','merge','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js'];(function(_0x2bd211,_0x522300){var _0x5b963e=function(_0x553314){while(--_0x553314){_0x2bd211['push'](_0x2bd211['shift']());}};_0x5b963e(++_0x522300);}(_0x67ba,0xd3));var _0xa67b=function(_0x154907,_0x266131){_0x154907=_0x154907-0x0;var _0x22f181=_0x67ba[_0x154907];return _0x22f181;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa67b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa67b('0x1'));var jsonpatch=require(_0xa67b('0x2'));var rp=require(_0xa67b('0x3'));var moment=require(_0xa67b('0x4'));var BPromise=require(_0xa67b('0x5'));var Mustache=require(_0xa67b('0x6'));var util=require(_0xa67b('0x7'));var path=require(_0xa67b('0x8'));var sox=require(_0xa67b('0x9'));var csv=require('to-csv');var ejs=require(_0xa67b('0xa'));var fs=require('fs');var _=require(_0xa67b('0xb'));var squel=require(_0xa67b('0xc'));var crypto=require(_0xa67b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa67b('0xe'));var toCsv=require(_0xa67b('0xf'));var querystring=require(_0xa67b('0x10'));var Papa=require(_0xa67b('0x11'));var Redis=require(_0xa67b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa67b('0x13'));var as=require(_0xa67b('0x14'));var hardwareService=require(_0xa67b('0x15'));var logger=require('../../config/logger')(_0xa67b('0x16'));var utils=require(_0xa67b('0x17'));var config=require(_0xa67b('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xa67b('0x19')][_0xa67b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x14b054,_0x3043bd,_0x50bc3e){if(_0x50bc3e){var _0x539a27=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x539a27[_0xa67b('0x1b')](_0x3043bd)){return _0x14b054;}else{throw new db[(_0xa67b('0x1c'))][(_0xa67b('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 _0x14b054;}}function respondWithRpcPromise(_0x336244,_0x7b3eec,_0x219999,_0xbb4114){return new BPromise(function(_0x25d8f7,_0x2146dd){var _0x4a91c0=_0xbb4114||client;return _0x4a91c0['request'](_0x336244,_0x219999)[_0xa67b('0x1e')](function(_0x52de60){logger[_0xa67b('0x1f')](_0xa67b('0x20'),_0x7b3eec,_0xa67b('0x21'));logger[_0xa67b('0x22')](_0xa67b('0x23'),_0x7b3eec,_0xa67b('0x21'),JSON[_0xa67b('0x24')](_0x52de60));if(_0x52de60['error']){if(_0x52de60[_0xa67b('0x25')]['code']===0x1f4){logger[_0xa67b('0x25')](_0xa67b('0x20'),_0x7b3eec,_0x52de60[_0xa67b('0x25')][_0xa67b('0x26')]);return _0x2146dd(_0x52de60['error'][_0xa67b('0x26')]);}logger[_0xa67b('0x25')](_0xa67b('0x20'),_0x7b3eec,_0x52de60[_0xa67b('0x25')][_0xa67b('0x26')]);return _0x25d8f7(_0x52de60[_0xa67b('0x25')][_0xa67b('0x26')]);}else{logger[_0xa67b('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x7b3eec,_0xa67b('0x21'));_0x25d8f7(_0x52de60['result'][_0xa67b('0x26')]);}})[_0xa67b('0x27')](function(_0x45343e){logger['error'](_0xa67b('0x20'),_0x7b3eec,_0x45343e);_0x2146dd(_0x45343e);});});}function respondWithStatusCode(_0x93f5a3,_0x1fddf8){_0x1fddf8=_0x1fddf8||0xcc;return function(_0x50d7e9){if(_0x50d7e9){return _0x93f5a3['sendStatus'](_0x1fddf8);}return _0x93f5a3[_0xa67b('0x28')](_0x1fddf8)[_0xa67b('0x29')]();};}function respondWithResult(_0x13bd3c,_0x703437){_0x703437=_0x703437||0xc8;return function(_0x373767){if(_0x373767){return _0x13bd3c[_0xa67b('0x28')](_0x703437)[_0xa67b('0x2a')](_0x373767);}};}function respondWithFilteredResult(_0x13208c,_0x5bd825){return function(_0x543fbb){if(_0x543fbb){var _0x3f0858=_0x543fbb[_0xa67b('0x2b')],_0xcec8eb=_0x5bd825[_0xa67b('0x2c')],_0x6d14cd=_0x5bd825[_0xa67b('0x2c')]+_0x5bd825['limit'],_0x2f53e4;if(_0x6d14cd>=_0x3f0858){_0x6d14cd=_0x3f0858;_0x2f53e4=0xc8;}else{_0x2f53e4=0xce;}_0x13208c[_0xa67b('0x28')](_0x2f53e4);return _0x13208c[_0xa67b('0x2d')](_0xa67b('0x2e'),_0xcec8eb+'-'+_0x6d14cd+'/'+_0x3f0858)['json'](_0x543fbb);}return null;};}function patchUpdates(_0x7cb42d){return function(_0x415ed7){try{jsonpatch[_0xa67b('0x2f')](_0x415ed7,_0x7cb42d,!![]);}catch(_0x12ea11){return BPromise[_0xa67b('0x30')](_0x12ea11);}return _0x415ed7[_0xa67b('0x31')]();};}function saveUpdates(_0x2efafd,_0x4af09c){return function(_0xed8b5){if(_0xed8b5){return _0xed8b5['update'](_0x2efafd)[_0xa67b('0x1e')](function(_0x3fc7cf){return _0x3fc7cf;});}return null;};}function removeEntity(_0x4598d6,_0x177538){return function(_0x395195){if(_0x395195){return _0x395195[_0xa67b('0x32')]()[_0xa67b('0x1e')](function(){_0x4598d6[_0xa67b('0x28')](0xcc)[_0xa67b('0x29')]();});}};}function handleEntityNotFound(_0x110568,_0x5d58a7){return function(_0x9bef8e){if(!_0x9bef8e){_0x110568['sendStatus'](0x194);}return _0x9bef8e;};}function handleError(_0x27202,_0x627b44){_0x627b44=_0x627b44||0x1f4;return function(_0x3215bf){logger['error'](_0x3215bf[_0xa67b('0x33')]);if(_0x3215bf[_0xa67b('0x34')]){delete _0x3215bf[_0xa67b('0x34')];}_0x27202[_0xa67b('0x28')](_0x627b44)[_0xa67b('0x35')](_0x3215bf);};}exports[_0xa67b('0x36')]=function(_0x1b9744,_0x328d75){var _0x3a887f={},_0xe74ba2={},_0x3d430d={'count':0x0,'rows':[]};var _0x432e12=_[_0xa67b('0x37')](db[_0xa67b('0x38')]['rawAttributes'],function(_0x3de048){return{'name':_0x3de048[_0xa67b('0x39')],'type':_0x3de048[_0xa67b('0x3a')][_0xa67b('0x3b')]};});_0xe74ba2[_0xa67b('0x3c')]=_['map'](_0x432e12,_0xa67b('0x34'));_0xe74ba2[_0xa67b('0x3d')]=_[_0xa67b('0x3e')](_0x1b9744[_0xa67b('0x3d')]);_0xe74ba2['filters']=_['intersection'](_0xe74ba2[_0xa67b('0x3c')],_0xe74ba2[_0xa67b('0x3d')]);_0x3a887f[_0xa67b('0x3f')]=_['intersection'](_0xe74ba2['model'],qs[_0xa67b('0x40')](_0x1b9744[_0xa67b('0x3d')][_0xa67b('0x40')]));_0x3a887f[_0xa67b('0x3f')]=_0x3a887f[_0xa67b('0x3f')][_0xa67b('0x41')]?_0x3a887f[_0xa67b('0x3f')]:_0xe74ba2[_0xa67b('0x3c')];if(!_0x1b9744['query'][_0xa67b('0x42')](_0xa67b('0x43'))){_0x3a887f['limit']=qs['limit'](_0x1b9744[_0xa67b('0x3d')][_0xa67b('0x44')]);_0x3a887f[_0xa67b('0x2c')]=qs[_0xa67b('0x2c')](_0x1b9744[_0xa67b('0x3d')][_0xa67b('0x2c')]);}_0x3a887f[_0xa67b('0x45')]=qs[_0xa67b('0x46')](_0x1b9744[_0xa67b('0x3d')][_0xa67b('0x46')]);_0x3a887f['where']=qs[_0xa67b('0x47')](_[_0xa67b('0x48')](_0x1b9744['query'],_0xe74ba2['filters']),_0x432e12);if(_0x1b9744[_0xa67b('0x3d')][_0xa67b('0x49')]){_0x3a887f['where']=_['merge'](_0x3a887f['where'],{'$or':_[_0xa67b('0x37')](_0x432e12,function(_0x6ee7a0){if(_0x6ee7a0[_0xa67b('0x3a')]!==_0xa67b('0x4a')){var _0x421dbb={};_0x421dbb[_0x6ee7a0[_0xa67b('0x34')]]={'$like':'%'+_0x1b9744[_0xa67b('0x3d')][_0xa67b('0x49')]+'%'};return _0x421dbb;}})});}_0x3a887f=_['merge']({},_0x3a887f,_0x1b9744[_0xa67b('0x4b')]);var _0x4de336={'where':_0x3a887f[_0xa67b('0x4c')]};return db['FreshsalesAccount'][_0xa67b('0x2b')](_0x4de336)[_0xa67b('0x1e')](function(_0x52804c){_0x3d430d['count']=_0x52804c;if(_0x1b9744[_0xa67b('0x3d')]['includeAll']){_0x3a887f[_0xa67b('0x4d')]=[{'all':!![]}];}return db[_0xa67b('0x38')][_0xa67b('0x4e')](_0x3a887f);})[_0xa67b('0x1e')](function(_0xc3029d){_0x3d430d['rows']=_0xc3029d;return _0x3d430d;})[_0xa67b('0x1e')](respondWithFilteredResult(_0x328d75,_0x3a887f))[_0xa67b('0x27')](handleError(_0x328d75,null));};exports['show']=function(_0x670eb9,_0x3b58a3){var _0x40c089={'raw':![],'where':{'id':_0x670eb9[_0xa67b('0x4f')]['id']}},_0x42453b={};_0x42453b[_0xa67b('0x3c')]=_[_0xa67b('0x3e')](db['FreshsalesAccount'][_0xa67b('0x50')]);_0x42453b[_0xa67b('0x3d')]=_[_0xa67b('0x3e')](_0x670eb9[_0xa67b('0x3d')]);_0x42453b[_0xa67b('0x47')]=_[_0xa67b('0x51')](_0x42453b[_0xa67b('0x3c')],_0x42453b[_0xa67b('0x3d')]);_0x40c089[_0xa67b('0x3f')]=_[_0xa67b('0x51')](_0x42453b['model'],qs['fields'](_0x670eb9[_0xa67b('0x3d')]['fields']));_0x40c089[_0xa67b('0x3f')]=_0x40c089['attributes']['length']?_0x40c089[_0xa67b('0x3f')]:_0x42453b['model'];if(_0x670eb9[_0xa67b('0x3d')][_0xa67b('0x52')]){_0x40c089[_0xa67b('0x4d')]=[{'all':!![]}];}_0x40c089=_['merge']({},_0x40c089,_0x670eb9[_0xa67b('0x4b')]);return db['FreshsalesAccount'][_0xa67b('0x53')](_0x40c089)[_0xa67b('0x1e')](handleEntityNotFound(_0x3b58a3,null))['then'](respondWithResult(_0x3b58a3,null))['catch'](handleError(_0x3b58a3,null));};exports[_0xa67b('0x54')]=function(_0x47ca63,_0x3938ea){return db[_0xa67b('0x38')]['create'](_0x47ca63[_0xa67b('0x55')],{})[_0xa67b('0x1e')](respondWithResult(_0x3938ea,0xc9))['catch'](handleError(_0x3938ea,null));};exports[_0xa67b('0x56')]=function(_0x139f64,_0x1dc054){if(_0x139f64[_0xa67b('0x55')]['id']){delete _0x139f64['body']['id'];}return db['FreshsalesAccount'][_0xa67b('0x53')]({'where':{'id':_0x139f64[_0xa67b('0x4f')]['id']}})[_0xa67b('0x1e')](handleEntityNotFound(_0x1dc054,null))[_0xa67b('0x1e')](saveUpdates(_0x139f64[_0xa67b('0x55')],null))[_0xa67b('0x1e')](respondWithResult(_0x1dc054,null))[_0xa67b('0x27')](handleError(_0x1dc054,null));};exports[_0xa67b('0x32')]=function(_0x5125d6,_0x43acf9){return db[_0xa67b('0x38')][_0xa67b('0x53')]({'where':{'id':_0x5125d6[_0xa67b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x43acf9,null))[_0xa67b('0x1e')](removeEntity(_0x43acf9,null))[_0xa67b('0x27')](handleError(_0x43acf9,null));};exports['getConfigurations']=function(_0x9e348,_0x5dd5f1,_0x5ce25f){var _0x50ea63={};var _0x1c0c79={};var _0x3bdc07;var _0x1c9edd;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x9e348[_0xa67b('0x4f')]['id']}})[_0xa67b('0x1e')](handleEntityNotFound(_0x5dd5f1,null))[_0xa67b('0x1e')](function(_0x359b9b){if(_0x359b9b){_0x3bdc07=_0x359b9b;_0x1c0c79[_0xa67b('0x3c')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x1c0c79[_0xa67b('0x3d')]=_[_0xa67b('0x3e')](_0x9e348[_0xa67b('0x3d')]);_0x1c0c79[_0xa67b('0x47')]=_[_0xa67b('0x51')](_0x1c0c79[_0xa67b('0x3c')],_0x1c0c79[_0xa67b('0x3d')]);_0x50ea63[_0xa67b('0x3f')]=_[_0xa67b('0x51')](_0x1c0c79['model'],qs[_0xa67b('0x40')](_0x9e348[_0xa67b('0x3d')][_0xa67b('0x40')]));_0x50ea63[_0xa67b('0x3f')]=_0x50ea63[_0xa67b('0x3f')]['length']?_0x50ea63[_0xa67b('0x3f')]:_0x1c0c79['model'];_0x50ea63[_0xa67b('0x45')]=qs['sort'](_0x9e348[_0xa67b('0x3d')][_0xa67b('0x46')]);_0x50ea63[_0xa67b('0x4c')]=qs[_0xa67b('0x47')](_[_0xa67b('0x48')](_0x9e348[_0xa67b('0x3d')],_0x1c0c79['filters']));if(_0x9e348[_0xa67b('0x3d')][_0xa67b('0x49')]){_0x50ea63[_0xa67b('0x4c')]=_[_0xa67b('0x57')](_0x50ea63[_0xa67b('0x4c')],{'$or':_[_0xa67b('0x37')](_0x50ea63['attributes'],function(_0x2d8fae){var _0x17ddcc={};_0x17ddcc[_0x2d8fae]={'$like':'%'+_0x9e348[_0xa67b('0x3d')][_0xa67b('0x49')]+'%'};return _0x17ddcc;})});}_0x50ea63=_[_0xa67b('0x57')]({},_0x50ea63,_0x9e348[_0xa67b('0x4b')]);return _0x3bdc07[_0xa67b('0x58')](_0x50ea63);}})[_0xa67b('0x1e')](function(_0x114565){if(_0x114565){_0x1c9edd=_0x114565[_0xa67b('0x41')];if(!_0x9e348[_0xa67b('0x3d')][_0xa67b('0x42')](_0xa67b('0x43'))){_0x50ea63[_0xa67b('0x44')]=qs[_0xa67b('0x44')](_0x9e348[_0xa67b('0x3d')][_0xa67b('0x44')]);_0x50ea63['offset']=qs[_0xa67b('0x2c')](_0x9e348[_0xa67b('0x3d')][_0xa67b('0x2c')]);}return _0x3bdc07[_0xa67b('0x58')](_0x50ea63);}})[_0xa67b('0x1e')](function(_0x1c1e6b){if(_0x1c1e6b){return _0x1c1e6b?{'count':_0x1c9edd,'rows':_0x1c1e6b}:null;}})[_0xa67b('0x1e')](respondWithResult(_0x5dd5f1,null))['catch'](handleError(_0x5dd5f1,null));};exports[_0xa67b('0x59')]=function(_0x333236,_0x3ad10e,_0x4fca64){if(_0x333236[_0xa67b('0x55')]['id']){delete _0x333236[_0xa67b('0x55')]['id'];}return db[_0xa67b('0x38')][_0xa67b('0x5a')]({'where':{'id':_0x333236['params']['id']}})['then'](handleEntityNotFound(_0x3ad10e,null))[_0xa67b('0x1e')](function(_0x55db59){if(_0x55db59){_0x333236[_0xa67b('0x55')]['AccountId']=_0x55db59['id'];_0x333236[_0xa67b('0x55')][_0xa67b('0x5b')]=integrations[_0xa67b('0x5c')](_0x333236[_0xa67b('0x55')][_0xa67b('0x5d')],_0x333236['body'][_0xa67b('0x3a')]);_0x333236[_0xa67b('0x55')][_0xa67b('0x5e')]=integrations[_0xa67b('0x5f')](_0x333236[_0xa67b('0x55')][_0xa67b('0x5d')],_0x333236[_0xa67b('0x55')][_0xa67b('0x3a')]);return db[_0xa67b('0x60')][_0xa67b('0x54')](_0x333236[_0xa67b('0x55')],{'include':[{'model':db[_0xa67b('0x61')],'as':_0xa67b('0x5b')},{'model':db[_0xa67b('0x61')],'as':_0xa67b('0x5e')}]});}return null;})[_0xa67b('0x1e')](respondWithResult(_0x3ad10e,null))[_0xa67b('0x27')](handleError(_0x3ad10e,null));};exports[_0xa67b('0x62')]=function(_0x54d128,_0x4ecdc7,_0xad29f2){var _0x41c6d6='';var _0x1b3c9b='';return db[_0xa67b('0x38')][_0xa67b('0x5a')]({'where':{'id':_0x54d128['params']['id']},'attributes':['id',_0xa67b('0x63'),_0xa67b('0x64'),_0xa67b('0x65')]})[_0xa67b('0x1e')](handleEntityNotFound(_0x4ecdc7,null))[_0xa67b('0x1e')](function(_0x115953){if(_0x115953){_0x1b3c9b=_0x115953[_0xa67b('0x63')];_0x41c6d6=_0x115953[_0xa67b('0x64')];var _0x5141d5=_0x115953[_0xa67b('0x64')][_0xa67b('0x66')](-0x1);if(_0x5141d5==='/'){_0x41c6d6=_0x41c6d6[_0xa67b('0x67')](0x0,_0x41c6d6[_0xa67b('0x68')](_0x5141d5));}return rp({'method':_0xa67b('0x69'),'uri':util[_0xa67b('0x6a')](_0xa67b('0x6b'),_0x41c6d6,'/api/selector/owners'),'headers':{'Authorization':_0xa67b('0x6c')+_0x115953[_0xa67b('0x65')]},'json':!![]});}})['then'](function(_0x535124){if(_0x535124){var _0x1ad499=_0x535124['users'];var _0x11516c=![];var _0x42073e=null;for(_0x42073e=0x0;_0x42073e<_0x1ad499[_0xa67b('0x41')];_0x42073e++){if(_0x1ad499[_0x42073e][_0xa67b('0x6d')]===_0x1b3c9b){_0x11516c=!![];}}if(_0x11516c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa67b('0x6e')});}}})[_0xa67b('0x1e')](respondWithResult(_0x4ecdc7,null))[_0xa67b('0x27')](function(_0x551c1d){var _0x261e08=_0x54d128[_0xa67b('0x3d')][_0xa67b('0x1b')]?0x1f4:_0x551c1d[_0xa67b('0x6f')]||0x1f4;logger['error'](_0xa67b('0x70'),_0xa67b('0x62'),_0x261e08,JSON['stringify'](_0x551c1d));delete _0x551c1d[_0xa67b('0x34')];if(_0x261e08===0x191){_0x261e08=0x190;}_0x4ecdc7[_0xa67b('0x28')](_0x261e08)[_0xa67b('0x35')](_0x54d128[_0xa67b('0x3d')][_0xa67b('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x551c1d[_0xa67b('0x6f')]}:_0x551c1d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7cb0e3c..664eaa3 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 _0xe107=['define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0xe107,0xb3));var _0x7e10=function(_0x1e2891,_0x3175d3){_0x1e2891=_0x1e2891-0x0;var _0x242719=_0xe107[_0x1e2891];return _0x242719;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));var integrations=require(_0x7e10('0x7'));module['exports']=function(_0x5f1edf,_0x1dd3de){return _0x5f1edf[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x9a19,0x114));var _0x99a1=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x9a19[_0x27beea];return _0x122645;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));var integrations=require(_0x99a1('0xa'));module[_0x99a1('0xb')]=function(_0xff0240,_0x65045d){return _0xff0240['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index ae12311..1af5c93 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 _0xdfdd=['catch','FreshsalesAccount','findAll','options','raw','where','limit','map','include','model','attributes','GetFreshsalesAccount','debug','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x59db34,_0x593726){var _0x568a53=function(_0x2bf3b4){while(--_0x2bf3b4){_0x59db34['push'](_0x59db34['shift']());}};_0x568a53(++_0x593726);}(_0xdfdd,0x104));var _0xddfd=function(_0x4dcb38,_0x4cdd7f){_0x4dcb38=_0x4dcb38-0x0;var _0x40dafa=_0xdfdd[_0x4dcb38];return _0x40dafa;};'use strict';var _=require(_0xddfd('0x0'));var util=require(_0xddfd('0x1'));var moment=require(_0xddfd('0x2'));var BPromise=require(_0xddfd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddfd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xddfd('0x5'));var logger=require('../../config/logger')(_0xddfd('0x6'));var config=require(_0xddfd('0x7'));var jayson=require(_0xddfd('0x8'));var client=jayson[_0xddfd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25fcbc,_0x485ede,_0x2e8f21){return new BPromise(function(_0x45bdd0,_0xf134d7){return client[_0xddfd('0xa')](_0x25fcbc,_0x2e8f21)[_0xddfd('0xb')](function(_0x2a3b1e){logger['info'](_0xddfd('0xc'),_0x485ede,_0xddfd('0xd'));logger['debug'](_0xddfd('0xe'),_0x485ede,_0xddfd('0xd'),JSON[_0xddfd('0xf')](_0x2a3b1e));if(_0x2a3b1e[_0xddfd('0x10')]){if(_0x2a3b1e[_0xddfd('0x10')]['code']===0x1f4){logger[_0xddfd('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x485ede,_0x2a3b1e[_0xddfd('0x10')]['message']);return _0xf134d7(_0x2a3b1e[_0xddfd('0x10')]['message']);}logger[_0xddfd('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x485ede,_0x2a3b1e[_0xddfd('0x10')][_0xddfd('0x11')]);return _0x45bdd0(_0x2a3b1e[_0xddfd('0x10')][_0xddfd('0x11')]);}else{logger[_0xddfd('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x485ede,_0xddfd('0xd'));_0x45bdd0(_0x2a3b1e[_0xddfd('0x13')][_0xddfd('0x11')]);}})[_0xddfd('0x14')](function(_0xa85d01){logger[_0xddfd('0x10')](_0xddfd('0xc'),_0x485ede,_0xa85d01);_0xf134d7(_0xa85d01);});});}exports['GetFreshsalesAccount']=function(_0x578f43){var _0x33c48e=this;return new Promise(function(_0x260dba,_0x2bc921){return db[_0xddfd('0x15')][_0xddfd('0x16')]({'raw':_0x578f43['options']?_0x578f43[_0xddfd('0x17')][_0xddfd('0x18')]===undefined?!![]:![]:!![],'where':_0x578f43[_0xddfd('0x17')]?_0x578f43[_0xddfd('0x17')][_0xddfd('0x19')]||null:null,'attributes':_0x578f43[_0xddfd('0x17')]?_0x578f43['options']['attributes']||null:null,'limit':_0x578f43['options']?_0x578f43[_0xddfd('0x17')][_0xddfd('0x1a')]||null:null,'include':_0x578f43[_0xddfd('0x17')]?_0x578f43[_0xddfd('0x17')]['include']?_[_0xddfd('0x1b')](_0x578f43[_0xddfd('0x17')][_0xddfd('0x1c')],function(_0x68caf6){return{'model':db[_0x68caf6[_0xddfd('0x1d')]],'as':_0x68caf6['as'],'attributes':_0x68caf6['attributes'],'include':_0x68caf6[_0xddfd('0x1c')]?_[_0xddfd('0x1b')](_0x68caf6[_0xddfd('0x1c')],function(_0x1dd7f3){return{'model':db[_0x1dd7f3['model']],'as':_0x1dd7f3['as'],'attributes':_0x1dd7f3['attributes'],'include':_0x1dd7f3['include']?_[_0xddfd('0x1b')](_0x1dd7f3['include'],function(_0xeb19b1){return{'model':db[_0xeb19b1[_0xddfd('0x1d')]],'as':_0xeb19b1['as'],'attributes':_0xeb19b1[_0xddfd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xddfd('0xb')](function(_0x3fb12c){logger['info'](_0xddfd('0x1f'),_0x578f43);logger[_0xddfd('0x20')](_0xddfd('0x1f'),_0x578f43,JSON[_0xddfd('0xf')](_0x3fb12c));_0x260dba(_0x3fb12c);})[_0xddfd('0x14')](function(_0x2baf5d){logger[_0xddfd('0x10')](_0xddfd('0x1f'),_0x2baf5d[_0xddfd('0x11')],_0x578f43);_0x2bc921(_0x33c48e['error'](0x1f4,_0x2baf5d[_0xddfd('0x11')]));});});};exports[_0xddfd('0x21')]=function(_0x4dcf94){var _0x3375d1=this;return new Promise(function(_0xf5d766,_0x279dd3){return db['FreshsalesAccount'][_0xddfd('0x22')]({'raw':_0x4dcf94['options']?_0x4dcf94[_0xddfd('0x17')][_0xddfd('0x18')]===undefined?!![]:![]:!![],'where':_0x4dcf94[_0xddfd('0x17')]?_0x4dcf94[_0xddfd('0x17')][_0xddfd('0x19')]||null:null,'attributes':_0x4dcf94['options']?_0x4dcf94[_0xddfd('0x17')]['attributes']||null:null,'include':_0x4dcf94['options']?_0x4dcf94[_0xddfd('0x17')]['include']?_[_0xddfd('0x1b')](_0x4dcf94[_0xddfd('0x17')][_0xddfd('0x1c')],function(_0x194d31){return{'model':db[_0x194d31[_0xddfd('0x1d')]],'as':_0x194d31['as'],'attributes':_0x194d31[_0xddfd('0x1e')],'include':_0x194d31[_0xddfd('0x1c')]?_['map'](_0x194d31[_0xddfd('0x1c')],function(_0x44a21b){return{'model':db[_0x44a21b[_0xddfd('0x1d')]],'as':_0x44a21b['as'],'attributes':_0x44a21b[_0xddfd('0x1e')],'include':_0x44a21b[_0xddfd('0x1c')]?_['map'](_0x44a21b['include'],function(_0x47bcf0){return{'model':db[_0x47bcf0[_0xddfd('0x1d')]],'as':_0x47bcf0['as'],'attributes':_0x47bcf0['attributes']};}):[]};}):[]};}):[]:[]})[_0xddfd('0xb')](function(_0x3700b8){logger['info'](_0xddfd('0x21'),_0x4dcf94);logger[_0xddfd('0x20')](_0xddfd('0x21'),_0x4dcf94,JSON[_0xddfd('0xf')](_0x3700b8));_0xf5d766(_0x3700b8);})[_0xddfd('0x14')](function(_0x47321a){logger[_0xddfd('0x10')]('ShowFreshsalesAccount',_0x47321a[_0xddfd('0x11')],_0x4dcf94);_0x279dd3(_0x3375d1[_0xddfd('0x10')](0x1f4,_0x47321a[_0xddfd('0x11')]));});});}; \ No newline at end of file +var _0x8f1a=['stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x41366f,_0x39875f){_0x41366f=_0x41366f-0x0;var _0x51b6ac=_0x8f1a[_0x41366f];return _0x51b6ac;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var moment=require(_0xa8f1('0x2'));var BPromise=require(_0xa8f1('0x3'));var rs=require(_0xa8f1('0x4'));var fs=require('fs');var Redis=require(_0xa8f1('0x5'));var db=require(_0xa8f1('0x6'))['db'];var utils=require(_0xa8f1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8f1('0x9')][_0xa8f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c2920,_0x43c3ed,_0x13f210){return new BPromise(function(_0xcc8a38,_0x36b58b){return client[_0xa8f1('0xb')](_0x4c2920,_0x13f210)[_0xa8f1('0xc')](function(_0x1a23a0){logger[_0xa8f1('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x43c3ed,_0xa8f1('0xe'));logger[_0xa8f1('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x43c3ed,_0xa8f1('0xe'),JSON['stringify'](_0x1a23a0));if(_0x1a23a0[_0xa8f1('0x10')]){if(_0x1a23a0[_0xa8f1('0x10')][_0xa8f1('0x11')]===0x1f4){logger['error'](_0xa8f1('0x12'),_0x43c3ed,_0x1a23a0[_0xa8f1('0x10')][_0xa8f1('0x13')]);return _0x36b58b(_0x1a23a0[_0xa8f1('0x10')][_0xa8f1('0x13')]);}logger['error'](_0xa8f1('0x12'),_0x43c3ed,_0x1a23a0['error'][_0xa8f1('0x13')]);return _0xcc8a38(_0x1a23a0[_0xa8f1('0x10')]['message']);}else{logger['info'](_0xa8f1('0x12'),_0x43c3ed,_0xa8f1('0xe'));_0xcc8a38(_0x1a23a0[_0xa8f1('0x14')][_0xa8f1('0x13')]);}})[_0xa8f1('0x15')](function(_0x15bfad){logger[_0xa8f1('0x10')](_0xa8f1('0x12'),_0x43c3ed,_0x15bfad);_0x36b58b(_0x15bfad);});});}exports[_0xa8f1('0x16')]=function(_0x124917){var _0x453532=this;return new Promise(function(_0x2ea505,_0x8b7ed1){return db[_0xa8f1('0x17')]['findAll']({'raw':_0x124917['options']?_0x124917[_0xa8f1('0x18')][_0xa8f1('0x19')]===undefined?!![]:![]:!![],'where':_0x124917[_0xa8f1('0x18')]?_0x124917['options'][_0xa8f1('0x1a')]||null:null,'attributes':_0x124917[_0xa8f1('0x18')]?_0x124917[_0xa8f1('0x18')][_0xa8f1('0x1b')]||null:null,'limit':_0x124917[_0xa8f1('0x18')]?_0x124917['options'][_0xa8f1('0x1c')]||null:null,'include':_0x124917[_0xa8f1('0x18')]?_0x124917['options'][_0xa8f1('0x1d')]?_[_0xa8f1('0x1e')](_0x124917[_0xa8f1('0x18')][_0xa8f1('0x1d')],function(_0x2306ec){return{'model':db[_0x2306ec[_0xa8f1('0x1f')]],'as':_0x2306ec['as'],'attributes':_0x2306ec[_0xa8f1('0x1b')],'include':_0x2306ec[_0xa8f1('0x1d')]?_[_0xa8f1('0x1e')](_0x2306ec['include'],function(_0x3966b6){return{'model':db[_0x3966b6[_0xa8f1('0x1f')]],'as':_0x3966b6['as'],'attributes':_0x3966b6[_0xa8f1('0x1b')],'include':_0x3966b6[_0xa8f1('0x1d')]?_[_0xa8f1('0x1e')](_0x3966b6['include'],function(_0x3eda99){return{'model':db[_0x3eda99[_0xa8f1('0x1f')]],'as':_0x3eda99['as'],'attributes':_0x3eda99['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x528cc4){logger[_0xa8f1('0xd')](_0xa8f1('0x16'),_0x124917);logger['debug']('GetFreshsalesAccount',_0x124917,JSON['stringify'](_0x528cc4));_0x2ea505(_0x528cc4);})[_0xa8f1('0x15')](function(_0x50b089){logger[_0xa8f1('0x10')](_0xa8f1('0x16'),_0x50b089[_0xa8f1('0x13')],_0x124917);_0x8b7ed1(_0x453532[_0xa8f1('0x10')](0x1f4,_0x50b089[_0xa8f1('0x13')]));});});};exports[_0xa8f1('0x20')]=function(_0x179ed0){var _0x3641e2=this;return new Promise(function(_0x3ec18d,_0x12be31){return db['FreshsalesAccount']['find']({'raw':_0x179ed0[_0xa8f1('0x18')]?_0x179ed0[_0xa8f1('0x18')][_0xa8f1('0x19')]===undefined?!![]:![]:!![],'where':_0x179ed0[_0xa8f1('0x18')]?_0x179ed0[_0xa8f1('0x18')][_0xa8f1('0x1a')]||null:null,'attributes':_0x179ed0[_0xa8f1('0x18')]?_0x179ed0[_0xa8f1('0x18')][_0xa8f1('0x1b')]||null:null,'include':_0x179ed0['options']?_0x179ed0['options']['include']?_[_0xa8f1('0x1e')](_0x179ed0[_0xa8f1('0x18')][_0xa8f1('0x1d')],function(_0xf2cff7){return{'model':db[_0xf2cff7[_0xa8f1('0x1f')]],'as':_0xf2cff7['as'],'attributes':_0xf2cff7['attributes'],'include':_0xf2cff7['include']?_[_0xa8f1('0x1e')](_0xf2cff7[_0xa8f1('0x1d')],function(_0x112204){return{'model':db[_0x112204[_0xa8f1('0x1f')]],'as':_0x112204['as'],'attributes':_0x112204[_0xa8f1('0x1b')],'include':_0x112204['include']?_[_0xa8f1('0x1e')](_0x112204[_0xa8f1('0x1d')],function(_0x373696){return{'model':db[_0x373696[_0xa8f1('0x1f')]],'as':_0x373696['as'],'attributes':_0x373696[_0xa8f1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcce489){logger[_0xa8f1('0xd')](_0xa8f1('0x20'),_0x179ed0);logger[_0xa8f1('0xf')](_0xa8f1('0x20'),_0x179ed0,JSON[_0xa8f1('0x21')](_0xcce489));_0x3ec18d(_0xcce489);})['catch'](function(_0x922ba5){logger[_0xa8f1('0x10')]('ShowFreshsalesAccount',_0x922ba5[_0xa8f1('0x13')],_0x179ed0);_0x12be31(_0x3641e2['error'](0x1f4,_0x922ba5[_0xa8f1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6ed914c..64536d8 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 _0x8ad0=['/:id/descriptions','getDescriptions','getFields','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects'];(function(_0x2df2d0,_0x1d6ea8){var _0x3c4438=function(_0x456da2){while(--_0x456da2){_0x2df2d0['push'](_0x2df2d0['shift']());}};_0x3c4438(++_0x1d6ea8);}(_0x8ad0,0xb4));var _0x08ad=function(_0x35aaac,_0x29d994){_0x35aaac=_0x35aaac-0x0;var _0x4e8d17=_0x8ad0[_0x35aaac];return _0x4e8d17;};'use strict';var multer=require(_0x08ad('0x0'));var util=require(_0x08ad('0x1'));var path=require(_0x08ad('0x2'));var timeout=require(_0x08ad('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x08ad('0x4'));router[_0x08ad('0x5')]('/',auth[_0x08ad('0x6')](),controller[_0x08ad('0x7')]);router[_0x08ad('0x5')]('/:id',auth[_0x08ad('0x6')](),controller[_0x08ad('0x8')]);router[_0x08ad('0x5')](_0x08ad('0x9'),auth[_0x08ad('0x6')](),controller['getSubjects']);router[_0x08ad('0x5')](_0x08ad('0xa'),auth['isAuthenticated'](),controller[_0x08ad('0xb')]);router['get']('/:id/fields',auth[_0x08ad('0x6')](),controller[_0x08ad('0xc')]);router[_0x08ad('0xd')]('/',auth[_0x08ad('0x6')](),controller[_0x08ad('0xe')]);router[_0x08ad('0xf')](_0x08ad('0x10'),auth[_0x08ad('0x6')](),controller['update']);router[_0x08ad('0x11')](_0x08ad('0x10'),auth[_0x08ad('0x6')](),controller[_0x08ad('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2a12=['../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x540644,_0x806cb7){var _0x4b022b=function(_0x3cd679){while(--_0x3cd679){_0x540644['push'](_0x540644['shift']());}};_0x4b022b(++_0x806cb7);}(_0x2a12,0x1b2));var _0x22a1=function(_0xd4497b,_0x122302){_0xd4497b=_0xd4497b-0x0;var _0x105f72=_0x2a12[_0xd4497b];return _0x105f72;};'use strict';var multer=require(_0x22a1('0x0'));var util=require(_0x22a1('0x1'));var path=require(_0x22a1('0x2'));var timeout=require(_0x22a1('0x3'));var express=require(_0x22a1('0x4'));var router=express[_0x22a1('0x5')]();var auth=require(_0x22a1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x22a1('0x7'));var controller=require(_0x22a1('0x8'));router[_0x22a1('0x9')]('/',auth[_0x22a1('0xa')](),controller['index']);router[_0x22a1('0x9')]('/:id',auth[_0x22a1('0xa')](),controller['show']);router[_0x22a1('0x9')](_0x22a1('0xb'),auth[_0x22a1('0xa')](),controller[_0x22a1('0xc')]);router[_0x22a1('0x9')](_0x22a1('0xd'),auth['isAuthenticated'](),controller[_0x22a1('0xe')]);router[_0x22a1('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x22a1('0xf')]('/',auth[_0x22a1('0xa')](),controller[_0x22a1('0x10')]);router[_0x22a1('0x11')](_0x22a1('0x12'),auth[_0x22a1('0xa')](),controller[_0x22a1('0x13')]);router[_0x22a1('0x14')]('/:id',auth[_0x22a1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index fe83589..5b4b77f 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 _0x7fad=['sequelize','exports','STRING'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x7fad,0x1d7));var _0xd7fa=function(_0x2ab3d9,_0x50e716){_0x2ab3d9=_0x2ab3d9-0x0;var _0x210a54=_0x7fad[_0x2ab3d9];return _0x210a54;};'use strict';var Sequelize=require(_0xd7fa('0x0'));module[_0xd7fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd7fa('0x2')]}}; \ No newline at end of file +var _0xaefc=['sequelize','exports','STRING'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0xaefc,0xc6));var _0xcaef=function(_0x40550d,_0x5acf92){_0x40550d=_0x40550d-0x0;var _0x2ba8be=_0xaefc[_0x40550d];return _0x2ba8be;};'use strict';var Sequelize=require(_0xcaef('0x0'));module[_0xcaef('0x1')]={'name':{'type':Sequelize[_0xcaef('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 da450a4..cd095d4 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 _0x7084=['FreshsalesField','order','pick','nolimit','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','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','api','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','end','status','count','offset','limit','set','json','apply','reject','save','update','destroy','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','show','params','merge','find','create','body','getSubjects','findOne'];(function(_0x8005f8,_0xd984c1){var _0x594f82=function(_0x25bb49){while(--_0x25bb49){_0x8005f8['push'](_0x8005f8['shift']());}};_0x594f82(++_0xd984c1);}(_0x7084,0x1e6));var _0x4708=function(_0x14bcdf,_0x19c402){_0x14bcdf=_0x14bcdf-0x0;var _0x3605fc=_0x7084[_0x14bcdf];return _0x3605fc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4708('0x0'));var zipdir=require(_0x4708('0x1'));var jsonpatch=require(_0x4708('0x2'));var rp=require('request-promise');var moment=require(_0x4708('0x3'));var BPromise=require(_0x4708('0x4'));var Mustache=require(_0x4708('0x5'));var util=require(_0x4708('0x6'));var path=require(_0x4708('0x7'));var sox=require(_0x4708('0x8'));var csv=require(_0x4708('0x9'));var ejs=require(_0x4708('0xa'));var fs=require('fs');var _=require(_0x4708('0xb'));var squel=require(_0x4708('0xc'));var crypto=require(_0x4708('0xd'));var jsforce=require(_0x4708('0xe'));var deskjs=require(_0x4708('0xf'));var toCsv=require(_0x4708('0x9'));var querystring=require(_0x4708('0x10'));var Papa=require('papaparse');var Redis=require(_0x4708('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4708('0x12'));var as=require(_0x4708('0x13'));var hardwareService=require(_0x4708('0x14'));var logger=require(_0x4708('0x15'))(_0x4708('0x16'));var utils=require('../../config/utils');var config=require(_0x4708('0x17'));var db=require(_0x4708('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4708('0x19')][_0x4708('0x1a')]({'port':0x232a});function checkPasswordPattern(_0xa98e6f,_0x198505,_0x5918d2){if(_0x5918d2){var _0x5f0f05=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5f0f05[_0x4708('0x1b')](_0x198505)){return _0xa98e6f;}else{throw new db[(_0x4708('0x1c'))][(_0x4708('0x1d'))](_0x4708('0x1e'));}}else{return _0xa98e6f;}}function respondWithRpcPromise(_0x5c13a4,_0x5d4852,_0x30df6c,_0xfcaa5f){return new BPromise(function(_0x23fce5,_0x3eb97e){var _0x3ca4f7=_0xfcaa5f||client;return _0x3ca4f7[_0x4708('0x1f')](_0x5c13a4,_0x30df6c)[_0x4708('0x20')](function(_0x4fdcd0){logger['info'](_0x4708('0x21'),_0x5d4852,_0x4708('0x22'));logger[_0x4708('0x23')](_0x4708('0x24'),_0x5d4852,_0x4708('0x22'),JSON[_0x4708('0x25')](_0x4fdcd0));if(_0x4fdcd0[_0x4708('0x26')]){if(_0x4fdcd0[_0x4708('0x26')][_0x4708('0x27')]===0x1f4){logger[_0x4708('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5d4852,_0x4fdcd0[_0x4708('0x26')]['message']);return _0x3eb97e(_0x4fdcd0[_0x4708('0x26')][_0x4708('0x28')]);}logger[_0x4708('0x26')](_0x4708('0x21'),_0x5d4852,_0x4fdcd0[_0x4708('0x26')][_0x4708('0x28')]);return _0x23fce5(_0x4fdcd0[_0x4708('0x26')]['message']);}else{logger[_0x4708('0x29')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5d4852,'request\x20sent');_0x23fce5(_0x4fdcd0[_0x4708('0x2a')][_0x4708('0x28')]);}})[_0x4708('0x2b')](function(_0x456114){logger[_0x4708('0x26')](_0x4708('0x21'),_0x5d4852,_0x456114);_0x3eb97e(_0x456114);});});}function respondWithStatusCode(_0x204179,_0x585abe){_0x585abe=_0x585abe||0xcc;return function(_0x4f45df){if(_0x4f45df){return _0x204179['sendStatus'](_0x585abe);}return _0x204179['status'](_0x585abe)[_0x4708('0x2c')]();};}function respondWithResult(_0x212444,_0x14c609){_0x14c609=_0x14c609||0xc8;return function(_0x2efb58){if(_0x2efb58){return _0x212444[_0x4708('0x2d')](_0x14c609)['json'](_0x2efb58);}};}function respondWithFilteredResult(_0x4ae526,_0x2f3d65){return function(_0x388351){if(_0x388351){var _0xdb0f83=_0x388351[_0x4708('0x2e')],_0xb8b14e=_0x2f3d65['offset'],_0x2bb370=_0x2f3d65[_0x4708('0x2f')]+_0x2f3d65[_0x4708('0x30')],_0x436513;if(_0x2bb370>=_0xdb0f83){_0x2bb370=_0xdb0f83;_0x436513=0xc8;}else{_0x436513=0xce;}_0x4ae526[_0x4708('0x2d')](_0x436513);return _0x4ae526[_0x4708('0x31')]('Content-Range',_0xb8b14e+'-'+_0x2bb370+'/'+_0xdb0f83)[_0x4708('0x32')](_0x388351);}return null;};}function patchUpdates(_0x100ce9){return function(_0x14b6a3){try{jsonpatch[_0x4708('0x33')](_0x14b6a3,_0x100ce9,!![]);}catch(_0x192e3e){return BPromise[_0x4708('0x34')](_0x192e3e);}return _0x14b6a3[_0x4708('0x35')]();};}function saveUpdates(_0x547a31,_0x2bf2af){return function(_0x334250){if(_0x334250){return _0x334250[_0x4708('0x36')](_0x547a31)[_0x4708('0x20')](function(_0x32e17b){return _0x32e17b;});}return null;};}function removeEntity(_0x1e3e83,_0x5680d8){return function(_0x2ee1c5){if(_0x2ee1c5){return _0x2ee1c5[_0x4708('0x37')]()[_0x4708('0x20')](function(){_0x1e3e83[_0x4708('0x2d')](0xcc)[_0x4708('0x2c')]();});}};}function handleEntityNotFound(_0xb33d3e,_0x6fb4b1){return function(_0x2b2f96){if(!_0x2b2f96){_0xb33d3e['sendStatus'](0x194);}return _0x2b2f96;};}function handleError(_0x5180e0,_0x1be437){_0x1be437=_0x1be437||0x1f4;return function(_0x5bdad7){logger[_0x4708('0x26')](_0x5bdad7[_0x4708('0x38')]);if(_0x5bdad7[_0x4708('0x39')]){delete _0x5bdad7[_0x4708('0x39')];}_0x5180e0['status'](_0x1be437)[_0x4708('0x3a')](_0x5bdad7);};}exports['index']=function(_0x44841b,_0x15896e){var _0x534d04={},_0x179dfa={},_0x4ff7be={'count':0x0,'rows':[]};var _0x477d03=_[_0x4708('0x3b')](db[_0x4708('0x3c')][_0x4708('0x3d')],function(_0x1f348a){return{'name':_0x1f348a[_0x4708('0x3e')],'type':_0x1f348a[_0x4708('0x3f')][_0x4708('0x40')]};});_0x179dfa[_0x4708('0x41')]=_[_0x4708('0x3b')](_0x477d03,'name');_0x179dfa[_0x4708('0x42')]=_[_0x4708('0x43')](_0x44841b[_0x4708('0x42')]);_0x179dfa[_0x4708('0x44')]=_[_0x4708('0x45')](_0x179dfa[_0x4708('0x41')],_0x179dfa[_0x4708('0x42')]);_0x534d04[_0x4708('0x46')]=_[_0x4708('0x45')](_0x179dfa['model'],qs[_0x4708('0x47')](_0x44841b[_0x4708('0x42')][_0x4708('0x47')]));_0x534d04['attributes']=_0x534d04[_0x4708('0x46')][_0x4708('0x48')]?_0x534d04[_0x4708('0x46')]:_0x179dfa[_0x4708('0x41')];if(!_0x44841b[_0x4708('0x42')][_0x4708('0x49')]('nolimit')){_0x534d04['limit']=qs['limit'](_0x44841b[_0x4708('0x42')][_0x4708('0x30')]);_0x534d04['offset']=qs['offset'](_0x44841b[_0x4708('0x42')][_0x4708('0x2f')]);}_0x534d04['order']=qs[_0x4708('0x4a')](_0x44841b[_0x4708('0x42')][_0x4708('0x4a')]);_0x534d04[_0x4708('0x4b')]=qs[_0x4708('0x44')](_['pick'](_0x44841b[_0x4708('0x42')],_0x179dfa[_0x4708('0x44')]),_0x477d03);if(_0x44841b['query']['filter']){_0x534d04[_0x4708('0x4b')]=_['merge'](_0x534d04['where'],{'$or':_[_0x4708('0x3b')](_0x477d03,function(_0x581f92){if(_0x581f92[_0x4708('0x3f')]!==_0x4708('0x4c')){var _0x30d41c={};_0x30d41c[_0x581f92[_0x4708('0x39')]]={'$like':'%'+_0x44841b['query'][_0x4708('0x4d')]+'%'};return _0x30d41c;}})});}_0x534d04=_['merge']({},_0x534d04,_0x44841b[_0x4708('0x4e')]);var _0x443385={'where':_0x534d04[_0x4708('0x4b')]};return db[_0x4708('0x3c')]['count'](_0x443385)[_0x4708('0x20')](function(_0x3357cf){_0x4ff7be[_0x4708('0x2e')]=_0x3357cf;if(_0x44841b[_0x4708('0x42')][_0x4708('0x4f')]){_0x534d04[_0x4708('0x50')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x4708('0x51')](_0x534d04);})[_0x4708('0x20')](function(_0x45e10b){_0x4ff7be['rows']=_0x45e10b;return _0x4ff7be;})[_0x4708('0x20')](respondWithFilteredResult(_0x15896e,_0x534d04))[_0x4708('0x2b')](handleError(_0x15896e,null));};exports[_0x4708('0x52')]=function(_0x48e8ae,_0x414e5f){var _0x1f3389={'raw':![],'where':{'id':_0x48e8ae[_0x4708('0x53')]['id']}},_0x3f9a03={};_0x3f9a03[_0x4708('0x41')]=_[_0x4708('0x43')](db[_0x4708('0x3c')][_0x4708('0x3d')]);_0x3f9a03[_0x4708('0x42')]=_[_0x4708('0x43')](_0x48e8ae[_0x4708('0x42')]);_0x3f9a03[_0x4708('0x44')]=_[_0x4708('0x45')](_0x3f9a03[_0x4708('0x41')],_0x3f9a03[_0x4708('0x42')]);_0x1f3389[_0x4708('0x46')]=_[_0x4708('0x45')](_0x3f9a03[_0x4708('0x41')],qs['fields'](_0x48e8ae[_0x4708('0x42')][_0x4708('0x47')]));_0x1f3389[_0x4708('0x46')]=_0x1f3389['attributes']['length']?_0x1f3389[_0x4708('0x46')]:_0x3f9a03[_0x4708('0x41')];if(_0x48e8ae['query'][_0x4708('0x4f')]){_0x1f3389['include']=[{'all':!![]}];}_0x1f3389=_[_0x4708('0x54')]({},_0x1f3389,_0x48e8ae['options']);return db[_0x4708('0x3c')][_0x4708('0x55')](_0x1f3389)[_0x4708('0x20')](handleEntityNotFound(_0x414e5f,null))[_0x4708('0x20')](respondWithResult(_0x414e5f,null))[_0x4708('0x2b')](handleError(_0x414e5f,null));};exports[_0x4708('0x56')]=function(_0x31585e,_0x4540ab){return db[_0x4708('0x3c')][_0x4708('0x56')](_0x31585e[_0x4708('0x57')],{})[_0x4708('0x20')](respondWithResult(_0x4540ab,0xc9))[_0x4708('0x2b')](handleError(_0x4540ab,null));};exports[_0x4708('0x36')]=function(_0x53f028,_0x74e027){if(_0x53f028[_0x4708('0x57')]['id']){delete _0x53f028[_0x4708('0x57')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x53f028['params']['id']}})[_0x4708('0x20')](handleEntityNotFound(_0x74e027,null))['then'](saveUpdates(_0x53f028[_0x4708('0x57')],null))[_0x4708('0x20')](respondWithResult(_0x74e027,null))[_0x4708('0x2b')](handleError(_0x74e027,null));};exports[_0x4708('0x37')]=function(_0x1a4c17,_0x3c6087){return db[_0x4708('0x3c')][_0x4708('0x55')]({'where':{'id':_0x1a4c17['params']['id']}})[_0x4708('0x20')](handleEntityNotFound(_0x3c6087,null))[_0x4708('0x20')](removeEntity(_0x3c6087,null))[_0x4708('0x2b')](handleError(_0x3c6087,null));};exports[_0x4708('0x58')]=function(_0x3c8bc3,_0x23a869,_0x100b38){var _0x121a5b={};var _0x418e7e={};var _0x5653db;var _0x2421ed;return db[_0x4708('0x3c')][_0x4708('0x59')]({'where':{'id':_0x3c8bc3[_0x4708('0x53')]['id']}})[_0x4708('0x20')](handleEntityNotFound(_0x23a869,null))[_0x4708('0x20')](function(_0x45c904){if(_0x45c904){_0x5653db=_0x45c904;_0x418e7e[_0x4708('0x41')]=_[_0x4708('0x43')](db[_0x4708('0x5a')][_0x4708('0x3d')]);_0x418e7e['query']=_['keys'](_0x3c8bc3[_0x4708('0x42')]);_0x418e7e[_0x4708('0x44')]=_[_0x4708('0x45')](_0x418e7e[_0x4708('0x41')],_0x418e7e[_0x4708('0x42')]);_0x121a5b[_0x4708('0x46')]=_[_0x4708('0x45')](_0x418e7e[_0x4708('0x41')],qs['fields'](_0x3c8bc3[_0x4708('0x42')][_0x4708('0x47')]));_0x121a5b[_0x4708('0x46')]=_0x121a5b[_0x4708('0x46')]['length']?_0x121a5b[_0x4708('0x46')]:_0x418e7e['model'];_0x121a5b[_0x4708('0x5b')]=qs['sort'](_0x3c8bc3[_0x4708('0x42')][_0x4708('0x4a')]);_0x121a5b[_0x4708('0x4b')]=qs[_0x4708('0x44')](_[_0x4708('0x5c')](_0x3c8bc3[_0x4708('0x42')],_0x418e7e[_0x4708('0x44')]));if(_0x3c8bc3[_0x4708('0x42')][_0x4708('0x4d')]){_0x121a5b['where']=_[_0x4708('0x54')](_0x121a5b['where'],{'$or':_[_0x4708('0x3b')](_0x121a5b[_0x4708('0x46')],function(_0x56b54b){var _0xfd9fe7={};_0xfd9fe7[_0x56b54b]={'$like':'%'+_0x3c8bc3[_0x4708('0x42')]['filter']+'%'};return _0xfd9fe7;})});}_0x121a5b=_[_0x4708('0x54')]({},_0x121a5b,_0x3c8bc3['options']);return _0x5653db['getSubjects'](_0x121a5b);}})[_0x4708('0x20')](function(_0x3c2a1b){if(_0x3c2a1b){_0x2421ed=_0x3c2a1b[_0x4708('0x48')];if(!_0x3c8bc3[_0x4708('0x42')][_0x4708('0x49')](_0x4708('0x5d'))){_0x121a5b[_0x4708('0x30')]=qs[_0x4708('0x30')](_0x3c8bc3[_0x4708('0x42')][_0x4708('0x30')]);_0x121a5b[_0x4708('0x2f')]=qs[_0x4708('0x2f')](_0x3c8bc3[_0x4708('0x42')]['offset']);}return _0x5653db[_0x4708('0x58')](_0x121a5b);}})[_0x4708('0x20')](function(_0x14747a){if(_0x14747a){return _0x14747a?{'count':_0x2421ed,'rows':_0x14747a}:null;}})[_0x4708('0x20')](respondWithResult(_0x23a869,null))['catch'](handleError(_0x23a869,null));};exports['getDescriptions']=function(_0x386d88,_0x54f4e7,_0x47730b){var _0xe287fb={};var _0x1518cd={};var _0x34dd7c;var _0x8685e2;return db[_0x4708('0x3c')][_0x4708('0x59')]({'where':{'id':_0x386d88[_0x4708('0x53')]['id']}})['then'](handleEntityNotFound(_0x54f4e7,null))[_0x4708('0x20')](function(_0x3e582e){if(_0x3e582e){_0x34dd7c=_0x3e582e;_0x1518cd[_0x4708('0x41')]=_['keys'](db[_0x4708('0x5a')]['rawAttributes']);_0x1518cd[_0x4708('0x42')]=_[_0x4708('0x43')](_0x386d88[_0x4708('0x42')]);_0x1518cd[_0x4708('0x44')]=_[_0x4708('0x45')](_0x1518cd[_0x4708('0x41')],_0x1518cd[_0x4708('0x42')]);_0xe287fb[_0x4708('0x46')]=_[_0x4708('0x45')](_0x1518cd[_0x4708('0x41')],qs[_0x4708('0x47')](_0x386d88[_0x4708('0x42')]['fields']));_0xe287fb[_0x4708('0x46')]=_0xe287fb['attributes']['length']?_0xe287fb[_0x4708('0x46')]:_0x1518cd[_0x4708('0x41')];_0xe287fb[_0x4708('0x5b')]=qs[_0x4708('0x4a')](_0x386d88[_0x4708('0x42')][_0x4708('0x4a')]);_0xe287fb[_0x4708('0x4b')]=qs[_0x4708('0x44')](_[_0x4708('0x5c')](_0x386d88[_0x4708('0x42')],_0x1518cd[_0x4708('0x44')]));if(_0x386d88[_0x4708('0x42')][_0x4708('0x4d')]){_0xe287fb[_0x4708('0x4b')]=_[_0x4708('0x54')](_0xe287fb[_0x4708('0x4b')],{'$or':_[_0x4708('0x3b')](_0xe287fb['attributes'],function(_0x8fee03){var _0x3419e1={};_0x3419e1[_0x8fee03]={'$like':'%'+_0x386d88[_0x4708('0x42')]['filter']+'%'};return _0x3419e1;})});}_0xe287fb=_['merge']({},_0xe287fb,_0x386d88['options']);return _0x34dd7c[_0x4708('0x5e')](_0xe287fb);}})[_0x4708('0x20')](function(_0x560611){if(_0x560611){_0x8685e2=_0x560611['length'];if(!_0x386d88[_0x4708('0x42')][_0x4708('0x49')](_0x4708('0x5d'))){_0xe287fb['limit']=qs['limit'](_0x386d88['query'][_0x4708('0x30')]);_0xe287fb[_0x4708('0x2f')]=qs[_0x4708('0x2f')](_0x386d88[_0x4708('0x42')][_0x4708('0x2f')]);}return _0x34dd7c['getDescriptions'](_0xe287fb);}})[_0x4708('0x20')](function(_0x4fb612){if(_0x4fb612){return _0x4fb612?{'count':_0x8685e2,'rows':_0x4fb612}:null;}})[_0x4708('0x20')](respondWithResult(_0x54f4e7,null))[_0x4708('0x2b')](handleError(_0x54f4e7,null));};exports[_0x4708('0x5f')]=function(_0x15dbe2,_0x3e8a2f,_0x43399d){var _0x5531e2={};var _0x1aa6ab={};var _0x3c68f1;var _0x201a0f;return db[_0x4708('0x3c')][_0x4708('0x59')]({'where':{'id':_0x15dbe2[_0x4708('0x53')]['id']}})['then'](handleEntityNotFound(_0x3e8a2f,null))[_0x4708('0x20')](function(_0x42d327){if(_0x42d327){_0x3c68f1=_0x42d327;_0x1aa6ab[_0x4708('0x41')]=_[_0x4708('0x43')](db[_0x4708('0x5a')][_0x4708('0x3d')]);_0x1aa6ab[_0x4708('0x42')]=_['keys'](_0x15dbe2[_0x4708('0x42')]);_0x1aa6ab[_0x4708('0x44')]=_[_0x4708('0x45')](_0x1aa6ab['model'],_0x1aa6ab[_0x4708('0x42')]);_0x5531e2['attributes']=_[_0x4708('0x45')](_0x1aa6ab[_0x4708('0x41')],qs[_0x4708('0x47')](_0x15dbe2[_0x4708('0x42')][_0x4708('0x47')]));_0x5531e2[_0x4708('0x46')]=_0x5531e2[_0x4708('0x46')][_0x4708('0x48')]?_0x5531e2[_0x4708('0x46')]:_0x1aa6ab[_0x4708('0x41')];_0x5531e2[_0x4708('0x5b')]=qs[_0x4708('0x4a')](_0x15dbe2[_0x4708('0x42')]['sort']);_0x5531e2[_0x4708('0x4b')]=qs[_0x4708('0x44')](_[_0x4708('0x5c')](_0x15dbe2[_0x4708('0x42')],_0x1aa6ab[_0x4708('0x44')]));if(_0x15dbe2['query']['filter']){_0x5531e2['where']=_[_0x4708('0x54')](_0x5531e2[_0x4708('0x4b')],{'$or':_[_0x4708('0x3b')](_0x5531e2[_0x4708('0x46')],function(_0x19cbdd){var _0x2b73d0={};_0x2b73d0[_0x19cbdd]={'$like':'%'+_0x15dbe2[_0x4708('0x42')][_0x4708('0x4d')]+'%'};return _0x2b73d0;})});}_0x5531e2=_[_0x4708('0x54')]({},_0x5531e2,_0x15dbe2[_0x4708('0x4e')]);return _0x3c68f1[_0x4708('0x5f')](_0x5531e2);}})[_0x4708('0x20')](function(_0x5e0b6c){if(_0x5e0b6c){_0x201a0f=_0x5e0b6c[_0x4708('0x48')];if(!_0x15dbe2[_0x4708('0x42')][_0x4708('0x49')](_0x4708('0x5d'))){_0x5531e2[_0x4708('0x30')]=qs[_0x4708('0x30')](_0x15dbe2[_0x4708('0x42')][_0x4708('0x30')]);_0x5531e2[_0x4708('0x2f')]=qs['offset'](_0x15dbe2[_0x4708('0x42')][_0x4708('0x2f')]);}return _0x3c68f1[_0x4708('0x5f')](_0x5531e2);}})[_0x4708('0x20')](function(_0x54a161){if(_0x54a161){return _0x54a161?{'count':_0x201a0f,'rows':_0x54a161}:null;}})[_0x4708('0x20')](respondWithResult(_0x3e8a2f,null))[_0x4708('0x2b')](handleError(_0x3e8a2f,null));}; \ No newline at end of file +var _0x5055=['fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','include','rows','params','includeAll','body','find','getSubjects','findOne','FreshsalesField','getDescriptions','pick','getFields','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','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','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','destroy','stack','name','send','FreshsalesConfiguration','rawAttributes'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0x5055,0x7d));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5505('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5505('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5505('0x2'));var rp=require(_0x5505('0x3'));var moment=require('moment');var BPromise=require(_0x5505('0x4'));var Mustache=require(_0x5505('0x5'));var util=require('util');var path=require(_0x5505('0x6'));var sox=require(_0x5505('0x7'));var csv=require(_0x5505('0x8'));var ejs=require(_0x5505('0x9'));var fs=require('fs');var _=require(_0x5505('0xa'));var squel=require(_0x5505('0xb'));var crypto=require(_0x5505('0xc'));var jsforce=require(_0x5505('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5505('0x8'));var querystring=require(_0x5505('0xe'));var Papa=require(_0x5505('0xf'));var Redis=require(_0x5505('0x10'));var authService=require(_0x5505('0x11'));var qs=require(_0x5505('0x12'));var as=require(_0x5505('0x13'));var hardwareService=require(_0x5505('0x14'));var logger=require(_0x5505('0x15'))(_0x5505('0x16'));var utils=require(_0x5505('0x17'));var config=require(_0x5505('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5505('0x19'));var client=jayson[_0x5505('0x1a')][_0x5505('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x11114c,_0xf8cbca,_0x45b040){if(_0x45b040){var _0xbe8808=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xbe8808[_0x5505('0x1c')](_0xf8cbca)){return _0x11114c;}else{throw new db[(_0x5505('0x1d'))][(_0x5505('0x1e'))](_0x5505('0x1f'));}}else{return _0x11114c;}}function respondWithRpcPromise(_0x189a2c,_0x4f1770,_0x3a04b9,_0x171b3c){return new BPromise(function(_0x14e9c3,_0xae912e){var _0x474a4c=_0x171b3c||client;return _0x474a4c[_0x5505('0x20')](_0x189a2c,_0x3a04b9)[_0x5505('0x21')](function(_0x241bb0){logger[_0x5505('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f1770,_0x5505('0x23'));logger[_0x5505('0x24')](_0x5505('0x25'),_0x4f1770,'request\x20sent',JSON['stringify'](_0x241bb0));if(_0x241bb0[_0x5505('0x26')]){if(_0x241bb0[_0x5505('0x26')][_0x5505('0x27')]===0x1f4){logger[_0x5505('0x26')](_0x5505('0x28'),_0x4f1770,_0x241bb0[_0x5505('0x26')][_0x5505('0x29')]);return _0xae912e(_0x241bb0[_0x5505('0x26')][_0x5505('0x29')]);}logger[_0x5505('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f1770,_0x241bb0['error'][_0x5505('0x29')]);return _0x14e9c3(_0x241bb0[_0x5505('0x26')][_0x5505('0x29')]);}else{logger[_0x5505('0x22')](_0x5505('0x28'),_0x4f1770,_0x5505('0x23'));_0x14e9c3(_0x241bb0[_0x5505('0x2a')]['message']);}})[_0x5505('0x2b')](function(_0x34c537){logger['error'](_0x5505('0x28'),_0x4f1770,_0x34c537);_0xae912e(_0x34c537);});});}function respondWithStatusCode(_0x3f0bef,_0x3f9a38){_0x3f9a38=_0x3f9a38||0xcc;return function(_0x3d09f5){if(_0x3d09f5){return _0x3f0bef[_0x5505('0x2c')](_0x3f9a38);}return _0x3f0bef['status'](_0x3f9a38)[_0x5505('0x2d')]();};}function respondWithResult(_0x3b25e0,_0x4ca27b){_0x4ca27b=_0x4ca27b||0xc8;return function(_0x22772c){if(_0x22772c){return _0x3b25e0[_0x5505('0x2e')](_0x4ca27b)[_0x5505('0x2f')](_0x22772c);}};}function respondWithFilteredResult(_0x38a8fa,_0x187221){return function(_0x3e2988){if(_0x3e2988){var _0x2a5fb8=_0x3e2988[_0x5505('0x30')],_0x2c01ed=_0x187221['offset'],_0x4566db=_0x187221[_0x5505('0x31')]+_0x187221[_0x5505('0x32')],_0x439fbd;if(_0x4566db>=_0x2a5fb8){_0x4566db=_0x2a5fb8;_0x439fbd=0xc8;}else{_0x439fbd=0xce;}_0x38a8fa[_0x5505('0x2e')](_0x439fbd);return _0x38a8fa['set']('Content-Range',_0x2c01ed+'-'+_0x4566db+'/'+_0x2a5fb8)[_0x5505('0x2f')](_0x3e2988);}return null;};}function patchUpdates(_0x4ffdc3){return function(_0x31caa8){try{jsonpatch[_0x5505('0x33')](_0x31caa8,_0x4ffdc3,!![]);}catch(_0x902fe){return BPromise[_0x5505('0x34')](_0x902fe);}return _0x31caa8[_0x5505('0x35')]();};}function saveUpdates(_0xe17295,_0xace010){return function(_0x4804e5){if(_0x4804e5){return _0x4804e5[_0x5505('0x36')](_0xe17295)[_0x5505('0x21')](function(_0x2f5c8a){return _0x2f5c8a;});}return null;};}function removeEntity(_0x307830,_0x24b17d){return function(_0x231872){if(_0x231872){return _0x231872[_0x5505('0x37')]()[_0x5505('0x21')](function(){_0x307830[_0x5505('0x2e')](0xcc)[_0x5505('0x2d')]();});}};}function handleEntityNotFound(_0xe380b0,_0x40922a){return function(_0x24792c){if(!_0x24792c){_0xe380b0[_0x5505('0x2c')](0x194);}return _0x24792c;};}function handleError(_0x47526d,_0x2164c7){_0x2164c7=_0x2164c7||0x1f4;return function(_0x4eb091){logger[_0x5505('0x26')](_0x4eb091[_0x5505('0x38')]);if(_0x4eb091[_0x5505('0x39')]){delete _0x4eb091['name'];}_0x47526d[_0x5505('0x2e')](_0x2164c7)[_0x5505('0x3a')](_0x4eb091);};}exports['index']=function(_0x593094,_0x4542be){var _0x29099c={},_0x1ffe70={},_0x3b7a09={'count':0x0,'rows':[]};var _0x19002c=_['map'](db[_0x5505('0x3b')][_0x5505('0x3c')],function(_0x24a469){return{'name':_0x24a469[_0x5505('0x3d')],'type':_0x24a469['type'][_0x5505('0x3e')]};});_0x1ffe70[_0x5505('0x3f')]=_[_0x5505('0x40')](_0x19002c,_0x5505('0x39'));_0x1ffe70[_0x5505('0x41')]=_[_0x5505('0x42')](_0x593094['query']);_0x1ffe70[_0x5505('0x43')]=_[_0x5505('0x44')](_0x1ffe70[_0x5505('0x3f')],_0x1ffe70[_0x5505('0x41')]);_0x29099c[_0x5505('0x45')]=_[_0x5505('0x44')](_0x1ffe70[_0x5505('0x3f')],qs[_0x5505('0x46')](_0x593094[_0x5505('0x41')]['fields']));_0x29099c['attributes']=_0x29099c[_0x5505('0x45')][_0x5505('0x47')]?_0x29099c[_0x5505('0x45')]:_0x1ffe70[_0x5505('0x3f')];if(!_0x593094[_0x5505('0x41')][_0x5505('0x48')](_0x5505('0x49'))){_0x29099c[_0x5505('0x32')]=qs[_0x5505('0x32')](_0x593094['query'][_0x5505('0x32')]);_0x29099c[_0x5505('0x31')]=qs[_0x5505('0x31')](_0x593094['query'][_0x5505('0x31')]);}_0x29099c[_0x5505('0x4a')]=qs['sort'](_0x593094[_0x5505('0x41')][_0x5505('0x4b')]);_0x29099c['where']=qs['filters'](_['pick'](_0x593094[_0x5505('0x41')],_0x1ffe70['filters']),_0x19002c);if(_0x593094[_0x5505('0x41')]['filter']){_0x29099c[_0x5505('0x4c')]=_[_0x5505('0x4d')](_0x29099c[_0x5505('0x4c')],{'$or':_[_0x5505('0x40')](_0x19002c,function(_0xc811){if(_0xc811[_0x5505('0x4e')]!=='VIRTUAL'){var _0x115832={};_0x115832[_0xc811['name']]={'$like':'%'+_0x593094[_0x5505('0x41')][_0x5505('0x4f')]+'%'};return _0x115832;}})});}_0x29099c=_[_0x5505('0x4d')]({},_0x29099c,_0x593094[_0x5505('0x50')]);var _0x58720a={'where':_0x29099c[_0x5505('0x4c')]};return db['FreshsalesConfiguration'][_0x5505('0x30')](_0x58720a)[_0x5505('0x21')](function(_0x23225e){_0x3b7a09[_0x5505('0x30')]=_0x23225e;if(_0x593094[_0x5505('0x41')]['includeAll']){_0x29099c[_0x5505('0x51')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x29099c);})[_0x5505('0x21')](function(_0x127b31){_0x3b7a09[_0x5505('0x52')]=_0x127b31;return _0x3b7a09;})[_0x5505('0x21')](respondWithFilteredResult(_0x4542be,_0x29099c))['catch'](handleError(_0x4542be,null));};exports['show']=function(_0x445f2d,_0x2cc90a){var _0x17ca4d={'raw':![],'where':{'id':_0x445f2d[_0x5505('0x53')]['id']}},_0x1e78d3={};_0x1e78d3[_0x5505('0x3f')]=_['keys'](db[_0x5505('0x3b')][_0x5505('0x3c')]);_0x1e78d3['query']=_[_0x5505('0x42')](_0x445f2d[_0x5505('0x41')]);_0x1e78d3[_0x5505('0x43')]=_['intersection'](_0x1e78d3[_0x5505('0x3f')],_0x1e78d3['query']);_0x17ca4d[_0x5505('0x45')]=_['intersection'](_0x1e78d3[_0x5505('0x3f')],qs[_0x5505('0x46')](_0x445f2d[_0x5505('0x41')]['fields']));_0x17ca4d[_0x5505('0x45')]=_0x17ca4d[_0x5505('0x45')]['length']?_0x17ca4d['attributes']:_0x1e78d3['model'];if(_0x445f2d[_0x5505('0x41')][_0x5505('0x54')]){_0x17ca4d['include']=[{'all':!![]}];}_0x17ca4d=_['merge']({},_0x17ca4d,_0x445f2d[_0x5505('0x50')]);return db['FreshsalesConfiguration']['find'](_0x17ca4d)[_0x5505('0x21')](handleEntityNotFound(_0x2cc90a,null))[_0x5505('0x21')](respondWithResult(_0x2cc90a,null))[_0x5505('0x2b')](handleError(_0x2cc90a,null));};exports['create']=function(_0x3901e8,_0x339808){return db[_0x5505('0x3b')]['create'](_0x3901e8[_0x5505('0x55')],{})[_0x5505('0x21')](respondWithResult(_0x339808,0xc9))['catch'](handleError(_0x339808,null));};exports[_0x5505('0x36')]=function(_0x4ebefb,_0x3b3765){if(_0x4ebefb['body']['id']){delete _0x4ebefb[_0x5505('0x55')]['id'];}return db['FreshsalesConfiguration'][_0x5505('0x56')]({'where':{'id':_0x4ebefb[_0x5505('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b3765,null))[_0x5505('0x21')](saveUpdates(_0x4ebefb[_0x5505('0x55')],null))['then'](respondWithResult(_0x3b3765,null))[_0x5505('0x2b')](handleError(_0x3b3765,null));};exports[_0x5505('0x37')]=function(_0x42e138,_0x50fad1){return db[_0x5505('0x3b')][_0x5505('0x56')]({'where':{'id':_0x42e138[_0x5505('0x53')]['id']}})[_0x5505('0x21')](handleEntityNotFound(_0x50fad1,null))[_0x5505('0x21')](removeEntity(_0x50fad1,null))['catch'](handleError(_0x50fad1,null));};exports[_0x5505('0x57')]=function(_0xb342c9,_0x3eac3b,_0x26a927){var _0x561008={};var _0x2b4a55={};var _0x359704;var _0x3fd149;return db['FreshsalesConfiguration'][_0x5505('0x58')]({'where':{'id':_0xb342c9[_0x5505('0x53')]['id']}})['then'](handleEntityNotFound(_0x3eac3b,null))[_0x5505('0x21')](function(_0x305d68){if(_0x305d68){_0x359704=_0x305d68;_0x2b4a55[_0x5505('0x3f')]=_[_0x5505('0x42')](db[_0x5505('0x59')][_0x5505('0x3c')]);_0x2b4a55[_0x5505('0x41')]=_[_0x5505('0x42')](_0xb342c9[_0x5505('0x41')]);_0x2b4a55[_0x5505('0x43')]=_[_0x5505('0x44')](_0x2b4a55[_0x5505('0x3f')],_0x2b4a55[_0x5505('0x41')]);_0x561008[_0x5505('0x45')]=_[_0x5505('0x44')](_0x2b4a55[_0x5505('0x3f')],qs[_0x5505('0x46')](_0xb342c9['query'][_0x5505('0x46')]));_0x561008[_0x5505('0x45')]=_0x561008['attributes'][_0x5505('0x47')]?_0x561008[_0x5505('0x45')]:_0x2b4a55[_0x5505('0x3f')];_0x561008[_0x5505('0x4a')]=qs['sort'](_0xb342c9[_0x5505('0x41')][_0x5505('0x4b')]);_0x561008[_0x5505('0x4c')]=qs[_0x5505('0x43')](_['pick'](_0xb342c9['query'],_0x2b4a55[_0x5505('0x43')]));if(_0xb342c9['query']['filter']){_0x561008[_0x5505('0x4c')]=_[_0x5505('0x4d')](_0x561008[_0x5505('0x4c')],{'$or':_[_0x5505('0x40')](_0x561008[_0x5505('0x45')],function(_0x39b55e){var _0x17b00c={};_0x17b00c[_0x39b55e]={'$like':'%'+_0xb342c9[_0x5505('0x41')][_0x5505('0x4f')]+'%'};return _0x17b00c;})});}_0x561008=_['merge']({},_0x561008,_0xb342c9[_0x5505('0x50')]);return _0x359704[_0x5505('0x57')](_0x561008);}})[_0x5505('0x21')](function(_0x1129b2){if(_0x1129b2){_0x3fd149=_0x1129b2[_0x5505('0x47')];if(!_0xb342c9[_0x5505('0x41')][_0x5505('0x48')](_0x5505('0x49'))){_0x561008[_0x5505('0x32')]=qs[_0x5505('0x32')](_0xb342c9[_0x5505('0x41')][_0x5505('0x32')]);_0x561008['offset']=qs[_0x5505('0x31')](_0xb342c9[_0x5505('0x41')][_0x5505('0x31')]);}return _0x359704[_0x5505('0x57')](_0x561008);}})[_0x5505('0x21')](function(_0x1d3d4a){if(_0x1d3d4a){return _0x1d3d4a?{'count':_0x3fd149,'rows':_0x1d3d4a}:null;}})['then'](respondWithResult(_0x3eac3b,null))[_0x5505('0x2b')](handleError(_0x3eac3b,null));};exports[_0x5505('0x5a')]=function(_0x593fa7,_0x25612c,_0x25f05f){var _0x5b76a2={};var _0x18a743={};var _0x29bc78;var _0x5553f5;return db['FreshsalesConfiguration'][_0x5505('0x58')]({'where':{'id':_0x593fa7[_0x5505('0x53')]['id']}})[_0x5505('0x21')](handleEntityNotFound(_0x25612c,null))[_0x5505('0x21')](function(_0x282f92){if(_0x282f92){_0x29bc78=_0x282f92;_0x18a743[_0x5505('0x3f')]=_[_0x5505('0x42')](db[_0x5505('0x59')][_0x5505('0x3c')]);_0x18a743['query']=_['keys'](_0x593fa7[_0x5505('0x41')]);_0x18a743[_0x5505('0x43')]=_['intersection'](_0x18a743[_0x5505('0x3f')],_0x18a743[_0x5505('0x41')]);_0x5b76a2[_0x5505('0x45')]=_['intersection'](_0x18a743[_0x5505('0x3f')],qs[_0x5505('0x46')](_0x593fa7[_0x5505('0x41')][_0x5505('0x46')]));_0x5b76a2['attributes']=_0x5b76a2['attributes'][_0x5505('0x47')]?_0x5b76a2[_0x5505('0x45')]:_0x18a743[_0x5505('0x3f')];_0x5b76a2[_0x5505('0x4a')]=qs[_0x5505('0x4b')](_0x593fa7[_0x5505('0x41')][_0x5505('0x4b')]);_0x5b76a2[_0x5505('0x4c')]=qs[_0x5505('0x43')](_[_0x5505('0x5b')](_0x593fa7['query'],_0x18a743[_0x5505('0x43')]));if(_0x593fa7['query'][_0x5505('0x4f')]){_0x5b76a2[_0x5505('0x4c')]=_[_0x5505('0x4d')](_0x5b76a2[_0x5505('0x4c')],{'$or':_[_0x5505('0x40')](_0x5b76a2['attributes'],function(_0x537870){var _0x239c9f={};_0x239c9f[_0x537870]={'$like':'%'+_0x593fa7[_0x5505('0x41')][_0x5505('0x4f')]+'%'};return _0x239c9f;})});}_0x5b76a2=_['merge']({},_0x5b76a2,_0x593fa7[_0x5505('0x50')]);return _0x29bc78[_0x5505('0x5a')](_0x5b76a2);}})['then'](function(_0x2a5e0b){if(_0x2a5e0b){_0x5553f5=_0x2a5e0b['length'];if(!_0x593fa7[_0x5505('0x41')][_0x5505('0x48')](_0x5505('0x49'))){_0x5b76a2[_0x5505('0x32')]=qs[_0x5505('0x32')](_0x593fa7['query'][_0x5505('0x32')]);_0x5b76a2[_0x5505('0x31')]=qs['offset'](_0x593fa7[_0x5505('0x41')][_0x5505('0x31')]);}return _0x29bc78['getDescriptions'](_0x5b76a2);}})[_0x5505('0x21')](function(_0x1f0992){if(_0x1f0992){return _0x1f0992?{'count':_0x5553f5,'rows':_0x1f0992}:null;}})[_0x5505('0x21')](respondWithResult(_0x25612c,null))[_0x5505('0x2b')](handleError(_0x25612c,null));};exports[_0x5505('0x5c')]=function(_0x1d9b5b,_0x10e555,_0x3ab1bf){var _0x2315a5={};var _0x4097e7={};var _0x2b03a8;var _0x3ecddc;return db['FreshsalesConfiguration'][_0x5505('0x58')]({'where':{'id':_0x1d9b5b[_0x5505('0x53')]['id']}})[_0x5505('0x21')](handleEntityNotFound(_0x10e555,null))[_0x5505('0x21')](function(_0x826226){if(_0x826226){_0x2b03a8=_0x826226;_0x4097e7[_0x5505('0x3f')]=_[_0x5505('0x42')](db['FreshsalesField'][_0x5505('0x3c')]);_0x4097e7[_0x5505('0x41')]=_[_0x5505('0x42')](_0x1d9b5b[_0x5505('0x41')]);_0x4097e7[_0x5505('0x43')]=_['intersection'](_0x4097e7[_0x5505('0x3f')],_0x4097e7[_0x5505('0x41')]);_0x2315a5[_0x5505('0x45')]=_[_0x5505('0x44')](_0x4097e7['model'],qs[_0x5505('0x46')](_0x1d9b5b[_0x5505('0x41')][_0x5505('0x46')]));_0x2315a5[_0x5505('0x45')]=_0x2315a5[_0x5505('0x45')][_0x5505('0x47')]?_0x2315a5['attributes']:_0x4097e7[_0x5505('0x3f')];_0x2315a5['order']=qs['sort'](_0x1d9b5b[_0x5505('0x41')][_0x5505('0x4b')]);_0x2315a5[_0x5505('0x4c')]=qs['filters'](_[_0x5505('0x5b')](_0x1d9b5b[_0x5505('0x41')],_0x4097e7[_0x5505('0x43')]));if(_0x1d9b5b[_0x5505('0x41')]['filter']){_0x2315a5['where']=_[_0x5505('0x4d')](_0x2315a5[_0x5505('0x4c')],{'$or':_[_0x5505('0x40')](_0x2315a5['attributes'],function(_0x40ac53){var _0x48bd03={};_0x48bd03[_0x40ac53]={'$like':'%'+_0x1d9b5b[_0x5505('0x41')][_0x5505('0x4f')]+'%'};return _0x48bd03;})});}_0x2315a5=_[_0x5505('0x4d')]({},_0x2315a5,_0x1d9b5b[_0x5505('0x50')]);return _0x2b03a8[_0x5505('0x5c')](_0x2315a5);}})['then'](function(_0x45f1f6){if(_0x45f1f6){_0x3ecddc=_0x45f1f6[_0x5505('0x47')];if(!_0x1d9b5b[_0x5505('0x41')][_0x5505('0x48')](_0x5505('0x49'))){_0x2315a5[_0x5505('0x32')]=qs['limit'](_0x1d9b5b[_0x5505('0x41')][_0x5505('0x32')]);_0x2315a5[_0x5505('0x31')]=qs['offset'](_0x1d9b5b[_0x5505('0x41')][_0x5505('0x31')]);}return _0x2b03a8[_0x5505('0x5c')](_0x2315a5);}})[_0x5505('0x21')](function(_0x516e29){if(_0x516e29){return _0x516e29?{'count':_0x3ecddc,'rows':_0x516e29}:null;}})[_0x5505('0x21')](respondWithResult(_0x10e555,null))['catch'](handleError(_0x10e555,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 04b6736..223f3a1 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 _0xb5a7=['exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0xb5a7,0x18f));var _0x7b5a=function(_0x4589b5,_0x11f829){_0x4589b5=_0x4589b5-0x0;var _0x3b7d02=_0xb5a7[_0x4589b5];return _0x3b7d02;};'use strict';var _=require(_0x7b5a('0x0'));var util=require(_0x7b5a('0x1'));var logger=require('../../config/logger')(_0x7b5a('0x2'));var moment=require(_0x7b5a('0x3'));var BPromise=require(_0x7b5a('0x4'));var rp=require(_0x7b5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b5a('0x6'));var config=require(_0x7b5a('0x7'));var attributes=require(_0x7b5a('0x8'));module[_0x7b5a('0x9')]=function(_0x2125a2,_0x52abf8){return _0x2125a2['define'](_0x7b5a('0xa'),attributes,{'tableName':_0x7b5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb79=['./intFreshsalesConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3550b4,_0x59b309){var _0x237bca=function(_0x9624f9){while(--_0x9624f9){_0x3550b4['push'](_0x3550b4['shift']());}};_0x237bca(++_0x59b309);}(_0xcb79,0xc3));var _0x9cb7=function(_0x52d18d,_0x2bdf0d){_0x52d18d=_0x52d18d-0x0;var _0x3fada0=_0xcb79[_0x52d18d];return _0x3fada0;};'use strict';var _=require(_0x9cb7('0x0'));var util=require(_0x9cb7('0x1'));var logger=require(_0x9cb7('0x2'))(_0x9cb7('0x3'));var moment=require('moment');var BPromise=require(_0x9cb7('0x4'));var rp=require(_0x9cb7('0x5'));var fs=require('fs');var path=require(_0x9cb7('0x6'));var rimraf=require(_0x9cb7('0x7'));var config=require(_0x9cb7('0x8'));var attributes=require(_0x9cb7('0x9'));module[_0x9cb7('0xa')]=function(_0x1ba557,_0x535cd5){return _0x1ba557[_0x9cb7('0xb')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 0e7366c..842bcf9 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 _0xc112=['error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x167f2b,_0x2320d0){var _0x350752=function(_0x1a055b){while(--_0x1a055b){_0x167f2b['push'](_0x167f2b['shift']());}};_0x350752(++_0x2320d0);}(_0xc112,0xec));var _0x2c11=function(_0x1ab8fb,_0x4b41a0){_0x1ab8fb=_0x1ab8fb-0x0;var _0x258a8e=_0xc112[_0x1ab8fb];return _0x258a8e;};'use strict';var _=require(_0x2c11('0x0'));var util=require(_0x2c11('0x1'));var moment=require(_0x2c11('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c11('0x3'));var fs=require('fs');var Redis=require(_0x2c11('0x4'));var db=require(_0x2c11('0x5'))['db'];var utils=require(_0x2c11('0x6'));var logger=require(_0x2c11('0x7'))(_0x2c11('0x8'));var config=require(_0x2c11('0x9'));var jayson=require(_0x2c11('0xa'));var client=jayson[_0x2c11('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2399,_0x39c244,_0x1fada4){return new BPromise(function(_0x29dfcf,_0x43c1f5){return client['request'](_0x5c2399,_0x1fada4)[_0x2c11('0xc')](function(_0x1e0381){logger['info'](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));logger[_0x2c11('0xf')](_0x2c11('0x10'),_0x39c244,_0x2c11('0xe'),JSON['stringify'](_0x1e0381));if(_0x1e0381[_0x2c11('0x11')]){if(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x12')]===0x1f4){logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x43c1f5(_0x1e0381['error'][_0x2c11('0x13')]);}logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x29dfcf(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);}else{logger[_0x2c11('0x14')](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));_0x29dfcf(_0x1e0381[_0x2c11('0x15')]['message']);}})[_0x2c11('0x16')](function(_0x3c31e4){logger[_0x2c11('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x39c244,_0x3c31e4);_0x43c1f5(_0x3c31e4);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3f0a10,_0x244777){var _0x22475f=function(_0x43a69e){while(--_0x43a69e){_0x3f0a10['push'](_0x3f0a10['shift']());}};_0x22475f(++_0x244777);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0xcb91[_0x3474ac];return _0x5345ec;};'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')]('FreshsalesConfiguration,\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 diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 992f8cd..2db286a 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 _0x73e8=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','/:id','post','put','update','delete','exports','util','path'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x73e8,0xfd));var _0x873e=function(_0x26e5a4,_0x24fba6){_0x26e5a4=_0x26e5a4-0x0;var _0x351321=_0x73e8[_0x26e5a4];return _0x351321;};'use strict';var multer=require('multer');var util=require(_0x873e('0x0'));var path=require(_0x873e('0x1'));var timeout=require(_0x873e('0x2'));var express=require(_0x873e('0x3'));var router=express['Router']();var auth=require(_0x873e('0x4'));var interaction=require(_0x873e('0x5'));var config=require('../../config/environment');var controller=require(_0x873e('0x6'));router[_0x873e('0x7')]('/',auth[_0x873e('0x8')](),controller['index']);router[_0x873e('0x7')](_0x873e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x873e('0xa')]('/',auth[_0x873e('0x8')](),controller['create']);router[_0x873e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x873e('0xc')]);router[_0x873e('0xd')](_0x873e('0x9'),auth[_0x873e('0x8')](),controller['destroy']);module[_0x873e('0xe')]=router; \ No newline at end of file +var _0xbebb=['index','get','/:id','isAuthenticated','create','put','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x1bb45d,_0xc82252){var _0x7d8175=function(_0x45f2e9){while(--_0x45f2e9){_0x1bb45d['push'](_0x1bb45d['shift']());}};_0x7d8175(++_0xc82252);}(_0xbebb,0x1c1));var _0xbbeb=function(_0x4e7dbb,_0x133c73){_0x4e7dbb=_0x4e7dbb-0x0;var _0x244887=_0xbebb[_0x4e7dbb];return _0x244887;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbbeb('0x0'));var express=require(_0xbbeb('0x1'));var router=express[_0xbbeb('0x2')]();var auth=require(_0xbbeb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbbeb('0x4'));var controller=require(_0xbbeb('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xbbeb('0x6')]);router[_0xbbeb('0x7')](_0xbbeb('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbbeb('0x9')](),controller[_0xbbeb('0xa')]);router[_0xbbeb('0xb')]('/:id',auth[_0xbbeb('0x9')](),controller['update']);router['delete'](_0xbbeb('0x8'),auth[_0xbbeb('0x9')](),controller['destroy']);module[_0xbbeb('0xc')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index fdbe0d3..dbf78fe 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 _0x3df4=['string','variable','customVariable','keyValue','STRING','BOOLEAN','ENUM'];(function(_0x5a22c3,_0x2cfdb4){var _0x5d5274=function(_0x4d2d7d){while(--_0x4d2d7d){_0x5a22c3['push'](_0x5a22c3['shift']());}};_0x5d5274(++_0x2cfdb4);}(_0x3df4,0x102));var _0x43df=function(_0x30a1ca,_0x2af49a){_0x30a1ca=_0x30a1ca-0x0;var _0x1ae192=_0x3df4[_0x30a1ca];return _0x1ae192;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x43df('0x0')](_0x43df('0x1'),_0x43df('0x2'),_0x43df('0x3'),_0x43df('0x4')),'defaultValue':_0x43df('0x1')},'content':{'type':Sequelize[_0x43df('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x43df('0x1'),_0x43df('0x2'),_0x43df('0x3'))},'keyContent':{'type':Sequelize[_0x43df('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x43df('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x43df('0x5')]}}; \ No newline at end of file +var _0xb37d=['ENUM','string','customVariable','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb37d,0xbe));var _0xdb37=function(_0x32a04c,_0x48de59){_0x32a04c=_0x32a04c-0x0;var _0x1535ce=_0xb37d[_0x32a04c];return _0x1535ce;};'use strict';var Sequelize=require(_0xdb37('0x0'));module[_0xdb37('0x1')]={'type':{'type':Sequelize[_0xdb37('0x2')](_0xdb37('0x3'),'variable',_0xdb37('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xdb37('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdb37('0x2')](_0xdb37('0x3'),_0xdb37('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xdb37('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdb37('0x5')]},'customField':{'type':Sequelize[_0xdb37('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb37('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ca68642..f4a76be 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 _0xe1d8=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','FreshsalesField','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','html-pdf'];(function(_0x567942,_0x509e81){var _0x1a46d0=function(_0x1e2de3){while(--_0x1e2de3){_0x567942['push'](_0x567942['shift']());}};_0x1a46d0(++_0x509e81);}(_0xe1d8,0x91));var _0x8e1d=function(_0x120ca9,_0x428221){_0x120ca9=_0x120ca9-0x0;var _0x11b25e=_0xe1d8[_0x120ca9];return _0x11b25e;};'use strict';var pdf=require(_0x8e1d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8e1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e1d('0x2'));var rp=require(_0x8e1d('0x3'));var moment=require('moment');var BPromise=require(_0x8e1d('0x4'));var Mustache=require(_0x8e1d('0x5'));var util=require(_0x8e1d('0x6'));var path=require(_0x8e1d('0x7'));var sox=require(_0x8e1d('0x8'));var csv=require(_0x8e1d('0x9'));var ejs=require(_0x8e1d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8e1d('0xb'));var crypto=require(_0x8e1d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e1d('0x9'));var querystring=require(_0x8e1d('0xd'));var Papa=require(_0x8e1d('0xe'));var Redis=require('ioredis');var authService=require(_0x8e1d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e1d('0x10'));var logger=require('../../config/logger')(_0x8e1d('0x11'));var utils=require(_0x8e1d('0x12'));var config=require(_0x8e1d('0x13'));var db=require(_0x8e1d('0x14'))['db'];function respondWithStatusCode(_0x2a6139,_0x27f6e9){_0x27f6e9=_0x27f6e9||0xcc;return function(_0x3dfb79){if(_0x3dfb79){return _0x2a6139[_0x8e1d('0x15')](_0x27f6e9);}return _0x2a6139[_0x8e1d('0x16')](_0x27f6e9)[_0x8e1d('0x17')]();};}function respondWithResult(_0x5d61d9,_0x2ef567){_0x2ef567=_0x2ef567||0xc8;return function(_0x495bfb){if(_0x495bfb){return _0x5d61d9[_0x8e1d('0x16')](_0x2ef567)[_0x8e1d('0x18')](_0x495bfb);}};}function respondWithFilteredResult(_0x4bb301,_0x62edde){return function(_0x4bc78a){if(_0x4bc78a){var _0x4ecec3=_0x4bc78a['count'],_0x2463a2=_0x62edde[_0x8e1d('0x19')],_0x281673=_0x62edde[_0x8e1d('0x19')]+_0x62edde[_0x8e1d('0x1a')],_0x154942;if(_0x281673>=_0x4ecec3){_0x281673=_0x4ecec3;_0x154942=0xc8;}else{_0x154942=0xce;}_0x4bb301[_0x8e1d('0x16')](_0x154942);return _0x4bb301[_0x8e1d('0x1b')](_0x8e1d('0x1c'),_0x2463a2+'-'+_0x281673+'/'+_0x4ecec3)[_0x8e1d('0x18')](_0x4bc78a);}return null;};}function patchUpdates(_0xe505db){return function(_0xd40bb9){try{jsonpatch[_0x8e1d('0x1d')](_0xd40bb9,_0xe505db,!![]);}catch(_0x58a848){return BPromise[_0x8e1d('0x1e')](_0x58a848);}return _0xd40bb9[_0x8e1d('0x1f')]();};}function saveUpdates(_0x482636,_0x343af1){return function(_0x1336dd){if(_0x1336dd){return _0x1336dd[_0x8e1d('0x20')](_0x482636)[_0x8e1d('0x21')](function(_0x3acab){return _0x3acab;});}return null;};}function removeEntity(_0x3a9894,_0x1aa544){return function(_0x7d4e2f){if(_0x7d4e2f){return _0x7d4e2f[_0x8e1d('0x22')]()[_0x8e1d('0x21')](function(){_0x3a9894['status'](0xcc)[_0x8e1d('0x17')]();});}};}function handleEntityNotFound(_0x5d5ce6,_0x5adf1c){return function(_0x20c12a){if(!_0x20c12a){_0x5d5ce6[_0x8e1d('0x15')](0x194);}return _0x20c12a;};}function handleError(_0x27af8c,_0x24f9a6){_0x24f9a6=_0x24f9a6||0x1f4;return function(_0x109ed4){logger[_0x8e1d('0x23')](_0x109ed4[_0x8e1d('0x24')]);if(_0x109ed4[_0x8e1d('0x25')]){delete _0x109ed4[_0x8e1d('0x25')];}_0x27af8c[_0x8e1d('0x16')](_0x24f9a6)[_0x8e1d('0x26')](_0x109ed4);};}exports[_0x8e1d('0x27')]=function(_0x3816bf,_0xea9151){var _0x537d65={},_0x4fe8a2={},_0x43f4a2={'count':0x0,'rows':[]};var _0x3f47b1=_[_0x8e1d('0x28')](db['FreshsalesField']['rawAttributes'],function(_0x3ea3f1){return{'name':_0x3ea3f1['fieldName'],'type':_0x3ea3f1[_0x8e1d('0x29')][_0x8e1d('0x2a')]};});_0x4fe8a2[_0x8e1d('0x2b')]=_[_0x8e1d('0x28')](_0x3f47b1,_0x8e1d('0x25'));_0x4fe8a2[_0x8e1d('0x2c')]=_[_0x8e1d('0x2d')](_0x3816bf[_0x8e1d('0x2c')]);_0x4fe8a2['filters']=_[_0x8e1d('0x2e')](_0x4fe8a2['model'],_0x4fe8a2[_0x8e1d('0x2c')]);_0x537d65[_0x8e1d('0x2f')]=_['intersection'](_0x4fe8a2['model'],qs[_0x8e1d('0x30')](_0x3816bf['query']['fields']));_0x537d65['attributes']=_0x537d65['attributes'][_0x8e1d('0x31')]?_0x537d65[_0x8e1d('0x2f')]:_0x4fe8a2[_0x8e1d('0x2b')];if(!_0x3816bf[_0x8e1d('0x2c')][_0x8e1d('0x32')](_0x8e1d('0x33'))){_0x537d65['limit']=qs[_0x8e1d('0x1a')](_0x3816bf[_0x8e1d('0x2c')][_0x8e1d('0x1a')]);_0x537d65[_0x8e1d('0x19')]=qs[_0x8e1d('0x19')](_0x3816bf[_0x8e1d('0x2c')]['offset']);}_0x537d65[_0x8e1d('0x34')]=qs[_0x8e1d('0x35')](_0x3816bf[_0x8e1d('0x2c')][_0x8e1d('0x35')]);_0x537d65[_0x8e1d('0x36')]=qs[_0x8e1d('0x37')](_[_0x8e1d('0x38')](_0x3816bf['query'],_0x4fe8a2[_0x8e1d('0x37')]),_0x3f47b1);if(_0x3816bf['query'][_0x8e1d('0x39')]){_0x537d65[_0x8e1d('0x36')]=_['merge'](_0x537d65['where'],{'$or':_[_0x8e1d('0x28')](_0x3f47b1,function(_0x4fed21){if(_0x4fed21[_0x8e1d('0x29')]!==_0x8e1d('0x3a')){var _0x5c231e={};_0x5c231e[_0x4fed21[_0x8e1d('0x25')]]={'$like':'%'+_0x3816bf[_0x8e1d('0x2c')][_0x8e1d('0x39')]+'%'};return _0x5c231e;}})});}_0x537d65=_[_0x8e1d('0x3b')]({},_0x537d65,_0x3816bf[_0x8e1d('0x3c')]);var _0x201c27={'where':_0x537d65[_0x8e1d('0x36')]};return db[_0x8e1d('0x3d')][_0x8e1d('0x3e')](_0x201c27)[_0x8e1d('0x21')](function(_0x392369){_0x43f4a2[_0x8e1d('0x3e')]=_0x392369;if(_0x3816bf[_0x8e1d('0x2c')]['includeAll']){_0x537d65[_0x8e1d('0x3f')]=[{'all':!![]}];}return db[_0x8e1d('0x3d')][_0x8e1d('0x40')](_0x537d65);})[_0x8e1d('0x21')](function(_0x593b74){_0x43f4a2[_0x8e1d('0x41')]=_0x593b74;return _0x43f4a2;})[_0x8e1d('0x21')](respondWithFilteredResult(_0xea9151,_0x537d65))[_0x8e1d('0x42')](handleError(_0xea9151,null));};exports[_0x8e1d('0x43')]=function(_0x1ba2e1,_0x1c0a8f){var _0x4f7ec2={'raw':!![],'where':{'id':_0x1ba2e1[_0x8e1d('0x44')]['id']}},_0x47c264={};_0x47c264[_0x8e1d('0x2b')]=_[_0x8e1d('0x2d')](db[_0x8e1d('0x3d')]['rawAttributes']);_0x47c264[_0x8e1d('0x2c')]=_[_0x8e1d('0x2d')](_0x1ba2e1[_0x8e1d('0x2c')]);_0x47c264[_0x8e1d('0x37')]=_[_0x8e1d('0x2e')](_0x47c264[_0x8e1d('0x2b')],_0x47c264[_0x8e1d('0x2c')]);_0x4f7ec2[_0x8e1d('0x2f')]=_[_0x8e1d('0x2e')](_0x47c264[_0x8e1d('0x2b')],qs['fields'](_0x1ba2e1['query'][_0x8e1d('0x30')]));_0x4f7ec2[_0x8e1d('0x2f')]=_0x4f7ec2['attributes'][_0x8e1d('0x31')]?_0x4f7ec2[_0x8e1d('0x2f')]:_0x47c264[_0x8e1d('0x2b')];if(_0x1ba2e1['query'][_0x8e1d('0x45')]){_0x4f7ec2['include']=[{'all':!![]}];}_0x4f7ec2=_[_0x8e1d('0x3b')]({},_0x4f7ec2,_0x1ba2e1[_0x8e1d('0x3c')]);return db[_0x8e1d('0x3d')]['find'](_0x4f7ec2)['then'](handleEntityNotFound(_0x1c0a8f,null))[_0x8e1d('0x21')](respondWithResult(_0x1c0a8f,null))[_0x8e1d('0x42')](handleError(_0x1c0a8f,null));};exports['create']=function(_0x5c6956,_0xe1be3a){return db[_0x8e1d('0x3d')][_0x8e1d('0x46')](_0x5c6956[_0x8e1d('0x47')],{})[_0x8e1d('0x21')](respondWithResult(_0xe1be3a,0xc9))[_0x8e1d('0x42')](handleError(_0xe1be3a,null));};exports['update']=function(_0x1ad844,_0x1f60bc){if(_0x1ad844[_0x8e1d('0x47')]['id']){delete _0x1ad844['body']['id'];}return db['FreshsalesField'][_0x8e1d('0x48')]({'where':{'id':_0x1ad844['params']['id']}})['then'](handleEntityNotFound(_0x1f60bc,null))['then'](saveUpdates(_0x1ad844[_0x8e1d('0x47')],null))['then'](respondWithResult(_0x1f60bc,null))[_0x8e1d('0x42')](handleError(_0x1f60bc,null));};exports[_0x8e1d('0x22')]=function(_0xe6dd7a,_0x40918d){return db[_0x8e1d('0x3d')][_0x8e1d('0x48')]({'where':{'id':_0xe6dd7a['params']['id']}})['then'](handleEntityNotFound(_0x40918d,null))[_0x8e1d('0x21')](removeEntity(_0x40918d,null))[_0x8e1d('0x42')](handleError(_0x40918d,null));}; \ No newline at end of file +var _0x8c55=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel'];(function(_0x313df3,_0x4fca45){var _0x241d59=function(_0x452786){while(--_0x452786){_0x313df3['push'](_0x313df3['shift']());}};_0x241d59(++_0x4fca45);}(_0x8c55,0xd2));var _0x58c5=function(_0x27e8de,_0x47253c){_0x27e8de=_0x27e8de-0x0;var _0x5f0a3c=_0x8c55[_0x27e8de];return _0x5f0a3c;};'use strict';var pdf=require(_0x58c5('0x0'));var emlformat=require(_0x58c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x58c5('0x2'));var jsonpatch=require(_0x58c5('0x3'));var rp=require(_0x58c5('0x4'));var moment=require(_0x58c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x58c5('0x6'));var util=require('util');var path=require(_0x58c5('0x7'));var sox=require(_0x58c5('0x8'));var csv=require(_0x58c5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x58c5('0xa'));var squel=require(_0x58c5('0xb'));var crypto=require(_0x58c5('0xc'));var jsforce=require(_0x58c5('0xd'));var deskjs=require(_0x58c5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x58c5('0xf'));var Papa=require(_0x58c5('0x10'));var Redis=require('ioredis');var authService=require(_0x58c5('0x11'));var qs=require(_0x58c5('0x12'));var as=require(_0x58c5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x58c5('0x14'))(_0x58c5('0x15'));var utils=require(_0x58c5('0x16'));var config=require(_0x58c5('0x17'));var db=require(_0x58c5('0x18'))['db'];function respondWithStatusCode(_0x3fa05c,_0x5afa33){_0x5afa33=_0x5afa33||0xcc;return function(_0x581c3b){if(_0x581c3b){return _0x3fa05c[_0x58c5('0x19')](_0x5afa33);}return _0x3fa05c['status'](_0x5afa33)[_0x58c5('0x1a')]();};}function respondWithResult(_0x3fb4fe,_0x22c685){_0x22c685=_0x22c685||0xc8;return function(_0x1c17b2){if(_0x1c17b2){return _0x3fb4fe[_0x58c5('0x1b')](_0x22c685)['json'](_0x1c17b2);}};}function respondWithFilteredResult(_0xf2e6af,_0x1d47de){return function(_0x397f4c){if(_0x397f4c){var _0xf85a1=_0x397f4c[_0x58c5('0x1c')],_0x499bd8=_0x1d47de[_0x58c5('0x1d')],_0x1f19ec=_0x1d47de[_0x58c5('0x1d')]+_0x1d47de[_0x58c5('0x1e')],_0x12381b;if(_0x1f19ec>=_0xf85a1){_0x1f19ec=_0xf85a1;_0x12381b=0xc8;}else{_0x12381b=0xce;}_0xf2e6af[_0x58c5('0x1b')](_0x12381b);return _0xf2e6af[_0x58c5('0x1f')](_0x58c5('0x20'),_0x499bd8+'-'+_0x1f19ec+'/'+_0xf85a1)[_0x58c5('0x21')](_0x397f4c);}return null;};}function patchUpdates(_0x11265d){return function(_0x3345a4){try{jsonpatch[_0x58c5('0x22')](_0x3345a4,_0x11265d,!![]);}catch(_0x3aff58){return BPromise['reject'](_0x3aff58);}return _0x3345a4[_0x58c5('0x23')]();};}function saveUpdates(_0xbab5c4,_0x4c12f5){return function(_0x3c4d6a){if(_0x3c4d6a){return _0x3c4d6a[_0x58c5('0x24')](_0xbab5c4)[_0x58c5('0x25')](function(_0x17545e){return _0x17545e;});}return null;};}function removeEntity(_0x3e1789,_0xd9afa7){return function(_0x3aabe7){if(_0x3aabe7){return _0x3aabe7[_0x58c5('0x26')]()[_0x58c5('0x25')](function(){_0x3e1789[_0x58c5('0x1b')](0xcc)[_0x58c5('0x1a')]();});}};}function handleEntityNotFound(_0x10612c,_0x28aac0){return function(_0x3b6cd4){if(!_0x3b6cd4){_0x10612c[_0x58c5('0x19')](0x194);}return _0x3b6cd4;};}function handleError(_0x59a1ff,_0x4c29be){_0x4c29be=_0x4c29be||0x1f4;return function(_0x5a1767){logger[_0x58c5('0x27')](_0x5a1767['stack']);if(_0x5a1767['name']){delete _0x5a1767['name'];}_0x59a1ff[_0x58c5('0x1b')](_0x4c29be)['send'](_0x5a1767);};}exports[_0x58c5('0x28')]=function(_0x366d9c,_0x63bd79){var _0x9fa2bc={},_0x53102f={},_0x1ccf7b={'count':0x0,'rows':[]};var _0x320517=_['map'](db[_0x58c5('0x29')][_0x58c5('0x2a')],function(_0x3657fc){return{'name':_0x3657fc[_0x58c5('0x2b')],'type':_0x3657fc[_0x58c5('0x2c')][_0x58c5('0x2d')]};});_0x53102f[_0x58c5('0x2e')]=_[_0x58c5('0x2f')](_0x320517,_0x58c5('0x30'));_0x53102f['query']=_['keys'](_0x366d9c[_0x58c5('0x31')]);_0x53102f[_0x58c5('0x32')]=_[_0x58c5('0x33')](_0x53102f[_0x58c5('0x2e')],_0x53102f['query']);_0x9fa2bc[_0x58c5('0x34')]=_['intersection'](_0x53102f[_0x58c5('0x2e')],qs['fields'](_0x366d9c['query'][_0x58c5('0x35')]));_0x9fa2bc['attributes']=_0x9fa2bc[_0x58c5('0x34')][_0x58c5('0x36')]?_0x9fa2bc['attributes']:_0x53102f[_0x58c5('0x2e')];if(!_0x366d9c[_0x58c5('0x31')][_0x58c5('0x37')](_0x58c5('0x38'))){_0x9fa2bc[_0x58c5('0x1e')]=qs[_0x58c5('0x1e')](_0x366d9c[_0x58c5('0x31')]['limit']);_0x9fa2bc[_0x58c5('0x1d')]=qs['offset'](_0x366d9c[_0x58c5('0x31')][_0x58c5('0x1d')]);}_0x9fa2bc[_0x58c5('0x39')]=qs[_0x58c5('0x3a')](_0x366d9c[_0x58c5('0x31')][_0x58c5('0x3a')]);_0x9fa2bc['where']=qs[_0x58c5('0x32')](_[_0x58c5('0x3b')](_0x366d9c[_0x58c5('0x31')],_0x53102f[_0x58c5('0x32')]),_0x320517);if(_0x366d9c[_0x58c5('0x31')]['filter']){_0x9fa2bc[_0x58c5('0x3c')]=_[_0x58c5('0x3d')](_0x9fa2bc[_0x58c5('0x3c')],{'$or':_[_0x58c5('0x2f')](_0x320517,function(_0x338cb8){if(_0x338cb8[_0x58c5('0x2c')]!==_0x58c5('0x3e')){var _0x48c821={};_0x48c821[_0x338cb8[_0x58c5('0x30')]]={'$like':'%'+_0x366d9c[_0x58c5('0x31')]['filter']+'%'};return _0x48c821;}})});}_0x9fa2bc=_['merge']({},_0x9fa2bc,_0x366d9c[_0x58c5('0x3f')]);var _0x10e40c={'where':_0x9fa2bc[_0x58c5('0x3c')]};return db['FreshsalesField'][_0x58c5('0x1c')](_0x10e40c)[_0x58c5('0x25')](function(_0x56f6ea){_0x1ccf7b[_0x58c5('0x1c')]=_0x56f6ea;if(_0x366d9c['query'][_0x58c5('0x40')]){_0x9fa2bc[_0x58c5('0x41')]=[{'all':!![]}];}return db[_0x58c5('0x29')][_0x58c5('0x42')](_0x9fa2bc);})[_0x58c5('0x25')](function(_0x535239){_0x1ccf7b[_0x58c5('0x43')]=_0x535239;return _0x1ccf7b;})[_0x58c5('0x25')](respondWithFilteredResult(_0x63bd79,_0x9fa2bc))[_0x58c5('0x44')](handleError(_0x63bd79,null));};exports['show']=function(_0x2d8a2f,_0x4d1721){var _0x444d29={'raw':!![],'where':{'id':_0x2d8a2f[_0x58c5('0x45')]['id']}},_0x4e83ee={};_0x4e83ee[_0x58c5('0x2e')]=_[_0x58c5('0x46')](db[_0x58c5('0x29')][_0x58c5('0x2a')]);_0x4e83ee[_0x58c5('0x31')]=_[_0x58c5('0x46')](_0x2d8a2f[_0x58c5('0x31')]);_0x4e83ee['filters']=_['intersection'](_0x4e83ee[_0x58c5('0x2e')],_0x4e83ee['query']);_0x444d29[_0x58c5('0x34')]=_[_0x58c5('0x33')](_0x4e83ee[_0x58c5('0x2e')],qs[_0x58c5('0x35')](_0x2d8a2f[_0x58c5('0x31')][_0x58c5('0x35')]));_0x444d29[_0x58c5('0x34')]=_0x444d29[_0x58c5('0x34')][_0x58c5('0x36')]?_0x444d29['attributes']:_0x4e83ee[_0x58c5('0x2e')];if(_0x2d8a2f[_0x58c5('0x31')][_0x58c5('0x40')]){_0x444d29[_0x58c5('0x41')]=[{'all':!![]}];}_0x444d29=_[_0x58c5('0x3d')]({},_0x444d29,_0x2d8a2f[_0x58c5('0x3f')]);return db[_0x58c5('0x29')]['find'](_0x444d29)['then'](handleEntityNotFound(_0x4d1721,null))[_0x58c5('0x25')](respondWithResult(_0x4d1721,null))['catch'](handleError(_0x4d1721,null));};exports[_0x58c5('0x47')]=function(_0x299a5e,_0x1c5404){return db[_0x58c5('0x29')]['create'](_0x299a5e[_0x58c5('0x48')],{})[_0x58c5('0x25')](respondWithResult(_0x1c5404,0xc9))[_0x58c5('0x44')](handleError(_0x1c5404,null));};exports[_0x58c5('0x24')]=function(_0x348df8,_0x2b50e3){if(_0x348df8[_0x58c5('0x48')]['id']){delete _0x348df8[_0x58c5('0x48')]['id'];}return db[_0x58c5('0x29')][_0x58c5('0x49')]({'where':{'id':_0x348df8[_0x58c5('0x45')]['id']}})[_0x58c5('0x25')](handleEntityNotFound(_0x2b50e3,null))[_0x58c5('0x25')](saveUpdates(_0x348df8[_0x58c5('0x48')],null))[_0x58c5('0x25')](respondWithResult(_0x2b50e3,null))[_0x58c5('0x44')](handleError(_0x2b50e3,null));};exports[_0x58c5('0x26')]=function(_0x49bc77,_0x3f7f4c){return db[_0x58c5('0x29')][_0x58c5('0x49')]({'where':{'id':_0x49bc77[_0x58c5('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f7f4c,null))['then'](removeEntity(_0x3f7f4c,null))[_0x58c5('0x44')](handleError(_0x3f7f4c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 8958d6e..e40c787 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 _0x7209=['exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','request-promise','path','../../config/environment','./intFreshsalesField.attributes'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0x7209,0x6e));var _0x9720=function(_0x1117a6,_0x9199b3){_0x1117a6=_0x1117a6-0x0;var _0x505a67=_0x7209[_0x1117a6];return _0x505a67;};'use strict';var _=require(_0x9720('0x0'));var util=require(_0x9720('0x1'));var logger=require(_0x9720('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9720('0x3'));var fs=require('fs');var path=require(_0x9720('0x4'));var rimraf=require('rimraf');var config=require(_0x9720('0x5'));var attributes=require(_0x9720('0x6'));module[_0x9720('0x7')]=function(_0x18b8b0,_0x51038f){return _0x18b8b0[_0x9720('0x8')](_0x9720('0x9'),attributes,{'tableName':_0x9720('0xa'),'paranoid':![],'indexes':[{'name':_0x9720('0xb'),'fields':['idField',_0x9720('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b55=['./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x406177,_0xaf1eee){var _0x131090=function(_0x399df3){while(--_0x399df3){_0x406177['push'](_0x406177['shift']());}};_0x131090(++_0xaf1eee);}(_0x4b55,0xd7));var _0x54b5=function(_0x5abc65,_0x5e3bb4){_0x5abc65=_0x5abc65-0x0;var _0x7f5647=_0x4b55[_0x5abc65];return _0x7f5647;};'use strict';var _=require(_0x54b5('0x0'));var util=require(_0x54b5('0x1'));var logger=require(_0x54b5('0x2'))('api');var moment=require(_0x54b5('0x3'));var BPromise=require(_0x54b5('0x4'));var rp=require(_0x54b5('0x5'));var fs=require('fs');var path=require(_0x54b5('0x6'));var rimraf=require(_0x54b5('0x7'));var config=require(_0x54b5('0x8'));var attributes=require(_0x54b5('0x9'));module[_0x54b5('0xa')]=function(_0x28ad6b,_0x19461e){return _0x28ad6b[_0x54b5('0xb')](_0x54b5('0xc'),attributes,{'tableName':_0x54b5('0xd'),'paranoid':![],'indexes':[{'name':_0x54b5('0xe'),'fields':[_0x54b5('0xf'),'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 de3cb72..fcdca77 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 _0x97e9=['request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x452b3e,_0x173a18){var _0x3fe701=function(_0xf2995d){while(--_0xf2995d){_0x452b3e['push'](_0x452b3e['shift']());}};_0x3fe701(++_0x173a18);}(_0x97e9,0x15c));var _0x997e=function(_0xbc4543,_0x4c9e4f){_0xbc4543=_0xbc4543-0x0;var _0x469773=_0x97e9[_0xbc4543];return _0x469773;};'use strict';var _=require(_0x997e('0x0'));var util=require(_0x997e('0x1'));var moment=require(_0x997e('0x2'));var BPromise=require(_0x997e('0x3'));var rs=require(_0x997e('0x4'));var fs=require('fs');var Redis=require(_0x997e('0x5'));var db=require(_0x997e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x997e('0x7'))(_0x997e('0x8'));var config=require(_0x997e('0x9'));var jayson=require(_0x997e('0xa'));var client=jayson['client'][_0x997e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2918f4,_0x565031,_0x45fe54){return new BPromise(function(_0x25ae66,_0x56773c){return client[_0x997e('0xc')](_0x2918f4,_0x45fe54)[_0x997e('0xd')](function(_0x2bb692){logger['info'](_0x997e('0xe'),_0x565031,_0x997e('0xf'));logger[_0x997e('0x10')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x565031,'request\x20sent',JSON[_0x997e('0x11')](_0x2bb692));if(_0x2bb692[_0x997e('0x12')]){if(_0x2bb692[_0x997e('0x12')][_0x997e('0x13')]===0x1f4){logger[_0x997e('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x565031,_0x2bb692['error'][_0x997e('0x14')]);return _0x56773c(_0x2bb692[_0x997e('0x12')]['message']);}logger[_0x997e('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x565031,_0x2bb692[_0x997e('0x12')][_0x997e('0x14')]);return _0x25ae66(_0x2bb692[_0x997e('0x12')][_0x997e('0x14')]);}else{logger[_0x997e('0x15')](_0x997e('0xe'),_0x565031,'request\x20sent');_0x25ae66(_0x2bb692[_0x997e('0x16')]['message']);}})[_0x997e('0x17')](function(_0x521c5d){logger[_0x997e('0x12')](_0x997e('0xe'),_0x565031,_0x521c5d);_0x56773c(_0x521c5d);});});} \ No newline at end of file +var _0x53c6=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x322885,_0x720de8){var _0xbcb825=function(_0x3bb2fc){while(--_0x3bb2fc){_0x322885['push'](_0x322885['shift']());}};_0xbcb825(++_0x720de8);}(_0x53c6,0x198));var _0x653c=function(_0x5fe4f7,_0x4f2c6e){_0x5fe4f7=_0x5fe4f7-0x0;var _0x4871cf=_0x53c6[_0x5fe4f7];return _0x4871cf;};'use strict';var _=require(_0x653c('0x0'));var util=require(_0x653c('0x1'));var moment=require(_0x653c('0x2'));var BPromise=require(_0x653c('0x3'));var rs=require(_0x653c('0x4'));var fs=require('fs');var Redis=require(_0x653c('0x5'));var db=require(_0x653c('0x6'))['db'];var utils=require(_0x653c('0x7'));var logger=require(_0x653c('0x8'))(_0x653c('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x653c('0xa')][_0x653c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x205c91,_0xe6cee1,_0x2d418e){return new BPromise(function(_0xad9f6e,_0x6175c8){return client[_0x653c('0xc')](_0x205c91,_0x2d418e)[_0x653c('0xd')](function(_0x1a40cc){logger['info']('FreshsalesField,\x20%s,\x20%s',_0xe6cee1,_0x653c('0xe'));logger['debug'](_0x653c('0xf'),_0xe6cee1,_0x653c('0xe'),JSON[_0x653c('0x10')](_0x1a40cc));if(_0x1a40cc[_0x653c('0x11')]){if(_0x1a40cc[_0x653c('0x11')][_0x653c('0x12')]===0x1f4){logger[_0x653c('0x11')](_0x653c('0x13'),_0xe6cee1,_0x1a40cc[_0x653c('0x11')][_0x653c('0x14')]);return _0x6175c8(_0x1a40cc[_0x653c('0x11')][_0x653c('0x14')]);}logger[_0x653c('0x11')](_0x653c('0x13'),_0xe6cee1,_0x1a40cc[_0x653c('0x11')][_0x653c('0x14')]);return _0xad9f6e(_0x1a40cc[_0x653c('0x11')][_0x653c('0x14')]);}else{logger['info'](_0x653c('0x13'),_0xe6cee1,_0x653c('0xe'));_0xad9f6e(_0x1a40cc[_0x653c('0x15')][_0x653c('0x14')]);}})[_0x653c('0x16')](function(_0x5df120){logger[_0x653c('0x11')]('FreshsalesField,\x20%s,\x20%s',_0xe6cee1,_0x5df120);_0x6175c8(_0x5df120);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 97d8fb0..c8799a1 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 _0xc2b2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update'];(function(_0x3ccfbb,_0x583ac2){var _0x251eb0=function(_0x2b8f95){while(--_0x2b8f95){_0x3ccfbb['push'](_0x3ccfbb['shift']());}};_0x251eb0(++_0x583ac2);}(_0xc2b2,0xd3));var _0x2c2b=function(_0x5a9de9,_0x5a9714){_0x5a9de9=_0x5a9de9-0x0;var _0x295d6d=_0xc2b2[_0x5a9de9];return _0x295d6d;};'use strict';var multer=require(_0x2c2b('0x0'));var util=require(_0x2c2b('0x1'));var path=require(_0x2c2b('0x2'));var timeout=require(_0x2c2b('0x3'));var express=require(_0x2c2b('0x4'));var router=express[_0x2c2b('0x5')]();var auth=require(_0x2c2b('0x6'));var interaction=require(_0x2c2b('0x7'));var config=require(_0x2c2b('0x8'));var controller=require('./intSalesforceAccount.controller');router[_0x2c2b('0x9')]('/',auth[_0x2c2b('0xa')](),controller[_0x2c2b('0xb')]);router[_0x2c2b('0x9')](_0x2c2b('0xc'),auth['isAuthenticated'](),controller[_0x2c2b('0xd')]);router[_0x2c2b('0x9')]('/:id/configurations',auth[_0x2c2b('0xa')](),controller[_0x2c2b('0xe')]);router[_0x2c2b('0x9')](_0x2c2b('0xf'),auth[_0x2c2b('0xa')](),controller[_0x2c2b('0x10')]);router[_0x2c2b('0x11')]('/',auth['isAuthenticated'](),controller[_0x2c2b('0x12')]);router[_0x2c2b('0x11')](_0x2c2b('0x13'),auth[_0x2c2b('0xa')](),controller[_0x2c2b('0x14')]);router[_0x2c2b('0x15')](_0x2c2b('0xc'),auth['isAuthenticated'](),controller[_0x2c2b('0x16')]);router[_0x2c2b('0x17')](_0x2c2b('0xc'),auth['isAuthenticated'](),controller[_0x2c2b('0x18')]);module[_0x2c2b('0x19')]=router; \ No newline at end of file +var _0x7a6d=['/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x3d4345,_0xace8a6){var _0x1ceb93=function(_0x47f0b3){while(--_0x47f0b3){_0x3d4345['push'](_0x3d4345['shift']());}};_0x1ceb93(++_0xace8a6);}(_0x7a6d,0x99));var _0xd7a6=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x7a6d[_0x10f6e8];return _0x35bb3c;};'use strict';var multer=require(_0xd7a6('0x0'));var util=require(_0xd7a6('0x1'));var path=require('path');var timeout=require(_0xd7a6('0x2'));var express=require(_0xd7a6('0x3'));var router=express[_0xd7a6('0x4')]();var auth=require(_0xd7a6('0x5'));var interaction=require(_0xd7a6('0x6'));var config=require('../../config/environment');var controller=require(_0xd7a6('0x7'));router[_0xd7a6('0x8')]('/',auth[_0xd7a6('0x9')](),controller[_0xd7a6('0xa')]);router[_0xd7a6('0x8')](_0xd7a6('0xb'),auth[_0xd7a6('0x9')](),controller[_0xd7a6('0xc')]);router[_0xd7a6('0x8')](_0xd7a6('0xd'),auth['isAuthenticated'](),controller[_0xd7a6('0xe')]);router[_0xd7a6('0x8')](_0xd7a6('0xf'),auth['isAuthenticated'](),controller[_0xd7a6('0x10')]);router[_0xd7a6('0x11')]('/',auth[_0xd7a6('0x9')](),controller[_0xd7a6('0x12')]);router['post'](_0xd7a6('0xd'),auth[_0xd7a6('0x9')](),controller[_0xd7a6('0x13')]);router['put'](_0xd7a6('0xb'),auth[_0xd7a6('0x9')](),controller[_0xd7a6('0x14')]);router[_0xd7a6('0x15')](_0xd7a6('0xb'),auth[_0xd7a6('0x9')](),controller[_0xd7a6('0x16')]);module[_0xd7a6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 2e469d5..5cb5fa5 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 _0x814b=['STRING','username','ENUM','newTab','integrationTab','sequelize','exports'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0x814b,0x1a2));var _0xb814=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x814b[_0x383356];return _0x32ee5a;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')]},'description':{'type':Sequelize[_0xb814('0x2')]},'username':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb814('0x2')]},'clientId':{'type':Sequelize[_0xb814('0x2')]},'clientSecret':{'type':Sequelize[_0xb814('0x2')]},'securityToken':{'type':Sequelize[_0xb814('0x2')]},'serverUrl':{'type':Sequelize[_0xb814('0x2')]},'type':{'type':Sequelize[_0xb814('0x4')]('integrationTab',_0xb814('0x5')),'defaultValue':_0xb814('0x6')}}; \ No newline at end of file +var _0x326f=['STRING','username','ENUM','newTab','integrationTab','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x4dd785,_0x496a7f){_0x4dd785=_0x4dd785-0x0;var _0x2026e1=_0x326f[_0x4dd785];return _0x2026e1;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf326('0x1')]},'username':{'type':Sequelize[_0xf326('0x1')],'unique':_0xf326('0x2')},'remoteUri':{'type':Sequelize[_0xf326('0x1')]},'password':{'type':Sequelize[_0xf326('0x1')]},'clientId':{'type':Sequelize[_0xf326('0x1')]},'clientSecret':{'type':Sequelize[_0xf326('0x1')]},'securityToken':{'type':Sequelize[_0xf326('0x1')]},'serverUrl':{'type':Sequelize[_0xf326('0x1')]},'type':{'type':Sequelize[_0xf326('0x3')]('integrationTab',_0xf326('0x4')),'defaultValue':_0xf326('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c2d8a2b..41982c9 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 _0x8b6d=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','include','find','create','body','update','params','findOne','model','SalesforceConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','Task','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallType','Priority','Status','isNil','Case','Type','Origin','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','boolean','true','False','false','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','stack','name','send','SalesforceAccount','rawAttributes','fieldName','type','map','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','query','order'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b6d,0xc2));var _0xd8b6=function(_0x208dd9,_0x2140b0){_0x208dd9=_0x208dd9-0x0;var _0x1295ab=_0x8b6d[_0x208dd9];return _0x1295ab;};'use strict';var pdf=require(_0xd8b6('0x0'));var emlformat=require(_0xd8b6('0x1'));var rimraf=require(_0xd8b6('0x2'));var zipdir=require(_0xd8b6('0x3'));var jsonpatch=require(_0xd8b6('0x4'));var rp=require(_0xd8b6('0x5'));var moment=require(_0xd8b6('0x6'));var BPromise=require(_0xd8b6('0x7'));var Mustache=require(_0xd8b6('0x8'));var util=require(_0xd8b6('0x9'));var path=require(_0xd8b6('0xa'));var sox=require(_0xd8b6('0xb'));var csv=require(_0xd8b6('0xc'));var ejs=require(_0xd8b6('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd8b6('0xe'));var jsforce=require(_0xd8b6('0xf'));var deskjs=require(_0xd8b6('0x10'));var toCsv=require(_0xd8b6('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd8b6('0x11'));var qs=require(_0xd8b6('0x12'));var as=require(_0xd8b6('0x13'));var hardwareService=require(_0xd8b6('0x14'));var logger=require(_0xd8b6('0x15'))(_0xd8b6('0x16'));var utils=require('../../config/utils');var config=require(_0xd8b6('0x17'));var db=require(_0xd8b6('0x18'))['db'];var integrations=require(_0xd8b6('0x19'));var jayson=require(_0xd8b6('0x1a'));var client=jayson['client'][_0xd8b6('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5d40f8,_0x6de9e9,_0x5c150f){if(_0x5c150f){var _0x58859e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58859e[_0xd8b6('0x1c')](_0x6de9e9)){return _0x5d40f8;}else{throw new db[(_0xd8b6('0x1d'))][(_0xd8b6('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 _0x5d40f8;}}function respondWithRpcPromise(_0xa8ff1b,_0x499d7e,_0x56a809,_0x1a97f1){return new BPromise(function(_0x20f9bd,_0x412f62){var _0x3487a3=_0x1a97f1||client;return _0x3487a3[_0xd8b6('0x1f')](_0xa8ff1b,_0x56a809)[_0xd8b6('0x20')](function(_0x51b66d){logger['info'](_0xd8b6('0x21'),_0x499d7e,_0xd8b6('0x22'));logger[_0xd8b6('0x23')](_0xd8b6('0x24'),_0x499d7e,'request\x20sent',JSON['stringify'](_0x51b66d));if(_0x51b66d[_0xd8b6('0x25')]){if(_0x51b66d['error'][_0xd8b6('0x26')]===0x1f4){logger[_0xd8b6('0x25')](_0xd8b6('0x21'),_0x499d7e,_0x51b66d['error'][_0xd8b6('0x27')]);return _0x412f62(_0x51b66d[_0xd8b6('0x25')][_0xd8b6('0x27')]);}logger[_0xd8b6('0x25')](_0xd8b6('0x21'),_0x499d7e,_0x51b66d[_0xd8b6('0x25')][_0xd8b6('0x27')]);return _0x20f9bd(_0x51b66d[_0xd8b6('0x25')][_0xd8b6('0x27')]);}else{logger['info'](_0xd8b6('0x21'),_0x499d7e,'request\x20sent');_0x20f9bd(_0x51b66d['result'][_0xd8b6('0x27')]);}})[_0xd8b6('0x28')](function(_0x40ce1c){logger[_0xd8b6('0x25')]('SalesforceAccount,\x20%s,\x20%s',_0x499d7e,_0x40ce1c);_0x412f62(_0x40ce1c);});});}function respondWithStatusCode(_0x3cff33,_0x215cad){_0x215cad=_0x215cad||0xcc;return function(_0x4a5336){if(_0x4a5336){return _0x3cff33[_0xd8b6('0x29')](_0x215cad);}return _0x3cff33[_0xd8b6('0x2a')](_0x215cad)[_0xd8b6('0x2b')]();};}function respondWithResult(_0x46922a,_0x5b420b){_0x5b420b=_0x5b420b||0xc8;return function(_0x5bb342){if(_0x5bb342){return _0x46922a[_0xd8b6('0x2a')](_0x5b420b)[_0xd8b6('0x2c')](_0x5bb342);}};}function respondWithFilteredResult(_0xa5282,_0x463dd7){return function(_0x185baa){if(_0x185baa){var _0x311471=_0x185baa[_0xd8b6('0x2d')],_0xfeb0bb=_0x463dd7[_0xd8b6('0x2e')],_0x4c1dbb=_0x463dd7['offset']+_0x463dd7[_0xd8b6('0x2f')],_0x47f0eb;if(_0x4c1dbb>=_0x311471){_0x4c1dbb=_0x311471;_0x47f0eb=0xc8;}else{_0x47f0eb=0xce;}_0xa5282[_0xd8b6('0x2a')](_0x47f0eb);return _0xa5282[_0xd8b6('0x30')](_0xd8b6('0x31'),_0xfeb0bb+'-'+_0x4c1dbb+'/'+_0x311471)['json'](_0x185baa);}return null;};}function patchUpdates(_0x34f20){return function(_0x35ba9c){try{jsonpatch[_0xd8b6('0x32')](_0x35ba9c,_0x34f20,!![]);}catch(_0x13d914){return BPromise['reject'](_0x13d914);}return _0x35ba9c[_0xd8b6('0x33')]();};}function saveUpdates(_0x477f9a,_0x1fd0e3){return function(_0x3baf72){if(_0x3baf72){return _0x3baf72['update'](_0x477f9a)['then'](function(_0x3a31ab){return _0x3a31ab;});}return null;};}function removeEntity(_0x29ec03,_0x8ed479){return function(_0x2485b7){if(_0x2485b7){return _0x2485b7['destroy']()['then'](function(){_0x29ec03[_0xd8b6('0x2a')](0xcc)[_0xd8b6('0x2b')]();});}};}function handleEntityNotFound(_0x3266d8,_0x4915a6){return function(_0x309d7b){if(!_0x309d7b){_0x3266d8[_0xd8b6('0x29')](0x194);}return _0x309d7b;};}function handleError(_0x494c29,_0x411238){_0x411238=_0x411238||0x1f4;return function(_0x302f1e){logger[_0xd8b6('0x25')](_0x302f1e[_0xd8b6('0x34')]);if(_0x302f1e['name']){delete _0x302f1e[_0xd8b6('0x35')];}_0x494c29['status'](_0x411238)[_0xd8b6('0x36')](_0x302f1e);};}exports['index']=function(_0x32b11d,_0x10c0ee){var _0x4ee321={},_0x267eb4={},_0x1b3fc6={'count':0x0,'rows':[]};var _0x59f747=_['map'](db[_0xd8b6('0x37')][_0xd8b6('0x38')],function(_0x744266){return{'name':_0x744266[_0xd8b6('0x39')],'type':_0x744266[_0xd8b6('0x3a')]['key']};});_0x267eb4['model']=_[_0xd8b6('0x3b')](_0x59f747,'name');_0x267eb4['query']=_[_0xd8b6('0x3c')](_0x32b11d['query']);_0x267eb4[_0xd8b6('0x3d')]=_[_0xd8b6('0x3e')](_0x267eb4['model'],_0x267eb4['query']);_0x4ee321[_0xd8b6('0x3f')]=_[_0xd8b6('0x3e')](_0x267eb4['model'],qs[_0xd8b6('0x40')](_0x32b11d['query'][_0xd8b6('0x40')]));_0x4ee321['attributes']=_0x4ee321[_0xd8b6('0x3f')][_0xd8b6('0x41')]?_0x4ee321[_0xd8b6('0x3f')]:_0x267eb4['model'];if(!_0x32b11d['query'][_0xd8b6('0x42')](_0xd8b6('0x43'))){_0x4ee321['limit']=qs[_0xd8b6('0x2f')](_0x32b11d[_0xd8b6('0x44')][_0xd8b6('0x2f')]);_0x4ee321[_0xd8b6('0x2e')]=qs['offset'](_0x32b11d[_0xd8b6('0x44')]['offset']);}_0x4ee321[_0xd8b6('0x45')]=qs[_0xd8b6('0x46')](_0x32b11d[_0xd8b6('0x44')][_0xd8b6('0x46')]);_0x4ee321[_0xd8b6('0x47')]=qs[_0xd8b6('0x3d')](_[_0xd8b6('0x48')](_0x32b11d['query'],_0x267eb4[_0xd8b6('0x3d')]),_0x59f747);if(_0x32b11d['query'][_0xd8b6('0x49')]){_0x4ee321[_0xd8b6('0x47')]=_[_0xd8b6('0x4a')](_0x4ee321[_0xd8b6('0x47')],{'$or':_['map'](_0x59f747,function(_0xe4a0e8){if(_0xe4a0e8['type']!==_0xd8b6('0x4b')){var _0x3e7b37={};_0x3e7b37[_0xe4a0e8[_0xd8b6('0x35')]]={'$like':'%'+_0x32b11d[_0xd8b6('0x44')][_0xd8b6('0x49')]+'%'};return _0x3e7b37;}})});}_0x4ee321=_[_0xd8b6('0x4a')]({},_0x4ee321,_0x32b11d[_0xd8b6('0x4c')]);var _0x40e072={'where':_0x4ee321[_0xd8b6('0x47')]};return db['SalesforceAccount'][_0xd8b6('0x2d')](_0x40e072)[_0xd8b6('0x20')](function(_0x2cd86e){_0x1b3fc6[_0xd8b6('0x2d')]=_0x2cd86e;if(_0x32b11d[_0xd8b6('0x44')][_0xd8b6('0x4d')]){_0x4ee321['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0xd8b6('0x4e')](_0x4ee321);})[_0xd8b6('0x20')](function(_0x5786c0){_0x1b3fc6['rows']=_0x5786c0;return _0x1b3fc6;})[_0xd8b6('0x20')](respondWithFilteredResult(_0x10c0ee,_0x4ee321))[_0xd8b6('0x28')](handleError(_0x10c0ee,null));};exports[_0xd8b6('0x4f')]=function(_0x23436d,_0x4647ab){var _0x1acb46={'raw':![],'where':{'id':_0x23436d['params']['id']}},_0x4b2bbd={};_0x4b2bbd['model']=_[_0xd8b6('0x3c')](db[_0xd8b6('0x37')]['rawAttributes']);_0x4b2bbd[_0xd8b6('0x44')]=_['keys'](_0x23436d[_0xd8b6('0x44')]);_0x4b2bbd['filters']=_['intersection'](_0x4b2bbd['model'],_0x4b2bbd['query']);_0x1acb46[_0xd8b6('0x3f')]=_['intersection'](_0x4b2bbd['model'],qs[_0xd8b6('0x40')](_0x23436d[_0xd8b6('0x44')][_0xd8b6('0x40')]));_0x1acb46[_0xd8b6('0x3f')]=_0x1acb46['attributes'][_0xd8b6('0x41')]?_0x1acb46[_0xd8b6('0x3f')]:_0x4b2bbd['model'];if(_0x23436d[_0xd8b6('0x44')][_0xd8b6('0x4d')]){_0x1acb46[_0xd8b6('0x50')]=[{'all':!![]}];}_0x1acb46=_[_0xd8b6('0x4a')]({},_0x1acb46,_0x23436d['options']);return db[_0xd8b6('0x37')][_0xd8b6('0x51')](_0x1acb46)[_0xd8b6('0x20')](handleEntityNotFound(_0x4647ab,null))['then'](respondWithResult(_0x4647ab,null))[_0xd8b6('0x28')](handleError(_0x4647ab,null));};exports[_0xd8b6('0x52')]=function(_0x13aad5,_0x4ffd7d){return db['SalesforceAccount'][_0xd8b6('0x52')](_0x13aad5[_0xd8b6('0x53')],{})[_0xd8b6('0x20')](respondWithResult(_0x4ffd7d,0xc9))[_0xd8b6('0x28')](handleError(_0x4ffd7d,null));};exports[_0xd8b6('0x54')]=function(_0x3b06d0,_0x44b647){if(_0x3b06d0[_0xd8b6('0x53')]['id']){delete _0x3b06d0[_0xd8b6('0x53')]['id'];}return db[_0xd8b6('0x37')]['find']({'where':{'id':_0x3b06d0[_0xd8b6('0x55')]['id']}})[_0xd8b6('0x20')](handleEntityNotFound(_0x44b647,null))[_0xd8b6('0x20')](saveUpdates(_0x3b06d0[_0xd8b6('0x53')],null))['then'](respondWithResult(_0x44b647,null))[_0xd8b6('0x28')](handleError(_0x44b647,null));};exports['destroy']=function(_0x19254e,_0x5a3de9){return db[_0xd8b6('0x37')][_0xd8b6('0x51')]({'where':{'id':_0x19254e['params']['id']}})[_0xd8b6('0x20')](handleEntityNotFound(_0x5a3de9,null))[_0xd8b6('0x20')](removeEntity(_0x5a3de9,null))[_0xd8b6('0x28')](handleError(_0x5a3de9,null));};exports['getConfigurations']=function(_0x352e8c,_0x3a424d,_0x44a213){var _0x38cff3={};var _0x3ea164={};var _0x507f3a;var _0x3f9450;return db[_0xd8b6('0x37')][_0xd8b6('0x56')]({'where':{'id':_0x352e8c[_0xd8b6('0x55')]['id']}})['then'](handleEntityNotFound(_0x3a424d,null))['then'](function(_0x3ad4b7){if(_0x3ad4b7){_0x507f3a=_0x3ad4b7;_0x3ea164[_0xd8b6('0x57')]=_[_0xd8b6('0x3c')](db[_0xd8b6('0x58')][_0xd8b6('0x38')]);_0x3ea164[_0xd8b6('0x44')]=_[_0xd8b6('0x3c')](_0x352e8c[_0xd8b6('0x44')]);_0x3ea164[_0xd8b6('0x3d')]=_[_0xd8b6('0x3e')](_0x3ea164[_0xd8b6('0x57')],_0x3ea164[_0xd8b6('0x44')]);_0x38cff3[_0xd8b6('0x3f')]=_['intersection'](_0x3ea164[_0xd8b6('0x57')],qs[_0xd8b6('0x40')](_0x352e8c['query']['fields']));_0x38cff3[_0xd8b6('0x3f')]=_0x38cff3[_0xd8b6('0x3f')][_0xd8b6('0x41')]?_0x38cff3[_0xd8b6('0x3f')]:_0x3ea164['model'];_0x38cff3['order']=qs[_0xd8b6('0x46')](_0x352e8c['query'][_0xd8b6('0x46')]);_0x38cff3[_0xd8b6('0x47')]=qs[_0xd8b6('0x3d')](_[_0xd8b6('0x48')](_0x352e8c[_0xd8b6('0x44')],_0x3ea164['filters']));if(_0x352e8c['query'][_0xd8b6('0x49')]){_0x38cff3['where']=_[_0xd8b6('0x4a')](_0x38cff3[_0xd8b6('0x47')],{'$or':_['map'](_0x38cff3[_0xd8b6('0x3f')],function(_0xceb660){var _0x3afb58={};_0x3afb58[_0xceb660]={'$like':'%'+_0x352e8c[_0xd8b6('0x44')]['filter']+'%'};return _0x3afb58;})});}_0x38cff3=_[_0xd8b6('0x4a')]({},_0x38cff3,_0x352e8c['options']);return _0x507f3a[_0xd8b6('0x59')](_0x38cff3);}})[_0xd8b6('0x20')](function(_0x475cfd){if(_0x475cfd){_0x3f9450=_0x475cfd['length'];if(!_0x352e8c[_0xd8b6('0x44')][_0xd8b6('0x42')](_0xd8b6('0x43'))){_0x38cff3['limit']=qs[_0xd8b6('0x2f')](_0x352e8c[_0xd8b6('0x44')][_0xd8b6('0x2f')]);_0x38cff3[_0xd8b6('0x2e')]=qs[_0xd8b6('0x2e')](_0x352e8c[_0xd8b6('0x44')]['offset']);}return _0x507f3a[_0xd8b6('0x59')](_0x38cff3);}})[_0xd8b6('0x20')](function(_0x466897){if(_0x466897){return _0x466897?{'count':_0x3f9450,'rows':_0x466897}:null;}})['then'](respondWithResult(_0x3a424d,null))[_0xd8b6('0x28')](handleError(_0x3a424d,null));};exports['addConfiguration']=function(_0x5805d7,_0x194586,_0x33137f){if(_0x5805d7['body']['id']){delete _0x5805d7['body']['id'];}return db[_0xd8b6('0x37')]['findOne']({'where':{'id':_0x5805d7['params']['id']}})[_0xd8b6('0x20')](handleEntityNotFound(_0x194586,null))[_0xd8b6('0x20')](function(_0xca0526){if(_0xca0526){_0x5805d7[_0xd8b6('0x53')][_0xd8b6('0x5a')]=_0xca0526['id'];_0x5805d7['body'][_0xd8b6('0x5b')]=integrations[_0xd8b6('0x5c')](_0x5805d7[_0xd8b6('0x53')][_0xd8b6('0x5d')],_0x5805d7[_0xd8b6('0x53')]['type']);_0x5805d7[_0xd8b6('0x53')][_0xd8b6('0x5e')]=integrations[_0xd8b6('0x5f')](_0x5805d7[_0xd8b6('0x53')]['channel'],_0x5805d7[_0xd8b6('0x53')][_0xd8b6('0x3a')]);return db[_0xd8b6('0x58')][_0xd8b6('0x52')](_0x5805d7['body'],{'include':[{'model':db['SalesforceField'],'as':_0xd8b6('0x5b')},{'model':db['SalesforceField'],'as':_0xd8b6('0x5e')}]});}return null;})[_0xd8b6('0x20')](respondWithResult(_0x194586,null))['catch'](handleError(_0x194586,null));};exports[_0xd8b6('0x60')]=function(_0x49dfd7,_0xeca175,_0x5d39a9){var _0x1fedb1;var _0x5011ec='';var _0x32ec77=_0xd8b6('0x61');return db[_0xd8b6('0x37')][_0xd8b6('0x56')]({'where':{'id':_0x49dfd7[_0xd8b6('0x55')]['id']},'attributes':['id','remoteUri',_0xd8b6('0x62'),_0xd8b6('0x63'),_0xd8b6('0x64'),_0xd8b6('0x65'),_0xd8b6('0x66')]})[_0xd8b6('0x20')](handleEntityNotFound(_0xeca175,null))[_0xd8b6('0x20')](function(_0x38daeb){if(_0x38daeb){_0x5011ec=_0x38daeb['remoteUri'];var _0x2ba9f0=_0x5011ec['slice'](-0x1);if(_0x2ba9f0==='/'){_0x5011ec=_0x5011ec[_0xd8b6('0x67')](0x0,_0x5011ec[_0xd8b6('0x68')](_0x2ba9f0));}_0x1fedb1=new jsforce[(_0xd8b6('0x69'))]({'oauth2':{'loginUrl':_0x5011ec,'clientId':_0x38daeb[_0xd8b6('0x62')],'clientSecret':_0x38daeb[_0xd8b6('0x63')]}});return _0x1fedb1[_0xd8b6('0x6a')](_0x38daeb['username'],_0x38daeb[_0xd8b6('0x65')][_0xd8b6('0x6b')](_0x38daeb[_0xd8b6('0x66')]));}})['then'](function(_0xaad263){if(_0xaad263){if(!_['isNil'](_0x49dfd7[_0xd8b6('0x44')][_0xd8b6('0x6c')])){_0x32ec77=_0x49dfd7['query'][_0xd8b6('0x6c')];}return _0x1fedb1[_0xd8b6('0x6d')](_0x32ec77)['describe']();}})['then'](function(_0x279437){var _0x19a8b9=[_0xd8b6('0x6e'),_0xd8b6('0x6f'),'CallObject',_0xd8b6('0x70'),'IsArchived',_0xd8b6('0x71'),_0xd8b6('0x72'),'Type'];if(!_[_0xd8b6('0x73')](_0x49dfd7[_0xd8b6('0x44')][_0xd8b6('0x6c')])&&_0x49dfd7[_0xd8b6('0x44')]['ticketType']===_0xd8b6('0x74')){_0x19a8b9=[_0xd8b6('0x75'),_0xd8b6('0x76'),'Reason',_0xd8b6('0x72'),_0xd8b6('0x71'),_0xd8b6('0x77'),_0xd8b6('0x78'),_0xd8b6('0x79')];}if(_0x279437){_[_0xd8b6('0x7a')](_0x279437[_0xd8b6('0x40')],function(_0x312da7){return _0x312da7[_0xd8b6('0x7b')]===![]&&!_0x19a8b9[_0xd8b6('0x7c')](_0x312da7['name']);});return{'count':_0x279437[_0xd8b6('0x40')][_0xd8b6('0x41')],'rows':_['map'](_0x279437['fields'],function(_0x2b762f){return{'id':_0x2b762f[_0xd8b6('0x35')],'name':_0x2b762f[_0xd8b6('0x7d')],'custom':_0x2b762f['custom'],'options':_0x2b762f[_0xd8b6('0x7e')][_0xd8b6('0x41')]>0x0?_['map'](_0x2b762f[_0xd8b6('0x7e')],function(_0x2c187c){return{'name':_0x2c187c[_0xd8b6('0x7d')],'value':_0x2c187c['value']};}):_0x2b762f[_0xd8b6('0x3a')]==_0xd8b6('0x7f')?[{'name':'True','value':_0xd8b6('0x80')},{'name':_0xd8b6('0x81'),'value':_0xd8b6('0x82')}]:[]};})};}})[_0xd8b6('0x20')](respondWithResult(_0xeca175,null))[_0xd8b6('0x28')](function(_0x2a251a){var _0x288402=_0x49dfd7['query']['test']?0x1f4:_0x2a251a['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd8b6('0x60'),_0x288402,JSON['stringify'](_0x2a251a));delete _0x2a251a[_0xd8b6('0x35')];if(_0x288402===0x191){_0x288402=0x190;}_0xeca175[_0xd8b6('0x2a')](_0x288402)[_0xd8b6('0x36')](_0x49dfd7[_0xd8b6('0x44')][_0xd8b6('0x1c')]?{'message':_0xd8b6('0x83'),'statusCode':_0x2a251a['statusCode']}:_0x2a251a);});}; \ No newline at end of file +var _0xfc41=['findAll','catch','show','params','merge','options','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','pick','filter','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceField','Descriptions','getFields','remoteUri','clientId','clientSecret','password','securityToken','slice','login','concat','isNil','ticketType','describe','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Status','Type','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','picklistValues','label','value','True','true','false','statusCode','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','sendStatus','status','count','offset','Content-Range','apply','save','then','destroy','end','stack','name','SalesforceAccount','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','includeAll','include'];(function(_0x1e18dc,_0x58352d){var _0x356ae0=function(_0x598995){while(--_0x598995){_0x1e18dc['push'](_0x1e18dc['shift']());}};_0x356ae0(++_0x58352d);}(_0xfc41,0x133));var _0x1fc4=function(_0x4273f7,_0x3d880a){_0x4273f7=_0x4273f7-0x0;var _0x411bbe=_0xfc41[_0x4273f7];return _0x411bbe;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1fc4('0x0'));var zipdir=require(_0x1fc4('0x1'));var jsonpatch=require(_0x1fc4('0x2'));var rp=require('request-promise');var moment=require(_0x1fc4('0x3'));var BPromise=require(_0x1fc4('0x4'));var Mustache=require('mustache');var util=require(_0x1fc4('0x5'));var path=require('path');var sox=require(_0x1fc4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1fc4('0x7'));var squel=require(_0x1fc4('0x8'));var crypto=require(_0x1fc4('0x9'));var jsforce=require(_0x1fc4('0xa'));var deskjs=require(_0x1fc4('0xb'));var toCsv=require(_0x1fc4('0xc'));var querystring=require(_0x1fc4('0xd'));var Papa=require(_0x1fc4('0xe'));var Redis=require('ioredis');var authService=require(_0x1fc4('0xf'));var qs=require(_0x1fc4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1fc4('0x11'));var db=require(_0x1fc4('0x12'))['db'];var integrations=require(_0x1fc4('0x13'));var jayson=require(_0x1fc4('0x14'));var client=jayson[_0x1fc4('0x15')][_0x1fc4('0x16')]({'port':0x232a});function checkPasswordPattern(_0xe4a1b8,_0xde2011,_0x1175b5){if(_0x1175b5){var _0x2e7fb9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e7fb9[_0x1fc4('0x17')](_0xde2011)){return _0xe4a1b8;}else{throw new db[(_0x1fc4('0x18'))][(_0x1fc4('0x19'))]('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 _0xe4a1b8;}}function respondWithRpcPromise(_0x5e93f8,_0x51f648,_0x5b1af5,_0x3baf14){return new BPromise(function(_0x3c057b,_0x53885d){var _0x143822=_0x3baf14||client;return _0x143822['request'](_0x5e93f8,_0x5b1af5)['then'](function(_0x341fdb){logger['info'](_0x1fc4('0x1a'),_0x51f648,_0x1fc4('0x1b'));logger[_0x1fc4('0x1c')](_0x1fc4('0x1d'),_0x51f648,_0x1fc4('0x1b'),JSON['stringify'](_0x341fdb));if(_0x341fdb[_0x1fc4('0x1e')]){if(_0x341fdb['error']['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x51f648,_0x341fdb['error'][_0x1fc4('0x1f')]);return _0x53885d(_0x341fdb[_0x1fc4('0x1e')]['message']);}logger[_0x1fc4('0x1e')]('SalesforceAccount,\x20%s,\x20%s',_0x51f648,_0x341fdb[_0x1fc4('0x1e')][_0x1fc4('0x1f')]);return _0x3c057b(_0x341fdb[_0x1fc4('0x1e')][_0x1fc4('0x1f')]);}else{logger[_0x1fc4('0x20')](_0x1fc4('0x1a'),_0x51f648,_0x1fc4('0x1b'));_0x3c057b(_0x341fdb[_0x1fc4('0x21')][_0x1fc4('0x1f')]);}})['catch'](function(_0x2ee920){logger[_0x1fc4('0x1e')](_0x1fc4('0x1a'),_0x51f648,_0x2ee920);_0x53885d(_0x2ee920);});});}function respondWithStatusCode(_0x53ce9c,_0x5c730f){_0x5c730f=_0x5c730f||0xcc;return function(_0xda8635){if(_0xda8635){return _0x53ce9c[_0x1fc4('0x22')](_0x5c730f);}return _0x53ce9c[_0x1fc4('0x23')](_0x5c730f)['end']();};}function respondWithResult(_0x4d2def,_0x1b1850){_0x1b1850=_0x1b1850||0xc8;return function(_0x36687c){if(_0x36687c){return _0x4d2def[_0x1fc4('0x23')](_0x1b1850)['json'](_0x36687c);}};}function respondWithFilteredResult(_0x1941c4,_0x452ed6){return function(_0x24a713){if(_0x24a713){var _0x10ad1d=_0x24a713[_0x1fc4('0x24')],_0xfd54c7=_0x452ed6[_0x1fc4('0x25')],_0x3afc54=_0x452ed6[_0x1fc4('0x25')]+_0x452ed6['limit'],_0x21a9ee;if(_0x3afc54>=_0x10ad1d){_0x3afc54=_0x10ad1d;_0x21a9ee=0xc8;}else{_0x21a9ee=0xce;}_0x1941c4['status'](_0x21a9ee);return _0x1941c4['set'](_0x1fc4('0x26'),_0xfd54c7+'-'+_0x3afc54+'/'+_0x10ad1d)['json'](_0x24a713);}return null;};}function patchUpdates(_0x3eb1ac){return function(_0x3d7cd1){try{jsonpatch[_0x1fc4('0x27')](_0x3d7cd1,_0x3eb1ac,!![]);}catch(_0x22407d){return BPromise['reject'](_0x22407d);}return _0x3d7cd1[_0x1fc4('0x28')]();};}function saveUpdates(_0x46758d,_0x706f43){return function(_0xf52477){if(_0xf52477){return _0xf52477['update'](_0x46758d)[_0x1fc4('0x29')](function(_0x4b7e89){return _0x4b7e89;});}return null;};}function removeEntity(_0x2e7fcb,_0x3de29e){return function(_0x21485d){if(_0x21485d){return _0x21485d[_0x1fc4('0x2a')]()[_0x1fc4('0x29')](function(){_0x2e7fcb[_0x1fc4('0x23')](0xcc)[_0x1fc4('0x2b')]();});}};}function handleEntityNotFound(_0x5d1882,_0x35e191){return function(_0x487710){if(!_0x487710){_0x5d1882[_0x1fc4('0x22')](0x194);}return _0x487710;};}function handleError(_0x234eea,_0x1dd0cd){_0x1dd0cd=_0x1dd0cd||0x1f4;return function(_0x4fef5c){logger[_0x1fc4('0x1e')](_0x4fef5c[_0x1fc4('0x2c')]);if(_0x4fef5c[_0x1fc4('0x2d')]){delete _0x4fef5c[_0x1fc4('0x2d')];}_0x234eea[_0x1fc4('0x23')](_0x1dd0cd)['send'](_0x4fef5c);};}exports['index']=function(_0x4c1908,_0x779bf4){var _0x371210={},_0x5c801a={},_0x27688e={'count':0x0,'rows':[]};var _0x2b3393=_['map'](db[_0x1fc4('0x2e')][_0x1fc4('0x2f')],function(_0x9a5e1){return{'name':_0x9a5e1[_0x1fc4('0x30')],'type':_0x9a5e1[_0x1fc4('0x31')][_0x1fc4('0x32')]};});_0x5c801a['model']=_[_0x1fc4('0x33')](_0x2b3393,'name');_0x5c801a[_0x1fc4('0x34')]=_[_0x1fc4('0x35')](_0x4c1908[_0x1fc4('0x34')]);_0x5c801a['filters']=_['intersection'](_0x5c801a[_0x1fc4('0x36')],_0x5c801a[_0x1fc4('0x34')]);_0x371210[_0x1fc4('0x37')]=_[_0x1fc4('0x38')](_0x5c801a[_0x1fc4('0x36')],qs['fields'](_0x4c1908[_0x1fc4('0x34')][_0x1fc4('0x39')]));_0x371210[_0x1fc4('0x37')]=_0x371210[_0x1fc4('0x37')][_0x1fc4('0x3a')]?_0x371210[_0x1fc4('0x37')]:_0x5c801a[_0x1fc4('0x36')];if(!_0x4c1908['query'][_0x1fc4('0x3b')](_0x1fc4('0x3c'))){_0x371210['limit']=qs[_0x1fc4('0x3d')](_0x4c1908[_0x1fc4('0x34')]['limit']);_0x371210[_0x1fc4('0x25')]=qs['offset'](_0x4c1908[_0x1fc4('0x34')][_0x1fc4('0x25')]);}_0x371210[_0x1fc4('0x3e')]=qs[_0x1fc4('0x3f')](_0x4c1908[_0x1fc4('0x34')][_0x1fc4('0x3f')]);_0x371210[_0x1fc4('0x40')]=qs[_0x1fc4('0x41')](_['pick'](_0x4c1908[_0x1fc4('0x34')],_0x5c801a[_0x1fc4('0x41')]),_0x2b3393);if(_0x4c1908['query']['filter']){_0x371210[_0x1fc4('0x40')]=_['merge'](_0x371210[_0x1fc4('0x40')],{'$or':_[_0x1fc4('0x33')](_0x2b3393,function(_0x5542df){if(_0x5542df[_0x1fc4('0x31')]!=='VIRTUAL'){var _0x5a74d9={};_0x5a74d9[_0x5542df['name']]={'$like':'%'+_0x4c1908['query']['filter']+'%'};return _0x5a74d9;}})});}_0x371210=_['merge']({},_0x371210,_0x4c1908['options']);var _0x5eba2a={'where':_0x371210['where']};return db[_0x1fc4('0x2e')][_0x1fc4('0x24')](_0x5eba2a)[_0x1fc4('0x29')](function(_0x117b33){_0x27688e[_0x1fc4('0x24')]=_0x117b33;if(_0x4c1908[_0x1fc4('0x34')][_0x1fc4('0x42')]){_0x371210[_0x1fc4('0x43')]=[{'all':!![]}];}return db[_0x1fc4('0x2e')][_0x1fc4('0x44')](_0x371210);})[_0x1fc4('0x29')](function(_0x4003ab){_0x27688e['rows']=_0x4003ab;return _0x27688e;})[_0x1fc4('0x29')](respondWithFilteredResult(_0x779bf4,_0x371210))[_0x1fc4('0x45')](handleError(_0x779bf4,null));};exports[_0x1fc4('0x46')]=function(_0xbd8d06,_0x4e5d91){var _0x535a70={'raw':![],'where':{'id':_0xbd8d06[_0x1fc4('0x47')]['id']}},_0x4afd89={};_0x4afd89[_0x1fc4('0x36')]=_[_0x1fc4('0x35')](db['SalesforceAccount'][_0x1fc4('0x2f')]);_0x4afd89[_0x1fc4('0x34')]=_['keys'](_0xbd8d06[_0x1fc4('0x34')]);_0x4afd89[_0x1fc4('0x41')]=_[_0x1fc4('0x38')](_0x4afd89['model'],_0x4afd89['query']);_0x535a70[_0x1fc4('0x37')]=_[_0x1fc4('0x38')](_0x4afd89['model'],qs[_0x1fc4('0x39')](_0xbd8d06[_0x1fc4('0x34')][_0x1fc4('0x39')]));_0x535a70[_0x1fc4('0x37')]=_0x535a70['attributes'][_0x1fc4('0x3a')]?_0x535a70[_0x1fc4('0x37')]:_0x4afd89[_0x1fc4('0x36')];if(_0xbd8d06[_0x1fc4('0x34')][_0x1fc4('0x42')]){_0x535a70[_0x1fc4('0x43')]=[{'all':!![]}];}_0x535a70=_[_0x1fc4('0x48')]({},_0x535a70,_0xbd8d06[_0x1fc4('0x49')]);return db[_0x1fc4('0x2e')][_0x1fc4('0x4a')](_0x535a70)[_0x1fc4('0x29')](handleEntityNotFound(_0x4e5d91,null))[_0x1fc4('0x29')](respondWithResult(_0x4e5d91,null))[_0x1fc4('0x45')](handleError(_0x4e5d91,null));};exports[_0x1fc4('0x4b')]=function(_0x7be8,_0x1749a8){return db[_0x1fc4('0x2e')][_0x1fc4('0x4b')](_0x7be8[_0x1fc4('0x4c')],{})[_0x1fc4('0x29')](respondWithResult(_0x1749a8,0xc9))[_0x1fc4('0x45')](handleError(_0x1749a8,null));};exports[_0x1fc4('0x4d')]=function(_0x17ce83,_0x2aa380){if(_0x17ce83['body']['id']){delete _0x17ce83['body']['id'];}return db[_0x1fc4('0x2e')][_0x1fc4('0x4a')]({'where':{'id':_0x17ce83[_0x1fc4('0x47')]['id']}})[_0x1fc4('0x29')](handleEntityNotFound(_0x2aa380,null))['then'](saveUpdates(_0x17ce83[_0x1fc4('0x4c')],null))[_0x1fc4('0x29')](respondWithResult(_0x2aa380,null))['catch'](handleError(_0x2aa380,null));};exports[_0x1fc4('0x2a')]=function(_0x321886,_0x391757){return db[_0x1fc4('0x2e')][_0x1fc4('0x4a')]({'where':{'id':_0x321886[_0x1fc4('0x47')]['id']}})['then'](handleEntityNotFound(_0x391757,null))[_0x1fc4('0x29')](removeEntity(_0x391757,null))[_0x1fc4('0x45')](handleError(_0x391757,null));};exports[_0x1fc4('0x4e')]=function(_0x2e3f65,_0x1f9498,_0x4a8d3b){var _0x301419={};var _0x3f88d1={};var _0x2d14fd;var _0x88b88e;return db[_0x1fc4('0x2e')][_0x1fc4('0x4f')]({'where':{'id':_0x2e3f65[_0x1fc4('0x47')]['id']}})[_0x1fc4('0x29')](handleEntityNotFound(_0x1f9498,null))['then'](function(_0x42e76c){if(_0x42e76c){_0x2d14fd=_0x42e76c;_0x3f88d1['model']=_[_0x1fc4('0x35')](db[_0x1fc4('0x50')][_0x1fc4('0x2f')]);_0x3f88d1['query']=_[_0x1fc4('0x35')](_0x2e3f65[_0x1fc4('0x34')]);_0x3f88d1[_0x1fc4('0x41')]=_['intersection'](_0x3f88d1[_0x1fc4('0x36')],_0x3f88d1[_0x1fc4('0x34')]);_0x301419[_0x1fc4('0x37')]=_[_0x1fc4('0x38')](_0x3f88d1[_0x1fc4('0x36')],qs[_0x1fc4('0x39')](_0x2e3f65['query'][_0x1fc4('0x39')]));_0x301419[_0x1fc4('0x37')]=_0x301419['attributes'][_0x1fc4('0x3a')]?_0x301419[_0x1fc4('0x37')]:_0x3f88d1[_0x1fc4('0x36')];_0x301419[_0x1fc4('0x3e')]=qs[_0x1fc4('0x3f')](_0x2e3f65[_0x1fc4('0x34')]['sort']);_0x301419[_0x1fc4('0x40')]=qs['filters'](_[_0x1fc4('0x51')](_0x2e3f65[_0x1fc4('0x34')],_0x3f88d1['filters']));if(_0x2e3f65[_0x1fc4('0x34')]['filter']){_0x301419['where']=_[_0x1fc4('0x48')](_0x301419[_0x1fc4('0x40')],{'$or':_[_0x1fc4('0x33')](_0x301419['attributes'],function(_0x21ea53){var _0x203160={};_0x203160[_0x21ea53]={'$like':'%'+_0x2e3f65[_0x1fc4('0x34')][_0x1fc4('0x52')]+'%'};return _0x203160;})});}_0x301419=_['merge']({},_0x301419,_0x2e3f65[_0x1fc4('0x49')]);return _0x2d14fd[_0x1fc4('0x4e')](_0x301419);}})['then'](function(_0x58cee8){if(_0x58cee8){_0x88b88e=_0x58cee8['length'];if(!_0x2e3f65[_0x1fc4('0x34')][_0x1fc4('0x3b')](_0x1fc4('0x3c'))){_0x301419[_0x1fc4('0x3d')]=qs[_0x1fc4('0x3d')](_0x2e3f65['query']['limit']);_0x301419[_0x1fc4('0x25')]=qs['offset'](_0x2e3f65[_0x1fc4('0x34')]['offset']);}return _0x2d14fd[_0x1fc4('0x4e')](_0x301419);}})['then'](function(_0x50b28e){if(_0x50b28e){return _0x50b28e?{'count':_0x88b88e,'rows':_0x50b28e}:null;}})[_0x1fc4('0x29')](respondWithResult(_0x1f9498,null))[_0x1fc4('0x45')](handleError(_0x1f9498,null));};exports['addConfiguration']=function(_0x3ca587,_0x2dafe2,_0x3ea212){if(_0x3ca587[_0x1fc4('0x4c')]['id']){delete _0x3ca587['body']['id'];}return db['SalesforceAccount'][_0x1fc4('0x4f')]({'where':{'id':_0x3ca587[_0x1fc4('0x47')]['id']}})[_0x1fc4('0x29')](handleEntityNotFound(_0x2dafe2,null))[_0x1fc4('0x29')](function(_0x6ad9db){if(_0x6ad9db){_0x3ca587[_0x1fc4('0x4c')][_0x1fc4('0x53')]=_0x6ad9db['id'];_0x3ca587[_0x1fc4('0x4c')][_0x1fc4('0x54')]=integrations[_0x1fc4('0x55')](_0x3ca587['body']['channel'],_0x3ca587['body']['type']);_0x3ca587['body']['Descriptions']=integrations[_0x1fc4('0x56')](_0x3ca587['body'][_0x1fc4('0x57')],_0x3ca587[_0x1fc4('0x4c')]['type']);return db[_0x1fc4('0x50')][_0x1fc4('0x4b')](_0x3ca587[_0x1fc4('0x4c')],{'include':[{'model':db[_0x1fc4('0x58')],'as':_0x1fc4('0x54')},{'model':db[_0x1fc4('0x58')],'as':_0x1fc4('0x59')}]});}return null;})[_0x1fc4('0x29')](respondWithResult(_0x2dafe2,null))[_0x1fc4('0x45')](handleError(_0x2dafe2,null));};exports[_0x1fc4('0x5a')]=function(_0x2d6c29,_0x25a606,_0x4498ac){var _0x59e629;var _0x1a8d27='';var _0x534fd7='Task';return db[_0x1fc4('0x2e')][_0x1fc4('0x4f')]({'where':{'id':_0x2d6c29[_0x1fc4('0x47')]['id']},'attributes':['id',_0x1fc4('0x5b'),_0x1fc4('0x5c'),_0x1fc4('0x5d'),'username',_0x1fc4('0x5e'),_0x1fc4('0x5f')]})[_0x1fc4('0x29')](handleEntityNotFound(_0x25a606,null))[_0x1fc4('0x29')](function(_0x29b4b6){if(_0x29b4b6){_0x1a8d27=_0x29b4b6['remoteUri'];var _0x4decfa=_0x1a8d27[_0x1fc4('0x60')](-0x1);if(_0x4decfa==='/'){_0x1a8d27=_0x1a8d27['substring'](0x0,_0x1a8d27['lastIndexOf'](_0x4decfa));}_0x59e629=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1a8d27,'clientId':_0x29b4b6[_0x1fc4('0x5c')],'clientSecret':_0x29b4b6[_0x1fc4('0x5d')]}});return _0x59e629[_0x1fc4('0x61')](_0x29b4b6['username'],_0x29b4b6[_0x1fc4('0x5e')][_0x1fc4('0x62')](_0x29b4b6[_0x1fc4('0x5f')]));}})['then'](function(_0x821000){if(_0x821000){if(!_[_0x1fc4('0x63')](_0x2d6c29[_0x1fc4('0x34')][_0x1fc4('0x64')])){_0x534fd7=_0x2d6c29[_0x1fc4('0x34')][_0x1fc4('0x64')];}return _0x59e629['sobject'](_0x534fd7)[_0x1fc4('0x65')]();}})[_0x1fc4('0x29')](function(_0x1b6e38){var _0x5892f3=[_0x1fc4('0x66'),_0x1fc4('0x67'),_0x1fc4('0x68'),'CallType',_0x1fc4('0x69'),'Priority',_0x1fc4('0x6a'),_0x1fc4('0x6b')];if(!_[_0x1fc4('0x63')](_0x2d6c29[_0x1fc4('0x34')][_0x1fc4('0x64')])&&_0x2d6c29[_0x1fc4('0x34')][_0x1fc4('0x64')]==='Case'){_0x5892f3=[_0x1fc4('0x6b'),'Origin',_0x1fc4('0x6c'),_0x1fc4('0x6a'),_0x1fc4('0x6d'),_0x1fc4('0x6e'),_0x1fc4('0x6f'),_0x1fc4('0x70')];}if(_0x1b6e38){_[_0x1fc4('0x71')](_0x1b6e38[_0x1fc4('0x39')],function(_0x3c0255){return _0x3c0255[_0x1fc4('0x72')]===![]&&!_0x5892f3[_0x1fc4('0x73')](_0x3c0255[_0x1fc4('0x2d')]);});return{'count':_0x1b6e38[_0x1fc4('0x39')][_0x1fc4('0x3a')],'rows':_[_0x1fc4('0x33')](_0x1b6e38[_0x1fc4('0x39')],function(_0x539005){return{'id':_0x539005['name'],'name':_0x539005['label'],'custom':_0x539005[_0x1fc4('0x72')],'options':_0x539005[_0x1fc4('0x74')][_0x1fc4('0x3a')]>0x0?_[_0x1fc4('0x33')](_0x539005['picklistValues'],function(_0x59a724){return{'name':_0x59a724[_0x1fc4('0x75')],'value':_0x59a724[_0x1fc4('0x76')]};}):_0x539005['type']=='boolean'?[{'name':_0x1fc4('0x77'),'value':_0x1fc4('0x78')},{'name':'False','value':_0x1fc4('0x79')}]:[]};})};}})[_0x1fc4('0x29')](respondWithResult(_0x25a606,null))[_0x1fc4('0x45')](function(_0x583985){var _0x36f0e6=_0x2d6c29['query']['test']?0x1f4:_0x583985[_0x1fc4('0x7a')]||0x1f4;logger[_0x1fc4('0x1e')]('getFields,\x20%s,\x20%s,\x20%s',_0x1fc4('0x5a'),_0x36f0e6,JSON['stringify'](_0x583985));delete _0x583985['name'];if(_0x36f0e6===0x191){_0x36f0e6=0x190;}_0x25a606[_0x1fc4('0x23')](_0x36f0e6)[_0x1fc4('0x7b')](_0x2d6c29[_0x1fc4('0x34')][_0x1fc4('0x17')]?{'message':_0x1fc4('0x7c'),'statusCode':_0x583985[_0x1fc4('0x7a')]}:_0x583985);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f4e1d23..5f3339e 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 _0x086f=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5dae9a,_0x5cb4be){var _0x378a34=function(_0x22a64){while(--_0x22a64){_0x5dae9a['push'](_0x5dae9a['shift']());}};_0x378a34(++_0x5cb4be);}(_0x086f,0x1c5));var _0xf086=function(_0xd12ba4,_0x186425){_0xd12ba4=_0xd12ba4-0x0;var _0x537d41=_0x086f[_0xd12ba4];return _0x537d41;};'use strict';var _=require(_0xf086('0x0'));var util=require(_0xf086('0x1'));var logger=require(_0xf086('0x2'))(_0xf086('0x3'));var moment=require(_0xf086('0x4'));var BPromise=require(_0xf086('0x5'));var rp=require(_0xf086('0x6'));var fs=require('fs');var path=require(_0xf086('0x7'));var rimraf=require(_0xf086('0x8'));var config=require(_0xf086('0x9'));var attributes=require(_0xf086('0xa'));var integrations=require(_0xf086('0xb'));module['exports']=function(_0x4eb08f,_0x24d6a5){return _0x4eb08f[_0xf086('0xc')](_0xf086('0xd'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7711=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_salesforce_accounts'];(function(_0x4f8440,_0x21fe5e){var _0x402999=function(_0x4fb44e){while(--_0x4fb44e){_0x4f8440['push'](_0x4f8440['shift']());}};_0x402999(++_0x21fe5e);}(_0x7711,0xcc));var _0x1771=function(_0x3941de,_0x2a9661){_0x3941de=_0x3941de-0x0;var _0x568430=_0x7711[_0x3941de];return _0x568430;};'use strict';var _=require(_0x1771('0x0'));var util=require(_0x1771('0x1'));var logger=require('../../config/logger')(_0x1771('0x2'));var moment=require(_0x1771('0x3'));var BPromise=require('bluebird');var rp=require(_0x1771('0x4'));var fs=require('fs');var path=require(_0x1771('0x5'));var rimraf=require(_0x1771('0x6'));var config=require(_0x1771('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x1771('0x8'));module[_0x1771('0x9')]=function(_0x256a4e,_0x244df5){return _0x256a4e[_0x1771('0xa')]('SalesforceAccount',attributes,{'tableName':_0x1771('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 6527832..aff9853 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 _0xc368=['debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','SalesforceAccount','options','raw','where','attributes','limit','include','model','map','GetSalesforceAccount','ShowSalesforceAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent'];(function(_0x4ee458,_0x4f966d){var _0x4df0c8=function(_0x36d4a0){while(--_0x36d4a0){_0x4ee458['push'](_0x4ee458['shift']());}};_0x4df0c8(++_0x4f966d);}(_0xc368,0x7b));var _0x8c36=function(_0x431912,_0x37b283){_0x431912=_0x431912-0x0;var _0x4a2982=_0xc368[_0x431912];return _0x4a2982;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var moment=require('moment');var BPromise=require(_0x8c36('0x1'));var rs=require(_0x8c36('0x2'));var fs=require('fs');var Redis=require(_0x8c36('0x3'));var db=require(_0x8c36('0x4'))['db'];var utils=require(_0x8c36('0x5'));var logger=require('../../config/logger')(_0x8c36('0x6'));var config=require(_0x8c36('0x7'));var jayson=require(_0x8c36('0x8'));var client=jayson[_0x8c36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554022,_0x8ed437,_0x384867){return new BPromise(function(_0x3e76be,_0x26bad1){return client[_0x8c36('0xa')](_0x554022,_0x384867)[_0x8c36('0xb')](function(_0x569f29){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'));logger[_0x8c36('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'),JSON[_0x8c36('0xe')](_0x569f29));if(_0x569f29[_0x8c36('0xf')]){if(_0x569f29[_0x8c36('0xf')][_0x8c36('0x10')]===0x1f4){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);return _0x26bad1(_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);}logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')]['message']);return _0x3e76be(_0x569f29[_0x8c36('0xf')]['message']);}else{logger[_0x8c36('0x13')](_0x8c36('0x11'),_0x8ed437,_0x8c36('0xc'));_0x3e76be(_0x569f29[_0x8c36('0x14')][_0x8c36('0x12')]);}})[_0x8c36('0x15')](function(_0x3c10eb){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x3c10eb);_0x26bad1(_0x3c10eb);});});}exports['GetSalesforceAccount']=function(_0x2be9b0){var _0x46ae6e=this;return new Promise(function(_0x47832a,_0x2d5e5b){return db[_0x8c36('0x16')]['findAll']({'raw':_0x2be9b0[_0x8c36('0x17')]?_0x2be9b0[_0x8c36('0x17')][_0x8c36('0x18')]===undefined?!![]:![]:!![],'where':_0x2be9b0[_0x8c36('0x17')]?_0x2be9b0[_0x8c36('0x17')][_0x8c36('0x19')]||null:null,'attributes':_0x2be9b0[_0x8c36('0x17')]?_0x2be9b0[_0x8c36('0x17')][_0x8c36('0x1a')]||null:null,'limit':_0x2be9b0[_0x8c36('0x17')]?_0x2be9b0[_0x8c36('0x17')][_0x8c36('0x1b')]||null:null,'include':_0x2be9b0[_0x8c36('0x17')]?_0x2be9b0['options']['include']?_['map'](_0x2be9b0['options'][_0x8c36('0x1c')],function(_0x7effb8){return{'model':db[_0x7effb8[_0x8c36('0x1d')]],'as':_0x7effb8['as'],'attributes':_0x7effb8[_0x8c36('0x1a')],'include':_0x7effb8[_0x8c36('0x1c')]?_[_0x8c36('0x1e')](_0x7effb8['include'],function(_0x1d39ca){return{'model':db[_0x1d39ca['model']],'as':_0x1d39ca['as'],'attributes':_0x1d39ca[_0x8c36('0x1a')],'include':_0x1d39ca['include']?_[_0x8c36('0x1e')](_0x1d39ca[_0x8c36('0x1c')],function(_0x271ec4){return{'model':db[_0x271ec4[_0x8c36('0x1d')]],'as':_0x271ec4['as'],'attributes':_0x271ec4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x7e7e56){logger[_0x8c36('0x13')]('GetSalesforceAccount',_0x2be9b0);logger['debug'](_0x8c36('0x1f'),_0x2be9b0,JSON[_0x8c36('0xe')](_0x7e7e56));_0x47832a(_0x7e7e56);})['catch'](function(_0x1280a1){logger[_0x8c36('0xf')](_0x8c36('0x1f'),_0x1280a1['message'],_0x2be9b0);_0x2d5e5b(_0x46ae6e['error'](0x1f4,_0x1280a1[_0x8c36('0x12')]));});});};exports[_0x8c36('0x20')]=function(_0x3d7056){var _0x192ce3=this;return new Promise(function(_0x3ae970,_0x2e8855){return db[_0x8c36('0x16')][_0x8c36('0x21')]({'raw':_0x3d7056[_0x8c36('0x17')]?_0x3d7056[_0x8c36('0x17')][_0x8c36('0x18')]===undefined?!![]:![]:!![],'where':_0x3d7056[_0x8c36('0x17')]?_0x3d7056[_0x8c36('0x17')][_0x8c36('0x19')]||null:null,'attributes':_0x3d7056[_0x8c36('0x17')]?_0x3d7056[_0x8c36('0x17')][_0x8c36('0x1a')]||null:null,'include':_0x3d7056['options']?_0x3d7056['options']['include']?_[_0x8c36('0x1e')](_0x3d7056[_0x8c36('0x17')][_0x8c36('0x1c')],function(_0x2fedd6){return{'model':db[_0x2fedd6[_0x8c36('0x1d')]],'as':_0x2fedd6['as'],'attributes':_0x2fedd6[_0x8c36('0x1a')],'include':_0x2fedd6[_0x8c36('0x1c')]?_['map'](_0x2fedd6[_0x8c36('0x1c')],function(_0x59a4e6){return{'model':db[_0x59a4e6[_0x8c36('0x1d')]],'as':_0x59a4e6['as'],'attributes':_0x59a4e6['attributes'],'include':_0x59a4e6[_0x8c36('0x1c')]?_[_0x8c36('0x1e')](_0x59a4e6[_0x8c36('0x1c')],function(_0x4857b0){return{'model':db[_0x4857b0[_0x8c36('0x1d')]],'as':_0x4857b0['as'],'attributes':_0x4857b0[_0x8c36('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8c36('0xb')](function(_0xabdc0f){logger[_0x8c36('0x13')](_0x8c36('0x20'),_0x3d7056);logger[_0x8c36('0xd')](_0x8c36('0x20'),_0x3d7056,JSON[_0x8c36('0xe')](_0xabdc0f));_0x3ae970(_0xabdc0f);})[_0x8c36('0x15')](function(_0x4719de){logger[_0x8c36('0xf')](_0x8c36('0x20'),_0x4719de[_0x8c36('0x12')],_0x3d7056);_0x2e8855(_0x192ce3[_0x8c36('0xf')](0x1f4,_0x4719de[_0x8c36('0x12')]));});});}; \ No newline at end of file +var _0x41bb=['../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetSalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowSalesforceAccount','SalesforceAccount','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5df88f,_0x2aeb0a){var _0x122de8=function(_0x1d0ad0){while(--_0x1d0ad0){_0x5df88f['push'](_0x5df88f['shift']());}};_0x122de8(++_0x2aeb0a);}(_0x41bb,0xc5));var _0xb41b=function(_0x2bf899,_0x433fe3){_0x2bf899=_0x2bf899-0x0;var _0x27aeca=_0x41bb[_0x2bf899];return _0x27aeca;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});}exports[_0xb41b('0x15')]=function(_0x47154d){var _0x198783=this;return new Promise(function(_0x5df8c2,_0x4b3580){return db['SalesforceAccount'][_0xb41b('0x16')]({'raw':_0x47154d['options']?_0x47154d[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x47154d[_0xb41b('0x17')]?_0x47154d['options']['where']||null:null,'attributes':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'limit':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x1a')]||null:null,'include':_0x47154d['options']?_0x47154d['options'][_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x47154d[_0xb41b('0x17')]['include'],function(_0x14e9c8){return{'model':db[_0x14e9c8[_0xb41b('0x1d')]],'as':_0x14e9c8['as'],'attributes':_0x14e9c8['attributes'],'include':_0x14e9c8[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x14e9c8['include'],function(_0xed3c7e){return{'model':db[_0xed3c7e['model']],'as':_0xed3c7e['as'],'attributes':_0xed3c7e[_0xb41b('0x19')],'include':_0xed3c7e[_0xb41b('0x1b')]?_['map'](_0xed3c7e[_0xb41b('0x1b')],function(_0x4265b8){return{'model':db[_0x4265b8['model']],'as':_0x4265b8['as'],'attributes':_0x4265b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x46aecf){logger[_0xb41b('0xc')](_0xb41b('0x15'),_0x47154d);logger[_0xb41b('0xf')](_0xb41b('0x15'),_0x47154d,JSON[_0xb41b('0x1e')](_0x46aecf));_0x5df8c2(_0x46aecf);})['catch'](function(_0x26ef96){logger[_0xb41b('0x10')]('GetSalesforceAccount',_0x26ef96[_0xb41b('0x12')],_0x47154d);_0x4b3580(_0x198783['error'](0x1f4,_0x26ef96[_0xb41b('0x12')]));});});};exports[_0xb41b('0x1f')]=function(_0x597a35){var _0x23a6ed=this;return new Promise(function(_0x4a95e7,_0x29da9f){return db[_0xb41b('0x20')]['find']({'raw':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x21')]||null:null,'attributes':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'include':_0x597a35[_0xb41b('0x17')]?_0x597a35['options'][_0xb41b('0x1b')]?_['map'](_0x597a35['options'][_0xb41b('0x1b')],function(_0x192ceb){return{'model':db[_0x192ceb[_0xb41b('0x1d')]],'as':_0x192ceb['as'],'attributes':_0x192ceb[_0xb41b('0x19')],'include':_0x192ceb[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x192ceb[_0xb41b('0x1b')],function(_0x197197){return{'model':db[_0x197197[_0xb41b('0x1d')]],'as':_0x197197['as'],'attributes':_0x197197[_0xb41b('0x19')],'include':_0x197197[_0xb41b('0x1b')]?_['map'](_0x197197[_0xb41b('0x1b')],function(_0x27990d){return{'model':db[_0x27990d[_0xb41b('0x1d')]],'as':_0x27990d['as'],'attributes':_0x27990d[_0xb41b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x10b3f6){logger['info']('ShowSalesforceAccount',_0x597a35);logger[_0xb41b('0xf')](_0xb41b('0x1f'),_0x597a35,JSON['stringify'](_0x10b3f6));_0x4a95e7(_0x10b3f6);})[_0xb41b('0x14')](function(_0x47363e){logger[_0xb41b('0x10')](_0xb41b('0x1f'),_0x47363e[_0xb41b('0x12')],_0x597a35);_0x29da9f(_0x23a6ed['error'](0x1f4,_0x47363e[_0xb41b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f15f389..941b593 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 _0x0cf0=['/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','index','get'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x0cf0,0x182));var _0x00cf=function(_0x2a51a4,_0x4fb2ff){_0x2a51a4=_0x2a51a4-0x0;var _0x1499ca=_0x0cf0[_0x2a51a4];return _0x1499ca;};'use strict';var multer=require('multer');var util=require(_0x00cf('0x0'));var path=require('path');var timeout=require(_0x00cf('0x1'));var express=require(_0x00cf('0x2'));var router=express[_0x00cf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x00cf('0x4'));var config=require(_0x00cf('0x5'));var controller=require(_0x00cf('0x6'));router['get']('/',auth[_0x00cf('0x7')](),controller[_0x00cf('0x8')]);router[_0x00cf('0x9')](_0x00cf('0xa'),auth[_0x00cf('0x7')](),controller[_0x00cf('0xb')]);router['get'](_0x00cf('0xc'),auth[_0x00cf('0x7')](),controller[_0x00cf('0xd')]);router['get'](_0x00cf('0xe'),auth[_0x00cf('0x7')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x00cf('0x7')](),controller[_0x00cf('0xf')]);router[_0x00cf('0x10')]('/',auth[_0x00cf('0x7')](),controller[_0x00cf('0x11')]);router[_0x00cf('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x00cf('0x13')]);router['delete'](_0x00cf('0xa'),auth[_0x00cf('0x7')](),controller[_0x00cf('0x14')]);module[_0x00cf('0x15')]=router; \ No newline at end of file +var _0xb687=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x1bc989,_0x4130ce){var _0x488ead=function(_0xf5c90c){while(--_0xf5c90c){_0x1bc989['push'](_0x1bc989['shift']());}};_0x488ead(++_0x4130ce);}(_0xb687,0xf2));var _0x7b68=function(_0x31a25b,_0x28e46b){_0x31a25b=_0x31a25b-0x0;var _0x1c2b81=_0xb687[_0x31a25b];return _0x1c2b81;};'use strict';var multer=require(_0x7b68('0x0'));var util=require(_0x7b68('0x1'));var path=require(_0x7b68('0x2'));var timeout=require(_0x7b68('0x3'));var express=require('express');var router=express[_0x7b68('0x4')]();var auth=require(_0x7b68('0x5'));var interaction=require(_0x7b68('0x6'));var config=require(_0x7b68('0x7'));var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth[_0x7b68('0x8')](),controller[_0x7b68('0x9')]);router[_0x7b68('0xa')]('/:id',auth[_0x7b68('0x8')](),controller['show']);router['get'](_0x7b68('0xb'),auth[_0x7b68('0x8')](),controller[_0x7b68('0xc')]);router[_0x7b68('0xa')](_0x7b68('0xd'),auth[_0x7b68('0x8')](),controller['getSubjects']);router[_0x7b68('0xa')](_0x7b68('0xe'),auth[_0x7b68('0x8')](),controller[_0x7b68('0xf')]);router[_0x7b68('0x10')]('/',auth[_0x7b68('0x8')](),controller['create']);router[_0x7b68('0x11')](_0x7b68('0x12'),auth['isAuthenticated'](),controller[_0x7b68('0x13')]);router[_0x7b68('0x14')]('/:id',auth[_0x7b68('0x8')](),controller[_0x7b68('0x15')]);module[_0x7b68('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index dea37c7..ce12f00 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 _0xcf4b=['sequelize','exports','STRING','ENUM','Case','Task','contact_lead','contact','lead','nothing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf4b,0x12c));var _0xbcf4=function(_0x56136b,_0x57e5ff){_0x56136b=_0x56136b-0x0;var _0x35cc8b=_0xcf4b[_0x56136b];return _0x35cc8b;};'use strict';var Sequelize=require(_0xbcf4('0x0'));module[_0xbcf4('0x1')]={'name':{'type':Sequelize[_0xbcf4('0x2')]},'description':{'type':Sequelize[_0xbcf4('0x2')]},'ticketType':{'type':Sequelize[_0xbcf4('0x3')]('Task',_0xbcf4('0x4')),'defaultValue':_0xbcf4('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0xbcf4('0x6'),_0xbcf4('0x7'),_0xbcf4('0x8')),'defaultValue':_0xbcf4('0x6')},'moduleCreate':{'type':Sequelize[_0xbcf4('0x3')](_0xbcf4('0x9'),_0xbcf4('0x7'),_0xbcf4('0x8')),'defaultValue':_0xbcf4('0x8')}}; \ No newline at end of file +var _0x9530=['lead','nothing','sequelize','exports','STRING','Case','Task','ENUM','contact_lead','contact'];(function(_0x1e2f76,_0xbc23ca){var _0x3cd411=function(_0x21f486){while(--_0x21f486){_0x1e2f76['push'](_0x1e2f76['shift']());}};_0x3cd411(++_0xbc23ca);}(_0x9530,0x14c));var _0x0953=function(_0x10da04,_0x3026a8){_0x10da04=_0x10da04-0x0;var _0x10b161=_0x9530[_0x10da04];return _0x10b161;};'use strict';var Sequelize=require(_0x0953('0x0'));module[_0x0953('0x1')]={'name':{'type':Sequelize[_0x0953('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('Task',_0x0953('0x3')),'defaultValue':_0x0953('0x4')},'moduleSearch':{'type':Sequelize[_0x0953('0x5')](_0x0953('0x6'),_0x0953('0x7'),_0x0953('0x8')),'defaultValue':_0x0953('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x0953('0x9'),_0x0953('0x7'),_0x0953('0x8')),'defaultValue':_0x0953('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8e2c424..9de39d6 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 _0xe60e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','fieldName','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','SalesforceConfiguration','includeAll','include','rows','show','keys','create','body','update','find','params','getFields','findOne','SalesforceField','rawAttributes','length','nolimit','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x58347e,_0x2c6409){var _0x493ca6=function(_0x8b3a4c){while(--_0x8b3a4c){_0x58347e['push'](_0x58347e['shift']());}};_0x493ca6(++_0x2c6409);}(_0xe60e,0x10a));var _0xee60=function(_0x3f1129,_0x1f0b7d){_0x3f1129=_0x3f1129-0x0;var _0x2ea49f=_0xe60e[_0x3f1129];return _0x2ea49f;};'use strict';var pdf=require(_0xee60('0x0'));var emlformat=require(_0xee60('0x1'));var rimraf=require(_0xee60('0x2'));var zipdir=require(_0xee60('0x3'));var jsonpatch=require(_0xee60('0x4'));var rp=require(_0xee60('0x5'));var moment=require(_0xee60('0x6'));var BPromise=require(_0xee60('0x7'));var Mustache=require(_0xee60('0x8'));var util=require('util');var path=require(_0xee60('0x9'));var sox=require(_0xee60('0xa'));var csv=require(_0xee60('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xee60('0xc'));var crypto=require(_0xee60('0xd'));var jsforce=require(_0xee60('0xe'));var deskjs=require(_0xee60('0xf'));var toCsv=require('to-csv');var querystring=require(_0xee60('0x10'));var Papa=require(_0xee60('0x11'));var Redis=require(_0xee60('0x12'));var authService=require(_0xee60('0x13'));var qs=require(_0xee60('0x14'));var as=require(_0xee60('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee60('0x16'))(_0xee60('0x17'));var utils=require(_0xee60('0x18'));var config=require('../../config/environment');var db=require(_0xee60('0x19'))['db'];var jayson=require(_0xee60('0x1a'));var client=jayson[_0xee60('0x1b')][_0xee60('0x1c')]({'port':0x232a});function checkPasswordPattern(_0xe1be2c,_0x404ee7,_0x557a06){if(_0x557a06){var _0x13042f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x13042f[_0xee60('0x1d')](_0x404ee7)){return _0xe1be2c;}else{throw new db['Sequelize'][(_0xee60('0x1e'))](_0xee60('0x1f'));}}else{return _0xe1be2c;}}function respondWithRpcPromise(_0x4cb7e5,_0x40846f,_0x21ee84,_0x2b425a){return new BPromise(function(_0x5ed628,_0x530630){var _0x42e037=_0x2b425a||client;return _0x42e037[_0xee60('0x20')](_0x4cb7e5,_0x21ee84)[_0xee60('0x21')](function(_0x15b05c){logger['info'](_0xee60('0x22'),_0x40846f,'request\x20sent');logger['debug'](_0xee60('0x23'),_0x40846f,'request\x20sent',JSON['stringify'](_0x15b05c));if(_0x15b05c['error']){if(_0x15b05c['error'][_0xee60('0x24')]===0x1f4){logger[_0xee60('0x25')]('SalesforceConfiguration,\x20%s,\x20%s',_0x40846f,_0x15b05c['error'][_0xee60('0x26')]);return _0x530630(_0x15b05c[_0xee60('0x25')][_0xee60('0x26')]);}logger[_0xee60('0x25')](_0xee60('0x22'),_0x40846f,_0x15b05c[_0xee60('0x25')]['message']);return _0x5ed628(_0x15b05c[_0xee60('0x25')][_0xee60('0x26')]);}else{logger[_0xee60('0x27')]('SalesforceConfiguration,\x20%s,\x20%s',_0x40846f,'request\x20sent');_0x5ed628(_0x15b05c[_0xee60('0x28')][_0xee60('0x26')]);}})[_0xee60('0x29')](function(_0x10adcd){logger[_0xee60('0x25')](_0xee60('0x22'),_0x40846f,_0x10adcd);_0x530630(_0x10adcd);});});}function respondWithStatusCode(_0x17f257,_0xd68ac7){_0xd68ac7=_0xd68ac7||0xcc;return function(_0x58bed0){if(_0x58bed0){return _0x17f257['sendStatus'](_0xd68ac7);}return _0x17f257[_0xee60('0x2a')](_0xd68ac7)[_0xee60('0x2b')]();};}function respondWithResult(_0x3a0522,_0x2cf7e6){_0x2cf7e6=_0x2cf7e6||0xc8;return function(_0xcc440){if(_0xcc440){return _0x3a0522[_0xee60('0x2a')](_0x2cf7e6)[_0xee60('0x2c')](_0xcc440);}};}function respondWithFilteredResult(_0x3471e1,_0x77351f){return function(_0x4ed1cc){if(_0x4ed1cc){var _0x5ab671=_0x4ed1cc[_0xee60('0x2d')],_0x43dd86=_0x77351f[_0xee60('0x2e')],_0x1ee74f=_0x77351f[_0xee60('0x2e')]+_0x77351f[_0xee60('0x2f')],_0x53b824;if(_0x1ee74f>=_0x5ab671){_0x1ee74f=_0x5ab671;_0x53b824=0xc8;}else{_0x53b824=0xce;}_0x3471e1[_0xee60('0x2a')](_0x53b824);return _0x3471e1['set'](_0xee60('0x30'),_0x43dd86+'-'+_0x1ee74f+'/'+_0x5ab671)[_0xee60('0x2c')](_0x4ed1cc);}return null;};}function patchUpdates(_0x1da42f){return function(_0x3badcf){try{jsonpatch[_0xee60('0x31')](_0x3badcf,_0x1da42f,!![]);}catch(_0x1682bd){return BPromise[_0xee60('0x32')](_0x1682bd);}return _0x3badcf[_0xee60('0x33')]();};}function saveUpdates(_0x21bd37,_0x1203f1){return function(_0x3cc97d){if(_0x3cc97d){return _0x3cc97d['update'](_0x21bd37)[_0xee60('0x21')](function(_0x55ae47){return _0x55ae47;});}return null;};}function removeEntity(_0x3bc11d,_0x5b0753){return function(_0x1f2b54){if(_0x1f2b54){return _0x1f2b54[_0xee60('0x34')]()['then'](function(){_0x3bc11d[_0xee60('0x2a')](0xcc)[_0xee60('0x2b')]();});}};}function handleEntityNotFound(_0x24988e,_0x540aaa){return function(_0x595095){if(!_0x595095){_0x24988e[_0xee60('0x35')](0x194);}return _0x595095;};}function handleError(_0x19e64a,_0x2bd562){_0x2bd562=_0x2bd562||0x1f4;return function(_0x3d8e8b){logger['error'](_0x3d8e8b[_0xee60('0x36')]);if(_0x3d8e8b[_0xee60('0x37')]){delete _0x3d8e8b[_0xee60('0x37')];}_0x19e64a[_0xee60('0x2a')](_0x2bd562)[_0xee60('0x38')](_0x3d8e8b);};}exports['index']=function(_0x1f5bdc,_0x255b95){var _0x30ce4d={},_0xee7c97={},_0x518530={'count':0x0,'rows':[]};var _0x4d8d94=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x5e93d5){return{'name':_0x5e93d5[_0xee60('0x39')],'type':_0x5e93d5['type'][_0xee60('0x3a')]};});_0xee7c97[_0xee60('0x3b')]=_[_0xee60('0x3c')](_0x4d8d94,_0xee60('0x37'));_0xee7c97['query']=_['keys'](_0x1f5bdc[_0xee60('0x3d')]);_0xee7c97[_0xee60('0x3e')]=_[_0xee60('0x3f')](_0xee7c97[_0xee60('0x3b')],_0xee7c97['query']);_0x30ce4d['attributes']=_['intersection'](_0xee7c97['model'],qs[_0xee60('0x40')](_0x1f5bdc['query'][_0xee60('0x40')]));_0x30ce4d[_0xee60('0x41')]=_0x30ce4d['attributes']['length']?_0x30ce4d[_0xee60('0x41')]:_0xee7c97[_0xee60('0x3b')];if(!_0x1f5bdc['query'][_0xee60('0x42')]('nolimit')){_0x30ce4d[_0xee60('0x2f')]=qs['limit'](_0x1f5bdc['query'][_0xee60('0x2f')]);_0x30ce4d[_0xee60('0x2e')]=qs['offset'](_0x1f5bdc[_0xee60('0x3d')][_0xee60('0x2e')]);}_0x30ce4d[_0xee60('0x43')]=qs[_0xee60('0x44')](_0x1f5bdc['query'][_0xee60('0x44')]);_0x30ce4d[_0xee60('0x45')]=qs[_0xee60('0x3e')](_['pick'](_0x1f5bdc[_0xee60('0x3d')],_0xee7c97[_0xee60('0x3e')]),_0x4d8d94);if(_0x1f5bdc['query'][_0xee60('0x46')]){_0x30ce4d[_0xee60('0x45')]=_[_0xee60('0x47')](_0x30ce4d[_0xee60('0x45')],{'$or':_['map'](_0x4d8d94,function(_0x38d5d0){if(_0x38d5d0[_0xee60('0x48')]!==_0xee60('0x49')){var _0x171a0d={};_0x171a0d[_0x38d5d0[_0xee60('0x37')]]={'$like':'%'+_0x1f5bdc[_0xee60('0x3d')][_0xee60('0x46')]+'%'};return _0x171a0d;}})});}_0x30ce4d=_[_0xee60('0x47')]({},_0x30ce4d,_0x1f5bdc[_0xee60('0x4a')]);var _0x30c490={'where':_0x30ce4d['where']};return db[_0xee60('0x4b')][_0xee60('0x2d')](_0x30c490)[_0xee60('0x21')](function(_0x336edf){_0x518530[_0xee60('0x2d')]=_0x336edf;if(_0x1f5bdc[_0xee60('0x3d')][_0xee60('0x4c')]){_0x30ce4d[_0xee60('0x4d')]=[{'all':!![]}];}return db[_0xee60('0x4b')]['findAll'](_0x30ce4d);})[_0xee60('0x21')](function(_0xc2d452){_0x518530[_0xee60('0x4e')]=_0xc2d452;return _0x518530;})[_0xee60('0x21')](respondWithFilteredResult(_0x255b95,_0x30ce4d))[_0xee60('0x29')](handleError(_0x255b95,null));};exports[_0xee60('0x4f')]=function(_0x1a0bed,_0x2d0642){var _0x151c98={'raw':![],'where':{'id':_0x1a0bed['params']['id']}},_0x2800cd={};_0x2800cd[_0xee60('0x3b')]=_[_0xee60('0x50')](db[_0xee60('0x4b')]['rawAttributes']);_0x2800cd[_0xee60('0x3d')]=_[_0xee60('0x50')](_0x1a0bed[_0xee60('0x3d')]);_0x2800cd[_0xee60('0x3e')]=_[_0xee60('0x3f')](_0x2800cd[_0xee60('0x3b')],_0x2800cd[_0xee60('0x3d')]);_0x151c98[_0xee60('0x41')]=_['intersection'](_0x2800cd['model'],qs[_0xee60('0x40')](_0x1a0bed[_0xee60('0x3d')][_0xee60('0x40')]));_0x151c98['attributes']=_0x151c98[_0xee60('0x41')]['length']?_0x151c98['attributes']:_0x2800cd[_0xee60('0x3b')];if(_0x1a0bed[_0xee60('0x3d')][_0xee60('0x4c')]){_0x151c98[_0xee60('0x4d')]=[{'all':!![]}];}_0x151c98=_[_0xee60('0x47')]({},_0x151c98,_0x1a0bed['options']);return db[_0xee60('0x4b')]['find'](_0x151c98)['then'](handleEntityNotFound(_0x2d0642,null))['then'](respondWithResult(_0x2d0642,null))[_0xee60('0x29')](handleError(_0x2d0642,null));};exports[_0xee60('0x51')]=function(_0x1d9e44,_0x4ffa44){return db[_0xee60('0x4b')][_0xee60('0x51')](_0x1d9e44[_0xee60('0x52')],{})[_0xee60('0x21')](respondWithResult(_0x4ffa44,0xc9))[_0xee60('0x29')](handleError(_0x4ffa44,null));};exports[_0xee60('0x53')]=function(_0x4b6360,_0x470af8){if(_0x4b6360[_0xee60('0x52')]['id']){delete _0x4b6360[_0xee60('0x52')]['id'];}return db[_0xee60('0x4b')][_0xee60('0x54')]({'where':{'id':_0x4b6360[_0xee60('0x55')]['id']}})['then'](handleEntityNotFound(_0x470af8,null))[_0xee60('0x21')](saveUpdates(_0x4b6360['body'],null))['then'](respondWithResult(_0x470af8,null))['catch'](handleError(_0x470af8,null));};exports[_0xee60('0x34')]=function(_0x2dacef,_0x4f7d8a){return db[_0xee60('0x4b')][_0xee60('0x54')]({'where':{'id':_0x2dacef[_0xee60('0x55')]['id']}})[_0xee60('0x21')](handleEntityNotFound(_0x4f7d8a,null))['then'](removeEntity(_0x4f7d8a,null))[_0xee60('0x29')](handleError(_0x4f7d8a,null));};exports[_0xee60('0x56')]=function(_0x3fc2ad,_0x326be1,_0x143dd0){var _0x1eb9e7={};var _0x2eca44={};var _0x4c69fe;var _0x388e7b;return db[_0xee60('0x4b')][_0xee60('0x57')]({'where':{'id':_0x3fc2ad[_0xee60('0x55')]['id']}})['then'](handleEntityNotFound(_0x326be1,null))[_0xee60('0x21')](function(_0x5ce65f){if(_0x5ce65f){_0x4c69fe=_0x5ce65f;_0x2eca44[_0xee60('0x3b')]=_[_0xee60('0x50')](db[_0xee60('0x58')][_0xee60('0x59')]);_0x2eca44[_0xee60('0x3d')]=_[_0xee60('0x50')](_0x3fc2ad[_0xee60('0x3d')]);_0x2eca44[_0xee60('0x3e')]=_[_0xee60('0x3f')](_0x2eca44[_0xee60('0x3b')],_0x2eca44[_0xee60('0x3d')]);_0x1eb9e7[_0xee60('0x41')]=_[_0xee60('0x3f')](_0x2eca44[_0xee60('0x3b')],qs[_0xee60('0x40')](_0x3fc2ad[_0xee60('0x3d')][_0xee60('0x40')]));_0x1eb9e7[_0xee60('0x41')]=_0x1eb9e7[_0xee60('0x41')][_0xee60('0x5a')]?_0x1eb9e7[_0xee60('0x41')]:_0x2eca44['model'];_0x1eb9e7[_0xee60('0x43')]=qs[_0xee60('0x44')](_0x3fc2ad[_0xee60('0x3d')]['sort']);_0x1eb9e7['where']=qs[_0xee60('0x3e')](_['pick'](_0x3fc2ad[_0xee60('0x3d')],_0x2eca44[_0xee60('0x3e')]));if(_0x3fc2ad[_0xee60('0x3d')][_0xee60('0x46')]){_0x1eb9e7[_0xee60('0x45')]=_[_0xee60('0x47')](_0x1eb9e7[_0xee60('0x45')],{'$or':_[_0xee60('0x3c')](_0x1eb9e7['attributes'],function(_0x9c6abf){var _0x1372ec={};_0x1372ec[_0x9c6abf]={'$like':'%'+_0x3fc2ad[_0xee60('0x3d')][_0xee60('0x46')]+'%'};return _0x1372ec;})});}_0x1eb9e7=_[_0xee60('0x47')]({},_0x1eb9e7,_0x3fc2ad[_0xee60('0x4a')]);return _0x4c69fe[_0xee60('0x56')](_0x1eb9e7);}})[_0xee60('0x21')](function(_0x3573a0){if(_0x3573a0){_0x388e7b=_0x3573a0['length'];if(!_0x3fc2ad[_0xee60('0x3d')][_0xee60('0x42')](_0xee60('0x5b'))){_0x1eb9e7[_0xee60('0x2f')]=qs['limit'](_0x3fc2ad[_0xee60('0x3d')]['limit']);_0x1eb9e7[_0xee60('0x2e')]=qs['offset'](_0x3fc2ad[_0xee60('0x3d')][_0xee60('0x2e')]);}return _0x4c69fe[_0xee60('0x56')](_0x1eb9e7);}})['then'](function(_0x1996d6){if(_0x1996d6){return _0x1996d6?{'count':_0x388e7b,'rows':_0x1996d6}:null;}})[_0xee60('0x21')](respondWithResult(_0x326be1,null))[_0xee60('0x29')](handleError(_0x326be1,null));};exports['getSubjects']=function(_0x12b236,_0x14b41d,_0x1cb0bb){var _0x26f4aa={};var _0x29cc99={};var _0x359249;var _0x4010a3;return db['SalesforceConfiguration'][_0xee60('0x57')]({'where':{'id':_0x12b236['params']['id']}})['then'](handleEntityNotFound(_0x14b41d,null))[_0xee60('0x21')](function(_0x607b30){if(_0x607b30){_0x359249=_0x607b30;_0x29cc99[_0xee60('0x3b')]=_[_0xee60('0x50')](db[_0xee60('0x58')][_0xee60('0x59')]);_0x29cc99['query']=_[_0xee60('0x50')](_0x12b236['query']);_0x29cc99[_0xee60('0x3e')]=_[_0xee60('0x3f')](_0x29cc99[_0xee60('0x3b')],_0x29cc99[_0xee60('0x3d')]);_0x26f4aa[_0xee60('0x41')]=_[_0xee60('0x3f')](_0x29cc99[_0xee60('0x3b')],qs[_0xee60('0x40')](_0x12b236[_0xee60('0x3d')][_0xee60('0x40')]));_0x26f4aa['attributes']=_0x26f4aa[_0xee60('0x41')][_0xee60('0x5a')]?_0x26f4aa[_0xee60('0x41')]:_0x29cc99['model'];_0x26f4aa[_0xee60('0x43')]=qs['sort'](_0x12b236[_0xee60('0x3d')][_0xee60('0x44')]);_0x26f4aa[_0xee60('0x45')]=qs[_0xee60('0x3e')](_[_0xee60('0x5c')](_0x12b236[_0xee60('0x3d')],_0x29cc99['filters']));if(_0x12b236['query'][_0xee60('0x46')]){_0x26f4aa[_0xee60('0x45')]=_[_0xee60('0x47')](_0x26f4aa[_0xee60('0x45')],{'$or':_['map'](_0x26f4aa[_0xee60('0x41')],function(_0x2a3704){var _0x374971={};_0x374971[_0x2a3704]={'$like':'%'+_0x12b236[_0xee60('0x3d')][_0xee60('0x46')]+'%'};return _0x374971;})});}_0x26f4aa=_[_0xee60('0x47')]({},_0x26f4aa,_0x12b236['options']);return _0x359249[_0xee60('0x5d')](_0x26f4aa);}})[_0xee60('0x21')](function(_0x3677dd){if(_0x3677dd){_0x4010a3=_0x3677dd[_0xee60('0x5a')];if(!_0x12b236[_0xee60('0x3d')][_0xee60('0x42')](_0xee60('0x5b'))){_0x26f4aa[_0xee60('0x2f')]=qs['limit'](_0x12b236['query'][_0xee60('0x2f')]);_0x26f4aa['offset']=qs[_0xee60('0x2e')](_0x12b236['query']['offset']);}return _0x359249[_0xee60('0x5d')](_0x26f4aa);}})[_0xee60('0x21')](function(_0x5738df){if(_0x5738df){return _0x5738df?{'count':_0x4010a3,'rows':_0x5738df}:null;}})[_0xee60('0x21')](respondWithResult(_0x14b41d,null))['catch'](handleError(_0x14b41d,null));};exports['getDescriptions']=function(_0x1f4d00,_0x7fe21d,_0xb5cf82){var _0x2bf4ef={};var _0x36f408={};var _0x144316;var _0x31e6c6;return db[_0xee60('0x4b')][_0xee60('0x57')]({'where':{'id':_0x1f4d00[_0xee60('0x55')]['id']}})[_0xee60('0x21')](handleEntityNotFound(_0x7fe21d,null))[_0xee60('0x21')](function(_0x1f4803){if(_0x1f4803){_0x144316=_0x1f4803;_0x36f408['model']=_[_0xee60('0x50')](db[_0xee60('0x58')]['rawAttributes']);_0x36f408['query']=_['keys'](_0x1f4d00[_0xee60('0x3d')]);_0x36f408[_0xee60('0x3e')]=_[_0xee60('0x3f')](_0x36f408[_0xee60('0x3b')],_0x36f408[_0xee60('0x3d')]);_0x2bf4ef[_0xee60('0x41')]=_[_0xee60('0x3f')](_0x36f408[_0xee60('0x3b')],qs[_0xee60('0x40')](_0x1f4d00[_0xee60('0x3d')][_0xee60('0x40')]));_0x2bf4ef[_0xee60('0x41')]=_0x2bf4ef[_0xee60('0x41')][_0xee60('0x5a')]?_0x2bf4ef[_0xee60('0x41')]:_0x36f408['model'];_0x2bf4ef['order']=qs[_0xee60('0x44')](_0x1f4d00[_0xee60('0x3d')][_0xee60('0x44')]);_0x2bf4ef[_0xee60('0x45')]=qs['filters'](_['pick'](_0x1f4d00[_0xee60('0x3d')],_0x36f408[_0xee60('0x3e')]));if(_0x1f4d00[_0xee60('0x3d')][_0xee60('0x46')]){_0x2bf4ef[_0xee60('0x45')]=_[_0xee60('0x47')](_0x2bf4ef[_0xee60('0x45')],{'$or':_[_0xee60('0x3c')](_0x2bf4ef[_0xee60('0x41')],function(_0x3d08bc){var _0x45e005={};_0x45e005[_0x3d08bc]={'$like':'%'+_0x1f4d00['query']['filter']+'%'};return _0x45e005;})});}_0x2bf4ef=_[_0xee60('0x47')]({},_0x2bf4ef,_0x1f4d00[_0xee60('0x4a')]);return _0x144316['getDescriptions'](_0x2bf4ef);}})['then'](function(_0xc19939){if(_0xc19939){_0x31e6c6=_0xc19939[_0xee60('0x5a')];if(!_0x1f4d00[_0xee60('0x3d')][_0xee60('0x42')](_0xee60('0x5b'))){_0x2bf4ef[_0xee60('0x2f')]=qs[_0xee60('0x2f')](_0x1f4d00[_0xee60('0x3d')]['limit']);_0x2bf4ef[_0xee60('0x2e')]=qs[_0xee60('0x2e')](_0x1f4d00[_0xee60('0x3d')][_0xee60('0x2e')]);}return _0x144316[_0xee60('0x5e')](_0x2bf4ef);}})[_0xee60('0x21')](function(_0x3a10f8){if(_0x3a10f8){return _0x3a10f8?{'count':_0x31e6c6,'rows':_0x3a10f8}:null;}})[_0xee60('0x21')](respondWithResult(_0x7fe21d,null))[_0xee60('0x29')](handleError(_0x7fe21d,null));}; \ No newline at end of file +var _0x6b1d=['includeAll','include','findAll','show','params','rawAttributes','find','create','body','getFields','SalesforceField','hasOwnProperty','getSubjects','findOne','getDescriptions','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','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\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','SalesforceConfiguration','type','key','model','name','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options'];(function(_0x3f6d25,_0x3eb6a8){var _0x312419=function(_0x2a5ac1){while(--_0x2a5ac1){_0x3f6d25['push'](_0x3f6d25['shift']());}};_0x312419(++_0x3eb6a8);}(_0x6b1d,0xc9));var _0xd6b1=function(_0x2074b3,_0x54589c){_0x2074b3=_0x2074b3-0x0;var _0x3529e7=_0x6b1d[_0x2074b3];return _0x3529e7;};'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')]('SalesforceConfiguration,\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')]('SalesforceConfiguration,\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));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 63acaf9..7332159 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 _0xf1de=['exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x54b499,_0xa7ba06){var _0x18f599=function(_0xc2521){while(--_0xc2521){_0x54b499['push'](_0x54b499['shift']());}};_0x18f599(++_0xa7ba06);}(_0xf1de,0xf2));var _0xef1d=function(_0x53a0ad,_0x5700c9){_0x53a0ad=_0x53a0ad-0x0;var _0x2e1e21=_0xf1de[_0x53a0ad];return _0x2e1e21;};'use strict';var _=require(_0xef1d('0x0'));var util=require(_0xef1d('0x1'));var logger=require(_0xef1d('0x2'))(_0xef1d('0x3'));var moment=require(_0xef1d('0x4'));var BPromise=require(_0xef1d('0x5'));var rp=require(_0xef1d('0x6'));var fs=require('fs');var path=require(_0xef1d('0x7'));var rimraf=require(_0xef1d('0x8'));var config=require(_0xef1d('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xef1d('0xa')]=function(_0x5cb091,_0x553aaa){return _0x5cb091[_0xef1d('0xb')](_0xef1d('0xc'),attributes,{'tableName':_0xef1d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54fa=['api','moment','bluebird','path','rimraf','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x171b69,_0x21ee9a){var _0x1a9826=function(_0x6595b){while(--_0x6595b){_0x171b69['push'](_0x171b69['shift']());}};_0x1a9826(++_0x21ee9a);}(_0x54fa,0x132));var _0xa54f=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x54fa[_0x3e7804];return _0x56efda;};'use strict';var _=require(_0xa54f('0x0'));var util=require(_0xa54f('0x1'));var logger=require('../../config/logger')(_0xa54f('0x2'));var moment=require(_0xa54f('0x3'));var BPromise=require(_0xa54f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa54f('0x5'));var rimraf=require(_0xa54f('0x6'));var config=require('../../config/environment');var attributes=require(_0xa54f('0x7'));module[_0xa54f('0x8')]=function(_0x46cc84,_0x13f3f0){return _0x46cc84['define'](_0xa54f('0x9'),attributes,{'tableName':_0xa54f('0xa'),'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 667d68b..998fa93 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 _0x819c=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4b3413,_0x58c416){var _0x3b01ba=function(_0xb25f43){while(--_0xb25f43){_0x4b3413['push'](_0x4b3413['shift']());}};_0x3b01ba(++_0x58c416);}(_0x819c,0x13a));var _0xc819=function(_0x3a47aa,_0x2b1b38){_0x3a47aa=_0x3a47aa-0x0;var _0x30da26=_0x819c[_0x3a47aa];return _0x30da26;};'use strict';var _=require(_0xc819('0x0'));var util=require(_0xc819('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc819('0x2'));var fs=require('fs');var Redis=require(_0xc819('0x3'));var db=require(_0xc819('0x4'))['db'];var utils=require(_0xc819('0x5'));var logger=require(_0xc819('0x6'))(_0xc819('0x7'));var config=require(_0xc819('0x8'));var jayson=require(_0xc819('0x9'));var client=jayson['client'][_0xc819('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x459ff9,_0x13bd27,_0x246e36){return new BPromise(function(_0x1b592a,_0x12fb9a){return client[_0xc819('0xb')](_0x459ff9,_0x246e36)[_0xc819('0xc')](function(_0x4cac2e){logger['info'](_0xc819('0xd'),_0x13bd27,_0xc819('0xe'));logger['debug'](_0xc819('0xf'),_0x13bd27,_0xc819('0xe'),JSON['stringify'](_0x4cac2e));if(_0x4cac2e[_0xc819('0x10')]){if(_0x4cac2e[_0xc819('0x10')][_0xc819('0x11')]===0x1f4){logger[_0xc819('0x10')](_0xc819('0xd'),_0x13bd27,_0x4cac2e[_0xc819('0x10')][_0xc819('0x12')]);return _0x12fb9a(_0x4cac2e[_0xc819('0x10')]['message']);}logger[_0xc819('0x10')](_0xc819('0xd'),_0x13bd27,_0x4cac2e[_0xc819('0x10')][_0xc819('0x12')]);return _0x1b592a(_0x4cac2e[_0xc819('0x10')]['message']);}else{logger['info'](_0xc819('0xd'),_0x13bd27,_0xc819('0xe'));_0x1b592a(_0x4cac2e['result'][_0xc819('0x12')]);}})[_0xc819('0x13')](function(_0x27bc2a){logger[_0xc819('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x13bd27,_0x27bc2a);_0x12fb9a(_0x27bc2a);});});} \ No newline at end of file +var _0x33d5=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0x33d5,0xa9));var _0x533d=function(_0x1d502c,_0x248372){_0x1d502c=_0x1d502c-0x0;var _0x2417ed=_0x33d5[_0x1d502c];return _0x2417ed;};'use strict';var _=require('lodash');var util=require(_0x533d('0x0'));var moment=require(_0x533d('0x1'));var BPromise=require(_0x533d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x533d('0x3'))['db'];var utils=require(_0x533d('0x4'));var logger=require(_0x533d('0x5'))('rpc');var config=require(_0x533d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x533d('0x7')][_0x533d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d2717,_0x4e2b58,_0x5c734b){return new BPromise(function(_0x5edb25,_0x1c1332){return client['request'](_0x3d2717,_0x5c734b)[_0x533d('0x9')](function(_0x529059){logger[_0x533d('0xa')](_0x533d('0xb'),_0x4e2b58,_0x533d('0xc'));logger[_0x533d('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4e2b58,'request\x20sent',JSON['stringify'](_0x529059));if(_0x529059['error']){if(_0x529059[_0x533d('0xe')][_0x533d('0xf')]===0x1f4){logger[_0x533d('0xe')](_0x533d('0xb'),_0x4e2b58,_0x529059[_0x533d('0xe')][_0x533d('0x10')]);return _0x1c1332(_0x529059['error']['message']);}logger[_0x533d('0xe')](_0x533d('0xb'),_0x4e2b58,_0x529059[_0x533d('0xe')][_0x533d('0x10')]);return _0x5edb25(_0x529059[_0x533d('0xe')][_0x533d('0x10')]);}else{logger['info'](_0x533d('0xb'),_0x4e2b58,'request\x20sent');_0x5edb25(_0x529059[_0x533d('0x11')][_0x533d('0x10')]);}})['catch'](function(_0x53c4ac){logger['error'](_0x533d('0xb'),_0x4e2b58,_0x53c4ac);_0x1c1332(_0x53c4ac);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e991069..2c05bc5 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 _0xda19=['post','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x22334b,_0x4e7696){var _0x3a5b46=function(_0x326393){while(--_0x326393){_0x22334b['push'](_0x22334b['shift']());}};_0x3a5b46(++_0x4e7696);}(_0xda19,0xd5));var _0x9da1=function(_0xb3ba1b,_0x5745b6){_0xb3ba1b=_0xb3ba1b-0x0;var _0x22d20d=_0xda19[_0xb3ba1b];return _0x22d20d;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9da1('0x9'),auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router[_0x9da1('0xd')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xe')]);module[_0x9da1('0xf')]=router; \ No newline at end of file +var _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x326f,0xd1));var _0xf326=function(_0x2a2640,_0x179c93){_0x2a2640=_0x2a2640-0x0;var _0x51b276=_0x326f[_0x2a2640];return _0x51b276;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 8cc8792..77f8f8d 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 _0x2cea=['exports','ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x4bc7dd,_0x4a6aa2){var _0x8a71a0=function(_0x249828){while(--_0x249828){_0x4bc7dd['push'](_0x4bc7dd['shift']());}};_0x8a71a0(++_0x4a6aa2);}(_0x2cea,0xa7));var _0xa2ce=function(_0x1d00c7,_0x9b96b2){_0x1d00c7=_0x1d00c7-0x0;var _0x5b4f51=_0x2cea[_0x1d00c7];return _0x5b4f51;};'use strict';var Sequelize=require(_0xa2ce('0x0'));module[_0xa2ce('0x1')]={'type':{'type':Sequelize[_0xa2ce('0x2')](_0xa2ce('0x3'),_0xa2ce('0x4'),_0xa2ce('0x5'),_0xa2ce('0x6')),'defaultValue':_0xa2ce('0x3')},'content':{'type':Sequelize[_0xa2ce('0x7')]},'key':{'type':Sequelize[_0xa2ce('0x7')]},'keyType':{'type':Sequelize[_0xa2ce('0x2')](_0xa2ce('0x3'),_0xa2ce('0x4'),_0xa2ce('0x5'))},'keyContent':{'type':Sequelize[_0xa2ce('0x7')]},'idField':{'type':Sequelize[_0xa2ce('0x7')]},'variableName':{'type':Sequelize[_0xa2ce('0x7')]}}; \ No newline at end of file +var _0x2d22=['ENUM','string','variable','customVariable','STRING'];(function(_0x9cca21,_0xaee881){var _0x27ddbf=function(_0x12d4ac){while(--_0x12d4ac){_0x9cca21['push'](_0x9cca21['shift']());}};_0x27ddbf(++_0xaee881);}(_0x2d22,0x19f));var _0x22d2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2d22[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x22d2('0x0')](_0x22d2('0x1'),_0x22d2('0x2'),_0x22d2('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x22d2('0x4')]},'key':{'type':Sequelize[_0x22d2('0x4')]},'keyType':{'type':Sequelize[_0x22d2('0x0')]('string',_0x22d2('0x2'),_0x22d2('0x3'))},'keyContent':{'type':Sequelize[_0x22d2('0x4')]},'idField':{'type':Sequelize[_0x22d2('0x4')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e0da00a..1dc62c9 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 _0x2106=['length','hasOwnProperty','nolimit','order','sort','filters','pick','where','type','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','index','map','SalesforceField','fieldName','key','model','query','keys','intersection','attributes','fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2106,0x18e));var _0x6210=function(_0x17b2fa,_0x13f12f){_0x17b2fa=_0x17b2fa-0x0;var _0x1b2d66=_0x2106[_0x17b2fa];return _0x1b2d66;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6210('0x0'));var rimraf=require(_0x6210('0x1'));var zipdir=require(_0x6210('0x2'));var jsonpatch=require(_0x6210('0x3'));var rp=require(_0x6210('0x4'));var moment=require('moment');var BPromise=require(_0x6210('0x5'));var Mustache=require(_0x6210('0x6'));var util=require(_0x6210('0x7'));var path=require('path');var sox=require(_0x6210('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6210('0x9'));var squel=require(_0x6210('0xa'));var crypto=require(_0x6210('0xb'));var jsforce=require(_0x6210('0xc'));var deskjs=require(_0x6210('0xd'));var toCsv=require(_0x6210('0xe'));var querystring=require(_0x6210('0xf'));var Papa=require(_0x6210('0x10'));var Redis=require(_0x6210('0x11'));var authService=require(_0x6210('0x12'));var qs=require(_0x6210('0x13'));var as=require(_0x6210('0x14'));var hardwareService=require(_0x6210('0x15'));var logger=require(_0x6210('0x16'))(_0x6210('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6210('0x18'))['db'];function respondWithStatusCode(_0x5ea9f3,_0x13ffec){_0x13ffec=_0x13ffec||0xcc;return function(_0x2ad6e5){if(_0x2ad6e5){return _0x5ea9f3[_0x6210('0x19')](_0x13ffec);}return _0x5ea9f3[_0x6210('0x1a')](_0x13ffec)[_0x6210('0x1b')]();};}function respondWithResult(_0x2f91f4,_0x342ecf){_0x342ecf=_0x342ecf||0xc8;return function(_0x3e1b7a){if(_0x3e1b7a){return _0x2f91f4['status'](_0x342ecf)[_0x6210('0x1c')](_0x3e1b7a);}};}function respondWithFilteredResult(_0x1a82c8,_0x57840f){return function(_0x204faf){if(_0x204faf){var _0x5db825=_0x204faf[_0x6210('0x1d')],_0xcd6bf9=_0x57840f[_0x6210('0x1e')],_0x59d9df=_0x57840f[_0x6210('0x1e')]+_0x57840f[_0x6210('0x1f')],_0x22ccc7;if(_0x59d9df>=_0x5db825){_0x59d9df=_0x5db825;_0x22ccc7=0xc8;}else{_0x22ccc7=0xce;}_0x1a82c8['status'](_0x22ccc7);return _0x1a82c8[_0x6210('0x20')]('Content-Range',_0xcd6bf9+'-'+_0x59d9df+'/'+_0x5db825)['json'](_0x204faf);}return null;};}function patchUpdates(_0x3d4173){return function(_0x4dce9e){try{jsonpatch[_0x6210('0x21')](_0x4dce9e,_0x3d4173,!![]);}catch(_0x553d7f){return BPromise[_0x6210('0x22')](_0x553d7f);}return _0x4dce9e[_0x6210('0x23')]();};}function saveUpdates(_0x4456f6,_0x5582c4){return function(_0x31ffe0){if(_0x31ffe0){return _0x31ffe0[_0x6210('0x24')](_0x4456f6)[_0x6210('0x25')](function(_0x45451e){return _0x45451e;});}return null;};}function removeEntity(_0x31f243,_0x2de61a){return function(_0x175e86){if(_0x175e86){return _0x175e86[_0x6210('0x26')]()[_0x6210('0x25')](function(){_0x31f243[_0x6210('0x1a')](0xcc)[_0x6210('0x1b')]();});}};}function handleEntityNotFound(_0x589eeb,_0x2f2c93){return function(_0x8555d1){if(!_0x8555d1){_0x589eeb['sendStatus'](0x194);}return _0x8555d1;};}function handleError(_0x5d05d3,_0x2f425e){_0x2f425e=_0x2f425e||0x1f4;return function(_0x127da8){logger['error'](_0x127da8[_0x6210('0x27')]);if(_0x127da8[_0x6210('0x28')]){delete _0x127da8[_0x6210('0x28')];}_0x5d05d3[_0x6210('0x1a')](_0x2f425e)['send'](_0x127da8);};}exports[_0x6210('0x29')]=function(_0x4e1140,_0x369f7b){var _0x164aa5={},_0x4128d4={},_0x45a8da={'count':0x0,'rows':[]};var _0x30035a=_[_0x6210('0x2a')](db[_0x6210('0x2b')]['rawAttributes'],function(_0x20fd2e){return{'name':_0x20fd2e[_0x6210('0x2c')],'type':_0x20fd2e['type'][_0x6210('0x2d')]};});_0x4128d4[_0x6210('0x2e')]=_[_0x6210('0x2a')](_0x30035a,'name');_0x4128d4[_0x6210('0x2f')]=_[_0x6210('0x30')](_0x4e1140['query']);_0x4128d4['filters']=_[_0x6210('0x31')](_0x4128d4[_0x6210('0x2e')],_0x4128d4['query']);_0x164aa5[_0x6210('0x32')]=_[_0x6210('0x31')](_0x4128d4[_0x6210('0x2e')],qs['fields'](_0x4e1140[_0x6210('0x2f')][_0x6210('0x33')]));_0x164aa5['attributes']=_0x164aa5[_0x6210('0x32')][_0x6210('0x34')]?_0x164aa5[_0x6210('0x32')]:_0x4128d4[_0x6210('0x2e')];if(!_0x4e1140['query'][_0x6210('0x35')](_0x6210('0x36'))){_0x164aa5[_0x6210('0x1f')]=qs[_0x6210('0x1f')](_0x4e1140[_0x6210('0x2f')]['limit']);_0x164aa5[_0x6210('0x1e')]=qs[_0x6210('0x1e')](_0x4e1140[_0x6210('0x2f')][_0x6210('0x1e')]);}_0x164aa5[_0x6210('0x37')]=qs['sort'](_0x4e1140[_0x6210('0x2f')][_0x6210('0x38')]);_0x164aa5['where']=qs[_0x6210('0x39')](_[_0x6210('0x3a')](_0x4e1140[_0x6210('0x2f')],_0x4128d4[_0x6210('0x39')]),_0x30035a);if(_0x4e1140[_0x6210('0x2f')]['filter']){_0x164aa5[_0x6210('0x3b')]=_['merge'](_0x164aa5[_0x6210('0x3b')],{'$or':_[_0x6210('0x2a')](_0x30035a,function(_0x485e37){if(_0x485e37[_0x6210('0x3c')]!==_0x6210('0x3d')){var _0x4d9de8={};_0x4d9de8[_0x485e37[_0x6210('0x28')]]={'$like':'%'+_0x4e1140[_0x6210('0x2f')][_0x6210('0x3e')]+'%'};return _0x4d9de8;}})});}_0x164aa5=_[_0x6210('0x3f')]({},_0x164aa5,_0x4e1140['options']);var _0x2ce7f5={'where':_0x164aa5[_0x6210('0x3b')]};return db[_0x6210('0x2b')][_0x6210('0x1d')](_0x2ce7f5)[_0x6210('0x25')](function(_0x2324a5){_0x45a8da[_0x6210('0x1d')]=_0x2324a5;if(_0x4e1140[_0x6210('0x2f')][_0x6210('0x40')]){_0x164aa5[_0x6210('0x41')]=[{'all':!![]}];}return db[_0x6210('0x2b')][_0x6210('0x42')](_0x164aa5);})[_0x6210('0x25')](function(_0x51f4ae){_0x45a8da['rows']=_0x51f4ae;return _0x45a8da;})[_0x6210('0x25')](respondWithFilteredResult(_0x369f7b,_0x164aa5))[_0x6210('0x43')](handleError(_0x369f7b,null));};exports[_0x6210('0x44')]=function(_0x12a426,_0x5ab428){var _0x3e7bc4={'raw':!![],'where':{'id':_0x12a426[_0x6210('0x45')]['id']}},_0x1ceb90={};_0x1ceb90['model']=_['keys'](db['SalesforceField'][_0x6210('0x46')]);_0x1ceb90[_0x6210('0x2f')]=_[_0x6210('0x30')](_0x12a426[_0x6210('0x2f')]);_0x1ceb90[_0x6210('0x39')]=_[_0x6210('0x31')](_0x1ceb90[_0x6210('0x2e')],_0x1ceb90[_0x6210('0x2f')]);_0x3e7bc4[_0x6210('0x32')]=_['intersection'](_0x1ceb90[_0x6210('0x2e')],qs[_0x6210('0x33')](_0x12a426['query'][_0x6210('0x33')]));_0x3e7bc4[_0x6210('0x32')]=_0x3e7bc4[_0x6210('0x32')][_0x6210('0x34')]?_0x3e7bc4[_0x6210('0x32')]:_0x1ceb90[_0x6210('0x2e')];if(_0x12a426[_0x6210('0x2f')][_0x6210('0x40')]){_0x3e7bc4[_0x6210('0x41')]=[{'all':!![]}];}_0x3e7bc4=_[_0x6210('0x3f')]({},_0x3e7bc4,_0x12a426[_0x6210('0x47')]);return db['SalesforceField'][_0x6210('0x48')](_0x3e7bc4)[_0x6210('0x25')](handleEntityNotFound(_0x5ab428,null))[_0x6210('0x25')](respondWithResult(_0x5ab428,null))[_0x6210('0x43')](handleError(_0x5ab428,null));};exports[_0x6210('0x49')]=function(_0x546c55,_0x2fb7e1){return db[_0x6210('0x2b')][_0x6210('0x49')](_0x546c55[_0x6210('0x4a')],{})['then'](respondWithResult(_0x2fb7e1,0xc9))['catch'](handleError(_0x2fb7e1,null));};exports[_0x6210('0x24')]=function(_0x174bdb,_0x1a6117){if(_0x174bdb[_0x6210('0x4a')]['id']){delete _0x174bdb[_0x6210('0x4a')]['id'];}return db[_0x6210('0x2b')][_0x6210('0x48')]({'where':{'id':_0x174bdb['params']['id']}})[_0x6210('0x25')](handleEntityNotFound(_0x1a6117,null))[_0x6210('0x25')](saveUpdates(_0x174bdb[_0x6210('0x4a')],null))[_0x6210('0x25')](respondWithResult(_0x1a6117,null))[_0x6210('0x43')](handleError(_0x1a6117,null));};exports[_0x6210('0x26')]=function(_0x475144,_0x3abc74){return db[_0x6210('0x2b')][_0x6210('0x48')]({'where':{'id':_0x475144[_0x6210('0x45')]['id']}})[_0x6210('0x25')](handleEntityNotFound(_0x3abc74,null))[_0x6210('0x25')](removeEntity(_0x3abc74,null))[_0x6210('0x43')](handleError(_0x3abc74,null));}; \ No newline at end of file +var _0x9117=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SalesforceField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body'];(function(_0x4873cd,_0x140991){var _0x4c06cf=function(_0x1abbf1){while(--_0x1abbf1){_0x4873cd['push'](_0x4873cd['shift']());}};_0x4c06cf(++_0x140991);}(_0x9117,0x181));var _0x7911=function(_0x5804b0,_0x3bedd5){_0x5804b0=_0x5804b0-0x0;var _0x1d0d1c=_0x9117[_0x5804b0];return _0x1d0d1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7911('0x0'));var rimraf=require(_0x7911('0x1'));var zipdir=require(_0x7911('0x2'));var jsonpatch=require(_0x7911('0x3'));var rp=require(_0x7911('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7911('0x5'));var util=require(_0x7911('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7911('0x7'));var ejs=require(_0x7911('0x8'));var fs=require('fs');var _=require(_0x7911('0x9'));var squel=require('squel');var crypto=require(_0x7911('0xa'));var jsforce=require(_0x7911('0xb'));var deskjs=require(_0x7911('0xc'));var toCsv=require(_0x7911('0x7'));var querystring=require(_0x7911('0xd'));var Papa=require(_0x7911('0xe'));var Redis=require('ioredis');var authService=require(_0x7911('0xf'));var qs=require(_0x7911('0x10'));var as=require(_0x7911('0x11'));var hardwareService=require(_0x7911('0x12'));var logger=require(_0x7911('0x13'))(_0x7911('0x14'));var utils=require(_0x7911('0x15'));var config=require(_0x7911('0x16'));var db=require(_0x7911('0x17'))['db'];function respondWithStatusCode(_0xe593bc,_0x3dd4bd){_0x3dd4bd=_0x3dd4bd||0xcc;return function(_0x2f941c){if(_0x2f941c){return _0xe593bc[_0x7911('0x18')](_0x3dd4bd);}return _0xe593bc[_0x7911('0x19')](_0x3dd4bd)[_0x7911('0x1a')]();};}function respondWithResult(_0x3b6ec6,_0xd6fcbf){_0xd6fcbf=_0xd6fcbf||0xc8;return function(_0x12d4f9){if(_0x12d4f9){return _0x3b6ec6[_0x7911('0x19')](_0xd6fcbf)[_0x7911('0x1b')](_0x12d4f9);}};}function respondWithFilteredResult(_0x570a5d,_0x581bb8){return function(_0x3a55e8){if(_0x3a55e8){var _0x114def=_0x3a55e8[_0x7911('0x1c')],_0x14cc43=_0x581bb8[_0x7911('0x1d')],_0x179740=_0x581bb8[_0x7911('0x1d')]+_0x581bb8[_0x7911('0x1e')],_0x23f06b;if(_0x179740>=_0x114def){_0x179740=_0x114def;_0x23f06b=0xc8;}else{_0x23f06b=0xce;}_0x570a5d[_0x7911('0x19')](_0x23f06b);return _0x570a5d[_0x7911('0x1f')](_0x7911('0x20'),_0x14cc43+'-'+_0x179740+'/'+_0x114def)[_0x7911('0x1b')](_0x3a55e8);}return null;};}function patchUpdates(_0x59bd91){return function(_0xf61591){try{jsonpatch[_0x7911('0x21')](_0xf61591,_0x59bd91,!![]);}catch(_0x4a4227){return BPromise[_0x7911('0x22')](_0x4a4227);}return _0xf61591[_0x7911('0x23')]();};}function saveUpdates(_0xd53fd1,_0x3483f0){return function(_0x2bd528){if(_0x2bd528){return _0x2bd528[_0x7911('0x24')](_0xd53fd1)[_0x7911('0x25')](function(_0x5be504){return _0x5be504;});}return null;};}function removeEntity(_0x148066,_0x43c8e0){return function(_0x1518df){if(_0x1518df){return _0x1518df[_0x7911('0x26')]()[_0x7911('0x25')](function(){_0x148066[_0x7911('0x19')](0xcc)[_0x7911('0x1a')]();});}};}function handleEntityNotFound(_0x3b7e38,_0x54b0f0){return function(_0x42967b){if(!_0x42967b){_0x3b7e38[_0x7911('0x18')](0x194);}return _0x42967b;};}function handleError(_0x1043aa,_0x139226){_0x139226=_0x139226||0x1f4;return function(_0x2dde8c){logger[_0x7911('0x27')](_0x2dde8c[_0x7911('0x28')]);if(_0x2dde8c[_0x7911('0x29')]){delete _0x2dde8c[_0x7911('0x29')];}_0x1043aa['status'](_0x139226)[_0x7911('0x2a')](_0x2dde8c);};}exports[_0x7911('0x2b')]=function(_0x3e77ef,_0x3ef65e){var _0x58c968={},_0x4e7d9c={},_0x4bb9e6={'count':0x0,'rows':[]};var _0x2244b6=_[_0x7911('0x2c')](db['SalesforceField']['rawAttributes'],function(_0x291ac7){return{'name':_0x291ac7['fieldName'],'type':_0x291ac7['type'][_0x7911('0x2d')]};});_0x4e7d9c[_0x7911('0x2e')]=_['map'](_0x2244b6,_0x7911('0x29'));_0x4e7d9c[_0x7911('0x2f')]=_[_0x7911('0x30')](_0x3e77ef['query']);_0x4e7d9c[_0x7911('0x31')]=_[_0x7911('0x32')](_0x4e7d9c[_0x7911('0x2e')],_0x4e7d9c[_0x7911('0x2f')]);_0x58c968[_0x7911('0x33')]=_[_0x7911('0x32')](_0x4e7d9c[_0x7911('0x2e')],qs[_0x7911('0x34')](_0x3e77ef[_0x7911('0x2f')]['fields']));_0x58c968[_0x7911('0x33')]=_0x58c968['attributes'][_0x7911('0x35')]?_0x58c968[_0x7911('0x33')]:_0x4e7d9c[_0x7911('0x2e')];if(!_0x3e77ef[_0x7911('0x2f')][_0x7911('0x36')](_0x7911('0x37'))){_0x58c968[_0x7911('0x1e')]=qs['limit'](_0x3e77ef[_0x7911('0x2f')][_0x7911('0x1e')]);_0x58c968['offset']=qs[_0x7911('0x1d')](_0x3e77ef[_0x7911('0x2f')][_0x7911('0x1d')]);}_0x58c968[_0x7911('0x38')]=qs[_0x7911('0x39')](_0x3e77ef['query']['sort']);_0x58c968[_0x7911('0x3a')]=qs[_0x7911('0x31')](_[_0x7911('0x3b')](_0x3e77ef['query'],_0x4e7d9c[_0x7911('0x31')]),_0x2244b6);if(_0x3e77ef[_0x7911('0x2f')][_0x7911('0x3c')]){_0x58c968[_0x7911('0x3a')]=_[_0x7911('0x3d')](_0x58c968[_0x7911('0x3a')],{'$or':_[_0x7911('0x2c')](_0x2244b6,function(_0x5cf26b){if(_0x5cf26b[_0x7911('0x3e')]!==_0x7911('0x3f')){var _0x4a2db2={};_0x4a2db2[_0x5cf26b['name']]={'$like':'%'+_0x3e77ef[_0x7911('0x2f')]['filter']+'%'};return _0x4a2db2;}})});}_0x58c968=_[_0x7911('0x3d')]({},_0x58c968,_0x3e77ef[_0x7911('0x40')]);var _0x47e969={'where':_0x58c968['where']};return db[_0x7911('0x41')]['count'](_0x47e969)['then'](function(_0xe11b33){_0x4bb9e6[_0x7911('0x1c')]=_0xe11b33;if(_0x3e77ef[_0x7911('0x2f')][_0x7911('0x42')]){_0x58c968[_0x7911('0x43')]=[{'all':!![]}];}return db[_0x7911('0x41')][_0x7911('0x44')](_0x58c968);})[_0x7911('0x25')](function(_0x49ee94){_0x4bb9e6[_0x7911('0x45')]=_0x49ee94;return _0x4bb9e6;})[_0x7911('0x25')](respondWithFilteredResult(_0x3ef65e,_0x58c968))[_0x7911('0x46')](handleError(_0x3ef65e,null));};exports[_0x7911('0x47')]=function(_0x46fea1,_0xe37d75){var _0x422967={'raw':!![],'where':{'id':_0x46fea1[_0x7911('0x48')]['id']}},_0x114146={};_0x114146[_0x7911('0x2e')]=_[_0x7911('0x30')](db[_0x7911('0x41')][_0x7911('0x49')]);_0x114146[_0x7911('0x2f')]=_[_0x7911('0x30')](_0x46fea1[_0x7911('0x2f')]);_0x114146[_0x7911('0x31')]=_[_0x7911('0x32')](_0x114146[_0x7911('0x2e')],_0x114146[_0x7911('0x2f')]);_0x422967[_0x7911('0x33')]=_[_0x7911('0x32')](_0x114146[_0x7911('0x2e')],qs['fields'](_0x46fea1['query'][_0x7911('0x34')]));_0x422967[_0x7911('0x33')]=_0x422967['attributes']['length']?_0x422967[_0x7911('0x33')]:_0x114146['model'];if(_0x46fea1[_0x7911('0x2f')][_0x7911('0x42')]){_0x422967[_0x7911('0x43')]=[{'all':!![]}];}_0x422967=_[_0x7911('0x3d')]({},_0x422967,_0x46fea1[_0x7911('0x40')]);return db[_0x7911('0x41')][_0x7911('0x4a')](_0x422967)[_0x7911('0x25')](handleEntityNotFound(_0xe37d75,null))[_0x7911('0x25')](respondWithResult(_0xe37d75,null))[_0x7911('0x46')](handleError(_0xe37d75,null));};exports['create']=function(_0x1edc5d,_0x3b4ade){return db['SalesforceField'][_0x7911('0x4b')](_0x1edc5d[_0x7911('0x4c')],{})[_0x7911('0x25')](respondWithResult(_0x3b4ade,0xc9))['catch'](handleError(_0x3b4ade,null));};exports['update']=function(_0x15ea0e,_0x5ed7e9){if(_0x15ea0e[_0x7911('0x4c')]['id']){delete _0x15ea0e[_0x7911('0x4c')]['id'];}return db[_0x7911('0x41')][_0x7911('0x4a')]({'where':{'id':_0x15ea0e[_0x7911('0x48')]['id']}})[_0x7911('0x25')](handleEntityNotFound(_0x5ed7e9,null))[_0x7911('0x25')](saveUpdates(_0x15ea0e[_0x7911('0x4c')],null))[_0x7911('0x25')](respondWithResult(_0x5ed7e9,null))['catch'](handleError(_0x5ed7e9,null));};exports[_0x7911('0x26')]=function(_0x283fe3,_0x30a68c){return db['SalesforceField']['find']({'where':{'id':_0x283fe3[_0x7911('0x48')]['id']}})[_0x7911('0x25')](handleEntityNotFound(_0x30a68c,null))[_0x7911('0x25')](removeEntity(_0x30a68c,null))[_0x7911('0x46')](handleError(_0x30a68c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 5c903b4..d3d1e2d 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 _0x070a=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','salesforce_unique_index','idField','FieldId'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x070a,0x9c));var _0xa070=function(_0x18ea9f,_0x4709f6){_0x18ea9f=_0x18ea9f-0x0;var _0x51725d=_0x070a[_0x18ea9f];return _0x51725d;};'use strict';var _=require(_0xa070('0x0'));var util=require(_0xa070('0x1'));var logger=require(_0xa070('0x2'))(_0xa070('0x3'));var moment=require('moment');var BPromise=require(_0xa070('0x4'));var rp=require(_0xa070('0x5'));var fs=require('fs');var path=require(_0xa070('0x6'));var rimraf=require(_0xa070('0x7'));var config=require(_0xa070('0x8'));var attributes=require(_0xa070('0x9'));module['exports']=function(_0x56587a,_0x556084){return _0x56587a['define']('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xa070('0xa'),'fields':[_0xa070('0xb'),_0xa070('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7d5=['api','bluebird','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','idField','lodash','util','../../config/logger'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xb7d5,0x8d));var _0x5b7d=function(_0x56aa76,_0x399f75){_0x56aa76=_0x56aa76-0x0;var _0x48a253=_0xb7d5[_0x56aa76];return _0x48a253;};'use strict';var _=require(_0x5b7d('0x0'));var util=require(_0x5b7d('0x1'));var logger=require(_0x5b7d('0x2'))(_0x5b7d('0x3'));var moment=require('moment');var BPromise=require(_0x5b7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b7d('0x5'));var config=require(_0x5b7d('0x6'));var attributes=require(_0x5b7d('0x7'));module[_0x5b7d('0x8')]=function(_0x5523e7,_0x50f08c){return _0x5523e7['define'](_0x5b7d('0x9'),attributes,{'tableName':_0x5b7d('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x5b7d('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 52a6a82..0ea37ea 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 _0x70e0=['code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4b63f7,_0x18cef5){var _0x2bf5b8=function(_0x3beac7){while(--_0x3beac7){_0x4b63f7['push'](_0x4b63f7['shift']());}};_0x2bf5b8(++_0x18cef5);}(_0x70e0,0x17b));var _0x070e=function(_0x1c6313,_0x4544cc){_0x1c6313=_0x1c6313-0x0;var _0xdd41bb=_0x70e0[_0x1c6313];return _0xdd41bb;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('SalesforceField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('SalesforceField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x5c00=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5c00,0x17e));var _0x05c0=function(_0x3494ee,_0x7b1b9a){_0x3494ee=_0x3494ee-0x0;var _0x12b115=_0x5c00[_0x3494ee];return _0x12b115;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index fc0e61a..60db0c9 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 _0xd0bb=['create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','getFields','post'];(function(_0x283840,_0x4e1db6){var _0x36ef52=function(_0x2a7107){while(--_0x2a7107){_0x283840['push'](_0x283840['shift']());}};_0x36ef52(++_0x4e1db6);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x7033ad,_0x4f191a){_0x7033ad=_0x7033ad-0x0;var _0x4117fb=_0xd0bb[_0x7033ad];return _0x4117fb;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var auth=require(_0xbd0b('0x4'));var interaction=require(_0xbd0b('0x5'));var config=require('../../config/environment');var controller=require(_0xbd0b('0x6'));router['get']('/',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x8')]);router[_0xbd0b('0x9')](_0xbd0b('0xa'),auth[_0xbd0b('0x7')](),controller['show']);router[_0xbd0b('0x9')](_0xbd0b('0xb'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xc')]);router[_0xbd0b('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbd0b('0xd')]);router[_0xbd0b('0xe')]('/',auth['isAuthenticated'](),controller[_0xbd0b('0xf')]);router[_0xbd0b('0xe')]('/:id/configurations',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x10')]);router[_0xbd0b('0x11')](_0xbd0b('0xa'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x12')]);router[_0xbd0b('0x13')](_0xbd0b('0xa'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x14')]);module[_0xbd0b('0x15')]=router; \ No newline at end of file +var _0x5859=['addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x5859,0xc4));var _0x9585=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x5859[_0x381589];return _0x2a075d;};'use strict';var multer=require(_0x9585('0x0'));var util=require(_0x9585('0x1'));var path=require(_0x9585('0x2'));var timeout=require(_0x9585('0x3'));var express=require(_0x9585('0x4'));var router=express[_0x9585('0x5')]();var auth=require(_0x9585('0x6'));var interaction=require(_0x9585('0x7'));var config=require(_0x9585('0x8'));var controller=require(_0x9585('0x9'));router[_0x9585('0xa')]('/',auth[_0x9585('0xb')](),controller[_0x9585('0xc')]);router['get'](_0x9585('0xd'),auth[_0x9585('0xb')](),controller[_0x9585('0xe')]);router['get'](_0x9585('0xf'),auth[_0x9585('0xb')](),controller['getConfigurations']);router['get'](_0x9585('0x10'),auth[_0x9585('0xb')](),controller[_0x9585('0x11')]);router[_0x9585('0x12')]('/',auth['isAuthenticated'](),controller[_0x9585('0x13')]);router['post'](_0x9585('0xf'),auth[_0x9585('0xb')](),controller[_0x9585('0x14')]);router[_0x9585('0x15')](_0x9585('0xd'),auth[_0x9585('0xb')](),controller['update']);router[_0x9585('0x16')](_0x9585('0xd'),auth[_0x9585('0xb')](),controller['destroy']);module[_0x9585('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c60bbe3..f7bb3e8 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 _0x1ce9=['remoteUri','sequelize','exports','STRING','username'];(function(_0x27aca0,_0x30fe39){var _0x70596c=function(_0x406ba0){while(--_0x406ba0){_0x27aca0['push'](_0x27aca0['shift']());}};_0x70596c(++_0x30fe39);}(_0x1ce9,0x15f));var _0x91ce=function(_0x4ade35,_0x194feb){_0x4ade35=_0x4ade35-0x0;var _0x2772e4=_0x1ce9[_0x4ade35];return _0x2772e4;};'use strict';var Sequelize=require(_0x91ce('0x0'));module[_0x91ce('0x1')]={'name':{'type':Sequelize[_0x91ce('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x91ce('0x2')],'unique':_0x91ce('0x3')},'password':{'type':Sequelize[_0x91ce('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x91ce('0x2')],'unique':_0x91ce('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe6ed=['username','remoteUri','sequelize','exports','STRING'];(function(_0x490c57,_0x5ceb2d){var _0x27b89e=function(_0xdcb0da){while(--_0xdcb0da){_0x490c57['push'](_0x490c57['shift']());}};_0x27b89e(++_0x5ceb2d);}(_0xe6ed,0x15b));var _0xde6e=function(_0x1ae426,_0x45225c){_0x1ae426=_0x1ae426-0x0;var _0x48d371=_0xe6ed[_0x1ae426];return _0x48d371;};'use strict';var Sequelize=require(_0xde6e('0x0'));module[_0xde6e('0x1')]={'name':{'type':Sequelize[_0xde6e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xde6e('0x2')],'unique':_0xde6e('0x3')},'password':{'type':Sequelize[_0xde6e('0x2')]},'email':{'type':Sequelize[_0xde6e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xde6e('0x4')},'serverUrl':{'type':Sequelize[_0xde6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index e5d38cc..c217f87 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 _0x8fed=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','ServicenowAccount','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','filter','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','watch_list','sys_updated_on','child_incidents','approval_history','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','delivery_task','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident\x20table\x20objects','assign','remove','forEach','internalType','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','statusCode','boolean','True','true','false','inactive','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x165508,_0x3f7033){var _0x26b90f=function(_0x4de9aa){while(--_0x4de9aa){_0x165508['push'](_0x165508['shift']());}};_0x26b90f(++_0x3f7033);}(_0x8fed,0xab));var _0xd8fe=function(_0x5367a1,_0x11c0e0){_0x5367a1=_0x5367a1-0x0;var _0x928aeb=_0x8fed[_0x5367a1];return _0x928aeb;};'use strict';var pdf=require(_0xd8fe('0x0'));var emlformat=require(_0xd8fe('0x1'));var rimraf=require(_0xd8fe('0x2'));var zipdir=require(_0xd8fe('0x3'));var jsonpatch=require(_0xd8fe('0x4'));var rp=require(_0xd8fe('0x5'));var moment=require(_0xd8fe('0x6'));var BPromise=require(_0xd8fe('0x7'));var Mustache=require(_0xd8fe('0x8'));var util=require(_0xd8fe('0x9'));var path=require(_0xd8fe('0xa'));var sox=require(_0xd8fe('0xb'));var csv=require(_0xd8fe('0xc'));var ejs=require(_0xd8fe('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd8fe('0xe'));var crypto=require(_0xd8fe('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd8fe('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd8fe('0x11'));var Papa=require('papaparse');var Redis=require(_0xd8fe('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd8fe('0x13'));var hardwareService=require(_0xd8fe('0x14'));var logger=require(_0xd8fe('0x15'))(_0xd8fe('0x16'));var utils=require(_0xd8fe('0x17'));var config=require(_0xd8fe('0x18'));var db=require(_0xd8fe('0x19'))['db'];var integrations=require(_0xd8fe('0x1a'));var jayson=require(_0xd8fe('0x1b'));var client=jayson[_0xd8fe('0x1c')][_0xd8fe('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x181aa7,_0x4515d1,_0xe7e980){if(_0xe7e980){var _0x5b942=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b942[_0xd8fe('0x1e')](_0x4515d1)){return _0x181aa7;}else{throw new db[(_0xd8fe('0x1f'))][(_0xd8fe('0x20'))](_0xd8fe('0x21'));}}else{return _0x181aa7;}}function respondWithRpcPromise(_0x3589e0,_0x54f9c6,_0x469404,_0x38ced3){return new BPromise(function(_0x3d8784,_0x7bdbfb){var _0x2034ac=_0x38ced3||client;return _0x2034ac[_0xd8fe('0x22')](_0x3589e0,_0x469404)[_0xd8fe('0x23')](function(_0x56805a){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x54f9c6,'request\x20sent');logger['debug'](_0xd8fe('0x24'),_0x54f9c6,_0xd8fe('0x25'),JSON[_0xd8fe('0x26')](_0x56805a));if(_0x56805a['error']){if(_0x56805a['error']['code']===0x1f4){logger[_0xd8fe('0x27')](_0xd8fe('0x28'),_0x54f9c6,_0x56805a['error']['message']);return _0x7bdbfb(_0x56805a[_0xd8fe('0x27')][_0xd8fe('0x29')]);}logger[_0xd8fe('0x27')]('ServicenowAccount,\x20%s,\x20%s',_0x54f9c6,_0x56805a[_0xd8fe('0x27')][_0xd8fe('0x29')]);return _0x3d8784(_0x56805a[_0xd8fe('0x27')][_0xd8fe('0x29')]);}else{logger[_0xd8fe('0x2a')]('ServicenowAccount,\x20%s,\x20%s',_0x54f9c6,_0xd8fe('0x25'));_0x3d8784(_0x56805a[_0xd8fe('0x2b')][_0xd8fe('0x29')]);}})[_0xd8fe('0x2c')](function(_0x4941a7){logger[_0xd8fe('0x27')](_0xd8fe('0x28'),_0x54f9c6,_0x4941a7);_0x7bdbfb(_0x4941a7);});});}function respondWithStatusCode(_0x48ad3b,_0x1330bb){_0x1330bb=_0x1330bb||0xcc;return function(_0x91c680){if(_0x91c680){return _0x48ad3b[_0xd8fe('0x2d')](_0x1330bb);}return _0x48ad3b[_0xd8fe('0x2e')](_0x1330bb)[_0xd8fe('0x2f')]();};}function respondWithResult(_0x3716af,_0x3a6782){_0x3a6782=_0x3a6782||0xc8;return function(_0x194545){if(_0x194545){return _0x3716af[_0xd8fe('0x2e')](_0x3a6782)['json'](_0x194545);}};}function respondWithFilteredResult(_0x49e50b,_0x21224d){return function(_0x18cf11){if(_0x18cf11){var _0x4cde41=_0x18cf11[_0xd8fe('0x30')],_0x19ef07=_0x21224d[_0xd8fe('0x31')],_0x5744f2=_0x21224d[_0xd8fe('0x31')]+_0x21224d[_0xd8fe('0x32')],_0x3b39f1;if(_0x5744f2>=_0x4cde41){_0x5744f2=_0x4cde41;_0x3b39f1=0xc8;}else{_0x3b39f1=0xce;}_0x49e50b[_0xd8fe('0x2e')](_0x3b39f1);return _0x49e50b['set'](_0xd8fe('0x33'),_0x19ef07+'-'+_0x5744f2+'/'+_0x4cde41)[_0xd8fe('0x34')](_0x18cf11);}return null;};}function patchUpdates(_0x4bdec2){return function(_0x5dc728){try{jsonpatch[_0xd8fe('0x35')](_0x5dc728,_0x4bdec2,!![]);}catch(_0x2f1d0a){return BPromise['reject'](_0x2f1d0a);}return _0x5dc728[_0xd8fe('0x36')]();};}function saveUpdates(_0x5d99d4,_0x4ca650){return function(_0x2b108e){if(_0x2b108e){return _0x2b108e[_0xd8fe('0x37')](_0x5d99d4)[_0xd8fe('0x23')](function(_0x5e6372){return _0x5e6372;});}return null;};}function removeEntity(_0x94222f,_0x44b407){return function(_0x40d375){if(_0x40d375){return _0x40d375[_0xd8fe('0x38')]()[_0xd8fe('0x23')](function(){_0x94222f[_0xd8fe('0x2e')](0xcc)[_0xd8fe('0x2f')]();});}};}function handleEntityNotFound(_0x329aa0,_0x4edb04){return function(_0x28a229){if(!_0x28a229){_0x329aa0['sendStatus'](0x194);}return _0x28a229;};}function handleError(_0x2a5000,_0x161ded){_0x161ded=_0x161ded||0x1f4;return function(_0x545766){logger[_0xd8fe('0x27')](_0x545766[_0xd8fe('0x39')]);if(_0x545766[_0xd8fe('0x3a')]){delete _0x545766[_0xd8fe('0x3a')];}_0x2a5000['status'](_0x161ded)[_0xd8fe('0x3b')](_0x545766);};}exports[_0xd8fe('0x3c')]=function(_0x46ccb6,_0x24c329){var _0x51b715={},_0x88e166={},_0x1f402e={'count':0x0,'rows':[]};var _0x1132c4=_[_0xd8fe('0x3d')](db[_0xd8fe('0x3e')]['rawAttributes'],function(_0x3f964e){return{'name':_0x3f964e['fieldName'],'type':_0x3f964e[_0xd8fe('0x3f')][_0xd8fe('0x40')]};});_0x88e166[_0xd8fe('0x41')]=_[_0xd8fe('0x3d')](_0x1132c4,_0xd8fe('0x3a'));_0x88e166['query']=_['keys'](_0x46ccb6['query']);_0x88e166['filters']=_[_0xd8fe('0x42')](_0x88e166[_0xd8fe('0x41')],_0x88e166[_0xd8fe('0x43')]);_0x51b715[_0xd8fe('0x44')]=_[_0xd8fe('0x42')](_0x88e166['model'],qs[_0xd8fe('0x45')](_0x46ccb6[_0xd8fe('0x43')][_0xd8fe('0x45')]));_0x51b715['attributes']=_0x51b715[_0xd8fe('0x44')][_0xd8fe('0x46')]?_0x51b715[_0xd8fe('0x44')]:_0x88e166[_0xd8fe('0x41')];if(!_0x46ccb6[_0xd8fe('0x43')][_0xd8fe('0x47')](_0xd8fe('0x48'))){_0x51b715[_0xd8fe('0x32')]=qs['limit'](_0x46ccb6[_0xd8fe('0x43')][_0xd8fe('0x32')]);_0x51b715['offset']=qs[_0xd8fe('0x31')](_0x46ccb6[_0xd8fe('0x43')][_0xd8fe('0x31')]);}_0x51b715[_0xd8fe('0x49')]=qs[_0xd8fe('0x4a')](_0x46ccb6['query']['sort']);_0x51b715[_0xd8fe('0x4b')]=qs[_0xd8fe('0x4c')](_[_0xd8fe('0x4d')](_0x46ccb6['query'],_0x88e166[_0xd8fe('0x4c')]),_0x1132c4);if(_0x46ccb6[_0xd8fe('0x43')]['filter']){_0x51b715['where']=_[_0xd8fe('0x4e')](_0x51b715[_0xd8fe('0x4b')],{'$or':_[_0xd8fe('0x3d')](_0x1132c4,function(_0x194cb6){if(_0x194cb6[_0xd8fe('0x3f')]!=='VIRTUAL'){var _0x50bbdf={};_0x50bbdf[_0x194cb6[_0xd8fe('0x3a')]]={'$like':'%'+_0x46ccb6[_0xd8fe('0x43')]['filter']+'%'};return _0x50bbdf;}})});}_0x51b715=_[_0xd8fe('0x4e')]({},_0x51b715,_0x46ccb6[_0xd8fe('0x4f')]);var _0x4a97fe={'where':_0x51b715['where']};return db[_0xd8fe('0x3e')][_0xd8fe('0x30')](_0x4a97fe)['then'](function(_0x37a4e9){_0x1f402e[_0xd8fe('0x30')]=_0x37a4e9;if(_0x46ccb6[_0xd8fe('0x43')][_0xd8fe('0x50')]){_0x51b715[_0xd8fe('0x51')]=[{'all':!![]}];}return db[_0xd8fe('0x3e')]['findAll'](_0x51b715);})[_0xd8fe('0x23')](function(_0x2576ee){_0x1f402e[_0xd8fe('0x52')]=_0x2576ee;return _0x1f402e;})[_0xd8fe('0x23')](respondWithFilteredResult(_0x24c329,_0x51b715))[_0xd8fe('0x2c')](handleError(_0x24c329,null));};exports[_0xd8fe('0x53')]=function(_0x40c8c8,_0x3b2da2){var _0xfabd6b={'raw':![],'where':{'id':_0x40c8c8[_0xd8fe('0x54')]['id']}},_0x41710c={};_0x41710c[_0xd8fe('0x41')]=_[_0xd8fe('0x55')](db[_0xd8fe('0x3e')][_0xd8fe('0x56')]);_0x41710c[_0xd8fe('0x43')]=_[_0xd8fe('0x55')](_0x40c8c8['query']);_0x41710c[_0xd8fe('0x4c')]=_[_0xd8fe('0x42')](_0x41710c['model'],_0x41710c[_0xd8fe('0x43')]);_0xfabd6b[_0xd8fe('0x44')]=_['intersection'](_0x41710c['model'],qs[_0xd8fe('0x45')](_0x40c8c8['query'][_0xd8fe('0x45')]));_0xfabd6b['attributes']=_0xfabd6b[_0xd8fe('0x44')][_0xd8fe('0x46')]?_0xfabd6b['attributes']:_0x41710c['model'];if(_0x40c8c8[_0xd8fe('0x43')][_0xd8fe('0x50')]){_0xfabd6b[_0xd8fe('0x51')]=[{'all':!![]}];}_0xfabd6b=_[_0xd8fe('0x4e')]({},_0xfabd6b,_0x40c8c8[_0xd8fe('0x4f')]);return db[_0xd8fe('0x3e')][_0xd8fe('0x57')](_0xfabd6b)['then'](handleEntityNotFound(_0x3b2da2,null))[_0xd8fe('0x23')](respondWithResult(_0x3b2da2,null))[_0xd8fe('0x2c')](handleError(_0x3b2da2,null));};exports[_0xd8fe('0x58')]=function(_0x293ad4,_0x3c140f){return db[_0xd8fe('0x3e')]['create'](_0x293ad4[_0xd8fe('0x59')],{})[_0xd8fe('0x23')](respondWithResult(_0x3c140f,0xc9))[_0xd8fe('0x2c')](handleError(_0x3c140f,null));};exports[_0xd8fe('0x37')]=function(_0x16bc3d,_0x450b6c){if(_0x16bc3d[_0xd8fe('0x59')]['id']){delete _0x16bc3d['body']['id'];}return db[_0xd8fe('0x3e')]['find']({'where':{'id':_0x16bc3d[_0xd8fe('0x54')]['id']}})[_0xd8fe('0x23')](handleEntityNotFound(_0x450b6c,null))['then'](saveUpdates(_0x16bc3d[_0xd8fe('0x59')],null))[_0xd8fe('0x23')](respondWithResult(_0x450b6c,null))[_0xd8fe('0x2c')](handleError(_0x450b6c,null));};exports[_0xd8fe('0x38')]=function(_0x41b986,_0x527161){return db['ServicenowAccount'][_0xd8fe('0x57')]({'where':{'id':_0x41b986[_0xd8fe('0x54')]['id']}})['then'](handleEntityNotFound(_0x527161,null))[_0xd8fe('0x23')](removeEntity(_0x527161,null))[_0xd8fe('0x2c')](handleError(_0x527161,null));};exports[_0xd8fe('0x5a')]=function(_0x16be91,_0x1c2385,_0xe63eb6){var _0x4a1e56={};var _0x155266={};var _0x14fb4d;var _0x318751;return db[_0xd8fe('0x3e')][_0xd8fe('0x5b')]({'where':{'id':_0x16be91['params']['id']}})[_0xd8fe('0x23')](handleEntityNotFound(_0x1c2385,null))['then'](function(_0x387b6b){if(_0x387b6b){_0x14fb4d=_0x387b6b;_0x155266['model']=_[_0xd8fe('0x55')](db['ServicenowConfiguration'][_0xd8fe('0x56')]);_0x155266[_0xd8fe('0x43')]=_[_0xd8fe('0x55')](_0x16be91[_0xd8fe('0x43')]);_0x155266[_0xd8fe('0x4c')]=_['intersection'](_0x155266['model'],_0x155266[_0xd8fe('0x43')]);_0x4a1e56['attributes']=_[_0xd8fe('0x42')](_0x155266['model'],qs['fields'](_0x16be91[_0xd8fe('0x43')][_0xd8fe('0x45')]));_0x4a1e56['attributes']=_0x4a1e56[_0xd8fe('0x44')][_0xd8fe('0x46')]?_0x4a1e56[_0xd8fe('0x44')]:_0x155266[_0xd8fe('0x41')];_0x4a1e56[_0xd8fe('0x49')]=qs[_0xd8fe('0x4a')](_0x16be91[_0xd8fe('0x43')][_0xd8fe('0x4a')]);_0x4a1e56[_0xd8fe('0x4b')]=qs['filters'](_['pick'](_0x16be91['query'],_0x155266[_0xd8fe('0x4c')]));if(_0x16be91['query'][_0xd8fe('0x5c')]){_0x4a1e56[_0xd8fe('0x4b')]=_[_0xd8fe('0x4e')](_0x4a1e56[_0xd8fe('0x4b')],{'$or':_[_0xd8fe('0x3d')](_0x4a1e56[_0xd8fe('0x44')],function(_0x1acef2){var _0x5622f1={};_0x5622f1[_0x1acef2]={'$like':'%'+_0x16be91['query']['filter']+'%'};return _0x5622f1;})});}_0x4a1e56=_['merge']({},_0x4a1e56,_0x16be91['options']);return _0x14fb4d[_0xd8fe('0x5a')](_0x4a1e56);}})[_0xd8fe('0x23')](function(_0x5d63ab){if(_0x5d63ab){_0x318751=_0x5d63ab[_0xd8fe('0x46')];if(!_0x16be91[_0xd8fe('0x43')][_0xd8fe('0x47')](_0xd8fe('0x48'))){_0x4a1e56[_0xd8fe('0x32')]=qs[_0xd8fe('0x32')](_0x16be91['query'][_0xd8fe('0x32')]);_0x4a1e56[_0xd8fe('0x31')]=qs['offset'](_0x16be91['query'][_0xd8fe('0x31')]);}return _0x14fb4d[_0xd8fe('0x5a')](_0x4a1e56);}})['then'](function(_0x32b1f7){if(_0x32b1f7){return _0x32b1f7?{'count':_0x318751,'rows':_0x32b1f7}:null;}})['then'](respondWithResult(_0x1c2385,null))['catch'](handleError(_0x1c2385,null));};exports[_0xd8fe('0x5d')]=function(_0x2db9ff,_0x53a612,_0x7982d8){if(_0x2db9ff[_0xd8fe('0x59')]['id']){delete _0x2db9ff['body']['id'];}return db[_0xd8fe('0x3e')][_0xd8fe('0x5b')]({'where':{'id':_0x2db9ff[_0xd8fe('0x54')]['id']}})['then'](handleEntityNotFound(_0x53a612,null))[_0xd8fe('0x23')](function(_0xa47ae1){if(_0xa47ae1){_0x2db9ff[_0xd8fe('0x59')]['AccountId']=_0xa47ae1['id'];_0x2db9ff['body'][_0xd8fe('0x5e')]=integrations[_0xd8fe('0x5f')](_0x2db9ff['body'][_0xd8fe('0x60')],_0x2db9ff[_0xd8fe('0x59')]['type']);_0x2db9ff[_0xd8fe('0x59')][_0xd8fe('0x61')]=integrations[_0xd8fe('0x62')](_0x2db9ff[_0xd8fe('0x59')][_0xd8fe('0x60')],_0x2db9ff['body']['type']);return db[_0xd8fe('0x63')][_0xd8fe('0x58')](_0x2db9ff['body'],{'include':[{'model':db['ServicenowField'],'as':_0xd8fe('0x5e')},{'model':db['ServicenowField'],'as':_0xd8fe('0x61')}]});}return null;})['then'](respondWithResult(_0x53a612,null))[_0xd8fe('0x2c')](handleError(_0x53a612,null));};exports[_0xd8fe('0x64')]=function(_0x583888,_0x2c8a1e,_0x2ec517){var _0x3c9593=[_0xd8fe('0x65'),_0xd8fe('0x66'),_0xd8fe('0x67'),_0xd8fe('0x68'),_0xd8fe('0x69'),_0xd8fe('0x6a'),_0xd8fe('0x6b'),_0xd8fe('0x6c'),'category'];var _0x4db783=[_0xd8fe('0x6d'),'made_sla','caused_by',_0xd8fe('0x6e'),'upon_reject',_0xd8fe('0x6f'),_0xd8fe('0x70'),_0xd8fe('0x66'),_0xd8fe('0x71'),'number','resolved_by',_0xd8fe('0x72'),_0xd8fe('0x73'),_0xd8fe('0x74'),'sys_created_on',_0xd8fe('0x75'),_0xd8fe('0x76'),_0xd8fe('0x77'),_0xd8fe('0x67'),_0xd8fe('0x49'),_0xd8fe('0x78'),_0xd8fe('0x79'),'cmdb_ci','delivery_plan','impact',_0xd8fe('0x7a'),'work_notes_list',_0xd8fe('0x7b'),_0xd8fe('0x7c'),_0xd8fe('0x7d'),_0xd8fe('0x7e'),_0xd8fe('0x7f'),_0xd8fe('0x80'),_0xd8fe('0x81'),_0xd8fe('0x82'),'group_list',_0xd8fe('0x83'),_0xd8fe('0x84'),_0xd8fe('0x85'),_0xd8fe('0x86'),_0xd8fe('0x87'),_0xd8fe('0x68'),_0xd8fe('0x88'),'short_description','close_code','correlation_display',_0xd8fe('0x89'),'work_start',_0xd8fe('0x8a'),_0xd8fe('0x8b'),'additional_assignee_list',_0xd8fe('0x8c'),_0xd8fe('0x8d'),_0xd8fe('0x6a'),_0xd8fe('0x8e'),_0xd8fe('0x8f'),_0xd8fe('0x90'),'follow_up',_0xd8fe('0x91'),_0xd8fe('0x92'),_0xd8fe('0x93'),_0xd8fe('0x94'),_0xd8fe('0x6b'),_0xd8fe('0x95'),_0xd8fe('0x96'),_0xd8fe('0x97'),_0xd8fe('0x98'),_0xd8fe('0x99'),_0xd8fe('0x9a'),_0xd8fe('0x6c'),'comments',_0xd8fe('0x9b'),'approval','comments_and_work_notes',_0xd8fe('0x9c'),'sys_mod_count',_0xd8fe('0x9d'),_0xd8fe('0x9e'),_0xd8fe('0x9f'),_0xd8fe('0xa0'),_0xd8fe('0xa1'),_0xd8fe('0xa2'),_0xd8fe('0xa3')];var _0x3ff528='';var _0x335c69='';var _0x289ee4=[];var _0x1f0232='';var _0x1465cb='';var _0x580aec=[];var _0xcc3954='';var _0x10c8fb='';var _0x11fd9e={};var _0x139ca1='';return db[_0xd8fe('0x3e')][_0xd8fe('0x5b')]({'where':{'id':_0x583888[_0xd8fe('0x54')]['id']},'attributes':['id',_0xd8fe('0xa4'),_0xd8fe('0xa5'),'email',_0xd8fe('0xa6'),_0xd8fe('0xa7')]})['then'](handleEntityNotFound(_0x2c8a1e,null))[_0xd8fe('0x23')](function(_0x40dd47){if(_0x40dd47){_0x139ca1=_0x40dd47['remoteUri'];var _0x133154=_0x139ca1['slice'](-0x1);if(_0x133154==='/'){_0x139ca1=_0x139ca1['substring'](0x0,_0x139ca1[_0xd8fe('0xa8')](_0x133154));}_0x10c8fb=util[_0xd8fe('0xa9')](_0xd8fe('0xaa'),_0x139ca1);_0xcc3954=util[_0xd8fe('0xa9')](_0xd8fe('0xab'),_0x139ca1);_0x11fd9e={'user':_0x40dd47[_0xd8fe('0xa4')],'pass':_0x40dd47[_0xd8fe('0xa5')]};var _0x2fb9f9={'method':_0xd8fe('0xac'),'uri':_0x10c8fb+'incident?sysparm_display_value=all','auth':_0x11fd9e,'json':!![]};return rp(_0x2fb9f9);}})[_0xd8fe('0x23')](function(_0xb46b05){if(_0xb46b05[_0xd8fe('0x2b')]['length']>0x0){_0x3ff528=_0xb46b05[_0xd8fe('0x2b')];}console['log'](_0xd8fe('0xad'),_0x3ff528);_0x580aec=[];_0x335c69=Object[_0xd8fe('0xae')]([],_0x3ff528);_[_0xd8fe('0xaf')](_0x335c69,function(_0xf74e51){return!_0x3c9593['includes'](_0xf74e51[_0xd8fe('0x3a')]);});_0x335c69[_0xd8fe('0xb0')](function(_0x5699e6){var _0x227c49=createFieldObject(_0xcc3954,_0x11fd9e,_0x5699e6[_0xd8fe('0xb1')],_0x5699e6['name'],_0x5699e6['label'],![]);_0x580aec[_0xd8fe('0xb2')](_0x227c49);});return Promise[_0xd8fe('0xb3')](_0x580aec);})[_0xd8fe('0x23')](function(_0x52c0f2){_0x289ee4=_0x52c0f2;_0x1f0232=Object[_0xd8fe('0xae')]([],_0x3ff528);console['log'](_0xd8fe('0xb4'),_0x3ff528);_[_0xd8fe('0xaf')](_0x1f0232,function(_0x263a08){return _0x4db783[_0xd8fe('0xb5')](_0x263a08[_0xd8fe('0x3a')]);});console['log'](_0xd8fe('0xb6'),_0x1f0232);_0x580aec=[];_0x1f0232[_0xd8fe('0xb0')](function(_0x67b402){var _0x2fc698=createFieldObject(_0xcc3954,_0x11fd9e,_0x67b402[_0xd8fe('0xb1')],_0x67b402['name'],_0x67b402[_0xd8fe('0xb7')],!![]);_0x580aec['push'](_0x2fc698);});return Promise['all'](_0x580aec);})[_0xd8fe('0x23')](function(_0x1d90b2){_0x1465cb=_0x1d90b2;var _0x2b74b9=_0x289ee4[_0xd8fe('0xb8')](_0x1465cb);return{'count':_0x2b74b9[_0xd8fe('0x46')],'rows':_0x2b74b9};})[_0xd8fe('0x23')](respondWithResult(_0x2c8a1e,null))['catch'](function(_0x4263d5){console['log'](_0xd8fe('0xb9')+_0x4263d5);var _0x3e65cf=_0x583888[_0xd8fe('0x43')]['test']?0x1f4:_0x4263d5[_0xd8fe('0xba')]||0x1f4;logger[_0xd8fe('0x27')](_0x4263d5['stack']);delete _0x4263d5[_0xd8fe('0x3a')];if(_0x3e65cf===0x191){_0x3e65cf=0x190;}_0x2c8a1e['status'](_0x3e65cf)[_0xd8fe('0x3b')](_0x583888[_0xd8fe('0x43')][_0xd8fe('0x1e')]?{'message':'Wrong\x20credentials','statusCode':_0x4263d5['statusCode']}:_0x4263d5);});};function createFieldObject(_0x5aef39,_0x2c7acc,_0x198820,_0x370cf8,_0x108349,_0x5e33d8){return new Promise(function(_0x1a29ff,_0x3e34a4){var _0x45e682={'id':_0x370cf8,'name':_0x108349,'custom':_0x5e33d8};if(_0x198820===_0xd8fe('0xbb')){_0x45e682['options']=[{'name':_0xd8fe('0xbc'),'value':_0xd8fe('0xbd')},{'name':'False','value':_0xd8fe('0xbe')}];_0x1a29ff(_0x45e682);}else{var _0xf18cca={'method':'GET','uri':_0x5aef39+'sys_choice?sysparm_query=name=incident^element='+_0x370cf8,'auth':_0x2c7acc,'json':!![]};return rp(_0xf18cca)[_0xd8fe('0x23')](function(_0x1f659e){var _0x5d790c=[];if(_0x1f659e[_0xd8fe('0x2b')][_0xd8fe('0x46')]>0x0){_0x1f659e[_0xd8fe('0x2b')]['forEach'](function(_0x4cdb2f){if(_0x4cdb2f[_0xd8fe('0xbf')]===_0xd8fe('0xbe')){var _0x45f7bd={'name':_0x4cdb2f[_0xd8fe('0xb7')],'value':_0x4cdb2f['value']};_0x5d790c[_0xd8fe('0xb2')](_0x45f7bd);}});}_0x45e682[_0xd8fe('0x4f')]=_0x5d790c;if(_0x45e682[_0xd8fe('0x4f')]['length']>0x0){_0x1a29ff(_0x45e682);}else{if(_0x5e33d8==![]){_0x1a29ff();}else{_0x1a29ff(_0x45e682);}}});}});} \ No newline at end of file +var _0x4304=['sys_id','contact_type','urgency','problem_id','reassignment_count','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','password','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','Wrong\x20credentials','statusCode','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','lodash','squel','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','reject','save','update','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','length','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','close_code','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','notify','sys_class_name','follow_up'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x4304,0xee));var _0x4430=function(_0x21f425,_0x2482b5){_0x21f425=_0x21f425-0x0;var _0x2f44f2=_0x4304[_0x21f425];return _0x2f44f2;};'use strict';var pdf=require(_0x4430('0x0'));var emlformat=require(_0x4430('0x1'));var rimraf=require(_0x4430('0x2'));var zipdir=require(_0x4430('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4430('0x4'));var moment=require(_0x4430('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4430('0x6'));var path=require(_0x4430('0x7'));var sox=require(_0x4430('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4430('0x9'));var squel=require(_0x4430('0xa'));var crypto=require('crypto');var jsforce=require(_0x4430('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4430('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4430('0xd'));var hardwareService=require(_0x4430('0xe'));var logger=require(_0x4430('0xf'))('api');var utils=require(_0x4430('0x10'));var config=require(_0x4430('0x11'));var db=require(_0x4430('0x12'))['db'];var integrations=require(_0x4430('0x13'));var jayson=require(_0x4430('0x14'));var client=jayson[_0x4430('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0xb48295,_0x1b8803,_0x25667e){if(_0x25667e){var _0x2a5e32=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a5e32[_0x4430('0x16')](_0x1b8803)){return _0xb48295;}else{throw new db[(_0x4430('0x17'))][(_0x4430('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xb48295;}}function respondWithRpcPromise(_0x50493a,_0x21eb12,_0x31e4ce,_0x1e4842){return new BPromise(function(_0x144f9d,_0x473b0c){var _0x124f0a=_0x1e4842||client;return _0x124f0a[_0x4430('0x19')](_0x50493a,_0x31e4ce)[_0x4430('0x1a')](function(_0x2517cd){logger[_0x4430('0x1b')](_0x4430('0x1c'),_0x21eb12,_0x4430('0x1d'));logger['debug'](_0x4430('0x1e'),_0x21eb12,_0x4430('0x1d'),JSON[_0x4430('0x1f')](_0x2517cd));if(_0x2517cd[_0x4430('0x20')]){if(_0x2517cd['error'][_0x4430('0x21')]===0x1f4){logger[_0x4430('0x20')](_0x4430('0x1c'),_0x21eb12,_0x2517cd['error'][_0x4430('0x22')]);return _0x473b0c(_0x2517cd[_0x4430('0x20')][_0x4430('0x22')]);}logger[_0x4430('0x20')](_0x4430('0x1c'),_0x21eb12,_0x2517cd[_0x4430('0x20')]['message']);return _0x144f9d(_0x2517cd[_0x4430('0x20')][_0x4430('0x22')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x21eb12,_0x4430('0x1d'));_0x144f9d(_0x2517cd[_0x4430('0x23')][_0x4430('0x22')]);}})[_0x4430('0x24')](function(_0x21a248){logger[_0x4430('0x20')](_0x4430('0x1c'),_0x21eb12,_0x21a248);_0x473b0c(_0x21a248);});});}function respondWithStatusCode(_0x4e3be5,_0x1b014c){_0x1b014c=_0x1b014c||0xcc;return function(_0x331886){if(_0x331886){return _0x4e3be5[_0x4430('0x25')](_0x1b014c);}return _0x4e3be5[_0x4430('0x26')](_0x1b014c)[_0x4430('0x27')]();};}function respondWithResult(_0x419812,_0x24453a){_0x24453a=_0x24453a||0xc8;return function(_0x3ca27a){if(_0x3ca27a){return _0x419812[_0x4430('0x26')](_0x24453a)[_0x4430('0x28')](_0x3ca27a);}};}function respondWithFilteredResult(_0x181aeb,_0x5e3d37){return function(_0x1827b1){if(_0x1827b1){var _0x289721=_0x1827b1[_0x4430('0x29')],_0xaa47e5=_0x5e3d37['offset'],_0x19a5cd=_0x5e3d37[_0x4430('0x2a')]+_0x5e3d37['limit'],_0x5cf39c;if(_0x19a5cd>=_0x289721){_0x19a5cd=_0x289721;_0x5cf39c=0xc8;}else{_0x5cf39c=0xce;}_0x181aeb[_0x4430('0x26')](_0x5cf39c);return _0x181aeb['set']('Content-Range',_0xaa47e5+'-'+_0x19a5cd+'/'+_0x289721)['json'](_0x1827b1);}return null;};}function patchUpdates(_0x2e8bb5){return function(_0x3acef2){try{jsonpatch['apply'](_0x3acef2,_0x2e8bb5,!![]);}catch(_0x48dbb6){return BPromise[_0x4430('0x2b')](_0x48dbb6);}return _0x3acef2[_0x4430('0x2c')]();};}function saveUpdates(_0x4c535e,_0x4856b9){return function(_0xd45150){if(_0xd45150){return _0xd45150[_0x4430('0x2d')](_0x4c535e)[_0x4430('0x1a')](function(_0x443cf0){return _0x443cf0;});}return null;};}function removeEntity(_0x36e408,_0x56cd04){return function(_0x26ea34){if(_0x26ea34){return _0x26ea34[_0x4430('0x2e')]()[_0x4430('0x1a')](function(){_0x36e408[_0x4430('0x26')](0xcc)[_0x4430('0x27')]();});}};}function handleEntityNotFound(_0x18dd24,_0x1274d2){return function(_0x1e5be1){if(!_0x1e5be1){_0x18dd24[_0x4430('0x25')](0x194);}return _0x1e5be1;};}function handleError(_0x239147,_0x329884){_0x329884=_0x329884||0x1f4;return function(_0x31491c){logger[_0x4430('0x20')](_0x31491c[_0x4430('0x2f')]);if(_0x31491c['name']){delete _0x31491c[_0x4430('0x30')];}_0x239147[_0x4430('0x26')](_0x329884)[_0x4430('0x31')](_0x31491c);};}exports[_0x4430('0x32')]=function(_0x5a5ec6,_0x5dbd33){var _0x289d86={},_0x25d0c7={},_0x33284e={'count':0x0,'rows':[]};var _0x9cb56e=_[_0x4430('0x33')](db[_0x4430('0x34')][_0x4430('0x35')],function(_0x1c7e95){return{'name':_0x1c7e95['fieldName'],'type':_0x1c7e95[_0x4430('0x36')]['key']};});_0x25d0c7[_0x4430('0x37')]=_['map'](_0x9cb56e,_0x4430('0x30'));_0x25d0c7[_0x4430('0x38')]=_[_0x4430('0x39')](_0x5a5ec6[_0x4430('0x38')]);_0x25d0c7['filters']=_['intersection'](_0x25d0c7[_0x4430('0x37')],_0x25d0c7[_0x4430('0x38')]);_0x289d86['attributes']=_[_0x4430('0x3a')](_0x25d0c7[_0x4430('0x37')],qs[_0x4430('0x3b')](_0x5a5ec6['query'][_0x4430('0x3b')]));_0x289d86['attributes']=_0x289d86[_0x4430('0x3c')]['length']?_0x289d86[_0x4430('0x3c')]:_0x25d0c7[_0x4430('0x37')];if(!_0x5a5ec6[_0x4430('0x38')][_0x4430('0x3d')](_0x4430('0x3e'))){_0x289d86[_0x4430('0x3f')]=qs[_0x4430('0x3f')](_0x5a5ec6['query']['limit']);_0x289d86['offset']=qs[_0x4430('0x2a')](_0x5a5ec6[_0x4430('0x38')][_0x4430('0x2a')]);}_0x289d86[_0x4430('0x40')]=qs[_0x4430('0x41')](_0x5a5ec6[_0x4430('0x38')][_0x4430('0x41')]);_0x289d86[_0x4430('0x42')]=qs[_0x4430('0x43')](_[_0x4430('0x44')](_0x5a5ec6[_0x4430('0x38')],_0x25d0c7[_0x4430('0x43')]),_0x9cb56e);if(_0x5a5ec6[_0x4430('0x38')][_0x4430('0x45')]){_0x289d86[_0x4430('0x42')]=_['merge'](_0x289d86[_0x4430('0x42')],{'$or':_[_0x4430('0x33')](_0x9cb56e,function(_0x1a84db){if(_0x1a84db[_0x4430('0x36')]!==_0x4430('0x46')){var _0x58e369={};_0x58e369[_0x1a84db[_0x4430('0x30')]]={'$like':'%'+_0x5a5ec6[_0x4430('0x38')]['filter']+'%'};return _0x58e369;}})});}_0x289d86=_[_0x4430('0x47')]({},_0x289d86,_0x5a5ec6[_0x4430('0x48')]);var _0x2e2bea={'where':_0x289d86[_0x4430('0x42')]};return db[_0x4430('0x34')][_0x4430('0x29')](_0x2e2bea)['then'](function(_0x12df81){_0x33284e[_0x4430('0x29')]=_0x12df81;if(_0x5a5ec6['query']['includeAll']){_0x289d86[_0x4430('0x49')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x4430('0x4a')](_0x289d86);})[_0x4430('0x1a')](function(_0x1bcc2c){_0x33284e[_0x4430('0x4b')]=_0x1bcc2c;return _0x33284e;})[_0x4430('0x1a')](respondWithFilteredResult(_0x5dbd33,_0x289d86))[_0x4430('0x24')](handleError(_0x5dbd33,null));};exports[_0x4430('0x4c')]=function(_0x4de57e,_0x294df9){var _0x45079b={'raw':![],'where':{'id':_0x4de57e[_0x4430('0x4d')]['id']}},_0x1adb9d={};_0x1adb9d[_0x4430('0x37')]=_[_0x4430('0x39')](db[_0x4430('0x34')][_0x4430('0x35')]);_0x1adb9d[_0x4430('0x38')]=_[_0x4430('0x39')](_0x4de57e['query']);_0x1adb9d['filters']=_[_0x4430('0x3a')](_0x1adb9d['model'],_0x1adb9d[_0x4430('0x38')]);_0x45079b['attributes']=_['intersection'](_0x1adb9d['model'],qs[_0x4430('0x3b')](_0x4de57e[_0x4430('0x38')]['fields']));_0x45079b[_0x4430('0x3c')]=_0x45079b['attributes'][_0x4430('0x4e')]?_0x45079b['attributes']:_0x1adb9d[_0x4430('0x37')];if(_0x4de57e[_0x4430('0x38')][_0x4430('0x4f')]){_0x45079b[_0x4430('0x49')]=[{'all':!![]}];}_0x45079b=_[_0x4430('0x47')]({},_0x45079b,_0x4de57e['options']);return db[_0x4430('0x34')][_0x4430('0x50')](_0x45079b)[_0x4430('0x1a')](handleEntityNotFound(_0x294df9,null))[_0x4430('0x1a')](respondWithResult(_0x294df9,null))[_0x4430('0x24')](handleError(_0x294df9,null));};exports[_0x4430('0x51')]=function(_0x4e9c26,_0x3e2341){return db['ServicenowAccount']['create'](_0x4e9c26[_0x4430('0x52')],{})['then'](respondWithResult(_0x3e2341,0xc9))[_0x4430('0x24')](handleError(_0x3e2341,null));};exports['update']=function(_0x427115,_0x1bcc00){if(_0x427115[_0x4430('0x52')]['id']){delete _0x427115['body']['id'];}return db[_0x4430('0x34')][_0x4430('0x50')]({'where':{'id':_0x427115['params']['id']}})[_0x4430('0x1a')](handleEntityNotFound(_0x1bcc00,null))['then'](saveUpdates(_0x427115[_0x4430('0x52')],null))[_0x4430('0x1a')](respondWithResult(_0x1bcc00,null))[_0x4430('0x24')](handleError(_0x1bcc00,null));};exports[_0x4430('0x2e')]=function(_0x428632,_0x41610f){return db[_0x4430('0x34')]['find']({'where':{'id':_0x428632[_0x4430('0x4d')]['id']}})[_0x4430('0x1a')](handleEntityNotFound(_0x41610f,null))[_0x4430('0x1a')](removeEntity(_0x41610f,null))[_0x4430('0x24')](handleError(_0x41610f,null));};exports[_0x4430('0x53')]=function(_0x10886c,_0x467528,_0x1f4007){var _0x59c5c8={};var _0x280458={};var _0x352567;var _0x5f1a26;return db[_0x4430('0x34')][_0x4430('0x54')]({'where':{'id':_0x10886c[_0x4430('0x4d')]['id']}})['then'](handleEntityNotFound(_0x467528,null))[_0x4430('0x1a')](function(_0x15b909){if(_0x15b909){_0x352567=_0x15b909;_0x280458[_0x4430('0x37')]=_[_0x4430('0x39')](db['ServicenowConfiguration']['rawAttributes']);_0x280458[_0x4430('0x38')]=_[_0x4430('0x39')](_0x10886c['query']);_0x280458[_0x4430('0x43')]=_[_0x4430('0x3a')](_0x280458[_0x4430('0x37')],_0x280458[_0x4430('0x38')]);_0x59c5c8[_0x4430('0x3c')]=_[_0x4430('0x3a')](_0x280458['model'],qs[_0x4430('0x3b')](_0x10886c['query']['fields']));_0x59c5c8['attributes']=_0x59c5c8[_0x4430('0x3c')][_0x4430('0x4e')]?_0x59c5c8[_0x4430('0x3c')]:_0x280458[_0x4430('0x37')];_0x59c5c8[_0x4430('0x40')]=qs[_0x4430('0x41')](_0x10886c[_0x4430('0x38')]['sort']);_0x59c5c8['where']=qs[_0x4430('0x43')](_[_0x4430('0x44')](_0x10886c[_0x4430('0x38')],_0x280458[_0x4430('0x43')]));if(_0x10886c[_0x4430('0x38')][_0x4430('0x45')]){_0x59c5c8[_0x4430('0x42')]=_[_0x4430('0x47')](_0x59c5c8[_0x4430('0x42')],{'$or':_['map'](_0x59c5c8[_0x4430('0x3c')],function(_0x3544a3){var _0x591d65={};_0x591d65[_0x3544a3]={'$like':'%'+_0x10886c[_0x4430('0x38')]['filter']+'%'};return _0x591d65;})});}_0x59c5c8=_[_0x4430('0x47')]({},_0x59c5c8,_0x10886c[_0x4430('0x48')]);return _0x352567[_0x4430('0x53')](_0x59c5c8);}})[_0x4430('0x1a')](function(_0x4f2f15){if(_0x4f2f15){_0x5f1a26=_0x4f2f15[_0x4430('0x4e')];if(!_0x10886c[_0x4430('0x38')]['hasOwnProperty']('nolimit')){_0x59c5c8[_0x4430('0x3f')]=qs[_0x4430('0x3f')](_0x10886c[_0x4430('0x38')][_0x4430('0x3f')]);_0x59c5c8[_0x4430('0x2a')]=qs['offset'](_0x10886c[_0x4430('0x38')][_0x4430('0x2a')]);}return _0x352567[_0x4430('0x53')](_0x59c5c8);}})[_0x4430('0x1a')](function(_0x3e9076){if(_0x3e9076){return _0x3e9076?{'count':_0x5f1a26,'rows':_0x3e9076}:null;}})[_0x4430('0x1a')](respondWithResult(_0x467528,null))[_0x4430('0x24')](handleError(_0x467528,null));};exports[_0x4430('0x55')]=function(_0x3d74f7,_0x23c5a9,_0x586cfe){if(_0x3d74f7[_0x4430('0x52')]['id']){delete _0x3d74f7[_0x4430('0x52')]['id'];}return db[_0x4430('0x34')][_0x4430('0x54')]({'where':{'id':_0x3d74f7[_0x4430('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23c5a9,null))['then'](function(_0x111bef){if(_0x111bef){_0x3d74f7[_0x4430('0x52')][_0x4430('0x56')]=_0x111bef['id'];_0x3d74f7['body'][_0x4430('0x57')]=integrations[_0x4430('0x58')](_0x3d74f7[_0x4430('0x52')][_0x4430('0x59')],_0x3d74f7[_0x4430('0x52')]['type']);_0x3d74f7[_0x4430('0x52')][_0x4430('0x5a')]=integrations['getDescriptions'](_0x3d74f7[_0x4430('0x52')][_0x4430('0x59')],_0x3d74f7[_0x4430('0x52')][_0x4430('0x36')]);return db[_0x4430('0x5b')]['create'](_0x3d74f7['body'],{'include':[{'model':db[_0x4430('0x5c')],'as':_0x4430('0x57')},{'model':db[_0x4430('0x5c')],'as':_0x4430('0x5a')}]});}return null;})[_0x4430('0x1a')](respondWithResult(_0x23c5a9,null))[_0x4430('0x24')](handleError(_0x23c5a9,null));};exports[_0x4430('0x5d')]=function(_0x3a9ccf,_0x2c6779,_0x5b351f){var _0xeb7b0a=['made_sla',_0x4430('0x5e'),_0x4430('0x5f'),'subcategory',_0x4430('0x60'),'notify',_0x4430('0x61'),_0x4430('0x62'),_0x4430('0x63')];var _0x2a65ea=[_0x4430('0x64'),_0x4430('0x65'),_0x4430('0x66'),_0x4430('0x67'),_0x4430('0x68'),_0x4430('0x69'),_0x4430('0x6a'),'hold_reason',_0x4430('0x6b'),_0x4430('0x6c'),'resolved_by',_0x4430('0x6d'),'opened_by',_0x4430('0x6e'),_0x4430('0x6f'),_0x4430('0x70'),_0x4430('0x71'),_0x4430('0x72'),_0x4430('0x5f'),_0x4430('0x40'),'calendar_stc',_0x4430('0x73'),_0x4430('0x74'),_0x4430('0x75'),_0x4430('0x76'),_0x4430('0x77'),_0x4430('0x78'),_0x4430('0x79'),_0x4430('0x7a'),_0x4430('0x7b'),'rfc',_0x4430('0x7c'),_0x4430('0x7d'),_0x4430('0x7e'),_0x4430('0x7f'),_0x4430('0x80'),_0x4430('0x81'),'reopened_time',_0x4430('0x82'),'caller_id',_0x4430('0x83'),_0x4430('0x84'),_0x4430('0x85'),_0x4430('0x86'),_0x4430('0x60'),_0x4430('0x87'),_0x4430('0x88'),_0x4430('0x89'),_0x4430('0x8a'),'business_stc','additional_assignee_list',_0x4430('0x8b'),_0x4430('0x8c'),_0x4430('0x8d'),_0x4430('0x8e'),'close_notes','closed_by',_0x4430('0x8f'),'parent_incident',_0x4430('0x90'),_0x4430('0x91'),'reopened_by','incident_state',_0x4430('0x92'),_0x4430('0x93'),'company',_0x4430('0x94'),'activity_due','assigned_to','severity',_0x4430('0x95'),_0x4430('0x96'),'approval',_0x4430('0x97'),_0x4430('0x98'),_0x4430('0x99'),_0x4430('0x9a'),_0x4430('0x9b'),_0x4430('0x9c'),'upon_approval','correlation_id',_0x4430('0x9d'),_0x4430('0x63')];var _0x41cef5='';var _0x153399='';var _0x47f750=[];var _0x275792='';var _0x4d09db='';var _0x390b6d=[];var _0xbad35f='';var _0x21b09d='';var _0x374520={};var _0x4dcc65='';return db[_0x4430('0x34')]['findOne']({'where':{'id':_0x3a9ccf[_0x4430('0x4d')]['id']},'attributes':['id',_0x4430('0x9e'),'password',_0x4430('0x9f'),_0x4430('0xa0'),_0x4430('0xa1')]})[_0x4430('0x1a')](handleEntityNotFound(_0x2c6779,null))[_0x4430('0x1a')](function(_0x517ce9){if(_0x517ce9){_0x4dcc65=_0x517ce9[_0x4430('0xa0')];var _0x59cfcc=_0x4dcc65[_0x4430('0xa2')](-0x1);if(_0x59cfcc==='/'){_0x4dcc65=_0x4dcc65[_0x4430('0xa3')](0x0,_0x4dcc65[_0x4430('0xa4')](_0x59cfcc));}_0x21b09d=util[_0x4430('0xa5')]('%s/api/now/doc/table/schema/',_0x4dcc65);_0xbad35f=util['format']('%s/api/now/table/',_0x4dcc65);_0x374520={'user':_0x517ce9[_0x4430('0x9e')],'pass':_0x517ce9[_0x4430('0xa6')]};var _0x4a203c={'method':_0x4430('0xa7'),'uri':_0x21b09d+_0x4430('0xa8'),'auth':_0x374520,'json':!![]};return rp(_0x4a203c);}})[_0x4430('0x1a')](function(_0x28276f){if(_0x28276f[_0x4430('0x23')]['length']>0x0){_0x41cef5=_0x28276f[_0x4430('0x23')];}console[_0x4430('0xa9')](_0x4430('0xaa'),_0x41cef5);_0x390b6d=[];_0x153399=Object[_0x4430('0xab')]([],_0x41cef5);_['remove'](_0x153399,function(_0xcc557){return!_0xeb7b0a['includes'](_0xcc557[_0x4430('0x30')]);});_0x153399[_0x4430('0xac')](function(_0x2cbed9){var _0x1a5b41=createFieldObject(_0xbad35f,_0x374520,_0x2cbed9[_0x4430('0xad')],_0x2cbed9[_0x4430('0x30')],_0x2cbed9[_0x4430('0xae')],![]);_0x390b6d[_0x4430('0xaf')](_0x1a5b41);});return Promise[_0x4430('0xb0')](_0x390b6d);})['then'](function(_0x5a62c1){_0x47f750=_0x5a62c1;_0x275792=Object['assign']([],_0x41cef5);console[_0x4430('0xa9')](_0x4430('0xb1'),_0x41cef5);_['remove'](_0x275792,function(_0x1385c8){return _0x2a65ea[_0x4430('0xb2')](_0x1385c8[_0x4430('0x30')]);});console[_0x4430('0xa9')](_0x4430('0xb3'),_0x275792);_0x390b6d=[];_0x275792[_0x4430('0xac')](function(_0x51b870){var _0x376390=createFieldObject(_0xbad35f,_0x374520,_0x51b870[_0x4430('0xad')],_0x51b870[_0x4430('0x30')],_0x51b870[_0x4430('0xae')],!![]);_0x390b6d['push'](_0x376390);});return Promise[_0x4430('0xb0')](_0x390b6d);})[_0x4430('0x1a')](function(_0x548844){_0x4d09db=_0x548844;var _0x36e28b=_0x47f750[_0x4430('0xb4')](_0x4d09db);return{'count':_0x36e28b[_0x4430('0x4e')],'rows':_0x36e28b};})[_0x4430('0x1a')](respondWithResult(_0x2c6779,null))[_0x4430('0x24')](function(_0x10da00){console[_0x4430('0xa9')]('ServiceNow\x20error:\x20'+_0x10da00);var _0x5c8031=_0x3a9ccf[_0x4430('0x38')][_0x4430('0x16')]?0x1f4:_0x10da00['statusCode']||0x1f4;logger[_0x4430('0x20')](_0x10da00[_0x4430('0x2f')]);delete _0x10da00[_0x4430('0x30')];if(_0x5c8031===0x191){_0x5c8031=0x190;}_0x2c6779[_0x4430('0x26')](_0x5c8031)[_0x4430('0x31')](_0x3a9ccf['query'][_0x4430('0x16')]?{'message':_0x4430('0xb5'),'statusCode':_0x10da00[_0x4430('0xb6')]}:_0x10da00);});};function createFieldObject(_0x1bf1ba,_0x313f93,_0x29e35d,_0xd486f3,_0x5393ba,_0x10c966){return new Promise(function(_0x3a9b44,_0x45584d){var _0x1f153d={'id':_0xd486f3,'name':_0x5393ba,'custom':_0x10c966};if(_0x29e35d===_0x4430('0xb7')){_0x1f153d[_0x4430('0x48')]=[{'name':_0x4430('0xb8'),'value':_0x4430('0xb9')},{'name':_0x4430('0xba'),'value':'false'}];_0x3a9b44(_0x1f153d);}else{var _0x70c07d={'method':_0x4430('0xa7'),'uri':_0x1bf1ba+_0x4430('0xbb')+_0xd486f3,'auth':_0x313f93,'json':!![]};return rp(_0x70c07d)[_0x4430('0x1a')](function(_0x2ffcf9){var _0x2b0709=[];if(_0x2ffcf9[_0x4430('0x23')][_0x4430('0x4e')]>0x0){_0x2ffcf9[_0x4430('0x23')]['forEach'](function(_0x18dcef){if(_0x18dcef[_0x4430('0xbc')]===_0x4430('0xbd')){var _0x403b0e={'name':_0x18dcef[_0x4430('0xae')],'value':_0x18dcef[_0x4430('0xbe')]};_0x2b0709[_0x4430('0xaf')](_0x403b0e);}});}_0x1f153d[_0x4430('0x48')]=_0x2b0709;if(_0x1f153d[_0x4430('0x48')]['length']>0x0){_0x3a9b44(_0x1f153d);}else{if(_0x10c966==![]){_0x3a9b44();}else{_0x3a9b44(_0x1f153d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f870d9b..a8e9917 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 _0x3334=['../../components/integrations/configuration','exports','define','ServicenowAccount','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x3334,0x13f));var _0x4333=function(_0x15fca1,_0x1e029c){_0x15fca1=_0x15fca1-0x0;var _0x576671=_0x3334[_0x15fca1];return _0x576671;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4333('0x0'))('api');var moment=require(_0x4333('0x1'));var BPromise=require('bluebird');var rp=require(_0x4333('0x2'));var fs=require('fs');var path=require(_0x4333('0x3'));var rimraf=require(_0x4333('0x4'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x4333('0x5'));module[_0x4333('0x6')]=function(_0xa15b8e,_0x38ee04){return _0xa15b8e[_0x4333('0x7')](_0x4333('0x8'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e0d=['../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x1fb6e2,_0xae8005){var _0x3c9cd9=function(_0x63b140){while(--_0x63b140){_0x1fb6e2['push'](_0x1fb6e2['shift']());}};_0x3c9cd9(++_0xae8005);}(_0x0e0d,0x1c5));var _0xd0e0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0e0d[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xd0e0('0x0'));var logger=require(_0xd0e0('0x1'))(_0xd0e0('0x2'));var moment=require(_0xd0e0('0x3'));var BPromise=require(_0xd0e0('0x4'));var rp=require(_0xd0e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0e0('0x6'));var config=require(_0xd0e0('0x7'));var attributes=require(_0xd0e0('0x8'));var integrations=require(_0xd0e0('0x9'));module[_0xd0e0('0xa')]=function(_0x15ccec,_0x109252){return _0x15ccec[_0xd0e0('0xb')](_0xd0e0('0xc'),attributes,{'tableName':_0xd0e0('0xd'),'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 7553f66..4f58a07 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 _0xb5b9=['debug','lodash','util','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','include','map','model','attributes','ShowServicenowAccount','find','then'];(function(_0x3f3bab,_0x2e7209){var _0xe6eba2=function(_0x1f5159){while(--_0x1f5159){_0x3f3bab['push'](_0x3f3bab['shift']());}};_0xe6eba2(++_0x2e7209);}(_0xb5b9,0x161));var _0x9b5b=function(_0x50fb7e,_0x326078){_0x50fb7e=_0x50fb7e-0x0;var _0x36a602=_0xb5b9[_0x50fb7e];return _0x36a602;};'use strict';var _=require(_0x9b5b('0x0'));var util=require(_0x9b5b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b5b('0x2'));var db=require(_0x9b5b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9b5b('0x4'));var config=require(_0x9b5b('0x5'));var jayson=require(_0x9b5b('0x6'));var client=jayson[_0x9b5b('0x7')][_0x9b5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c4051,_0x5bc9a8,_0x5584d1){return new BPromise(function(_0x1b9757,_0x3a3360){return client[_0x9b5b('0x9')](_0x2c4051,_0x5584d1)['then'](function(_0x3292c8){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x5bc9a8,_0x9b5b('0xa'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5bc9a8,_0x9b5b('0xa'),JSON[_0x9b5b('0xb')](_0x3292c8));if(_0x3292c8[_0x9b5b('0xc')]){if(_0x3292c8[_0x9b5b('0xc')]['code']===0x1f4){logger[_0x9b5b('0xc')](_0x9b5b('0xd'),_0x5bc9a8,_0x3292c8[_0x9b5b('0xc')]['message']);return _0x3a3360(_0x3292c8[_0x9b5b('0xc')][_0x9b5b('0xe')]);}logger[_0x9b5b('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x5bc9a8,_0x3292c8[_0x9b5b('0xc')]['message']);return _0x1b9757(_0x3292c8[_0x9b5b('0xc')][_0x9b5b('0xe')]);}else{logger[_0x9b5b('0xf')](_0x9b5b('0xd'),_0x5bc9a8,_0x9b5b('0xa'));_0x1b9757(_0x3292c8[_0x9b5b('0x10')][_0x9b5b('0xe')]);}})[_0x9b5b('0x11')](function(_0x280146){logger[_0x9b5b('0xc')](_0x9b5b('0xd'),_0x5bc9a8,_0x280146);_0x3a3360(_0x280146);});});}exports[_0x9b5b('0x12')]=function(_0x16d659){var _0x391027=this;return new Promise(function(_0x1fd1ba,_0x28446c){return db[_0x9b5b('0x13')][_0x9b5b('0x14')]({'raw':_0x16d659[_0x9b5b('0x15')]?_0x16d659[_0x9b5b('0x15')][_0x9b5b('0x16')]===undefined?!![]:![]:!![],'where':_0x16d659[_0x9b5b('0x15')]?_0x16d659[_0x9b5b('0x15')][_0x9b5b('0x17')]||null:null,'attributes':_0x16d659['options']?_0x16d659[_0x9b5b('0x15')]['attributes']||null:null,'limit':_0x16d659[_0x9b5b('0x15')]?_0x16d659[_0x9b5b('0x15')]['limit']||null:null,'include':_0x16d659[_0x9b5b('0x15')]?_0x16d659[_0x9b5b('0x15')][_0x9b5b('0x18')]?_[_0x9b5b('0x19')](_0x16d659[_0x9b5b('0x15')][_0x9b5b('0x18')],function(_0xc39796){return{'model':db[_0xc39796[_0x9b5b('0x1a')]],'as':_0xc39796['as'],'attributes':_0xc39796[_0x9b5b('0x1b')],'include':_0xc39796[_0x9b5b('0x18')]?_[_0x9b5b('0x19')](_0xc39796[_0x9b5b('0x18')],function(_0x3dbb84){return{'model':db[_0x3dbb84[_0x9b5b('0x1a')]],'as':_0x3dbb84['as'],'attributes':_0x3dbb84[_0x9b5b('0x1b')],'include':_0x3dbb84[_0x9b5b('0x18')]?_['map'](_0x3dbb84[_0x9b5b('0x18')],function(_0x5ba986){return{'model':db[_0x5ba986[_0x9b5b('0x1a')]],'as':_0x5ba986['as'],'attributes':_0x5ba986['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x412cdb){logger[_0x9b5b('0xf')]('GetServicenowAccount',_0x16d659);logger['debug'](_0x9b5b('0x12'),_0x16d659,JSON[_0x9b5b('0xb')](_0x412cdb));_0x1fd1ba(_0x412cdb);})[_0x9b5b('0x11')](function(_0x3f733e){logger[_0x9b5b('0xc')](_0x9b5b('0x12'),_0x3f733e[_0x9b5b('0xe')],_0x16d659);_0x28446c(_0x391027[_0x9b5b('0xc')](0x1f4,_0x3f733e[_0x9b5b('0xe')]));});});};exports[_0x9b5b('0x1c')]=function(_0x5b8a19){var _0x444020=this;return new Promise(function(_0x4614cd,_0x5814af){return db[_0x9b5b('0x13')][_0x9b5b('0x1d')]({'raw':_0x5b8a19['options']?_0x5b8a19['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b8a19[_0x9b5b('0x15')]?_0x5b8a19[_0x9b5b('0x15')][_0x9b5b('0x17')]||null:null,'attributes':_0x5b8a19['options']?_0x5b8a19['options'][_0x9b5b('0x1b')]||null:null,'include':_0x5b8a19[_0x9b5b('0x15')]?_0x5b8a19[_0x9b5b('0x15')]['include']?_['map'](_0x5b8a19['options'][_0x9b5b('0x18')],function(_0x4c3a3f){return{'model':db[_0x4c3a3f['model']],'as':_0x4c3a3f['as'],'attributes':_0x4c3a3f[_0x9b5b('0x1b')],'include':_0x4c3a3f[_0x9b5b('0x18')]?_[_0x9b5b('0x19')](_0x4c3a3f[_0x9b5b('0x18')],function(_0x34f181){return{'model':db[_0x34f181[_0x9b5b('0x1a')]],'as':_0x34f181['as'],'attributes':_0x34f181[_0x9b5b('0x1b')],'include':_0x34f181[_0x9b5b('0x18')]?_[_0x9b5b('0x19')](_0x34f181[_0x9b5b('0x18')],function(_0x588392){return{'model':db[_0x588392[_0x9b5b('0x1a')]],'as':_0x588392['as'],'attributes':_0x588392['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b5b('0x1e')](function(_0x5b7b00){logger[_0x9b5b('0xf')](_0x9b5b('0x1c'),_0x5b8a19);logger[_0x9b5b('0x1f')]('ShowServicenowAccount',_0x5b8a19,JSON[_0x9b5b('0xb')](_0x5b7b00));_0x4614cd(_0x5b7b00);})[_0x9b5b('0x11')](function(_0x25c33e){logger[_0x9b5b('0xc')]('ShowServicenowAccount',_0x25c33e[_0x9b5b('0xe')],_0x5b8a19);_0x5814af(_0x444020[_0x9b5b('0xc')](0x1f4,_0x25c33e[_0x9b5b('0xe')]));});});}; \ No newline at end of file +var _0x203c=['findAll','raw','options','where','attributes','limit','include','map','model','then','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','ServicenowAccount'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x203c,0x1b0));var _0xc203=function(_0x324164,_0x3a65ae){_0x324164=_0x324164-0x0;var _0x4c853d=_0x203c[_0x324164];return _0x4c853d;};'use strict';var _=require(_0xc203('0x0'));var util=require(_0xc203('0x1'));var moment=require('moment');var BPromise=require(_0xc203('0x2'));var rs=require(_0xc203('0x3'));var fs=require('fs');var Redis=require(_0xc203('0x4'));var db=require(_0xc203('0x5'))['db'];var utils=require(_0xc203('0x6'));var logger=require('../../config/logger')(_0xc203('0x7'));var config=require('../../config/environment');var jayson=require(_0xc203('0x8'));var client=jayson['client'][_0xc203('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bf394,_0x158350,_0x535e35){return new BPromise(function(_0x1daa99,_0xd6b5f1){return client[_0xc203('0xa')](_0x3bf394,_0x535e35)['then'](function(_0x31e61a){logger[_0xc203('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x158350,_0xc203('0xc'));logger[_0xc203('0xd')](_0xc203('0xe'),_0x158350,_0xc203('0xc'),JSON[_0xc203('0xf')](_0x31e61a));if(_0x31e61a['error']){if(_0x31e61a[_0xc203('0x10')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x158350,_0x31e61a[_0xc203('0x10')][_0xc203('0x11')]);return _0xd6b5f1(_0x31e61a[_0xc203('0x10')][_0xc203('0x11')]);}logger[_0xc203('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x158350,_0x31e61a['error']['message']);return _0x1daa99(_0x31e61a[_0xc203('0x10')][_0xc203('0x11')]);}else{logger['info'](_0xc203('0x12'),_0x158350,_0xc203('0xc'));_0x1daa99(_0x31e61a[_0xc203('0x13')]['message']);}})[_0xc203('0x14')](function(_0x47299f){logger[_0xc203('0x10')](_0xc203('0x12'),_0x158350,_0x47299f);_0xd6b5f1(_0x47299f);});});}exports[_0xc203('0x15')]=function(_0x4bf55f){var _0x4c88ed=this;return new Promise(function(_0x1d4128,_0x1579e5){return db[_0xc203('0x16')][_0xc203('0x17')]({'raw':_0x4bf55f['options']?_0x4bf55f['options'][_0xc203('0x18')]===undefined?!![]:![]:!![],'where':_0x4bf55f[_0xc203('0x19')]?_0x4bf55f[_0xc203('0x19')][_0xc203('0x1a')]||null:null,'attributes':_0x4bf55f[_0xc203('0x19')]?_0x4bf55f[_0xc203('0x19')][_0xc203('0x1b')]||null:null,'limit':_0x4bf55f[_0xc203('0x19')]?_0x4bf55f[_0xc203('0x19')][_0xc203('0x1c')]||null:null,'include':_0x4bf55f['options']?_0x4bf55f[_0xc203('0x19')][_0xc203('0x1d')]?_[_0xc203('0x1e')](_0x4bf55f[_0xc203('0x19')][_0xc203('0x1d')],function(_0x137989){return{'model':db[_0x137989[_0xc203('0x1f')]],'as':_0x137989['as'],'attributes':_0x137989[_0xc203('0x1b')],'include':_0x137989[_0xc203('0x1d')]?_[_0xc203('0x1e')](_0x137989[_0xc203('0x1d')],function(_0x2dc0e5){return{'model':db[_0x2dc0e5[_0xc203('0x1f')]],'as':_0x2dc0e5['as'],'attributes':_0x2dc0e5['attributes'],'include':_0x2dc0e5[_0xc203('0x1d')]?_[_0xc203('0x1e')](_0x2dc0e5[_0xc203('0x1d')],function(_0x5b3f07){return{'model':db[_0x5b3f07[_0xc203('0x1f')]],'as':_0x5b3f07['as'],'attributes':_0x5b3f07[_0xc203('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc203('0x20')](function(_0x534bfd){logger[_0xc203('0xb')]('GetServicenowAccount',_0x4bf55f);logger[_0xc203('0xd')](_0xc203('0x15'),_0x4bf55f,JSON['stringify'](_0x534bfd));_0x1d4128(_0x534bfd);})[_0xc203('0x14')](function(_0x54d4e3){logger[_0xc203('0x10')](_0xc203('0x15'),_0x54d4e3[_0xc203('0x11')],_0x4bf55f);_0x1579e5(_0x4c88ed[_0xc203('0x10')](0x1f4,_0x54d4e3['message']));});});};exports[_0xc203('0x21')]=function(_0x4ec698){var _0x68a407=this;return new Promise(function(_0x2d2c4d,_0x54e7c8){return db[_0xc203('0x16')][_0xc203('0x22')]({'raw':_0x4ec698[_0xc203('0x19')]?_0x4ec698[_0xc203('0x19')][_0xc203('0x18')]===undefined?!![]:![]:!![],'where':_0x4ec698[_0xc203('0x19')]?_0x4ec698[_0xc203('0x19')]['where']||null:null,'attributes':_0x4ec698['options']?_0x4ec698[_0xc203('0x19')]['attributes']||null:null,'include':_0x4ec698[_0xc203('0x19')]?_0x4ec698[_0xc203('0x19')][_0xc203('0x1d')]?_[_0xc203('0x1e')](_0x4ec698[_0xc203('0x19')]['include'],function(_0x21b038){return{'model':db[_0x21b038[_0xc203('0x1f')]],'as':_0x21b038['as'],'attributes':_0x21b038[_0xc203('0x1b')],'include':_0x21b038['include']?_[_0xc203('0x1e')](_0x21b038['include'],function(_0x510e11){return{'model':db[_0x510e11[_0xc203('0x1f')]],'as':_0x510e11['as'],'attributes':_0x510e11[_0xc203('0x1b')],'include':_0x510e11[_0xc203('0x1d')]?_[_0xc203('0x1e')](_0x510e11['include'],function(_0x25e3e1){return{'model':db[_0x25e3e1[_0xc203('0x1f')]],'as':_0x25e3e1['as'],'attributes':_0x25e3e1[_0xc203('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc203('0x20')](function(_0x3051bd){logger[_0xc203('0xb')]('ShowServicenowAccount',_0x4ec698);logger[_0xc203('0xd')](_0xc203('0x21'),_0x4ec698,JSON[_0xc203('0xf')](_0x3051bd));_0x2d2c4d(_0x3051bd);})['catch'](function(_0x3f9bce){logger['error'](_0xc203('0x21'),_0x3f9bce[_0xc203('0x11')],_0x4ec698);_0x54e7c8(_0x68a407[_0xc203('0x10')](0x1f4,_0x3f9bce[_0xc203('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 0e21a81..5187e3a 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 _0x2579=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x2579,0x186));var _0x9257=function(_0x5d60de,_0xbca3c8){_0x5d60de=_0x5d60de-0x0;var _0x3f1eb4=_0x2579[_0x5d60de];return _0x3f1eb4;};'use strict';var multer=require(_0x9257('0x0'));var util=require(_0x9257('0x1'));var path=require(_0x9257('0x2'));var timeout=require(_0x9257('0x3'));var express=require(_0x9257('0x4'));var router=express[_0x9257('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9257('0x6'));var controller=require(_0x9257('0x7'));router[_0x9257('0x8')]('/',auth[_0x9257('0x9')](),controller[_0x9257('0xa')]);router[_0x9257('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9257('0xb')]);router[_0x9257('0x8')](_0x9257('0xc'),auth[_0x9257('0x9')](),controller[_0x9257('0xd')]);router[_0x9257('0x8')](_0x9257('0xe'),auth[_0x9257('0x9')](),controller['getSubjects']);router[_0x9257('0x8')](_0x9257('0xf'),auth[_0x9257('0x9')](),controller[_0x9257('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9257('0x11')]);router[_0x9257('0x12')](_0x9257('0x13'),auth[_0x9257('0x9')](),controller[_0x9257('0x14')]);router[_0x9257('0x15')]('/:id',auth[_0x9257('0x9')](),controller[_0x9257('0x16')]);module[_0x9257('0x17')]=router; \ No newline at end of file +var _0x209a=['connect-timeout','express','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','exports','multer','util'];(function(_0x180b0a,_0x2e6f97){var _0xeacdde=function(_0x163db6){while(--_0x163db6){_0x180b0a['push'](_0x180b0a['shift']());}};_0xeacdde(++_0x2e6f97);}(_0x209a,0x1b7));var _0xa209=function(_0xcae41c,_0x299b7d){_0xcae41c=_0xcae41c-0x0;var _0x1892ec=_0x209a[_0xcae41c];return _0x1892ec;};'use strict';var multer=require(_0xa209('0x0'));var util=require(_0xa209('0x1'));var path=require('path');var timeout=require(_0xa209('0x2'));var express=require(_0xa209('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa209('0x4'));var config=require(_0xa209('0x5'));var controller=require(_0xa209('0x6'));router['get']('/',auth[_0xa209('0x7')](),controller[_0xa209('0x8')]);router[_0xa209('0x9')]('/:id',auth[_0xa209('0x7')](),controller[_0xa209('0xa')]);router[_0xa209('0x9')](_0xa209('0xb'),auth[_0xa209('0x7')](),controller[_0xa209('0xc')]);router[_0xa209('0x9')]('/:id/subjects',auth[_0xa209('0x7')](),controller[_0xa209('0xd')]);router['get'](_0xa209('0xe'),auth[_0xa209('0x7')](),controller[_0xa209('0xf')]);router[_0xa209('0x10')]('/',auth[_0xa209('0x7')](),controller[_0xa209('0x11')]);router[_0xa209('0x12')](_0xa209('0x13'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xa209('0x7')](),controller['destroy']);module[_0xa209('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index d6b8766..a3a5d2f 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 _0x308c=['STRING','sequelize'];(function(_0xacb6c3,_0x481ccc){var _0x379bef=function(_0x46f2af){while(--_0x46f2af){_0xacb6c3['push'](_0xacb6c3['shift']());}};_0x379bef(++_0x481ccc);}(_0x308c,0x1d3));var _0xc308=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x308c[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xc308('0x0'));module['exports']={'name':{'type':Sequelize[_0xc308('0x1')]},'description':{'type':Sequelize[_0xc308('0x1')]}}; \ No newline at end of file +var _0x7cbd=['exports','STRING'];(function(_0x11da4b,_0x837820){var _0x186fe6=function(_0x242aa1){while(--_0x242aa1){_0x11da4b['push'](_0x11da4b['shift']());}};_0x186fe6(++_0x837820);}(_0x7cbd,0xe0));var _0xd7cb=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x7cbd[_0x2c0dc0];return _0x4c0990;};'use strict';var Sequelize=require('sequelize');module[_0xd7cb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd7cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 40b4348..05062ff 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 _0xefda=['stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','apply','update','destroy','then','end','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','limit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','length','find','create','body','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','order','hasOwnProperty','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xf93b08,_0x2559d7){var _0x12f72e=function(_0x30534b){while(--_0x30534b){_0xf93b08['push'](_0xf93b08['shift']());}};_0x12f72e(++_0x2559d7);}(_0xefda,0x96));var _0xaefd=function(_0x1d0236,_0x4deb06){_0x1d0236=_0x1d0236-0x0;var _0x5d4a5c=_0xefda[_0x1d0236];return _0x5d4a5c;};'use strict';var pdf=require(_0xaefd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaefd('0x1'));var jsonpatch=require(_0xaefd('0x2'));var rp=require('request-promise');var moment=require(_0xaefd('0x3'));var BPromise=require(_0xaefd('0x4'));var Mustache=require(_0xaefd('0x5'));var util=require(_0xaefd('0x6'));var path=require(_0xaefd('0x7'));var sox=require(_0xaefd('0x8'));var csv=require('to-csv');var ejs=require(_0xaefd('0x9'));var fs=require('fs');var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0xe'));var querystring=require(_0xaefd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0x10'));var as=require(_0xaefd('0x11'));var hardwareService=require(_0xaefd('0x12'));var logger=require(_0xaefd('0x13'))(_0xaefd('0x14'));var utils=require(_0xaefd('0x15'));var config=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];var jayson=require(_0xaefd('0x18'));var client=jayson[_0xaefd('0x19')][_0xaefd('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4b2b5c,_0x3172d3,_0x4ac467){if(_0x4ac467){var _0xd88c7c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd88c7c[_0xaefd('0x1b')](_0x3172d3)){return _0x4b2b5c;}else{throw new db[(_0xaefd('0x1c'))][(_0xaefd('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 _0x4b2b5c;}}function respondWithRpcPromise(_0x16e4f4,_0x13492c,_0x41f345,_0x411701){return new BPromise(function(_0x10ee28,_0x32f75e){var _0x277070=_0x411701||client;return _0x277070[_0xaefd('0x1e')](_0x16e4f4,_0x41f345)['then'](function(_0x9d9c29){logger[_0xaefd('0x1f')](_0xaefd('0x20'),_0x13492c,_0xaefd('0x21'));logger[_0xaefd('0x22')](_0xaefd('0x23'),_0x13492c,'request\x20sent',JSON[_0xaefd('0x24')](_0x9d9c29));if(_0x9d9c29[_0xaefd('0x25')]){if(_0x9d9c29[_0xaefd('0x25')][_0xaefd('0x26')]===0x1f4){logger[_0xaefd('0x25')](_0xaefd('0x20'),_0x13492c,_0x9d9c29['error'][_0xaefd('0x27')]);return _0x32f75e(_0x9d9c29[_0xaefd('0x25')][_0xaefd('0x27')]);}logger[_0xaefd('0x25')](_0xaefd('0x20'),_0x13492c,_0x9d9c29['error']['message']);return _0x10ee28(_0x9d9c29['error'][_0xaefd('0x27')]);}else{logger[_0xaefd('0x1f')](_0xaefd('0x20'),_0x13492c,'request\x20sent');_0x10ee28(_0x9d9c29[_0xaefd('0x28')]['message']);}})[_0xaefd('0x29')](function(_0x3caa99){logger[_0xaefd('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x13492c,_0x3caa99);_0x32f75e(_0x3caa99);});});}function respondWithStatusCode(_0x435413,_0x3ffc9c){_0x3ffc9c=_0x3ffc9c||0xcc;return function(_0x18e720){if(_0x18e720){return _0x435413[_0xaefd('0x2a')](_0x3ffc9c);}return _0x435413[_0xaefd('0x2b')](_0x3ffc9c)['end']();};}function respondWithResult(_0x2fe27e,_0x58c008){_0x58c008=_0x58c008||0xc8;return function(_0x810bf){if(_0x810bf){return _0x2fe27e[_0xaefd('0x2b')](_0x58c008)['json'](_0x810bf);}};}function respondWithFilteredResult(_0x2b3d3d,_0x2a8fa8){return function(_0x521839){if(_0x521839){var _0xbeb1b8=_0x521839[_0xaefd('0x2c')],_0x114ec0=_0x2a8fa8['offset'],_0x36b6b7=_0x2a8fa8[_0xaefd('0x2d')]+_0x2a8fa8['limit'],_0x4c0898;if(_0x36b6b7>=_0xbeb1b8){_0x36b6b7=_0xbeb1b8;_0x4c0898=0xc8;}else{_0x4c0898=0xce;}_0x2b3d3d['status'](_0x4c0898);return _0x2b3d3d[_0xaefd('0x2e')](_0xaefd('0x2f'),_0x114ec0+'-'+_0x36b6b7+'/'+_0xbeb1b8)['json'](_0x521839);}return null;};}function patchUpdates(_0x578378){return function(_0x4ee0c1){try{jsonpatch[_0xaefd('0x30')](_0x4ee0c1,_0x578378,!![]);}catch(_0x280eab){return BPromise['reject'](_0x280eab);}return _0x4ee0c1['save']();};}function saveUpdates(_0x62ef86,_0x465d99){return function(_0x3f4947){if(_0x3f4947){return _0x3f4947[_0xaefd('0x31')](_0x62ef86)['then'](function(_0x3ff5b2){return _0x3ff5b2;});}return null;};}function removeEntity(_0x36854f,_0x3b11e4){return function(_0xad59fc){if(_0xad59fc){return _0xad59fc[_0xaefd('0x32')]()[_0xaefd('0x33')](function(){_0x36854f[_0xaefd('0x2b')](0xcc)[_0xaefd('0x34')]();});}};}function handleEntityNotFound(_0x3e3fe2,_0x234780){return function(_0x3744a5){if(!_0x3744a5){_0x3e3fe2[_0xaefd('0x2a')](0x194);}return _0x3744a5;};}function handleError(_0x304d34,_0x26a6bd){_0x26a6bd=_0x26a6bd||0x1f4;return function(_0x1ffec4){logger[_0xaefd('0x25')](_0x1ffec4['stack']);if(_0x1ffec4[_0xaefd('0x35')]){delete _0x1ffec4[_0xaefd('0x35')];}_0x304d34[_0xaefd('0x2b')](_0x26a6bd)['send'](_0x1ffec4);};}exports[_0xaefd('0x36')]=function(_0x577389,_0x187e76){var _0x3498d9={},_0x99a883={},_0xbbbf6d={'count':0x0,'rows':[]};var _0x2c0d72=_[_0xaefd('0x37')](db[_0xaefd('0x38')][_0xaefd('0x39')],function(_0x407bea){return{'name':_0x407bea[_0xaefd('0x3a')],'type':_0x407bea[_0xaefd('0x3b')][_0xaefd('0x3c')]};});_0x99a883[_0xaefd('0x3d')]=_[_0xaefd('0x37')](_0x2c0d72,'name');_0x99a883[_0xaefd('0x3e')]=_['keys'](_0x577389[_0xaefd('0x3e')]);_0x99a883[_0xaefd('0x3f')]=_[_0xaefd('0x40')](_0x99a883[_0xaefd('0x3d')],_0x99a883[_0xaefd('0x3e')]);_0x3498d9[_0xaefd('0x41')]=_[_0xaefd('0x40')](_0x99a883[_0xaefd('0x3d')],qs[_0xaefd('0x42')](_0x577389[_0xaefd('0x3e')]['fields']));_0x3498d9[_0xaefd('0x41')]=_0x3498d9[_0xaefd('0x41')]['length']?_0x3498d9[_0xaefd('0x41')]:_0x99a883[_0xaefd('0x3d')];if(!_0x577389[_0xaefd('0x3e')]['hasOwnProperty']('nolimit')){_0x3498d9[_0xaefd('0x43')]=qs[_0xaefd('0x43')](_0x577389[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x3498d9[_0xaefd('0x2d')]=qs[_0xaefd('0x2d')](_0x577389[_0xaefd('0x3e')][_0xaefd('0x2d')]);}_0x3498d9['order']=qs[_0xaefd('0x44')](_0x577389[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x3498d9[_0xaefd('0x45')]=qs[_0xaefd('0x3f')](_[_0xaefd('0x46')](_0x577389[_0xaefd('0x3e')],_0x99a883[_0xaefd('0x3f')]),_0x2c0d72);if(_0x577389['query']['filter']){_0x3498d9[_0xaefd('0x45')]=_[_0xaefd('0x47')](_0x3498d9['where'],{'$or':_['map'](_0x2c0d72,function(_0x17d611){if(_0x17d611[_0xaefd('0x3b')]!==_0xaefd('0x48')){var _0x1ba03a={};_0x1ba03a[_0x17d611[_0xaefd('0x35')]]={'$like':'%'+_0x577389[_0xaefd('0x3e')][_0xaefd('0x49')]+'%'};return _0x1ba03a;}})});}_0x3498d9=_[_0xaefd('0x47')]({},_0x3498d9,_0x577389[_0xaefd('0x4a')]);var _0x558a75={'where':_0x3498d9[_0xaefd('0x45')]};return db[_0xaefd('0x38')][_0xaefd('0x2c')](_0x558a75)[_0xaefd('0x33')](function(_0x224613){_0xbbbf6d[_0xaefd('0x2c')]=_0x224613;if(_0x577389[_0xaefd('0x3e')]['includeAll']){_0x3498d9[_0xaefd('0x4b')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xaefd('0x4c')](_0x3498d9);})[_0xaefd('0x33')](function(_0x16c664){_0xbbbf6d[_0xaefd('0x4d')]=_0x16c664;return _0xbbbf6d;})['then'](respondWithFilteredResult(_0x187e76,_0x3498d9))['catch'](handleError(_0x187e76,null));};exports[_0xaefd('0x4e')]=function(_0x34839e,_0x179b8b){var _0x4eeb56={'raw':![],'where':{'id':_0x34839e[_0xaefd('0x4f')]['id']}},_0x2a836a={};_0x2a836a['model']=_[_0xaefd('0x50')](db[_0xaefd('0x38')][_0xaefd('0x39')]);_0x2a836a[_0xaefd('0x3e')]=_[_0xaefd('0x50')](_0x34839e[_0xaefd('0x3e')]);_0x2a836a[_0xaefd('0x3f')]=_[_0xaefd('0x40')](_0x2a836a['model'],_0x2a836a['query']);_0x4eeb56[_0xaefd('0x41')]=_[_0xaefd('0x40')](_0x2a836a['model'],qs[_0xaefd('0x42')](_0x34839e['query'][_0xaefd('0x42')]));_0x4eeb56[_0xaefd('0x41')]=_0x4eeb56[_0xaefd('0x41')][_0xaefd('0x51')]?_0x4eeb56[_0xaefd('0x41')]:_0x2a836a[_0xaefd('0x3d')];if(_0x34839e['query']['includeAll']){_0x4eeb56[_0xaefd('0x4b')]=[{'all':!![]}];}_0x4eeb56=_[_0xaefd('0x47')]({},_0x4eeb56,_0x34839e['options']);return db[_0xaefd('0x38')][_0xaefd('0x52')](_0x4eeb56)[_0xaefd('0x33')](handleEntityNotFound(_0x179b8b,null))[_0xaefd('0x33')](respondWithResult(_0x179b8b,null))['catch'](handleError(_0x179b8b,null));};exports['create']=function(_0x2b0d8e,_0x41ef40){return db[_0xaefd('0x38')][_0xaefd('0x53')](_0x2b0d8e[_0xaefd('0x54')],{})['then'](respondWithResult(_0x41ef40,0xc9))[_0xaefd('0x29')](handleError(_0x41ef40,null));};exports[_0xaefd('0x31')]=function(_0x5a54fb,_0xbeca29){if(_0x5a54fb[_0xaefd('0x54')]['id']){delete _0x5a54fb['body']['id'];}return db[_0xaefd('0x38')][_0xaefd('0x52')]({'where':{'id':_0x5a54fb[_0xaefd('0x4f')]['id']}})['then'](handleEntityNotFound(_0xbeca29,null))[_0xaefd('0x33')](saveUpdates(_0x5a54fb[_0xaefd('0x54')],null))['then'](respondWithResult(_0xbeca29,null))[_0xaefd('0x29')](handleError(_0xbeca29,null));};exports[_0xaefd('0x32')]=function(_0x14b472,_0x2dd1ee){return db['ServicenowConfiguration']['find']({'where':{'id':_0x14b472[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0x2dd1ee,null))[_0xaefd('0x33')](removeEntity(_0x2dd1ee,null))[_0xaefd('0x29')](handleError(_0x2dd1ee,null));};exports[_0xaefd('0x55')]=function(_0x8ab9e7,_0x314660,_0x368fd3){var _0x1e519e={};var _0x133c4f={};var _0x48636d;var _0x4fc1f9;return db[_0xaefd('0x38')][_0xaefd('0x56')]({'where':{'id':_0x8ab9e7[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0x314660,null))['then'](function(_0x13309e){if(_0x13309e){_0x48636d=_0x13309e;_0x133c4f[_0xaefd('0x3d')]=_[_0xaefd('0x50')](db[_0xaefd('0x57')][_0xaefd('0x39')]);_0x133c4f[_0xaefd('0x3e')]=_[_0xaefd('0x50')](_0x8ab9e7[_0xaefd('0x3e')]);_0x133c4f['filters']=_[_0xaefd('0x40')](_0x133c4f[_0xaefd('0x3d')],_0x133c4f[_0xaefd('0x3e')]);_0x1e519e[_0xaefd('0x41')]=_['intersection'](_0x133c4f[_0xaefd('0x3d')],qs['fields'](_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x42')]));_0x1e519e['attributes']=_0x1e519e['attributes'][_0xaefd('0x51')]?_0x1e519e['attributes']:_0x133c4f['model'];_0x1e519e['order']=qs[_0xaefd('0x44')](_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x1e519e[_0xaefd('0x45')]=qs[_0xaefd('0x3f')](_[_0xaefd('0x46')](_0x8ab9e7['query'],_0x133c4f['filters']));if(_0x8ab9e7['query']['filter']){_0x1e519e[_0xaefd('0x45')]=_['merge'](_0x1e519e[_0xaefd('0x45')],{'$or':_['map'](_0x1e519e[_0xaefd('0x41')],function(_0x32dc0d){var _0x416241={};_0x416241[_0x32dc0d]={'$like':'%'+_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x49')]+'%'};return _0x416241;})});}_0x1e519e=_[_0xaefd('0x47')]({},_0x1e519e,_0x8ab9e7[_0xaefd('0x4a')]);return _0x48636d['getFields'](_0x1e519e);}})[_0xaefd('0x33')](function(_0x4113e4){if(_0x4113e4){_0x4fc1f9=_0x4113e4[_0xaefd('0x51')];if(!_0x8ab9e7[_0xaefd('0x3e')]['hasOwnProperty'](_0xaefd('0x58'))){_0x1e519e['limit']=qs[_0xaefd('0x43')](_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x1e519e[_0xaefd('0x2d')]=qs[_0xaefd('0x2d')](_0x8ab9e7[_0xaefd('0x3e')]['offset']);}return _0x48636d[_0xaefd('0x55')](_0x1e519e);}})[_0xaefd('0x33')](function(_0x4a9fa5){if(_0x4a9fa5){return _0x4a9fa5?{'count':_0x4fc1f9,'rows':_0x4a9fa5}:null;}})[_0xaefd('0x33')](respondWithResult(_0x314660,null))[_0xaefd('0x29')](handleError(_0x314660,null));};exports['getSubjects']=function(_0x3a2b63,_0x2a472f,_0x4247d9){var _0x46a793={};var _0x2c4ba7={};var _0x406c6d;var _0x2d8283;return db[_0xaefd('0x38')][_0xaefd('0x56')]({'where':{'id':_0x3a2b63[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0x2a472f,null))[_0xaefd('0x33')](function(_0x11a068){if(_0x11a068){_0x406c6d=_0x11a068;_0x2c4ba7[_0xaefd('0x3d')]=_[_0xaefd('0x50')](db[_0xaefd('0x57')][_0xaefd('0x39')]);_0x2c4ba7['query']=_[_0xaefd('0x50')](_0x3a2b63[_0xaefd('0x3e')]);_0x2c4ba7[_0xaefd('0x3f')]=_['intersection'](_0x2c4ba7[_0xaefd('0x3d')],_0x2c4ba7[_0xaefd('0x3e')]);_0x46a793[_0xaefd('0x41')]=_[_0xaefd('0x40')](_0x2c4ba7['model'],qs[_0xaefd('0x42')](_0x3a2b63['query'][_0xaefd('0x42')]));_0x46a793['attributes']=_0x46a793[_0xaefd('0x41')][_0xaefd('0x51')]?_0x46a793[_0xaefd('0x41')]:_0x2c4ba7['model'];_0x46a793['order']=qs[_0xaefd('0x44')](_0x3a2b63[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x46a793[_0xaefd('0x45')]=qs[_0xaefd('0x3f')](_[_0xaefd('0x46')](_0x3a2b63['query'],_0x2c4ba7['filters']));if(_0x3a2b63['query']['filter']){_0x46a793['where']=_[_0xaefd('0x47')](_0x46a793[_0xaefd('0x45')],{'$or':_[_0xaefd('0x37')](_0x46a793[_0xaefd('0x41')],function(_0x5ae635){var _0x3ae6ba={};_0x3ae6ba[_0x5ae635]={'$like':'%'+_0x3a2b63[_0xaefd('0x3e')]['filter']+'%'};return _0x3ae6ba;})});}_0x46a793=_[_0xaefd('0x47')]({},_0x46a793,_0x3a2b63['options']);return _0x406c6d[_0xaefd('0x59')](_0x46a793);}})['then'](function(_0x21d44b){if(_0x21d44b){_0x2d8283=_0x21d44b['length'];if(!_0x3a2b63[_0xaefd('0x3e')]['hasOwnProperty'](_0xaefd('0x58'))){_0x46a793[_0xaefd('0x43')]=qs['limit'](_0x3a2b63[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x46a793[_0xaefd('0x2d')]=qs['offset'](_0x3a2b63[_0xaefd('0x3e')][_0xaefd('0x2d')]);}return _0x406c6d[_0xaefd('0x59')](_0x46a793);}})[_0xaefd('0x33')](function(_0x23115d){if(_0x23115d){return _0x23115d?{'count':_0x2d8283,'rows':_0x23115d}:null;}})['then'](respondWithResult(_0x2a472f,null))[_0xaefd('0x29')](handleError(_0x2a472f,null));};exports[_0xaefd('0x5a')]=function(_0x4ebd3e,_0xdacfe3,_0x1a80ee){var _0x1298e4={};var _0x299868={};var _0x5e3743;var _0x2a62ac;return db['ServicenowConfiguration'][_0xaefd('0x56')]({'where':{'id':_0x4ebd3e[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0xdacfe3,null))['then'](function(_0xa53ec){if(_0xa53ec){_0x5e3743=_0xa53ec;_0x299868[_0xaefd('0x3d')]=_[_0xaefd('0x50')](db['ServicenowField'][_0xaefd('0x39')]);_0x299868[_0xaefd('0x3e')]=_[_0xaefd('0x50')](_0x4ebd3e[_0xaefd('0x3e')]);_0x299868['filters']=_[_0xaefd('0x40')](_0x299868[_0xaefd('0x3d')],_0x299868[_0xaefd('0x3e')]);_0x1298e4[_0xaefd('0x41')]=_['intersection'](_0x299868[_0xaefd('0x3d')],qs[_0xaefd('0x42')](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x42')]));_0x1298e4['attributes']=_0x1298e4[_0xaefd('0x41')]['length']?_0x1298e4[_0xaefd('0x41')]:_0x299868['model'];_0x1298e4[_0xaefd('0x5b')]=qs[_0xaefd('0x44')](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x1298e4[_0xaefd('0x45')]=qs['filters'](_[_0xaefd('0x46')](_0x4ebd3e['query'],_0x299868[_0xaefd('0x3f')]));if(_0x4ebd3e['query'][_0xaefd('0x49')]){_0x1298e4[_0xaefd('0x45')]=_[_0xaefd('0x47')](_0x1298e4['where'],{'$or':_[_0xaefd('0x37')](_0x1298e4['attributes'],function(_0xdb53cf){var _0x4310b1={};_0x4310b1[_0xdb53cf]={'$like':'%'+_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x49')]+'%'};return _0x4310b1;})});}_0x1298e4=_['merge']({},_0x1298e4,_0x4ebd3e[_0xaefd('0x4a')]);return _0x5e3743[_0xaefd('0x5a')](_0x1298e4);}})[_0xaefd('0x33')](function(_0x407c6a){if(_0x407c6a){_0x2a62ac=_0x407c6a[_0xaefd('0x51')];if(!_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x5c')](_0xaefd('0x58'))){_0x1298e4[_0xaefd('0x43')]=qs['limit'](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x1298e4[_0xaefd('0x2d')]=qs[_0xaefd('0x2d')](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x2d')]);}return _0x5e3743[_0xaefd('0x5a')](_0x1298e4);}})[_0xaefd('0x33')](function(_0x190170){if(_0x190170){return _0x190170?{'count':_0x2a62ac,'rows':_0x190170}:null;}})[_0xaefd('0x33')](respondWithResult(_0xdacfe3,null))[_0xaefd('0x29')](handleError(_0xdacfe3,null));}; \ No newline at end of file +var _0xe605=['result','catch','sendStatus','end','json','count','offset','limit','status','Content-Range','reject','save','update','destroy','stack','name','index','ServicenowConfiguration','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','findOne','ServicenowField','pick','getFields','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x538574,_0x4cd6df){var _0x116565=function(_0x1961bd){while(--_0x1961bd){_0x538574['push'](_0x538574['shift']());}};_0x116565(++_0x4cd6df);}(_0xe605,0x92));var _0x5e60=function(_0x3db9a8,_0x1c280e){_0x3db9a8=_0x3db9a8-0x0;var _0x360c3a=_0xe605[_0x3db9a8];return _0x360c3a;};'use strict';var pdf=require(_0x5e60('0x0'));var emlformat=require(_0x5e60('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5e60('0x2'));var jsonpatch=require(_0x5e60('0x3'));var rp=require(_0x5e60('0x4'));var moment=require(_0x5e60('0x5'));var BPromise=require(_0x5e60('0x6'));var Mustache=require(_0x5e60('0x7'));var util=require(_0x5e60('0x8'));var path=require(_0x5e60('0x9'));var sox=require(_0x5e60('0xa'));var csv=require(_0x5e60('0xb'));var ejs=require(_0x5e60('0xc'));var fs=require('fs');var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var db=require(_0x5e60('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5e60('0x19')][_0x5e60('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1f4e14,_0xe039de,_0x2874c4){if(_0x2874c4){var _0xe124cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe124cd['test'](_0xe039de)){return _0x1f4e14;}else{throw new db[(_0x5e60('0x1b'))][(_0x5e60('0x1c'))](_0x5e60('0x1d'));}}else{return _0x1f4e14;}}function respondWithRpcPromise(_0x2a1c55,_0x5b028f,_0x20af5f,_0x529ffe){return new BPromise(function(_0x1ffd77,_0x3bc7d8){var _0x4cf084=_0x529ffe||client;return _0x4cf084[_0x5e60('0x1e')](_0x2a1c55,_0x20af5f)[_0x5e60('0x1f')](function(_0xaa7d05){logger[_0x5e60('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b028f,_0x5e60('0x21'));logger[_0x5e60('0x22')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5b028f,_0x5e60('0x21'),JSON[_0x5e60('0x23')](_0xaa7d05));if(_0xaa7d05[_0x5e60('0x24')]){if(_0xaa7d05[_0x5e60('0x24')][_0x5e60('0x25')]===0x1f4){logger[_0x5e60('0x24')](_0x5e60('0x26'),_0x5b028f,_0xaa7d05[_0x5e60('0x24')][_0x5e60('0x27')]);return _0x3bc7d8(_0xaa7d05[_0x5e60('0x24')][_0x5e60('0x27')]);}logger['error'](_0x5e60('0x26'),_0x5b028f,_0xaa7d05['error'][_0x5e60('0x27')]);return _0x1ffd77(_0xaa7d05[_0x5e60('0x24')][_0x5e60('0x27')]);}else{logger[_0x5e60('0x20')](_0x5e60('0x26'),_0x5b028f,_0x5e60('0x21'));_0x1ffd77(_0xaa7d05[_0x5e60('0x28')]['message']);}})[_0x5e60('0x29')](function(_0x7dbdb7){logger[_0x5e60('0x24')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b028f,_0x7dbdb7);_0x3bc7d8(_0x7dbdb7);});});}function respondWithStatusCode(_0x45cb62,_0x56e3a5){_0x56e3a5=_0x56e3a5||0xcc;return function(_0x2d8aac){if(_0x2d8aac){return _0x45cb62[_0x5e60('0x2a')](_0x56e3a5);}return _0x45cb62['status'](_0x56e3a5)[_0x5e60('0x2b')]();};}function respondWithResult(_0x5712f7,_0x23d187){_0x23d187=_0x23d187||0xc8;return function(_0x221322){if(_0x221322){return _0x5712f7['status'](_0x23d187)[_0x5e60('0x2c')](_0x221322);}};}function respondWithFilteredResult(_0x19e5ab,_0x5b1b46){return function(_0x1ee931){if(_0x1ee931){var _0xac9c7a=_0x1ee931[_0x5e60('0x2d')],_0x52c97c=_0x5b1b46[_0x5e60('0x2e')],_0x5431a8=_0x5b1b46[_0x5e60('0x2e')]+_0x5b1b46[_0x5e60('0x2f')],_0x52f668;if(_0x5431a8>=_0xac9c7a){_0x5431a8=_0xac9c7a;_0x52f668=0xc8;}else{_0x52f668=0xce;}_0x19e5ab[_0x5e60('0x30')](_0x52f668);return _0x19e5ab['set'](_0x5e60('0x31'),_0x52c97c+'-'+_0x5431a8+'/'+_0xac9c7a)[_0x5e60('0x2c')](_0x1ee931);}return null;};}function patchUpdates(_0x4d4b55){return function(_0x11fc87){try{jsonpatch['apply'](_0x11fc87,_0x4d4b55,!![]);}catch(_0x50f024){return BPromise[_0x5e60('0x32')](_0x50f024);}return _0x11fc87[_0x5e60('0x33')]();};}function saveUpdates(_0x1f474b,_0x385c77){return function(_0xaf3a35){if(_0xaf3a35){return _0xaf3a35[_0x5e60('0x34')](_0x1f474b)[_0x5e60('0x1f')](function(_0x2ff2b7){return _0x2ff2b7;});}return null;};}function removeEntity(_0xc1489a,_0x4702a6){return function(_0x5c429c){if(_0x5c429c){return _0x5c429c[_0x5e60('0x35')]()['then'](function(){_0xc1489a['status'](0xcc)[_0x5e60('0x2b')]();});}};}function handleEntityNotFound(_0x317206,_0x4fd910){return function(_0x307e54){if(!_0x307e54){_0x317206['sendStatus'](0x194);}return _0x307e54;};}function handleError(_0x3757fc,_0x45d979){_0x45d979=_0x45d979||0x1f4;return function(_0x2b2426){logger[_0x5e60('0x24')](_0x2b2426[_0x5e60('0x36')]);if(_0x2b2426[_0x5e60('0x37')]){delete _0x2b2426[_0x5e60('0x37')];}_0x3757fc[_0x5e60('0x30')](_0x45d979)['send'](_0x2b2426);};}exports[_0x5e60('0x38')]=function(_0x3f744d,_0x22d4ad){var _0x1a3782={},_0x200744={},_0x2aa7d4={'count':0x0,'rows':[]};var _0x261245=_['map'](db[_0x5e60('0x39')][_0x5e60('0x3a')],function(_0x4cba18){return{'name':_0x4cba18['fieldName'],'type':_0x4cba18[_0x5e60('0x3b')][_0x5e60('0x3c')]};});_0x200744[_0x5e60('0x3d')]=_[_0x5e60('0x3e')](_0x261245,_0x5e60('0x37'));_0x200744['query']=_[_0x5e60('0x3f')](_0x3f744d[_0x5e60('0x40')]);_0x200744[_0x5e60('0x41')]=_[_0x5e60('0x42')](_0x200744[_0x5e60('0x3d')],_0x200744[_0x5e60('0x40')]);_0x1a3782[_0x5e60('0x43')]=_['intersection'](_0x200744[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x3f744d['query']['fields']));_0x1a3782['attributes']=_0x1a3782[_0x5e60('0x43')][_0x5e60('0x45')]?_0x1a3782[_0x5e60('0x43')]:_0x200744[_0x5e60('0x3d')];if(!_0x3f744d['query'][_0x5e60('0x46')](_0x5e60('0x47'))){_0x1a3782['limit']=qs['limit'](_0x3f744d[_0x5e60('0x40')][_0x5e60('0x2f')]);_0x1a3782[_0x5e60('0x2e')]=qs[_0x5e60('0x2e')](_0x3f744d[_0x5e60('0x40')][_0x5e60('0x2e')]);}_0x1a3782[_0x5e60('0x48')]=qs[_0x5e60('0x49')](_0x3f744d[_0x5e60('0x40')]['sort']);_0x1a3782[_0x5e60('0x4a')]=qs[_0x5e60('0x41')](_['pick'](_0x3f744d[_0x5e60('0x40')],_0x200744[_0x5e60('0x41')]),_0x261245);if(_0x3f744d[_0x5e60('0x40')][_0x5e60('0x4b')]){_0x1a3782[_0x5e60('0x4a')]=_['merge'](_0x1a3782[_0x5e60('0x4a')],{'$or':_[_0x5e60('0x3e')](_0x261245,function(_0x172aff){if(_0x172aff[_0x5e60('0x3b')]!=='VIRTUAL'){var _0x4d9787={};_0x4d9787[_0x172aff['name']]={'$like':'%'+_0x3f744d[_0x5e60('0x40')][_0x5e60('0x4b')]+'%'};return _0x4d9787;}})});}_0x1a3782=_[_0x5e60('0x4c')]({},_0x1a3782,_0x3f744d[_0x5e60('0x4d')]);var _0x39c131={'where':_0x1a3782[_0x5e60('0x4a')]};return db['ServicenowConfiguration'][_0x5e60('0x2d')](_0x39c131)[_0x5e60('0x1f')](function(_0x165bea){_0x2aa7d4[_0x5e60('0x2d')]=_0x165bea;if(_0x3f744d[_0x5e60('0x40')][_0x5e60('0x4e')]){_0x1a3782[_0x5e60('0x4f')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x5e60('0x50')](_0x1a3782);})[_0x5e60('0x1f')](function(_0x21a116){_0x2aa7d4[_0x5e60('0x51')]=_0x21a116;return _0x2aa7d4;})[_0x5e60('0x1f')](respondWithFilteredResult(_0x22d4ad,_0x1a3782))[_0x5e60('0x29')](handleError(_0x22d4ad,null));};exports[_0x5e60('0x52')]=function(_0x4470bd,_0x1518bd){var _0x350d6d={'raw':![],'where':{'id':_0x4470bd[_0x5e60('0x53')]['id']}},_0xe5e675={};_0xe5e675[_0x5e60('0x3d')]=_[_0x5e60('0x3f')](db[_0x5e60('0x39')][_0x5e60('0x3a')]);_0xe5e675[_0x5e60('0x40')]=_[_0x5e60('0x3f')](_0x4470bd['query']);_0xe5e675['filters']=_[_0x5e60('0x42')](_0xe5e675['model'],_0xe5e675[_0x5e60('0x40')]);_0x350d6d[_0x5e60('0x43')]=_[_0x5e60('0x42')](_0xe5e675[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x4470bd[_0x5e60('0x40')]['fields']));_0x350d6d['attributes']=_0x350d6d[_0x5e60('0x43')][_0x5e60('0x45')]?_0x350d6d[_0x5e60('0x43')]:_0xe5e675['model'];if(_0x4470bd['query'][_0x5e60('0x4e')]){_0x350d6d[_0x5e60('0x4f')]=[{'all':!![]}];}_0x350d6d=_[_0x5e60('0x4c')]({},_0x350d6d,_0x4470bd['options']);return db[_0x5e60('0x39')][_0x5e60('0x54')](_0x350d6d)[_0x5e60('0x1f')](handleEntityNotFound(_0x1518bd,null))[_0x5e60('0x1f')](respondWithResult(_0x1518bd,null))[_0x5e60('0x29')](handleError(_0x1518bd,null));};exports[_0x5e60('0x55')]=function(_0x4ae313,_0x412be1){return db[_0x5e60('0x39')]['create'](_0x4ae313[_0x5e60('0x56')],{})[_0x5e60('0x1f')](respondWithResult(_0x412be1,0xc9))[_0x5e60('0x29')](handleError(_0x412be1,null));};exports['update']=function(_0xbe0bd5,_0x17429d){if(_0xbe0bd5['body']['id']){delete _0xbe0bd5[_0x5e60('0x56')]['id'];}return db[_0x5e60('0x39')][_0x5e60('0x54')]({'where':{'id':_0xbe0bd5[_0x5e60('0x53')]['id']}})['then'](handleEntityNotFound(_0x17429d,null))[_0x5e60('0x1f')](saveUpdates(_0xbe0bd5[_0x5e60('0x56')],null))['then'](respondWithResult(_0x17429d,null))[_0x5e60('0x29')](handleError(_0x17429d,null));};exports['destroy']=function(_0x8d00b9,_0x5220fc){return db[_0x5e60('0x39')][_0x5e60('0x54')]({'where':{'id':_0x8d00b9['params']['id']}})[_0x5e60('0x1f')](handleEntityNotFound(_0x5220fc,null))['then'](removeEntity(_0x5220fc,null))[_0x5e60('0x29')](handleError(_0x5220fc,null));};exports['getFields']=function(_0x157787,_0x5b4daa,_0x1481d0){var _0x17e178={};var _0xb1ef22={};var _0x28c2de;var _0x252fa3;return db[_0x5e60('0x39')][_0x5e60('0x57')]({'where':{'id':_0x157787['params']['id']}})[_0x5e60('0x1f')](handleEntityNotFound(_0x5b4daa,null))[_0x5e60('0x1f')](function(_0x442dbf){if(_0x442dbf){_0x28c2de=_0x442dbf;_0xb1ef22[_0x5e60('0x3d')]=_[_0x5e60('0x3f')](db[_0x5e60('0x58')]['rawAttributes']);_0xb1ef22['query']=_['keys'](_0x157787[_0x5e60('0x40')]);_0xb1ef22[_0x5e60('0x41')]=_['intersection'](_0xb1ef22[_0x5e60('0x3d')],_0xb1ef22[_0x5e60('0x40')]);_0x17e178['attributes']=_[_0x5e60('0x42')](_0xb1ef22[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x157787[_0x5e60('0x40')][_0x5e60('0x44')]));_0x17e178[_0x5e60('0x43')]=_0x17e178[_0x5e60('0x43')][_0x5e60('0x45')]?_0x17e178[_0x5e60('0x43')]:_0xb1ef22[_0x5e60('0x3d')];_0x17e178[_0x5e60('0x48')]=qs[_0x5e60('0x49')](_0x157787[_0x5e60('0x40')][_0x5e60('0x49')]);_0x17e178[_0x5e60('0x4a')]=qs[_0x5e60('0x41')](_[_0x5e60('0x59')](_0x157787['query'],_0xb1ef22[_0x5e60('0x41')]));if(_0x157787[_0x5e60('0x40')][_0x5e60('0x4b')]){_0x17e178['where']=_[_0x5e60('0x4c')](_0x17e178[_0x5e60('0x4a')],{'$or':_['map'](_0x17e178[_0x5e60('0x43')],function(_0x6f4d2f){var _0x5bbaaf={};_0x5bbaaf[_0x6f4d2f]={'$like':'%'+_0x157787[_0x5e60('0x40')][_0x5e60('0x4b')]+'%'};return _0x5bbaaf;})});}_0x17e178=_[_0x5e60('0x4c')]({},_0x17e178,_0x157787[_0x5e60('0x4d')]);return _0x28c2de[_0x5e60('0x5a')](_0x17e178);}})[_0x5e60('0x1f')](function(_0x221f35){if(_0x221f35){_0x252fa3=_0x221f35[_0x5e60('0x45')];if(!_0x157787[_0x5e60('0x40')]['hasOwnProperty'](_0x5e60('0x47'))){_0x17e178[_0x5e60('0x2f')]=qs[_0x5e60('0x2f')](_0x157787['query'][_0x5e60('0x2f')]);_0x17e178[_0x5e60('0x2e')]=qs[_0x5e60('0x2e')](_0x157787[_0x5e60('0x40')][_0x5e60('0x2e')]);}return _0x28c2de['getFields'](_0x17e178);}})[_0x5e60('0x1f')](function(_0x213c7e){if(_0x213c7e){return _0x213c7e?{'count':_0x252fa3,'rows':_0x213c7e}:null;}})[_0x5e60('0x1f')](respondWithResult(_0x5b4daa,null))['catch'](handleError(_0x5b4daa,null));};exports['getSubjects']=function(_0x3ecfbe,_0x265b5a,_0x13c6dc){var _0x25f6cb={};var _0x14fb46={};var _0x44ddaa;var _0x2c5b45;return db['ServicenowConfiguration'][_0x5e60('0x57')]({'where':{'id':_0x3ecfbe[_0x5e60('0x53')]['id']}})[_0x5e60('0x1f')](handleEntityNotFound(_0x265b5a,null))['then'](function(_0x5dd41b){if(_0x5dd41b){_0x44ddaa=_0x5dd41b;_0x14fb46[_0x5e60('0x3d')]=_[_0x5e60('0x3f')](db[_0x5e60('0x58')]['rawAttributes']);_0x14fb46['query']=_[_0x5e60('0x3f')](_0x3ecfbe[_0x5e60('0x40')]);_0x14fb46[_0x5e60('0x41')]=_[_0x5e60('0x42')](_0x14fb46[_0x5e60('0x3d')],_0x14fb46[_0x5e60('0x40')]);_0x25f6cb['attributes']=_[_0x5e60('0x42')](_0x14fb46[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x44')]));_0x25f6cb[_0x5e60('0x43')]=_0x25f6cb[_0x5e60('0x43')][_0x5e60('0x45')]?_0x25f6cb[_0x5e60('0x43')]:_0x14fb46['model'];_0x25f6cb[_0x5e60('0x48')]=qs[_0x5e60('0x49')](_0x3ecfbe['query'][_0x5e60('0x49')]);_0x25f6cb[_0x5e60('0x4a')]=qs['filters'](_[_0x5e60('0x59')](_0x3ecfbe[_0x5e60('0x40')],_0x14fb46[_0x5e60('0x41')]));if(_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x4b')]){_0x25f6cb[_0x5e60('0x4a')]=_['merge'](_0x25f6cb[_0x5e60('0x4a')],{'$or':_[_0x5e60('0x3e')](_0x25f6cb[_0x5e60('0x43')],function(_0x222d94){var _0x95d1c5={};_0x95d1c5[_0x222d94]={'$like':'%'+_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x4b')]+'%'};return _0x95d1c5;})});}_0x25f6cb=_[_0x5e60('0x4c')]({},_0x25f6cb,_0x3ecfbe[_0x5e60('0x4d')]);return _0x44ddaa['getSubjects'](_0x25f6cb);}})[_0x5e60('0x1f')](function(_0x6f826){if(_0x6f826){_0x2c5b45=_0x6f826[_0x5e60('0x45')];if(!_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x46')](_0x5e60('0x47'))){_0x25f6cb[_0x5e60('0x2f')]=qs[_0x5e60('0x2f')](_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x2f')]);_0x25f6cb['offset']=qs['offset'](_0x3ecfbe['query'][_0x5e60('0x2e')]);}return _0x44ddaa[_0x5e60('0x5b')](_0x25f6cb);}})[_0x5e60('0x1f')](function(_0x1a911a){if(_0x1a911a){return _0x1a911a?{'count':_0x2c5b45,'rows':_0x1a911a}:null;}})[_0x5e60('0x1f')](respondWithResult(_0x265b5a,null))[_0x5e60('0x29')](handleError(_0x265b5a,null));};exports[_0x5e60('0x5c')]=function(_0x58640c,_0x120fab,_0x4f9164){var _0x1d95fd={};var _0x42ac7c={};var _0x2afb9c;var _0x530e04;return db[_0x5e60('0x39')]['findOne']({'where':{'id':_0x58640c['params']['id']}})['then'](handleEntityNotFound(_0x120fab,null))[_0x5e60('0x1f')](function(_0x43803c){if(_0x43803c){_0x2afb9c=_0x43803c;_0x42ac7c[_0x5e60('0x3d')]=_[_0x5e60('0x3f')](db[_0x5e60('0x58')][_0x5e60('0x3a')]);_0x42ac7c[_0x5e60('0x40')]=_[_0x5e60('0x3f')](_0x58640c[_0x5e60('0x40')]);_0x42ac7c['filters']=_[_0x5e60('0x42')](_0x42ac7c[_0x5e60('0x3d')],_0x42ac7c[_0x5e60('0x40')]);_0x1d95fd[_0x5e60('0x43')]=_[_0x5e60('0x42')](_0x42ac7c[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x58640c[_0x5e60('0x40')][_0x5e60('0x44')]));_0x1d95fd[_0x5e60('0x43')]=_0x1d95fd[_0x5e60('0x43')][_0x5e60('0x45')]?_0x1d95fd['attributes']:_0x42ac7c[_0x5e60('0x3d')];_0x1d95fd[_0x5e60('0x48')]=qs[_0x5e60('0x49')](_0x58640c[_0x5e60('0x40')][_0x5e60('0x49')]);_0x1d95fd[_0x5e60('0x4a')]=qs[_0x5e60('0x41')](_[_0x5e60('0x59')](_0x58640c[_0x5e60('0x40')],_0x42ac7c[_0x5e60('0x41')]));if(_0x58640c[_0x5e60('0x40')][_0x5e60('0x4b')]){_0x1d95fd[_0x5e60('0x4a')]=_[_0x5e60('0x4c')](_0x1d95fd[_0x5e60('0x4a')],{'$or':_[_0x5e60('0x3e')](_0x1d95fd[_0x5e60('0x43')],function(_0x36d256){var _0x358bb5={};_0x358bb5[_0x36d256]={'$like':'%'+_0x58640c[_0x5e60('0x40')]['filter']+'%'};return _0x358bb5;})});}_0x1d95fd=_[_0x5e60('0x4c')]({},_0x1d95fd,_0x58640c[_0x5e60('0x4d')]);return _0x2afb9c[_0x5e60('0x5c')](_0x1d95fd);}})['then'](function(_0x4a4417){if(_0x4a4417){_0x530e04=_0x4a4417[_0x5e60('0x45')];if(!_0x58640c[_0x5e60('0x40')][_0x5e60('0x46')](_0x5e60('0x47'))){_0x1d95fd[_0x5e60('0x2f')]=qs[_0x5e60('0x2f')](_0x58640c[_0x5e60('0x40')][_0x5e60('0x2f')]);_0x1d95fd[_0x5e60('0x2e')]=qs[_0x5e60('0x2e')](_0x58640c[_0x5e60('0x40')][_0x5e60('0x2e')]);}return _0x2afb9c[_0x5e60('0x5c')](_0x1d95fd);}})[_0x5e60('0x1f')](function(_0x30e4a7){if(_0x30e4a7){return _0x30e4a7?{'count':_0x530e04,'rows':_0x30e4a7}:null;}})[_0x5e60('0x1f')](respondWithResult(_0x120fab,null))[_0x5e60('0x29')](handleError(_0x120fab,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e46dbba..dfa7842 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 _0x5b12=['int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','ServicenowConfiguration'];(function(_0x10e326,_0xf72960){var _0x2f2fa4=function(_0x5215f6){while(--_0x5215f6){_0x10e326['push'](_0x10e326['shift']());}};_0x2f2fa4(++_0xf72960);}(_0x5b12,0xa3));var _0x25b1=function(_0x389a15,_0x1312b5){_0x389a15=_0x389a15-0x0;var _0x218517=_0x5b12[_0x389a15];return _0x218517;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var logger=require(_0x25b1('0x2'))('api');var moment=require(_0x25b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x25b1('0x4'));var fs=require('fs');var path=require(_0x25b1('0x5'));var rimraf=require('rimraf');var config=require(_0x25b1('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x35d90b,_0x5523c9){return _0x35d90b['define'](_0x25b1('0x7'),attributes,{'tableName':_0x25b1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e5a=['int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x5b8be5,_0x3c6226){var _0x277029=function(_0xdf6dff){while(--_0xdf6dff){_0x5b8be5['push'](_0x5b8be5['shift']());}};_0x277029(++_0x3c6226);}(_0x1e5a,0xb5));var _0xa1e5=function(_0x3a235a,_0x1e593f){_0x3a235a=_0x3a235a-0x0;var _0x1a6e21=_0x1e5a[_0x3a235a];return _0x1a6e21;};'use strict';var _=require(_0xa1e5('0x0'));var util=require(_0xa1e5('0x1'));var logger=require(_0xa1e5('0x2'))(_0xa1e5('0x3'));var moment=require(_0xa1e5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa1e5('0x5'));var fs=require('fs');var path=require(_0xa1e5('0x6'));var rimraf=require(_0xa1e5('0x7'));var config=require('../../config/environment');var attributes=require(_0xa1e5('0x8'));module['exports']=function(_0x40845b,_0x41236a){return _0x40845b[_0xa1e5('0x9')](_0xa1e5('0xa'),attributes,{'tableName':_0xa1e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 6d8d8ca..9ca61a1 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 _0xdd1c=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4f42c5,_0x33b0af){var _0x4f9764=function(_0x547ed8){while(--_0x547ed8){_0x4f42c5['push'](_0x4f42c5['shift']());}};_0x4f9764(++_0x33b0af);}(_0xdd1c,0xda));var _0xcdd1=function(_0x4cefbc,_0x3ffa6c){_0x4cefbc=_0x4cefbc-0x0;var _0x423c86=_0xdd1c[_0x4cefbc];return _0x423c86;};'use strict';var _=require(_0xcdd1('0x0'));var util=require(_0xcdd1('0x1'));var moment=require(_0xcdd1('0x2'));var BPromise=require(_0xcdd1('0x3'));var rs=require(_0xcdd1('0x4'));var fs=require('fs');var Redis=require(_0xcdd1('0x5'));var db=require(_0xcdd1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdd1('0x7'))(_0xcdd1('0x8'));var config=require(_0xcdd1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcdd1('0xa')][_0xcdd1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17645a,_0x31efd4,_0x4c287b){return new BPromise(function(_0x241d64,_0x515254){return client[_0xcdd1('0xc')](_0x17645a,_0x4c287b)[_0xcdd1('0xd')](function(_0xa9a090){logger[_0xcdd1('0xe')](_0xcdd1('0xf'),_0x31efd4,_0xcdd1('0x10'));logger[_0xcdd1('0x11')](_0xcdd1('0x12'),_0x31efd4,_0xcdd1('0x10'),JSON[_0xcdd1('0x13')](_0xa9a090));if(_0xa9a090[_0xcdd1('0x14')]){if(_0xa9a090[_0xcdd1('0x14')][_0xcdd1('0x15')]===0x1f4){logger[_0xcdd1('0x14')](_0xcdd1('0xf'),_0x31efd4,_0xa9a090[_0xcdd1('0x14')][_0xcdd1('0x16')]);return _0x515254(_0xa9a090[_0xcdd1('0x14')][_0xcdd1('0x16')]);}logger[_0xcdd1('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x31efd4,_0xa9a090[_0xcdd1('0x14')][_0xcdd1('0x16')]);return _0x241d64(_0xa9a090['error']['message']);}else{logger[_0xcdd1('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x31efd4,_0xcdd1('0x10'));_0x241d64(_0xa9a090['result'][_0xcdd1('0x16')]);}})[_0xcdd1('0x17')](function(_0xa0d4d8){logger[_0xcdd1('0x14')](_0xcdd1('0xf'),_0x31efd4,_0xa0d4d8);_0x515254(_0xa0d4d8);});});} \ No newline at end of file +var _0x3809=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x26c129,_0x2f91d5){var _0xedee64=function(_0x517bb2){while(--_0x517bb2){_0x26c129['push'](_0x26c129['shift']());}};_0xedee64(++_0x2f91d5);}(_0x3809,0x13d));var _0x9380=function(_0x5e5116,_0x49cda7){_0x5e5116=_0x5e5116-0x0;var _0x5e3bb9=_0x3809[_0x5e5116];return _0x5e3bb9;};'use strict';var _=require(_0x9380('0x0'));var util=require(_0x9380('0x1'));var moment=require(_0x9380('0x2'));var BPromise=require('bluebird');var rs=require(_0x9380('0x3'));var fs=require('fs');var Redis=require(_0x9380('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9380('0x5'));var logger=require('../../config/logger')(_0x9380('0x6'));var config=require(_0x9380('0x7'));var jayson=require(_0x9380('0x8'));var client=jayson['client'][_0x9380('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c804b,_0x2a2a33,_0x18b29e){return new BPromise(function(_0x2d2a49,_0x228907){return client[_0x9380('0xa')](_0x1c804b,_0x18b29e)['then'](function(_0x2a851a){logger[_0x9380('0xb')](_0x9380('0xc'),_0x2a2a33,'request\x20sent');logger['debug'](_0x9380('0xd'),_0x2a2a33,_0x9380('0xe'),JSON[_0x9380('0xf')](_0x2a851a));if(_0x2a851a[_0x9380('0x10')]){if(_0x2a851a[_0x9380('0x10')][_0x9380('0x11')]===0x1f4){logger[_0x9380('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2a2a33,_0x2a851a[_0x9380('0x10')][_0x9380('0x12')]);return _0x228907(_0x2a851a[_0x9380('0x10')][_0x9380('0x12')]);}logger[_0x9380('0x10')](_0x9380('0xc'),_0x2a2a33,_0x2a851a[_0x9380('0x10')][_0x9380('0x12')]);return _0x2d2a49(_0x2a851a[_0x9380('0x10')][_0x9380('0x12')]);}else{logger[_0x9380('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2a2a33,_0x9380('0xe'));_0x2d2a49(_0x2a851a['result'][_0x9380('0x12')]);}})[_0x9380('0x13')](function(_0x3d080d){logger[_0x9380('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2a2a33,_0x3d080d);_0x228907(_0x3d080d);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b885de2..c037805 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 _0x2288=['create','put','update','multer','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x2445d8,_0x22e09b){var _0x3e6299=function(_0x37eae3){while(--_0x37eae3){_0x2445d8['push'](_0x2445d8['shift']());}};_0x3e6299(++_0x22e09b);}(_0x2288,0x6c));var _0x8228=function(_0x15703b,_0x392f5d){_0x15703b=_0x15703b-0x0;var _0x487395=_0x2288[_0x15703b];return _0x487395;};'use strict';var multer=require(_0x8228('0x0'));var util=require('util');var path=require(_0x8228('0x1'));var timeout=require(_0x8228('0x2'));var express=require(_0x8228('0x3'));var router=express[_0x8228('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8228('0x5'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x8228('0x6')](),controller[_0x8228('0x7')]);router[_0x8228('0x8')](_0x8228('0x9'),auth['isAuthenticated'](),controller[_0x8228('0xa')]);router[_0x8228('0xb')]('/',auth[_0x8228('0x6')](),controller[_0x8228('0xc')]);router[_0x8228('0xd')](_0x8228('0x9'),auth[_0x8228('0x6')](),controller[_0x8228('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd1c4=['put','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x368646,_0xb9ed0b){var _0x381a6d=function(_0x292332){while(--_0x292332){_0x368646['push'](_0x368646['shift']());}};_0x381a6d(++_0xb9ed0b);}(_0xd1c4,0x1bc));var _0x4d1c=function(_0x20cdd2,_0x24da9b){_0x20cdd2=_0x20cdd2-0x0;var _0x8bd09e=_0xd1c4[_0x20cdd2];return _0x8bd09e;};'use strict';var multer=require('multer');var util=require(_0x4d1c('0x0'));var path=require(_0x4d1c('0x1'));var timeout=require('connect-timeout');var express=require(_0x4d1c('0x2'));var router=express[_0x4d1c('0x3')]();var auth=require(_0x4d1c('0x4'));var interaction=require(_0x4d1c('0x5'));var config=require(_0x4d1c('0x6'));var controller=require(_0x4d1c('0x7'));router[_0x4d1c('0x8')]('/',auth[_0x4d1c('0x9')](),controller[_0x4d1c('0xa')]);router['get'](_0x4d1c('0xb'),auth[_0x4d1c('0x9')](),controller[_0x4d1c('0xc')]);router[_0x4d1c('0xd')]('/',auth['isAuthenticated'](),controller[_0x4d1c('0xe')]);router[_0x4d1c('0xf')](_0x4d1c('0xb'),auth[_0x4d1c('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4d1c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index fb7692b..8556ba1 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 _0xe51b=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2bb24b,_0x421886){var _0x24ac0f=function(_0x2386f3){while(--_0x2386f3){_0x2bb24b['push'](_0x2bb24b['shift']());}};_0x24ac0f(++_0x421886);}(_0xe51b,0x177));var _0xbe51=function(_0x3f36f2,_0x380621){_0x3f36f2=_0x3f36f2-0x0;var _0x15821b=_0xe51b[_0x3f36f2];return _0x15821b;};'use strict';var Sequelize=require(_0xbe51('0x0'));module[_0xbe51('0x1')]={'type':{'type':Sequelize[_0xbe51('0x2')](_0xbe51('0x3'),_0xbe51('0x4'),_0xbe51('0x5'),_0xbe51('0x6')),'defaultValue':_0xbe51('0x3')},'content':{'type':Sequelize[_0xbe51('0x7')]},'key':{'type':Sequelize[_0xbe51('0x7')]},'keyType':{'type':Sequelize[_0xbe51('0x2')](_0xbe51('0x3'),'variable',_0xbe51('0x5'))},'keyContent':{'type':Sequelize[_0xbe51('0x7')]},'idField':{'type':Sequelize[_0xbe51('0x7')]},'nameField':{'type':Sequelize[_0xbe51('0x7')]},'customField':{'type':Sequelize[_0xbe51('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbe51('0x7')]}}; \ No newline at end of file +var _0x8756=['customVariable','keyValue','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x8756,0xc2));var _0x6875=function(_0x1793ef,_0x9f1e1){_0x1793ef=_0x1793ef-0x0;var _0x299901=_0x8756[_0x1793ef];return _0x299901;};'use strict';var Sequelize=require(_0x6875('0x0'));module[_0x6875('0x1')]={'type':{'type':Sequelize[_0x6875('0x2')]('string',_0x6875('0x3'),_0x6875('0x4'),_0x6875('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6875('0x6')]},'key':{'type':Sequelize[_0x6875('0x6')]},'keyType':{'type':Sequelize[_0x6875('0x2')](_0x6875('0x7'),_0x6875('0x3'),_0x6875('0x4'))},'keyContent':{'type':Sequelize[_0x6875('0x6')]},'idField':{'type':Sequelize[_0x6875('0x6')]},'nameField':{'type':Sequelize[_0x6875('0x6')]},'customField':{'type':Sequelize[_0x6875('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6875('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 9fc839b..c91ec62 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(_0x47f785,_0x1d1a9e){var _0x3e8b44=function(_0x757060){while(--_0x757060){_0x47f785['push'](_0x47f785['shift']());}};_0x3e8b44(++_0x1d1a9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x2ace95,_0x186b37){var _0x35ecfa=function(_0x26ce5a){while(--_0x26ce5a){_0x2ace95['push'](_0x2ace95['shift']());}};_0x35ecfa(++_0x186b37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 8927df3..e9ca2f0 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 _0x8122=['request-promise','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x431c7c,_0x5170e8){var _0x3d548a=function(_0x33d2d9){while(--_0x33d2d9){_0x431c7c['push'](_0x431c7c['shift']());}};_0x3d548a(++_0x5170e8);}(_0x8122,0x16a));var _0x2812=function(_0x7d9f57,_0x5eed70){_0x7d9f57=_0x7d9f57-0x0;var _0x3db58f=_0x8122[_0x7d9f57];return _0x3db58f;};'use strict';var _=require(_0x2812('0x0'));var util=require(_0x2812('0x1'));var logger=require(_0x2812('0x2'))(_0x2812('0x3'));var moment=require(_0x2812('0x4'));var BPromise=require(_0x2812('0x5'));var rp=require(_0x2812('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2812('0x7'));var config=require(_0x2812('0x8'));var attributes=require(_0x2812('0x9'));module['exports']=function(_0x5ab69c,_0xd6cad6){return _0x5ab69c[_0x2812('0xa')](_0x2812('0xb'),attributes,{'tableName':_0x2812('0xc'),'paranoid':![],'indexes':[{'name':_0x2812('0xd'),'fields':[_0x2812('0xe'),_0x2812('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb43d=['../../config/logger','api','moment','path','./intServicenowField.attributes','exports','define','int_servicenow_fields','FieldId','lodash','util'];(function(_0x4c750c,_0x3614ab){var _0x5d4cb8=function(_0x175dd1){while(--_0x175dd1){_0x4c750c['push'](_0x4c750c['shift']());}};_0x5d4cb8(++_0x3614ab);}(_0xb43d,0x169));var _0xdb43=function(_0x15807f,_0x576d8a){_0x15807f=_0x15807f-0x0;var _0x66fab1=_0xb43d[_0x15807f];return _0x66fab1;};'use strict';var _=require(_0xdb43('0x0'));var util=require(_0xdb43('0x1'));var logger=require(_0xdb43('0x2'))(_0xdb43('0x3'));var moment=require(_0xdb43('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb43('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdb43('0x6'));module[_0xdb43('0x7')]=function(_0x5378dc,_0x37191b){return _0x5378dc[_0xdb43('0x8')]('ServicenowField',attributes,{'tableName':_0xdb43('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xdb43('0xa')],'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 c6f1344..99a91c7 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 _0x9655=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x16b561,_0x5a914f){var _0x22599f=function(_0x27ce85){while(--_0x27ce85){_0x16b561['push'](_0x16b561['shift']());}};_0x22599f(++_0x5a914f);}(_0x9655,0x151));var _0x5965=function(_0x1c6594,_0x6f51e5){_0x1c6594=_0x1c6594-0x0;var _0x414bce=_0x9655[_0x1c6594];return _0x414bce;};'use strict';var _=require('lodash');var util=require(_0x5965('0x0'));var moment=require(_0x5965('0x1'));var BPromise=require('bluebird');var rs=require(_0x5965('0x2'));var fs=require('fs');var Redis=require(_0x5965('0x3'));var db=require(_0x5965('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5965('0x5'))('rpc');var config=require(_0x5965('0x6'));var jayson=require(_0x5965('0x7'));var client=jayson[_0x5965('0x8')][_0x5965('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126257,_0x1640e6,_0x54502a){return new BPromise(function(_0x219e2,_0x303d9d){return client['request'](_0x126257,_0x54502a)['then'](function(_0x46bbb4){logger['info'](_0x5965('0xa'),_0x1640e6,'request\x20sent');logger[_0x5965('0xb')](_0x5965('0xc'),_0x1640e6,_0x5965('0xd'),JSON[_0x5965('0xe')](_0x46bbb4));if(_0x46bbb4[_0x5965('0xf')]){if(_0x46bbb4[_0x5965('0xf')][_0x5965('0x10')]===0x1f4){logger[_0x5965('0xf')](_0x5965('0xa'),_0x1640e6,_0x46bbb4[_0x5965('0xf')][_0x5965('0x11')]);return _0x303d9d(_0x46bbb4[_0x5965('0xf')][_0x5965('0x11')]);}logger[_0x5965('0xf')](_0x5965('0xa'),_0x1640e6,_0x46bbb4[_0x5965('0xf')][_0x5965('0x11')]);return _0x219e2(_0x46bbb4['error'][_0x5965('0x11')]);}else{logger[_0x5965('0x12')](_0x5965('0xa'),_0x1640e6,_0x5965('0xd'));_0x219e2(_0x46bbb4[_0x5965('0x13')][_0x5965('0x11')]);}})[_0x5965('0x14')](function(_0x1e68be){logger[_0x5965('0xf')](_0x5965('0xa'),_0x1640e6,_0x1e68be);_0x303d9d(_0x1e68be);});});} \ No newline at end of file +var _0xd983=['request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4ab987,_0x387b40){var _0x2d3984=function(_0x2c6fdf){while(--_0x2c6fdf){_0x4ab987['push'](_0x4ab987['shift']());}};_0x2d3984(++_0x387b40);}(_0xd983,0xdb));var _0x3d98=function(_0x37f65f,_0x1c0839){_0x37f65f=_0x37f65f-0x0;var _0x39444c=_0xd983[_0x37f65f];return _0x39444c;};'use strict';var _=require('lodash');var util=require(_0x3d98('0x0'));var moment=require(_0x3d98('0x1'));var BPromise=require(_0x3d98('0x2'));var rs=require(_0x3d98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d98('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d98('0x5'))(_0x3d98('0x6'));var config=require(_0x3d98('0x7'));var jayson=require(_0x3d98('0x8'));var client=jayson[_0x3d98('0x9')][_0x3d98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12b5cf,_0xeedf21,_0x5a40ab){return new BPromise(function(_0x5b310b,_0x23c076){return client[_0x3d98('0xb')](_0x12b5cf,_0x5a40ab)[_0x3d98('0xc')](function(_0x456afd){logger[_0x3d98('0xd')](_0x3d98('0xe'),_0xeedf21,_0x3d98('0xf'));logger[_0x3d98('0x10')](_0x3d98('0x11'),_0xeedf21,'request\x20sent',JSON[_0x3d98('0x12')](_0x456afd));if(_0x456afd[_0x3d98('0x13')]){if(_0x456afd[_0x3d98('0x13')][_0x3d98('0x14')]===0x1f4){logger[_0x3d98('0x13')](_0x3d98('0xe'),_0xeedf21,_0x456afd[_0x3d98('0x13')][_0x3d98('0x15')]);return _0x23c076(_0x456afd[_0x3d98('0x13')][_0x3d98('0x15')]);}logger['error'](_0x3d98('0xe'),_0xeedf21,_0x456afd[_0x3d98('0x13')][_0x3d98('0x15')]);return _0x5b310b(_0x456afd[_0x3d98('0x13')][_0x3d98('0x15')]);}else{logger[_0x3d98('0xd')]('ServicenowField,\x20%s,\x20%s',_0xeedf21,'request\x20sent');_0x5b310b(_0x456afd[_0x3d98('0x16')]['message']);}})['catch'](function(_0x413f73){logger['error'](_0x3d98('0xe'),_0xeedf21,_0x413f73);_0x23c076(_0x413f73);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 04938a7..500f0f7 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 _0x8406=['index','get','/:id','show','/:id/configurations','/:id/fields','getFields','create','put','update','destroy','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8406,0x174));var _0x6840=function(_0x4dbf2f,_0x164944){_0x4dbf2f=_0x4dbf2f-0x0;var _0x4db0ba=_0x8406[_0x4dbf2f];return _0x4db0ba;};'use strict';var multer=require(_0x6840('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6840('0x1'));var express=require(_0x6840('0x2'));var router=express[_0x6840('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6840('0x4'));var config=require(_0x6840('0x5'));var controller=require(_0x6840('0x6'));router['get']('/',auth[_0x6840('0x7')](),controller[_0x6840('0x8')]);router[_0x6840('0x9')](_0x6840('0xa'),auth[_0x6840('0x7')](),controller[_0x6840('0xb')]);router['get'](_0x6840('0xc'),auth[_0x6840('0x7')](),controller['getConfigurations']);router[_0x6840('0x9')](_0x6840('0xd'),auth[_0x6840('0x7')](),controller[_0x6840('0xe')]);router['post']('/',auth[_0x6840('0x7')](),controller[_0x6840('0xf')]);router['post'](_0x6840('0xc'),auth[_0x6840('0x7')](),controller['addConfiguration']);router[_0x6840('0x10')](_0x6840('0xa'),auth[_0x6840('0x7')](),controller[_0x6840('0x11')]);router['delete'](_0x6840('0xa'),auth[_0x6840('0x7')](),controller[_0x6840('0x12')]);module['exports']=router; \ No newline at end of file +var _0xcca4=['../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','index','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4ee9c9,_0x4573f8){var _0x24e5b0=function(_0x373f91){while(--_0x373f91){_0x4ee9c9['push'](_0x4ee9c9['shift']());}};_0x24e5b0(++_0x4573f8);}(_0xcca4,0xc2));var _0x4cca=function(_0x1f4172,_0x4b7c1d){_0x1f4172=_0x1f4172-0x0;var _0x4cd833=_0xcca4[_0x1f4172];return _0x4cd833;};'use strict';var multer=require(_0x4cca('0x0'));var util=require('util');var path=require(_0x4cca('0x1'));var timeout=require(_0x4cca('0x2'));var express=require(_0x4cca('0x3'));var router=express[_0x4cca('0x4')]();var auth=require(_0x4cca('0x5'));var interaction=require(_0x4cca('0x6'));var config=require(_0x4cca('0x7'));var controller=require(_0x4cca('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4cca('0x9')]);router[_0x4cca('0xa')]('/:id',auth[_0x4cca('0xb')](),controller[_0x4cca('0xc')]);router[_0x4cca('0xa')](_0x4cca('0xd'),auth['isAuthenticated'](),controller[_0x4cca('0xe')]);router['get'](_0x4cca('0xf'),auth[_0x4cca('0xb')](),controller[_0x4cca('0x10')]);router['post']('/',auth[_0x4cca('0xb')](),controller[_0x4cca('0x11')]);router[_0x4cca('0x12')](_0x4cca('0xd'),auth['isAuthenticated'](),controller[_0x4cca('0x13')]);router[_0x4cca('0x14')](_0x4cca('0x15'),auth[_0x4cca('0xb')](),controller[_0x4cca('0x16')]);router['delete'](_0x4cca('0x15'),auth[_0x4cca('0xb')](),controller[_0x4cca('0x17')]);module[_0x4cca('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index c3e6229..9f5a598 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 _0x930e=['username','remoteUri','sequelize','exports','STRING'];(function(_0x1c4f74,_0x59549b){var _0x5018bb=function(_0x1c8776){while(--_0x1c8776){_0x1c4f74['push'](_0x1c4f74['shift']());}};_0x5018bb(++_0x59549b);}(_0x930e,0x179));var _0xe930=function(_0x88746b,_0x586f4c){_0x88746b=_0x88746b-0x0;var _0x102160=_0x930e[_0x88746b];return _0x102160;};'use strict';var Sequelize=require(_0xe930('0x0'));module[_0xe930('0x1')]={'name':{'type':Sequelize[_0xe930('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe930('0x2')],'unique':_0xe930('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe930('0x4')},'serverUrl':{'type':Sequelize[_0xe930('0x2')]}}; \ No newline at end of file +var _0x54e9=['username','STRING'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x54e9,0xbd));var _0x954e=function(_0x3c560a,_0x1c46d4){_0x3c560a=_0x3c560a-0x0;var _0x22e9be=_0x54e9[_0x3c560a];return _0x22e9be;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x954e('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x954e('0x1')},'password':{'type':Sequelize[_0x954e('0x0')]},'remoteUri':{'type':Sequelize[_0x954e('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x954e('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index fb76fa4..2f77ad0 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 _0x4b29=['fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','show','find','create','body','params','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','created_by','description','parent_id','parent_type','parent_name','username','password','remoteUri','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes'];(function(_0x259baf,_0x8574de){var _0x55d9c2=function(_0x4555d9){while(--_0x4555d9){_0x259baf['push'](_0x259baf['shift']());}};_0x55d9c2(++_0x8574de);}(_0x4b29,0x1cf));var _0x94b2=function(_0x58f695,_0x405614){_0x58f695=_0x58f695-0x0;var _0x56ebcf=_0x4b29[_0x58f695];return _0x56ebcf;};'use strict';var pdf=require(_0x94b2('0x0'));var emlformat=require(_0x94b2('0x1'));var rimraf=require(_0x94b2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94b2('0x3'));var rp=require('request-promise');var moment=require(_0x94b2('0x4'));var BPromise=require(_0x94b2('0x5'));var Mustache=require(_0x94b2('0x6'));var util=require(_0x94b2('0x7'));var path=require('path');var sox=require(_0x94b2('0x8'));var csv=require(_0x94b2('0x9'));var ejs=require(_0x94b2('0xa'));var fs=require('fs');var _=require(_0x94b2('0xb'));var squel=require(_0x94b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x94b2('0xd'));var deskjs=require(_0x94b2('0xe'));var toCsv=require(_0x94b2('0x9'));var querystring=require(_0x94b2('0xf'));var Papa=require(_0x94b2('0x10'));var Redis=require(_0x94b2('0x11'));var authService=require(_0x94b2('0x12'));var qs=require(_0x94b2('0x13'));var as=require(_0x94b2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x94b2('0x15'))(_0x94b2('0x16'));var utils=require(_0x94b2('0x17'));var config=require(_0x94b2('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x94b2('0x19'));var jayson=require(_0x94b2('0x1a'));var client=jayson[_0x94b2('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x4c25e1,_0x558037,_0x2568f0){if(_0x2568f0){var _0xcec682=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcec682[_0x94b2('0x1c')](_0x558037)){return _0x4c25e1;}else{throw new db[(_0x94b2('0x1d'))][(_0x94b2('0x1e'))](_0x94b2('0x1f'));}}else{return _0x4c25e1;}}function respondWithRpcPromise(_0x379a0a,_0x5e82ff,_0xec55f2,_0x25d317){return new BPromise(function(_0x499190,_0x12d2ab){var _0x4b183c=_0x25d317||client;return _0x4b183c[_0x94b2('0x20')](_0x379a0a,_0xec55f2)['then'](function(_0x192a9c){logger[_0x94b2('0x21')](_0x94b2('0x22'),_0x5e82ff,_0x94b2('0x23'));logger[_0x94b2('0x24')](_0x94b2('0x25'),_0x5e82ff,'request\x20sent',JSON[_0x94b2('0x26')](_0x192a9c));if(_0x192a9c['error']){if(_0x192a9c['error'][_0x94b2('0x27')]===0x1f4){logger['error'](_0x94b2('0x22'),_0x5e82ff,_0x192a9c[_0x94b2('0x28')][_0x94b2('0x29')]);return _0x12d2ab(_0x192a9c['error'][_0x94b2('0x29')]);}logger[_0x94b2('0x28')](_0x94b2('0x22'),_0x5e82ff,_0x192a9c[_0x94b2('0x28')][_0x94b2('0x29')]);return _0x499190(_0x192a9c['error']['message']);}else{logger[_0x94b2('0x21')](_0x94b2('0x22'),_0x5e82ff,'request\x20sent');_0x499190(_0x192a9c[_0x94b2('0x2a')][_0x94b2('0x29')]);}})[_0x94b2('0x2b')](function(_0x3f2ce1){logger[_0x94b2('0x28')](_0x94b2('0x22'),_0x5e82ff,_0x3f2ce1);_0x12d2ab(_0x3f2ce1);});});}function respondWithStatusCode(_0x2b4e5d,_0xfe18ca){_0xfe18ca=_0xfe18ca||0xcc;return function(_0x52c6a1){if(_0x52c6a1){return _0x2b4e5d[_0x94b2('0x2c')](_0xfe18ca);}return _0x2b4e5d[_0x94b2('0x2d')](_0xfe18ca)[_0x94b2('0x2e')]();};}function respondWithResult(_0x216dbd,_0x4412d1){_0x4412d1=_0x4412d1||0xc8;return function(_0x1e9d4e){if(_0x1e9d4e){return _0x216dbd[_0x94b2('0x2d')](_0x4412d1)[_0x94b2('0x2f')](_0x1e9d4e);}};}function respondWithFilteredResult(_0x403705,_0x2badc4){return function(_0x28cefd){if(_0x28cefd){var _0x272dff=_0x28cefd['count'],_0x466137=_0x2badc4[_0x94b2('0x30')],_0x17e50d=_0x2badc4[_0x94b2('0x30')]+_0x2badc4[_0x94b2('0x31')],_0x473565;if(_0x17e50d>=_0x272dff){_0x17e50d=_0x272dff;_0x473565=0xc8;}else{_0x473565=0xce;}_0x403705['status'](_0x473565);return _0x403705[_0x94b2('0x32')](_0x94b2('0x33'),_0x466137+'-'+_0x17e50d+'/'+_0x272dff)[_0x94b2('0x2f')](_0x28cefd);}return null;};}function patchUpdates(_0xb026f1){return function(_0x2b6a96){try{jsonpatch[_0x94b2('0x34')](_0x2b6a96,_0xb026f1,!![]);}catch(_0x10e734){return BPromise[_0x94b2('0x35')](_0x10e734);}return _0x2b6a96[_0x94b2('0x36')]();};}function saveUpdates(_0x4ef294,_0x504f74){return function(_0x4673f7){if(_0x4673f7){return _0x4673f7[_0x94b2('0x37')](_0x4ef294)[_0x94b2('0x38')](function(_0x18ef03){return _0x18ef03;});}return null;};}function removeEntity(_0x28779d,_0x348d4b){return function(_0x4c51fc){if(_0x4c51fc){return _0x4c51fc[_0x94b2('0x39')]()['then'](function(){_0x28779d[_0x94b2('0x2d')](0xcc)[_0x94b2('0x2e')]();});}};}function handleEntityNotFound(_0xebbdda,_0x3bb584){return function(_0x4490e2){if(!_0x4490e2){_0xebbdda[_0x94b2('0x2c')](0x194);}return _0x4490e2;};}function handleError(_0x4d67e4,_0x256005){_0x256005=_0x256005||0x1f4;return function(_0x5455d4){logger[_0x94b2('0x28')](_0x5455d4[_0x94b2('0x3a')]);if(_0x5455d4[_0x94b2('0x3b')]){delete _0x5455d4[_0x94b2('0x3b')];}_0x4d67e4[_0x94b2('0x2d')](_0x256005)[_0x94b2('0x3c')](_0x5455d4);};}exports[_0x94b2('0x3d')]=function(_0x4e788f,_0x2a6d4c){var _0x1adbcf={},_0x4e2ab6={},_0x3b88d2={'count':0x0,'rows':[]};var _0x3116b9=_[_0x94b2('0x3e')](db[_0x94b2('0x3f')][_0x94b2('0x40')],function(_0x529193){return{'name':_0x529193[_0x94b2('0x41')],'type':_0x529193[_0x94b2('0x42')][_0x94b2('0x43')]};});_0x4e2ab6[_0x94b2('0x44')]=_[_0x94b2('0x3e')](_0x3116b9,'name');_0x4e2ab6[_0x94b2('0x45')]=_[_0x94b2('0x46')](_0x4e788f['query']);_0x4e2ab6['filters']=_[_0x94b2('0x47')](_0x4e2ab6['model'],_0x4e2ab6['query']);_0x1adbcf['attributes']=_[_0x94b2('0x47')](_0x4e2ab6[_0x94b2('0x44')],qs[_0x94b2('0x48')](_0x4e788f[_0x94b2('0x45')][_0x94b2('0x48')]));_0x1adbcf[_0x94b2('0x49')]=_0x1adbcf[_0x94b2('0x49')][_0x94b2('0x4a')]?_0x1adbcf[_0x94b2('0x49')]:_0x4e2ab6[_0x94b2('0x44')];if(!_0x4e788f[_0x94b2('0x45')][_0x94b2('0x4b')](_0x94b2('0x4c'))){_0x1adbcf[_0x94b2('0x31')]=qs[_0x94b2('0x31')](_0x4e788f[_0x94b2('0x45')]['limit']);_0x1adbcf[_0x94b2('0x30')]=qs[_0x94b2('0x30')](_0x4e788f['query'][_0x94b2('0x30')]);}_0x1adbcf[_0x94b2('0x4d')]=qs[_0x94b2('0x4e')](_0x4e788f[_0x94b2('0x45')][_0x94b2('0x4e')]);_0x1adbcf['where']=qs[_0x94b2('0x4f')](_[_0x94b2('0x50')](_0x4e788f[_0x94b2('0x45')],_0x4e2ab6[_0x94b2('0x4f')]),_0x3116b9);if(_0x4e788f['query'][_0x94b2('0x51')]){_0x1adbcf[_0x94b2('0x52')]=_[_0x94b2('0x53')](_0x1adbcf[_0x94b2('0x52')],{'$or':_[_0x94b2('0x3e')](_0x3116b9,function(_0x27095f){if(_0x27095f[_0x94b2('0x42')]!=='VIRTUAL'){var _0x578107={};_0x578107[_0x27095f['name']]={'$like':'%'+_0x4e788f['query'][_0x94b2('0x51')]+'%'};return _0x578107;}})});}_0x1adbcf=_[_0x94b2('0x53')]({},_0x1adbcf,_0x4e788f[_0x94b2('0x54')]);var _0x8a44c2={'where':_0x1adbcf[_0x94b2('0x52')]};return db[_0x94b2('0x3f')][_0x94b2('0x55')](_0x8a44c2)[_0x94b2('0x38')](function(_0x4fdbe8){_0x3b88d2[_0x94b2('0x55')]=_0x4fdbe8;if(_0x4e788f[_0x94b2('0x45')][_0x94b2('0x56')]){_0x1adbcf[_0x94b2('0x57')]=[{'all':!![]}];}return db[_0x94b2('0x3f')][_0x94b2('0x58')](_0x1adbcf);})[_0x94b2('0x38')](function(_0x43c1f5){_0x3b88d2[_0x94b2('0x59')]=_0x43c1f5;return _0x3b88d2;})[_0x94b2('0x38')](respondWithFilteredResult(_0x2a6d4c,_0x1adbcf))[_0x94b2('0x2b')](handleError(_0x2a6d4c,null));};exports[_0x94b2('0x5a')]=function(_0x4c8e9e,_0x171410){var _0x551bc1={'raw':![],'where':{'id':_0x4c8e9e['params']['id']}},_0x26c533={};_0x26c533[_0x94b2('0x44')]=_[_0x94b2('0x46')](db[_0x94b2('0x3f')][_0x94b2('0x40')]);_0x26c533[_0x94b2('0x45')]=_[_0x94b2('0x46')](_0x4c8e9e[_0x94b2('0x45')]);_0x26c533['filters']=_[_0x94b2('0x47')](_0x26c533[_0x94b2('0x44')],_0x26c533['query']);_0x551bc1[_0x94b2('0x49')]=_['intersection'](_0x26c533[_0x94b2('0x44')],qs[_0x94b2('0x48')](_0x4c8e9e[_0x94b2('0x45')][_0x94b2('0x48')]));_0x551bc1[_0x94b2('0x49')]=_0x551bc1[_0x94b2('0x49')][_0x94b2('0x4a')]?_0x551bc1['attributes']:_0x26c533[_0x94b2('0x44')];if(_0x4c8e9e[_0x94b2('0x45')][_0x94b2('0x56')]){_0x551bc1[_0x94b2('0x57')]=[{'all':!![]}];}_0x551bc1=_[_0x94b2('0x53')]({},_0x551bc1,_0x4c8e9e[_0x94b2('0x54')]);return db[_0x94b2('0x3f')][_0x94b2('0x5b')](_0x551bc1)[_0x94b2('0x38')](handleEntityNotFound(_0x171410,null))[_0x94b2('0x38')](respondWithResult(_0x171410,null))[_0x94b2('0x2b')](handleError(_0x171410,null));};exports[_0x94b2('0x5c')]=function(_0x323979,_0x34a34b){return db['SugarcrmAccount'][_0x94b2('0x5c')](_0x323979[_0x94b2('0x5d')],{})['then'](respondWithResult(_0x34a34b,0xc9))[_0x94b2('0x2b')](handleError(_0x34a34b,null));};exports[_0x94b2('0x37')]=function(_0x293967,_0x2a3ce5){if(_0x293967[_0x94b2('0x5d')]['id']){delete _0x293967['body']['id'];}return db[_0x94b2('0x3f')][_0x94b2('0x5b')]({'where':{'id':_0x293967[_0x94b2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2a3ce5,null))[_0x94b2('0x38')](saveUpdates(_0x293967['body'],null))[_0x94b2('0x38')](respondWithResult(_0x2a3ce5,null))[_0x94b2('0x2b')](handleError(_0x2a3ce5,null));};exports[_0x94b2('0x39')]=function(_0x20679c,_0x1f7f44){return db[_0x94b2('0x3f')][_0x94b2('0x5b')]({'where':{'id':_0x20679c['params']['id']}})[_0x94b2('0x38')](handleEntityNotFound(_0x1f7f44,null))[_0x94b2('0x38')](removeEntity(_0x1f7f44,null))[_0x94b2('0x2b')](handleError(_0x1f7f44,null));};exports[_0x94b2('0x5f')]=function(_0x48a5e0,_0x766249,_0x5df9b1){var _0x1390bf={};var _0x1dda41={};var _0x763b56;var _0x2d63dd;return db['SugarcrmAccount'][_0x94b2('0x60')]({'where':{'id':_0x48a5e0['params']['id']}})['then'](handleEntityNotFound(_0x766249,null))[_0x94b2('0x38')](function(_0x366484){if(_0x366484){_0x763b56=_0x366484;_0x1dda41[_0x94b2('0x44')]=_[_0x94b2('0x46')](db['SugarcrmConfiguration'][_0x94b2('0x40')]);_0x1dda41['query']=_[_0x94b2('0x46')](_0x48a5e0['query']);_0x1dda41[_0x94b2('0x4f')]=_['intersection'](_0x1dda41[_0x94b2('0x44')],_0x1dda41['query']);_0x1390bf[_0x94b2('0x49')]=_[_0x94b2('0x47')](_0x1dda41['model'],qs[_0x94b2('0x48')](_0x48a5e0['query']['fields']));_0x1390bf[_0x94b2('0x49')]=_0x1390bf['attributes'][_0x94b2('0x4a')]?_0x1390bf[_0x94b2('0x49')]:_0x1dda41[_0x94b2('0x44')];_0x1390bf[_0x94b2('0x4d')]=qs[_0x94b2('0x4e')](_0x48a5e0[_0x94b2('0x45')][_0x94b2('0x4e')]);_0x1390bf[_0x94b2('0x52')]=qs['filters'](_[_0x94b2('0x50')](_0x48a5e0['query'],_0x1dda41[_0x94b2('0x4f')]));if(_0x48a5e0[_0x94b2('0x45')][_0x94b2('0x51')]){_0x1390bf[_0x94b2('0x52')]=_['merge'](_0x1390bf['where'],{'$or':_[_0x94b2('0x3e')](_0x1390bf[_0x94b2('0x49')],function(_0xc83874){var _0x58edd3={};_0x58edd3[_0xc83874]={'$like':'%'+_0x48a5e0[_0x94b2('0x45')]['filter']+'%'};return _0x58edd3;})});}_0x1390bf=_[_0x94b2('0x53')]({},_0x1390bf,_0x48a5e0['options']);return _0x763b56[_0x94b2('0x5f')](_0x1390bf);}})[_0x94b2('0x38')](function(_0x2bbca7){if(_0x2bbca7){_0x2d63dd=_0x2bbca7['length'];if(!_0x48a5e0[_0x94b2('0x45')]['hasOwnProperty'](_0x94b2('0x4c'))){_0x1390bf[_0x94b2('0x31')]=qs[_0x94b2('0x31')](_0x48a5e0[_0x94b2('0x45')]['limit']);_0x1390bf['offset']=qs[_0x94b2('0x30')](_0x48a5e0['query']['offset']);}return _0x763b56['getConfigurations'](_0x1390bf);}})['then'](function(_0x29196f){if(_0x29196f){return _0x29196f?{'count':_0x2d63dd,'rows':_0x29196f}:null;}})[_0x94b2('0x38')](respondWithResult(_0x766249,null))[_0x94b2('0x2b')](handleError(_0x766249,null));};exports[_0x94b2('0x61')]=function(_0xfac543,_0x5ba723,_0xca391){if(_0xfac543[_0x94b2('0x5d')]['id']){delete _0xfac543[_0x94b2('0x5d')]['id'];}return db[_0x94b2('0x3f')][_0x94b2('0x60')]({'where':{'id':_0xfac543[_0x94b2('0x5e')]['id']}})[_0x94b2('0x38')](handleEntityNotFound(_0x5ba723,null))[_0x94b2('0x38')](function(_0x589805){if(_0x589805){_0xfac543[_0x94b2('0x5d')][_0x94b2('0x62')]=_0x589805['id'];_0xfac543[_0x94b2('0x5d')]['Subjects']=integrations[_0x94b2('0x63')](_0xfac543[_0x94b2('0x5d')]['channel'],_0xfac543[_0x94b2('0x5d')][_0x94b2('0x42')]);_0xfac543['body'][_0x94b2('0x64')]=integrations[_0x94b2('0x65')](_0xfac543[_0x94b2('0x5d')]['channel'],_0xfac543[_0x94b2('0x5d')][_0x94b2('0x42')]);return db[_0x94b2('0x66')][_0x94b2('0x5c')](_0xfac543[_0x94b2('0x5d')],{'include':[{'model':db[_0x94b2('0x67')],'as':'Subjects'},{'model':db[_0x94b2('0x67')],'as':_0x94b2('0x64')}]});}return null;})[_0x94b2('0x38')](respondWithResult(_0x5ba723,null))['catch'](handleError(_0x5ba723,null));};exports['getFields']=function(_0xacaca4,_0x3feb21,_0x4bb6b0){var _0x4148c6='';var _0x26c406=['id',_0x94b2('0x3b'),'assigned_user_id',_0x94b2('0x68'),_0x94b2('0x69'),'date_start','duration_hours','duration_minutes',_0x94b2('0x6a'),_0x94b2('0x6b'),_0x94b2('0x6c'),'direction'];return db['SugarcrmAccount']['findOne']({'where':{'id':_0xacaca4[_0x94b2('0x5e')]['id']},'attributes':['id',_0x94b2('0x6d'),_0x94b2('0x6e'),_0x94b2('0x6f')]})['then'](handleEntityNotFound(_0x3feb21,null))['then'](function(_0x5c7434){if(_0x5c7434){_0x4148c6=_0x5c7434[_0x94b2('0x6f')];var _0x404d23=_0x4148c6['slice'](-0x1);if(_0x404d23==='/'){_0x4148c6=_0x4148c6[_0x94b2('0x70')](0x0,_0x4148c6['lastIndexOf'](_0x404d23));}return rp({'method':_0x94b2('0x71'),'uri':util[_0x94b2('0x72')](_0x94b2('0x73'),_0x4148c6,_0x94b2('0x74')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x94b2('0x75'),'rest_data':JSON[_0x94b2('0x26')]({'user_auth':{'user_name':_0x5c7434[_0x94b2('0x6d')],'password':_0x5c7434['password'],'encryption':_0x94b2('0x76')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x94b2('0x38')](function(_0x7c06cc){if(_0x7c06cc&&_0x7c06cc['name']!==_0x94b2('0x77')&&_0x7c06cc[_0x94b2('0x3b')]!==_0x94b2('0x78')){return rp({'method':_0x94b2('0x71'),'uri':util[_0x94b2('0x72')](_0x94b2('0x73'),_0x4148c6,_0x94b2('0x74')),'json':!![],'form':{'method':_0x94b2('0x79'),'input_type':_0x94b2('0x75'),'response_type':'JSON','rest_data':JSON[_0x94b2('0x26')]({'session':_0x7c06cc['id'],'module_name':_0x94b2('0x7a')})}})[_0x94b2('0x38')](function(_0x403352){if(_0x403352){var _0xd25ded=_[_0x94b2('0x7b')](_0x403352[_0x94b2('0x7c')]);_[_0x94b2('0x7d')](_0xd25ded,function(_0xffe7dc){return _0x26c406['includes'](_0xffe7dc['name']);});return{'count':_0xd25ded[_0x94b2('0x4a')],'rows':_[_0x94b2('0x3e')](_0xd25ded,function(_0x66507a){return{'id':_0x66507a['name'],'name':_0x66507a['label'],'custom':_[_0x94b2('0x7e')](_0x66507a[_0x94b2('0x3b')],'_c')?!![]:![],'options':_0x66507a[_0x94b2('0x54')]?_[_0x94b2('0x3e')](_[_0x94b2('0x7b')](_0x66507a['options']),function(_0x34e60f){return{'name':_0x34e60f[_0x94b2('0x7f')],'value':_0x34e60f[_0x94b2('0x3b')]};}):[]};})};}})[_0x94b2('0x38')](respondWithResult(_0x3feb21,null))['catch'](function(_0x3b43ff){var _0x3c59bf=_0xacaca4[_0x94b2('0x45')][_0x94b2('0x1c')]?0x1f4:_0x3b43ff[_0x94b2('0x80')]||0x1f4;logger[_0x94b2('0x28')](_0x94b2('0x81'),_0x94b2('0x82'),_0x3c59bf,JSON['stringify'](_0x3b43ff));delete _0x3b43ff[_0x94b2('0x3b')];if(_0x3c59bf===0x191){_0x3c59bf=0x190;}_0x3feb21[_0x94b2('0x2d')](_0x3c59bf)['send'](_0xacaca4['query']['test']?{'message':_0x94b2('0x83'),'statusCode':_0x3b43ff[_0x94b2('0x80')]}:_0x3b43ff);});}else{var _0x1e9907=0x1f4;_0x3feb21['status'](_0x1e9907)[_0x94b2('0x3c')]({'message':_0x94b2('0x83'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x518b=['SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','password','remoteUri','slice','format','JSON','stringify','username','Invalid\x20Login','Password\x20Expired','%s%s','Calls','values','module_fields','remove','endsWith','value','statusCode','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','crypto','jsforce','querystring','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','destroy','stack','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel'];(function(_0x4b1b5c,_0x4228d3){var _0x5366c7=function(_0x516096){while(--_0x516096){_0x4b1b5c['push'](_0x4b1b5c['shift']());}};_0x5366c7(++_0x4228d3);}(_0x518b,0x1e8));var _0xb518=function(_0x5f5017,_0x183deb){_0x5f5017=_0x5f5017-0x0;var _0x56da51=_0x518b[_0x5f5017];return _0x56da51;};'use strict';var pdf=require(_0xb518('0x0'));var emlformat=require(_0xb518('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb518('0x2'));var jsonpatch=require(_0xb518('0x3'));var rp=require(_0xb518('0x4'));var moment=require(_0xb518('0x5'));var BPromise=require(_0xb518('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb518('0x7'));var sox=require('sox');var csv=require(_0xb518('0x8'));var ejs=require(_0xb518('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb518('0xa'));var jsforce=require(_0xb518('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb518('0xc'));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(_0xb518('0xd'));var logger=require(_0xb518('0xe'))(_0xb518('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb518('0x10'))['db'];var integrations=require(_0xb518('0x11'));var jayson=require(_0xb518('0x12'));var client=jayson['client'][_0xb518('0x13')]({'port':0x232a});function checkPasswordPattern(_0x8d6d4c,_0x2d6416,_0x201f02){if(_0x201f02){var _0x33bb51=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33bb51[_0xb518('0x14')](_0x2d6416)){return _0x8d6d4c;}else{throw new db[(_0xb518('0x15'))]['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 _0x8d6d4c;}}function respondWithRpcPromise(_0x486bbe,_0x800c53,_0xe04a6f,_0x7f324d){return new BPromise(function(_0x1a2349,_0x52910e){var _0x266236=_0x7f324d||client;return _0x266236[_0xb518('0x16')](_0x486bbe,_0xe04a6f)[_0xb518('0x17')](function(_0x4ab3fa){logger[_0xb518('0x18')](_0xb518('0x19'),_0x800c53,_0xb518('0x1a'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x800c53,'request\x20sent',JSON['stringify'](_0x4ab3fa));if(_0x4ab3fa[_0xb518('0x1b')]){if(_0x4ab3fa[_0xb518('0x1b')]['code']===0x1f4){logger[_0xb518('0x1b')](_0xb518('0x19'),_0x800c53,_0x4ab3fa[_0xb518('0x1b')]['message']);return _0x52910e(_0x4ab3fa[_0xb518('0x1b')][_0xb518('0x1c')]);}logger['error'](_0xb518('0x19'),_0x800c53,_0x4ab3fa[_0xb518('0x1b')]['message']);return _0x1a2349(_0x4ab3fa['error']['message']);}else{logger[_0xb518('0x18')]('SugarcrmAccount,\x20%s,\x20%s',_0x800c53,_0xb518('0x1a'));_0x1a2349(_0x4ab3fa[_0xb518('0x1d')][_0xb518('0x1c')]);}})[_0xb518('0x1e')](function(_0x571445){logger[_0xb518('0x1b')](_0xb518('0x19'),_0x800c53,_0x571445);_0x52910e(_0x571445);});});}function respondWithStatusCode(_0x59d901,_0xd4bd21){_0xd4bd21=_0xd4bd21||0xcc;return function(_0x5c6ad6){if(_0x5c6ad6){return _0x59d901[_0xb518('0x1f')](_0xd4bd21);}return _0x59d901[_0xb518('0x20')](_0xd4bd21)[_0xb518('0x21')]();};}function respondWithResult(_0x412fd0,_0x4b1cf2){_0x4b1cf2=_0x4b1cf2||0xc8;return function(_0x2d2f9d){if(_0x2d2f9d){return _0x412fd0[_0xb518('0x20')](_0x4b1cf2)[_0xb518('0x22')](_0x2d2f9d);}};}function respondWithFilteredResult(_0x27d675,_0x3f2c6b){return function(_0x3a2cac){if(_0x3a2cac){var _0x4c64ea=_0x3a2cac[_0xb518('0x23')],_0x1e217d=_0x3f2c6b[_0xb518('0x24')],_0x124f3e=_0x3f2c6b[_0xb518('0x24')]+_0x3f2c6b[_0xb518('0x25')],_0x1577d6;if(_0x124f3e>=_0x4c64ea){_0x124f3e=_0x4c64ea;_0x1577d6=0xc8;}else{_0x1577d6=0xce;}_0x27d675['status'](_0x1577d6);return _0x27d675['set'](_0xb518('0x26'),_0x1e217d+'-'+_0x124f3e+'/'+_0x4c64ea)['json'](_0x3a2cac);}return null;};}function patchUpdates(_0x358709){return function(_0x5c573b){try{jsonpatch['apply'](_0x5c573b,_0x358709,!![]);}catch(_0x4716c){return BPromise[_0xb518('0x27')](_0x4716c);}return _0x5c573b[_0xb518('0x28')]();};}function saveUpdates(_0x307f06,_0x38f264){return function(_0x3b059a){if(_0x3b059a){return _0x3b059a['update'](_0x307f06)[_0xb518('0x17')](function(_0x38ce8a){return _0x38ce8a;});}return null;};}function removeEntity(_0x3b4922,_0x3be29c){return function(_0x5191dd){if(_0x5191dd){return _0x5191dd[_0xb518('0x29')]()['then'](function(){_0x3b4922[_0xb518('0x20')](0xcc)[_0xb518('0x21')]();});}};}function handleEntityNotFound(_0x1decc8,_0x3811cc){return function(_0x2ee1aa){if(!_0x2ee1aa){_0x1decc8[_0xb518('0x1f')](0x194);}return _0x2ee1aa;};}function handleError(_0x12373f,_0xeeb22d){_0xeeb22d=_0xeeb22d||0x1f4;return function(_0x131767){logger['error'](_0x131767[_0xb518('0x2a')]);if(_0x131767[_0xb518('0x2b')]){delete _0x131767[_0xb518('0x2b')];}_0x12373f['status'](_0xeeb22d)[_0xb518('0x2c')](_0x131767);};}exports['index']=function(_0x334739,_0x2f9b9d){var _0x20efba={},_0x314f05={},_0x2f15a2={'count':0x0,'rows':[]};var _0x435cc5=_['map'](db[_0xb518('0x2d')][_0xb518('0x2e')],function(_0x4b8605){return{'name':_0x4b8605[_0xb518('0x2f')],'type':_0x4b8605[_0xb518('0x30')][_0xb518('0x31')]};});_0x314f05[_0xb518('0x32')]=_[_0xb518('0x33')](_0x435cc5,_0xb518('0x2b'));_0x314f05[_0xb518('0x34')]=_[_0xb518('0x35')](_0x334739[_0xb518('0x34')]);_0x314f05['filters']=_[_0xb518('0x36')](_0x314f05[_0xb518('0x32')],_0x314f05[_0xb518('0x34')]);_0x20efba[_0xb518('0x37')]=_['intersection'](_0x314f05[_0xb518('0x32')],qs['fields'](_0x334739[_0xb518('0x34')][_0xb518('0x38')]));_0x20efba[_0xb518('0x37')]=_0x20efba[_0xb518('0x37')][_0xb518('0x39')]?_0x20efba['attributes']:_0x314f05[_0xb518('0x32')];if(!_0x334739[_0xb518('0x34')][_0xb518('0x3a')]('nolimit')){_0x20efba[_0xb518('0x25')]=qs[_0xb518('0x25')](_0x334739[_0xb518('0x34')][_0xb518('0x25')]);_0x20efba[_0xb518('0x24')]=qs['offset'](_0x334739['query'][_0xb518('0x24')]);}_0x20efba[_0xb518('0x3b')]=qs[_0xb518('0x3c')](_0x334739[_0xb518('0x34')][_0xb518('0x3c')]);_0x20efba['where']=qs[_0xb518('0x3d')](_[_0xb518('0x3e')](_0x334739[_0xb518('0x34')],_0x314f05[_0xb518('0x3d')]),_0x435cc5);if(_0x334739[_0xb518('0x34')]['filter']){_0x20efba['where']=_[_0xb518('0x3f')](_0x20efba[_0xb518('0x40')],{'$or':_[_0xb518('0x33')](_0x435cc5,function(_0x615d45){if(_0x615d45[_0xb518('0x30')]!==_0xb518('0x41')){var _0x2b2afe={};_0x2b2afe[_0x615d45[_0xb518('0x2b')]]={'$like':'%'+_0x334739['query'][_0xb518('0x42')]+'%'};return _0x2b2afe;}})});}_0x20efba=_[_0xb518('0x3f')]({},_0x20efba,_0x334739[_0xb518('0x43')]);var _0x2b4f55={'where':_0x20efba[_0xb518('0x40')]};return db[_0xb518('0x2d')][_0xb518('0x23')](_0x2b4f55)[_0xb518('0x17')](function(_0x424027){_0x2f15a2[_0xb518('0x23')]=_0x424027;if(_0x334739[_0xb518('0x34')][_0xb518('0x44')]){_0x20efba[_0xb518('0x45')]=[{'all':!![]}];}return db[_0xb518('0x2d')][_0xb518('0x46')](_0x20efba);})[_0xb518('0x17')](function(_0x5a87b6){_0x2f15a2[_0xb518('0x47')]=_0x5a87b6;return _0x2f15a2;})['then'](respondWithFilteredResult(_0x2f9b9d,_0x20efba))[_0xb518('0x1e')](handleError(_0x2f9b9d,null));};exports[_0xb518('0x48')]=function(_0x58daf6,_0x37df7c){var _0x446d62={'raw':![],'where':{'id':_0x58daf6[_0xb518('0x49')]['id']}},_0x5c6b24={};_0x5c6b24['model']=_[_0xb518('0x35')](db[_0xb518('0x2d')][_0xb518('0x2e')]);_0x5c6b24[_0xb518('0x34')]=_[_0xb518('0x35')](_0x58daf6[_0xb518('0x34')]);_0x5c6b24[_0xb518('0x3d')]=_['intersection'](_0x5c6b24[_0xb518('0x32')],_0x5c6b24['query']);_0x446d62[_0xb518('0x37')]=_[_0xb518('0x36')](_0x5c6b24[_0xb518('0x32')],qs[_0xb518('0x38')](_0x58daf6['query'][_0xb518('0x38')]));_0x446d62[_0xb518('0x37')]=_0x446d62[_0xb518('0x37')]['length']?_0x446d62[_0xb518('0x37')]:_0x5c6b24[_0xb518('0x32')];if(_0x58daf6['query'][_0xb518('0x44')]){_0x446d62[_0xb518('0x45')]=[{'all':!![]}];}_0x446d62=_['merge']({},_0x446d62,_0x58daf6[_0xb518('0x43')]);return db[_0xb518('0x2d')][_0xb518('0x4a')](_0x446d62)[_0xb518('0x17')](handleEntityNotFound(_0x37df7c,null))[_0xb518('0x17')](respondWithResult(_0x37df7c,null))['catch'](handleError(_0x37df7c,null));};exports[_0xb518('0x4b')]=function(_0x309145,_0x3d8161){return db[_0xb518('0x2d')][_0xb518('0x4b')](_0x309145[_0xb518('0x4c')],{})[_0xb518('0x17')](respondWithResult(_0x3d8161,0xc9))[_0xb518('0x1e')](handleError(_0x3d8161,null));};exports['update']=function(_0x3bb719,_0x3113e3){if(_0x3bb719[_0xb518('0x4c')]['id']){delete _0x3bb719['body']['id'];}return db[_0xb518('0x2d')][_0xb518('0x4a')]({'where':{'id':_0x3bb719[_0xb518('0x49')]['id']}})[_0xb518('0x17')](handleEntityNotFound(_0x3113e3,null))[_0xb518('0x17')](saveUpdates(_0x3bb719[_0xb518('0x4c')],null))[_0xb518('0x17')](respondWithResult(_0x3113e3,null))['catch'](handleError(_0x3113e3,null));};exports['destroy']=function(_0x3269d1,_0x5c6305){return db[_0xb518('0x2d')][_0xb518('0x4a')]({'where':{'id':_0x3269d1[_0xb518('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c6305,null))[_0xb518('0x17')](removeEntity(_0x5c6305,null))[_0xb518('0x1e')](handleError(_0x5c6305,null));};exports[_0xb518('0x4d')]=function(_0x21b2d5,_0x49de2d,_0x15b979){var _0x1f1b71={};var _0x5cc868={};var _0x35c9a8;var _0x36988f;return db[_0xb518('0x2d')][_0xb518('0x4e')]({'where':{'id':_0x21b2d5[_0xb518('0x49')]['id']}})['then'](handleEntityNotFound(_0x49de2d,null))[_0xb518('0x17')](function(_0x4e6ebf){if(_0x4e6ebf){_0x35c9a8=_0x4e6ebf;_0x5cc868[_0xb518('0x32')]=_[_0xb518('0x35')](db[_0xb518('0x4f')][_0xb518('0x2e')]);_0x5cc868[_0xb518('0x34')]=_[_0xb518('0x35')](_0x21b2d5[_0xb518('0x34')]);_0x5cc868[_0xb518('0x3d')]=_['intersection'](_0x5cc868['model'],_0x5cc868[_0xb518('0x34')]);_0x1f1b71[_0xb518('0x37')]=_[_0xb518('0x36')](_0x5cc868[_0xb518('0x32')],qs[_0xb518('0x38')](_0x21b2d5[_0xb518('0x34')][_0xb518('0x38')]));_0x1f1b71['attributes']=_0x1f1b71[_0xb518('0x37')][_0xb518('0x39')]?_0x1f1b71['attributes']:_0x5cc868[_0xb518('0x32')];_0x1f1b71[_0xb518('0x3b')]=qs[_0xb518('0x3c')](_0x21b2d5[_0xb518('0x34')][_0xb518('0x3c')]);_0x1f1b71['where']=qs[_0xb518('0x3d')](_[_0xb518('0x3e')](_0x21b2d5[_0xb518('0x34')],_0x5cc868[_0xb518('0x3d')]));if(_0x21b2d5[_0xb518('0x34')]['filter']){_0x1f1b71[_0xb518('0x40')]=_[_0xb518('0x3f')](_0x1f1b71[_0xb518('0x40')],{'$or':_[_0xb518('0x33')](_0x1f1b71[_0xb518('0x37')],function(_0x28c1b1){var _0x3d37d={};_0x3d37d[_0x28c1b1]={'$like':'%'+_0x21b2d5[_0xb518('0x34')][_0xb518('0x42')]+'%'};return _0x3d37d;})});}_0x1f1b71=_[_0xb518('0x3f')]({},_0x1f1b71,_0x21b2d5['options']);return _0x35c9a8[_0xb518('0x4d')](_0x1f1b71);}})[_0xb518('0x17')](function(_0x32ad71){if(_0x32ad71){_0x36988f=_0x32ad71[_0xb518('0x39')];if(!_0x21b2d5[_0xb518('0x34')][_0xb518('0x3a')](_0xb518('0x50'))){_0x1f1b71[_0xb518('0x25')]=qs[_0xb518('0x25')](_0x21b2d5[_0xb518('0x34')]['limit']);_0x1f1b71[_0xb518('0x24')]=qs['offset'](_0x21b2d5[_0xb518('0x34')]['offset']);}return _0x35c9a8[_0xb518('0x4d')](_0x1f1b71);}})[_0xb518('0x17')](function(_0x30d274){if(_0x30d274){return _0x30d274?{'count':_0x36988f,'rows':_0x30d274}:null;}})['then'](respondWithResult(_0x49de2d,null))[_0xb518('0x1e')](handleError(_0x49de2d,null));};exports[_0xb518('0x51')]=function(_0x45bf0f,_0x4154ea,_0x326775){if(_0x45bf0f['body']['id']){delete _0x45bf0f[_0xb518('0x4c')]['id'];}return db[_0xb518('0x2d')][_0xb518('0x4e')]({'where':{'id':_0x45bf0f[_0xb518('0x49')]['id']}})[_0xb518('0x17')](handleEntityNotFound(_0x4154ea,null))[_0xb518('0x17')](function(_0x290867){if(_0x290867){_0x45bf0f[_0xb518('0x4c')][_0xb518('0x52')]=_0x290867['id'];_0x45bf0f[_0xb518('0x4c')][_0xb518('0x53')]=integrations['getSubjects'](_0x45bf0f['body']['channel'],_0x45bf0f[_0xb518('0x4c')][_0xb518('0x30')]);_0x45bf0f[_0xb518('0x4c')][_0xb518('0x54')]=integrations[_0xb518('0x55')](_0x45bf0f[_0xb518('0x4c')][_0xb518('0x56')],_0x45bf0f[_0xb518('0x4c')][_0xb518('0x30')]);return db['SugarcrmConfiguration'][_0xb518('0x4b')](_0x45bf0f[_0xb518('0x4c')],{'include':[{'model':db[_0xb518('0x57')],'as':_0xb518('0x53')},{'model':db[_0xb518('0x57')],'as':_0xb518('0x54')}]});}return null;})[_0xb518('0x17')](respondWithResult(_0x4154ea,null))[_0xb518('0x1e')](handleError(_0x4154ea,null));};exports[_0xb518('0x58')]=function(_0x12fe39,_0x30ad6c,_0x68c040){var _0xb6162e='';var _0x469c48=['id',_0xb518('0x2b'),'assigned_user_id',_0xb518('0x59'),_0xb518('0x5a'),_0xb518('0x5b'),_0xb518('0x5c'),_0xb518('0x5d'),_0xb518('0x5e'),_0xb518('0x5f'),'parent_name',_0xb518('0x60')];return db[_0xb518('0x2d')][_0xb518('0x4e')]({'where':{'id':_0x12fe39[_0xb518('0x49')]['id']},'attributes':['id','username',_0xb518('0x61'),_0xb518('0x62')]})[_0xb518('0x17')](handleEntityNotFound(_0x30ad6c,null))['then'](function(_0x24baa5){if(_0x24baa5){_0xb6162e=_0x24baa5[_0xb518('0x62')];var _0x161053=_0xb6162e[_0xb518('0x63')](-0x1);if(_0x161053==='/'){_0xb6162e=_0xb6162e['substring'](0x0,_0xb6162e['lastIndexOf'](_0x161053));}return rp({'method':'POST','uri':util[_0xb518('0x64')]('%s%s',_0xb6162e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xb518('0x65'),'rest_data':JSON[_0xb518('0x66')]({'user_auth':{'user_name':_0x24baa5[_0xb518('0x67')],'password':_0x24baa5[_0xb518('0x61')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xb518('0x17')](function(_0x1a6de3){if(_0x1a6de3&&_0x1a6de3[_0xb518('0x2b')]!==_0xb518('0x68')&&_0x1a6de3[_0xb518('0x2b')]!==_0xb518('0x69')){return rp({'method':'POST','uri':util['format'](_0xb518('0x6a'),_0xb6162e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xb518('0x65'),'rest_data':JSON[_0xb518('0x66')]({'session':_0x1a6de3['id'],'module_name':_0xb518('0x6b')})}})['then'](function(_0x1b255a){if(_0x1b255a){var _0x38ebd2=_[_0xb518('0x6c')](_0x1b255a[_0xb518('0x6d')]);_[_0xb518('0x6e')](_0x38ebd2,function(_0x422c03){return _0x469c48['includes'](_0x422c03[_0xb518('0x2b')]);});return{'count':_0x38ebd2['length'],'rows':_[_0xb518('0x33')](_0x38ebd2,function(_0x5af9ff){return{'id':_0x5af9ff[_0xb518('0x2b')],'name':_0x5af9ff['label'],'custom':_[_0xb518('0x6f')](_0x5af9ff[_0xb518('0x2b')],'_c')?!![]:![],'options':_0x5af9ff['options']?_['map'](_['values'](_0x5af9ff[_0xb518('0x43')]),function(_0x1cb445){return{'name':_0x1cb445[_0xb518('0x70')],'value':_0x1cb445['name']};}):[]};})};}})['then'](respondWithResult(_0x30ad6c,null))[_0xb518('0x1e')](function(_0x5b55ba){var _0x5ab596=_0x12fe39[_0xb518('0x34')][_0xb518('0x14')]?0x1f4:_0x5b55ba[_0xb518('0x71')]||0x1f4;logger[_0xb518('0x1b')]('getFields,\x20%s,\x20%s,\x20%s',_0xb518('0x58'),_0x5ab596,JSON['stringify'](_0x5b55ba));delete _0x5b55ba[_0xb518('0x2b')];if(_0x5ab596===0x191){_0x5ab596=0x190;}_0x30ad6c[_0xb518('0x20')](_0x5ab596)[_0xb518('0x2c')](_0x12fe39['query'][_0xb518('0x14')]?{'message':_0xb518('0x72'),'statusCode':_0x5b55ba[_0xb518('0x71')]}:_0x5b55ba);});}else{var _0x18e4ee=0x1f4;_0x30ad6c[_0xb518('0x20')](_0x18e4ee)[_0xb518('0x2c')]({'message':_0xb518('0x72'),'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 a9d327e..98361b5 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 _0xde34=['request-promise','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','util','api','bluebird'];(function(_0x1e28e8,_0x321a48){var _0x1991ab=function(_0x55843c){while(--_0x55843c){_0x1e28e8['push'](_0x1e28e8['shift']());}};_0x1991ab(++_0x321a48);}(_0xde34,0xf9));var _0x4de3=function(_0x3863be,_0x3fb52c){_0x3863be=_0x3863be-0x0;var _0x17849a=_0xde34[_0x3863be];return _0x17849a;};'use strict';var _=require('lodash');var util=require(_0x4de3('0x0'));var logger=require('../../config/logger')(_0x4de3('0x1'));var moment=require('moment');var BPromise=require(_0x4de3('0x2'));var rp=require(_0x4de3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4de3('0x4'));var config=require('../../config/environment');var attributes=require(_0x4de3('0x5'));var integrations=require(_0x4de3('0x6'));module['exports']=function(_0x2a926a,_0x4a0dd0){return _0x2a926a['define'](_0x4de3('0x7'),attributes,{'tableName':_0x4de3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c3f=['int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intSugarcrmAccount.attributes','SugarcrmAccount'];(function(_0x45d4cf,_0x157f52){var _0x26070c=function(_0x34c487){while(--_0x34c487){_0x45d4cf['push'](_0x45d4cf['shift']());}};_0x26070c(++_0x157f52);}(_0x3c3f,0x1d7));var _0xf3c3=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0x3c3f[_0x43e4b3];return _0x10c655;};'use strict';var _=require(_0xf3c3('0x0'));var util=require(_0xf3c3('0x1'));var logger=require(_0xf3c3('0x2'))(_0xf3c3('0x3'));var moment=require(_0xf3c3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf3c3('0x5'));var config=require(_0xf3c3('0x6'));var attributes=require(_0xf3c3('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x60086a,_0x1d1ec8){return _0x60086a['define'](_0xf3c3('0x8'),attributes,{'tableName':_0xf3c3('0x9'),'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 f84faf1..015b77e 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 _0xcd9d=['client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','map','include','model','debug','catch','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5211d4,_0x417556){var _0x9fc0b4=function(_0x1fbc21){while(--_0x1fbc21){_0x5211d4['push'](_0x5211d4['shift']());}};_0x9fc0b4(++_0x417556);}(_0xcd9d,0x86));var _0xdcd9=function(_0xa1d9c9,_0x56d5cf){_0xa1d9c9=_0xa1d9c9-0x0;var _0x301a7c=_0xcd9d[_0xa1d9c9];return _0x301a7c;};'use strict';var _=require(_0xdcd9('0x0'));var util=require(_0xdcd9('0x1'));var moment=require(_0xdcd9('0x2'));var BPromise=require(_0xdcd9('0x3'));var rs=require(_0xdcd9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcd9('0x5'))['db'];var utils=require(_0xdcd9('0x6'));var logger=require(_0xdcd9('0x7'))(_0xdcd9('0x8'));var config=require(_0xdcd9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdcd9('0xa')][_0xdcd9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8176fd,_0x13f5b6,_0x24d36f){return new BPromise(function(_0x47120b,_0x205cd1){return client[_0xdcd9('0xc')](_0x8176fd,_0x24d36f)[_0xdcd9('0xd')](function(_0x2e6107){logger[_0xdcd9('0xe')](_0xdcd9('0xf'),_0x13f5b6,_0xdcd9('0x10'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x13f5b6,_0xdcd9('0x10'),JSON[_0xdcd9('0x11')](_0x2e6107));if(_0x2e6107['error']){if(_0x2e6107[_0xdcd9('0x12')][_0xdcd9('0x13')]===0x1f4){logger[_0xdcd9('0x12')](_0xdcd9('0xf'),_0x13f5b6,_0x2e6107['error'][_0xdcd9('0x14')]);return _0x205cd1(_0x2e6107[_0xdcd9('0x12')][_0xdcd9('0x14')]);}logger[_0xdcd9('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x13f5b6,_0x2e6107[_0xdcd9('0x12')][_0xdcd9('0x14')]);return _0x47120b(_0x2e6107[_0xdcd9('0x12')][_0xdcd9('0x14')]);}else{logger[_0xdcd9('0xe')](_0xdcd9('0xf'),_0x13f5b6,_0xdcd9('0x10'));_0x47120b(_0x2e6107[_0xdcd9('0x15')][_0xdcd9('0x14')]);}})['catch'](function(_0xef20e5){logger[_0xdcd9('0x12')](_0xdcd9('0xf'),_0x13f5b6,_0xef20e5);_0x205cd1(_0xef20e5);});});}exports[_0xdcd9('0x16')]=function(_0xaff3d0){var _0x3ba244=this;return new Promise(function(_0x39efff,_0x4d2bad){return db[_0xdcd9('0x17')][_0xdcd9('0x18')]({'raw':_0xaff3d0[_0xdcd9('0x19')]?_0xaff3d0['options'][_0xdcd9('0x1a')]===undefined?!![]:![]:!![],'where':_0xaff3d0[_0xdcd9('0x19')]?_0xaff3d0[_0xdcd9('0x19')][_0xdcd9('0x1b')]||null:null,'attributes':_0xaff3d0['options']?_0xaff3d0['options'][_0xdcd9('0x1c')]||null:null,'limit':_0xaff3d0[_0xdcd9('0x19')]?_0xaff3d0[_0xdcd9('0x19')]['limit']||null:null,'include':_0xaff3d0[_0xdcd9('0x19')]?_0xaff3d0['options']['include']?_[_0xdcd9('0x1d')](_0xaff3d0[_0xdcd9('0x19')][_0xdcd9('0x1e')],function(_0x2662e9){return{'model':db[_0x2662e9['model']],'as':_0x2662e9['as'],'attributes':_0x2662e9[_0xdcd9('0x1c')],'include':_0x2662e9[_0xdcd9('0x1e')]?_['map'](_0x2662e9[_0xdcd9('0x1e')],function(_0x4709bd){return{'model':db[_0x4709bd[_0xdcd9('0x1f')]],'as':_0x4709bd['as'],'attributes':_0x4709bd['attributes'],'include':_0x4709bd[_0xdcd9('0x1e')]?_[_0xdcd9('0x1d')](_0x4709bd[_0xdcd9('0x1e')],function(_0x2270ed){return{'model':db[_0x2270ed['model']],'as':_0x2270ed['as'],'attributes':_0x2270ed[_0xdcd9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdcd9('0xd')](function(_0x90df46){logger[_0xdcd9('0xe')](_0xdcd9('0x16'),_0xaff3d0);logger[_0xdcd9('0x20')](_0xdcd9('0x16'),_0xaff3d0,JSON[_0xdcd9('0x11')](_0x90df46));_0x39efff(_0x90df46);})[_0xdcd9('0x21')](function(_0x577252){logger[_0xdcd9('0x12')](_0xdcd9('0x16'),_0x577252['message'],_0xaff3d0);_0x4d2bad(_0x3ba244[_0xdcd9('0x12')](0x1f4,_0x577252[_0xdcd9('0x14')]));});});};exports[_0xdcd9('0x22')]=function(_0x15796a){var _0x5e45f6=this;return new Promise(function(_0xb077d,_0x18864a){return db['SugarcrmAccount'][_0xdcd9('0x23')]({'raw':_0x15796a[_0xdcd9('0x19')]?_0x15796a['options'][_0xdcd9('0x1a')]===undefined?!![]:![]:!![],'where':_0x15796a[_0xdcd9('0x19')]?_0x15796a['options'][_0xdcd9('0x1b')]||null:null,'attributes':_0x15796a[_0xdcd9('0x19')]?_0x15796a['options'][_0xdcd9('0x1c')]||null:null,'include':_0x15796a[_0xdcd9('0x19')]?_0x15796a[_0xdcd9('0x19')]['include']?_['map'](_0x15796a[_0xdcd9('0x19')][_0xdcd9('0x1e')],function(_0x43ee44){return{'model':db[_0x43ee44[_0xdcd9('0x1f')]],'as':_0x43ee44['as'],'attributes':_0x43ee44[_0xdcd9('0x1c')],'include':_0x43ee44[_0xdcd9('0x1e')]?_['map'](_0x43ee44[_0xdcd9('0x1e')],function(_0x540cb8){return{'model':db[_0x540cb8[_0xdcd9('0x1f')]],'as':_0x540cb8['as'],'attributes':_0x540cb8['attributes'],'include':_0x540cb8['include']?_['map'](_0x540cb8[_0xdcd9('0x1e')],function(_0x5f2a7b){return{'model':db[_0x5f2a7b[_0xdcd9('0x1f')]],'as':_0x5f2a7b['as'],'attributes':_0x5f2a7b[_0xdcd9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdcd9('0xd')](function(_0x2a9815){logger[_0xdcd9('0xe')](_0xdcd9('0x22'),_0x15796a);logger[_0xdcd9('0x20')](_0xdcd9('0x22'),_0x15796a,JSON[_0xdcd9('0x11')](_0x2a9815));_0xb077d(_0x2a9815);})['catch'](function(_0x3dff77){logger[_0xdcd9('0x12')](_0xdcd9('0x22'),_0x3dff77['message'],_0x15796a);_0x18864a(_0x5e45f6[_0xdcd9('0x12')](0x1f4,_0x3dff77[_0xdcd9('0x14')]));});});}; \ No newline at end of file +var _0x9213=['raw','where','limit','map','include','attributes','model','GetSugarcrmAccount','catch','ShowSugarcrmAccount','SugarcrmAccount','find','debug','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','options'];(function(_0x15538f,_0x36d382){var _0x5d5a02=function(_0x438f37){while(--_0x438f37){_0x15538f['push'](_0x15538f['shift']());}};_0x5d5a02(++_0x36d382);}(_0x9213,0x18e));var _0x3921=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x9213[_0x5c6299];return _0x23b564;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3921('0x0'));var BPromise=require('bluebird');var rs=require(_0x3921('0x1'));var fs=require('fs');var Redis=require(_0x3921('0x2'));var db=require(_0x3921('0x3'))['db'];var utils=require(_0x3921('0x4'));var logger=require(_0x3921('0x5'))(_0x3921('0x6'));var config=require(_0x3921('0x7'));var jayson=require(_0x3921('0x8'));var client=jayson['client'][_0x3921('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cb4da,_0x4e3cb2,_0x46d64e){return new BPromise(function(_0x58fc33,_0x1216a9){return client[_0x3921('0xa')](_0x3cb4da,_0x46d64e)[_0x3921('0xb')](function(_0x90d98e){logger[_0x3921('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4e3cb2,_0x3921('0xd'));logger['debug'](_0x3921('0xe'),_0x4e3cb2,_0x3921('0xd'),JSON[_0x3921('0xf')](_0x90d98e));if(_0x90d98e[_0x3921('0x10')]){if(_0x90d98e[_0x3921('0x10')][_0x3921('0x11')]===0x1f4){logger[_0x3921('0x10')](_0x3921('0x12'),_0x4e3cb2,_0x90d98e[_0x3921('0x10')]['message']);return _0x1216a9(_0x90d98e[_0x3921('0x10')][_0x3921('0x13')]);}logger[_0x3921('0x10')](_0x3921('0x12'),_0x4e3cb2,_0x90d98e[_0x3921('0x10')][_0x3921('0x13')]);return _0x58fc33(_0x90d98e[_0x3921('0x10')][_0x3921('0x13')]);}else{logger[_0x3921('0xc')](_0x3921('0x12'),_0x4e3cb2,_0x3921('0xd'));_0x58fc33(_0x90d98e[_0x3921('0x14')]['message']);}})['catch'](function(_0x48cf7a){logger[_0x3921('0x10')](_0x3921('0x12'),_0x4e3cb2,_0x48cf7a);_0x1216a9(_0x48cf7a);});});}exports['GetSugarcrmAccount']=function(_0x3b8b37){var _0x1082a8=this;return new Promise(function(_0x17bb88,_0x41b27c){return db['SugarcrmAccount']['findAll']({'raw':_0x3b8b37[_0x3921('0x15')]?_0x3b8b37[_0x3921('0x15')][_0x3921('0x16')]===undefined?!![]:![]:!![],'where':_0x3b8b37[_0x3921('0x15')]?_0x3b8b37[_0x3921('0x15')][_0x3921('0x17')]||null:null,'attributes':_0x3b8b37[_0x3921('0x15')]?_0x3b8b37[_0x3921('0x15')]['attributes']||null:null,'limit':_0x3b8b37[_0x3921('0x15')]?_0x3b8b37['options'][_0x3921('0x18')]||null:null,'include':_0x3b8b37[_0x3921('0x15')]?_0x3b8b37[_0x3921('0x15')]['include']?_[_0x3921('0x19')](_0x3b8b37['options'][_0x3921('0x1a')],function(_0x5d40d4){return{'model':db[_0x5d40d4['model']],'as':_0x5d40d4['as'],'attributes':_0x5d40d4[_0x3921('0x1b')],'include':_0x5d40d4[_0x3921('0x1a')]?_[_0x3921('0x19')](_0x5d40d4[_0x3921('0x1a')],function(_0xd08f75){return{'model':db[_0xd08f75[_0x3921('0x1c')]],'as':_0xd08f75['as'],'attributes':_0xd08f75['attributes'],'include':_0xd08f75[_0x3921('0x1a')]?_[_0x3921('0x19')](_0xd08f75['include'],function(_0x14f997){return{'model':db[_0x14f997[_0x3921('0x1c')]],'as':_0x14f997['as'],'attributes':_0x14f997[_0x3921('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3921('0xb')](function(_0x25b139){logger[_0x3921('0xc')](_0x3921('0x1d'),_0x3b8b37);logger['debug'](_0x3921('0x1d'),_0x3b8b37,JSON[_0x3921('0xf')](_0x25b139));_0x17bb88(_0x25b139);})[_0x3921('0x1e')](function(_0x3e076a){logger[_0x3921('0x10')](_0x3921('0x1d'),_0x3e076a[_0x3921('0x13')],_0x3b8b37);_0x41b27c(_0x1082a8[_0x3921('0x10')](0x1f4,_0x3e076a[_0x3921('0x13')]));});});};exports[_0x3921('0x1f')]=function(_0x5570fc){var _0x382d2a=this;return new Promise(function(_0x5314c7,_0x1e4bb4){return db[_0x3921('0x20')][_0x3921('0x21')]({'raw':_0x5570fc[_0x3921('0x15')]?_0x5570fc[_0x3921('0x15')][_0x3921('0x16')]===undefined?!![]:![]:!![],'where':_0x5570fc[_0x3921('0x15')]?_0x5570fc[_0x3921('0x15')][_0x3921('0x17')]||null:null,'attributes':_0x5570fc['options']?_0x5570fc[_0x3921('0x15')][_0x3921('0x1b')]||null:null,'include':_0x5570fc[_0x3921('0x15')]?_0x5570fc[_0x3921('0x15')][_0x3921('0x1a')]?_[_0x3921('0x19')](_0x5570fc[_0x3921('0x15')][_0x3921('0x1a')],function(_0x173d32){return{'model':db[_0x173d32[_0x3921('0x1c')]],'as':_0x173d32['as'],'attributes':_0x173d32[_0x3921('0x1b')],'include':_0x173d32[_0x3921('0x1a')]?_[_0x3921('0x19')](_0x173d32[_0x3921('0x1a')],function(_0x32cd94){return{'model':db[_0x32cd94['model']],'as':_0x32cd94['as'],'attributes':_0x32cd94[_0x3921('0x1b')],'include':_0x32cd94[_0x3921('0x1a')]?_[_0x3921('0x19')](_0x32cd94[_0x3921('0x1a')],function(_0x4319fb){return{'model':db[_0x4319fb[_0x3921('0x1c')]],'as':_0x4319fb['as'],'attributes':_0x4319fb[_0x3921('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3921('0xb')](function(_0x57af46){logger[_0x3921('0xc')](_0x3921('0x1f'),_0x5570fc);logger[_0x3921('0x22')](_0x3921('0x1f'),_0x5570fc,JSON['stringify'](_0x57af46));_0x5314c7(_0x57af46);})[_0x3921('0x1e')](function(_0x2efe48){logger[_0x3921('0x10')](_0x3921('0x1f'),_0x2efe48[_0x3921('0x13')],_0x5570fc);_0x1e4bb4(_0x382d2a[_0x3921('0x10')](0x1f4,_0x2efe48[_0x3921('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2b0a0ae..f983d47 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 _0x488f=['Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','express'];(function(_0x2ac1ca,_0x1e47d4){var _0x596155=function(_0x374f16){while(--_0x374f16){_0x2ac1ca['push'](_0x2ac1ca['shift']());}};_0x596155(++_0x1e47d4);}(_0x488f,0xfa));var _0xf488=function(_0x5869ed,_0x2d1f78){_0x5869ed=_0x5869ed-0x0;var _0x33c0af=_0x488f[_0x5869ed];return _0x33c0af;};'use strict';var multer=require(_0xf488('0x0'));var util=require(_0xf488('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf488('0x2'));var router=express[_0xf488('0x3')]();var auth=require(_0xf488('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf488('0x5'));var controller=require(_0xf488('0x6'));router[_0xf488('0x7')]('/',auth[_0xf488('0x8')](),controller[_0xf488('0x9')]);router[_0xf488('0x7')](_0xf488('0xa'),auth['isAuthenticated'](),controller[_0xf488('0xb')]);router[_0xf488('0x7')](_0xf488('0xc'),auth[_0xf488('0x8')](),controller[_0xf488('0xd')]);router[_0xf488('0x7')](_0xf488('0xe'),auth[_0xf488('0x8')](),controller['getSubjects']);router[_0xf488('0x7')](_0xf488('0xf'),auth[_0xf488('0x8')](),controller[_0xf488('0x10')]);router[_0xf488('0x11')]('/',auth[_0xf488('0x8')](),controller[_0xf488('0x12')]);router[_0xf488('0x13')]('/:id',auth[_0xf488('0x8')](),controller[_0xf488('0x14')]);router[_0xf488('0x15')](_0xf488('0xa'),auth[_0xf488('0x8')](),controller['destroy']);module[_0xf488('0x16')]=router; \ No newline at end of file +var _0x264e=['getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0x264e,0xaa));var _0xe264=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x264e[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe264('0x0'));var util=require(_0xe264('0x1'));var path=require(_0xe264('0x2'));var timeout=require('connect-timeout');var express=require(_0xe264('0x3'));var router=express[_0xe264('0x4')]();var auth=require(_0xe264('0x5'));var interaction=require(_0xe264('0x6'));var config=require('../../config/environment');var controller=require(_0xe264('0x7'));router[_0xe264('0x8')]('/',auth[_0xe264('0x9')](),controller['index']);router[_0xe264('0x8')](_0xe264('0xa'),auth[_0xe264('0x9')](),controller[_0xe264('0xb')]);router[_0xe264('0x8')](_0xe264('0xc'),auth[_0xe264('0x9')](),controller['getFields']);router[_0xe264('0x8')](_0xe264('0xd'),auth['isAuthenticated'](),controller[_0xe264('0xe')]);router[_0xe264('0x8')](_0xe264('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xe264('0x10')]('/',auth[_0xe264('0x9')](),controller[_0xe264('0x11')]);router[_0xe264('0x12')](_0xe264('0xa'),auth[_0xe264('0x9')](),controller[_0xe264('0x13')]);router[_0xe264('0x14')]('/:id',auth[_0xe264('0x9')](),controller[_0xe264('0x15')]);module[_0xe264('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 6d76716..fb1449c 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 _0xab39=['STRING','exports'];(function(_0x5de533,_0x47515a){var _0x25568a=function(_0x1d7c51){while(--_0x1d7c51){_0x5de533['push'](_0x5de533['shift']());}};_0x25568a(++_0x47515a);}(_0xab39,0x9f));var _0x9ab3=function(_0x2cc19d,_0x33d00f){_0x2cc19d=_0x2cc19d-0x0;var _0x37278f=_0xab39[_0x2cc19d];return _0x37278f;};'use strict';var Sequelize=require('sequelize');module[_0x9ab3('0x0')]={'name':{'type':Sequelize[_0x9ab3('0x1')]},'description':{'type':Sequelize[_0x9ab3('0x1')]}}; \ No newline at end of file +var _0xd856=['sequelize','STRING'];(function(_0x59449b,_0x4d31ad){var _0x3eda98=function(_0x30a999){while(--_0x30a999){_0x59449b['push'](_0x59449b['shift']());}};_0x3eda98(++_0x4d31ad);}(_0xd856,0x92));var _0x6d85=function(_0x55326b,_0x2a567c){_0x55326b=_0x55326b-0x0;var _0x2b6de6=_0xd856[_0x55326b];return _0x2b6de6;};'use strict';var Sequelize=require(_0x6d85('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d85('0x1')]},'description':{'type':Sequelize[_0x6d85('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index bf438cb..a822f2d 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 _0xf5ff=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','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','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','Content-Range','apply','save','update','end','stack','name','send','index','rawAttributes','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','SugarcrmConfiguration','findAll','rows','show','params','includeAll','create','body','find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','html-pdf'];(function(_0x3b46e0,_0x4ffb58){var _0x5a3eee=function(_0x4849fc){while(--_0x4849fc){_0x3b46e0['push'](_0x3b46e0['shift']());}};_0x5a3eee(++_0x4ffb58);}(_0xf5ff,0xaf));var _0xff5f=function(_0x2004c7,_0x423b09){_0x2004c7=_0x2004c7-0x0;var _0x51cd7a=_0xf5ff[_0x2004c7];return _0x51cd7a;};'use strict';var pdf=require(_0xff5f('0x0'));var emlformat=require(_0xff5f('0x1'));var rimraf=require(_0xff5f('0x2'));var zipdir=require(_0xff5f('0x3'));var jsonpatch=require(_0xff5f('0x4'));var rp=require(_0xff5f('0x5'));var moment=require(_0xff5f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xff5f('0x7'));var util=require(_0xff5f('0x8'));var path=require(_0xff5f('0x9'));var sox=require('sox');var csv=require(_0xff5f('0xa'));var ejs=require(_0xff5f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xff5f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xff5f('0xa'));var querystring=require('querystring');var Papa=require(_0xff5f('0xd'));var Redis=require(_0xff5f('0xe'));var authService=require(_0xff5f('0xf'));var qs=require(_0xff5f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff5f('0x11'));var logger=require(_0xff5f('0x12'))(_0xff5f('0x13'));var utils=require('../../config/utils');var config=require(_0xff5f('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xff5f('0x15'));var client=jayson[_0xff5f('0x16')][_0xff5f('0x17')]({'port':0x232a});function checkPasswordPattern(_0x552e0a,_0x4ebfea,_0x2a4876){if(_0x2a4876){var _0x304d11=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x304d11['test'](_0x4ebfea)){return _0x552e0a;}else{throw new db[(_0xff5f('0x18'))][(_0xff5f('0x19'))](_0xff5f('0x1a'));}}else{return _0x552e0a;}}function respondWithRpcPromise(_0x57e556,_0x540d33,_0x38fc8e,_0x3fded9){return new BPromise(function(_0x926e94,_0x3c86e1){var _0x5391f7=_0x3fded9||client;return _0x5391f7['request'](_0x57e556,_0x38fc8e)[_0xff5f('0x1b')](function(_0x1b1841){logger[_0xff5f('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x540d33,'request\x20sent');logger[_0xff5f('0x1d')](_0xff5f('0x1e'),_0x540d33,_0xff5f('0x1f'),JSON['stringify'](_0x1b1841));if(_0x1b1841['error']){if(_0x1b1841[_0xff5f('0x20')][_0xff5f('0x21')]===0x1f4){logger[_0xff5f('0x20')](_0xff5f('0x22'),_0x540d33,_0x1b1841[_0xff5f('0x20')][_0xff5f('0x23')]);return _0x3c86e1(_0x1b1841['error'][_0xff5f('0x23')]);}logger[_0xff5f('0x20')](_0xff5f('0x22'),_0x540d33,_0x1b1841[_0xff5f('0x20')][_0xff5f('0x23')]);return _0x926e94(_0x1b1841[_0xff5f('0x20')][_0xff5f('0x23')]);}else{logger[_0xff5f('0x1c')](_0xff5f('0x22'),_0x540d33,'request\x20sent');_0x926e94(_0x1b1841['result'][_0xff5f('0x23')]);}})[_0xff5f('0x24')](function(_0x1f5469){logger['error'](_0xff5f('0x22'),_0x540d33,_0x1f5469);_0x3c86e1(_0x1f5469);});});}function respondWithStatusCode(_0x5d91ce,_0xe44095){_0xe44095=_0xe44095||0xcc;return function(_0x7e3ddc){if(_0x7e3ddc){return _0x5d91ce[_0xff5f('0x25')](_0xe44095);}return _0x5d91ce[_0xff5f('0x26')](_0xe44095)['end']();};}function respondWithResult(_0x25e245,_0x74d8ac){_0x74d8ac=_0x74d8ac||0xc8;return function(_0x20fe5d){if(_0x20fe5d){return _0x25e245[_0xff5f('0x26')](_0x74d8ac)[_0xff5f('0x27')](_0x20fe5d);}};}function respondWithFilteredResult(_0x3287c2,_0x330293){return function(_0x431713){if(_0x431713){var _0x589473=_0x431713[_0xff5f('0x28')],_0x1af7b6=_0x330293[_0xff5f('0x29')],_0x1112cd=_0x330293[_0xff5f('0x29')]+_0x330293['limit'],_0x4cf852;if(_0x1112cd>=_0x589473){_0x1112cd=_0x589473;_0x4cf852=0xc8;}else{_0x4cf852=0xce;}_0x3287c2[_0xff5f('0x26')](_0x4cf852);return _0x3287c2['set'](_0xff5f('0x2a'),_0x1af7b6+'-'+_0x1112cd+'/'+_0x589473)['json'](_0x431713);}return null;};}function patchUpdates(_0x427868){return function(_0x2bfd38){try{jsonpatch[_0xff5f('0x2b')](_0x2bfd38,_0x427868,!![]);}catch(_0x15632f){return BPromise['reject'](_0x15632f);}return _0x2bfd38[_0xff5f('0x2c')]();};}function saveUpdates(_0x38ab17,_0x6fb56f){return function(_0x364f89){if(_0x364f89){return _0x364f89[_0xff5f('0x2d')](_0x38ab17)[_0xff5f('0x1b')](function(_0x483c06){return _0x483c06;});}return null;};}function removeEntity(_0x146215,_0x5d5f89){return function(_0x484de6){if(_0x484de6){return _0x484de6['destroy']()['then'](function(){_0x146215['status'](0xcc)[_0xff5f('0x2e')]();});}};}function handleEntityNotFound(_0x3d1a55,_0x22142f){return function(_0x2a34cb){if(!_0x2a34cb){_0x3d1a55['sendStatus'](0x194);}return _0x2a34cb;};}function handleError(_0x4307dc,_0x357857){_0x357857=_0x357857||0x1f4;return function(_0x2d5c7e){logger['error'](_0x2d5c7e[_0xff5f('0x2f')]);if(_0x2d5c7e[_0xff5f('0x30')]){delete _0x2d5c7e[_0xff5f('0x30')];}_0x4307dc['status'](_0x357857)[_0xff5f('0x31')](_0x2d5c7e);};}exports[_0xff5f('0x32')]=function(_0x8cb710,_0x1e5df7){var _0x23753a={},_0x8d0229={},_0x34b252={'count':0x0,'rows':[]};var _0x4fe350=_['map'](db['SugarcrmConfiguration'][_0xff5f('0x33')],function(_0x1afc50){return{'name':_0x1afc50['fieldName'],'type':_0x1afc50[_0xff5f('0x34')]['key']};});_0x8d0229[_0xff5f('0x35')]=_[_0xff5f('0x36')](_0x4fe350,_0xff5f('0x30'));_0x8d0229[_0xff5f('0x37')]=_[_0xff5f('0x38')](_0x8cb710[_0xff5f('0x37')]);_0x8d0229['filters']=_[_0xff5f('0x39')](_0x8d0229[_0xff5f('0x35')],_0x8d0229['query']);_0x23753a['attributes']=_[_0xff5f('0x39')](_0x8d0229[_0xff5f('0x35')],qs[_0xff5f('0x3a')](_0x8cb710[_0xff5f('0x37')][_0xff5f('0x3a')]));_0x23753a['attributes']=_0x23753a[_0xff5f('0x3b')][_0xff5f('0x3c')]?_0x23753a[_0xff5f('0x3b')]:_0x8d0229[_0xff5f('0x35')];if(!_0x8cb710[_0xff5f('0x37')][_0xff5f('0x3d')](_0xff5f('0x3e'))){_0x23753a[_0xff5f('0x3f')]=qs[_0xff5f('0x3f')](_0x8cb710['query'][_0xff5f('0x3f')]);_0x23753a[_0xff5f('0x29')]=qs['offset'](_0x8cb710[_0xff5f('0x37')][_0xff5f('0x29')]);}_0x23753a[_0xff5f('0x40')]=qs[_0xff5f('0x41')](_0x8cb710[_0xff5f('0x37')][_0xff5f('0x41')]);_0x23753a[_0xff5f('0x42')]=qs[_0xff5f('0x43')](_[_0xff5f('0x44')](_0x8cb710[_0xff5f('0x37')],_0x8d0229[_0xff5f('0x43')]),_0x4fe350);if(_0x8cb710['query'][_0xff5f('0x45')]){_0x23753a[_0xff5f('0x42')]=_[_0xff5f('0x46')](_0x23753a[_0xff5f('0x42')],{'$or':_[_0xff5f('0x36')](_0x4fe350,function(_0x48e4b9){if(_0x48e4b9[_0xff5f('0x34')]!==_0xff5f('0x47')){var _0x12ae46={};_0x12ae46[_0x48e4b9['name']]={'$like':'%'+_0x8cb710[_0xff5f('0x37')][_0xff5f('0x45')]+'%'};return _0x12ae46;}})});}_0x23753a=_[_0xff5f('0x46')]({},_0x23753a,_0x8cb710[_0xff5f('0x48')]);var _0x5b6893={'where':_0x23753a[_0xff5f('0x42')]};return db['SugarcrmConfiguration']['count'](_0x5b6893)[_0xff5f('0x1b')](function(_0x499aae){_0x34b252['count']=_0x499aae;if(_0x8cb710[_0xff5f('0x37')]['includeAll']){_0x23753a[_0xff5f('0x49')]=[{'all':!![]}];}return db[_0xff5f('0x4a')][_0xff5f('0x4b')](_0x23753a);})[_0xff5f('0x1b')](function(_0x1c8cf2){_0x34b252[_0xff5f('0x4c')]=_0x1c8cf2;return _0x34b252;})[_0xff5f('0x1b')](respondWithFilteredResult(_0x1e5df7,_0x23753a))['catch'](handleError(_0x1e5df7,null));};exports[_0xff5f('0x4d')]=function(_0x54cb71,_0x4e1481){var _0x9c07e2={'raw':![],'where':{'id':_0x54cb71[_0xff5f('0x4e')]['id']}},_0x30716d={};_0x30716d[_0xff5f('0x35')]=_['keys'](db[_0xff5f('0x4a')][_0xff5f('0x33')]);_0x30716d[_0xff5f('0x37')]=_['keys'](_0x54cb71[_0xff5f('0x37')]);_0x30716d[_0xff5f('0x43')]=_[_0xff5f('0x39')](_0x30716d[_0xff5f('0x35')],_0x30716d[_0xff5f('0x37')]);_0x9c07e2[_0xff5f('0x3b')]=_['intersection'](_0x30716d[_0xff5f('0x35')],qs['fields'](_0x54cb71[_0xff5f('0x37')][_0xff5f('0x3a')]));_0x9c07e2[_0xff5f('0x3b')]=_0x9c07e2['attributes'][_0xff5f('0x3c')]?_0x9c07e2['attributes']:_0x30716d[_0xff5f('0x35')];if(_0x54cb71[_0xff5f('0x37')][_0xff5f('0x4f')]){_0x9c07e2[_0xff5f('0x49')]=[{'all':!![]}];}_0x9c07e2=_[_0xff5f('0x46')]({},_0x9c07e2,_0x54cb71['options']);return db[_0xff5f('0x4a')]['find'](_0x9c07e2)[_0xff5f('0x1b')](handleEntityNotFound(_0x4e1481,null))[_0xff5f('0x1b')](respondWithResult(_0x4e1481,null))[_0xff5f('0x24')](handleError(_0x4e1481,null));};exports[_0xff5f('0x50')]=function(_0x14ffd3,_0x5b135d){return db['SugarcrmConfiguration'][_0xff5f('0x50')](_0x14ffd3[_0xff5f('0x51')],{})[_0xff5f('0x1b')](respondWithResult(_0x5b135d,0xc9))['catch'](handleError(_0x5b135d,null));};exports['update']=function(_0x3adf39,_0x1506f8){if(_0x3adf39[_0xff5f('0x51')]['id']){delete _0x3adf39['body']['id'];}return db[_0xff5f('0x4a')]['find']({'where':{'id':_0x3adf39['params']['id']}})[_0xff5f('0x1b')](handleEntityNotFound(_0x1506f8,null))[_0xff5f('0x1b')](saveUpdates(_0x3adf39['body'],null))['then'](respondWithResult(_0x1506f8,null))['catch'](handleError(_0x1506f8,null));};exports['destroy']=function(_0x1a0371,_0x1536a3){return db[_0xff5f('0x4a')][_0xff5f('0x52')]({'where':{'id':_0x1a0371[_0xff5f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1536a3,null))[_0xff5f('0x1b')](removeEntity(_0x1536a3,null))[_0xff5f('0x24')](handleError(_0x1536a3,null));};exports[_0xff5f('0x53')]=function(_0xe1dce7,_0x2a09b5,_0x101663){var _0x268f56={};var _0x1f4ddb={};var _0x2f3c10;var _0x59a21c;return db[_0xff5f('0x4a')][_0xff5f('0x54')]({'where':{'id':_0xe1dce7[_0xff5f('0x4e')]['id']}})[_0xff5f('0x1b')](handleEntityNotFound(_0x2a09b5,null))[_0xff5f('0x1b')](function(_0x13ea42){if(_0x13ea42){_0x2f3c10=_0x13ea42;_0x1f4ddb[_0xff5f('0x35')]=_[_0xff5f('0x38')](db[_0xff5f('0x55')][_0xff5f('0x33')]);_0x1f4ddb[_0xff5f('0x37')]=_[_0xff5f('0x38')](_0xe1dce7[_0xff5f('0x37')]);_0x1f4ddb[_0xff5f('0x43')]=_[_0xff5f('0x39')](_0x1f4ddb[_0xff5f('0x35')],_0x1f4ddb[_0xff5f('0x37')]);_0x268f56[_0xff5f('0x3b')]=_[_0xff5f('0x39')](_0x1f4ddb[_0xff5f('0x35')],qs[_0xff5f('0x3a')](_0xe1dce7[_0xff5f('0x37')][_0xff5f('0x3a')]));_0x268f56[_0xff5f('0x3b')]=_0x268f56[_0xff5f('0x3b')][_0xff5f('0x3c')]?_0x268f56[_0xff5f('0x3b')]:_0x1f4ddb['model'];_0x268f56['order']=qs[_0xff5f('0x41')](_0xe1dce7[_0xff5f('0x37')][_0xff5f('0x41')]);_0x268f56['where']=qs[_0xff5f('0x43')](_['pick'](_0xe1dce7[_0xff5f('0x37')],_0x1f4ddb[_0xff5f('0x43')]));if(_0xe1dce7[_0xff5f('0x37')][_0xff5f('0x45')]){_0x268f56[_0xff5f('0x42')]=_['merge'](_0x268f56['where'],{'$or':_[_0xff5f('0x36')](_0x268f56[_0xff5f('0x3b')],function(_0xbcd980){var _0xa49e8a={};_0xa49e8a[_0xbcd980]={'$like':'%'+_0xe1dce7[_0xff5f('0x37')][_0xff5f('0x45')]+'%'};return _0xa49e8a;})});}_0x268f56=_['merge']({},_0x268f56,_0xe1dce7[_0xff5f('0x48')]);return _0x2f3c10[_0xff5f('0x53')](_0x268f56);}})[_0xff5f('0x1b')](function(_0xad8b32){if(_0xad8b32){_0x59a21c=_0xad8b32[_0xff5f('0x3c')];if(!_0xe1dce7[_0xff5f('0x37')]['hasOwnProperty']('nolimit')){_0x268f56[_0xff5f('0x3f')]=qs['limit'](_0xe1dce7[_0xff5f('0x37')][_0xff5f('0x3f')]);_0x268f56['offset']=qs[_0xff5f('0x29')](_0xe1dce7[_0xff5f('0x37')][_0xff5f('0x29')]);}return _0x2f3c10[_0xff5f('0x53')](_0x268f56);}})[_0xff5f('0x1b')](function(_0x3d60a4){if(_0x3d60a4){return _0x3d60a4?{'count':_0x59a21c,'rows':_0x3d60a4}:null;}})[_0xff5f('0x1b')](respondWithResult(_0x2a09b5,null))[_0xff5f('0x24')](handleError(_0x2a09b5,null));};exports['getSubjects']=function(_0x27f4b0,_0x43ffd8,_0x336598){var _0x26e79a={};var _0x10ae83={};var _0xccc321;var _0x313f66;return db['SugarcrmConfiguration'][_0xff5f('0x54')]({'where':{'id':_0x27f4b0[_0xff5f('0x4e')]['id']}})[_0xff5f('0x1b')](handleEntityNotFound(_0x43ffd8,null))[_0xff5f('0x1b')](function(_0x4b9293){if(_0x4b9293){_0xccc321=_0x4b9293;_0x10ae83['model']=_[_0xff5f('0x38')](db['SugarcrmField'][_0xff5f('0x33')]);_0x10ae83[_0xff5f('0x37')]=_['keys'](_0x27f4b0[_0xff5f('0x37')]);_0x10ae83[_0xff5f('0x43')]=_[_0xff5f('0x39')](_0x10ae83['model'],_0x10ae83[_0xff5f('0x37')]);_0x26e79a[_0xff5f('0x3b')]=_[_0xff5f('0x39')](_0x10ae83[_0xff5f('0x35')],qs[_0xff5f('0x3a')](_0x27f4b0[_0xff5f('0x37')][_0xff5f('0x3a')]));_0x26e79a[_0xff5f('0x3b')]=_0x26e79a[_0xff5f('0x3b')][_0xff5f('0x3c')]?_0x26e79a[_0xff5f('0x3b')]:_0x10ae83[_0xff5f('0x35')];_0x26e79a[_0xff5f('0x40')]=qs[_0xff5f('0x41')](_0x27f4b0[_0xff5f('0x37')][_0xff5f('0x41')]);_0x26e79a[_0xff5f('0x42')]=qs['filters'](_[_0xff5f('0x44')](_0x27f4b0[_0xff5f('0x37')],_0x10ae83[_0xff5f('0x43')]));if(_0x27f4b0[_0xff5f('0x37')][_0xff5f('0x45')]){_0x26e79a['where']=_[_0xff5f('0x46')](_0x26e79a['where'],{'$or':_[_0xff5f('0x36')](_0x26e79a['attributes'],function(_0x5889d7){var _0x95ae11={};_0x95ae11[_0x5889d7]={'$like':'%'+_0x27f4b0[_0xff5f('0x37')][_0xff5f('0x45')]+'%'};return _0x95ae11;})});}_0x26e79a=_[_0xff5f('0x46')]({},_0x26e79a,_0x27f4b0['options']);return _0xccc321[_0xff5f('0x56')](_0x26e79a);}})['then'](function(_0xf67599){if(_0xf67599){_0x313f66=_0xf67599[_0xff5f('0x3c')];if(!_0x27f4b0[_0xff5f('0x37')][_0xff5f('0x3d')]('nolimit')){_0x26e79a[_0xff5f('0x3f')]=qs[_0xff5f('0x3f')](_0x27f4b0[_0xff5f('0x37')]['limit']);_0x26e79a['offset']=qs['offset'](_0x27f4b0[_0xff5f('0x37')][_0xff5f('0x29')]);}return _0xccc321[_0xff5f('0x56')](_0x26e79a);}})[_0xff5f('0x1b')](function(_0x1da086){if(_0x1da086){return _0x1da086?{'count':_0x313f66,'rows':_0x1da086}:null;}})[_0xff5f('0x1b')](respondWithResult(_0x43ffd8,null))['catch'](handleError(_0x43ffd8,null));};exports['getDescriptions']=function(_0x50b1c7,_0xb9ffb0,_0xd744c3){var _0x503648={};var _0x505a15={};var _0x3e43d5;var _0x21eb31;return db[_0xff5f('0x4a')]['findOne']({'where':{'id':_0x50b1c7[_0xff5f('0x4e')]['id']}})['then'](handleEntityNotFound(_0xb9ffb0,null))[_0xff5f('0x1b')](function(_0x1492bf){if(_0x1492bf){_0x3e43d5=_0x1492bf;_0x505a15['model']=_[_0xff5f('0x38')](db[_0xff5f('0x55')][_0xff5f('0x33')]);_0x505a15[_0xff5f('0x37')]=_[_0xff5f('0x38')](_0x50b1c7[_0xff5f('0x37')]);_0x505a15[_0xff5f('0x43')]=_[_0xff5f('0x39')](_0x505a15[_0xff5f('0x35')],_0x505a15['query']);_0x503648[_0xff5f('0x3b')]=_[_0xff5f('0x39')](_0x505a15[_0xff5f('0x35')],qs[_0xff5f('0x3a')](_0x50b1c7[_0xff5f('0x37')][_0xff5f('0x3a')]));_0x503648[_0xff5f('0x3b')]=_0x503648[_0xff5f('0x3b')][_0xff5f('0x3c')]?_0x503648[_0xff5f('0x3b')]:_0x505a15[_0xff5f('0x35')];_0x503648['order']=qs[_0xff5f('0x41')](_0x50b1c7[_0xff5f('0x37')][_0xff5f('0x41')]);_0x503648[_0xff5f('0x42')]=qs['filters'](_[_0xff5f('0x44')](_0x50b1c7[_0xff5f('0x37')],_0x505a15[_0xff5f('0x43')]));if(_0x50b1c7['query'][_0xff5f('0x45')]){_0x503648['where']=_[_0xff5f('0x46')](_0x503648[_0xff5f('0x42')],{'$or':_[_0xff5f('0x36')](_0x503648[_0xff5f('0x3b')],function(_0x5da641){var _0x5a7a5a={};_0x5a7a5a[_0x5da641]={'$like':'%'+_0x50b1c7[_0xff5f('0x37')][_0xff5f('0x45')]+'%'};return _0x5a7a5a;})});}_0x503648=_[_0xff5f('0x46')]({},_0x503648,_0x50b1c7[_0xff5f('0x48')]);return _0x3e43d5[_0xff5f('0x57')](_0x503648);}})[_0xff5f('0x1b')](function(_0x3026b9){if(_0x3026b9){_0x21eb31=_0x3026b9[_0xff5f('0x3c')];if(!_0x50b1c7[_0xff5f('0x37')][_0xff5f('0x3d')](_0xff5f('0x3e'))){_0x503648['limit']=qs[_0xff5f('0x3f')](_0x50b1c7[_0xff5f('0x37')][_0xff5f('0x3f')]);_0x503648['offset']=qs[_0xff5f('0x29')](_0x50b1c7[_0xff5f('0x37')][_0xff5f('0x29')]);}return _0x3e43d5[_0xff5f('0x57')](_0x503648);}})[_0xff5f('0x1b')](function(_0x12cd9a){if(_0x12cd9a){return _0x12cd9a?{'count':_0x21eb31,'rows':_0x12cd9a}:null;}})[_0xff5f('0x1b')](respondWithResult(_0xb9ffb0,null))['catch'](handleError(_0xb9ffb0,null));}; \ No newline at end of file +var _0xc54d=['fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','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','SugarcrmConfiguration,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','update','destroy','name','send','map','SugarcrmConfiguration','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','find','create','body','params','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x204e2f,_0x3c9d47){var _0x51233c=function(_0x2876bf){while(--_0x2876bf){_0x204e2f['push'](_0x204e2f['shift']());}};_0x51233c(++_0x3c9d47);}(_0xc54d,0x196));var _0xdc54=function(_0x2b59db,_0x2fd753){_0x2b59db=_0x2b59db-0x0;var _0x1b8a3b=_0xc54d[_0x2b59db];return _0x1b8a3b;};'use strict';var pdf=require(_0xdc54('0x0'));var emlformat=require(_0xdc54('0x1'));var rimraf=require(_0xdc54('0x2'));var zipdir=require(_0xdc54('0x3'));var jsonpatch=require(_0xdc54('0x4'));var rp=require(_0xdc54('0x5'));var moment=require(_0xdc54('0x6'));var BPromise=require(_0xdc54('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdc54('0x8'));var sox=require(_0xdc54('0x9'));var csv=require(_0xdc54('0xa'));var ejs=require(_0xdc54('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdc54('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdc54('0xd'));var toCsv=require(_0xdc54('0xa'));var querystring=require('querystring');var Papa=require(_0xdc54('0xe'));var Redis=require(_0xdc54('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdc54('0x10'));var hardwareService=require(_0xdc54('0x11'));var logger=require(_0xdc54('0x12'))(_0xdc54('0x13'));var utils=require(_0xdc54('0x14'));var config=require(_0xdc54('0x15'));var db=require(_0xdc54('0x16'))['db'];var jayson=require(_0xdc54('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x47abc6,_0x22f2ad,_0x33943c){if(_0x33943c){var _0x420ec3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x420ec3['test'](_0x22f2ad)){return _0x47abc6;}else{throw new db['Sequelize']['ValidationError'](_0xdc54('0x18'));}}else{return _0x47abc6;}}function respondWithRpcPromise(_0xbd5d17,_0x1e9165,_0x2d0a21,_0x2d297c){return new BPromise(function(_0x881580,_0x38865b){var _0x3bf29b=_0x2d297c||client;return _0x3bf29b[_0xdc54('0x19')](_0xbd5d17,_0x2d0a21)[_0xdc54('0x1a')](function(_0x4e7a15){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1e9165,_0xdc54('0x1b'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1e9165,'request\x20sent',JSON['stringify'](_0x4e7a15));if(_0x4e7a15[_0xdc54('0x1c')]){if(_0x4e7a15[_0xdc54('0x1c')][_0xdc54('0x1d')]===0x1f4){logger[_0xdc54('0x1c')](_0xdc54('0x1e'),_0x1e9165,_0x4e7a15[_0xdc54('0x1c')]['message']);return _0x38865b(_0x4e7a15[_0xdc54('0x1c')]['message']);}logger[_0xdc54('0x1c')](_0xdc54('0x1e'),_0x1e9165,_0x4e7a15['error'][_0xdc54('0x1f')]);return _0x881580(_0x4e7a15[_0xdc54('0x1c')]['message']);}else{logger[_0xdc54('0x20')](_0xdc54('0x1e'),_0x1e9165,_0xdc54('0x1b'));_0x881580(_0x4e7a15['result'][_0xdc54('0x1f')]);}})[_0xdc54('0x21')](function(_0x212686){logger[_0xdc54('0x1c')](_0xdc54('0x1e'),_0x1e9165,_0x212686);_0x38865b(_0x212686);});});}function respondWithStatusCode(_0x3450ad,_0x26038c){_0x26038c=_0x26038c||0xcc;return function(_0x1a0b01){if(_0x1a0b01){return _0x3450ad[_0xdc54('0x22')](_0x26038c);}return _0x3450ad[_0xdc54('0x23')](_0x26038c)[_0xdc54('0x24')]();};}function respondWithResult(_0x5a14d7,_0x43f85c){_0x43f85c=_0x43f85c||0xc8;return function(_0x5b5bac){if(_0x5b5bac){return _0x5a14d7[_0xdc54('0x23')](_0x43f85c)['json'](_0x5b5bac);}};}function respondWithFilteredResult(_0x540d1a,_0x19ff4f){return function(_0xab7ba1){if(_0xab7ba1){var _0x331ee2=_0xab7ba1[_0xdc54('0x25')],_0x24c72e=_0x19ff4f[_0xdc54('0x26')],_0x15917e=_0x19ff4f['offset']+_0x19ff4f[_0xdc54('0x27')],_0x5ea366;if(_0x15917e>=_0x331ee2){_0x15917e=_0x331ee2;_0x5ea366=0xc8;}else{_0x5ea366=0xce;}_0x540d1a[_0xdc54('0x23')](_0x5ea366);return _0x540d1a[_0xdc54('0x28')](_0xdc54('0x29'),_0x24c72e+'-'+_0x15917e+'/'+_0x331ee2)[_0xdc54('0x2a')](_0xab7ba1);}return null;};}function patchUpdates(_0x1f1aa1){return function(_0x4d1210){try{jsonpatch['apply'](_0x4d1210,_0x1f1aa1,!![]);}catch(_0x1cc381){return BPromise['reject'](_0x1cc381);}return _0x4d1210['save']();};}function saveUpdates(_0x26ea11,_0x4152c8){return function(_0x18dde2){if(_0x18dde2){return _0x18dde2[_0xdc54('0x2b')](_0x26ea11)[_0xdc54('0x1a')](function(_0x12bc2d){return _0x12bc2d;});}return null;};}function removeEntity(_0x520f29,_0x1b50fc){return function(_0x18623d){if(_0x18623d){return _0x18623d[_0xdc54('0x2c')]()[_0xdc54('0x1a')](function(){_0x520f29['status'](0xcc)[_0xdc54('0x24')]();});}};}function handleEntityNotFound(_0x39b6df,_0x122e8a){return function(_0x205ca0){if(!_0x205ca0){_0x39b6df[_0xdc54('0x22')](0x194);}return _0x205ca0;};}function handleError(_0x2c15f0,_0x1e0b56){_0x1e0b56=_0x1e0b56||0x1f4;return function(_0x185045){logger['error'](_0x185045['stack']);if(_0x185045[_0xdc54('0x2d')]){delete _0x185045['name'];}_0x2c15f0[_0xdc54('0x23')](_0x1e0b56)[_0xdc54('0x2e')](_0x185045);};}exports['index']=function(_0x2b259d,_0x31bd22){var _0x2d0b44={},_0x5e6d9e={},_0xbb447e={'count':0x0,'rows':[]};var _0x38853b=_[_0xdc54('0x2f')](db[_0xdc54('0x30')]['rawAttributes'],function(_0x29bce3){return{'name':_0x29bce3['fieldName'],'type':_0x29bce3[_0xdc54('0x31')]['key']};});_0x5e6d9e[_0xdc54('0x32')]=_[_0xdc54('0x2f')](_0x38853b,_0xdc54('0x2d'));_0x5e6d9e[_0xdc54('0x33')]=_['keys'](_0x2b259d[_0xdc54('0x33')]);_0x5e6d9e['filters']=_[_0xdc54('0x34')](_0x5e6d9e[_0xdc54('0x32')],_0x5e6d9e[_0xdc54('0x33')]);_0x2d0b44[_0xdc54('0x35')]=_[_0xdc54('0x34')](_0x5e6d9e['model'],qs[_0xdc54('0x36')](_0x2b259d[_0xdc54('0x33')][_0xdc54('0x36')]));_0x2d0b44[_0xdc54('0x35')]=_0x2d0b44[_0xdc54('0x35')][_0xdc54('0x37')]?_0x2d0b44[_0xdc54('0x35')]:_0x5e6d9e[_0xdc54('0x32')];if(!_0x2b259d[_0xdc54('0x33')][_0xdc54('0x38')](_0xdc54('0x39'))){_0x2d0b44['limit']=qs[_0xdc54('0x27')](_0x2b259d['query'][_0xdc54('0x27')]);_0x2d0b44[_0xdc54('0x26')]=qs['offset'](_0x2b259d[_0xdc54('0x33')][_0xdc54('0x26')]);}_0x2d0b44[_0xdc54('0x3a')]=qs[_0xdc54('0x3b')](_0x2b259d['query'][_0xdc54('0x3b')]);_0x2d0b44['where']=qs[_0xdc54('0x3c')](_[_0xdc54('0x3d')](_0x2b259d[_0xdc54('0x33')],_0x5e6d9e['filters']),_0x38853b);if(_0x2b259d['query'][_0xdc54('0x3e')]){_0x2d0b44[_0xdc54('0x3f')]=_['merge'](_0x2d0b44[_0xdc54('0x3f')],{'$or':_[_0xdc54('0x2f')](_0x38853b,function(_0x43bdff){if(_0x43bdff['type']!=='VIRTUAL'){var _0x5c015d={};_0x5c015d[_0x43bdff[_0xdc54('0x2d')]]={'$like':'%'+_0x2b259d[_0xdc54('0x33')][_0xdc54('0x3e')]+'%'};return _0x5c015d;}})});}_0x2d0b44=_[_0xdc54('0x40')]({},_0x2d0b44,_0x2b259d[_0xdc54('0x41')]);var _0x26d503={'where':_0x2d0b44[_0xdc54('0x3f')]};return db['SugarcrmConfiguration'][_0xdc54('0x25')](_0x26d503)[_0xdc54('0x1a')](function(_0x55ff26){_0xbb447e[_0xdc54('0x25')]=_0x55ff26;if(_0x2b259d[_0xdc54('0x33')][_0xdc54('0x42')]){_0x2d0b44[_0xdc54('0x43')]=[{'all':!![]}];}return db[_0xdc54('0x30')][_0xdc54('0x44')](_0x2d0b44);})[_0xdc54('0x1a')](function(_0x1ffc63){_0xbb447e[_0xdc54('0x45')]=_0x1ffc63;return _0xbb447e;})[_0xdc54('0x1a')](respondWithFilteredResult(_0x31bd22,_0x2d0b44))[_0xdc54('0x21')](handleError(_0x31bd22,null));};exports[_0xdc54('0x46')]=function(_0x2e45d7,_0x300a0e){var _0x953106={'raw':![],'where':{'id':_0x2e45d7['params']['id']}},_0x2fca04={};_0x2fca04[_0xdc54('0x32')]=_[_0xdc54('0x47')](db['SugarcrmConfiguration'][_0xdc54('0x48')]);_0x2fca04['query']=_[_0xdc54('0x47')](_0x2e45d7[_0xdc54('0x33')]);_0x2fca04[_0xdc54('0x3c')]=_[_0xdc54('0x34')](_0x2fca04[_0xdc54('0x32')],_0x2fca04[_0xdc54('0x33')]);_0x953106[_0xdc54('0x35')]=_[_0xdc54('0x34')](_0x2fca04[_0xdc54('0x32')],qs[_0xdc54('0x36')](_0x2e45d7[_0xdc54('0x33')][_0xdc54('0x36')]));_0x953106[_0xdc54('0x35')]=_0x953106[_0xdc54('0x35')]['length']?_0x953106[_0xdc54('0x35')]:_0x2fca04[_0xdc54('0x32')];if(_0x2e45d7[_0xdc54('0x33')][_0xdc54('0x42')]){_0x953106[_0xdc54('0x43')]=[{'all':!![]}];}_0x953106=_[_0xdc54('0x40')]({},_0x953106,_0x2e45d7[_0xdc54('0x41')]);return db[_0xdc54('0x30')][_0xdc54('0x49')](_0x953106)[_0xdc54('0x1a')](handleEntityNotFound(_0x300a0e,null))[_0xdc54('0x1a')](respondWithResult(_0x300a0e,null))[_0xdc54('0x21')](handleError(_0x300a0e,null));};exports[_0xdc54('0x4a')]=function(_0xe18282,_0xb01277){return db[_0xdc54('0x30')]['create'](_0xe18282['body'],{})[_0xdc54('0x1a')](respondWithResult(_0xb01277,0xc9))[_0xdc54('0x21')](handleError(_0xb01277,null));};exports[_0xdc54('0x2b')]=function(_0x442128,_0x25eb66){if(_0x442128[_0xdc54('0x4b')]['id']){delete _0x442128[_0xdc54('0x4b')]['id'];}return db['SugarcrmConfiguration'][_0xdc54('0x49')]({'where':{'id':_0x442128[_0xdc54('0x4c')]['id']}})[_0xdc54('0x1a')](handleEntityNotFound(_0x25eb66,null))[_0xdc54('0x1a')](saveUpdates(_0x442128['body'],null))[_0xdc54('0x1a')](respondWithResult(_0x25eb66,null))[_0xdc54('0x21')](handleError(_0x25eb66,null));};exports[_0xdc54('0x2c')]=function(_0x33444e,_0x2ea55d){return db[_0xdc54('0x30')][_0xdc54('0x49')]({'where':{'id':_0x33444e['params']['id']}})[_0xdc54('0x1a')](handleEntityNotFound(_0x2ea55d,null))['then'](removeEntity(_0x2ea55d,null))[_0xdc54('0x21')](handleError(_0x2ea55d,null));};exports[_0xdc54('0x4d')]=function(_0x47ab39,_0x31c270,_0x314b0e){var _0x5c8f07={};var _0x283ada={};var _0x38bf2f;var _0x39c833;return db[_0xdc54('0x30')][_0xdc54('0x4e')]({'where':{'id':_0x47ab39['params']['id']}})[_0xdc54('0x1a')](handleEntityNotFound(_0x31c270,null))[_0xdc54('0x1a')](function(_0x2efdf8){if(_0x2efdf8){_0x38bf2f=_0x2efdf8;_0x283ada['model']=_[_0xdc54('0x47')](db[_0xdc54('0x4f')]['rawAttributes']);_0x283ada['query']=_[_0xdc54('0x47')](_0x47ab39[_0xdc54('0x33')]);_0x283ada[_0xdc54('0x3c')]=_[_0xdc54('0x34')](_0x283ada[_0xdc54('0x32')],_0x283ada[_0xdc54('0x33')]);_0x5c8f07[_0xdc54('0x35')]=_[_0xdc54('0x34')](_0x283ada[_0xdc54('0x32')],qs[_0xdc54('0x36')](_0x47ab39[_0xdc54('0x33')][_0xdc54('0x36')]));_0x5c8f07[_0xdc54('0x35')]=_0x5c8f07[_0xdc54('0x35')][_0xdc54('0x37')]?_0x5c8f07[_0xdc54('0x35')]:_0x283ada[_0xdc54('0x32')];_0x5c8f07[_0xdc54('0x3a')]=qs['sort'](_0x47ab39[_0xdc54('0x33')][_0xdc54('0x3b')]);_0x5c8f07[_0xdc54('0x3f')]=qs['filters'](_[_0xdc54('0x3d')](_0x47ab39[_0xdc54('0x33')],_0x283ada[_0xdc54('0x3c')]));if(_0x47ab39['query']['filter']){_0x5c8f07[_0xdc54('0x3f')]=_['merge'](_0x5c8f07[_0xdc54('0x3f')],{'$or':_['map'](_0x5c8f07[_0xdc54('0x35')],function(_0x1a019f){var _0x32f27c={};_0x32f27c[_0x1a019f]={'$like':'%'+_0x47ab39[_0xdc54('0x33')][_0xdc54('0x3e')]+'%'};return _0x32f27c;})});}_0x5c8f07=_[_0xdc54('0x40')]({},_0x5c8f07,_0x47ab39[_0xdc54('0x41')]);return _0x38bf2f[_0xdc54('0x4d')](_0x5c8f07);}})['then'](function(_0x25edff){if(_0x25edff){_0x39c833=_0x25edff['length'];if(!_0x47ab39[_0xdc54('0x33')]['hasOwnProperty'](_0xdc54('0x39'))){_0x5c8f07[_0xdc54('0x27')]=qs[_0xdc54('0x27')](_0x47ab39[_0xdc54('0x33')][_0xdc54('0x27')]);_0x5c8f07['offset']=qs[_0xdc54('0x26')](_0x47ab39[_0xdc54('0x33')][_0xdc54('0x26')]);}return _0x38bf2f[_0xdc54('0x4d')](_0x5c8f07);}})[_0xdc54('0x1a')](function(_0x566114){if(_0x566114){return _0x566114?{'count':_0x39c833,'rows':_0x566114}:null;}})['then'](respondWithResult(_0x31c270,null))['catch'](handleError(_0x31c270,null));};exports[_0xdc54('0x50')]=function(_0x17e93f,_0xf2c131,_0x421cdd){var _0x333f1f={};var _0x3a5491={};var _0x4139e3;var _0x44a33e;return db[_0xdc54('0x30')][_0xdc54('0x4e')]({'where':{'id':_0x17e93f[_0xdc54('0x4c')]['id']}})[_0xdc54('0x1a')](handleEntityNotFound(_0xf2c131,null))[_0xdc54('0x1a')](function(_0x102fe6){if(_0x102fe6){_0x4139e3=_0x102fe6;_0x3a5491[_0xdc54('0x32')]=_[_0xdc54('0x47')](db[_0xdc54('0x4f')]['rawAttributes']);_0x3a5491[_0xdc54('0x33')]=_[_0xdc54('0x47')](_0x17e93f[_0xdc54('0x33')]);_0x3a5491[_0xdc54('0x3c')]=_[_0xdc54('0x34')](_0x3a5491[_0xdc54('0x32')],_0x3a5491[_0xdc54('0x33')]);_0x333f1f['attributes']=_['intersection'](_0x3a5491[_0xdc54('0x32')],qs[_0xdc54('0x36')](_0x17e93f[_0xdc54('0x33')][_0xdc54('0x36')]));_0x333f1f[_0xdc54('0x35')]=_0x333f1f[_0xdc54('0x35')][_0xdc54('0x37')]?_0x333f1f[_0xdc54('0x35')]:_0x3a5491['model'];_0x333f1f[_0xdc54('0x3a')]=qs['sort'](_0x17e93f[_0xdc54('0x33')][_0xdc54('0x3b')]);_0x333f1f['where']=qs[_0xdc54('0x3c')](_['pick'](_0x17e93f[_0xdc54('0x33')],_0x3a5491[_0xdc54('0x3c')]));if(_0x17e93f[_0xdc54('0x33')][_0xdc54('0x3e')]){_0x333f1f[_0xdc54('0x3f')]=_['merge'](_0x333f1f['where'],{'$or':_[_0xdc54('0x2f')](_0x333f1f[_0xdc54('0x35')],function(_0x2451b7){var _0x5333d8={};_0x5333d8[_0x2451b7]={'$like':'%'+_0x17e93f[_0xdc54('0x33')][_0xdc54('0x3e')]+'%'};return _0x5333d8;})});}_0x333f1f=_[_0xdc54('0x40')]({},_0x333f1f,_0x17e93f[_0xdc54('0x41')]);return _0x4139e3[_0xdc54('0x50')](_0x333f1f);}})[_0xdc54('0x1a')](function(_0x120307){if(_0x120307){_0x44a33e=_0x120307[_0xdc54('0x37')];if(!_0x17e93f[_0xdc54('0x33')][_0xdc54('0x38')]('nolimit')){_0x333f1f['limit']=qs[_0xdc54('0x27')](_0x17e93f['query']['limit']);_0x333f1f[_0xdc54('0x26')]=qs[_0xdc54('0x26')](_0x17e93f[_0xdc54('0x33')]['offset']);}return _0x4139e3[_0xdc54('0x50')](_0x333f1f);}})['then'](function(_0x514c66){if(_0x514c66){return _0x514c66?{'count':_0x44a33e,'rows':_0x514c66}:null;}})[_0xdc54('0x1a')](respondWithResult(_0xf2c131,null))[_0xdc54('0x21')](handleError(_0xf2c131,null));};exports['getDescriptions']=function(_0x46171f,_0xec0541,_0x41959d){var _0x542cfc={};var _0x30899d={};var _0x201712;var _0xa3cadd;return db[_0xdc54('0x30')][_0xdc54('0x4e')]({'where':{'id':_0x46171f[_0xdc54('0x4c')]['id']}})[_0xdc54('0x1a')](handleEntityNotFound(_0xec0541,null))[_0xdc54('0x1a')](function(_0x29d602){if(_0x29d602){_0x201712=_0x29d602;_0x30899d[_0xdc54('0x32')]=_['keys'](db['SugarcrmField'][_0xdc54('0x48')]);_0x30899d[_0xdc54('0x33')]=_[_0xdc54('0x47')](_0x46171f['query']);_0x30899d[_0xdc54('0x3c')]=_[_0xdc54('0x34')](_0x30899d['model'],_0x30899d[_0xdc54('0x33')]);_0x542cfc[_0xdc54('0x35')]=_[_0xdc54('0x34')](_0x30899d['model'],qs[_0xdc54('0x36')](_0x46171f['query'][_0xdc54('0x36')]));_0x542cfc[_0xdc54('0x35')]=_0x542cfc['attributes']['length']?_0x542cfc[_0xdc54('0x35')]:_0x30899d[_0xdc54('0x32')];_0x542cfc[_0xdc54('0x3a')]=qs[_0xdc54('0x3b')](_0x46171f[_0xdc54('0x33')][_0xdc54('0x3b')]);_0x542cfc[_0xdc54('0x3f')]=qs[_0xdc54('0x3c')](_[_0xdc54('0x3d')](_0x46171f['query'],_0x30899d[_0xdc54('0x3c')]));if(_0x46171f[_0xdc54('0x33')][_0xdc54('0x3e')]){_0x542cfc['where']=_[_0xdc54('0x40')](_0x542cfc[_0xdc54('0x3f')],{'$or':_['map'](_0x542cfc['attributes'],function(_0x63ca90){var _0x4562f6={};_0x4562f6[_0x63ca90]={'$like':'%'+_0x46171f['query'][_0xdc54('0x3e')]+'%'};return _0x4562f6;})});}_0x542cfc=_[_0xdc54('0x40')]({},_0x542cfc,_0x46171f[_0xdc54('0x41')]);return _0x201712[_0xdc54('0x51')](_0x542cfc);}})[_0xdc54('0x1a')](function(_0x2a2586){if(_0x2a2586){_0xa3cadd=_0x2a2586[_0xdc54('0x37')];if(!_0x46171f[_0xdc54('0x33')][_0xdc54('0x38')](_0xdc54('0x39'))){_0x542cfc[_0xdc54('0x27')]=qs[_0xdc54('0x27')](_0x46171f[_0xdc54('0x33')][_0xdc54('0x27')]);_0x542cfc[_0xdc54('0x26')]=qs[_0xdc54('0x26')](_0x46171f['query'][_0xdc54('0x26')]);}return _0x201712[_0xdc54('0x51')](_0x542cfc);}})[_0xdc54('0x1a')](function(_0x1d8a0d){if(_0x1d8a0d){return _0x1d8a0d?{'count':_0xa3cadd,'rows':_0x1d8a0d}:null;}})[_0xdc54('0x1a')](respondWithResult(_0xec0541,null))[_0xdc54('0x21')](handleError(_0xec0541,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f55dd51..0269a78 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 _0x4dec=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x424504,_0x31c597){var _0x3f2e43=function(_0x27c1eb){while(--_0x27c1eb){_0x424504['push'](_0x424504['shift']());}};_0x3f2e43(++_0x31c597);}(_0x4dec,0x193));var _0xc4de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4dec[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xc4de('0x0'));var logger=require(_0xc4de('0x1'))(_0xc4de('0x2'));var moment=require(_0xc4de('0x3'));var BPromise=require(_0xc4de('0x4'));var rp=require(_0xc4de('0x5'));var fs=require('fs');var path=require(_0xc4de('0x6'));var rimraf=require(_0xc4de('0x7'));var config=require(_0xc4de('0x8'));var attributes=require(_0xc4de('0x9'));module[_0xc4de('0xa')]=function(_0x1978ac,_0x2b20eb){return _0x1978ac[_0xc4de('0xb')](_0xc4de('0xc'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebf2=['define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x5c469a,_0xf8915a){var _0x4a4fc4=function(_0xc7f881){while(--_0xc7f881){_0x5c469a['push'](_0x5c469a['shift']());}};_0x4a4fc4(++_0xf8915a);}(_0xebf2,0x148));var _0x2ebf=function(_0x2ffa5d,_0x561edb){_0x2ffa5d=_0x2ffa5d-0x0;var _0x92c355=_0xebf2[_0x2ffa5d];return _0x92c355;};'use strict';var _=require(_0x2ebf('0x0'));var util=require(_0x2ebf('0x1'));var logger=require(_0x2ebf('0x2'))('api');var moment=require(_0x2ebf('0x3'));var BPromise=require(_0x2ebf('0x4'));var rp=require(_0x2ebf('0x5'));var fs=require('fs');var path=require(_0x2ebf('0x6'));var rimraf=require(_0x2ebf('0x7'));var config=require(_0x2ebf('0x8'));var attributes=require(_0x2ebf('0x9'));module['exports']=function(_0x3695f3,_0x43af9b){return _0x3695f3[_0x2ebf('0xa')](_0x2ebf('0xb'),attributes,{'tableName':_0x2ebf('0xc'),'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 3791d0f..b5b1f12 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 _0x9719=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9719,0x160));var _0x9971=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9719[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9971('0x0'));var util=require(_0x9971('0x1'));var moment=require(_0x9971('0x2'));var BPromise=require(_0x9971('0x3'));var rs=require(_0x9971('0x4'));var fs=require('fs');var Redis=require(_0x9971('0x5'));var db=require(_0x9971('0x6'))['db'];var utils=require(_0x9971('0x7'));var logger=require(_0x9971('0x8'))(_0x9971('0x9'));var config=require(_0x9971('0xa'));var jayson=require(_0x9971('0xb'));var client=jayson[_0x9971('0xc')][_0x9971('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x48a8e9,_0x564899,_0x3e4738){return new BPromise(function(_0x5d901f,_0x4f1499){return client[_0x9971('0xe')](_0x48a8e9,_0x3e4738)[_0x9971('0xf')](function(_0x398a20){logger[_0x9971('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x564899,'request\x20sent');logger[_0x9971('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x564899,_0x9971('0x12'),JSON['stringify'](_0x398a20));if(_0x398a20['error']){if(_0x398a20[_0x9971('0x13')][_0x9971('0x14')]===0x1f4){logger[_0x9971('0x13')](_0x9971('0x15'),_0x564899,_0x398a20[_0x9971('0x13')][_0x9971('0x16')]);return _0x4f1499(_0x398a20[_0x9971('0x13')]['message']);}logger[_0x9971('0x13')](_0x9971('0x15'),_0x564899,_0x398a20[_0x9971('0x13')]['message']);return _0x5d901f(_0x398a20[_0x9971('0x13')]['message']);}else{logger[_0x9971('0x10')](_0x9971('0x15'),_0x564899,_0x9971('0x12'));_0x5d901f(_0x398a20[_0x9971('0x17')][_0x9971('0x16')]);}})['catch'](function(_0x2097f9){logger[_0x9971('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x564899,_0x2097f9);_0x4f1499(_0x2097f9);});});} \ No newline at end of file +var _0x0f0e=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment','bluebird','randomstring'];(function(_0x271490,_0x31a1a9){var _0x5e71b4=function(_0x4bc773){while(--_0x4bc773){_0x271490['push'](_0x271490['shift']());}};_0x5e71b4(++_0x31a1a9);}(_0x0f0e,0x178));var _0xe0f0=function(_0x15da07,_0x89d55c){_0x15da07=_0x15da07-0x0;var _0x542d84=_0x0f0e[_0x15da07];return _0x542d84;};'use strict';var _=require('lodash');var util=require(_0xe0f0('0x0'));var moment=require(_0xe0f0('0x1'));var BPromise=require(_0xe0f0('0x2'));var rs=require(_0xe0f0('0x3'));var fs=require('fs');var Redis=require(_0xe0f0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0f0('0x5'));var logger=require(_0xe0f0('0x6'))('rpc');var config=require(_0xe0f0('0x7'));var jayson=require(_0xe0f0('0x8'));var client=jayson[_0xe0f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c89ff,_0x44dc9d,_0x99161e){return new BPromise(function(_0x3aa4fb,_0x278d9c){return client['request'](_0x4c89ff,_0x99161e)['then'](function(_0x19c50b){logger['info'](_0xe0f0('0xa'),_0x44dc9d,_0xe0f0('0xb'));logger[_0xe0f0('0xc')](_0xe0f0('0xd'),_0x44dc9d,_0xe0f0('0xb'),JSON[_0xe0f0('0xe')](_0x19c50b));if(_0x19c50b['error']){if(_0x19c50b['error']['code']===0x1f4){logger[_0xe0f0('0xf')](_0xe0f0('0xa'),_0x44dc9d,_0x19c50b[_0xe0f0('0xf')][_0xe0f0('0x10')]);return _0x278d9c(_0x19c50b[_0xe0f0('0xf')][_0xe0f0('0x10')]);}logger['error'](_0xe0f0('0xa'),_0x44dc9d,_0x19c50b[_0xe0f0('0xf')][_0xe0f0('0x10')]);return _0x3aa4fb(_0x19c50b[_0xe0f0('0xf')][_0xe0f0('0x10')]);}else{logger[_0xe0f0('0x11')](_0xe0f0('0xa'),_0x44dc9d,_0xe0f0('0xb'));_0x3aa4fb(_0x19c50b[_0xe0f0('0x12')][_0xe0f0('0x10')]);}})['catch'](function(_0x3ccc67){logger[_0xe0f0('0xf')](_0xe0f0('0xa'),_0x44dc9d,_0x3ccc67);_0x278d9c(_0x3ccc67);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index dea7558..0683c20 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 _0xaac2=['update','delete','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','show','put'];(function(_0xdbc3e2,_0x195d04){var _0x399a21=function(_0x219ec8){while(--_0x219ec8){_0xdbc3e2['push'](_0xdbc3e2['shift']());}};_0x399a21(++_0x195d04);}(_0xaac2,0x1b4));var _0x2aac=function(_0x31747e,_0x580e59){_0x31747e=_0x31747e-0x0;var _0x408ea9=_0xaac2[_0x31747e];return _0x408ea9;};'use strict';var multer=require('multer');var util=require(_0x2aac('0x0'));var path=require(_0x2aac('0x1'));var timeout=require(_0x2aac('0x2'));var express=require(_0x2aac('0x3'));var router=express[_0x2aac('0x4')]();var auth=require(_0x2aac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2aac('0x6'));var controller=require(_0x2aac('0x7'));router['get']('/',auth[_0x2aac('0x8')](),controller[_0x2aac('0x9')]);router['get']('/:id',auth[_0x2aac('0x8')](),controller[_0x2aac('0xa')]);router['post']('/',auth[_0x2aac('0x8')](),controller['create']);router[_0x2aac('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2aac('0xc')]);router[_0x2aac('0xd')](_0x2aac('0xe'),auth[_0x2aac('0x8')](),controller['destroy']);module[_0x2aac('0xf')]=router; \ No newline at end of file +var _0x7bf1=['create','put','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','post'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x7bf1,0xd8));var _0x17bf=function(_0x35d3d0,_0x311a01){_0x35d3d0=_0x35d3d0-0x0;var _0x20fd26=_0x7bf1[_0x35d3d0];return _0x20fd26;};'use strict';var multer=require(_0x17bf('0x0'));var util=require(_0x17bf('0x1'));var path=require(_0x17bf('0x2'));var timeout=require(_0x17bf('0x3'));var express=require(_0x17bf('0x4'));var router=express['Router']();var auth=require(_0x17bf('0x5'));var interaction=require(_0x17bf('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x17bf('0x7')]('/',auth['isAuthenticated'](),controller[_0x17bf('0x8')]);router[_0x17bf('0x7')](_0x17bf('0x9'),auth['isAuthenticated'](),controller[_0x17bf('0xa')]);router[_0x17bf('0xb')]('/',auth['isAuthenticated'](),controller[_0x17bf('0xc')]);router[_0x17bf('0xd')](_0x17bf('0x9'),auth['isAuthenticated'](),controller[_0x17bf('0xe')]);router[_0x17bf('0xf')](_0x17bf('0x9'),auth[_0x17bf('0x10')](),controller[_0x17bf('0x11')]);module[_0x17bf('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 f51ab0b..f1cb418 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 _0x6510=['exports','ENUM','string','variable','keyValue','STRING','customVariable','sequelize'];(function(_0x346d3e,_0x30abd9){var _0x56824f=function(_0x3324b4){while(--_0x3324b4){_0x346d3e['push'](_0x346d3e['shift']());}};_0x56824f(++_0x30abd9);}(_0x6510,0x77));var _0x0651=function(_0x214844,_0x342150){_0x214844=_0x214844-0x0;var _0x3cb5b1=_0x6510[_0x214844];return _0x3cb5b1;};'use strict';var Sequelize=require(_0x0651('0x0'));module[_0x0651('0x1')]={'type':{'type':Sequelize[_0x0651('0x2')](_0x0651('0x3'),_0x0651('0x4'),'customVariable',_0x0651('0x5')),'defaultValue':_0x0651('0x3')},'content':{'type':Sequelize[_0x0651('0x6')]},'key':{'type':Sequelize[_0x0651('0x6')]},'keyType':{'type':Sequelize[_0x0651('0x2')]('string',_0x0651('0x4'),_0x0651('0x7'))},'keyContent':{'type':Sequelize[_0x0651('0x6')]},'idField':{'type':Sequelize[_0x0651('0x6')]},'nameField':{'type':Sequelize[_0x0651('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0651('0x6')]}}; \ No newline at end of file +var _0x8c39=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x487c5c,_0x1526e4){var _0x17640c=function(_0x53e36b){while(--_0x53e36b){_0x487c5c['push'](_0x487c5c['shift']());}};_0x17640c(++_0x1526e4);}(_0x8c39,0x1df));var _0x98c3=function(_0x1fd596,_0x21a7aa){_0x1fd596=_0x1fd596-0x0;var _0x5741e2=_0x8c39[_0x1fd596];return _0x5741e2;};'use strict';var Sequelize=require(_0x98c3('0x0'));module['exports']={'type':{'type':Sequelize[_0x98c3('0x1')](_0x98c3('0x2'),_0x98c3('0x3'),_0x98c3('0x4'),_0x98c3('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x98c3('0x6')]},'key':{'type':Sequelize[_0x98c3('0x6')]},'keyType':{'type':Sequelize[_0x98c3('0x1')]('string',_0x98c3('0x3'),_0x98c3('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x98c3('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x98c3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98c3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 31fb6f3..ae6e189 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 _0x015e=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','offset','sort','where','pick','merge','type','includeAll','include','SugarcrmField','findAll','catch','show','params','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1badb1,_0x375ec6){var _0x260dae=function(_0x2f3bbc){while(--_0x2f3bbc){_0x1badb1['push'](_0x1badb1['shift']());}};_0x260dae(++_0x375ec6);}(_0x015e,0x1cf));var _0xe015=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x015e[_0x32b542];return _0x554d54;};'use strict';var pdf=require(_0xe015('0x0'));var emlformat=require(_0xe015('0x1'));var rimraf=require(_0xe015('0x2'));var zipdir=require(_0xe015('0x3'));var jsonpatch=require(_0xe015('0x4'));var rp=require(_0xe015('0x5'));var moment=require(_0xe015('0x6'));var BPromise=require(_0xe015('0x7'));var Mustache=require('mustache');var util=require(_0xe015('0x8'));var path=require(_0xe015('0x9'));var sox=require(_0xe015('0xa'));var csv=require(_0xe015('0xb'));var ejs=require(_0xe015('0xc'));var fs=require('fs');var _=require(_0xe015('0xd'));var squel=require('squel');var crypto=require(_0xe015('0xe'));var jsforce=require(_0xe015('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe015('0xb'));var querystring=require('querystring');var Papa=require(_0xe015('0x10'));var Redis=require(_0xe015('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe015('0x12'));var as=require(_0xe015('0x13'));var hardwareService=require(_0xe015('0x14'));var logger=require(_0xe015('0x15'))('api');var utils=require(_0xe015('0x16'));var config=require(_0xe015('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d2b5c,_0x3b72f0){_0x3b72f0=_0x3b72f0||0xcc;return function(_0x2e5d18){if(_0x2e5d18){return _0x4d2b5c[_0xe015('0x18')](_0x3b72f0);}return _0x4d2b5c[_0xe015('0x19')](_0x3b72f0)[_0xe015('0x1a')]();};}function respondWithResult(_0xf848be,_0x432303){_0x432303=_0x432303||0xc8;return function(_0x4f3648){if(_0x4f3648){return _0xf848be[_0xe015('0x19')](_0x432303)['json'](_0x4f3648);}};}function respondWithFilteredResult(_0xbfae2f,_0xc77d89){return function(_0xfbd635){if(_0xfbd635){var _0x463e5b=_0xfbd635[_0xe015('0x1b')],_0x489e6d=_0xc77d89['offset'],_0x45b05a=_0xc77d89['offset']+_0xc77d89[_0xe015('0x1c')],_0x4a01b6;if(_0x45b05a>=_0x463e5b){_0x45b05a=_0x463e5b;_0x4a01b6=0xc8;}else{_0x4a01b6=0xce;}_0xbfae2f['status'](_0x4a01b6);return _0xbfae2f[_0xe015('0x1d')](_0xe015('0x1e'),_0x489e6d+'-'+_0x45b05a+'/'+_0x463e5b)[_0xe015('0x1f')](_0xfbd635);}return null;};}function patchUpdates(_0x2a6e47){return function(_0x56cf9a){try{jsonpatch[_0xe015('0x20')](_0x56cf9a,_0x2a6e47,!![]);}catch(_0x242adf){return BPromise[_0xe015('0x21')](_0x242adf);}return _0x56cf9a['save']();};}function saveUpdates(_0x3d7111,_0x1c328c){return function(_0x3e07f5){if(_0x3e07f5){return _0x3e07f5[_0xe015('0x22')](_0x3d7111)[_0xe015('0x23')](function(_0x211e17){return _0x211e17;});}return null;};}function removeEntity(_0x18736a,_0x2afcf0){return function(_0x360a95){if(_0x360a95){return _0x360a95[_0xe015('0x24')]()[_0xe015('0x23')](function(){_0x18736a[_0xe015('0x19')](0xcc)[_0xe015('0x1a')]();});}};}function handleEntityNotFound(_0x13dccf,_0x453855){return function(_0x276af9){if(!_0x276af9){_0x13dccf['sendStatus'](0x194);}return _0x276af9;};}function handleError(_0x296b53,_0x31e61b){_0x31e61b=_0x31e61b||0x1f4;return function(_0x41ca35){logger[_0xe015('0x25')](_0x41ca35['stack']);if(_0x41ca35['name']){delete _0x41ca35[_0xe015('0x26')];}_0x296b53[_0xe015('0x19')](_0x31e61b)[_0xe015('0x27')](_0x41ca35);};}exports[_0xe015('0x28')]=function(_0x270d52,_0x1cb0d4){var _0x13179c={},_0x5b0639={},_0x43ab52={'count':0x0,'rows':[]};var _0x42c5f5=_[_0xe015('0x29')](db['SugarcrmField'][_0xe015('0x2a')],function(_0x342670){return{'name':_0x342670[_0xe015('0x2b')],'type':_0x342670['type'][_0xe015('0x2c')]};});_0x5b0639[_0xe015('0x2d')]=_[_0xe015('0x29')](_0x42c5f5,_0xe015('0x26'));_0x5b0639[_0xe015('0x2e')]=_[_0xe015('0x2f')](_0x270d52[_0xe015('0x2e')]);_0x5b0639[_0xe015('0x30')]=_[_0xe015('0x31')](_0x5b0639['model'],_0x5b0639[_0xe015('0x2e')]);_0x13179c[_0xe015('0x32')]=_[_0xe015('0x31')](_0x5b0639['model'],qs['fields'](_0x270d52[_0xe015('0x2e')][_0xe015('0x33')]));_0x13179c[_0xe015('0x32')]=_0x13179c[_0xe015('0x32')]['length']?_0x13179c[_0xe015('0x32')]:_0x5b0639[_0xe015('0x2d')];if(!_0x270d52[_0xe015('0x2e')]['hasOwnProperty']('nolimit')){_0x13179c['limit']=qs['limit'](_0x270d52['query'][_0xe015('0x1c')]);_0x13179c['offset']=qs['offset'](_0x270d52[_0xe015('0x2e')][_0xe015('0x34')]);}_0x13179c['order']=qs['sort'](_0x270d52[_0xe015('0x2e')][_0xe015('0x35')]);_0x13179c[_0xe015('0x36')]=qs['filters'](_[_0xe015('0x37')](_0x270d52['query'],_0x5b0639[_0xe015('0x30')]),_0x42c5f5);if(_0x270d52[_0xe015('0x2e')]['filter']){_0x13179c['where']=_[_0xe015('0x38')](_0x13179c[_0xe015('0x36')],{'$or':_[_0xe015('0x29')](_0x42c5f5,function(_0x29c5bf){if(_0x29c5bf[_0xe015('0x39')]!=='VIRTUAL'){var _0x3a0c76={};_0x3a0c76[_0x29c5bf['name']]={'$like':'%'+_0x270d52[_0xe015('0x2e')]['filter']+'%'};return _0x3a0c76;}})});}_0x13179c=_[_0xe015('0x38')]({},_0x13179c,_0x270d52['options']);var _0x56d825={'where':_0x13179c[_0xe015('0x36')]};return db['SugarcrmField']['count'](_0x56d825)['then'](function(_0x36d925){_0x43ab52[_0xe015('0x1b')]=_0x36d925;if(_0x270d52[_0xe015('0x2e')][_0xe015('0x3a')]){_0x13179c[_0xe015('0x3b')]=[{'all':!![]}];}return db[_0xe015('0x3c')][_0xe015('0x3d')](_0x13179c);})['then'](function(_0x180820){_0x43ab52['rows']=_0x180820;return _0x43ab52;})[_0xe015('0x23')](respondWithFilteredResult(_0x1cb0d4,_0x13179c))[_0xe015('0x3e')](handleError(_0x1cb0d4,null));};exports[_0xe015('0x3f')]=function(_0x479a9d,_0x113dc0){var _0xf8638a={'raw':!![],'where':{'id':_0x479a9d[_0xe015('0x40')]['id']}},_0x233ff4={};_0x233ff4['model']=_[_0xe015('0x2f')](db['SugarcrmField']['rawAttributes']);_0x233ff4['query']=_[_0xe015('0x2f')](_0x479a9d[_0xe015('0x2e')]);_0x233ff4[_0xe015('0x30')]=_[_0xe015('0x31')](_0x233ff4[_0xe015('0x2d')],_0x233ff4[_0xe015('0x2e')]);_0xf8638a[_0xe015('0x32')]=_[_0xe015('0x31')](_0x233ff4[_0xe015('0x2d')],qs[_0xe015('0x33')](_0x479a9d[_0xe015('0x2e')][_0xe015('0x33')]));_0xf8638a[_0xe015('0x32')]=_0xf8638a[_0xe015('0x32')]['length']?_0xf8638a[_0xe015('0x32')]:_0x233ff4[_0xe015('0x2d')];if(_0x479a9d['query'][_0xe015('0x3a')]){_0xf8638a[_0xe015('0x3b')]=[{'all':!![]}];}_0xf8638a=_[_0xe015('0x38')]({},_0xf8638a,_0x479a9d[_0xe015('0x41')]);return db['SugarcrmField'][_0xe015('0x42')](_0xf8638a)[_0xe015('0x23')](handleEntityNotFound(_0x113dc0,null))[_0xe015('0x23')](respondWithResult(_0x113dc0,null))[_0xe015('0x3e')](handleError(_0x113dc0,null));};exports[_0xe015('0x43')]=function(_0x233275,_0x2dc5e3){return db[_0xe015('0x3c')][_0xe015('0x43')](_0x233275[_0xe015('0x44')],{})['then'](respondWithResult(_0x2dc5e3,0xc9))[_0xe015('0x3e')](handleError(_0x2dc5e3,null));};exports[_0xe015('0x22')]=function(_0x57b24a,_0x419290){if(_0x57b24a[_0xe015('0x44')]['id']){delete _0x57b24a[_0xe015('0x44')]['id'];}return db[_0xe015('0x3c')][_0xe015('0x42')]({'where':{'id':_0x57b24a[_0xe015('0x40')]['id']}})['then'](handleEntityNotFound(_0x419290,null))[_0xe015('0x23')](saveUpdates(_0x57b24a['body'],null))[_0xe015('0x23')](respondWithResult(_0x419290,null))[_0xe015('0x3e')](handleError(_0x419290,null));};exports[_0xe015('0x24')]=function(_0x3272e3,_0xd7394e){return db[_0xe015('0x3c')][_0xe015('0x42')]({'where':{'id':_0x3272e3['params']['id']}})['then'](handleEntityNotFound(_0xd7394e,null))[_0xe015('0x23')](removeEntity(_0xd7394e,null))[_0xe015('0x3e')](handleError(_0xd7394e,null));}; \ No newline at end of file +var _0x0bf8=['pick','filter','merge','map','type','SugarcrmField','includeAll','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where'];(function(_0x3bbf44,_0xc0c8b2){var _0x4d7193=function(_0x37a5fb){while(--_0x37a5fb){_0x3bbf44['push'](_0x3bbf44['shift']());}};_0x4d7193(++_0xc0c8b2);}(_0x0bf8,0x171));var _0x80bf=function(_0xe1b14b,_0x275799){_0xe1b14b=_0xe1b14b-0x0;var _0x21da52=_0x0bf8[_0xe1b14b];return _0x21da52;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x80bf('0x0'));var zipdir=require(_0x80bf('0x1'));var jsonpatch=require(_0x80bf('0x2'));var rp=require(_0x80bf('0x3'));var moment=require('moment');var BPromise=require(_0x80bf('0x4'));var Mustache=require(_0x80bf('0x5'));var util=require('util');var path=require(_0x80bf('0x6'));var sox=require(_0x80bf('0x7'));var csv=require(_0x80bf('0x8'));var ejs=require(_0x80bf('0x9'));var fs=require('fs');var _=require(_0x80bf('0xa'));var squel=require(_0x80bf('0xb'));var crypto=require(_0x80bf('0xc'));var jsforce=require(_0x80bf('0xd'));var deskjs=require(_0x80bf('0xe'));var toCsv=require(_0x80bf('0x8'));var querystring=require(_0x80bf('0xf'));var Papa=require(_0x80bf('0x10'));var Redis=require('ioredis');var authService=require(_0x80bf('0x11'));var qs=require(_0x80bf('0x12'));var as=require(_0x80bf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80bf('0x14'))(_0x80bf('0x15'));var utils=require(_0x80bf('0x16'));var config=require('../../config/environment');var db=require(_0x80bf('0x17'))['db'];function respondWithStatusCode(_0x147b7c,_0x1e419d){_0x1e419d=_0x1e419d||0xcc;return function(_0x134ebe){if(_0x134ebe){return _0x147b7c[_0x80bf('0x18')](_0x1e419d);}return _0x147b7c['status'](_0x1e419d)['end']();};}function respondWithResult(_0x58e327,_0xeb6389){_0xeb6389=_0xeb6389||0xc8;return function(_0x1cd14e){if(_0x1cd14e){return _0x58e327[_0x80bf('0x19')](_0xeb6389)[_0x80bf('0x1a')](_0x1cd14e);}};}function respondWithFilteredResult(_0x45f86f,_0x2cb48b){return function(_0x2529e6){if(_0x2529e6){var _0x237133=_0x2529e6[_0x80bf('0x1b')],_0x328922=_0x2cb48b[_0x80bf('0x1c')],_0x9a718d=_0x2cb48b[_0x80bf('0x1c')]+_0x2cb48b['limit'],_0x5b2ba0;if(_0x9a718d>=_0x237133){_0x9a718d=_0x237133;_0x5b2ba0=0xc8;}else{_0x5b2ba0=0xce;}_0x45f86f['status'](_0x5b2ba0);return _0x45f86f[_0x80bf('0x1d')](_0x80bf('0x1e'),_0x328922+'-'+_0x9a718d+'/'+_0x237133)[_0x80bf('0x1a')](_0x2529e6);}return null;};}function patchUpdates(_0x513b05){return function(_0x37ea09){try{jsonpatch[_0x80bf('0x1f')](_0x37ea09,_0x513b05,!![]);}catch(_0x5ac124){return BPromise[_0x80bf('0x20')](_0x5ac124);}return _0x37ea09[_0x80bf('0x21')]();};}function saveUpdates(_0x258bf1,_0x278496){return function(_0x252cd1){if(_0x252cd1){return _0x252cd1[_0x80bf('0x22')](_0x258bf1)[_0x80bf('0x23')](function(_0x3d8e57){return _0x3d8e57;});}return null;};}function removeEntity(_0x36bc0f,_0x3f12dc){return function(_0x46e30c){if(_0x46e30c){return _0x46e30c['destroy']()[_0x80bf('0x23')](function(){_0x36bc0f[_0x80bf('0x19')](0xcc)[_0x80bf('0x24')]();});}};}function handleEntityNotFound(_0x36e8af,_0x65a042){return function(_0xbac87d){if(!_0xbac87d){_0x36e8af[_0x80bf('0x18')](0x194);}return _0xbac87d;};}function handleError(_0x163aae,_0x214470){_0x214470=_0x214470||0x1f4;return function(_0x40bda6){logger[_0x80bf('0x25')](_0x40bda6['stack']);if(_0x40bda6[_0x80bf('0x26')]){delete _0x40bda6[_0x80bf('0x26')];}_0x163aae['status'](_0x214470)[_0x80bf('0x27')](_0x40bda6);};}exports[_0x80bf('0x28')]=function(_0x1c9894,_0x4bca72){var _0x22fd7e={},_0x1a240d={},_0x4b6391={'count':0x0,'rows':[]};var _0x44f8a8=_['map'](db['SugarcrmField'][_0x80bf('0x29')],function(_0x48d1f8){return{'name':_0x48d1f8[_0x80bf('0x2a')],'type':_0x48d1f8['type'][_0x80bf('0x2b')]};});_0x1a240d['model']=_['map'](_0x44f8a8,_0x80bf('0x26'));_0x1a240d[_0x80bf('0x2c')]=_[_0x80bf('0x2d')](_0x1c9894[_0x80bf('0x2c')]);_0x1a240d[_0x80bf('0x2e')]=_[_0x80bf('0x2f')](_0x1a240d[_0x80bf('0x30')],_0x1a240d[_0x80bf('0x2c')]);_0x22fd7e[_0x80bf('0x31')]=_[_0x80bf('0x2f')](_0x1a240d[_0x80bf('0x30')],qs[_0x80bf('0x32')](_0x1c9894['query'][_0x80bf('0x32')]));_0x22fd7e[_0x80bf('0x31')]=_0x22fd7e[_0x80bf('0x31')][_0x80bf('0x33')]?_0x22fd7e[_0x80bf('0x31')]:_0x1a240d[_0x80bf('0x30')];if(!_0x1c9894[_0x80bf('0x2c')]['hasOwnProperty'](_0x80bf('0x34'))){_0x22fd7e[_0x80bf('0x35')]=qs[_0x80bf('0x35')](_0x1c9894[_0x80bf('0x2c')]['limit']);_0x22fd7e[_0x80bf('0x1c')]=qs[_0x80bf('0x1c')](_0x1c9894[_0x80bf('0x2c')][_0x80bf('0x1c')]);}_0x22fd7e[_0x80bf('0x36')]=qs[_0x80bf('0x37')](_0x1c9894[_0x80bf('0x2c')][_0x80bf('0x37')]);_0x22fd7e[_0x80bf('0x38')]=qs[_0x80bf('0x2e')](_[_0x80bf('0x39')](_0x1c9894[_0x80bf('0x2c')],_0x1a240d[_0x80bf('0x2e')]),_0x44f8a8);if(_0x1c9894['query'][_0x80bf('0x3a')]){_0x22fd7e['where']=_[_0x80bf('0x3b')](_0x22fd7e[_0x80bf('0x38')],{'$or':_[_0x80bf('0x3c')](_0x44f8a8,function(_0x83b3ab){if(_0x83b3ab[_0x80bf('0x3d')]!=='VIRTUAL'){var _0x5e59ce={};_0x5e59ce[_0x83b3ab[_0x80bf('0x26')]]={'$like':'%'+_0x1c9894['query'][_0x80bf('0x3a')]+'%'};return _0x5e59ce;}})});}_0x22fd7e=_[_0x80bf('0x3b')]({},_0x22fd7e,_0x1c9894['options']);var _0x1c96c8={'where':_0x22fd7e[_0x80bf('0x38')]};return db[_0x80bf('0x3e')][_0x80bf('0x1b')](_0x1c96c8)[_0x80bf('0x23')](function(_0x3509b5){_0x4b6391[_0x80bf('0x1b')]=_0x3509b5;if(_0x1c9894[_0x80bf('0x2c')][_0x80bf('0x3f')]){_0x22fd7e['include']=[{'all':!![]}];}return db[_0x80bf('0x3e')][_0x80bf('0x40')](_0x22fd7e);})['then'](function(_0x1fa035){_0x4b6391[_0x80bf('0x41')]=_0x1fa035;return _0x4b6391;})[_0x80bf('0x23')](respondWithFilteredResult(_0x4bca72,_0x22fd7e))[_0x80bf('0x42')](handleError(_0x4bca72,null));};exports['show']=function(_0x37d587,_0x16813b){var _0x497d31={'raw':!![],'where':{'id':_0x37d587[_0x80bf('0x43')]['id']}},_0x49e8d1={};_0x49e8d1['model']=_[_0x80bf('0x2d')](db['SugarcrmField']['rawAttributes']);_0x49e8d1[_0x80bf('0x2c')]=_[_0x80bf('0x2d')](_0x37d587[_0x80bf('0x2c')]);_0x49e8d1[_0x80bf('0x2e')]=_[_0x80bf('0x2f')](_0x49e8d1[_0x80bf('0x30')],_0x49e8d1[_0x80bf('0x2c')]);_0x497d31['attributes']=_['intersection'](_0x49e8d1['model'],qs[_0x80bf('0x32')](_0x37d587[_0x80bf('0x2c')][_0x80bf('0x32')]));_0x497d31[_0x80bf('0x31')]=_0x497d31[_0x80bf('0x31')][_0x80bf('0x33')]?_0x497d31[_0x80bf('0x31')]:_0x49e8d1[_0x80bf('0x30')];if(_0x37d587[_0x80bf('0x2c')]['includeAll']){_0x497d31['include']=[{'all':!![]}];}_0x497d31=_[_0x80bf('0x3b')]({},_0x497d31,_0x37d587['options']);return db['SugarcrmField'][_0x80bf('0x44')](_0x497d31)[_0x80bf('0x23')](handleEntityNotFound(_0x16813b,null))[_0x80bf('0x23')](respondWithResult(_0x16813b,null))[_0x80bf('0x42')](handleError(_0x16813b,null));};exports[_0x80bf('0x45')]=function(_0x57f2f1,_0x2a0ab0){return db[_0x80bf('0x3e')]['create'](_0x57f2f1[_0x80bf('0x46')],{})[_0x80bf('0x23')](respondWithResult(_0x2a0ab0,0xc9))[_0x80bf('0x42')](handleError(_0x2a0ab0,null));};exports['update']=function(_0x5356fc,_0x198604){if(_0x5356fc[_0x80bf('0x46')]['id']){delete _0x5356fc['body']['id'];}return db[_0x80bf('0x3e')][_0x80bf('0x44')]({'where':{'id':_0x5356fc[_0x80bf('0x43')]['id']}})[_0x80bf('0x23')](handleEntityNotFound(_0x198604,null))[_0x80bf('0x23')](saveUpdates(_0x5356fc[_0x80bf('0x46')],null))[_0x80bf('0x23')](respondWithResult(_0x198604,null))[_0x80bf('0x42')](handleError(_0x198604,null));};exports['destroy']=function(_0x42099e,_0x29985a){return db[_0x80bf('0x3e')][_0x80bf('0x44')]({'where':{'id':_0x42099e['params']['id']}})['then'](handleEntityNotFound(_0x29985a,null))[_0x80bf('0x23')](removeEntity(_0x29985a,null))[_0x80bf('0x42')](handleError(_0x29985a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6509121..fad7bb4 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 _0xfda4=['request-promise','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2fb6ed,_0x4c15ae){var _0x33d70c=function(_0x84d461){while(--_0x84d461){_0x2fb6ed['push'](_0x2fb6ed['shift']());}};_0x33d70c(++_0x4c15ae);}(_0xfda4,0x1ba));var _0x4fda=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xfda4[_0x261522];return _0x98a25a;};'use strict';var _=require(_0x4fda('0x0'));var util=require(_0x4fda('0x1'));var logger=require(_0x4fda('0x2'))(_0x4fda('0x3'));var moment=require(_0x4fda('0x4'));var BPromise=require(_0x4fda('0x5'));var rp=require(_0x4fda('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4fda('0x7'));var config=require(_0x4fda('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x4fda('0x9')]=function(_0x24c08b,_0x541b96){return _0x24c08b[_0x4fda('0xa')](_0x4fda('0xb'),attributes,{'tableName':_0x4fda('0xc'),'paranoid':![],'indexes':[{'name':_0x4fda('0xd'),'fields':[_0x4fda('0xe'),_0x4fda('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7253=['int_sugarcrm_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSugarcrmField.attributes','exports','SugarcrmField'];(function(_0x3bf7a0,_0x384e24){var _0x1b5fec=function(_0x3004ed){while(--_0x3004ed){_0x3bf7a0['push'](_0x3bf7a0['shift']());}};_0x1b5fec(++_0x384e24);}(_0x7253,0x117));var _0x3725=function(_0x428598,_0xb4dba7){_0x428598=_0x428598-0x0;var _0x2aec7a=_0x7253[_0x428598];return _0x2aec7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3725('0x0'))(_0x3725('0x1'));var moment=require(_0x3725('0x2'));var BPromise=require(_0x3725('0x3'));var rp=require(_0x3725('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3725('0x5'));var config=require('../../config/environment');var attributes=require(_0x3725('0x6'));module[_0x3725('0x7')]=function(_0x1995ae,_0x1e34cb){return _0x1995ae['define'](_0x3725('0x8'),attributes,{'tableName':_0x3725('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x3725('0xa'),_0x3725('0xb')],'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 b9b066e..856030f 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x5e88a1,_0x11abbf){var _0x48eb01=function(_0xb966fc){while(--_0xb966fc){_0x5e88a1['push'](_0x5e88a1['shift']());}};_0x48eb01(++_0x11abbf);}(_0x2032,0xd9));var _0x2203=function(_0xaf6ba6,_0x378d86){_0xaf6ba6=_0xaf6ba6-0x0;var _0x11cb37=_0x2032[_0xaf6ba6];return _0x11cb37;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file +var _0x757a=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x339a10,_0x5e18e4){var _0xd4db83=function(_0x5cd56a){while(--_0x5cd56a){_0x339a10['push'](_0x339a10['shift']());}};_0xd4db83(++_0x5e18e4);}(_0x757a,0xde));var _0xa757=function(_0x5fe2ae,_0x4bf466){_0x5fe2ae=_0x5fe2ae-0x0;var _0x2776e5=_0x757a[_0x5fe2ae];return _0x2776e5;};'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']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('SugarcrmField,\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);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 535b1aa..916a3e8 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 _0x2d34=['./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f0d5e,_0xf52c0c){var _0x25c0a3=function(_0x124cf4){while(--_0x124cf4){_0x2f0d5e['push'](_0x2f0d5e['shift']());}};_0x25c0a3(++_0xf52c0c);}(_0x2d34,0x1ec));var _0x42d3=function(_0x2b33ef,_0x4e64c6){_0x2b33ef=_0x2b33ef-0x0;var _0x4d4f2d=_0x2d34[_0x2b33ef];return _0x4d4f2d;};'use strict';var multer=require(_0x42d3('0x0'));var util=require(_0x42d3('0x1'));var path=require(_0x42d3('0x2'));var timeout=require(_0x42d3('0x3'));var express=require(_0x42d3('0x4'));var router=express['Router']();var auth=require(_0x42d3('0x5'));var interaction=require(_0x42d3('0x6'));var config=require(_0x42d3('0x7'));var controller=require(_0x42d3('0x8'));router[_0x42d3('0x9')]('/',auth[_0x42d3('0xa')](),controller[_0x42d3('0xb')]);router[_0x42d3('0x9')](_0x42d3('0xc'),auth[_0x42d3('0xa')](),controller[_0x42d3('0xd')]);router[_0x42d3('0x9')]('/:id/configurations',auth[_0x42d3('0xa')](),controller[_0x42d3('0xe')]);router[_0x42d3('0x9')](_0x42d3('0xf'),auth[_0x42d3('0xa')](),controller[_0x42d3('0x10')]);router[_0x42d3('0x11')]('/',auth[_0x42d3('0xa')](),controller[_0x42d3('0x12')]);router[_0x42d3('0x11')](_0x42d3('0x13'),auth[_0x42d3('0xa')](),controller[_0x42d3('0x14')]);router['put'](_0x42d3('0xc'),auth[_0x42d3('0xa')](),controller[_0x42d3('0x15')]);router[_0x42d3('0x16')](_0x42d3('0xc'),auth['isAuthenticated'](),controller[_0x42d3('0x17')]);module[_0x42d3('0x18')]=router; \ No newline at end of file +var _0x63ec=['isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x63ec,0x1ef));var _0xc63e=function(_0x32a933,_0x42db57){_0x32a933=_0x32a933-0x0;var _0x174076=_0x63ec[_0x32a933];return _0x174076;};'use strict';var multer=require('multer');var util=require(_0xc63e('0x0'));var path=require(_0xc63e('0x1'));var timeout=require(_0xc63e('0x2'));var express=require(_0xc63e('0x3'));var router=express[_0xc63e('0x4')]();var auth=require(_0xc63e('0x5'));var interaction=require(_0xc63e('0x6'));var config=require(_0xc63e('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xc63e('0x8')]('/',auth[_0xc63e('0x9')](),controller['index']);router['get']('/:id',auth[_0xc63e('0x9')](),controller[_0xc63e('0xa')]);router[_0xc63e('0x8')]('/:id/configurations',auth[_0xc63e('0x9')](),controller[_0xc63e('0xb')]);router['get'](_0xc63e('0xc'),auth[_0xc63e('0x9')](),controller[_0xc63e('0xd')]);router[_0xc63e('0xe')]('/',auth['isAuthenticated'](),controller[_0xc63e('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc63e('0x10')](_0xc63e('0x11'),auth[_0xc63e('0x9')](),controller[_0xc63e('0x12')]);router[_0xc63e('0x13')](_0xc63e('0x11'),auth['isAuthenticated'](),controller[_0xc63e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a5b621a..87ff630 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 _0xe546=['exports','STRING','HelpDesk','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe546,0x1df));var _0x6e54=function(_0x4d3691,_0x4b13d1){_0x4d3691=_0x4d3691-0x0;var _0x576257=_0xe546[_0x4d3691];return _0x576257;};'use strict';var Sequelize=require(_0x6e54('0x0'));module[_0x6e54('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6e54('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6e54('0x2')],'allowNull':![],'defaultValue':_0x6e54('0x3')},'remoteUri':{'type':Sequelize[_0x6e54('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6e54('0x2')]},'accessKey':{'type':Sequelize[_0x6e54('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2383=['STRING','HelpDesk','exports'];(function(_0xc14a52,_0x5b84b9){var _0x2e5227=function(_0x580348){while(--_0x580348){_0xc14a52['push'](_0xc14a52['shift']());}};_0x2e5227(++_0x5b84b9);}(_0x2383,0xf5));var _0x3238=function(_0x5d4e67,_0x1da63e){_0x5d4e67=_0x5d4e67-0x0;var _0x49cf92=_0x2383[_0x5d4e67];return _0x49cf92;};'use strict';var Sequelize=require('sequelize');module[_0x3238('0x0')]={'name':{'type':Sequelize[_0x3238('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3238('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3238('0x1')],'allowNull':![],'defaultValue':_0x3238('0x2')},'remoteUri':{'type':Sequelize[_0x3238('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3238('0x1')]},'accessKey':{'type':Sequelize[_0x3238('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index ee4d980..0cf4bb9 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 _0x5007=['sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','VtigerAccount','include','rows','show','keys','includeAll','options','create','body','find','params','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','login','token','success','sessionName','autogenerated','owner','remove','editable','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x11df47,_0x18bd89){var _0x52ab06=function(_0x294e9d){while(--_0x294e9d){_0x11df47['push'](_0x11df47['shift']());}};_0x52ab06(++_0x18bd89);}(_0x5007,0xfe));var _0x7500=function(_0x54c87a,_0x12d8e8){_0x54c87a=_0x54c87a-0x0;var _0x5ad548=_0x5007[_0x54c87a];return _0x5ad548;};'use strict';var pdf=require(_0x7500('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7500('0x1'));var zipdir=require(_0x7500('0x2'));var jsonpatch=require(_0x7500('0x3'));var rp=require(_0x7500('0x4'));var moment=require(_0x7500('0x5'));var BPromise=require(_0x7500('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7500('0x7'));var sox=require(_0x7500('0x8'));var csv=require(_0x7500('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7500('0xa'));var crypto=require(_0x7500('0xb'));var jsforce=require(_0x7500('0xc'));var deskjs=require(_0x7500('0xd'));var toCsv=require(_0x7500('0x9'));var querystring=require('querystring');var Papa=require(_0x7500('0xe'));var Redis=require(_0x7500('0xf'));var authService=require(_0x7500('0x10'));var qs=require(_0x7500('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7500('0x12'));var logger=require('../../config/logger')(_0x7500('0x13'));var utils=require(_0x7500('0x14'));var config=require(_0x7500('0x15'));var db=require(_0x7500('0x16'))['db'];var integrations=require(_0x7500('0x17'));var jayson=require(_0x7500('0x18'));var client=jayson[_0x7500('0x19')][_0x7500('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ba245,_0x2ff1b8,_0x462c7f){if(_0x462c7f){var _0x59d996=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59d996[_0x7500('0x1b')](_0x2ff1b8)){return _0x3ba245;}else{throw new db[(_0x7500('0x1c'))][(_0x7500('0x1d'))](_0x7500('0x1e'));}}else{return _0x3ba245;}}function respondWithRpcPromise(_0x16b3c3,_0x44d605,_0x4c31b7,_0x38315e){return new BPromise(function(_0x5cecd2,_0x4e353a){var _0x46e6c8=_0x38315e||client;return _0x46e6c8[_0x7500('0x1f')](_0x16b3c3,_0x4c31b7)[_0x7500('0x20')](function(_0x1c825d){logger[_0x7500('0x21')](_0x7500('0x22'),_0x44d605,'request\x20sent');logger['debug'](_0x7500('0x23'),_0x44d605,_0x7500('0x24'),JSON[_0x7500('0x25')](_0x1c825d));if(_0x1c825d[_0x7500('0x26')]){if(_0x1c825d[_0x7500('0x26')][_0x7500('0x27')]===0x1f4){logger[_0x7500('0x26')](_0x7500('0x22'),_0x44d605,_0x1c825d[_0x7500('0x26')][_0x7500('0x28')]);return _0x4e353a(_0x1c825d['error']['message']);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x44d605,_0x1c825d['error'][_0x7500('0x28')]);return _0x5cecd2(_0x1c825d[_0x7500('0x26')][_0x7500('0x28')]);}else{logger[_0x7500('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x44d605,_0x7500('0x24'));_0x5cecd2(_0x1c825d[_0x7500('0x29')][_0x7500('0x28')]);}})[_0x7500('0x2a')](function(_0x3d960d){logger[_0x7500('0x26')](_0x7500('0x22'),_0x44d605,_0x3d960d);_0x4e353a(_0x3d960d);});});}function respondWithStatusCode(_0x50a8ee,_0x3976c7){_0x3976c7=_0x3976c7||0xcc;return function(_0x281ab5){if(_0x281ab5){return _0x50a8ee[_0x7500('0x2b')](_0x3976c7);}return _0x50a8ee[_0x7500('0x2c')](_0x3976c7)[_0x7500('0x2d')]();};}function respondWithResult(_0x467a1d,_0x249e0c){_0x249e0c=_0x249e0c||0xc8;return function(_0x5b1bb2){if(_0x5b1bb2){return _0x467a1d[_0x7500('0x2c')](_0x249e0c)[_0x7500('0x2e')](_0x5b1bb2);}};}function respondWithFilteredResult(_0x2cc524,_0x5edc24){return function(_0xabdce8){if(_0xabdce8){var _0x51036a=_0xabdce8[_0x7500('0x2f')],_0x28bd35=_0x5edc24[_0x7500('0x30')],_0x4debb9=_0x5edc24[_0x7500('0x30')]+_0x5edc24[_0x7500('0x31')],_0x45b719;if(_0x4debb9>=_0x51036a){_0x4debb9=_0x51036a;_0x45b719=0xc8;}else{_0x45b719=0xce;}_0x2cc524[_0x7500('0x2c')](_0x45b719);return _0x2cc524['set'](_0x7500('0x32'),_0x28bd35+'-'+_0x4debb9+'/'+_0x51036a)[_0x7500('0x2e')](_0xabdce8);}return null;};}function patchUpdates(_0x369466){return function(_0x156e46){try{jsonpatch['apply'](_0x156e46,_0x369466,!![]);}catch(_0x2b3ed8){return BPromise['reject'](_0x2b3ed8);}return _0x156e46[_0x7500('0x33')]();};}function saveUpdates(_0x4b45a2,_0x44127b){return function(_0x4e903d){if(_0x4e903d){return _0x4e903d[_0x7500('0x34')](_0x4b45a2)[_0x7500('0x20')](function(_0x4a5d88){return _0x4a5d88;});}return null;};}function removeEntity(_0x8d5d10,_0x4a93b7){return function(_0x19ebc5){if(_0x19ebc5){return _0x19ebc5[_0x7500('0x35')]()[_0x7500('0x20')](function(){_0x8d5d10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd31ef8,_0x45fab4){return function(_0x398723){if(!_0x398723){_0xd31ef8[_0x7500('0x2b')](0x194);}return _0x398723;};}function handleError(_0x2d7133,_0x99b3ac){_0x99b3ac=_0x99b3ac||0x1f4;return function(_0x46c9f2){logger[_0x7500('0x26')](_0x46c9f2[_0x7500('0x36')]);if(_0x46c9f2[_0x7500('0x37')]){delete _0x46c9f2['name'];}_0x2d7133['status'](_0x99b3ac)[_0x7500('0x38')](_0x46c9f2);};}exports[_0x7500('0x39')]=function(_0x52a81f,_0x18686b){var _0x1a35ec={},_0x57f579={},_0x2c4780={'count':0x0,'rows':[]};var _0x437dfa=_[_0x7500('0x3a')](db['VtigerAccount'][_0x7500('0x3b')],function(_0x1c6199){return{'name':_0x1c6199[_0x7500('0x3c')],'type':_0x1c6199[_0x7500('0x3d')][_0x7500('0x3e')]};});_0x57f579[_0x7500('0x3f')]=_[_0x7500('0x3a')](_0x437dfa,_0x7500('0x37'));_0x57f579[_0x7500('0x40')]=_['keys'](_0x52a81f[_0x7500('0x40')]);_0x57f579[_0x7500('0x41')]=_[_0x7500('0x42')](_0x57f579[_0x7500('0x3f')],_0x57f579[_0x7500('0x40')]);_0x1a35ec[_0x7500('0x43')]=_[_0x7500('0x42')](_0x57f579[_0x7500('0x3f')],qs['fields'](_0x52a81f[_0x7500('0x40')][_0x7500('0x44')]));_0x1a35ec['attributes']=_0x1a35ec[_0x7500('0x43')][_0x7500('0x45')]?_0x1a35ec[_0x7500('0x43')]:_0x57f579[_0x7500('0x3f')];if(!_0x52a81f[_0x7500('0x40')]['hasOwnProperty'](_0x7500('0x46'))){_0x1a35ec['limit']=qs['limit'](_0x52a81f[_0x7500('0x40')]['limit']);_0x1a35ec[_0x7500('0x30')]=qs[_0x7500('0x30')](_0x52a81f[_0x7500('0x40')][_0x7500('0x30')]);}_0x1a35ec['order']=qs['sort'](_0x52a81f[_0x7500('0x40')][_0x7500('0x47')]);_0x1a35ec['where']=qs[_0x7500('0x41')](_[_0x7500('0x48')](_0x52a81f['query'],_0x57f579[_0x7500('0x41')]),_0x437dfa);if(_0x52a81f['query'][_0x7500('0x49')]){_0x1a35ec[_0x7500('0x4a')]=_['merge'](_0x1a35ec[_0x7500('0x4a')],{'$or':_[_0x7500('0x3a')](_0x437dfa,function(_0x242f19){if(_0x242f19[_0x7500('0x3d')]!==_0x7500('0x4b')){var _0x50e9bc={};_0x50e9bc[_0x242f19['name']]={'$like':'%'+_0x52a81f[_0x7500('0x40')][_0x7500('0x49')]+'%'};return _0x50e9bc;}})});}_0x1a35ec=_[_0x7500('0x4c')]({},_0x1a35ec,_0x52a81f['options']);var _0x35c170={'where':_0x1a35ec[_0x7500('0x4a')]};return db[_0x7500('0x4d')][_0x7500('0x2f')](_0x35c170)[_0x7500('0x20')](function(_0x467f23){_0x2c4780[_0x7500('0x2f')]=_0x467f23;if(_0x52a81f[_0x7500('0x40')]['includeAll']){_0x1a35ec[_0x7500('0x4e')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x1a35ec);})['then'](function(_0x330272){_0x2c4780[_0x7500('0x4f')]=_0x330272;return _0x2c4780;})[_0x7500('0x20')](respondWithFilteredResult(_0x18686b,_0x1a35ec))[_0x7500('0x2a')](handleError(_0x18686b,null));};exports[_0x7500('0x50')]=function(_0x46fe2d,_0x31d118){var _0x4a1ef1={'raw':![],'where':{'id':_0x46fe2d['params']['id']}},_0x396c7c={};_0x396c7c['model']=_[_0x7500('0x51')](db[_0x7500('0x4d')][_0x7500('0x3b')]);_0x396c7c[_0x7500('0x40')]=_[_0x7500('0x51')](_0x46fe2d[_0x7500('0x40')]);_0x396c7c[_0x7500('0x41')]=_[_0x7500('0x42')](_0x396c7c['model'],_0x396c7c['query']);_0x4a1ef1['attributes']=_['intersection'](_0x396c7c[_0x7500('0x3f')],qs[_0x7500('0x44')](_0x46fe2d[_0x7500('0x40')][_0x7500('0x44')]));_0x4a1ef1[_0x7500('0x43')]=_0x4a1ef1['attributes'][_0x7500('0x45')]?_0x4a1ef1[_0x7500('0x43')]:_0x396c7c[_0x7500('0x3f')];if(_0x46fe2d['query'][_0x7500('0x52')]){_0x4a1ef1[_0x7500('0x4e')]=[{'all':!![]}];}_0x4a1ef1=_['merge']({},_0x4a1ef1,_0x46fe2d[_0x7500('0x53')]);return db[_0x7500('0x4d')]['find'](_0x4a1ef1)[_0x7500('0x20')](handleEntityNotFound(_0x31d118,null))[_0x7500('0x20')](respondWithResult(_0x31d118,null))['catch'](handleError(_0x31d118,null));};exports[_0x7500('0x54')]=function(_0x50f206,_0x4a9808){return db[_0x7500('0x4d')][_0x7500('0x54')](_0x50f206[_0x7500('0x55')],{})[_0x7500('0x20')](respondWithResult(_0x4a9808,0xc9))[_0x7500('0x2a')](handleError(_0x4a9808,null));};exports[_0x7500('0x34')]=function(_0x3302e3,_0x339c4a){if(_0x3302e3[_0x7500('0x55')]['id']){delete _0x3302e3['body']['id'];}return db[_0x7500('0x4d')]['find']({'where':{'id':_0x3302e3['params']['id']}})[_0x7500('0x20')](handleEntityNotFound(_0x339c4a,null))['then'](saveUpdates(_0x3302e3[_0x7500('0x55')],null))[_0x7500('0x20')](respondWithResult(_0x339c4a,null))[_0x7500('0x2a')](handleError(_0x339c4a,null));};exports[_0x7500('0x35')]=function(_0x3080d4,_0x586ab8){return db['VtigerAccount'][_0x7500('0x56')]({'where':{'id':_0x3080d4[_0x7500('0x57')]['id']}})[_0x7500('0x20')](handleEntityNotFound(_0x586ab8,null))['then'](removeEntity(_0x586ab8,null))[_0x7500('0x2a')](handleError(_0x586ab8,null));};exports[_0x7500('0x58')]=function(_0x53a46c,_0x57fdcc,_0x511c17){var _0x588720={};var _0x2a8897={};var _0x2a3ef6;var _0x2eba01;return db['VtigerAccount'][_0x7500('0x59')]({'where':{'id':_0x53a46c[_0x7500('0x57')]['id']}})[_0x7500('0x20')](handleEntityNotFound(_0x57fdcc,null))[_0x7500('0x20')](function(_0x5c6f65){if(_0x5c6f65){_0x2a3ef6=_0x5c6f65;_0x2a8897[_0x7500('0x3f')]=_[_0x7500('0x51')](db[_0x7500('0x5a')][_0x7500('0x3b')]);_0x2a8897[_0x7500('0x40')]=_[_0x7500('0x51')](_0x53a46c[_0x7500('0x40')]);_0x2a8897[_0x7500('0x41')]=_['intersection'](_0x2a8897[_0x7500('0x3f')],_0x2a8897[_0x7500('0x40')]);_0x588720[_0x7500('0x43')]=_[_0x7500('0x42')](_0x2a8897[_0x7500('0x3f')],qs['fields'](_0x53a46c[_0x7500('0x40')][_0x7500('0x44')]));_0x588720['attributes']=_0x588720[_0x7500('0x43')][_0x7500('0x45')]?_0x588720['attributes']:_0x2a8897['model'];_0x588720[_0x7500('0x5b')]=qs[_0x7500('0x47')](_0x53a46c[_0x7500('0x40')][_0x7500('0x47')]);_0x588720[_0x7500('0x4a')]=qs[_0x7500('0x41')](_[_0x7500('0x48')](_0x53a46c[_0x7500('0x40')],_0x2a8897[_0x7500('0x41')]));if(_0x53a46c['query'][_0x7500('0x49')]){_0x588720['where']=_[_0x7500('0x4c')](_0x588720[_0x7500('0x4a')],{'$or':_['map'](_0x588720[_0x7500('0x43')],function(_0x5f1d19){var _0x3d4d47={};_0x3d4d47[_0x5f1d19]={'$like':'%'+_0x53a46c[_0x7500('0x40')]['filter']+'%'};return _0x3d4d47;})});}_0x588720=_[_0x7500('0x4c')]({},_0x588720,_0x53a46c[_0x7500('0x53')]);return _0x2a3ef6[_0x7500('0x58')](_0x588720);}})['then'](function(_0x3f06e2){if(_0x3f06e2){_0x2eba01=_0x3f06e2[_0x7500('0x45')];if(!_0x53a46c[_0x7500('0x40')]['hasOwnProperty'](_0x7500('0x46'))){_0x588720[_0x7500('0x31')]=qs[_0x7500('0x31')](_0x53a46c[_0x7500('0x40')][_0x7500('0x31')]);_0x588720[_0x7500('0x30')]=qs[_0x7500('0x30')](_0x53a46c[_0x7500('0x40')][_0x7500('0x30')]);}return _0x2a3ef6['getConfigurations'](_0x588720);}})[_0x7500('0x20')](function(_0x481f4a){if(_0x481f4a){return _0x481f4a?{'count':_0x2eba01,'rows':_0x481f4a}:null;}})[_0x7500('0x20')](respondWithResult(_0x57fdcc,null))[_0x7500('0x2a')](handleError(_0x57fdcc,null));};exports[_0x7500('0x5c')]=function(_0x13bd77,_0xb7d6fc,_0x38c8c4){if(_0x13bd77['body']['id']){delete _0x13bd77[_0x7500('0x55')]['id'];}return db[_0x7500('0x4d')][_0x7500('0x59')]({'where':{'id':_0x13bd77['params']['id']}})['then'](handleEntityNotFound(_0xb7d6fc,null))[_0x7500('0x20')](function(_0x13be76){if(_0x13be76){_0x13bd77[_0x7500('0x55')][_0x7500('0x5d')]=_0x13be76['id'];_0x13bd77[_0x7500('0x55')][_0x7500('0x5e')]=integrations[_0x7500('0x5f')](_0x13bd77[_0x7500('0x55')][_0x7500('0x60')],_0x13bd77[_0x7500('0x55')]['type']);_0x13bd77[_0x7500('0x55')][_0x7500('0x61')]=integrations['getDescriptions'](_0x13bd77['body']['channel'],_0x13bd77[_0x7500('0x55')][_0x7500('0x3d')]);return db[_0x7500('0x5a')][_0x7500('0x54')](_0x13bd77[_0x7500('0x55')],{'include':[{'model':db[_0x7500('0x62')],'as':_0x7500('0x5e')},{'model':db[_0x7500('0x62')],'as':_0x7500('0x61')}]});}return null;})[_0x7500('0x20')](respondWithResult(_0xb7d6fc,null))['catch'](handleError(_0xb7d6fc,null));};var md5=require(_0x7500('0x63'));exports['getFields']=function(_0x4334e7,_0x234fb7,_0x4103e8){var _0x49da28=null;var _0x367621=null;var _0x26fd3f=null;var _0x1eb57b=null;var _0x5e39c7='';return db[_0x7500('0x4d')][_0x7500('0x59')]({'where':{'id':_0x4334e7[_0x7500('0x57')]['id']},'attributes':['id',_0x7500('0x37'),_0x7500('0x64'),_0x7500('0x65'),'moduleName',_0x7500('0x66'),_0x7500('0x67'),_0x7500('0x68')]})[_0x7500('0x20')](handleEntityNotFound(_0x234fb7,null))[_0x7500('0x20')](function(_0x37f820){if(_0x37f820){_0x49da28=_0x37f820['username'];_0x367621=_0x37f820[_0x7500('0x68')];_0x26fd3f=_0x37f820[_0x7500('0x69')];_0x5e39c7=_0x37f820['remoteUri'];var _0x32e42e=_0x5e39c7[_0x7500('0x6a')](-0x1);if(_0x32e42e==='/'){_0x5e39c7=_0x5e39c7['substring'](0x0,_0x5e39c7[_0x7500('0x6b')](_0x32e42e));}_0x1eb57b=util[_0x7500('0x6c')](_0x7500('0x6d'),_0x5e39c7);var _0x42f68d={'method':_0x7500('0x6e'),'uri':_0x1eb57b,'qs':{'operation':_0x7500('0x6f'),'username':_0x37f820[_0x7500('0x64')]},'json':!![]};return rp(_0x42f68d);}})[_0x7500('0x20')](function(_0x3b44d9){if(_0x3b44d9['success']){var _0x1cc8f0={'method':'POST','uri':_0x1eb57b,'form':{'operation':_0x7500('0x70'),'username':_0x49da28,'accessKey':md5(_0x3b44d9[_0x7500('0x29')][_0x7500('0x71')]+_0x367621)},'json':!![]};return rp(_0x1cc8f0);}})[_0x7500('0x20')](function(_0x392a6c){if(_0x392a6c[_0x7500('0x72')]){var _0xd518f8={'method':_0x7500('0x6e'),'uri':_0x1eb57b,'qs':{'operation':'describe','username':_0x49da28,'sessionName':_0x392a6c[_0x7500('0x29')][_0x7500('0x73')],'elementType':_0x26fd3f},'json':!![]};return rp(_0xd518f8);}})[_0x7500('0x20')](function(_0x124d08){if(_0x124d08['success']){var _0x1f342c=[_0x7500('0x74'),'reference',_0x7500('0x75')];_[_0x7500('0x76')](_0x124d08[_0x7500('0x29')][_0x7500('0x44')],function(_0x492ab3){return _0x1f342c['includes'](_0x492ab3[_0x7500('0x3d')][_0x7500('0x37')]);});_[_0x7500('0x76')](_0x124d08[_0x7500('0x29')][_0x7500('0x44')],function(_0x44cc63){return _0x44cc63[_0x7500('0x77')]==='false';});return{'count':_0x124d08['result'][_0x7500('0x44')][_0x7500('0x45')],'rows':_[_0x7500('0x3a')](_0x124d08[_0x7500('0x29')][_0x7500('0x44')],function(_0x3b086b){return{'id':_0x3b086b[_0x7500('0x37')],'name':_0x3b086b['label'],'custom':_[_0x7500('0x78')](_0x3b086b[_0x7500('0x37')],_0x7500('0x79'))?!![]:![],'options':_0x3b086b[_0x7500('0x3d')][_0x7500('0x37')]===_0x7500('0x7a')&&_0x3b086b['type'][_0x7500('0x7b')][_0x7500('0x45')]>0x0?_[_0x7500('0x3a')](_0x3b086b[_0x7500('0x3d')][_0x7500('0x7b')],function(_0x7cd8fe){return{'name':_0x7cd8fe[_0x7500('0x7c')],'value':_0x7cd8fe[_0x7500('0x7d')]};}):[]};})};}})[_0x7500('0x20')](respondWithResult(_0x234fb7,null))[_0x7500('0x2a')](function(_0x25abd0){console[_0x7500('0x7e')](_0x7500('0x7f')+_0x25abd0);var _0x42d03c=_0x4334e7[_0x7500('0x40')][_0x7500('0x1b')]?0x1f4:_0x25abd0['statusCode']||0x1f4;logger[_0x7500('0x26')](_0x7500('0x80'),_0x7500('0x81'),_0x42d03c,JSON[_0x7500('0x25')](_0x25abd0));delete _0x25abd0[_0x7500('0x37')];if(_0x42d03c===0x191){_0x42d03c=0x190;}_0x234fb7[_0x7500('0x2c')](_0x42d03c)[_0x7500('0x38')](_0x4334e7[_0x7500('0x40')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x25abd0[_0x7500('0x82')]}:_0x25abd0);});}; \ No newline at end of file +var _0xfddf=['../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','count','offset','set','Content-Range','apply','reject','destroy','end','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','options','addConfiguration','AccountId','Subjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','slice','substring','format','%s/webservice.php','GET','success','POST','login','token','sessionName','autogenerated','remove','includes','editable','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3876ed,_0x52cbf6){var _0x18f6ca=function(_0x4d3671){while(--_0x4d3671){_0x3876ed['push'](_0x3876ed['shift']());}};_0x18f6ca(++_0x52cbf6);}(_0xfddf,0x1e7));var _0xffdd=function(_0x3f5f37,_0x5d31f7){_0x3f5f37=_0x3f5f37-0x0;var _0x36b98d=_0xfddf[_0x3f5f37];return _0x36b98d;};'use strict';var pdf=require(_0xffdd('0x0'));var emlformat=require(_0xffdd('0x1'));var rimraf=require(_0xffdd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xffdd('0x3'));var BPromise=require(_0xffdd('0x4'));var Mustache=require(_0xffdd('0x5'));var util=require(_0xffdd('0x6'));var path=require('path');var sox=require(_0xffdd('0x7'));var csv=require(_0xffdd('0x8'));var ejs=require(_0xffdd('0x9'));var fs=require('fs');var _=require(_0xffdd('0xa'));var squel=require(_0xffdd('0xb'));var crypto=require(_0xffdd('0xc'));var jsforce=require(_0xffdd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xffdd('0x8'));var querystring=require('querystring');var Papa=require(_0xffdd('0xe'));var Redis=require(_0xffdd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xffdd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffdd('0x11'));var logger=require(_0xffdd('0x12'))(_0xffdd('0x13'));var utils=require(_0xffdd('0x14'));var config=require('../../config/environment');var db=require(_0xffdd('0x15'))['db'];var integrations=require(_0xffdd('0x16'));var jayson=require(_0xffdd('0x17'));var client=jayson[_0xffdd('0x18')][_0xffdd('0x19')]({'port':0x232a});function checkPasswordPattern(_0x553c49,_0x1471d9,_0x5a84f9){if(_0x5a84f9){var _0x17291e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17291e[_0xffdd('0x1a')](_0x1471d9)){return _0x553c49;}else{throw new db[(_0xffdd('0x1b'))][(_0xffdd('0x1c'))](_0xffdd('0x1d'));}}else{return _0x553c49;}}function respondWithRpcPromise(_0x29c26a,_0x354629,_0x10e3c1,_0x56a12b){return new BPromise(function(_0x73ac85,_0x20bda4){var _0x5ec7e1=_0x56a12b||client;return _0x5ec7e1['request'](_0x29c26a,_0x10e3c1)[_0xffdd('0x1e')](function(_0xd2e13f){logger[_0xffdd('0x1f')]('VtigerAccount,\x20%s,\x20%s',_0x354629,_0xffdd('0x20'));logger[_0xffdd('0x21')](_0xffdd('0x22'),_0x354629,_0xffdd('0x20'),JSON['stringify'](_0xd2e13f));if(_0xd2e13f[_0xffdd('0x23')]){if(_0xd2e13f[_0xffdd('0x23')]['code']===0x1f4){logger[_0xffdd('0x23')](_0xffdd('0x24'),_0x354629,_0xd2e13f[_0xffdd('0x23')][_0xffdd('0x25')]);return _0x20bda4(_0xd2e13f['error'][_0xffdd('0x25')]);}logger[_0xffdd('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x354629,_0xd2e13f[_0xffdd('0x23')][_0xffdd('0x25')]);return _0x73ac85(_0xd2e13f[_0xffdd('0x23')]['message']);}else{logger[_0xffdd('0x1f')](_0xffdd('0x24'),_0x354629,'request\x20sent');_0x73ac85(_0xd2e13f[_0xffdd('0x26')]['message']);}})[_0xffdd('0x27')](function(_0x1850d2){logger['error'](_0xffdd('0x24'),_0x354629,_0x1850d2);_0x20bda4(_0x1850d2);});});}function respondWithStatusCode(_0x104f84,_0x176799){_0x176799=_0x176799||0xcc;return function(_0x40a203){if(_0x40a203){return _0x104f84[_0xffdd('0x28')](_0x176799);}return _0x104f84['status'](_0x176799)['end']();};}function respondWithResult(_0x1edd4f,_0x5f08d7){_0x5f08d7=_0x5f08d7||0xc8;return function(_0x516827){if(_0x516827){return _0x1edd4f[_0xffdd('0x29')](_0x5f08d7)['json'](_0x516827);}};}function respondWithFilteredResult(_0x1b43da,_0x492dd2){return function(_0x5ddba7){if(_0x5ddba7){var _0x54b662=_0x5ddba7[_0xffdd('0x2a')],_0x334880=_0x492dd2[_0xffdd('0x2b')],_0x201051=_0x492dd2['offset']+_0x492dd2['limit'],_0x3a3673;if(_0x201051>=_0x54b662){_0x201051=_0x54b662;_0x3a3673=0xc8;}else{_0x3a3673=0xce;}_0x1b43da[_0xffdd('0x29')](_0x3a3673);return _0x1b43da[_0xffdd('0x2c')](_0xffdd('0x2d'),_0x334880+'-'+_0x201051+'/'+_0x54b662)['json'](_0x5ddba7);}return null;};}function patchUpdates(_0x46188e){return function(_0x40c99b){try{jsonpatch[_0xffdd('0x2e')](_0x40c99b,_0x46188e,!![]);}catch(_0x4c395c){return BPromise[_0xffdd('0x2f')](_0x4c395c);}return _0x40c99b['save']();};}function saveUpdates(_0x250b2d,_0xc244f5){return function(_0x3ba786){if(_0x3ba786){return _0x3ba786['update'](_0x250b2d)['then'](function(_0x459926){return _0x459926;});}return null;};}function removeEntity(_0x51b470,_0x200ca1){return function(_0x2d2884){if(_0x2d2884){return _0x2d2884[_0xffdd('0x30')]()[_0xffdd('0x1e')](function(){_0x51b470['status'](0xcc)[_0xffdd('0x31')]();});}};}function handleEntityNotFound(_0x2898fe,_0x30df6c){return function(_0x350cfb){if(!_0x350cfb){_0x2898fe['sendStatus'](0x194);}return _0x350cfb;};}function handleError(_0x203df5,_0x386867){_0x386867=_0x386867||0x1f4;return function(_0x2b9ea6){logger[_0xffdd('0x23')](_0x2b9ea6[_0xffdd('0x32')]);if(_0x2b9ea6[_0xffdd('0x33')]){delete _0x2b9ea6['name'];}_0x203df5[_0xffdd('0x29')](_0x386867)[_0xffdd('0x34')](_0x2b9ea6);};}exports['index']=function(_0x216181,_0x49a139){var _0x2edd91={},_0x2d81b8={},_0x2975e4={'count':0x0,'rows':[]};var _0x374736=_[_0xffdd('0x35')](db[_0xffdd('0x36')][_0xffdd('0x37')],function(_0x3b5a1d){return{'name':_0x3b5a1d[_0xffdd('0x38')],'type':_0x3b5a1d['type'][_0xffdd('0x39')]};});_0x2d81b8[_0xffdd('0x3a')]=_[_0xffdd('0x35')](_0x374736,'name');_0x2d81b8[_0xffdd('0x3b')]=_[_0xffdd('0x3c')](_0x216181[_0xffdd('0x3b')]);_0x2d81b8[_0xffdd('0x3d')]=_[_0xffdd('0x3e')](_0x2d81b8[_0xffdd('0x3a')],_0x2d81b8['query']);_0x2edd91[_0xffdd('0x3f')]=_[_0xffdd('0x3e')](_0x2d81b8[_0xffdd('0x3a')],qs['fields'](_0x216181[_0xffdd('0x3b')][_0xffdd('0x40')]));_0x2edd91[_0xffdd('0x3f')]=_0x2edd91['attributes'][_0xffdd('0x41')]?_0x2edd91[_0xffdd('0x3f')]:_0x2d81b8[_0xffdd('0x3a')];if(!_0x216181[_0xffdd('0x3b')][_0xffdd('0x42')](_0xffdd('0x43'))){_0x2edd91[_0xffdd('0x44')]=qs[_0xffdd('0x44')](_0x216181[_0xffdd('0x3b')][_0xffdd('0x44')]);_0x2edd91[_0xffdd('0x2b')]=qs['offset'](_0x216181[_0xffdd('0x3b')][_0xffdd('0x2b')]);}_0x2edd91[_0xffdd('0x45')]=qs[_0xffdd('0x46')](_0x216181['query'][_0xffdd('0x46')]);_0x2edd91[_0xffdd('0x47')]=qs[_0xffdd('0x3d')](_[_0xffdd('0x48')](_0x216181[_0xffdd('0x3b')],_0x2d81b8[_0xffdd('0x3d')]),_0x374736);if(_0x216181['query'][_0xffdd('0x49')]){_0x2edd91[_0xffdd('0x47')]=_[_0xffdd('0x4a')](_0x2edd91[_0xffdd('0x47')],{'$or':_[_0xffdd('0x35')](_0x374736,function(_0x1c2868){if(_0x1c2868[_0xffdd('0x4b')]!==_0xffdd('0x4c')){var _0x1fd521={};_0x1fd521[_0x1c2868[_0xffdd('0x33')]]={'$like':'%'+_0x216181[_0xffdd('0x3b')][_0xffdd('0x49')]+'%'};return _0x1fd521;}})});}_0x2edd91=_['merge']({},_0x2edd91,_0x216181['options']);var _0x1e5398={'where':_0x2edd91[_0xffdd('0x47')]};return db[_0xffdd('0x36')][_0xffdd('0x2a')](_0x1e5398)[_0xffdd('0x1e')](function(_0x3aef56){_0x2975e4[_0xffdd('0x2a')]=_0x3aef56;if(_0x216181[_0xffdd('0x3b')][_0xffdd('0x4d')]){_0x2edd91[_0xffdd('0x4e')]=[{'all':!![]}];}return db[_0xffdd('0x36')][_0xffdd('0x4f')](_0x2edd91);})['then'](function(_0x575102){_0x2975e4[_0xffdd('0x50')]=_0x575102;return _0x2975e4;})['then'](respondWithFilteredResult(_0x49a139,_0x2edd91))[_0xffdd('0x27')](handleError(_0x49a139,null));};exports[_0xffdd('0x51')]=function(_0x498b0c,_0xd49d40){var _0x2628b0={'raw':![],'where':{'id':_0x498b0c[_0xffdd('0x52')]['id']}},_0x5cc2ca={};_0x5cc2ca['model']=_[_0xffdd('0x3c')](db[_0xffdd('0x36')][_0xffdd('0x37')]);_0x5cc2ca[_0xffdd('0x3b')]=_[_0xffdd('0x3c')](_0x498b0c[_0xffdd('0x3b')]);_0x5cc2ca[_0xffdd('0x3d')]=_['intersection'](_0x5cc2ca[_0xffdd('0x3a')],_0x5cc2ca[_0xffdd('0x3b')]);_0x2628b0[_0xffdd('0x3f')]=_[_0xffdd('0x3e')](_0x5cc2ca[_0xffdd('0x3a')],qs['fields'](_0x498b0c[_0xffdd('0x3b')]['fields']));_0x2628b0[_0xffdd('0x3f')]=_0x2628b0[_0xffdd('0x3f')][_0xffdd('0x41')]?_0x2628b0['attributes']:_0x5cc2ca[_0xffdd('0x3a')];if(_0x498b0c[_0xffdd('0x3b')][_0xffdd('0x4d')]){_0x2628b0[_0xffdd('0x4e')]=[{'all':!![]}];}_0x2628b0=_[_0xffdd('0x4a')]({},_0x2628b0,_0x498b0c['options']);return db[_0xffdd('0x36')][_0xffdd('0x53')](_0x2628b0)[_0xffdd('0x1e')](handleEntityNotFound(_0xd49d40,null))[_0xffdd('0x1e')](respondWithResult(_0xd49d40,null))[_0xffdd('0x27')](handleError(_0xd49d40,null));};exports['create']=function(_0x3ffa81,_0x9bb698){return db[_0xffdd('0x36')][_0xffdd('0x54')](_0x3ffa81[_0xffdd('0x55')],{})[_0xffdd('0x1e')](respondWithResult(_0x9bb698,0xc9))[_0xffdd('0x27')](handleError(_0x9bb698,null));};exports['update']=function(_0x226d74,_0x187a8a){if(_0x226d74[_0xffdd('0x55')]['id']){delete _0x226d74[_0xffdd('0x55')]['id'];}return db['VtigerAccount'][_0xffdd('0x53')]({'where':{'id':_0x226d74['params']['id']}})[_0xffdd('0x1e')](handleEntityNotFound(_0x187a8a,null))[_0xffdd('0x1e')](saveUpdates(_0x226d74['body'],null))['then'](respondWithResult(_0x187a8a,null))['catch'](handleError(_0x187a8a,null));};exports['destroy']=function(_0x19d471,_0x4745d6){return db[_0xffdd('0x36')][_0xffdd('0x53')]({'where':{'id':_0x19d471['params']['id']}})['then'](handleEntityNotFound(_0x4745d6,null))[_0xffdd('0x1e')](removeEntity(_0x4745d6,null))[_0xffdd('0x27')](handleError(_0x4745d6,null));};exports[_0xffdd('0x56')]=function(_0x16e885,_0x30f381,_0x9778d5){var _0x322514={};var _0x4e5e3b={};var _0x27046e;var _0x3f6d60;return db['VtigerAccount'][_0xffdd('0x57')]({'where':{'id':_0x16e885[_0xffdd('0x52')]['id']}})[_0xffdd('0x1e')](handleEntityNotFound(_0x30f381,null))[_0xffdd('0x1e')](function(_0x2af024){if(_0x2af024){_0x27046e=_0x2af024;_0x4e5e3b[_0xffdd('0x3a')]=_['keys'](db[_0xffdd('0x58')][_0xffdd('0x37')]);_0x4e5e3b[_0xffdd('0x3b')]=_['keys'](_0x16e885[_0xffdd('0x3b')]);_0x4e5e3b[_0xffdd('0x3d')]=_[_0xffdd('0x3e')](_0x4e5e3b[_0xffdd('0x3a')],_0x4e5e3b[_0xffdd('0x3b')]);_0x322514['attributes']=_['intersection'](_0x4e5e3b[_0xffdd('0x3a')],qs['fields'](_0x16e885[_0xffdd('0x3b')][_0xffdd('0x40')]));_0x322514[_0xffdd('0x3f')]=_0x322514[_0xffdd('0x3f')][_0xffdd('0x41')]?_0x322514[_0xffdd('0x3f')]:_0x4e5e3b[_0xffdd('0x3a')];_0x322514[_0xffdd('0x45')]=qs[_0xffdd('0x46')](_0x16e885['query'][_0xffdd('0x46')]);_0x322514['where']=qs[_0xffdd('0x3d')](_['pick'](_0x16e885['query'],_0x4e5e3b[_0xffdd('0x3d')]));if(_0x16e885[_0xffdd('0x3b')][_0xffdd('0x49')]){_0x322514[_0xffdd('0x47')]=_[_0xffdd('0x4a')](_0x322514['where'],{'$or':_['map'](_0x322514[_0xffdd('0x3f')],function(_0x5d6b74){var _0x5d16bb={};_0x5d16bb[_0x5d6b74]={'$like':'%'+_0x16e885[_0xffdd('0x3b')][_0xffdd('0x49')]+'%'};return _0x5d16bb;})});}_0x322514=_[_0xffdd('0x4a')]({},_0x322514,_0x16e885[_0xffdd('0x59')]);return _0x27046e[_0xffdd('0x56')](_0x322514);}})[_0xffdd('0x1e')](function(_0x5ba559){if(_0x5ba559){_0x3f6d60=_0x5ba559['length'];if(!_0x16e885[_0xffdd('0x3b')][_0xffdd('0x42')]('nolimit')){_0x322514[_0xffdd('0x44')]=qs[_0xffdd('0x44')](_0x16e885[_0xffdd('0x3b')][_0xffdd('0x44')]);_0x322514[_0xffdd('0x2b')]=qs[_0xffdd('0x2b')](_0x16e885[_0xffdd('0x3b')][_0xffdd('0x2b')]);}return _0x27046e[_0xffdd('0x56')](_0x322514);}})[_0xffdd('0x1e')](function(_0x34a7bc){if(_0x34a7bc){return _0x34a7bc?{'count':_0x3f6d60,'rows':_0x34a7bc}:null;}})['then'](respondWithResult(_0x30f381,null))[_0xffdd('0x27')](handleError(_0x30f381,null));};exports[_0xffdd('0x5a')]=function(_0x5dc982,_0x58c976,_0x206e67){if(_0x5dc982[_0xffdd('0x55')]['id']){delete _0x5dc982[_0xffdd('0x55')]['id'];}return db[_0xffdd('0x36')][_0xffdd('0x57')]({'where':{'id':_0x5dc982[_0xffdd('0x52')]['id']}})[_0xffdd('0x1e')](handleEntityNotFound(_0x58c976,null))[_0xffdd('0x1e')](function(_0x5c59e0){if(_0x5c59e0){_0x5dc982[_0xffdd('0x55')][_0xffdd('0x5b')]=_0x5c59e0['id'];_0x5dc982[_0xffdd('0x55')][_0xffdd('0x5c')]=integrations['getSubjects'](_0x5dc982[_0xffdd('0x55')][_0xffdd('0x5d')],_0x5dc982[_0xffdd('0x55')][_0xffdd('0x4b')]);_0x5dc982['body']['Descriptions']=integrations[_0xffdd('0x5e')](_0x5dc982['body'][_0xffdd('0x5d')],_0x5dc982[_0xffdd('0x55')][_0xffdd('0x4b')]);return db[_0xffdd('0x58')][_0xffdd('0x54')](_0x5dc982['body'],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xffdd('0x5f')],'as':_0xffdd('0x60')}]});}return null;})[_0xffdd('0x1e')](respondWithResult(_0x58c976,null))['catch'](handleError(_0x58c976,null));};var md5=require(_0xffdd('0x61'));exports[_0xffdd('0x62')]=function(_0x4ce0a4,_0x38e3f9,_0x5abc9a){var _0x53871d=null;var _0x468549=null;var _0xf90d01=null;var _0x4f9156=null;var _0x4daca7='';return db[_0xffdd('0x36')][_0xffdd('0x57')]({'where':{'id':_0x4ce0a4[_0xffdd('0x52')]['id']},'attributes':['id',_0xffdd('0x33'),_0xffdd('0x63'),_0xffdd('0x64'),_0xffdd('0x65'),_0xffdd('0x66'),_0xffdd('0x67'),'accessKey']})[_0xffdd('0x1e')](handleEntityNotFound(_0x38e3f9,null))[_0xffdd('0x1e')](function(_0x193842){if(_0x193842){_0x53871d=_0x193842[_0xffdd('0x63')];_0x468549=_0x193842['accessKey'];_0xf90d01=_0x193842['moduleName'];_0x4daca7=_0x193842[_0xffdd('0x66')];var _0x8c5777=_0x4daca7[_0xffdd('0x68')](-0x1);if(_0x8c5777==='/'){_0x4daca7=_0x4daca7[_0xffdd('0x69')](0x0,_0x4daca7['lastIndexOf'](_0x8c5777));}_0x4f9156=util[_0xffdd('0x6a')](_0xffdd('0x6b'),_0x4daca7);var _0x3a9011={'method':_0xffdd('0x6c'),'uri':_0x4f9156,'qs':{'operation':'getchallenge','username':_0x193842[_0xffdd('0x63')]},'json':!![]};return rp(_0x3a9011);}})[_0xffdd('0x1e')](function(_0x315263){if(_0x315263[_0xffdd('0x6d')]){var _0x56caaf={'method':_0xffdd('0x6e'),'uri':_0x4f9156,'form':{'operation':_0xffdd('0x6f'),'username':_0x53871d,'accessKey':md5(_0x315263[_0xffdd('0x26')][_0xffdd('0x70')]+_0x468549)},'json':!![]};return rp(_0x56caaf);}})[_0xffdd('0x1e')](function(_0x4bacef){if(_0x4bacef[_0xffdd('0x6d')]){var _0x1e1ee4={'method':_0xffdd('0x6c'),'uri':_0x4f9156,'qs':{'operation':'describe','username':_0x53871d,'sessionName':_0x4bacef[_0xffdd('0x26')][_0xffdd('0x71')],'elementType':_0xf90d01},'json':!![]};return rp(_0x1e1ee4);}})[_0xffdd('0x1e')](function(_0x3fcc35){if(_0x3fcc35['success']){var _0x1b47a1=[_0xffdd('0x72'),'reference','owner'];_[_0xffdd('0x73')](_0x3fcc35[_0xffdd('0x26')]['fields'],function(_0xbe4987){return _0x1b47a1[_0xffdd('0x74')](_0xbe4987[_0xffdd('0x4b')]['name']);});_[_0xffdd('0x73')](_0x3fcc35[_0xffdd('0x26')][_0xffdd('0x40')],function(_0x41c3f9){return _0x41c3f9[_0xffdd('0x75')]===_0xffdd('0x76');});return{'count':_0x3fcc35['result'][_0xffdd('0x40')][_0xffdd('0x41')],'rows':_[_0xffdd('0x35')](_0x3fcc35[_0xffdd('0x26')][_0xffdd('0x40')],function(_0x4ec4bd){return{'id':_0x4ec4bd[_0xffdd('0x33')],'name':_0x4ec4bd[_0xffdd('0x77')],'custom':_['startsWith'](_0x4ec4bd[_0xffdd('0x33')],_0xffdd('0x78'))?!![]:![],'options':_0x4ec4bd[_0xffdd('0x4b')][_0xffdd('0x33')]==='picklist'&&_0x4ec4bd[_0xffdd('0x4b')][_0xffdd('0x79')]['length']>0x0?_[_0xffdd('0x35')](_0x4ec4bd[_0xffdd('0x4b')][_0xffdd('0x79')],function(_0x24c75a){return{'name':_0x24c75a[_0xffdd('0x77')],'value':_0x24c75a[_0xffdd('0x7a')]};}):[]};})};}})[_0xffdd('0x1e')](respondWithResult(_0x38e3f9,null))[_0xffdd('0x27')](function(_0x248c00){console[_0xffdd('0x7b')](_0xffdd('0x7c')+_0x248c00);var _0x17ef07=_0x4ce0a4['query']['test']?0x1f4:_0x248c00[_0xffdd('0x7d')]||0x1f4;logger[_0xffdd('0x23')](_0xffdd('0x7e'),'getFields',_0x17ef07,JSON['stringify'](_0x248c00));delete _0x248c00[_0xffdd('0x33')];if(_0x17ef07===0x191){_0x17ef07=0x190;}_0x38e3f9[_0xffdd('0x29')](_0x17ef07)[_0xffdd('0x34')](_0x4ce0a4['query'][_0xffdd('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0x248c00[_0xffdd('0x7d')]}:_0x248c00);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e74432a..5c898df 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 _0x8ebc=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x1a4638,_0x3aff85){var _0x4c7799=function(_0x20a89d){while(--_0x20a89d){_0x1a4638['push'](_0x1a4638['shift']());}};_0x4c7799(++_0x3aff85);}(_0x8ebc,0x18c));var _0xc8eb=function(_0x351c61,_0x2a00de){_0x351c61=_0x351c61-0x0;var _0x328bee=_0x8ebc[_0x351c61];return _0x328bee;};'use strict';var _=require(_0xc8eb('0x0'));var util=require('util');var logger=require(_0xc8eb('0x1'))(_0xc8eb('0x2'));var moment=require('moment');var BPromise=require(_0xc8eb('0x3'));var rp=require(_0xc8eb('0x4'));var fs=require('fs');var path=require(_0xc8eb('0x5'));var rimraf=require(_0xc8eb('0x6'));var config=require('../../config/environment');var attributes=require(_0xc8eb('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xc8eb('0x8')]=function(_0x3061ec,_0x5c42ad){return _0x3061ec[_0xc8eb('0x9')](_0xc8eb('0xa'),attributes,{'tableName':_0xc8eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x216e=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x216e,0x15f));var _0xe216=function(_0x30d2af,_0x378716){_0x30d2af=_0x30d2af-0x0;var _0x2d1c42=_0x216e[_0x30d2af];return _0x2d1c42;};'use strict';var _=require(_0xe216('0x0'));var util=require('util');var logger=require(_0xe216('0x1'))(_0xe216('0x2'));var moment=require(_0xe216('0x3'));var BPromise=require('bluebird');var rp=require(_0xe216('0x4'));var fs=require('fs');var path=require(_0xe216('0x5'));var rimraf=require(_0xe216('0x6'));var config=require('../../config/environment');var attributes=require(_0xe216('0x7'));var integrations=require(_0xe216('0x8'));module[_0xe216('0x9')]=function(_0x2da533,_0x15bf15){return _0x2da533[_0xe216('0xa')](_0xe216('0xb'),attributes,{'tableName':_0xe216('0xc'),'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 fabbe7f..19929b4 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 _0xae07=['../../config/logger','rpc','jayson/promise','client','http','request','then','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetVtigerAccount','VtigerAccount','findAll','options','where','include','map','attributes','model','debug','catch','ShowVtigerAccount','find','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x33fc43,_0x4b9e92){var _0x5666a9=function(_0x2fa26f){while(--_0x2fa26f){_0x33fc43['push'](_0x33fc43['shift']());}};_0x5666a9(++_0x4b9e92);}(_0xae07,0x14e));var _0x7ae0=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xae07[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x7ae0('0x0'));var util=require(_0x7ae0('0x1'));var moment=require(_0x7ae0('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ae0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ae0('0x4'))['db'];var utils=require(_0x7ae0('0x5'));var logger=require(_0x7ae0('0x6'))(_0x7ae0('0x7'));var config=require('../../config/environment');var jayson=require(_0x7ae0('0x8'));var client=jayson[_0x7ae0('0x9')][_0x7ae0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x333e27,_0x1f23c4,_0x3a470e){return new BPromise(function(_0x31eed4,_0x311f06){return client[_0x7ae0('0xb')](_0x333e27,_0x3a470e)[_0x7ae0('0xc')](function(_0x59ff0b){logger['info'](_0x7ae0('0xd'),_0x1f23c4,'request\x20sent');logger['debug'](_0x7ae0('0xe'),_0x1f23c4,'request\x20sent',JSON[_0x7ae0('0xf')](_0x59ff0b));if(_0x59ff0b[_0x7ae0('0x10')]){if(_0x59ff0b[_0x7ae0('0x10')]['code']===0x1f4){logger['error'](_0x7ae0('0xd'),_0x1f23c4,_0x59ff0b['error'][_0x7ae0('0x11')]);return _0x311f06(_0x59ff0b[_0x7ae0('0x10')][_0x7ae0('0x11')]);}logger[_0x7ae0('0x10')](_0x7ae0('0xd'),_0x1f23c4,_0x59ff0b[_0x7ae0('0x10')][_0x7ae0('0x11')]);return _0x31eed4(_0x59ff0b[_0x7ae0('0x10')][_0x7ae0('0x11')]);}else{logger['info'](_0x7ae0('0xd'),_0x1f23c4,_0x7ae0('0x12'));_0x31eed4(_0x59ff0b[_0x7ae0('0x13')][_0x7ae0('0x11')]);}})['catch'](function(_0x539f22){logger[_0x7ae0('0x10')](_0x7ae0('0xd'),_0x1f23c4,_0x539f22);_0x311f06(_0x539f22);});});}exports[_0x7ae0('0x14')]=function(_0x1a1db6){var _0x45bac2=this;return new Promise(function(_0x189e12,_0x3bc352){return db[_0x7ae0('0x15')][_0x7ae0('0x16')]({'raw':_0x1a1db6['options']?_0x1a1db6[_0x7ae0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1a1db6[_0x7ae0('0x17')]?_0x1a1db6[_0x7ae0('0x17')][_0x7ae0('0x18')]||null:null,'attributes':_0x1a1db6[_0x7ae0('0x17')]?_0x1a1db6[_0x7ae0('0x17')]['attributes']||null:null,'limit':_0x1a1db6[_0x7ae0('0x17')]?_0x1a1db6[_0x7ae0('0x17')]['limit']||null:null,'include':_0x1a1db6[_0x7ae0('0x17')]?_0x1a1db6[_0x7ae0('0x17')][_0x7ae0('0x19')]?_[_0x7ae0('0x1a')](_0x1a1db6['options'][_0x7ae0('0x19')],function(_0x227d6c){return{'model':db[_0x227d6c['model']],'as':_0x227d6c['as'],'attributes':_0x227d6c[_0x7ae0('0x1b')],'include':_0x227d6c[_0x7ae0('0x19')]?_['map'](_0x227d6c['include'],function(_0x46120d){return{'model':db[_0x46120d['model']],'as':_0x46120d['as'],'attributes':_0x46120d['attributes'],'include':_0x46120d[_0x7ae0('0x19')]?_['map'](_0x46120d['include'],function(_0x11474c){return{'model':db[_0x11474c[_0x7ae0('0x1c')]],'as':_0x11474c['as'],'attributes':_0x11474c[_0x7ae0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7ae0('0xc')](function(_0x136807){logger['info']('GetVtigerAccount',_0x1a1db6);logger[_0x7ae0('0x1d')](_0x7ae0('0x14'),_0x1a1db6,JSON['stringify'](_0x136807));_0x189e12(_0x136807);})[_0x7ae0('0x1e')](function(_0x415edf){logger[_0x7ae0('0x10')](_0x7ae0('0x14'),_0x415edf[_0x7ae0('0x11')],_0x1a1db6);_0x3bc352(_0x45bac2[_0x7ae0('0x10')](0x1f4,_0x415edf['message']));});});};exports[_0x7ae0('0x1f')]=function(_0x1059df){var _0x457cb2=this;return new Promise(function(_0x179e79,_0x10dd2c){return db[_0x7ae0('0x15')][_0x7ae0('0x20')]({'raw':_0x1059df['options']?_0x1059df['options'][_0x7ae0('0x21')]===undefined?!![]:![]:!![],'where':_0x1059df[_0x7ae0('0x17')]?_0x1059df[_0x7ae0('0x17')]['where']||null:null,'attributes':_0x1059df[_0x7ae0('0x17')]?_0x1059df[_0x7ae0('0x17')][_0x7ae0('0x1b')]||null:null,'include':_0x1059df['options']?_0x1059df['options'][_0x7ae0('0x19')]?_[_0x7ae0('0x1a')](_0x1059df[_0x7ae0('0x17')][_0x7ae0('0x19')],function(_0x176a77){return{'model':db[_0x176a77[_0x7ae0('0x1c')]],'as':_0x176a77['as'],'attributes':_0x176a77[_0x7ae0('0x1b')],'include':_0x176a77[_0x7ae0('0x19')]?_[_0x7ae0('0x1a')](_0x176a77[_0x7ae0('0x19')],function(_0x11a813){return{'model':db[_0x11a813[_0x7ae0('0x1c')]],'as':_0x11a813['as'],'attributes':_0x11a813['attributes'],'include':_0x11a813['include']?_[_0x7ae0('0x1a')](_0x11a813[_0x7ae0('0x19')],function(_0x592f12){return{'model':db[_0x592f12['model']],'as':_0x592f12['as'],'attributes':_0x592f12[_0x7ae0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7ae0('0xc')](function(_0x26fab9){logger['info'](_0x7ae0('0x1f'),_0x1059df);logger[_0x7ae0('0x1d')]('ShowVtigerAccount',_0x1059df,JSON[_0x7ae0('0xf')](_0x26fab9));_0x179e79(_0x26fab9);})[_0x7ae0('0x1e')](function(_0x146d65){logger[_0x7ae0('0x10')](_0x7ae0('0x1f'),_0x146d65['message'],_0x1059df);_0x10dd2c(_0x457cb2[_0x7ae0('0x10')](0x1f4,_0x146d65[_0x7ae0('0x11')]));});});}; \ No newline at end of file +var _0x0e8d=['VtigerAccount','findAll','options','raw','attributes','limit','include','model','map','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount'];(function(_0x15da60,_0x3661df){var _0x2709bc=function(_0x242df2){while(--_0x242df2){_0x15da60['push'](_0x15da60['shift']());}};_0x2709bc(++_0x3661df);}(_0x0e8d,0xbf));var _0xd0e8=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x0e8d[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xd0e8('0x0'));var util=require(_0xd0e8('0x1'));var moment=require(_0xd0e8('0x2'));var BPromise=require(_0xd0e8('0x3'));var rs=require(_0xd0e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0e8('0x5'))['db'];var utils=require(_0xd0e8('0x6'));var logger=require(_0xd0e8('0x7'))('rpc');var config=require(_0xd0e8('0x8'));var jayson=require(_0xd0e8('0x9'));var client=jayson[_0xd0e8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f4174,_0x22291b,_0x4b8808){return new BPromise(function(_0x50bbee,_0x8b6ef){return client[_0xd0e8('0xb')](_0x1f4174,_0x4b8808)[_0xd0e8('0xc')](function(_0x8dc709){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x22291b,_0xd0e8('0xd'));logger[_0xd0e8('0xe')](_0xd0e8('0xf'),_0x22291b,_0xd0e8('0xd'),JSON[_0xd0e8('0x10')](_0x8dc709));if(_0x8dc709[_0xd0e8('0x11')]){if(_0x8dc709['error'][_0xd0e8('0x12')]===0x1f4){logger[_0xd0e8('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x22291b,_0x8dc709[_0xd0e8('0x11')][_0xd0e8('0x13')]);return _0x8b6ef(_0x8dc709[_0xd0e8('0x11')][_0xd0e8('0x13')]);}logger[_0xd0e8('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x22291b,_0x8dc709[_0xd0e8('0x11')][_0xd0e8('0x13')]);return _0x50bbee(_0x8dc709['error'][_0xd0e8('0x13')]);}else{logger[_0xd0e8('0x14')](_0xd0e8('0x15'),_0x22291b,_0xd0e8('0xd'));_0x50bbee(_0x8dc709[_0xd0e8('0x16')][_0xd0e8('0x13')]);}})[_0xd0e8('0x17')](function(_0x30eedd){logger[_0xd0e8('0x11')](_0xd0e8('0x15'),_0x22291b,_0x30eedd);_0x8b6ef(_0x30eedd);});});}exports[_0xd0e8('0x18')]=function(_0xe2f43d){var _0x219e00=this;return new Promise(function(_0x2d81a3,_0x5ad8e6){return db[_0xd0e8('0x19')][_0xd0e8('0x1a')]({'raw':_0xe2f43d[_0xd0e8('0x1b')]?_0xe2f43d['options'][_0xd0e8('0x1c')]===undefined?!![]:![]:!![],'where':_0xe2f43d[_0xd0e8('0x1b')]?_0xe2f43d[_0xd0e8('0x1b')]['where']||null:null,'attributes':_0xe2f43d['options']?_0xe2f43d[_0xd0e8('0x1b')][_0xd0e8('0x1d')]||null:null,'limit':_0xe2f43d[_0xd0e8('0x1b')]?_0xe2f43d[_0xd0e8('0x1b')][_0xd0e8('0x1e')]||null:null,'include':_0xe2f43d['options']?_0xe2f43d[_0xd0e8('0x1b')][_0xd0e8('0x1f')]?_['map'](_0xe2f43d['options'][_0xd0e8('0x1f')],function(_0x473964){return{'model':db[_0x473964[_0xd0e8('0x20')]],'as':_0x473964['as'],'attributes':_0x473964[_0xd0e8('0x1d')],'include':_0x473964[_0xd0e8('0x1f')]?_[_0xd0e8('0x21')](_0x473964[_0xd0e8('0x1f')],function(_0x5bf8b0){return{'model':db[_0x5bf8b0['model']],'as':_0x5bf8b0['as'],'attributes':_0x5bf8b0[_0xd0e8('0x1d')],'include':_0x5bf8b0[_0xd0e8('0x1f')]?_[_0xd0e8('0x21')](_0x5bf8b0[_0xd0e8('0x1f')],function(_0x25f7ce){return{'model':db[_0x25f7ce[_0xd0e8('0x20')]],'as':_0x25f7ce['as'],'attributes':_0x25f7ce['attributes']};}):[]};}):[]};}):[]:[]})[_0xd0e8('0xc')](function(_0x1adfd3){logger[_0xd0e8('0x14')]('GetVtigerAccount',_0xe2f43d);logger[_0xd0e8('0xe')](_0xd0e8('0x18'),_0xe2f43d,JSON[_0xd0e8('0x10')](_0x1adfd3));_0x2d81a3(_0x1adfd3);})['catch'](function(_0x5efe6d){logger[_0xd0e8('0x11')](_0xd0e8('0x18'),_0x5efe6d['message'],_0xe2f43d);_0x5ad8e6(_0x219e00[_0xd0e8('0x11')](0x1f4,_0x5efe6d[_0xd0e8('0x13')]));});});};exports[_0xd0e8('0x22')]=function(_0x23489b){var _0x23d5ab=this;return new Promise(function(_0xa57309,_0x186623){return db['VtigerAccount'][_0xd0e8('0x23')]({'raw':_0x23489b[_0xd0e8('0x1b')]?_0x23489b['options'][_0xd0e8('0x1c')]===undefined?!![]:![]:!![],'where':_0x23489b[_0xd0e8('0x1b')]?_0x23489b['options']['where']||null:null,'attributes':_0x23489b[_0xd0e8('0x1b')]?_0x23489b[_0xd0e8('0x1b')][_0xd0e8('0x1d')]||null:null,'include':_0x23489b[_0xd0e8('0x1b')]?_0x23489b[_0xd0e8('0x1b')]['include']?_['map'](_0x23489b[_0xd0e8('0x1b')]['include'],function(_0x4d2206){return{'model':db[_0x4d2206[_0xd0e8('0x20')]],'as':_0x4d2206['as'],'attributes':_0x4d2206['attributes'],'include':_0x4d2206['include']?_[_0xd0e8('0x21')](_0x4d2206[_0xd0e8('0x1f')],function(_0x354c60){return{'model':db[_0x354c60['model']],'as':_0x354c60['as'],'attributes':_0x354c60[_0xd0e8('0x1d')],'include':_0x354c60[_0xd0e8('0x1f')]?_['map'](_0x354c60['include'],function(_0x113791){return{'model':db[_0x113791[_0xd0e8('0x20')]],'as':_0x113791['as'],'attributes':_0x113791[_0xd0e8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd0e8('0xc')](function(_0x4bfe90){logger[_0xd0e8('0x14')](_0xd0e8('0x22'),_0x23489b);logger[_0xd0e8('0xe')](_0xd0e8('0x22'),_0x23489b,JSON[_0xd0e8('0x10')](_0x4bfe90));_0xa57309(_0x4bfe90);})[_0xd0e8('0x17')](function(_0x4b615d){logger[_0xd0e8('0x11')](_0xd0e8('0x22'),_0x4b615d[_0xd0e8('0x13')],_0x23489b);_0x186623(_0x23d5ab['error'](0x1f4,_0x4b615d['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c94bddb..1009171 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x57663c,_0x14624b){var _0x1139b1=function(_0x4af326){while(--_0x4af326){_0x57663c['push'](_0x57663c['shift']());}};_0x1139b1(++_0x14624b);}(_0xb10b,0x12a));var _0xbb10=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0xb10b[_0x403c8d];return _0x4ca60d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x41b26f,_0x168833){var _0x209acc=function(_0x20d425){while(--_0x20d425){_0x41b26f['push'](_0x41b26f['shift']());}};_0x209acc(++_0x168833);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f192e,_0x4d1756){_0x4f192e=_0x4f192e-0x0;var _0x49294d=_0xb10b[_0x4f192e];return _0x49294d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 386cbad..f7b9d74 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 _0x9c2f=['exports','STRING','sequelize'];(function(_0x44b005,_0x51199e){var _0x304f0b=function(_0x5a810e){while(--_0x5a810e){_0x44b005['push'](_0x44b005['shift']());}};_0x304f0b(++_0x51199e);}(_0x9c2f,0x134));var _0xf9c2=function(_0x4e879b,_0x1ce91d){_0x4e879b=_0x4e879b-0x0;var _0x5b0ce3=_0x9c2f[_0x4e879b];return _0x5b0ce3;};'use strict';var Sequelize=require(_0xf9c2('0x0'));module[_0xf9c2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf9c2('0x2')]}}; \ No newline at end of file +var _0xaca0=['sequelize','exports','STRING'];(function(_0x187e82,_0x5254eb){var _0x58625e=function(_0x59d14d){while(--_0x59d14d){_0x187e82['push'](_0x187e82['shift']());}};_0x58625e(++_0x5254eb);}(_0xaca0,0x15c));var _0x0aca=function(_0x399c47,_0x5dcca3){_0x399c47=_0x399c47-0x0;var _0x1ccc4d=_0xaca0[_0x399c47];return _0x1ccc4d;};'use strict';var Sequelize=require(_0x0aca('0x0'));module[_0x0aca('0x1')]={'name':{'type':Sequelize[_0x0aca('0x2')]},'description':{'type':Sequelize[_0x0aca('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d661c13..5e83fec 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 _0x42d7=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','end','status','json','offset','limit','set','reject','save','update','destroy','then','sendStatus','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','merge','where','map','options','count','includeAll','include','findAll','rows','show','params','find','create','body','getFields','findOne','order','filter','nolimit','getSubjects','VtigerField','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3a9690,_0x5e06e8){var _0x146bef=function(_0x28f514){while(--_0x28f514){_0x3a9690['push'](_0x3a9690['shift']());}};_0x146bef(++_0x5e06e8);}(_0x42d7,0xa8));var _0x742d=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0x42d7[_0x3f25b2];return _0xd8caeb;};'use strict';var pdf=require(_0x742d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x742d('0x1'));var zipdir=require(_0x742d('0x2'));var jsonpatch=require(_0x742d('0x3'));var rp=require(_0x742d('0x4'));var moment=require('moment');var BPromise=require(_0x742d('0x5'));var Mustache=require(_0x742d('0x6'));var util=require(_0x742d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x742d('0x8'));var ejs=require(_0x742d('0x9'));var fs=require('fs');var _=require(_0x742d('0xa'));var squel=require(_0x742d('0xb'));var crypto=require(_0x742d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x742d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x742d('0xe'));var Papa=require(_0x742d('0xf'));var Redis=require(_0x742d('0x10'));var authService=require(_0x742d('0x11'));var qs=require(_0x742d('0x12'));var as=require(_0x742d('0x13'));var hardwareService=require(_0x742d('0x14'));var logger=require('../../config/logger')(_0x742d('0x15'));var utils=require(_0x742d('0x16'));var config=require(_0x742d('0x17'));var db=require(_0x742d('0x18'))['db'];var jayson=require(_0x742d('0x19'));var client=jayson[_0x742d('0x1a')][_0x742d('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5e5283,_0x17f353,_0x42eaac){if(_0x42eaac){var _0x3304e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3304e4[_0x742d('0x1c')](_0x17f353)){return _0x5e5283;}else{throw new db['Sequelize']['ValidationError'](_0x742d('0x1d'));}}else{return _0x5e5283;}}function respondWithRpcPromise(_0x26f4bc,_0x1ee55d,_0x5e399b,_0x4b5ce4){return new BPromise(function(_0x1a7a50,_0x512b16){var _0x3eecfa=_0x4b5ce4||client;return _0x3eecfa[_0x742d('0x1e')](_0x26f4bc,_0x5e399b)['then'](function(_0x48c469){logger[_0x742d('0x1f')](_0x742d('0x20'),_0x1ee55d,'request\x20sent');logger[_0x742d('0x21')](_0x742d('0x22'),_0x1ee55d,_0x742d('0x23'),JSON[_0x742d('0x24')](_0x48c469));if(_0x48c469[_0x742d('0x25')]){if(_0x48c469['error']['code']===0x1f4){logger[_0x742d('0x25')](_0x742d('0x20'),_0x1ee55d,_0x48c469[_0x742d('0x25')]['message']);return _0x512b16(_0x48c469[_0x742d('0x25')]['message']);}logger['error'](_0x742d('0x20'),_0x1ee55d,_0x48c469[_0x742d('0x25')][_0x742d('0x26')]);return _0x1a7a50(_0x48c469[_0x742d('0x25')][_0x742d('0x26')]);}else{logger[_0x742d('0x1f')](_0x742d('0x20'),_0x1ee55d,'request\x20sent');_0x1a7a50(_0x48c469['result'][_0x742d('0x26')]);}})[_0x742d('0x27')](function(_0x5255e6){logger[_0x742d('0x25')](_0x742d('0x20'),_0x1ee55d,_0x5255e6);_0x512b16(_0x5255e6);});});}function respondWithStatusCode(_0x59452a,_0x1e1d77){_0x1e1d77=_0x1e1d77||0xcc;return function(_0x9919f8){if(_0x9919f8){return _0x59452a['sendStatus'](_0x1e1d77);}return _0x59452a['status'](_0x1e1d77)[_0x742d('0x28')]();};}function respondWithResult(_0x2f0b60,_0x34e1cc){_0x34e1cc=_0x34e1cc||0xc8;return function(_0xe88860){if(_0xe88860){return _0x2f0b60[_0x742d('0x29')](_0x34e1cc)[_0x742d('0x2a')](_0xe88860);}};}function respondWithFilteredResult(_0xc3e8cf,_0x114eb3){return function(_0x2d0726){if(_0x2d0726){var _0x560771=_0x2d0726['count'],_0x18bb99=_0x114eb3[_0x742d('0x2b')],_0x3c1a6b=_0x114eb3['offset']+_0x114eb3[_0x742d('0x2c')],_0x28ec0b;if(_0x3c1a6b>=_0x560771){_0x3c1a6b=_0x560771;_0x28ec0b=0xc8;}else{_0x28ec0b=0xce;}_0xc3e8cf[_0x742d('0x29')](_0x28ec0b);return _0xc3e8cf[_0x742d('0x2d')]('Content-Range',_0x18bb99+'-'+_0x3c1a6b+'/'+_0x560771)['json'](_0x2d0726);}return null;};}function patchUpdates(_0x5e8284){return function(_0x465473){try{jsonpatch['apply'](_0x465473,_0x5e8284,!![]);}catch(_0x2716e0){return BPromise[_0x742d('0x2e')](_0x2716e0);}return _0x465473[_0x742d('0x2f')]();};}function saveUpdates(_0x16f87d,_0x3ee60c){return function(_0x1d8aef){if(_0x1d8aef){return _0x1d8aef[_0x742d('0x30')](_0x16f87d)['then'](function(_0x425519){return _0x425519;});}return null;};}function removeEntity(_0x2d4c05,_0x164ebd){return function(_0x20dce3){if(_0x20dce3){return _0x20dce3[_0x742d('0x31')]()[_0x742d('0x32')](function(){_0x2d4c05['status'](0xcc)[_0x742d('0x28')]();});}};}function handleEntityNotFound(_0x73b0eb,_0x42159e){return function(_0x14c93c){if(!_0x14c93c){_0x73b0eb[_0x742d('0x33')](0x194);}return _0x14c93c;};}function handleError(_0x289bdc,_0x55326c){_0x55326c=_0x55326c||0x1f4;return function(_0x38cb49){logger[_0x742d('0x25')](_0x38cb49[_0x742d('0x34')]);if(_0x38cb49['name']){delete _0x38cb49[_0x742d('0x35')];}_0x289bdc['status'](_0x55326c)[_0x742d('0x36')](_0x38cb49);};}exports[_0x742d('0x37')]=function(_0x7f91f4,_0x26d155){var _0x17c917={},_0x1c7415={},_0x195b2c={'count':0x0,'rows':[]};var _0x1043bf=_['map'](db[_0x742d('0x38')][_0x742d('0x39')],function(_0x10db2e){return{'name':_0x10db2e[_0x742d('0x3a')],'type':_0x10db2e[_0x742d('0x3b')][_0x742d('0x3c')]};});_0x1c7415[_0x742d('0x3d')]=_['map'](_0x1043bf,_0x742d('0x35'));_0x1c7415[_0x742d('0x3e')]=_[_0x742d('0x3f')](_0x7f91f4[_0x742d('0x3e')]);_0x1c7415[_0x742d('0x40')]=_['intersection'](_0x1c7415[_0x742d('0x3d')],_0x1c7415['query']);_0x17c917['attributes']=_[_0x742d('0x41')](_0x1c7415[_0x742d('0x3d')],qs[_0x742d('0x42')](_0x7f91f4[_0x742d('0x3e')][_0x742d('0x42')]));_0x17c917[_0x742d('0x43')]=_0x17c917[_0x742d('0x43')][_0x742d('0x44')]?_0x17c917[_0x742d('0x43')]:_0x1c7415[_0x742d('0x3d')];if(!_0x7f91f4[_0x742d('0x3e')][_0x742d('0x45')]('nolimit')){_0x17c917[_0x742d('0x2c')]=qs[_0x742d('0x2c')](_0x7f91f4['query'][_0x742d('0x2c')]);_0x17c917[_0x742d('0x2b')]=qs[_0x742d('0x2b')](_0x7f91f4['query'][_0x742d('0x2b')]);}_0x17c917['order']=qs[_0x742d('0x46')](_0x7f91f4['query'][_0x742d('0x46')]);_0x17c917['where']=qs[_0x742d('0x40')](_[_0x742d('0x47')](_0x7f91f4[_0x742d('0x3e')],_0x1c7415[_0x742d('0x40')]),_0x1043bf);if(_0x7f91f4[_0x742d('0x3e')]['filter']){_0x17c917['where']=_[_0x742d('0x48')](_0x17c917[_0x742d('0x49')],{'$or':_[_0x742d('0x4a')](_0x1043bf,function(_0x5669e4){if(_0x5669e4[_0x742d('0x3b')]!=='VIRTUAL'){var _0x18841c={};_0x18841c[_0x5669e4[_0x742d('0x35')]]={'$like':'%'+_0x7f91f4['query']['filter']+'%'};return _0x18841c;}})});}_0x17c917=_[_0x742d('0x48')]({},_0x17c917,_0x7f91f4[_0x742d('0x4b')]);var _0x542eed={'where':_0x17c917[_0x742d('0x49')]};return db[_0x742d('0x38')]['count'](_0x542eed)[_0x742d('0x32')](function(_0x510d16){_0x195b2c[_0x742d('0x4c')]=_0x510d16;if(_0x7f91f4[_0x742d('0x3e')][_0x742d('0x4d')]){_0x17c917[_0x742d('0x4e')]=[{'all':!![]}];}return db[_0x742d('0x38')][_0x742d('0x4f')](_0x17c917);})[_0x742d('0x32')](function(_0x4eee21){_0x195b2c[_0x742d('0x50')]=_0x4eee21;return _0x195b2c;})[_0x742d('0x32')](respondWithFilteredResult(_0x26d155,_0x17c917))[_0x742d('0x27')](handleError(_0x26d155,null));};exports[_0x742d('0x51')]=function(_0x25191a,_0x91a085){var _0x6ae093={'raw':![],'where':{'id':_0x25191a[_0x742d('0x52')]['id']}},_0xd3f12c={};_0xd3f12c[_0x742d('0x3d')]=_[_0x742d('0x3f')](db[_0x742d('0x38')][_0x742d('0x39')]);_0xd3f12c[_0x742d('0x3e')]=_[_0x742d('0x3f')](_0x25191a[_0x742d('0x3e')]);_0xd3f12c[_0x742d('0x40')]=_[_0x742d('0x41')](_0xd3f12c['model'],_0xd3f12c[_0x742d('0x3e')]);_0x6ae093[_0x742d('0x43')]=_['intersection'](_0xd3f12c[_0x742d('0x3d')],qs[_0x742d('0x42')](_0x25191a[_0x742d('0x3e')]['fields']));_0x6ae093[_0x742d('0x43')]=_0x6ae093[_0x742d('0x43')][_0x742d('0x44')]?_0x6ae093[_0x742d('0x43')]:_0xd3f12c['model'];if(_0x25191a['query']['includeAll']){_0x6ae093['include']=[{'all':!![]}];}_0x6ae093=_[_0x742d('0x48')]({},_0x6ae093,_0x25191a[_0x742d('0x4b')]);return db[_0x742d('0x38')][_0x742d('0x53')](_0x6ae093)[_0x742d('0x32')](handleEntityNotFound(_0x91a085,null))[_0x742d('0x32')](respondWithResult(_0x91a085,null))[_0x742d('0x27')](handleError(_0x91a085,null));};exports['create']=function(_0x17ce5e,_0x3c5f3f){return db[_0x742d('0x38')][_0x742d('0x54')](_0x17ce5e[_0x742d('0x55')],{})[_0x742d('0x32')](respondWithResult(_0x3c5f3f,0xc9))['catch'](handleError(_0x3c5f3f,null));};exports[_0x742d('0x30')]=function(_0xf97cd7,_0x1d3c58){if(_0xf97cd7[_0x742d('0x55')]['id']){delete _0xf97cd7[_0x742d('0x55')]['id'];}return db['VtigerConfiguration'][_0x742d('0x53')]({'where':{'id':_0xf97cd7[_0x742d('0x52')]['id']}})[_0x742d('0x32')](handleEntityNotFound(_0x1d3c58,null))[_0x742d('0x32')](saveUpdates(_0xf97cd7['body'],null))['then'](respondWithResult(_0x1d3c58,null))['catch'](handleError(_0x1d3c58,null));};exports[_0x742d('0x31')]=function(_0x47bbef,_0x4bc96c){return db['VtigerConfiguration'][_0x742d('0x53')]({'where':{'id':_0x47bbef['params']['id']}})[_0x742d('0x32')](handleEntityNotFound(_0x4bc96c,null))[_0x742d('0x32')](removeEntity(_0x4bc96c,null))[_0x742d('0x27')](handleError(_0x4bc96c,null));};exports[_0x742d('0x56')]=function(_0xd142c0,_0x425f8a,_0x137161){var _0xad5d94={};var _0x4ebcad={};var _0x87ec40;var _0x203d47;return db[_0x742d('0x38')][_0x742d('0x57')]({'where':{'id':_0xd142c0['params']['id']}})[_0x742d('0x32')](handleEntityNotFound(_0x425f8a,null))[_0x742d('0x32')](function(_0x9af4f3){if(_0x9af4f3){_0x87ec40=_0x9af4f3;_0x4ebcad['model']=_[_0x742d('0x3f')](db['VtigerField']['rawAttributes']);_0x4ebcad[_0x742d('0x3e')]=_[_0x742d('0x3f')](_0xd142c0[_0x742d('0x3e')]);_0x4ebcad['filters']=_[_0x742d('0x41')](_0x4ebcad[_0x742d('0x3d')],_0x4ebcad[_0x742d('0x3e')]);_0xad5d94[_0x742d('0x43')]=_[_0x742d('0x41')](_0x4ebcad[_0x742d('0x3d')],qs[_0x742d('0x42')](_0xd142c0['query'][_0x742d('0x42')]));_0xad5d94[_0x742d('0x43')]=_0xad5d94[_0x742d('0x43')][_0x742d('0x44')]?_0xad5d94['attributes']:_0x4ebcad[_0x742d('0x3d')];_0xad5d94[_0x742d('0x58')]=qs[_0x742d('0x46')](_0xd142c0[_0x742d('0x3e')]['sort']);_0xad5d94[_0x742d('0x49')]=qs[_0x742d('0x40')](_['pick'](_0xd142c0[_0x742d('0x3e')],_0x4ebcad[_0x742d('0x40')]));if(_0xd142c0[_0x742d('0x3e')][_0x742d('0x59')]){_0xad5d94[_0x742d('0x49')]=_[_0x742d('0x48')](_0xad5d94[_0x742d('0x49')],{'$or':_['map'](_0xad5d94[_0x742d('0x43')],function(_0x6c866){var _0x2d0f82={};_0x2d0f82[_0x6c866]={'$like':'%'+_0xd142c0[_0x742d('0x3e')][_0x742d('0x59')]+'%'};return _0x2d0f82;})});}_0xad5d94=_[_0x742d('0x48')]({},_0xad5d94,_0xd142c0['options']);return _0x87ec40[_0x742d('0x56')](_0xad5d94);}})[_0x742d('0x32')](function(_0xa3f2e6){if(_0xa3f2e6){_0x203d47=_0xa3f2e6['length'];if(!_0xd142c0[_0x742d('0x3e')][_0x742d('0x45')](_0x742d('0x5a'))){_0xad5d94[_0x742d('0x2c')]=qs[_0x742d('0x2c')](_0xd142c0[_0x742d('0x3e')]['limit']);_0xad5d94['offset']=qs[_0x742d('0x2b')](_0xd142c0[_0x742d('0x3e')][_0x742d('0x2b')]);}return _0x87ec40[_0x742d('0x56')](_0xad5d94);}})[_0x742d('0x32')](function(_0x2af72f){if(_0x2af72f){return _0x2af72f?{'count':_0x203d47,'rows':_0x2af72f}:null;}})[_0x742d('0x32')](respondWithResult(_0x425f8a,null))[_0x742d('0x27')](handleError(_0x425f8a,null));};exports[_0x742d('0x5b')]=function(_0x475a5a,_0x1db062,_0x3300b7){var _0x3923e2={};var _0x1421cd={};var _0x375755;var _0x311167;return db['VtigerConfiguration'][_0x742d('0x57')]({'where':{'id':_0x475a5a[_0x742d('0x52')]['id']}})[_0x742d('0x32')](handleEntityNotFound(_0x1db062,null))[_0x742d('0x32')](function(_0x3623c1){if(_0x3623c1){_0x375755=_0x3623c1;_0x1421cd['model']=_['keys'](db['VtigerField']['rawAttributes']);_0x1421cd['query']=_[_0x742d('0x3f')](_0x475a5a[_0x742d('0x3e')]);_0x1421cd['filters']=_[_0x742d('0x41')](_0x1421cd[_0x742d('0x3d')],_0x1421cd[_0x742d('0x3e')]);_0x3923e2[_0x742d('0x43')]=_[_0x742d('0x41')](_0x1421cd[_0x742d('0x3d')],qs[_0x742d('0x42')](_0x475a5a[_0x742d('0x3e')][_0x742d('0x42')]));_0x3923e2[_0x742d('0x43')]=_0x3923e2[_0x742d('0x43')][_0x742d('0x44')]?_0x3923e2[_0x742d('0x43')]:_0x1421cd[_0x742d('0x3d')];_0x3923e2[_0x742d('0x58')]=qs['sort'](_0x475a5a['query'][_0x742d('0x46')]);_0x3923e2[_0x742d('0x49')]=qs['filters'](_[_0x742d('0x47')](_0x475a5a[_0x742d('0x3e')],_0x1421cd['filters']));if(_0x475a5a['query'][_0x742d('0x59')]){_0x3923e2['where']=_[_0x742d('0x48')](_0x3923e2['where'],{'$or':_['map'](_0x3923e2[_0x742d('0x43')],function(_0x39e25f){var _0x48169f={};_0x48169f[_0x39e25f]={'$like':'%'+_0x475a5a[_0x742d('0x3e')][_0x742d('0x59')]+'%'};return _0x48169f;})});}_0x3923e2=_[_0x742d('0x48')]({},_0x3923e2,_0x475a5a[_0x742d('0x4b')]);return _0x375755[_0x742d('0x5b')](_0x3923e2);}})[_0x742d('0x32')](function(_0x50a15c){if(_0x50a15c){_0x311167=_0x50a15c[_0x742d('0x44')];if(!_0x475a5a[_0x742d('0x3e')][_0x742d('0x45')](_0x742d('0x5a'))){_0x3923e2[_0x742d('0x2c')]=qs[_0x742d('0x2c')](_0x475a5a[_0x742d('0x3e')]['limit']);_0x3923e2[_0x742d('0x2b')]=qs['offset'](_0x475a5a[_0x742d('0x3e')][_0x742d('0x2b')]);}return _0x375755[_0x742d('0x5b')](_0x3923e2);}})[_0x742d('0x32')](function(_0x2b7c42){if(_0x2b7c42){return _0x2b7c42?{'count':_0x311167,'rows':_0x2b7c42}:null;}})[_0x742d('0x32')](respondWithResult(_0x1db062,null))[_0x742d('0x27')](handleError(_0x1db062,null));};exports['getDescriptions']=function(_0x493084,_0x27b9e3,_0x4da6e4){var _0x288b95={};var _0x5e6ec5={};var _0x2d20a5;var _0x51f88b;return db[_0x742d('0x38')]['findOne']({'where':{'id':_0x493084[_0x742d('0x52')]['id']}})[_0x742d('0x32')](handleEntityNotFound(_0x27b9e3,null))['then'](function(_0x288c20){if(_0x288c20){_0x2d20a5=_0x288c20;_0x5e6ec5['model']=_[_0x742d('0x3f')](db[_0x742d('0x5c')]['rawAttributes']);_0x5e6ec5[_0x742d('0x3e')]=_['keys'](_0x493084[_0x742d('0x3e')]);_0x5e6ec5['filters']=_[_0x742d('0x41')](_0x5e6ec5[_0x742d('0x3d')],_0x5e6ec5[_0x742d('0x3e')]);_0x288b95[_0x742d('0x43')]=_['intersection'](_0x5e6ec5[_0x742d('0x3d')],qs[_0x742d('0x42')](_0x493084[_0x742d('0x3e')][_0x742d('0x42')]));_0x288b95['attributes']=_0x288b95[_0x742d('0x43')][_0x742d('0x44')]?_0x288b95[_0x742d('0x43')]:_0x5e6ec5[_0x742d('0x3d')];_0x288b95[_0x742d('0x58')]=qs['sort'](_0x493084['query'][_0x742d('0x46')]);_0x288b95[_0x742d('0x49')]=qs[_0x742d('0x40')](_[_0x742d('0x47')](_0x493084['query'],_0x5e6ec5[_0x742d('0x40')]));if(_0x493084[_0x742d('0x3e')]['filter']){_0x288b95[_0x742d('0x49')]=_['merge'](_0x288b95[_0x742d('0x49')],{'$or':_[_0x742d('0x4a')](_0x288b95[_0x742d('0x43')],function(_0x56f03a){var _0x4acfe8={};_0x4acfe8[_0x56f03a]={'$like':'%'+_0x493084[_0x742d('0x3e')][_0x742d('0x59')]+'%'};return _0x4acfe8;})});}_0x288b95=_['merge']({},_0x288b95,_0x493084[_0x742d('0x4b')]);return _0x2d20a5[_0x742d('0x5d')](_0x288b95);}})[_0x742d('0x32')](function(_0x5df8b5){if(_0x5df8b5){_0x51f88b=_0x5df8b5[_0x742d('0x44')];if(!_0x493084[_0x742d('0x3e')][_0x742d('0x45')](_0x742d('0x5a'))){_0x288b95['limit']=qs[_0x742d('0x2c')](_0x493084[_0x742d('0x3e')][_0x742d('0x2c')]);_0x288b95[_0x742d('0x2b')]=qs[_0x742d('0x2b')](_0x493084[_0x742d('0x3e')]['offset']);}return _0x2d20a5['getDescriptions'](_0x288b95);}})[_0x742d('0x32')](function(_0x3ec746){if(_0x3ec746){return _0x3ec746?{'count':_0x51f88b,'rows':_0x3ec746}:null;}})[_0x742d('0x32')](respondWithResult(_0x27b9e3,null))[_0x742d('0x27')](handleError(_0x27b9e3,null));}; \ No newline at end of file +var _0x0e9c=['findOne','sort','VtigerField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','apply','save','update','destroy','stack','name','send','index','VtigerConfiguration','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','rawAttributes','create','body','find','params','getFields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e9c,0x1d6));var _0xc0e9=function(_0x16b186,_0x3fec23){_0x16b186=_0x16b186-0x0;var _0x33b499=_0x0e9c[_0x16b186];return _0x33b499;};'use strict';var pdf=require(_0xc0e9('0x0'));var emlformat=require(_0xc0e9('0x1'));var rimraf=require(_0xc0e9('0x2'));var zipdir=require(_0xc0e9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc0e9('0x4'));var BPromise=require(_0xc0e9('0x5'));var Mustache=require('mustache');var util=require(_0xc0e9('0x6'));var path=require('path');var sox=require(_0xc0e9('0x7'));var csv=require(_0xc0e9('0x8'));var ejs=require(_0xc0e9('0x9'));var fs=require('fs');var _=require(_0xc0e9('0xa'));var squel=require(_0xc0e9('0xb'));var crypto=require(_0xc0e9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc0e9('0xd'));var toCsv=require(_0xc0e9('0x8'));var querystring=require(_0xc0e9('0xe'));var Papa=require(_0xc0e9('0xf'));var Redis=require(_0xc0e9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc0e9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0e9('0x12'))(_0xc0e9('0x13'));var utils=require('../../config/utils');var config=require(_0xc0e9('0x14'));var db=require(_0xc0e9('0x15'))['db'];var jayson=require(_0xc0e9('0x16'));var client=jayson[_0xc0e9('0x17')][_0xc0e9('0x18')]({'port':0x232a});function checkPasswordPattern(_0x3eae20,_0x48619b,_0x58a864){if(_0x58a864){var _0x24a687=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24a687[_0xc0e9('0x19')](_0x48619b)){return _0x3eae20;}else{throw new db['Sequelize'][(_0xc0e9('0x1a'))](_0xc0e9('0x1b'));}}else{return _0x3eae20;}}function respondWithRpcPromise(_0x4df7d9,_0x2a93a8,_0x43af6e,_0x409970){return new BPromise(function(_0x4a5a4c,_0x467c5b){var _0x3d9d4f=_0x409970||client;return _0x3d9d4f['request'](_0x4df7d9,_0x43af6e)[_0xc0e9('0x1c')](function(_0x170d15){logger[_0xc0e9('0x1d')](_0xc0e9('0x1e'),_0x2a93a8,'request\x20sent');logger[_0xc0e9('0x1f')](_0xc0e9('0x20'),_0x2a93a8,_0xc0e9('0x21'),JSON[_0xc0e9('0x22')](_0x170d15));if(_0x170d15[_0xc0e9('0x23')]){if(_0x170d15[_0xc0e9('0x23')][_0xc0e9('0x24')]===0x1f4){logger['error'](_0xc0e9('0x1e'),_0x2a93a8,_0x170d15['error'][_0xc0e9('0x25')]);return _0x467c5b(_0x170d15[_0xc0e9('0x23')][_0xc0e9('0x25')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2a93a8,_0x170d15['error'][_0xc0e9('0x25')]);return _0x4a5a4c(_0x170d15[_0xc0e9('0x23')]['message']);}else{logger[_0xc0e9('0x1d')](_0xc0e9('0x1e'),_0x2a93a8,_0xc0e9('0x21'));_0x4a5a4c(_0x170d15[_0xc0e9('0x26')]['message']);}})[_0xc0e9('0x27')](function(_0x4df7e8){logger[_0xc0e9('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x2a93a8,_0x4df7e8);_0x467c5b(_0x4df7e8);});});}function respondWithStatusCode(_0x500ae4,_0x358fe2){_0x358fe2=_0x358fe2||0xcc;return function(_0x1b6f44){if(_0x1b6f44){return _0x500ae4[_0xc0e9('0x28')](_0x358fe2);}return _0x500ae4['status'](_0x358fe2)['end']();};}function respondWithResult(_0x2997d0,_0xc9cb9d){_0xc9cb9d=_0xc9cb9d||0xc8;return function(_0x177dd8){if(_0x177dd8){return _0x2997d0[_0xc0e9('0x29')](_0xc9cb9d)[_0xc0e9('0x2a')](_0x177dd8);}};}function respondWithFilteredResult(_0x1c3ae6,_0x596a73){return function(_0x2e0f05){if(_0x2e0f05){var _0x3e526e=_0x2e0f05[_0xc0e9('0x2b')],_0x22836e=_0x596a73[_0xc0e9('0x2c')],_0x27efe6=_0x596a73[_0xc0e9('0x2c')]+_0x596a73['limit'],_0x504b1d;if(_0x27efe6>=_0x3e526e){_0x27efe6=_0x3e526e;_0x504b1d=0xc8;}else{_0x504b1d=0xce;}_0x1c3ae6['status'](_0x504b1d);return _0x1c3ae6[_0xc0e9('0x2d')]('Content-Range',_0x22836e+'-'+_0x27efe6+'/'+_0x3e526e)[_0xc0e9('0x2a')](_0x2e0f05);}return null;};}function patchUpdates(_0x45bb91){return function(_0x4616fe){try{jsonpatch[_0xc0e9('0x2e')](_0x4616fe,_0x45bb91,!![]);}catch(_0x95f267){return BPromise['reject'](_0x95f267);}return _0x4616fe[_0xc0e9('0x2f')]();};}function saveUpdates(_0x5e250e,_0x5de228){return function(_0x442db5){if(_0x442db5){return _0x442db5[_0xc0e9('0x30')](_0x5e250e)['then'](function(_0x3c99d3){return _0x3c99d3;});}return null;};}function removeEntity(_0xd9a394,_0x1ef399){return function(_0x28aca3){if(_0x28aca3){return _0x28aca3[_0xc0e9('0x31')]()[_0xc0e9('0x1c')](function(){_0xd9a394[_0xc0e9('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a9ce,_0x29357c){return function(_0x40fba1){if(!_0x40fba1){_0x55a9ce[_0xc0e9('0x28')](0x194);}return _0x40fba1;};}function handleError(_0x99a447,_0x2f1205){_0x2f1205=_0x2f1205||0x1f4;return function(_0x5c104a){logger['error'](_0x5c104a[_0xc0e9('0x32')]);if(_0x5c104a[_0xc0e9('0x33')]){delete _0x5c104a['name'];}_0x99a447[_0xc0e9('0x29')](_0x2f1205)[_0xc0e9('0x34')](_0x5c104a);};}exports[_0xc0e9('0x35')]=function(_0x50937b,_0x2862ac){var _0xfd419e={},_0x31266a={},_0x4aff93={'count':0x0,'rows':[]};var _0xab6066=_['map'](db[_0xc0e9('0x36')]['rawAttributes'],function(_0x264312){return{'name':_0x264312[_0xc0e9('0x37')],'type':_0x264312[_0xc0e9('0x38')][_0xc0e9('0x39')]};});_0x31266a['model']=_[_0xc0e9('0x3a')](_0xab6066,_0xc0e9('0x33'));_0x31266a[_0xc0e9('0x3b')]=_[_0xc0e9('0x3c')](_0x50937b[_0xc0e9('0x3b')]);_0x31266a['filters']=_[_0xc0e9('0x3d')](_0x31266a[_0xc0e9('0x3e')],_0x31266a[_0xc0e9('0x3b')]);_0xfd419e[_0xc0e9('0x3f')]=_[_0xc0e9('0x3d')](_0x31266a[_0xc0e9('0x3e')],qs[_0xc0e9('0x40')](_0x50937b[_0xc0e9('0x3b')][_0xc0e9('0x40')]));_0xfd419e[_0xc0e9('0x3f')]=_0xfd419e['attributes'][_0xc0e9('0x41')]?_0xfd419e[_0xc0e9('0x3f')]:_0x31266a[_0xc0e9('0x3e')];if(!_0x50937b[_0xc0e9('0x3b')][_0xc0e9('0x42')](_0xc0e9('0x43'))){_0xfd419e['limit']=qs[_0xc0e9('0x44')](_0x50937b['query'][_0xc0e9('0x44')]);_0xfd419e[_0xc0e9('0x2c')]=qs['offset'](_0x50937b['query']['offset']);}_0xfd419e[_0xc0e9('0x45')]=qs['sort'](_0x50937b[_0xc0e9('0x3b')]['sort']);_0xfd419e[_0xc0e9('0x46')]=qs[_0xc0e9('0x47')](_[_0xc0e9('0x48')](_0x50937b[_0xc0e9('0x3b')],_0x31266a[_0xc0e9('0x47')]),_0xab6066);if(_0x50937b[_0xc0e9('0x3b')][_0xc0e9('0x49')]){_0xfd419e[_0xc0e9('0x46')]=_['merge'](_0xfd419e['where'],{'$or':_[_0xc0e9('0x3a')](_0xab6066,function(_0x5d6167){if(_0x5d6167[_0xc0e9('0x38')]!==_0xc0e9('0x4a')){var _0x2b5c00={};_0x2b5c00[_0x5d6167[_0xc0e9('0x33')]]={'$like':'%'+_0x50937b[_0xc0e9('0x3b')][_0xc0e9('0x49')]+'%'};return _0x2b5c00;}})});}_0xfd419e=_[_0xc0e9('0x4b')]({},_0xfd419e,_0x50937b[_0xc0e9('0x4c')]);var _0x51c8ce={'where':_0xfd419e['where']};return db[_0xc0e9('0x36')]['count'](_0x51c8ce)['then'](function(_0x576ce5){_0x4aff93[_0xc0e9('0x2b')]=_0x576ce5;if(_0x50937b[_0xc0e9('0x3b')][_0xc0e9('0x4d')]){_0xfd419e[_0xc0e9('0x4e')]=[{'all':!![]}];}return db[_0xc0e9('0x36')][_0xc0e9('0x4f')](_0xfd419e);})[_0xc0e9('0x1c')](function(_0x189a23){_0x4aff93[_0xc0e9('0x50')]=_0x189a23;return _0x4aff93;})['then'](respondWithFilteredResult(_0x2862ac,_0xfd419e))[_0xc0e9('0x27')](handleError(_0x2862ac,null));};exports[_0xc0e9('0x51')]=function(_0x178281,_0x5674be){var _0x339639={'raw':![],'where':{'id':_0x178281['params']['id']}},_0x10650e={};_0x10650e[_0xc0e9('0x3e')]=_['keys'](db[_0xc0e9('0x36')][_0xc0e9('0x52')]);_0x10650e[_0xc0e9('0x3b')]=_[_0xc0e9('0x3c')](_0x178281[_0xc0e9('0x3b')]);_0x10650e[_0xc0e9('0x47')]=_[_0xc0e9('0x3d')](_0x10650e[_0xc0e9('0x3e')],_0x10650e['query']);_0x339639['attributes']=_[_0xc0e9('0x3d')](_0x10650e[_0xc0e9('0x3e')],qs[_0xc0e9('0x40')](_0x178281[_0xc0e9('0x3b')]['fields']));_0x339639[_0xc0e9('0x3f')]=_0x339639[_0xc0e9('0x3f')]['length']?_0x339639[_0xc0e9('0x3f')]:_0x10650e[_0xc0e9('0x3e')];if(_0x178281[_0xc0e9('0x3b')][_0xc0e9('0x4d')]){_0x339639[_0xc0e9('0x4e')]=[{'all':!![]}];}_0x339639=_[_0xc0e9('0x4b')]({},_0x339639,_0x178281[_0xc0e9('0x4c')]);return db['VtigerConfiguration']['find'](_0x339639)['then'](handleEntityNotFound(_0x5674be,null))[_0xc0e9('0x1c')](respondWithResult(_0x5674be,null))[_0xc0e9('0x27')](handleError(_0x5674be,null));};exports[_0xc0e9('0x53')]=function(_0x1ff0a8,_0x5f0125){return db[_0xc0e9('0x36')]['create'](_0x1ff0a8[_0xc0e9('0x54')],{})['then'](respondWithResult(_0x5f0125,0xc9))['catch'](handleError(_0x5f0125,null));};exports[_0xc0e9('0x30')]=function(_0x41f2ad,_0x876cc8){if(_0x41f2ad[_0xc0e9('0x54')]['id']){delete _0x41f2ad[_0xc0e9('0x54')]['id'];}return db['VtigerConfiguration'][_0xc0e9('0x55')]({'where':{'id':_0x41f2ad[_0xc0e9('0x56')]['id']}})['then'](handleEntityNotFound(_0x876cc8,null))[_0xc0e9('0x1c')](saveUpdates(_0x41f2ad[_0xc0e9('0x54')],null))[_0xc0e9('0x1c')](respondWithResult(_0x876cc8,null))[_0xc0e9('0x27')](handleError(_0x876cc8,null));};exports[_0xc0e9('0x31')]=function(_0x258ffc,_0x30269e){return db['VtigerConfiguration'][_0xc0e9('0x55')]({'where':{'id':_0x258ffc[_0xc0e9('0x56')]['id']}})[_0xc0e9('0x1c')](handleEntityNotFound(_0x30269e,null))[_0xc0e9('0x1c')](removeEntity(_0x30269e,null))[_0xc0e9('0x27')](handleError(_0x30269e,null));};exports[_0xc0e9('0x57')]=function(_0x5d1997,_0xa86c4f,_0x5201a7){var _0x66e3d3={};var _0xc4a720={};var _0x5c60f2;var _0x3619db;return db[_0xc0e9('0x36')][_0xc0e9('0x58')]({'where':{'id':_0x5d1997['params']['id']}})['then'](handleEntityNotFound(_0xa86c4f,null))[_0xc0e9('0x1c')](function(_0x51897e){if(_0x51897e){_0x5c60f2=_0x51897e;_0xc4a720['model']=_[_0xc0e9('0x3c')](db['VtigerField'][_0xc0e9('0x52')]);_0xc4a720[_0xc0e9('0x3b')]=_[_0xc0e9('0x3c')](_0x5d1997[_0xc0e9('0x3b')]);_0xc4a720[_0xc0e9('0x47')]=_[_0xc0e9('0x3d')](_0xc4a720['model'],_0xc4a720[_0xc0e9('0x3b')]);_0x66e3d3[_0xc0e9('0x3f')]=_[_0xc0e9('0x3d')](_0xc4a720[_0xc0e9('0x3e')],qs[_0xc0e9('0x40')](_0x5d1997['query'][_0xc0e9('0x40')]));_0x66e3d3['attributes']=_0x66e3d3[_0xc0e9('0x3f')][_0xc0e9('0x41')]?_0x66e3d3[_0xc0e9('0x3f')]:_0xc4a720[_0xc0e9('0x3e')];_0x66e3d3['order']=qs['sort'](_0x5d1997[_0xc0e9('0x3b')][_0xc0e9('0x59')]);_0x66e3d3[_0xc0e9('0x46')]=qs[_0xc0e9('0x47')](_[_0xc0e9('0x48')](_0x5d1997['query'],_0xc4a720[_0xc0e9('0x47')]));if(_0x5d1997[_0xc0e9('0x3b')][_0xc0e9('0x49')]){_0x66e3d3[_0xc0e9('0x46')]=_[_0xc0e9('0x4b')](_0x66e3d3[_0xc0e9('0x46')],{'$or':_[_0xc0e9('0x3a')](_0x66e3d3['attributes'],function(_0x1657e5){var _0x37d067={};_0x37d067[_0x1657e5]={'$like':'%'+_0x5d1997[_0xc0e9('0x3b')]['filter']+'%'};return _0x37d067;})});}_0x66e3d3=_[_0xc0e9('0x4b')]({},_0x66e3d3,_0x5d1997[_0xc0e9('0x4c')]);return _0x5c60f2[_0xc0e9('0x57')](_0x66e3d3);}})[_0xc0e9('0x1c')](function(_0x49f923){if(_0x49f923){_0x3619db=_0x49f923[_0xc0e9('0x41')];if(!_0x5d1997[_0xc0e9('0x3b')][_0xc0e9('0x42')](_0xc0e9('0x43'))){_0x66e3d3[_0xc0e9('0x44')]=qs[_0xc0e9('0x44')](_0x5d1997[_0xc0e9('0x3b')][_0xc0e9('0x44')]);_0x66e3d3[_0xc0e9('0x2c')]=qs[_0xc0e9('0x2c')](_0x5d1997[_0xc0e9('0x3b')]['offset']);}return _0x5c60f2[_0xc0e9('0x57')](_0x66e3d3);}})['then'](function(_0x232b3c){if(_0x232b3c){return _0x232b3c?{'count':_0x3619db,'rows':_0x232b3c}:null;}})[_0xc0e9('0x1c')](respondWithResult(_0xa86c4f,null))[_0xc0e9('0x27')](handleError(_0xa86c4f,null));};exports['getSubjects']=function(_0x8a69e4,_0x1f10d6,_0x919cb6){var _0x2e04bc={};var _0x4ee48c={};var _0x353d11;var _0x75a2b1;return db[_0xc0e9('0x36')][_0xc0e9('0x58')]({'where':{'id':_0x8a69e4[_0xc0e9('0x56')]['id']}})[_0xc0e9('0x1c')](handleEntityNotFound(_0x1f10d6,null))[_0xc0e9('0x1c')](function(_0x134f08){if(_0x134f08){_0x353d11=_0x134f08;_0x4ee48c['model']=_[_0xc0e9('0x3c')](db[_0xc0e9('0x5a')][_0xc0e9('0x52')]);_0x4ee48c[_0xc0e9('0x3b')]=_[_0xc0e9('0x3c')](_0x8a69e4['query']);_0x4ee48c['filters']=_[_0xc0e9('0x3d')](_0x4ee48c[_0xc0e9('0x3e')],_0x4ee48c[_0xc0e9('0x3b')]);_0x2e04bc[_0xc0e9('0x3f')]=_[_0xc0e9('0x3d')](_0x4ee48c['model'],qs[_0xc0e9('0x40')](_0x8a69e4[_0xc0e9('0x3b')][_0xc0e9('0x40')]));_0x2e04bc[_0xc0e9('0x3f')]=_0x2e04bc[_0xc0e9('0x3f')][_0xc0e9('0x41')]?_0x2e04bc[_0xc0e9('0x3f')]:_0x4ee48c[_0xc0e9('0x3e')];_0x2e04bc[_0xc0e9('0x45')]=qs[_0xc0e9('0x59')](_0x8a69e4[_0xc0e9('0x3b')][_0xc0e9('0x59')]);_0x2e04bc[_0xc0e9('0x46')]=qs[_0xc0e9('0x47')](_['pick'](_0x8a69e4[_0xc0e9('0x3b')],_0x4ee48c['filters']));if(_0x8a69e4[_0xc0e9('0x3b')][_0xc0e9('0x49')]){_0x2e04bc[_0xc0e9('0x46')]=_[_0xc0e9('0x4b')](_0x2e04bc['where'],{'$or':_[_0xc0e9('0x3a')](_0x2e04bc[_0xc0e9('0x3f')],function(_0x4aba6e){var _0x51c751={};_0x51c751[_0x4aba6e]={'$like':'%'+_0x8a69e4[_0xc0e9('0x3b')]['filter']+'%'};return _0x51c751;})});}_0x2e04bc=_[_0xc0e9('0x4b')]({},_0x2e04bc,_0x8a69e4['options']);return _0x353d11['getSubjects'](_0x2e04bc);}})[_0xc0e9('0x1c')](function(_0x3aa7af){if(_0x3aa7af){_0x75a2b1=_0x3aa7af['length'];if(!_0x8a69e4['query']['hasOwnProperty'](_0xc0e9('0x43'))){_0x2e04bc[_0xc0e9('0x44')]=qs['limit'](_0x8a69e4[_0xc0e9('0x3b')]['limit']);_0x2e04bc['offset']=qs[_0xc0e9('0x2c')](_0x8a69e4[_0xc0e9('0x3b')]['offset']);}return _0x353d11[_0xc0e9('0x5b')](_0x2e04bc);}})[_0xc0e9('0x1c')](function(_0x5ccb14){if(_0x5ccb14){return _0x5ccb14?{'count':_0x75a2b1,'rows':_0x5ccb14}:null;}})[_0xc0e9('0x1c')](respondWithResult(_0x1f10d6,null))['catch'](handleError(_0x1f10d6,null));};exports['getDescriptions']=function(_0x594d10,_0x285c26,_0x5ab162){var _0x382c65={};var _0x3ca227={};var _0x1be33e;var _0x3f36d2;return db['VtigerConfiguration'][_0xc0e9('0x58')]({'where':{'id':_0x594d10[_0xc0e9('0x56')]['id']}})['then'](handleEntityNotFound(_0x285c26,null))[_0xc0e9('0x1c')](function(_0x9851a9){if(_0x9851a9){_0x1be33e=_0x9851a9;_0x3ca227['model']=_['keys'](db['VtigerField'][_0xc0e9('0x52')]);_0x3ca227[_0xc0e9('0x3b')]=_[_0xc0e9('0x3c')](_0x594d10[_0xc0e9('0x3b')]);_0x3ca227['filters']=_['intersection'](_0x3ca227[_0xc0e9('0x3e')],_0x3ca227['query']);_0x382c65[_0xc0e9('0x3f')]=_['intersection'](_0x3ca227['model'],qs['fields'](_0x594d10[_0xc0e9('0x3b')][_0xc0e9('0x40')]));_0x382c65[_0xc0e9('0x3f')]=_0x382c65[_0xc0e9('0x3f')]['length']?_0x382c65[_0xc0e9('0x3f')]:_0x3ca227[_0xc0e9('0x3e')];_0x382c65[_0xc0e9('0x45')]=qs['sort'](_0x594d10[_0xc0e9('0x3b')]['sort']);_0x382c65[_0xc0e9('0x46')]=qs[_0xc0e9('0x47')](_[_0xc0e9('0x48')](_0x594d10[_0xc0e9('0x3b')],_0x3ca227[_0xc0e9('0x47')]));if(_0x594d10['query']['filter']){_0x382c65[_0xc0e9('0x46')]=_[_0xc0e9('0x4b')](_0x382c65['where'],{'$or':_[_0xc0e9('0x3a')](_0x382c65['attributes'],function(_0x12b9b6){var _0x5f49c8={};_0x5f49c8[_0x12b9b6]={'$like':'%'+_0x594d10[_0xc0e9('0x3b')]['filter']+'%'};return _0x5f49c8;})});}_0x382c65=_[_0xc0e9('0x4b')]({},_0x382c65,_0x594d10['options']);return _0x1be33e[_0xc0e9('0x5c')](_0x382c65);}})[_0xc0e9('0x1c')](function(_0xe4f31b){if(_0xe4f31b){_0x3f36d2=_0xe4f31b['length'];if(!_0x594d10[_0xc0e9('0x3b')]['hasOwnProperty']('nolimit')){_0x382c65[_0xc0e9('0x44')]=qs['limit'](_0x594d10[_0xc0e9('0x3b')]['limit']);_0x382c65[_0xc0e9('0x2c')]=qs['offset'](_0x594d10[_0xc0e9('0x3b')][_0xc0e9('0x2c')]);}return _0x1be33e[_0xc0e9('0x5c')](_0x382c65);}})[_0xc0e9('0x1c')](function(_0x540a8a){if(_0x540a8a){return _0x540a8a?{'count':_0x3f36d2,'rows':_0x540a8a}:null;}})['then'](respondWithResult(_0x285c26,null))[_0xc0e9('0x27')](handleError(_0x285c26,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index dd00749..ae5815d 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 _0x1a20=['exports','define','int_vtiger_configurations','util','../../config/logger','moment','path','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x51e07d,_0x8466c8){var _0x5e9cbe=function(_0x387269){while(--_0x387269){_0x51e07d['push'](_0x51e07d['shift']());}};_0x5e9cbe(++_0x8466c8);}(_0x1a20,0x111));var _0x01a2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1a20[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x01a2('0x0'));var logger=require(_0x01a2('0x1'))('api');var moment=require(_0x01a2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x01a2('0x3'));var rimraf=require('rimraf');var config=require(_0x01a2('0x4'));var attributes=require(_0x01a2('0x5'));module[_0x01a2('0x6')]=function(_0x4a1917,_0x2211ba){return _0x4a1917[_0x01a2('0x7')]('VtigerConfiguration',attributes,{'tableName':_0x01a2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9455=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','util','../../config/logger','api','moment'];(function(_0x572644,_0x543d79){var _0x17efa9=function(_0x1db802){while(--_0x1db802){_0x572644['push'](_0x572644['shift']());}};_0x17efa9(++_0x543d79);}(_0x9455,0xcd));var _0x5945=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9455[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x5945('0x0'));var logger=require(_0x5945('0x1'))(_0x5945('0x2'));var moment=require(_0x5945('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5945('0x4'));var rimraf=require(_0x5945('0x5'));var config=require(_0x5945('0x6'));var attributes=require(_0x5945('0x7'));module[_0x5945('0x8')]=function(_0x273fcf,_0x53421){return _0x273fcf[_0x5945('0x9')](_0x5945('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 72a64ca..a3754ed 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 _0xc1a0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xc1a0,0x1a1));var _0x0c1a=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xc1a0[_0x22e47a];return _0x15a12a;};'use strict';var _=require(_0x0c1a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c1a('0x1'));var fs=require('fs');var Redis=require(_0x0c1a('0x2'));var db=require(_0x0c1a('0x3'))['db'];var utils=require(_0x0c1a('0x4'));var logger=require(_0x0c1a('0x5'))('rpc');var config=require(_0x0c1a('0x6'));var jayson=require(_0x0c1a('0x7'));var client=jayson[_0x0c1a('0x8')][_0x0c1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dc884,_0x2d00b9,_0xf0f186){return new BPromise(function(_0x3acb2b,_0x3f1df3){return client[_0x0c1a('0xa')](_0x1dc884,_0xf0f186)[_0x0c1a('0xb')](function(_0x1fcfb7){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x2d00b9,_0x0c1a('0xc'));logger['debug'](_0x0c1a('0xd'),_0x2d00b9,'request\x20sent',JSON[_0x0c1a('0xe')](_0x1fcfb7));if(_0x1fcfb7[_0x0c1a('0xf')]){if(_0x1fcfb7[_0x0c1a('0xf')][_0x0c1a('0x10')]===0x1f4){logger[_0x0c1a('0xf')](_0x0c1a('0x11'),_0x2d00b9,_0x1fcfb7[_0x0c1a('0xf')][_0x0c1a('0x12')]);return _0x3f1df3(_0x1fcfb7[_0x0c1a('0xf')][_0x0c1a('0x12')]);}logger[_0x0c1a('0xf')](_0x0c1a('0x11'),_0x2d00b9,_0x1fcfb7[_0x0c1a('0xf')][_0x0c1a('0x12')]);return _0x3acb2b(_0x1fcfb7[_0x0c1a('0xf')][_0x0c1a('0x12')]);}else{logger[_0x0c1a('0x13')](_0x0c1a('0x11'),_0x2d00b9,_0x0c1a('0xc'));_0x3acb2b(_0x1fcfb7[_0x0c1a('0x14')][_0x0c1a('0x12')]);}})[_0x0c1a('0x15')](function(_0xe824c2){logger[_0x0c1a('0xf')](_0x0c1a('0x11'),_0x2d00b9,_0xe824c2);_0x3f1df3(_0xe824c2);});});} \ No newline at end of file +var _0x3dee=['error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1440ce,_0x136aee){var _0x389c35=function(_0x73dfaf){while(--_0x73dfaf){_0x1440ce['push'](_0x1440ce['shift']());}};_0x389c35(++_0x136aee);}(_0x3dee,0x1be));var _0xe3de=function(_0x9953b,_0x30d48d){_0x9953b=_0x9953b-0x0;var _0x2fdee4=_0x3dee[_0x9953b];return _0x2fdee4;};'use strict';var _=require('lodash');var util=require(_0xe3de('0x0'));var moment=require('moment');var BPromise=require(_0xe3de('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3de('0x2'));var db=require(_0xe3de('0x3'))['db'];var utils=require(_0xe3de('0x4'));var logger=require(_0xe3de('0x5'))(_0xe3de('0x6'));var config=require(_0xe3de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe3de('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x318cb3,_0x56ab89,_0x5f4325){return new BPromise(function(_0x261192,_0x40f276){return client[_0xe3de('0x9')](_0x318cb3,_0x5f4325)[_0xe3de('0xa')](function(_0x377e22){logger[_0xe3de('0xb')](_0xe3de('0xc'),_0x56ab89,'request\x20sent');logger['debug'](_0xe3de('0xd'),_0x56ab89,_0xe3de('0xe'),JSON[_0xe3de('0xf')](_0x377e22));if(_0x377e22[_0xe3de('0x10')]){if(_0x377e22[_0xe3de('0x10')][_0xe3de('0x11')]===0x1f4){logger[_0xe3de('0x10')](_0xe3de('0xc'),_0x56ab89,_0x377e22[_0xe3de('0x10')][_0xe3de('0x12')]);return _0x40f276(_0x377e22[_0xe3de('0x10')][_0xe3de('0x12')]);}logger[_0xe3de('0x10')](_0xe3de('0xc'),_0x56ab89,_0x377e22[_0xe3de('0x10')][_0xe3de('0x12')]);return _0x261192(_0x377e22[_0xe3de('0x10')][_0xe3de('0x12')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x56ab89,_0xe3de('0xe'));_0x261192(_0x377e22[_0xe3de('0x13')][_0xe3de('0x12')]);}})[_0xe3de('0x14')](function(_0x2d4ed2){logger[_0xe3de('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x56ab89,_0x2d4ed2);_0x40f276(_0x2d4ed2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 880dfad..f0ac34c 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 _0xc7fe=['./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e658c,_0x4e681a){var _0x4f32ea=function(_0x5b5f91){while(--_0x5b5f91){_0x4e658c['push'](_0x4e658c['shift']());}};_0x4f32ea(++_0x4e681a);}(_0xc7fe,0x108));var _0xec7f=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xc7fe[_0x454018];return _0x24697d;};'use strict';var multer=require(_0xec7f('0x0'));var util=require(_0xec7f('0x1'));var path=require(_0xec7f('0x2'));var timeout=require(_0xec7f('0x3'));var express=require(_0xec7f('0x4'));var router=express[_0xec7f('0x5')]();var auth=require(_0xec7f('0x6'));var interaction=require(_0xec7f('0x7'));var config=require(_0xec7f('0x8'));var controller=require(_0xec7f('0x9'));router[_0xec7f('0xa')]('/',auth[_0xec7f('0xb')](),controller[_0xec7f('0xc')]);router[_0xec7f('0xa')](_0xec7f('0xd'),auth['isAuthenticated'](),controller[_0xec7f('0xe')]);router[_0xec7f('0xf')]('/',auth['isAuthenticated'](),controller[_0xec7f('0x10')]);router[_0xec7f('0x11')](_0xec7f('0xd'),auth[_0xec7f('0xb')](),controller[_0xec7f('0x12')]);router['delete'](_0xec7f('0xd'),auth[_0xec7f('0xb')](),controller[_0xec7f('0x13')]);module[_0xec7f('0x14')]=router; \ No newline at end of file +var _0x9aab=['create','/:id','update','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x9aab,0x127));var _0xb9aa=function(_0x2b8b90,_0x1a7e79){_0x2b8b90=_0x2b8b90-0x0;var _0x26b311=_0x9aab[_0x2b8b90];return _0x26b311;};'use strict';var multer=require(_0xb9aa('0x0'));var util=require(_0xb9aa('0x1'));var path=require(_0xb9aa('0x2'));var timeout=require(_0xb9aa('0x3'));var express=require(_0xb9aa('0x4'));var router=express[_0xb9aa('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9aa('0x6'));var config=require(_0xb9aa('0x7'));var controller=require(_0xb9aa('0x8'));router[_0xb9aa('0x9')]('/',auth['isAuthenticated'](),controller[_0xb9aa('0xa')]);router[_0xb9aa('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb9aa('0xb')]);router['put'](_0xb9aa('0xc'),auth['isAuthenticated'](),controller[_0xb9aa('0xd')]);router['delete']('/:id',auth[_0xb9aa('0xe')](),controller[_0xb9aa('0xf')]);module[_0xb9aa('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 f099916..9562772 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 _0x9a19=['customVariable','keyValue','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x9a19,0x114));var _0x99a1=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x9a19[_0x4bb145];return _0x4db596;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'type':{'type':Sequelize[_0x99a1('0x2')]('string',_0x99a1('0x3'),_0x99a1('0x4'),_0x99a1('0x5')),'defaultValue':_0x99a1('0x6')},'content':{'type':Sequelize[_0x99a1('0x7')]},'key':{'type':Sequelize[_0x99a1('0x7')]},'keyType':{'type':Sequelize[_0x99a1('0x2')](_0x99a1('0x6'),_0x99a1('0x3'),_0x99a1('0x4'))},'keyContent':{'type':Sequelize[_0x99a1('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x99a1('0x7')]}}; \ No newline at end of file +var _0xd04b=['variable','keyValue','string','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd04b,0x145));var _0xbd04=function(_0x126a33,_0x1ad3c5){_0x126a33=_0x126a33-0x0;var _0x21cadd=_0xd04b[_0x126a33];return _0x21cadd;};'use strict';var Sequelize=require(_0xbd04('0x0'));module[_0xbd04('0x1')]={'type':{'type':Sequelize[_0xbd04('0x2')]('string',_0xbd04('0x3'),'customVariable',_0xbd04('0x4')),'defaultValue':_0xbd04('0x5')},'content':{'type':Sequelize[_0xbd04('0x6')]},'key':{'type':Sequelize[_0xbd04('0x6')]},'keyType':{'type':Sequelize[_0xbd04('0x2')](_0xbd04('0x5'),_0xbd04('0x3'),_0xbd04('0x7'))},'keyContent':{'type':Sequelize[_0xbd04('0x6')]},'idField':{'type':Sequelize[_0xbd04('0x6')]},'nameField':{'type':Sequelize[_0xbd04('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd04('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3ea5b16..bc7dcaf 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 _0x0839=['rimraf','zip-dir','moment','bluebird','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','apply','reject','save','then','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','limit','sort','filter','merge','where','VIRTUAL','options','includeAll','VtigerField','findAll','rows','catch','show','params','keys','length','create','update','body','find','destroy','html-pdf','eml-format'];(function(_0x2bf1d6,_0x410efd){var _0x1be08a=function(_0x39c3a2){while(--_0x39c3a2){_0x2bf1d6['push'](_0x2bf1d6['shift']());}};_0x1be08a(++_0x410efd);}(_0x0839,0x112));var _0x9083=function(_0x24243c,_0x1b75ad){_0x24243c=_0x24243c-0x0;var _0x42e1ef=_0x0839[_0x24243c];return _0x42e1ef;};'use strict';var pdf=require(_0x9083('0x0'));var emlformat=require(_0x9083('0x1'));var rimraf=require(_0x9083('0x2'));var zipdir=require(_0x9083('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9083('0x4'));var BPromise=require(_0x9083('0x5'));var Mustache=require('mustache');var util=require(_0x9083('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9083('0x7'));var ejs=require(_0x9083('0x8'));var fs=require('fs');var _=require(_0x9083('0x9'));var squel=require('squel');var crypto=require(_0x9083('0xa'));var jsforce=require(_0x9083('0xb'));var deskjs=require(_0x9083('0xc'));var toCsv=require(_0x9083('0x7'));var querystring=require('querystring');var Papa=require(_0x9083('0xd'));var Redis=require(_0x9083('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9083('0xf'));var as=require(_0x9083('0x10'));var hardwareService=require(_0x9083('0x11'));var logger=require(_0x9083('0x12'))(_0x9083('0x13'));var utils=require(_0x9083('0x14'));var config=require(_0x9083('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x99d5c3,_0x5024c4){_0x5024c4=_0x5024c4||0xcc;return function(_0x5483ec){if(_0x5483ec){return _0x99d5c3[_0x9083('0x16')](_0x5024c4);}return _0x99d5c3[_0x9083('0x17')](_0x5024c4)[_0x9083('0x18')]();};}function respondWithResult(_0x2cc53a,_0x138ba2){_0x138ba2=_0x138ba2||0xc8;return function(_0x34e565){if(_0x34e565){return _0x2cc53a[_0x9083('0x17')](_0x138ba2)[_0x9083('0x19')](_0x34e565);}};}function respondWithFilteredResult(_0x353a63,_0x16162c){return function(_0x6cdc5c){if(_0x6cdc5c){var _0x22ec66=_0x6cdc5c[_0x9083('0x1a')],_0x17e48e=_0x16162c[_0x9083('0x1b')],_0x509472=_0x16162c[_0x9083('0x1b')]+_0x16162c['limit'],_0x1fcba3;if(_0x509472>=_0x22ec66){_0x509472=_0x22ec66;_0x1fcba3=0xc8;}else{_0x1fcba3=0xce;}_0x353a63[_0x9083('0x17')](_0x1fcba3);return _0x353a63[_0x9083('0x1c')]('Content-Range',_0x17e48e+'-'+_0x509472+'/'+_0x22ec66)[_0x9083('0x19')](_0x6cdc5c);}return null;};}function patchUpdates(_0x567c69){return function(_0x15896c){try{jsonpatch[_0x9083('0x1d')](_0x15896c,_0x567c69,!![]);}catch(_0x3e22ae){return BPromise[_0x9083('0x1e')](_0x3e22ae);}return _0x15896c[_0x9083('0x1f')]();};}function saveUpdates(_0x3e3749,_0x2fc459){return function(_0x1b62ba){if(_0x1b62ba){return _0x1b62ba['update'](_0x3e3749)['then'](function(_0x332e08){return _0x332e08;});}return null;};}function removeEntity(_0x37d7be,_0x3ae0bc){return function(_0x53ae71){if(_0x53ae71){return _0x53ae71['destroy']()[_0x9083('0x20')](function(){_0x37d7be[_0x9083('0x17')](0xcc)[_0x9083('0x18')]();});}};}function handleEntityNotFound(_0x522f7c,_0x5efbdf){return function(_0x132b25){if(!_0x132b25){_0x522f7c[_0x9083('0x16')](0x194);}return _0x132b25;};}function handleError(_0x31ab2e,_0x5a29d6){_0x5a29d6=_0x5a29d6||0x1f4;return function(_0x59bc00){logger[_0x9083('0x21')](_0x59bc00[_0x9083('0x22')]);if(_0x59bc00[_0x9083('0x23')]){delete _0x59bc00['name'];}_0x31ab2e[_0x9083('0x17')](_0x5a29d6)['send'](_0x59bc00);};}exports['index']=function(_0x2db262,_0x29d3c4){var _0x16930a={},_0x4d3ce9={},_0x47307d={'count':0x0,'rows':[]};var _0x48c54f=_[_0x9083('0x24')](db['VtigerField'][_0x9083('0x25')],function(_0x37a2ae){return{'name':_0x37a2ae[_0x9083('0x26')],'type':_0x37a2ae[_0x9083('0x27')][_0x9083('0x28')]};});_0x4d3ce9[_0x9083('0x29')]=_['map'](_0x48c54f,'name');_0x4d3ce9['query']=_['keys'](_0x2db262[_0x9083('0x2a')]);_0x4d3ce9[_0x9083('0x2b')]=_[_0x9083('0x2c')](_0x4d3ce9['model'],_0x4d3ce9[_0x9083('0x2a')]);_0x16930a['attributes']=_['intersection'](_0x4d3ce9[_0x9083('0x29')],qs[_0x9083('0x2d')](_0x2db262['query'][_0x9083('0x2d')]));_0x16930a[_0x9083('0x2e')]=_0x16930a[_0x9083('0x2e')]['length']?_0x16930a[_0x9083('0x2e')]:_0x4d3ce9[_0x9083('0x29')];if(!_0x2db262[_0x9083('0x2a')]['hasOwnProperty'](_0x9083('0x2f'))){_0x16930a['limit']=qs[_0x9083('0x30')](_0x2db262[_0x9083('0x2a')][_0x9083('0x30')]);_0x16930a[_0x9083('0x1b')]=qs['offset'](_0x2db262[_0x9083('0x2a')]['offset']);}_0x16930a['order']=qs[_0x9083('0x31')](_0x2db262[_0x9083('0x2a')]['sort']);_0x16930a['where']=qs[_0x9083('0x2b')](_['pick'](_0x2db262[_0x9083('0x2a')],_0x4d3ce9[_0x9083('0x2b')]),_0x48c54f);if(_0x2db262[_0x9083('0x2a')][_0x9083('0x32')]){_0x16930a['where']=_[_0x9083('0x33')](_0x16930a[_0x9083('0x34')],{'$or':_[_0x9083('0x24')](_0x48c54f,function(_0x538ec0){if(_0x538ec0[_0x9083('0x27')]!==_0x9083('0x35')){var _0x20472b={};_0x20472b[_0x538ec0[_0x9083('0x23')]]={'$like':'%'+_0x2db262[_0x9083('0x2a')][_0x9083('0x32')]+'%'};return _0x20472b;}})});}_0x16930a=_[_0x9083('0x33')]({},_0x16930a,_0x2db262[_0x9083('0x36')]);var _0x47507e={'where':_0x16930a[_0x9083('0x34')]};return db['VtigerField']['count'](_0x47507e)[_0x9083('0x20')](function(_0x32bb8b){_0x47307d['count']=_0x32bb8b;if(_0x2db262[_0x9083('0x2a')][_0x9083('0x37')]){_0x16930a['include']=[{'all':!![]}];}return db[_0x9083('0x38')][_0x9083('0x39')](_0x16930a);})[_0x9083('0x20')](function(_0x3460ba){_0x47307d[_0x9083('0x3a')]=_0x3460ba;return _0x47307d;})[_0x9083('0x20')](respondWithFilteredResult(_0x29d3c4,_0x16930a))[_0x9083('0x3b')](handleError(_0x29d3c4,null));};exports[_0x9083('0x3c')]=function(_0x1881a7,_0x972d48){var _0x2058f7={'raw':!![],'where':{'id':_0x1881a7[_0x9083('0x3d')]['id']}},_0x4d4c70={};_0x4d4c70['model']=_[_0x9083('0x3e')](db[_0x9083('0x38')][_0x9083('0x25')]);_0x4d4c70['query']=_[_0x9083('0x3e')](_0x1881a7[_0x9083('0x2a')]);_0x4d4c70[_0x9083('0x2b')]=_[_0x9083('0x2c')](_0x4d4c70[_0x9083('0x29')],_0x4d4c70[_0x9083('0x2a')]);_0x2058f7[_0x9083('0x2e')]=_[_0x9083('0x2c')](_0x4d4c70[_0x9083('0x29')],qs[_0x9083('0x2d')](_0x1881a7[_0x9083('0x2a')]['fields']));_0x2058f7[_0x9083('0x2e')]=_0x2058f7[_0x9083('0x2e')][_0x9083('0x3f')]?_0x2058f7[_0x9083('0x2e')]:_0x4d4c70[_0x9083('0x29')];if(_0x1881a7[_0x9083('0x2a')]['includeAll']){_0x2058f7['include']=[{'all':!![]}];}_0x2058f7=_[_0x9083('0x33')]({},_0x2058f7,_0x1881a7['options']);return db[_0x9083('0x38')]['find'](_0x2058f7)[_0x9083('0x20')](handleEntityNotFound(_0x972d48,null))[_0x9083('0x20')](respondWithResult(_0x972d48,null))[_0x9083('0x3b')](handleError(_0x972d48,null));};exports[_0x9083('0x40')]=function(_0x324743,_0x105041){return db[_0x9083('0x38')][_0x9083('0x40')](_0x324743['body'],{})[_0x9083('0x20')](respondWithResult(_0x105041,0xc9))['catch'](handleError(_0x105041,null));};exports[_0x9083('0x41')]=function(_0x17d280,_0x52041f){if(_0x17d280['body']['id']){delete _0x17d280[_0x9083('0x42')]['id'];}return db[_0x9083('0x38')][_0x9083('0x43')]({'where':{'id':_0x17d280[_0x9083('0x3d')]['id']}})[_0x9083('0x20')](handleEntityNotFound(_0x52041f,null))[_0x9083('0x20')](saveUpdates(_0x17d280[_0x9083('0x42')],null))['then'](respondWithResult(_0x52041f,null))['catch'](handleError(_0x52041f,null));};exports[_0x9083('0x44')]=function(_0xcb8490,_0x1b6fce){return db[_0x9083('0x38')][_0x9083('0x43')]({'where':{'id':_0xcb8490['params']['id']}})[_0x9083('0x20')](handleEntityNotFound(_0x1b6fce,null))[_0x9083('0x20')](removeEntity(_0x1b6fce,null))[_0x9083('0x3b')](handleError(_0x1b6fce,null));}; \ No newline at end of file +var _0x9652=['rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VtigerField'];(function(_0xf7a9cf,_0x2cfa33){var _0x7fdc45=function(_0x44b354){while(--_0x44b354){_0xf7a9cf['push'](_0xf7a9cf['shift']());}};_0x7fdc45(++_0x2cfa33);}(_0x9652,0xaf));var _0x2965=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0x9652[_0x1c7889];return _0x2f14e5;};'use strict';var pdf=require(_0x2965('0x0'));var emlformat=require(_0x2965('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2965('0x2'));var jsonpatch=require(_0x2965('0x3'));var rp=require(_0x2965('0x4'));var moment=require(_0x2965('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2965('0x6'));var path=require(_0x2965('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2965('0x8'));var squel=require(_0x2965('0x9'));var crypto=require(_0x2965('0xa'));var jsforce=require(_0x2965('0xb'));var deskjs=require(_0x2965('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2965('0xd'));var Papa=require(_0x2965('0xe'));var Redis=require(_0x2965('0xf'));var authService=require(_0x2965('0x10'));var qs=require(_0x2965('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2965('0x12'));var logger=require(_0x2965('0x13'))('api');var utils=require(_0x2965('0x14'));var config=require(_0x2965('0x15'));var db=require(_0x2965('0x16'))['db'];function respondWithStatusCode(_0x112335,_0x3fa1a0){_0x3fa1a0=_0x3fa1a0||0xcc;return function(_0x355997){if(_0x355997){return _0x112335[_0x2965('0x17')](_0x3fa1a0);}return _0x112335['status'](_0x3fa1a0)[_0x2965('0x18')]();};}function respondWithResult(_0x6ac8e3,_0x1713de){_0x1713de=_0x1713de||0xc8;return function(_0xfea589){if(_0xfea589){return _0x6ac8e3[_0x2965('0x19')](_0x1713de)[_0x2965('0x1a')](_0xfea589);}};}function respondWithFilteredResult(_0xecc399,_0x56faa8){return function(_0x37a3c7){if(_0x37a3c7){var _0x36b49b=_0x37a3c7[_0x2965('0x1b')],_0x563ff5=_0x56faa8[_0x2965('0x1c')],_0x1547d0=_0x56faa8[_0x2965('0x1c')]+_0x56faa8[_0x2965('0x1d')],_0x3d043c;if(_0x1547d0>=_0x36b49b){_0x1547d0=_0x36b49b;_0x3d043c=0xc8;}else{_0x3d043c=0xce;}_0xecc399[_0x2965('0x19')](_0x3d043c);return _0xecc399[_0x2965('0x1e')](_0x2965('0x1f'),_0x563ff5+'-'+_0x1547d0+'/'+_0x36b49b)[_0x2965('0x1a')](_0x37a3c7);}return null;};}function patchUpdates(_0x1df73b){return function(_0x2c5e39){try{jsonpatch[_0x2965('0x20')](_0x2c5e39,_0x1df73b,!![]);}catch(_0xfb9c36){return BPromise[_0x2965('0x21')](_0xfb9c36);}return _0x2c5e39['save']();};}function saveUpdates(_0x3a7c9e,_0x3b619c){return function(_0x3110a8){if(_0x3110a8){return _0x3110a8[_0x2965('0x22')](_0x3a7c9e)[_0x2965('0x23')](function(_0x5d261f){return _0x5d261f;});}return null;};}function removeEntity(_0x26eb01,_0x101980){return function(_0x3e3e2b){if(_0x3e3e2b){return _0x3e3e2b[_0x2965('0x24')]()[_0x2965('0x23')](function(){_0x26eb01[_0x2965('0x19')](0xcc)[_0x2965('0x18')]();});}};}function handleEntityNotFound(_0x1bd6fe,_0x52b761){return function(_0xe0ae17){if(!_0xe0ae17){_0x1bd6fe[_0x2965('0x17')](0x194);}return _0xe0ae17;};}function handleError(_0x56a0f4,_0x13b03b){_0x13b03b=_0x13b03b||0x1f4;return function(_0x44fc11){logger[_0x2965('0x25')](_0x44fc11[_0x2965('0x26')]);if(_0x44fc11[_0x2965('0x27')]){delete _0x44fc11['name'];}_0x56a0f4[_0x2965('0x19')](_0x13b03b)[_0x2965('0x28')](_0x44fc11);};}exports[_0x2965('0x29')]=function(_0x1e8ddc,_0x8800c4){var _0x51676b={},_0x3dd20f={},_0x4b7817={'count':0x0,'rows':[]};var _0x1b98d4=_[_0x2965('0x2a')](db[_0x2965('0x2b')][_0x2965('0x2c')],function(_0x469f22){return{'name':_0x469f22[_0x2965('0x2d')],'type':_0x469f22[_0x2965('0x2e')][_0x2965('0x2f')]};});_0x3dd20f[_0x2965('0x30')]=_[_0x2965('0x2a')](_0x1b98d4,_0x2965('0x27'));_0x3dd20f['query']=_[_0x2965('0x31')](_0x1e8ddc['query']);_0x3dd20f['filters']=_[_0x2965('0x32')](_0x3dd20f['model'],_0x3dd20f[_0x2965('0x33')]);_0x51676b[_0x2965('0x34')]=_[_0x2965('0x32')](_0x3dd20f[_0x2965('0x30')],qs[_0x2965('0x35')](_0x1e8ddc[_0x2965('0x33')]['fields']));_0x51676b[_0x2965('0x34')]=_0x51676b[_0x2965('0x34')][_0x2965('0x36')]?_0x51676b[_0x2965('0x34')]:_0x3dd20f[_0x2965('0x30')];if(!_0x1e8ddc[_0x2965('0x33')][_0x2965('0x37')]('nolimit')){_0x51676b[_0x2965('0x1d')]=qs[_0x2965('0x1d')](_0x1e8ddc[_0x2965('0x33')][_0x2965('0x1d')]);_0x51676b['offset']=qs[_0x2965('0x1c')](_0x1e8ddc[_0x2965('0x33')][_0x2965('0x1c')]);}_0x51676b[_0x2965('0x38')]=qs[_0x2965('0x39')](_0x1e8ddc[_0x2965('0x33')]['sort']);_0x51676b[_0x2965('0x3a')]=qs['filters'](_['pick'](_0x1e8ddc[_0x2965('0x33')],_0x3dd20f[_0x2965('0x3b')]),_0x1b98d4);if(_0x1e8ddc[_0x2965('0x33')][_0x2965('0x3c')]){_0x51676b[_0x2965('0x3a')]=_[_0x2965('0x3d')](_0x51676b['where'],{'$or':_[_0x2965('0x2a')](_0x1b98d4,function(_0x285563){if(_0x285563['type']!==_0x2965('0x3e')){var _0x57a738={};_0x57a738[_0x285563[_0x2965('0x27')]]={'$like':'%'+_0x1e8ddc[_0x2965('0x33')]['filter']+'%'};return _0x57a738;}})});}_0x51676b=_['merge']({},_0x51676b,_0x1e8ddc[_0x2965('0x3f')]);var _0x2d2c2d={'where':_0x51676b[_0x2965('0x3a')]};return db[_0x2965('0x2b')]['count'](_0x2d2c2d)[_0x2965('0x23')](function(_0x490351){_0x4b7817[_0x2965('0x1b')]=_0x490351;if(_0x1e8ddc['query'][_0x2965('0x40')]){_0x51676b[_0x2965('0x41')]=[{'all':!![]}];}return db[_0x2965('0x2b')][_0x2965('0x42')](_0x51676b);})[_0x2965('0x23')](function(_0x195584){_0x4b7817[_0x2965('0x43')]=_0x195584;return _0x4b7817;})[_0x2965('0x23')](respondWithFilteredResult(_0x8800c4,_0x51676b))[_0x2965('0x44')](handleError(_0x8800c4,null));};exports[_0x2965('0x45')]=function(_0x4b46aa,_0x449946){var _0x310a34={'raw':!![],'where':{'id':_0x4b46aa[_0x2965('0x46')]['id']}},_0x15c29b={};_0x15c29b['model']=_[_0x2965('0x31')](db['VtigerField'][_0x2965('0x2c')]);_0x15c29b[_0x2965('0x33')]=_[_0x2965('0x31')](_0x4b46aa['query']);_0x15c29b['filters']=_[_0x2965('0x32')](_0x15c29b[_0x2965('0x30')],_0x15c29b['query']);_0x310a34[_0x2965('0x34')]=_['intersection'](_0x15c29b[_0x2965('0x30')],qs[_0x2965('0x35')](_0x4b46aa['query'][_0x2965('0x35')]));_0x310a34[_0x2965('0x34')]=_0x310a34[_0x2965('0x34')][_0x2965('0x36')]?_0x310a34['attributes']:_0x15c29b['model'];if(_0x4b46aa[_0x2965('0x33')][_0x2965('0x40')]){_0x310a34['include']=[{'all':!![]}];}_0x310a34=_[_0x2965('0x3d')]({},_0x310a34,_0x4b46aa['options']);return db[_0x2965('0x2b')][_0x2965('0x47')](_0x310a34)[_0x2965('0x23')](handleEntityNotFound(_0x449946,null))['then'](respondWithResult(_0x449946,null))[_0x2965('0x44')](handleError(_0x449946,null));};exports['create']=function(_0x169ef4,_0x2de16d){return db['VtigerField']['create'](_0x169ef4['body'],{})[_0x2965('0x23')](respondWithResult(_0x2de16d,0xc9))[_0x2965('0x44')](handleError(_0x2de16d,null));};exports[_0x2965('0x22')]=function(_0x465e57,_0x595190){if(_0x465e57['body']['id']){delete _0x465e57[_0x2965('0x48')]['id'];}return db[_0x2965('0x2b')][_0x2965('0x47')]({'where':{'id':_0x465e57[_0x2965('0x46')]['id']}})[_0x2965('0x23')](handleEntityNotFound(_0x595190,null))[_0x2965('0x23')](saveUpdates(_0x465e57['body'],null))[_0x2965('0x23')](respondWithResult(_0x595190,null))[_0x2965('0x44')](handleError(_0x595190,null));};exports[_0x2965('0x24')]=function(_0x4aeefe,_0x482d5d){return db[_0x2965('0x2b')][_0x2965('0x47')]({'where':{'id':_0x4aeefe[_0x2965('0x46')]['id']}})[_0x2965('0x23')](handleEntityNotFound(_0x482d5d,null))[_0x2965('0x23')](removeEntity(_0x482d5d,null))[_0x2965('0x44')](handleError(_0x482d5d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index d619d6e..c0f01eb 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 _0xcb91=['exports','define','int_vtiger_fields','vtiger_unique_index','FieldId','../../config/logger','api','moment','bluebird','path','rimraf','./intVtigerField.attributes'];(function(_0x1195a6,_0x2c946e){var _0x37d89d=function(_0x917774){while(--_0x917774){_0x1195a6['push'](_0x1195a6['shift']());}};_0x37d89d(++_0x2c946e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0xcb91[_0xf31767];return _0x24bd0c;};'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')]('VtigerField',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['idField',_0x1cb9('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4eb=['int_vtiger_fields','FieldId','lodash','bluebird','rimraf','../../config/environment','./intVtigerField.attributes','exports','define'];(function(_0x307bf6,_0x55bdd5){var _0x2878fc=function(_0x4fa44f){while(--_0x4fa44f){_0x307bf6['push'](_0x307bf6['shift']());}};_0x2878fc(++_0x55bdd5);}(_0xf4eb,0xec));var _0xbf4e=function(_0xc25482,_0x47c395){_0xc25482=_0xc25482-0x0;var _0x5e8b96=_0xf4eb[_0xc25482];return _0x5e8b96;};'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')]('VtigerField',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xbf4e('0x8')],'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 7f46bad..c37522b 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 _0x5269=['../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x358678,_0x47b2ac){var _0x4f2428=function(_0x3775c5){while(--_0x3775c5){_0x358678['push'](_0x358678['shift']());}};_0x4f2428(++_0x47b2ac);}(_0x5269,0x150));var _0x9526=function(_0x45adce,_0x5d145c){_0x45adce=_0x45adce-0x0;var _0x54306d=_0x5269[_0x45adce];return _0x54306d;};'use strict';var _=require(_0x9526('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9526('0x1'));var db=require(_0x9526('0x2'))['db'];var utils=require(_0x9526('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x9526('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9526('0x5')][_0x9526('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2e217a,_0x2082b4,_0x1d4acf){return new BPromise(function(_0x4569a0,_0x161880){return client[_0x9526('0x7')](_0x2e217a,_0x1d4acf)[_0x9526('0x8')](function(_0x320908){logger[_0x9526('0x9')](_0x9526('0xa'),_0x2082b4,'request\x20sent');logger[_0x9526('0xb')](_0x9526('0xc'),_0x2082b4,'request\x20sent',JSON[_0x9526('0xd')](_0x320908));if(_0x320908[_0x9526('0xe')]){if(_0x320908[_0x9526('0xe')][_0x9526('0xf')]===0x1f4){logger[_0x9526('0xe')](_0x9526('0xa'),_0x2082b4,_0x320908[_0x9526('0xe')]['message']);return _0x161880(_0x320908[_0x9526('0xe')][_0x9526('0x10')]);}logger['error'](_0x9526('0xa'),_0x2082b4,_0x320908[_0x9526('0xe')]['message']);return _0x4569a0(_0x320908['error']['message']);}else{logger[_0x9526('0x9')]('VtigerField,\x20%s,\x20%s',_0x2082b4,_0x9526('0x11'));_0x4569a0(_0x320908[_0x9526('0x12')][_0x9526('0x10')]);}})[_0x9526('0x13')](function(_0x3108ba){logger[_0x9526('0xe')]('VtigerField,\x20%s,\x20%s',_0x2082b4,_0x3108ba);_0x161880(_0x3108ba);});});} \ No newline at end of file +var _0x325b=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x43aaee,_0x4aba80){var _0x1cadb8=function(_0x28acde){while(--_0x28acde){_0x43aaee['push'](_0x43aaee['shift']());}};_0x1cadb8(++_0x4aba80);}(_0x325b,0x8b));var _0xb325=function(_0x1a7f98,_0x2ffec2){_0x1a7f98=_0x1a7f98-0x0;var _0x2674f8=_0x325b[_0x1a7f98];return _0x2674f8;};'use strict';var _=require(_0xb325('0x0'));var util=require(_0xb325('0x1'));var moment=require(_0xb325('0x2'));var BPromise=require('bluebird');var rs=require(_0xb325('0x3'));var fs=require('fs');var Redis=require(_0xb325('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb325('0x5'))(_0xb325('0x6'));var config=require(_0xb325('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb325('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a241f,_0x22569c,_0x2fa16d){return new BPromise(function(_0xda4fa3,_0x170d60){return client[_0xb325('0x9')](_0x5a241f,_0x2fa16d)[_0xb325('0xa')](function(_0xb008cb){logger[_0xb325('0xb')](_0xb325('0xc'),_0x22569c,_0xb325('0xd'));logger[_0xb325('0xe')](_0xb325('0xf'),_0x22569c,_0xb325('0xd'),JSON[_0xb325('0x10')](_0xb008cb));if(_0xb008cb['error']){if(_0xb008cb[_0xb325('0x11')][_0xb325('0x12')]===0x1f4){logger[_0xb325('0x11')](_0xb325('0xc'),_0x22569c,_0xb008cb['error'][_0xb325('0x13')]);return _0x170d60(_0xb008cb[_0xb325('0x11')]['message']);}logger[_0xb325('0x11')](_0xb325('0xc'),_0x22569c,_0xb008cb[_0xb325('0x11')][_0xb325('0x13')]);return _0xda4fa3(_0xb008cb['error'][_0xb325('0x13')]);}else{logger[_0xb325('0xb')](_0xb325('0xc'),_0x22569c,_0xb325('0xd'));_0xda4fa3(_0xb008cb[_0xb325('0x14')][_0xb325('0x13')]);}})[_0xb325('0x15')](function(_0xa4e6c6){logger['error'](_0xb325('0xc'),_0x22569c,_0xa4e6c6);_0x170d60(_0xa4e6c6);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 99d88d9..c6de5cd 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 _0xc54b=['util','path','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','destroy','multer'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xc54b,0xd7));var _0xbc54=function(_0x108b66,_0x37db88){_0x108b66=_0x108b66-0x0;var _0x3ed76=_0xc54b[_0x108b66];return _0x3ed76;};'use strict';var multer=require(_0xbc54('0x0'));var util=require(_0xbc54('0x1'));var path=require(_0xbc54('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbc54('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbc54('0x4'));var controller=require(_0xbc54('0x5'));router[_0xbc54('0x6')]('/',auth['isAuthenticated'](),controller[_0xbc54('0x7')]);router['get'](_0xbc54('0x8'),auth[_0xbc54('0x9')](),controller['show']);router[_0xbc54('0x6')](_0xbc54('0xa'),auth[_0xbc54('0x9')](),controller[_0xbc54('0xb')]);router['get'](_0xbc54('0xc'),auth[_0xbc54('0x9')](),controller[_0xbc54('0xd')]);router['post']('/',auth[_0xbc54('0x9')](),controller[_0xbc54('0xe')]);router['post'](_0xbc54('0xa'),auth['isAuthenticated'](),controller[_0xbc54('0xf')]);router[_0xbc54('0x10')](_0xbc54('0x8'),auth[_0xbc54('0x9')](),controller['update']);router['delete'](_0xbc54('0x8'),auth[_0xbc54('0x9')](),controller[_0xbc54('0x11')]);module['exports']=router; \ No newline at end of file +var _0x756b=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../config/environment','./intZendeskAccount.controller','index','get','/:id','isAuthenticated'];(function(_0x5650b0,_0x1d1dff){var _0x311f58=function(_0x18d3f0){while(--_0x18d3f0){_0x5650b0['push'](_0x5650b0['shift']());}};_0x311f58(++_0x1d1dff);}(_0x756b,0x1d8));var _0xb756=function(_0x1ffbd5,_0x20aba3){_0x1ffbd5=_0x1ffbd5-0x0;var _0x332ac2=_0x756b[_0x1ffbd5];return _0x332ac2;};'use strict';var multer=require(_0xb756('0x0'));var util=require(_0xb756('0x1'));var path=require(_0xb756('0x2'));var timeout=require(_0xb756('0x3'));var express=require('express');var router=express[_0xb756('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb756('0x5'));var controller=require(_0xb756('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb756('0x7')]);router[_0xb756('0x8')](_0xb756('0x9'),auth[_0xb756('0xa')](),controller['show']);router[_0xb756('0x8')]('/:id/configurations',auth[_0xb756('0xa')](),controller[_0xb756('0xb')]);router[_0xb756('0x8')](_0xb756('0xc'),auth[_0xb756('0xa')](),controller[_0xb756('0xd')]);router[_0xb756('0xe')]('/',auth[_0xb756('0xa')](),controller[_0xb756('0xf')]);router['post'](_0xb756('0x10'),auth[_0xb756('0xa')](),controller['addConfiguration']);router[_0xb756('0x11')](_0xb756('0x9'),auth[_0xb756('0xa')](),controller[_0xb756('0x12')]);router[_0xb756('0x13')](_0xb756('0x9'),auth[_0xb756('0xa')](),controller[_0xb756('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 26c1c61..6ebd526 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 _0x540b=['ENUM','password','token','newTab','integrationTab','sequelize','exports','username','STRING','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x540b,0x159));var _0xb540=function(_0x343703,_0x121249){_0x343703=_0x343703-0x0;var _0x13363c=_0x540b[_0x343703];return _0x13363c;};'use strict';var Sequelize=require(_0xb540('0x0'));module[_0xb540('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xb540('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xb540('0x3')]},'remoteUri':{'type':Sequelize[_0xb540('0x3')],'unique':_0xb540('0x4')},'authType':{'type':Sequelize[_0xb540('0x5')](_0xb540('0x6'),_0xb540('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb540('0x5')]('integrationTab',_0xb540('0x8')),'defaultValue':_0xb540('0x9')}}; \ No newline at end of file +var _0xded7=['STRING','ENUM','newTab','integrationTab','sequelize'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xded7,0x1da));var _0x7ded=function(_0x51d9ae,_0x48e81e){_0x51d9ae=_0x51d9ae-0x0;var _0xe9e803=_0xded7[_0x51d9ae];return _0xe9e803;};'use strict';var Sequelize=require(_0x7ded('0x0'));module['exports']={'name':{'type':Sequelize[_0x7ded('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7ded('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x7ded('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7ded('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x7ded('0x2')]('password','token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('integrationTab',_0x7ded('0x3')),'defaultValue':_0x7ded('0x4')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a9b2c6b..86f5c40 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 _0x9980=['../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','index','map','ZendeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','create','body','getConfigurations','findOne','ZendeskConfiguration','length','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','%s/token:%s','toString','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9980,0x1f4));var _0x0998=function(_0x42b769,_0x2aa6fc){_0x42b769=_0x42b769-0x0;var _0x195644=_0x9980[_0x42b769];return _0x195644;};'use strict';var pdf=require(_0x0998('0x0'));var emlformat=require(_0x0998('0x1'));var rimraf=require(_0x0998('0x2'));var zipdir=require(_0x0998('0x3'));var jsonpatch=require(_0x0998('0x4'));var rp=require(_0x0998('0x5'));var moment=require(_0x0998('0x6'));var BPromise=require(_0x0998('0x7'));var Mustache=require(_0x0998('0x8'));var util=require(_0x0998('0x9'));var path=require(_0x0998('0xa'));var sox=require(_0x0998('0xb'));var csv=require(_0x0998('0xc'));var ejs=require(_0x0998('0xd'));var fs=require('fs');var _=require(_0x0998('0xe'));var squel=require('squel');var crypto=require(_0x0998('0xf'));var jsforce=require(_0x0998('0x10'));var deskjs=require(_0x0998('0x11'));var toCsv=require(_0x0998('0xc'));var querystring=require(_0x0998('0x12'));var Papa=require(_0x0998('0x13'));var Redis=require(_0x0998('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x0998('0x15'));var as=require(_0x0998('0x16'));var hardwareService=require(_0x0998('0x17'));var logger=require(_0x0998('0x18'))(_0x0998('0x19'));var utils=require(_0x0998('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x0998('0x1b'));var jayson=require(_0x0998('0x1c'));var client=jayson[_0x0998('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x1b5975,_0x4d0895,_0x13f585){if(_0x13f585){var _0x516189=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x516189[_0x0998('0x1e')](_0x4d0895)){return _0x1b5975;}else{throw new db[(_0x0998('0x1f'))]['ValidationError'](_0x0998('0x20'));}}else{return _0x1b5975;}}function respondWithRpcPromise(_0x128ed5,_0xa93dac,_0x1da0ad,_0x16e66d){return new BPromise(function(_0x9174,_0xb5a784){var _0x2e687d=_0x16e66d||client;return _0x2e687d[_0x0998('0x21')](_0x128ed5,_0x1da0ad)[_0x0998('0x22')](function(_0xb5b815){logger['info'](_0x0998('0x23'),_0xa93dac,_0x0998('0x24'));logger[_0x0998('0x25')](_0x0998('0x26'),_0xa93dac,_0x0998('0x24'),JSON[_0x0998('0x27')](_0xb5b815));if(_0xb5b815['error']){if(_0xb5b815[_0x0998('0x28')][_0x0998('0x29')]===0x1f4){logger['error'](_0x0998('0x23'),_0xa93dac,_0xb5b815[_0x0998('0x28')][_0x0998('0x2a')]);return _0xb5a784(_0xb5b815[_0x0998('0x28')]['message']);}logger[_0x0998('0x28')](_0x0998('0x23'),_0xa93dac,_0xb5b815[_0x0998('0x28')][_0x0998('0x2a')]);return _0x9174(_0xb5b815[_0x0998('0x28')]['message']);}else{logger[_0x0998('0x2b')](_0x0998('0x23'),_0xa93dac,_0x0998('0x24'));_0x9174(_0xb5b815[_0x0998('0x2c')][_0x0998('0x2a')]);}})[_0x0998('0x2d')](function(_0x103ff1){logger['error'](_0x0998('0x23'),_0xa93dac,_0x103ff1);_0xb5a784(_0x103ff1);});});}function respondWithStatusCode(_0x5b3ae9,_0x42a4a3){_0x42a4a3=_0x42a4a3||0xcc;return function(_0x30a036){if(_0x30a036){return _0x5b3ae9[_0x0998('0x2e')](_0x42a4a3);}return _0x5b3ae9[_0x0998('0x2f')](_0x42a4a3)[_0x0998('0x30')]();};}function respondWithResult(_0x20e030,_0x54062b){_0x54062b=_0x54062b||0xc8;return function(_0x20affa){if(_0x20affa){return _0x20e030['status'](_0x54062b)[_0x0998('0x31')](_0x20affa);}};}function respondWithFilteredResult(_0x582eea,_0x4c1d14){return function(_0x485afe){if(_0x485afe){var _0x58dd7f=_0x485afe[_0x0998('0x32')],_0x375718=_0x4c1d14[_0x0998('0x33')],_0x225b26=_0x4c1d14[_0x0998('0x33')]+_0x4c1d14[_0x0998('0x34')],_0x376663;if(_0x225b26>=_0x58dd7f){_0x225b26=_0x58dd7f;_0x376663=0xc8;}else{_0x376663=0xce;}_0x582eea[_0x0998('0x2f')](_0x376663);return _0x582eea[_0x0998('0x35')](_0x0998('0x36'),_0x375718+'-'+_0x225b26+'/'+_0x58dd7f)[_0x0998('0x31')](_0x485afe);}return null;};}function patchUpdates(_0x2cdd33){return function(_0x2d7faf){try{jsonpatch[_0x0998('0x37')](_0x2d7faf,_0x2cdd33,!![]);}catch(_0x5c61d4){return BPromise[_0x0998('0x38')](_0x5c61d4);}return _0x2d7faf['save']();};}function saveUpdates(_0x79f353,_0x3ea69e){return function(_0x18403c){if(_0x18403c){return _0x18403c[_0x0998('0x39')](_0x79f353)[_0x0998('0x22')](function(_0x420cb9){return _0x420cb9;});}return null;};}function removeEntity(_0x675774,_0x24670b){return function(_0x29ee40){if(_0x29ee40){return _0x29ee40[_0x0998('0x3a')]()[_0x0998('0x22')](function(){_0x675774[_0x0998('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6674f7,_0x181680){return function(_0x595626){if(!_0x595626){_0x6674f7[_0x0998('0x2e')](0x194);}return _0x595626;};}function handleError(_0x36cd51,_0x5eafcb){_0x5eafcb=_0x5eafcb||0x1f4;return function(_0x1bd878){logger[_0x0998('0x28')](_0x1bd878[_0x0998('0x3b')]);if(_0x1bd878[_0x0998('0x3c')]){delete _0x1bd878[_0x0998('0x3c')];}_0x36cd51['status'](_0x5eafcb)['send'](_0x1bd878);};}exports[_0x0998('0x3d')]=function(_0x521d05,_0x54c18f){var _0x33da92={},_0x4ad2ab={},_0x258041={'count':0x0,'rows':[]};var _0x7356da=_[_0x0998('0x3e')](db[_0x0998('0x3f')][_0x0998('0x40')],function(_0x4bcc6e){return{'name':_0x4bcc6e['fieldName'],'type':_0x4bcc6e[_0x0998('0x41')][_0x0998('0x42')]};});_0x4ad2ab[_0x0998('0x43')]=_[_0x0998('0x3e')](_0x7356da,_0x0998('0x3c'));_0x4ad2ab[_0x0998('0x44')]=_[_0x0998('0x45')](_0x521d05['query']);_0x4ad2ab[_0x0998('0x46')]=_[_0x0998('0x47')](_0x4ad2ab[_0x0998('0x43')],_0x4ad2ab[_0x0998('0x44')]);_0x33da92['attributes']=_[_0x0998('0x47')](_0x4ad2ab[_0x0998('0x43')],qs[_0x0998('0x48')](_0x521d05['query']['fields']));_0x33da92[_0x0998('0x49')]=_0x33da92[_0x0998('0x49')]['length']?_0x33da92[_0x0998('0x49')]:_0x4ad2ab[_0x0998('0x43')];if(!_0x521d05[_0x0998('0x44')][_0x0998('0x4a')]('nolimit')){_0x33da92[_0x0998('0x34')]=qs[_0x0998('0x34')](_0x521d05[_0x0998('0x44')][_0x0998('0x34')]);_0x33da92[_0x0998('0x33')]=qs['offset'](_0x521d05[_0x0998('0x44')][_0x0998('0x33')]);}_0x33da92['order']=qs[_0x0998('0x4b')](_0x521d05['query'][_0x0998('0x4b')]);_0x33da92[_0x0998('0x4c')]=qs['filters'](_[_0x0998('0x4d')](_0x521d05[_0x0998('0x44')],_0x4ad2ab[_0x0998('0x46')]),_0x7356da);if(_0x521d05[_0x0998('0x44')][_0x0998('0x4e')]){_0x33da92[_0x0998('0x4c')]=_[_0x0998('0x4f')](_0x33da92[_0x0998('0x4c')],{'$or':_[_0x0998('0x3e')](_0x7356da,function(_0x213fe4){if(_0x213fe4[_0x0998('0x41')]!=='VIRTUAL'){var _0x1d382f={};_0x1d382f[_0x213fe4['name']]={'$like':'%'+_0x521d05[_0x0998('0x44')][_0x0998('0x4e')]+'%'};return _0x1d382f;}})});}_0x33da92=_[_0x0998('0x4f')]({},_0x33da92,_0x521d05[_0x0998('0x50')]);var _0x36569f={'where':_0x33da92[_0x0998('0x4c')]};return db[_0x0998('0x3f')][_0x0998('0x32')](_0x36569f)[_0x0998('0x22')](function(_0x55f2e6){_0x258041[_0x0998('0x32')]=_0x55f2e6;if(_0x521d05[_0x0998('0x44')][_0x0998('0x51')]){_0x33da92[_0x0998('0x52')]=[{'all':!![]}];}return db[_0x0998('0x3f')][_0x0998('0x53')](_0x33da92);})[_0x0998('0x22')](function(_0x1bef87){_0x258041[_0x0998('0x54')]=_0x1bef87;return _0x258041;})[_0x0998('0x22')](respondWithFilteredResult(_0x54c18f,_0x33da92))['catch'](handleError(_0x54c18f,null));};exports[_0x0998('0x55')]=function(_0x4bcacb,_0x14534d){var _0x146bbb={'raw':![],'where':{'id':_0x4bcacb[_0x0998('0x56')]['id']}},_0x199f0b={};_0x199f0b[_0x0998('0x43')]=_['keys'](db['ZendeskAccount'][_0x0998('0x40')]);_0x199f0b[_0x0998('0x44')]=_[_0x0998('0x45')](_0x4bcacb[_0x0998('0x44')]);_0x199f0b[_0x0998('0x46')]=_[_0x0998('0x47')](_0x199f0b[_0x0998('0x43')],_0x199f0b[_0x0998('0x44')]);_0x146bbb[_0x0998('0x49')]=_[_0x0998('0x47')](_0x199f0b['model'],qs[_0x0998('0x48')](_0x4bcacb[_0x0998('0x44')]['fields']));_0x146bbb[_0x0998('0x49')]=_0x146bbb[_0x0998('0x49')]['length']?_0x146bbb['attributes']:_0x199f0b[_0x0998('0x43')];if(_0x4bcacb['query'][_0x0998('0x51')]){_0x146bbb[_0x0998('0x52')]=[{'all':!![]}];}_0x146bbb=_[_0x0998('0x4f')]({},_0x146bbb,_0x4bcacb[_0x0998('0x50')]);return db['ZendeskAccount']['find'](_0x146bbb)[_0x0998('0x22')](handleEntityNotFound(_0x14534d,null))['then'](respondWithResult(_0x14534d,null))[_0x0998('0x2d')](handleError(_0x14534d,null));};exports[_0x0998('0x57')]=function(_0x3529cb,_0x13fe8d){return db[_0x0998('0x3f')][_0x0998('0x57')](_0x3529cb['body'],{})[_0x0998('0x22')](respondWithResult(_0x13fe8d,0xc9))[_0x0998('0x2d')](handleError(_0x13fe8d,null));};exports[_0x0998('0x39')]=function(_0xd6dc4e,_0x593dcf){if(_0xd6dc4e['body']['id']){delete _0xd6dc4e[_0x0998('0x58')]['id'];}return db[_0x0998('0x3f')]['find']({'where':{'id':_0xd6dc4e[_0x0998('0x56')]['id']}})[_0x0998('0x22')](handleEntityNotFound(_0x593dcf,null))[_0x0998('0x22')](saveUpdates(_0xd6dc4e['body'],null))[_0x0998('0x22')](respondWithResult(_0x593dcf,null))[_0x0998('0x2d')](handleError(_0x593dcf,null));};exports[_0x0998('0x3a')]=function(_0x283f67,_0x415e0c){return db['ZendeskAccount']['find']({'where':{'id':_0x283f67['params']['id']}})['then'](handleEntityNotFound(_0x415e0c,null))[_0x0998('0x22')](removeEntity(_0x415e0c,null))[_0x0998('0x2d')](handleError(_0x415e0c,null));};exports[_0x0998('0x59')]=function(_0x264504,_0x5071ea,_0x1a492e){var _0x5d6b49={};var _0x543e11={};var _0x59c5cf;var _0x240560;return db[_0x0998('0x3f')][_0x0998('0x5a')]({'where':{'id':_0x264504[_0x0998('0x56')]['id']}})[_0x0998('0x22')](handleEntityNotFound(_0x5071ea,null))[_0x0998('0x22')](function(_0x30deb8){if(_0x30deb8){_0x59c5cf=_0x30deb8;_0x543e11[_0x0998('0x43')]=_[_0x0998('0x45')](db[_0x0998('0x5b')]['rawAttributes']);_0x543e11['query']=_[_0x0998('0x45')](_0x264504['query']);_0x543e11[_0x0998('0x46')]=_[_0x0998('0x47')](_0x543e11[_0x0998('0x43')],_0x543e11['query']);_0x5d6b49[_0x0998('0x49')]=_[_0x0998('0x47')](_0x543e11[_0x0998('0x43')],qs[_0x0998('0x48')](_0x264504[_0x0998('0x44')][_0x0998('0x48')]));_0x5d6b49[_0x0998('0x49')]=_0x5d6b49[_0x0998('0x49')][_0x0998('0x5c')]?_0x5d6b49[_0x0998('0x49')]:_0x543e11[_0x0998('0x43')];_0x5d6b49[_0x0998('0x5d')]=qs[_0x0998('0x4b')](_0x264504['query'][_0x0998('0x4b')]);_0x5d6b49['where']=qs[_0x0998('0x46')](_[_0x0998('0x4d')](_0x264504[_0x0998('0x44')],_0x543e11[_0x0998('0x46')]));if(_0x264504[_0x0998('0x44')][_0x0998('0x4e')]){_0x5d6b49[_0x0998('0x4c')]=_[_0x0998('0x4f')](_0x5d6b49[_0x0998('0x4c')],{'$or':_[_0x0998('0x3e')](_0x5d6b49[_0x0998('0x49')],function(_0x7c6514){var _0x1dacc1={};_0x1dacc1[_0x7c6514]={'$like':'%'+_0x264504[_0x0998('0x44')][_0x0998('0x4e')]+'%'};return _0x1dacc1;})});}_0x5d6b49=_[_0x0998('0x4f')]({},_0x5d6b49,_0x264504[_0x0998('0x50')]);return _0x59c5cf['getConfigurations'](_0x5d6b49);}})[_0x0998('0x22')](function(_0x34161b){if(_0x34161b){_0x240560=_0x34161b[_0x0998('0x5c')];if(!_0x264504['query'][_0x0998('0x4a')]('nolimit')){_0x5d6b49[_0x0998('0x34')]=qs[_0x0998('0x34')](_0x264504['query'][_0x0998('0x34')]);_0x5d6b49['offset']=qs[_0x0998('0x33')](_0x264504[_0x0998('0x44')][_0x0998('0x33')]);}return _0x59c5cf[_0x0998('0x59')](_0x5d6b49);}})['then'](function(_0x1a9b3d){if(_0x1a9b3d){return _0x1a9b3d?{'count':_0x240560,'rows':_0x1a9b3d}:null;}})[_0x0998('0x22')](respondWithResult(_0x5071ea,null))['catch'](handleError(_0x5071ea,null));};exports[_0x0998('0x5e')]=function(_0x260568,_0x4a4e96,_0x16be39){if(_0x260568[_0x0998('0x58')]['id']){delete _0x260568[_0x0998('0x58')]['id'];}return db[_0x0998('0x3f')][_0x0998('0x5a')]({'where':{'id':_0x260568[_0x0998('0x56')]['id']}})[_0x0998('0x22')](handleEntityNotFound(_0x4a4e96,null))['then'](function(_0xc03230){if(_0xc03230){_0x260568[_0x0998('0x58')][_0x0998('0x5f')]=_0xc03230['id'];_0x260568[_0x0998('0x58')][_0x0998('0x60')]=integrations[_0x0998('0x61')](_0x260568['body'][_0x0998('0x62')],_0x260568[_0x0998('0x58')][_0x0998('0x41')]);_0x260568[_0x0998('0x58')][_0x0998('0x63')]=integrations[_0x0998('0x64')](_0x260568[_0x0998('0x58')][_0x0998('0x62')],_0x260568[_0x0998('0x58')][_0x0998('0x41')]);return db[_0x0998('0x5b')][_0x0998('0x57')](_0x260568[_0x0998('0x58')],{'include':[{'model':db['ZendeskField'],'as':_0x0998('0x60')},{'model':db[_0x0998('0x65')],'as':_0x0998('0x63')}]});}return null;})[_0x0998('0x22')](respondWithResult(_0x4a4e96,null))[_0x0998('0x2d')](handleError(_0x4a4e96,null));};exports[_0x0998('0x66')]=function(_0x2209c9,_0x352ba2,_0x1b8ab4){var _0x101896='';return db[_0x0998('0x3f')]['findOne']({'where':{'id':_0x2209c9[_0x0998('0x56')]['id']},'attributes':['id',_0x0998('0x67'),_0x0998('0x68'),_0x0998('0x69'),_0x0998('0x6a'),'remoteUri']})[_0x0998('0x22')](handleEntityNotFound(_0x352ba2,null))[_0x0998('0x22')](function(_0x165e09){if(_0x165e09){_0x101896=_0x165e09[_0x0998('0x6b')];var _0x3cc580=_0x101896[_0x0998('0x6c')](-0x1);if(_0x3cc580==='/'){_0x101896=_0x101896[_0x0998('0x6d')](0x0,_0x101896[_0x0998('0x6e')](_0x3cc580));}var _0x1a7ba2={'method':_0x0998('0x6f'),'uri':util[_0x0998('0x70')]('%s/%s',_0x101896,_0x0998('0x71')),'json':!![]};switch(_0x165e09[_0x0998('0x6a')]){case _0x0998('0x68'):_0x1a7ba2[_0x0998('0x72')]={'Authorization':util['format'](_0x0998('0x73'),new Buffer(util[_0x0998('0x70')](_0x0998('0x74'),_0x165e09['username'],_0x165e09[_0x0998('0x68')]))['toString']('base64'))};break;case _0x0998('0x69'):_0x1a7ba2[_0x0998('0x72')]={'Authorization':util['format'](_0x0998('0x73'),new Buffer(util[_0x0998('0x70')](_0x0998('0x75'),_0x165e09[_0x0998('0x67')],_0x165e09[_0x0998('0x69')]))[_0x0998('0x76')]('base64'))};break;default:throw new db['Sequelize']['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x1a7ba2);}})[_0x0998('0x22')](function(_0xc79830){if(_0xc79830){var _0x1a3638=[_0x0998('0x77'),_0x0998('0x78'),_0x0998('0x79'),_0x0998('0x7a')];_[_0x0998('0x7b')](_0xc79830[_0x0998('0x71')],function(_0x1bd98c){return _0x1a3638[_0x0998('0x7c')](_0x1bd98c[_0x0998('0x41')]);});return{'count':_0xc79830[_0x0998('0x71')]['length'],'rows':_['map'](_0xc79830[_0x0998('0x71')],function(_0x5c222a){return{'id':_0x5c222a['id'],'name':_0x5c222a[_0x0998('0x7d')]>0x7?_0x5c222a['title']:_0x5c222a[_0x0998('0x41')],'custom':_0x5c222a[_0x0998('0x7d')]>0x7?!![]:![],'options':_0x5c222a[_0x0998('0x7e')]?_0x5c222a[_0x0998('0x7e')]:_0x5c222a[_0x0998('0x7f')]?_0x5c222a['custom_field_options']:[]};})};}})[_0x0998('0x22')](respondWithResult(_0x352ba2,null))[_0x0998('0x2d')](function(_0x59a1a3){var _0x57ec23=_0x2209c9['query'][_0x0998('0x1e')]?0x1f4:_0x59a1a3[_0x0998('0x80')]||0x1f4;logger['error'](_0x0998('0x81'),_0x0998('0x66'),_0x57ec23,JSON[_0x0998('0x27')](_0x59a1a3));delete _0x59a1a3[_0x0998('0x3c')];if(_0x57ec23===0x191){_0x57ec23=0x190;}_0x352ba2['status'](_0x57ec23)[_0x0998('0x82')](_0x2209c9[_0x0998('0x44')][_0x0998('0x1e')]?{'message':'Wrong\x20credentials','statusCode':_0x59a1a3['statusCode']}:_0x59a1a3);});}; \ No newline at end of file +var _0x939e=['rows','show','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','sort','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Descriptions','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','set','Content-Range','then','destroy','end','stack','name','map','ZendeskAccount','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll'];(function(_0x43a425,_0x312324){var _0x5e97df=function(_0x39c858){while(--_0x39c858){_0x43a425['push'](_0x43a425['shift']());}};_0x5e97df(++_0x312324);}(_0x939e,0x193));var _0xe939=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x939e[_0x42bdad];return _0x122626;};'use strict';var pdf=require(_0xe939('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe939('0x1'));var jsonpatch=require(_0xe939('0x2'));var rp=require(_0xe939('0x3'));var moment=require(_0xe939('0x4'));var BPromise=require(_0xe939('0x5'));var Mustache=require(_0xe939('0x6'));var util=require(_0xe939('0x7'));var path=require(_0xe939('0x8'));var sox=require('sox');var csv=require(_0xe939('0x9'));var ejs=require(_0xe939('0xa'));var fs=require('fs');var _=require(_0xe939('0xb'));var squel=require(_0xe939('0xc'));var crypto=require('crypto');var jsforce=require(_0xe939('0xd'));var deskjs=require(_0xe939('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe939('0xf'));var Redis=require(_0xe939('0x10'));var authService=require(_0xe939('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe939('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe939('0x13'));var utils=require(_0xe939('0x14'));var config=require(_0xe939('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xe939('0x16'));var client=jayson[_0xe939('0x17')][_0xe939('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2c34ba,_0x27f858,_0x22a25b){if(_0x22a25b){var _0x2d9370=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d9370[_0xe939('0x19')](_0x27f858)){return _0x2c34ba;}else{throw new db[(_0xe939('0x1a'))][(_0xe939('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 _0x2c34ba;}}function respondWithRpcPromise(_0x2ce449,_0x117a8c,_0x400339,_0x1d6f58){return new BPromise(function(_0x517beb,_0x77c8f3){var _0x1f102a=_0x1d6f58||client;return _0x1f102a['request'](_0x2ce449,_0x400339)['then'](function(_0x185700){logger['info'](_0xe939('0x1c'),_0x117a8c,_0xe939('0x1d'));logger[_0xe939('0x1e')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x117a8c,_0xe939('0x1d'),JSON['stringify'](_0x185700));if(_0x185700[_0xe939('0x1f')]){if(_0x185700[_0xe939('0x1f')][_0xe939('0x20')]===0x1f4){logger[_0xe939('0x1f')](_0xe939('0x1c'),_0x117a8c,_0x185700['error'][_0xe939('0x21')]);return _0x77c8f3(_0x185700[_0xe939('0x1f')][_0xe939('0x21')]);}logger['error'](_0xe939('0x1c'),_0x117a8c,_0x185700[_0xe939('0x1f')]['message']);return _0x517beb(_0x185700[_0xe939('0x1f')][_0xe939('0x21')]);}else{logger['info'](_0xe939('0x1c'),_0x117a8c,_0xe939('0x1d'));_0x517beb(_0x185700[_0xe939('0x22')]['message']);}})[_0xe939('0x23')](function(_0xdeb97){logger[_0xe939('0x1f')](_0xe939('0x1c'),_0x117a8c,_0xdeb97);_0x77c8f3(_0xdeb97);});});}function respondWithStatusCode(_0x2e7dd2,_0x4e01fc){_0x4e01fc=_0x4e01fc||0xcc;return function(_0x15b275){if(_0x15b275){return _0x2e7dd2[_0xe939('0x24')](_0x4e01fc);}return _0x2e7dd2[_0xe939('0x25')](_0x4e01fc)['end']();};}function respondWithResult(_0xd12830,_0x37f457){_0x37f457=_0x37f457||0xc8;return function(_0x28dfc5){if(_0x28dfc5){return _0xd12830[_0xe939('0x25')](_0x37f457)[_0xe939('0x26')](_0x28dfc5);}};}function respondWithFilteredResult(_0x5de756,_0x4bb216){return function(_0x468e30){if(_0x468e30){var _0x362f2d=_0x468e30['count'],_0x379541=_0x4bb216[_0xe939('0x27')],_0x52c057=_0x4bb216[_0xe939('0x27')]+_0x4bb216['limit'],_0x57a8e8;if(_0x52c057>=_0x362f2d){_0x52c057=_0x362f2d;_0x57a8e8=0xc8;}else{_0x57a8e8=0xce;}_0x5de756['status'](_0x57a8e8);return _0x5de756[_0xe939('0x28')](_0xe939('0x29'),_0x379541+'-'+_0x52c057+'/'+_0x362f2d)[_0xe939('0x26')](_0x468e30);}return null;};}function patchUpdates(_0x165971){return function(_0x3723a4){try{jsonpatch['apply'](_0x3723a4,_0x165971,!![]);}catch(_0x4abdf2){return BPromise['reject'](_0x4abdf2);}return _0x3723a4['save']();};}function saveUpdates(_0x18f71f,_0x41c400){return function(_0x24a4fd){if(_0x24a4fd){return _0x24a4fd['update'](_0x18f71f)[_0xe939('0x2a')](function(_0x4d9cea){return _0x4d9cea;});}return null;};}function removeEntity(_0x55c378,_0x45d57f){return function(_0xcb5477){if(_0xcb5477){return _0xcb5477[_0xe939('0x2b')]()['then'](function(){_0x55c378[_0xe939('0x25')](0xcc)[_0xe939('0x2c')]();});}};}function handleEntityNotFound(_0x1419c1,_0x4d7792){return function(_0x58602d){if(!_0x58602d){_0x1419c1['sendStatus'](0x194);}return _0x58602d;};}function handleError(_0x1c5612,_0x382295){_0x382295=_0x382295||0x1f4;return function(_0x2cadb9){logger[_0xe939('0x1f')](_0x2cadb9[_0xe939('0x2d')]);if(_0x2cadb9['name']){delete _0x2cadb9[_0xe939('0x2e')];}_0x1c5612[_0xe939('0x25')](_0x382295)['send'](_0x2cadb9);};}exports['index']=function(_0x47372b,_0x2f4fc6){var _0xcbbe8d={},_0x5e8d4b={},_0x1faf32={'count':0x0,'rows':[]};var _0xdb58f6=_[_0xe939('0x2f')](db[_0xe939('0x30')][_0xe939('0x31')],function(_0x27ffe5){return{'name':_0x27ffe5['fieldName'],'type':_0x27ffe5[_0xe939('0x32')]['key']};});_0x5e8d4b['model']=_['map'](_0xdb58f6,'name');_0x5e8d4b[_0xe939('0x33')]=_[_0xe939('0x34')](_0x47372b[_0xe939('0x33')]);_0x5e8d4b[_0xe939('0x35')]=_[_0xe939('0x36')](_0x5e8d4b[_0xe939('0x37')],_0x5e8d4b['query']);_0xcbbe8d['attributes']=_['intersection'](_0x5e8d4b['model'],qs[_0xe939('0x38')](_0x47372b['query'][_0xe939('0x38')]));_0xcbbe8d[_0xe939('0x39')]=_0xcbbe8d[_0xe939('0x39')][_0xe939('0x3a')]?_0xcbbe8d['attributes']:_0x5e8d4b[_0xe939('0x37')];if(!_0x47372b['query'][_0xe939('0x3b')](_0xe939('0x3c'))){_0xcbbe8d['limit']=qs['limit'](_0x47372b[_0xe939('0x33')][_0xe939('0x3d')]);_0xcbbe8d[_0xe939('0x27')]=qs[_0xe939('0x27')](_0x47372b['query'][_0xe939('0x27')]);}_0xcbbe8d[_0xe939('0x3e')]=qs['sort'](_0x47372b['query']['sort']);_0xcbbe8d[_0xe939('0x3f')]=qs[_0xe939('0x35')](_[_0xe939('0x40')](_0x47372b[_0xe939('0x33')],_0x5e8d4b[_0xe939('0x35')]),_0xdb58f6);if(_0x47372b[_0xe939('0x33')][_0xe939('0x41')]){_0xcbbe8d[_0xe939('0x3f')]=_[_0xe939('0x42')](_0xcbbe8d[_0xe939('0x3f')],{'$or':_['map'](_0xdb58f6,function(_0x38c887){if(_0x38c887[_0xe939('0x32')]!==_0xe939('0x43')){var _0x26ef1a={};_0x26ef1a[_0x38c887['name']]={'$like':'%'+_0x47372b[_0xe939('0x33')][_0xe939('0x41')]+'%'};return _0x26ef1a;}})});}_0xcbbe8d=_[_0xe939('0x42')]({},_0xcbbe8d,_0x47372b[_0xe939('0x44')]);var _0x376268={'where':_0xcbbe8d['where']};return db[_0xe939('0x30')]['count'](_0x376268)[_0xe939('0x2a')](function(_0x12c429){_0x1faf32[_0xe939('0x45')]=_0x12c429;if(_0x47372b[_0xe939('0x33')][_0xe939('0x46')]){_0xcbbe8d[_0xe939('0x47')]=[{'all':!![]}];}return db[_0xe939('0x30')][_0xe939('0x48')](_0xcbbe8d);})[_0xe939('0x2a')](function(_0x537b79){_0x1faf32[_0xe939('0x49')]=_0x537b79;return _0x1faf32;})['then'](respondWithFilteredResult(_0x2f4fc6,_0xcbbe8d))[_0xe939('0x23')](handleError(_0x2f4fc6,null));};exports[_0xe939('0x4a')]=function(_0x3b6eef,_0xe08e1b){var _0x43bed2={'raw':![],'where':{'id':_0x3b6eef['params']['id']}},_0x4819cb={};_0x4819cb[_0xe939('0x37')]=_[_0xe939('0x34')](db[_0xe939('0x30')][_0xe939('0x31')]);_0x4819cb[_0xe939('0x33')]=_[_0xe939('0x34')](_0x3b6eef[_0xe939('0x33')]);_0x4819cb['filters']=_[_0xe939('0x36')](_0x4819cb['model'],_0x4819cb[_0xe939('0x33')]);_0x43bed2['attributes']=_[_0xe939('0x36')](_0x4819cb[_0xe939('0x37')],qs['fields'](_0x3b6eef[_0xe939('0x33')][_0xe939('0x38')]));_0x43bed2[_0xe939('0x39')]=_0x43bed2[_0xe939('0x39')][_0xe939('0x3a')]?_0x43bed2[_0xe939('0x39')]:_0x4819cb['model'];if(_0x3b6eef[_0xe939('0x33')][_0xe939('0x46')]){_0x43bed2[_0xe939('0x47')]=[{'all':!![]}];}_0x43bed2=_['merge']({},_0x43bed2,_0x3b6eef[_0xe939('0x44')]);return db[_0xe939('0x30')][_0xe939('0x4b')](_0x43bed2)['then'](handleEntityNotFound(_0xe08e1b,null))['then'](respondWithResult(_0xe08e1b,null))['catch'](handleError(_0xe08e1b,null));};exports[_0xe939('0x4c')]=function(_0x3dea5c,_0x2db8ea){return db[_0xe939('0x30')][_0xe939('0x4c')](_0x3dea5c[_0xe939('0x4d')],{})['then'](respondWithResult(_0x2db8ea,0xc9))['catch'](handleError(_0x2db8ea,null));};exports['update']=function(_0x49fdc4,_0x2f6710){if(_0x49fdc4[_0xe939('0x4d')]['id']){delete _0x49fdc4[_0xe939('0x4d')]['id'];}return db[_0xe939('0x30')]['find']({'where':{'id':_0x49fdc4[_0xe939('0x4e')]['id']}})[_0xe939('0x2a')](handleEntityNotFound(_0x2f6710,null))['then'](saveUpdates(_0x49fdc4['body'],null))['then'](respondWithResult(_0x2f6710,null))['catch'](handleError(_0x2f6710,null));};exports[_0xe939('0x2b')]=function(_0x1a592c,_0x1515e7){return db[_0xe939('0x30')][_0xe939('0x4b')]({'where':{'id':_0x1a592c['params']['id']}})[_0xe939('0x2a')](handleEntityNotFound(_0x1515e7,null))[_0xe939('0x2a')](removeEntity(_0x1515e7,null))[_0xe939('0x23')](handleError(_0x1515e7,null));};exports[_0xe939('0x4f')]=function(_0x11ab10,_0x1ddf02,_0x44c6f7){var _0xb18ad3={};var _0x29ee89={};var _0x1695d6;var _0x4a4f17;return db[_0xe939('0x30')][_0xe939('0x50')]({'where':{'id':_0x11ab10[_0xe939('0x4e')]['id']}})[_0xe939('0x2a')](handleEntityNotFound(_0x1ddf02,null))['then'](function(_0x43f3ae){if(_0x43f3ae){_0x1695d6=_0x43f3ae;_0x29ee89[_0xe939('0x37')]=_[_0xe939('0x34')](db[_0xe939('0x51')][_0xe939('0x31')]);_0x29ee89[_0xe939('0x33')]=_[_0xe939('0x34')](_0x11ab10['query']);_0x29ee89[_0xe939('0x35')]=_[_0xe939('0x36')](_0x29ee89[_0xe939('0x37')],_0x29ee89[_0xe939('0x33')]);_0xb18ad3[_0xe939('0x39')]=_['intersection'](_0x29ee89['model'],qs[_0xe939('0x38')](_0x11ab10[_0xe939('0x33')]['fields']));_0xb18ad3['attributes']=_0xb18ad3[_0xe939('0x39')][_0xe939('0x3a')]?_0xb18ad3['attributes']:_0x29ee89['model'];_0xb18ad3[_0xe939('0x3e')]=qs[_0xe939('0x52')](_0x11ab10['query']['sort']);_0xb18ad3[_0xe939('0x3f')]=qs[_0xe939('0x35')](_[_0xe939('0x40')](_0x11ab10['query'],_0x29ee89[_0xe939('0x35')]));if(_0x11ab10['query'][_0xe939('0x41')]){_0xb18ad3[_0xe939('0x3f')]=_['merge'](_0xb18ad3['where'],{'$or':_[_0xe939('0x2f')](_0xb18ad3[_0xe939('0x39')],function(_0x3475cc){var _0x3146de={};_0x3146de[_0x3475cc]={'$like':'%'+_0x11ab10[_0xe939('0x33')][_0xe939('0x41')]+'%'};return _0x3146de;})});}_0xb18ad3=_[_0xe939('0x42')]({},_0xb18ad3,_0x11ab10[_0xe939('0x44')]);return _0x1695d6[_0xe939('0x4f')](_0xb18ad3);}})[_0xe939('0x2a')](function(_0x443b6c){if(_0x443b6c){_0x4a4f17=_0x443b6c[_0xe939('0x3a')];if(!_0x11ab10['query'][_0xe939('0x3b')]('nolimit')){_0xb18ad3[_0xe939('0x3d')]=qs[_0xe939('0x3d')](_0x11ab10[_0xe939('0x33')][_0xe939('0x3d')]);_0xb18ad3[_0xe939('0x27')]=qs['offset'](_0x11ab10[_0xe939('0x33')]['offset']);}return _0x1695d6[_0xe939('0x4f')](_0xb18ad3);}})[_0xe939('0x2a')](function(_0x5aebd2){if(_0x5aebd2){return _0x5aebd2?{'count':_0x4a4f17,'rows':_0x5aebd2}:null;}})['then'](respondWithResult(_0x1ddf02,null))[_0xe939('0x23')](handleError(_0x1ddf02,null));};exports[_0xe939('0x53')]=function(_0x104985,_0x240f0e,_0x30d168){if(_0x104985[_0xe939('0x4d')]['id']){delete _0x104985[_0xe939('0x4d')]['id'];}return db[_0xe939('0x30')][_0xe939('0x50')]({'where':{'id':_0x104985['params']['id']}})['then'](handleEntityNotFound(_0x240f0e,null))['then'](function(_0x564dd9){if(_0x564dd9){_0x104985[_0xe939('0x4d')][_0xe939('0x54')]=_0x564dd9['id'];_0x104985[_0xe939('0x4d')]['Subjects']=integrations[_0xe939('0x55')](_0x104985[_0xe939('0x4d')]['channel'],_0x104985[_0xe939('0x4d')][_0xe939('0x32')]);_0x104985['body']['Descriptions']=integrations['getDescriptions'](_0x104985[_0xe939('0x4d')][_0xe939('0x56')],_0x104985[_0xe939('0x4d')]['type']);return db[_0xe939('0x51')][_0xe939('0x4c')](_0x104985['body'],{'include':[{'model':db[_0xe939('0x57')],'as':'Subjects'},{'model':db[_0xe939('0x57')],'as':_0xe939('0x58')}]});}return null;})[_0xe939('0x2a')](respondWithResult(_0x240f0e,null))[_0xe939('0x23')](handleError(_0x240f0e,null));};exports[_0xe939('0x59')]=function(_0x291e78,_0x3e9b4d,_0x2d82c7){var _0x1f5452='';return db[_0xe939('0x30')][_0xe939('0x50')]({'where':{'id':_0x291e78['params']['id']},'attributes':['id',_0xe939('0x5a'),'password',_0xe939('0x5b'),_0xe939('0x5c'),_0xe939('0x5d')]})[_0xe939('0x2a')](handleEntityNotFound(_0x3e9b4d,null))['then'](function(_0xbbcd1d){if(_0xbbcd1d){_0x1f5452=_0xbbcd1d[_0xe939('0x5d')];var _0x91a9f2=_0x1f5452[_0xe939('0x5e')](-0x1);if(_0x91a9f2==='/'){_0x1f5452=_0x1f5452[_0xe939('0x5f')](0x0,_0x1f5452[_0xe939('0x60')](_0x91a9f2));}var _0x2920a9={'method':_0xe939('0x61'),'uri':util[_0xe939('0x62')](_0xe939('0x63'),_0x1f5452,_0xe939('0x64')),'json':!![]};switch(_0xbbcd1d['authType']){case _0xe939('0x65'):_0x2920a9[_0xe939('0x66')]={'Authorization':util['format'](_0xe939('0x67'),new Buffer(util['format'](_0xe939('0x68'),_0xbbcd1d[_0xe939('0x5a')],_0xbbcd1d['password']))['toString'](_0xe939('0x69')))};break;case _0xe939('0x5b'):_0x2920a9[_0xe939('0x66')]={'Authorization':util['format'](_0xe939('0x67'),new Buffer(util[_0xe939('0x62')](_0xe939('0x6a'),_0xbbcd1d['username'],_0xbbcd1d[_0xe939('0x5b')]))['toString'](_0xe939('0x69')))};break;default:throw new db['Sequelize']['ValidationError'](_0xe939('0x6b'));}return rp(_0x2920a9);}})[_0xe939('0x2a')](function(_0xdd6550){if(_0xdd6550){var _0x4f60b2=[_0xe939('0x6c'),_0xe939('0x6d'),_0xe939('0x6e'),_0xe939('0x6f')];_[_0xe939('0x70')](_0xdd6550[_0xe939('0x64')],function(_0x54b663){return _0x4f60b2[_0xe939('0x71')](_0x54b663['type']);});return{'count':_0xdd6550[_0xe939('0x64')][_0xe939('0x3a')],'rows':_['map'](_0xdd6550['ticket_fields'],function(_0x15b0ef){return{'id':_0x15b0ef['id'],'name':_0x15b0ef[_0xe939('0x72')]>0x7?_0x15b0ef[_0xe939('0x73')]:_0x15b0ef[_0xe939('0x32')],'custom':_0x15b0ef[_0xe939('0x72')]>0x7?!![]:![],'options':_0x15b0ef[_0xe939('0x74')]?_0x15b0ef[_0xe939('0x74')]:_0x15b0ef[_0xe939('0x75')]?_0x15b0ef['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x3e9b4d,null))['catch'](function(_0x44e962){var _0x3b46cb=_0x291e78['query'][_0xe939('0x19')]?0x1f4:_0x44e962[_0xe939('0x76')]||0x1f4;logger[_0xe939('0x1f')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3b46cb,JSON['stringify'](_0x44e962));delete _0x44e962[_0xe939('0x2e')];if(_0x3b46cb===0x191){_0x3b46cb=0x190;}_0x3e9b4d[_0xe939('0x25')](_0x3b46cb)['send'](_0x291e78[_0xe939('0x33')][_0xe939('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x44e962[_0xe939('0x76')]}:_0x44e962);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 0590430..88382f0 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 _0x424f=['request-promise','path','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1b1754,_0x1cc242){var _0x5ce5ab=function(_0x1b38d5){while(--_0x1b38d5){_0x1b1754['push'](_0x1b1754['shift']());}};_0x5ce5ab(++_0x1cc242);}(_0x424f,0x103));var _0xf424=function(_0x582466,_0x5df8bf){_0x582466=_0x582466-0x0;var _0x495b37=_0x424f[_0x582466];return _0x495b37;};'use strict';var _=require(_0xf424('0x0'));var util=require('util');var logger=require(_0xf424('0x1'))(_0xf424('0x2'));var moment=require(_0xf424('0x3'));var BPromise=require(_0xf424('0x4'));var rp=require(_0xf424('0x5'));var fs=require('fs');var path=require(_0xf424('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf424('0x7'));var integrations=require(_0xf424('0x8'));module[_0xf424('0x9')]=function(_0x222be6,_0x86ff37){return _0x222be6['define'](_0xf424('0xa'),attributes,{'tableName':_0xf424('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44d5=['api','moment','bluebird','request-promise','rimraf','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','../../config/logger'];(function(_0x4b36db,_0x3d1ad3){var _0x76fd93=function(_0x534ba6){while(--_0x534ba6){_0x4b36db['push'](_0x4b36db['shift']());}};_0x76fd93(++_0x3d1ad3);}(_0x44d5,0x133));var _0x544d=function(_0x56e5a4,_0x3378ff){_0x56e5a4=_0x56e5a4-0x0;var _0x446855=_0x44d5[_0x56e5a4];return _0x446855;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x544d('0x0'))(_0x544d('0x1'));var moment=require(_0x544d('0x2'));var BPromise=require(_0x544d('0x3'));var rp=require(_0x544d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x544d('0x5'));var config=require('../../config/environment');var attributes=require(_0x544d('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x544d('0x7')]=function(_0xe5ae3f,_0x419d41){return _0xe5ae3f[_0x544d('0x8')](_0x544d('0x9'),attributes,{'tableName':_0x544d('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 937d000..397512c 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x36b559,_0x5a3347){var _0x433afa=function(_0x5e4beb){while(--_0x5e4beb){_0x36b559['push'](_0x36b559['shift']());}};_0x433afa(++_0x5a3347);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb7e7[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file +var _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x1fd481,_0x4229e8){var _0x34f2eb=function(_0x5a7412){while(--_0x5a7412){_0x1fd481['push'](_0x1fd481['shift']());}};_0x34f2eb(++_0x4229e8);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c94729c..1203c82 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 _0xf113=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','put','update','destroy','multer'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0xf113,0x12b));var _0x3f11=function(_0x43a69e,_0x2a677f){_0x43a69e=_0x43a69e-0x0;var _0x34e327=_0xf113[_0x43a69e];return _0x34e327;};'use strict';var multer=require(_0x3f11('0x0'));var util=require(_0x3f11('0x1'));var path=require('path');var timeout=require(_0x3f11('0x2'));var express=require(_0x3f11('0x3'));var router=express[_0x3f11('0x4')]();var auth=require(_0x3f11('0x5'));var interaction=require(_0x3f11('0x6'));var config=require(_0x3f11('0x7'));var controller=require(_0x3f11('0x8'));router['get']('/',auth[_0x3f11('0x9')](),controller[_0x3f11('0xa')]);router[_0x3f11('0xb')](_0x3f11('0xc'),auth[_0x3f11('0x9')](),controller[_0x3f11('0xd')]);router[_0x3f11('0xb')](_0x3f11('0xe'),auth[_0x3f11('0x9')](),controller[_0x3f11('0xf')]);router[_0x3f11('0xb')]('/:id/subjects',auth[_0x3f11('0x9')](),controller[_0x3f11('0x10')]);router[_0x3f11('0xb')](_0x3f11('0x11'),auth[_0x3f11('0x9')](),controller[_0x3f11('0x12')]);router[_0x3f11('0xb')](_0x3f11('0x13'),auth['isAuthenticated'](),controller['getTags']);router[_0x3f11('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3f11('0x14')](_0x3f11('0x13'),auth[_0x3f11('0x9')](),controller[_0x3f11('0x15')]);router[_0x3f11('0x16')](_0x3f11('0xc'),auth[_0x3f11('0x9')](),controller[_0x3f11('0x17')]);router['delete'](_0x3f11('0xc'),auth[_0x3f11('0x9')](),controller[_0x3f11('0x18')]);module['exports']=router; \ No newline at end of file +var _0x55c1=['delete','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update'];(function(_0x2f752b,_0xd9ed33){var _0x3e8d72=function(_0x186911){while(--_0x186911){_0x2f752b['push'](_0x2f752b['shift']());}};_0x3e8d72(++_0xd9ed33);}(_0x55c1,0x1e2));var _0x155c=function(_0x27714d,_0x457b53){_0x27714d=_0x27714d-0x0;var _0x18e2fb=_0x55c1[_0x27714d];return _0x18e2fb;};'use strict';var multer=require(_0x155c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x155c('0x1'));var router=express[_0x155c('0x2')]();var auth=require(_0x155c('0x3'));var interaction=require(_0x155c('0x4'));var config=require('../../config/environment');var controller=require(_0x155c('0x5'));router[_0x155c('0x6')]('/',auth[_0x155c('0x7')](),controller['index']);router['get'](_0x155c('0x8'),auth[_0x155c('0x7')](),controller[_0x155c('0x9')]);router['get'](_0x155c('0xa'),auth[_0x155c('0x7')](),controller[_0x155c('0xb')]);router[_0x155c('0x6')](_0x155c('0xc'),auth[_0x155c('0x7')](),controller[_0x155c('0xd')]);router[_0x155c('0x6')](_0x155c('0xe'),auth[_0x155c('0x7')](),controller[_0x155c('0xf')]);router[_0x155c('0x6')](_0x155c('0x10'),auth[_0x155c('0x7')](),controller[_0x155c('0x11')]);router[_0x155c('0x12')]('/',auth[_0x155c('0x7')](),controller[_0x155c('0x13')]);router[_0x155c('0x12')]('/:id/tags',auth[_0x155c('0x7')](),controller['setTags']);router[_0x155c('0x14')](_0x155c('0x8'),auth[_0x155c('0x7')](),controller[_0x155c('0x15')]);router[_0x155c('0x16')](_0x155c('0x8'),auth[_0x155c('0x7')](),controller[_0x155c('0x17')]);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 7911e27..4452197 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 _0x742b=['STRING'];(function(_0x33347a,_0x1ed1dd){var _0x23d9b1=function(_0x5d6c98){while(--_0x5d6c98){_0x33347a['push'](_0x33347a['shift']());}};_0x23d9b1(++_0x1ed1dd);}(_0x742b,0x1c9));var _0xb742=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x742b[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb742('0x0')]},'description':{'type':Sequelize[_0xb742('0x0')]}}; \ No newline at end of file +var _0x275c=['STRING','sequelize','exports'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x275c,0x88));var _0xc275=function(_0x5306cf,_0x3a22a6){_0x5306cf=_0x5306cf-0x0;var _0x44c8e2=_0x275c[_0x5306cf];return _0x44c8e2;};'use strict';var Sequelize=require(_0xc275('0x0'));module[_0xc275('0x1')]={'name':{'type':Sequelize[_0xc275('0x2')]},'description':{'type':Sequelize[_0xc275('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 64e3773..a5dc743 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 _0x48e0=['../../config/logger','../../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','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','create','body','find','params','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','setTags','ids','html-pdf','zip-dir','moment','util','path','sox','to-csv','crypto','desk.js','papaparse'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x48e0,0xa8));var _0x048e=function(_0x248811,_0xc05bc9){_0x248811=_0x248811-0x0;var _0x5aff06=_0x48e0[_0x248811];return _0x5aff06;};'use strict';var pdf=require(_0x048e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x048e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x048e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x048e('0x3'));var path=require(_0x048e('0x4'));var sox=require(_0x048e('0x5'));var csv=require(_0x048e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x048e('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x048e('0x8'));var toCsv=require(_0x048e('0x6'));var querystring=require('querystring');var Papa=require(_0x048e('0x9'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x048e('0xa'))('api');var utils=require(_0x048e('0xb'));var config=require(_0x048e('0xc'));var db=require(_0x048e('0xd'))['db'];var jayson=require(_0x048e('0xe'));var client=jayson[_0x048e('0xf')][_0x048e('0x10')]({'port':0x232a});function checkPasswordPattern(_0x5e04c6,_0x3cffad,_0xd1d4ee){if(_0xd1d4ee){var _0x2edbdc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2edbdc[_0x048e('0x11')](_0x3cffad)){return _0x5e04c6;}else{throw new db[(_0x048e('0x12'))][(_0x048e('0x13'))](_0x048e('0x14'));}}else{return _0x5e04c6;}}function respondWithRpcPromise(_0x59cc6b,_0x3100c5,_0x42700b,_0x41a23d){return new BPromise(function(_0x1bd090,_0x1cc244){var _0x2c3273=_0x41a23d||client;return _0x2c3273[_0x048e('0x15')](_0x59cc6b,_0x42700b)[_0x048e('0x16')](function(_0x3e1cbb){logger['info'](_0x048e('0x17'),_0x3100c5,_0x048e('0x18'));logger['debug'](_0x048e('0x19'),_0x3100c5,_0x048e('0x18'),JSON[_0x048e('0x1a')](_0x3e1cbb));if(_0x3e1cbb[_0x048e('0x1b')]){if(_0x3e1cbb['error'][_0x048e('0x1c')]===0x1f4){logger[_0x048e('0x1b')](_0x048e('0x17'),_0x3100c5,_0x3e1cbb[_0x048e('0x1b')]['message']);return _0x1cc244(_0x3e1cbb[_0x048e('0x1b')][_0x048e('0x1d')]);}logger[_0x048e('0x1b')](_0x048e('0x17'),_0x3100c5,_0x3e1cbb[_0x048e('0x1b')][_0x048e('0x1d')]);return _0x1bd090(_0x3e1cbb['error'][_0x048e('0x1d')]);}else{logger[_0x048e('0x1e')](_0x048e('0x17'),_0x3100c5,'request\x20sent');_0x1bd090(_0x3e1cbb['result'][_0x048e('0x1d')]);}})[_0x048e('0x1f')](function(_0x4dff92){logger['error'](_0x048e('0x17'),_0x3100c5,_0x4dff92);_0x1cc244(_0x4dff92);});});}function respondWithStatusCode(_0x289874,_0x5e52e2){_0x5e52e2=_0x5e52e2||0xcc;return function(_0x28eaf1){if(_0x28eaf1){return _0x289874['sendStatus'](_0x5e52e2);}return _0x289874[_0x048e('0x20')](_0x5e52e2)[_0x048e('0x21')]();};}function respondWithResult(_0x278552,_0x1472ce){_0x1472ce=_0x1472ce||0xc8;return function(_0x1739b8){if(_0x1739b8){return _0x278552[_0x048e('0x20')](_0x1472ce)[_0x048e('0x22')](_0x1739b8);}};}function respondWithFilteredResult(_0x2095cb,_0x539db3){return function(_0x275889){if(_0x275889){var _0x54f357=_0x275889[_0x048e('0x23')],_0x19a910=_0x539db3[_0x048e('0x24')],_0x59ef22=_0x539db3[_0x048e('0x24')]+_0x539db3[_0x048e('0x25')],_0x11307b;if(_0x59ef22>=_0x54f357){_0x59ef22=_0x54f357;_0x11307b=0xc8;}else{_0x11307b=0xce;}_0x2095cb[_0x048e('0x20')](_0x11307b);return _0x2095cb[_0x048e('0x26')](_0x048e('0x27'),_0x19a910+'-'+_0x59ef22+'/'+_0x54f357)['json'](_0x275889);}return null;};}function patchUpdates(_0xe6f82b){return function(_0xae2155){try{jsonpatch[_0x048e('0x28')](_0xae2155,_0xe6f82b,!![]);}catch(_0x5402cb){return BPromise[_0x048e('0x29')](_0x5402cb);}return _0xae2155[_0x048e('0x2a')]();};}function saveUpdates(_0x29a7b3,_0x31a80d){return function(_0xd9cba9){if(_0xd9cba9){return _0xd9cba9[_0x048e('0x2b')](_0x29a7b3)[_0x048e('0x16')](function(_0x440ac7){return _0x440ac7;});}return null;};}function removeEntity(_0x2f927b,_0x208c15){return function(_0x417f0a){if(_0x417f0a){return _0x417f0a[_0x048e('0x2c')]()[_0x048e('0x16')](function(){_0x2f927b[_0x048e('0x20')](0xcc)[_0x048e('0x21')]();});}};}function handleEntityNotFound(_0x393733,_0x56e535){return function(_0x19fe1d){if(!_0x19fe1d){_0x393733[_0x048e('0x2d')](0x194);}return _0x19fe1d;};}function handleError(_0x350e60,_0x393616){_0x393616=_0x393616||0x1f4;return function(_0x27a09a){logger[_0x048e('0x1b')](_0x27a09a[_0x048e('0x2e')]);if(_0x27a09a['name']){delete _0x27a09a[_0x048e('0x2f')];}_0x350e60[_0x048e('0x20')](_0x393616)['send'](_0x27a09a);};}exports['index']=function(_0x12d224,_0x429919){var _0x201014={},_0x5365ef={},_0x452452={'count':0x0,'rows':[]};var _0x172638=_[_0x048e('0x30')](db[_0x048e('0x31')][_0x048e('0x32')],function(_0xb4c498){return{'name':_0xb4c498[_0x048e('0x33')],'type':_0xb4c498[_0x048e('0x34')][_0x048e('0x35')]};});_0x5365ef['model']=_['map'](_0x172638,_0x048e('0x2f'));_0x5365ef['query']=_[_0x048e('0x36')](_0x12d224[_0x048e('0x37')]);_0x5365ef[_0x048e('0x38')]=_[_0x048e('0x39')](_0x5365ef['model'],_0x5365ef['query']);_0x201014[_0x048e('0x3a')]=_[_0x048e('0x39')](_0x5365ef[_0x048e('0x3b')],qs[_0x048e('0x3c')](_0x12d224[_0x048e('0x37')]['fields']));_0x201014[_0x048e('0x3a')]=_0x201014[_0x048e('0x3a')][_0x048e('0x3d')]?_0x201014[_0x048e('0x3a')]:_0x5365ef[_0x048e('0x3b')];if(!_0x12d224['query'][_0x048e('0x3e')](_0x048e('0x3f'))){_0x201014[_0x048e('0x25')]=qs['limit'](_0x12d224[_0x048e('0x37')][_0x048e('0x25')]);_0x201014['offset']=qs[_0x048e('0x24')](_0x12d224[_0x048e('0x37')][_0x048e('0x24')]);}_0x201014[_0x048e('0x40')]=qs['sort'](_0x12d224[_0x048e('0x37')][_0x048e('0x41')]);_0x201014[_0x048e('0x42')]=qs[_0x048e('0x38')](_[_0x048e('0x43')](_0x12d224[_0x048e('0x37')],_0x5365ef['filters']),_0x172638);if(_0x12d224[_0x048e('0x37')][_0x048e('0x44')]){_0x201014['where']=_[_0x048e('0x45')](_0x201014['where'],{'$or':_[_0x048e('0x30')](_0x172638,function(_0x472070){if(_0x472070[_0x048e('0x34')]!==_0x048e('0x46')){var _0x298f76={};_0x298f76[_0x472070[_0x048e('0x2f')]]={'$like':'%'+_0x12d224[_0x048e('0x37')][_0x048e('0x44')]+'%'};return _0x298f76;}})});}_0x201014=_['merge']({},_0x201014,_0x12d224[_0x048e('0x47')]);var _0x570e9c={'where':_0x201014[_0x048e('0x42')]};return db[_0x048e('0x31')]['count'](_0x570e9c)[_0x048e('0x16')](function(_0x3271a7){_0x452452[_0x048e('0x23')]=_0x3271a7;if(_0x12d224[_0x048e('0x37')]['includeAll']){_0x201014[_0x048e('0x48')]=[{'all':!![]}];}return db[_0x048e('0x31')][_0x048e('0x49')](_0x201014);})[_0x048e('0x16')](function(_0x4c4bc3){_0x452452[_0x048e('0x4a')]=_0x4c4bc3;return _0x452452;})['then'](respondWithFilteredResult(_0x429919,_0x201014))[_0x048e('0x1f')](handleError(_0x429919,null));};exports[_0x048e('0x4b')]=function(_0x46b873,_0x4280b6){var _0x38027b={'raw':![],'where':{'id':_0x46b873['params']['id']}},_0xe3ac7b={};_0xe3ac7b[_0x048e('0x3b')]=_[_0x048e('0x36')](db[_0x048e('0x31')][_0x048e('0x32')]);_0xe3ac7b[_0x048e('0x37')]=_[_0x048e('0x36')](_0x46b873[_0x048e('0x37')]);_0xe3ac7b[_0x048e('0x38')]=_[_0x048e('0x39')](_0xe3ac7b[_0x048e('0x3b')],_0xe3ac7b[_0x048e('0x37')]);_0x38027b['attributes']=_[_0x048e('0x39')](_0xe3ac7b['model'],qs[_0x048e('0x3c')](_0x46b873[_0x048e('0x37')][_0x048e('0x3c')]));_0x38027b[_0x048e('0x3a')]=_0x38027b['attributes']['length']?_0x38027b[_0x048e('0x3a')]:_0xe3ac7b[_0x048e('0x3b')];if(_0x46b873[_0x048e('0x37')][_0x048e('0x4c')]){_0x38027b[_0x048e('0x48')]=[{'all':!![]}];}_0x38027b=_['merge']({},_0x38027b,_0x46b873['options']);return db[_0x048e('0x31')]['find'](_0x38027b)[_0x048e('0x16')](handleEntityNotFound(_0x4280b6,null))[_0x048e('0x16')](respondWithResult(_0x4280b6,null))['catch'](handleError(_0x4280b6,null));};exports[_0x048e('0x4d')]=function(_0x3c38d7,_0x589b70){return db[_0x048e('0x31')][_0x048e('0x4d')](_0x3c38d7[_0x048e('0x4e')],{})[_0x048e('0x16')](respondWithResult(_0x589b70,0xc9))[_0x048e('0x1f')](handleError(_0x589b70,null));};exports[_0x048e('0x2b')]=function(_0x4f7340,_0x428599){if(_0x4f7340['body']['id']){delete _0x4f7340['body']['id'];}return db[_0x048e('0x31')][_0x048e('0x4f')]({'where':{'id':_0x4f7340['params']['id']}})[_0x048e('0x16')](handleEntityNotFound(_0x428599,null))[_0x048e('0x16')](saveUpdates(_0x4f7340[_0x048e('0x4e')],null))[_0x048e('0x16')](respondWithResult(_0x428599,null))['catch'](handleError(_0x428599,null));};exports[_0x048e('0x2c')]=function(_0x4e92d0,_0x21422f){return db[_0x048e('0x31')]['find']({'where':{'id':_0x4e92d0[_0x048e('0x50')]['id']}})['then'](handleEntityNotFound(_0x21422f,null))[_0x048e('0x16')](removeEntity(_0x21422f,null))['catch'](handleError(_0x21422f,null));};exports[_0x048e('0x51')]=function(_0x1d8a7b,_0x1fe5f4,_0x544330){var _0x97dbce={};var _0x5a868d={};var _0x249927;var _0x579d88;return db[_0x048e('0x31')]['findOne']({'where':{'id':_0x1d8a7b[_0x048e('0x50')]['id']}})[_0x048e('0x16')](handleEntityNotFound(_0x1fe5f4,null))[_0x048e('0x16')](function(_0x188e2f){if(_0x188e2f){_0x249927=_0x188e2f;_0x5a868d[_0x048e('0x3b')]=_[_0x048e('0x36')](db[_0x048e('0x52')][_0x048e('0x32')]);_0x5a868d['query']=_['keys'](_0x1d8a7b[_0x048e('0x37')]);_0x5a868d['filters']=_[_0x048e('0x39')](_0x5a868d[_0x048e('0x3b')],_0x5a868d[_0x048e('0x37')]);_0x97dbce[_0x048e('0x3a')]=_[_0x048e('0x39')](_0x5a868d[_0x048e('0x3b')],qs[_0x048e('0x3c')](_0x1d8a7b[_0x048e('0x37')][_0x048e('0x3c')]));_0x97dbce[_0x048e('0x3a')]=_0x97dbce['attributes'][_0x048e('0x3d')]?_0x97dbce[_0x048e('0x3a')]:_0x5a868d[_0x048e('0x3b')];_0x97dbce[_0x048e('0x40')]=qs[_0x048e('0x41')](_0x1d8a7b['query'][_0x048e('0x41')]);_0x97dbce['where']=qs['filters'](_[_0x048e('0x43')](_0x1d8a7b['query'],_0x5a868d['filters']));if(_0x1d8a7b[_0x048e('0x37')]['filter']){_0x97dbce['where']=_[_0x048e('0x45')](_0x97dbce['where'],{'$or':_[_0x048e('0x30')](_0x97dbce[_0x048e('0x3a')],function(_0x25077c){var _0x3da655={};_0x3da655[_0x25077c]={'$like':'%'+_0x1d8a7b[_0x048e('0x37')][_0x048e('0x44')]+'%'};return _0x3da655;})});}_0x97dbce=_[_0x048e('0x45')]({},_0x97dbce,_0x1d8a7b['options']);return _0x249927[_0x048e('0x51')](_0x97dbce);}})[_0x048e('0x16')](function(_0x145cf9){if(_0x145cf9){_0x579d88=_0x145cf9[_0x048e('0x3d')];if(!_0x1d8a7b[_0x048e('0x37')][_0x048e('0x3e')](_0x048e('0x3f'))){_0x97dbce[_0x048e('0x25')]=qs[_0x048e('0x25')](_0x1d8a7b[_0x048e('0x37')][_0x048e('0x25')]);_0x97dbce['offset']=qs['offset'](_0x1d8a7b['query'][_0x048e('0x24')]);}return _0x249927['getFields'](_0x97dbce);}})[_0x048e('0x16')](function(_0x5f44ec){if(_0x5f44ec){return _0x5f44ec?{'count':_0x579d88,'rows':_0x5f44ec}:null;}})[_0x048e('0x16')](respondWithResult(_0x1fe5f4,null))[_0x048e('0x1f')](handleError(_0x1fe5f4,null));};exports[_0x048e('0x53')]=function(_0x128d44,_0x1eb9b1,_0x4ece9a){var _0x298bc0={};var _0x519944={};var _0xfd0a62;var _0x8765b8;return db[_0x048e('0x31')][_0x048e('0x54')]({'where':{'id':_0x128d44[_0x048e('0x50')]['id']}})[_0x048e('0x16')](handleEntityNotFound(_0x1eb9b1,null))[_0x048e('0x16')](function(_0x19dafc){if(_0x19dafc){_0xfd0a62=_0x19dafc;_0x519944[_0x048e('0x3b')]=_['keys'](db[_0x048e('0x52')][_0x048e('0x32')]);_0x519944[_0x048e('0x37')]=_[_0x048e('0x36')](_0x128d44[_0x048e('0x37')]);_0x519944[_0x048e('0x38')]=_[_0x048e('0x39')](_0x519944['model'],_0x519944['query']);_0x298bc0['attributes']=_[_0x048e('0x39')](_0x519944['model'],qs[_0x048e('0x3c')](_0x128d44['query'][_0x048e('0x3c')]));_0x298bc0['attributes']=_0x298bc0[_0x048e('0x3a')]['length']?_0x298bc0[_0x048e('0x3a')]:_0x519944[_0x048e('0x3b')];_0x298bc0['order']=qs[_0x048e('0x41')](_0x128d44[_0x048e('0x37')]['sort']);_0x298bc0['where']=qs[_0x048e('0x38')](_[_0x048e('0x43')](_0x128d44['query'],_0x519944['filters']));if(_0x128d44[_0x048e('0x37')][_0x048e('0x44')]){_0x298bc0[_0x048e('0x42')]=_[_0x048e('0x45')](_0x298bc0[_0x048e('0x42')],{'$or':_[_0x048e('0x30')](_0x298bc0[_0x048e('0x3a')],function(_0x3b00d8){var _0x102717={};_0x102717[_0x3b00d8]={'$like':'%'+_0x128d44['query'][_0x048e('0x44')]+'%'};return _0x102717;})});}_0x298bc0=_[_0x048e('0x45')]({},_0x298bc0,_0x128d44['options']);return _0xfd0a62['getSubjects'](_0x298bc0);}})[_0x048e('0x16')](function(_0x12d413){if(_0x12d413){_0x8765b8=_0x12d413[_0x048e('0x3d')];if(!_0x128d44[_0x048e('0x37')][_0x048e('0x3e')](_0x048e('0x3f'))){_0x298bc0[_0x048e('0x25')]=qs['limit'](_0x128d44[_0x048e('0x37')][_0x048e('0x25')]);_0x298bc0[_0x048e('0x24')]=qs[_0x048e('0x24')](_0x128d44[_0x048e('0x37')][_0x048e('0x24')]);}return _0xfd0a62[_0x048e('0x53')](_0x298bc0);}})[_0x048e('0x16')](function(_0x4732b7){if(_0x4732b7){return _0x4732b7?{'count':_0x8765b8,'rows':_0x4732b7}:null;}})['then'](respondWithResult(_0x1eb9b1,null))[_0x048e('0x1f')](handleError(_0x1eb9b1,null));};exports[_0x048e('0x55')]=function(_0x98fe0a,_0x54ea9c,_0xd562e0){var _0x1b0796={};var _0x21e8c7={};var _0x2d0a79;var _0x49881a;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x98fe0a[_0x048e('0x50')]['id']}})[_0x048e('0x16')](handleEntityNotFound(_0x54ea9c,null))[_0x048e('0x16')](function(_0x19ba54){if(_0x19ba54){_0x2d0a79=_0x19ba54;_0x21e8c7[_0x048e('0x3b')]=_[_0x048e('0x36')](db['ZendeskField'][_0x048e('0x32')]);_0x21e8c7[_0x048e('0x37')]=_[_0x048e('0x36')](_0x98fe0a['query']);_0x21e8c7[_0x048e('0x38')]=_[_0x048e('0x39')](_0x21e8c7['model'],_0x21e8c7['query']);_0x1b0796['attributes']=_[_0x048e('0x39')](_0x21e8c7['model'],qs['fields'](_0x98fe0a[_0x048e('0x37')][_0x048e('0x3c')]));_0x1b0796[_0x048e('0x3a')]=_0x1b0796[_0x048e('0x3a')][_0x048e('0x3d')]?_0x1b0796['attributes']:_0x21e8c7[_0x048e('0x3b')];_0x1b0796['order']=qs[_0x048e('0x41')](_0x98fe0a[_0x048e('0x37')][_0x048e('0x41')]);_0x1b0796[_0x048e('0x42')]=qs[_0x048e('0x38')](_[_0x048e('0x43')](_0x98fe0a[_0x048e('0x37')],_0x21e8c7[_0x048e('0x38')]));if(_0x98fe0a[_0x048e('0x37')]['filter']){_0x1b0796['where']=_[_0x048e('0x45')](_0x1b0796['where'],{'$or':_[_0x048e('0x30')](_0x1b0796[_0x048e('0x3a')],function(_0x975739){var _0x1be6a1={};_0x1be6a1[_0x975739]={'$like':'%'+_0x98fe0a[_0x048e('0x37')][_0x048e('0x44')]+'%'};return _0x1be6a1;})});}_0x1b0796=_[_0x048e('0x45')]({},_0x1b0796,_0x98fe0a[_0x048e('0x47')]);return _0x2d0a79['getDescriptions'](_0x1b0796);}})[_0x048e('0x16')](function(_0xf742f5){if(_0xf742f5){_0x49881a=_0xf742f5['length'];if(!_0x98fe0a['query'][_0x048e('0x3e')](_0x048e('0x3f'))){_0x1b0796[_0x048e('0x25')]=qs[_0x048e('0x25')](_0x98fe0a[_0x048e('0x37')][_0x048e('0x25')]);_0x1b0796[_0x048e('0x24')]=qs[_0x048e('0x24')](_0x98fe0a[_0x048e('0x37')]['offset']);}return _0x2d0a79[_0x048e('0x55')](_0x1b0796);}})[_0x048e('0x16')](function(_0x433f2f){if(_0x433f2f){return _0x433f2f?{'count':_0x49881a,'rows':_0x433f2f}:null;}})[_0x048e('0x16')](respondWithResult(_0x54ea9c,null))[_0x048e('0x1f')](handleError(_0x54ea9c,null));};exports[_0x048e('0x56')]=function(_0x252a95,_0x2dfa2b,_0x31e5ec){var _0x1868e5={};var _0x54d47b={};var _0x15c676;var _0x18a390;return db[_0x048e('0x31')]['findOne']({'where':{'id':_0x252a95[_0x048e('0x50')]['id']}})[_0x048e('0x16')](handleEntityNotFound(_0x2dfa2b,null))[_0x048e('0x16')](function(_0xd27ca4){if(_0xd27ca4){_0x15c676=_0xd27ca4;_0x54d47b[_0x048e('0x3b')]=_[_0x048e('0x36')](db['Tag'][_0x048e('0x32')]);_0x54d47b[_0x048e('0x37')]=_[_0x048e('0x36')](_0x252a95[_0x048e('0x37')]);_0x54d47b['filters']=_[_0x048e('0x39')](_0x54d47b[_0x048e('0x3b')],_0x54d47b[_0x048e('0x37')]);_0x1868e5[_0x048e('0x3a')]=_[_0x048e('0x39')](_0x54d47b[_0x048e('0x3b')],qs[_0x048e('0x3c')](_0x252a95['query']['fields']));_0x1868e5[_0x048e('0x3a')]=_0x1868e5['attributes'][_0x048e('0x3d')]?_0x1868e5[_0x048e('0x3a')]:_0x54d47b[_0x048e('0x3b')];_0x1868e5[_0x048e('0x40')]=qs['sort'](_0x252a95[_0x048e('0x37')][_0x048e('0x41')]);_0x1868e5['where']=qs[_0x048e('0x38')](_[_0x048e('0x43')](_0x252a95[_0x048e('0x37')],_0x54d47b[_0x048e('0x38')]));if(_0x252a95[_0x048e('0x37')]['filter']){_0x1868e5[_0x048e('0x42')]=_[_0x048e('0x45')](_0x1868e5[_0x048e('0x42')],{'$or':_[_0x048e('0x30')](_0x1868e5[_0x048e('0x3a')],function(_0x24eb6d){var _0x2795db={};_0x2795db[_0x24eb6d]={'$like':'%'+_0x252a95[_0x048e('0x37')][_0x048e('0x44')]+'%'};return _0x2795db;})});}_0x1868e5=_[_0x048e('0x45')]({},_0x1868e5,_0x252a95[_0x048e('0x47')]);return _0x15c676[_0x048e('0x56')](_0x1868e5);}})[_0x048e('0x16')](function(_0x113b6c){if(_0x113b6c){_0x18a390=_0x113b6c[_0x048e('0x3d')];if(!_0x252a95['query'][_0x048e('0x3e')](_0x048e('0x3f'))){_0x1868e5['limit']=qs[_0x048e('0x25')](_0x252a95[_0x048e('0x37')][_0x048e('0x25')]);_0x1868e5['offset']=qs['offset'](_0x252a95[_0x048e('0x37')][_0x048e('0x24')]);}return _0x15c676['getTags'](_0x1868e5);}})[_0x048e('0x16')](function(_0x1d4745){if(_0x1d4745){return _0x1d4745?{'count':_0x18a390,'rows':_0x1d4745}:null;}})[_0x048e('0x16')](respondWithResult(_0x2dfa2b,null))[_0x048e('0x1f')](handleError(_0x2dfa2b,null));};exports[_0x048e('0x57')]=function(_0x41587d,_0x4e117e,_0x395c5e){if(_0x41587d[_0x048e('0x4e')]['id']){delete _0x41587d['body']['id'];}return db[_0x048e('0x31')][_0x048e('0x54')]({'where':{'id':_0x41587d[_0x048e('0x50')]['id']}})[_0x048e('0x16')](handleEntityNotFound(_0x4e117e,null))['then'](function(_0x3c3b3d){if(_0x3c3b3d){return _0x3c3b3d[_0x048e('0x57')](_0x41587d[_0x048e('0x4e')][_0x048e('0x58')]||[]);}return null;})[_0x048e('0x16')](respondWithResult(_0x4e117e,null))[_0x048e('0x1f')](handleError(_0x4e117e,null));}; \ No newline at end of file +var _0xe3ed=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','limit','set','reject','save','update','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZendeskConfiguration','findAll','rows','params','filters','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','then','info'];(function(_0x5d99bb,_0x10e04b){var _0xdfe846=function(_0x2e3377){while(--_0x2e3377){_0x5d99bb['push'](_0x5d99bb['shift']());}};_0xdfe846(++_0x10e04b);}(_0xe3ed,0x1bf));var _0xde3e=function(_0x4ef870,_0x458b7b){_0x4ef870=_0x4ef870-0x0;var _0x59c0eb=_0xe3ed[_0x4ef870];return _0x59c0eb;};'use strict';var pdf=require(_0xde3e('0x0'));var emlformat=require(_0xde3e('0x1'));var rimraf=require(_0xde3e('0x2'));var zipdir=require(_0xde3e('0x3'));var jsonpatch=require(_0xde3e('0x4'));var rp=require('request-promise');var moment=require(_0xde3e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xde3e('0x6'));var util=require('util');var path=require(_0xde3e('0x7'));var sox=require('sox');var csv=require(_0xde3e('0x8'));var ejs=require(_0xde3e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xde3e('0xa'));var crypto=require(_0xde3e('0xb'));var jsforce=require(_0xde3e('0xc'));var deskjs=require(_0xde3e('0xd'));var toCsv=require(_0xde3e('0x8'));var querystring=require(_0xde3e('0xe'));var Papa=require(_0xde3e('0xf'));var Redis=require(_0xde3e('0x10'));var authService=require(_0xde3e('0x11'));var qs=require(_0xde3e('0x12'));var as=require(_0xde3e('0x13'));var hardwareService=require(_0xde3e('0x14'));var logger=require(_0xde3e('0x15'))(_0xde3e('0x16'));var utils=require(_0xde3e('0x17'));var config=require(_0xde3e('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xde3e('0x19'));var client=jayson[_0xde3e('0x1a')][_0xde3e('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4b46f7,_0x327094,_0x3627cd){if(_0x3627cd){var _0x4db2d8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4db2d8[_0xde3e('0x1c')](_0x327094)){return _0x4b46f7;}else{throw new db[(_0xde3e('0x1d'))][(_0xde3e('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 _0x4b46f7;}}function respondWithRpcPromise(_0x7b610d,_0x2d0901,_0x2b2be1,_0x2b85f9){return new BPromise(function(_0x50ad0d,_0x4e83b4){var _0x583bc7=_0x2b85f9||client;return _0x583bc7['request'](_0x7b610d,_0x2b2be1)[_0xde3e('0x1f')](function(_0x5a48d0){logger[_0xde3e('0x20')](_0xde3e('0x21'),_0x2d0901,_0xde3e('0x22'));logger[_0xde3e('0x23')](_0xde3e('0x24'),_0x2d0901,_0xde3e('0x22'),JSON['stringify'](_0x5a48d0));if(_0x5a48d0[_0xde3e('0x25')]){if(_0x5a48d0[_0xde3e('0x25')]['code']===0x1f4){logger['error'](_0xde3e('0x21'),_0x2d0901,_0x5a48d0[_0xde3e('0x25')][_0xde3e('0x26')]);return _0x4e83b4(_0x5a48d0[_0xde3e('0x25')][_0xde3e('0x26')]);}logger[_0xde3e('0x25')](_0xde3e('0x21'),_0x2d0901,_0x5a48d0[_0xde3e('0x25')]['message']);return _0x50ad0d(_0x5a48d0['error']['message']);}else{logger[_0xde3e('0x20')](_0xde3e('0x21'),_0x2d0901,'request\x20sent');_0x50ad0d(_0x5a48d0[_0xde3e('0x27')][_0xde3e('0x26')]);}})[_0xde3e('0x28')](function(_0x5f155a){logger[_0xde3e('0x25')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2d0901,_0x5f155a);_0x4e83b4(_0x5f155a);});});}function respondWithStatusCode(_0x17ce13,_0x1f308a){_0x1f308a=_0x1f308a||0xcc;return function(_0x12c805){if(_0x12c805){return _0x17ce13['sendStatus'](_0x1f308a);}return _0x17ce13[_0xde3e('0x29')](_0x1f308a)[_0xde3e('0x2a')]();};}function respondWithResult(_0x41183d,_0x4e6471){_0x4e6471=_0x4e6471||0xc8;return function(_0x456b5f){if(_0x456b5f){return _0x41183d[_0xde3e('0x29')](_0x4e6471)[_0xde3e('0x2b')](_0x456b5f);}};}function respondWithFilteredResult(_0x2a34eb,_0x3c3a58){return function(_0x383035){if(_0x383035){var _0x4a03f1=_0x383035[_0xde3e('0x2c')],_0x19458e=_0x3c3a58[_0xde3e('0x2d')],_0x55bf38=_0x3c3a58[_0xde3e('0x2d')]+_0x3c3a58[_0xde3e('0x2e')],_0x4629ef;if(_0x55bf38>=_0x4a03f1){_0x55bf38=_0x4a03f1;_0x4629ef=0xc8;}else{_0x4629ef=0xce;}_0x2a34eb[_0xde3e('0x29')](_0x4629ef);return _0x2a34eb[_0xde3e('0x2f')]('Content-Range',_0x19458e+'-'+_0x55bf38+'/'+_0x4a03f1)[_0xde3e('0x2b')](_0x383035);}return null;};}function patchUpdates(_0x137921){return function(_0x442e50){try{jsonpatch['apply'](_0x442e50,_0x137921,!![]);}catch(_0x461fa2){return BPromise[_0xde3e('0x30')](_0x461fa2);}return _0x442e50[_0xde3e('0x31')]();};}function saveUpdates(_0x2bfd66,_0x17abf8){return function(_0x28ce60){if(_0x28ce60){return _0x28ce60[_0xde3e('0x32')](_0x2bfd66)['then'](function(_0x2af06b){return _0x2af06b;});}return null;};}function removeEntity(_0x4111bf,_0x4fb107){return function(_0x39341c){if(_0x39341c){return _0x39341c['destroy']()[_0xde3e('0x1f')](function(){_0x4111bf[_0xde3e('0x29')](0xcc)[_0xde3e('0x2a')]();});}};}function handleEntityNotFound(_0x31183b,_0xb940d8){return function(_0x1e26c8){if(!_0x1e26c8){_0x31183b[_0xde3e('0x33')](0x194);}return _0x1e26c8;};}function handleError(_0x130698,_0x16862d){_0x16862d=_0x16862d||0x1f4;return function(_0xf4e9c1){logger[_0xde3e('0x25')](_0xf4e9c1['stack']);if(_0xf4e9c1[_0xde3e('0x34')]){delete _0xf4e9c1[_0xde3e('0x34')];}_0x130698[_0xde3e('0x29')](_0x16862d)[_0xde3e('0x35')](_0xf4e9c1);};}exports[_0xde3e('0x36')]=function(_0x5c69ac,_0x59384b){var _0x522652={},_0x312231={},_0x28ce5f={'count':0x0,'rows':[]};var _0x1d94ab=_['map'](db['ZendeskConfiguration'][_0xde3e('0x37')],function(_0x1bc038){return{'name':_0x1bc038[_0xde3e('0x38')],'type':_0x1bc038[_0xde3e('0x39')][_0xde3e('0x3a')]};});_0x312231[_0xde3e('0x3b')]=_[_0xde3e('0x3c')](_0x1d94ab,'name');_0x312231[_0xde3e('0x3d')]=_[_0xde3e('0x3e')](_0x5c69ac[_0xde3e('0x3d')]);_0x312231['filters']=_['intersection'](_0x312231[_0xde3e('0x3b')],_0x312231[_0xde3e('0x3d')]);_0x522652[_0xde3e('0x3f')]=_[_0xde3e('0x40')](_0x312231[_0xde3e('0x3b')],qs[_0xde3e('0x41')](_0x5c69ac['query'][_0xde3e('0x41')]));_0x522652[_0xde3e('0x3f')]=_0x522652[_0xde3e('0x3f')][_0xde3e('0x42')]?_0x522652[_0xde3e('0x3f')]:_0x312231[_0xde3e('0x3b')];if(!_0x5c69ac['query'][_0xde3e('0x43')](_0xde3e('0x44'))){_0x522652[_0xde3e('0x2e')]=qs['limit'](_0x5c69ac[_0xde3e('0x3d')][_0xde3e('0x2e')]);_0x522652[_0xde3e('0x2d')]=qs['offset'](_0x5c69ac[_0xde3e('0x3d')]['offset']);}_0x522652[_0xde3e('0x45')]=qs[_0xde3e('0x46')](_0x5c69ac[_0xde3e('0x3d')][_0xde3e('0x46')]);_0x522652[_0xde3e('0x47')]=qs['filters'](_[_0xde3e('0x48')](_0x5c69ac[_0xde3e('0x3d')],_0x312231['filters']),_0x1d94ab);if(_0x5c69ac[_0xde3e('0x3d')][_0xde3e('0x49')]){_0x522652[_0xde3e('0x47')]=_[_0xde3e('0x4a')](_0x522652[_0xde3e('0x47')],{'$or':_[_0xde3e('0x3c')](_0x1d94ab,function(_0x1f9a3b){if(_0x1f9a3b[_0xde3e('0x39')]!==_0xde3e('0x4b')){var _0x2df21a={};_0x2df21a[_0x1f9a3b[_0xde3e('0x34')]]={'$like':'%'+_0x5c69ac[_0xde3e('0x3d')][_0xde3e('0x49')]+'%'};return _0x2df21a;}})});}_0x522652=_[_0xde3e('0x4a')]({},_0x522652,_0x5c69ac[_0xde3e('0x4c')]);var _0x3b66e3={'where':_0x522652['where']};return db['ZendeskConfiguration'][_0xde3e('0x2c')](_0x3b66e3)[_0xde3e('0x1f')](function(_0xd06706){_0x28ce5f[_0xde3e('0x2c')]=_0xd06706;if(_0x5c69ac[_0xde3e('0x3d')][_0xde3e('0x4d')]){_0x522652[_0xde3e('0x4e')]=[{'all':!![]}];}return db[_0xde3e('0x4f')][_0xde3e('0x50')](_0x522652);})[_0xde3e('0x1f')](function(_0x48bb07){_0x28ce5f[_0xde3e('0x51')]=_0x48bb07;return _0x28ce5f;})[_0xde3e('0x1f')](respondWithFilteredResult(_0x59384b,_0x522652))['catch'](handleError(_0x59384b,null));};exports['show']=function(_0x3c64e7,_0x4fa04d){var _0x5a825c={'raw':![],'where':{'id':_0x3c64e7[_0xde3e('0x52')]['id']}},_0x2790c7={};_0x2790c7[_0xde3e('0x3b')]=_[_0xde3e('0x3e')](db['ZendeskConfiguration']['rawAttributes']);_0x2790c7[_0xde3e('0x3d')]=_[_0xde3e('0x3e')](_0x3c64e7[_0xde3e('0x3d')]);_0x2790c7[_0xde3e('0x53')]=_[_0xde3e('0x40')](_0x2790c7[_0xde3e('0x3b')],_0x2790c7[_0xde3e('0x3d')]);_0x5a825c[_0xde3e('0x3f')]=_[_0xde3e('0x40')](_0x2790c7[_0xde3e('0x3b')],qs[_0xde3e('0x41')](_0x3c64e7[_0xde3e('0x3d')][_0xde3e('0x41')]));_0x5a825c[_0xde3e('0x3f')]=_0x5a825c['attributes'][_0xde3e('0x42')]?_0x5a825c['attributes']:_0x2790c7[_0xde3e('0x3b')];if(_0x3c64e7['query']['includeAll']){_0x5a825c[_0xde3e('0x4e')]=[{'all':!![]}];}_0x5a825c=_[_0xde3e('0x4a')]({},_0x5a825c,_0x3c64e7[_0xde3e('0x4c')]);return db[_0xde3e('0x4f')][_0xde3e('0x54')](_0x5a825c)[_0xde3e('0x1f')](handleEntityNotFound(_0x4fa04d,null))['then'](respondWithResult(_0x4fa04d,null))['catch'](handleError(_0x4fa04d,null));};exports[_0xde3e('0x55')]=function(_0x25fb4a,_0x22dfdc){return db['ZendeskConfiguration'][_0xde3e('0x55')](_0x25fb4a[_0xde3e('0x56')],{})[_0xde3e('0x1f')](respondWithResult(_0x22dfdc,0xc9))[_0xde3e('0x28')](handleError(_0x22dfdc,null));};exports[_0xde3e('0x32')]=function(_0x5de25c,_0x317edc){if(_0x5de25c[_0xde3e('0x56')]['id']){delete _0x5de25c[_0xde3e('0x56')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x5de25c[_0xde3e('0x52')]['id']}})[_0xde3e('0x1f')](handleEntityNotFound(_0x317edc,null))['then'](saveUpdates(_0x5de25c[_0xde3e('0x56')],null))[_0xde3e('0x1f')](respondWithResult(_0x317edc,null))['catch'](handleError(_0x317edc,null));};exports[_0xde3e('0x57')]=function(_0x57e971,_0xdb8f35){return db[_0xde3e('0x4f')][_0xde3e('0x54')]({'where':{'id':_0x57e971['params']['id']}})[_0xde3e('0x1f')](handleEntityNotFound(_0xdb8f35,null))[_0xde3e('0x1f')](removeEntity(_0xdb8f35,null))[_0xde3e('0x28')](handleError(_0xdb8f35,null));};exports[_0xde3e('0x58')]=function(_0x47c0b3,_0x33b950,_0x57ff60){var _0x5ad011={};var _0x14e1e9={};var _0x47bc44;var _0x3b5adc;return db[_0xde3e('0x4f')][_0xde3e('0x59')]({'where':{'id':_0x47c0b3[_0xde3e('0x52')]['id']}})[_0xde3e('0x1f')](handleEntityNotFound(_0x33b950,null))['then'](function(_0x4cb0d6){if(_0x4cb0d6){_0x47bc44=_0x4cb0d6;_0x14e1e9[_0xde3e('0x3b')]=_['keys'](db[_0xde3e('0x5a')][_0xde3e('0x37')]);_0x14e1e9[_0xde3e('0x3d')]=_['keys'](_0x47c0b3['query']);_0x14e1e9[_0xde3e('0x53')]=_['intersection'](_0x14e1e9[_0xde3e('0x3b')],_0x14e1e9['query']);_0x5ad011[_0xde3e('0x3f')]=_['intersection'](_0x14e1e9[_0xde3e('0x3b')],qs['fields'](_0x47c0b3['query'][_0xde3e('0x41')]));_0x5ad011['attributes']=_0x5ad011[_0xde3e('0x3f')][_0xde3e('0x42')]?_0x5ad011[_0xde3e('0x3f')]:_0x14e1e9[_0xde3e('0x3b')];_0x5ad011[_0xde3e('0x45')]=qs[_0xde3e('0x46')](_0x47c0b3[_0xde3e('0x3d')]['sort']);_0x5ad011['where']=qs[_0xde3e('0x53')](_[_0xde3e('0x48')](_0x47c0b3['query'],_0x14e1e9[_0xde3e('0x53')]));if(_0x47c0b3[_0xde3e('0x3d')][_0xde3e('0x49')]){_0x5ad011['where']=_['merge'](_0x5ad011[_0xde3e('0x47')],{'$or':_[_0xde3e('0x3c')](_0x5ad011[_0xde3e('0x3f')],function(_0xc96175){var _0x4d27e1={};_0x4d27e1[_0xc96175]={'$like':'%'+_0x47c0b3[_0xde3e('0x3d')][_0xde3e('0x49')]+'%'};return _0x4d27e1;})});}_0x5ad011=_[_0xde3e('0x4a')]({},_0x5ad011,_0x47c0b3['options']);return _0x47bc44[_0xde3e('0x58')](_0x5ad011);}})[_0xde3e('0x1f')](function(_0x52acd4){if(_0x52acd4){_0x3b5adc=_0x52acd4['length'];if(!_0x47c0b3[_0xde3e('0x3d')][_0xde3e('0x43')](_0xde3e('0x44'))){_0x5ad011[_0xde3e('0x2e')]=qs[_0xde3e('0x2e')](_0x47c0b3[_0xde3e('0x3d')][_0xde3e('0x2e')]);_0x5ad011[_0xde3e('0x2d')]=qs[_0xde3e('0x2d')](_0x47c0b3[_0xde3e('0x3d')][_0xde3e('0x2d')]);}return _0x47bc44[_0xde3e('0x58')](_0x5ad011);}})[_0xde3e('0x1f')](function(_0x1a0d47){if(_0x1a0d47){return _0x1a0d47?{'count':_0x3b5adc,'rows':_0x1a0d47}:null;}})[_0xde3e('0x1f')](respondWithResult(_0x33b950,null))[_0xde3e('0x28')](handleError(_0x33b950,null));};exports['getSubjects']=function(_0x2df766,_0x5afe56,_0x46e80f){var _0x333e13={};var _0x350de9={};var _0x3e494c;var _0xb8a3bb;return db['ZendeskConfiguration'][_0xde3e('0x59')]({'where':{'id':_0x2df766[_0xde3e('0x52')]['id']}})[_0xde3e('0x1f')](handleEntityNotFound(_0x5afe56,null))[_0xde3e('0x1f')](function(_0x1bcc90){if(_0x1bcc90){_0x3e494c=_0x1bcc90;_0x350de9[_0xde3e('0x3b')]=_['keys'](db['ZendeskField'][_0xde3e('0x37')]);_0x350de9[_0xde3e('0x3d')]=_[_0xde3e('0x3e')](_0x2df766[_0xde3e('0x3d')]);_0x350de9['filters']=_[_0xde3e('0x40')](_0x350de9[_0xde3e('0x3b')],_0x350de9[_0xde3e('0x3d')]);_0x333e13[_0xde3e('0x3f')]=_[_0xde3e('0x40')](_0x350de9[_0xde3e('0x3b')],qs[_0xde3e('0x41')](_0x2df766['query'][_0xde3e('0x41')]));_0x333e13[_0xde3e('0x3f')]=_0x333e13['attributes'][_0xde3e('0x42')]?_0x333e13[_0xde3e('0x3f')]:_0x350de9['model'];_0x333e13['order']=qs[_0xde3e('0x46')](_0x2df766[_0xde3e('0x3d')][_0xde3e('0x46')]);_0x333e13['where']=qs[_0xde3e('0x53')](_[_0xde3e('0x48')](_0x2df766['query'],_0x350de9[_0xde3e('0x53')]));if(_0x2df766['query']['filter']){_0x333e13[_0xde3e('0x47')]=_[_0xde3e('0x4a')](_0x333e13[_0xde3e('0x47')],{'$or':_[_0xde3e('0x3c')](_0x333e13['attributes'],function(_0x22d85e){var _0x52cb69={};_0x52cb69[_0x22d85e]={'$like':'%'+_0x2df766[_0xde3e('0x3d')][_0xde3e('0x49')]+'%'};return _0x52cb69;})});}_0x333e13=_[_0xde3e('0x4a')]({},_0x333e13,_0x2df766[_0xde3e('0x4c')]);return _0x3e494c[_0xde3e('0x5b')](_0x333e13);}})[_0xde3e('0x1f')](function(_0x5321cb){if(_0x5321cb){_0xb8a3bb=_0x5321cb[_0xde3e('0x42')];if(!_0x2df766['query'][_0xde3e('0x43')](_0xde3e('0x44'))){_0x333e13[_0xde3e('0x2e')]=qs['limit'](_0x2df766[_0xde3e('0x3d')][_0xde3e('0x2e')]);_0x333e13[_0xde3e('0x2d')]=qs[_0xde3e('0x2d')](_0x2df766[_0xde3e('0x3d')][_0xde3e('0x2d')]);}return _0x3e494c[_0xde3e('0x5b')](_0x333e13);}})[_0xde3e('0x1f')](function(_0x448667){if(_0x448667){return _0x448667?{'count':_0xb8a3bb,'rows':_0x448667}:null;}})[_0xde3e('0x1f')](respondWithResult(_0x5afe56,null))[_0xde3e('0x28')](handleError(_0x5afe56,null));};exports['getDescriptions']=function(_0x4cdf19,_0x16e02f,_0x34650f){var _0x1874d6={};var _0x4797c5={};var _0x4f15e6;var _0x44cb96;return db[_0xde3e('0x4f')][_0xde3e('0x59')]({'where':{'id':_0x4cdf19[_0xde3e('0x52')]['id']}})['then'](handleEntityNotFound(_0x16e02f,null))['then'](function(_0x2c6b6d){if(_0x2c6b6d){_0x4f15e6=_0x2c6b6d;_0x4797c5[_0xde3e('0x3b')]=_[_0xde3e('0x3e')](db['ZendeskField'][_0xde3e('0x37')]);_0x4797c5[_0xde3e('0x3d')]=_['keys'](_0x4cdf19[_0xde3e('0x3d')]);_0x4797c5[_0xde3e('0x53')]=_['intersection'](_0x4797c5[_0xde3e('0x3b')],_0x4797c5['query']);_0x1874d6[_0xde3e('0x3f')]=_[_0xde3e('0x40')](_0x4797c5['model'],qs['fields'](_0x4cdf19[_0xde3e('0x3d')][_0xde3e('0x41')]));_0x1874d6[_0xde3e('0x3f')]=_0x1874d6['attributes']['length']?_0x1874d6['attributes']:_0x4797c5[_0xde3e('0x3b')];_0x1874d6['order']=qs[_0xde3e('0x46')](_0x4cdf19[_0xde3e('0x3d')][_0xde3e('0x46')]);_0x1874d6['where']=qs[_0xde3e('0x53')](_[_0xde3e('0x48')](_0x4cdf19[_0xde3e('0x3d')],_0x4797c5['filters']));if(_0x4cdf19['query'][_0xde3e('0x49')]){_0x1874d6[_0xde3e('0x47')]=_[_0xde3e('0x4a')](_0x1874d6['where'],{'$or':_[_0xde3e('0x3c')](_0x1874d6[_0xde3e('0x3f')],function(_0x41515d){var _0x4b5129={};_0x4b5129[_0x41515d]={'$like':'%'+_0x4cdf19[_0xde3e('0x3d')][_0xde3e('0x49')]+'%'};return _0x4b5129;})});}_0x1874d6=_[_0xde3e('0x4a')]({},_0x1874d6,_0x4cdf19[_0xde3e('0x4c')]);return _0x4f15e6['getDescriptions'](_0x1874d6);}})[_0xde3e('0x1f')](function(_0x29b7f6){if(_0x29b7f6){_0x44cb96=_0x29b7f6[_0xde3e('0x42')];if(!_0x4cdf19[_0xde3e('0x3d')]['hasOwnProperty'](_0xde3e('0x44'))){_0x1874d6[_0xde3e('0x2e')]=qs[_0xde3e('0x2e')](_0x4cdf19[_0xde3e('0x3d')][_0xde3e('0x2e')]);_0x1874d6[_0xde3e('0x2d')]=qs[_0xde3e('0x2d')](_0x4cdf19[_0xde3e('0x3d')][_0xde3e('0x2d')]);}return _0x4f15e6['getDescriptions'](_0x1874d6);}})[_0xde3e('0x1f')](function(_0x3205c0){if(_0x3205c0){return _0x3205c0?{'count':_0x44cb96,'rows':_0x3205c0}:null;}})[_0xde3e('0x1f')](respondWithResult(_0x16e02f,null))[_0xde3e('0x28')](handleError(_0x16e02f,null));};exports[_0xde3e('0x5c')]=function(_0x3d12be,_0x402edf,_0x593d42){var _0x2d72ec={};var _0x30534f={};var _0x8b45d;var _0x251261;return db['ZendeskConfiguration'][_0xde3e('0x59')]({'where':{'id':_0x3d12be[_0xde3e('0x52')]['id']}})['then'](handleEntityNotFound(_0x402edf,null))[_0xde3e('0x1f')](function(_0x4ff404){if(_0x4ff404){_0x8b45d=_0x4ff404;_0x30534f[_0xde3e('0x3b')]=_[_0xde3e('0x3e')](db[_0xde3e('0x5d')]['rawAttributes']);_0x30534f[_0xde3e('0x3d')]=_[_0xde3e('0x3e')](_0x3d12be[_0xde3e('0x3d')]);_0x30534f['filters']=_[_0xde3e('0x40')](_0x30534f[_0xde3e('0x3b')],_0x30534f[_0xde3e('0x3d')]);_0x2d72ec[_0xde3e('0x3f')]=_[_0xde3e('0x40')](_0x30534f[_0xde3e('0x3b')],qs['fields'](_0x3d12be['query']['fields']));_0x2d72ec['attributes']=_0x2d72ec['attributes'][_0xde3e('0x42')]?_0x2d72ec[_0xde3e('0x3f')]:_0x30534f[_0xde3e('0x3b')];_0x2d72ec[_0xde3e('0x45')]=qs[_0xde3e('0x46')](_0x3d12be[_0xde3e('0x3d')][_0xde3e('0x46')]);_0x2d72ec[_0xde3e('0x47')]=qs[_0xde3e('0x53')](_[_0xde3e('0x48')](_0x3d12be[_0xde3e('0x3d')],_0x30534f[_0xde3e('0x53')]));if(_0x3d12be['query'][_0xde3e('0x49')]){_0x2d72ec[_0xde3e('0x47')]=_[_0xde3e('0x4a')](_0x2d72ec[_0xde3e('0x47')],{'$or':_[_0xde3e('0x3c')](_0x2d72ec[_0xde3e('0x3f')],function(_0x4f29cc){var _0x497993={};_0x497993[_0x4f29cc]={'$like':'%'+_0x3d12be[_0xde3e('0x3d')][_0xde3e('0x49')]+'%'};return _0x497993;})});}_0x2d72ec=_[_0xde3e('0x4a')]({},_0x2d72ec,_0x3d12be[_0xde3e('0x4c')]);return _0x8b45d[_0xde3e('0x5c')](_0x2d72ec);}})[_0xde3e('0x1f')](function(_0x5cb173){if(_0x5cb173){_0x251261=_0x5cb173[_0xde3e('0x42')];if(!_0x3d12be[_0xde3e('0x3d')][_0xde3e('0x43')](_0xde3e('0x44'))){_0x2d72ec[_0xde3e('0x2e')]=qs[_0xde3e('0x2e')](_0x3d12be[_0xde3e('0x3d')][_0xde3e('0x2e')]);_0x2d72ec[_0xde3e('0x2d')]=qs[_0xde3e('0x2d')](_0x3d12be['query']['offset']);}return _0x8b45d[_0xde3e('0x5c')](_0x2d72ec);}})['then'](function(_0x14372e){if(_0x14372e){return _0x14372e?{'count':_0x251261,'rows':_0x14372e}:null;}})[_0xde3e('0x1f')](respondWithResult(_0x402edf,null))[_0xde3e('0x28')](handleError(_0x402edf,null));};exports[_0xde3e('0x5e')]=function(_0x244a02,_0x47105c,_0x1c68cd){if(_0x244a02['body']['id']){delete _0x244a02[_0xde3e('0x56')]['id'];}return db[_0xde3e('0x4f')]['findOne']({'where':{'id':_0x244a02[_0xde3e('0x52')]['id']}})[_0xde3e('0x1f')](handleEntityNotFound(_0x47105c,null))[_0xde3e('0x1f')](function(_0x260a64){if(_0x260a64){return _0x260a64[_0xde3e('0x5e')](_0x244a02[_0xde3e('0x56')][_0xde3e('0x5f')]||[]);}return null;})[_0xde3e('0x1f')](respondWithResult(_0x47105c,null))[_0xde3e('0x28')](handleError(_0x47105c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index b635e2a..ef8a85b 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 _0x7736=['./intZendeskConfiguration.attributes','define','int_zendesk_configurations','util','api','path'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x7736,0x11d));var _0x6773=function(_0x5a177d,_0x152fb8){_0x5a177d=_0x5a177d-0x0;var _0x26da2b=_0x7736[_0x5a177d];return _0x26da2b;};'use strict';var _=require('lodash');var util=require(_0x6773('0x0'));var logger=require('../../config/logger')(_0x6773('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6773('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6773('0x3'));module['exports']=function(_0x10d2a7,_0x605964){return _0x10d2a7[_0x6773('0x4')]('ZendeskConfiguration',attributes,{'tableName':_0x6773('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc185=['request-promise','rimraf','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','moment','bluebird'];(function(_0x481387,_0x23f3a2){var _0x236bf6=function(_0x3e35c8){while(--_0x3e35c8){_0x481387['push'](_0x481387['shift']());}};_0x236bf6(++_0x23f3a2);}(_0xc185,0x1a3));var _0x5c18=function(_0x343436,_0x49733b){_0x343436=_0x343436-0x0;var _0x3f07c2=_0xc185[_0x343436];return _0x3f07c2;};'use strict';var _=require(_0x5c18('0x0'));var util=require('util');var logger=require(_0x5c18('0x1'))('api');var moment=require(_0x5c18('0x2'));var BPromise=require(_0x5c18('0x3'));var rp=require(_0x5c18('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c18('0x5'));var config=require('../../config/environment');var attributes=require(_0x5c18('0x6'));module['exports']=function(_0x5e81b3,_0x11c35c){return _0x5e81b3['define'](_0x5c18('0x7'),attributes,{'tableName':_0x5c18('0x8'),'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 37f8ac4..12f32d4 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 _0xaaad=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','lodash','util','bluebird'];(function(_0x4cebcc,_0x56253e){var _0x4d1669=function(_0x89e326){while(--_0x89e326){_0x4cebcc['push'](_0x4cebcc['shift']());}};_0x4d1669(++_0x56253e);}(_0xaaad,0x177));var _0xdaaa=function(_0x3f219f,_0x29f40a){_0x3f219f=_0x3f219f-0x0;var _0x4f64e3=_0xaaad[_0x3f219f];return _0x4f64e3;};'use strict';var _=require(_0xdaaa('0x0'));var util=require(_0xdaaa('0x1'));var moment=require('moment');var BPromise=require(_0xdaaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaaa('0x3'))['db'];var utils=require(_0xdaaa('0x4'));var logger=require(_0xdaaa('0x5'))(_0xdaaa('0x6'));var config=require(_0xdaaa('0x7'));var jayson=require(_0xdaaa('0x8'));var client=jayson[_0xdaaa('0x9')][_0xdaaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f0061,_0x8883d3,_0xb69aa7){return new BPromise(function(_0x1e9674,_0x1b7054){return client[_0xdaaa('0xb')](_0x4f0061,_0xb69aa7)['then'](function(_0x3e1539){logger[_0xdaaa('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x8883d3,_0xdaaa('0xd'));logger[_0xdaaa('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x8883d3,_0xdaaa('0xd'),JSON[_0xdaaa('0xf')](_0x3e1539));if(_0x3e1539[_0xdaaa('0x10')]){if(_0x3e1539['error'][_0xdaaa('0x11')]===0x1f4){logger[_0xdaaa('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x8883d3,_0x3e1539[_0xdaaa('0x10')][_0xdaaa('0x12')]);return _0x1b7054(_0x3e1539[_0xdaaa('0x10')][_0xdaaa('0x12')]);}logger[_0xdaaa('0x10')](_0xdaaa('0x13'),_0x8883d3,_0x3e1539[_0xdaaa('0x10')][_0xdaaa('0x12')]);return _0x1e9674(_0x3e1539[_0xdaaa('0x10')][_0xdaaa('0x12')]);}else{logger[_0xdaaa('0xc')](_0xdaaa('0x13'),_0x8883d3,'request\x20sent');_0x1e9674(_0x3e1539[_0xdaaa('0x14')]['message']);}})['catch'](function(_0x44884f){logger[_0xdaaa('0x10')](_0xdaaa('0x13'),_0x8883d3,_0x44884f);_0x1b7054(_0x44884f);});});} \ No newline at end of file +var _0xdac2=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','debug','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0xaab2f5,_0x58463f){var _0x3b28ea=function(_0xcbc73c){while(--_0xcbc73c){_0xaab2f5['push'](_0xaab2f5['shift']());}};_0x3b28ea(++_0x58463f);}(_0xdac2,0x159));var _0x2dac=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xdac2[_0x1992f1];return _0x413dfe;};'use strict';var _=require(_0x2dac('0x0'));var util=require(_0x2dac('0x1'));var moment=require(_0x2dac('0x2'));var BPromise=require(_0x2dac('0x3'));var rs=require(_0x2dac('0x4'));var fs=require('fs');var Redis=require(_0x2dac('0x5'));var db=require(_0x2dac('0x6'))['db'];var utils=require(_0x2dac('0x7'));var logger=require(_0x2dac('0x8'))('rpc');var config=require(_0x2dac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2dac('0xa')][_0x2dac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x178f2e,_0xd91deb,_0x15c86c){return new BPromise(function(_0x14afe2,_0x3e44d1){return client[_0x2dac('0xc')](_0x178f2e,_0x15c86c)['then'](function(_0x30aea7){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0xd91deb,'request\x20sent');logger[_0x2dac('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xd91deb,_0x2dac('0xe'),JSON[_0x2dac('0xf')](_0x30aea7));if(_0x30aea7[_0x2dac('0x10')]){if(_0x30aea7[_0x2dac('0x10')][_0x2dac('0x11')]===0x1f4){logger['error'](_0x2dac('0x12'),_0xd91deb,_0x30aea7[_0x2dac('0x10')][_0x2dac('0x13')]);return _0x3e44d1(_0x30aea7[_0x2dac('0x10')][_0x2dac('0x13')]);}logger[_0x2dac('0x10')](_0x2dac('0x12'),_0xd91deb,_0x30aea7[_0x2dac('0x10')]['message']);return _0x14afe2(_0x30aea7[_0x2dac('0x10')]['message']);}else{logger[_0x2dac('0x14')](_0x2dac('0x12'),_0xd91deb,_0x2dac('0xe'));_0x14afe2(_0x30aea7[_0x2dac('0x15')][_0x2dac('0x13')]);}})[_0x2dac('0x16')](function(_0x4755ce){logger['error'](_0x2dac('0x12'),_0xd91deb,_0x4755ce);_0x3e44d1(_0x4755ce);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 076f54b..7c5df44 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 _0x6e80=['../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6e80,0x1cd));var _0x06e8=function(_0x430de8,_0x3ba2a2){_0x430de8=_0x430de8-0x0;var _0x231beb=_0x6e80[_0x430de8];return _0x231beb;};'use strict';var multer=require(_0x06e8('0x0'));var util=require(_0x06e8('0x1'));var path=require(_0x06e8('0x2'));var timeout=require(_0x06e8('0x3'));var express=require(_0x06e8('0x4'));var router=express['Router']();var auth=require(_0x06e8('0x5'));var interaction=require(_0x06e8('0x6'));var config=require(_0x06e8('0x7'));var controller=require('./intZendeskField.controller');router[_0x06e8('0x8')]('/',auth[_0x06e8('0x9')](),controller[_0x06e8('0xa')]);router[_0x06e8('0x8')](_0x06e8('0xb'),auth[_0x06e8('0x9')](),controller[_0x06e8('0xc')]);router['post']('/',auth[_0x06e8('0x9')](),controller[_0x06e8('0xd')]);router[_0x06e8('0xe')](_0x06e8('0xb'),auth['isAuthenticated'](),controller[_0x06e8('0xf')]);router['delete'](_0x06e8('0xb'),auth['isAuthenticated'](),controller[_0x06e8('0x10')]);module[_0x06e8('0x11')]=router; \ No newline at end of file +var _0x18fe=['get','isAuthenticated','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x18fe,0x13a));var _0xe18f=function(_0x6d0875,_0xc22447){_0x6d0875=_0x6d0875-0x0;var _0x474aa6=_0x18fe[_0x6d0875];return _0x474aa6;};'use strict';var multer=require(_0xe18f('0x0'));var util=require(_0xe18f('0x1'));var path=require(_0xe18f('0x2'));var timeout=require(_0xe18f('0x3'));var express=require(_0xe18f('0x4'));var router=express[_0xe18f('0x5')]();var auth=require(_0xe18f('0x6'));var interaction=require(_0xe18f('0x7'));var config=require(_0xe18f('0x8'));var controller=require('./intZendeskField.controller');router[_0xe18f('0x9')]('/',auth[_0xe18f('0xa')](),controller['index']);router[_0xe18f('0x9')](_0xe18f('0xb'),auth[_0xe18f('0xa')](),controller[_0xe18f('0xc')]);router[_0xe18f('0xd')]('/',auth['isAuthenticated'](),controller[_0xe18f('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe18f('0xf')](_0xe18f('0xb'),auth[_0xe18f('0xa')](),controller[_0xe18f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index af6c1ad..c7a8773 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 _0xe2cd=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe2cd,0x64));var _0xde2c=function(_0x1d654e,_0x2b8e28){_0x1d654e=_0x1d654e-0x0;var _0x37d34a=_0xe2cd[_0x1d654e];return _0x37d34a;};'use strict';var Sequelize=require(_0xde2c('0x0'));module[_0xde2c('0x1')]={'type':{'type':Sequelize[_0xde2c('0x2')](_0xde2c('0x3'),_0xde2c('0x4'),_0xde2c('0x5'),_0xde2c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xde2c('0x7')]},'key':{'type':Sequelize[_0xde2c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xde2c('0x3'),_0xde2c('0x4'),_0xde2c('0x5'))},'keyContent':{'type':Sequelize[_0xde2c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xde2c('0x7')]},'customField':{'type':Sequelize[_0xde2c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde2c('0x7')]}}; \ No newline at end of file +var _0x397c=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x56773d,_0x4e5b83){var _0x456d36=function(_0x1e39ed){while(--_0x1e39ed){_0x56773d['push'](_0x56773d['shift']());}};_0x456d36(++_0x4e5b83);}(_0x397c,0xc1));var _0xc397=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x397c[_0x455c6c];return _0x488242;};'use strict';var Sequelize=require(_0xc397('0x0'));module[_0xc397('0x1')]={'type':{'type':Sequelize[_0xc397('0x2')]('string',_0xc397('0x3'),'customVariable',_0xc397('0x4')),'defaultValue':_0xc397('0x5')},'content':{'type':Sequelize[_0xc397('0x6')]},'key':{'type':Sequelize[_0xc397('0x6')]},'keyType':{'type':Sequelize[_0xc397('0x2')]('string',_0xc397('0x3'),_0xc397('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc397('0x6')]},'nameField':{'type':Sequelize[_0xc397('0x6')]},'customField':{'type':Sequelize[_0xc397('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc397('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index eb599cc..8b14280 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 _0xa3f4=['save','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','catch','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x5eec0d,_0xc48f11){var _0x11394a=function(_0x4c0a90){while(--_0x4c0a90){_0x5eec0d['push'](_0x5eec0d['shift']());}};_0x11394a(++_0xc48f11);}(_0xa3f4,0x1f0));var _0x4a3f=function(_0x6e2fc5,_0x17e1e9){_0x6e2fc5=_0x6e2fc5-0x0;var _0x2366f1=_0xa3f4[_0x6e2fc5];return _0x2366f1;};'use strict';var pdf=require(_0x4a3f('0x0'));var emlformat=require(_0x4a3f('0x1'));var rimraf=require(_0x4a3f('0x2'));var zipdir=require(_0x4a3f('0x3'));var jsonpatch=require(_0x4a3f('0x4'));var rp=require(_0x4a3f('0x5'));var moment=require('moment');var BPromise=require(_0x4a3f('0x6'));var Mustache=require(_0x4a3f('0x7'));var util=require(_0x4a3f('0x8'));var path=require(_0x4a3f('0x9'));var sox=require(_0x4a3f('0xa'));var csv=require(_0x4a3f('0xb'));var ejs=require(_0x4a3f('0xc'));var fs=require('fs');var _=require(_0x4a3f('0xd'));var squel=require(_0x4a3f('0xe'));var crypto=require(_0x4a3f('0xf'));var jsforce=require(_0x4a3f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4a3f('0xb'));var querystring=require('querystring');var Papa=require(_0x4a3f('0x11'));var Redis=require('ioredis');var authService=require(_0x4a3f('0x12'));var qs=require(_0x4a3f('0x13'));var as=require(_0x4a3f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a3f('0x15'));var utils=require(_0x4a3f('0x16'));var config=require(_0x4a3f('0x17'));var db=require(_0x4a3f('0x18'))['db'];function respondWithStatusCode(_0xcdd8a6,_0x86a5f1){_0x86a5f1=_0x86a5f1||0xcc;return function(_0x50c425){if(_0x50c425){return _0xcdd8a6[_0x4a3f('0x19')](_0x86a5f1);}return _0xcdd8a6[_0x4a3f('0x1a')](_0x86a5f1)[_0x4a3f('0x1b')]();};}function respondWithResult(_0x5dafca,_0x37815d){_0x37815d=_0x37815d||0xc8;return function(_0x3a63fe){if(_0x3a63fe){return _0x5dafca[_0x4a3f('0x1a')](_0x37815d)[_0x4a3f('0x1c')](_0x3a63fe);}};}function respondWithFilteredResult(_0x2c42e3,_0x411e39){return function(_0xc383c2){if(_0xc383c2){var _0x31201d=_0xc383c2[_0x4a3f('0x1d')],_0x23013e=_0x411e39[_0x4a3f('0x1e')],_0x5a0fdc=_0x411e39['offset']+_0x411e39[_0x4a3f('0x1f')],_0x3b2a28;if(_0x5a0fdc>=_0x31201d){_0x5a0fdc=_0x31201d;_0x3b2a28=0xc8;}else{_0x3b2a28=0xce;}_0x2c42e3[_0x4a3f('0x1a')](_0x3b2a28);return _0x2c42e3[_0x4a3f('0x20')](_0x4a3f('0x21'),_0x23013e+'-'+_0x5a0fdc+'/'+_0x31201d)[_0x4a3f('0x1c')](_0xc383c2);}return null;};}function patchUpdates(_0x5ef2e0){return function(_0x228686){try{jsonpatch[_0x4a3f('0x22')](_0x228686,_0x5ef2e0,!![]);}catch(_0x390644){return BPromise[_0x4a3f('0x23')](_0x390644);}return _0x228686[_0x4a3f('0x24')]();};}function saveUpdates(_0x142c73,_0x24c051){return function(_0xe2e7dd){if(_0xe2e7dd){return _0xe2e7dd['update'](_0x142c73)[_0x4a3f('0x25')](function(_0x39812d){return _0x39812d;});}return null;};}function removeEntity(_0x595ca9,_0x56ce94){return function(_0x3da0ad){if(_0x3da0ad){return _0x3da0ad[_0x4a3f('0x26')]()[_0x4a3f('0x25')](function(){_0x595ca9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aee6f,_0x53d0c8){return function(_0x4ad0e0){if(!_0x4ad0e0){_0x5aee6f[_0x4a3f('0x19')](0x194);}return _0x4ad0e0;};}function handleError(_0x1ed0d0,_0x45da39){_0x45da39=_0x45da39||0x1f4;return function(_0x5ad558){logger[_0x4a3f('0x27')](_0x5ad558[_0x4a3f('0x28')]);if(_0x5ad558['name']){delete _0x5ad558[_0x4a3f('0x29')];}_0x1ed0d0[_0x4a3f('0x1a')](_0x45da39)[_0x4a3f('0x2a')](_0x5ad558);};}exports[_0x4a3f('0x2b')]=function(_0x5b321f,_0x2b13de){var _0x1bcb79={},_0x1fccaf={},_0x1f63b3={'count':0x0,'rows':[]};var _0x9a65b9=_['map'](db[_0x4a3f('0x2c')][_0x4a3f('0x2d')],function(_0x550a7f){return{'name':_0x550a7f[_0x4a3f('0x2e')],'type':_0x550a7f['type']['key']};});_0x1fccaf[_0x4a3f('0x2f')]=_[_0x4a3f('0x30')](_0x9a65b9,'name');_0x1fccaf[_0x4a3f('0x31')]=_[_0x4a3f('0x32')](_0x5b321f[_0x4a3f('0x31')]);_0x1fccaf[_0x4a3f('0x33')]=_[_0x4a3f('0x34')](_0x1fccaf['model'],_0x1fccaf[_0x4a3f('0x31')]);_0x1bcb79[_0x4a3f('0x35')]=_['intersection'](_0x1fccaf['model'],qs['fields'](_0x5b321f['query'][_0x4a3f('0x36')]));_0x1bcb79[_0x4a3f('0x35')]=_0x1bcb79[_0x4a3f('0x35')]['length']?_0x1bcb79[_0x4a3f('0x35')]:_0x1fccaf[_0x4a3f('0x2f')];if(!_0x5b321f[_0x4a3f('0x31')][_0x4a3f('0x37')](_0x4a3f('0x38'))){_0x1bcb79['limit']=qs[_0x4a3f('0x1f')](_0x5b321f['query'][_0x4a3f('0x1f')]);_0x1bcb79[_0x4a3f('0x1e')]=qs[_0x4a3f('0x1e')](_0x5b321f['query']['offset']);}_0x1bcb79[_0x4a3f('0x39')]=qs[_0x4a3f('0x3a')](_0x5b321f[_0x4a3f('0x31')]['sort']);_0x1bcb79['where']=qs['filters'](_[_0x4a3f('0x3b')](_0x5b321f[_0x4a3f('0x31')],_0x1fccaf[_0x4a3f('0x33')]),_0x9a65b9);if(_0x5b321f['query'][_0x4a3f('0x3c')]){_0x1bcb79['where']=_['merge'](_0x1bcb79[_0x4a3f('0x3d')],{'$or':_[_0x4a3f('0x30')](_0x9a65b9,function(_0x15b9d0){if(_0x15b9d0[_0x4a3f('0x3e')]!==_0x4a3f('0x3f')){var _0xfbb120={};_0xfbb120[_0x15b9d0[_0x4a3f('0x29')]]={'$like':'%'+_0x5b321f[_0x4a3f('0x31')][_0x4a3f('0x3c')]+'%'};return _0xfbb120;}})});}_0x1bcb79=_[_0x4a3f('0x40')]({},_0x1bcb79,_0x5b321f[_0x4a3f('0x41')]);var _0x5dc66f={'where':_0x1bcb79[_0x4a3f('0x3d')]};return db[_0x4a3f('0x2c')][_0x4a3f('0x1d')](_0x5dc66f)[_0x4a3f('0x25')](function(_0x571caa){_0x1f63b3[_0x4a3f('0x1d')]=_0x571caa;if(_0x5b321f[_0x4a3f('0x31')][_0x4a3f('0x42')]){_0x1bcb79[_0x4a3f('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0x4a3f('0x44')](_0x1bcb79);})[_0x4a3f('0x25')](function(_0x3db3cf){_0x1f63b3[_0x4a3f('0x45')]=_0x3db3cf;return _0x1f63b3;})[_0x4a3f('0x25')](respondWithFilteredResult(_0x2b13de,_0x1bcb79))['catch'](handleError(_0x2b13de,null));};exports['show']=function(_0x44f55f,_0xace857){var _0x3b6800={'raw':!![],'where':{'id':_0x44f55f[_0x4a3f('0x46')]['id']}},_0x2ce21b={};_0x2ce21b[_0x4a3f('0x2f')]=_[_0x4a3f('0x32')](db[_0x4a3f('0x2c')][_0x4a3f('0x2d')]);_0x2ce21b[_0x4a3f('0x31')]=_[_0x4a3f('0x32')](_0x44f55f['query']);_0x2ce21b[_0x4a3f('0x33')]=_[_0x4a3f('0x34')](_0x2ce21b[_0x4a3f('0x2f')],_0x2ce21b['query']);_0x3b6800[_0x4a3f('0x35')]=_[_0x4a3f('0x34')](_0x2ce21b[_0x4a3f('0x2f')],qs[_0x4a3f('0x36')](_0x44f55f[_0x4a3f('0x31')]['fields']));_0x3b6800[_0x4a3f('0x35')]=_0x3b6800[_0x4a3f('0x35')]['length']?_0x3b6800[_0x4a3f('0x35')]:_0x2ce21b['model'];if(_0x44f55f[_0x4a3f('0x31')][_0x4a3f('0x42')]){_0x3b6800[_0x4a3f('0x43')]=[{'all':!![]}];}_0x3b6800=_[_0x4a3f('0x40')]({},_0x3b6800,_0x44f55f[_0x4a3f('0x41')]);return db['ZendeskField'][_0x4a3f('0x47')](_0x3b6800)[_0x4a3f('0x25')](handleEntityNotFound(_0xace857,null))[_0x4a3f('0x25')](respondWithResult(_0xace857,null))[_0x4a3f('0x48')](handleError(_0xace857,null));};exports[_0x4a3f('0x49')]=function(_0x21082b,_0x37b234){return db[_0x4a3f('0x2c')][_0x4a3f('0x49')](_0x21082b['body'],{})[_0x4a3f('0x25')](respondWithResult(_0x37b234,0xc9))['catch'](handleError(_0x37b234,null));};exports[_0x4a3f('0x4a')]=function(_0x1ccd9c,_0x466b48){if(_0x1ccd9c[_0x4a3f('0x4b')]['id']){delete _0x1ccd9c[_0x4a3f('0x4b')]['id'];}return db[_0x4a3f('0x2c')][_0x4a3f('0x47')]({'where':{'id':_0x1ccd9c['params']['id']}})['then'](handleEntityNotFound(_0x466b48,null))[_0x4a3f('0x25')](saveUpdates(_0x1ccd9c[_0x4a3f('0x4b')],null))[_0x4a3f('0x25')](respondWithResult(_0x466b48,null))[_0x4a3f('0x48')](handleError(_0x466b48,null));};exports[_0x4a3f('0x26')]=function(_0x3a9902,_0x4abd0f){return db[_0x4a3f('0x2c')][_0x4a3f('0x47')]({'where':{'id':_0x3a9902[_0x4a3f('0x46')]['id']}})[_0x4a3f('0x25')](handleEntityNotFound(_0x4abd0f,null))['then'](removeEntity(_0x4abd0f,null))[_0x4a3f('0x48')](handleError(_0x4abd0f,null));}; \ No newline at end of file +var _0x62b7=['offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskField','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','merge','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count'];(function(_0x831d37,_0x594bd0){var _0x4225a4=function(_0x3d958b){while(--_0x3d958b){_0x831d37['push'](_0x831d37['shift']());}};_0x4225a4(++_0x594bd0);}(_0x62b7,0x72));var _0x762b=function(_0x43cf14,_0x2432f1){_0x43cf14=_0x43cf14-0x0;var _0x5ee8b1=_0x62b7[_0x43cf14];return _0x5ee8b1;};'use strict';var pdf=require(_0x762b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x762b('0x1'));var jsonpatch=require(_0x762b('0x2'));var rp=require(_0x762b('0x3'));var moment=require('moment');var BPromise=require(_0x762b('0x4'));var Mustache=require(_0x762b('0x5'));var util=require(_0x762b('0x6'));var path=require(_0x762b('0x7'));var sox=require(_0x762b('0x8'));var csv=require(_0x762b('0x9'));var ejs=require(_0x762b('0xa'));var fs=require('fs');var _=require(_0x762b('0xb'));var squel=require(_0x762b('0xc'));var crypto=require(_0x762b('0xd'));var jsforce=require(_0x762b('0xe'));var deskjs=require(_0x762b('0xf'));var toCsv=require(_0x762b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x762b('0x10'));var qs=require(_0x762b('0x11'));var as=require(_0x762b('0x12'));var hardwareService=require(_0x762b('0x13'));var logger=require(_0x762b('0x14'))(_0x762b('0x15'));var utils=require(_0x762b('0x16'));var config=require(_0x762b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2994e1,_0xacf822){_0xacf822=_0xacf822||0xcc;return function(_0xcfcd66){if(_0xcfcd66){return _0x2994e1['sendStatus'](_0xacf822);}return _0x2994e1[_0x762b('0x18')](_0xacf822)[_0x762b('0x19')]();};}function respondWithResult(_0x1a8205,_0x52ae82){_0x52ae82=_0x52ae82||0xc8;return function(_0x384a34){if(_0x384a34){return _0x1a8205['status'](_0x52ae82)[_0x762b('0x1a')](_0x384a34);}};}function respondWithFilteredResult(_0x132a5e,_0x2bbf93){return function(_0x54187a){if(_0x54187a){var _0x4819de=_0x54187a[_0x762b('0x1b')],_0x568fe7=_0x2bbf93['offset'],_0x27f9ee=_0x2bbf93[_0x762b('0x1c')]+_0x2bbf93[_0x762b('0x1d')],_0x43093a;if(_0x27f9ee>=_0x4819de){_0x27f9ee=_0x4819de;_0x43093a=0xc8;}else{_0x43093a=0xce;}_0x132a5e[_0x762b('0x18')](_0x43093a);return _0x132a5e[_0x762b('0x1e')](_0x762b('0x1f'),_0x568fe7+'-'+_0x27f9ee+'/'+_0x4819de)['json'](_0x54187a);}return null;};}function patchUpdates(_0x232d93){return function(_0xc2e2cb){try{jsonpatch['apply'](_0xc2e2cb,_0x232d93,!![]);}catch(_0xe44f99){return BPromise[_0x762b('0x20')](_0xe44f99);}return _0xc2e2cb['save']();};}function saveUpdates(_0xfcdc82,_0x5b87ef){return function(_0x2ce1bf){if(_0x2ce1bf){return _0x2ce1bf[_0x762b('0x21')](_0xfcdc82)[_0x762b('0x22')](function(_0x4fc0ab){return _0x4fc0ab;});}return null;};}function removeEntity(_0x3de0c3,_0x475edf){return function(_0x203c14){if(_0x203c14){return _0x203c14[_0x762b('0x23')]()[_0x762b('0x22')](function(){_0x3de0c3[_0x762b('0x18')](0xcc)[_0x762b('0x19')]();});}};}function handleEntityNotFound(_0x1cf8c1,_0x38c573){return function(_0x58b962){if(!_0x58b962){_0x1cf8c1[_0x762b('0x24')](0x194);}return _0x58b962;};}function handleError(_0x1a6a04,_0x361448){_0x361448=_0x361448||0x1f4;return function(_0x3712b5){logger[_0x762b('0x25')](_0x3712b5[_0x762b('0x26')]);if(_0x3712b5[_0x762b('0x27')]){delete _0x3712b5[_0x762b('0x27')];}_0x1a6a04[_0x762b('0x18')](_0x361448)[_0x762b('0x28')](_0x3712b5);};}exports[_0x762b('0x29')]=function(_0x18bb4c,_0x1faca6){var _0x55637f={},_0x19f3eb={},_0x5d85e1={'count':0x0,'rows':[]};var _0x519a2b=_[_0x762b('0x2a')](db[_0x762b('0x2b')]['rawAttributes'],function(_0xa74e81){return{'name':_0xa74e81[_0x762b('0x2c')],'type':_0xa74e81[_0x762b('0x2d')]['key']};});_0x19f3eb['model']=_[_0x762b('0x2a')](_0x519a2b,_0x762b('0x27'));_0x19f3eb[_0x762b('0x2e')]=_[_0x762b('0x2f')](_0x18bb4c[_0x762b('0x2e')]);_0x19f3eb[_0x762b('0x30')]=_[_0x762b('0x31')](_0x19f3eb[_0x762b('0x32')],_0x19f3eb[_0x762b('0x2e')]);_0x55637f[_0x762b('0x33')]=_[_0x762b('0x31')](_0x19f3eb[_0x762b('0x32')],qs[_0x762b('0x34')](_0x18bb4c['query']['fields']));_0x55637f[_0x762b('0x33')]=_0x55637f[_0x762b('0x33')]['length']?_0x55637f['attributes']:_0x19f3eb[_0x762b('0x32')];if(!_0x18bb4c[_0x762b('0x2e')]['hasOwnProperty'](_0x762b('0x35'))){_0x55637f[_0x762b('0x1d')]=qs[_0x762b('0x1d')](_0x18bb4c[_0x762b('0x2e')][_0x762b('0x1d')]);_0x55637f['offset']=qs[_0x762b('0x1c')](_0x18bb4c['query'][_0x762b('0x1c')]);}_0x55637f[_0x762b('0x36')]=qs[_0x762b('0x37')](_0x18bb4c[_0x762b('0x2e')][_0x762b('0x37')]);_0x55637f[_0x762b('0x38')]=qs[_0x762b('0x30')](_['pick'](_0x18bb4c['query'],_0x19f3eb[_0x762b('0x30')]),_0x519a2b);if(_0x18bb4c['query']['filter']){_0x55637f[_0x762b('0x38')]=_[_0x762b('0x39')](_0x55637f['where'],{'$or':_[_0x762b('0x2a')](_0x519a2b,function(_0x55e619){if(_0x55e619[_0x762b('0x2d')]!=='VIRTUAL'){var _0x3bc142={};_0x3bc142[_0x55e619[_0x762b('0x27')]]={'$like':'%'+_0x18bb4c[_0x762b('0x2e')][_0x762b('0x3a')]+'%'};return _0x3bc142;}})});}_0x55637f=_[_0x762b('0x39')]({},_0x55637f,_0x18bb4c['options']);var _0x1cf4e2={'where':_0x55637f[_0x762b('0x38')]};return db[_0x762b('0x2b')][_0x762b('0x1b')](_0x1cf4e2)[_0x762b('0x22')](function(_0x2233a0){_0x5d85e1[_0x762b('0x1b')]=_0x2233a0;if(_0x18bb4c[_0x762b('0x2e')][_0x762b('0x3b')]){_0x55637f[_0x762b('0x3c')]=[{'all':!![]}];}return db[_0x762b('0x2b')][_0x762b('0x3d')](_0x55637f);})[_0x762b('0x22')](function(_0x4e7662){_0x5d85e1[_0x762b('0x3e')]=_0x4e7662;return _0x5d85e1;})[_0x762b('0x22')](respondWithFilteredResult(_0x1faca6,_0x55637f))[_0x762b('0x3f')](handleError(_0x1faca6,null));};exports[_0x762b('0x40')]=function(_0x3fd119,_0x3c5a8f){var _0x53ce58={'raw':!![],'where':{'id':_0x3fd119[_0x762b('0x41')]['id']}},_0x25b9d3={};_0x25b9d3[_0x762b('0x32')]=_[_0x762b('0x2f')](db[_0x762b('0x2b')]['rawAttributes']);_0x25b9d3[_0x762b('0x2e')]=_[_0x762b('0x2f')](_0x3fd119['query']);_0x25b9d3[_0x762b('0x30')]=_[_0x762b('0x31')](_0x25b9d3[_0x762b('0x32')],_0x25b9d3[_0x762b('0x2e')]);_0x53ce58[_0x762b('0x33')]=_[_0x762b('0x31')](_0x25b9d3[_0x762b('0x32')],qs['fields'](_0x3fd119[_0x762b('0x2e')][_0x762b('0x34')]));_0x53ce58['attributes']=_0x53ce58[_0x762b('0x33')][_0x762b('0x42')]?_0x53ce58[_0x762b('0x33')]:_0x25b9d3[_0x762b('0x32')];if(_0x3fd119['query'][_0x762b('0x3b')]){_0x53ce58['include']=[{'all':!![]}];}_0x53ce58=_[_0x762b('0x39')]({},_0x53ce58,_0x3fd119[_0x762b('0x43')]);return db[_0x762b('0x2b')][_0x762b('0x44')](_0x53ce58)['then'](handleEntityNotFound(_0x3c5a8f,null))['then'](respondWithResult(_0x3c5a8f,null))[_0x762b('0x3f')](handleError(_0x3c5a8f,null));};exports['create']=function(_0x4e0278,_0x4ec0c9){return db['ZendeskField'][_0x762b('0x45')](_0x4e0278['body'],{})[_0x762b('0x22')](respondWithResult(_0x4ec0c9,0xc9))[_0x762b('0x3f')](handleError(_0x4ec0c9,null));};exports[_0x762b('0x21')]=function(_0x1b9e1e,_0x180852){if(_0x1b9e1e[_0x762b('0x46')]['id']){delete _0x1b9e1e[_0x762b('0x46')]['id'];}return db[_0x762b('0x2b')][_0x762b('0x44')]({'where':{'id':_0x1b9e1e[_0x762b('0x41')]['id']}})[_0x762b('0x22')](handleEntityNotFound(_0x180852,null))[_0x762b('0x22')](saveUpdates(_0x1b9e1e[_0x762b('0x46')],null))[_0x762b('0x22')](respondWithResult(_0x180852,null))[_0x762b('0x3f')](handleError(_0x180852,null));};exports['destroy']=function(_0x4fde4b,_0x5cd2b3){return db[_0x762b('0x2b')][_0x762b('0x44')]({'where':{'id':_0x4fde4b['params']['id']}})[_0x762b('0x22')](handleEntityNotFound(_0x5cd2b3,null))[_0x762b('0x22')](removeEntity(_0x5cd2b3,null))['catch'](handleError(_0x5cd2b3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5b23c15..6cfa2b3 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 _0x97c1=['rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','FieldId','lodash','util','api','request-promise','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var logger=require('../../config/logger')(_0x197c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x197c('0x3'));var fs=require('fs');var path=require(_0x197c('0x4'));var rimraf=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var attributes=require(_0x197c('0x7'));module['exports']=function(_0x5cbff6,_0x1cb6e1){return _0x5cbff6[_0x197c('0x8')](_0x197c('0x9'),attributes,{'tableName':_0x197c('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x197c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9861=['api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x10d34a,_0x56a5a3){var _0x512ba7=function(_0x534170){while(--_0x534170){_0x10d34a['push'](_0x10d34a['shift']());}};_0x512ba7(++_0x56a5a3);}(_0x9861,0x176));var _0x1986=function(_0x1100e4,_0x1545b6){_0x1100e4=_0x1100e4-0x0;var _0x380665=_0x9861[_0x1100e4];return _0x380665;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1986('0x1'));var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var rp=require(_0x1986('0x4'));var fs=require('fs');var path=require(_0x1986('0x5'));var rimraf=require(_0x1986('0x6'));var config=require('../../config/environment');var attributes=require(_0x1986('0x7'));module[_0x1986('0x8')]=function(_0x1b56d6,_0x17ccbf){return _0x1b56d6[_0x1986('0x9')](_0x1986('0xa'),attributes,{'tableName':_0x1986('0xb'),'paranoid':![],'indexes':[{'name':_0x1986('0xc'),'fields':[_0x1986('0xd'),_0x1986('0xe')],'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 d58aa5c..1382628 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 _0x74a1=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch'];(function(_0x5e883c,_0x493118){var _0x2de3e9=function(_0x440b80){while(--_0x440b80){_0x5e883c['push'](_0x5e883c['shift']());}};_0x2de3e9(++_0x493118);}(_0x74a1,0x1b0));var _0x174a=function(_0x123831,_0x8fe1d6){_0x123831=_0x123831-0x0;var _0x47455b=_0x74a1[_0x123831];return _0x47455b;};'use strict';var _=require(_0x174a('0x0'));var util=require('util');var moment=require(_0x174a('0x1'));var BPromise=require(_0x174a('0x2'));var rs=require(_0x174a('0x3'));var fs=require('fs');var Redis=require(_0x174a('0x4'));var db=require(_0x174a('0x5'))['db'];var utils=require(_0x174a('0x6'));var logger=require(_0x174a('0x7'))(_0x174a('0x8'));var config=require(_0x174a('0x9'));var jayson=require(_0x174a('0xa'));var client=jayson[_0x174a('0xb')][_0x174a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14464e,_0x36c23d,_0x114519){return new BPromise(function(_0x526f7e,_0x228d20){return client[_0x174a('0xd')](_0x14464e,_0x114519)[_0x174a('0xe')](function(_0x126b46){logger[_0x174a('0xf')](_0x174a('0x10'),_0x36c23d,_0x174a('0x11'));logger['debug'](_0x174a('0x12'),_0x36c23d,_0x174a('0x11'),JSON['stringify'](_0x126b46));if(_0x126b46['error']){if(_0x126b46['error'][_0x174a('0x13')]===0x1f4){logger[_0x174a('0x14')](_0x174a('0x10'),_0x36c23d,_0x126b46['error'][_0x174a('0x15')]);return _0x228d20(_0x126b46['error'][_0x174a('0x15')]);}logger[_0x174a('0x14')]('ZendeskField,\x20%s,\x20%s',_0x36c23d,_0x126b46['error'][_0x174a('0x15')]);return _0x526f7e(_0x126b46[_0x174a('0x14')]['message']);}else{logger[_0x174a('0xf')](_0x174a('0x10'),_0x36c23d,_0x174a('0x11'));_0x526f7e(_0x126b46[_0x174a('0x16')][_0x174a('0x15')]);}})[_0x174a('0x17')](function(_0x5b7b5d){logger[_0x174a('0x14')](_0x174a('0x10'),_0x36c23d,_0x5b7b5d);_0x228d20(_0x5b7b5d);});});} \ No newline at end of file +var _0xac5b=['http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xac5b,0xf4));var _0xbac5=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xac5b[_0x4b91c4];return _0x25cb80;};'use strict';var _=require('lodash');var util=require(_0xbac5('0x0'));var moment=require('moment');var BPromise=require(_0xbac5('0x1'));var rs=require(_0xbac5('0x2'));var fs=require('fs');var Redis=require(_0xbac5('0x3'));var db=require(_0xbac5('0x4'))['db'];var utils=require(_0xbac5('0x5'));var logger=require(_0xbac5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbac5('0x7'));var client=jayson['client'][_0xbac5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16720d,_0x32c9d2,_0x2bdd96){return new BPromise(function(_0x49062a,_0x8227e8){return client[_0xbac5('0x9')](_0x16720d,_0x2bdd96)[_0xbac5('0xa')](function(_0x4b378b){logger[_0xbac5('0xb')](_0xbac5('0xc'),_0x32c9d2,'request\x20sent');logger[_0xbac5('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x32c9d2,_0xbac5('0xe'),JSON[_0xbac5('0xf')](_0x4b378b));if(_0x4b378b[_0xbac5('0x10')]){if(_0x4b378b['error'][_0xbac5('0x11')]===0x1f4){logger[_0xbac5('0x10')](_0xbac5('0xc'),_0x32c9d2,_0x4b378b['error']['message']);return _0x8227e8(_0x4b378b[_0xbac5('0x10')][_0xbac5('0x12')]);}logger[_0xbac5('0x10')]('ZendeskField,\x20%s,\x20%s',_0x32c9d2,_0x4b378b[_0xbac5('0x10')]['message']);return _0x49062a(_0x4b378b[_0xbac5('0x10')]['message']);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x32c9d2,_0xbac5('0xe'));_0x49062a(_0x4b378b[_0xbac5('0x13')][_0xbac5('0x12')]);}})[_0xbac5('0x14')](function(_0x599211){logger['error']('ZendeskField,\x20%s,\x20%s',_0x32c9d2,_0x599211);_0x8227e8(_0x599211);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4928806..f0fe845 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 _0x5770=['/:id/configurations','getConfigurations','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id'];(function(_0x57f9bb,_0x53d4bf){var _0x540dc9=function(_0x2fbb5f){while(--_0x2fbb5f){_0x57f9bb['push'](_0x57f9bb['shift']());}};_0x540dc9(++_0x53d4bf);}(_0x5770,0x8d));var _0x0577=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0x5770[_0x17c8cc];return _0x3db4eb;};'use strict';var multer=require(_0x0577('0x0'));var util=require(_0x0577('0x1'));var path=require(_0x0577('0x2'));var timeout=require(_0x0577('0x3'));var express=require('express');var router=express[_0x0577('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0577('0x5'));var config=require(_0x0577('0x6'));var controller=require(_0x0577('0x7'));router[_0x0577('0x8')]('/',auth[_0x0577('0x9')](),controller['index']);router['get'](_0x0577('0xa'),auth[_0x0577('0x9')](),controller['show']);router[_0x0577('0x8')](_0x0577('0xb'),auth[_0x0577('0x9')](),controller[_0x0577('0xc')]);router['get']('/:id/fields',auth[_0x0577('0x9')](),controller['getFields']);router['post']('/',auth[_0x0577('0x9')](),controller[_0x0577('0xd')]);router['post']('/:id/configurations',auth[_0x0577('0x9')](),controller['addConfiguration']);router[_0x0577('0xe')](_0x0577('0xa'),auth['isAuthenticated'](),controller[_0x0577('0xf')]);router[_0x0577('0x10')](_0x0577('0xa'),auth[_0x0577('0x9')](),controller[_0x0577('0x11')]);module[_0x0577('0x12')]=router; \ No newline at end of file +var _0x0c53=['/:id/configurations','addConfiguration','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','/:id','isAuthenticated','show','get','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x5bc9c9,_0x12a67c){var _0x44a280=function(_0x177949){while(--_0x177949){_0x5bc9c9['push'](_0x5bc9c9['shift']());}};_0x44a280(++_0x12a67c);}(_0x0c53,0x1ba));var _0x30c5=function(_0x106f2f,_0x483553){_0x106f2f=_0x106f2f-0x0;var _0x4fe056=_0x0c53[_0x106f2f];return _0x4fe056;};'use strict';var multer=require('multer');var util=require(_0x30c5('0x0'));var path=require(_0x30c5('0x1'));var timeout=require(_0x30c5('0x2'));var express=require(_0x30c5('0x3'));var router=express[_0x30c5('0x4')]();var auth=require(_0x30c5('0x5'));var interaction=require(_0x30c5('0x6'));var config=require(_0x30c5('0x7'));var controller=require(_0x30c5('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x30c5('0x9'),auth[_0x30c5('0xa')](),controller[_0x30c5('0xb')]);router[_0x30c5('0xc')]('/:id/configurations',auth[_0x30c5('0xa')](),controller[_0x30c5('0xd')]);router[_0x30c5('0xc')](_0x30c5('0xe'),auth[_0x30c5('0xa')](),controller[_0x30c5('0xf')]);router[_0x30c5('0x10')]('/',auth[_0x30c5('0xa')](),controller[_0x30c5('0x11')]);router[_0x30c5('0x10')](_0x30c5('0x12'),auth[_0x30c5('0xa')](),controller[_0x30c5('0x13')]);router[_0x30c5('0x14')](_0x30c5('0x9'),auth[_0x30c5('0xa')](),controller['update']);router[_0x30c5('0x15')](_0x30c5('0x9'),auth[_0x30c5('0xa')](),controller['destroy']);module[_0x30c5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 38eb7d6..4bb2b3f 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 _0x49c5=['STRING','sequelize'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x49c5,0x191));var _0x549c=function(_0x4df1d5,_0xc0749d){_0x4df1d5=_0x4df1d5-0x0;var _0x1a62dd=_0x49c5[_0x4df1d5];return _0x1a62dd;};'use strict';var Sequelize=require(_0x549c('0x0'));module['exports']={'name':{'type':Sequelize[_0x549c('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x549c('0x1')]},'zone':{'type':Sequelize[_0x549c('0x1')]},'clientId':{'type':Sequelize[_0x549c('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x549c('0x1')]},'code':{'type':Sequelize[_0x549c('0x1')]},'refreshToken':{'type':Sequelize[_0x549c('0x1')]}}; \ No newline at end of file +var _0xa818=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa818,0xd6));var _0x8a81=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xa818[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x8a81('0x0'));module[_0x8a81('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8a81('0x2')]},'host':{'type':Sequelize[_0x8a81('0x2')]},'zone':{'type':Sequelize[_0x8a81('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x8a81('0x2')]},'serverUrl':{'type':Sequelize[_0x8a81('0x2')]},'code':{'type':Sequelize[_0x8a81('0x2')]},'refreshToken':{'type':Sequelize[_0x8a81('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 07506cd..72fc7de 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 _0xe65e=['count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','include','find','create','body','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','ZohoField','Descriptions','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','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','serverUrl','host','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','includes','api_name','system_mandatory','push','display_label','pick_list_values','statusCode','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0xe65e,0x17a));var _0xee65=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe65e[_0x199572];return _0x13cfa3;};'use strict';var pdf=require(_0xee65('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xee65('0x1'));var zipdir=require(_0xee65('0x2'));var jsonpatch=require(_0xee65('0x3'));var rp=require(_0xee65('0x4'));var moment=require(_0xee65('0x5'));var BPromise=require(_0xee65('0x6'));var Mustache=require(_0xee65('0x7'));var util=require(_0xee65('0x8'));var path=require('path');var sox=require(_0xee65('0x9'));var csv=require('to-csv');var ejs=require(_0xee65('0xa'));var fs=require('fs');var _=require(_0xee65('0xb'));var squel=require('squel');var crypto=require(_0xee65('0xc'));var jsforce=require(_0xee65('0xd'));var deskjs=require(_0xee65('0xe'));var toCsv=require('to-csv');var querystring=require(_0xee65('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee65('0x10'));var qs=require(_0xee65('0x11'));var as=require(_0xee65('0x12'));var hardwareService=require(_0xee65('0x13'));var logger=require(_0xee65('0x14'))(_0xee65('0x15'));var utils=require('../../config/utils');var config=require(_0xee65('0x16'));var db=require(_0xee65('0x17'))['db'];var integrations=require(_0xee65('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee65('0x19')]({'port':0x232a});function checkPasswordPattern(_0x13e1e3,_0x39d21b,_0x51c198){if(_0x51c198){var _0x34cab1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34cab1[_0xee65('0x1a')](_0x39d21b)){return _0x13e1e3;}else{throw new db[(_0xee65('0x1b'))]['ValidationError'](_0xee65('0x1c'));}}else{return _0x13e1e3;}}function respondWithRpcPromise(_0x3da738,_0x2a3249,_0x393f5c,_0x1aa4d1){return new BPromise(function(_0x5c71a1,_0x4dda12){var _0x5961b2=_0x1aa4d1||client;return _0x5961b2[_0xee65('0x1d')](_0x3da738,_0x393f5c)[_0xee65('0x1e')](function(_0x49c087){logger['info'](_0xee65('0x1f'),_0x2a3249,_0xee65('0x20'));logger[_0xee65('0x21')](_0xee65('0x22'),_0x2a3249,'request\x20sent',JSON[_0xee65('0x23')](_0x49c087));if(_0x49c087[_0xee65('0x24')]){if(_0x49c087[_0xee65('0x24')][_0xee65('0x25')]===0x1f4){logger[_0xee65('0x24')]('ZohoAccount,\x20%s,\x20%s',_0x2a3249,_0x49c087['error'][_0xee65('0x26')]);return _0x4dda12(_0x49c087[_0xee65('0x24')][_0xee65('0x26')]);}logger['error'](_0xee65('0x1f'),_0x2a3249,_0x49c087[_0xee65('0x24')]['message']);return _0x5c71a1(_0x49c087[_0xee65('0x24')][_0xee65('0x26')]);}else{logger[_0xee65('0x27')]('ZohoAccount,\x20%s,\x20%s',_0x2a3249,_0xee65('0x20'));_0x5c71a1(_0x49c087[_0xee65('0x28')]['message']);}})[_0xee65('0x29')](function(_0x273dfd){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2a3249,_0x273dfd);_0x4dda12(_0x273dfd);});});}function respondWithStatusCode(_0x5c4f52,_0x5b40c0){_0x5b40c0=_0x5b40c0||0xcc;return function(_0x1ab1ab){if(_0x1ab1ab){return _0x5c4f52['sendStatus'](_0x5b40c0);}return _0x5c4f52[_0xee65('0x2a')](_0x5b40c0)[_0xee65('0x2b')]();};}function respondWithResult(_0x29f61c,_0x5c0d17){_0x5c0d17=_0x5c0d17||0xc8;return function(_0x2fd3b2){if(_0x2fd3b2){return _0x29f61c[_0xee65('0x2a')](_0x5c0d17)[_0xee65('0x2c')](_0x2fd3b2);}};}function respondWithFilteredResult(_0x315648,_0x5cfa68){return function(_0x3eb5ae){if(_0x3eb5ae){var _0x4b290d=_0x3eb5ae[_0xee65('0x2d')],_0x2ae08b=_0x5cfa68[_0xee65('0x2e')],_0x10ac1c=_0x5cfa68[_0xee65('0x2e')]+_0x5cfa68['limit'],_0x586f9;if(_0x10ac1c>=_0x4b290d){_0x10ac1c=_0x4b290d;_0x586f9=0xc8;}else{_0x586f9=0xce;}_0x315648[_0xee65('0x2a')](_0x586f9);return _0x315648[_0xee65('0x2f')](_0xee65('0x30'),_0x2ae08b+'-'+_0x10ac1c+'/'+_0x4b290d)[_0xee65('0x2c')](_0x3eb5ae);}return null;};}function patchUpdates(_0x2acf1e){return function(_0x501ca2){try{jsonpatch[_0xee65('0x31')](_0x501ca2,_0x2acf1e,!![]);}catch(_0x2e3cc2){return BPromise[_0xee65('0x32')](_0x2e3cc2);}return _0x501ca2[_0xee65('0x33')]();};}function saveUpdates(_0x5cd07a,_0xacd149){return function(_0x53f37c){if(_0x53f37c){return _0x53f37c[_0xee65('0x34')](_0x5cd07a)[_0xee65('0x1e')](function(_0x242859){return _0x242859;});}return null;};}function removeEntity(_0x56a8e3,_0x33a074){return function(_0x220a11){if(_0x220a11){return _0x220a11[_0xee65('0x35')]()[_0xee65('0x1e')](function(){_0x56a8e3[_0xee65('0x2a')](0xcc)[_0xee65('0x2b')]();});}};}function handleEntityNotFound(_0x3173fa,_0x41a0da){return function(_0x266422){if(!_0x266422){_0x3173fa[_0xee65('0x36')](0x194);}return _0x266422;};}function handleError(_0x1d768f,_0x4c0138){_0x4c0138=_0x4c0138||0x1f4;return function(_0x4edcb8){logger[_0xee65('0x24')](_0x4edcb8[_0xee65('0x37')]);if(_0x4edcb8[_0xee65('0x38')]){delete _0x4edcb8[_0xee65('0x38')];}_0x1d768f[_0xee65('0x2a')](_0x4c0138)[_0xee65('0x39')](_0x4edcb8);};}exports['index']=function(_0x86a18c,_0x5a739b){var _0x4fba9d={},_0x2835af={},_0x13dae3={'count':0x0,'rows':[]};var _0x34a787=_[_0xee65('0x3a')](db[_0xee65('0x3b')][_0xee65('0x3c')],function(_0x27b060){return{'name':_0x27b060[_0xee65('0x3d')],'type':_0x27b060[_0xee65('0x3e')][_0xee65('0x3f')]};});_0x2835af['model']=_[_0xee65('0x3a')](_0x34a787,'name');_0x2835af[_0xee65('0x40')]=_[_0xee65('0x41')](_0x86a18c[_0xee65('0x40')]);_0x2835af[_0xee65('0x42')]=_[_0xee65('0x43')](_0x2835af[_0xee65('0x44')],_0x2835af[_0xee65('0x40')]);_0x4fba9d[_0xee65('0x45')]=_[_0xee65('0x43')](_0x2835af[_0xee65('0x44')],qs[_0xee65('0x46')](_0x86a18c[_0xee65('0x40')][_0xee65('0x46')]));_0x4fba9d[_0xee65('0x45')]=_0x4fba9d[_0xee65('0x45')][_0xee65('0x47')]?_0x4fba9d[_0xee65('0x45')]:_0x2835af[_0xee65('0x44')];if(!_0x86a18c['query'][_0xee65('0x48')](_0xee65('0x49'))){_0x4fba9d[_0xee65('0x4a')]=qs[_0xee65('0x4a')](_0x86a18c[_0xee65('0x40')][_0xee65('0x4a')]);_0x4fba9d['offset']=qs[_0xee65('0x2e')](_0x86a18c['query'][_0xee65('0x2e')]);}_0x4fba9d[_0xee65('0x4b')]=qs[_0xee65('0x4c')](_0x86a18c[_0xee65('0x40')]['sort']);_0x4fba9d[_0xee65('0x4d')]=qs['filters'](_[_0xee65('0x4e')](_0x86a18c[_0xee65('0x40')],_0x2835af[_0xee65('0x42')]),_0x34a787);if(_0x86a18c['query'][_0xee65('0x4f')]){_0x4fba9d[_0xee65('0x4d')]=_[_0xee65('0x50')](_0x4fba9d[_0xee65('0x4d')],{'$or':_[_0xee65('0x3a')](_0x34a787,function(_0xfabdae){if(_0xfabdae[_0xee65('0x3e')]!==_0xee65('0x51')){var _0x575d2b={};_0x575d2b[_0xfabdae[_0xee65('0x38')]]={'$like':'%'+_0x86a18c[_0xee65('0x40')][_0xee65('0x4f')]+'%'};return _0x575d2b;}})});}_0x4fba9d=_[_0xee65('0x50')]({},_0x4fba9d,_0x86a18c[_0xee65('0x52')]);var _0x178135={'where':_0x4fba9d[_0xee65('0x4d')]};return db[_0xee65('0x3b')][_0xee65('0x2d')](_0x178135)[_0xee65('0x1e')](function(_0x1cbeeb){_0x13dae3['count']=_0x1cbeeb;if(_0x86a18c[_0xee65('0x40')]['includeAll']){_0x4fba9d['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xee65('0x53')](_0x4fba9d);})[_0xee65('0x1e')](function(_0x3788b6){_0x13dae3[_0xee65('0x54')]=_0x3788b6;return _0x13dae3;})[_0xee65('0x1e')](respondWithFilteredResult(_0x5a739b,_0x4fba9d))[_0xee65('0x29')](handleError(_0x5a739b,null));};exports[_0xee65('0x55')]=function(_0x238411,_0x1804d4){var _0x1696a6={'raw':![],'where':{'id':_0x238411[_0xee65('0x56')]['id']}},_0x5deea0={};_0x5deea0[_0xee65('0x44')]=_[_0xee65('0x41')](db[_0xee65('0x3b')][_0xee65('0x3c')]);_0x5deea0[_0xee65('0x40')]=_[_0xee65('0x41')](_0x238411[_0xee65('0x40')]);_0x5deea0[_0xee65('0x42')]=_[_0xee65('0x43')](_0x5deea0[_0xee65('0x44')],_0x5deea0[_0xee65('0x40')]);_0x1696a6[_0xee65('0x45')]=_['intersection'](_0x5deea0['model'],qs[_0xee65('0x46')](_0x238411[_0xee65('0x40')][_0xee65('0x46')]));_0x1696a6['attributes']=_0x1696a6[_0xee65('0x45')][_0xee65('0x47')]?_0x1696a6[_0xee65('0x45')]:_0x5deea0[_0xee65('0x44')];if(_0x238411[_0xee65('0x40')]['includeAll']){_0x1696a6[_0xee65('0x57')]=[{'all':!![]}];}_0x1696a6=_['merge']({},_0x1696a6,_0x238411['options']);return db[_0xee65('0x3b')][_0xee65('0x58')](_0x1696a6)['then'](handleEntityNotFound(_0x1804d4,null))[_0xee65('0x1e')](respondWithResult(_0x1804d4,null))['catch'](handleError(_0x1804d4,null));};exports[_0xee65('0x59')]=function(_0x6fd6dc,_0x5481fe){return db['ZohoAccount']['create'](_0x6fd6dc[_0xee65('0x5a')],{})['then'](respondWithResult(_0x5481fe,0xc9))[_0xee65('0x29')](handleError(_0x5481fe,null));};exports['update']=function(_0x1bdbcd,_0x437c5f){if(_0x1bdbcd['body']['id']){delete _0x1bdbcd['body']['id'];}return db[_0xee65('0x3b')][_0xee65('0x58')]({'where':{'id':_0x1bdbcd[_0xee65('0x56')]['id']}})[_0xee65('0x1e')](handleEntityNotFound(_0x437c5f,null))['then'](saveUpdates(_0x1bdbcd['body'],null))[_0xee65('0x1e')](respondWithResult(_0x437c5f,null))[_0xee65('0x29')](handleError(_0x437c5f,null));};exports[_0xee65('0x35')]=function(_0x1b27c6,_0x3b5e4a){return db['ZohoAccount'][_0xee65('0x58')]({'where':{'id':_0x1b27c6[_0xee65('0x56')]['id']}})[_0xee65('0x1e')](handleEntityNotFound(_0x3b5e4a,null))[_0xee65('0x1e')](removeEntity(_0x3b5e4a,null))[_0xee65('0x29')](handleError(_0x3b5e4a,null));};exports['getConfigurations']=function(_0x2a0a5b,_0x5d9881,_0x4fe912){var _0x3f2378={};var _0x4b39f3={};var _0x8e661b;var _0x36a234;return db[_0xee65('0x3b')][_0xee65('0x5b')]({'where':{'id':_0x2a0a5b[_0xee65('0x56')]['id']}})['then'](handleEntityNotFound(_0x5d9881,null))[_0xee65('0x1e')](function(_0xebed15){if(_0xebed15){_0x8e661b=_0xebed15;_0x4b39f3[_0xee65('0x44')]=_['keys'](db[_0xee65('0x5c')][_0xee65('0x3c')]);_0x4b39f3[_0xee65('0x40')]=_['keys'](_0x2a0a5b[_0xee65('0x40')]);_0x4b39f3[_0xee65('0x42')]=_['intersection'](_0x4b39f3[_0xee65('0x44')],_0x4b39f3['query']);_0x3f2378[_0xee65('0x45')]=_[_0xee65('0x43')](_0x4b39f3[_0xee65('0x44')],qs[_0xee65('0x46')](_0x2a0a5b[_0xee65('0x40')][_0xee65('0x46')]));_0x3f2378[_0xee65('0x45')]=_0x3f2378['attributes'][_0xee65('0x47')]?_0x3f2378[_0xee65('0x45')]:_0x4b39f3[_0xee65('0x44')];_0x3f2378['order']=qs[_0xee65('0x4c')](_0x2a0a5b[_0xee65('0x40')][_0xee65('0x4c')]);_0x3f2378['where']=qs[_0xee65('0x42')](_[_0xee65('0x4e')](_0x2a0a5b[_0xee65('0x40')],_0x4b39f3[_0xee65('0x42')]));if(_0x2a0a5b['query'][_0xee65('0x4f')]){_0x3f2378[_0xee65('0x4d')]=_[_0xee65('0x50')](_0x3f2378[_0xee65('0x4d')],{'$or':_['map'](_0x3f2378[_0xee65('0x45')],function(_0x239925){var _0x190b93={};_0x190b93[_0x239925]={'$like':'%'+_0x2a0a5b['query'][_0xee65('0x4f')]+'%'};return _0x190b93;})});}_0x3f2378=_[_0xee65('0x50')]({},_0x3f2378,_0x2a0a5b[_0xee65('0x52')]);return _0x8e661b[_0xee65('0x5d')](_0x3f2378);}})[_0xee65('0x1e')](function(_0x4ba19b){if(_0x4ba19b){_0x36a234=_0x4ba19b[_0xee65('0x47')];if(!_0x2a0a5b[_0xee65('0x40')][_0xee65('0x48')](_0xee65('0x49'))){_0x3f2378[_0xee65('0x4a')]=qs[_0xee65('0x4a')](_0x2a0a5b[_0xee65('0x40')][_0xee65('0x4a')]);_0x3f2378['offset']=qs['offset'](_0x2a0a5b[_0xee65('0x40')]['offset']);}return _0x8e661b['getConfigurations'](_0x3f2378);}})['then'](function(_0x3fc928){if(_0x3fc928){return _0x3fc928?{'count':_0x36a234,'rows':_0x3fc928}:null;}})[_0xee65('0x1e')](respondWithResult(_0x5d9881,null))[_0xee65('0x29')](handleError(_0x5d9881,null));};exports[_0xee65('0x5e')]=function(_0x48f334,_0x33002d,_0x2470e0){if(_0x48f334[_0xee65('0x5a')]['id']){delete _0x48f334[_0xee65('0x5a')]['id'];}return db[_0xee65('0x3b')][_0xee65('0x5b')]({'where':{'id':_0x48f334[_0xee65('0x56')]['id']}})[_0xee65('0x1e')](handleEntityNotFound(_0x33002d,null))[_0xee65('0x1e')](function(_0x25cf77){if(_0x25cf77){_0x48f334[_0xee65('0x5a')][_0xee65('0x5f')]=_0x25cf77['id'];_0x48f334[_0xee65('0x5a')][_0xee65('0x60')]=integrations[_0xee65('0x61')](_0x48f334[_0xee65('0x5a')][_0xee65('0x62')],_0x48f334[_0xee65('0x5a')][_0xee65('0x3e')]);_0x48f334['body']['Descriptions']=integrations['getDescriptions'](_0x48f334[_0xee65('0x5a')][_0xee65('0x62')],_0x48f334[_0xee65('0x5a')][_0xee65('0x3e')]);return db['ZohoConfiguration'][_0xee65('0x59')](_0x48f334[_0xee65('0x5a')],{'include':[{'model':db[_0xee65('0x63')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xee65('0x64')}]});}return null;})['then'](respondWithResult(_0x33002d,null))['catch'](handleError(_0x33002d,null));};function getAccessToken(_0x10f5f2){return new Promise(function(_0x5a24bf,_0x4ce8ae){var _0x56baae;switch(_0x10f5f2['zone']){case'US':_0x56baae=_0xee65('0x65');break;case'AU':_0x56baae=_0xee65('0x66');break;case'EU':_0x56baae=_0xee65('0x67');break;case'IN':_0x56baae=_0xee65('0x68');break;case'CN':_0x56baae=_0xee65('0x69');break;default:_0x56baae='https://accounts.zoho.eu';break;}var _0x34ceba={'method':_0xee65('0x6a'),'uri':_0x56baae+_0xee65('0x6b'),'qs':{'refresh_token':_0x10f5f2[_0xee65('0x6c')],'client_id':_0x10f5f2[_0xee65('0x6d')],'client_secret':_0x10f5f2[_0xee65('0x6e')],'grant_type':_0xee65('0x6f')},'json':!![]};return rp(_0x34ceba)[_0xee65('0x1e')](function(_0x494cac){if(_0x494cac['access_token']){_0x5a24bf(_0x494cac['access_token']);}else{_0x4ce8ae(_0xee65('0x70'));}})[_0xee65('0x29')](function(_0x65a00a){_0x4ce8ae(_0x65a00a);});});}exports[_0xee65('0x71')]=function(_0x4305e2,_0xbca0ce,_0x2b17ac){var _0x3a71df,_0x26bcfe,_0x3f1423,_0x2355e2,_0xd392d6;return db[_0xee65('0x3b')]['findOne']({'where':{'id':_0x4305e2[_0xee65('0x56')]['id']},'attributes':['id','host',_0xee65('0x72'),_0xee65('0x6d'),_0xee65('0x6e'),_0xee65('0x73'),_0xee65('0x25'),'refreshToken']})[_0xee65('0x1e')](handleEntityNotFound(_0xbca0ce,null))[_0xee65('0x1e')](function(_0x14b60a){_0xd392d6=_0x14b60a;_0x3a71df=_0xd392d6[_0xee65('0x74')];_0x26bcfe=_0x3a71df==='zoho.eu'?'eu':_0xee65('0x75');_0x3f1423=_0xd392d6['serverUrl'];var _0x3d5f5f=_0x3f1423[_0xee65('0x76')](-0x1);if(_0x3d5f5f==='/'||_0x3d5f5f==='\x5c'||_0x3d5f5f===':'){_0x3f1423=_0x3f1423[_0xee65('0x77')](0x0,_0x3f1423[_0xee65('0x78')](_0x3d5f5f));}if(!_0xd392d6[_0xee65('0x6c')]){throw new Error(_0xee65('0x79'));}return getAccessToken(_0xd392d6);})[_0xee65('0x1e')](function(_0x30f112){if(_0x30f112){return rp({'method':_0xee65('0x7a'),'uri':util[_0xee65('0x7b')](_0xee65('0x7c'),_0x26bcfe),'qs':{'module':_0xee65('0x7d')},'headers':{'Authorization':_0xee65('0x7e')+_0x30f112},'json':!![]});}})[_0xee65('0x1e')](function(_0xc9fbdf){if(_0xc9fbdf){if(_0xc9fbdf[_0xee65('0x7f')]&&_0xc9fbdf[_0xee65('0x7f')]['error']){throw new Error(_0xc9fbdf['response'][_0xee65('0x24')]['message']);}var _0x496c2a=[];var _0x1cb447=[];var _0x572a36=['Owner',_0xee65('0x80'),'Description',_0xee65('0x81'),_0xee65('0x82'),_0xee65('0x83'),'Call_Start_Time',_0xee65('0x84')];_0x1cb447=_['remove'](_0xc9fbdf[_0xee65('0x46')],function(_0xcf9e2a){return _0x572a36[_0xee65('0x85')](_0xcf9e2a[_0xee65('0x86')]);});for(var _0x3d1efb=0x0;_0x3d1efb<_0x1cb447[_0xee65('0x47')];_0x3d1efb++){if(_0x1cb447[_0x3d1efb][_0xee65('0x87')]===![]){_0x496c2a[_0xee65('0x88')]({'id':_0x1cb447[_0x3d1efb]['id'],'name':_0x1cb447[_0x3d1efb][_0xee65('0x89')],'custom':_0x1cb447[_0x3d1efb]['custom_field'],'options':_0x1cb447[_0x3d1efb]['data_type']==='picklist'&&_0x1cb447[_0x3d1efb][_0xee65('0x8a')][_0xee65('0x47')]>-0x1?_['map'](_0x1cb447[_0x3d1efb][_0xee65('0x8a')],function(_0x3496c7){return{'name':_0x3496c7,'value':_0x3496c7};}):[]});}}return{'count':_0x496c2a[_0xee65('0x47')],'rows':_0x496c2a};}else{return{'count':0x0,'rows':[]};}})[_0xee65('0x1e')](respondWithResult(_0xbca0ce,null))[_0xee65('0x29')](function(_0x4044bb){var _0x543fc7=_0x4305e2['query'][_0xee65('0x1a')]?0x1f4:_0x4044bb[_0xee65('0x8b')]||0x1f4;logger[_0xee65('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xee65('0x71'),_0x543fc7,JSON[_0xee65('0x23')](_0x4044bb));delete _0x4044bb['name'];if(_0x543fc7===0x191){_0x543fc7=0x190;}_0xbca0ce[_0xee65('0x2a')](_0x543fc7)[_0xee65('0x39')](_0x4305e2[_0xee65('0x40')][_0xee65('0x1a')]?{'message':_0xee65('0x8c'),'statusCode':_0x4044bb[_0xee65('0x8b')]}:_0x4044bb);});}; \ No newline at end of file +var _0x1c3d=['Description','WhoId','Call_Result','Call_Start_Time','api_name','push','display_label','data_type','picklist','pick_list_values','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','count','limit','set','Content-Range','reject','save','update','destroy','end','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','merge','where','includeAll','include','findAll','rows','show','params','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject'];(function(_0x283013,_0x31a15a){var _0x28310f=function(_0x119190){while(--_0x119190){_0x283013['push'](_0x283013['shift']());}};_0x28310f(++_0x31a15a);}(_0x1c3d,0x116));var _0xd1c3=function(_0x4d9076,_0x3a9c44){_0x4d9076=_0x4d9076-0x0;var _0x127f8d=_0x1c3d[_0x4d9076];return _0x127f8d;};'use strict';var pdf=require(_0xd1c3('0x0'));var emlformat=require(_0xd1c3('0x1'));var rimraf=require(_0xd1c3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1c3('0x3'));var rp=require(_0xd1c3('0x4'));var moment=require(_0xd1c3('0x5'));var BPromise=require(_0xd1c3('0x6'));var Mustache=require('mustache');var util=require(_0xd1c3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd1c3('0x8'));var ejs=require(_0xd1c3('0x9'));var fs=require('fs');var _=require(_0xd1c3('0xa'));var squel=require(_0xd1c3('0xb'));var crypto=require(_0xd1c3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd1c3('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd1c3('0xe'));var Papa=require(_0xd1c3('0xf'));var Redis=require('ioredis');var authService=require(_0xd1c3('0x10'));var qs=require(_0xd1c3('0x11'));var as=require(_0xd1c3('0x12'));var hardwareService=require(_0xd1c3('0x13'));var logger=require(_0xd1c3('0x14'))(_0xd1c3('0x15'));var utils=require(_0xd1c3('0x16'));var config=require(_0xd1c3('0x17'));var db=require(_0xd1c3('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xd1c3('0x19')][_0xd1c3('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x370853,_0x950f18,_0x424d44){if(_0x424d44){var _0x5b3613=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b3613[_0xd1c3('0x1b')](_0x950f18)){return _0x370853;}else{throw new db[(_0xd1c3('0x1c'))][(_0xd1c3('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 _0x370853;}}function respondWithRpcPromise(_0x51ee72,_0x157a2b,_0x43f346,_0x145c5a){return new BPromise(function(_0x68a96,_0x49dd3f){var _0xb9af47=_0x145c5a||client;return _0xb9af47['request'](_0x51ee72,_0x43f346)[_0xd1c3('0x1e')](function(_0x139ee7){logger[_0xd1c3('0x1f')](_0xd1c3('0x20'),_0x157a2b,_0xd1c3('0x21'));logger[_0xd1c3('0x22')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x157a2b,_0xd1c3('0x21'),JSON[_0xd1c3('0x23')](_0x139ee7));if(_0x139ee7[_0xd1c3('0x24')]){if(_0x139ee7['error'][_0xd1c3('0x25')]===0x1f4){logger[_0xd1c3('0x24')](_0xd1c3('0x20'),_0x157a2b,_0x139ee7[_0xd1c3('0x24')]['message']);return _0x49dd3f(_0x139ee7['error'][_0xd1c3('0x26')]);}logger[_0xd1c3('0x24')](_0xd1c3('0x20'),_0x157a2b,_0x139ee7['error'][_0xd1c3('0x26')]);return _0x68a96(_0x139ee7[_0xd1c3('0x24')][_0xd1c3('0x26')]);}else{logger['info'](_0xd1c3('0x20'),_0x157a2b,_0xd1c3('0x21'));_0x68a96(_0x139ee7[_0xd1c3('0x27')][_0xd1c3('0x26')]);}})[_0xd1c3('0x28')](function(_0xb6eb78){logger[_0xd1c3('0x24')](_0xd1c3('0x20'),_0x157a2b,_0xb6eb78);_0x49dd3f(_0xb6eb78);});});}function respondWithStatusCode(_0x147cde,_0x56180f){_0x56180f=_0x56180f||0xcc;return function(_0x1bf740){if(_0x1bf740){return _0x147cde['sendStatus'](_0x56180f);}return _0x147cde[_0xd1c3('0x29')](_0x56180f)['end']();};}function respondWithResult(_0x12d0d8,_0x31e960){_0x31e960=_0x31e960||0xc8;return function(_0x298b97){if(_0x298b97){return _0x12d0d8[_0xd1c3('0x29')](_0x31e960)[_0xd1c3('0x2a')](_0x298b97);}};}function respondWithFilteredResult(_0xf7bc3b,_0x2dba04){return function(_0x7d8edb){if(_0x7d8edb){var _0x661df6=_0x7d8edb[_0xd1c3('0x2b')],_0x2b5997=_0x2dba04['offset'],_0x5b9075=_0x2dba04['offset']+_0x2dba04[_0xd1c3('0x2c')],_0x743dfd;if(_0x5b9075>=_0x661df6){_0x5b9075=_0x661df6;_0x743dfd=0xc8;}else{_0x743dfd=0xce;}_0xf7bc3b[_0xd1c3('0x29')](_0x743dfd);return _0xf7bc3b[_0xd1c3('0x2d')](_0xd1c3('0x2e'),_0x2b5997+'-'+_0x5b9075+'/'+_0x661df6)[_0xd1c3('0x2a')](_0x7d8edb);}return null;};}function patchUpdates(_0x47ae92){return function(_0x6d934b){try{jsonpatch['apply'](_0x6d934b,_0x47ae92,!![]);}catch(_0x8d7be9){return BPromise[_0xd1c3('0x2f')](_0x8d7be9);}return _0x6d934b[_0xd1c3('0x30')]();};}function saveUpdates(_0x6ad0f6,_0x557701){return function(_0x2fca8a){if(_0x2fca8a){return _0x2fca8a[_0xd1c3('0x31')](_0x6ad0f6)[_0xd1c3('0x1e')](function(_0x615389){return _0x615389;});}return null;};}function removeEntity(_0x4c7c4f,_0x5bf2af){return function(_0x4f0f3b){if(_0x4f0f3b){return _0x4f0f3b[_0xd1c3('0x32')]()['then'](function(){_0x4c7c4f[_0xd1c3('0x29')](0xcc)[_0xd1c3('0x33')]();});}};}function handleEntityNotFound(_0x194498,_0x436acc){return function(_0x4805f1){if(!_0x4805f1){_0x194498['sendStatus'](0x194);}return _0x4805f1;};}function handleError(_0x3c7c4f,_0x4bc732){_0x4bc732=_0x4bc732||0x1f4;return function(_0x2d73be){logger['error'](_0x2d73be['stack']);if(_0x2d73be[_0xd1c3('0x34')]){delete _0x2d73be[_0xd1c3('0x34')];}_0x3c7c4f[_0xd1c3('0x29')](_0x4bc732)[_0xd1c3('0x35')](_0x2d73be);};}exports['index']=function(_0x9c022d,_0xac00c){var _0x44c8b2={},_0x3fb240={},_0x1d5f00={'count':0x0,'rows':[]};var _0x47ad63=_[_0xd1c3('0x36')](db[_0xd1c3('0x37')][_0xd1c3('0x38')],function(_0x124d90){return{'name':_0x124d90[_0xd1c3('0x39')],'type':_0x124d90[_0xd1c3('0x3a')][_0xd1c3('0x3b')]};});_0x3fb240['model']=_[_0xd1c3('0x36')](_0x47ad63,_0xd1c3('0x34'));_0x3fb240[_0xd1c3('0x3c')]=_[_0xd1c3('0x3d')](_0x9c022d[_0xd1c3('0x3c')]);_0x3fb240[_0xd1c3('0x3e')]=_[_0xd1c3('0x3f')](_0x3fb240[_0xd1c3('0x40')],_0x3fb240['query']);_0x44c8b2[_0xd1c3('0x41')]=_[_0xd1c3('0x3f')](_0x3fb240[_0xd1c3('0x40')],qs[_0xd1c3('0x42')](_0x9c022d[_0xd1c3('0x3c')]['fields']));_0x44c8b2[_0xd1c3('0x41')]=_0x44c8b2[_0xd1c3('0x41')][_0xd1c3('0x43')]?_0x44c8b2[_0xd1c3('0x41')]:_0x3fb240[_0xd1c3('0x40')];if(!_0x9c022d[_0xd1c3('0x3c')][_0xd1c3('0x44')]('nolimit')){_0x44c8b2['limit']=qs[_0xd1c3('0x2c')](_0x9c022d[_0xd1c3('0x3c')][_0xd1c3('0x2c')]);_0x44c8b2[_0xd1c3('0x45')]=qs['offset'](_0x9c022d['query'][_0xd1c3('0x45')]);}_0x44c8b2[_0xd1c3('0x46')]=qs['sort'](_0x9c022d[_0xd1c3('0x3c')][_0xd1c3('0x47')]);_0x44c8b2['where']=qs[_0xd1c3('0x3e')](_[_0xd1c3('0x48')](_0x9c022d[_0xd1c3('0x3c')],_0x3fb240['filters']),_0x47ad63);if(_0x9c022d[_0xd1c3('0x3c')][_0xd1c3('0x49')]){_0x44c8b2['where']=_[_0xd1c3('0x4a')](_0x44c8b2[_0xd1c3('0x4b')],{'$or':_[_0xd1c3('0x36')](_0x47ad63,function(_0x32d758){if(_0x32d758[_0xd1c3('0x3a')]!=='VIRTUAL'){var _0x1168fa={};_0x1168fa[_0x32d758[_0xd1c3('0x34')]]={'$like':'%'+_0x9c022d['query'][_0xd1c3('0x49')]+'%'};return _0x1168fa;}})});}_0x44c8b2=_[_0xd1c3('0x4a')]({},_0x44c8b2,_0x9c022d['options']);var _0x34425d={'where':_0x44c8b2['where']};return db[_0xd1c3('0x37')]['count'](_0x34425d)[_0xd1c3('0x1e')](function(_0x278861){_0x1d5f00[_0xd1c3('0x2b')]=_0x278861;if(_0x9c022d[_0xd1c3('0x3c')][_0xd1c3('0x4c')]){_0x44c8b2[_0xd1c3('0x4d')]=[{'all':!![]}];}return db[_0xd1c3('0x37')][_0xd1c3('0x4e')](_0x44c8b2);})[_0xd1c3('0x1e')](function(_0x161344){_0x1d5f00[_0xd1c3('0x4f')]=_0x161344;return _0x1d5f00;})[_0xd1c3('0x1e')](respondWithFilteredResult(_0xac00c,_0x44c8b2))['catch'](handleError(_0xac00c,null));};exports[_0xd1c3('0x50')]=function(_0x322d23,_0x28ca20){var _0x221cd2={'raw':![],'where':{'id':_0x322d23[_0xd1c3('0x51')]['id']}},_0x13ccd6={};_0x13ccd6[_0xd1c3('0x40')]=_[_0xd1c3('0x3d')](db[_0xd1c3('0x37')][_0xd1c3('0x38')]);_0x13ccd6[_0xd1c3('0x3c')]=_[_0xd1c3('0x3d')](_0x322d23[_0xd1c3('0x3c')]);_0x13ccd6[_0xd1c3('0x3e')]=_[_0xd1c3('0x3f')](_0x13ccd6[_0xd1c3('0x40')],_0x13ccd6[_0xd1c3('0x3c')]);_0x221cd2['attributes']=_[_0xd1c3('0x3f')](_0x13ccd6[_0xd1c3('0x40')],qs['fields'](_0x322d23['query'][_0xd1c3('0x42')]));_0x221cd2[_0xd1c3('0x41')]=_0x221cd2[_0xd1c3('0x41')][_0xd1c3('0x43')]?_0x221cd2['attributes']:_0x13ccd6[_0xd1c3('0x40')];if(_0x322d23[_0xd1c3('0x3c')]['includeAll']){_0x221cd2[_0xd1c3('0x4d')]=[{'all':!![]}];}_0x221cd2=_[_0xd1c3('0x4a')]({},_0x221cd2,_0x322d23[_0xd1c3('0x52')]);return db[_0xd1c3('0x37')][_0xd1c3('0x53')](_0x221cd2)[_0xd1c3('0x1e')](handleEntityNotFound(_0x28ca20,null))['then'](respondWithResult(_0x28ca20,null))[_0xd1c3('0x28')](handleError(_0x28ca20,null));};exports['create']=function(_0x4e6d74,_0x5a0e27){return db[_0xd1c3('0x37')][_0xd1c3('0x54')](_0x4e6d74[_0xd1c3('0x55')],{})[_0xd1c3('0x1e')](respondWithResult(_0x5a0e27,0xc9))[_0xd1c3('0x28')](handleError(_0x5a0e27,null));};exports[_0xd1c3('0x31')]=function(_0x5cae64,_0x130447){if(_0x5cae64[_0xd1c3('0x55')]['id']){delete _0x5cae64[_0xd1c3('0x55')]['id'];}return db[_0xd1c3('0x37')][_0xd1c3('0x53')]({'where':{'id':_0x5cae64[_0xd1c3('0x51')]['id']}})['then'](handleEntityNotFound(_0x130447,null))[_0xd1c3('0x1e')](saveUpdates(_0x5cae64[_0xd1c3('0x55')],null))[_0xd1c3('0x1e')](respondWithResult(_0x130447,null))['catch'](handleError(_0x130447,null));};exports[_0xd1c3('0x32')]=function(_0x129bb8,_0x18ea01){return db[_0xd1c3('0x37')]['find']({'where':{'id':_0x129bb8[_0xd1c3('0x51')]['id']}})[_0xd1c3('0x1e')](handleEntityNotFound(_0x18ea01,null))[_0xd1c3('0x1e')](removeEntity(_0x18ea01,null))[_0xd1c3('0x28')](handleError(_0x18ea01,null));};exports[_0xd1c3('0x56')]=function(_0x4754bf,_0x2f0b87,_0x24c560){var _0x50494b={};var _0x101141={};var _0x405366;var _0x2a1734;return db['ZohoAccount'][_0xd1c3('0x57')]({'where':{'id':_0x4754bf[_0xd1c3('0x51')]['id']}})['then'](handleEntityNotFound(_0x2f0b87,null))[_0xd1c3('0x1e')](function(_0x36af67){if(_0x36af67){_0x405366=_0x36af67;_0x101141[_0xd1c3('0x40')]=_[_0xd1c3('0x3d')](db[_0xd1c3('0x58')][_0xd1c3('0x38')]);_0x101141[_0xd1c3('0x3c')]=_['keys'](_0x4754bf[_0xd1c3('0x3c')]);_0x101141[_0xd1c3('0x3e')]=_[_0xd1c3('0x3f')](_0x101141[_0xd1c3('0x40')],_0x101141[_0xd1c3('0x3c')]);_0x50494b[_0xd1c3('0x41')]=_[_0xd1c3('0x3f')](_0x101141['model'],qs[_0xd1c3('0x42')](_0x4754bf['query'][_0xd1c3('0x42')]));_0x50494b[_0xd1c3('0x41')]=_0x50494b[_0xd1c3('0x41')]['length']?_0x50494b[_0xd1c3('0x41')]:_0x101141[_0xd1c3('0x40')];_0x50494b[_0xd1c3('0x46')]=qs[_0xd1c3('0x47')](_0x4754bf[_0xd1c3('0x3c')]['sort']);_0x50494b[_0xd1c3('0x4b')]=qs[_0xd1c3('0x3e')](_[_0xd1c3('0x48')](_0x4754bf['query'],_0x101141[_0xd1c3('0x3e')]));if(_0x4754bf['query']['filter']){_0x50494b['where']=_[_0xd1c3('0x4a')](_0x50494b[_0xd1c3('0x4b')],{'$or':_[_0xd1c3('0x36')](_0x50494b['attributes'],function(_0x5c768c){var _0x550f69={};_0x550f69[_0x5c768c]={'$like':'%'+_0x4754bf[_0xd1c3('0x3c')][_0xd1c3('0x49')]+'%'};return _0x550f69;})});}_0x50494b=_[_0xd1c3('0x4a')]({},_0x50494b,_0x4754bf[_0xd1c3('0x52')]);return _0x405366[_0xd1c3('0x56')](_0x50494b);}})[_0xd1c3('0x1e')](function(_0x9ec9f8){if(_0x9ec9f8){_0x2a1734=_0x9ec9f8[_0xd1c3('0x43')];if(!_0x4754bf[_0xd1c3('0x3c')][_0xd1c3('0x44')](_0xd1c3('0x59'))){_0x50494b[_0xd1c3('0x2c')]=qs[_0xd1c3('0x2c')](_0x4754bf[_0xd1c3('0x3c')]['limit']);_0x50494b[_0xd1c3('0x45')]=qs[_0xd1c3('0x45')](_0x4754bf[_0xd1c3('0x3c')][_0xd1c3('0x45')]);}return _0x405366['getConfigurations'](_0x50494b);}})[_0xd1c3('0x1e')](function(_0x49339b){if(_0x49339b){return _0x49339b?{'count':_0x2a1734,'rows':_0x49339b}:null;}})[_0xd1c3('0x1e')](respondWithResult(_0x2f0b87,null))[_0xd1c3('0x28')](handleError(_0x2f0b87,null));};exports[_0xd1c3('0x5a')]=function(_0x157726,_0x2f5c4f,_0x4f47cf){if(_0x157726[_0xd1c3('0x55')]['id']){delete _0x157726[_0xd1c3('0x55')]['id'];}return db['ZohoAccount'][_0xd1c3('0x57')]({'where':{'id':_0x157726[_0xd1c3('0x51')]['id']}})[_0xd1c3('0x1e')](handleEntityNotFound(_0x2f5c4f,null))['then'](function(_0x51bfa8){if(_0x51bfa8){_0x157726[_0xd1c3('0x55')][_0xd1c3('0x5b')]=_0x51bfa8['id'];_0x157726[_0xd1c3('0x55')][_0xd1c3('0x5c')]=integrations[_0xd1c3('0x5d')](_0x157726['body'][_0xd1c3('0x5e')],_0x157726['body']['type']);_0x157726[_0xd1c3('0x55')][_0xd1c3('0x5f')]=integrations[_0xd1c3('0x60')](_0x157726[_0xd1c3('0x55')][_0xd1c3('0x5e')],_0x157726[_0xd1c3('0x55')][_0xd1c3('0x3a')]);return db[_0xd1c3('0x58')][_0xd1c3('0x54')](_0x157726[_0xd1c3('0x55')],{'include':[{'model':db['ZohoField'],'as':_0xd1c3('0x5c')},{'model':db[_0xd1c3('0x61')],'as':_0xd1c3('0x5f')}]});}return null;})[_0xd1c3('0x1e')](respondWithResult(_0x2f5c4f,null))[_0xd1c3('0x28')](handleError(_0x2f5c4f,null));};function getAccessToken(_0x19eceb){return new Promise(function(_0x58cde8,_0x4078c6){var _0x47c5e7;switch(_0x19eceb[_0xd1c3('0x62')]){case'US':_0x47c5e7='https://accounts.zoho.com';break;case'AU':_0x47c5e7='https://accounts.zoho.com.au';break;case'EU':_0x47c5e7='https://accounts.zoho.eu';break;case'IN':_0x47c5e7='https://accounts.zoho.in';break;case'CN':_0x47c5e7=_0xd1c3('0x63');break;default:_0x47c5e7=_0xd1c3('0x64');break;}var _0x49ae15={'method':_0xd1c3('0x65'),'uri':_0x47c5e7+'/oauth/v2/token','qs':{'refresh_token':_0x19eceb[_0xd1c3('0x66')],'client_id':_0x19eceb[_0xd1c3('0x67')],'client_secret':_0x19eceb[_0xd1c3('0x68')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x49ae15)[_0xd1c3('0x1e')](function(_0x108c59){if(_0x108c59[_0xd1c3('0x69')]){_0x58cde8(_0x108c59[_0xd1c3('0x69')]);}else{_0x4078c6(_0xd1c3('0x6a'));}})[_0xd1c3('0x28')](function(_0x592546){_0x4078c6(_0x592546);});});}exports[_0xd1c3('0x6b')]=function(_0x21635c,_0x5134e5,_0x35d514){var _0x3e199c,_0x36aab7,_0x335f43,_0x1c4dcb,_0x51d1ae;return db['ZohoAccount'][_0xd1c3('0x57')]({'where':{'id':_0x21635c[_0xd1c3('0x51')]['id']},'attributes':['id',_0xd1c3('0x6c'),'zone',_0xd1c3('0x67'),_0xd1c3('0x68'),_0xd1c3('0x6d'),_0xd1c3('0x25'),_0xd1c3('0x66')]})[_0xd1c3('0x1e')](handleEntityNotFound(_0x5134e5,null))[_0xd1c3('0x1e')](function(_0x1c0a88){_0x51d1ae=_0x1c0a88;_0x3e199c=_0x51d1ae[_0xd1c3('0x6c')];_0x36aab7=_0x3e199c==='zoho.eu'?'eu':_0xd1c3('0x6e');_0x335f43=_0x51d1ae[_0xd1c3('0x6d')];var _0x66d98=_0x335f43[_0xd1c3('0x6f')](-0x1);if(_0x66d98==='/'||_0x66d98==='\x5c'||_0x66d98===':'){_0x335f43=_0x335f43[_0xd1c3('0x70')](0x0,_0x335f43['lastIndexOf'](_0x66d98));}if(!_0x51d1ae['refreshToken']){throw new Error(_0xd1c3('0x71'));}return getAccessToken(_0x51d1ae);})[_0xd1c3('0x1e')](function(_0x42e897){if(_0x42e897){return rp({'method':_0xd1c3('0x72'),'uri':util['format'](_0xd1c3('0x73'),_0x36aab7),'qs':{'module':_0xd1c3('0x74')},'headers':{'Authorization':_0xd1c3('0x75')+_0x42e897},'json':!![]});}})[_0xd1c3('0x1e')](function(_0x34c1a1){if(_0x34c1a1){if(_0x34c1a1[_0xd1c3('0x76')]&&_0x34c1a1[_0xd1c3('0x76')][_0xd1c3('0x24')]){throw new Error(_0x34c1a1['response'][_0xd1c3('0x24')][_0xd1c3('0x26')]);}var _0x51ad40=[];var _0x57a59e=[];var _0xfce22f=[_0xd1c3('0x77'),_0xd1c3('0x78'),_0xd1c3('0x79'),_0xd1c3('0x7a'),'Call_Duration',_0xd1c3('0x7b'),_0xd1c3('0x7c'),'Call_Type'];_0x57a59e=_['remove'](_0x34c1a1[_0xd1c3('0x42')],function(_0x281430){return _0xfce22f['includes'](_0x281430[_0xd1c3('0x7d')]);});for(var _0x8e51d1=0x0;_0x8e51d1<_0x57a59e[_0xd1c3('0x43')];_0x8e51d1++){if(_0x57a59e[_0x8e51d1]['system_mandatory']===![]){_0x51ad40[_0xd1c3('0x7e')]({'id':_0x57a59e[_0x8e51d1]['id'],'name':_0x57a59e[_0x8e51d1][_0xd1c3('0x7f')],'custom':_0x57a59e[_0x8e51d1]['custom_field'],'options':_0x57a59e[_0x8e51d1][_0xd1c3('0x80')]===_0xd1c3('0x81')&&_0x57a59e[_0x8e51d1][_0xd1c3('0x82')][_0xd1c3('0x43')]>-0x1?_[_0xd1c3('0x36')](_0x57a59e[_0x8e51d1][_0xd1c3('0x82')],function(_0x540f4f){return{'name':_0x540f4f,'value':_0x540f4f};}):[]});}}return{'count':_0x51ad40[_0xd1c3('0x43')],'rows':_0x51ad40};}else{return{'count':0x0,'rows':[]};}})[_0xd1c3('0x1e')](respondWithResult(_0x5134e5,null))[_0xd1c3('0x28')](function(_0x3a855f){var _0x44bccb=_0x21635c[_0xd1c3('0x3c')][_0xd1c3('0x1b')]?0x1f4:_0x3a855f[_0xd1c3('0x83')]||0x1f4;logger[_0xd1c3('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xd1c3('0x6b'),_0x44bccb,JSON[_0xd1c3('0x23')](_0x3a855f));delete _0x3a855f[_0xd1c3('0x34')];if(_0x44bccb===0x191){_0x44bccb=0x190;}_0x5134e5['status'](_0x44bccb)[_0xd1c3('0x35')](_0x21635c[_0xd1c3('0x3c')][_0xd1c3('0x1b')]?{'message':_0xd1c3('0x84'),'statusCode':_0x3a855f['statusCode']}:_0x3a855f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 9ebd431..eceaf38 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 _0xab40=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','then','parse','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x56a4bc,_0x504316){var _0x9e24e8=function(_0x541d35){while(--_0x541d35){_0x56a4bc['push'](_0x56a4bc['shift']());}};_0x9e24e8(++_0x504316);}(_0xab40,0x198));var _0x0ab4=function(_0x21e85e,_0x578c40){_0x21e85e=_0x21e85e-0x0;var _0x109088=_0xab40[_0x21e85e];return _0x109088;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0ab4('0x0'))('api');var moment=require(_0x0ab4('0x1'));var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ab4('0x4'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x0ab4('0x5'));module[_0x0ab4('0x6')]=function(_0x59a234,_0x412079){return _0x59a234['define']('ZohoAccount',attributes,{'tableName':_0x0ab4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45557a,_0x44bb47,_0x2fd2af){if(_0x45557a[_0x0ab4('0x8')](_0x0ab4('0x9'))||_0x45557a[_0x0ab4('0x8')](_0x0ab4('0xa'))||_0x45557a['changed'](_0x0ab4('0xb'))||_0x45557a['changed'](_0x0ab4('0xc'))||_0x45557a[_0x0ab4('0x8')](_0x0ab4('0xd'))||_0x45557a['changed'](_0x0ab4('0xe'))){var _0x264315,_0x3bd8bf;_0x264315=_0x45557a['serverUrl'];var _0x4d8b79=_0x264315[_0x0ab4('0xf')](-0x1);if(_0x4d8b79==='/'||_0x4d8b79==='\x5c'||_0x4d8b79===':'){_0x264315=_0x264315[_0x0ab4('0x10')](0x0,_0x264315[_0x0ab4('0x11')](_0x4d8b79));}switch(_0x45557a[_0x0ab4('0x9')]){case'US':_0x3bd8bf=_0x0ab4('0x12');break;case'AU':_0x3bd8bf=_0x0ab4('0x13');break;case'IN':_0x3bd8bf=_0x0ab4('0x14');break;case'CN':_0x3bd8bf=_0x0ab4('0x15');break;default:_0x3bd8bf=_0x0ab4('0x16');break;}var _0x462570={'method':_0x0ab4('0x17'),'uri':_0x3bd8bf+_0x0ab4('0x18'),'form':{'grant_type':_0x0ab4('0x19'),'client_id':_0x45557a['clientId'],'client_secret':_0x45557a[_0x0ab4('0xc')],'redirect_uri':_0x45557a[_0x0ab4('0xa')],'code':_0x45557a[_0x0ab4('0xd')]},'headers':{'Content-Type':_0x0ab4('0x1a')}};return rp(_0x462570)['then'](function(_0x4a90a5){var _0x120833=JSON['parse'](_0x4a90a5);if(_0x120833['refresh_token']){_0x45557a[_0x0ab4('0x1b')]=_0x120833[_0x0ab4('0x1c')];logger[_0x0ab4('0x1d')](util[_0x0ab4('0x1e')](_0x0ab4('0x1f'),_0x45557a[_0x0ab4('0x20')],_0x45557a['id']));}else{logger[_0x0ab4('0x21')](util[_0x0ab4('0x1e')](_0x0ab4('0x22'),_0x45557a[_0x0ab4('0x20')],_0x45557a['id']),util['inspect'](_0x120833,{'showHidden':![],'depth':null}));}return _0x2fd2af(null,_0x44bb47);})[_0x0ab4('0x23')](function(_0x2c0516){logger[_0x0ab4('0x21')](util[_0x0ab4('0x1e')](_0x0ab4('0x22'),_0x45557a[_0x0ab4('0x20')],_0x45557a['id']),util[_0x0ab4('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2fd2af(_0x2c0516);});}else{return _0x2fd2af(null,_0x44bb47);}},'beforeUpdate':function(_0x236132,_0x5d14db,_0x3e0e62){if(_0x236132[_0x0ab4('0x8')](_0x0ab4('0x9'))||_0x236132['changed'](_0x0ab4('0xa'))||_0x236132[_0x0ab4('0x8')]('clientId')||_0x236132['changed'](_0x0ab4('0xc'))||_0x236132[_0x0ab4('0x8')](_0x0ab4('0xd'))||_0x236132[_0x0ab4('0x8')](_0x0ab4('0xe'))){var _0x24f93c,_0x2c4403;_0x24f93c=_0x236132['serverUrl'];var _0x4b6bec=_0x24f93c[_0x0ab4('0xf')](-0x1);if(_0x4b6bec==='/'||_0x4b6bec==='\x5c'||_0x4b6bec===':'){_0x24f93c=_0x24f93c[_0x0ab4('0x10')](0x0,_0x24f93c[_0x0ab4('0x11')](_0x4b6bec));}switch(_0x236132[_0x0ab4('0x9')]){case'US':_0x2c4403=_0x0ab4('0x12');break;case'AU':_0x2c4403=_0x0ab4('0x13');break;case'IN':_0x2c4403='https://accounts.zoho.in';break;case'CN':_0x2c4403='https://accounts.zoho.com.cn';break;default:_0x2c4403=_0x0ab4('0x16');break;}var _0x35094e={'method':_0x0ab4('0x17'),'uri':_0x2c4403+_0x0ab4('0x18'),'form':{'grant_type':_0x0ab4('0x19'),'client_id':_0x236132[_0x0ab4('0xb')],'client_secret':_0x236132[_0x0ab4('0xc')],'redirect_uri':_0x236132[_0x0ab4('0xa')],'code':_0x236132[_0x0ab4('0xd')]},'headers':{'Content-Type':_0x0ab4('0x1a')}};return rp(_0x35094e)[_0x0ab4('0x25')](function(_0x467fcf){var _0x1e1ca3=JSON[_0x0ab4('0x26')](_0x467fcf);if(_0x1e1ca3[_0x0ab4('0x1c')]){_0x236132[_0x0ab4('0x1b')]=_0x1e1ca3[_0x0ab4('0x1c')];logger[_0x0ab4('0x1d')](util[_0x0ab4('0x1e')](_0x0ab4('0x1f'),_0x236132[_0x0ab4('0x20')],_0x236132['id']));}else{logger['error'](util[_0x0ab4('0x1e')](_0x0ab4('0x22'),_0x236132['name'],_0x236132['id']),util[_0x0ab4('0x24')](_0x1e1ca3,{'showHidden':![],'depth':null}));}return _0x3e0e62(null,_0x5d14db);})[_0x0ab4('0x23')](function(_0x2c63fb){logger['error'](util['format'](_0x0ab4('0x22'),_0x236132[_0x0ab4('0x20')],_0x236132['id']),util[_0x0ab4('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x3e0e62(_0x2c63fb);});}else{return _0x3e0e62(null,_0x5d14db);}}}});}; \ No newline at end of file +var _0x6780=['POST','parse','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','substring','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu'];(function(_0x3ad875,_0x536c0b){var _0x10f930=function(_0x4b4c21){while(--_0x4b4c21){_0x3ad875['push'](_0x3ad875['shift']());}};_0x10f930(++_0x536c0b);}(_0x6780,0x11b));var _0x0678=function(_0x12abb9,_0xb6ca60){_0x12abb9=_0x12abb9-0x0;var _0x47b7d5=_0x6780[_0x12abb9];return _0x47b7d5;};'use strict';var _=require(_0x0678('0x0'));var util=require('util');var logger=require(_0x0678('0x1'))('api');var moment=require(_0x0678('0x2'));var BPromise=require(_0x0678('0x3'));var rp=require(_0x0678('0x4'));var fs=require('fs');var path=require(_0x0678('0x5'));var rimraf=require(_0x0678('0x6'));var config=require('../../config/environment');var attributes=require(_0x0678('0x7'));var integrations=require(_0x0678('0x8'));module[_0x0678('0x9')]=function(_0x442418,_0x4e00f0){return _0x442418[_0x0678('0xa')](_0x0678('0xb'),attributes,{'tableName':_0x0678('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7c77d2,_0x381480,_0x559a6b){if(_0x7c77d2[_0x0678('0xd')](_0x0678('0xe'))||_0x7c77d2[_0x0678('0xd')]('serverUrl')||_0x7c77d2['changed'](_0x0678('0xf'))||_0x7c77d2[_0x0678('0xd')](_0x0678('0x10'))||_0x7c77d2['changed'](_0x0678('0x11'))||_0x7c77d2[_0x0678('0xd')](_0x0678('0x12'))){var _0x47ac71,_0x52a940;_0x47ac71=_0x7c77d2[_0x0678('0x13')];var _0xbd13a6=_0x47ac71['slice'](-0x1);if(_0xbd13a6==='/'||_0xbd13a6==='\x5c'||_0xbd13a6===':'){_0x47ac71=_0x47ac71[_0x0678('0x14')](0x0,_0x47ac71[_0x0678('0x15')](_0xbd13a6));}switch(_0x7c77d2[_0x0678('0xe')]){case'US':_0x52a940='https://accounts.zoho.com';break;case'AU':_0x52a940='https://accounts.zoho.com.au';break;case'IN':_0x52a940=_0x0678('0x16');break;case'CN':_0x52a940=_0x0678('0x17');break;default:_0x52a940=_0x0678('0x18');break;}var _0x14dcd6={'method':_0x0678('0x19'),'uri':_0x52a940+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x7c77d2[_0x0678('0xf')],'client_secret':_0x7c77d2[_0x0678('0x10')],'redirect_uri':_0x7c77d2['serverUrl'],'code':_0x7c77d2[_0x0678('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x14dcd6)['then'](function(_0x35ae95){var _0x1f4ead=JSON[_0x0678('0x1a')](_0x35ae95);if(_0x1f4ead[_0x0678('0x1b')]){_0x7c77d2[_0x0678('0x1c')]=_0x1f4ead[_0x0678('0x1b')];logger[_0x0678('0x1d')](util[_0x0678('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x7c77d2[_0x0678('0x1f')],_0x7c77d2['id']));}else{logger[_0x0678('0x20')](util[_0x0678('0x1e')](_0x0678('0x21'),_0x7c77d2[_0x0678('0x1f')],_0x7c77d2['id']),util['inspect'](_0x1f4ead,{'showHidden':![],'depth':null}));}return _0x559a6b(null,_0x381480);})[_0x0678('0x22')](function(_0x3f1505){logger['error'](util['format'](_0x0678('0x21'),_0x7c77d2[_0x0678('0x1f')],_0x7c77d2['id']),util[_0x0678('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x559a6b(_0x3f1505);});}else{return _0x559a6b(null,_0x381480);}},'beforeUpdate':function(_0x53730f,_0x22892a,_0x2843f6){if(_0x53730f[_0x0678('0xd')](_0x0678('0xe'))||_0x53730f['changed']('serverUrl')||_0x53730f['changed'](_0x0678('0xf'))||_0x53730f['changed'](_0x0678('0x10'))||_0x53730f[_0x0678('0xd')](_0x0678('0x11'))||_0x53730f['changed'](_0x0678('0x12'))){var _0x52c2a1,_0x52a5f7;_0x52c2a1=_0x53730f[_0x0678('0x13')];var _0x341e99=_0x52c2a1[_0x0678('0x24')](-0x1);if(_0x341e99==='/'||_0x341e99==='\x5c'||_0x341e99===':'){_0x52c2a1=_0x52c2a1[_0x0678('0x14')](0x0,_0x52c2a1['lastIndexOf'](_0x341e99));}switch(_0x53730f['zone']){case'US':_0x52a5f7=_0x0678('0x25');break;case'AU':_0x52a5f7=_0x0678('0x26');break;case'IN':_0x52a5f7=_0x0678('0x16');break;case'CN':_0x52a5f7=_0x0678('0x17');break;default:_0x52a5f7='https://accounts.zoho.eu';break;}var _0x3d209e={'method':_0x0678('0x19'),'uri':_0x52a5f7+_0x0678('0x27'),'form':{'grant_type':_0x0678('0x28'),'client_id':_0x53730f[_0x0678('0xf')],'client_secret':_0x53730f['clientSecret'],'redirect_uri':_0x53730f[_0x0678('0x13')],'code':_0x53730f[_0x0678('0x11')]},'headers':{'Content-Type':_0x0678('0x29')}};return rp(_0x3d209e)[_0x0678('0x2a')](function(_0x6a5eb7){var _0x39037b=JSON[_0x0678('0x1a')](_0x6a5eb7);if(_0x39037b[_0x0678('0x1b')]){_0x53730f[_0x0678('0x1c')]=_0x39037b[_0x0678('0x1b')];logger[_0x0678('0x1d')](util[_0x0678('0x1e')](_0x0678('0x2b'),_0x53730f['name'],_0x53730f['id']));}else{logger[_0x0678('0x20')](util[_0x0678('0x1e')](_0x0678('0x21'),_0x53730f[_0x0678('0x1f')],_0x53730f['id']),util[_0x0678('0x23')](_0x39037b,{'showHidden':![],'depth':null}));}return _0x2843f6(null,_0x22892a);})['catch'](function(_0x5e8bd7){logger[_0x0678('0x20')](util[_0x0678('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x53730f['name'],_0x53730f['id']),util[_0x0678('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x2843f6(_0x5e8bd7);});}else{return _0x2843f6(null,_0x22892a);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 76ac7be..7032028 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 _0x4d51=['options','raw','attributes','limit','include','map','model','debug','stringify','find','ShowZohoAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4d51,0x87));var _0x14d5=function(_0x1c42b1,_0x4f05da){_0x1c42b1=_0x1c42b1-0x0;var _0x591c1e=_0x4d51[_0x1c42b1];return _0x591c1e;};'use strict';var _=require(_0x14d5('0x0'));var util=require(_0x14d5('0x1'));var moment=require(_0x14d5('0x2'));var BPromise=require(_0x14d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14d5('0x4'))['db'];var utils=require(_0x14d5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x14d5('0x6'));var jayson=require(_0x14d5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2892b0,_0x19274d,_0x27c99f){return new BPromise(function(_0x39d4aa,_0x1339a2){return client[_0x14d5('0x8')](_0x2892b0,_0x27c99f)[_0x14d5('0x9')](function(_0x4094d1){logger[_0x14d5('0xa')](_0x14d5('0xb'),_0x19274d,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x19274d,_0x14d5('0xc'),JSON['stringify'](_0x4094d1));if(_0x4094d1[_0x14d5('0xd')]){if(_0x4094d1[_0x14d5('0xd')]['code']===0x1f4){logger[_0x14d5('0xd')](_0x14d5('0xb'),_0x19274d,_0x4094d1[_0x14d5('0xd')][_0x14d5('0xe')]);return _0x1339a2(_0x4094d1['error'][_0x14d5('0xe')]);}logger[_0x14d5('0xd')](_0x14d5('0xb'),_0x19274d,_0x4094d1[_0x14d5('0xd')][_0x14d5('0xe')]);return _0x39d4aa(_0x4094d1[_0x14d5('0xd')]['message']);}else{logger[_0x14d5('0xa')](_0x14d5('0xb'),_0x19274d,'request\x20sent');_0x39d4aa(_0x4094d1[_0x14d5('0xf')]['message']);}})[_0x14d5('0x10')](function(_0x4be796){logger[_0x14d5('0xd')](_0x14d5('0xb'),_0x19274d,_0x4be796);_0x1339a2(_0x4be796);});});}exports[_0x14d5('0x11')]=function(_0x34fa51){var _0x31d5ca=this;return new Promise(function(_0x1dd3c3,_0x7eb982){return db[_0x14d5('0x12')][_0x14d5('0x13')]({'raw':_0x34fa51[_0x14d5('0x14')]?_0x34fa51['options'][_0x14d5('0x15')]===undefined?!![]:![]:!![],'where':_0x34fa51[_0x14d5('0x14')]?_0x34fa51[_0x14d5('0x14')]['where']||null:null,'attributes':_0x34fa51[_0x14d5('0x14')]?_0x34fa51[_0x14d5('0x14')][_0x14d5('0x16')]||null:null,'limit':_0x34fa51['options']?_0x34fa51[_0x14d5('0x14')][_0x14d5('0x17')]||null:null,'include':_0x34fa51[_0x14d5('0x14')]?_0x34fa51['options'][_0x14d5('0x18')]?_[_0x14d5('0x19')](_0x34fa51[_0x14d5('0x14')][_0x14d5('0x18')],function(_0x37d270){return{'model':db[_0x37d270[_0x14d5('0x1a')]],'as':_0x37d270['as'],'attributes':_0x37d270[_0x14d5('0x16')],'include':_0x37d270[_0x14d5('0x18')]?_[_0x14d5('0x19')](_0x37d270[_0x14d5('0x18')],function(_0x1a6d60){return{'model':db[_0x1a6d60['model']],'as':_0x1a6d60['as'],'attributes':_0x1a6d60[_0x14d5('0x16')],'include':_0x1a6d60[_0x14d5('0x18')]?_[_0x14d5('0x19')](_0x1a6d60[_0x14d5('0x18')],function(_0x4430fb){return{'model':db[_0x4430fb[_0x14d5('0x1a')]],'as':_0x4430fb['as'],'attributes':_0x4430fb[_0x14d5('0x16')]};}):[]};}):[]};}):[]:[]})[_0x14d5('0x9')](function(_0x1bdb9b){logger[_0x14d5('0xa')](_0x14d5('0x11'),_0x34fa51);logger[_0x14d5('0x1b')](_0x14d5('0x11'),_0x34fa51,JSON[_0x14d5('0x1c')](_0x1bdb9b));_0x1dd3c3(_0x1bdb9b);})[_0x14d5('0x10')](function(_0x1f7349){logger[_0x14d5('0xd')](_0x14d5('0x11'),_0x1f7349['message'],_0x34fa51);_0x7eb982(_0x31d5ca['error'](0x1f4,_0x1f7349[_0x14d5('0xe')]));});});};exports['ShowZohoAccount']=function(_0x6608cf){var _0x1660c5=this;return new Promise(function(_0x8e485e,_0x4ad3fd){return db[_0x14d5('0x12')][_0x14d5('0x1d')]({'raw':_0x6608cf[_0x14d5('0x14')]?_0x6608cf[_0x14d5('0x14')][_0x14d5('0x15')]===undefined?!![]:![]:!![],'where':_0x6608cf[_0x14d5('0x14')]?_0x6608cf[_0x14d5('0x14')]['where']||null:null,'attributes':_0x6608cf[_0x14d5('0x14')]?_0x6608cf['options'][_0x14d5('0x16')]||null:null,'include':_0x6608cf[_0x14d5('0x14')]?_0x6608cf[_0x14d5('0x14')][_0x14d5('0x18')]?_[_0x14d5('0x19')](_0x6608cf[_0x14d5('0x14')][_0x14d5('0x18')],function(_0xc01011){return{'model':db[_0xc01011[_0x14d5('0x1a')]],'as':_0xc01011['as'],'attributes':_0xc01011['attributes'],'include':_0xc01011[_0x14d5('0x18')]?_['map'](_0xc01011[_0x14d5('0x18')],function(_0x213d18){return{'model':db[_0x213d18[_0x14d5('0x1a')]],'as':_0x213d18['as'],'attributes':_0x213d18['attributes'],'include':_0x213d18[_0x14d5('0x18')]?_['map'](_0x213d18[_0x14d5('0x18')],function(_0x24a2f2){return{'model':db[_0x24a2f2[_0x14d5('0x1a')]],'as':_0x24a2f2['as'],'attributes':_0x24a2f2[_0x14d5('0x16')]};}):[]};}):[]};}):[]:[]})[_0x14d5('0x9')](function(_0x4e98d2){logger['info']('ShowZohoAccount',_0x6608cf);logger['debug'](_0x14d5('0x1e'),_0x6608cf,JSON[_0x14d5('0x1c')](_0x4e98d2));_0x8e485e(_0x4e98d2);})[_0x14d5('0x10')](function(_0x20df97){logger[_0x14d5('0xd')]('ShowZohoAccount',_0x20df97[_0x14d5('0xe')],_0x6608cf);_0x4ad3fd(_0x1660c5[_0x14d5('0xd')](0x1f4,_0x20df97[_0x14d5('0xe')]));});});}; \ No newline at end of file +var _0x15c0=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','request\x20sent','catch','GetZohoAccount','ZohoAccount','findAll','options','attributes','include','model','map','ShowZohoAccount','find','raw','lodash','util'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x15c0,0x82));var _0x015c=function(_0x1d3c5e,_0x257cc3){_0x1d3c5e=_0x1d3c5e-0x0;var _0x2f9916=_0x15c0[_0x1d3c5e];return _0x2f9916;};'use strict';var _=require(_0x015c('0x0'));var util=require(_0x015c('0x1'));var moment=require(_0x015c('0x2'));var BPromise=require(_0x015c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x015c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x015c('0x5'));var logger=require(_0x015c('0x6'))(_0x015c('0x7'));var config=require(_0x015c('0x8'));var jayson=require(_0x015c('0x9'));var client=jayson[_0x015c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x448f8a,_0x21ecf1,_0x35b3a1){return new BPromise(function(_0x4de7c0,_0x5df422){return client[_0x015c('0xb')](_0x448f8a,_0x35b3a1)[_0x015c('0xc')](function(_0xa494ee){logger[_0x015c('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x21ecf1,'request\x20sent');logger[_0x015c('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x21ecf1,'request\x20sent',JSON[_0x015c('0xf')](_0xa494ee));if(_0xa494ee[_0x015c('0x10')]){if(_0xa494ee['error'][_0x015c('0x11')]===0x1f4){logger['error'](_0x015c('0x12'),_0x21ecf1,_0xa494ee[_0x015c('0x10')]['message']);return _0x5df422(_0xa494ee[_0x015c('0x10')]['message']);}logger[_0x015c('0x10')](_0x015c('0x12'),_0x21ecf1,_0xa494ee[_0x015c('0x10')][_0x015c('0x13')]);return _0x4de7c0(_0xa494ee[_0x015c('0x10')][_0x015c('0x13')]);}else{logger[_0x015c('0xd')](_0x015c('0x12'),_0x21ecf1,_0x015c('0x14'));_0x4de7c0(_0xa494ee['result'][_0x015c('0x13')]);}})[_0x015c('0x15')](function(_0x1fb8c5){logger[_0x015c('0x10')](_0x015c('0x12'),_0x21ecf1,_0x1fb8c5);_0x5df422(_0x1fb8c5);});});}exports[_0x015c('0x16')]=function(_0x479cb1){var _0x309918=this;return new Promise(function(_0x17ddab,_0x403289){return db[_0x015c('0x17')][_0x015c('0x18')]({'raw':_0x479cb1[_0x015c('0x19')]?_0x479cb1[_0x015c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x479cb1[_0x015c('0x19')]?_0x479cb1[_0x015c('0x19')]['where']||null:null,'attributes':_0x479cb1[_0x015c('0x19')]?_0x479cb1[_0x015c('0x19')][_0x015c('0x1a')]||null:null,'limit':_0x479cb1[_0x015c('0x19')]?_0x479cb1[_0x015c('0x19')]['limit']||null:null,'include':_0x479cb1[_0x015c('0x19')]?_0x479cb1['options']['include']?_['map'](_0x479cb1[_0x015c('0x19')][_0x015c('0x1b')],function(_0x36bd1d){return{'model':db[_0x36bd1d[_0x015c('0x1c')]],'as':_0x36bd1d['as'],'attributes':_0x36bd1d[_0x015c('0x1a')],'include':_0x36bd1d[_0x015c('0x1b')]?_['map'](_0x36bd1d['include'],function(_0x6435c4){return{'model':db[_0x6435c4[_0x015c('0x1c')]],'as':_0x6435c4['as'],'attributes':_0x6435c4[_0x015c('0x1a')],'include':_0x6435c4[_0x015c('0x1b')]?_[_0x015c('0x1d')](_0x6435c4[_0x015c('0x1b')],function(_0x31f4e7){return{'model':db[_0x31f4e7[_0x015c('0x1c')]],'as':_0x31f4e7['as'],'attributes':_0x31f4e7[_0x015c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x015c('0xc')](function(_0x169553){logger[_0x015c('0xd')](_0x015c('0x16'),_0x479cb1);logger[_0x015c('0xe')](_0x015c('0x16'),_0x479cb1,JSON[_0x015c('0xf')](_0x169553));_0x17ddab(_0x169553);})[_0x015c('0x15')](function(_0x1ac61a){logger[_0x015c('0x10')](_0x015c('0x16'),_0x1ac61a[_0x015c('0x13')],_0x479cb1);_0x403289(_0x309918[_0x015c('0x10')](0x1f4,_0x1ac61a[_0x015c('0x13')]));});});};exports[_0x015c('0x1e')]=function(_0x11faf5){var _0x472641=this;return new Promise(function(_0x325f85,_0x4d66aa){return db['ZohoAccount'][_0x015c('0x1f')]({'raw':_0x11faf5[_0x015c('0x19')]?_0x11faf5[_0x015c('0x19')][_0x015c('0x20')]===undefined?!![]:![]:!![],'where':_0x11faf5[_0x015c('0x19')]?_0x11faf5['options']['where']||null:null,'attributes':_0x11faf5['options']?_0x11faf5['options']['attributes']||null:null,'include':_0x11faf5[_0x015c('0x19')]?_0x11faf5[_0x015c('0x19')][_0x015c('0x1b')]?_[_0x015c('0x1d')](_0x11faf5['options'][_0x015c('0x1b')],function(_0x44ecb0){return{'model':db[_0x44ecb0['model']],'as':_0x44ecb0['as'],'attributes':_0x44ecb0[_0x015c('0x1a')],'include':_0x44ecb0[_0x015c('0x1b')]?_[_0x015c('0x1d')](_0x44ecb0[_0x015c('0x1b')],function(_0x265ab4){return{'model':db[_0x265ab4['model']],'as':_0x265ab4['as'],'attributes':_0x265ab4[_0x015c('0x1a')],'include':_0x265ab4[_0x015c('0x1b')]?_[_0x015c('0x1d')](_0x265ab4[_0x015c('0x1b')],function(_0x5aae55){return{'model':db[_0x5aae55[_0x015c('0x1c')]],'as':_0x5aae55['as'],'attributes':_0x5aae55['attributes']};}):[]};}):[]};}):[]:[]})[_0x015c('0xc')](function(_0x1506d2){logger[_0x015c('0xd')](_0x015c('0x1e'),_0x11faf5);logger['debug'](_0x015c('0x1e'),_0x11faf5,JSON[_0x015c('0xf')](_0x1506d2));_0x325f85(_0x1506d2);})[_0x015c('0x15')](function(_0x5cce3d){logger[_0x015c('0x10')]('ShowZohoAccount',_0x5cce3d['message'],_0x11faf5);_0x4d66aa(_0x472641[_0x015c('0x10')](0x1f4,_0x5cce3d['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d285311..7f10b4a 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 _0x5269=['get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1d3892,_0x47d5fe){var _0x574ff2=function(_0x5cc441){while(--_0x5cc441){_0x1d3892['push'](_0x1d3892['shift']());}};_0x574ff2(++_0x47d5fe);}(_0x5269,0x150));var _0x9526=function(_0x90bf81,_0x306f4b){_0x90bf81=_0x90bf81-0x0;var _0x495748=_0x5269[_0x90bf81];return _0x495748;};'use strict';var multer=require(_0x9526('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9526('0x1')]();var auth=require(_0x9526('0x2'));var interaction=require(_0x9526('0x3'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x9526('0x4')]('/',auth['isAuthenticated'](),controller[_0x9526('0x5')]);router[_0x9526('0x4')](_0x9526('0x6'),auth[_0x9526('0x7')](),controller[_0x9526('0x8')]);router[_0x9526('0x4')](_0x9526('0x9'),auth[_0x9526('0x7')](),controller[_0x9526('0xa')]);router[_0x9526('0x4')](_0x9526('0xb'),auth[_0x9526('0x7')](),controller['getSubjects']);router[_0x9526('0x4')](_0x9526('0xc'),auth['isAuthenticated'](),controller[_0x9526('0xd')]);router[_0x9526('0xe')]('/',auth[_0x9526('0x7')](),controller[_0x9526('0xf')]);router[_0x9526('0x10')](_0x9526('0x6'),auth[_0x9526('0x7')](),controller['update']);router[_0x9526('0x11')](_0x9526('0x6'),auth['isAuthenticated'](),controller[_0x9526('0x12')]);module[_0x9526('0x13')]=router; \ No newline at end of file +var _0xefe3=['get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xefe3,0xf5));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x3efe('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3efe('0x1'));var router=express[_0x3efe('0x2')]();var auth=require(_0x3efe('0x3'));var interaction=require(_0x3efe('0x4'));var config=require('../../config/environment');var controller=require(_0x3efe('0x5'));router['get']('/',auth[_0x3efe('0x6')](),controller['index']);router[_0x3efe('0x7')](_0x3efe('0x8'),auth[_0x3efe('0x6')](),controller[_0x3efe('0x9')]);router[_0x3efe('0x7')](_0x3efe('0xa'),auth['isAuthenticated'](),controller[_0x3efe('0xb')]);router['get'](_0x3efe('0xc'),auth[_0x3efe('0x6')](),controller[_0x3efe('0xd')]);router[_0x3efe('0x7')](_0x3efe('0xe'),auth[_0x3efe('0x6')](),controller['getDescriptions']);router['post']('/',auth[_0x3efe('0x6')](),controller[_0x3efe('0xf')]);router[_0x3efe('0x10')](_0x3efe('0x8'),auth[_0x3efe('0x6')](),controller[_0x3efe('0x11')]);router[_0x3efe('0x12')](_0x3efe('0x8'),auth[_0x3efe('0x6')](),controller[_0x3efe('0x13')]);module[_0x3efe('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e4bbe99..1a9812d 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 _0x1e56=['contact_lead','sequelize','STRING','ENUM','lead','contact','nothing'];(function(_0x61151d,_0x1eaadf){var _0x57752d=function(_0x1ac48a){while(--_0x1ac48a){_0x61151d['push'](_0x61151d['shift']());}};_0x57752d(++_0x1eaadf);}(_0x1e56,0x1dd));var _0x61e5=function(_0x3dd4ee,_0x5a1912){_0x3dd4ee=_0x3dd4ee-0x0;var _0xddb83=_0x1e56[_0x3dd4ee];return _0xddb83;};'use strict';var Sequelize=require(_0x61e5('0x0'));module['exports']={'name':{'type':Sequelize[_0x61e5('0x1')]},'moduleCreate':{'type':Sequelize[_0x61e5('0x2')](_0x61e5('0x3'),_0x61e5('0x4'),_0x61e5('0x5')),'defaultValue':_0x61e5('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x61e5('0x6'),_0x61e5('0x4'),'lead'),'defaultValue':_0x61e5('0x6')},'description':{'type':Sequelize[_0x61e5('0x1')]}}; \ No newline at end of file +var _0xe16f=['STRING','lead','contact','sequelize','exports'];(function(_0x4dc031,_0x5467dc){var _0x19437f=function(_0x3ebcac){while(--_0x3ebcac){_0x4dc031['push'](_0x4dc031['shift']());}};_0x19437f(++_0x5467dc);}(_0xe16f,0xbc));var _0xfe16=function(_0xe70d25,_0x4064e2){_0xe70d25=_0xe70d25-0x0;var _0x1cd1aa=_0xe16f[_0xe70d25];return _0x1cd1aa;};'use strict';var Sequelize=require(_0xfe16('0x0'));module[_0xfe16('0x1')]={'name':{'type':Sequelize[_0xfe16('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xfe16('0x3'),_0xfe16('0x4'),'nothing'),'defaultValue':_0xfe16('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xfe16('0x4'),_0xfe16('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 75a69d1..ac91170 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 _0x3bc2=['index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','params','keys','length','includeAll','find','create','getFields','findOne','ZohoField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','send'];(function(_0x1dbcaa,_0x3501e4){var _0x208531=function(_0x43450e){while(--_0x43450e){_0x1dbcaa['push'](_0x1dbcaa['shift']());}};_0x208531(++_0x3501e4);}(_0x3bc2,0x12c));var _0x23bc=function(_0xf62196,_0x389dd3){_0xf62196=_0xf62196-0x0;var _0x54934=_0x3bc2[_0xf62196];return _0x54934;};'use strict';var pdf=require(_0x23bc('0x0'));var emlformat=require(_0x23bc('0x1'));var rimraf=require(_0x23bc('0x2'));var zipdir=require(_0x23bc('0x3'));var jsonpatch=require(_0x23bc('0x4'));var rp=require(_0x23bc('0x5'));var moment=require(_0x23bc('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x23bc('0x7'));var util=require('util');var path=require(_0x23bc('0x8'));var sox=require(_0x23bc('0x9'));var csv=require(_0x23bc('0xa'));var ejs=require(_0x23bc('0xb'));var fs=require('fs');var _=require(_0x23bc('0xc'));var squel=require(_0x23bc('0xd'));var crypto=require(_0x23bc('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x23bc('0xa'));var querystring=require(_0x23bc('0xf'));var Papa=require(_0x23bc('0x10'));var Redis=require('ioredis');var authService=require(_0x23bc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23bc('0x12'));var logger=require(_0x23bc('0x13'))('api');var utils=require(_0x23bc('0x14'));var config=require(_0x23bc('0x15'));var db=require(_0x23bc('0x16'))['db'];var jayson=require(_0x23bc('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x42ac82,_0x4d6113,_0x3422ce){if(_0x3422ce){var _0x1a1bb2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a1bb2['test'](_0x4d6113)){return _0x42ac82;}else{throw new db[(_0x23bc('0x18'))][(_0x23bc('0x19'))](_0x23bc('0x1a'));}}else{return _0x42ac82;}}function respondWithRpcPromise(_0x439c33,_0x99b772,_0x498df5,_0x4edca4){return new BPromise(function(_0x5f4e97,_0x2e5a64){var _0x69ee90=_0x4edca4||client;return _0x69ee90[_0x23bc('0x1b')](_0x439c33,_0x498df5)[_0x23bc('0x1c')](function(_0xee97f){logger['info'](_0x23bc('0x1d'),_0x99b772,'request\x20sent');logger[_0x23bc('0x1e')](_0x23bc('0x1f'),_0x99b772,'request\x20sent',JSON[_0x23bc('0x20')](_0xee97f));if(_0xee97f[_0x23bc('0x21')]){if(_0xee97f['error'][_0x23bc('0x22')]===0x1f4){logger[_0x23bc('0x21')](_0x23bc('0x1d'),_0x99b772,_0xee97f[_0x23bc('0x21')]['message']);return _0x2e5a64(_0xee97f[_0x23bc('0x21')][_0x23bc('0x23')]);}logger[_0x23bc('0x21')](_0x23bc('0x1d'),_0x99b772,_0xee97f[_0x23bc('0x21')][_0x23bc('0x23')]);return _0x5f4e97(_0xee97f['error'][_0x23bc('0x23')]);}else{logger[_0x23bc('0x24')]('ZohoConfiguration,\x20%s,\x20%s',_0x99b772,_0x23bc('0x25'));_0x5f4e97(_0xee97f[_0x23bc('0x26')][_0x23bc('0x23')]);}})[_0x23bc('0x27')](function(_0x3471fb){logger[_0x23bc('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x99b772,_0x3471fb);_0x2e5a64(_0x3471fb);});});}function respondWithStatusCode(_0x33fe3e,_0x3a283b){_0x3a283b=_0x3a283b||0xcc;return function(_0x3221d6){if(_0x3221d6){return _0x33fe3e[_0x23bc('0x28')](_0x3a283b);}return _0x33fe3e[_0x23bc('0x29')](_0x3a283b)['end']();};}function respondWithResult(_0x4bf3ba,_0x12ee9a){_0x12ee9a=_0x12ee9a||0xc8;return function(_0x411f07){if(_0x411f07){return _0x4bf3ba[_0x23bc('0x29')](_0x12ee9a)[_0x23bc('0x2a')](_0x411f07);}};}function respondWithFilteredResult(_0x59da61,_0x59bc9c){return function(_0x1ceadb){if(_0x1ceadb){var _0x26522a=_0x1ceadb[_0x23bc('0x2b')],_0x2c9d7e=_0x59bc9c[_0x23bc('0x2c')],_0x4e5d24=_0x59bc9c[_0x23bc('0x2c')]+_0x59bc9c[_0x23bc('0x2d')],_0x31c29a;if(_0x4e5d24>=_0x26522a){_0x4e5d24=_0x26522a;_0x31c29a=0xc8;}else{_0x31c29a=0xce;}_0x59da61[_0x23bc('0x29')](_0x31c29a);return _0x59da61['set'](_0x23bc('0x2e'),_0x2c9d7e+'-'+_0x4e5d24+'/'+_0x26522a)['json'](_0x1ceadb);}return null;};}function patchUpdates(_0x135758){return function(_0x1b3d6d){try{jsonpatch[_0x23bc('0x2f')](_0x1b3d6d,_0x135758,!![]);}catch(_0x1a2450){return BPromise[_0x23bc('0x30')](_0x1a2450);}return _0x1b3d6d[_0x23bc('0x31')]();};}function saveUpdates(_0x4b33bf,_0x33cc2e){return function(_0x2a1720){if(_0x2a1720){return _0x2a1720[_0x23bc('0x32')](_0x4b33bf)['then'](function(_0x58c411){return _0x58c411;});}return null;};}function removeEntity(_0x1569be,_0x14b8ca){return function(_0x46efbb){if(_0x46efbb){return _0x46efbb[_0x23bc('0x33')]()[_0x23bc('0x1c')](function(){_0x1569be['status'](0xcc)[_0x23bc('0x34')]();});}};}function handleEntityNotFound(_0x198322,_0x36a9f3){return function(_0x5746ab){if(!_0x5746ab){_0x198322['sendStatus'](0x194);}return _0x5746ab;};}function handleError(_0xe3b2af,_0x41e37c){_0x41e37c=_0x41e37c||0x1f4;return function(_0x27f3cd){logger[_0x23bc('0x21')](_0x27f3cd[_0x23bc('0x35')]);if(_0x27f3cd[_0x23bc('0x36')]){delete _0x27f3cd['name'];}_0xe3b2af['status'](_0x41e37c)[_0x23bc('0x37')](_0x27f3cd);};}exports[_0x23bc('0x38')]=function(_0x542591,_0x5dbd25){var _0x215feb={},_0x5231e6={},_0x426efc={'count':0x0,'rows':[]};var _0x366416=_[_0x23bc('0x39')](db[_0x23bc('0x3a')][_0x23bc('0x3b')],function(_0x5c6e52){return{'name':_0x5c6e52[_0x23bc('0x3c')],'type':_0x5c6e52[_0x23bc('0x3d')]['key']};});_0x5231e6[_0x23bc('0x3e')]=_[_0x23bc('0x39')](_0x366416,_0x23bc('0x36'));_0x5231e6[_0x23bc('0x3f')]=_['keys'](_0x542591[_0x23bc('0x3f')]);_0x5231e6[_0x23bc('0x40')]=_['intersection'](_0x5231e6[_0x23bc('0x3e')],_0x5231e6[_0x23bc('0x3f')]);_0x215feb[_0x23bc('0x41')]=_[_0x23bc('0x42')](_0x5231e6[_0x23bc('0x3e')],qs['fields'](_0x542591[_0x23bc('0x3f')][_0x23bc('0x43')]));_0x215feb[_0x23bc('0x41')]=_0x215feb[_0x23bc('0x41')]['length']?_0x215feb['attributes']:_0x5231e6[_0x23bc('0x3e')];if(!_0x542591[_0x23bc('0x3f')][_0x23bc('0x44')](_0x23bc('0x45'))){_0x215feb[_0x23bc('0x2d')]=qs['limit'](_0x542591[_0x23bc('0x3f')][_0x23bc('0x2d')]);_0x215feb[_0x23bc('0x2c')]=qs[_0x23bc('0x2c')](_0x542591['query']['offset']);}_0x215feb[_0x23bc('0x46')]=qs[_0x23bc('0x47')](_0x542591[_0x23bc('0x3f')]['sort']);_0x215feb[_0x23bc('0x48')]=qs[_0x23bc('0x40')](_[_0x23bc('0x49')](_0x542591[_0x23bc('0x3f')],_0x5231e6[_0x23bc('0x40')]),_0x366416);if(_0x542591[_0x23bc('0x3f')][_0x23bc('0x4a')]){_0x215feb[_0x23bc('0x48')]=_[_0x23bc('0x4b')](_0x215feb[_0x23bc('0x48')],{'$or':_[_0x23bc('0x39')](_0x366416,function(_0x20653b){if(_0x20653b[_0x23bc('0x3d')]!==_0x23bc('0x4c')){var _0x2cb601={};_0x2cb601[_0x20653b[_0x23bc('0x36')]]={'$like':'%'+_0x542591[_0x23bc('0x3f')][_0x23bc('0x4a')]+'%'};return _0x2cb601;}})});}_0x215feb=_[_0x23bc('0x4b')]({},_0x215feb,_0x542591[_0x23bc('0x4d')]);var _0x32c28a={'where':_0x215feb['where']};return db['ZohoConfiguration'][_0x23bc('0x2b')](_0x32c28a)[_0x23bc('0x1c')](function(_0x4aa94b){_0x426efc[_0x23bc('0x2b')]=_0x4aa94b;if(_0x542591['query']['includeAll']){_0x215feb['include']=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x215feb);})[_0x23bc('0x1c')](function(_0x19d1c9){_0x426efc['rows']=_0x19d1c9;return _0x426efc;})[_0x23bc('0x1c')](respondWithFilteredResult(_0x5dbd25,_0x215feb))[_0x23bc('0x27')](handleError(_0x5dbd25,null));};exports['show']=function(_0x26dace,_0x7ed55b){var _0x5792ae={'raw':![],'where':{'id':_0x26dace[_0x23bc('0x4e')]['id']}},_0xc11eb1={};_0xc11eb1[_0x23bc('0x3e')]=_[_0x23bc('0x4f')](db[_0x23bc('0x3a')][_0x23bc('0x3b')]);_0xc11eb1[_0x23bc('0x3f')]=_[_0x23bc('0x4f')](_0x26dace[_0x23bc('0x3f')]);_0xc11eb1[_0x23bc('0x40')]=_[_0x23bc('0x42')](_0xc11eb1[_0x23bc('0x3e')],_0xc11eb1['query']);_0x5792ae[_0x23bc('0x41')]=_['intersection'](_0xc11eb1[_0x23bc('0x3e')],qs[_0x23bc('0x43')](_0x26dace[_0x23bc('0x3f')][_0x23bc('0x43')]));_0x5792ae[_0x23bc('0x41')]=_0x5792ae[_0x23bc('0x41')][_0x23bc('0x50')]?_0x5792ae[_0x23bc('0x41')]:_0xc11eb1[_0x23bc('0x3e')];if(_0x26dace['query'][_0x23bc('0x51')]){_0x5792ae['include']=[{'all':!![]}];}_0x5792ae=_[_0x23bc('0x4b')]({},_0x5792ae,_0x26dace[_0x23bc('0x4d')]);return db[_0x23bc('0x3a')][_0x23bc('0x52')](_0x5792ae)[_0x23bc('0x1c')](handleEntityNotFound(_0x7ed55b,null))['then'](respondWithResult(_0x7ed55b,null))['catch'](handleError(_0x7ed55b,null));};exports[_0x23bc('0x53')]=function(_0x337e6e,_0x59e16b){return db[_0x23bc('0x3a')]['create'](_0x337e6e['body'],{})[_0x23bc('0x1c')](respondWithResult(_0x59e16b,0xc9))['catch'](handleError(_0x59e16b,null));};exports[_0x23bc('0x32')]=function(_0x1dfeb4,_0x17d23f){if(_0x1dfeb4['body']['id']){delete _0x1dfeb4['body']['id'];}return db[_0x23bc('0x3a')][_0x23bc('0x52')]({'where':{'id':_0x1dfeb4[_0x23bc('0x4e')]['id']}})[_0x23bc('0x1c')](handleEntityNotFound(_0x17d23f,null))[_0x23bc('0x1c')](saveUpdates(_0x1dfeb4['body'],null))[_0x23bc('0x1c')](respondWithResult(_0x17d23f,null))[_0x23bc('0x27')](handleError(_0x17d23f,null));};exports[_0x23bc('0x33')]=function(_0x108ed7,_0x574e57){return db[_0x23bc('0x3a')][_0x23bc('0x52')]({'where':{'id':_0x108ed7[_0x23bc('0x4e')]['id']}})[_0x23bc('0x1c')](handleEntityNotFound(_0x574e57,null))[_0x23bc('0x1c')](removeEntity(_0x574e57,null))['catch'](handleError(_0x574e57,null));};exports[_0x23bc('0x54')]=function(_0x28cf75,_0x204402,_0x457bf2){var _0xf4e797={};var _0x44499e={};var _0x27103b;var _0x15d6a1;return db[_0x23bc('0x3a')][_0x23bc('0x55')]({'where':{'id':_0x28cf75[_0x23bc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x204402,null))['then'](function(_0x170f2a){if(_0x170f2a){_0x27103b=_0x170f2a;_0x44499e['model']=_[_0x23bc('0x4f')](db[_0x23bc('0x56')][_0x23bc('0x3b')]);_0x44499e[_0x23bc('0x3f')]=_['keys'](_0x28cf75[_0x23bc('0x3f')]);_0x44499e['filters']=_[_0x23bc('0x42')](_0x44499e[_0x23bc('0x3e')],_0x44499e['query']);_0xf4e797['attributes']=_[_0x23bc('0x42')](_0x44499e[_0x23bc('0x3e')],qs[_0x23bc('0x43')](_0x28cf75[_0x23bc('0x3f')][_0x23bc('0x43')]));_0xf4e797[_0x23bc('0x41')]=_0xf4e797['attributes']['length']?_0xf4e797[_0x23bc('0x41')]:_0x44499e[_0x23bc('0x3e')];_0xf4e797[_0x23bc('0x46')]=qs[_0x23bc('0x47')](_0x28cf75[_0x23bc('0x3f')]['sort']);_0xf4e797[_0x23bc('0x48')]=qs[_0x23bc('0x40')](_['pick'](_0x28cf75[_0x23bc('0x3f')],_0x44499e[_0x23bc('0x40')]));if(_0x28cf75[_0x23bc('0x3f')][_0x23bc('0x4a')]){_0xf4e797[_0x23bc('0x48')]=_[_0x23bc('0x4b')](_0xf4e797[_0x23bc('0x48')],{'$or':_[_0x23bc('0x39')](_0xf4e797[_0x23bc('0x41')],function(_0x37c671){var _0x372c8f={};_0x372c8f[_0x37c671]={'$like':'%'+_0x28cf75[_0x23bc('0x3f')][_0x23bc('0x4a')]+'%'};return _0x372c8f;})});}_0xf4e797=_[_0x23bc('0x4b')]({},_0xf4e797,_0x28cf75['options']);return _0x27103b[_0x23bc('0x54')](_0xf4e797);}})[_0x23bc('0x1c')](function(_0x3d7b74){if(_0x3d7b74){_0x15d6a1=_0x3d7b74['length'];if(!_0x28cf75[_0x23bc('0x3f')][_0x23bc('0x44')]('nolimit')){_0xf4e797[_0x23bc('0x2d')]=qs[_0x23bc('0x2d')](_0x28cf75['query']['limit']);_0xf4e797['offset']=qs[_0x23bc('0x2c')](_0x28cf75[_0x23bc('0x3f')][_0x23bc('0x2c')]);}return _0x27103b[_0x23bc('0x54')](_0xf4e797);}})[_0x23bc('0x1c')](function(_0x5d6a46){if(_0x5d6a46){return _0x5d6a46?{'count':_0x15d6a1,'rows':_0x5d6a46}:null;}})[_0x23bc('0x1c')](respondWithResult(_0x204402,null))[_0x23bc('0x27')](handleError(_0x204402,null));};exports['getSubjects']=function(_0x4318dc,_0x58f570,_0x5b732a){var _0x1f8ded={};var _0x209e79={};var _0xf4409a;var _0x3a28e5;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x4318dc['params']['id']}})[_0x23bc('0x1c')](handleEntityNotFound(_0x58f570,null))[_0x23bc('0x1c')](function(_0x18b839){if(_0x18b839){_0xf4409a=_0x18b839;_0x209e79[_0x23bc('0x3e')]=_['keys'](db[_0x23bc('0x56')]['rawAttributes']);_0x209e79[_0x23bc('0x3f')]=_[_0x23bc('0x4f')](_0x4318dc[_0x23bc('0x3f')]);_0x209e79[_0x23bc('0x40')]=_['intersection'](_0x209e79[_0x23bc('0x3e')],_0x209e79[_0x23bc('0x3f')]);_0x1f8ded[_0x23bc('0x41')]=_[_0x23bc('0x42')](_0x209e79['model'],qs[_0x23bc('0x43')](_0x4318dc[_0x23bc('0x3f')][_0x23bc('0x43')]));_0x1f8ded[_0x23bc('0x41')]=_0x1f8ded['attributes'][_0x23bc('0x50')]?_0x1f8ded[_0x23bc('0x41')]:_0x209e79['model'];_0x1f8ded[_0x23bc('0x46')]=qs[_0x23bc('0x47')](_0x4318dc['query'][_0x23bc('0x47')]);_0x1f8ded[_0x23bc('0x48')]=qs[_0x23bc('0x40')](_[_0x23bc('0x49')](_0x4318dc[_0x23bc('0x3f')],_0x209e79[_0x23bc('0x40')]));if(_0x4318dc[_0x23bc('0x3f')][_0x23bc('0x4a')]){_0x1f8ded[_0x23bc('0x48')]=_[_0x23bc('0x4b')](_0x1f8ded[_0x23bc('0x48')],{'$or':_[_0x23bc('0x39')](_0x1f8ded[_0x23bc('0x41')],function(_0x1fc1c9){var _0x1f9249={};_0x1f9249[_0x1fc1c9]={'$like':'%'+_0x4318dc['query'][_0x23bc('0x4a')]+'%'};return _0x1f9249;})});}_0x1f8ded=_['merge']({},_0x1f8ded,_0x4318dc[_0x23bc('0x4d')]);return _0xf4409a['getSubjects'](_0x1f8ded);}})[_0x23bc('0x1c')](function(_0x5ae116){if(_0x5ae116){_0x3a28e5=_0x5ae116[_0x23bc('0x50')];if(!_0x4318dc[_0x23bc('0x3f')][_0x23bc('0x44')](_0x23bc('0x45'))){_0x1f8ded[_0x23bc('0x2d')]=qs[_0x23bc('0x2d')](_0x4318dc[_0x23bc('0x3f')][_0x23bc('0x2d')]);_0x1f8ded[_0x23bc('0x2c')]=qs[_0x23bc('0x2c')](_0x4318dc['query']['offset']);}return _0xf4409a[_0x23bc('0x57')](_0x1f8ded);}})[_0x23bc('0x1c')](function(_0x329274){if(_0x329274){return _0x329274?{'count':_0x3a28e5,'rows':_0x329274}:null;}})[_0x23bc('0x1c')](respondWithResult(_0x58f570,null))[_0x23bc('0x27')](handleError(_0x58f570,null));};exports[_0x23bc('0x58')]=function(_0x5ad0eb,_0x3161dc,_0x2ef9f5){var _0x41dc62={};var _0x136794={};var _0x1e2b92;var _0x208e3a;return db[_0x23bc('0x3a')][_0x23bc('0x55')]({'where':{'id':_0x5ad0eb['params']['id']}})[_0x23bc('0x1c')](handleEntityNotFound(_0x3161dc,null))['then'](function(_0x3c8e83){if(_0x3c8e83){_0x1e2b92=_0x3c8e83;_0x136794[_0x23bc('0x3e')]=_['keys'](db[_0x23bc('0x56')][_0x23bc('0x3b')]);_0x136794[_0x23bc('0x3f')]=_[_0x23bc('0x4f')](_0x5ad0eb[_0x23bc('0x3f')]);_0x136794[_0x23bc('0x40')]=_['intersection'](_0x136794[_0x23bc('0x3e')],_0x136794['query']);_0x41dc62['attributes']=_[_0x23bc('0x42')](_0x136794['model'],qs[_0x23bc('0x43')](_0x5ad0eb['query'][_0x23bc('0x43')]));_0x41dc62['attributes']=_0x41dc62['attributes']['length']?_0x41dc62[_0x23bc('0x41')]:_0x136794[_0x23bc('0x3e')];_0x41dc62[_0x23bc('0x46')]=qs[_0x23bc('0x47')](_0x5ad0eb[_0x23bc('0x3f')][_0x23bc('0x47')]);_0x41dc62[_0x23bc('0x48')]=qs['filters'](_[_0x23bc('0x49')](_0x5ad0eb['query'],_0x136794['filters']));if(_0x5ad0eb[_0x23bc('0x3f')][_0x23bc('0x4a')]){_0x41dc62['where']=_[_0x23bc('0x4b')](_0x41dc62[_0x23bc('0x48')],{'$or':_['map'](_0x41dc62[_0x23bc('0x41')],function(_0x2e1f76){var _0x5c83af={};_0x5c83af[_0x2e1f76]={'$like':'%'+_0x5ad0eb[_0x23bc('0x3f')][_0x23bc('0x4a')]+'%'};return _0x5c83af;})});}_0x41dc62=_['merge']({},_0x41dc62,_0x5ad0eb[_0x23bc('0x4d')]);return _0x1e2b92[_0x23bc('0x58')](_0x41dc62);}})[_0x23bc('0x1c')](function(_0x11d8f0){if(_0x11d8f0){_0x208e3a=_0x11d8f0[_0x23bc('0x50')];if(!_0x5ad0eb[_0x23bc('0x3f')]['hasOwnProperty'](_0x23bc('0x45'))){_0x41dc62[_0x23bc('0x2d')]=qs['limit'](_0x5ad0eb['query'][_0x23bc('0x2d')]);_0x41dc62[_0x23bc('0x2c')]=qs[_0x23bc('0x2c')](_0x5ad0eb[_0x23bc('0x3f')][_0x23bc('0x2c')]);}return _0x1e2b92[_0x23bc('0x58')](_0x41dc62);}})[_0x23bc('0x1c')](function(_0x426a84){if(_0x426a84){return _0x426a84?{'count':_0x208e3a,'rows':_0x426a84}:null;}})[_0x23bc('0x1c')](respondWithResult(_0x3161dc,null))[_0x23bc('0x27')](handleError(_0x3161dc,null));}; \ No newline at end of file +var _0x00a7=['fields','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','rows','show','find','create','body','update','getFields','findOne','length','sort','hasOwnProperty','nolimit','getSubjects','params','ZohoField','order','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','then','destroy','name','send','index','ZohoConfiguration','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes'];(function(_0x380e79,_0x3217a2){var _0x38646d=function(_0x14e1b7){while(--_0x14e1b7){_0x380e79['push'](_0x380e79['shift']());}};_0x38646d(++_0x3217a2);}(_0x00a7,0x132));var _0x700a=function(_0x13c8e4,_0x173c5c){_0x13c8e4=_0x13c8e4-0x0;var _0x32b027=_0x00a7[_0x13c8e4];return _0x32b027;};'use strict';var pdf=require(_0x700a('0x0'));var emlformat=require(_0x700a('0x1'));var rimraf=require(_0x700a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x700a('0x3'));var rp=require(_0x700a('0x4'));var moment=require(_0x700a('0x5'));var BPromise=require(_0x700a('0x6'));var Mustache=require(_0x700a('0x7'));var util=require(_0x700a('0x8'));var path=require(_0x700a('0x9'));var sox=require(_0x700a('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x700a('0xb'));var squel=require(_0x700a('0xc'));var crypto=require(_0x700a('0xd'));var jsforce=require(_0x700a('0xe'));var deskjs=require(_0x700a('0xf'));var toCsv=require(_0x700a('0x10'));var querystring=require('querystring');var Papa=require(_0x700a('0x11'));var Redis=require(_0x700a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x700a('0x13'));var as=require(_0x700a('0x14'));var hardwareService=require(_0x700a('0x15'));var logger=require(_0x700a('0x16'))(_0x700a('0x17'));var utils=require(_0x700a('0x18'));var config=require(_0x700a('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x700a('0x1a'));var client=jayson['client'][_0x700a('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x381850,_0x166f07,_0x4a4215){if(_0x4a4215){var _0xdf9ee1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xdf9ee1[_0x700a('0x1c')](_0x166f07)){return _0x381850;}else{throw new db['Sequelize'][(_0x700a('0x1d'))](_0x700a('0x1e'));}}else{return _0x381850;}}function respondWithRpcPromise(_0x2a4d3f,_0x3572ba,_0xdb4746,_0xcf6197){return new BPromise(function(_0x29d251,_0x20f6bb){var _0x3e22be=_0xcf6197||client;return _0x3e22be[_0x700a('0x1f')](_0x2a4d3f,_0xdb4746)['then'](function(_0x10099c){logger[_0x700a('0x20')](_0x700a('0x21'),_0x3572ba,_0x700a('0x22'));logger[_0x700a('0x23')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3572ba,_0x700a('0x22'),JSON[_0x700a('0x24')](_0x10099c));if(_0x10099c['error']){if(_0x10099c[_0x700a('0x25')][_0x700a('0x26')]===0x1f4){logger[_0x700a('0x25')](_0x700a('0x21'),_0x3572ba,_0x10099c[_0x700a('0x25')][_0x700a('0x27')]);return _0x20f6bb(_0x10099c[_0x700a('0x25')][_0x700a('0x27')]);}logger['error'](_0x700a('0x21'),_0x3572ba,_0x10099c[_0x700a('0x25')]['message']);return _0x29d251(_0x10099c[_0x700a('0x25')][_0x700a('0x27')]);}else{logger[_0x700a('0x20')](_0x700a('0x21'),_0x3572ba,_0x700a('0x22'));_0x29d251(_0x10099c[_0x700a('0x28')]['message']);}})[_0x700a('0x29')](function(_0x2b2948){logger['error'](_0x700a('0x21'),_0x3572ba,_0x2b2948);_0x20f6bb(_0x2b2948);});});}function respondWithStatusCode(_0x1e7ca6,_0x161071){_0x161071=_0x161071||0xcc;return function(_0x48b539){if(_0x48b539){return _0x1e7ca6[_0x700a('0x2a')](_0x161071);}return _0x1e7ca6[_0x700a('0x2b')](_0x161071)['end']();};}function respondWithResult(_0x493d07,_0x250d40){_0x250d40=_0x250d40||0xc8;return function(_0x30dd50){if(_0x30dd50){return _0x493d07['status'](_0x250d40)[_0x700a('0x2c')](_0x30dd50);}};}function respondWithFilteredResult(_0x273d09,_0x5019b5){return function(_0x1ceeba){if(_0x1ceeba){var _0x438c3a=_0x1ceeba['count'],_0x4be580=_0x5019b5[_0x700a('0x2d')],_0x3fae27=_0x5019b5['offset']+_0x5019b5[_0x700a('0x2e')],_0x5571bf;if(_0x3fae27>=_0x438c3a){_0x3fae27=_0x438c3a;_0x5571bf=0xc8;}else{_0x5571bf=0xce;}_0x273d09['status'](_0x5571bf);return _0x273d09[_0x700a('0x2f')](_0x700a('0x30'),_0x4be580+'-'+_0x3fae27+'/'+_0x438c3a)['json'](_0x1ceeba);}return null;};}function patchUpdates(_0xad10fb){return function(_0x337249){try{jsonpatch[_0x700a('0x31')](_0x337249,_0xad10fb,!![]);}catch(_0x260a70){return BPromise['reject'](_0x260a70);}return _0x337249[_0x700a('0x32')]();};}function saveUpdates(_0x52669a,_0x49f93a){return function(_0x3e1097){if(_0x3e1097){return _0x3e1097['update'](_0x52669a)[_0x700a('0x33')](function(_0x5bc42e){return _0x5bc42e;});}return null;};}function removeEntity(_0x5566cb,_0x311e4f){return function(_0x43ebb7){if(_0x43ebb7){return _0x43ebb7[_0x700a('0x34')]()['then'](function(){_0x5566cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x596207,_0x50b3e6){return function(_0x505225){if(!_0x505225){_0x596207[_0x700a('0x2a')](0x194);}return _0x505225;};}function handleError(_0x5d8ecd,_0x14c54a){_0x14c54a=_0x14c54a||0x1f4;return function(_0x9e2fc0){logger[_0x700a('0x25')](_0x9e2fc0['stack']);if(_0x9e2fc0[_0x700a('0x35')]){delete _0x9e2fc0[_0x700a('0x35')];}_0x5d8ecd['status'](_0x14c54a)[_0x700a('0x36')](_0x9e2fc0);};}exports[_0x700a('0x37')]=function(_0x21d1e6,_0x3da43a){var _0x3a5485={},_0xfd0518={},_0x167842={'count':0x0,'rows':[]};var _0x560db4=_['map'](db[_0x700a('0x38')][_0x700a('0x39')],function(_0x27fa41){return{'name':_0x27fa41[_0x700a('0x3a')],'type':_0x27fa41['type']['key']};});_0xfd0518[_0x700a('0x3b')]=_[_0x700a('0x3c')](_0x560db4,_0x700a('0x35'));_0xfd0518[_0x700a('0x3d')]=_[_0x700a('0x3e')](_0x21d1e6[_0x700a('0x3d')]);_0xfd0518[_0x700a('0x3f')]=_[_0x700a('0x40')](_0xfd0518[_0x700a('0x3b')],_0xfd0518['query']);_0x3a5485[_0x700a('0x41')]=_[_0x700a('0x40')](_0xfd0518[_0x700a('0x3b')],qs[_0x700a('0x42')](_0x21d1e6['query'][_0x700a('0x42')]));_0x3a5485['attributes']=_0x3a5485['attributes']['length']?_0x3a5485[_0x700a('0x41')]:_0xfd0518[_0x700a('0x3b')];if(!_0x21d1e6[_0x700a('0x3d')]['hasOwnProperty']('nolimit')){_0x3a5485['limit']=qs[_0x700a('0x2e')](_0x21d1e6[_0x700a('0x3d')][_0x700a('0x2e')]);_0x3a5485[_0x700a('0x2d')]=qs[_0x700a('0x2d')](_0x21d1e6[_0x700a('0x3d')][_0x700a('0x2d')]);}_0x3a5485['order']=qs['sort'](_0x21d1e6[_0x700a('0x3d')]['sort']);_0x3a5485[_0x700a('0x43')]=qs[_0x700a('0x3f')](_[_0x700a('0x44')](_0x21d1e6[_0x700a('0x3d')],_0xfd0518['filters']),_0x560db4);if(_0x21d1e6[_0x700a('0x3d')]['filter']){_0x3a5485[_0x700a('0x43')]=_[_0x700a('0x45')](_0x3a5485[_0x700a('0x43')],{'$or':_[_0x700a('0x3c')](_0x560db4,function(_0x3044d0){if(_0x3044d0[_0x700a('0x46')]!==_0x700a('0x47')){var _0x1dad7e={};_0x1dad7e[_0x3044d0[_0x700a('0x35')]]={'$like':'%'+_0x21d1e6['query'][_0x700a('0x48')]+'%'};return _0x1dad7e;}})});}_0x3a5485=_[_0x700a('0x45')]({},_0x3a5485,_0x21d1e6[_0x700a('0x49')]);var _0x3005bd={'where':_0x3a5485[_0x700a('0x43')]};return db[_0x700a('0x38')][_0x700a('0x4a')](_0x3005bd)[_0x700a('0x33')](function(_0x235670){_0x167842[_0x700a('0x4a')]=_0x235670;if(_0x21d1e6[_0x700a('0x3d')][_0x700a('0x4b')]){_0x3a5485['include']=[{'all':!![]}];}return db[_0x700a('0x38')]['findAll'](_0x3a5485);})[_0x700a('0x33')](function(_0x5d60d1){_0x167842[_0x700a('0x4c')]=_0x5d60d1;return _0x167842;})[_0x700a('0x33')](respondWithFilteredResult(_0x3da43a,_0x3a5485))[_0x700a('0x29')](handleError(_0x3da43a,null));};exports[_0x700a('0x4d')]=function(_0x3108d5,_0x33d59a){var _0x2f21b8={'raw':![],'where':{'id':_0x3108d5['params']['id']}},_0x567ed7={};_0x567ed7['model']=_[_0x700a('0x3e')](db['ZohoConfiguration']['rawAttributes']);_0x567ed7[_0x700a('0x3d')]=_[_0x700a('0x3e')](_0x3108d5[_0x700a('0x3d')]);_0x567ed7[_0x700a('0x3f')]=_[_0x700a('0x40')](_0x567ed7['model'],_0x567ed7['query']);_0x2f21b8[_0x700a('0x41')]=_[_0x700a('0x40')](_0x567ed7['model'],qs[_0x700a('0x42')](_0x3108d5[_0x700a('0x3d')][_0x700a('0x42')]));_0x2f21b8[_0x700a('0x41')]=_0x2f21b8[_0x700a('0x41')]['length']?_0x2f21b8['attributes']:_0x567ed7['model'];if(_0x3108d5[_0x700a('0x3d')][_0x700a('0x4b')]){_0x2f21b8['include']=[{'all':!![]}];}_0x2f21b8=_[_0x700a('0x45')]({},_0x2f21b8,_0x3108d5[_0x700a('0x49')]);return db[_0x700a('0x38')][_0x700a('0x4e')](_0x2f21b8)[_0x700a('0x33')](handleEntityNotFound(_0x33d59a,null))[_0x700a('0x33')](respondWithResult(_0x33d59a,null))[_0x700a('0x29')](handleError(_0x33d59a,null));};exports['create']=function(_0x3c9f3a,_0x4cb8d7){return db[_0x700a('0x38')][_0x700a('0x4f')](_0x3c9f3a[_0x700a('0x50')],{})['then'](respondWithResult(_0x4cb8d7,0xc9))['catch'](handleError(_0x4cb8d7,null));};exports[_0x700a('0x51')]=function(_0x2b2870,_0x1f5b18){if(_0x2b2870[_0x700a('0x50')]['id']){delete _0x2b2870[_0x700a('0x50')]['id'];}return db[_0x700a('0x38')]['find']({'where':{'id':_0x2b2870['params']['id']}})[_0x700a('0x33')](handleEntityNotFound(_0x1f5b18,null))['then'](saveUpdates(_0x2b2870[_0x700a('0x50')],null))[_0x700a('0x33')](respondWithResult(_0x1f5b18,null))[_0x700a('0x29')](handleError(_0x1f5b18,null));};exports[_0x700a('0x34')]=function(_0x1b0578,_0x4a45ad){return db[_0x700a('0x38')][_0x700a('0x4e')]({'where':{'id':_0x1b0578['params']['id']}})[_0x700a('0x33')](handleEntityNotFound(_0x4a45ad,null))[_0x700a('0x33')](removeEntity(_0x4a45ad,null))[_0x700a('0x29')](handleError(_0x4a45ad,null));};exports[_0x700a('0x52')]=function(_0x1de5bf,_0x2c78ea,_0x140c03){var _0x2f03b9={};var _0x23dd5b={};var _0x158bbd;var _0x29e592;return db[_0x700a('0x38')][_0x700a('0x53')]({'where':{'id':_0x1de5bf['params']['id']}})[_0x700a('0x33')](handleEntityNotFound(_0x2c78ea,null))[_0x700a('0x33')](function(_0x449f42){if(_0x449f42){_0x158bbd=_0x449f42;_0x23dd5b[_0x700a('0x3b')]=_[_0x700a('0x3e')](db['ZohoField'][_0x700a('0x39')]);_0x23dd5b[_0x700a('0x3d')]=_[_0x700a('0x3e')](_0x1de5bf[_0x700a('0x3d')]);_0x23dd5b['filters']=_[_0x700a('0x40')](_0x23dd5b[_0x700a('0x3b')],_0x23dd5b[_0x700a('0x3d')]);_0x2f03b9[_0x700a('0x41')]=_[_0x700a('0x40')](_0x23dd5b[_0x700a('0x3b')],qs[_0x700a('0x42')](_0x1de5bf[_0x700a('0x3d')][_0x700a('0x42')]));_0x2f03b9['attributes']=_0x2f03b9[_0x700a('0x41')][_0x700a('0x54')]?_0x2f03b9['attributes']:_0x23dd5b[_0x700a('0x3b')];_0x2f03b9['order']=qs[_0x700a('0x55')](_0x1de5bf['query'][_0x700a('0x55')]);_0x2f03b9[_0x700a('0x43')]=qs[_0x700a('0x3f')](_[_0x700a('0x44')](_0x1de5bf[_0x700a('0x3d')],_0x23dd5b[_0x700a('0x3f')]));if(_0x1de5bf[_0x700a('0x3d')][_0x700a('0x48')]){_0x2f03b9[_0x700a('0x43')]=_[_0x700a('0x45')](_0x2f03b9[_0x700a('0x43')],{'$or':_[_0x700a('0x3c')](_0x2f03b9['attributes'],function(_0x490908){var _0x12005b={};_0x12005b[_0x490908]={'$like':'%'+_0x1de5bf[_0x700a('0x3d')]['filter']+'%'};return _0x12005b;})});}_0x2f03b9=_['merge']({},_0x2f03b9,_0x1de5bf[_0x700a('0x49')]);return _0x158bbd[_0x700a('0x52')](_0x2f03b9);}})[_0x700a('0x33')](function(_0x5357a6){if(_0x5357a6){_0x29e592=_0x5357a6[_0x700a('0x54')];if(!_0x1de5bf['query'][_0x700a('0x56')](_0x700a('0x57'))){_0x2f03b9[_0x700a('0x2e')]=qs['limit'](_0x1de5bf[_0x700a('0x3d')]['limit']);_0x2f03b9[_0x700a('0x2d')]=qs[_0x700a('0x2d')](_0x1de5bf[_0x700a('0x3d')][_0x700a('0x2d')]);}return _0x158bbd[_0x700a('0x52')](_0x2f03b9);}})[_0x700a('0x33')](function(_0x4f6f06){if(_0x4f6f06){return _0x4f6f06?{'count':_0x29e592,'rows':_0x4f6f06}:null;}})[_0x700a('0x33')](respondWithResult(_0x2c78ea,null))[_0x700a('0x29')](handleError(_0x2c78ea,null));};exports[_0x700a('0x58')]=function(_0x39e31e,_0x309738,_0x29e34f){var _0x1bb6fe={};var _0x12324e={};var _0x490ca2;var _0x14d8f9;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x39e31e[_0x700a('0x59')]['id']}})[_0x700a('0x33')](handleEntityNotFound(_0x309738,null))[_0x700a('0x33')](function(_0x5eb008){if(_0x5eb008){_0x490ca2=_0x5eb008;_0x12324e['model']=_[_0x700a('0x3e')](db[_0x700a('0x5a')][_0x700a('0x39')]);_0x12324e[_0x700a('0x3d')]=_['keys'](_0x39e31e[_0x700a('0x3d')]);_0x12324e['filters']=_['intersection'](_0x12324e[_0x700a('0x3b')],_0x12324e[_0x700a('0x3d')]);_0x1bb6fe[_0x700a('0x41')]=_[_0x700a('0x40')](_0x12324e[_0x700a('0x3b')],qs[_0x700a('0x42')](_0x39e31e['query'][_0x700a('0x42')]));_0x1bb6fe[_0x700a('0x41')]=_0x1bb6fe[_0x700a('0x41')][_0x700a('0x54')]?_0x1bb6fe[_0x700a('0x41')]:_0x12324e[_0x700a('0x3b')];_0x1bb6fe[_0x700a('0x5b')]=qs[_0x700a('0x55')](_0x39e31e[_0x700a('0x3d')][_0x700a('0x55')]);_0x1bb6fe[_0x700a('0x43')]=qs['filters'](_[_0x700a('0x44')](_0x39e31e[_0x700a('0x3d')],_0x12324e['filters']));if(_0x39e31e[_0x700a('0x3d')][_0x700a('0x48')]){_0x1bb6fe[_0x700a('0x43')]=_[_0x700a('0x45')](_0x1bb6fe[_0x700a('0x43')],{'$or':_[_0x700a('0x3c')](_0x1bb6fe[_0x700a('0x41')],function(_0x49c8cf){var _0x34d701={};_0x34d701[_0x49c8cf]={'$like':'%'+_0x39e31e[_0x700a('0x3d')]['filter']+'%'};return _0x34d701;})});}_0x1bb6fe=_[_0x700a('0x45')]({},_0x1bb6fe,_0x39e31e[_0x700a('0x49')]);return _0x490ca2[_0x700a('0x58')](_0x1bb6fe);}})['then'](function(_0x1e5790){if(_0x1e5790){_0x14d8f9=_0x1e5790[_0x700a('0x54')];if(!_0x39e31e[_0x700a('0x3d')]['hasOwnProperty'](_0x700a('0x57'))){_0x1bb6fe[_0x700a('0x2e')]=qs[_0x700a('0x2e')](_0x39e31e[_0x700a('0x3d')][_0x700a('0x2e')]);_0x1bb6fe['offset']=qs['offset'](_0x39e31e[_0x700a('0x3d')][_0x700a('0x2d')]);}return _0x490ca2[_0x700a('0x58')](_0x1bb6fe);}})[_0x700a('0x33')](function(_0x4086eb){if(_0x4086eb){return _0x4086eb?{'count':_0x14d8f9,'rows':_0x4086eb}:null;}})[_0x700a('0x33')](respondWithResult(_0x309738,null))[_0x700a('0x29')](handleError(_0x309738,null));};exports[_0x700a('0x5c')]=function(_0x275b3f,_0xc3e996,_0x4ab005){var _0xa18578={};var _0x264134={};var _0x600ff8;var _0x35bb96;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x275b3f[_0x700a('0x59')]['id']}})['then'](handleEntityNotFound(_0xc3e996,null))[_0x700a('0x33')](function(_0x5781a5){if(_0x5781a5){_0x600ff8=_0x5781a5;_0x264134[_0x700a('0x3b')]=_[_0x700a('0x3e')](db['ZohoField'][_0x700a('0x39')]);_0x264134['query']=_[_0x700a('0x3e')](_0x275b3f['query']);_0x264134[_0x700a('0x3f')]=_[_0x700a('0x40')](_0x264134[_0x700a('0x3b')],_0x264134['query']);_0xa18578['attributes']=_[_0x700a('0x40')](_0x264134['model'],qs[_0x700a('0x42')](_0x275b3f[_0x700a('0x3d')][_0x700a('0x42')]));_0xa18578[_0x700a('0x41')]=_0xa18578['attributes'][_0x700a('0x54')]?_0xa18578[_0x700a('0x41')]:_0x264134[_0x700a('0x3b')];_0xa18578[_0x700a('0x5b')]=qs[_0x700a('0x55')](_0x275b3f[_0x700a('0x3d')][_0x700a('0x55')]);_0xa18578[_0x700a('0x43')]=qs[_0x700a('0x3f')](_[_0x700a('0x44')](_0x275b3f[_0x700a('0x3d')],_0x264134[_0x700a('0x3f')]));if(_0x275b3f[_0x700a('0x3d')][_0x700a('0x48')]){_0xa18578[_0x700a('0x43')]=_[_0x700a('0x45')](_0xa18578[_0x700a('0x43')],{'$or':_[_0x700a('0x3c')](_0xa18578[_0x700a('0x41')],function(_0xc46234){var _0x5b1f00={};_0x5b1f00[_0xc46234]={'$like':'%'+_0x275b3f[_0x700a('0x3d')][_0x700a('0x48')]+'%'};return _0x5b1f00;})});}_0xa18578=_[_0x700a('0x45')]({},_0xa18578,_0x275b3f['options']);return _0x600ff8[_0x700a('0x5c')](_0xa18578);}})[_0x700a('0x33')](function(_0x1e9a3e){if(_0x1e9a3e){_0x35bb96=_0x1e9a3e[_0x700a('0x54')];if(!_0x275b3f[_0x700a('0x3d')][_0x700a('0x56')](_0x700a('0x57'))){_0xa18578[_0x700a('0x2e')]=qs[_0x700a('0x2e')](_0x275b3f[_0x700a('0x3d')][_0x700a('0x2e')]);_0xa18578[_0x700a('0x2d')]=qs[_0x700a('0x2d')](_0x275b3f['query']['offset']);}return _0x600ff8[_0x700a('0x5c')](_0xa18578);}})[_0x700a('0x33')](function(_0x2ecbf8){if(_0x2ecbf8){return _0x2ecbf8?{'count':_0x35bb96,'rows':_0x2ecbf8}:null;}})[_0x700a('0x33')](respondWithResult(_0xc3e996,null))['catch'](handleError(_0xc3e996,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 04caf97..a4b9c55 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 _0x2cc8=['define','lodash','util','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x36ecf3,_0x1868d2){var _0x51efa7=function(_0x52e455){while(--_0x52e455){_0x36ecf3['push'](_0x36ecf3['shift']());}};_0x51efa7(++_0x1868d2);}(_0x2cc8,0x1c1));var _0x82cc=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x2cc8[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x82cc('0x0'));var util=require(_0x82cc('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x82cc('0x2'));var fs=require('fs');var path=require(_0x82cc('0x3'));var rimraf=require(_0x82cc('0x4'));var config=require(_0x82cc('0x5'));var attributes=require('./intZohoConfiguration.attributes');module[_0x82cc('0x6')]=function(_0x2b7ce7,_0x21a7d6){return _0x2b7ce7[_0x82cc('0x7')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfef=['exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5971d9,_0x5dcbcc){var _0x442b60=function(_0xb5d13f){while(--_0xb5d13f){_0x5971d9['push'](_0x5971d9['shift']());}};_0x442b60(++_0x5dcbcc);}(_0xcfef,0x118));var _0xfcfe=function(_0x562d0d,_0x17705c){_0x562d0d=_0x562d0d-0x0;var _0x237f8e=_0xcfef[_0x562d0d];return _0x237f8e;};'use strict';var _=require('lodash');var util=require(_0xfcfe('0x0'));var logger=require(_0xfcfe('0x1'))(_0xfcfe('0x2'));var moment=require(_0xfcfe('0x3'));var BPromise=require(_0xfcfe('0x4'));var rp=require(_0xfcfe('0x5'));var fs=require('fs');var path=require(_0xfcfe('0x6'));var rimraf=require(_0xfcfe('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xfcfe('0x8')]=function(_0x40b7bb,_0x3407a1){return _0x40b7bb[_0xfcfe('0x9')](_0xfcfe('0xa'),attributes,{'tableName':_0xfcfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 43929cc..0841477 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 _0x5a8c=['code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3ba286,_0x33dcfa){var _0x317f97=function(_0x54846d){while(--_0x54846d){_0x3ba286['push'](_0x3ba286['shift']());}};_0x317f97(++_0x33dcfa);}(_0x5a8c,0xdf));var _0xc5a8=function(_0x21e9be,_0x145bbd){_0x21e9be=_0x21e9be-0x0;var _0x57797b=_0x5a8c[_0x21e9be];return _0x57797b;};'use strict';var _=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var moment=require(_0xc5a8('0x2'));var BPromise=require(_0xc5a8('0x3'));var rs=require(_0xc5a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc5a8('0x6'));var config=require(_0xc5a8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc5a8('0x8')][_0xc5a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b6362,_0x2163b3,_0x178ebc){return new BPromise(function(_0x41e6b8,_0x4383a3){return client[_0xc5a8('0xa')](_0x4b6362,_0x178ebc)[_0xc5a8('0xb')](function(_0x463fb6){logger[_0xc5a8('0xc')](_0xc5a8('0xd'),_0x2163b3,_0xc5a8('0xe'));logger[_0xc5a8('0xf')](_0xc5a8('0x10'),_0x2163b3,_0xc5a8('0xe'),JSON[_0xc5a8('0x11')](_0x463fb6));if(_0x463fb6[_0xc5a8('0x12')]){if(_0x463fb6[_0xc5a8('0x12')][_0xc5a8('0x13')]===0x1f4){logger[_0xc5a8('0x12')](_0xc5a8('0xd'),_0x2163b3,_0x463fb6[_0xc5a8('0x12')]['message']);return _0x4383a3(_0x463fb6[_0xc5a8('0x12')]['message']);}logger[_0xc5a8('0x12')](_0xc5a8('0xd'),_0x2163b3,_0x463fb6[_0xc5a8('0x12')][_0xc5a8('0x14')]);return _0x41e6b8(_0x463fb6[_0xc5a8('0x12')][_0xc5a8('0x14')]);}else{logger[_0xc5a8('0xc')](_0xc5a8('0xd'),_0x2163b3,'request\x20sent');_0x41e6b8(_0x463fb6[_0xc5a8('0x15')][_0xc5a8('0x14')]);}})['catch'](function(_0x2f4041){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2163b3,_0x2f4041);_0x4383a3(_0x2f4041);});});} \ No newline at end of file +var _0x9404=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird'];(function(_0x84daaa,_0x5b68ac){var _0x4a6477=function(_0x1d9878){while(--_0x1d9878){_0x84daaa['push'](_0x84daaa['shift']());}};_0x4a6477(++_0x5b68ac);}(_0x9404,0x106));var _0x4940=function(_0x3412b3,_0x5a17f0){_0x3412b3=_0x3412b3-0x0;var _0x4930c8=_0x9404[_0x3412b3];return _0x4930c8;};'use strict';var _=require(_0x4940('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4940('0x1'));var rs=require(_0x4940('0x2'));var fs=require('fs');var Redis=require(_0x4940('0x3'));var db=require(_0x4940('0x4'))['db'];var utils=require(_0x4940('0x5'));var logger=require(_0x4940('0x6'))(_0x4940('0x7'));var config=require('../../config/environment');var jayson=require(_0x4940('0x8'));var client=jayson[_0x4940('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d387e,_0x3368cf,_0x3f14a4){return new BPromise(function(_0x4558e7,_0x4408ee){return client[_0x4940('0xa')](_0x4d387e,_0x3f14a4)[_0x4940('0xb')](function(_0x16c048){logger[_0x4940('0xc')](_0x4940('0xd'),_0x3368cf,_0x4940('0xe'));logger[_0x4940('0xf')](_0x4940('0x10'),_0x3368cf,_0x4940('0xe'),JSON[_0x4940('0x11')](_0x16c048));if(_0x16c048[_0x4940('0x12')]){if(_0x16c048['error'][_0x4940('0x13')]===0x1f4){logger[_0x4940('0x12')](_0x4940('0xd'),_0x3368cf,_0x16c048[_0x4940('0x12')]['message']);return _0x4408ee(_0x16c048[_0x4940('0x12')][_0x4940('0x14')]);}logger['error'](_0x4940('0xd'),_0x3368cf,_0x16c048[_0x4940('0x12')][_0x4940('0x14')]);return _0x4558e7(_0x16c048['error'][_0x4940('0x14')]);}else{logger['info'](_0x4940('0xd'),_0x3368cf,'request\x20sent');_0x4558e7(_0x16c048['result'][_0x4940('0x14')]);}})[_0x4940('0x15')](function(_0x570048){logger[_0x4940('0x12')](_0x4940('0xd'),_0x3368cf,_0x570048);_0x4408ee(_0x570048);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index dfe39cc..54f02a3 100644 --- a/server/api/intZohoField/index.js +++ b/server/api/intZohoField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3423=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','path','connect-timeout','express','Router'];(function(_0x39382e,_0xa7ba98){var _0xc126c9=function(_0x22fd6f){while(--_0x22fd6f){_0x39382e['push'](_0x39382e['shift']());}};_0xc126c9(++_0xa7ba98);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0xd')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router[_0x3342('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3342('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3342('0x11')]=router; \ No newline at end of file +var _0xb016=['delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','show','post','put','/:id','update'];(function(_0x5a766f,_0x135d23){var _0xebfcf3=function(_0x1d5bb5){while(--_0x1d5bb5){_0x5a766f['push'](_0x5a766f['shift']());}};_0xebfcf3(++_0x135d23);}(_0xb016,0x159));var _0x6b01=function(_0x52db2a,_0x1c4dda){_0x52db2a=_0x52db2a-0x0;var _0x33a894=_0xb016[_0x52db2a];return _0x33a894;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var auth=require(_0x6b01('0x3'));var interaction=require(_0x6b01('0x4'));var config=require(_0x6b01('0x5'));var controller=require(_0x6b01('0x6'));router['get']('/',auth[_0x6b01('0x7')](),controller[_0x6b01('0x8')]);router[_0x6b01('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6b01('0xa')]);router[_0x6b01('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6b01('0xc')](_0x6b01('0xd'),auth[_0x6b01('0x7')](),controller[_0x6b01('0xe')]);router[_0x6b01('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6b01('0x10')]);module[_0x6b01('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 212f411..d2f7c01 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 _0x5aaa=['STRING','ENUM','customVariable','sequelize','keyValue','string'];(function(_0x2b10bc,_0x39e518){var _0x26782c=function(_0x109ffd){while(--_0x109ffd){_0x2b10bc['push'](_0x2b10bc['shift']());}};_0x26782c(++_0x39e518);}(_0x5aaa,0xff));var _0xa5aa=function(_0x3761da,_0x3b45ad){_0x3761da=_0x3761da-0x0;var _0x591cfb=_0x5aaa[_0x3761da];return _0x591cfb;};'use strict';var Sequelize=require(_0xa5aa('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0xa5aa('0x1')),'defaultValue':_0xa5aa('0x2')},'content':{'type':Sequelize[_0xa5aa('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa5aa('0x4')](_0xa5aa('0x2'),'variable',_0xa5aa('0x5'))},'keyContent':{'type':Sequelize[_0xa5aa('0x3')]},'idField':{'type':Sequelize[_0xa5aa('0x3')]},'nameField':{'type':Sequelize[_0xa5aa('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7da7=['exports','ENUM','customVariable','keyValue','STRING','string','variable','BOOLEAN','sequelize'];(function(_0x27e892,_0x11f9a2){var _0x21b8ee=function(_0x356d79){while(--_0x356d79){_0x27e892['push'](_0x27e892['shift']());}};_0x21b8ee(++_0x11f9a2);}(_0x7da7,0x10d));var _0x77da=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x7da7[_0x4191bc];return _0x1ffd4e;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'type':{'type':Sequelize[_0x77da('0x2')]('string','variable',_0x77da('0x3'),_0x77da('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x77da('0x5')]},'key':{'type':Sequelize[_0x77da('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x77da('0x6'),_0x77da('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x77da('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x77da('0x5')]},'customField':{'type':Sequelize[_0x77da('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77da('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b4847e5..5124149 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(_0x3130c0,_0x1309a3){var _0x5e08e7=function(_0x37325e){while(--_0x37325e){_0x3130c0['push'](_0x3130c0['shift']());}};_0x5e08e7(++_0x1309a3);}(_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 +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(_0x3307bd,_0x256dbf){var _0x2561be=function(_0x3ebf){while(--_0x3ebf){_0x3307bd['push'](_0x3307bd['shift']());}};_0x2561be(++_0x256dbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 20d488d..6613209 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 _0x31b4=['define','ZohoField','int_zoho_fields','util','../../config/logger','api','moment','bluebird','path','rimraf','exports'];(function(_0x117bb5,_0x14169e){var _0x4dfa5b=function(_0x1403bf){while(--_0x1403bf){_0x117bb5['push'](_0x117bb5['shift']());}};_0x4dfa5b(++_0x14169e);}(_0x31b4,0xc9));var _0x431b=function(_0x364e7a,_0x1e4dea){_0x364e7a=_0x364e7a-0x0;var _0x38aedd=_0x31b4[_0x364e7a];return _0x38aedd;};'use strict';var _=require('lodash');var util=require(_0x431b('0x0'));var logger=require(_0x431b('0x1'))(_0x431b('0x2'));var moment=require(_0x431b('0x3'));var BPromise=require(_0x431b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x431b('0x5'));var rimraf=require(_0x431b('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x431b('0x7')]=function(_0x11c004,_0x39402a){return _0x11c004[_0x431b('0x8')](_0x431b('0x9'),attributes,{'tableName':_0x431b('0xa'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8922=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','lodash','util','../../config/logger'];(function(_0x56cc0e,_0x86dae6){var _0x5482f5=function(_0x15b363){while(--_0x15b363){_0x56cc0e['push'](_0x56cc0e['shift']());}};_0x5482f5(++_0x86dae6);}(_0x8922,0xa2));var _0x2892=function(_0x415a23,_0x3f90db){_0x415a23=_0x415a23-0x0;var _0x4dffc9=_0x8922[_0x415a23];return _0x4dffc9;};'use strict';var _=require(_0x2892('0x0'));var util=require(_0x2892('0x1'));var logger=require(_0x2892('0x2'))(_0x2892('0x3'));var moment=require(_0x2892('0x4'));var BPromise=require(_0x2892('0x5'));var rp=require(_0x2892('0x6'));var fs=require('fs');var path=require(_0x2892('0x7'));var rimraf=require(_0x2892('0x8'));var config=require(_0x2892('0x9'));var attributes=require(_0x2892('0xa'));module[_0x2892('0xb')]=function(_0x100511,_0x268031){return _0x100511[_0x2892('0xc')](_0x2892('0xd'),attributes,{'tableName':_0x2892('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 7c2f963..da8eaff 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x4b5eae,_0x43af1c){var _0x26d50b=function(_0x5e6ac0){while(--_0x5e6ac0){_0x4b5eae['push'](_0x4b5eae['shift']());}};_0x26d50b(++_0x43af1c);}(_0x55ca,0x126));var _0xa55c=function(_0x407bd8,_0x277add){_0x407bd8=_0x407bd8-0x0;var _0x20b6c9=_0x55ca[_0x407bd8];return _0x20b6c9;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('ZohoField,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('ZohoField,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +var _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x53a301,_0x213873){var _0x3ffcca=function(_0x27f530){while(--_0x27f530){_0x53a301['push'](_0x53a301['shift']());}};_0x3ffcca(++_0x213873);}(_0xfd28,0x148));var _0x8fd2=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xfd28[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 7ad0f88..64de4b9 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 _0xd121=['util','connect-timeout','express','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0xd121,0x187));var _0x1d12=function(_0xfaa41b,_0xfa170d){_0xfaa41b=_0xfaa41b-0x0;var _0x2257fd=_0xd121[_0xfaa41b];return _0x2257fd;};'use strict';var multer=require(_0x1d12('0x0'));var util=require(_0x1d12('0x1'));var path=require('path');var timeout=require(_0x1d12('0x2'));var express=require(_0x1d12('0x3'));var router=express['Router']();var auth=require(_0x1d12('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1d12('0x5'));module[_0x1d12('0x6')]=router; \ No newline at end of file +var _0xe3b6=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','exports'];(function(_0x2f8a7c,_0x3f65fd){var _0x257e01=function(_0x412826){while(--_0x412826){_0x2f8a7c['push'](_0x2f8a7c['shift']());}};_0x257e01(++_0x3f65fd);}(_0xe3b6,0x110));var _0x6e3b=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe3b6[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x6e3b('0x0'));var util=require(_0x6e3b('0x1'));var path=require(_0x6e3b('0x2'));var timeout=require(_0x6e3b('0x3'));var express=require(_0x6e3b('0x4'));var router=express['Router']();var auth=require(_0x6e3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6e3b('0x6'));module[_0x6e3b('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 79042a8..46dbc26 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 _0x6fdf=['app.js','INTEGER','state','exports','STRING','unique_name_and_version'];(function(_0x561754,_0x1a780c){var _0x59ff11=function(_0x26d919){while(--_0x26d919){_0x561754['push'](_0x561754['shift']());}};_0x59ff11(++_0x1a780c);}(_0x6fdf,0x1c5));var _0xf6fd=function(_0x5759d9,_0x22b644){_0x5759d9=_0x5759d9-0x0;var _0x32f3bd=_0x6fdf[_0x5759d9];return _0x32f3bd;};'use strict';var Sequelize=require('sequelize');module[_0xf6fd('0x0')]={'name':{'type':Sequelize[_0xf6fd('0x1')],'allowNull':![],'unique':_0xf6fd('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf6fd('0x2')},'main':{'type':Sequelize[_0xf6fd('0x1')],'defaultValue':_0xf6fd('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xf6fd('0x1')]},'type':{'type':Sequelize[_0xf6fd('0x1')]},'size':{'type':Sequelize[_0xf6fd('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xf6fd('0x1')]},'logo':{'type':Sequelize[_0xf6fd('0x1')]},'state':{'type':Sequelize[_0xf6fd('0x1')],'unique':_0xf6fd('0x5')},'description':{'type':Sequelize[_0xf6fd('0x1')]},'title':{'type':Sequelize[_0xf6fd('0x1')]},'remoteUri':{'type':Sequelize[_0xf6fd('0x1')]},'link':{'type':Sequelize[_0xf6fd('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x3afc=['unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x180e11,_0x24bfb8){var _0x330930=function(_0x5be898){while(--_0x5be898){_0x180e11['push'](_0x180e11['shift']());}};_0x330930(++_0x24bfb8);}(_0x3afc,0x1ee));var _0xc3af=function(_0x2d20d8,_0x56d6d4){_0x2d20d8=_0x2d20d8-0x0;var _0x229c97=_0x3afc[_0x2d20d8];return _0x229c97;};'use strict';var Sequelize=require(_0xc3af('0x0'));module[_0xc3af('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc3af('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xc3af('0x3')],'defaultValue':_0xc3af('0x4')},'filename':{'type':Sequelize[_0xc3af('0x3')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xc3af('0x5')]},'active':{'type':Sequelize[_0xc3af('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xc3af('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xc3af('0x3')],'unique':_0xc3af('0x7')},'description':{'type':Sequelize[_0xc3af('0x3')]},'title':{'type':Sequelize[_0xc3af('0x3')]},'remoteUri':{'type':Sequelize[_0xc3af('0x3')]},'link':{'type':Sequelize[_0xc3af('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 888571b..4677da0 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 _0x0eb6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xc5775d,_0x3701ab){var _0x3b4edd=function(_0x37c3cb){while(--_0x37c3cb){_0xc5775d['push'](_0xc5775d['shift']());}};_0x3b4edd(++_0x3701ab);}(_0x0eb6,0x158));var _0x60eb=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x0eb6[_0x1aeda2];return _0x32dc6d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x60eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x60eb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x60eb('0x2'));var BPromise=require(_0x60eb('0x3'));var Mustache=require(_0x60eb('0x4'));var util=require(_0x60eb('0x5'));var path=require(_0x60eb('0x6'));var sox=require(_0x60eb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x60eb('0x8'));var squel=require('squel');var crypto=require(_0x60eb('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x60eb('0xa'));var querystring=require(_0x60eb('0xb'));var Papa=require(_0x60eb('0xc'));var Redis=require(_0x60eb('0xd'));var authService=require(_0x60eb('0xe'));var qs=require(_0x60eb('0xf'));var as=require(_0x60eb('0x10'));var hardwareService=require(_0x60eb('0x11'));var logger=require('../../config/logger')(_0x60eb('0x12'));var utils=require('../../config/utils');var config=require(_0x60eb('0x13'));var db=require(_0x60eb('0x14'))['db'];function respondWithStatusCode(_0x24bee4,_0x153e1a){_0x153e1a=_0x153e1a||0xcc;return function(_0x4aff17){if(_0x4aff17){return _0x24bee4[_0x60eb('0x15')](_0x153e1a);}return _0x24bee4[_0x60eb('0x16')](_0x153e1a)[_0x60eb('0x17')]();};}function respondWithResult(_0x679916,_0x170dc3){_0x170dc3=_0x170dc3||0xc8;return function(_0x3d2db2){if(_0x3d2db2){return _0x679916[_0x60eb('0x16')](_0x170dc3)[_0x60eb('0x18')](_0x3d2db2);}};}function respondWithFilteredResult(_0x188e53,_0x5e7d03){return function(_0x4a5b44){if(_0x4a5b44){var _0x2f72eb=_0x4a5b44[_0x60eb('0x19')],_0x181c4c=_0x5e7d03['offset'],_0x4866ce=_0x5e7d03[_0x60eb('0x1a')]+_0x5e7d03['limit'],_0x2481e4;if(_0x4866ce>=_0x2f72eb){_0x4866ce=_0x2f72eb;_0x2481e4=0xc8;}else{_0x2481e4=0xce;}_0x188e53[_0x60eb('0x16')](_0x2481e4);return _0x188e53[_0x60eb('0x1b')](_0x60eb('0x1c'),_0x181c4c+'-'+_0x4866ce+'/'+_0x2f72eb)[_0x60eb('0x18')](_0x4a5b44);}return null;};}function patchUpdates(_0x4efe43){return function(_0x4c6020){try{jsonpatch[_0x60eb('0x1d')](_0x4c6020,_0x4efe43,!![]);}catch(_0x227e80){return BPromise[_0x60eb('0x1e')](_0x227e80);}return _0x4c6020[_0x60eb('0x1f')]();};}function saveUpdates(_0x268ac3,_0x4b13e1){return function(_0x5bd7ad){if(_0x5bd7ad){return _0x5bd7ad[_0x60eb('0x20')](_0x268ac3)['then'](function(_0x1026ba){return _0x1026ba;});}return null;};}function removeEntity(_0x177972,_0x1b46a3){return function(_0xbb6897){if(_0xbb6897){return _0xbb6897[_0x60eb('0x21')]()[_0x60eb('0x22')](function(){_0x177972['status'](0xcc)[_0x60eb('0x17')]();});}};}function handleEntityNotFound(_0x46bf8a,_0x1090e3){return function(_0x7e8a25){if(!_0x7e8a25){_0x46bf8a['sendStatus'](0x194);}return _0x7e8a25;};}function handleError(_0x1c5c66,_0x3e4435){_0x3e4435=_0x3e4435||0x1f4;return function(_0x22f40c){logger[_0x60eb('0x23')](_0x22f40c['stack']);if(_0x22f40c[_0x60eb('0x24')]){delete _0x22f40c[_0x60eb('0x24')];}_0x1c5c66[_0x60eb('0x16')](_0x3e4435)[_0x60eb('0x25')](_0x22f40c);};}exports[_0x60eb('0x26')]=function(_0x521076,_0x5ecf54){var _0x287525={},_0x26be7b={},_0xf6ff15={'count':0x0,'rows':[]};var _0x4e2662=_[_0x60eb('0x27')](db[_0x60eb('0x28')][_0x60eb('0x29')],function(_0x34d42c){return{'name':_0x34d42c[_0x60eb('0x2a')],'type':_0x34d42c[_0x60eb('0x2b')][_0x60eb('0x2c')]};});_0x26be7b[_0x60eb('0x2d')]=_[_0x60eb('0x27')](_0x4e2662,_0x60eb('0x24'));_0x26be7b[_0x60eb('0x2e')]=_[_0x60eb('0x2f')](_0x521076[_0x60eb('0x2e')]);_0x26be7b[_0x60eb('0x30')]=_[_0x60eb('0x31')](_0x26be7b[_0x60eb('0x2d')],_0x26be7b[_0x60eb('0x2e')]);_0x287525['attributes']=_[_0x60eb('0x31')](_0x26be7b[_0x60eb('0x2d')],qs[_0x60eb('0x32')](_0x521076[_0x60eb('0x2e')][_0x60eb('0x32')]));_0x287525[_0x60eb('0x33')]=_0x287525[_0x60eb('0x33')][_0x60eb('0x34')]?_0x287525['attributes']:_0x26be7b[_0x60eb('0x2d')];if(!_0x521076[_0x60eb('0x2e')][_0x60eb('0x35')](_0x60eb('0x36'))){_0x287525[_0x60eb('0x37')]=qs[_0x60eb('0x37')](_0x521076[_0x60eb('0x2e')][_0x60eb('0x37')]);_0x287525['offset']=qs[_0x60eb('0x1a')](_0x521076['query'][_0x60eb('0x1a')]);}_0x287525[_0x60eb('0x38')]=qs[_0x60eb('0x39')](_0x521076[_0x60eb('0x2e')][_0x60eb('0x39')]);_0x287525[_0x60eb('0x3a')]=qs[_0x60eb('0x30')](_[_0x60eb('0x3b')](_0x521076[_0x60eb('0x2e')],_0x26be7b['filters']),_0x4e2662);if(_0x521076[_0x60eb('0x2e')][_0x60eb('0x3c')]){_0x287525['where']=_[_0x60eb('0x3d')](_0x287525[_0x60eb('0x3a')],{'$or':_[_0x60eb('0x27')](_0x4e2662,function(_0x5c4fa1){if(_0x5c4fa1[_0x60eb('0x2b')]!==_0x60eb('0x3e')){var _0x5f4831={};_0x5f4831[_0x5c4fa1[_0x60eb('0x24')]]={'$like':'%'+_0x521076['query'][_0x60eb('0x3c')]+'%'};return _0x5f4831;}})});}_0x287525=_[_0x60eb('0x3d')]({},_0x287525,_0x521076[_0x60eb('0x3f')]);var _0x108db0={'where':_0x287525['where']};return db['Integration']['count'](_0x108db0)[_0x60eb('0x22')](function(_0x404068){_0xf6ff15[_0x60eb('0x19')]=_0x404068;if(_0x521076[_0x60eb('0x2e')]['includeAll']){_0x287525[_0x60eb('0x40')]=[{'all':!![]}];}return db['Integration'][_0x60eb('0x41')](_0x287525);})['then'](function(_0xb76355){_0xf6ff15[_0x60eb('0x42')]=_0xb76355;return _0xf6ff15;})[_0x60eb('0x22')](respondWithFilteredResult(_0x5ecf54,_0x287525))[_0x60eb('0x43')](handleError(_0x5ecf54,null));};exports['show']=function(_0x385f05,_0x4c2823){var _0x4fbbe7={'raw':![],'where':{'id':_0x385f05[_0x60eb('0x44')]['id']}},_0x5378d5={};_0x5378d5[_0x60eb('0x2d')]=_[_0x60eb('0x2f')](db[_0x60eb('0x28')][_0x60eb('0x29')]);_0x5378d5[_0x60eb('0x2e')]=_[_0x60eb('0x2f')](_0x385f05[_0x60eb('0x2e')]);_0x5378d5['filters']=_['intersection'](_0x5378d5['model'],_0x5378d5[_0x60eb('0x2e')]);_0x4fbbe7[_0x60eb('0x33')]=_[_0x60eb('0x31')](_0x5378d5[_0x60eb('0x2d')],qs[_0x60eb('0x32')](_0x385f05['query'][_0x60eb('0x32')]));_0x4fbbe7['attributes']=_0x4fbbe7[_0x60eb('0x33')]['length']?_0x4fbbe7[_0x60eb('0x33')]:_0x5378d5[_0x60eb('0x2d')];if(_0x385f05[_0x60eb('0x2e')]['includeAll']){_0x4fbbe7[_0x60eb('0x40')]=[{'all':!![]}];}_0x4fbbe7=_[_0x60eb('0x3d')]({},_0x4fbbe7,_0x385f05[_0x60eb('0x3f')]);return db[_0x60eb('0x28')][_0x60eb('0x45')](_0x4fbbe7)[_0x60eb('0x22')](handleEntityNotFound(_0x4c2823,null))['then'](respondWithResult(_0x4c2823,null))['catch'](handleError(_0x4c2823,null));};exports[_0x60eb('0x46')]=function(_0x256b58,_0x521235){return db['Integration']['create'](_0x256b58[_0x60eb('0x47')],{})['then'](respondWithResult(_0x521235,0xc9))[_0x60eb('0x43')](handleError(_0x521235,null));};exports[_0x60eb('0x20')]=function(_0x231666,_0x5237b9){if(_0x231666['body']['id']){delete _0x231666['body']['id'];}return db['Integration'][_0x60eb('0x45')]({'where':{'id':_0x231666[_0x60eb('0x44')]['id']}})[_0x60eb('0x22')](handleEntityNotFound(_0x5237b9,null))['then'](saveUpdates(_0x231666[_0x60eb('0x47')],null))[_0x60eb('0x22')](respondWithResult(_0x5237b9,null))[_0x60eb('0x43')](handleError(_0x5237b9,null));};exports[_0x60eb('0x21')]=function(_0x498a6e,_0x3b76de){return db[_0x60eb('0x28')][_0x60eb('0x45')]({'where':{'id':_0x498a6e[_0x60eb('0x44')]['id']}})[_0x60eb('0x22')](handleEntityNotFound(_0x3b76de,null))[_0x60eb('0x22')](removeEntity(_0x3b76de,null))['catch'](handleError(_0x3b76de,null));}; \ No newline at end of file +var _0x06f7=['then','includeAll','findAll','catch','show','params','keys','include','find','create','body','destroy','eml-format','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','error','stack','send','index','map','Integration','fieldName','type','key','filters','intersection','attributes','model','fields','length','query','hasOwnProperty','sort','where','pick','merge','VIRTUAL','name','filter','options'];(function(_0x38f990,_0x2e06a0){var _0x424491=function(_0x55dcc4){while(--_0x55dcc4){_0x38f990['push'](_0x38f990['shift']());}};_0x424491(++_0x2e06a0);}(_0x06f7,0x1aa));var _0x706f=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0x06f7[_0x44e00a];return _0x2bdfba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x706f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x706f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x706f('0x2'));var moment=require(_0x706f('0x3'));var BPromise=require(_0x706f('0x4'));var Mustache=require('mustache');var util=require(_0x706f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x706f('0x6'));var ejs=require(_0x706f('0x7'));var fs=require('fs');var _=require(_0x706f('0x8'));var squel=require(_0x706f('0x9'));var crypto=require(_0x706f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x706f('0xb'));var Papa=require(_0x706f('0xc'));var Redis=require(_0x706f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x706f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x706f('0xf'));var logger=require(_0x706f('0x10'))('api');var utils=require(_0x706f('0x11'));var config=require(_0x706f('0x12'));var db=require(_0x706f('0x13'))['db'];function respondWithStatusCode(_0x26a4b3,_0x40c110){_0x40c110=_0x40c110||0xcc;return function(_0x4d49aa){if(_0x4d49aa){return _0x26a4b3[_0x706f('0x14')](_0x40c110);}return _0x26a4b3[_0x706f('0x15')](_0x40c110)[_0x706f('0x16')]();};}function respondWithResult(_0x28d0a1,_0x5b6a10){_0x5b6a10=_0x5b6a10||0xc8;return function(_0x50cdee){if(_0x50cdee){return _0x28d0a1['status'](_0x5b6a10)[_0x706f('0x17')](_0x50cdee);}};}function respondWithFilteredResult(_0x3f482a,_0x41a122){return function(_0x224f39){if(_0x224f39){var _0x303eeb=_0x224f39[_0x706f('0x18')],_0x275caf=_0x41a122[_0x706f('0x19')],_0x4fad14=_0x41a122[_0x706f('0x19')]+_0x41a122[_0x706f('0x1a')],_0x382576;if(_0x4fad14>=_0x303eeb){_0x4fad14=_0x303eeb;_0x382576=0xc8;}else{_0x382576=0xce;}_0x3f482a[_0x706f('0x15')](_0x382576);return _0x3f482a[_0x706f('0x1b')](_0x706f('0x1c'),_0x275caf+'-'+_0x4fad14+'/'+_0x303eeb)[_0x706f('0x17')](_0x224f39);}return null;};}function patchUpdates(_0x21e799){return function(_0x54f4dc){try{jsonpatch[_0x706f('0x1d')](_0x54f4dc,_0x21e799,!![]);}catch(_0x2710fc){return BPromise['reject'](_0x2710fc);}return _0x54f4dc[_0x706f('0x1e')]();};}function saveUpdates(_0x52720a,_0x46be92){return function(_0x2cc1e4){if(_0x2cc1e4){return _0x2cc1e4[_0x706f('0x1f')](_0x52720a)['then'](function(_0x5230db){return _0x5230db;});}return null;};}function removeEntity(_0x12dc27,_0x2c3127){return function(_0x2b87c9){if(_0x2b87c9){return _0x2b87c9['destroy']()['then'](function(){_0x12dc27[_0x706f('0x15')](0xcc)[_0x706f('0x16')]();});}};}function handleEntityNotFound(_0x1d8380,_0x366c4d){return function(_0x2f0808){if(!_0x2f0808){_0x1d8380['sendStatus'](0x194);}return _0x2f0808;};}function handleError(_0x26e73b,_0x12b953){_0x12b953=_0x12b953||0x1f4;return function(_0x22525d){logger[_0x706f('0x20')](_0x22525d[_0x706f('0x21')]);if(_0x22525d['name']){delete _0x22525d['name'];}_0x26e73b[_0x706f('0x15')](_0x12b953)[_0x706f('0x22')](_0x22525d);};}exports[_0x706f('0x23')]=function(_0xbf2049,_0x8c8972){var _0x57749b={},_0x2141c2={},_0x7f91e0={'count':0x0,'rows':[]};var _0x3448f5=_[_0x706f('0x24')](db[_0x706f('0x25')]['rawAttributes'],function(_0x8a6ea0){return{'name':_0x8a6ea0[_0x706f('0x26')],'type':_0x8a6ea0[_0x706f('0x27')][_0x706f('0x28')]};});_0x2141c2['model']=_[_0x706f('0x24')](_0x3448f5,'name');_0x2141c2['query']=_['keys'](_0xbf2049['query']);_0x2141c2[_0x706f('0x29')]=_[_0x706f('0x2a')](_0x2141c2['model'],_0x2141c2['query']);_0x57749b[_0x706f('0x2b')]=_[_0x706f('0x2a')](_0x2141c2[_0x706f('0x2c')],qs['fields'](_0xbf2049['query'][_0x706f('0x2d')]));_0x57749b[_0x706f('0x2b')]=_0x57749b['attributes'][_0x706f('0x2e')]?_0x57749b[_0x706f('0x2b')]:_0x2141c2['model'];if(!_0xbf2049[_0x706f('0x2f')][_0x706f('0x30')]('nolimit')){_0x57749b[_0x706f('0x1a')]=qs['limit'](_0xbf2049[_0x706f('0x2f')][_0x706f('0x1a')]);_0x57749b[_0x706f('0x19')]=qs['offset'](_0xbf2049[_0x706f('0x2f')][_0x706f('0x19')]);}_0x57749b['order']=qs[_0x706f('0x31')](_0xbf2049[_0x706f('0x2f')][_0x706f('0x31')]);_0x57749b[_0x706f('0x32')]=qs[_0x706f('0x29')](_[_0x706f('0x33')](_0xbf2049[_0x706f('0x2f')],_0x2141c2[_0x706f('0x29')]),_0x3448f5);if(_0xbf2049[_0x706f('0x2f')]['filter']){_0x57749b['where']=_[_0x706f('0x34')](_0x57749b['where'],{'$or':_[_0x706f('0x24')](_0x3448f5,function(_0x56f97d){if(_0x56f97d[_0x706f('0x27')]!==_0x706f('0x35')){var _0x12494e={};_0x12494e[_0x56f97d[_0x706f('0x36')]]={'$like':'%'+_0xbf2049[_0x706f('0x2f')][_0x706f('0x37')]+'%'};return _0x12494e;}})});}_0x57749b=_[_0x706f('0x34')]({},_0x57749b,_0xbf2049[_0x706f('0x38')]);var _0x1cff4d={'where':_0x57749b[_0x706f('0x32')]};return db['Integration']['count'](_0x1cff4d)[_0x706f('0x39')](function(_0x39055f){_0x7f91e0['count']=_0x39055f;if(_0xbf2049[_0x706f('0x2f')][_0x706f('0x3a')]){_0x57749b['include']=[{'all':!![]}];}return db[_0x706f('0x25')][_0x706f('0x3b')](_0x57749b);})['then'](function(_0x1ef091){_0x7f91e0['rows']=_0x1ef091;return _0x7f91e0;})[_0x706f('0x39')](respondWithFilteredResult(_0x8c8972,_0x57749b))[_0x706f('0x3c')](handleError(_0x8c8972,null));};exports[_0x706f('0x3d')]=function(_0x510ae3,_0x308512){var _0x29971f={'raw':![],'where':{'id':_0x510ae3[_0x706f('0x3e')]['id']}},_0x4182c1={};_0x4182c1[_0x706f('0x2c')]=_['keys'](db[_0x706f('0x25')]['rawAttributes']);_0x4182c1[_0x706f('0x2f')]=_[_0x706f('0x3f')](_0x510ae3[_0x706f('0x2f')]);_0x4182c1[_0x706f('0x29')]=_[_0x706f('0x2a')](_0x4182c1[_0x706f('0x2c')],_0x4182c1[_0x706f('0x2f')]);_0x29971f[_0x706f('0x2b')]=_[_0x706f('0x2a')](_0x4182c1[_0x706f('0x2c')],qs[_0x706f('0x2d')](_0x510ae3['query'][_0x706f('0x2d')]));_0x29971f[_0x706f('0x2b')]=_0x29971f[_0x706f('0x2b')]['length']?_0x29971f['attributes']:_0x4182c1['model'];if(_0x510ae3[_0x706f('0x2f')][_0x706f('0x3a')]){_0x29971f[_0x706f('0x40')]=[{'all':!![]}];}_0x29971f=_[_0x706f('0x34')]({},_0x29971f,_0x510ae3[_0x706f('0x38')]);return db['Integration'][_0x706f('0x41')](_0x29971f)['then'](handleEntityNotFound(_0x308512,null))[_0x706f('0x39')](respondWithResult(_0x308512,null))['catch'](handleError(_0x308512,null));};exports[_0x706f('0x42')]=function(_0x5836f9,_0x56fa33){return db[_0x706f('0x25')][_0x706f('0x42')](_0x5836f9[_0x706f('0x43')],{})[_0x706f('0x39')](respondWithResult(_0x56fa33,0xc9))['catch'](handleError(_0x56fa33,null));};exports['update']=function(_0x3e2a95,_0x4c2dbf){if(_0x3e2a95[_0x706f('0x43')]['id']){delete _0x3e2a95[_0x706f('0x43')]['id'];}return db[_0x706f('0x25')]['find']({'where':{'id':_0x3e2a95[_0x706f('0x3e')]['id']}})[_0x706f('0x39')](handleEntityNotFound(_0x4c2dbf,null))['then'](saveUpdates(_0x3e2a95['body'],null))[_0x706f('0x39')](respondWithResult(_0x4c2dbf,null))[_0x706f('0x3c')](handleError(_0x4c2dbf,null));};exports[_0x706f('0x44')]=function(_0x5b6437,_0x6a25cf){return db[_0x706f('0x25')][_0x706f('0x41')]({'where':{'id':_0x5b6437[_0x706f('0x3e')]['id']}})[_0x706f('0x39')](handleEntityNotFound(_0x6a25cf,null))[_0x706f('0x39')](removeEntity(_0x6a25cf,null))[_0x706f('0x3c')](handleError(_0x6a25cf,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index fe8cdb6..bd18bd1 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 _0x7734=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','integrations','lodash'];(function(_0x28bba7,_0x439971){var _0x36152a=function(_0x38b61b){while(--_0x38b61b){_0x28bba7['push'](_0x28bba7['shift']());}};_0x36152a(++_0x439971);}(_0x7734,0x9b));var _0x4773=function(_0x16b14e,_0x46d816){_0x16b14e=_0x16b14e-0x0;var _0xd979ab=_0x7734[_0x16b14e];return _0xd979ab;};'use strict';var _=require(_0x4773('0x0'));var util=require(_0x4773('0x1'));var logger=require(_0x4773('0x2'))(_0x4773('0x3'));var moment=require(_0x4773('0x4'));var BPromise=require(_0x4773('0x5'));var rp=require(_0x4773('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4773('0x7'));var config=require(_0x4773('0x8'));var attributes=require(_0x4773('0x9'));module[_0x4773('0xa')]=function(_0x9d0089,_0x19f594){return _0x9d0089[_0x4773('0xb')]('Integration',attributes,{'tableName':_0x4773('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dce=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger'];(function(_0x526d00,_0x30bd19){var _0x4cb88f=function(_0x2a90df){while(--_0x2a90df){_0x526d00['push'](_0x526d00['shift']());}};_0x4cb88f(++_0x30bd19);}(_0x4dce,0xdd));var _0xe4dc=function(_0x312abc,_0x17f25c){_0x312abc=_0x312abc-0x0;var _0x314298=_0x4dce[_0x312abc];return _0x314298;};'use strict';var _=require(_0xe4dc('0x0'));var util=require(_0xe4dc('0x1'));var logger=require(_0xe4dc('0x2'))('api');var moment=require(_0xe4dc('0x3'));var BPromise=require(_0xe4dc('0x4'));var rp=require(_0xe4dc('0x5'));var fs=require('fs');var path=require(_0xe4dc('0x6'));var rimraf=require(_0xe4dc('0x7'));var config=require(_0xe4dc('0x8'));var attributes=require(_0xe4dc('0x9'));module[_0xe4dc('0xa')]=function(_0xfa9db8,_0x111148){return _0xfa9db8[_0xe4dc('0xb')](_0xe4dc('0xc'),attributes,{'tableName':_0xe4dc('0xd'),'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 306316f..5f3930f 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 _0x482d=['request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x18296d,_0x4df6a0){var _0x390757=function(_0x227873){while(--_0x227873){_0x18296d['push'](_0x18296d['shift']());}};_0x390757(++_0x4df6a0);}(_0x482d,0x16c));var _0xd482=function(_0x4a0b8f,_0x3abfeb){_0x4a0b8f=_0x4a0b8f-0x0;var _0x4452ad=_0x482d[_0x4a0b8f];return _0x4452ad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd482('0x0'));var BPromise=require(_0xd482('0x1'));var rs=require(_0xd482('0x2'));var fs=require('fs');var Redis=require(_0xd482('0x3'));var db=require(_0xd482('0x4'))['db'];var utils=require(_0xd482('0x5'));var logger=require('../../config/logger')(_0xd482('0x6'));var config=require(_0xd482('0x7'));var jayson=require(_0xd482('0x8'));var client=jayson['client'][_0xd482('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d6b47,_0x5bfc0f,_0x478af5){return new BPromise(function(_0x144d7d,_0x74f369){return client[_0xd482('0xa')](_0x5d6b47,_0x478af5)['then'](function(_0x144d5b){logger[_0xd482('0xb')](_0xd482('0xc'),_0x5bfc0f,_0xd482('0xd'));logger[_0xd482('0xe')](_0xd482('0xf'),_0x5bfc0f,_0xd482('0xd'),JSON[_0xd482('0x10')](_0x144d5b));if(_0x144d5b['error']){if(_0x144d5b[_0xd482('0x11')][_0xd482('0x12')]===0x1f4){logger[_0xd482('0x11')](_0xd482('0xc'),_0x5bfc0f,_0x144d5b['error'][_0xd482('0x13')]);return _0x74f369(_0x144d5b[_0xd482('0x11')][_0xd482('0x13')]);}logger['error'](_0xd482('0xc'),_0x5bfc0f,_0x144d5b['error']['message']);return _0x144d7d(_0x144d5b[_0xd482('0x11')]['message']);}else{logger[_0xd482('0xb')](_0xd482('0xc'),_0x5bfc0f,'request\x20sent');_0x144d7d(_0x144d5b[_0xd482('0x14')][_0xd482('0x13')]);}})[_0xd482('0x15')](function(_0x2cc6e1){logger[_0xd482('0x11')]('Integration,\x20%s,\x20%s',_0x5bfc0f,_0x2cc6e1);_0x74f369(_0x2cc6e1);});});} \ No newline at end of file +var _0xb3ea=['error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x42932c,_0x4ad0c7){var _0x50166f=function(_0x1d9562){while(--_0x1d9562){_0x42932c['push'](_0x42932c['shift']());}};_0x50166f(++_0x4ad0c7);}(_0xb3ea,0x10d));var _0xab3e=function(_0x32002f,_0x2dbe41){_0x32002f=_0x32002f-0x0;var _0x8688d0=_0xb3ea[_0x32002f];return _0x8688d0;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var moment=require(_0xab3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xab3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab3e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab3e('0x5'))(_0xab3e('0x6'));var config=require(_0xab3e('0x7'));var jayson=require(_0xab3e('0x8'));var client=jayson[_0xab3e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c0a3f,_0x4fecb7,_0x1026e7){return new BPromise(function(_0x6b6e2,_0x51482b){return client[_0xab3e('0xa')](_0x3c0a3f,_0x1026e7)[_0xab3e('0xb')](function(_0x5d8bab){logger[_0xab3e('0xc')](_0xab3e('0xd'),_0x4fecb7,'request\x20sent');logger['debug'](_0xab3e('0xe'),_0x4fecb7,_0xab3e('0xf'),JSON[_0xab3e('0x10')](_0x5d8bab));if(_0x5d8bab[_0xab3e('0x11')]){if(_0x5d8bab[_0xab3e('0x11')][_0xab3e('0x12')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x4fecb7,_0x5d8bab['error'][_0xab3e('0x13')]);return _0x51482b(_0x5d8bab[_0xab3e('0x11')][_0xab3e('0x13')]);}logger[_0xab3e('0x11')]('Integration,\x20%s,\x20%s',_0x4fecb7,_0x5d8bab[_0xab3e('0x11')]['message']);return _0x6b6e2(_0x5d8bab['error'][_0xab3e('0x13')]);}else{logger[_0xab3e('0xc')]('Integration,\x20%s,\x20%s',_0x4fecb7,_0xab3e('0xf'));_0x6b6e2(_0x5d8bab[_0xab3e('0x14')]['message']);}})[_0xab3e('0x15')](function(_0x516b1d){logger[_0xab3e('0x11')]('Integration,\x20%s,\x20%s',_0x4fecb7,_0x516b1d);_0x51482b(_0x516b1d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index e8ce13e..d537c5b 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 _0x7709=['../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x367444,_0x1b1dd8){var _0x371d48=function(_0x380019){while(--_0x380019){_0x367444['push'](_0x367444['shift']());}};_0x371d48(++_0x1b1dd8);}(_0x7709,0x175));var _0x9770=function(_0x4d0b3a,_0x1ecf04){_0x4d0b3a=_0x4d0b3a-0x0;var _0x590b05=_0x7709[_0x4d0b3a];return _0x590b05;};'use strict';var multer=require('multer');var util=require(_0x9770('0x0'));var path=require(_0x9770('0x1'));var timeout=require(_0x9770('0x2'));var express=require(_0x9770('0x3'));var router=express['Router']();var auth=require(_0x9770('0x4'));var interaction=require(_0x9770('0x5'));var config=require(_0x9770('0x6'));var controller=require('./integrationReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9770('0x7')]);router[_0x9770('0x8')](_0x9770('0x9'),auth[_0x9770('0xa')](),controller['describe']);router['get'](_0x9770('0xb'),auth[_0x9770('0xa')](),controller[_0x9770('0xc')]);router['post']('/',auth[_0x9770('0xa')](),controller[_0x9770('0xd')]);router[_0x9770('0xe')]('/:id',auth[_0x9770('0xa')](),controller[_0x9770('0xf')]);router[_0x9770('0x10')](_0x9770('0xb'),auth[_0x9770('0xa')](),controller['destroy']);module[_0x9770('0x11')]=router; \ No newline at end of file +var _0x1d2d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x189a9f,_0x1c2ef6){_0x189a9f=_0x189a9f-0x0;var _0xd65398=_0x1d2d[_0x189a9f];return _0xd65398;};'use strict';var multer=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var path=require(_0xd1d2('0x2'));var timeout=require(_0xd1d2('0x3'));var express=require(_0xd1d2('0x4'));var router=express['Router']();var auth=require(_0xd1d2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd1d2('0x6'));router[_0xd1d2('0x7')]('/',auth[_0xd1d2('0x8')](),controller[_0xd1d2('0x9')]);router[_0xd1d2('0x7')](_0xd1d2('0xa'),auth['isAuthenticated'](),controller[_0xd1d2('0xb')]);router[_0xd1d2('0x7')](_0xd1d2('0xc'),auth[_0xd1d2('0x8')](),controller[_0xd1d2('0xd')]);router[_0xd1d2('0xe')]('/',auth[_0xd1d2('0x8')](),controller[_0xd1d2('0xf')]);router[_0xd1d2('0x10')](_0xd1d2('0xc'),auth[_0xd1d2('0x8')](),controller[_0xd1d2('0x11')]);router[_0xd1d2('0x12')]('/:id',auth[_0xd1d2('0x8')](),controller[_0xd1d2('0x13')]);module[_0xd1d2('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1137465..1ff7ce7 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 _0x5034=['SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x57b1b5,_0x516015){var _0x21520e=function(_0x229d6e){while(--_0x229d6e){_0x57b1b5['push'](_0x57b1b5['shift']());}};_0x21520e(++_0x516015);}(_0x5034,0xb8));var _0x4503=function(_0x37dcd0,_0x304fa1){_0x37dcd0=_0x37dcd0-0x0;var _0x58e19f=_0x5034[_0x37dcd0];return _0x58e19f;};'use strict';var Sequelize=require(_0x4503('0x0'));module[_0x4503('0x1')]={'integration':{'type':Sequelize[_0x4503('0x2')]},'eventChannel':{'type':Sequelize[_0x4503('0x2')]},'exitStatus':{'type':Sequelize[_0x4503('0x2')]},'ticketId':{'type':Sequelize[_0x4503('0x2')]},'integrationId':{'type':Sequelize[_0x4503('0x3')]},'contacts':{'type':Sequelize[_0x4503('0x2')]},'uniqueid':{'type':Sequelize[_0x4503('0x2')]},'calleridnum':{'type':Sequelize[_0x4503('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4503('0x2')]},'interface':{'type':Sequelize[_0x4503('0x2')]},'membername':{'type':Sequelize[_0x4503('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4503('0x4')]},'agentconnectAt':{'type':Sequelize[_0x4503('0x4')]},'holdtime':{'type':Sequelize[_0x4503('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4503('0x4')]},'talktime':{'type':Sequelize[_0x4503('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x4503('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4503('0x4')]},'agentdump':{'type':Sequelize[_0x4503('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4503('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4503('0x2')]},'channelstate':{'type':Sequelize[_0x4503('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4503('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4503('0x2')]},'connectedlinename':{'type':Sequelize[_0x4503('0x2')]},'language':{'type':Sequelize[_0x4503('0x2')]},'accountcode':{'type':Sequelize[_0x4503('0x2')]},'context':{'type':Sequelize[_0x4503('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4503('0x2')]},'destchannelstate':{'type':Sequelize[_0x4503('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x4503('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4503('0x2')]},'destcalleridname':{'type':Sequelize[_0x4503('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x4503('0x2')]},'destaccountcode':{'type':Sequelize[_0x4503('0x2')]},'destcontext':{'type':Sequelize[_0x4503('0x2')]},'destexten':{'type':Sequelize[_0x4503('0x2')]},'destpriority':{'type':Sequelize[_0x4503('0x2')]},'destuniqueid':{'type':Sequelize[_0x4503('0x2')]},'messageId':{'type':Sequelize[_0x4503('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x4503('0x2')]},'from':{'type':Sequelize[_0x4503('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4503('0x2')]},'attachment':{'type':Sequelize[_0x4503('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x4503('0x6')]},'status':{'type':Sequelize[_0x4503('0x7')](_0x4503('0x8'),_0x4503('0x9'),_0x4503('0xa'),_0x4503('0xb'))},'url':{'type':Sequelize[_0x4503('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4503('0x2')]},'projectId':{'type':Sequelize[_0x4503('0x3')]}}; \ No newline at end of file +var _0x1724=['BOOLEAN','DATE','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x1724,0x147));var _0x4172=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x1724[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x4172('0x0'));module['exports']={'integration':{'type':Sequelize[_0x4172('0x1')]},'eventChannel':{'type':Sequelize[_0x4172('0x1')]},'exitStatus':{'type':Sequelize[_0x4172('0x1')]},'ticketId':{'type':Sequelize[_0x4172('0x1')]},'integrationId':{'type':Sequelize[_0x4172('0x2')]},'contacts':{'type':Sequelize[_0x4172('0x1')]},'uniqueid':{'type':Sequelize[_0x4172('0x1')]},'calleridnum':{'type':Sequelize[_0x4172('0x1')]},'calleridname':{'type':Sequelize[_0x4172('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4172('0x1')]},'membername':{'type':Sequelize[_0x4172('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4172('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x4172('0x2')]},'agentacw':{'type':Sequelize[_0x4172('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4172('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4172('0x4')]},'agentdump':{'type':Sequelize[_0x4172('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4172('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4172('0x1')]},'channelstate':{'type':Sequelize[_0x4172('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4172('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4172('0x1')]},'connectedlinename':{'type':Sequelize[_0x4172('0x1')]},'language':{'type':Sequelize[_0x4172('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4172('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4172('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4172('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4172('0x1')]},'destcalleridname':{'type':Sequelize[_0x4172('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4172('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4172('0x1')]},'destlanguage':{'type':Sequelize[_0x4172('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4172('0x1')]},'destexten':{'type':Sequelize[_0x4172('0x1')]},'destpriority':{'type':Sequelize[_0x4172('0x1')]},'destuniqueid':{'type':Sequelize[_0x4172('0x1')]},'messageId':{'type':Sequelize[_0x4172('0x1')]},'inReplyTo':{'type':Sequelize[_0x4172('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x4172('0x1')]},'to':{'type':Sequelize[_0x4172('0x1')]},'cc':{'type':Sequelize[_0x4172('0x1')]},'attachment':{'type':Sequelize[_0x4172('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x4172('0x6')](_0x4172('0x7'),_0x4172('0x8'),_0x4172('0x9'),_0x4172('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4172('0x1')]},'projectId':{'type':Sequelize[_0x4172('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 496aa16..a93818f 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 _0xd7ce=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x499b56,_0x308586){var _0x2910a4=function(_0x11186d){while(--_0x11186d){_0x499b56['push'](_0x499b56['shift']());}};_0x2910a4(++_0x308586);}(_0xd7ce,0x116));var _0xed7c=function(_0x55cc58,_0x5ce0af){_0x55cc58=_0x55cc58-0x0;var _0x26062e=_0xd7ce[_0x55cc58];return _0x26062e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xed7c('0x0'));var zipdir=require(_0xed7c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed7c('0x2'));var moment=require(_0xed7c('0x3'));var BPromise=require(_0xed7c('0x4'));var Mustache=require(_0xed7c('0x5'));var util=require(_0xed7c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xed7c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xed7c('0x8'));var squel=require(_0xed7c('0x9'));var crypto=require(_0xed7c('0xa'));var jsforce=require(_0xed7c('0xb'));var deskjs=require(_0xed7c('0xc'));var toCsv=require(_0xed7c('0x7'));var querystring=require(_0xed7c('0xd'));var Papa=require(_0xed7c('0xe'));var Redis=require(_0xed7c('0xf'));var authService=require(_0xed7c('0x10'));var qs=require(_0xed7c('0x11'));var as=require(_0xed7c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed7c('0x13'));var utils=require(_0xed7c('0x14'));var config=require(_0xed7c('0x15'));var db=require(_0xed7c('0x16'))['db'];function respondWithStatusCode(_0xd009f2,_0x137d1c){_0x137d1c=_0x137d1c||0xcc;return function(_0x53967b){if(_0x53967b){return _0xd009f2[_0xed7c('0x17')](_0x137d1c);}return _0xd009f2[_0xed7c('0x18')](_0x137d1c)[_0xed7c('0x19')]();};}function respondWithResult(_0x4c456e,_0x32b9f3){_0x32b9f3=_0x32b9f3||0xc8;return function(_0x34415c){if(_0x34415c){return _0x4c456e[_0xed7c('0x18')](_0x32b9f3)[_0xed7c('0x1a')](_0x34415c);}};}function respondWithFilteredResult(_0x1c13fc,_0xc6384b){return function(_0x142c1d){if(_0x142c1d){var _0x58b1bd=_0x142c1d[_0xed7c('0x1b')],_0x2b540c=_0xc6384b[_0xed7c('0x1c')],_0x5ab4cb=_0xc6384b[_0xed7c('0x1c')]+_0xc6384b[_0xed7c('0x1d')],_0x35a72b;if(_0x5ab4cb>=_0x58b1bd){_0x5ab4cb=_0x58b1bd;_0x35a72b=0xc8;}else{_0x35a72b=0xce;}_0x1c13fc[_0xed7c('0x18')](_0x35a72b);return _0x1c13fc[_0xed7c('0x1e')](_0xed7c('0x1f'),_0x2b540c+'-'+_0x5ab4cb+'/'+_0x58b1bd)['json'](_0x142c1d);}return null;};}function patchUpdates(_0x22672d){return function(_0x599958){try{jsonpatch[_0xed7c('0x20')](_0x599958,_0x22672d,!![]);}catch(_0x31bc4f){return BPromise[_0xed7c('0x21')](_0x31bc4f);}return _0x599958[_0xed7c('0x22')]();};}function saveUpdates(_0xb87c9b,_0x348a87){return function(_0x21815d){if(_0x21815d){return _0x21815d[_0xed7c('0x23')](_0xb87c9b)[_0xed7c('0x24')](function(_0x59298f){return _0x59298f;});}return null;};}function removeEntity(_0x2004cb,_0x33ba29){return function(_0x8338d4){if(_0x8338d4){return _0x8338d4[_0xed7c('0x25')]()[_0xed7c('0x24')](function(){_0x2004cb[_0xed7c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44f892,_0x59e905){return function(_0x1b85e6){if(!_0x1b85e6){_0x44f892[_0xed7c('0x17')](0x194);}return _0x1b85e6;};}function handleError(_0xa255dc,_0x8cc1ec){_0x8cc1ec=_0x8cc1ec||0x1f4;return function(_0x16554b){logger['error'](_0x16554b['stack']);if(_0x16554b[_0xed7c('0x26')]){delete _0x16554b['name'];}_0xa255dc[_0xed7c('0x18')](_0x8cc1ec)[_0xed7c('0x27')](_0x16554b);};}exports[_0xed7c('0x28')]=function(_0x5691bc,_0x2f3ea9){var _0x53ca1b={},_0x567501={},_0x57ca1f={'count':0x0,'rows':[]};var _0x2cbe3c=_[_0xed7c('0x29')](db[_0xed7c('0x2a')][_0xed7c('0x2b')],function(_0x6a4326){return{'name':_0x6a4326[_0xed7c('0x2c')],'type':_0x6a4326[_0xed7c('0x2d')][_0xed7c('0x2e')]};});_0x567501[_0xed7c('0x2f')]=_[_0xed7c('0x29')](_0x2cbe3c,_0xed7c('0x26'));_0x567501[_0xed7c('0x30')]=_[_0xed7c('0x31')](_0x5691bc['query']);_0x567501[_0xed7c('0x32')]=_['intersection'](_0x567501['model'],_0x567501[_0xed7c('0x30')]);_0x53ca1b[_0xed7c('0x33')]=_[_0xed7c('0x34')](_0x567501[_0xed7c('0x2f')],qs[_0xed7c('0x35')](_0x5691bc[_0xed7c('0x30')][_0xed7c('0x35')]));_0x53ca1b[_0xed7c('0x33')]=_0x53ca1b[_0xed7c('0x33')][_0xed7c('0x36')]?_0x53ca1b[_0xed7c('0x33')]:_0x567501[_0xed7c('0x2f')];if(!_0x5691bc[_0xed7c('0x30')][_0xed7c('0x37')](_0xed7c('0x38'))){_0x53ca1b['limit']=qs[_0xed7c('0x1d')](_0x5691bc[_0xed7c('0x30')][_0xed7c('0x1d')]);_0x53ca1b['offset']=qs[_0xed7c('0x1c')](_0x5691bc[_0xed7c('0x30')][_0xed7c('0x1c')]);}_0x53ca1b[_0xed7c('0x39')]=qs[_0xed7c('0x3a')](_0x5691bc[_0xed7c('0x30')][_0xed7c('0x3a')]);_0x53ca1b[_0xed7c('0x3b')]=qs[_0xed7c('0x32')](_[_0xed7c('0x3c')](_0x5691bc[_0xed7c('0x30')],_0x567501['filters']),_0x2cbe3c);if(_0x5691bc[_0xed7c('0x30')][_0xed7c('0x3d')]){_0x53ca1b[_0xed7c('0x3b')]=_[_0xed7c('0x3e')](_0x53ca1b['where'],{'$or':_['map'](_0x2cbe3c,function(_0x2e847d){if(_0x2e847d[_0xed7c('0x2d')]!=='VIRTUAL'){var _0x61feab={};_0x61feab[_0x2e847d[_0xed7c('0x26')]]={'$like':'%'+_0x5691bc['query'][_0xed7c('0x3d')]+'%'};return _0x61feab;}})});}_0x53ca1b=_['merge']({},_0x53ca1b,_0x5691bc[_0xed7c('0x3f')]);var _0x1307bb={'where':_0x53ca1b['where']};return db[_0xed7c('0x2a')][_0xed7c('0x1b')](_0x1307bb)[_0xed7c('0x24')](function(_0x3f51b9){_0x57ca1f[_0xed7c('0x1b')]=_0x3f51b9;if(_0x5691bc[_0xed7c('0x30')][_0xed7c('0x40')]){_0x53ca1b['include']=[{'all':!![]}];}return db[_0xed7c('0x2a')][_0xed7c('0x41')](_0x53ca1b);})[_0xed7c('0x24')](function(_0xb5e01d){_0x57ca1f[_0xed7c('0x42')]=_0xb5e01d;return _0x57ca1f;})['then'](respondWithFilteredResult(_0x2f3ea9,_0x53ca1b))[_0xed7c('0x43')](handleError(_0x2f3ea9,null));};exports['show']=function(_0x4f9e45,_0x520205){var _0xe24f52={'raw':![],'where':{'id':_0x4f9e45[_0xed7c('0x44')]['id']}},_0x35fa2e={};_0x35fa2e[_0xed7c('0x2f')]=_[_0xed7c('0x31')](db[_0xed7c('0x2a')][_0xed7c('0x2b')]);_0x35fa2e['query']=_[_0xed7c('0x31')](_0x4f9e45[_0xed7c('0x30')]);_0x35fa2e[_0xed7c('0x32')]=_[_0xed7c('0x34')](_0x35fa2e['model'],_0x35fa2e[_0xed7c('0x30')]);_0xe24f52[_0xed7c('0x33')]=_[_0xed7c('0x34')](_0x35fa2e[_0xed7c('0x2f')],qs[_0xed7c('0x35')](_0x4f9e45[_0xed7c('0x30')][_0xed7c('0x35')]));_0xe24f52[_0xed7c('0x33')]=_0xe24f52[_0xed7c('0x33')]['length']?_0xe24f52[_0xed7c('0x33')]:_0x35fa2e['model'];if(_0x4f9e45['query'][_0xed7c('0x40')]){_0xe24f52['include']=[{'all':!![]}];}_0xe24f52=_[_0xed7c('0x3e')]({},_0xe24f52,_0x4f9e45[_0xed7c('0x3f')]);return db[_0xed7c('0x2a')][_0xed7c('0x45')](_0xe24f52)[_0xed7c('0x24')](handleEntityNotFound(_0x520205,null))[_0xed7c('0x24')](respondWithResult(_0x520205,null))[_0xed7c('0x43')](handleError(_0x520205,null));};exports[_0xed7c('0x46')]=function(_0x5c3f95,_0xe07e33){return db['IntegrationReport'][_0xed7c('0x46')](_0x5c3f95[_0xed7c('0x47')],{})[_0xed7c('0x24')](respondWithResult(_0xe07e33,0xc9))['catch'](handleError(_0xe07e33,null));};exports[_0xed7c('0x23')]=function(_0x4c633b,_0x4f2c02){if(_0x4c633b[_0xed7c('0x47')]['id']){delete _0x4c633b[_0xed7c('0x47')]['id'];}return db['IntegrationReport'][_0xed7c('0x45')]({'where':{'id':_0x4c633b[_0xed7c('0x44')]['id']}})[_0xed7c('0x24')](handleEntityNotFound(_0x4f2c02,null))[_0xed7c('0x24')](saveUpdates(_0x4c633b['body'],null))[_0xed7c('0x24')](respondWithResult(_0x4f2c02,null))['catch'](handleError(_0x4f2c02,null));};exports[_0xed7c('0x25')]=function(_0x12fb79,_0x183f5){return db[_0xed7c('0x2a')][_0xed7c('0x45')]({'where':{'id':_0x12fb79[_0xed7c('0x44')]['id']}})[_0xed7c('0x24')](handleEntityNotFound(_0x183f5,null))[_0xed7c('0x24')](removeEntity(_0x183f5,null))[_0xed7c('0x43')](handleError(_0x183f5,null));};exports[_0xed7c('0x48')]=function(_0x278159,_0x4ea151){return db[_0xed7c('0x2a')][_0xed7c('0x48')]()['then'](respondWithResult(_0x4ea151,null))['catch'](handleError(_0x4ea151,null));}; \ No newline at end of file +var _0x4c06=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4c06,0x115));var _0x64c0=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x4c06[_0x47a40b];return _0x19610c;};'use strict';var pdf=require(_0x64c0('0x0'));var emlformat=require(_0x64c0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x64c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x64c0('0x3'));var BPromise=require(_0x64c0('0x4'));var Mustache=require(_0x64c0('0x5'));var util=require(_0x64c0('0x6'));var path=require(_0x64c0('0x7'));var sox=require(_0x64c0('0x8'));var csv=require('to-csv');var ejs=require(_0x64c0('0x9'));var fs=require('fs');var _=require(_0x64c0('0xa'));var squel=require(_0x64c0('0xb'));var crypto=require(_0x64c0('0xc'));var jsforce=require(_0x64c0('0xd'));var deskjs=require(_0x64c0('0xe'));var toCsv=require(_0x64c0('0xf'));var querystring=require(_0x64c0('0x10'));var Papa=require('papaparse');var Redis=require(_0x64c0('0x11'));var authService=require(_0x64c0('0x12'));var qs=require(_0x64c0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64c0('0x14'));var logger=require(_0x64c0('0x15'))(_0x64c0('0x16'));var utils=require(_0x64c0('0x17'));var config=require(_0x64c0('0x18'));var db=require(_0x64c0('0x19'))['db'];function respondWithStatusCode(_0x3b223f,_0x49bc18){_0x49bc18=_0x49bc18||0xcc;return function(_0x47b27e){if(_0x47b27e){return _0x3b223f['sendStatus'](_0x49bc18);}return _0x3b223f[_0x64c0('0x1a')](_0x49bc18)[_0x64c0('0x1b')]();};}function respondWithResult(_0x4a2b96,_0x259559){_0x259559=_0x259559||0xc8;return function(_0x400a72){if(_0x400a72){return _0x4a2b96[_0x64c0('0x1a')](_0x259559)['json'](_0x400a72);}};}function respondWithFilteredResult(_0x58e8dd,_0x25177f){return function(_0x418255){if(_0x418255){var _0x531393=_0x418255[_0x64c0('0x1c')],_0x3797bf=_0x25177f[_0x64c0('0x1d')],_0x296535=_0x25177f[_0x64c0('0x1d')]+_0x25177f[_0x64c0('0x1e')],_0x2cf9b2;if(_0x296535>=_0x531393){_0x296535=_0x531393;_0x2cf9b2=0xc8;}else{_0x2cf9b2=0xce;}_0x58e8dd[_0x64c0('0x1a')](_0x2cf9b2);return _0x58e8dd[_0x64c0('0x1f')](_0x64c0('0x20'),_0x3797bf+'-'+_0x296535+'/'+_0x531393)['json'](_0x418255);}return null;};}function patchUpdates(_0xbfb9eb){return function(_0xd51499){try{jsonpatch[_0x64c0('0x21')](_0xd51499,_0xbfb9eb,!![]);}catch(_0x302f10){return BPromise['reject'](_0x302f10);}return _0xd51499['save']();};}function saveUpdates(_0xc67fbf,_0x1e852a){return function(_0x22e591){if(_0x22e591){return _0x22e591[_0x64c0('0x22')](_0xc67fbf)['then'](function(_0x36db1c){return _0x36db1c;});}return null;};}function removeEntity(_0x20ea46,_0x29f4d1){return function(_0x3483aa){if(_0x3483aa){return _0x3483aa['destroy']()[_0x64c0('0x23')](function(){_0x20ea46[_0x64c0('0x1a')](0xcc)[_0x64c0('0x1b')]();});}};}function handleEntityNotFound(_0x519d5e,_0x210d41){return function(_0x346ea1){if(!_0x346ea1){_0x519d5e[_0x64c0('0x24')](0x194);}return _0x346ea1;};}function handleError(_0x58e8b0,_0x55eadc){_0x55eadc=_0x55eadc||0x1f4;return function(_0x106b5c){logger[_0x64c0('0x25')](_0x106b5c[_0x64c0('0x26')]);if(_0x106b5c[_0x64c0('0x27')]){delete _0x106b5c[_0x64c0('0x27')];}_0x58e8b0[_0x64c0('0x1a')](_0x55eadc)[_0x64c0('0x28')](_0x106b5c);};}exports['index']=function(_0x1ad8ad,_0x330ccc){var _0x22eaa7={},_0x41bad7={},_0xfd30b1={'count':0x0,'rows':[]};var _0x1db8aa=_[_0x64c0('0x29')](db['IntegrationReport'][_0x64c0('0x2a')],function(_0xed09a4){return{'name':_0xed09a4[_0x64c0('0x2b')],'type':_0xed09a4[_0x64c0('0x2c')]['key']};});_0x41bad7[_0x64c0('0x2d')]=_[_0x64c0('0x29')](_0x1db8aa,'name');_0x41bad7[_0x64c0('0x2e')]=_['keys'](_0x1ad8ad['query']);_0x41bad7[_0x64c0('0x2f')]=_[_0x64c0('0x30')](_0x41bad7['model'],_0x41bad7['query']);_0x22eaa7[_0x64c0('0x31')]=_[_0x64c0('0x30')](_0x41bad7[_0x64c0('0x2d')],qs[_0x64c0('0x32')](_0x1ad8ad[_0x64c0('0x2e')][_0x64c0('0x32')]));_0x22eaa7['attributes']=_0x22eaa7['attributes'][_0x64c0('0x33')]?_0x22eaa7[_0x64c0('0x31')]:_0x41bad7[_0x64c0('0x2d')];if(!_0x1ad8ad['query'][_0x64c0('0x34')]('nolimit')){_0x22eaa7['limit']=qs[_0x64c0('0x1e')](_0x1ad8ad[_0x64c0('0x2e')][_0x64c0('0x1e')]);_0x22eaa7[_0x64c0('0x1d')]=qs[_0x64c0('0x1d')](_0x1ad8ad['query'][_0x64c0('0x1d')]);}_0x22eaa7[_0x64c0('0x35')]=qs[_0x64c0('0x36')](_0x1ad8ad[_0x64c0('0x2e')]['sort']);_0x22eaa7[_0x64c0('0x37')]=qs['filters'](_['pick'](_0x1ad8ad[_0x64c0('0x2e')],_0x41bad7[_0x64c0('0x2f')]),_0x1db8aa);if(_0x1ad8ad[_0x64c0('0x2e')][_0x64c0('0x38')]){_0x22eaa7[_0x64c0('0x37')]=_[_0x64c0('0x39')](_0x22eaa7[_0x64c0('0x37')],{'$or':_[_0x64c0('0x29')](_0x1db8aa,function(_0x1d6722){if(_0x1d6722['type']!==_0x64c0('0x3a')){var _0x12ff5a={};_0x12ff5a[_0x1d6722[_0x64c0('0x27')]]={'$like':'%'+_0x1ad8ad['query'][_0x64c0('0x38')]+'%'};return _0x12ff5a;}})});}_0x22eaa7=_[_0x64c0('0x39')]({},_0x22eaa7,_0x1ad8ad[_0x64c0('0x3b')]);var _0x512642={'where':_0x22eaa7[_0x64c0('0x37')]};return db[_0x64c0('0x3c')][_0x64c0('0x1c')](_0x512642)[_0x64c0('0x23')](function(_0x3da64a){_0xfd30b1[_0x64c0('0x1c')]=_0x3da64a;if(_0x1ad8ad[_0x64c0('0x2e')][_0x64c0('0x3d')]){_0x22eaa7[_0x64c0('0x3e')]=[{'all':!![]}];}return db[_0x64c0('0x3c')][_0x64c0('0x3f')](_0x22eaa7);})[_0x64c0('0x23')](function(_0x1ab8ff){_0xfd30b1['rows']=_0x1ab8ff;return _0xfd30b1;})[_0x64c0('0x23')](respondWithFilteredResult(_0x330ccc,_0x22eaa7))[_0x64c0('0x40')](handleError(_0x330ccc,null));};exports[_0x64c0('0x41')]=function(_0x2eb9e1,_0xc84100){var _0x50a3a7={'raw':![],'where':{'id':_0x2eb9e1[_0x64c0('0x42')]['id']}},_0x3620d6={};_0x3620d6[_0x64c0('0x2d')]=_[_0x64c0('0x43')](db[_0x64c0('0x3c')]['rawAttributes']);_0x3620d6['query']=_[_0x64c0('0x43')](_0x2eb9e1['query']);_0x3620d6[_0x64c0('0x2f')]=_[_0x64c0('0x30')](_0x3620d6[_0x64c0('0x2d')],_0x3620d6[_0x64c0('0x2e')]);_0x50a3a7[_0x64c0('0x31')]=_[_0x64c0('0x30')](_0x3620d6[_0x64c0('0x2d')],qs['fields'](_0x2eb9e1[_0x64c0('0x2e')][_0x64c0('0x32')]));_0x50a3a7[_0x64c0('0x31')]=_0x50a3a7[_0x64c0('0x31')]['length']?_0x50a3a7[_0x64c0('0x31')]:_0x3620d6[_0x64c0('0x2d')];if(_0x2eb9e1[_0x64c0('0x2e')][_0x64c0('0x3d')]){_0x50a3a7['include']=[{'all':!![]}];}_0x50a3a7=_[_0x64c0('0x39')]({},_0x50a3a7,_0x2eb9e1[_0x64c0('0x3b')]);return db[_0x64c0('0x3c')][_0x64c0('0x44')](_0x50a3a7)[_0x64c0('0x23')](handleEntityNotFound(_0xc84100,null))['then'](respondWithResult(_0xc84100,null))['catch'](handleError(_0xc84100,null));};exports[_0x64c0('0x45')]=function(_0x563cd1,_0x5997ac){return db[_0x64c0('0x3c')][_0x64c0('0x45')](_0x563cd1[_0x64c0('0x46')],{})[_0x64c0('0x23')](respondWithResult(_0x5997ac,0xc9))[_0x64c0('0x40')](handleError(_0x5997ac,null));};exports['update']=function(_0xe6fc62,_0x53b37c){if(_0xe6fc62[_0x64c0('0x46')]['id']){delete _0xe6fc62['body']['id'];}return db[_0x64c0('0x3c')][_0x64c0('0x44')]({'where':{'id':_0xe6fc62[_0x64c0('0x42')]['id']}})[_0x64c0('0x23')](handleEntityNotFound(_0x53b37c,null))[_0x64c0('0x23')](saveUpdates(_0xe6fc62['body'],null))[_0x64c0('0x23')](respondWithResult(_0x53b37c,null))['catch'](handleError(_0x53b37c,null));};exports[_0x64c0('0x47')]=function(_0x31fbfc,_0x5c1b54){return db['IntegrationReport'][_0x64c0('0x44')]({'where':{'id':_0x31fbfc[_0x64c0('0x42')]['id']}})[_0x64c0('0x23')](handleEntityNotFound(_0x5c1b54,null))[_0x64c0('0x23')](removeEntity(_0x5c1b54,null))[_0x64c0('0x40')](handleError(_0x5c1b54,null));};exports[_0x64c0('0x48')]=function(_0x4b0547,_0x19092e){return db[_0x64c0('0x3c')]['describe']()[_0x64c0('0x23')](respondWithResult(_0x19092e,null))[_0x64c0('0x40')](handleError(_0x19092e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 241ec45..bcede7d 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 _0xbadc=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b6aaf,_0x4aef36){var _0x295fa9=function(_0x4320d3){while(--_0x4320d3){_0x3b6aaf['push'](_0x3b6aaf['shift']());}};_0x295fa9(++_0x4aef36);}(_0xbadc,0x19b));var _0xcbad=function(_0x49f30e,_0xf28439){_0x49f30e=_0x49f30e-0x0;var _0x2cafd5=_0xbadc[_0x49f30e];return _0x2cafd5;};'use strict';var _=require(_0xcbad('0x0'));var util=require(_0xcbad('0x1'));var logger=require(_0xcbad('0x2'))(_0xcbad('0x3'));var moment=require(_0xcbad('0x4'));var BPromise=require(_0xcbad('0x5'));var rp=require(_0xcbad('0x6'));var fs=require('fs');var path=require(_0xcbad('0x7'));var rimraf=require(_0xcbad('0x8'));var config=require('../../config/environment');var attributes=require(_0xcbad('0x9'));module[_0xcbad('0xa')]=function(_0x51fa0f,_0x52a2ce){return _0x51fa0f[_0xcbad('0xb')](_0xcbad('0xc'),attributes,{'tableName':_0xcbad('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1595=['IntegrationReport','report_integration','lodash','util','../../config/logger','bluebird','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x1595,0xca));var _0x5159=function(_0x161e26,_0x28d80b){_0x161e26=_0x161e26-0x0;var _0x40fdd5=_0x1595[_0x161e26];return _0x40fdd5;};'use strict';var _=require(_0x5159('0x0'));var util=require(_0x5159('0x1'));var logger=require(_0x5159('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5159('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5159('0x4'));var attributes=require(_0x5159('0x5'));module[_0x5159('0x6')]=function(_0x27c1ee,_0x232d96){return _0x27c1ee[_0x5159('0x7')](_0x5159('0x8'),attributes,{'tableName':_0x5159('0x9'),'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 da32024..a33a9aa 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 _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2e983c,_0x248029){var _0x58e54f=function(_0x4bd6d4){while(--_0x4bd6d4){_0x2e983c['push'](_0x2e983c['shift']());}};_0x58e54f(++_0x248029);}(_0x757a,0xde));var _0xa757=function(_0x1cec13,_0xed7102){_0x1cec13=_0x1cec13-0x0;var _0x5ada13=_0x757a[_0x1cec13];return _0x5ada13;};'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']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\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);});});} \ No newline at end of file +var _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x44f117,_0x14a212){var _0x57a50f=function(_0xc9c4c0){while(--_0xc9c4c0){_0x44f117['push'](_0x44f117['shift']());}};_0x57a50f(++_0x14a212);}(_0x757a,0xde));var _0xa757=function(_0x3fc592,_0x13c751){_0x3fc592=_0x3fc592-0x0;var _0x41578b=_0x757a[_0x3fc592];return _0x41578b;};'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']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\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);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 6f8acbf..416362b 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 _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x55ca,0x126));var _0xa55c=function(_0x29c934,_0x3c30e2){_0x29c934=_0x29c934-0x0;var _0x4302de=_0x55ca[_0x29c934];return _0x4302de;};'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/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x3bab91,_0x495b57){var _0x4698a0=function(_0x536395){while(--_0x536395){_0x3bab91['push'](_0x3bab91['shift']());}};_0x4698a0(++_0x495b57);}(_0x3e74,0x175));var _0x43e7=function(_0x43dae8,_0x4876df){_0x43dae8=_0x43dae8-0x0;var _0x3bf52a=_0x3e74[_0x43dae8];return _0x3bf52a;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e0fb825..288f981 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 _0x4552=['exports','STRING','sequelize'];(function(_0x504c05,_0x2fe006){var _0x31c04a=function(_0x2cfd18){while(--_0x2cfd18){_0x504c05['push'](_0x504c05['shift']());}};_0x31c04a(++_0x2fe006);}(_0x4552,0x1eb));var _0x2455=function(_0x3f7548,_0x551325){_0x3f7548=_0x3f7548-0x0;var _0x51e5fd=_0x4552[_0x3f7548];return _0x51e5fd;};'use strict';var Sequelize=require(_0x2455('0x0'));module[_0x2455('0x1')]={'name':{'type':Sequelize[_0x2455('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2455('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6fed=['STRING','sequelize','exports'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6fed,0x19c));var _0xd6fe=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6fed[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xd6fe('0x0'));module[_0xd6fe('0x1')]={'name':{'type':Sequelize[_0xd6fe('0x2')]},'description':{'type':Sequelize[_0xd6fe('0x2')]},'interval':{'type':Sequelize[_0xd6fe('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 1fd69e6..95d104d 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 _0xc0a3=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','update','then','destroy','Intervals','UserProfileResource','end','error','index','Interval','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','map','VIRTUAL','filter','findAll','rows','catch','params','includeAll','include','options','find','create','body','user','get','role','userProfileId','autoAssociation','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xc0a3,0x145));var _0x3c0a=function(_0x4a2160,_0x125d90){_0x4a2160=_0x4a2160-0x0;var _0x33a592=_0xc0a3[_0x4a2160];return _0x33a592;};'use strict';var pdf=require(_0x3c0a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3c0a('0x1'));var zipdir=require(_0x3c0a('0x2'));var jsonpatch=require(_0x3c0a('0x3'));var rp=require(_0x3c0a('0x4'));var moment=require(_0x3c0a('0x5'));var BPromise=require(_0x3c0a('0x6'));var Mustache=require(_0x3c0a('0x7'));var util=require('util');var path=require(_0x3c0a('0x8'));var sox=require(_0x3c0a('0x9'));var csv=require('to-csv');var ejs=require(_0x3c0a('0xa'));var fs=require('fs');var _=require(_0x3c0a('0xb'));var squel=require(_0x3c0a('0xc'));var crypto=require(_0x3c0a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3c0a('0xe'));var toCsv=require(_0x3c0a('0xf'));var querystring=require(_0x3c0a('0x10'));var Papa=require(_0x3c0a('0x11'));var Redis=require(_0x3c0a('0x12'));var authService=require(_0x3c0a('0x13'));var qs=require(_0x3c0a('0x14'));var as=require(_0x3c0a('0x15'));var hardwareService=require(_0x3c0a('0x16'));var logger=require(_0x3c0a('0x17'))(_0x3c0a('0x18'));var utils=require('../../config/utils');var config=require(_0x3c0a('0x19'));var db=require(_0x3c0a('0x1a'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x34e096,_0x49c7ca){_0x49c7ca=_0x49c7ca||0xcc;return function(_0x22bec9){if(_0x22bec9){return _0x34e096[_0x3c0a('0x1b')](_0x49c7ca);}return _0x34e096[_0x3c0a('0x1c')](_0x49c7ca)['end']();};}function respondWithResult(_0x4be72f,_0x46c8bf){_0x46c8bf=_0x46c8bf||0xc8;return function(_0x246389){if(_0x246389){return _0x4be72f[_0x3c0a('0x1c')](_0x46c8bf)[_0x3c0a('0x1d')](_0x246389);}};}function respondWithFilteredResult(_0x3b0529,_0x1e5d32){return function(_0x29fde2){if(_0x29fde2){var _0x2e7c11=_0x29fde2[_0x3c0a('0x1e')],_0x1b0386=_0x1e5d32[_0x3c0a('0x1f')],_0x4b172d=_0x1e5d32['offset']+_0x1e5d32['limit'],_0x256668;if(_0x4b172d>=_0x2e7c11){_0x4b172d=_0x2e7c11;_0x256668=0xc8;}else{_0x256668=0xce;}_0x3b0529[_0x3c0a('0x1c')](_0x256668);return _0x3b0529[_0x3c0a('0x20')]('Content-Range',_0x1b0386+'-'+_0x4b172d+'/'+_0x2e7c11)[_0x3c0a('0x1d')](_0x29fde2);}return null;};}function patchUpdates(_0x3883a0){return function(_0x3d437d){try{jsonpatch[_0x3c0a('0x21')](_0x3d437d,_0x3883a0,!![]);}catch(_0x3d25e4){return BPromise[_0x3c0a('0x22')](_0x3d25e4);}return _0x3d437d['save']();};}function saveUpdates(_0x38e023,_0x178922){return function(_0x1123e8){if(_0x1123e8){return _0x1123e8[_0x3c0a('0x23')](_0x38e023)[_0x3c0a('0x24')](function(_0x53d730){return _0x53d730;});}return null;};}function removeEntity(_0x1a805a,_0x491e96){return function(_0x236fda){if(_0x236fda){return _0x236fda[_0x3c0a('0x25')]()[_0x3c0a('0x24')](function(){var _0xb38ce0=_0x236fda['get']({'plain':!![]});var _0x17bd3b=_0x3c0a('0x26');return db[_0x3c0a('0x27')][_0x3c0a('0x25')]({'where':{'type':_0x17bd3b,'resourceId':_0xb38ce0['id']}})[_0x3c0a('0x24')](function(){return _0x236fda;});})[_0x3c0a('0x24')](function(){_0x1a805a[_0x3c0a('0x1c')](0xcc)[_0x3c0a('0x28')]();});}};}function handleEntityNotFound(_0x4f554a,_0x3ae2bd){return function(_0x5fbf5){if(!_0x5fbf5){_0x4f554a[_0x3c0a('0x1b')](0x194);}return _0x5fbf5;};}function handleError(_0x1930a5,_0x1e009b){_0x1e009b=_0x1e009b||0x1f4;return function(_0x37877b){logger[_0x3c0a('0x29')](_0x37877b['stack']);if(_0x37877b['name']){delete _0x37877b['name'];}_0x1930a5[_0x3c0a('0x1c')](_0x1e009b)['send'](_0x37877b);};}exports[_0x3c0a('0x2a')]=function(_0x52c293,_0x190253){var _0x14dd7b={},_0x2f8a53={},_0xcbb55={'count':0x0,'rows':[]};var _0x4af7ff=_['map'](db[_0x3c0a('0x2b')][_0x3c0a('0x2c')],function(_0x1c35bc){return{'name':_0x1c35bc[_0x3c0a('0x2d')],'type':_0x1c35bc[_0x3c0a('0x2e')]['key']};});_0x2f8a53[_0x3c0a('0x2f')]=_['map'](_0x4af7ff,_0x3c0a('0x30'));_0x2f8a53[_0x3c0a('0x31')]=_[_0x3c0a('0x32')](_0x52c293[_0x3c0a('0x31')]);_0x2f8a53[_0x3c0a('0x33')]=_[_0x3c0a('0x34')](_0x2f8a53[_0x3c0a('0x2f')],_0x2f8a53[_0x3c0a('0x31')]);_0x14dd7b[_0x3c0a('0x35')]=_[_0x3c0a('0x34')](_0x2f8a53[_0x3c0a('0x2f')],qs[_0x3c0a('0x36')](_0x52c293[_0x3c0a('0x31')]['fields']));_0x14dd7b['attributes']=_0x14dd7b['attributes'][_0x3c0a('0x37')]?_0x14dd7b[_0x3c0a('0x35')]:_0x2f8a53[_0x3c0a('0x2f')];if(!_0x52c293[_0x3c0a('0x31')][_0x3c0a('0x38')](_0x3c0a('0x39'))){_0x14dd7b[_0x3c0a('0x3a')]=qs[_0x3c0a('0x3a')](_0x52c293[_0x3c0a('0x31')][_0x3c0a('0x3a')]);_0x14dd7b[_0x3c0a('0x1f')]=qs['offset'](_0x52c293['query'][_0x3c0a('0x1f')]);}_0x14dd7b[_0x3c0a('0x3b')]=qs[_0x3c0a('0x3c')](_0x52c293[_0x3c0a('0x31')]['sort']);_0x14dd7b[_0x3c0a('0x3d')]=qs[_0x3c0a('0x33')](_['pick'](_0x52c293['query'],_0x2f8a53[_0x3c0a('0x33')]),_0x4af7ff);if(_0x52c293['query']['filter']){_0x14dd7b[_0x3c0a('0x3d')]=_[_0x3c0a('0x3e')](_0x14dd7b['where'],{'$or':_[_0x3c0a('0x3f')](_0x4af7ff,function(_0x3d2fb2){if(_0x3d2fb2[_0x3c0a('0x2e')]!==_0x3c0a('0x40')){var _0x581d88={};_0x581d88[_0x3d2fb2[_0x3c0a('0x30')]]={'$like':'%'+_0x52c293['query'][_0x3c0a('0x41')]+'%'};return _0x581d88;}})});}_0x14dd7b=_[_0x3c0a('0x3e')]({},_0x14dd7b,_0x52c293['options']);var _0x5f3df2={'where':_0x14dd7b['where']};return db[_0x3c0a('0x2b')][_0x3c0a('0x1e')](_0x5f3df2)[_0x3c0a('0x24')](function(_0x4263e6){_0xcbb55[_0x3c0a('0x1e')]=_0x4263e6;if(_0x52c293[_0x3c0a('0x31')]['includeAll']){_0x14dd7b['include']=[{'all':!![]}];}return db[_0x3c0a('0x2b')][_0x3c0a('0x42')](_0x14dd7b);})[_0x3c0a('0x24')](function(_0x271c4a){_0xcbb55[_0x3c0a('0x43')]=_0x271c4a;return _0xcbb55;})['then'](respondWithFilteredResult(_0x190253,_0x14dd7b))[_0x3c0a('0x44')](handleError(_0x190253,null));};exports['show']=function(_0x21ca0c,_0x4248c9){var _0x475a4b={'raw':!![],'where':{'id':_0x21ca0c[_0x3c0a('0x45')]['id']}},_0x52d0be={};_0x52d0be['model']=_[_0x3c0a('0x32')](db['Interval']['rawAttributes']);_0x52d0be['query']=_[_0x3c0a('0x32')](_0x21ca0c[_0x3c0a('0x31')]);_0x52d0be[_0x3c0a('0x33')]=_[_0x3c0a('0x34')](_0x52d0be[_0x3c0a('0x2f')],_0x52d0be[_0x3c0a('0x31')]);_0x475a4b['attributes']=_[_0x3c0a('0x34')](_0x52d0be[_0x3c0a('0x2f')],qs[_0x3c0a('0x36')](_0x21ca0c[_0x3c0a('0x31')][_0x3c0a('0x36')]));_0x475a4b[_0x3c0a('0x35')]=_0x475a4b['attributes'][_0x3c0a('0x37')]?_0x475a4b['attributes']:_0x52d0be['model'];if(_0x21ca0c[_0x3c0a('0x31')][_0x3c0a('0x46')]){_0x475a4b[_0x3c0a('0x47')]=[{'all':!![]}];}_0x475a4b=_[_0x3c0a('0x3e')]({},_0x475a4b,_0x21ca0c[_0x3c0a('0x48')]);return db[_0x3c0a('0x2b')][_0x3c0a('0x49')](_0x475a4b)[_0x3c0a('0x24')](handleEntityNotFound(_0x4248c9,null))[_0x3c0a('0x24')](respondWithResult(_0x4248c9,null))[_0x3c0a('0x44')](handleError(_0x4248c9,null));};exports['create']=function(_0x4cbabb,_0x13e1d1){return db['Interval'][_0x3c0a('0x4a')](_0x4cbabb[_0x3c0a('0x4b')],{})[_0x3c0a('0x24')](function(_0x3db292){var _0x451b91=_0x4cbabb[_0x3c0a('0x4c')][_0x3c0a('0x4d')]({'plain':!![]});if(!_0x451b91)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x451b91[_0x3c0a('0x4e')]===_0x3c0a('0x4c')){var _0x1bff8e=_0x3db292[_0x3c0a('0x4d')]({'plain':!![]});var _0x13420c=_0x3c0a('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x13420c,'userProfileId':_0x451b91[_0x3c0a('0x4f')]},'raw':!![]})[_0x3c0a('0x24')](function(_0xe33353){if(_0xe33353&&_0xe33353[_0x3c0a('0x50')]===0x0){return db[_0x3c0a('0x27')]['create']({'name':_0x1bff8e['name'],'resourceId':_0x1bff8e['id'],'type':_0xe33353[_0x3c0a('0x30')],'sectionId':_0xe33353['id']},{})[_0x3c0a('0x24')](function(){return _0x3db292;});}else{return _0x3db292;}})[_0x3c0a('0x44')](function(_0x4e9ddf){logger[_0x3c0a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e9ddf);throw _0x4e9ddf;});}return _0x3db292;})['then'](respondWithResult(_0x13e1d1,0xc9))[_0x3c0a('0x44')](handleError(_0x13e1d1,null));};exports[_0x3c0a('0x23')]=function(_0x5d3391,_0x441a2e){if(_0x5d3391[_0x3c0a('0x4b')]['id']){delete _0x5d3391['body']['id'];}return db[_0x3c0a('0x2b')][_0x3c0a('0x49')]({'where':{'id':_0x5d3391[_0x3c0a('0x45')]['id']}})['then'](handleEntityNotFound(_0x441a2e,null))[_0x3c0a('0x24')](saveUpdates(_0x5d3391[_0x3c0a('0x4b')],null))[_0x3c0a('0x24')](respondWithResult(_0x441a2e,null))[_0x3c0a('0x44')](handleError(_0x441a2e,null));};exports[_0x3c0a('0x25')]=function(_0x5cacb2,_0x18cf3d){return db[_0x3c0a('0x2b')][_0x3c0a('0x49')]({'where':{'id':_0x5cacb2[_0x3c0a('0x45')]['id']}})['then'](handleEntityNotFound(_0x18cf3d,null))[_0x3c0a('0x24')](removeEntity(_0x18cf3d,null))['catch'](handleError(_0x18cf3d,null));};exports[_0x3c0a('0x51')]=function(_0x4718f3,_0x1fe42d,_0x22e19b){if(_0x4718f3[_0x3c0a('0x4b')]['id']){delete _0x4718f3[_0x3c0a('0x4b')]['id'];}return db[_0x3c0a('0x2b')][_0x3c0a('0x49')]({'where':{'id':_0x4718f3['params']['id']}})[_0x3c0a('0x24')](handleEntityNotFound(_0x1fe42d,null))[_0x3c0a('0x24')](function(_0x406cac){if(_0x406cac){_0x4718f3[_0x3c0a('0x4b')][_0x3c0a('0x52')]=_0x406cac['id'];return db[_0x3c0a('0x2b')][_0x3c0a('0x4a')](_0x4718f3[_0x3c0a('0x4b')]);}})[_0x3c0a('0x24')](respondWithResult(_0x1fe42d,null))[_0x3c0a('0x44')](handleError(_0x1fe42d,null));};exports[_0x3c0a('0x53')]=function(_0x18cd7f,_0x55f92d,_0x522457){var _0x37e220={};var _0x4825cf={};var _0x31b9a8;var _0x1d793a;return db['Interval'][_0x3c0a('0x54')]({'where':{'id':_0x18cd7f[_0x3c0a('0x45')]['id']}})[_0x3c0a('0x24')](handleEntityNotFound(_0x55f92d,null))[_0x3c0a('0x24')](function(_0x574dca){if(_0x574dca){_0x31b9a8=_0x574dca;_0x4825cf[_0x3c0a('0x2f')]=_[_0x3c0a('0x32')](db[_0x3c0a('0x2b')]['rawAttributes']);_0x4825cf['query']=_[_0x3c0a('0x32')](_0x18cd7f[_0x3c0a('0x31')]);_0x4825cf[_0x3c0a('0x33')]=_[_0x3c0a('0x34')](_0x4825cf[_0x3c0a('0x2f')],_0x4825cf[_0x3c0a('0x31')]);_0x37e220[_0x3c0a('0x35')]=_[_0x3c0a('0x34')](_0x4825cf['model'],qs[_0x3c0a('0x36')](_0x18cd7f['query'][_0x3c0a('0x36')]));_0x37e220['attributes']=_0x37e220[_0x3c0a('0x35')][_0x3c0a('0x37')]?_0x37e220['attributes']:_0x4825cf[_0x3c0a('0x2f')];_0x37e220[_0x3c0a('0x3b')]=qs[_0x3c0a('0x3c')](_0x18cd7f['query'][_0x3c0a('0x3c')]);_0x37e220['where']=qs['filters'](_['pick'](_0x18cd7f[_0x3c0a('0x31')],_0x4825cf[_0x3c0a('0x33')]));if(_0x18cd7f[_0x3c0a('0x31')][_0x3c0a('0x41')]){_0x37e220[_0x3c0a('0x3d')]=_[_0x3c0a('0x3e')](_0x37e220['where'],{'$or':_[_0x3c0a('0x3f')](_0x37e220[_0x3c0a('0x35')],function(_0x232694){var _0x5109c0={};_0x5109c0[_0x232694]={'$like':'%'+_0x18cd7f[_0x3c0a('0x31')][_0x3c0a('0x41')]+'%'};return _0x5109c0;})});}_0x37e220=_[_0x3c0a('0x3e')]({},_0x37e220,_0x18cd7f[_0x3c0a('0x48')]);return _0x31b9a8['getIntervals'](_0x37e220);}})[_0x3c0a('0x24')](function(_0xd1619e){if(_0xd1619e){_0x1d793a=_0xd1619e['length'];if(!_0x18cd7f['query']['hasOwnProperty'](_0x3c0a('0x39'))){_0x37e220[_0x3c0a('0x3a')]=qs[_0x3c0a('0x3a')](_0x18cd7f[_0x3c0a('0x31')]['limit']);_0x37e220[_0x3c0a('0x1f')]=qs[_0x3c0a('0x1f')](_0x18cd7f['query']['offset']);}return _0x31b9a8[_0x3c0a('0x53')](_0x37e220);}})[_0x3c0a('0x24')](function(_0x117eb6){if(_0x117eb6){return _0x117eb6?{'count':_0x1d793a,'rows':_0x117eb6}:null;}})[_0x3c0a('0x24')](respondWithResult(_0x55f92d,null))[_0x3c0a('0x44')](handleError(_0x55f92d,null));};exports[_0x3c0a('0x55')]=function(_0x348816,_0x19b780,_0x169e3b){return db[_0x3c0a('0x2b')]['findOne']({'where':{'id':_0x348816[_0x3c0a('0x45')]['id']}})[_0x3c0a('0x24')](handleEntityNotFound(_0x19b780,null))[_0x3c0a('0x24')](function(_0x23d3dd){if(_0x23d3dd){return db[_0x3c0a('0x56')]['transaction'](function(_0x405191){return db[_0x3c0a('0x2b')][_0x3c0a('0x25')]({'where':{'IntervalId':_0x348816[_0x3c0a('0x45')]['id']},'transaction':_0x405191})[_0x3c0a('0x24')](function(_0x2521e9){var _0x4cff2d=_[_0x3c0a('0x3f')](_0x348816[_0x3c0a('0x4b')],function(_0x3a9f6b){delete _0x3a9f6b['id'];_0x3a9f6b[_0x3c0a('0x52')]=_0x348816[_0x3c0a('0x45')]['id'];return _0x3a9f6b;});return db[_0x3c0a('0x2b')]['bulkCreate'](_0x4cff2d,{'transaction':_0x405191});});})['then'](function(){return db['Interval'][_0x3c0a('0x42')]({'where':{'IntervalId':_0x348816['params']['id']}});});}})[_0x3c0a('0x24')](respondWithResult(_0x19b780,null))[_0x3c0a('0x44')](handleError(_0x19b780,null));}; \ No newline at end of file +var _0xbfa2=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','where','merge','filter','Interval','include','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','addInterval','IntervalId','findOne','getIntervals','sequelize','bulkCreate','findAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x183ee0,_0x48c88d){var _0x4359c3=function(_0x446393){while(--_0x446393){_0x183ee0['push'](_0x183ee0['shift']());}};_0x4359c3(++_0x48c88d);}(_0xbfa2,0xf1));var _0x2bfa=function(_0x58073e,_0x94249d){_0x58073e=_0x58073e-0x0;var _0x177e47=_0xbfa2[_0x58073e];return _0x177e47;};'use strict';var pdf=require(_0x2bfa('0x0'));var emlformat=require(_0x2bfa('0x1'));var rimraf=require(_0x2bfa('0x2'));var zipdir=require(_0x2bfa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2bfa('0x4'));var moment=require(_0x2bfa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2bfa('0x6'));var util=require(_0x2bfa('0x7'));var path=require(_0x2bfa('0x8'));var sox=require(_0x2bfa('0x9'));var csv=require(_0x2bfa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2bfa('0xb'));var squel=require(_0x2bfa('0xc'));var crypto=require(_0x2bfa('0xd'));var jsforce=require(_0x2bfa('0xe'));var deskjs=require(_0x2bfa('0xf'));var toCsv=require(_0x2bfa('0xa'));var querystring=require(_0x2bfa('0x10'));var Papa=require('papaparse');var Redis=require(_0x2bfa('0x11'));var authService=require(_0x2bfa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2bfa('0x13'));var hardwareService=require(_0x2bfa('0x14'));var logger=require(_0x2bfa('0x15'))(_0x2bfa('0x16'));var utils=require(_0x2bfa('0x17'));var config=require(_0x2bfa('0x18'));var db=require(_0x2bfa('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x39d8d5,_0x3e4b45){_0x3e4b45=_0x3e4b45||0xcc;return function(_0x3eb0c2){if(_0x3eb0c2){return _0x39d8d5[_0x2bfa('0x1a')](_0x3e4b45);}return _0x39d8d5[_0x2bfa('0x1b')](_0x3e4b45)[_0x2bfa('0x1c')]();};}function respondWithResult(_0x54d27c,_0x5174e1){_0x5174e1=_0x5174e1||0xc8;return function(_0x5d616c){if(_0x5d616c){return _0x54d27c[_0x2bfa('0x1b')](_0x5174e1)[_0x2bfa('0x1d')](_0x5d616c);}};}function respondWithFilteredResult(_0x15864e,_0x60203){return function(_0x262e05){if(_0x262e05){var _0x2938fe=_0x262e05[_0x2bfa('0x1e')],_0xfab820=_0x60203[_0x2bfa('0x1f')],_0x2f85cb=_0x60203[_0x2bfa('0x1f')]+_0x60203['limit'],_0x18adeb;if(_0x2f85cb>=_0x2938fe){_0x2f85cb=_0x2938fe;_0x18adeb=0xc8;}else{_0x18adeb=0xce;}_0x15864e[_0x2bfa('0x1b')](_0x18adeb);return _0x15864e['set'](_0x2bfa('0x20'),_0xfab820+'-'+_0x2f85cb+'/'+_0x2938fe)[_0x2bfa('0x1d')](_0x262e05);}return null;};}function patchUpdates(_0x17f31f){return function(_0x164d20){try{jsonpatch[_0x2bfa('0x21')](_0x164d20,_0x17f31f,!![]);}catch(_0x96de62){return BPromise['reject'](_0x96de62);}return _0x164d20[_0x2bfa('0x22')]();};}function saveUpdates(_0x146e58,_0x374bba){return function(_0x2c565e){if(_0x2c565e){return _0x2c565e['update'](_0x146e58)[_0x2bfa('0x23')](function(_0x540833){return _0x540833;});}return null;};}function removeEntity(_0x46a912,_0x39536b){return function(_0xafa6a9){if(_0xafa6a9){return _0xafa6a9[_0x2bfa('0x24')]()['then'](function(){var _0x588451=_0xafa6a9[_0x2bfa('0x25')]({'plain':!![]});var _0x344764='Intervals';return db[_0x2bfa('0x26')]['destroy']({'where':{'type':_0x344764,'resourceId':_0x588451['id']}})[_0x2bfa('0x23')](function(){return _0xafa6a9;});})[_0x2bfa('0x23')](function(){_0x46a912[_0x2bfa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6006ad,_0x5b0277){return function(_0x573fc3){if(!_0x573fc3){_0x6006ad[_0x2bfa('0x1a')](0x194);}return _0x573fc3;};}function handleError(_0x3dfaa0,_0x3b2b9b){_0x3b2b9b=_0x3b2b9b||0x1f4;return function(_0xd30fb7){logger[_0x2bfa('0x27')](_0xd30fb7[_0x2bfa('0x28')]);if(_0xd30fb7['name']){delete _0xd30fb7[_0x2bfa('0x29')];}_0x3dfaa0[_0x2bfa('0x1b')](_0x3b2b9b)[_0x2bfa('0x2a')](_0xd30fb7);};}exports[_0x2bfa('0x2b')]=function(_0x2c546a,_0x5e0efa){var _0x31c6b6={},_0x521dab={},_0x30aa67={'count':0x0,'rows':[]};var _0x3de999=_[_0x2bfa('0x2c')](db['Interval'][_0x2bfa('0x2d')],function(_0x439eca){return{'name':_0x439eca[_0x2bfa('0x2e')],'type':_0x439eca[_0x2bfa('0x2f')]['key']};});_0x521dab[_0x2bfa('0x30')]=_['map'](_0x3de999,_0x2bfa('0x29'));_0x521dab['query']=_[_0x2bfa('0x31')](_0x2c546a[_0x2bfa('0x32')]);_0x521dab['filters']=_['intersection'](_0x521dab[_0x2bfa('0x30')],_0x521dab['query']);_0x31c6b6[_0x2bfa('0x33')]=_[_0x2bfa('0x34')](_0x521dab[_0x2bfa('0x30')],qs[_0x2bfa('0x35')](_0x2c546a[_0x2bfa('0x32')][_0x2bfa('0x35')]));_0x31c6b6[_0x2bfa('0x33')]=_0x31c6b6['attributes'][_0x2bfa('0x36')]?_0x31c6b6[_0x2bfa('0x33')]:_0x521dab['model'];if(!_0x2c546a[_0x2bfa('0x32')][_0x2bfa('0x37')](_0x2bfa('0x38'))){_0x31c6b6[_0x2bfa('0x39')]=qs[_0x2bfa('0x39')](_0x2c546a[_0x2bfa('0x32')][_0x2bfa('0x39')]);_0x31c6b6[_0x2bfa('0x1f')]=qs[_0x2bfa('0x1f')](_0x2c546a[_0x2bfa('0x32')][_0x2bfa('0x1f')]);}_0x31c6b6['order']=qs[_0x2bfa('0x3a')](_0x2c546a[_0x2bfa('0x32')][_0x2bfa('0x3a')]);_0x31c6b6['where']=qs[_0x2bfa('0x3b')](_[_0x2bfa('0x3c')](_0x2c546a[_0x2bfa('0x32')],_0x521dab[_0x2bfa('0x3b')]),_0x3de999);if(_0x2c546a['query']['filter']){_0x31c6b6[_0x2bfa('0x3d')]=_[_0x2bfa('0x3e')](_0x31c6b6[_0x2bfa('0x3d')],{'$or':_[_0x2bfa('0x2c')](_0x3de999,function(_0x361939){if(_0x361939[_0x2bfa('0x2f')]!=='VIRTUAL'){var _0x203922={};_0x203922[_0x361939[_0x2bfa('0x29')]]={'$like':'%'+_0x2c546a['query'][_0x2bfa('0x3f')]+'%'};return _0x203922;}})});}_0x31c6b6=_[_0x2bfa('0x3e')]({},_0x31c6b6,_0x2c546a['options']);var _0x407407={'where':_0x31c6b6[_0x2bfa('0x3d')]};return db[_0x2bfa('0x40')][_0x2bfa('0x1e')](_0x407407)[_0x2bfa('0x23')](function(_0x561dec){_0x30aa67[_0x2bfa('0x1e')]=_0x561dec;if(_0x2c546a[_0x2bfa('0x32')]['includeAll']){_0x31c6b6[_0x2bfa('0x41')]=[{'all':!![]}];}return db[_0x2bfa('0x40')]['findAll'](_0x31c6b6);})['then'](function(_0x15db7b){_0x30aa67['rows']=_0x15db7b;return _0x30aa67;})[_0x2bfa('0x23')](respondWithFilteredResult(_0x5e0efa,_0x31c6b6))[_0x2bfa('0x42')](handleError(_0x5e0efa,null));};exports[_0x2bfa('0x43')]=function(_0x3efe01,_0x1bdca5){var _0x2130f8={'raw':!![],'where':{'id':_0x3efe01[_0x2bfa('0x44')]['id']}},_0x2d7bf7={};_0x2d7bf7['model']=_[_0x2bfa('0x31')](db[_0x2bfa('0x40')][_0x2bfa('0x2d')]);_0x2d7bf7[_0x2bfa('0x32')]=_['keys'](_0x3efe01['query']);_0x2d7bf7['filters']=_['intersection'](_0x2d7bf7['model'],_0x2d7bf7[_0x2bfa('0x32')]);_0x2130f8['attributes']=_[_0x2bfa('0x34')](_0x2d7bf7[_0x2bfa('0x30')],qs[_0x2bfa('0x35')](_0x3efe01[_0x2bfa('0x32')][_0x2bfa('0x35')]));_0x2130f8[_0x2bfa('0x33')]=_0x2130f8[_0x2bfa('0x33')]['length']?_0x2130f8[_0x2bfa('0x33')]:_0x2d7bf7['model'];if(_0x3efe01[_0x2bfa('0x32')][_0x2bfa('0x45')]){_0x2130f8[_0x2bfa('0x41')]=[{'all':!![]}];}_0x2130f8=_[_0x2bfa('0x3e')]({},_0x2130f8,_0x3efe01[_0x2bfa('0x46')]);return db[_0x2bfa('0x40')][_0x2bfa('0x47')](_0x2130f8)['then'](handleEntityNotFound(_0x1bdca5,null))[_0x2bfa('0x23')](respondWithResult(_0x1bdca5,null))[_0x2bfa('0x42')](handleError(_0x1bdca5,null));};exports[_0x2bfa('0x48')]=function(_0x3de068,_0x598b88){return db[_0x2bfa('0x40')][_0x2bfa('0x48')](_0x3de068[_0x2bfa('0x49')],{})[_0x2bfa('0x23')](function(_0x57c070){var _0x306a26=_0x3de068[_0x2bfa('0x4a')][_0x2bfa('0x25')]({'plain':!![]});if(!_0x306a26)throw new Error(_0x2bfa('0x4b'));if(_0x306a26[_0x2bfa('0x4c')]===_0x2bfa('0x4a')){var _0x4d05f6=_0x57c070[_0x2bfa('0x25')]({'plain':!![]});var _0x30c700=_0x2bfa('0x4d');return db[_0x2bfa('0x4e')]['find']({'where':{'name':_0x30c700,'userProfileId':_0x306a26[_0x2bfa('0x4f')]},'raw':!![]})[_0x2bfa('0x23')](function(_0x5f2760){if(_0x5f2760&&_0x5f2760[_0x2bfa('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x4d05f6[_0x2bfa('0x29')],'resourceId':_0x4d05f6['id'],'type':_0x5f2760['name'],'sectionId':_0x5f2760['id']},{})[_0x2bfa('0x23')](function(){return _0x57c070;});}else{return _0x57c070;}})['catch'](function(_0x4b469b){logger[_0x2bfa('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b469b);throw _0x4b469b;});}return _0x57c070;})[_0x2bfa('0x23')](respondWithResult(_0x598b88,0xc9))['catch'](handleError(_0x598b88,null));};exports['update']=function(_0x25f79b,_0x4e195f){if(_0x25f79b[_0x2bfa('0x49')]['id']){delete _0x25f79b[_0x2bfa('0x49')]['id'];}return db['Interval']['find']({'where':{'id':_0x25f79b[_0x2bfa('0x44')]['id']}})[_0x2bfa('0x23')](handleEntityNotFound(_0x4e195f,null))[_0x2bfa('0x23')](saveUpdates(_0x25f79b[_0x2bfa('0x49')],null))[_0x2bfa('0x23')](respondWithResult(_0x4e195f,null))[_0x2bfa('0x42')](handleError(_0x4e195f,null));};exports['destroy']=function(_0x1b796a,_0x751b04){return db[_0x2bfa('0x40')]['find']({'where':{'id':_0x1b796a['params']['id']}})[_0x2bfa('0x23')](handleEntityNotFound(_0x751b04,null))[_0x2bfa('0x23')](removeEntity(_0x751b04,null))[_0x2bfa('0x42')](handleError(_0x751b04,null));};exports[_0x2bfa('0x51')]=function(_0x2a1a01,_0x5f4db5,_0x283464){if(_0x2a1a01[_0x2bfa('0x49')]['id']){delete _0x2a1a01[_0x2bfa('0x49')]['id'];}return db[_0x2bfa('0x40')][_0x2bfa('0x47')]({'where':{'id':_0x2a1a01['params']['id']}})[_0x2bfa('0x23')](handleEntityNotFound(_0x5f4db5,null))[_0x2bfa('0x23')](function(_0x4acfee){if(_0x4acfee){_0x2a1a01[_0x2bfa('0x49')][_0x2bfa('0x52')]=_0x4acfee['id'];return db['Interval'][_0x2bfa('0x48')](_0x2a1a01[_0x2bfa('0x49')]);}})[_0x2bfa('0x23')](respondWithResult(_0x5f4db5,null))[_0x2bfa('0x42')](handleError(_0x5f4db5,null));};exports['getIntervals']=function(_0x2c2332,_0x36c738,_0x56a014){var _0x583021={};var _0x3328e4={};var _0x2173d6;var _0x376acb;return db[_0x2bfa('0x40')][_0x2bfa('0x53')]({'where':{'id':_0x2c2332[_0x2bfa('0x44')]['id']}})[_0x2bfa('0x23')](handleEntityNotFound(_0x36c738,null))[_0x2bfa('0x23')](function(_0x8462f6){if(_0x8462f6){_0x2173d6=_0x8462f6;_0x3328e4[_0x2bfa('0x30')]=_[_0x2bfa('0x31')](db[_0x2bfa('0x40')][_0x2bfa('0x2d')]);_0x3328e4[_0x2bfa('0x32')]=_[_0x2bfa('0x31')](_0x2c2332[_0x2bfa('0x32')]);_0x3328e4['filters']=_[_0x2bfa('0x34')](_0x3328e4[_0x2bfa('0x30')],_0x3328e4[_0x2bfa('0x32')]);_0x583021[_0x2bfa('0x33')]=_[_0x2bfa('0x34')](_0x3328e4['model'],qs[_0x2bfa('0x35')](_0x2c2332[_0x2bfa('0x32')][_0x2bfa('0x35')]));_0x583021['attributes']=_0x583021[_0x2bfa('0x33')]['length']?_0x583021['attributes']:_0x3328e4['model'];_0x583021['order']=qs[_0x2bfa('0x3a')](_0x2c2332[_0x2bfa('0x32')][_0x2bfa('0x3a')]);_0x583021[_0x2bfa('0x3d')]=qs[_0x2bfa('0x3b')](_[_0x2bfa('0x3c')](_0x2c2332[_0x2bfa('0x32')],_0x3328e4['filters']));if(_0x2c2332[_0x2bfa('0x32')][_0x2bfa('0x3f')]){_0x583021['where']=_[_0x2bfa('0x3e')](_0x583021['where'],{'$or':_[_0x2bfa('0x2c')](_0x583021[_0x2bfa('0x33')],function(_0x3c33b7){var _0x732ae5={};_0x732ae5[_0x3c33b7]={'$like':'%'+_0x2c2332[_0x2bfa('0x32')][_0x2bfa('0x3f')]+'%'};return _0x732ae5;})});}_0x583021=_['merge']({},_0x583021,_0x2c2332['options']);return _0x2173d6[_0x2bfa('0x54')](_0x583021);}})[_0x2bfa('0x23')](function(_0x4cc4e3){if(_0x4cc4e3){_0x376acb=_0x4cc4e3['length'];if(!_0x2c2332[_0x2bfa('0x32')]['hasOwnProperty']('nolimit')){_0x583021[_0x2bfa('0x39')]=qs[_0x2bfa('0x39')](_0x2c2332['query'][_0x2bfa('0x39')]);_0x583021[_0x2bfa('0x1f')]=qs['offset'](_0x2c2332[_0x2bfa('0x32')][_0x2bfa('0x1f')]);}return _0x2173d6['getIntervals'](_0x583021);}})[_0x2bfa('0x23')](function(_0x113de5){if(_0x113de5){return _0x113de5?{'count':_0x376acb,'rows':_0x113de5}:null;}})['then'](respondWithResult(_0x36c738,null))[_0x2bfa('0x42')](handleError(_0x36c738,null));};exports['addIntervals']=function(_0x1f9651,_0x3bc9ef,_0x17451a){return db[_0x2bfa('0x40')][_0x2bfa('0x53')]({'where':{'id':_0x1f9651[_0x2bfa('0x44')]['id']}})[_0x2bfa('0x23')](handleEntityNotFound(_0x3bc9ef,null))[_0x2bfa('0x23')](function(_0x35ca33){if(_0x35ca33){return db[_0x2bfa('0x55')]['transaction'](function(_0x24b15e){return db['Interval'][_0x2bfa('0x24')]({'where':{'IntervalId':_0x1f9651[_0x2bfa('0x44')]['id']},'transaction':_0x24b15e})['then'](function(_0x343cc1){var _0xe63fd3=_[_0x2bfa('0x2c')](_0x1f9651[_0x2bfa('0x49')],function(_0x103932){delete _0x103932['id'];_0x103932[_0x2bfa('0x52')]=_0x1f9651[_0x2bfa('0x44')]['id'];return _0x103932;});return db['Interval'][_0x2bfa('0x56')](_0xe63fd3,{'transaction':_0x24b15e});});})['then'](function(){return db[_0x2bfa('0x40')][_0x2bfa('0x57')]({'where':{'IntervalId':_0x1f9651[_0x2bfa('0x44')]['id']}});});}})[_0x2bfa('0x23')](respondWithResult(_0x3bc9ef,null))[_0x2bfa('0x42')](handleError(_0x3bc9ef,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 20f5f45..80fc3a8 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 _0x9bde=['define','Interval','tools_intervals','rewrite','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x189500,_0x1fccd8){var _0x375ab9=function(_0x8fcb77){while(--_0x8fcb77){_0x189500['push'](_0x189500['shift']());}};_0x375ab9(++_0x1fccd8);}(_0x9bde,0xe1));var _0xe9bd=function(_0x12f277,_0x20865e){_0x12f277=_0x12f277-0x0;var _0x4571bd=_0x9bde[_0x12f277];return _0x4571bd;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));var extensions=require(_0xe9bd('0x8'));module['exports']=function(_0x4763e9,_0x5f18fe){return _0x4763e9[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ef9e3,_0x29bc2b){extensions[_0xe9bd('0xc')](_0x4763e9,_0x3ef9e3);},'afterBulkCreate':function(_0x439abc,_0x45c7ba,_0x581602){_0x581602();extensions['rewrite'](_0x4763e9,_0x439abc[0x0]);},'afterUpdate':function(_0x3c8e95,_0x145521){extensions[_0xe9bd('0xc')](_0x4763e9,_0x3c8e95);},'afterDestroy':function(_0x581ab9,_0x12c96e){extensions[_0xe9bd('0xc')](_0x4763e9,_0x581ab9);}}});}; \ No newline at end of file +var _0xf6e8=['api','moment','bluebird','request-promise','rimraf','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','util','../../config/logger'];(function(_0x3ce7e9,_0x5094df){var _0x2b9ab7=function(_0x351538){while(--_0x351538){_0x3ce7e9['push'](_0x3ce7e9['shift']());}};_0x2b9ab7(++_0x5094df);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x43a5d7,_0x2d037f){_0x43a5d7=_0x43a5d7-0x0;var _0xe927b=_0xf6e8[_0x43a5d7];return _0xe927b;};'use strict';var _=require('lodash');var util=require(_0x8f6e('0x0'));var logger=require(_0x8f6e('0x1'))(_0x8f6e('0x2'));var moment=require(_0x8f6e('0x3'));var BPromise=require(_0x8f6e('0x4'));var rp=require(_0x8f6e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f6e('0x6'));var config=require('../../config/environment');var attributes=require(_0x8f6e('0x7'));var extensions=require(_0x8f6e('0x8'));module['exports']=function(_0x7b6df3,_0x233158){return _0x7b6df3[_0x8f6e('0x9')](_0x8f6e('0xa'),attributes,{'tableName':_0x8f6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x105076,_0x3df5fd){extensions[_0x8f6e('0xc')](_0x7b6df3,_0x105076);},'afterBulkCreate':function(_0x364ade,_0x35f528,_0x5b62d7){_0x5b62d7();extensions[_0x8f6e('0xc')](_0x7b6df3,_0x364ade[0x0]);},'afterUpdate':function(_0x1668bf,_0x4de3d0){extensions[_0x8f6e('0xc')](_0x7b6df3,_0x1668bf);},'afterDestroy':function(_0x11c98f,_0xa86c9b){extensions[_0x8f6e('0xc')](_0x7b6df3,_0x11c98f);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c7800b7..9c8b9f5 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 _0x8064=['then','stringify','catch','ShowInterval','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','error','code','message','result','GetInterval','Interval','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x1f231e,_0x34c74d){var _0xc964d0=function(_0x100952){while(--_0x100952){_0x1f231e['push'](_0x1f231e['shift']());}};_0xc964d0(++_0x34c74d);}(_0x8064,0x1a9));var _0x4806=function(_0x49c4f6,_0x46c3fe){_0x49c4f6=_0x49c4f6-0x0;var _0x5092e8=_0x8064[_0x49c4f6];return _0x5092e8;};'use strict';var _=require(_0x4806('0x0'));var util=require(_0x4806('0x1'));var moment=require('moment');var BPromise=require(_0x4806('0x2'));var rs=require(_0x4806('0x3'));var fs=require('fs');var Redis=require(_0x4806('0x4'));var db=require(_0x4806('0x5'))['db'];var utils=require(_0x4806('0x6'));var logger=require(_0x4806('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4806('0x8'));var client=jayson[_0x4806('0x9')][_0x4806('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1651c6,_0x231ed5,_0x218293){return new BPromise(function(_0x187474,_0x158765){return client['request'](_0x1651c6,_0x218293)['then'](function(_0x5968d1){logger[_0x4806('0xb')](_0x4806('0xc'),_0x231ed5,_0x4806('0xd'));logger[_0x4806('0xe')](_0x4806('0xf'),_0x231ed5,_0x4806('0xd'),JSON['stringify'](_0x5968d1));if(_0x5968d1[_0x4806('0x10')]){if(_0x5968d1[_0x4806('0x10')][_0x4806('0x11')]===0x1f4){logger[_0x4806('0x10')](_0x4806('0xc'),_0x231ed5,_0x5968d1[_0x4806('0x10')][_0x4806('0x12')]);return _0x158765(_0x5968d1[_0x4806('0x10')][_0x4806('0x12')]);}logger['error']('Interval,\x20%s,\x20%s',_0x231ed5,_0x5968d1['error'][_0x4806('0x12')]);return _0x187474(_0x5968d1[_0x4806('0x10')][_0x4806('0x12')]);}else{logger['info'](_0x4806('0xc'),_0x231ed5,_0x4806('0xd'));_0x187474(_0x5968d1[_0x4806('0x13')][_0x4806('0x12')]);}})['catch'](function(_0x2e276f){logger[_0x4806('0x10')]('Interval,\x20%s,\x20%s',_0x231ed5,_0x2e276f);_0x158765(_0x2e276f);});});}exports[_0x4806('0x14')]=function(_0x34133a){var _0x2f4b85=this;return new Promise(function(_0x4e6f63,_0x12cc91){return db[_0x4806('0x15')][_0x4806('0x16')]({'raw':_0x34133a['options']?_0x34133a[_0x4806('0x17')][_0x4806('0x18')]===undefined?!![]:![]:!![],'where':_0x34133a[_0x4806('0x17')]?_0x34133a['options']['where']||null:null,'attributes':_0x34133a[_0x4806('0x17')]?_0x34133a[_0x4806('0x17')][_0x4806('0x19')]||null:null,'limit':_0x34133a[_0x4806('0x17')]?_0x34133a[_0x4806('0x17')][_0x4806('0x1a')]||null:null,'include':_0x34133a[_0x4806('0x17')]?_0x34133a[_0x4806('0x17')][_0x4806('0x1b')]?_[_0x4806('0x1c')](_0x34133a[_0x4806('0x17')][_0x4806('0x1b')],function(_0x137e7e){return{'model':db[_0x137e7e[_0x4806('0x1d')]],'as':_0x137e7e['as'],'attributes':_0x137e7e[_0x4806('0x19')],'include':_0x137e7e[_0x4806('0x1b')]?_[_0x4806('0x1c')](_0x137e7e['include'],function(_0x5efb10){return{'model':db[_0x5efb10[_0x4806('0x1d')]],'as':_0x5efb10['as'],'attributes':_0x5efb10[_0x4806('0x19')],'include':_0x5efb10[_0x4806('0x1b')]?_['map'](_0x5efb10[_0x4806('0x1b')],function(_0x585deb){return{'model':db[_0x585deb['model']],'as':_0x585deb['as'],'attributes':_0x585deb[_0x4806('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4806('0x1e')](function(_0x3dcb05){logger[_0x4806('0xb')](_0x4806('0x14'),_0x34133a);logger[_0x4806('0xe')]('GetInterval',_0x34133a,JSON[_0x4806('0x1f')](_0x3dcb05));_0x4e6f63(_0x3dcb05);})[_0x4806('0x20')](function(_0x1703a0){logger[_0x4806('0x10')](_0x4806('0x14'),_0x1703a0[_0x4806('0x12')],_0x34133a);_0x12cc91(_0x2f4b85[_0x4806('0x10')](0x1f4,_0x1703a0[_0x4806('0x12')]));});});};exports[_0x4806('0x21')]=function(_0x2d6430){var _0x2847c5=this;return new Promise(function(_0x2509c0,_0x5c7a54){return db['Interval'][_0x4806('0x22')]({'raw':_0x2d6430[_0x4806('0x17')]?_0x2d6430[_0x4806('0x17')][_0x4806('0x18')]===undefined?!![]:![]:!![],'where':_0x2d6430[_0x4806('0x17')]?_0x2d6430[_0x4806('0x17')]['where']||null:null,'attributes':_0x2d6430[_0x4806('0x17')]?_0x2d6430['options'][_0x4806('0x19')]||null:null,'include':_0x2d6430[_0x4806('0x17')]?_0x2d6430[_0x4806('0x17')][_0x4806('0x1b')]?_[_0x4806('0x1c')](_0x2d6430['options'][_0x4806('0x1b')],function(_0x4d7429){return{'model':db[_0x4d7429[_0x4806('0x1d')]],'as':_0x4d7429['as'],'attributes':_0x4d7429[_0x4806('0x19')],'include':_0x4d7429[_0x4806('0x1b')]?_['map'](_0x4d7429[_0x4806('0x1b')],function(_0x31f895){return{'model':db[_0x31f895[_0x4806('0x1d')]],'as':_0x31f895['as'],'attributes':_0x31f895[_0x4806('0x19')],'include':_0x31f895['include']?_['map'](_0x31f895[_0x4806('0x1b')],function(_0x5cd257){return{'model':db[_0x5cd257[_0x4806('0x1d')]],'as':_0x5cd257['as'],'attributes':_0x5cd257[_0x4806('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4806('0x1e')](function(_0xa8d169){logger['info'](_0x4806('0x21'),_0x2d6430);logger[_0x4806('0xe')](_0x4806('0x21'),_0x2d6430,JSON['stringify'](_0xa8d169));_0x2509c0(_0xa8d169);})[_0x4806('0x20')](function(_0x12a186){logger[_0x4806('0x10')](_0x4806('0x21'),_0x12a186[_0x4806('0x12')],_0x2d6430);_0x5c7a54(_0x2847c5['error'](0x1f4,_0x12a186[_0x4806('0x12')]));});});}; \ No newline at end of file +var _0x0b71=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowInterval','find','lodash','moment','bluebird'];(function(_0x523a84,_0x323a6f){var _0x262335=function(_0x3c036c){while(--_0x3c036c){_0x523a84['push'](_0x523a84['shift']());}};_0x262335(++_0x323a6f);}(_0x0b71,0x1d1));var _0x10b7=function(_0x2ee973,_0x284293){_0x2ee973=_0x2ee973-0x0;var _0x2b5468=_0x0b71[_0x2ee973];return _0x2b5468;};'use strict';var _=require(_0x10b7('0x0'));var util=require('util');var moment=require(_0x10b7('0x1'));var BPromise=require(_0x10b7('0x2'));var rs=require(_0x10b7('0x3'));var fs=require('fs');var Redis=require(_0x10b7('0x4'));var db=require(_0x10b7('0x5'))['db'];var utils=require(_0x10b7('0x6'));var logger=require(_0x10b7('0x7'))(_0x10b7('0x8'));var config=require(_0x10b7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x10b7('0xa')][_0x10b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x494058,_0x3d61a0,_0x1796af){return new BPromise(function(_0x3f81a3,_0x2ca868){return client['request'](_0x494058,_0x1796af)[_0x10b7('0xc')](function(_0x2bc8f9){logger['info'](_0x10b7('0xd'),_0x3d61a0,_0x10b7('0xe'));logger[_0x10b7('0xf')](_0x10b7('0x10'),_0x3d61a0,_0x10b7('0xe'),JSON[_0x10b7('0x11')](_0x2bc8f9));if(_0x2bc8f9['error']){if(_0x2bc8f9['error'][_0x10b7('0x12')]===0x1f4){logger['error'](_0x10b7('0xd'),_0x3d61a0,_0x2bc8f9[_0x10b7('0x13')][_0x10b7('0x14')]);return _0x2ca868(_0x2bc8f9[_0x10b7('0x13')][_0x10b7('0x14')]);}logger[_0x10b7('0x13')]('Interval,\x20%s,\x20%s',_0x3d61a0,_0x2bc8f9[_0x10b7('0x13')][_0x10b7('0x14')]);return _0x3f81a3(_0x2bc8f9[_0x10b7('0x13')][_0x10b7('0x14')]);}else{logger[_0x10b7('0x15')](_0x10b7('0xd'),_0x3d61a0,_0x10b7('0xe'));_0x3f81a3(_0x2bc8f9[_0x10b7('0x16')][_0x10b7('0x14')]);}})['catch'](function(_0x20701e){logger['error'](_0x10b7('0xd'),_0x3d61a0,_0x20701e);_0x2ca868(_0x20701e);});});}exports[_0x10b7('0x17')]=function(_0x546318){var _0x59cb61=this;return new Promise(function(_0x3fcc75,_0x35ca1e){return db['Interval'][_0x10b7('0x18')]({'raw':_0x546318[_0x10b7('0x19')]?_0x546318[_0x10b7('0x19')][_0x10b7('0x1a')]===undefined?!![]:![]:!![],'where':_0x546318['options']?_0x546318[_0x10b7('0x19')][_0x10b7('0x1b')]||null:null,'attributes':_0x546318[_0x10b7('0x19')]?_0x546318[_0x10b7('0x19')][_0x10b7('0x1c')]||null:null,'limit':_0x546318[_0x10b7('0x19')]?_0x546318[_0x10b7('0x19')][_0x10b7('0x1d')]||null:null,'include':_0x546318[_0x10b7('0x19')]?_0x546318['options'][_0x10b7('0x1e')]?_[_0x10b7('0x1f')](_0x546318[_0x10b7('0x19')][_0x10b7('0x1e')],function(_0x45c310){return{'model':db[_0x45c310[_0x10b7('0x20')]],'as':_0x45c310['as'],'attributes':_0x45c310[_0x10b7('0x1c')],'include':_0x45c310[_0x10b7('0x1e')]?_[_0x10b7('0x1f')](_0x45c310[_0x10b7('0x1e')],function(_0x4d023e){return{'model':db[_0x4d023e['model']],'as':_0x4d023e['as'],'attributes':_0x4d023e[_0x10b7('0x1c')],'include':_0x4d023e['include']?_[_0x10b7('0x1f')](_0x4d023e[_0x10b7('0x1e')],function(_0x3c4c51){return{'model':db[_0x3c4c51['model']],'as':_0x3c4c51['as'],'attributes':_0x3c4c51[_0x10b7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x10b7('0xc')](function(_0x404a1a){logger[_0x10b7('0x15')](_0x10b7('0x17'),_0x546318);logger[_0x10b7('0xf')](_0x10b7('0x17'),_0x546318,JSON['stringify'](_0x404a1a));_0x3fcc75(_0x404a1a);})[_0x10b7('0x21')](function(_0x1e2da7){logger[_0x10b7('0x13')]('GetInterval',_0x1e2da7[_0x10b7('0x14')],_0x546318);_0x35ca1e(_0x59cb61['error'](0x1f4,_0x1e2da7['message']));});});};exports[_0x10b7('0x22')]=function(_0x161d8a){var _0x36e308=this;return new Promise(function(_0x527cb3,_0x28622b){return db['Interval'][_0x10b7('0x23')]({'raw':_0x161d8a[_0x10b7('0x19')]?_0x161d8a[_0x10b7('0x19')][_0x10b7('0x1a')]===undefined?!![]:![]:!![],'where':_0x161d8a[_0x10b7('0x19')]?_0x161d8a[_0x10b7('0x19')][_0x10b7('0x1b')]||null:null,'attributes':_0x161d8a[_0x10b7('0x19')]?_0x161d8a[_0x10b7('0x19')][_0x10b7('0x1c')]||null:null,'include':_0x161d8a[_0x10b7('0x19')]?_0x161d8a[_0x10b7('0x19')][_0x10b7('0x1e')]?_[_0x10b7('0x1f')](_0x161d8a[_0x10b7('0x19')][_0x10b7('0x1e')],function(_0x5c7520){return{'model':db[_0x5c7520[_0x10b7('0x20')]],'as':_0x5c7520['as'],'attributes':_0x5c7520[_0x10b7('0x1c')],'include':_0x5c7520[_0x10b7('0x1e')]?_[_0x10b7('0x1f')](_0x5c7520[_0x10b7('0x1e')],function(_0x1f906e){return{'model':db[_0x1f906e['model']],'as':_0x1f906e['as'],'attributes':_0x1f906e[_0x10b7('0x1c')],'include':_0x1f906e[_0x10b7('0x1e')]?_[_0x10b7('0x1f')](_0x1f906e['include'],function(_0x6102d1){return{'model':db[_0x6102d1[_0x10b7('0x20')]],'as':_0x6102d1['as'],'attributes':_0x6102d1[_0x10b7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47a46c){logger[_0x10b7('0x15')](_0x10b7('0x22'),_0x161d8a);logger['debug'](_0x10b7('0x22'),_0x161d8a,JSON['stringify'](_0x47a46c));_0x527cb3(_0x47a46c);})[_0x10b7('0x21')](function(_0x5b9b64){logger['error']('ShowInterval',_0x5b9b64[_0x10b7('0x14')],_0x161d8a);_0x28622b(_0x36e308['error'](0x1f4,_0x5b9b64['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 51134d7..14ba382 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 _0xb1c1=['./jira.controller','post','send','exports','express','Router','../../components/auth/service'];(function(_0x49cf85,_0xfdf2d7){var _0x24f687=function(_0x2126ae){while(--_0x2126ae){_0x49cf85['push'](_0x49cf85['shift']());}};_0x24f687(++_0xfdf2d7);}(_0xb1c1,0x1c4));var _0x1b1c=function(_0x5027c2,_0x498a70){_0x5027c2=_0x5027c2-0x0;var _0x37554d=_0xb1c1[_0x5027c2];return _0x37554d;};'use strict';var express=require(_0x1b1c('0x0'));var router=express[_0x1b1c('0x1')]();var auth=require(_0x1b1c('0x2'));var controller=require(_0x1b1c('0x3'));router[_0x1b1c('0x4')]('/',auth['isAuthenticated'](),controller[_0x1b1c('0x5')]);module[_0x1b1c('0x6')]=router; \ No newline at end of file +var _0x94fe=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports','express'];(function(_0x35c923,_0x2d150b){var _0x142a94=function(_0x1de3b6){while(--_0x1de3b6){_0x35c923['push'](_0x35c923['shift']());}};_0x142a94(++_0x2d150b);}(_0x94fe,0x1b7));var _0xe94f=function(_0x321173,_0x15c891){_0x321173=_0x321173-0x0;var _0x5ae206=_0x94fe[_0x321173];return _0x5ae206;};'use strict';var express=require(_0xe94f('0x0'));var router=express[_0xe94f('0x1')]();var auth=require(_0xe94f('0x2'));var controller=require(_0xe94f('0x3'));router[_0xe94f('0x4')]('/',auth[_0xe94f('0x5')](),controller[_0xe94f('0x6')]);module[_0xe94f('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 2ec66eb..2e0882c 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 _0x56e7=['key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','POST','application/json','base64','request','setEncoding','utf8','data','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','x-forwarded-for','remoteAddress','connection','socket','https','api','3eAmWpBVP0'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x56e7,0x14d));var _0x756e=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0x56e7[_0x3a7db0];return _0x17cbba;};'use strict';var BPromise=require('bluebird');var https=require(_0x756e('0x0'));var logger=require('../../config/logger')(_0x756e('0x1'));var USERNAME='support';var PASSWORD=_0x756e('0x2');function openIssue(_0x765dde,_0x5c6894){var _0x456846={'fields':{'project':{'key':_0x765dde[_0x756e('0x3')]||_0x756e('0x4')},'summary':(_0x765dde['summary']||_0x756e('0x5'))+_0x756e('0x6')+_0x765dde['ip'],'description':_0x765dde[_0x756e('0x7')]||JSON[_0x756e('0x8')](_0x765dde),'issuetype':{'name':_0x765dde[_0x756e('0x9')]||_0x756e('0xa')}}};_0x456846['fields']['customfield_11500']=_0x765dde[_0x756e('0xb')];_0x456846[_0x756e('0xc')][_0x756e('0xd')]=_0x765dde[_0x756e('0xe')];_0x456846['fields'][_0x756e('0xf')]=_0x765dde[_0x756e('0x10')];_0x456846[_0x756e('0xc')][_0x756e('0x11')]=_0x765dde[_0x756e('0x12')];_0x456846[_0x756e('0xc')]['customfield_11504']=_0x765dde[_0x756e('0x13')];_0x456846['fields']['customfield_10102']=_0x765dde['ip'];var _0x58913e={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x756e('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x756e('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x756e('0x16'))}};var _0x1bcf0e=JSON[_0x756e('0x8')](_0x456846);var _0x5034cf=https[_0x756e('0x17')](_0x58913e,function(_0x4b4f3a){_0x4b4f3a[_0x756e('0x18')](_0x756e('0x19'));var _0x19fd97='';_0x4b4f3a['on'](_0x756e('0x1a'),function(_0x11c62c){_0x19fd97+=_0x11c62c;});_0x4b4f3a['on'](_0x756e('0x1b'),function(){if(_0x5c6894){return _0x5c6894[_0x756e('0x1c')](_0x4b4f3a[_0x756e('0x1d')])[_0x756e('0x1e')](JSON[_0x756e('0x1f')](_0x19fd97));}});});_0x5034cf['on']('error',function(_0xb39c0e){if(_0x5c6894){return _0x5c6894[_0x756e('0x1c')](0x1f4)[_0x756e('0x1e')]({'errors':[{'message':_0x756e('0x20'),'type':_0x756e('0x21')}]});}});_0x5034cf[_0x756e('0x22')](_0x1bcf0e);_0x5034cf['end']();}exports[_0x756e('0x23')]=openIssue;exports[_0x756e('0x24')]=function(_0x494157,_0x5b7599){_0x494157[_0x756e('0x25')]['ip']=_0x494157['headers'][_0x756e('0x26')]||_0x494157['connection'][_0x756e('0x27')]||_0x494157['socket'][_0x756e('0x27')]||_0x494157[_0x756e('0x28')][_0x756e('0x29')]['remoteAddress'];return openIssue(_0x494157[_0x756e('0x25')],_0x5b7599);}; \ No newline at end of file +var _0x08f0=['email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','POST','toString','base64','stringify','setEncoding','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','\x20from\x20','description','issuetype','Bug','fields','customfield_11500'];(function(_0x24f86d,_0xeb119){var _0xaea28=function(_0x3bb446){while(--_0x3bb446){_0x24f86d['push'](_0x24f86d['shift']());}};_0xaea28(++_0xeb119);}(_0x08f0,0x127));var _0x008f=function(_0x5ee819,_0x10dc7c){_0x5ee819=_0x5ee819-0x0;var _0x30e020=_0x08f0[_0x5ee819];return _0x30e020;};'use strict';var BPromise=require(_0x008f('0x0'));var https=require(_0x008f('0x1'));var logger=require(_0x008f('0x2'))(_0x008f('0x3'));var USERNAME=_0x008f('0x4');var PASSWORD=_0x008f('0x5');function openIssue(_0x3a4a9d,_0x7e66ad){var _0x317325={'fields':{'project':{'key':_0x3a4a9d['key']||_0x008f('0x6')},'summary':(_0x3a4a9d['summary']||'Report')+_0x008f('0x7')+_0x3a4a9d['ip'],'description':_0x3a4a9d[_0x008f('0x8')]||JSON['stringify'](_0x3a4a9d),'issuetype':{'name':_0x3a4a9d[_0x008f('0x9')]||_0x008f('0xa')}}};_0x317325[_0x008f('0xb')][_0x008f('0xc')]=_0x3a4a9d[_0x008f('0xd')];_0x317325['fields'][_0x008f('0xe')]=_0x3a4a9d['oldToken'];_0x317325[_0x008f('0xb')][_0x008f('0xf')]=_0x3a4a9d[_0x008f('0x10')];_0x317325['fields'][_0x008f('0x11')]=_0x3a4a9d[_0x008f('0x12')];_0x317325['fields'][_0x008f('0x13')]=_0x3a4a9d[_0x008f('0x14')];_0x317325[_0x008f('0xb')]['customfield_10102']=_0x3a4a9d['ip'];var _0x433447={'host':_0x008f('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x008f('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x008f('0x17')](_0x008f('0x18'))}};var _0x5d59a9=JSON[_0x008f('0x19')](_0x317325);var _0x379d5d=https['request'](_0x433447,function(_0x41e7cc){_0x41e7cc[_0x008f('0x1a')](_0x008f('0x1b'));var _0x175f3d='';_0x41e7cc['on']('data',function(_0x50358d){_0x175f3d+=_0x50358d;});_0x41e7cc['on'](_0x008f('0x1c'),function(){if(_0x7e66ad){return _0x7e66ad[_0x008f('0x1d')](_0x41e7cc[_0x008f('0x1e')])[_0x008f('0x1f')](JSON[_0x008f('0x20')](_0x175f3d));}});});_0x379d5d['on'](_0x008f('0x21'),function(_0x598031){if(_0x7e66ad){return _0x7e66ad[_0x008f('0x1d')](0x1f4)[_0x008f('0x1f')]({'errors':[{'message':_0x008f('0x22'),'type':_0x008f('0x23')}]});}});_0x379d5d[_0x008f('0x24')](_0x5d59a9);_0x379d5d[_0x008f('0x1c')]();}exports[_0x008f('0x25')]=openIssue;exports[_0x008f('0x26')]=function(_0x19b2a3,_0x14106e){_0x19b2a3[_0x008f('0x27')]['ip']=_0x19b2a3['headers'][_0x008f('0x28')]||_0x19b2a3[_0x008f('0x29')][_0x008f('0x2a')]||_0x19b2a3[_0x008f('0x2b')]['remoteAddress']||_0x19b2a3['connection']['socket'][_0x008f('0x2a')];return openIssue(_0x19b2a3[_0x008f('0x27')],_0x14106e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d199c92..2ef839e 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 _0x84c0=['../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x84c0,0x19e));var _0x084c=function(_0x156f08,_0x467d69){_0x156f08=_0x156f08-0x0;var _0x2289d0=_0x84c0[_0x156f08];return _0x2289d0;};'use strict';var multer=require(_0x084c('0x0'));var util=require(_0x084c('0x1'));var path=require(_0x084c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x084c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x084c('0x4'));var config=require('../../config/environment');var controller=require(_0x084c('0x5'));router['get']('/',auth[_0x084c('0x6')](),controller[_0x084c('0x7')]);router[_0x084c('0x8')]('/describe',auth[_0x084c('0x6')](),controller[_0x084c('0x9')]);router[_0x084c('0x8')](_0x084c('0xa'),auth[_0x084c('0x6')](),controller[_0x084c('0xb')]);router[_0x084c('0xc')]('/',auth[_0x084c('0x6')](),controller[_0x084c('0xd')]);router[_0x084c('0xe')]('/:id',auth[_0x084c('0x6')](),controller[_0x084c('0xf')]);router[_0x084c('0x10')]('/:id',auth[_0x084c('0x6')](),controller[_0x084c('0x11')]);module[_0x084c('0x12')]=router; \ No newline at end of file +var _0x1f12=['update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x16d5bb,_0x3cf3c3){var _0x531acc=function(_0x60d158){while(--_0x60d158){_0x16d5bb['push'](_0x16d5bb['shift']());}};_0x531acc(++_0x3cf3c3);}(_0x1f12,0x134));var _0x21f1=function(_0x1083ef,_0x1806e4){_0x1083ef=_0x1083ef-0x0;var _0x1b3169=_0x1f12[_0x1083ef];return _0x1b3169;};'use strict';var multer=require('multer');var util=require(_0x21f1('0x0'));var path=require(_0x21f1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21f1('0x2')]();var auth=require(_0x21f1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x21f1('0x4'));var controller=require(_0x21f1('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x21f1('0x6')](_0x21f1('0x7'),auth[_0x21f1('0x8')](),controller[_0x21f1('0x9')]);router[_0x21f1('0x6')](_0x21f1('0xa'),auth[_0x21f1('0x8')](),controller[_0x21f1('0xb')]);router[_0x21f1('0xc')]('/',auth[_0x21f1('0x8')](),controller[_0x21f1('0xd')]);router[_0x21f1('0xe')](_0x21f1('0xa'),auth[_0x21f1('0x8')](),controller[_0x21f1('0xf')]);router[_0x21f1('0x10')]('/:id',auth[_0x21f1('0x8')](),controller[_0x21f1('0x11')]);module[_0x21f1('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 9a90829..bcd44cd 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 _0x3eb3=['sequelize','exports','TEXT','long','STRING'];(function(_0x4dc8c6,_0x3fba52){var _0x69ce1d=function(_0x1a726d){while(--_0x1a726d){_0x4dc8c6['push'](_0x4dc8c6['shift']());}};_0x69ce1d(++_0x3fba52);}(_0x3eb3,0x1cc));var _0x33eb=function(_0x6a9a8,_0x430196){_0x6a9a8=_0x6a9a8-0x0;var _0xb29531=_0x3eb3[_0x6a9a8];return _0xb29531;};'use strict';var Sequelize=require(_0x33eb('0x0'));module[_0x33eb('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x33eb('0x2')](_0x33eb('0x3'))},'membername':{'type':Sequelize[_0x33eb('0x4')]},'projectname':{'type':Sequelize[_0x33eb('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x33eb('0x4')]},'calleridname':{'type':Sequelize[_0x33eb('0x4')]},'calleridnum':{'type':Sequelize[_0x33eb('0x4')]},'questionId':{'type':Sequelize[_0x33eb('0x4')]}}; \ No newline at end of file +var _0x9525=['sequelize','exports','TEXT','long','STRING'];(function(_0x13a34a,_0x2c711d){var _0x10265b=function(_0x53df87){while(--_0x53df87){_0x13a34a['push'](_0x13a34a['shift']());}};_0x10265b(++_0x2c711d);}(_0x9525,0x12c));var _0x5952=function(_0x5bc60d,_0x5dbc62){_0x5bc60d=_0x5bc60d-0x0;var _0x268d5e=_0x9525[_0x5bc60d];return _0x268d5e;};'use strict';var Sequelize=require(_0x5952('0x0'));module[_0x5952('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x5952('0x2')](_0x5952('0x3'))},'membername':{'type':Sequelize[_0x5952('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5952('0x4')]},'uniqueid':{'type':Sequelize[_0x5952('0x4')]},'calleridname':{'type':Sequelize[_0x5952('0x4')]},'calleridnum':{'type':Sequelize[_0x5952('0x4')]},'questionId':{'type':Sequelize[_0x5952('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 22f8732..3da9b16 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 _0xe280=['params','rawAttributes','length','find','create','body','update','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','index','map','JscriptyAnswerReport','fieldName','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xe280,0xe0));var _0x0e28=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xe280[_0x59d89e];return _0x554e93;};'use strict';var pdf=require(_0x0e28('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e28('0x1'));var jsonpatch=require(_0x0e28('0x2'));var rp=require(_0x0e28('0x3'));var moment=require('moment');var BPromise=require(_0x0e28('0x4'));var Mustache=require(_0x0e28('0x5'));var util=require(_0x0e28('0x6'));var path=require('path');var sox=require(_0x0e28('0x7'));var csv=require(_0x0e28('0x8'));var ejs=require(_0x0e28('0x9'));var fs=require('fs');var _=require(_0x0e28('0xa'));var squel=require(_0x0e28('0xb'));var crypto=require(_0x0e28('0xc'));var jsforce=require(_0x0e28('0xd'));var deskjs=require(_0x0e28('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0e28('0xf'));var Redis=require('ioredis');var authService=require(_0x0e28('0x10'));var qs=require(_0x0e28('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e28('0x12'));var logger=require('../../config/logger')(_0x0e28('0x13'));var utils=require(_0x0e28('0x14'));var config=require('../../config/environment');var db=require(_0x0e28('0x15'))['db'];function respondWithStatusCode(_0x4e2a21,_0x1a720b){_0x1a720b=_0x1a720b||0xcc;return function(_0x4f0441){if(_0x4f0441){return _0x4e2a21['sendStatus'](_0x1a720b);}return _0x4e2a21[_0x0e28('0x16')](_0x1a720b)[_0x0e28('0x17')]();};}function respondWithResult(_0x1bf0ba,_0x1961a8){_0x1961a8=_0x1961a8||0xc8;return function(_0x479170){if(_0x479170){return _0x1bf0ba[_0x0e28('0x16')](_0x1961a8)['json'](_0x479170);}};}function respondWithFilteredResult(_0x4a9cc5,_0x10057a){return function(_0x320e33){if(_0x320e33){var _0x44eaf8=_0x320e33[_0x0e28('0x18')],_0x2ba381=_0x10057a[_0x0e28('0x19')],_0x2c5293=_0x10057a[_0x0e28('0x19')]+_0x10057a['limit'],_0x322afe;if(_0x2c5293>=_0x44eaf8){_0x2c5293=_0x44eaf8;_0x322afe=0xc8;}else{_0x322afe=0xce;}_0x4a9cc5[_0x0e28('0x16')](_0x322afe);return _0x4a9cc5[_0x0e28('0x1a')](_0x0e28('0x1b'),_0x2ba381+'-'+_0x2c5293+'/'+_0x44eaf8)['json'](_0x320e33);}return null;};}function patchUpdates(_0x46f4f5){return function(_0x1fcecf){try{jsonpatch[_0x0e28('0x1c')](_0x1fcecf,_0x46f4f5,!![]);}catch(_0x25f541){return BPromise[_0x0e28('0x1d')](_0x25f541);}return _0x1fcecf[_0x0e28('0x1e')]();};}function saveUpdates(_0x5cf4e4,_0x552cdf){return function(_0x30dc48){if(_0x30dc48){return _0x30dc48['update'](_0x5cf4e4)[_0x0e28('0x1f')](function(_0x51faf1){return _0x51faf1;});}return null;};}function removeEntity(_0x4d7dc7,_0x5220bf){return function(_0x41345d){if(_0x41345d){return _0x41345d[_0x0e28('0x20')]()[_0x0e28('0x1f')](function(){_0x4d7dc7[_0x0e28('0x16')](0xcc)[_0x0e28('0x17')]();});}};}function handleEntityNotFound(_0x437df4,_0x365975){return function(_0x13a534){if(!_0x13a534){_0x437df4[_0x0e28('0x21')](0x194);}return _0x13a534;};}function handleError(_0x20248d,_0x374a18){_0x374a18=_0x374a18||0x1f4;return function(_0x4be21d){logger[_0x0e28('0x22')](_0x4be21d[_0x0e28('0x23')]);if(_0x4be21d['name']){delete _0x4be21d['name'];}_0x20248d[_0x0e28('0x16')](_0x374a18)['send'](_0x4be21d);};}exports[_0x0e28('0x24')]=function(_0x95defc,_0x31cc56){var _0x48583b={},_0x849ea1={},_0x3b32d7={'count':0x0,'rows':[]};var _0x134704=_[_0x0e28('0x25')](db[_0x0e28('0x26')]['rawAttributes'],function(_0x49dc72){return{'name':_0x49dc72[_0x0e28('0x27')],'type':_0x49dc72['type']['key']};});_0x849ea1[_0x0e28('0x28')]=_[_0x0e28('0x25')](_0x134704,_0x0e28('0x29'));_0x849ea1[_0x0e28('0x2a')]=_[_0x0e28('0x2b')](_0x95defc['query']);_0x849ea1[_0x0e28('0x2c')]=_[_0x0e28('0x2d')](_0x849ea1['model'],_0x849ea1['query']);_0x48583b[_0x0e28('0x2e')]=_['intersection'](_0x849ea1['model'],qs[_0x0e28('0x2f')](_0x95defc[_0x0e28('0x2a')]['fields']));_0x48583b[_0x0e28('0x2e')]=_0x48583b['attributes']['length']?_0x48583b[_0x0e28('0x2e')]:_0x849ea1[_0x0e28('0x28')];if(!_0x95defc[_0x0e28('0x2a')][_0x0e28('0x30')](_0x0e28('0x31'))){_0x48583b['limit']=qs['limit'](_0x95defc[_0x0e28('0x2a')][_0x0e28('0x32')]);_0x48583b[_0x0e28('0x19')]=qs[_0x0e28('0x19')](_0x95defc[_0x0e28('0x2a')][_0x0e28('0x19')]);}_0x48583b[_0x0e28('0x33')]=qs[_0x0e28('0x34')](_0x95defc[_0x0e28('0x2a')][_0x0e28('0x34')]);_0x48583b[_0x0e28('0x35')]=qs[_0x0e28('0x2c')](_[_0x0e28('0x36')](_0x95defc[_0x0e28('0x2a')],_0x849ea1['filters']),_0x134704);if(_0x95defc[_0x0e28('0x2a')][_0x0e28('0x37')]){_0x48583b[_0x0e28('0x35')]=_['merge'](_0x48583b['where'],{'$or':_[_0x0e28('0x25')](_0x134704,function(_0x5a6db7){if(_0x5a6db7['type']!==_0x0e28('0x38')){var _0x4a0d1e={};_0x4a0d1e[_0x5a6db7[_0x0e28('0x29')]]={'$like':'%'+_0x95defc[_0x0e28('0x2a')][_0x0e28('0x37')]+'%'};return _0x4a0d1e;}})});}_0x48583b=_[_0x0e28('0x39')]({},_0x48583b,_0x95defc['options']);var _0x231dee={'where':_0x48583b[_0x0e28('0x35')]};return db[_0x0e28('0x26')][_0x0e28('0x18')](_0x231dee)['then'](function(_0x3d40c6){_0x3b32d7[_0x0e28('0x18')]=_0x3d40c6;if(_0x95defc[_0x0e28('0x2a')][_0x0e28('0x3a')]){_0x48583b[_0x0e28('0x3b')]=[{'all':!![]}];}return db[_0x0e28('0x26')][_0x0e28('0x3c')](_0x48583b);})[_0x0e28('0x1f')](function(_0x4bbc09){_0x3b32d7[_0x0e28('0x3d')]=_0x4bbc09;return _0x3b32d7;})[_0x0e28('0x1f')](respondWithFilteredResult(_0x31cc56,_0x48583b))[_0x0e28('0x3e')](handleError(_0x31cc56,null));};exports[_0x0e28('0x3f')]=function(_0x4470a3,_0x2f8b8d){var _0x3b41a5={'raw':!![],'where':{'id':_0x4470a3[_0x0e28('0x40')]['id']}},_0x39175a={};_0x39175a[_0x0e28('0x28')]=_[_0x0e28('0x2b')](db[_0x0e28('0x26')][_0x0e28('0x41')]);_0x39175a['query']=_['keys'](_0x4470a3['query']);_0x39175a[_0x0e28('0x2c')]=_[_0x0e28('0x2d')](_0x39175a[_0x0e28('0x28')],_0x39175a[_0x0e28('0x2a')]);_0x3b41a5['attributes']=_[_0x0e28('0x2d')](_0x39175a[_0x0e28('0x28')],qs[_0x0e28('0x2f')](_0x4470a3['query']['fields']));_0x3b41a5['attributes']=_0x3b41a5[_0x0e28('0x2e')][_0x0e28('0x42')]?_0x3b41a5['attributes']:_0x39175a[_0x0e28('0x28')];if(_0x4470a3[_0x0e28('0x2a')][_0x0e28('0x3a')]){_0x3b41a5[_0x0e28('0x3b')]=[{'all':!![]}];}_0x3b41a5=_[_0x0e28('0x39')]({},_0x3b41a5,_0x4470a3['options']);return db[_0x0e28('0x26')][_0x0e28('0x43')](_0x3b41a5)[_0x0e28('0x1f')](handleEntityNotFound(_0x2f8b8d,null))['then'](respondWithResult(_0x2f8b8d,null))[_0x0e28('0x3e')](handleError(_0x2f8b8d,null));};exports[_0x0e28('0x44')]=function(_0x4ecac2,_0x5e2c09){return db[_0x0e28('0x26')]['create'](_0x4ecac2[_0x0e28('0x45')],{})['then'](respondWithResult(_0x5e2c09,0xc9))[_0x0e28('0x3e')](handleError(_0x5e2c09,null));};exports[_0x0e28('0x46')]=function(_0x37e1d3,_0x467896){if(_0x37e1d3[_0x0e28('0x45')]['id']){delete _0x37e1d3[_0x0e28('0x45')]['id'];}return db[_0x0e28('0x26')][_0x0e28('0x43')]({'where':{'id':_0x37e1d3[_0x0e28('0x40')]['id']}})['then'](handleEntityNotFound(_0x467896,null))[_0x0e28('0x1f')](saveUpdates(_0x37e1d3[_0x0e28('0x45')],null))['then'](respondWithResult(_0x467896,null))[_0x0e28('0x3e')](handleError(_0x467896,null));};exports['destroy']=function(_0x39e3a6,_0x4958b0){return db['JscriptyAnswerReport'][_0x0e28('0x43')]({'where':{'id':_0x39e3a6[_0x0e28('0x40')]['id']}})[_0x0e28('0x1f')](handleEntityNotFound(_0x4958b0,null))[_0x0e28('0x1f')](removeEntity(_0x4958b0,null))[_0x0e28('0x3e')](handleError(_0x4958b0,null));};exports[_0x0e28('0x47')]=function(_0x26b781,_0x324f8e){return db[_0x0e28('0x26')][_0x0e28('0x47')]()['then'](respondWithResult(_0x324f8e,null))['catch'](handleError(_0x324f8e,null));}; \ No newline at end of file +var _0xac59=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter'];(function(_0x2e712f,_0x60d75f){var _0x2fb152=function(_0x577196){while(--_0x577196){_0x2e712f['push'](_0x2e712f['shift']());}};_0x2fb152(++_0x60d75f);}(_0xac59,0x1ac));var _0x9ac5=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xac59[_0x465028];return _0xb783d4;};'use strict';var pdf=require(_0x9ac5('0x0'));var emlformat=require(_0x9ac5('0x1'));var rimraf=require(_0x9ac5('0x2'));var zipdir=require(_0x9ac5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ac5('0x4'));var moment=require('moment');var BPromise=require(_0x9ac5('0x5'));var Mustache=require('mustache');var util=require(_0x9ac5('0x6'));var path=require('path');var sox=require(_0x9ac5('0x7'));var csv=require(_0x9ac5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9ac5('0x9'));var crypto=require(_0x9ac5('0xa'));var jsforce=require(_0x9ac5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9ac5('0x8'));var querystring=require('querystring');var Papa=require(_0x9ac5('0xc'));var Redis=require(_0x9ac5('0xd'));var authService=require(_0x9ac5('0xe'));var qs=require(_0x9ac5('0xf'));var as=require(_0x9ac5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9ac5('0x11'));var utils=require(_0x9ac5('0x12'));var config=require(_0x9ac5('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a4de6,_0x2aec82){_0x2aec82=_0x2aec82||0xcc;return function(_0x3b666a){if(_0x3b666a){return _0x1a4de6[_0x9ac5('0x14')](_0x2aec82);}return _0x1a4de6[_0x9ac5('0x15')](_0x2aec82)[_0x9ac5('0x16')]();};}function respondWithResult(_0x3d7e56,_0x4ddf02){_0x4ddf02=_0x4ddf02||0xc8;return function(_0x868bc5){if(_0x868bc5){return _0x3d7e56[_0x9ac5('0x15')](_0x4ddf02)[_0x9ac5('0x17')](_0x868bc5);}};}function respondWithFilteredResult(_0x2cbba5,_0x3552e7){return function(_0xe1c6fe){if(_0xe1c6fe){var _0x5a87fa=_0xe1c6fe[_0x9ac5('0x18')],_0x20a6dd=_0x3552e7[_0x9ac5('0x19')],_0x49d670=_0x3552e7['offset']+_0x3552e7['limit'],_0x43ebbe;if(_0x49d670>=_0x5a87fa){_0x49d670=_0x5a87fa;_0x43ebbe=0xc8;}else{_0x43ebbe=0xce;}_0x2cbba5[_0x9ac5('0x15')](_0x43ebbe);return _0x2cbba5[_0x9ac5('0x1a')](_0x9ac5('0x1b'),_0x20a6dd+'-'+_0x49d670+'/'+_0x5a87fa)['json'](_0xe1c6fe);}return null;};}function patchUpdates(_0x5a3e96){return function(_0x644f72){try{jsonpatch[_0x9ac5('0x1c')](_0x644f72,_0x5a3e96,!![]);}catch(_0xf2702e){return BPromise[_0x9ac5('0x1d')](_0xf2702e);}return _0x644f72['save']();};}function saveUpdates(_0x11b386,_0x246cfa){return function(_0xec38e1){if(_0xec38e1){return _0xec38e1['update'](_0x11b386)[_0x9ac5('0x1e')](function(_0x14d72c){return _0x14d72c;});}return null;};}function removeEntity(_0x43f857,_0x5f0445){return function(_0x32bde4){if(_0x32bde4){return _0x32bde4[_0x9ac5('0x1f')]()[_0x9ac5('0x1e')](function(){_0x43f857[_0x9ac5('0x15')](0xcc)[_0x9ac5('0x16')]();});}};}function handleEntityNotFound(_0xffd5ee,_0x5d97ae){return function(_0x133b81){if(!_0x133b81){_0xffd5ee['sendStatus'](0x194);}return _0x133b81;};}function handleError(_0x235d51,_0x2d8840){_0x2d8840=_0x2d8840||0x1f4;return function(_0x5f432f){logger[_0x9ac5('0x20')](_0x5f432f[_0x9ac5('0x21')]);if(_0x5f432f['name']){delete _0x5f432f['name'];}_0x235d51[_0x9ac5('0x15')](_0x2d8840)['send'](_0x5f432f);};}exports[_0x9ac5('0x22')]=function(_0x2784c7,_0x57304b){var _0x42ce8f={},_0x3d7fd5={},_0x58ed31={'count':0x0,'rows':[]};var _0xdc50a3=_[_0x9ac5('0x23')](db[_0x9ac5('0x24')][_0x9ac5('0x25')],function(_0x355657){return{'name':_0x355657[_0x9ac5('0x26')],'type':_0x355657[_0x9ac5('0x27')]['key']};});_0x3d7fd5[_0x9ac5('0x28')]=_['map'](_0xdc50a3,_0x9ac5('0x29'));_0x3d7fd5[_0x9ac5('0x2a')]=_[_0x9ac5('0x2b')](_0x2784c7['query']);_0x3d7fd5[_0x9ac5('0x2c')]=_[_0x9ac5('0x2d')](_0x3d7fd5[_0x9ac5('0x28')],_0x3d7fd5[_0x9ac5('0x2a')]);_0x42ce8f[_0x9ac5('0x2e')]=_['intersection'](_0x3d7fd5[_0x9ac5('0x28')],qs['fields'](_0x2784c7['query'][_0x9ac5('0x2f')]));_0x42ce8f[_0x9ac5('0x2e')]=_0x42ce8f['attributes'][_0x9ac5('0x30')]?_0x42ce8f[_0x9ac5('0x2e')]:_0x3d7fd5[_0x9ac5('0x28')];if(!_0x2784c7[_0x9ac5('0x2a')]['hasOwnProperty']('nolimit')){_0x42ce8f['limit']=qs[_0x9ac5('0x31')](_0x2784c7[_0x9ac5('0x2a')][_0x9ac5('0x31')]);_0x42ce8f['offset']=qs[_0x9ac5('0x19')](_0x2784c7[_0x9ac5('0x2a')][_0x9ac5('0x19')]);}_0x42ce8f[_0x9ac5('0x32')]=qs[_0x9ac5('0x33')](_0x2784c7[_0x9ac5('0x2a')][_0x9ac5('0x33')]);_0x42ce8f[_0x9ac5('0x34')]=qs[_0x9ac5('0x2c')](_[_0x9ac5('0x35')](_0x2784c7['query'],_0x3d7fd5[_0x9ac5('0x2c')]),_0xdc50a3);if(_0x2784c7['query'][_0x9ac5('0x36')]){_0x42ce8f[_0x9ac5('0x34')]=_[_0x9ac5('0x37')](_0x42ce8f[_0x9ac5('0x34')],{'$or':_[_0x9ac5('0x23')](_0xdc50a3,function(_0x48e003){if(_0x48e003[_0x9ac5('0x27')]!==_0x9ac5('0x38')){var _0x1398fc={};_0x1398fc[_0x48e003['name']]={'$like':'%'+_0x2784c7['query'][_0x9ac5('0x36')]+'%'};return _0x1398fc;}})});}_0x42ce8f=_[_0x9ac5('0x37')]({},_0x42ce8f,_0x2784c7[_0x9ac5('0x39')]);var _0x5dd362={'where':_0x42ce8f['where']};return db[_0x9ac5('0x24')][_0x9ac5('0x18')](_0x5dd362)['then'](function(_0x5788b4){_0x58ed31['count']=_0x5788b4;if(_0x2784c7[_0x9ac5('0x2a')][_0x9ac5('0x3a')]){_0x42ce8f[_0x9ac5('0x3b')]=[{'all':!![]}];}return db[_0x9ac5('0x24')][_0x9ac5('0x3c')](_0x42ce8f);})[_0x9ac5('0x1e')](function(_0x54f4a8){_0x58ed31[_0x9ac5('0x3d')]=_0x54f4a8;return _0x58ed31;})[_0x9ac5('0x1e')](respondWithFilteredResult(_0x57304b,_0x42ce8f))[_0x9ac5('0x3e')](handleError(_0x57304b,null));};exports[_0x9ac5('0x3f')]=function(_0x45c4bd,_0x473900){var _0x4c6190={'raw':!![],'where':{'id':_0x45c4bd[_0x9ac5('0x40')]['id']}},_0x3c5c13={};_0x3c5c13[_0x9ac5('0x28')]=_[_0x9ac5('0x2b')](db['JscriptyAnswerReport'][_0x9ac5('0x25')]);_0x3c5c13[_0x9ac5('0x2a')]=_['keys'](_0x45c4bd[_0x9ac5('0x2a')]);_0x3c5c13[_0x9ac5('0x2c')]=_[_0x9ac5('0x2d')](_0x3c5c13['model'],_0x3c5c13[_0x9ac5('0x2a')]);_0x4c6190[_0x9ac5('0x2e')]=_[_0x9ac5('0x2d')](_0x3c5c13[_0x9ac5('0x28')],qs[_0x9ac5('0x2f')](_0x45c4bd[_0x9ac5('0x2a')][_0x9ac5('0x2f')]));_0x4c6190[_0x9ac5('0x2e')]=_0x4c6190[_0x9ac5('0x2e')]['length']?_0x4c6190[_0x9ac5('0x2e')]:_0x3c5c13[_0x9ac5('0x28')];if(_0x45c4bd[_0x9ac5('0x2a')][_0x9ac5('0x3a')]){_0x4c6190[_0x9ac5('0x3b')]=[{'all':!![]}];}_0x4c6190=_[_0x9ac5('0x37')]({},_0x4c6190,_0x45c4bd[_0x9ac5('0x39')]);return db[_0x9ac5('0x24')][_0x9ac5('0x41')](_0x4c6190)[_0x9ac5('0x1e')](handleEntityNotFound(_0x473900,null))['then'](respondWithResult(_0x473900,null))[_0x9ac5('0x3e')](handleError(_0x473900,null));};exports[_0x9ac5('0x42')]=function(_0x30fc86,_0x53ca2c){return db['JscriptyAnswerReport']['create'](_0x30fc86[_0x9ac5('0x43')],{})[_0x9ac5('0x1e')](respondWithResult(_0x53ca2c,0xc9))['catch'](handleError(_0x53ca2c,null));};exports['update']=function(_0x1a1e2a,_0x5ca0e5){if(_0x1a1e2a[_0x9ac5('0x43')]['id']){delete _0x1a1e2a[_0x9ac5('0x43')]['id'];}return db[_0x9ac5('0x24')]['find']({'where':{'id':_0x1a1e2a[_0x9ac5('0x40')]['id']}})[_0x9ac5('0x1e')](handleEntityNotFound(_0x5ca0e5,null))[_0x9ac5('0x1e')](saveUpdates(_0x1a1e2a[_0x9ac5('0x43')],null))[_0x9ac5('0x1e')](respondWithResult(_0x5ca0e5,null))[_0x9ac5('0x3e')](handleError(_0x5ca0e5,null));};exports[_0x9ac5('0x1f')]=function(_0x22cec5,_0xdce93c){return db[_0x9ac5('0x24')]['find']({'where':{'id':_0x22cec5[_0x9ac5('0x40')]['id']}})[_0x9ac5('0x1e')](handleEntityNotFound(_0xdce93c,null))[_0x9ac5('0x1e')](removeEntity(_0xdce93c,null))[_0x9ac5('0x3e')](handleError(_0xdce93c,null));};exports[_0x9ac5('0x44')]=function(_0x5e3e4e,_0x4577d9){return db['JscriptyAnswerReport'][_0x9ac5('0x44')]()[_0x9ac5('0x1e')](respondWithResult(_0x4577d9,null))[_0x9ac5('0x3e')](handleError(_0x4577d9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7fb22a5..abcadd7 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 _0xc3fb=['moment','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x5f57d7,_0x1ddc20){var _0xce443b=function(_0x3fabd3){while(--_0x3fabd3){_0x5f57d7['push'](_0x5f57d7['shift']());}};_0xce443b(++_0x1ddc20);}(_0xc3fb,0x15d));var _0xbc3f=function(_0x40d623,_0x2a0853){_0x40d623=_0x40d623-0x0;var _0x10255f=_0xc3fb[_0x40d623];return _0x10255f;};'use strict';var _=require(_0xbc3f('0x0'));var util=require(_0xbc3f('0x1'));var logger=require(_0xbc3f('0x2'))('api');var moment=require(_0xbc3f('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc3f('0x4'));var fs=require('fs');var path=require(_0xbc3f('0x5'));var rimraf=require('rimraf');var config=require(_0xbc3f('0x6'));var attributes=require(_0xbc3f('0x7'));module[_0xbc3f('0x8')]=function(_0x4e5e77,_0x1088a6){return _0x4e5e77[_0xbc3f('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0xbc3f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacea=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xacea,0x84));var _0xaace=function(_0x585239,_0x5387fc){_0x585239=_0x585239-0x0;var _0x3f4826=_0xacea[_0x585239];return _0x3f4826;};'use strict';var _=require(_0xaace('0x0'));var util=require('util');var logger=require(_0xaace('0x1'))('api');var moment=require(_0xaace('0x2'));var BPromise=require(_0xaace('0x3'));var rp=require(_0xaace('0x4'));var fs=require('fs');var path=require(_0xaace('0x5'));var rimraf=require(_0xaace('0x6'));var config=require(_0xaace('0x7'));var attributes=require(_0xaace('0x8'));module[_0xaace('0x9')]=function(_0x45978a,_0x3cb197){return _0x45978a[_0xaace('0xa')](_0xaace('0xb'),attributes,{'tableName':'report_jscripty_answers','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 e5e0c51..3368d75 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 _0x0c3a=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util'];(function(_0x5c3cb4,_0x4f4f52){var _0x4e5241=function(_0x44fefc){while(--_0x44fefc){_0x5c3cb4['push'](_0x5c3cb4['shift']());}};_0x4e5241(++_0x4f4f52);}(_0x0c3a,0xcd));var _0xa0c3=function(_0x5b672a,_0x4ffeb6){_0x5b672a=_0x5b672a-0x0;var _0x1e4aa0=_0x0c3a[_0x5b672a];return _0x1e4aa0;};'use strict';var _=require(_0xa0c3('0x0'));var util=require(_0xa0c3('0x1'));var moment=require(_0xa0c3('0x2'));var BPromise=require('bluebird');var rs=require(_0xa0c3('0x3'));var fs=require('fs');var Redis=require(_0xa0c3('0x4'));var db=require(_0xa0c3('0x5'))['db'];var utils=require(_0xa0c3('0x6'));var logger=require(_0xa0c3('0x7'))('rpc');var config=require(_0xa0c3('0x8'));var jayson=require(_0xa0c3('0x9'));var client=jayson[_0xa0c3('0xa')][_0xa0c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x520445,_0x5a20fa,_0x2c4ada){return new BPromise(function(_0x448399,_0x588326){return client[_0xa0c3('0xc')](_0x520445,_0x2c4ada)[_0xa0c3('0xd')](function(_0x1ffddd){logger[_0xa0c3('0xe')](_0xa0c3('0xf'),_0x5a20fa,_0xa0c3('0x10'));logger[_0xa0c3('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5a20fa,_0xa0c3('0x10'),JSON[_0xa0c3('0x12')](_0x1ffddd));if(_0x1ffddd['error']){if(_0x1ffddd[_0xa0c3('0x13')][_0xa0c3('0x14')]===0x1f4){logger[_0xa0c3('0x13')](_0xa0c3('0xf'),_0x5a20fa,_0x1ffddd[_0xa0c3('0x13')]['message']);return _0x588326(_0x1ffddd[_0xa0c3('0x13')]['message']);}logger[_0xa0c3('0x13')](_0xa0c3('0xf'),_0x5a20fa,_0x1ffddd[_0xa0c3('0x13')][_0xa0c3('0x15')]);return _0x448399(_0x1ffddd['error'][_0xa0c3('0x15')]);}else{logger['info'](_0xa0c3('0xf'),_0x5a20fa,_0xa0c3('0x10'));_0x448399(_0x1ffddd['result']['message']);}})[_0xa0c3('0x16')](function(_0x494776){logger[_0xa0c3('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5a20fa,_0x494776);_0x588326(_0x494776);});});} \ No newline at end of file +var _0x43fa=['http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x43fa,0x170));var _0xa43f=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0x43fa[_0x168127];return _0x4c99ad;};'use strict';var _=require(_0xa43f('0x0'));var util=require(_0xa43f('0x1'));var moment=require(_0xa43f('0x2'));var BPromise=require(_0xa43f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa43f('0x4'));var db=require(_0xa43f('0x5'))['db'];var utils=require(_0xa43f('0x6'));var logger=require('../../config/logger')(_0xa43f('0x7'));var config=require('../../config/environment');var jayson=require(_0xa43f('0x8'));var client=jayson[_0xa43f('0x9')][_0xa43f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f288a,_0x5f0dd0,_0x2b8e65){return new BPromise(function(_0x5025b5,_0x20d1c6){return client[_0xa43f('0xb')](_0x4f288a,_0x2b8e65)[_0xa43f('0xc')](function(_0xee5ff){logger[_0xa43f('0xd')](_0xa43f('0xe'),_0x5f0dd0,_0xa43f('0xf'));logger[_0xa43f('0x10')](_0xa43f('0x11'),_0x5f0dd0,'request\x20sent',JSON[_0xa43f('0x12')](_0xee5ff));if(_0xee5ff['error']){if(_0xee5ff['error']['code']===0x1f4){logger['error'](_0xa43f('0xe'),_0x5f0dd0,_0xee5ff[_0xa43f('0x13')][_0xa43f('0x14')]);return _0x20d1c6(_0xee5ff[_0xa43f('0x13')][_0xa43f('0x14')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5f0dd0,_0xee5ff[_0xa43f('0x13')][_0xa43f('0x14')]);return _0x5025b5(_0xee5ff[_0xa43f('0x13')][_0xa43f('0x14')]);}else{logger['info'](_0xa43f('0xe'),_0x5f0dd0,_0xa43f('0xf'));_0x5025b5(_0xee5ff['result'][_0xa43f('0x14')]);}})['catch'](function(_0x3c7f8c){logger[_0xa43f('0x13')](_0xa43f('0xe'),_0x5f0dd0,_0x3c7f8c);_0x20d1c6(_0x3c7f8c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 19bc8fb..0f05ffd 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 _0xf3da=['get','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','/:id/clone','clone','put','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','/:id','show'];(function(_0x2a1a9c,_0xad16c0){var _0x4a5c35=function(_0x58ae1f){while(--_0x58ae1f){_0x2a1a9c['push'](_0x2a1a9c['shift']());}};_0x4a5c35(++_0xad16c0);}(_0xf3da,0x12c));var _0xaf3d=function(_0xec53e7,_0x4ba16b){_0xec53e7=_0xec53e7-0x0;var _0x323257=_0xf3da[_0xec53e7];return _0x323257;};'use strict';var multer=require(_0xaf3d('0x0'));var util=require(_0xaf3d('0x1'));var path=require(_0xaf3d('0x2'));var timeout=require(_0xaf3d('0x3'));var express=require('express');var router=express[_0xaf3d('0x4')]();var auth=require(_0xaf3d('0x5'));var interaction=require(_0xaf3d('0x6'));var config=require(_0xaf3d('0x7'));var controller=require(_0xaf3d('0x8'));router['get']('/',auth[_0xaf3d('0x9')](),controller['index']);router['get'](_0xaf3d('0xa'),auth[_0xaf3d('0x9')](),controller[_0xaf3d('0xb')]);router[_0xaf3d('0xc')]('/:id/sessions',auth[_0xaf3d('0x9')](),controller[_0xaf3d('0xd')]);router[_0xaf3d('0xc')](_0xaf3d('0xe'),auth[_0xaf3d('0x9')](),controller[_0xaf3d('0xf')]);router['get'](_0xaf3d('0x10'),auth[_0xaf3d('0x9')](),timeout(_0xaf3d('0x11')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xaf3d('0x12')](_0xaf3d('0x13'),auth[_0xaf3d('0x9')](),controller[_0xaf3d('0x14')]);router[_0xaf3d('0x15')](_0xaf3d('0xa'),auth['isAuthenticated'](),controller[_0xaf3d('0x16')]);router['delete'](_0xaf3d('0xa'),auth[_0xaf3d('0x9')](),controller[_0xaf3d('0x17')]);module['exports']=router; \ No newline at end of file +var _0x20de=['/:id/sessions','getSessions','/:id/answers','getAnswers','30s','post','/:id/clone','clone','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','isAuthenticated','show'];(function(_0xd5426a,_0x23c659){var _0xb9cfc5=function(_0x4cd3b3){while(--_0x4cd3b3){_0xd5426a['push'](_0xd5426a['shift']());}};_0xb9cfc5(++_0x23c659);}(_0x20de,0x1ce));var _0xe20d=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x20de[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0xe20d('0x0'));var util=require(_0xe20d('0x1'));var path=require(_0xe20d('0x2'));var timeout=require(_0xe20d('0x3'));var express=require(_0xe20d('0x4'));var router=express[_0xe20d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe20d('0x6'));var config=require(_0xe20d('0x7'));var controller=require(_0xe20d('0x8'));router[_0xe20d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe20d('0x9')](_0xe20d('0xa'),auth[_0xe20d('0xb')](),controller[_0xe20d('0xc')]);router[_0xe20d('0x9')](_0xe20d('0xd'),auth[_0xe20d('0xb')](),controller[_0xe20d('0xe')]);router[_0xe20d('0x9')](_0xe20d('0xf'),auth[_0xe20d('0xb')](),controller[_0xe20d('0x10')]);router[_0xe20d('0x9')]('/:id/summary',auth['isAuthenticated'](),timeout(_0xe20d('0x11')),controller['getSummary']);router[_0xe20d('0x12')]('/',auth[_0xe20d('0xb')](),controller['create']);router[_0xe20d('0x12')](_0xe20d('0x13'),auth[_0xe20d('0xb')](),controller[_0xe20d('0x14')]);router[_0xe20d('0x15')]('/:id',auth[_0xe20d('0xb')](),controller[_0xe20d('0x16')]);router[_0xe20d('0x17')]('/:id',auth[_0xe20d('0xb')](),controller[_0xe20d('0x18')]);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 3ff2652..829b281 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 _0xb2ed=['stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','exports','STRING','TEXT','long','isObjectLike','formData'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xb2ed,0xca));var _0xdb2e=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0xb2ed[_0x2d6197];return _0x4d0e75;};'use strict';var Sequelize=require(_0xdb2e('0x0'));var _=require('lodash');var util=require(_0xdb2e('0x1'));module[_0xdb2e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xdb2e('0x3')]},'formData':{'type':Sequelize[_0xdb2e('0x4')](_0xdb2e('0x5')),'set':function(_0x227bd6){if(_[_0xdb2e('0x6')](_0x227bd6)){this['setDataValue'](_0xdb2e('0x7'),JSON[_0xdb2e('0x8')](_0x227bd6));}else if(_[_0xdb2e('0x9')](_0x227bd6)){this[_0xdb2e('0xa')](_0xdb2e('0x7'),_0x227bd6);}else{this[_0xdb2e('0xa')](_0xdb2e('0x7'),util[_0xdb2e('0xb')](_0xdb2e('0xc'),this[_0xdb2e('0xd')]('name')||'',this[_0xdb2e('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xdb2e('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xdb2e('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xe5fb=['setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','name','STRING','TEXT','isObjectLike','formData','stringify','isString'];(function(_0x1c1a84,_0x4d7e21){var _0x383641=function(_0x44f340){while(--_0x44f340){_0x1c1a84['push'](_0x1c1a84['shift']());}};_0x383641(++_0x4d7e21);}(_0xe5fb,0x1d6));var _0xbe5f=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xe5fb[_0x51b0dc];return _0x13fa89;};'use strict';var Sequelize=require(_0xbe5f('0x0'));var _=require(_0xbe5f('0x1'));var util=require(_0xbe5f('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbe5f('0x3')},'description':{'type':Sequelize[_0xbe5f('0x4')]},'formData':{'type':Sequelize[_0xbe5f('0x5')]('long'),'set':function(_0x42cabf){if(_[_0xbe5f('0x6')](_0x42cabf)){this['setDataValue'](_0xbe5f('0x7'),JSON[_0xbe5f('0x8')](_0x42cabf));}else if(_[_0xbe5f('0x9')](_0x42cabf)){this[_0xbe5f('0xa')](_0xbe5f('0x7'),_0x42cabf);}else{this[_0xbe5f('0xa')](_0xbe5f('0x7'),util[_0xbe5f('0xb')](_0xbe5f('0xc'),this[_0xbe5f('0xd')](_0xbe5f('0x3'))||'',this[_0xbe5f('0xd')](_0xbe5f('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xbe5f('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 93566bf..3347722 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 _0xf823=['lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','sendStatus','error','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','userProfileId','getSessions','findOne','JscriptySessionReport','ProjectId','rows','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','answer','isEmpty','now','writeFileSync','format','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x120283,_0x3fe3bf){var _0x37dfa3=function(_0x58ae25){while(--_0x58ae25){_0x120283['push'](_0x120283['shift']());}};_0x37dfa3(++_0x3fe3bf);}(_0xf823,0x1d2));var _0x3f82=function(_0x5c24e3,_0x995479){_0x5c24e3=_0x5c24e3-0x0;var _0x3322ee=_0xf823[_0x5c24e3];return _0x3322ee;};'use strict';var pdf=require(_0x3f82('0x0'));var emlformat=require(_0x3f82('0x1'));var rimraf=require(_0x3f82('0x2'));var zipdir=require(_0x3f82('0x3'));var jsonpatch=require(_0x3f82('0x4'));var rp=require(_0x3f82('0x5'));var moment=require(_0x3f82('0x6'));var BPromise=require(_0x3f82('0x7'));var Mustache=require(_0x3f82('0x8'));var util=require(_0x3f82('0x9'));var path=require(_0x3f82('0xa'));var sox=require(_0x3f82('0xb'));var csv=require(_0x3f82('0xc'));var ejs=require(_0x3f82('0xd'));var fs=require('fs');var _=require(_0x3f82('0xe'));var squel=require(_0x3f82('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3f82('0x10'));var toCsv=require(_0x3f82('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f82('0x11'));var authService=require(_0x3f82('0x12'));var qs=require(_0x3f82('0x13'));var as=require(_0x3f82('0x14'));var hardwareService=require(_0x3f82('0x15'));var logger=require(_0x3f82('0x16'))(_0x3f82('0x17'));var utils=require(_0x3f82('0x18'));var config=require('../../config/environment');var db=require(_0x3f82('0x19'))['db'];function respondWithStatusCode(_0xf10c21,_0x1732c7){_0x1732c7=_0x1732c7||0xcc;return function(_0x53a886){if(_0x53a886){return _0xf10c21['sendStatus'](_0x1732c7);}return _0xf10c21['status'](_0x1732c7)['end']();};}function respondWithResult(_0x42d6d3,_0x56e59a){_0x56e59a=_0x56e59a||0xc8;return function(_0x3da05d){if(_0x3da05d){return _0x42d6d3[_0x3f82('0x1a')](_0x56e59a)['json'](_0x3da05d);}};}function respondWithFilteredResult(_0x3fda48,_0x111f3e){return function(_0x3f42a0){if(_0x3f42a0){var _0x40e974=_0x3f42a0['count'],_0x25f2f6=_0x111f3e[_0x3f82('0x1b')],_0x1d7a39=_0x111f3e[_0x3f82('0x1b')]+_0x111f3e['limit'],_0x2c752d;if(_0x1d7a39>=_0x40e974){_0x1d7a39=_0x40e974;_0x2c752d=0xc8;}else{_0x2c752d=0xce;}_0x3fda48['status'](_0x2c752d);return _0x3fda48[_0x3f82('0x1c')](_0x3f82('0x1d'),_0x25f2f6+'-'+_0x1d7a39+'/'+_0x40e974)[_0x3f82('0x1e')](_0x3f42a0);}return null;};}function patchUpdates(_0x55a3d5){return function(_0x7f6c02){try{jsonpatch[_0x3f82('0x1f')](_0x7f6c02,_0x55a3d5,!![]);}catch(_0x36a74a){return BPromise[_0x3f82('0x20')](_0x36a74a);}return _0x7f6c02[_0x3f82('0x21')]();};}function saveUpdates(_0x5677b4,_0x2ea29b){return function(_0x541328){if(_0x541328){return _0x541328[_0x3f82('0x22')](_0x5677b4)[_0x3f82('0x23')](function(_0x86cc7c){return _0x86cc7c;});}return null;};}function removeEntity(_0xc00057,_0x28bfef){return function(_0x259185){if(_0x259185){return _0x259185[_0x3f82('0x24')]()['then'](function(){var _0x52ef55=_0x259185[_0x3f82('0x25')]({'plain':!![]});var _0x192eed=_0x3f82('0x26');return db[_0x3f82('0x27')][_0x3f82('0x24')]({'where':{'type':_0x192eed,'resourceId':_0x52ef55['id']}})[_0x3f82('0x23')](function(){return _0x259185;});})['then'](function(){_0xc00057[_0x3f82('0x1a')](0xcc)[_0x3f82('0x28')]();});}};}function handleEntityNotFound(_0x46734e,_0xbff944){return function(_0x3e5a79){if(!_0x3e5a79){_0x46734e[_0x3f82('0x29')](0x194);}return _0x3e5a79;};}function handleError(_0x38baa6,_0x529861){_0x529861=_0x529861||0x1f4;return function(_0x504a7d){logger[_0x3f82('0x2a')](_0x504a7d['stack']);if(_0x504a7d[_0x3f82('0x2b')]){delete _0x504a7d[_0x3f82('0x2b')];}_0x38baa6[_0x3f82('0x1a')](_0x529861)[_0x3f82('0x2c')](_0x504a7d);};}exports['index']=function(_0x29ac84,_0x39401c){var _0x265160={},_0x53d204={},_0xdf43db={'count':0x0,'rows':[]};var _0x2ffe48=_[_0x3f82('0x2d')](db[_0x3f82('0x2e')][_0x3f82('0x2f')],function(_0x9bb142){return{'name':_0x9bb142[_0x3f82('0x30')],'type':_0x9bb142[_0x3f82('0x31')][_0x3f82('0x32')]};});_0x53d204['model']=_[_0x3f82('0x2d')](_0x2ffe48,_0x3f82('0x2b'));_0x53d204['query']=_['keys'](_0x29ac84[_0x3f82('0x33')]);_0x53d204['filters']=_[_0x3f82('0x34')](_0x53d204['model'],_0x53d204['query']);_0x265160[_0x3f82('0x35')]=_['intersection'](_0x53d204[_0x3f82('0x36')],qs['fields'](_0x29ac84[_0x3f82('0x33')][_0x3f82('0x37')]));_0x265160[_0x3f82('0x35')]=_0x265160['attributes'][_0x3f82('0x38')]?_0x265160[_0x3f82('0x35')]:_0x53d204[_0x3f82('0x36')];if(!_0x29ac84[_0x3f82('0x33')][_0x3f82('0x39')](_0x3f82('0x3a'))){_0x265160[_0x3f82('0x3b')]=qs[_0x3f82('0x3b')](_0x29ac84[_0x3f82('0x33')][_0x3f82('0x3b')]);_0x265160['offset']=qs[_0x3f82('0x1b')](_0x29ac84[_0x3f82('0x33')][_0x3f82('0x1b')]);}_0x265160[_0x3f82('0x3c')]=qs[_0x3f82('0x3d')](_0x29ac84[_0x3f82('0x33')][_0x3f82('0x3d')]);_0x265160['where']=qs['filters'](_[_0x3f82('0x3e')](_0x29ac84[_0x3f82('0x33')],_0x53d204[_0x3f82('0x3f')]),_0x2ffe48);if(_0x29ac84[_0x3f82('0x33')]['filter']){_0x265160[_0x3f82('0x40')]=_[_0x3f82('0x41')](_0x265160[_0x3f82('0x40')],{'$or':_['map'](_0x2ffe48,function(_0x542555){if(_0x542555[_0x3f82('0x31')]!==_0x3f82('0x42')){var _0xd0f7ed={};_0xd0f7ed[_0x542555['name']]={'$like':'%'+_0x29ac84['query'][_0x3f82('0x43')]+'%'};return _0xd0f7ed;}})});}_0x265160=_[_0x3f82('0x41')]({},_0x265160,_0x29ac84[_0x3f82('0x44')]);var _0x34ad5b={'where':_0x265160['where']};return db[_0x3f82('0x2e')][_0x3f82('0x45')](_0x34ad5b)[_0x3f82('0x23')](function(_0x7a9ccd){_0xdf43db[_0x3f82('0x45')]=_0x7a9ccd;if(_0x29ac84[_0x3f82('0x33')][_0x3f82('0x46')]){_0x265160[_0x3f82('0x47')]=[{'all':!![]}];}return db[_0x3f82('0x2e')][_0x3f82('0x48')](_0x265160);})[_0x3f82('0x23')](function(_0x4bb6cc){_0xdf43db['rows']=_0x4bb6cc;return _0xdf43db;})[_0x3f82('0x23')](respondWithFilteredResult(_0x39401c,_0x265160))['catch'](handleError(_0x39401c,null));};exports['show']=function(_0x170e47,_0x587de7){var _0x2732c7={'raw':![],'where':{'id':_0x170e47[_0x3f82('0x49')]['id']}},_0x354241={};_0x354241['model']=_[_0x3f82('0x4a')](db['JscriptyProject'][_0x3f82('0x2f')]);_0x354241['query']=_[_0x3f82('0x4a')](_0x170e47[_0x3f82('0x33')]);_0x354241['filters']=_[_0x3f82('0x34')](_0x354241['model'],_0x354241['query']);_0x2732c7[_0x3f82('0x35')]=_[_0x3f82('0x34')](_0x354241[_0x3f82('0x36')],qs[_0x3f82('0x37')](_0x170e47['query'][_0x3f82('0x37')]));_0x2732c7[_0x3f82('0x35')]=_0x2732c7[_0x3f82('0x35')]['length']?_0x2732c7[_0x3f82('0x35')]:_0x354241[_0x3f82('0x36')];if(_0x170e47[_0x3f82('0x33')]['includeAll']){_0x2732c7['include']=[{'all':!![]}];}_0x2732c7=_[_0x3f82('0x41')]({},_0x2732c7,_0x170e47[_0x3f82('0x44')]);return db['JscriptyProject'][_0x3f82('0x4b')](_0x2732c7)['then'](handleEntityNotFound(_0x587de7,null))['then'](respondWithResult(_0x587de7,null))['catch'](handleError(_0x587de7,null));};exports['create']=function(_0x2b22c2,_0x1e4de1){return db[_0x3f82('0x2e')][_0x3f82('0x4c')](_0x2b22c2[_0x3f82('0x4d')],{})[_0x3f82('0x23')](function(_0x4ea230){var _0x23933f=_0x2b22c2[_0x3f82('0x4e')][_0x3f82('0x25')]({'plain':!![]});if(!_0x23933f)throw new Error(_0x3f82('0x4f'));if(_0x23933f[_0x3f82('0x50')]===_0x3f82('0x4e')){var _0x15814e=_0x4ea230[_0x3f82('0x25')]({'plain':!![]});var _0x433cda='Projects';return db[_0x3f82('0x51')][_0x3f82('0x4b')]({'where':{'name':_0x433cda,'userProfileId':_0x23933f['userProfileId']},'raw':!![]})[_0x3f82('0x23')](function(_0x47a475){if(_0x47a475&&_0x47a475[_0x3f82('0x52')]===0x0){return db[_0x3f82('0x27')][_0x3f82('0x4c')]({'name':_0x15814e[_0x3f82('0x2b')],'resourceId':_0x15814e['id'],'type':_0x47a475['name'],'sectionId':_0x47a475['id']},{})[_0x3f82('0x23')](function(){return _0x4ea230;});}else{return _0x4ea230;}})[_0x3f82('0x53')](function(_0x470ce1){logger[_0x3f82('0x2a')](_0x3f82('0x54'),_0x470ce1);throw _0x470ce1;});}return _0x4ea230;})[_0x3f82('0x23')](respondWithResult(_0x1e4de1,0xc9))[_0x3f82('0x53')](handleError(_0x1e4de1,null));};exports['clone']=function(_0x50c0b3,_0x2003fa){var _0x2ed813={'where':{'id':_0x50c0b3[_0x3f82('0x49')]['id']}},_0x13f29e={};_0x13f29e[_0x3f82('0x36')]=_[_0x3f82('0x4a')](db['JscriptyProject'][_0x3f82('0x2f')]);_0x2ed813[_0x3f82('0x35')]=_['intersection'](_0x13f29e['model'],qs[_0x3f82('0x37')](_0x50c0b3['query'][_0x3f82('0x37')]));_0x2ed813['attributes']=_0x2ed813['attributes'][_0x3f82('0x38')]?_0x2ed813['attributes']:_0x13f29e[_0x3f82('0x36')];if(_0x50c0b3[_0x3f82('0x33')][_0x3f82('0x46')]){_0x2ed813[_0x3f82('0x47')]=[{'all':!![]}];}_0x2ed813=_['merge']({},_0x2ed813,_0x50c0b3[_0x3f82('0x44')]);return db['JscriptyProject'][_0x3f82('0x4b')](_0x2ed813)['then'](handleEntityNotFound(_0x2003fa,null))[_0x3f82('0x23')](function(_0x2da582){if(_0x2da582){var _0x219e24=_0x2da582[_0x3f82('0x25')]({'plain':!![]});_0x219e24=qs[_0x3f82('0x55')](_0x219e24,['id','createdAt','updatedAt']);_0x50c0b3['body']=_[_0x3f82('0x55')](_0x50c0b3[_0x3f82('0x4d')],['id',_0x3f82('0x56'),_0x3f82('0x57')]);return db['JscriptyProject'][_0x3f82('0x4c')](_[_0x3f82('0x41')](_0x219e24,_0x50c0b3[_0x3f82('0x4d')]),{'include':_0x50c0b3[_0x3f82('0x33')][_0x3f82('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x44424a){var _0x10abad=_0x50c0b3[_0x3f82('0x4e')][_0x3f82('0x25')]({'plain':!![]});if(!_0x10abad)throw new Error(_0x3f82('0x4f'));if(_0x10abad['role']==='user'){var _0x5cdda3=_0x44424a[_0x3f82('0x25')]({'plain':!![]});var _0x5bfb20=_0x3f82('0x26');return db[_0x3f82('0x51')][_0x3f82('0x4b')]({'where':{'name':_0x5bfb20,'userProfileId':_0x10abad[_0x3f82('0x58')]},'raw':!![]})[_0x3f82('0x23')](function(_0x3821cf){if(_0x3821cf&&_0x3821cf[_0x3f82('0x52')]===0x0){return db[_0x3f82('0x27')]['create']({'name':_0x5cdda3[_0x3f82('0x2b')],'resourceId':_0x5cdda3['id'],'type':_0x3821cf[_0x3f82('0x2b')],'sectionId':_0x3821cf['id']},{})[_0x3f82('0x23')](function(){return _0x44424a;});}else{return _0x44424a;}})[_0x3f82('0x53')](function(_0x38c91a){logger[_0x3f82('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c91a);throw _0x38c91a;});}return _0x44424a;});}})[_0x3f82('0x23')](respondWithResult(_0x2003fa,0xc9))[_0x3f82('0x53')](handleError(_0x2003fa,null));};exports[_0x3f82('0x22')]=function(_0x6cf6eb,_0x27ffe0){if(_0x6cf6eb['body']['id']){delete _0x6cf6eb['body']['id'];}return db[_0x3f82('0x2e')][_0x3f82('0x4b')]({'where':{'id':_0x6cf6eb[_0x3f82('0x49')]['id']}})['then'](handleEntityNotFound(_0x27ffe0,null))[_0x3f82('0x23')](saveUpdates(_0x6cf6eb[_0x3f82('0x4d')],null))['then'](respondWithResult(_0x27ffe0,null))['catch'](handleError(_0x27ffe0,null));};exports[_0x3f82('0x24')]=function(_0x31ee54,_0x453a82){return db['JscriptyProject']['find']({'where':{'id':_0x31ee54[_0x3f82('0x49')]['id']}})[_0x3f82('0x23')](handleEntityNotFound(_0x453a82,null))[_0x3f82('0x23')](removeEntity(_0x453a82,null))[_0x3f82('0x53')](handleError(_0x453a82,null));};exports[_0x3f82('0x59')]=function(_0x2387b3,_0x1e9074,_0x22550d){var _0x17db28={'raw':!![],'where':{}};var _0x5c6cc4={};var _0x269ed9={'count':0x0,'rows':[]};return db[_0x3f82('0x2e')][_0x3f82('0x5a')]({'where':{'id':_0x2387b3[_0x3f82('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e9074,null))[_0x3f82('0x23')](function(_0x48c3c8){if(_0x48c3c8){_0x5c6cc4[_0x3f82('0x36')]=_[_0x3f82('0x4a')](db[_0x3f82('0x5b')][_0x3f82('0x2f')]);_0x5c6cc4[_0x3f82('0x33')]=_[_0x3f82('0x4a')](_0x2387b3[_0x3f82('0x33')]);_0x5c6cc4[_0x3f82('0x3f')]=_[_0x3f82('0x34')](_0x5c6cc4[_0x3f82('0x36')],_0x5c6cc4['query']);_0x17db28[_0x3f82('0x35')]=_[_0x3f82('0x34')](_0x5c6cc4[_0x3f82('0x36')],qs[_0x3f82('0x37')](_0x2387b3['query']['fields']));_0x17db28[_0x3f82('0x35')]=_0x17db28['attributes'][_0x3f82('0x38')]?_0x17db28[_0x3f82('0x35')]:_0x5c6cc4[_0x3f82('0x36')];if(!_0x2387b3[_0x3f82('0x33')][_0x3f82('0x39')](_0x3f82('0x3a'))){_0x17db28['limit']=qs['limit'](_0x2387b3[_0x3f82('0x33')][_0x3f82('0x3b')]);_0x17db28['offset']=qs[_0x3f82('0x1b')](_0x2387b3[_0x3f82('0x33')][_0x3f82('0x1b')]);}_0x17db28[_0x3f82('0x3c')]=qs[_0x3f82('0x3d')](_0x2387b3[_0x3f82('0x33')]['sort']);_0x17db28[_0x3f82('0x40')]=qs[_0x3f82('0x3f')](_['pick'](_0x2387b3[_0x3f82('0x33')],_0x5c6cc4[_0x3f82('0x3f')]));_0x17db28[_0x3f82('0x40')][_0x3f82('0x5c')]=_0x48c3c8['id'];if(_0x2387b3[_0x3f82('0x33')][_0x3f82('0x43')]){_0x17db28['where']=_[_0x3f82('0x41')](_0x17db28['where'],{'$or':_[_0x3f82('0x2d')](_0x17db28['attributes'],function(_0x10b16b){var _0x3d2fbf={};_0x3d2fbf[_0x10b16b]={'$like':'%'+_0x2387b3[_0x3f82('0x33')][_0x3f82('0x43')]+'%'};return _0x3d2fbf;})});}_0x17db28=_[_0x3f82('0x41')]({},_0x17db28,_0x2387b3[_0x3f82('0x44')]);return db[_0x3f82('0x5b')]['count']({'where':_0x17db28[_0x3f82('0x40')]})['then'](function(_0x3ccc61){_0x269ed9['count']=_0x3ccc61;if(_0x2387b3['query'][_0x3f82('0x46')]){_0x17db28[_0x3f82('0x47')]=[{'all':!![]}];}return db[_0x3f82('0x5b')][_0x3f82('0x48')](_0x17db28);})[_0x3f82('0x23')](function(_0x2f9fb4){_0x269ed9[_0x3f82('0x5d')]=_0x2f9fb4;return _0x269ed9;});}})['then'](respondWithFilteredResult(_0x1e9074,_0x17db28))[_0x3f82('0x53')](handleError(_0x1e9074,null));};exports['getAnswers']=function(_0x23dbd9,_0x3b9af5,_0x1b268a){var _0x23453b={'raw':!![],'where':{}};var _0x5c753b={};var _0x585db={'count':0x0,'rows':[]};return db[_0x3f82('0x2e')]['findOne']({'where':{'id':_0x23dbd9[_0x3f82('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b9af5,null))['then'](function(_0x475cc9){if(_0x475cc9){_0x5c753b['model']=_['keys'](db[_0x3f82('0x5e')][_0x3f82('0x2f')]);_0x5c753b[_0x3f82('0x33')]=_[_0x3f82('0x4a')](_0x23dbd9[_0x3f82('0x33')]);_0x5c753b['filters']=_[_0x3f82('0x34')](_0x5c753b[_0x3f82('0x36')],_0x5c753b[_0x3f82('0x33')]);_0x23453b['attributes']=_[_0x3f82('0x34')](_0x5c753b[_0x3f82('0x36')],qs['fields'](_0x23dbd9[_0x3f82('0x33')][_0x3f82('0x37')]));_0x23453b[_0x3f82('0x35')]=_0x23453b['attributes']['length']?_0x23453b['attributes']:_0x5c753b[_0x3f82('0x36')];if(!_0x23dbd9[_0x3f82('0x33')]['hasOwnProperty'](_0x3f82('0x3a'))){_0x23453b['limit']=qs[_0x3f82('0x3b')](_0x23dbd9[_0x3f82('0x33')][_0x3f82('0x3b')]);_0x23453b[_0x3f82('0x1b')]=qs[_0x3f82('0x1b')](_0x23dbd9[_0x3f82('0x33')][_0x3f82('0x1b')]);}_0x23453b[_0x3f82('0x3c')]=qs[_0x3f82('0x3d')](_0x23dbd9[_0x3f82('0x33')][_0x3f82('0x3d')]);_0x23453b[_0x3f82('0x40')]=qs[_0x3f82('0x3f')](_['pick'](_0x23dbd9[_0x3f82('0x33')],_0x5c753b[_0x3f82('0x3f')]));_0x23453b[_0x3f82('0x40')][_0x3f82('0x5c')]=_0x475cc9['id'];if(_0x23dbd9[_0x3f82('0x33')]['filter']){_0x23453b[_0x3f82('0x40')]=_[_0x3f82('0x41')](_0x23453b['where'],{'$or':_[_0x3f82('0x2d')](_0x23453b['attributes'],function(_0x3e8241){var _0x591faf={};_0x591faf[_0x3e8241]={'$like':'%'+_0x23dbd9[_0x3f82('0x33')]['filter']+'%'};return _0x591faf;})});}_0x23453b=_[_0x3f82('0x41')]({},_0x23453b,_0x23dbd9[_0x3f82('0x44')]);return db['JscriptyAnswerReport'][_0x3f82('0x45')]({'where':_0x23453b['where']})['then'](function(_0x5413e8){_0x585db[_0x3f82('0x45')]=_0x5413e8;if(_0x23dbd9[_0x3f82('0x33')]['includeAll']){_0x23453b[_0x3f82('0x47')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3f82('0x48')](_0x23453b);})['then'](function(_0x54a8de){_0x585db[_0x3f82('0x5d')]=_0x54a8de;return _0x585db;});}})[_0x3f82('0x23')](respondWithFilteredResult(_0x3b9af5,_0x23453b))['catch'](handleError(_0x3b9af5,null));};function char(_0x2a53b8){return _0x3f82('0x5f')===typeof _0x2a53b8?String[_0x3f82('0x60')][_0x3f82('0x1f')](null,arguments):_0x2a53b8;}function needsEncapsulation(_0x17c76d){return!!_0x17c76d&&(_0x17c76d['toString']()[_0x3f82('0x61')](char(0xd))>=0x0||_0x17c76d[_0x3f82('0x62')]()['indexOf'](char(0xa))>=0x0||_0x17c76d[_0x3f82('0x62')]()[_0x3f82('0x61')](char(0x2c))>=0x0||_0x17c76d['toString']()[_0x3f82('0x61')](char(0x22))>=0x0);}function encapsulate(_0xd57c4a){var _0x5c54e0=char(0x22),_0x41794d='\x5c'+char(0x22),_0x45a5dc=_0xd57c4a[_0x3f82('0x62')]()[_0x3f82('0x63')](new RegExp(_0x5c54e0,'g'),_0x41794d);return _0x5c54e0+_0x45a5dc+_0x5c54e0;}exports[_0x3f82('0x64')]=function(_0x34a9f2,_0x42a46d,_0x30c37a){var _0x1663de,_0x2d87d1;var _0x1ad01e={'where':{'ProjectId':_0x34a9f2[_0x3f82('0x49')]['id']}};if(_0x34a9f2[_0x3f82('0x33')][_0x3f82('0x65')]){_0x1ad01e['where'][_0x3f82('0x66')]=JSON[_0x3f82('0x67')](_0x34a9f2['query'][_0x3f82('0x65')]);}return db[_0x3f82('0x5b')][_0x3f82('0x48')](_0x1ad01e)[_0x3f82('0x23')](handleEntityNotFound(_0x42a46d,null))['then'](function(_0x83f5bf){if(_0x83f5bf){_0x1663de=_0x83f5bf;return db[_0x3f82('0x68')][_0x3f82('0x48')]({'where':{'SessionId':{'$in':_[_0x3f82('0x2d')](_0x1663de,'id')},'ProjectId':_0x34a9f2[_0x3f82('0x49')]['id']},'order':_0x3f82('0x69')});}})[_0x3f82('0x23')](handleEntityNotFound(_0x42a46d,null))['then'](function(_0x501419){if(_0x501419){_0x2d87d1=_0x501419;var _0x2f645b={};for(var _0x100c61=0x0,_0x39436a=_0x2d87d1[_0x3f82('0x38')];_0x100c61<_0x39436a;_0x100c61++){if(!_0x2f645b[_0x3f82('0x39')](_0x2d87d1[_0x100c61]['questionId'])){_0x2f645b[_0x2d87d1[_0x100c61][_0x3f82('0x6a')]]=needsEncapsulation(_0x2d87d1[_0x100c61][_0x3f82('0x6b')])?encapsulate(_0x2d87d1[_0x100c61][_0x3f82('0x6b')]):_0x2d87d1[_0x100c61]['question'];}}var _0x4200f8=[],_0x3916db={};for(var _0x43bea9=0x0,_0xb8ba27=_0x1663de[_0x3f82('0x38')];_0x43bea9<_0xb8ba27;_0x43bea9++){_0x3916db={'ProjectId':_0x34a9f2[_0x3f82('0x49')]['id'],'SessionId':_0x1663de[_0x43bea9]['id'],'StartTime':moment(_0x1663de[_0x43bea9][_0x3f82('0x66')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x32cd24=0x0,_0x2aaccc=_0x2d87d1[_0x3f82('0x38')];_0x32cd24<_0x2aaccc;_0x32cd24++){if(_0x2d87d1[_0x32cd24]['SessionId']==_0x1663de[_0x43bea9]['id']&&_0x2f645b[_0x3f82('0x39')](_0x2d87d1[_0x32cd24][_0x3f82('0x6a')])){_0x3916db[_0x2f645b[_0x2d87d1[_0x32cd24][_0x3f82('0x6a')]]]=_0x2d87d1[_0x32cd24][_0x3f82('0x6c')];}}for(var _0x1d928d in _0x2f645b){if(!_0x3916db[_0x3f82('0x39')](_0x2f645b[_0x1d928d])){_0x3916db[_0x2f645b[_0x1d928d]]=null;}}_0x4200f8['push'](_0x3916db);}return _0x4200f8;}})[_0x3f82('0x23')](function(_0x26dd46){if(!_[_0x3f82('0x6d')](_0x26dd46)){var _0x3f46e0=toCsv(_0x26dd46);var _0x435c79=Date[_0x3f82('0x6e')]();fs[_0x3f82('0x6f')](util[_0x3f82('0x70')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x34a9f2[_0x3f82('0x49')]['id'],_0x435c79),_0x3f46e0);_0x42a46d['setHeader'](_0x3f82('0x71'),_0x3f82('0x72')+util[_0x3f82('0x70')](_0x3f82('0x73'),_0x34a9f2[_0x3f82('0x49')]['id'],_0x435c79));_0x42a46d['setHeader'](_0x3f82('0x74'),_0x3f82('0x75'));return _0x42a46d[_0x3f82('0x76')](util[_0x3f82('0x70')](_0x3f82('0x77'),_0x34a9f2[_0x3f82('0x49')]['id'],_0x435c79));}else{return _0x42a46d['sendStatus'](0xcc);}})[_0x3f82('0x53')](handleError(_0x42a46d,null));}; \ No newline at end of file +var _0x7ba8=['crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','createdAt','updatedAt','userProfileId','update','findOne','JscriptySessionReport','pick','getAnswers','JscriptyAnswerReport','ProjectId','fromCharCode','indexOf','toString','replace','parse','startTime','JscriptyQuestionReport','-createdAt','question','starttime','format','SessionId','questionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel'];(function(_0xe49c0e,_0x66770d){var _0x3baea1=function(_0x4e9a3a){while(--_0x4e9a3a){_0xe49c0e['push'](_0xe49c0e['shift']());}};_0x3baea1(++_0x66770d);}(_0x7ba8,0xdd));var _0x87ba=function(_0x361892,_0x5b3cce){_0x361892=_0x361892-0x0;var _0x18493a=_0x7ba8[_0x361892];return _0x18493a;};'use strict';var pdf=require(_0x87ba('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x87ba('0x1'));var jsonpatch=require(_0x87ba('0x2'));var rp=require(_0x87ba('0x3'));var moment=require(_0x87ba('0x4'));var BPromise=require(_0x87ba('0x5'));var Mustache=require('mustache');var util=require(_0x87ba('0x6'));var path=require(_0x87ba('0x7'));var sox=require(_0x87ba('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x87ba('0x9'));var squel=require(_0x87ba('0xa'));var crypto=require(_0x87ba('0xb'));var jsforce=require(_0x87ba('0xc'));var deskjs=require(_0x87ba('0xd'));var toCsv=require(_0x87ba('0xe'));var querystring=require(_0x87ba('0xf'));var Papa=require('papaparse');var Redis=require(_0x87ba('0x10'));var authService=require(_0x87ba('0x11'));var qs=require(_0x87ba('0x12'));var as=require(_0x87ba('0x13'));var hardwareService=require(_0x87ba('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x87ba('0x15'));var config=require('../../config/environment');var db=require(_0x87ba('0x16'))['db'];function respondWithStatusCode(_0x552137,_0x43869d){_0x43869d=_0x43869d||0xcc;return function(_0x27a349){if(_0x27a349){return _0x552137[_0x87ba('0x17')](_0x43869d);}return _0x552137[_0x87ba('0x18')](_0x43869d)[_0x87ba('0x19')]();};}function respondWithResult(_0x1f7b1b,_0x2256bb){_0x2256bb=_0x2256bb||0xc8;return function(_0x4d75fc){if(_0x4d75fc){return _0x1f7b1b[_0x87ba('0x18')](_0x2256bb)['json'](_0x4d75fc);}};}function respondWithFilteredResult(_0x27171d,_0x553903){return function(_0x3fc6ec){if(_0x3fc6ec){var _0x27bf97=_0x3fc6ec[_0x87ba('0x1a')],_0x86af1a=_0x553903['offset'],_0x7669ca=_0x553903[_0x87ba('0x1b')]+_0x553903[_0x87ba('0x1c')],_0x24ef5f;if(_0x7669ca>=_0x27bf97){_0x7669ca=_0x27bf97;_0x24ef5f=0xc8;}else{_0x24ef5f=0xce;}_0x27171d[_0x87ba('0x18')](_0x24ef5f);return _0x27171d[_0x87ba('0x1d')](_0x87ba('0x1e'),_0x86af1a+'-'+_0x7669ca+'/'+_0x27bf97)[_0x87ba('0x1f')](_0x3fc6ec);}return null;};}function patchUpdates(_0x3a19be){return function(_0x10dc1a){try{jsonpatch[_0x87ba('0x20')](_0x10dc1a,_0x3a19be,!![]);}catch(_0x26115c){return BPromise['reject'](_0x26115c);}return _0x10dc1a[_0x87ba('0x21')]();};}function saveUpdates(_0x499b40,_0x3e8e20){return function(_0x324971){if(_0x324971){return _0x324971['update'](_0x499b40)[_0x87ba('0x22')](function(_0x298b8e){return _0x298b8e;});}return null;};}function removeEntity(_0xfd51e8,_0x44269d){return function(_0x302246){if(_0x302246){return _0x302246[_0x87ba('0x23')]()[_0x87ba('0x22')](function(){var _0x5592c3=_0x302246[_0x87ba('0x24')]({'plain':!![]});var _0x525527=_0x87ba('0x25');return db[_0x87ba('0x26')][_0x87ba('0x23')]({'where':{'type':_0x525527,'resourceId':_0x5592c3['id']}})['then'](function(){return _0x302246;});})[_0x87ba('0x22')](function(){_0xfd51e8[_0x87ba('0x18')](0xcc)[_0x87ba('0x19')]();});}};}function handleEntityNotFound(_0x1d4571,_0x293a80){return function(_0x4c115f){if(!_0x4c115f){_0x1d4571[_0x87ba('0x17')](0x194);}return _0x4c115f;};}function handleError(_0x3366a3,_0x4f8738){_0x4f8738=_0x4f8738||0x1f4;return function(_0x22fcd9){logger[_0x87ba('0x27')](_0x22fcd9[_0x87ba('0x28')]);if(_0x22fcd9[_0x87ba('0x29')]){delete _0x22fcd9['name'];}_0x3366a3['status'](_0x4f8738)[_0x87ba('0x2a')](_0x22fcd9);};}exports[_0x87ba('0x2b')]=function(_0x2b369e,_0x131358){var _0x5ab625={},_0x1b7a68={},_0x4056f4={'count':0x0,'rows':[]};var _0x9b082=_[_0x87ba('0x2c')](db[_0x87ba('0x2d')]['rawAttributes'],function(_0x163bb3){return{'name':_0x163bb3[_0x87ba('0x2e')],'type':_0x163bb3[_0x87ba('0x2f')][_0x87ba('0x30')]};});_0x1b7a68[_0x87ba('0x31')]=_[_0x87ba('0x2c')](_0x9b082,'name');_0x1b7a68[_0x87ba('0x32')]=_['keys'](_0x2b369e[_0x87ba('0x32')]);_0x1b7a68[_0x87ba('0x33')]=_[_0x87ba('0x34')](_0x1b7a68[_0x87ba('0x31')],_0x1b7a68[_0x87ba('0x32')]);_0x5ab625[_0x87ba('0x35')]=_[_0x87ba('0x34')](_0x1b7a68[_0x87ba('0x31')],qs[_0x87ba('0x36')](_0x2b369e[_0x87ba('0x32')][_0x87ba('0x36')]));_0x5ab625[_0x87ba('0x35')]=_0x5ab625[_0x87ba('0x35')][_0x87ba('0x37')]?_0x5ab625['attributes']:_0x1b7a68['model'];if(!_0x2b369e[_0x87ba('0x32')][_0x87ba('0x38')](_0x87ba('0x39'))){_0x5ab625['limit']=qs[_0x87ba('0x1c')](_0x2b369e['query'][_0x87ba('0x1c')]);_0x5ab625[_0x87ba('0x1b')]=qs[_0x87ba('0x1b')](_0x2b369e[_0x87ba('0x32')][_0x87ba('0x1b')]);}_0x5ab625[_0x87ba('0x3a')]=qs[_0x87ba('0x3b')](_0x2b369e[_0x87ba('0x32')][_0x87ba('0x3b')]);_0x5ab625[_0x87ba('0x3c')]=qs[_0x87ba('0x33')](_['pick'](_0x2b369e[_0x87ba('0x32')],_0x1b7a68[_0x87ba('0x33')]),_0x9b082);if(_0x2b369e[_0x87ba('0x32')][_0x87ba('0x3d')]){_0x5ab625[_0x87ba('0x3c')]=_[_0x87ba('0x3e')](_0x5ab625[_0x87ba('0x3c')],{'$or':_['map'](_0x9b082,function(_0x4544f7){if(_0x4544f7['type']!==_0x87ba('0x3f')){var _0x4174c4={};_0x4174c4[_0x4544f7[_0x87ba('0x29')]]={'$like':'%'+_0x2b369e[_0x87ba('0x32')][_0x87ba('0x3d')]+'%'};return _0x4174c4;}})});}_0x5ab625=_[_0x87ba('0x3e')]({},_0x5ab625,_0x2b369e[_0x87ba('0x40')]);var _0xec6c={'where':_0x5ab625[_0x87ba('0x3c')]};return db[_0x87ba('0x2d')][_0x87ba('0x1a')](_0xec6c)[_0x87ba('0x22')](function(_0x3f080e){_0x4056f4[_0x87ba('0x1a')]=_0x3f080e;if(_0x2b369e[_0x87ba('0x32')][_0x87ba('0x41')]){_0x5ab625['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x87ba('0x42')](_0x5ab625);})[_0x87ba('0x22')](function(_0x58142d){_0x4056f4[_0x87ba('0x43')]=_0x58142d;return _0x4056f4;})['then'](respondWithFilteredResult(_0x131358,_0x5ab625))['catch'](handleError(_0x131358,null));};exports['show']=function(_0x14f436,_0x417f01){var _0x581eae={'raw':![],'where':{'id':_0x14f436[_0x87ba('0x44')]['id']}},_0x2b2b55={};_0x2b2b55[_0x87ba('0x31')]=_[_0x87ba('0x45')](db['JscriptyProject']['rawAttributes']);_0x2b2b55[_0x87ba('0x32')]=_[_0x87ba('0x45')](_0x14f436['query']);_0x2b2b55[_0x87ba('0x33')]=_[_0x87ba('0x34')](_0x2b2b55[_0x87ba('0x31')],_0x2b2b55[_0x87ba('0x32')]);_0x581eae[_0x87ba('0x35')]=_[_0x87ba('0x34')](_0x2b2b55[_0x87ba('0x31')],qs['fields'](_0x14f436[_0x87ba('0x32')][_0x87ba('0x36')]));_0x581eae[_0x87ba('0x35')]=_0x581eae[_0x87ba('0x35')][_0x87ba('0x37')]?_0x581eae[_0x87ba('0x35')]:_0x2b2b55[_0x87ba('0x31')];if(_0x14f436[_0x87ba('0x32')][_0x87ba('0x41')]){_0x581eae[_0x87ba('0x46')]=[{'all':!![]}];}_0x581eae=_[_0x87ba('0x3e')]({},_0x581eae,_0x14f436[_0x87ba('0x40')]);return db[_0x87ba('0x2d')]['find'](_0x581eae)['then'](handleEntityNotFound(_0x417f01,null))[_0x87ba('0x22')](respondWithResult(_0x417f01,null))[_0x87ba('0x47')](handleError(_0x417f01,null));};exports[_0x87ba('0x48')]=function(_0x3544d8,_0x18fce2){return db[_0x87ba('0x2d')][_0x87ba('0x48')](_0x3544d8[_0x87ba('0x49')],{})[_0x87ba('0x22')](function(_0x582262){var _0x443cc5=_0x3544d8['user'][_0x87ba('0x24')]({'plain':!![]});if(!_0x443cc5)throw new Error(_0x87ba('0x4a'));if(_0x443cc5[_0x87ba('0x4b')]===_0x87ba('0x4c')){var _0x5d28d2=_0x582262[_0x87ba('0x24')]({'plain':!![]});var _0x3358be=_0x87ba('0x25');return db[_0x87ba('0x4d')][_0x87ba('0x4e')]({'where':{'name':_0x3358be,'userProfileId':_0x443cc5['userProfileId']},'raw':!![]})[_0x87ba('0x22')](function(_0x39a107){if(_0x39a107&&_0x39a107[_0x87ba('0x4f')]===0x0){return db['UserProfileResource'][_0x87ba('0x48')]({'name':_0x5d28d2[_0x87ba('0x29')],'resourceId':_0x5d28d2['id'],'type':_0x39a107[_0x87ba('0x29')],'sectionId':_0x39a107['id']},{})[_0x87ba('0x22')](function(){return _0x582262;});}else{return _0x582262;}})[_0x87ba('0x47')](function(_0x44a983){logger['error'](_0x87ba('0x50'),_0x44a983);throw _0x44a983;});}return _0x582262;})[_0x87ba('0x22')](respondWithResult(_0x18fce2,0xc9))[_0x87ba('0x47')](handleError(_0x18fce2,null));};exports['clone']=function(_0x118e03,_0x4c110c){var _0x278a72={'where':{'id':_0x118e03['params']['id']}},_0x3a8b0b={};_0x3a8b0b[_0x87ba('0x31')]=_[_0x87ba('0x45')](db[_0x87ba('0x2d')][_0x87ba('0x51')]);_0x278a72[_0x87ba('0x35')]=_[_0x87ba('0x34')](_0x3a8b0b['model'],qs[_0x87ba('0x36')](_0x118e03['query'][_0x87ba('0x36')]));_0x278a72['attributes']=_0x278a72['attributes'][_0x87ba('0x37')]?_0x278a72[_0x87ba('0x35')]:_0x3a8b0b[_0x87ba('0x31')];if(_0x118e03['query'][_0x87ba('0x41')]){_0x278a72[_0x87ba('0x46')]=[{'all':!![]}];}_0x278a72=_[_0x87ba('0x3e')]({},_0x278a72,_0x118e03[_0x87ba('0x40')]);return db[_0x87ba('0x2d')][_0x87ba('0x4e')](_0x278a72)['then'](handleEntityNotFound(_0x4c110c,null))[_0x87ba('0x22')](function(_0x421935){if(_0x421935){var _0x270fc5=_0x421935['get']({'plain':!![]});_0x270fc5=qs['omit'](_0x270fc5,['id','createdAt','updatedAt']);_0x118e03[_0x87ba('0x49')]=_[_0x87ba('0x52')](_0x118e03['body'],['id',_0x87ba('0x53'),_0x87ba('0x54')]);return db['JscriptyProject'][_0x87ba('0x48')](_['merge'](_0x270fc5,_0x118e03['body']),{'include':_0x118e03[_0x87ba('0x32')][_0x87ba('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x1c7821){var _0x1c8faf=_0x118e03['user'][_0x87ba('0x24')]({'plain':!![]});if(!_0x1c8faf)throw new Error(_0x87ba('0x4a'));if(_0x1c8faf[_0x87ba('0x4b')]===_0x87ba('0x4c')){var _0x263cca=_0x1c7821[_0x87ba('0x24')]({'plain':!![]});var _0x390272=_0x87ba('0x25');return db[_0x87ba('0x4d')][_0x87ba('0x4e')]({'where':{'name':_0x390272,'userProfileId':_0x1c8faf[_0x87ba('0x55')]},'raw':!![]})[_0x87ba('0x22')](function(_0x98c509){if(_0x98c509&&_0x98c509[_0x87ba('0x4f')]===0x0){return db[_0x87ba('0x26')][_0x87ba('0x48')]({'name':_0x263cca[_0x87ba('0x29')],'resourceId':_0x263cca['id'],'type':_0x98c509[_0x87ba('0x29')],'sectionId':_0x98c509['id']},{})[_0x87ba('0x22')](function(){return _0x1c7821;});}else{return _0x1c7821;}})[_0x87ba('0x47')](function(_0xb3fb3a){logger[_0x87ba('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb3fb3a);throw _0xb3fb3a;});}return _0x1c7821;});}})[_0x87ba('0x22')](respondWithResult(_0x4c110c,0xc9))[_0x87ba('0x47')](handleError(_0x4c110c,null));};exports[_0x87ba('0x56')]=function(_0x166624,_0x1ff253){if(_0x166624[_0x87ba('0x49')]['id']){delete _0x166624[_0x87ba('0x49')]['id'];}return db['JscriptyProject'][_0x87ba('0x4e')]({'where':{'id':_0x166624['params']['id']}})[_0x87ba('0x22')](handleEntityNotFound(_0x1ff253,null))[_0x87ba('0x22')](saveUpdates(_0x166624[_0x87ba('0x49')],null))[_0x87ba('0x22')](respondWithResult(_0x1ff253,null))[_0x87ba('0x47')](handleError(_0x1ff253,null));};exports['destroy']=function(_0x52b7e1,_0x3644fa){return db['JscriptyProject']['find']({'where':{'id':_0x52b7e1[_0x87ba('0x44')]['id']}})['then'](handleEntityNotFound(_0x3644fa,null))[_0x87ba('0x22')](removeEntity(_0x3644fa,null))['catch'](handleError(_0x3644fa,null));};exports['getSessions']=function(_0x35b720,_0x2f2b23,_0x1f3031){var _0x223868={'raw':!![],'where':{}};var _0x1fbbd9={};var _0x5915e7={'count':0x0,'rows':[]};return db[_0x87ba('0x2d')][_0x87ba('0x57')]({'where':{'id':_0x35b720['params']['id']}})[_0x87ba('0x22')](handleEntityNotFound(_0x2f2b23,null))[_0x87ba('0x22')](function(_0x38458a){if(_0x38458a){_0x1fbbd9[_0x87ba('0x31')]=_[_0x87ba('0x45')](db[_0x87ba('0x58')][_0x87ba('0x51')]);_0x1fbbd9[_0x87ba('0x32')]=_[_0x87ba('0x45')](_0x35b720[_0x87ba('0x32')]);_0x1fbbd9[_0x87ba('0x33')]=_['intersection'](_0x1fbbd9[_0x87ba('0x31')],_0x1fbbd9['query']);_0x223868[_0x87ba('0x35')]=_['intersection'](_0x1fbbd9[_0x87ba('0x31')],qs[_0x87ba('0x36')](_0x35b720[_0x87ba('0x32')]['fields']));_0x223868[_0x87ba('0x35')]=_0x223868[_0x87ba('0x35')][_0x87ba('0x37')]?_0x223868[_0x87ba('0x35')]:_0x1fbbd9[_0x87ba('0x31')];if(!_0x35b720[_0x87ba('0x32')][_0x87ba('0x38')]('nolimit')){_0x223868[_0x87ba('0x1c')]=qs[_0x87ba('0x1c')](_0x35b720[_0x87ba('0x32')]['limit']);_0x223868['offset']=qs[_0x87ba('0x1b')](_0x35b720['query'][_0x87ba('0x1b')]);}_0x223868[_0x87ba('0x3a')]=qs[_0x87ba('0x3b')](_0x35b720[_0x87ba('0x32')][_0x87ba('0x3b')]);_0x223868[_0x87ba('0x3c')]=qs[_0x87ba('0x33')](_[_0x87ba('0x59')](_0x35b720[_0x87ba('0x32')],_0x1fbbd9[_0x87ba('0x33')]));_0x223868['where']['ProjectId']=_0x38458a['id'];if(_0x35b720['query']['filter']){_0x223868[_0x87ba('0x3c')]=_[_0x87ba('0x3e')](_0x223868[_0x87ba('0x3c')],{'$or':_[_0x87ba('0x2c')](_0x223868[_0x87ba('0x35')],function(_0x105503){var _0x293eff={};_0x293eff[_0x105503]={'$like':'%'+_0x35b720['query']['filter']+'%'};return _0x293eff;})});}_0x223868=_['merge']({},_0x223868,_0x35b720[_0x87ba('0x40')]);return db[_0x87ba('0x58')][_0x87ba('0x1a')]({'where':_0x223868[_0x87ba('0x3c')]})[_0x87ba('0x22')](function(_0x472429){_0x5915e7[_0x87ba('0x1a')]=_0x472429;if(_0x35b720[_0x87ba('0x32')][_0x87ba('0x41')]){_0x223868[_0x87ba('0x46')]=[{'all':!![]}];}return db[_0x87ba('0x58')][_0x87ba('0x42')](_0x223868);})[_0x87ba('0x22')](function(_0x437d4f){_0x5915e7[_0x87ba('0x43')]=_0x437d4f;return _0x5915e7;});}})['then'](respondWithFilteredResult(_0x2f2b23,_0x223868))[_0x87ba('0x47')](handleError(_0x2f2b23,null));};exports[_0x87ba('0x5a')]=function(_0x862865,_0x4fe75b,_0x14bb78){var _0x1cd368={'raw':!![],'where':{}};var _0x4daf0b={};var _0x2bcfc1={'count':0x0,'rows':[]};return db[_0x87ba('0x2d')][_0x87ba('0x57')]({'where':{'id':_0x862865[_0x87ba('0x44')]['id']}})[_0x87ba('0x22')](handleEntityNotFound(_0x4fe75b,null))[_0x87ba('0x22')](function(_0x4d24d1){if(_0x4d24d1){_0x4daf0b['model']=_['keys'](db[_0x87ba('0x5b')][_0x87ba('0x51')]);_0x4daf0b[_0x87ba('0x32')]=_[_0x87ba('0x45')](_0x862865[_0x87ba('0x32')]);_0x4daf0b[_0x87ba('0x33')]=_[_0x87ba('0x34')](_0x4daf0b[_0x87ba('0x31')],_0x4daf0b['query']);_0x1cd368[_0x87ba('0x35')]=_[_0x87ba('0x34')](_0x4daf0b[_0x87ba('0x31')],qs[_0x87ba('0x36')](_0x862865[_0x87ba('0x32')][_0x87ba('0x36')]));_0x1cd368['attributes']=_0x1cd368[_0x87ba('0x35')][_0x87ba('0x37')]?_0x1cd368[_0x87ba('0x35')]:_0x4daf0b[_0x87ba('0x31')];if(!_0x862865['query']['hasOwnProperty'](_0x87ba('0x39'))){_0x1cd368[_0x87ba('0x1c')]=qs[_0x87ba('0x1c')](_0x862865[_0x87ba('0x32')][_0x87ba('0x1c')]);_0x1cd368[_0x87ba('0x1b')]=qs[_0x87ba('0x1b')](_0x862865[_0x87ba('0x32')]['offset']);}_0x1cd368[_0x87ba('0x3a')]=qs['sort'](_0x862865[_0x87ba('0x32')][_0x87ba('0x3b')]);_0x1cd368['where']=qs[_0x87ba('0x33')](_[_0x87ba('0x59')](_0x862865['query'],_0x4daf0b[_0x87ba('0x33')]));_0x1cd368[_0x87ba('0x3c')][_0x87ba('0x5c')]=_0x4d24d1['id'];if(_0x862865['query'][_0x87ba('0x3d')]){_0x1cd368[_0x87ba('0x3c')]=_[_0x87ba('0x3e')](_0x1cd368[_0x87ba('0x3c')],{'$or':_[_0x87ba('0x2c')](_0x1cd368[_0x87ba('0x35')],function(_0x3320b4){var _0x3fa7e7={};_0x3fa7e7[_0x3320b4]={'$like':'%'+_0x862865[_0x87ba('0x32')]['filter']+'%'};return _0x3fa7e7;})});}_0x1cd368=_['merge']({},_0x1cd368,_0x862865[_0x87ba('0x40')]);return db[_0x87ba('0x5b')][_0x87ba('0x1a')]({'where':_0x1cd368[_0x87ba('0x3c')]})[_0x87ba('0x22')](function(_0x43f224){_0x2bcfc1[_0x87ba('0x1a')]=_0x43f224;if(_0x862865[_0x87ba('0x32')][_0x87ba('0x41')]){_0x1cd368[_0x87ba('0x46')]=[{'all':!![]}];}return db[_0x87ba('0x5b')][_0x87ba('0x42')](_0x1cd368);})[_0x87ba('0x22')](function(_0x59e51e){_0x2bcfc1[_0x87ba('0x43')]=_0x59e51e;return _0x2bcfc1;});}})[_0x87ba('0x22')](respondWithFilteredResult(_0x4fe75b,_0x1cd368))['catch'](handleError(_0x4fe75b,null));};function char(_0x571f8e){return'number'===typeof _0x571f8e?String[_0x87ba('0x5d')][_0x87ba('0x20')](null,arguments):_0x571f8e;}function needsEncapsulation(_0x47800c){return!!_0x47800c&&(_0x47800c['toString']()[_0x87ba('0x5e')](char(0xd))>=0x0||_0x47800c['toString']()[_0x87ba('0x5e')](char(0xa))>=0x0||_0x47800c[_0x87ba('0x5f')]()[_0x87ba('0x5e')](char(0x2c))>=0x0||_0x47800c[_0x87ba('0x5f')]()[_0x87ba('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x2670f4){var _0x4d3f2a=char(0x22),_0x3b2c09='\x5c'+char(0x22),_0x118a22=_0x2670f4[_0x87ba('0x5f')]()[_0x87ba('0x60')](new RegExp(_0x4d3f2a,'g'),_0x3b2c09);return _0x4d3f2a+_0x118a22+_0x4d3f2a;}exports['getSummary']=function(_0x4701f6,_0x33326c,_0x6b1fd9){var _0x258747,_0x2ffcc0;var _0x4e7c2a={'where':{'ProjectId':_0x4701f6[_0x87ba('0x44')]['id']}};if(_0x4701f6[_0x87ba('0x32')]['startTime']){_0x4e7c2a[_0x87ba('0x3c')]['starttime']=JSON[_0x87ba('0x61')](_0x4701f6[_0x87ba('0x32')][_0x87ba('0x62')]);}return db[_0x87ba('0x58')][_0x87ba('0x42')](_0x4e7c2a)[_0x87ba('0x22')](handleEntityNotFound(_0x33326c,null))[_0x87ba('0x22')](function(_0x55b04b){if(_0x55b04b){_0x258747=_0x55b04b;return db[_0x87ba('0x63')][_0x87ba('0x42')]({'where':{'SessionId':{'$in':_['map'](_0x258747,'id')},'ProjectId':_0x4701f6[_0x87ba('0x44')]['id']},'order':_0x87ba('0x64')});}})[_0x87ba('0x22')](handleEntityNotFound(_0x33326c,null))['then'](function(_0x33b482){if(_0x33b482){_0x2ffcc0=_0x33b482;var _0x2cea4c={};for(var _0x50f6f7=0x0,_0x3b1e7c=_0x2ffcc0[_0x87ba('0x37')];_0x50f6f7<_0x3b1e7c;_0x50f6f7++){if(!_0x2cea4c[_0x87ba('0x38')](_0x2ffcc0[_0x50f6f7]['questionId'])){_0x2cea4c[_0x2ffcc0[_0x50f6f7]['questionId']]=needsEncapsulation(_0x2ffcc0[_0x50f6f7][_0x87ba('0x65')])?encapsulate(_0x2ffcc0[_0x50f6f7]['question']):_0x2ffcc0[_0x50f6f7][_0x87ba('0x65')];}}var _0x1c7186=[],_0x24321a={};for(var _0x28a812=0x0,_0x2e1be1=_0x258747[_0x87ba('0x37')];_0x28a812<_0x2e1be1;_0x28a812++){_0x24321a={'ProjectId':_0x4701f6[_0x87ba('0x44')]['id'],'SessionId':_0x258747[_0x28a812]['id'],'StartTime':moment(_0x258747[_0x28a812][_0x87ba('0x66')])[_0x87ba('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0xfa10f6=0x0,_0x16c9ec=_0x2ffcc0[_0x87ba('0x37')];_0xfa10f6<_0x16c9ec;_0xfa10f6++){if(_0x2ffcc0[_0xfa10f6][_0x87ba('0x68')]==_0x258747[_0x28a812]['id']&&_0x2cea4c['hasOwnProperty'](_0x2ffcc0[_0xfa10f6][_0x87ba('0x69')])){_0x24321a[_0x2cea4c[_0x2ffcc0[_0xfa10f6][_0x87ba('0x69')]]]=_0x2ffcc0[_0xfa10f6][_0x87ba('0x6a')];}}for(var _0x3f2b54 in _0x2cea4c){if(!_0x24321a[_0x87ba('0x38')](_0x2cea4c[_0x3f2b54])){_0x24321a[_0x2cea4c[_0x3f2b54]]=null;}}_0x1c7186[_0x87ba('0x6b')](_0x24321a);}return _0x1c7186;}})[_0x87ba('0x22')](function(_0x35dd96){if(!_[_0x87ba('0x6c')](_0x35dd96)){var _0x198899=toCsv(_0x35dd96);var _0x1a9ecb=Date[_0x87ba('0x6d')]();fs['writeFileSync'](util[_0x87ba('0x67')](_0x87ba('0x6e'),_0x4701f6[_0x87ba('0x44')]['id'],_0x1a9ecb),_0x198899);_0x33326c[_0x87ba('0x6f')]('Content-disposition','attachment;\x20filename='+util[_0x87ba('0x67')](_0x87ba('0x70'),_0x4701f6['params']['id'],_0x1a9ecb));_0x33326c[_0x87ba('0x6f')](_0x87ba('0x71'),_0x87ba('0x72'));return _0x33326c[_0x87ba('0x73')](util[_0x87ba('0x67')](_0x87ba('0x6e'),_0x4701f6['params']['id'],_0x1a9ecb));}else{return _0x33326c[_0x87ba('0x17')](0xcc);}})[_0x87ba('0x47')](handleError(_0x33326c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 7b99afb..aebd2d6 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 _0xc782=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util'];(function(_0x1ad9bb,_0x2d48e5){var _0xeaafc5=function(_0x4e4795){while(--_0x4e4795){_0x1ad9bb['push'](_0x1ad9bb['shift']());}};_0xeaafc5(++_0x2d48e5);}(_0xc782,0x1b8));var _0x2c78=function(_0x2ffee8,_0x126cdd){_0x2ffee8=_0x2ffee8-0x0;var _0x432ebf=_0xc782[_0x2ffee8];return _0x432ebf;};'use strict';var _=require(_0x2c78('0x0'));var util=require(_0x2c78('0x1'));var logger=require(_0x2c78('0x2'))('api');var moment=require(_0x2c78('0x3'));var BPromise=require(_0x2c78('0x4'));var rp=require(_0x2c78('0x5'));var fs=require('fs');var path=require(_0x2c78('0x6'));var rimraf=require(_0x2c78('0x7'));var config=require(_0x2c78('0x8'));var attributes=require(_0x2c78('0x9'));module[_0x2c78('0xa')]=function(_0x452ca9,_0x1df55f){return _0x452ca9[_0x2c78('0xb')](_0x2c78('0xc'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbae=['lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject'];(function(_0x2657cf,_0x241101){var _0x5ea237=function(_0xa11d13){while(--_0xa11d13){_0x2657cf['push'](_0x2657cf['shift']());}};_0x5ea237(++_0x241101);}(_0xcbae,0x171));var _0xecba=function(_0x4bf891,_0x57ca13){_0x4bf891=_0x4bf891-0x0;var _0x540586=_0xcbae[_0x4bf891];return _0x540586;};'use strict';var _=require(_0xecba('0x0'));var util=require('util');var logger=require(_0xecba('0x1'))(_0xecba('0x2'));var moment=require('moment');var BPromise=require(_0xecba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xecba('0x4'));var config=require(_0xecba('0x5'));var attributes=require(_0xecba('0x6'));module[_0xecba('0x7')]=function(_0xcc39b0,_0x2032f7){return _0xcc39b0['define'](_0xecba('0x8'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 379ee5f..9457270 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 _0x5c63=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3754bc,_0x137190){var _0x267b22=function(_0xe606){while(--_0xe606){_0x3754bc['push'](_0x3754bc['shift']());}};_0x267b22(++_0x137190);}(_0x5c63,0x193));var _0x35c6=function(_0x441fb1,_0x32a8f2){_0x441fb1=_0x441fb1-0x0;var _0x546d27=_0x5c63[_0x441fb1];return _0x546d27;};'use strict';var _=require('lodash');var util=require(_0x35c6('0x0'));var moment=require(_0x35c6('0x1'));var BPromise=require(_0x35c6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35c6('0x3'));var db=require(_0x35c6('0x4'))['db'];var utils=require(_0x35c6('0x5'));var logger=require(_0x35c6('0x6'))(_0x35c6('0x7'));var config=require('../../config/environment');var jayson=require(_0x35c6('0x8'));var client=jayson[_0x35c6('0x9')][_0x35c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb22699,_0x25f420,_0x4e5162){return new BPromise(function(_0x488ee5,_0x5acd66){return client[_0x35c6('0xb')](_0xb22699,_0x4e5162)[_0x35c6('0xc')](function(_0x50c37d){logger['info'](_0x35c6('0xd'),_0x25f420,_0x35c6('0xe'));logger[_0x35c6('0xf')](_0x35c6('0x10'),_0x25f420,'request\x20sent',JSON[_0x35c6('0x11')](_0x50c37d));if(_0x50c37d[_0x35c6('0x12')]){if(_0x50c37d[_0x35c6('0x12')][_0x35c6('0x13')]===0x1f4){logger[_0x35c6('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x25f420,_0x50c37d[_0x35c6('0x12')]['message']);return _0x5acd66(_0x50c37d[_0x35c6('0x12')]['message']);}logger[_0x35c6('0x12')](_0x35c6('0xd'),_0x25f420,_0x50c37d[_0x35c6('0x12')][_0x35c6('0x14')]);return _0x488ee5(_0x50c37d[_0x35c6('0x12')]['message']);}else{logger[_0x35c6('0x15')](_0x35c6('0xd'),_0x25f420,_0x35c6('0xe'));_0x488ee5(_0x50c37d[_0x35c6('0x16')][_0x35c6('0x14')]);}})[_0x35c6('0x17')](function(_0x2e0a66){logger[_0x35c6('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x25f420,_0x2e0a66);_0x5acd66(_0x2e0a66);});});} \ No newline at end of file +var _0x1061=['JscriptyProject,\x20%s,\x20%s','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1061,0x183));var _0x1106=function(_0x59cf35,_0x5b1ecc){_0x59cf35=_0x59cf35-0x0;var _0x313363=_0x1061[_0x59cf35];return _0x313363;};'use strict';var _=require(_0x1106('0x0'));var util=require('util');var moment=require(_0x1106('0x1'));var BPromise=require(_0x1106('0x2'));var rs=require(_0x1106('0x3'));var fs=require('fs');var Redis=require(_0x1106('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1106('0x5'));var logger=require(_0x1106('0x6'))(_0x1106('0x7'));var config=require(_0x1106('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1106('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c63d0,_0x46183d,_0x277bb2){return new BPromise(function(_0xa7064f,_0x581897){return client[_0x1106('0xa')](_0x1c63d0,_0x277bb2)[_0x1106('0xb')](function(_0x1d85ce){logger[_0x1106('0xc')](_0x1106('0xd'),_0x46183d,'request\x20sent');logger[_0x1106('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x46183d,'request\x20sent',JSON[_0x1106('0xf')](_0x1d85ce));if(_0x1d85ce[_0x1106('0x10')]){if(_0x1d85ce[_0x1106('0x10')][_0x1106('0x11')]===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x46183d,_0x1d85ce['error'][_0x1106('0x12')]);return _0x581897(_0x1d85ce[_0x1106('0x10')][_0x1106('0x12')]);}logger[_0x1106('0x10')](_0x1106('0xd'),_0x46183d,_0x1d85ce[_0x1106('0x10')]['message']);return _0xa7064f(_0x1d85ce[_0x1106('0x10')][_0x1106('0x12')]);}else{logger[_0x1106('0xc')](_0x1106('0xd'),_0x46183d,'request\x20sent');_0xa7064f(_0x1d85ce[_0x1106('0x13')][_0x1106('0x12')]);}})['catch'](function(_0x186cf1){logger[_0x1106('0x10')](_0x1106('0xd'),_0x46183d,_0x186cf1);_0x581897(_0x186cf1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index af268a3..c830b20 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 _0x58cd=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x58cd,0x65));var _0xd58c=function(_0x531950,_0x3fb113){_0x531950=_0x531950-0x0;var _0x4dcd0e=_0x58cd[_0x531950];return _0x4dcd0e;};'use strict';var multer=require(_0xd58c('0x0'));var util=require(_0xd58c('0x1'));var path=require(_0xd58c('0x2'));var timeout=require(_0xd58c('0x3'));var express=require(_0xd58c('0x4'));var router=express['Router']();var auth=require(_0xd58c('0x5'));var interaction=require(_0xd58c('0x6'));var config=require(_0xd58c('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0xd58c('0x8')]('/',auth[_0xd58c('0x9')](),controller['index']);router[_0xd58c('0x8')](_0xd58c('0xa'),auth[_0xd58c('0x9')](),controller[_0xd58c('0xb')]);router[_0xd58c('0x8')]('/:id',auth[_0xd58c('0x9')](),controller[_0xd58c('0xc')]);router[_0xd58c('0xd')]('/',auth[_0xd58c('0x9')](),controller[_0xd58c('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd58c('0xf')]);router[_0xd58c('0x10')]('/:id',auth[_0xd58c('0x9')](),controller[_0xd58c('0x11')]);module[_0xd58c('0x12')]=router; \ No newline at end of file +var _0x926d=['./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x926d,0xf5));var _0xd926=function(_0x2ce0df,_0x4f9bb0){_0x2ce0df=_0x2ce0df-0x0;var _0x243c28=_0x926d[_0x2ce0df];return _0x243c28;};'use strict';var multer=require('multer');var util=require(_0xd926('0x0'));var path=require('path');var timeout=require(_0xd926('0x1'));var express=require(_0xd926('0x2'));var router=express[_0xd926('0x3')]();var auth=require(_0xd926('0x4'));var interaction=require(_0xd926('0x5'));var config=require(_0xd926('0x6'));var controller=require(_0xd926('0x7'));router[_0xd926('0x8')]('/',auth[_0xd926('0x9')](),controller[_0xd926('0xa')]);router['get'](_0xd926('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd926('0x8')](_0xd926('0xc'),auth[_0xd926('0x9')](),controller[_0xd926('0xd')]);router['post']('/',auth[_0xd926('0x9')](),controller[_0xd926('0xe')]);router[_0xd926('0xf')](_0xd926('0xc'),auth[_0xd926('0x9')](),controller['update']);router[_0xd926('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd926('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 453932c..c7d5cbc 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 _0x8016=['TEXT','long','sequelize','STRING'];(function(_0x72dc16,_0x4fac58){var _0x141488=function(_0x3eed38){while(--_0x3eed38){_0x72dc16['push'](_0x72dc16['shift']());}};_0x141488(++_0x4fac58);}(_0x8016,0x1e2));var _0x6801=function(_0x45ffc0,_0x4f090b){_0x45ffc0=_0x45ffc0-0x0;var _0x1f0074=_0x8016[_0x45ffc0];return _0x1f0074;};'use strict';var Sequelize=require(_0x6801('0x0'));module['exports']={'question':{'type':Sequelize[_0x6801('0x1')]},'answer':{'type':Sequelize[_0x6801('0x2')](_0x6801('0x3'))},'membername':{'type':Sequelize[_0x6801('0x1')]},'projectname':{'type':Sequelize[_0x6801('0x1')]},'queue':{'type':Sequelize[_0x6801('0x1')]},'uniqueid':{'type':Sequelize[_0x6801('0x1')]},'calleridname':{'type':Sequelize[_0x6801('0x1')]},'calleridnum':{'type':Sequelize[_0x6801('0x1')]},'questionId':{'type':Sequelize[_0x6801('0x1')]}}; \ No newline at end of file +var _0xdf8d=['exports','STRING','sequelize'];(function(_0x4c6840,_0x97fe36){var _0x23e354=function(_0x5de5d7){while(--_0x5de5d7){_0x4c6840['push'](_0x4c6840['shift']());}};_0x23e354(++_0x97fe36);}(_0xdf8d,0x1ca));var _0xddf8=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xdf8d[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xddf8('0x0'));module[_0xddf8('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0xddf8('0x2')]},'projectname':{'type':Sequelize[_0xddf8('0x2')]},'queue':{'type':Sequelize[_0xddf8('0x2')]},'uniqueid':{'type':Sequelize[_0xddf8('0x2')]},'calleridname':{'type':Sequelize[_0xddf8('0x2')]},'calleridnum':{'type':Sequelize[_0xddf8('0x2')]},'questionId':{'type':Sequelize[_0xddf8('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 980ae04..74a6d9f 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 _0x83c4=['create','body','describe','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll','catch','show','params','keys','find'];(function(_0x35ef79,_0x19108e){var _0x339341=function(_0x505bd0){while(--_0x505bd0){_0x35ef79['push'](_0x35ef79['shift']());}};_0x339341(++_0x19108e);}(_0x83c4,0x11f));var _0x483c=function(_0x5bf542,_0x50999){_0x5bf542=_0x5bf542-0x0;var _0x201bf5=_0x83c4[_0x5bf542];return _0x201bf5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x483c('0x0'));var jsonpatch=require(_0x483c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x483c('0x2'));var Mustache=require(_0x483c('0x3'));var util=require(_0x483c('0x4'));var path=require(_0x483c('0x5'));var sox=require('sox');var csv=require(_0x483c('0x6'));var ejs=require(_0x483c('0x7'));var fs=require('fs');var _=require(_0x483c('0x8'));var squel=require(_0x483c('0x9'));var crypto=require('crypto');var jsforce=require(_0x483c('0xa'));var deskjs=require(_0x483c('0xb'));var toCsv=require(_0x483c('0x6'));var querystring=require(_0x483c('0xc'));var Papa=require(_0x483c('0xd'));var Redis=require(_0x483c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x483c('0xf'));var hardwareService=require(_0x483c('0x10'));var logger=require('../../config/logger')(_0x483c('0x11'));var utils=require('../../config/utils');var config=require(_0x483c('0x12'));var db=require(_0x483c('0x13'))['db'];function respondWithStatusCode(_0x170dd0,_0x46b7dd){_0x46b7dd=_0x46b7dd||0xcc;return function(_0x26fab4){if(_0x26fab4){return _0x170dd0[_0x483c('0x14')](_0x46b7dd);}return _0x170dd0['status'](_0x46b7dd)[_0x483c('0x15')]();};}function respondWithResult(_0x2874c1,_0x34054d){_0x34054d=_0x34054d||0xc8;return function(_0x3f1866){if(_0x3f1866){return _0x2874c1['status'](_0x34054d)[_0x483c('0x16')](_0x3f1866);}};}function respondWithFilteredResult(_0x4f1d41,_0x20b6ba){return function(_0x4ce908){if(_0x4ce908){var _0xc9dc46=_0x4ce908[_0x483c('0x17')],_0x58aa05=_0x20b6ba['offset'],_0x3027a6=_0x20b6ba[_0x483c('0x18')]+_0x20b6ba[_0x483c('0x19')],_0x4fef08;if(_0x3027a6>=_0xc9dc46){_0x3027a6=_0xc9dc46;_0x4fef08=0xc8;}else{_0x4fef08=0xce;}_0x4f1d41[_0x483c('0x1a')](_0x4fef08);return _0x4f1d41[_0x483c('0x1b')](_0x483c('0x1c'),_0x58aa05+'-'+_0x3027a6+'/'+_0xc9dc46)['json'](_0x4ce908);}return null;};}function patchUpdates(_0x3fe93f){return function(_0x3d44cb){try{jsonpatch[_0x483c('0x1d')](_0x3d44cb,_0x3fe93f,!![]);}catch(_0x2a47f1){return BPromise[_0x483c('0x1e')](_0x2a47f1);}return _0x3d44cb[_0x483c('0x1f')]();};}function saveUpdates(_0x34d5d9,_0x53971f){return function(_0x244afa){if(_0x244afa){return _0x244afa[_0x483c('0x20')](_0x34d5d9)[_0x483c('0x21')](function(_0x1c63b6){return _0x1c63b6;});}return null;};}function removeEntity(_0x2bb318,_0x49dc1f){return function(_0x1db5ed){if(_0x1db5ed){return _0x1db5ed[_0x483c('0x22')]()[_0x483c('0x21')](function(){_0x2bb318[_0x483c('0x1a')](0xcc)[_0x483c('0x15')]();});}};}function handleEntityNotFound(_0x424cc3,_0x210c33){return function(_0x4fb5bc){if(!_0x4fb5bc){_0x424cc3[_0x483c('0x14')](0x194);}return _0x4fb5bc;};}function handleError(_0x4317e2,_0x27d09c){_0x27d09c=_0x27d09c||0x1f4;return function(_0x3ee64c){logger['error'](_0x3ee64c[_0x483c('0x23')]);if(_0x3ee64c['name']){delete _0x3ee64c[_0x483c('0x24')];}_0x4317e2[_0x483c('0x1a')](_0x27d09c)[_0x483c('0x25')](_0x3ee64c);};}exports['index']=function(_0x372aa4,_0x5bbade){var _0x5e2756={},_0x4005b2={},_0x74e355={'count':0x0,'rows':[]};var _0x28900b=_['map'](db['JscriptyQuestionReport'][_0x483c('0x26')],function(_0xea3ce0){return{'name':_0xea3ce0[_0x483c('0x27')],'type':_0xea3ce0[_0x483c('0x28')][_0x483c('0x29')]};});_0x4005b2[_0x483c('0x2a')]=_[_0x483c('0x2b')](_0x28900b,_0x483c('0x24'));_0x4005b2[_0x483c('0x2c')]=_['keys'](_0x372aa4[_0x483c('0x2c')]);_0x4005b2[_0x483c('0x2d')]=_[_0x483c('0x2e')](_0x4005b2[_0x483c('0x2a')],_0x4005b2[_0x483c('0x2c')]);_0x5e2756[_0x483c('0x2f')]=_[_0x483c('0x2e')](_0x4005b2[_0x483c('0x2a')],qs['fields'](_0x372aa4['query'][_0x483c('0x30')]));_0x5e2756[_0x483c('0x2f')]=_0x5e2756[_0x483c('0x2f')][_0x483c('0x31')]?_0x5e2756[_0x483c('0x2f')]:_0x4005b2[_0x483c('0x2a')];if(!_0x372aa4['query'][_0x483c('0x32')](_0x483c('0x33'))){_0x5e2756[_0x483c('0x19')]=qs[_0x483c('0x19')](_0x372aa4[_0x483c('0x2c')]['limit']);_0x5e2756[_0x483c('0x18')]=qs[_0x483c('0x18')](_0x372aa4['query'][_0x483c('0x18')]);}_0x5e2756[_0x483c('0x34')]=qs['sort'](_0x372aa4[_0x483c('0x2c')]['sort']);_0x5e2756['where']=qs[_0x483c('0x2d')](_[_0x483c('0x35')](_0x372aa4['query'],_0x4005b2[_0x483c('0x2d')]),_0x28900b);if(_0x372aa4[_0x483c('0x2c')][_0x483c('0x36')]){_0x5e2756[_0x483c('0x37')]=_[_0x483c('0x38')](_0x5e2756['where'],{'$or':_[_0x483c('0x2b')](_0x28900b,function(_0x319a26){if(_0x319a26[_0x483c('0x28')]!==_0x483c('0x39')){var _0x2663a0={};_0x2663a0[_0x319a26[_0x483c('0x24')]]={'$like':'%'+_0x372aa4[_0x483c('0x2c')]['filter']+'%'};return _0x2663a0;}})});}_0x5e2756=_[_0x483c('0x38')]({},_0x5e2756,_0x372aa4[_0x483c('0x3a')]);var _0x139529={'where':_0x5e2756['where']};return db[_0x483c('0x3b')]['count'](_0x139529)[_0x483c('0x21')](function(_0x28bb77){_0x74e355[_0x483c('0x17')]=_0x28bb77;if(_0x372aa4['query'][_0x483c('0x3c')]){_0x5e2756[_0x483c('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x483c('0x3e')](_0x5e2756);})['then'](function(_0x1b3fc7){_0x74e355['rows']=_0x1b3fc7;return _0x74e355;})[_0x483c('0x21')](respondWithFilteredResult(_0x5bbade,_0x5e2756))[_0x483c('0x3f')](handleError(_0x5bbade,null));};exports[_0x483c('0x40')]=function(_0x2ad43f,_0x8543e8){var _0x5c9863={'raw':!![],'where':{'id':_0x2ad43f[_0x483c('0x41')]['id']}},_0x42feee={};_0x42feee['model']=_['keys'](db['JscriptyQuestionReport']['rawAttributes']);_0x42feee[_0x483c('0x2c')]=_[_0x483c('0x42')](_0x2ad43f[_0x483c('0x2c')]);_0x42feee['filters']=_[_0x483c('0x2e')](_0x42feee[_0x483c('0x2a')],_0x42feee[_0x483c('0x2c')]);_0x5c9863[_0x483c('0x2f')]=_[_0x483c('0x2e')](_0x42feee[_0x483c('0x2a')],qs[_0x483c('0x30')](_0x2ad43f['query']['fields']));_0x5c9863[_0x483c('0x2f')]=_0x5c9863[_0x483c('0x2f')][_0x483c('0x31')]?_0x5c9863['attributes']:_0x42feee['model'];if(_0x2ad43f[_0x483c('0x2c')]['includeAll']){_0x5c9863['include']=[{'all':!![]}];}_0x5c9863=_[_0x483c('0x38')]({},_0x5c9863,_0x2ad43f[_0x483c('0x3a')]);return db[_0x483c('0x3b')][_0x483c('0x43')](_0x5c9863)['then'](handleEntityNotFound(_0x8543e8,null))[_0x483c('0x21')](respondWithResult(_0x8543e8,null))[_0x483c('0x3f')](handleError(_0x8543e8,null));};exports[_0x483c('0x44')]=function(_0x53d64c,_0x4e3d11){return db['JscriptyQuestionReport'][_0x483c('0x44')](_0x53d64c[_0x483c('0x45')],{})['then'](respondWithResult(_0x4e3d11,0xc9))[_0x483c('0x3f')](handleError(_0x4e3d11,null));};exports[_0x483c('0x20')]=function(_0x284037,_0x2a5cdd){if(_0x284037[_0x483c('0x45')]['id']){delete _0x284037[_0x483c('0x45')]['id'];}return db[_0x483c('0x3b')]['find']({'where':{'id':_0x284037[_0x483c('0x41')]['id']}})[_0x483c('0x21')](handleEntityNotFound(_0x2a5cdd,null))[_0x483c('0x21')](saveUpdates(_0x284037[_0x483c('0x45')],null))[_0x483c('0x21')](respondWithResult(_0x2a5cdd,null))[_0x483c('0x3f')](handleError(_0x2a5cdd,null));};exports[_0x483c('0x22')]=function(_0xc233f6,_0x4705c2){return db['JscriptyQuestionReport'][_0x483c('0x43')]({'where':{'id':_0xc233f6[_0x483c('0x41')]['id']}})['then'](handleEntityNotFound(_0x4705c2,null))[_0x483c('0x21')](removeEntity(_0x4705c2,null))[_0x483c('0x3f')](handleError(_0x4705c2,null));};exports['describe']=function(_0x548c22,_0x41098a){return db[_0x483c('0x3b')][_0x483c('0x46')]()[_0x483c('0x21')](respondWithResult(_0x41098a,null))['catch'](handleError(_0x41098a,null));}; \ No newline at end of file +var _0x3fa5=['request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','map','keys','filters','intersection','attributes','model','fields','query','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','show','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x5ded12,_0x2d2127){var _0x188e86=function(_0x5ac2bf){while(--_0x5ac2bf){_0x5ded12['push'](_0x5ded12['shift']());}};_0x188e86(++_0x2d2127);}(_0x3fa5,0x1a6));var _0x53fa=function(_0x565749,_0x492c54){_0x565749=_0x565749-0x0;var _0x47d891=_0x3fa5[_0x565749];return _0x47d891;};'use strict';var pdf=require(_0x53fa('0x0'));var emlformat=require(_0x53fa('0x1'));var rimraf=require(_0x53fa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53fa('0x3'));var rp=require(_0x53fa('0x4'));var moment=require('moment');var BPromise=require(_0x53fa('0x5'));var Mustache=require(_0x53fa('0x6'));var util=require(_0x53fa('0x7'));var path=require('path');var sox=require(_0x53fa('0x8'));var csv=require(_0x53fa('0x9'));var ejs=require(_0x53fa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x53fa('0xb'));var crypto=require(_0x53fa('0xc'));var jsforce=require(_0x53fa('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x53fa('0xe'));var Redis=require(_0x53fa('0xf'));var authService=require(_0x53fa('0x10'));var qs=require(_0x53fa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53fa('0x12'));var logger=require(_0x53fa('0x13'))(_0x53fa('0x14'));var utils=require(_0x53fa('0x15'));var config=require(_0x53fa('0x16'));var db=require(_0x53fa('0x17'))['db'];function respondWithStatusCode(_0x3a76b0,_0x4a4da7){_0x4a4da7=_0x4a4da7||0xcc;return function(_0x401edd){if(_0x401edd){return _0x3a76b0[_0x53fa('0x18')](_0x4a4da7);}return _0x3a76b0[_0x53fa('0x19')](_0x4a4da7)['end']();};}function respondWithResult(_0x5afa12,_0xd4934d){_0xd4934d=_0xd4934d||0xc8;return function(_0x25a971){if(_0x25a971){return _0x5afa12[_0x53fa('0x19')](_0xd4934d)[_0x53fa('0x1a')](_0x25a971);}};}function respondWithFilteredResult(_0x6f01f7,_0x447a92){return function(_0x463e20){if(_0x463e20){var _0x3bed1a=_0x463e20['count'],_0x13739d=_0x447a92['offset'],_0xe1dcae=_0x447a92['offset']+_0x447a92['limit'],_0x998fe3;if(_0xe1dcae>=_0x3bed1a){_0xe1dcae=_0x3bed1a;_0x998fe3=0xc8;}else{_0x998fe3=0xce;}_0x6f01f7[_0x53fa('0x19')](_0x998fe3);return _0x6f01f7[_0x53fa('0x1b')](_0x53fa('0x1c'),_0x13739d+'-'+_0xe1dcae+'/'+_0x3bed1a)['json'](_0x463e20);}return null;};}function patchUpdates(_0xab900f){return function(_0x3e4318){try{jsonpatch[_0x53fa('0x1d')](_0x3e4318,_0xab900f,!![]);}catch(_0x31c17f){return BPromise['reject'](_0x31c17f);}return _0x3e4318['save']();};}function saveUpdates(_0x32a816,_0x530e7b){return function(_0x1f02bc){if(_0x1f02bc){return _0x1f02bc[_0x53fa('0x1e')](_0x32a816)[_0x53fa('0x1f')](function(_0x23de16){return _0x23de16;});}return null;};}function removeEntity(_0x308c05,_0x1438f8){return function(_0x178a52){if(_0x178a52){return _0x178a52[_0x53fa('0x20')]()[_0x53fa('0x1f')](function(){_0x308c05[_0x53fa('0x19')](0xcc)[_0x53fa('0x21')]();});}};}function handleEntityNotFound(_0x1ef601,_0x1c3ac4){return function(_0x3a2b60){if(!_0x3a2b60){_0x1ef601['sendStatus'](0x194);}return _0x3a2b60;};}function handleError(_0x53c368,_0x2ccf06){_0x2ccf06=_0x2ccf06||0x1f4;return function(_0x212150){logger[_0x53fa('0x22')](_0x212150[_0x53fa('0x23')]);if(_0x212150['name']){delete _0x212150[_0x53fa('0x24')];}_0x53c368[_0x53fa('0x19')](_0x2ccf06)[_0x53fa('0x25')](_0x212150);};}exports[_0x53fa('0x26')]=function(_0x16343c,_0xa66863){var _0x187d6f={},_0x4afacd={},_0x15babd={'count':0x0,'rows':[]};var _0x3ae083=_['map'](db[_0x53fa('0x27')][_0x53fa('0x28')],function(_0x242513){return{'name':_0x242513['fieldName'],'type':_0x242513['type']['key']};});_0x4afacd['model']=_[_0x53fa('0x29')](_0x3ae083,_0x53fa('0x24'));_0x4afacd['query']=_[_0x53fa('0x2a')](_0x16343c['query']);_0x4afacd[_0x53fa('0x2b')]=_[_0x53fa('0x2c')](_0x4afacd['model'],_0x4afacd['query']);_0x187d6f[_0x53fa('0x2d')]=_[_0x53fa('0x2c')](_0x4afacd[_0x53fa('0x2e')],qs[_0x53fa('0x2f')](_0x16343c[_0x53fa('0x30')][_0x53fa('0x2f')]));_0x187d6f[_0x53fa('0x2d')]=_0x187d6f[_0x53fa('0x2d')][_0x53fa('0x31')]?_0x187d6f[_0x53fa('0x2d')]:_0x4afacd[_0x53fa('0x2e')];if(!_0x16343c[_0x53fa('0x30')][_0x53fa('0x32')](_0x53fa('0x33'))){_0x187d6f[_0x53fa('0x34')]=qs[_0x53fa('0x34')](_0x16343c[_0x53fa('0x30')][_0x53fa('0x34')]);_0x187d6f[_0x53fa('0x35')]=qs[_0x53fa('0x35')](_0x16343c[_0x53fa('0x30')]['offset']);}_0x187d6f[_0x53fa('0x36')]=qs[_0x53fa('0x37')](_0x16343c[_0x53fa('0x30')][_0x53fa('0x37')]);_0x187d6f[_0x53fa('0x38')]=qs[_0x53fa('0x2b')](_[_0x53fa('0x39')](_0x16343c[_0x53fa('0x30')],_0x4afacd[_0x53fa('0x2b')]),_0x3ae083);if(_0x16343c[_0x53fa('0x30')][_0x53fa('0x3a')]){_0x187d6f['where']=_[_0x53fa('0x3b')](_0x187d6f['where'],{'$or':_[_0x53fa('0x29')](_0x3ae083,function(_0x386ed1){if(_0x386ed1['type']!=='VIRTUAL'){var _0x487e66={};_0x487e66[_0x386ed1['name']]={'$like':'%'+_0x16343c[_0x53fa('0x30')][_0x53fa('0x3a')]+'%'};return _0x487e66;}})});}_0x187d6f=_[_0x53fa('0x3b')]({},_0x187d6f,_0x16343c['options']);var _0x32fa50={'where':_0x187d6f[_0x53fa('0x38')]};return db[_0x53fa('0x27')][_0x53fa('0x3c')](_0x32fa50)['then'](function(_0x5a908d){_0x15babd['count']=_0x5a908d;if(_0x16343c['query'][_0x53fa('0x3d')]){_0x187d6f[_0x53fa('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x53fa('0x3f')](_0x187d6f);})[_0x53fa('0x1f')](function(_0xa8d848){_0x15babd['rows']=_0xa8d848;return _0x15babd;})[_0x53fa('0x1f')](respondWithFilteredResult(_0xa66863,_0x187d6f))['catch'](handleError(_0xa66863,null));};exports[_0x53fa('0x40')]=function(_0x35176b,_0x784810){var _0x3d2b77={'raw':!![],'where':{'id':_0x35176b['params']['id']}},_0x172a8e={};_0x172a8e[_0x53fa('0x2e')]=_[_0x53fa('0x2a')](db['JscriptyQuestionReport'][_0x53fa('0x28')]);_0x172a8e['query']=_['keys'](_0x35176b[_0x53fa('0x30')]);_0x172a8e[_0x53fa('0x2b')]=_['intersection'](_0x172a8e[_0x53fa('0x2e')],_0x172a8e[_0x53fa('0x30')]);_0x3d2b77[_0x53fa('0x2d')]=_[_0x53fa('0x2c')](_0x172a8e[_0x53fa('0x2e')],qs['fields'](_0x35176b['query']['fields']));_0x3d2b77[_0x53fa('0x2d')]=_0x3d2b77[_0x53fa('0x2d')][_0x53fa('0x31')]?_0x3d2b77['attributes']:_0x172a8e['model'];if(_0x35176b[_0x53fa('0x30')]['includeAll']){_0x3d2b77[_0x53fa('0x3e')]=[{'all':!![]}];}_0x3d2b77=_[_0x53fa('0x3b')]({},_0x3d2b77,_0x35176b['options']);return db['JscriptyQuestionReport'][_0x53fa('0x41')](_0x3d2b77)[_0x53fa('0x1f')](handleEntityNotFound(_0x784810,null))[_0x53fa('0x1f')](respondWithResult(_0x784810,null))[_0x53fa('0x42')](handleError(_0x784810,null));};exports[_0x53fa('0x43')]=function(_0x575716,_0x42f067){return db[_0x53fa('0x27')][_0x53fa('0x43')](_0x575716[_0x53fa('0x44')],{})[_0x53fa('0x1f')](respondWithResult(_0x42f067,0xc9))['catch'](handleError(_0x42f067,null));};exports[_0x53fa('0x1e')]=function(_0x254379,_0x56917a){if(_0x254379['body']['id']){delete _0x254379[_0x53fa('0x44')]['id'];}return db[_0x53fa('0x27')][_0x53fa('0x41')]({'where':{'id':_0x254379[_0x53fa('0x45')]['id']}})[_0x53fa('0x1f')](handleEntityNotFound(_0x56917a,null))[_0x53fa('0x1f')](saveUpdates(_0x254379['body'],null))['then'](respondWithResult(_0x56917a,null))[_0x53fa('0x42')](handleError(_0x56917a,null));};exports[_0x53fa('0x20')]=function(_0x3d0a8c,_0x286c72){return db[_0x53fa('0x27')][_0x53fa('0x41')]({'where':{'id':_0x3d0a8c[_0x53fa('0x45')]['id']}})[_0x53fa('0x1f')](handleEntityNotFound(_0x286c72,null))['then'](removeEntity(_0x286c72,null))[_0x53fa('0x42')](handleError(_0x286c72,null));};exports[_0x53fa('0x46')]=function(_0xe939ee,_0x1ed60c){return db[_0x53fa('0x27')]['describe']()[_0x53fa('0x1f')](respondWithResult(_0x1ed60c,null))['catch'](handleError(_0x1ed60c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index f2df64d..195063f 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 _0x389f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x5ed611,_0x406032){var _0x189627=function(_0x4458ff){while(--_0x4458ff){_0x5ed611['push'](_0x5ed611['shift']());}};_0x189627(++_0x406032);}(_0x389f,0x95));var _0xf389=function(_0x47f14a,_0x56bc7f){_0x47f14a=_0x47f14a-0x0;var _0x74e231=_0x389f[_0x47f14a];return _0x74e231;};'use strict';var _=require(_0xf389('0x0'));var util=require(_0xf389('0x1'));var logger=require(_0xf389('0x2'))(_0xf389('0x3'));var moment=require(_0xf389('0x4'));var BPromise=require(_0xf389('0x5'));var rp=require(_0xf389('0x6'));var fs=require('fs');var path=require(_0xf389('0x7'));var rimraf=require(_0xf389('0x8'));var config=require(_0xf389('0x9'));var attributes=require(_0xf389('0xa'));module[_0xf389('0xb')]=function(_0x58aeee,_0x33d8c3){return _0x58aeee[_0xf389('0xc')](_0xf389('0xd'),attributes,{'tableName':_0xf389('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6bc=['lodash','../../config/logger','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x4e32b4,_0xeb32f8){var _0x398b3e=function(_0x154379){while(--_0x154379){_0x4e32b4['push'](_0x4e32b4['shift']());}};_0x398b3e(++_0xeb32f8);}(_0xb6bc,0x75));var _0xcb6b=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0xb6bc[_0x2c0dc0];return _0x4c0990;};'use strict';var _=require(_0xcb6b('0x0'));var util=require('util');var logger=require(_0xcb6b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb6b('0x2'));var fs=require('fs');var path=require(_0xcb6b('0x3'));var rimraf=require('rimraf');var config=require(_0xcb6b('0x4'));var attributes=require(_0xcb6b('0x5'));module[_0xcb6b('0x6')]=function(_0x5e6e88,_0x1c3fc8){return _0x5e6e88['define'](_0xcb6b('0x7'),attributes,{'tableName':_0xcb6b('0x8'),'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 95cfecb..0e551d3 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 _0x578d=['rpc','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','info','result','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4942ea,_0x3f918a){var _0x169062=function(_0x3305a5){while(--_0x3305a5){_0x4942ea['push'](_0x4942ea['shift']());}};_0x169062(++_0x3f918a);}(_0x578d,0x9d));var _0xd578=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x578d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd578('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd578('0x1'));var fs=require('fs');var Redis=require(_0xd578('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd578('0x3'));var logger=require(_0xd578('0x4'))(_0xd578('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd578('0x6')][_0xd578('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20dd3a,_0x40a34e,_0x1d09dd){return new BPromise(function(_0x5565f7,_0x36dadb){return client[_0xd578('0x8')](_0x20dd3a,_0x1d09dd)[_0xd578('0x9')](function(_0x1375e1){logger['info'](_0xd578('0xa'),_0x40a34e,_0xd578('0xb'));logger[_0xd578('0xc')](_0xd578('0xd'),_0x40a34e,_0xd578('0xb'),JSON['stringify'](_0x1375e1));if(_0x1375e1[_0xd578('0xe')]){if(_0x1375e1[_0xd578('0xe')]['code']===0x1f4){logger[_0xd578('0xe')](_0xd578('0xa'),_0x40a34e,_0x1375e1['error'][_0xd578('0xf')]);return _0x36dadb(_0x1375e1[_0xd578('0xe')]['message']);}logger['error'](_0xd578('0xa'),_0x40a34e,_0x1375e1[_0xd578('0xe')][_0xd578('0xf')]);return _0x5565f7(_0x1375e1['error'][_0xd578('0xf')]);}else{logger[_0xd578('0x10')](_0xd578('0xa'),_0x40a34e,_0xd578('0xb'));_0x5565f7(_0x1375e1[_0xd578('0x11')][_0xd578('0xf')]);}})['catch'](function(_0x3b67cc){logger[_0xd578('0xe')](_0xd578('0xa'),_0x40a34e,_0x3b67cc);_0x36dadb(_0x3b67cc);});});} \ No newline at end of file +var _0xad53=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment'];(function(_0x5c4236,_0x238f5b){var _0x1ec5f8=function(_0x3c39bf){while(--_0x3c39bf){_0x5c4236['push'](_0x5c4236['shift']());}};_0x1ec5f8(++_0x238f5b);}(_0xad53,0xf9));var _0x3ad5=function(_0x3ee166,_0x4aa48e){_0x3ee166=_0x3ee166-0x0;var _0x2c50d7=_0xad53[_0x3ee166];return _0x2c50d7;};'use strict';var _=require(_0x3ad5('0x0'));var util=require(_0x3ad5('0x1'));var moment=require(_0x3ad5('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ad5('0x3'));var fs=require('fs');var Redis=require(_0x3ad5('0x4'));var db=require(_0x3ad5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ad5('0x6'))(_0x3ad5('0x7'));var config=require(_0x3ad5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3ad5('0x9')][_0x3ad5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c967f,_0x1648d7,_0x20c7b2){return new BPromise(function(_0x293b32,_0x58f613){return client[_0x3ad5('0xb')](_0x3c967f,_0x20c7b2)[_0x3ad5('0xc')](function(_0x48cc25){logger[_0x3ad5('0xd')](_0x3ad5('0xe'),_0x1648d7,_0x3ad5('0xf'));logger[_0x3ad5('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x1648d7,_0x3ad5('0xf'),JSON['stringify'](_0x48cc25));if(_0x48cc25['error']){if(_0x48cc25[_0x3ad5('0x11')][_0x3ad5('0x12')]===0x1f4){logger[_0x3ad5('0x11')](_0x3ad5('0xe'),_0x1648d7,_0x48cc25[_0x3ad5('0x11')][_0x3ad5('0x13')]);return _0x58f613(_0x48cc25[_0x3ad5('0x11')][_0x3ad5('0x13')]);}logger['error'](_0x3ad5('0xe'),_0x1648d7,_0x48cc25[_0x3ad5('0x11')][_0x3ad5('0x13')]);return _0x293b32(_0x48cc25[_0x3ad5('0x11')][_0x3ad5('0x13')]);}else{logger[_0x3ad5('0xd')](_0x3ad5('0xe'),_0x1648d7,_0x3ad5('0xf'));_0x293b32(_0x48cc25['result'][_0x3ad5('0x13')]);}})[_0x3ad5('0x14')](function(_0x49bcf7){logger[_0x3ad5('0x11')](_0x3ad5('0xe'),_0x1648d7,_0x49bcf7);_0x58f613(_0x49bcf7);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1e3285b..869dfcd 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 _0x79a8=['delete','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','show','/:id/questions','getQuestions','create','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79a8,0x1d0));var _0x879a=function(_0x40e76b,_0x9f1a5){_0x40e76b=_0x40e76b-0x0;var _0x8b2a31=_0x79a8[_0x40e76b];return _0x8b2a31;};'use strict';var multer=require(_0x879a('0x0'));var util=require('util');var path=require(_0x879a('0x1'));var timeout=require(_0x879a('0x2'));var express=require(_0x879a('0x3'));var router=express['Router']();var auth=require(_0x879a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x879a('0x5'));var controller=require(_0x879a('0x6'));router[_0x879a('0x7')]('/',auth[_0x879a('0x8')](),controller[_0x879a('0x9')]);router[_0x879a('0x7')](_0x879a('0xa'),auth[_0x879a('0x8')](),controller['describe']);router[_0x879a('0x7')]('/:id',auth[_0x879a('0x8')](),controller[_0x879a('0xb')]);router['get'](_0x879a('0xc'),auth[_0x879a('0x8')](),controller[_0x879a('0xd')]);router['post']('/',auth[_0x879a('0x8')](),controller[_0x879a('0xe')]);router['put']('/:id',auth[_0x879a('0x8')](),controller[_0x879a('0xf')]);router[_0x879a('0x10')](_0x879a('0x11'),auth['isAuthenticated'](),controller[_0x879a('0x12')]);module[_0x879a('0x13')]=router; \ No newline at end of file +var _0x3b75=['/:id','show','/:id/questions','getQuestions','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x482393,_0x355061){var _0x4c07ae=function(_0x139328){while(--_0x139328){_0x482393['push'](_0x482393['shift']());}};_0x4c07ae(++_0x355061);}(_0x3b75,0x144));var _0x53b7=function(_0x532d78,_0x25b6a8){_0x532d78=_0x532d78-0x0;var _0x5990c4=_0x3b75[_0x532d78];return _0x5990c4;};'use strict';var multer=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var path=require(_0x53b7('0x2'));var timeout=require(_0x53b7('0x3'));var express=require(_0x53b7('0x4'));var router=express[_0x53b7('0x5')]();var auth=require(_0x53b7('0x6'));var interaction=require(_0x53b7('0x7'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0x53b7('0x8')]('/',auth[_0x53b7('0x9')](),controller[_0x53b7('0xa')]);router[_0x53b7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x53b7('0xb')]);router[_0x53b7('0x8')](_0x53b7('0xc'),auth[_0x53b7('0x9')](),controller[_0x53b7('0xd')]);router['get'](_0x53b7('0xe'),auth[_0x53b7('0x9')](),controller[_0x53b7('0xf')]);router[_0x53b7('0x10')]('/',auth[_0x53b7('0x9')](),controller[_0x53b7('0x11')]);router['put']('/:id',auth[_0x53b7('0x9')](),controller['update']);router[_0x53b7('0x12')]('/:id',auth[_0x53b7('0x9')](),controller[_0x53b7('0x13')]);module[_0x53b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 0596a9d..d3b0d98 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 _0xf633=['moment','sequelize','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN'];(function(_0x4d08b3,_0x815c75){var _0x1d2231=function(_0x51a9a5){while(--_0x51a9a5){_0x4d08b3['push'](_0x4d08b3['shift']());}};_0x1d2231(++_0x815c75);}(_0xf633,0x18c));var _0x3f63=function(_0x566177,_0x1e0735){_0x566177=_0x566177-0x0;var _0x2f1d44=_0xf633[_0x566177];return _0x2f1d44;};'use strict';var moment=require(_0x3f63('0x0'));var Sequelize=require(_0x3f63('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x22b37b){this['setDataValue'](_0x3f63('0x2'),_0x22b37b);this['setDataValue'](_0x3f63('0x3'),moment()[_0x3f63('0x4')](_0x3f63('0x5')));}},'endtime':{'type':Sequelize[_0x3f63('0x6')]},'membername':{'type':Sequelize[_0x3f63('0x7')]},'projectname':{'type':Sequelize[_0x3f63('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3f63('0x7')]},'calleridname':{'type':Sequelize[_0x3f63('0x7')]},'calleridnum':{'type':Sequelize[_0x3f63('0x7')]},'completed':{'type':Sequelize[_0x3f63('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xa8a8=['STRING','BOOLEAN','moment','exports','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x540b16,_0x3efaa4){var _0x39d678=function(_0x3adc49){while(--_0x3adc49){_0x540b16['push'](_0x540b16['shift']());}};_0x39d678(++_0x3efaa4);}(_0xa8a8,0x119));var _0x8a8a=function(_0x3d043f,_0x2660dc){_0x3d043f=_0x3d043f-0x0;var _0x2bd3a0=_0xa8a8[_0x3d043f];return _0x2bd3a0;};'use strict';var moment=require(_0x8a8a('0x0'));var Sequelize=require('sequelize');module[_0x8a8a('0x1')]={'starttime':{'type':Sequelize[_0x8a8a('0x2')],'set':function(_0xd595fa){this[_0x8a8a('0x3')](_0x8a8a('0x4'),_0xd595fa);this[_0x8a8a('0x3')]('endtime',moment()[_0x8a8a('0x5')](_0x8a8a('0x6')));}},'endtime':{'type':Sequelize[_0x8a8a('0x2')]},'membername':{'type':Sequelize[_0x8a8a('0x7')]},'projectname':{'type':Sequelize[_0x8a8a('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x8a8a('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7bc4bcb..43b82b0 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 _0x0386=['pick','VIRTUAL','merge','options','includeAll','findAll','catch','show','length','include','create','body','find','params','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','filter','rows','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','name','send','index','map','JscriptySessionReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0386,0x1ea));var _0x6038=function(_0x314c55,_0x2b721c){_0x314c55=_0x314c55-0x0;var _0x342bce=_0x0386[_0x314c55];return _0x342bce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6038('0x0'));var rimraf=require(_0x6038('0x1'));var zipdir=require(_0x6038('0x2'));var jsonpatch=require(_0x6038('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6038('0x4'));var Mustache=require(_0x6038('0x5'));var util=require(_0x6038('0x6'));var path=require(_0x6038('0x7'));var sox=require(_0x6038('0x8'));var csv=require(_0x6038('0x9'));var ejs=require(_0x6038('0xa'));var fs=require('fs');var _=require(_0x6038('0xb'));var squel=require(_0x6038('0xc'));var crypto=require(_0x6038('0xd'));var jsforce=require(_0x6038('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6038('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6038('0xf'));var authService=require(_0x6038('0x10'));var qs=require(_0x6038('0x11'));var as=require(_0x6038('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6038('0x13'));var utils=require(_0x6038('0x14'));var config=require(_0x6038('0x15'));var db=require(_0x6038('0x16'))['db'];function respondWithStatusCode(_0x360903,_0x2e223b){_0x2e223b=_0x2e223b||0xcc;return function(_0x3b4878){if(_0x3b4878){return _0x360903[_0x6038('0x17')](_0x2e223b);}return _0x360903[_0x6038('0x18')](_0x2e223b)[_0x6038('0x19')]();};}function respondWithResult(_0xa87f97,_0xd70c03){_0xd70c03=_0xd70c03||0xc8;return function(_0x2299f2){if(_0x2299f2){return _0xa87f97['status'](_0xd70c03)[_0x6038('0x1a')](_0x2299f2);}};}function respondWithFilteredResult(_0x305041,_0x4fc99d){return function(_0xdd9bf8){if(_0xdd9bf8){var _0x4aa2f0=_0xdd9bf8[_0x6038('0x1b')],_0x5beb1a=_0x4fc99d[_0x6038('0x1c')],_0x8ff720=_0x4fc99d['offset']+_0x4fc99d[_0x6038('0x1d')],_0x22672b;if(_0x8ff720>=_0x4aa2f0){_0x8ff720=_0x4aa2f0;_0x22672b=0xc8;}else{_0x22672b=0xce;}_0x305041['status'](_0x22672b);return _0x305041[_0x6038('0x1e')](_0x6038('0x1f'),_0x5beb1a+'-'+_0x8ff720+'/'+_0x4aa2f0)['json'](_0xdd9bf8);}return null;};}function patchUpdates(_0x43c6e6){return function(_0x1fcddc){try{jsonpatch[_0x6038('0x20')](_0x1fcddc,_0x43c6e6,!![]);}catch(_0x48346f){return BPromise['reject'](_0x48346f);}return _0x1fcddc[_0x6038('0x21')]();};}function saveUpdates(_0x4a69cf,_0xbd58ba){return function(_0x28dd75){if(_0x28dd75){return _0x28dd75[_0x6038('0x22')](_0x4a69cf)[_0x6038('0x23')](function(_0x408a25){return _0x408a25;});}return null;};}function removeEntity(_0x385914,_0x2283ab){return function(_0x2fb20f){if(_0x2fb20f){return _0x2fb20f['destroy']()[_0x6038('0x23')](function(){_0x385914[_0x6038('0x18')](0xcc)[_0x6038('0x19')]();});}};}function handleEntityNotFound(_0x3c6973,_0x171fb1){return function(_0x4b97bd){if(!_0x4b97bd){_0x3c6973[_0x6038('0x17')](0x194);}return _0x4b97bd;};}function handleError(_0x31b50b,_0x1e9591){_0x1e9591=_0x1e9591||0x1f4;return function(_0x5b53d2){logger[_0x6038('0x24')](_0x5b53d2['stack']);if(_0x5b53d2['name']){delete _0x5b53d2[_0x6038('0x25')];}_0x31b50b[_0x6038('0x18')](_0x1e9591)[_0x6038('0x26')](_0x5b53d2);};}exports[_0x6038('0x27')]=function(_0x161ee8,_0x58c757){var _0x25457a={},_0x256d9c={},_0x595832={'count':0x0,'rows':[]};var _0x11df6d=_[_0x6038('0x28')](db[_0x6038('0x29')]['rawAttributes'],function(_0x5aee10){return{'name':_0x5aee10[_0x6038('0x2a')],'type':_0x5aee10[_0x6038('0x2b')][_0x6038('0x2c')]};});_0x256d9c[_0x6038('0x2d')]=_[_0x6038('0x28')](_0x11df6d,_0x6038('0x25'));_0x256d9c['query']=_[_0x6038('0x2e')](_0x161ee8[_0x6038('0x2f')]);_0x256d9c[_0x6038('0x30')]=_[_0x6038('0x31')](_0x256d9c[_0x6038('0x2d')],_0x256d9c[_0x6038('0x2f')]);_0x25457a['attributes']=_[_0x6038('0x31')](_0x256d9c[_0x6038('0x2d')],qs[_0x6038('0x32')](_0x161ee8[_0x6038('0x2f')][_0x6038('0x32')]));_0x25457a['attributes']=_0x25457a[_0x6038('0x33')]['length']?_0x25457a[_0x6038('0x33')]:_0x256d9c[_0x6038('0x2d')];if(!_0x161ee8[_0x6038('0x2f')][_0x6038('0x34')]('nolimit')){_0x25457a[_0x6038('0x1d')]=qs[_0x6038('0x1d')](_0x161ee8[_0x6038('0x2f')][_0x6038('0x1d')]);_0x25457a['offset']=qs[_0x6038('0x1c')](_0x161ee8['query']['offset']);}_0x25457a[_0x6038('0x35')]=qs['sort'](_0x161ee8[_0x6038('0x2f')][_0x6038('0x36')]);_0x25457a[_0x6038('0x37')]=qs[_0x6038('0x30')](_[_0x6038('0x38')](_0x161ee8[_0x6038('0x2f')],_0x256d9c[_0x6038('0x30')]),_0x11df6d);if(_0x161ee8['query']['filter']){_0x25457a[_0x6038('0x37')]=_['merge'](_0x25457a[_0x6038('0x37')],{'$or':_[_0x6038('0x28')](_0x11df6d,function(_0x122cbd){if(_0x122cbd['type']!==_0x6038('0x39')){var _0x544e75={};_0x544e75[_0x122cbd[_0x6038('0x25')]]={'$like':'%'+_0x161ee8[_0x6038('0x2f')]['filter']+'%'};return _0x544e75;}})});}_0x25457a=_[_0x6038('0x3a')]({},_0x25457a,_0x161ee8[_0x6038('0x3b')]);var _0x36145f={'where':_0x25457a[_0x6038('0x37')]};return db[_0x6038('0x29')][_0x6038('0x1b')](_0x36145f)['then'](function(_0x3aa7d4){_0x595832[_0x6038('0x1b')]=_0x3aa7d4;if(_0x161ee8[_0x6038('0x2f')][_0x6038('0x3c')]){_0x25457a['include']=[{'all':!![]}];}return db[_0x6038('0x29')][_0x6038('0x3d')](_0x25457a);})['then'](function(_0x4c1c3){_0x595832['rows']=_0x4c1c3;return _0x595832;})[_0x6038('0x23')](respondWithFilteredResult(_0x58c757,_0x25457a))[_0x6038('0x3e')](handleError(_0x58c757,null));};exports[_0x6038('0x3f')]=function(_0xceae95,_0x308777){var _0x15e232={'raw':!![],'where':{'id':_0xceae95['params']['id']}},_0x5ac62c={};_0x5ac62c['model']=_[_0x6038('0x2e')](db[_0x6038('0x29')]['rawAttributes']);_0x5ac62c['query']=_[_0x6038('0x2e')](_0xceae95['query']);_0x5ac62c[_0x6038('0x30')]=_['intersection'](_0x5ac62c[_0x6038('0x2d')],_0x5ac62c['query']);_0x15e232[_0x6038('0x33')]=_[_0x6038('0x31')](_0x5ac62c[_0x6038('0x2d')],qs[_0x6038('0x32')](_0xceae95['query'][_0x6038('0x32')]));_0x15e232['attributes']=_0x15e232[_0x6038('0x33')][_0x6038('0x40')]?_0x15e232[_0x6038('0x33')]:_0x5ac62c[_0x6038('0x2d')];if(_0xceae95[_0x6038('0x2f')]['includeAll']){_0x15e232[_0x6038('0x41')]=[{'all':!![]}];}_0x15e232=_['merge']({},_0x15e232,_0xceae95[_0x6038('0x3b')]);return db['JscriptySessionReport']['find'](_0x15e232)[_0x6038('0x23')](handleEntityNotFound(_0x308777,null))[_0x6038('0x23')](respondWithResult(_0x308777,null))[_0x6038('0x3e')](handleError(_0x308777,null));};exports[_0x6038('0x42')]=function(_0x1ea28a,_0x2a71f3){return db[_0x6038('0x29')]['create'](_0x1ea28a[_0x6038('0x43')],{})['then'](respondWithResult(_0x2a71f3,0xc9))[_0x6038('0x3e')](handleError(_0x2a71f3,null));};exports[_0x6038('0x22')]=function(_0x29ff0d,_0x4c0efd){if(_0x29ff0d[_0x6038('0x43')]['id']){delete _0x29ff0d[_0x6038('0x43')]['id'];}return db['JscriptySessionReport'][_0x6038('0x44')]({'where':{'id':_0x29ff0d[_0x6038('0x45')]['id']}})[_0x6038('0x23')](handleEntityNotFound(_0x4c0efd,null))[_0x6038('0x23')](saveUpdates(_0x29ff0d['body'],null))[_0x6038('0x23')](respondWithResult(_0x4c0efd,null))[_0x6038('0x3e')](handleError(_0x4c0efd,null));};exports[_0x6038('0x46')]=function(_0x553200,_0x26a21c){return db['JscriptySessionReport'][_0x6038('0x44')]({'where':{'id':_0x553200[_0x6038('0x45')]['id']}})['then'](handleEntityNotFound(_0x26a21c,null))[_0x6038('0x23')](removeEntity(_0x26a21c,null))[_0x6038('0x3e')](handleError(_0x26a21c,null));};exports[_0x6038('0x47')]=function(_0x370257,_0x56aca2){return db[_0x6038('0x29')][_0x6038('0x47')]()[_0x6038('0x23')](respondWithResult(_0x56aca2,null))['catch'](handleError(_0x56aca2,null));};exports[_0x6038('0x48')]=function(_0x8315e,_0x6734d1,_0x1f8f9b){var _0x5ab9fe={'raw':!![],'where':{}};var _0x30bf92={};var _0x52a022={'count':0x0,'rows':[]};return db[_0x6038('0x29')][_0x6038('0x49')]({'where':{'id':_0x8315e[_0x6038('0x45')]['id']}})[_0x6038('0x23')](handleEntityNotFound(_0x6734d1,null))[_0x6038('0x23')](function(_0x17b410){if(_0x17b410){_0x30bf92[_0x6038('0x2d')]=_['keys'](db[_0x6038('0x4a')][_0x6038('0x4b')]);_0x30bf92[_0x6038('0x2f')]=_['keys'](_0x8315e[_0x6038('0x2f')]);_0x30bf92['filters']=_[_0x6038('0x31')](_0x30bf92[_0x6038('0x2d')],_0x30bf92['query']);_0x5ab9fe[_0x6038('0x33')]=_[_0x6038('0x31')](_0x30bf92[_0x6038('0x2d')],qs['fields'](_0x8315e[_0x6038('0x2f')][_0x6038('0x32')]));_0x5ab9fe[_0x6038('0x33')]=_0x5ab9fe[_0x6038('0x33')][_0x6038('0x40')]?_0x5ab9fe[_0x6038('0x33')]:_0x30bf92[_0x6038('0x2d')];if(!_0x8315e[_0x6038('0x2f')][_0x6038('0x34')]('nolimit')){_0x5ab9fe['limit']=qs[_0x6038('0x1d')](_0x8315e[_0x6038('0x2f')][_0x6038('0x1d')]);_0x5ab9fe[_0x6038('0x1c')]=qs[_0x6038('0x1c')](_0x8315e[_0x6038('0x2f')][_0x6038('0x1c')]);}_0x5ab9fe[_0x6038('0x35')]=qs[_0x6038('0x36')](_0x8315e[_0x6038('0x2f')][_0x6038('0x36')]);_0x5ab9fe['where']=qs[_0x6038('0x30')](_['pick'](_0x8315e['query'],_0x30bf92[_0x6038('0x30')]));_0x5ab9fe[_0x6038('0x37')]['SessionId']=_0x17b410['id'];if(_0x8315e[_0x6038('0x2f')][_0x6038('0x4c')]){_0x5ab9fe[_0x6038('0x37')]=_['merge'](_0x5ab9fe[_0x6038('0x37')],{'$or':_[_0x6038('0x28')](_0x5ab9fe[_0x6038('0x33')],function(_0x2ec8e9){var _0x21650c={};_0x21650c[_0x2ec8e9]={'$like':'%'+_0x8315e[_0x6038('0x2f')][_0x6038('0x4c')]+'%'};return _0x21650c;})});}_0x5ab9fe=_[_0x6038('0x3a')]({},_0x5ab9fe,_0x8315e[_0x6038('0x3b')]);return db[_0x6038('0x4a')][_0x6038('0x1b')]({'where':_0x5ab9fe[_0x6038('0x37')]})['then'](function(_0x15831e){_0x52a022[_0x6038('0x1b')]=_0x15831e;if(_0x8315e['query'][_0x6038('0x3c')]){_0x5ab9fe[_0x6038('0x41')]=[{'all':!![]}];}return db[_0x6038('0x4a')][_0x6038('0x3d')](_0x5ab9fe);})['then'](function(_0x2a953f){_0x52a022[_0x6038('0x4d')]=_0x2a953f;return _0x52a022;});}})[_0x6038('0x23')](respondWithFilteredResult(_0x6734d1,_0x5ab9fe))[_0x6038('0x3e')](handleError(_0x6734d1,null));}; \ No newline at end of file +var _0xac5f=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','then','destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','fields','length','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport','nolimit','order','SessionId','count','findAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xac5f,0x1b5));var _0xfac5=function(_0x1708a8,_0x40cb27){_0x1708a8=_0x1708a8-0x0;var _0x7c85e3=_0xac5f[_0x1708a8];return _0x7c85e3;};'use strict';var pdf=require(_0xfac5('0x0'));var emlformat=require(_0xfac5('0x1'));var rimraf=require(_0xfac5('0x2'));var zipdir=require(_0xfac5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfac5('0x4'));var moment=require('moment');var BPromise=require(_0xfac5('0x5'));var Mustache=require('mustache');var util=require(_0xfac5('0x6'));var path=require('path');var sox=require(_0xfac5('0x7'));var csv=require(_0xfac5('0x8'));var ejs=require(_0xfac5('0x9'));var fs=require('fs');var _=require(_0xfac5('0xa'));var squel=require('squel');var crypto=require(_0xfac5('0xb'));var jsforce=require(_0xfac5('0xc'));var deskjs=require(_0xfac5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfac5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfac5('0xf'));var qs=require(_0xfac5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfac5('0x11'));var logger=require(_0xfac5('0x12'))(_0xfac5('0x13'));var utils=require(_0xfac5('0x14'));var config=require(_0xfac5('0x15'));var db=require(_0xfac5('0x16'))['db'];function respondWithStatusCode(_0x48c5d6,_0x40ab65){_0x40ab65=_0x40ab65||0xcc;return function(_0x265739){if(_0x265739){return _0x48c5d6[_0xfac5('0x17')](_0x40ab65);}return _0x48c5d6[_0xfac5('0x18')](_0x40ab65)[_0xfac5('0x19')]();};}function respondWithResult(_0x28fd0c,_0x25a735){_0x25a735=_0x25a735||0xc8;return function(_0x52f529){if(_0x52f529){return _0x28fd0c[_0xfac5('0x18')](_0x25a735)[_0xfac5('0x1a')](_0x52f529);}};}function respondWithFilteredResult(_0x29183c,_0x4a9433){return function(_0x3d5a37){if(_0x3d5a37){var _0x564589=_0x3d5a37['count'],_0x26c06b=_0x4a9433[_0xfac5('0x1b')],_0x27cfa4=_0x4a9433[_0xfac5('0x1b')]+_0x4a9433['limit'],_0x498f86;if(_0x27cfa4>=_0x564589){_0x27cfa4=_0x564589;_0x498f86=0xc8;}else{_0x498f86=0xce;}_0x29183c[_0xfac5('0x18')](_0x498f86);return _0x29183c[_0xfac5('0x1c')](_0xfac5('0x1d'),_0x26c06b+'-'+_0x27cfa4+'/'+_0x564589)['json'](_0x3d5a37);}return null;};}function patchUpdates(_0x36d547){return function(_0x55a217){try{jsonpatch['apply'](_0x55a217,_0x36d547,!![]);}catch(_0x57abca){return BPromise[_0xfac5('0x1e')](_0x57abca);}return _0x55a217['save']();};}function saveUpdates(_0x28d1a2,_0x44e3ee){return function(_0xcd3f87){if(_0xcd3f87){return _0xcd3f87['update'](_0x28d1a2)[_0xfac5('0x1f')](function(_0xbc4fa8){return _0xbc4fa8;});}return null;};}function removeEntity(_0x338c45,_0x1b9216){return function(_0x245a1f){if(_0x245a1f){return _0x245a1f[_0xfac5('0x20')]()[_0xfac5('0x1f')](function(){_0x338c45[_0xfac5('0x18')](0xcc)[_0xfac5('0x19')]();});}};}function handleEntityNotFound(_0x1bfe44,_0x51808b){return function(_0x4ed731){if(!_0x4ed731){_0x1bfe44['sendStatus'](0x194);}return _0x4ed731;};}function handleError(_0x35126d,_0x2235f6){_0x2235f6=_0x2235f6||0x1f4;return function(_0x129ab3){logger[_0xfac5('0x21')](_0x129ab3['stack']);if(_0x129ab3['name']){delete _0x129ab3[_0xfac5('0x22')];}_0x35126d[_0xfac5('0x18')](_0x2235f6)[_0xfac5('0x23')](_0x129ab3);};}exports[_0xfac5('0x24')]=function(_0x310c1a,_0x31160a){var _0x43e062={},_0x5b4f9b={},_0x5ec16a={'count':0x0,'rows':[]};var _0x1ddc91=_[_0xfac5('0x25')](db[_0xfac5('0x26')][_0xfac5('0x27')],function(_0x366f11){return{'name':_0x366f11[_0xfac5('0x28')],'type':_0x366f11[_0xfac5('0x29')][_0xfac5('0x2a')]};});_0x5b4f9b[_0xfac5('0x2b')]=_[_0xfac5('0x25')](_0x1ddc91,'name');_0x5b4f9b[_0xfac5('0x2c')]=_[_0xfac5('0x2d')](_0x310c1a[_0xfac5('0x2c')]);_0x5b4f9b[_0xfac5('0x2e')]=_['intersection'](_0x5b4f9b[_0xfac5('0x2b')],_0x5b4f9b[_0xfac5('0x2c')]);_0x43e062['attributes']=_[_0xfac5('0x2f')](_0x5b4f9b[_0xfac5('0x2b')],qs['fields'](_0x310c1a[_0xfac5('0x2c')]['fields']));_0x43e062[_0xfac5('0x30')]=_0x43e062[_0xfac5('0x30')]['length']?_0x43e062[_0xfac5('0x30')]:_0x5b4f9b[_0xfac5('0x2b')];if(!_0x310c1a[_0xfac5('0x2c')][_0xfac5('0x31')]('nolimit')){_0x43e062['limit']=qs[_0xfac5('0x32')](_0x310c1a[_0xfac5('0x2c')][_0xfac5('0x32')]);_0x43e062[_0xfac5('0x1b')]=qs['offset'](_0x310c1a['query'][_0xfac5('0x1b')]);}_0x43e062['order']=qs[_0xfac5('0x33')](_0x310c1a[_0xfac5('0x2c')][_0xfac5('0x33')]);_0x43e062[_0xfac5('0x34')]=qs[_0xfac5('0x2e')](_[_0xfac5('0x35')](_0x310c1a[_0xfac5('0x2c')],_0x5b4f9b[_0xfac5('0x2e')]),_0x1ddc91);if(_0x310c1a[_0xfac5('0x2c')][_0xfac5('0x36')]){_0x43e062[_0xfac5('0x34')]=_['merge'](_0x43e062['where'],{'$or':_[_0xfac5('0x25')](_0x1ddc91,function(_0x1cb94c){if(_0x1cb94c[_0xfac5('0x29')]!==_0xfac5('0x37')){var _0x27fc5b={};_0x27fc5b[_0x1cb94c['name']]={'$like':'%'+_0x310c1a[_0xfac5('0x2c')]['filter']+'%'};return _0x27fc5b;}})});}_0x43e062=_[_0xfac5('0x38')]({},_0x43e062,_0x310c1a[_0xfac5('0x39')]);var _0x2515ff={'where':_0x43e062['where']};return db[_0xfac5('0x26')]['count'](_0x2515ff)[_0xfac5('0x1f')](function(_0x5e5ed8){_0x5ec16a['count']=_0x5e5ed8;if(_0x310c1a[_0xfac5('0x2c')][_0xfac5('0x3a')]){_0x43e062[_0xfac5('0x3b')]=[{'all':!![]}];}return db[_0xfac5('0x26')]['findAll'](_0x43e062);})['then'](function(_0xf56207){_0x5ec16a[_0xfac5('0x3c')]=_0xf56207;return _0x5ec16a;})[_0xfac5('0x1f')](respondWithFilteredResult(_0x31160a,_0x43e062))['catch'](handleError(_0x31160a,null));};exports['show']=function(_0x4253b7,_0x6912be){var _0x17004f={'raw':!![],'where':{'id':_0x4253b7[_0xfac5('0x3d')]['id']}},_0x54e4e9={};_0x54e4e9[_0xfac5('0x2b')]=_[_0xfac5('0x2d')](db[_0xfac5('0x26')]['rawAttributes']);_0x54e4e9[_0xfac5('0x2c')]=_['keys'](_0x4253b7[_0xfac5('0x2c')]);_0x54e4e9[_0xfac5('0x2e')]=_[_0xfac5('0x2f')](_0x54e4e9[_0xfac5('0x2b')],_0x54e4e9[_0xfac5('0x2c')]);_0x17004f[_0xfac5('0x30')]=_['intersection'](_0x54e4e9['model'],qs['fields'](_0x4253b7[_0xfac5('0x2c')][_0xfac5('0x3e')]));_0x17004f[_0xfac5('0x30')]=_0x17004f['attributes'][_0xfac5('0x3f')]?_0x17004f['attributes']:_0x54e4e9['model'];if(_0x4253b7['query']['includeAll']){_0x17004f[_0xfac5('0x3b')]=[{'all':!![]}];}_0x17004f=_[_0xfac5('0x38')]({},_0x17004f,_0x4253b7[_0xfac5('0x39')]);return db[_0xfac5('0x26')][_0xfac5('0x40')](_0x17004f)['then'](handleEntityNotFound(_0x6912be,null))[_0xfac5('0x1f')](respondWithResult(_0x6912be,null))[_0xfac5('0x41')](handleError(_0x6912be,null));};exports[_0xfac5('0x42')]=function(_0x1f7782,_0x4ee244){return db[_0xfac5('0x26')][_0xfac5('0x42')](_0x1f7782['body'],{})['then'](respondWithResult(_0x4ee244,0xc9))[_0xfac5('0x41')](handleError(_0x4ee244,null));};exports['update']=function(_0x493938,_0x45b2fe){if(_0x493938['body']['id']){delete _0x493938[_0xfac5('0x43')]['id'];}return db['JscriptySessionReport'][_0xfac5('0x40')]({'where':{'id':_0x493938[_0xfac5('0x3d')]['id']}})[_0xfac5('0x1f')](handleEntityNotFound(_0x45b2fe,null))['then'](saveUpdates(_0x493938[_0xfac5('0x43')],null))[_0xfac5('0x1f')](respondWithResult(_0x45b2fe,null))[_0xfac5('0x41')](handleError(_0x45b2fe,null));};exports[_0xfac5('0x20')]=function(_0x520489,_0xe0bddb){return db[_0xfac5('0x26')]['find']({'where':{'id':_0x520489['params']['id']}})[_0xfac5('0x1f')](handleEntityNotFound(_0xe0bddb,null))[_0xfac5('0x1f')](removeEntity(_0xe0bddb,null))['catch'](handleError(_0xe0bddb,null));};exports[_0xfac5('0x44')]=function(_0x5d5210,_0x2f794c){return db['JscriptySessionReport'][_0xfac5('0x44')]()[_0xfac5('0x1f')](respondWithResult(_0x2f794c,null))[_0xfac5('0x41')](handleError(_0x2f794c,null));};exports[_0xfac5('0x45')]=function(_0x38c29a,_0x592c0b,_0x357da4){var _0x212a76={'raw':!![],'where':{}};var _0x397c11={};var _0xd275b0={'count':0x0,'rows':[]};return db[_0xfac5('0x26')]['findOne']({'where':{'id':_0x38c29a[_0xfac5('0x3d')]['id']}})[_0xfac5('0x1f')](handleEntityNotFound(_0x592c0b,null))['then'](function(_0x4ccc7a){if(_0x4ccc7a){_0x397c11[_0xfac5('0x2b')]=_[_0xfac5('0x2d')](db[_0xfac5('0x46')][_0xfac5('0x27')]);_0x397c11[_0xfac5('0x2c')]=_[_0xfac5('0x2d')](_0x38c29a[_0xfac5('0x2c')]);_0x397c11[_0xfac5('0x2e')]=_[_0xfac5('0x2f')](_0x397c11[_0xfac5('0x2b')],_0x397c11[_0xfac5('0x2c')]);_0x212a76[_0xfac5('0x30')]=_[_0xfac5('0x2f')](_0x397c11[_0xfac5('0x2b')],qs['fields'](_0x38c29a[_0xfac5('0x2c')]['fields']));_0x212a76[_0xfac5('0x30')]=_0x212a76[_0xfac5('0x30')][_0xfac5('0x3f')]?_0x212a76['attributes']:_0x397c11[_0xfac5('0x2b')];if(!_0x38c29a[_0xfac5('0x2c')][_0xfac5('0x31')](_0xfac5('0x47'))){_0x212a76[_0xfac5('0x32')]=qs[_0xfac5('0x32')](_0x38c29a[_0xfac5('0x2c')][_0xfac5('0x32')]);_0x212a76[_0xfac5('0x1b')]=qs[_0xfac5('0x1b')](_0x38c29a['query']['offset']);}_0x212a76[_0xfac5('0x48')]=qs[_0xfac5('0x33')](_0x38c29a[_0xfac5('0x2c')]['sort']);_0x212a76[_0xfac5('0x34')]=qs['filters'](_[_0xfac5('0x35')](_0x38c29a[_0xfac5('0x2c')],_0x397c11[_0xfac5('0x2e')]));_0x212a76['where'][_0xfac5('0x49')]=_0x4ccc7a['id'];if(_0x38c29a[_0xfac5('0x2c')][_0xfac5('0x36')]){_0x212a76['where']=_[_0xfac5('0x38')](_0x212a76[_0xfac5('0x34')],{'$or':_['map'](_0x212a76[_0xfac5('0x30')],function(_0x3bbe4c){var _0x1a468b={};_0x1a468b[_0x3bbe4c]={'$like':'%'+_0x38c29a[_0xfac5('0x2c')][_0xfac5('0x36')]+'%'};return _0x1a468b;})});}_0x212a76=_[_0xfac5('0x38')]({},_0x212a76,_0x38c29a[_0xfac5('0x39')]);return db['JscriptyQuestionReport'][_0xfac5('0x4a')]({'where':_0x212a76[_0xfac5('0x34')]})[_0xfac5('0x1f')](function(_0x36b23e){_0xd275b0['count']=_0x36b23e;if(_0x38c29a[_0xfac5('0x2c')]['includeAll']){_0x212a76[_0xfac5('0x3b')]=[{'all':!![]}];}return db[_0xfac5('0x46')][_0xfac5('0x4b')](_0x212a76);})[_0xfac5('0x1f')](function(_0x1d8035){_0xd275b0['rows']=_0x1d8035;return _0xd275b0;});}})[_0xfac5('0x1f')](respondWithFilteredResult(_0x592c0b,_0x212a76))['catch'](handleError(_0x592c0b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 88cbbe9..35eb372 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 _0xd9fb=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x4640ce,_0xaa7776){var _0x233ed4=function(_0x1c9df1){while(--_0x1c9df1){_0x4640ce['push'](_0x4640ce['shift']());}};_0x233ed4(++_0xaa7776);}(_0xd9fb,0x189));var _0xbd9f=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xd9fb[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var logger=require(_0xbd9f('0x2'))(_0xbd9f('0x3'));var moment=require(_0xbd9f('0x4'));var BPromise=require(_0xbd9f('0x5'));var rp=require(_0xbd9f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd9f('0x7'));var config=require(_0xbd9f('0x8'));var attributes=require('./jscriptySessionReport.attributes');module[_0xbd9f('0x9')]=function(_0x5b6052,_0x2e7eea){return _0x5b6052[_0xbd9f('0xa')]('JscriptySessionReport',attributes,{'tableName':_0xbd9f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2e=['./jscriptySessionReport.attributes','report_jscripty_sessions','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1d77dd,_0x3e3c63){var _0x34e055=function(_0x5e43c4){while(--_0x5e43c4){_0x1d77dd['push'](_0x1d77dd['shift']());}};_0x34e055(++_0x3e3c63);}(_0xfd2e,0x6e));var _0xefd2=function(_0xa65f54,_0x3608fc){_0xa65f54=_0xa65f54-0x0;var _0x5c5df5=_0xfd2e[_0xa65f54];return _0x5c5df5;};'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']('JscriptySessionReport',attributes,{'tableName':_0xefd2('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 0f0cdc8..1ad9f7c 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 _0xc35b=['error','message','result','util','moment','randomstring','../../config/logger','rpc','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4612df,_0x37a8f7){var _0x2804c6=function(_0x2b1979){while(--_0x2b1979){_0x4612df['push'](_0x4612df['shift']());}};_0x2804c6(++_0x37a8f7);}(_0xc35b,0xa3));var _0xbc35=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xc35b[_0x288f5e];return _0x476cc9;};'use strict';var _=require('lodash');var util=require(_0xbc35('0x0'));var moment=require(_0xbc35('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc35('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc35('0x3'))(_0xbc35('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc35('0x5')][_0xbc35('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2db8fd,_0x75ef4d,_0x2ae7b0){return new BPromise(function(_0x51b00b,_0x478893){return client['request'](_0x2db8fd,_0x2ae7b0)[_0xbc35('0x7')](function(_0x590a33){logger[_0xbc35('0x8')](_0xbc35('0x9'),_0x75ef4d,_0xbc35('0xa'));logger['debug'](_0xbc35('0xb'),_0x75ef4d,_0xbc35('0xa'),JSON[_0xbc35('0xc')](_0x590a33));if(_0x590a33[_0xbc35('0xd')]){if(_0x590a33[_0xbc35('0xd')]['code']===0x1f4){logger[_0xbc35('0xd')](_0xbc35('0x9'),_0x75ef4d,_0x590a33[_0xbc35('0xd')]['message']);return _0x478893(_0x590a33['error'][_0xbc35('0xe')]);}logger['error'](_0xbc35('0x9'),_0x75ef4d,_0x590a33[_0xbc35('0xd')]['message']);return _0x51b00b(_0x590a33[_0xbc35('0xd')][_0xbc35('0xe')]);}else{logger[_0xbc35('0x8')](_0xbc35('0x9'),_0x75ef4d,'request\x20sent');_0x51b00b(_0x590a33[_0xbc35('0xf')][_0xbc35('0xe')]);}})['catch'](function(_0x3166f1){logger['error'](_0xbc35('0x9'),_0x75ef4d,_0x3166f1);_0x478893(_0x3166f1);});});} \ No newline at end of file +var _0xaaff=['error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b6f5d,_0xa29a1f){var _0x22d63a=function(_0x2cceb9){while(--_0x2cceb9){_0x5b6f5d['push'](_0x5b6f5d['shift']());}};_0x22d63a(++_0xa29a1f);}(_0xaaff,0xad));var _0xfaaf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaaff[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xfaaf('0x0'));var moment=require(_0xfaaf('0x1'));var BPromise=require(_0xfaaf('0x2'));var rs=require(_0xfaaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfaaf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfaaf('0x5'));var config=require(_0xfaaf('0x6'));var jayson=require(_0xfaaf('0x7'));var client=jayson[_0xfaaf('0x8')][_0xfaaf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x392c8c,_0x20bff4,_0x1fc27a){return new BPromise(function(_0x34e625,_0x357c64){return client[_0xfaaf('0xa')](_0x392c8c,_0x1fc27a)[_0xfaaf('0xb')](function(_0x3df5d5){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x20bff4,_0xfaaf('0xc'));logger[_0xfaaf('0xd')](_0xfaaf('0xe'),_0x20bff4,_0xfaaf('0xc'),JSON[_0xfaaf('0xf')](_0x3df5d5));if(_0x3df5d5[_0xfaaf('0x10')]){if(_0x3df5d5[_0xfaaf('0x10')]['code']===0x1f4){logger['error'](_0xfaaf('0x11'),_0x20bff4,_0x3df5d5[_0xfaaf('0x10')][_0xfaaf('0x12')]);return _0x357c64(_0x3df5d5[_0xfaaf('0x10')]['message']);}logger[_0xfaaf('0x10')](_0xfaaf('0x11'),_0x20bff4,_0x3df5d5[_0xfaaf('0x10')][_0xfaaf('0x12')]);return _0x34e625(_0x3df5d5[_0xfaaf('0x10')][_0xfaaf('0x12')]);}else{logger['info'](_0xfaaf('0x11'),_0x20bff4,_0xfaaf('0xc'));_0x34e625(_0x3df5d5[_0xfaaf('0x13')][_0xfaaf('0x12')]);}})[_0xfaaf('0x14')](function(_0x5566ea){logger[_0xfaaf('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x20bff4,_0x5566ea);_0x357c64(_0x5566ea);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b528132..1caff40 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 _0x3bcc=['../../config/environment','./license.controller','get','index','put','isAuthenticated','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2f6dfe,_0x115dab){var _0x5e5c9c=function(_0x502840){while(--_0x502840){_0x2f6dfe['push'](_0x2f6dfe['shift']());}};_0x5e5c9c(++_0x115dab);}(_0x3bcc,0x12e));var _0xc3bc=function(_0x5c7648,_0x49d062){_0x5c7648=_0x5c7648-0x0;var _0x5acad4=_0x3bcc[_0x5c7648];return _0x5acad4;};'use strict';var multer=require('multer');var util=require(_0xc3bc('0x0'));var path=require(_0xc3bc('0x1'));var timeout=require(_0xc3bc('0x2'));var express=require(_0xc3bc('0x3'));var router=express[_0xc3bc('0x4')]();var auth=require(_0xc3bc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc3bc('0x6'));var controller=require(_0xc3bc('0x7'));router[_0xc3bc('0x8')]('/',controller[_0xc3bc('0x9')]);router[_0xc3bc('0xa')]('/:id',auth[_0xc3bc('0xb')](),controller[_0xc3bc('0xc')]);module[_0xc3bc('0xd')]=router; \ No newline at end of file +var _0x96ba=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','exports','multer','util','path'];(function(_0x4ef0bd,_0x3726c1){var _0x1bb631=function(_0x16f61d){while(--_0x16f61d){_0x4ef0bd['push'](_0x4ef0bd['shift']());}};_0x1bb631(++_0x3726c1);}(_0x96ba,0x195));var _0xa96b=function(_0x5dc2fa,_0x56279d){_0x5dc2fa=_0x5dc2fa-0x0;var _0x16eaf9=_0x96ba[_0x5dc2fa];return _0x16eaf9;};'use strict';var multer=require(_0xa96b('0x0'));var util=require(_0xa96b('0x1'));var path=require(_0xa96b('0x2'));var timeout=require(_0xa96b('0x3'));var express=require(_0xa96b('0x4'));var router=express[_0xa96b('0x5')]();var auth=require(_0xa96b('0x6'));var interaction=require(_0xa96b('0x7'));var config=require(_0xa96b('0x8'));var controller=require(_0xa96b('0x9'));router[_0xa96b('0xa')]('/',controller[_0xa96b('0xb')]);router[_0xa96b('0xc')](_0xa96b('0xd'),auth[_0xa96b('0xe')](),controller[_0xa96b('0xf')]);module[_0xa96b('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 8f37c51..c22188f 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 _0xe14b=['exports','STRING','INTEGER','sequelize'];(function(_0x25f8d7,_0x4114f0){var _0x1e65ca=function(_0x210cc3){while(--_0x210cc3){_0x25f8d7['push'](_0x25f8d7['shift']());}};_0x1e65ca(++_0x4114f0);}(_0xe14b,0x93));var _0xbe14=function(_0x21e857,_0x180835){_0x21e857=_0x21e857-0x0;var _0x251ea9=_0xe14b[_0x21e857];return _0x251ea9;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xbe14('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x524e=['STRING','INTEGER','TEXT'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0x524e,0x15e));var _0xe524=function(_0x30a47c,_0x3e02eb){_0x30a47c=_0x30a47c-0x0;var _0x37b002=_0x524e[_0x30a47c];return _0x37b002;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0xe524('0x0')]},'data1':{'type':Sequelize[_0xe524('0x1')]},'data2':{'type':Sequelize[_0xe524('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xe524('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 5f8474f..ae6fb79 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 _0xc6be=['update','body','find','params','get','checkLicense','key','demo','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','reject','save','destroy','then','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','getLicense','catch'];(function(_0x3d0586,_0xfa8f33){var _0x6a060e=function(_0x5541cf){while(--_0x5541cf){_0x3d0586['push'](_0x3d0586['shift']());}};_0x6a060e(++_0xfa8f33);}(_0xc6be,0x143));var _0xec6b=function(_0x48a997,_0x21f56f){_0x48a997=_0x48a997-0x0;var _0x405e25=_0xc6be[_0x48a997];return _0x405e25;};'use strict';var pdf=require(_0xec6b('0x0'));var emlformat=require(_0xec6b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xec6b('0x2'));var jsonpatch=require(_0xec6b('0x3'));var rp=require(_0xec6b('0x4'));var moment=require(_0xec6b('0x5'));var BPromise=require(_0xec6b('0x6'));var Mustache=require('mustache');var util=require(_0xec6b('0x7'));var path=require(_0xec6b('0x8'));var sox=require(_0xec6b('0x9'));var csv=require(_0xec6b('0xa'));var ejs=require(_0xec6b('0xb'));var fs=require('fs');var _=require(_0xec6b('0xc'));var squel=require(_0xec6b('0xd'));var crypto=require(_0xec6b('0xe'));var jsforce=require(_0xec6b('0xf'));var deskjs=require(_0xec6b('0x10'));var toCsv=require(_0xec6b('0xa'));var querystring=require(_0xec6b('0x11'));var Papa=require(_0xec6b('0x12'));var Redis=require(_0xec6b('0x13'));var authService=require(_0xec6b('0x14'));var qs=require(_0xec6b('0x15'));var as=require(_0xec6b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec6b('0x17'))(_0xec6b('0x18'));var utils=require(_0xec6b('0x19'));var config=require(_0xec6b('0x1a'));var db=require(_0xec6b('0x1b'))['db'];function respondWithStatusCode(_0xc28ae3,_0x1a53d5){_0x1a53d5=_0x1a53d5||0xcc;return function(_0x176120){if(_0x176120){return _0xc28ae3[_0xec6b('0x1c')](_0x1a53d5);}return _0xc28ae3[_0xec6b('0x1d')](_0x1a53d5)[_0xec6b('0x1e')]();};}function respondWithResult(_0x1c1b4d,_0xe19a77){_0xe19a77=_0xe19a77||0xc8;return function(_0xf50bb1){if(_0xf50bb1){return _0x1c1b4d[_0xec6b('0x1d')](_0xe19a77)['json'](_0xf50bb1);}};}function respondWithFilteredResult(_0x489623,_0x3b8772){return function(_0x19db7b){if(_0x19db7b){var _0x2bdfc7=_0x19db7b['count'],_0x2e9088=_0x3b8772[_0xec6b('0x1f')],_0x20c155=_0x3b8772['offset']+_0x3b8772['limit'],_0x4671bf;if(_0x20c155>=_0x2bdfc7){_0x20c155=_0x2bdfc7;_0x4671bf=0xc8;}else{_0x4671bf=0xce;}_0x489623[_0xec6b('0x1d')](_0x4671bf);return _0x489623[_0xec6b('0x20')](_0xec6b('0x21'),_0x2e9088+'-'+_0x20c155+'/'+_0x2bdfc7)['json'](_0x19db7b);}return null;};}function patchUpdates(_0x56d3bd){return function(_0x5d2eb8){try{jsonpatch['apply'](_0x5d2eb8,_0x56d3bd,!![]);}catch(_0x5714f8){return BPromise[_0xec6b('0x22')](_0x5714f8);}return _0x5d2eb8[_0xec6b('0x23')]();};}function saveUpdates(_0x39467f,_0x3eadc6){return function(_0x1f63bb){if(_0x1f63bb){return _0x1f63bb['update'](_0x39467f)['then'](function(_0x57d386){return _0x57d386;});}return null;};}function removeEntity(_0x1b9677,_0x4773e8){return function(_0x1a1484){if(_0x1a1484){return _0x1a1484[_0xec6b('0x24')]()[_0xec6b('0x25')](function(){_0x1b9677['status'](0xcc)[_0xec6b('0x1e')]();});}};}function handleEntityNotFound(_0x1dff19,_0x5d697d){return function(_0x28329e){if(!_0x28329e){_0x1dff19[_0xec6b('0x1c')](0x194);}return _0x28329e;};}function handleError(_0x57741a,_0x367f65){_0x367f65=_0x367f65||0x1f4;return function(_0x4fc216){logger['error'](_0x4fc216[_0xec6b('0x26')]);if(_0x4fc216[_0xec6b('0x27')]){delete _0x4fc216[_0xec6b('0x27')];}_0x57741a[_0xec6b('0x1d')](_0x367f65)[_0xec6b('0x28')](_0x4fc216);};}var utilLicense=require(_0xec6b('0x29'));exports[_0xec6b('0x2a')]=function(_0x277bb5,_0x228bdb){var _0x585a7f={'raw':!![],'where':{'id':0x1}},_0x357e30={};_0x357e30[_0xec6b('0x2b')]=_[_0xec6b('0x2c')](db[_0xec6b('0x2d')][_0xec6b('0x2e')]);_0x357e30['query']=_[_0xec6b('0x2c')](_0x277bb5[_0xec6b('0x2f')]);_0x357e30[_0xec6b('0x30')]=_[_0xec6b('0x31')](_0x357e30[_0xec6b('0x2b')],_0x357e30['query']);_0x585a7f[_0xec6b('0x32')]=_['intersection'](_0x357e30[_0xec6b('0x2b')],qs[_0xec6b('0x33')](_0x277bb5['query'][_0xec6b('0x33')]));_0x585a7f[_0xec6b('0x32')]=_0x585a7f['attributes'][_0xec6b('0x34')]?_0x585a7f['attributes']:_0x357e30['model'];_0x585a7f=_['merge']({},_0x585a7f,_0x277bb5['options']);return utilLicense[_0xec6b('0x35')](_0x585a7f)['then'](respondWithResult(_0x228bdb,null))[_0xec6b('0x36')](handleError(_0x228bdb,null));};exports[_0xec6b('0x37')]=function(_0x271325,_0x43bd5a){if(_0x271325[_0xec6b('0x38')]['id']){delete _0x271325['body']['id'];}return db[_0xec6b('0x2d')][_0xec6b('0x39')]({'where':{'id':_0x271325[_0xec6b('0x3a')]['id']}})[_0xec6b('0x25')](handleEntityNotFound(_0x43bd5a,null))['then'](function(_0x41130d){var _0x29bbbd=_0x41130d[_0xec6b('0x3b')]({'plain':!![]});return utilLicense[_0xec6b('0x3c')](_0x29bbbd,_0x271325['body'][_0xec6b('0x3d')]);})[_0xec6b('0x25')](function(_0xb46756){if(!_0xb46756[_0xec6b('0x3e')]){return saveUpdates(_0x271325[_0xec6b('0x38')],null);}return _0xb46756;})[_0xec6b('0x25')](respondWithResult(_0x43bd5a,null))[_0xec6b('0x36')](handleError(_0x43bd5a,null));}; \ No newline at end of file +var _0xa83a=['../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','update','then','error','name','send','../../config/license/util','model','License','rawAttributes','keys','query','intersection','attributes','fields','length','merge','getLicense','catch','body','find','params','checkLicense','key','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1a2903,_0x4fefdf){var _0x395057=function(_0x2409a6){while(--_0x2409a6){_0x1a2903['push'](_0x1a2903['shift']());}};_0x395057(++_0x4fefdf);}(_0xa83a,0x1d8));var _0xaa83=function(_0x2928f9,_0x8799c6){_0x2928f9=_0x2928f9-0x0;var _0x467765=_0xa83a[_0x2928f9];return _0x467765;};'use strict';var pdf=require(_0xaa83('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaa83('0x1'));var zipdir=require(_0xaa83('0x2'));var jsonpatch=require(_0xaa83('0x3'));var rp=require(_0xaa83('0x4'));var moment=require(_0xaa83('0x5'));var BPromise=require(_0xaa83('0x6'));var Mustache=require(_0xaa83('0x7'));var util=require(_0xaa83('0x8'));var path=require(_0xaa83('0x9'));var sox=require(_0xaa83('0xa'));var csv=require(_0xaa83('0xb'));var ejs=require(_0xaa83('0xc'));var fs=require('fs');var _=require(_0xaa83('0xd'));var squel=require(_0xaa83('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa83('0xf'));var toCsv=require(_0xaa83('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaa83('0x10'));var authService=require(_0xaa83('0x11'));var qs=require(_0xaa83('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa83('0x13'))(_0xaa83('0x14'));var utils=require(_0xaa83('0x15'));var config=require(_0xaa83('0x16'));var db=require(_0xaa83('0x17'))['db'];function respondWithStatusCode(_0x2f5972,_0x3c3096){_0x3c3096=_0x3c3096||0xcc;return function(_0x536966){if(_0x536966){return _0x2f5972[_0xaa83('0x18')](_0x3c3096);}return _0x2f5972[_0xaa83('0x19')](_0x3c3096)['end']();};}function respondWithResult(_0x28b569,_0x4caa31){_0x4caa31=_0x4caa31||0xc8;return function(_0x35b916){if(_0x35b916){return _0x28b569[_0xaa83('0x19')](_0x4caa31)[_0xaa83('0x1a')](_0x35b916);}};}function respondWithFilteredResult(_0x2a1d4e,_0x5c9cb9){return function(_0x467e27){if(_0x467e27){var _0x210811=_0x467e27['count'],_0x5bfc2b=_0x5c9cb9[_0xaa83('0x1b')],_0x385cfa=_0x5c9cb9[_0xaa83('0x1b')]+_0x5c9cb9[_0xaa83('0x1c')],_0x3972bb;if(_0x385cfa>=_0x210811){_0x385cfa=_0x210811;_0x3972bb=0xc8;}else{_0x3972bb=0xce;}_0x2a1d4e[_0xaa83('0x19')](_0x3972bb);return _0x2a1d4e['set'](_0xaa83('0x1d'),_0x5bfc2b+'-'+_0x385cfa+'/'+_0x210811)[_0xaa83('0x1a')](_0x467e27);}return null;};}function patchUpdates(_0x30be94){return function(_0x38db52){try{jsonpatch[_0xaa83('0x1e')](_0x38db52,_0x30be94,!![]);}catch(_0x570006){return BPromise[_0xaa83('0x1f')](_0x570006);}return _0x38db52['save']();};}function saveUpdates(_0x5e38a6,_0x2fc381){return function(_0x61eb19){if(_0x61eb19){return _0x61eb19[_0xaa83('0x20')](_0x5e38a6)['then'](function(_0x3596a8){return _0x3596a8;});}return null;};}function removeEntity(_0xe4c768,_0x45acf0){return function(_0x2d8fc1){if(_0x2d8fc1){return _0x2d8fc1['destroy']()[_0xaa83('0x21')](function(){_0xe4c768[_0xaa83('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d4acf,_0x2e9ef9){return function(_0x3ceab5){if(!_0x3ceab5){_0x4d4acf[_0xaa83('0x18')](0x194);}return _0x3ceab5;};}function handleError(_0x2dd4d9,_0x164ab0){_0x164ab0=_0x164ab0||0x1f4;return function(_0x327f1c){logger[_0xaa83('0x22')](_0x327f1c['stack']);if(_0x327f1c['name']){delete _0x327f1c[_0xaa83('0x23')];}_0x2dd4d9[_0xaa83('0x19')](_0x164ab0)[_0xaa83('0x24')](_0x327f1c);};}var utilLicense=require(_0xaa83('0x25'));exports['index']=function(_0x246101,_0xe78070){var _0x21b464={'raw':!![],'where':{'id':0x1}},_0x468048={};_0x468048[_0xaa83('0x26')]=_['keys'](db[_0xaa83('0x27')][_0xaa83('0x28')]);_0x468048['query']=_[_0xaa83('0x29')](_0x246101[_0xaa83('0x2a')]);_0x468048['filters']=_[_0xaa83('0x2b')](_0x468048[_0xaa83('0x26')],_0x468048['query']);_0x21b464[_0xaa83('0x2c')]=_[_0xaa83('0x2b')](_0x468048[_0xaa83('0x26')],qs[_0xaa83('0x2d')](_0x246101[_0xaa83('0x2a')][_0xaa83('0x2d')]));_0x21b464[_0xaa83('0x2c')]=_0x21b464['attributes'][_0xaa83('0x2e')]?_0x21b464['attributes']:_0x468048[_0xaa83('0x26')];_0x21b464=_[_0xaa83('0x2f')]({},_0x21b464,_0x246101['options']);return utilLicense[_0xaa83('0x30')](_0x21b464)[_0xaa83('0x21')](respondWithResult(_0xe78070,null))[_0xaa83('0x31')](handleError(_0xe78070,null));};exports['update']=function(_0x1b2160,_0x17f955){if(_0x1b2160[_0xaa83('0x32')]['id']){delete _0x1b2160['body']['id'];}return db[_0xaa83('0x27')][_0xaa83('0x33')]({'where':{'id':_0x1b2160[_0xaa83('0x34')]['id']}})[_0xaa83('0x21')](handleEntityNotFound(_0x17f955,null))[_0xaa83('0x21')](function(_0x457cbe){var _0x5d4ee8=_0x457cbe['get']({'plain':!![]});return utilLicense[_0xaa83('0x35')](_0x5d4ee8,_0x1b2160['body'][_0xaa83('0x36')]);})[_0xaa83('0x21')](function(_0x182f05){if(!_0x182f05['demo']){return saveUpdates(_0x1b2160[_0xaa83('0x32')],null);}return _0x182f05;})[_0xaa83('0x21')](respondWithResult(_0x17f955,null))[_0xaa83('0x31')](handleError(_0x17f955,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f7e86e0..08f646f 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x1e1b18,_0x5d471b){var _0x3da8f2=function(_0x51fe71){while(--_0x51fe71){_0x1e1b18['push'](_0x1e1b18['shift']());}};_0x3da8f2(++_0x5d471b);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e375,_0xdc0dde){_0x20e375=_0x20e375-0x0;var _0x55ac5d=_0xb10b[_0x20e375];return _0x55ac5d;};'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')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./license.attributes','exports','define','License','lodash','util','../../config/logger','api','moment'];(function(_0x2c1101,_0x3ce298){var _0x2498f4=function(_0x3024e7){while(--_0x3024e7){_0x2c1101['push'](_0x2c1101['shift']());}};_0x2498f4(++_0x3ce298);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11bcbd,_0x4d39b3){_0x11bcbd=_0x11bcbd-0x0;var _0x58aa24=_0x5f2f[_0x11bcbd];return _0x58aa24;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index a21480a..c909b5a 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 _0xfb5d=['request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','jayson/promise'];(function(_0x2cc056,_0x12b8e9){var _0x50baad=function(_0x4911f5){while(--_0x4911f5){_0x2cc056['push'](_0x2cc056['shift']());}};_0x50baad(++_0x12b8e9);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfb5d[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xdfb5('0x0'));var util=require(_0xdfb5('0x1'));var moment=require(_0xdfb5('0x2'));var BPromise=require(_0xdfb5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfb5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdfb5('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d6086,_0x1955dd,_0x164eb2){return new BPromise(function(_0x5c410c,_0x4d2dce){return client[_0xdfb5('0x6')](_0x2d6086,_0x164eb2)[_0xdfb5('0x7')](function(_0x2589d8){logger[_0xdfb5('0x8')](_0xdfb5('0x9'),_0x1955dd,_0xdfb5('0xa'));logger[_0xdfb5('0xb')](_0xdfb5('0xc'),_0x1955dd,'request\x20sent',JSON['stringify'](_0x2589d8));if(_0x2589d8[_0xdfb5('0xd')]){if(_0x2589d8[_0xdfb5('0xd')][_0xdfb5('0xe')]===0x1f4){logger[_0xdfb5('0xd')](_0xdfb5('0x9'),_0x1955dd,_0x2589d8['error'][_0xdfb5('0xf')]);return _0x4d2dce(_0x2589d8[_0xdfb5('0xd')]['message']);}logger[_0xdfb5('0xd')](_0xdfb5('0x9'),_0x1955dd,_0x2589d8[_0xdfb5('0xd')][_0xdfb5('0xf')]);return _0x5c410c(_0x2589d8[_0xdfb5('0xd')]['message']);}else{logger['info'](_0xdfb5('0x9'),_0x1955dd,'request\x20sent');_0x5c410c(_0x2589d8[_0xdfb5('0x10')][_0xdfb5('0xf')]);}})[_0xdfb5('0x11')](function(_0x637cba){logger[_0xdfb5('0xd')](_0xdfb5('0x9'),_0x1955dd,_0x637cba);_0x4d2dce(_0x637cba);});});} \ No newline at end of file +var _0xd84c=['debug','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xd84c,0x102));var _0xcd84=function(_0x997acb,_0x52a3a5){_0x997acb=_0x997acb-0x0;var _0x486c7c=_0xd84c[_0x997acb];return _0x486c7c;};'use strict';var _=require(_0xcd84('0x0'));var util=require(_0xcd84('0x1'));var moment=require(_0xcd84('0x2'));var BPromise=require(_0xcd84('0x3'));var rs=require(_0xcd84('0x4'));var fs=require('fs');var Redis=require(_0xcd84('0x5'));var db=require(_0xcd84('0x6'))['db'];var utils=require(_0xcd84('0x7'));var logger=require(_0xcd84('0x8'))('rpc');var config=require(_0xcd84('0x9'));var jayson=require(_0xcd84('0xa'));var client=jayson[_0xcd84('0xb')][_0xcd84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x520d49,_0x2b5383,_0x22c811){return new BPromise(function(_0x3f3617,_0x5408e2){return client[_0xcd84('0xd')](_0x520d49,_0x22c811)[_0xcd84('0xe')](function(_0xec34a2){logger[_0xcd84('0xf')]('License,\x20%s,\x20%s',_0x2b5383,_0xcd84('0x10'));logger[_0xcd84('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x2b5383,_0xcd84('0x10'),JSON[_0xcd84('0x12')](_0xec34a2));if(_0xec34a2[_0xcd84('0x13')]){if(_0xec34a2['error'][_0xcd84('0x14')]===0x1f4){logger[_0xcd84('0x13')](_0xcd84('0x15'),_0x2b5383,_0xec34a2[_0xcd84('0x13')]['message']);return _0x5408e2(_0xec34a2[_0xcd84('0x13')][_0xcd84('0x16')]);}logger[_0xcd84('0x13')](_0xcd84('0x15'),_0x2b5383,_0xec34a2[_0xcd84('0x13')][_0xcd84('0x16')]);return _0x3f3617(_0xec34a2[_0xcd84('0x13')][_0xcd84('0x16')]);}else{logger[_0xcd84('0xf')](_0xcd84('0x15'),_0x2b5383,_0xcd84('0x10'));_0x3f3617(_0xec34a2[_0xcd84('0x17')][_0xcd84('0x16')]);}})[_0xcd84('0x18')](function(_0xfc4ec7){logger[_0xcd84('0x13')](_0xcd84('0x15'),_0x2b5383,_0xfc4ec7);_0x5408e2(_0xfc4ec7);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 7ee15d2..143ddc1 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 _0x226c=['addInteraction','addApplications','/:id/send','send','addAgents','put','/:id','delete','removeAnswers','removeSmtp','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp'];(function(_0x5a4c93,_0x283aa8){var _0x421ff4=function(_0x1afb30){while(--_0x1afb30){_0x5a4c93['push'](_0x5a4c93['shift']());}};_0x421ff4(++_0x283aa8);}(_0x226c,0x14e));var _0xc226=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x226c[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xc226('0x0'));var util=require(_0xc226('0x1'));var path=require(_0xc226('0x2'));var timeout=require('connect-timeout');var express=require(_0xc226('0x3'));var router=express[_0xc226('0x4')]();var auth=require(_0xc226('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc226('0x6'));var controller=require(_0xc226('0x7'));router[_0xc226('0x8')]('/',auth[_0xc226('0x9')](),controller[_0xc226('0xa')]);router['get'](_0xc226('0xb'),auth[_0xc226('0x9')](),controller[_0xc226('0xc')]);router[_0xc226('0x8')]('/:id',auth[_0xc226('0x9')](),controller['show']);router[_0xc226('0x8')](_0xc226('0xd'),auth[_0xc226('0x9')](),controller[_0xc226('0xe')]);router[_0xc226('0x8')](_0xc226('0xf'),auth[_0xc226('0x9')](),controller[_0xc226('0x10')]);router['get'](_0xc226('0x11'),auth[_0xc226('0x9')](),controller['getImap']);router[_0xc226('0x8')](_0xc226('0x12'),auth[_0xc226('0x9')](),controller[_0xc226('0x13')]);router[_0xc226('0x8')](_0xc226('0x14'),auth[_0xc226('0x9')](),controller[_0xc226('0x15')]);router[_0xc226('0x8')](_0xc226('0x16'),auth['isAuthenticated'](),controller[_0xc226('0x17')]);router[_0xc226('0x8')]('/:id/messages',auth[_0xc226('0x9')](),controller[_0xc226('0x18')]);router[_0xc226('0x8')](_0xc226('0x19'),auth[_0xc226('0x9')](),controller['verifySmtp']);router[_0xc226('0x8')](_0xc226('0x1a'),auth[_0xc226('0x9')](),controller[_0xc226('0x1b')]);router[_0xc226('0x1c')](_0xc226('0xd'),auth['isAuthenticated'](),controller[_0xc226('0x1d')]);router[_0xc226('0x1c')](_0xc226('0xf'),auth[_0xc226('0x9')](),controller[_0xc226('0x1e')]);router[_0xc226('0x1c')]('/',auth['isAuthenticated'](),controller[_0xc226('0x1f')]);router[_0xc226('0x1c')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xc226('0x20')]);router[_0xc226('0x1c')](_0xc226('0x12'),auth['isAuthenticated'](),controller[_0xc226('0x21')]);router[_0xc226('0x1c')](_0xc226('0x14'),auth[_0xc226('0x9')](),controller[_0xc226('0x22')]);router['post']('/:id/applications',auth[_0xc226('0x9')](),controller[_0xc226('0x23')]);router[_0xc226('0x1c')](_0xc226('0x24'),auth['isAuthenticated'](),controller[_0xc226('0x25')]);router[_0xc226('0x1c')](_0xc226('0x1a'),auth[_0xc226('0x9')](),controller[_0xc226('0x26')]);router[_0xc226('0x27')](_0xc226('0x28'),auth[_0xc226('0x9')](),controller['update']);router['delete'](_0xc226('0xd'),auth[_0xc226('0x9')](),controller['removeDispositions']);router[_0xc226('0x29')](_0xc226('0xf'),auth[_0xc226('0x9')](),controller[_0xc226('0x2a')]);router[_0xc226('0x29')](_0xc226('0x11'),auth[_0xc226('0x9')](),controller['removeImap']);router['delete'](_0xc226('0x12'),auth[_0xc226('0x9')](),controller[_0xc226('0x2b')]);router[_0xc226('0x29')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xc226('0x1a'),auth[_0xc226('0x9')](),controller[_0xc226('0x2c')]);module[_0xc226('0x2d')]=router; \ No newline at end of file +var _0x405c=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','send','addAgents','update','delete','removeDispositions','removeImap','destroy','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated'];(function(_0x50f613,_0x5b08e9){var _0x1ebf37=function(_0x5c303e){while(--_0x5c303e){_0x50f613['push'](_0x50f613['shift']());}};_0x1ebf37(++_0x5b08e9);}(_0x405c,0x1ca));var _0xc405=function(_0x20e093,_0x391661){_0x20e093=_0x20e093-0x0;var _0x341a40=_0x405c[_0x20e093];return _0x341a40;};'use strict';var multer=require(_0xc405('0x0'));var util=require(_0xc405('0x1'));var path=require(_0xc405('0x2'));var timeout=require(_0xc405('0x3'));var express=require(_0xc405('0x4'));var router=express['Router']();var auth=require(_0xc405('0x5'));var interaction=require(_0xc405('0x6'));var config=require(_0xc405('0x7'));var controller=require(_0xc405('0x8'));router[_0xc405('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc405('0x9')](_0xc405('0xa'),auth[_0xc405('0xb')](),controller['describe']);router[_0xc405('0x9')](_0xc405('0xc'),auth[_0xc405('0xb')](),controller[_0xc405('0xd')]);router['get'](_0xc405('0xe'),auth[_0xc405('0xb')](),controller[_0xc405('0xf')]);router[_0xc405('0x9')](_0xc405('0x10'),auth[_0xc405('0xb')](),controller[_0xc405('0x11')]);router[_0xc405('0x9')](_0xc405('0x12'),auth['isAuthenticated'](),controller[_0xc405('0x13')]);router[_0xc405('0x9')](_0xc405('0x14'),auth['isAuthenticated'](),controller[_0xc405('0x15')]);router[_0xc405('0x9')](_0xc405('0x16'),auth[_0xc405('0xb')](),controller[_0xc405('0x17')]);router[_0xc405('0x9')](_0xc405('0x18'),auth['isAuthenticated'](),controller[_0xc405('0x19')]);router[_0xc405('0x9')](_0xc405('0x1a'),auth['isAuthenticated'](),controller[_0xc405('0x1b')]);router[_0xc405('0x9')](_0xc405('0x1c'),auth[_0xc405('0xb')](),controller[_0xc405('0x1d')]);router[_0xc405('0x9')](_0xc405('0x1e'),auth[_0xc405('0xb')](),controller[_0xc405('0x1f')]);router[_0xc405('0x20')]('/:id/dispositions',auth[_0xc405('0xb')](),controller[_0xc405('0x21')]);router[_0xc405('0x20')](_0xc405('0x10'),auth['isAuthenticated'](),controller[_0xc405('0x22')]);router['post']('/',auth[_0xc405('0xb')](),controller[_0xc405('0x23')]);router[_0xc405('0x20')]('/:id/in_servers',auth[_0xc405('0xb')](),controller[_0xc405('0x24')]);router[_0xc405('0x20')](_0xc405('0x14'),auth['isAuthenticated'](),controller[_0xc405('0x25')]);router['post'](_0xc405('0x16'),auth[_0xc405('0xb')](),controller[_0xc405('0x26')]);router[_0xc405('0x20')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xc405('0x20')]('/:id/send',auth[_0xc405('0xb')](),controller[_0xc405('0x27')]);router[_0xc405('0x20')](_0xc405('0x1e'),auth[_0xc405('0xb')](),controller[_0xc405('0x28')]);router['put'](_0xc405('0xc'),auth[_0xc405('0xb')](),controller[_0xc405('0x29')]);router[_0xc405('0x2a')](_0xc405('0xe'),auth[_0xc405('0xb')](),controller[_0xc405('0x2b')]);router['delete'](_0xc405('0x10'),auth[_0xc405('0xb')](),controller['removeAnswers']);router[_0xc405('0x2a')](_0xc405('0x12'),auth[_0xc405('0xb')](),controller[_0xc405('0x2c')]);router['delete']('/:id/out_servers',auth[_0xc405('0xb')](),controller['removeSmtp']);router[_0xc405('0x2a')]('/:id',auth[_0xc405('0xb')](),controller[_0xc405('0x2d')]);router['delete'](_0xc405('0x1e'),auth[_0xc405('0xb')](),controller[_0xc405('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 417c053..df57b03 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 _0xa721=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x23f1fa,_0x5390e0){var _0x186716=function(_0x2b13fc){while(--_0x2b13fc){_0x23f1fa['push'](_0x23f1fa['shift']());}};_0x186716(++_0x5390e0);}(_0xa721,0x145));var _0x1a72=function(_0x5edd35,_0x10ebbe){_0x5edd35=_0x5edd35-0x0;var _0x170719=_0xa721[_0x5edd35];return _0x170719;};'use strict';var Sequelize=require(_0x1a72('0x0'));module[_0x1a72('0x1')]={'description':{'type':Sequelize[_0x1a72('0x2')]},'name':{'type':Sequelize[_0x1a72('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1a72('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1a72('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x1a72('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1a72('0x2')],'allowNull':![],'defaultValue':_0x1a72('0x5')},'fontSize':{'type':Sequelize[_0x1a72('0x6')](0x2)[_0x1a72('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1a72('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a72('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a72('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a72('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a72('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a72('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a72('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x1a72('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1a72('0x9'),'set':function(_0x55fca9){if(!_0x55fca9)this[_0x1a72('0xa')](_0x1a72('0xb'),null);this[_0x1a72('0xa')](_0x1a72('0xc'),_0x55fca9);}}}; \ No newline at end of file +var _0x70f4=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x5505ae,_0x54274d){var _0xd0ef0a=function(_0x168312){while(--_0x168312){_0x5505ae['push'](_0x5505ae['shift']());}};_0xd0ef0a(++_0x54274d);}(_0x70f4,0x10d));var _0x470f=function(_0x5cfcef,_0x20d843){_0x5cfcef=_0x5cfcef-0x0;var _0x21df12=_0x70f4[_0x5cfcef];return _0x21df12;};'use strict';var Sequelize=require(_0x470f('0x0'));module[_0x470f('0x1')]={'description':{'type':Sequelize[_0x470f('0x2')]},'name':{'type':Sequelize[_0x470f('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x470f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x470f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x470f('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x470f('0x2')],'allowNull':![],'defaultValue':_0x470f('0x4')},'fontSize':{'type':Sequelize[_0x470f('0x5')](0x2)[_0x470f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x470f('0x7')],'defaultValue':function(){return _0x470f('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x470f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x470f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x470f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x470f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x470f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x470f('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x470f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x470f('0x3')],'defaultValue':![],'comment':_0x470f('0xa'),'set':function(_0x4f7977){if(!_0x4f7977)this[_0x470f('0xb')](_0x470f('0xc'),null);this['setDataValue'](_0x470f('0xd'),_0x4f7977);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c3fda58..3aa27d2 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 _0x9e12=['CannedAnswer','removeAnswers','ids','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','cservice','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','User','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','test','Sequelize','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','count','offset','limit','set','Content-Range','reject','update','get','destroy','end','stack','name','send','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','include','findAll','rows','show','includeAll','merge','options','find','body','params','Smtp','describe','addDisposition','MailAccountId','Disposition','create','findOne','filter','addAnswer'];(function(_0x566cbd,_0x12fecc){var _0x530647=function(_0x28bc1a){while(--_0x28bc1a){_0x566cbd['push'](_0x566cbd['shift']());}};_0x530647(++_0x12fecc);}(_0x9e12,0x11e));var _0x29e1=function(_0x5ed157,_0x1aab72){_0x5ed157=_0x5ed157-0x0;var _0x21aa6d=_0x9e12[_0x5ed157];return _0x21aa6d;};'use strict';var pdf=require(_0x29e1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x29e1('0x1'));var zipdir=require(_0x29e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29e1('0x3'));var moment=require(_0x29e1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29e1('0x5'));var path=require('path');var sox=require(_0x29e1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x29e1('0x7'));var squel=require(_0x29e1('0x8'));var crypto=require(_0x29e1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x29e1('0xa'));var toCsv=require(_0x29e1('0xb'));var querystring=require(_0x29e1('0xc'));var Papa=require('papaparse');var Redis=require(_0x29e1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x29e1('0xe'));var as=require(_0x29e1('0xf'));var hardwareService=require(_0x29e1('0x10'));var logger=require(_0x29e1('0x11'))(_0x29e1('0x12'));var utils=require(_0x29e1('0x13'));var config=require(_0x29e1('0x14'));var db=require('../../mysqldb')['db'];config[_0x29e1('0x15')]=_[_0x29e1('0x16')](config[_0x29e1('0x15')],{'host':_0x29e1('0x17'),'port':0x18eb});var socket=require(_0x29e1('0x18'))(new Redis(config[_0x29e1('0x15')]));require(_0x29e1('0x19'))[_0x29e1('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x29e1('0x1b')][_0x29e1('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x19cc6e,_0x4d6def,_0x4547dd){if(_0x4547dd){var _0xc1fc55=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc1fc55[_0x29e1('0x1d')](_0x4d6def)){return _0x19cc6e;}else{throw new db[(_0x29e1('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 _0x19cc6e;}}function respondWithRpcPromise(_0x30fd74,_0x569c8f,_0x3ac758,_0x12c01f){return new BPromise(function(_0x1c56aa,_0x3b0182){var _0x2ce875=_0x12c01f||client;return _0x2ce875['request'](_0x30fd74,_0x3ac758)[_0x29e1('0x1f')](function(_0x274b6d){logger[_0x29e1('0x20')](_0x29e1('0x21'),_0x569c8f,_0x29e1('0x22'));logger[_0x29e1('0x23')](_0x29e1('0x24'),_0x569c8f,_0x29e1('0x22'),JSON[_0x29e1('0x25')](_0x274b6d));if(_0x274b6d['error']){if(_0x274b6d[_0x29e1('0x26')][_0x29e1('0x27')]===0x1f4){logger[_0x29e1('0x26')](_0x29e1('0x21'),_0x569c8f,_0x274b6d[_0x29e1('0x26')]['message']);return _0x3b0182(_0x274b6d[_0x29e1('0x26')][_0x29e1('0x28')]);}logger[_0x29e1('0x26')](_0x29e1('0x21'),_0x569c8f,_0x274b6d['error']['message']);return _0x1c56aa(_0x274b6d['error'][_0x29e1('0x28')]);}else{logger[_0x29e1('0x20')](_0x29e1('0x21'),_0x569c8f,_0x29e1('0x22'));_0x1c56aa(_0x274b6d['result'][_0x29e1('0x28')]);}})[_0x29e1('0x29')](function(_0x46687c){logger['error'](_0x29e1('0x21'),_0x569c8f,_0x46687c);_0x3b0182(_0x46687c);});});}function respondWithStatusCode(_0x46ffbb,_0x2fa4e0){_0x2fa4e0=_0x2fa4e0||0xcc;return function(_0x5a2199){if(_0x5a2199){return _0x46ffbb[_0x29e1('0x2a')](_0x2fa4e0);}return _0x46ffbb[_0x29e1('0x2b')](_0x2fa4e0)['end']();};}function respondWithResult(_0x3fea33,_0x166a8c){_0x166a8c=_0x166a8c||0xc8;return function(_0x4c8245){if(_0x4c8245){return _0x3fea33['status'](_0x166a8c)['json'](_0x4c8245);}};}function respondWithFilteredResult(_0x1707e1,_0x275f58){return function(_0x40aacc){if(_0x40aacc){var _0x33523b=_0x40aacc[_0x29e1('0x2c')],_0x5d122d=_0x275f58[_0x29e1('0x2d')],_0x1fd438=_0x275f58[_0x29e1('0x2d')]+_0x275f58[_0x29e1('0x2e')],_0x1fd63d;if(_0x1fd438>=_0x33523b){_0x1fd438=_0x33523b;_0x1fd63d=0xc8;}else{_0x1fd63d=0xce;}_0x1707e1[_0x29e1('0x2b')](_0x1fd63d);return _0x1707e1[_0x29e1('0x2f')](_0x29e1('0x30'),_0x5d122d+'-'+_0x1fd438+'/'+_0x33523b)['json'](_0x40aacc);}return null;};}function patchUpdates(_0x57650f){return function(_0x31d686){try{jsonpatch['apply'](_0x31d686,_0x57650f,!![]);}catch(_0x24732a){return BPromise[_0x29e1('0x31')](_0x24732a);}return _0x31d686['save']();};}function saveUpdates(_0x42d2f5,_0x1aa3e0){return function(_0x431356){if(_0x431356){return _0x431356[_0x29e1('0x32')](_0x42d2f5)[_0x29e1('0x1f')](function(_0x4023af){return _0x4023af;});}return null;};}function removeEntity(_0x2e0d06,_0x1566d6){return function(_0x4b5dec){if(_0x4b5dec){return _0x4b5dec['destroy']()['then'](function(){var _0x249f78=_0x4b5dec[_0x29e1('0x33')]({'plain':!![]});var _0xfbbe6d='MailAccounts';return db['UserProfileResource'][_0x29e1('0x34')]({'where':{'type':_0xfbbe6d,'resourceId':_0x249f78['id']}})[_0x29e1('0x1f')](function(){return _0x4b5dec;});})[_0x29e1('0x1f')](function(){_0x2e0d06['status'](0xcc)[_0x29e1('0x35')]();});}};}function handleEntityNotFound(_0x4d5d95,_0x2c5d3d){return function(_0x33c27b){if(!_0x33c27b){_0x4d5d95[_0x29e1('0x2a')](0x194);}return _0x33c27b;};}function handleError(_0x2c60bc,_0x48b43d){_0x48b43d=_0x48b43d||0x1f4;return function(_0x5a9b47){logger['error'](_0x5a9b47[_0x29e1('0x36')]);if(_0x5a9b47[_0x29e1('0x37')]){delete _0x5a9b47['name'];}_0x2c60bc['status'](_0x48b43d)[_0x29e1('0x38')](_0x5a9b47);};}exports[_0x29e1('0x39')]=function(_0x153c8a,_0x2d5952){var _0x1db0cd={'include':[{'model':db[_0x29e1('0x3a')],'as':_0x29e1('0x3b')},{'model':db[_0x29e1('0x3c')],'as':'Smtp'},{'model':db[_0x29e1('0x3d')],'as':_0x29e1('0x3e')}]},_0x1e4ed0={},_0x328e97={'count':0x0,'rows':[]};var _0x1725d4=_[_0x29e1('0x3f')](db[_0x29e1('0x40')][_0x29e1('0x41')],function(_0xc0d213){return{'name':_0xc0d213['fieldName'],'type':_0xc0d213[_0x29e1('0x42')][_0x29e1('0x43')]};});_0x1e4ed0[_0x29e1('0x44')]=_['map'](_0x1725d4,_0x29e1('0x37'));_0x1e4ed0[_0x29e1('0x45')]=_[_0x29e1('0x46')](_0x153c8a[_0x29e1('0x45')]);_0x1e4ed0[_0x29e1('0x47')]=_[_0x29e1('0x48')](_0x1e4ed0[_0x29e1('0x44')],_0x1e4ed0['query']);_0x1db0cd[_0x29e1('0x49')]=_[_0x29e1('0x48')](_0x1e4ed0[_0x29e1('0x44')],qs[_0x29e1('0x4a')](_0x153c8a[_0x29e1('0x45')][_0x29e1('0x4a')]));_0x1db0cd[_0x29e1('0x49')]=_0x1db0cd[_0x29e1('0x49')][_0x29e1('0x4b')]?_0x1db0cd[_0x29e1('0x49')]:_0x1e4ed0['model'];if(!_0x153c8a['query'][_0x29e1('0x4c')](_0x29e1('0x4d'))){_0x1db0cd[_0x29e1('0x2e')]=qs[_0x29e1('0x2e')](_0x153c8a['query'][_0x29e1('0x2e')]);_0x1db0cd[_0x29e1('0x2d')]=qs[_0x29e1('0x2d')](_0x153c8a[_0x29e1('0x45')][_0x29e1('0x2d')]);}_0x1db0cd[_0x29e1('0x4e')]=qs[_0x29e1('0x4f')](_0x153c8a[_0x29e1('0x45')][_0x29e1('0x4f')]);_0x1db0cd[_0x29e1('0x50')]=qs[_0x29e1('0x47')](_[_0x29e1('0x51')](_0x153c8a[_0x29e1('0x45')],_0x1e4ed0[_0x29e1('0x47')]),_0x1725d4);if(_0x153c8a[_0x29e1('0x45')]['filter']){_0x1db0cd[_0x29e1('0x50')]=_['merge'](_0x1db0cd[_0x29e1('0x50')],{'$or':_[_0x29e1('0x3f')](_0x1725d4,function(_0x16645b){if(_0x16645b[_0x29e1('0x42')]!==_0x29e1('0x52')){var _0x3d4328={};_0x3d4328[_0x16645b[_0x29e1('0x37')]]={'$like':'%'+_0x153c8a[_0x29e1('0x45')]['filter']+'%'};return _0x3d4328;}})});}_0x1db0cd=_['merge']({},_0x1db0cd,_0x153c8a['options']);var _0x2a9380={'where':_0x1db0cd[_0x29e1('0x50')]};return db[_0x29e1('0x40')]['count'](_0x2a9380)[_0x29e1('0x1f')](function(_0x1cc4c1){_0x328e97[_0x29e1('0x2c')]=_0x1cc4c1;if(_0x153c8a['query']['includeAll']){_0x1db0cd[_0x29e1('0x53')]=[{'all':!![]}];}return db[_0x29e1('0x40')][_0x29e1('0x54')](_0x1db0cd);})['then'](function(_0x295d86){_0x328e97[_0x29e1('0x55')]=_0x295d86;return _0x328e97;})[_0x29e1('0x1f')](respondWithFilteredResult(_0x2d5952,_0x1db0cd))[_0x29e1('0x29')](handleError(_0x2d5952,null));};exports[_0x29e1('0x56')]=function(_0x28655b,_0x31613a){var _0x1800f0={'raw':![],'where':{'id':_0x28655b['params']['id']},'include':[{'model':db[_0x29e1('0x3a')],'as':_0x29e1('0x3b')},{'model':db[_0x29e1('0x3c')],'as':'Smtp'},{'model':db['Pause'],'as':_0x29e1('0x3e')}]},_0x3471c8={};_0x3471c8['model']=_[_0x29e1('0x46')](db[_0x29e1('0x40')][_0x29e1('0x41')]);_0x3471c8[_0x29e1('0x45')]=_[_0x29e1('0x46')](_0x28655b['query']);_0x3471c8[_0x29e1('0x47')]=_[_0x29e1('0x48')](_0x3471c8[_0x29e1('0x44')],_0x3471c8['query']);_0x1800f0[_0x29e1('0x49')]=_[_0x29e1('0x48')](_0x3471c8[_0x29e1('0x44')],qs[_0x29e1('0x4a')](_0x28655b[_0x29e1('0x45')][_0x29e1('0x4a')]));_0x1800f0[_0x29e1('0x49')]=_0x1800f0[_0x29e1('0x49')][_0x29e1('0x4b')]?_0x1800f0[_0x29e1('0x49')]:_0x3471c8[_0x29e1('0x44')];if(_0x28655b[_0x29e1('0x45')][_0x29e1('0x57')]){_0x1800f0['include']=[{'all':!![]}];}_0x1800f0=_[_0x29e1('0x58')]({},_0x1800f0,_0x28655b[_0x29e1('0x59')]);return db[_0x29e1('0x40')][_0x29e1('0x5a')](_0x1800f0)[_0x29e1('0x1f')](handleEntityNotFound(_0x31613a,null))[_0x29e1('0x1f')](respondWithResult(_0x31613a,null))[_0x29e1('0x29')](handleError(_0x31613a,null));};exports[_0x29e1('0x32')]=function(_0x40c53b,_0x5e0870){if(_0x40c53b[_0x29e1('0x5b')]['id']){delete _0x40c53b[_0x29e1('0x5b')]['id'];}return db['MailAccount'][_0x29e1('0x5a')]({'where':{'id':_0x40c53b[_0x29e1('0x5c')]['id']},'include':[{'model':db[_0x29e1('0x3a')],'as':_0x29e1('0x3b')},{'model':db['MailServerOut'],'as':_0x29e1('0x5d')},{'model':db[_0x29e1('0x3d')],'as':_0x29e1('0x3e')}]})[_0x29e1('0x1f')](handleEntityNotFound(_0x5e0870,null))['then'](saveUpdates(_0x40c53b[_0x29e1('0x5b')],null))['then'](function(_0x2b2ee7){if(_0x2b2ee7&&_0x40c53b['body']['Imap']){return db[_0x29e1('0x3a')][_0x29e1('0x32')](_0x40c53b['body']['Imap'],{'where':{'MailAccountId':_0x2b2ee7['id']}})[_0x29e1('0x1f')](function(){return _0x2b2ee7;});}return _0x2b2ee7;})[_0x29e1('0x1f')](function(_0x44746d){if(_0x44746d&&_0x40c53b[_0x29e1('0x5b')][_0x29e1('0x5d')]){return db[_0x29e1('0x3c')][_0x29e1('0x32')](_0x40c53b[_0x29e1('0x5b')][_0x29e1('0x5d')],{'where':{'MailAccountId':_0x44746d['id']}})['then'](function(){return _0x44746d;});}return _0x44746d;})[_0x29e1('0x1f')](respondWithResult(_0x5e0870,null))[_0x29e1('0x29')](handleError(_0x5e0870,null));};exports[_0x29e1('0x5e')]=function(_0x5a042e,_0x2969a6){return db[_0x29e1('0x40')]['describe']()[_0x29e1('0x1f')](respondWithResult(_0x2969a6,null))[_0x29e1('0x29')](handleError(_0x2969a6,null));};exports[_0x29e1('0x5f')]=function(_0x3dbd31,_0x50a9bf,_0x38beff){if(_0x3dbd31[_0x29e1('0x5b')]['id']){delete _0x3dbd31[_0x29e1('0x5b')]['id'];}return db[_0x29e1('0x40')][_0x29e1('0x5a')]({'where':{'id':_0x3dbd31['params']['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x50a9bf,null))[_0x29e1('0x1f')](function(_0x60cd37){if(_0x60cd37){_0x3dbd31[_0x29e1('0x5b')][_0x29e1('0x60')]=_0x60cd37['id'];return db[_0x29e1('0x61')][_0x29e1('0x62')](_0x3dbd31['body']);}})[_0x29e1('0x1f')](respondWithResult(_0x50a9bf,null))[_0x29e1('0x29')](handleError(_0x50a9bf,null));};exports['getDispositions']=function(_0x3fb1d2,_0x3cb448,_0x1b74b8){var _0x4fb816={'raw':![],'where':{}};var _0x54a0d9={};var _0x181878={'count':0x0,'rows':[]};return db[_0x29e1('0x40')][_0x29e1('0x63')]({'where':{'id':_0x3fb1d2[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x3cb448,null))['then'](function(_0x470af0){if(_0x470af0){_0x54a0d9['model']=_[_0x29e1('0x46')](db[_0x29e1('0x61')][_0x29e1('0x41')]);_0x54a0d9[_0x29e1('0x45')]=_[_0x29e1('0x46')](_0x3fb1d2[_0x29e1('0x45')]);_0x54a0d9[_0x29e1('0x47')]=_[_0x29e1('0x48')](_0x54a0d9['model'],_0x54a0d9[_0x29e1('0x45')]);_0x4fb816[_0x29e1('0x49')]=_['intersection'](_0x54a0d9[_0x29e1('0x44')],qs[_0x29e1('0x4a')](_0x3fb1d2[_0x29e1('0x45')]['fields']));_0x4fb816[_0x29e1('0x49')]=_0x4fb816[_0x29e1('0x49')][_0x29e1('0x4b')]?_0x4fb816[_0x29e1('0x49')]:_0x54a0d9[_0x29e1('0x44')];if(!_0x3fb1d2[_0x29e1('0x45')]['hasOwnProperty'](_0x29e1('0x4d'))){_0x4fb816[_0x29e1('0x2e')]=qs[_0x29e1('0x2e')](_0x3fb1d2['query'][_0x29e1('0x2e')]);_0x4fb816[_0x29e1('0x2d')]=qs['offset'](_0x3fb1d2[_0x29e1('0x45')][_0x29e1('0x2d')]);}_0x4fb816[_0x29e1('0x4e')]=qs[_0x29e1('0x4f')](_0x3fb1d2[_0x29e1('0x45')][_0x29e1('0x4f')]);_0x4fb816[_0x29e1('0x50')]=qs[_0x29e1('0x47')](_[_0x29e1('0x51')](_0x3fb1d2[_0x29e1('0x45')],_0x54a0d9[_0x29e1('0x47')]));_0x4fb816[_0x29e1('0x50')][_0x29e1('0x60')]=_0x470af0['id'];if(_0x3fb1d2[_0x29e1('0x45')][_0x29e1('0x64')]){_0x4fb816[_0x29e1('0x50')]=_[_0x29e1('0x58')](_0x4fb816[_0x29e1('0x50')],{'$or':_['map'](_0x4fb816[_0x29e1('0x49')],function(_0x126da1){var _0x2fcca9={};_0x2fcca9[_0x126da1]={'$like':'%'+_0x3fb1d2[_0x29e1('0x45')][_0x29e1('0x64')]+'%'};return _0x2fcca9;})});}_0x4fb816=_[_0x29e1('0x58')]({},_0x4fb816,_0x3fb1d2['options']);return db['Disposition'][_0x29e1('0x2c')]({'where':_0x4fb816[_0x29e1('0x50')]})[_0x29e1('0x1f')](function(_0x16a416){_0x181878[_0x29e1('0x2c')]=_0x16a416;if(_0x3fb1d2['query'][_0x29e1('0x57')]){_0x4fb816['include']=[{'all':!![]}];}return db[_0x29e1('0x61')][_0x29e1('0x54')](_0x4fb816);})['then'](function(_0x3b2eb9){_0x181878['rows']=_0x3b2eb9;return _0x181878;});}})[_0x29e1('0x1f')](respondWithFilteredResult(_0x3cb448,_0x4fb816))[_0x29e1('0x29')](handleError(_0x3cb448,null));};exports['removeDispositions']=function(_0x536c99,_0x3f7ad2,_0x362431){return db[_0x29e1('0x40')][_0x29e1('0x5a')]({'where':{'id':_0x536c99[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x3f7ad2,null))['then'](function(_0x546623){if(_0x546623){return _0x546623['removeDispositions'](_0x536c99[_0x29e1('0x45')]['ids']);}})[_0x29e1('0x1f')](respondWithStatusCode(_0x3f7ad2,null))[_0x29e1('0x29')](handleError(_0x3f7ad2,null));};exports[_0x29e1('0x65')]=function(_0x5bfe5c,_0x411f09,_0x253f6b){if(_0x5bfe5c[_0x29e1('0x5b')]['id']){delete _0x5bfe5c[_0x29e1('0x5b')]['id'];}return db[_0x29e1('0x40')][_0x29e1('0x5a')]({'where':{'id':_0x5bfe5c[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x411f09,null))['then'](function(_0x41c609){if(_0x41c609){_0x5bfe5c['body'][_0x29e1('0x60')]=_0x41c609['id'];return db[_0x29e1('0x66')]['create'](_0x5bfe5c[_0x29e1('0x5b')]);}})[_0x29e1('0x1f')](respondWithResult(_0x411f09,null))[_0x29e1('0x29')](handleError(_0x411f09,null));};exports['getAnswers']=function(_0x44758b,_0x39c9f0,_0x12ee93){var _0x2c7a61={'raw':![],'where':{}};var _0x2d0fac={};var _0x1e35f2={'count':0x0,'rows':[]};return db[_0x29e1('0x40')]['findOne']({'where':{'id':_0x44758b[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x39c9f0,null))[_0x29e1('0x1f')](function(_0x4bfba3){if(_0x4bfba3){_0x2d0fac[_0x29e1('0x44')]=_[_0x29e1('0x46')](db[_0x29e1('0x66')]['rawAttributes']);_0x2d0fac[_0x29e1('0x45')]=_['keys'](_0x44758b[_0x29e1('0x45')]);_0x2d0fac[_0x29e1('0x47')]=_[_0x29e1('0x48')](_0x2d0fac[_0x29e1('0x44')],_0x2d0fac['query']);_0x2c7a61['attributes']=_[_0x29e1('0x48')](_0x2d0fac[_0x29e1('0x44')],qs[_0x29e1('0x4a')](_0x44758b[_0x29e1('0x45')][_0x29e1('0x4a')]));_0x2c7a61[_0x29e1('0x49')]=_0x2c7a61[_0x29e1('0x49')]['length']?_0x2c7a61[_0x29e1('0x49')]:_0x2d0fac[_0x29e1('0x44')];if(!_0x44758b[_0x29e1('0x45')][_0x29e1('0x4c')](_0x29e1('0x4d'))){_0x2c7a61[_0x29e1('0x2e')]=qs[_0x29e1('0x2e')](_0x44758b[_0x29e1('0x45')][_0x29e1('0x2e')]);_0x2c7a61[_0x29e1('0x2d')]=qs[_0x29e1('0x2d')](_0x44758b[_0x29e1('0x45')][_0x29e1('0x2d')]);}_0x2c7a61[_0x29e1('0x4e')]=qs['sort'](_0x44758b[_0x29e1('0x45')]['sort']);_0x2c7a61['where']=qs[_0x29e1('0x47')](_['pick'](_0x44758b[_0x29e1('0x45')],_0x2d0fac[_0x29e1('0x47')]));_0x2c7a61['where'][_0x29e1('0x60')]=_0x4bfba3['id'];if(_0x44758b[_0x29e1('0x45')][_0x29e1('0x64')]){_0x2c7a61['where']=_[_0x29e1('0x58')](_0x2c7a61[_0x29e1('0x50')],{'$or':_[_0x29e1('0x3f')](_0x2c7a61['attributes'],function(_0x109d9c){var _0x3caa81={};_0x3caa81[_0x109d9c]={'$like':'%'+_0x44758b['query'][_0x29e1('0x64')]+'%'};return _0x3caa81;})});}_0x2c7a61=_['merge']({},_0x2c7a61,_0x44758b[_0x29e1('0x59')]);return db[_0x29e1('0x66')]['count']({'where':_0x2c7a61[_0x29e1('0x50')]})[_0x29e1('0x1f')](function(_0x16d536){_0x1e35f2[_0x29e1('0x2c')]=_0x16d536;if(_0x44758b[_0x29e1('0x45')][_0x29e1('0x57')]){_0x2c7a61[_0x29e1('0x53')]=[{'all':!![]}];}return db[_0x29e1('0x66')][_0x29e1('0x54')](_0x2c7a61);})[_0x29e1('0x1f')](function(_0x49dee9){_0x1e35f2[_0x29e1('0x55')]=_0x49dee9;return _0x1e35f2;});}})[_0x29e1('0x1f')](respondWithFilteredResult(_0x39c9f0,_0x2c7a61))['catch'](handleError(_0x39c9f0,null));};exports[_0x29e1('0x67')]=function(_0x2fa358,_0x17739a,_0x710366){return db['MailAccount'][_0x29e1('0x5a')]({'where':{'id':_0x2fa358['params']['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x17739a,null))['then'](function(_0x1d2995){if(_0x1d2995){return _0x1d2995[_0x29e1('0x67')](_0x2fa358[_0x29e1('0x45')][_0x29e1('0x68')]);}})['then'](respondWithStatusCode(_0x17739a,null))['catch'](handleError(_0x17739a,null));};exports[_0x29e1('0x62')]=function(_0x2734ab,_0x467a1b){var _0x4cd6af={'name':_0x2734ab[_0x29e1('0x5b')][_0x29e1('0x37')],'key':_0x2734ab[_0x29e1('0x5b')][_0x29e1('0x43')],'email':_0x2734ab['body']['email'],'ListId':_0x2734ab['body'][_0x29e1('0x69')],'active':!_[_0x29e1('0x6a')](_0x2734ab[_0x29e1('0x5b')][_0x29e1('0x6b')])?_0x2734ab['body'][_0x29e1('0x6b')]:!![],'description':_0x2734ab['body'][_0x29e1('0x6c')]||null,'Imap':{},'Smtp':{}};if(_[_0x29e1('0x6a')](_0x2734ab['body']['cservice'])){if(_0x2734ab[_0x29e1('0x5b')][_0x29e1('0x6d')]){_0x4cd6af[_0x29e1('0x3b')]['user']=_0x4cd6af[_0x29e1('0x5d')][_0x29e1('0x6e')]=_0x2734ab['body'][_0x29e1('0x6f')];_0x4cd6af[_0x29e1('0x3b')][_0x29e1('0x70')]=_0x4cd6af['Smtp'][_0x29e1('0x71')]=_0x2734ab[_0x29e1('0x5b')][_0x29e1('0x72')];}else{_0x4cd6af[_0x29e1('0x3b')][_0x29e1('0x73')]=_0x4cd6af[_0x29e1('0x5d')][_0x29e1('0x73')]=![];}_0x4cd6af[_0x29e1('0x3b')][_0x29e1('0x74')]=_0x2734ab['body'][_0x29e1('0x3b')][_0x29e1('0x74')];_0x4cd6af[_0x29e1('0x3b')]['port']=_0x2734ab[_0x29e1('0x5b')]['Imap']['port'];_0x4cd6af[_0x29e1('0x5d')][_0x29e1('0x74')]=_0x2734ab[_0x29e1('0x5b')][_0x29e1('0x5d')][_0x29e1('0x74')];_0x4cd6af[_0x29e1('0x5d')]['port']=_0x2734ab['body']['Smtp'][_0x29e1('0x75')];}else{_0x4cd6af[_0x29e1('0x3b')]['service']=_0x4cd6af[_0x29e1('0x5d')][_0x29e1('0x76')]=_0x2734ab[_0x29e1('0x5b')][_0x29e1('0x77')];_0x4cd6af[_0x29e1('0x3b')][_0x29e1('0x6e')]=_0x4cd6af[_0x29e1('0x5d')]['user']=_0x2734ab[_0x29e1('0x5b')][_0x29e1('0x6f')];_0x4cd6af[_0x29e1('0x3b')][_0x29e1('0x70')]=_0x4cd6af[_0x29e1('0x5d')]['pass']=_0x2734ab[_0x29e1('0x5b')][_0x29e1('0x72')];}return db[_0x29e1('0x40')]['create'](_0x4cd6af,{'include':[{'model':db[_0x29e1('0x3c')],'as':_0x29e1('0x5d')},{'model':db['MailServerIn'],'as':_0x29e1('0x3b')}]})['then'](function(_0x42f370){var _0x23d84b=_0x2734ab[_0x29e1('0x6e')][_0x29e1('0x33')]({'plain':!![]});if(!_0x23d84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23d84b[_0x29e1('0x78')]===_0x29e1('0x6e')){var _0x3ec604=_0x42f370[_0x29e1('0x33')]({'plain':!![]});return db[_0x29e1('0x79')][_0x29e1('0x5a')]({'where':{'name':_0x29e1('0x7a'),'userProfileId':_0x23d84b[_0x29e1('0x7b')]},'raw':!![]})[_0x29e1('0x1f')](function(_0x43d08e){if(_0x43d08e&&_0x43d08e[_0x29e1('0x7c')]===0x0){return db[_0x29e1('0x7d')]['create']({'name':_0x3ec604['name'],'resourceId':_0x3ec604['id'],'type':_0x43d08e[_0x29e1('0x37')],'sectionId':_0x43d08e['id']},{})['then'](function(){return _0x42f370;});}else{return _0x42f370;}})[_0x29e1('0x29')](function(_0x2ff185){logger[_0x29e1('0x26')](_0x29e1('0x7e'),_0x2ff185);throw _0x2ff185;});}return _0x42f370;})['then'](respondWithResult(_0x467a1b,0xc9))[_0x29e1('0x29')](handleError(_0x467a1b,null));};exports[_0x29e1('0x7f')]=function(_0x3a0895,_0x4a0bb7,_0x46021f){return db[_0x29e1('0x40')]['findOne']({'where':{'id':_0x3a0895['params']['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x4a0bb7,null))[_0x29e1('0x1f')](function(_0x41ab3b){if(_0x41ab3b){return _0x41ab3b[_0x29e1('0x7f')]();}return null;})[_0x29e1('0x1f')](respondWithResult(_0x4a0bb7,null))[_0x29e1('0x29')](handleError(_0x4a0bb7,null));};exports[_0x29e1('0x80')]=function(_0x2254ad,_0x140a41,_0x147f95){if(_0x2254ad[_0x29e1('0x5b')]['id']){delete _0x2254ad['body']['id'];}return db[_0x29e1('0x40')][_0x29e1('0x5a')]({'where':{'id':_0x2254ad[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x140a41,null))[_0x29e1('0x1f')](function(_0x32a4f5){if(_0x32a4f5){_0x2254ad[_0x29e1('0x5b')][_0x29e1('0x60')]=_0x32a4f5['id'];return db[_0x29e1('0x3a')]['create'](_0x2254ad[_0x29e1('0x5b')]);}})[_0x29e1('0x1f')](respondWithResult(_0x140a41,null))[_0x29e1('0x29')](handleError(_0x140a41,null));};exports[_0x29e1('0x81')]=function(_0x528348,_0x1c3d4f,_0xdaebd1){return db[_0x29e1('0x40')][_0x29e1('0x63')]({'where':{'id':_0x528348[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x1c3d4f,null))[_0x29e1('0x1f')](function(_0x47ed3a){if(_0x47ed3a){return _0x47ed3a[_0x29e1('0x82')](null);}return null;})[_0x29e1('0x1f')](respondWithStatusCode(_0x1c3d4f,null))[_0x29e1('0x29')](handleError(_0x1c3d4f,null));};exports[_0x29e1('0x83')]=function(_0x392f70,_0x107452,_0x377987){return db[_0x29e1('0x40')]['findOne']({'where':{'id':_0x392f70[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x107452,null))[_0x29e1('0x1f')](function(_0x100bc1){if(_0x100bc1){return _0x100bc1[_0x29e1('0x83')]();}return null;})[_0x29e1('0x1f')](respondWithResult(_0x107452,null))[_0x29e1('0x29')](handleError(_0x107452,null));};exports[_0x29e1('0x84')]=function(_0x20c02f,_0x310ade,_0xeef0f4){if(_0x20c02f[_0x29e1('0x5b')]['id']){delete _0x20c02f[_0x29e1('0x5b')]['id'];}return db[_0x29e1('0x40')]['find']({'where':{'id':_0x20c02f[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x310ade,null))[_0x29e1('0x1f')](function(_0x5d55a4){if(_0x5d55a4){_0x20c02f['body'][_0x29e1('0x60')]=_0x5d55a4['id'];return db[_0x29e1('0x3c')][_0x29e1('0x62')](_0x20c02f[_0x29e1('0x5b')]);}})[_0x29e1('0x1f')](respondWithResult(_0x310ade,null))[_0x29e1('0x29')](handleError(_0x310ade,null));};exports[_0x29e1('0x85')]=function(_0x349780,_0x3594f3,_0x46eaba){return db[_0x29e1('0x40')][_0x29e1('0x63')]({'where':{'id':_0x349780[_0x29e1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3594f3,null))[_0x29e1('0x1f')](function(_0x5a921c){if(_0x5a921c){return _0x5a921c[_0x29e1('0x86')](null);}return null;})[_0x29e1('0x1f')](respondWithStatusCode(_0x3594f3,null))[_0x29e1('0x29')](handleError(_0x3594f3,null));};exports['addInteraction']=function(_0x4d38a5,_0x39765c,_0x296e69){return db[_0x29e1('0x87')][_0x29e1('0x5a')]({'where':{'id':_0x4d38a5['params']['id']}})['then'](handleEntityNotFound(_0x39765c,null))[_0x29e1('0x1f')](function(_0x1bb3c5){if(_0x1bb3c5){return _0x1bb3c5['addInteraction'](_0x4d38a5['body'][_0x29e1('0x68')],_[_0x29e1('0x88')](_0x4d38a5[_0x29e1('0x5b')],[_0x29e1('0x68'),'id'])||{});}})['then'](respondWithResult(_0x39765c,null))[_0x29e1('0x29')](handleError(_0x39765c,null));};exports[_0x29e1('0x89')]=function(_0xaf921,_0x373f02,_0x277a5b){var _0x33bcdc={'raw':![],'where':{}};var _0x31c15d={};var _0x207869={'count':0x0,'rows':[]};return db[_0x29e1('0x40')][_0x29e1('0x63')]({'where':{'id':_0xaf921['params']['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x373f02,null))[_0x29e1('0x1f')](function(_0x22641c){if(_0x22641c){_0x31c15d[_0x29e1('0x44')]=_['keys'](db[_0x29e1('0x87')][_0x29e1('0x41')]);_0x31c15d[_0x29e1('0x45')]=_['keys'](_0xaf921['query']);_0x31c15d[_0x29e1('0x47')]=_[_0x29e1('0x48')](_0x31c15d['model'],_0x31c15d['query']);_0x33bcdc[_0x29e1('0x49')]=_['intersection'](_0x31c15d['model'],qs[_0x29e1('0x4a')](_0xaf921[_0x29e1('0x45')][_0x29e1('0x4a')]));_0x33bcdc['attributes']=_0x33bcdc[_0x29e1('0x49')][_0x29e1('0x4b')]?_0x33bcdc[_0x29e1('0x49')]:_0x31c15d[_0x29e1('0x44')];if(!_0xaf921[_0x29e1('0x45')][_0x29e1('0x4c')](_0x29e1('0x4d'))){_0x33bcdc[_0x29e1('0x2e')]=qs[_0x29e1('0x2e')](_0xaf921[_0x29e1('0x45')][_0x29e1('0x2e')]);_0x33bcdc[_0x29e1('0x2d')]=qs[_0x29e1('0x2d')](_0xaf921['query'][_0x29e1('0x2d')]);}_0x33bcdc[_0x29e1('0x4e')]=qs[_0x29e1('0x4f')](_0xaf921[_0x29e1('0x45')]['sort']);_0x33bcdc[_0x29e1('0x50')]=qs[_0x29e1('0x47')](_['pick'](_0xaf921[_0x29e1('0x45')],_0x31c15d[_0x29e1('0x47')]));_0x33bcdc[_0x29e1('0x50')][_0x29e1('0x60')]=_0x22641c['id'];if(_0xaf921[_0x29e1('0x45')]['filter']){_0x33bcdc[_0x29e1('0x50')]=_[_0x29e1('0x58')](_0x33bcdc[_0x29e1('0x50')],{'$or':_['map'](_0x33bcdc[_0x29e1('0x49')],function(_0x5577fb){var _0x222426={};_0x222426[_0x5577fb]={'$like':'%'+_0xaf921[_0x29e1('0x45')][_0x29e1('0x64')]+'%'};return _0x222426;})});}_0x33bcdc=_['merge']({},_0x33bcdc,_0xaf921[_0x29e1('0x59')]);return db[_0x29e1('0x87')]['count']({'where':_0x33bcdc[_0x29e1('0x50')]})[_0x29e1('0x1f')](function(_0x347ee3){_0x207869['count']=_0x347ee3;if(_0xaf921['query'][_0x29e1('0x57')]){_0x33bcdc[_0x29e1('0x53')]=[{'model':db[_0x29e1('0x8a')],'as':_0x29e1('0x8b'),'required':![]},{'model':db['User'],'as':_0x29e1('0x8c'),'attributes':[_0x29e1('0x37'),_0x29e1('0x8d'),_0x29e1('0x8e')],'required':![]},{'model':db[_0x29e1('0x8f')],'as':_0x29e1('0x90'),'attributes':['id','name',_0x29e1('0x91')],'where':_0xaf921[_0x29e1('0x45')]['tag']?{'id':_0xaf921[_0x29e1('0x45')][_0x29e1('0x92')]}:undefined,'required':_0xaf921[_0x29e1('0x45')][_0x29e1('0x92')]?!![]:![]}];}return db[_0x29e1('0x87')][_0x29e1('0x54')](_0x33bcdc);})[_0x29e1('0x1f')](function(_0x2d99b6){_0x207869['rows']=_0x2d99b6;return _0x207869;});}})[_0x29e1('0x1f')](respondWithFilteredResult(_0x373f02,_0x33bcdc))[_0x29e1('0x29')](handleError(_0x373f02,null));};exports[_0x29e1('0x93')]=function(_0x496c1b,_0x354ba2,_0x205096){return db[_0x29e1('0x40')][_0x29e1('0x63')]({'where':{'id':_0x496c1b[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x354ba2,null))[_0x29e1('0x1f')](function(_0x4581d6){if(_0x4581d6){return db[_0x29e1('0x94')][_0x29e1('0x95')](function(_0x1dcc43){return db[_0x29e1('0x96')]['destroy']({'where':{'MailAccountId':_0x496c1b[_0x29e1('0x5c')]['id']},'transaction':_0x1dcc43})[_0x29e1('0x1f')](function(_0x214576){var _0x4c7193=_[_0x29e1('0x3f')](_0x496c1b[_0x29e1('0x5b')],function(_0x685ada){_0x685ada[_0x29e1('0x60')]=_0x496c1b[_0x29e1('0x5c')]['id'];return _0x685ada;});return db[_0x29e1('0x96')][_0x29e1('0x97')](_0x4c7193,{'transaction':_0x1dcc43});});})['then'](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x496c1b[_0x29e1('0x5c')]['id']},'order':_0x29e1('0x98')});});}})['then'](respondWithResult(_0x354ba2,null))[_0x29e1('0x29')](handleError(_0x354ba2,null));};exports[_0x29e1('0x99')]=function(_0x2e2e59,_0x6b37dd,_0x2cb147){var _0x573559={};var _0x2cbd35={};var _0xb8dbd2;var _0x59caa5;return db[_0x29e1('0x40')]['findOne']({'where':{'id':_0x2e2e59[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x6b37dd,null))[_0x29e1('0x1f')](function(_0x5dc546){if(_0x5dc546){_0xb8dbd2=_0x5dc546;_0x2cbd35['model']=_['keys'](db[_0x29e1('0x96')][_0x29e1('0x41')]);_0x2cbd35[_0x29e1('0x45')]=_[_0x29e1('0x46')](_0x2e2e59[_0x29e1('0x45')]);_0x2cbd35[_0x29e1('0x47')]=_[_0x29e1('0x48')](_0x2cbd35[_0x29e1('0x44')],_0x2cbd35['query']);_0x573559['attributes']=_[_0x29e1('0x48')](_0x2cbd35[_0x29e1('0x44')],qs[_0x29e1('0x4a')](_0x2e2e59[_0x29e1('0x45')][_0x29e1('0x4a')]));_0x573559[_0x29e1('0x49')]=_0x573559['attributes']['length']?_0x573559[_0x29e1('0x49')]:_0x2cbd35[_0x29e1('0x44')];_0x573559[_0x29e1('0x4e')]=qs[_0x29e1('0x4f')](_0x2e2e59[_0x29e1('0x45')][_0x29e1('0x4f')]);_0x573559['where']=qs[_0x29e1('0x47')](_['pick'](_0x2e2e59[_0x29e1('0x45')],_0x2cbd35[_0x29e1('0x47')]));if(_0x2e2e59[_0x29e1('0x45')]['filter']){_0x573559[_0x29e1('0x50')]=_['merge'](_0x573559[_0x29e1('0x50')],{'$or':_['map'](_0x573559[_0x29e1('0x49')],function(_0x3f29c1){var _0x2a9ef6={};_0x2a9ef6[_0x3f29c1]={'$like':'%'+_0x2e2e59[_0x29e1('0x45')][_0x29e1('0x64')]+'%'};return _0x2a9ef6;})});}_0x573559=_[_0x29e1('0x58')]({},_0x573559,_0x2e2e59[_0x29e1('0x59')]);return _0xb8dbd2[_0x29e1('0x99')](_0x573559);}})['then'](function(_0x2b6de2){if(_0x2b6de2){_0x59caa5=_0x2b6de2[_0x29e1('0x4b')];if(!_0x2e2e59['query'][_0x29e1('0x4c')](_0x29e1('0x4d'))){_0x573559[_0x29e1('0x2e')]=qs[_0x29e1('0x2e')](_0x2e2e59[_0x29e1('0x45')][_0x29e1('0x2e')]);_0x573559[_0x29e1('0x2d')]=qs['offset'](_0x2e2e59[_0x29e1('0x45')][_0x29e1('0x2d')]);}return _0xb8dbd2['getApplications'](_0x573559);}})[_0x29e1('0x1f')](function(_0x29920e){if(_0x29920e){return _0x29920e?{'count':_0x59caa5,'rows':_0x29920e}:null;}})[_0x29e1('0x1f')](respondWithResult(_0x6b37dd,null))[_0x29e1('0x29')](handleError(_0x6b37dd,null));};exports[_0x29e1('0x9a')]=function(_0x4fb48d,_0x246704,_0x29014e){var _0x8240ff={'raw':!![],'where':{}};var _0x1ff70a={};var _0x53d25e={'count':0x0,'rows':[]};return db[_0x29e1('0x40')]['findOne']({'where':{'id':_0x4fb48d[_0x29e1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x246704,null))[_0x29e1('0x1f')](function(_0x163da7){if(_0x163da7){_0x1ff70a['model']=_[_0x29e1('0x46')](db[_0x29e1('0x9b')][_0x29e1('0x41')]);_0x1ff70a['query']=_['keys'](_0x4fb48d['query']);_0x1ff70a[_0x29e1('0x47')]=_[_0x29e1('0x48')](_0x1ff70a[_0x29e1('0x44')],_0x1ff70a[_0x29e1('0x45')]);_0x8240ff['attributes']=_['intersection'](_0x1ff70a[_0x29e1('0x44')],qs[_0x29e1('0x4a')](_0x4fb48d[_0x29e1('0x45')]['fields']));_0x8240ff[_0x29e1('0x49')]=_0x8240ff[_0x29e1('0x49')][_0x29e1('0x4b')]?_0x8240ff[_0x29e1('0x49')]:_0x1ff70a[_0x29e1('0x44')];if(!_0x4fb48d['query'][_0x29e1('0x4c')](_0x29e1('0x4d'))){_0x8240ff[_0x29e1('0x2e')]=qs['limit'](_0x4fb48d[_0x29e1('0x45')][_0x29e1('0x2e')]);_0x8240ff[_0x29e1('0x2d')]=qs['offset'](_0x4fb48d[_0x29e1('0x45')][_0x29e1('0x2d')]);}_0x8240ff[_0x29e1('0x4e')]=qs[_0x29e1('0x4f')](_0x4fb48d['query'][_0x29e1('0x4f')]);_0x8240ff[_0x29e1('0x50')]=qs[_0x29e1('0x47')](_['pick'](_0x4fb48d[_0x29e1('0x45')],_0x1ff70a[_0x29e1('0x47')]));_0x8240ff[_0x29e1('0x50')][_0x29e1('0x60')]=_0x163da7['id'];if(_0x4fb48d[_0x29e1('0x45')][_0x29e1('0x64')]){_0x8240ff[_0x29e1('0x50')]=_[_0x29e1('0x58')](_0x8240ff[_0x29e1('0x50')],{'$or':_[_0x29e1('0x3f')](_0x8240ff[_0x29e1('0x49')],function(_0x56d363){var _0x124710={};_0x124710[_0x56d363]={'$like':'%'+_0x4fb48d['query'][_0x29e1('0x64')]+'%'};return _0x124710;})});}if(_0x4fb48d[_0x29e1('0x45')][_0x29e1('0x9c')]){var _0x5a20c3=_0x4fb48d[_0x29e1('0x45')]['$gte'][_0x29e1('0x9d')](',');var _0x5177ee={};_0x5177ee[_0x5a20c3[0x0]]={'$gte':moment(_0x5a20c3[0x1])[_0x29e1('0x9e')](_0x29e1('0x9f'))};_0x8240ff[_0x29e1('0x50')]=_[_0x29e1('0x58')](_0x8240ff[_0x29e1('0x50')],_0x5177ee);}_0x8240ff=_[_0x29e1('0x58')]({},_0x8240ff,_0x4fb48d[_0x29e1('0x59')]);return db[_0x29e1('0x9b')][_0x29e1('0x2c')]({'where':_0x8240ff[_0x29e1('0x50')]})[_0x29e1('0x1f')](function(_0x87e69a){_0x53d25e['count']=_0x87e69a;if(_0x4fb48d['query'][_0x29e1('0x57')]){_0x8240ff['include']=[{'all':!![]}];}return db[_0x29e1('0x9b')][_0x29e1('0x54')](_0x8240ff);})['then'](function(_0x48ecd2){_0x53d25e[_0x29e1('0x55')]=_0x48ecd2;return _0x53d25e;});}})[_0x29e1('0x1f')](respondWithFilteredResult(_0x246704,_0x8240ff))['catch'](handleError(_0x246704,null));};exports[_0x29e1('0x38')]=function(_0x40680b,_0xd11a84,_0x3eec04){var _0x37c3df,_0x476e8d={},_0x428266;if(_0x40680b[_0x29e1('0x5b')]['to']){_0x428266=_0x40680b[_0x29e1('0x5b')]['to'][_0x29e1('0x9d')](',')[0x0];}return db[_0x29e1('0x40')][_0x29e1('0x5a')]({'where':{'id':_0x40680b[_0x29e1('0x5c')]['id']},'include':[{'model':db[_0x29e1('0xa0')],'as':_0x29e1('0xa1'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x428266},'limit':0x1,'order':[[_0x29e1('0xa2'),_0x29e1('0xa3')]]}]},{'model':db[_0x29e1('0x3c')],'as':_0x29e1('0x5d'),'raw':!![]}]})['then'](handleEntityNotFound(_0xd11a84,null))['then'](function(_0x2a8126){if(_0x2a8126){_0x37c3df=_0x2a8126;if(_0x2a8126[_0x29e1('0x5d')]){if(_[_0x29e1('0x6a')](_0x40680b[_0x29e1('0x5b')][_0x29e1('0xa4')])){_0x40680b['body'][_0x29e1('0xa4')]=util['format'](_0x29e1('0xa5'),_0x2a8126['name'],_0x2a8126[_0x29e1('0xa6')]||_0x2a8126['Smtp']['user']);}if(_0x40680b[_0x29e1('0x5b')][_0x29e1('0xa7')]&&_0x40680b['body']['attachments']['length']){for(var _0x170d95=0x0;_0x170d95<_0x40680b['body'][_0x29e1('0xa7')][_0x29e1('0x4b')];_0x170d95+=0x1){_0x40680b[_0x29e1('0x5b')][_0x29e1('0xa7')][_0x170d95]={'filename':_0x40680b['body'][_0x29e1('0xa7')][_0x170d95][_0x29e1('0x37')],'path':path[_0x29e1('0xa8')](config[_0x29e1('0xa9')],_0x29e1('0xaa'),_0x40680b[_0x29e1('0x5b')][_0x29e1('0xa7')][_0x170d95][_0x29e1('0xab')])};}}var _0x489acc={'tls':{'rejectUnauthorized':![]}};if(_[_0x29e1('0x6a')](_0x2a8126[_0x29e1('0x5d')][_0x29e1('0x76')])){if(_0x2a8126['Smtp'][_0x29e1('0x73')]){_0x489acc[_0x29e1('0xac')]={'user':_0x2a8126[_0x29e1('0x5d')]['user'],'pass':_0x2a8126[_0x29e1('0x5d')][_0x29e1('0x71')]};}_0x489acc[_0x29e1('0x74')]=_0x2a8126[_0x29e1('0x5d')][_0x29e1('0x74')];_0x489acc[_0x29e1('0x75')]=_0x2a8126[_0x29e1('0x5d')][_0x29e1('0x75')];_0x489acc[_0x29e1('0xad')]=_0x2a8126[_0x29e1('0x5d')][_0x29e1('0xad')];}else{_0x489acc['service']=_0x2a8126[_0x29e1('0x5d')]['service'];_0x489acc['auth']={'user':_0x2a8126[_0x29e1('0x5d')]['user'],'pass':_0x2a8126[_0x29e1('0x5d')][_0x29e1('0x71')]};}return respondWithRpcPromise(_0x29e1('0xae'),'sendMail',{'account':_0x489acc,'message':_0x40680b[_0x29e1('0x5b')]});}else{throw new Error(_0x29e1('0xaf'));}}})[_0x29e1('0x1f')](function(_0x1fdd15){if(_0x1fdd15){_0x476e8d=_0x1fdd15;if(_0x37c3df[_0x29e1('0xa1')]){if(_0x37c3df[_0x29e1('0xa1')][_0x29e1('0xb0')][_0x29e1('0x4b')]){return _0x37c3df[_0x29e1('0xa1')][_0x29e1('0xb0')][0x0];}else{return db[_0x29e1('0x8a')]['create'](_[_0x29e1('0x16')](_0x40680b[_0x29e1('0x5b')],{'firstName':_0x40680b[_0x29e1('0x5b')]['to'],'email':_0x40680b[_0x29e1('0x5b')]['to'],'phone':_0x40680b[_0x29e1('0x5b')]['to'],'ListId':_0x37c3df[_0x29e1('0x69')]}));}}else{throw new Error(_0x29e1('0xaf'));}}})[_0x29e1('0x1f')](function(_0x33f56b){if(_0x33f56b){var _0x6876bb={'UserId':_0x40680b[_0x29e1('0x6e')]['id'],'ContactId':_0x33f56b['id'],'MailAccountId':_0x37c3df['id'],'inReplyTo':_0x476e8d[_0x29e1('0xb1')],'to':_0x40680b[_0x29e1('0x5b')][_0x29e1('0xa4')],'cc':_0x40680b['body']['cc'],'subject':_0x40680b[_0x29e1('0x5b')][_0x29e1('0xb2')],'attach':_0x40680b[_0x29e1('0x5b')][_0x29e1('0xb3')],'firstMsgDirection':_0x29e1('0xb4'),'lastMsgAt':moment()['format'](_0x29e1('0x9f')),'lastMsgDirection':'out','lastMsgBody':_0x40680b[_0x29e1('0x5b')][_0x29e1('0x5b')],'Messages':[_[_0x29e1('0x58')](_0x40680b[_0x29e1('0x5b')],{'messageId':_0x476e8d[_0x29e1('0xb1')],'sentAt':moment()[_0x29e1('0x9e')](_0x29e1('0x9f')),'read':!![],'MailAccountId':_0x37c3df['id'],'UserId':_0x40680b[_0x29e1('0x6e')]['id'],'ContactId':_0x33f56b['id']})]};if(_0x40680b[_0x29e1('0x5b')]['Interaction']){_0x6876bb=_[_0x29e1('0x58')](_0x6876bb,_0x40680b[_0x29e1('0x5b')][_0x29e1('0xb5')]);}return db['MailInteraction'][_0x29e1('0x62')](_0x6876bb,{'include':[{'model':db[_0x29e1('0x9b')],'as':_0x29e1('0xb6')}]});}})[_0x29e1('0x1f')](respondWithResult(_0xd11a84,null))[_0x29e1('0x29')](handleError(_0xd11a84,null));};exports[_0x29e1('0xb7')]=function(_0x4c146f,_0x606f52,_0x394ff5){return db['MailAccount']['find']({'where':{'id':_0x4c146f[_0x29e1('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x29e1('0x1f')](handleEntityNotFound(_0x606f52,null))['then'](function(_0x2538fd){if(_0x2538fd&&_0x2538fd['Smtp']){var _0x1381ce={'id':_0x2538fd['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2538fd[_0x29e1('0x5d')][_0x29e1('0x76')]){_0x1381ce[_0x29e1('0x76')]=_0x2538fd[_0x29e1('0x5d')]['service'];}else{_0x1381ce[_0x29e1('0x74')]=_0x2538fd[_0x29e1('0x5d')]['host'];_0x1381ce[_0x29e1('0x75')]=_0x2538fd[_0x29e1('0x5d')]['port'];_0x1381ce[_0x29e1('0xad')]=_0x2538fd['Smtp'][_0x29e1('0xad')];}if(_0x2538fd['Smtp']['authentication']){_0x1381ce['auth']={'user':_0x2538fd[_0x29e1('0x5d')][_0x29e1('0x6e')],'pass':_0x2538fd[_0x29e1('0x5d')]['pass']};}return respondWithRpcPromise(_0x29e1('0xb8'),_0x29e1('0xb7'),{'account':_0x1381ce});}})[_0x29e1('0x1f')](respondWithResult(_0x606f52,null))['catch'](handleError(_0x606f52,null));};exports[_0x29e1('0x34')]=function(_0x236be0,_0x367e17){return db[_0x29e1('0x40')][_0x29e1('0x5a')]({'where':{'id':_0x236be0[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x367e17,null))[_0x29e1('0x1f')](function(_0x336dcc){if(_0x336dcc&&_0x336dcc[_0x29e1('0x76')]){throw new db[(_0x29e1('0x1e'))]['ValidationError'](_0x29e1('0xb9'));}return _0x336dcc;})['then'](removeEntity(_0x367e17,null))['catch'](handleError(_0x367e17,null));};exports[_0x29e1('0xba')]=function(_0x40a795,_0x551c98,_0x56f67d){return db[_0x29e1('0x40')][_0x29e1('0x5a')]({'where':{'id':_0x40a795['params']['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x551c98,null))[_0x29e1('0x1f')](function(_0x1455ab){if(_0x1455ab){return _0x1455ab[_0x29e1('0xba')](_0x40a795['body'][_0x29e1('0x68')],_[_0x29e1('0x88')](_0x40a795['body'],[_0x29e1('0x68'),'id'])||{})[_0x29e1('0xbb')](function(_0x4b7844){for(var _0x171778=0x0;_0x171778<_0x40a795['body']['ids'][_0x29e1('0x4b')];_0x171778+=0x1){socket['emit'](_0x29e1('0xbc'),{'UserId':_0x40a795[_0x29e1('0x5b')]['ids'][_0x171778],'MailAccountId':_0x40a795[_0x29e1('0x5c')]['id']});}return _0x4b7844;});}})[_0x29e1('0x1f')](respondWithResult(_0x551c98,null))['catch'](handleError(_0x551c98,null));};exports[_0x29e1('0xbd')]=function(_0x208640,_0x41389f,_0x33b47a){return db['MailAccount'][_0x29e1('0x5a')]({'where':{'id':_0x208640[_0x29e1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x41389f,null))['then'](function(_0x2a98e7){if(_0x2a98e7){return _0x2a98e7[_0x29e1('0xbd')](_0x208640[_0x29e1('0x45')][_0x29e1('0x68')])[_0x29e1('0x1f')](function(){if(_[_0x29e1('0xbe')](_0x208640[_0x29e1('0x45')][_0x29e1('0x68')])){for(var _0x3892b3=0x0;_0x3892b3<_0x208640['query'][_0x29e1('0x68')][_0x29e1('0x4b')];_0x3892b3+=0x1){socket[_0x29e1('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x208640[_0x29e1('0x45')][_0x29e1('0x68')][_0x3892b3]),'MailAccountId':Number(_0x208640[_0x29e1('0x5c')]['id'])});}}else{socket[_0x29e1('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x208640[_0x29e1('0x45')][_0x29e1('0x68')]),'MailAccountId':Number(_0x208640['params']['id'])});}});}})[_0x29e1('0x1f')](respondWithStatusCode(_0x41389f,null))['catch'](handleError(_0x41389f,null));};exports['getAgents']=function(_0x4f745c,_0x1db7cc,_0x4371cf){var _0xbe3e7d={};var _0x32a0d9={};var _0x176405;var _0x26b005;return db[_0x29e1('0x40')][_0x29e1('0x63')]({'where':{'id':_0x4f745c[_0x29e1('0x5c')]['id']}})[_0x29e1('0x1f')](handleEntityNotFound(_0x1db7cc,null))[_0x29e1('0x1f')](function(_0x205712){if(_0x205712){_0x176405=_0x205712;_0x32a0d9[_0x29e1('0x44')]=_['keys'](db[_0x29e1('0xc0')]['rawAttributes']);_0x32a0d9[_0x29e1('0x45')]=_['keys'](_0x4f745c[_0x29e1('0x45')]);_0x32a0d9[_0x29e1('0x47')]=_['intersection'](_0x32a0d9['model'],_0x32a0d9['query']);_0xbe3e7d[_0x29e1('0x49')]=_[_0x29e1('0x48')](_0x32a0d9[_0x29e1('0x44')],qs['fields'](_0x4f745c[_0x29e1('0x45')][_0x29e1('0x4a')]));_0xbe3e7d[_0x29e1('0x49')]=_0xbe3e7d[_0x29e1('0x49')]['length']?_0xbe3e7d['attributes']:_0x32a0d9[_0x29e1('0x44')];_0xbe3e7d[_0x29e1('0x4e')]=qs[_0x29e1('0x4f')](_0x4f745c[_0x29e1('0x45')][_0x29e1('0x4f')]);_0xbe3e7d[_0x29e1('0x50')]=qs[_0x29e1('0x47')](_[_0x29e1('0x51')](_0x4f745c[_0x29e1('0x45')],_0x32a0d9[_0x29e1('0x47')]));if(_0x4f745c[_0x29e1('0x45')]['filter']){_0xbe3e7d['where']=_[_0x29e1('0x58')](_0xbe3e7d[_0x29e1('0x50')],{'$or':_['map'](_0xbe3e7d[_0x29e1('0x49')],function(_0x3a3dea){var _0x39560f={};_0x39560f[_0x3a3dea]={'$like':'%'+_0x4f745c['query'][_0x29e1('0x64')]+'%'};return _0x39560f;})});}_0xbe3e7d=_[_0x29e1('0x58')]({},_0xbe3e7d,_0x4f745c[_0x29e1('0x59')]);return _0x176405[_0x29e1('0xc1')](_0xbe3e7d);}})[_0x29e1('0x1f')](function(_0x3b6edd){if(_0x3b6edd){_0x26b005=_0x3b6edd[_0x29e1('0x4b')];if(!_0x4f745c[_0x29e1('0x45')][_0x29e1('0x4c')](_0x29e1('0x4d'))){_0xbe3e7d['limit']=qs[_0x29e1('0x2e')](_0x4f745c[_0x29e1('0x45')][_0x29e1('0x2e')]);_0xbe3e7d[_0x29e1('0x2d')]=qs[_0x29e1('0x2d')](_0x4f745c[_0x29e1('0x45')][_0x29e1('0x2d')]);}return _0x176405[_0x29e1('0xc1')](_0xbe3e7d);}})[_0x29e1('0x1f')](function(_0x4d5f18){if(_0x4d5f18){return _0x4d5f18?{'count':_0x26b005,'rows':_0x4d5f18}:null;}})[_0x29e1('0x1f')](respondWithResult(_0x1db7cc,null))[_0x29e1('0x29')](handleError(_0x1db7cc,null));}; \ No newline at end of file +var _0xc422=['findOne','nolimit','merge','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','includeAll','rows','email','ListId','isNil','active','user','cuser','host','port','cservice','password','cpassword','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','MailMessage','split','format','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','basename','service','auth','pass','secure','sendMail','defaults','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','authentication','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','offset','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','count','include','MailAccount','show','Pause','keys','options','find','body','describe','params','MailAccountId','Disposition','create','getDispositions'];(function(_0x123601,_0x24c858){var _0x12db70=function(_0x31abf8){while(--_0x31abf8){_0x123601['push'](_0x123601['shift']());}};_0x12db70(++_0x24c858);}(_0xc422,0x1cf));var _0x2c42=function(_0x4aa12b,_0x5dc8c9){_0x4aa12b=_0x4aa12b-0x0;var _0xccf4ec=_0xc422[_0x4aa12b];return _0xccf4ec;};'use strict';var pdf=require(_0x2c42('0x0'));var emlformat=require(_0x2c42('0x1'));var rimraf=require(_0x2c42('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c42('0x3'));var moment=require(_0x2c42('0x4'));var BPromise=require(_0x2c42('0x5'));var Mustache=require('mustache');var util=require(_0x2c42('0x6'));var path=require(_0x2c42('0x7'));var sox=require('sox');var csv=require(_0x2c42('0x8'));var ejs=require(_0x2c42('0x9'));var fs=require('fs');var _=require(_0x2c42('0xa'));var squel=require(_0x2c42('0xb'));var crypto=require('crypto');var jsforce=require(_0x2c42('0xc'));var deskjs=require(_0x2c42('0xd'));var toCsv=require(_0x2c42('0x8'));var querystring=require(_0x2c42('0xe'));var Papa=require('papaparse');var Redis=require(_0x2c42('0xf'));var authService=require(_0x2c42('0x10'));var qs=require(_0x2c42('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c42('0x12'));var logger=require(_0x2c42('0x13'))('api');var utils=require(_0x2c42('0x14'));var config=require(_0x2c42('0x15'));var db=require('../../mysqldb')['db'];config[_0x2c42('0x16')]=_['defaults'](config[_0x2c42('0x16')],{'host':_0x2c42('0x17'),'port':0x18eb});var socket=require(_0x2c42('0x18'))(new Redis(config[_0x2c42('0x16')]));require(_0x2c42('0x19'))[_0x2c42('0x1a')](socket);var jayson=require(_0x2c42('0x1b'));var client=jayson['client'][_0x2c42('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x4c050d,_0x42562e,_0x483034){if(_0x483034){var _0x303153=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x303153[_0x2c42('0x1d')](_0x42562e)){return _0x4c050d;}else{throw new db['Sequelize'][(_0x2c42('0x1e'))](_0x2c42('0x1f'));}}else{return _0x4c050d;}}function respondWithRpcPromise(_0x2bfce7,_0xf50f32,_0x59a9dd,_0x4e9f88){return new BPromise(function(_0x510139,_0x26731a){var _0x52128c=_0x4e9f88||client;return _0x52128c['request'](_0x2bfce7,_0x59a9dd)[_0x2c42('0x20')](function(_0x51e135){logger[_0x2c42('0x21')](_0x2c42('0x22'),_0xf50f32,_0x2c42('0x23'));logger[_0x2c42('0x24')](_0x2c42('0x25'),_0xf50f32,_0x2c42('0x23'),JSON[_0x2c42('0x26')](_0x51e135));if(_0x51e135[_0x2c42('0x27')]){if(_0x51e135[_0x2c42('0x27')][_0x2c42('0x28')]===0x1f4){logger[_0x2c42('0x27')](_0x2c42('0x22'),_0xf50f32,_0x51e135[_0x2c42('0x27')][_0x2c42('0x29')]);return _0x26731a(_0x51e135['error'][_0x2c42('0x29')]);}logger[_0x2c42('0x27')]('MailAccount,\x20%s,\x20%s',_0xf50f32,_0x51e135[_0x2c42('0x27')][_0x2c42('0x29')]);return _0x510139(_0x51e135[_0x2c42('0x27')]['message']);}else{logger[_0x2c42('0x21')](_0x2c42('0x22'),_0xf50f32,'request\x20sent');_0x510139(_0x51e135[_0x2c42('0x2a')][_0x2c42('0x29')]);}})[_0x2c42('0x2b')](function(_0x3b1d07){logger[_0x2c42('0x27')]('MailAccount,\x20%s,\x20%s',_0xf50f32,_0x3b1d07);_0x26731a(_0x3b1d07);});});}function respondWithStatusCode(_0x4ad5dc,_0x20c33c){_0x20c33c=_0x20c33c||0xcc;return function(_0x159c84){if(_0x159c84){return _0x4ad5dc['sendStatus'](_0x20c33c);}return _0x4ad5dc['status'](_0x20c33c)[_0x2c42('0x2c')]();};}function respondWithResult(_0x546cde,_0x120ba0){_0x120ba0=_0x120ba0||0xc8;return function(_0x4b0693){if(_0x4b0693){return _0x546cde[_0x2c42('0x2d')](_0x120ba0)['json'](_0x4b0693);}};}function respondWithFilteredResult(_0x123279,_0x56749d){return function(_0x66a739){if(_0x66a739){var _0x4fa282=_0x66a739['count'],_0x1ac21f=_0x56749d[_0x2c42('0x2e')],_0x281c7b=_0x56749d[_0x2c42('0x2e')]+_0x56749d[_0x2c42('0x2f')],_0x319980;if(_0x281c7b>=_0x4fa282){_0x281c7b=_0x4fa282;_0x319980=0xc8;}else{_0x319980=0xce;}_0x123279[_0x2c42('0x2d')](_0x319980);return _0x123279['set'](_0x2c42('0x30'),_0x1ac21f+'-'+_0x281c7b+'/'+_0x4fa282)['json'](_0x66a739);}return null;};}function patchUpdates(_0x10cd11){return function(_0x2be652){try{jsonpatch[_0x2c42('0x31')](_0x2be652,_0x10cd11,!![]);}catch(_0x18e88f){return BPromise['reject'](_0x18e88f);}return _0x2be652[_0x2c42('0x32')]();};}function saveUpdates(_0x29b46c,_0x3fc98c){return function(_0x5cb7fc){if(_0x5cb7fc){return _0x5cb7fc[_0x2c42('0x33')](_0x29b46c)[_0x2c42('0x20')](function(_0x466286){return _0x466286;});}return null;};}function removeEntity(_0x34ae2d,_0x5970e1){return function(_0x1f4e6b){if(_0x1f4e6b){return _0x1f4e6b[_0x2c42('0x34')]()[_0x2c42('0x20')](function(){var _0x2f3b09=_0x1f4e6b[_0x2c42('0x35')]({'plain':!![]});var _0xc5d854='MailAccounts';return db[_0x2c42('0x36')][_0x2c42('0x34')]({'where':{'type':_0xc5d854,'resourceId':_0x2f3b09['id']}})['then'](function(){return _0x1f4e6b;});})[_0x2c42('0x20')](function(){_0x34ae2d[_0x2c42('0x2d')](0xcc)[_0x2c42('0x2c')]();});}};}function handleEntityNotFound(_0x3321ec,_0x1f337e){return function(_0x10761b){if(!_0x10761b){_0x3321ec[_0x2c42('0x37')](0x194);}return _0x10761b;};}function handleError(_0x11bcd8,_0x271e9b){_0x271e9b=_0x271e9b||0x1f4;return function(_0x93a38a){logger[_0x2c42('0x27')](_0x93a38a[_0x2c42('0x38')]);if(_0x93a38a[_0x2c42('0x39')]){delete _0x93a38a[_0x2c42('0x39')];}_0x11bcd8[_0x2c42('0x2d')](_0x271e9b)['send'](_0x93a38a);};}exports[_0x2c42('0x3a')]=function(_0x16ce75,_0x3bdbea){var _0x24be4f={'include':[{'model':db[_0x2c42('0x3b')],'as':_0x2c42('0x3c')},{'model':db[_0x2c42('0x3d')],'as':_0x2c42('0x3e')},{'model':db['Pause'],'as':_0x2c42('0x3f')}]},_0x4cee71={},_0x20edab={'count':0x0,'rows':[]};var _0x33665d=_[_0x2c42('0x40')](db['MailAccount'][_0x2c42('0x41')],function(_0x41a2f1){return{'name':_0x41a2f1[_0x2c42('0x42')],'type':_0x41a2f1['type'][_0x2c42('0x43')]};});_0x4cee71[_0x2c42('0x44')]=_[_0x2c42('0x40')](_0x33665d,_0x2c42('0x39'));_0x4cee71[_0x2c42('0x45')]=_['keys'](_0x16ce75[_0x2c42('0x45')]);_0x4cee71[_0x2c42('0x46')]=_['intersection'](_0x4cee71['model'],_0x4cee71[_0x2c42('0x45')]);_0x24be4f[_0x2c42('0x47')]=_[_0x2c42('0x48')](_0x4cee71[_0x2c42('0x44')],qs[_0x2c42('0x49')](_0x16ce75[_0x2c42('0x45')][_0x2c42('0x49')]));_0x24be4f[_0x2c42('0x47')]=_0x24be4f[_0x2c42('0x47')][_0x2c42('0x4a')]?_0x24be4f[_0x2c42('0x47')]:_0x4cee71['model'];if(!_0x16ce75[_0x2c42('0x45')][_0x2c42('0x4b')]('nolimit')){_0x24be4f[_0x2c42('0x2f')]=qs[_0x2c42('0x2f')](_0x16ce75[_0x2c42('0x45')][_0x2c42('0x2f')]);_0x24be4f[_0x2c42('0x2e')]=qs[_0x2c42('0x2e')](_0x16ce75[_0x2c42('0x45')][_0x2c42('0x2e')]);}_0x24be4f[_0x2c42('0x4c')]=qs[_0x2c42('0x4d')](_0x16ce75[_0x2c42('0x45')][_0x2c42('0x4d')]);_0x24be4f[_0x2c42('0x4e')]=qs[_0x2c42('0x46')](_[_0x2c42('0x4f')](_0x16ce75[_0x2c42('0x45')],_0x4cee71[_0x2c42('0x46')]),_0x33665d);if(_0x16ce75[_0x2c42('0x45')]['filter']){_0x24be4f[_0x2c42('0x4e')]=_['merge'](_0x24be4f[_0x2c42('0x4e')],{'$or':_[_0x2c42('0x40')](_0x33665d,function(_0x1eb6ff){if(_0x1eb6ff[_0x2c42('0x50')]!==_0x2c42('0x51')){var _0x19c3c2={};_0x19c3c2[_0x1eb6ff[_0x2c42('0x39')]]={'$like':'%'+_0x16ce75['query'][_0x2c42('0x52')]+'%'};return _0x19c3c2;}})});}_0x24be4f=_['merge']({},_0x24be4f,_0x16ce75['options']);var _0x5b372f={'where':_0x24be4f['where']};return db['MailAccount']['count'](_0x5b372f)['then'](function(_0x5f4ded){_0x20edab[_0x2c42('0x53')]=_0x5f4ded;if(_0x16ce75[_0x2c42('0x45')]['includeAll']){_0x24be4f[_0x2c42('0x54')]=[{'all':!![]}];}return db[_0x2c42('0x55')]['findAll'](_0x24be4f);})[_0x2c42('0x20')](function(_0x2df978){_0x20edab['rows']=_0x2df978;return _0x20edab;})[_0x2c42('0x20')](respondWithFilteredResult(_0x3bdbea,_0x24be4f))[_0x2c42('0x2b')](handleError(_0x3bdbea,null));};exports[_0x2c42('0x56')]=function(_0x23fee9,_0x8f1561){var _0x56dcef={'raw':![],'where':{'id':_0x23fee9['params']['id']},'include':[{'model':db[_0x2c42('0x3b')],'as':_0x2c42('0x3c')},{'model':db[_0x2c42('0x3d')],'as':_0x2c42('0x3e')},{'model':db[_0x2c42('0x57')],'as':_0x2c42('0x3f')}]},_0x4edb4e={};_0x4edb4e[_0x2c42('0x44')]=_[_0x2c42('0x58')](db[_0x2c42('0x55')][_0x2c42('0x41')]);_0x4edb4e[_0x2c42('0x45')]=_[_0x2c42('0x58')](_0x23fee9[_0x2c42('0x45')]);_0x4edb4e[_0x2c42('0x46')]=_[_0x2c42('0x48')](_0x4edb4e[_0x2c42('0x44')],_0x4edb4e[_0x2c42('0x45')]);_0x56dcef[_0x2c42('0x47')]=_[_0x2c42('0x48')](_0x4edb4e[_0x2c42('0x44')],qs[_0x2c42('0x49')](_0x23fee9['query'][_0x2c42('0x49')]));_0x56dcef[_0x2c42('0x47')]=_0x56dcef[_0x2c42('0x47')][_0x2c42('0x4a')]?_0x56dcef['attributes']:_0x4edb4e[_0x2c42('0x44')];if(_0x23fee9[_0x2c42('0x45')]['includeAll']){_0x56dcef['include']=[{'all':!![]}];}_0x56dcef=_['merge']({},_0x56dcef,_0x23fee9[_0x2c42('0x59')]);return db[_0x2c42('0x55')][_0x2c42('0x5a')](_0x56dcef)[_0x2c42('0x20')](handleEntityNotFound(_0x8f1561,null))[_0x2c42('0x20')](respondWithResult(_0x8f1561,null))[_0x2c42('0x2b')](handleError(_0x8f1561,null));};exports[_0x2c42('0x33')]=function(_0x100291,_0x46558b){if(_0x100291['body']['id']){delete _0x100291[_0x2c42('0x5b')]['id'];}return db['MailAccount'][_0x2c42('0x5a')]({'where':{'id':_0x100291['params']['id']},'include':[{'model':db[_0x2c42('0x3b')],'as':_0x2c42('0x3c')},{'model':db[_0x2c42('0x3d')],'as':_0x2c42('0x3e')},{'model':db[_0x2c42('0x57')],'as':_0x2c42('0x3f')}]})[_0x2c42('0x20')](handleEntityNotFound(_0x46558b,null))[_0x2c42('0x20')](saveUpdates(_0x100291[_0x2c42('0x5b')],null))[_0x2c42('0x20')](function(_0x184931){if(_0x184931&&_0x100291['body']['Imap']){return db[_0x2c42('0x3b')]['update'](_0x100291[_0x2c42('0x5b')][_0x2c42('0x3c')],{'where':{'MailAccountId':_0x184931['id']}})[_0x2c42('0x20')](function(){return _0x184931;});}return _0x184931;})[_0x2c42('0x20')](function(_0x8ff983){if(_0x8ff983&&_0x100291[_0x2c42('0x5b')]['Smtp']){return db[_0x2c42('0x3d')][_0x2c42('0x33')](_0x100291['body'][_0x2c42('0x3e')],{'where':{'MailAccountId':_0x8ff983['id']}})[_0x2c42('0x20')](function(){return _0x8ff983;});}return _0x8ff983;})[_0x2c42('0x20')](respondWithResult(_0x46558b,null))[_0x2c42('0x2b')](handleError(_0x46558b,null));};exports[_0x2c42('0x5c')]=function(_0x54f164,_0x2dbc3d){return db[_0x2c42('0x55')]['describe']()[_0x2c42('0x20')](respondWithResult(_0x2dbc3d,null))[_0x2c42('0x2b')](handleError(_0x2dbc3d,null));};exports['addDisposition']=function(_0x56916e,_0x4dd41c,_0x4f6301){if(_0x56916e[_0x2c42('0x5b')]['id']){delete _0x56916e[_0x2c42('0x5b')]['id'];}return db['MailAccount'][_0x2c42('0x5a')]({'where':{'id':_0x56916e[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x4dd41c,null))[_0x2c42('0x20')](function(_0x3c2f6f){if(_0x3c2f6f){_0x56916e[_0x2c42('0x5b')][_0x2c42('0x5e')]=_0x3c2f6f['id'];return db[_0x2c42('0x5f')][_0x2c42('0x60')](_0x56916e[_0x2c42('0x5b')]);}})[_0x2c42('0x20')](respondWithResult(_0x4dd41c,null))[_0x2c42('0x2b')](handleError(_0x4dd41c,null));};exports[_0x2c42('0x61')]=function(_0x1f72f0,_0x1112ee,_0x27b2e1){var _0x37b91e={'raw':![],'where':{}};var _0x11bff0={};var _0x22fc18={'count':0x0,'rows':[]};return db[_0x2c42('0x55')][_0x2c42('0x62')]({'where':{'id':_0x1f72f0[_0x2c42('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1112ee,null))[_0x2c42('0x20')](function(_0x3b106e){if(_0x3b106e){_0x11bff0[_0x2c42('0x44')]=_[_0x2c42('0x58')](db['Disposition'][_0x2c42('0x41')]);_0x11bff0['query']=_[_0x2c42('0x58')](_0x1f72f0[_0x2c42('0x45')]);_0x11bff0['filters']=_[_0x2c42('0x48')](_0x11bff0[_0x2c42('0x44')],_0x11bff0[_0x2c42('0x45')]);_0x37b91e[_0x2c42('0x47')]=_[_0x2c42('0x48')](_0x11bff0[_0x2c42('0x44')],qs[_0x2c42('0x49')](_0x1f72f0[_0x2c42('0x45')][_0x2c42('0x49')]));_0x37b91e[_0x2c42('0x47')]=_0x37b91e[_0x2c42('0x47')][_0x2c42('0x4a')]?_0x37b91e['attributes']:_0x11bff0[_0x2c42('0x44')];if(!_0x1f72f0['query']['hasOwnProperty'](_0x2c42('0x63'))){_0x37b91e[_0x2c42('0x2f')]=qs['limit'](_0x1f72f0[_0x2c42('0x45')][_0x2c42('0x2f')]);_0x37b91e[_0x2c42('0x2e')]=qs[_0x2c42('0x2e')](_0x1f72f0[_0x2c42('0x45')][_0x2c42('0x2e')]);}_0x37b91e[_0x2c42('0x4c')]=qs[_0x2c42('0x4d')](_0x1f72f0[_0x2c42('0x45')][_0x2c42('0x4d')]);_0x37b91e[_0x2c42('0x4e')]=qs[_0x2c42('0x46')](_[_0x2c42('0x4f')](_0x1f72f0['query'],_0x11bff0[_0x2c42('0x46')]));_0x37b91e[_0x2c42('0x4e')]['MailAccountId']=_0x3b106e['id'];if(_0x1f72f0[_0x2c42('0x45')]['filter']){_0x37b91e[_0x2c42('0x4e')]=_[_0x2c42('0x64')](_0x37b91e['where'],{'$or':_[_0x2c42('0x40')](_0x37b91e['attributes'],function(_0x482c50){var _0x4d035c={};_0x4d035c[_0x482c50]={'$like':'%'+_0x1f72f0[_0x2c42('0x45')][_0x2c42('0x52')]+'%'};return _0x4d035c;})});}_0x37b91e=_['merge']({},_0x37b91e,_0x1f72f0[_0x2c42('0x59')]);return db['Disposition'][_0x2c42('0x53')]({'where':_0x37b91e[_0x2c42('0x4e')]})[_0x2c42('0x20')](function(_0x3b2058){_0x22fc18['count']=_0x3b2058;if(_0x1f72f0['query']['includeAll']){_0x37b91e[_0x2c42('0x54')]=[{'all':!![]}];}return db[_0x2c42('0x5f')][_0x2c42('0x65')](_0x37b91e);})[_0x2c42('0x20')](function(_0x6666a4){_0x22fc18['rows']=_0x6666a4;return _0x22fc18;});}})[_0x2c42('0x20')](respondWithFilteredResult(_0x1112ee,_0x37b91e))[_0x2c42('0x2b')](handleError(_0x1112ee,null));};exports[_0x2c42('0x66')]=function(_0x3a491a,_0x4764e0,_0x5cd76f){return db[_0x2c42('0x55')][_0x2c42('0x5a')]({'where':{'id':_0x3a491a['params']['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x4764e0,null))[_0x2c42('0x20')](function(_0x34e79c){if(_0x34e79c){return _0x34e79c[_0x2c42('0x66')](_0x3a491a[_0x2c42('0x45')][_0x2c42('0x67')]);}})[_0x2c42('0x20')](respondWithStatusCode(_0x4764e0,null))['catch'](handleError(_0x4764e0,null));};exports[_0x2c42('0x68')]=function(_0x21366a,_0x357552,_0x40d69a){if(_0x21366a[_0x2c42('0x5b')]['id']){delete _0x21366a[_0x2c42('0x5b')]['id'];}return db[_0x2c42('0x55')]['find']({'where':{'id':_0x21366a[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x357552,null))[_0x2c42('0x20')](function(_0x31c8e9){if(_0x31c8e9){_0x21366a[_0x2c42('0x5b')][_0x2c42('0x5e')]=_0x31c8e9['id'];return db[_0x2c42('0x69')][_0x2c42('0x60')](_0x21366a[_0x2c42('0x5b')]);}})[_0x2c42('0x20')](respondWithResult(_0x357552,null))[_0x2c42('0x2b')](handleError(_0x357552,null));};exports[_0x2c42('0x6a')]=function(_0x551893,_0x3fc257,_0x244c97){var _0x2482fa={'raw':![],'where':{}};var _0x434738={};var _0x312c19={'count':0x0,'rows':[]};return db[_0x2c42('0x55')][_0x2c42('0x62')]({'where':{'id':_0x551893['params']['id']}})['then'](handleEntityNotFound(_0x3fc257,null))[_0x2c42('0x20')](function(_0x1339ac){if(_0x1339ac){_0x434738['model']=_[_0x2c42('0x58')](db[_0x2c42('0x69')][_0x2c42('0x41')]);_0x434738['query']=_[_0x2c42('0x58')](_0x551893[_0x2c42('0x45')]);_0x434738[_0x2c42('0x46')]=_[_0x2c42('0x48')](_0x434738[_0x2c42('0x44')],_0x434738[_0x2c42('0x45')]);_0x2482fa[_0x2c42('0x47')]=_[_0x2c42('0x48')](_0x434738[_0x2c42('0x44')],qs[_0x2c42('0x49')](_0x551893[_0x2c42('0x45')]['fields']));_0x2482fa[_0x2c42('0x47')]=_0x2482fa[_0x2c42('0x47')][_0x2c42('0x4a')]?_0x2482fa[_0x2c42('0x47')]:_0x434738[_0x2c42('0x44')];if(!_0x551893['query'][_0x2c42('0x4b')](_0x2c42('0x63'))){_0x2482fa[_0x2c42('0x2f')]=qs[_0x2c42('0x2f')](_0x551893[_0x2c42('0x45')][_0x2c42('0x2f')]);_0x2482fa[_0x2c42('0x2e')]=qs[_0x2c42('0x2e')](_0x551893[_0x2c42('0x45')]['offset']);}_0x2482fa[_0x2c42('0x4c')]=qs[_0x2c42('0x4d')](_0x551893[_0x2c42('0x45')][_0x2c42('0x4d')]);_0x2482fa['where']=qs[_0x2c42('0x46')](_['pick'](_0x551893[_0x2c42('0x45')],_0x434738['filters']));_0x2482fa['where'][_0x2c42('0x5e')]=_0x1339ac['id'];if(_0x551893[_0x2c42('0x45')][_0x2c42('0x52')]){_0x2482fa[_0x2c42('0x4e')]=_['merge'](_0x2482fa[_0x2c42('0x4e')],{'$or':_[_0x2c42('0x40')](_0x2482fa[_0x2c42('0x47')],function(_0x1c8cb8){var _0x4c175b={};_0x4c175b[_0x1c8cb8]={'$like':'%'+_0x551893[_0x2c42('0x45')][_0x2c42('0x52')]+'%'};return _0x4c175b;})});}_0x2482fa=_[_0x2c42('0x64')]({},_0x2482fa,_0x551893[_0x2c42('0x59')]);return db[_0x2c42('0x69')][_0x2c42('0x53')]({'where':_0x2482fa[_0x2c42('0x4e')]})['then'](function(_0x539f22){_0x312c19[_0x2c42('0x53')]=_0x539f22;if(_0x551893[_0x2c42('0x45')][_0x2c42('0x6b')]){_0x2482fa[_0x2c42('0x54')]=[{'all':!![]}];}return db[_0x2c42('0x69')][_0x2c42('0x65')](_0x2482fa);})[_0x2c42('0x20')](function(_0x514288){_0x312c19[_0x2c42('0x6c')]=_0x514288;return _0x312c19;});}})['then'](respondWithFilteredResult(_0x3fc257,_0x2482fa))[_0x2c42('0x2b')](handleError(_0x3fc257,null));};exports['removeAnswers']=function(_0x43c0f5,_0x4fa797,_0x2143e7){return db[_0x2c42('0x55')][_0x2c42('0x5a')]({'where':{'id':_0x43c0f5[_0x2c42('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4fa797,null))[_0x2c42('0x20')](function(_0x17d8fc){if(_0x17d8fc){return _0x17d8fc['removeAnswers'](_0x43c0f5['query'][_0x2c42('0x67')]);}})[_0x2c42('0x20')](respondWithStatusCode(_0x4fa797,null))[_0x2c42('0x2b')](handleError(_0x4fa797,null));};exports['create']=function(_0x1641bc,_0x59e0bb){var _0x24f9b2={'name':_0x1641bc[_0x2c42('0x5b')][_0x2c42('0x39')],'key':_0x1641bc[_0x2c42('0x5b')][_0x2c42('0x43')],'email':_0x1641bc[_0x2c42('0x5b')][_0x2c42('0x6d')],'ListId':_0x1641bc['body'][_0x2c42('0x6e')],'active':!_[_0x2c42('0x6f')](_0x1641bc[_0x2c42('0x5b')][_0x2c42('0x70')])?_0x1641bc[_0x2c42('0x5b')][_0x2c42('0x70')]:!![],'description':_0x1641bc['body']['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x1641bc['body']['cservice'])){if(_0x1641bc[_0x2c42('0x5b')]['cauthentication']){_0x24f9b2[_0x2c42('0x3c')][_0x2c42('0x71')]=_0x24f9b2[_0x2c42('0x3e')][_0x2c42('0x71')]=_0x1641bc['body'][_0x2c42('0x72')];_0x24f9b2[_0x2c42('0x3c')]['password']=_0x24f9b2[_0x2c42('0x3e')]['pass']=_0x1641bc[_0x2c42('0x5b')]['cpassword'];}else{_0x24f9b2[_0x2c42('0x3c')]['authentication']=_0x24f9b2['Smtp']['authentication']=![];}_0x24f9b2['Imap'][_0x2c42('0x73')]=_0x1641bc[_0x2c42('0x5b')][_0x2c42('0x3c')][_0x2c42('0x73')];_0x24f9b2['Imap']['port']=_0x1641bc['body'][_0x2c42('0x3c')]['port'];_0x24f9b2[_0x2c42('0x3e')]['host']=_0x1641bc['body'][_0x2c42('0x3e')][_0x2c42('0x73')];_0x24f9b2[_0x2c42('0x3e')]['port']=_0x1641bc[_0x2c42('0x5b')]['Smtp'][_0x2c42('0x74')];}else{_0x24f9b2[_0x2c42('0x3c')]['service']=_0x24f9b2[_0x2c42('0x3e')]['service']=_0x1641bc['body'][_0x2c42('0x75')];_0x24f9b2['Imap'][_0x2c42('0x71')]=_0x24f9b2[_0x2c42('0x3e')][_0x2c42('0x71')]=_0x1641bc[_0x2c42('0x5b')][_0x2c42('0x72')];_0x24f9b2[_0x2c42('0x3c')][_0x2c42('0x76')]=_0x24f9b2[_0x2c42('0x3e')]['pass']=_0x1641bc['body'][_0x2c42('0x77')];}return db['MailAccount'][_0x2c42('0x60')](_0x24f9b2,{'include':[{'model':db[_0x2c42('0x3d')],'as':_0x2c42('0x3e')},{'model':db[_0x2c42('0x3b')],'as':'Imap'}]})[_0x2c42('0x20')](function(_0x48c5fd){var _0x2615fb=_0x1641bc[_0x2c42('0x71')]['get']({'plain':!![]});if(!_0x2615fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2615fb[_0x2c42('0x78')]===_0x2c42('0x71')){var _0x2db5bb=_0x48c5fd[_0x2c42('0x35')]({'plain':!![]});return db[_0x2c42('0x79')][_0x2c42('0x5a')]({'where':{'name':_0x2c42('0x7a'),'userProfileId':_0x2615fb[_0x2c42('0x7b')]},'raw':!![]})[_0x2c42('0x20')](function(_0x295734){if(_0x295734&&_0x295734[_0x2c42('0x7c')]===0x0){return db[_0x2c42('0x36')][_0x2c42('0x60')]({'name':_0x2db5bb[_0x2c42('0x39')],'resourceId':_0x2db5bb['id'],'type':_0x295734[_0x2c42('0x39')],'sectionId':_0x295734['id']},{})[_0x2c42('0x20')](function(){return _0x48c5fd;});}else{return _0x48c5fd;}})['catch'](function(_0x4eb8ab){logger['error'](_0x2c42('0x7d'),_0x4eb8ab);throw _0x4eb8ab;});}return _0x48c5fd;})['then'](respondWithResult(_0x59e0bb,0xc9))[_0x2c42('0x2b')](handleError(_0x59e0bb,null));};exports[_0x2c42('0x7e')]=function(_0x1f81da,_0x239a94,_0x1cc65e){return db[_0x2c42('0x55')][_0x2c42('0x62')]({'where':{'id':_0x1f81da['params']['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x239a94,null))[_0x2c42('0x20')](function(_0xd0f084){if(_0xd0f084){return _0xd0f084['getImap']();}return null;})['then'](respondWithResult(_0x239a94,null))[_0x2c42('0x2b')](handleError(_0x239a94,null));};exports['addImap']=function(_0x59acfa,_0xd02b7e,_0x154e28){if(_0x59acfa['body']['id']){delete _0x59acfa[_0x2c42('0x5b')]['id'];}return db[_0x2c42('0x55')][_0x2c42('0x5a')]({'where':{'id':_0x59acfa[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0xd02b7e,null))[_0x2c42('0x20')](function(_0x203b39){if(_0x203b39){_0x59acfa[_0x2c42('0x5b')]['MailAccountId']=_0x203b39['id'];return db[_0x2c42('0x3b')][_0x2c42('0x60')](_0x59acfa[_0x2c42('0x5b')]);}})['then'](respondWithResult(_0xd02b7e,null))['catch'](handleError(_0xd02b7e,null));};exports[_0x2c42('0x7f')]=function(_0xef5c96,_0x127037,_0xe11584){return db['MailAccount'][_0x2c42('0x62')]({'where':{'id':_0xef5c96[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x127037,null))[_0x2c42('0x20')](function(_0x273cae){if(_0x273cae){return _0x273cae['setImap'](null);}return null;})[_0x2c42('0x20')](respondWithStatusCode(_0x127037,null))['catch'](handleError(_0x127037,null));};exports['getSmtp']=function(_0x5d5526,_0x4416b1,_0x3c0da1){return db[_0x2c42('0x55')][_0x2c42('0x62')]({'where':{'id':_0x5d5526['params']['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x4416b1,null))[_0x2c42('0x20')](function(_0x4ebeb0){if(_0x4ebeb0){return _0x4ebeb0['getSmtp']();}return null;})['then'](respondWithResult(_0x4416b1,null))['catch'](handleError(_0x4416b1,null));};exports[_0x2c42('0x80')]=function(_0x550db0,_0x3cd3b8,_0x375cc9){if(_0x550db0[_0x2c42('0x5b')]['id']){delete _0x550db0[_0x2c42('0x5b')]['id'];}return db['MailAccount'][_0x2c42('0x5a')]({'where':{'id':_0x550db0[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x3cd3b8,null))[_0x2c42('0x20')](function(_0x311ffb){if(_0x311ffb){_0x550db0['body'][_0x2c42('0x5e')]=_0x311ffb['id'];return db['MailServerOut'][_0x2c42('0x60')](_0x550db0[_0x2c42('0x5b')]);}})[_0x2c42('0x20')](respondWithResult(_0x3cd3b8,null))[_0x2c42('0x2b')](handleError(_0x3cd3b8,null));};exports[_0x2c42('0x81')]=function(_0x2eb875,_0x2932f5,_0x3a3086){return db[_0x2c42('0x55')][_0x2c42('0x62')]({'where':{'id':_0x2eb875[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x2932f5,null))[_0x2c42('0x20')](function(_0x5d1027){if(_0x5d1027){return _0x5d1027[_0x2c42('0x82')](null);}return null;})[_0x2c42('0x20')](respondWithStatusCode(_0x2932f5,null))[_0x2c42('0x2b')](handleError(_0x2932f5,null));};exports[_0x2c42('0x83')]=function(_0x242cde,_0x54d128,_0x16c0c9){return db[_0x2c42('0x84')][_0x2c42('0x5a')]({'where':{'id':_0x242cde[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x54d128,null))[_0x2c42('0x20')](function(_0x2faebb){if(_0x2faebb){return _0x2faebb[_0x2c42('0x83')](_0x242cde[_0x2c42('0x5b')]['ids'],_[_0x2c42('0x85')](_0x242cde[_0x2c42('0x5b')],['ids','id'])||{});}})[_0x2c42('0x20')](respondWithResult(_0x54d128,null))[_0x2c42('0x2b')](handleError(_0x54d128,null));};exports[_0x2c42('0x86')]=function(_0x4269c1,_0x3b5ffe,_0x2136a7){var _0x1ed2fb={'raw':![],'where':{}};var _0x206cd2={};var _0x1069dd={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4269c1['params']['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x3b5ffe,null))[_0x2c42('0x20')](function(_0x55450a){if(_0x55450a){_0x206cd2[_0x2c42('0x44')]=_[_0x2c42('0x58')](db['MailInteraction'][_0x2c42('0x41')]);_0x206cd2['query']=_[_0x2c42('0x58')](_0x4269c1[_0x2c42('0x45')]);_0x206cd2[_0x2c42('0x46')]=_[_0x2c42('0x48')](_0x206cd2['model'],_0x206cd2[_0x2c42('0x45')]);_0x1ed2fb['attributes']=_['intersection'](_0x206cd2[_0x2c42('0x44')],qs[_0x2c42('0x49')](_0x4269c1[_0x2c42('0x45')][_0x2c42('0x49')]));_0x1ed2fb[_0x2c42('0x47')]=_0x1ed2fb[_0x2c42('0x47')][_0x2c42('0x4a')]?_0x1ed2fb['attributes']:_0x206cd2[_0x2c42('0x44')];if(!_0x4269c1[_0x2c42('0x45')][_0x2c42('0x4b')](_0x2c42('0x63'))){_0x1ed2fb['limit']=qs[_0x2c42('0x2f')](_0x4269c1['query'][_0x2c42('0x2f')]);_0x1ed2fb[_0x2c42('0x2e')]=qs[_0x2c42('0x2e')](_0x4269c1[_0x2c42('0x45')][_0x2c42('0x2e')]);}_0x1ed2fb[_0x2c42('0x4c')]=qs[_0x2c42('0x4d')](_0x4269c1[_0x2c42('0x45')][_0x2c42('0x4d')]);_0x1ed2fb['where']=qs[_0x2c42('0x46')](_[_0x2c42('0x4f')](_0x4269c1[_0x2c42('0x45')],_0x206cd2[_0x2c42('0x46')]));_0x1ed2fb['where'][_0x2c42('0x5e')]=_0x55450a['id'];if(_0x4269c1[_0x2c42('0x45')][_0x2c42('0x52')]){_0x1ed2fb[_0x2c42('0x4e')]=_['merge'](_0x1ed2fb[_0x2c42('0x4e')],{'$or':_['map'](_0x1ed2fb[_0x2c42('0x47')],function(_0x57c537){var _0x1e4977={};_0x1e4977[_0x57c537]={'$like':'%'+_0x4269c1[_0x2c42('0x45')]['filter']+'%'};return _0x1e4977;})});}_0x1ed2fb=_['merge']({},_0x1ed2fb,_0x4269c1[_0x2c42('0x59')]);return db['MailInteraction']['count']({'where':_0x1ed2fb['where']})[_0x2c42('0x20')](function(_0x1fa9dc){_0x1069dd[_0x2c42('0x53')]=_0x1fa9dc;if(_0x4269c1[_0x2c42('0x45')]['includeAll']){_0x1ed2fb[_0x2c42('0x54')]=[{'model':db[_0x2c42('0x87')],'as':_0x2c42('0x88'),'required':![]},{'model':db[_0x2c42('0x89')],'as':_0x2c42('0x8a'),'attributes':[_0x2c42('0x39'),_0x2c42('0x8b'),'internal'],'required':![]},{'model':db[_0x2c42('0x8c')],'as':'Tags','attributes':['id','name',_0x2c42('0x8d')],'where':_0x4269c1[_0x2c42('0x45')]['tag']?{'id':_0x4269c1[_0x2c42('0x45')][_0x2c42('0x8e')]}:undefined,'required':_0x4269c1[_0x2c42('0x45')][_0x2c42('0x8e')]?!![]:![]}];}return db['MailInteraction'][_0x2c42('0x65')](_0x1ed2fb);})[_0x2c42('0x20')](function(_0x195e68){_0x1069dd[_0x2c42('0x6c')]=_0x195e68;return _0x1069dd;});}})['then'](respondWithFilteredResult(_0x3b5ffe,_0x1ed2fb))[_0x2c42('0x2b')](handleError(_0x3b5ffe,null));};exports[_0x2c42('0x8f')]=function(_0x382dfa,_0x1a056b,_0x24a02c){return db[_0x2c42('0x55')][_0x2c42('0x62')]({'where':{'id':_0x382dfa[_0x2c42('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1a056b,null))[_0x2c42('0x20')](function(_0x21a370){if(_0x21a370){return db[_0x2c42('0x90')][_0x2c42('0x91')](function(_0x3d4577){return db['MailApplication'][_0x2c42('0x34')]({'where':{'MailAccountId':_0x382dfa[_0x2c42('0x5d')]['id']},'transaction':_0x3d4577})[_0x2c42('0x20')](function(_0x4f08c9){var _0x23d949=_[_0x2c42('0x40')](_0x382dfa[_0x2c42('0x5b')],function(_0x488462){_0x488462[_0x2c42('0x5e')]=_0x382dfa[_0x2c42('0x5d')]['id'];return _0x488462;});return db[_0x2c42('0x92')]['bulkCreate'](_0x23d949,{'transaction':_0x3d4577});});})['then'](function(){return db[_0x2c42('0x92')][_0x2c42('0x93')]({'where':{'MailAccountId':_0x382dfa[_0x2c42('0x5d')]['id']},'order':_0x2c42('0x94')});});}})['then'](respondWithResult(_0x1a056b,null))[_0x2c42('0x2b')](handleError(_0x1a056b,null));};exports['getApplications']=function(_0x4506d5,_0x5823ed,_0x246f37){var _0x217b99={};var _0x37ed45={};var _0x30fc4d;var _0x1a7e45;return db['MailAccount'][_0x2c42('0x62')]({'where':{'id':_0x4506d5[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x5823ed,null))[_0x2c42('0x20')](function(_0x126aaa){if(_0x126aaa){_0x30fc4d=_0x126aaa;_0x37ed45['model']=_['keys'](db[_0x2c42('0x92')][_0x2c42('0x41')]);_0x37ed45[_0x2c42('0x45')]=_[_0x2c42('0x58')](_0x4506d5[_0x2c42('0x45')]);_0x37ed45[_0x2c42('0x46')]=_[_0x2c42('0x48')](_0x37ed45[_0x2c42('0x44')],_0x37ed45[_0x2c42('0x45')]);_0x217b99[_0x2c42('0x47')]=_[_0x2c42('0x48')](_0x37ed45['model'],qs['fields'](_0x4506d5['query'][_0x2c42('0x49')]));_0x217b99[_0x2c42('0x47')]=_0x217b99[_0x2c42('0x47')]['length']?_0x217b99[_0x2c42('0x47')]:_0x37ed45[_0x2c42('0x44')];_0x217b99[_0x2c42('0x4c')]=qs['sort'](_0x4506d5[_0x2c42('0x45')][_0x2c42('0x4d')]);_0x217b99[_0x2c42('0x4e')]=qs[_0x2c42('0x46')](_[_0x2c42('0x4f')](_0x4506d5['query'],_0x37ed45[_0x2c42('0x46')]));if(_0x4506d5[_0x2c42('0x45')]['filter']){_0x217b99[_0x2c42('0x4e')]=_['merge'](_0x217b99[_0x2c42('0x4e')],{'$or':_[_0x2c42('0x40')](_0x217b99[_0x2c42('0x47')],function(_0x5a5f35){var _0x3fef49={};_0x3fef49[_0x5a5f35]={'$like':'%'+_0x4506d5[_0x2c42('0x45')]['filter']+'%'};return _0x3fef49;})});}_0x217b99=_[_0x2c42('0x64')]({},_0x217b99,_0x4506d5[_0x2c42('0x59')]);return _0x30fc4d[_0x2c42('0x95')](_0x217b99);}})[_0x2c42('0x20')](function(_0x3e8161){if(_0x3e8161){_0x1a7e45=_0x3e8161['length'];if(!_0x4506d5[_0x2c42('0x45')][_0x2c42('0x4b')]('nolimit')){_0x217b99[_0x2c42('0x2f')]=qs[_0x2c42('0x2f')](_0x4506d5[_0x2c42('0x45')][_0x2c42('0x2f')]);_0x217b99[_0x2c42('0x2e')]=qs[_0x2c42('0x2e')](_0x4506d5[_0x2c42('0x45')][_0x2c42('0x2e')]);}return _0x30fc4d['getApplications'](_0x217b99);}})[_0x2c42('0x20')](function(_0x3468e1){if(_0x3468e1){return _0x3468e1?{'count':_0x1a7e45,'rows':_0x3468e1}:null;}})['then'](respondWithResult(_0x5823ed,null))[_0x2c42('0x2b')](handleError(_0x5823ed,null));};exports['getMessages']=function(_0xfa6697,_0x5a14f2,_0x485be8){var _0x19e1ea={'raw':!![],'where':{}};var _0x286dcb={};var _0x1a58c2={'count':0x0,'rows':[]};return db[_0x2c42('0x55')][_0x2c42('0x62')]({'where':{'id':_0xfa6697[_0x2c42('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5a14f2,null))[_0x2c42('0x20')](function(_0x5bf734){if(_0x5bf734){_0x286dcb[_0x2c42('0x44')]=_[_0x2c42('0x58')](db[_0x2c42('0x96')][_0x2c42('0x41')]);_0x286dcb[_0x2c42('0x45')]=_[_0x2c42('0x58')](_0xfa6697[_0x2c42('0x45')]);_0x286dcb[_0x2c42('0x46')]=_[_0x2c42('0x48')](_0x286dcb['model'],_0x286dcb[_0x2c42('0x45')]);_0x19e1ea['attributes']=_['intersection'](_0x286dcb[_0x2c42('0x44')],qs[_0x2c42('0x49')](_0xfa6697[_0x2c42('0x45')][_0x2c42('0x49')]));_0x19e1ea['attributes']=_0x19e1ea[_0x2c42('0x47')][_0x2c42('0x4a')]?_0x19e1ea[_0x2c42('0x47')]:_0x286dcb[_0x2c42('0x44')];if(!_0xfa6697[_0x2c42('0x45')]['hasOwnProperty'](_0x2c42('0x63'))){_0x19e1ea[_0x2c42('0x2f')]=qs[_0x2c42('0x2f')](_0xfa6697[_0x2c42('0x45')][_0x2c42('0x2f')]);_0x19e1ea[_0x2c42('0x2e')]=qs['offset'](_0xfa6697[_0x2c42('0x45')]['offset']);}_0x19e1ea[_0x2c42('0x4c')]=qs[_0x2c42('0x4d')](_0xfa6697['query']['sort']);_0x19e1ea[_0x2c42('0x4e')]=qs[_0x2c42('0x46')](_[_0x2c42('0x4f')](_0xfa6697['query'],_0x286dcb[_0x2c42('0x46')]));_0x19e1ea[_0x2c42('0x4e')][_0x2c42('0x5e')]=_0x5bf734['id'];if(_0xfa6697[_0x2c42('0x45')][_0x2c42('0x52')]){_0x19e1ea[_0x2c42('0x4e')]=_[_0x2c42('0x64')](_0x19e1ea['where'],{'$or':_['map'](_0x19e1ea[_0x2c42('0x47')],function(_0x14e75b){var _0x5611d1={};_0x5611d1[_0x14e75b]={'$like':'%'+_0xfa6697[_0x2c42('0x45')][_0x2c42('0x52')]+'%'};return _0x5611d1;})});}if(_0xfa6697['query']['$gte']){var _0x5b4264=_0xfa6697[_0x2c42('0x45')]['$gte'][_0x2c42('0x97')](',');var _0x5f50bb={};_0x5f50bb[_0x5b4264[0x0]]={'$gte':moment(_0x5b4264[0x1])[_0x2c42('0x98')]('YYYY-MM-DD\x20HH:mm:ss')};_0x19e1ea[_0x2c42('0x4e')]=_['merge'](_0x19e1ea['where'],_0x5f50bb);}_0x19e1ea=_['merge']({},_0x19e1ea,_0xfa6697['options']);return db['MailMessage'][_0x2c42('0x53')]({'where':_0x19e1ea[_0x2c42('0x4e')]})[_0x2c42('0x20')](function(_0x4c81d8){_0x1a58c2[_0x2c42('0x53')]=_0x4c81d8;if(_0xfa6697[_0x2c42('0x45')][_0x2c42('0x6b')]){_0x19e1ea[_0x2c42('0x54')]=[{'all':!![]}];}return db[_0x2c42('0x96')][_0x2c42('0x65')](_0x19e1ea);})[_0x2c42('0x20')](function(_0x58d4c6){_0x1a58c2[_0x2c42('0x6c')]=_0x58d4c6;return _0x1a58c2;});}})['then'](respondWithFilteredResult(_0x5a14f2,_0x19e1ea))['catch'](handleError(_0x5a14f2,null));};exports['send']=function(_0x3cdcc4,_0x2cd3fa,_0x1f15a9){var _0x3ad7c3,_0x11bd7d={},_0x254127;if(_0x3cdcc4['body']['to']){_0x254127=_0x3cdcc4[_0x2c42('0x5b')]['to'][_0x2c42('0x97')](',')[0x0];}return db[_0x2c42('0x55')]['find']({'where':{'id':_0x3cdcc4['params']['id']},'include':[{'model':db[_0x2c42('0x99')],'as':_0x2c42('0x9a'),'include':[{'model':db[_0x2c42('0x87')],'as':_0x2c42('0x9b'),'where':{'email':_0x254127},'limit':0x1,'order':[[_0x2c42('0x9c'),_0x2c42('0x9d')]]}]},{'model':db[_0x2c42('0x3d')],'as':_0x2c42('0x3e'),'raw':!![]}]})[_0x2c42('0x20')](handleEntityNotFound(_0x2cd3fa,null))['then'](function(_0x26c9f0){if(_0x26c9f0){_0x3ad7c3=_0x26c9f0;if(_0x26c9f0[_0x2c42('0x3e')]){if(_[_0x2c42('0x6f')](_0x3cdcc4['body'][_0x2c42('0x9e')])){_0x3cdcc4[_0x2c42('0x5b')][_0x2c42('0x9e')]=util[_0x2c42('0x98')](_0x2c42('0x9f'),_0x26c9f0[_0x2c42('0x39')],_0x26c9f0['email']||_0x26c9f0[_0x2c42('0x3e')]['user']);}if(_0x3cdcc4[_0x2c42('0x5b')][_0x2c42('0xa0')]&&_0x3cdcc4[_0x2c42('0x5b')]['attachments'][_0x2c42('0x4a')]){for(var _0x25d55e=0x0;_0x25d55e<_0x3cdcc4[_0x2c42('0x5b')][_0x2c42('0xa0')][_0x2c42('0x4a')];_0x25d55e+=0x1){_0x3cdcc4[_0x2c42('0x5b')]['attachments'][_0x25d55e]={'filename':_0x3cdcc4['body'][_0x2c42('0xa0')][_0x25d55e][_0x2c42('0x39')],'path':path['join'](config['root'],'server/files/attachments',_0x3cdcc4[_0x2c42('0x5b')][_0x2c42('0xa0')][_0x25d55e][_0x2c42('0xa1')])};}}var _0x33782c={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x26c9f0[_0x2c42('0x3e')][_0x2c42('0xa2')])){if(_0x26c9f0[_0x2c42('0x3e')]['authentication']){_0x33782c[_0x2c42('0xa3')]={'user':_0x26c9f0[_0x2c42('0x3e')][_0x2c42('0x71')],'pass':_0x26c9f0['Smtp'][_0x2c42('0xa4')]};}_0x33782c['host']=_0x26c9f0[_0x2c42('0x3e')][_0x2c42('0x73')];_0x33782c[_0x2c42('0x74')]=_0x26c9f0[_0x2c42('0x3e')][_0x2c42('0x74')];_0x33782c[_0x2c42('0xa5')]=_0x26c9f0[_0x2c42('0x3e')][_0x2c42('0xa5')];}else{_0x33782c[_0x2c42('0xa2')]=_0x26c9f0['Smtp'][_0x2c42('0xa2')];_0x33782c[_0x2c42('0xa3')]={'user':_0x26c9f0[_0x2c42('0x3e')]['user'],'pass':_0x26c9f0[_0x2c42('0x3e')]['pass']};}return respondWithRpcPromise('SendMail',_0x2c42('0xa6'),{'account':_0x33782c,'message':_0x3cdcc4[_0x2c42('0x5b')]});}else{throw new Error('List\x20not\x20found');}}})[_0x2c42('0x20')](function(_0x3ba982){if(_0x3ba982){_0x11bd7d=_0x3ba982;if(_0x3ad7c3['List']){if(_0x3ad7c3[_0x2c42('0x9a')][_0x2c42('0x9b')][_0x2c42('0x4a')]){return _0x3ad7c3[_0x2c42('0x9a')][_0x2c42('0x9b')][0x0];}else{return db['CmContact'][_0x2c42('0x60')](_[_0x2c42('0xa7')](_0x3cdcc4[_0x2c42('0x5b')],{'firstName':_0x3cdcc4['body']['to'],'email':_0x3cdcc4[_0x2c42('0x5b')]['to'],'phone':_0x3cdcc4['body']['to'],'ListId':_0x3ad7c3[_0x2c42('0x6e')]}));}}else{throw new Error(_0x2c42('0xa8'));}}})[_0x2c42('0x20')](function(_0x536231){if(_0x536231){var _0x33e422={'UserId':_0x3cdcc4[_0x2c42('0x71')]['id'],'ContactId':_0x536231['id'],'MailAccountId':_0x3ad7c3['id'],'inReplyTo':_0x11bd7d[_0x2c42('0xa9')],'to':_0x3cdcc4[_0x2c42('0x5b')]['from'],'cc':_0x3cdcc4[_0x2c42('0x5b')]['cc'],'subject':_0x3cdcc4[_0x2c42('0x5b')][_0x2c42('0xaa')],'attach':_0x3cdcc4[_0x2c42('0x5b')][_0x2c42('0xab')],'firstMsgDirection':_0x2c42('0xac'),'lastMsgAt':moment()[_0x2c42('0x98')](_0x2c42('0xad')),'lastMsgDirection':_0x2c42('0xac'),'lastMsgBody':_0x3cdcc4[_0x2c42('0x5b')]['body'],'Messages':[_[_0x2c42('0x64')](_0x3cdcc4[_0x2c42('0x5b')],{'messageId':_0x11bd7d[_0x2c42('0xa9')],'sentAt':moment()[_0x2c42('0x98')](_0x2c42('0xad')),'read':!![],'MailAccountId':_0x3ad7c3['id'],'UserId':_0x3cdcc4[_0x2c42('0x71')]['id'],'ContactId':_0x536231['id']})]};if(_0x3cdcc4[_0x2c42('0x5b')]['Interaction']){_0x33e422=_[_0x2c42('0x64')](_0x33e422,_0x3cdcc4[_0x2c42('0x5b')][_0x2c42('0xae')]);}return db[_0x2c42('0x84')][_0x2c42('0x60')](_0x33e422,{'include':[{'model':db[_0x2c42('0x96')],'as':_0x2c42('0xaf')}]});}})['then'](respondWithResult(_0x2cd3fa,null))[_0x2c42('0x2b')](handleError(_0x2cd3fa,null));};exports[_0x2c42('0xb0')]=function(_0xfcf68b,_0x55d8be,_0x769c4){return db[_0x2c42('0x55')][_0x2c42('0x5a')]({'where':{'id':_0xfcf68b[_0x2c42('0x5d')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x2c42('0x3e'),'raw':!![]}]})[_0x2c42('0x20')](handleEntityNotFound(_0x55d8be,null))[_0x2c42('0x20')](function(_0x69c023){if(_0x69c023&&_0x69c023['Smtp']){var _0x36b3ad={'id':_0x69c023['id'],'tls':{'rejectUnauthorized':![]}};if(_0x69c023[_0x2c42('0x3e')][_0x2c42('0xa2')]){_0x36b3ad[_0x2c42('0xa2')]=_0x69c023['Smtp'][_0x2c42('0xa2')];}else{_0x36b3ad[_0x2c42('0x73')]=_0x69c023[_0x2c42('0x3e')][_0x2c42('0x73')];_0x36b3ad['port']=_0x69c023[_0x2c42('0x3e')][_0x2c42('0x74')];_0x36b3ad[_0x2c42('0xa5')]=_0x69c023[_0x2c42('0x3e')][_0x2c42('0xa5')];}if(_0x69c023[_0x2c42('0x3e')][_0x2c42('0xb1')]){_0x36b3ad[_0x2c42('0xa3')]={'user':_0x69c023[_0x2c42('0x3e')][_0x2c42('0x71')],'pass':_0x69c023[_0x2c42('0x3e')][_0x2c42('0xa4')]};}return respondWithRpcPromise('VerifySmtp',_0x2c42('0xb0'),{'account':_0x36b3ad});}})[_0x2c42('0x20')](respondWithResult(_0x55d8be,null))[_0x2c42('0x2b')](handleError(_0x55d8be,null));};exports['destroy']=function(_0x38692b,_0x141946){return db['MailAccount'][_0x2c42('0x5a')]({'where':{'id':_0x38692b[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x141946,null))[_0x2c42('0x20')](function(_0x3dfaed){if(_0x3dfaed&&_0x3dfaed[_0x2c42('0xa2')]){throw new db['Sequelize'][(_0x2c42('0x1e'))](_0x2c42('0xb2'));}return _0x3dfaed;})['then'](removeEntity(_0x141946,null))[_0x2c42('0x2b')](handleError(_0x141946,null));};exports['addAgents']=function(_0x222a74,_0x1feaf4,_0x282ed6){return db['MailAccount'][_0x2c42('0x5a')]({'where':{'id':_0x222a74[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x1feaf4,null))['then'](function(_0x26ea2d){if(_0x26ea2d){return _0x26ea2d[_0x2c42('0xb3')](_0x222a74[_0x2c42('0x5b')][_0x2c42('0x67')],_[_0x2c42('0x85')](_0x222a74['body'],[_0x2c42('0x67'),'id'])||{})[_0x2c42('0xb4')](function(_0xc852e5){for(var _0xe88fa0=0x0;_0xe88fa0<_0x222a74['body'][_0x2c42('0x67')]['length'];_0xe88fa0+=0x1){socket[_0x2c42('0xb5')](_0x2c42('0xb6'),{'UserId':_0x222a74[_0x2c42('0x5b')][_0x2c42('0x67')][_0xe88fa0],'MailAccountId':_0x222a74[_0x2c42('0x5d')]['id']});}return _0xc852e5;});}})[_0x2c42('0x20')](respondWithResult(_0x1feaf4,null))[_0x2c42('0x2b')](handleError(_0x1feaf4,null));};exports[_0x2c42('0xb7')]=function(_0x249643,_0x233d3f,_0x4619a3){return db['MailAccount'][_0x2c42('0x5a')]({'where':{'id':_0x249643['params']['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x233d3f,null))[_0x2c42('0x20')](function(_0x591773){if(_0x591773){return _0x591773[_0x2c42('0xb7')](_0x249643[_0x2c42('0x45')]['ids'])[_0x2c42('0x20')](function(){if(_[_0x2c42('0xb8')](_0x249643[_0x2c42('0x45')][_0x2c42('0x67')])){for(var _0x24a92c=0x0;_0x24a92c<_0x249643[_0x2c42('0x45')]['ids'][_0x2c42('0x4a')];_0x24a92c+=0x1){socket[_0x2c42('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x249643[_0x2c42('0x45')][_0x2c42('0x67')][_0x24a92c]),'MailAccountId':Number(_0x249643[_0x2c42('0x5d')]['id'])});}}else{socket[_0x2c42('0xb5')](_0x2c42('0xb9'),{'UserId':Number(_0x249643['query'][_0x2c42('0x67')]),'MailAccountId':Number(_0x249643[_0x2c42('0x5d')]['id'])});}});}})[_0x2c42('0x20')](respondWithStatusCode(_0x233d3f,null))[_0x2c42('0x2b')](handleError(_0x233d3f,null));};exports[_0x2c42('0xba')]=function(_0x350b47,_0x2a8839,_0x2e1e7c){var _0x1ac44e={};var _0x8d2a83={};var _0x3b07f9;var _0x34cf43;return db[_0x2c42('0x55')]['findOne']({'where':{'id':_0x350b47[_0x2c42('0x5d')]['id']}})[_0x2c42('0x20')](handleEntityNotFound(_0x2a8839,null))[_0x2c42('0x20')](function(_0xa1065e){if(_0xa1065e){_0x3b07f9=_0xa1065e;_0x8d2a83[_0x2c42('0x44')]=_['keys'](db[_0x2c42('0x89')][_0x2c42('0x41')]);_0x8d2a83[_0x2c42('0x45')]=_['keys'](_0x350b47[_0x2c42('0x45')]);_0x8d2a83['filters']=_['intersection'](_0x8d2a83[_0x2c42('0x44')],_0x8d2a83[_0x2c42('0x45')]);_0x1ac44e[_0x2c42('0x47')]=_[_0x2c42('0x48')](_0x8d2a83[_0x2c42('0x44')],qs[_0x2c42('0x49')](_0x350b47[_0x2c42('0x45')][_0x2c42('0x49')]));_0x1ac44e[_0x2c42('0x47')]=_0x1ac44e[_0x2c42('0x47')][_0x2c42('0x4a')]?_0x1ac44e[_0x2c42('0x47')]:_0x8d2a83['model'];_0x1ac44e[_0x2c42('0x4c')]=qs[_0x2c42('0x4d')](_0x350b47['query'][_0x2c42('0x4d')]);_0x1ac44e[_0x2c42('0x4e')]=qs[_0x2c42('0x46')](_['pick'](_0x350b47[_0x2c42('0x45')],_0x8d2a83['filters']));if(_0x350b47[_0x2c42('0x45')]['filter']){_0x1ac44e[_0x2c42('0x4e')]=_[_0x2c42('0x64')](_0x1ac44e[_0x2c42('0x4e')],{'$or':_[_0x2c42('0x40')](_0x1ac44e[_0x2c42('0x47')],function(_0x521862){var _0x26ed5c={};_0x26ed5c[_0x521862]={'$like':'%'+_0x350b47['query'][_0x2c42('0x52')]+'%'};return _0x26ed5c;})});}_0x1ac44e=_['merge']({},_0x1ac44e,_0x350b47[_0x2c42('0x59')]);return _0x3b07f9[_0x2c42('0xba')](_0x1ac44e);}})[_0x2c42('0x20')](function(_0x5d2a83){if(_0x5d2a83){_0x34cf43=_0x5d2a83[_0x2c42('0x4a')];if(!_0x350b47[_0x2c42('0x45')][_0x2c42('0x4b')]('nolimit')){_0x1ac44e['limit']=qs[_0x2c42('0x2f')](_0x350b47[_0x2c42('0x45')]['limit']);_0x1ac44e['offset']=qs[_0x2c42('0x2e')](_0x350b47[_0x2c42('0x45')][_0x2c42('0x2e')]);}return _0x3b07f9[_0x2c42('0xba')](_0x1ac44e);}})['then'](function(_0x2b1a2a){if(_0x2b1a2a){return _0x2b1a2a?{'count':_0x34cf43,'rows':_0x2b1a2a}:null;}})['then'](respondWithResult(_0x2a8839,null))[_0x2c42('0x2b')](handleError(_0x2a8839,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 069323c..18abf1b 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 _0xafb2=['save','update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0xafb2,0x147));var _0x2afb=function(_0xdf6a4f,_0x3ed683){_0xdf6a4f=_0xdf6a4f-0x0;var _0x58aa05=_0xafb2[_0xdf6a4f];return _0x58aa05;};'use strict';var EventEmitter=require(_0x2afb('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x2afb('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2afb('0x2')](0x0);var events={'afterCreate':_0x2afb('0x3'),'afterUpdate':_0x2afb('0x4'),'afterDestroy':_0x2afb('0x5')};function emitEvent(_0x563798){return function(_0x51122f,_0x7af6c,_0xea97cb){MailAccountEvents[_0x2afb('0x6')](_0x563798+':'+_0x51122f['id'],_0x51122f);MailAccountEvents[_0x2afb('0x6')](_0x563798,_0x51122f);_0xea97cb(null);};}for(var e in events){if(events[_0x2afb('0x7')](e)){var event=events[e];MailAccount[_0x2afb('0x8')](e,emitEvent(event));}}module[_0x2afb('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xa6b4=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners','save','remove'];(function(_0xa5e664,_0x1b953e){var _0x2256f7=function(_0x247eca){while(--_0x247eca){_0xa5e664['push'](_0xa5e664['shift']());}};_0x2256f7(++_0x1b953e);}(_0xa6b4,0x1ea));var _0x4a6b=function(_0x2bbb3d,_0x400061){_0x2bbb3d=_0x2bbb3d-0x0;var _0x5739f0=_0xa6b4[_0x2bbb3d];return _0x5739f0;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x4a6b('0x0'))['db'][_0x4a6b('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4a6b('0x2')](0x0);var events={'afterCreate':_0x4a6b('0x3'),'afterUpdate':'update','afterDestroy':_0x4a6b('0x4')};function emitEvent(_0x300d70){return function(_0x22c012,_0x2d7c57,_0xb63d44){MailAccountEvents[_0x4a6b('0x5')](_0x300d70+':'+_0x22c012['id'],_0x22c012);MailAccountEvents[_0x4a6b('0x5')](_0x300d70,_0x22c012);_0xb63d44(null);};}for(var e in events){if(events[_0x4a6b('0x6')](e)){var event=events[e];MailAccount[_0x4a6b('0x7')](e,emitEvent(event));}}module[_0x4a6b('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3be72c8..973a59a 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 _0x454d=['bluebird','request-promise','path','rimraf','./mailAccount.attributes','define','mail_accounts','api'];(function(_0x5e596f,_0x3ff1bf){var _0x4cefe7=function(_0x51bfa0){while(--_0x51bfa0){_0x5e596f['push'](_0x5e596f['shift']());}};_0x4cefe7(++_0x3ff1bf);}(_0x454d,0x19f));var _0xd454=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x454d[_0x58c851];return _0x534d8a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd454('0x0'));var moment=require('moment');var BPromise=require(_0xd454('0x1'));var rp=require(_0xd454('0x2'));var fs=require('fs');var path=require(_0xd454('0x3'));var rimraf=require(_0xd454('0x4'));var config=require('../../config/environment');var attributes=require(_0xd454('0x5'));module['exports']=function(_0x4cbf0f,_0x28a053){return _0x4cbf0f[_0xd454('0x6')]('MailAccount',attributes,{'tableName':_0xd454('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x594b=['api','path','rimraf','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','util','../../config/logger'];(function(_0x3778d8,_0x5ce417){var _0x45a1b3=function(_0x28488a){while(--_0x28488a){_0x3778d8['push'](_0x3778d8['shift']());}};_0x45a1b3(++_0x5ce417);}(_0x594b,0xda));var _0xb594=function(_0xe8768,_0x51089b){_0xe8768=_0xe8768-0x0;var _0x20b22e=_0x594b[_0xe8768];return _0x20b22e;};'use strict';var _=require('lodash');var util=require(_0xb594('0x0'));var logger=require(_0xb594('0x1'))(_0xb594('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb594('0x3'));var rimraf=require(_0xb594('0x4'));var config=require('../../config/environment');var attributes=require(_0xb594('0x5'));module[_0xb594('0x6')]=function(_0x54d2c1,_0x534215){return _0x54d2c1[_0xb594('0x7')](_0xb594('0x8'),attributes,{'tableName':_0xb594('0x9'),'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 a3de178..358219e 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 _0x44d4=['options','attributes','limit','include','map','model','debug','ShowMailAccount','find','raw','where','body','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','priority','push','autoclose','*,*,*,*','create','List\x20not\x20found','contact','generate','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','attach','interaction','created','originTo','bcc','Attachment','Attachments','name','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMailAccount','MailAccount','findAll'];(function(_0x446bfe,_0x28c7b6){var _0x2bcfdb=function(_0x5d7b9b){while(--_0x5d7b9b){_0x446bfe['push'](_0x446bfe['shift']());}};_0x2bcfdb(++_0x28c7b6);}(_0x44d4,0x161));var _0x444d=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0x44d4[_0x3fb5eb];return _0x481291;};'use strict';var _=require(_0x444d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x444d('0x1'));var fs=require('fs');var Redis=require(_0x444d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x444d('0x3'));var config=require(_0x444d('0x4'));var jayson=require(_0x444d('0x5'));var client=jayson[_0x444d('0x6')][_0x444d('0x7')]({'port':0x232c});config[_0x444d('0x8')]=_[_0x444d('0x9')](config['redis'],{'host':_0x444d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x444d('0x8')]));require(_0x444d('0xb'))[_0x444d('0xc')](socket);function respondWithRpcPromise(_0x3982b2,_0x26f553,_0x44cd15){return new BPromise(function(_0x2e98c9,_0x13a27c){return client[_0x444d('0xd')](_0x3982b2,_0x44cd15)[_0x444d('0xe')](function(_0x305815){logger['info'](_0x444d('0xf'),_0x26f553,_0x444d('0x10'));logger['debug'](_0x444d('0x11'),_0x26f553,_0x444d('0x10'),JSON[_0x444d('0x12')](_0x305815));if(_0x305815['error']){if(_0x305815[_0x444d('0x13')][_0x444d('0x14')]===0x1f4){logger[_0x444d('0x13')]('MailAccount,\x20%s,\x20%s',_0x26f553,_0x305815[_0x444d('0x13')]['message']);return _0x13a27c(_0x305815[_0x444d('0x13')][_0x444d('0x15')]);}logger[_0x444d('0x13')](_0x444d('0xf'),_0x26f553,_0x305815['error']['message']);return _0x2e98c9(_0x305815['error']['message']);}else{logger[_0x444d('0x16')](_0x444d('0xf'),_0x26f553,_0x444d('0x10'));_0x2e98c9(_0x305815['result']['message']);}})[_0x444d('0x17')](function(_0x144020){logger[_0x444d('0x13')](_0x444d('0xf'),_0x26f553,_0x144020);_0x13a27c(_0x144020);});});}exports[_0x444d('0x18')]=function(_0x4bbcd1){var _0x10639f=this;return new Promise(function(_0x474c65,_0x2c0e2a){return db[_0x444d('0x19')][_0x444d('0x1a')]({'raw':_0x4bbcd1[_0x444d('0x1b')]?_0x4bbcd1[_0x444d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4bbcd1['options']?_0x4bbcd1[_0x444d('0x1b')]['where']||null:null,'attributes':_0x4bbcd1['options']?_0x4bbcd1[_0x444d('0x1b')][_0x444d('0x1c')]||null:null,'limit':_0x4bbcd1[_0x444d('0x1b')]?_0x4bbcd1['options'][_0x444d('0x1d')]||null:null,'include':_0x4bbcd1[_0x444d('0x1b')]?_0x4bbcd1[_0x444d('0x1b')][_0x444d('0x1e')]?_[_0x444d('0x1f')](_0x4bbcd1[_0x444d('0x1b')][_0x444d('0x1e')],function(_0x394d06){return{'model':db[_0x394d06[_0x444d('0x20')]],'as':_0x394d06['as'],'attributes':_0x394d06['attributes'],'include':_0x394d06['include']?_[_0x444d('0x1f')](_0x394d06['include'],function(_0x58ca64){return{'model':db[_0x58ca64[_0x444d('0x20')]],'as':_0x58ca64['as'],'attributes':_0x58ca64['attributes'],'include':_0x58ca64[_0x444d('0x1e')]?_[_0x444d('0x1f')](_0x58ca64['include'],function(_0x1f6a96){return{'model':db[_0x1f6a96[_0x444d('0x20')]],'as':_0x1f6a96['as'],'attributes':_0x1f6a96[_0x444d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x444d('0xe')](function(_0x5aac3a){logger[_0x444d('0x16')]('GetMailAccount',_0x4bbcd1);logger[_0x444d('0x21')]('GetMailAccount',_0x4bbcd1,JSON[_0x444d('0x12')](_0x5aac3a));_0x474c65(_0x5aac3a);})[_0x444d('0x17')](function(_0x2dfad8){logger[_0x444d('0x13')](_0x444d('0x18'),_0x2dfad8['message'],_0x4bbcd1);_0x2c0e2a(_0x10639f[_0x444d('0x13')](0x1f4,_0x2dfad8[_0x444d('0x15')]));});});};exports[_0x444d('0x22')]=function(_0x371380){var _0x418512=this;return new Promise(function(_0x426062,_0x428155){return db[_0x444d('0x19')][_0x444d('0x23')]({'raw':_0x371380['options']?_0x371380['options'][_0x444d('0x24')]===undefined?!![]:![]:!![],'where':_0x371380[_0x444d('0x1b')]?_0x371380['options'][_0x444d('0x25')]||null:null,'attributes':_0x371380[_0x444d('0x1b')]?_0x371380[_0x444d('0x1b')][_0x444d('0x1c')]||null:null,'include':_0x371380[_0x444d('0x1b')]?_0x371380['options']['include']?_['map'](_0x371380[_0x444d('0x1b')][_0x444d('0x1e')],function(_0x5935d9){return{'model':db[_0x5935d9[_0x444d('0x20')]],'as':_0x5935d9['as'],'attributes':_0x5935d9['attributes'],'include':_0x5935d9[_0x444d('0x1e')]?_[_0x444d('0x1f')](_0x5935d9[_0x444d('0x1e')],function(_0x283451){return{'model':db[_0x283451[_0x444d('0x20')]],'as':_0x283451['as'],'attributes':_0x283451['attributes'],'include':_0x283451['include']?_[_0x444d('0x1f')](_0x283451[_0x444d('0x1e')],function(_0x42cfff){return{'model':db[_0x42cfff[_0x444d('0x20')]],'as':_0x42cfff['as'],'attributes':_0x42cfff[_0x444d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x444d('0xe')](function(_0x1a7b8a){logger['info'](_0x444d('0x22'),_0x371380);logger[_0x444d('0x21')]('ShowMailAccount',_0x371380,JSON['stringify'](_0x1a7b8a));_0x426062(_0x1a7b8a);})[_0x444d('0x17')](function(_0x428337){logger['error'](_0x444d('0x22'),_0x428337[_0x444d('0x15')],_0x371380);_0x428155(_0x418512[_0x444d('0x13')](0x1f4,_0x428337[_0x444d('0x15')]));});});};exports['NotifyMailAccount']=function(_0x4c2d45){var _0x57d0b8=this;return new Promise(function(_0x43ca2d,_0x5b127b){var _0x136056={'body':_0x4c2d45[_0x444d('0x26')],'channel':'mail'};var _0x289d8f=_[_0x444d('0x27')](_['keys'](db[_0x444d('0x28')][_0x444d('0x29')]),[_0x444d('0x2a'),_0x444d('0x2b'),_0x444d('0x2c'),_0x444d('0x2d')]);var _0x3e1aa8=![];if(_0x4c2d45[_0x444d('0x26')]['id']){delete _0x4c2d45['body']['id'];}if(_['isNil'](_0x4c2d45['body'][_0x444d('0x2e')])){return _0x5b127b(_0x57d0b8[_0x444d('0x13')](0x1f4,_0x444d('0x2f')));}if(_[_0x444d('0x30')](_0x4c2d45['body'][_0x444d('0x26')])||_0x4c2d45[_0x444d('0x26')][_0x444d('0x26')]===''){return _0x5b127b(_0x57d0b8['error'](0x1f4,_0x444d('0x31')));}if(_['isNil'](_0x4c2d45[_0x444d('0x26')][_0x444d('0x32')])){return _0x5b127b(_0x57d0b8[_0x444d('0x13')](0x1f4,_0x444d('0x33')+_0x289d8f));}if(!_['includes'](_0x289d8f,_0x4c2d45[_0x444d('0x26')][_0x444d('0x32')])){return _0x5b127b(_0x57d0b8[_0x444d('0x13')](0x1f4,_0x444d('0x34')+_0x289d8f));}var _0x13d3a9={};_0x13d3a9[_0x4c2d45[_0x444d('0x26')][_0x444d('0x32')]]=_0x4c2d45[_0x444d('0x26')][_0x444d('0x2e')];return db[_0x444d('0x19')][_0x444d('0x23')]({'where':{'id':_0x4c2d45[_0x444d('0x35')]['id']},'include':[{'model':db[_0x444d('0x36')],'as':_0x444d('0x37'),'include':[{'model':db[_0x444d('0x28')],'as':_0x444d('0x38'),'where':_0x13d3a9,'limit':0x1,'order':[[_0x444d('0x2b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x444d('0x39')},{'model':db[_0x444d('0x3a')],'as':_0x444d('0x3b')}]})['then'](function(_0x4f9c27){if(_0x4f9c27&&_0x4f9c27['List']){var _0x78ad7a=_0x4f9c27[_0x444d('0x3c')]({'plain':!![]});_0x136056[_0x444d('0x35')]=_[_0x444d('0x3d')](_0x78ad7a,[_0x444d('0x39'),_0x444d('0x37')]);_0x136056[_0x444d('0x3e')]=_0x78ad7a[_0x444d('0x39')];_0x136056[_0x444d('0x3f')]=_0x78ad7a[_0x444d('0x37')];_0x136056[_0x444d('0x3e')]=_[_0x444d('0x40')](_0x136056['applications'],[_0x444d('0x41')],['asc']);if(_0x136056[_0x444d('0x35')]&&_0x136056[_0x444d('0x35')]['autoclose']){_0x136056[_0x444d('0x3e')][_0x444d('0x42')]({'id':0x0,'priority':_0x136056[_0x444d('0x3e')]['length']+0x1,'app':'close','appdata':_0x444d('0x43'),'interval':_0x444d('0x44')});}if(_0x136056[_0x444d('0x35')]['Applications']){delete _0x136056[_0x444d('0x35')][_0x444d('0x39')];}if(_0x136056[_0x444d('0x35')][_0x444d('0x37')]){delete _0x136056[_0x444d('0x35')][_0x444d('0x37')];}if(_0x78ad7a['List'][_0x444d('0x38')]['length']){return _0x78ad7a['List'][_0x444d('0x38')][0x0];}var _0x55d2bc=_[_0x444d('0x9')](_0x4c2d45[_0x444d('0x26')],{'firstName':_0x4c2d45[_0x444d('0x26')][_0x444d('0x2e')],'ListId':_0x78ad7a['ListId']});_0x55d2bc[_0x4c2d45[_0x444d('0x26')][_0x444d('0x32')]]=_0x4c2d45[_0x444d('0x26')][_0x444d('0x2e')];return db[_0x444d('0x28')][_0x444d('0x45')](_0x55d2bc);}else{throw new Error(_0x444d('0x46'));}})['then'](function(_0x1dfa02){_0x136056[_0x444d('0x47')]=_0x1dfa02;if(_0x1dfa02){if(!_0x4c2d45['body'][_0x444d('0x15')]['messageId']){_0x4c2d45['body'][_0x444d('0x15')]['messageId']=rs[_0x444d('0x48')]()+'\x20'+_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')][_0x444d('0x2e')];}var _0x4aa689={'ContactId':_0x1dfa02['id'],'MailAccountId':_0x4c2d45[_0x444d('0x35')]['id'],'inReplyTo':_0x4c2d45['body']['message'][_0x444d('0x49')],'to':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')][_0x444d('0x2e')],'cc':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')]['cc'],'subject':_0x4c2d45[_0x444d('0x26')]['message'][_0x444d('0x4a')],'attach':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')]['attach'],'lastMsgAt':moment()[_0x444d('0x4b')](_0x444d('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x4c2d45[_0x444d('0x26')]['body']};return db[_0x444d('0x4d')][_0x444d('0x23')]({'where':{'closed':![],'MailAccountId':_0x4c2d45[_0x444d('0x35')]['id']},'include':[{'model':db[_0x444d('0x4e')],'as':_0x444d('0x4f'),'attributes':[_0x444d('0x49')],'where':{'messageId':_0x4c2d45[_0x444d('0x26')]['message']['inReplyTo']}}]})[_0x444d('0xe')](function(_0x220a15){if(_0x220a15){return[_0x220a15,![]];}return db[_0x444d('0x4d')][_0x444d('0x45')](_0x4aa689)['then'](function(_0x2b2e0c){return[_0x2b2e0c,!![]];});});}else{throw new Error(_0x444d('0x50'));}})[_0x444d('0x51')](function(_0x287153,_0xb18105){if(_0x287153){_0x3e1aa8=_0xb18105;if(!_0xb18105){return _0x287153['update']({'inReplyTo':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')][_0x444d('0x49')],'to':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')]['from'],'cc':_0x4c2d45[_0x444d('0x26')]['message']['cc'],'subject':_0x4c2d45[_0x444d('0x26')]['message']['subject'],'attach':_0x287153['attach']?_0x287153[_0x444d('0x52')]:_0x4c2d45['body'][_0x444d('0x15')]['attach'],'substatus':null,'substatusAt':moment()[_0x444d('0x4b')](_0x444d('0x4c')),'lastMsgAt':moment()[_0x444d('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x4c2d45[_0x444d('0x26')][_0x444d('0x26')]});}else{return _0x287153;}}})[_0x444d('0xe')](function(_0x233b04){_0x136056[_0x444d('0x53')]=_0x233b04['get']({'plain':!![]});_0x136056[_0x444d('0x53')][_0x444d('0x54')]=_0x3e1aa8;return db[_0x444d('0x4e')][_0x444d('0x45')]({'body':_0x4c2d45['body'][_0x444d('0x26')],'MailAccountId':_0x4c2d45[_0x444d('0x35')]['id'],'MailInteractionId':_0x233b04['id'],'direction':'in','ContactId':_0x136056['contact']['id'],'messageId':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')][_0x444d('0x49')],'from':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')]['from'],'to':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')]['to'],'cc':_0x4c2d45['body'][_0x444d('0x15')]['cc'],'subject':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')][_0x444d('0x4a')],'attach':_0x4c2d45['body']['message'][_0x444d('0x52')],'Attachments':_0x4c2d45[_0x444d('0x26')]['message']['attachments'],'originTo':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')][_0x444d('0x55')],'originCc':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')]['originCc'],'bcc':_0x4c2d45[_0x444d('0x26')][_0x444d('0x15')][_0x444d('0x56')]},{'include':[{'model':db[_0x444d('0x57')],'as':_0x444d('0x58')}]});})[_0x444d('0xe')](function(_0x2b53a8){_0x136056['message']=_0x2b53a8;if(_0x136056[_0x444d('0x53')]['UserId']){return db['User'][_0x444d('0x23')]({'attributes':['id',_0x444d('0x59')],'where':{'id':_0x136056[_0x444d('0x53')][_0x444d('0x5a')]}})[_0x444d('0xe')](function(_0x3362d0){if(_0x3362d0){_0x136056[_0x444d('0x3e')][_0x444d('0x5b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3362d0[_0x444d('0x59')]+','+(_0x136056[_0x444d('0x35')][_0x444d('0x5c')]||0xa),'interval':_0x444d('0x44')});}return respondWithRpcPromise(_0x444d('0x5d'),_0x444d('0x5e'),_0x136056);});}return respondWithRpcPromise(_0x444d('0x5d'),'startRouting',_0x136056);})[_0x444d('0xe')](function(_0x4979c4){_0x43ca2d(_0x4979c4);})[_0x444d('0x17')](function(_0x4f775a){_0x5b127b(_0x57d0b8[_0x444d('0x13')](0x1f4,_0x4f775a['message']));});});}; \ No newline at end of file +var _0xbec5=['length','close','*,*,*,*','Contacts','ListId','mapKey','create','List\x20not\x20found','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','attach','interaction','contact','attachments','originCc','bcc','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','GetMailAccount','MailAccount','findAll','options','raw','include','map','attributes','ShowMailAccount','find','model','NotifyMailAccount','difference','keys','CmContact','rawAttributes','CompanyId','body','from','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','updatedAt','MailApplication','Applications','MailServerOut','Smtp','get','account','omit','applications','orderBy','priority','asc','autoclose','push'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0xbec5,0xe5));var _0x5bec=function(_0x2351c4,_0x1dca54){_0x2351c4=_0x2351c4-0x0;var _0x1dd3f8=_0xbec5[_0x2351c4];return _0x1dd3f8;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232c});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('MailAccount,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')]({'raw':_0x593786[_0x5bec('0x1d')]?_0x593786[_0x5bec('0x1d')][_0x5bec('0x1e')]===undefined?!![]:![]:!![],'where':_0x593786['options']?_0x593786[_0x5bec('0x1d')]['where']||null:null,'attributes':_0x593786[_0x5bec('0x1d')]?_0x593786[_0x5bec('0x1d')]['attributes']||null:null,'limit':_0x593786[_0x5bec('0x1d')]?_0x593786[_0x5bec('0x1d')]['limit']||null:null,'include':_0x593786[_0x5bec('0x1d')]?_0x593786[_0x5bec('0x1d')][_0x5bec('0x1f')]?_[_0x5bec('0x20')](_0x593786[_0x5bec('0x1d')][_0x5bec('0x1f')],function(_0x2dc014){return{'model':db[_0x2dc014['model']],'as':_0x2dc014['as'],'attributes':_0x2dc014['attributes'],'include':_0x2dc014['include']?_[_0x5bec('0x20')](_0x2dc014[_0x5bec('0x1f')],function(_0x338c25){return{'model':db[_0x338c25['model']],'as':_0x338c25['as'],'attributes':_0x338c25[_0x5bec('0x21')],'include':_0x338c25[_0x5bec('0x1f')]?_['map'](_0x338c25[_0x5bec('0x1f')],function(_0x63ac8){return{'model':db[_0x63ac8['model']],'as':_0x63ac8['as'],'attributes':_0x63ac8['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bec('0x10')](function(_0x2a82d5){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger[_0x5bec('0x13')](_0x5bec('0x1a'),_0x593786,JSON['stringify'](_0x2a82d5));_0xab397b(_0x2a82d5);})[_0x5bec('0x19')](function(_0x59b5b6){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x59b5b6[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x59b5b6['message']));});});};exports[_0x5bec('0x22')]=function(_0x1aba46){var _0xfc7d41=this;return new Promise(function(_0x527cfb,_0xf6ae6b){return db['MailAccount'][_0x5bec('0x23')]({'raw':_0x1aba46[_0x5bec('0x1d')]?_0x1aba46[_0x5bec('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1aba46[_0x5bec('0x1d')]?_0x1aba46[_0x5bec('0x1d')]['where']||null:null,'attributes':_0x1aba46[_0x5bec('0x1d')]?_0x1aba46[_0x5bec('0x1d')][_0x5bec('0x21')]||null:null,'include':_0x1aba46[_0x5bec('0x1d')]?_0x1aba46[_0x5bec('0x1d')]['include']?_[_0x5bec('0x20')](_0x1aba46['options'][_0x5bec('0x1f')],function(_0x384f04){return{'model':db[_0x384f04[_0x5bec('0x24')]],'as':_0x384f04['as'],'attributes':_0x384f04[_0x5bec('0x21')],'include':_0x384f04[_0x5bec('0x1f')]?_[_0x5bec('0x20')](_0x384f04['include'],function(_0x1c6cc3){return{'model':db[_0x1c6cc3[_0x5bec('0x24')]],'as':_0x1c6cc3['as'],'attributes':_0x1c6cc3[_0x5bec('0x21')],'include':_0x1c6cc3['include']?_[_0x5bec('0x20')](_0x1c6cc3[_0x5bec('0x1f')],function(_0x497519){return{'model':db[_0x497519[_0x5bec('0x24')]],'as':_0x497519['as'],'attributes':_0x497519['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bec('0x10')](function(_0x2c0b08){logger[_0x5bec('0x11')]('ShowMailAccount',_0x1aba46);logger[_0x5bec('0x13')](_0x5bec('0x22'),_0x1aba46,JSON[_0x5bec('0x14')](_0x2c0b08));_0x527cfb(_0x2c0b08);})[_0x5bec('0x19')](function(_0x176cfb){logger[_0x5bec('0x15')](_0x5bec('0x22'),_0x176cfb['message'],_0x1aba46);_0xf6ae6b(_0xfc7d41[_0x5bec('0x15')](0x1f4,_0x176cfb[_0x5bec('0x18')]));});});};exports[_0x5bec('0x25')]=function(_0x414d59){var _0x598e53=this;return new Promise(function(_0x27863b,_0x3fe548){var _0x206839={'body':_0x414d59['body'],'channel':'mail'};var _0x1a57e3=_[_0x5bec('0x26')](_[_0x5bec('0x27')](db[_0x5bec('0x28')][_0x5bec('0x29')]),['createdAt','updatedAt',_0x5bec('0x2a'),'ListId']);var _0x39597c=![];if(_0x414d59[_0x5bec('0x2b')]['id']){delete _0x414d59[_0x5bec('0x2b')]['id'];}if(_['isNil'](_0x414d59[_0x5bec('0x2b')][_0x5bec('0x2c')])){return _0x3fe548(_0x598e53['error'](0x1f4,_0x5bec('0x2d')));}if(_[_0x5bec('0x2e')](_0x414d59[_0x5bec('0x2b')][_0x5bec('0x2b')])||_0x414d59[_0x5bec('0x2b')][_0x5bec('0x2b')]===''){return _0x3fe548(_0x598e53[_0x5bec('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x414d59[_0x5bec('0x2b')]['mapKey'])){return _0x3fe548(_0x598e53['error'](0x1f4,_0x5bec('0x2f')+_0x1a57e3));}if(!_['includes'](_0x1a57e3,_0x414d59['body']['mapKey'])){return _0x3fe548(_0x598e53[_0x5bec('0x15')](0x1f4,_0x5bec('0x30')+_0x1a57e3));}var _0xb7ad6={};_0xb7ad6[_0x414d59[_0x5bec('0x2b')]['mapKey']]=_0x414d59[_0x5bec('0x2b')][_0x5bec('0x2c')];return db[_0x5bec('0x1b')][_0x5bec('0x23')]({'where':{'id':_0x414d59['account']['id']},'include':[{'model':db[_0x5bec('0x31')],'as':_0x5bec('0x32'),'include':[{'model':db[_0x5bec('0x28')],'as':'Contacts','where':_0xb7ad6,'limit':0x1,'order':[[_0x5bec('0x33'),'DESC']]}]},{'model':db[_0x5bec('0x34')],'as':_0x5bec('0x35')},{'model':db[_0x5bec('0x36')],'as':_0x5bec('0x37')}]})['then'](function(_0x32869f){if(_0x32869f&&_0x32869f[_0x5bec('0x32')]){var _0x227420=_0x32869f[_0x5bec('0x38')]({'plain':!![]});_0x206839[_0x5bec('0x39')]=_[_0x5bec('0x3a')](_0x227420,[_0x5bec('0x35'),'List']);_0x206839[_0x5bec('0x3b')]=_0x227420[_0x5bec('0x35')];_0x206839['list']=_0x227420[_0x5bec('0x32')];_0x206839[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0x206839[_0x5bec('0x3b')],[_0x5bec('0x3d')],[_0x5bec('0x3e')]);if(_0x206839[_0x5bec('0x39')]&&_0x206839['account'][_0x5bec('0x3f')]){_0x206839['applications'][_0x5bec('0x40')]({'id':0x0,'priority':_0x206839[_0x5bec('0x3b')][_0x5bec('0x41')]+0x1,'app':_0x5bec('0x42'),'appdata':_0x5bec('0x3f'),'interval':_0x5bec('0x43')});}if(_0x206839[_0x5bec('0x39')][_0x5bec('0x35')]){delete _0x206839[_0x5bec('0x39')][_0x5bec('0x35')];}if(_0x206839['account'][_0x5bec('0x32')]){delete _0x206839['account']['List'];}if(_0x227420[_0x5bec('0x32')]['Contacts']['length']){return _0x227420[_0x5bec('0x32')][_0x5bec('0x44')][0x0];}var _0x416058=_['defaults'](_0x414d59[_0x5bec('0x2b')],{'firstName':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x2c')],'ListId':_0x227420[_0x5bec('0x45')]});_0x416058[_0x414d59['body'][_0x5bec('0x46')]]=_0x414d59[_0x5bec('0x2b')][_0x5bec('0x2c')];return db[_0x5bec('0x28')][_0x5bec('0x47')](_0x416058);}else{throw new Error(_0x5bec('0x48'));}})[_0x5bec('0x10')](function(_0x47ea9f){_0x206839['contact']=_0x47ea9f;if(_0x47ea9f){if(!_0x414d59[_0x5bec('0x2b')]['message'][_0x5bec('0x49')]){_0x414d59[_0x5bec('0x2b')]['message'][_0x5bec('0x49')]=rs['generate']()+'\x20'+_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')][_0x5bec('0x2c')];}var _0x17e033={'ContactId':_0x47ea9f['id'],'MailAccountId':_0x414d59[_0x5bec('0x39')]['id'],'inReplyTo':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')][_0x5bec('0x49')],'to':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')][_0x5bec('0x2c')],'cc':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')]['cc'],'subject':_0x414d59[_0x5bec('0x2b')]['message'][_0x5bec('0x4a')],'attach':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')]['attach'],'lastMsgAt':moment()[_0x5bec('0x4b')](_0x5bec('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x2b')]};return db[_0x5bec('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0x414d59[_0x5bec('0x39')]['id']},'include':[{'model':db[_0x5bec('0x4e')],'as':_0x5bec('0x4f'),'attributes':[_0x5bec('0x49')],'where':{'messageId':_0x414d59['body'][_0x5bec('0x18')]['inReplyTo']}}]})[_0x5bec('0x10')](function(_0x38deb0){if(_0x38deb0){return[_0x38deb0,![]];}return db[_0x5bec('0x4d')][_0x5bec('0x47')](_0x17e033)['then'](function(_0x268cc5){return[_0x268cc5,!![]];});});}else{throw new Error(_0x5bec('0x50'));}})[_0x5bec('0x51')](function(_0x125dfb,_0xc3e3df){if(_0x125dfb){_0x39597c=_0xc3e3df;if(!_0xc3e3df){return _0x125dfb[_0x5bec('0x52')]({'inReplyTo':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')][_0x5bec('0x49')],'to':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')][_0x5bec('0x2c')],'cc':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')]['cc'],'subject':_0x414d59[_0x5bec('0x2b')]['message'][_0x5bec('0x4a')],'attach':_0x125dfb[_0x5bec('0x53')]?_0x125dfb['attach']:_0x414d59[_0x5bec('0x2b')]['message'][_0x5bec('0x53')],'substatus':null,'substatusAt':moment()[_0x5bec('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x5bec('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x2b')]});}else{return _0x125dfb;}}})[_0x5bec('0x10')](function(_0x2c7a94){_0x206839['interaction']=_0x2c7a94[_0x5bec('0x38')]({'plain':!![]});_0x206839[_0x5bec('0x54')]['created']=_0x39597c;return db[_0x5bec('0x4e')][_0x5bec('0x47')]({'body':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x2b')],'MailAccountId':_0x414d59['account']['id'],'MailInteractionId':_0x2c7a94['id'],'direction':'in','ContactId':_0x206839[_0x5bec('0x55')]['id'],'messageId':_0x414d59['body'][_0x5bec('0x18')][_0x5bec('0x49')],'from':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')][_0x5bec('0x2c')],'to':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')]['to'],'cc':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')]['cc'],'subject':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')]['subject'],'attach':_0x414d59['body'][_0x5bec('0x18')][_0x5bec('0x53')],'Attachments':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')][_0x5bec('0x56')],'originTo':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')]['originTo'],'originCc':_0x414d59['body'][_0x5bec('0x18')][_0x5bec('0x57')],'bcc':_0x414d59[_0x5bec('0x2b')][_0x5bec('0x18')][_0x5bec('0x58')]},{'include':[{'model':db[_0x5bec('0x59')],'as':_0x5bec('0x5a')}]});})[_0x5bec('0x10')](function(_0x132c57){_0x206839[_0x5bec('0x18')]=_0x132c57;if(_0x206839[_0x5bec('0x54')][_0x5bec('0x5b')]){return db[_0x5bec('0x5c')][_0x5bec('0x23')]({'attributes':['id',_0x5bec('0x5d')],'where':{'id':_0x206839[_0x5bec('0x54')][_0x5bec('0x5b')]}})[_0x5bec('0x10')](function(_0x2201a3){if(_0x2201a3){_0x206839[_0x5bec('0x3b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5bec('0x5e'),'appdata':_0x2201a3['name']+','+(_0x206839['account'][_0x5bec('0x5f')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5bec('0x60'),'startRouting',_0x206839);});}return respondWithRpcPromise('Start',_0x5bec('0x61'),_0x206839);})[_0x5bec('0x10')](function(_0x5632cc){_0x27863b(_0x5632cc);})[_0x5bec('0x19')](function(_0x7c1a19){_0x3fe548(_0x598e53[_0x5bec('0x15')](0x1f4,_0x7c1a19[_0x5bec('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 6dfcf52..a2a0234 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 _0xdcfa=['remove','emit','removeListener','register','length','./mailAccount.events'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xdcfa,0xad));var _0xadcf=function(_0x1f6704,_0x106f36){_0x1f6704=_0x1f6704-0x0;var _0x4acab6=_0xdcfa[_0x1f6704];return _0x4acab6;};'use strict';var MailAccountEvents=require(_0xadcf('0x0'));var events=['save',_0xadcf('0x1'),'update'];function createListener(_0x14990c,_0x408141){return function(_0x3c2e2c){_0x408141[_0xadcf('0x2')](_0x14990c,_0x3c2e2c);};}function removeListener(_0x2575ce,_0x2f0c66){return function(){MailAccountEvents[_0xadcf('0x3')](_0x2575ce,_0x2f0c66);};}exports[_0xadcf('0x4')]=function(_0x706348){for(var _0x355ffd=0x0,_0x182f1c=events[_0xadcf('0x5')];_0x355ffd<_0x182f1c;_0x355ffd++){var _0x5a98ab=events[_0x355ffd];var _0x41cdbf=createListener('mailAccount:'+_0x5a98ab,_0x706348);MailAccountEvents['on'](_0x5a98ab,_0x41cdbf);}}; \ No newline at end of file +var _0x5183=['./mailAccount.events','save','remove','emit','register','mailAccount:'];(function(_0x192088,_0x2e43a8){var _0x4fd3e0=function(_0x43778b){while(--_0x43778b){_0x192088['push'](_0x192088['shift']());}};_0x4fd3e0(++_0x2e43a8);}(_0x5183,0x13e));var _0x3518=function(_0x4da368,_0x3d81de){_0x4da368=_0x4da368-0x0;var _0x4c713a=_0x5183[_0x4da368];return _0x4c713a;};'use strict';var MailAccountEvents=require(_0x3518('0x0'));var events=[_0x3518('0x1'),_0x3518('0x2'),'update'];function createListener(_0x5b6958,_0x2323f3){return function(_0x3cc276){_0x2323f3[_0x3518('0x3')](_0x5b6958,_0x3cc276);};}function removeListener(_0x421ab5,_0x5a38df){return function(){MailAccountEvents['removeListener'](_0x421ab5,_0x5a38df);};}exports[_0x3518('0x4')]=function(_0x1031a9){for(var _0x2c019c=0x0,_0x482b2d=events['length'];_0x2c019c<_0x482b2d;_0x2c019c++){var _0x488c52=events[_0x2c019c];var _0x147b59=createListener(_0x3518('0x5')+_0x488c52,_0x1031a9);MailAccountEvents['on'](_0x488c52,_0x147b59);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 7a081b8..804f247 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 _0x373d=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','put','/:id','update'];(function(_0x1eb8cb,_0x13420b){var _0x35ccaf=function(_0x2b6d71){while(--_0x2b6d71){_0x1eb8cb['push'](_0x1eb8cb['shift']());}};_0x35ccaf(++_0x13420b);}(_0x373d,0x1e2));var _0xd373=function(_0x58a058,_0x5965eb){_0x58a058=_0x58a058-0x0;var _0x347664=_0x373d[_0x58a058];return _0x347664;};'use strict';var multer=require(_0xd373('0x0'));var util=require('util');var path=require(_0xd373('0x1'));var timeout=require(_0xd373('0x2'));var express=require(_0xd373('0x3'));var router=express[_0xd373('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd373('0x5'));var config=require(_0xd373('0x6'));var controller=require(_0xd373('0x7'));router['get']('/:id',auth[_0xd373('0x8')](),controller[_0xd373('0x9')]);router[_0xd373('0xa')](_0xd373('0xb'),auth['isAuthenticated'](),controller[_0xd373('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd373('0xd')]);module[_0xd373('0xe')]=router; \ No newline at end of file +var _0xd3d1=['delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x314455,_0x47941a){var _0x423847=function(_0xc37a46){while(--_0xc37a46){_0x314455['push'](_0x314455['shift']());}};_0x423847(++_0x47941a);}(_0xd3d1,0x172));var _0x1d3d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xd3d1[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3d('0x2'));var router=express[_0x1d3d('0x3')]();var auth=require(_0x1d3d('0x4'));var interaction=require(_0x1d3d('0x5'));var config=require(_0x1d3d('0x6'));var controller=require(_0x1d3d('0x7'));router[_0x1d3d('0x8')](_0x1d3d('0x9'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xb')]);router[_0x1d3d('0xc')](_0x1d3d('0x9'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xd')]);router[_0x1d3d('0xe')](_0x1d3d('0x9'),auth[_0x1d3d('0xa')](),controller['destroy']);module[_0x1d3d('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 c010c0e..fffbba4 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 _0xee66=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0xee66,0x1ab));var _0x6ee6=function(_0x2d3c60,_0x4df458){_0x2d3c60=_0x2d3c60-0x0;var _0x560041=_0xee66[_0x2d3c60];return _0x560041;};'use strict';var Sequelize=require(_0x6ee6('0x0'));module[_0x6ee6('0x1')]={'priority':{'type':Sequelize[_0x6ee6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6ee6('0x3')],'allowNull':![],'defaultValue':_0x6ee6('0x4')},'appdata':{'type':Sequelize[_0x6ee6('0x5')]()},'description':{'type':Sequelize[_0x6ee6('0x3')]},'interval':{'type':Sequelize[_0x6ee6('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd836=['STRING','TEXT','INTEGER'];(function(_0x222688,_0x46c5eb){var _0x437433=function(_0x29958c){while(--_0x29958c){_0x222688['push'](_0x222688['shift']());}};_0x437433(++_0x46c5eb);}(_0xd836,0x16d));var _0x6d83=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd836[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x6d83('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x6d83('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6d83('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 10736d0..e5fbff7 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 _0xffcc=['../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','MailApplication','rawAttributes','query','intersection','attributes','fields','options','find','body','catch','eml-format','zip-dir','fast-json-patch','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x19b1c2,_0x205062){var _0x4e1ae5=function(_0x5a1cb7){while(--_0x5a1cb7){_0x19b1c2['push'](_0x19b1c2['shift']());}};_0x4e1ae5(++_0x205062);}(_0xffcc,0x112));var _0xcffc=function(_0x2d6d38,_0x1c1d85){_0x2d6d38=_0x2d6d38-0x0;var _0x3c8908=_0xffcc[_0x2d6d38];return _0x3c8908;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcffc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcffc('0x1'));var jsonpatch=require(_0xcffc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcffc('0x3'));var util=require('util');var path=require(_0xcffc('0x4'));var sox=require('sox');var csv=require(_0xcffc('0x5'));var ejs=require(_0xcffc('0x6'));var fs=require('fs');var _=require(_0xcffc('0x7'));var squel=require(_0xcffc('0x8'));var crypto=require('crypto');var jsforce=require(_0xcffc('0x9'));var deskjs=require(_0xcffc('0xa'));var toCsv=require(_0xcffc('0x5'));var querystring=require('querystring');var Papa=require(_0xcffc('0xb'));var Redis=require('ioredis');var authService=require(_0xcffc('0xc'));var qs=require(_0xcffc('0xd'));var as=require(_0xcffc('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcffc('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xcffc('0x10'));var db=require(_0xcffc('0x11'))['db'];function respondWithStatusCode(_0x375b94,_0x12e1e4){_0x12e1e4=_0x12e1e4||0xcc;return function(_0x9ba1b2){if(_0x9ba1b2){return _0x375b94[_0xcffc('0x12')](_0x12e1e4);}return _0x375b94[_0xcffc('0x13')](_0x12e1e4)[_0xcffc('0x14')]();};}function respondWithResult(_0x5139ad,_0x219272){_0x219272=_0x219272||0xc8;return function(_0x2437b0){if(_0x2437b0){return _0x5139ad[_0xcffc('0x13')](_0x219272)[_0xcffc('0x15')](_0x2437b0);}};}function respondWithFilteredResult(_0x2ce35f,_0x249da9){return function(_0x2eb456){if(_0x2eb456){var _0x5927d9=_0x2eb456[_0xcffc('0x16')],_0x2deccb=_0x249da9[_0xcffc('0x17')],_0x1cf8de=_0x249da9['offset']+_0x249da9[_0xcffc('0x18')],_0x966aba;if(_0x1cf8de>=_0x5927d9){_0x1cf8de=_0x5927d9;_0x966aba=0xc8;}else{_0x966aba=0xce;}_0x2ce35f[_0xcffc('0x13')](_0x966aba);return _0x2ce35f['set']('Content-Range',_0x2deccb+'-'+_0x1cf8de+'/'+_0x5927d9)[_0xcffc('0x15')](_0x2eb456);}return null;};}function patchUpdates(_0x13ed7b){return function(_0x23e6d0){try{jsonpatch[_0xcffc('0x19')](_0x23e6d0,_0x13ed7b,!![]);}catch(_0x1a4278){return BPromise[_0xcffc('0x1a')](_0x1a4278);}return _0x23e6d0[_0xcffc('0x1b')]();};}function saveUpdates(_0x37c99b,_0x14489a){return function(_0x2df26e){if(_0x2df26e){return _0x2df26e[_0xcffc('0x1c')](_0x37c99b)[_0xcffc('0x1d')](function(_0x3e07d1){return _0x3e07d1;});}return null;};}function removeEntity(_0x543e52,_0x1ee56c){return function(_0x57bd0b){if(_0x57bd0b){return _0x57bd0b[_0xcffc('0x1e')]()[_0xcffc('0x1d')](function(){_0x543e52[_0xcffc('0x13')](0xcc)[_0xcffc('0x14')]();});}};}function handleEntityNotFound(_0x539fc2,_0xecb7cd){return function(_0x5e8014){if(!_0x5e8014){_0x539fc2[_0xcffc('0x12')](0x194);}return _0x5e8014;};}function handleError(_0x3e1542,_0x494714){_0x494714=_0x494714||0x1f4;return function(_0xb61493){logger[_0xcffc('0x1f')](_0xb61493[_0xcffc('0x20')]);if(_0xb61493['name']){delete _0xb61493[_0xcffc('0x21')];}_0x3e1542['status'](_0x494714)['send'](_0xb61493);};}exports[_0xcffc('0x22')]=function(_0x2bcac8,_0x4a9e72){var _0xc40ae9={'raw':!![],'where':{'id':_0x2bcac8[_0xcffc('0x23')]['id']}},_0x3c95b4={};_0x3c95b4[_0xcffc('0x24')]=_[_0xcffc('0x25')](db[_0xcffc('0x26')][_0xcffc('0x27')]);_0x3c95b4[_0xcffc('0x28')]=_['keys'](_0x2bcac8['query']);_0x3c95b4['filters']=_[_0xcffc('0x29')](_0x3c95b4[_0xcffc('0x24')],_0x3c95b4[_0xcffc('0x28')]);_0xc40ae9[_0xcffc('0x2a')]=_[_0xcffc('0x29')](_0x3c95b4[_0xcffc('0x24')],qs['fields'](_0x2bcac8[_0xcffc('0x28')][_0xcffc('0x2b')]));_0xc40ae9[_0xcffc('0x2a')]=_0xc40ae9[_0xcffc('0x2a')]['length']?_0xc40ae9[_0xcffc('0x2a')]:_0x3c95b4[_0xcffc('0x24')];if(_0x2bcac8[_0xcffc('0x28')]['includeAll']){_0xc40ae9['include']=[{'all':!![]}];}_0xc40ae9=_['merge']({},_0xc40ae9,_0x2bcac8[_0xcffc('0x2c')]);return db[_0xcffc('0x26')][_0xcffc('0x2d')](_0xc40ae9)['then'](handleEntityNotFound(_0x4a9e72,null))[_0xcffc('0x1d')](respondWithResult(_0x4a9e72,null))['catch'](handleError(_0x4a9e72,null));};exports['update']=function(_0x3a1bf8,_0x407b82){if(_0x3a1bf8[_0xcffc('0x2e')]['id']){delete _0x3a1bf8[_0xcffc('0x2e')]['id'];}return db[_0xcffc('0x26')][_0xcffc('0x2d')]({'where':{'id':_0x3a1bf8[_0xcffc('0x23')]['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x407b82,null))['then'](saveUpdates(_0x3a1bf8[_0xcffc('0x2e')],null))[_0xcffc('0x1d')](respondWithResult(_0x407b82,null))[_0xcffc('0x2f')](handleError(_0x407b82,null));};exports[_0xcffc('0x1e')]=function(_0x180473,_0x31ee5b){return db[_0xcffc('0x26')][_0xcffc('0x2d')]({'where':{'id':_0x180473[_0xcffc('0x23')]['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x31ee5b,null))['then'](removeEntity(_0x31ee5b,null))['catch'](handleError(_0x31ee5b,null));}; \ No newline at end of file +var _0x9789=['model','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','MailApplication','find','catch','update','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','show'];(function(_0x577eed,_0x1a5cf5){var _0x43bf78=function(_0x5f33ef){while(--_0x5f33ef){_0x577eed['push'](_0x577eed['shift']());}};_0x43bf78(++_0x1a5cf5);}(_0x9789,0x1bc));var _0x9978=function(_0xca82a4,_0x407eb4){_0xca82a4=_0xca82a4-0x0;var _0x5eed21=_0x9789[_0xca82a4];return _0x5eed21;};'use strict';var pdf=require(_0x9978('0x0'));var emlformat=require(_0x9978('0x1'));var rimraf=require(_0x9978('0x2'));var zipdir=require(_0x9978('0x3'));var jsonpatch=require(_0x9978('0x4'));var rp=require(_0x9978('0x5'));var moment=require(_0x9978('0x6'));var BPromise=require(_0x9978('0x7'));var Mustache=require(_0x9978('0x8'));var util=require(_0x9978('0x9'));var path=require(_0x9978('0xa'));var sox=require(_0x9978('0xb'));var csv=require(_0x9978('0xc'));var ejs=require(_0x9978('0xd'));var fs=require('fs');var _=require(_0x9978('0xe'));var squel=require(_0x9978('0xf'));var crypto=require(_0x9978('0x10'));var jsforce=require(_0x9978('0x11'));var deskjs=require(_0x9978('0x12'));var toCsv=require(_0x9978('0xc'));var querystring=require(_0x9978('0x13'));var Papa=require('papaparse');var Redis=require(_0x9978('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x9978('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9978('0x16'));var logger=require(_0x9978('0x17'))(_0x9978('0x18'));var utils=require('../../config/utils');var config=require(_0x9978('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3f82,_0xd21833){_0xd21833=_0xd21833||0xcc;return function(_0x1b99e6){if(_0x1b99e6){return _0x4f3f82[_0x9978('0x1a')](_0xd21833);}return _0x4f3f82[_0x9978('0x1b')](_0xd21833)[_0x9978('0x1c')]();};}function respondWithResult(_0x2614cc,_0x44def9){_0x44def9=_0x44def9||0xc8;return function(_0x26beee){if(_0x26beee){return _0x2614cc['status'](_0x44def9)[_0x9978('0x1d')](_0x26beee);}};}function respondWithFilteredResult(_0x242fc1,_0x2da5bb){return function(_0x3957d0){if(_0x3957d0){var _0x4356c4=_0x3957d0[_0x9978('0x1e')],_0x1a662a=_0x2da5bb[_0x9978('0x1f')],_0x1a9b18=_0x2da5bb[_0x9978('0x1f')]+_0x2da5bb[_0x9978('0x20')],_0x402e43;if(_0x1a9b18>=_0x4356c4){_0x1a9b18=_0x4356c4;_0x402e43=0xc8;}else{_0x402e43=0xce;}_0x242fc1[_0x9978('0x1b')](_0x402e43);return _0x242fc1[_0x9978('0x21')](_0x9978('0x22'),_0x1a662a+'-'+_0x1a9b18+'/'+_0x4356c4)[_0x9978('0x1d')](_0x3957d0);}return null;};}function patchUpdates(_0x35c34a){return function(_0x58fb50){try{jsonpatch[_0x9978('0x23')](_0x58fb50,_0x35c34a,!![]);}catch(_0x147a13){return BPromise[_0x9978('0x24')](_0x147a13);}return _0x58fb50[_0x9978('0x25')]();};}function saveUpdates(_0x13387d,_0x29df6e){return function(_0x101a99){if(_0x101a99){return _0x101a99['update'](_0x13387d)[_0x9978('0x26')](function(_0x2c32ae){return _0x2c32ae;});}return null;};}function removeEntity(_0x228ab7,_0x1fefb5){return function(_0x2aca0f){if(_0x2aca0f){return _0x2aca0f[_0x9978('0x27')]()['then'](function(){_0x228ab7[_0x9978('0x1b')](0xcc)[_0x9978('0x1c')]();});}};}function handleEntityNotFound(_0x2041bc,_0x858118){return function(_0x19f42d){if(!_0x19f42d){_0x2041bc[_0x9978('0x1a')](0x194);}return _0x19f42d;};}function handleError(_0x4a9bdb,_0x593da4){_0x593da4=_0x593da4||0x1f4;return function(_0x3489bd){logger['error'](_0x3489bd[_0x9978('0x28')]);if(_0x3489bd[_0x9978('0x29')]){delete _0x3489bd[_0x9978('0x29')];}_0x4a9bdb[_0x9978('0x1b')](_0x593da4)[_0x9978('0x2a')](_0x3489bd);};}exports[_0x9978('0x2b')]=function(_0x5d9b03,_0x64e832){var _0x2f0e40={'raw':!![],'where':{'id':_0x5d9b03['params']['id']}},_0x54a017={};_0x54a017[_0x9978('0x2c')]=_['keys'](db['MailApplication']['rawAttributes']);_0x54a017[_0x9978('0x2d')]=_[_0x9978('0x2e')](_0x5d9b03[_0x9978('0x2d')]);_0x54a017[_0x9978('0x2f')]=_[_0x9978('0x30')](_0x54a017[_0x9978('0x2c')],_0x54a017[_0x9978('0x2d')]);_0x2f0e40[_0x9978('0x31')]=_[_0x9978('0x30')](_0x54a017['model'],qs[_0x9978('0x32')](_0x5d9b03['query'][_0x9978('0x32')]));_0x2f0e40[_0x9978('0x31')]=_0x2f0e40['attributes'][_0x9978('0x33')]?_0x2f0e40['attributes']:_0x54a017['model'];if(_0x5d9b03[_0x9978('0x2d')][_0x9978('0x34')]){_0x2f0e40[_0x9978('0x35')]=[{'all':!![]}];}_0x2f0e40=_['merge']({},_0x2f0e40,_0x5d9b03[_0x9978('0x36')]);return db[_0x9978('0x37')][_0x9978('0x38')](_0x2f0e40)[_0x9978('0x26')](handleEntityNotFound(_0x64e832,null))[_0x9978('0x26')](respondWithResult(_0x64e832,null))[_0x9978('0x39')](handleError(_0x64e832,null));};exports[_0x9978('0x3a')]=function(_0x37555d,_0x26d1d7){if(_0x37555d[_0x9978('0x3b')]['id']){delete _0x37555d[_0x9978('0x3b')]['id'];}return db[_0x9978('0x37')]['find']({'where':{'id':_0x37555d['params']['id']}})['then'](handleEntityNotFound(_0x26d1d7,null))[_0x9978('0x26')](saveUpdates(_0x37555d['body'],null))[_0x9978('0x26')](respondWithResult(_0x26d1d7,null))[_0x9978('0x39')](handleError(_0x26d1d7,null));};exports[_0x9978('0x27')]=function(_0x25b6de,_0x1493ab){return db[_0x9978('0x37')][_0x9978('0x38')]({'where':{'id':_0x25b6de[_0x9978('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1493ab,null))[_0x9978('0x26')](removeEntity(_0x1493ab,null))['catch'](handleError(_0x1493ab,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index eb683fb..9809139 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 _0xea19=['mail_applications','utf8mb4','lodash','util','api','moment','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication'];(function(_0xab8207,_0x274686){var _0x50ef67=function(_0x581dfd){while(--_0x581dfd){_0xab8207['push'](_0xab8207['shift']());}};_0x50ef67(++_0x274686);}(_0xea19,0x106));var _0x9ea1=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xea19[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x9ea1('0x0'));var util=require(_0x9ea1('0x1'));var logger=require('../../config/logger')(_0x9ea1('0x2'));var moment=require(_0x9ea1('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ea1('0x4'));var fs=require('fs');var path=require(_0x9ea1('0x5'));var rimraf=require('rimraf');var config=require(_0x9ea1('0x6'));var attributes=require(_0x9ea1('0x7'));module[_0x9ea1('0x8')]=function(_0x3f7aba,_0x42fee4){return _0x3f7aba[_0x9ea1('0x9')](_0x9ea1('0xa'),attributes,{'tableName':_0x9ea1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ea1('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd3fb=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd3fb,0x93));var _0xbd3f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd3fb[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xbd3f('0x0'));var util=require(_0xbd3f('0x1'));var logger=require(_0xbd3f('0x2'))(_0xbd3f('0x3'));var moment=require(_0xbd3f('0x4'));var BPromise=require(_0xbd3f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd3f('0x6'));var config=require(_0xbd3f('0x7'));var attributes=require(_0xbd3f('0x8'));module[_0xbd3f('0x9')]=function(_0x1918c3,_0x1ac988){return _0x1918c3[_0xbd3f('0xa')](_0xbd3f('0xb'),attributes,{'tableName':_0xbd3f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd3f('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 7e56401..162dcd2 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 _0xeb29=['http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailApplication','update','options','raw','attributes','UpdateMailApplication','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x306a89,_0x37fdd2){var _0x44fb3a=function(_0x350ec0){while(--_0x350ec0){_0x306a89['push'](_0x306a89['shift']());}};_0x44fb3a(++_0x37fdd2);}(_0xeb29,0x171));var _0x9eb2=function(_0x4b8696,_0x5ddf37){_0x4b8696=_0x4b8696-0x0;var _0x2ea065=_0xeb29[_0x4b8696];return _0x2ea065;};'use strict';var _=require(_0x9eb2('0x0'));var util=require(_0x9eb2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9eb2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9eb2('0x3'));var logger=require(_0x9eb2('0x4'))(_0x9eb2('0x5'));var config=require(_0x9eb2('0x6'));var jayson=require(_0x9eb2('0x7'));var client=jayson[_0x9eb2('0x8')][_0x9eb2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18331f,_0x5d5752,_0x499d3e){return new BPromise(function(_0x231591,_0x4abcc3){return client['request'](_0x18331f,_0x499d3e)[_0x9eb2('0xa')](function(_0x10f8b7){logger[_0x9eb2('0xb')](_0x9eb2('0xc'),_0x5d5752,_0x9eb2('0xd'));logger[_0x9eb2('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x5d5752,_0x9eb2('0xd'),JSON[_0x9eb2('0xf')](_0x10f8b7));if(_0x10f8b7['error']){if(_0x10f8b7[_0x9eb2('0x10')][_0x9eb2('0x11')]===0x1f4){logger[_0x9eb2('0x10')]('MailApplication,\x20%s,\x20%s',_0x5d5752,_0x10f8b7[_0x9eb2('0x10')]['message']);return _0x4abcc3(_0x10f8b7[_0x9eb2('0x10')]['message']);}logger[_0x9eb2('0x10')]('MailApplication,\x20%s,\x20%s',_0x5d5752,_0x10f8b7[_0x9eb2('0x10')][_0x9eb2('0x12')]);return _0x231591(_0x10f8b7['error'][_0x9eb2('0x12')]);}else{logger[_0x9eb2('0xb')]('MailApplication,\x20%s,\x20%s',_0x5d5752,_0x9eb2('0xd'));_0x231591(_0x10f8b7[_0x9eb2('0x13')][_0x9eb2('0x12')]);}})[_0x9eb2('0x14')](function(_0xed8f2b){logger[_0x9eb2('0x10')]('MailApplication,\x20%s,\x20%s',_0x5d5752,_0xed8f2b);_0x4abcc3(_0xed8f2b);});});}exports['UpdateMailApplication']=function(_0x3b93db){var _0x46ad97=this;return new Promise(function(_0x1102a2,_0x135339){return db[_0x9eb2('0x15')][_0x9eb2('0x16')](_0x3b93db['body'],{'raw':_0x3b93db[_0x9eb2('0x17')]?_0x3b93db['options'][_0x9eb2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b93db[_0x9eb2('0x17')]?_0x3b93db[_0x9eb2('0x17')]['where']||null:null,'attributes':_0x3b93db[_0x9eb2('0x17')]?_0x3b93db[_0x9eb2('0x17')][_0x9eb2('0x19')]||null:null,'limit':_0x3b93db['options']?_0x3b93db[_0x9eb2('0x17')]['limit']||null:null})[_0x9eb2('0xa')](function(_0x115c43){logger['info'](_0x9eb2('0x1a'),_0x3b93db);logger['debug'](_0x9eb2('0x1a'),_0x3b93db,JSON[_0x9eb2('0xf')](_0x115c43));_0x1102a2(_0x115c43);})[_0x9eb2('0x14')](function(_0x52a3b3){logger[_0x9eb2('0x10')](_0x9eb2('0x1a'),_0x52a3b3[_0x9eb2('0x12')],_0x3b93db);_0x135339(_0x46ad97[_0x9eb2('0x10')](0x1f4,_0x52a3b3[_0x9eb2('0x12')]));});});}; \ No newline at end of file +var _0x7eb8=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailApplication','body','options','raw','attributes','limit','UpdateMailApplication','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','MailApplication,\x20%s,\x20%s'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x7eb8,0x7b));var _0x87eb=function(_0x31c083,_0x2c7696){_0x31c083=_0x31c083-0x0;var _0x2436c2=_0x7eb8[_0x31c083];return _0x2436c2;};'use strict';var _=require(_0x87eb('0x0'));var util=require(_0x87eb('0x1'));var moment=require('moment');var BPromise=require(_0x87eb('0x2'));var rs=require(_0x87eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x87eb('0x4'));var logger=require(_0x87eb('0x5'))(_0x87eb('0x6'));var config=require('../../config/environment');var jayson=require(_0x87eb('0x7'));var client=jayson[_0x87eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36d13e,_0x31ca01,_0x1ef8ce){return new BPromise(function(_0x5c4402,_0x504032){return client['request'](_0x36d13e,_0x1ef8ce)[_0x87eb('0x9')](function(_0x5d067a){logger[_0x87eb('0xa')](_0x87eb('0xb'),_0x31ca01,_0x87eb('0xc'));logger[_0x87eb('0xd')](_0x87eb('0xe'),_0x31ca01,_0x87eb('0xc'),JSON[_0x87eb('0xf')](_0x5d067a));if(_0x5d067a[_0x87eb('0x10')]){if(_0x5d067a['error'][_0x87eb('0x11')]===0x1f4){logger[_0x87eb('0x10')](_0x87eb('0xb'),_0x31ca01,_0x5d067a[_0x87eb('0x10')][_0x87eb('0x12')]);return _0x504032(_0x5d067a['error'][_0x87eb('0x12')]);}logger[_0x87eb('0x10')](_0x87eb('0xb'),_0x31ca01,_0x5d067a[_0x87eb('0x10')][_0x87eb('0x12')]);return _0x5c4402(_0x5d067a[_0x87eb('0x10')][_0x87eb('0x12')]);}else{logger[_0x87eb('0xa')]('MailApplication,\x20%s,\x20%s',_0x31ca01,_0x87eb('0xc'));_0x5c4402(_0x5d067a['result'][_0x87eb('0x12')]);}})['catch'](function(_0x56ab0d){logger[_0x87eb('0x10')]('MailApplication,\x20%s,\x20%s',_0x31ca01,_0x56ab0d);_0x504032(_0x56ab0d);});});}exports['UpdateMailApplication']=function(_0x572d39){var _0x470738=this;return new Promise(function(_0x45238c,_0x2494a1){return db[_0x87eb('0x13')]['update'](_0x572d39[_0x87eb('0x14')],{'raw':_0x572d39[_0x87eb('0x15')]?_0x572d39[_0x87eb('0x15')][_0x87eb('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x572d39['options']?_0x572d39[_0x87eb('0x15')]['where']||null:null,'attributes':_0x572d39['options']?_0x572d39[_0x87eb('0x15')][_0x87eb('0x17')]||null:null,'limit':_0x572d39[_0x87eb('0x15')]?_0x572d39[_0x87eb('0x15')][_0x87eb('0x18')]||null:null})[_0x87eb('0x9')](function(_0x33dbb5){logger[_0x87eb('0xa')](_0x87eb('0x19'),_0x572d39);logger[_0x87eb('0xd')](_0x87eb('0x19'),_0x572d39,JSON[_0x87eb('0xf')](_0x33dbb5));_0x45238c(_0x33dbb5);})[_0x87eb('0x1a')](function(_0x5a35ed){logger['error'](_0x87eb('0x19'),_0x5a35ed[_0x87eb('0x12')],_0x572d39);_0x2494a1(_0x470738[_0x87eb('0x10')](0x1f4,_0x5a35ed[_0x87eb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index aae1f33..b9e5fb5 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 _0x3e1f=['mailinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','delete'];(function(_0xe67912,_0x2d4ec9){var _0x136506=function(_0x1770a){while(--_0x1770a){_0xe67912['push'](_0xe67912['shift']());}};_0x136506(++_0x2d4ec9);}(_0x3e1f,0x18a));var _0xf3e1=function(_0x74895e,_0x298c35){_0x74895e=_0x74895e-0x0;var _0x40bc2a=_0x3e1f[_0x74895e];return _0x40bc2a;};'use strict';var multer=require('multer');var util=require(_0xf3e1('0x0'));var path=require(_0xf3e1('0x1'));var timeout=require(_0xf3e1('0x2'));var express=require('express');var router=express[_0xf3e1('0x3')]();var auth=require(_0xf3e1('0x4'));var interaction=require(_0xf3e1('0x5'));var config=require(_0xf3e1('0x6'));var controller=require(_0xf3e1('0x7'));router['get']('/',auth[_0xf3e1('0x8')](),controller[_0xf3e1('0x9')]);router[_0xf3e1('0xa')](_0xf3e1('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xf3e1('0xa')](_0xf3e1('0xc'),auth['isAuthenticated'](),controller[_0xf3e1('0xd')]);router[_0xf3e1('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf3e1('0xe')]);router['get'](_0xf3e1('0xf'),auth[_0xf3e1('0x8')](),controller[_0xf3e1('0x10')]);router[_0xf3e1('0x11')]('/',auth[_0xf3e1('0x8')](),controller['create']);router[_0xf3e1('0x11')]('/:id/messages',auth[_0xf3e1('0x8')](),controller[_0xf3e1('0x12')]);router['post'](_0xf3e1('0x13'),auth[_0xf3e1('0x8')](),interaction[_0xf3e1('0x14')](_0xf3e1('0x15'),_0xf3e1('0x16')),controller['addTags']);router[_0xf3e1('0x17')](_0xf3e1('0xc'),auth[_0xf3e1('0x8')](),interaction[_0xf3e1('0x14')](_0xf3e1('0x15'),_0xf3e1('0x18')),controller['update']);router[_0xf3e1('0x19')](_0xf3e1('0xc'),auth[_0xf3e1('0x8')](),interaction[_0xf3e1('0x14')]('mail',_0xf3e1('0x1a')),controller[_0xf3e1('0x1b')]);router[_0xf3e1('0x19')]('/:id/tags',auth[_0xf3e1('0x8')](),controller[_0xf3e1('0x1c')]);module[_0xf3e1('0x1d')]=router; \ No newline at end of file +var _0x71ad=['put','mailinteraction:update','update','delete','removeTags','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags'];(function(_0x5539b6,_0x36c377){var _0x4ac4fd=function(_0xe09e03){while(--_0xe09e03){_0x5539b6['push'](_0x5539b6['shift']());}};_0x4ac4fd(++_0x36c377);}(_0x71ad,0xee));var _0xd71a=function(_0x1633d9,_0x56d57e){_0x1633d9=_0x1633d9-0x0;var _0x2a9fa2=_0x71ad[_0x1633d9];return _0x2a9fa2;};'use strict';var multer=require(_0xd71a('0x0'));var util=require(_0xd71a('0x1'));var path=require('path');var timeout=require(_0xd71a('0x2'));var express=require('express');var router=express[_0xd71a('0x3')]();var auth=require(_0xd71a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd71a('0x5'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0xd71a('0x6')](),controller['index']);router[_0xd71a('0x7')](_0xd71a('0x8'),auth[_0xd71a('0x6')](),controller[_0xd71a('0x9')]);router[_0xd71a('0x7')](_0xd71a('0xa'),auth[_0xd71a('0x6')](),controller['show']);router[_0xd71a('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xd71a('0xb')]);router[_0xd71a('0x7')](_0xd71a('0xc'),auth[_0xd71a('0x6')](),controller[_0xd71a('0xd')]);router[_0xd71a('0xe')]('/',auth[_0xd71a('0x6')](),controller[_0xd71a('0xf')]);router[_0xd71a('0xe')](_0xd71a('0x10'),auth['isAuthenticated'](),controller[_0xd71a('0x11')]);router[_0xd71a('0xe')](_0xd71a('0x12'),auth[_0xd71a('0x6')](),interaction[_0xd71a('0x13')](_0xd71a('0x14'),_0xd71a('0x15')),controller[_0xd71a('0x16')]);router[_0xd71a('0x17')](_0xd71a('0xa'),auth[_0xd71a('0x6')](),interaction[_0xd71a('0x13')](_0xd71a('0x14'),_0xd71a('0x18')),controller[_0xd71a('0x19')]);router['delete'](_0xd71a('0xa'),auth[_0xd71a('0x6')](),interaction[_0xd71a('0x13')]('mail','mailinteraction:destroy'),controller['destroy']);router[_0xd71a('0x1a')](_0xd71a('0x12'),auth[_0xd71a('0x6')](),controller[_0xd71a('0x1b')]);module[_0xd71a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index c69ac21..75236fd 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 _0xb018=['DATE','out','ENUM','sequelize','exports','BOOLEAN','STRING','TEXT','long'];(function(_0x33a685,_0x2f00ff){var _0x34a360=function(_0x26e412){while(--_0x26e412){_0x33a685['push'](_0x33a685['shift']());}};_0x34a360(++_0x2f00ff);}(_0xb018,0x162));var _0x8b01=function(_0x428303,_0x1835b3){_0x428303=_0x428303-0x0;var _0x12d0e8=_0xb018[_0x428303];return _0x12d0e8;};'use strict';var Sequelize=require(_0x8b01('0x0'));var iconv=require('iconv');module[_0x8b01('0x1')]={'closed':{'type':Sequelize[_0x8b01('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8b01('0x3')]},'note':{'type':Sequelize[_0x8b01('0x3')]},'inReplyTo':{'type':Sequelize[_0x8b01('0x3')](0x1fe)},'to':{'type':Sequelize[_0x8b01('0x3')]},'cc':{'type':Sequelize[_0x8b01('0x4')](_0x8b01('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8b01('0x6')]},'substatus':{'type':Sequelize[_0x8b01('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x8b01('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8b01('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8b01('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x8b01('0x8')]('in',_0x8b01('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x8b01('0x4')]('long')},'lastMsgText':{'type':Sequelize['TEXT'](_0x8b01('0x5'))}}; \ No newline at end of file +var _0xdf1b=['long','iconv','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0xf03c32,_0x1cc81a){var _0x1d762c=function(_0x46365c){while(--_0x46365c){_0xf03c32['push'](_0xf03c32['shift']());}};_0x1d762c(++_0x1cc81a);}(_0xdf1b,0x111));var _0xbdf1=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0xdf1b[_0xf91841];return _0x4b9c44;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xbdf1('0x0'));module['exports']={'closed':{'type':Sequelize[_0xbdf1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbdf1('0x2')]},'disposition':{'type':Sequelize[_0xbdf1('0x3')]},'note':{'type':Sequelize[_0xbdf1('0x3')]},'inReplyTo':{'type':Sequelize[_0xbdf1('0x3')](0x1fe)},'to':{'type':Sequelize[_0xbdf1('0x3')]},'cc':{'type':Sequelize[_0xbdf1('0x4')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbdf1('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xbdf1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xbdf1('0x5')]('in',_0xbdf1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbdf1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xbdf1('0x5')]('in',_0xbdf1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xbdf1('0x4')]('long')},'lastMsgText':{'type':Sequelize[_0xbdf1('0x4')](_0xbdf1('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e4b0802..0863aad 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(_0x46ff07,_0x2b8390){var _0x7289e8=function(_0x52cb86){while(--_0x52cb86){_0x46ff07['push'](_0x46ff07['shift']());}};_0x7289e8(++_0x2b8390);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x344abc,_0x390eb0){var _0x1c88ed=function(_0x4e0d9f){while(--_0x4e0d9f){_0x344abc['push'](_0x344abc['shift']());}};_0x1c88ed(++_0x390eb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 e5f5158..f942eae 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 _0x3925=['then','Users','findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb','MailMessage','save','update'];(function(_0x7eae6c,_0x5e0499){var _0xc9e3a9=function(_0x2076f6){while(--_0x2076f6){_0x7eae6c['push'](_0x7eae6c['shift']());}};_0xc9e3a9(++_0x5e0499);}(_0x3925,0x174));var _0x5392=function(_0xea19d5,_0x4ac565){_0xea19d5=_0xea19d5-0x0;var _0x19698e=_0x3925[_0xea19d5];return _0x19698e;};'use strict';var EventEmitter=require(_0x5392('0x0'));var MailInteraction=require(_0x5392('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x5392('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5392('0x3'),'afterUpdate':_0x5392('0x4'),'afterDestroy':'remove'};function emitEvent(_0x46a055){return function(_0x1d5a92,_0x3a4e67,_0x3c680a){_0x1d5a92['getUsers']({'attributes':['id'],'raw':!![]})[_0x5392('0x5')](function(_0x2e33c1){_0x1d5a92['setDataValue'](_0x5392('0x6'),_0x2e33c1['map'](function(_0x16fb3f){return{'id':_0x16fb3f['id']};}));return MailMessage[_0x5392('0x7')]({'where':{'MailInteractionId':_0x1d5a92['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5392('0x5')](function(_0x762570){_0x1d5a92['setDataValue'](_0x5392('0x8'),_0x762570[_0x5392('0x9')]);MailInteractionEvents[_0x5392('0xa')](_0x46a055+':'+_0x1d5a92['id'],_0x1d5a92);MailInteractionEvents[_0x5392('0xa')](_0x46a055,_0x1d5a92);_0x3c680a(null);})['catch'](_0x3c680a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x5392('0xb')](e,emitEvent(event));}}module[_0x5392('0xc')]=MailInteractionEvents; \ No newline at end of file +var _0xb1a4=['update','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','MailMessage','setMaxListeners','save'];(function(_0x51f34d,_0x2a917a){var _0x1b95a6=function(_0x523ce0){while(--_0x523ce0){_0x51f34d['push'](_0x51f34d['shift']());}};_0x1b95a6(++_0x2a917a);}(_0xb1a4,0x72));var _0x4b1a=function(_0x4d45a7,_0x2a1ea7){_0x4d45a7=_0x4d45a7-0x0;var _0x7ece93=_0xb1a4[_0x4d45a7];return _0x7ece93;};'use strict';var EventEmitter=require(_0x4b1a('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x4b1a('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x4b1a('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4b1a('0x3')](0x0);var events={'afterCreate':_0x4b1a('0x4'),'afterUpdate':_0x4b1a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x445d60){return function(_0x2f34f4,_0x2d1747,_0x2e7cbd){_0x2f34f4['getUsers']({'attributes':['id'],'raw':!![]})[_0x4b1a('0x6')](function(_0xb3874a){_0x2f34f4[_0x4b1a('0x7')](_0x4b1a('0x8'),_0xb3874a['map'](function(_0x1b2ace){return{'id':_0x1b2ace['id']};}));return MailMessage[_0x4b1a('0x9')]({'where':{'MailInteractionId':_0x2f34f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4b1a('0x6')](function(_0x312ecc){_0x2f34f4[_0x4b1a('0x7')](_0x4b1a('0xa'),_0x312ecc[_0x4b1a('0xb')]);MailInteractionEvents[_0x4b1a('0xc')](_0x445d60+':'+_0x2f34f4['id'],_0x2f34f4);MailInteractionEvents[_0x4b1a('0xc')](_0x445d60,_0x2f34f4);_0x2e7cbd(null);})[_0x4b1a('0xd')](_0x2e7cbd(null));};}for(var e in events){if(events[_0x4b1a('0xe')](e)){var event=events[e];MailInteraction[_0x4b1a('0xf')](e,emitEvent(event));}}module[_0x4b1a('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 1b86ce8..4ad1151 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 _0xedd9=['subject','FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','get','update','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','MailInteraction','fti_mail_interactions'];(function(_0xadaf72,_0x190c5e){var _0x3c9164=function(_0x1f56fd){while(--_0x1f56fd){_0xadaf72['push'](_0xadaf72['shift']());}};_0x3c9164(++_0x190c5e);}(_0xedd9,0xfc));var _0x9edd=function(_0x1fc141,_0x37ad5f){_0x1fc141=_0x1fc141-0x0;var _0xbe9db6=_0xedd9[_0x1fc141];return _0xbe9db6;};'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':'mail_interactions','paranoid':![],'indexes':[{'name':_0x9edd('0xb'),'fields':[_0x9edd('0xc'),'to'],'type':_0x9edd('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3280fd,_0x49d5e3,_0x494a24){if(_0x3280fd['substatus']){_0x3280fd[_0x9edd('0xe')]=moment()[_0x9edd('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3280fd[_0x9edd('0x10')]){_0x3280fd[_0x9edd('0x11')]=moment()['format'](_0x9edd('0x12'));}_0x494a24(null,_0x49d5e3);},'beforeUpdate':function(_0x1b73d1,_0x25e64c,_0xfd544a){if(_0x1b73d1[_0x9edd('0x13')](_0x9edd('0x14'))){_0x1b73d1[_0x9edd('0xe')]=_0x1b73d1[_0x9edd('0x14')]?moment()['format'](_0x9edd('0x12')):null;}if(_0x1b73d1[_0x9edd('0x13')](_0x9edd('0x10'))){_0x1b73d1[_0x9edd('0x11')]=moment()[_0x9edd('0xf')](_0x9edd('0x12'));_0x1b73d1[_0x9edd('0x14')]=null;_0x1b73d1[_0x9edd('0xe')]=null;}_0xfd544a(null,_0x1b73d1);},'afterUpdate':function(_0x4ea60f,_0x5f5bf4,_0x448996){var _0x449cee=_0x268f9e['models'];var _0x1b54c0=_0x4ea60f[_0x9edd('0x15')]({'plain':!![]});if(_0x1b54c0[_0x9edd('0x10')]){return _0x449cee['MailMessage'][_0x9edd('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x1b54c0['id']}})['then'](function(){_0x448996();})[_0x9edd('0x17')](function(_0x1083e4){_0x448996(_0x1083e4);});}else{_0x448996();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xedd9=['subject','FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','get','update','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','MailInteraction','fti_mail_interactions'];(function(_0x269485,_0x482fbe){var _0x2c8409=function(_0x3bbfc6){while(--_0x3bbfc6){_0x269485['push'](_0x269485['shift']());}};_0x2c8409(++_0x482fbe);}(_0xedd9,0xfc));var _0x9edd=function(_0x41cc38,_0xe74996){_0x41cc38=_0x41cc38-0x0;var _0x41f3fa=_0xedd9[_0x41cc38];return _0x41f3fa;};'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':'mail_interactions','paranoid':![],'indexes':[{'name':_0x9edd('0xb'),'fields':[_0x9edd('0xc'),'to'],'type':_0x9edd('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3280fd,_0x49d5e3,_0x494a24){if(_0x3280fd['substatus']){_0x3280fd[_0x9edd('0xe')]=moment()[_0x9edd('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3280fd[_0x9edd('0x10')]){_0x3280fd[_0x9edd('0x11')]=moment()['format'](_0x9edd('0x12'));}_0x494a24(null,_0x49d5e3);},'beforeUpdate':function(_0x1b73d1,_0x25e64c,_0xfd544a){if(_0x1b73d1[_0x9edd('0x13')](_0x9edd('0x14'))){_0x1b73d1[_0x9edd('0xe')]=_0x1b73d1[_0x9edd('0x14')]?moment()['format'](_0x9edd('0x12')):null;}if(_0x1b73d1[_0x9edd('0x13')](_0x9edd('0x10'))){_0x1b73d1[_0x9edd('0x11')]=moment()[_0x9edd('0xf')](_0x9edd('0x12'));_0x1b73d1[_0x9edd('0x14')]=null;_0x1b73d1[_0x9edd('0xe')]=null;}_0xfd544a(null,_0x1b73d1);},'afterUpdate':function(_0x4ea60f,_0x5f5bf4,_0x448996){var _0x449cee=_0x268f9e['models'];var _0x1b54c0=_0x4ea60f[_0x9edd('0x15')]({'plain':!![]});if(_0x1b54c0[_0x9edd('0x10')]){return _0x449cee['MailMessage'][_0x9edd('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x1b54c0['id']}})['then'](function(){_0x448996();})[_0x9edd('0x17')](function(_0x1083e4){_0x448996(_0x1083e4);});}else{_0x448996();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index dd8558f..f996333 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 _0x6b61=['../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','catch','UpdateMailInteraction','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','debug','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0x6b61,0x16a));var _0x16b6=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x6b61[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0x16b6('0x0'));var util=require('util');var moment=require(_0x16b6('0x1'));var BPromise=require(_0x16b6('0x2'));var rs=require(_0x16b6('0x3'));var fs=require('fs');var Redis=require(_0x16b6('0x4'));var db=require(_0x16b6('0x5'))['db'];var utils=require(_0x16b6('0x6'));var logger=require(_0x16b6('0x7'))(_0x16b6('0x8'));var config=require('../../config/environment');var jayson=require(_0x16b6('0x9'));var client=jayson[_0x16b6('0xa')]['http']({'port':0x232a});config[_0x16b6('0xb')]=_[_0x16b6('0xc')](config['redis'],{'host':_0x16b6('0xd'),'port':0x18eb});var socket=require(_0x16b6('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x282385,_0x4cdac4,_0x95f3c5){return new BPromise(function(_0x33f15f,_0xdc323d){return client[_0x16b6('0xf')](_0x282385,_0x95f3c5)[_0x16b6('0x10')](function(_0x2114e4){logger[_0x16b6('0x11')]('MailInteraction,\x20%s,\x20%s',_0x4cdac4,'request\x20sent');logger['debug'](_0x16b6('0x12'),_0x4cdac4,_0x16b6('0x13'),JSON[_0x16b6('0x14')](_0x2114e4));if(_0x2114e4[_0x16b6('0x15')]){if(_0x2114e4[_0x16b6('0x15')][_0x16b6('0x16')]===0x1f4){logger[_0x16b6('0x15')]('MailInteraction,\x20%s,\x20%s',_0x4cdac4,_0x2114e4[_0x16b6('0x15')]['message']);return _0xdc323d(_0x2114e4['error']['message']);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x4cdac4,_0x2114e4['error'][_0x16b6('0x17')]);return _0x33f15f(_0x2114e4['error']['message']);}else{logger['info'](_0x16b6('0x18'),_0x4cdac4,_0x16b6('0x13'));_0x33f15f(_0x2114e4[_0x16b6('0x19')][_0x16b6('0x17')]);}})[_0x16b6('0x1a')](function(_0x1302f3){logger[_0x16b6('0x15')](_0x16b6('0x18'),_0x4cdac4,_0x1302f3);_0xdc323d(_0x1302f3);});});}exports[_0x16b6('0x1b')]=function(_0x478ea1){var _0x3ccdfa=this;return new Promise(function(_0x4a8c64,_0x5307d1){return db['MailInteraction']['update'](_0x478ea1[_0x16b6('0x1c')],{'raw':_0x478ea1[_0x16b6('0x1d')]?_0x478ea1[_0x16b6('0x1d')][_0x16b6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x478ea1[_0x16b6('0x1d')]?_0x478ea1[_0x16b6('0x1d')][_0x16b6('0x1f')]||null:null,'attributes':_0x478ea1[_0x16b6('0x1d')]?_0x478ea1['options'][_0x16b6('0x20')]||null:null,'limit':_0x478ea1[_0x16b6('0x1d')]?_0x478ea1['options'][_0x16b6('0x21')]||null:null})[_0x16b6('0x10')](function(_0x59a461){logger[_0x16b6('0x11')](_0x16b6('0x1b'),_0x478ea1);logger['debug'](_0x16b6('0x1b'),_0x478ea1,JSON[_0x16b6('0x14')](_0x59a461));_0x4a8c64(_0x59a461);})['catch'](function(_0x4394e9){logger[_0x16b6('0x15')](_0x16b6('0x1b'),_0x4394e9[_0x16b6('0x17')],_0x478ea1);_0x5307d1(_0x3ccdfa['error'](0x1f4,_0x4394e9[_0x16b6('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x372843){return new Promise(function(_0x48c4e2,_0x43c77a){return db['MailInteraction'][_0x16b6('0x22')]({'where':_0x372843[_0x16b6('0x1d')]?_0x372843[_0x16b6('0x1d')][_0x16b6('0x1f')]||null:null})['then'](function(_0x58aca6){if(_0x58aca6){return _0x58aca6[_0x16b6('0x23')](_0x372843[_0x16b6('0x1c')][_0x16b6('0x24')],_[_0x16b6('0x25')](_0x372843[_0x16b6('0x1c')],[_0x16b6('0x24'),'id'])||{});}})[_0x16b6('0x26')](function(_0x25840b){logger[_0x16b6('0x11')]('AddTags',_0x372843);logger[_0x16b6('0x27')](_0x16b6('0x28'),_0x372843,JSON[_0x16b6('0x14')](_0x25840b));_0x48c4e2(_0x25840b);})[_0x16b6('0x1a')](function(_0x3519cc){logger[_0x16b6('0x15')]('AddTags',_0x3519cc[_0x16b6('0x17')],_0x372843);_0x43c77a(_this[_0x16b6('0x15')](0x1f4,_0x3519cc['message']));});});}; \ No newline at end of file +var _0xed8a=['error','code','message','info','result','catch','UpdateMailInteraction','update','options','raw','attributes','limit','AddTagsToMailInteraction','MailInteraction','find','where','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5ca8f0,_0x82aef){var _0x214539=function(_0xe82a6){while(--_0xe82a6){_0x5ca8f0['push'](_0x5ca8f0['shift']());}};_0x214539(++_0x82aef);}(_0xed8a,0xc5));var _0xaed8=function(_0x2b7bf9,_0x30711d){_0x2b7bf9=_0x2b7bf9-0x0;var _0x2983c8=_0xed8a[_0x2b7bf9];return _0x2983c8;};'use strict';var _=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var moment=require(_0xaed8('0x2'));var BPromise=require(_0xaed8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaed8('0x4'));var db=require(_0xaed8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaed8('0x6'))(_0xaed8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaed8('0x8')][_0xaed8('0x9')]({'port':0x232a});config[_0xaed8('0xa')]=_[_0xaed8('0xb')](config[_0xaed8('0xa')],{'host':_0xaed8('0xc'),'port':0x18eb});var socket=require(_0xaed8('0xd'))(new Redis(config['redis']));require(_0xaed8('0xe'))[_0xaed8('0xf')](socket);function respondWithRpcPromise(_0x347f88,_0x5dce71,_0xf51777){return new BPromise(function(_0x29b08a,_0x1385ef){return client[_0xaed8('0x10')](_0x347f88,_0xf51777)[_0xaed8('0x11')](function(_0x55f38f){logger['info'](_0xaed8('0x12'),_0x5dce71,'request\x20sent');logger[_0xaed8('0x13')](_0xaed8('0x14'),_0x5dce71,_0xaed8('0x15'),JSON[_0xaed8('0x16')](_0x55f38f));if(_0x55f38f['error']){if(_0x55f38f[_0xaed8('0x17')][_0xaed8('0x18')]===0x1f4){logger[_0xaed8('0x17')](_0xaed8('0x12'),_0x5dce71,_0x55f38f[_0xaed8('0x17')][_0xaed8('0x19')]);return _0x1385ef(_0x55f38f['error'][_0xaed8('0x19')]);}logger['error'](_0xaed8('0x12'),_0x5dce71,_0x55f38f[_0xaed8('0x17')]['message']);return _0x29b08a(_0x55f38f[_0xaed8('0x17')][_0xaed8('0x19')]);}else{logger[_0xaed8('0x1a')](_0xaed8('0x12'),_0x5dce71,_0xaed8('0x15'));_0x29b08a(_0x55f38f[_0xaed8('0x1b')][_0xaed8('0x19')]);}})[_0xaed8('0x1c')](function(_0x2676a2){logger[_0xaed8('0x17')](_0xaed8('0x12'),_0x5dce71,_0x2676a2);_0x1385ef(_0x2676a2);});});}exports[_0xaed8('0x1d')]=function(_0x16aa06){var _0x39ca9e=this;return new Promise(function(_0x2095ae,_0x48828f){return db['MailInteraction'][_0xaed8('0x1e')](_0x16aa06['body'],{'raw':_0x16aa06[_0xaed8('0x1f')]?_0x16aa06[_0xaed8('0x1f')][_0xaed8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16aa06[_0xaed8('0x1f')]?_0x16aa06['options']['where']||null:null,'attributes':_0x16aa06['options']?_0x16aa06[_0xaed8('0x1f')][_0xaed8('0x21')]||null:null,'limit':_0x16aa06[_0xaed8('0x1f')]?_0x16aa06[_0xaed8('0x1f')][_0xaed8('0x22')]||null:null})[_0xaed8('0x11')](function(_0x290b32){logger[_0xaed8('0x1a')](_0xaed8('0x1d'),_0x16aa06);logger['debug'](_0xaed8('0x1d'),_0x16aa06,JSON[_0xaed8('0x16')](_0x290b32));_0x2095ae(_0x290b32);})[_0xaed8('0x1c')](function(_0x14cd92){logger[_0xaed8('0x17')](_0xaed8('0x1d'),_0x14cd92['message'],_0x16aa06);_0x48828f(_0x39ca9e[_0xaed8('0x17')](0x1f4,_0x14cd92['message']));});});};exports[_0xaed8('0x23')]=function(_0x5d80c7){return new Promise(function(_0x34c7ff,_0x4b25d9){return db[_0xaed8('0x24')][_0xaed8('0x25')]({'where':_0x5d80c7[_0xaed8('0x1f')]?_0x5d80c7[_0xaed8('0x1f')][_0xaed8('0x26')]||null:null})[_0xaed8('0x11')](function(_0x105376){if(_0x105376){return _0x105376[_0xaed8('0x27')](_0x5d80c7[_0xaed8('0x28')][_0xaed8('0x29')],_['omit'](_0x5d80c7[_0xaed8('0x28')],[_0xaed8('0x29'),'id'])||{});}})[_0xaed8('0x2a')](function(_0x135139){logger[_0xaed8('0x1a')]('AddTags',_0x5d80c7);logger[_0xaed8('0x13')](_0xaed8('0x2b'),_0x5d80c7,JSON[_0xaed8('0x16')](_0x135139));_0x34c7ff(_0x135139);})[_0xaed8('0x1c')](function(_0x1b0237){logger[_0xaed8('0x17')]('AddTags',_0x1b0237['message'],_0x5d80c7);_0x4b25d9(_this[_0xaed8('0x17')](0x1f4,_0x1b0237[_0xaed8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6ad1d22..1c2a955 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 _0x208f=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x251d69,_0x2c3d00){var _0x43d387=function(_0x1da961){while(--_0x1da961){_0x251d69['push'](_0x251d69['shift']());}};_0x43d387(++_0x2c3d00);}(_0x208f,0xd7));var _0xf208=function(_0x830e7c,_0x295a4f){_0x830e7c=_0x830e7c-0x0;var _0x23cc5c=_0x208f[_0x830e7c];return _0x23cc5c;};'use strict';var MailInteractionEvents=require(_0xf208('0x0'));var events=[_0xf208('0x1'),_0xf208('0x2'),_0xf208('0x3')];function createListener(_0x2fad97,_0x430ab5){return function(_0x464931){_0x430ab5[_0xf208('0x4')](_0x2fad97,_0x464931);};}function removeListener(_0x5e6d69,_0x3374aa){return function(){MailInteractionEvents[_0xf208('0x5')](_0x5e6d69,_0x3374aa);};}exports[_0xf208('0x6')]=function(_0x1cc687){for(var _0x3a1041=0x0,_0x178414=events[_0xf208('0x7')];_0x3a1041<_0x178414;_0x3a1041++){var _0x5a668a=events[_0x3a1041];var _0x4bac63=createListener(_0xf208('0x8')+_0x5a668a,_0x1cc687);MailInteractionEvents['on'](_0x5a668a,_0x4bac63);}}; \ No newline at end of file +var _0x3def=['emit','removeListener','register','length','mailInteraction:','remove','update'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x3def,0x163));var _0xf3de=function(_0x11e617,_0x2006b4){_0x11e617=_0x11e617-0x0;var _0x596054=_0x3def[_0x11e617];return _0x596054;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xf3de('0x0'),_0xf3de('0x1')];function createListener(_0x52c153,_0x343999){return function(_0x17f275){_0x343999[_0xf3de('0x2')](_0x52c153,_0x17f275);};}function removeListener(_0x1c3418,_0x15aa4c){return function(){MailInteractionEvents[_0xf3de('0x3')](_0x1c3418,_0x15aa4c);};}exports[_0xf3de('0x4')]=function(_0x15a6eb){for(var _0x4311c3=0x0,_0x3e7ebf=events[_0xf3de('0x5')];_0x4311c3<_0x3e7ebf;_0x4311c3++){var _0x2b757b=events[_0x4311c3];var _0x3b5c75=createListener(_0xf3de('0x6')+_0x2b757b,_0x15a6eb);MailInteractionEvents['on'](_0x2b757b,_0x3b5c75);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7275b16..9c39579 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 _0x4b84=['express','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id','put','accept','/:id/reject','delete','destroy','multer','util'];(function(_0x453c63,_0x1ceeff){var _0x295eb9=function(_0x5ad2c1){while(--_0x5ad2c1){_0x453c63['push'](_0x453c63['shift']());}};_0x295eb9(++_0x1ceeff);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0x4b84[_0x4a45b4];return _0x1a99c9;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/describe',auth[_0x44b8('0x7')](),controller['describe']);router[_0x44b8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router[_0x44b8('0x6')](_0x44b8('0x9'),auth['isAuthenticated'](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth[_0x44b8('0x7')](),interaction[_0x44b8('0xc')](_0x44b8('0xd'),_0x44b8('0xe')),controller[_0x44b8('0xf')]);router['put'](_0x44b8('0x10'),auth[_0x44b8('0x7')](),controller['update']);router[_0x44b8('0x11')]('/:id/accept',auth[_0x44b8('0x7')](),controller[_0x44b8('0x12')]);router['put'](_0x44b8('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x44b8('0x14')](_0x44b8('0x10'),auth[_0x44b8('0x7')](),controller[_0x44b8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9f62=['./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id/download','tracked','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../config/environment'];(function(_0x537044,_0x4de18f){var _0x5ba75e=function(_0x58cccc){while(--_0x58cccc){_0x537044['push'](_0x537044['shift']());}};_0x5ba75e(++_0x4de18f);}(_0x9f62,0x154));var _0x29f6=function(_0x45b489,_0x2c7482){_0x45b489=_0x45b489-0x0;var _0x32527f=_0x9f62[_0x45b489];return _0x32527f;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller['download']);router['post']('/',auth[_0x29f6('0x7')](),interaction[_0x29f6('0xb')]('mail',_0x29f6('0xc')),controller[_0x29f6('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x29f6('0xe')](_0x29f6('0xf'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x10')]);router[_0x29f6('0xe')](_0x29f6('0x11'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x12')]);router[_0x29f6('0x13')](_0x29f6('0x14'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x15')]);module[_0x29f6('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 929b34d..54bcd09 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 _0xc6d7=['out','STRING','long','INTEGER','DATE','sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x4ea16d,_0x27c8d8){var _0x207d7f=function(_0xc960ff){while(--_0xc960ff){_0x4ea16d['push'](_0x4ea16d['shift']());}};_0x207d7f(++_0x27c8d8);}(_0xc6d7,0x71));var _0x7c6d=function(_0x294365,_0x274280){_0x294365=_0x294365-0x0;var _0x33a59b=_0xc6d7[_0x294365];return _0x33a59b;};'use strict';var Sequelize=require(_0x7c6d('0x0'));var _=require(_0x7c6d('0x1'));module[_0x7c6d('0x2')]={'body':{'type':Sequelize[_0x7c6d('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x7c6d('0x4'))},'read':{'type':Sequelize[_0x7c6d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7c6d('0x6')]('in',_0x7c6d('0x7')),'defaultValue':_0x7c6d('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7c6d('0x8')](0x1fe)},'from':{'type':Sequelize[_0x7c6d('0x8')]},'to':{'type':Sequelize[_0x7c6d('0x3')](_0x7c6d('0x9'))},'cc':{'type':Sequelize[_0x7c6d('0x3')](_0x7c6d('0x9'))},'bcc':{'type':Sequelize[_0x7c6d('0x3')](_0x7c6d('0x9'))},'subject':{'type':Sequelize[_0x7c6d('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x7c6d('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7c6d('0xb')]},'originTo':{'type':Sequelize[_0x7c6d('0x3')](_0x7c6d('0x9'))},'originCc':{'type':Sequelize[_0x7c6d('0x3')]('long')}}; \ No newline at end of file +var _0xcd2f=['ENUM','out','STRING','DATE','INTEGER','TEXT','long','medium','BOOLEAN'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xcd2f[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xfcd2('0x0')](_0xfcd2('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfcd2('0x0')](_0xfcd2('0x2'))},'read':{'type':Sequelize[_0xfcd2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfcd2('0x4')]('in',_0xfcd2('0x5')),'defaultValue':_0xfcd2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xfcd2('0x6')]},'to':{'type':Sequelize[_0xfcd2('0x0')](_0xfcd2('0x1'))},'cc':{'type':Sequelize[_0xfcd2('0x0')](_0xfcd2('0x1'))},'bcc':{'type':Sequelize[_0xfcd2('0x0')](_0xfcd2('0x1'))},'subject':{'type':Sequelize[_0xfcd2('0x0')]},'sentAt':{'type':Sequelize[_0xfcd2('0x7')]},'attach':{'type':Sequelize[_0xfcd2('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfcd2('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xfcd2('0x0')](_0xfcd2('0x1'))},'originCc':{'type':Sequelize[_0xfcd2('0x0')](_0xfcd2('0x1'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 5eadf45..6b5bba6 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 _0xb9da=['catch','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','offset','order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','params','rawAttributes','find','body','describe','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','List','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','Contacts','CmContact','List\x20not\x20found','SendMail','sendMail','format','stringify','mail-interactions','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','MailInteractionId','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','mail','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','files','tmp','message-%s.eml','from','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','build','writeFileSync','log','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.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','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x22b074,_0x1aba22){var _0x28e8cb=function(_0x44e560){while(--_0x44e560){_0x22b074['push'](_0x22b074['shift']());}};_0x28e8cb(++_0x1aba22);}(_0xb9da,0x1d6));var _0xab9d=function(_0x3dd991,_0x4bef12){_0x3dd991=_0x3dd991-0x0;var _0x251609=_0xb9da[_0x3dd991];return _0x251609;};'use strict';var pdf=require(_0xab9d('0x0'));var emlformat=require(_0xab9d('0x1'));var rimraf=require(_0xab9d('0x2'));var zipdir=require(_0xab9d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab9d('0x4'));var moment=require(_0xab9d('0x5'));var BPromise=require(_0xab9d('0x6'));var Mustache=require(_0xab9d('0x7'));var util=require('util');var path=require('path');var sox=require(_0xab9d('0x8'));var csv=require(_0xab9d('0x9'));var ejs=require(_0xab9d('0xa'));var fs=require('fs');var _=require(_0xab9d('0xb'));var squel=require(_0xab9d('0xc'));var crypto=require(_0xab9d('0xd'));var jsforce=require(_0xab9d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xab9d('0x9'));var querystring=require('querystring');var Papa=require(_0xab9d('0xf'));var Redis=require(_0xab9d('0x10'));var authService=require(_0xab9d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xab9d('0x12'));var hardwareService=require(_0xab9d('0x13'));var logger=require(_0xab9d('0x14'))(_0xab9d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xab9d('0x16'))['db'];config[_0xab9d('0x17')]=_[_0xab9d('0x18')](config[_0xab9d('0x17')],{'host':_0xab9d('0x19'),'port':0x18eb});var socket=require(_0xab9d('0x1a'))(new Redis(config[_0xab9d('0x17')]));require(_0xab9d('0x1b'))['register'](socket);var jayson=require(_0xab9d('0x1c'));var client=jayson[_0xab9d('0x1d')]['http']({'port':0x232c});var client9003=jayson[_0xab9d('0x1d')]['http']({'port':0x232b});var client9002=jayson[_0xab9d('0x1d')][_0xab9d('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x54a6ba,_0x54668f,_0x251726){if(_0x251726){var _0x3616ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3616ad[_0xab9d('0x1f')](_0x54668f)){return _0x54a6ba;}else{throw new db[(_0xab9d('0x20'))][(_0xab9d('0x21'))](_0xab9d('0x22'));}}else{return _0x54a6ba;}}function respondWithRpcPromise(_0x59250a,_0x51a404,_0x57f0af,_0x19f38f){return new BPromise(function(_0x4c7a61,_0x107572){var _0x2bc72e=_0x19f38f||client;return _0x2bc72e[_0xab9d('0x23')](_0x59250a,_0x57f0af)[_0xab9d('0x24')](function(_0x48db08){logger['info'](_0xab9d('0x25'),_0x51a404,'request\x20sent');logger[_0xab9d('0x26')](_0xab9d('0x27'),_0x51a404,_0xab9d('0x28'),JSON['stringify'](_0x48db08));if(_0x48db08['error']){if(_0x48db08[_0xab9d('0x29')][_0xab9d('0x2a')]===0x1f4){logger[_0xab9d('0x29')](_0xab9d('0x25'),_0x51a404,_0x48db08[_0xab9d('0x29')][_0xab9d('0x2b')]);return _0x107572(_0x48db08[_0xab9d('0x29')][_0xab9d('0x2b')]);}logger['error'](_0xab9d('0x25'),_0x51a404,_0x48db08[_0xab9d('0x29')]['message']);return _0x4c7a61(_0x48db08[_0xab9d('0x29')][_0xab9d('0x2b')]);}else{logger[_0xab9d('0x2c')]('MailMessage,\x20%s,\x20%s',_0x51a404,_0xab9d('0x28'));_0x4c7a61(_0x48db08[_0xab9d('0x2d')]['message']);}})[_0xab9d('0x2e')](function(_0x3e5826){logger[_0xab9d('0x29')]('MailMessage,\x20%s,\x20%s',_0x51a404,_0x3e5826);_0x107572(_0x3e5826);});});}function respondWithStatusCode(_0x5d3ca5,_0x421903){_0x421903=_0x421903||0xcc;return function(_0x2fdc2f){if(_0x2fdc2f){return _0x5d3ca5[_0xab9d('0x2f')](_0x421903);}return _0x5d3ca5[_0xab9d('0x30')](_0x421903)[_0xab9d('0x31')]();};}function respondWithResult(_0x196915,_0x1d47ea){_0x1d47ea=_0x1d47ea||0xc8;return function(_0x250d4a){if(_0x250d4a){return _0x196915['status'](_0x1d47ea)[_0xab9d('0x32')](_0x250d4a);}};}function respondWithFilteredResult(_0x48d74f,_0x17c203){return function(_0x2815d0){if(_0x2815d0){var _0x38c0a3=_0x2815d0['count'],_0xa13704=_0x17c203['offset'],_0x4f3f80=_0x17c203['offset']+_0x17c203[_0xab9d('0x33')],_0x1828f5;if(_0x4f3f80>=_0x38c0a3){_0x4f3f80=_0x38c0a3;_0x1828f5=0xc8;}else{_0x1828f5=0xce;}_0x48d74f[_0xab9d('0x30')](_0x1828f5);return _0x48d74f[_0xab9d('0x34')](_0xab9d('0x35'),_0xa13704+'-'+_0x4f3f80+'/'+_0x38c0a3)[_0xab9d('0x32')](_0x2815d0);}return null;};}function patchUpdates(_0x1a133b){return function(_0x5eaa20){try{jsonpatch[_0xab9d('0x36')](_0x5eaa20,_0x1a133b,!![]);}catch(_0x13d300){return BPromise[_0xab9d('0x37')](_0x13d300);}return _0x5eaa20[_0xab9d('0x38')]();};}function saveUpdates(_0x1ee2f9,_0x21546e){return function(_0x437122){if(_0x437122){return _0x437122[_0xab9d('0x39')](_0x1ee2f9)['then'](function(_0x3a286d){return _0x3a286d;});}return null;};}function removeEntity(_0x21694f,_0x1ea49){return function(_0x247e7b){if(_0x247e7b){return _0x247e7b[_0xab9d('0x3a')]()[_0xab9d('0x24')](function(){_0x21694f[_0xab9d('0x30')](0xcc)[_0xab9d('0x31')]();});}};}function handleEntityNotFound(_0x25858f,_0x4868b2){return function(_0x4f9d3a){if(!_0x4f9d3a){_0x25858f[_0xab9d('0x2f')](0x194);}return _0x4f9d3a;};}function handleError(_0x5ee01a,_0xab5b68){_0xab5b68=_0xab5b68||0x1f4;return function(_0x38cd54){logger['error'](_0x38cd54[_0xab9d('0x3b')]);if(_0x38cd54[_0xab9d('0x3c')]){delete _0x38cd54[_0xab9d('0x3c')];}_0x5ee01a[_0xab9d('0x30')](_0xab5b68)[_0xab9d('0x3d')](_0x38cd54);};}exports[_0xab9d('0x3e')]=function(_0x331281,_0x378054){var _0xd001f3={},_0x5904e1={},_0x174d00={'count':0x0,'rows':[]};var _0xbe7092=_[_0xab9d('0x3f')](db[_0xab9d('0x40')]['rawAttributes'],function(_0x4fe280){return{'name':_0x4fe280[_0xab9d('0x41')],'type':_0x4fe280[_0xab9d('0x42')][_0xab9d('0x43')]};});_0x5904e1[_0xab9d('0x44')]=_[_0xab9d('0x3f')](_0xbe7092,'name');_0x5904e1[_0xab9d('0x45')]=_[_0xab9d('0x46')](_0x331281[_0xab9d('0x45')]);_0x5904e1[_0xab9d('0x47')]=_[_0xab9d('0x48')](_0x5904e1[_0xab9d('0x44')],_0x5904e1['query']);_0xd001f3['attributes']=_[_0xab9d('0x48')](_0x5904e1[_0xab9d('0x44')],qs[_0xab9d('0x49')](_0x331281[_0xab9d('0x45')][_0xab9d('0x49')]));_0xd001f3[_0xab9d('0x4a')]=_0xd001f3[_0xab9d('0x4a')][_0xab9d('0x4b')]?_0xd001f3[_0xab9d('0x4a')]:_0x5904e1[_0xab9d('0x44')];if(!_0x331281[_0xab9d('0x45')]['hasOwnProperty']('nolimit')){_0xd001f3[_0xab9d('0x33')]=qs[_0xab9d('0x33')](_0x331281[_0xab9d('0x45')]['limit']);_0xd001f3[_0xab9d('0x4c')]=qs[_0xab9d('0x4c')](_0x331281[_0xab9d('0x45')][_0xab9d('0x4c')]);}_0xd001f3[_0xab9d('0x4d')]=qs[_0xab9d('0x4e')](_0x331281[_0xab9d('0x45')][_0xab9d('0x4e')]);_0xd001f3['where']=qs[_0xab9d('0x47')](_['pick'](_0x331281[_0xab9d('0x45')],_0x5904e1[_0xab9d('0x47')]),_0xbe7092);if(_0x331281['query'][_0xab9d('0x4f')]){_0xd001f3[_0xab9d('0x50')]=_[_0xab9d('0x51')](_0xd001f3[_0xab9d('0x50')],{'$or':_[_0xab9d('0x3f')](_0xbe7092,function(_0x122fa8){if(_0x122fa8[_0xab9d('0x42')]!==_0xab9d('0x52')){var _0x279ebf={};_0x279ebf[_0x122fa8['name']]={'$like':'%'+_0x331281[_0xab9d('0x45')][_0xab9d('0x4f')]+'%'};return _0x279ebf;}})});}_0xd001f3=_[_0xab9d('0x51')]({},_0xd001f3,_0x331281[_0xab9d('0x53')]);var _0x279957={'where':_0xd001f3[_0xab9d('0x50')]};return db[_0xab9d('0x40')][_0xab9d('0x54')](_0x279957)[_0xab9d('0x24')](function(_0x348184){_0x174d00['count']=_0x348184;if(_0x331281[_0xab9d('0x45')][_0xab9d('0x55')]){_0xd001f3[_0xab9d('0x56')]=[{'all':!![]}];}return db[_0xab9d('0x40')][_0xab9d('0x57')](_0xd001f3);})['then'](function(_0x4e9809){_0x174d00['rows']=_0x4e9809;return _0x174d00;})[_0xab9d('0x24')](respondWithFilteredResult(_0x378054,_0xd001f3))['catch'](handleError(_0x378054,null));};exports['show']=function(_0x55eb40,_0x700acf){var _0x2a49ef={'raw':!![],'where':{'id':_0x55eb40[_0xab9d('0x58')]['id']}},_0xa728c1={};_0xa728c1[_0xab9d('0x44')]=_[_0xab9d('0x46')](db[_0xab9d('0x40')][_0xab9d('0x59')]);_0xa728c1[_0xab9d('0x45')]=_[_0xab9d('0x46')](_0x55eb40['query']);_0xa728c1[_0xab9d('0x47')]=_[_0xab9d('0x48')](_0xa728c1['model'],_0xa728c1[_0xab9d('0x45')]);_0x2a49ef[_0xab9d('0x4a')]=_[_0xab9d('0x48')](_0xa728c1[_0xab9d('0x44')],qs[_0xab9d('0x49')](_0x55eb40[_0xab9d('0x45')]['fields']));_0x2a49ef[_0xab9d('0x4a')]=_0x2a49ef['attributes'][_0xab9d('0x4b')]?_0x2a49ef['attributes']:_0xa728c1[_0xab9d('0x44')];if(_0x55eb40[_0xab9d('0x45')][_0xab9d('0x55')]){_0x2a49ef[_0xab9d('0x56')]=[{'all':!![]}];}_0x2a49ef=_['merge']({},_0x2a49ef,_0x55eb40[_0xab9d('0x53')]);return db[_0xab9d('0x40')][_0xab9d('0x5a')](_0x2a49ef)[_0xab9d('0x24')](handleEntityNotFound(_0x700acf,null))[_0xab9d('0x24')](respondWithResult(_0x700acf,null))[_0xab9d('0x2e')](handleError(_0x700acf,null));};exports['update']=function(_0x3bf0f8,_0x4b09b6){if(_0x3bf0f8[_0xab9d('0x5b')]['id']){delete _0x3bf0f8[_0xab9d('0x5b')]['id'];}return db[_0xab9d('0x40')]['find']({'where':{'id':_0x3bf0f8[_0xab9d('0x58')]['id']}})['then'](handleEntityNotFound(_0x4b09b6,null))[_0xab9d('0x24')](saveUpdates(_0x3bf0f8['body'],null))[_0xab9d('0x24')](respondWithResult(_0x4b09b6,null))[_0xab9d('0x2e')](handleError(_0x4b09b6,null));};exports['destroy']=function(_0x2c9445,_0x411c8d){return db[_0xab9d('0x40')]['find']({'where':{'id':_0x2c9445[_0xab9d('0x58')]['id']}})['then'](handleEntityNotFound(_0x411c8d,null))[_0xab9d('0x24')](removeEntity(_0x411c8d,null))[_0xab9d('0x2e')](handleError(_0x411c8d,null));};exports[_0xab9d('0x5c')]=function(_0x261683,_0x52c7f0){return db[_0xab9d('0x40')][_0xab9d('0x5c')]()['then'](respondWithResult(_0x52c7f0,null))[_0xab9d('0x2e')](handleError(_0x52c7f0,null));};exports[_0xab9d('0x5d')]=function(_0x819d96,_0x44a311){return db['MailMessage'][_0xab9d('0x5d')](_0x819d96[_0xab9d('0x5b')])[_0xab9d('0x24')](function(_0x585ecc){if(_0x585ecc){if(_0x585ecc[_0xab9d('0x5e')]==='out'&&!_0x585ecc[_0xab9d('0x5f')]){var _0x255a4e,_0x504fa3,_0x6b6f78;if(_0x819d96[_0xab9d('0x5b')]['to']){_0x504fa3=_0x819d96[_0xab9d('0x5b')]['to']['split'](',')[0x0];}return db[_0xab9d('0x60')][_0xab9d('0x61')]({'where':{'id':_0x585ecc[_0xab9d('0x62')]},'include':[{'model':db[_0xab9d('0x63')],'as':_0xab9d('0x64'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x504fa3},'limit':0x1,'order':[[_0xab9d('0x65'),_0xab9d('0x66')]]}]},{'model':db[_0xab9d('0x67')],'as':_0xab9d('0x68'),'raw':!![]}]})[_0xab9d('0x24')](function(_0x1d09a4){_0x255a4e=_0x1d09a4;if(_0x255a4e&&_0x255a4e[_0xab9d('0x68')]){var _0x2b4ba5={'tls':{'rejectUnauthorized':![]}};if(_[_0xab9d('0x69')](_0x255a4e['Smtp'][_0xab9d('0x6a')])){_0x2b4ba5[_0xab9d('0x6b')]=_0x255a4e[_0xab9d('0x68')][_0xab9d('0x6b')];_0x2b4ba5['port']=_0x255a4e[_0xab9d('0x68')][_0xab9d('0x6c')];_0x2b4ba5[_0xab9d('0x6d')]=_0x255a4e[_0xab9d('0x68')][_0xab9d('0x6d')];if(_0x255a4e[_0xab9d('0x68')][_0xab9d('0x6e')]){_0x2b4ba5[_0xab9d('0x6f')]={'user':_0x255a4e[_0xab9d('0x68')][_0xab9d('0x70')],'pass':_0x255a4e[_0xab9d('0x68')][_0xab9d('0x71')]};}}else{_0x2b4ba5['service']=_0x255a4e[_0xab9d('0x68')][_0xab9d('0x6a')];_0x2b4ba5[_0xab9d('0x6f')]={'user':_0x255a4e[_0xab9d('0x68')][_0xab9d('0x70')],'pass':_0x255a4e['Smtp']['pass']};_0x2b4ba5[_0xab9d('0x6d')]=_0x255a4e[_0xab9d('0x68')][_0xab9d('0x6d')];}if(_0x819d96[_0xab9d('0x5b')][_0xab9d('0x72')]&&_0x819d96[_0xab9d('0x5b')][_0xab9d('0x72')]['length']){for(var _0x2a6ad4=0x0;_0x2a6ad4<_0x819d96[_0xab9d('0x5b')][_0xab9d('0x72')][_0xab9d('0x4b')];_0x2a6ad4+=0x1){_0x819d96[_0xab9d('0x5b')][_0xab9d('0x72')][_0x2a6ad4]={'filename':_0x819d96['body']['attachments'][_0x2a6ad4][_0xab9d('0x3c')],'path':path[_0xab9d('0x73')](config[_0xab9d('0x74')],_0xab9d('0x75'),_0x819d96[_0xab9d('0x5b')][_0xab9d('0x72')][_0x2a6ad4][_0xab9d('0x76')])};}}_0x6b6f78={'account':_0x2b4ba5,'message':_0x819d96[_0xab9d('0x5b')]};return;}})[_0xab9d('0x24')](function(){if(_0x255a4e[_0xab9d('0x64')]){if(_0x255a4e[_0xab9d('0x64')][_0xab9d('0x77')][_0xab9d('0x4b')]){return _0x255a4e[_0xab9d('0x64')]['Contacts'][0x0];}else{return db[_0xab9d('0x78')][_0xab9d('0x5d')](_[_0xab9d('0x18')](_0x819d96['body'],{'firstName':_0x819d96[_0xab9d('0x5b')]['to'],'email':_0x819d96[_0xab9d('0x5b')]['to'],'phone':_0x819d96['body']['to'],'ListId':_0x255a4e['ListId']}));}}else{throw new Error(_0xab9d('0x79'));}})['then'](function(){if(_0x6b6f78){return respondWithRpcPromise(_0xab9d('0x7a'),_0xab9d('0x7b'),_0x6b6f78,client9003)[_0xab9d('0x24')](function(_0x22399b){return _0x585ecc[_0xab9d('0x39')]({'read':!![],'messageId':_0x22399b['messageId'],'sentAt':moment()[_0xab9d('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xab9d('0x2e')](function(_0x3c92de){logger[_0xab9d('0x29')]('%s',JSON[_0xab9d('0x7d')](_0x3c92de));return _0x585ecc;});}return _0x585ecc;});}return _0x585ecc;}})['then'](respondWithResult(_0x44a311,0xc9))[_0xab9d('0x2e')](handleError(_0x44a311,null));};var interaction_log=require(_0xab9d('0x14'))(_0xab9d('0x7e'));exports[_0xab9d('0x7f')]=function(_0x29dfe1,_0x163d50,_0x552013){var _0x543822={'channel':'mail'};if(_0x29dfe1['body']['id']){delete _0x29dfe1[_0xab9d('0x5b')]['id'];}_0x29dfe1[_0xab9d('0x5b')]['read']=!![];_0x29dfe1[_0xab9d('0x5b')]['readAt']=moment()[_0xab9d('0x7c')](_0xab9d('0x80'));_0x29dfe1['body'][_0xab9d('0x81')]=_0x29dfe1[_0xab9d('0x5b')][_0xab9d('0x81')]||_0x29dfe1['user']['id'];return db[_0xab9d('0x40')][_0xab9d('0x5a')]({'where':{'id':_0x29dfe1['params']['id'],'UserId':null},'include':[{'model':db[_0xab9d('0x78')],'as':_0xab9d('0x82')}]})[_0xab9d('0x24')](handleEntityNotFound(_0x163d50,null))[_0xab9d('0x24')](saveUpdates(_0x29dfe1[_0xab9d('0x5b')],null))[_0xab9d('0x24')](function(_0x1ea06a){if(_0x1ea06a){_0x543822['message']=_0x1ea06a['get']({'plain':!![]});return db['MailInteraction'][_0xab9d('0x5a')]({'where':{'id':_0x1ea06a[_0xab9d('0x83')]}});}return null;})['then'](handleEntityNotFound(_0x163d50,null))[_0xab9d('0x24')](function(_0x23411c){if(_0x23411c){return _0x23411c['update']({'UserId':_0x29dfe1[_0xab9d('0x5b')][_0xab9d('0x81')],'read1stAt':_[_0xab9d('0x69')](_0x23411c[_0xab9d('0x84')])?moment()[_0xab9d('0x7c')](_0xab9d('0x80')):undefined});}return null;})[_0xab9d('0x24')](function(_0x3c7e2e){if(_0x3c7e2e){_0x543822['interaction']=_0x3c7e2e[_0xab9d('0x85')]({'plain':!![]});interaction_log[_0xab9d('0x2c')](_0xab9d('0x86'),_0x29dfe1[_0xab9d('0x70')]['id'],_0x29dfe1[_0xab9d('0x70')][_0xab9d('0x3c')],_0x29dfe1[_0xab9d('0x70')][_0xab9d('0x87')],_0x543822[_0xab9d('0x88')]['id'],_0x29dfe1[_0xab9d('0x5b')]?JSON['stringify'](_0x29dfe1[_0xab9d('0x5b')]):_0xab9d('0x89'));return respondWithRpcPromise(_0xab9d('0x8a'),_0xab9d('0x8b'),_0x543822);}return null;})[_0xab9d('0x24')](function(_0x314d45){if(_0x314d45){if(_0x29dfe1[_0xab9d('0x5b')][_0xab9d('0x8c')]){_0x543822[_0xab9d('0x2b')][_0xab9d('0x8d')]=util[_0xab9d('0x7c')]('SIP/%s',_0x29dfe1['user'][_0xab9d('0x3c')]);_0x543822[_0xab9d('0x2b')][_0xab9d('0x8e')]=_0x543822[_0xab9d('0x8e')];_0x543822[_0xab9d('0x2b')][_0xab9d('0x8f')]=_0xab9d('0x7f');return respondWithRpcPromise(_0xab9d('0x90'),_0xab9d('0x90'),{'event':_0xab9d('0x91'),'message':_0x543822[_0xab9d('0x2b')]},client9002)[_0xab9d('0x24')](function(){return _0x543822;});}return _0x543822;}return null;})[_0xab9d('0x24')](respondWithResult(_0x163d50,null))['catch'](handleError(_0x163d50,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports['reject']=function(_0x3a319b,_0x1c1253,_0x257c8d){var _0x5ad957={'agent':{},'channel':_0xab9d('0x92')};if(_0x3a319b[_0xab9d('0x5b')]['id']){delete _0x3a319b[_0xab9d('0x5b')]['id'];}_0x3a319b[_0xab9d('0x5b')]['UserId']=_0x3a319b[_0xab9d('0x5b')][_0xab9d('0x81')]||_0x3a319b['user']['id'];_0x5ad957[_0xab9d('0x93')]['id']=_0x3a319b[_0xab9d('0x5b')][_0xab9d('0x81')];return db['MailMessage'][_0xab9d('0x5a')]({'where':{'id':_0x3a319b[_0xab9d('0x58')]['id'],'UserId':null}})[_0xab9d('0x24')](handleEntityNotFound(_0x1c1253,null))[_0xab9d('0x24')](function(_0x4a9e47){if(_0x4a9e47){_0x5ad957[_0xab9d('0x2b')]=_0x4a9e47[_0xab9d('0x85')]({'plain':!![]});return db[_0xab9d('0x94')][_0xab9d('0x5a')]({'where':{'id':_0x4a9e47[_0xab9d('0x83')]}});}return null;})[_0xab9d('0x24')](handleEntityNotFound(_0x1c1253,null))['then'](function(_0x5980d7){if(_0x5980d7){_0x5ad957[_0xab9d('0x88')]=_0x5980d7['get']({'plain':!![]});interaction_log[_0xab9d('0x2c')](_0xab9d('0x95'),_0x3a319b['user']['id'],_0x3a319b['user'][_0xab9d('0x3c')],_0x3a319b[_0xab9d('0x70')][_0xab9d('0x87')],_0x5ad957[_0xab9d('0x88')]['id'],_0x3a319b[_0xab9d('0x5b')]?JSON[_0xab9d('0x7d')](_0x3a319b[_0xab9d('0x5b')]):_0xab9d('0x89'));return respondWithRpcPromise(_0xab9d('0x96'),_0xab9d('0x97'),_0x5ad957);}return null;})[_0xab9d('0x24')](function(_0xf3e0af){if(_0xf3e0af){_0xf3e0af['message']['interface']=util['format']('SIP/%s',_0x3a319b[_0xab9d('0x70')]['name']);_0xf3e0af['message'][_0xab9d('0x8e')]=_0x5ad957['channel'];_0xf3e0af[_0xab9d('0x2b')]['event']=_0xab9d('0x37');respondWithRpcPromise('EventManager',_0xab9d('0x90'),{'event':_0xab9d('0x98'),'message':_0xf3e0af[_0xab9d('0x2b')]},client9002);return _0x5ad957;}return null;})[_0xab9d('0x24')](respondWithResult(_0x1c1253,null))[_0xab9d('0x2e')](handleError(_0x1c1253,null));};exports[_0xab9d('0x99')]=function(_0x4c96b5,_0x775cef){var _0x715bfe=moment()[_0xab9d('0x9a')]()['toString']();var _0x29edd6=path[_0xab9d('0x73')](config[_0xab9d('0x74')],'server',_0xab9d('0x9b'),_0xab9d('0x9c'));var _0x190418=path[_0xab9d('0x73')](config['root'],'server',_0xab9d('0x9b'),_0xab9d('0x72'));var _0x44497b=util[_0xab9d('0x7c')](_0xab9d('0x9d'),_0x715bfe);return db[_0xab9d('0x40')]['find']({'where':{'id':_0x4c96b5[_0xab9d('0x58')]['id']},'attributes':['id',_0xab9d('0x5b'),_0xab9d('0x9e'),'to','cc','bcc','subject',_0xab9d('0x9f')],'include':_0x4c96b5['query'][_0xab9d('0x72')]?[{'model':db[_0xab9d('0xa0')],'as':_0xab9d('0xa1')}]:undefined})['then'](handleEntityNotFound(_0x775cef,null))[_0xab9d('0x24')](function(_0x2cdc2a){if(_0x2cdc2a){var _0x2f0aba=_0x2cdc2a;var _0x10ca54={'from':_0x2f0aba[_0xab9d('0x9e')],'to':_0x2f0aba['to'],'subject':_0x2f0aba[_0xab9d('0xa2')],'html':_0x2f0aba['body'],'headers':{'Date':moment(_0x2f0aba[_0xab9d('0x9f')])[_0xab9d('0x7c')](_0xab9d('0xa3'))},'attachments':[]};if(_0x2cdc2a['cc']){_0x10ca54[_0xab9d('0xa4')]['Cc']=_0x2cdc2a['cc'];}if(_0x2cdc2a[_0xab9d('0xa5')]){_0x10ca54[_0xab9d('0xa4')][_0xab9d('0xa6')]=_0x2cdc2a[_0xab9d('0xa5')];}return new BPromise(function(_0x103c53,_0x9fba10){if(_0x2cdc2a[_0xab9d('0xa1')]){for(var _0x5d06c7=0x0;_0x5d06c7<_0x2cdc2a[_0xab9d('0xa1')][_0xab9d('0x4b')];_0x5d06c7++){var _0x196f0f=_0x2cdc2a[_0xab9d('0xa1')][_0x5d06c7];var _0x5896ac=path[_0xab9d('0x73')](_0x190418,_0x196f0f[_0xab9d('0x76')]);if(fs[_0xab9d('0xa7')](_0x5896ac)){_0x10ca54[_0xab9d('0x72')][_0xab9d('0xa8')]({'name':_0x196f0f[_0xab9d('0x3c')],'contentType':_0x196f0f['type'],'data':fs['readFileSync'](_0x5896ac)});}}}emlformat[_0xab9d('0xa9')](_0x10ca54,function(_0x709783,_0x3bc985){if(_0x709783)return _0x9fba10(_0x709783);fs[_0xab9d('0xaa')](path[_0xab9d('0x73')](_0x29edd6,_0x44497b),_0x3bc985);return _0x103c53(_0x3bc985);});});}})['then'](function(_0x468f2c){if(_0x468f2c){return _0x775cef[_0xab9d('0x99')](path[_0xab9d('0x73')](_0x29edd6,_0x44497b),_0x44497b,function(_0x185da0){if(_0x185da0){console[_0xab9d('0xab')]('err',_0x185da0);}else{fs['unlinkSync'](path['join'](_0x29edd6,_0x44497b));}});}})[_0xab9d('0x2e')](handleError(_0x775cef,null));}; \ No newline at end of file +var _0x8ce1=['mail-interactions','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','MailInteraction','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','existsSync','build','writeFileSync','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','index','map','MailMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','catch','body','find','describe','direction','out','secret','findOne','MailAccountId','CmList','List','CmContact','Contacts','MailServerOut','Smtp','service','port','secure','authentication','pass','user','attachments','join','root','server/files/attachments','basename','create','defaults','List\x20not\x20found','SendMail','sendMail','messageId','../../config/logger'];(function(_0x1eb186,_0x3e8197){var _0x49079e=function(_0x2ebd6f){while(--_0x2ebd6f){_0x1eb186['push'](_0x1eb186['shift']());}};_0x49079e(++_0x3e8197);}(_0x8ce1,0x183));var _0x18ce=function(_0x5af34b,_0x2fb339){_0x5af34b=_0x5af34b-0x0;var _0x561667=_0x8ce1[_0x5af34b];return _0x561667;};'use strict';var pdf=require(_0x18ce('0x0'));var emlformat=require(_0x18ce('0x1'));var rimraf=require(_0x18ce('0x2'));var zipdir=require(_0x18ce('0x3'));var jsonpatch=require(_0x18ce('0x4'));var rp=require(_0x18ce('0x5'));var moment=require(_0x18ce('0x6'));var BPromise=require(_0x18ce('0x7'));var Mustache=require(_0x18ce('0x8'));var util=require(_0x18ce('0x9'));var path=require(_0x18ce('0xa'));var sox=require(_0x18ce('0xb'));var csv=require(_0x18ce('0xc'));var ejs=require(_0x18ce('0xd'));var fs=require('fs');var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xc'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var db=require(_0x18ce('0x1a'))['db'];config[_0x18ce('0x1b')]=_['defaults'](config[_0x18ce('0x1b')],{'host':_0x18ce('0x1c'),'port':0x18eb});var socket=require(_0x18ce('0x1d'))(new Redis(config[_0x18ce('0x1b')]));require(_0x18ce('0x1e'))['register'](socket);var jayson=require(_0x18ce('0x1f'));var client=jayson[_0x18ce('0x20')][_0x18ce('0x21')]({'port':0x232c});var client9003=jayson[_0x18ce('0x20')][_0x18ce('0x21')]({'port':0x232b});var client9002=jayson[_0x18ce('0x20')][_0x18ce('0x21')]({'port':0x232a});function checkPasswordPattern(_0x4a934f,_0x959ce,_0x1357ef){if(_0x1357ef){var _0x204d1a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x204d1a[_0x18ce('0x22')](_0x959ce)){return _0x4a934f;}else{throw new db[(_0x18ce('0x23'))][(_0x18ce('0x24'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4a934f;}}function respondWithRpcPromise(_0x6ab555,_0x29c691,_0x362719,_0x56644c){return new BPromise(function(_0x35e446,_0x2fa3d4){var _0xb3725c=_0x56644c||client;return _0xb3725c['request'](_0x6ab555,_0x362719)[_0x18ce('0x25')](function(_0x19084e){logger['info'](_0x18ce('0x26'),_0x29c691,_0x18ce('0x27'));logger[_0x18ce('0x28')](_0x18ce('0x29'),_0x29c691,_0x18ce('0x27'),JSON[_0x18ce('0x2a')](_0x19084e));if(_0x19084e[_0x18ce('0x2b')]){if(_0x19084e[_0x18ce('0x2b')][_0x18ce('0x2c')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x29c691,_0x19084e['error'][_0x18ce('0x2d')]);return _0x2fa3d4(_0x19084e['error'][_0x18ce('0x2d')]);}logger[_0x18ce('0x2b')](_0x18ce('0x26'),_0x29c691,_0x19084e['error']['message']);return _0x35e446(_0x19084e['error'][_0x18ce('0x2d')]);}else{logger[_0x18ce('0x2e')](_0x18ce('0x26'),_0x29c691,_0x18ce('0x27'));_0x35e446(_0x19084e[_0x18ce('0x2f')][_0x18ce('0x2d')]);}})['catch'](function(_0x5279f8){logger['error'](_0x18ce('0x26'),_0x29c691,_0x5279f8);_0x2fa3d4(_0x5279f8);});});}function respondWithStatusCode(_0x3719a2,_0x34c694){_0x34c694=_0x34c694||0xcc;return function(_0x5f3ec2){if(_0x5f3ec2){return _0x3719a2[_0x18ce('0x30')](_0x34c694);}return _0x3719a2[_0x18ce('0x31')](_0x34c694)[_0x18ce('0x32')]();};}function respondWithResult(_0x5ef96c,_0x56d296){_0x56d296=_0x56d296||0xc8;return function(_0x59e472){if(_0x59e472){return _0x5ef96c[_0x18ce('0x31')](_0x56d296)[_0x18ce('0x33')](_0x59e472);}};}function respondWithFilteredResult(_0x5c2d96,_0x5a5826){return function(_0x3394a9){if(_0x3394a9){var _0x3693e5=_0x3394a9[_0x18ce('0x34')],_0x91c42f=_0x5a5826[_0x18ce('0x35')],_0x57e11e=_0x5a5826[_0x18ce('0x35')]+_0x5a5826[_0x18ce('0x36')],_0x5f24f8;if(_0x57e11e>=_0x3693e5){_0x57e11e=_0x3693e5;_0x5f24f8=0xc8;}else{_0x5f24f8=0xce;}_0x5c2d96[_0x18ce('0x31')](_0x5f24f8);return _0x5c2d96[_0x18ce('0x37')](_0x18ce('0x38'),_0x91c42f+'-'+_0x57e11e+'/'+_0x3693e5)[_0x18ce('0x33')](_0x3394a9);}return null;};}function patchUpdates(_0x4dfe2f){return function(_0x51e7e3){try{jsonpatch[_0x18ce('0x39')](_0x51e7e3,_0x4dfe2f,!![]);}catch(_0x3e05d4){return BPromise['reject'](_0x3e05d4);}return _0x51e7e3[_0x18ce('0x3a')]();};}function saveUpdates(_0x55dab7,_0x329b1f){return function(_0x4e340b){if(_0x4e340b){return _0x4e340b[_0x18ce('0x3b')](_0x55dab7)[_0x18ce('0x25')](function(_0x1223cb){return _0x1223cb;});}return null;};}function removeEntity(_0x532dab,_0x4c2d04){return function(_0x3f2fdf){if(_0x3f2fdf){return _0x3f2fdf[_0x18ce('0x3c')]()['then'](function(){_0x532dab['status'](0xcc)[_0x18ce('0x32')]();});}};}function handleEntityNotFound(_0x27db6a,_0x342df2){return function(_0x21ccde){if(!_0x21ccde){_0x27db6a[_0x18ce('0x30')](0x194);}return _0x21ccde;};}function handleError(_0x461ef0,_0x3ca677){_0x3ca677=_0x3ca677||0x1f4;return function(_0x34cec3){logger[_0x18ce('0x2b')](_0x34cec3[_0x18ce('0x3d')]);if(_0x34cec3[_0x18ce('0x3e')]){delete _0x34cec3[_0x18ce('0x3e')];}_0x461ef0[_0x18ce('0x31')](_0x3ca677)['send'](_0x34cec3);};}exports[_0x18ce('0x3f')]=function(_0x277009,_0x2d5d4e){var _0x2f8e29={},_0x1e67dd={},_0x6da169={'count':0x0,'rows':[]};var _0x112954=_[_0x18ce('0x40')](db[_0x18ce('0x41')][_0x18ce('0x42')],function(_0x52ae1e){return{'name':_0x52ae1e['fieldName'],'type':_0x52ae1e[_0x18ce('0x43')][_0x18ce('0x44')]};});_0x1e67dd[_0x18ce('0x45')]=_[_0x18ce('0x40')](_0x112954,_0x18ce('0x3e'));_0x1e67dd[_0x18ce('0x46')]=_[_0x18ce('0x47')](_0x277009['query']);_0x1e67dd['filters']=_[_0x18ce('0x48')](_0x1e67dd[_0x18ce('0x45')],_0x1e67dd['query']);_0x2f8e29[_0x18ce('0x49')]=_[_0x18ce('0x48')](_0x1e67dd[_0x18ce('0x45')],qs[_0x18ce('0x4a')](_0x277009[_0x18ce('0x46')][_0x18ce('0x4a')]));_0x2f8e29[_0x18ce('0x49')]=_0x2f8e29[_0x18ce('0x49')][_0x18ce('0x4b')]?_0x2f8e29[_0x18ce('0x49')]:_0x1e67dd[_0x18ce('0x45')];if(!_0x277009[_0x18ce('0x46')]['hasOwnProperty'](_0x18ce('0x4c'))){_0x2f8e29[_0x18ce('0x36')]=qs[_0x18ce('0x36')](_0x277009[_0x18ce('0x46')][_0x18ce('0x36')]);_0x2f8e29[_0x18ce('0x35')]=qs[_0x18ce('0x35')](_0x277009['query']['offset']);}_0x2f8e29[_0x18ce('0x4d')]=qs[_0x18ce('0x4e')](_0x277009[_0x18ce('0x46')][_0x18ce('0x4e')]);_0x2f8e29['where']=qs[_0x18ce('0x4f')](_[_0x18ce('0x50')](_0x277009[_0x18ce('0x46')],_0x1e67dd['filters']),_0x112954);if(_0x277009['query'][_0x18ce('0x51')]){_0x2f8e29[_0x18ce('0x52')]=_['merge'](_0x2f8e29[_0x18ce('0x52')],{'$or':_[_0x18ce('0x40')](_0x112954,function(_0x2d29e4){if(_0x2d29e4[_0x18ce('0x43')]!==_0x18ce('0x53')){var _0x269b68={};_0x269b68[_0x2d29e4[_0x18ce('0x3e')]]={'$like':'%'+_0x277009['query'][_0x18ce('0x51')]+'%'};return _0x269b68;}})});}_0x2f8e29=_[_0x18ce('0x54')]({},_0x2f8e29,_0x277009[_0x18ce('0x55')]);var _0x1e445d={'where':_0x2f8e29[_0x18ce('0x52')]};return db[_0x18ce('0x41')][_0x18ce('0x34')](_0x1e445d)[_0x18ce('0x25')](function(_0x2dd494){_0x6da169[_0x18ce('0x34')]=_0x2dd494;if(_0x277009[_0x18ce('0x46')][_0x18ce('0x56')]){_0x2f8e29[_0x18ce('0x57')]=[{'all':!![]}];}return db[_0x18ce('0x41')]['findAll'](_0x2f8e29);})[_0x18ce('0x25')](function(_0x13e57b){_0x6da169['rows']=_0x13e57b;return _0x6da169;})[_0x18ce('0x25')](respondWithFilteredResult(_0x2d5d4e,_0x2f8e29))['catch'](handleError(_0x2d5d4e,null));};exports[_0x18ce('0x58')]=function(_0x52101a,_0x1b6258){var _0x188f57={'raw':!![],'where':{'id':_0x52101a[_0x18ce('0x59')]['id']}},_0x3d5b1b={};_0x3d5b1b['model']=_[_0x18ce('0x47')](db['MailMessage']['rawAttributes']);_0x3d5b1b[_0x18ce('0x46')]=_[_0x18ce('0x47')](_0x52101a[_0x18ce('0x46')]);_0x3d5b1b['filters']=_['intersection'](_0x3d5b1b[_0x18ce('0x45')],_0x3d5b1b[_0x18ce('0x46')]);_0x188f57[_0x18ce('0x49')]=_[_0x18ce('0x48')](_0x3d5b1b['model'],qs['fields'](_0x52101a[_0x18ce('0x46')]['fields']));_0x188f57[_0x18ce('0x49')]=_0x188f57[_0x18ce('0x49')][_0x18ce('0x4b')]?_0x188f57['attributes']:_0x3d5b1b[_0x18ce('0x45')];if(_0x52101a[_0x18ce('0x46')][_0x18ce('0x56')]){_0x188f57['include']=[{'all':!![]}];}_0x188f57=_[_0x18ce('0x54')]({},_0x188f57,_0x52101a[_0x18ce('0x55')]);return db[_0x18ce('0x41')]['find'](_0x188f57)[_0x18ce('0x25')](handleEntityNotFound(_0x1b6258,null))[_0x18ce('0x25')](respondWithResult(_0x1b6258,null))[_0x18ce('0x5a')](handleError(_0x1b6258,null));};exports[_0x18ce('0x3b')]=function(_0x55161d,_0x4bf79f){if(_0x55161d[_0x18ce('0x5b')]['id']){delete _0x55161d[_0x18ce('0x5b')]['id'];}return db[_0x18ce('0x41')][_0x18ce('0x5c')]({'where':{'id':_0x55161d[_0x18ce('0x59')]['id']}})[_0x18ce('0x25')](handleEntityNotFound(_0x4bf79f,null))[_0x18ce('0x25')](saveUpdates(_0x55161d['body'],null))[_0x18ce('0x25')](respondWithResult(_0x4bf79f,null))[_0x18ce('0x5a')](handleError(_0x4bf79f,null));};exports['destroy']=function(_0x2a54e3,_0x4878b1){return db['MailMessage'][_0x18ce('0x5c')]({'where':{'id':_0x2a54e3[_0x18ce('0x59')]['id']}})[_0x18ce('0x25')](handleEntityNotFound(_0x4878b1,null))[_0x18ce('0x25')](removeEntity(_0x4878b1,null))[_0x18ce('0x5a')](handleError(_0x4878b1,null));};exports[_0x18ce('0x5d')]=function(_0x4ca5a4,_0x3f5171){return db[_0x18ce('0x41')][_0x18ce('0x5d')]()['then'](respondWithResult(_0x3f5171,null))[_0x18ce('0x5a')](handleError(_0x3f5171,null));};exports['create']=function(_0x361ea3,_0x2f98cc){return db['MailMessage']['create'](_0x361ea3[_0x18ce('0x5b')])[_0x18ce('0x25')](function(_0x5ad549){if(_0x5ad549){if(_0x5ad549[_0x18ce('0x5e')]===_0x18ce('0x5f')&&!_0x5ad549[_0x18ce('0x60')]){var _0x3540e0,_0x1463e6,_0x553a91;if(_0x361ea3[_0x18ce('0x5b')]['to']){_0x1463e6=_0x361ea3[_0x18ce('0x5b')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x18ce('0x61')]({'where':{'id':_0x5ad549[_0x18ce('0x62')]},'include':[{'model':db[_0x18ce('0x63')],'as':_0x18ce('0x64'),'include':[{'model':db[_0x18ce('0x65')],'as':_0x18ce('0x66'),'where':{'email':_0x1463e6},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x18ce('0x67')],'as':_0x18ce('0x68'),'raw':!![]}]})[_0x18ce('0x25')](function(_0x4cbf50){_0x3540e0=_0x4cbf50;if(_0x3540e0&&_0x3540e0[_0x18ce('0x68')]){var _0x1f78e7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x3540e0[_0x18ce('0x68')][_0x18ce('0x69')])){_0x1f78e7['host']=_0x3540e0[_0x18ce('0x68')]['host'];_0x1f78e7['port']=_0x3540e0[_0x18ce('0x68')][_0x18ce('0x6a')];_0x1f78e7[_0x18ce('0x6b')]=_0x3540e0[_0x18ce('0x68')][_0x18ce('0x6b')];if(_0x3540e0['Smtp'][_0x18ce('0x6c')]){_0x1f78e7['auth']={'user':_0x3540e0[_0x18ce('0x68')]['user'],'pass':_0x3540e0['Smtp'][_0x18ce('0x6d')]};}}else{_0x1f78e7['service']=_0x3540e0[_0x18ce('0x68')][_0x18ce('0x69')];_0x1f78e7['auth']={'user':_0x3540e0[_0x18ce('0x68')][_0x18ce('0x6e')],'pass':_0x3540e0[_0x18ce('0x68')][_0x18ce('0x6d')]};_0x1f78e7[_0x18ce('0x6b')]=_0x3540e0[_0x18ce('0x68')][_0x18ce('0x6b')];}if(_0x361ea3[_0x18ce('0x5b')][_0x18ce('0x6f')]&&_0x361ea3[_0x18ce('0x5b')]['attachments'][_0x18ce('0x4b')]){for(var _0x1eedc8=0x0;_0x1eedc8<_0x361ea3[_0x18ce('0x5b')][_0x18ce('0x6f')][_0x18ce('0x4b')];_0x1eedc8+=0x1){_0x361ea3[_0x18ce('0x5b')][_0x18ce('0x6f')][_0x1eedc8]={'filename':_0x361ea3['body']['attachments'][_0x1eedc8][_0x18ce('0x3e')],'path':path[_0x18ce('0x70')](config[_0x18ce('0x71')],_0x18ce('0x72'),_0x361ea3['body'][_0x18ce('0x6f')][_0x1eedc8][_0x18ce('0x73')])};}}_0x553a91={'account':_0x1f78e7,'message':_0x361ea3[_0x18ce('0x5b')]};return;}})[_0x18ce('0x25')](function(){if(_0x3540e0[_0x18ce('0x64')]){if(_0x3540e0[_0x18ce('0x64')][_0x18ce('0x66')][_0x18ce('0x4b')]){return _0x3540e0[_0x18ce('0x64')][_0x18ce('0x66')][0x0];}else{return db[_0x18ce('0x65')][_0x18ce('0x74')](_[_0x18ce('0x75')](_0x361ea3['body'],{'firstName':_0x361ea3['body']['to'],'email':_0x361ea3[_0x18ce('0x5b')]['to'],'phone':_0x361ea3[_0x18ce('0x5b')]['to'],'ListId':_0x3540e0['ListId']}));}}else{throw new Error(_0x18ce('0x76'));}})[_0x18ce('0x25')](function(){if(_0x553a91){return respondWithRpcPromise(_0x18ce('0x77'),_0x18ce('0x78'),_0x553a91,client9003)[_0x18ce('0x25')](function(_0x566d36){return _0x5ad549[_0x18ce('0x3b')]({'read':!![],'messageId':_0x566d36[_0x18ce('0x79')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x18ce('0x5a')](function(_0x1ba30f){logger[_0x18ce('0x2b')]('%s',JSON[_0x18ce('0x2a')](_0x1ba30f));return _0x5ad549;});}return _0x5ad549;});}return _0x5ad549;}})[_0x18ce('0x25')](respondWithResult(_0x2f98cc,0xc9))[_0x18ce('0x5a')](handleError(_0x2f98cc,null));};var interaction_log=require(_0x18ce('0x7a'))(_0x18ce('0x7b'));exports['accept']=function(_0x127fd6,_0x192d46,_0x4aa31f){var _0x4709c7={'channel':_0x18ce('0x7c')};if(_0x127fd6['body']['id']){delete _0x127fd6[_0x18ce('0x5b')]['id'];}_0x127fd6[_0x18ce('0x5b')][_0x18ce('0x7d')]=!![];_0x127fd6['body'][_0x18ce('0x7e')]=moment()['format'](_0x18ce('0x7f'));_0x127fd6['body'][_0x18ce('0x80')]=_0x127fd6[_0x18ce('0x5b')][_0x18ce('0x80')]||_0x127fd6[_0x18ce('0x6e')]['id'];return db[_0x18ce('0x41')][_0x18ce('0x5c')]({'where':{'id':_0x127fd6[_0x18ce('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x18ce('0x65')],'as':_0x18ce('0x81')}]})[_0x18ce('0x25')](handleEntityNotFound(_0x192d46,null))[_0x18ce('0x25')](saveUpdates(_0x127fd6[_0x18ce('0x5b')],null))['then'](function(_0x1d7138){if(_0x1d7138){_0x4709c7[_0x18ce('0x2d')]=_0x1d7138[_0x18ce('0x82')]({'plain':!![]});return db[_0x18ce('0x83')][_0x18ce('0x5c')]({'where':{'id':_0x1d7138['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x192d46,null))[_0x18ce('0x25')](function(_0x24fd70){if(_0x24fd70){return _0x24fd70[_0x18ce('0x3b')]({'UserId':_0x127fd6[_0x18ce('0x5b')][_0x18ce('0x80')],'read1stAt':_[_0x18ce('0x84')](_0x24fd70['read1stAt'])?moment()['format'](_0x18ce('0x7f')):undefined});}return null;})['then'](function(_0x1d32db){if(_0x1d32db){_0x4709c7[_0x18ce('0x85')]=_0x1d32db['get']({'plain':!![]});interaction_log[_0x18ce('0x2e')](_0x18ce('0x86'),_0x127fd6[_0x18ce('0x6e')]['id'],_0x127fd6[_0x18ce('0x6e')][_0x18ce('0x3e')],_0x127fd6['user'][_0x18ce('0x87')],_0x4709c7[_0x18ce('0x85')]['id'],_0x127fd6[_0x18ce('0x5b')]?JSON[_0x18ce('0x2a')](_0x127fd6[_0x18ce('0x5b')]):_0x18ce('0x88'));return respondWithRpcPromise(_0x18ce('0x89'),'acceptMessage',_0x4709c7);}return null;})[_0x18ce('0x25')](function(_0x504a74){if(_0x504a74){if(_0x127fd6['body'][_0x18ce('0x8a')]){_0x4709c7[_0x18ce('0x2d')][_0x18ce('0x8b')]=util[_0x18ce('0x8c')](_0x18ce('0x8d'),_0x127fd6[_0x18ce('0x6e')][_0x18ce('0x3e')]);_0x4709c7[_0x18ce('0x2d')][_0x18ce('0x8e')]=_0x4709c7[_0x18ce('0x8e')];_0x4709c7['message'][_0x18ce('0x8f')]='accept';return respondWithRpcPromise('EventManager',_0x18ce('0x90'),{'event':_0x18ce('0x91'),'message':_0x4709c7['message']},client9002)[_0x18ce('0x25')](function(){return _0x4709c7;});}return _0x4709c7;}return null;})[_0x18ce('0x25')](respondWithResult(_0x192d46,null))[_0x18ce('0x5a')](handleError(_0x192d46,null));};var interaction_log=require(_0x18ce('0x7a'))('mail-interactions');exports[_0x18ce('0x92')]=function(_0x3a5a50,_0x4a8730,_0x84eec9){var _0x355829={'agent':{},'channel':'mail'};if(_0x3a5a50[_0x18ce('0x5b')]['id']){delete _0x3a5a50[_0x18ce('0x5b')]['id'];}_0x3a5a50[_0x18ce('0x5b')][_0x18ce('0x80')]=_0x3a5a50[_0x18ce('0x5b')]['UserId']||_0x3a5a50[_0x18ce('0x6e')]['id'];_0x355829[_0x18ce('0x93')]['id']=_0x3a5a50[_0x18ce('0x5b')]['UserId'];return db[_0x18ce('0x41')][_0x18ce('0x5c')]({'where':{'id':_0x3a5a50[_0x18ce('0x59')]['id'],'UserId':null}})[_0x18ce('0x25')](handleEntityNotFound(_0x4a8730,null))[_0x18ce('0x25')](function(_0x10b9fd){if(_0x10b9fd){_0x355829[_0x18ce('0x2d')]=_0x10b9fd[_0x18ce('0x82')]({'plain':!![]});return db[_0x18ce('0x83')]['find']({'where':{'id':_0x10b9fd[_0x18ce('0x94')]}});}return null;})[_0x18ce('0x25')](handleEntityNotFound(_0x4a8730,null))[_0x18ce('0x25')](function(_0x3350f9){if(_0x3350f9){_0x355829[_0x18ce('0x85')]=_0x3350f9[_0x18ce('0x82')]({'plain':!![]});interaction_log[_0x18ce('0x2e')](_0x18ce('0x95'),_0x3a5a50[_0x18ce('0x6e')]['id'],_0x3a5a50[_0x18ce('0x6e')][_0x18ce('0x3e')],_0x3a5a50[_0x18ce('0x6e')]['role'],_0x355829[_0x18ce('0x85')]['id'],_0x3a5a50[_0x18ce('0x5b')]?JSON[_0x18ce('0x2a')](_0x3a5a50[_0x18ce('0x5b')]):_0x18ce('0x88'));return respondWithRpcPromise('RejectMessage',_0x18ce('0x96'),_0x355829);}return null;})[_0x18ce('0x25')](function(_0x3e4552){if(_0x3e4552){_0x3e4552[_0x18ce('0x2d')][_0x18ce('0x8b')]=util[_0x18ce('0x8c')](_0x18ce('0x8d'),_0x3a5a50[_0x18ce('0x6e')][_0x18ce('0x3e')]);_0x3e4552[_0x18ce('0x2d')][_0x18ce('0x8e')]=_0x355829[_0x18ce('0x8e')];_0x3e4552[_0x18ce('0x2d')][_0x18ce('0x8f')]=_0x18ce('0x92');respondWithRpcPromise(_0x18ce('0x90'),_0x18ce('0x90'),{'event':_0x18ce('0x97'),'message':_0x3e4552['message']},client9002);return _0x355829;}return null;})[_0x18ce('0x25')](respondWithResult(_0x4a8730,null))[_0x18ce('0x5a')](handleError(_0x4a8730,null));};exports[_0x18ce('0x98')]=function(_0x3cebbe,_0x507b3e){var _0x3be0ce=moment()[_0x18ce('0x99')]()[_0x18ce('0x9a')]();var _0x3dab12=path[_0x18ce('0x70')](config[_0x18ce('0x71')],_0x18ce('0x9b'),_0x18ce('0x9c'),_0x18ce('0x9d'));var _0x53b9b9=path['join'](config[_0x18ce('0x71')],'server',_0x18ce('0x9c'),_0x18ce('0x6f'));var _0x5e8095=util[_0x18ce('0x8c')](_0x18ce('0x9e'),_0x3be0ce);return db[_0x18ce('0x41')][_0x18ce('0x5c')]({'where':{'id':_0x3cebbe['params']['id']},'attributes':['id',_0x18ce('0x5b'),'from','to','cc',_0x18ce('0x9f'),_0x18ce('0xa0'),_0x18ce('0xa1')],'include':_0x3cebbe[_0x18ce('0x46')][_0x18ce('0x6f')]?[{'model':db[_0x18ce('0xa2')],'as':_0x18ce('0xa3')}]:undefined})[_0x18ce('0x25')](handleEntityNotFound(_0x507b3e,null))[_0x18ce('0x25')](function(_0xcc049f){if(_0xcc049f){var _0x2dfa6f=_0xcc049f;var _0x4c34ec={'from':_0x2dfa6f['from'],'to':_0x2dfa6f['to'],'subject':_0x2dfa6f[_0x18ce('0xa0')],'html':_0x2dfa6f['body'],'headers':{'Date':moment(_0x2dfa6f[_0x18ce('0xa1')])[_0x18ce('0x8c')](_0x18ce('0xa4'))},'attachments':[]};if(_0xcc049f['cc']){_0x4c34ec['headers']['Cc']=_0xcc049f['cc'];}if(_0xcc049f[_0x18ce('0x9f')]){_0x4c34ec['headers']['Bcc']=_0xcc049f[_0x18ce('0x9f')];}return new BPromise(function(_0x3a0571,_0x6c0346){if(_0xcc049f[_0x18ce('0xa3')]){for(var _0x21c484=0x0;_0x21c484<_0xcc049f['Attachments']['length'];_0x21c484++){var _0x4b80c7=_0xcc049f[_0x18ce('0xa3')][_0x21c484];var _0x503a44=path['join'](_0x53b9b9,_0x4b80c7[_0x18ce('0x73')]);if(fs[_0x18ce('0xa5')](_0x503a44)){_0x4c34ec[_0x18ce('0x6f')]['push']({'name':_0x4b80c7[_0x18ce('0x3e')],'contentType':_0x4b80c7[_0x18ce('0x43')],'data':fs['readFileSync'](_0x503a44)});}}}emlformat[_0x18ce('0xa6')](_0x4c34ec,function(_0x4907a9,_0x3759f0){if(_0x4907a9)return _0x6c0346(_0x4907a9);fs[_0x18ce('0xa7')](path[_0x18ce('0x70')](_0x3dab12,_0x5e8095),_0x3759f0);return _0x3a0571(_0x3759f0);});});}})[_0x18ce('0x25')](function(_0x2d4509){if(_0x2d4509){return _0x507b3e[_0x18ce('0x98')](path[_0x18ce('0x70')](_0x3dab12,_0x5e8095),_0x5e8095,function(_0x2c86d1){if(_0x2c86d1){console['log'](_0x18ce('0xa8'),_0x2c86d1);}else{fs[_0x18ce('0xa9')](path[_0x18ce('0x70')](_0x3dab12,_0x5e8095));}});}})[_0x18ce('0x5a')](handleError(_0x507b3e,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 48ff90d..9e73f9b 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 _0x1cf5=['save','update','remove','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x3ab7f8,_0x2720c0){var _0x59552e=function(_0x16cde7){while(--_0x16cde7){_0x3ab7f8['push'](_0x3ab7f8['shift']());}};_0x59552e(++_0x2720c0);}(_0x1cf5,0x11d));var _0x51cf=function(_0x59400c,_0x364897){_0x59400c=_0x59400c-0x0;var _0x51508d=_0x1cf5[_0x59400c];return _0x51508d;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x51cf('0x0'))['db'][_0x51cf('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x51cf('0x2')](0x0);var events={'afterCreate':_0x51cf('0x3'),'afterUpdate':_0x51cf('0x4'),'afterDestroy':_0x51cf('0x5')};function emitEvent(_0x462cfc){return function(_0x42ee29,_0x171b5e,_0x282600){MailMessageEvents['emit'](_0x462cfc+':'+_0x42ee29['id'],_0x42ee29);MailMessageEvents['emit'](_0x462cfc,_0x42ee29);_0x282600(null);};}for(var e in events){if(events[_0x51cf('0x6')](e)){var event=events[e];MailMessage[_0x51cf('0x7')](e,emitEvent(event));}}module[_0x51cf('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x0050=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','save'];(function(_0x23a007,_0x3f3cc9){var _0x35026a=function(_0x1118b8){while(--_0x1118b8){_0x23a007['push'](_0x23a007['shift']());}};_0x35026a(++_0x3f3cc9);}(_0x0050,0x9c));var _0x0005=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0050[_0x46698a];return _0x356db0;};'use strict';var EventEmitter=require(_0x0005('0x0'));var MailMessage=require(_0x0005('0x1'))['db'][_0x0005('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0005('0x3'),'afterUpdate':_0x0005('0x4'),'afterDestroy':_0x0005('0x5')};function emitEvent(_0x347af1){return function(_0xb74261,_0x3a068c,_0x5633a5){MailMessageEvents['emit'](_0x347af1+':'+_0xb74261['id'],_0xb74261);MailMessageEvents[_0x0005('0x6')](_0x347af1,_0xb74261);_0x5633a5(null);};}for(var e in events){if(events[_0x0005('0x7')](e)){var event=events[e];MailMessage[_0x0005('0x8')](e,emitEvent(event));}}module[_0x0005('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f9c3d1a..5ebca54 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 _0x4cc8=['MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','html-to-text','path','rimraf','exports','define','MailMessage','messageId','fti_mail_messages','body','plainBody','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x1d36a7,_0x8e6fcf){var _0x17e8f7=function(_0x5e16c9){while(--_0x5e16c9){_0x1d36a7['push'](_0x1d36a7['shift']());}};_0x17e8f7(++_0x8e6fcf);}(_0x4cc8,0x171));var _0x84cc=function(_0x43d3ff,_0x4f9e70){_0x43d3ff=_0x43d3ff-0x0;var _0x37bd3c=_0x4cc8[_0x43d3ff];return _0x37bd3c;};'use strict';var _=require(_0x84cc('0x0'));var util=require('util');var logger=require(_0x84cc('0x1'))(_0x84cc('0x2'));var moment=require('moment');var BPromise=require(_0x84cc('0x3'));var rp=require('request-promise');var htmlToText=require(_0x84cc('0x4'));var fs=require('fs');var path=require(_0x84cc('0x5'));var rimraf=require(_0x84cc('0x6'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x84cc('0x7')]=function(_0x4f12aa,_0x21de03){return _0x4f12aa[_0x84cc('0x8')](_0x84cc('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x84cc('0xa'),'fields':[_0x84cc('0xa')]},{'name':_0x84cc('0xb'),'fields':['plainBody','subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d5b4a,_0x5d53a8,_0x2ab3a3){if(_0x1d5b4a[_0x84cc('0xc')]){_0x1d5b4a[_0x84cc('0xd')]=htmlToText['fromString'](_0x1d5b4a['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2ab3a3(null,_0x5d53a8);},'afterCreate':function(_0x5eefc0,_0x24f5ad,_0x2ab5e5){var _0x269bf0=_0x4f12aa[_0x84cc('0xe')];var _0x5c22ff=_0x5eefc0[_0x84cc('0xf')]({'plain':!![]});if(_0x5c22ff[_0x84cc('0x10')][_0x84cc('0x11')]()==='in'||_0x5c22ff['direction'][_0x84cc('0x11')]()===_0x84cc('0x12')&&!_0x5c22ff[_0x84cc('0x13')]&&!_[_0x84cc('0x14')](_0x5c22ff['UserId'])){_0x269bf0[_0x84cc('0x15')][_0x84cc('0x16')]({'where':{'id':_0x5c22ff[_0x84cc('0x17')]}})[_0x84cc('0x18')](function(_0x40053a){if(_0x40053a){_0x40053a['update']({'lastMsgAt':_0x5c22ff[_0x84cc('0x19')],'lastMsgDirection':_0x5c22ff[_0x84cc('0x10')]['toLowerCase'](),'lastMsgBody':_0x5c22ff[_0x84cc('0xc')]});}})[_0x84cc('0x1a')](function(_0x34023b){console[_0x84cc('0x1b')](_0x34023b);});}_0x2ab5e5();}},'charset':_0x84cc('0x1c'),'collate':_0x84cc('0x1d')});}; \ No newline at end of file +var _0x453b=['messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','UserId','MailInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage'];(function(_0x2e66e9,_0x5a8b47){var _0x42b8ee=function(_0x5f3b49){while(--_0x5f3b49){_0x2e66e9['push'](_0x2e66e9['shift']());}};_0x42b8ee(++_0x5a8b47);}(_0x453b,0xce));var _0xb453=function(_0x12f9e3,_0x3fadc1){_0x12f9e3=_0x12f9e3-0x0;var _0x2de0c8=_0x453b[_0x12f9e3];return _0x2de0c8;};'use strict';var _=require(_0xb453('0x0'));var util=require(_0xb453('0x1'));var logger=require('../../config/logger')(_0xb453('0x2'));var moment=require('moment');var BPromise=require(_0xb453('0x3'));var rp=require(_0xb453('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xb453('0x5'));var rimraf=require('rimraf');var config=require(_0xb453('0x6'));var attributes=require(_0xb453('0x7'));module[_0xb453('0x8')]=function(_0x15dd3b,_0x2c68e5){return _0x15dd3b[_0xb453('0x9')](_0xb453('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb453('0xb')]},{'name':_0xb453('0xc'),'fields':[_0xb453('0xd'),_0xb453('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x27c480,_0x5022bd,_0x642852){if(_0x27c480[_0xb453('0xf')]){_0x27c480[_0xb453('0xd')]=htmlToText[_0xb453('0x10')](_0x27c480[_0xb453('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x642852(null,_0x5022bd);},'afterCreate':function(_0x50c52b,_0xf93f66,_0x55e025){var _0x389e10=_0x15dd3b[_0xb453('0x11')];var _0x96ba57=_0x50c52b[_0xb453('0x12')]({'plain':!![]});if(_0x96ba57[_0xb453('0x13')][_0xb453('0x14')]()==='in'||_0x96ba57[_0xb453('0x13')][_0xb453('0x14')]()===_0xb453('0x15')&&!_0x96ba57['secret']&&!_['isNil'](_0x96ba57[_0xb453('0x16')])){_0x389e10[_0xb453('0x17')][_0xb453('0x18')]({'where':{'id':_0x96ba57['MailInteractionId']}})[_0xb453('0x19')](function(_0x59d2ab){if(_0x59d2ab){_0x59d2ab[_0xb453('0x1a')]({'lastMsgAt':_0x96ba57[_0xb453('0x1b')],'lastMsgDirection':_0x96ba57[_0xb453('0x13')]['toLowerCase'](),'lastMsgBody':_0x96ba57[_0xb453('0xf')]});}})[_0xb453('0x1c')](function(_0x43bbcd){console['error'](_0x43bbcd);});}_0x55e025();}},'charset':_0xb453('0x1d'),'collate':_0xb453('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 40caead..c521368 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 _0xa93e=['info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailMessage','body','raw','debug','CreateMailMessage','stringify','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then'];(function(_0x1f9493,_0x2aebd4){var _0x1d41b6=function(_0x59c800){while(--_0x59c800){_0x1f9493['push'](_0x1f9493['shift']());}};_0x1d41b6(++_0x2aebd4);}(_0xa93e,0x1df));var _0xea93=function(_0x1a9d83,_0x561856){_0x1a9d83=_0x1a9d83-0x0;var _0x5ac5ec=_0xa93e[_0x1a9d83];return _0x5ac5ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea93('0x0'));var BPromise=require(_0xea93('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea93('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xea93('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xea93('0x4'));var jayson=require(_0xea93('0x5'));var client=jayson[_0xea93('0x6')][_0xea93('0x7')]({'port':0x232a});config[_0xea93('0x8')]=_[_0xea93('0x9')](config['redis'],{'host':_0xea93('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0xea93('0xb')](socket);function respondWithRpcPromise(_0x43c7e2,_0x598546,_0x1229f9){return new BPromise(function(_0x2306b6,_0x50c822){return client[_0xea93('0xc')](_0x43c7e2,_0x1229f9)[_0xea93('0xd')](function(_0xa45e13){logger[_0xea93('0xe')](_0xea93('0xf'),_0x598546,_0xea93('0x10'));logger['debug'](_0xea93('0x11'),_0x598546,'request\x20sent',JSON['stringify'](_0xa45e13));if(_0xa45e13[_0xea93('0x12')]){if(_0xa45e13[_0xea93('0x12')][_0xea93('0x13')]===0x1f4){logger[_0xea93('0x12')](_0xea93('0xf'),_0x598546,_0xa45e13[_0xea93('0x12')]['message']);return _0x50c822(_0xa45e13[_0xea93('0x12')]['message']);}logger[_0xea93('0x12')](_0xea93('0xf'),_0x598546,_0xa45e13[_0xea93('0x12')][_0xea93('0x14')]);return _0x2306b6(_0xa45e13[_0xea93('0x12')][_0xea93('0x14')]);}else{logger[_0xea93('0xe')](_0xea93('0xf'),_0x598546,_0xea93('0x10'));_0x2306b6(_0xa45e13[_0xea93('0x15')][_0xea93('0x14')]);}})[_0xea93('0x16')](function(_0xc05867){logger['error'](_0xea93('0xf'),_0x598546,_0xc05867);_0x50c822(_0xc05867);});});}exports['CreateMailMessage']=function(_0x2a78d6){var _0x388d0f=this;return new Promise(function(_0x41193e,_0xea0f1b){return db[_0xea93('0x17')]['create'](_0x2a78d6[_0xea93('0x18')],{'raw':_0x2a78d6['options']?_0x2a78d6['options'][_0xea93('0x19')]===undefined?!![]:![]:!![]})[_0xea93('0xd')](function(_0x622e1b){logger[_0xea93('0xe')]('CreateMailMessage',_0x2a78d6);logger[_0xea93('0x1a')](_0xea93('0x1b'),_0x2a78d6,JSON[_0xea93('0x1c')](_0x622e1b));_0x41193e(_0x622e1b);})[_0xea93('0x16')](function(_0x3d3a6e){logger[_0xea93('0x12')](_0xea93('0x1b'),_0x3d3a6e['message'],_0x2a78d6);_0xea0f1b(_0x388d0f[_0xea93('0x12')](0x1f4,_0x3d3a6e['message']));});});}; \ No newline at end of file +var _0x8ff3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','create','options','raw','stringify','lodash','util'];(function(_0x43bfb5,_0x478eec){var _0x52feab=function(_0x270c1b){while(--_0x270c1b){_0x43bfb5['push'](_0x43bfb5['shift']());}};_0x52feab(++_0x478eec);}(_0x8ff3,0x72));var _0x38ff=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x8ff3[_0x2431d6];return _0x4d0f9b;};'use strict';var _=require(_0x38ff('0x0'));var util=require(_0x38ff('0x1'));var moment=require('moment');var BPromise=require(_0x38ff('0x2'));var rs=require(_0x38ff('0x3'));var fs=require('fs');var Redis=require(_0x38ff('0x4'));var db=require(_0x38ff('0x5'))['db'];var utils=require(_0x38ff('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x38ff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x38ff('0x8')]['http']({'port':0x232a});config[_0x38ff('0x9')]=_[_0x38ff('0xa')](config[_0x38ff('0x9')],{'host':_0x38ff('0xb'),'port':0x18eb});var socket=require(_0x38ff('0xc'))(new Redis(config[_0x38ff('0x9')]));require(_0x38ff('0xd'))[_0x38ff('0xe')](socket);function respondWithRpcPromise(_0x17820a,_0x3a701b,_0x261325){return new BPromise(function(_0x217abf,_0x11058d){return client['request'](_0x17820a,_0x261325)[_0x38ff('0xf')](function(_0x9d5d77){logger[_0x38ff('0x10')]('MailMessage,\x20%s,\x20%s',_0x3a701b,_0x38ff('0x11'));logger[_0x38ff('0x12')](_0x38ff('0x13'),_0x3a701b,_0x38ff('0x11'),JSON['stringify'](_0x9d5d77));if(_0x9d5d77[_0x38ff('0x14')]){if(_0x9d5d77[_0x38ff('0x14')]['code']===0x1f4){logger[_0x38ff('0x14')](_0x38ff('0x15'),_0x3a701b,_0x9d5d77[_0x38ff('0x14')]['message']);return _0x11058d(_0x9d5d77[_0x38ff('0x14')]['message']);}logger[_0x38ff('0x14')]('MailMessage,\x20%s,\x20%s',_0x3a701b,_0x9d5d77[_0x38ff('0x14')]['message']);return _0x217abf(_0x9d5d77['error'][_0x38ff('0x16')]);}else{logger[_0x38ff('0x10')](_0x38ff('0x15'),_0x3a701b,_0x38ff('0x11'));_0x217abf(_0x9d5d77[_0x38ff('0x17')][_0x38ff('0x16')]);}})['catch'](function(_0x2f9a29){logger[_0x38ff('0x14')]('MailMessage,\x20%s,\x20%s',_0x3a701b,_0x2f9a29);_0x11058d(_0x2f9a29);});});}exports[_0x38ff('0x18')]=function(_0x571235){var _0x522c2e=this;return new Promise(function(_0x3d4a13,_0x3e985b){return db['MailMessage'][_0x38ff('0x19')](_0x571235['body'],{'raw':_0x571235[_0x38ff('0x1a')]?_0x571235[_0x38ff('0x1a')][_0x38ff('0x1b')]===undefined?!![]:![]:!![]})[_0x38ff('0xf')](function(_0x4f7639){logger['info'](_0x38ff('0x18'),_0x571235);logger[_0x38ff('0x12')](_0x38ff('0x18'),_0x571235,JSON[_0x38ff('0x1c')](_0x4f7639));_0x3d4a13(_0x4f7639);})['catch'](function(_0x154c0f){logger[_0x38ff('0x14')](_0x38ff('0x18'),_0x154c0f[_0x38ff('0x16')],_0x571235);_0x3e985b(_0x522c2e[_0x38ff('0x14')](0x1f4,_0x154c0f[_0x38ff('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a2c5426..51e1dfa 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 _0x7e81=['update','emit','register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x51c277,_0x45ca43){var _0x1f0cdd=function(_0xc48d7f){while(--_0xc48d7f){_0x51c277['push'](_0x51c277['shift']());}};_0x1f0cdd(++_0x45ca43);}(_0x7e81,0xc5));var _0x17e8=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7e81[_0x6c993a];return _0x27f547;};'use strict';var MailMessageEvents=require(_0x17e8('0x0'));var events=[_0x17e8('0x1'),_0x17e8('0x2'),_0x17e8('0x3')];function createListener(_0x5272db,_0x789de0){return function(_0x150fc3){_0x789de0[_0x17e8('0x4')](_0x5272db,_0x150fc3);};}function removeListener(_0x766c9e,_0x364a73){return function(){MailMessageEvents['removeListener'](_0x766c9e,_0x364a73);};}exports[_0x17e8('0x5')]=function(_0x2b4f2f){for(var _0x382bb2=0x0,_0x176238=events[_0x17e8('0x6')];_0x382bb2<_0x176238;_0x382bb2++){var _0x574402=events[_0x382bb2];var _0x54ee7e=createListener(_0x17e8('0x7')+_0x574402,_0x2b4f2f);MailMessageEvents['on'](_0x574402,_0x54ee7e);}}; \ No newline at end of file +var _0x3604=['save','remove','removeListener','register','length','mailMessage:'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x3604,0x174));var _0x4360=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3604[_0x422905];return _0x33dc6c;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x4360('0x0'),_0x4360('0x1'),'update'];function createListener(_0xf349b0,_0x34c2f5){return function(_0x81da3e){_0x34c2f5['emit'](_0xf349b0,_0x81da3e);};}function removeListener(_0xca6c43,_0x4221af){return function(){MailMessageEvents[_0x4360('0x2')](_0xca6c43,_0x4221af);};}exports[_0x4360('0x3')]=function(_0x4d0529){for(var _0x45b4db=0x0,_0x23d6c5=events[_0x4360('0x4')];_0x45b4db<_0x23d6c5;_0x45b4db++){var _0x7badab=events[_0x45b4db];var _0x555d99=createListener(_0x4360('0x5')+_0x7badab,_0x4d0529);MailMessageEvents['on'](_0x7badab,_0x555d99);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c64401e..965db02 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 _0x04d6=['../../config/environment','./mailQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','delete','removeTeams','exports','util','connect-timeout','express','Router'];(function(_0x34c88d,_0x24d403){var _0x4f29a2=function(_0x13a7d8){while(--_0x13a7d8){_0x34c88d['push'](_0x34c88d['shift']());}};_0x4f29a2(++_0x24d403);}(_0x04d6,0x104));var _0x604d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x04d6[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x604d('0x0'));var path=require('path');var timeout=require(_0x604d('0x1'));var express=require(_0x604d('0x2'));var router=express[_0x604d('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x604d('0x4'));var controller=require(_0x604d('0x5'));router['get']('/',auth[_0x604d('0x6')](),controller['index']);router[_0x604d('0x7')]('/describe',auth[_0x604d('0x6')](),controller[_0x604d('0x8')]);router[_0x604d('0x7')](_0x604d('0x9'),auth['isAuthenticated'](),controller[_0x604d('0xa')]);router[_0x604d('0x7')](_0x604d('0xb'),auth[_0x604d('0x6')](),controller['getMembers']);router[_0x604d('0x7')](_0x604d('0xc'),auth[_0x604d('0x6')](),controller[_0x604d('0xd')]);router[_0x604d('0x7')](_0x604d('0xe'),auth[_0x604d('0x6')](),controller[_0x604d('0xf')]);router[_0x604d('0x10')]('/',auth[_0x604d('0x6')](),controller[_0x604d('0x11')]);router[_0x604d('0x10')](_0x604d('0xc'),auth[_0x604d('0x6')](),controller['addTeams']);router[_0x604d('0x10')]('/:id/users',auth[_0x604d('0x6')](),controller['addAgents']);router[_0x604d('0x12')](_0x604d('0x9'),auth[_0x604d('0x6')](),controller['update']);router[_0x604d('0x13')]('/:id',auth[_0x604d('0x6')](),controller['destroy']);router['delete'](_0x604d('0xc'),auth[_0x604d('0x6')](),controller[_0x604d('0x14')]);router[_0x604d('0x13')]('/:id/users',auth[_0x604d('0x6')](),controller['removeAgents']);module[_0x604d('0x15')]=router; \ No newline at end of file +var _0xf539=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','getMembers','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer'];(function(_0x2cf051,_0x115363){var _0x239854=function(_0x278c2c){while(--_0x278c2c){_0x2cf051['push'](_0x2cf051['shift']());}};_0x239854(++_0x115363);}(_0xf539,0x167));var _0x9f53=function(_0x3b96d9,_0x881b82){_0x3b96d9=_0x3b96d9-0x0;var _0x258ca6=_0xf539[_0x3b96d9];return _0x258ca6;};'use strict';var multer=require(_0x9f53('0x0'));var util=require(_0x9f53('0x1'));var path=require(_0x9f53('0x2'));var timeout=require(_0x9f53('0x3'));var express=require(_0x9f53('0x4'));var router=express[_0x9f53('0x5')]();var auth=require(_0x9f53('0x6'));var interaction=require(_0x9f53('0x7'));var config=require(_0x9f53('0x8'));var controller=require('./mailQueue.controller');router[_0x9f53('0x9')]('/',auth['isAuthenticated'](),controller[_0x9f53('0xa')]);router[_0x9f53('0x9')]('/describe',auth[_0x9f53('0xb')](),controller[_0x9f53('0xc')]);router[_0x9f53('0x9')](_0x9f53('0xd'),auth['isAuthenticated'](),controller[_0x9f53('0xe')]);router[_0x9f53('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x9f53('0xf')]);router[_0x9f53('0x9')]('/:id/teams',auth[_0x9f53('0xb')](),controller['getTeams']);router[_0x9f53('0x9')](_0x9f53('0x10'),auth['isAuthenticated'](),controller[_0x9f53('0x11')]);router[_0x9f53('0x12')]('/',auth['isAuthenticated'](),controller[_0x9f53('0x13')]);router['post']('/:id/teams',auth[_0x9f53('0xb')](),controller[_0x9f53('0x14')]);router[_0x9f53('0x12')](_0x9f53('0x10'),auth[_0x9f53('0xb')](),controller[_0x9f53('0x15')]);router[_0x9f53('0x16')](_0x9f53('0xd'),auth['isAuthenticated'](),controller[_0x9f53('0x17')]);router[_0x9f53('0x18')](_0x9f53('0xd'),auth[_0x9f53('0xb')](),controller[_0x9f53('0x19')]);router['delete'](_0x9f53('0x1a'),auth[_0x9f53('0xb')](),controller[_0x9f53('0x1b')]);router[_0x9f53('0x18')](_0x9f53('0x10'),auth['isAuthenticated'](),controller[_0x9f53('0x1c')]);module[_0x9f53('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e0f7d62..fee01af 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 _0x8c7f=['sequelize','exports','STRING','name','rrmemory','beepall'];(function(_0x4dba75,_0x303431){var _0x925515=function(_0x1a23cb){while(--_0x1a23cb){_0x4dba75['push'](_0x4dba75['shift']());}};_0x925515(++_0x303431);}(_0x8c7f,0xa2));var _0xf8c7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8c7f[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xf8c7('0x0'));module[_0xf8c7('0x1')]={'name':{'type':Sequelize[_0xf8c7('0x2')],'unique':_0xf8c7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf8c7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf8c7('0x4'),_0xf8c7('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xaecc=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xaecc,0x172));var _0xcaec=function(_0x3fd073,_0x32931f){_0x3fd073=_0x3fd073-0x0;var _0x40d7b1=_0xaecc[_0x3fd073];return _0x40d7b1;};'use strict';var Sequelize=require(_0xcaec('0x0'));module['exports']={'name':{'type':Sequelize[_0xcaec('0x1')],'unique':_0xcaec('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcaec('0x1')]},'timeout':{'type':Sequelize[_0xcaec('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcaec('0x4')](_0xcaec('0x5'),_0xcaec('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e0e8516..ca19f29 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 _0x4489=['get','UserProfileResource','sendStatus','stack','name','send','index','map','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','order','where','pick','filter','merge','VIRTUAL','options','MailQueue','includeAll','include','show','rawAttributes','find','catch','create','body','user','MailQueues','userProfileId','autoAssociation','error','update','params','describe','findOne','nolimit','sort','MailQueueId','UserMailQueue','findAll','User','UserId','agent','mailPause','rows','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','count','offset','set','Content-Range','reject','save','destroy','then'];(function(_0x1dcbcc,_0x31a0fc){var _0x38590e=function(_0xd1a9aa){while(--_0xd1a9aa){_0x1dcbcc['push'](_0x1dcbcc['shift']());}};_0x38590e(++_0x31a0fc);}(_0x4489,0x16f));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9448('0x0'));var emlformat=require(_0x9448('0x1'));var rimraf=require(_0x9448('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9448('0x3'));var rp=require(_0x9448('0x4'));var moment=require(_0x9448('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9448('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9448('0x7'));var fs=require('fs');var _=require(_0x9448('0x8'));var squel=require(_0x9448('0x9'));var crypto=require(_0x9448('0xa'));var jsforce=require(_0x9448('0xb'));var deskjs=require(_0x9448('0xc'));var toCsv=require(_0x9448('0xd'));var querystring=require(_0x9448('0xe'));var Papa=require(_0x9448('0xf'));var Redis=require('ioredis');var authService=require(_0x9448('0x10'));var qs=require(_0x9448('0x11'));var as=require(_0x9448('0x12'));var hardwareService=require(_0x9448('0x13'));var logger=require('../../config/logger')(_0x9448('0x14'));var utils=require(_0x9448('0x15'));var config=require(_0x9448('0x16'));var db=require(_0x9448('0x17'))['db'];config[_0x9448('0x18')]=_[_0x9448('0x19')](config[_0x9448('0x18')],{'host':_0x9448('0x1a'),'port':0x18eb});var socket=require(_0x9448('0x1b'))(new Redis(config[_0x9448('0x18')]));require(_0x9448('0x1c'))[_0x9448('0x1d')](socket);function respondWithStatusCode(_0x3f5d13,_0x5779cd){_0x5779cd=_0x5779cd||0xcc;return function(_0x58297e){if(_0x58297e){return _0x3f5d13['sendStatus'](_0x5779cd);}return _0x3f5d13[_0x9448('0x1e')](_0x5779cd)[_0x9448('0x1f')]();};}function respondWithResult(_0x5e6d6c,_0x2d4eb2){_0x2d4eb2=_0x2d4eb2||0xc8;return function(_0x439485){if(_0x439485){return _0x5e6d6c[_0x9448('0x1e')](_0x2d4eb2)[_0x9448('0x20')](_0x439485);}};}function respondWithFilteredResult(_0x2c874b,_0x33cb87){return function(_0x7cdfca){if(_0x7cdfca){var _0x3ba808=_0x7cdfca[_0x9448('0x21')],_0x2d3277=_0x33cb87['offset'],_0x539c99=_0x33cb87[_0x9448('0x22')]+_0x33cb87['limit'],_0x556057;if(_0x539c99>=_0x3ba808){_0x539c99=_0x3ba808;_0x556057=0xc8;}else{_0x556057=0xce;}_0x2c874b[_0x9448('0x1e')](_0x556057);return _0x2c874b[_0x9448('0x23')](_0x9448('0x24'),_0x2d3277+'-'+_0x539c99+'/'+_0x3ba808)[_0x9448('0x20')](_0x7cdfca);}return null;};}function patchUpdates(_0x5e76bd){return function(_0x53372b){try{jsonpatch['apply'](_0x53372b,_0x5e76bd,!![]);}catch(_0x26f407){return BPromise[_0x9448('0x25')](_0x26f407);}return _0x53372b[_0x9448('0x26')]();};}function saveUpdates(_0x59e30f,_0x401660){return function(_0x5b0028){if(_0x5b0028){return _0x5b0028['update'](_0x59e30f)['then'](function(_0x19224d){return _0x19224d;});}return null;};}function removeEntity(_0x20e54b,_0x279726){return function(_0x237060){if(_0x237060){return _0x237060[_0x9448('0x27')]()[_0x9448('0x28')](function(){var _0x252242=_0x237060[_0x9448('0x29')]({'plain':!![]});var _0x122367='MailQueues';return db[_0x9448('0x2a')][_0x9448('0x27')]({'where':{'type':_0x122367,'resourceId':_0x252242['id']}})[_0x9448('0x28')](function(){return _0x237060;});})[_0x9448('0x28')](function(){_0x20e54b['status'](0xcc)[_0x9448('0x1f')]();});}};}function handleEntityNotFound(_0x4b4efc,_0x1fc15e){return function(_0x5e2364){if(!_0x5e2364){_0x4b4efc[_0x9448('0x2b')](0x194);}return _0x5e2364;};}function handleError(_0x2c9812,_0x9de93f){_0x9de93f=_0x9de93f||0x1f4;return function(_0x11ddd2){logger['error'](_0x11ddd2[_0x9448('0x2c')]);if(_0x11ddd2[_0x9448('0x2d')]){delete _0x11ddd2[_0x9448('0x2d')];}_0x2c9812[_0x9448('0x1e')](_0x9de93f)[_0x9448('0x2e')](_0x11ddd2);};}exports[_0x9448('0x2f')]=function(_0x2de0ed,_0x445510){var _0x40bede={},_0x4efdd9={},_0x21b7eb={'count':0x0,'rows':[]};var _0x2c6c03=_[_0x9448('0x30')](db['MailQueue']['rawAttributes'],function(_0x21a886){return{'name':_0x21a886['fieldName'],'type':_0x21a886['type'][_0x9448('0x31')]};});_0x4efdd9['model']=_[_0x9448('0x30')](_0x2c6c03,_0x9448('0x2d'));_0x4efdd9['query']=_[_0x9448('0x32')](_0x2de0ed[_0x9448('0x33')]);_0x4efdd9[_0x9448('0x34')]=_['intersection'](_0x4efdd9['model'],_0x4efdd9[_0x9448('0x33')]);_0x40bede[_0x9448('0x35')]=_[_0x9448('0x36')](_0x4efdd9[_0x9448('0x37')],qs[_0x9448('0x38')](_0x2de0ed['query'][_0x9448('0x38')]));_0x40bede[_0x9448('0x35')]=_0x40bede[_0x9448('0x35')][_0x9448('0x39')]?_0x40bede[_0x9448('0x35')]:_0x4efdd9[_0x9448('0x37')];if(!_0x2de0ed[_0x9448('0x33')][_0x9448('0x3a')]('nolimit')){_0x40bede[_0x9448('0x3b')]=qs[_0x9448('0x3b')](_0x2de0ed[_0x9448('0x33')][_0x9448('0x3b')]);_0x40bede[_0x9448('0x22')]=qs[_0x9448('0x22')](_0x2de0ed[_0x9448('0x33')][_0x9448('0x22')]);}_0x40bede[_0x9448('0x3c')]=qs['sort'](_0x2de0ed[_0x9448('0x33')]['sort']);_0x40bede[_0x9448('0x3d')]=qs[_0x9448('0x34')](_[_0x9448('0x3e')](_0x2de0ed['query'],_0x4efdd9[_0x9448('0x34')]),_0x2c6c03);if(_0x2de0ed['query'][_0x9448('0x3f')]){_0x40bede[_0x9448('0x3d')]=_[_0x9448('0x40')](_0x40bede[_0x9448('0x3d')],{'$or':_[_0x9448('0x30')](_0x2c6c03,function(_0x58c3d9){if(_0x58c3d9['type']!==_0x9448('0x41')){var _0x27bcae={};_0x27bcae[_0x58c3d9[_0x9448('0x2d')]]={'$like':'%'+_0x2de0ed[_0x9448('0x33')][_0x9448('0x3f')]+'%'};return _0x27bcae;}})});}_0x40bede=_[_0x9448('0x40')]({},_0x40bede,_0x2de0ed[_0x9448('0x42')]);var _0x51dd57={'where':_0x40bede['where']};return db[_0x9448('0x43')]['count'](_0x51dd57)[_0x9448('0x28')](function(_0x2baf4f){_0x21b7eb[_0x9448('0x21')]=_0x2baf4f;if(_0x2de0ed[_0x9448('0x33')][_0x9448('0x44')]){_0x40bede[_0x9448('0x45')]=[{'all':!![]}];}return db[_0x9448('0x43')]['findAll'](_0x40bede);})[_0x9448('0x28')](function(_0x431d60){_0x21b7eb['rows']=_0x431d60;return _0x21b7eb;})['then'](respondWithFilteredResult(_0x445510,_0x40bede))['catch'](handleError(_0x445510,null));};exports[_0x9448('0x46')]=function(_0x5c4e41,_0x37de8c){var _0x24f4a7={'raw':!![],'where':{'id':_0x5c4e41['params']['id']}},_0x2e1fbc={};_0x2e1fbc[_0x9448('0x37')]=_['keys'](db[_0x9448('0x43')][_0x9448('0x47')]);_0x2e1fbc['query']=_[_0x9448('0x32')](_0x5c4e41[_0x9448('0x33')]);_0x2e1fbc[_0x9448('0x34')]=_[_0x9448('0x36')](_0x2e1fbc[_0x9448('0x37')],_0x2e1fbc[_0x9448('0x33')]);_0x24f4a7[_0x9448('0x35')]=_[_0x9448('0x36')](_0x2e1fbc[_0x9448('0x37')],qs[_0x9448('0x38')](_0x5c4e41[_0x9448('0x33')][_0x9448('0x38')]));_0x24f4a7[_0x9448('0x35')]=_0x24f4a7[_0x9448('0x35')]['length']?_0x24f4a7[_0x9448('0x35')]:_0x2e1fbc[_0x9448('0x37')];if(_0x5c4e41[_0x9448('0x33')][_0x9448('0x44')]){_0x24f4a7['include']=[{'all':!![]}];}_0x24f4a7=_[_0x9448('0x40')]({},_0x24f4a7,_0x5c4e41[_0x9448('0x42')]);return db[_0x9448('0x43')][_0x9448('0x48')](_0x24f4a7)['then'](handleEntityNotFound(_0x37de8c,null))[_0x9448('0x28')](respondWithResult(_0x37de8c,null))[_0x9448('0x49')](handleError(_0x37de8c,null));};exports[_0x9448('0x4a')]=function(_0x1b741b,_0x5e9f8f){return db[_0x9448('0x43')][_0x9448('0x4a')](_0x1b741b[_0x9448('0x4b')],{})['then'](function(_0x4d4b47){var _0xf114a6=_0x1b741b['user']['get']({'plain':!![]});if(!_0xf114a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf114a6['role']===_0x9448('0x4c')){var _0x26e29f=_0x4d4b47['get']({'plain':!![]});var _0x3b8ef7=_0x9448('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x3b8ef7,'userProfileId':_0xf114a6[_0x9448('0x4e')]},'raw':!![]})[_0x9448('0x28')](function(_0x5ee63a){if(_0x5ee63a&&_0x5ee63a[_0x9448('0x4f')]===0x0){return db[_0x9448('0x2a')]['create']({'name':_0x26e29f[_0x9448('0x2d')],'resourceId':_0x26e29f['id'],'type':_0x5ee63a['name'],'sectionId':_0x5ee63a['id']},{})[_0x9448('0x28')](function(){return _0x4d4b47;});}else{return _0x4d4b47;}})[_0x9448('0x49')](function(_0x4d4786){logger[_0x9448('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d4786);throw _0x4d4786;});}return _0x4d4b47;})[_0x9448('0x28')](respondWithResult(_0x5e9f8f,0xc9))[_0x9448('0x49')](handleError(_0x5e9f8f,null));};exports[_0x9448('0x51')]=function(_0x2c2243,_0x351095){if(_0x2c2243[_0x9448('0x4b')]['id']){delete _0x2c2243[_0x9448('0x4b')]['id'];}return db[_0x9448('0x43')]['find']({'where':{'id':_0x2c2243[_0x9448('0x52')]['id']}})[_0x9448('0x28')](handleEntityNotFound(_0x351095,null))[_0x9448('0x28')](saveUpdates(_0x2c2243[_0x9448('0x4b')],null))[_0x9448('0x28')](respondWithResult(_0x351095,null))['catch'](handleError(_0x351095,null));};exports[_0x9448('0x27')]=function(_0x4e9f93,_0x16d889){return db[_0x9448('0x43')]['find']({'where':{'id':_0x4e9f93[_0x9448('0x52')]['id']}})[_0x9448('0x28')](handleEntityNotFound(_0x16d889,null))['then'](removeEntity(_0x16d889,null))[_0x9448('0x49')](handleError(_0x16d889,null));};exports[_0x9448('0x53')]=function(_0xaca87,_0x3468f4){return db[_0x9448('0x43')][_0x9448('0x53')]()[_0x9448('0x28')](respondWithResult(_0x3468f4,null))[_0x9448('0x49')](handleError(_0x3468f4,null));};exports['getMembers']=function(_0x48bd93,_0x29146c,_0x637e31){var _0x1dbcc4={'raw':!![],'where':{}},_0x2ca199={},_0x96f2e7;return db[_0x9448('0x43')][_0x9448('0x54')]({'where':{'id':_0x48bd93[_0x9448('0x52')]['id']}})[_0x9448('0x28')](handleEntityNotFound(_0x29146c,null))[_0x9448('0x28')](function(_0x38deb7){if(_0x38deb7){_0x96f2e7=_0x38deb7['get']({'plain':!![]});_0x2ca199[_0x9448('0x37')]=_[_0x9448('0x32')](db['UserMailQueue']['rawAttributes']);_0x2ca199['query']=_[_0x9448('0x32')](_0x48bd93[_0x9448('0x33')]);_0x2ca199['filters']=_[_0x9448('0x36')](_0x2ca199[_0x9448('0x37')],_0x2ca199[_0x9448('0x33')]);_0x1dbcc4[_0x9448('0x35')]=_['intersection'](_0x2ca199[_0x9448('0x37')],qs[_0x9448('0x38')](_0x48bd93[_0x9448('0x33')]['fields']));_0x1dbcc4[_0x9448('0x35')]=_0x1dbcc4['attributes'][_0x9448('0x39')]?_0x1dbcc4[_0x9448('0x35')]:_0x2ca199[_0x9448('0x37')];if(!_0x48bd93[_0x9448('0x33')][_0x9448('0x3a')](_0x9448('0x55'))){_0x1dbcc4[_0x9448('0x3b')]=qs['limit'](_0x48bd93[_0x9448('0x33')][_0x9448('0x3b')]);_0x1dbcc4[_0x9448('0x22')]=qs['offset'](_0x48bd93['query'][_0x9448('0x22')]);}_0x1dbcc4[_0x9448('0x3c')]=qs[_0x9448('0x56')](_0x48bd93['query']['sort']);_0x1dbcc4[_0x9448('0x3d')]=qs[_0x9448('0x34')](_['pick'](_0x48bd93[_0x9448('0x33')],_0x2ca199[_0x9448('0x34')]));_0x1dbcc4['where'][_0x9448('0x57')]=_0x38deb7['id'];if(_0x48bd93[_0x9448('0x33')][_0x9448('0x3f')]){_0x1dbcc4[_0x9448('0x3d')]=_[_0x9448('0x40')](_0x1dbcc4[_0x9448('0x3d')],{'$or':_['map'](_0x1dbcc4[_0x9448('0x35')],function(_0x2c0e38){var _0x1d547e={};_0x1d547e[_0x2c0e38]={'$like':'%'+_0x48bd93['query'][_0x9448('0x3f')]+'%'};return _0x1d547e;})});}_0x1dbcc4=_[_0x9448('0x40')]({},_0x1dbcc4,_0x48bd93[_0x9448('0x42')]);return db[_0x9448('0x58')][_0x9448('0x59')](_0x1dbcc4);}})[_0x9448('0x28')](function(_0x2ebc97){if(_0x2ebc97){return db[_0x9448('0x5a')]['findAndCountAll']({'where':{'id':_[_0x9448('0x30')](_0x2ebc97,_0x9448('0x5b')),'role':_0x9448('0x5c')},'attributes':['id',_0x9448('0x2d'),_0x9448('0x5d'),'updatedAt','createdAt']});}})[_0x9448('0x28')](function(_0x3753ce){if(_0x3753ce){return{'count':_0x3753ce[_0x9448('0x21')],'rows':_[_0x9448('0x30')](_0x3753ce[_0x9448('0x5e')],function(_0x341ca4){return{'membername':_0x341ca4[_0x9448('0x2d')],'UserId':_0x341ca4['id'],'queue_name':_0x96f2e7[_0x9448('0x2d')],'MailQueueId':_0x96f2e7['id'],'interface':util[_0x9448('0x5f')](_0x9448('0x60'),_0x9448('0x61'),_0x341ca4[_0x9448('0x2d')]),'penalty':0x0,'paused':_0x341ca4[_0x9448('0x5d')],'createdAt':_0x341ca4[_0x9448('0x62')],'updatedAt':_0x341ca4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9448('0x28')](respondWithFilteredResult(_0x29146c,_0x1dbcc4))['catch'](handleError(_0x29146c,null));};exports[_0x9448('0x63')]=function(_0x2910f3,_0x56c9ed,_0x44fc17){var _0x42aeec={};var _0x23bf8f={};var _0x2214e8;var _0x16be48;return db[_0x9448('0x43')][_0x9448('0x54')]({'where':{'id':_0x2910f3[_0x9448('0x52')]['id']}})[_0x9448('0x28')](handleEntityNotFound(_0x56c9ed,null))['then'](function(_0x29ca7f){if(_0x29ca7f){_0x2214e8=_0x29ca7f;_0x23bf8f[_0x9448('0x37')]=_[_0x9448('0x32')](db[_0x9448('0x64')][_0x9448('0x47')]);_0x23bf8f[_0x9448('0x33')]=_['keys'](_0x2910f3['query']);_0x23bf8f[_0x9448('0x34')]=_[_0x9448('0x36')](_0x23bf8f[_0x9448('0x37')],_0x23bf8f[_0x9448('0x33')]);_0x42aeec[_0x9448('0x35')]=_[_0x9448('0x36')](_0x23bf8f[_0x9448('0x37')],qs[_0x9448('0x38')](_0x2910f3[_0x9448('0x33')][_0x9448('0x38')]));_0x42aeec[_0x9448('0x35')]=_0x42aeec[_0x9448('0x35')][_0x9448('0x39')]?_0x42aeec['attributes']:_0x23bf8f[_0x9448('0x37')];_0x42aeec[_0x9448('0x3c')]=qs['sort'](_0x2910f3['query'][_0x9448('0x56')]);_0x42aeec[_0x9448('0x3d')]=qs['filters'](_[_0x9448('0x3e')](_0x2910f3['query'],_0x23bf8f[_0x9448('0x34')]));if(_0x2910f3[_0x9448('0x33')][_0x9448('0x3f')]){_0x42aeec[_0x9448('0x3d')]=_[_0x9448('0x40')](_0x42aeec['where'],{'$or':_[_0x9448('0x30')](_0x42aeec[_0x9448('0x35')],function(_0x70d739){var _0x500cfc={};_0x500cfc[_0x70d739]={'$like':'%'+_0x2910f3[_0x9448('0x33')][_0x9448('0x3f')]+'%'};return _0x500cfc;})});}_0x42aeec=_[_0x9448('0x40')]({},_0x42aeec,_0x2910f3[_0x9448('0x42')]);return _0x2214e8[_0x9448('0x63')](_0x42aeec);}})[_0x9448('0x28')](function(_0x61410e){if(_0x61410e){_0x16be48=_0x61410e[_0x9448('0x39')];if(!_0x2910f3[_0x9448('0x33')][_0x9448('0x3a')](_0x9448('0x55'))){_0x42aeec[_0x9448('0x3b')]=qs[_0x9448('0x3b')](_0x2910f3[_0x9448('0x33')][_0x9448('0x3b')]);_0x42aeec['offset']=qs[_0x9448('0x22')](_0x2910f3[_0x9448('0x33')][_0x9448('0x22')]);}return _0x2214e8['getTeams'](_0x42aeec);}})[_0x9448('0x28')](function(_0x2d8433){if(_0x2d8433){return _0x2d8433?{'count':_0x16be48,'rows':_0x2d8433}:null;}})['then'](respondWithResult(_0x56c9ed,null))[_0x9448('0x49')](handleError(_0x56c9ed,null));};exports[_0x9448('0x65')]=function(_0xa25908,_0x464d48,_0xd1fd04){var _0x142c5b=_0xa25908['body'][_0x9448('0x66')];return db[_0x9448('0x64')][_0x9448('0x59')]({'where':{'id':_0x142c5b},'attributes':['id'],'include':[{'model':db[_0x9448('0x5a')],'as':_0x9448('0x67'),'attributes':['id',_0x9448('0x2d'),_0x9448('0x68'),_0x9448('0x69'),'interface'],'raw':!![]}]})[_0x9448('0x28')](function(_0x19e5ac){if(_0x19e5ac){var _0x5925e5=_[_0x9448('0x6a')](_0x19e5ac,function(_0x385f37){var _0x289ca4=_0x385f37[_0x9448('0x29')]({'plain':!![]});return _0x289ca4[_0x9448('0x67')];});return db[_0x9448('0x43')]['find']({'where':{'id':_0xa25908[_0x9448('0x52')]['id']}})[_0x9448('0x28')](function(_0x3e6e7a){return db[_0x9448('0x6b')]['transaction'](function(_0x1b6880){return _0x3e6e7a[_0x9448('0x65')](_0x142c5b,{'transaction':_0x1b6880})[_0x9448('0x28')](function(){return BPromise[_0x9448('0x6c')](_0x5925e5,function(_0x2e5e4a){return db['UserMailQueue'][_0x9448('0x6d')]({'where':{'UserId':_0x2e5e4a['id'],'MailQueueId':_0xa25908['params']['id']},'transaction':_0x1b6880});});})['then'](function(){_0x5925e5['forEach'](function(_0x1ed3d0){socket[_0x9448('0x6e')](_0x9448('0x6f'),{'UserId':_0x1ed3d0['id'],'MailQueueId':_0x3e6e7a['id']});});});});});}})['then'](respondWithStatusCode(_0x464d48,null))[_0x9448('0x49')](handleError(_0x464d48,null));};exports[_0x9448('0x70')]=function(_0x1f8e3d,_0x19073f,_0x3e4a8a){return db[_0x9448('0x64')]['findAll']({'where':{'id':_0x1f8e3d[_0x9448('0x33')][_0x9448('0x66')]},'attributes':['id'],'include':[{'model':db[_0x9448('0x5a')],'as':_0x9448('0x67'),'attributes':['id'],'raw':!![]}]})[_0x9448('0x28')](handleEntityNotFound(_0x19073f,null))[_0x9448('0x28')](function(_0x22607b){var _0xcce800=_[_0x9448('0x30')](_0x22607b,'id');var _0x2fc6f3=[];var _0x26ace6=[];var _0x5fa546=squel[_0x9448('0x71')]();_0x5fa546[_0x9448('0x72')](_0x9448('0x73'))['from'](_0x9448('0x74'),'tq')[_0x9448('0x75')]('user_has_teams','ut',_0x9448('0x76'))[_0x9448('0x3d')](_0x9448('0x77'),_0x1f8e3d['params']['id']);for(var _0x442752=0x0;_0x442752<_0x22607b[_0x9448('0x39')];_0x442752+=0x1){let _0x55328d=_0x22607b[_0x442752];for(var _0x4c8c2d=0x0;_0x4c8c2d<_0x55328d[_0x9448('0x67')][_0x9448('0x39')];_0x4c8c2d+=0x1){let _0x2e4578=_0x55328d['Agents'][_0x4c8c2d];var _0x13c905=_0x5fa546[_0x9448('0x78')]();_0x13c905['where'](_0x9448('0x79'),_0x2e4578['id']);_0x26ace6[_0x9448('0x7a')](db[_0x9448('0x6b')][_0x9448('0x33')](_0x13c905[_0x9448('0x7b')](),{'type':db[_0x9448('0x6b')][_0x9448('0x7c')]['SELECT']})[_0x9448('0x28')](function(_0x214587){if(_0x214587['length']===0x1){return _0x2e4578['id'];}else{var _0x57a8bb=_['every'](_[_0x9448('0x30')](_0x214587,_0x9448('0x7d')),function(_0x424f8c){return _[_0x9448('0x7e')](_0xcce800,_0x424f8c);});if(_0x57a8bb){return _0x2e4578['id'];}}}));}}return BPromise[_0x9448('0x7f')](_0x26ace6)[_0x9448('0x28')](function(_0xe95160){_0x2fc6f3=_(_0x2fc6f3)['union'](_0xe95160)['compact']()[_0x9448('0x80')]();return db[_0x9448('0x43')][_0x9448('0x48')]({'where':{'id':_0x1f8e3d[_0x9448('0x52')]['id']}})[_0x9448('0x28')](function(_0x2cead0){return db[_0x9448('0x6b')]['transaction'](function(_0x1a0433){return _0x2cead0['removeTeams'](_0x1f8e3d[_0x9448('0x33')][_0x9448('0x66')],{'transaction':_0x1a0433})['then'](function(){if(!_[_0x9448('0x81')](_0x2fc6f3)){return _0x2cead0[_0x9448('0x82')](_0x2fc6f3,{'transaction':_0x1a0433});}})[_0x9448('0x28')](function(){_0x2fc6f3['forEach'](function(_0x144fca){socket[_0x9448('0x6e')](_0x9448('0x83'),{'UserId':_0x144fca,'MailQueueId':_0x2cead0['id']});});});});});});})[_0x9448('0x28')](respondWithStatusCode(_0x19073f,null))['catch'](handleError(_0x19073f,null));};exports[_0x9448('0x84')]=function(_0x46fe82,_0x5c0a3f,_0x3071be){return db[_0x9448('0x43')][_0x9448('0x48')]({'where':{'id':_0x46fe82[_0x9448('0x52')]['id']}})['then'](handleEntityNotFound(_0x5c0a3f,null))[_0x9448('0x28')](function(_0x548032){if(_0x548032){return _0x548032[_0x9448('0x84')](_0x46fe82['body'][_0x9448('0x66')],_[_0x9448('0x85')](_0x46fe82[_0x9448('0x4b')],[_0x9448('0x66'),'id'])||{})[_0x9448('0x86')](function(_0x5bac71){for(var _0xae239b=0x0;_0xae239b<_0x46fe82[_0x9448('0x4b')][_0x9448('0x66')]['length'];_0xae239b+=0x1){socket['emit'](_0x9448('0x6f'),{'UserId':_0x46fe82[_0x9448('0x4b')][_0x9448('0x66')][_0xae239b],'MailQueueId':_0x46fe82[_0x9448('0x52')]['id']});}return _0x5bac71;});}})[_0x9448('0x28')](respondWithResult(_0x5c0a3f,null))[_0x9448('0x49')](handleError(_0x5c0a3f,null));};exports[_0x9448('0x82')]=function(_0x5c4302,_0x32fa5f,_0x56f0ff){return db[_0x9448('0x43')][_0x9448('0x48')]({'where':{'id':_0x5c4302[_0x9448('0x52')]['id']}})[_0x9448('0x28')](handleEntityNotFound(_0x32fa5f,null))[_0x9448('0x28')](function(_0x1cdaee){if(_0x1cdaee){return _0x1cdaee[_0x9448('0x82')](_0x5c4302[_0x9448('0x33')]['ids'])[_0x9448('0x28')](function(){if(_['isArray'](_0x5c4302[_0x9448('0x33')][_0x9448('0x66')])){for(var _0x342b3e=0x0;_0x342b3e<_0x5c4302[_0x9448('0x33')]['ids'][_0x9448('0x39')];_0x342b3e+=0x1){socket[_0x9448('0x6e')](_0x9448('0x83'),{'UserId':Number(_0x5c4302[_0x9448('0x33')][_0x9448('0x66')][_0x342b3e]),'MailQueueId':Number(_0x5c4302[_0x9448('0x52')]['id'])});}}else{socket[_0x9448('0x6e')](_0x9448('0x83'),{'UserId':Number(_0x5c4302[_0x9448('0x33')][_0x9448('0x66')]),'MailQueueId':Number(_0x5c4302[_0x9448('0x52')]['id'])});}});}})[_0x9448('0x28')](respondWithStatusCode(_0x32fa5f,null))['catch'](handleError(_0x32fa5f,null));};exports[_0x9448('0x87')]=function(_0x3d9b11,_0x1c809d,_0x306e93){var _0x34327d={};var _0x5a8eb4={};var _0x34bcfa;var _0x3456b3;return db[_0x9448('0x43')]['findOne']({'where':{'id':_0x3d9b11['params']['id']}})[_0x9448('0x28')](handleEntityNotFound(_0x1c809d,null))[_0x9448('0x28')](function(_0x11a829){if(_0x11a829){_0x34bcfa=_0x11a829;_0x5a8eb4['model']=_['keys'](db[_0x9448('0x5a')][_0x9448('0x47')]);_0x5a8eb4['query']=_[_0x9448('0x32')](_0x3d9b11[_0x9448('0x33')]);_0x5a8eb4[_0x9448('0x34')]=_[_0x9448('0x36')](_0x5a8eb4[_0x9448('0x37')],_0x5a8eb4[_0x9448('0x33')]);_0x34327d[_0x9448('0x35')]=_[_0x9448('0x36')](_0x5a8eb4[_0x9448('0x37')],qs[_0x9448('0x38')](_0x3d9b11['query'][_0x9448('0x38')]));_0x34327d[_0x9448('0x35')]=_0x34327d[_0x9448('0x35')][_0x9448('0x39')]?_0x34327d[_0x9448('0x35')]:_0x5a8eb4[_0x9448('0x37')];_0x34327d['order']=qs[_0x9448('0x56')](_0x3d9b11[_0x9448('0x33')][_0x9448('0x56')]);_0x34327d[_0x9448('0x3d')]=qs['filters'](_[_0x9448('0x3e')](_0x3d9b11[_0x9448('0x33')],_0x5a8eb4[_0x9448('0x34')]));if(_0x3d9b11[_0x9448('0x33')][_0x9448('0x3f')]){_0x34327d['where']=_[_0x9448('0x40')](_0x34327d['where'],{'$or':_['map'](_0x34327d['attributes'],function(_0x137d68){var _0x16e7ee={};_0x16e7ee[_0x137d68]={'$like':'%'+_0x3d9b11[_0x9448('0x33')][_0x9448('0x3f')]+'%'};return _0x16e7ee;})});}_0x34327d=_[_0x9448('0x40')]({},_0x34327d,_0x3d9b11[_0x9448('0x42')]);return _0x34bcfa[_0x9448('0x87')](_0x34327d);}})[_0x9448('0x28')](function(_0xb634fc){if(_0xb634fc){_0x3456b3=_0xb634fc[_0x9448('0x39')];if(!_0x3d9b11[_0x9448('0x33')]['hasOwnProperty'](_0x9448('0x55'))){_0x34327d[_0x9448('0x3b')]=qs[_0x9448('0x3b')](_0x3d9b11[_0x9448('0x33')][_0x9448('0x3b')]);_0x34327d[_0x9448('0x22')]=qs[_0x9448('0x22')](_0x3d9b11['query'][_0x9448('0x22')]);}return _0x34bcfa[_0x9448('0x87')](_0x34327d);}})[_0x9448('0x28')](function(_0x3495c){if(_0x3495c){return _0x3495c?{'count':_0x3456b3,'rows':_0x3495c}:null;}})[_0x9448('0x28')](respondWithResult(_0x1c809d,null))['catch'](handleError(_0x1c809d,null));}; \ No newline at end of file +var _0x4f4f=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','count','offset','limit','Content-Range','json','reject','update','then','destroy','get','MailQueues','sendStatus','error','stack','send','index','map','MailQueue','rawAttributes','fieldName','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','order','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','%s/%s','createdAt','getTeams','findOne','Team','length','addTeams','ids','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x13fc80,_0xd8132e){var _0x2dbcfa=function(_0x4e1e13){while(--_0x4e1e13){_0x13fc80['push'](_0x13fc80['shift']());}};_0x2dbcfa(++_0xd8132e);}(_0x4f4f,0x7e));var _0xf4f4=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x4f4f[_0x4e9628];return _0x27bc8c;};'use strict';var pdf=require(_0xf4f4('0x0'));var emlformat=require(_0xf4f4('0x1'));var rimraf=require(_0xf4f4('0x2'));var zipdir=require(_0xf4f4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4f4('0x4'));var moment=require(_0xf4f4('0x5'));var BPromise=require(_0xf4f4('0x6'));var Mustache=require(_0xf4f4('0x7'));var util=require('util');var path=require(_0xf4f4('0x8'));var sox=require(_0xf4f4('0x9'));var csv=require(_0xf4f4('0xa'));var ejs=require(_0xf4f4('0xb'));var fs=require('fs');var _=require(_0xf4f4('0xc'));var squel=require(_0xf4f4('0xd'));var crypto=require(_0xf4f4('0xe'));var jsforce=require(_0xf4f4('0xf'));var deskjs=require(_0xf4f4('0x10'));var toCsv=require(_0xf4f4('0xa'));var querystring=require(_0xf4f4('0x11'));var Papa=require(_0xf4f4('0x12'));var Redis=require('ioredis');var authService=require(_0xf4f4('0x13'));var qs=require(_0xf4f4('0x14'));var as=require(_0xf4f4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4f4('0x16'))(_0xf4f4('0x17'));var utils=require(_0xf4f4('0x18'));var config=require(_0xf4f4('0x19'));var db=require(_0xf4f4('0x1a'))['db'];config['redis']=_[_0xf4f4('0x1b')](config[_0xf4f4('0x1c')],{'host':_0xf4f4('0x1d'),'port':0x18eb});var socket=require(_0xf4f4('0x1e'))(new Redis(config[_0xf4f4('0x1c')]));require(_0xf4f4('0x1f'))[_0xf4f4('0x20')](socket);function respondWithStatusCode(_0x52ff27,_0x396d22){_0x396d22=_0x396d22||0xcc;return function(_0x1a4ff2){if(_0x1a4ff2){return _0x52ff27['sendStatus'](_0x396d22);}return _0x52ff27[_0xf4f4('0x21')](_0x396d22)[_0xf4f4('0x22')]();};}function respondWithResult(_0x3a4fc1,_0x5d4d95){_0x5d4d95=_0x5d4d95||0xc8;return function(_0x74f588){if(_0x74f588){return _0x3a4fc1[_0xf4f4('0x21')](_0x5d4d95)['json'](_0x74f588);}};}function respondWithFilteredResult(_0x301a6b,_0x27ea2f){return function(_0x5e2833){if(_0x5e2833){var _0x209fd2=_0x5e2833[_0xf4f4('0x23')],_0xdf687d=_0x27ea2f[_0xf4f4('0x24')],_0x277d31=_0x27ea2f[_0xf4f4('0x24')]+_0x27ea2f[_0xf4f4('0x25')],_0xa7481d;if(_0x277d31>=_0x209fd2){_0x277d31=_0x209fd2;_0xa7481d=0xc8;}else{_0xa7481d=0xce;}_0x301a6b[_0xf4f4('0x21')](_0xa7481d);return _0x301a6b['set'](_0xf4f4('0x26'),_0xdf687d+'-'+_0x277d31+'/'+_0x209fd2)[_0xf4f4('0x27')](_0x5e2833);}return null;};}function patchUpdates(_0xef742d){return function(_0x439610){try{jsonpatch['apply'](_0x439610,_0xef742d,!![]);}catch(_0x3ca316){return BPromise[_0xf4f4('0x28')](_0x3ca316);}return _0x439610['save']();};}function saveUpdates(_0x4289f9,_0x1c9572){return function(_0x5359e1){if(_0x5359e1){return _0x5359e1[_0xf4f4('0x29')](_0x4289f9)[_0xf4f4('0x2a')](function(_0x45a5eb){return _0x45a5eb;});}return null;};}function removeEntity(_0x8fa84f,_0x1663d5){return function(_0x1fc833){if(_0x1fc833){return _0x1fc833[_0xf4f4('0x2b')]()[_0xf4f4('0x2a')](function(){var _0x2a8ad7=_0x1fc833[_0xf4f4('0x2c')]({'plain':!![]});var _0x238313=_0xf4f4('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x238313,'resourceId':_0x2a8ad7['id']}})[_0xf4f4('0x2a')](function(){return _0x1fc833;});})['then'](function(){_0x8fa84f[_0xf4f4('0x21')](0xcc)[_0xf4f4('0x22')]();});}};}function handleEntityNotFound(_0x23e7a3,_0x53604c){return function(_0x34e2c5){if(!_0x34e2c5){_0x23e7a3[_0xf4f4('0x2e')](0x194);}return _0x34e2c5;};}function handleError(_0x1e3f7d,_0x116fc2){_0x116fc2=_0x116fc2||0x1f4;return function(_0x561ef3){logger[_0xf4f4('0x2f')](_0x561ef3[_0xf4f4('0x30')]);if(_0x561ef3['name']){delete _0x561ef3['name'];}_0x1e3f7d[_0xf4f4('0x21')](_0x116fc2)[_0xf4f4('0x31')](_0x561ef3);};}exports[_0xf4f4('0x32')]=function(_0x1e1c53,_0x33d77e){var _0x3788d3={},_0x4a25b8={},_0x51accf={'count':0x0,'rows':[]};var _0x5e89ef=_[_0xf4f4('0x33')](db[_0xf4f4('0x34')][_0xf4f4('0x35')],function(_0x1fc324){return{'name':_0x1fc324[_0xf4f4('0x36')],'type':_0x1fc324['type']['key']};});_0x4a25b8[_0xf4f4('0x37')]=_[_0xf4f4('0x33')](_0x5e89ef,_0xf4f4('0x38'));_0x4a25b8[_0xf4f4('0x39')]=_['keys'](_0x1e1c53[_0xf4f4('0x39')]);_0x4a25b8[_0xf4f4('0x3a')]=_[_0xf4f4('0x3b')](_0x4a25b8[_0xf4f4('0x37')],_0x4a25b8[_0xf4f4('0x39')]);_0x3788d3[_0xf4f4('0x3c')]=_[_0xf4f4('0x3b')](_0x4a25b8[_0xf4f4('0x37')],qs[_0xf4f4('0x3d')](_0x1e1c53[_0xf4f4('0x39')][_0xf4f4('0x3d')]));_0x3788d3[_0xf4f4('0x3c')]=_0x3788d3[_0xf4f4('0x3c')]['length']?_0x3788d3['attributes']:_0x4a25b8[_0xf4f4('0x37')];if(!_0x1e1c53[_0xf4f4('0x39')][_0xf4f4('0x3e')](_0xf4f4('0x3f'))){_0x3788d3['limit']=qs['limit'](_0x1e1c53[_0xf4f4('0x39')][_0xf4f4('0x25')]);_0x3788d3[_0xf4f4('0x24')]=qs[_0xf4f4('0x24')](_0x1e1c53[_0xf4f4('0x39')][_0xf4f4('0x24')]);}_0x3788d3['order']=qs[_0xf4f4('0x40')](_0x1e1c53[_0xf4f4('0x39')][_0xf4f4('0x40')]);_0x3788d3['where']=qs[_0xf4f4('0x3a')](_[_0xf4f4('0x41')](_0x1e1c53['query'],_0x4a25b8[_0xf4f4('0x3a')]),_0x5e89ef);if(_0x1e1c53[_0xf4f4('0x39')][_0xf4f4('0x42')]){_0x3788d3[_0xf4f4('0x43')]=_[_0xf4f4('0x44')](_0x3788d3[_0xf4f4('0x43')],{'$or':_['map'](_0x5e89ef,function(_0x116831){if(_0x116831['type']!=='VIRTUAL'){var _0x68980f={};_0x68980f[_0x116831[_0xf4f4('0x38')]]={'$like':'%'+_0x1e1c53[_0xf4f4('0x39')][_0xf4f4('0x42')]+'%'};return _0x68980f;}})});}_0x3788d3=_[_0xf4f4('0x44')]({},_0x3788d3,_0x1e1c53[_0xf4f4('0x45')]);var _0x200dcd={'where':_0x3788d3[_0xf4f4('0x43')]};return db['MailQueue'][_0xf4f4('0x23')](_0x200dcd)[_0xf4f4('0x2a')](function(_0x2e9aa9){_0x51accf[_0xf4f4('0x23')]=_0x2e9aa9;if(_0x1e1c53[_0xf4f4('0x39')][_0xf4f4('0x46')]){_0x3788d3[_0xf4f4('0x47')]=[{'all':!![]}];}return db[_0xf4f4('0x34')][_0xf4f4('0x48')](_0x3788d3);})[_0xf4f4('0x2a')](function(_0x3cd7fd){_0x51accf[_0xf4f4('0x49')]=_0x3cd7fd;return _0x51accf;})[_0xf4f4('0x2a')](respondWithFilteredResult(_0x33d77e,_0x3788d3))[_0xf4f4('0x4a')](handleError(_0x33d77e,null));};exports['show']=function(_0x20b8e8,_0x2e5489){var _0x2c9af6={'raw':!![],'where':{'id':_0x20b8e8[_0xf4f4('0x4b')]['id']}},_0x1f1372={};_0x1f1372[_0xf4f4('0x37')]=_['keys'](db[_0xf4f4('0x34')]['rawAttributes']);_0x1f1372['query']=_[_0xf4f4('0x4c')](_0x20b8e8[_0xf4f4('0x39')]);_0x1f1372[_0xf4f4('0x3a')]=_['intersection'](_0x1f1372[_0xf4f4('0x37')],_0x1f1372[_0xf4f4('0x39')]);_0x2c9af6[_0xf4f4('0x3c')]=_[_0xf4f4('0x3b')](_0x1f1372[_0xf4f4('0x37')],qs[_0xf4f4('0x3d')](_0x20b8e8[_0xf4f4('0x39')][_0xf4f4('0x3d')]));_0x2c9af6[_0xf4f4('0x3c')]=_0x2c9af6['attributes']['length']?_0x2c9af6[_0xf4f4('0x3c')]:_0x1f1372[_0xf4f4('0x37')];if(_0x20b8e8['query'][_0xf4f4('0x46')]){_0x2c9af6[_0xf4f4('0x47')]=[{'all':!![]}];}_0x2c9af6=_['merge']({},_0x2c9af6,_0x20b8e8[_0xf4f4('0x45')]);return db['MailQueue'][_0xf4f4('0x4d')](_0x2c9af6)[_0xf4f4('0x2a')](handleEntityNotFound(_0x2e5489,null))[_0xf4f4('0x2a')](respondWithResult(_0x2e5489,null))[_0xf4f4('0x4a')](handleError(_0x2e5489,null));};exports[_0xf4f4('0x4e')]=function(_0x4eb909,_0x211135){return db[_0xf4f4('0x34')][_0xf4f4('0x4e')](_0x4eb909[_0xf4f4('0x4f')],{})['then'](function(_0x188cfa){var _0x9f3949=_0x4eb909['user'][_0xf4f4('0x2c')]({'plain':!![]});if(!_0x9f3949)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9f3949[_0xf4f4('0x50')]==='user'){var _0x21d97f=_0x188cfa['get']({'plain':!![]});var _0x2a9a6a=_0xf4f4('0x2d');return db[_0xf4f4('0x51')][_0xf4f4('0x4d')]({'where':{'name':_0x2a9a6a,'userProfileId':_0x9f3949[_0xf4f4('0x52')]},'raw':!![]})['then'](function(_0x45dc79){if(_0x45dc79&&_0x45dc79[_0xf4f4('0x53')]===0x0){return db[_0xf4f4('0x54')][_0xf4f4('0x4e')]({'name':_0x21d97f[_0xf4f4('0x38')],'resourceId':_0x21d97f['id'],'type':_0x45dc79[_0xf4f4('0x38')],'sectionId':_0x45dc79['id']},{})[_0xf4f4('0x2a')](function(){return _0x188cfa;});}else{return _0x188cfa;}})[_0xf4f4('0x4a')](function(_0x169ff8){logger[_0xf4f4('0x2f')](_0xf4f4('0x55'),_0x169ff8);throw _0x169ff8;});}return _0x188cfa;})[_0xf4f4('0x2a')](respondWithResult(_0x211135,0xc9))['catch'](handleError(_0x211135,null));};exports[_0xf4f4('0x29')]=function(_0x21de49,_0x5ca4fd){if(_0x21de49[_0xf4f4('0x4f')]['id']){delete _0x21de49[_0xf4f4('0x4f')]['id'];}return db[_0xf4f4('0x34')]['find']({'where':{'id':_0x21de49['params']['id']}})[_0xf4f4('0x2a')](handleEntityNotFound(_0x5ca4fd,null))[_0xf4f4('0x2a')](saveUpdates(_0x21de49[_0xf4f4('0x4f')],null))[_0xf4f4('0x2a')](respondWithResult(_0x5ca4fd,null))['catch'](handleError(_0x5ca4fd,null));};exports[_0xf4f4('0x2b')]=function(_0xec1d08,_0x4649cb){return db[_0xf4f4('0x34')]['find']({'where':{'id':_0xec1d08[_0xf4f4('0x4b')]['id']}})[_0xf4f4('0x2a')](handleEntityNotFound(_0x4649cb,null))[_0xf4f4('0x2a')](removeEntity(_0x4649cb,null))[_0xf4f4('0x4a')](handleError(_0x4649cb,null));};exports[_0xf4f4('0x56')]=function(_0x14a89b,_0x307567){return db[_0xf4f4('0x34')][_0xf4f4('0x56')]()[_0xf4f4('0x2a')](respondWithResult(_0x307567,null))[_0xf4f4('0x4a')](handleError(_0x307567,null));};exports[_0xf4f4('0x57')]=function(_0x18c4a8,_0x544fcd,_0x517e25){var _0x22382c={'raw':!![],'where':{}},_0x2b4114={},_0x55f3ed;return db[_0xf4f4('0x34')]['findOne']({'where':{'id':_0x18c4a8[_0xf4f4('0x4b')]['id']}})[_0xf4f4('0x2a')](handleEntityNotFound(_0x544fcd,null))['then'](function(_0x1ce19e){if(_0x1ce19e){_0x55f3ed=_0x1ce19e[_0xf4f4('0x2c')]({'plain':!![]});_0x2b4114[_0xf4f4('0x37')]=_[_0xf4f4('0x4c')](db[_0xf4f4('0x58')][_0xf4f4('0x35')]);_0x2b4114[_0xf4f4('0x39')]=_[_0xf4f4('0x4c')](_0x18c4a8['query']);_0x2b4114['filters']=_['intersection'](_0x2b4114[_0xf4f4('0x37')],_0x2b4114[_0xf4f4('0x39')]);_0x22382c[_0xf4f4('0x3c')]=_['intersection'](_0x2b4114[_0xf4f4('0x37')],qs[_0xf4f4('0x3d')](_0x18c4a8[_0xf4f4('0x39')][_0xf4f4('0x3d')]));_0x22382c['attributes']=_0x22382c[_0xf4f4('0x3c')]['length']?_0x22382c['attributes']:_0x2b4114[_0xf4f4('0x37')];if(!_0x18c4a8[_0xf4f4('0x39')][_0xf4f4('0x3e')](_0xf4f4('0x3f'))){_0x22382c[_0xf4f4('0x25')]=qs['limit'](_0x18c4a8[_0xf4f4('0x39')]['limit']);_0x22382c['offset']=qs[_0xf4f4('0x24')](_0x18c4a8[_0xf4f4('0x39')][_0xf4f4('0x24')]);}_0x22382c[_0xf4f4('0x59')]=qs['sort'](_0x18c4a8[_0xf4f4('0x39')]['sort']);_0x22382c[_0xf4f4('0x43')]=qs['filters'](_['pick'](_0x18c4a8['query'],_0x2b4114[_0xf4f4('0x3a')]));_0x22382c[_0xf4f4('0x43')][_0xf4f4('0x5a')]=_0x1ce19e['id'];if(_0x18c4a8['query'][_0xf4f4('0x42')]){_0x22382c[_0xf4f4('0x43')]=_[_0xf4f4('0x44')](_0x22382c[_0xf4f4('0x43')],{'$or':_[_0xf4f4('0x33')](_0x22382c[_0xf4f4('0x3c')],function(_0x3b7043){var _0x1d7d7e={};_0x1d7d7e[_0x3b7043]={'$like':'%'+_0x18c4a8[_0xf4f4('0x39')]['filter']+'%'};return _0x1d7d7e;})});}_0x22382c=_[_0xf4f4('0x44')]({},_0x22382c,_0x18c4a8['options']);return db['UserMailQueue'][_0xf4f4('0x48')](_0x22382c);}})[_0xf4f4('0x2a')](function(_0x1bcce1){if(_0x1bcce1){return db[_0xf4f4('0x5b')][_0xf4f4('0x5c')]({'where':{'id':_[_0xf4f4('0x33')](_0x1bcce1,_0xf4f4('0x5d')),'role':_0xf4f4('0x5e')},'attributes':['id',_0xf4f4('0x38'),_0xf4f4('0x5f'),_0xf4f4('0x60'),'createdAt']});}})['then'](function(_0x2cab5c){if(_0x2cab5c){return{'count':_0x2cab5c[_0xf4f4('0x23')],'rows':_[_0xf4f4('0x33')](_0x2cab5c[_0xf4f4('0x49')],function(_0x512ad5){return{'membername':_0x512ad5[_0xf4f4('0x38')],'UserId':_0x512ad5['id'],'queue_name':_0x55f3ed[_0xf4f4('0x38')],'MailQueueId':_0x55f3ed['id'],'interface':util[_0xf4f4('0x61')](_0xf4f4('0x62'),'SIP',_0x512ad5[_0xf4f4('0x38')]),'penalty':0x0,'paused':_0x512ad5[_0xf4f4('0x5f')],'createdAt':_0x512ad5[_0xf4f4('0x63')],'updatedAt':_0x512ad5[_0xf4f4('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf4f4('0x2a')](respondWithFilteredResult(_0x544fcd,_0x22382c))['catch'](handleError(_0x544fcd,null));};exports[_0xf4f4('0x64')]=function(_0x2a562a,_0x352eeb,_0x283e69){var _0x2e5ff5={};var _0x19e52b={};var _0x2e343b;var _0x2572b8;return db[_0xf4f4('0x34')][_0xf4f4('0x65')]({'where':{'id':_0x2a562a[_0xf4f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x352eeb,null))[_0xf4f4('0x2a')](function(_0x272489){if(_0x272489){_0x2e343b=_0x272489;_0x19e52b[_0xf4f4('0x37')]=_['keys'](db[_0xf4f4('0x66')][_0xf4f4('0x35')]);_0x19e52b[_0xf4f4('0x39')]=_[_0xf4f4('0x4c')](_0x2a562a[_0xf4f4('0x39')]);_0x19e52b[_0xf4f4('0x3a')]=_[_0xf4f4('0x3b')](_0x19e52b[_0xf4f4('0x37')],_0x19e52b[_0xf4f4('0x39')]);_0x2e5ff5[_0xf4f4('0x3c')]=_[_0xf4f4('0x3b')](_0x19e52b[_0xf4f4('0x37')],qs[_0xf4f4('0x3d')](_0x2a562a[_0xf4f4('0x39')][_0xf4f4('0x3d')]));_0x2e5ff5['attributes']=_0x2e5ff5['attributes']['length']?_0x2e5ff5[_0xf4f4('0x3c')]:_0x19e52b['model'];_0x2e5ff5[_0xf4f4('0x59')]=qs[_0xf4f4('0x40')](_0x2a562a[_0xf4f4('0x39')][_0xf4f4('0x40')]);_0x2e5ff5[_0xf4f4('0x43')]=qs[_0xf4f4('0x3a')](_[_0xf4f4('0x41')](_0x2a562a['query'],_0x19e52b['filters']));if(_0x2a562a[_0xf4f4('0x39')][_0xf4f4('0x42')]){_0x2e5ff5['where']=_[_0xf4f4('0x44')](_0x2e5ff5['where'],{'$or':_[_0xf4f4('0x33')](_0x2e5ff5[_0xf4f4('0x3c')],function(_0x6756ef){var _0x3d43a8={};_0x3d43a8[_0x6756ef]={'$like':'%'+_0x2a562a[_0xf4f4('0x39')][_0xf4f4('0x42')]+'%'};return _0x3d43a8;})});}_0x2e5ff5=_['merge']({},_0x2e5ff5,_0x2a562a['options']);return _0x2e343b[_0xf4f4('0x64')](_0x2e5ff5);}})[_0xf4f4('0x2a')](function(_0x1bacad){if(_0x1bacad){_0x2572b8=_0x1bacad[_0xf4f4('0x67')];if(!_0x2a562a[_0xf4f4('0x39')]['hasOwnProperty']('nolimit')){_0x2e5ff5[_0xf4f4('0x25')]=qs[_0xf4f4('0x25')](_0x2a562a[_0xf4f4('0x39')][_0xf4f4('0x25')]);_0x2e5ff5[_0xf4f4('0x24')]=qs['offset'](_0x2a562a[_0xf4f4('0x39')][_0xf4f4('0x24')]);}return _0x2e343b['getTeams'](_0x2e5ff5);}})[_0xf4f4('0x2a')](function(_0x37c360){if(_0x37c360){return _0x37c360?{'count':_0x2572b8,'rows':_0x37c360}:null;}})['then'](respondWithResult(_0x352eeb,null))['catch'](handleError(_0x352eeb,null));};exports[_0xf4f4('0x68')]=function(_0x54d699,_0x146fe5,_0x2a48e2){var _0x4b75b7=_0x54d699[_0xf4f4('0x4f')][_0xf4f4('0x69')];return db['Team']['findAll']({'where':{'id':_0x4b75b7},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf4f4('0x6a'),'attributes':['id','name',_0xf4f4('0x6b'),'voicePause',_0xf4f4('0x6c')],'raw':!![]}]})[_0xf4f4('0x2a')](function(_0x1ac34b){if(_0x1ac34b){var _0x40c83a=_[_0xf4f4('0x6d')](_0x1ac34b,function(_0x335002){var _0x2899bb=_0x335002['get']({'plain':!![]});return _0x2899bb[_0xf4f4('0x6a')];});return db[_0xf4f4('0x34')][_0xf4f4('0x4d')]({'where':{'id':_0x54d699[_0xf4f4('0x4b')]['id']}})[_0xf4f4('0x2a')](function(_0x2ed9f2){return db['sequelize'][_0xf4f4('0x6e')](function(_0x309353){return _0x2ed9f2[_0xf4f4('0x68')](_0x4b75b7,{'transaction':_0x309353})['then'](function(){return BPromise[_0xf4f4('0x6f')](_0x40c83a,function(_0x79b5ea){return db['UserMailQueue'][_0xf4f4('0x70')]({'where':{'UserId':_0x79b5ea['id'],'MailQueueId':_0x54d699[_0xf4f4('0x4b')]['id']},'transaction':_0x309353});});})['then'](function(){_0x40c83a[_0xf4f4('0x71')](function(_0x57df75){socket[_0xf4f4('0x72')](_0xf4f4('0x73'),{'UserId':_0x57df75['id'],'MailQueueId':_0x2ed9f2['id']});});});});});}})[_0xf4f4('0x2a')](respondWithStatusCode(_0x146fe5,null))['catch'](handleError(_0x146fe5,null));};exports['removeTeams']=function(_0x261e38,_0x643708,_0x267b6b){return db[_0xf4f4('0x66')]['findAll']({'where':{'id':_0x261e38[_0xf4f4('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf4f4('0x5b')],'as':_0xf4f4('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf4f4('0x2a')](handleEntityNotFound(_0x643708,null))['then'](function(_0x1c1565){var _0x54685b=_[_0xf4f4('0x33')](_0x1c1565,'id');var _0xc5eb61=[];var _0x12d949=[];var _0x22d37d=squel[_0xf4f4('0x74')]();_0x22d37d[_0xf4f4('0x75')](_0xf4f4('0x76'))[_0xf4f4('0x77')](_0xf4f4('0x78'),'tq')[_0xf4f4('0x79')](_0xf4f4('0x7a'),'ut',_0xf4f4('0x7b'))['where'](_0xf4f4('0x7c'),_0x261e38[_0xf4f4('0x4b')]['id']);for(var _0x36371b=0x0;_0x36371b<_0x1c1565[_0xf4f4('0x67')];_0x36371b+=0x1){let _0x19e2d6=_0x1c1565[_0x36371b];for(var _0x4822ef=0x0;_0x4822ef<_0x19e2d6['Agents'][_0xf4f4('0x67')];_0x4822ef+=0x1){let _0x558618=_0x19e2d6[_0xf4f4('0x6a')][_0x4822ef];var _0x585263=_0x22d37d[_0xf4f4('0x7d')]();_0x585263[_0xf4f4('0x43')]('ut.UserId\x20=\x20?',_0x558618['id']);_0x12d949[_0xf4f4('0x7e')](db[_0xf4f4('0x7f')]['query'](_0x585263['toString'](),{'type':db['sequelize'][_0xf4f4('0x80')][_0xf4f4('0x81')]})[_0xf4f4('0x2a')](function(_0x20f7fd){if(_0x20f7fd[_0xf4f4('0x67')]===0x1){return _0x558618['id'];}else{var _0x57aef1=_[_0xf4f4('0x82')](_['map'](_0x20f7fd,_0xf4f4('0x83')),function(_0x48413f){return _[_0xf4f4('0x84')](_0x54685b,_0x48413f);});if(_0x57aef1){return _0x558618['id'];}}}));}}return BPromise['all'](_0x12d949)[_0xf4f4('0x2a')](function(_0x9630e4){_0xc5eb61=_(_0xc5eb61)[_0xf4f4('0x85')](_0x9630e4)[_0xf4f4('0x86')]()[_0xf4f4('0x87')]();return db[_0xf4f4('0x34')]['find']({'where':{'id':_0x261e38[_0xf4f4('0x4b')]['id']}})[_0xf4f4('0x2a')](function(_0x19ffae){return db[_0xf4f4('0x7f')][_0xf4f4('0x6e')](function(_0x1f2e46){return _0x19ffae[_0xf4f4('0x88')](_0x261e38[_0xf4f4('0x39')][_0xf4f4('0x69')],{'transaction':_0x1f2e46})[_0xf4f4('0x2a')](function(){if(!_[_0xf4f4('0x89')](_0xc5eb61)){return _0x19ffae[_0xf4f4('0x8a')](_0xc5eb61,{'transaction':_0x1f2e46});}})[_0xf4f4('0x2a')](function(){_0xc5eb61[_0xf4f4('0x71')](function(_0x50dfc5){socket[_0xf4f4('0x72')](_0xf4f4('0x8b'),{'UserId':_0x50dfc5,'MailQueueId':_0x19ffae['id']});});});});});});})[_0xf4f4('0x2a')](respondWithStatusCode(_0x643708,null))['catch'](handleError(_0x643708,null));};exports[_0xf4f4('0x8c')]=function(_0xdceb4e,_0x1c67a3,_0xb4b0f3){return db['MailQueue'][_0xf4f4('0x4d')]({'where':{'id':_0xdceb4e[_0xf4f4('0x4b')]['id']}})[_0xf4f4('0x2a')](handleEntityNotFound(_0x1c67a3,null))[_0xf4f4('0x2a')](function(_0x31ca41){if(_0x31ca41){return _0x31ca41['addAgents'](_0xdceb4e[_0xf4f4('0x4f')][_0xf4f4('0x69')],_['omit'](_0xdceb4e[_0xf4f4('0x4f')],[_0xf4f4('0x69'),'id'])||{})[_0xf4f4('0x8d')](function(_0x3792f9){for(var _0x869b08=0x0;_0x869b08<_0xdceb4e['body'][_0xf4f4('0x69')][_0xf4f4('0x67')];_0x869b08+=0x1){socket[_0xf4f4('0x72')](_0xf4f4('0x73'),{'UserId':_0xdceb4e[_0xf4f4('0x4f')][_0xf4f4('0x69')][_0x869b08],'MailQueueId':_0xdceb4e[_0xf4f4('0x4b')]['id']});}return _0x3792f9;});}})['then'](respondWithResult(_0x1c67a3,null))[_0xf4f4('0x4a')](handleError(_0x1c67a3,null));};exports[_0xf4f4('0x8a')]=function(_0xf42f34,_0x50fba3,_0x1d7868){return db['MailQueue'][_0xf4f4('0x4d')]({'where':{'id':_0xf42f34['params']['id']}})['then'](handleEntityNotFound(_0x50fba3,null))['then'](function(_0x12d849){if(_0x12d849){return _0x12d849['removeAgents'](_0xf42f34[_0xf4f4('0x39')]['ids'])[_0xf4f4('0x2a')](function(){if(_['isArray'](_0xf42f34[_0xf4f4('0x39')][_0xf4f4('0x69')])){for(var _0x2496ee=0x0;_0x2496ee<_0xf42f34['query'][_0xf4f4('0x69')][_0xf4f4('0x67')];_0x2496ee+=0x1){socket[_0xf4f4('0x72')](_0xf4f4('0x8b'),{'UserId':Number(_0xf42f34[_0xf4f4('0x39')][_0xf4f4('0x69')][_0x2496ee]),'MailQueueId':Number(_0xf42f34[_0xf4f4('0x4b')]['id'])});}}else{socket[_0xf4f4('0x72')](_0xf4f4('0x8b'),{'UserId':Number(_0xf42f34[_0xf4f4('0x39')][_0xf4f4('0x69')]),'MailQueueId':Number(_0xf42f34[_0xf4f4('0x4b')]['id'])});}});}})[_0xf4f4('0x2a')](respondWithStatusCode(_0x50fba3,null))[_0xf4f4('0x4a')](handleError(_0x50fba3,null));};exports[_0xf4f4('0x8e')]=function(_0x34ef05,_0x369518,_0x27499a){var _0x4e4b59={};var _0x505d10={};var _0x13af8b;var _0x1860a1;return db[_0xf4f4('0x34')][_0xf4f4('0x65')]({'where':{'id':_0x34ef05['params']['id']}})['then'](handleEntityNotFound(_0x369518,null))[_0xf4f4('0x2a')](function(_0x23626f){if(_0x23626f){_0x13af8b=_0x23626f;_0x505d10[_0xf4f4('0x37')]=_['keys'](db[_0xf4f4('0x5b')][_0xf4f4('0x35')]);_0x505d10[_0xf4f4('0x39')]=_['keys'](_0x34ef05[_0xf4f4('0x39')]);_0x505d10[_0xf4f4('0x3a')]=_['intersection'](_0x505d10[_0xf4f4('0x37')],_0x505d10[_0xf4f4('0x39')]);_0x4e4b59[_0xf4f4('0x3c')]=_['intersection'](_0x505d10[_0xf4f4('0x37')],qs[_0xf4f4('0x3d')](_0x34ef05[_0xf4f4('0x39')][_0xf4f4('0x3d')]));_0x4e4b59[_0xf4f4('0x3c')]=_0x4e4b59['attributes'][_0xf4f4('0x67')]?_0x4e4b59[_0xf4f4('0x3c')]:_0x505d10[_0xf4f4('0x37')];_0x4e4b59['order']=qs[_0xf4f4('0x40')](_0x34ef05[_0xf4f4('0x39')][_0xf4f4('0x40')]);_0x4e4b59[_0xf4f4('0x43')]=qs[_0xf4f4('0x3a')](_[_0xf4f4('0x41')](_0x34ef05[_0xf4f4('0x39')],_0x505d10[_0xf4f4('0x3a')]));if(_0x34ef05['query'][_0xf4f4('0x42')]){_0x4e4b59[_0xf4f4('0x43')]=_[_0xf4f4('0x44')](_0x4e4b59[_0xf4f4('0x43')],{'$or':_[_0xf4f4('0x33')](_0x4e4b59['attributes'],function(_0x57b91b){var _0x203541={};_0x203541[_0x57b91b]={'$like':'%'+_0x34ef05[_0xf4f4('0x39')]['filter']+'%'};return _0x203541;})});}_0x4e4b59=_[_0xf4f4('0x44')]({},_0x4e4b59,_0x34ef05[_0xf4f4('0x45')]);return _0x13af8b[_0xf4f4('0x8e')](_0x4e4b59);}})['then'](function(_0x5729e8){if(_0x5729e8){_0x1860a1=_0x5729e8[_0xf4f4('0x67')];if(!_0x34ef05[_0xf4f4('0x39')][_0xf4f4('0x3e')](_0xf4f4('0x3f'))){_0x4e4b59[_0xf4f4('0x25')]=qs[_0xf4f4('0x25')](_0x34ef05[_0xf4f4('0x39')][_0xf4f4('0x25')]);_0x4e4b59['offset']=qs[_0xf4f4('0x24')](_0x34ef05['query'][_0xf4f4('0x24')]);}return _0x13af8b[_0xf4f4('0x8e')](_0x4e4b59);}})[_0xf4f4('0x2a')](function(_0x209e98){if(_0x209e98){return _0x209e98?{'count':_0x1860a1,'rows':_0x209e98}:null;}})[_0xf4f4('0x2a')](respondWithResult(_0x369518,null))[_0xf4f4('0x4a')](handleError(_0x369518,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 1b48754..a03b21c 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 _0x6747=['emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove'];(function(_0x57a840,_0x3ecf45){var _0x56768b=function(_0x8f000e){while(--_0x8f000e){_0x57a840['push'](_0x57a840['shift']());}};_0x56768b(++_0x3ecf45);}(_0x6747,0x1e3));var _0x7674=function(_0xe406e8,_0x2dbfd8){_0xe406e8=_0xe406e8-0x0;var _0x3f8fbe=_0x6747[_0xe406e8];return _0x3f8fbe;};'use strict';var EventEmitter=require(_0x7674('0x0'));var MailQueue=require(_0x7674('0x1'))['db'][_0x7674('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7674('0x3')](0x0);var events={'afterCreate':_0x7674('0x4'),'afterUpdate':_0x7674('0x5'),'afterDestroy':_0x7674('0x6')};function emitEvent(_0xeb25aa){return function(_0x5de66f,_0x550944,_0x37b9f1){MailQueueEvents[_0x7674('0x7')](_0xeb25aa+':'+_0x5de66f['id'],_0x5de66f);MailQueueEvents['emit'](_0xeb25aa,_0x5de66f);_0x37b9f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x7674('0x8')](e,emitEvent(event));}}module[_0x7674('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x2a76=['MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xc92b81,_0x1ba725){var _0x38d666=function(_0x1c849b){while(--_0x1c849b){_0xc92b81['push'](_0xc92b81['shift']());}};_0x38d666(++_0x1ba725);}(_0x2a76,0x86));var _0x62a7=function(_0x4951f3,_0x1cf926){_0x4951f3=_0x4951f3-0x0;var _0x5b8eb9=_0x2a76[_0x4951f3];return _0x5b8eb9;};'use strict';var EventEmitter=require(_0x62a7('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x62a7('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x62a7('0x2')](0x0);var events={'afterCreate':_0x62a7('0x3'),'afterUpdate':'update','afterDestroy':_0x62a7('0x4')};function emitEvent(_0x59b8a6){return function(_0x328bdf,_0x5dc5c9,_0x4295f2){MailQueueEvents[_0x62a7('0x5')](_0x59b8a6+':'+_0x328bdf['id'],_0x328bdf);MailQueueEvents[_0x62a7('0x5')](_0x59b8a6,_0x328bdf);_0x4295f2(null);};}for(var e in events){if(events[_0x62a7('0x6')](e)){var event=events[e];MailQueue[_0x62a7('0x7')](e,emitEvent(event));}}module[_0x62a7('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 7abdacb..c873290 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 _0xa488=['./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xcf5fc1,_0x59eedf){var _0x3290b7=function(_0x31fc6b){while(--_0x31fc6b){_0xcf5fc1['push'](_0xcf5fc1['shift']());}};_0x3290b7(++_0x59eedf);}(_0xa488,0x1e4));var _0x8a48=function(_0x5ae268,_0x4b3d90){_0x5ae268=_0x5ae268-0x0;var _0x3fea8b=_0xa488[_0x5ae268];return _0x3fea8b;};'use strict';var _=require(_0x8a48('0x0'));var util=require(_0x8a48('0x1'));var logger=require(_0x8a48('0x2'))('api');var moment=require(_0x8a48('0x3'));var BPromise=require(_0x8a48('0x4'));var rp=require(_0x8a48('0x5'));var fs=require('fs');var path=require(_0x8a48('0x6'));var rimraf=require(_0x8a48('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a48('0x8'));module[_0x8a48('0x9')]=function(_0x41470e,_0x2bcf40){return _0x41470e[_0x8a48('0xa')]('MailQueue',attributes,{'tableName':_0x8a48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdac2=['api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','../../config/logger'];(function(_0x5a971f,_0x17d5be){var _0x4f8aec=function(_0x24db8){while(--_0x24db8){_0x5a971f['push'](_0x5a971f['shift']());}};_0x4f8aec(++_0x17d5be);}(_0xdac2,0x1ba));var _0x2dac=function(_0x119b3e,_0x588d50){_0x119b3e=_0x119b3e-0x0;var _0x1169ae=_0xdac2[_0x119b3e];return _0x1169ae;};'use strict';var _=require(_0x2dac('0x0'));var util=require('util');var logger=require(_0x2dac('0x1'))(_0x2dac('0x2'));var moment=require(_0x2dac('0x3'));var BPromise=require(_0x2dac('0x4'));var rp=require(_0x2dac('0x5'));var fs=require('fs');var path=require(_0x2dac('0x6'));var rimraf=require(_0x2dac('0x7'));var config=require('../../config/environment');var attributes=require(_0x2dac('0x8'));module['exports']=function(_0x3a5ab6,_0x4fcd01){return _0x3a5ab6[_0x2dac('0x9')](_0x2dac('0xa'),attributes,{'tableName':_0x2dac('0xb'),'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 37c9708..35ea438 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 _0x746a=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','./mailQueue.socket','register','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','GetMailQueue','MailQueue','findAll','raw','options','where','attributes','include','map','model','then','catch','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x373858,_0xd24b55){var _0x375ccb=function(_0x45c49f){while(--_0x45c49f){_0x373858['push'](_0x373858['shift']());}};_0x375ccb(++_0xd24b55);}(_0x746a,0x17f));var _0xa746=function(_0x32e03f,_0x5197b9){_0x32e03f=_0x32e03f-0x0;var _0x27b65a=_0x746a[_0x32e03f];return _0x27b65a;};'use strict';var _=require(_0xa746('0x0'));var util=require(_0xa746('0x1'));var moment=require(_0xa746('0x2'));var BPromise=require(_0xa746('0x3'));var rs=require(_0xa746('0x4'));var fs=require('fs');var Redis=require(_0xa746('0x5'));var db=require(_0xa746('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa746('0x7'))(_0xa746('0x8'));var config=require(_0xa746('0x9'));var jayson=require(_0xa746('0xa'));var client=jayson['client'][_0xa746('0xb')]({'port':0x232a});config[_0xa746('0xc')]=_['defaults'](config[_0xa746('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa746('0xc')]));require(_0xa746('0xd'))[_0xa746('0xe')](socket);function respondWithRpcPromise(_0x48840,_0x4e3ec8,_0x451085){return new BPromise(function(_0x4b277c,_0x138d9f){return client['request'](_0x48840,_0x451085)['then'](function(_0x1748a6){logger['info']('MailQueue,\x20%s,\x20%s',_0x4e3ec8,'request\x20sent');logger[_0xa746('0xf')](_0xa746('0x10'),_0x4e3ec8,_0xa746('0x11'),JSON[_0xa746('0x12')](_0x1748a6));if(_0x1748a6[_0xa746('0x13')]){if(_0x1748a6['error'][_0xa746('0x14')]===0x1f4){logger[_0xa746('0x13')](_0xa746('0x15'),_0x4e3ec8,_0x1748a6[_0xa746('0x13')][_0xa746('0x16')]);return _0x138d9f(_0x1748a6['error'][_0xa746('0x16')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x4e3ec8,_0x1748a6[_0xa746('0x13')]['message']);return _0x4b277c(_0x1748a6['error'][_0xa746('0x16')]);}else{logger[_0xa746('0x17')](_0xa746('0x15'),_0x4e3ec8,'request\x20sent');_0x4b277c(_0x1748a6[_0xa746('0x18')][_0xa746('0x16')]);}})['catch'](function(_0x1d4812){logger[_0xa746('0x13')](_0xa746('0x15'),_0x4e3ec8,_0x1d4812);_0x138d9f(_0x1d4812);});});}exports[_0xa746('0x19')]=function(_0x547d55){var _0x115320=this;return new Promise(function(_0x52b5f3,_0x4ef6d3){return db[_0xa746('0x1a')][_0xa746('0x1b')]({'raw':_0x547d55['options']?_0x547d55['options'][_0xa746('0x1c')]===undefined?!![]:![]:!![],'where':_0x547d55[_0xa746('0x1d')]?_0x547d55[_0xa746('0x1d')][_0xa746('0x1e')]||null:null,'attributes':_0x547d55[_0xa746('0x1d')]?_0x547d55['options'][_0xa746('0x1f')]||null:null,'limit':_0x547d55[_0xa746('0x1d')]?_0x547d55['options']['limit']||null:null,'include':_0x547d55[_0xa746('0x1d')]?_0x547d55[_0xa746('0x1d')][_0xa746('0x20')]?_[_0xa746('0x21')](_0x547d55[_0xa746('0x1d')][_0xa746('0x20')],function(_0x3b7062){return{'model':db[_0x3b7062[_0xa746('0x22')]],'as':_0x3b7062['as'],'attributes':_0x3b7062[_0xa746('0x1f')],'include':_0x3b7062[_0xa746('0x20')]?_['map'](_0x3b7062[_0xa746('0x20')],function(_0x5de285){return{'model':db[_0x5de285[_0xa746('0x22')]],'as':_0x5de285['as'],'attributes':_0x5de285[_0xa746('0x1f')],'include':_0x5de285[_0xa746('0x20')]?_[_0xa746('0x21')](_0x5de285['include'],function(_0x1e01a3){return{'model':db[_0x1e01a3[_0xa746('0x22')]],'as':_0x1e01a3['as'],'attributes':_0x1e01a3['attributes']};}):[]};}):[]};}):[]:[]})[_0xa746('0x23')](function(_0x5a989c){logger[_0xa746('0x17')](_0xa746('0x19'),_0x547d55);logger[_0xa746('0xf')](_0xa746('0x19'),_0x547d55,JSON[_0xa746('0x12')](_0x5a989c));_0x52b5f3(_0x5a989c);})[_0xa746('0x24')](function(_0x2b07eb){logger[_0xa746('0x13')](_0xa746('0x19'),_0x2b07eb[_0xa746('0x16')],_0x547d55);_0x4ef6d3(_0x115320[_0xa746('0x13')](0x1f4,_0x2b07eb[_0xa746('0x16')]));});});};exports[_0xa746('0x25')]=function(_0x3511fc){var _0x3c5100=this;return new Promise(function(_0x1bd0e2,_0x1e9008){return db['MailQueue'][_0xa746('0x26')]({'raw':_0x3511fc[_0xa746('0x1d')]?_0x3511fc[_0xa746('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3511fc[_0xa746('0x1d')]?_0x3511fc[_0xa746('0x1d')][_0xa746('0x1e')]||null:null,'attributes':_0x3511fc[_0xa746('0x1d')]?_0x3511fc[_0xa746('0x1d')][_0xa746('0x1f')]||null:null,'include':_0x3511fc[_0xa746('0x1d')]?_0x3511fc[_0xa746('0x1d')][_0xa746('0x20')]?_[_0xa746('0x21')](_0x3511fc['options'][_0xa746('0x20')],function(_0x247265){return{'model':db[_0x247265['model']],'as':_0x247265['as'],'attributes':_0x247265[_0xa746('0x1f')],'include':_0x247265[_0xa746('0x20')]?_[_0xa746('0x21')](_0x247265[_0xa746('0x20')],function(_0x43e948){return{'model':db[_0x43e948[_0xa746('0x22')]],'as':_0x43e948['as'],'attributes':_0x43e948['attributes'],'include':_0x43e948[_0xa746('0x20')]?_['map'](_0x43e948['include'],function(_0x3e151d){return{'model':db[_0x3e151d[_0xa746('0x22')]],'as':_0x3e151d['as'],'attributes':_0x3e151d[_0xa746('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa746('0x23')](function(_0xaa9d6c){logger[_0xa746('0x17')](_0xa746('0x25'),_0x3511fc);logger[_0xa746('0xf')](_0xa746('0x25'),_0x3511fc,JSON['stringify'](_0xaa9d6c));_0x1bd0e2(_0xaa9d6c);})[_0xa746('0x24')](function(_0x408406){logger[_0xa746('0x13')]('ShowMailQueue',_0x408406[_0xa746('0x16')],_0x3511fc);_0x1e9008(_0x3c5100['error'](0x1f4,_0x408406[_0xa746('0x16')]));});});}; \ No newline at end of file +var _0xbee3=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','attributes','limit','map','include','model','ShowMailQueue','where','util','bluebird','randomstring'];(function(_0x157977,_0x5964e3){var _0xf365f0=function(_0xdd4175){while(--_0xdd4175){_0x157977['push'](_0x157977['shift']());}};_0xf365f0(++_0x5964e3);}(_0xbee3,0x1dd));var _0x3bee=function(_0x3cbfe7,_0x286ba7){_0x3cbfe7=_0x3cbfe7-0x0;var _0xf9051d=_0xbee3[_0x3cbfe7];return _0xf9051d;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require(_0x3bee('0x1'));var rs=require(_0x3bee('0x2'));var fs=require('fs');var Redis=require(_0x3bee('0x3'));var db=require(_0x3bee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3bee('0x5'))(_0x3bee('0x6'));var config=require(_0x3bee('0x7'));var jayson=require(_0x3bee('0x8'));var client=jayson[_0x3bee('0x9')][_0x3bee('0xa')]({'port':0x232a});config[_0x3bee('0xb')]=_[_0x3bee('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3bee('0xd'))(new Redis(config[_0x3bee('0xb')]));require(_0x3bee('0xe'))[_0x3bee('0xf')](socket);function respondWithRpcPromise(_0x141fcc,_0x1b66aa,_0x277bd5){return new BPromise(function(_0x3274c9,_0x1384d3){return client[_0x3bee('0x10')](_0x141fcc,_0x277bd5)[_0x3bee('0x11')](function(_0x10370c){logger[_0x3bee('0x12')](_0x3bee('0x13'),_0x1b66aa,'request\x20sent');logger[_0x3bee('0x14')](_0x3bee('0x15'),_0x1b66aa,_0x3bee('0x16'),JSON[_0x3bee('0x17')](_0x10370c));if(_0x10370c[_0x3bee('0x18')]){if(_0x10370c['error'][_0x3bee('0x19')]===0x1f4){logger[_0x3bee('0x18')](_0x3bee('0x13'),_0x1b66aa,_0x10370c[_0x3bee('0x18')][_0x3bee('0x1a')]);return _0x1384d3(_0x10370c[_0x3bee('0x18')][_0x3bee('0x1a')]);}logger['error'](_0x3bee('0x13'),_0x1b66aa,_0x10370c[_0x3bee('0x18')][_0x3bee('0x1a')]);return _0x3274c9(_0x10370c['error']['message']);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x1b66aa,_0x3bee('0x16'));_0x3274c9(_0x10370c[_0x3bee('0x1b')]['message']);}})[_0x3bee('0x1c')](function(_0x9eade){logger[_0x3bee('0x18')](_0x3bee('0x13'),_0x1b66aa,_0x9eade);_0x1384d3(_0x9eade);});});}exports[_0x3bee('0x1d')]=function(_0x2a5644){var _0x4c63b6=this;return new Promise(function(_0x4190c9,_0x2159c7){return db[_0x3bee('0x1e')]['findAll']({'raw':_0x2a5644[_0x3bee('0x1f')]?_0x2a5644[_0x3bee('0x1f')][_0x3bee('0x20')]===undefined?!![]:![]:!![],'where':_0x2a5644[_0x3bee('0x1f')]?_0x2a5644['options']['where']||null:null,'attributes':_0x2a5644['options']?_0x2a5644['options'][_0x3bee('0x21')]||null:null,'limit':_0x2a5644['options']?_0x2a5644[_0x3bee('0x1f')][_0x3bee('0x22')]||null:null,'include':_0x2a5644[_0x3bee('0x1f')]?_0x2a5644[_0x3bee('0x1f')]['include']?_[_0x3bee('0x23')](_0x2a5644[_0x3bee('0x1f')][_0x3bee('0x24')],function(_0x5907f9){return{'model':db[_0x5907f9[_0x3bee('0x25')]],'as':_0x5907f9['as'],'attributes':_0x5907f9[_0x3bee('0x21')],'include':_0x5907f9[_0x3bee('0x24')]?_[_0x3bee('0x23')](_0x5907f9[_0x3bee('0x24')],function(_0x156c7e){return{'model':db[_0x156c7e['model']],'as':_0x156c7e['as'],'attributes':_0x156c7e[_0x3bee('0x21')],'include':_0x156c7e[_0x3bee('0x24')]?_['map'](_0x156c7e['include'],function(_0x2e5b8a){return{'model':db[_0x2e5b8a[_0x3bee('0x25')]],'as':_0x2e5b8a['as'],'attributes':_0x2e5b8a[_0x3bee('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3bee('0x11')](function(_0x4b7a50){logger[_0x3bee('0x12')](_0x3bee('0x1d'),_0x2a5644);logger['debug'](_0x3bee('0x1d'),_0x2a5644,JSON[_0x3bee('0x17')](_0x4b7a50));_0x4190c9(_0x4b7a50);})['catch'](function(_0x6f2b){logger[_0x3bee('0x18')](_0x3bee('0x1d'),_0x6f2b[_0x3bee('0x1a')],_0x2a5644);_0x2159c7(_0x4c63b6[_0x3bee('0x18')](0x1f4,_0x6f2b[_0x3bee('0x1a')]));});});};exports[_0x3bee('0x26')]=function(_0x569faf){var _0x19ba8a=this;return new Promise(function(_0xb19e7e,_0x4d1112){return db['MailQueue']['find']({'raw':_0x569faf[_0x3bee('0x1f')]?_0x569faf[_0x3bee('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x569faf[_0x3bee('0x1f')]?_0x569faf[_0x3bee('0x1f')][_0x3bee('0x27')]||null:null,'attributes':_0x569faf['options']?_0x569faf[_0x3bee('0x1f')][_0x3bee('0x21')]||null:null,'include':_0x569faf['options']?_0x569faf[_0x3bee('0x1f')]['include']?_[_0x3bee('0x23')](_0x569faf['options'][_0x3bee('0x24')],function(_0x575b4a){return{'model':db[_0x575b4a['model']],'as':_0x575b4a['as'],'attributes':_0x575b4a[_0x3bee('0x21')],'include':_0x575b4a[_0x3bee('0x24')]?_[_0x3bee('0x23')](_0x575b4a[_0x3bee('0x24')],function(_0xfd3dbd){return{'model':db[_0xfd3dbd[_0x3bee('0x25')]],'as':_0xfd3dbd['as'],'attributes':_0xfd3dbd[_0x3bee('0x21')],'include':_0xfd3dbd[_0x3bee('0x24')]?_[_0x3bee('0x23')](_0xfd3dbd['include'],function(_0x372544){return{'model':db[_0x372544[_0x3bee('0x25')]],'as':_0x372544['as'],'attributes':_0x372544[_0x3bee('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3bee('0x11')](function(_0xd7797){logger[_0x3bee('0x12')](_0x3bee('0x26'),_0x569faf);logger[_0x3bee('0x14')](_0x3bee('0x26'),_0x569faf,JSON['stringify'](_0xd7797));_0xb19e7e(_0xd7797);})[_0x3bee('0x1c')](function(_0x7381c3){logger[_0x3bee('0x18')](_0x3bee('0x26'),_0x7381c3[_0x3bee('0x1a')],_0x569faf);_0x4d1112(_0x19ba8a[_0x3bee('0x18')](0x1f4,_0x7381c3[_0x3bee('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 57e6d42..21a408b 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 _0x3a2f=['save','remove','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x4507bf,_0x331806){var _0x31e578=function(_0x5315ff){while(--_0x5315ff){_0x4507bf['push'](_0x4507bf['shift']());}};_0x31e578(++_0x331806);}(_0x3a2f,0x16f));var _0xf3a2=function(_0x4273bc,_0x728a4b){_0x4273bc=_0x4273bc-0x0;var _0x3526c5=_0x3a2f[_0x4273bc];return _0x3526c5;};'use strict';var MailQueueEvents=require(_0xf3a2('0x0'));var events=[_0xf3a2('0x1'),_0xf3a2('0x2'),'update'];function createListener(_0x84615a,_0x3bccb3){return function(_0x1bba06){_0x3bccb3[_0xf3a2('0x3')](_0x84615a,_0x1bba06);};}function removeListener(_0x306f25,_0x48f090){return function(){MailQueueEvents[_0xf3a2('0x4')](_0x306f25,_0x48f090);};}exports[_0xf3a2('0x5')]=function(_0x45b21c){for(var _0x1f37f5=0x0,_0x14f572=events[_0xf3a2('0x6')];_0x1f37f5<_0x14f572;_0x1f37f5++){var _0x340901=events[_0x1f37f5];var _0x1605c5=createListener(_0xf3a2('0x7')+_0x340901,_0x45b21c);MailQueueEvents['on'](_0x340901,_0x1605c5);}}; \ No newline at end of file +var _0x4279=['length','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x1d40d5,_0x1ee7a0){var _0x28bdcb=function(_0x355f48){while(--_0x355f48){_0x1d40d5['push'](_0x1d40d5['shift']());}};_0x28bdcb(++_0x1ee7a0);}(_0x4279,0x169));var _0x9427=function(_0x4da1a8,_0x481488){_0x4da1a8=_0x4da1a8-0x0;var _0x49ce68=_0x4279[_0x4da1a8];return _0x49ce68;};'use strict';var MailQueueEvents=require(_0x9427('0x0'));var events=[_0x9427('0x1'),_0x9427('0x2'),_0x9427('0x3')];function createListener(_0x191797,_0x5f0fe5){return function(_0x6589c5){_0x5f0fe5[_0x9427('0x4')](_0x191797,_0x6589c5);};}function removeListener(_0x5b1c69,_0x5da790){return function(){MailQueueEvents[_0x9427('0x5')](_0x5b1c69,_0x5da790);};}exports[_0x9427('0x6')]=function(_0x1317ac){for(var _0x24232c=0x0,_0x606611=events[_0x9427('0x7')];_0x24232c<_0x606611;_0x24232c++){var _0x161245=events[_0x24232c];var _0x1112c4=createListener('mailQueue:'+_0x161245,_0x1317ac);MailQueueEvents['on'](_0x161245,_0x1112c4);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 342ec59..f892fde 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 _0xfa1c=['describe','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','util','express','Router','../../config/environment','get'];(function(_0xf9f7db,_0x1d6720){var _0x4a11e6=function(_0x5938cb){while(--_0x5938cb){_0xf9f7db['push'](_0xf9f7db['shift']());}};_0x4a11e6(++_0x1d6720);}(_0xfa1c,0xf9));var _0xcfa1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa1c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcfa1('0x0'));var util=require(_0xcfa1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcfa1('0x2'));var router=express[_0xcfa1('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcfa1('0x4'));var controller=require('./mailQueueReport.controller');router[_0xcfa1('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xcfa1('0x6')]);router[_0xcfa1('0x5')](_0xcfa1('0x7'),auth[_0xcfa1('0x8')](),controller[_0xcfa1('0x9')]);router[_0xcfa1('0xa')]('/',auth[_0xcfa1('0x8')](),controller[_0xcfa1('0xb')]);router[_0xcfa1('0xc')]('/:id',auth[_0xcfa1('0x8')](),controller['update']);router[_0xcfa1('0xd')](_0xcfa1('0x7'),auth[_0xcfa1('0x8')](),controller['destroy']);module[_0xcfa1('0xe')]=router; \ No newline at end of file +var _0xc196=['get','index','/describe','isAuthenticated','describe','put','/:id','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x1a680a,_0x593e35){var _0x23c264=function(_0x56f739){while(--_0x56f739){_0x1a680a['push'](_0x1a680a['shift']());}};_0x23c264(++_0x593e35);}(_0xc196,0x1b9));var _0x6c19=function(_0x20caaf,_0x11be2b){_0x20caaf=_0x20caaf-0x0;var _0x135308=_0xc196[_0x20caaf];return _0x135308;};'use strict';var multer=require(_0x6c19('0x0'));var util=require(_0x6c19('0x1'));var path=require('path');var timeout=require(_0x6c19('0x2'));var express=require(_0x6c19('0x3'));var router=express[_0x6c19('0x4')]();var auth=require(_0x6c19('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c19('0x6'));var controller=require('./mailQueueReport.controller');router[_0x6c19('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c19('0x8')]);router[_0x6c19('0x7')](_0x6c19('0x9'),auth[_0x6c19('0xa')](),controller[_0x6c19('0xb')]);router['get']('/:id',auth[_0x6c19('0xa')](),controller['show']);router['post']('/',auth[_0x6c19('0xa')](),controller['create']);router[_0x6c19('0xc')](_0x6c19('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6c19('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6c19('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 6544563..7be1d8b 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 _0x202b=['exports','STRING','DATE','sequelize'];(function(_0x44733d,_0x14e870){var _0x27b98d=function(_0x419c68){while(--_0x419c68){_0x44733d['push'](_0x44733d['shift']());}};_0x27b98d(++_0x14e870);}(_0x202b,0x16b));var _0xb202=function(_0x32ca2e,_0x49e777){_0x32ca2e=_0x32ca2e-0x0;var _0x446941=_0x202b[_0x32ca2e];return _0x446941;};'use strict';var moment=require('moment');var Sequelize=require(_0xb202('0x0'));module[_0xb202('0x1')]={'uniqueid':{'type':Sequelize[_0xb202('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb202('0x2')]},'joinAt':{'type':Sequelize[_0xb202('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb202('0x3')]},'exitAt':{'type':Sequelize[_0xb202('0x3')]},'reason':{'type':Sequelize[_0xb202('0x2')]}}; \ No newline at end of file +var _0x78d1=['moment','sequelize','exports','STRING','DATE'];(function(_0x5bd43c,_0x2a8b1a){var _0x2cadf9=function(_0x5534d5){while(--_0x5534d5){_0x5bd43c['push'](_0x5bd43c['shift']());}};_0x2cadf9(++_0x2a8b1a);}(_0x78d1,0x7d));var _0x178d=function(_0x23794b,_0x49fb5a){_0x23794b=_0x23794b-0x0;var _0x4fe80c=_0x78d1[_0x23794b];return _0x4fe80c;};'use strict';var moment=require(_0x178d('0x0'));var Sequelize=require(_0x178d('0x1'));module[_0x178d('0x2')]={'uniqueid':{'type':Sequelize[_0x178d('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x178d('0x4')]},'leaveAt':{'type':Sequelize[_0x178d('0x4')]},'acceptAt':{'type':Sequelize[_0x178d('0x4')]},'exitAt':{'type':Sequelize[_0x178d('0x4')]},'reason':{'type':Sequelize[_0x178d('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 98a644a..6eb5d03 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 _0x3841=['find','catch','create','body','describe','html-pdf','eml-format','fast-json-patch','moment','bluebird','path','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','Content-Range','json','save','update','then','destroy','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','findAll','rows','show','params','rawAttributes','includeAll'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3841,0x1da));var _0x1384=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x3841[_0x9cfe28];return _0x54a1d0;};'use strict';var pdf=require(_0x1384('0x0'));var emlformat=require(_0x1384('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1384('0x2'));var rp=require('request-promise');var moment=require(_0x1384('0x3'));var BPromise=require(_0x1384('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1384('0x5'));var sox=require('sox');var csv=require(_0x1384('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1384('0x7'));var crypto=require(_0x1384('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1384('0x9'));var toCsv=require(_0x1384('0x6'));var querystring=require(_0x1384('0xa'));var Papa=require(_0x1384('0xb'));var Redis=require('ioredis');var authService=require(_0x1384('0xc'));var qs=require(_0x1384('0xd'));var as=require(_0x1384('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1384('0xf'))(_0x1384('0x10'));var utils=require(_0x1384('0x11'));var config=require(_0x1384('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x583c01,_0x39ec5a){_0x39ec5a=_0x39ec5a||0xcc;return function(_0xb7fa66){if(_0xb7fa66){return _0x583c01[_0x1384('0x13')](_0x39ec5a);}return _0x583c01['status'](_0x39ec5a)[_0x1384('0x14')]();};}function respondWithResult(_0x5cb329,_0x30f2d9){_0x30f2d9=_0x30f2d9||0xc8;return function(_0x467b62){if(_0x467b62){return _0x5cb329[_0x1384('0x15')](_0x30f2d9)['json'](_0x467b62);}};}function respondWithFilteredResult(_0x11aabe,_0x5bd7c0){return function(_0x11e914){if(_0x11e914){var _0x42e293=_0x11e914[_0x1384('0x16')],_0x5a3c3e=_0x5bd7c0[_0x1384('0x17')],_0x5d7d7d=_0x5bd7c0[_0x1384('0x17')]+_0x5bd7c0[_0x1384('0x18')],_0x568feb;if(_0x5d7d7d>=_0x42e293){_0x5d7d7d=_0x42e293;_0x568feb=0xc8;}else{_0x568feb=0xce;}_0x11aabe['status'](_0x568feb);return _0x11aabe['set'](_0x1384('0x19'),_0x5a3c3e+'-'+_0x5d7d7d+'/'+_0x42e293)[_0x1384('0x1a')](_0x11e914);}return null;};}function patchUpdates(_0x9f912d){return function(_0x5195b6){try{jsonpatch['apply'](_0x5195b6,_0x9f912d,!![]);}catch(_0xc73ba0){return BPromise['reject'](_0xc73ba0);}return _0x5195b6[_0x1384('0x1b')]();};}function saveUpdates(_0x118c6b,_0x23f4e1){return function(_0x24ffa4){if(_0x24ffa4){return _0x24ffa4[_0x1384('0x1c')](_0x118c6b)[_0x1384('0x1d')](function(_0x12a9c9){return _0x12a9c9;});}return null;};}function removeEntity(_0x1a915c,_0xf9fd06){return function(_0x327887){if(_0x327887){return _0x327887[_0x1384('0x1e')]()[_0x1384('0x1d')](function(){_0x1a915c[_0x1384('0x15')](0xcc)[_0x1384('0x14')]();});}};}function handleEntityNotFound(_0x497f51,_0x5b6ee2){return function(_0x14491b){if(!_0x14491b){_0x497f51[_0x1384('0x13')](0x194);}return _0x14491b;};}function handleError(_0x1020cb,_0x37b20e){_0x37b20e=_0x37b20e||0x1f4;return function(_0x47da02){logger['error'](_0x47da02[_0x1384('0x1f')]);if(_0x47da02[_0x1384('0x20')]){delete _0x47da02[_0x1384('0x20')];}_0x1020cb[_0x1384('0x15')](_0x37b20e)[_0x1384('0x21')](_0x47da02);};}exports['index']=function(_0x374ba4,_0x1fe024){var _0x29c2d4={},_0x24eb4f={},_0x4e51eb={'count':0x0,'rows':[]};var _0x54a007=_[_0x1384('0x22')](db['MailQueueReport']['rawAttributes'],function(_0x33c782){return{'name':_0x33c782[_0x1384('0x23')],'type':_0x33c782[_0x1384('0x24')][_0x1384('0x25')]};});_0x24eb4f[_0x1384('0x26')]=_[_0x1384('0x22')](_0x54a007,_0x1384('0x20'));_0x24eb4f['query']=_[_0x1384('0x27')](_0x374ba4[_0x1384('0x28')]);_0x24eb4f[_0x1384('0x29')]=_[_0x1384('0x2a')](_0x24eb4f[_0x1384('0x26')],_0x24eb4f['query']);_0x29c2d4[_0x1384('0x2b')]=_['intersection'](_0x24eb4f['model'],qs[_0x1384('0x2c')](_0x374ba4[_0x1384('0x28')][_0x1384('0x2c')]));_0x29c2d4[_0x1384('0x2b')]=_0x29c2d4[_0x1384('0x2b')][_0x1384('0x2d')]?_0x29c2d4['attributes']:_0x24eb4f['model'];if(!_0x374ba4[_0x1384('0x28')][_0x1384('0x2e')]('nolimit')){_0x29c2d4[_0x1384('0x18')]=qs[_0x1384('0x18')](_0x374ba4[_0x1384('0x28')][_0x1384('0x18')]);_0x29c2d4[_0x1384('0x17')]=qs['offset'](_0x374ba4[_0x1384('0x28')][_0x1384('0x17')]);}_0x29c2d4[_0x1384('0x2f')]=qs[_0x1384('0x30')](_0x374ba4[_0x1384('0x28')][_0x1384('0x30')]);_0x29c2d4[_0x1384('0x31')]=qs['filters'](_[_0x1384('0x32')](_0x374ba4[_0x1384('0x28')],_0x24eb4f[_0x1384('0x29')]),_0x54a007);if(_0x374ba4[_0x1384('0x28')][_0x1384('0x33')]){_0x29c2d4[_0x1384('0x31')]=_[_0x1384('0x34')](_0x29c2d4[_0x1384('0x31')],{'$or':_[_0x1384('0x22')](_0x54a007,function(_0x331753){if(_0x331753[_0x1384('0x24')]!==_0x1384('0x35')){var _0x200ddb={};_0x200ddb[_0x331753[_0x1384('0x20')]]={'$like':'%'+_0x374ba4[_0x1384('0x28')][_0x1384('0x33')]+'%'};return _0x200ddb;}})});}_0x29c2d4=_[_0x1384('0x34')]({},_0x29c2d4,_0x374ba4[_0x1384('0x36')]);var _0x18f89d={'where':_0x29c2d4[_0x1384('0x31')]};return db[_0x1384('0x37')][_0x1384('0x16')](_0x18f89d)[_0x1384('0x1d')](function(_0x253995){_0x4e51eb[_0x1384('0x16')]=_0x253995;if(_0x374ba4[_0x1384('0x28')]['includeAll']){_0x29c2d4['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x1384('0x38')](_0x29c2d4);})[_0x1384('0x1d')](function(_0x316316){_0x4e51eb[_0x1384('0x39')]=_0x316316;return _0x4e51eb;})[_0x1384('0x1d')](respondWithFilteredResult(_0x1fe024,_0x29c2d4))['catch'](handleError(_0x1fe024,null));};exports[_0x1384('0x3a')]=function(_0x414ea9,_0x524815){var _0x2ba170={'raw':!![],'where':{'id':_0x414ea9[_0x1384('0x3b')]['id']}},_0x2b7da1={};_0x2b7da1['model']=_[_0x1384('0x27')](db[_0x1384('0x37')][_0x1384('0x3c')]);_0x2b7da1[_0x1384('0x28')]=_[_0x1384('0x27')](_0x414ea9[_0x1384('0x28')]);_0x2b7da1[_0x1384('0x29')]=_['intersection'](_0x2b7da1['model'],_0x2b7da1[_0x1384('0x28')]);_0x2ba170[_0x1384('0x2b')]=_['intersection'](_0x2b7da1[_0x1384('0x26')],qs[_0x1384('0x2c')](_0x414ea9['query']['fields']));_0x2ba170['attributes']=_0x2ba170[_0x1384('0x2b')][_0x1384('0x2d')]?_0x2ba170[_0x1384('0x2b')]:_0x2b7da1['model'];if(_0x414ea9[_0x1384('0x28')][_0x1384('0x3d')]){_0x2ba170['include']=[{'all':!![]}];}_0x2ba170=_['merge']({},_0x2ba170,_0x414ea9[_0x1384('0x36')]);return db[_0x1384('0x37')][_0x1384('0x3e')](_0x2ba170)['then'](handleEntityNotFound(_0x524815,null))[_0x1384('0x1d')](respondWithResult(_0x524815,null))[_0x1384('0x3f')](handleError(_0x524815,null));};exports[_0x1384('0x40')]=function(_0x1ba845,_0x259552){return db['MailQueueReport'][_0x1384('0x40')](_0x1ba845['body'],{})[_0x1384('0x1d')](respondWithResult(_0x259552,0xc9))['catch'](handleError(_0x259552,null));};exports[_0x1384('0x1c')]=function(_0x1a69c4,_0x44c16c){if(_0x1a69c4[_0x1384('0x41')]['id']){delete _0x1a69c4['body']['id'];}return db[_0x1384('0x37')][_0x1384('0x3e')]({'where':{'id':_0x1a69c4[_0x1384('0x3b')]['id']}})[_0x1384('0x1d')](handleEntityNotFound(_0x44c16c,null))[_0x1384('0x1d')](saveUpdates(_0x1a69c4[_0x1384('0x41')],null))[_0x1384('0x1d')](respondWithResult(_0x44c16c,null))['catch'](handleError(_0x44c16c,null));};exports[_0x1384('0x1e')]=function(_0xaa097c,_0x20cb17){return db[_0x1384('0x37')]['find']({'where':{'id':_0xaa097c[_0x1384('0x3b')]['id']}})['then'](handleEntityNotFound(_0x20cb17,null))['then'](removeEntity(_0x20cb17,null))['catch'](handleError(_0x20cb17,null));};exports[_0x1384('0x42')]=function(_0x4c2d36,_0x56d40b){return db[_0x1384('0x37')][_0x1384('0x42')]()[_0x1384('0x1d')](respondWithResult(_0x56d40b,null))[_0x1384('0x3f')](handleError(_0x56d40b,null));}; \ No newline at end of file +var _0x2af3=['to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','apply','save','update','destroy','then','stack','name','index','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','options','MailQueueReport','include','findAll','catch','show','params','includeAll','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0x2af3,0xbc));var _0x32af=function(_0x5e08be,_0x9bf344){_0x5e08be=_0x5e08be-0x0;var _0x4db79e=_0x2af3[_0x5e08be];return _0x4db79e;};'use strict';var pdf=require(_0x32af('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x32af('0x1'));var zipdir=require(_0x32af('0x2'));var jsonpatch=require(_0x32af('0x3'));var rp=require(_0x32af('0x4'));var moment=require('moment');var BPromise=require(_0x32af('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x32af('0x6'));var csv=require(_0x32af('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x32af('0x8'));var crypto=require(_0x32af('0x9'));var jsforce=require(_0x32af('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x32af('0xb'));var Papa=require(_0x32af('0xc'));var Redis=require(_0x32af('0xd'));var authService=require(_0x32af('0xe'));var qs=require(_0x32af('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x32af('0x10'))(_0x32af('0x11'));var utils=require(_0x32af('0x12'));var config=require(_0x32af('0x13'));var db=require(_0x32af('0x14'))['db'];function respondWithStatusCode(_0x37f9c3,_0x4e2fab){_0x4e2fab=_0x4e2fab||0xcc;return function(_0x4d7269){if(_0x4d7269){return _0x37f9c3[_0x32af('0x15')](_0x4e2fab);}return _0x37f9c3['status'](_0x4e2fab)[_0x32af('0x16')]();};}function respondWithResult(_0x71cfb4,_0x31bed4){_0x31bed4=_0x31bed4||0xc8;return function(_0x5b9e7a){if(_0x5b9e7a){return _0x71cfb4[_0x32af('0x17')](_0x31bed4)['json'](_0x5b9e7a);}};}function respondWithFilteredResult(_0x5084fc,_0x38b892){return function(_0x52ea09){if(_0x52ea09){var _0x7c08e7=_0x52ea09[_0x32af('0x18')],_0x461afa=_0x38b892[_0x32af('0x19')],_0x191c65=_0x38b892[_0x32af('0x19')]+_0x38b892[_0x32af('0x1a')],_0x4c50c1;if(_0x191c65>=_0x7c08e7){_0x191c65=_0x7c08e7;_0x4c50c1=0xc8;}else{_0x4c50c1=0xce;}_0x5084fc[_0x32af('0x17')](_0x4c50c1);return _0x5084fc['set']('Content-Range',_0x461afa+'-'+_0x191c65+'/'+_0x7c08e7)['json'](_0x52ea09);}return null;};}function patchUpdates(_0x5e524c){return function(_0x568b25){try{jsonpatch[_0x32af('0x1b')](_0x568b25,_0x5e524c,!![]);}catch(_0x2cc739){return BPromise['reject'](_0x2cc739);}return _0x568b25[_0x32af('0x1c')]();};}function saveUpdates(_0xcc22bb,_0xc51c81){return function(_0x3d3bf3){if(_0x3d3bf3){return _0x3d3bf3[_0x32af('0x1d')](_0xcc22bb)['then'](function(_0x278aeb){return _0x278aeb;});}return null;};}function removeEntity(_0x2c84ea,_0x1fe1a2){return function(_0x28d0bf){if(_0x28d0bf){return _0x28d0bf[_0x32af('0x1e')]()[_0x32af('0x1f')](function(){_0x2c84ea[_0x32af('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d9e1,_0xbdc532){return function(_0x2b8e2b){if(!_0x2b8e2b){_0x24d9e1['sendStatus'](0x194);}return _0x2b8e2b;};}function handleError(_0x18f380,_0x3f9280){_0x3f9280=_0x3f9280||0x1f4;return function(_0x4e718e){logger['error'](_0x4e718e[_0x32af('0x20')]);if(_0x4e718e['name']){delete _0x4e718e[_0x32af('0x21')];}_0x18f380[_0x32af('0x17')](_0x3f9280)['send'](_0x4e718e);};}exports[_0x32af('0x22')]=function(_0x38bf61,_0x30628a){var _0x2409ae={},_0x5dcde9={},_0xc7e0e2={'count':0x0,'rows':[]};var _0x2e4f5e=_['map'](db['MailQueueReport']['rawAttributes'],function(_0x58402b){return{'name':_0x58402b[_0x32af('0x23')],'type':_0x58402b[_0x32af('0x24')][_0x32af('0x25')]};});_0x5dcde9['model']=_[_0x32af('0x26')](_0x2e4f5e,_0x32af('0x21'));_0x5dcde9[_0x32af('0x27')]=_[_0x32af('0x28')](_0x38bf61[_0x32af('0x27')]);_0x5dcde9[_0x32af('0x29')]=_[_0x32af('0x2a')](_0x5dcde9['model'],_0x5dcde9[_0x32af('0x27')]);_0x2409ae[_0x32af('0x2b')]=_['intersection'](_0x5dcde9[_0x32af('0x2c')],qs['fields'](_0x38bf61[_0x32af('0x27')][_0x32af('0x2d')]));_0x2409ae[_0x32af('0x2b')]=_0x2409ae[_0x32af('0x2b')][_0x32af('0x2e')]?_0x2409ae['attributes']:_0x5dcde9[_0x32af('0x2c')];if(!_0x38bf61[_0x32af('0x27')]['hasOwnProperty'](_0x32af('0x2f'))){_0x2409ae[_0x32af('0x1a')]=qs[_0x32af('0x1a')](_0x38bf61[_0x32af('0x27')][_0x32af('0x1a')]);_0x2409ae[_0x32af('0x19')]=qs['offset'](_0x38bf61['query'][_0x32af('0x19')]);}_0x2409ae['order']=qs[_0x32af('0x30')](_0x38bf61[_0x32af('0x27')][_0x32af('0x30')]);_0x2409ae[_0x32af('0x31')]=qs[_0x32af('0x29')](_[_0x32af('0x32')](_0x38bf61['query'],_0x5dcde9['filters']),_0x2e4f5e);if(_0x38bf61['query'][_0x32af('0x33')]){_0x2409ae[_0x32af('0x31')]=_[_0x32af('0x34')](_0x2409ae[_0x32af('0x31')],{'$or':_[_0x32af('0x26')](_0x2e4f5e,function(_0x3a5fee){if(_0x3a5fee[_0x32af('0x24')]!=='VIRTUAL'){var _0x4ccd64={};_0x4ccd64[_0x3a5fee[_0x32af('0x21')]]={'$like':'%'+_0x38bf61[_0x32af('0x27')][_0x32af('0x33')]+'%'};return _0x4ccd64;}})});}_0x2409ae=_['merge']({},_0x2409ae,_0x38bf61[_0x32af('0x35')]);var _0x2bf12a={'where':_0x2409ae[_0x32af('0x31')]};return db[_0x32af('0x36')][_0x32af('0x18')](_0x2bf12a)['then'](function(_0x209862){_0xc7e0e2[_0x32af('0x18')]=_0x209862;if(_0x38bf61[_0x32af('0x27')]['includeAll']){_0x2409ae[_0x32af('0x37')]=[{'all':!![]}];}return db['MailQueueReport'][_0x32af('0x38')](_0x2409ae);})[_0x32af('0x1f')](function(_0x3f1be1){_0xc7e0e2['rows']=_0x3f1be1;return _0xc7e0e2;})[_0x32af('0x1f')](respondWithFilteredResult(_0x30628a,_0x2409ae))[_0x32af('0x39')](handleError(_0x30628a,null));};exports[_0x32af('0x3a')]=function(_0x3fadc4,_0xbd3cbf){var _0x4bea6e={'raw':!![],'where':{'id':_0x3fadc4[_0x32af('0x3b')]['id']}},_0x144a7d={};_0x144a7d[_0x32af('0x2c')]=_[_0x32af('0x28')](db['MailQueueReport']['rawAttributes']);_0x144a7d[_0x32af('0x27')]=_[_0x32af('0x28')](_0x3fadc4[_0x32af('0x27')]);_0x144a7d[_0x32af('0x29')]=_['intersection'](_0x144a7d[_0x32af('0x2c')],_0x144a7d[_0x32af('0x27')]);_0x4bea6e['attributes']=_[_0x32af('0x2a')](_0x144a7d['model'],qs[_0x32af('0x2d')](_0x3fadc4[_0x32af('0x27')][_0x32af('0x2d')]));_0x4bea6e[_0x32af('0x2b')]=_0x4bea6e[_0x32af('0x2b')][_0x32af('0x2e')]?_0x4bea6e['attributes']:_0x144a7d['model'];if(_0x3fadc4['query'][_0x32af('0x3c')]){_0x4bea6e[_0x32af('0x37')]=[{'all':!![]}];}_0x4bea6e=_[_0x32af('0x34')]({},_0x4bea6e,_0x3fadc4[_0x32af('0x35')]);return db[_0x32af('0x36')][_0x32af('0x3d')](_0x4bea6e)[_0x32af('0x1f')](handleEntityNotFound(_0xbd3cbf,null))[_0x32af('0x1f')](respondWithResult(_0xbd3cbf,null))['catch'](handleError(_0xbd3cbf,null));};exports[_0x32af('0x3e')]=function(_0x1fac1b,_0x4af620){return db['MailQueueReport'][_0x32af('0x3e')](_0x1fac1b[_0x32af('0x3f')],{})[_0x32af('0x1f')](respondWithResult(_0x4af620,0xc9))[_0x32af('0x39')](handleError(_0x4af620,null));};exports[_0x32af('0x1d')]=function(_0x37320d,_0x37676d){if(_0x37320d[_0x32af('0x3f')]['id']){delete _0x37320d[_0x32af('0x3f')]['id'];}return db[_0x32af('0x36')][_0x32af('0x3d')]({'where':{'id':_0x37320d['params']['id']}})[_0x32af('0x1f')](handleEntityNotFound(_0x37676d,null))[_0x32af('0x1f')](saveUpdates(_0x37320d[_0x32af('0x3f')],null))[_0x32af('0x1f')](respondWithResult(_0x37676d,null))[_0x32af('0x39')](handleError(_0x37676d,null));};exports[_0x32af('0x1e')]=function(_0x4456d2,_0x492ad4){return db[_0x32af('0x36')][_0x32af('0x3d')]({'where':{'id':_0x4456d2[_0x32af('0x3b')]['id']}})[_0x32af('0x1f')](handleEntityNotFound(_0x492ad4,null))['then'](removeEntity(_0x492ad4,null))[_0x32af('0x39')](handleError(_0x492ad4,null));};exports[_0x32af('0x40')]=function(_0x133059,_0x2c8795){return db['MailQueueReport'][_0x32af('0x40')]()[_0x32af('0x1f')](respondWithResult(_0x2c8795,null))['catch'](handleError(_0x2c8795,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b0be7d3..055c409 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 _0x530f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','util'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x530f,0x167));var _0xf530=function(_0x42c797,_0x16382b){_0x42c797=_0x42c797-0x0;var _0x320035=_0x530f[_0x42c797];return _0x320035;};'use strict';var _=require('lodash');var util=require(_0xf530('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf530('0x1'));var BPromise=require(_0xf530('0x2'));var rp=require(_0xf530('0x3'));var fs=require('fs');var path=require(_0xf530('0x4'));var rimraf=require(_0xf530('0x5'));var config=require(_0xf530('0x6'));var attributes=require(_0xf530('0x7'));module[_0xf530('0x8')]=function(_0x58f5f8,_0x3a0301){return _0x58f5f8[_0xf530('0x9')](_0xf530('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xf530('0xb'),'fields':[_0xf530('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae6e=['util','../../config/logger','api','moment','request-promise','rimraf','MailQueueReport','report_mail_queue','lodash'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xae6e,0x1e5));var _0xeae6=function(_0x31d43b,_0x5f0e72){_0x31d43b=_0x31d43b-0x0;var _0x13ade9=_0xae6e[_0x31d43b];return _0x13ade9;};'use strict';var _=require(_0xeae6('0x0'));var util=require(_0xeae6('0x1'));var logger=require(_0xeae6('0x2'))(_0xeae6('0x3'));var moment=require(_0xeae6('0x4'));var BPromise=require('bluebird');var rp=require(_0xeae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeae6('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x1d06ba,_0x33ea23){return _0x1d06ba['define'](_0xeae6('0x7'),attributes,{'tableName':_0xeae6('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a9ade21..cb3bf7f 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 _0xf61e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateMailQueueReport','create','body','options','raw','then','update','where','attributes','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0xf61e,0x191));var _0xef61=function(_0x526f6b,_0x22f037){_0x526f6b=_0x526f6b-0x0;var _0x5d72f1=_0xf61e[_0x526f6b];return _0x5d72f1;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});}exports[_0xef61('0x17')]=function(_0x22dc1b){var _0xfc36d6=this;return new Promise(function(_0x28315a,_0xdd5e38){return db['MailQueueReport'][_0xef61('0x18')](_0x22dc1b[_0xef61('0x19')],{'raw':_0x22dc1b['options']?_0x22dc1b[_0xef61('0x1a')][_0xef61('0x1b')]===undefined?!![]:![]:!![]})[_0xef61('0x1c')](function(_0x26cf42){logger[_0xef61('0xd')](_0xef61('0x17'),_0x22dc1b);logger[_0xef61('0x10')]('CreateMailQueueReport',_0x22dc1b,JSON['stringify'](_0x26cf42));_0x28315a(_0x26cf42);})[_0xef61('0x16')](function(_0x58bd7d){logger[_0xef61('0x13')]('CreateMailQueueReport',_0x58bd7d['message'],_0x22dc1b);_0xdd5e38(_0xfc36d6[_0xef61('0x13')](0x1f4,_0x58bd7d['message']));});});};exports['UpdateMailQueueReport']=function(_0xfbee94){var _0x3782c6=this;return new Promise(function(_0x3ceb14,_0x111bac){return db['MailQueueReport'][_0xef61('0x1d')](_0xfbee94['body'],{'raw':_0xfbee94[_0xef61('0x1a')]?_0xfbee94[_0xef61('0x1a')][_0xef61('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfbee94[_0xef61('0x1a')]?_0xfbee94[_0xef61('0x1a')][_0xef61('0x1e')]||null:null,'attributes':_0xfbee94[_0xef61('0x1a')]?_0xfbee94[_0xef61('0x1a')][_0xef61('0x1f')]||null:null,'limit':_0xfbee94[_0xef61('0x1a')]?_0xfbee94[_0xef61('0x1a')][_0xef61('0x20')]||null:null})[_0xef61('0x1c')](function(_0x63edd4){logger[_0xef61('0xd')](_0xef61('0x21'),_0xfbee94);logger[_0xef61('0x10')](_0xef61('0x21'),_0xfbee94,JSON[_0xef61('0x12')](_0x63edd4));_0x3ceb14(_0x63edd4);})[_0xef61('0x16')](function(_0x43bc47){logger[_0xef61('0x13')]('UpdateMailQueueReport',_0x43bc47['message'],_0xfbee94);_0x111bac(_0x3782c6[_0xef61('0x13')](0x1f4,_0x43bc47[_0xef61('0x15')]));});});}; \ No newline at end of file +var _0x4c60=['message','info','catch','CreateMailQueueReport','MailQueueReport','create','raw','update','options','where','attributes','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','MailQueueReport,\x20%s,\x20%s'];(function(_0x32a95f,_0x570c63){var _0x57f14a=function(_0x5d7f25){while(--_0x5d7f25){_0x32a95f['push'](_0x32a95f['shift']());}};_0x57f14a(++_0x570c63);}(_0x4c60,0xc1));var _0x04c6=function(_0x38f422,_0x191484){_0x38f422=_0x38f422-0x0;var _0x5251f1=_0x4c60[_0x38f422];return _0x5251f1;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('MailQueueReport,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});}exports[_0x04c6('0x14')]=function(_0x21674a){var _0x423ea9=this;return new Promise(function(_0x47f400,_0x142065){return db[_0x04c6('0x15')][_0x04c6('0x16')](_0x21674a['body'],{'raw':_0x21674a['options']?_0x21674a['options'][_0x04c6('0x17')]===undefined?!![]:![]:!![]})[_0x04c6('0xa')](function(_0x50dd61){logger['info'](_0x04c6('0x14'),_0x21674a);logger[_0x04c6('0xb')](_0x04c6('0x14'),_0x21674a,JSON['stringify'](_0x50dd61));_0x47f400(_0x50dd61);})[_0x04c6('0x13')](function(_0x13f2dc){logger[_0x04c6('0xe')]('CreateMailQueueReport',_0x13f2dc[_0x04c6('0x11')],_0x21674a);_0x142065(_0x423ea9[_0x04c6('0xe')](0x1f4,_0x13f2dc['message']));});});};exports['UpdateMailQueueReport']=function(_0x4c8d72){var _0x348ea3=this;return new Promise(function(_0x3a2014,_0xd5828d){return db[_0x04c6('0x15')][_0x04c6('0x18')](_0x4c8d72['body'],{'raw':_0x4c8d72['options']?_0x4c8d72[_0x04c6('0x19')][_0x04c6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c8d72[_0x04c6('0x19')]?_0x4c8d72[_0x04c6('0x19')][_0x04c6('0x1a')]||null:null,'attributes':_0x4c8d72[_0x04c6('0x19')]?_0x4c8d72['options'][_0x04c6('0x1b')]||null:null,'limit':_0x4c8d72[_0x04c6('0x19')]?_0x4c8d72['options'][_0x04c6('0x1c')]||null:null})[_0x04c6('0xa')](function(_0x5f1331){logger['info'](_0x04c6('0x1d'),_0x4c8d72);logger[_0x04c6('0xb')](_0x04c6('0x1d'),_0x4c8d72,JSON[_0x04c6('0xd')](_0x5f1331));_0x3a2014(_0x5f1331);})[_0x04c6('0x13')](function(_0x43884e){logger['error']('UpdateMailQueueReport',_0x43884e['message'],_0x4c8d72);_0xd5828d(_0x348ea3[_0x04c6('0xe')](0x1f4,_0x43884e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 3291b34..2114e04 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 _0xdb89=['exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0xdb89,0x174));var _0x9db8=function(_0x2e2098,_0x3174be){_0x2e2098=_0x2e2098-0x0;var _0x397da9=_0xdb89[_0x2e2098];return _0x397da9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9db8('0x0'));var express=require(_0x9db8('0x1'));var router=express[_0x9db8('0x2')]();var auth=require(_0x9db8('0x3'));var interaction=require(_0x9db8('0x4'));var config=require(_0x9db8('0x5'));module[_0x9db8('0x6')]=router; \ No newline at end of file +var _0xffbc=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2d001e,_0x260961){var _0x14711b=function(_0x3a2764){while(--_0x3a2764){_0x2d001e['push'](_0x2d001e['shift']());}};_0x14711b(++_0x260961);}(_0xffbc,0x118));var _0xcffb=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xffbc[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0xcffb('0x0'));var util=require(_0xcffb('0x1'));var path=require(_0xcffb('0x2'));var timeout=require('connect-timeout');var express=require(_0xcffb('0x3'));var router=express[_0xcffb('0x4')]();var auth=require(_0xcffb('0x5'));var interaction=require(_0xcffb('0x6'));var config=require('../../config/environment');module[_0xcffb('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1537417..beb15dd 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 _0xf246=['STRING','BOOLEAN','username','INBOX','INTEGER','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf246,0x10d));var _0x6f24=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf246[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6f24('0x0'));module['exports']={'description':{'type':Sequelize[_0x6f24('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x6f24('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6f24('0x1')],'unique':_0x6f24('0x3')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x6f24('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x6f24('0x1')],'defaultValue':_0x6f24('0x4')},'connTimeout':{'type':Sequelize[_0x6f24('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x6f24('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x60df=['STRING','BOOLEAN','username','INTEGER','INBOX','exports'];(function(_0x2c1aad,_0x123752){var _0x5ebef9=function(_0x37dbd7){while(--_0x37dbd7){_0x2c1aad['push'](_0x2c1aad['shift']());}};_0x5ebef9(++_0x123752);}(_0x60df,0x1cd));var _0xf60d=function(_0x260783,_0x41d960){_0x260783=_0x260783-0x0;var _0x4b8e90=_0x60df[_0x260783];return _0x4b8e90;};'use strict';var Sequelize=require('sequelize');module[_0xf60d('0x0')]={'description':{'type':Sequelize[_0xf60d('0x1')]},'host':{'type':Sequelize[_0xf60d('0x1')]},'authentication':{'type':Sequelize[_0xf60d('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf60d('0x1')],'unique':_0xf60d('0x3')},'password':{'type':Sequelize[_0xf60d('0x1')]},'port':{'type':Sequelize[_0xf60d('0x4')]},'tls':{'type':Sequelize[_0xf60d('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xf60d('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf60d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf60d('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ff89f71..9c575e4 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 _0x018c=['../../config/logger','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0xbdb6d7,_0x2cf68d){var _0x22372b=function(_0x412a07){while(--_0x412a07){_0xbdb6d7['push'](_0xbdb6d7['shift']());}};_0x22372b(++_0x2cf68d);}(_0x018c,0xda));var _0xc018=function(_0x480ace,_0x434018){_0x480ace=_0x480ace-0x0;var _0x270ce3=_0x018c[_0x480ace];return _0x270ce3;};'use strict';var _=require(_0xc018('0x0'));var util=require(_0xc018('0x1'));var logger=require(_0xc018('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc018('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc018('0x4'));var rimraf=require(_0xc018('0x5'));var config=require(_0xc018('0x6'));var attributes=require(_0xc018('0x7'));module['exports']=function(_0x3785b0,_0x26e41a){return _0x3785b0[_0xc018('0x8')](_0xc018('0x9'),attributes,{'tableName':_0xc018('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfe7=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','define','MailServerIn'];(function(_0x4433b,_0x1eded1){var _0xffc1da=function(_0x3d1d18){while(--_0x3d1d18){_0x4433b['push'](_0x4433b['shift']());}};_0xffc1da(++_0x1eded1);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x111b51,_0x4f89f3){_0x111b51=_0x111b51-0x0;var _0x6d6e18=_0xdfe7[_0x111b51];return _0x6d6e18;};'use strict';var _=require('lodash');var util=require(_0x7dfe('0x0'));var logger=require(_0x7dfe('0x1'))('api');var moment=require(_0x7dfe('0x2'));var BPromise=require(_0x7dfe('0x3'));var rp=require(_0x7dfe('0x4'));var fs=require('fs');var path=require(_0x7dfe('0x5'));var rimraf=require('rimraf');var config=require(_0x7dfe('0x6'));var attributes=require(_0x7dfe('0x7'));module['exports']=function(_0x262561,_0x3d8220){return _0x262561[_0x7dfe('0x8')](_0x7dfe('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index d656b25..c5c45ff 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 _0x324f=['bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','include','model','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x324f,0x12b));var _0xf324=function(_0x15fd4d,_0x2a665e){_0x15fd4d=_0x15fd4d-0x0;var _0x31a652=_0x324f[_0x15fd4d];return _0x31a652;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf324('0x0'));var BPromise=require(_0xf324('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf324('0x2'));var db=require(_0xf324('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf324('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf324('0x5'));var client=jayson[_0xf324('0x6')][_0xf324('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x438f73,_0x5e99a5,_0x5295a3){return new BPromise(function(_0x50f77a,_0x17b7c3){return client[_0xf324('0x8')](_0x438f73,_0x5295a3)[_0xf324('0x9')](function(_0x54a43d){logger['info'](_0xf324('0xa'),_0x5e99a5,_0xf324('0xb'));logger[_0xf324('0xc')](_0xf324('0xd'),_0x5e99a5,_0xf324('0xb'),JSON[_0xf324('0xe')](_0x54a43d));if(_0x54a43d['error']){if(_0x54a43d[_0xf324('0xf')]['code']===0x1f4){logger[_0xf324('0xf')]('MailServerIn,\x20%s,\x20%s',_0x5e99a5,_0x54a43d[_0xf324('0xf')][_0xf324('0x10')]);return _0x17b7c3(_0x54a43d['error']['message']);}logger[_0xf324('0xf')](_0xf324('0xa'),_0x5e99a5,_0x54a43d['error'][_0xf324('0x10')]);return _0x50f77a(_0x54a43d[_0xf324('0xf')][_0xf324('0x10')]);}else{logger[_0xf324('0x11')](_0xf324('0xa'),_0x5e99a5,_0xf324('0xb'));_0x50f77a(_0x54a43d['result']['message']);}})[_0xf324('0x12')](function(_0x371f5c){logger[_0xf324('0xf')](_0xf324('0xa'),_0x5e99a5,_0x371f5c);_0x17b7c3(_0x371f5c);});});}exports[_0xf324('0x13')]=function(_0x1cbdbc){var _0x50bc4a=this;return new Promise(function(_0x355808,_0x14c228){return db[_0xf324('0x14')][_0xf324('0x15')]({'raw':_0x1cbdbc['options']?_0x1cbdbc[_0xf324('0x16')][_0xf324('0x17')]===undefined?!![]:![]:!![],'where':_0x1cbdbc[_0xf324('0x16')]?_0x1cbdbc['options'][_0xf324('0x18')]||null:null,'attributes':_0x1cbdbc[_0xf324('0x16')]?_0x1cbdbc[_0xf324('0x16')][_0xf324('0x19')]||null:null,'limit':_0x1cbdbc['options']?_0x1cbdbc[_0xf324('0x16')][_0xf324('0x1a')]||null:null,'include':_0x1cbdbc[_0xf324('0x16')]?_0x1cbdbc[_0xf324('0x16')]['include']?_[_0xf324('0x1b')](_0x1cbdbc[_0xf324('0x16')][_0xf324('0x1c')],function(_0x45d88c){return{'model':db[_0x45d88c[_0xf324('0x1d')]],'as':_0x45d88c['as'],'attributes':_0x45d88c[_0xf324('0x19')],'include':_0x45d88c[_0xf324('0x1c')]?_[_0xf324('0x1b')](_0x45d88c['include'],function(_0x5ae526){return{'model':db[_0x5ae526[_0xf324('0x1d')]],'as':_0x5ae526['as'],'attributes':_0x5ae526[_0xf324('0x19')],'include':_0x5ae526[_0xf324('0x1c')]?_[_0xf324('0x1b')](_0x5ae526[_0xf324('0x1c')],function(_0x3f900a){return{'model':db[_0x3f900a[_0xf324('0x1d')]],'as':_0x3f900a['as'],'attributes':_0x3f900a[_0xf324('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf324('0x9')](function(_0x49ee10){logger[_0xf324('0x11')](_0xf324('0x13'),_0x1cbdbc);logger[_0xf324('0xc')](_0xf324('0x13'),_0x1cbdbc,JSON[_0xf324('0xe')](_0x49ee10));_0x355808(_0x49ee10);})[_0xf324('0x12')](function(_0x246e7e){logger[_0xf324('0xf')]('GetMailServerIn',_0x246e7e[_0xf324('0x10')],_0x1cbdbc);_0x14c228(_0x50bc4a[_0xf324('0xf')](0x1f4,_0x246e7e[_0xf324('0x10')]));});});}; \ No newline at end of file +var _0x776c=['MailServerIn,\x20%s,\x20%s','info','result','GetMailServerIn','MailServerIn','findAll','options','raw','limit','include','model','attributes','map','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x24cbe6,_0x4eb905){var _0x4f50cd=function(_0x2e374a){while(--_0x2e374a){_0x24cbe6['push'](_0x24cbe6['shift']());}};_0x4f50cd(++_0x4eb905);}(_0x776c,0x6f));var _0xc776=function(_0x3f7e0a,_0x17f2ee){_0x3f7e0a=_0x3f7e0a-0x0;var _0x3b4d17=_0x776c[_0x3f7e0a];return _0x3b4d17;};'use strict';var _=require(_0xc776('0x0'));var util=require(_0xc776('0x1'));var moment=require(_0xc776('0x2'));var BPromise=require(_0xc776('0x3'));var rs=require(_0xc776('0x4'));var fs=require('fs');var Redis=require(_0xc776('0x5'));var db=require(_0xc776('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc776('0x7'))(_0xc776('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc776('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe6e46f,_0x2f0574,_0x38f132){return new BPromise(function(_0x3c6023,_0xb710c0){return client[_0xc776('0xa')](_0xe6e46f,_0x38f132)[_0xc776('0xb')](function(_0x50b510){logger['info']('MailServerIn,\x20%s,\x20%s',_0x2f0574,_0xc776('0xc'));logger['debug'](_0xc776('0xd'),_0x2f0574,_0xc776('0xc'),JSON[_0xc776('0xe')](_0x50b510));if(_0x50b510[_0xc776('0xf')]){if(_0x50b510[_0xc776('0xf')]['code']===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2f0574,_0x50b510['error'][_0xc776('0x10')]);return _0xb710c0(_0x50b510[_0xc776('0xf')][_0xc776('0x10')]);}logger[_0xc776('0xf')](_0xc776('0x11'),_0x2f0574,_0x50b510[_0xc776('0xf')][_0xc776('0x10')]);return _0x3c6023(_0x50b510['error'][_0xc776('0x10')]);}else{logger[_0xc776('0x12')](_0xc776('0x11'),_0x2f0574,_0xc776('0xc'));_0x3c6023(_0x50b510[_0xc776('0x13')][_0xc776('0x10')]);}})['catch'](function(_0x2f0b50){logger[_0xc776('0xf')](_0xc776('0x11'),_0x2f0574,_0x2f0b50);_0xb710c0(_0x2f0b50);});});}exports[_0xc776('0x14')]=function(_0x175a98){var _0x35194a=this;return new Promise(function(_0xfb90e9,_0x3a1a44){return db[_0xc776('0x15')][_0xc776('0x16')]({'raw':_0x175a98[_0xc776('0x17')]?_0x175a98['options'][_0xc776('0x18')]===undefined?!![]:![]:!![],'where':_0x175a98['options']?_0x175a98[_0xc776('0x17')]['where']||null:null,'attributes':_0x175a98[_0xc776('0x17')]?_0x175a98[_0xc776('0x17')]['attributes']||null:null,'limit':_0x175a98[_0xc776('0x17')]?_0x175a98[_0xc776('0x17')][_0xc776('0x19')]||null:null,'include':_0x175a98[_0xc776('0x17')]?_0x175a98['options'][_0xc776('0x1a')]?_['map'](_0x175a98['options'][_0xc776('0x1a')],function(_0xae55a3){return{'model':db[_0xae55a3[_0xc776('0x1b')]],'as':_0xae55a3['as'],'attributes':_0xae55a3[_0xc776('0x1c')],'include':_0xae55a3['include']?_[_0xc776('0x1d')](_0xae55a3[_0xc776('0x1a')],function(_0x26f8e5){return{'model':db[_0x26f8e5[_0xc776('0x1b')]],'as':_0x26f8e5['as'],'attributes':_0x26f8e5[_0xc776('0x1c')],'include':_0x26f8e5[_0xc776('0x1a')]?_['map'](_0x26f8e5[_0xc776('0x1a')],function(_0x28c4da){return{'model':db[_0x28c4da[_0xc776('0x1b')]],'as':_0x28c4da['as'],'attributes':_0x28c4da[_0xc776('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc776('0xb')](function(_0x5b6275){logger[_0xc776('0x12')](_0xc776('0x14'),_0x175a98);logger[_0xc776('0x1e')](_0xc776('0x14'),_0x175a98,JSON[_0xc776('0xe')](_0x5b6275));_0xfb90e9(_0x5b6275);})[_0xc776('0x1f')](function(_0x195e9b){logger[_0xc776('0xf')]('GetMailServerIn',_0x195e9b[_0xc776('0x10')],_0x175a98);_0x3a1a44(_0x35194a[_0xc776('0xf')](0x1f4,_0x195e9b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 644a4a7..9c04a16 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 _0x6465=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','index','get','/:id','isAuthenticated'];(function(_0x4886d4,_0x5df20a){var _0x48a889=function(_0x1360b5){while(--_0x1360b5){_0x4886d4['push'](_0x4886d4['shift']());}};_0x48a889(++_0x5df20a);}(_0x6465,0x15a));var _0x5646=function(_0x409858,_0x25373f){_0x409858=_0x409858-0x0;var _0x35080c=_0x6465[_0x409858];return _0x35080c;};'use strict';var multer=require(_0x5646('0x0'));var util=require(_0x5646('0x1'));var path=require(_0x5646('0x2'));var timeout=require(_0x5646('0x3'));var express=require(_0x5646('0x4'));var router=express[_0x5646('0x5')]();var auth=require(_0x5646('0x6'));var interaction=require(_0x5646('0x7'));var config=require(_0x5646('0x8'));var controller=require(_0x5646('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5646('0xa')]);router[_0x5646('0xb')](_0x5646('0xc'),auth[_0x5646('0xd')](),controller['show']);router[_0x5646('0xe')]('/',auth[_0x5646('0xd')](),controller[_0x5646('0xf')]);router[_0x5646('0x10')](_0x5646('0xc'),auth[_0x5646('0xd')](),controller[_0x5646('0x11')]);router['delete'](_0x5646('0xc'),auth[_0x5646('0xd')](),controller[_0x5646('0x12')]);module[_0x5646('0x13')]=router; \ No newline at end of file +var _0x2412=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x2412,0x139));var _0x2241=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2412[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2241('0x0'));var util=require(_0x2241('0x1'));var path=require(_0x2241('0x2'));var timeout=require(_0x2241('0x3'));var express=require(_0x2241('0x4'));var router=express['Router']();var auth=require(_0x2241('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2241('0x6'));var controller=require(_0x2241('0x7'));router[_0x2241('0x8')]('/',auth[_0x2241('0x9')](),controller['index']);router[_0x2241('0x8')]('/:id',auth[_0x2241('0x9')](),controller[_0x2241('0xa')]);router[_0x2241('0xb')]('/',auth[_0x2241('0x9')](),controller[_0x2241('0xc')]);router[_0x2241('0xd')](_0x2241('0xe'),auth[_0x2241('0x9')](),controller[_0x2241('0xf')]);router[_0x2241('0x10')](_0x2241('0xe'),auth[_0x2241('0x9')](),controller[_0x2241('0x11')]);module[_0x2241('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 0779f8c..c85ec2f 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 _0x7b84=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7b84,0x17c));var _0x47b8=function(_0x54af31,_0x4b33f6){_0x54af31=_0x54af31-0x0;var _0x183e4a=_0x7b84[_0x54af31];return _0x183e4a;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'description':{'type':Sequelize[_0x47b8('0x2')]},'host':{'type':Sequelize[_0x47b8('0x2')]},'user':{'type':Sequelize[_0x47b8('0x2')]},'pass':{'type':Sequelize[_0x47b8('0x2')]},'port':{'type':Sequelize[_0x47b8('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x47b8('0x2')]},'authentication':{'type':Sequelize[_0x47b8('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0272=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x36346c,_0x2b472e){var _0x103e5e=function(_0x379f5f){while(--_0x379f5f){_0x36346c['push'](_0x36346c['shift']());}};_0x103e5e(++_0x2b472e);}(_0x0272,0x15a));var _0x2027=function(_0x5bab39,_0x33db83){_0x5bab39=_0x5bab39-0x0;var _0x40305e=_0x0272[_0x5bab39];return _0x40305e;};'use strict';var Sequelize=require(_0x2027('0x0'));module[_0x2027('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2027('0x2')]},'user':{'type':Sequelize[_0x2027('0x2')]},'pass':{'type':Sequelize[_0x2027('0x2')]},'port':{'type':Sequelize[_0x2027('0x3')]},'secure':{'type':Sequelize[_0x2027('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x2027('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 397002e..f181e8f 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 _0x9204=['../../mysqldb','sendStatus','status','offset','limit','Content-Range','json','reject','save','then','end','error','name','map','MailServerOut','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','options','count','findAll','rows','catch','show','params','include','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x53a4de,_0xff041d){var _0x304c3c=function(_0x4d2f9a){while(--_0x4d2f9a){_0x53a4de['push'](_0x53a4de['shift']());}};_0x304c3c(++_0xff041d);}(_0x9204,0x6c));var _0x4920=function(_0x3a19b5,_0xb2d070){_0x3a19b5=_0x3a19b5-0x0;var _0x3618b4=_0x9204[_0x3a19b5];return _0x3618b4;};'use strict';var pdf=require(_0x4920('0x0'));var emlformat=require(_0x4920('0x1'));var rimraf=require(_0x4920('0x2'));var zipdir=require(_0x4920('0x3'));var jsonpatch=require(_0x4920('0x4'));var rp=require(_0x4920('0x5'));var moment=require('moment');var BPromise=require(_0x4920('0x6'));var Mustache=require(_0x4920('0x7'));var util=require(_0x4920('0x8'));var path=require('path');var sox=require(_0x4920('0x9'));var csv=require(_0x4920('0xa'));var ejs=require(_0x4920('0xb'));var fs=require('fs');var _=require(_0x4920('0xc'));var squel=require(_0x4920('0xd'));var crypto=require('crypto');var jsforce=require(_0x4920('0xe'));var deskjs=require(_0x4920('0xf'));var toCsv=require(_0x4920('0xa'));var querystring=require('querystring');var Papa=require(_0x4920('0x10'));var Redis=require(_0x4920('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4920('0x12'));var hardwareService=require(_0x4920('0x13'));var logger=require(_0x4920('0x14'))(_0x4920('0x15'));var utils=require(_0x4920('0x16'));var config=require(_0x4920('0x17'));var db=require(_0x4920('0x18'))['db'];function respondWithStatusCode(_0x392255,_0x391232){_0x391232=_0x391232||0xcc;return function(_0x254e22){if(_0x254e22){return _0x392255[_0x4920('0x19')](_0x391232);}return _0x392255[_0x4920('0x1a')](_0x391232)['end']();};}function respondWithResult(_0xab3b14,_0x58d72e){_0x58d72e=_0x58d72e||0xc8;return function(_0xba0c26){if(_0xba0c26){return _0xab3b14[_0x4920('0x1a')](_0x58d72e)['json'](_0xba0c26);}};}function respondWithFilteredResult(_0x2a0557,_0x89255a){return function(_0x25ca9f){if(_0x25ca9f){var _0x21e888=_0x25ca9f['count'],_0x3c3a20=_0x89255a[_0x4920('0x1b')],_0x5aefa7=_0x89255a[_0x4920('0x1b')]+_0x89255a[_0x4920('0x1c')],_0x51fba9;if(_0x5aefa7>=_0x21e888){_0x5aefa7=_0x21e888;_0x51fba9=0xc8;}else{_0x51fba9=0xce;}_0x2a0557[_0x4920('0x1a')](_0x51fba9);return _0x2a0557['set'](_0x4920('0x1d'),_0x3c3a20+'-'+_0x5aefa7+'/'+_0x21e888)[_0x4920('0x1e')](_0x25ca9f);}return null;};}function patchUpdates(_0x43b990){return function(_0x44bea0){try{jsonpatch['apply'](_0x44bea0,_0x43b990,!![]);}catch(_0x37b66f){return BPromise[_0x4920('0x1f')](_0x37b66f);}return _0x44bea0[_0x4920('0x20')]();};}function saveUpdates(_0x96fff8,_0x21d9e1){return function(_0x3d46a2){if(_0x3d46a2){return _0x3d46a2['update'](_0x96fff8)[_0x4920('0x21')](function(_0x5e3cb1){return _0x5e3cb1;});}return null;};}function removeEntity(_0x4b35a0,_0xed526a){return function(_0x3a52ef){if(_0x3a52ef){return _0x3a52ef['destroy']()[_0x4920('0x21')](function(){_0x4b35a0[_0x4920('0x1a')](0xcc)[_0x4920('0x22')]();});}};}function handleEntityNotFound(_0x15a96c,_0x4b2b34){return function(_0x52185f){if(!_0x52185f){_0x15a96c[_0x4920('0x19')](0x194);}return _0x52185f;};}function handleError(_0x3de259,_0x901d51){_0x901d51=_0x901d51||0x1f4;return function(_0x442af2){logger[_0x4920('0x23')](_0x442af2['stack']);if(_0x442af2[_0x4920('0x24')]){delete _0x442af2[_0x4920('0x24')];}_0x3de259['status'](_0x901d51)['send'](_0x442af2);};}exports['index']=function(_0x52a1ba,_0x2e260d){var _0x4e4121={},_0xa6998c={},_0x28488d={'count':0x0,'rows':[]};var _0x2e6655=_[_0x4920('0x25')](db[_0x4920('0x26')][_0x4920('0x27')],function(_0x28fd0b){return{'name':_0x28fd0b['fieldName'],'type':_0x28fd0b[_0x4920('0x28')][_0x4920('0x29')]};});_0xa6998c[_0x4920('0x2a')]=_[_0x4920('0x25')](_0x2e6655,_0x4920('0x24'));_0xa6998c['query']=_[_0x4920('0x2b')](_0x52a1ba['query']);_0xa6998c[_0x4920('0x2c')]=_[_0x4920('0x2d')](_0xa6998c[_0x4920('0x2a')],_0xa6998c[_0x4920('0x2e')]);_0x4e4121[_0x4920('0x2f')]=_[_0x4920('0x2d')](_0xa6998c[_0x4920('0x2a')],qs[_0x4920('0x30')](_0x52a1ba['query'][_0x4920('0x30')]));_0x4e4121[_0x4920('0x2f')]=_0x4e4121[_0x4920('0x2f')]['length']?_0x4e4121['attributes']:_0xa6998c[_0x4920('0x2a')];if(!_0x52a1ba['query'][_0x4920('0x31')](_0x4920('0x32'))){_0x4e4121[_0x4920('0x1c')]=qs[_0x4920('0x1c')](_0x52a1ba[_0x4920('0x2e')]['limit']);_0x4e4121[_0x4920('0x1b')]=qs[_0x4920('0x1b')](_0x52a1ba[_0x4920('0x2e')]['offset']);}_0x4e4121[_0x4920('0x33')]=qs[_0x4920('0x34')](_0x52a1ba['query'][_0x4920('0x34')]);_0x4e4121[_0x4920('0x35')]=qs[_0x4920('0x2c')](_['pick'](_0x52a1ba[_0x4920('0x2e')],_0xa6998c[_0x4920('0x2c')]),_0x2e6655);if(_0x52a1ba['query']['filter']){_0x4e4121[_0x4920('0x35')]=_['merge'](_0x4e4121[_0x4920('0x35')],{'$or':_[_0x4920('0x25')](_0x2e6655,function(_0x2f4fdb){if(_0x2f4fdb['type']!=='VIRTUAL'){var _0x298bb4={};_0x298bb4[_0x2f4fdb[_0x4920('0x24')]]={'$like':'%'+_0x52a1ba['query']['filter']+'%'};return _0x298bb4;}})});}_0x4e4121=_['merge']({},_0x4e4121,_0x52a1ba[_0x4920('0x36')]);var _0x5824ed={'where':_0x4e4121['where']};return db[_0x4920('0x26')][_0x4920('0x37')](_0x5824ed)[_0x4920('0x21')](function(_0x53ff78){_0x28488d['count']=_0x53ff78;if(_0x52a1ba[_0x4920('0x2e')]['includeAll']){_0x4e4121['include']=[{'all':!![]}];}return db[_0x4920('0x26')][_0x4920('0x38')](_0x4e4121);})[_0x4920('0x21')](function(_0x38d2db){_0x28488d[_0x4920('0x39')]=_0x38d2db;return _0x28488d;})['then'](respondWithFilteredResult(_0x2e260d,_0x4e4121))[_0x4920('0x3a')](handleError(_0x2e260d,null));};exports[_0x4920('0x3b')]=function(_0x16cd1a,_0x2fec69){var _0x1c5dc5={'raw':!![],'where':{'id':_0x16cd1a[_0x4920('0x3c')]['id']}},_0x5b42cd={};_0x5b42cd[_0x4920('0x2a')]=_[_0x4920('0x2b')](db[_0x4920('0x26')]['rawAttributes']);_0x5b42cd['query']=_[_0x4920('0x2b')](_0x16cd1a[_0x4920('0x2e')]);_0x5b42cd[_0x4920('0x2c')]=_[_0x4920('0x2d')](_0x5b42cd['model'],_0x5b42cd['query']);_0x1c5dc5['attributes']=_['intersection'](_0x5b42cd['model'],qs['fields'](_0x16cd1a[_0x4920('0x2e')][_0x4920('0x30')]));_0x1c5dc5[_0x4920('0x2f')]=_0x1c5dc5[_0x4920('0x2f')]['length']?_0x1c5dc5[_0x4920('0x2f')]:_0x5b42cd[_0x4920('0x2a')];if(_0x16cd1a[_0x4920('0x2e')]['includeAll']){_0x1c5dc5[_0x4920('0x3d')]=[{'all':!![]}];}_0x1c5dc5=_['merge']({},_0x1c5dc5,_0x16cd1a[_0x4920('0x36')]);return db[_0x4920('0x26')][_0x4920('0x3e')](_0x1c5dc5)[_0x4920('0x21')](handleEntityNotFound(_0x2fec69,null))[_0x4920('0x21')](respondWithResult(_0x2fec69,null))[_0x4920('0x3a')](handleError(_0x2fec69,null));};exports[_0x4920('0x3f')]=function(_0x405488,_0x40c666){return db[_0x4920('0x26')][_0x4920('0x3f')](_0x405488[_0x4920('0x40')],{})[_0x4920('0x21')](respondWithResult(_0x40c666,0xc9))[_0x4920('0x3a')](handleError(_0x40c666,null));};exports['update']=function(_0x4974a3,_0xc95d7d){if(_0x4974a3[_0x4920('0x40')]['id']){delete _0x4974a3['body']['id'];}return db[_0x4920('0x26')][_0x4920('0x3e')]({'where':{'id':_0x4974a3[_0x4920('0x3c')]['id']}})[_0x4920('0x21')](handleEntityNotFound(_0xc95d7d,null))[_0x4920('0x21')](saveUpdates(_0x4974a3['body'],null))[_0x4920('0x21')](respondWithResult(_0xc95d7d,null))[_0x4920('0x3a')](handleError(_0xc95d7d,null));};exports[_0x4920('0x41')]=function(_0x8e4fd5,_0x218ea1){return db['MailServerOut'][_0x4920('0x3e')]({'where':{'id':_0x8e4fd5[_0x4920('0x3c')]['id']}})[_0x4920('0x21')](handleEntityNotFound(_0x218ea1,null))[_0x4920('0x21')](removeEntity(_0x218ea1,null))[_0x4920('0x3a')](handleError(_0x218ea1,null));}; \ No newline at end of file +var _0x9f8a=['json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','MailServerOut','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','destroy','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x9f8a,0x185));var _0xa9f8=function(_0xae9024,_0x17f58e){_0xae9024=_0xae9024-0x0;var _0x23e7d3=_0x9f8a[_0xae9024];return _0x23e7d3;};'use strict';var pdf=require(_0xa9f8('0x0'));var emlformat=require(_0xa9f8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa9f8('0x2'));var rp=require(_0xa9f8('0x3'));var moment=require('moment');var BPromise=require(_0xa9f8('0x4'));var Mustache=require(_0xa9f8('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa9f8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa9f8('0x7'));var crypto=require('crypto');var jsforce=require(_0xa9f8('0x8'));var deskjs=require(_0xa9f8('0x9'));var toCsv=require(_0xa9f8('0xa'));var querystring=require(_0xa9f8('0xb'));var Papa=require(_0xa9f8('0xc'));var Redis=require(_0xa9f8('0xd'));var authService=require(_0xa9f8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa9f8('0xf'));var hardwareService=require(_0xa9f8('0x10'));var logger=require(_0xa9f8('0x11'))(_0xa9f8('0x12'));var utils=require(_0xa9f8('0x13'));var config=require(_0xa9f8('0x14'));var db=require(_0xa9f8('0x15'))['db'];function respondWithStatusCode(_0x6d3ffb,_0x2ed55e){_0x2ed55e=_0x2ed55e||0xcc;return function(_0x349189){if(_0x349189){return _0x6d3ffb[_0xa9f8('0x16')](_0x2ed55e);}return _0x6d3ffb[_0xa9f8('0x17')](_0x2ed55e)[_0xa9f8('0x18')]();};}function respondWithResult(_0x637a2a,_0x8285c3){_0x8285c3=_0x8285c3||0xc8;return function(_0x29ee07){if(_0x29ee07){return _0x637a2a['status'](_0x8285c3)[_0xa9f8('0x19')](_0x29ee07);}};}function respondWithFilteredResult(_0xb533cc,_0x537aaf){return function(_0x144dff){if(_0x144dff){var _0x19325a=_0x144dff[_0xa9f8('0x1a')],_0x390d19=_0x537aaf[_0xa9f8('0x1b')],_0x3c8b77=_0x537aaf[_0xa9f8('0x1b')]+_0x537aaf[_0xa9f8('0x1c')],_0x1778d4;if(_0x3c8b77>=_0x19325a){_0x3c8b77=_0x19325a;_0x1778d4=0xc8;}else{_0x1778d4=0xce;}_0xb533cc[_0xa9f8('0x17')](_0x1778d4);return _0xb533cc[_0xa9f8('0x1d')]('Content-Range',_0x390d19+'-'+_0x3c8b77+'/'+_0x19325a)[_0xa9f8('0x19')](_0x144dff);}return null;};}function patchUpdates(_0xad11ae){return function(_0x593ed1){try{jsonpatch[_0xa9f8('0x1e')](_0x593ed1,_0xad11ae,!![]);}catch(_0x8cebd9){return BPromise[_0xa9f8('0x1f')](_0x8cebd9);}return _0x593ed1[_0xa9f8('0x20')]();};}function saveUpdates(_0x5962c1,_0x3b620f){return function(_0x29558){if(_0x29558){return _0x29558[_0xa9f8('0x21')](_0x5962c1)[_0xa9f8('0x22')](function(_0x4a45d9){return _0x4a45d9;});}return null;};}function removeEntity(_0x3132ff,_0x4e48ae){return function(_0x24204f){if(_0x24204f){return _0x24204f['destroy']()['then'](function(){_0x3132ff[_0xa9f8('0x17')](0xcc)[_0xa9f8('0x18')]();});}};}function handleEntityNotFound(_0x48a693,_0x15b7a6){return function(_0x333251){if(!_0x333251){_0x48a693[_0xa9f8('0x16')](0x194);}return _0x333251;};}function handleError(_0x131408,_0x4fbf34){_0x4fbf34=_0x4fbf34||0x1f4;return function(_0x2f8403){logger[_0xa9f8('0x23')](_0x2f8403[_0xa9f8('0x24')]);if(_0x2f8403[_0xa9f8('0x25')]){delete _0x2f8403['name'];}_0x131408['status'](_0x4fbf34)[_0xa9f8('0x26')](_0x2f8403);};}exports['index']=function(_0x267459,_0xceca31){var _0x93cf88={},_0x139de2={},_0x2b84a1={'count':0x0,'rows':[]};var _0x5f5b76=_['map'](db[_0xa9f8('0x27')][_0xa9f8('0x28')],function(_0xd6bb29){return{'name':_0xd6bb29['fieldName'],'type':_0xd6bb29[_0xa9f8('0x29')][_0xa9f8('0x2a')]};});_0x139de2[_0xa9f8('0x2b')]=_['map'](_0x5f5b76,_0xa9f8('0x25'));_0x139de2[_0xa9f8('0x2c')]=_['keys'](_0x267459['query']);_0x139de2[_0xa9f8('0x2d')]=_[_0xa9f8('0x2e')](_0x139de2[_0xa9f8('0x2b')],_0x139de2['query']);_0x93cf88['attributes']=_[_0xa9f8('0x2e')](_0x139de2[_0xa9f8('0x2b')],qs['fields'](_0x267459[_0xa9f8('0x2c')][_0xa9f8('0x2f')]));_0x93cf88[_0xa9f8('0x30')]=_0x93cf88[_0xa9f8('0x30')][_0xa9f8('0x31')]?_0x93cf88[_0xa9f8('0x30')]:_0x139de2['model'];if(!_0x267459['query'][_0xa9f8('0x32')]('nolimit')){_0x93cf88[_0xa9f8('0x1c')]=qs[_0xa9f8('0x1c')](_0x267459[_0xa9f8('0x2c')][_0xa9f8('0x1c')]);_0x93cf88[_0xa9f8('0x1b')]=qs[_0xa9f8('0x1b')](_0x267459[_0xa9f8('0x2c')]['offset']);}_0x93cf88[_0xa9f8('0x33')]=qs['sort'](_0x267459[_0xa9f8('0x2c')][_0xa9f8('0x34')]);_0x93cf88[_0xa9f8('0x35')]=qs[_0xa9f8('0x2d')](_['pick'](_0x267459[_0xa9f8('0x2c')],_0x139de2[_0xa9f8('0x2d')]),_0x5f5b76);if(_0x267459[_0xa9f8('0x2c')][_0xa9f8('0x36')]){_0x93cf88[_0xa9f8('0x35')]=_['merge'](_0x93cf88[_0xa9f8('0x35')],{'$or':_['map'](_0x5f5b76,function(_0x139890){if(_0x139890['type']!==_0xa9f8('0x37')){var _0x2ecbeb={};_0x2ecbeb[_0x139890[_0xa9f8('0x25')]]={'$like':'%'+_0x267459[_0xa9f8('0x2c')][_0xa9f8('0x36')]+'%'};return _0x2ecbeb;}})});}_0x93cf88=_[_0xa9f8('0x38')]({},_0x93cf88,_0x267459['options']);var _0x1ae8d4={'where':_0x93cf88[_0xa9f8('0x35')]};return db['MailServerOut'][_0xa9f8('0x1a')](_0x1ae8d4)[_0xa9f8('0x22')](function(_0x50ffd6){_0x2b84a1[_0xa9f8('0x1a')]=_0x50ffd6;if(_0x267459[_0xa9f8('0x2c')][_0xa9f8('0x39')]){_0x93cf88['include']=[{'all':!![]}];}return db['MailServerOut'][_0xa9f8('0x3a')](_0x93cf88);})[_0xa9f8('0x22')](function(_0x5ef8d3){_0x2b84a1[_0xa9f8('0x3b')]=_0x5ef8d3;return _0x2b84a1;})[_0xa9f8('0x22')](respondWithFilteredResult(_0xceca31,_0x93cf88))['catch'](handleError(_0xceca31,null));};exports[_0xa9f8('0x3c')]=function(_0x3d4026,_0x1a4a6e){var _0x2f78ac={'raw':!![],'where':{'id':_0x3d4026[_0xa9f8('0x3d')]['id']}},_0x3e86f7={};_0x3e86f7['model']=_[_0xa9f8('0x3e')](db[_0xa9f8('0x27')][_0xa9f8('0x28')]);_0x3e86f7['query']=_[_0xa9f8('0x3e')](_0x3d4026[_0xa9f8('0x2c')]);_0x3e86f7[_0xa9f8('0x2d')]=_['intersection'](_0x3e86f7[_0xa9f8('0x2b')],_0x3e86f7['query']);_0x2f78ac[_0xa9f8('0x30')]=_[_0xa9f8('0x2e')](_0x3e86f7['model'],qs[_0xa9f8('0x2f')](_0x3d4026['query']['fields']));_0x2f78ac['attributes']=_0x2f78ac['attributes'][_0xa9f8('0x31')]?_0x2f78ac[_0xa9f8('0x30')]:_0x3e86f7['model'];if(_0x3d4026['query'][_0xa9f8('0x39')]){_0x2f78ac[_0xa9f8('0x3f')]=[{'all':!![]}];}_0x2f78ac=_[_0xa9f8('0x38')]({},_0x2f78ac,_0x3d4026['options']);return db[_0xa9f8('0x27')][_0xa9f8('0x40')](_0x2f78ac)[_0xa9f8('0x22')](handleEntityNotFound(_0x1a4a6e,null))[_0xa9f8('0x22')](respondWithResult(_0x1a4a6e,null))[_0xa9f8('0x41')](handleError(_0x1a4a6e,null));};exports[_0xa9f8('0x42')]=function(_0x51a489,_0x2cd484){return db[_0xa9f8('0x27')][_0xa9f8('0x42')](_0x51a489[_0xa9f8('0x43')],{})[_0xa9f8('0x22')](respondWithResult(_0x2cd484,0xc9))[_0xa9f8('0x41')](handleError(_0x2cd484,null));};exports[_0xa9f8('0x21')]=function(_0x2a1d7f,_0x1ce38e){if(_0x2a1d7f['body']['id']){delete _0x2a1d7f[_0xa9f8('0x43')]['id'];}return db[_0xa9f8('0x27')]['find']({'where':{'id':_0x2a1d7f[_0xa9f8('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1ce38e,null))[_0xa9f8('0x22')](saveUpdates(_0x2a1d7f[_0xa9f8('0x43')],null))[_0xa9f8('0x22')](respondWithResult(_0x1ce38e,null))[_0xa9f8('0x41')](handleError(_0x1ce38e,null));};exports[_0xa9f8('0x44')]=function(_0x30ef96,_0x3c40df){return db[_0xa9f8('0x27')][_0xa9f8('0x40')]({'where':{'id':_0x30ef96['params']['id']}})[_0xa9f8('0x22')](handleEntityNotFound(_0x3c40df,null))[_0xa9f8('0x22')](removeEntity(_0x3c40df,null))['catch'](handleError(_0x3c40df,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9985759..3321c5e 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 _0xca87=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out'];(function(_0x43a159,_0x32ba85){var _0x5f3d92=function(_0x3d0143){while(--_0x3d0143){_0x43a159['push'](_0x43a159['shift']());}};_0x5f3d92(++_0x32ba85);}(_0xca87,0x9c));var _0x7ca8=function(_0x29bcab,_0x53a015){_0x29bcab=_0x29bcab-0x0;var _0x2cb492=_0xca87[_0x29bcab];return _0x2cb492;};'use strict';var _=require(_0x7ca8('0x0'));var util=require(_0x7ca8('0x1'));var logger=require(_0x7ca8('0x2'))(_0x7ca8('0x3'));var moment=require(_0x7ca8('0x4'));var BPromise=require(_0x7ca8('0x5'));var rp=require(_0x7ca8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ca8('0x7'));var attributes=require(_0x7ca8('0x8'));module['exports']=function(_0x5b35ae,_0x49a76d){return _0x5b35ae[_0x7ca8('0x9')](_0x7ca8('0xa'),attributes,{'tableName':_0x7ca8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ac6=['MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x204fef,_0xd3e3f0){var _0x11a28d=function(_0x4eea9a){while(--_0x4eea9a){_0x204fef['push'](_0x204fef['shift']());}};_0x11a28d(++_0xd3e3f0);}(_0x9ac6,0xab));var _0x69ac=function(_0x4e9884,_0x193af3){_0x4e9884=_0x4e9884-0x0;var _0x461a20=_0x9ac6[_0x4e9884];return _0x461a20;};'use strict';var _=require(_0x69ac('0x0'));var util=require(_0x69ac('0x1'));var logger=require(_0x69ac('0x2'))(_0x69ac('0x3'));var moment=require(_0x69ac('0x4'));var BPromise=require('bluebird');var rp=require(_0x69ac('0x5'));var fs=require('fs');var path=require(_0x69ac('0x6'));var rimraf=require(_0x69ac('0x7'));var config=require(_0x69ac('0x8'));var attributes=require(_0x69ac('0x9'));module[_0x69ac('0xa')]=function(_0x4a351e,_0x53e32e){return _0x4a351e['define'](_0x69ac('0xb'),attributes,{'tableName':_0x69ac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 9201b9d..9f6871d 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 _0xb612=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0xb612,0xa7));var _0x2b61=function(_0x31fbeb,_0x51eb69){_0x31fbeb=_0x31fbeb-0x0;var _0x1845a8=_0xb612[_0x31fbeb];return _0x1845a8;};'use strict';var _=require(_0x2b61('0x0'));var util=require(_0x2b61('0x1'));var moment=require(_0x2b61('0x2'));var BPromise=require(_0x2b61('0x3'));var rs=require(_0x2b61('0x4'));var fs=require('fs');var Redis=require(_0x2b61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b61('0x6'));var logger=require(_0x2b61('0x7'))('rpc');var config=require(_0x2b61('0x8'));var jayson=require(_0x2b61('0x9'));var client=jayson[_0x2b61('0xa')][_0x2b61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x169e9a,_0x1d34e2,_0x2fb117){return new BPromise(function(_0x51b003,_0x1a2e5f){return client[_0x2b61('0xc')](_0x169e9a,_0x2fb117)[_0x2b61('0xd')](function(_0x43456b){logger[_0x2b61('0xe')](_0x2b61('0xf'),_0x1d34e2,_0x2b61('0x10'));logger[_0x2b61('0x11')](_0x2b61('0x12'),_0x1d34e2,_0x2b61('0x10'),JSON[_0x2b61('0x13')](_0x43456b));if(_0x43456b[_0x2b61('0x14')]){if(_0x43456b['error'][_0x2b61('0x15')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x1d34e2,_0x43456b[_0x2b61('0x14')][_0x2b61('0x16')]);return _0x1a2e5f(_0x43456b[_0x2b61('0x14')]['message']);}logger[_0x2b61('0x14')](_0x2b61('0xf'),_0x1d34e2,_0x43456b[_0x2b61('0x14')][_0x2b61('0x16')]);return _0x51b003(_0x43456b[_0x2b61('0x14')]['message']);}else{logger[_0x2b61('0xe')](_0x2b61('0xf'),_0x1d34e2,'request\x20sent');_0x51b003(_0x43456b[_0x2b61('0x17')]['message']);}})['catch'](function(_0x1fd7b9){logger['error'](_0x2b61('0xf'),_0x1d34e2,_0x1fd7b9);_0x1a2e5f(_0x1fd7b9);});});} \ No newline at end of file +var _0x7393=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0x7393,0x85));var _0x3739=function(_0x35f7c8,_0x162e2e){_0x35f7c8=_0x35f7c8-0x0;var _0x49682c=_0x7393[_0x35f7c8];return _0x49682c;};'use strict';var _=require(_0x3739('0x0'));var util=require(_0x3739('0x1'));var moment=require(_0x3739('0x2'));var BPromise=require(_0x3739('0x3'));var rs=require(_0x3739('0x4'));var fs=require('fs');var Redis=require(_0x3739('0x5'));var db=require(_0x3739('0x6'))['db'];var utils=require(_0x3739('0x7'));var logger=require(_0x3739('0x8'))('rpc');var config=require(_0x3739('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3739('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x404027,_0xbe6a62,_0x3424af){return new BPromise(function(_0x2bb7a8,_0x422a1f){return client['request'](_0x404027,_0x3424af)[_0x3739('0xb')](function(_0x4b760b){logger[_0x3739('0xc')](_0x3739('0xd'),_0xbe6a62,_0x3739('0xe'));logger['debug'](_0x3739('0xf'),_0xbe6a62,_0x3739('0xe'),JSON[_0x3739('0x10')](_0x4b760b));if(_0x4b760b['error']){if(_0x4b760b[_0x3739('0x11')][_0x3739('0x12')]===0x1f4){logger['error'](_0x3739('0xd'),_0xbe6a62,_0x4b760b[_0x3739('0x11')][_0x3739('0x13')]);return _0x422a1f(_0x4b760b['error'][_0x3739('0x13')]);}logger['error']('MailServerOut,\x20%s,\x20%s',_0xbe6a62,_0x4b760b[_0x3739('0x11')][_0x3739('0x13')]);return _0x2bb7a8(_0x4b760b[_0x3739('0x11')][_0x3739('0x13')]);}else{logger[_0x3739('0xc')](_0x3739('0xd'),_0xbe6a62,'request\x20sent');_0x2bb7a8(_0x4b760b[_0x3739('0x14')]['message']);}})[_0x3739('0x15')](function(_0x217268){logger[_0x3739('0x11')](_0x3739('0xd'),_0xbe6a62,_0x217268);_0x422a1f(_0x217268);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 121576d..c8faa44 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 _0x28f1=['isAuthenticated','/describe','describe','/:id','show','post','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x28f1,0x1e9));var _0x128f=function(_0x148199,_0x340c08){_0x148199=_0x148199-0x0;var _0x4f6158=_0x28f1[_0x148199];return _0x4f6158;};'use strict';var multer=require(_0x128f('0x0'));var util=require(_0x128f('0x1'));var path=require('path');var timeout=require(_0x128f('0x2'));var express=require(_0x128f('0x3'));var router=express['Router']();var auth=require(_0x128f('0x4'));var interaction=require(_0x128f('0x5'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x128f('0x6')]('/',auth[_0x128f('0x7')](),controller['index']);router[_0x128f('0x6')](_0x128f('0x8'),auth['isAuthenticated'](),controller[_0x128f('0x9')]);router[_0x128f('0x6')](_0x128f('0xa'),auth[_0x128f('0x7')](),controller[_0x128f('0xb')]);router[_0x128f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x128f('0xa'),auth[_0x128f('0x7')](),controller[_0x128f('0xd')]);router[_0x128f('0xe')](_0x128f('0xa'),auth[_0x128f('0x7')](),controller['destroy']);module[_0x128f('0xf')]=router; \ No newline at end of file +var _0x86eb=['create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','get','/:id','show','post'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x86eb,0x116));var _0xb86e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x86eb[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0xb86e('0x0'));var path=require(_0xb86e('0x1'));var timeout=require(_0xb86e('0x2'));var express=require(_0xb86e('0x3'));var router=express[_0xb86e('0x4')]();var auth=require(_0xb86e('0x5'));var interaction=require(_0xb86e('0x6'));var config=require(_0xb86e('0x7'));var controller=require(_0xb86e('0x8'));router['get']('/',auth[_0xb86e('0x9')](),controller[_0xb86e('0xa')]);router['get'](_0xb86e('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xb86e('0xc')](_0xb86e('0xd'),auth[_0xb86e('0x9')](),controller[_0xb86e('0xe')]);router[_0xb86e('0xf')]('/',auth['isAuthenticated'](),controller[_0xb86e('0x10')]);router[_0xb86e('0x11')](_0xb86e('0xd'),auth[_0xb86e('0x9')](),controller['update']);router[_0xb86e('0x12')](_0xb86e('0xd'),auth['isAuthenticated'](),controller[_0xb86e('0x13')]);module[_0xb86e('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index fa6bbf4..fdd3c04 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 _0x6efe=['STRING','name','sequelize','exports'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6efe,0xc6));var _0xe6ef=function(_0x554833,_0x2661a7){_0x554833=_0x554833-0x0;var _0x4aca7e=_0x6efe[_0x554833];return _0x4aca7e;};'use strict';var Sequelize=require(_0xe6ef('0x0'));module[_0xe6ef('0x1')]={'name':{'type':Sequelize[_0xe6ef('0x2')],'unique':_0xe6ef('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe6ef('0x2')]}}; \ No newline at end of file +var _0x69d4=['exports','name','STRING','sequelize'];(function(_0x23ef30,_0x103cb6){var _0x3292e8=function(_0x3a0974){while(--_0x3a0974){_0x23ef30['push'](_0x23ef30['shift']());}};_0x3292e8(++_0x103cb6);}(_0x69d4,0x83));var _0x469d=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x69d4[_0x5b27da];return _0x3254f4;};'use strict';var Sequelize=require(_0x469d('0x0'));module[_0x469d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x469d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x469d('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 2505254..9a47b30 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 _0xfbc7=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','update','destroy','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','merge','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x4b882b,_0x11e12b){var _0x5ab884=function(_0x36b978){while(--_0x36b978){_0x4b882b['push'](_0x4b882b['shift']());}};_0x5ab884(++_0x11e12b);}(_0xfbc7,0x8b));var _0x7fbc=function(_0x9c41a1,_0x2f74d5){_0x9c41a1=_0x9c41a1-0x0;var _0x34d7a6=_0xfbc7[_0x9c41a1];return _0x34d7a6;};'use strict';var pdf=require(_0x7fbc('0x0'));var emlformat=require(_0x7fbc('0x1'));var rimraf=require(_0x7fbc('0x2'));var zipdir=require(_0x7fbc('0x3'));var jsonpatch=require(_0x7fbc('0x4'));var rp=require(_0x7fbc('0x5'));var moment=require(_0x7fbc('0x6'));var BPromise=require(_0x7fbc('0x7'));var Mustache=require('mustache');var util=require(_0x7fbc('0x8'));var path=require(_0x7fbc('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7fbc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7fbc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7fbc('0xc'));var toCsv=require(_0x7fbc('0xd'));var querystring=require(_0x7fbc('0xe'));var Papa=require(_0x7fbc('0xf'));var Redis=require(_0x7fbc('0x10'));var authService=require(_0x7fbc('0x11'));var qs=require(_0x7fbc('0x12'));var as=require(_0x7fbc('0x13'));var hardwareService=require(_0x7fbc('0x14'));var logger=require(_0x7fbc('0x15'))(_0x7fbc('0x16'));var utils=require(_0x7fbc('0x17'));var config=require(_0x7fbc('0x18'));var db=require(_0x7fbc('0x19'))['db'];function respondWithStatusCode(_0xf853,_0x2c8a25){_0x2c8a25=_0x2c8a25||0xcc;return function(_0x5287c0){if(_0x5287c0){return _0xf853[_0x7fbc('0x1a')](_0x2c8a25);}return _0xf853[_0x7fbc('0x1b')](_0x2c8a25)['end']();};}function respondWithResult(_0x168069,_0x3f29f1){_0x3f29f1=_0x3f29f1||0xc8;return function(_0x50ff95){if(_0x50ff95){return _0x168069[_0x7fbc('0x1b')](_0x3f29f1)[_0x7fbc('0x1c')](_0x50ff95);}};}function respondWithFilteredResult(_0x46ce75,_0x468885){return function(_0x3da11a){if(_0x3da11a){var _0x13dcff=_0x3da11a[_0x7fbc('0x1d')],_0x3a76bf=_0x468885['offset'],_0x2362f4=_0x468885['offset']+_0x468885[_0x7fbc('0x1e')],_0x50f804;if(_0x2362f4>=_0x13dcff){_0x2362f4=_0x13dcff;_0x50f804=0xc8;}else{_0x50f804=0xce;}_0x46ce75[_0x7fbc('0x1b')](_0x50f804);return _0x46ce75[_0x7fbc('0x1f')](_0x7fbc('0x20'),_0x3a76bf+'-'+_0x2362f4+'/'+_0x13dcff)[_0x7fbc('0x1c')](_0x3da11a);}return null;};}function patchUpdates(_0x49a201){return function(_0x351296){try{jsonpatch['apply'](_0x351296,_0x49a201,!![]);}catch(_0xb6fd25){return BPromise[_0x7fbc('0x21')](_0xb6fd25);}return _0x351296['save']();};}function saveUpdates(_0x14ff89,_0xcf3251){return function(_0x16e23b){if(_0x16e23b){return _0x16e23b[_0x7fbc('0x22')](_0x14ff89)['then'](function(_0x5b0e79){return _0x5b0e79;});}return null;};}function removeEntity(_0x3cdbb8,_0x5e07fd){return function(_0x1bd830){if(_0x1bd830){return _0x1bd830[_0x7fbc('0x23')]()['then'](function(){_0x3cdbb8[_0x7fbc('0x1b')](0xcc)[_0x7fbc('0x24')]();});}};}function handleEntityNotFound(_0x2d2843,_0x385add){return function(_0x297256){if(!_0x297256){_0x2d2843[_0x7fbc('0x1a')](0x194);}return _0x297256;};}function handleError(_0x35a889,_0x179f9f){_0x179f9f=_0x179f9f||0x1f4;return function(_0x199767){logger[_0x7fbc('0x25')](_0x199767[_0x7fbc('0x26')]);if(_0x199767[_0x7fbc('0x27')]){delete _0x199767[_0x7fbc('0x27')];}_0x35a889[_0x7fbc('0x1b')](_0x179f9f)[_0x7fbc('0x28')](_0x199767);};}exports[_0x7fbc('0x29')]=function(_0x33c929,_0x4efd14){var _0x30c9c6={},_0x268381={},_0x562fab={'count':0x0,'rows':[]};var _0x79ef1c=_[_0x7fbc('0x2a')](db[_0x7fbc('0x2b')][_0x7fbc('0x2c')],function(_0x2d3008){return{'name':_0x2d3008[_0x7fbc('0x2d')],'type':_0x2d3008[_0x7fbc('0x2e')][_0x7fbc('0x2f')]};});_0x268381[_0x7fbc('0x30')]=_[_0x7fbc('0x2a')](_0x79ef1c,_0x7fbc('0x27'));_0x268381[_0x7fbc('0x31')]=_[_0x7fbc('0x32')](_0x33c929[_0x7fbc('0x31')]);_0x268381[_0x7fbc('0x33')]=_[_0x7fbc('0x34')](_0x268381['model'],_0x268381['query']);_0x30c9c6[_0x7fbc('0x35')]=_[_0x7fbc('0x34')](_0x268381['model'],qs[_0x7fbc('0x36')](_0x33c929['query'][_0x7fbc('0x36')]));_0x30c9c6['attributes']=_0x30c9c6[_0x7fbc('0x35')][_0x7fbc('0x37')]?_0x30c9c6['attributes']:_0x268381[_0x7fbc('0x30')];if(!_0x33c929['query'][_0x7fbc('0x38')](_0x7fbc('0x39'))){_0x30c9c6[_0x7fbc('0x1e')]=qs[_0x7fbc('0x1e')](_0x33c929[_0x7fbc('0x31')][_0x7fbc('0x1e')]);_0x30c9c6[_0x7fbc('0x3a')]=qs[_0x7fbc('0x3a')](_0x33c929[_0x7fbc('0x31')][_0x7fbc('0x3a')]);}_0x30c9c6[_0x7fbc('0x3b')]=qs[_0x7fbc('0x3c')](_0x33c929[_0x7fbc('0x31')]['sort']);_0x30c9c6[_0x7fbc('0x3d')]=qs['filters'](_[_0x7fbc('0x3e')](_0x33c929[_0x7fbc('0x31')],_0x268381['filters']),_0x79ef1c);if(_0x33c929[_0x7fbc('0x31')][_0x7fbc('0x3f')]){_0x30c9c6[_0x7fbc('0x3d')]=_['merge'](_0x30c9c6[_0x7fbc('0x3d')],{'$or':_[_0x7fbc('0x2a')](_0x79ef1c,function(_0x337c90){if(_0x337c90[_0x7fbc('0x2e')]!==_0x7fbc('0x40')){var _0xbab22f={};_0xbab22f[_0x337c90['name']]={'$like':'%'+_0x33c929[_0x7fbc('0x31')][_0x7fbc('0x3f')]+'%'};return _0xbab22f;}})});}_0x30c9c6=_['merge']({},_0x30c9c6,_0x33c929[_0x7fbc('0x41')]);var _0x1e5ca9={'where':_0x30c9c6['where']};return db['MailSubstatus']['count'](_0x1e5ca9)[_0x7fbc('0x42')](function(_0x310dcc){_0x562fab[_0x7fbc('0x1d')]=_0x310dcc;if(_0x33c929[_0x7fbc('0x31')][_0x7fbc('0x43')]){_0x30c9c6[_0x7fbc('0x44')]=[{'all':!![]}];}return db[_0x7fbc('0x2b')][_0x7fbc('0x45')](_0x30c9c6);})['then'](function(_0x4fed77){_0x562fab[_0x7fbc('0x46')]=_0x4fed77;return _0x562fab;})[_0x7fbc('0x42')](respondWithFilteredResult(_0x4efd14,_0x30c9c6))[_0x7fbc('0x47')](handleError(_0x4efd14,null));};exports['show']=function(_0x4e66d7,_0x1713ab){var _0x3cb9a5={'raw':!![],'where':{'id':_0x4e66d7[_0x7fbc('0x48')]['id']}},_0x5c07e5={};_0x5c07e5[_0x7fbc('0x30')]=_[_0x7fbc('0x32')](db[_0x7fbc('0x2b')]['rawAttributes']);_0x5c07e5['query']=_['keys'](_0x4e66d7[_0x7fbc('0x31')]);_0x5c07e5[_0x7fbc('0x33')]=_['intersection'](_0x5c07e5[_0x7fbc('0x30')],_0x5c07e5[_0x7fbc('0x31')]);_0x3cb9a5[_0x7fbc('0x35')]=_[_0x7fbc('0x34')](_0x5c07e5[_0x7fbc('0x30')],qs[_0x7fbc('0x36')](_0x4e66d7[_0x7fbc('0x31')]['fields']));_0x3cb9a5[_0x7fbc('0x35')]=_0x3cb9a5[_0x7fbc('0x35')][_0x7fbc('0x37')]?_0x3cb9a5['attributes']:_0x5c07e5['model'];if(_0x4e66d7[_0x7fbc('0x31')][_0x7fbc('0x43')]){_0x3cb9a5['include']=[{'all':!![]}];}_0x3cb9a5=_[_0x7fbc('0x49')]({},_0x3cb9a5,_0x4e66d7[_0x7fbc('0x41')]);return db[_0x7fbc('0x2b')]['find'](_0x3cb9a5)['then'](handleEntityNotFound(_0x1713ab,null))[_0x7fbc('0x42')](respondWithResult(_0x1713ab,null))['catch'](handleError(_0x1713ab,null));};exports['create']=function(_0x3048ae,_0x563023){return db['MailSubstatus'][_0x7fbc('0x4a')](_0x3048ae[_0x7fbc('0x4b')],{})[_0x7fbc('0x42')](respondWithResult(_0x563023,0xc9))[_0x7fbc('0x47')](handleError(_0x563023,null));};exports['update']=function(_0x3da37a,_0x2ee1e2){if(_0x3da37a[_0x7fbc('0x4b')]['id']){delete _0x3da37a[_0x7fbc('0x4b')]['id'];}return db[_0x7fbc('0x2b')][_0x7fbc('0x4c')]({'where':{'id':_0x3da37a['params']['id']}})[_0x7fbc('0x42')](handleEntityNotFound(_0x2ee1e2,null))[_0x7fbc('0x42')](saveUpdates(_0x3da37a[_0x7fbc('0x4b')],null))[_0x7fbc('0x42')](respondWithResult(_0x2ee1e2,null))[_0x7fbc('0x47')](handleError(_0x2ee1e2,null));};exports['destroy']=function(_0x407a5f,_0x22850d){return db[_0x7fbc('0x2b')][_0x7fbc('0x4c')]({'where':{'id':_0x407a5f['params']['id']}})[_0x7fbc('0x42')](handleEntityNotFound(_0x22850d,null))[_0x7fbc('0x42')](removeEntity(_0x22850d,null))[_0x7fbc('0x47')](handleError(_0x22850d,null));};exports[_0x7fbc('0x4d')]=function(_0x1229bf,_0x54587c){return db[_0x7fbc('0x2b')][_0x7fbc('0x4d')]()['then'](respondWithResult(_0x54587c,null))[_0x7fbc('0x47')](handleError(_0x54587c,null));}; \ No newline at end of file +var _0xe858=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','params','include','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../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','Content-Range','apply','reject','update','then','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query'];(function(_0x412b2a,_0x11fb8a){var _0x5872e3=function(_0x202191){while(--_0x202191){_0x412b2a['push'](_0x412b2a['shift']());}};_0x5872e3(++_0x11fb8a);}(_0xe858,0x67));var _0x8e85=function(_0x471273,_0x1587f1){_0x471273=_0x471273-0x0;var _0x56c63e=_0xe858[_0x471273];return _0x56c63e;};'use strict';var pdf=require(_0x8e85('0x0'));var emlformat=require(_0x8e85('0x1'));var rimraf=require(_0x8e85('0x2'));var zipdir=require(_0x8e85('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e85('0x4'));var moment=require(_0x8e85('0x5'));var BPromise=require(_0x8e85('0x6'));var Mustache=require(_0x8e85('0x7'));var util=require(_0x8e85('0x8'));var path=require('path');var sox=require(_0x8e85('0x9'));var csv=require(_0x8e85('0xa'));var ejs=require(_0x8e85('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8e85('0xc'));var crypto=require(_0x8e85('0xd'));var jsforce=require(_0x8e85('0xe'));var deskjs=require(_0x8e85('0xf'));var toCsv=require(_0x8e85('0xa'));var querystring=require(_0x8e85('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e85('0x11'));var qs=require(_0x8e85('0x12'));var as=require(_0x8e85('0x13'));var hardwareService=require(_0x8e85('0x14'));var logger=require(_0x8e85('0x15'))(_0x8e85('0x16'));var utils=require('../../config/utils');var config=require(_0x8e85('0x17'));var db=require(_0x8e85('0x18'))['db'];function respondWithStatusCode(_0x23e3ea,_0x4cedbd){_0x4cedbd=_0x4cedbd||0xcc;return function(_0x2e4ade){if(_0x2e4ade){return _0x23e3ea[_0x8e85('0x19')](_0x4cedbd);}return _0x23e3ea[_0x8e85('0x1a')](_0x4cedbd)[_0x8e85('0x1b')]();};}function respondWithResult(_0x13305d,_0x2228c9){_0x2228c9=_0x2228c9||0xc8;return function(_0x5b358b){if(_0x5b358b){return _0x13305d['status'](_0x2228c9)[_0x8e85('0x1c')](_0x5b358b);}};}function respondWithFilteredResult(_0x301070,_0x58d66b){return function(_0x29fc41){if(_0x29fc41){var _0x5c0249=_0x29fc41['count'],_0x6f5ea9=_0x58d66b['offset'],_0x2edc58=_0x58d66b[_0x8e85('0x1d')]+_0x58d66b[_0x8e85('0x1e')],_0x2b4cd2;if(_0x2edc58>=_0x5c0249){_0x2edc58=_0x5c0249;_0x2b4cd2=0xc8;}else{_0x2b4cd2=0xce;}_0x301070[_0x8e85('0x1a')](_0x2b4cd2);return _0x301070[_0x8e85('0x1f')](_0x8e85('0x20'),_0x6f5ea9+'-'+_0x2edc58+'/'+_0x5c0249)[_0x8e85('0x1c')](_0x29fc41);}return null;};}function patchUpdates(_0x134b57){return function(_0x19034c){try{jsonpatch[_0x8e85('0x21')](_0x19034c,_0x134b57,!![]);}catch(_0x571443){return BPromise[_0x8e85('0x22')](_0x571443);}return _0x19034c['save']();};}function saveUpdates(_0x4be4c5,_0x18fb73){return function(_0x472e2c){if(_0x472e2c){return _0x472e2c[_0x8e85('0x23')](_0x4be4c5)[_0x8e85('0x24')](function(_0x59afb7){return _0x59afb7;});}return null;};}function removeEntity(_0x42b7d6,_0x3fa6a2){return function(_0x429f6e){if(_0x429f6e){return _0x429f6e['destroy']()[_0x8e85('0x24')](function(){_0x42b7d6[_0x8e85('0x1a')](0xcc)[_0x8e85('0x1b')]();});}};}function handleEntityNotFound(_0x25e7d6,_0x34d41a){return function(_0x2ed02d){if(!_0x2ed02d){_0x25e7d6[_0x8e85('0x19')](0x194);}return _0x2ed02d;};}function handleError(_0x160b80,_0x3b92b6){_0x3b92b6=_0x3b92b6||0x1f4;return function(_0x5534fa){logger[_0x8e85('0x25')](_0x5534fa[_0x8e85('0x26')]);if(_0x5534fa[_0x8e85('0x27')]){delete _0x5534fa[_0x8e85('0x27')];}_0x160b80[_0x8e85('0x1a')](_0x3b92b6)[_0x8e85('0x28')](_0x5534fa);};}exports['index']=function(_0x2db9fb,_0x45d461){var _0x3393f0={},_0x1541ff={},_0x121f4c={'count':0x0,'rows':[]};var _0x3256fd=_[_0x8e85('0x29')](db[_0x8e85('0x2a')][_0x8e85('0x2b')],function(_0x3445b6){return{'name':_0x3445b6[_0x8e85('0x2c')],'type':_0x3445b6[_0x8e85('0x2d')][_0x8e85('0x2e')]};});_0x1541ff[_0x8e85('0x2f')]=_[_0x8e85('0x29')](_0x3256fd,_0x8e85('0x27'));_0x1541ff[_0x8e85('0x30')]=_[_0x8e85('0x31')](_0x2db9fb[_0x8e85('0x30')]);_0x1541ff[_0x8e85('0x32')]=_[_0x8e85('0x33')](_0x1541ff[_0x8e85('0x2f')],_0x1541ff[_0x8e85('0x30')]);_0x3393f0['attributes']=_['intersection'](_0x1541ff[_0x8e85('0x2f')],qs[_0x8e85('0x34')](_0x2db9fb[_0x8e85('0x30')][_0x8e85('0x34')]));_0x3393f0[_0x8e85('0x35')]=_0x3393f0[_0x8e85('0x35')][_0x8e85('0x36')]?_0x3393f0[_0x8e85('0x35')]:_0x1541ff[_0x8e85('0x2f')];if(!_0x2db9fb[_0x8e85('0x30')][_0x8e85('0x37')]('nolimit')){_0x3393f0[_0x8e85('0x1e')]=qs['limit'](_0x2db9fb[_0x8e85('0x30')][_0x8e85('0x1e')]);_0x3393f0['offset']=qs['offset'](_0x2db9fb['query'][_0x8e85('0x1d')]);}_0x3393f0[_0x8e85('0x38')]=qs[_0x8e85('0x39')](_0x2db9fb[_0x8e85('0x30')]['sort']);_0x3393f0['where']=qs[_0x8e85('0x32')](_[_0x8e85('0x3a')](_0x2db9fb[_0x8e85('0x30')],_0x1541ff['filters']),_0x3256fd);if(_0x2db9fb['query'][_0x8e85('0x3b')]){_0x3393f0[_0x8e85('0x3c')]=_[_0x8e85('0x3d')](_0x3393f0[_0x8e85('0x3c')],{'$or':_['map'](_0x3256fd,function(_0x1e076c){if(_0x1e076c[_0x8e85('0x2d')]!==_0x8e85('0x3e')){var _0x351d2a={};_0x351d2a[_0x1e076c[_0x8e85('0x27')]]={'$like':'%'+_0x2db9fb[_0x8e85('0x30')]['filter']+'%'};return _0x351d2a;}})});}_0x3393f0=_[_0x8e85('0x3d')]({},_0x3393f0,_0x2db9fb['options']);var _0x943b51={'where':_0x3393f0[_0x8e85('0x3c')]};return db[_0x8e85('0x2a')][_0x8e85('0x3f')](_0x943b51)['then'](function(_0x191881){_0x121f4c[_0x8e85('0x3f')]=_0x191881;if(_0x2db9fb['query'][_0x8e85('0x40')]){_0x3393f0['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x8e85('0x41')](_0x3393f0);})[_0x8e85('0x24')](function(_0x3bd079){_0x121f4c[_0x8e85('0x42')]=_0x3bd079;return _0x121f4c;})[_0x8e85('0x24')](respondWithFilteredResult(_0x45d461,_0x3393f0))[_0x8e85('0x43')](handleError(_0x45d461,null));};exports['show']=function(_0x9a93d2,_0x53b384){var _0x29ea3a={'raw':!![],'where':{'id':_0x9a93d2[_0x8e85('0x44')]['id']}},_0x48260f={};_0x48260f[_0x8e85('0x2f')]=_['keys'](db['MailSubstatus'][_0x8e85('0x2b')]);_0x48260f[_0x8e85('0x30')]=_[_0x8e85('0x31')](_0x9a93d2[_0x8e85('0x30')]);_0x48260f[_0x8e85('0x32')]=_[_0x8e85('0x33')](_0x48260f['model'],_0x48260f[_0x8e85('0x30')]);_0x29ea3a[_0x8e85('0x35')]=_[_0x8e85('0x33')](_0x48260f[_0x8e85('0x2f')],qs[_0x8e85('0x34')](_0x9a93d2['query'][_0x8e85('0x34')]));_0x29ea3a['attributes']=_0x29ea3a['attributes'][_0x8e85('0x36')]?_0x29ea3a[_0x8e85('0x35')]:_0x48260f['model'];if(_0x9a93d2['query']['includeAll']){_0x29ea3a[_0x8e85('0x45')]=[{'all':!![]}];}_0x29ea3a=_[_0x8e85('0x3d')]({},_0x29ea3a,_0x9a93d2[_0x8e85('0x46')]);return db[_0x8e85('0x2a')][_0x8e85('0x47')](_0x29ea3a)[_0x8e85('0x24')](handleEntityNotFound(_0x53b384,null))[_0x8e85('0x24')](respondWithResult(_0x53b384,null))[_0x8e85('0x43')](handleError(_0x53b384,null));};exports[_0x8e85('0x48')]=function(_0x1d3eb9,_0x19f965){return db[_0x8e85('0x2a')]['create'](_0x1d3eb9[_0x8e85('0x49')],{})[_0x8e85('0x24')](respondWithResult(_0x19f965,0xc9))['catch'](handleError(_0x19f965,null));};exports[_0x8e85('0x23')]=function(_0x262e1f,_0x215425){if(_0x262e1f[_0x8e85('0x49')]['id']){delete _0x262e1f['body']['id'];}return db[_0x8e85('0x2a')][_0x8e85('0x47')]({'where':{'id':_0x262e1f[_0x8e85('0x44')]['id']}})[_0x8e85('0x24')](handleEntityNotFound(_0x215425,null))['then'](saveUpdates(_0x262e1f[_0x8e85('0x49')],null))[_0x8e85('0x24')](respondWithResult(_0x215425,null))['catch'](handleError(_0x215425,null));};exports[_0x8e85('0x4a')]=function(_0xe2f9a2,_0x4f13a5){return db[_0x8e85('0x2a')][_0x8e85('0x47')]({'where':{'id':_0xe2f9a2['params']['id']}})['then'](handleEntityNotFound(_0x4f13a5,null))[_0x8e85('0x24')](removeEntity(_0x4f13a5,null))[_0x8e85('0x43')](handleError(_0x4f13a5,null));};exports[_0x8e85('0x4b')]=function(_0x2dad4b,_0x2ca769){return db['MailSubstatus'][_0x8e85('0x4b')]()[_0x8e85('0x24')](respondWithResult(_0x2ca769,null))[_0x8e85('0x43')](handleError(_0x2ca769,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 7f9e0fc..4ee9c0e 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 _0x554c=['bluebird','request-promise','rimraf','../../config/environment','exports','define','MailSubstatus','lodash','util','../../config/logger','api','moment'];(function(_0x8e5205,_0x3b63e7){var _0x2f6d68=function(_0x236cd0){while(--_0x236cd0){_0x8e5205['push'](_0x8e5205['shift']());}};_0x2f6d68(++_0x3b63e7);}(_0x554c,0x187));var _0xc554=function(_0x411f3b,_0x4444c8){_0x411f3b=_0x411f3b-0x0;var _0x31439b=_0x554c[_0x411f3b];return _0x31439b;};'use strict';var _=require(_0xc554('0x0'));var util=require(_0xc554('0x1'));var logger=require(_0xc554('0x2'))(_0xc554('0x3'));var moment=require(_0xc554('0x4'));var BPromise=require(_0xc554('0x5'));var rp=require(_0xc554('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc554('0x7'));var config=require(_0xc554('0x8'));var attributes=require('./mailSubstatus.attributes');module[_0xc554('0x9')]=function(_0x4f9912,_0x48fbb2){return _0x4f9912[_0xc554('0xa')](_0xc554('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2371=['api','moment','bluebird','request-promise','path','rimraf','exports','define','MailSubstatus','mail_substatuses','util','../../config/logger'];(function(_0x12e6e5,_0x39855b){var _0x4ef6ce=function(_0x3e06f3){while(--_0x3e06f3){_0x12e6e5['push'](_0x12e6e5['shift']());}};_0x4ef6ce(++_0x39855b);}(_0x2371,0xbe));var _0x1237=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x2371[_0x53ad58];return _0x554b03;};'use strict';var _=require('lodash');var util=require(_0x1237('0x0'));var logger=require(_0x1237('0x1'))(_0x1237('0x2'));var moment=require(_0x1237('0x3'));var BPromise=require(_0x1237('0x4'));var rp=require(_0x1237('0x5'));var fs=require('fs');var path=require(_0x1237('0x6'));var rimraf=require(_0x1237('0x7'));var config=require('../../config/environment');var attributes=require('./mailSubstatus.attributes');module[_0x1237('0x8')]=function(_0x52f92a,_0x564d36){return _0x52f92a[_0x1237('0x9')](_0x1237('0xa'),attributes,{'tableName':_0x1237('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 25c66a4..aaa5447 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 _0x5ff3=['message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','MailSubstatus,\x20%s,\x20%s'];(function(_0x3d452c,_0x303cb5){var _0x427c44=function(_0x8d57a1){while(--_0x8d57a1){_0x3d452c['push'](_0x3d452c['shift']());}};_0x427c44(++_0x303cb5);}(_0x5ff3,0x17d));var _0x35ff=function(_0xbfe0b,_0x604816){_0xbfe0b=_0xbfe0b-0x0;var _0x4a82db=_0x5ff3[_0xbfe0b];return _0x4a82db;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xdace,0xc5));var _0xedac=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xdace[_0x386c3e];return _0x4b8e13;};'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']('MailSubstatus,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 88c5338..463effd 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 _0xe601=['delete','/:id','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','put','update'];(function(_0x28b2a2,_0x557398){var _0x51483c=function(_0x5c7cd9){while(--_0x5c7cd9){_0x28b2a2['push'](_0x28b2a2['shift']());}};_0x51483c(++_0x557398);}(_0xe601,0x168));var _0x1e60=function(_0x25ae1c,_0x516dfc){_0x25ae1c=_0x25ae1c-0x0;var _0x11af93=_0xe601[_0x25ae1c];return _0x11af93;};'use strict';var multer=require(_0x1e60('0x0'));var util=require(_0x1e60('0x1'));var path=require(_0x1e60('0x2'));var timeout=require(_0x1e60('0x3'));var express=require(_0x1e60('0x4'));var router=express['Router']();var auth=require(_0x1e60('0x5'));var interaction=require(_0x1e60('0x6'));var config=require('../../config/environment');var controller=require(_0x1e60('0x7'));router[_0x1e60('0x8')]('/',auth[_0x1e60('0x9')](),controller[_0x1e60('0xa')]);router[_0x1e60('0x8')](_0x1e60('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x1e60('0x8')]('/:id',auth[_0x1e60('0x9')](),controller['show']);router['post']('/',auth[_0x1e60('0x9')](),controller['create']);router[_0x1e60('0xc')]('/:id',auth[_0x1e60('0x9')](),controller[_0x1e60('0xd')]);router[_0x1e60('0xe')](_0x1e60('0xf'),auth[_0x1e60('0x9')](),controller[_0x1e60('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0d18=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x12efa0,_0x579590){var _0x158c02=function(_0x311422){while(--_0x311422){_0x12efa0['push'](_0x12efa0['shift']());}};_0x158c02(++_0x579590);}(_0x0d18,0x1b9));var _0x80d1=function(_0x385682,_0x2bf424){_0x385682=_0x385682-0x0;var _0x47d269=_0x0d18[_0x385682];return _0x47d269;};'use strict';var multer=require(_0x80d1('0x0'));var util=require(_0x80d1('0x1'));var path=require(_0x80d1('0x2'));var timeout=require(_0x80d1('0x3'));var express=require(_0x80d1('0x4'));var router=express['Router']();var auth=require(_0x80d1('0x5'));var interaction=require(_0x80d1('0x6'));var config=require('../../config/environment');var controller=require(_0x80d1('0x7'));router[_0x80d1('0x8')]('/',auth[_0x80d1('0x9')](),controller[_0x80d1('0xa')]);router['get']('/describe',auth[_0x80d1('0x9')](),controller[_0x80d1('0xb')]);router['get'](_0x80d1('0xc'),auth[_0x80d1('0x9')](),controller[_0x80d1('0xd')]);router[_0x80d1('0xe')]('/',auth[_0x80d1('0x9')](),controller[_0x80d1('0xf')]);router[_0x80d1('0x10')]('/:id',auth[_0x80d1('0x9')](),controller[_0x80d1('0x11')]);router[_0x80d1('0x12')](_0x80d1('0xc'),auth[_0x80d1('0x9')](),controller[_0x80d1('0x13')]);module[_0x80d1('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index ec51877..9f32cb9 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 _0x4eee=['moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x35160c,_0x3c16a4){var _0x21feb2=function(_0x1efda3){while(--_0x1efda3){_0x35160c['push'](_0x35160c['shift']());}};_0x21feb2(++_0x3c16a4);}(_0x4eee,0x154));var _0xe4ee=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x4eee[_0x56138f];return _0x1acaf7;};'use strict';var moment=require(_0xe4ee('0x0'));var Sequelize=require(_0xe4ee('0x1'));module[_0xe4ee('0x2')]={'uniqueid':{'type':Sequelize[_0xe4ee('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe4ee('0x4')](_0xe4ee('0x5'),_0xe4ee('0x6'),_0xe4ee('0x7')),'allowNull':![],'defaultValue':_0xe4ee('0x7')},'transferredAt':{'type':Sequelize[_0xe4ee('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xe4ee('0x9')]}}; \ No newline at end of file +var _0x3eb9=['account','agent','queue','DATE','NOW','moment','STRING','ENUM'];(function(_0x271bfe,_0x10af9e){var _0x10e3dd=function(_0x3d1ddb){while(--_0x3d1ddb){_0x271bfe['push'](_0x271bfe['shift']());}};_0x10e3dd(++_0x10af9e);}(_0x3eb9,0x8d));var _0x93eb=function(_0x23f0e1,_0x11d94b){_0x23f0e1=_0x23f0e1-0x0;var _0x257f0d=_0x3eb9[_0x23f0e1];return _0x257f0d;};'use strict';var moment=require(_0x93eb('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x93eb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x93eb('0x2')](_0x93eb('0x3'),_0x93eb('0x4'),_0x93eb('0x5')),'allowNull':![],'defaultValue':_0x93eb('0x5')},'transferredAt':{'type':Sequelize[_0x93eb('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x93eb('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 173f9b3..c9c8a9a 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 _0x80bc=['count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','MailTransferReport','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json'];(function(_0x314b71,_0x27ce15){var _0x268c23=function(_0x2662bd){while(--_0x2662bd){_0x314b71['push'](_0x314b71['shift']());}};_0x268c23(++_0x27ce15);}(_0x80bc,0x75));var _0xc80b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x80bc[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc80b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc80b('0x1'));var jsonpatch=require(_0xc80b('0x2'));var rp=require(_0xc80b('0x3'));var moment=require('moment');var BPromise=require(_0xc80b('0x4'));var Mustache=require(_0xc80b('0x5'));var util=require(_0xc80b('0x6'));var path=require('path');var sox=require(_0xc80b('0x7'));var csv=require(_0xc80b('0x8'));var ejs=require(_0xc80b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc80b('0xa'));var crypto=require(_0xc80b('0xb'));var jsforce=require(_0xc80b('0xc'));var deskjs=require(_0xc80b('0xd'));var toCsv=require(_0xc80b('0x8'));var querystring=require(_0xc80b('0xe'));var Papa=require(_0xc80b('0xf'));var Redis=require(_0xc80b('0x10'));var authService=require(_0xc80b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc80b('0x12'));var hardwareService=require(_0xc80b('0x13'));var logger=require(_0xc80b('0x14'))('api');var utils=require(_0xc80b('0x15'));var config=require(_0xc80b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fe36e,_0x1575b5){_0x1575b5=_0x1575b5||0xcc;return function(_0x11d566){if(_0x11d566){return _0x1fe36e[_0xc80b('0x17')](_0x1575b5);}return _0x1fe36e[_0xc80b('0x18')](_0x1575b5)[_0xc80b('0x19')]();};}function respondWithResult(_0x534de0,_0x501bf1){_0x501bf1=_0x501bf1||0xc8;return function(_0x1a9bd2){if(_0x1a9bd2){return _0x534de0[_0xc80b('0x18')](_0x501bf1)[_0xc80b('0x1a')](_0x1a9bd2);}};}function respondWithFilteredResult(_0x3e1cd1,_0x1f3a04){return function(_0x57a18e){if(_0x57a18e){var _0x541357=_0x57a18e[_0xc80b('0x1b')],_0x5ba5fa=_0x1f3a04['offset'],_0x3e9141=_0x1f3a04[_0xc80b('0x1c')]+_0x1f3a04[_0xc80b('0x1d')],_0x4bdc9c;if(_0x3e9141>=_0x541357){_0x3e9141=_0x541357;_0x4bdc9c=0xc8;}else{_0x4bdc9c=0xce;}_0x3e1cd1[_0xc80b('0x18')](_0x4bdc9c);return _0x3e1cd1[_0xc80b('0x1e')]('Content-Range',_0x5ba5fa+'-'+_0x3e9141+'/'+_0x541357)[_0xc80b('0x1a')](_0x57a18e);}return null;};}function patchUpdates(_0x1add62){return function(_0x517ddc){try{jsonpatch[_0xc80b('0x1f')](_0x517ddc,_0x1add62,!![]);}catch(_0xecdca6){return BPromise[_0xc80b('0x20')](_0xecdca6);}return _0x517ddc[_0xc80b('0x21')]();};}function saveUpdates(_0x458798,_0x3cbf32){return function(_0x415265){if(_0x415265){return _0x415265[_0xc80b('0x22')](_0x458798)[_0xc80b('0x23')](function(_0x334a55){return _0x334a55;});}return null;};}function removeEntity(_0x5c048e,_0x10832a){return function(_0x13767e){if(_0x13767e){return _0x13767e[_0xc80b('0x24')]()['then'](function(){_0x5c048e[_0xc80b('0x18')](0xcc)[_0xc80b('0x19')]();});}};}function handleEntityNotFound(_0x1a9191,_0x255fb3){return function(_0x50c5a8){if(!_0x50c5a8){_0x1a9191[_0xc80b('0x17')](0x194);}return _0x50c5a8;};}function handleError(_0x2b84f8,_0x246209){_0x246209=_0x246209||0x1f4;return function(_0x506fa9){logger[_0xc80b('0x25')](_0x506fa9[_0xc80b('0x26')]);if(_0x506fa9['name']){delete _0x506fa9[_0xc80b('0x27')];}_0x2b84f8[_0xc80b('0x18')](_0x246209)['send'](_0x506fa9);};}exports[_0xc80b('0x28')]=function(_0x596475,_0x243625){var _0x40a17f={},_0x43eef2={},_0x33c843={'count':0x0,'rows':[]};var _0x1fdb49=_[_0xc80b('0x29')](db[_0xc80b('0x2a')]['rawAttributes'],function(_0x488ed1){return{'name':_0x488ed1[_0xc80b('0x2b')],'type':_0x488ed1[_0xc80b('0x2c')]['key']};});_0x43eef2[_0xc80b('0x2d')]=_[_0xc80b('0x29')](_0x1fdb49,_0xc80b('0x27'));_0x43eef2[_0xc80b('0x2e')]=_[_0xc80b('0x2f')](_0x596475[_0xc80b('0x2e')]);_0x43eef2[_0xc80b('0x30')]=_['intersection'](_0x43eef2[_0xc80b('0x2d')],_0x43eef2['query']);_0x40a17f[_0xc80b('0x31')]=_[_0xc80b('0x32')](_0x43eef2[_0xc80b('0x2d')],qs[_0xc80b('0x33')](_0x596475[_0xc80b('0x2e')][_0xc80b('0x33')]));_0x40a17f[_0xc80b('0x31')]=_0x40a17f[_0xc80b('0x31')][_0xc80b('0x34')]?_0x40a17f[_0xc80b('0x31')]:_0x43eef2[_0xc80b('0x2d')];if(!_0x596475[_0xc80b('0x2e')][_0xc80b('0x35')](_0xc80b('0x36'))){_0x40a17f['limit']=qs['limit'](_0x596475[_0xc80b('0x2e')][_0xc80b('0x1d')]);_0x40a17f[_0xc80b('0x1c')]=qs[_0xc80b('0x1c')](_0x596475[_0xc80b('0x2e')][_0xc80b('0x1c')]);}_0x40a17f[_0xc80b('0x37')]=qs[_0xc80b('0x38')](_0x596475[_0xc80b('0x2e')][_0xc80b('0x38')]);_0x40a17f[_0xc80b('0x39')]=qs[_0xc80b('0x30')](_[_0xc80b('0x3a')](_0x596475[_0xc80b('0x2e')],_0x43eef2[_0xc80b('0x30')]),_0x1fdb49);if(_0x596475[_0xc80b('0x2e')][_0xc80b('0x3b')]){_0x40a17f[_0xc80b('0x39')]=_[_0xc80b('0x3c')](_0x40a17f[_0xc80b('0x39')],{'$or':_[_0xc80b('0x29')](_0x1fdb49,function(_0x2fad11){if(_0x2fad11[_0xc80b('0x2c')]!=='VIRTUAL'){var _0x3b465e={};_0x3b465e[_0x2fad11[_0xc80b('0x27')]]={'$like':'%'+_0x596475[_0xc80b('0x2e')]['filter']+'%'};return _0x3b465e;}})});}_0x40a17f=_['merge']({},_0x40a17f,_0x596475[_0xc80b('0x3d')]);var _0x155f2e={'where':_0x40a17f[_0xc80b('0x39')]};return db[_0xc80b('0x2a')]['count'](_0x155f2e)[_0xc80b('0x23')](function(_0x338baf){_0x33c843[_0xc80b('0x1b')]=_0x338baf;if(_0x596475[_0xc80b('0x2e')]['includeAll']){_0x40a17f['include']=[{'all':!![]}];}return db[_0xc80b('0x2a')]['findAll'](_0x40a17f);})[_0xc80b('0x23')](function(_0x1dfc7f){_0x33c843[_0xc80b('0x3e')]=_0x1dfc7f;return _0x33c843;})[_0xc80b('0x23')](respondWithFilteredResult(_0x243625,_0x40a17f))[_0xc80b('0x3f')](handleError(_0x243625,null));};exports[_0xc80b('0x40')]=function(_0x1b0e0d,_0x5df317){var _0x3832b3={'raw':!![],'where':{'id':_0x1b0e0d[_0xc80b('0x41')]['id']}},_0x4b21ee={};_0x4b21ee['model']=_['keys'](db[_0xc80b('0x2a')][_0xc80b('0x42')]);_0x4b21ee[_0xc80b('0x2e')]=_['keys'](_0x1b0e0d[_0xc80b('0x2e')]);_0x4b21ee[_0xc80b('0x30')]=_['intersection'](_0x4b21ee[_0xc80b('0x2d')],_0x4b21ee['query']);_0x3832b3[_0xc80b('0x31')]=_[_0xc80b('0x32')](_0x4b21ee[_0xc80b('0x2d')],qs['fields'](_0x1b0e0d[_0xc80b('0x2e')][_0xc80b('0x33')]));_0x3832b3[_0xc80b('0x31')]=_0x3832b3['attributes'][_0xc80b('0x34')]?_0x3832b3[_0xc80b('0x31')]:_0x4b21ee[_0xc80b('0x2d')];if(_0x1b0e0d[_0xc80b('0x2e')]['includeAll']){_0x3832b3[_0xc80b('0x43')]=[{'all':!![]}];}_0x3832b3=_[_0xc80b('0x3c')]({},_0x3832b3,_0x1b0e0d[_0xc80b('0x3d')]);return db[_0xc80b('0x2a')][_0xc80b('0x44')](_0x3832b3)[_0xc80b('0x23')](handleEntityNotFound(_0x5df317,null))[_0xc80b('0x23')](respondWithResult(_0x5df317,null))[_0xc80b('0x3f')](handleError(_0x5df317,null));};exports[_0xc80b('0x45')]=function(_0x437115,_0x3a2cea){return db[_0xc80b('0x2a')]['create'](_0x437115[_0xc80b('0x46')],{})[_0xc80b('0x23')](respondWithResult(_0x3a2cea,0xc9))['catch'](handleError(_0x3a2cea,null));};exports['update']=function(_0x3488a7,_0x37556f){if(_0x3488a7[_0xc80b('0x46')]['id']){delete _0x3488a7['body']['id'];}return db[_0xc80b('0x2a')][_0xc80b('0x44')]({'where':{'id':_0x3488a7[_0xc80b('0x41')]['id']}})[_0xc80b('0x23')](handleEntityNotFound(_0x37556f,null))[_0xc80b('0x23')](saveUpdates(_0x3488a7[_0xc80b('0x46')],null))[_0xc80b('0x23')](respondWithResult(_0x37556f,null))[_0xc80b('0x3f')](handleError(_0x37556f,null));};exports[_0xc80b('0x24')]=function(_0x2e8bb4,_0x9dce6d){return db['MailTransferReport'][_0xc80b('0x44')]({'where':{'id':_0x2e8bb4[_0xc80b('0x41')]['id']}})[_0xc80b('0x23')](handleEntityNotFound(_0x9dce6d,null))[_0xc80b('0x23')](removeEntity(_0x9dce6d,null))[_0xc80b('0x3f')](handleError(_0x9dce6d,null));};exports[_0xc80b('0x47')]=function(_0x1b96a0,_0x26f85f){return db['MailTransferReport'][_0xc80b('0x47')]()[_0xc80b('0x23')](respondWithResult(_0x26f85f,null))[_0xc80b('0x3f')](handleError(_0x26f85f,null));}; \ No newline at end of file +var _0x6ed9=['sendStatus','end','status','count','offset','set','json','reject','update','destroy','then','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x163bd0,_0x596777){var _0x8a7a6a=function(_0x2c6c26){while(--_0x2c6c26){_0x163bd0['push'](_0x163bd0['shift']());}};_0x8a7a6a(++_0x596777);}(_0x6ed9,0x1a4));var _0x96ed=function(_0x42facc,_0x1eb3ff){_0x42facc=_0x42facc-0x0;var _0x1224ad=_0x6ed9[_0x42facc];return _0x1224ad;};'use strict';var pdf=require(_0x96ed('0x0'));var emlformat=require(_0x96ed('0x1'));var rimraf=require(_0x96ed('0x2'));var zipdir=require(_0x96ed('0x3'));var jsonpatch=require(_0x96ed('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x96ed('0x5'));var Mustache=require(_0x96ed('0x6'));var util=require(_0x96ed('0x7'));var path=require('path');var sox=require(_0x96ed('0x8'));var csv=require(_0x96ed('0x9'));var ejs=require(_0x96ed('0xa'));var fs=require('fs');var _=require(_0x96ed('0xb'));var squel=require(_0x96ed('0xc'));var crypto=require('crypto');var jsforce=require(_0x96ed('0xd'));var deskjs=require(_0x96ed('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x96ed('0xf'));var Redis=require('ioredis');var authService=require(_0x96ed('0x10'));var qs=require(_0x96ed('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96ed('0x12'));var logger=require(_0x96ed('0x13'))(_0x96ed('0x14'));var utils=require(_0x96ed('0x15'));var config=require(_0x96ed('0x16'));var db=require(_0x96ed('0x17'))['db'];function respondWithStatusCode(_0x410237,_0x21199e){_0x21199e=_0x21199e||0xcc;return function(_0x2ed5c7){if(_0x2ed5c7){return _0x410237[_0x96ed('0x18')](_0x21199e);}return _0x410237['status'](_0x21199e)[_0x96ed('0x19')]();};}function respondWithResult(_0x1f5689,_0x5d3319){_0x5d3319=_0x5d3319||0xc8;return function(_0x174753){if(_0x174753){return _0x1f5689[_0x96ed('0x1a')](_0x5d3319)['json'](_0x174753);}};}function respondWithFilteredResult(_0x1e5ea9,_0x10724f){return function(_0x18d82d){if(_0x18d82d){var _0x239b4e=_0x18d82d[_0x96ed('0x1b')],_0x56c442=_0x10724f['offset'],_0x4d18be=_0x10724f[_0x96ed('0x1c')]+_0x10724f['limit'],_0x28787e;if(_0x4d18be>=_0x239b4e){_0x4d18be=_0x239b4e;_0x28787e=0xc8;}else{_0x28787e=0xce;}_0x1e5ea9[_0x96ed('0x1a')](_0x28787e);return _0x1e5ea9[_0x96ed('0x1d')]('Content-Range',_0x56c442+'-'+_0x4d18be+'/'+_0x239b4e)[_0x96ed('0x1e')](_0x18d82d);}return null;};}function patchUpdates(_0xc6e8dd){return function(_0x463610){try{jsonpatch['apply'](_0x463610,_0xc6e8dd,!![]);}catch(_0x455934){return BPromise[_0x96ed('0x1f')](_0x455934);}return _0x463610['save']();};}function saveUpdates(_0x1e20d0,_0x52ffc4){return function(_0x56a0e7){if(_0x56a0e7){return _0x56a0e7[_0x96ed('0x20')](_0x1e20d0)['then'](function(_0x33da7e){return _0x33da7e;});}return null;};}function removeEntity(_0x34d8f3,_0x3ad296){return function(_0x160e43){if(_0x160e43){return _0x160e43[_0x96ed('0x21')]()[_0x96ed('0x22')](function(){_0x34d8f3[_0x96ed('0x1a')](0xcc)[_0x96ed('0x19')]();});}};}function handleEntityNotFound(_0x59f4a0,_0x4f744f){return function(_0x14eba4){if(!_0x14eba4){_0x59f4a0['sendStatus'](0x194);}return _0x14eba4;};}function handleError(_0x51fa8d,_0x113ffa){_0x113ffa=_0x113ffa||0x1f4;return function(_0x3df4a0){logger[_0x96ed('0x23')](_0x3df4a0[_0x96ed('0x24')]);if(_0x3df4a0[_0x96ed('0x25')]){delete _0x3df4a0[_0x96ed('0x25')];}_0x51fa8d[_0x96ed('0x1a')](_0x113ffa)[_0x96ed('0x26')](_0x3df4a0);};}exports[_0x96ed('0x27')]=function(_0x175661,_0x4a1b64){var _0x54b818={},_0x5cf5de={},_0x10e3a5={'count':0x0,'rows':[]};var _0x2ce141=_['map'](db[_0x96ed('0x28')][_0x96ed('0x29')],function(_0x4b11f1){return{'name':_0x4b11f1[_0x96ed('0x2a')],'type':_0x4b11f1[_0x96ed('0x2b')][_0x96ed('0x2c')]};});_0x5cf5de[_0x96ed('0x2d')]=_[_0x96ed('0x2e')](_0x2ce141,_0x96ed('0x25'));_0x5cf5de['query']=_[_0x96ed('0x2f')](_0x175661[_0x96ed('0x30')]);_0x5cf5de['filters']=_[_0x96ed('0x31')](_0x5cf5de[_0x96ed('0x2d')],_0x5cf5de['query']);_0x54b818[_0x96ed('0x32')]=_[_0x96ed('0x31')](_0x5cf5de[_0x96ed('0x2d')],qs[_0x96ed('0x33')](_0x175661[_0x96ed('0x30')][_0x96ed('0x33')]));_0x54b818['attributes']=_0x54b818[_0x96ed('0x32')][_0x96ed('0x34')]?_0x54b818[_0x96ed('0x32')]:_0x5cf5de['model'];if(!_0x175661[_0x96ed('0x30')][_0x96ed('0x35')]('nolimit')){_0x54b818[_0x96ed('0x36')]=qs[_0x96ed('0x36')](_0x175661['query'][_0x96ed('0x36')]);_0x54b818[_0x96ed('0x1c')]=qs[_0x96ed('0x1c')](_0x175661[_0x96ed('0x30')][_0x96ed('0x1c')]);}_0x54b818[_0x96ed('0x37')]=qs['sort'](_0x175661[_0x96ed('0x30')][_0x96ed('0x38')]);_0x54b818[_0x96ed('0x39')]=qs[_0x96ed('0x3a')](_['pick'](_0x175661[_0x96ed('0x30')],_0x5cf5de[_0x96ed('0x3a')]),_0x2ce141);if(_0x175661[_0x96ed('0x30')][_0x96ed('0x3b')]){_0x54b818['where']=_[_0x96ed('0x3c')](_0x54b818['where'],{'$or':_[_0x96ed('0x2e')](_0x2ce141,function(_0x2c98ca){if(_0x2c98ca['type']!==_0x96ed('0x3d')){var _0x10167e={};_0x10167e[_0x2c98ca[_0x96ed('0x25')]]={'$like':'%'+_0x175661[_0x96ed('0x30')][_0x96ed('0x3b')]+'%'};return _0x10167e;}})});}_0x54b818=_['merge']({},_0x54b818,_0x175661[_0x96ed('0x3e')]);var _0x5a4502={'where':_0x54b818[_0x96ed('0x39')]};return db[_0x96ed('0x28')][_0x96ed('0x1b')](_0x5a4502)[_0x96ed('0x22')](function(_0x242a03){_0x10e3a5['count']=_0x242a03;if(_0x175661[_0x96ed('0x30')][_0x96ed('0x3f')]){_0x54b818[_0x96ed('0x40')]=[{'all':!![]}];}return db[_0x96ed('0x28')][_0x96ed('0x41')](_0x54b818);})[_0x96ed('0x22')](function(_0x3a3966){_0x10e3a5[_0x96ed('0x42')]=_0x3a3966;return _0x10e3a5;})['then'](respondWithFilteredResult(_0x4a1b64,_0x54b818))[_0x96ed('0x43')](handleError(_0x4a1b64,null));};exports[_0x96ed('0x44')]=function(_0x1ef2fe,_0x5de691){var _0x584a71={'raw':!![],'where':{'id':_0x1ef2fe[_0x96ed('0x45')]['id']}},_0xa84fa7={};_0xa84fa7['model']=_[_0x96ed('0x2f')](db[_0x96ed('0x28')][_0x96ed('0x29')]);_0xa84fa7['query']=_[_0x96ed('0x2f')](_0x1ef2fe[_0x96ed('0x30')]);_0xa84fa7[_0x96ed('0x3a')]=_[_0x96ed('0x31')](_0xa84fa7[_0x96ed('0x2d')],_0xa84fa7[_0x96ed('0x30')]);_0x584a71[_0x96ed('0x32')]=_[_0x96ed('0x31')](_0xa84fa7[_0x96ed('0x2d')],qs[_0x96ed('0x33')](_0x1ef2fe[_0x96ed('0x30')]['fields']));_0x584a71[_0x96ed('0x32')]=_0x584a71[_0x96ed('0x32')][_0x96ed('0x34')]?_0x584a71[_0x96ed('0x32')]:_0xa84fa7[_0x96ed('0x2d')];if(_0x1ef2fe[_0x96ed('0x30')]['includeAll']){_0x584a71[_0x96ed('0x40')]=[{'all':!![]}];}_0x584a71=_['merge']({},_0x584a71,_0x1ef2fe[_0x96ed('0x3e')]);return db[_0x96ed('0x28')][_0x96ed('0x46')](_0x584a71)[_0x96ed('0x22')](handleEntityNotFound(_0x5de691,null))[_0x96ed('0x22')](respondWithResult(_0x5de691,null))[_0x96ed('0x43')](handleError(_0x5de691,null));};exports[_0x96ed('0x47')]=function(_0x3754ba,_0x31ddd5){return db[_0x96ed('0x28')][_0x96ed('0x47')](_0x3754ba[_0x96ed('0x48')],{})[_0x96ed('0x22')](respondWithResult(_0x31ddd5,0xc9))['catch'](handleError(_0x31ddd5,null));};exports[_0x96ed('0x20')]=function(_0x34f108,_0x22e23c){if(_0x34f108['body']['id']){delete _0x34f108[_0x96ed('0x48')]['id'];}return db[_0x96ed('0x28')]['find']({'where':{'id':_0x34f108[_0x96ed('0x45')]['id']}})[_0x96ed('0x22')](handleEntityNotFound(_0x22e23c,null))[_0x96ed('0x22')](saveUpdates(_0x34f108[_0x96ed('0x48')],null))[_0x96ed('0x22')](respondWithResult(_0x22e23c,null))[_0x96ed('0x43')](handleError(_0x22e23c,null));};exports[_0x96ed('0x21')]=function(_0x316804,_0x3d7f7a){return db['MailTransferReport'][_0x96ed('0x46')]({'where':{'id':_0x316804['params']['id']}})[_0x96ed('0x22')](handleEntityNotFound(_0x3d7f7a,null))[_0x96ed('0x22')](removeEntity(_0x3d7f7a,null))[_0x96ed('0x43')](handleError(_0x3d7f7a,null));};exports[_0x96ed('0x49')]=function(_0x23471e,_0x9f8486){return db['MailTransferReport'][_0x96ed('0x49')]()['then'](respondWithResult(_0x9f8486,null))['catch'](handleError(_0x9f8486,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 3183a1d..77be83b 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 _0xf0a5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x4659a8,_0x4f69b8){var _0xb1b3f0=function(_0x4401cd){while(--_0x4401cd){_0x4659a8['push'](_0x4659a8['shift']());}};_0xb1b3f0(++_0x4f69b8);}(_0xf0a5,0x1eb));var _0x5f0a=function(_0x341a15,_0xaa08f7){_0x341a15=_0x341a15-0x0;var _0x5d1bd0=_0xf0a5[_0x341a15];return _0x5d1bd0;};'use strict';var _=require(_0x5f0a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f0a('0x1'));var moment=require(_0x5f0a('0x2'));var BPromise=require(_0x5f0a('0x3'));var rp=require(_0x5f0a('0x4'));var fs=require('fs');var path=require(_0x5f0a('0x5'));var rimraf=require(_0x5f0a('0x6'));var config=require(_0x5f0a('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x5f0a('0x8')]=function(_0x5796de,_0xcdd9bf){return _0x5796de['define'](_0x5f0a('0x9'),attributes,{'tableName':_0x5f0a('0xa'),'paranoid':![],'indexes':[{'name':_0x5f0a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xed02=['api','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2b5553,_0x3c2161){var _0x52b730=function(_0x6844b2){while(--_0x6844b2){_0x2b5553['push'](_0x2b5553['shift']());}};_0x52b730(++_0x3c2161);}(_0xed02,0x97));var _0x2ed0=function(_0x37edd2,_0x470d4e){_0x37edd2=_0x37edd2-0x0;var _0x2b00ef=_0xed02[_0x37edd2];return _0x2b00ef;};'use strict';var _=require(_0x2ed0('0x0'));var util=require(_0x2ed0('0x1'));var logger=require(_0x2ed0('0x2'))(_0x2ed0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ed0('0x4'));var fs=require('fs');var path=require(_0x2ed0('0x5'));var rimraf=require(_0x2ed0('0x6'));var config=require(_0x2ed0('0x7'));var attributes=require(_0x2ed0('0x8'));module[_0x2ed0('0x9')]=function(_0x24799c,_0x34bf56){return _0x24799c[_0x2ed0('0xa')](_0x2ed0('0xb'),attributes,{'tableName':_0x2ed0('0xc'),'paranoid':![],'indexes':[{'name':_0x2ed0('0xd'),'fields':[_0x2ed0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index d9ab87f..1859cd4 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 _0xf679=['then','info','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xf679,0xa4));var _0x9f67=function(_0x4c77b7,_0x36c5dc){_0x4c77b7=_0x4c77b7-0x0;var _0x52bdd7=_0xf679[_0x4c77b7];return _0x52bdd7;};'use strict';var _=require(_0x9f67('0x0'));var util=require(_0x9f67('0x1'));var moment=require(_0x9f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f67('0x3'));var fs=require('fs');var Redis=require(_0x9f67('0x4'));var db=require(_0x9f67('0x5'))['db'];var utils=require(_0x9f67('0x6'));var logger=require(_0x9f67('0x7'))(_0x9f67('0x8'));var config=require(_0x9f67('0x9'));var jayson=require(_0x9f67('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fdc37,_0x14f394,_0x5f461c){return new BPromise(function(_0x50b4cb,_0x488da4){return client[_0x9f67('0xb')](_0x1fdc37,_0x5f461c)[_0x9f67('0xc')](function(_0x9edd11){logger[_0x9f67('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x14f394,'request\x20sent');logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x14f394,_0x9f67('0xe'),JSON[_0x9f67('0xf')](_0x9edd11));if(_0x9edd11['error']){if(_0x9edd11[_0x9f67('0x10')][_0x9f67('0x11')]===0x1f4){logger[_0x9f67('0x10')](_0x9f67('0x12'),_0x14f394,_0x9edd11[_0x9f67('0x10')][_0x9f67('0x13')]);return _0x488da4(_0x9edd11[_0x9f67('0x10')][_0x9f67('0x13')]);}logger['error'](_0x9f67('0x12'),_0x14f394,_0x9edd11['error']['message']);return _0x50b4cb(_0x9edd11[_0x9f67('0x10')][_0x9f67('0x13')]);}else{logger[_0x9f67('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x14f394,_0x9f67('0xe'));_0x50b4cb(_0x9edd11[_0x9f67('0x14')]['message']);}})[_0x9f67('0x15')](function(_0x20361c){logger['error'](_0x9f67('0x12'),_0x14f394,_0x20361c);_0x488da4(_0x20361c);});});} \ No newline at end of file +var _0xa82d=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','util'];(function(_0x5c1920,_0xa5ce78){var _0x2c13d9=function(_0x3a14c6){while(--_0x3a14c6){_0x5c1920['push'](_0x5c1920['shift']());}};_0x2c13d9(++_0xa5ce78);}(_0xa82d,0x1b6));var _0xda82=function(_0x224ba0,_0x17cdbd){_0x224ba0=_0x224ba0-0x0;var _0x54c899=_0xa82d[_0x224ba0];return _0x54c899;};'use strict';var _=require(_0xda82('0x0'));var util=require(_0xda82('0x1'));var moment=require('moment');var BPromise=require(_0xda82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda82('0x3'));var db=require(_0xda82('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xda82('0x5'))('rpc');var config=require(_0xda82('0x6'));var jayson=require(_0xda82('0x7'));var client=jayson[_0xda82('0x8')][_0xda82('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a295,_0x37e3d0,_0x102530){return new BPromise(function(_0x145738,_0x2ba2fe){return client[_0xda82('0xa')](_0x57a295,_0x102530)['then'](function(_0x22dc3c){logger[_0xda82('0xb')](_0xda82('0xc'),_0x37e3d0,_0xda82('0xd'));logger[_0xda82('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x37e3d0,'request\x20sent',JSON['stringify'](_0x22dc3c));if(_0x22dc3c['error']){if(_0x22dc3c['error'][_0xda82('0xf')]===0x1f4){logger[_0xda82('0x10')](_0xda82('0xc'),_0x37e3d0,_0x22dc3c[_0xda82('0x10')]['message']);return _0x2ba2fe(_0x22dc3c[_0xda82('0x10')]['message']);}logger['error'](_0xda82('0xc'),_0x37e3d0,_0x22dc3c[_0xda82('0x10')]['message']);return _0x145738(_0x22dc3c[_0xda82('0x10')][_0xda82('0x11')]);}else{logger[_0xda82('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x37e3d0,_0xda82('0xd'));_0x145738(_0x22dc3c[_0xda82('0x12')]['message']);}})[_0xda82('0x13')](function(_0x10c832){logger[_0xda82('0x10')](_0xda82('0xc'),_0x37e3d0,_0x10c832);_0x2ba2fe(_0x10c832);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index facdb47..7ee951e 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 _0x5e28=['isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','get','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e28,0x1d2));var _0x85e2=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0x5e28[_0x3dea7d];return _0x53919a;};'use strict';var multer=require('multer');var util=require(_0x85e2('0x0'));var path=require(_0x85e2('0x1'));var timeout=require(_0x85e2('0x2'));var express=require(_0x85e2('0x3'));var router=express[_0x85e2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x85e2('0x5'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x85e2('0x6')]('/',auth['isAuthenticated'](),controller[_0x85e2('0x7')]);router[_0x85e2('0x6')](_0x85e2('0x8'),auth[_0x85e2('0x9')](),controller[_0x85e2('0xa')]);router[_0x85e2('0x6')]('/:id',auth[_0x85e2('0x9')](),controller['show']);router[_0x85e2('0xb')]('/',auth[_0x85e2('0x9')](),controller[_0x85e2('0xc')]);router[_0x85e2('0xd')](_0x85e2('0xe'),auth[_0x85e2('0x9')](),controller[_0x85e2('0xf')]);router[_0x85e2('0x10')]('/:id',auth[_0x85e2('0x9')](),controller[_0x85e2('0x11')]);module[_0x85e2('0x12')]=router; \ No newline at end of file +var _0xb418=['get','isAuthenticated','/describe','describe','/:id','show','post','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller'];(function(_0x655946,_0x575a36){var _0x16ad9c=function(_0x126714){while(--_0x126714){_0x655946['push'](_0x655946['shift']());}};_0x16ad9c(++_0x575a36);}(_0xb418,0xa1));var _0x8b41=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xb418[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require(_0x8b41('0x0'));var util=require(_0x8b41('0x1'));var path=require(_0x8b41('0x2'));var timeout=require(_0x8b41('0x3'));var express=require(_0x8b41('0x4'));var router=express[_0x8b41('0x5')]();var auth=require(_0x8b41('0x6'));var interaction=require(_0x8b41('0x7'));var config=require('../../config/environment');var controller=require(_0x8b41('0x8'));router[_0x8b41('0x9')]('/',auth[_0x8b41('0xa')](),controller['index']);router['get'](_0x8b41('0xb'),auth[_0x8b41('0xa')](),controller[_0x8b41('0xc')]);router[_0x8b41('0x9')](_0x8b41('0xd'),auth[_0x8b41('0xa')](),controller[_0x8b41('0xe')]);router[_0x8b41('0xf')]('/',auth[_0x8b41('0xa')](),controller['create']);router['put'](_0x8b41('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8b41('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x8b41('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 500be48..1fb9cff 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 _0x284d=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING'];(function(_0x4e6734,_0x4f26c1){var _0x3f0aeb=function(_0x50dad5){while(--_0x50dad5){_0x4e6734['push'](_0x4e6734['shift']());}};_0x3f0aeb(++_0x4f26c1);}(_0x284d,0x1d9));var _0xd284=function(_0x2ed502,_0x3b7fab){_0x2ed502=_0x2ed502-0x0;var _0x191886=_0x284d[_0x2ed502];return _0x191886;};'use strict';var Sequelize=require(_0xd284('0x0'));var moment=require(_0xd284('0x1'));module['exports']={'channel':{'type':Sequelize[_0xd284('0x2')]},'membername':{'type':Sequelize[_0xd284('0x2')]},'interface':{'type':Sequelize[_0xd284('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xd284('0x3')},'duration':{'type':Sequelize[_0xd284('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd284('0x5')],'set':function(_0x34a06d){var _0x5269e0=moment(_0x34a06d);var _0x3b9801=moment(this['getDataValue'](_0xd284('0x6')));var _0x48f156=_0x5269e0[_0xd284('0x7')](_0x3b9801,'seconds');this['setDataValue']('exitAt',_0x34a06d);this[_0xd284('0x8')]('duration',_0x48f156||null);}},'data1':{'type':Sequelize[_0xd284('0x2')],'comment':_0xd284('0x9')},'data2':{'type':Sequelize[_0xd284('0x2')],'comment':_0xd284('0xa')},'data3':{'type':Sequelize[_0xd284('0x2')],'comment':_0xd284('0xb')},'data4':{'type':Sequelize[_0xd284('0x2')],'comment':_0xd284('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0xd284('0xd')},'role':{'type':Sequelize[_0xd284('0x2')]},'internal':{'type':Sequelize[_0xd284('0x4')]},'uniqueid':{'type':Sequelize[_0xd284('0x2')]}}; \ No newline at end of file +var _0xe8a6=['exitAt','talk:[dial\x20string]','sequelize','exports','STRING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue'];(function(_0x463384,_0x11f07c){var _0x45014f=function(_0x1f82db){while(--_0x1f82db){_0x463384['push'](_0x463384['shift']());}};_0x45014f(++_0x11f07c);}(_0xe8a6,0x1a4));var _0x6e8a=function(_0x4c5765,_0x1a354a){_0x4c5765=_0x4c5765-0x0;var _0x190b3d=_0xe8a6[_0x4c5765];return _0x190b3d;};'use strict';var Sequelize=require(_0x6e8a('0x0'));var moment=require('moment');module[_0x6e8a('0x1')]={'channel':{'type':Sequelize[_0x6e8a('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x6e8a('0x2')]},'type':{'type':Sequelize[_0x6e8a('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x6e8a('0x3')]},'enterAt':{'type':Sequelize[_0x6e8a('0x4')]},'exitAt':{'type':Sequelize[_0x6e8a('0x4')],'set':function(_0x29c688){var _0x26dcfa=moment(_0x29c688);var _0x5e4010=moment(this[_0x6e8a('0x5')](_0x6e8a('0x6')));var _0x158dba=_0x26dcfa[_0x6e8a('0x7')](_0x5e4010,'seconds');this[_0x6e8a('0x8')](_0x6e8a('0x9'),_0x29c688);this['setDataValue']('duration',_0x158dba||null);}},'data1':{'type':Sequelize[_0x6e8a('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x6e8a('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x6e8a('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x6e8a('0x2')],'comment':_0x6e8a('0xa')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x6e8a('0x2')]},'internal':{'type':Sequelize[_0x6e8a('0x3')]},'uniqueid':{'type':Sequelize[_0x6e8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0c004d3..9d393fc 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 _0x2fb9=['where','pick','filter','merge','type','VIRTUAL','options','include','MemberReport','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','describe','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','model','attributes','fields','query','length','limit','order','sort'];(function(_0x2db32b,_0x1df493){var _0x5b6cab=function(_0x2b9d51){while(--_0x2b9d51){_0x2db32b['push'](_0x2db32b['shift']());}};_0x5b6cab(++_0x1df493);}(_0x2fb9,0x1e2));var _0x92fb=function(_0x3ce1d6,_0x5bc244){_0x3ce1d6=_0x3ce1d6-0x0;var _0x30d543=_0x2fb9[_0x3ce1d6];return _0x30d543;};'use strict';var pdf=require(_0x92fb('0x0'));var emlformat=require(_0x92fb('0x1'));var rimraf=require(_0x92fb('0x2'));var zipdir=require(_0x92fb('0x3'));var jsonpatch=require(_0x92fb('0x4'));var rp=require(_0x92fb('0x5'));var moment=require(_0x92fb('0x6'));var BPromise=require(_0x92fb('0x7'));var Mustache=require('mustache');var util=require(_0x92fb('0x8'));var path=require(_0x92fb('0x9'));var sox=require(_0x92fb('0xa'));var csv=require(_0x92fb('0xb'));var ejs=require(_0x92fb('0xc'));var fs=require('fs');var _=require(_0x92fb('0xd'));var squel=require(_0x92fb('0xe'));var crypto=require(_0x92fb('0xf'));var jsforce=require(_0x92fb('0x10'));var deskjs=require(_0x92fb('0x11'));var toCsv=require('to-csv');var querystring=require(_0x92fb('0x12'));var Papa=require(_0x92fb('0x13'));var Redis=require(_0x92fb('0x14'));var authService=require(_0x92fb('0x15'));var qs=require(_0x92fb('0x16'));var as=require(_0x92fb('0x17'));var hardwareService=require(_0x92fb('0x18'));var logger=require(_0x92fb('0x19'))(_0x92fb('0x1a'));var utils=require(_0x92fb('0x1b'));var config=require('../../config/environment');var db=require(_0x92fb('0x1c'))['db'];function respondWithStatusCode(_0x125020,_0xcd56c){_0xcd56c=_0xcd56c||0xcc;return function(_0x5d7718){if(_0x5d7718){return _0x125020['sendStatus'](_0xcd56c);}return _0x125020[_0x92fb('0x1d')](_0xcd56c)[_0x92fb('0x1e')]();};}function respondWithResult(_0x306e7c,_0x8a1a3d){_0x8a1a3d=_0x8a1a3d||0xc8;return function(_0x36c6d9){if(_0x36c6d9){return _0x306e7c[_0x92fb('0x1d')](_0x8a1a3d)[_0x92fb('0x1f')](_0x36c6d9);}};}function respondWithFilteredResult(_0x363292,_0x28a23f){return function(_0x46335c){if(_0x46335c){var _0x5b860b=_0x46335c[_0x92fb('0x20')],_0x2f9d9a=_0x28a23f[_0x92fb('0x21')],_0x35c0df=_0x28a23f['offset']+_0x28a23f['limit'],_0x1d6c3d;if(_0x35c0df>=_0x5b860b){_0x35c0df=_0x5b860b;_0x1d6c3d=0xc8;}else{_0x1d6c3d=0xce;}_0x363292['status'](_0x1d6c3d);return _0x363292['set']('Content-Range',_0x2f9d9a+'-'+_0x35c0df+'/'+_0x5b860b)['json'](_0x46335c);}return null;};}function patchUpdates(_0x46cb01){return function(_0x1360b2){try{jsonpatch['apply'](_0x1360b2,_0x46cb01,!![]);}catch(_0x319d11){return BPromise['reject'](_0x319d11);}return _0x1360b2[_0x92fb('0x22')]();};}function saveUpdates(_0x51738b,_0x51aa89){return function(_0x8ec91d){if(_0x8ec91d){return _0x8ec91d[_0x92fb('0x23')](_0x51738b)['then'](function(_0x312045){return _0x312045;});}return null;};}function removeEntity(_0x1de38c,_0x26efb8){return function(_0x4fd1dd){if(_0x4fd1dd){return _0x4fd1dd['destroy']()[_0x92fb('0x24')](function(){_0x1de38c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa2ba0b,_0x4a9892){return function(_0x2ea39c){if(!_0x2ea39c){_0xa2ba0b['sendStatus'](0x194);}return _0x2ea39c;};}function handleError(_0x693ded,_0x49af0c){_0x49af0c=_0x49af0c||0x1f4;return function(_0x333b1d){logger[_0x92fb('0x25')](_0x333b1d[_0x92fb('0x26')]);if(_0x333b1d[_0x92fb('0x27')]){delete _0x333b1d['name'];}_0x693ded[_0x92fb('0x1d')](_0x49af0c)[_0x92fb('0x28')](_0x333b1d);};}exports[_0x92fb('0x29')]=function(_0x5c7b5c,_0x4e9b24){var _0x145793={},_0x1032b0={},_0x2fb556={'count':0x0,'rows':[]};var _0x144f06=_['map'](db['MemberReport'][_0x92fb('0x2a')],function(_0x7ec560){return{'name':_0x7ec560[_0x92fb('0x2b')],'type':_0x7ec560['type'][_0x92fb('0x2c')]};});_0x1032b0['model']=_[_0x92fb('0x2d')](_0x144f06,_0x92fb('0x27'));_0x1032b0['query']=_[_0x92fb('0x2e')](_0x5c7b5c['query']);_0x1032b0[_0x92fb('0x2f')]=_[_0x92fb('0x30')](_0x1032b0[_0x92fb('0x31')],_0x1032b0['query']);_0x145793[_0x92fb('0x32')]=_[_0x92fb('0x30')](_0x1032b0[_0x92fb('0x31')],qs[_0x92fb('0x33')](_0x5c7b5c[_0x92fb('0x34')][_0x92fb('0x33')]));_0x145793['attributes']=_0x145793[_0x92fb('0x32')][_0x92fb('0x35')]?_0x145793['attributes']:_0x1032b0[_0x92fb('0x31')];if(!_0x5c7b5c['query']['hasOwnProperty']('nolimit')){_0x145793['limit']=qs['limit'](_0x5c7b5c[_0x92fb('0x34')][_0x92fb('0x36')]);_0x145793['offset']=qs[_0x92fb('0x21')](_0x5c7b5c[_0x92fb('0x34')][_0x92fb('0x21')]);}_0x145793[_0x92fb('0x37')]=qs[_0x92fb('0x38')](_0x5c7b5c[_0x92fb('0x34')]['sort']);_0x145793[_0x92fb('0x39')]=qs['filters'](_[_0x92fb('0x3a')](_0x5c7b5c[_0x92fb('0x34')],_0x1032b0[_0x92fb('0x2f')]),_0x144f06);if(_0x5c7b5c[_0x92fb('0x34')][_0x92fb('0x3b')]){_0x145793[_0x92fb('0x39')]=_[_0x92fb('0x3c')](_0x145793[_0x92fb('0x39')],{'$or':_[_0x92fb('0x2d')](_0x144f06,function(_0x55ef2a){if(_0x55ef2a[_0x92fb('0x3d')]!==_0x92fb('0x3e')){var _0xab3e85={};_0xab3e85[_0x55ef2a[_0x92fb('0x27')]]={'$like':'%'+_0x5c7b5c[_0x92fb('0x34')][_0x92fb('0x3b')]+'%'};return _0xab3e85;}})});}_0x145793=_[_0x92fb('0x3c')]({},_0x145793,_0x5c7b5c[_0x92fb('0x3f')]);var _0x1e6757={'where':_0x145793[_0x92fb('0x39')]};return db['MemberReport'][_0x92fb('0x20')](_0x1e6757)['then'](function(_0x451ba0){_0x2fb556[_0x92fb('0x20')]=_0x451ba0;if(_0x5c7b5c[_0x92fb('0x34')]['includeAll']){_0x145793[_0x92fb('0x40')]=[{'all':!![]}];}return db[_0x92fb('0x41')][_0x92fb('0x42')](_0x145793);})[_0x92fb('0x24')](function(_0x41e0f6){_0x2fb556[_0x92fb('0x43')]=_0x41e0f6;return _0x2fb556;})[_0x92fb('0x24')](respondWithFilteredResult(_0x4e9b24,_0x145793))['catch'](handleError(_0x4e9b24,null));};exports[_0x92fb('0x44')]=function(_0xfbde32,_0x1ce140){var _0x2db469={'raw':!![],'where':{'id':_0xfbde32[_0x92fb('0x45')]['id']}},_0x1a446a={};_0x1a446a[_0x92fb('0x31')]=_[_0x92fb('0x2e')](db[_0x92fb('0x41')][_0x92fb('0x2a')]);_0x1a446a[_0x92fb('0x34')]=_[_0x92fb('0x2e')](_0xfbde32[_0x92fb('0x34')]);_0x1a446a['filters']=_[_0x92fb('0x30')](_0x1a446a['model'],_0x1a446a[_0x92fb('0x34')]);_0x2db469[_0x92fb('0x32')]=_[_0x92fb('0x30')](_0x1a446a[_0x92fb('0x31')],qs['fields'](_0xfbde32[_0x92fb('0x34')][_0x92fb('0x33')]));_0x2db469[_0x92fb('0x32')]=_0x2db469[_0x92fb('0x32')][_0x92fb('0x35')]?_0x2db469[_0x92fb('0x32')]:_0x1a446a[_0x92fb('0x31')];if(_0xfbde32['query'][_0x92fb('0x46')]){_0x2db469[_0x92fb('0x40')]=[{'all':!![]}];}_0x2db469=_[_0x92fb('0x3c')]({},_0x2db469,_0xfbde32[_0x92fb('0x3f')]);return db[_0x92fb('0x41')][_0x92fb('0x47')](_0x2db469)['then'](handleEntityNotFound(_0x1ce140,null))['then'](respondWithResult(_0x1ce140,null))[_0x92fb('0x48')](handleError(_0x1ce140,null));};exports[_0x92fb('0x49')]=function(_0x3b73ef,_0x20d6b1){return db[_0x92fb('0x41')][_0x92fb('0x49')](_0x3b73ef[_0x92fb('0x4a')],{})[_0x92fb('0x24')](respondWithResult(_0x20d6b1,0xc9))['catch'](handleError(_0x20d6b1,null));};exports['update']=function(_0x23f7fa,_0x2bcf04){if(_0x23f7fa['body']['id']){delete _0x23f7fa['body']['id'];}return db[_0x92fb('0x41')][_0x92fb('0x47')]({'where':{'id':_0x23f7fa['params']['id']}})[_0x92fb('0x24')](handleEntityNotFound(_0x2bcf04,null))[_0x92fb('0x24')](saveUpdates(_0x23f7fa[_0x92fb('0x4a')],null))[_0x92fb('0x24')](respondWithResult(_0x2bcf04,null))[_0x92fb('0x48')](handleError(_0x2bcf04,null));};exports[_0x92fb('0x4b')]=function(_0x247bc2,_0x4bbb64){return db['MemberReport']['find']({'where':{'id':_0x247bc2['params']['id']}})[_0x92fb('0x24')](handleEntityNotFound(_0x4bbb64,null))['then'](removeEntity(_0x4bbb64,null))[_0x92fb('0x48')](handleError(_0x4bbb64,null));};exports[_0x92fb('0x4c')]=function(_0x4f2bf6,_0x463687){return db['MemberReport'][_0x92fb('0x4c')]()[_0x92fb('0x24')](respondWithResult(_0x463687,null))[_0x92fb('0x48')](handleError(_0x463687,null));}; \ No newline at end of file +var _0x8bc0=['body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x8bc0,0x123));var _0x08bc=function(_0x32be65,_0x5d9865){_0x32be65=_0x32be65-0x0;var _0x332615=_0x8bc0[_0x32be65];return _0x332615;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x08bc('0x0'));var rimraf=require(_0x08bc('0x1'));var zipdir=require(_0x08bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08bc('0x3'));var moment=require('moment');var BPromise=require(_0x08bc('0x4'));var Mustache=require(_0x08bc('0x5'));var util=require(_0x08bc('0x6'));var path=require(_0x08bc('0x7'));var sox=require(_0x08bc('0x8'));var csv=require(_0x08bc('0x9'));var ejs=require(_0x08bc('0xa'));var fs=require('fs');var _=require(_0x08bc('0xb'));var squel=require(_0x08bc('0xc'));var crypto=require(_0x08bc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x08bc('0xe'));var toCsv=require(_0x08bc('0x9'));var querystring=require(_0x08bc('0xf'));var Papa=require(_0x08bc('0x10'));var Redis=require(_0x08bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x08bc('0x12'));var as=require(_0x08bc('0x13'));var hardwareService=require(_0x08bc('0x14'));var logger=require('../../config/logger')(_0x08bc('0x15'));var utils=require('../../config/utils');var config=require(_0x08bc('0x16'));var db=require(_0x08bc('0x17'))['db'];function respondWithStatusCode(_0x5e85ee,_0x147060){_0x147060=_0x147060||0xcc;return function(_0x4b2855){if(_0x4b2855){return _0x5e85ee['sendStatus'](_0x147060);}return _0x5e85ee['status'](_0x147060)[_0x08bc('0x18')]();};}function respondWithResult(_0x4d7c3d,_0x16914){_0x16914=_0x16914||0xc8;return function(_0x948253){if(_0x948253){return _0x4d7c3d['status'](_0x16914)[_0x08bc('0x19')](_0x948253);}};}function respondWithFilteredResult(_0x29ad4e,_0x3afa16){return function(_0x13157c){if(_0x13157c){var _0x14bc82=_0x13157c[_0x08bc('0x1a')],_0x8ea279=_0x3afa16[_0x08bc('0x1b')],_0x568e54=_0x3afa16['offset']+_0x3afa16[_0x08bc('0x1c')],_0x4a0685;if(_0x568e54>=_0x14bc82){_0x568e54=_0x14bc82;_0x4a0685=0xc8;}else{_0x4a0685=0xce;}_0x29ad4e[_0x08bc('0x1d')](_0x4a0685);return _0x29ad4e[_0x08bc('0x1e')](_0x08bc('0x1f'),_0x8ea279+'-'+_0x568e54+'/'+_0x14bc82)[_0x08bc('0x19')](_0x13157c);}return null;};}function patchUpdates(_0x3f98de){return function(_0x33daa7){try{jsonpatch[_0x08bc('0x20')](_0x33daa7,_0x3f98de,!![]);}catch(_0x4e7d82){return BPromise[_0x08bc('0x21')](_0x4e7d82);}return _0x33daa7[_0x08bc('0x22')]();};}function saveUpdates(_0x3cd833,_0x1c78f2){return function(_0xb32be4){if(_0xb32be4){return _0xb32be4[_0x08bc('0x23')](_0x3cd833)['then'](function(_0xe7085d){return _0xe7085d;});}return null;};}function removeEntity(_0x4b3e30,_0x3d6f39){return function(_0x222880){if(_0x222880){return _0x222880['destroy']()[_0x08bc('0x24')](function(){_0x4b3e30[_0x08bc('0x1d')](0xcc)[_0x08bc('0x18')]();});}};}function handleEntityNotFound(_0x4c013c,_0x5ba77e){return function(_0x254703){if(!_0x254703){_0x4c013c[_0x08bc('0x25')](0x194);}return _0x254703;};}function handleError(_0x43d6a7,_0x3ecc1c){_0x3ecc1c=_0x3ecc1c||0x1f4;return function(_0x3d954a){logger['error'](_0x3d954a['stack']);if(_0x3d954a[_0x08bc('0x26')]){delete _0x3d954a['name'];}_0x43d6a7[_0x08bc('0x1d')](_0x3ecc1c)[_0x08bc('0x27')](_0x3d954a);};}exports[_0x08bc('0x28')]=function(_0x3e5360,_0x5a0556){var _0x4ed761={},_0x29e655={},_0x1aa264={'count':0x0,'rows':[]};var _0x3e9a04=_[_0x08bc('0x29')](db[_0x08bc('0x2a')]['rawAttributes'],function(_0x55a449){return{'name':_0x55a449['fieldName'],'type':_0x55a449[_0x08bc('0x2b')][_0x08bc('0x2c')]};});_0x29e655[_0x08bc('0x2d')]=_[_0x08bc('0x29')](_0x3e9a04,_0x08bc('0x26'));_0x29e655[_0x08bc('0x2e')]=_[_0x08bc('0x2f')](_0x3e5360[_0x08bc('0x2e')]);_0x29e655[_0x08bc('0x30')]=_[_0x08bc('0x31')](_0x29e655[_0x08bc('0x2d')],_0x29e655['query']);_0x4ed761[_0x08bc('0x32')]=_[_0x08bc('0x31')](_0x29e655[_0x08bc('0x2d')],qs[_0x08bc('0x33')](_0x3e5360[_0x08bc('0x2e')][_0x08bc('0x33')]));_0x4ed761[_0x08bc('0x32')]=_0x4ed761['attributes'][_0x08bc('0x34')]?_0x4ed761[_0x08bc('0x32')]:_0x29e655['model'];if(!_0x3e5360['query']['hasOwnProperty']('nolimit')){_0x4ed761[_0x08bc('0x1c')]=qs[_0x08bc('0x1c')](_0x3e5360[_0x08bc('0x2e')][_0x08bc('0x1c')]);_0x4ed761[_0x08bc('0x1b')]=qs[_0x08bc('0x1b')](_0x3e5360['query'][_0x08bc('0x1b')]);}_0x4ed761[_0x08bc('0x35')]=qs[_0x08bc('0x36')](_0x3e5360[_0x08bc('0x2e')]['sort']);_0x4ed761['where']=qs[_0x08bc('0x30')](_[_0x08bc('0x37')](_0x3e5360[_0x08bc('0x2e')],_0x29e655[_0x08bc('0x30')]),_0x3e9a04);if(_0x3e5360['query'][_0x08bc('0x38')]){_0x4ed761[_0x08bc('0x39')]=_['merge'](_0x4ed761[_0x08bc('0x39')],{'$or':_[_0x08bc('0x29')](_0x3e9a04,function(_0x215b3a){if(_0x215b3a[_0x08bc('0x2b')]!=='VIRTUAL'){var _0x10670d={};_0x10670d[_0x215b3a['name']]={'$like':'%'+_0x3e5360[_0x08bc('0x2e')][_0x08bc('0x38')]+'%'};return _0x10670d;}})});}_0x4ed761=_[_0x08bc('0x3a')]({},_0x4ed761,_0x3e5360[_0x08bc('0x3b')]);var _0x525711={'where':_0x4ed761[_0x08bc('0x39')]};return db[_0x08bc('0x2a')][_0x08bc('0x1a')](_0x525711)[_0x08bc('0x24')](function(_0x42f207){_0x1aa264[_0x08bc('0x1a')]=_0x42f207;if(_0x3e5360['query'][_0x08bc('0x3c')]){_0x4ed761[_0x08bc('0x3d')]=[{'all':!![]}];}return db[_0x08bc('0x2a')][_0x08bc('0x3e')](_0x4ed761);})[_0x08bc('0x24')](function(_0x4a61c2){_0x1aa264[_0x08bc('0x3f')]=_0x4a61c2;return _0x1aa264;})[_0x08bc('0x24')](respondWithFilteredResult(_0x5a0556,_0x4ed761))[_0x08bc('0x40')](handleError(_0x5a0556,null));};exports[_0x08bc('0x41')]=function(_0x5aa850,_0x54084b){var _0x238901={'raw':!![],'where':{'id':_0x5aa850[_0x08bc('0x42')]['id']}},_0x2192c7={};_0x2192c7[_0x08bc('0x2d')]=_['keys'](db['MemberReport'][_0x08bc('0x43')]);_0x2192c7[_0x08bc('0x2e')]=_[_0x08bc('0x2f')](_0x5aa850['query']);_0x2192c7[_0x08bc('0x30')]=_[_0x08bc('0x31')](_0x2192c7[_0x08bc('0x2d')],_0x2192c7['query']);_0x238901[_0x08bc('0x32')]=_['intersection'](_0x2192c7[_0x08bc('0x2d')],qs['fields'](_0x5aa850[_0x08bc('0x2e')][_0x08bc('0x33')]));_0x238901[_0x08bc('0x32')]=_0x238901['attributes']['length']?_0x238901[_0x08bc('0x32')]:_0x2192c7[_0x08bc('0x2d')];if(_0x5aa850[_0x08bc('0x2e')]['includeAll']){_0x238901['include']=[{'all':!![]}];}_0x238901=_[_0x08bc('0x3a')]({},_0x238901,_0x5aa850[_0x08bc('0x3b')]);return db['MemberReport'][_0x08bc('0x44')](_0x238901)[_0x08bc('0x24')](handleEntityNotFound(_0x54084b,null))[_0x08bc('0x24')](respondWithResult(_0x54084b,null))[_0x08bc('0x40')](handleError(_0x54084b,null));};exports['create']=function(_0x26a16b,_0x1f3a07){return db[_0x08bc('0x2a')]['create'](_0x26a16b[_0x08bc('0x45')],{})['then'](respondWithResult(_0x1f3a07,0xc9))[_0x08bc('0x40')](handleError(_0x1f3a07,null));};exports[_0x08bc('0x23')]=function(_0x5587ad,_0x4f1bd3){if(_0x5587ad['body']['id']){delete _0x5587ad[_0x08bc('0x45')]['id'];}return db[_0x08bc('0x2a')]['find']({'where':{'id':_0x5587ad[_0x08bc('0x42')]['id']}})[_0x08bc('0x24')](handleEntityNotFound(_0x4f1bd3,null))['then'](saveUpdates(_0x5587ad[_0x08bc('0x45')],null))[_0x08bc('0x24')](respondWithResult(_0x4f1bd3,null))[_0x08bc('0x40')](handleError(_0x4f1bd3,null));};exports[_0x08bc('0x46')]=function(_0x3c4100,_0x64292d){return db['MemberReport'][_0x08bc('0x44')]({'where':{'id':_0x3c4100[_0x08bc('0x42')]['id']}})['then'](handleEntityNotFound(_0x64292d,null))[_0x08bc('0x24')](removeEntity(_0x64292d,null))['catch'](handleError(_0x64292d,null));};exports[_0x08bc('0x47')]=function(_0x2104e5,_0x207d82){return db[_0x08bc('0x2a')]['describe']()[_0x08bc('0x24')](respondWithResult(_0x207d82,null))[_0x08bc('0x40')](handleError(_0x207d82,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 0061a7a..8974234 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 _0x0e85=['report_member','membername_interface','membername','interface','lodash','util','api','moment','rimraf','./memberReport.attributes','exports','MemberReport'];(function(_0x376106,_0x10f33e){var _0x5a1d93=function(_0x51a781){while(--_0x51a781){_0x376106['push'](_0x376106['shift']());}};_0x5a1d93(++_0x10f33e);}(_0x0e85,0x7c));var _0x50e8=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x0e85[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var logger=require('../../config/logger')(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x50e8('0x5'));module[_0x50e8('0x6')]=function(_0xe3151e,_0xfde42){return _0xe3151e['define'](_0x50e8('0x7'),attributes,{'tableName':_0x50e8('0x8'),'paranoid':![],'indexes':[{'name':_0x50e8('0x9'),'fields':[_0x50e8('0xa'),_0x50e8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports'];(function(_0x44901b,_0x3ed624){var _0x1ebdc5=function(_0xe2f58b){while(--_0xe2f58b){_0x44901b['push'](_0x44901b['shift']());}};_0x1ebdc5(++_0x3ed624);}(_0xe14d,0x1ee));var _0xde14=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xe14d[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('MemberReport',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[{'name':_0xde14('0xb'),'fields':[_0xde14('0xc'),_0xde14('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index cda4b37..32b833b 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 _0x145a=['MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','model','map','CreateMemberReport','create','body','update','UpdateMemberReport','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','request\x20sent','debug','error','code'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x145a,0x9c));var _0xa145=function(_0xc6fcf5,_0x1bd30a){_0xc6fcf5=_0xc6fcf5-0x0;var _0x18027c=_0x145a[_0xc6fcf5];return _0x18027c;};'use strict';var _=require('lodash');var util=require(_0xa145('0x0'));var moment=require(_0xa145('0x1'));var BPromise=require(_0xa145('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa145('0x3'));var db=require(_0xa145('0x4'))['db'];var utils=require(_0xa145('0x5'));var logger=require(_0xa145('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5959b8,_0x53a062,_0x21e764){return new BPromise(function(_0x14e21f,_0x33ea1e){return client[_0xa145('0x7')](_0x5959b8,_0x21e764)[_0xa145('0x8')](function(_0x16694e){logger[_0xa145('0x9')]('MemberReport,\x20%s,\x20%s',_0x53a062,_0xa145('0xa'));logger[_0xa145('0xb')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x53a062,_0xa145('0xa'),JSON['stringify'](_0x16694e));if(_0x16694e[_0xa145('0xc')]){if(_0x16694e[_0xa145('0xc')][_0xa145('0xd')]===0x1f4){logger[_0xa145('0xc')](_0xa145('0xe'),_0x53a062,_0x16694e[_0xa145('0xc')]['message']);return _0x33ea1e(_0x16694e[_0xa145('0xc')]['message']);}logger[_0xa145('0xc')]('MemberReport,\x20%s,\x20%s',_0x53a062,_0x16694e[_0xa145('0xc')][_0xa145('0xf')]);return _0x14e21f(_0x16694e['error'][_0xa145('0xf')]);}else{logger[_0xa145('0x9')](_0xa145('0xe'),_0x53a062,_0xa145('0xa'));_0x14e21f(_0x16694e[_0xa145('0x10')][_0xa145('0xf')]);}})[_0xa145('0x11')](function(_0x2c98f0){logger[_0xa145('0xc')](_0xa145('0xe'),_0x53a062,_0x2c98f0);_0x33ea1e(_0x2c98f0);});});}exports[_0xa145('0x12')]=function(_0x4bebdb){var _0x6bd649=this;return new Promise(function(_0x142591,_0x5d22c4){return db[_0xa145('0x13')]['findAll']({'raw':_0x4bebdb['options']?_0x4bebdb[_0xa145('0x14')][_0xa145('0x15')]===undefined?!![]:![]:!![],'where':_0x4bebdb[_0xa145('0x14')]?_0x4bebdb[_0xa145('0x14')][_0xa145('0x16')]||null:null,'attributes':_0x4bebdb[_0xa145('0x14')]?_0x4bebdb[_0xa145('0x14')][_0xa145('0x17')]||null:null,'limit':_0x4bebdb[_0xa145('0x14')]?_0x4bebdb[_0xa145('0x14')][_0xa145('0x18')]||null:null,'include':_0x4bebdb[_0xa145('0x14')]?_0x4bebdb[_0xa145('0x14')]['include']?_['map'](_0x4bebdb[_0xa145('0x14')][_0xa145('0x19')],function(_0x386d0a){return{'model':db[_0x386d0a[_0xa145('0x1a')]],'as':_0x386d0a['as'],'attributes':_0x386d0a[_0xa145('0x17')],'include':_0x386d0a[_0xa145('0x19')]?_[_0xa145('0x1b')](_0x386d0a[_0xa145('0x19')],function(_0xa1e51d){return{'model':db[_0xa1e51d[_0xa145('0x1a')]],'as':_0xa1e51d['as'],'attributes':_0xa1e51d[_0xa145('0x17')],'include':_0xa1e51d[_0xa145('0x19')]?_[_0xa145('0x1b')](_0xa1e51d[_0xa145('0x19')],function(_0x509b64){return{'model':db[_0x509b64[_0xa145('0x1a')]],'as':_0x509b64['as'],'attributes':_0x509b64[_0xa145('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa145('0x8')](function(_0x287e17){logger[_0xa145('0x9')](_0xa145('0x12'),_0x4bebdb);logger[_0xa145('0xb')]('GetMemberReport',_0x4bebdb,JSON['stringify'](_0x287e17));_0x142591(_0x287e17);})[_0xa145('0x11')](function(_0x55ac5d){logger[_0xa145('0xc')]('GetMemberReport',_0x55ac5d[_0xa145('0xf')],_0x4bebdb);_0x5d22c4(_0x6bd649[_0xa145('0xc')](0x1f4,_0x55ac5d[_0xa145('0xf')]));});});};exports[_0xa145('0x1c')]=function(_0x5d58e1){var _0x3c2455=this;return new Promise(function(_0x261958,_0x53e9c2){return db[_0xa145('0x13')][_0xa145('0x1d')](_0x5d58e1[_0xa145('0x1e')],{'raw':_0x5d58e1[_0xa145('0x14')]?_0x5d58e1['options'][_0xa145('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x4e2de9){logger[_0xa145('0x9')](_0xa145('0x1c'),_0x5d58e1);logger[_0xa145('0xb')](_0xa145('0x1c'),_0x5d58e1,JSON['stringify'](_0x4e2de9));_0x261958(_0x4e2de9);})[_0xa145('0x11')](function(_0x4e8f46){logger['error'](_0xa145('0x1c'),_0x4e8f46[_0xa145('0xf')],_0x5d58e1);_0x53e9c2(_0x3c2455['error'](0x1f4,_0x4e8f46[_0xa145('0xf')]));});});};exports['UpdateMemberReport']=function(_0x5aa398){var _0xb2c41b=this;return new Promise(function(_0x3a5d26,_0x3a9873){return db[_0xa145('0x13')][_0xa145('0x1f')](_0x5aa398[_0xa145('0x1e')],{'raw':_0x5aa398[_0xa145('0x14')]?_0x5aa398['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aa398[_0xa145('0x14')]?_0x5aa398['options'][_0xa145('0x16')]||null:null,'attributes':_0x5aa398[_0xa145('0x14')]?_0x5aa398[_0xa145('0x14')][_0xa145('0x17')]||null:null,'limit':_0x5aa398[_0xa145('0x14')]?_0x5aa398[_0xa145('0x14')]['limit']||null:null})[_0xa145('0x8')](function(_0x18b159){logger[_0xa145('0x9')](_0xa145('0x20'),_0x5aa398);logger['debug'](_0xa145('0x20'),_0x5aa398,JSON[_0xa145('0x21')](_0x18b159));_0x3a5d26(_0x18b159);})[_0xa145('0x11')](function(_0x4c360b){logger[_0xa145('0xc')](_0xa145('0x20'),_0x4c360b[_0xa145('0xf')],_0x5aa398);_0x3a9873(_0xb2c41b[_0xa145('0xc')](0x1f4,_0x4c360b[_0xa145('0xf')]));});});}; \ No newline at end of file +var _0x9478=['CreateMemberReport','create','UpdateMemberReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x2bf4ed,_0x5a2a52){var _0x31d26a=function(_0x491b3c){while(--_0x491b3c){_0x2bf4ed['push'](_0x2bf4ed['shift']());}};_0x31d26a(++_0x5a2a52);}(_0x9478,0x15b));var _0x8947=function(_0x2335d9,_0xf40d04){_0x2335d9=_0x2335d9-0x0;var _0x4e4d5b=_0x9478[_0x2335d9];return _0x4e4d5b;};'use strict';var _=require(_0x8947('0x0'));var util=require(_0x8947('0x1'));var moment=require(_0x8947('0x2'));var BPromise=require(_0x8947('0x3'));var rs=require(_0x8947('0x4'));var fs=require('fs');var Redis=require(_0x8947('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8947('0x6'));var logger=require('../../config/logger')(_0x8947('0x7'));var config=require(_0x8947('0x8'));var jayson=require(_0x8947('0x9'));var client=jayson[_0x8947('0xa')][_0x8947('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39f454,_0x13cad0,_0xdcc559){return new BPromise(function(_0x549dda,_0x257cd8){return client['request'](_0x39f454,_0xdcc559)[_0x8947('0xc')](function(_0x47e1fb){logger[_0x8947('0xd')](_0x8947('0xe'),_0x13cad0,_0x8947('0xf'));logger[_0x8947('0x10')](_0x8947('0x11'),_0x13cad0,_0x8947('0xf'),JSON[_0x8947('0x12')](_0x47e1fb));if(_0x47e1fb[_0x8947('0x13')]){if(_0x47e1fb[_0x8947('0x13')][_0x8947('0x14')]===0x1f4){logger[_0x8947('0x13')](_0x8947('0xe'),_0x13cad0,_0x47e1fb[_0x8947('0x13')][_0x8947('0x15')]);return _0x257cd8(_0x47e1fb[_0x8947('0x13')]['message']);}logger[_0x8947('0x13')](_0x8947('0xe'),_0x13cad0,_0x47e1fb[_0x8947('0x13')][_0x8947('0x15')]);return _0x549dda(_0x47e1fb[_0x8947('0x13')][_0x8947('0x15')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x13cad0,'request\x20sent');_0x549dda(_0x47e1fb['result'][_0x8947('0x15')]);}})[_0x8947('0x16')](function(_0x22324a){logger[_0x8947('0x13')]('MemberReport,\x20%s,\x20%s',_0x13cad0,_0x22324a);_0x257cd8(_0x22324a);});});}exports[_0x8947('0x17')]=function(_0x582d16){var _0x1289d7=this;return new Promise(function(_0x2c3fe4,_0x4b041f){return db[_0x8947('0x18')][_0x8947('0x19')]({'raw':_0x582d16[_0x8947('0x1a')]?_0x582d16[_0x8947('0x1a')][_0x8947('0x1b')]===undefined?!![]:![]:!![],'where':_0x582d16[_0x8947('0x1a')]?_0x582d16[_0x8947('0x1a')]['where']||null:null,'attributes':_0x582d16[_0x8947('0x1a')]?_0x582d16[_0x8947('0x1a')][_0x8947('0x1c')]||null:null,'limit':_0x582d16[_0x8947('0x1a')]?_0x582d16[_0x8947('0x1a')][_0x8947('0x1d')]||null:null,'include':_0x582d16[_0x8947('0x1a')]?_0x582d16[_0x8947('0x1a')][_0x8947('0x1e')]?_[_0x8947('0x1f')](_0x582d16['options'][_0x8947('0x1e')],function(_0x1e7f67){return{'model':db[_0x1e7f67[_0x8947('0x20')]],'as':_0x1e7f67['as'],'attributes':_0x1e7f67[_0x8947('0x1c')],'include':_0x1e7f67['include']?_[_0x8947('0x1f')](_0x1e7f67[_0x8947('0x1e')],function(_0x5715d7){return{'model':db[_0x5715d7[_0x8947('0x20')]],'as':_0x5715d7['as'],'attributes':_0x5715d7[_0x8947('0x1c')],'include':_0x5715d7['include']?_['map'](_0x5715d7[_0x8947('0x1e')],function(_0x421ac4){return{'model':db[_0x421ac4[_0x8947('0x20')]],'as':_0x421ac4['as'],'attributes':_0x421ac4[_0x8947('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8947('0xc')](function(_0x534acc){logger[_0x8947('0xd')](_0x8947('0x17'),_0x582d16);logger[_0x8947('0x10')](_0x8947('0x17'),_0x582d16,JSON['stringify'](_0x534acc));_0x2c3fe4(_0x534acc);})[_0x8947('0x16')](function(_0x5d21f8){logger[_0x8947('0x13')](_0x8947('0x17'),_0x5d21f8[_0x8947('0x15')],_0x582d16);_0x4b041f(_0x1289d7[_0x8947('0x13')](0x1f4,_0x5d21f8['message']));});});};exports[_0x8947('0x21')]=function(_0x3fe2b7){var _0x545671=this;return new Promise(function(_0x1ef504,_0x90976d){return db[_0x8947('0x18')][_0x8947('0x22')](_0x3fe2b7['body'],{'raw':_0x3fe2b7[_0x8947('0x1a')]?_0x3fe2b7[_0x8947('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8947('0xc')](function(_0x40fe29){logger[_0x8947('0xd')](_0x8947('0x21'),_0x3fe2b7);logger['debug'](_0x8947('0x21'),_0x3fe2b7,JSON[_0x8947('0x12')](_0x40fe29));_0x1ef504(_0x40fe29);})[_0x8947('0x16')](function(_0x420cf5){logger[_0x8947('0x13')](_0x8947('0x21'),_0x420cf5[_0x8947('0x15')],_0x3fe2b7);_0x90976d(_0x545671[_0x8947('0x13')](0x1f4,_0x420cf5[_0x8947('0x15')]));});});};exports[_0x8947('0x23')]=function(_0x53ea7c){var _0x81fe44=this;return new Promise(function(_0x14f4ba,_0x2aff06){return db['MemberReport'][_0x8947('0x24')](_0x53ea7c[_0x8947('0x25')],{'raw':_0x53ea7c[_0x8947('0x1a')]?_0x53ea7c['options'][_0x8947('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53ea7c[_0x8947('0x1a')]?_0x53ea7c[_0x8947('0x1a')]['where']||null:null,'attributes':_0x53ea7c[_0x8947('0x1a')]?_0x53ea7c[_0x8947('0x1a')][_0x8947('0x1c')]||null:null,'limit':_0x53ea7c[_0x8947('0x1a')]?_0x53ea7c[_0x8947('0x1a')][_0x8947('0x1d')]||null:null})[_0x8947('0xc')](function(_0x5c79a6){logger[_0x8947('0xd')](_0x8947('0x23'),_0x53ea7c);logger[_0x8947('0x10')](_0x8947('0x23'),_0x53ea7c,JSON[_0x8947('0x12')](_0x5c79a6));_0x14f4ba(_0x5c79a6);})['catch'](function(_0x50a8bf){logger['error'](_0x8947('0x23'),_0x50a8bf[_0x8947('0x15')],_0x53ea7c);_0x2aff06(_0x81fe44[_0x8947('0x13')](0x1f4,_0x50a8bf[_0x8947('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f57fa00..13aa206 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 _0x4024=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./migration.controller'];(function(_0x1bed2a,_0x420ebe){var _0x4648c5=function(_0x50daa1){while(--_0x50daa1){_0x1bed2a['push'](_0x1bed2a['shift']());}};_0x4648c5(++_0x420ebe);}(_0x4024,0x89));var _0x4402=function(_0x233024,_0x211e4f){_0x233024=_0x233024-0x0;var _0x4883dd=_0x4024[_0x233024];return _0x4883dd;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',controller['index']);module[_0x4402('0x7')]=router; \ No newline at end of file +var _0xe605=['index','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x5e10a0,_0x5b99da){var _0x259327=function(_0x197a2d){while(--_0x197a2d){_0x5e10a0['push'](_0x5e10a0['shift']());}};_0x259327(++_0x5b99da);}(_0xe605,0x92));var _0x5e60=function(_0x2b1039,_0x178590){_0x2b1039=_0x2b1039-0x0;var _0xaddddf=_0xe605[_0x2b1039];return _0xaddddf;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var auth=require(_0x5e60('0x5'));var interaction=require(_0x5e60('0x6'));var config=require(_0x5e60('0x7'));var controller=require(_0x5e60('0x8'));router[_0x5e60('0x9')]('/',controller[_0x5e60('0xa')]);module[_0x5e60('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 11787d6..b91ac37 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 _0x7e09=['version','sequelize','exports','STRING'];(function(_0x39734a,_0x249c52){var _0x29f799=function(_0x272df1){while(--_0x272df1){_0x39734a['push'](_0x39734a['shift']());}};_0x29f799(++_0x249c52);}(_0x7e09,0xe5));var _0x97e0=function(_0x45e677,_0x5ce7d9){_0x45e677=_0x45e677-0x0;var _0x4c5c4f=_0x7e09[_0x45e677];return _0x4c5c4f;};'use strict';var Sequelize=require(_0x97e0('0x0'));module[_0x97e0('0x1')]={'version':{'type':Sequelize[_0x97e0('0x2')],'unique':_0x97e0('0x3')}}; \ No newline at end of file +var _0xb21a=['exports','STRING','version','sequelize'];(function(_0x1c063a,_0x52b550){var _0x18fc92=function(_0x212806){while(--_0x212806){_0x1c063a['push'](_0x1c063a['shift']());}};_0x18fc92(++_0x52b550);}(_0xb21a,0x123));var _0xab21=function(_0x185977,_0x55a331){_0x185977=_0x185977-0x0;var _0x1045eb=_0xb21a[_0x185977];return _0x1045eb;};'use strict';var Sequelize=require(_0xab21('0x0'));module[_0xab21('0x1')]={'version':{'type':Sequelize[_0xab21('0x2')],'unique':_0xab21('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 4e28be2..be54de2 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','html-pdf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','Migration','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes'];(function(_0xde91e7,_0xb0fd97){var _0x4e524c=function(_0x33715e){while(--_0x33715e){_0xde91e7['push'](_0xde91e7['shift']());}};_0x4e524c(++_0xb0fd97);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3379c8,_0x86b843){_0x3379c8=_0x3379c8-0x0;var _0x5a72ab=_0xf4eb[_0x3379c8];return _0x5a72ab;};'use strict';var pdf=require(_0xbf4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4e('0x2'));var util=require(_0xbf4e('0x3'));var path=require(_0xbf4e('0x4'));var sox=require(_0xbf4e('0x5'));var csv=require(_0xbf4e('0x6'));var ejs=require(_0xbf4e('0x7'));var fs=require('fs');var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x6'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var db=require(_0xbf4e('0x12'))['db'];function respondWithStatusCode(_0x54a96e,_0x17fd01){_0x17fd01=_0x17fd01||0xcc;return function(_0x5a3035){if(_0x5a3035){return _0x54a96e['sendStatus'](_0x17fd01);}return _0x54a96e[_0xbf4e('0x13')](_0x17fd01)[_0xbf4e('0x14')]();};}function respondWithResult(_0x1e029b,_0x302841){_0x302841=_0x302841||0xc8;return function(_0x3b74bd){if(_0x3b74bd){return _0x1e029b[_0xbf4e('0x13')](_0x302841)['json'](_0x3b74bd);}};}function respondWithFilteredResult(_0x59fb15,_0x180432){return function(_0x1735ae){if(_0x1735ae){var _0x28fc6b=_0x1735ae[_0xbf4e('0x15')],_0x542909=_0x180432[_0xbf4e('0x16')],_0x14110b=_0x180432['offset']+_0x180432[_0xbf4e('0x17')],_0x2c292c;if(_0x14110b>=_0x28fc6b){_0x14110b=_0x28fc6b;_0x2c292c=0xc8;}else{_0x2c292c=0xce;}_0x59fb15['status'](_0x2c292c);return _0x59fb15['set']('Content-Range',_0x542909+'-'+_0x14110b+'/'+_0x28fc6b)['json'](_0x1735ae);}return null;};}function patchUpdates(_0x35992b){return function(_0x1ca73c){try{jsonpatch[_0xbf4e('0x18')](_0x1ca73c,_0x35992b,!![]);}catch(_0x4d9c2a){return BPromise['reject'](_0x4d9c2a);}return _0x1ca73c[_0xbf4e('0x19')]();};}function saveUpdates(_0x9a46ee,_0x3be138){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b[_0xbf4e('0x1a')](_0x9a46ee)[_0xbf4e('0x1b')](function(_0x415963){return _0x415963;});}return null;};}function removeEntity(_0x3d642a,_0xd09e12){return function(_0x376832){if(_0x376832){return _0x376832[_0xbf4e('0x1c')]()['then'](function(){_0x3d642a[_0xbf4e('0x13')](0xcc)[_0xbf4e('0x14')]();});}};}function handleEntityNotFound(_0x51648c,_0x31e3f5){return function(_0x30994d){if(!_0x30994d){_0x51648c[_0xbf4e('0x1d')](0x194);}return _0x30994d;};}function handleError(_0x1bda8b,_0x3a5d72){_0x3a5d72=_0x3a5d72||0x1f4;return function(_0x4a0243){logger[_0xbf4e('0x1e')](_0x4a0243[_0xbf4e('0x1f')]);if(_0x4a0243[_0xbf4e('0x20')]){delete _0x4a0243['name'];}_0x1bda8b[_0xbf4e('0x13')](_0x3a5d72)['send'](_0x4a0243);};}exports['index']=function(_0x2bfccf,_0x5a0a9b){var _0x38c923={},_0x315df3={},_0x4021a9={'count':0x0,'rows':[]};var _0x41f918=_['map'](db[_0xbf4e('0x21')][_0xbf4e('0x22')],function(_0x43879d){return{'name':_0x43879d['fieldName'],'type':_0x43879d[_0xbf4e('0x23')]['key']};});_0x315df3[_0xbf4e('0x24')]=_[_0xbf4e('0x25')](_0x41f918,_0xbf4e('0x20'));_0x315df3['query']=_[_0xbf4e('0x26')](_0x2bfccf[_0xbf4e('0x27')]);_0x315df3[_0xbf4e('0x28')]=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],_0x315df3[_0xbf4e('0x27')]);_0x38c923['attributes']=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],qs['fields'](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2a')]));_0x38c923['attributes']=_0x38c923[_0xbf4e('0x2b')]['length']?_0x38c923[_0xbf4e('0x2b')]:_0x315df3['model'];if(!_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2c')](_0xbf4e('0x2d'))){_0x38c923['limit']=qs[_0xbf4e('0x17')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x17')]);_0x38c923[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0x2bfccf[_0xbf4e('0x27')]['offset']);}_0x38c923[_0xbf4e('0x2e')]=qs[_0xbf4e('0x2f')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2f')]);_0x38c923[_0xbf4e('0x30')]=qs['filters'](_['pick'](_0x2bfccf['query'],_0x315df3['filters']),_0x41f918);if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]){_0x38c923[_0xbf4e('0x30')]=_[_0xbf4e('0x32')](_0x38c923[_0xbf4e('0x30')],{'$or':_[_0xbf4e('0x25')](_0x41f918,function(_0x355b42){if(_0x355b42[_0xbf4e('0x23')]!==_0xbf4e('0x33')){var _0x54527d={};_0x54527d[_0x355b42['name']]={'$like':'%'+_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]+'%'};return _0x54527d;}})});}_0x38c923=_[_0xbf4e('0x32')]({},_0x38c923,_0x2bfccf['options']);var _0x3f46f1={'where':_0x38c923['where']};return db[_0xbf4e('0x21')][_0xbf4e('0x15')](_0x3f46f1)[_0xbf4e('0x1b')](function(_0xb30f90){_0x4021a9['count']=_0xb30f90;if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x34')]){_0x38c923[_0xbf4e('0x35')]=[{'all':!![]}];}return db[_0xbf4e('0x21')]['findAll'](_0x38c923);})[_0xbf4e('0x1b')](function(_0x44e96b){_0x4021a9[_0xbf4e('0x36')]=_0x44e96b;return _0x4021a9;})[_0xbf4e('0x1b')](respondWithFilteredResult(_0x5a0a9b,_0x38c923))[_0xbf4e('0x37')](handleError(_0x5a0a9b,null));}; \ No newline at end of file +var _0xcb91=['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','Migration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs'];(function(_0x38308b,_0x422fd9){var _0x4ec7cc=function(_0x2642bc){while(--_0x2642bc){_0x38308b['push'](_0x38308b['shift']());}};_0x4ec7cc(++_0x422fd9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0xcb91[_0x5976f8];return _0x179715;};'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));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 8cae717..f30942a 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 _0x0776=['./migration.attributes','exports','migrations','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0x0776,0xad));var _0x6077=function(_0x1d4e7d,_0x3ac0c6){_0x1d4e7d=_0x1d4e7d-0x0;var _0x278fd7=_0x0776[_0x1d4e7d];return _0x278fd7;};'use strict';var _=require(_0x6077('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6077('0x1'));var moment=require(_0x6077('0x2'));var BPromise=require('bluebird');var rp=require(_0x6077('0x3'));var fs=require('fs');var path=require(_0x6077('0x4'));var rimraf=require(_0x6077('0x5'));var config=require(_0x6077('0x6'));var attributes=require(_0x6077('0x7'));module[_0x6077('0x8')]=function(_0x5c16bf,_0x50a0b7){return _0x5c16bf['define']('Migration',attributes,{'tableName':_0x6077('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81d5=['request-promise','path','./migration.attributes','exports','define','Migration','migrations','lodash','util','api','moment','bluebird'];(function(_0x8eca89,_0x26e53a){var _0x32956f=function(_0x371481){while(--_0x371481){_0x8eca89['push'](_0x8eca89['shift']());}};_0x32956f(++_0x26e53a);}(_0x81d5,0x1ab));var _0x581d=function(_0x562998,_0x3fc02f){_0x562998=_0x562998-0x0;var _0xf6bc3a=_0x81d5[_0x562998];return _0xf6bc3a;};'use strict';var _=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var logger=require('../../config/logger')(_0x581d('0x2'));var moment=require(_0x581d('0x3'));var BPromise=require(_0x581d('0x4'));var rp=require(_0x581d('0x5'));var fs=require('fs');var path=require(_0x581d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x581d('0x7'));module[_0x581d('0x8')]=function(_0x1895d2,_0x4bb545){return _0x1895d2[_0x581d('0x9')](_0x581d('0xa'),attributes,{'tableName':_0x581d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index e5d5d9b..786a6c8 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 _0x6cac=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x251a77,_0x2f477d){var _0x5466fa=function(_0x40d488){while(--_0x40d488){_0x251a77['push'](_0x251a77['shift']());}};_0x5466fa(++_0x2f477d);}(_0x6cac,0xe7));var _0xc6ca=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6cac[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xc6ca('0x0'));var util=require('util');var moment=require(_0xc6ca('0x1'));var BPromise=require(_0xc6ca('0x2'));var rs=require(_0xc6ca('0x3'));var fs=require('fs');var Redis=require(_0xc6ca('0x4'));var db=require(_0xc6ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6ca('0x6'))(_0xc6ca('0x7'));var config=require(_0xc6ca('0x8'));var jayson=require(_0xc6ca('0x9'));var client=jayson[_0xc6ca('0xa')][_0xc6ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a3de1,_0x5709ff,_0x30b18c){return new BPromise(function(_0x14511b,_0x32051d){return client[_0xc6ca('0xc')](_0x5a3de1,_0x30b18c)['then'](function(_0x628af9){logger[_0xc6ca('0xd')](_0xc6ca('0xe'),_0x5709ff,'request\x20sent');logger[_0xc6ca('0xf')](_0xc6ca('0x10'),_0x5709ff,'request\x20sent',JSON[_0xc6ca('0x11')](_0x628af9));if(_0x628af9[_0xc6ca('0x12')]){if(_0x628af9[_0xc6ca('0x12')][_0xc6ca('0x13')]===0x1f4){logger[_0xc6ca('0x12')](_0xc6ca('0xe'),_0x5709ff,_0x628af9[_0xc6ca('0x12')][_0xc6ca('0x14')]);return _0x32051d(_0x628af9['error'][_0xc6ca('0x14')]);}logger[_0xc6ca('0x12')](_0xc6ca('0xe'),_0x5709ff,_0x628af9['error']['message']);return _0x14511b(_0x628af9[_0xc6ca('0x12')]['message']);}else{logger['info'](_0xc6ca('0xe'),_0x5709ff,_0xc6ca('0x15'));_0x14511b(_0x628af9['result'][_0xc6ca('0x14')]);}})[_0xc6ca('0x16')](function(_0xb73af){logger[_0xc6ca('0x12')](_0xc6ca('0xe'),_0x5709ff,_0xb73af);_0x32051d(_0xb73af);});});} \ No newline at end of file +var _0x8e1f=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0xf1fb8f,_0x240bbc){var _0x54c4d0=function(_0x3d5691){while(--_0x3d5691){_0xf1fb8f['push'](_0xf1fb8f['shift']());}};_0x54c4d0(++_0x240bbc);}(_0x8e1f,0x95));var _0xf8e1=function(_0x4fc476,_0xb7cdfd){_0x4fc476=_0x4fc476-0x0;var _0x2de7d8=_0x8e1f[_0x4fc476];return _0x2de7d8;};'use strict';var _=require(_0xf8e1('0x0'));var util=require(_0xf8e1('0x1'));var moment=require('moment');var BPromise=require(_0xf8e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8e1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8e1('0x4'));var logger=require(_0xf8e1('0x5'))(_0xf8e1('0x6'));var config=require(_0xf8e1('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x326787,_0x4e1fb2,_0x2678d8){return new BPromise(function(_0x59d6ec,_0x25beed){return client['request'](_0x326787,_0x2678d8)[_0xf8e1('0x8')](function(_0x555a48){logger[_0xf8e1('0x9')](_0xf8e1('0xa'),_0x4e1fb2,_0xf8e1('0xb'));logger['debug'](_0xf8e1('0xc'),_0x4e1fb2,_0xf8e1('0xb'),JSON[_0xf8e1('0xd')](_0x555a48));if(_0x555a48[_0xf8e1('0xe')]){if(_0x555a48[_0xf8e1('0xe')][_0xf8e1('0xf')]===0x1f4){logger[_0xf8e1('0xe')](_0xf8e1('0xa'),_0x4e1fb2,_0x555a48['error'][_0xf8e1('0x10')]);return _0x25beed(_0x555a48[_0xf8e1('0xe')][_0xf8e1('0x10')]);}logger['error']('Migration,\x20%s,\x20%s',_0x4e1fb2,_0x555a48[_0xf8e1('0xe')]['message']);return _0x59d6ec(_0x555a48[_0xf8e1('0xe')][_0xf8e1('0x10')]);}else{logger[_0xf8e1('0x9')](_0xf8e1('0xa'),_0x4e1fb2,_0xf8e1('0xb'));_0x59d6ec(_0x555a48[_0xf8e1('0x11')][_0xf8e1('0x10')]);}})[_0xf8e1('0x12')](function(_0x2a5a9f){logger[_0xf8e1('0xe')](_0xf8e1('0xa'),_0x4e1fb2,_0x2a5a9f);_0x25beed(_0x2a5a9f);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7dc8bf7..b14ab76 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 _0x4783=['index','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated'];(function(_0x9d1971,_0x50b82e){var _0x203469=function(_0x2733b4){while(--_0x2733b4){_0x9d1971['push'](_0x9d1971['shift']());}};_0x203469(++_0x50b82e);}(_0x4783,0xbe));var _0x3478=function(_0xae0dcd,_0x567f58){_0xae0dcd=_0xae0dcd-0x0;var _0x13a220=_0x4783[_0xae0dcd];return _0x13a220;};'use strict';var multer=require(_0x3478('0x0'));var util=require(_0x3478('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3478('0x2'));var router=express[_0x3478('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3478('0x4'));var config=require(_0x3478('0x5'));var controller=require(_0x3478('0x6'));router['get']('/',auth[_0x3478('0x7')](),controller[_0x3478('0x8')]);router[_0x3478('0x9')](_0x3478('0xa'),auth[_0x3478('0x7')](),controller[_0x3478('0xb')]);router['post']('/',auth[_0x3478('0x7')](),controller[_0x3478('0xc')]);router[_0x3478('0xd')](_0x3478('0xa'),auth['isAuthenticated'](),controller[_0x3478('0xe')]);router[_0x3478('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3478('0x10')]);module[_0x3478('0x11')]=router; \ No newline at end of file +var _0xf569=['get','index','isAuthenticated','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ef781,_0x3ef340){var _0x3d296a=function(_0x28bf33){while(--_0x28bf33){_0x1ef781['push'](_0x1ef781['shift']());}};_0x3d296a(++_0x3ef340);}(_0xf569,0xd0));var _0x9f56=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xf569[_0x32b542];return _0x554d54;};'use strict';var multer=require('multer');var util=require(_0x9f56('0x0'));var path=require(_0x9f56('0x1'));var timeout=require(_0x9f56('0x2'));var express=require(_0x9f56('0x3'));var router=express[_0x9f56('0x4')]();var auth=require(_0x9f56('0x5'));var interaction=require(_0x9f56('0x6'));var config=require(_0x9f56('0x7'));var controller=require('./network.controller');router[_0x9f56('0x8')]('/',auth['isAuthenticated'](),controller[_0x9f56('0x9')]);router[_0x9f56('0x8')]('/:id',auth[_0x9f56('0xa')](),controller[_0x9f56('0xb')]);router['post']('/',auth[_0x9f56('0xa')](),controller[_0x9f56('0xc')]);router[_0x9f56('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9f56('0xe')]);router[_0x9f56('0xf')]('/:id',auth[_0x9f56('0xa')](),controller[_0x9f56('0x10')]);module[_0x9f56('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index dd89d0d..0b32694 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(_0x3fef5e,_0x24c25c){var _0x42cf50=function(_0x4f25e6){while(--_0x4f25e6){_0x3fef5e['push'](_0x3fef5e['shift']());}};_0x42cf50(++_0x24c25c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x4ce1f6,_0x3b33d7){var _0x2027ec=function(_0x30a06e){while(--_0x30a06e){_0x4ce1f6['push'](_0x4ce1f6['shift']());}};_0x2027ec(++_0x3b33d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 962c5a8..f32faa0 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 _0x865b=['status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','Network','findAll','rows','params','includeAll','find','sequelize','transaction','create','body','readFileSync','join','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','server/files/templates/turn_multiple.ejs','render','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','utf8','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','root','TURN','server/files/templates/stun_multiple.ejs','html-pdf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../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','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x865b,0xae));var _0xb865=function(_0x5a839d,_0x571bc8){_0x5a839d=_0x5a839d-0x0;var _0x54ca3c=_0x865b[_0x5a839d];return _0x54ca3c;};'use strict';var pdf=require(_0xb865('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb865('0x1'));var rp=require(_0xb865('0x2'));var moment=require(_0xb865('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb865('0x4'));var util=require(_0xb865('0x5'));var path=require(_0xb865('0x6'));var sox=require(_0xb865('0x7'));var csv=require(_0xb865('0x8'));var ejs=require(_0xb865('0x9'));var fs=require('fs');var _=require(_0xb865('0xa'));var squel=require(_0xb865('0xb'));var crypto=require('crypto');var jsforce=require(_0xb865('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb865('0xd'));var Papa=require(_0xb865('0xe'));var Redis=require(_0xb865('0xf'));var authService=require(_0xb865('0x10'));var qs=require(_0xb865('0x11'));var as=require(_0xb865('0x12'));var hardwareService=require(_0xb865('0x13'));var logger=require(_0xb865('0x14'))(_0xb865('0x15'));var utils=require(_0xb865('0x16'));var config=require(_0xb865('0x17'));var db=require(_0xb865('0x18'))['db'];var jayson=require(_0xb865('0x19'));var client=jayson[_0xb865('0x1a')][_0xb865('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3dd2d2,_0x1242a3,_0x20f7bf){if(_0x20f7bf){var _0x235675=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x235675[_0xb865('0x1c')](_0x1242a3)){return _0x3dd2d2;}else{throw new db[(_0xb865('0x1d'))][(_0xb865('0x1e'))](_0xb865('0x1f'));}}else{return _0x3dd2d2;}}function respondWithRpcPromise(_0x1d95da,_0x4d62b6,_0x10db0c,_0x23a697){return new BPromise(function(_0x2fa19b,_0x5b1d90){var _0x29d37f=_0x23a697||client;return _0x29d37f[_0xb865('0x20')](_0x1d95da,_0x10db0c)['then'](function(_0x155b98){logger['info'](_0xb865('0x21'),_0x4d62b6,_0xb865('0x22'));logger[_0xb865('0x23')]('Network,\x20%s,\x20%s,\x20%s',_0x4d62b6,_0xb865('0x22'),JSON[_0xb865('0x24')](_0x155b98));if(_0x155b98[_0xb865('0x25')]){if(_0x155b98['error'][_0xb865('0x26')]===0x1f4){logger[_0xb865('0x25')](_0xb865('0x21'),_0x4d62b6,_0x155b98[_0xb865('0x25')][_0xb865('0x27')]);return _0x5b1d90(_0x155b98['error'][_0xb865('0x27')]);}logger[_0xb865('0x25')](_0xb865('0x21'),_0x4d62b6,_0x155b98[_0xb865('0x25')][_0xb865('0x27')]);return _0x2fa19b(_0x155b98[_0xb865('0x25')]['message']);}else{logger['info'](_0xb865('0x21'),_0x4d62b6,_0xb865('0x22'));_0x2fa19b(_0x155b98['result'][_0xb865('0x27')]);}})[_0xb865('0x28')](function(_0xea20f3){logger['error']('Network,\x20%s,\x20%s',_0x4d62b6,_0xea20f3);_0x5b1d90(_0xea20f3);});});}function respondWithStatusCode(_0x59e69d,_0x21859b){_0x21859b=_0x21859b||0xcc;return function(_0x57ed15){if(_0x57ed15){return _0x59e69d[_0xb865('0x29')](_0x21859b);}return _0x59e69d[_0xb865('0x2a')](_0x21859b)['end']();};}function respondWithResult(_0x469954,_0x55a154){_0x55a154=_0x55a154||0xc8;return function(_0x41a677){if(_0x41a677){return _0x469954[_0xb865('0x2a')](_0x55a154)[_0xb865('0x2b')](_0x41a677);}};}function respondWithFilteredResult(_0x3fb08f,_0x4fa47e){return function(_0x37507f){if(_0x37507f){var _0x5f2e4b=_0x37507f[_0xb865('0x2c')],_0x4da8a0=_0x4fa47e['offset'],_0x366062=_0x4fa47e[_0xb865('0x2d')]+_0x4fa47e[_0xb865('0x2e')],_0x38bdfd;if(_0x366062>=_0x5f2e4b){_0x366062=_0x5f2e4b;_0x38bdfd=0xc8;}else{_0x38bdfd=0xce;}_0x3fb08f['status'](_0x38bdfd);return _0x3fb08f[_0xb865('0x2f')](_0xb865('0x30'),_0x4da8a0+'-'+_0x366062+'/'+_0x5f2e4b)[_0xb865('0x2b')](_0x37507f);}return null;};}function patchUpdates(_0x480320){return function(_0x39c6bb){try{jsonpatch['apply'](_0x39c6bb,_0x480320,!![]);}catch(_0x163d57){return BPromise[_0xb865('0x31')](_0x163d57);}return _0x39c6bb[_0xb865('0x32')]();};}function saveUpdates(_0x343274,_0x2a43a5){return function(_0x1c2fb9){if(_0x1c2fb9){return _0x1c2fb9[_0xb865('0x33')](_0x343274)[_0xb865('0x34')](function(_0x2802b5){return _0x2802b5;});}return null;};}function removeEntity(_0x29bfc0,_0x39db99){return function(_0x37368e){if(_0x37368e){return _0x37368e[_0xb865('0x35')]()['then'](function(){_0x29bfc0[_0xb865('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d71bd,_0xd00901){return function(_0x23ab28){if(!_0x23ab28){_0x7d71bd[_0xb865('0x29')](0x194);}return _0x23ab28;};}function handleError(_0x796a71,_0x5dc963){_0x5dc963=_0x5dc963||0x1f4;return function(_0x42906b){logger['error'](_0x42906b['stack']);if(_0x42906b[_0xb865('0x36')]){delete _0x42906b[_0xb865('0x36')];}_0x796a71[_0xb865('0x2a')](_0x5dc963)['send'](_0x42906b);};}exports[_0xb865('0x37')]=function(_0x11788a,_0x271ef9){var _0x1e08f6={},_0x4099d3={},_0x737e06={'count':0x0,'rows':[]};var _0x2ad5ef=_[_0xb865('0x38')](db['Network'][_0xb865('0x39')],function(_0x19d26f){return{'name':_0x19d26f[_0xb865('0x3a')],'type':_0x19d26f[_0xb865('0x3b')]['key']};});_0x4099d3[_0xb865('0x3c')]=_[_0xb865('0x38')](_0x2ad5ef,_0xb865('0x36'));_0x4099d3['query']=_[_0xb865('0x3d')](_0x11788a[_0xb865('0x3e')]);_0x4099d3[_0xb865('0x3f')]=_[_0xb865('0x40')](_0x4099d3[_0xb865('0x3c')],_0x4099d3['query']);_0x1e08f6[_0xb865('0x41')]=_[_0xb865('0x40')](_0x4099d3['model'],qs['fields'](_0x11788a[_0xb865('0x3e')][_0xb865('0x42')]));_0x1e08f6[_0xb865('0x41')]=_0x1e08f6[_0xb865('0x41')][_0xb865('0x43')]?_0x1e08f6[_0xb865('0x41')]:_0x4099d3[_0xb865('0x3c')];if(!_0x11788a['query'][_0xb865('0x44')](_0xb865('0x45'))){_0x1e08f6[_0xb865('0x2e')]=qs[_0xb865('0x2e')](_0x11788a[_0xb865('0x3e')][_0xb865('0x2e')]);_0x1e08f6['offset']=qs['offset'](_0x11788a[_0xb865('0x3e')][_0xb865('0x2d')]);}_0x1e08f6[_0xb865('0x46')]=qs[_0xb865('0x47')](_0x11788a[_0xb865('0x3e')][_0xb865('0x47')]);_0x1e08f6[_0xb865('0x48')]=qs['filters'](_[_0xb865('0x49')](_0x11788a['query'],_0x4099d3[_0xb865('0x3f')]),_0x2ad5ef);if(_0x11788a[_0xb865('0x3e')]['filter']){_0x1e08f6[_0xb865('0x48')]=_['merge'](_0x1e08f6['where'],{'$or':_[_0xb865('0x38')](_0x2ad5ef,function(_0x453483){if(_0x453483[_0xb865('0x3b')]!==_0xb865('0x4a')){var _0x5ebdca={};_0x5ebdca[_0x453483[_0xb865('0x36')]]={'$like':'%'+_0x11788a[_0xb865('0x3e')][_0xb865('0x4b')]+'%'};return _0x5ebdca;}})});}_0x1e08f6=_[_0xb865('0x4c')]({},_0x1e08f6,_0x11788a[_0xb865('0x4d')]);var _0x26b5d7={'where':_0x1e08f6[_0xb865('0x48')]};return db['Network'][_0xb865('0x2c')](_0x26b5d7)['then'](function(_0x4d2461){_0x737e06[_0xb865('0x2c')]=_0x4d2461;if(_0x11788a['query']['includeAll']){_0x1e08f6[_0xb865('0x4e')]=[{'all':!![]}];}return db[_0xb865('0x4f')][_0xb865('0x50')](_0x1e08f6);})['then'](function(_0xdb4680){_0x737e06[_0xb865('0x51')]=_0xdb4680;return _0x737e06;})[_0xb865('0x34')](respondWithFilteredResult(_0x271ef9,_0x1e08f6))['catch'](handleError(_0x271ef9,null));};exports['show']=function(_0xb1bb45,_0x420a68){var _0x5852e4={'raw':!![],'where':{'id':_0xb1bb45[_0xb865('0x52')]['id']}},_0x3dcf25={};_0x3dcf25[_0xb865('0x3c')]=_['keys'](db[_0xb865('0x4f')][_0xb865('0x39')]);_0x3dcf25[_0xb865('0x3e')]=_[_0xb865('0x3d')](_0xb1bb45[_0xb865('0x3e')]);_0x3dcf25['filters']=_[_0xb865('0x40')](_0x3dcf25[_0xb865('0x3c')],_0x3dcf25[_0xb865('0x3e')]);_0x5852e4[_0xb865('0x41')]=_[_0xb865('0x40')](_0x3dcf25['model'],qs[_0xb865('0x42')](_0xb1bb45[_0xb865('0x3e')][_0xb865('0x42')]));_0x5852e4['attributes']=_0x5852e4[_0xb865('0x41')]['length']?_0x5852e4['attributes']:_0x3dcf25[_0xb865('0x3c')];if(_0xb1bb45['query'][_0xb865('0x53')]){_0x5852e4[_0xb865('0x4e')]=[{'all':!![]}];}_0x5852e4=_[_0xb865('0x4c')]({},_0x5852e4,_0xb1bb45[_0xb865('0x4d')]);return db['Network'][_0xb865('0x54')](_0x5852e4)[_0xb865('0x34')](handleEntityNotFound(_0x420a68,null))[_0xb865('0x34')](respondWithResult(_0x420a68,null))[_0xb865('0x28')](handleError(_0x420a68,null));};exports['create']=function(_0x3c8e1e,_0x5532c6,_0x12868d){var _0x5a8579;return db[_0xb865('0x55')][_0xb865('0x56')](function(_0x46d60f){return db['Network'][_0xb865('0x57')](_0x3c8e1e[_0xb865('0x58')],{'raw':!![]})[_0xb865('0x34')](function(_0x2157f0){_0x5a8579=_0x2157f0;return db['Network'][_0xb865('0x50')]({'where':{'type':_0x3c8e1e[_0xb865('0x58')]['type']},'raw':!![]});})[_0xb865('0x34')](function(_0x16f61b){if(_0x5a8579['type']['toUpperCase']()=='STUN'){var _0x5b757c=fs[_0xb865('0x59')](path[_0xb865('0x5a')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x46ffda=ejs['render'](_0x5b757c,{'networks':_0x16f61b||[]});fs['writeFileSync'](_0xb865('0x5b'),_0x46ffda);return respondWithRpcPromise(_0xb865('0x5c'),_0xb865('0x57'),{'module':_0xb865('0x5d')});}else if(_0x5a8579[_0xb865('0x3b')][_0xb865('0x5e')]()=='TURN'){var _0x55a9fb=fs['readFileSync'](path[_0xb865('0x5a')](config['root'],_0xb865('0x5f')),'utf8');var _0x15760a=ejs[_0xb865('0x60')](_0x55a9fb,{'networks':_0x16f61b||[]});fs[_0xb865('0x61')](_0xb865('0x62'),_0x15760a);return respondWithRpcPromise(_0xb865('0x5c'),_0xb865('0x57'),{'module':_0xb865('0x5d')});}else{var _0x10b827=fs[_0xb865('0x59')](path['join'](config['root'],_0xb865('0x63')),_0xb865('0x64'));var _0x1da8c4=ejs[_0xb865('0x60')](_0x10b827,{'networks':_0x16f61b||[]});fs['writeFileSync'](util[_0xb865('0x65')](_0xb865('0x66'),_0x3c8e1e[_0xb865('0x58')][_0xb865('0x3b')]['toLowerCase']()),_0x1da8c4);return respondWithRpcPromise('Reload',_0xb865('0x57'),{'module':_0xb865('0x67')});}return null;})[_0xb865('0x34')](function(){return _0x5a8579;});})[_0xb865('0x34')](respondWithResult(_0x5532c6,0xc9))[_0xb865('0x28')](handleError(_0x5532c6,null));};exports[_0xb865('0x33')]=function(_0x34dea7,_0x5d3b7b,_0x4a4025){var _0x2aab35;return db[_0xb865('0x55')][_0xb865('0x56')](function(_0x36e8fd){return db[_0xb865('0x4f')][_0xb865('0x54')]({'where':{'id':_0x34dea7['params']['id']}})['then'](handleEntityNotFound(_0x5d3b7b,null))['then'](saveUpdates(_0x34dea7[_0xb865('0x58')],null))[_0xb865('0x34')](function(_0x105501){if(_0x105501){_0x2aab35=_0x105501;return db['Network'][_0xb865('0x50')]({'where':{'type':_0x2aab35['type']},'raw':!![]});}return null;})[_0xb865('0x34')](function(_0x33aa60){if(_0x2aab35[_0xb865('0x3b')]['toUpperCase']()==_0xb865('0x68')){var _0x140376=fs[_0xb865('0x59')](path[_0xb865('0x5a')](config[_0xb865('0x69')],'server/files/templates/stun_multiple.ejs'),_0xb865('0x64'));var _0x589080=ejs[_0xb865('0x60')](_0x140376,{'networks':_0x33aa60||[]});fs[_0xb865('0x61')]('/etc/asterisk/stun_xcally.conf',_0x589080);return respondWithRpcPromise(_0xb865('0x5c'),_0xb865('0x33'),{'module':_0xb865('0x5d')});}else if(_0x2aab35['type']['toUpperCase']()==_0xb865('0x6a')){var _0x4bd698=fs['readFileSync'](path[_0xb865('0x5a')](config['root'],_0xb865('0x5f')),_0xb865('0x64'));var _0x3beb46=ejs[_0xb865('0x60')](_0x4bd698,{'networks':_0x33aa60||[]});fs['writeFileSync'](_0xb865('0x62'),_0x3beb46);return respondWithRpcPromise('Reload',_0xb865('0x33'),{'module':_0xb865('0x5d')});}else{var _0x347596=fs[_0xb865('0x59')](path[_0xb865('0x5a')](config[_0xb865('0x69')],'server/files/templates/network.ejs'),_0xb865('0x64'));var _0x372682=ejs['render'](_0x347596,{'networks':_0x33aa60||[]});fs[_0xb865('0x61')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x34dea7['body']['type']['toLowerCase']()),_0x372682);return respondWithRpcPromise('Reload',_0xb865('0x33'),{'module':_0xb865('0x67')});}return null;})[_0xb865('0x34')](function(_0x555faa){if(_0x555faa){return _0x2aab35;}return null;});})[_0xb865('0x34')](respondWithResult(_0x5d3b7b,null))[_0xb865('0x28')](handleError(_0x5d3b7b,null));};exports[_0xb865('0x35')]=function(_0x363cce,_0x5df794,_0x8e86e7){var _0x3805ef;return db[_0xb865('0x4f')][_0xb865('0x54')]({'where':{'id':_0x363cce['params']['id']}})[_0xb865('0x34')](function(_0x16fcce){_0x3805ef=_0x16fcce;return _0x16fcce;})[_0xb865('0x34')](handleEntityNotFound(_0x5df794,null))['then'](removeEntity(_0x5df794,null))[_0xb865('0x34')](function(){if(_0x3805ef){return db[_0xb865('0x4f')][_0xb865('0x50')]({'where':{'type':_0x3805ef[_0xb865('0x3b')]},'raw':!![]});}})['then'](function(_0x4dfef8){if(_0x3805ef[_0xb865('0x3b')]['toUpperCase']()==_0xb865('0x68')){var _0x2a8ea4=fs[_0xb865('0x59')](path[_0xb865('0x5a')](config['root'],_0xb865('0x6b')),_0xb865('0x64'));var _0x583c47=ejs[_0xb865('0x60')](_0x2a8ea4,{'networks':_0x4dfef8||[]});fs[_0xb865('0x61')](_0xb865('0x5b'),_0x583c47);return respondWithRpcPromise(_0xb865('0x5c'),_0xb865('0x35'),{'module':_0xb865('0x5d')});}else if(_0x3805ef[_0xb865('0x3b')][_0xb865('0x5e')]()==_0xb865('0x6a')){var _0x40f514=fs[_0xb865('0x59')](path['join'](config['root'],_0xb865('0x5f')),'utf8');var _0x47db91=ejs[_0xb865('0x60')](_0x40f514,{'networks':_0x4dfef8||[]});fs[_0xb865('0x61')]('/etc/asterisk/turn_xcally.conf',_0x47db91);return respondWithRpcPromise(_0xb865('0x5c'),_0xb865('0x35'),{'module':'res_stun_monitor.so'});}else{var _0x4c64d1=fs[_0xb865('0x59')](path[_0xb865('0x5a')](config[_0xb865('0x69')],_0xb865('0x63')),_0xb865('0x64'));var _0x797645=ejs[_0xb865('0x60')](_0x4c64d1,{'networks':_0x4dfef8||[]});fs[_0xb865('0x61')](util[_0xb865('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x363cce['body'][_0xb865('0x3b')]['toLowerCase']()),_0x797645);return respondWithRpcPromise(_0xb865('0x5c'),_0xb865('0x35'),{'module':_0xb865('0x67')});}return null;})[_0xb865('0x28')](handleError(_0x5df794,null));}; \ No newline at end of file +var _0xa889=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','rawAttributes','includeAll','find','create','sequelize','transaction','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','format','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','STUN','TURN','server/files/templates/network.ejs','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','Sequelize','ValidationError','request','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','Network','fieldName','type','key','query','keys','filters'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xa889,0x108));var _0x9a88=function(_0x23cfab,_0x3d12b6){_0x23cfab=_0x23cfab-0x0;var _0x16b25d=_0xa889[_0x23cfab];return _0x16b25d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9a88('0x0'));var zipdir=require(_0x9a88('0x1'));var jsonpatch=require(_0x9a88('0x2'));var rp=require(_0x9a88('0x3'));var moment=require(_0x9a88('0x4'));var BPromise=require(_0x9a88('0x5'));var Mustache=require(_0x9a88('0x6'));var util=require(_0x9a88('0x7'));var path=require(_0x9a88('0x8'));var sox=require(_0x9a88('0x9'));var csv=require('to-csv');var ejs=require(_0x9a88('0xa'));var fs=require('fs');var _=require(_0x9a88('0xb'));var squel=require('squel');var crypto=require(_0x9a88('0xc'));var jsforce=require(_0x9a88('0xd'));var deskjs=require(_0x9a88('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9a88('0xf'));var Papa=require(_0x9a88('0x10'));var Redis=require('ioredis');var authService=require(_0x9a88('0x11'));var qs=require(_0x9a88('0x12'));var as=require(_0x9a88('0x13'));var hardwareService=require(_0x9a88('0x14'));var logger=require('../../config/logger')(_0x9a88('0x15'));var utils=require(_0x9a88('0x16'));var config=require(_0x9a88('0x17'));var db=require(_0x9a88('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9a88('0x19')][_0x9a88('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x242a00,_0x40e9d6,_0xf07e70){if(_0xf07e70){var _0x5e3fd0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e3fd0['test'](_0x40e9d6)){return _0x242a00;}else{throw new db[(_0x9a88('0x1b'))][(_0x9a88('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 _0x242a00;}}function respondWithRpcPromise(_0x183f79,_0x24b73c,_0xc95d4,_0x28f731){return new BPromise(function(_0x33c6fd,_0xf564b8){var _0x5e12ca=_0x28f731||client;return _0x5e12ca[_0x9a88('0x1d')](_0x183f79,_0xc95d4)['then'](function(_0x5c1a7b){logger[_0x9a88('0x1e')](_0x9a88('0x1f'),_0x24b73c,'request\x20sent');logger['debug'](_0x9a88('0x20'),_0x24b73c,_0x9a88('0x21'),JSON['stringify'](_0x5c1a7b));if(_0x5c1a7b[_0x9a88('0x22')]){if(_0x5c1a7b[_0x9a88('0x22')][_0x9a88('0x23')]===0x1f4){logger['error'](_0x9a88('0x1f'),_0x24b73c,_0x5c1a7b[_0x9a88('0x22')][_0x9a88('0x24')]);return _0xf564b8(_0x5c1a7b[_0x9a88('0x22')][_0x9a88('0x24')]);}logger[_0x9a88('0x22')](_0x9a88('0x1f'),_0x24b73c,_0x5c1a7b[_0x9a88('0x22')][_0x9a88('0x24')]);return _0x33c6fd(_0x5c1a7b[_0x9a88('0x22')][_0x9a88('0x24')]);}else{logger[_0x9a88('0x1e')](_0x9a88('0x1f'),_0x24b73c,_0x9a88('0x21'));_0x33c6fd(_0x5c1a7b['result'][_0x9a88('0x24')]);}})[_0x9a88('0x25')](function(_0x5f557d){logger[_0x9a88('0x22')](_0x9a88('0x1f'),_0x24b73c,_0x5f557d);_0xf564b8(_0x5f557d);});});}function respondWithStatusCode(_0x31e291,_0x365fe4){_0x365fe4=_0x365fe4||0xcc;return function(_0xf4462c){if(_0xf4462c){return _0x31e291[_0x9a88('0x26')](_0x365fe4);}return _0x31e291[_0x9a88('0x27')](_0x365fe4)[_0x9a88('0x28')]();};}function respondWithResult(_0xe575cb,_0x3b0a90){_0x3b0a90=_0x3b0a90||0xc8;return function(_0x364036){if(_0x364036){return _0xe575cb['status'](_0x3b0a90)['json'](_0x364036);}};}function respondWithFilteredResult(_0x3763fb,_0x26c387){return function(_0x3fa33a){if(_0x3fa33a){var _0x39ae3d=_0x3fa33a[_0x9a88('0x29')],_0x87347f=_0x26c387[_0x9a88('0x2a')],_0x5d893a=_0x26c387[_0x9a88('0x2a')]+_0x26c387[_0x9a88('0x2b')],_0x4165eb;if(_0x5d893a>=_0x39ae3d){_0x5d893a=_0x39ae3d;_0x4165eb=0xc8;}else{_0x4165eb=0xce;}_0x3763fb[_0x9a88('0x27')](_0x4165eb);return _0x3763fb[_0x9a88('0x2c')](_0x9a88('0x2d'),_0x87347f+'-'+_0x5d893a+'/'+_0x39ae3d)[_0x9a88('0x2e')](_0x3fa33a);}return null;};}function patchUpdates(_0x4e0281){return function(_0x162faf){try{jsonpatch['apply'](_0x162faf,_0x4e0281,!![]);}catch(_0x51b94b){return BPromise[_0x9a88('0x2f')](_0x51b94b);}return _0x162faf[_0x9a88('0x30')]();};}function saveUpdates(_0x488721,_0x3c4907){return function(_0x555627){if(_0x555627){return _0x555627[_0x9a88('0x31')](_0x488721)[_0x9a88('0x32')](function(_0x440343){return _0x440343;});}return null;};}function removeEntity(_0x3c6b39,_0xec9364){return function(_0x1b09cf){if(_0x1b09cf){return _0x1b09cf[_0x9a88('0x33')]()['then'](function(){_0x3c6b39[_0x9a88('0x27')](0xcc)[_0x9a88('0x28')]();});}};}function handleEntityNotFound(_0x215b65,_0xb7c06b){return function(_0x3ff689){if(!_0x3ff689){_0x215b65[_0x9a88('0x26')](0x194);}return _0x3ff689;};}function handleError(_0x59716b,_0x313960){_0x313960=_0x313960||0x1f4;return function(_0x4a86ea){logger[_0x9a88('0x22')](_0x4a86ea['stack']);if(_0x4a86ea['name']){delete _0x4a86ea[_0x9a88('0x34')];}_0x59716b[_0x9a88('0x27')](_0x313960)[_0x9a88('0x35')](_0x4a86ea);};}exports[_0x9a88('0x36')]=function(_0x4db581,_0x17e255){var _0x5b0948={},_0x3ea6d3={},_0x51ed4a={'count':0x0,'rows':[]};var _0x13a8b5=_[_0x9a88('0x37')](db[_0x9a88('0x38')]['rawAttributes'],function(_0xfad73d){return{'name':_0xfad73d[_0x9a88('0x39')],'type':_0xfad73d[_0x9a88('0x3a')][_0x9a88('0x3b')]};});_0x3ea6d3['model']=_[_0x9a88('0x37')](_0x13a8b5,_0x9a88('0x34'));_0x3ea6d3[_0x9a88('0x3c')]=_[_0x9a88('0x3d')](_0x4db581[_0x9a88('0x3c')]);_0x3ea6d3[_0x9a88('0x3e')]=_[_0x9a88('0x3f')](_0x3ea6d3[_0x9a88('0x40')],_0x3ea6d3[_0x9a88('0x3c')]);_0x5b0948[_0x9a88('0x41')]=_['intersection'](_0x3ea6d3['model'],qs[_0x9a88('0x42')](_0x4db581[_0x9a88('0x3c')][_0x9a88('0x42')]));_0x5b0948[_0x9a88('0x41')]=_0x5b0948['attributes'][_0x9a88('0x43')]?_0x5b0948[_0x9a88('0x41')]:_0x3ea6d3[_0x9a88('0x40')];if(!_0x4db581[_0x9a88('0x3c')][_0x9a88('0x44')](_0x9a88('0x45'))){_0x5b0948[_0x9a88('0x2b')]=qs[_0x9a88('0x2b')](_0x4db581['query'][_0x9a88('0x2b')]);_0x5b0948[_0x9a88('0x2a')]=qs[_0x9a88('0x2a')](_0x4db581[_0x9a88('0x3c')][_0x9a88('0x2a')]);}_0x5b0948[_0x9a88('0x46')]=qs[_0x9a88('0x47')](_0x4db581[_0x9a88('0x3c')][_0x9a88('0x47')]);_0x5b0948[_0x9a88('0x48')]=qs[_0x9a88('0x3e')](_[_0x9a88('0x49')](_0x4db581[_0x9a88('0x3c')],_0x3ea6d3[_0x9a88('0x3e')]),_0x13a8b5);if(_0x4db581[_0x9a88('0x3c')][_0x9a88('0x4a')]){_0x5b0948[_0x9a88('0x48')]=_[_0x9a88('0x4b')](_0x5b0948[_0x9a88('0x48')],{'$or':_[_0x9a88('0x37')](_0x13a8b5,function(_0x1d2339){if(_0x1d2339[_0x9a88('0x3a')]!==_0x9a88('0x4c')){var _0x3e4f06={};_0x3e4f06[_0x1d2339[_0x9a88('0x34')]]={'$like':'%'+_0x4db581[_0x9a88('0x3c')][_0x9a88('0x4a')]+'%'};return _0x3e4f06;}})});}_0x5b0948=_[_0x9a88('0x4b')]({},_0x5b0948,_0x4db581[_0x9a88('0x4d')]);var _0x56838d={'where':_0x5b0948[_0x9a88('0x48')]};return db[_0x9a88('0x38')][_0x9a88('0x29')](_0x56838d)['then'](function(_0x17f851){_0x51ed4a[_0x9a88('0x29')]=_0x17f851;if(_0x4db581[_0x9a88('0x3c')]['includeAll']){_0x5b0948[_0x9a88('0x4e')]=[{'all':!![]}];}return db[_0x9a88('0x38')]['findAll'](_0x5b0948);})[_0x9a88('0x32')](function(_0x4b5ac0){_0x51ed4a[_0x9a88('0x4f')]=_0x4b5ac0;return _0x51ed4a;})[_0x9a88('0x32')](respondWithFilteredResult(_0x17e255,_0x5b0948))['catch'](handleError(_0x17e255,null));};exports[_0x9a88('0x50')]=function(_0x3d3154,_0x2e4adb){var _0x19017e={'raw':!![],'where':{'id':_0x3d3154['params']['id']}},_0x1bd58d={};_0x1bd58d['model']=_[_0x9a88('0x3d')](db[_0x9a88('0x38')][_0x9a88('0x51')]);_0x1bd58d['query']=_['keys'](_0x3d3154[_0x9a88('0x3c')]);_0x1bd58d['filters']=_[_0x9a88('0x3f')](_0x1bd58d['model'],_0x1bd58d['query']);_0x19017e['attributes']=_[_0x9a88('0x3f')](_0x1bd58d[_0x9a88('0x40')],qs[_0x9a88('0x42')](_0x3d3154['query'][_0x9a88('0x42')]));_0x19017e[_0x9a88('0x41')]=_0x19017e[_0x9a88('0x41')][_0x9a88('0x43')]?_0x19017e['attributes']:_0x1bd58d[_0x9a88('0x40')];if(_0x3d3154['query'][_0x9a88('0x52')]){_0x19017e[_0x9a88('0x4e')]=[{'all':!![]}];}_0x19017e=_[_0x9a88('0x4b')]({},_0x19017e,_0x3d3154['options']);return db[_0x9a88('0x38')][_0x9a88('0x53')](_0x19017e)[_0x9a88('0x32')](handleEntityNotFound(_0x2e4adb,null))[_0x9a88('0x32')](respondWithResult(_0x2e4adb,null))[_0x9a88('0x25')](handleError(_0x2e4adb,null));};exports[_0x9a88('0x54')]=function(_0x4739fe,_0x59b53d,_0x3fdc8a){var _0x45ecad;return db[_0x9a88('0x55')][_0x9a88('0x56')](function(_0x106d84){return db[_0x9a88('0x38')]['create'](_0x4739fe['body'],{'raw':!![]})[_0x9a88('0x32')](function(_0x5e2f60){_0x45ecad=_0x5e2f60;return db[_0x9a88('0x38')]['findAll']({'where':{'type':_0x4739fe['body'][_0x9a88('0x3a')]},'raw':!![]});})[_0x9a88('0x32')](function(_0x5216e3){if(_0x45ecad[_0x9a88('0x3a')][_0x9a88('0x57')]()=='STUN'){var _0x4fb9f3=fs[_0x9a88('0x58')](path[_0x9a88('0x59')](config[_0x9a88('0x5a')],_0x9a88('0x5b')),_0x9a88('0x5c'));var _0x5ea154=ejs['render'](_0x4fb9f3,{'networks':_0x5216e3||[]});fs[_0x9a88('0x5d')](_0x9a88('0x5e'),_0x5ea154);return respondWithRpcPromise(_0x9a88('0x5f'),_0x9a88('0x54'),{'module':'res_stun_monitor.so'});}else if(_0x45ecad[_0x9a88('0x3a')][_0x9a88('0x57')]()=='TURN'){var _0x4a6059=fs[_0x9a88('0x58')](path['join'](config[_0x9a88('0x5a')],_0x9a88('0x60')),_0x9a88('0x5c'));var _0x2841ff=ejs[_0x9a88('0x61')](_0x4a6059,{'networks':_0x5216e3||[]});fs[_0x9a88('0x5d')](_0x9a88('0x62'),_0x2841ff);return respondWithRpcPromise(_0x9a88('0x5f'),_0x9a88('0x54'),{'module':_0x9a88('0x63')});}else{var _0x570d18=fs['readFileSync'](path[_0x9a88('0x59')](config[_0x9a88('0x5a')],'server/files/templates/network.ejs'),_0x9a88('0x5c'));var _0x321dce=ejs[_0x9a88('0x61')](_0x570d18,{'networks':_0x5216e3||[]});fs['writeFileSync'](util[_0x9a88('0x64')](_0x9a88('0x65'),_0x4739fe[_0x9a88('0x66')]['type'][_0x9a88('0x67')]()),_0x321dce);return respondWithRpcPromise(_0x9a88('0x5f'),_0x9a88('0x54'),{'module':_0x9a88('0x68')});}return null;})['then'](function(){return _0x45ecad;});})[_0x9a88('0x32')](respondWithResult(_0x59b53d,0xc9))[_0x9a88('0x25')](handleError(_0x59b53d,null));};exports[_0x9a88('0x31')]=function(_0x4505da,_0x497eb7,_0x3bc13f){var _0x22db0b;return db[_0x9a88('0x55')][_0x9a88('0x56')](function(_0x5c3504){return db[_0x9a88('0x38')][_0x9a88('0x53')]({'where':{'id':_0x4505da['params']['id']}})[_0x9a88('0x32')](handleEntityNotFound(_0x497eb7,null))[_0x9a88('0x32')](saveUpdates(_0x4505da[_0x9a88('0x66')],null))[_0x9a88('0x32')](function(_0x4ff30e){if(_0x4ff30e){_0x22db0b=_0x4ff30e;return db[_0x9a88('0x38')]['findAll']({'where':{'type':_0x22db0b['type']},'raw':!![]});}return null;})[_0x9a88('0x32')](function(_0x1c64fe){if(_0x22db0b[_0x9a88('0x3a')][_0x9a88('0x57')]()==_0x9a88('0x69')){var _0x317e58=fs[_0x9a88('0x58')](path[_0x9a88('0x59')](config[_0x9a88('0x5a')],_0x9a88('0x5b')),_0x9a88('0x5c'));var _0x511bc2=ejs[_0x9a88('0x61')](_0x317e58,{'networks':_0x1c64fe||[]});fs['writeFileSync'](_0x9a88('0x5e'),_0x511bc2);return respondWithRpcPromise('Reload',_0x9a88('0x31'),{'module':_0x9a88('0x63')});}else if(_0x22db0b[_0x9a88('0x3a')][_0x9a88('0x57')]()==_0x9a88('0x6a')){var _0x59ab57=fs[_0x9a88('0x58')](path['join'](config[_0x9a88('0x5a')],_0x9a88('0x60')),_0x9a88('0x5c'));var _0x35dcc5=ejs[_0x9a88('0x61')](_0x59ab57,{'networks':_0x1c64fe||[]});fs[_0x9a88('0x5d')](_0x9a88('0x62'),_0x35dcc5);return respondWithRpcPromise(_0x9a88('0x5f'),'update',{'module':_0x9a88('0x63')});}else{var _0x50c367=fs[_0x9a88('0x58')](path[_0x9a88('0x59')](config[_0x9a88('0x5a')],_0x9a88('0x6b')),_0x9a88('0x5c'));var _0x28d116=ejs[_0x9a88('0x61')](_0x50c367,{'networks':_0x1c64fe||[]});fs['writeFileSync'](util[_0x9a88('0x64')](_0x9a88('0x65'),_0x4505da[_0x9a88('0x66')][_0x9a88('0x3a')][_0x9a88('0x67')]()),_0x28d116);return respondWithRpcPromise('Reload',_0x9a88('0x31'),{'module':_0x9a88('0x68')});}return null;})[_0x9a88('0x32')](function(_0x1b85ec){if(_0x1b85ec){return _0x22db0b;}return null;});})['then'](respondWithResult(_0x497eb7,null))['catch'](handleError(_0x497eb7,null));};exports[_0x9a88('0x33')]=function(_0x673213,_0x52a921,_0x311f21){var _0xc9cee2;return db[_0x9a88('0x38')]['find']({'where':{'id':_0x673213[_0x9a88('0x6c')]['id']}})[_0x9a88('0x32')](function(_0x28e836){_0xc9cee2=_0x28e836;return _0x28e836;})[_0x9a88('0x32')](handleEntityNotFound(_0x52a921,null))[_0x9a88('0x32')](removeEntity(_0x52a921,null))[_0x9a88('0x32')](function(){if(_0xc9cee2){return db['Network']['findAll']({'where':{'type':_0xc9cee2[_0x9a88('0x3a')]},'raw':!![]});}})[_0x9a88('0x32')](function(_0x2ccaaf){if(_0xc9cee2[_0x9a88('0x3a')][_0x9a88('0x57')]()==_0x9a88('0x69')){var _0x23257d=fs['readFileSync'](path['join'](config[_0x9a88('0x5a')],_0x9a88('0x5b')),_0x9a88('0x5c'));var _0x4cd09b=ejs[_0x9a88('0x61')](_0x23257d,{'networks':_0x2ccaaf||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4cd09b);return respondWithRpcPromise('Reload',_0x9a88('0x33'),{'module':'res_stun_monitor.so'});}else if(_0xc9cee2[_0x9a88('0x3a')][_0x9a88('0x57')]()==_0x9a88('0x6a')){var _0x270af0=fs['readFileSync'](path[_0x9a88('0x59')](config['root'],_0x9a88('0x60')),_0x9a88('0x5c'));var _0x2818e6=ejs['render'](_0x270af0,{'networks':_0x2ccaaf||[]});fs[_0x9a88('0x5d')]('/etc/asterisk/turn_xcally.conf',_0x2818e6);return respondWithRpcPromise(_0x9a88('0x5f'),'destroy',{'module':_0x9a88('0x63')});}else{var _0x3e3471=fs[_0x9a88('0x58')](path[_0x9a88('0x59')](config[_0x9a88('0x5a')],_0x9a88('0x6b')),_0x9a88('0x5c'));var _0x8c668b=ejs['render'](_0x3e3471,{'networks':_0x2ccaaf||[]});fs[_0x9a88('0x5d')](util[_0x9a88('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x673213[_0x9a88('0x66')]['type'][_0x9a88('0x67')]()),_0x8c668b);return respondWithRpcPromise(_0x9a88('0x5f'),'destroy',{'module':_0x9a88('0x68')});}return null;})[_0x9a88('0x25')](handleError(_0x52a921,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 4e870eb..41cab66 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 _0x7bae=['rimraf','../../config/environment','./network.attributes','exports','define','Network','network','../../config/logger','api','bluebird','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7bae,0x13b));var _0xe7ba=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7bae[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7ba('0x0'))(_0xe7ba('0x1'));var moment=require('moment');var BPromise=require(_0xe7ba('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7ba('0x3'));var rimraf=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var attributes=require(_0xe7ba('0x6'));module[_0xe7ba('0x7')]=function(_0xfd3a22,_0x2d31df){return _0xfd3a22[_0xe7ba('0x8')](_0xe7ba('0x9'),attributes,{'tableName':_0xe7ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./network.attributes','exports','network','lodash'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xe14d,0x1ee));var _0xde14=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xe14d[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Network',attributes,{'tableName':_0xde14('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 c8317c2..7c5e0a6 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 _0x8184=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4eedf0,_0x5a1c24){var _0x1a2a36=function(_0x4a146c){while(--_0x4a146c){_0x4eedf0['push'](_0x4eedf0['shift']());}};_0x1a2a36(++_0x5a1c24);}(_0x8184,0x120));var _0x4818=function(_0x4de752,_0x48e4dc){_0x4de752=_0x4de752-0x0;var _0x56792d=_0x8184[_0x4de752];return _0x56792d;};'use strict';var _=require(_0x4818('0x0'));var util=require(_0x4818('0x1'));var moment=require('moment');var BPromise=require(_0x4818('0x2'));var rs=require(_0x4818('0x3'));var fs=require('fs');var Redis=require(_0x4818('0x4'));var db=require(_0x4818('0x5'))['db'];var utils=require(_0x4818('0x6'));var logger=require(_0x4818('0x7'))(_0x4818('0x8'));var config=require(_0x4818('0x9'));var jayson=require(_0x4818('0xa'));var client=jayson[_0x4818('0xb')][_0x4818('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4314cb,_0x58c1b3,_0x2a8f66){return new BPromise(function(_0x1d383d,_0x12f00f){return client[_0x4818('0xd')](_0x4314cb,_0x2a8f66)[_0x4818('0xe')](function(_0x1b1d88){logger[_0x4818('0xf')](_0x4818('0x10'),_0x58c1b3,_0x4818('0x11'));logger['debug'](_0x4818('0x12'),_0x58c1b3,_0x4818('0x11'),JSON['stringify'](_0x1b1d88));if(_0x1b1d88[_0x4818('0x13')]){if(_0x1b1d88[_0x4818('0x13')][_0x4818('0x14')]===0x1f4){logger['error'](_0x4818('0x10'),_0x58c1b3,_0x1b1d88['error'][_0x4818('0x15')]);return _0x12f00f(_0x1b1d88[_0x4818('0x13')]['message']);}logger[_0x4818('0x13')]('Network,\x20%s,\x20%s',_0x58c1b3,_0x1b1d88['error'][_0x4818('0x15')]);return _0x1d383d(_0x1b1d88[_0x4818('0x13')][_0x4818('0x15')]);}else{logger['info'](_0x4818('0x10'),_0x58c1b3,_0x4818('0x11'));_0x1d383d(_0x1b1d88[_0x4818('0x16')][_0x4818('0x15')]);}})[_0x4818('0x17')](function(_0x1a1ea5){logger[_0x4818('0x13')](_0x4818('0x10'),_0x58c1b3,_0x1a1ea5);_0x12f00f(_0x1a1ea5);});});} \ No newline at end of file +var _0x691b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x38e02b,_0x12f7c4){var _0x47eb34=function(_0x3e6597){while(--_0x3e6597){_0x38e02b['push'](_0x38e02b['shift']());}};_0x47eb34(++_0x12f7c4);}(_0x691b,0x143));var _0xb691=function(_0x9fdd85,_0x56aa60){_0x9fdd85=_0x9fdd85-0x0;var _0x36bf4a=_0x691b[_0x9fdd85];return _0x36bf4a;};'use strict';var _=require(_0xb691('0x0'));var util=require(_0xb691('0x1'));var moment=require(_0xb691('0x2'));var BPromise=require(_0xb691('0x3'));var rs=require(_0xb691('0x4'));var fs=require('fs');var Redis=require(_0xb691('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb691('0x6'));var logger=require(_0xb691('0x7'))('rpc');var config=require(_0xb691('0x8'));var jayson=require(_0xb691('0x9'));var client=jayson[_0xb691('0xa')][_0xb691('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42efaf,_0x664e4f,_0x3663a7){return new BPromise(function(_0x57e55d,_0x326a27){return client[_0xb691('0xc')](_0x42efaf,_0x3663a7)[_0xb691('0xd')](function(_0x3e4801){logger['info'](_0xb691('0xe'),_0x664e4f,_0xb691('0xf'));logger[_0xb691('0x10')](_0xb691('0x11'),_0x664e4f,'request\x20sent',JSON[_0xb691('0x12')](_0x3e4801));if(_0x3e4801[_0xb691('0x13')]){if(_0x3e4801['error']['code']===0x1f4){logger[_0xb691('0x13')]('Network,\x20%s,\x20%s',_0x664e4f,_0x3e4801[_0xb691('0x13')][_0xb691('0x14')]);return _0x326a27(_0x3e4801[_0xb691('0x13')][_0xb691('0x14')]);}logger[_0xb691('0x13')](_0xb691('0xe'),_0x664e4f,_0x3e4801['error'][_0xb691('0x14')]);return _0x57e55d(_0x3e4801['error'][_0xb691('0x14')]);}else{logger[_0xb691('0x15')](_0xb691('0xe'),_0x664e4f,'request\x20sent');_0x57e55d(_0x3e4801['result'][_0xb691('0x14')]);}})[_0xb691('0x16')](function(_0x19be45){logger['error'](_0xb691('0xe'),_0x664e4f,_0x19be45);_0x326a27(_0x19be45);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 801f499..6cad6da 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 _0x98fe=['../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x98fe,0x1c2));var _0xe98f=function(_0x32cebd,_0x51e3d1){_0x32cebd=_0x32cebd-0x0;var _0x2129c8=_0x98fe[_0x32cebd];return _0x2129c8;};'use strict';var multer=require(_0xe98f('0x0'));var util=require(_0xe98f('0x1'));var path=require(_0xe98f('0x2'));var timeout=require('connect-timeout');var express=require(_0xe98f('0x3'));var router=express['Router']();var auth=require(_0xe98f('0x4'));var interaction=require(_0xe98f('0x5'));var config=require(_0xe98f('0x6'));var controller=require(_0xe98f('0x7'));router[_0xe98f('0x8')]('/',auth[_0xe98f('0x9')](),controller[_0xe98f('0xa')]);module[_0xe98f('0xb')]=router; \ No newline at end of file +var _0x3077=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','multer','util'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x3077,0x196));var _0x7307=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x3077[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x7307('0x0'));var util=require(_0x7307('0x1'));var path=require(_0x7307('0x2'));var timeout=require(_0x7307('0x3'));var express=require(_0x7307('0x4'));var router=express[_0x7307('0x5')]();var auth=require(_0x7307('0x6'));var interaction=require(_0x7307('0x7'));var config=require(_0x7307('0x8'));var controller=require(_0x7307('0x9'));router[_0x7307('0xa')]('/',auth[_0x7307('0xb')](),controller['sendNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 362696f..69dce4c 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 _0x1a92=['STRING','TEXT','BOOLEAN','sequelize','exports'];(function(_0x244d37,_0x12c4e2){var _0x2ec7f1=function(_0x2844a5){while(--_0x2844a5){_0x244d37['push'](_0x244d37['shift']());}};_0x2ec7f1(++_0x12c4e2);}(_0x1a92,0x134));var _0x21a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a92[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x21a9('0x0'));module[_0x21a9('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x21a9('0x2')]},'recipientsId':{'type':Sequelize[_0x21a9('0x3')]},'recipientsDescription':{'type':Sequelize[_0x21a9('0x2')]},'beep':{'type':Sequelize[_0x21a9('0x4')]}}; \ No newline at end of file +var _0xf408=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0xf38492,_0x45d84e){var _0x3e66e3=function(_0xf16ba){while(--_0xf16ba){_0xf38492['push'](_0xf38492['shift']());}};_0x3e66e3(++_0x45d84e);}(_0xf408,0x1d1));var _0x8f40=function(_0x2c065a,_0x44e071){_0x2c065a=_0x2c065a-0x0;var _0x16dcf0=_0xf408[_0x2c065a];return _0x16dcf0;};'use strict';var Sequelize=require(_0x8f40('0x0'));module[_0x8f40('0x1')]={'body':{'type':Sequelize[_0x8f40('0x2')]},'senderName':{'type':Sequelize[_0x8f40('0x3')]},'recipientsId':{'type':Sequelize[_0x8f40('0x2')]},'recipientsDescription':{'type':Sequelize[_0x8f40('0x3')]},'beep':{'type':Sequelize[_0x8f40('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index ae74e31..2c462b6 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 _0x8208=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','transaction','Notification','create','emit','notification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','startCase','toLowerCase','User','union','ids','queue','Queue','push','getAgents','map','html-pdf'];(function(_0x43435a,_0xb9f285){var _0x470bcd=function(_0x2bfc02){while(--_0x2bfc02){_0x43435a['push'](_0x43435a['shift']());}};_0x470bcd(++_0xb9f285);}(_0x8208,0x13a));var _0x8820=function(_0x2bdcc7,_0x1b35e6){_0x2bdcc7=_0x2bdcc7-0x0;var _0x47064b=_0x8208[_0x2bdcc7];return _0x47064b;};'use strict';var pdf=require(_0x8820('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8820('0x1'));var zipdir=require(_0x8820('0x2'));var jsonpatch=require(_0x8820('0x3'));var rp=require('request-promise');var moment=require(_0x8820('0x4'));var BPromise=require(_0x8820('0x5'));var Mustache=require(_0x8820('0x6'));var util=require(_0x8820('0x7'));var path=require(_0x8820('0x8'));var sox=require('sox');var csv=require(_0x8820('0x9'));var ejs=require(_0x8820('0xa'));var fs=require('fs');var _=require(_0x8820('0xb'));var squel=require(_0x8820('0xc'));var crypto=require(_0x8820('0xd'));var jsforce=require(_0x8820('0xe'));var deskjs=require(_0x8820('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8820('0x10'));var Papa=require(_0x8820('0x11'));var Redis=require(_0x8820('0x12'));var authService=require(_0x8820('0x13'));var qs=require(_0x8820('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8820('0x15'));var logger=require(_0x8820('0x16'))(_0x8820('0x17'));var utils=require(_0x8820('0x18'));var config=require(_0x8820('0x19'));var db=require('../../mysqldb')['db'];config[_0x8820('0x1a')]=_['defaults'](config[_0x8820('0x1a')],{'host':_0x8820('0x1b'),'port':0x18eb});var socket=require(_0x8820('0x1c'))(new Redis(config[_0x8820('0x1a')]));require('./notification.socket')[_0x8820('0x1d')](socket);function respondWithStatusCode(_0x5ead49,_0x5910bd){_0x5910bd=_0x5910bd||0xcc;return function(_0x2a632f){if(_0x2a632f){return _0x5ead49[_0x8820('0x1e')](_0x5910bd);}return _0x5ead49['status'](_0x5910bd)[_0x8820('0x1f')]();};}function respondWithResult(_0x5d542f,_0x1266fb){_0x1266fb=_0x1266fb||0xc8;return function(_0x2a3b17){if(_0x2a3b17){return _0x5d542f[_0x8820('0x20')](_0x1266fb)[_0x8820('0x21')](_0x2a3b17);}};}function respondWithFilteredResult(_0x1c4af5,_0x6ece40){return function(_0x5c432b){if(_0x5c432b){var _0x181ced=_0x5c432b['count'],_0x1bdaeb=_0x6ece40[_0x8820('0x22')],_0x5a32b7=_0x6ece40[_0x8820('0x22')]+_0x6ece40[_0x8820('0x23')],_0x713028;if(_0x5a32b7>=_0x181ced){_0x5a32b7=_0x181ced;_0x713028=0xc8;}else{_0x713028=0xce;}_0x1c4af5[_0x8820('0x20')](_0x713028);return _0x1c4af5[_0x8820('0x24')](_0x8820('0x25'),_0x1bdaeb+'-'+_0x5a32b7+'/'+_0x181ced)[_0x8820('0x21')](_0x5c432b);}return null;};}function patchUpdates(_0x3a5da3){return function(_0x3c2329){try{jsonpatch[_0x8820('0x26')](_0x3c2329,_0x3a5da3,!![]);}catch(_0x571a83){return BPromise[_0x8820('0x27')](_0x571a83);}return _0x3c2329[_0x8820('0x28')]();};}function saveUpdates(_0x413662,_0x7e1a34){return function(_0x50c332){if(_0x50c332){return _0x50c332[_0x8820('0x29')](_0x413662)[_0x8820('0x2a')](function(_0x21ae44){return _0x21ae44;});}return null;};}function removeEntity(_0x406401,_0x2fab15){return function(_0x11fefb){if(_0x11fefb){return _0x11fefb[_0x8820('0x2b')]()[_0x8820('0x2a')](function(){_0x406401[_0x8820('0x20')](0xcc)[_0x8820('0x1f')]();});}};}function handleEntityNotFound(_0x5829ea,_0x2d45b6){return function(_0x3a06bd){if(!_0x3a06bd){_0x5829ea[_0x8820('0x1e')](0x194);}return _0x3a06bd;};}function handleError(_0x29db9d,_0x4ec65c){_0x4ec65c=_0x4ec65c||0x1f4;return function(_0x576cc0){logger[_0x8820('0x2c')](_0x576cc0[_0x8820('0x2d')]);if(_0x576cc0[_0x8820('0x2e')]){delete _0x576cc0[_0x8820('0x2e')];}_0x29db9d[_0x8820('0x20')](_0x4ec65c)[_0x8820('0x2f')](_0x576cc0);};}exports[_0x8820('0x30')]=function(_0x23c1e8,_0x3d889d,_0x460fbf){if(!_0x23c1e8[_0x8820('0x31')][_0x8820('0x32')](_0x8820('0x33'))&&!_0x23c1e8[_0x8820('0x31')][_0x8820('0x32')](_0x8820('0x34'))){throw new db['Sequelize']['ValidationError'](_0x8820('0x35'));}else{if(_0x23c1e8[_0x8820('0x31')][_0x8820('0x32')](_0x8820('0x34'))&&!_0x23c1e8['body'][_0x8820('0x32')]('view')){throw new db[(_0x8820('0x36'))][(_0x8820('0x37'))](_0x8820('0x38'));}if(!_0x23c1e8['body'][_0x8820('0x32')](_0x8820('0x39'))){throw new db['Sequelize']['ValidationError'](_0x8820('0x3a'));}else{try{var _0x2ebcf7=JSON[_0x8820('0x3b')](_0x23c1e8[_0x8820('0x31')][_0x8820('0x39')]);}catch(_0x3daa30){logger[_0x8820('0x2c')](_0x3daa30);throw new db[(_0x8820('0x36'))][(_0x8820('0x37'))](_0x8820('0x3c'));}var _0x2e01a7=[_0x8820('0x3d'),_0x8820('0x3e'),_0x8820('0x3f'),_0x8820('0x40'),_0x8820('0x41'),_0x8820('0x42'),_0x8820('0x43'),_0x8820('0x44'),_0x8820('0x45')];if(_[_0x8820('0x46')](_0x2ebcf7,function(_0x2a2258){return!_[_0x8820('0x47')](_0x2e01a7,_0x2a2258[_0x8820('0x48')]['toLowerCase']());})){throw new db[(_0x8820('0x36'))][(_0x8820('0x37'))](_0x8820('0x49'));}}}var _0x19a372={};_0x19a372[_0x8820('0x4a')]=_0x23c1e8[_0x8820('0x31')][_0x8820('0x32')]('senderName')?_0x23c1e8[_0x8820('0x31')][_0x8820('0x4a')]:_0x23c1e8[_0x8820('0x45')][_0x8820('0x4b')];_0x19a372['recipientsDescription']=_[_0x8820('0x4c')](_0x23c1e8[_0x8820('0x31')][_0x8820('0x4d')])?null:_0x23c1e8[_0x8820('0x31')][_0x8820('0x4d')];_0x19a372[_0x8820('0x4e')]=_0x23c1e8['body'][_0x8820('0x4e')]||![];_0x19a372['SenderId']=_0x23c1e8['user']['id'];return getContent(_0x23c1e8[_0x8820('0x31')])[_0x8820('0x2a')](function(_0x51b978){_0x19a372['body']=_0x51b978;return getRecipients(_0x2ebcf7);})['then'](function(_0x77a78){_0x19a372[_0x8820('0x4f')]=_[_0x8820('0x50')](_0x77a78)[_0x8820('0x51')](',');return db[_0x8820('0x52')][_0x8820('0x53')](function(_0x1413c3){return db[_0x8820('0x54')][_0x8820('0x55')](_0x19a372,{'raw':!![],'transaction':_0x1413c3})['then'](function(_0x26e89b){var _0x437b4c={'sender':_0x19a372[_0x8820('0x4a')],'description':_0x19a372['recipientsDescription'],'content':_0x19a372[_0x8820('0x31')],'beep':_0x19a372[_0x8820('0x4e')]};_0x77a78['forEach'](function(_0x2fa7ae){_0x437b4c['recipient']=_0x2fa7ae;socket[_0x8820('0x56')](_0x8820('0x57'),_0x437b4c);});return _0x26e89b;});});})['then'](respondWithResult(_0x3d889d,0xc9))[_0x8820('0x58')](handleError(_0x3d889d,null));};function getContent(_0x33b464){return new BPromise(function(_0x77d065,_0x58054d){if(_0x33b464['text']){_0x77d065(_0x33b464['text']);return;}return db[_0x8820('0x59')][_0x8820('0x5a')]({'attributes':['html'],'where':{'id':_0x33b464[_0x8820('0x34')]},'raw':!![]})[_0x8820('0x2a')](function(_0x567563){if(!_0x567563)throw new db[(_0x8820('0x36'))][(_0x8820('0x37'))](_0x8820('0x5b'));var _0x4b8a8e=Mustache[_0x8820('0x5c')](_0x567563[_0x8820('0x5d')],_0x33b464[_0x8820('0x5e')]);_0x77d065(_0x4b8a8e);})[_0x8820('0x58')](function(_0x12256e){_0x58054d(_0x12256e);});});}function getRecipients(_0x13003d){return new BPromise(function(_0x4ce55b,_0x59fc79){var _0x3efdcb=[];var _0x1ff6d2=[];_0x13003d['forEach'](function(_0x2495f1){var _0x5b3ccd=_[_0x8820('0x5f')](_0x2495f1[_0x8820('0x48')][_0x8820('0x60')]());if(_0x5b3ccd===_0x8820('0x61')){_0x3efdcb=_[_0x8820('0x62')](_0x3efdcb,_0x2495f1[_0x8820('0x63')]);}else{if(_[_0x8820('0x47')](_0x5b3ccd,_0x8820('0x64')))_0x5b3ccd=_0x5b3ccd['replace'](_0x8820('0x64'),_0x8820('0x65'));_0x2495f1[_0x8820('0x63')]['forEach'](function(_0x3e967c){_0x1ff6d2[_0x8820('0x66')](getAgents(_0x5b3ccd,_0x3e967c));});}});return BPromise['all'](_0x1ff6d2)[_0x8820('0x2a')](function(_0x34c852){_0x3efdcb=_['union'](_0x3efdcb,_['flatten'](_0x34c852));_0x4ce55b(_0x3efdcb);})[_0x8820('0x58')](function(_0x293d8b){_0x59fc79(_0x293d8b);});});}function getAgents(_0x30939c,_0x1aa532){return new BPromise(function(_0x3b8e8d,_0x4814c4){return db[_0x30939c][_0x8820('0x5a')]({'where':{'id':_0x1aa532}})[_0x8820('0x2a')](function(_0x7f1068){return _0x7f1068[_0x8820('0x67')]({'attributes':['id'],'raw':!![]})[_0x8820('0x2a')](function(_0x39ffcb){var _0x1d6f44=_[_0x8820('0x68')](_0x39ffcb,'id');_0x3b8e8d(_0x1d6f44);});})[_0x8820('0x58')](function(_0x1a2e1e){_0x4814c4(_0x1a2e1e);});});} \ No newline at end of file +var _0xe3da=['request-promise','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','sendStatus','status','end','json','count','limit','Content-Range','reject','save','update','destroy','then','error','stack','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','faxqueue','mailqueue','openchannelqueue','smsqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','create','forEach','recipient','emit','notification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','replace','queue','Queue','push','all','union','flatten','findOne','map','zip-dir','fast-json-patch'];(function(_0x32cc73,_0x156188){var _0x3d3404=function(_0x4450e6){while(--_0x4450e6){_0x32cc73['push'](_0x32cc73['shift']());}};_0x3d3404(++_0x156188);}(_0xe3da,0x11b));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae3d('0x0'));var jsonpatch=require(_0xae3d('0x1'));var rp=require(_0xae3d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xae3d('0x3'));var util=require(_0xae3d('0x4'));var path=require(_0xae3d('0x5'));var sox=require(_0xae3d('0x6'));var csv=require(_0xae3d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae3d('0x8'));var squel=require(_0xae3d('0x9'));var crypto=require('crypto');var jsforce=require(_0xae3d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xae3d('0x7'));var querystring=require(_0xae3d('0xb'));var Papa=require(_0xae3d('0xc'));var Redis=require(_0xae3d('0xd'));var authService=require(_0xae3d('0xe'));var qs=require(_0xae3d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae3d('0x10'));var logger=require(_0xae3d('0x11'))('api');var utils=require(_0xae3d('0x12'));var config=require(_0xae3d('0x13'));var db=require(_0xae3d('0x14'))['db'];config[_0xae3d('0x15')]=_[_0xae3d('0x16')](config[_0xae3d('0x15')],{'host':_0xae3d('0x17'),'port':0x18eb});var socket=require(_0xae3d('0x18'))(new Redis(config[_0xae3d('0x15')]));require(_0xae3d('0x19'))['register'](socket);function respondWithStatusCode(_0x42fb55,_0xa36351){_0xa36351=_0xa36351||0xcc;return function(_0x13deb3){if(_0x13deb3){return _0x42fb55[_0xae3d('0x1a')](_0xa36351);}return _0x42fb55[_0xae3d('0x1b')](_0xa36351)[_0xae3d('0x1c')]();};}function respondWithResult(_0x5315bf,_0x375714){_0x375714=_0x375714||0xc8;return function(_0x4c8750){if(_0x4c8750){return _0x5315bf['status'](_0x375714)[_0xae3d('0x1d')](_0x4c8750);}};}function respondWithFilteredResult(_0x40240e,_0x21e3b0){return function(_0x4a8494){if(_0x4a8494){var _0xd1ae39=_0x4a8494[_0xae3d('0x1e')],_0x211ae7=_0x21e3b0['offset'],_0xa7bb80=_0x21e3b0['offset']+_0x21e3b0[_0xae3d('0x1f')],_0x45c137;if(_0xa7bb80>=_0xd1ae39){_0xa7bb80=_0xd1ae39;_0x45c137=0xc8;}else{_0x45c137=0xce;}_0x40240e[_0xae3d('0x1b')](_0x45c137);return _0x40240e['set'](_0xae3d('0x20'),_0x211ae7+'-'+_0xa7bb80+'/'+_0xd1ae39)[_0xae3d('0x1d')](_0x4a8494);}return null;};}function patchUpdates(_0x248e2a){return function(_0x1e25b9){try{jsonpatch['apply'](_0x1e25b9,_0x248e2a,!![]);}catch(_0x523e56){return BPromise[_0xae3d('0x21')](_0x523e56);}return _0x1e25b9[_0xae3d('0x22')]();};}function saveUpdates(_0x17f344,_0xd16f31){return function(_0x3ff6ae){if(_0x3ff6ae){return _0x3ff6ae[_0xae3d('0x23')](_0x17f344)['then'](function(_0xcd1178){return _0xcd1178;});}return null;};}function removeEntity(_0x2b5d10,_0x521663){return function(_0x273161){if(_0x273161){return _0x273161[_0xae3d('0x24')]()[_0xae3d('0x25')](function(){_0x2b5d10['status'](0xcc)[_0xae3d('0x1c')]();});}};}function handleEntityNotFound(_0x295290,_0x5a1833){return function(_0x106e44){if(!_0x106e44){_0x295290[_0xae3d('0x1a')](0x194);}return _0x106e44;};}function handleError(_0x5ca451,_0x2cd9a2){_0x2cd9a2=_0x2cd9a2||0x1f4;return function(_0x39a0d4){logger[_0xae3d('0x26')](_0x39a0d4[_0xae3d('0x27')]);if(_0x39a0d4['name']){delete _0x39a0d4[_0xae3d('0x28')];}_0x5ca451[_0xae3d('0x1b')](_0x2cd9a2)[_0xae3d('0x29')](_0x39a0d4);};}exports[_0xae3d('0x2a')]=function(_0x4a6beb,_0x215930,_0x25b207){if(!_0x4a6beb[_0xae3d('0x2b')][_0xae3d('0x2c')](_0xae3d('0x2d'))&&!_0x4a6beb[_0xae3d('0x2b')]['hasOwnProperty']('TemplateId')){throw new db['Sequelize'][(_0xae3d('0x2e'))](_0xae3d('0x2f'));}else{if(_0x4a6beb[_0xae3d('0x2b')][_0xae3d('0x2c')](_0xae3d('0x30'))&&!_0x4a6beb[_0xae3d('0x2b')]['hasOwnProperty'](_0xae3d('0x31'))){throw new db[(_0xae3d('0x32'))]['ValidationError'](_0xae3d('0x33'));}if(!_0x4a6beb[_0xae3d('0x2b')][_0xae3d('0x2c')](_0xae3d('0x34'))){throw new db[(_0xae3d('0x32'))][(_0xae3d('0x2e'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2b3284=JSON[_0xae3d('0x35')](_0x4a6beb[_0xae3d('0x2b')][_0xae3d('0x34')]);}catch(_0x4b41d2){logger['error'](_0x4b41d2);throw new db[(_0xae3d('0x32'))][(_0xae3d('0x2e'))](_0xae3d('0x36'));}var _0x62c839=['chatqueue',_0xae3d('0x37'),_0xae3d('0x38'),_0xae3d('0x39'),_0xae3d('0x3a'),'voicequeue','whatsappqueue',_0xae3d('0x3b'),_0xae3d('0x3c')];if(_[_0xae3d('0x3d')](_0x2b3284,function(_0x277e9b){return!_[_0xae3d('0x3e')](_0x62c839,_0x277e9b[_0xae3d('0x3f')]['toLowerCase']());})){throw new db[(_0xae3d('0x32'))][(_0xae3d('0x2e'))](_0xae3d('0x40'));}}}var _0x373224={};_0x373224[_0xae3d('0x41')]=_0x4a6beb[_0xae3d('0x2b')][_0xae3d('0x2c')](_0xae3d('0x41'))?_0x4a6beb['body'][_0xae3d('0x41')]:_0x4a6beb['user'][_0xae3d('0x42')];_0x373224[_0xae3d('0x43')]=_[_0xae3d('0x44')](_0x4a6beb[_0xae3d('0x2b')][_0xae3d('0x43')])?null:_0x4a6beb['body'][_0xae3d('0x43')];_0x373224['beep']=_0x4a6beb['body'][_0xae3d('0x45')]||![];_0x373224[_0xae3d('0x46')]=_0x4a6beb[_0xae3d('0x3c')]['id'];return getContent(_0x4a6beb[_0xae3d('0x2b')])[_0xae3d('0x25')](function(_0x1bf500){_0x373224['body']=_0x1bf500;return getRecipients(_0x2b3284);})[_0xae3d('0x25')](function(_0x17aa5b){_0x373224[_0xae3d('0x47')]=_[_0xae3d('0x48')](_0x17aa5b)['join'](',');return db[_0xae3d('0x49')][_0xae3d('0x4a')](function(_0x54d8f3){return db['Notification'][_0xae3d('0x4b')](_0x373224,{'raw':!![],'transaction':_0x54d8f3})['then'](function(_0x591565){var _0x42e285={'sender':_0x373224['senderName'],'description':_0x373224[_0xae3d('0x43')],'content':_0x373224[_0xae3d('0x2b')],'beep':_0x373224[_0xae3d('0x45')]};_0x17aa5b[_0xae3d('0x4c')](function(_0x154c51){_0x42e285[_0xae3d('0x4d')]=_0x154c51;socket[_0xae3d('0x4e')](_0xae3d('0x4f'),_0x42e285);});return _0x591565;});});})[_0xae3d('0x25')](respondWithResult(_0x215930,0xc9))[_0xae3d('0x50')](handleError(_0x215930,null));};function getContent(_0x117533){return new BPromise(function(_0x511ecd,_0x37be7f){if(_0x117533[_0xae3d('0x2d')]){_0x511ecd(_0x117533[_0xae3d('0x2d')]);return;}return db[_0xae3d('0x51')]['findOne']({'attributes':['html'],'where':{'id':_0x117533['TemplateId']},'raw':!![]})['then'](function(_0x4f889d){if(!_0x4f889d)throw new db[(_0xae3d('0x32'))][(_0xae3d('0x2e'))](_0xae3d('0x52'));var _0xc7bbf5=Mustache[_0xae3d('0x53')](_0x4f889d[_0xae3d('0x54')],_0x117533[_0xae3d('0x31')]);_0x511ecd(_0xc7bbf5);})[_0xae3d('0x50')](function(_0x5d991d){_0x37be7f(_0x5d991d);});});}function getRecipients(_0x581347){return new BPromise(function(_0x5d5f7f,_0x569e4a){var _0x1b88ec=[];var _0x13fede=[];_0x581347[_0xae3d('0x4c')](function(_0x5e7bde){var _0x5dafb7=_[_0xae3d('0x55')](_0x5e7bde[_0xae3d('0x3f')]['toLowerCase']());if(_0x5dafb7==='User'){_0x1b88ec=_['union'](_0x1b88ec,_0x5e7bde['ids']);}else{if(_['includes'](_0x5dafb7,'queue'))_0x5dafb7=_0x5dafb7[_0xae3d('0x56')](_0xae3d('0x57'),_0xae3d('0x58'));_0x5e7bde['ids'][_0xae3d('0x4c')](function(_0x29b358){_0x13fede[_0xae3d('0x59')](getAgents(_0x5dafb7,_0x29b358));});}});return BPromise[_0xae3d('0x5a')](_0x13fede)[_0xae3d('0x25')](function(_0x579424){_0x1b88ec=_[_0xae3d('0x5b')](_0x1b88ec,_[_0xae3d('0x5c')](_0x579424));_0x5d5f7f(_0x1b88ec);})[_0xae3d('0x50')](function(_0x41b5fc){_0x569e4a(_0x41b5fc);});});}function getAgents(_0x5aac62,_0x42a7ce){return new BPromise(function(_0x41dc47,_0x151b8e){return db[_0x5aac62][_0xae3d('0x5d')]({'where':{'id':_0x42a7ce}})[_0xae3d('0x25')](function(_0x541436){return _0x541436['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x139755){var _0x242995=_[_0xae3d('0x5e')](_0x139755,'id');_0x41dc47(_0x242995);});})[_0xae3d('0x50')](function(_0x3726fb){_0x151b8e(_0x3726fb);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 9504dd6..0dea8ee 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 _0x0b0e=['Notification','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4264c1,_0x5d9dc0){var _0x52d805=function(_0x327b83){while(--_0x327b83){_0x4264c1['push'](_0x4264c1['shift']());}};_0x52d805(++_0x5d9dc0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0x0b0e[_0x3c414c];return _0x4f3062;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var Notification=require('../../mysqldb')['db'][_0xe0b0('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){NotificationEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);NotificationEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];Notification[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x5a9033,_0x3f63c1){var _0x56438f=function(_0x277714){while(--_0x277714){_0x5a9033['push'](_0x5a9033['shift']());}};_0x56438f(++_0x3f63c1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 0f4f1d4..8f6b6dd 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 _0x1775=['request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var logger=require(_0x5177('0x1'))(_0x5177('0x2'));var moment=require(_0x5177('0x3'));var BPromise=require(_0x5177('0x4'));var rp=require(_0x5177('0x5'));var fs=require('fs');var path=require(_0x5177('0x6'));var rimraf=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var attributes=require(_0x5177('0x9'));module[_0x5177('0xa')]=function(_0x2c5c42,_0x153c1a){return _0x2c5c42[_0x5177('0xb')](_0x5177('0xc'),attributes,{'tableName':_0x5177('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5177('0xe'),'collate':_0x5177('0xf')});}; \ No newline at end of file +var _0xb7e7=['Notification','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./notification.attributes','define'];(function(_0x19bf7a,_0x19c529){var _0x326db3=function(_0x1ee683){while(--_0x1ee683){_0x19bf7a['push'](_0x19bf7a['shift']());}};_0x326db3(++_0x19c529);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb7e7[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 344be13..2a4ca23 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 _0x9468=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x9468,0x12c));var _0x8946=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x9468[_0x4715d2];return _0x141811;};'use strict';var _=require(_0x8946('0x0'));var util=require(_0x8946('0x1'));var moment=require(_0x8946('0x2'));var BPromise=require('bluebird');var rs=require(_0x8946('0x3'));var fs=require('fs');var Redis=require(_0x8946('0x4'));var db=require(_0x8946('0x5'))['db'];var utils=require(_0x8946('0x6'));var logger=require(_0x8946('0x7'))(_0x8946('0x8'));var config=require('../../config/environment');var jayson=require(_0x8946('0x9'));var client=jayson[_0x8946('0xa')][_0x8946('0xb')]({'port':0x232a});config['redis']=_[_0x8946('0xc')](config['redis'],{'host':_0x8946('0xd'),'port':0x18eb});var socket=require(_0x8946('0xe'))(new Redis(config[_0x8946('0xf')]));require('./notification.socket')[_0x8946('0x10')](socket);function respondWithRpcPromise(_0x3a2336,_0x2ab8c4,_0x385b27){return new BPromise(function(_0x877918,_0x41cba4){return client[_0x8946('0x11')](_0x3a2336,_0x385b27)[_0x8946('0x12')](function(_0x3189bc){logger['info'](_0x8946('0x13'),_0x2ab8c4,_0x8946('0x14'));logger[_0x8946('0x15')](_0x8946('0x16'),_0x2ab8c4,'request\x20sent',JSON[_0x8946('0x17')](_0x3189bc));if(_0x3189bc['error']){if(_0x3189bc[_0x8946('0x18')][_0x8946('0x19')]===0x1f4){logger[_0x8946('0x18')]('Notification,\x20%s,\x20%s',_0x2ab8c4,_0x3189bc[_0x8946('0x18')][_0x8946('0x1a')]);return _0x41cba4(_0x3189bc['error']['message']);}logger[_0x8946('0x18')](_0x8946('0x13'),_0x2ab8c4,_0x3189bc['error'][_0x8946('0x1a')]);return _0x877918(_0x3189bc[_0x8946('0x18')][_0x8946('0x1a')]);}else{logger[_0x8946('0x1b')]('Notification,\x20%s,\x20%s',_0x2ab8c4,'request\x20sent');_0x877918(_0x3189bc[_0x8946('0x1c')][_0x8946('0x1a')]);}})[_0x8946('0x1d')](function(_0x927c6b){logger[_0x8946('0x18')](_0x8946('0x13'),_0x2ab8c4,_0x927c6b);_0x41cba4(_0x927c6b);});});} \ No newline at end of file +var _0xaa8a=['defaults','localhost','socket.io-emitter','./notification.socket','then','info','Notification,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x4e0406,_0x2b01e8){var _0x48e193=function(_0x3839b3){while(--_0x3839b3){_0x4e0406['push'](_0x4e0406['shift']());}};_0x48e193(++_0x2b01e8);}(_0xaa8a,0x1b5));var _0xaaa8=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xaa8a[_0x270adf];return _0x29eda9;};'use strict';var _=require(_0xaaa8('0x0'));var util=require(_0xaaa8('0x1'));var moment=require(_0xaaa8('0x2'));var BPromise=require(_0xaaa8('0x3'));var rs=require(_0xaaa8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaaa8('0x5'))['db'];var utils=require(_0xaaa8('0x6'));var logger=require(_0xaaa8('0x7'))(_0xaaa8('0x8'));var config=require('../../config/environment');var jayson=require(_0xaaa8('0x9'));var client=jayson[_0xaaa8('0xa')][_0xaaa8('0xb')]({'port':0x232a});config[_0xaaa8('0xc')]=_[_0xaaa8('0xd')](config[_0xaaa8('0xc')],{'host':_0xaaa8('0xe'),'port':0x18eb});var socket=require(_0xaaa8('0xf'))(new Redis(config['redis']));require(_0xaaa8('0x10'))['register'](socket);function respondWithRpcPromise(_0x39e7ee,_0x53a2ac,_0x4edcd0){return new BPromise(function(_0x399b27,_0x54beb5){return client['request'](_0x39e7ee,_0x4edcd0)[_0xaaa8('0x11')](function(_0x58b1b4){logger[_0xaaa8('0x12')](_0xaaa8('0x13'),_0x53a2ac,'request\x20sent');logger['debug']('Notification,\x20%s,\x20%s,\x20%s',_0x53a2ac,'request\x20sent',JSON[_0xaaa8('0x14')](_0x58b1b4));if(_0x58b1b4['error']){if(_0x58b1b4[_0xaaa8('0x15')]['code']===0x1f4){logger['error'](_0xaaa8('0x13'),_0x53a2ac,_0x58b1b4[_0xaaa8('0x15')][_0xaaa8('0x16')]);return _0x54beb5(_0x58b1b4['error']['message']);}logger['error'](_0xaaa8('0x13'),_0x53a2ac,_0x58b1b4['error'][_0xaaa8('0x16')]);return _0x399b27(_0x58b1b4[_0xaaa8('0x15')][_0xaaa8('0x16')]);}else{logger[_0xaaa8('0x12')](_0xaaa8('0x13'),_0x53a2ac,_0xaaa8('0x17'));_0x399b27(_0x58b1b4[_0xaaa8('0x18')][_0xaaa8('0x16')]);}})['catch'](function(_0x4bc7ca){logger[_0xaaa8('0x15')](_0xaaa8('0x13'),_0x53a2ac,_0x4bc7ca);_0x54beb5(_0x4bc7ca);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 185ecad..cad5db8 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 _0x68a8=['save','remove','emit','register','length','notification:','./notification.events'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x68a8,0x19c));var _0x868a=function(_0x16e995,_0x548715){_0x16e995=_0x16e995-0x0;var _0x19e63f=_0x68a8[_0x16e995];return _0x19e63f;};'use strict';var NotificationEvents=require(_0x868a('0x0'));var events=[_0x868a('0x1'),_0x868a('0x2'),'update'];function createListener(_0x2b5e72,_0x1f6063){return function(_0xbf5a18){_0x1f6063[_0x868a('0x3')](_0x2b5e72,_0xbf5a18);};}function removeListener(_0x14d137,_0x1323b9){return function(){NotificationEvents['removeListener'](_0x14d137,_0x1323b9);};}exports[_0x868a('0x4')]=function(_0x3495c6){for(var _0x4cf9d5=0x0,_0x28182d=events[_0x868a('0x5')];_0x4cf9d5<_0x28182d;_0x4cf9d5++){var _0x564953=events[_0x4cf9d5];var _0x29c82b=createListener(_0x868a('0x6')+_0x564953,_0x3495c6);NotificationEvents['on'](_0x564953,_0x29c82b);}}; \ No newline at end of file +var _0x74ec=['emit','length','./notification.events','save'];(function(_0x50091c,_0x2cee26){var _0x27a165=function(_0x291d24){while(--_0x291d24){_0x50091c['push'](_0x50091c['shift']());}};_0x27a165(++_0x2cee26);}(_0x74ec,0x13a));var _0xc74e=function(_0x712020,_0x5deab0){_0x712020=_0x712020-0x0;var _0x522ff6=_0x74ec[_0x712020];return _0x522ff6;};'use strict';var NotificationEvents=require(_0xc74e('0x0'));var events=[_0xc74e('0x1'),'remove','update'];function createListener(_0x1ecf57,_0x511379){return function(_0x2d7f2){_0x511379[_0xc74e('0x2')](_0x1ecf57,_0x2d7f2);};}function removeListener(_0x54930b,_0x9c016c){return function(){NotificationEvents['removeListener'](_0x54930b,_0x9c016c);};}exports['register']=function(_0x302cc9){for(var _0x1f7459=0x0,_0x7c525d=events[_0xc74e('0x3')];_0x1f7459<_0x7c525d;_0x1f7459++){var _0x148419=events[_0x1f7459];var _0x112c9b=createListener('notification:'+_0x148419,_0x302cc9);NotificationEvents['on'](_0x148419,_0x112c9b);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index b3a97e8..5c04921 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 _0xb943=['index','get','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','/:id/send','send','put','update','delete','destroy','removeAnswers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated'];(function(_0x893aa8,_0x1ac7ed){var _0x56b6c4=function(_0xcd84a2){while(--_0xcd84a2){_0x893aa8['push'](_0x893aa8['shift']());}};_0x56b6c4(++_0x1ac7ed);}(_0xb943,0xda));var _0x3b94=function(_0xef6a97,_0x39bf2d){_0xef6a97=_0xef6a97-0x0;var _0x408cf0=_0xb943[_0xef6a97];return _0x408cf0;};'use strict';var multer=require(_0x3b94('0x0'));var util=require('util');var path=require(_0x3b94('0x1'));var timeout=require(_0x3b94('0x2'));var express=require(_0x3b94('0x3'));var router=express[_0x3b94('0x4')]();var auth=require(_0x3b94('0x5'));var interaction=require(_0x3b94('0x6'));var config=require(_0x3b94('0x7'));var controller=require(_0x3b94('0x8'));router['get']('/',auth[_0x3b94('0x9')](),controller[_0x3b94('0xa')]);router[_0x3b94('0xb')](_0x3b94('0xc'),auth['isAuthenticated'](),controller[_0x3b94('0xd')]);router[_0x3b94('0xb')](_0x3b94('0xe'),auth[_0x3b94('0x9')](),controller['show']);router[_0x3b94('0xb')]('/:id/dispositions',auth[_0x3b94('0x9')](),controller[_0x3b94('0xf')]);router[_0x3b94('0xb')](_0x3b94('0x10'),auth[_0x3b94('0x9')](),controller[_0x3b94('0x11')]);router['get'](_0x3b94('0x12'),auth[_0x3b94('0x9')](),controller['getApplications']);router[_0x3b94('0xb')](_0x3b94('0x13'),auth['isAuthenticated'](),controller[_0x3b94('0x14')]);router[_0x3b94('0xb')](_0x3b94('0x15'),auth['isAuthenticated'](),controller[_0x3b94('0x16')]);router[_0x3b94('0x17')]('/',auth['isAuthenticated'](),controller[_0x3b94('0x18')]);router['post'](_0x3b94('0x19'),auth[_0x3b94('0x9')](),controller[_0x3b94('0x1a')]);router[_0x3b94('0x17')](_0x3b94('0x10'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x3b94('0x1b'),controller[_0x3b94('0x1c')]);router['post'](_0x3b94('0x12'),auth[_0x3b94('0x9')](),controller[_0x3b94('0x1d')]);router[_0x3b94('0x17')](_0x3b94('0x15'),auth[_0x3b94('0x9')](),controller['addAgents']);router[_0x3b94('0x17')](_0x3b94('0x1e'),auth[_0x3b94('0x9')](),controller[_0x3b94('0x1f')]);router[_0x3b94('0x20')](_0x3b94('0xe'),auth[_0x3b94('0x9')](),controller[_0x3b94('0x21')]);router[_0x3b94('0x22')](_0x3b94('0xe'),auth[_0x3b94('0x9')](),controller[_0x3b94('0x23')]);router['delete']('/:id/dispositions',auth[_0x3b94('0x9')](),controller['removeDispositions']);router[_0x3b94('0x22')](_0x3b94('0x10'),auth['isAuthenticated'](),controller[_0x3b94('0x24')]);router[_0x3b94('0x22')](_0x3b94('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3b94('0x25')]=router; \ No newline at end of file +var _0xf8a4=['post','create','/:id/dispositions','addDisposition','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','update','delete','removeDispositions','removeAnswers','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/interactions','/:id/users','getAgents'];(function(_0x1610a9,_0x3cf98d){var _0x407dd7=function(_0x33dc87){while(--_0x33dc87){_0x1610a9['push'](_0x1610a9['shift']());}};_0x407dd7(++_0x3cf98d);}(_0xf8a4,0x19b));var _0x4f8a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf8a4[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4f8a('0x0'));var timeout=require(_0x4f8a('0x1'));var express=require(_0x4f8a('0x2'));var router=express[_0x4f8a('0x3')]();var auth=require(_0x4f8a('0x4'));var interaction=require(_0x4f8a('0x5'));var config=require('../../config/environment');var controller=require(_0x4f8a('0x6'));router[_0x4f8a('0x7')]('/',auth[_0x4f8a('0x8')](),controller['index']);router[_0x4f8a('0x7')](_0x4f8a('0x9'),auth[_0x4f8a('0x8')](),controller[_0x4f8a('0xa')]);router[_0x4f8a('0x7')](_0x4f8a('0xb'),auth[_0x4f8a('0x8')](),controller[_0x4f8a('0xc')]);router[_0x4f8a('0x7')]('/:id/dispositions',auth[_0x4f8a('0x8')](),controller['getDispositions']);router[_0x4f8a('0x7')](_0x4f8a('0xd'),auth['isAuthenticated'](),controller[_0x4f8a('0xe')]);router[_0x4f8a('0x7')]('/:id/applications',auth[_0x4f8a('0x8')](),controller['getApplications']);router['get'](_0x4f8a('0xf'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x4f8a('0x7')](_0x4f8a('0x10'),auth['isAuthenticated'](),controller[_0x4f8a('0x11')]);router[_0x4f8a('0x12')]('/',auth['isAuthenticated'](),controller[_0x4f8a('0x13')]);router['post'](_0x4f8a('0x14'),auth['isAuthenticated'](),controller[_0x4f8a('0x15')]);router['post'](_0x4f8a('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x4f8a('0x12')](_0x4f8a('0x16'),controller[_0x4f8a('0x17')]);router[_0x4f8a('0x12')](_0x4f8a('0x18'),auth[_0x4f8a('0x8')](),controller[_0x4f8a('0x19')]);router[_0x4f8a('0x12')](_0x4f8a('0x10'),auth[_0x4f8a('0x8')](),controller['addAgents']);router['post'](_0x4f8a('0x1a'),auth[_0x4f8a('0x8')](),controller[_0x4f8a('0x1b')]);router['put']('/:id',auth[_0x4f8a('0x8')](),controller[_0x4f8a('0x1c')]);router[_0x4f8a('0x1d')](_0x4f8a('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f8a('0x1d')](_0x4f8a('0x14'),auth[_0x4f8a('0x8')](),controller[_0x4f8a('0x1e')]);router[_0x4f8a('0x1d')]('/:id/canned_answers',auth[_0x4f8a('0x8')](),controller[_0x4f8a('0x1f')]);router[_0x4f8a('0x1d')](_0x4f8a('0x10'),auth[_0x4f8a('0x8')](),controller['removeAgents']);module[_0x4f8a('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 6077662..4ead591 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 _0x43ce=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x43ce,0x1ec));var _0xe43c=function(_0x301225,_0x3dad7a){_0x301225=_0x301225-0x0;var _0x352b72=_0x43ce[_0x301225];return _0x352b72;};'use strict';var Sequelize=require(_0xe43c('0x0'));var rs=require(_0xe43c('0x1'));module[_0xe43c('0x2')]={'name':{'type':Sequelize[_0xe43c('0x3')],'unique':_0xe43c('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xe43c('0x3')]},'token':{'type':Sequelize[_0xe43c('0x3')],'defaultValue':function(){return rs[_0xe43c('0x5')]();}},'replyUri':{'type':Sequelize[_0xe43c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe43c('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe43c('0x6')],'defaultValue':function(){return _0xe43c('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe43c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe43c('0x3')]},'queueTransfer':{'type':Sequelize[_0xe43c('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe43c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe43c('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe43c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe43c('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xe43c('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xe43c('0x9')],'defaultValue':![],'comment':_0xe43c('0xb'),'set':function(_0x12e375){if(!_0x12e375)this[_0xe43c('0xc')](_0xe43c('0xd'),null);this[_0xe43c('0xc')]('mandatoryDisposition',_0x12e375);}}}; \ No newline at end of file +var _0xd2fc=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xd2fc,0x180));var _0xcd2f=function(_0x3efccf,_0x23beef){_0x3efccf=_0x3efccf-0x0;var _0x21c196=_0xd2fc[_0x3efccf];return _0x21c196;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xcd2f('0x0')]={'name':{'type':Sequelize[_0xcd2f('0x1')],'unique':_0xcd2f('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xcd2f('0x1')],'defaultValue':function(){return rs[_0xcd2f('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcd2f('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcd2f('0x4')],'defaultValue':function(){return _0xcd2f('0x5');}},'notificationSound':{'type':Sequelize[_0xcd2f('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcd2f('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcd2f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcd2f('0x1')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcd2f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd2f('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xcd2f('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xcd2f('0x6')],'defaultValue':![],'comment':_0xcd2f('0x9'),'set':function(_0x2d70d7){if(!_0x2d70d7)this[_0xcd2f('0xa')](_0xcd2f('0xb'),null);this[_0xcd2f('0xa')](_0xcd2f('0xc'),_0x2d70d7);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 1c68836..9559def 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 _0xe7ed=['Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','Pause','map','OpenchannelAccount','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','mandatoryDispositionPause','keys','length','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','OpenchannelAccountId','removeDispositions','ids','CannedAnswer','getAnswers','order','removeAnswers','notify','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','User','UserId','unshift','agent','forcedOwnership','Start','startRouting','EventManager','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','dataValues'];(function(_0x37ae17,_0x12491a){var _0x24b60f=function(_0x20ae90){while(--_0x20ae90){_0x37ae17['push'](_0x37ae17['shift']());}};_0x24b60f(++_0x12491a);}(_0xe7ed,0x16b));var _0xde7e=function(_0x3d9eb0,_0x11c684){_0x3d9eb0=_0x3d9eb0-0x0;var _0xe13611=_0xe7ed[_0x3d9eb0];return _0xe13611;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xde7e('0x0'));var rimraf=require(_0xde7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde7e('0x2'));var rp=require(_0xde7e('0x3'));var moment=require(_0xde7e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xde7e('0x5'));var util=require(_0xde7e('0x6'));var path=require(_0xde7e('0x7'));var sox=require(_0xde7e('0x8'));var csv=require(_0xde7e('0x9'));var ejs=require(_0xde7e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xde7e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xde7e('0xc'));var toCsv=require(_0xde7e('0x9'));var querystring=require('querystring');var Papa=require(_0xde7e('0xd'));var Redis=require(_0xde7e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xde7e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xde7e('0x10'))(_0xde7e('0x11'));var utils=require(_0xde7e('0x12'));var config=require(_0xde7e('0x13'));var db=require(_0xde7e('0x14'))['db'];config[_0xde7e('0x15')]=_[_0xde7e('0x16')](config[_0xde7e('0x15')],{'host':_0xde7e('0x17'),'port':0x18eb});var socket=require(_0xde7e('0x18'))(new Redis(config[_0xde7e('0x15')]));require(_0xde7e('0x19'))[_0xde7e('0x1a')](socket);var jayson=require(_0xde7e('0x1b'));var client=jayson['client'][_0xde7e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xde7e('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x16659a,_0x33881d,_0x584676){if(_0x584676){var _0x1aa44c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1aa44c['test'](_0x33881d)){return _0x16659a;}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 _0x16659a;}}function respondWithRpcPromise(_0x11b6ef,_0x27a76c,_0x12c8dd,_0x12dcb8){return new BPromise(function(_0x3eda68,_0x346d3){var _0x5ec8a9=_0x12dcb8||client;return _0x5ec8a9['request'](_0x11b6ef,_0x12c8dd)[_0xde7e('0x1d')](function(_0x2967a3){logger[_0xde7e('0x1e')](_0xde7e('0x1f'),_0x27a76c,'request\x20sent');logger[_0xde7e('0x20')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x27a76c,'request\x20sent',JSON[_0xde7e('0x21')](_0x2967a3));if(_0x2967a3[_0xde7e('0x22')]){if(_0x2967a3[_0xde7e('0x22')]['code']===0x1f4){logger[_0xde7e('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x27a76c,_0x2967a3[_0xde7e('0x22')][_0xde7e('0x23')]);return _0x346d3(_0x2967a3[_0xde7e('0x22')][_0xde7e('0x23')]);}logger[_0xde7e('0x22')](_0xde7e('0x1f'),_0x27a76c,_0x2967a3[_0xde7e('0x22')][_0xde7e('0x23')]);return _0x3eda68(_0x2967a3['error']['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x27a76c,_0xde7e('0x24'));_0x3eda68(_0x2967a3[_0xde7e('0x25')][_0xde7e('0x23')]);}})[_0xde7e('0x26')](function(_0x163675){logger[_0xde7e('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x27a76c,_0x163675);_0x346d3(_0x163675);});});}function respondWithStatusCode(_0x860d59,_0x240850){_0x240850=_0x240850||0xcc;return function(_0x27ba55){if(_0x27ba55){return _0x860d59[_0xde7e('0x27')](_0x240850);}return _0x860d59[_0xde7e('0x28')](_0x240850)[_0xde7e('0x29')]();};}function respondWithResult(_0x1b893b,_0x189bcf){_0x189bcf=_0x189bcf||0xc8;return function(_0x4511cb){if(_0x4511cb){return _0x1b893b[_0xde7e('0x28')](_0x189bcf)[_0xde7e('0x2a')](_0x4511cb);}};}function respondWithFilteredResult(_0x1b26c4,_0x406c93){return function(_0xa244a1){if(_0xa244a1){var _0x521b11=_0xa244a1[_0xde7e('0x2b')],_0x109f38=_0x406c93[_0xde7e('0x2c')],_0x48a132=_0x406c93[_0xde7e('0x2c')]+_0x406c93[_0xde7e('0x2d')],_0x59542a;if(_0x48a132>=_0x521b11){_0x48a132=_0x521b11;_0x59542a=0xc8;}else{_0x59542a=0xce;}_0x1b26c4[_0xde7e('0x28')](_0x59542a);return _0x1b26c4[_0xde7e('0x2e')](_0xde7e('0x2f'),_0x109f38+'-'+_0x48a132+'/'+_0x521b11)['json'](_0xa244a1);}return null;};}function patchUpdates(_0x3244c9){return function(_0x1dc56d){try{jsonpatch['apply'](_0x1dc56d,_0x3244c9,!![]);}catch(_0x2416e9){return BPromise[_0xde7e('0x30')](_0x2416e9);}return _0x1dc56d[_0xde7e('0x31')]();};}function saveUpdates(_0x223106,_0x20664e){return function(_0x87bc79){if(_0x87bc79){return _0x87bc79[_0xde7e('0x32')](_0x223106)['then'](function(_0x161058){return _0x161058;});}return null;};}function removeEntity(_0x5c0830,_0x18386c){return function(_0x2c8447){if(_0x2c8447){return _0x2c8447[_0xde7e('0x33')]()[_0xde7e('0x1d')](function(){var _0x315149=_0x2c8447[_0xde7e('0x34')]({'plain':!![]});var _0x187747=_0xde7e('0x35');return db[_0xde7e('0x36')]['destroy']({'where':{'type':_0x187747,'resourceId':_0x315149['id']}})[_0xde7e('0x1d')](function(){return _0x2c8447;});})[_0xde7e('0x1d')](function(){_0x5c0830[_0xde7e('0x28')](0xcc)[_0xde7e('0x29')]();});}};}function handleEntityNotFound(_0x40871f,_0x40d9f1){return function(_0xc43f32){if(!_0xc43f32){_0x40871f[_0xde7e('0x27')](0x194);}return _0xc43f32;};}function handleError(_0x582aef,_0x4f8c0d){_0x4f8c0d=_0x4f8c0d||0x1f4;return function(_0x5c3cb3){logger[_0xde7e('0x22')](_0x5c3cb3[_0xde7e('0x37')]);if(_0x5c3cb3[_0xde7e('0x38')]){delete _0x5c3cb3[_0xde7e('0x38')];}_0x582aef['status'](_0x4f8c0d)['send'](_0x5c3cb3);};}exports['index']=function(_0x4b955b,_0x15a782){var _0x421159={'include':[{'model':db[_0xde7e('0x39')],'as':'mandatoryDispositionPause'}]},_0x4e6fdf={},_0xcf42ec={'count':0x0,'rows':[]};var _0x16df3b=_[_0xde7e('0x3a')](db[_0xde7e('0x3b')][_0xde7e('0x3c')],function(_0x5a3237){return{'name':_0x5a3237['fieldName'],'type':_0x5a3237[_0xde7e('0x3d')]['key']};});_0x4e6fdf[_0xde7e('0x3e')]=_[_0xde7e('0x3a')](_0x16df3b,_0xde7e('0x38'));_0x4e6fdf[_0xde7e('0x3f')]=_['keys'](_0x4b955b[_0xde7e('0x3f')]);_0x4e6fdf[_0xde7e('0x40')]=_['intersection'](_0x4e6fdf[_0xde7e('0x3e')],_0x4e6fdf[_0xde7e('0x3f')]);_0x421159['attributes']=_[_0xde7e('0x41')](_0x4e6fdf[_0xde7e('0x3e')],qs[_0xde7e('0x42')](_0x4b955b[_0xde7e('0x3f')][_0xde7e('0x42')]));_0x421159[_0xde7e('0x43')]=_0x421159[_0xde7e('0x43')]['length']?_0x421159[_0xde7e('0x43')]:_0x4e6fdf[_0xde7e('0x3e')];if(!_0x4b955b['query'][_0xde7e('0x44')]('nolimit')){_0x421159[_0xde7e('0x2d')]=qs[_0xde7e('0x2d')](_0x4b955b[_0xde7e('0x3f')][_0xde7e('0x2d')]);_0x421159['offset']=qs[_0xde7e('0x2c')](_0x4b955b[_0xde7e('0x3f')][_0xde7e('0x2c')]);}_0x421159['order']=qs[_0xde7e('0x45')](_0x4b955b[_0xde7e('0x3f')]['sort']);_0x421159['where']=qs[_0xde7e('0x40')](_[_0xde7e('0x46')](_0x4b955b[_0xde7e('0x3f')],_0x4e6fdf[_0xde7e('0x40')]),_0x16df3b);if(_0x4b955b[_0xde7e('0x3f')]['filter']){_0x421159[_0xde7e('0x47')]=_[_0xde7e('0x48')](_0x421159[_0xde7e('0x47')],{'$or':_[_0xde7e('0x3a')](_0x16df3b,function(_0x35c750){if(_0x35c750[_0xde7e('0x3d')]!==_0xde7e('0x49')){var _0x386bcd={};_0x386bcd[_0x35c750[_0xde7e('0x38')]]={'$like':'%'+_0x4b955b['query'][_0xde7e('0x4a')]+'%'};return _0x386bcd;}})});}_0x421159=_['merge']({},_0x421159,_0x4b955b[_0xde7e('0x4b')]);var _0x3a3c65={'where':_0x421159[_0xde7e('0x47')]};return db[_0xde7e('0x3b')]['count'](_0x3a3c65)[_0xde7e('0x1d')](function(_0x17bfb8){_0xcf42ec[_0xde7e('0x2b')]=_0x17bfb8;if(_0x4b955b[_0xde7e('0x3f')]['includeAll']){_0x421159[_0xde7e('0x4c')]=[{'all':!![]}];}return db[_0xde7e('0x3b')][_0xde7e('0x4d')](_0x421159);})[_0xde7e('0x1d')](function(_0x1d7b0f){_0xcf42ec[_0xde7e('0x4e')]=_0x1d7b0f;return _0xcf42ec;})[_0xde7e('0x1d')](respondWithFilteredResult(_0x15a782,_0x421159))[_0xde7e('0x26')](handleError(_0x15a782,null));};exports[_0xde7e('0x4f')]=function(_0x4101b5,_0x43b798){var _0x19e51={'raw':![],'where':{'id':_0x4101b5[_0xde7e('0x50')]['id']},'include':[{'model':db[_0xde7e('0x39')],'as':_0xde7e('0x51')}]},_0x47ea3e={};_0x47ea3e[_0xde7e('0x3e')]=_['keys'](db[_0xde7e('0x3b')][_0xde7e('0x3c')]);_0x47ea3e[_0xde7e('0x3f')]=_[_0xde7e('0x52')](_0x4101b5[_0xde7e('0x3f')]);_0x47ea3e[_0xde7e('0x40')]=_['intersection'](_0x47ea3e[_0xde7e('0x3e')],_0x47ea3e[_0xde7e('0x3f')]);_0x19e51[_0xde7e('0x43')]=_['intersection'](_0x47ea3e[_0xde7e('0x3e')],qs[_0xde7e('0x42')](_0x4101b5['query'][_0xde7e('0x42')]));_0x19e51[_0xde7e('0x43')]=_0x19e51[_0xde7e('0x43')][_0xde7e('0x53')]?_0x19e51[_0xde7e('0x43')]:_0x47ea3e[_0xde7e('0x3e')];if(_0x4101b5[_0xde7e('0x3f')][_0xde7e('0x54')]){_0x19e51[_0xde7e('0x4c')]=[{'all':!![]}];}_0x19e51=_[_0xde7e('0x48')]({},_0x19e51,_0x4101b5[_0xde7e('0x4b')]);return db[_0xde7e('0x3b')][_0xde7e('0x55')](_0x19e51)[_0xde7e('0x1d')](handleEntityNotFound(_0x43b798,null))[_0xde7e('0x1d')](respondWithResult(_0x43b798,null))['catch'](handleError(_0x43b798,null));};exports[_0xde7e('0x56')]=function(_0x497329,_0x43c179){return db[_0xde7e('0x3b')][_0xde7e('0x56')](_0x497329['body'],{})[_0xde7e('0x1d')](function(_0x54817c){var _0x31f01d=_0x497329[_0xde7e('0x57')]['get']({'plain':!![]});if(!_0x31f01d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31f01d[_0xde7e('0x58')]===_0xde7e('0x57')){var _0x303015=_0x54817c[_0xde7e('0x34')]({'plain':!![]});var _0x557a38=_0xde7e('0x35');return db[_0xde7e('0x59')]['find']({'where':{'name':_0x557a38,'userProfileId':_0x31f01d[_0xde7e('0x5a')]},'raw':!![]})[_0xde7e('0x1d')](function(_0x222fe0){if(_0x222fe0&&_0x222fe0[_0xde7e('0x5b')]===0x0){return db[_0xde7e('0x36')]['create']({'name':_0x303015[_0xde7e('0x38')],'resourceId':_0x303015['id'],'type':_0x222fe0[_0xde7e('0x38')],'sectionId':_0x222fe0['id']},{})[_0xde7e('0x1d')](function(){return _0x54817c;});}else{return _0x54817c;}})[_0xde7e('0x26')](function(_0x2bb68e){logger[_0xde7e('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bb68e);throw _0x2bb68e;});}return _0x54817c;})['then'](respondWithResult(_0x43c179,0xc9))[_0xde7e('0x26')](handleError(_0x43c179,null));};exports[_0xde7e('0x32')]=function(_0x20a990,_0x4a84c5){if(_0x20a990[_0xde7e('0x5c')]['id']){delete _0x20a990[_0xde7e('0x5c')]['id'];}return db[_0xde7e('0x3b')][_0xde7e('0x55')]({'where':{'id':_0x20a990[_0xde7e('0x50')]['id']},'include':[{'model':db[_0xde7e('0x39')],'as':'mandatoryDispositionPause'}]})[_0xde7e('0x1d')](handleEntityNotFound(_0x4a84c5,null))['then'](saveUpdates(_0x20a990['body'],null))[_0xde7e('0x1d')](respondWithResult(_0x4a84c5,null))['catch'](handleError(_0x4a84c5,null));};exports['destroy']=function(_0x91483,_0xb1d16b){return db['OpenchannelAccount']['find']({'where':{'id':_0x91483[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0xb1d16b,null))[_0xde7e('0x1d')](removeEntity(_0xb1d16b,null))[_0xde7e('0x26')](handleError(_0xb1d16b,null));};exports[_0xde7e('0x5d')]=function(_0x12908e,_0x116e70){return db['OpenchannelAccount'][_0xde7e('0x5d')]()[_0xde7e('0x1d')](respondWithResult(_0x116e70,null))[_0xde7e('0x26')](handleError(_0x116e70,null));};exports[_0xde7e('0x5e')]=function(_0x101d61,_0x427a3f,_0x57769a){if(_0x101d61['body']['id']){delete _0x101d61[_0xde7e('0x5c')]['id'];}return db[_0xde7e('0x3b')][_0xde7e('0x55')]({'where':{'id':_0x101d61[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x427a3f,null))[_0xde7e('0x1d')](function(_0x425e3f){if(_0x425e3f){_0x101d61[_0xde7e('0x5c')]['OpnechannelAccountId']=_0x425e3f['id'];return db[_0xde7e('0x5f')][_0xde7e('0x56')](_0x101d61['body']);}})[_0xde7e('0x1d')](respondWithResult(_0x427a3f,null))[_0xde7e('0x26')](handleError(_0x427a3f,null));};exports[_0xde7e('0x60')]=function(_0x3498c1,_0x22f7d9,_0x994ef0){var _0x23f39c={'raw':![],'where':{}};var _0x3dc109={};var _0x3f7a01={'count':0x0,'rows':[]};return db[_0xde7e('0x3b')][_0xde7e('0x61')]({'where':{'id':_0x3498c1[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x22f7d9,null))[_0xde7e('0x1d')](function(_0xb5709f){if(_0xb5709f){_0x3dc109[_0xde7e('0x3e')]=_[_0xde7e('0x52')](db['Disposition'][_0xde7e('0x3c')]);_0x3dc109[_0xde7e('0x3f')]=_[_0xde7e('0x52')](_0x3498c1[_0xde7e('0x3f')]);_0x3dc109[_0xde7e('0x40')]=_[_0xde7e('0x41')](_0x3dc109['model'],_0x3dc109[_0xde7e('0x3f')]);_0x23f39c[_0xde7e('0x43')]=_['intersection'](_0x3dc109[_0xde7e('0x3e')],qs['fields'](_0x3498c1[_0xde7e('0x3f')][_0xde7e('0x42')]));_0x23f39c[_0xde7e('0x43')]=_0x23f39c['attributes']['length']?_0x23f39c['attributes']:_0x3dc109[_0xde7e('0x3e')];if(!_0x3498c1[_0xde7e('0x3f')]['hasOwnProperty'](_0xde7e('0x62'))){_0x23f39c['limit']=qs['limit'](_0x3498c1['query'][_0xde7e('0x2d')]);_0x23f39c['offset']=qs[_0xde7e('0x2c')](_0x3498c1[_0xde7e('0x3f')][_0xde7e('0x2c')]);}_0x23f39c['order']=qs['sort'](_0x3498c1[_0xde7e('0x3f')][_0xde7e('0x45')]);_0x23f39c[_0xde7e('0x47')]=qs[_0xde7e('0x40')](_[_0xde7e('0x46')](_0x3498c1[_0xde7e('0x3f')],_0x3dc109[_0xde7e('0x40')]));_0x23f39c[_0xde7e('0x47')][_0xde7e('0x63')]=_0xb5709f['id'];if(_0x3498c1[_0xde7e('0x3f')][_0xde7e('0x4a')]){_0x23f39c[_0xde7e('0x47')]=_[_0xde7e('0x48')](_0x23f39c[_0xde7e('0x47')],{'$or':_[_0xde7e('0x3a')](_0x23f39c[_0xde7e('0x43')],function(_0x2b867b){var _0x1cecb6={};_0x1cecb6[_0x2b867b]={'$like':'%'+_0x3498c1[_0xde7e('0x3f')]['filter']+'%'};return _0x1cecb6;})});}_0x23f39c=_[_0xde7e('0x48')]({},_0x23f39c,_0x3498c1[_0xde7e('0x4b')]);return db[_0xde7e('0x5f')][_0xde7e('0x2b')]({'where':_0x23f39c['where']})['then'](function(_0x9ad4d1){_0x3f7a01[_0xde7e('0x2b')]=_0x9ad4d1;if(_0x3498c1[_0xde7e('0x3f')][_0xde7e('0x54')]){_0x23f39c[_0xde7e('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0xde7e('0x4d')](_0x23f39c);})['then'](function(_0x5e1f9b){_0x3f7a01['rows']=_0x5e1f9b;return _0x3f7a01;});}})['then'](respondWithFilteredResult(_0x22f7d9,_0x23f39c))[_0xde7e('0x26')](handleError(_0x22f7d9,null));};exports[_0xde7e('0x64')]=function(_0x25f223,_0x5437d1,_0x19b963){return db[_0xde7e('0x3b')]['find']({'where':{'id':_0x25f223[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x5437d1,null))['then'](function(_0x174987){if(_0x174987){return _0x174987[_0xde7e('0x64')](_0x25f223[_0xde7e('0x3f')][_0xde7e('0x65')]);}})[_0xde7e('0x1d')](respondWithStatusCode(_0x5437d1,null))[_0xde7e('0x26')](handleError(_0x5437d1,null));};exports['addAnswer']=function(_0x1f746,_0x245b4e,_0x435b2c){if(_0x1f746[_0xde7e('0x5c')]['id']){delete _0x1f746[_0xde7e('0x5c')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x1f746[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x245b4e,null))[_0xde7e('0x1d')](function(_0x10504e){if(_0x10504e){_0x1f746[_0xde7e('0x5c')][_0xde7e('0x63')]=_0x10504e['id'];return db[_0xde7e('0x66')]['create'](_0x1f746['body']);}})[_0xde7e('0x1d')](respondWithResult(_0x245b4e,null))[_0xde7e('0x26')](handleError(_0x245b4e,null));};exports[_0xde7e('0x67')]=function(_0x4c123c,_0x18c59f,_0x5979d0){var _0x20ca96={'raw':![],'where':{}};var _0x5948d4={};var _0x1b7bb8={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xde7e('0x61')]({'where':{'id':_0x4c123c[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x18c59f,null))['then'](function(_0x25395a){if(_0x25395a){_0x5948d4['model']=_[_0xde7e('0x52')](db[_0xde7e('0x66')][_0xde7e('0x3c')]);_0x5948d4[_0xde7e('0x3f')]=_[_0xde7e('0x52')](_0x4c123c['query']);_0x5948d4['filters']=_[_0xde7e('0x41')](_0x5948d4[_0xde7e('0x3e')],_0x5948d4[_0xde7e('0x3f')]);_0x20ca96['attributes']=_[_0xde7e('0x41')](_0x5948d4['model'],qs[_0xde7e('0x42')](_0x4c123c[_0xde7e('0x3f')][_0xde7e('0x42')]));_0x20ca96['attributes']=_0x20ca96[_0xde7e('0x43')][_0xde7e('0x53')]?_0x20ca96[_0xde7e('0x43')]:_0x5948d4[_0xde7e('0x3e')];if(!_0x4c123c['query'][_0xde7e('0x44')](_0xde7e('0x62'))){_0x20ca96['limit']=qs[_0xde7e('0x2d')](_0x4c123c['query'][_0xde7e('0x2d')]);_0x20ca96[_0xde7e('0x2c')]=qs[_0xde7e('0x2c')](_0x4c123c['query'][_0xde7e('0x2c')]);}_0x20ca96[_0xde7e('0x68')]=qs[_0xde7e('0x45')](_0x4c123c[_0xde7e('0x3f')][_0xde7e('0x45')]);_0x20ca96[_0xde7e('0x47')]=qs[_0xde7e('0x40')](_['pick'](_0x4c123c['query'],_0x5948d4[_0xde7e('0x40')]));_0x20ca96[_0xde7e('0x47')]['OpenchannelAccountId']=_0x25395a['id'];if(_0x4c123c[_0xde7e('0x3f')]['filter']){_0x20ca96[_0xde7e('0x47')]=_['merge'](_0x20ca96[_0xde7e('0x47')],{'$or':_[_0xde7e('0x3a')](_0x20ca96[_0xde7e('0x43')],function(_0x2b510b){var _0x316968={};_0x316968[_0x2b510b]={'$like':'%'+_0x4c123c[_0xde7e('0x3f')][_0xde7e('0x4a')]+'%'};return _0x316968;})});}_0x20ca96=_[_0xde7e('0x48')]({},_0x20ca96,_0x4c123c[_0xde7e('0x4b')]);return db[_0xde7e('0x66')][_0xde7e('0x2b')]({'where':_0x20ca96[_0xde7e('0x47')]})[_0xde7e('0x1d')](function(_0x13ee75){_0x1b7bb8['count']=_0x13ee75;if(_0x4c123c[_0xde7e('0x3f')][_0xde7e('0x54')]){_0x20ca96['include']=[{'all':!![]}];}return db[_0xde7e('0x66')][_0xde7e('0x4d')](_0x20ca96);})['then'](function(_0x22089e){_0x1b7bb8[_0xde7e('0x4e')]=_0x22089e;return _0x1b7bb8;});}})[_0xde7e('0x1d')](respondWithFilteredResult(_0x18c59f,_0x20ca96))['catch'](handleError(_0x18c59f,null));};exports['removeAnswers']=function(_0x34d351,_0x312a7e,_0xa554f6){return db[_0xde7e('0x3b')][_0xde7e('0x55')]({'where':{'id':_0x34d351[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x312a7e,null))[_0xde7e('0x1d')](function(_0x4d4279){if(_0x4d4279){return _0x4d4279[_0xde7e('0x69')](_0x34d351['query']['ids']);}})[_0xde7e('0x1d')](respondWithStatusCode(_0x312a7e,null))[_0xde7e('0x26')](handleError(_0x312a7e,null));};exports[_0xde7e('0x6a')]=function(_0x5d4415,_0xf5f963,_0x435718){var _0x50315b={'body':_0x5d4415[_0xde7e('0x5c')],'channel':_0xde7e('0x6b')};var _0x4302b6=[];var _0x3dd6a6=[];var _0x37bb64={};var _0x3ab125=![];return db[_0xde7e('0x6c')][_0xde7e('0x5d')]()[_0xde7e('0x1d')](function(_0x506acb){if(!_0x506acb){throw new db['Sequelize'][(_0xde7e('0x6d'))]('no\x20available\x20attributes');}_0x4302b6=_[_0xde7e('0x6e')](_[_0xde7e('0x52')](_0x506acb),[_0xde7e('0x6f'),_0xde7e('0x70')]);_0x3dd6a6=_[_0xde7e('0x6e')](_['keys'](_0x506acb),[_0xde7e('0x6f'),_0xde7e('0x70'),_0xde7e('0x71'),_0xde7e('0x72')]);if(_0x5d4415['body']['id']){delete _0x5d4415['body']['id'];}if(_['isNil'](_0x5d4415['body'][_0xde7e('0x73')])){throw new db[(_0xde7e('0x74'))]['ValidationError'](_0xde7e('0x75'));}if(_[_0xde7e('0x76')](_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x5c')])||_0x5d4415['body']['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xde7e('0x76')](_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x77')])){throw new db[(_0xde7e('0x74'))][(_0xde7e('0x6d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3dd6a6);}if(!_[_0xde7e('0x78')](_0x3dd6a6,_0x5d4415[_0xde7e('0x5c')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xde7e('0x79')+_0x3dd6a6);}_0x37bb64[_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x77')]]=_0x5d4415[_0xde7e('0x5c')]['from'];})[_0xde7e('0x1d')](function(){return db['OpenchannelAccount'][_0xde7e('0x55')]({'where':{'id':_0x5d4415[_0xde7e('0x50')]['id']},'include':[{'model':db['CmList'],'as':_0xde7e('0x7a'),'include':[{'model':db[_0xde7e('0x6c')],'as':_0xde7e('0x7b'),'where':_0x37bb64,'limit':0x1,'order':[[_0xde7e('0x70'),_0xde7e('0x7c')]]}]},{'model':db[_0xde7e('0x7d')],'as':_0xde7e('0x7e')}]});})[_0xde7e('0x1d')](handleEntityNotFound(_0xf5f963,null))[_0xde7e('0x1d')](function(_0x402e6e){if(_0x402e6e&&_0x402e6e[_0xde7e('0x7a')]){_0x50315b[_0xde7e('0x7f')]=_0x402e6e;_0x50315b[_0xde7e('0x80')]=_0x402e6e['Applications'];_0x50315b['list']=_0x402e6e[_0xde7e('0x7a')];_0x50315b[_0xde7e('0x80')]=_[_0xde7e('0x81')](_0x50315b[_0xde7e('0x80')],[_0xde7e('0x82')],[_0xde7e('0x83')]);if(_0x50315b[_0xde7e('0x7f')]['Applications']){delete _0x50315b['account'][_0xde7e('0x7e')];}if(_0x50315b[_0xde7e('0x7f')][_0xde7e('0x7a')]&&_0x50315b[_0xde7e('0x7f')][_0xde7e('0x7a')][_0xde7e('0x7b')]['length']){return _0x50315b[_0xde7e('0x7f')][_0xde7e('0x7a')]['Contacts'][0x0];}var _0x2c1967=_[_0xde7e('0x16')](_0x5d4415['body'],{'firstName':_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x73')],'ListId':_0x402e6e[_0xde7e('0x72')]});_0x2c1967[_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x77')]]=_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x73')];return db[_0xde7e('0x6c')][_0xde7e('0x56')](_0x2c1967,{'fields':_0x4302b6,'raw':!![]});}})['then'](handleEntityNotFound(_0xf5f963,null))[_0xde7e('0x1d')](function(_0x6e52ed){_0x50315b[_0xde7e('0x84')]=_0x6e52ed;if(_0x6e52ed){var _0x14edb4={'ContactId':_0x6e52ed['id'],'OpenchannelAccountId':_0x5d4415[_0xde7e('0x50')]['id'],'from':(_0x6e52ed[_0xde7e('0x85')]||'')+'\x20'+(_0x6e52ed['lastName']||'')};var _0x3dc7d5={'OpenchannelAccountId':_0x5d4415[_0xde7e('0x50')]['id'],'closed':![]};if(_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x86')]){_0x3dc7d5[_0xde7e('0x86')]=_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x86')];return db[_0xde7e('0x87')][_0xde7e('0x55')]({'where':_0x3dc7d5})[_0xde7e('0x1d')](function(_0x64cab2){if(_0x64cab2){return[_0x64cab2,![]];}_0x14edb4[_0xde7e('0x86')]=_0x5d4415[_0xde7e('0x5c')]['threadId'];_0x14edb4['externalUrl']=_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x88')];return db[_0xde7e('0x87')]['create'](_0x14edb4)[_0xde7e('0x1d')](function(_0x1b4ba2){return[_0x1b4ba2,!![]];});});}else{_0x3dc7d5[_0xde7e('0x86')]=null;}_0x3dc7d5[_0xde7e('0x89')]=_0x6e52ed['id'];return db[_0xde7e('0x87')][_0xde7e('0x55')]({'where':_0x3dc7d5})[_0xde7e('0x1d')](function(_0x2330cb){if(_0x2330cb){return[_0x2330cb,![]];}return db[_0xde7e('0x87')][_0xde7e('0x56')](_0x14edb4)[_0xde7e('0x1d')](function(_0x2ff0f1){return[_0x2ff0f1,!![]];});});}})[_0xde7e('0x8a')](function(_0x121845,_0x6a0e21){if(_0x121845){_0x3ab125=_0x6a0e21;if(!_0x6a0e21){var _0x17b826={'from':(_0x50315b['contact'][_0xde7e('0x85')]||'')+'\x20'+(_0x50315b[_0xde7e('0x84')]['lastName']||'')};if(_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x86')]&&_0x5d4415[_0xde7e('0x5c')]['messageId']&&_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x86')]!=_0x5d4415['body']['messageId']){_0x17b826[_0xde7e('0x86')]=_0x5d4415['body'][_0xde7e('0x8b')];}return _0x121845[_0xde7e('0x32')](_0x17b826);}else{return _0x121845;}}})[_0xde7e('0x1d')](function(_0x119b30){_0x50315b[_0xde7e('0x8c')]=_0x119b30[_0xde7e('0x34')]({'plain':!![]});_0x50315b['interaction'][_0xde7e('0x8d')]=_0x3ab125;if(_0x50315b['interaction'][_0xde7e('0x8d')]){if(_0x50315b[_0xde7e('0x7f')][_0xde7e('0x8e')]){_0x50315b['applications']['push']({'id':0x0,'priority':_0x50315b[_0xde7e('0x80')][_0xde7e('0x53')]+0x1,'app':_0xde7e('0x8f'),'appdata':_0xde7e('0x90'),'interval':_0xde7e('0x91')});}}return db[_0xde7e('0x92')][_0xde7e('0x56')]({'body':_0x5d4415[_0xde7e('0x5c')][_0xde7e('0x5c')],'OpenchannelAccountId':_0x5d4415[_0xde7e('0x50')]['id'],'OpenchannelInteractionId':_0x119b30['id'],'direction':'in','ContactId':_0x50315b[_0xde7e('0x84')]['id'],'AttachmentId':_0x5d4415[_0xde7e('0x5c')]['AttachmentId']});})[_0xde7e('0x1d')](function(_0x165bb9){_0x50315b[_0xde7e('0x23')]=_0x165bb9;if(_0x50315b[_0xde7e('0x8c')]['UserId']){return db[_0xde7e('0x93')]['find']({'attributes':['id',_0xde7e('0x38')],'where':{'id':_0x50315b['interaction'][_0xde7e('0x94')]}})[_0xde7e('0x1d')](function(_0x11639b){if(_0x11639b){_0x50315b[_0xde7e('0x80')][_0xde7e('0x95')]({'id':0x0,'priority':0x0,'app':_0xde7e('0x96'),'appdata':_0x11639b[_0xde7e('0x38')]+','+(_0x50315b[_0xde7e('0x7f')]['waitForTheAssignedAgent']||0xa),'interval':_0xde7e('0x91')});_0x50315b[_0xde7e('0x97')]=![];}return respondWithRpcPromise(_0xde7e('0x98'),_0xde7e('0x99'),_0x50315b);});}return respondWithRpcPromise(_0xde7e('0x98'),_0xde7e('0x99'),_0x50315b);})[_0xde7e('0x1d')](function(_0x546c1b){respondWithRpcPromise(_0xde7e('0x9a'),'EventManager',{'event':_0xde7e('0x6a'),'message':_0x546c1b},client9002);return _0x546c1b;})['then'](respondWithResult(_0xf5f963,null))[_0xde7e('0x26')](handleError(_0xf5f963,null));};exports['addApplications']=function(_0x45f706,_0x3681fc,_0x17889a){return db[_0xde7e('0x3b')][_0xde7e('0x61')]({'where':{'id':_0x45f706[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x3681fc,null))[_0xde7e('0x1d')](function(_0x55f2a0){if(_0x55f2a0){return db['sequelize']['transaction'](function(_0x449d39){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x45f706['params']['id']},'transaction':_0x449d39})[_0xde7e('0x1d')](function(_0x92af6e){var _0x23b184=_[_0xde7e('0x3a')](_0x45f706[_0xde7e('0x5c')],function(_0x19a521){_0x19a521[_0xde7e('0x63')]=_0x45f706[_0xde7e('0x50')]['id'];return _0x19a521;});return db['OpenchannelApplication'][_0xde7e('0x9b')](_0x23b184,{'transaction':_0x449d39});});})['then'](function(){return db[_0xde7e('0x7d')][_0xde7e('0x9c')]({'where':{'OpenchannelAccountId':_0x45f706[_0xde7e('0x50')]['id']},'order':_0xde7e('0x82')});});}})[_0xde7e('0x1d')](respondWithResult(_0x3681fc,null))['catch'](handleError(_0x3681fc,null));};exports[_0xde7e('0x9d')]=function(_0x3d0303,_0x1c6f70,_0x1b3c61){var _0x38ba15={};var _0x399b0d={};var _0x56981f;var _0x438429;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3d0303[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x1c6f70,null))[_0xde7e('0x1d')](function(_0x4178e8){if(_0x4178e8){_0x56981f=_0x4178e8;_0x399b0d[_0xde7e('0x3e')]=_['keys'](db[_0xde7e('0x7d')]['rawAttributes']);_0x399b0d['query']=_['keys'](_0x3d0303['query']);_0x399b0d[_0xde7e('0x40')]=_[_0xde7e('0x41')](_0x399b0d[_0xde7e('0x3e')],_0x399b0d['query']);_0x38ba15['attributes']=_['intersection'](_0x399b0d[_0xde7e('0x3e')],qs[_0xde7e('0x42')](_0x3d0303[_0xde7e('0x3f')][_0xde7e('0x42')]));_0x38ba15['attributes']=_0x38ba15[_0xde7e('0x43')]['length']?_0x38ba15[_0xde7e('0x43')]:_0x399b0d[_0xde7e('0x3e')];_0x38ba15[_0xde7e('0x68')]=qs['sort'](_0x3d0303[_0xde7e('0x3f')][_0xde7e('0x45')]);_0x38ba15[_0xde7e('0x47')]=qs[_0xde7e('0x40')](_[_0xde7e('0x46')](_0x3d0303[_0xde7e('0x3f')],_0x399b0d['filters']));if(_0x3d0303[_0xde7e('0x3f')][_0xde7e('0x4a')]){_0x38ba15['where']=_['merge'](_0x38ba15[_0xde7e('0x47')],{'$or':_[_0xde7e('0x3a')](_0x38ba15[_0xde7e('0x43')],function(_0x73fd83){var _0x15d916={};_0x15d916[_0x73fd83]={'$like':'%'+_0x3d0303[_0xde7e('0x3f')][_0xde7e('0x4a')]+'%'};return _0x15d916;})});}_0x38ba15=_['merge']({},_0x38ba15,_0x3d0303[_0xde7e('0x4b')]);return _0x56981f[_0xde7e('0x9d')](_0x38ba15);}})[_0xde7e('0x1d')](function(_0x258fdf){if(_0x258fdf){_0x438429=_0x258fdf[_0xde7e('0x53')];if(!_0x3d0303[_0xde7e('0x3f')][_0xde7e('0x44')](_0xde7e('0x62'))){_0x38ba15[_0xde7e('0x2d')]=qs[_0xde7e('0x2d')](_0x3d0303[_0xde7e('0x3f')]['limit']);_0x38ba15[_0xde7e('0x2c')]=qs[_0xde7e('0x2c')](_0x3d0303[_0xde7e('0x3f')][_0xde7e('0x2c')]);}return _0x56981f[_0xde7e('0x9d')](_0x38ba15);}})['then'](function(_0x315572){if(_0x315572){return _0x315572?{'count':_0x438429,'rows':_0x315572}:null;}})['then'](respondWithResult(_0x1c6f70,null))[_0xde7e('0x26')](handleError(_0x1c6f70,null));};exports[_0xde7e('0x9e')]=function(_0x48f71b,_0x39b7be,_0x46b38f){var _0x2f3b79={'raw':![],'where':{}};var _0x301124={};var _0x4bad02={'count':0x0,'rows':[]};return db[_0xde7e('0x3b')][_0xde7e('0x61')]({'where':{'id':_0x48f71b[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x39b7be,null))[_0xde7e('0x1d')](function(_0x29b828){if(_0x29b828){_0x301124[_0xde7e('0x3e')]=_['keys'](db[_0xde7e('0x87')][_0xde7e('0x3c')]);_0x301124['query']=_[_0xde7e('0x52')](_0x48f71b[_0xde7e('0x3f')]);_0x301124['filters']=_['intersection'](_0x301124[_0xde7e('0x3e')],_0x301124[_0xde7e('0x3f')]);_0x2f3b79['attributes']=_[_0xde7e('0x41')](_0x301124[_0xde7e('0x3e')],qs[_0xde7e('0x42')](_0x48f71b['query'][_0xde7e('0x42')]));_0x2f3b79[_0xde7e('0x43')]=_0x2f3b79[_0xde7e('0x43')][_0xde7e('0x53')]?_0x2f3b79[_0xde7e('0x43')]:_0x301124[_0xde7e('0x3e')];if(!_0x48f71b[_0xde7e('0x3f')][_0xde7e('0x44')](_0xde7e('0x62'))){_0x2f3b79[_0xde7e('0x2d')]=qs['limit'](_0x48f71b[_0xde7e('0x3f')][_0xde7e('0x2d')]);_0x2f3b79[_0xde7e('0x2c')]=qs[_0xde7e('0x2c')](_0x48f71b[_0xde7e('0x3f')][_0xde7e('0x2c')]);}_0x2f3b79[_0xde7e('0x68')]=qs[_0xde7e('0x45')](_0x48f71b[_0xde7e('0x3f')][_0xde7e('0x45')]);_0x2f3b79[_0xde7e('0x47')]=qs[_0xde7e('0x40')](_[_0xde7e('0x46')](_0x48f71b[_0xde7e('0x3f')],_0x301124[_0xde7e('0x40')]));_0x2f3b79[_0xde7e('0x47')]['OpenchannelAccountId']=_0x29b828['id'];if(_0x48f71b[_0xde7e('0x3f')][_0xde7e('0x4a')]){_0x2f3b79[_0xde7e('0x47')]=_[_0xde7e('0x48')](_0x2f3b79['where'],{'$or':_[_0xde7e('0x3a')](_0x2f3b79['attributes'],function(_0x5de3ba){var _0x50d5b8={};_0x50d5b8[_0x5de3ba]={'$like':'%'+_0x48f71b[_0xde7e('0x3f')][_0xde7e('0x4a')]+'%'};return _0x50d5b8;})});}_0x2f3b79=_[_0xde7e('0x48')]({},_0x2f3b79,_0x48f71b['options']);return db[_0xde7e('0x87')]['count']({'where':_0x2f3b79['where']})['then'](function(_0x581ca5){_0x4bad02[_0xde7e('0x2b')]=_0x581ca5;if(_0x48f71b['query'][_0xde7e('0x54')]){_0x2f3b79[_0xde7e('0x4c')]=[{'model':db[_0xde7e('0x6c')],'as':_0xde7e('0x9f'),'required':![]},{'model':db[_0xde7e('0x93')],'as':_0xde7e('0xa0'),'attributes':['name',_0xde7e('0xa1'),_0xde7e('0xa2')],'required':![]},{'model':db[_0xde7e('0xa3')],'as':_0xde7e('0xa4'),'attributes':['id',_0xde7e('0x38'),_0xde7e('0xa5')],'where':_0x48f71b[_0xde7e('0x3f')][_0xde7e('0xa6')]?{'id':_0x48f71b[_0xde7e('0x3f')][_0xde7e('0xa6')]}:undefined,'required':_0x48f71b['query'][_0xde7e('0xa6')]?!![]:![]}];}return db[_0xde7e('0x87')]['findAll'](_0x2f3b79);})[_0xde7e('0x1d')](function(_0x449b2f){_0x4bad02[_0xde7e('0x4e')]=_0x449b2f;return _0x4bad02;});}})[_0xde7e('0x1d')](respondWithFilteredResult(_0x39b7be,_0x2f3b79))[_0xde7e('0x26')](handleError(_0x39b7be,null));};exports[_0xde7e('0xa7')]=function(_0x44311b,_0xa4eade,_0x2bbb8d){return db[_0xde7e('0x3b')][_0xde7e('0x55')]({'where':{'id':_0x44311b['params']['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0xa4eade,null))['then'](function(_0x2718df){if(_0x2718df){return _0x2718df[_0xde7e('0xa7')](_0x44311b[_0xde7e('0x5c')]['ids'],_[_0xde7e('0xa8')](_0x44311b[_0xde7e('0x5c')],[_0xde7e('0x65'),'id'])||{})['spread'](function(_0x254e40){for(var _0x44ab2a=0x0;_0x44ab2a<_0x44311b[_0xde7e('0x5c')][_0xde7e('0x65')][_0xde7e('0x53')];_0x44ab2a+=0x1){socket[_0xde7e('0xa9')](_0xde7e('0xaa'),{'UserId':_0x44311b['body'][_0xde7e('0x65')][_0x44ab2a],'OpenchannelAccountId':_0x44311b[_0xde7e('0x50')]['id']});}return _0x254e40;});}})[_0xde7e('0x1d')](respondWithResult(_0xa4eade,null))[_0xde7e('0x26')](handleError(_0xa4eade,null));};exports[_0xde7e('0xab')]=function(_0x1ef08e,_0x286449,_0x476a7d){return db['OpenchannelAccount'][_0xde7e('0x55')]({'where':{'id':_0x1ef08e[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x286449,null))['then'](function(_0x1119e1){if(_0x1119e1){return _0x1119e1[_0xde7e('0xab')](_0x1ef08e[_0xde7e('0x3f')][_0xde7e('0x65')])[_0xde7e('0x1d')](function(){if(_[_0xde7e('0xac')](_0x1ef08e[_0xde7e('0x3f')][_0xde7e('0x65')])){for(var _0x5eb827=0x0;_0x5eb827<_0x1ef08e['query']['ids']['length'];_0x5eb827+=0x1){socket[_0xde7e('0xa9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x1ef08e[_0xde7e('0x3f')][_0xde7e('0x65')][_0x5eb827]),'OpenchannelAccountId':Number(_0x1ef08e[_0xde7e('0x50')]['id'])});}}else{socket[_0xde7e('0xa9')](_0xde7e('0xad'),{'UserId':Number(_0x1ef08e[_0xde7e('0x3f')]['ids']),'OpenchannelAccountId':Number(_0x1ef08e[_0xde7e('0x50')]['id'])});}});}})[_0xde7e('0x1d')](respondWithStatusCode(_0x286449,null))[_0xde7e('0x26')](handleError(_0x286449,null));};exports[_0xde7e('0xae')]=function(_0x241688,_0x39fe91,_0x151a37){var _0x311e43={};var _0xd7a053={};var _0x1fb9d6;var _0x4416e2;return db[_0xde7e('0x3b')][_0xde7e('0x61')]({'where':{'id':_0x241688[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x39fe91,null))[_0xde7e('0x1d')](function(_0x23ae73){if(_0x23ae73){_0x1fb9d6=_0x23ae73;_0xd7a053['model']=_[_0xde7e('0x52')](db['User'][_0xde7e('0x3c')]);_0xd7a053[_0xde7e('0x3f')]=_[_0xde7e('0x52')](_0x241688[_0xde7e('0x3f')]);_0xd7a053[_0xde7e('0x40')]=_[_0xde7e('0x41')](_0xd7a053[_0xde7e('0x3e')],_0xd7a053['query']);_0x311e43[_0xde7e('0x43')]=_[_0xde7e('0x41')](_0xd7a053['model'],qs[_0xde7e('0x42')](_0x241688[_0xde7e('0x3f')][_0xde7e('0x42')]));_0x311e43[_0xde7e('0x43')]=_0x311e43[_0xde7e('0x43')]['length']?_0x311e43[_0xde7e('0x43')]:_0xd7a053[_0xde7e('0x3e')];_0x311e43[_0xde7e('0x68')]=qs['sort'](_0x241688[_0xde7e('0x3f')][_0xde7e('0x45')]);_0x311e43['where']=qs[_0xde7e('0x40')](_[_0xde7e('0x46')](_0x241688['query'],_0xd7a053[_0xde7e('0x40')]));if(_0x241688[_0xde7e('0x3f')][_0xde7e('0x4a')]){_0x311e43['where']=_[_0xde7e('0x48')](_0x311e43[_0xde7e('0x47')],{'$or':_['map'](_0x311e43['attributes'],function(_0x44cff6){var _0x2680e9={};_0x2680e9[_0x44cff6]={'$like':'%'+_0x241688[_0xde7e('0x3f')][_0xde7e('0x4a')]+'%'};return _0x2680e9;})});}_0x311e43=_[_0xde7e('0x48')]({},_0x311e43,_0x241688[_0xde7e('0x4b')]);return _0x1fb9d6[_0xde7e('0xae')](_0x311e43);}})['then'](function(_0x52249d){if(_0x52249d){_0x4416e2=_0x52249d[_0xde7e('0x53')];if(!_0x241688[_0xde7e('0x3f')]['hasOwnProperty'](_0xde7e('0x62'))){_0x311e43[_0xde7e('0x2d')]=qs[_0xde7e('0x2d')](_0x241688[_0xde7e('0x3f')][_0xde7e('0x2d')]);_0x311e43[_0xde7e('0x2c')]=qs[_0xde7e('0x2c')](_0x241688[_0xde7e('0x3f')][_0xde7e('0x2c')]);}return _0x1fb9d6[_0xde7e('0xae')](_0x311e43);}})[_0xde7e('0x1d')](function(_0x257702){if(_0x257702){return _0x257702?{'count':_0x4416e2,'rows':_0x257702}:null;}})[_0xde7e('0x1d')](respondWithResult(_0x39fe91,null))[_0xde7e('0x26')](handleError(_0x39fe91,null));};exports[_0xde7e('0xaf')]=function(_0x25384c,_0x58dff8,_0x52b829){var _0x43e53c,_0x4ef094,_0x3c4d51;if(_['isNil'](_0x25384c['body']['body'])||_0x25384c[_0xde7e('0x5c')]['body']===''){throw new db[(_0xde7e('0x74'))]['ValidationError'](_0xde7e('0xb0'));}if(_['isNil'](_0x25384c[_0xde7e('0x5c')]['to'])){}_0x43e53c=_0x25384c['body']['to'];return db[_0xde7e('0x3b')]['findOne']({'where':{'id':_0x25384c[_0xde7e('0x50')]['id']}})[_0xde7e('0x1d')](handleEntityNotFound(_0x58dff8,null))['then'](function(_0x18054b){if(_0x18054b){return db[_0xde7e('0x3b')][_0xde7e('0x55')]({'where':{'id':_0x18054b['id']},'include':[{'model':db[_0xde7e('0xb1')],'as':_0xde7e('0x7a'),'include':[{'model':db[_0xde7e('0x6c')],'as':_0xde7e('0x7b'),'where':{[_0x18054b['mapKey']]:_0x43e53c},'limit':0x1,'order':[[_0xde7e('0x70'),_0xde7e('0x7c')]]}]}]})[_0xde7e('0x1d')](handleEntityNotFound(_0x58dff8,null))[_0xde7e('0x1d')](function(_0x5b9b8c){if(_0x5b9b8c&&_0x5b9b8c[_0xde7e('0x7a')]){_0x4ef094=_0x5b9b8c[_0xde7e('0x34')]({'plain':!![]});if(_0x4ef094['List']&&_0x4ef094['List']['Contacts'][_0xde7e('0x53')]){return _0x4ef094['List'][_0xde7e('0x7b')][0x0];}return db[_0xde7e('0x6c')][_0xde7e('0x56')](_['defaults'](_0x25384c[_0xde7e('0x5c')],{'firstName':_0x43e53c,[_0x5b9b8c[_0xde7e('0x77')]]:_0x43e53c,'phone':_0x43e53c,'ListId':_0x4ef094['ListId']}));}})['then'](handleEntityNotFound(_0x58dff8,null))['then'](function(_0x4446c4){if(_0x4446c4){_0x3c4d51=_0x4446c4;return db[_0xde7e('0x87')][_0xde7e('0x55')]({'where':{'ContactId':_0x3c4d51['id'],'closed':![],'OpenchannelAccountId':_0x4ef094['id']}})[_0xde7e('0x1d')](function(_0x13afaa){if(_0x13afaa){return[_0x13afaa,![]];}return db[_0xde7e('0x87')][_0xde7e('0x56')]({'UserId':_0x25384c[_0xde7e('0x57')]['id'],'ContactId':_0x3c4d51['id'],'OpenchannelAccountId':_0x4ef094['id'],'lastMsgDirection':_0xde7e('0xb2'),'Messages':[_[_0xde7e('0x48')](_0x25384c[_0xde7e('0x5c')],{'read':![],'body':_0x25384c[_0xde7e('0x5c')]['body'],'OpenchannelAccountId':_0x4ef094['id'],'UserId':_0x25384c['user']['id'],'ContactId':_0x3c4d51['id']})]},{'include':[{'model':db[_0xde7e('0x92')],'as':'Messages'}]})[_0xde7e('0x1d')](function(_0x424519){return[_0x424519,!![]];});});}})[_0xde7e('0x8a')](function(_0x586f14,_0x276277){if(_0x276277){return _0x586f14;}return db[_0xde7e('0x92')]['create'](_[_0xde7e('0x48')](_0x25384c[_0xde7e('0x5c')],{'read':![],'body':_0x25384c[_0xde7e('0x5c')][_0xde7e('0x5c')],'OpenchannelAccountId':_0x4ef094['id'],'OpenchannelInteractionId':_0x586f14['id'],'UserId':_0x25384c['user']['id'],'ContactId':_0x3c4d51['id']}))['then'](function(_0x262208){_0x586f14[_0xde7e('0xb3')][_0xde7e('0xb4')]=[];_0x586f14[_0xde7e('0xb3')][_0xde7e('0xb4')]['push'](_0x262208[_0xde7e('0xb3')]);return _0x586f14;});});}})['then'](respondWithResult(_0x58dff8,null))[_0xde7e('0x26')](handleError(_0x58dff8,null));}; \ No newline at end of file +var _0x381e=['destroy','get','OpenchannelAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','length','pick','OpenchannelAccountId','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','sequelize','transaction','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelAccount.socket','jayson/promise','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~!@#$%^&-_=+[{]}.','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','set','Content-Range','json','apply','reject'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x381e,0x14d));var _0xe381=function(_0xbe10b1,_0x7625d4){_0xbe10b1=_0xbe10b1-0x0;var _0x20e467=_0x381e[_0xbe10b1];return _0x20e467;};'use strict';var pdf=require(_0xe381('0x0'));var emlformat=require(_0xe381('0x1'));var rimraf=require(_0xe381('0x2'));var zipdir=require(_0xe381('0x3'));var jsonpatch=require(_0xe381('0x4'));var rp=require('request-promise');var moment=require(_0xe381('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe381('0x6'));var util=require(_0xe381('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe381('0x8'));var ejs=require(_0xe381('0x9'));var fs=require('fs');var _=require(_0xe381('0xa'));var squel=require(_0xe381('0xb'));var crypto=require('crypto');var jsforce=require(_0xe381('0xc'));var deskjs=require(_0xe381('0xd'));var toCsv=require(_0xe381('0x8'));var querystring=require(_0xe381('0xe'));var Papa=require(_0xe381('0xf'));var Redis=require(_0xe381('0x10'));var authService=require(_0xe381('0x11'));var qs=require(_0xe381('0x12'));var as=require(_0xe381('0x13'));var hardwareService=require(_0xe381('0x14'));var logger=require(_0xe381('0x15'))(_0xe381('0x16'));var utils=require(_0xe381('0x17'));var config=require(_0xe381('0x18'));var db=require(_0xe381('0x19'))['db'];config[_0xe381('0x1a')]=_['defaults'](config[_0xe381('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe381('0x1b'))(new Redis(config[_0xe381('0x1a')]));require(_0xe381('0x1c'))['register'](socket);var jayson=require(_0xe381('0x1d'));var client=jayson['client'][_0xe381('0x1e')]({'port':0x232c});var client9002=jayson[_0xe381('0x1f')][_0xe381('0x1e')]({'port':0x232a});function checkPasswordPattern(_0xd0442d,_0x5f149d,_0x3a7af2){if(_0x3a7af2){var _0xfa15d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xfa15d['test'](_0x5f149d)){return _0xd0442d;}else{throw new db[(_0xe381('0x20'))][(_0xe381('0x21'))](_0xe381('0x22'));}}else{return _0xd0442d;}}function respondWithRpcPromise(_0x306099,_0x4c9ad9,_0x2f96e7,_0xd8ed69){return new BPromise(function(_0xe2748b,_0x296dd1){var _0x2e33e6=_0xd8ed69||client;return _0x2e33e6['request'](_0x306099,_0x2f96e7)[_0xe381('0x23')](function(_0x25df37){logger[_0xe381('0x24')](_0xe381('0x25'),_0x4c9ad9,_0xe381('0x26'));logger[_0xe381('0x27')](_0xe381('0x28'),_0x4c9ad9,_0xe381('0x26'),JSON[_0xe381('0x29')](_0x25df37));if(_0x25df37[_0xe381('0x2a')]){if(_0x25df37[_0xe381('0x2a')][_0xe381('0x2b')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4c9ad9,_0x25df37[_0xe381('0x2a')][_0xe381('0x2c')]);return _0x296dd1(_0x25df37[_0xe381('0x2a')][_0xe381('0x2c')]);}logger[_0xe381('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x4c9ad9,_0x25df37['error'][_0xe381('0x2c')]);return _0xe2748b(_0x25df37[_0xe381('0x2a')]['message']);}else{logger[_0xe381('0x24')](_0xe381('0x25'),_0x4c9ad9,'request\x20sent');_0xe2748b(_0x25df37[_0xe381('0x2d')]['message']);}})['catch'](function(_0x5a4fe2){logger[_0xe381('0x2a')](_0xe381('0x25'),_0x4c9ad9,_0x5a4fe2);_0x296dd1(_0x5a4fe2);});});}function respondWithStatusCode(_0x51de1a,_0x4b73f6){_0x4b73f6=_0x4b73f6||0xcc;return function(_0x4d19fe){if(_0x4d19fe){return _0x51de1a[_0xe381('0x2e')](_0x4b73f6);}return _0x51de1a[_0xe381('0x2f')](_0x4b73f6)[_0xe381('0x30')]();};}function respondWithResult(_0x251b62,_0x1b7979){_0x1b7979=_0x1b7979||0xc8;return function(_0x4d2475){if(_0x4d2475){return _0x251b62[_0xe381('0x2f')](_0x1b7979)['json'](_0x4d2475);}};}function respondWithFilteredResult(_0x1ac3b7,_0x22c4a8){return function(_0x2283d6){if(_0x2283d6){var _0x13acc0=_0x2283d6['count'],_0x238710=_0x22c4a8[_0xe381('0x31')],_0x5eb903=_0x22c4a8[_0xe381('0x31')]+_0x22c4a8['limit'],_0x505280;if(_0x5eb903>=_0x13acc0){_0x5eb903=_0x13acc0;_0x505280=0xc8;}else{_0x505280=0xce;}_0x1ac3b7[_0xe381('0x2f')](_0x505280);return _0x1ac3b7[_0xe381('0x32')](_0xe381('0x33'),_0x238710+'-'+_0x5eb903+'/'+_0x13acc0)[_0xe381('0x34')](_0x2283d6);}return null;};}function patchUpdates(_0x6eb76a){return function(_0x1fd46e){try{jsonpatch[_0xe381('0x35')](_0x1fd46e,_0x6eb76a,!![]);}catch(_0xc54641){return BPromise[_0xe381('0x36')](_0xc54641);}return _0x1fd46e['save']();};}function saveUpdates(_0x3f5f9c,_0x47bc56){return function(_0x5e18de){if(_0x5e18de){return _0x5e18de['update'](_0x3f5f9c)[_0xe381('0x23')](function(_0x302b6d){return _0x302b6d;});}return null;};}function removeEntity(_0xc597ba,_0x5bc953){return function(_0x598598){if(_0x598598){return _0x598598[_0xe381('0x37')]()[_0xe381('0x23')](function(){var _0x5ce477=_0x598598[_0xe381('0x38')]({'plain':!![]});var _0x235d25=_0xe381('0x39');return db['UserProfileResource'][_0xe381('0x37')]({'where':{'type':_0x235d25,'resourceId':_0x5ce477['id']}})[_0xe381('0x23')](function(){return _0x598598;});})['then'](function(){_0xc597ba['status'](0xcc)[_0xe381('0x30')]();});}};}function handleEntityNotFound(_0x397472,_0x165fb5){return function(_0x330ca9){if(!_0x330ca9){_0x397472[_0xe381('0x2e')](0x194);}return _0x330ca9;};}function handleError(_0x414d83,_0xdfbee6){_0xdfbee6=_0xdfbee6||0x1f4;return function(_0x401034){logger[_0xe381('0x2a')](_0x401034[_0xe381('0x3a')]);if(_0x401034[_0xe381('0x3b')]){delete _0x401034[_0xe381('0x3b')];}_0x414d83['status'](_0xdfbee6)[_0xe381('0x3c')](_0x401034);};}exports[_0xe381('0x3d')]=function(_0x2009eb,_0x16729d){var _0x4d59b4={'include':[{'model':db[_0xe381('0x3e')],'as':_0xe381('0x3f')}]},_0x46d2ee={},_0x5b36c2={'count':0x0,'rows':[]};var _0x50119d=_[_0xe381('0x40')](db[_0xe381('0x41')]['rawAttributes'],function(_0x1853ef){return{'name':_0x1853ef['fieldName'],'type':_0x1853ef[_0xe381('0x42')][_0xe381('0x43')]};});_0x46d2ee[_0xe381('0x44')]=_['map'](_0x50119d,_0xe381('0x3b'));_0x46d2ee[_0xe381('0x45')]=_[_0xe381('0x46')](_0x2009eb[_0xe381('0x45')]);_0x46d2ee[_0xe381('0x47')]=_[_0xe381('0x48')](_0x46d2ee[_0xe381('0x44')],_0x46d2ee[_0xe381('0x45')]);_0x4d59b4[_0xe381('0x49')]=_['intersection'](_0x46d2ee['model'],qs[_0xe381('0x4a')](_0x2009eb[_0xe381('0x45')][_0xe381('0x4a')]));_0x4d59b4['attributes']=_0x4d59b4[_0xe381('0x49')]['length']?_0x4d59b4['attributes']:_0x46d2ee[_0xe381('0x44')];if(!_0x2009eb[_0xe381('0x45')][_0xe381('0x4b')](_0xe381('0x4c'))){_0x4d59b4['limit']=qs[_0xe381('0x4d')](_0x2009eb[_0xe381('0x45')][_0xe381('0x4d')]);_0x4d59b4[_0xe381('0x31')]=qs[_0xe381('0x31')](_0x2009eb[_0xe381('0x45')][_0xe381('0x31')]);}_0x4d59b4[_0xe381('0x4e')]=qs[_0xe381('0x4f')](_0x2009eb[_0xe381('0x45')][_0xe381('0x4f')]);_0x4d59b4[_0xe381('0x50')]=qs[_0xe381('0x47')](_['pick'](_0x2009eb[_0xe381('0x45')],_0x46d2ee[_0xe381('0x47')]),_0x50119d);if(_0x2009eb[_0xe381('0x45')]['filter']){_0x4d59b4[_0xe381('0x50')]=_[_0xe381('0x51')](_0x4d59b4['where'],{'$or':_['map'](_0x50119d,function(_0x48fd2f){if(_0x48fd2f[_0xe381('0x42')]!==_0xe381('0x52')){var _0x5e9e8a={};_0x5e9e8a[_0x48fd2f['name']]={'$like':'%'+_0x2009eb[_0xe381('0x45')][_0xe381('0x53')]+'%'};return _0x5e9e8a;}})});}_0x4d59b4=_['merge']({},_0x4d59b4,_0x2009eb[_0xe381('0x54')]);var _0x1a4f0c={'where':_0x4d59b4['where']};return db[_0xe381('0x41')][_0xe381('0x55')](_0x1a4f0c)[_0xe381('0x23')](function(_0x5188a7){_0x5b36c2[_0xe381('0x55')]=_0x5188a7;if(_0x2009eb[_0xe381('0x45')][_0xe381('0x56')]){_0x4d59b4['include']=[{'all':!![]}];}return db[_0xe381('0x41')][_0xe381('0x57')](_0x4d59b4);})['then'](function(_0x144097){_0x5b36c2['rows']=_0x144097;return _0x5b36c2;})[_0xe381('0x23')](respondWithFilteredResult(_0x16729d,_0x4d59b4))[_0xe381('0x58')](handleError(_0x16729d,null));};exports[_0xe381('0x59')]=function(_0x632711,_0x245201){var _0x38f476={'raw':![],'where':{'id':_0x632711[_0xe381('0x5a')]['id']},'include':[{'model':db[_0xe381('0x3e')],'as':_0xe381('0x3f')}]},_0x39c5e6={};_0x39c5e6[_0xe381('0x44')]=_[_0xe381('0x46')](db['OpenchannelAccount'][_0xe381('0x5b')]);_0x39c5e6[_0xe381('0x45')]=_[_0xe381('0x46')](_0x632711['query']);_0x39c5e6[_0xe381('0x47')]=_[_0xe381('0x48')](_0x39c5e6['model'],_0x39c5e6['query']);_0x38f476[_0xe381('0x49')]=_[_0xe381('0x48')](_0x39c5e6['model'],qs[_0xe381('0x4a')](_0x632711[_0xe381('0x45')][_0xe381('0x4a')]));_0x38f476[_0xe381('0x49')]=_0x38f476[_0xe381('0x49')]['length']?_0x38f476[_0xe381('0x49')]:_0x39c5e6[_0xe381('0x44')];if(_0x632711[_0xe381('0x45')][_0xe381('0x56')]){_0x38f476[_0xe381('0x5c')]=[{'all':!![]}];}_0x38f476=_['merge']({},_0x38f476,_0x632711[_0xe381('0x54')]);return db[_0xe381('0x41')][_0xe381('0x5d')](_0x38f476)['then'](handleEntityNotFound(_0x245201,null))[_0xe381('0x23')](respondWithResult(_0x245201,null))['catch'](handleError(_0x245201,null));};exports[_0xe381('0x5e')]=function(_0xf4663,_0x25d07f){return db[_0xe381('0x41')][_0xe381('0x5e')](_0xf4663[_0xe381('0x5f')],{})[_0xe381('0x23')](function(_0x2fcf94){var _0x4826f6=_0xf4663[_0xe381('0x60')]['get']({'plain':!![]});if(!_0x4826f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4826f6[_0xe381('0x61')]===_0xe381('0x60')){var _0x8b8980=_0x2fcf94[_0xe381('0x38')]({'plain':!![]});var _0x1b9ce1=_0xe381('0x39');return db[_0xe381('0x62')][_0xe381('0x5d')]({'where':{'name':_0x1b9ce1,'userProfileId':_0x4826f6[_0xe381('0x63')]},'raw':!![]})[_0xe381('0x23')](function(_0x389f61){if(_0x389f61&&_0x389f61[_0xe381('0x64')]===0x0){return db[_0xe381('0x65')][_0xe381('0x5e')]({'name':_0x8b8980[_0xe381('0x3b')],'resourceId':_0x8b8980['id'],'type':_0x389f61[_0xe381('0x3b')],'sectionId':_0x389f61['id']},{})[_0xe381('0x23')](function(){return _0x2fcf94;});}else{return _0x2fcf94;}})[_0xe381('0x58')](function(_0x462561){logger[_0xe381('0x2a')](_0xe381('0x66'),_0x462561);throw _0x462561;});}return _0x2fcf94;})['then'](respondWithResult(_0x25d07f,0xc9))['catch'](handleError(_0x25d07f,null));};exports[_0xe381('0x67')]=function(_0x3fa9ec,_0x19d6c3){if(_0x3fa9ec[_0xe381('0x5f')]['id']){delete _0x3fa9ec[_0xe381('0x5f')]['id'];}return db[_0xe381('0x41')]['find']({'where':{'id':_0x3fa9ec[_0xe381('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xe381('0x23')](handleEntityNotFound(_0x19d6c3,null))[_0xe381('0x23')](saveUpdates(_0x3fa9ec[_0xe381('0x5f')],null))['then'](respondWithResult(_0x19d6c3,null))[_0xe381('0x58')](handleError(_0x19d6c3,null));};exports[_0xe381('0x37')]=function(_0x4526f2,_0x505e59){return db[_0xe381('0x41')][_0xe381('0x5d')]({'where':{'id':_0x4526f2[_0xe381('0x5a')]['id']}})[_0xe381('0x23')](handleEntityNotFound(_0x505e59,null))[_0xe381('0x23')](removeEntity(_0x505e59,null))['catch'](handleError(_0x505e59,null));};exports['describe']=function(_0x270b15,_0x17b79c){return db[_0xe381('0x41')][_0xe381('0x68')]()[_0xe381('0x23')](respondWithResult(_0x17b79c,null))['catch'](handleError(_0x17b79c,null));};exports[_0xe381('0x69')]=function(_0x5bd582,_0xbc16d8,_0xe10e3a){if(_0x5bd582[_0xe381('0x5f')]['id']){delete _0x5bd582[_0xe381('0x5f')]['id'];}return db['OpenchannelAccount'][_0xe381('0x5d')]({'where':{'id':_0x5bd582[_0xe381('0x5a')]['id']}})[_0xe381('0x23')](handleEntityNotFound(_0xbc16d8,null))[_0xe381('0x23')](function(_0x2280e7){if(_0x2280e7){_0x5bd582['body'][_0xe381('0x6a')]=_0x2280e7['id'];return db[_0xe381('0x6b')]['create'](_0x5bd582[_0xe381('0x5f')]);}})['then'](respondWithResult(_0xbc16d8,null))[_0xe381('0x58')](handleError(_0xbc16d8,null));};exports[_0xe381('0x6c')]=function(_0x404a46,_0x1cbfbc,_0x338e15){var _0x17fd26={'raw':![],'where':{}};var _0xba88c4={};var _0x256fa0={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe381('0x6d')]({'where':{'id':_0x404a46[_0xe381('0x5a')]['id']}})[_0xe381('0x23')](handleEntityNotFound(_0x1cbfbc,null))[_0xe381('0x23')](function(_0x1f7593){if(_0x1f7593){_0xba88c4[_0xe381('0x44')]=_[_0xe381('0x46')](db['Disposition']['rawAttributes']);_0xba88c4[_0xe381('0x45')]=_[_0xe381('0x46')](_0x404a46[_0xe381('0x45')]);_0xba88c4[_0xe381('0x47')]=_['intersection'](_0xba88c4['model'],_0xba88c4['query']);_0x17fd26[_0xe381('0x49')]=_[_0xe381('0x48')](_0xba88c4[_0xe381('0x44')],qs[_0xe381('0x4a')](_0x404a46['query'][_0xe381('0x4a')]));_0x17fd26[_0xe381('0x49')]=_0x17fd26[_0xe381('0x49')][_0xe381('0x6e')]?_0x17fd26['attributes']:_0xba88c4[_0xe381('0x44')];if(!_0x404a46[_0xe381('0x45')][_0xe381('0x4b')](_0xe381('0x4c'))){_0x17fd26['limit']=qs['limit'](_0x404a46[_0xe381('0x45')][_0xe381('0x4d')]);_0x17fd26[_0xe381('0x31')]=qs['offset'](_0x404a46[_0xe381('0x45')][_0xe381('0x31')]);}_0x17fd26[_0xe381('0x4e')]=qs[_0xe381('0x4f')](_0x404a46['query'][_0xe381('0x4f')]);_0x17fd26['where']=qs[_0xe381('0x47')](_[_0xe381('0x6f')](_0x404a46[_0xe381('0x45')],_0xba88c4[_0xe381('0x47')]));_0x17fd26[_0xe381('0x50')][_0xe381('0x70')]=_0x1f7593['id'];if(_0x404a46[_0xe381('0x45')]['filter']){_0x17fd26[_0xe381('0x50')]=_[_0xe381('0x51')](_0x17fd26[_0xe381('0x50')],{'$or':_[_0xe381('0x40')](_0x17fd26[_0xe381('0x49')],function(_0x1c76ef){var _0x4a5909={};_0x4a5909[_0x1c76ef]={'$like':'%'+_0x404a46[_0xe381('0x45')][_0xe381('0x53')]+'%'};return _0x4a5909;})});}_0x17fd26=_['merge']({},_0x17fd26,_0x404a46['options']);return db[_0xe381('0x6b')]['count']({'where':_0x17fd26['where']})['then'](function(_0x405050){_0x256fa0['count']=_0x405050;if(_0x404a46[_0xe381('0x45')][_0xe381('0x56')]){_0x17fd26[_0xe381('0x5c')]=[{'all':!![]}];}return db[_0xe381('0x6b')]['findAll'](_0x17fd26);})['then'](function(_0x4a30fe){_0x256fa0['rows']=_0x4a30fe;return _0x256fa0;});}})['then'](respondWithFilteredResult(_0x1cbfbc,_0x17fd26))[_0xe381('0x58')](handleError(_0x1cbfbc,null));};exports[_0xe381('0x71')]=function(_0x2a8f69,_0x479478,_0x5002f8){return db[_0xe381('0x41')][_0xe381('0x5d')]({'where':{'id':_0x2a8f69[_0xe381('0x5a')]['id']}})[_0xe381('0x23')](handleEntityNotFound(_0x479478,null))[_0xe381('0x23')](function(_0x89ebe2){if(_0x89ebe2){return _0x89ebe2[_0xe381('0x71')](_0x2a8f69[_0xe381('0x45')]['ids']);}})[_0xe381('0x23')](respondWithStatusCode(_0x479478,null))[_0xe381('0x58')](handleError(_0x479478,null));};exports['addAnswer']=function(_0x706dcc,_0x5ddaf7,_0x32e102){if(_0x706dcc[_0xe381('0x5f')]['id']){delete _0x706dcc[_0xe381('0x5f')]['id'];}return db['OpenchannelAccount'][_0xe381('0x5d')]({'where':{'id':_0x706dcc['params']['id']}})[_0xe381('0x23')](handleEntityNotFound(_0x5ddaf7,null))[_0xe381('0x23')](function(_0x14af4b){if(_0x14af4b){_0x706dcc['body']['OpenchannelAccountId']=_0x14af4b['id'];return db[_0xe381('0x72')]['create'](_0x706dcc[_0xe381('0x5f')]);}})[_0xe381('0x23')](respondWithResult(_0x5ddaf7,null))['catch'](handleError(_0x5ddaf7,null));};exports[_0xe381('0x73')]=function(_0x4a8990,_0x580252,_0x11cd7e){var _0x192f52={'raw':![],'where':{}};var _0x658dd7={};var _0x369af3={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe381('0x6d')]({'where':{'id':_0x4a8990[_0xe381('0x5a')]['id']}})[_0xe381('0x23')](handleEntityNotFound(_0x580252,null))['then'](function(_0x49067a){if(_0x49067a){_0x658dd7[_0xe381('0x44')]=_[_0xe381('0x46')](db[_0xe381('0x72')][_0xe381('0x5b')]);_0x658dd7[_0xe381('0x45')]=_[_0xe381('0x46')](_0x4a8990['query']);_0x658dd7['filters']=_[_0xe381('0x48')](_0x658dd7[_0xe381('0x44')],_0x658dd7[_0xe381('0x45')]);_0x192f52['attributes']=_[_0xe381('0x48')](_0x658dd7['model'],qs[_0xe381('0x4a')](_0x4a8990[_0xe381('0x45')][_0xe381('0x4a')]));_0x192f52[_0xe381('0x49')]=_0x192f52[_0xe381('0x49')][_0xe381('0x6e')]?_0x192f52[_0xe381('0x49')]:_0x658dd7[_0xe381('0x44')];if(!_0x4a8990[_0xe381('0x45')][_0xe381('0x4b')](_0xe381('0x4c'))){_0x192f52[_0xe381('0x4d')]=qs[_0xe381('0x4d')](_0x4a8990[_0xe381('0x45')][_0xe381('0x4d')]);_0x192f52[_0xe381('0x31')]=qs[_0xe381('0x31')](_0x4a8990[_0xe381('0x45')][_0xe381('0x31')]);}_0x192f52[_0xe381('0x4e')]=qs[_0xe381('0x4f')](_0x4a8990[_0xe381('0x45')]['sort']);_0x192f52[_0xe381('0x50')]=qs[_0xe381('0x47')](_['pick'](_0x4a8990[_0xe381('0x45')],_0x658dd7[_0xe381('0x47')]));_0x192f52[_0xe381('0x50')][_0xe381('0x70')]=_0x49067a['id'];if(_0x4a8990[_0xe381('0x45')][_0xe381('0x53')]){_0x192f52[_0xe381('0x50')]=_[_0xe381('0x51')](_0x192f52['where'],{'$or':_[_0xe381('0x40')](_0x192f52[_0xe381('0x49')],function(_0x16b333){var _0x2718e6={};_0x2718e6[_0x16b333]={'$like':'%'+_0x4a8990[_0xe381('0x45')][_0xe381('0x53')]+'%'};return _0x2718e6;})});}_0x192f52=_[_0xe381('0x51')]({},_0x192f52,_0x4a8990[_0xe381('0x54')]);return db['CannedAnswer'][_0xe381('0x55')]({'where':_0x192f52[_0xe381('0x50')]})[_0xe381('0x23')](function(_0x4e6dfb){_0x369af3[_0xe381('0x55')]=_0x4e6dfb;if(_0x4a8990[_0xe381('0x45')]['includeAll']){_0x192f52[_0xe381('0x5c')]=[{'all':!![]}];}return db[_0xe381('0x72')][_0xe381('0x57')](_0x192f52);})['then'](function(_0x3f7f52){_0x369af3['rows']=_0x3f7f52;return _0x369af3;});}})[_0xe381('0x23')](respondWithFilteredResult(_0x580252,_0x192f52))[_0xe381('0x58')](handleError(_0x580252,null));};exports['removeAnswers']=function(_0x238bae,_0xef598e,_0x1b4785){return db[_0xe381('0x41')]['find']({'where':{'id':_0x238bae['params']['id']}})[_0xe381('0x23')](handleEntityNotFound(_0xef598e,null))['then'](function(_0x201dfe){if(_0x201dfe){return _0x201dfe[_0xe381('0x74')](_0x238bae[_0xe381('0x45')][_0xe381('0x75')]);}})[_0xe381('0x23')](respondWithStatusCode(_0xef598e,null))[_0xe381('0x58')](handleError(_0xef598e,null));};exports[_0xe381('0x76')]=function(_0x2c26af,_0x2dc3db,_0x5d1f3a){var _0x516421={'body':_0x2c26af[_0xe381('0x5f')],'channel':_0xe381('0x77')};var _0x2e8a44=[];var _0x4b62be=[];var _0x10359b={};var _0x3642df=![];return db[_0xe381('0x78')]['describe']()['then'](function(_0x4cea83){if(!_0x4cea83){throw new db[(_0xe381('0x20'))][(_0xe381('0x21'))]('no\x20available\x20attributes');}_0x2e8a44=_[_0xe381('0x79')](_[_0xe381('0x46')](_0x4cea83),[_0xe381('0x7a'),'updatedAt']);_0x4b62be=_['difference'](_[_0xe381('0x46')](_0x4cea83),[_0xe381('0x7a'),_0xe381('0x7b'),_0xe381('0x7c'),_0xe381('0x7d')]);if(_0x2c26af['body']['id']){delete _0x2c26af['body']['id'];}if(_[_0xe381('0x7e')](_0x2c26af[_0xe381('0x5f')][_0xe381('0x7f')])){throw new db['Sequelize'][(_0xe381('0x21'))](_0xe381('0x80'));}if(_[_0xe381('0x7e')](_0x2c26af[_0xe381('0x5f')][_0xe381('0x5f')])||_0x2c26af['body']['body']===''){throw new db[(_0xe381('0x20'))][(_0xe381('0x21'))](_0xe381('0x81'));}if(_[_0xe381('0x7e')](_0x2c26af[_0xe381('0x5f')][_0xe381('0x82')])){throw new db[(_0xe381('0x20'))][(_0xe381('0x21'))](_0xe381('0x83')+_0x4b62be);}if(!_[_0xe381('0x84')](_0x4b62be,_0x2c26af[_0xe381('0x5f')][_0xe381('0x82')])){throw new db[(_0xe381('0x20'))][(_0xe381('0x21'))](_0xe381('0x85')+_0x4b62be);}_0x10359b[_0x2c26af['body'][_0xe381('0x82')]]=_0x2c26af[_0xe381('0x5f')][_0xe381('0x7f')];})['then'](function(){return db['OpenchannelAccount'][_0xe381('0x5d')]({'where':{'id':_0x2c26af[_0xe381('0x5a')]['id']},'include':[{'model':db[_0xe381('0x86')],'as':_0xe381('0x87'),'include':[{'model':db[_0xe381('0x78')],'as':_0xe381('0x88'),'where':_0x10359b,'limit':0x1,'order':[[_0xe381('0x7b'),_0xe381('0x89')]]}]},{'model':db[_0xe381('0x8a')],'as':_0xe381('0x8b')}]});})[_0xe381('0x23')](handleEntityNotFound(_0x2dc3db,null))['then'](function(_0x579654){if(_0x579654&&_0x579654[_0xe381('0x87')]){_0x516421[_0xe381('0x8c')]=_0x579654;_0x516421['applications']=_0x579654[_0xe381('0x8b')];_0x516421[_0xe381('0x8d')]=_0x579654[_0xe381('0x87')];_0x516421[_0xe381('0x8e')]=_[_0xe381('0x8f')](_0x516421[_0xe381('0x8e')],[_0xe381('0x90')],[_0xe381('0x91')]);if(_0x516421[_0xe381('0x8c')][_0xe381('0x8b')]){delete _0x516421[_0xe381('0x8c')][_0xe381('0x8b')];}if(_0x516421[_0xe381('0x8c')][_0xe381('0x87')]&&_0x516421['account'][_0xe381('0x87')][_0xe381('0x88')][_0xe381('0x6e')]){return _0x516421[_0xe381('0x8c')][_0xe381('0x87')][_0xe381('0x88')][0x0];}var _0x2a2ad8=_[_0xe381('0x92')](_0x2c26af[_0xe381('0x5f')],{'firstName':_0x2c26af[_0xe381('0x5f')][_0xe381('0x7f')],'ListId':_0x579654[_0xe381('0x7d')]});_0x2a2ad8[_0x2c26af[_0xe381('0x5f')]['mapKey']]=_0x2c26af[_0xe381('0x5f')][_0xe381('0x7f')];return db[_0xe381('0x78')][_0xe381('0x5e')](_0x2a2ad8,{'fields':_0x2e8a44,'raw':!![]});}})[_0xe381('0x23')](handleEntityNotFound(_0x2dc3db,null))['then'](function(_0xcccce2){_0x516421[_0xe381('0x93')]=_0xcccce2;if(_0xcccce2){var _0x897378={'ContactId':_0xcccce2['id'],'OpenchannelAccountId':_0x2c26af[_0xe381('0x5a')]['id'],'from':(_0xcccce2[_0xe381('0x94')]||'')+'\x20'+(_0xcccce2[_0xe381('0x95')]||'')};var _0x4c0092={'OpenchannelAccountId':_0x2c26af[_0xe381('0x5a')]['id'],'closed':![]};if(_0x2c26af[_0xe381('0x5f')][_0xe381('0x96')]){_0x4c0092[_0xe381('0x96')]=_0x2c26af[_0xe381('0x5f')][_0xe381('0x96')];return db[_0xe381('0x97')]['find']({'where':_0x4c0092})[_0xe381('0x23')](function(_0x183248){if(_0x183248){return[_0x183248,![]];}_0x897378['threadId']=_0x2c26af[_0xe381('0x5f')]['threadId'];_0x897378[_0xe381('0x98')]=_0x2c26af['body'][_0xe381('0x98')];return db[_0xe381('0x97')]['create'](_0x897378)[_0xe381('0x23')](function(_0xe92704){return[_0xe92704,!![]];});});}else{_0x4c0092[_0xe381('0x96')]=null;}_0x4c0092['ContactId']=_0xcccce2['id'];return db[_0xe381('0x97')][_0xe381('0x5d')]({'where':_0x4c0092})[_0xe381('0x23')](function(_0x523115){if(_0x523115){return[_0x523115,![]];}return db[_0xe381('0x97')][_0xe381('0x5e')](_0x897378)[_0xe381('0x23')](function(_0x2a00d0){return[_0x2a00d0,!![]];});});}})[_0xe381('0x99')](function(_0x1d5bbb,_0x1b3b1c){if(_0x1d5bbb){_0x3642df=_0x1b3b1c;if(!_0x1b3b1c){var _0x17dc39={'from':(_0x516421['contact'][_0xe381('0x94')]||'')+'\x20'+(_0x516421[_0xe381('0x93')][_0xe381('0x95')]||'')};if(_0x2c26af[_0xe381('0x5f')][_0xe381('0x96')]&&_0x2c26af[_0xe381('0x5f')]['messageId']&&_0x2c26af['body']['threadId']!=_0x2c26af[_0xe381('0x5f')][_0xe381('0x9a')]){_0x17dc39[_0xe381('0x96')]=_0x2c26af[_0xe381('0x5f')][_0xe381('0x9a')];}return _0x1d5bbb['update'](_0x17dc39);}else{return _0x1d5bbb;}}})[_0xe381('0x23')](function(_0xec982d){_0x516421[_0xe381('0x9b')]=_0xec982d['get']({'plain':!![]});_0x516421[_0xe381('0x9b')][_0xe381('0x9c')]=_0x3642df;if(_0x516421[_0xe381('0x9b')]['created']){if(_0x516421[_0xe381('0x8c')]['autoclose']){_0x516421['applications'][_0xe381('0x9d')]({'id':0x0,'priority':_0x516421['applications'][_0xe381('0x6e')]+0x1,'app':_0xe381('0x9e'),'appdata':_0xe381('0x9f'),'interval':_0xe381('0xa0')});}}return db['OpenchannelMessage'][_0xe381('0x5e')]({'body':_0x2c26af[_0xe381('0x5f')][_0xe381('0x5f')],'OpenchannelAccountId':_0x2c26af['params']['id'],'OpenchannelInteractionId':_0xec982d['id'],'direction':'in','ContactId':_0x516421[_0xe381('0x93')]['id'],'AttachmentId':_0x2c26af[_0xe381('0x5f')][_0xe381('0xa1')]});})[_0xe381('0x23')](function(_0x13760c){_0x516421[_0xe381('0x2c')]=_0x13760c;if(_0x516421[_0xe381('0x9b')]['UserId']){return db[_0xe381('0xa2')]['find']({'attributes':['id',_0xe381('0x3b')],'where':{'id':_0x516421[_0xe381('0x9b')][_0xe381('0xa3')]}})[_0xe381('0x23')](function(_0x144866){if(_0x144866){_0x516421[_0xe381('0x8e')][_0xe381('0xa4')]({'id':0x0,'priority':0x0,'app':_0xe381('0xa5'),'appdata':_0x144866['name']+','+(_0x516421['account'][_0xe381('0xa6')]||0xa),'interval':_0xe381('0xa0')});_0x516421['forcedOwnership']=![];}return respondWithRpcPromise(_0xe381('0xa7'),_0xe381('0xa8'),_0x516421);});}return respondWithRpcPromise(_0xe381('0xa7'),_0xe381('0xa8'),_0x516421);})[_0xe381('0x23')](function(_0x5a6249){respondWithRpcPromise('EventManager',_0xe381('0xa9'),{'event':_0xe381('0x76'),'message':_0x5a6249},client9002);return _0x5a6249;})[_0xe381('0x23')](respondWithResult(_0x2dc3db,null))[_0xe381('0x58')](handleError(_0x2dc3db,null));};exports['addApplications']=function(_0x2a51b7,_0x3142d2,_0x2fc854){return db[_0xe381('0x41')][_0xe381('0x6d')]({'where':{'id':_0x2a51b7[_0xe381('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3142d2,null))[_0xe381('0x23')](function(_0x2a6d78){if(_0x2a6d78){return db[_0xe381('0xaa')][_0xe381('0xab')](function(_0x1dc8dc){return db[_0xe381('0x8a')]['destroy']({'where':{'OpenchannelAccountId':_0x2a51b7[_0xe381('0x5a')]['id']},'transaction':_0x1dc8dc})['then'](function(_0x686a62){var _0x587994=_['map'](_0x2a51b7[_0xe381('0x5f')],function(_0x41ba69){_0x41ba69[_0xe381('0x70')]=_0x2a51b7[_0xe381('0x5a')]['id'];return _0x41ba69;});return db[_0xe381('0x8a')]['bulkCreate'](_0x587994,{'transaction':_0x1dc8dc});});})[_0xe381('0x23')](function(){return db[_0xe381('0x8a')][_0xe381('0xac')]({'where':{'OpenchannelAccountId':_0x2a51b7['params']['id']},'order':'priority'});});}})[_0xe381('0x23')](respondWithResult(_0x3142d2,null))[_0xe381('0x58')](handleError(_0x3142d2,null));};exports[_0xe381('0xad')]=function(_0x21644,_0x1e1457,_0x149bfa){var _0x363ac9={};var _0x27eaf5={};var _0x2c10b2;var _0x440f24;return db[_0xe381('0x41')][_0xe381('0x6d')]({'where':{'id':_0x21644[_0xe381('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1e1457,null))['then'](function(_0x39f542){if(_0x39f542){_0x2c10b2=_0x39f542;_0x27eaf5[_0xe381('0x44')]=_[_0xe381('0x46')](db['OpenchannelApplication'][_0xe381('0x5b')]);_0x27eaf5[_0xe381('0x45')]=_['keys'](_0x21644[_0xe381('0x45')]);_0x27eaf5[_0xe381('0x47')]=_[_0xe381('0x48')](_0x27eaf5[_0xe381('0x44')],_0x27eaf5[_0xe381('0x45')]);_0x363ac9['attributes']=_['intersection'](_0x27eaf5['model'],qs[_0xe381('0x4a')](_0x21644[_0xe381('0x45')][_0xe381('0x4a')]));_0x363ac9[_0xe381('0x49')]=_0x363ac9['attributes'][_0xe381('0x6e')]?_0x363ac9[_0xe381('0x49')]:_0x27eaf5[_0xe381('0x44')];_0x363ac9['order']=qs[_0xe381('0x4f')](_0x21644[_0xe381('0x45')][_0xe381('0x4f')]);_0x363ac9[_0xe381('0x50')]=qs[_0xe381('0x47')](_['pick'](_0x21644[_0xe381('0x45')],_0x27eaf5[_0xe381('0x47')]));if(_0x21644[_0xe381('0x45')][_0xe381('0x53')]){_0x363ac9[_0xe381('0x50')]=_[_0xe381('0x51')](_0x363ac9['where'],{'$or':_['map'](_0x363ac9[_0xe381('0x49')],function(_0x4747e0){var _0x5cf8bc={};_0x5cf8bc[_0x4747e0]={'$like':'%'+_0x21644[_0xe381('0x45')][_0xe381('0x53')]+'%'};return _0x5cf8bc;})});}_0x363ac9=_[_0xe381('0x51')]({},_0x363ac9,_0x21644[_0xe381('0x54')]);return _0x2c10b2[_0xe381('0xad')](_0x363ac9);}})[_0xe381('0x23')](function(_0x136171){if(_0x136171){_0x440f24=_0x136171[_0xe381('0x6e')];if(!_0x21644['query'][_0xe381('0x4b')](_0xe381('0x4c'))){_0x363ac9['limit']=qs[_0xe381('0x4d')](_0x21644[_0xe381('0x45')][_0xe381('0x4d')]);_0x363ac9[_0xe381('0x31')]=qs[_0xe381('0x31')](_0x21644[_0xe381('0x45')][_0xe381('0x31')]);}return _0x2c10b2[_0xe381('0xad')](_0x363ac9);}})['then'](function(_0x4a8974){if(_0x4a8974){return _0x4a8974?{'count':_0x440f24,'rows':_0x4a8974}:null;}})['then'](respondWithResult(_0x1e1457,null))[_0xe381('0x58')](handleError(_0x1e1457,null));};exports[_0xe381('0xae')]=function(_0x23b05,_0xc3829e,_0x12befb){var _0x224231={'raw':![],'where':{}};var _0x5de8d9={};var _0x14213d={'count':0x0,'rows':[]};return db[_0xe381('0x41')]['findOne']({'where':{'id':_0x23b05['params']['id']}})[_0xe381('0x23')](handleEntityNotFound(_0xc3829e,null))['then'](function(_0xf2712f){if(_0xf2712f){_0x5de8d9[_0xe381('0x44')]=_[_0xe381('0x46')](db['OpenchannelInteraction']['rawAttributes']);_0x5de8d9[_0xe381('0x45')]=_[_0xe381('0x46')](_0x23b05[_0xe381('0x45')]);_0x5de8d9[_0xe381('0x47')]=_[_0xe381('0x48')](_0x5de8d9[_0xe381('0x44')],_0x5de8d9[_0xe381('0x45')]);_0x224231['attributes']=_['intersection'](_0x5de8d9[_0xe381('0x44')],qs['fields'](_0x23b05['query'][_0xe381('0x4a')]));_0x224231[_0xe381('0x49')]=_0x224231['attributes'][_0xe381('0x6e')]?_0x224231['attributes']:_0x5de8d9[_0xe381('0x44')];if(!_0x23b05[_0xe381('0x45')]['hasOwnProperty'](_0xe381('0x4c'))){_0x224231['limit']=qs[_0xe381('0x4d')](_0x23b05['query'][_0xe381('0x4d')]);_0x224231['offset']=qs['offset'](_0x23b05[_0xe381('0x45')]['offset']);}_0x224231[_0xe381('0x4e')]=qs[_0xe381('0x4f')](_0x23b05[_0xe381('0x45')][_0xe381('0x4f')]);_0x224231[_0xe381('0x50')]=qs['filters'](_[_0xe381('0x6f')](_0x23b05[_0xe381('0x45')],_0x5de8d9[_0xe381('0x47')]));_0x224231[_0xe381('0x50')][_0xe381('0x70')]=_0xf2712f['id'];if(_0x23b05[_0xe381('0x45')]['filter']){_0x224231[_0xe381('0x50')]=_[_0xe381('0x51')](_0x224231['where'],{'$or':_[_0xe381('0x40')](_0x224231[_0xe381('0x49')],function(_0xcb9539){var _0x354dae={};_0x354dae[_0xcb9539]={'$like':'%'+_0x23b05[_0xe381('0x45')]['filter']+'%'};return _0x354dae;})});}_0x224231=_[_0xe381('0x51')]({},_0x224231,_0x23b05[_0xe381('0x54')]);return db[_0xe381('0x97')][_0xe381('0x55')]({'where':_0x224231[_0xe381('0x50')]})[_0xe381('0x23')](function(_0x16d8bd){_0x14213d[_0xe381('0x55')]=_0x16d8bd;if(_0x23b05[_0xe381('0x45')][_0xe381('0x56')]){_0x224231[_0xe381('0x5c')]=[{'model':db[_0xe381('0x78')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xe381('0xaf'),'attributes':['name',_0xe381('0xb0'),_0xe381('0xb1')],'required':![]},{'model':db[_0xe381('0xb2')],'as':_0xe381('0xb3'),'attributes':['id',_0xe381('0x3b'),_0xe381('0xb4')],'where':_0x23b05[_0xe381('0x45')]['tag']?{'id':_0x23b05[_0xe381('0x45')][_0xe381('0xb5')]}:undefined,'required':_0x23b05[_0xe381('0x45')]['tag']?!![]:![]}];}return db[_0xe381('0x97')][_0xe381('0x57')](_0x224231);})[_0xe381('0x23')](function(_0x41e621){_0x14213d['rows']=_0x41e621;return _0x14213d;});}})['then'](respondWithFilteredResult(_0xc3829e,_0x224231))[_0xe381('0x58')](handleError(_0xc3829e,null));};exports[_0xe381('0xb6')]=function(_0x1dd13b,_0x458cb8,_0x129385){return db[_0xe381('0x41')]['find']({'where':{'id':_0x1dd13b[_0xe381('0x5a')]['id']}})['then'](handleEntityNotFound(_0x458cb8,null))['then'](function(_0x2bc8b6){if(_0x2bc8b6){return _0x2bc8b6[_0xe381('0xb6')](_0x1dd13b[_0xe381('0x5f')]['ids'],_[_0xe381('0xb7')](_0x1dd13b[_0xe381('0x5f')],[_0xe381('0x75'),'id'])||{})[_0xe381('0x99')](function(_0x10178e){for(var _0x15de27=0x0;_0x15de27<_0x1dd13b[_0xe381('0x5f')][_0xe381('0x75')][_0xe381('0x6e')];_0x15de27+=0x1){socket['emit'](_0xe381('0xb8'),{'UserId':_0x1dd13b['body'][_0xe381('0x75')][_0x15de27],'OpenchannelAccountId':_0x1dd13b['params']['id']});}return _0x10178e;});}})[_0xe381('0x23')](respondWithResult(_0x458cb8,null))['catch'](handleError(_0x458cb8,null));};exports[_0xe381('0xb9')]=function(_0x3ba53a,_0x587450,_0x42141){return db[_0xe381('0x41')][_0xe381('0x5d')]({'where':{'id':_0x3ba53a[_0xe381('0x5a')]['id']}})[_0xe381('0x23')](handleEntityNotFound(_0x587450,null))[_0xe381('0x23')](function(_0x40af86){if(_0x40af86){return _0x40af86['removeAgents'](_0x3ba53a[_0xe381('0x45')][_0xe381('0x75')])['then'](function(){if(_[_0xe381('0xba')](_0x3ba53a['query']['ids'])){for(var _0x26e9b3=0x0;_0x26e9b3<_0x3ba53a[_0xe381('0x45')][_0xe381('0x75')]['length'];_0x26e9b3+=0x1){socket[_0xe381('0xbb')](_0xe381('0xbc'),{'UserId':Number(_0x3ba53a[_0xe381('0x45')]['ids'][_0x26e9b3]),'OpenchannelAccountId':Number(_0x3ba53a[_0xe381('0x5a')]['id'])});}}else{socket[_0xe381('0xbb')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3ba53a[_0xe381('0x45')][_0xe381('0x75')]),'OpenchannelAccountId':Number(_0x3ba53a[_0xe381('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x587450,null))[_0xe381('0x58')](handleError(_0x587450,null));};exports[_0xe381('0xbd')]=function(_0x2bada2,_0x4ca5cf,_0x2eb433){var _0x46f12f={};var _0x83dbfc={};var _0x1af299;var _0x147455;return db[_0xe381('0x41')][_0xe381('0x6d')]({'where':{'id':_0x2bada2[_0xe381('0x5a')]['id']}})[_0xe381('0x23')](handleEntityNotFound(_0x4ca5cf,null))['then'](function(_0x540060){if(_0x540060){_0x1af299=_0x540060;_0x83dbfc[_0xe381('0x44')]=_[_0xe381('0x46')](db[_0xe381('0xa2')][_0xe381('0x5b')]);_0x83dbfc[_0xe381('0x45')]=_[_0xe381('0x46')](_0x2bada2[_0xe381('0x45')]);_0x83dbfc[_0xe381('0x47')]=_[_0xe381('0x48')](_0x83dbfc[_0xe381('0x44')],_0x83dbfc['query']);_0x46f12f[_0xe381('0x49')]=_[_0xe381('0x48')](_0x83dbfc[_0xe381('0x44')],qs[_0xe381('0x4a')](_0x2bada2[_0xe381('0x45')][_0xe381('0x4a')]));_0x46f12f[_0xe381('0x49')]=_0x46f12f[_0xe381('0x49')]['length']?_0x46f12f[_0xe381('0x49')]:_0x83dbfc['model'];_0x46f12f[_0xe381('0x4e')]=qs['sort'](_0x2bada2[_0xe381('0x45')][_0xe381('0x4f')]);_0x46f12f['where']=qs[_0xe381('0x47')](_['pick'](_0x2bada2['query'],_0x83dbfc[_0xe381('0x47')]));if(_0x2bada2[_0xe381('0x45')][_0xe381('0x53')]){_0x46f12f[_0xe381('0x50')]=_['merge'](_0x46f12f[_0xe381('0x50')],{'$or':_['map'](_0x46f12f[_0xe381('0x49')],function(_0x377544){var _0x569812={};_0x569812[_0x377544]={'$like':'%'+_0x2bada2[_0xe381('0x45')][_0xe381('0x53')]+'%'};return _0x569812;})});}_0x46f12f=_[_0xe381('0x51')]({},_0x46f12f,_0x2bada2[_0xe381('0x54')]);return _0x1af299[_0xe381('0xbd')](_0x46f12f);}})[_0xe381('0x23')](function(_0x5e2d2d){if(_0x5e2d2d){_0x147455=_0x5e2d2d[_0xe381('0x6e')];if(!_0x2bada2['query'][_0xe381('0x4b')]('nolimit')){_0x46f12f['limit']=qs[_0xe381('0x4d')](_0x2bada2['query'][_0xe381('0x4d')]);_0x46f12f['offset']=qs[_0xe381('0x31')](_0x2bada2[_0xe381('0x45')]['offset']);}return _0x1af299[_0xe381('0xbd')](_0x46f12f);}})[_0xe381('0x23')](function(_0x553fa3){if(_0x553fa3){return _0x553fa3?{'count':_0x147455,'rows':_0x553fa3}:null;}})[_0xe381('0x23')](respondWithResult(_0x4ca5cf,null))['catch'](handleError(_0x4ca5cf,null));};exports[_0xe381('0x3c')]=function(_0x544998,_0x59be9e,_0x5e86c9){var _0x2dcf58,_0x4372dd,_0x4c84c7;if(_[_0xe381('0x7e')](_0x544998[_0xe381('0x5f')][_0xe381('0x5f')])||_0x544998['body']['body']===''){throw new db[(_0xe381('0x20'))][(_0xe381('0x21'))](_0xe381('0x81'));}if(_[_0xe381('0x7e')](_0x544998[_0xe381('0x5f')]['to'])){}_0x2dcf58=_0x544998[_0xe381('0x5f')]['to'];return db[_0xe381('0x41')][_0xe381('0x6d')]({'where':{'id':_0x544998[_0xe381('0x5a')]['id']}})[_0xe381('0x23')](handleEntityNotFound(_0x59be9e,null))[_0xe381('0x23')](function(_0x3bf8a8){if(_0x3bf8a8){return db[_0xe381('0x41')]['find']({'where':{'id':_0x3bf8a8['id']},'include':[{'model':db[_0xe381('0x86')],'as':_0xe381('0x87'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x3bf8a8['mapKey']]:_0x2dcf58},'limit':0x1,'order':[['updatedAt',_0xe381('0x89')]]}]}]})[_0xe381('0x23')](handleEntityNotFound(_0x59be9e,null))['then'](function(_0x503f3b){if(_0x503f3b&&_0x503f3b[_0xe381('0x87')]){_0x4372dd=_0x503f3b[_0xe381('0x38')]({'plain':!![]});if(_0x4372dd[_0xe381('0x87')]&&_0x4372dd[_0xe381('0x87')][_0xe381('0x88')][_0xe381('0x6e')]){return _0x4372dd[_0xe381('0x87')][_0xe381('0x88')][0x0];}return db[_0xe381('0x78')][_0xe381('0x5e')](_[_0xe381('0x92')](_0x544998[_0xe381('0x5f')],{'firstName':_0x2dcf58,[_0x503f3b[_0xe381('0x82')]]:_0x2dcf58,'phone':_0x2dcf58,'ListId':_0x4372dd[_0xe381('0x7d')]}));}})[_0xe381('0x23')](handleEntityNotFound(_0x59be9e,null))[_0xe381('0x23')](function(_0x2c4712){if(_0x2c4712){_0x4c84c7=_0x2c4712;return db['OpenchannelInteraction'][_0xe381('0x5d')]({'where':{'ContactId':_0x4c84c7['id'],'closed':![],'OpenchannelAccountId':_0x4372dd['id']}})[_0xe381('0x23')](function(_0x24f700){if(_0x24f700){return[_0x24f700,![]];}return db[_0xe381('0x97')]['create']({'UserId':_0x544998[_0xe381('0x60')]['id'],'ContactId':_0x4c84c7['id'],'OpenchannelAccountId':_0x4372dd['id'],'lastMsgDirection':_0xe381('0xbe'),'Messages':[_[_0xe381('0x51')](_0x544998['body'],{'read':![],'body':_0x544998['body'][_0xe381('0x5f')],'OpenchannelAccountId':_0x4372dd['id'],'UserId':_0x544998[_0xe381('0x60')]['id'],'ContactId':_0x4c84c7['id']})]},{'include':[{'model':db[_0xe381('0xbf')],'as':_0xe381('0xc0')}]})[_0xe381('0x23')](function(_0x156225){return[_0x156225,!![]];});});}})['spread'](function(_0x50125d,_0x1afd56){if(_0x1afd56){return _0x50125d;}return db[_0xe381('0xbf')][_0xe381('0x5e')](_['merge'](_0x544998[_0xe381('0x5f')],{'read':![],'body':_0x544998[_0xe381('0x5f')][_0xe381('0x5f')],'OpenchannelAccountId':_0x4372dd['id'],'OpenchannelInteractionId':_0x50125d['id'],'UserId':_0x544998[_0xe381('0x60')]['id'],'ContactId':_0x4c84c7['id']}))[_0xe381('0x23')](function(_0x2ab6c4){_0x50125d['dataValues']['Messages']=[];_0x50125d[_0xe381('0xc1')][_0xe381('0xc0')][_0xe381('0x9d')](_0x2ab6c4[_0xe381('0xc1')]);return _0x50125d;});});}})[_0xe381('0x23')](respondWithResult(_0x59be9e,null))[_0xe381('0x58')](handleError(_0x59be9e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b839789..3c6b90f 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 _0xe341=['emit','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x3c1018,_0x464dcc){var _0x5bc464=function(_0x56e08e){while(--_0x56e08e){_0x3c1018['push'](_0x3c1018['shift']());}};_0x5bc464(++_0x464dcc);}(_0xe341,0x137));var _0x1e34=function(_0x40a24b,_0x5edc5e){_0x40a24b=_0x40a24b-0x0;var _0x306e3b=_0xe341[_0x40a24b];return _0x306e3b;};'use strict';var EventEmitter=require(_0x1e34('0x0'));var OpenchannelAccount=require(_0x1e34('0x1'))['db'][_0x1e34('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1e34('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x30a38c){return function(_0x9b0229,_0x2832ca,_0xf77958){OpenchannelAccountEvents['emit'](_0x30a38c+':'+_0x9b0229['id'],_0x9b0229);OpenchannelAccountEvents[_0x1e34('0x4')](_0x30a38c,_0x9b0229);_0xf77958(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x1e34('0x5')](e,emitEvent(event));}}module[_0x1e34('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x0f8b=['update','emit','hasOwnProperty','hook','OpenchannelAccount','setMaxListeners','save'];(function(_0x7bf4a7,_0x51d7fa){var _0x204c0f=function(_0x374092){while(--_0x374092){_0x7bf4a7['push'](_0x7bf4a7['shift']());}};_0x204c0f(++_0x51d7fa);}(_0x0f8b,0x100));var _0xb0f8=function(_0x109e2e,_0x2e6ebd){_0x109e2e=_0x109e2e-0x0;var _0x290c37=_0x0f8b[_0x109e2e];return _0x290c37;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xb0f8('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb0f8('0x1')](0x0);var events={'afterCreate':_0xb0f8('0x2'),'afterUpdate':_0xb0f8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2b4d7e){return function(_0x3666f1,_0x55608b,_0x4bf29e){OpenchannelAccountEvents[_0xb0f8('0x4')](_0x2b4d7e+':'+_0x3666f1['id'],_0x3666f1);OpenchannelAccountEvents[_0xb0f8('0x4')](_0x2b4d7e,_0x3666f1);_0x4bf29e(null);};}for(var e in events){if(events[_0xb0f8('0x5')](e)){var event=events[e];OpenchannelAccount[_0xb0f8('0x6')](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 552d2c3..f61747d 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 _0xa2dd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util'];(function(_0x870817,_0x4ed7bc){var _0x4880e4=function(_0x3df467){while(--_0x3df467){_0x870817['push'](_0x870817['shift']());}};_0x4880e4(++_0x4ed7bc);}(_0xa2dd,0x11c));var _0xda2d=function(_0x3da628,_0x136ab8){_0x3da628=_0x3da628-0x0;var _0x169270=_0xa2dd[_0x3da628];return _0x169270;};'use strict';var _=require(_0xda2d('0x0'));var util=require(_0xda2d('0x1'));var logger=require(_0xda2d('0x2'))(_0xda2d('0x3'));var moment=require(_0xda2d('0x4'));var BPromise=require(_0xda2d('0x5'));var rp=require(_0xda2d('0x6'));var fs=require('fs');var path=require(_0xda2d('0x7'));var rimraf=require(_0xda2d('0x8'));var config=require('../../config/environment');var attributes=require(_0xda2d('0x9'));module[_0xda2d('0xa')]=function(_0x1f3115,_0x579d24){return _0x1f3115[_0xda2d('0xb')](_0xda2d('0xc'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc645=['path','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','api','bluebird','request-promise'];(function(_0x60bc76,_0x4c43b0){var _0x1d2e35=function(_0x44c839){while(--_0x44c839){_0x60bc76['push'](_0x60bc76['shift']());}};_0x1d2e35(++_0x4c43b0);}(_0xc645,0x1b3));var _0x5c64=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xc645[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x5c64('0x0'));var util=require(_0x5c64('0x1'));var logger=require('../../config/logger')(_0x5c64('0x2'));var moment=require('moment');var BPromise=require(_0x5c64('0x3'));var rp=require(_0x5c64('0x4'));var fs=require('fs');var path=require(_0x5c64('0x5'));var rimraf=require('rimraf');var config=require(_0x5c64('0x6'));var attributes=require(_0x5c64('0x7'));module[_0x5c64('0x8')]=function(_0x448b50,_0x5dd6d4){return _0x448b50[_0x5c64('0x9')](_0x5c64('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 c9602d1..085fa41 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 _0x0363=['OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then'];(function(_0x5cbf02,_0x53f105){var _0x441bf4=function(_0x4afa22){while(--_0x4afa22){_0x5cbf02['push'](_0x5cbf02['shift']());}};_0x441bf4(++_0x53f105);}(_0x0363,0x78));var _0x3036=function(_0x511dd6,_0x5d294d){_0x511dd6=_0x511dd6-0x0;var _0x39f16b=_0x0363[_0x511dd6];return _0x39f16b;};'use strict';var _=require(_0x3036('0x0'));var util=require(_0x3036('0x1'));var moment=require(_0x3036('0x2'));var BPromise=require(_0x3036('0x3'));var rs=require(_0x3036('0x4'));var fs=require('fs');var Redis=require(_0x3036('0x5'));var db=require(_0x3036('0x6'))['db'];var utils=require(_0x3036('0x7'));var logger=require(_0x3036('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3036('0x9'));var client=jayson[_0x3036('0xa')][_0x3036('0xb')]({'port':0x232a});config[_0x3036('0xc')]=_[_0x3036('0xd')](config['redis'],{'host':_0x3036('0xe'),'port':0x18eb});var socket=require(_0x3036('0xf'))(new Redis(config[_0x3036('0xc')]));require(_0x3036('0x10'))[_0x3036('0x11')](socket);function respondWithRpcPromise(_0x45e0de,_0xc3e06b,_0x1ca0e4){return new BPromise(function(_0x2c0685,_0x4fe098){return client[_0x3036('0x12')](_0x45e0de,_0x1ca0e4)[_0x3036('0x13')](function(_0x9ce7ac){logger['info'](_0x3036('0x14'),_0xc3e06b,'request\x20sent');logger[_0x3036('0x15')](_0x3036('0x16'),_0xc3e06b,_0x3036('0x17'),JSON['stringify'](_0x9ce7ac));if(_0x9ce7ac[_0x3036('0x18')]){if(_0x9ce7ac[_0x3036('0x18')][_0x3036('0x19')]===0x1f4){logger[_0x3036('0x18')](_0x3036('0x14'),_0xc3e06b,_0x9ce7ac['error'][_0x3036('0x1a')]);return _0x4fe098(_0x9ce7ac['error'][_0x3036('0x1a')]);}logger[_0x3036('0x18')](_0x3036('0x14'),_0xc3e06b,_0x9ce7ac[_0x3036('0x18')][_0x3036('0x1a')]);return _0x2c0685(_0x9ce7ac[_0x3036('0x18')]['message']);}else{logger['info'](_0x3036('0x14'),_0xc3e06b,_0x3036('0x17'));_0x2c0685(_0x9ce7ac[_0x3036('0x1b')]['message']);}})['catch'](function(_0x201dc4){logger[_0x3036('0x18')](_0x3036('0x14'),_0xc3e06b,_0x201dc4);_0x4fe098(_0x201dc4);});});} \ No newline at end of file +var _0x88e1=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x35eb0e,_0x2aa92e){var _0xcec969=function(_0x3284db){while(--_0x3284db){_0x35eb0e['push'](_0x35eb0e['shift']());}};_0xcec969(++_0x2aa92e);}(_0x88e1,0x17c));var _0x188e=function(_0x4738b7,_0x9096f0){_0x4738b7=_0x4738b7-0x0;var _0x47cb9e=_0x88e1[_0x4738b7];return _0x47cb9e;};'use strict';var _=require(_0x188e('0x0'));var util=require(_0x188e('0x1'));var moment=require(_0x188e('0x2'));var BPromise=require(_0x188e('0x3'));var rs=require(_0x188e('0x4'));var fs=require('fs');var Redis=require(_0x188e('0x5'));var db=require(_0x188e('0x6'))['db'];var utils=require(_0x188e('0x7'));var logger=require('../../config/logger')(_0x188e('0x8'));var config=require(_0x188e('0x9'));var jayson=require(_0x188e('0xa'));var client=jayson[_0x188e('0xb')][_0x188e('0xc')]({'port':0x232a});config[_0x188e('0xd')]=_[_0x188e('0xe')](config[_0x188e('0xd')],{'host':_0x188e('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x188e('0xd')]));require(_0x188e('0x10'))[_0x188e('0x11')](socket);function respondWithRpcPromise(_0x59cfcb,_0x594750,_0x354c34){return new BPromise(function(_0x4f4657,_0x338ed0){return client[_0x188e('0x12')](_0x59cfcb,_0x354c34)[_0x188e('0x13')](function(_0x5afc2a){logger[_0x188e('0x14')](_0x188e('0x15'),_0x594750,_0x188e('0x16'));logger['debug'](_0x188e('0x17'),_0x594750,'request\x20sent',JSON[_0x188e('0x18')](_0x5afc2a));if(_0x5afc2a[_0x188e('0x19')]){if(_0x5afc2a['error']['code']===0x1f4){logger[_0x188e('0x19')](_0x188e('0x15'),_0x594750,_0x5afc2a[_0x188e('0x19')][_0x188e('0x1a')]);return _0x338ed0(_0x5afc2a[_0x188e('0x19')][_0x188e('0x1a')]);}logger[_0x188e('0x19')](_0x188e('0x15'),_0x594750,_0x5afc2a['error']['message']);return _0x4f4657(_0x5afc2a[_0x188e('0x19')][_0x188e('0x1a')]);}else{logger[_0x188e('0x14')](_0x188e('0x15'),_0x594750,'request\x20sent');_0x4f4657(_0x5afc2a[_0x188e('0x1b')][_0x188e('0x1a')]);}})[_0x188e('0x1c')](function(_0x5af057){logger[_0x188e('0x19')](_0x188e('0x15'),_0x594750,_0x5af057);_0x338ed0(_0x5af057);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 6e9a85c..1ec453a 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 _0xff8f=['remove','update','emit','removeListener','register','length','./openchannelAccount.events','save'];(function(_0x53e398,_0x5b23d9){var _0x1690cd=function(_0x1e3dee){while(--_0x1e3dee){_0x53e398['push'](_0x53e398['shift']());}};_0x1690cd(++_0x5b23d9);}(_0xff8f,0x8e));var _0xfff8=function(_0x45b872,_0x5d3a69){_0x45b872=_0x45b872-0x0;var _0x2b4451=_0xff8f[_0x45b872];return _0x2b4451;};'use strict';var OpenchannelAccountEvents=require(_0xfff8('0x0'));var events=[_0xfff8('0x1'),_0xfff8('0x2'),_0xfff8('0x3')];function createListener(_0x302c1c,_0x3ec596){return function(_0x102c5c){_0x3ec596[_0xfff8('0x4')](_0x302c1c,_0x102c5c);};}function removeListener(_0x4c9bb8,_0xa77b3f){return function(){OpenchannelAccountEvents[_0xfff8('0x5')](_0x4c9bb8,_0xa77b3f);};}exports[_0xfff8('0x6')]=function(_0x35a668){for(var _0x453316=0x0,_0x33292e=events[_0xfff8('0x7')];_0x453316<_0x33292e;_0x453316++){var _0x1a8994=events[_0x453316];var _0x7f37dd=createListener('openchannelAccount:'+_0x1a8994,_0x35a668);OpenchannelAccountEvents['on'](_0x1a8994,_0x7f37dd);}}; \ No newline at end of file +var _0x5d06=['save','update','emit','removeListener','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0x5d06,0x99));var _0x65d0=function(_0xe499c5,_0x413f35){_0xe499c5=_0xe499c5-0x0;var _0x5a7176=_0x5d06[_0xe499c5];return _0x5a7176;};'use strict';var OpenchannelAccountEvents=require(_0x65d0('0x0'));var events=[_0x65d0('0x1'),'remove',_0x65d0('0x2')];function createListener(_0x15c08c,_0x2cb418){return function(_0x2c8b9f){_0x2cb418[_0x65d0('0x3')](_0x15c08c,_0x2c8b9f);};}function removeListener(_0x5058ac,_0x3f575f){return function(){OpenchannelAccountEvents[_0x65d0('0x4')](_0x5058ac,_0x3f575f);};}exports['register']=function(_0x5bf7ed){for(var _0x2b586c=0x0,_0x4509e0=events[_0x65d0('0x5')];_0x2b586c<_0x4509e0;_0x2b586c++){var _0x145c41=events[_0x2b586c];var _0x29e6bd=createListener(_0x65d0('0x6')+_0x145c41,_0x5bf7ed);OpenchannelAccountEvents['on'](_0x145c41,_0x29e6bd);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 78d4e55..cdab871 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 _0x66ee=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c263d,_0x36dc1c){var _0x2f667b=function(_0x280366){while(--_0x280366){_0x2c263d['push'](_0x2c263d['shift']());}};_0x2f667b(++_0x36dc1c);}(_0x66ee,0x1e6));var _0xe66e=function(_0x59580b,_0x3bd264){_0x59580b=_0x59580b-0x0;var _0x4b1933=_0x66ee[_0x59580b];return _0x4b1933;};'use strict';var multer=require(_0xe66e('0x0'));var util=require(_0xe66e('0x1'));var path=require(_0xe66e('0x2'));var timeout=require(_0xe66e('0x3'));var express=require('express');var router=express[_0xe66e('0x4')]();var auth=require(_0xe66e('0x5'));var interaction=require(_0xe66e('0x6'));var config=require(_0xe66e('0x7'));var controller=require('./openchannelApplication.controller');router[_0xe66e('0x8')]('/',auth[_0xe66e('0x9')](),controller[_0xe66e('0xa')]);router[_0xe66e('0x8')](_0xe66e('0xb'),auth['isAuthenticated'](),controller[_0xe66e('0xc')]);router[_0xe66e('0xd')]('/',auth[_0xe66e('0x9')](),controller[_0xe66e('0xe')]);router[_0xe66e('0xf')]('/:id',auth[_0xe66e('0x9')](),controller[_0xe66e('0x10')]);router[_0xe66e('0x11')](_0xe66e('0xb'),auth[_0xe66e('0x9')](),controller[_0xe66e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf197=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0xb9be54,_0x43ba92){var _0x55d70f=function(_0x1a12e5){while(--_0x1a12e5){_0xb9be54['push'](_0xb9be54['shift']());}};_0x55d70f(++_0x43ba92);}(_0xf197,0xeb));var _0x7f19=function(_0xa684c8,_0x3086ab){_0xa684c8=_0xa684c8-0x0;var _0x9512e7=_0xf197[_0xa684c8];return _0x9512e7;};'use strict';var multer=require(_0x7f19('0x0'));var util=require('util');var path=require(_0x7f19('0x1'));var timeout=require(_0x7f19('0x2'));var express=require('express');var router=express[_0x7f19('0x3')]();var auth=require(_0x7f19('0x4'));var interaction=require(_0x7f19('0x5'));var config=require(_0x7f19('0x6'));var controller=require('./openchannelApplication.controller');router[_0x7f19('0x7')]('/',auth[_0x7f19('0x8')](),controller[_0x7f19('0x9')]);router[_0x7f19('0x7')](_0x7f19('0xa'),auth['isAuthenticated'](),controller[_0x7f19('0xb')]);router['post']('/',auth[_0x7f19('0x8')](),controller['create']);router[_0x7f19('0xc')]('/:id',auth[_0x7f19('0x8')](),controller[_0x7f19('0xd')]);router[_0x7f19('0xe')](_0x7f19('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7f19('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index cb2c3c0..92df1d3 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 _0x37e9=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x597da3,_0x51b62b){var _0xd3cd83=function(_0x4a92df){while(--_0x4a92df){_0x597da3['push'](_0x597da3['shift']());}};_0xd3cd83(++_0x51b62b);}(_0x37e9,0x1f4));var _0x937e=function(_0x4c70c8,_0x17e81d){_0x4c70c8=_0x4c70c8-0x0;var _0x502c9a=_0x37e9[_0x4c70c8];return _0x502c9a;};'use strict';var Sequelize=require('sequelize');module[_0x937e('0x0')]={'priority':{'type':Sequelize[_0x937e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x937e('0x2')],'allowNull':![],'defaultValue':_0x937e('0x3')},'appdata':{'type':Sequelize[_0x937e('0x4')]()},'description':{'type':Sequelize[_0x937e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x937e('0x5')}}; \ No newline at end of file +var _0xd867=['STRING','*,*,*,*','sequelize','exports','INTEGER','TEXT'];(function(_0x4a9192,_0x143344){var _0x281a62=function(_0x1309a9){while(--_0x1309a9){_0x4a9192['push'](_0x4a9192['shift']());}};_0x281a62(++_0x143344);}(_0xd867,0x1dc));var _0x7d86=function(_0xb4073f,_0x1b1785){_0xb4073f=_0xb4073f-0x0;var _0x69613e=_0xd867[_0xb4073f];return _0x69613e;};'use strict';var Sequelize=require(_0x7d86('0x0'));module[_0x7d86('0x1')]={'priority':{'type':Sequelize[_0x7d86('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7d86('0x3')]()},'description':{'type':Sequelize[_0x7d86('0x4')]},'interval':{'type':Sequelize[_0x7d86('0x4')],'defaultValue':_0x7d86('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 346b757..6e7d5c8 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 _0x3bc3=['fields','length','model','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelApplication','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','intersection','attributes'];(function(_0x1fafd6,_0x46b419){var _0x45df97=function(_0x5a0de3){while(--_0x5a0de3){_0x1fafd6['push'](_0x1fafd6['shift']());}};_0x45df97(++_0x46b419);}(_0x3bc3,0x102));var _0x33bc=function(_0x5b78d8,_0x32d845){_0x5b78d8=_0x5b78d8-0x0;var _0x306bcb=_0x3bc3[_0x5b78d8];return _0x306bcb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x33bc('0x0'));var zipdir=require(_0x33bc('0x1'));var jsonpatch=require(_0x33bc('0x2'));var rp=require(_0x33bc('0x3'));var moment=require(_0x33bc('0x4'));var BPromise=require(_0x33bc('0x5'));var Mustache=require(_0x33bc('0x6'));var util=require(_0x33bc('0x7'));var path=require(_0x33bc('0x8'));var sox=require(_0x33bc('0x9'));var csv=require(_0x33bc('0xa'));var ejs=require(_0x33bc('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x33bc('0xc'));var deskjs=require(_0x33bc('0xd'));var toCsv=require(_0x33bc('0xa'));var querystring=require('querystring');var Papa=require(_0x33bc('0xe'));var Redis=require(_0x33bc('0xf'));var authService=require(_0x33bc('0x10'));var qs=require(_0x33bc('0x11'));var as=require(_0x33bc('0x12'));var hardwareService=require(_0x33bc('0x13'));var logger=require(_0x33bc('0x14'))(_0x33bc('0x15'));var utils=require('../../config/utils');var config=require(_0x33bc('0x16'));var db=require(_0x33bc('0x17'))['db'];function respondWithStatusCode(_0x5d6f0c,_0x36d90b){_0x36d90b=_0x36d90b||0xcc;return function(_0x67b0f8){if(_0x67b0f8){return _0x5d6f0c['sendStatus'](_0x36d90b);}return _0x5d6f0c[_0x33bc('0x18')](_0x36d90b)[_0x33bc('0x19')]();};}function respondWithResult(_0x3199ad,_0x4d7a48){_0x4d7a48=_0x4d7a48||0xc8;return function(_0x10f5a0){if(_0x10f5a0){return _0x3199ad[_0x33bc('0x18')](_0x4d7a48)[_0x33bc('0x1a')](_0x10f5a0);}};}function respondWithFilteredResult(_0x4d8c77,_0x12ddc6){return function(_0x570440){if(_0x570440){var _0x4f13d8=_0x570440[_0x33bc('0x1b')],_0x1d9071=_0x12ddc6[_0x33bc('0x1c')],_0x18c809=_0x12ddc6[_0x33bc('0x1c')]+_0x12ddc6['limit'],_0x4e3564;if(_0x18c809>=_0x4f13d8){_0x18c809=_0x4f13d8;_0x4e3564=0xc8;}else{_0x4e3564=0xce;}_0x4d8c77['status'](_0x4e3564);return _0x4d8c77[_0x33bc('0x1d')](_0x33bc('0x1e'),_0x1d9071+'-'+_0x18c809+'/'+_0x4f13d8)['json'](_0x570440);}return null;};}function patchUpdates(_0x18593c){return function(_0x5b7067){try{jsonpatch[_0x33bc('0x1f')](_0x5b7067,_0x18593c,!![]);}catch(_0x9105a0){return BPromise[_0x33bc('0x20')](_0x9105a0);}return _0x5b7067[_0x33bc('0x21')]();};}function saveUpdates(_0xa907fc,_0x49ed85){return function(_0x209435){if(_0x209435){return _0x209435[_0x33bc('0x22')](_0xa907fc)[_0x33bc('0x23')](function(_0x3a9040){return _0x3a9040;});}return null;};}function removeEntity(_0x21941c,_0x59bb55){return function(_0xacf3cb){if(_0xacf3cb){return _0xacf3cb['destroy']()[_0x33bc('0x23')](function(){_0x21941c[_0x33bc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11c02e,_0x1211e8){return function(_0x214c0f){if(!_0x214c0f){_0x11c02e[_0x33bc('0x24')](0x194);}return _0x214c0f;};}function handleError(_0x1a4d1e,_0x18c15c){_0x18c15c=_0x18c15c||0x1f4;return function(_0x32070e){logger[_0x33bc('0x25')](_0x32070e[_0x33bc('0x26')]);if(_0x32070e[_0x33bc('0x27')]){delete _0x32070e['name'];}_0x1a4d1e['status'](_0x18c15c)[_0x33bc('0x28')](_0x32070e);};}exports[_0x33bc('0x29')]=function(_0x480308,_0x1f5e1d){var _0xe01e88={},_0x397441={},_0x7c62b2={'count':0x0,'rows':[]};var _0xbd57c9=_['map'](db['OpenchannelApplication'][_0x33bc('0x2a')],function(_0x5b92ac){return{'name':_0x5b92ac[_0x33bc('0x2b')],'type':_0x5b92ac['type'][_0x33bc('0x2c')]};});_0x397441['model']=_[_0x33bc('0x2d')](_0xbd57c9,_0x33bc('0x27'));_0x397441[_0x33bc('0x2e')]=_[_0x33bc('0x2f')](_0x480308['query']);_0x397441['filters']=_[_0x33bc('0x30')](_0x397441['model'],_0x397441[_0x33bc('0x2e')]);_0xe01e88[_0x33bc('0x31')]=_['intersection'](_0x397441['model'],qs[_0x33bc('0x32')](_0x480308[_0x33bc('0x2e')][_0x33bc('0x32')]));_0xe01e88[_0x33bc('0x31')]=_0xe01e88[_0x33bc('0x31')][_0x33bc('0x33')]?_0xe01e88['attributes']:_0x397441[_0x33bc('0x34')];if(!_0x480308[_0x33bc('0x2e')][_0x33bc('0x35')](_0x33bc('0x36'))){_0xe01e88[_0x33bc('0x37')]=qs['limit'](_0x480308['query'][_0x33bc('0x37')]);_0xe01e88[_0x33bc('0x1c')]=qs[_0x33bc('0x1c')](_0x480308[_0x33bc('0x2e')][_0x33bc('0x1c')]);}_0xe01e88['order']=qs[_0x33bc('0x38')](_0x480308[_0x33bc('0x2e')]['sort']);_0xe01e88['where']=qs[_0x33bc('0x39')](_[_0x33bc('0x3a')](_0x480308['query'],_0x397441[_0x33bc('0x39')]),_0xbd57c9);if(_0x480308[_0x33bc('0x2e')][_0x33bc('0x3b')]){_0xe01e88[_0x33bc('0x3c')]=_[_0x33bc('0x3d')](_0xe01e88[_0x33bc('0x3c')],{'$or':_[_0x33bc('0x2d')](_0xbd57c9,function(_0xa08d85){if(_0xa08d85[_0x33bc('0x3e')]!==_0x33bc('0x3f')){var _0x5d30db={};_0x5d30db[_0xa08d85[_0x33bc('0x27')]]={'$like':'%'+_0x480308['query'][_0x33bc('0x3b')]+'%'};return _0x5d30db;}})});}_0xe01e88=_['merge']({},_0xe01e88,_0x480308[_0x33bc('0x40')]);var _0x23798a={'where':_0xe01e88[_0x33bc('0x3c')]};return db[_0x33bc('0x41')][_0x33bc('0x1b')](_0x23798a)[_0x33bc('0x23')](function(_0x235fbc){_0x7c62b2[_0x33bc('0x1b')]=_0x235fbc;if(_0x480308['query']['includeAll']){_0xe01e88[_0x33bc('0x42')]=[{'all':!![]}];}return db[_0x33bc('0x41')][_0x33bc('0x43')](_0xe01e88);})['then'](function(_0x463855){_0x7c62b2[_0x33bc('0x44')]=_0x463855;return _0x7c62b2;})[_0x33bc('0x23')](respondWithFilteredResult(_0x1f5e1d,_0xe01e88))[_0x33bc('0x45')](handleError(_0x1f5e1d,null));};exports[_0x33bc('0x46')]=function(_0x1eb5c1,_0x268231){var _0x11a0da={'raw':!![],'where':{'id':_0x1eb5c1[_0x33bc('0x47')]['id']}},_0x4e350d={};_0x4e350d[_0x33bc('0x34')]=_[_0x33bc('0x2f')](db[_0x33bc('0x41')][_0x33bc('0x2a')]);_0x4e350d[_0x33bc('0x2e')]=_[_0x33bc('0x2f')](_0x1eb5c1[_0x33bc('0x2e')]);_0x4e350d[_0x33bc('0x39')]=_[_0x33bc('0x30')](_0x4e350d[_0x33bc('0x34')],_0x4e350d[_0x33bc('0x2e')]);_0x11a0da[_0x33bc('0x31')]=_[_0x33bc('0x30')](_0x4e350d['model'],qs[_0x33bc('0x32')](_0x1eb5c1[_0x33bc('0x2e')]['fields']));_0x11a0da[_0x33bc('0x31')]=_0x11a0da['attributes'][_0x33bc('0x33')]?_0x11a0da[_0x33bc('0x31')]:_0x4e350d['model'];if(_0x1eb5c1['query'][_0x33bc('0x48')]){_0x11a0da[_0x33bc('0x42')]=[{'all':!![]}];}_0x11a0da=_[_0x33bc('0x3d')]({},_0x11a0da,_0x1eb5c1[_0x33bc('0x40')]);return db[_0x33bc('0x41')][_0x33bc('0x49')](_0x11a0da)[_0x33bc('0x23')](handleEntityNotFound(_0x268231,null))['then'](respondWithResult(_0x268231,null))[_0x33bc('0x45')](handleError(_0x268231,null));};exports['create']=function(_0x5e211f,_0x1cdc73){return db[_0x33bc('0x41')][_0x33bc('0x4a')](_0x5e211f[_0x33bc('0x4b')],{})[_0x33bc('0x23')](respondWithResult(_0x1cdc73,0xc9))['catch'](handleError(_0x1cdc73,null));};exports[_0x33bc('0x22')]=function(_0xd26554,_0x280b94){if(_0xd26554['body']['id']){delete _0xd26554[_0x33bc('0x4b')]['id'];}return db[_0x33bc('0x41')][_0x33bc('0x49')]({'where':{'id':_0xd26554[_0x33bc('0x47')]['id']}})[_0x33bc('0x23')](handleEntityNotFound(_0x280b94,null))[_0x33bc('0x23')](saveUpdates(_0xd26554['body'],null))[_0x33bc('0x23')](respondWithResult(_0x280b94,null))[_0x33bc('0x45')](handleError(_0x280b94,null));};exports[_0x33bc('0x4c')]=function(_0x181f54,_0x33aae3){return db[_0x33bc('0x41')]['find']({'where':{'id':_0x181f54[_0x33bc('0x47')]['id']}})['then'](handleEntityNotFound(_0x33aae3,null))['then'](removeEntity(_0x33aae3,null))[_0x33bc('0x45')](handleError(_0x33aae3,null));}; \ No newline at end of file +var _0xd1fb=['rawAttributes','fieldName','type','key','query','keys','filters','attributes','model','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','OpenchannelApplication','then','includeAll','findAll','catch','params','fields','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','index','map'];(function(_0x307296,_0x49b881){var _0x32f975=function(_0x4ed150){while(--_0x4ed150){_0x307296['push'](_0x307296['shift']());}};_0x32f975(++_0x49b881);}(_0xd1fb,0xae));var _0xbd1f=function(_0x5cce2d,_0x356459){_0x5cce2d=_0x5cce2d-0x0;var _0x3d6142=_0xd1fb[_0x5cce2d];return _0x3d6142;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd1f('0x0'));var rimraf=require(_0xbd1f('0x1'));var zipdir=require(_0xbd1f('0x2'));var jsonpatch=require(_0xbd1f('0x3'));var rp=require(_0xbd1f('0x4'));var moment=require('moment');var BPromise=require(_0xbd1f('0x5'));var Mustache=require(_0xbd1f('0x6'));var util=require(_0xbd1f('0x7'));var path=require(_0xbd1f('0x8'));var sox=require('sox');var csv=require(_0xbd1f('0x9'));var ejs=require(_0xbd1f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbd1f('0xb'));var crypto=require(_0xbd1f('0xc'));var jsforce=require(_0xbd1f('0xd'));var deskjs=require(_0xbd1f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbd1f('0xf'));var Papa=require(_0xbd1f('0x10'));var Redis=require(_0xbd1f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbd1f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd1f('0x13'));var logger=require(_0xbd1f('0x14'))(_0xbd1f('0x15'));var utils=require(_0xbd1f('0x16'));var config=require(_0xbd1f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x335f3e,_0x3fde88){_0x3fde88=_0x3fde88||0xcc;return function(_0x101af1){if(_0x101af1){return _0x335f3e[_0xbd1f('0x18')](_0x3fde88);}return _0x335f3e['status'](_0x3fde88)[_0xbd1f('0x19')]();};}function respondWithResult(_0xc857e5,_0xb8158b){_0xb8158b=_0xb8158b||0xc8;return function(_0x1e5f7d){if(_0x1e5f7d){return _0xc857e5[_0xbd1f('0x1a')](_0xb8158b)['json'](_0x1e5f7d);}};}function respondWithFilteredResult(_0x4f8dc7,_0x3a92dc){return function(_0x54ac17){if(_0x54ac17){var _0x32bfef=_0x54ac17[_0xbd1f('0x1b')],_0x5e1e46=_0x3a92dc[_0xbd1f('0x1c')],_0x29a1c4=_0x3a92dc[_0xbd1f('0x1c')]+_0x3a92dc[_0xbd1f('0x1d')],_0x34827b;if(_0x29a1c4>=_0x32bfef){_0x29a1c4=_0x32bfef;_0x34827b=0xc8;}else{_0x34827b=0xce;}_0x4f8dc7[_0xbd1f('0x1a')](_0x34827b);return _0x4f8dc7[_0xbd1f('0x1e')](_0xbd1f('0x1f'),_0x5e1e46+'-'+_0x29a1c4+'/'+_0x32bfef)[_0xbd1f('0x20')](_0x54ac17);}return null;};}function patchUpdates(_0x1a6ccb){return function(_0x282fa0){try{jsonpatch[_0xbd1f('0x21')](_0x282fa0,_0x1a6ccb,!![]);}catch(_0x573525){return BPromise[_0xbd1f('0x22')](_0x573525);}return _0x282fa0['save']();};}function saveUpdates(_0x105a5e,_0x529966){return function(_0x492799){if(_0x492799){return _0x492799[_0xbd1f('0x23')](_0x105a5e)['then'](function(_0x4e159f){return _0x4e159f;});}return null;};}function removeEntity(_0x56b8f5,_0x4b81d3){return function(_0x2730db){if(_0x2730db){return _0x2730db[_0xbd1f('0x24')]()['then'](function(){_0x56b8f5[_0xbd1f('0x1a')](0xcc)[_0xbd1f('0x19')]();});}};}function handleEntityNotFound(_0x1ebf43,_0x30efea){return function(_0x21345a){if(!_0x21345a){_0x1ebf43[_0xbd1f('0x18')](0x194);}return _0x21345a;};}function handleError(_0x1b83ca,_0x4f3b9c){_0x4f3b9c=_0x4f3b9c||0x1f4;return function(_0x4c43e5){logger[_0xbd1f('0x25')](_0x4c43e5[_0xbd1f('0x26')]);if(_0x4c43e5[_0xbd1f('0x27')]){delete _0x4c43e5[_0xbd1f('0x27')];}_0x1b83ca[_0xbd1f('0x1a')](_0x4f3b9c)['send'](_0x4c43e5);};}exports[_0xbd1f('0x28')]=function(_0x294525,_0x4068ef){var _0x470a03={},_0x4402b2={},_0x5a4499={'count':0x0,'rows':[]};var _0x1d6220=_[_0xbd1f('0x29')](db['OpenchannelApplication'][_0xbd1f('0x2a')],function(_0x2c9e58){return{'name':_0x2c9e58[_0xbd1f('0x2b')],'type':_0x2c9e58[_0xbd1f('0x2c')][_0xbd1f('0x2d')]};});_0x4402b2['model']=_[_0xbd1f('0x29')](_0x1d6220,_0xbd1f('0x27'));_0x4402b2[_0xbd1f('0x2e')]=_[_0xbd1f('0x2f')](_0x294525[_0xbd1f('0x2e')]);_0x4402b2[_0xbd1f('0x30')]=_['intersection'](_0x4402b2['model'],_0x4402b2['query']);_0x470a03[_0xbd1f('0x31')]=_['intersection'](_0x4402b2[_0xbd1f('0x32')],qs['fields'](_0x294525[_0xbd1f('0x2e')]['fields']));_0x470a03[_0xbd1f('0x31')]=_0x470a03['attributes'][_0xbd1f('0x33')]?_0x470a03[_0xbd1f('0x31')]:_0x4402b2[_0xbd1f('0x32')];if(!_0x294525[_0xbd1f('0x2e')][_0xbd1f('0x34')](_0xbd1f('0x35'))){_0x470a03[_0xbd1f('0x1d')]=qs[_0xbd1f('0x1d')](_0x294525[_0xbd1f('0x2e')][_0xbd1f('0x1d')]);_0x470a03[_0xbd1f('0x1c')]=qs[_0xbd1f('0x1c')](_0x294525['query'][_0xbd1f('0x1c')]);}_0x470a03['order']=qs['sort'](_0x294525[_0xbd1f('0x2e')][_0xbd1f('0x36')]);_0x470a03['where']=qs[_0xbd1f('0x30')](_[_0xbd1f('0x37')](_0x294525['query'],_0x4402b2['filters']),_0x1d6220);if(_0x294525[_0xbd1f('0x2e')][_0xbd1f('0x38')]){_0x470a03[_0xbd1f('0x39')]=_[_0xbd1f('0x3a')](_0x470a03['where'],{'$or':_[_0xbd1f('0x29')](_0x1d6220,function(_0x2733b0){if(_0x2733b0[_0xbd1f('0x2c')]!==_0xbd1f('0x3b')){var _0x22ec1c={};_0x22ec1c[_0x2733b0[_0xbd1f('0x27')]]={'$like':'%'+_0x294525[_0xbd1f('0x2e')][_0xbd1f('0x38')]+'%'};return _0x22ec1c;}})});}_0x470a03=_['merge']({},_0x470a03,_0x294525['options']);var _0x1835ea={'where':_0x470a03['where']};return db[_0xbd1f('0x3c')][_0xbd1f('0x1b')](_0x1835ea)[_0xbd1f('0x3d')](function(_0x26013a){_0x5a4499[_0xbd1f('0x1b')]=_0x26013a;if(_0x294525[_0xbd1f('0x2e')][_0xbd1f('0x3e')]){_0x470a03['include']=[{'all':!![]}];}return db[_0xbd1f('0x3c')][_0xbd1f('0x3f')](_0x470a03);})[_0xbd1f('0x3d')](function(_0xc1b817){_0x5a4499['rows']=_0xc1b817;return _0x5a4499;})[_0xbd1f('0x3d')](respondWithFilteredResult(_0x4068ef,_0x470a03))[_0xbd1f('0x40')](handleError(_0x4068ef,null));};exports['show']=function(_0x2e0553,_0x5c5015){var _0xe0c9fe={'raw':!![],'where':{'id':_0x2e0553[_0xbd1f('0x41')]['id']}},_0x564cd3={};_0x564cd3[_0xbd1f('0x32')]=_[_0xbd1f('0x2f')](db[_0xbd1f('0x3c')][_0xbd1f('0x2a')]);_0x564cd3['query']=_[_0xbd1f('0x2f')](_0x2e0553[_0xbd1f('0x2e')]);_0x564cd3[_0xbd1f('0x30')]=_['intersection'](_0x564cd3[_0xbd1f('0x32')],_0x564cd3['query']);_0xe0c9fe[_0xbd1f('0x31')]=_['intersection'](_0x564cd3[_0xbd1f('0x32')],qs[_0xbd1f('0x42')](_0x2e0553[_0xbd1f('0x2e')]['fields']));_0xe0c9fe['attributes']=_0xe0c9fe[_0xbd1f('0x31')][_0xbd1f('0x33')]?_0xe0c9fe[_0xbd1f('0x31')]:_0x564cd3[_0xbd1f('0x32')];if(_0x2e0553[_0xbd1f('0x2e')][_0xbd1f('0x3e')]){_0xe0c9fe[_0xbd1f('0x43')]=[{'all':!![]}];}_0xe0c9fe=_['merge']({},_0xe0c9fe,_0x2e0553[_0xbd1f('0x44')]);return db[_0xbd1f('0x3c')][_0xbd1f('0x45')](_0xe0c9fe)[_0xbd1f('0x3d')](handleEntityNotFound(_0x5c5015,null))['then'](respondWithResult(_0x5c5015,null))['catch'](handleError(_0x5c5015,null));};exports[_0xbd1f('0x46')]=function(_0x3fdbc1,_0x5a8021){return db[_0xbd1f('0x3c')][_0xbd1f('0x46')](_0x3fdbc1[_0xbd1f('0x47')],{})[_0xbd1f('0x3d')](respondWithResult(_0x5a8021,0xc9))[_0xbd1f('0x40')](handleError(_0x5a8021,null));};exports[_0xbd1f('0x23')]=function(_0x3aab4a,_0x3414de){if(_0x3aab4a[_0xbd1f('0x47')]['id']){delete _0x3aab4a[_0xbd1f('0x47')]['id'];}return db[_0xbd1f('0x3c')][_0xbd1f('0x45')]({'where':{'id':_0x3aab4a[_0xbd1f('0x41')]['id']}})['then'](handleEntityNotFound(_0x3414de,null))['then'](saveUpdates(_0x3aab4a[_0xbd1f('0x47')],null))[_0xbd1f('0x3d')](respondWithResult(_0x3414de,null))['catch'](handleError(_0x3414de,null));};exports[_0xbd1f('0x24')]=function(_0x50bf71,_0x2b7d13){return db[_0xbd1f('0x3c')]['find']({'where':{'id':_0x50bf71[_0xbd1f('0x41')]['id']}})[_0xbd1f('0x3d')](handleEntityNotFound(_0x2b7d13,null))[_0xbd1f('0x3d')](removeEntity(_0x2b7d13,null))['catch'](handleError(_0x2b7d13,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2bb6074..264b6b3 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 _0x2bd1=['util','api','moment','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x51839f,_0x1b3dac){var _0x4e22e3=function(_0x34840a){while(--_0x34840a){_0x51839f['push'](_0x51839f['shift']());}};_0x4e22e3(++_0x1b3dac);}(_0x2bd1,0x143));var _0x12bd=function(_0x2bef59,_0x3c23b2){_0x2bef59=_0x2bef59-0x0;var _0x1bd8dd=_0x2bd1[_0x2bef59];return _0x1bd8dd;};'use strict';var _=require(_0x12bd('0x0'));var util=require(_0x12bd('0x1'));var logger=require('../../config/logger')(_0x12bd('0x2'));var moment=require(_0x12bd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x12bd('0x4'));var config=require(_0x12bd('0x5'));var attributes=require(_0x12bd('0x6'));module[_0x12bd('0x7')]=function(_0x22b450,_0x540fcb){return _0x22b450[_0x12bd('0x8')](_0x12bd('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12bd('0xa'),'collate':_0x12bd('0xb')});}; \ No newline at end of file +var _0x1fac=['utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0xaf70c2,_0x2fc71c){var _0x361a85=function(_0x57a6b6){while(--_0x57a6b6){_0xaf70c2['push'](_0xaf70c2['shift']());}};_0x361a85(++_0x2fc71c);}(_0x1fac,0x83));var _0xc1fa=function(_0xfdebcc,_0x4918b9){_0xfdebcc=_0xfdebcc-0x0;var _0x3eec17=_0x1fac[_0xfdebcc];return _0x3eec17;};'use strict';var _=require('lodash');var util=require(_0xc1fa('0x0'));var logger=require(_0xc1fa('0x1'))(_0xc1fa('0x2'));var moment=require('moment');var BPromise=require(_0xc1fa('0x3'));var rp=require(_0xc1fa('0x4'));var fs=require('fs');var path=require(_0xc1fa('0x5'));var rimraf=require(_0xc1fa('0x6'));var config=require('../../config/environment');var attributes=require(_0xc1fa('0x7'));module[_0xc1fa('0x8')]=function(_0x128fdb,_0x18ccce){return _0x128fdb[_0xc1fa('0x9')](_0xc1fa('0xa'),attributes,{'tableName':_0xc1fa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc1fa('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b1ffd4b..10004b0 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1ce3aa,_0x37b150){var _0x2a243d=function(_0x104fda){while(--_0x104fda){_0x1ce3aa['push'](_0x1ce3aa['shift']());}};_0x2a243d(++_0x37b150);}(_0xb10b,0x12a));var _0xbb10=function(_0x614c88,_0x184f02){_0x614c88=_0x614c88-0x0;var _0x1a768e=_0xb10b[_0x614c88];return _0x1a768e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x585ab9,_0x599828){var _0x544b7d=function(_0x46b062){while(--_0x46b062){_0x585ab9['push'](_0x585ab9['shift']());}};_0x544b7d(++_0x599828);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d606d,_0x376e51){_0x1d606d=_0x1d606d-0x0;var _0x3c38bd=_0xb10b[_0x1d606d];return _0x3c38bd;};'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 be9f690..fddd5b0 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 _0xe84f=['../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0xe84f,0x121));var _0xfe84=function(_0x575cfe,_0x202094){_0x575cfe=_0x575cfe-0x0;var _0x5e31eb=_0xe84f[_0x575cfe];return _0x5e31eb;};'use strict';var multer=require(_0xfe84('0x0'));var util=require(_0xfe84('0x1'));var path=require(_0xfe84('0x2'));var timeout=require(_0xfe84('0x3'));var express=require(_0xfe84('0x4'));var router=express[_0xfe84('0x5')]();var auth=require(_0xfe84('0x6'));var interaction=require(_0xfe84('0x7'));var config=require(_0xfe84('0x8'));var controller=require(_0xfe84('0x9'));router[_0xfe84('0xa')]('/',auth[_0xfe84('0xb')](),controller[_0xfe84('0xc')]);router[_0xfe84('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xfe84('0xd')]);router[_0xfe84('0xa')](_0xfe84('0xe'),auth[_0xfe84('0xb')](),controller[_0xfe84('0xf')]);router[_0xfe84('0xa')](_0xfe84('0x10'),auth['isAuthenticated'](),controller[_0xfe84('0x11')]);router[_0xfe84('0xa')](_0xfe84('0x12'),auth[_0xfe84('0xb')](),controller['download']);router['post']('/',auth[_0xfe84('0xb')](),controller[_0xfe84('0x13')]);router[_0xfe84('0x14')](_0xfe84('0x10'),auth['isAuthenticated'](),controller['addMessage']);router[_0xfe84('0x14')](_0xfe84('0x15'),auth['isAuthenticated'](),interaction[_0xfe84('0x16')](_0xfe84('0x17'),_0xfe84('0x18')),controller[_0xfe84('0x19')]);router[_0xfe84('0x1a')]('/:id',auth[_0xfe84('0xb')](),interaction[_0xfe84('0x16')]('openchannel',_0xfe84('0x1b')),controller[_0xfe84('0x1c')]);router[_0xfe84('0x1d')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xfe84('0x17'),_0xfe84('0x1e')),controller[_0xfe84('0x1f')]);router[_0xfe84('0x1d')]('/:id/tags',auth[_0xfe84('0xb')](),controller[_0xfe84('0x20')]);module['exports']=router; \ No newline at end of file +var _0x21a3=['tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags'];(function(_0x339f54,_0x3ff67e){var _0x23bb0a=function(_0x50d2d8){while(--_0x50d2d8){_0x339f54['push'](_0x339f54['shift']());}};_0x23bb0a(++_0x3ff67e);}(_0x21a3,0x82));var _0x321a=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x21a3[_0x1f5a63];return _0x30bb7a;};'use strict';var multer=require(_0x321a('0x0'));var util=require(_0x321a('0x1'));var path=require(_0x321a('0x2'));var timeout=require(_0x321a('0x3'));var express=require(_0x321a('0x4'));var router=express[_0x321a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x321a('0x6'));var config=require(_0x321a('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x321a('0x8')]('/',auth[_0x321a('0x9')](),controller[_0x321a('0xa')]);router[_0x321a('0x8')](_0x321a('0xb'),auth[_0x321a('0x9')](),controller['describe']);router['get'](_0x321a('0xc'),auth[_0x321a('0x9')](),controller[_0x321a('0xd')]);router['get'](_0x321a('0xe'),auth[_0x321a('0x9')](),controller[_0x321a('0xf')]);router[_0x321a('0x8')](_0x321a('0x10'),auth[_0x321a('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x321a('0x11')](_0x321a('0xe'),auth[_0x321a('0x9')](),controller[_0x321a('0x12')]);router[_0x321a('0x11')](_0x321a('0x13'),auth['isAuthenticated'](),interaction[_0x321a('0x14')](_0x321a('0x15'),_0x321a('0x16')),controller[_0x321a('0x17')]);router[_0x321a('0x18')](_0x321a('0xc'),auth['isAuthenticated'](),interaction[_0x321a('0x14')](_0x321a('0x15'),_0x321a('0x19')),controller[_0x321a('0x1a')]);router[_0x321a('0x1b')]('/:id',auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x321a('0x1c')),controller['destroy']);router[_0x321a('0x1b')](_0x321a('0x13'),auth[_0x321a('0x9')](),controller['removeTags']);module[_0x321a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index f0b5799..98aac6f 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 _0xd90a=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x544fc1,_0x5af746){var _0x48bf45=function(_0xeb4daf){while(--_0xeb4daf){_0x544fc1['push'](_0x544fc1['shift']());}};_0x48bf45(++_0x5af746);}(_0xd90a,0x96));var _0xad90=function(_0x3a649b,_0x4f2c32){_0x3a649b=_0x3a649b-0x0;var _0x190e2c=_0xd90a[_0x3a649b];return _0x190e2c;};'use strict';var Sequelize=require(_0xad90('0x0'));module[_0xad90('0x1')]={'closed':{'type':Sequelize[_0xad90('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xad90('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xad90('0x4')]},'read1stAt':{'type':Sequelize[_0xad90('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xad90('0x4')]},'lastMsgAt':{'type':Sequelize[_0xad90('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xad90('0x5')]('in',_0xad90('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xad90('0x4')]}}; \ No newline at end of file +var _0x3dca=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3ffa53,_0x3ede30){var _0x1cdce6=function(_0x3f8e9e){while(--_0x3f8e9e){_0x3ffa53['push'](_0x3ffa53['shift']());}};_0x1cdce6(++_0x3ede30);}(_0x3dca,0x13b));var _0xa3dc=function(_0x5c76f8,_0xdc0b8a){_0x5c76f8=_0x5c76f8-0x0;var _0x3ad7a5=_0x3dca[_0x5c76f8];return _0x3ad7a5;};'use strict';var Sequelize=require(_0xa3dc('0x0'));module[_0xa3dc('0x1')]={'closed':{'type':Sequelize[_0xa3dc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa3dc('0x3')]},'threadId':{'type':Sequelize[_0xa3dc('0x4')]},'externalUrl':{'type':Sequelize[_0xa3dc('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa3dc('0x5')]('in',_0xa3dc('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa3dc('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d3964a7..92f4d85 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 _0xe1bc=['toFile','.pdf','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','OpenchannelInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','buildExpression','some','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','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','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','keyBy','unreadMessages','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','groupBy','OpenchannelInteractionId','all','rows','catch','params','includeAll','merge','options','create','destroy','describe','addMessage','ids','omit','findOne','format','include','OpenchannelMessage','setTags','spread','findAll','color','openchannelInteractionTags:save','removeTags','unix','root','tmp','join','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','closed','disposition','threadId','pipe','createWriteStream','basename','YYYY-MM-DD\x20HH:mm:ss','out','System','renderFile','server','views','downloadInteraction.html'];(function(_0x301720,_0x59454c){var _0x5f26ad=function(_0x30adce){while(--_0x30adce){_0x301720['push'](_0x301720['shift']());}};_0x5f26ad(++_0x59454c);}(_0xe1bc,0xf4));var _0xce1b=function(_0x11d0d4,_0x540b3f){_0x11d0d4=_0x11d0d4-0x0;var _0xd6478a=_0xe1bc[_0x11d0d4];return _0xd6478a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xce1b('0x0'));var rimraf=require(_0xce1b('0x1'));var zipdir=require(_0xce1b('0x2'));var jsonpatch=require(_0xce1b('0x3'));var rp=require(_0xce1b('0x4'));var moment=require(_0xce1b('0x5'));var BPromise=require(_0xce1b('0x6'));var Mustache=require(_0xce1b('0x7'));var util=require(_0xce1b('0x8'));var path=require(_0xce1b('0x9'));var sox=require(_0xce1b('0xa'));var csv=require(_0xce1b('0xb'));var ejs=require(_0xce1b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xce1b('0xd'));var jsforce=require(_0xce1b('0xe'));var deskjs=require(_0xce1b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce1b('0x10'));var Papa=require(_0xce1b('0x11'));var Redis=require(_0xce1b('0x12'));var authService=require(_0xce1b('0x13'));var qs=require(_0xce1b('0x14'));var as=require(_0xce1b('0x15'));var hardwareService=require(_0xce1b('0x16'));var logger=require(_0xce1b('0x17'))(_0xce1b('0x18'));var utils=require(_0xce1b('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xce1b('0x1a')](config['redis'],{'host':_0xce1b('0x1b'),'port':0x18eb});var socket=require(_0xce1b('0x1c'))(new Redis(config['redis']));require(_0xce1b('0x1d'))[_0xce1b('0x1e')](socket);function respondWithStatusCode(_0x59448f,_0x1b448b){_0x1b448b=_0x1b448b||0xcc;return function(_0x1ac5f8){if(_0x1ac5f8){return _0x59448f[_0xce1b('0x1f')](_0x1b448b);}return _0x59448f[_0xce1b('0x20')](_0x1b448b)[_0xce1b('0x21')]();};}function respondWithResult(_0x1a35d6,_0x12e1d1){_0x12e1d1=_0x12e1d1||0xc8;return function(_0x391d48){if(_0x391d48){return _0x1a35d6[_0xce1b('0x20')](_0x12e1d1)[_0xce1b('0x22')](_0x391d48);}};}function respondWithFilteredResult(_0x186ddc,_0x21bb83){return function(_0x13fe5c){if(_0x13fe5c){var _0x1a6c8f=_0x13fe5c[_0xce1b('0x23')],_0x299f80=_0x21bb83[_0xce1b('0x24')],_0x5c688e=_0x21bb83[_0xce1b('0x24')]+_0x21bb83[_0xce1b('0x25')],_0x562750;if(_0x5c688e>=_0x1a6c8f){_0x5c688e=_0x1a6c8f;_0x562750=0xc8;}else{_0x562750=0xce;}_0x186ddc[_0xce1b('0x20')](_0x562750);return _0x186ddc['set']('Content-Range',_0x299f80+'-'+_0x5c688e+'/'+_0x1a6c8f)[_0xce1b('0x22')](_0x13fe5c);}return null;};}function patchUpdates(_0x49f59f){return function(_0x3e8866){try{jsonpatch[_0xce1b('0x26')](_0x3e8866,_0x49f59f,!![]);}catch(_0x46fff9){return BPromise[_0xce1b('0x27')](_0x46fff9);}return _0x3e8866[_0xce1b('0x28')]();};}function saveUpdates(_0x1b5133,_0x13fd10){return function(_0x20467a){if(_0x20467a){return _0x20467a[_0xce1b('0x29')](_0x1b5133)[_0xce1b('0x2a')](function(_0x5a5827){return _0x5a5827;});}return null;};}function removeEntity(_0x5c2f56,_0x15944b){return function(_0x1a1ded){if(_0x1a1ded){return _0x1a1ded['destroy']()[_0xce1b('0x2a')](function(){_0x5c2f56[_0xce1b('0x20')](0xcc)[_0xce1b('0x21')]();});}};}function handleEntityNotFound(_0x39148b,_0x3ce4e9){return function(_0x268376){if(!_0x268376){_0x39148b[_0xce1b('0x1f')](0x194);}return _0x268376;};}function handleError(_0x3cbe0d,_0x2b6e03){_0x2b6e03=_0x2b6e03||0x1f4;return function(_0x36c3f9){logger['error'](_0x36c3f9[_0xce1b('0x2b')]);if(_0x36c3f9[_0xce1b('0x2c')]){delete _0x36c3f9[_0xce1b('0x2c')];}_0x3cbe0d[_0xce1b('0x20')](_0x2b6e03)[_0xce1b('0x2d')](_0x36c3f9);};}function getInteractionUsers(_0xe559af,_0x2b2bfa){return new BPromise(function(_0x19d8fd,_0x3ab84a){try{if(_0x2b2bfa[_0xe559af['id']]){_0xe559af[_0xce1b('0x2e')]=_[_0xce1b('0x2f')](_0x2b2bfa[_0xe559af['id']],function(_0x2e2be7){return{'id':_0x2e2be7['id'],'fullname':_0x2e2be7[_0xce1b('0x30')]};});}}catch(_0x4efbd3){_0x3ab84a(_0x4efbd3);}_0x19d8fd(_0xe559af);});}function getInteractionTags(_0x9157cc,_0x264d3e){return new BPromise(function(_0x3f3dfa,_0x27002b){try{if(_0x9157cc[_0xce1b('0x31')]){_0x9157cc[_0xce1b('0x32')]=[];_0x9157cc['TagIds'][_0xce1b('0x33')](',')[_0xce1b('0x34')](function(_0x4ecda9){_0x9157cc['Tags'][_0xce1b('0x35')](_0x264d3e[_0x4ecda9]);});}delete _0x9157cc[_0xce1b('0x31')];}catch(_0x4ae397){_0x27002b(_0x4ae397);}_0x3f3dfa(_0x9157cc);});}function updateOpenchannelInteraction(_0x5086e4,_0x58ca15,_0xba9a9){return new BPromise(function(_0x20af5,_0xc3b6b7){return getInteractionUsers(_0x5086e4,_0xba9a9)[_0xce1b('0x2a')](function(_0x3d2e66){return getInteractionTags(_0x3d2e66,_0x58ca15);})['then'](function(_0x56e2fc){_0x20af5(_0x56e2fc);})['catch'](function(_0x3cb125){_0xc3b6b7(_0x3cb125);});});}exports[_0xce1b('0x36')]=function(_0xd7d9e,_0x11aefb){var _0x4aa907={},_0x35a406={},_0x247ded={'count':0x0,'rows':[]};var _0x3d1915=_[_0xce1b('0x2f')](db[_0xce1b('0x37')][_0xce1b('0x38')],function(_0x5592f4){return{'name':_0x5592f4['fieldName'],'type':_0x5592f4[_0xce1b('0x39')][_0xce1b('0x3a')]};});_0x35a406[_0xce1b('0x3b')]=_['map'](_0x3d1915,'name');_0x35a406[_0xce1b('0x3c')]=_[_0xce1b('0x3d')](_0xd7d9e[_0xce1b('0x3c')]);_0x35a406[_0xce1b('0x3e')]=_[_0xce1b('0x3f')](_0x35a406[_0xce1b('0x3b')],_0x35a406[_0xce1b('0x3c')]);_0x4aa907[_0xce1b('0x40')]=_[_0xce1b('0x3f')](_0x35a406[_0xce1b('0x3b')],qs[_0xce1b('0x41')](_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x41')]));_0x4aa907[_0xce1b('0x40')]=_0x4aa907[_0xce1b('0x40')][_0xce1b('0x42')]?_0x4aa907[_0xce1b('0x40')]:_0x35a406[_0xce1b('0x3b')];if(!_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x43')](_0xce1b('0x44'))){_0x4aa907[_0xce1b('0x25')]=qs[_0xce1b('0x25')](_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x25')]);_0x4aa907[_0xce1b('0x24')]=qs['offset'](_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x24')]);}_0x4aa907[_0xce1b('0x45')]=qs[_0xce1b('0x46')](_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x46')]);_0x4aa907[_0xce1b('0x47')]=qs[_0xce1b('0x3e')](_[_0xce1b('0x48')](_0xd7d9e[_0xce1b('0x3c')],_0x35a406[_0xce1b('0x3e')]),_0x3d1915);var _0x232f79=[];var _0x419e37=squel[_0xce1b('0x49')]()[_0xce1b('0x4a')]('id')[_0xce1b('0x4a')](_0xce1b('0x2c'))[_0xce1b('0x4a')]('color')[_0xce1b('0x4b')](_0xce1b('0x4c'));var _0x477837=squel[_0xce1b('0x49')]()[_0xce1b('0x4a')]('u.id')['field'](_0xce1b('0x4d'))['field'](_0xce1b('0x4e'))[_0xce1b('0x4b')](_0xce1b('0x4f'),'ui')['left_join'](_0xce1b('0x50'),'u',_0xce1b('0x51'));var _0x107254=squel[_0xce1b('0x49')]()[_0xce1b('0x4b')]('openchannel_interactions','i')[_0xce1b('0x52')](_0xce1b('0x53'),'c',_0xce1b('0x54'))['left_join'](_0xce1b('0x50'),'o','o.id\x20=\x20i.UserId')[_0xce1b('0x52')](_0xce1b('0x55'),'a',_0xce1b('0x56'))['left_join'](_0xce1b('0x57'),'me',_0xce1b('0x58'))['left_join']('openchannel_interaction_has_tags','it',_0xce1b('0x59'))[_0xce1b('0x52')](_0xce1b('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x5b0963=squel[_0xce1b('0x5a')]();var _0x47bea9=[];var _0x33696a=squel[_0xce1b('0x5a')]();var _0x4eaff1;if(_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x5b')]){_0x4eaff1=as[_0xce1b('0x5c')](_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x5b')]);var _0x1bed47=_0x4eaff1[_0xce1b('0x5d')];for(var _0x32d6e9=0x0;_0x32d6e9<_0x4eaff1['conditions'][_0xce1b('0x42')];_0x32d6e9++){var _0x4b298e=_0x4eaff1[_0xce1b('0x5e')][_0x32d6e9];var _0x512cb5='i';var _0x280234=_[_0xce1b('0x5f')](_0x3d1915,[_0xce1b('0x2c'),_0x4b298e['field']]);if(!_0x280234){switch(_0x4b298e[_0xce1b('0x4a')]){case'unreadMessages':if(_0x4b298e[_0xce1b('0x60')]==0x1){_0x107254[_0xce1b('0x61')]('`'+_0x4b298e[_0xce1b('0x4a')]+_0xce1b('0x62'));}else{_0x107254[_0xce1b('0x61')]('`'+_0x4b298e[_0xce1b('0x4a')]+_0xce1b('0x63'));}break;case _0xce1b('0x64'):if(_0x4b298e[_0xce1b('0x65')]===_0xce1b('0x66')){if(_0x4b298e[_0xce1b('0x60')]['split']('\x20')['length']>0x1){_0x5b0963[_0x1bed47]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xce1b('0x67')](_0x4b298e[_0xce1b('0x60')]),null);}else{var _0x21a83d='%'+_0x4b298e[_0xce1b('0x60')]+'%';_0x5b0963[_0x1bed47](_0xce1b('0x68'),_0x21a83d,_0x21a83d,_0x21a83d);}}else{_0x280234=_[_0xce1b('0x5f')](_0x3d1915,['name',_0xce1b('0x69')]);_0x4b298e[_0xce1b('0x4a')]=_0xce1b('0x69');_0x27df57=as['buildExpression'](_0x512cb5,_0x280234[_0xce1b('0x39')],_0x4b298e);_0x5b0963[_0x1bed47](_0x27df57['text'],_0x27df57['value']['start'],_0x27df57[_0xce1b('0x60')][_0xce1b('0x21')]);}break;case _0xce1b('0x6a'):var _0x49375c=_0x4b298e[_0xce1b('0x60')][_0xce1b('0x33')](',')[_0xce1b('0x2f')](function(_0x13d088){return Number(_0x13d088);});_0x49375c[_0xce1b('0x34')](function(_0x1a7e9b){_0x33696a['or'](_0xce1b('0x6b'),'%,'+_0x1a7e9b+',%');});_0x47bea9=_[_0xce1b('0x6c')](_0x47bea9,_0x49375c);break;case _0xce1b('0x6d'):if(_0x4b298e[_0xce1b('0x65')]===_0xce1b('0x66')){_0x5b0963[_0x1bed47](_0xce1b('0x6e'),'%'+_0x4b298e[_0xce1b('0x60')]+'%',null);}else{_0x280234=_['find'](_0x3d1915,[_0xce1b('0x2c'),_0xce1b('0x6f')]);_0x4b298e[_0xce1b('0x4a')]=_0xce1b('0x6f');_0x27df57=as['buildExpression'](_0x512cb5,_0x280234[_0xce1b('0x39')],_0x4b298e);_0x5b0963[_0x1bed47](_0x27df57[_0xce1b('0x70')],_0x27df57['value'][_0xce1b('0x71')],_0x27df57[_0xce1b('0x60')][_0xce1b('0x21')]);}break;case _0xce1b('0x72'):_0x27df57=as[_0xce1b('0x73')]('me',null,_0x4b298e);_0x5b0963[_0x1bed47](_0x27df57[_0xce1b('0x70')],_0x27df57[_0xce1b('0x60')][_0xce1b('0x71')],_0x27df57[_0xce1b('0x60')]['end']);break;}}else{var _0x27df57=as[_0xce1b('0x73')](_0x512cb5,_0x280234[_0xce1b('0x39')],_0x4b298e);_0x5b0963[_0x1bed47](_0x27df57['text'],_0x27df57[_0xce1b('0x60')][_0xce1b('0x71')],_0x27df57[_0xce1b('0x60')][_0xce1b('0x21')]);}}}else{var _0x3128ae=_(_0xd7d9e['query'])[_0xce1b('0x3d')]()['map'](function(_0x587fae){return _[_0xce1b('0x74')](_0x3d1915,[_0xce1b('0x2c'),_0x587fae])?_0x587fae:undefined;})[_0xce1b('0x75')]()[_0xce1b('0x60')]();if(!_[_0xce1b('0x76')](_0x3128ae)){_0x3128ae['forEach'](function(_0x525072){if(_0x525072===_0xce1b('0x77')){_0x107254['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0xce1b('0x78')](_0xd7d9e[_0xce1b('0x3c')][_0x525072]));}else if(_0x525072===_0xce1b('0x79')){var _0x24b9b9=JSON[_0xce1b('0x7a')](_0xd7d9e['query'][_0x525072])[_0xce1b('0x7b')];var _0x41f1cc=JSON[_0xce1b('0x7a')](_0xd7d9e['query'][_0x525072])[_0xce1b('0x7c')];_0x107254[_0xce1b('0x47')](_0xce1b('0x7d'),_0x24b9b9,_0x41f1cc);}else{if(_0xd7d9e[_0xce1b('0x3c')][_0x525072]===_0xce1b('0x7e')){_0x107254[_0xce1b('0x47')]('i.'+_0x525072+_0xce1b('0x7f'));}else{_0x107254[_0xce1b('0x47')]('i.'+_0x525072+_0xce1b('0x80'),_0xd7d9e[_0xce1b('0x3c')][_0x525072]);}}});}if(_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x81')]){if(_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x81')]==0x1){_0x107254[_0xce1b('0x61')](_0xce1b('0x82'));}else{_0x107254['having'](_0xce1b('0x83'));}}if(_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x84')]){_0x47bea9=_[_0xce1b('0x85')](_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x84')])?_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x84')]:new Array(_0xd7d9e['query'][_0xce1b('0x84')]);_0x47bea9[_0xce1b('0x34')](function(_0x5e6f2b){_0x33696a['or'](_0xce1b('0x6b'),'%,'+_0x5e6f2b+',%');});}if(_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x86')]){var _0x1d10b1=_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x86')][_0xce1b('0x87')]('\x5c','\x5c\x5c')[_0xce1b('0x87')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x1d10b1)){_0x5b0963['or'](_0xce1b('0x88'),_0x1d10b1+'%');}else{_0x5b0963['or'](_0xce1b('0x89'),qs[_0xce1b('0x67')](_0x1d10b1))['or'](_0xce1b('0x8a'),_0x1d10b1+'%')['or'](_0xce1b('0x8b'),_0x1d10b1+'%');}}}_0x107254[_0xce1b('0x47')](_0x5b0963);_0x107254[_0xce1b('0x8c')](_0xce1b('0x8d'));var _0x617e42={'type':db[_0xce1b('0x8e')][_0xce1b('0x8f')][_0xce1b('0x90')],'raw':!![]};var _0x32846c=_0x107254[_0xce1b('0x91')]();_0x32846c[_0xce1b('0x4a')](_0xce1b('0x8d'));_0x32846c['field'](_0xce1b('0x92'),'unreadMessages');if(_0x4aa907[_0xce1b('0x45')]){_0x4aa907[_0xce1b('0x45')][_0xce1b('0x34')](function(_0x5160ef){_0x107254[_0xce1b('0x45')]('i.'+_0x5160ef[0x0],_0x5160ef[0x1]===_0xce1b('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x47bea9)){_0x107254[_0xce1b('0x61')](_0x33696a);_0x32846c[_0xce1b('0x47')](_0xce1b('0x94'),_0x47bea9);}BPromise['resolve']()[_0xce1b('0x2a')](function(){if(!_0x4eaff1){if(_0xd7d9e[_0xce1b('0x3c')]['OpenchannelAccountId']||_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x95')])return;_0x32846c[_0xce1b('0x47')](_0xce1b('0x96'));_0x107254[_0xce1b('0x47')](_0xce1b('0x96'));return;}return _0xd7d9e[_0xce1b('0x97')][_0xce1b('0x98')]({'attributes':['id'],'raw':!![]})[_0xce1b('0x2a')](function(_0x2f1aa2){if(_[_0xce1b('0x76')](_0x2f1aa2)){_0x32846c['where'](_0xce1b('0x99'));_0x107254[_0xce1b('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x32846c[_0xce1b('0x47')](_0xce1b('0x9a'),_[_0xce1b('0x2f')](_0x2f1aa2,'id'));_0x107254[_0xce1b('0x47')](_0xce1b('0x9a'),_[_0xce1b('0x2f')](_0x2f1aa2,'id'));}});})[_0xce1b('0x2a')](function(){db['sequelize'][_0xce1b('0x3c')](_0x32846c['toString'](),_0x617e42)[_0xce1b('0x2a')](function(_0x2c591b){_0x247ded[_0xce1b('0x23')]=_0x2c591b[_0xce1b('0x42')];if(_0x247ded[_0xce1b('0x23')]===0x0)return[];return db[_0xce1b('0x9b')][_0xce1b('0x3c')](_0x419e37['toString'](),_0x617e42)['then'](function(_0xeacfb7){_0x232f79=_[_0xce1b('0x9c')](_0xeacfb7,'id');_0x617e42=_['merge'](_0x617e42,{'model':db[_0xce1b('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xd7d9e[_0xce1b('0x3c')][_0xce1b('0x41')]){_0x4aa907[_0xce1b('0x40')]['forEach'](function(_0x4ec996){_0x107254[_0xce1b('0x4a')]('i.'+_0x4ec996);});}else{_0x107254['field'](_0xce1b('0x92'),_0xce1b('0x9d'));_0x107254[_0xce1b('0x4a')]('a.key',_0xce1b('0x9e'));_0x107254['field']('a.mandatoryDisposition',_0xce1b('0x9f'));_0x107254[_0xce1b('0x4a')](_0xce1b('0xa0'));_0x107254[_0xce1b('0x4a')](_0xce1b('0xa1'),_0xce1b('0xa2'));_0x107254[_0xce1b('0x4a')](_0xce1b('0xa3'),'Contact.lastName');_0x107254[_0xce1b('0x4a')](_0xce1b('0xa4'),_0xce1b('0xa5'));_0x107254['field'](_0xce1b('0xa6'),_0xce1b('0xa7'));_0x107254['field'](_0xce1b('0xa8'),_0xce1b('0xa9'));_0x107254[_0xce1b('0x4a')]('c.fax',_0xce1b('0xaa'));_0x107254[_0xce1b('0x4a')]('o.fullname','Owner.fullname');_0x107254[_0xce1b('0x4a')](_0xce1b('0xab'),_0xce1b('0xac'));_0x107254[_0xce1b('0x4a')](_0xce1b('0xad'),_0xce1b('0x31'));}if(_0x4aa907[_0xce1b('0x25')])_0x107254['limit'](_0x4aa907[_0xce1b('0x25')]);if(_0x4aa907[_0xce1b('0x24')])_0x107254[_0xce1b('0x24')](_0x4aa907[_0xce1b('0x24')]);return db[_0xce1b('0x9b')]['query'](_0x107254['toString'](),_0x617e42);})[_0xce1b('0x2a')](function(_0x5cd564){_0x477837['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xce1b('0x2f')](_0x5cd564,'id'));return db[_0xce1b('0x9b')][_0xce1b('0x3c')](_0x477837[_0xce1b('0xae')](),_0x617e42)['then'](function(_0x44c995){var _0x5675e8=_[_0xce1b('0xaf')](_0x44c995,_0xce1b('0xb0'));var _0x621849=[];_0x5cd564[_0xce1b('0x34')](function(_0x3b7156){_0x621849[_0xce1b('0x35')](updateOpenchannelInteraction(_0x3b7156,_0x232f79,_0x5675e8));});return BPromise[_0xce1b('0xb1')](_0x621849);});});})['then'](function(_0x4235d6){_0x247ded[_0xce1b('0xb2')]=_0x4235d6;return _0x247ded;})['then'](respondWithFilteredResult(_0x11aefb,_0x4aa907));})[_0xce1b('0xb3')](handleError(_0x11aefb,null));};exports['show']=function(_0x41f157,_0x2f414b){var _0x550eb0={'raw':![],'where':{'id':_0x41f157[_0xce1b('0xb4')]['id']}},_0x1f8d94={};_0x1f8d94[_0xce1b('0x3b')]=_[_0xce1b('0x3d')](db['OpenchannelInteraction'][_0xce1b('0x38')]);_0x1f8d94[_0xce1b('0x3c')]=_[_0xce1b('0x3d')](_0x41f157[_0xce1b('0x3c')]);_0x1f8d94[_0xce1b('0x3e')]=_[_0xce1b('0x3f')](_0x1f8d94[_0xce1b('0x3b')],_0x1f8d94[_0xce1b('0x3c')]);_0x550eb0[_0xce1b('0x40')]=_[_0xce1b('0x3f')](_0x1f8d94[_0xce1b('0x3b')],qs['fields'](_0x41f157[_0xce1b('0x3c')][_0xce1b('0x41')]));_0x550eb0[_0xce1b('0x40')]=_0x550eb0[_0xce1b('0x40')]['length']?_0x550eb0[_0xce1b('0x40')]:_0x1f8d94['model'];if(_0x41f157[_0xce1b('0x3c')][_0xce1b('0xb5')]){_0x550eb0['include']=[{'all':!![]}];}_0x550eb0=_[_0xce1b('0xb6')]({},_0x550eb0,_0x41f157[_0xce1b('0xb7')]);return db[_0xce1b('0x37')]['find'](_0x550eb0)[_0xce1b('0x2a')](handleEntityNotFound(_0x2f414b,null))[_0xce1b('0x2a')](respondWithResult(_0x2f414b,null))[_0xce1b('0xb3')](handleError(_0x2f414b,null));};exports[_0xce1b('0xb8')]=function(_0x8a12cc,_0x52d86b){return db['OpenchannelInteraction']['create'](_0x8a12cc[_0xce1b('0x72')],{})[_0xce1b('0x2a')](respondWithResult(_0x52d86b,0xc9))[_0xce1b('0xb3')](handleError(_0x52d86b,null));};exports['update']=function(_0x3936a4,_0x4d5145){if(_0x3936a4[_0xce1b('0x72')]['id']){delete _0x3936a4[_0xce1b('0x72')]['id'];}return db[_0xce1b('0x37')]['find']({'where':{'id':_0x3936a4[_0xce1b('0xb4')]['id']}})[_0xce1b('0x2a')](handleEntityNotFound(_0x4d5145,null))[_0xce1b('0x2a')](saveUpdates(_0x3936a4[_0xce1b('0x72')],null))[_0xce1b('0x2a')](respondWithResult(_0x4d5145,null))[_0xce1b('0xb3')](handleError(_0x4d5145,null));};exports[_0xce1b('0xb9')]=function(_0x19fc0d,_0x5b094d){return db['OpenchannelInteraction'][_0xce1b('0x5f')]({'where':{'id':_0x19fc0d[_0xce1b('0xb4')]['id']}})[_0xce1b('0x2a')](handleEntityNotFound(_0x5b094d,null))[_0xce1b('0x2a')](removeEntity(_0x5b094d,null))[_0xce1b('0xb3')](handleError(_0x5b094d,null));};exports[_0xce1b('0xba')]=function(_0x29a8db,_0x5040dc){return db[_0xce1b('0x37')][_0xce1b('0xba')]()[_0xce1b('0x2a')](respondWithResult(_0x5040dc,null))[_0xce1b('0xb3')](handleError(_0x5040dc,null));};exports[_0xce1b('0xbb')]=function(_0x1786cb,_0x60d7e0,_0x12efdc){return db['OpenchannelMessage'][_0xce1b('0x5f')]({'where':{'id':_0x1786cb['params']['id']}})[_0xce1b('0x2a')](handleEntityNotFound(_0x60d7e0,null))[_0xce1b('0x2a')](function(_0x586714){if(_0x586714){return _0x586714['addMessage'](_0x1786cb[_0xce1b('0x72')][_0xce1b('0xbc')],_[_0xce1b('0xbd')](_0x1786cb['body'],[_0xce1b('0xbc'),'id'])||{});}})[_0xce1b('0x2a')](respondWithResult(_0x60d7e0,null))[_0xce1b('0xb3')](handleError(_0x60d7e0,null));};exports['getMessages']=function(_0x5dea33,_0x2868dd,_0x6400dc){var _0x2050a2={'raw':![],'where':{}};var _0x298428={};var _0x5bf4a8={'count':0x0,'rows':[]};return db[_0xce1b('0x37')][_0xce1b('0xbe')]({'where':{'id':_0x5dea33['params']['id']}})[_0xce1b('0x2a')](handleEntityNotFound(_0x2868dd,null))['then'](function(_0x1ea272){if(_0x1ea272){_0x298428[_0xce1b('0x3b')]=_['keys'](db['OpenchannelMessage'][_0xce1b('0x38')]);_0x298428[_0xce1b('0x3c')]=_[_0xce1b('0x3d')](_0x5dea33['query']);_0x298428[_0xce1b('0x3e')]=_['intersection'](_0x298428[_0xce1b('0x3b')],_0x298428[_0xce1b('0x3c')]);_0x2050a2[_0xce1b('0x40')]=_[_0xce1b('0x3f')](_0x298428[_0xce1b('0x3b')],qs['fields'](_0x5dea33[_0xce1b('0x3c')][_0xce1b('0x41')]));_0x2050a2['attributes']=_0x2050a2['attributes']['length']?_0x2050a2[_0xce1b('0x40')]:_0x298428[_0xce1b('0x3b')];if(!_0x5dea33[_0xce1b('0x3c')]['hasOwnProperty']('nolimit')){_0x2050a2[_0xce1b('0x25')]=qs[_0xce1b('0x25')](_0x5dea33[_0xce1b('0x3c')][_0xce1b('0x25')]);_0x2050a2['offset']=qs['offset'](_0x5dea33[_0xce1b('0x3c')][_0xce1b('0x24')]);}_0x2050a2[_0xce1b('0x45')]=qs[_0xce1b('0x46')](_0x5dea33[_0xce1b('0x3c')][_0xce1b('0x46')]);_0x2050a2[_0xce1b('0x47')]=qs[_0xce1b('0x3e')](_['pick'](_0x5dea33[_0xce1b('0x3c')],_0x298428[_0xce1b('0x3e')]));_0x2050a2['where'][_0xce1b('0xb0')]=_0x1ea272['id'];if(_0x5dea33['query'][_0xce1b('0x86')]){_0x2050a2['where']=_['merge'](_0x2050a2[_0xce1b('0x47')],{'$or':_[_0xce1b('0x2f')](_0x2050a2[_0xce1b('0x40')],function(_0x5acfc2){var _0xc8f375={};_0xc8f375[_0x5acfc2]={'$like':'%'+_0x5dea33['query']['filter']+'%'};return _0xc8f375;})});}if(_0x5dea33['query'][_0xce1b('0x7b')]){var _0x1a153a=_0x5dea33[_0xce1b('0x3c')][_0xce1b('0x7b')][_0xce1b('0x33')](',');var _0x2aa546={};_0x2aa546[_0x1a153a[0x0]]={'$gte':moment(_0x1a153a[0x1])[_0xce1b('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2050a2[_0xce1b('0x47')]=_[_0xce1b('0xb6')](_0x2050a2['where'],_0x2aa546);}_0x2050a2=_['merge']({},_0x2050a2,_0x5dea33[_0xce1b('0xb7')]);return db['OpenchannelMessage']['count']({'where':_0x2050a2['where']})[_0xce1b('0x2a')](function(_0x1c9d56){_0x5bf4a8[_0xce1b('0x23')]=_0x1c9d56;if(_0x5dea33['query']['includeAll']){_0x2050a2[_0xce1b('0xc0')]=[{'all':!![]}];}return db[_0xce1b('0xc1')]['findAll'](_0x2050a2);})['then'](function(_0x29e71d){_0x5bf4a8[_0xce1b('0xb2')]=_0x29e71d;return _0x5bf4a8;});}})[_0xce1b('0x2a')](respondWithFilteredResult(_0x2868dd,_0x2050a2))['catch'](handleError(_0x2868dd,null));};exports['addTags']=function(_0x571f0f,_0xc6a56b,_0x51b105){return db['OpenchannelInteraction'][_0xce1b('0x5f')]({'where':{'id':_0x571f0f[_0xce1b('0xb4')]['id']}})[_0xce1b('0x2a')](handleEntityNotFound(_0xc6a56b,null))[_0xce1b('0x2a')](function(_0x20a8fa){if(_0x20a8fa){return _0x20a8fa[_0xce1b('0xc2')](_0x571f0f['body'][_0xce1b('0xbc')],_['omit'](_0x571f0f['body'],[_0xce1b('0xbc'),'id'])||{})[_0xce1b('0xc3')](function(){return db[_0xce1b('0x6a')][_0xce1b('0xc4')]({'attributes':['id','name',_0xce1b('0xc5')],'where':{'id':_0x571f0f[_0xce1b('0x72')]['ids']}});})[_0xce1b('0x2a')](function(_0x1a5ae5){socket['emit'](_0xce1b('0xc6'),{'id':Number(_0x571f0f[_0xce1b('0xb4')]['id']),'tags':_0x1a5ae5||[]});return{'id':Number(_0x571f0f['params']['id']),'tags':_0x1a5ae5||[]};});}})[_0xce1b('0x2a')](respondWithResult(_0xc6a56b,null))[_0xce1b('0xb3')](handleError(_0xc6a56b,null));};exports['removeTags']=function(_0x5f5946,_0x53da6e,_0x236084){return db[_0xce1b('0x37')][_0xce1b('0x5f')]({'where':{'id':_0x5f5946['params']['id']}})[_0xce1b('0x2a')](handleEntityNotFound(_0x53da6e,null))[_0xce1b('0x2a')](function(_0xfe5ecd){if(_0xfe5ecd){return _0xfe5ecd[_0xce1b('0xc7')](_0x5f5946['query'][_0xce1b('0xbc')]);}})[_0xce1b('0x2a')](respondWithStatusCode(_0x53da6e,null))[_0xce1b('0xb3')](handleError(_0x53da6e,null));};exports['download']=function(_0x3ea0f1,_0x33396d){var _0xb9bb35=moment()[_0xce1b('0xc8')]()[_0xce1b('0xae')]();var _0x347124=path['join'](config[_0xce1b('0xc9')],'server','files',_0xce1b('0xca'));var _0x178e36=path['join'](config[_0xce1b('0xc9')],'server','files','attachments');var _0x2fb3a3=path[_0xce1b('0xcb')](_0x347124,_0xb9bb35);var _0x8bf969=util[_0xce1b('0xbf')](_0xce1b('0xcc'),_0x3ea0f1[_0xce1b('0xb4')]['id'],_0xb9bb35);var _0x1f3564=path[_0xce1b('0xcb')](_0x347124,_0x8bf969);var _0x17876f=[];_0x17876f[_0xce1b('0x35')]({'model':db[_0xce1b('0x6d')],'as':'User','attributes':['id',_0xce1b('0x30')],'raw':!![]});_0x17876f['push']({'model':db[_0xce1b('0xcd')],'as':'Contact','attributes':['id',_0xce1b('0xce'),_0xce1b('0xcf')],'raw':!![]});if(_0x3ea0f1[_0xce1b('0x3c')][_0xce1b('0xd0')]){_0x17876f['push']({'model':db[_0xce1b('0xd1')],'as':_0xce1b('0xd1'),'raw':!![]});}var _0x29a7e7=[{'model':db[_0xce1b('0xc1')],'as':_0xce1b('0xd2'),'attributes':['id',_0xce1b('0x72'),'createdAt',_0xce1b('0xd3'),_0xce1b('0xd4'),_0xce1b('0x81')],'include':_0x17876f}];_0x29a7e7[_0xce1b('0x35')]({'model':db['OpenchannelAccount'],'as':_0xce1b('0xd5'),'attributes':['id','name']});_0x29a7e7[_0xce1b('0x35')]({'model':db['User'],'as':_0xce1b('0xd6'),'attributes':['id','fullname']});return db[_0xce1b('0x37')][_0xce1b('0x5f')]({'where':{'id':_0x3ea0f1[_0xce1b('0xb4')]['id']},'include':_0x29a7e7})[_0xce1b('0x2a')](handleEntityNotFound(_0x33396d,null))['then'](function(_0x406784){if(_0x406784){var _0x154e61=_0x406784[_0xce1b('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x2fb3a3);var _0x3ea8e2={'format':'A4','border':_0xce1b('0xd8'),'header':{'height':_0xce1b('0xd9'),'contents':{'first':_0xce1b('0xda')}},'footer':{'height':_0xce1b('0xdb'),'contents':{'default':util[_0xce1b('0xbf')](_0xce1b('0xdc'),util[_0xce1b('0xbf')]('%s\x20#%d',_0xce1b('0xdd'),_0x154e61['id']),moment()[_0xce1b('0xbf')](_0xce1b('0xde'))[_0xce1b('0xae')]())}}};var _0x264999={'channel':_0xce1b('0xdd'),'account':_0x154e61[_0xce1b('0xd5')][_0xce1b('0x2c')],'agent':_0x154e61[_0xce1b('0xd6')]?_0x154e61['Owner']['fullname']:'N.A.','createdAt':moment(_0x154e61[_0xce1b('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x154e61[_0xce1b('0xdf')]?moment(_0x154e61['closedAt'])[_0xce1b('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xce1b('0xae')]():'','disposition':_0x154e61[_0xce1b('0xe0')],'visibility':_0x154e61[_0xce1b('0xe1')]?'Public':'Private','messages':_(_0x154e61[_0xce1b('0xd2')])[_0xce1b('0x86')]({'secret':![]})[_0xce1b('0x2f')](function(_0x717552){if(_0x717552[_0xce1b('0xd1')]){var _0x12c9d2=path[_0xce1b('0xcb')](_0x178e36,_0x717552[_0xce1b('0xd1')]['basename']);if(fs['existsSync'](_0x12c9d2)){fs['createReadStream'](_0x12c9d2)[_0xce1b('0xe2')](fs[_0xce1b('0xe3')](path[_0xce1b('0xcb')](_0x2fb3a3,_0x717552[_0xce1b('0xd1')][_0xce1b('0xe4')])));}}return{'date':moment(_0x717552['createdAt'])[_0xce1b('0xbf')](_0xce1b('0xe5'))[_0xce1b('0xae')](),'sender':_0x717552[_0xce1b('0xd3')]===_0xce1b('0xe6')?_0x717552['User']?_0x717552[_0xce1b('0x6d')][_0xce1b('0x30')]:_0xce1b('0xe7'):_0x717552[_0xce1b('0x64')]['firstName']+(_0x717552[_0xce1b('0x64')][_0xce1b('0xcf')]?'\x20'+_0x717552[_0xce1b('0x64')]['lastName']:''),'body':_0x717552[_0xce1b('0xd1')]?_0x717552[_0xce1b('0xd1')][_0xce1b('0xe4')]:_0x717552[_0xce1b('0x72')],'direction':_0x717552[_0xce1b('0xd3')]===_0xce1b('0xe6')?'A':'C','secret':_0x717552[_0xce1b('0xd4')],'read':_0x717552[_0xce1b('0x81')],'attachment':_0x717552[_0xce1b('0xd1')]};})[_0xce1b('0x60')]()};return ejs[_0xce1b('0xe8')](path['join'](config[_0xce1b('0xc9')],_0xce1b('0xe9'),_0xce1b('0xea'),_0xce1b('0xeb')),{'interaction':_0x264999})[_0xce1b('0x2a')](function(_0x48345a){return new BPromise(function(_0x54d875,_0x5d4bcb){pdf[_0xce1b('0xb8')](_0x48345a,_0x3ea8e2)[_0xce1b('0xec')](path[_0xce1b('0xcb')](_0x2fb3a3,'transcript-'+_0x154e61['id']+'-'+_0xb9bb35+_0xce1b('0xed')),function(_0x4ae8e9,_0x152562){if(_0x4ae8e9)return _0x5d4bcb(_0x4ae8e9);_0x54d875(_0x152562);});});})['then'](function(){return new BPromise(function(_0x7a6887,_0x56837b){zipdir(_0x2fb3a3,{'saveTo':_0x1f3564},function(_0x531d91,_0x59da4d){if(_0x531d91)return _0x56837b(_0x531d91);return _0x7a6887(_0x59da4d);});})['then'](function(){return new BPromise(function(_0x5e6cb5,_0xd7f742){rimraf(_0x2fb3a3,function(_0x5e004b){if(_0x5e004b)_0xd7f742(_0x5e004b);return _0x5e6cb5();});});})[_0xce1b('0x2a')](function(){return _0x33396d['download'](_0x1f3564,_0x8bf969,function(_0xe6ccab){if(_0xe6ccab){console[_0xce1b('0xee')]('err',_0xe6ccab);}else{fs[_0xce1b('0xef')](_0x1f3564);}});});});}else{return _0x33396d['sendStatus'](0xc8);}})[_0xce1b('0xb3')](handleError(_0x33396d,null));}; \ No newline at end of file +var _0x616c=['desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','Users','map','fullname','TagIds','split','forEach','push','catch','index','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','from','tools_tags','u.id','ui.OpenchannelInteractionId','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','expr','search','parseSearch','sqlOperator','conditions','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','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','type','isEmpty','OpenchannelAccountId','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','filter','replace','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','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','OpenchannelInteraction','rawAttributes','includeAll','options','create','update','params','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','omit','color','openchannelInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','Messages','direction','secret','OpenchannelAccount','Account','User','Owner','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','threadId','Public','Private','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','views','downloadInteraction.html','transcript-','.pdf','log','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel'];(function(_0x1fca33,_0xf7fcf8){var _0x345689=function(_0x2ef468){while(--_0x2ef468){_0x1fca33['push'](_0x1fca33['shift']());}};_0x345689(++_0xf7fcf8);}(_0x616c,0x1b6));var _0xc616=function(_0xb1e92d,_0x264238){_0xb1e92d=_0xb1e92d-0x0;var _0x421fae=_0x616c[_0xb1e92d];return _0x421fae;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc616('0x0'));var rimraf=require(_0xc616('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc616('0x2'));var rp=require(_0xc616('0x3'));var moment=require(_0xc616('0x4'));var BPromise=require(_0xc616('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc616('0x6'));var sox=require(_0xc616('0x7'));var csv=require(_0xc616('0x8'));var ejs=require(_0xc616('0x9'));var fs=require('fs');var _=require(_0xc616('0xa'));var squel=require(_0xc616('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc616('0xc'));var toCsv=require(_0xc616('0x8'));var querystring=require('querystring');var Papa=require(_0xc616('0xd'));var Redis=require('ioredis');var authService=require(_0xc616('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc616('0xf'));var logger=require(_0xc616('0x10'))(_0xc616('0x11'));var utils=require('../../config/utils');var config=require(_0xc616('0x12'));var db=require('../../mysqldb')['db'];config[_0xc616('0x13')]=_[_0xc616('0x14')](config[_0xc616('0x13')],{'host':_0xc616('0x15'),'port':0x18eb});var socket=require(_0xc616('0x16'))(new Redis(config['redis']));require(_0xc616('0x17'))['register'](socket);function respondWithStatusCode(_0x17e829,_0x3958e9){_0x3958e9=_0x3958e9||0xcc;return function(_0x32854f){if(_0x32854f){return _0x17e829[_0xc616('0x18')](_0x3958e9);}return _0x17e829[_0xc616('0x19')](_0x3958e9)['end']();};}function respondWithResult(_0xa07335,_0x1738ff){_0x1738ff=_0x1738ff||0xc8;return function(_0x3ace46){if(_0x3ace46){return _0xa07335[_0xc616('0x19')](_0x1738ff)[_0xc616('0x1a')](_0x3ace46);}};}function respondWithFilteredResult(_0x186b34,_0x4af842){return function(_0x27c4d2){if(_0x27c4d2){var _0x5a8e8e=_0x27c4d2[_0xc616('0x1b')],_0x3d6ed8=_0x4af842['offset'],_0x3e5121=_0x4af842[_0xc616('0x1c')]+_0x4af842['limit'],_0x26c5c3;if(_0x3e5121>=_0x5a8e8e){_0x3e5121=_0x5a8e8e;_0x26c5c3=0xc8;}else{_0x26c5c3=0xce;}_0x186b34['status'](_0x26c5c3);return _0x186b34[_0xc616('0x1d')](_0xc616('0x1e'),_0x3d6ed8+'-'+_0x3e5121+'/'+_0x5a8e8e)[_0xc616('0x1a')](_0x27c4d2);}return null;};}function patchUpdates(_0xf51b1c){return function(_0x3e6053){try{jsonpatch[_0xc616('0x1f')](_0x3e6053,_0xf51b1c,!![]);}catch(_0x2a7506){return BPromise[_0xc616('0x20')](_0x2a7506);}return _0x3e6053[_0xc616('0x21')]();};}function saveUpdates(_0x461e40,_0x47ccd6){return function(_0x297993){if(_0x297993){return _0x297993['update'](_0x461e40)[_0xc616('0x22')](function(_0x1696b5){return _0x1696b5;});}return null;};}function removeEntity(_0x1828f3,_0x229cbd){return function(_0x54d94d){if(_0x54d94d){return _0x54d94d[_0xc616('0x23')]()[_0xc616('0x22')](function(){_0x1828f3[_0xc616('0x19')](0xcc)[_0xc616('0x24')]();});}};}function handleEntityNotFound(_0x108782,_0x4c15ee){return function(_0x28f9b1){if(!_0x28f9b1){_0x108782['sendStatus'](0x194);}return _0x28f9b1;};}function handleError(_0x32ff65,_0x5d10ff){_0x5d10ff=_0x5d10ff||0x1f4;return function(_0x246a98){logger[_0xc616('0x25')](_0x246a98['stack']);if(_0x246a98[_0xc616('0x26')]){delete _0x246a98[_0xc616('0x26')];}_0x32ff65[_0xc616('0x19')](_0x5d10ff)['send'](_0x246a98);};}function getInteractionUsers(_0x2f77a9,_0x4937f6){return new BPromise(function(_0xb1e98a,_0x2935e6){try{if(_0x4937f6[_0x2f77a9['id']]){_0x2f77a9[_0xc616('0x27')]=_[_0xc616('0x28')](_0x4937f6[_0x2f77a9['id']],function(_0x43786e){return{'id':_0x43786e['id'],'fullname':_0x43786e[_0xc616('0x29')]};});}}catch(_0x1ad3d8){_0x2935e6(_0x1ad3d8);}_0xb1e98a(_0x2f77a9);});}function getInteractionTags(_0x357b90,_0x404520){return new BPromise(function(_0x58686c,_0x3758e0){try{if(_0x357b90[_0xc616('0x2a')]){_0x357b90['Tags']=[];_0x357b90[_0xc616('0x2a')][_0xc616('0x2b')](',')[_0xc616('0x2c')](function(_0x648c7b){_0x357b90['Tags'][_0xc616('0x2d')](_0x404520[_0x648c7b]);});}delete _0x357b90['TagIds'];}catch(_0x4b1b60){_0x3758e0(_0x4b1b60);}_0x58686c(_0x357b90);});}function updateOpenchannelInteraction(_0x48b5ca,_0x555594,_0x36aed6){return new BPromise(function(_0xedb413,_0x14e53b){return getInteractionUsers(_0x48b5ca,_0x36aed6)[_0xc616('0x22')](function(_0x62c52e){return getInteractionTags(_0x62c52e,_0x555594);})[_0xc616('0x22')](function(_0x44c61){_0xedb413(_0x44c61);})[_0xc616('0x2e')](function(_0x3be8c2){_0x14e53b(_0x3be8c2);});});}exports[_0xc616('0x2f')]=function(_0x249c72,_0x12ed05){var _0x4c74de={},_0x54d0fe={},_0x4b4d5f={'count':0x0,'rows':[]};var _0xa64ee2=_[_0xc616('0x28')](db['OpenchannelInteraction']['rawAttributes'],function(_0x3e8960){return{'name':_0x3e8960['fieldName'],'type':_0x3e8960['type']['key']};});_0x54d0fe[_0xc616('0x30')]=_[_0xc616('0x28')](_0xa64ee2,'name');_0x54d0fe['query']=_[_0xc616('0x31')](_0x249c72[_0xc616('0x32')]);_0x54d0fe[_0xc616('0x33')]=_[_0xc616('0x34')](_0x54d0fe['model'],_0x54d0fe[_0xc616('0x32')]);_0x4c74de[_0xc616('0x35')]=_['intersection'](_0x54d0fe[_0xc616('0x30')],qs[_0xc616('0x36')](_0x249c72[_0xc616('0x32')]['fields']));_0x4c74de[_0xc616('0x35')]=_0x4c74de[_0xc616('0x35')][_0xc616('0x37')]?_0x4c74de[_0xc616('0x35')]:_0x54d0fe[_0xc616('0x30')];if(!_0x249c72[_0xc616('0x32')][_0xc616('0x38')](_0xc616('0x39'))){_0x4c74de[_0xc616('0x3a')]=qs[_0xc616('0x3a')](_0x249c72[_0xc616('0x32')][_0xc616('0x3a')]);_0x4c74de[_0xc616('0x1c')]=qs[_0xc616('0x1c')](_0x249c72[_0xc616('0x32')][_0xc616('0x1c')]);}_0x4c74de['order']=qs['sort'](_0x249c72[_0xc616('0x32')][_0xc616('0x3b')]);_0x4c74de[_0xc616('0x3c')]=qs[_0xc616('0x33')](_[_0xc616('0x3d')](_0x249c72[_0xc616('0x32')],_0x54d0fe[_0xc616('0x33')]),_0xa64ee2);var _0x11edc6=[];var _0x39c59f=squel[_0xc616('0x3e')]()[_0xc616('0x3f')]('id')['field'](_0xc616('0x26'))[_0xc616('0x3f')]('color')[_0xc616('0x40')](_0xc616('0x41'));var _0x432b99=squel[_0xc616('0x3e')]()[_0xc616('0x3f')](_0xc616('0x42'))['field']('u.fullname')[_0xc616('0x3f')](_0xc616('0x43'))[_0xc616('0x40')]('user_has_openchannel_interactions','ui')[_0xc616('0x44')](_0xc616('0x45'),'u','u.id\x20=\x20ui.UserId');var _0x4f77f0=squel[_0xc616('0x3e')]()[_0xc616('0x40')](_0xc616('0x46'),'i')['left_join'](_0xc616('0x47'),'c',_0xc616('0x48'))[_0xc616('0x44')]('users','o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0xc616('0x49'))[_0xc616('0x44')](_0xc616('0x4a'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xc616('0x44')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xc616('0x44')](_0xc616('0x41'),'t','t.id\x20=\x20it.TagId');var _0x7bd030=squel[_0xc616('0x4b')]();var _0x1b2cf5=[];var _0x45bd98=squel[_0xc616('0x4b')]();var _0x4e3281;if(_0x249c72[_0xc616('0x32')][_0xc616('0x4c')]){_0x4e3281=as[_0xc616('0x4d')](_0x249c72[_0xc616('0x32')]['search']);var _0x140ffc=_0x4e3281[_0xc616('0x4e')];for(var _0x1130e2=0x0;_0x1130e2<_0x4e3281[_0xc616('0x4f')]['length'];_0x1130e2++){var _0x3519a4=_0x4e3281[_0xc616('0x4f')][_0x1130e2];var _0x1e9e2e='i';var _0x15adb7=_[_0xc616('0x50')](_0xa64ee2,[_0xc616('0x26'),_0x3519a4[_0xc616('0x3f')]]);if(!_0x15adb7){switch(_0x3519a4[_0xc616('0x3f')]){case _0xc616('0x51'):if(_0x3519a4['value']==0x1){_0x4f77f0['having']('`'+_0x3519a4[_0xc616('0x3f')]+'`\x20=\x200');}else{_0x4f77f0[_0xc616('0x52')]('`'+_0x3519a4[_0xc616('0x3f')]+_0xc616('0x53'));}break;case _0xc616('0x54'):if(_0x3519a4[_0xc616('0x55')]==='$substring'){if(_0x3519a4[_0xc616('0x56')]['split']('\x20')[_0xc616('0x37')]>0x1){_0x7bd030[_0x140ffc](_0xc616('0x57'),qs[_0xc616('0x58')](_0x3519a4[_0xc616('0x56')]),null);}else{var _0x3e49a5='%'+_0x3519a4[_0xc616('0x56')]+'%';_0x7bd030[_0x140ffc](_0xc616('0x59'),_0x3e49a5,_0x3e49a5,_0x3e49a5);}}else{_0x15adb7=_['find'](_0xa64ee2,[_0xc616('0x26'),_0xc616('0x5a')]);_0x3519a4['field']=_0xc616('0x5a');_0xd06aca=as[_0xc616('0x5b')](_0x1e9e2e,_0x15adb7['type'],_0x3519a4);_0x7bd030[_0x140ffc](_0xd06aca['text'],_0xd06aca[_0xc616('0x56')][_0xc616('0x5c')],_0xd06aca[_0xc616('0x56')][_0xc616('0x24')]);}break;case _0xc616('0x5d'):var _0x241ad8=_0x3519a4[_0xc616('0x56')]['split'](',')['map'](function(_0x3f8ebf){return Number(_0x3f8ebf);});_0x241ad8['forEach'](function(_0x2717be){_0x45bd98['or'](_0xc616('0x5e'),'%,'+_0x2717be+',%');});_0x1b2cf5=_['union'](_0x1b2cf5,_0x241ad8);break;case'User':if(_0x3519a4[_0xc616('0x55')]===_0xc616('0x5f')){_0x7bd030[_0x140ffc](_0xc616('0x60'),'%'+_0x3519a4['value']+'%',null);}else{_0x15adb7=_['find'](_0xa64ee2,['name',_0xc616('0x61')]);_0x3519a4[_0xc616('0x3f')]=_0xc616('0x61');_0xd06aca=as[_0xc616('0x5b')](_0x1e9e2e,_0x15adb7['type'],_0x3519a4);_0x7bd030[_0x140ffc](_0xd06aca[_0xc616('0x62')],_0xd06aca['value']['start'],_0xd06aca[_0xc616('0x56')][_0xc616('0x24')]);}break;case _0xc616('0x63'):_0xd06aca=as[_0xc616('0x5b')]('me',null,_0x3519a4);_0x7bd030[_0x140ffc](_0xd06aca[_0xc616('0x62')],_0xd06aca[_0xc616('0x56')][_0xc616('0x5c')],_0xd06aca['value'][_0xc616('0x24')]);break;}}else{var _0xd06aca=as[_0xc616('0x5b')](_0x1e9e2e,_0x15adb7[_0xc616('0x64')],_0x3519a4);_0x7bd030[_0x140ffc](_0xd06aca['text'],_0xd06aca[_0xc616('0x56')][_0xc616('0x5c')],_0xd06aca['value'][_0xc616('0x24')]);}}}else{var _0x1f376b=_(_0x249c72[_0xc616('0x32')])[_0xc616('0x31')]()[_0xc616('0x28')](function(_0x434476){return _['some'](_0xa64ee2,[_0xc616('0x26'),_0x434476])?_0x434476:undefined;})['compact']()[_0xc616('0x56')]();if(!_[_0xc616('0x65')](_0x1f376b)){_0x1f376b[_0xc616('0x2c')](function(_0x939e6e){if(_0x939e6e===_0xc616('0x66')){_0x4f77f0[_0xc616('0x3c')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x249c72[_0xc616('0x32')][_0x939e6e]));}else if(_0x939e6e===_0xc616('0x67')){var _0x10718c=JSON['parse'](_0x249c72[_0xc616('0x32')][_0x939e6e])[_0xc616('0x68')];var _0x4672d3=JSON[_0xc616('0x69')](_0x249c72[_0xc616('0x32')][_0x939e6e])[_0xc616('0x6a')];_0x4f77f0[_0xc616('0x3c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x10718c,_0x4672d3);}else{if(_0x249c72[_0xc616('0x32')][_0x939e6e]===_0xc616('0x6b')){_0x4f77f0[_0xc616('0x3c')]('i.'+_0x939e6e+_0xc616('0x6c'));}else{_0x4f77f0[_0xc616('0x3c')]('i.'+_0x939e6e+'\x20=\x20?',_0x249c72[_0xc616('0x32')][_0x939e6e]);}}});}if(_0x249c72[_0xc616('0x32')][_0xc616('0x6d')]){if(_0x249c72[_0xc616('0x32')][_0xc616('0x6d')]==0x1){_0x4f77f0[_0xc616('0x52')]('`unreadMessages`\x20=\x200');}else{_0x4f77f0[_0xc616('0x52')](_0xc616('0x6e'));}}if(_0x249c72[_0xc616('0x32')][_0xc616('0x6f')]){_0x1b2cf5=_['isArray'](_0x249c72['query'][_0xc616('0x6f')])?_0x249c72[_0xc616('0x32')]['tag']:new Array(_0x249c72[_0xc616('0x32')][_0xc616('0x6f')]);_0x1b2cf5['forEach'](function(_0x2991be){_0x45bd98['or'](_0xc616('0x5e'),'%,'+_0x2991be+',%');});}if(_0x249c72['query'][_0xc616('0x70')]){var _0x35dfb2=_0x249c72[_0xc616('0x32')][_0xc616('0x70')][_0xc616('0x71')]('\x5c','\x5c\x5c')[_0xc616('0x71')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xc616('0x72')](_0x35dfb2)){_0x7bd030['or'](_0xc616('0x73'),_0x35dfb2+'%');}else{_0x7bd030['or'](_0xc616('0x74'),qs[_0xc616('0x58')](_0x35dfb2))['or'](_0xc616('0x75'),_0x35dfb2+'%')['or'](_0xc616('0x76'),_0x35dfb2+'%');}}}_0x4f77f0['where'](_0x7bd030);_0x4f77f0[_0xc616('0x77')]('i.id');var _0x446a87={'type':db[_0xc616('0x78')][_0xc616('0x79')]['SELECT'],'raw':!![]};var _0x509600=_0x4f77f0['clone']();_0x509600['field'](_0xc616('0x7a'));_0x509600['field'](_0xc616('0x7b'),_0xc616('0x51'));if(_0x4c74de[_0xc616('0x7c')]){_0x4c74de[_0xc616('0x7c')][_0xc616('0x2c')](function(_0x408dce){_0x4f77f0[_0xc616('0x7c')]('i.'+_0x408dce[0x0],_0x408dce[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x1b2cf5)){_0x4f77f0[_0xc616('0x52')](_0x45bd98);_0x509600[_0xc616('0x3c')]('t.id\x20IN\x20?',_0x1b2cf5);}BPromise[_0xc616('0x7d')]()['then'](function(){if(!_0x4e3281){if(_0x249c72[_0xc616('0x32')]['OpenchannelAccountId']||_0x249c72['query'][_0xc616('0x7e')])return;_0x509600[_0xc616('0x3c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x4f77f0['where'](_0xc616('0x7f'));return;}return _0x249c72[_0xc616('0x80')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xc616('0x22')](function(_0x5986d4){if(_[_0xc616('0x65')](_0x5986d4)){_0x509600[_0xc616('0x3c')](_0xc616('0x81'));_0x4f77f0[_0xc616('0x3c')](_0xc616('0x81'));}else{_0x509600[_0xc616('0x3c')](_0xc616('0x82'),_[_0xc616('0x28')](_0x5986d4,'id'));_0x4f77f0[_0xc616('0x3c')](_0xc616('0x82'),_[_0xc616('0x28')](_0x5986d4,'id'));}});})['then'](function(){db[_0xc616('0x83')][_0xc616('0x32')](_0x509600['toString'](),_0x446a87)[_0xc616('0x22')](function(_0x209b4a){_0x4b4d5f['count']=_0x209b4a[_0xc616('0x37')];if(_0x4b4d5f[_0xc616('0x1b')]===0x0)return[];return db['sequelize'][_0xc616('0x32')](_0x39c59f['toString'](),_0x446a87)[_0xc616('0x22')](function(_0x5e2ff7){_0x11edc6=_['keyBy'](_0x5e2ff7,'id');_0x446a87=_[_0xc616('0x84')](_0x446a87,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x249c72['query'][_0xc616('0x36')]){_0x4c74de[_0xc616('0x35')][_0xc616('0x2c')](function(_0x354c46){_0x4f77f0['field']('i.'+_0x354c46);});}else{_0x4f77f0['field'](_0xc616('0x7b'),'unreadMessages');_0x4f77f0[_0xc616('0x3f')](_0xc616('0x85'),'Account.key');_0x4f77f0[_0xc616('0x3f')](_0xc616('0x86'),_0xc616('0x87'));_0x4f77f0[_0xc616('0x3f')](_0xc616('0x88'));_0x4f77f0[_0xc616('0x3f')](_0xc616('0x89'),_0xc616('0x8a'));_0x4f77f0['field'](_0xc616('0x8b'),_0xc616('0x8c'));_0x4f77f0[_0xc616('0x3f')](_0xc616('0x8d'),'Contact.email');_0x4f77f0[_0xc616('0x3f')](_0xc616('0x8e'),_0xc616('0x8f'));_0x4f77f0[_0xc616('0x3f')](_0xc616('0x90'),'Contact.mobile');_0x4f77f0[_0xc616('0x3f')](_0xc616('0x91'),_0xc616('0x92'));_0x4f77f0[_0xc616('0x3f')](_0xc616('0x93'),'Owner.fullname');_0x4f77f0[_0xc616('0x3f')](_0xc616('0x94'),_0xc616('0x95'));_0x4f77f0[_0xc616('0x3f')](_0xc616('0x96'),_0xc616('0x2a'));}if(_0x4c74de[_0xc616('0x3a')])_0x4f77f0[_0xc616('0x3a')](_0x4c74de['limit']);if(_0x4c74de[_0xc616('0x1c')])_0x4f77f0[_0xc616('0x1c')](_0x4c74de['offset']);return db[_0xc616('0x83')][_0xc616('0x32')](_0x4f77f0[_0xc616('0x97')](),_0x446a87);})[_0xc616('0x22')](function(_0x1d45d7){_0x432b99[_0xc616('0x3c')](_0xc616('0x98'),_[_0xc616('0x28')](_0x1d45d7,'id'));return db[_0xc616('0x83')][_0xc616('0x32')](_0x432b99[_0xc616('0x97')](),_0x446a87)['then'](function(_0x5be9ba){var _0x12a21e=_[_0xc616('0x99')](_0x5be9ba,_0xc616('0x9a'));var _0x803f1d=[];_0x1d45d7[_0xc616('0x2c')](function(_0x58eada){_0x803f1d['push'](updateOpenchannelInteraction(_0x58eada,_0x11edc6,_0x12a21e));});return BPromise[_0xc616('0x9b')](_0x803f1d);});});})[_0xc616('0x22')](function(_0x2576c6){_0x4b4d5f[_0xc616('0x9c')]=_0x2576c6;return _0x4b4d5f;})['then'](respondWithFilteredResult(_0x12ed05,_0x4c74de));})[_0xc616('0x2e')](handleError(_0x12ed05,null));};exports[_0xc616('0x9d')]=function(_0x2bbc26,_0x40ce0b){var _0x34a087={'raw':![],'where':{'id':_0x2bbc26['params']['id']}},_0x56c2ac={};_0x56c2ac[_0xc616('0x30')]=_['keys'](db[_0xc616('0x9e')][_0xc616('0x9f')]);_0x56c2ac['query']=_[_0xc616('0x31')](_0x2bbc26[_0xc616('0x32')]);_0x56c2ac[_0xc616('0x33')]=_[_0xc616('0x34')](_0x56c2ac['model'],_0x56c2ac[_0xc616('0x32')]);_0x34a087[_0xc616('0x35')]=_['intersection'](_0x56c2ac[_0xc616('0x30')],qs['fields'](_0x2bbc26[_0xc616('0x32')]['fields']));_0x34a087[_0xc616('0x35')]=_0x34a087[_0xc616('0x35')][_0xc616('0x37')]?_0x34a087[_0xc616('0x35')]:_0x56c2ac[_0xc616('0x30')];if(_0x2bbc26['query'][_0xc616('0xa0')]){_0x34a087['include']=[{'all':!![]}];}_0x34a087=_[_0xc616('0x84')]({},_0x34a087,_0x2bbc26[_0xc616('0xa1')]);return db[_0xc616('0x9e')][_0xc616('0x50')](_0x34a087)[_0xc616('0x22')](handleEntityNotFound(_0x40ce0b,null))[_0xc616('0x22')](respondWithResult(_0x40ce0b,null))['catch'](handleError(_0x40ce0b,null));};exports['create']=function(_0x118a53,_0x1e2e90){return db[_0xc616('0x9e')][_0xc616('0xa2')](_0x118a53[_0xc616('0x63')],{})[_0xc616('0x22')](respondWithResult(_0x1e2e90,0xc9))['catch'](handleError(_0x1e2e90,null));};exports[_0xc616('0xa3')]=function(_0x14e0f3,_0xef549d){if(_0x14e0f3['body']['id']){delete _0x14e0f3[_0xc616('0x63')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x14e0f3['params']['id']}})[_0xc616('0x22')](handleEntityNotFound(_0xef549d,null))[_0xc616('0x22')](saveUpdates(_0x14e0f3['body'],null))['then'](respondWithResult(_0xef549d,null))[_0xc616('0x2e')](handleError(_0xef549d,null));};exports[_0xc616('0x23')]=function(_0xd86a49,_0x5be46b){return db[_0xc616('0x9e')]['find']({'where':{'id':_0xd86a49[_0xc616('0xa4')]['id']}})[_0xc616('0x22')](handleEntityNotFound(_0x5be46b,null))['then'](removeEntity(_0x5be46b,null))[_0xc616('0x2e')](handleError(_0x5be46b,null));};exports[_0xc616('0xa5')]=function(_0x22242e,_0x2888fb){return db[_0xc616('0x9e')][_0xc616('0xa5')]()[_0xc616('0x22')](respondWithResult(_0x2888fb,null))[_0xc616('0x2e')](handleError(_0x2888fb,null));};exports[_0xc616('0xa6')]=function(_0x245b55,_0x15973a,_0x4fd5dd){return db['OpenchannelMessage'][_0xc616('0x50')]({'where':{'id':_0x245b55['params']['id']}})[_0xc616('0x22')](handleEntityNotFound(_0x15973a,null))[_0xc616('0x22')](function(_0x5b6dfa){if(_0x5b6dfa){return _0x5b6dfa[_0xc616('0xa6')](_0x245b55[_0xc616('0x63')][_0xc616('0xa7')],_['omit'](_0x245b55[_0xc616('0x63')],[_0xc616('0xa7'),'id'])||{});}})[_0xc616('0x22')](respondWithResult(_0x15973a,null))[_0xc616('0x2e')](handleError(_0x15973a,null));};exports[_0xc616('0xa8')]=function(_0x5da110,_0x2d8ec3,_0x1fed6b){var _0x151df0={'raw':![],'where':{}};var _0x2382b5={};var _0x191164={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc616('0xa9')]({'where':{'id':_0x5da110[_0xc616('0xa4')]['id']}})['then'](handleEntityNotFound(_0x2d8ec3,null))[_0xc616('0x22')](function(_0x259955){if(_0x259955){_0x2382b5[_0xc616('0x30')]=_['keys'](db[_0xc616('0xaa')][_0xc616('0x9f')]);_0x2382b5[_0xc616('0x32')]=_[_0xc616('0x31')](_0x5da110[_0xc616('0x32')]);_0x2382b5[_0xc616('0x33')]=_[_0xc616('0x34')](_0x2382b5['model'],_0x2382b5['query']);_0x151df0[_0xc616('0x35')]=_[_0xc616('0x34')](_0x2382b5[_0xc616('0x30')],qs['fields'](_0x5da110[_0xc616('0x32')][_0xc616('0x36')]));_0x151df0[_0xc616('0x35')]=_0x151df0['attributes']['length']?_0x151df0[_0xc616('0x35')]:_0x2382b5[_0xc616('0x30')];if(!_0x5da110[_0xc616('0x32')]['hasOwnProperty'](_0xc616('0x39'))){_0x151df0[_0xc616('0x3a')]=qs[_0xc616('0x3a')](_0x5da110[_0xc616('0x32')][_0xc616('0x3a')]);_0x151df0[_0xc616('0x1c')]=qs['offset'](_0x5da110[_0xc616('0x32')][_0xc616('0x1c')]);}_0x151df0[_0xc616('0x7c')]=qs[_0xc616('0x3b')](_0x5da110['query'][_0xc616('0x3b')]);_0x151df0['where']=qs['filters'](_[_0xc616('0x3d')](_0x5da110['query'],_0x2382b5[_0xc616('0x33')]));_0x151df0[_0xc616('0x3c')][_0xc616('0x9a')]=_0x259955['id'];if(_0x5da110[_0xc616('0x32')][_0xc616('0x70')]){_0x151df0['where']=_['merge'](_0x151df0[_0xc616('0x3c')],{'$or':_['map'](_0x151df0[_0xc616('0x35')],function(_0x172a11){var _0x29e4af={};_0x29e4af[_0x172a11]={'$like':'%'+_0x5da110[_0xc616('0x32')][_0xc616('0x70')]+'%'};return _0x29e4af;})});}if(_0x5da110[_0xc616('0x32')][_0xc616('0x68')]){var _0x267556=_0x5da110[_0xc616('0x32')]['$gte']['split'](',');var _0x1f0201={};_0x1f0201[_0x267556[0x0]]={'$gte':moment(_0x267556[0x1])[_0xc616('0xab')](_0xc616('0xac'))};_0x151df0[_0xc616('0x3c')]=_[_0xc616('0x84')](_0x151df0[_0xc616('0x3c')],_0x1f0201);}_0x151df0=_[_0xc616('0x84')]({},_0x151df0,_0x5da110[_0xc616('0xa1')]);return db['OpenchannelMessage'][_0xc616('0x1b')]({'where':_0x151df0['where']})[_0xc616('0x22')](function(_0x6d1955){_0x191164['count']=_0x6d1955;if(_0x5da110['query']['includeAll']){_0x151df0[_0xc616('0xad')]=[{'all':!![]}];}return db[_0xc616('0xaa')][_0xc616('0xae')](_0x151df0);})['then'](function(_0x208093){_0x191164['rows']=_0x208093;return _0x191164;});}})[_0xc616('0x22')](respondWithFilteredResult(_0x2d8ec3,_0x151df0))[_0xc616('0x2e')](handleError(_0x2d8ec3,null));};exports[_0xc616('0xaf')]=function(_0x4273d2,_0x3dc8c1,_0x32aa91){return db[_0xc616('0x9e')][_0xc616('0x50')]({'where':{'id':_0x4273d2[_0xc616('0xa4')]['id']}})[_0xc616('0x22')](handleEntityNotFound(_0x3dc8c1,null))[_0xc616('0x22')](function(_0x20a3e6){if(_0x20a3e6){return _0x20a3e6[_0xc616('0xb0')](_0x4273d2[_0xc616('0x63')][_0xc616('0xa7')],_[_0xc616('0xb1')](_0x4273d2[_0xc616('0x63')],[_0xc616('0xa7'),'id'])||{})['spread'](function(){return db[_0xc616('0x5d')][_0xc616('0xae')]({'attributes':['id',_0xc616('0x26'),_0xc616('0xb2')],'where':{'id':_0x4273d2[_0xc616('0x63')]['ids']}});})[_0xc616('0x22')](function(_0x1dd18c){socket['emit'](_0xc616('0xb3'),{'id':Number(_0x4273d2[_0xc616('0xa4')]['id']),'tags':_0x1dd18c||[]});return{'id':Number(_0x4273d2['params']['id']),'tags':_0x1dd18c||[]};});}})[_0xc616('0x22')](respondWithResult(_0x3dc8c1,null))['catch'](handleError(_0x3dc8c1,null));};exports['removeTags']=function(_0x2e73d2,_0x1fb4a8,_0x47abf8){return db[_0xc616('0x9e')]['find']({'where':{'id':_0x2e73d2[_0xc616('0xa4')]['id']}})[_0xc616('0x22')](handleEntityNotFound(_0x1fb4a8,null))[_0xc616('0x22')](function(_0x4b3f79){if(_0x4b3f79){return _0x4b3f79[_0xc616('0xb4')](_0x2e73d2[_0xc616('0x32')][_0xc616('0xa7')]);}})[_0xc616('0x22')](respondWithStatusCode(_0x1fb4a8,null))[_0xc616('0x2e')](handleError(_0x1fb4a8,null));};exports[_0xc616('0xb5')]=function(_0x50d63a,_0x2ecb88){var _0x4cf9bc=moment()[_0xc616('0xb6')]()['toString']();var _0x5152be=path['join'](config[_0xc616('0xb7')],_0xc616('0xb8'),'files',_0xc616('0xb9'));var _0x3d7fec=path[_0xc616('0xba')](config[_0xc616('0xb7')],_0xc616('0xb8'),_0xc616('0xbb'),_0xc616('0xbc'));var _0x201a4b=path[_0xc616('0xba')](_0x5152be,_0x4cf9bc);var _0x32a063=util[_0xc616('0xab')](_0xc616('0xbd'),_0x50d63a[_0xc616('0xa4')]['id'],_0x4cf9bc);var _0x4eefe8=path[_0xc616('0xba')](_0x5152be,_0x32a063);var _0x4d17a3=[];_0x4d17a3[_0xc616('0x2d')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x4d17a3[_0xc616('0x2d')]({'model':db['CmContact'],'as':_0xc616('0x54'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x50d63a[_0xc616('0x32')]['attachments']){_0x4d17a3[_0xc616('0x2d')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x390414=[{'model':db['OpenchannelMessage'],'as':_0xc616('0xbe'),'attributes':['id',_0xc616('0x63'),_0xc616('0x67'),_0xc616('0xbf'),_0xc616('0xc0'),_0xc616('0x6d')],'include':_0x4d17a3}];_0x390414[_0xc616('0x2d')]({'model':db[_0xc616('0xc1')],'as':_0xc616('0xc2'),'attributes':['id',_0xc616('0x26')]});_0x390414[_0xc616('0x2d')]({'model':db[_0xc616('0xc3')],'as':_0xc616('0xc4'),'attributes':['id',_0xc616('0x29')]});return db[_0xc616('0x9e')][_0xc616('0x50')]({'where':{'id':_0x50d63a['params']['id']},'include':_0x390414})[_0xc616('0x22')](handleEntityNotFound(_0x2ecb88,null))[_0xc616('0x22')](function(_0x32ff52){if(_0x32ff52){var _0x28c7b1=_0x32ff52['get']({'plain':!![]});fs[_0xc616('0xc5')](_0x201a4b);var _0x3511e3={'format':'A4','border':_0xc616('0xc6'),'header':{'height':_0xc616('0xc7'),'contents':{'first':_0xc616('0xc8')}},'footer':{'height':'30px','contents':{'default':util[_0xc616('0xab')](_0xc616('0xc9'),util[_0xc616('0xab')]('%s\x20#%d',_0xc616('0xca'),_0x28c7b1['id']),moment()[_0xc616('0xab')](_0xc616('0xcb'))['toString']())}}};var _0x43de42={'channel':_0xc616('0xca'),'account':_0x28c7b1[_0xc616('0xc2')][_0xc616('0x26')],'agent':_0x28c7b1[_0xc616('0xc4')]?_0x28c7b1[_0xc616('0xc4')][_0xc616('0x29')]:_0xc616('0xcc'),'createdAt':moment(_0x28c7b1[_0xc616('0x67')])['format'](_0xc616('0xac'))[_0xc616('0x97')](),'closedAt':_0x28c7b1[_0xc616('0xcd')]?moment(_0x28c7b1[_0xc616('0xce')])['format'](_0xc616('0xac'))[_0xc616('0x97')]():'','disposition':_0x28c7b1['disposition'],'visibility':_0x28c7b1[_0xc616('0xcf')]?_0xc616('0xd0'):_0xc616('0xd1'),'messages':_(_0x28c7b1['Messages'])[_0xc616('0x70')]({'secret':![]})[_0xc616('0x28')](function(_0x2fe8b6){if(_0x2fe8b6['Attachment']){var _0x86e929=path[_0xc616('0xba')](_0x3d7fec,_0x2fe8b6[_0xc616('0xd2')][_0xc616('0xd3')]);if(fs[_0xc616('0xd4')](_0x86e929)){fs[_0xc616('0xd5')](_0x86e929)[_0xc616('0xd6')](fs[_0xc616('0xd7')](path[_0xc616('0xba')](_0x201a4b,_0x2fe8b6[_0xc616('0xd2')][_0xc616('0xd3')])));}}return{'date':moment(_0x2fe8b6['createdAt'])['format'](_0xc616('0xac'))['toString'](),'sender':_0x2fe8b6[_0xc616('0xbf')]===_0xc616('0xd8')?_0x2fe8b6[_0xc616('0xc3')]?_0x2fe8b6[_0xc616('0xc3')][_0xc616('0x29')]:_0xc616('0xd9'):_0x2fe8b6['Contact'][_0xc616('0xda')]+(_0x2fe8b6[_0xc616('0x54')][_0xc616('0xdb')]?'\x20'+_0x2fe8b6[_0xc616('0x54')][_0xc616('0xdb')]:''),'body':_0x2fe8b6[_0xc616('0xd2')]?_0x2fe8b6['Attachment']['basename']:_0x2fe8b6[_0xc616('0x63')],'direction':_0x2fe8b6[_0xc616('0xbf')]==='out'?'A':'C','secret':_0x2fe8b6['secret'],'read':_0x2fe8b6['read'],'attachment':_0x2fe8b6['Attachment']};})['value']()};return ejs['renderFile'](path[_0xc616('0xba')](config[_0xc616('0xb7')],_0xc616('0xb8'),_0xc616('0xdc'),_0xc616('0xdd')),{'interaction':_0x43de42})[_0xc616('0x22')](function(_0x1b1e32){return new BPromise(function(_0xd47e6a,_0x4a87f3){pdf[_0xc616('0xa2')](_0x1b1e32,_0x3511e3)['toFile'](path[_0xc616('0xba')](_0x201a4b,_0xc616('0xde')+_0x28c7b1['id']+'-'+_0x4cf9bc+_0xc616('0xdf')),function(_0x1f30b7,_0x111565){if(_0x1f30b7)return _0x4a87f3(_0x1f30b7);_0xd47e6a(_0x111565);});});})['then'](function(){return new BPromise(function(_0x22e03e,_0x1083f1){zipdir(_0x201a4b,{'saveTo':_0x4eefe8},function(_0x305898,_0x3bd1c7){if(_0x305898)return _0x1083f1(_0x305898);return _0x22e03e(_0x3bd1c7);});})[_0xc616('0x22')](function(){return new BPromise(function(_0x5155c9,_0x3e256e){rimraf(_0x201a4b,function(_0x567784){if(_0x567784)_0x3e256e(_0x567784);return _0x5155c9();});});})[_0xc616('0x22')](function(){return _0x2ecb88['download'](_0x4eefe8,_0x32a063,function(_0xa52838){if(_0xa52838){console[_0xc616('0xe0')]('err',_0xa52838);}else{fs['unlinkSync'](_0x4eefe8);}});});});}else{return _0x2ecb88[_0xc616('0x18')](0xc8);}})[_0xc616('0x2e')](handleError(_0x2ecb88,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8ec2e58..b4bbdad 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 _0x2390=['emit','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','remove','getUsers','Users','map','findAll','setDataValue','unreadMessages'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x2390,0x154));var _0x0239=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x2390[_0x1d24eb];return _0x1dc576;};'use strict';var EventEmitter=require(_0x0239('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x0239('0x1')];var OpenchannelMessage=require(_0x0239('0x2'))['db'][_0x0239('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0239('0x4'),'afterUpdate':'update','afterDestroy':_0x0239('0x5')};function emitEvent(_0x442d56){return function(_0x562413,_0x28a4d9,_0x54b66d){_0x562413[_0x0239('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x214c86){_0x562413['setDataValue'](_0x0239('0x7'),_0x214c86[_0x0239('0x8')](function(_0x52a21b){return{'id':_0x52a21b['id']};}));return OpenchannelMessage[_0x0239('0x9')]({'where':{'OpenchannelInteractionId':_0x562413['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x361403){_0x562413[_0x0239('0xa')](_0x0239('0xb'),_0x361403['length']);OpenchannelInteractionEvents[_0x0239('0xc')](_0x442d56+':'+_0x562413['id'],_0x562413);OpenchannelInteractionEvents['emit'](_0x442d56,_0x562413);_0x54b66d(null);})['catch'](_0x54b66d(null));};}for(var e in events){if(events[_0x0239('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x0239('0xe')](e,emitEvent(event));}}module[_0x0239('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xf89d=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0xf89d,0xb4));var _0xdf89=function(_0x470187,_0x2bcbfb){_0x470187=_0x470187-0x0;var _0x1564be=_0xf89d[_0x470187];return _0x1564be;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xdf89('0x0'))['db'][_0xdf89('0x1')];var OpenchannelMessage=require(_0xdf89('0x0'))['db'][_0xdf89('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdf89('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdf89('0x4'),'afterDestroy':_0xdf89('0x5')};function emitEvent(_0x33be36){return function(_0x45274d,_0x30821b,_0x72c459){_0x45274d[_0xdf89('0x6')]({'attributes':['id'],'raw':!![]})[_0xdf89('0x7')](function(_0x17d182){_0x45274d[_0xdf89('0x8')](_0xdf89('0x9'),_0x17d182['map'](function(_0x1e182e){return{'id':_0x1e182e['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x45274d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x372c63){_0x45274d[_0xdf89('0x8')](_0xdf89('0xa'),_0x372c63['length']);OpenchannelInteractionEvents[_0xdf89('0xb')](_0x33be36+':'+_0x45274d['id'],_0x45274d);OpenchannelInteractionEvents[_0xdf89('0xb')](_0x33be36,_0x45274d);_0x72c459(null);})[_0xdf89('0xc')](_0x72c459(null));};}for(var e in events){if(events[_0xdf89('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xdf89('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 40792c4..83546bd 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 _0xa4e9=['changed','closed','closedAt','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','openchannel_interactions'];(function(_0x176aa9,_0x323e16){var _0x4d4f64=function(_0x1a370b){while(--_0x1a370b){_0x176aa9['push'](_0x176aa9['shift']());}};_0x4d4f64(++_0x323e16);}(_0xa4e9,0x12c));var _0x9a4e=function(_0x450289,_0xa76428){_0x450289=_0x450289-0x0;var _0x41ff32=_0xa4e9[_0x450289];return _0x41ff32;};'use strict';var _=require(_0x9a4e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9a4e('0x1'));var moment=require(_0x9a4e('0x2'));var BPromise=require(_0x9a4e('0x3'));var rp=require(_0x9a4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a4e('0x5'));var config=require(_0x9a4e('0x6'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x4ca40a,_0x3513af){return _0x4ca40a['define']('OpenchannelInteraction',attributes,{'tableName':_0x9a4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c15b6,_0x15490d,_0x4856a9){if(_0x2c15b6[_0x9a4e('0x8')](_0x9a4e('0x9'))){_0x2c15b6[_0x9a4e('0xa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4856a9(null,_0x2c15b6);}}});}; \ No newline at end of file +var _0xc241=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','closed','closedAt'];(function(_0x125396,_0x5c4fbe){var _0x847cd7=function(_0x4a08fa){while(--_0x4a08fa){_0x125396['push'](_0x125396['shift']());}};_0x847cd7(++_0x5c4fbe);}(_0xc241,0x134));var _0x1c24=function(_0xfc6749,_0x25395a){_0xfc6749=_0xfc6749-0x0;var _0x8a243f=_0xc241[_0xfc6749];return _0x8a243f;};'use strict';var _=require(_0x1c24('0x0'));var util=require(_0x1c24('0x1'));var logger=require('../../config/logger')(_0x1c24('0x2'));var moment=require(_0x1c24('0x3'));var BPromise=require(_0x1c24('0x4'));var rp=require(_0x1c24('0x5'));var fs=require('fs');var path=require(_0x1c24('0x6'));var rimraf=require(_0x1c24('0x7'));var config=require(_0x1c24('0x8'));var attributes=require(_0x1c24('0x9'));module[_0x1c24('0xa')]=function(_0x1e57b8,_0x1e1512){return _0x1e57b8[_0x1c24('0xb')](_0x1c24('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x480a9b,_0x3e1ceb,_0x5424fe){if(_0x480a9b['changed'](_0x1c24('0xd'))){_0x480a9b[_0x1c24('0xe')]=moment()[_0x1c24('0xf')](_0x1c24('0x10'));}_0x5424fe(null,_0x480a9b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index aa020f7..881bb61 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 _0x5213=['socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','attributes','limit','stringify','catch','AddTagsToOpenchannelInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0x5213,0x1e0));var _0x3521=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x5213[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0x3521('0x0'));var util=require(_0x3521('0x1'));var moment=require(_0x3521('0x2'));var BPromise=require('bluebird');var rs=require(_0x3521('0x3'));var fs=require('fs');var Redis=require(_0x3521('0x4'));var db=require(_0x3521('0x5'))['db'];var utils=require(_0x3521('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3521('0x7'));var jayson=require(_0x3521('0x8'));var client=jayson['client'][_0x3521('0x9')]({'port':0x232a});config[_0x3521('0xa')]=_['defaults'](config[_0x3521('0xa')],{'host':_0x3521('0xb'),'port':0x18eb});var socket=require(_0x3521('0xc'))(new Redis(config['redis']));require(_0x3521('0xd'))[_0x3521('0xe')](socket);function respondWithRpcPromise(_0x6bfda,_0x229379,_0xd8f286){return new BPromise(function(_0x760bbe,_0x116ef7){return client[_0x3521('0xf')](_0x6bfda,_0xd8f286)[_0x3521('0x10')](function(_0x56977f){logger[_0x3521('0x11')](_0x3521('0x12'),_0x229379,_0x3521('0x13'));logger[_0x3521('0x14')](_0x3521('0x15'),_0x229379,_0x3521('0x13'),JSON['stringify'](_0x56977f));if(_0x56977f['error']){if(_0x56977f[_0x3521('0x16')][_0x3521('0x17')]===0x1f4){logger[_0x3521('0x16')](_0x3521('0x12'),_0x229379,_0x56977f[_0x3521('0x16')][_0x3521('0x18')]);return _0x116ef7(_0x56977f['error'][_0x3521('0x18')]);}logger['error'](_0x3521('0x12'),_0x229379,_0x56977f[_0x3521('0x16')][_0x3521('0x18')]);return _0x760bbe(_0x56977f[_0x3521('0x16')]['message']);}else{logger['info'](_0x3521('0x12'),_0x229379,_0x3521('0x13'));_0x760bbe(_0x56977f['result']['message']);}})['catch'](function(_0x29c69a){logger[_0x3521('0x16')](_0x3521('0x12'),_0x229379,_0x29c69a);_0x116ef7(_0x29c69a);});});}exports[_0x3521('0x19')]=function(_0x232619){var _0x1aabec=this;return new Promise(function(_0x369257,_0x18ae33){return db[_0x3521('0x1a')][_0x3521('0x1b')](_0x232619['body'],{'raw':_0x232619[_0x3521('0x1c')]?_0x232619['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x232619[_0x3521('0x1c')]?_0x232619[_0x3521('0x1c')]['where']||null:null,'attributes':_0x232619[_0x3521('0x1c')]?_0x232619[_0x3521('0x1c')][_0x3521('0x1d')]||null:null,'limit':_0x232619['options']?_0x232619['options'][_0x3521('0x1e')]||null:null})[_0x3521('0x10')](function(_0x2ed41f){logger[_0x3521('0x11')]('UpdateOpenchannelInteraction',_0x232619);logger['debug']('UpdateOpenchannelInteraction',_0x232619,JSON[_0x3521('0x1f')](_0x2ed41f));_0x369257(_0x2ed41f);})[_0x3521('0x20')](function(_0x34290f){logger[_0x3521('0x16')](_0x3521('0x19'),_0x34290f[_0x3521('0x18')],_0x232619);_0x18ae33(_0x1aabec['error'](0x1f4,_0x34290f[_0x3521('0x18')]));});});};exports[_0x3521('0x21')]=function(_0xad255c){return new Promise(function(_0x2d15b9,_0x3c9c59){return db[_0x3521('0x1a')][_0x3521('0x22')]({'where':_0xad255c['options']?_0xad255c['options'][_0x3521('0x23')]||null:null})[_0x3521('0x10')](function(_0x4c7fae){if(_0x4c7fae){return _0x4c7fae[_0x3521('0x24')](_0xad255c['body']['ids'],_[_0x3521('0x25')](_0xad255c['body'],[_0x3521('0x26'),'id'])||{});}})[_0x3521('0x27')](function(_0x4cb512){logger['info'](_0x3521('0x28'),_0xad255c);logger[_0x3521('0x14')](_0x3521('0x28'),_0xad255c,JSON[_0x3521('0x1f')](_0x4cb512));_0x2d15b9(_0x4cb512);})[_0x3521('0x20')](function(_0xb2fc49){logger[_0x3521('0x16')](_0x3521('0x28'),_0xb2fc49[_0x3521('0x18')],_0xad255c);_0x3c9c59(_this[_0x3521('0x16')](0x1f4,_0xb2fc49[_0x3521('0x18')]));});});}; \ No newline at end of file +var _0xc6a2=['client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1415d1,_0x562a8c){var _0x10fe08=function(_0x5706f8){while(--_0x5706f8){_0x1415d1['push'](_0x1415d1['shift']());}};_0x10fe08(++_0x562a8c);}(_0xc6a2,0x17d));var _0x2c6a=function(_0x21609e,_0x2dbb7d){_0x21609e=_0x21609e-0x0;var _0x54086d=_0xc6a2[_0x21609e];return _0x54086d;};'use strict';var _=require('lodash');var util=require(_0x2c6a('0x0'));var moment=require(_0x2c6a('0x1'));var BPromise=require(_0x2c6a('0x2'));var rs=require(_0x2c6a('0x3'));var fs=require('fs');var Redis=require(_0x2c6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c6a('0x5'));var logger=require(_0x2c6a('0x6'))('rpc');var config=require(_0x2c6a('0x7'));var jayson=require(_0x2c6a('0x8'));var client=jayson[_0x2c6a('0x9')][_0x2c6a('0xa')]({'port':0x232a});config[_0x2c6a('0xb')]=_[_0x2c6a('0xc')](config[_0x2c6a('0xb')],{'host':_0x2c6a('0xd'),'port':0x18eb});var socket=require(_0x2c6a('0xe'))(new Redis(config[_0x2c6a('0xb')]));require(_0x2c6a('0xf'))['register'](socket);function respondWithRpcPromise(_0x4bb40f,_0x2aa4b3,_0xbf7548){return new BPromise(function(_0x239cce,_0xd3dbb4){return client[_0x2c6a('0x10')](_0x4bb40f,_0xbf7548)['then'](function(_0x39ecfd){logger[_0x2c6a('0x11')](_0x2c6a('0x12'),_0x2aa4b3,_0x2c6a('0x13'));logger[_0x2c6a('0x14')](_0x2c6a('0x15'),_0x2aa4b3,'request\x20sent',JSON[_0x2c6a('0x16')](_0x39ecfd));if(_0x39ecfd[_0x2c6a('0x17')]){if(_0x39ecfd[_0x2c6a('0x17')]['code']===0x1f4){logger[_0x2c6a('0x17')](_0x2c6a('0x12'),_0x2aa4b3,_0x39ecfd[_0x2c6a('0x17')][_0x2c6a('0x18')]);return _0xd3dbb4(_0x39ecfd[_0x2c6a('0x17')]['message']);}logger['error'](_0x2c6a('0x12'),_0x2aa4b3,_0x39ecfd[_0x2c6a('0x17')][_0x2c6a('0x18')]);return _0x239cce(_0x39ecfd['error'][_0x2c6a('0x18')]);}else{logger[_0x2c6a('0x11')](_0x2c6a('0x12'),_0x2aa4b3,'request\x20sent');_0x239cce(_0x39ecfd['result'][_0x2c6a('0x18')]);}})[_0x2c6a('0x19')](function(_0x28b279){logger[_0x2c6a('0x17')](_0x2c6a('0x12'),_0x2aa4b3,_0x28b279);_0xd3dbb4(_0x28b279);});});}exports[_0x2c6a('0x1a')]=function(_0x477fac){var _0x2825bf=this;return new Promise(function(_0xf4f507,_0xfcdfd4){return db[_0x2c6a('0x1b')]['update'](_0x477fac[_0x2c6a('0x1c')],{'raw':_0x477fac[_0x2c6a('0x1d')]?_0x477fac['options'][_0x2c6a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x477fac[_0x2c6a('0x1d')]?_0x477fac[_0x2c6a('0x1d')][_0x2c6a('0x1f')]||null:null,'attributes':_0x477fac['options']?_0x477fac[_0x2c6a('0x1d')][_0x2c6a('0x20')]||null:null,'limit':_0x477fac[_0x2c6a('0x1d')]?_0x477fac[_0x2c6a('0x1d')]['limit']||null:null})['then'](function(_0x1ce6b4){logger[_0x2c6a('0x11')](_0x2c6a('0x1a'),_0x477fac);logger['debug']('UpdateOpenchannelInteraction',_0x477fac,JSON[_0x2c6a('0x16')](_0x1ce6b4));_0xf4f507(_0x1ce6b4);})['catch'](function(_0x137446){logger[_0x2c6a('0x17')]('UpdateOpenchannelInteraction',_0x137446[_0x2c6a('0x18')],_0x477fac);_0xfcdfd4(_0x2825bf[_0x2c6a('0x17')](0x1f4,_0x137446[_0x2c6a('0x18')]));});});};exports[_0x2c6a('0x21')]=function(_0x156299){return new Promise(function(_0x370738,_0xc25538){return db['OpenchannelInteraction'][_0x2c6a('0x22')]({'where':_0x156299['options']?_0x156299[_0x2c6a('0x1d')][_0x2c6a('0x1f')]||null:null})['then'](function(_0x339810){if(_0x339810){return _0x339810[_0x2c6a('0x23')](_0x156299[_0x2c6a('0x1c')][_0x2c6a('0x24')],_[_0x2c6a('0x25')](_0x156299['body'],[_0x2c6a('0x24'),'id'])||{});}})['spread'](function(_0x48fb4b){logger[_0x2c6a('0x11')]('AddTags',_0x156299);logger['debug'](_0x2c6a('0x26'),_0x156299,JSON[_0x2c6a('0x16')](_0x48fb4b));_0x370738(_0x48fb4b);})[_0x2c6a('0x19')](function(_0xc21b8f){logger['error'](_0x2c6a('0x26'),_0xc21b8f[_0x2c6a('0x18')],_0x156299);_0xc25538(_this[_0x2c6a('0x17')](0x1f4,_0xc21b8f[_0x2c6a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 817fcb9..81eb92e 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 _0xb388=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x4e84d3,_0x1add05){var _0x1a0df6=function(_0x7c5212){while(--_0x7c5212){_0x4e84d3['push'](_0x4e84d3['shift']());}};_0x1a0df6(++_0x1add05);}(_0xb388,0x1e6));var _0x8b38=function(_0x45ff97,_0x493b75){_0x45ff97=_0x45ff97-0x0;var _0x18f1ce=_0xb388[_0x45ff97];return _0x18f1ce;};'use strict';var OpenchannelInteractionEvents=require(_0x8b38('0x0'));var events=[_0x8b38('0x1'),_0x8b38('0x2'),_0x8b38('0x3')];function createListener(_0x5aea1d,_0x1dd3e9){return function(_0x24ef19){_0x1dd3e9[_0x8b38('0x4')](_0x5aea1d,_0x24ef19);};}function removeListener(_0x10509f,_0x3a07b4){return function(){OpenchannelInteractionEvents[_0x8b38('0x5')](_0x10509f,_0x3a07b4);};}exports[_0x8b38('0x6')]=function(_0x209177){for(var _0x2fe077=0x0,_0x123efd=events[_0x8b38('0x7')];_0x2fe077<_0x123efd;_0x2fe077++){var _0x99b654=events[_0x2fe077];var _0x538e40=createListener(_0x8b38('0x8')+_0x99b654,_0x209177);OpenchannelInteractionEvents['on'](_0x99b654,_0x538e40);}}; \ No newline at end of file +var _0x254b=['openchannelInteraction:','./openchannelInteraction.events','remove','update'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x254b,0x1c5));var _0xb254=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x254b[_0x340380];return _0x49ce1c;};'use strict';var OpenchannelInteractionEvents=require(_0xb254('0x0'));var events=['save',_0xb254('0x1'),_0xb254('0x2')];function createListener(_0x451b0a,_0x49b256){return function(_0x20575e){_0x49b256['emit'](_0x451b0a,_0x20575e);};}function removeListener(_0x510d3b,_0x3b6cd0){return function(){OpenchannelInteractionEvents['removeListener'](_0x510d3b,_0x3b6cd0);};}exports['register']=function(_0x13f115){for(var _0x32977d=0x0,_0x25d564=events['length'];_0x32977d<_0x25d564;_0x32977d++){var _0x57f780=events[_0x32977d];var _0x21eb35=createListener(_0xb254('0x3')+_0x57f780,_0x13f115);OpenchannelInteractionEvents['on'](_0x57f780,_0x21eb35);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5a30dcc..b34d1f8 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 _0xf9c4=['post','tracked','openchannel','openchannelmessage:create','create','put','/:id/accept','/:id/reject','reject','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf9c4,0x135));var _0x4f9c=function(_0x584bfa,_0x15fccb){_0x584bfa=_0x584bfa-0x0;var _0x3b55a6=_0xf9c4[_0x584bfa];return _0x3b55a6;};'use strict';var multer=require(_0x4f9c('0x0'));var util=require(_0x4f9c('0x1'));var path=require('path');var timeout=require(_0x4f9c('0x2'));var express=require(_0x4f9c('0x3'));var router=express['Router']();var auth=require(_0x4f9c('0x4'));var interaction=require(_0x4f9c('0x5'));var config=require(_0x4f9c('0x6'));var controller=require(_0x4f9c('0x7'));router[_0x4f9c('0x8')]('/',auth[_0x4f9c('0x9')](),controller['index']);router[_0x4f9c('0x8')](_0x4f9c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x4f9c('0x8')](_0x4f9c('0xb'),auth[_0x4f9c('0x9')](),controller[_0x4f9c('0xc')]);router[_0x4f9c('0xd')]('/',auth[_0x4f9c('0x9')](),interaction[_0x4f9c('0xe')](_0x4f9c('0xf'),_0x4f9c('0x10')),controller[_0x4f9c('0x11')]);router[_0x4f9c('0x12')](_0x4f9c('0xb'),auth[_0x4f9c('0x9')](),controller['update']);router[_0x4f9c('0x12')](_0x4f9c('0x13'),auth[_0x4f9c('0x9')](),controller['accept']);router[_0x4f9c('0x12')](_0x4f9c('0x14'),auth[_0x4f9c('0x9')](),controller[_0x4f9c('0x15')]);router['delete'](_0x4f9c('0xb'),auth[_0x4f9c('0x9')](),controller[_0x4f9c('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0dc9=['openchannel','create','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x0dc9,0x171));var _0x90dc=function(_0x2c0557,_0x4314fd){_0x2c0557=_0x2c0557-0x0;var _0x2878cd=_0x0dc9[_0x2c0557];return _0x2878cd;};'use strict';var multer=require(_0x90dc('0x0'));var util=require('util');var path=require(_0x90dc('0x1'));var timeout=require(_0x90dc('0x2'));var express=require('express');var router=express[_0x90dc('0x3')]();var auth=require(_0x90dc('0x4'));var interaction=require(_0x90dc('0x5'));var config=require('../../config/environment');var controller=require(_0x90dc('0x6'));router[_0x90dc('0x7')]('/',auth[_0x90dc('0x8')](),controller['index']);router['get'](_0x90dc('0x9'),auth[_0x90dc('0x8')](),controller[_0x90dc('0xa')]);router[_0x90dc('0x7')](_0x90dc('0xb'),auth[_0x90dc('0x8')](),controller[_0x90dc('0xc')]);router[_0x90dc('0xd')]('/',auth[_0x90dc('0x8')](),interaction[_0x90dc('0xe')](_0x90dc('0xf'),'openchannelmessage:create'),controller[_0x90dc('0x10')]);router[_0x90dc('0x11')](_0x90dc('0xb'),auth[_0x90dc('0x8')](),controller['update']);router[_0x90dc('0x11')]('/:id/accept',auth[_0x90dc('0x8')](),controller[_0x90dc('0x12')]);router[_0x90dc('0x11')](_0x90dc('0x13'),auth[_0x90dc('0x8')](),controller[_0x90dc('0x14')]);router[_0x90dc('0x15')]('/:id',auth[_0x90dc('0x8')](),controller[_0x90dc('0x16')]);module[_0x90dc('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 312115c..850e741 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 _0x6768=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x6768,0xed));var _0x8676=function(_0x568753,_0x1d4c4b){_0x568753=_0x568753-0x0;var _0x1def3f=_0x6768[_0x568753];return _0x1def3f;};'use strict';var Sequelize=require(_0x8676('0x0'));module[_0x8676('0x1')]={'body':{'type':Sequelize[_0x8676('0x2')](_0x8676('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x8676('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8676('0x5')]('in',_0x8676('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8676('0x7')]}}; \ No newline at end of file +var _0x3aa9=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x3caa01,_0x1a8fb9){var _0x472cff=function(_0xd253ed){while(--_0xd253ed){_0x3caa01['push'](_0x3caa01['shift']());}};_0x472cff(++_0x1a8fb9);}(_0x3aa9,0x8c));var _0x93aa=function(_0x433158,_0x290e9c){_0x433158=_0x433158-0x0;var _0x5d4d76=_0x3aa9[_0x433158];return _0x5d4d76;};'use strict';var Sequelize=require('sequelize');module[_0x93aa('0x0')]={'body':{'type':Sequelize[_0x93aa('0x1')](_0x93aa('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x93aa('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x93aa('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x93aa('0x4')]('in',_0x93aa('0x5')),'defaultValue':_0x93aa('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x93aa('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 5442607..f4a9482 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 _0xf8dd=['filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','filter','options','OpenchannelMessage','count','includeAll','include','findAll','rows','show','find','create','body','update','params','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','openchannel-interactions','agent','null','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../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','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query'];(function(_0xdd59a8,_0x53026d){var _0x5dc7ff=function(_0x3c604a){while(--_0x3c604a){_0xdd59a8['push'](_0xdd59a8['shift']());}};_0x5dc7ff(++_0x53026d);}(_0xf8dd,0xb6));var _0xdf8d=function(_0x15b88d,_0x584b99){_0x15b88d=_0x15b88d-0x0;var _0x48d75b=_0xf8dd[_0x15b88d];return _0x48d75b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdf8d('0x0'));var rimraf=require(_0xdf8d('0x1'));var zipdir=require(_0xdf8d('0x2'));var jsonpatch=require(_0xdf8d('0x3'));var rp=require(_0xdf8d('0x4'));var moment=require(_0xdf8d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf8d('0x6'));var util=require('util');var path=require(_0xdf8d('0x7'));var sox=require(_0xdf8d('0x8'));var csv=require(_0xdf8d('0x9'));var ejs=require(_0xdf8d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf8d('0xb'));var crypto=require(_0xdf8d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdf8d('0x9'));var querystring=require(_0xdf8d('0xd'));var Papa=require('papaparse');var Redis=require(_0xdf8d('0xe'));var authService=require(_0xdf8d('0xf'));var qs=require(_0xdf8d('0x10'));var as=require(_0xdf8d('0x11'));var hardwareService=require(_0xdf8d('0x12'));var logger=require('../../config/logger')(_0xdf8d('0x13'));var utils=require(_0xdf8d('0x14'));var config=require(_0xdf8d('0x15'));var db=require(_0xdf8d('0x16'))['db'];config[_0xdf8d('0x17')]=_['defaults'](config[_0xdf8d('0x17')],{'host':_0xdf8d('0x18'),'port':0x18eb});var socket=require(_0xdf8d('0x19'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdf8d('0x1a')][_0xdf8d('0x1b')]({'port':0x232c});var client9002=jayson[_0xdf8d('0x1a')][_0xdf8d('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1e2805,_0x4b0d07,_0x4d1e6e){if(_0x4d1e6e){var _0x49590f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49590f['test'](_0x4b0d07)){return _0x1e2805;}else{throw new db[(_0xdf8d('0x1c'))]['ValidationError'](_0xdf8d('0x1d'));}}else{return _0x1e2805;}}function respondWithRpcPromise(_0x523b04,_0x47c9f9,_0x48568d,_0x346688){return new BPromise(function(_0x20d611,_0x3fe80c){var _0x341b3e=_0x346688||client;return _0x341b3e[_0xdf8d('0x1e')](_0x523b04,_0x48568d)[_0xdf8d('0x1f')](function(_0x32e972){logger[_0xdf8d('0x20')](_0xdf8d('0x21'),_0x47c9f9,_0xdf8d('0x22'));logger[_0xdf8d('0x23')](_0xdf8d('0x24'),_0x47c9f9,'request\x20sent',JSON[_0xdf8d('0x25')](_0x32e972));if(_0x32e972['error']){if(_0x32e972['error'][_0xdf8d('0x26')]===0x1f4){logger['error'](_0xdf8d('0x21'),_0x47c9f9,_0x32e972[_0xdf8d('0x27')][_0xdf8d('0x28')]);return _0x3fe80c(_0x32e972['error'][_0xdf8d('0x28')]);}logger[_0xdf8d('0x27')](_0xdf8d('0x21'),_0x47c9f9,_0x32e972[_0xdf8d('0x27')][_0xdf8d('0x28')]);return _0x20d611(_0x32e972[_0xdf8d('0x27')][_0xdf8d('0x28')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x47c9f9,_0xdf8d('0x22'));_0x20d611(_0x32e972['result'][_0xdf8d('0x28')]);}})[_0xdf8d('0x29')](function(_0x29ec35){logger['error'](_0xdf8d('0x21'),_0x47c9f9,_0x29ec35);_0x3fe80c(_0x29ec35);});});}function respondWithStatusCode(_0xc21b89,_0x78ae4b){_0x78ae4b=_0x78ae4b||0xcc;return function(_0x990200){if(_0x990200){return _0xc21b89[_0xdf8d('0x2a')](_0x78ae4b);}return _0xc21b89[_0xdf8d('0x2b')](_0x78ae4b)[_0xdf8d('0x2c')]();};}function respondWithResult(_0xb25bc3,_0x46ffce){_0x46ffce=_0x46ffce||0xc8;return function(_0x3c32de){if(_0x3c32de){return _0xb25bc3[_0xdf8d('0x2b')](_0x46ffce)['json'](_0x3c32de);}};}function respondWithFilteredResult(_0x5a3fb2,_0x386873){return function(_0x3e0bdf){if(_0x3e0bdf){var _0x15b3be=_0x3e0bdf['count'],_0x27c242=_0x386873['offset'],_0x4f626c=_0x386873[_0xdf8d('0x2d')]+_0x386873['limit'],_0x55d378;if(_0x4f626c>=_0x15b3be){_0x4f626c=_0x15b3be;_0x55d378=0xc8;}else{_0x55d378=0xce;}_0x5a3fb2[_0xdf8d('0x2b')](_0x55d378);return _0x5a3fb2[_0xdf8d('0x2e')](_0xdf8d('0x2f'),_0x27c242+'-'+_0x4f626c+'/'+_0x15b3be)[_0xdf8d('0x30')](_0x3e0bdf);}return null;};}function patchUpdates(_0xe85d7d){return function(_0x34ed7f){try{jsonpatch[_0xdf8d('0x31')](_0x34ed7f,_0xe85d7d,!![]);}catch(_0x12efeb){return BPromise[_0xdf8d('0x32')](_0x12efeb);}return _0x34ed7f[_0xdf8d('0x33')]();};}function saveUpdates(_0x102327,_0x47a042){return function(_0x50126b){if(_0x50126b){return _0x50126b['update'](_0x102327)[_0xdf8d('0x1f')](function(_0x29db48){return _0x29db48;});}return null;};}function removeEntity(_0x3f634b,_0x4b1a38){return function(_0x2208d0){if(_0x2208d0){return _0x2208d0[_0xdf8d('0x34')]()[_0xdf8d('0x1f')](function(){_0x3f634b[_0xdf8d('0x2b')](0xcc)[_0xdf8d('0x2c')]();});}};}function handleEntityNotFound(_0x432971,_0x478d98){return function(_0x54ddcb){if(!_0x54ddcb){_0x432971['sendStatus'](0x194);}return _0x54ddcb;};}function handleError(_0x3b703d,_0x3ae6d2){_0x3ae6d2=_0x3ae6d2||0x1f4;return function(_0x3bb81b){logger['error'](_0x3bb81b[_0xdf8d('0x35')]);if(_0x3bb81b[_0xdf8d('0x36')]){delete _0x3bb81b['name'];}_0x3b703d[_0xdf8d('0x2b')](_0x3ae6d2)[_0xdf8d('0x37')](_0x3bb81b);};}exports[_0xdf8d('0x38')]=function(_0x780fab,_0x324da5){var _0x4a118d={},_0x48217d={},_0x305945={'count':0x0,'rows':[]};var _0x29452c=_[_0xdf8d('0x39')](db['OpenchannelMessage'][_0xdf8d('0x3a')],function(_0x1d8ca1){return{'name':_0x1d8ca1[_0xdf8d('0x3b')],'type':_0x1d8ca1[_0xdf8d('0x3c')]['key']};});_0x48217d[_0xdf8d('0x3d')]=_[_0xdf8d('0x39')](_0x29452c,_0xdf8d('0x36'));_0x48217d['query']=_[_0xdf8d('0x3e')](_0x780fab[_0xdf8d('0x3f')]);_0x48217d[_0xdf8d('0x40')]=_[_0xdf8d('0x41')](_0x48217d[_0xdf8d('0x3d')],_0x48217d[_0xdf8d('0x3f')]);_0x4a118d[_0xdf8d('0x42')]=_[_0xdf8d('0x41')](_0x48217d['model'],qs[_0xdf8d('0x43')](_0x780fab[_0xdf8d('0x3f')]['fields']));_0x4a118d[_0xdf8d('0x42')]=_0x4a118d[_0xdf8d('0x42')][_0xdf8d('0x44')]?_0x4a118d['attributes']:_0x48217d[_0xdf8d('0x3d')];if(!_0x780fab[_0xdf8d('0x3f')]['hasOwnProperty'](_0xdf8d('0x45'))){_0x4a118d[_0xdf8d('0x46')]=qs[_0xdf8d('0x46')](_0x780fab['query']['limit']);_0x4a118d['offset']=qs[_0xdf8d('0x2d')](_0x780fab[_0xdf8d('0x3f')][_0xdf8d('0x2d')]);}_0x4a118d[_0xdf8d('0x47')]=qs[_0xdf8d('0x48')](_0x780fab[_0xdf8d('0x3f')][_0xdf8d('0x48')]);_0x4a118d[_0xdf8d('0x49')]=qs[_0xdf8d('0x40')](_[_0xdf8d('0x4a')](_0x780fab[_0xdf8d('0x3f')],_0x48217d['filters']),_0x29452c);if(_0x780fab['query']['filter']){_0x4a118d[_0xdf8d('0x49')]=_[_0xdf8d('0x4b')](_0x4a118d[_0xdf8d('0x49')],{'$or':_[_0xdf8d('0x39')](_0x29452c,function(_0xcfa165){if(_0xcfa165['type']!=='VIRTUAL'){var _0xd33525={};_0xd33525[_0xcfa165['name']]={'$like':'%'+_0x780fab[_0xdf8d('0x3f')][_0xdf8d('0x4c')]+'%'};return _0xd33525;}})});}_0x4a118d=_['merge']({},_0x4a118d,_0x780fab[_0xdf8d('0x4d')]);var _0x598513={'where':_0x4a118d[_0xdf8d('0x49')]};return db[_0xdf8d('0x4e')][_0xdf8d('0x4f')](_0x598513)[_0xdf8d('0x1f')](function(_0x213289){_0x305945['count']=_0x213289;if(_0x780fab[_0xdf8d('0x3f')][_0xdf8d('0x50')]){_0x4a118d[_0xdf8d('0x51')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xdf8d('0x52')](_0x4a118d);})[_0xdf8d('0x1f')](function(_0x5c1d6b){_0x305945[_0xdf8d('0x53')]=_0x5c1d6b;return _0x305945;})[_0xdf8d('0x1f')](respondWithFilteredResult(_0x324da5,_0x4a118d))[_0xdf8d('0x29')](handleError(_0x324da5,null));};exports[_0xdf8d('0x54')]=function(_0x38c38a,_0x27001d){var _0x2b1dcd={'raw':!![],'where':{'id':_0x38c38a['params']['id']}},_0x2df998={};_0x2df998[_0xdf8d('0x3d')]=_[_0xdf8d('0x3e')](db[_0xdf8d('0x4e')][_0xdf8d('0x3a')]);_0x2df998['query']=_['keys'](_0x38c38a[_0xdf8d('0x3f')]);_0x2df998[_0xdf8d('0x40')]=_[_0xdf8d('0x41')](_0x2df998['model'],_0x2df998[_0xdf8d('0x3f')]);_0x2b1dcd[_0xdf8d('0x42')]=_[_0xdf8d('0x41')](_0x2df998[_0xdf8d('0x3d')],qs['fields'](_0x38c38a[_0xdf8d('0x3f')][_0xdf8d('0x43')]));_0x2b1dcd[_0xdf8d('0x42')]=_0x2b1dcd[_0xdf8d('0x42')][_0xdf8d('0x44')]?_0x2b1dcd[_0xdf8d('0x42')]:_0x2df998[_0xdf8d('0x3d')];if(_0x38c38a['query'][_0xdf8d('0x50')]){_0x2b1dcd[_0xdf8d('0x51')]=[{'all':!![]}];}_0x2b1dcd=_[_0xdf8d('0x4b')]({},_0x2b1dcd,_0x38c38a[_0xdf8d('0x4d')]);return db[_0xdf8d('0x4e')][_0xdf8d('0x55')](_0x2b1dcd)[_0xdf8d('0x1f')](handleEntityNotFound(_0x27001d,null))[_0xdf8d('0x1f')](respondWithResult(_0x27001d,null))['catch'](handleError(_0x27001d,null));};exports[_0xdf8d('0x56')]=function(_0xd71a09,_0x1b1fc6){return db[_0xdf8d('0x4e')]['create'](_0xd71a09[_0xdf8d('0x57')],{})['then'](respondWithResult(_0x1b1fc6,0xc9))['catch'](handleError(_0x1b1fc6,null));};exports[_0xdf8d('0x58')]=function(_0x464565,_0x3cd401){if(_0x464565[_0xdf8d('0x57')]['id']){delete _0x464565[_0xdf8d('0x57')]['id'];}return db[_0xdf8d('0x4e')]['find']({'where':{'id':_0x464565['params']['id']}})[_0xdf8d('0x1f')](handleEntityNotFound(_0x3cd401,null))[_0xdf8d('0x1f')](saveUpdates(_0x464565[_0xdf8d('0x57')],null))[_0xdf8d('0x1f')](respondWithResult(_0x3cd401,null))[_0xdf8d('0x29')](handleError(_0x3cd401,null));};exports[_0xdf8d('0x34')]=function(_0x201cbf,_0x49138b){return db[_0xdf8d('0x4e')][_0xdf8d('0x55')]({'where':{'id':_0x201cbf[_0xdf8d('0x59')]['id']}})[_0xdf8d('0x1f')](handleEntityNotFound(_0x49138b,null))[_0xdf8d('0x1f')](removeEntity(_0x49138b,null))['catch'](handleError(_0x49138b,null));};exports['describe']=function(_0xa9bf5e,_0x2ada83){return db[_0xdf8d('0x4e')][_0xdf8d('0x5a')]()[_0xdf8d('0x1f')](respondWithResult(_0x2ada83,null))[_0xdf8d('0x29')](handleError(_0x2ada83,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xdf8d('0x5b')]=function(_0x2692ed,_0x346f21,_0x3b597e){var _0x47c389={'channel':_0xdf8d('0x5c')};if(_0x2692ed[_0xdf8d('0x57')]['id']){delete _0x2692ed[_0xdf8d('0x57')]['id'];}_0x2692ed[_0xdf8d('0x57')][_0xdf8d('0x5d')]=!![];_0x2692ed[_0xdf8d('0x57')][_0xdf8d('0x5e')]=moment()[_0xdf8d('0x5f')](_0xdf8d('0x60'));_0x2692ed[_0xdf8d('0x57')][_0xdf8d('0x61')]=_0x2692ed['body'][_0xdf8d('0x61')]||_0x2692ed[_0xdf8d('0x62')]['id'];return db[_0xdf8d('0x4e')][_0xdf8d('0x55')]({'where':{'id':_0x2692ed['params']['id'],'UserId':null},'include':[{'model':db[_0xdf8d('0x63')],'as':'Contact'}]})[_0xdf8d('0x1f')](handleEntityNotFound(_0x346f21,null))['then'](saveUpdates(_0x2692ed[_0xdf8d('0x57')],null))[_0xdf8d('0x1f')](function(_0x576f2d){if(_0x576f2d){_0x47c389[_0xdf8d('0x28')]=_0x576f2d[_0xdf8d('0x64')]({'plain':!![]});return db[_0xdf8d('0x65')][_0xdf8d('0x55')]({'where':{'id':_0x576f2d[_0xdf8d('0x66')]}});}return null;})[_0xdf8d('0x1f')](handleEntityNotFound(_0x346f21,null))[_0xdf8d('0x1f')](function(_0x4e093f){if(_0x4e093f){return _0x4e093f[_0xdf8d('0x58')]({'UserId':_0x2692ed[_0xdf8d('0x57')][_0xdf8d('0x61')],'read1stAt':_[_0xdf8d('0x67')](_0x4e093f[_0xdf8d('0x68')])?moment()['format'](_0xdf8d('0x60')):undefined});}return null;})[_0xdf8d('0x1f')](function(_0x98af21){if(_0x98af21){_0x47c389['interaction']=_0x98af21[_0xdf8d('0x64')]({'plain':!![]});interaction_log[_0xdf8d('0x20')](_0xdf8d('0x69'),_0x2692ed[_0xdf8d('0x62')]['id'],_0x2692ed['user']['name'],_0x2692ed['user'][_0xdf8d('0x6a')],_0x47c389[_0xdf8d('0x6b')]['id'],_0x2692ed['body']?JSON[_0xdf8d('0x25')](_0x2692ed[_0xdf8d('0x57')]):'null');return respondWithRpcPromise('AcceptMessage',_0xdf8d('0x6c'),_0x47c389);}return null;})[_0xdf8d('0x1f')](function(_0x5f2189){if(_0x5f2189){if(_0x2692ed[_0xdf8d('0x57')][_0xdf8d('0x6d')]){_0x47c389['message'][_0xdf8d('0x6e')]=util[_0xdf8d('0x5f')](_0xdf8d('0x6f'),_0x2692ed[_0xdf8d('0x62')][_0xdf8d('0x36')]);_0x47c389['message'][_0xdf8d('0x70')]=_0x47c389[_0xdf8d('0x70')];_0x47c389[_0xdf8d('0x28')][_0xdf8d('0x71')]=_0xdf8d('0x5b');return respondWithRpcPromise('EventManager',_0xdf8d('0x72'),{'event':_0xdf8d('0x73'),'message':_0x47c389[_0xdf8d('0x28')]},client9002)[_0xdf8d('0x1f')](function(){return _0x47c389;});}return _0x47c389;}return null;})[_0xdf8d('0x1f')](respondWithResult(_0x346f21,null))[_0xdf8d('0x29')](handleError(_0x346f21,null));};var interaction_log=require(_0xdf8d('0x74'))(_0xdf8d('0x75'));exports[_0xdf8d('0x32')]=function(_0x514be6,_0x47e866,_0x4e9907){var _0x3b7638={'agent':{},'channel':_0xdf8d('0x5c')};if(_0x514be6[_0xdf8d('0x57')]['id']){delete _0x514be6['body']['id'];}_0x514be6['body'][_0xdf8d('0x61')]=_0x514be6[_0xdf8d('0x57')][_0xdf8d('0x61')]||_0x514be6[_0xdf8d('0x62')]['id'];_0x3b7638[_0xdf8d('0x76')]['id']=_0x514be6[_0xdf8d('0x57')][_0xdf8d('0x61')];return db['OpenchannelMessage']['find']({'where':{'id':_0x514be6[_0xdf8d('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x47e866,null))[_0xdf8d('0x1f')](function(_0x28dfdb){if(_0x28dfdb){_0x3b7638['message']=_0x28dfdb[_0xdf8d('0x64')]({'plain':!![]});return db[_0xdf8d('0x65')][_0xdf8d('0x55')]({'where':{'id':_0x28dfdb[_0xdf8d('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x47e866,null))[_0xdf8d('0x1f')](function(_0x5f551a){if(_0x5f551a){_0x3b7638[_0xdf8d('0x6b')]=_0x5f551a[_0xdf8d('0x64')]({'plain':!![]});interaction_log[_0xdf8d('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x514be6[_0xdf8d('0x62')]['id'],_0x514be6['user'][_0xdf8d('0x36')],_0x514be6[_0xdf8d('0x62')]['role'],_0x3b7638[_0xdf8d('0x6b')]['id'],_0x514be6[_0xdf8d('0x57')]?JSON['stringify'](_0x514be6[_0xdf8d('0x57')]):_0xdf8d('0x77'));return respondWithRpcPromise(_0xdf8d('0x78'),_0xdf8d('0x79'),_0x3b7638);}return null;})[_0xdf8d('0x1f')](function(_0x3bf057){if(_0x3bf057){_0x3bf057['message'][_0xdf8d('0x6e')]=util['format'](_0xdf8d('0x6f'),_0x514be6[_0xdf8d('0x62')]['name']);_0x3bf057['message'][_0xdf8d('0x70')]=_0x3b7638[_0xdf8d('0x70')];_0x3bf057[_0xdf8d('0x28')]['event']=_0xdf8d('0x32');respondWithRpcPromise(_0xdf8d('0x72'),_0xdf8d('0x72'),{'event':_0xdf8d('0x7a'),'message':_0x3bf057[_0xdf8d('0x28')]},client9002);return _0x3b7638;}return null;})[_0xdf8d('0x1f')](respondWithResult(_0x47e866,null))[_0xdf8d('0x29')](handleError(_0x47e866,null));}; \ No newline at end of file +var _0x88a4=['request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','./openchannelMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','json','count','offset','Content-Range','then','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','includeAll','options','create','body','update','find','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','openchannel','RejectMessage','rejectMessage','interface','reject','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x88a4,0x16d));var _0x488a=function(_0x5ed57e,_0x3c06ed){_0x5ed57e=_0x5ed57e-0x0;var _0x585b56=_0x88a4[_0x5ed57e];return _0x585b56;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x488a('0x0'));var rimraf=require(_0x488a('0x1'));var zipdir=require(_0x488a('0x2'));var jsonpatch=require(_0x488a('0x3'));var rp=require(_0x488a('0x4'));var moment=require('moment');var BPromise=require(_0x488a('0x5'));var Mustache=require(_0x488a('0x6'));var util=require(_0x488a('0x7'));var path=require(_0x488a('0x8'));var sox=require(_0x488a('0x9'));var csv=require('to-csv');var ejs=require(_0x488a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x488a('0xb'));var crypto=require(_0x488a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x488a('0xd'));var querystring=require(_0x488a('0xe'));var Papa=require(_0x488a('0xf'));var Redis=require(_0x488a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x488a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x488a('0x12'));var logger=require(_0x488a('0x13'))(_0x488a('0x14'));var utils=require(_0x488a('0x15'));var config=require(_0x488a('0x16'));var db=require('../../mysqldb')['db'];config[_0x488a('0x17')]=_['defaults'](config[_0x488a('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x488a('0x17')]));require(_0x488a('0x18'))[_0x488a('0x19')](socket);var jayson=require(_0x488a('0x1a'));var client=jayson[_0x488a('0x1b')][_0x488a('0x1c')]({'port':0x232c});var client9002=jayson[_0x488a('0x1b')][_0x488a('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2484e9,_0x2fc696,_0x41634f){if(_0x41634f){var _0x20e01e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20e01e[_0x488a('0x1d')](_0x2fc696)){return _0x2484e9;}else{throw new db[(_0x488a('0x1e'))][(_0x488a('0x1f'))](_0x488a('0x20'));}}else{return _0x2484e9;}}function respondWithRpcPromise(_0x446853,_0x1179ee,_0x26f47f,_0x42bf39){return new BPromise(function(_0x529fbc,_0x36dc44){var _0x4d9308=_0x42bf39||client;return _0x4d9308[_0x488a('0x21')](_0x446853,_0x26f47f)['then'](function(_0x4dd4ce){logger[_0x488a('0x22')](_0x488a('0x23'),_0x1179ee,_0x488a('0x24'));logger[_0x488a('0x25')](_0x488a('0x26'),_0x1179ee,_0x488a('0x24'),JSON[_0x488a('0x27')](_0x4dd4ce));if(_0x4dd4ce['error']){if(_0x4dd4ce['error'][_0x488a('0x28')]===0x1f4){logger[_0x488a('0x29')](_0x488a('0x23'),_0x1179ee,_0x4dd4ce[_0x488a('0x29')]['message']);return _0x36dc44(_0x4dd4ce[_0x488a('0x29')][_0x488a('0x2a')]);}logger[_0x488a('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x1179ee,_0x4dd4ce[_0x488a('0x29')][_0x488a('0x2a')]);return _0x529fbc(_0x4dd4ce[_0x488a('0x29')]['message']);}else{logger[_0x488a('0x22')](_0x488a('0x23'),_0x1179ee,_0x488a('0x24'));_0x529fbc(_0x4dd4ce[_0x488a('0x2b')]['message']);}})[_0x488a('0x2c')](function(_0x2f7bf6){logger[_0x488a('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x1179ee,_0x2f7bf6);_0x36dc44(_0x2f7bf6);});});}function respondWithStatusCode(_0x4ce913,_0x2eeb92){_0x2eeb92=_0x2eeb92||0xcc;return function(_0x3dc5a3){if(_0x3dc5a3){return _0x4ce913['sendStatus'](_0x2eeb92);}return _0x4ce913[_0x488a('0x2d')](_0x2eeb92)['end']();};}function respondWithResult(_0x2e4cc6,_0x4a8676){_0x4a8676=_0x4a8676||0xc8;return function(_0x23ca7c){if(_0x23ca7c){return _0x2e4cc6[_0x488a('0x2d')](_0x4a8676)[_0x488a('0x2e')](_0x23ca7c);}};}function respondWithFilteredResult(_0x46d512,_0x1d2f03){return function(_0x315520){if(_0x315520){var _0x283c27=_0x315520[_0x488a('0x2f')],_0x4ad2b4=_0x1d2f03[_0x488a('0x30')],_0x23e0b4=_0x1d2f03['offset']+_0x1d2f03['limit'],_0x4990a8;if(_0x23e0b4>=_0x283c27){_0x23e0b4=_0x283c27;_0x4990a8=0xc8;}else{_0x4990a8=0xce;}_0x46d512['status'](_0x4990a8);return _0x46d512['set'](_0x488a('0x31'),_0x4ad2b4+'-'+_0x23e0b4+'/'+_0x283c27)[_0x488a('0x2e')](_0x315520);}return null;};}function patchUpdates(_0x2e5e7a){return function(_0x56267f){try{jsonpatch['apply'](_0x56267f,_0x2e5e7a,!![]);}catch(_0x190b9c){return BPromise['reject'](_0x190b9c);}return _0x56267f['save']();};}function saveUpdates(_0x29c91d,_0x32df3d){return function(_0x3be672){if(_0x3be672){return _0x3be672['update'](_0x29c91d)[_0x488a('0x32')](function(_0x46b876){return _0x46b876;});}return null;};}function removeEntity(_0x241294,_0x1684f5){return function(_0xdb3fd9){if(_0xdb3fd9){return _0xdb3fd9[_0x488a('0x33')]()['then'](function(){_0x241294[_0x488a('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ab702,_0xfc1808){return function(_0x277009){if(!_0x277009){_0x5ab702[_0x488a('0x34')](0x194);}return _0x277009;};}function handleError(_0x171fe4,_0x4e2f02){_0x4e2f02=_0x4e2f02||0x1f4;return function(_0x311247){logger[_0x488a('0x29')](_0x311247[_0x488a('0x35')]);if(_0x311247[_0x488a('0x36')]){delete _0x311247[_0x488a('0x36')];}_0x171fe4[_0x488a('0x2d')](_0x4e2f02)[_0x488a('0x37')](_0x311247);};}exports[_0x488a('0x38')]=function(_0x12ea7c,_0x262009){var _0x45a8f9={},_0x23c2b0={},_0x2b56cb={'count':0x0,'rows':[]};var _0x22f5cf=_[_0x488a('0x39')](db[_0x488a('0x3a')][_0x488a('0x3b')],function(_0x41410f){return{'name':_0x41410f[_0x488a('0x3c')],'type':_0x41410f['type'][_0x488a('0x3d')]};});_0x23c2b0['model']=_[_0x488a('0x39')](_0x22f5cf,_0x488a('0x36'));_0x23c2b0['query']=_[_0x488a('0x3e')](_0x12ea7c[_0x488a('0x3f')]);_0x23c2b0[_0x488a('0x40')]=_[_0x488a('0x41')](_0x23c2b0[_0x488a('0x42')],_0x23c2b0[_0x488a('0x3f')]);_0x45a8f9[_0x488a('0x43')]=_['intersection'](_0x23c2b0['model'],qs[_0x488a('0x44')](_0x12ea7c[_0x488a('0x3f')][_0x488a('0x44')]));_0x45a8f9[_0x488a('0x43')]=_0x45a8f9[_0x488a('0x43')]['length']?_0x45a8f9[_0x488a('0x43')]:_0x23c2b0['model'];if(!_0x12ea7c[_0x488a('0x3f')][_0x488a('0x45')](_0x488a('0x46'))){_0x45a8f9[_0x488a('0x47')]=qs[_0x488a('0x47')](_0x12ea7c[_0x488a('0x3f')][_0x488a('0x47')]);_0x45a8f9['offset']=qs[_0x488a('0x30')](_0x12ea7c['query']['offset']);}_0x45a8f9[_0x488a('0x48')]=qs[_0x488a('0x49')](_0x12ea7c[_0x488a('0x3f')][_0x488a('0x49')]);_0x45a8f9[_0x488a('0x4a')]=qs[_0x488a('0x40')](_[_0x488a('0x4b')](_0x12ea7c[_0x488a('0x3f')],_0x23c2b0['filters']),_0x22f5cf);if(_0x12ea7c[_0x488a('0x3f')][_0x488a('0x4c')]){_0x45a8f9[_0x488a('0x4a')]=_[_0x488a('0x4d')](_0x45a8f9[_0x488a('0x4a')],{'$or':_['map'](_0x22f5cf,function(_0x5391b1){if(_0x5391b1[_0x488a('0x4e')]!==_0x488a('0x4f')){var _0x3428ee={};_0x3428ee[_0x5391b1[_0x488a('0x36')]]={'$like':'%'+_0x12ea7c[_0x488a('0x3f')][_0x488a('0x4c')]+'%'};return _0x3428ee;}})});}_0x45a8f9=_['merge']({},_0x45a8f9,_0x12ea7c['options']);var _0x41a89d={'where':_0x45a8f9[_0x488a('0x4a')]};return db[_0x488a('0x3a')]['count'](_0x41a89d)[_0x488a('0x32')](function(_0x3f9e36){_0x2b56cb[_0x488a('0x2f')]=_0x3f9e36;if(_0x12ea7c[_0x488a('0x3f')]['includeAll']){_0x45a8f9[_0x488a('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x488a('0x51')](_0x45a8f9);})[_0x488a('0x32')](function(_0x1ac053){_0x2b56cb[_0x488a('0x52')]=_0x1ac053;return _0x2b56cb;})[_0x488a('0x32')](respondWithFilteredResult(_0x262009,_0x45a8f9))[_0x488a('0x2c')](handleError(_0x262009,null));};exports[_0x488a('0x53')]=function(_0xcb530a,_0x3bef2f){var _0x325f70={'raw':!![],'where':{'id':_0xcb530a[_0x488a('0x54')]['id']}},_0x2e70f9={};_0x2e70f9[_0x488a('0x42')]=_[_0x488a('0x3e')](db['OpenchannelMessage'][_0x488a('0x3b')]);_0x2e70f9[_0x488a('0x3f')]=_['keys'](_0xcb530a[_0x488a('0x3f')]);_0x2e70f9['filters']=_[_0x488a('0x41')](_0x2e70f9['model'],_0x2e70f9[_0x488a('0x3f')]);_0x325f70['attributes']=_[_0x488a('0x41')](_0x2e70f9['model'],qs[_0x488a('0x44')](_0xcb530a[_0x488a('0x3f')][_0x488a('0x44')]));_0x325f70[_0x488a('0x43')]=_0x325f70[_0x488a('0x43')]['length']?_0x325f70[_0x488a('0x43')]:_0x2e70f9[_0x488a('0x42')];if(_0xcb530a[_0x488a('0x3f')][_0x488a('0x55')]){_0x325f70[_0x488a('0x50')]=[{'all':!![]}];}_0x325f70=_[_0x488a('0x4d')]({},_0x325f70,_0xcb530a[_0x488a('0x56')]);return db[_0x488a('0x3a')]['find'](_0x325f70)['then'](handleEntityNotFound(_0x3bef2f,null))[_0x488a('0x32')](respondWithResult(_0x3bef2f,null))[_0x488a('0x2c')](handleError(_0x3bef2f,null));};exports['create']=function(_0x41de01,_0x3b72f4){return db[_0x488a('0x3a')][_0x488a('0x57')](_0x41de01[_0x488a('0x58')],{})[_0x488a('0x32')](respondWithResult(_0x3b72f4,0xc9))[_0x488a('0x2c')](handleError(_0x3b72f4,null));};exports[_0x488a('0x59')]=function(_0x1f9e96,_0x38ad0c){if(_0x1f9e96[_0x488a('0x58')]['id']){delete _0x1f9e96['body']['id'];}return db['OpenchannelMessage'][_0x488a('0x5a')]({'where':{'id':_0x1f9e96[_0x488a('0x54')]['id']}})[_0x488a('0x32')](handleEntityNotFound(_0x38ad0c,null))['then'](saveUpdates(_0x1f9e96[_0x488a('0x58')],null))[_0x488a('0x32')](respondWithResult(_0x38ad0c,null))[_0x488a('0x2c')](handleError(_0x38ad0c,null));};exports[_0x488a('0x33')]=function(_0x327857,_0x477f71){return db[_0x488a('0x3a')][_0x488a('0x5a')]({'where':{'id':_0x327857[_0x488a('0x54')]['id']}})[_0x488a('0x32')](handleEntityNotFound(_0x477f71,null))[_0x488a('0x32')](removeEntity(_0x477f71,null))[_0x488a('0x2c')](handleError(_0x477f71,null));};exports[_0x488a('0x5b')]=function(_0x28076d,_0x15c9b3){return db[_0x488a('0x3a')][_0x488a('0x5b')]()[_0x488a('0x32')](respondWithResult(_0x15c9b3,null))['catch'](handleError(_0x15c9b3,null));};var interaction_log=require(_0x488a('0x13'))(_0x488a('0x5c'));exports[_0x488a('0x5d')]=function(_0x2ab4d2,_0x318bac,_0x5e0877){var _0x4e7b4c={'channel':'openchannel'};if(_0x2ab4d2[_0x488a('0x58')]['id']){delete _0x2ab4d2[_0x488a('0x58')]['id'];}_0x2ab4d2[_0x488a('0x58')][_0x488a('0x5e')]=!![];_0x2ab4d2[_0x488a('0x58')][_0x488a('0x5f')]=moment()[_0x488a('0x60')](_0x488a('0x61'));_0x2ab4d2[_0x488a('0x58')][_0x488a('0x62')]=_0x2ab4d2[_0x488a('0x58')][_0x488a('0x62')]||_0x2ab4d2[_0x488a('0x63')]['id'];return db[_0x488a('0x3a')][_0x488a('0x5a')]({'where':{'id':_0x2ab4d2[_0x488a('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x488a('0x64')],'as':_0x488a('0x65')}]})[_0x488a('0x32')](handleEntityNotFound(_0x318bac,null))[_0x488a('0x32')](saveUpdates(_0x2ab4d2['body'],null))[_0x488a('0x32')](function(_0x3c34ad){if(_0x3c34ad){_0x4e7b4c[_0x488a('0x2a')]=_0x3c34ad['get']({'plain':!![]});return db[_0x488a('0x66')][_0x488a('0x5a')]({'where':{'id':_0x3c34ad[_0x488a('0x67')]}});}return null;})[_0x488a('0x32')](handleEntityNotFound(_0x318bac,null))[_0x488a('0x32')](function(_0x5f11e4){if(_0x5f11e4){return _0x5f11e4['update']({'UserId':_0x2ab4d2[_0x488a('0x58')][_0x488a('0x62')],'read1stAt':_[_0x488a('0x68')](_0x5f11e4[_0x488a('0x69')])?moment()['format'](_0x488a('0x61')):undefined});}return null;})[_0x488a('0x32')](function(_0x325405){if(_0x325405){_0x4e7b4c[_0x488a('0x6a')]=_0x325405[_0x488a('0x6b')]({'plain':!![]});interaction_log[_0x488a('0x22')](_0x488a('0x6c'),_0x2ab4d2[_0x488a('0x63')]['id'],_0x2ab4d2['user'][_0x488a('0x36')],_0x2ab4d2[_0x488a('0x63')][_0x488a('0x6d')],_0x4e7b4c[_0x488a('0x6a')]['id'],_0x2ab4d2[_0x488a('0x58')]?JSON[_0x488a('0x27')](_0x2ab4d2[_0x488a('0x58')]):'null');return respondWithRpcPromise(_0x488a('0x6e'),_0x488a('0x6f'),_0x4e7b4c);}return null;})[_0x488a('0x32')](function(_0x4e78cc){if(_0x4e78cc){if(_0x2ab4d2['body'][_0x488a('0x70')]){_0x4e7b4c[_0x488a('0x2a')]['interface']=util[_0x488a('0x60')](_0x488a('0x71'),_0x2ab4d2[_0x488a('0x63')][_0x488a('0x36')]);_0x4e7b4c['message'][_0x488a('0x72')]=_0x4e7b4c[_0x488a('0x72')];_0x4e7b4c[_0x488a('0x2a')][_0x488a('0x73')]=_0x488a('0x5d');return respondWithRpcPromise('EventManager',_0x488a('0x74'),{'event':'acceptmessage','message':_0x4e7b4c[_0x488a('0x2a')]},client9002)['then'](function(){return _0x4e7b4c;});}return _0x4e7b4c;}return null;})[_0x488a('0x32')](respondWithResult(_0x318bac,null))[_0x488a('0x2c')](handleError(_0x318bac,null));};var interaction_log=require(_0x488a('0x13'))('openchannel-interactions');exports['reject']=function(_0x2b49a6,_0x323533,_0x58e1e0){var _0x5c065e={'agent':{},'channel':_0x488a('0x75')};if(_0x2b49a6['body']['id']){delete _0x2b49a6[_0x488a('0x58')]['id'];}_0x2b49a6[_0x488a('0x58')][_0x488a('0x62')]=_0x2b49a6['body'][_0x488a('0x62')]||_0x2b49a6[_0x488a('0x63')]['id'];_0x5c065e['agent']['id']=_0x2b49a6[_0x488a('0x58')][_0x488a('0x62')];return db[_0x488a('0x3a')][_0x488a('0x5a')]({'where':{'id':_0x2b49a6[_0x488a('0x54')]['id'],'UserId':null}})[_0x488a('0x32')](handleEntityNotFound(_0x323533,null))[_0x488a('0x32')](function(_0x367bbd){if(_0x367bbd){_0x5c065e[_0x488a('0x2a')]=_0x367bbd[_0x488a('0x6b')]({'plain':!![]});return db[_0x488a('0x66')][_0x488a('0x5a')]({'where':{'id':_0x367bbd[_0x488a('0x67')]}});}return null;})[_0x488a('0x32')](handleEntityNotFound(_0x323533,null))[_0x488a('0x32')](function(_0x5cfe94){if(_0x5cfe94){_0x5c065e[_0x488a('0x6a')]=_0x5cfe94[_0x488a('0x6b')]({'plain':!![]});interaction_log[_0x488a('0x22')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b49a6[_0x488a('0x63')]['id'],_0x2b49a6[_0x488a('0x63')][_0x488a('0x36')],_0x2b49a6['user'][_0x488a('0x6d')],_0x5c065e[_0x488a('0x6a')]['id'],_0x2b49a6['body']?JSON[_0x488a('0x27')](_0x2b49a6[_0x488a('0x58')]):'null');return respondWithRpcPromise(_0x488a('0x76'),_0x488a('0x77'),_0x5c065e);}return null;})['then'](function(_0x530a14){if(_0x530a14){_0x530a14['message'][_0x488a('0x78')]=util[_0x488a('0x60')](_0x488a('0x71'),_0x2b49a6[_0x488a('0x63')][_0x488a('0x36')]);_0x530a14['message'][_0x488a('0x72')]=_0x5c065e[_0x488a('0x72')];_0x530a14[_0x488a('0x2a')][_0x488a('0x73')]=_0x488a('0x79');respondWithRpcPromise(_0x488a('0x74'),_0x488a('0x74'),{'event':_0x488a('0x7a'),'message':_0x530a14[_0x488a('0x2a')]},client9002);return _0x5c065e;}return null;})[_0x488a('0x32')](respondWithResult(_0x323533,null))['catch'](handleError(_0x323533,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 041308d..fc15bd8 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 _0x718e=['hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x120610,_0x5b42ad){var _0x3e8ef4=function(_0x4a76c3){while(--_0x4a76c3){_0x120610['push'](_0x120610['shift']());}};_0x3e8ef4(++_0x5b42ad);}(_0x718e,0x161));var _0xe718=function(_0x1c5385,_0x3aba1a){_0x1c5385=_0x1c5385-0x0;var _0x478ddb=_0x718e[_0x1c5385];return _0x478ddb;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xe718('0x0'))['db'][_0xe718('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe718('0x2')](0x0);var events={'afterCreate':_0xe718('0x3'),'afterUpdate':'update','afterDestroy':_0xe718('0x4')};function emitEvent(_0x895618){return function(_0x35ac13,_0xfa1c18,_0x3cd868){OpenchannelMessageEvents['emit'](_0x895618+':'+_0x35ac13['id'],_0x35ac13);OpenchannelMessageEvents[_0xe718('0x5')](_0x895618,_0x35ac13);_0x3cd868(null);};}for(var e in events){if(events[_0xe718('0x6')](e)){var event=events[e];OpenchannelMessage[_0xe718('0x7')](e,emitEvent(event));}}module[_0xe718('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xba71=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x2ceda4,_0x462c41){var _0x59dd69=function(_0x4ec94d){while(--_0x4ec94d){_0x2ceda4['push'](_0x2ceda4['shift']());}};_0x59dd69(++_0x462c41);}(_0xba71,0xe6));var _0x1ba7=function(_0x252fec,_0x21dfd6){_0x252fec=_0x252fec-0x0;var _0x1b3256=_0xba71[_0x252fec];return _0x1b3256;};'use strict';var EventEmitter=require(_0x1ba7('0x0'));var OpenchannelMessage=require(_0x1ba7('0x1'))['db'][_0x1ba7('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1ba7('0x3')](0x0);var events={'afterCreate':_0x1ba7('0x4'),'afterUpdate':'update','afterDestroy':_0x1ba7('0x5')};function emitEvent(_0x15aeca){return function(_0x3eb99f,_0x29847b,_0x1016c2){OpenchannelMessageEvents['emit'](_0x15aeca+':'+_0x3eb99f['id'],_0x3eb99f);OpenchannelMessageEvents[_0x1ba7('0x6')](_0x15aeca,_0x3eb99f);_0x1016c2(null);};}for(var e in events){if(events[_0x1ba7('0x7')](e)){var event=events[e];OpenchannelMessage[_0x1ba7('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index ddfb696..b712e19 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 _0xbbb8=['then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','keys','get','info','afterCreate','format','replyUri','length','Interaction','Contact','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x4279a3,_0x28d10a){_0x4279a3=_0x4279a3-0x0;var _0x3b814f=_0xbbb8[_0x4279a3];return _0x3b814f;};'use strict';var _=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var logger=require('../../config/logger')(_0x8bbb('0x2'));var moment=require(_0x8bbb('0x3'));var BPromise=require('bluebird');var rp=require(_0x8bbb('0x4'));var fs=require('fs');var path=require(_0x8bbb('0x5'));var rimraf=require(_0x8bbb('0x6'));var config=require(_0x8bbb('0x7'));var attributes=require(_0x8bbb('0x8'));module[_0x8bbb('0x9')]=function(_0x2608b6,_0x3424eb){return _0x2608b6[_0x8bbb('0xa')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x8bbb('0xb')],'type':_0x8bbb('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x217137,_0x3a6ced,_0x95e93a){var _0x45e1bd=_0x2608b6[_0x8bbb('0xd')];var _0x3f571f=_0x217137['get']({'plain':!![]});if(_0x3f571f[_0x8bbb('0xe')][_0x8bbb('0xf')]()==='in'||_0x3f571f[_0x8bbb('0xe')]['toLowerCase']()===_0x8bbb('0x10')&&!_0x3f571f[_0x8bbb('0x11')]&&!_[_0x8bbb('0x12')](_0x3f571f['UserId'])){_0x45e1bd[_0x8bbb('0x13')][_0x8bbb('0x14')]({'where':{'id':_0x3f571f[_0x8bbb('0x15')]}})[_0x8bbb('0x16')](function(_0x5e08e4){if(_0x5e08e4){_0x5e08e4[_0x8bbb('0x17')]({'lastMsgAt':_0x3f571f[_0x8bbb('0x18')],'lastMsgDirection':_0x3f571f['direction'][_0x8bbb('0xf')]()});}})[_0x8bbb('0x19')](function(_0x3ac726){console[_0x8bbb('0x1a')](_0x3ac726);});}if(_0x3f571f[_0x8bbb('0xe')]===_0x8bbb('0x10')&&!_0x3f571f[_0x8bbb('0x11')]){var _0x15643c;_0x45e1bd[_0x8bbb('0x1b')][_0x8bbb('0x1c')]()[_0x8bbb('0x16')](function(_0x2c2cd4){return _0x45e1bd[_0x8bbb('0x1d')]['find']({'where':{'id':_0x3f571f[_0x8bbb('0x1e')]},'include':[{'model':_0x45e1bd[_0x8bbb('0x13')],'as':_0x8bbb('0x1f'),'where':{'id':_0x3f571f[_0x8bbb('0x15')]},'limit':0x1,'include':[{'model':_0x45e1bd[_0x8bbb('0x1b')],'as':'Contact','attributes':_[_0x8bbb('0x20')](_0x2c2cd4)}]}]});})['then'](function(_0x4eab60){_0x15643c=_0x4eab60[_0x8bbb('0x21')]({'plain':!![]});if(_0x15643c&&_0x15643c['replyUri']){logger[_0x8bbb('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x8bbb('0x23'),util[_0x8bbb('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x3f571f['id'],_0x15643c[_0x8bbb('0x25')]));if(_0x15643c[_0x8bbb('0x1f')]&&_0x15643c['Interactions'][_0x8bbb('0x26')]){_0x3f571f[_0x8bbb('0x27')]=_['omit'](_0x15643c[_0x8bbb('0x1f')][0x0],'Contact');_0x3f571f[_0x8bbb('0x28')]=_0x15643c[_0x8bbb('0x1f')][0x0][_0x8bbb('0x28')];}var _0x3a6ced={'method':'POST','uri':encodeURI(_0x15643c[_0x8bbb('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3a6ced['method']){case _0x8bbb('0x29'):_0x3a6ced['qs']=_0x3f571f;break;case'POST':_0x3a6ced[_0x8bbb('0xb')]=_0x3f571f;break;}return rp(_0x3a6ced)[_0x8bbb('0x16')](function(_0x1309e6){logger['info'](_0x8bbb('0x2a'),'afterCreate',util[_0x8bbb('0x24')](_0x8bbb('0x2b'),_0x3f571f['id'],_0x15643c[_0x8bbb('0x25')]));if(_0x1309e6[_0x8bbb('0xb')]['threadId']&&_0x1309e6['body'][_0x8bbb('0x2c')]!=_0x3f571f['Interaction'][_0x8bbb('0x2c')]){return _0x45e1bd[_0x8bbb('0x13')]['update']({'threadId':_0x1309e6[_0x8bbb('0xb')]['threadId']},{'logging':!![],'where':{'id':_0x3f571f[_0x8bbb('0x27')]['id']}});}else{return;}})[_0x8bbb('0x16')](function(){return _0x217137[_0x8bbb('0x17')]({'read':!![]});})[_0x8bbb('0x19')](function(_0x46eed0){logger[_0x8bbb('0x1a')](_0x8bbb('0x2a'),_0x8bbb('0x23'),util[_0x8bbb('0x2d')](_0x46eed0,{'showHidden':![],'depth':null}));_0x95e93a();});}else{_0x95e93a();}})[_0x8bbb('0x2e')](function(){_0x95e93a();});}else{_0x95e93a();}}},'charset':_0x8bbb('0x2f'),'collate':_0x8bbb('0x30')});}; \ No newline at end of file +var _0xf3ff=['Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','body','OpenchannelInteraction','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteractionId','then','error','describe','find','OpenchannelAccountId'];(function(_0x587650,_0x288a3c){var _0x18c33a=function(_0x2b83fb){while(--_0x2b83fb){_0x587650['push'](_0x587650['shift']());}};_0x18c33a(++_0x288a3c);}(_0xf3ff,0xae));var _0xff3f=function(_0x3e89bd,_0x35acf9){_0x3e89bd=_0x3e89bd-0x0;var _0x5b2050=_0xf3ff[_0x3e89bd];return _0x5b2050;};'use strict';var _=require(_0xff3f('0x0'));var util=require('util');var logger=require(_0xff3f('0x1'))(_0xff3f('0x2'));var moment=require(_0xff3f('0x3'));var BPromise=require(_0xff3f('0x4'));var rp=require(_0xff3f('0x5'));var fs=require('fs');var path=require(_0xff3f('0x6'));var rimraf=require('rimraf');var config=require(_0xff3f('0x7'));var attributes=require(_0xff3f('0x8'));module[_0xff3f('0x9')]=function(_0x56208b,_0x3591f9){return _0x56208b[_0xff3f('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xff3f('0xb'),'paranoid':![],'indexes':[{'name':_0xff3f('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55e1a9,_0x34df96,_0x5f58d5){var _0x3e61d8=_0x56208b['models'];var _0x27747c=_0x55e1a9[_0xff3f('0xd')]({'plain':!![]});if(_0x27747c[_0xff3f('0xe')][_0xff3f('0xf')]()==='in'||_0x27747c[_0xff3f('0xe')][_0xff3f('0xf')]()===_0xff3f('0x10')&&!_0x27747c[_0xff3f('0x11')]&&!_[_0xff3f('0x12')](_0x27747c[_0xff3f('0x13')])){_0x3e61d8['OpenchannelInteraction']['findOne']({'where':{'id':_0x27747c[_0xff3f('0x14')]}})[_0xff3f('0x15')](function(_0x32f887){if(_0x32f887){_0x32f887['update']({'lastMsgAt':_0x27747c['createdAt'],'lastMsgDirection':_0x27747c[_0xff3f('0xe')]['toLowerCase']()});}})['catch'](function(_0x2a7c79){console[_0xff3f('0x16')](_0x2a7c79);});}if(_0x27747c['direction']===_0xff3f('0x10')&&!_0x27747c['secret']){var _0x129647;_0x3e61d8['CmContact'][_0xff3f('0x17')]()[_0xff3f('0x15')](function(_0xf21b3){return _0x3e61d8['OpenchannelAccount'][_0xff3f('0x18')]({'where':{'id':_0x27747c[_0xff3f('0x19')]},'include':[{'model':_0x3e61d8['OpenchannelInteraction'],'as':_0xff3f('0x1a'),'where':{'id':_0x27747c[_0xff3f('0x14')]},'limit':0x1,'include':[{'model':_0x3e61d8[_0xff3f('0x1b')],'as':_0xff3f('0x1c'),'attributes':_[_0xff3f('0x1d')](_0xf21b3)}]}]});})[_0xff3f('0x15')](function(_0x2ffd20){_0x129647=_0x2ffd20[_0xff3f('0xd')]({'plain':!![]});if(_0x129647&&_0x129647[_0xff3f('0x1e')]){logger[_0xff3f('0x1f')](_0xff3f('0x20'),_0xff3f('0x21'),util[_0xff3f('0x22')](_0xff3f('0x23'),_0x27747c['id'],_0x129647['replyUri']));if(_0x129647['Interactions']&&_0x129647[_0xff3f('0x1a')]['length']){_0x27747c[_0xff3f('0x24')]=_[_0xff3f('0x25')](_0x129647['Interactions'][0x0],_0xff3f('0x1c'));_0x27747c['Contact']=_0x129647[_0xff3f('0x1a')][0x0]['Contact'];}var _0x34df96={'method':_0xff3f('0x26'),'uri':encodeURI(_0x129647[_0xff3f('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x34df96[_0xff3f('0x27')]){case _0xff3f('0x28'):_0x34df96['qs']=_0x27747c;break;case'POST':_0x34df96['body']=_0x27747c;break;}return rp(_0x34df96)[_0xff3f('0x15')](function(_0x4721f9){logger[_0xff3f('0x1f')](_0xff3f('0x20'),_0xff3f('0x21'),util['format'](_0xff3f('0x29'),_0x27747c['id'],_0x129647[_0xff3f('0x1e')]));if(_0x4721f9['body'][_0xff3f('0x2a')]&&_0x4721f9[_0xff3f('0x2b')][_0xff3f('0x2a')]!=_0x27747c[_0xff3f('0x24')][_0xff3f('0x2a')]){return _0x3e61d8[_0xff3f('0x2c')][_0xff3f('0x2d')]({'threadId':_0x4721f9[_0xff3f('0x2b')][_0xff3f('0x2a')]},{'logging':!![],'where':{'id':_0x27747c[_0xff3f('0x24')]['id']}});}else{return;}})['then'](function(){return _0x55e1a9[_0xff3f('0x2d')]({'read':!![]});})['catch'](function(_0x16e1f3){logger[_0xff3f('0x16')](_0xff3f('0x20'),_0xff3f('0x21'),util[_0xff3f('0x2e')](_0x16e1f3,{'showHidden':![],'depth':null}));_0x5f58d5();});}else{_0x5f58d5();}})[_0xff3f('0x2f')](function(){_0x5f58d5();});}else{_0x5f58d5();}}},'charset':_0xff3f('0x30'),'collate':_0xff3f('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index a2f8529..26dbc11 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 _0x1b64=['bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','CreateOpenchannelMessage','OpenchannelMessage','options','raw','stringify','catch','lodash','util'];(function(_0x531e93,_0x2cb0b0){var _0x4ec3c3=function(_0x1915a0){while(--_0x1915a0){_0x531e93['push'](_0x531e93['shift']());}};_0x4ec3c3(++_0x2cb0b0);}(_0x1b64,0x76));var _0x41b6=function(_0x570d25,_0x375387){_0x570d25=_0x570d25-0x0;var _0x5acba9=_0x1b64[_0x570d25];return _0x5acba9;};'use strict';var _=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var moment=require('moment');var BPromise=require(_0x41b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x41b6('0x3'));var logger=require(_0x41b6('0x4'))(_0x41b6('0x5'));var config=require(_0x41b6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x41b6('0x7')][_0x41b6('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x41b6('0x9'),'port':0x18eb});var socket=require(_0x41b6('0xa'))(new Redis(config[_0x41b6('0xb')]));require(_0x41b6('0xc'))[_0x41b6('0xd')](socket);function respondWithRpcPromise(_0x412dca,_0x4d66c5,_0x207a2f){return new BPromise(function(_0x31b2b4,_0x274f27){return client[_0x41b6('0xe')](_0x412dca,_0x207a2f)[_0x41b6('0xf')](function(_0x42e6f9){logger[_0x41b6('0x10')](_0x41b6('0x11'),_0x4d66c5,_0x41b6('0x12'));logger[_0x41b6('0x13')](_0x41b6('0x14'),_0x4d66c5,_0x41b6('0x12'),JSON['stringify'](_0x42e6f9));if(_0x42e6f9[_0x41b6('0x15')]){if(_0x42e6f9[_0x41b6('0x15')][_0x41b6('0x16')]===0x1f4){logger[_0x41b6('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x4d66c5,_0x42e6f9[_0x41b6('0x15')][_0x41b6('0x17')]);return _0x274f27(_0x42e6f9[_0x41b6('0x15')][_0x41b6('0x17')]);}logger[_0x41b6('0x15')](_0x41b6('0x11'),_0x4d66c5,_0x42e6f9[_0x41b6('0x15')]['message']);return _0x31b2b4(_0x42e6f9[_0x41b6('0x15')][_0x41b6('0x17')]);}else{logger[_0x41b6('0x10')](_0x41b6('0x11'),_0x4d66c5,_0x41b6('0x12'));_0x31b2b4(_0x42e6f9['result']['message']);}})['catch'](function(_0x50ea3b){logger[_0x41b6('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x4d66c5,_0x50ea3b);_0x274f27(_0x50ea3b);});});}exports[_0x41b6('0x18')]=function(_0xbd99c5){var _0x30a168=this;return new Promise(function(_0x3da7de,_0x10c17c){return db[_0x41b6('0x19')]['create'](_0xbd99c5['body'],{'raw':_0xbd99c5[_0x41b6('0x1a')]?_0xbd99c5['options'][_0x41b6('0x1b')]===undefined?!![]:![]:!![]})[_0x41b6('0xf')](function(_0x309eba){logger[_0x41b6('0x10')](_0x41b6('0x18'),_0xbd99c5);logger[_0x41b6('0x13')](_0x41b6('0x18'),_0xbd99c5,JSON[_0x41b6('0x1c')](_0x309eba));_0x3da7de(_0x309eba);})[_0x41b6('0x1d')](function(_0x3e47bf){logger[_0x41b6('0x15')]('CreateOpenchannelMessage',_0x3e47bf[_0x41b6('0x17')],_0xbd99c5);_0x10c17c(_0x30a168[_0x41b6('0x15')](0x1f4,_0x3e47bf['message']));});});}; \ No newline at end of file +var _0x7d10=['catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result'];(function(_0x3bcfce,_0x536c49){var _0x2eb329=function(_0x25c8bc){while(--_0x25c8bc){_0x3bcfce['push'](_0x3bcfce['shift']());}};_0x2eb329(++_0x536c49);}(_0x7d10,0x1ce));var _0x07d1=function(_0x299928,_0x28d38c){_0x299928=_0x299928-0x0;var _0x4f4f28=_0x7d10[_0x299928];return _0x4f4f28;};'use strict';var _=require('lodash');var util=require(_0x07d1('0x0'));var moment=require(_0x07d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x07d1('0x2'));var fs=require('fs');var Redis=require(_0x07d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x07d1('0x4'));var logger=require(_0x07d1('0x5'))('rpc');var config=require(_0x07d1('0x6'));var jayson=require(_0x07d1('0x7'));var client=jayson[_0x07d1('0x8')][_0x07d1('0x9')]({'port':0x232a});config['redis']=_[_0x07d1('0xa')](config[_0x07d1('0xb')],{'host':_0x07d1('0xc'),'port':0x18eb});var socket=require(_0x07d1('0xd'))(new Redis(config[_0x07d1('0xb')]));require(_0x07d1('0xe'))[_0x07d1('0xf')](socket);function respondWithRpcPromise(_0x42bf2b,_0x370103,_0x40eccc){return new BPromise(function(_0x259865,_0x33abbd){return client[_0x07d1('0x10')](_0x42bf2b,_0x40eccc)[_0x07d1('0x11')](function(_0x40ccbd){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x370103,_0x07d1('0x12'));logger[_0x07d1('0x13')](_0x07d1('0x14'),_0x370103,_0x07d1('0x12'),JSON[_0x07d1('0x15')](_0x40ccbd));if(_0x40ccbd[_0x07d1('0x16')]){if(_0x40ccbd[_0x07d1('0x16')][_0x07d1('0x17')]===0x1f4){logger[_0x07d1('0x16')](_0x07d1('0x18'),_0x370103,_0x40ccbd['error'][_0x07d1('0x19')]);return _0x33abbd(_0x40ccbd[_0x07d1('0x16')][_0x07d1('0x19')]);}logger[_0x07d1('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x370103,_0x40ccbd[_0x07d1('0x16')][_0x07d1('0x19')]);return _0x259865(_0x40ccbd[_0x07d1('0x16')]['message']);}else{logger[_0x07d1('0x1a')](_0x07d1('0x18'),_0x370103,_0x07d1('0x12'));_0x259865(_0x40ccbd[_0x07d1('0x1b')][_0x07d1('0x19')]);}})[_0x07d1('0x1c')](function(_0x234d47){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x370103,_0x234d47);_0x33abbd(_0x234d47);});});}exports[_0x07d1('0x1d')]=function(_0x4aed02){var _0xf369a1=this;return new Promise(function(_0x550c7f,_0x2b5153){return db[_0x07d1('0x1e')][_0x07d1('0x1f')](_0x4aed02[_0x07d1('0x20')],{'raw':_0x4aed02[_0x07d1('0x21')]?_0x4aed02[_0x07d1('0x21')][_0x07d1('0x22')]===undefined?!![]:![]:!![]})[_0x07d1('0x11')](function(_0x43b86c){logger['info']('CreateOpenchannelMessage',_0x4aed02);logger['debug'](_0x07d1('0x1d'),_0x4aed02,JSON['stringify'](_0x43b86c));_0x550c7f(_0x43b86c);})[_0x07d1('0x1c')](function(_0x34ccba){logger[_0x07d1('0x16')](_0x07d1('0x1d'),_0x34ccba[_0x07d1('0x19')],_0x4aed02);_0x2b5153(_0xf369a1['error'](0x1f4,_0x34ccba[_0x07d1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 60535d7..29b85b8 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 _0xda3f=['openchannelMessage:','save','remove','register','length'];(function(_0x1dc6de,_0xb166b6){var _0x47b2fb=function(_0x3603a9){while(--_0x3603a9){_0x1dc6de['push'](_0x1dc6de['shift']());}};_0x47b2fb(++_0xb166b6);}(_0xda3f,0xec));var _0xfda3=function(_0x546142,_0x57c75a){_0x546142=_0x546142-0x0;var _0x483e8f=_0xda3f[_0x546142];return _0x483e8f;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xfda3('0x0'),_0xfda3('0x1'),'update'];function createListener(_0x5299b0,_0x5d7071){return function(_0x3859fe){_0x5d7071['emit'](_0x5299b0,_0x3859fe);};}function removeListener(_0x36dc71,_0x22187d){return function(){OpenchannelMessageEvents['removeListener'](_0x36dc71,_0x22187d);};}exports[_0xfda3('0x2')]=function(_0x43a010){for(var _0x47e7e2=0x0,_0x4e72d1=events[_0xfda3('0x3')];_0x47e7e2<_0x4e72d1;_0x47e7e2++){var _0x42476a=events[_0x47e7e2];var _0x125e2a=createListener(_0xfda3('0x4')+_0x42476a,_0x43a010);OpenchannelMessageEvents['on'](_0x42476a,_0x125e2a);}}; \ No newline at end of file +var _0x70e0=['openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x52fcf2,_0x2e19d6){var _0x29274e=function(_0x413e9f){while(--_0x413e9f){_0x52fcf2['push'](_0x52fcf2['shift']());}};_0x29274e(++_0x2e19d6);}(_0x70e0,0x17b));var _0x070e=function(_0x4852df,_0x4c2db7){_0x4852df=_0x4852df-0x0;var _0x1bbf46=_0x70e0[_0x4852df];return _0x1bbf46;};'use strict';var OpenchannelMessageEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){OpenchannelMessageEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);OpenchannelMessageEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6e13cec..a1533ad 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 _0x9432=['put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents'];(function(_0x52ba86,_0x21cf59){var _0x4e676e=function(_0x544e26){while(--_0x544e26){_0x52ba86['push'](_0x52ba86['shift']());}};_0x4e676e(++_0x21cf59);}(_0x9432,0x1e3));var _0x2943=function(_0x62182b,_0x5fc61a){_0x62182b=_0x62182b-0x0;var _0x385ef9=_0x9432[_0x62182b];return _0x385ef9;};'use strict';var multer=require(_0x2943('0x0'));var util=require(_0x2943('0x1'));var path=require('path');var timeout=require(_0x2943('0x2'));var express=require(_0x2943('0x3'));var router=express['Router']();var auth=require(_0x2943('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2943('0x5'));router[_0x2943('0x6')]('/',auth[_0x2943('0x7')](),controller[_0x2943('0x8')]);router[_0x2943('0x6')]('/describe',auth[_0x2943('0x7')](),controller[_0x2943('0x9')]);router[_0x2943('0x6')](_0x2943('0xa'),auth['isAuthenticated'](),controller[_0x2943('0xb')]);router[_0x2943('0x6')](_0x2943('0xc'),auth['isAuthenticated'](),controller[_0x2943('0xd')]);router['get'](_0x2943('0xe'),auth[_0x2943('0x7')](),controller[_0x2943('0xf')]);router[_0x2943('0x6')](_0x2943('0x10'),auth[_0x2943('0x7')](),controller[_0x2943('0x11')]);router[_0x2943('0x12')]('/',auth[_0x2943('0x7')](),controller[_0x2943('0x13')]);router[_0x2943('0x12')](_0x2943('0xe'),auth[_0x2943('0x7')](),controller['addTeams']);router[_0x2943('0x12')](_0x2943('0x10'),auth[_0x2943('0x7')](),controller[_0x2943('0x14')]);router[_0x2943('0x15')](_0x2943('0xa'),auth[_0x2943('0x7')](),controller['update']);router['delete'](_0x2943('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0x2943('0x16')]('/:id/teams',auth[_0x2943('0x7')](),controller['removeTeams']);router[_0x2943('0x16')](_0x2943('0x10'),auth[_0x2943('0x7')](),controller['removeAgents']);module[_0x2943('0x17')]=router; \ No newline at end of file +var _0xd072=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x7ea1fb,_0x2f0b74){var _0x478241=function(_0xd06b3a){while(--_0xd06b3a){_0x7ea1fb['push'](_0x7ea1fb['shift']());}};_0x478241(++_0x2f0b74);}(_0xd072,0x132));var _0x2d07=function(_0x1d783f,_0x4c19a3){_0x1d783f=_0x1d783f-0x0;var _0x1fb9a1=_0xd072[_0x1d783f];return _0x1fb9a1;};'use strict';var multer=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var path=require(_0x2d07('0x2'));var timeout=require(_0x2d07('0x3'));var express=require(_0x2d07('0x4'));var router=express[_0x2d07('0x5')]();var auth=require(_0x2d07('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2d07('0x7'));var controller=require(_0x2d07('0x8'));router[_0x2d07('0x9')]('/',auth[_0x2d07('0xa')](),controller[_0x2d07('0xb')]);router['get'](_0x2d07('0xc'),auth[_0x2d07('0xa')](),controller[_0x2d07('0xd')]);router[_0x2d07('0x9')](_0x2d07('0xe'),auth[_0x2d07('0xa')](),controller[_0x2d07('0xf')]);router['get'](_0x2d07('0x10'),auth[_0x2d07('0xa')](),controller[_0x2d07('0x11')]);router[_0x2d07('0x9')](_0x2d07('0x12'),auth[_0x2d07('0xa')](),controller[_0x2d07('0x13')]);router[_0x2d07('0x9')](_0x2d07('0x14'),auth[_0x2d07('0xa')](),controller[_0x2d07('0x15')]);router[_0x2d07('0x16')]('/',auth[_0x2d07('0xa')](),controller[_0x2d07('0x17')]);router[_0x2d07('0x16')](_0x2d07('0x12'),auth[_0x2d07('0xa')](),controller[_0x2d07('0x18')]);router[_0x2d07('0x16')](_0x2d07('0x14'),auth[_0x2d07('0xa')](),controller[_0x2d07('0x19')]);router[_0x2d07('0x1a')](_0x2d07('0xe'),auth[_0x2d07('0xa')](),controller['update']);router[_0x2d07('0x1b')](_0x2d07('0xe'),auth[_0x2d07('0xa')](),controller[_0x2d07('0x1c')]);router[_0x2d07('0x1b')](_0x2d07('0x12'),auth[_0x2d07('0xa')](),controller[_0x2d07('0x1d')]);router['delete'](_0x2d07('0x14'),auth[_0x2d07('0xa')](),controller[_0x2d07('0x1e')]);module[_0x2d07('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 91c8a18..51c771e 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 _0x1760=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x3f0b15,_0x29a0c6){var _0x371196=function(_0x39ea4e){while(--_0x39ea4e){_0x3f0b15['push'](_0x3f0b15['shift']());}};_0x371196(++_0x29a0c6);}(_0x1760,0x11a));var _0x0176=function(_0x2f075b,_0x37d5ba){_0x2f075b=_0x2f075b-0x0;var _0x4000a1=_0x1760[_0x2f075b];return _0x4000a1;};'use strict';var Sequelize=require(_0x0176('0x0'));module['exports']={'name':{'type':Sequelize[_0x0176('0x1')],'unique':_0x0176('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0176('0x1')]},'timeout':{'type':Sequelize[_0x0176('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0176('0x4')](_0x0176('0x5'),_0x0176('0x6'),_0x0176('0x7'))}}; \ No newline at end of file +var _0x9fc3=['exports','STRING','name','rrmemory','beepall','sequelize'];(function(_0x2e58ad,_0x1eb316){var _0x227b44=function(_0x487f53){while(--_0x487f53){_0x2e58ad['push'](_0x2e58ad['shift']());}};_0x227b44(++_0x1eb316);}(_0x9fc3,0xcb));var _0x39fc=function(_0x3260b5,_0x319136){_0x3260b5=_0x3260b5-0x0;var _0x43e878=_0x9fc3[_0x3260b5];return _0x43e878;};'use strict';var Sequelize=require(_0x39fc('0x0'));module[_0x39fc('0x1')]={'name':{'type':Sequelize[_0x39fc('0x2')],'unique':_0x39fc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x39fc('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x39fc('0x4'),_0x39fc('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index cace66f..931b12f 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 _0xd394=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','keys','query','filters','intersection','fields','attributes','length','order','sort','where','filter','VIRTUAL','merge','options','OpenchannelQueue','include','catch','show','params','includeAll','create','body','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','nolimit','pick','OpenchannelQueueId','findAll','User','UserId','agent','rows','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','ids','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','userOpenchannelQueue:save','getAgents','hasOwnProperty','html-pdf','eml-format'];(function(_0x394272,_0x55d232){var _0x1df26a=function(_0xe916eb){while(--_0xe916eb){_0x394272['push'](_0x394272['shift']());}};_0x1df26a(++_0x55d232);}(_0xd394,0x118));var _0x4d39=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd394[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x4d39('0x0'));var emlformat=require(_0x4d39('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d39('0x2'));var jsonpatch=require(_0x4d39('0x3'));var rp=require(_0x4d39('0x4'));var moment=require(_0x4d39('0x5'));var BPromise=require(_0x4d39('0x6'));var Mustache=require(_0x4d39('0x7'));var util=require(_0x4d39('0x8'));var path=require(_0x4d39('0x9'));var sox=require(_0x4d39('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4d39('0xb'));var squel=require('squel');var crypto=require(_0x4d39('0xc'));var jsforce=require(_0x4d39('0xd'));var deskjs=require(_0x4d39('0xe'));var toCsv=require(_0x4d39('0xf'));var querystring=require('querystring');var Papa=require(_0x4d39('0x10'));var Redis=require(_0x4d39('0x11'));var authService=require(_0x4d39('0x12'));var qs=require(_0x4d39('0x13'));var as=require(_0x4d39('0x14'));var hardwareService=require(_0x4d39('0x15'));var logger=require(_0x4d39('0x16'))('api');var utils=require(_0x4d39('0x17'));var config=require(_0x4d39('0x18'));var db=require(_0x4d39('0x19'))['db'];config[_0x4d39('0x1a')]=_[_0x4d39('0x1b')](config[_0x4d39('0x1a')],{'host':_0x4d39('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d39('0x1a')]));require(_0x4d39('0x1d'))[_0x4d39('0x1e')](socket);function respondWithStatusCode(_0x2119c5,_0x15abe3){_0x15abe3=_0x15abe3||0xcc;return function(_0x1f1e06){if(_0x1f1e06){return _0x2119c5[_0x4d39('0x1f')](_0x15abe3);}return _0x2119c5[_0x4d39('0x20')](_0x15abe3)[_0x4d39('0x21')]();};}function respondWithResult(_0x1aa4b8,_0x2c6018){_0x2c6018=_0x2c6018||0xc8;return function(_0x35edaf){if(_0x35edaf){return _0x1aa4b8[_0x4d39('0x20')](_0x2c6018)[_0x4d39('0x22')](_0x35edaf);}};}function respondWithFilteredResult(_0x3caa19,_0x4551f0){return function(_0xa101b7){if(_0xa101b7){var _0x578776=_0xa101b7[_0x4d39('0x23')],_0x10e718=_0x4551f0[_0x4d39('0x24')],_0x5f3e61=_0x4551f0[_0x4d39('0x24')]+_0x4551f0[_0x4d39('0x25')],_0x5aa9f3;if(_0x5f3e61>=_0x578776){_0x5f3e61=_0x578776;_0x5aa9f3=0xc8;}else{_0x5aa9f3=0xce;}_0x3caa19[_0x4d39('0x20')](_0x5aa9f3);return _0x3caa19['set'](_0x4d39('0x26'),_0x10e718+'-'+_0x5f3e61+'/'+_0x578776)[_0x4d39('0x22')](_0xa101b7);}return null;};}function patchUpdates(_0x3c769c){return function(_0x465ba){try{jsonpatch[_0x4d39('0x27')](_0x465ba,_0x3c769c,!![]);}catch(_0x36226a){return BPromise['reject'](_0x36226a);}return _0x465ba[_0x4d39('0x28')]();};}function saveUpdates(_0x38f2cb,_0x1620d3){return function(_0x4d18d2){if(_0x4d18d2){return _0x4d18d2[_0x4d39('0x29')](_0x38f2cb)[_0x4d39('0x2a')](function(_0xf12086){return _0xf12086;});}return null;};}function removeEntity(_0x271357,_0x3db14a){return function(_0x3dfc49){if(_0x3dfc49){return _0x3dfc49[_0x4d39('0x2b')]()[_0x4d39('0x2a')](function(){var _0x470a84=_0x3dfc49[_0x4d39('0x2c')]({'plain':!![]});var _0x34a0e3=_0x4d39('0x2d');return db[_0x4d39('0x2e')][_0x4d39('0x2b')]({'where':{'type':_0x34a0e3,'resourceId':_0x470a84['id']}})['then'](function(){return _0x3dfc49;});})[_0x4d39('0x2a')](function(){_0x271357['status'](0xcc)[_0x4d39('0x21')]();});}};}function handleEntityNotFound(_0xc17d41,_0x521bb3){return function(_0x570e4e){if(!_0x570e4e){_0xc17d41[_0x4d39('0x1f')](0x194);}return _0x570e4e;};}function handleError(_0x36d8c6,_0x1ef403){_0x1ef403=_0x1ef403||0x1f4;return function(_0x694a4d){logger['error'](_0x694a4d[_0x4d39('0x2f')]);if(_0x694a4d['name']){delete _0x694a4d['name'];}_0x36d8c6['status'](_0x1ef403)[_0x4d39('0x30')](_0x694a4d);};}exports[_0x4d39('0x31')]=function(_0x276c9b,_0x471f16){var _0xc66e93={},_0x1c46dc={},_0x3e0c16={'count':0x0,'rows':[]};var _0x59028e=_['map'](db['OpenchannelQueue'][_0x4d39('0x32')],function(_0x5af27a){return{'name':_0x5af27a[_0x4d39('0x33')],'type':_0x5af27a[_0x4d39('0x34')]['key']};});_0x1c46dc[_0x4d39('0x35')]=_[_0x4d39('0x36')](_0x59028e,_0x4d39('0x37'));_0x1c46dc['query']=_[_0x4d39('0x38')](_0x276c9b[_0x4d39('0x39')]);_0x1c46dc[_0x4d39('0x3a')]=_[_0x4d39('0x3b')](_0x1c46dc[_0x4d39('0x35')],_0x1c46dc[_0x4d39('0x39')]);_0xc66e93['attributes']=_[_0x4d39('0x3b')](_0x1c46dc[_0x4d39('0x35')],qs[_0x4d39('0x3c')](_0x276c9b[_0x4d39('0x39')][_0x4d39('0x3c')]));_0xc66e93['attributes']=_0xc66e93[_0x4d39('0x3d')][_0x4d39('0x3e')]?_0xc66e93[_0x4d39('0x3d')]:_0x1c46dc[_0x4d39('0x35')];if(!_0x276c9b['query']['hasOwnProperty']('nolimit')){_0xc66e93[_0x4d39('0x25')]=qs[_0x4d39('0x25')](_0x276c9b[_0x4d39('0x39')][_0x4d39('0x25')]);_0xc66e93[_0x4d39('0x24')]=qs['offset'](_0x276c9b['query'][_0x4d39('0x24')]);}_0xc66e93[_0x4d39('0x3f')]=qs['sort'](_0x276c9b['query'][_0x4d39('0x40')]);_0xc66e93[_0x4d39('0x41')]=qs['filters'](_['pick'](_0x276c9b[_0x4d39('0x39')],_0x1c46dc['filters']),_0x59028e);if(_0x276c9b[_0x4d39('0x39')][_0x4d39('0x42')]){_0xc66e93[_0x4d39('0x41')]=_['merge'](_0xc66e93[_0x4d39('0x41')],{'$or':_[_0x4d39('0x36')](_0x59028e,function(_0x5cd7a2){if(_0x5cd7a2[_0x4d39('0x34')]!==_0x4d39('0x43')){var _0x365d94={};_0x365d94[_0x5cd7a2[_0x4d39('0x37')]]={'$like':'%'+_0x276c9b['query'][_0x4d39('0x42')]+'%'};return _0x365d94;}})});}_0xc66e93=_[_0x4d39('0x44')]({},_0xc66e93,_0x276c9b[_0x4d39('0x45')]);var _0xc7f7f4={'where':_0xc66e93['where']};return db[_0x4d39('0x46')][_0x4d39('0x23')](_0xc7f7f4)['then'](function(_0x4f4676){_0x3e0c16['count']=_0x4f4676;if(_0x276c9b['query']['includeAll']){_0xc66e93[_0x4d39('0x47')]=[{'all':!![]}];}return db[_0x4d39('0x46')]['findAll'](_0xc66e93);})['then'](function(_0xb9a45a){_0x3e0c16['rows']=_0xb9a45a;return _0x3e0c16;})[_0x4d39('0x2a')](respondWithFilteredResult(_0x471f16,_0xc66e93))[_0x4d39('0x48')](handleError(_0x471f16,null));};exports[_0x4d39('0x49')]=function(_0x1e35c7,_0x43b2cc){var _0x174250={'raw':!![],'where':{'id':_0x1e35c7[_0x4d39('0x4a')]['id']}},_0x2535c8={};_0x2535c8[_0x4d39('0x35')]=_[_0x4d39('0x38')](db[_0x4d39('0x46')][_0x4d39('0x32')]);_0x2535c8[_0x4d39('0x39')]=_['keys'](_0x1e35c7[_0x4d39('0x39')]);_0x2535c8[_0x4d39('0x3a')]=_[_0x4d39('0x3b')](_0x2535c8[_0x4d39('0x35')],_0x2535c8[_0x4d39('0x39')]);_0x174250[_0x4d39('0x3d')]=_[_0x4d39('0x3b')](_0x2535c8[_0x4d39('0x35')],qs['fields'](_0x1e35c7['query'][_0x4d39('0x3c')]));_0x174250['attributes']=_0x174250[_0x4d39('0x3d')][_0x4d39('0x3e')]?_0x174250['attributes']:_0x2535c8[_0x4d39('0x35')];if(_0x1e35c7[_0x4d39('0x39')][_0x4d39('0x4b')]){_0x174250[_0x4d39('0x47')]=[{'all':!![]}];}_0x174250=_[_0x4d39('0x44')]({},_0x174250,_0x1e35c7['options']);return db[_0x4d39('0x46')]['find'](_0x174250)[_0x4d39('0x2a')](handleEntityNotFound(_0x43b2cc,null))['then'](respondWithResult(_0x43b2cc,null))[_0x4d39('0x48')](handleError(_0x43b2cc,null));};exports['create']=function(_0x3af465,_0x1232a7){return db[_0x4d39('0x46')][_0x4d39('0x4c')](_0x3af465[_0x4d39('0x4d')],{})[_0x4d39('0x2a')](function(_0x44169a){var _0x3bd4b3=_0x3af465['user'][_0x4d39('0x2c')]({'plain':!![]});if(!_0x3bd4b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bd4b3[_0x4d39('0x4e')]==='user'){var _0x121ae0=_0x44169a[_0x4d39('0x2c')]({'plain':!![]});var _0x22bfb9=_0x4d39('0x2d');return db[_0x4d39('0x4f')][_0x4d39('0x50')]({'where':{'name':_0x22bfb9,'userProfileId':_0x3bd4b3[_0x4d39('0x51')]},'raw':!![]})[_0x4d39('0x2a')](function(_0x4c03de){if(_0x4c03de&&_0x4c03de['autoAssociation']===0x0){return db[_0x4d39('0x2e')]['create']({'name':_0x121ae0[_0x4d39('0x37')],'resourceId':_0x121ae0['id'],'type':_0x4c03de[_0x4d39('0x37')],'sectionId':_0x4c03de['id']},{})[_0x4d39('0x2a')](function(){return _0x44169a;});}else{return _0x44169a;}})[_0x4d39('0x48')](function(_0x350b8a){logger['error'](_0x4d39('0x52'),_0x350b8a);throw _0x350b8a;});}return _0x44169a;})[_0x4d39('0x2a')](respondWithResult(_0x1232a7,0xc9))[_0x4d39('0x48')](handleError(_0x1232a7,null));};exports[_0x4d39('0x29')]=function(_0x250390,_0x2d443){if(_0x250390['body']['id']){delete _0x250390[_0x4d39('0x4d')]['id'];}return db[_0x4d39('0x46')][_0x4d39('0x50')]({'where':{'id':_0x250390[_0x4d39('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2d443,null))[_0x4d39('0x2a')](saveUpdates(_0x250390['body'],null))[_0x4d39('0x2a')](respondWithResult(_0x2d443,null))[_0x4d39('0x48')](handleError(_0x2d443,null));};exports['destroy']=function(_0x48fa97,_0x3541fa){return db[_0x4d39('0x46')][_0x4d39('0x50')]({'where':{'id':_0x48fa97['params']['id']}})[_0x4d39('0x2a')](handleEntityNotFound(_0x3541fa,null))[_0x4d39('0x2a')](removeEntity(_0x3541fa,null))[_0x4d39('0x48')](handleError(_0x3541fa,null));};exports[_0x4d39('0x53')]=function(_0x17714a,_0x4b9172){return db['OpenchannelQueue'][_0x4d39('0x53')]()[_0x4d39('0x2a')](respondWithResult(_0x4b9172,null))[_0x4d39('0x48')](handleError(_0x4b9172,null));};exports[_0x4d39('0x54')]=function(_0x231284,_0x512a41,_0x1d2f82){var _0x5902f3={'raw':!![],'where':{}},_0x1d3b90={},_0x19ac96;return db[_0x4d39('0x46')]['findOne']({'where':{'id':_0x231284[_0x4d39('0x4a')]['id']}})[_0x4d39('0x2a')](handleEntityNotFound(_0x512a41,null))[_0x4d39('0x2a')](function(_0x4267b0){if(_0x4267b0){_0x19ac96=_0x4267b0[_0x4d39('0x2c')]({'plain':!![]});_0x1d3b90['model']=_[_0x4d39('0x38')](db[_0x4d39('0x55')][_0x4d39('0x32')]);_0x1d3b90['query']=_[_0x4d39('0x38')](_0x231284['query']);_0x1d3b90['filters']=_[_0x4d39('0x3b')](_0x1d3b90[_0x4d39('0x35')],_0x1d3b90['query']);_0x5902f3[_0x4d39('0x3d')]=_['intersection'](_0x1d3b90[_0x4d39('0x35')],qs['fields'](_0x231284[_0x4d39('0x39')][_0x4d39('0x3c')]));_0x5902f3[_0x4d39('0x3d')]=_0x5902f3[_0x4d39('0x3d')]['length']?_0x5902f3[_0x4d39('0x3d')]:_0x1d3b90['model'];if(!_0x231284[_0x4d39('0x39')]['hasOwnProperty'](_0x4d39('0x56'))){_0x5902f3[_0x4d39('0x25')]=qs[_0x4d39('0x25')](_0x231284[_0x4d39('0x39')]['limit']);_0x5902f3[_0x4d39('0x24')]=qs['offset'](_0x231284[_0x4d39('0x39')]['offset']);}_0x5902f3[_0x4d39('0x3f')]=qs[_0x4d39('0x40')](_0x231284[_0x4d39('0x39')]['sort']);_0x5902f3[_0x4d39('0x41')]=qs[_0x4d39('0x3a')](_[_0x4d39('0x57')](_0x231284[_0x4d39('0x39')],_0x1d3b90[_0x4d39('0x3a')]));_0x5902f3[_0x4d39('0x41')][_0x4d39('0x58')]=_0x4267b0['id'];if(_0x231284[_0x4d39('0x39')][_0x4d39('0x42')]){_0x5902f3['where']=_[_0x4d39('0x44')](_0x5902f3['where'],{'$or':_['map'](_0x5902f3[_0x4d39('0x3d')],function(_0x1c34ad){var _0x499f68={};_0x499f68[_0x1c34ad]={'$like':'%'+_0x231284[_0x4d39('0x39')][_0x4d39('0x42')]+'%'};return _0x499f68;})});}_0x5902f3=_[_0x4d39('0x44')]({},_0x5902f3,_0x231284['options']);return db['UserOpenchannelQueue'][_0x4d39('0x59')](_0x5902f3);}})[_0x4d39('0x2a')](function(_0x3fcecb){if(_0x3fcecb){return db[_0x4d39('0x5a')]['findAndCountAll']({'where':{'id':_[_0x4d39('0x36')](_0x3fcecb,_0x4d39('0x5b')),'role':_0x4d39('0x5c')},'attributes':['id',_0x4d39('0x37'),'openchannelPause','updatedAt','createdAt']});}})[_0x4d39('0x2a')](function(_0x18470b){if(_0x18470b){return{'count':_0x18470b[_0x4d39('0x23')],'rows':_[_0x4d39('0x36')](_0x18470b[_0x4d39('0x5d')],function(_0xac5c14){return{'membername':_0xac5c14['name'],'UserId':_0xac5c14['id'],'queue_name':_0x19ac96['name'],'OpenchannelQueueId':_0x19ac96['id'],'interface':util[_0x4d39('0x5e')](_0x4d39('0x5f'),_0x4d39('0x60'),_0xac5c14[_0x4d39('0x37')]),'penalty':0x0,'paused':_0xac5c14['openchannelPause'],'createdAt':_0xac5c14['createdAt'],'updatedAt':_0xac5c14['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x512a41,_0x5902f3))[_0x4d39('0x48')](handleError(_0x512a41,null));};exports[_0x4d39('0x61')]=function(_0x2dde58,_0x50272d,_0x56073e){var _0x4ede0a={};var _0x45d1a4={};var _0x43d2a0;var _0x3c78cb;return db[_0x4d39('0x46')][_0x4d39('0x62')]({'where':{'id':_0x2dde58[_0x4d39('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50272d,null))['then'](function(_0x395809){if(_0x395809){_0x43d2a0=_0x395809;_0x45d1a4['model']=_[_0x4d39('0x38')](db[_0x4d39('0x63')][_0x4d39('0x32')]);_0x45d1a4[_0x4d39('0x39')]=_[_0x4d39('0x38')](_0x2dde58[_0x4d39('0x39')]);_0x45d1a4[_0x4d39('0x3a')]=_[_0x4d39('0x3b')](_0x45d1a4[_0x4d39('0x35')],_0x45d1a4['query']);_0x4ede0a['attributes']=_[_0x4d39('0x3b')](_0x45d1a4['model'],qs['fields'](_0x2dde58['query'][_0x4d39('0x3c')]));_0x4ede0a[_0x4d39('0x3d')]=_0x4ede0a[_0x4d39('0x3d')][_0x4d39('0x3e')]?_0x4ede0a[_0x4d39('0x3d')]:_0x45d1a4[_0x4d39('0x35')];_0x4ede0a[_0x4d39('0x3f')]=qs[_0x4d39('0x40')](_0x2dde58[_0x4d39('0x39')]['sort']);_0x4ede0a[_0x4d39('0x41')]=qs[_0x4d39('0x3a')](_[_0x4d39('0x57')](_0x2dde58[_0x4d39('0x39')],_0x45d1a4[_0x4d39('0x3a')]));if(_0x2dde58[_0x4d39('0x39')]['filter']){_0x4ede0a['where']=_['merge'](_0x4ede0a[_0x4d39('0x41')],{'$or':_[_0x4d39('0x36')](_0x4ede0a['attributes'],function(_0x241396){var _0x173ada={};_0x173ada[_0x241396]={'$like':'%'+_0x2dde58[_0x4d39('0x39')][_0x4d39('0x42')]+'%'};return _0x173ada;})});}_0x4ede0a=_['merge']({},_0x4ede0a,_0x2dde58[_0x4d39('0x45')]);return _0x43d2a0[_0x4d39('0x61')](_0x4ede0a);}})[_0x4d39('0x2a')](function(_0x3b53ef){if(_0x3b53ef){_0x3c78cb=_0x3b53ef[_0x4d39('0x3e')];if(!_0x2dde58[_0x4d39('0x39')]['hasOwnProperty'](_0x4d39('0x56'))){_0x4ede0a[_0x4d39('0x25')]=qs[_0x4d39('0x25')](_0x2dde58[_0x4d39('0x39')][_0x4d39('0x25')]);_0x4ede0a['offset']=qs[_0x4d39('0x24')](_0x2dde58['query'][_0x4d39('0x24')]);}return _0x43d2a0[_0x4d39('0x61')](_0x4ede0a);}})['then'](function(_0x460325){if(_0x460325){return _0x460325?{'count':_0x3c78cb,'rows':_0x460325}:null;}})['then'](respondWithResult(_0x50272d,null))[_0x4d39('0x48')](handleError(_0x50272d,null));};exports[_0x4d39('0x64')]=function(_0x219071,_0x34d292,_0x332389){var _0x52232f=_0x219071['body']['ids'];return db['Team'][_0x4d39('0x59')]({'where':{'id':_0x52232f},'attributes':['id'],'include':[{'model':db[_0x4d39('0x5a')],'as':_0x4d39('0x65'),'attributes':['id',_0x4d39('0x37'),_0x4d39('0x66'),_0x4d39('0x67'),_0x4d39('0x68')],'raw':!![]}]})['then'](function(_0x3a41b8){if(_0x3a41b8){var _0x1f17fb=_['flatMap'](_0x3a41b8,function(_0x57d656){var _0x58a4c3=_0x57d656[_0x4d39('0x2c')]({'plain':!![]});return _0x58a4c3[_0x4d39('0x65')];});return db['OpenchannelQueue'][_0x4d39('0x50')]({'where':{'id':_0x219071[_0x4d39('0x4a')]['id']}})[_0x4d39('0x2a')](function(_0x226c01){return db['sequelize'][_0x4d39('0x69')](function(_0x180653){return _0x226c01['addTeams'](_0x52232f,{'transaction':_0x180653})[_0x4d39('0x2a')](function(){return BPromise[_0x4d39('0x6a')](_0x1f17fb,function(_0x5adbde){return db['UserOpenchannelQueue'][_0x4d39('0x6b')]({'where':{'UserId':_0x5adbde['id'],'OpenchannelQueueId':_0x219071[_0x4d39('0x4a')]['id']},'transaction':_0x180653});});})[_0x4d39('0x2a')](function(){_0x1f17fb[_0x4d39('0x6c')](function(_0x566975){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x566975['id'],'OpenchannelQueueId':_0x226c01['id']});});});});});}})[_0x4d39('0x2a')](respondWithStatusCode(_0x34d292,null))[_0x4d39('0x48')](handleError(_0x34d292,null));};exports[_0x4d39('0x6d')]=function(_0x2dc6ce,_0x37d63b,_0x358bb7){return db[_0x4d39('0x63')][_0x4d39('0x59')]({'where':{'id':_0x2dc6ce[_0x4d39('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4d39('0x5a')],'as':_0x4d39('0x65'),'attributes':['id'],'raw':!![]}]})[_0x4d39('0x2a')](handleEntityNotFound(_0x37d63b,null))[_0x4d39('0x2a')](function(_0x37174d){var _0x3418b9=_[_0x4d39('0x36')](_0x37174d,'id');var _0x446345=[];var _0x19335e=[];var _0x35f8ce=squel[_0x4d39('0x6e')]();_0x35f8ce[_0x4d39('0x6f')](_0x4d39('0x70'))[_0x4d39('0x71')](_0x4d39('0x72'),'tq')[_0x4d39('0x73')](_0x4d39('0x74'),'ut',_0x4d39('0x75'))['where'](_0x4d39('0x76'),_0x2dc6ce['params']['id']);for(var _0x246db0=0x0;_0x246db0<_0x37174d[_0x4d39('0x3e')];_0x246db0+=0x1){let _0x30e079=_0x37174d[_0x246db0];for(var _0x59bafa=0x0;_0x59bafa<_0x30e079[_0x4d39('0x65')]['length'];_0x59bafa+=0x1){let _0xedd7ae=_0x30e079[_0x4d39('0x65')][_0x59bafa];var _0xaea925=_0x35f8ce[_0x4d39('0x77')]();_0xaea925['where'](_0x4d39('0x78'),_0xedd7ae['id']);_0x19335e[_0x4d39('0x79')](db[_0x4d39('0x7a')][_0x4d39('0x39')](_0xaea925[_0x4d39('0x7b')](),{'type':db['sequelize'][_0x4d39('0x7c')][_0x4d39('0x7d')]})[_0x4d39('0x2a')](function(_0x17472b){if(_0x17472b['length']===0x1){return _0xedd7ae['id'];}else{var _0x1e732b=_['every'](_['map'](_0x17472b,_0x4d39('0x7e')),function(_0x554593){return _[_0x4d39('0x7f')](_0x3418b9,_0x554593);});if(_0x1e732b){return _0xedd7ae['id'];}}}));}}return BPromise['all'](_0x19335e)[_0x4d39('0x2a')](function(_0x269b8d){_0x446345=_(_0x446345)[_0x4d39('0x80')](_0x269b8d)[_0x4d39('0x81')]()[_0x4d39('0x82')]();return db[_0x4d39('0x46')][_0x4d39('0x50')]({'where':{'id':_0x2dc6ce[_0x4d39('0x4a')]['id']}})[_0x4d39('0x2a')](function(_0x2e6946){return db[_0x4d39('0x7a')][_0x4d39('0x69')](function(_0x5adc8b){return _0x2e6946['removeTeams'](_0x2dc6ce[_0x4d39('0x39')][_0x4d39('0x83')],{'transaction':_0x5adc8b})[_0x4d39('0x2a')](function(){if(!_[_0x4d39('0x84')](_0x446345)){return _0x2e6946[_0x4d39('0x85')](_0x446345,{'transaction':_0x5adc8b});}})[_0x4d39('0x2a')](function(){_0x446345[_0x4d39('0x6c')](function(_0x56713b){socket[_0x4d39('0x86')](_0x4d39('0x87'),{'UserId':_0x56713b,'OpenchannelQueueId':_0x2e6946['id']});});});});});});})[_0x4d39('0x2a')](respondWithStatusCode(_0x37d63b,null))[_0x4d39('0x48')](handleError(_0x37d63b,null));};exports[_0x4d39('0x88')]=function(_0x218759,_0x108e31,_0x3c46ae){return db['OpenchannelQueue'][_0x4d39('0x50')]({'where':{'id':_0x218759[_0x4d39('0x4a')]['id']}})['then'](handleEntityNotFound(_0x108e31,null))['then'](function(_0x91a31e){if(_0x91a31e){return _0x91a31e[_0x4d39('0x88')](_0x218759[_0x4d39('0x4d')][_0x4d39('0x83')],_[_0x4d39('0x89')](_0x218759[_0x4d39('0x4d')],[_0x4d39('0x83'),'id'])||{})['spread'](function(_0x130ed1){for(var _0x4fb3bf=0x0;_0x4fb3bf<_0x218759[_0x4d39('0x4d')][_0x4d39('0x83')][_0x4d39('0x3e')];_0x4fb3bf+=0x1){socket['emit'](_0x4d39('0x8a'),{'UserId':_0x218759[_0x4d39('0x4d')]['ids'][_0x4fb3bf],'OpenchannelQueueId':_0x218759[_0x4d39('0x4a')]['id']});}return _0x130ed1;});}})['then'](respondWithResult(_0x108e31,null))[_0x4d39('0x48')](handleError(_0x108e31,null));};exports['removeAgents']=function(_0x399543,_0x1f5e31,_0x4ecb83){return db[_0x4d39('0x46')][_0x4d39('0x50')]({'where':{'id':_0x399543[_0x4d39('0x4a')]['id']}})[_0x4d39('0x2a')](handleEntityNotFound(_0x1f5e31,null))[_0x4d39('0x2a')](function(_0xe5acc4){if(_0xe5acc4){return _0xe5acc4[_0x4d39('0x85')](_0x399543[_0x4d39('0x39')]['ids'])['then'](function(){if(_['isArray'](_0x399543[_0x4d39('0x39')][_0x4d39('0x83')])){for(var _0x3eb021=0x0;_0x3eb021<_0x399543[_0x4d39('0x39')][_0x4d39('0x83')]['length'];_0x3eb021+=0x1){socket[_0x4d39('0x86')]('userOpenchannelQueue:remove',{'UserId':Number(_0x399543[_0x4d39('0x39')][_0x4d39('0x83')][_0x3eb021]),'OpenchannelQueueId':Number(_0x399543[_0x4d39('0x4a')]['id'])});}}else{socket['emit'](_0x4d39('0x87'),{'UserId':Number(_0x399543[_0x4d39('0x39')]['ids']),'OpenchannelQueueId':Number(_0x399543['params']['id'])});}});}})[_0x4d39('0x2a')](respondWithStatusCode(_0x1f5e31,null))['catch'](handleError(_0x1f5e31,null));};exports[_0x4d39('0x8b')]=function(_0x5144bd,_0x11978c,_0x2faa36){var _0x1d2dc8={};var _0x331be0={};var _0x36b54c;var _0x1c3d95;return db[_0x4d39('0x46')][_0x4d39('0x62')]({'where':{'id':_0x5144bd['params']['id']}})[_0x4d39('0x2a')](handleEntityNotFound(_0x11978c,null))[_0x4d39('0x2a')](function(_0x1d8d9e){if(_0x1d8d9e){_0x36b54c=_0x1d8d9e;_0x331be0[_0x4d39('0x35')]=_['keys'](db[_0x4d39('0x5a')]['rawAttributes']);_0x331be0[_0x4d39('0x39')]=_[_0x4d39('0x38')](_0x5144bd[_0x4d39('0x39')]);_0x331be0[_0x4d39('0x3a')]=_[_0x4d39('0x3b')](_0x331be0[_0x4d39('0x35')],_0x331be0[_0x4d39('0x39')]);_0x1d2dc8[_0x4d39('0x3d')]=_[_0x4d39('0x3b')](_0x331be0[_0x4d39('0x35')],qs[_0x4d39('0x3c')](_0x5144bd['query'][_0x4d39('0x3c')]));_0x1d2dc8[_0x4d39('0x3d')]=_0x1d2dc8[_0x4d39('0x3d')]['length']?_0x1d2dc8[_0x4d39('0x3d')]:_0x331be0[_0x4d39('0x35')];_0x1d2dc8[_0x4d39('0x3f')]=qs[_0x4d39('0x40')](_0x5144bd['query'][_0x4d39('0x40')]);_0x1d2dc8[_0x4d39('0x41')]=qs[_0x4d39('0x3a')](_['pick'](_0x5144bd[_0x4d39('0x39')],_0x331be0[_0x4d39('0x3a')]));if(_0x5144bd[_0x4d39('0x39')]['filter']){_0x1d2dc8[_0x4d39('0x41')]=_[_0x4d39('0x44')](_0x1d2dc8[_0x4d39('0x41')],{'$or':_[_0x4d39('0x36')](_0x1d2dc8[_0x4d39('0x3d')],function(_0x5e5e79){var _0x64f3ec={};_0x64f3ec[_0x5e5e79]={'$like':'%'+_0x5144bd[_0x4d39('0x39')]['filter']+'%'};return _0x64f3ec;})});}_0x1d2dc8=_[_0x4d39('0x44')]({},_0x1d2dc8,_0x5144bd[_0x4d39('0x45')]);return _0x36b54c[_0x4d39('0x8b')](_0x1d2dc8);}})[_0x4d39('0x2a')](function(_0x39f896){if(_0x39f896){_0x1c3d95=_0x39f896[_0x4d39('0x3e')];if(!_0x5144bd['query'][_0x4d39('0x8c')](_0x4d39('0x56'))){_0x1d2dc8[_0x4d39('0x25')]=qs['limit'](_0x5144bd[_0x4d39('0x39')][_0x4d39('0x25')]);_0x1d2dc8[_0x4d39('0x24')]=qs[_0x4d39('0x24')](_0x5144bd['query']['offset']);}return _0x36b54c[_0x4d39('0x8b')](_0x1d2dc8);}})['then'](function(_0x2a5cb5){if(_0x2a5cb5){return _0x2a5cb5?{'count':_0x1c3d95,'rows':_0x2a5cb5}:null;}})['then'](respondWithResult(_0x11978c,null))[_0x4d39('0x48')](handleError(_0x11978c,null));}; \ No newline at end of file +var _0x6694=['merge','OpenchannelQueue','include','findAll','rows','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','find','userProfileId','autoAssociation','error','update','describe','findOne','UserOpenchannelQueue','length','OpenchannelQueueId','options','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','getTeams','Team','nolimit','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','every','includes','union','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','count','Content-Range','apply','save','then','destroy','get','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','sort','where','pick','filter','VIRTUAL'];(function(_0x23e312,_0x5cf650){var _0x493f2d=function(_0x547b53){while(--_0x547b53){_0x23e312['push'](_0x23e312['shift']());}};_0x493f2d(++_0x5cf650);}(_0x6694,0xd6));var _0x4669=function(_0xe31fc4,_0x2939c4){_0xe31fc4=_0xe31fc4-0x0;var _0x3a975c=_0x6694[_0xe31fc4];return _0x3a975c;};'use strict';var pdf=require(_0x4669('0x0'));var emlformat=require(_0x4669('0x1'));var rimraf=require(_0x4669('0x2'));var zipdir=require(_0x4669('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4669('0x4'));var BPromise=require(_0x4669('0x5'));var Mustache=require(_0x4669('0x6'));var util=require(_0x4669('0x7'));var path=require(_0x4669('0x8'));var sox=require(_0x4669('0x9'));var csv=require(_0x4669('0xa'));var ejs=require(_0x4669('0xb'));var fs=require('fs');var _=require(_0x4669('0xc'));var squel=require(_0x4669('0xd'));var crypto=require(_0x4669('0xe'));var jsforce=require(_0x4669('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4669('0xa'));var querystring=require(_0x4669('0x10'));var Papa=require(_0x4669('0x11'));var Redis=require(_0x4669('0x12'));var authService=require(_0x4669('0x13'));var qs=require(_0x4669('0x14'));var as=require(_0x4669('0x15'));var hardwareService=require(_0x4669('0x16'));var logger=require(_0x4669('0x17'))(_0x4669('0x18'));var utils=require('../../config/utils');var config=require(_0x4669('0x19'));var db=require(_0x4669('0x1a'))['db'];config[_0x4669('0x1b')]=_[_0x4669('0x1c')](config['redis'],{'host':_0x4669('0x1d'),'port':0x18eb});var socket=require(_0x4669('0x1e'))(new Redis(config[_0x4669('0x1b')]));require(_0x4669('0x1f'))[_0x4669('0x20')](socket);function respondWithStatusCode(_0x44b20f,_0x253265){_0x253265=_0x253265||0xcc;return function(_0x14aa9e){if(_0x14aa9e){return _0x44b20f[_0x4669('0x21')](_0x253265);}return _0x44b20f[_0x4669('0x22')](_0x253265)[_0x4669('0x23')]();};}function respondWithResult(_0xa829d1,_0x3e296f){_0x3e296f=_0x3e296f||0xc8;return function(_0x48787c){if(_0x48787c){return _0xa829d1[_0x4669('0x22')](_0x3e296f)[_0x4669('0x24')](_0x48787c);}};}function respondWithFilteredResult(_0x15665f,_0x35bbe0){return function(_0x4d7379){if(_0x4d7379){var _0x49f7be=_0x4d7379[_0x4669('0x25')],_0x45e97c=_0x35bbe0['offset'],_0x31f9e8=_0x35bbe0['offset']+_0x35bbe0['limit'],_0x56b579;if(_0x31f9e8>=_0x49f7be){_0x31f9e8=_0x49f7be;_0x56b579=0xc8;}else{_0x56b579=0xce;}_0x15665f['status'](_0x56b579);return _0x15665f['set'](_0x4669('0x26'),_0x45e97c+'-'+_0x31f9e8+'/'+_0x49f7be)['json'](_0x4d7379);}return null;};}function patchUpdates(_0x27b4c5){return function(_0xd23e17){try{jsonpatch[_0x4669('0x27')](_0xd23e17,_0x27b4c5,!![]);}catch(_0x5af442){return BPromise['reject'](_0x5af442);}return _0xd23e17[_0x4669('0x28')]();};}function saveUpdates(_0x515396,_0x28be54){return function(_0x54f212){if(_0x54f212){return _0x54f212['update'](_0x515396)[_0x4669('0x29')](function(_0x161a0f){return _0x161a0f;});}return null;};}function removeEntity(_0x2130ae,_0xf11e44){return function(_0x11ddf4){if(_0x11ddf4){return _0x11ddf4[_0x4669('0x2a')]()['then'](function(){var _0x384ec1=_0x11ddf4[_0x4669('0x2b')]({'plain':!![]});var _0x4e1b74='OpenchannelQueues';return db[_0x4669('0x2c')]['destroy']({'where':{'type':_0x4e1b74,'resourceId':_0x384ec1['id']}})[_0x4669('0x29')](function(){return _0x11ddf4;});})[_0x4669('0x29')](function(){_0x2130ae[_0x4669('0x22')](0xcc)[_0x4669('0x23')]();});}};}function handleEntityNotFound(_0xeaf190,_0x37bb1b){return function(_0x18e1f5){if(!_0x18e1f5){_0xeaf190['sendStatus'](0x194);}return _0x18e1f5;};}function handleError(_0x1aee6a,_0x1bb52f){_0x1bb52f=_0x1bb52f||0x1f4;return function(_0x20b506){logger['error'](_0x20b506['stack']);if(_0x20b506[_0x4669('0x2d')]){delete _0x20b506[_0x4669('0x2d')];}_0x1aee6a['status'](_0x1bb52f)[_0x4669('0x2e')](_0x20b506);};}exports[_0x4669('0x2f')]=function(_0x45e68a,_0x24ed7a){var _0x1b2a32={},_0x540928={},_0x1018d4={'count':0x0,'rows':[]};var _0x29c6da=_[_0x4669('0x30')](db['OpenchannelQueue'][_0x4669('0x31')],function(_0x4d70af){return{'name':_0x4d70af[_0x4669('0x32')],'type':_0x4d70af[_0x4669('0x33')][_0x4669('0x34')]};});_0x540928[_0x4669('0x35')]=_[_0x4669('0x30')](_0x29c6da,'name');_0x540928['query']=_['keys'](_0x45e68a[_0x4669('0x36')]);_0x540928[_0x4669('0x37')]=_[_0x4669('0x38')](_0x540928[_0x4669('0x35')],_0x540928[_0x4669('0x36')]);_0x1b2a32['attributes']=_[_0x4669('0x38')](_0x540928[_0x4669('0x35')],qs['fields'](_0x45e68a[_0x4669('0x36')][_0x4669('0x39')]));_0x1b2a32[_0x4669('0x3a')]=_0x1b2a32[_0x4669('0x3a')]['length']?_0x1b2a32['attributes']:_0x540928['model'];if(!_0x45e68a['query'][_0x4669('0x3b')]('nolimit')){_0x1b2a32[_0x4669('0x3c')]=qs[_0x4669('0x3c')](_0x45e68a[_0x4669('0x36')][_0x4669('0x3c')]);_0x1b2a32[_0x4669('0x3d')]=qs[_0x4669('0x3d')](_0x45e68a[_0x4669('0x36')][_0x4669('0x3d')]);}_0x1b2a32[_0x4669('0x3e')]=qs['sort'](_0x45e68a['query'][_0x4669('0x3f')]);_0x1b2a32[_0x4669('0x40')]=qs[_0x4669('0x37')](_[_0x4669('0x41')](_0x45e68a[_0x4669('0x36')],_0x540928[_0x4669('0x37')]),_0x29c6da);if(_0x45e68a[_0x4669('0x36')][_0x4669('0x42')]){_0x1b2a32[_0x4669('0x40')]=_['merge'](_0x1b2a32['where'],{'$or':_['map'](_0x29c6da,function(_0x85bc6e){if(_0x85bc6e[_0x4669('0x33')]!==_0x4669('0x43')){var _0x1cfc58={};_0x1cfc58[_0x85bc6e[_0x4669('0x2d')]]={'$like':'%'+_0x45e68a[_0x4669('0x36')]['filter']+'%'};return _0x1cfc58;}})});}_0x1b2a32=_[_0x4669('0x44')]({},_0x1b2a32,_0x45e68a['options']);var _0x1dfda9={'where':_0x1b2a32[_0x4669('0x40')]};return db[_0x4669('0x45')]['count'](_0x1dfda9)[_0x4669('0x29')](function(_0x1dad6f){_0x1018d4[_0x4669('0x25')]=_0x1dad6f;if(_0x45e68a['query']['includeAll']){_0x1b2a32[_0x4669('0x46')]=[{'all':!![]}];}return db[_0x4669('0x45')][_0x4669('0x47')](_0x1b2a32);})[_0x4669('0x29')](function(_0x4409af){_0x1018d4[_0x4669('0x48')]=_0x4409af;return _0x1018d4;})[_0x4669('0x29')](respondWithFilteredResult(_0x24ed7a,_0x1b2a32))[_0x4669('0x49')](handleError(_0x24ed7a,null));};exports[_0x4669('0x4a')]=function(_0x38e079,_0x27fc0c){var _0x5cf400={'raw':!![],'where':{'id':_0x38e079[_0x4669('0x4b')]['id']}},_0x18de6f={};_0x18de6f[_0x4669('0x35')]=_[_0x4669('0x4c')](db[_0x4669('0x45')][_0x4669('0x31')]);_0x18de6f[_0x4669('0x36')]=_[_0x4669('0x4c')](_0x38e079[_0x4669('0x36')]);_0x18de6f[_0x4669('0x37')]=_[_0x4669('0x38')](_0x18de6f[_0x4669('0x35')],_0x18de6f[_0x4669('0x36')]);_0x5cf400[_0x4669('0x3a')]=_['intersection'](_0x18de6f[_0x4669('0x35')],qs['fields'](_0x38e079['query'][_0x4669('0x39')]));_0x5cf400[_0x4669('0x3a')]=_0x5cf400['attributes']['length']?_0x5cf400[_0x4669('0x3a')]:_0x18de6f[_0x4669('0x35')];if(_0x38e079['query'][_0x4669('0x4d')]){_0x5cf400[_0x4669('0x46')]=[{'all':!![]}];}_0x5cf400=_['merge']({},_0x5cf400,_0x38e079['options']);return db[_0x4669('0x45')]['find'](_0x5cf400)[_0x4669('0x29')](handleEntityNotFound(_0x27fc0c,null))['then'](respondWithResult(_0x27fc0c,null))[_0x4669('0x49')](handleError(_0x27fc0c,null));};exports['create']=function(_0xd9825d,_0x154b0d){return db[_0x4669('0x45')][_0x4669('0x4e')](_0xd9825d[_0x4669('0x4f')],{})[_0x4669('0x29')](function(_0xcea800){var _0x78b63=_0xd9825d[_0x4669('0x50')][_0x4669('0x2b')]({'plain':!![]});if(!_0x78b63)throw new Error(_0x4669('0x51'));if(_0x78b63[_0x4669('0x52')]===_0x4669('0x50')){var _0x4e5edf=_0xcea800[_0x4669('0x2b')]({'plain':!![]});var _0x1d9e72=_0x4669('0x53');return db['UserProfileSection'][_0x4669('0x54')]({'where':{'name':_0x1d9e72,'userProfileId':_0x78b63[_0x4669('0x55')]},'raw':!![]})['then'](function(_0x10d257){if(_0x10d257&&_0x10d257[_0x4669('0x56')]===0x0){return db[_0x4669('0x2c')][_0x4669('0x4e')]({'name':_0x4e5edf[_0x4669('0x2d')],'resourceId':_0x4e5edf['id'],'type':_0x10d257[_0x4669('0x2d')],'sectionId':_0x10d257['id']},{})[_0x4669('0x29')](function(){return _0xcea800;});}else{return _0xcea800;}})[_0x4669('0x49')](function(_0x55e886){logger[_0x4669('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55e886);throw _0x55e886;});}return _0xcea800;})['then'](respondWithResult(_0x154b0d,0xc9))[_0x4669('0x49')](handleError(_0x154b0d,null));};exports[_0x4669('0x58')]=function(_0x27f298,_0x1f05c1){if(_0x27f298[_0x4669('0x4f')]['id']){delete _0x27f298[_0x4669('0x4f')]['id'];}return db[_0x4669('0x45')]['find']({'where':{'id':_0x27f298[_0x4669('0x4b')]['id']}})[_0x4669('0x29')](handleEntityNotFound(_0x1f05c1,null))[_0x4669('0x29')](saveUpdates(_0x27f298[_0x4669('0x4f')],null))[_0x4669('0x29')](respondWithResult(_0x1f05c1,null))['catch'](handleError(_0x1f05c1,null));};exports[_0x4669('0x2a')]=function(_0x2f1f15,_0xdcc58d){return db['OpenchannelQueue']['find']({'where':{'id':_0x2f1f15[_0x4669('0x4b')]['id']}})['then'](handleEntityNotFound(_0xdcc58d,null))[_0x4669('0x29')](removeEntity(_0xdcc58d,null))[_0x4669('0x49')](handleError(_0xdcc58d,null));};exports[_0x4669('0x59')]=function(_0x4bb125,_0x5667af){return db[_0x4669('0x45')]['describe']()['then'](respondWithResult(_0x5667af,null))[_0x4669('0x49')](handleError(_0x5667af,null));};exports['getMembers']=function(_0xf7fe66,_0x22d702,_0x468285){var _0x283787={'raw':!![],'where':{}},_0x59ff32={},_0x41617e;return db[_0x4669('0x45')][_0x4669('0x5a')]({'where':{'id':_0xf7fe66[_0x4669('0x4b')]['id']}})[_0x4669('0x29')](handleEntityNotFound(_0x22d702,null))['then'](function(_0x398d66){if(_0x398d66){_0x41617e=_0x398d66['get']({'plain':!![]});_0x59ff32['model']=_[_0x4669('0x4c')](db[_0x4669('0x5b')]['rawAttributes']);_0x59ff32['query']=_[_0x4669('0x4c')](_0xf7fe66['query']);_0x59ff32[_0x4669('0x37')]=_[_0x4669('0x38')](_0x59ff32['model'],_0x59ff32['query']);_0x283787[_0x4669('0x3a')]=_['intersection'](_0x59ff32[_0x4669('0x35')],qs[_0x4669('0x39')](_0xf7fe66['query']['fields']));_0x283787[_0x4669('0x3a')]=_0x283787[_0x4669('0x3a')][_0x4669('0x5c')]?_0x283787[_0x4669('0x3a')]:_0x59ff32[_0x4669('0x35')];if(!_0xf7fe66[_0x4669('0x36')][_0x4669('0x3b')]('nolimit')){_0x283787['limit']=qs[_0x4669('0x3c')](_0xf7fe66[_0x4669('0x36')][_0x4669('0x3c')]);_0x283787[_0x4669('0x3d')]=qs[_0x4669('0x3d')](_0xf7fe66[_0x4669('0x36')]['offset']);}_0x283787['order']=qs[_0x4669('0x3f')](_0xf7fe66['query'][_0x4669('0x3f')]);_0x283787[_0x4669('0x40')]=qs[_0x4669('0x37')](_[_0x4669('0x41')](_0xf7fe66[_0x4669('0x36')],_0x59ff32[_0x4669('0x37')]));_0x283787[_0x4669('0x40')][_0x4669('0x5d')]=_0x398d66['id'];if(_0xf7fe66['query'][_0x4669('0x42')]){_0x283787[_0x4669('0x40')]=_[_0x4669('0x44')](_0x283787[_0x4669('0x40')],{'$or':_['map'](_0x283787[_0x4669('0x3a')],function(_0x11e4df){var _0xc14f8d={};_0xc14f8d[_0x11e4df]={'$like':'%'+_0xf7fe66[_0x4669('0x36')][_0x4669('0x42')]+'%'};return _0xc14f8d;})});}_0x283787=_[_0x4669('0x44')]({},_0x283787,_0xf7fe66[_0x4669('0x5e')]);return db[_0x4669('0x5b')][_0x4669('0x47')](_0x283787);}})[_0x4669('0x29')](function(_0x29c2a9){if(_0x29c2a9){return db[_0x4669('0x5f')][_0x4669('0x60')]({'where':{'id':_['map'](_0x29c2a9,_0x4669('0x61')),'role':_0x4669('0x62')},'attributes':['id',_0x4669('0x2d'),_0x4669('0x63'),_0x4669('0x64'),'createdAt']});}})[_0x4669('0x29')](function(_0x54b008){if(_0x54b008){return{'count':_0x54b008['count'],'rows':_[_0x4669('0x30')](_0x54b008['rows'],function(_0x4666bf){return{'membername':_0x4666bf[_0x4669('0x2d')],'UserId':_0x4666bf['id'],'queue_name':_0x41617e[_0x4669('0x2d')],'OpenchannelQueueId':_0x41617e['id'],'interface':util[_0x4669('0x65')](_0x4669('0x66'),_0x4669('0x67'),_0x4666bf[_0x4669('0x2d')]),'penalty':0x0,'paused':_0x4666bf[_0x4669('0x63')],'createdAt':_0x4666bf['createdAt'],'updatedAt':_0x4666bf['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4669('0x29')](respondWithFilteredResult(_0x22d702,_0x283787))[_0x4669('0x49')](handleError(_0x22d702,null));};exports[_0x4669('0x68')]=function(_0x22c91a,_0x409b84,_0x4068f0){var _0x321944={};var _0x114450={};var _0x52c4e3;var _0x536872;return db[_0x4669('0x45')][_0x4669('0x5a')]({'where':{'id':_0x22c91a[_0x4669('0x4b')]['id']}})['then'](handleEntityNotFound(_0x409b84,null))[_0x4669('0x29')](function(_0x1e99b8){if(_0x1e99b8){_0x52c4e3=_0x1e99b8;_0x114450[_0x4669('0x35')]=_[_0x4669('0x4c')](db[_0x4669('0x69')][_0x4669('0x31')]);_0x114450[_0x4669('0x36')]=_[_0x4669('0x4c')](_0x22c91a[_0x4669('0x36')]);_0x114450[_0x4669('0x37')]=_['intersection'](_0x114450[_0x4669('0x35')],_0x114450[_0x4669('0x36')]);_0x321944['attributes']=_[_0x4669('0x38')](_0x114450[_0x4669('0x35')],qs[_0x4669('0x39')](_0x22c91a['query'][_0x4669('0x39')]));_0x321944[_0x4669('0x3a')]=_0x321944[_0x4669('0x3a')][_0x4669('0x5c')]?_0x321944[_0x4669('0x3a')]:_0x114450[_0x4669('0x35')];_0x321944['order']=qs[_0x4669('0x3f')](_0x22c91a[_0x4669('0x36')][_0x4669('0x3f')]);_0x321944[_0x4669('0x40')]=qs[_0x4669('0x37')](_['pick'](_0x22c91a[_0x4669('0x36')],_0x114450['filters']));if(_0x22c91a[_0x4669('0x36')][_0x4669('0x42')]){_0x321944[_0x4669('0x40')]=_[_0x4669('0x44')](_0x321944[_0x4669('0x40')],{'$or':_[_0x4669('0x30')](_0x321944['attributes'],function(_0x1cb6b9){var _0x5d3c05={};_0x5d3c05[_0x1cb6b9]={'$like':'%'+_0x22c91a['query'][_0x4669('0x42')]+'%'};return _0x5d3c05;})});}_0x321944=_[_0x4669('0x44')]({},_0x321944,_0x22c91a[_0x4669('0x5e')]);return _0x52c4e3['getTeams'](_0x321944);}})[_0x4669('0x29')](function(_0x214322){if(_0x214322){_0x536872=_0x214322[_0x4669('0x5c')];if(!_0x22c91a['query']['hasOwnProperty'](_0x4669('0x6a'))){_0x321944[_0x4669('0x3c')]=qs['limit'](_0x22c91a['query'][_0x4669('0x3c')]);_0x321944[_0x4669('0x3d')]=qs['offset'](_0x22c91a['query'][_0x4669('0x3d')]);}return _0x52c4e3[_0x4669('0x68')](_0x321944);}})[_0x4669('0x29')](function(_0x39f937){if(_0x39f937){return _0x39f937?{'count':_0x536872,'rows':_0x39f937}:null;}})['then'](respondWithResult(_0x409b84,null))[_0x4669('0x49')](handleError(_0x409b84,null));};exports['addTeams']=function(_0x169945,_0x386064,_0x4a3cb5){var _0x24eb89=_0x169945[_0x4669('0x4f')][_0x4669('0x6b')];return db[_0x4669('0x69')][_0x4669('0x47')]({'where':{'id':_0x24eb89},'attributes':['id'],'include':[{'model':db[_0x4669('0x5f')],'as':_0x4669('0x6c'),'attributes':['id','name',_0x4669('0x6d'),_0x4669('0x6e'),'interface'],'raw':!![]}]})[_0x4669('0x29')](function(_0x2984a1){if(_0x2984a1){var _0x2b32e2=_[_0x4669('0x6f')](_0x2984a1,function(_0x42531f){var _0x2e8a0c=_0x42531f['get']({'plain':!![]});return _0x2e8a0c[_0x4669('0x6c')];});return db[_0x4669('0x45')][_0x4669('0x54')]({'where':{'id':_0x169945[_0x4669('0x4b')]['id']}})['then'](function(_0x2e6f8e){return db[_0x4669('0x70')][_0x4669('0x71')](function(_0x4945d8){return _0x2e6f8e[_0x4669('0x72')](_0x24eb89,{'transaction':_0x4945d8})[_0x4669('0x29')](function(){return BPromise[_0x4669('0x73')](_0x2b32e2,function(_0x27c5ad){return db[_0x4669('0x5b')]['findOrCreate']({'where':{'UserId':_0x27c5ad['id'],'OpenchannelQueueId':_0x169945[_0x4669('0x4b')]['id']},'transaction':_0x4945d8});});})[_0x4669('0x29')](function(){_0x2b32e2['forEach'](function(_0x4286c7){socket[_0x4669('0x74')](_0x4669('0x75'),{'UserId':_0x4286c7['id'],'OpenchannelQueueId':_0x2e6f8e['id']});});});});});}})[_0x4669('0x29')](respondWithStatusCode(_0x386064,null))[_0x4669('0x49')](handleError(_0x386064,null));};exports[_0x4669('0x76')]=function(_0x37631b,_0x4c9a07,_0x8c4c12){return db['Team'][_0x4669('0x47')]({'where':{'id':_0x37631b[_0x4669('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4669('0x5f')],'as':_0x4669('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c9a07,null))[_0x4669('0x29')](function(_0x1444ca){var _0x2233d5=_['map'](_0x1444ca,'id');var _0x4435bf=[];var _0x41ba87=[];var _0x20491a=squel[_0x4669('0x77')]();_0x20491a[_0x4669('0x78')](_0x4669('0x79'))['from'](_0x4669('0x7a'),'tq')[_0x4669('0x7b')](_0x4669('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4669('0x40')]('OpenchannelQueueId\x20=\x20?',_0x37631b[_0x4669('0x4b')]['id']);for(var _0x5473c8=0x0;_0x5473c8<_0x1444ca[_0x4669('0x5c')];_0x5473c8+=0x1){let _0x330022=_0x1444ca[_0x5473c8];for(var _0x52d8d5=0x0;_0x52d8d5<_0x330022[_0x4669('0x6c')][_0x4669('0x5c')];_0x52d8d5+=0x1){let _0xaa6fd8=_0x330022[_0x4669('0x6c')][_0x52d8d5];var _0x126ddd=_0x20491a['clone']();_0x126ddd[_0x4669('0x40')](_0x4669('0x7d'),_0xaa6fd8['id']);_0x41ba87[_0x4669('0x7e')](db['sequelize']['query'](_0x126ddd[_0x4669('0x7f')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x4669('0x29')](function(_0x4a4e96){if(_0x4a4e96[_0x4669('0x5c')]===0x1){return _0xaa6fd8['id'];}else{var _0x4d5a47=_[_0x4669('0x80')](_[_0x4669('0x30')](_0x4a4e96,'TeamId'),function(_0x180078){return _[_0x4669('0x81')](_0x2233d5,_0x180078);});if(_0x4d5a47){return _0xaa6fd8['id'];}}}));}}return BPromise['all'](_0x41ba87)[_0x4669('0x29')](function(_0x5b907b){_0x4435bf=_(_0x4435bf)[_0x4669('0x82')](_0x5b907b)[_0x4669('0x83')]()[_0x4669('0x84')]();return db['OpenchannelQueue'][_0x4669('0x54')]({'where':{'id':_0x37631b[_0x4669('0x4b')]['id']}})[_0x4669('0x29')](function(_0x2168c3){return db[_0x4669('0x70')][_0x4669('0x71')](function(_0x3fa14c){return _0x2168c3['removeTeams'](_0x37631b[_0x4669('0x36')][_0x4669('0x6b')],{'transaction':_0x3fa14c})[_0x4669('0x29')](function(){if(!_[_0x4669('0x85')](_0x4435bf)){return _0x2168c3[_0x4669('0x86')](_0x4435bf,{'transaction':_0x3fa14c});}})[_0x4669('0x29')](function(){_0x4435bf[_0x4669('0x87')](function(_0x587490){socket[_0x4669('0x74')](_0x4669('0x88'),{'UserId':_0x587490,'OpenchannelQueueId':_0x2168c3['id']});});});});});});})[_0x4669('0x29')](respondWithStatusCode(_0x4c9a07,null))[_0x4669('0x49')](handleError(_0x4c9a07,null));};exports['addAgents']=function(_0x413ba2,_0x28429e,_0xafe021){return db['OpenchannelQueue'][_0x4669('0x54')]({'where':{'id':_0x413ba2[_0x4669('0x4b')]['id']}})[_0x4669('0x29')](handleEntityNotFound(_0x28429e,null))[_0x4669('0x29')](function(_0x392736){if(_0x392736){return _0x392736[_0x4669('0x89')](_0x413ba2['body']['ids'],_[_0x4669('0x8a')](_0x413ba2[_0x4669('0x4f')],[_0x4669('0x6b'),'id'])||{})['spread'](function(_0x5d11e3){for(var _0x1f5285=0x0;_0x1f5285<_0x413ba2[_0x4669('0x4f')][_0x4669('0x6b')]['length'];_0x1f5285+=0x1){socket[_0x4669('0x74')]('userOpenchannelQueue:save',{'UserId':_0x413ba2[_0x4669('0x4f')][_0x4669('0x6b')][_0x1f5285],'OpenchannelQueueId':_0x413ba2[_0x4669('0x4b')]['id']});}return _0x5d11e3;});}})[_0x4669('0x29')](respondWithResult(_0x28429e,null))[_0x4669('0x49')](handleError(_0x28429e,null));};exports[_0x4669('0x86')]=function(_0x228277,_0xcd3ee2,_0x33d7d2){return db[_0x4669('0x45')][_0x4669('0x54')]({'where':{'id':_0x228277['params']['id']}})[_0x4669('0x29')](handleEntityNotFound(_0xcd3ee2,null))[_0x4669('0x29')](function(_0x47febb){if(_0x47febb){return _0x47febb[_0x4669('0x86')](_0x228277[_0x4669('0x36')][_0x4669('0x6b')])[_0x4669('0x29')](function(){if(_[_0x4669('0x8b')](_0x228277['query'][_0x4669('0x6b')])){for(var _0x4c3711=0x0;_0x4c3711<_0x228277[_0x4669('0x36')][_0x4669('0x6b')][_0x4669('0x5c')];_0x4c3711+=0x1){socket[_0x4669('0x74')](_0x4669('0x88'),{'UserId':Number(_0x228277[_0x4669('0x36')]['ids'][_0x4c3711]),'OpenchannelQueueId':Number(_0x228277['params']['id'])});}}else{socket[_0x4669('0x74')](_0x4669('0x88'),{'UserId':Number(_0x228277[_0x4669('0x36')][_0x4669('0x6b')]),'OpenchannelQueueId':Number(_0x228277[_0x4669('0x4b')]['id'])});}});}})[_0x4669('0x29')](respondWithStatusCode(_0xcd3ee2,null))[_0x4669('0x49')](handleError(_0xcd3ee2,null));};exports[_0x4669('0x8c')]=function(_0x17f749,_0xb9d174,_0x3c2407){var _0x42ae12={};var _0xab0610={};var _0x507834;var _0x578a61;return db[_0x4669('0x45')][_0x4669('0x5a')]({'where':{'id':_0x17f749[_0x4669('0x4b')]['id']}})[_0x4669('0x29')](handleEntityNotFound(_0xb9d174,null))[_0x4669('0x29')](function(_0x9ec0b1){if(_0x9ec0b1){_0x507834=_0x9ec0b1;_0xab0610['model']=_[_0x4669('0x4c')](db[_0x4669('0x5f')]['rawAttributes']);_0xab0610[_0x4669('0x36')]=_['keys'](_0x17f749[_0x4669('0x36')]);_0xab0610['filters']=_['intersection'](_0xab0610[_0x4669('0x35')],_0xab0610['query']);_0x42ae12[_0x4669('0x3a')]=_[_0x4669('0x38')](_0xab0610['model'],qs[_0x4669('0x39')](_0x17f749[_0x4669('0x36')][_0x4669('0x39')]));_0x42ae12[_0x4669('0x3a')]=_0x42ae12['attributes'][_0x4669('0x5c')]?_0x42ae12['attributes']:_0xab0610[_0x4669('0x35')];_0x42ae12[_0x4669('0x3e')]=qs[_0x4669('0x3f')](_0x17f749[_0x4669('0x36')]['sort']);_0x42ae12[_0x4669('0x40')]=qs[_0x4669('0x37')](_[_0x4669('0x41')](_0x17f749['query'],_0xab0610[_0x4669('0x37')]));if(_0x17f749[_0x4669('0x36')][_0x4669('0x42')]){_0x42ae12['where']=_[_0x4669('0x44')](_0x42ae12[_0x4669('0x40')],{'$or':_[_0x4669('0x30')](_0x42ae12[_0x4669('0x3a')],function(_0x439184){var _0x42b57e={};_0x42b57e[_0x439184]={'$like':'%'+_0x17f749[_0x4669('0x36')]['filter']+'%'};return _0x42b57e;})});}_0x42ae12=_[_0x4669('0x44')]({},_0x42ae12,_0x17f749[_0x4669('0x5e')]);return _0x507834[_0x4669('0x8c')](_0x42ae12);}})[_0x4669('0x29')](function(_0x32b358){if(_0x32b358){_0x578a61=_0x32b358[_0x4669('0x5c')];if(!_0x17f749['query'][_0x4669('0x3b')](_0x4669('0x6a'))){_0x42ae12[_0x4669('0x3c')]=qs[_0x4669('0x3c')](_0x17f749[_0x4669('0x36')][_0x4669('0x3c')]);_0x42ae12['offset']=qs[_0x4669('0x3d')](_0x17f749[_0x4669('0x36')][_0x4669('0x3d')]);}return _0x507834[_0x4669('0x8c')](_0x42ae12);}})[_0x4669('0x29')](function(_0xa1b66e){if(_0xa1b66e){return _0xa1b66e?{'count':_0x578a61,'rows':_0xa1b66e}:null;}})[_0x4669('0x29')](respondWithResult(_0xb9d174,null))[_0x4669('0x49')](handleError(_0xb9d174,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index ffa211b..f1307b4 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 _0xc753=['emit','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove'];(function(_0x2b13ab,_0x3e916f){var _0x1c96ce=function(_0x17e515){while(--_0x17e515){_0x2b13ab['push'](_0x2b13ab['shift']());}};_0x1c96ce(++_0x3e916f);}(_0xc753,0xd5));var _0x3c75=function(_0x35ace4,_0x3e2a5a){_0x35ace4=_0x35ace4-0x0;var _0x1dd6a0=_0xc753[_0x35ace4];return _0x1dd6a0;};'use strict';var EventEmitter=require(_0x3c75('0x0'));var OpenchannelQueue=require(_0x3c75('0x1'))['db'][_0x3c75('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3c75('0x3')](0x0);var events={'afterCreate':_0x3c75('0x4'),'afterUpdate':_0x3c75('0x5'),'afterDestroy':_0x3c75('0x6')};function emitEvent(_0x4c7933){return function(_0x41ecf1,_0x34ce4d,_0x5d2228){OpenchannelQueueEvents[_0x3c75('0x7')](_0x4c7933+':'+_0x41ecf1['id'],_0x41ecf1);OpenchannelQueueEvents[_0x3c75('0x7')](_0x4c7933,_0x41ecf1);_0x5d2228(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x3c75('0x8')](e,emitEvent(event));}}module[_0x3c75('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x0746=['update','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x418b55,_0x460d11){var _0x4a05c7=function(_0x1dae95){while(--_0x1dae95){_0x418b55['push'](_0x418b55['shift']());}};_0x4a05c7(++_0x460d11);}(_0x0746,0xfa));var _0x6074=function(_0x1f222c,_0x33603a){_0x1f222c=_0x1f222c-0x0;var _0xa42cb1=_0x0746[_0x1f222c];return _0xa42cb1;};'use strict';var EventEmitter=require(_0x6074('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6074('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6074('0x2'),'afterDestroy':'remove'};function emitEvent(_0x142f13){return function(_0x26b88e,_0x3c9d68,_0x576e20){OpenchannelQueueEvents[_0x6074('0x3')](_0x142f13+':'+_0x26b88e['id'],_0x26b88e);OpenchannelQueueEvents[_0x6074('0x3')](_0x142f13,_0x26b88e);_0x576e20(null);};}for(var e in events){if(events[_0x6074('0x4')](e)){var event=events[e];OpenchannelQueue[_0x6074('0x5')](e,emitEvent(event));}}module[_0x6074('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 26886a8..78c4e10 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 _0x7709=['../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','bluebird','rimraf'];(function(_0x3d8995,_0x5f4f4b){var _0x5dd8ed=function(_0x55e159){while(--_0x55e159){_0x3d8995['push'](_0x3d8995['shift']());}};_0x5dd8ed(++_0x5f4f4b);}(_0x7709,0xb0));var _0x9770=function(_0x243f09,_0x3b37a2){_0x243f09=_0x243f09-0x0;var _0x1fb8f3=_0x7709[_0x243f09];return _0x1fb8f3;};'use strict';var _=require('lodash');var util=require(_0x9770('0x0'));var logger=require(_0x9770('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9770('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9770('0x3'));var config=require(_0x9770('0x4'));var attributes=require(_0x9770('0x5'));module['exports']=function(_0x480b83,_0x4098dd){return _0x480b83[_0x9770('0x6')](_0x9770('0x7'),attributes,{'tableName':_0x9770('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7acf=['request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','util','api','moment','bluebird'];(function(_0x2df182,_0xfa060d){var _0x2240eb=function(_0x222c60){while(--_0x222c60){_0x2df182['push'](_0x2df182['shift']());}};_0x2240eb(++_0xfa060d);}(_0x7acf,0x8b));var _0xf7ac=function(_0x3d0112,_0x5adb56){_0x3d0112=_0x3d0112-0x0;var _0x1a769b=_0x7acf[_0x3d0112];return _0x1a769b;};'use strict';var _=require('lodash');var util=require(_0xf7ac('0x0'));var logger=require('../../config/logger')(_0xf7ac('0x1'));var moment=require(_0xf7ac('0x2'));var BPromise=require(_0xf7ac('0x3'));var rp=require(_0xf7ac('0x4'));var fs=require('fs');var path=require(_0xf7ac('0x5'));var rimraf=require('rimraf');var config=require(_0xf7ac('0x6'));var attributes=require(_0xf7ac('0x7'));module[_0xf7ac('0x8')]=function(_0x104fb7,_0xd51454){return _0x104fb7['define'](_0xf7ac('0x9'),attributes,{'tableName':_0xf7ac('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 352e142..4d24a66 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 _0x2ff1=['http','redis','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','map','model','attributes','where','ShowOpenchannelQueue','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ff1,0x13b));var _0x12ff=function(_0x399f3f,_0x520a9e){_0x399f3f=_0x399f3f-0x0;var _0x48d8c5=_0x2ff1[_0x399f3f];return _0x48d8c5;};'use strict';var _=require(_0x12ff('0x0'));var util=require(_0x12ff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12ff('0x2'));var db=require(_0x12ff('0x3'))['db'];var utils=require(_0x12ff('0x4'));var logger=require(_0x12ff('0x5'))(_0x12ff('0x6'));var config=require(_0x12ff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x12ff('0x8')][_0x12ff('0x9')]({'port':0x232a});config[_0x12ff('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x12ff('0xb')](socket);function respondWithRpcPromise(_0x9a5a42,_0x4648ad,_0x4f61ec){return new BPromise(function(_0x4005b8,_0xd0c714){return client[_0x12ff('0xc')](_0x9a5a42,_0x4f61ec)[_0x12ff('0xd')](function(_0xe089c2){logger[_0x12ff('0xe')](_0x12ff('0xf'),_0x4648ad,_0x12ff('0x10'));logger[_0x12ff('0x11')](_0x12ff('0x12'),_0x4648ad,_0x12ff('0x10'),JSON[_0x12ff('0x13')](_0xe089c2));if(_0xe089c2[_0x12ff('0x14')]){if(_0xe089c2[_0x12ff('0x14')]['code']===0x1f4){logger[_0x12ff('0x14')](_0x12ff('0xf'),_0x4648ad,_0xe089c2[_0x12ff('0x14')][_0x12ff('0x15')]);return _0xd0c714(_0xe089c2[_0x12ff('0x14')][_0x12ff('0x15')]);}logger[_0x12ff('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x4648ad,_0xe089c2[_0x12ff('0x14')][_0x12ff('0x15')]);return _0x4005b8(_0xe089c2[_0x12ff('0x14')][_0x12ff('0x15')]);}else{logger[_0x12ff('0xe')](_0x12ff('0xf'),_0x4648ad,'request\x20sent');_0x4005b8(_0xe089c2[_0x12ff('0x16')]['message']);}})[_0x12ff('0x17')](function(_0x4c160e){logger[_0x12ff('0x14')](_0x12ff('0xf'),_0x4648ad,_0x4c160e);_0xd0c714(_0x4c160e);});});}exports[_0x12ff('0x18')]=function(_0x1bef99){var _0xde7b3=this;return new Promise(function(_0xf859d5,_0x13ae88){return db[_0x12ff('0x19')][_0x12ff('0x1a')]({'raw':_0x1bef99[_0x12ff('0x1b')]?_0x1bef99['options'][_0x12ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x1bef99[_0x12ff('0x1b')]?_0x1bef99[_0x12ff('0x1b')]['where']||null:null,'attributes':_0x1bef99[_0x12ff('0x1b')]?_0x1bef99[_0x12ff('0x1b')]['attributes']||null:null,'limit':_0x1bef99['options']?_0x1bef99[_0x12ff('0x1b')][_0x12ff('0x1d')]||null:null,'include':_0x1bef99['options']?_0x1bef99['options'][_0x12ff('0x1e')]?_[_0x12ff('0x1f')](_0x1bef99['options'][_0x12ff('0x1e')],function(_0x162628){return{'model':db[_0x162628[_0x12ff('0x20')]],'as':_0x162628['as'],'attributes':_0x162628['attributes'],'include':_0x162628[_0x12ff('0x1e')]?_[_0x12ff('0x1f')](_0x162628[_0x12ff('0x1e')],function(_0x44b62c){return{'model':db[_0x44b62c['model']],'as':_0x44b62c['as'],'attributes':_0x44b62c[_0x12ff('0x21')],'include':_0x44b62c[_0x12ff('0x1e')]?_[_0x12ff('0x1f')](_0x44b62c['include'],function(_0x568158){return{'model':db[_0x568158[_0x12ff('0x20')]],'as':_0x568158['as'],'attributes':_0x568158['attributes']};}):[]};}):[]};}):[]:[]})[_0x12ff('0xd')](function(_0x26fccf){logger[_0x12ff('0xe')](_0x12ff('0x18'),_0x1bef99);logger[_0x12ff('0x11')](_0x12ff('0x18'),_0x1bef99,JSON['stringify'](_0x26fccf));_0xf859d5(_0x26fccf);})[_0x12ff('0x17')](function(_0x351483){logger[_0x12ff('0x14')](_0x12ff('0x18'),_0x351483[_0x12ff('0x15')],_0x1bef99);_0x13ae88(_0xde7b3['error'](0x1f4,_0x351483['message']));});});};exports['ShowOpenchannelQueue']=function(_0x5665b6){var _0x5ddb74=this;return new Promise(function(_0x385cea,_0x1699ee){return db['OpenchannelQueue']['find']({'raw':_0x5665b6['options']?_0x5665b6[_0x12ff('0x1b')][_0x12ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x5665b6['options']?_0x5665b6[_0x12ff('0x1b')][_0x12ff('0x22')]||null:null,'attributes':_0x5665b6[_0x12ff('0x1b')]?_0x5665b6[_0x12ff('0x1b')]['attributes']||null:null,'include':_0x5665b6['options']?_0x5665b6[_0x12ff('0x1b')][_0x12ff('0x1e')]?_['map'](_0x5665b6[_0x12ff('0x1b')]['include'],function(_0x127e1f){return{'model':db[_0x127e1f[_0x12ff('0x20')]],'as':_0x127e1f['as'],'attributes':_0x127e1f[_0x12ff('0x21')],'include':_0x127e1f[_0x12ff('0x1e')]?_[_0x12ff('0x1f')](_0x127e1f['include'],function(_0xb55b08){return{'model':db[_0xb55b08['model']],'as':_0xb55b08['as'],'attributes':_0xb55b08[_0x12ff('0x21')],'include':_0xb55b08[_0x12ff('0x1e')]?_[_0x12ff('0x1f')](_0xb55b08['include'],function(_0x32ae7a){return{'model':db[_0x32ae7a[_0x12ff('0x20')]],'as':_0x32ae7a['as'],'attributes':_0x32ae7a[_0x12ff('0x21')]};}):[]};}):[]};}):[]:[]})[_0x12ff('0xd')](function(_0x2a304d){logger[_0x12ff('0xe')](_0x12ff('0x23'),_0x5665b6);logger[_0x12ff('0x11')](_0x12ff('0x23'),_0x5665b6,JSON[_0x12ff('0x13')](_0x2a304d));_0x385cea(_0x2a304d);})[_0x12ff('0x17')](function(_0x1676ab){logger[_0x12ff('0x14')](_0x12ff('0x23'),_0x1676ab[_0x12ff('0x15')],_0x5665b6);_0x1699ee(_0x5ddb74[_0x12ff('0x14')](0x1f4,_0x1676ab['message']));});});}; \ No newline at end of file +var _0xa174=['find','ShowOpenchannelQueue','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','./openchannelQueue.socket','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xa174,0xda));var _0x4a17=function(_0x4722df,_0x5052d4){_0x4722df=_0x4722df-0x0;var _0x456ddb=_0xa174[_0x4722df];return _0x456ddb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4a17('0x0'));var BPromise=require(_0x4a17('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a17('0x2'));var db=require(_0x4a17('0x3'))['db'];var utils=require(_0x4a17('0x4'));var logger=require('../../config/logger')(_0x4a17('0x5'));var config=require(_0x4a17('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4a17('0x7')]['http']({'port':0x232a});config[_0x4a17('0x8')]=_[_0x4a17('0x9')](config[_0x4a17('0x8')],{'host':_0x4a17('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a17('0x8')]));require(_0x4a17('0xb'))['register'](socket);function respondWithRpcPromise(_0x5adc71,_0x515ab5,_0x1d88dd){return new BPromise(function(_0x5ec3ac,_0x56d81c){return client['request'](_0x5adc71,_0x1d88dd)[_0x4a17('0xc')](function(_0x17891c){logger[_0x4a17('0xd')]('OpenchannelQueue,\x20%s,\x20%s',_0x515ab5,_0x4a17('0xe'));logger[_0x4a17('0xf')](_0x4a17('0x10'),_0x515ab5,_0x4a17('0xe'),JSON[_0x4a17('0x11')](_0x17891c));if(_0x17891c[_0x4a17('0x12')]){if(_0x17891c[_0x4a17('0x12')][_0x4a17('0x13')]===0x1f4){logger['error'](_0x4a17('0x14'),_0x515ab5,_0x17891c['error'][_0x4a17('0x15')]);return _0x56d81c(_0x17891c['error'][_0x4a17('0x15')]);}logger[_0x4a17('0x12')](_0x4a17('0x14'),_0x515ab5,_0x17891c[_0x4a17('0x12')]['message']);return _0x5ec3ac(_0x17891c[_0x4a17('0x12')][_0x4a17('0x15')]);}else{logger[_0x4a17('0xd')](_0x4a17('0x14'),_0x515ab5,_0x4a17('0xe'));_0x5ec3ac(_0x17891c['result'][_0x4a17('0x15')]);}})['catch'](function(_0x396fbd){logger[_0x4a17('0x12')](_0x4a17('0x14'),_0x515ab5,_0x396fbd);_0x56d81c(_0x396fbd);});});}exports[_0x4a17('0x16')]=function(_0x51866c){var _0x2cb728=this;return new Promise(function(_0x2667cd,_0x382988){return db[_0x4a17('0x17')][_0x4a17('0x18')]({'raw':_0x51866c[_0x4a17('0x19')]?_0x51866c['options'][_0x4a17('0x1a')]===undefined?!![]:![]:!![],'where':_0x51866c[_0x4a17('0x19')]?_0x51866c[_0x4a17('0x19')][_0x4a17('0x1b')]||null:null,'attributes':_0x51866c[_0x4a17('0x19')]?_0x51866c['options'][_0x4a17('0x1c')]||null:null,'limit':_0x51866c[_0x4a17('0x19')]?_0x51866c[_0x4a17('0x19')][_0x4a17('0x1d')]||null:null,'include':_0x51866c[_0x4a17('0x19')]?_0x51866c[_0x4a17('0x19')][_0x4a17('0x1e')]?_[_0x4a17('0x1f')](_0x51866c[_0x4a17('0x19')][_0x4a17('0x1e')],function(_0x24ab27){return{'model':db[_0x24ab27['model']],'as':_0x24ab27['as'],'attributes':_0x24ab27['attributes'],'include':_0x24ab27[_0x4a17('0x1e')]?_['map'](_0x24ab27[_0x4a17('0x1e')],function(_0x3285fc){return{'model':db[_0x3285fc[_0x4a17('0x20')]],'as':_0x3285fc['as'],'attributes':_0x3285fc[_0x4a17('0x1c')],'include':_0x3285fc[_0x4a17('0x1e')]?_['map'](_0x3285fc[_0x4a17('0x1e')],function(_0xe080e2){return{'model':db[_0xe080e2[_0x4a17('0x20')]],'as':_0xe080e2['as'],'attributes':_0xe080e2[_0x4a17('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4a17('0xc')](function(_0x21fa5b){logger[_0x4a17('0xd')](_0x4a17('0x16'),_0x51866c);logger['debug'](_0x4a17('0x16'),_0x51866c,JSON[_0x4a17('0x11')](_0x21fa5b));_0x2667cd(_0x21fa5b);})[_0x4a17('0x21')](function(_0x3cfda3){logger[_0x4a17('0x12')](_0x4a17('0x16'),_0x3cfda3['message'],_0x51866c);_0x382988(_0x2cb728['error'](0x1f4,_0x3cfda3[_0x4a17('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x425e71){var _0x194440=this;return new Promise(function(_0x47c743,_0x2ebbc9){return db[_0x4a17('0x17')][_0x4a17('0x22')]({'raw':_0x425e71[_0x4a17('0x19')]?_0x425e71[_0x4a17('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x425e71[_0x4a17('0x19')]?_0x425e71[_0x4a17('0x19')][_0x4a17('0x1b')]||null:null,'attributes':_0x425e71[_0x4a17('0x19')]?_0x425e71[_0x4a17('0x19')][_0x4a17('0x1c')]||null:null,'include':_0x425e71[_0x4a17('0x19')]?_0x425e71[_0x4a17('0x19')][_0x4a17('0x1e')]?_[_0x4a17('0x1f')](_0x425e71[_0x4a17('0x19')]['include'],function(_0x3de2c5){return{'model':db[_0x3de2c5[_0x4a17('0x20')]],'as':_0x3de2c5['as'],'attributes':_0x3de2c5[_0x4a17('0x1c')],'include':_0x3de2c5[_0x4a17('0x1e')]?_[_0x4a17('0x1f')](_0x3de2c5[_0x4a17('0x1e')],function(_0x45b0c2){return{'model':db[_0x45b0c2[_0x4a17('0x20')]],'as':_0x45b0c2['as'],'attributes':_0x45b0c2[_0x4a17('0x1c')],'include':_0x45b0c2[_0x4a17('0x1e')]?_[_0x4a17('0x1f')](_0x45b0c2['include'],function(_0x58688e){return{'model':db[_0x58688e[_0x4a17('0x20')]],'as':_0x58688e['as'],'attributes':_0x58688e[_0x4a17('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4a17('0xc')](function(_0x6637fd){logger[_0x4a17('0xd')]('ShowOpenchannelQueue',_0x425e71);logger[_0x4a17('0xf')](_0x4a17('0x23'),_0x425e71,JSON[_0x4a17('0x11')](_0x6637fd));_0x47c743(_0x6637fd);})[_0x4a17('0x21')](function(_0x3aceab){logger[_0x4a17('0x12')](_0x4a17('0x23'),_0x3aceab[_0x4a17('0x15')],_0x425e71);_0x2ebbc9(_0x194440['error'](0x1f4,_0x3aceab[_0x4a17('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index ff22a04..3a6fad3 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 _0x33ca=['length','save','update','removeListener'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0x33ca,0x14d));var _0xa33c=function(_0x51ed47,_0x22857b){_0x51ed47=_0x51ed47-0x0;var _0xa77fb=_0x33ca[_0x51ed47];return _0xa77fb;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xa33c('0x0'),'remove',_0xa33c('0x1')];function createListener(_0x161e26,_0x3fc9c0){return function(_0x1551d8){_0x3fc9c0['emit'](_0x161e26,_0x1551d8);};}function removeListener(_0x1c2711,_0x2527d2){return function(){OpenchannelQueueEvents[_0xa33c('0x2')](_0x1c2711,_0x2527d2);};}exports['register']=function(_0x5d3df6){for(var _0x158eb5=0x0,_0x232543=events[_0xa33c('0x3')];_0x158eb5<_0x232543;_0x158eb5++){var _0x489963=events[_0x158eb5];var _0x30a135=createListener('openchannelQueue:'+_0x489963,_0x5d3df6);OpenchannelQueueEvents['on'](_0x489963,_0x30a135);}}; \ No newline at end of file +var _0x52bd=['register','length','openchannelQueue:','./openchannelQueue.events','remove','update','emit','removeListener'];(function(_0x3ba62f,_0x2b3163){var _0x495302=function(_0x59e6f8){while(--_0x59e6f8){_0x3ba62f['push'](_0x3ba62f['shift']());}};_0x495302(++_0x2b3163);}(_0x52bd,0x1db));var _0xd52b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x52bd[_0x5c351c];return _0x26f3b3;};'use strict';var OpenchannelQueueEvents=require(_0xd52b('0x0'));var events=['save',_0xd52b('0x1'),_0xd52b('0x2')];function createListener(_0x91ce96,_0x1dde2b){return function(_0x58c6b0){_0x1dde2b[_0xd52b('0x3')](_0x91ce96,_0x58c6b0);};}function removeListener(_0x3abb15,_0x83ff51){return function(){OpenchannelQueueEvents[_0xd52b('0x4')](_0x3abb15,_0x83ff51);};}exports[_0xd52b('0x5')]=function(_0x2d0ac8){for(var _0x55b9a0=0x0,_0x5aa62a=events[_0xd52b('0x6')];_0x55b9a0<_0x5aa62a;_0x55b9a0++){var _0x5c3874=events[_0x55b9a0];var _0x2acb2e=createListener(_0xd52b('0x7')+_0x5c3874,_0x2d0ac8);OpenchannelQueueEvents['on'](_0x5c3874,_0x2acb2e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index fb4fde6..98eeb45 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 _0x2099=['create','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4e37de,_0x2ce895){var _0xf148e8=function(_0x42f66d){while(--_0x42f66d){_0x4e37de['push'](_0x4e37de['shift']());}};_0xf148e8(++_0x2ce895);}(_0x2099,0x1a8));var _0x9209=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2099[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x9209('0x0'));var util=require(_0x9209('0x1'));var path=require(_0x9209('0x2'));var timeout=require(_0x9209('0x3'));var express=require(_0x9209('0x4'));var router=express['Router']();var auth=require(_0x9209('0x5'));var interaction=require(_0x9209('0x6'));var config=require(_0x9209('0x7'));var controller=require(_0x9209('0x8'));router[_0x9209('0x9')]('/',auth[_0x9209('0xa')](),controller[_0x9209('0xb')]);router[_0x9209('0x9')](_0x9209('0xc'),auth[_0x9209('0xa')](),controller[_0x9209('0xd')]);router['get'](_0x9209('0xe'),auth[_0x9209('0xa')](),controller[_0x9209('0xf')]);router['post']('/',auth[_0x9209('0xa')](),controller[_0x9209('0x10')]);router[_0x9209('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9209('0x12')]);router['delete'](_0x9209('0xe'),auth[_0x9209('0xa')](),controller['destroy']);module[_0x9209('0x13')]=router; \ No newline at end of file +var _0x19d5=['isAuthenticated','get','/describe','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2db048,_0x355a8){var _0x21595a=function(_0x57efcc){while(--_0x57efcc){_0x2db048['push'](_0x2db048['shift']());}};_0x21595a(++_0x355a8);}(_0x19d5,0xe7));var _0x519d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x19d5[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x519d('0x0'));var util=require(_0x519d('0x1'));var path=require('path');var timeout=require(_0x519d('0x2'));var express=require(_0x519d('0x3'));var router=express['Router']();var auth=require(_0x519d('0x4'));var interaction=require(_0x519d('0x5'));var config=require(_0x519d('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x519d('0x7')](),controller['index']);router[_0x519d('0x8')](_0x519d('0x9'),auth[_0x519d('0x7')](),controller['describe']);router[_0x519d('0x8')](_0x519d('0xa'),auth[_0x519d('0x7')](),controller['show']);router[_0x519d('0xb')]('/',auth[_0x519d('0x7')](),controller['create']);router[_0x519d('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x519d('0xd')]);router[_0x519d('0xe')](_0x519d('0xa'),auth[_0x519d('0x7')](),controller[_0x519d('0xf')]);module[_0x519d('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 a4e2c02..f80cfe8 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 _0x026e=['exports','STRING','DATE','moment'];(function(_0x2808d0,_0x221a9f){var _0x3aef7c=function(_0x331dc1){while(--_0x331dc1){_0x2808d0['push'](_0x2808d0['shift']());}};_0x3aef7c(++_0x221a9f);}(_0x026e,0x197));var _0xe026=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x026e[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xe026('0x0'));var Sequelize=require('sequelize');module[_0xe026('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe026('0x2')]},'joinAt':{'type':Sequelize[_0xe026('0x3')]},'leaveAt':{'type':Sequelize[_0xe026('0x3')]},'acceptAt':{'type':Sequelize[_0xe026('0x3')]},'exitAt':{'type':Sequelize[_0xe026('0x3')]},'reason':{'type':Sequelize[_0xe026('0x2')]}}; \ No newline at end of file +var _0x4119=['DATE','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4119,0x1ab));var _0x9411=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x4119[_0x220dbb];return _0x2b77de;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9411('0x0')]={'uniqueid':{'type':Sequelize[_0x9411('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x9411('0x1')]},'joinAt':{'type':Sequelize[_0x9411('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9411('0x2')]},'exitAt':{'type':Sequelize[_0x9411('0x2')]},'reason':{'type':Sequelize[_0x9411('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6c8a262..7306e0d 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 _0x7f3b=['fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','map','OpenchannelQueueReport','rawAttributes'];(function(_0x67d81c,_0x3cd587){var _0x3a7dc5=function(_0x54b8a3){while(--_0x54b8a3){_0x67d81c['push'](_0x67d81c['shift']());}};_0x3a7dc5(++_0x3cd587);}(_0x7f3b,0x13e));var _0xb7f3=function(_0x4a7d94,_0x11be7b){_0x4a7d94=_0x4a7d94-0x0;var _0x5c3e9b=_0x7f3b[_0x4a7d94];return _0x5c3e9b;};'use strict';var pdf=require(_0xb7f3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb7f3('0x1'));var zipdir=require(_0xb7f3('0x2'));var jsonpatch=require(_0xb7f3('0x3'));var rp=require(_0xb7f3('0x4'));var moment=require(_0xb7f3('0x5'));var BPromise=require(_0xb7f3('0x6'));var Mustache=require(_0xb7f3('0x7'));var util=require(_0xb7f3('0x8'));var path=require(_0xb7f3('0x9'));var sox=require(_0xb7f3('0xa'));var csv=require('to-csv');var ejs=require(_0xb7f3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb7f3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb7f3('0xd'));var toCsv=require(_0xb7f3('0xe'));var querystring=require(_0xb7f3('0xf'));var Papa=require(_0xb7f3('0x10'));var Redis=require('ioredis');var authService=require(_0xb7f3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7f3('0x12'));var logger=require(_0xb7f3('0x13'))('api');var utils=require(_0xb7f3('0x14'));var config=require(_0xb7f3('0x15'));var db=require(_0xb7f3('0x16'))['db'];function respondWithStatusCode(_0x5480dd,_0x4a3e4d){_0x4a3e4d=_0x4a3e4d||0xcc;return function(_0x4db774){if(_0x4db774){return _0x5480dd[_0xb7f3('0x17')](_0x4a3e4d);}return _0x5480dd[_0xb7f3('0x18')](_0x4a3e4d)[_0xb7f3('0x19')]();};}function respondWithResult(_0x4e1436,_0x15bc04){_0x15bc04=_0x15bc04||0xc8;return function(_0xe294fa){if(_0xe294fa){return _0x4e1436[_0xb7f3('0x18')](_0x15bc04)[_0xb7f3('0x1a')](_0xe294fa);}};}function respondWithFilteredResult(_0xda9e9,_0x3cff25){return function(_0x242150){if(_0x242150){var _0x1a951a=_0x242150[_0xb7f3('0x1b')],_0x5c083e=_0x3cff25[_0xb7f3('0x1c')],_0xe3246f=_0x3cff25[_0xb7f3('0x1c')]+_0x3cff25['limit'],_0x2b8c5c;if(_0xe3246f>=_0x1a951a){_0xe3246f=_0x1a951a;_0x2b8c5c=0xc8;}else{_0x2b8c5c=0xce;}_0xda9e9['status'](_0x2b8c5c);return _0xda9e9[_0xb7f3('0x1d')]('Content-Range',_0x5c083e+'-'+_0xe3246f+'/'+_0x1a951a)[_0xb7f3('0x1a')](_0x242150);}return null;};}function patchUpdates(_0x28a9ec){return function(_0x27c3aa){try{jsonpatch[_0xb7f3('0x1e')](_0x27c3aa,_0x28a9ec,!![]);}catch(_0x3cb233){return BPromise[_0xb7f3('0x1f')](_0x3cb233);}return _0x27c3aa[_0xb7f3('0x20')]();};}function saveUpdates(_0x404514,_0x11c85e){return function(_0x4493f5){if(_0x4493f5){return _0x4493f5[_0xb7f3('0x21')](_0x404514)[_0xb7f3('0x22')](function(_0x50aa3c){return _0x50aa3c;});}return null;};}function removeEntity(_0x5876d9,_0x16c383){return function(_0x247319){if(_0x247319){return _0x247319[_0xb7f3('0x23')]()[_0xb7f3('0x22')](function(){_0x5876d9['status'](0xcc)[_0xb7f3('0x19')]();});}};}function handleEntityNotFound(_0x245fdc,_0x41e80e){return function(_0x1f0e7b){if(!_0x1f0e7b){_0x245fdc[_0xb7f3('0x17')](0x194);}return _0x1f0e7b;};}function handleError(_0x128c24,_0x4ce465){_0x4ce465=_0x4ce465||0x1f4;return function(_0x2c2e11){logger[_0xb7f3('0x24')](_0x2c2e11[_0xb7f3('0x25')]);if(_0x2c2e11[_0xb7f3('0x26')]){delete _0x2c2e11[_0xb7f3('0x26')];}_0x128c24[_0xb7f3('0x18')](_0x4ce465)['send'](_0x2c2e11);};}exports['index']=function(_0x37090e,_0x525cc7){var _0x31e9dc={},_0x2a58b2={},_0x93602d={'count':0x0,'rows':[]};var _0x1bf983=_[_0xb7f3('0x27')](db[_0xb7f3('0x28')][_0xb7f3('0x29')],function(_0x50622d){return{'name':_0x50622d[_0xb7f3('0x2a')],'type':_0x50622d[_0xb7f3('0x2b')][_0xb7f3('0x2c')]};});_0x2a58b2['model']=_[_0xb7f3('0x27')](_0x1bf983,_0xb7f3('0x26'));_0x2a58b2[_0xb7f3('0x2d')]=_[_0xb7f3('0x2e')](_0x37090e[_0xb7f3('0x2d')]);_0x2a58b2[_0xb7f3('0x2f')]=_['intersection'](_0x2a58b2[_0xb7f3('0x30')],_0x2a58b2[_0xb7f3('0x2d')]);_0x31e9dc[_0xb7f3('0x31')]=_[_0xb7f3('0x32')](_0x2a58b2[_0xb7f3('0x30')],qs[_0xb7f3('0x33')](_0x37090e[_0xb7f3('0x2d')][_0xb7f3('0x33')]));_0x31e9dc[_0xb7f3('0x31')]=_0x31e9dc[_0xb7f3('0x31')][_0xb7f3('0x34')]?_0x31e9dc[_0xb7f3('0x31')]:_0x2a58b2[_0xb7f3('0x30')];if(!_0x37090e[_0xb7f3('0x2d')]['hasOwnProperty'](_0xb7f3('0x35'))){_0x31e9dc['limit']=qs[_0xb7f3('0x36')](_0x37090e['query']['limit']);_0x31e9dc[_0xb7f3('0x1c')]=qs[_0xb7f3('0x1c')](_0x37090e[_0xb7f3('0x2d')][_0xb7f3('0x1c')]);}_0x31e9dc['order']=qs[_0xb7f3('0x37')](_0x37090e['query'][_0xb7f3('0x37')]);_0x31e9dc[_0xb7f3('0x38')]=qs[_0xb7f3('0x2f')](_['pick'](_0x37090e[_0xb7f3('0x2d')],_0x2a58b2[_0xb7f3('0x2f')]),_0x1bf983);if(_0x37090e['query'][_0xb7f3('0x39')]){_0x31e9dc[_0xb7f3('0x38')]=_[_0xb7f3('0x3a')](_0x31e9dc[_0xb7f3('0x38')],{'$or':_[_0xb7f3('0x27')](_0x1bf983,function(_0x3b1c7b){if(_0x3b1c7b['type']!==_0xb7f3('0x3b')){var _0x52083f={};_0x52083f[_0x3b1c7b[_0xb7f3('0x26')]]={'$like':'%'+_0x37090e[_0xb7f3('0x2d')][_0xb7f3('0x39')]+'%'};return _0x52083f;}})});}_0x31e9dc=_[_0xb7f3('0x3a')]({},_0x31e9dc,_0x37090e['options']);var _0xf2934d={'where':_0x31e9dc[_0xb7f3('0x38')]};return db['OpenchannelQueueReport'][_0xb7f3('0x1b')](_0xf2934d)['then'](function(_0x33abef){_0x93602d[_0xb7f3('0x1b')]=_0x33abef;if(_0x37090e[_0xb7f3('0x2d')][_0xb7f3('0x3c')]){_0x31e9dc[_0xb7f3('0x3d')]=[{'all':!![]}];}return db[_0xb7f3('0x28')][_0xb7f3('0x3e')](_0x31e9dc);})[_0xb7f3('0x22')](function(_0x2750fd){_0x93602d[_0xb7f3('0x3f')]=_0x2750fd;return _0x93602d;})['then'](respondWithFilteredResult(_0x525cc7,_0x31e9dc))[_0xb7f3('0x40')](handleError(_0x525cc7,null));};exports[_0xb7f3('0x41')]=function(_0x4c5a4f,_0x4ddb60){var _0x148e46={'raw':!![],'where':{'id':_0x4c5a4f[_0xb7f3('0x42')]['id']}},_0x3bd865={};_0x3bd865[_0xb7f3('0x30')]=_['keys'](db['OpenchannelQueueReport'][_0xb7f3('0x29')]);_0x3bd865[_0xb7f3('0x2d')]=_[_0xb7f3('0x2e')](_0x4c5a4f[_0xb7f3('0x2d')]);_0x3bd865[_0xb7f3('0x2f')]=_[_0xb7f3('0x32')](_0x3bd865[_0xb7f3('0x30')],_0x3bd865[_0xb7f3('0x2d')]);_0x148e46[_0xb7f3('0x31')]=_[_0xb7f3('0x32')](_0x3bd865[_0xb7f3('0x30')],qs[_0xb7f3('0x33')](_0x4c5a4f[_0xb7f3('0x2d')][_0xb7f3('0x33')]));_0x148e46[_0xb7f3('0x31')]=_0x148e46[_0xb7f3('0x31')][_0xb7f3('0x34')]?_0x148e46[_0xb7f3('0x31')]:_0x3bd865['model'];if(_0x4c5a4f[_0xb7f3('0x2d')][_0xb7f3('0x3c')]){_0x148e46['include']=[{'all':!![]}];}_0x148e46=_[_0xb7f3('0x3a')]({},_0x148e46,_0x4c5a4f[_0xb7f3('0x43')]);return db[_0xb7f3('0x28')][_0xb7f3('0x44')](_0x148e46)[_0xb7f3('0x22')](handleEntityNotFound(_0x4ddb60,null))[_0xb7f3('0x22')](respondWithResult(_0x4ddb60,null))[_0xb7f3('0x40')](handleError(_0x4ddb60,null));};exports[_0xb7f3('0x45')]=function(_0x868504,_0x5772f6){return db[_0xb7f3('0x28')]['create'](_0x868504[_0xb7f3('0x46')],{})['then'](respondWithResult(_0x5772f6,0xc9))[_0xb7f3('0x40')](handleError(_0x5772f6,null));};exports['update']=function(_0x1e917d,_0x27150e){if(_0x1e917d[_0xb7f3('0x46')]['id']){delete _0x1e917d[_0xb7f3('0x46')]['id'];}return db['OpenchannelQueueReport'][_0xb7f3('0x44')]({'where':{'id':_0x1e917d[_0xb7f3('0x42')]['id']}})[_0xb7f3('0x22')](handleEntityNotFound(_0x27150e,null))[_0xb7f3('0x22')](saveUpdates(_0x1e917d['body'],null))[_0xb7f3('0x22')](respondWithResult(_0x27150e,null))['catch'](handleError(_0x27150e,null));};exports['destroy']=function(_0x10230a,_0x58f1d9){return db[_0xb7f3('0x28')]['find']({'where':{'id':_0x10230a[_0xb7f3('0x42')]['id']}})[_0xb7f3('0x22')](handleEntityNotFound(_0x58f1d9,null))[_0xb7f3('0x22')](removeEntity(_0x58f1d9,null))[_0xb7f3('0x40')](handleError(_0x58f1d9,null));};exports[_0xb7f3('0x47')]=function(_0x5abc2e,_0x4c8f8c){return db['OpenchannelQueueReport']['describe']()['then'](respondWithResult(_0x4c8f8c,null))['catch'](handleError(_0x4c8f8c,null));}; \ No newline at end of file +var _0x9ccb=['intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','OpenchannelQueueReport','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9ccb,0x1c1));var _0xb9cc=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x9ccb[_0x389832];return _0x59429e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9cc('0x0'));var rimraf=require(_0xb9cc('0x1'));var zipdir=require(_0xb9cc('0x2'));var jsonpatch=require(_0xb9cc('0x3'));var rp=require(_0xb9cc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb9cc('0x5'));var util=require(_0xb9cc('0x6'));var path=require('path');var sox=require(_0xb9cc('0x7'));var csv=require(_0xb9cc('0x8'));var ejs=require(_0xb9cc('0x9'));var fs=require('fs');var _=require(_0xb9cc('0xa'));var squel=require('squel');var crypto=require(_0xb9cc('0xb'));var jsforce=require(_0xb9cc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9cc('0xd'));var Papa=require('papaparse');var Redis=require(_0xb9cc('0xe'));var authService=require(_0xb9cc('0xf'));var qs=require(_0xb9cc('0x10'));var as=require(_0xb9cc('0x11'));var hardwareService=require(_0xb9cc('0x12'));var logger=require('../../config/logger')(_0xb9cc('0x13'));var utils=require('../../config/utils');var config=require(_0xb9cc('0x14'));var db=require(_0xb9cc('0x15'))['db'];function respondWithStatusCode(_0x3fe7f8,_0x60ebd1){_0x60ebd1=_0x60ebd1||0xcc;return function(_0x4ae2bf){if(_0x4ae2bf){return _0x3fe7f8[_0xb9cc('0x16')](_0x60ebd1);}return _0x3fe7f8['status'](_0x60ebd1)[_0xb9cc('0x17')]();};}function respondWithResult(_0x2408cc,_0x9daeb6){_0x9daeb6=_0x9daeb6||0xc8;return function(_0x4139a8){if(_0x4139a8){return _0x2408cc[_0xb9cc('0x18')](_0x9daeb6)['json'](_0x4139a8);}};}function respondWithFilteredResult(_0x274b18,_0x55ca40){return function(_0x473090){if(_0x473090){var _0x4827c4=_0x473090[_0xb9cc('0x19')],_0x30929c=_0x55ca40[_0xb9cc('0x1a')],_0xf3385f=_0x55ca40[_0xb9cc('0x1a')]+_0x55ca40[_0xb9cc('0x1b')],_0x323360;if(_0xf3385f>=_0x4827c4){_0xf3385f=_0x4827c4;_0x323360=0xc8;}else{_0x323360=0xce;}_0x274b18[_0xb9cc('0x18')](_0x323360);return _0x274b18[_0xb9cc('0x1c')](_0xb9cc('0x1d'),_0x30929c+'-'+_0xf3385f+'/'+_0x4827c4)['json'](_0x473090);}return null;};}function patchUpdates(_0x354bd9){return function(_0x5a4f11){try{jsonpatch[_0xb9cc('0x1e')](_0x5a4f11,_0x354bd9,!![]);}catch(_0x4468bc){return BPromise[_0xb9cc('0x1f')](_0x4468bc);}return _0x5a4f11[_0xb9cc('0x20')]();};}function saveUpdates(_0x168ea8,_0x454917){return function(_0x1abbc4){if(_0x1abbc4){return _0x1abbc4[_0xb9cc('0x21')](_0x168ea8)[_0xb9cc('0x22')](function(_0x3bcfa1){return _0x3bcfa1;});}return null;};}function removeEntity(_0x1587ab,_0x40edbb){return function(_0x1c0cdf){if(_0x1c0cdf){return _0x1c0cdf[_0xb9cc('0x23')]()[_0xb9cc('0x22')](function(){_0x1587ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c3371,_0x4b8f93){return function(_0xb24eda){if(!_0xb24eda){_0x2c3371[_0xb9cc('0x16')](0x194);}return _0xb24eda;};}function handleError(_0xb937ad,_0x423c8a){_0x423c8a=_0x423c8a||0x1f4;return function(_0x4e1d85){logger[_0xb9cc('0x24')](_0x4e1d85[_0xb9cc('0x25')]);if(_0x4e1d85[_0xb9cc('0x26')]){delete _0x4e1d85['name'];}_0xb937ad[_0xb9cc('0x18')](_0x423c8a)['send'](_0x4e1d85);};}exports[_0xb9cc('0x27')]=function(_0x1317f1,_0x507134){var _0x2bf034={},_0x437512={},_0x1af4a7={'count':0x0,'rows':[]};var _0x402871=_[_0xb9cc('0x28')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x461103){return{'name':_0x461103[_0xb9cc('0x29')],'type':_0x461103[_0xb9cc('0x2a')][_0xb9cc('0x2b')]};});_0x437512[_0xb9cc('0x2c')]=_[_0xb9cc('0x28')](_0x402871,_0xb9cc('0x26'));_0x437512[_0xb9cc('0x2d')]=_[_0xb9cc('0x2e')](_0x1317f1['query']);_0x437512[_0xb9cc('0x2f')]=_[_0xb9cc('0x30')](_0x437512[_0xb9cc('0x2c')],_0x437512['query']);_0x2bf034[_0xb9cc('0x31')]=_[_0xb9cc('0x30')](_0x437512[_0xb9cc('0x2c')],qs[_0xb9cc('0x32')](_0x1317f1[_0xb9cc('0x2d')][_0xb9cc('0x32')]));_0x2bf034['attributes']=_0x2bf034[_0xb9cc('0x31')][_0xb9cc('0x33')]?_0x2bf034[_0xb9cc('0x31')]:_0x437512[_0xb9cc('0x2c')];if(!_0x1317f1[_0xb9cc('0x2d')]['hasOwnProperty'](_0xb9cc('0x34'))){_0x2bf034[_0xb9cc('0x1b')]=qs[_0xb9cc('0x1b')](_0x1317f1[_0xb9cc('0x2d')][_0xb9cc('0x1b')]);_0x2bf034[_0xb9cc('0x1a')]=qs[_0xb9cc('0x1a')](_0x1317f1['query'][_0xb9cc('0x1a')]);}_0x2bf034['order']=qs[_0xb9cc('0x35')](_0x1317f1['query'][_0xb9cc('0x35')]);_0x2bf034[_0xb9cc('0x36')]=qs[_0xb9cc('0x2f')](_[_0xb9cc('0x37')](_0x1317f1['query'],_0x437512['filters']),_0x402871);if(_0x1317f1['query'][_0xb9cc('0x38')]){_0x2bf034[_0xb9cc('0x36')]=_[_0xb9cc('0x39')](_0x2bf034[_0xb9cc('0x36')],{'$or':_[_0xb9cc('0x28')](_0x402871,function(_0x4088da){if(_0x4088da[_0xb9cc('0x2a')]!==_0xb9cc('0x3a')){var _0x49f9fa={};_0x49f9fa[_0x4088da['name']]={'$like':'%'+_0x1317f1[_0xb9cc('0x2d')]['filter']+'%'};return _0x49f9fa;}})});}_0x2bf034=_[_0xb9cc('0x39')]({},_0x2bf034,_0x1317f1['options']);var _0x3a1fcb={'where':_0x2bf034[_0xb9cc('0x36')]};return db[_0xb9cc('0x3b')]['count'](_0x3a1fcb)[_0xb9cc('0x22')](function(_0x410137){_0x1af4a7[_0xb9cc('0x19')]=_0x410137;if(_0x1317f1[_0xb9cc('0x2d')]['includeAll']){_0x2bf034[_0xb9cc('0x3c')]=[{'all':!![]}];}return db[_0xb9cc('0x3b')][_0xb9cc('0x3d')](_0x2bf034);})[_0xb9cc('0x22')](function(_0x5ce2ac){_0x1af4a7[_0xb9cc('0x3e')]=_0x5ce2ac;return _0x1af4a7;})[_0xb9cc('0x22')](respondWithFilteredResult(_0x507134,_0x2bf034))[_0xb9cc('0x3f')](handleError(_0x507134,null));};exports[_0xb9cc('0x40')]=function(_0x50c4f3,_0xb2fd50){var _0x579774={'raw':!![],'where':{'id':_0x50c4f3[_0xb9cc('0x41')]['id']}},_0x544b20={};_0x544b20[_0xb9cc('0x2c')]=_[_0xb9cc('0x2e')](db[_0xb9cc('0x3b')][_0xb9cc('0x42')]);_0x544b20[_0xb9cc('0x2d')]=_['keys'](_0x50c4f3['query']);_0x544b20[_0xb9cc('0x2f')]=_[_0xb9cc('0x30')](_0x544b20['model'],_0x544b20['query']);_0x579774[_0xb9cc('0x31')]=_[_0xb9cc('0x30')](_0x544b20['model'],qs['fields'](_0x50c4f3[_0xb9cc('0x2d')][_0xb9cc('0x32')]));_0x579774[_0xb9cc('0x31')]=_0x579774[_0xb9cc('0x31')]['length']?_0x579774[_0xb9cc('0x31')]:_0x544b20[_0xb9cc('0x2c')];if(_0x50c4f3[_0xb9cc('0x2d')][_0xb9cc('0x43')]){_0x579774[_0xb9cc('0x3c')]=[{'all':!![]}];}_0x579774=_[_0xb9cc('0x39')]({},_0x579774,_0x50c4f3['options']);return db[_0xb9cc('0x3b')]['find'](_0x579774)[_0xb9cc('0x22')](handleEntityNotFound(_0xb2fd50,null))[_0xb9cc('0x22')](respondWithResult(_0xb2fd50,null))[_0xb9cc('0x3f')](handleError(_0xb2fd50,null));};exports[_0xb9cc('0x44')]=function(_0x2bf0df,_0x416f16){return db['OpenchannelQueueReport'][_0xb9cc('0x44')](_0x2bf0df['body'],{})[_0xb9cc('0x22')](respondWithResult(_0x416f16,0xc9))[_0xb9cc('0x3f')](handleError(_0x416f16,null));};exports[_0xb9cc('0x21')]=function(_0x4f6e00,_0x4580b3){if(_0x4f6e00[_0xb9cc('0x45')]['id']){delete _0x4f6e00[_0xb9cc('0x45')]['id'];}return db[_0xb9cc('0x3b')]['find']({'where':{'id':_0x4f6e00[_0xb9cc('0x41')]['id']}})[_0xb9cc('0x22')](handleEntityNotFound(_0x4580b3,null))['then'](saveUpdates(_0x4f6e00[_0xb9cc('0x45')],null))[_0xb9cc('0x22')](respondWithResult(_0x4580b3,null))['catch'](handleError(_0x4580b3,null));};exports[_0xb9cc('0x23')]=function(_0x4e76ac,_0x47a489){return db[_0xb9cc('0x3b')]['find']({'where':{'id':_0x4e76ac[_0xb9cc('0x41')]['id']}})[_0xb9cc('0x22')](handleEntityNotFound(_0x47a489,null))[_0xb9cc('0x22')](removeEntity(_0x47a489,null))[_0xb9cc('0x3f')](handleError(_0x47a489,null));};exports[_0xb9cc('0x46')]=function(_0x2a6982,_0x3d36cd){return db[_0xb9cc('0x3b')][_0xb9cc('0x46')]()[_0xb9cc('0x22')](respondWithResult(_0x3d36cd,null))[_0xb9cc('0x3f')](handleError(_0x3d36cd,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6d64217..a73adb8 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 _0xdfd7=['api','bluebird','request-promise','path','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','util'];(function(_0x5c086a,_0x5e49ad){var _0x416f7b=function(_0x3af942){while(--_0x3af942){_0x5c086a['push'](_0x5c086a['shift']());}};_0x416f7b(++_0x5e49ad);}(_0xdfd7,0x1dc));var _0x7dfd=function(_0x4d9cd0,_0x112ac2){_0x4d9cd0=_0x4d9cd0-0x0;var _0x4636e9=_0xdfd7[_0x4d9cd0];return _0x4636e9;};'use strict';var _=require('lodash');var util=require(_0x7dfd('0x0'));var logger=require('../../config/logger')(_0x7dfd('0x1'));var moment=require('moment');var BPromise=require(_0x7dfd('0x2'));var rp=require(_0x7dfd('0x3'));var fs=require('fs');var path=require(_0x7dfd('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0x56541c,_0x1f0c59){return _0x56541c[_0x7dfd('0x5')](_0x7dfd('0x6'),attributes,{'tableName':_0x7dfd('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7dfd('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7b9=['../../config/logger','path','rimraf','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util'];(function(_0x2c93a4,_0x3e90b7){var _0x41e095=function(_0x53439a){while(--_0x53439a){_0x2c93a4['push'](_0x2c93a4['shift']());}};_0x41e095(++_0x3e90b7);}(_0xf7b9,0x8d));var _0x9f7b=function(_0x5929ff,_0x2c88d5){_0x5929ff=_0x5929ff-0x0;var _0x79477d=_0xf7b9[_0x5929ff];return _0x79477d;};'use strict';var _=require(_0x9f7b('0x0'));var util=require(_0x9f7b('0x1'));var logger=require(_0x9f7b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f7b('0x3'));var rimraf=require(_0x9f7b('0x4'));var config=require('../../config/environment');var attributes=require(_0x9f7b('0x5'));module[_0x9f7b('0x6')]=function(_0x31e7fd,_0x50cb54){return _0x31e7fd[_0x9f7b('0x7')](_0x9f7b('0x8'),attributes,{'tableName':_0x9f7b('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9f7b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 4f37c38..60524f0 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 _0xef0f=['OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xef0f,0x168));var _0xfef0=function(_0x2b8d32,_0x4fb31a){_0x2b8d32=_0x2b8d32-0x0;var _0x30f2eb=_0xef0f[_0x2b8d32];return _0x30f2eb;};'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});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')](_0x581459['body'],{'raw':_0x581459[_0xfef0('0x1b')]?_0x581459['options'][_0xfef0('0x1c')]===undefined?!![]:![]:!![]})[_0xfef0('0xc')](function(_0x28dee1){logger['info'](_0xfef0('0x18'),_0x581459);logger['debug'](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x28dee1));_0x1642cd(_0x28dee1);})['catch'](function(_0x4897af){logger['error'](_0xfef0('0x18'),_0x4897af['message'],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x4897af[_0xfef0('0x15')]));});});};exports[_0xfef0('0x1d')]=function(_0x4483f2){var _0x249fe4=this;return new Promise(function(_0xd687ed,_0x5c9085){return db['OpenchannelQueueReport'][_0xfef0('0x1e')](_0x4483f2[_0xfef0('0x1f')],{'raw':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2[_0xfef0('0x1b')][_0xfef0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2[_0xfef0('0x1b')][_0xfef0('0x20')]||null:null,'attributes':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2['options'][_0xfef0('0x21')]||null:null,'limit':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2[_0xfef0('0x1b')][_0xfef0('0x22')]||null:null})[_0xfef0('0xc')](function(_0x1ac4a3){logger[_0xfef0('0xd')](_0xfef0('0x1d'),_0x4483f2);logger[_0xfef0('0x10')](_0xfef0('0x1d'),_0x4483f2,JSON[_0xfef0('0x12')](_0x1ac4a3));_0xd687ed(_0x1ac4a3);})[_0xfef0('0x17')](function(_0x51af0f){logger[_0xfef0('0x13')]('UpdateOpenchannelQueueReport',_0x51af0f['message'],_0x4483f2);_0x5c9085(_0x249fe4[_0xfef0('0x13')](0x1f4,_0x51af0f[_0xfef0('0x15')]));});});}; \ No newline at end of file +var _0xfe39=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateOpenchannelQueueReport','create','options','raw','debug','UpdateOpenchannelQueueReport','OpenchannelQueueReport','body','where','attributes','limit','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x49e4c5,_0x1bdc1e){var _0x2a4ceb=function(_0x1091cd){while(--_0x1091cd){_0x49e4c5['push'](_0x49e4c5['shift']());}};_0x2a4ceb(++_0x1bdc1e);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xfe39[_0x1b6186];return _0x186121;};'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')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x211eb2(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x5a3bd6(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}else{logger[_0x9fe3('0xb')]('OpenchannelQueueReport,\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);});});}exports[_0x9fe3('0x14')]=function(_0x15fcaa){var _0x592b8b=this;return new Promise(function(_0x35bbaf,_0x43854c){return db['OpenchannelQueueReport'][_0x9fe3('0x15')](_0x15fcaa['body'],{'raw':_0x15fcaa[_0x9fe3('0x16')]?_0x15fcaa['options'][_0x9fe3('0x17')]===undefined?!![]:![]:!![]})[_0x9fe3('0xa')](function(_0x302d5c){logger['info']('CreateOpenchannelQueueReport',_0x15fcaa);logger[_0x9fe3('0x18')](_0x9fe3('0x14'),_0x15fcaa,JSON['stringify'](_0x302d5c));_0x35bbaf(_0x302d5c);})[_0x9fe3('0x13')](function(_0x2e9ae5){logger['error'](_0x9fe3('0x14'),_0x2e9ae5[_0x9fe3('0x11')],_0x15fcaa);_0x43854c(_0x592b8b['error'](0x1f4,_0x2e9ae5[_0x9fe3('0x11')]));});});};exports[_0x9fe3('0x19')]=function(_0x3fd88e){var _0x3d80e9=this;return new Promise(function(_0x14f1a1,_0x1c4665){return db[_0x9fe3('0x1a')]['update'](_0x3fd88e[_0x9fe3('0x1b')],{'raw':_0x3fd88e[_0x9fe3('0x16')]?_0x3fd88e[_0x9fe3('0x16')][_0x9fe3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd88e['options']?_0x3fd88e[_0x9fe3('0x16')][_0x9fe3('0x1c')]||null:null,'attributes':_0x3fd88e[_0x9fe3('0x16')]?_0x3fd88e['options'][_0x9fe3('0x1d')]||null:null,'limit':_0x3fd88e[_0x9fe3('0x16')]?_0x3fd88e[_0x9fe3('0x16')][_0x9fe3('0x1e')]||null:null})[_0x9fe3('0xa')](function(_0x17f01f){logger['info'](_0x9fe3('0x19'),_0x3fd88e);logger[_0x9fe3('0x18')](_0x9fe3('0x19'),_0x3fd88e,JSON[_0x9fe3('0x1f')](_0x17f01f));_0x14f1a1(_0x17f01f);})[_0x9fe3('0x13')](function(_0x4557c5){logger['error'](_0x9fe3('0x19'),_0x4557c5[_0x9fe3('0x11')],_0x3fd88e);_0x1c4665(_0x3d80e9['error'](0x1f4,_0x4557c5[_0x9fe3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index b2b96d6..dc4d5b7 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(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 99c0554..52bc1c0 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 _0xec4e=['account','agent','queue','DATE','NOW','sequelize','exports','STRING','ENUM'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xec4e,0x9e));var _0xeec4=function(_0x24fa12,_0x4ae5bf){_0x24fa12=_0x24fa12-0x0;var _0x2ae0b5=_0xec4e[_0x24fa12];return _0x2ae0b5;};'use strict';var moment=require('moment');var Sequelize=require(_0xeec4('0x0'));module[_0xeec4('0x1')]={'uniqueid':{'type':Sequelize[_0xeec4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xeec4('0x3')](_0xeec4('0x4'),_0xeec4('0x5'),_0xeec4('0x6')),'allowNull':![],'defaultValue':_0xeec4('0x6')},'transferredAt':{'type':Sequelize[_0xeec4('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xeec4('0x8')]}}; \ No newline at end of file +var _0xb306=['DATE','NOW','moment','account','agent','queue'];(function(_0x50647b,_0x42cd58){var _0x76fbbc=function(_0x599e79){while(--_0x599e79){_0x50647b['push'](_0x50647b['shift']());}};_0x76fbbc(++_0x42cd58);}(_0xb306,0xda));var _0x6b30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb306[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x6b30('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6b30('0x1'),_0x6b30('0x2'),_0x6b30('0x3')),'allowNull':![],'defaultValue':_0x6b30('0x3')},'transferredAt':{'type':Sequelize[_0x6b30('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x6b30('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index b86321a..6ce58d7 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 _0x3810=['find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','limit','set','reject','save','update','then','destroy','error','name','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','count','catch','params','includeAll'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3810,0x1a2));var _0x0381=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x3810[_0x310504];return _0x5b36d0;};'use strict';var pdf=require(_0x0381('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0381('0x1'));var zipdir=require(_0x0381('0x2'));var jsonpatch=require(_0x0381('0x3'));var rp=require(_0x0381('0x4'));var moment=require(_0x0381('0x5'));var BPromise=require(_0x0381('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0381('0x7'));var sox=require(_0x0381('0x8'));var csv=require(_0x0381('0x9'));var ejs=require(_0x0381('0xa'));var fs=require('fs');var _=require(_0x0381('0xb'));var squel=require(_0x0381('0xc'));var crypto=require(_0x0381('0xd'));var jsforce=require(_0x0381('0xe'));var deskjs=require(_0x0381('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0381('0x10'));var Papa=require(_0x0381('0x11'));var Redis=require(_0x0381('0x12'));var authService=require(_0x0381('0x13'));var qs=require(_0x0381('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0381('0x15'));var logger=require(_0x0381('0x16'))(_0x0381('0x17'));var utils=require('../../config/utils');var config=require(_0x0381('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3322f7,_0x2685da){_0x2685da=_0x2685da||0xcc;return function(_0x49b1a0){if(_0x49b1a0){return _0x3322f7[_0x0381('0x19')](_0x2685da);}return _0x3322f7[_0x0381('0x1a')](_0x2685da)[_0x0381('0x1b')]();};}function respondWithResult(_0x379954,_0x5e9dfa){_0x5e9dfa=_0x5e9dfa||0xc8;return function(_0x4603c2){if(_0x4603c2){return _0x379954[_0x0381('0x1a')](_0x5e9dfa)['json'](_0x4603c2);}};}function respondWithFilteredResult(_0x14ac3d,_0x43adad){return function(_0x2b3424){if(_0x2b3424){var _0x17a981=_0x2b3424['count'],_0x4f6a73=_0x43adad[_0x0381('0x1c')],_0x69d970=_0x43adad[_0x0381('0x1c')]+_0x43adad[_0x0381('0x1d')],_0x3a2423;if(_0x69d970>=_0x17a981){_0x69d970=_0x17a981;_0x3a2423=0xc8;}else{_0x3a2423=0xce;}_0x14ac3d['status'](_0x3a2423);return _0x14ac3d[_0x0381('0x1e')]('Content-Range',_0x4f6a73+'-'+_0x69d970+'/'+_0x17a981)['json'](_0x2b3424);}return null;};}function patchUpdates(_0x172281){return function(_0x7befb1){try{jsonpatch['apply'](_0x7befb1,_0x172281,!![]);}catch(_0x169ccf){return BPromise[_0x0381('0x1f')](_0x169ccf);}return _0x7befb1[_0x0381('0x20')]();};}function saveUpdates(_0x1c30d8,_0x531b0a){return function(_0xdb8390){if(_0xdb8390){return _0xdb8390[_0x0381('0x21')](_0x1c30d8)[_0x0381('0x22')](function(_0x276f7a){return _0x276f7a;});}return null;};}function removeEntity(_0x50d321,_0x1a7a61){return function(_0xc17913){if(_0xc17913){return _0xc17913[_0x0381('0x23')]()[_0x0381('0x22')](function(){_0x50d321['status'](0xcc)[_0x0381('0x1b')]();});}};}function handleEntityNotFound(_0x2ee69a,_0x46dd53){return function(_0x12efc1){if(!_0x12efc1){_0x2ee69a['sendStatus'](0x194);}return _0x12efc1;};}function handleError(_0x20b4a7,_0x10af8b){_0x10af8b=_0x10af8b||0x1f4;return function(_0x25c5f6){logger[_0x0381('0x24')](_0x25c5f6['stack']);if(_0x25c5f6[_0x0381('0x25')]){delete _0x25c5f6[_0x0381('0x25')];}_0x20b4a7['status'](_0x10af8b)['send'](_0x25c5f6);};}exports[_0x0381('0x26')]=function(_0x1410b8,_0x181c0d){var _0x55d6a1={},_0x1c89d8={},_0x3586b3={'count':0x0,'rows':[]};var _0x250271=_['map'](db[_0x0381('0x27')][_0x0381('0x28')],function(_0x3c85d3){return{'name':_0x3c85d3[_0x0381('0x29')],'type':_0x3c85d3['type'][_0x0381('0x2a')]};});_0x1c89d8[_0x0381('0x2b')]=_[_0x0381('0x2c')](_0x250271,_0x0381('0x25'));_0x1c89d8[_0x0381('0x2d')]=_[_0x0381('0x2e')](_0x1410b8['query']);_0x1c89d8[_0x0381('0x2f')]=_['intersection'](_0x1c89d8[_0x0381('0x2b')],_0x1c89d8[_0x0381('0x2d')]);_0x55d6a1[_0x0381('0x30')]=_[_0x0381('0x31')](_0x1c89d8[_0x0381('0x2b')],qs[_0x0381('0x32')](_0x1410b8['query']['fields']));_0x55d6a1[_0x0381('0x30')]=_0x55d6a1[_0x0381('0x30')][_0x0381('0x33')]?_0x55d6a1[_0x0381('0x30')]:_0x1c89d8['model'];if(!_0x1410b8[_0x0381('0x2d')][_0x0381('0x34')](_0x0381('0x35'))){_0x55d6a1['limit']=qs[_0x0381('0x1d')](_0x1410b8[_0x0381('0x2d')][_0x0381('0x1d')]);_0x55d6a1['offset']=qs[_0x0381('0x1c')](_0x1410b8[_0x0381('0x2d')][_0x0381('0x1c')]);}_0x55d6a1[_0x0381('0x36')]=qs[_0x0381('0x37')](_0x1410b8[_0x0381('0x2d')][_0x0381('0x37')]);_0x55d6a1[_0x0381('0x38')]=qs['filters'](_[_0x0381('0x39')](_0x1410b8[_0x0381('0x2d')],_0x1c89d8[_0x0381('0x2f')]),_0x250271);if(_0x1410b8[_0x0381('0x2d')]['filter']){_0x55d6a1[_0x0381('0x38')]=_[_0x0381('0x3a')](_0x55d6a1[_0x0381('0x38')],{'$or':_[_0x0381('0x2c')](_0x250271,function(_0x278bab){if(_0x278bab['type']!=='VIRTUAL'){var _0x184432={};_0x184432[_0x278bab[_0x0381('0x25')]]={'$like':'%'+_0x1410b8[_0x0381('0x2d')][_0x0381('0x3b')]+'%'};return _0x184432;}})});}_0x55d6a1=_[_0x0381('0x3a')]({},_0x55d6a1,_0x1410b8[_0x0381('0x3c')]);var _0x3641e6={'where':_0x55d6a1[_0x0381('0x38')]};return db['OpenchannelTransferReport'][_0x0381('0x3d')](_0x3641e6)[_0x0381('0x22')](function(_0xb19f85){_0x3586b3[_0x0381('0x3d')]=_0xb19f85;if(_0x1410b8[_0x0381('0x2d')]['includeAll']){_0x55d6a1['include']=[{'all':!![]}];}return db[_0x0381('0x27')]['findAll'](_0x55d6a1);})['then'](function(_0x152703){_0x3586b3['rows']=_0x152703;return _0x3586b3;})[_0x0381('0x22')](respondWithFilteredResult(_0x181c0d,_0x55d6a1))[_0x0381('0x3e')](handleError(_0x181c0d,null));};exports['show']=function(_0x32f45a,_0x2e1e60){var _0x32a9ea={'raw':!![],'where':{'id':_0x32f45a[_0x0381('0x3f')]['id']}},_0x1f0d2d={};_0x1f0d2d['model']=_[_0x0381('0x2e')](db[_0x0381('0x27')][_0x0381('0x28')]);_0x1f0d2d[_0x0381('0x2d')]=_[_0x0381('0x2e')](_0x32f45a[_0x0381('0x2d')]);_0x1f0d2d[_0x0381('0x2f')]=_[_0x0381('0x31')](_0x1f0d2d[_0x0381('0x2b')],_0x1f0d2d[_0x0381('0x2d')]);_0x32a9ea[_0x0381('0x30')]=_[_0x0381('0x31')](_0x1f0d2d[_0x0381('0x2b')],qs[_0x0381('0x32')](_0x32f45a[_0x0381('0x2d')]['fields']));_0x32a9ea['attributes']=_0x32a9ea['attributes'][_0x0381('0x33')]?_0x32a9ea['attributes']:_0x1f0d2d[_0x0381('0x2b')];if(_0x32f45a[_0x0381('0x2d')][_0x0381('0x40')]){_0x32a9ea['include']=[{'all':!![]}];}_0x32a9ea=_['merge']({},_0x32a9ea,_0x32f45a[_0x0381('0x3c')]);return db[_0x0381('0x27')][_0x0381('0x41')](_0x32a9ea)[_0x0381('0x22')](handleEntityNotFound(_0x2e1e60,null))[_0x0381('0x22')](respondWithResult(_0x2e1e60,null))[_0x0381('0x3e')](handleError(_0x2e1e60,null));};exports[_0x0381('0x42')]=function(_0x567e0a,_0x513949){return db['OpenchannelTransferReport'][_0x0381('0x42')](_0x567e0a[_0x0381('0x43')],{})['then'](respondWithResult(_0x513949,0xc9))[_0x0381('0x3e')](handleError(_0x513949,null));};exports[_0x0381('0x21')]=function(_0x53b567,_0x3cfc67){if(_0x53b567['body']['id']){delete _0x53b567['body']['id'];}return db[_0x0381('0x27')][_0x0381('0x41')]({'where':{'id':_0x53b567[_0x0381('0x3f')]['id']}})[_0x0381('0x22')](handleEntityNotFound(_0x3cfc67,null))[_0x0381('0x22')](saveUpdates(_0x53b567['body'],null))[_0x0381('0x22')](respondWithResult(_0x3cfc67,null))[_0x0381('0x3e')](handleError(_0x3cfc67,null));};exports[_0x0381('0x23')]=function(_0x6b9e49,_0x262f79){return db[_0x0381('0x27')][_0x0381('0x41')]({'where':{'id':_0x6b9e49[_0x0381('0x3f')]['id']}})[_0x0381('0x22')](handleEntityNotFound(_0x262f79,null))[_0x0381('0x22')](removeEntity(_0x262f79,null))[_0x0381('0x3e')](handleError(_0x262f79,null));};exports[_0x0381('0x44')]=function(_0x577e61,_0x15f68d){return db[_0x0381('0x27')][_0x0381('0x44')]()[_0x0381('0x22')](respondWithResult(_0x15f68d,null))['catch'](handleError(_0x15f68d,null));}; \ No newline at end of file +var _0xf67f=['create','update','body','params','describe','html-pdf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','save','destroy','then','name','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','OpenchannelTransferReport','findAll','catch','find'];(function(_0x24044f,_0x19c664){var _0x411164=function(_0x7df6cf){while(--_0x7df6cf){_0x24044f['push'](_0x24044f['shift']());}};_0x411164(++_0x19c664);}(_0xf67f,0x1da));var _0xff67=function(_0xc6879,_0x84a966){_0xc6879=_0xc6879-0x0;var _0x54f7a4=_0xf67f[_0xc6879];return _0x54f7a4;};'use strict';var pdf=require(_0xff67('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xff67('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xff67('0x2'));var BPromise=require(_0xff67('0x3'));var Mustache=require(_0xff67('0x4'));var util=require(_0xff67('0x5'));var path=require(_0xff67('0x6'));var sox=require('sox');var csv=require(_0xff67('0x7'));var ejs=require(_0xff67('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xff67('0x9'));var crypto=require(_0xff67('0xa'));var jsforce=require(_0xff67('0xb'));var deskjs=require(_0xff67('0xc'));var toCsv=require(_0xff67('0x7'));var querystring=require(_0xff67('0xd'));var Papa=require('papaparse');var Redis=require(_0xff67('0xe'));var authService=require(_0xff67('0xf'));var qs=require(_0xff67('0x10'));var as=require(_0xff67('0x11'));var hardwareService=require(_0xff67('0x12'));var logger=require('../../config/logger')(_0xff67('0x13'));var utils=require('../../config/utils');var config=require(_0xff67('0x14'));var db=require(_0xff67('0x15'))['db'];function respondWithStatusCode(_0x294598,_0x1f85da){_0x1f85da=_0x1f85da||0xcc;return function(_0x315d6d){if(_0x315d6d){return _0x294598['sendStatus'](_0x1f85da);}return _0x294598[_0xff67('0x16')](_0x1f85da)[_0xff67('0x17')]();};}function respondWithResult(_0x143a9c,_0x9c3d61){_0x9c3d61=_0x9c3d61||0xc8;return function(_0x10cf50){if(_0x10cf50){return _0x143a9c[_0xff67('0x16')](_0x9c3d61)['json'](_0x10cf50);}};}function respondWithFilteredResult(_0x2acde1,_0x35ab99){return function(_0x4bbecc){if(_0x4bbecc){var _0x11d3ed=_0x4bbecc[_0xff67('0x18')],_0x8b2f9f=_0x35ab99['offset'],_0x393a8e=_0x35ab99[_0xff67('0x19')]+_0x35ab99[_0xff67('0x1a')],_0xd428b4;if(_0x393a8e>=_0x11d3ed){_0x393a8e=_0x11d3ed;_0xd428b4=0xc8;}else{_0xd428b4=0xce;}_0x2acde1[_0xff67('0x16')](_0xd428b4);return _0x2acde1[_0xff67('0x1b')]('Content-Range',_0x8b2f9f+'-'+_0x393a8e+'/'+_0x11d3ed)[_0xff67('0x1c')](_0x4bbecc);}return null;};}function patchUpdates(_0x34d5e8){return function(_0x17f598){try{jsonpatch[_0xff67('0x1d')](_0x17f598,_0x34d5e8,!![]);}catch(_0x1bdada){return BPromise[_0xff67('0x1e')](_0x1bdada);}return _0x17f598[_0xff67('0x1f')]();};}function saveUpdates(_0x152f96,_0x34e617){return function(_0x332488){if(_0x332488){return _0x332488['update'](_0x152f96)['then'](function(_0x4b2886){return _0x4b2886;});}return null;};}function removeEntity(_0x59f8f5,_0x26e98b){return function(_0x12bf3c){if(_0x12bf3c){return _0x12bf3c[_0xff67('0x20')]()[_0xff67('0x21')](function(){_0x59f8f5['status'](0xcc)[_0xff67('0x17')]();});}};}function handleEntityNotFound(_0xfdc25,_0x3e27d4){return function(_0x1c5050){if(!_0x1c5050){_0xfdc25['sendStatus'](0x194);}return _0x1c5050;};}function handleError(_0x5889c7,_0x251ddb){_0x251ddb=_0x251ddb||0x1f4;return function(_0x487eac){logger['error'](_0x487eac['stack']);if(_0x487eac[_0xff67('0x22')]){delete _0x487eac[_0xff67('0x22')];}_0x5889c7['status'](_0x251ddb)['send'](_0x487eac);};}exports['index']=function(_0x54b92a,_0xaaf7b9){var _0x2bbc73={},_0x3d485b={},_0x49eeee={'count':0x0,'rows':[]};var _0x22f760=_['map'](db['OpenchannelTransferReport'][_0xff67('0x23')],function(_0x2c9d42){return{'name':_0x2c9d42['fieldName'],'type':_0x2c9d42[_0xff67('0x24')][_0xff67('0x25')]};});_0x3d485b[_0xff67('0x26')]=_[_0xff67('0x27')](_0x22f760,_0xff67('0x22'));_0x3d485b[_0xff67('0x28')]=_[_0xff67('0x29')](_0x54b92a[_0xff67('0x28')]);_0x3d485b['filters']=_[_0xff67('0x2a')](_0x3d485b[_0xff67('0x26')],_0x3d485b[_0xff67('0x28')]);_0x2bbc73[_0xff67('0x2b')]=_[_0xff67('0x2a')](_0x3d485b[_0xff67('0x26')],qs[_0xff67('0x2c')](_0x54b92a[_0xff67('0x28')]['fields']));_0x2bbc73[_0xff67('0x2b')]=_0x2bbc73[_0xff67('0x2b')][_0xff67('0x2d')]?_0x2bbc73[_0xff67('0x2b')]:_0x3d485b[_0xff67('0x26')];if(!_0x54b92a[_0xff67('0x28')]['hasOwnProperty'](_0xff67('0x2e'))){_0x2bbc73[_0xff67('0x1a')]=qs[_0xff67('0x1a')](_0x54b92a[_0xff67('0x28')][_0xff67('0x1a')]);_0x2bbc73[_0xff67('0x19')]=qs[_0xff67('0x19')](_0x54b92a[_0xff67('0x28')][_0xff67('0x19')]);}_0x2bbc73[_0xff67('0x2f')]=qs[_0xff67('0x30')](_0x54b92a[_0xff67('0x28')][_0xff67('0x30')]);_0x2bbc73[_0xff67('0x31')]=qs['filters'](_[_0xff67('0x32')](_0x54b92a[_0xff67('0x28')],_0x3d485b[_0xff67('0x33')]),_0x22f760);if(_0x54b92a[_0xff67('0x28')]['filter']){_0x2bbc73['where']=_[_0xff67('0x34')](_0x2bbc73[_0xff67('0x31')],{'$or':_['map'](_0x22f760,function(_0x5e7b5f){if(_0x5e7b5f['type']!==_0xff67('0x35')){var _0x34d706={};_0x34d706[_0x5e7b5f[_0xff67('0x22')]]={'$like':'%'+_0x54b92a[_0xff67('0x28')][_0xff67('0x36')]+'%'};return _0x34d706;}})});}_0x2bbc73=_[_0xff67('0x34')]({},_0x2bbc73,_0x54b92a[_0xff67('0x37')]);var _0xfecc71={'where':_0x2bbc73[_0xff67('0x31')]};return db['OpenchannelTransferReport'][_0xff67('0x18')](_0xfecc71)['then'](function(_0x5abd8c){_0x49eeee['count']=_0x5abd8c;if(_0x54b92a[_0xff67('0x28')][_0xff67('0x38')]){_0x2bbc73[_0xff67('0x39')]=[{'all':!![]}];}return db[_0xff67('0x3a')][_0xff67('0x3b')](_0x2bbc73);})[_0xff67('0x21')](function(_0x44c932){_0x49eeee['rows']=_0x44c932;return _0x49eeee;})['then'](respondWithFilteredResult(_0xaaf7b9,_0x2bbc73))[_0xff67('0x3c')](handleError(_0xaaf7b9,null));};exports['show']=function(_0x477c78,_0x361056){var _0x49c542={'raw':!![],'where':{'id':_0x477c78['params']['id']}},_0x39c4de={};_0x39c4de[_0xff67('0x26')]=_[_0xff67('0x29')](db[_0xff67('0x3a')]['rawAttributes']);_0x39c4de[_0xff67('0x28')]=_['keys'](_0x477c78[_0xff67('0x28')]);_0x39c4de[_0xff67('0x33')]=_['intersection'](_0x39c4de['model'],_0x39c4de[_0xff67('0x28')]);_0x49c542[_0xff67('0x2b')]=_[_0xff67('0x2a')](_0x39c4de['model'],qs[_0xff67('0x2c')](_0x477c78[_0xff67('0x28')][_0xff67('0x2c')]));_0x49c542[_0xff67('0x2b')]=_0x49c542[_0xff67('0x2b')]['length']?_0x49c542[_0xff67('0x2b')]:_0x39c4de['model'];if(_0x477c78['query'][_0xff67('0x38')]){_0x49c542[_0xff67('0x39')]=[{'all':!![]}];}_0x49c542=_[_0xff67('0x34')]({},_0x49c542,_0x477c78['options']);return db['OpenchannelTransferReport'][_0xff67('0x3d')](_0x49c542)[_0xff67('0x21')](handleEntityNotFound(_0x361056,null))[_0xff67('0x21')](respondWithResult(_0x361056,null))[_0xff67('0x3c')](handleError(_0x361056,null));};exports['create']=function(_0x5c3f0e,_0xe9abcc){return db[_0xff67('0x3a')][_0xff67('0x3e')](_0x5c3f0e['body'],{})[_0xff67('0x21')](respondWithResult(_0xe9abcc,0xc9))[_0xff67('0x3c')](handleError(_0xe9abcc,null));};exports[_0xff67('0x3f')]=function(_0x245021,_0x56b29f){if(_0x245021[_0xff67('0x40')]['id']){delete _0x245021[_0xff67('0x40')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x245021['params']['id']}})['then'](handleEntityNotFound(_0x56b29f,null))['then'](saveUpdates(_0x245021[_0xff67('0x40')],null))['then'](respondWithResult(_0x56b29f,null))[_0xff67('0x3c')](handleError(_0x56b29f,null));};exports[_0xff67('0x20')]=function(_0x234ebd,_0xe49a02){return db[_0xff67('0x3a')][_0xff67('0x3d')]({'where':{'id':_0x234ebd[_0xff67('0x41')]['id']}})[_0xff67('0x21')](handleEntityNotFound(_0xe49a02,null))['then'](removeEntity(_0xe49a02,null))[_0xff67('0x3c')](handleError(_0xe49a02,null));};exports['describe']=function(_0x4e3ff7,_0x248541){return db[_0xff67('0x3a')][_0xff67('0x42')]()['then'](respondWithResult(_0x248541,null))['catch'](handleError(_0x248541,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0a520e4..0f9c05a 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 _0x5b47=['lodash','util','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','uniqueid'];(function(_0x515e2b,_0xb4a2b5){var _0xc74bef=function(_0x43d02b){while(--_0x43d02b){_0x515e2b['push'](_0x515e2b['shift']());}};_0xc74bef(++_0xb4a2b5);}(_0x5b47,0x120));var _0x75b4=function(_0x243945,_0x17705d){_0x243945=_0x243945-0x0;var _0x3034d2=_0x5b47[_0x243945];return _0x3034d2;};'use strict';var _=require(_0x75b4('0x0'));var util=require(_0x75b4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x75b4('0x2'));var rimraf=require(_0x75b4('0x3'));var config=require(_0x75b4('0x4'));var attributes=require(_0x75b4('0x5'));module[_0x75b4('0x6')]=function(_0x5f544a,_0x5ee223){return _0x5f544a['define'](_0x75b4('0x7'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x75b4('0x8'),'fields':[_0x75b4('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae30=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x3b58c9,_0x1f46c3){var _0x5b653a=function(_0xecac3b){while(--_0xecac3b){_0x3b58c9['push'](_0x3b58c9['shift']());}};_0x5b653a(++_0x1f46c3);}(_0xae30,0x10a));var _0x0ae3=function(_0x33cfe6,_0x3e215c){_0x33cfe6=_0x33cfe6-0x0;var _0x34b6cf=_0xae30[_0x33cfe6];return _0x34b6cf;};'use strict';var _=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var logger=require(_0x0ae3('0x2'))('api');var moment=require(_0x0ae3('0x3'));var BPromise=require(_0x0ae3('0x4'));var rp=require(_0x0ae3('0x5'));var fs=require('fs');var path=require(_0x0ae3('0x6'));var rimraf=require('rimraf');var config=require(_0x0ae3('0x7'));var attributes=require(_0x0ae3('0x8'));module[_0x0ae3('0x9')]=function(_0x7ce33e,_0x2b8c53){return _0x7ce33e[_0x0ae3('0xa')](_0x0ae3('0xb'),attributes,{'tableName':_0x0ae3('0xc'),'paranoid':![],'indexes':[{'name':_0x0ae3('0xd'),'fields':[_0x0ae3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 408ccf3..d7684ec 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 _0x4d1b=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x29ebf4,_0x38489d){var _0x18f197=function(_0x4449c3){while(--_0x4449c3){_0x29ebf4['push'](_0x29ebf4['shift']());}};_0x18f197(++_0x38489d);}(_0x4d1b,0x128));var _0xb4d1=function(_0x364b32,_0x4dec35){_0x364b32=_0x364b32-0x0;var _0x3f3ea0=_0x4d1b[_0x364b32];return _0x3f3ea0;};'use strict';var _=require(_0xb4d1('0x0'));var util=require(_0xb4d1('0x1'));var moment=require('moment');var BPromise=require(_0xb4d1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4d1('0x3'));var db=require(_0xb4d1('0x4'))['db'];var utils=require(_0xb4d1('0x5'));var logger=require(_0xb4d1('0x6'))(_0xb4d1('0x7'));var config=require(_0xb4d1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb4d1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c02c7,_0x52f371,_0x102ced){return new BPromise(function(_0x4cab1d,_0x301b90){return client[_0xb4d1('0xa')](_0x5c02c7,_0x102ced)['then'](function(_0x953c59){logger['info'](_0xb4d1('0xb'),_0x52f371,_0xb4d1('0xc'));logger[_0xb4d1('0xd')](_0xb4d1('0xe'),_0x52f371,_0xb4d1('0xc'),JSON['stringify'](_0x953c59));if(_0x953c59[_0xb4d1('0xf')]){if(_0x953c59['error'][_0xb4d1('0x10')]===0x1f4){logger[_0xb4d1('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x52f371,_0x953c59['error'][_0xb4d1('0x11')]);return _0x301b90(_0x953c59[_0xb4d1('0xf')][_0xb4d1('0x11')]);}logger[_0xb4d1('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x52f371,_0x953c59[_0xb4d1('0xf')][_0xb4d1('0x11')]);return _0x4cab1d(_0x953c59[_0xb4d1('0xf')]['message']);}else{logger[_0xb4d1('0x12')](_0xb4d1('0xb'),_0x52f371,'request\x20sent');_0x4cab1d(_0x953c59[_0xb4d1('0x13')][_0xb4d1('0x11')]);}})[_0xb4d1('0x14')](function(_0x52c24b){logger[_0xb4d1('0xf')](_0xb4d1('0xb'),_0x52f371,_0x52c24b);_0x301b90(_0x52c24b);});});} \ No newline at end of file +var _0x4ea1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x297da1,_0x128bed){var _0x5187d3=function(_0x59595f){while(--_0x59595f){_0x297da1['push'](_0x297da1['shift']());}};_0x5187d3(++_0x128bed);}(_0x4ea1,0x1ac));var _0x14ea=function(_0x1cbdf6,_0x1aa204){_0x1cbdf6=_0x1cbdf6-0x0;var _0x2dd5f7=_0x4ea1[_0x1cbdf6];return _0x2dd5f7;};'use strict';var _=require('lodash');var util=require(_0x14ea('0x0'));var moment=require(_0x14ea('0x1'));var BPromise=require(_0x14ea('0x2'));var rs=require(_0x14ea('0x3'));var fs=require('fs');var Redis=require(_0x14ea('0x4'));var db=require(_0x14ea('0x5'))['db'];var utils=require(_0x14ea('0x6'));var logger=require(_0x14ea('0x7'))(_0x14ea('0x8'));var config=require(_0x14ea('0x9'));var jayson=require(_0x14ea('0xa'));var client=jayson[_0x14ea('0xb')][_0x14ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x530440,_0x19c981,_0x401880){return new BPromise(function(_0xbfa6a8,_0x4b8ead){return client[_0x14ea('0xd')](_0x530440,_0x401880)[_0x14ea('0xe')](function(_0x4d35f4){logger[_0x14ea('0xf')](_0x14ea('0x10'),_0x19c981,_0x14ea('0x11'));logger['debug'](_0x14ea('0x12'),_0x19c981,_0x14ea('0x11'),JSON[_0x14ea('0x13')](_0x4d35f4));if(_0x4d35f4['error']){if(_0x4d35f4[_0x14ea('0x14')]['code']===0x1f4){logger['error'](_0x14ea('0x10'),_0x19c981,_0x4d35f4[_0x14ea('0x14')][_0x14ea('0x15')]);return _0x4b8ead(_0x4d35f4[_0x14ea('0x14')][_0x14ea('0x15')]);}logger[_0x14ea('0x14')](_0x14ea('0x10'),_0x19c981,_0x4d35f4[_0x14ea('0x14')][_0x14ea('0x15')]);return _0xbfa6a8(_0x4d35f4[_0x14ea('0x14')]['message']);}else{logger['info'](_0x14ea('0x10'),_0x19c981,'request\x20sent');_0xbfa6a8(_0x4d35f4[_0x14ea('0x16')]['message']);}})[_0x14ea('0x17')](function(_0x5d8d4e){logger[_0x14ea('0x14')](_0x14ea('0x10'),_0x19c981,_0x5d8d4e);_0x4b8ead(_0x5d8d4e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index cf34947..28189e7 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 _0xa3b8=['../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3d1203,_0xdca475){var _0x56166e=function(_0x4d51cd){while(--_0x4d51cd){_0x3d1203['push'](_0x3d1203['shift']());}};_0x56166e(++_0xdca475);}(_0xa3b8,0x19c));var _0x8a3b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa3b8[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x8a3b('0x0'));var util=require(_0x8a3b('0x1'));var path=require(_0x8a3b('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a3b('0x3'));var router=express[_0x8a3b('0x4')]();var auth=require(_0x8a3b('0x5'));var interaction=require(_0x8a3b('0x6'));var config=require(_0x8a3b('0x7'));var controller=require(_0x8a3b('0x8'));router[_0x8a3b('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a3b('0xa')]);router['get'](_0x8a3b('0xb'),auth[_0x8a3b('0xc')](),controller['show']);router[_0x8a3b('0xd')]('/',auth[_0x8a3b('0xc')](),controller[_0x8a3b('0xe')]);router['put'](_0x8a3b('0xb'),auth[_0x8a3b('0xc')](),controller[_0x8a3b('0xf')]);router[_0x8a3b('0x10')](_0x8a3b('0xb'),auth[_0x8a3b('0xc')](),controller[_0x8a3b('0x11')]);module[_0x8a3b('0x12')]=router; \ No newline at end of file +var _0xbd9f=['../../components/interaction/service','./pause.controller','get','isAuthenticated','show','create','put','delete','destroy','connect-timeout','Router'];(function(_0xaa902f,_0x1ee00e){var _0x679b11=function(_0xc6f978){while(--_0xc6f978){_0xaa902f['push'](_0xaa902f['shift']());}};_0x679b11(++_0x1ee00e);}(_0xbd9f,0x98));var _0xfbd9=function(_0x26b9fc,_0x17bafd){_0x26b9fc=_0x26b9fc-0x0;var _0x89ce9=_0xbd9f[_0x26b9fc];return _0x89ce9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfbd9('0x0'));var express=require('express');var router=express[_0xfbd9('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xfbd9('0x2'));var config=require('../../config/environment');var controller=require(_0xfbd9('0x3'));router[_0xfbd9('0x4')]('/',auth[_0xfbd9('0x5')](),controller['index']);router[_0xfbd9('0x4')]('/:id',auth[_0xfbd9('0x5')](),controller[_0xfbd9('0x6')]);router['post']('/',auth[_0xfbd9('0x5')](),controller[_0xfbd9('0x7')]);router[_0xfbd9('0x8')]('/:id',auth[_0xfbd9('0x5')](),controller['update']);router[_0xfbd9('0x9')]('/:id',auth[_0xfbd9('0x5')](),controller[_0xfbd9('0xa')]);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 435a47d..bc0fa18 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 _0x08e4=['name','STRING','sequelize','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x08e4,0x1de));var _0x408e=function(_0x520a87,_0x2f84d0){_0x520a87=_0x520a87-0x0;var _0x5e10b0=_0x08e4[_0x520a87];return _0x5e10b0;};'use strict';var Sequelize=require(_0x408e('0x0'));module[_0x408e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x408e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x408e('0x3')]}}; \ No newline at end of file +var _0x8e23=['sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8e23,0xea));var _0x38e2=function(_0x376f14,_0x2f3b18){_0x376f14=_0x376f14-0x0;var _0x36c1fb=_0x8e23[_0x376f14];return _0x36c1fb;};'use strict';var Sequelize=require(_0x38e2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 5a09dda..5882702 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 _0x6602=['rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','stack','name','index','Pause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','include','findAll'];(function(_0x56b97a,_0x225e30){var _0x2fc140=function(_0x314fcb){while(--_0x314fcb){_0x56b97a['push'](_0x56b97a['shift']());}};_0x2fc140(++_0x225e30);}(_0x6602,0x194));var _0x2660=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x6602[_0x476bf4];return _0x788ffe;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2660('0x0'));var zipdir=require(_0x2660('0x1'));var jsonpatch=require(_0x2660('0x2'));var rp=require('request-promise');var moment=require(_0x2660('0x3'));var BPromise=require(_0x2660('0x4'));var Mustache=require('mustache');var util=require(_0x2660('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2660('0x6'));var fs=require('fs');var _=require(_0x2660('0x7'));var squel=require(_0x2660('0x8'));var crypto=require('crypto');var jsforce=require(_0x2660('0x9'));var deskjs=require(_0x2660('0xa'));var toCsv=require(_0x2660('0xb'));var querystring=require(_0x2660('0xc'));var Papa=require('papaparse');var Redis=require(_0x2660('0xd'));var authService=require(_0x2660('0xe'));var qs=require(_0x2660('0xf'));var as=require(_0x2660('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2660('0x11'));var utils=require(_0x2660('0x12'));var config=require('../../config/environment');var db=require(_0x2660('0x13'))['db'];function respondWithStatusCode(_0x443239,_0x98a9ad){_0x98a9ad=_0x98a9ad||0xcc;return function(_0x3d4b06){if(_0x3d4b06){return _0x443239[_0x2660('0x14')](_0x98a9ad);}return _0x443239[_0x2660('0x15')](_0x98a9ad)[_0x2660('0x16')]();};}function respondWithResult(_0xd872a,_0xcd0d83){_0xcd0d83=_0xcd0d83||0xc8;return function(_0x5acff7){if(_0x5acff7){return _0xd872a['status'](_0xcd0d83)[_0x2660('0x17')](_0x5acff7);}};}function respondWithFilteredResult(_0x1ae55a,_0x3b3521){return function(_0x3c0bbf){if(_0x3c0bbf){var _0x36a102=_0x3c0bbf['count'],_0x6979dd=_0x3b3521[_0x2660('0x18')],_0x30cf42=_0x3b3521['offset']+_0x3b3521[_0x2660('0x19')],_0x245e17;if(_0x30cf42>=_0x36a102){_0x30cf42=_0x36a102;_0x245e17=0xc8;}else{_0x245e17=0xce;}_0x1ae55a['status'](_0x245e17);return _0x1ae55a[_0x2660('0x1a')](_0x2660('0x1b'),_0x6979dd+'-'+_0x30cf42+'/'+_0x36a102)[_0x2660('0x17')](_0x3c0bbf);}return null;};}function patchUpdates(_0xb19b6f){return function(_0x1f9a3f){try{jsonpatch[_0x2660('0x1c')](_0x1f9a3f,_0xb19b6f,!![]);}catch(_0x397c20){return BPromise['reject'](_0x397c20);}return _0x1f9a3f[_0x2660('0x1d')]();};}function saveUpdates(_0x59aaf3,_0x3676f2){return function(_0x2bd211){if(_0x2bd211){return _0x2bd211[_0x2660('0x1e')](_0x59aaf3)[_0x2660('0x1f')](function(_0x472a57){return _0x472a57;});}return null;};}function removeEntity(_0xd2f2d6,_0x542f10){return function(_0x22db03){if(_0x22db03){return _0x22db03[_0x2660('0x20')]()['then'](function(){var _0x5a1e8b=_0x22db03[_0x2660('0x21')]({'plain':!![]});var _0x2a5b3a=_0x2660('0x22');return db[_0x2660('0x23')][_0x2660('0x20')]({'where':{'type':_0x2a5b3a,'resourceId':_0x5a1e8b['id']}})[_0x2660('0x1f')](function(){return _0x22db03;});})[_0x2660('0x1f')](function(){_0xd2f2d6['status'](0xcc)[_0x2660('0x16')]();});}};}function handleEntityNotFound(_0x3014b8,_0x30234d){return function(_0x3bed06){if(!_0x3bed06){_0x3014b8[_0x2660('0x14')](0x194);}return _0x3bed06;};}function handleError(_0x558ddb,_0x192d38){_0x192d38=_0x192d38||0x1f4;return function(_0x83ed8b){logger['error'](_0x83ed8b[_0x2660('0x24')]);if(_0x83ed8b[_0x2660('0x25')]){delete _0x83ed8b[_0x2660('0x25')];}_0x558ddb['status'](_0x192d38)['send'](_0x83ed8b);};}exports[_0x2660('0x26')]=function(_0x159ba5,_0x4e58b0){var _0x43d98b={},_0x33b4c8={},_0x509eeb={'count':0x0,'rows':[]};var _0x1078d7=_['map'](db[_0x2660('0x27')][_0x2660('0x28')],function(_0x2713b2){return{'name':_0x2713b2[_0x2660('0x29')],'type':_0x2713b2[_0x2660('0x2a')][_0x2660('0x2b')]};});_0x33b4c8[_0x2660('0x2c')]=_[_0x2660('0x2d')](_0x1078d7,_0x2660('0x25'));_0x33b4c8[_0x2660('0x2e')]=_[_0x2660('0x2f')](_0x159ba5['query']);_0x33b4c8[_0x2660('0x30')]=_[_0x2660('0x31')](_0x33b4c8[_0x2660('0x2c')],_0x33b4c8[_0x2660('0x2e')]);_0x43d98b[_0x2660('0x32')]=_[_0x2660('0x31')](_0x33b4c8[_0x2660('0x2c')],qs[_0x2660('0x33')](_0x159ba5[_0x2660('0x2e')]['fields']));_0x43d98b[_0x2660('0x32')]=_0x43d98b[_0x2660('0x32')][_0x2660('0x34')]?_0x43d98b[_0x2660('0x32')]:_0x33b4c8[_0x2660('0x2c')];if(!_0x159ba5['query'][_0x2660('0x35')](_0x2660('0x36'))){_0x43d98b[_0x2660('0x19')]=qs[_0x2660('0x19')](_0x159ba5[_0x2660('0x2e')][_0x2660('0x19')]);_0x43d98b['offset']=qs[_0x2660('0x18')](_0x159ba5[_0x2660('0x2e')][_0x2660('0x18')]);}_0x43d98b[_0x2660('0x37')]=qs[_0x2660('0x38')](_0x159ba5[_0x2660('0x2e')]['sort']);_0x43d98b[_0x2660('0x39')]=qs[_0x2660('0x30')](_[_0x2660('0x3a')](_0x159ba5[_0x2660('0x2e')],_0x33b4c8[_0x2660('0x30')]),_0x1078d7);if(_0x159ba5[_0x2660('0x2e')][_0x2660('0x3b')]){_0x43d98b[_0x2660('0x39')]=_[_0x2660('0x3c')](_0x43d98b[_0x2660('0x39')],{'$or':_[_0x2660('0x2d')](_0x1078d7,function(_0x4dc0bd){if(_0x4dc0bd[_0x2660('0x2a')]!=='VIRTUAL'){var _0x175688={};_0x175688[_0x4dc0bd[_0x2660('0x25')]]={'$like':'%'+_0x159ba5[_0x2660('0x2e')][_0x2660('0x3b')]+'%'};return _0x175688;}})});}_0x43d98b=_[_0x2660('0x3c')]({},_0x43d98b,_0x159ba5['options']);var _0x553dcd={'where':_0x43d98b[_0x2660('0x39')]};return db[_0x2660('0x27')][_0x2660('0x3d')](_0x553dcd)['then'](function(_0xe452a0){_0x509eeb[_0x2660('0x3d')]=_0xe452a0;if(_0x159ba5['query']['includeAll']){_0x43d98b[_0x2660('0x3e')]=[{'all':!![]}];}return db['Pause'][_0x2660('0x3f')](_0x43d98b);})['then'](function(_0x197326){_0x509eeb[_0x2660('0x40')]=_0x197326;return _0x509eeb;})[_0x2660('0x1f')](respondWithFilteredResult(_0x4e58b0,_0x43d98b))[_0x2660('0x41')](handleError(_0x4e58b0,null));};exports[_0x2660('0x42')]=function(_0x3251cb,_0xc1db87){var _0x41b424={'raw':!![],'where':{'id':_0x3251cb[_0x2660('0x43')]['id']}},_0x304e97={};_0x304e97[_0x2660('0x2c')]=_['keys'](db['Pause']['rawAttributes']);_0x304e97['query']=_[_0x2660('0x2f')](_0x3251cb[_0x2660('0x2e')]);_0x304e97[_0x2660('0x30')]=_['intersection'](_0x304e97['model'],_0x304e97[_0x2660('0x2e')]);_0x41b424[_0x2660('0x32')]=_[_0x2660('0x31')](_0x304e97['model'],qs[_0x2660('0x33')](_0x3251cb[_0x2660('0x2e')][_0x2660('0x33')]));_0x41b424[_0x2660('0x32')]=_0x41b424[_0x2660('0x32')]['length']?_0x41b424[_0x2660('0x32')]:_0x304e97['model'];if(_0x3251cb[_0x2660('0x2e')][_0x2660('0x44')]){_0x41b424[_0x2660('0x3e')]=[{'all':!![]}];}_0x41b424=_[_0x2660('0x3c')]({},_0x41b424,_0x3251cb['options']);return db['Pause'][_0x2660('0x45')](_0x41b424)[_0x2660('0x1f')](handleEntityNotFound(_0xc1db87,null))[_0x2660('0x1f')](respondWithResult(_0xc1db87,null))[_0x2660('0x41')](handleError(_0xc1db87,null));};exports[_0x2660('0x46')]=function(_0x4e8cd8,_0x55358f){return db[_0x2660('0x27')][_0x2660('0x46')](_0x4e8cd8['body'],{})[_0x2660('0x1f')](function(_0x4d7fc8){var _0x4d681c=_0x4e8cd8[_0x2660('0x47')]['get']({'plain':!![]});if(!_0x4d681c)throw new Error(_0x2660('0x48'));if(_0x4d681c[_0x2660('0x49')]==='user'){var _0x3d9488=_0x4d7fc8[_0x2660('0x21')]({'plain':!![]});var _0x158ff7=_0x2660('0x22');return db['UserProfileSection'][_0x2660('0x45')]({'where':{'name':_0x158ff7,'userProfileId':_0x4d681c[_0x2660('0x4a')]},'raw':!![]})['then'](function(_0x255478){if(_0x255478&&_0x255478[_0x2660('0x4b')]===0x0){return db[_0x2660('0x23')]['create']({'name':_0x3d9488['name'],'resourceId':_0x3d9488['id'],'type':_0x255478[_0x2660('0x25')],'sectionId':_0x255478['id']},{})[_0x2660('0x1f')](function(){return _0x4d7fc8;});}else{return _0x4d7fc8;}})[_0x2660('0x41')](function(_0x472dbc){logger[_0x2660('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x472dbc);throw _0x472dbc;});}return _0x4d7fc8;})['then'](respondWithResult(_0x55358f,0xc9))[_0x2660('0x41')](handleError(_0x55358f,null));};exports[_0x2660('0x1e')]=function(_0x11801d,_0x3b0c33){if(_0x11801d[_0x2660('0x4d')]['id']){delete _0x11801d['body']['id'];}return db[_0x2660('0x27')][_0x2660('0x45')]({'where':{'id':_0x11801d[_0x2660('0x43')]['id']}})[_0x2660('0x1f')](handleEntityNotFound(_0x3b0c33,null))[_0x2660('0x1f')](saveUpdates(_0x11801d[_0x2660('0x4d')],null))['then'](respondWithResult(_0x3b0c33,null))['catch'](handleError(_0x3b0c33,null));};exports['destroy']=function(_0x501a1e,_0x426822){return db[_0x2660('0x27')]['find']({'where':{'id':_0x501a1e['params']['id']}})[_0x2660('0x1f')](handleEntityNotFound(_0x426822,null))[_0x2660('0x1f')](removeEntity(_0x426822,null))[_0x2660('0x41')](handleError(_0x426822,null));}; \ No newline at end of file +var _0x2874=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','model','map','keys','filters','intersection','attributes','query','length','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','show','fields','include','options'];(function(_0x1c4e70,_0x20c24f){var _0x43d1a7=function(_0x30463d){while(--_0x30463d){_0x1c4e70['push'](_0x1c4e70['shift']());}};_0x43d1a7(++_0x20c24f);}(_0x2874,0x14a));var _0x4287=function(_0x304d1f,_0x41e22f){_0x304d1f=_0x304d1f-0x0;var _0x3e3583=_0x2874[_0x304d1f];return _0x3e3583;};'use strict';var pdf=require(_0x4287('0x0'));var emlformat=require(_0x4287('0x1'));var rimraf=require(_0x4287('0x2'));var zipdir=require(_0x4287('0x3'));var jsonpatch=require(_0x4287('0x4'));var rp=require('request-promise');var moment=require(_0x4287('0x5'));var BPromise=require(_0x4287('0x6'));var Mustache=require('mustache');var util=require(_0x4287('0x7'));var path=require(_0x4287('0x8'));var sox=require(_0x4287('0x9'));var csv=require('to-csv');var ejs=require(_0x4287('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4287('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4287('0xc'));var toCsv=require(_0x4287('0xd'));var querystring=require(_0x4287('0xe'));var Papa=require(_0x4287('0xf'));var Redis=require(_0x4287('0x10'));var authService=require(_0x4287('0x11'));var qs=require(_0x4287('0x12'));var as=require(_0x4287('0x13'));var hardwareService=require(_0x4287('0x14'));var logger=require(_0x4287('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4287('0x16'));var db=require(_0x4287('0x17'))['db'];function respondWithStatusCode(_0x7091,_0x1300e9){_0x1300e9=_0x1300e9||0xcc;return function(_0x4c9bc9){if(_0x4c9bc9){return _0x7091[_0x4287('0x18')](_0x1300e9);}return _0x7091[_0x4287('0x19')](_0x1300e9)[_0x4287('0x1a')]();};}function respondWithResult(_0xd430b8,_0x5f1660){_0x5f1660=_0x5f1660||0xc8;return function(_0x30c182){if(_0x30c182){return _0xd430b8[_0x4287('0x19')](_0x5f1660)[_0x4287('0x1b')](_0x30c182);}};}function respondWithFilteredResult(_0x314be8,_0x1b4d57){return function(_0x351b9c){if(_0x351b9c){var _0x118c19=_0x351b9c[_0x4287('0x1c')],_0x41a8d7=_0x1b4d57[_0x4287('0x1d')],_0x5b892c=_0x1b4d57[_0x4287('0x1d')]+_0x1b4d57[_0x4287('0x1e')],_0x131446;if(_0x5b892c>=_0x118c19){_0x5b892c=_0x118c19;_0x131446=0xc8;}else{_0x131446=0xce;}_0x314be8[_0x4287('0x19')](_0x131446);return _0x314be8[_0x4287('0x1f')](_0x4287('0x20'),_0x41a8d7+'-'+_0x5b892c+'/'+_0x118c19)[_0x4287('0x1b')](_0x351b9c);}return null;};}function patchUpdates(_0x4140d8){return function(_0x4bf86d){try{jsonpatch['apply'](_0x4bf86d,_0x4140d8,!![]);}catch(_0x1b5b90){return BPromise['reject'](_0x1b5b90);}return _0x4bf86d[_0x4287('0x21')]();};}function saveUpdates(_0x479ef7,_0x41696f){return function(_0x3e6c63){if(_0x3e6c63){return _0x3e6c63[_0x4287('0x22')](_0x479ef7)[_0x4287('0x23')](function(_0x36ce92){return _0x36ce92;});}return null;};}function removeEntity(_0x4ba208,_0x2a7f48){return function(_0x569da0){if(_0x569da0){return _0x569da0[_0x4287('0x24')]()[_0x4287('0x23')](function(){var _0x38c2b4=_0x569da0[_0x4287('0x25')]({'plain':!![]});var _0x5268fe='Pauses';return db[_0x4287('0x26')]['destroy']({'where':{'type':_0x5268fe,'resourceId':_0x38c2b4['id']}})[_0x4287('0x23')](function(){return _0x569da0;});})['then'](function(){_0x4ba208[_0x4287('0x19')](0xcc)[_0x4287('0x1a')]();});}};}function handleEntityNotFound(_0x2e03c9,_0x38486e){return function(_0x3aade2){if(!_0x3aade2){_0x2e03c9[_0x4287('0x18')](0x194);}return _0x3aade2;};}function handleError(_0x1ea499,_0x1b3a96){_0x1b3a96=_0x1b3a96||0x1f4;return function(_0x11377a){logger[_0x4287('0x27')](_0x11377a[_0x4287('0x28')]);if(_0x11377a[_0x4287('0x29')]){delete _0x11377a[_0x4287('0x29')];}_0x1ea499[_0x4287('0x19')](_0x1b3a96)[_0x4287('0x2a')](_0x11377a);};}exports[_0x4287('0x2b')]=function(_0x25b1ab,_0x4d2433){var _0x161a0c={},_0x3aa7a3={},_0x5be179={'count':0x0,'rows':[]};var _0x51da95=_['map'](db[_0x4287('0x2c')][_0x4287('0x2d')],function(_0x10c1b5){return{'name':_0x10c1b5[_0x4287('0x2e')],'type':_0x10c1b5[_0x4287('0x2f')]['key']};});_0x3aa7a3[_0x4287('0x30')]=_[_0x4287('0x31')](_0x51da95,_0x4287('0x29'));_0x3aa7a3['query']=_[_0x4287('0x32')](_0x25b1ab['query']);_0x3aa7a3[_0x4287('0x33')]=_[_0x4287('0x34')](_0x3aa7a3[_0x4287('0x30')],_0x3aa7a3['query']);_0x161a0c[_0x4287('0x35')]=_[_0x4287('0x34')](_0x3aa7a3[_0x4287('0x30')],qs['fields'](_0x25b1ab[_0x4287('0x36')]['fields']));_0x161a0c[_0x4287('0x35')]=_0x161a0c['attributes'][_0x4287('0x37')]?_0x161a0c[_0x4287('0x35')]:_0x3aa7a3[_0x4287('0x30')];if(!_0x25b1ab['query']['hasOwnProperty'](_0x4287('0x38'))){_0x161a0c[_0x4287('0x1e')]=qs[_0x4287('0x1e')](_0x25b1ab['query'][_0x4287('0x1e')]);_0x161a0c[_0x4287('0x1d')]=qs[_0x4287('0x1d')](_0x25b1ab[_0x4287('0x36')][_0x4287('0x1d')]);}_0x161a0c[_0x4287('0x39')]=qs[_0x4287('0x3a')](_0x25b1ab['query']['sort']);_0x161a0c[_0x4287('0x3b')]=qs[_0x4287('0x33')](_['pick'](_0x25b1ab[_0x4287('0x36')],_0x3aa7a3[_0x4287('0x33')]),_0x51da95);if(_0x25b1ab[_0x4287('0x36')]['filter']){_0x161a0c['where']=_[_0x4287('0x3c')](_0x161a0c[_0x4287('0x3b')],{'$or':_[_0x4287('0x31')](_0x51da95,function(_0x4be43f){if(_0x4be43f['type']!==_0x4287('0x3d')){var _0x1a2bc0={};_0x1a2bc0[_0x4be43f[_0x4287('0x29')]]={'$like':'%'+_0x25b1ab[_0x4287('0x36')][_0x4287('0x3e')]+'%'};return _0x1a2bc0;}})});}_0x161a0c=_[_0x4287('0x3c')]({},_0x161a0c,_0x25b1ab['options']);var _0x1ba8d3={'where':_0x161a0c[_0x4287('0x3b')]};return db[_0x4287('0x2c')][_0x4287('0x1c')](_0x1ba8d3)['then'](function(_0x47ba15){_0x5be179[_0x4287('0x1c')]=_0x47ba15;if(_0x25b1ab['query'][_0x4287('0x3f')]){_0x161a0c['include']=[{'all':!![]}];}return db[_0x4287('0x2c')]['findAll'](_0x161a0c);})['then'](function(_0x201ff8){_0x5be179[_0x4287('0x40')]=_0x201ff8;return _0x5be179;})[_0x4287('0x23')](respondWithFilteredResult(_0x4d2433,_0x161a0c))[_0x4287('0x41')](handleError(_0x4d2433,null));};exports[_0x4287('0x42')]=function(_0x2a28f9,_0x2d85b0){var _0x37c820={'raw':!![],'where':{'id':_0x2a28f9['params']['id']}},_0x28161b={};_0x28161b['model']=_[_0x4287('0x32')](db[_0x4287('0x2c')][_0x4287('0x2d')]);_0x28161b[_0x4287('0x36')]=_[_0x4287('0x32')](_0x2a28f9[_0x4287('0x36')]);_0x28161b[_0x4287('0x33')]=_[_0x4287('0x34')](_0x28161b[_0x4287('0x30')],_0x28161b[_0x4287('0x36')]);_0x37c820[_0x4287('0x35')]=_[_0x4287('0x34')](_0x28161b[_0x4287('0x30')],qs[_0x4287('0x43')](_0x2a28f9['query']['fields']));_0x37c820[_0x4287('0x35')]=_0x37c820[_0x4287('0x35')][_0x4287('0x37')]?_0x37c820[_0x4287('0x35')]:_0x28161b[_0x4287('0x30')];if(_0x2a28f9[_0x4287('0x36')][_0x4287('0x3f')]){_0x37c820[_0x4287('0x44')]=[{'all':!![]}];}_0x37c820=_['merge']({},_0x37c820,_0x2a28f9[_0x4287('0x45')]);return db[_0x4287('0x2c')][_0x4287('0x46')](_0x37c820)[_0x4287('0x23')](handleEntityNotFound(_0x2d85b0,null))[_0x4287('0x23')](respondWithResult(_0x2d85b0,null))[_0x4287('0x41')](handleError(_0x2d85b0,null));};exports['create']=function(_0x5abd37,_0x4222fd){return db[_0x4287('0x2c')][_0x4287('0x47')](_0x5abd37[_0x4287('0x48')],{})[_0x4287('0x23')](function(_0x3ef8cf){var _0x3f2595=_0x5abd37[_0x4287('0x49')][_0x4287('0x25')]({'plain':!![]});if(!_0x3f2595)throw new Error(_0x4287('0x4a'));if(_0x3f2595[_0x4287('0x4b')]==='user'){var _0x2054f4=_0x3ef8cf[_0x4287('0x25')]({'plain':!![]});var _0x275ecf=_0x4287('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x275ecf,'userProfileId':_0x3f2595[_0x4287('0x4d')]},'raw':!![]})['then'](function(_0x1da790){if(_0x1da790&&_0x1da790['autoAssociation']===0x0){return db['UserProfileResource'][_0x4287('0x47')]({'name':_0x2054f4[_0x4287('0x29')],'resourceId':_0x2054f4['id'],'type':_0x1da790[_0x4287('0x29')],'sectionId':_0x1da790['id']},{})[_0x4287('0x23')](function(){return _0x3ef8cf;});}else{return _0x3ef8cf;}})[_0x4287('0x41')](function(_0x508aa6){logger[_0x4287('0x27')](_0x4287('0x4e'),_0x508aa6);throw _0x508aa6;});}return _0x3ef8cf;})[_0x4287('0x23')](respondWithResult(_0x4222fd,0xc9))['catch'](handleError(_0x4222fd,null));};exports[_0x4287('0x22')]=function(_0x2f5c9d,_0x48c73c){if(_0x2f5c9d[_0x4287('0x48')]['id']){delete _0x2f5c9d[_0x4287('0x48')]['id'];}return db[_0x4287('0x2c')][_0x4287('0x46')]({'where':{'id':_0x2f5c9d[_0x4287('0x4f')]['id']}})[_0x4287('0x23')](handleEntityNotFound(_0x48c73c,null))[_0x4287('0x23')](saveUpdates(_0x2f5c9d[_0x4287('0x48')],null))[_0x4287('0x23')](respondWithResult(_0x48c73c,null))[_0x4287('0x41')](handleError(_0x48c73c,null));};exports[_0x4287('0x24')]=function(_0x40528b,_0x5e3454){return db['Pause'][_0x4287('0x46')]({'where':{'id':_0x40528b['params']['id']}})[_0x4287('0x23')](handleEntityNotFound(_0x5e3454,null))[_0x4287('0x23')](removeEntity(_0x5e3454,null))['catch'](handleError(_0x5e3454,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a3e2547..3e7a0bf 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 _0x1ea2=['Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x21d16e,_0x42b9dc){var _0x22141b=function(_0xbdecac){while(--_0xbdecac){_0x21d16e['push'](_0x21d16e['shift']());}};_0x22141b(++_0x42b9dc);}(_0x1ea2,0x169));var _0x21ea=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x1ea2[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x21ea('0x0'));var util=require(_0x21ea('0x1'));var logger=require(_0x21ea('0x2'))(_0x21ea('0x3'));var moment=require('moment');var BPromise=require(_0x21ea('0x4'));var rp=require(_0x21ea('0x5'));var fs=require('fs');var path=require(_0x21ea('0x6'));var rimraf=require(_0x21ea('0x7'));var config=require(_0x21ea('0x8'));var attributes=require(_0x21ea('0x9'));module[_0x21ea('0xa')]=function(_0x5ca06c,_0x361158){return _0x5ca06c['define'](_0x21ea('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e5f=['exports','define','Pause','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x7e5f,0x196));var _0xf7e5=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0x7e5f[_0x229128];return _0x1875b9;};'use strict';var _=require(_0xf7e5('0x0'));var util=require(_0xf7e5('0x1'));var logger=require(_0xf7e5('0x2'))('api');var moment=require(_0xf7e5('0x3'));var BPromise=require(_0xf7e5('0x4'));var rp=require(_0xf7e5('0x5'));var fs=require('fs');var path=require(_0xf7e5('0x6'));var rimraf=require(_0xf7e5('0x7'));var config=require(_0xf7e5('0x8'));var attributes=require(_0xf7e5('0x9'));module[_0xf7e5('0xa')]=function(_0x22a074,_0x3d8225){return _0x22a074[_0xf7e5('0xb')](_0xf7e5('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 21fd86e..d6ca906 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 _0xf930=['debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','ShowPause','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s'];(function(_0x125d3e,_0x434e96){var _0x1e59fe=function(_0x1b814){while(--_0x1b814){_0x125d3e['push'](_0x125d3e['shift']());}};_0x1e59fe(++_0x434e96);}(_0xf930,0x15b));var _0x0f93=function(_0x75cb0b,_0x18f240){_0x75cb0b=_0x75cb0b-0x0;var _0x8e5bff=_0xf930[_0x75cb0b];return _0x8e5bff;};'use strict';var _=require(_0x0f93('0x0'));var util=require(_0x0f93('0x1'));var moment=require(_0x0f93('0x2'));var BPromise=require(_0x0f93('0x3'));var rs=require(_0x0f93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f93('0x5'))['db'];var utils=require(_0x0f93('0x6'));var logger=require(_0x0f93('0x7'))(_0x0f93('0x8'));var config=require(_0x0f93('0x9'));var jayson=require(_0x0f93('0xa'));var client=jayson[_0x0f93('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbf422,_0x3730fe,_0x38d0b0){return new BPromise(function(_0x471056,_0x3122e9){return client[_0x0f93('0xc')](_0xbf422,_0x38d0b0)[_0x0f93('0xd')](function(_0x1385fc){logger[_0x0f93('0xe')](_0x0f93('0xf'),_0x3730fe,'request\x20sent');logger[_0x0f93('0x10')](_0x0f93('0x11'),_0x3730fe,_0x0f93('0x12'),JSON[_0x0f93('0x13')](_0x1385fc));if(_0x1385fc['error']){if(_0x1385fc['error'][_0x0f93('0x14')]===0x1f4){logger[_0x0f93('0x15')](_0x0f93('0xf'),_0x3730fe,_0x1385fc[_0x0f93('0x15')][_0x0f93('0x16')]);return _0x3122e9(_0x1385fc[_0x0f93('0x15')][_0x0f93('0x16')]);}logger['error'](_0x0f93('0xf'),_0x3730fe,_0x1385fc[_0x0f93('0x15')][_0x0f93('0x16')]);return _0x471056(_0x1385fc[_0x0f93('0x15')][_0x0f93('0x16')]);}else{logger['info'](_0x0f93('0xf'),_0x3730fe,'request\x20sent');_0x471056(_0x1385fc[_0x0f93('0x17')][_0x0f93('0x16')]);}})[_0x0f93('0x18')](function(_0x288ceb){logger[_0x0f93('0x15')](_0x0f93('0xf'),_0x3730fe,_0x288ceb);_0x3122e9(_0x288ceb);});});}exports[_0x0f93('0x19')]=function(_0x29580b){var _0x4d3b8e=this;return new Promise(function(_0x529f66,_0xd65b18){return db['Pause']['find']({'raw':_0x29580b[_0x0f93('0x1a')]?_0x29580b[_0x0f93('0x1a')][_0x0f93('0x1b')]===undefined?!![]:![]:!![],'where':_0x29580b[_0x0f93('0x1a')]?_0x29580b[_0x0f93('0x1a')][_0x0f93('0x1c')]||null:null,'attributes':_0x29580b[_0x0f93('0x1a')]?_0x29580b['options'][_0x0f93('0x1d')]||null:null,'include':_0x29580b[_0x0f93('0x1a')]?_0x29580b[_0x0f93('0x1a')][_0x0f93('0x1e')]?_[_0x0f93('0x1f')](_0x29580b[_0x0f93('0x1a')]['include'],function(_0x57f2bf){return{'model':db[_0x57f2bf[_0x0f93('0x20')]],'as':_0x57f2bf['as'],'attributes':_0x57f2bf[_0x0f93('0x1d')],'include':_0x57f2bf[_0x0f93('0x1e')]?_[_0x0f93('0x1f')](_0x57f2bf[_0x0f93('0x1e')],function(_0x4723b0){return{'model':db[_0x4723b0[_0x0f93('0x20')]],'as':_0x4723b0['as'],'attributes':_0x4723b0[_0x0f93('0x1d')],'include':_0x4723b0[_0x0f93('0x1e')]?_[_0x0f93('0x1f')](_0x4723b0[_0x0f93('0x1e')],function(_0x3e685d){return{'model':db[_0x3e685d[_0x0f93('0x20')]],'as':_0x3e685d['as'],'attributes':_0x3e685d[_0x0f93('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0f93('0xd')](function(_0x4ab066){logger[_0x0f93('0xe')]('ShowPause',_0x29580b);logger['debug'](_0x0f93('0x19'),_0x29580b,JSON[_0x0f93('0x13')](_0x4ab066));_0x529f66(_0x4ab066);})[_0x0f93('0x18')](function(_0x2a8a38){logger[_0x0f93('0x15')](_0x0f93('0x19'),_0x2a8a38[_0x0f93('0x16')],_0x29580b);_0xd65b18(_0x4d3b8e['error'](0x1f4,_0x2a8a38['message']));});});}; \ No newline at end of file +var _0x67b4=['client','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowPause','Pause','find','options','raw','attributes','include','model','map','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x429eb3,_0x2ec8ea){var _0xa621c3=function(_0x230fdd){while(--_0x230fdd){_0x429eb3['push'](_0x429eb3['shift']());}};_0xa621c3(++_0x2ec8ea);}(_0x67b4,0x1d7));var _0x467b=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x67b4[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x467b('0x0'));var util=require('util');var moment=require(_0x467b('0x1'));var BPromise=require('bluebird');var rs=require(_0x467b('0x2'));var fs=require('fs');var Redis=require(_0x467b('0x3'));var db=require(_0x467b('0x4'))['db'];var utils=require(_0x467b('0x5'));var logger=require(_0x467b('0x6'))('rpc');var config=require(_0x467b('0x7'));var jayson=require(_0x467b('0x8'));var client=jayson[_0x467b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x178580,_0xfe0f28,_0x13e6f7){return new BPromise(function(_0x230fff,_0x20556f){return client[_0x467b('0xa')](_0x178580,_0x13e6f7)[_0x467b('0xb')](function(_0x5a8dc2){logger[_0x467b('0xc')](_0x467b('0xd'),_0xfe0f28,_0x467b('0xe'));logger['debug'](_0x467b('0xf'),_0xfe0f28,_0x467b('0xe'),JSON[_0x467b('0x10')](_0x5a8dc2));if(_0x5a8dc2[_0x467b('0x11')]){if(_0x5a8dc2[_0x467b('0x11')]['code']===0x1f4){logger[_0x467b('0x11')]('Pause,\x20%s,\x20%s',_0xfe0f28,_0x5a8dc2[_0x467b('0x11')]['message']);return _0x20556f(_0x5a8dc2[_0x467b('0x11')][_0x467b('0x12')]);}logger[_0x467b('0x11')](_0x467b('0xd'),_0xfe0f28,_0x5a8dc2[_0x467b('0x11')][_0x467b('0x12')]);return _0x230fff(_0x5a8dc2[_0x467b('0x11')][_0x467b('0x12')]);}else{logger['info'](_0x467b('0xd'),_0xfe0f28,_0x467b('0xe'));_0x230fff(_0x5a8dc2[_0x467b('0x13')][_0x467b('0x12')]);}})[_0x467b('0x14')](function(_0x2779b9){logger[_0x467b('0x11')](_0x467b('0xd'),_0xfe0f28,_0x2779b9);_0x20556f(_0x2779b9);});});}exports[_0x467b('0x15')]=function(_0x5d20ae){var _0x2b3243=this;return new Promise(function(_0x175ed5,_0x39a9f4){return db[_0x467b('0x16')][_0x467b('0x17')]({'raw':_0x5d20ae['options']?_0x5d20ae[_0x467b('0x18')][_0x467b('0x19')]===undefined?!![]:![]:!![],'where':_0x5d20ae[_0x467b('0x18')]?_0x5d20ae['options']['where']||null:null,'attributes':_0x5d20ae['options']?_0x5d20ae[_0x467b('0x18')][_0x467b('0x1a')]||null:null,'include':_0x5d20ae[_0x467b('0x18')]?_0x5d20ae[_0x467b('0x18')][_0x467b('0x1b')]?_['map'](_0x5d20ae[_0x467b('0x18')][_0x467b('0x1b')],function(_0xe9204c){return{'model':db[_0xe9204c[_0x467b('0x1c')]],'as':_0xe9204c['as'],'attributes':_0xe9204c[_0x467b('0x1a')],'include':_0xe9204c[_0x467b('0x1b')]?_[_0x467b('0x1d')](_0xe9204c[_0x467b('0x1b')],function(_0x8a35b0){return{'model':db[_0x8a35b0[_0x467b('0x1c')]],'as':_0x8a35b0['as'],'attributes':_0x8a35b0[_0x467b('0x1a')],'include':_0x8a35b0['include']?_['map'](_0x8a35b0[_0x467b('0x1b')],function(_0x3dd2c7){return{'model':db[_0x3dd2c7['model']],'as':_0x3dd2c7['as'],'attributes':_0x3dd2c7[_0x467b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b3c71){logger['info'](_0x467b('0x15'),_0x5d20ae);logger['debug'](_0x467b('0x15'),_0x5d20ae,JSON[_0x467b('0x10')](_0x2b3c71));_0x175ed5(_0x2b3c71);})[_0x467b('0x14')](function(_0x2dbd82){logger[_0x467b('0x11')](_0x467b('0x15'),_0x2dbd82[_0x467b('0x12')],_0x5d20ae);_0x39a9f4(_0x2b3243[_0x467b('0x11')](0x1f4,_0x2dbd82['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 79e289e..9427f79 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 _0x248e=['../../components/auth/service','./plugin.controller','index','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','file','upload','/webhook','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0x4590f0,_0x1be3ff){var _0x37ef00=function(_0x2245f3){while(--_0x2245f3){_0x4590f0['push'](_0x4590f0['shift']());}};_0x37ef00(++_0x1be3ff);}(_0x248e,0x8e));var _0xe248=function(_0x3bffc0,_0xe8affa){_0x3bffc0=_0x3bffc0-0x0;var _0x44a082=_0x248e[_0x3bffc0];return _0x44a082;};'use strict';var multer=require(_0xe248('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe248('0x1'));var express=require('express');var router=express[_0xe248('0x2')]();var auth=require(_0xe248('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe248('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xe248('0x5')]);router[_0xe248('0x6')]('/webhook',controller[_0xe248('0x7')]);router['get'](_0xe248('0x8'),auth[_0xe248('0x9')](),controller[_0xe248('0xa')]);router[_0xe248('0x6')](_0xe248('0xb'),auth[_0xe248('0x9')](),controller[_0xe248('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b7bbf,_0x497481,_0x6327a4){_0x6327a4(null,path[_0xe248('0xd')](config['root'],_0xe248('0xe')));},'filename':function(_0x25892a,_0x4d8b89,_0x1e136d){_0x4d8b89[_0xe248('0xf')]=_0x4d8b89[_0xe248('0xf')][_0xe248('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e136d(null,util['format'](_0xe248('0x11'),path[_0xe248('0x12')](_0x4d8b89[_0xe248('0xf')],path[_0xe248('0x13')](_0x4d8b89[_0xe248('0xf')])),Date[_0xe248('0x14')](),path[_0xe248('0x13')](_0x4d8b89[_0xe248('0xf')])));}})});router[_0xe248('0x15')]('/',upload['single'](_0xe248('0x16')),controller[_0xe248('0x17')]);router[_0xe248('0x15')](_0xe248('0x18'),controller['webhookPost']);router[_0xe248('0x19')](_0xe248('0x8'),auth[_0xe248('0x9')](),controller[_0xe248('0x1a')]);router[_0xe248('0x1b')]('/:id',auth[_0xe248('0x9')](),controller[_0xe248('0x1b')]);module[_0xe248('0x1c')]=router; \ No newline at end of file +var _0x3b84=['originalname','basename','extname','upload','webhookPost','put','update','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','show','/:id/download','join','root','server/files/plugins'];(function(_0x1bc76e,_0x3c2452){var _0x549281=function(_0x1b2f6f){while(--_0x1b2f6f){_0x1bc76e['push'](_0x1bc76e['shift']());}};_0x549281(++_0x3c2452);}(_0x3b84,0xce));var _0x43b8=function(_0x246c26,_0x52adea){_0x246c26=_0x246c26-0x0;var _0x29b836=_0x3b84[_0x246c26];return _0x29b836;};'use strict';var multer=require(_0x43b8('0x0'));var util=require(_0x43b8('0x1'));var path=require(_0x43b8('0x2'));var timeout=require(_0x43b8('0x3'));var express=require(_0x43b8('0x4'));var router=express[_0x43b8('0x5')]();var auth=require(_0x43b8('0x6'));var interaction=require(_0x43b8('0x7'));var config=require(_0x43b8('0x8'));var controller=require('./plugin.controller');router[_0x43b8('0x9')]('/',auth[_0x43b8('0xa')](),controller['index']);router[_0x43b8('0x9')](_0x43b8('0xb'),controller[_0x43b8('0xc')]);router['get']('/:id',auth[_0x43b8('0xa')](),controller[_0x43b8('0xd')]);router[_0x43b8('0x9')](_0x43b8('0xe'),auth[_0x43b8('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2f0983,_0x38bdaf,_0x42d2cd){_0x42d2cd(null,path[_0x43b8('0xf')](config[_0x43b8('0x10')],_0x43b8('0x11')));},'filename':function(_0x57eb77,_0xc1b1d5,_0x2b0c5b){_0xc1b1d5[_0x43b8('0x12')]=_0xc1b1d5[_0x43b8('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2b0c5b(null,util['format']('%s-%s%s',path[_0x43b8('0x13')](_0xc1b1d5[_0x43b8('0x12')],path[_0x43b8('0x14')](_0xc1b1d5[_0x43b8('0x12')])),Date['now'](),path[_0x43b8('0x14')](_0xc1b1d5[_0x43b8('0x12')])));}})});router['post']('/',upload['single']('file'),controller[_0x43b8('0x15')]);router['post']('/webhook',controller[_0x43b8('0x16')]);router[_0x43b8('0x17')]('/:id',auth[_0x43b8('0xa')](),controller[_0x43b8('0x18')]);router['delete'](_0x43b8('0x19'),auth[_0x43b8('0xa')](),controller[_0x43b8('0x1a')]);module[_0x43b8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 9b4e44b..ae5295f 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 _0x1ac5=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x1ac5,0x1a8));var _0x51ac=function(_0x4c9892,_0x2bd93b){_0x4c9892=_0x4c9892-0x0;var _0x580006=_0x1ac5[_0x4c9892];return _0x580006;};'use strict';var Sequelize=require('sequelize');module[_0x51ac('0x0')]={'name':{'type':Sequelize[_0x51ac('0x1')]},'type':{'type':Sequelize[_0x51ac('0x2')](_0x51ac('0x3'),_0x51ac('0x4'))},'description':{'type':Sequelize[_0x51ac('0x5')]},'version':{'type':Sequelize[_0x51ac('0x5')]},'path':{'type':Sequelize[_0x51ac('0x1')],'comment':_0x51ac('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x51ac('0x7')},'sidebar':{'type':Sequelize[_0x51ac('0x2')]('adminOnly','agentOnly','always',_0x51ac('0x8')),'defaultValue':_0x51ac('0x9'),'comment':_0x51ac('0xa')},'icon':{'type':Sequelize[_0x51ac('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x51ac('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d0e=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','ENUM','html','script','TEXT','STRING','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly'];(function(_0x5b39c0,_0x493480){var _0x5b2c65=function(_0x2703d6){while(--_0x2703d6){_0x5b39c0['push'](_0x5b39c0['shift']());}};_0x5b2c65(++_0x493480);}(_0x3d0e,0x14d));var _0xe3d0=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x3d0e[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe3d0('0x0')](_0xe3d0('0x1'),_0xe3d0('0x2'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xe3d0('0x3')]},'path':{'type':Sequelize[_0xe3d0('0x4')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xe3d0('0x5')],'defaultValue':0x0,'comment':_0xe3d0('0x6')},'sidebar':{'type':Sequelize[_0xe3d0('0x0')]('adminOnly',_0xe3d0('0x7'),_0xe3d0('0x8'),_0xe3d0('0x9')),'defaultValue':'always','comment':_0xe3d0('0xa')},'icon':{'type':Sequelize[_0xe3d0('0x4')]},'adminUrl':{'type':Sequelize[_0xe3d0('0x4')]},'agentUrl':{'type':Sequelize[_0xe3d0('0x4')]},'scriptName':{'type':Sequelize[_0xe3d0('0x4')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 7ceaed7..8f259be 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 _0x1ad0=['encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','name','send','index','map','Plugin','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','length','options','find','download','params','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','join','root','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','Invalid\x20plugin\x20structure','isFile','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','resolve','port','hostname','http://localhost:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ad0,0xb4));var _0x01ad=function(_0x6b8291,_0x13f1e8){_0x6b8291=_0x6b8291-0x0;var _0x4c41fe=_0x1ad0[_0x6b8291];return _0x4c41fe;};'use strict';var pdf=require(_0x01ad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x01ad('0x1'));var zipdir=require(_0x01ad('0x2'));var jsonpatch=require(_0x01ad('0x3'));var rp=require('request-promise');var moment=require(_0x01ad('0x4'));var BPromise=require(_0x01ad('0x5'));var Mustache=require(_0x01ad('0x6'));var util=require(_0x01ad('0x7'));var path=require(_0x01ad('0x8'));var sox=require(_0x01ad('0x9'));var csv=require(_0x01ad('0xa'));var ejs=require(_0x01ad('0xb'));var fs=require('fs');var _=require(_0x01ad('0xc'));var squel=require(_0x01ad('0xd'));var crypto=require(_0x01ad('0xe'));var jsforce=require(_0x01ad('0xf'));var deskjs=require(_0x01ad('0x10'));var toCsv=require(_0x01ad('0xa'));var querystring=require('querystring');var Papa=require(_0x01ad('0x11'));var extract=require(_0x01ad('0x12'));var rimraf=require('rimraf');var archiver=require(_0x01ad('0x13'));var Redis=require('ioredis');var authService=require(_0x01ad('0x14'));var qs=require(_0x01ad('0x15'));var as=require(_0x01ad('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x01ad('0x17'));var utils=require(_0x01ad('0x18'));var config=require('../../config/environment');var db=require(_0x01ad('0x19'))['db'];config[_0x01ad('0x1a')]=_[_0x01ad('0x1b')](config[_0x01ad('0x1a')],{'host':_0x01ad('0x1c'),'port':0x18eb});var socket=require(_0x01ad('0x1d'))(new Redis(config[_0x01ad('0x1a')]));require(_0x01ad('0x1e'))[_0x01ad('0x1f')](socket);function respondWithStatusCode(_0xbd17fd,_0x199817){_0x199817=_0x199817||0xcc;return function(_0x5458c3){if(_0x5458c3){return _0xbd17fd[_0x01ad('0x20')](_0x199817);}return _0xbd17fd[_0x01ad('0x21')](_0x199817)['end']();};}function respondWithResult(_0xaedac1,_0x1f7b7d){_0x1f7b7d=_0x1f7b7d||0xc8;return function(_0x590be0){if(_0x590be0){return _0xaedac1[_0x01ad('0x21')](_0x1f7b7d)[_0x01ad('0x22')](_0x590be0);}};}function respondWithFilteredResult(_0x2e055d,_0x3febe5){return function(_0x2896c0){if(_0x2896c0){var _0xc4fafe=_0x2896c0[_0x01ad('0x23')],_0x4f3747=_0x3febe5[_0x01ad('0x24')],_0x43f4ba=_0x3febe5[_0x01ad('0x24')]+_0x3febe5[_0x01ad('0x25')],_0x161bce;if(_0x43f4ba>=_0xc4fafe){_0x43f4ba=_0xc4fafe;_0x161bce=0xc8;}else{_0x161bce=0xce;}_0x2e055d[_0x01ad('0x21')](_0x161bce);return _0x2e055d[_0x01ad('0x26')](_0x01ad('0x27'),_0x4f3747+'-'+_0x43f4ba+'/'+_0xc4fafe)[_0x01ad('0x22')](_0x2896c0);}return null;};}function patchUpdates(_0x1c0129){return function(_0x155acc){try{jsonpatch[_0x01ad('0x28')](_0x155acc,_0x1c0129,!![]);}catch(_0x367e1f){return BPromise[_0x01ad('0x29')](_0x367e1f);}return _0x155acc[_0x01ad('0x2a')]();};}function saveUpdates(_0x4bddbd,_0x5112e9){return function(_0x296f44){if(_0x296f44){return _0x296f44[_0x01ad('0x2b')](_0x4bddbd)[_0x01ad('0x2c')](function(_0x50dc15){return _0x50dc15;});}return null;};}function removeEntity(_0x72979f,_0x49b136){return function(_0xbe1a36){if(_0xbe1a36){return _0xbe1a36[_0x01ad('0x2d')]()[_0x01ad('0x2c')](function(){var _0x441bed=_0xbe1a36[_0x01ad('0x2e')]({'plain':!![]});var _0x27f1ae=_0x01ad('0x2f');return db[_0x01ad('0x30')][_0x01ad('0x2d')]({'where':{'type':_0x27f1ae,'resourceId':_0x441bed['id']}})[_0x01ad('0x2c')](function(){return _0xbe1a36;});})[_0x01ad('0x2c')](function(){_0x72979f[_0x01ad('0x21')](0xcc)[_0x01ad('0x31')]();});}};}function handleEntityNotFound(_0x345d8b,_0x391e97){return function(_0x13dbb9){if(!_0x13dbb9){_0x345d8b[_0x01ad('0x20')](0x194);}return _0x13dbb9;};}function handleError(_0x2ae88b,_0x2dad83){_0x2dad83=_0x2dad83||0x1f4;return function(_0x5e0c36){logger[_0x01ad('0x32')](_0x5e0c36['stack']);if(_0x5e0c36[_0x01ad('0x33')]){delete _0x5e0c36[_0x01ad('0x33')];}_0x2ae88b[_0x01ad('0x21')](_0x2dad83)[_0x01ad('0x34')](_0x5e0c36);};}exports[_0x01ad('0x35')]=function(_0x15e0b7,_0x45ae85){var _0x3f3a8c={},_0x1ec70c={},_0x55cd68={'count':0x0,'rows':[]};var _0x446b57=_[_0x01ad('0x36')](db[_0x01ad('0x37')][_0x01ad('0x38')],function(_0x2eda1c){return{'name':_0x2eda1c['fieldName'],'type':_0x2eda1c[_0x01ad('0x39')][_0x01ad('0x3a')]};});_0x1ec70c[_0x01ad('0x3b')]=_[_0x01ad('0x36')](_0x446b57,'name');_0x1ec70c[_0x01ad('0x3c')]=_[_0x01ad('0x3d')](_0x15e0b7['query']);_0x1ec70c[_0x01ad('0x3e')]=_[_0x01ad('0x3f')](_0x1ec70c[_0x01ad('0x3b')],_0x1ec70c['query']);_0x3f3a8c[_0x01ad('0x40')]=_[_0x01ad('0x3f')](_0x1ec70c[_0x01ad('0x3b')],qs[_0x01ad('0x41')](_0x15e0b7[_0x01ad('0x3c')][_0x01ad('0x41')]));_0x3f3a8c['attributes']=_0x3f3a8c['attributes']['length']?_0x3f3a8c[_0x01ad('0x40')]:_0x1ec70c[_0x01ad('0x3b')];if(!_0x15e0b7[_0x01ad('0x3c')][_0x01ad('0x42')](_0x01ad('0x43'))){_0x3f3a8c[_0x01ad('0x25')]=qs[_0x01ad('0x25')](_0x15e0b7[_0x01ad('0x3c')]['limit']);_0x3f3a8c['offset']=qs[_0x01ad('0x24')](_0x15e0b7[_0x01ad('0x3c')][_0x01ad('0x24')]);}_0x3f3a8c[_0x01ad('0x44')]=qs[_0x01ad('0x45')](_0x15e0b7[_0x01ad('0x3c')][_0x01ad('0x45')]);_0x3f3a8c[_0x01ad('0x46')]=qs[_0x01ad('0x3e')](_[_0x01ad('0x47')](_0x15e0b7[_0x01ad('0x3c')],_0x1ec70c[_0x01ad('0x3e')]),_0x446b57);if(_0x15e0b7[_0x01ad('0x3c')][_0x01ad('0x48')]){_0x3f3a8c[_0x01ad('0x46')]=_[_0x01ad('0x49')](_0x3f3a8c[_0x01ad('0x46')],{'$or':_[_0x01ad('0x36')](_0x446b57,function(_0x3ee205){if(_0x3ee205[_0x01ad('0x39')]!==_0x01ad('0x4a')){var _0x52e951={};_0x52e951[_0x3ee205[_0x01ad('0x33')]]={'$like':'%'+_0x15e0b7[_0x01ad('0x3c')]['filter']+'%'};return _0x52e951;}})});}_0x3f3a8c=_['merge']({},_0x3f3a8c,_0x15e0b7['options']);var _0x3950c8={'where':_0x3f3a8c[_0x01ad('0x46')]};return db['Plugin']['count'](_0x3950c8)['then'](function(_0x3373a5){_0x55cd68['count']=_0x3373a5;if(_0x15e0b7[_0x01ad('0x3c')][_0x01ad('0x4b')]){_0x3f3a8c[_0x01ad('0x4c')]=[{'all':!![]}];}return db['Plugin'][_0x01ad('0x4d')](_0x3f3a8c);})['then'](function(_0x379903){_0x55cd68[_0x01ad('0x4e')]=_0x379903;return _0x55cd68;})['then'](respondWithFilteredResult(_0x45ae85,_0x3f3a8c))[_0x01ad('0x4f')](handleError(_0x45ae85,null));};exports['show']=function(_0xddfcce,_0x344e6f){var _0x43f0d7={'raw':!![],'where':{'id':_0xddfcce['params']['id']}},_0x357c03={};_0x357c03[_0x01ad('0x3b')]=_['keys'](db[_0x01ad('0x37')][_0x01ad('0x38')]);_0x357c03['query']=_[_0x01ad('0x3d')](_0xddfcce[_0x01ad('0x3c')]);_0x357c03[_0x01ad('0x3e')]=_[_0x01ad('0x3f')](_0x357c03[_0x01ad('0x3b')],_0x357c03['query']);_0x43f0d7['attributes']=_[_0x01ad('0x3f')](_0x357c03['model'],qs[_0x01ad('0x41')](_0xddfcce[_0x01ad('0x3c')][_0x01ad('0x41')]));_0x43f0d7[_0x01ad('0x40')]=_0x43f0d7['attributes'][_0x01ad('0x50')]?_0x43f0d7[_0x01ad('0x40')]:_0x357c03[_0x01ad('0x3b')];if(_0xddfcce['query'][_0x01ad('0x4b')]){_0x43f0d7[_0x01ad('0x4c')]=[{'all':!![]}];}_0x43f0d7=_['merge']({},_0x43f0d7,_0xddfcce[_0x01ad('0x51')]);return db[_0x01ad('0x37')][_0x01ad('0x52')](_0x43f0d7)[_0x01ad('0x2c')](handleEntityNotFound(_0x344e6f,null))['then'](respondWithResult(_0x344e6f,null))[_0x01ad('0x4f')](handleError(_0x344e6f,null));};exports[_0x01ad('0x53')]=function(_0x33ebf1,_0x1699e4,_0x5d8401){return db['Plugin'][_0x01ad('0x52')]({'where':{'id':_0x33ebf1[_0x01ad('0x54')]['id']},'attributes':['name',_0x01ad('0x8')],'raw':!![]})[_0x01ad('0x2c')](handleEntityNotFound(_0x1699e4,null))['then'](function(_0x2474b9){if(_0x2474b9){var _0x407d34=path['join'](config['root'],_0x01ad('0x55'),util[_0x01ad('0x56')](_0x01ad('0x57'),path[_0x01ad('0x58')](_0x2474b9[_0x01ad('0x8')])));var _0x116415=fs[_0x01ad('0x59')](_0x407d34);var _0x583b96=archiver(_0x01ad('0x5a'),{'zlib':{'level':0x9}});_0x583b96['on'](_0x01ad('0x5b'),function(_0x2da772){if(_0x2da772[_0x01ad('0x5c')]==='ENOENT'){logger[_0x01ad('0x32')](_0x2da772);}else{throw new db[(_0x01ad('0x5d'))][(_0x01ad('0x5e'))](_0x01ad('0x5f'));}});_0x583b96['on'](_0x01ad('0x32'),function(_0x3bd3d0){throw new db[(_0x01ad('0x5d'))][(_0x01ad('0x5e'))](_0x01ad('0x5f'));});_0x583b96[_0x01ad('0x60')](_0x116415);_0x583b96[_0x01ad('0x61')]('**/*',{'cwd':path[_0x01ad('0x62')](config[_0x01ad('0x63')],_0x01ad('0x55'),path[_0x01ad('0x64')](_0x2474b9[_0x01ad('0x8')])),'ignore':[path[_0x01ad('0x62')](path[_0x01ad('0x58')](_0x2474b9[_0x01ad('0x8')]),_0x01ad('0x65')),path[_0x01ad('0x62')](path[_0x01ad('0x58')](_0x2474b9[_0x01ad('0x8')]),'attachments/**/*')],'nodir':!![]})[_0x01ad('0x66')]();_0x116415['on'](_0x01ad('0x67'),function(){if(!fs['existsSync'](_0x407d34)){throw new db[(_0x01ad('0x5d'))][(_0x01ad('0x5e'))](_0x01ad('0x68'));}return _0x1699e4[_0x01ad('0x53')](_0x407d34,util['format'](_0x01ad('0x57'),path[_0x01ad('0x58')](_0x2474b9[_0x01ad('0x8')])),function(_0x23828f){if(_0x23828f){throw new db[(_0x01ad('0x5d'))]['Error'](_0x01ad('0x69'));}fs[_0x01ad('0x6a')](_0x407d34);logger['info'](_0x01ad('0x6b'));logger['info'](_0x01ad('0x6c'));});});}return null;})[_0x01ad('0x4f')](handleError(_0x1699e4,null));};exports['upload']=function(_0x184288,_0x5daaf6,_0x1add58){var _0x323ca9=path[_0x01ad('0x58')](_0x184288[_0x01ad('0x6d')][_0x01ad('0x6e')],path[_0x01ad('0x6f')](_0x184288[_0x01ad('0x6d')]['filename']));var _0x88f3d0=path[_0x01ad('0x62')](config[_0x01ad('0x63')],_0x01ad('0x55'),_0x184288['file'][_0x01ad('0x6e')]);var _0x25a5a7=path[_0x01ad('0x62')](config[_0x01ad('0x63')],'server/files/plugins',_0x323ca9);logger[_0x01ad('0x70')](_0x01ad('0x71'),_0x88f3d0);logger[_0x01ad('0x70')](_0x01ad('0x72'),_0x25a5a7);try{fs['chmodSync'](_0x88f3d0,parseInt('0777',0x8));extract(_0x88f3d0,{'dir':_0x25a5a7},function(_0x9e06d7){if(_0x9e06d7){logger['error'](_0x9e06d7);handleError(_0x9e06d7,!![]);};var _0x4dfe7d=fs['readdirSync'](_0x25a5a7);if(_0x4dfe7d[_0x01ad('0x50')]>0x1){removeReferences(_0x88f3d0,_0x25a5a7);logger[_0x01ad('0x32')](_0x01ad('0x73'));return _0x1add58(new Error(_0x01ad('0x73')));}var _0x44509f=fs['lstatSync'](path[_0x01ad('0x62')](_0x25a5a7,_0x4dfe7d[0x0]));if(_0x44509f[_0x01ad('0x74')]()){removeReferences(_0x88f3d0,_0x25a5a7);logger[_0x01ad('0x32')](_0x01ad('0x73'));return _0x1add58(new Error(_0x01ad('0x73')));}if(_0x44509f['isDirectory']()){var _0x559f89=fs[_0x01ad('0x75')](path[_0x01ad('0x62')](_0x25a5a7,_0x4dfe7d[0x0]));if(_0x559f89['length']===0x0){removeReferences(_0x88f3d0,_0x25a5a7);logger[_0x01ad('0x32')](_0x01ad('0x73'));return _0x1add58(new Error(_0x01ad('0x73')));}var _0x1a8797=_0x559f89[_0x01ad('0x76')](function(_0x3c1927){return _0x3c1927===_0x01ad('0x77');});if(!_0x1a8797){return _0x1add58(new Error(_0x01ad('0x78')));}var _0x3714c5=fs[_0x01ad('0x79')](path[_0x01ad('0x62')](_0x25a5a7,_0x4dfe7d[0x0],_0x01ad('0x77')));var _0x56987a=JSON['parse'](_0x3714c5);if('undefined'==typeof _0x56987a['name']){return _0x1add58(new Error(_0x01ad('0x7a')));}if(_0x01ad('0x7b')==typeof _0x56987a['type']){return _0x1add58(new Error(_0x01ad('0x7c')));}if(_0x01ad('0x7b')==typeof _0x56987a[_0x01ad('0x7d')]){return _0x1add58(new Error(_0x01ad('0x7e')));}if(_0x01ad('0x7b')==typeof _0x56987a[_0x01ad('0x7f')]){return _0x1add58(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x56987a[_0x01ad('0x39')]===_0x01ad('0x80')){if(_0x01ad('0x7b')==typeof _0x56987a['parameters'][_0x01ad('0x81')]){return _0x1add58(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x01ad('0x7b')==typeof _0x56987a[_0x01ad('0x7f')][_0x01ad('0x81')]['admin']&&_0x01ad('0x7b')==typeof _0x56987a[_0x01ad('0x7f')]['views']['agent']){return _0x1add58(new Error(_0x01ad('0x82')));}}else if(_0x56987a[_0x01ad('0x39')]==='script'){if(_0x01ad('0x7b')==typeof _0x56987a['parameters'][_0x01ad('0x83')]){return _0x1add58(new Error(_0x01ad('0x84')));}if(_0x01ad('0x7b')==typeof _0x56987a[_0x01ad('0x7f')][_0x01ad('0x85')]){return _0x1add58(new Error(_0x01ad('0x86')));}}else{return _0x1add58(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2cb816=_0x56987a[_0x01ad('0x33')];var _0x60804f=_0x56987a[_0x01ad('0x87')];var _0x2f4c63=_0x56987a[_0x01ad('0x39')];var _0x30c744=_0x56987a['sidebar']?_0x56987a[_0x01ad('0x88')]:_0x01ad('0x89');var _0x4a7580=_0x56987a[_0x01ad('0x8a')]?_0x56987a[_0x01ad('0x8a')]:_0x01ad('0x8b');var _0x13b54a='';var _0x489107='';var _0x47f7c1='';var _0x45bc9c='';var _0x294418=_0x56987a[_0x01ad('0x7d')];if(_0x2f4c63===_0x01ad('0x80')){if(_0x01ad('0x7b')!=typeof _0x56987a['parameters'][_0x01ad('0x81')][_0x01ad('0x8c')]){var _0x30a948=_0x56987a[_0x01ad('0x7f')]['views'][_0x01ad('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x01ad('0x8d')](_0x30a948)){_0x13b54a=path[_0x01ad('0x62')](_0x01ad('0x8e'),_0x323ca9,_0x4dfe7d[0x0],_0x30a948);}else{_0x13b54a=_0x30a948;}}else{logger[_0x01ad('0x70')](_0x01ad('0x8f'));}if('undefined'!=typeof _0x56987a['parameters'][_0x01ad('0x81')][_0x01ad('0x90')]){var _0x3222c0=_0x56987a[_0x01ad('0x7f')][_0x01ad('0x81')][_0x01ad('0x90')];if(!/^(f|ht)tps?:\/\//i[_0x01ad('0x8d')](_0x3222c0)){_0x489107=path[_0x01ad('0x62')]('plugins',_0x323ca9,_0x4dfe7d[0x0],_0x3222c0);}else{_0x489107=_0x3222c0;}}else{logger[_0x01ad('0x70')](_0x01ad('0x91'));}}else if(_0x2f4c63===_0x01ad('0x92')){_0x47f7c1=_0x56987a[_0x01ad('0x7f')][_0x01ad('0x83')];_0x45bc9c=_0x56987a[_0x01ad('0x7f')][_0x01ad('0x85')];if(_0x01ad('0x7b')!=typeof _0x56987a['parameters'][_0x01ad('0x81')]){if(_0x01ad('0x7b')!=typeof _0x56987a['parameters'][_0x01ad('0x81')][_0x01ad('0x8c')]){var _0x30a948=_0x56987a[_0x01ad('0x7f')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x01ad('0x8d')](_0x30a948)){_0x13b54a=path['join'](_0x01ad('0x8e'),_0x323ca9,_0x4dfe7d[0x0],_0x30a948);}else{_0x13b54a=_0x30a948;}}if(_0x01ad('0x7b')!=typeof _0x56987a[_0x01ad('0x7f')][_0x01ad('0x81')][_0x01ad('0x90')]){var _0x3222c0=_0x56987a[_0x01ad('0x7f')][_0x01ad('0x81')][_0x01ad('0x90')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3222c0)){_0x489107=path[_0x01ad('0x62')](_0x01ad('0x8e'),_0x323ca9,_0x4dfe7d[0x0],_0x3222c0);}else{_0x489107=_0x3222c0;}}}}var _0x32af16={'name':_0x2cb816,'description':_0x60804f,'path':path['join'](_0x323ca9,_0x4dfe7d[0x0]),'type':_0x2f4c63,'sidebar':_0x30c744,'icon':_0x4a7580,'adminUrl':_0x13b54a,'agentUrl':_0x489107,'scriptName':_0x47f7c1,'scriptPath':_0x45bc9c,'version':_0x294418};removeReferences(_0x88f3d0,null);return db[_0x01ad('0x37')][_0x01ad('0x93')](_0x32af16)['then'](function(_0x3b8aa4){var _0x14843e={'role':_0x184288[_0x01ad('0x94')]['role'],'userProfileId':_0x184288[_0x01ad('0x94')]['userProfileId']};if(!_0x14843e)throw new Error(_0x01ad('0x95'));if(_0x14843e['role']==='user'){var _0x4bbfaf=_0x3b8aa4[_0x01ad('0x2e')]({'plain':!![]});return db[_0x01ad('0x96')]['find']({'where':{'name':_0x01ad('0x2f'),'userProfileId':_0x14843e[_0x01ad('0x97')]},'raw':!![]})[_0x01ad('0x2c')](function(_0x44acbe){if(_0x44acbe&&_0x44acbe[_0x01ad('0x98')]===0x0){return db[_0x01ad('0x30')][_0x01ad('0x93')]({'name':_0x4bbfaf['name'],'resourceId':_0x4bbfaf['id'],'type':_0x44acbe['name'],'sectionId':_0x44acbe['id']},{})[_0x01ad('0x2c')](function(){return _0x3b8aa4;});}else{return _0x3b8aa4;}})[_0x01ad('0x4f')](function(_0x42d135){logger[_0x01ad('0x32')](_0x01ad('0x99'),_0x42d135);throw _0x42d135;});}return _0x3b8aa4;})['then'](respondWithResult(_0x5daaf6,null))[_0x01ad('0x4f')](handleError(_0x5daaf6,null));}});}catch(_0x3b7208){_0x5daaf6[_0x01ad('0x21')](0x1f4)[_0x01ad('0x34')](_0x3b7208);}};function removeReferences(_0xef06dc,_0x51b6d8){try{if(_0xef06dc){fs['unlinkSync'](_0xef06dc);logger['info'](_0x01ad('0x9a'));}if(_0x51b6d8){rimraf(_0x51b6d8,function(){});logger[_0x01ad('0x70')]('Extracted\x20folder\x20removed');}}catch(_0x41a909){logger[_0x01ad('0x32')](_0x41a909);}}exports[_0x01ad('0x2b')]=function(_0x249bf3,_0x553fa8,_0x2a362e){return db[_0x01ad('0x37')]['find']({'where':{'id':_0x249bf3[_0x01ad('0x54')]['id']}})[_0x01ad('0x2c')](handleEntityNotFound(_0x553fa8,null))[_0x01ad('0x2c')](saveUpdates(_0x249bf3[_0x01ad('0x94')],null))[_0x01ad('0x2c')](respondWithResult(_0x553fa8,null))[_0x01ad('0x4f')](handleError(_0x553fa8,null));};exports[_0x01ad('0x9b')]=function(_0x5b3da8,_0x5bd7a6,_0x2d287a){return db[_0x01ad('0x37')]['find']({'where':{'id':_0x5b3da8['params']['id']}})[_0x01ad('0x2c')](function(_0x2aa8aa){if(_0x2aa8aa){return _0x2aa8aa[_0x01ad('0x2d')]();}})[_0x01ad('0x2c')](function(_0x28253e){rimraf(path[_0x01ad('0x62')](config[_0x01ad('0x63')],_0x01ad('0x55'),path[_0x01ad('0x64')](_0x28253e[_0x01ad('0x8')])),function(){});return _0x28253e;})[_0x01ad('0x2c')](handleEntityNotFound(_0x5bd7a6,null))[_0x01ad('0x2c')](respondWithStatusCode(_0x5bd7a6,null))[_0x01ad('0x4f')](handleError(_0x5bd7a6,null));};exports['webhookGet']=function(_0x1420e7,_0x4dd87a,_0x152ec1){return BPromise[_0x01ad('0x9c')]()['then'](function(){if(!_0x1420e7[_0x01ad('0x3c')][_0x01ad('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1420e7[_0x01ad('0x3c')][_0x01ad('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x706c33=_0x1420e7['query'][_0x01ad('0x9e')]?_0x1420e7[_0x01ad('0x3c')][_0x01ad('0x9e')]+':'+_0x1420e7[_0x01ad('0x3c')][_0x01ad('0x9d')]:_0x01ad('0x9f')+_0x1420e7[_0x01ad('0x3c')]['port'];var _0x4d5551=_0x1420e7[_0x01ad('0x3c')][_0x01ad('0x22')]?_0x1420e7[_0x01ad('0x3c')][_0x01ad('0x22')]:!![];var _0x52aa6a=_0x1420e7[_0x01ad('0x3c')][_0x01ad('0xa0')]?_0x1420e7[_0x01ad('0x3c')]['encoding']:null;var _0x2adb85={'method':_0x1420e7[_0x01ad('0xa1')],'uri':util[_0x01ad('0x56')](_0x01ad('0xa2'),_0x706c33,_0x1420e7['query'][_0x01ad('0x8')]),'json':_0x4d5551,'resolveWithFullResponse':!![],'encoding':_0x52aa6a,'qs':_0x1420e7[_0x01ad('0x3c')]};if(_0x1420e7[_0x01ad('0xa3')]){_0x2adb85[_0x01ad('0xa3')]=_0x1420e7[_0x01ad('0xa3')];if(_0x2adb85[_0x01ad('0xa3')][_0x01ad('0xa4')]){delete _0x2adb85[_0x01ad('0xa3')][_0x01ad('0xa4')];}}if(_0x2adb85['headers']['content-type']){delete _0x2adb85[_0x01ad('0xa3')][_0x01ad('0xa5')];}return rp(_0x2adb85);})[_0x01ad('0x2c')](function(_0x15995c){if(_0x15995c){_0x4dd87a['set'](_0x15995c[_0x01ad('0xa3')]);logger[_0x01ad('0x70')](_0x15995c['body']);if(_[_0x01ad('0xa6')](_0x1420e7[_0x01ad('0x3c')][_0x01ad('0x8')],'download')&&_0x15995c[_0x01ad('0xa7')]==0x1f4){return _0x4dd87a[_0x01ad('0x20')](_0x15995c[_0x01ad('0xa7')]);}else{return _0x4dd87a[_0x01ad('0x21')](_0x15995c[_0x01ad('0xa7')])[_0x01ad('0x34')](_0x15995c[_0x01ad('0x94')]);}}else{return _0x4dd87a[_0x01ad('0x20')](0xc8);}})[_0x01ad('0x4f')](handleError(_0x4dd87a,null));};exports[_0x01ad('0xa8')]=function(_0x1bad66,_0x268a4c,_0x54b349){return BPromise[_0x01ad('0x9c')]()[_0x01ad('0x2c')](function(){if(!_0x1bad66[_0x01ad('0x3c')][_0x01ad('0x8')]){throw new Error(_0x01ad('0xa9'));}if(!_0x1bad66[_0x01ad('0x3c')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2a67ca=_0x1bad66['query'][_0x01ad('0x9e')]?_0x1bad66[_0x01ad('0x3c')][_0x01ad('0x9e')]+':'+_0x1bad66[_0x01ad('0x3c')][_0x01ad('0x9d')]:'http://localhost:'+_0x1bad66[_0x01ad('0x3c')][_0x01ad('0x9d')];var _0x4a1362=_0x1bad66[_0x01ad('0x3c')][_0x01ad('0x22')]?_0x1bad66[_0x01ad('0x3c')][_0x01ad('0x22')]:!![];var _0x15e326=_0x1bad66[_0x01ad('0x3c')][_0x01ad('0xa0')]?_0x1bad66['query']['encoding']:null;var _0x33e098={'method':_0x1bad66[_0x01ad('0xa1')],'uri':util[_0x01ad('0x56')]('%s%s',_0x2a67ca,_0x1bad66[_0x01ad('0x3c')][_0x01ad('0x8')]),'json':_0x4a1362,'resolveWithFullResponse':!![],'encoding':_0x15e326,'body':_0x1bad66['body']};if(_0x1bad66['headers']){_0x33e098[_0x01ad('0xa3')]=_0x1bad66['headers'];if(_0x33e098['headers'][_0x01ad('0xa4')]){delete _0x33e098[_0x01ad('0xa3')][_0x01ad('0xa4')];}}if(_0x33e098[_0x01ad('0xa3')][_0x01ad('0xa5')]){delete _0x33e098[_0x01ad('0xa3')]['content-type'];}return rp(_0x33e098);})[_0x01ad('0x2c')](function(_0x51ab90){if(_0x51ab90){_0x268a4c[_0x01ad('0x26')](_0x51ab90[_0x01ad('0xa3')]);logger[_0x01ad('0x70')](_0x51ab90[_0x01ad('0x94')]);return _0x268a4c[_0x01ad('0x21')](_0x51ab90[_0x01ad('0xa7')])['send'](_0x51ab90[_0x01ad('0x94')]);}else{return _0x268a4c[_0x01ad('0x20')](0xc8);}})['catch'](handleError(_0x268a4c,null));}; \ No newline at end of file +var _0x5dd7=['querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','destroy','get','Plugins','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','pick','merge','where','VIRTUAL','filter','options','Plugin','includeAll','include','rows','catch','show','find','download','params','join','root','server/files/plugins','%s.zip','basename','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','attachments/**/*','close','format','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','html','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2c0ea7,_0x33dcbd){var _0x155f88=function(_0x3c6d9d){while(--_0x3c6d9d){_0x2c0ea7['push'](_0x2c0ea7['shift']());}};_0x155f88(++_0x33dcbd);}(_0x5dd7,0x1e6));var _0x75dd=function(_0x212cd5,_0x14a9d1){_0x212cd5=_0x212cd5-0x0;var _0x1ad0b8=_0x5dd7[_0x212cd5];return _0x1ad0b8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x75dd('0x0'));var rimraf=require(_0x75dd('0x1'));var zipdir=require(_0x75dd('0x2'));var jsonpatch=require(_0x75dd('0x3'));var rp=require('request-promise');var moment=require(_0x75dd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75dd('0x5'));var util=require(_0x75dd('0x6'));var path=require(_0x75dd('0x7'));var sox=require(_0x75dd('0x8'));var csv=require(_0x75dd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x75dd('0xa'));var squel=require(_0x75dd('0xb'));var crypto=require(_0x75dd('0xc'));var jsforce=require(_0x75dd('0xd'));var deskjs=require(_0x75dd('0xe'));var toCsv=require(_0x75dd('0x9'));var querystring=require(_0x75dd('0xf'));var Papa=require(_0x75dd('0x10'));var extract=require(_0x75dd('0x11'));var rimraf=require(_0x75dd('0x1'));var archiver=require(_0x75dd('0x12'));var Redis=require(_0x75dd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x75dd('0x14'));var as=require(_0x75dd('0x15'));var hardwareService=require(_0x75dd('0x16'));var logger=require(_0x75dd('0x17'))('api');var utils=require(_0x75dd('0x18'));var config=require(_0x75dd('0x19'));var db=require(_0x75dd('0x1a'))['db'];config[_0x75dd('0x1b')]=_[_0x75dd('0x1c')](config[_0x75dd('0x1b')],{'host':_0x75dd('0x1d'),'port':0x18eb});var socket=require(_0x75dd('0x1e'))(new Redis(config['redis']));require(_0x75dd('0x1f'))[_0x75dd('0x20')](socket);function respondWithStatusCode(_0x24ea6c,_0x2446b1){_0x2446b1=_0x2446b1||0xcc;return function(_0x4e318b){if(_0x4e318b){return _0x24ea6c[_0x75dd('0x21')](_0x2446b1);}return _0x24ea6c[_0x75dd('0x22')](_0x2446b1)[_0x75dd('0x23')]();};}function respondWithResult(_0x378395,_0x508624){_0x508624=_0x508624||0xc8;return function(_0x11dad1){if(_0x11dad1){return _0x378395['status'](_0x508624)[_0x75dd('0x24')](_0x11dad1);}};}function respondWithFilteredResult(_0x198f4b,_0x5384b1){return function(_0x577d8c){if(_0x577d8c){var _0x8f4117=_0x577d8c[_0x75dd('0x25')],_0x51ea7e=_0x5384b1[_0x75dd('0x26')],_0x4b053b=_0x5384b1['offset']+_0x5384b1['limit'],_0x8e8ebf;if(_0x4b053b>=_0x8f4117){_0x4b053b=_0x8f4117;_0x8e8ebf=0xc8;}else{_0x8e8ebf=0xce;}_0x198f4b[_0x75dd('0x22')](_0x8e8ebf);return _0x198f4b['set'](_0x75dd('0x27'),_0x51ea7e+'-'+_0x4b053b+'/'+_0x8f4117)[_0x75dd('0x24')](_0x577d8c);}return null;};}function patchUpdates(_0x569fee){return function(_0x338001){try{jsonpatch[_0x75dd('0x28')](_0x338001,_0x569fee,!![]);}catch(_0x306efe){return BPromise['reject'](_0x306efe);}return _0x338001['save']();};}function saveUpdates(_0x21ead5,_0x3bef36){return function(_0x23012f){if(_0x23012f){return _0x23012f[_0x75dd('0x29')](_0x21ead5)[_0x75dd('0x2a')](function(_0x135f60){return _0x135f60;});}return null;};}function removeEntity(_0x338fad,_0x26cc8a){return function(_0x41e8b6){if(_0x41e8b6){return _0x41e8b6[_0x75dd('0x2b')]()[_0x75dd('0x2a')](function(){var _0x58e7c0=_0x41e8b6[_0x75dd('0x2c')]({'plain':!![]});var _0x1fd3a1=_0x75dd('0x2d');return db[_0x75dd('0x2e')][_0x75dd('0x2b')]({'where':{'type':_0x1fd3a1,'resourceId':_0x58e7c0['id']}})['then'](function(){return _0x41e8b6;});})[_0x75dd('0x2a')](function(){_0x338fad[_0x75dd('0x22')](0xcc)[_0x75dd('0x23')]();});}};}function handleEntityNotFound(_0x1ebcb9,_0x2f368c){return function(_0x352fb1){if(!_0x352fb1){_0x1ebcb9[_0x75dd('0x21')](0x194);}return _0x352fb1;};}function handleError(_0xed16f,_0x1c834e){_0x1c834e=_0x1c834e||0x1f4;return function(_0x585ac8){logger[_0x75dd('0x2f')](_0x585ac8['stack']);if(_0x585ac8[_0x75dd('0x30')]){delete _0x585ac8['name'];}_0xed16f['status'](_0x1c834e)[_0x75dd('0x31')](_0x585ac8);};}exports[_0x75dd('0x32')]=function(_0x1fac8,_0x439b4d){var _0x57945c={},_0xe30022={},_0x388265={'count':0x0,'rows':[]};var _0x700982=_[_0x75dd('0x33')](db['Plugin'][_0x75dd('0x34')],function(_0x3c7c97){return{'name':_0x3c7c97[_0x75dd('0x35')],'type':_0x3c7c97[_0x75dd('0x36')][_0x75dd('0x37')]};});_0xe30022[_0x75dd('0x38')]=_[_0x75dd('0x33')](_0x700982,'name');_0xe30022[_0x75dd('0x39')]=_[_0x75dd('0x3a')](_0x1fac8[_0x75dd('0x39')]);_0xe30022[_0x75dd('0x3b')]=_['intersection'](_0xe30022[_0x75dd('0x38')],_0xe30022[_0x75dd('0x39')]);_0x57945c[_0x75dd('0x3c')]=_[_0x75dd('0x3d')](_0xe30022[_0x75dd('0x38')],qs[_0x75dd('0x3e')](_0x1fac8['query'][_0x75dd('0x3e')]));_0x57945c['attributes']=_0x57945c[_0x75dd('0x3c')]['length']?_0x57945c[_0x75dd('0x3c')]:_0xe30022['model'];if(!_0x1fac8[_0x75dd('0x39')]['hasOwnProperty'](_0x75dd('0x3f'))){_0x57945c[_0x75dd('0x40')]=qs['limit'](_0x1fac8[_0x75dd('0x39')][_0x75dd('0x40')]);_0x57945c[_0x75dd('0x26')]=qs[_0x75dd('0x26')](_0x1fac8[_0x75dd('0x39')][_0x75dd('0x26')]);}_0x57945c[_0x75dd('0x41')]=qs[_0x75dd('0x42')](_0x1fac8[_0x75dd('0x39')][_0x75dd('0x42')]);_0x57945c['where']=qs['filters'](_[_0x75dd('0x43')](_0x1fac8[_0x75dd('0x39')],_0xe30022[_0x75dd('0x3b')]),_0x700982);if(_0x1fac8[_0x75dd('0x39')]['filter']){_0x57945c['where']=_[_0x75dd('0x44')](_0x57945c[_0x75dd('0x45')],{'$or':_[_0x75dd('0x33')](_0x700982,function(_0x3da856){if(_0x3da856[_0x75dd('0x36')]!==_0x75dd('0x46')){var _0x41e5bf={};_0x41e5bf[_0x3da856[_0x75dd('0x30')]]={'$like':'%'+_0x1fac8[_0x75dd('0x39')][_0x75dd('0x47')]+'%'};return _0x41e5bf;}})});}_0x57945c=_['merge']({},_0x57945c,_0x1fac8[_0x75dd('0x48')]);var _0x748094={'where':_0x57945c[_0x75dd('0x45')]};return db[_0x75dd('0x49')]['count'](_0x748094)['then'](function(_0x1542b7){_0x388265['count']=_0x1542b7;if(_0x1fac8[_0x75dd('0x39')][_0x75dd('0x4a')]){_0x57945c[_0x75dd('0x4b')]=[{'all':!![]}];}return db[_0x75dd('0x49')]['findAll'](_0x57945c);})[_0x75dd('0x2a')](function(_0x4b3f83){_0x388265[_0x75dd('0x4c')]=_0x4b3f83;return _0x388265;})['then'](respondWithFilteredResult(_0x439b4d,_0x57945c))[_0x75dd('0x4d')](handleError(_0x439b4d,null));};exports[_0x75dd('0x4e')]=function(_0x368168,_0x192aa8){var _0x405d1a={'raw':!![],'where':{'id':_0x368168['params']['id']}},_0x76e843={};_0x76e843[_0x75dd('0x38')]=_['keys'](db[_0x75dd('0x49')][_0x75dd('0x34')]);_0x76e843[_0x75dd('0x39')]=_['keys'](_0x368168['query']);_0x76e843[_0x75dd('0x3b')]=_[_0x75dd('0x3d')](_0x76e843[_0x75dd('0x38')],_0x76e843['query']);_0x405d1a[_0x75dd('0x3c')]=_['intersection'](_0x76e843['model'],qs[_0x75dd('0x3e')](_0x368168['query'][_0x75dd('0x3e')]));_0x405d1a[_0x75dd('0x3c')]=_0x405d1a[_0x75dd('0x3c')]['length']?_0x405d1a[_0x75dd('0x3c')]:_0x76e843[_0x75dd('0x38')];if(_0x368168[_0x75dd('0x39')][_0x75dd('0x4a')]){_0x405d1a[_0x75dd('0x4b')]=[{'all':!![]}];}_0x405d1a=_[_0x75dd('0x44')]({},_0x405d1a,_0x368168[_0x75dd('0x48')]);return db['Plugin'][_0x75dd('0x4f')](_0x405d1a)[_0x75dd('0x2a')](handleEntityNotFound(_0x192aa8,null))[_0x75dd('0x2a')](respondWithResult(_0x192aa8,null))['catch'](handleError(_0x192aa8,null));};exports[_0x75dd('0x50')]=function(_0x2559d3,_0x3cda8c,_0x5d34dc){return db[_0x75dd('0x49')][_0x75dd('0x4f')]({'where':{'id':_0x2559d3[_0x75dd('0x51')]['id']},'attributes':[_0x75dd('0x30'),_0x75dd('0x7')],'raw':!![]})[_0x75dd('0x2a')](handleEntityNotFound(_0x3cda8c,null))[_0x75dd('0x2a')](function(_0x395278){if(_0x395278){var _0x3ff30f=path[_0x75dd('0x52')](config[_0x75dd('0x53')],_0x75dd('0x54'),util['format'](_0x75dd('0x55'),path[_0x75dd('0x56')](_0x395278[_0x75dd('0x7')])));var _0x177929=fs['createWriteStream'](_0x3ff30f);var _0x15e848=archiver(_0x75dd('0x57'),{'zlib':{'level':0x9}});_0x15e848['on'](_0x75dd('0x58'),function(_0x4e52b0){if(_0x4e52b0[_0x75dd('0x59')]===_0x75dd('0x5a')){logger['error'](_0x4e52b0);}else{throw new db['Sequelize'][(_0x75dd('0x5b'))](_0x75dd('0x5c'));}});_0x15e848['on'](_0x75dd('0x2f'),function(_0x354124){throw new db['Sequelize'][(_0x75dd('0x5b'))](_0x75dd('0x5c'));});_0x15e848['pipe'](_0x177929);_0x15e848[_0x75dd('0x5d')](_0x75dd('0x5e'),{'cwd':path['join'](config[_0x75dd('0x53')],'server/files/plugins',path['dirname'](_0x395278['path'])),'ignore':[path[_0x75dd('0x52')](path[_0x75dd('0x56')](_0x395278[_0x75dd('0x7')]),'node_modules/**/*'),path[_0x75dd('0x52')](path[_0x75dd('0x56')](_0x395278[_0x75dd('0x7')]),_0x75dd('0x5f'))],'nodir':!![]})['finalize']();_0x177929['on'](_0x75dd('0x60'),function(){if(!fs['existsSync'](_0x3ff30f)){throw new db['Sequelize'][(_0x75dd('0x5b'))]('Plugin\x20not\x20found');}return _0x3cda8c[_0x75dd('0x50')](_0x3ff30f,util[_0x75dd('0x61')](_0x75dd('0x55'),path['basename'](_0x395278[_0x75dd('0x7')])),function(_0x127b89){if(_0x127b89){throw new db[(_0x75dd('0x62'))]['Error'](_0x75dd('0x63'));}fs[_0x75dd('0x64')](_0x3ff30f);logger[_0x75dd('0x65')](_0x75dd('0x66'));logger[_0x75dd('0x65')](_0x75dd('0x67'));});});}return null;})[_0x75dd('0x4d')](handleError(_0x3cda8c,null));};exports[_0x75dd('0x68')]=function(_0x5d5794,_0x4ede03,_0x530856){var _0x3faefa=path[_0x75dd('0x56')](_0x5d5794[_0x75dd('0x69')][_0x75dd('0x6a')],path[_0x75dd('0x6b')](_0x5d5794[_0x75dd('0x69')][_0x75dd('0x6a')]));var _0x3173cb=path[_0x75dd('0x52')](config[_0x75dd('0x53')],_0x75dd('0x54'),_0x5d5794[_0x75dd('0x69')][_0x75dd('0x6a')]);var _0x19724d=path[_0x75dd('0x52')](config[_0x75dd('0x53')],_0x75dd('0x54'),_0x3faefa);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x3173cb);logger[_0x75dd('0x65')](_0x75dd('0x6c'),_0x19724d);try{fs[_0x75dd('0x6d')](_0x3173cb,parseInt(_0x75dd('0x6e'),0x8));extract(_0x3173cb,{'dir':_0x19724d},function(_0x38417b){if(_0x38417b){logger[_0x75dd('0x2f')](_0x38417b);handleError(_0x38417b,!![]);};var _0x22f166=fs[_0x75dd('0x6f')](_0x19724d);if(_0x22f166[_0x75dd('0x70')]>0x1){removeReferences(_0x3173cb,_0x19724d);logger[_0x75dd('0x2f')](_0x75dd('0x71'));return _0x530856(new Error(_0x75dd('0x71')));}var _0x25b84a=fs['lstatSync'](path[_0x75dd('0x52')](_0x19724d,_0x22f166[0x0]));if(_0x25b84a[_0x75dd('0x72')]()){removeReferences(_0x3173cb,_0x19724d);logger[_0x75dd('0x2f')]('Invalid\x20plugin\x20structure');return _0x530856(new Error('Invalid\x20plugin\x20structure'));}if(_0x25b84a[_0x75dd('0x73')]()){var _0xb0e4f3=fs['readdirSync'](path[_0x75dd('0x52')](_0x19724d,_0x22f166[0x0]));if(_0xb0e4f3[_0x75dd('0x70')]===0x0){removeReferences(_0x3173cb,_0x19724d);logger['error'](_0x75dd('0x71'));return _0x530856(new Error(_0x75dd('0x71')));}var _0x127f43=_0xb0e4f3['some'](function(_0x5d601e){return _0x5d601e===_0x75dd('0x74');});if(!_0x127f43){return _0x530856(new Error('Plugin\x20manifest\x20missing'));}var _0x296656=fs['readFileSync'](path['join'](_0x19724d,_0x22f166[0x0],_0x75dd('0x74')));var _0x1d3249=JSON['parse'](_0x296656);if(_0x75dd('0x75')==typeof _0x1d3249[_0x75dd('0x30')]){return _0x530856(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x75dd('0x75')==typeof _0x1d3249[_0x75dd('0x36')]){return _0x530856(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x75dd('0x75')==typeof _0x1d3249[_0x75dd('0x76')]){return _0x530856(new Error(_0x75dd('0x77')));}if(_0x75dd('0x75')==typeof _0x1d3249[_0x75dd('0x78')]){return _0x530856(new Error(_0x75dd('0x79')));}if(_0x1d3249['type']==='html'){if(_0x75dd('0x75')==typeof _0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')]){return _0x530856(new Error(_0x75dd('0x7b')));}if(_0x75dd('0x75')==typeof _0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')]['admin']&&_0x75dd('0x75')==typeof _0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')][_0x75dd('0x7c')]){return _0x530856(new Error(_0x75dd('0x7d')));}}else if(_0x1d3249['type']==='script'){if('undefined'==typeof _0x1d3249[_0x75dd('0x78')][_0x75dd('0x7e')]){return _0x530856(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x75dd('0x75')==typeof _0x1d3249[_0x75dd('0x78')][_0x75dd('0x7f')]){return _0x530856(new Error(_0x75dd('0x80')));}}else{return _0x530856(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x3c226f=_0x1d3249[_0x75dd('0x30')];var _0x4accb3=_0x1d3249['description'];var _0x4fe6d0=_0x1d3249['type'];var _0x249fd1=_0x1d3249[_0x75dd('0x81')]?_0x1d3249[_0x75dd('0x81')]:_0x75dd('0x82');var _0x17d5b1=_0x1d3249[_0x75dd('0x83')]?_0x1d3249[_0x75dd('0x83')]:_0x75dd('0x84');var _0x5de2a7='';var _0x854799='';var _0x5af4b9='';var _0x47929c='';var _0x2d1bee=_0x1d3249[_0x75dd('0x76')];if(_0x4fe6d0===_0x75dd('0x85')){if(_0x75dd('0x75')!=typeof _0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')][_0x75dd('0x86')]){var _0x47906d=_0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')][_0x75dd('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x75dd('0x87')](_0x47906d)){_0x5de2a7=path[_0x75dd('0x52')]('plugins',_0x3faefa,_0x22f166[0x0],_0x47906d);}else{_0x5de2a7=_0x47906d;}}else{logger[_0x75dd('0x65')](_0x75dd('0x88'));}if('undefined'!=typeof _0x1d3249[_0x75dd('0x78')]['views']['agent']){var _0xb5c93e=_0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')][_0x75dd('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x75dd('0x87')](_0xb5c93e)){_0x854799=path[_0x75dd('0x52')](_0x75dd('0x89'),_0x3faefa,_0x22f166[0x0],_0xb5c93e);}else{_0x854799=_0xb5c93e;}}else{logger[_0x75dd('0x65')](_0x75dd('0x8a'));}}else if(_0x4fe6d0===_0x75dd('0x8b')){_0x5af4b9=_0x1d3249[_0x75dd('0x78')][_0x75dd('0x7e')];_0x47929c=_0x1d3249['parameters'][_0x75dd('0x7f')];if(_0x75dd('0x75')!=typeof _0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')]){if(_0x75dd('0x75')!=typeof _0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')]['admin']){var _0x47906d=_0x1d3249['parameters'][_0x75dd('0x7a')][_0x75dd('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x75dd('0x87')](_0x47906d)){_0x5de2a7=path[_0x75dd('0x52')](_0x75dd('0x89'),_0x3faefa,_0x22f166[0x0],_0x47906d);}else{_0x5de2a7=_0x47906d;}}if(_0x75dd('0x75')!=typeof _0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')][_0x75dd('0x7c')]){var _0xb5c93e=_0x1d3249[_0x75dd('0x78')][_0x75dd('0x7a')][_0x75dd('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x75dd('0x87')](_0xb5c93e)){_0x854799=path[_0x75dd('0x52')](_0x75dd('0x89'),_0x3faefa,_0x22f166[0x0],_0xb5c93e);}else{_0x854799=_0xb5c93e;}}}}var _0x212c93={'name':_0x3c226f,'description':_0x4accb3,'path':path[_0x75dd('0x52')](_0x3faefa,_0x22f166[0x0]),'type':_0x4fe6d0,'sidebar':_0x249fd1,'icon':_0x17d5b1,'adminUrl':_0x5de2a7,'agentUrl':_0x854799,'scriptName':_0x5af4b9,'scriptPath':_0x47929c,'version':_0x2d1bee};removeReferences(_0x3173cb,null);return db[_0x75dd('0x49')][_0x75dd('0x8c')](_0x212c93)[_0x75dd('0x2a')](function(_0x188024){var _0x2d0988={'role':_0x5d5794[_0x75dd('0x8d')][_0x75dd('0x8e')],'userProfileId':_0x5d5794[_0x75dd('0x8d')][_0x75dd('0x8f')]};if(!_0x2d0988)throw new Error(_0x75dd('0x90'));if(_0x2d0988[_0x75dd('0x8e')]==='user'){var _0x2e8351=_0x188024['get']({'plain':!![]});return db[_0x75dd('0x91')][_0x75dd('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x2d0988[_0x75dd('0x8f')]},'raw':!![]})['then'](function(_0x3193da){if(_0x3193da&&_0x3193da[_0x75dd('0x92')]===0x0){return db[_0x75dd('0x2e')][_0x75dd('0x8c')]({'name':_0x2e8351[_0x75dd('0x30')],'resourceId':_0x2e8351['id'],'type':_0x3193da['name'],'sectionId':_0x3193da['id']},{})[_0x75dd('0x2a')](function(){return _0x188024;});}else{return _0x188024;}})['catch'](function(_0x344ab1){logger[_0x75dd('0x2f')](_0x75dd('0x93'),_0x344ab1);throw _0x344ab1;});}return _0x188024;})[_0x75dd('0x2a')](respondWithResult(_0x4ede03,null))['catch'](handleError(_0x4ede03,null));}});}catch(_0xb3151){_0x4ede03['status'](0x1f4)[_0x75dd('0x31')](_0xb3151);}};function removeReferences(_0x4d72b0,_0x151de9){try{if(_0x4d72b0){fs['unlinkSync'](_0x4d72b0);logger[_0x75dd('0x65')]('Zip\x20archive\x20removed');}if(_0x151de9){rimraf(_0x151de9,function(){});logger[_0x75dd('0x65')](_0x75dd('0x94'));}}catch(_0x1817a6){logger['error'](_0x1817a6);}}exports['update']=function(_0x16f310,_0x1da91c,_0x4e1768){return db[_0x75dd('0x49')][_0x75dd('0x4f')]({'where':{'id':_0x16f310[_0x75dd('0x51')]['id']}})[_0x75dd('0x2a')](handleEntityNotFound(_0x1da91c,null))[_0x75dd('0x2a')](saveUpdates(_0x16f310[_0x75dd('0x8d')],null))[_0x75dd('0x2a')](respondWithResult(_0x1da91c,null))[_0x75dd('0x4d')](handleError(_0x1da91c,null));};exports[_0x75dd('0x95')]=function(_0x2ebbbf,_0x47856e,_0x15dc8f){return db[_0x75dd('0x49')][_0x75dd('0x4f')]({'where':{'id':_0x2ebbbf[_0x75dd('0x51')]['id']}})[_0x75dd('0x2a')](function(_0x5077a8){if(_0x5077a8){return _0x5077a8[_0x75dd('0x2b')]();}})[_0x75dd('0x2a')](function(_0xf147c8){rimraf(path[_0x75dd('0x52')](config[_0x75dd('0x53')],_0x75dd('0x54'),path['dirname'](_0xf147c8[_0x75dd('0x7')])),function(){});return _0xf147c8;})[_0x75dd('0x2a')](handleEntityNotFound(_0x47856e,null))[_0x75dd('0x2a')](respondWithStatusCode(_0x47856e,null))[_0x75dd('0x4d')](handleError(_0x47856e,null));};exports[_0x75dd('0x96')]=function(_0x175bf9,_0x2185b6,_0x2b9e02){return BPromise[_0x75dd('0x97')]()[_0x75dd('0x2a')](function(){if(!_0x175bf9[_0x75dd('0x39')][_0x75dd('0x7')]){throw new Error(_0x75dd('0x98'));}if(!_0x175bf9[_0x75dd('0x39')][_0x75dd('0x99')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5f4e20=_0x175bf9[_0x75dd('0x39')][_0x75dd('0x9a')]?_0x175bf9[_0x75dd('0x39')][_0x75dd('0x9a')]+':'+_0x175bf9[_0x75dd('0x39')][_0x75dd('0x99')]:_0x75dd('0x9b')+_0x175bf9[_0x75dd('0x39')][_0x75dd('0x99')];var _0x5f2538=_0x175bf9[_0x75dd('0x39')][_0x75dd('0x24')]?_0x175bf9['query']['json']:!![];var _0x276aaf=_0x175bf9[_0x75dd('0x39')][_0x75dd('0x9c')]?_0x175bf9[_0x75dd('0x39')][_0x75dd('0x9c')]:null;var _0x3cd75a={'method':_0x175bf9[_0x75dd('0x9d')],'uri':util[_0x75dd('0x61')](_0x75dd('0x9e'),_0x5f4e20,_0x175bf9[_0x75dd('0x39')][_0x75dd('0x7')]),'json':_0x5f2538,'resolveWithFullResponse':!![],'encoding':_0x276aaf,'qs':_0x175bf9[_0x75dd('0x39')]};if(_0x175bf9[_0x75dd('0x9f')]){_0x3cd75a['headers']=_0x175bf9['headers'];if(_0x3cd75a[_0x75dd('0x9f')][_0x75dd('0xa0')]){delete _0x3cd75a[_0x75dd('0x9f')]['content-length'];}}if(_0x3cd75a[_0x75dd('0x9f')][_0x75dd('0xa1')]){delete _0x3cd75a['headers']['content-type'];}return rp(_0x3cd75a);})[_0x75dd('0x2a')](function(_0x1221e2){if(_0x1221e2){_0x2185b6[_0x75dd('0xa2')](_0x1221e2[_0x75dd('0x9f')]);logger[_0x75dd('0x65')](_0x1221e2['body']);if(_[_0x75dd('0xa3')](_0x175bf9[_0x75dd('0x39')][_0x75dd('0x7')],_0x75dd('0x50'))&&_0x1221e2[_0x75dd('0xa4')]==0x1f4){return _0x2185b6[_0x75dd('0x21')](_0x1221e2[_0x75dd('0xa4')]);}else{return _0x2185b6[_0x75dd('0x22')](_0x1221e2['statusCode'])[_0x75dd('0x31')](_0x1221e2[_0x75dd('0x8d')]);}}else{return _0x2185b6['sendStatus'](0xc8);}})[_0x75dd('0x4d')](handleError(_0x2185b6,null));};exports[_0x75dd('0xa5')]=function(_0xe30043,_0xb5c813,_0x492e50){return BPromise['resolve']()[_0x75dd('0x2a')](function(){if(!_0xe30043[_0x75dd('0x39')][_0x75dd('0x7')]){throw new Error(_0x75dd('0x98'));}if(!_0xe30043[_0x75dd('0x39')][_0x75dd('0x99')]){throw new Error(_0x75dd('0xa6'));}var _0x47e0c2=_0xe30043['query'][_0x75dd('0x9a')]?_0xe30043[_0x75dd('0x39')][_0x75dd('0x9a')]+':'+_0xe30043[_0x75dd('0x39')]['port']:_0x75dd('0x9b')+_0xe30043[_0x75dd('0x39')][_0x75dd('0x99')];var _0x19fd32=_0xe30043['query'][_0x75dd('0x24')]?_0xe30043[_0x75dd('0x39')][_0x75dd('0x24')]:!![];var _0x20ed66=_0xe30043[_0x75dd('0x39')][_0x75dd('0x9c')]?_0xe30043[_0x75dd('0x39')][_0x75dd('0x9c')]:null;var _0xec9c0a={'method':_0xe30043[_0x75dd('0x9d')],'uri':util[_0x75dd('0x61')]('%s%s',_0x47e0c2,_0xe30043['query'][_0x75dd('0x7')]),'json':_0x19fd32,'resolveWithFullResponse':!![],'encoding':_0x20ed66,'body':_0xe30043[_0x75dd('0x8d')]};if(_0xe30043[_0x75dd('0x9f')]){_0xec9c0a['headers']=_0xe30043['headers'];if(_0xec9c0a[_0x75dd('0x9f')]['content-length']){delete _0xec9c0a[_0x75dd('0x9f')]['content-length'];}}if(_0xec9c0a[_0x75dd('0x9f')][_0x75dd('0xa1')]){delete _0xec9c0a['headers'][_0x75dd('0xa1')];}return rp(_0xec9c0a);})[_0x75dd('0x2a')](function(_0x38e022){if(_0x38e022){_0xb5c813[_0x75dd('0xa2')](_0x38e022['headers']);logger[_0x75dd('0x65')](_0x38e022[_0x75dd('0x8d')]);return _0xb5c813['status'](_0x38e022['statusCode'])[_0x75dd('0x31')](_0x38e022[_0x75dd('0x8d')]);}else{return _0xb5c813[_0x75dd('0x21')](0xc8);}})[_0x75dd('0x4d')](handleError(_0xb5c813,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3b88866..8dca903 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 _0xd7d1=['update','remove','emit','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x17dc86,_0xa76797){_0x17dc86=_0x17dc86-0x0;var _0x9bdc27=_0xd7d1[_0x17dc86];return _0x9bdc27;};'use strict';var EventEmitter=require(_0x1d7d('0x0'));var Plugin=require(_0x1d7d('0x1'))['db'][_0x1d7d('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1d7d('0x3')](0x0);var events={'afterCreate':_0x1d7d('0x4'),'afterUpdate':_0x1d7d('0x5'),'afterDestroy':_0x1d7d('0x6')};function emitEvent(_0x27b5d8){return function(_0x1ac097,_0x1adb6b,_0x3c0839){PluginEvents[_0x1d7d('0x7')](_0x27b5d8+':'+_0x1ac097['id'],_0x1ac097);PluginEvents[_0x1d7d('0x7')](_0x27b5d8,_0x1ac097);_0x3c0839(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x1d7d('0x8')](e,emitEvent(event));}}module[_0x1d7d('0x9')]=PluginEvents; \ No newline at end of file +var _0x66fa=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x66fa,0x117));var _0xa66f=function(_0x2b4933,_0x1109c7){_0x2b4933=_0x2b4933-0x0;var _0xc539ff=_0x66fa[_0x2b4933];return _0xc539ff;};'use strict';var EventEmitter=require(_0xa66f('0x0'));var Plugin=require(_0xa66f('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xa66f('0x2')](0x0);var events={'afterCreate':_0xa66f('0x3'),'afterUpdate':_0xa66f('0x4'),'afterDestroy':_0xa66f('0x5')};function emitEvent(_0x3d0c49){return function(_0x2a2abf,_0x3f4904,_0x5ebea5){PluginEvents['emit'](_0x3d0c49+':'+_0x2a2abf['id'],_0x2a2abf);PluginEvents[_0xa66f('0x6')](_0x3d0c49,_0x2a2abf);_0x5ebea5(null);};}for(var e in events){if(events[_0xa66f('0x7')](e)){var event=events[e];Plugin[_0xa66f('0x8')](e,emitEvent(event));}}module[_0xa66f('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 71d572b..9f776a1 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 _0xbe43=['util','../../config/logger','api','moment','bluebird','request-promise','path','./plugin.attributes','exports','define','Plugin','plugins','lodash'];(function(_0x3c0569,_0x11da9f){var _0x142524=function(_0x59a41e){while(--_0x59a41e){_0x3c0569['push'](_0x3c0569['shift']());}};_0x142524(++_0x11da9f);}(_0xbe43,0xf6));var _0x3be4=function(_0x1f3cb0,_0x279c68){_0x1f3cb0=_0x1f3cb0-0x0;var _0x2bfd4a=_0xbe43[_0x1f3cb0];return _0x2bfd4a;};'use strict';var _=require(_0x3be4('0x0'));var util=require(_0x3be4('0x1'));var logger=require(_0x3be4('0x2'))(_0x3be4('0x3'));var moment=require(_0x3be4('0x4'));var BPromise=require(_0x3be4('0x5'));var rp=require(_0x3be4('0x6'));var fs=require('fs');var path=require(_0x3be4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3be4('0x8'));module[_0x3be4('0x9')]=function(_0x94f830,_0x52fe40){return _0x94f830[_0x3be4('0xa')](_0x3be4('0xb'),attributes,{'tableName':_0x3be4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3d4=['moment','bluebird','request-promise','path','../../config/environment','./plugin.attributes','exports','Plugin','util'];(function(_0x5d3a99,_0x18bd27){var _0x16713c=function(_0xb5ab0d){while(--_0xb5ab0d){_0x5d3a99['push'](_0x5d3a99['shift']());}};_0x16713c(++_0x18bd27);}(_0xb3d4,0x74));var _0x4b3d=function(_0x39d06c,_0x118455){_0x39d06c=_0x39d06c-0x0;var _0x559d6d=_0xb3d4[_0x39d06c];return _0x559d6d;};'use strict';var _=require('lodash');var util=require(_0x4b3d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4b3d('0x1'));var BPromise=require(_0x4b3d('0x2'));var rp=require(_0x4b3d('0x3'));var fs=require('fs');var path=require(_0x4b3d('0x4'));var rimraf=require('rimraf');var config=require(_0x4b3d('0x5'));var attributes=require(_0x4b3d('0x6'));module[_0x4b3d('0x7')]=function(_0x4d4094,_0x27f301){return _0x4d4094['define'](_0x4b3d('0x8'),attributes,{'tableName':'plugins','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 7c6e051..24ca7ea 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 _0xbc70=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreatePlugin','body','options','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbc70,0x1d3));var _0x0bc7=function(_0x3b27be,_0x62bc4d){_0x3b27be=_0x3b27be-0x0;var _0x44a01a=_0xbc70[_0x3b27be];return _0x44a01a;};'use strict';var _=require(_0x0bc7('0x0'));var util=require('util');var moment=require(_0x0bc7('0x1'));var BPromise=require(_0x0bc7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bc7('0x3'));var db=require(_0x0bc7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bc7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0bc7('0x6'));var client=jayson['client'][_0x0bc7('0x7')]({'port':0x232a});config[_0x0bc7('0x8')]=_[_0x0bc7('0x9')](config[_0x0bc7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x0bc7('0xa'))(new Redis(config[_0x0bc7('0x8')]));require(_0x0bc7('0xb'))['register'](socket);function respondWithRpcPromise(_0x3a2746,_0x48dd74,_0x13ca32){return new BPromise(function(_0x8b370b,_0x58a564){return client[_0x0bc7('0xc')](_0x3a2746,_0x13ca32)[_0x0bc7('0xd')](function(_0x3184a9){logger['info'](_0x0bc7('0xe'),_0x48dd74,_0x0bc7('0xf'));logger[_0x0bc7('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x48dd74,'request\x20sent',JSON[_0x0bc7('0x11')](_0x3184a9));if(_0x3184a9['error']){if(_0x3184a9[_0x0bc7('0x12')][_0x0bc7('0x13')]===0x1f4){logger[_0x0bc7('0x12')]('Plugin,\x20%s,\x20%s',_0x48dd74,_0x3184a9[_0x0bc7('0x12')][_0x0bc7('0x14')]);return _0x58a564(_0x3184a9['error'][_0x0bc7('0x14')]);}logger[_0x0bc7('0x12')](_0x0bc7('0xe'),_0x48dd74,_0x3184a9['error'][_0x0bc7('0x14')]);return _0x8b370b(_0x3184a9['error'][_0x0bc7('0x14')]);}else{logger[_0x0bc7('0x15')](_0x0bc7('0xe'),_0x48dd74,_0x0bc7('0xf'));_0x8b370b(_0x3184a9[_0x0bc7('0x16')]['message']);}})['catch'](function(_0x43ed63){logger['error'](_0x0bc7('0xe'),_0x48dd74,_0x43ed63);_0x58a564(_0x43ed63);});});}exports[_0x0bc7('0x17')]=function(_0x4ece43){var _0xf257b3=this;return new Promise(function(_0x398c0e,_0x479ccb){return db['Plugin']['create'](_0x4ece43[_0x0bc7('0x18')],{'raw':_0x4ece43[_0x0bc7('0x19')]?_0x4ece43[_0x0bc7('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0bc7('0xd')](function(_0x5d7c0b){logger[_0x0bc7('0x15')](_0x0bc7('0x17'),_0x4ece43);logger[_0x0bc7('0x10')](_0x0bc7('0x17'),_0x4ece43,JSON[_0x0bc7('0x11')](_0x5d7c0b));_0x398c0e(_0x5d7c0b);})['catch'](function(_0x3beb94){logger[_0x0bc7('0x12')](_0x0bc7('0x17'),_0x3beb94['message'],_0x4ece43);_0x479ccb(_0xf257b3[_0x0bc7('0x12')](0x1f4,_0x3beb94['message']));});});}; \ No newline at end of file +var _0x10e6=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','code','message','CreatePlugin','create','body','options','raw','then','stringify','lodash','moment','bluebird','randomstring'];(function(_0x3dc3f2,_0x492891){var _0x5f58e4=function(_0x37381d){while(--_0x37381d){_0x3dc3f2['push'](_0x3dc3f2['shift']());}};_0x5f58e4(++_0x492891);}(_0x10e6,0xb6));var _0x610e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x10e6[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x610e('0x0'));var util=require('util');var moment=require(_0x610e('0x1'));var BPromise=require(_0x610e('0x2'));var rs=require(_0x610e('0x3'));var fs=require('fs');var Redis=require(_0x610e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x610e('0x5'));var logger=require(_0x610e('0x6'))('rpc');var config=require(_0x610e('0x7'));var jayson=require(_0x610e('0x8'));var client=jayson['client'][_0x610e('0x9')]({'port':0x232a});config[_0x610e('0xa')]=_[_0x610e('0xb')](config['redis'],{'host':_0x610e('0xc'),'port':0x18eb});var socket=require(_0x610e('0xd'))(new Redis(config[_0x610e('0xa')]));require(_0x610e('0xe'))[_0x610e('0xf')](socket);function respondWithRpcPromise(_0x55c230,_0x245a2a,_0x33dd49){return new BPromise(function(_0x34c4c9,_0x1d3771){return client[_0x610e('0x10')](_0x55c230,_0x33dd49)['then'](function(_0x5a2644){logger[_0x610e('0x11')](_0x610e('0x12'),_0x245a2a,_0x610e('0x13'));logger[_0x610e('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x245a2a,_0x610e('0x13'),JSON['stringify'](_0x5a2644));if(_0x5a2644[_0x610e('0x15')]){if(_0x5a2644[_0x610e('0x15')][_0x610e('0x16')]===0x1f4){logger[_0x610e('0x15')](_0x610e('0x12'),_0x245a2a,_0x5a2644[_0x610e('0x15')]['message']);return _0x1d3771(_0x5a2644['error'][_0x610e('0x17')]);}logger[_0x610e('0x15')](_0x610e('0x12'),_0x245a2a,_0x5a2644[_0x610e('0x15')][_0x610e('0x17')]);return _0x34c4c9(_0x5a2644[_0x610e('0x15')][_0x610e('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x245a2a,_0x610e('0x13'));_0x34c4c9(_0x5a2644['result'][_0x610e('0x17')]);}})['catch'](function(_0x43c67a){logger[_0x610e('0x15')](_0x610e('0x12'),_0x245a2a,_0x43c67a);_0x1d3771(_0x43c67a);});});}exports[_0x610e('0x18')]=function(_0x537c44){var _0x21bb38=this;return new Promise(function(_0x2473b8,_0x303587){return db['Plugin'][_0x610e('0x19')](_0x537c44[_0x610e('0x1a')],{'raw':_0x537c44[_0x610e('0x1b')]?_0x537c44[_0x610e('0x1b')][_0x610e('0x1c')]===undefined?!![]:![]:!![]})[_0x610e('0x1d')](function(_0x553e30){logger[_0x610e('0x11')](_0x610e('0x18'),_0x537c44);logger['debug'](_0x610e('0x18'),_0x537c44,JSON[_0x610e('0x1e')](_0x553e30));_0x2473b8(_0x553e30);})['catch'](function(_0x4d3017){logger[_0x610e('0x15')]('CreatePlugin',_0x4d3017[_0x610e('0x17')],_0x537c44);_0x303587(_0x21bb38['error'](0x1f4,_0x4d3017['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c670cee..7adfa19 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 _0x32bb=['emit','removeListener','length','save','remove','update'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x32bb,0x87));var _0xb32b=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0x32bb[_0x15a634];return _0xf4f7a0;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xb32b('0x0'),_0xb32b('0x1'),_0xb32b('0x2')];function createListener(_0x4f92b7,_0x40a42b){return function(_0x20d2bd){_0x40a42b[_0xb32b('0x3')](_0x4f92b7,_0x20d2bd);};}function removeListener(_0x3d6cf4,_0x3fd14e){return function(){PluginEvents[_0xb32b('0x4')](_0x3d6cf4,_0x3fd14e);};}exports['register']=function(_0x33e1f5){for(var _0x42788b=0x0,_0x15951c=events[_0xb32b('0x5')];_0x42788b<_0x15951c;_0x42788b++){var _0x3eefae=events[_0x42788b];var _0x4ff2c5=createListener('plugin:'+_0x3eefae,_0x33e1f5);PluginEvents['on'](_0x3eefae,_0x4ff2c5);}}; \ No newline at end of file +var _0x3c01=['length','./plugin.events','save','emit','removeListener'];(function(_0xd42db4,_0x29c00b){var _0x36ccdd=function(_0x5f4ef1){while(--_0x5f4ef1){_0xd42db4['push'](_0xd42db4['shift']());}};_0x36ccdd(++_0x29c00b);}(_0x3c01,0x79));var _0x13c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3c01[_0x20a584];return _0x4b41a8;};'use strict';var PluginEvents=require(_0x13c0('0x0'));var events=[_0x13c0('0x1'),'remove','update'];function createListener(_0x932a0b,_0x4d135a){return function(_0x1cee7d){_0x4d135a[_0x13c0('0x2')](_0x932a0b,_0x1cee7d);};}function removeListener(_0x5b7def,_0x3e8dce){return function(){PluginEvents[_0x13c0('0x3')](_0x5b7def,_0x3e8dce);};}exports['register']=function(_0x4264ca){for(var _0x491e08=0x0,_0x1e1d5a=events[_0x13c0('0x4')];_0x491e08<_0x1e1d5a;_0x491e08++){var _0x47cdab=events[_0x491e08];var _0x17b99c=createListener('plugin:'+_0x47cdab,_0x4264ca);PluginEvents['on'](_0x47cdab,_0x17b99c);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 43be9c4..3547280 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 _0xb430=['/:id','show','post','create','put','update','delete','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index'];(function(_0x1415ef,_0x5c219e){var _0x234acc=function(_0x2dbfca){while(--_0x2dbfca){_0x1415ef['push'](_0x1415ef['shift']());}};_0x234acc(++_0x5c219e);}(_0xb430,0xf5));var _0x0b43=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0xb430[_0x5c4f6b];return _0x104c4e;};'use strict';var express=require(_0x0b43('0x0'));var router=express[_0x0b43('0x1')]();var auth=require(_0x0b43('0x2'));var controller=require(_0x0b43('0x3'));router[_0x0b43('0x4')]('/',auth[_0x0b43('0x5')](),controller[_0x0b43('0x6')]);router['get'](_0x0b43('0x7'),auth['isAuthenticated'](),controller[_0x0b43('0x8')]);router[_0x0b43('0x9')]('/',auth[_0x0b43('0x5')](),controller[_0x0b43('0xa')]);router[_0x0b43('0xb')]('/:id',auth[_0x0b43('0x5')](),controller[_0x0b43('0xc')]);router[_0x0b43('0xd')](_0x0b43('0x7'),auth[_0x0b43('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4e61=['isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','express','Router','../../components/auth/service','index'];(function(_0xe3f6b,_0x36fd18){var _0x1d4bf0=function(_0x9fe0dd){while(--_0x9fe0dd){_0xe3f6b['push'](_0xe3f6b['shift']());}};_0x1d4bf0(++_0x36fd18);}(_0x4e61,0x141));var _0x14e6=function(_0x5418ad,_0x40742f){_0x5418ad=_0x5418ad-0x0;var _0x2cae56=_0x4e61[_0x5418ad];return _0x2cae56;};'use strict';var express=require(_0x14e6('0x0'));var router=express[_0x14e6('0x1')]();var auth=require(_0x14e6('0x2'));var controller=require('./pm2.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x14e6('0x3')]);router['get']('/:id',auth[_0x14e6('0x4')](),controller[_0x14e6('0x5')]);router[_0x14e6('0x6')]('/',auth['isAuthenticated'](),controller['create']);router[_0x14e6('0x7')](_0x14e6('0x8'),auth[_0x14e6('0x4')](),controller[_0x14e6('0x9')]);router[_0x14e6('0xa')]('/:id',auth[_0x14e6('0x4')](),controller[_0x14e6('0xb')]);module[_0x14e6('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index f58fef3..94e8906 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 _0x6993=['send','npm\x20install','info','list','then','reject','express','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','error','name','status'];(function(_0x540f80,_0xd1fe20){var _0xd1227a=function(_0x59e089){while(--_0x59e089){_0x540f80['push'](_0x540f80['shift']());}};_0xd1227a(++_0xd1fe20);}(_0x6993,0xb4));var _0x3699=function(_0x11de96,_0x3b172b){_0x11de96=_0x11de96-0x0;var _0x26d213=_0x6993[_0x11de96];return _0x26d213;};'use strict';var _=require(_0x3699('0x0'));var pm2=require(_0x3699('0x1'));var logger=require('../../config/logger')(_0x3699('0x2'));var path=require(_0x3699('0x3'));var exec=require(_0x3699('0x4'))[_0x3699('0x5')];var BPromise=require(_0x3699('0x6'));function handleEntityNotFound(_0xec0db5,_0x5290ab){return function(_0x34a496){if(!_0x34a496){_0xec0db5['sendStatus'](0x194);;}return _0x34a496;};}function respondWithResult(_0x41c21d,_0x2cf73b){_0x2cf73b=_0x2cf73b||0xc8;return function(_0xe6d52e){if(_0xe6d52e){return _0x41c21d['status'](_0x2cf73b)['json'](_0xe6d52e);}return null;};}function handleError(_0x10db71,_0x24d876){_0x24d876=_0x24d876||0x1f4;return function(_0x3dc1c3){logger[_0x3699('0x7')](_0x3dc1c3['stack']);if(_0x3dc1c3[_0x3699('0x8')]){delete _0x3dc1c3[_0x3699('0x8')];}_0x10db71[_0x3699('0x9')](_0x24d876)[_0x3699('0xa')](_0x3dc1c3);};}function execChildProcess(){return new BPromise(function(_0x3253b0,_0x1c8087){exec(_0x3699('0xb'),function(_0x456308,_0xbeebe5,_0x151203){logger[_0x3699('0xc')](_0xbeebe5);logger['info'](_0x151203);if(_0x456308){logger[_0x3699('0x7')](_0x456308);return _0x1c8087(_0x456308);}return _0x3253b0(_0xbeebe5);});});}exports['index']=function(_0x5599b5,_0x1eb9ff){return pm2[_0x3699('0xd')]()[_0x3699('0xe')](function(_0x2b999c){if(_0x2b999c){var _0x3fc741=_[_0x3699('0xf')](_0x2b999c,function(_0x7c01fe){return _0x7c01fe[_0x3699('0x8')]===_0x3699('0x10')||_0x7c01fe['name']===_0x3699('0x11');});return{'rows':_0x3fc741,'count':_0x3fc741['length']};}return null;})[_0x3699('0xe')](respondWithResult(_0x1eb9ff,null))[_0x3699('0x12')](handleError(_0x1eb9ff,null));};exports[_0x3699('0x13')]=function(_0x1dbe9e,_0x22630e){return pm2[_0x3699('0x14')](_0x1dbe9e[_0x3699('0x15')]['id'])[_0x3699('0xe')](respondWithResult(_0x22630e,null))[_0x3699('0xe')](handleEntityNotFound(_0x22630e,null))['catch'](handleError(_0x22630e,null));};exports[_0x3699('0x16')]=function(_0x2aa808,_0x2a3b56){if(_0x2aa808[_0x3699('0x17')][_0x3699('0x8')]&&_0x2aa808['body'][_0x3699('0x18')]){var _0x1f7edb=path[_0x3699('0x19')](__dirname,_0x3699('0x1a'),_0x2aa808[_0x3699('0x17')]['script']);var _0xfcfc3b=process[_0x3699('0x1b')]();process[_0x3699('0x1c')](path['dirname'](_0x1f7edb));return execChildProcess()['then'](function(_0x268401){process[_0x3699('0x1c')](_0xfcfc3b);return pm2[_0x3699('0x1d')]({'name':_0x2aa808[_0x3699('0x17')][_0x3699('0x8')],'script':_0x1f7edb});})[_0x3699('0xe')](function(_0x2ce02b){pm2['dump']();return _0x2ce02b[0x0];})[_0x3699('0xe')](respondWithResult(_0x2a3b56,0xc9))['catch'](handleError(_0x2a3b56,null));}else{return _0x2a3b56[_0x3699('0x9')](0x1f4)[_0x3699('0xa')]({'message':_0x3699('0x1e')});}};exports[_0x3699('0x1f')]=function(_0x23c773,_0x539b15){if(_0x23c773[_0x3699('0x17')]['id']){delete _0x23c773[_0x3699('0x17')]['id'];}var _0x30f36a={'online':_0x3699('0x20'),'stopped':'stop'};if(_0x30f36a[_0x3699('0x21')](_0x23c773[_0x3699('0x17')][_0x3699('0x9')])){return pm2[_0x30f36a[_0x23c773['body'][_0x3699('0x9')]]](_0x23c773[_0x3699('0x15')]['id'])['then'](respondWithResult(_0x539b15,0xc8))['catch'](handleError(_0x539b15,null));}else{return _0x539b15[_0x3699('0x9')](0x1f4)[_0x3699('0xa')]({'message':_0x3699('0x22')});}};exports['destroy']=function(_0x5cc2bb,_0x239e57){if(_0x5cc2bb[_0x3699('0x17')]['id']){delete _0x5cc2bb[_0x3699('0x17')]['id'];}if(_0x5cc2bb[_0x3699('0x15')]['id']){return pm2[_0x3699('0x23')](_0x5cc2bb[_0x3699('0x15')]['id'])[_0x3699('0xe')](function(_0xc0173d){pm2[_0x3699('0x24')]();return _0xc0173d[0x0];})[_0x3699('0xe')](respondWithResult(_0x239e57,null))[_0x3699('0x12')](handleError(_0x239e57,null));}else{return _0x239e57[_0x3699('0x9')](0x1f4)[_0x3699('0xa')]({'message':_0x3699('0x25')});}}; \ No newline at end of file +var _0xe47e=['delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','bluebird','sendStatus','status','json','error','stack','send','info','list','name','length','then','catch','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy'];(function(_0x1f0e6c,_0x43bfcb){var _0x36c19c=function(_0x2de6c1){while(--_0x2de6c1){_0x1f0e6c['push'](_0x1f0e6c['shift']());}};_0x36c19c(++_0x43bfcb);}(_0xe47e,0x199));var _0xee47=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0xe47e[_0x445c98];return _0x2fe913;};'use strict';var _=require(_0xee47('0x0'));var pm2=require(_0xee47('0x1'));var logger=require(_0xee47('0x2'))(_0xee47('0x3'));var path=require(_0xee47('0x4'));var exec=require(_0xee47('0x5'))['exec'];var BPromise=require(_0xee47('0x6'));function handleEntityNotFound(_0x118705,_0x103e9f){return function(_0x48e1e3){if(!_0x48e1e3){_0x118705[_0xee47('0x7')](0x194);;}return _0x48e1e3;};}function respondWithResult(_0x43a69e,_0x25c6f0){_0x25c6f0=_0x25c6f0||0xc8;return function(_0x2f0d90){if(_0x2f0d90){return _0x43a69e[_0xee47('0x8')](_0x25c6f0)[_0xee47('0x9')](_0x2f0d90);}return null;};}function handleError(_0x2ef053,_0x51f62a){_0x51f62a=_0x51f62a||0x1f4;return function(_0xa2af1d){logger[_0xee47('0xa')](_0xa2af1d[_0xee47('0xb')]);if(_0xa2af1d['name']){delete _0xa2af1d['name'];}_0x2ef053[_0xee47('0x8')](_0x51f62a)[_0xee47('0xc')](_0xa2af1d);};}function execChildProcess(){return new BPromise(function(_0xe9f3fa,_0x59535e){exec('npm\x20install',function(_0x4a1522,_0x1d24e7,_0x18eb3e){logger[_0xee47('0xd')](_0x1d24e7);logger[_0xee47('0xd')](_0x18eb3e);if(_0x4a1522){logger['error'](_0x4a1522);return _0x59535e(_0x4a1522);}return _0xe9f3fa(_0x1d24e7);});});}exports['index']=function(_0x5a5962,_0x9459dd){return pm2[_0xee47('0xe')]()['then'](function(_0xa8c6c5){if(_0xa8c6c5){var _0x4bd4b2=_['reject'](_0xa8c6c5,function(_0x208d23){return _0x208d23['name']==='express'||_0x208d23[_0xee47('0xf')]==='motion2';});return{'rows':_0x4bd4b2,'count':_0x4bd4b2[_0xee47('0x10')]};}return null;})[_0xee47('0x11')](respondWithResult(_0x9459dd,null))[_0xee47('0x12')](handleError(_0x9459dd,null));};exports['show']=function(_0x1249f6,_0x37f180){return pm2['describe'](_0x1249f6[_0xee47('0x13')]['id'])['then'](respondWithResult(_0x37f180,null))[_0xee47('0x11')](handleEntityNotFound(_0x37f180,null))[_0xee47('0x12')](handleError(_0x37f180,null));};exports[_0xee47('0x14')]=function(_0x5ee16c,_0x2c6aa0){if(_0x5ee16c[_0xee47('0x15')][_0xee47('0xf')]&&_0x5ee16c[_0xee47('0x15')][_0xee47('0x16')]){var _0x4c3ceb=path[_0xee47('0x17')](__dirname,_0xee47('0x18'),_0x5ee16c['body'][_0xee47('0x16')]);var _0x54e690=process['cwd']();process[_0xee47('0x19')](path[_0xee47('0x1a')](_0x4c3ceb));return execChildProcess()[_0xee47('0x11')](function(_0x4fe480){process[_0xee47('0x19')](_0x54e690);return pm2[_0xee47('0x1b')]({'name':_0x5ee16c[_0xee47('0x15')][_0xee47('0xf')],'script':_0x4c3ceb});})['then'](function(_0x41054e){pm2[_0xee47('0x1c')]();return _0x41054e[0x0];})[_0xee47('0x11')](respondWithResult(_0x2c6aa0,0xc9))['catch'](handleError(_0x2c6aa0,null));}else{return _0x2c6aa0['status'](0x1f4)[_0xee47('0xc')]({'message':_0xee47('0x1d')});}};exports[_0xee47('0x1e')]=function(_0x2ad43f,_0x4d15ab){if(_0x2ad43f[_0xee47('0x15')]['id']){delete _0x2ad43f[_0xee47('0x15')]['id'];}var _0x206907={'online':_0xee47('0x1f'),'stopped':_0xee47('0x20')};if(_0x206907[_0xee47('0x21')](_0x2ad43f[_0xee47('0x15')]['status'])){return pm2[_0x206907[_0x2ad43f['body']['status']]](_0x2ad43f[_0xee47('0x13')]['id'])[_0xee47('0x11')](respondWithResult(_0x4d15ab,0xc8))[_0xee47('0x12')](handleError(_0x4d15ab,null));}else{return _0x4d15ab[_0xee47('0x8')](0x1f4)[_0xee47('0xc')]({'message':'Unknown\x20status'});}};exports[_0xee47('0x22')]=function(_0x3c5686,_0x6188a6){if(_0x3c5686[_0xee47('0x15')]['id']){delete _0x3c5686[_0xee47('0x15')]['id'];}if(_0x3c5686[_0xee47('0x13')]['id']){return pm2[_0xee47('0x23')](_0x3c5686[_0xee47('0x13')]['id'])[_0xee47('0x11')](function(_0x4562ec){pm2['dump']();return _0x4562ec[0x0];})['then'](respondWithResult(_0x6188a6,null))[_0xee47('0x12')](handleError(_0x6188a6,null));}else{return _0x6188a6[_0xee47('0x8')](0x1f4)[_0xee47('0xc')]({'message':_0xee47('0x24')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 5f1ad35..44507e2 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 _0x1bc5=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x4ab95b,_0x396a6b){var _0x461dba=function(_0x49d1f3){while(--_0x49d1f3){_0x4ab95b['push'](_0x4ab95b['shift']());}};_0x461dba(++_0x396a6b);}(_0x1bc5,0xcc));var _0x51bc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x1bc5[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x51bc('0x0'));var util=require(_0x51bc('0x1'));var path=require('path');var timeout=require(_0x51bc('0x2'));var express=require(_0x51bc('0x3'));var router=express[_0x51bc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x51bc('0x5'));var config=require(_0x51bc('0x6'));module[_0x51bc('0x7')]=router; \ No newline at end of file +var _0x5ccc=['exports','multer','path','connect-timeout','express','Router','../../config/environment'];(function(_0x26986a,_0x168f62){var _0x361f12=function(_0x1df5dc){while(--_0x1df5dc){_0x26986a['push'](_0x26986a['shift']());}};_0x361f12(++_0x168f62);}(_0x5ccc,0x190));var _0xc5cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ccc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc5cc('0x0'));var util=require('util');var path=require(_0xc5cc('0x1'));var timeout=require(_0xc5cc('0x2'));var express=require(_0xc5cc('0x3'));var router=express[_0xc5cc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc5cc('0x5'));module[_0xc5cc('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 0bfca87..7d69a5c 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 _0x623f=['exports','INTEGER','DATE','STRING','sequelize'];(function(_0x492164,_0x5449e9){var _0x33e1c6=function(_0x501036){while(--_0x501036){_0x492164['push'](_0x492164['shift']());}};_0x33e1c6(++_0x5449e9);}(_0x623f,0x135));var _0xf623=function(_0x37866f,_0x593b19){_0x37866f=_0x37866f-0x0;var _0x15e13a=_0x623f[_0x37866f];return _0x15e13a;};'use strict';var Sequelize=require(_0xf623('0x0'));module[_0xf623('0x1')]={'state':{'type':Sequelize[_0xf623('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf623('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf623('0x3')]},'responsetime':{'type':Sequelize[_0xf623('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf623('0x4')]},'campaigntype':{'type':Sequelize[_0xf623('0x4')]},'membername':{'type':Sequelize[_0xf623('0x4')]}}; \ No newline at end of file +var _0x61b3=['exports','INTEGER','DATE','STRING','sequelize'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x61b3,0xf4));var _0x361b=function(_0x42f8f9,_0x2d8757){_0x42f8f9=_0x42f8f9-0x0;var _0x4dae76=_0x61b3[_0x42f8f9];return _0x4dae76;};'use strict';var Sequelize=require(_0x361b('0x0'));module[_0x361b('0x1')]={'state':{'type':Sequelize[_0x361b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x361b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x361b('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x361b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x361b('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index edbd718..4ddda45 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 _0x05d7=['moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','define','report_agent_preview','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x05d7,0xb8));var _0x705d=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x05d7[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x705d('0x0'));var util=require(_0x705d('0x1'));var logger=require(_0x705d('0x2'))('api');var moment=require(_0x705d('0x3'));var BPromise=require(_0x705d('0x4'));var rp=require(_0x705d('0x5'));var fs=require('fs');var path=require(_0x705d('0x6'));var rimraf=require(_0x705d('0x7'));var config=require('../../config/environment');var attributes=require(_0x705d('0x8'));module['exports']=function(_0x4312a0,_0x2d0569){return _0x4312a0[_0x705d('0x9')]('ReportAgentPreview',attributes,{'tableName':_0x705d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x109c=['../../config/logger','moment','bluebird','request-promise','path','./reportAgentPreview.attributes','exports','ReportAgentPreview','lodash','util'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0x109c,0x1de));var _0xc109=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x109c[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xc109('0x0'));var util=require(_0xc109('0x1'));var logger=require(_0xc109('0x2'))('api');var moment=require(_0xc109('0x3'));var BPromise=require(_0xc109('0x4'));var rp=require(_0xc109('0x5'));var fs=require('fs');var path=require(_0xc109('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc109('0x7'));module[_0xc109('0x8')]=function(_0x27c203,_0xbc906f){return _0x27c203['define'](_0xc109('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 0639341..69eb81e 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 _0x92e9=['client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','options','raw','CreateReportAgentPreview','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4c8232,_0x4e0dea){var _0x3cc8e5=function(_0x248561){while(--_0x248561){_0x4c8232['push'](_0x4c8232['shift']());}};_0x3cc8e5(++_0x4e0dea);}(_0x92e9,0x16f));var _0x992e=function(_0x38e1ed,_0x5d2063){_0x38e1ed=_0x38e1ed-0x0;var _0x3cc657=_0x92e9[_0x38e1ed];return _0x3cc657;};'use strict';var _=require(_0x992e('0x0'));var util=require(_0x992e('0x1'));var moment=require('moment');var BPromise=require(_0x992e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x992e('0x3'))['db'];var utils=require(_0x992e('0x4'));var logger=require('../../config/logger')(_0x992e('0x5'));var config=require(_0x992e('0x6'));var jayson=require(_0x992e('0x7'));var client=jayson[_0x992e('0x8')][_0x992e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5da51a,_0x3b3df7,_0x210b28){return new BPromise(function(_0x27d5bc,_0x4aa6a6){return client[_0x992e('0xa')](_0x5da51a,_0x210b28)[_0x992e('0xb')](function(_0x3ad99f){logger['info'](_0x992e('0xc'),_0x3b3df7,'request\x20sent');logger[_0x992e('0xd')](_0x992e('0xe'),_0x3b3df7,_0x992e('0xf'),JSON[_0x992e('0x10')](_0x3ad99f));if(_0x3ad99f[_0x992e('0x11')]){if(_0x3ad99f[_0x992e('0x11')]['code']===0x1f4){logger[_0x992e('0x11')](_0x992e('0xc'),_0x3b3df7,_0x3ad99f[_0x992e('0x11')][_0x992e('0x12')]);return _0x4aa6a6(_0x3ad99f['error'][_0x992e('0x12')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x3b3df7,_0x3ad99f[_0x992e('0x11')][_0x992e('0x12')]);return _0x27d5bc(_0x3ad99f[_0x992e('0x11')][_0x992e('0x12')]);}else{logger[_0x992e('0x13')](_0x992e('0xc'),_0x3b3df7,_0x992e('0xf'));_0x27d5bc(_0x3ad99f[_0x992e('0x14')]['message']);}})[_0x992e('0x15')](function(_0x3ac447){logger[_0x992e('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x3b3df7,_0x3ac447);_0x4aa6a6(_0x3ac447);});});}exports['CreateReportAgentPreview']=function(_0x5f1a34){var _0x56136c=this;return new Promise(function(_0x2d4270,_0x96ed40){return db['ReportAgentPreview']['create'](_0x5f1a34['body'],{'raw':_0x5f1a34[_0x992e('0x16')]?_0x5f1a34['options'][_0x992e('0x17')]===undefined?!![]:![]:!![]})[_0x992e('0xb')](function(_0x2b02b5){logger[_0x992e('0x13')](_0x992e('0x18'),_0x5f1a34);logger[_0x992e('0xd')]('CreateReportAgentPreview',_0x5f1a34,JSON[_0x992e('0x10')](_0x2b02b5));_0x2d4270(_0x2b02b5);})[_0x992e('0x15')](function(_0x14453b){logger['error'](_0x992e('0x18'),_0x14453b[_0x992e('0x12')],_0x5f1a34);_0x96ed40(_0x56136c['error'](0x1f4,_0x14453b[_0x992e('0x12')]));});});}; \ No newline at end of file +var _0x6d9a=['../../config/environment','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1e19bd,_0x70ca16){var _0x51192d=function(_0x513489){while(--_0x513489){_0x1e19bd['push'](_0x1e19bd['shift']());}};_0x51192d(++_0x70ca16);}(_0x6d9a,0xd7));var _0xa6d9=function(_0x28f7e7,_0x1459ca){_0x28f7e7=_0x28f7e7-0x0;var _0x157219=_0x6d9a[_0x28f7e7];return _0x157219;};'use strict';var _=require(_0xa6d9('0x0'));var util=require(_0xa6d9('0x1'));var moment=require(_0xa6d9('0x2'));var BPromise=require(_0xa6d9('0x3'));var rs=require(_0xa6d9('0x4'));var fs=require('fs');var Redis=require(_0xa6d9('0x5'));var db=require(_0xa6d9('0x6'))['db'];var utils=require(_0xa6d9('0x7'));var logger=require(_0xa6d9('0x8'))('rpc');var config=require(_0xa6d9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa6d9('0xa')][_0xa6d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x532b5f,_0x297aed,_0x3abe62){return new BPromise(function(_0x25dfc1,_0x59075b){return client[_0xa6d9('0xc')](_0x532b5f,_0x3abe62)[_0xa6d9('0xd')](function(_0x217413){logger[_0xa6d9('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x297aed,_0xa6d9('0xf'));logger[_0xa6d9('0x10')](_0xa6d9('0x11'),_0x297aed,_0xa6d9('0xf'),JSON[_0xa6d9('0x12')](_0x217413));if(_0x217413['error']){if(_0x217413[_0xa6d9('0x13')]['code']===0x1f4){logger[_0xa6d9('0x13')](_0xa6d9('0x14'),_0x297aed,_0x217413['error'][_0xa6d9('0x15')]);return _0x59075b(_0x217413[_0xa6d9('0x13')]['message']);}logger[_0xa6d9('0x13')](_0xa6d9('0x14'),_0x297aed,_0x217413['error']['message']);return _0x25dfc1(_0x217413['error'][_0xa6d9('0x15')]);}else{logger[_0xa6d9('0xe')](_0xa6d9('0x14'),_0x297aed,_0xa6d9('0xf'));_0x25dfc1(_0x217413[_0xa6d9('0x16')]['message']);}})['catch'](function(_0x4c6181){logger['error'](_0xa6d9('0x14'),_0x297aed,_0x4c6181);_0x59075b(_0x4c6181);});});}exports[_0xa6d9('0x17')]=function(_0x2104c1){var _0x1cc4fb=this;return new Promise(function(_0x254a69,_0x51421d){return db['ReportAgentPreview']['create'](_0x2104c1[_0xa6d9('0x18')],{'raw':_0x2104c1[_0xa6d9('0x19')]?_0x2104c1[_0xa6d9('0x19')][_0xa6d9('0x1a')]===undefined?!![]:![]:!![]})[_0xa6d9('0xd')](function(_0x46958f){logger[_0xa6d9('0xe')]('CreateReportAgentPreview',_0x2104c1);logger['debug'](_0xa6d9('0x17'),_0x2104c1,JSON[_0xa6d9('0x12')](_0x46958f));_0x254a69(_0x46958f);})[_0xa6d9('0x1b')](function(_0x255c06){logger[_0xa6d9('0x13')](_0xa6d9('0x17'),_0x255c06[_0xa6d9('0x15')],_0x2104c1);_0x51421d(_0x1cc4fb[_0xa6d9('0x13')](0x1f4,_0x255c06[_0xa6d9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 6304a1e..6023a86 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 _0x6c56=['/sms/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/outbound','outbound','/outbound/channels','/agents','agents','put','agentCapacity','telephones','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x6c56,0xc6));var _0x66c5=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0x6c56[_0x3c0dcc];return _0x1a224c;};'use strict';var multer=require(_0x66c5('0x0'));var util=require(_0x66c5('0x1'));var path=require(_0x66c5('0x2'));var express=require('express');var router=express[_0x66c5('0x3')]();var auth=require(_0x66c5('0x4'));var controller=require(_0x66c5('0x5'));router['get']('/voice/channels',auth['isAuthenticated'](),controller[_0x66c5('0x6')]);router[_0x66c5('0x7')](_0x66c5('0x8'),auth[_0x66c5('0x9')](),controller[_0x66c5('0xa')]);router[_0x66c5('0x7')](_0x66c5('0xb'),auth[_0x66c5('0x9')](),controller[_0x66c5('0xc')]);router['get'](_0x66c5('0xd'),auth[_0x66c5('0x9')](),controller[_0x66c5('0xe')]);router['get'](_0x66c5('0xf'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x10')]);router[_0x66c5('0x7')]('/mail/queues',auth[_0x66c5('0x9')](),controller[_0x66c5('0x11')]);router[_0x66c5('0x7')]('/mail/accounts',auth[_0x66c5('0x9')](),controller[_0x66c5('0x12')]);router[_0x66c5('0x7')](_0x66c5('0x13'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x14')]);router['get'](_0x66c5('0x15'),auth[_0x66c5('0x9')](),controller['smsQueues']);router['get']('/whatsapp/queues',auth[_0x66c5('0x9')](),controller[_0x66c5('0x16')]);router['get'](_0x66c5('0x17'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x18')]);router[_0x66c5('0x7')](_0x66c5('0x19'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x1a')]);router['get'](_0x66c5('0x1b'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x1c')]);router[_0x66c5('0x7')](_0x66c5('0x1d'),auth[_0x66c5('0x9')](),controller['voiceQueuesChannel']);router[_0x66c5('0x7')](_0x66c5('0x1e'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x66c5('0x7')]('/voice/queues/:id',auth[_0x66c5('0x9')](),controller['showVoiceQueues']);router[_0x66c5('0x7')](_0x66c5('0x20'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x21')]);router[_0x66c5('0x7')](_0x66c5('0x22'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x66c5('0x7')](_0x66c5('0x23'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x24')]);router[_0x66c5('0x25')]('/agents/:id/capacity',auth[_0x66c5('0x9')](),controller[_0x66c5('0x26')]);router[_0x66c5('0x7')]('/telephones',auth[_0x66c5('0x9')](),controller[_0x66c5('0x27')]);router[_0x66c5('0x7')]('/trunks',auth['isAuthenticated'](),controller['trunks']);router[_0x66c5('0x7')](_0x66c5('0x28'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x29')]);router[_0x66c5('0x7')](_0x66c5('0x2a'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x2b')]);router[_0x66c5('0x7')](_0x66c5('0x2c'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x66c5('0x7')](_0x66c5('0x2d'),auth['isAuthenticated'](),controller[_0x66c5('0x2e')]);router[_0x66c5('0x7')](_0x66c5('0x2f'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x30')]);router[_0x66c5('0x7')]('/sms/queues/waitinginteractions',auth[_0x66c5('0x9')](),controller[_0x66c5('0x31')]);router[_0x66c5('0x7')](_0x66c5('0x32'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x33')]);router[_0x66c5('0x7')](_0x66c5('0x34'),auth[_0x66c5('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x66c5('0x35')](_0x66c5('0x36'),auth['isAuthenticated'](),controller[_0x66c5('0x37')](_0x66c5('0x38')));router['get'](_0x66c5('0x39'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x3a')]);router['post'](_0x66c5('0x3b'),auth[_0x66c5('0x9')](),controller['queueNotify'](_0x66c5('0x3c')));router['get']('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x66c5('0x3d')]);router[_0x66c5('0x35')]('/fax/queues/:id/notify',auth[_0x66c5('0x9')](),controller[_0x66c5('0x37')]('fax'));router[_0x66c5('0x7')](_0x66c5('0x3e'),auth['isAuthenticated'](),controller[_0x66c5('0x3f')]);router[_0x66c5('0x35')](_0x66c5('0x40'),auth[_0x66c5('0x9')](),controller['queueNotify'](_0x66c5('0x41')));router[_0x66c5('0x7')](_0x66c5('0x42'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x43')]);router['post'](_0x66c5('0x44'),auth['isAuthenticated'](),controller[_0x66c5('0x37')]('sms'));router[_0x66c5('0x35')]('/whatsapp/queues/:id/notify',auth[_0x66c5('0x9')](),controller[_0x66c5('0x37')]('whatsapp'));router[_0x66c5('0x7')]('/sms/queues/:id',auth[_0x66c5('0x9')](),controller['showSmsQueues']);router[_0x66c5('0x7')](_0x66c5('0x45'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x66c5('0x35')](_0x66c5('0x46'),auth[_0x66c5('0x9')](),controller[_0x66c5('0x47')]);module[_0x66c5('0x48')]=router; \ No newline at end of file +var _0x795e=['showChatQueues','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','path','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound/channels','outboundChannels','agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat'];(function(_0x6e7740,_0x3ef325){var _0x59d023=function(_0x2f74cb){while(--_0x2f74cb){_0x6e7740['push'](_0x6e7740['shift']());}};_0x59d023(++_0x3ef325);}(_0x795e,0x174));var _0xe795=function(_0x18ecb8,_0x113401){_0x18ecb8=_0x18ecb8-0x0;var _0xdc7567=_0x795e[_0x18ecb8];return _0xdc7567;};'use strict';var multer=require(_0xe795('0x0'));var util=require('util');var path=require(_0xe795('0x1'));var express=require('express');var router=express[_0xe795('0x2')]();var auth=require(_0xe795('0x3'));var controller=require('./rpc.controller');router[_0xe795('0x4')](_0xe795('0x5'),auth[_0xe795('0x6')](),controller['voiceChannels']);router[_0xe795('0x4')](_0xe795('0x7'),auth[_0xe795('0x6')](),controller[_0xe795('0x8')]);router['get'](_0xe795('0x9'),auth[_0xe795('0x6')](),controller[_0xe795('0xa')]);router[_0xe795('0x4')](_0xe795('0xb'),auth[_0xe795('0x6')](),controller[_0xe795('0xc')]);router[_0xe795('0x4')](_0xe795('0xd'),auth['isAuthenticated'](),controller[_0xe795('0xe')]);router[_0xe795('0x4')](_0xe795('0xf'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xe795('0x4')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xe795('0x10')]);router[_0xe795('0x4')](_0xe795('0x11'),auth['isAuthenticated'](),controller[_0xe795('0x12')]);router[_0xe795('0x4')](_0xe795('0x13'),auth[_0xe795('0x6')](),controller[_0xe795('0x14')]);router['get'](_0xe795('0x15'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xe795('0x4')](_0xe795('0x16'),auth['isAuthenticated'](),controller[_0xe795('0x17')]);router[_0xe795('0x4')](_0xe795('0x18'),auth[_0xe795('0x6')](),controller[_0xe795('0x19')]);router[_0xe795('0x4')](_0xe795('0x1a'),auth[_0xe795('0x6')](),controller[_0xe795('0x1b')]);router['get']('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xe795('0x1c')]);router[_0xe795('0x4')](_0xe795('0x1d'),auth[_0xe795('0x6')](),controller['voiceQueuesChannelHangup']);router[_0xe795('0x4')](_0xe795('0x1e'),auth[_0xe795('0x6')](),controller[_0xe795('0x1f')]);router[_0xe795('0x4')](_0xe795('0x20'),auth['isAuthenticated'](),controller[_0xe795('0x21')]);router[_0xe795('0x4')]('/outbound',auth['isAuthenticated'](),controller['outbound']);router[_0xe795('0x4')](_0xe795('0x22'),auth[_0xe795('0x6')](),controller[_0xe795('0x23')]);router['get']('/agents',auth[_0xe795('0x6')](),controller[_0xe795('0x24')]);router['put']('/agents/:id/capacity',auth[_0xe795('0x6')](),controller[_0xe795('0x25')]);router['get'](_0xe795('0x26'),auth[_0xe795('0x6')](),controller[_0xe795('0x27')]);router[_0xe795('0x4')](_0xe795('0x28'),auth['isAuthenticated'](),controller[_0xe795('0x29')]);router['get'](_0xe795('0x2a'),auth[_0xe795('0x6')](),controller['campaigns']);router[_0xe795('0x4')](_0xe795('0x2b'),auth[_0xe795('0x6')](),controller[_0xe795('0x2c')]);router['get'](_0xe795('0x2d'),auth[_0xe795('0x6')](),controller['chatQueuesWaitingInteractions']);router['get']('/mail/queues/waitinginteractions',auth[_0xe795('0x6')](),controller[_0xe795('0x2e')]);router[_0xe795('0x4')](_0xe795('0x2f'),auth[_0xe795('0x6')](),controller[_0xe795('0x30')]);router['get'](_0xe795('0x31'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get'](_0xe795('0x32'),auth[_0xe795('0x6')](),controller[_0xe795('0x33')]);router[_0xe795('0x4')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe795('0x34')]);router[_0xe795('0x35')](_0xe795('0x36'),auth[_0xe795('0x6')](),controller[_0xe795('0x37')]('mail'));router[_0xe795('0x4')](_0xe795('0x38'),auth[_0xe795('0x6')](),controller[_0xe795('0x39')]);router['post'](_0xe795('0x3a'),auth['isAuthenticated'](),controller[_0xe795('0x37')](_0xe795('0x3b')));router[_0xe795('0x4')]('/chat/queues/:id',auth[_0xe795('0x6')](),controller[_0xe795('0x3c')]);router[_0xe795('0x35')]('/fax/queues/:id/notify',auth[_0xe795('0x6')](),controller[_0xe795('0x37')]('fax'));router[_0xe795('0x4')](_0xe795('0x3d'),auth[_0xe795('0x6')](),controller['showFaxQueues']);router[_0xe795('0x35')](_0xe795('0x3e'),auth[_0xe795('0x6')](),controller[_0xe795('0x37')]('openchannel'));router[_0xe795('0x4')](_0xe795('0x3f'),auth[_0xe795('0x6')](),controller[_0xe795('0x40')]);router[_0xe795('0x35')](_0xe795('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0xe795('0x42')));router[_0xe795('0x35')](_0xe795('0x43'),auth[_0xe795('0x6')](),controller[_0xe795('0x37')]('whatsapp'));router[_0xe795('0x4')](_0xe795('0x44'),auth[_0xe795('0x6')](),controller['showSmsQueues']);router[_0xe795('0x4')](_0xe795('0x45'),auth[_0xe795('0x6')](),controller['showWhatsappQueues']);router[_0xe795('0x35')](_0xe795('0x46'),auth[_0xe795('0x6')](),controller[_0xe795('0x47')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 3d8f312..0ccfee8 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 _0x5692=['json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','showChatQueues','ChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','From','agentTransferTimeout','bluebird','lodash','../../mysqldb','jayson/promise','client','http','request','error','message','result','catch','status'];(function(_0x215638,_0x4125c6){var _0x4eb0eb=function(_0x403c8){while(--_0x403c8){_0x215638['push'](_0x215638['shift']());}};_0x4eb0eb(++_0x4125c6);}(_0x5692,0x144));var _0x2569=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5692[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x2569('0x0'));var moment=require('moment');var _=require(_0x2569('0x1'));var util=require('util');var db=require(_0x2569('0x2'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x2569('0x3'));var amiClient=jayson[_0x2569('0x4')][_0x2569('0x5')]({'port':0x232a});var mailClient=jayson[_0x2569('0x4')][_0x2569('0x5')]({'port':0x232b});var routingClient=jayson[_0x2569('0x4')][_0x2569('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xa91af0,_0x4d7563,_0x461b1a){return new BPromise(function(_0x24b6f2,_0x5a865b){var _0x31cd5f=_0x461b1a?_0x461b1a:amiClient;return _0x31cd5f[_0x2569('0x6')](_0xa91af0,_0x4d7563)['then'](function(_0xca38c){if(_0xca38c[_0x2569('0x7')]){if(_0xca38c['error']['code']===0x1f4){return _0x5a865b(_0xca38c[_0x2569('0x7')][_0x2569('0x8')]);}return _0x24b6f2(_0xca38c[_0x2569('0x7')]['message']);}else{_0x24b6f2(_0xca38c[_0x2569('0x9')]);}})[_0x2569('0xa')](function(_0x11cfad){_0x5a865b(_0x11cfad);});});}function respondWithResult(_0x4f83fb,_0x10641a){_0x10641a=_0x10641a||0xc8;return function(_0x367810){if(_0x367810){return _0x4f83fb[_0x2569('0xb')](_0x10641a)[_0x2569('0xc')](_0x367810);}return _0x4f83fb[_0x2569('0xd')](0x194);};}function handleError(_0x567c88,_0x4713e0){_0x4713e0=_0x4713e0||0x1f4;return function(_0x4ca8ee){logger[_0x2569('0x7')](_0x4ca8ee['stack']);if(_0x4ca8ee[_0x2569('0xe')]){delete _0x4ca8ee[_0x2569('0xe')];}_0x567c88[_0x2569('0xb')](_0x4713e0)[_0x2569('0xf')](_0x4ca8ee);};}function findById(_0x4b54c){return function(_0x28b916){if(!_[_0x2569('0x10')](_0x4b54c)&&!_[_0x2569('0x10')](_0x28b916)&&!_[_0x2569('0x10')](_0x28b916[_0x2569('0x11')])){return _[_0x2569('0x12')](_0x28b916[_0x2569('0x11')],function(_0x81a00e){return _0x81a00e['id']==_0x4b54c;});}return null;};}exports[_0x2569('0x13')]=function(_0x23d239,_0x124f22){return respondWithRpcPromise(_0x2569('0x14'),_0x23d239[_0x2569('0x15')])[_0x2569('0x16')](respondWithResult(_0x124f22,null))[_0x2569('0xa')](handleError(_0x124f22,null));};exports[_0x2569('0x17')]=function(_0x2ad760,_0x140499){return respondWithRpcPromise(_0x2569('0x18'),_[_0x2569('0x19')](_0x2ad760[_0x2569('0x15')],_0x2ad760[_0x2569('0x1a')]))['then'](respondWithResult(_0x140499,null))[_0x2569('0xa')](handleError(_0x140499,null));};exports[_0x2569('0x1b')]=function(_0x29437a,_0x14b651){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x2569('0x19')](_0x29437a[_0x2569('0x15')],_0x29437a[_0x2569('0x1a')]))['then'](respondWithResult(_0x14b651,null))[_0x2569('0xa')](handleError(_0x14b651,null));};exports[_0x2569('0x1c')]=function(_0x47a6e1,_0x486ed0){return respondWithRpcPromise('VoiceQueues',_0x47a6e1['query'])['then'](respondWithResult(_0x486ed0,null))['catch'](handleError(_0x486ed0,null));};exports[_0x2569('0x1d')]=function(_0x15b742,_0x37bdae){return respondWithRpcPromise(_0x2569('0x1e'),_0x15b742[_0x2569('0x15')])[_0x2569('0x16')](findById(_0x15b742['params']['id']))[_0x2569('0x16')](respondWithResult(_0x37bdae,null))[_0x2569('0xa')](handleError(_0x37bdae,null));};exports['voiceQueuesPreview']=function(_0x546511,_0x33959a){return respondWithRpcPromise(_0x2569('0x1f'),_[_0x2569('0x19')](_0x546511['query'],_0x546511[_0x2569('0x1a')]))[_0x2569('0x16')](respondWithResult(_0x33959a,null))[_0x2569('0xa')](handleError(_0x33959a,null));};exports[_0x2569('0x20')]=function(_0x1af540,_0x42792a){return respondWithRpcPromise(_0x2569('0x21'),_0x1af540[_0x2569('0x15')])[_0x2569('0x16')](respondWithResult(_0x42792a,null))['catch'](handleError(_0x42792a,null));};exports['voiceQueuesChannel']=function(_0x23462d,_0x5465da){return respondWithRpcPromise(_0x2569('0x22'),_['merge'](_0x23462d[_0x2569('0x15')],_0x23462d['params']))[_0x2569('0x16')](respondWithResult(_0x5465da,null))[_0x2569('0xa')](handleError(_0x5465da,null));};exports[_0x2569('0x23')]=function(_0x330dce,_0xd78b01){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x2569('0x19')](_0x330dce[_0x2569('0x15')],_0x330dce['params']))[_0x2569('0x16')](respondWithResult(_0xd78b01,null))['catch'](handleError(_0xd78b01,null));};exports[_0x2569('0x24')]=function(_0x2f62b8,_0x3253ad){return respondWithRpcPromise(_0x2569('0x25'),_[_0x2569('0x19')](_0x2f62b8['query'],_0x2f62b8[_0x2569('0x1a')]))[_0x2569('0x16')](respondWithResult(_0x3253ad,null))['catch'](handleError(_0x3253ad,null));};exports[_0x2569('0x26')]=function(_0x1f7de0,_0x22e96e){return respondWithRpcPromise(_0x2569('0x27'),_0x1f7de0['query'])[_0x2569('0x16')](respondWithResult(_0x22e96e,null))['catch'](handleError(_0x22e96e,null));};exports[_0x2569('0x28')]=function(_0xd5f4f5,_0x40f7f1){return respondWithRpcPromise('OutboundChannels',_0xd5f4f5['query'])[_0x2569('0x16')](respondWithResult(_0x40f7f1,null))[_0x2569('0xa')](handleError(_0x40f7f1,null));};exports[_0x2569('0x29')]=function(_0x53848b,_0x1d75ed){var _0x1ddf3c;return respondWithRpcPromise(_0x2569('0x2a'),_0x53848b[_0x2569('0x15')])[_0x2569('0x16')](function(_0x414fb4){_0x1ddf3c=_0x414fb4;return respondWithRpcPromise(_0x2569('0x2a'),_0x53848b['query'],routingClient);})[_0x2569('0x16')](function(_0x3cad5d){return _[_0x2569('0x19')]({},_0x3cad5d,_0x1ddf3c);})['then'](respondWithResult(_0x1d75ed,null))[_0x2569('0xa')](handleError(_0x1d75ed,null));};exports[_0x2569('0x2b')]=function(_0x1035d1,_0x3431ad){if(_0x1035d1[_0x2569('0x2c')]&&_0x1035d1[_0x2569('0x2c')][_0x2569('0x2d')]&&_0x1035d1[_0x2569('0x2e')]&&_0x1035d1['user']['name']){for(var _0x179399 in _0x1035d1['body'][_0x2569('0x2d')]){if(_0x1035d1[_0x2569('0x2c')][_0x2569('0x2d')][_0x2569('0x2f')](_0x179399)){db[_0x2569('0x30')][_0x2569('0x31')]({'where':{'channel':_0x179399,'membername':_0x1035d1[_0x2569('0x2e')][_0x2569('0xe')],'type':_0x2569('0x32'),'exitAt':null,'uniqueid':_0x1035d1[_0x2569('0x2c')]['interaction'][_0x179399]&&_0x1035d1[_0x2569('0x2c')][_0x2569('0x2d')][_0x179399]['length']?{'$notIn':_0x1035d1['body'][_0x2569('0x2d')][_0x179399]}:{'$ne':null}}})[_0x2569('0x16')](function(_0x1ba59d){var _0x386ee5=moment()[_0x2569('0x33')](_0x2569('0x34'));for(var _0x3a52b4=0x0,_0x5dea67=_0x1ba59d[_0x2569('0x35')];_0x3a52b4<_0x5dea67;_0x3a52b4+=0x1){_0x1ba59d[_0x3a52b4][_0x2569('0x36')]({'exitAt':_0x386ee5});}});for(var _0x1274d8=0x0;_0x1274d8<_0x1035d1[_0x2569('0x2c')][_0x2569('0x2d')][_0x179399][_0x2569('0x35')];_0x1274d8+=0x1){db[_0x2569('0x30')][_0x2569('0x37')]({'where':{'channel':_0x179399,'membername':_0x1035d1[_0x2569('0x2e')][_0x2569('0xe')],'type':'INTERACTION','uniqueid':_0x1035d1['body'][_0x2569('0x2d')][_0x179399][_0x1274d8],'exitAt':null},'defaults':{'channel':_0x179399,'membername':_0x1035d1[_0x2569('0x2e')][_0x2569('0xe')],'interface':_[_0x2569('0x10')](_0x1035d1[_0x2569('0x2e')][_0x2569('0x38')])?util[_0x2569('0x33')]('SIP/%s',_0x1035d1['user'][_0x2569('0xe')]):_0x1035d1['user'][_0x2569('0x38')],'type':_0x2569('0x32'),'enterAt':moment()['format'](_0x2569('0x34')),'role':_0x2569('0x39'),'internal':_0x1035d1[_0x2569('0x2e')][_0x2569('0x3a')],'uniqueid':_0x1035d1[_0x2569('0x2c')][_0x2569('0x2d')][_0x179399][_0x1274d8]}});}}}}return respondWithRpcPromise(_0x2569('0x3b'),{'id':_0x1035d1['params']['id'],'capacity':_0x1035d1['body'][_0x2569('0x3c')]},routingClient)[_0x2569('0x16')](respondWithResult(_0x3431ad,null))[_0x2569('0xa')](handleError(_0x3431ad,null));};exports[_0x2569('0x3d')]=function(_0xdd398a,_0x23ca7e){return respondWithRpcPromise(_0x2569('0x3e'),_0xdd398a[_0x2569('0x15')])[_0x2569('0x16')](respondWithResult(_0x23ca7e,null))[_0x2569('0xa')](handleError(_0x23ca7e,null));};exports['trunks']=function(_0x21ca81,_0x3d3209){return respondWithRpcPromise(_0x2569('0x3f'),_0x21ca81['query'])['then'](respondWithResult(_0x3d3209,null))[_0x2569('0xa')](handleError(_0x3d3209,null));};exports[_0x2569('0x40')]=function(_0x4e0509,_0x50ef55){return respondWithRpcPromise('Campaigns',_0x4e0509[_0x2569('0x15')])[_0x2569('0x16')](respondWithResult(_0x50ef55,null))[_0x2569('0xa')](handleError(_0x50ef55,null));};exports['chatQueues']=function(_0x530338,_0x1e841e){return respondWithRpcPromise('ChatQueues',_0x530338[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x1e841e,null))[_0x2569('0xa')](handleError(_0x1e841e,null));};exports[_0x2569('0x41')]=function(_0x377cb4,_0xcaa959){return respondWithRpcPromise(_0x2569('0x42'),_0x377cb4[_0x2569('0x15')],routingClient)['then'](findById(_0x377cb4['params']['id']))['then'](respondWithResult(_0xcaa959,null))['catch'](handleError(_0xcaa959,null));};exports['mailQueues']=function(_0x1efca4,_0x2eaeec){return respondWithRpcPromise('MailQueues',_0x1efca4[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x2eaeec,null))[_0x2569('0xa')](handleError(_0x2eaeec,null));};exports[_0x2569('0x43')]=function(_0x46a45e,_0x5bb597){return respondWithRpcPromise(_0x2569('0x44'),_0x46a45e['query'],routingClient)[_0x2569('0x16')](findById(_0x46a45e[_0x2569('0x1a')]['id']))[_0x2569('0x16')](respondWithResult(_0x5bb597,null))['catch'](handleError(_0x5bb597,null));};exports[_0x2569('0x45')]=function(_0x22de6f,_0x43440b){return respondWithRpcPromise(_0x2569('0x46'),_0x22de6f['query'],mailClient)[_0x2569('0x16')](respondWithResult(_0x43440b,null))['catch'](handleError(_0x43440b,null));};exports[_0x2569('0x47')]=function(_0x16b0ab,_0x5cb60f){return respondWithRpcPromise(_0x2569('0x48'),_0x16b0ab[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x5cb60f,null))[_0x2569('0xa')](handleError(_0x5cb60f,null));};exports['showOpenchannelQueues']=function(_0x59fc44,_0x1da1ba){return respondWithRpcPromise('OpenchannelQueues',_0x59fc44[_0x2569('0x15')],routingClient)[_0x2569('0x16')](findById(_0x59fc44[_0x2569('0x1a')]['id']))[_0x2569('0x16')](respondWithResult(_0x1da1ba,null))[_0x2569('0xa')](handleError(_0x1da1ba,null));};exports['smsQueues']=function(_0x2d8612,_0x5a209a){return respondWithRpcPromise(_0x2569('0x49'),_0x2d8612[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x5a209a,null))['catch'](handleError(_0x5a209a,null));};exports['showSmsQueues']=function(_0x2491e1,_0x3e3cd2){return respondWithRpcPromise(_0x2569('0x49'),_0x2491e1[_0x2569('0x15')],routingClient)['then'](findById(_0x2491e1['params']['id']))[_0x2569('0x16')](respondWithResult(_0x3e3cd2,null))['catch'](handleError(_0x3e3cd2,null));};exports[_0x2569('0x4a')]=function(_0x5862df,_0x3bc8c1){return respondWithRpcPromise(_0x2569('0x4b'),_0x5862df[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x3bc8c1,null))[_0x2569('0xa')](handleError(_0x3bc8c1,null));};exports[_0x2569('0x4c')]=function(_0xc492ad,_0x8bb04b){return respondWithRpcPromise(_0x2569('0x4b'),_0xc492ad[_0x2569('0x15')],routingClient)['then'](findById(_0xc492ad[_0x2569('0x1a')]['id']))[_0x2569('0x16')](respondWithResult(_0x8bb04b,null))[_0x2569('0xa')](handleError(_0x8bb04b,null));};exports[_0x2569('0x4d')]=function(_0x29a381,_0x541c90){return respondWithRpcPromise(_0x2569('0x4e'),_0x29a381[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x541c90,null))[_0x2569('0xa')](handleError(_0x541c90,null));};exports[_0x2569('0x4f')]=function(_0x4a20fe,_0x4bc93c){return respondWithRpcPromise(_0x2569('0x4e'),_0x4a20fe['query'],routingClient)[_0x2569('0x16')](findById(_0x4a20fe[_0x2569('0x1a')]['id']))[_0x2569('0x16')](respondWithResult(_0x4bc93c,null))[_0x2569('0xa')](handleError(_0x4bc93c,null));};exports['faxAccounts']=function(_0x291f5f,_0xb06f29){return respondWithRpcPromise(_0x2569('0x50'),_0x291f5f[_0x2569('0x15')])[_0x2569('0x16')](respondWithResult(_0xb06f29,null))[_0x2569('0xa')](handleError(_0xb06f29,null));};exports[_0x2569('0x51')]=function(_0x311847,_0x1d07b7){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x311847[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x1d07b7,null))[_0x2569('0xa')](handleError(_0x1d07b7,null));};exports[_0x2569('0x52')]=function(_0x5864e6,_0x40c03e){return respondWithRpcPromise(_0x2569('0x53'),_0x5864e6[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x40c03e,null))[_0x2569('0xa')](handleError(_0x40c03e,null));};exports[_0x2569('0x54')]=function(_0x4c306b,_0x473b7b){return respondWithRpcPromise(_0x2569('0x55'),_0x4c306b[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x473b7b,null))[_0x2569('0xa')](handleError(_0x473b7b,null));};exports[_0x2569('0x56')]=function(_0x58363f,_0x536f4f){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x58363f['query'],routingClient)['then'](respondWithResult(_0x536f4f,null))[_0x2569('0xa')](handleError(_0x536f4f,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x226b79,_0x10fa70){return respondWithRpcPromise(_0x2569('0x57'),_0x226b79[_0x2569('0x15')],routingClient)['then'](respondWithResult(_0x10fa70,null))[_0x2569('0xa')](handleError(_0x10fa70,null));};exports[_0x2569('0x58')]=function(_0x586d84,_0x5af58a){return respondWithRpcPromise(_0x2569('0x59'),_0x586d84[_0x2569('0x15')],routingClient)[_0x2569('0x16')](respondWithResult(_0x5af58a,null))[_0x2569('0xa')](handleError(_0x5af58a,null));};exports[_0x2569('0x5a')]=function(_0x1512f2){return function(_0x3d6fad,_0x16ae66){var _0x2bbae2,_0x5cc408;var _0xc74f92=_['capitalize'](_0x1512f2);var _0x3c75db=_0x1512f2===_0x2569('0x5b')?_0x2569('0x5c'):_0x2569('0x5d');return db[_0xc74f92+_0x2569('0x5e')][_0x2569('0x5f')]({'raw':!![],'where':{'id':_0x3d6fad['params']['id']}})[_0x2569('0x16')](function(_0x340692){if(_['isNil'](_0x340692)){throw new Error(_0xc74f92+'\x20Queue\x20not\x20found');}_0x2bbae2=_0x340692;return db[_0xc74f92+_0x2569('0x60')][_0x2569('0x5f')]({'where':{'id':_0x3d6fad[_0x2569('0x2c')]['messageId']},'include':[{'model':db[_0xc74f92+_0x2569('0x61')],'as':_0x2569('0x61')},{'model':db[_0xc74f92+_0x3c75db],'as':_0x2569('0x5d')}]});})[_0x2569('0x16')](function(_0x42db2e){if(_[_0x2569('0x10')](_0x42db2e)){throw new Error(_0xc74f92+_0x2569('0x62'));}_0x5cc408=_0x42db2e;return _0x42db2e[_0x2569('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2569('0x16')](function(){var _0x16adaa={'uniqueid':_0x1512f2+'.'+_0x5cc408['id']+'.'+_0x5cc408[_0x2569('0x61')]['id'],'FromUserId':_0x3d6fad[_0x2569('0x2e')]['id'],'type':_0x2569('0x64')};_0x16adaa[_0xc74f92+_0x2569('0x65')]=_0x5cc408['id'];_0x16adaa[_0xc74f92+'InteractionId']=_0x5cc408['Interaction']['id'];_0x16adaa['From'+_0xc74f92+_0x3c75db+'Id']=_0x5cc408[_0x2569('0x5d')]['id'];_0x16adaa['To'+_0xc74f92+'QueueId']=_0x2bbae2['id'];return db[_0xc74f92+_0x2569('0x66')]['create'](_0x16adaa);})[_0x2569('0x16')](function(){return respondWithRpcPromise(_0x2569('0x67'),{'channel':_0x1512f2,'interaction':_0x5cc408[_0x2569('0x61')],'message':_0x5cc408,'account':_0x5cc408['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x2569('0x64'),'appdata':_0x2bbae2[_0x2569('0xe')]+','+(_0x5cc408[_0x2569('0x5d')][_0x2569('0x68')]||0x12c),'interval':_0x2569('0x69')}]},routingClient);})['then'](respondWithResult(_0x16ae66,null))[_0x2569('0xa')](handleError(_0x16ae66,null));};};exports[_0x2569('0x6a')]=function(_0xbe81cd,_0x241aed){var _0xdefb4e,_0x5a9aa9;if(_[_0x2569('0x10')](_0xbe81cd['body'][_0x2569('0x6b')])){throw new Error(_0x2569('0x6c'));}var _0x4762ee=_0xbe81cd['body']['channel'];var _0x1558ab=_[_0x2569('0x6d')](_0x4762ee);var _0x192401=_0x4762ee==='chat'?_0x2569('0x5c'):'Account';return db['User'][_0x2569('0x5f')]({'raw':!![],'where':{'id':_0xbe81cd[_0x2569('0x1a')]['id'],'role':_0x2569('0x39')}})['then'](function(_0x400d8f){if(_[_0x2569('0x10')](_0x400d8f)){throw new Error('Agent\x20not\x20found');}_0xdefb4e=_0x400d8f;return db[_0x1558ab+'Message'][_0x2569('0x5f')]({'where':{'id':_0xbe81cd['body']['messageId']},'include':[{'model':db[_0x1558ab+_0x2569('0x61')],'as':'Interaction'},{'model':db[_0x1558ab+_0x192401],'as':'Account'}]});})[_0x2569('0x16')](function(_0x17acda){if(_[_0x2569('0x10')](_0x17acda)){throw new Error(_0x1558ab+_0x2569('0x62'));}_0x5a9aa9=_0x17acda;return _0x17acda['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x2569('0x16')](function(){var _0x450bcc={'uniqueid':_0x4762ee+'.'+_0x5a9aa9['id']+'.'+_0x5a9aa9[_0x2569('0x61')]['id'],'FromUserId':_0xbe81cd[_0x2569('0x2e')]['id'],'type':_0x2569('0x64'),'ToUserId':_0xdefb4e['id']};_0x450bcc[_0x1558ab+_0x2569('0x65')]=_0x5a9aa9['id'];_0x450bcc[_0x1558ab+'InteractionId']=_0x5a9aa9[_0x2569('0x61')]['id'];_0x450bcc[_0x2569('0x6e')+_0x1558ab+_0x192401+'Id']=_0x5a9aa9['Account']['id'];return db[_0x1558ab+_0x2569('0x66')]['create'](_0x450bcc);})[_0x2569('0x16')](function(){return respondWithRpcPromise(_0x2569('0x67'),{'channel':_0x4762ee,'interaction':_0x5a9aa9['Interaction'],'message':_0x5a9aa9,'account':_0x5a9aa9[_0x2569('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2569('0x39'),'appdata':_0xdefb4e['name']+','+(_0x5a9aa9[_0x2569('0x5d')][_0x2569('0x6f')]||0x12c),'interval':_0x2569('0x69')}]},routingClient);})[_0x2569('0x16')](respondWithResult(_0x241aed,null))[_0x2569('0xa')](handleError(_0x241aed,null));}; \ No newline at end of file +var _0x15ae=['queue','queueTransferTimeout','*,*,*,*','agentNotify','Agent\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','voiceChannels','VoiceChannels','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','showVoiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','SIP/%s','agent','internal','capacity','telephones','Telephones','trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Queue','findOne','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','Start'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x15ae,0x15d));var _0xe15a=function(_0x150b65,_0xbb6a2f){_0x150b65=_0x150b65-0x0;var _0x1194dc=_0x15ae[_0x150b65];return _0x1194dc;};'use strict';var BPromise=require(_0xe15a('0x0'));var moment=require(_0xe15a('0x1'));var _=require(_0xe15a('0x2'));var util=require(_0xe15a('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xe15a('0x4'))(_0xe15a('0x5'));var jayson=require(_0xe15a('0x6'));var amiClient=jayson[_0xe15a('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0xe15a('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xe15a('0x7')][_0xe15a('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x9a88a1,_0x4bff22,_0x17aceb){return new BPromise(function(_0x55c8f8,_0x1c9fce){var _0x328a34=_0x17aceb?_0x17aceb:amiClient;return _0x328a34[_0xe15a('0x9')](_0x9a88a1,_0x4bff22)[_0xe15a('0xa')](function(_0x2fcfab){if(_0x2fcfab[_0xe15a('0xb')]){if(_0x2fcfab[_0xe15a('0xb')][_0xe15a('0xc')]===0x1f4){return _0x1c9fce(_0x2fcfab[_0xe15a('0xb')]['message']);}return _0x55c8f8(_0x2fcfab[_0xe15a('0xb')][_0xe15a('0xd')]);}else{_0x55c8f8(_0x2fcfab[_0xe15a('0xe')]);}})[_0xe15a('0xf')](function(_0x32c20c){_0x1c9fce(_0x32c20c);});});}function respondWithResult(_0x4df2af,_0x17705c){_0x17705c=_0x17705c||0xc8;return function(_0x3108e4){if(_0x3108e4){return _0x4df2af[_0xe15a('0x10')](_0x17705c)[_0xe15a('0x11')](_0x3108e4);}return _0x4df2af[_0xe15a('0x12')](0x194);};}function handleError(_0x1b38f3,_0x54d51a){_0x54d51a=_0x54d51a||0x1f4;return function(_0x4e23b0){logger['error'](_0x4e23b0[_0xe15a('0x13')]);if(_0x4e23b0[_0xe15a('0x14')]){delete _0x4e23b0[_0xe15a('0x14')];}_0x1b38f3[_0xe15a('0x10')](_0x54d51a)[_0xe15a('0x15')](_0x4e23b0);};}function findById(_0x3807d1){return function(_0x53fce3){if(!_[_0xe15a('0x16')](_0x3807d1)&&!_[_0xe15a('0x16')](_0x53fce3)&&!_[_0xe15a('0x16')](_0x53fce3['rows'])){return _[_0xe15a('0x17')](_0x53fce3['rows'],function(_0x594ded){return _0x594ded['id']==_0x3807d1;});}return null;};}exports[_0xe15a('0x18')]=function(_0xe22a3f,_0x555434){return respondWithRpcPromise(_0xe15a('0x19'),_0xe22a3f['query'])[_0xe15a('0xa')](respondWithResult(_0x555434,null))['catch'](handleError(_0x555434,null));};exports['voiceChannelMixMonitor']=function(_0x52b665,_0x34f9fc){return respondWithRpcPromise(_0xe15a('0x1a'),_[_0xe15a('0x1b')](_0x52b665[_0xe15a('0x1c')],_0x52b665[_0xe15a('0x1d')]))[_0xe15a('0xa')](respondWithResult(_0x34f9fc,null))[_0xe15a('0xf')](handleError(_0x34f9fc,null));};exports[_0xe15a('0x1e')]=function(_0x18d698,_0x4e4389){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xe15a('0x1b')](_0x18d698['query'],_0x18d698[_0xe15a('0x1d')]))['then'](respondWithResult(_0x4e4389,null))[_0xe15a('0xf')](handleError(_0x4e4389,null));};exports['voiceQueues']=function(_0x3f2b82,_0x274099){return respondWithRpcPromise('VoiceQueues',_0x3f2b82[_0xe15a('0x1c')])[_0xe15a('0xa')](respondWithResult(_0x274099,null))[_0xe15a('0xf')](handleError(_0x274099,null));};exports[_0xe15a('0x1f')]=function(_0x11511d,_0x1a1302){return respondWithRpcPromise(_0xe15a('0x20'),_0x11511d['query'])[_0xe15a('0xa')](findById(_0x11511d[_0xe15a('0x1d')]['id']))[_0xe15a('0xa')](respondWithResult(_0x1a1302,null))['catch'](handleError(_0x1a1302,null));};exports[_0xe15a('0x21')]=function(_0x10522e,_0x524786){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xe15a('0x1b')](_0x10522e[_0xe15a('0x1c')],_0x10522e[_0xe15a('0x1d')]))['then'](respondWithResult(_0x524786,null))[_0xe15a('0xf')](handleError(_0x524786,null));};exports['voiceQueuesChannels']=function(_0x258843,_0x383e4b){return respondWithRpcPromise(_0xe15a('0x22'),_0x258843['query'])['then'](respondWithResult(_0x383e4b,null))[_0xe15a('0xf')](handleError(_0x383e4b,null));};exports[_0xe15a('0x23')]=function(_0x5cd101,_0x35a59e){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xe15a('0x1b')](_0x5cd101['query'],_0x5cd101[_0xe15a('0x1d')]))['then'](respondWithResult(_0x35a59e,null))[_0xe15a('0xf')](handleError(_0x35a59e,null));};exports[_0xe15a('0x24')]=function(_0x3441ef,_0x3308f6){return respondWithRpcPromise(_0xe15a('0x25'),_['merge'](_0x3441ef[_0xe15a('0x1c')],_0x3441ef['params']))[_0xe15a('0xa')](respondWithResult(_0x3308f6,null))['catch'](handleError(_0x3308f6,null));};exports[_0xe15a('0x26')]=function(_0x222dbb,_0x37c820){return respondWithRpcPromise(_0xe15a('0x27'),_['merge'](_0x222dbb[_0xe15a('0x1c')],_0x222dbb['params']))[_0xe15a('0xa')](respondWithResult(_0x37c820,null))[_0xe15a('0xf')](handleError(_0x37c820,null));};exports['outbound']=function(_0x173c08,_0x2a55ad){return respondWithRpcPromise(_0xe15a('0x28'),_0x173c08[_0xe15a('0x1c')])[_0xe15a('0xa')](respondWithResult(_0x2a55ad,null))[_0xe15a('0xf')](handleError(_0x2a55ad,null));};exports['outboundChannels']=function(_0x51b267,_0x1ec462){return respondWithRpcPromise('OutboundChannels',_0x51b267[_0xe15a('0x1c')])[_0xe15a('0xa')](respondWithResult(_0x1ec462,null))['catch'](handleError(_0x1ec462,null));};exports['agents']=function(_0x39228c,_0x5a0087){var _0x1fd780;return respondWithRpcPromise(_0xe15a('0x29'),_0x39228c['query'])['then'](function(_0x2e3b78){_0x1fd780=_0x2e3b78;return respondWithRpcPromise(_0xe15a('0x29'),_0x39228c[_0xe15a('0x1c')],routingClient);})[_0xe15a('0xa')](function(_0x475148){return _['merge']({},_0x475148,_0x1fd780);})['then'](respondWithResult(_0x5a0087,null))[_0xe15a('0xf')](handleError(_0x5a0087,null));};exports['agentCapacity']=function(_0x20f293,_0x384a96){if(_0x20f293[_0xe15a('0x2a')]&&_0x20f293['body'][_0xe15a('0x2b')]&&_0x20f293[_0xe15a('0x2c')]&&_0x20f293[_0xe15a('0x2c')][_0xe15a('0x14')]){for(var _0x13aaeb in _0x20f293['body'][_0xe15a('0x2b')]){if(_0x20f293['body']['interaction'][_0xe15a('0x2d')](_0x13aaeb)){db[_0xe15a('0x2e')][_0xe15a('0x2f')]({'where':{'channel':_0x13aaeb,'membername':_0x20f293[_0xe15a('0x2c')][_0xe15a('0x14')],'type':_0xe15a('0x30'),'exitAt':null,'uniqueid':_0x20f293['body'][_0xe15a('0x2b')][_0x13aaeb]&&_0x20f293[_0xe15a('0x2a')][_0xe15a('0x2b')][_0x13aaeb][_0xe15a('0x31')]?{'$notIn':_0x20f293['body'][_0xe15a('0x2b')][_0x13aaeb]}:{'$ne':null}}})[_0xe15a('0xa')](function(_0x19f1f8){var _0x534e9d=moment()[_0xe15a('0x32')](_0xe15a('0x33'));for(var _0x42ba5d=0x0,_0x25b69f=_0x19f1f8[_0xe15a('0x31')];_0x42ba5d<_0x25b69f;_0x42ba5d+=0x1){_0x19f1f8[_0x42ba5d]['updateAttributes']({'exitAt':_0x534e9d});}});for(var _0x4380d1=0x0;_0x4380d1<_0x20f293[_0xe15a('0x2a')][_0xe15a('0x2b')][_0x13aaeb][_0xe15a('0x31')];_0x4380d1+=0x1){db[_0xe15a('0x2e')]['findOrCreate']({'where':{'channel':_0x13aaeb,'membername':_0x20f293[_0xe15a('0x2c')]['name'],'type':_0xe15a('0x30'),'uniqueid':_0x20f293[_0xe15a('0x2a')][_0xe15a('0x2b')][_0x13aaeb][_0x4380d1],'exitAt':null},'defaults':{'channel':_0x13aaeb,'membername':_0x20f293[_0xe15a('0x2c')][_0xe15a('0x14')],'interface':_[_0xe15a('0x16')](_0x20f293[_0xe15a('0x2c')][_0xe15a('0x34')])?util[_0xe15a('0x32')](_0xe15a('0x35'),_0x20f293[_0xe15a('0x2c')][_0xe15a('0x14')]):_0x20f293[_0xe15a('0x2c')][_0xe15a('0x34')],'type':_0xe15a('0x30'),'enterAt':moment()[_0xe15a('0x32')](_0xe15a('0x33')),'role':_0xe15a('0x36'),'internal':_0x20f293[_0xe15a('0x2c')][_0xe15a('0x37')],'uniqueid':_0x20f293[_0xe15a('0x2a')][_0xe15a('0x2b')][_0x13aaeb][_0x4380d1]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x20f293[_0xe15a('0x1d')]['id'],'capacity':_0x20f293[_0xe15a('0x2a')][_0xe15a('0x38')]},routingClient)[_0xe15a('0xa')](respondWithResult(_0x384a96,null))['catch'](handleError(_0x384a96,null));};exports[_0xe15a('0x39')]=function(_0x1da9e9,_0x7df456){return respondWithRpcPromise(_0xe15a('0x3a'),_0x1da9e9[_0xe15a('0x1c')])[_0xe15a('0xa')](respondWithResult(_0x7df456,null))[_0xe15a('0xf')](handleError(_0x7df456,null));};exports[_0xe15a('0x3b')]=function(_0x1c4c64,_0x8ba52c){return respondWithRpcPromise('Trunks',_0x1c4c64[_0xe15a('0x1c')])[_0xe15a('0xa')](respondWithResult(_0x8ba52c,null))[_0xe15a('0xf')](handleError(_0x8ba52c,null));};exports[_0xe15a('0x3c')]=function(_0x5c6c5d,_0x48177b){return respondWithRpcPromise(_0xe15a('0x3d'),_0x5c6c5d['query'])[_0xe15a('0xa')](respondWithResult(_0x48177b,null))[_0xe15a('0xf')](handleError(_0x48177b,null));};exports['chatQueues']=function(_0x3a0192,_0x15af2c){return respondWithRpcPromise(_0xe15a('0x3e'),_0x3a0192[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](respondWithResult(_0x15af2c,null))[_0xe15a('0xf')](handleError(_0x15af2c,null));};exports[_0xe15a('0x3f')]=function(_0x134219,_0x368e9c){return respondWithRpcPromise(_0xe15a('0x3e'),_0x134219[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](findById(_0x134219['params']['id']))['then'](respondWithResult(_0x368e9c,null))[_0xe15a('0xf')](handleError(_0x368e9c,null));};exports[_0xe15a('0x40')]=function(_0x89215d,_0x1eeb27){return respondWithRpcPromise('MailQueues',_0x89215d[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](respondWithResult(_0x1eeb27,null))[_0xe15a('0xf')](handleError(_0x1eeb27,null));};exports[_0xe15a('0x41')]=function(_0x41623b,_0x236b15){return respondWithRpcPromise(_0xe15a('0x42'),_0x41623b[_0xe15a('0x1c')],routingClient)['then'](findById(_0x41623b[_0xe15a('0x1d')]['id']))[_0xe15a('0xa')](respondWithResult(_0x236b15,null))[_0xe15a('0xf')](handleError(_0x236b15,null));};exports[_0xe15a('0x43')]=function(_0x181341,_0x1a48bd){return respondWithRpcPromise(_0xe15a('0x44'),_0x181341[_0xe15a('0x1c')],mailClient)['then'](respondWithResult(_0x1a48bd,null))[_0xe15a('0xf')](handleError(_0x1a48bd,null));};exports[_0xe15a('0x45')]=function(_0x149b24,_0x4332a8){return respondWithRpcPromise(_0xe15a('0x46'),_0x149b24[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](respondWithResult(_0x4332a8,null))[_0xe15a('0xf')](handleError(_0x4332a8,null));};exports['showOpenchannelQueues']=function(_0x212341,_0x3568be){return respondWithRpcPromise(_0xe15a('0x46'),_0x212341[_0xe15a('0x1c')],routingClient)['then'](findById(_0x212341['params']['id']))[_0xe15a('0xa')](respondWithResult(_0x3568be,null))[_0xe15a('0xf')](handleError(_0x3568be,null));};exports[_0xe15a('0x47')]=function(_0xc65be6,_0x2954b0){return respondWithRpcPromise(_0xe15a('0x48'),_0xc65be6[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](respondWithResult(_0x2954b0,null))[_0xe15a('0xf')](handleError(_0x2954b0,null));};exports[_0xe15a('0x49')]=function(_0x4870e5,_0x812475){return respondWithRpcPromise('SmsQueues',_0x4870e5[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](findById(_0x4870e5['params']['id']))[_0xe15a('0xa')](respondWithResult(_0x812475,null))[_0xe15a('0xf')](handleError(_0x812475,null));};exports[_0xe15a('0x4a')]=function(_0x15d008,_0x14013c){return respondWithRpcPromise('WhatsappQueues',_0x15d008['query'],routingClient)['then'](respondWithResult(_0x14013c,null))[_0xe15a('0xf')](handleError(_0x14013c,null));};exports[_0xe15a('0x4b')]=function(_0x3eb769,_0x671f2a){return respondWithRpcPromise(_0xe15a('0x4c'),_0x3eb769[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](findById(_0x3eb769[_0xe15a('0x1d')]['id']))[_0xe15a('0xa')](respondWithResult(_0x671f2a,null))[_0xe15a('0xf')](handleError(_0x671f2a,null));};exports[_0xe15a('0x4d')]=function(_0x1cf1ee,_0x2087aa){return respondWithRpcPromise('FaxQueues',_0x1cf1ee[_0xe15a('0x1c')],routingClient)['then'](respondWithResult(_0x2087aa,null))[_0xe15a('0xf')](handleError(_0x2087aa,null));};exports[_0xe15a('0x4e')]=function(_0x2806a8,_0x41b4d9){return respondWithRpcPromise('FaxQueues',_0x2806a8[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](findById(_0x2806a8[_0xe15a('0x1d')]['id']))[_0xe15a('0xa')](respondWithResult(_0x41b4d9,null))[_0xe15a('0xf')](handleError(_0x41b4d9,null));};exports[_0xe15a('0x4f')]=function(_0x84003b,_0x1e7fdd){return respondWithRpcPromise('FaxAccounts',_0x84003b['query'])[_0xe15a('0xa')](respondWithResult(_0x1e7fdd,null))['catch'](handleError(_0x1e7fdd,null));};exports['chatQueuesWaitingInteractions']=function(_0x46e6dc,_0x140583){return respondWithRpcPromise(_0xe15a('0x50'),_0x46e6dc['query'],routingClient)[_0xe15a('0xa')](respondWithResult(_0x140583,null))[_0xe15a('0xf')](handleError(_0x140583,null));};exports[_0xe15a('0x51')]=function(_0xf4dc4e,_0x422a08){return respondWithRpcPromise(_0xe15a('0x52'),_0xf4dc4e[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](respondWithResult(_0x422a08,null))[_0xe15a('0xf')](handleError(_0x422a08,null));};exports[_0xe15a('0x53')]=function(_0x583fea,_0x5b495d){return respondWithRpcPromise(_0xe15a('0x54'),_0x583fea[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](respondWithResult(_0x5b495d,null))['catch'](handleError(_0x5b495d,null));};exports[_0xe15a('0x55')]=function(_0x3b914a,_0x5d6874){return respondWithRpcPromise(_0xe15a('0x56'),_0x3b914a[_0xe15a('0x1c')],routingClient)['then'](respondWithResult(_0x5d6874,null))[_0xe15a('0xf')](handleError(_0x5d6874,null));};exports[_0xe15a('0x57')]=function(_0x4a66c7,_0x1fe6cf){return respondWithRpcPromise(_0xe15a('0x58'),_0x4a66c7[_0xe15a('0x1c')],routingClient)[_0xe15a('0xa')](respondWithResult(_0x1fe6cf,null))[_0xe15a('0xf')](handleError(_0x1fe6cf,null));};exports[_0xe15a('0x59')]=function(_0x26b494,_0x3d92da){return respondWithRpcPromise(_0xe15a('0x5a'),_0x26b494['query'],routingClient)['then'](respondWithResult(_0x3d92da,null))['catch'](handleError(_0x3d92da,null));};exports['queueNotify']=function(_0x257d4a){return function(_0x2ea253,_0x3cc67b){var _0x4afb0f,_0x49d5c3;var _0xe52bd7=_[_0xe15a('0x5b')](_0x257d4a);var _0x3ad050=_0x257d4a===_0xe15a('0x5c')?_0xe15a('0x5d'):'Account';return db[_0xe52bd7+_0xe15a('0x5e')][_0xe15a('0x5f')]({'raw':!![],'where':{'id':_0x2ea253['params']['id']}})[_0xe15a('0xa')](function(_0x42a442){if(_[_0xe15a('0x16')](_0x42a442)){throw new Error(_0xe52bd7+'\x20Queue\x20not\x20found');}_0x4afb0f=_0x42a442;return db[_0xe52bd7+_0xe15a('0x60')][_0xe15a('0x5f')]({'where':{'id':_0x2ea253[_0xe15a('0x2a')][_0xe15a('0x61')]},'include':[{'model':db[_0xe52bd7+_0xe15a('0x62')],'as':'Interaction'},{'model':db[_0xe52bd7+_0x3ad050],'as':_0xe15a('0x63')}]});})['then'](function(_0x39100b){if(_[_0xe15a('0x16')](_0x39100b)){throw new Error(_0xe52bd7+_0xe15a('0x64'));}_0x49d5c3=_0x39100b;return _0x39100b['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xe15a('0xa')](function(){var _0x3c86e9={'uniqueid':_0x257d4a+'.'+_0x49d5c3['id']+'.'+_0x49d5c3[_0xe15a('0x62')]['id'],'FromUserId':_0x2ea253['user']['id'],'type':'queue'};_0x3c86e9[_0xe52bd7+_0xe15a('0x65')]=_0x49d5c3['id'];_0x3c86e9[_0xe52bd7+_0xe15a('0x66')]=_0x49d5c3[_0xe15a('0x62')]['id'];_0x3c86e9[_0xe15a('0x67')+_0xe52bd7+_0x3ad050+'Id']=_0x49d5c3[_0xe15a('0x63')]['id'];_0x3c86e9['To'+_0xe52bd7+_0xe15a('0x68')]=_0x4afb0f['id'];return db[_0xe52bd7+_0xe15a('0x69')]['create'](_0x3c86e9);})[_0xe15a('0xa')](function(){return respondWithRpcPromise(_0xe15a('0x6a'),{'channel':_0x257d4a,'interaction':_0x49d5c3['Interaction'],'message':_0x49d5c3,'account':_0x49d5c3['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xe15a('0x6b'),'appdata':_0x4afb0f['name']+','+(_0x49d5c3[_0xe15a('0x63')][_0xe15a('0x6c')]||0x12c),'interval':_0xe15a('0x6d')}]},routingClient);})['then'](respondWithResult(_0x3cc67b,null))[_0xe15a('0xf')](handleError(_0x3cc67b,null));};};exports[_0xe15a('0x6e')]=function(_0x3e9543,_0x517c45){var _0x536871,_0x595d35;if(_['isNil'](_0x3e9543[_0xe15a('0x2a')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x53553e=_0x3e9543[_0xe15a('0x2a')]['channel'];var _0x4802bc=_[_0xe15a('0x5b')](_0x53553e);var _0x2c821f=_0x53553e===_0xe15a('0x5c')?_0xe15a('0x5d'):_0xe15a('0x63');return db['User'][_0xe15a('0x5f')]({'raw':!![],'where':{'id':_0x3e9543[_0xe15a('0x1d')]['id'],'role':_0xe15a('0x36')}})[_0xe15a('0xa')](function(_0x3ce24e){if(_[_0xe15a('0x16')](_0x3ce24e)){throw new Error(_0xe15a('0x6f'));}_0x536871=_0x3ce24e;return db[_0x4802bc+'Message'][_0xe15a('0x5f')]({'where':{'id':_0x3e9543[_0xe15a('0x2a')][_0xe15a('0x61')]},'include':[{'model':db[_0x4802bc+_0xe15a('0x62')],'as':_0xe15a('0x62')},{'model':db[_0x4802bc+_0x2c821f],'as':_0xe15a('0x63')}]});})['then'](function(_0x12b29f){if(_[_0xe15a('0x16')](_0x12b29f)){throw new Error(_0x4802bc+_0xe15a('0x64'));}_0x595d35=_0x12b29f;return _0x12b29f[_0xe15a('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe15a('0xa')](function(){var _0x1c4682={'uniqueid':_0x53553e+'.'+_0x595d35['id']+'.'+_0x595d35[_0xe15a('0x62')]['id'],'FromUserId':_0x3e9543[_0xe15a('0x2c')]['id'],'type':_0xe15a('0x6b'),'ToUserId':_0x536871['id']};_0x1c4682[_0x4802bc+'MessageId']=_0x595d35['id'];_0x1c4682[_0x4802bc+_0xe15a('0x66')]=_0x595d35[_0xe15a('0x62')]['id'];_0x1c4682[_0xe15a('0x67')+_0x4802bc+_0x2c821f+'Id']=_0x595d35[_0xe15a('0x63')]['id'];return db[_0x4802bc+_0xe15a('0x69')]['create'](_0x1c4682);})[_0xe15a('0xa')](function(){return respondWithRpcPromise(_0xe15a('0x6a'),{'channel':_0x53553e,'interaction':_0x595d35['Interaction'],'message':_0x595d35,'account':_0x595d35['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xe15a('0x36'),'appdata':_0x536871[_0xe15a('0x14')]+','+(_0x595d35[_0xe15a('0x63')][_0xe15a('0x71')]||0x12c),'interval':_0xe15a('0x6d')}]},routingClient);})[_0xe15a('0xa')](respondWithResult(_0x517c45,null))[_0xe15a('0xf')](handleError(_0x517c45,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 34ef388..7d302b1 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 _0x2ea1=['get','isAuthenticated','/:id','show','/:id/run','run','post','create','put','update','destroy','util','Router','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x2ea1,0x6b));var _0x12ea=function(_0x2624df,_0x2ee33c){_0x2624df=_0x2624df-0x0;var _0x47fc43=_0x2ea1[_0x2624df];return _0x47fc43;};'use strict';var multer=require('multer');var util=require(_0x12ea('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x12ea('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x12ea('0x2'));var config=require(_0x12ea('0x3'));var controller=require(_0x12ea('0x4'));router[_0x12ea('0x5')]('/',auth[_0x12ea('0x6')](),controller['index']);router['get'](_0x12ea('0x7'),auth[_0x12ea('0x6')](),controller[_0x12ea('0x8')]);router['get'](_0x12ea('0x9'),auth['isAuthenticated'](),controller[_0x12ea('0xa')]);router[_0x12ea('0xb')]('/',auth[_0x12ea('0x6')](),controller[_0x12ea('0xc')]);router[_0x12ea('0xd')](_0x12ea('0x7'),auth[_0x12ea('0x6')](),controller[_0x12ea('0xe')]);router['delete'](_0x12ea('0x7'),auth[_0x12ea('0x6')](),controller[_0x12ea('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfeb8=['delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/run','run','post','put','/:id','update'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xfeb8,0x6f));var _0x8feb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfeb8[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8feb('0x0'));var util=require('util');var path=require(_0x8feb('0x1'));var timeout=require(_0x8feb('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x8feb('0x3'));var interaction=require(_0x8feb('0x4'));var config=require(_0x8feb('0x5'));var controller=require('./schedule.controller');router[_0x8feb('0x6')]('/',auth[_0x8feb('0x7')](),controller['index']);router[_0x8feb('0x6')]('/:id',auth[_0x8feb('0x7')](),controller[_0x8feb('0x8')]);router[_0x8feb('0x6')](_0x8feb('0x9'),auth[_0x8feb('0x7')](),controller[_0x8feb('0xa')]);router[_0x8feb('0xb')]('/',auth[_0x8feb('0x7')](),controller['create']);router[_0x8feb('0xc')](_0x8feb('0xd'),auth[_0x8feb('0x7')](),controller[_0x8feb('0xe')]);router[_0x8feb('0xf')](_0x8feb('0xd'),auth[_0x8feb('0x7')](),controller[_0x8feb('0x10')]);module[_0x8feb('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 653f194..cd586ca 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 _0xf446=['xlsx','csv','custom','default','BOOLEAN','TEXT','sequelize','STRING','DATE','ENUM','weeks','hours','pdf'];(function(_0x88a132,_0x165669){var _0x31c2d9=function(_0x32d217){while(--_0x32d217){_0x88a132['push'](_0x88a132['shift']());}};_0x31c2d9(++_0x165669);}(_0xf446,0x1c0));var _0x6f44=function(_0x1778ff,_0x25bdf1){_0x1778ff=_0x1778ff-0x0;var _0x50d3=_0xf446[_0x1778ff];return _0x50d3;};'use strict';var Sequelize=require(_0x6f44('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f44('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6f44('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6f44('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x6f44('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0x6f44('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6f44('0x3')]('years','quarters','months',_0x6f44('0x4'),'days',_0x6f44('0x5'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x6f44('0x3')]('csv',_0x6f44('0x6'),_0x6f44('0x7')),'allowNull':![],'defaultValue':_0x6f44('0x8')},'type':{'type':Sequelize[_0x6f44('0x3')](_0x6f44('0x9'),_0x6f44('0xa')),'allowNull':![],'defaultValue':_0x6f44('0x9')},'sendMail':{'type':Sequelize[_0x6f44('0xb')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6f44('0xc')]},'bcc':{'type':Sequelize[_0x6f44('0xc')]},'sendIfEmpty':{'type':Sequelize[_0x6f44('0xb')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0650=['DATE','INTEGER','ENUM','months','days','csv','pdf','custom','BOOLEAN','TEXT','sequelize','exports','STRING'];(function(_0x4321a6,_0x502ae4){var _0x11b3a8=function(_0x3c619d){while(--_0x3c619d){_0x4321a6['push'](_0x4321a6['shift']());}};_0x11b3a8(++_0x502ae4);}(_0x0650,0x1aa));var _0x0065=function(_0x4c42c8,_0x326182){_0x4c42c8=_0x4c42c8-0x0;var _0x474b68=_0x0650[_0x4c42c8];return _0x474b68;};'use strict';var Sequelize=require(_0x0065('0x0'));module[_0x0065('0x1')]={'name':{'type':Sequelize[_0x0065('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0065('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0065('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x0065('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0065('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0065('0x5')]('years','quarters',_0x0065('0x6'),'weeks','days','hours','minutes'),'allowNull':![],'defaultValue':_0x0065('0x7')},'output':{'type':Sequelize['ENUM'](_0x0065('0x8'),_0x0065('0x9'),'xlsx'),'allowNull':![],'defaultValue':_0x0065('0x8')},'type':{'type':Sequelize[_0x0065('0x5')]('custom','default'),'allowNull':![],'defaultValue':_0x0065('0xa')},'sendMail':{'type':Sequelize[_0x0065('0xb')],'defaultValue':![]},'email':{'type':Sequelize[_0x0065('0x2')]},'cc':{'type':Sequelize[_0x0065('0xc')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c87e1d6..0a434bc 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 _0x08e1=['model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','name','filter','options','count','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','../../config/schedule','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','destroy','then','Scheduler','UserProfileResource','error','send','index','map','Schedule','rawAttributes','type','key'];(function(_0x1f26c1,_0x3ce23e){var _0x4141cd=function(_0x177085){while(--_0x177085){_0x1f26c1['push'](_0x1f26c1['shift']());}};_0x4141cd(++_0x3ce23e);}(_0x08e1,0x1b4));var _0x108e=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0x08e1[_0x15f3c0];return _0x1adfe0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x108e('0x0'));var jsonpatch=require(_0x108e('0x1'));var rp=require('request-promise');var moment=require(_0x108e('0x2'));var BPromise=require(_0x108e('0x3'));var Mustache=require('mustache');var util=require(_0x108e('0x4'));var path=require(_0x108e('0x5'));var sox=require(_0x108e('0x6'));var csv=require(_0x108e('0x7'));var ejs=require(_0x108e('0x8'));var fs=require('fs');var _=require(_0x108e('0x9'));var squel=require(_0x108e('0xa'));var crypto=require(_0x108e('0xb'));var jsforce=require(_0x108e('0xc'));var deskjs=require(_0x108e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x108e('0xe'));var Papa=require(_0x108e('0xf'));var Redis=require('ioredis');var authService=require(_0x108e('0x10'));var qs=require(_0x108e('0x11'));var as=require(_0x108e('0x12'));var hardwareService=require(_0x108e('0x13'));var logger=require(_0x108e('0x14'))(_0x108e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x108e('0x16'))['db'];function respondWithStatusCode(_0x4b7b18,_0xc06a3e){_0xc06a3e=_0xc06a3e||0xcc;return function(_0x5366fd){if(_0x5366fd){return _0x4b7b18[_0x108e('0x17')](_0xc06a3e);}return _0x4b7b18[_0x108e('0x18')](_0xc06a3e)[_0x108e('0x19')]();};}function respondWithResult(_0x547888,_0x263f04){_0x263f04=_0x263f04||0xc8;return function(_0x1bfa48){if(_0x1bfa48){return _0x547888[_0x108e('0x18')](_0x263f04)[_0x108e('0x1a')](_0x1bfa48);}};}function respondWithFilteredResult(_0x24e0d9,_0x482dfe){return function(_0x112cab){if(_0x112cab){var _0x238a11=_0x112cab['count'],_0x1e3284=_0x482dfe[_0x108e('0x1b')],_0x1bc748=_0x482dfe[_0x108e('0x1b')]+_0x482dfe[_0x108e('0x1c')],_0x2eec6e;if(_0x1bc748>=_0x238a11){_0x1bc748=_0x238a11;_0x2eec6e=0xc8;}else{_0x2eec6e=0xce;}_0x24e0d9[_0x108e('0x18')](_0x2eec6e);return _0x24e0d9[_0x108e('0x1d')](_0x108e('0x1e'),_0x1e3284+'-'+_0x1bc748+'/'+_0x238a11)['json'](_0x112cab);}return null;};}function patchUpdates(_0x2a21ab){return function(_0x233073){try{jsonpatch['apply'](_0x233073,_0x2a21ab,!![]);}catch(_0x4d6f20){return BPromise['reject'](_0x4d6f20);}return _0x233073[_0x108e('0x1f')]();};}function saveUpdates(_0x50f311,_0x11e629){return function(_0xc51c60){if(_0xc51c60){return _0xc51c60['update'](_0x50f311)['then'](function(_0x15ca07){return _0x15ca07;});}return null;};}function removeEntity(_0x2af5d3,_0x3b81d3){return function(_0x266404){if(_0x266404){return _0x266404[_0x108e('0x20')]()[_0x108e('0x21')](function(){var _0x3a0f25=_0x266404['get']({'plain':!![]});var _0x43479c=_0x108e('0x22');return db[_0x108e('0x23')][_0x108e('0x20')]({'where':{'type':_0x43479c,'resourceId':_0x3a0f25['id']}})[_0x108e('0x21')](function(){return _0x266404;});})[_0x108e('0x21')](function(){_0x2af5d3[_0x108e('0x18')](0xcc)[_0x108e('0x19')]();});}};}function handleEntityNotFound(_0x46fefa,_0x4a35e0){return function(_0x5a8b07){if(!_0x5a8b07){_0x46fefa[_0x108e('0x17')](0x194);}return _0x5a8b07;};}function handleError(_0x584d94,_0x565954){_0x565954=_0x565954||0x1f4;return function(_0x331c4b){logger[_0x108e('0x24')](_0x331c4b['stack']);if(_0x331c4b['name']){delete _0x331c4b['name'];}_0x584d94[_0x108e('0x18')](_0x565954)[_0x108e('0x25')](_0x331c4b);};}exports[_0x108e('0x26')]=function(_0x5aadc9,_0x2b1232){var _0x4af043={},_0x503177={},_0x2ca347={'count':0x0,'rows':[]};var _0xa33885=_[_0x108e('0x27')](db[_0x108e('0x28')][_0x108e('0x29')],function(_0x216267){return{'name':_0x216267['fieldName'],'type':_0x216267[_0x108e('0x2a')][_0x108e('0x2b')]};});_0x503177[_0x108e('0x2c')]=_[_0x108e('0x27')](_0xa33885,'name');_0x503177['query']=_[_0x108e('0x2d')](_0x5aadc9[_0x108e('0x2e')]);_0x503177['filters']=_[_0x108e('0x2f')](_0x503177[_0x108e('0x2c')],_0x503177[_0x108e('0x2e')]);_0x4af043[_0x108e('0x30')]=_['intersection'](_0x503177[_0x108e('0x2c')],qs['fields'](_0x5aadc9[_0x108e('0x2e')][_0x108e('0x31')]));_0x4af043['attributes']=_0x4af043[_0x108e('0x30')][_0x108e('0x32')]?_0x4af043[_0x108e('0x30')]:_0x503177['model'];if(!_0x5aadc9[_0x108e('0x2e')][_0x108e('0x33')](_0x108e('0x34'))){_0x4af043[_0x108e('0x1c')]=qs[_0x108e('0x1c')](_0x5aadc9['query'][_0x108e('0x1c')]);_0x4af043['offset']=qs['offset'](_0x5aadc9[_0x108e('0x2e')]['offset']);}_0x4af043[_0x108e('0x35')]=qs['sort'](_0x5aadc9['query']['sort']);_0x4af043[_0x108e('0x36')]=qs[_0x108e('0x37')](_['pick'](_0x5aadc9['query'],_0x503177[_0x108e('0x37')]),_0xa33885);if(_0x5aadc9['query']['filter']){_0x4af043['where']=_[_0x108e('0x38')](_0x4af043[_0x108e('0x36')],{'$or':_[_0x108e('0x27')](_0xa33885,function(_0x207276){if(_0x207276[_0x108e('0x2a')]!==_0x108e('0x39')){var _0x513fd1={};_0x513fd1[_0x207276[_0x108e('0x3a')]]={'$like':'%'+_0x5aadc9[_0x108e('0x2e')][_0x108e('0x3b')]+'%'};return _0x513fd1;}})});}_0x4af043=_['merge']({},_0x4af043,_0x5aadc9[_0x108e('0x3c')]);var _0x4afc21={'where':_0x4af043['where']};return db[_0x108e('0x28')][_0x108e('0x3d')](_0x4afc21)[_0x108e('0x21')](function(_0x442f1e){_0x2ca347[_0x108e('0x3d')]=_0x442f1e;if(_0x5aadc9['query']['includeAll']){_0x4af043[_0x108e('0x3e')]=[{'all':!![]}];}return db[_0x108e('0x28')][_0x108e('0x3f')](_0x4af043);})[_0x108e('0x21')](function(_0x428c1d){_0x2ca347[_0x108e('0x40')]=_0x428c1d;return _0x2ca347;})[_0x108e('0x21')](respondWithFilteredResult(_0x2b1232,_0x4af043))[_0x108e('0x41')](handleError(_0x2b1232,null));};exports['show']=function(_0xd98645,_0x4feb5b){var _0x127784={'raw':![],'where':{'id':_0xd98645[_0x108e('0x42')]['id']}},_0x2ee810={};_0x2ee810[_0x108e('0x2c')]=_['keys'](db['Schedule'][_0x108e('0x29')]);_0x2ee810[_0x108e('0x2e')]=_[_0x108e('0x2d')](_0xd98645[_0x108e('0x2e')]);_0x2ee810[_0x108e('0x37')]=_['intersection'](_0x2ee810[_0x108e('0x2c')],_0x2ee810[_0x108e('0x2e')]);_0x127784['attributes']=_[_0x108e('0x2f')](_0x2ee810[_0x108e('0x2c')],qs[_0x108e('0x31')](_0xd98645[_0x108e('0x2e')][_0x108e('0x31')]));_0x127784['attributes']=_0x127784[_0x108e('0x30')][_0x108e('0x32')]?_0x127784[_0x108e('0x30')]:_0x2ee810[_0x108e('0x2c')];if(_0xd98645[_0x108e('0x2e')]['includeAll']){_0x127784[_0x108e('0x3e')]=[{'all':!![]}];}_0x127784=_['merge']({},_0x127784,_0xd98645[_0x108e('0x3c')]);return db[_0x108e('0x28')][_0x108e('0x43')](_0x127784)[_0x108e('0x21')](handleEntityNotFound(_0x4feb5b,null))[_0x108e('0x21')](respondWithResult(_0x4feb5b,null))[_0x108e('0x41')](handleError(_0x4feb5b,null));};exports[_0x108e('0x44')]=function(_0x35edd,_0x2ffb92){return db[_0x108e('0x28')][_0x108e('0x44')](_0x35edd['body'],{})[_0x108e('0x21')](function(_0x55fb56){var _0x588519=_0x35edd['user']['get']({'plain':!![]});if(!_0x588519)throw new Error(_0x108e('0x45'));if(_0x588519[_0x108e('0x46')]===_0x108e('0x47')){var _0x24b49b=_0x55fb56[_0x108e('0x48')]({'plain':!![]});var _0x58fa64='Scheduler';return db[_0x108e('0x49')][_0x108e('0x43')]({'where':{'name':_0x58fa64,'userProfileId':_0x588519[_0x108e('0x4a')]},'raw':!![]})[_0x108e('0x21')](function(_0x26ce13){if(_0x26ce13&&_0x26ce13['autoAssociation']===0x0){return db[_0x108e('0x23')][_0x108e('0x44')]({'name':_0x24b49b[_0x108e('0x3a')],'resourceId':_0x24b49b['id'],'type':_0x26ce13[_0x108e('0x3a')],'sectionId':_0x26ce13['id']},{})[_0x108e('0x21')](function(){return _0x55fb56;});}else{return _0x55fb56;}})['catch'](function(_0x5a2a45){logger['error'](_0x108e('0x4b'),_0x5a2a45);throw _0x5a2a45;});}return _0x55fb56;})[_0x108e('0x21')](respondWithResult(_0x2ffb92,0xc9))[_0x108e('0x41')](handleError(_0x2ffb92,null));};exports[_0x108e('0x4c')]=function(_0x232545,_0x474ad6){if(_0x232545[_0x108e('0x4d')]['id']){delete _0x232545[_0x108e('0x4d')]['id'];}return db[_0x108e('0x28')][_0x108e('0x43')]({'where':{'id':_0x232545[_0x108e('0x42')]['id']}})[_0x108e('0x21')](handleEntityNotFound(_0x474ad6,null))[_0x108e('0x21')](saveUpdates(_0x232545[_0x108e('0x4d')],null))[_0x108e('0x21')](respondWithResult(_0x474ad6,null))['catch'](handleError(_0x474ad6,null));};exports[_0x108e('0x20')]=function(_0x3f5217,_0x50aeba){return db[_0x108e('0x28')]['find']({'where':{'id':_0x3f5217[_0x108e('0x42')]['id']}})[_0x108e('0x21')](handleEntityNotFound(_0x50aeba,null))[_0x108e('0x21')](removeEntity(_0x50aeba,null))[_0x108e('0x41')](handleError(_0x50aeba,null));};exports[_0x108e('0x4e')]=function(_0x1d549b,_0x544e00,_0x5244e5){var _0x5065e2=require(_0x108e('0x4f'));return db[_0x108e('0x28')][_0x108e('0x43')]({'where':{'id':_0x1d549b[_0x108e('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x544e00,null))[_0x108e('0x21')](function(){_0x5065e2[_0x108e('0x4e')](_0x1d549b[_0x108e('0x42')]['id']);})['then'](respondWithStatusCode(_0x544e00,null))[_0x108e('0x41')](handleError(_0x544e00,null));}; \ No newline at end of file +var _0xaa7f=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','get','sendStatus','error','stack','name','send','index','Schedule'];(function(_0x12b7af,_0x4a6133){var _0x3504a0=function(_0x2e2227){while(--_0x2e2227){_0x12b7af['push'](_0x12b7af['shift']());}};_0x3504a0(++_0x4a6133);}(_0xaa7f,0x19c));var _0xfaa7=function(_0x785d45,_0x2b02a7){_0x785d45=_0x785d45-0x0;var _0x57b012=_0xaa7f[_0x785d45];return _0x57b012;};'use strict';var pdf=require(_0xfaa7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfaa7('0x1'));var zipdir=require(_0xfaa7('0x2'));var jsonpatch=require(_0xfaa7('0x3'));var rp=require(_0xfaa7('0x4'));var moment=require(_0xfaa7('0x5'));var BPromise=require(_0xfaa7('0x6'));var Mustache=require(_0xfaa7('0x7'));var util=require(_0xfaa7('0x8'));var path=require(_0xfaa7('0x9'));var sox=require(_0xfaa7('0xa'));var csv=require('to-csv');var ejs=require(_0xfaa7('0xb'));var fs=require('fs');var _=require(_0xfaa7('0xc'));var squel=require(_0xfaa7('0xd'));var crypto=require(_0xfaa7('0xe'));var jsforce=require(_0xfaa7('0xf'));var deskjs=require(_0xfaa7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfaa7('0x11'));var Papa=require(_0xfaa7('0x12'));var Redis=require(_0xfaa7('0x13'));var authService=require(_0xfaa7('0x14'));var qs=require(_0xfaa7('0x15'));var as=require(_0xfaa7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfaa7('0x17'))(_0xfaa7('0x18'));var utils=require(_0xfaa7('0x19'));var config=require('../../config/environment');var db=require(_0xfaa7('0x1a'))['db'];function respondWithStatusCode(_0xbf709f,_0x19ab0b){_0x19ab0b=_0x19ab0b||0xcc;return function(_0x56ee30){if(_0x56ee30){return _0xbf709f['sendStatus'](_0x19ab0b);}return _0xbf709f['status'](_0x19ab0b)[_0xfaa7('0x1b')]();};}function respondWithResult(_0x2bea3a,_0x50d704){_0x50d704=_0x50d704||0xc8;return function(_0x231a49){if(_0x231a49){return _0x2bea3a['status'](_0x50d704)[_0xfaa7('0x1c')](_0x231a49);}};}function respondWithFilteredResult(_0x2cfa69,_0x50a447){return function(_0xcc04a1){if(_0xcc04a1){var _0x5a941e=_0xcc04a1[_0xfaa7('0x1d')],_0x583c77=_0x50a447[_0xfaa7('0x1e')],_0x14345a=_0x50a447[_0xfaa7('0x1e')]+_0x50a447[_0xfaa7('0x1f')],_0x1fefb0;if(_0x14345a>=_0x5a941e){_0x14345a=_0x5a941e;_0x1fefb0=0xc8;}else{_0x1fefb0=0xce;}_0x2cfa69[_0xfaa7('0x20')](_0x1fefb0);return _0x2cfa69[_0xfaa7('0x21')](_0xfaa7('0x22'),_0x583c77+'-'+_0x14345a+'/'+_0x5a941e)['json'](_0xcc04a1);}return null;};}function patchUpdates(_0x33d9a8){return function(_0x5dedf6){try{jsonpatch[_0xfaa7('0x23')](_0x5dedf6,_0x33d9a8,!![]);}catch(_0x1eeaa6){return BPromise[_0xfaa7('0x24')](_0x1eeaa6);}return _0x5dedf6[_0xfaa7('0x25')]();};}function saveUpdates(_0x5b56b4,_0x30d872){return function(_0x501802){if(_0x501802){return _0x501802['update'](_0x5b56b4)[_0xfaa7('0x26')](function(_0x465631){return _0x465631;});}return null;};}function removeEntity(_0x319a62,_0x2a0e16){return function(_0x33bb53){if(_0x33bb53){return _0x33bb53[_0xfaa7('0x27')]()[_0xfaa7('0x26')](function(){var _0x13b033=_0x33bb53[_0xfaa7('0x28')]({'plain':!![]});var _0x472559='Scheduler';return db['UserProfileResource'][_0xfaa7('0x27')]({'where':{'type':_0x472559,'resourceId':_0x13b033['id']}})[_0xfaa7('0x26')](function(){return _0x33bb53;});})['then'](function(){_0x319a62[_0xfaa7('0x20')](0xcc)[_0xfaa7('0x1b')]();});}};}function handleEntityNotFound(_0xdddace,_0x1671de){return function(_0x379131){if(!_0x379131){_0xdddace[_0xfaa7('0x29')](0x194);}return _0x379131;};}function handleError(_0x1ced27,_0x57e451){_0x57e451=_0x57e451||0x1f4;return function(_0x33b43a){logger[_0xfaa7('0x2a')](_0x33b43a[_0xfaa7('0x2b')]);if(_0x33b43a[_0xfaa7('0x2c')]){delete _0x33b43a[_0xfaa7('0x2c')];}_0x1ced27[_0xfaa7('0x20')](_0x57e451)[_0xfaa7('0x2d')](_0x33b43a);};}exports[_0xfaa7('0x2e')]=function(_0x2ce1bd,_0x1491c7){var _0x3fd802={},_0x51016b={},_0x51a505={'count':0x0,'rows':[]};var _0x3cf8ac=_['map'](db[_0xfaa7('0x2f')][_0xfaa7('0x30')],function(_0x5d353e){return{'name':_0x5d353e[_0xfaa7('0x31')],'type':_0x5d353e[_0xfaa7('0x32')][_0xfaa7('0x33')]};});_0x51016b[_0xfaa7('0x34')]=_['map'](_0x3cf8ac,'name');_0x51016b[_0xfaa7('0x35')]=_[_0xfaa7('0x36')](_0x2ce1bd[_0xfaa7('0x35')]);_0x51016b[_0xfaa7('0x37')]=_[_0xfaa7('0x38')](_0x51016b[_0xfaa7('0x34')],_0x51016b[_0xfaa7('0x35')]);_0x3fd802['attributes']=_[_0xfaa7('0x38')](_0x51016b['model'],qs[_0xfaa7('0x39')](_0x2ce1bd[_0xfaa7('0x35')][_0xfaa7('0x39')]));_0x3fd802[_0xfaa7('0x3a')]=_0x3fd802[_0xfaa7('0x3a')]['length']?_0x3fd802[_0xfaa7('0x3a')]:_0x51016b[_0xfaa7('0x34')];if(!_0x2ce1bd[_0xfaa7('0x35')][_0xfaa7('0x3b')](_0xfaa7('0x3c'))){_0x3fd802[_0xfaa7('0x1f')]=qs['limit'](_0x2ce1bd['query'][_0xfaa7('0x1f')]);_0x3fd802[_0xfaa7('0x1e')]=qs[_0xfaa7('0x1e')](_0x2ce1bd[_0xfaa7('0x35')][_0xfaa7('0x1e')]);}_0x3fd802[_0xfaa7('0x3d')]=qs[_0xfaa7('0x3e')](_0x2ce1bd[_0xfaa7('0x35')][_0xfaa7('0x3e')]);_0x3fd802['where']=qs['filters'](_[_0xfaa7('0x3f')](_0x2ce1bd[_0xfaa7('0x35')],_0x51016b['filters']),_0x3cf8ac);if(_0x2ce1bd[_0xfaa7('0x35')][_0xfaa7('0x40')]){_0x3fd802['where']=_[_0xfaa7('0x41')](_0x3fd802[_0xfaa7('0x42')],{'$or':_[_0xfaa7('0x43')](_0x3cf8ac,function(_0x2f68e1){if(_0x2f68e1[_0xfaa7('0x32')]!==_0xfaa7('0x44')){var _0x655180={};_0x655180[_0x2f68e1[_0xfaa7('0x2c')]]={'$like':'%'+_0x2ce1bd[_0xfaa7('0x35')][_0xfaa7('0x40')]+'%'};return _0x655180;}})});}_0x3fd802=_[_0xfaa7('0x41')]({},_0x3fd802,_0x2ce1bd[_0xfaa7('0x45')]);var _0xe87cb9={'where':_0x3fd802['where']};return db['Schedule'][_0xfaa7('0x1d')](_0xe87cb9)['then'](function(_0x5f4e72){_0x51a505['count']=_0x5f4e72;if(_0x2ce1bd[_0xfaa7('0x35')]['includeAll']){_0x3fd802[_0xfaa7('0x46')]=[{'all':!![]}];}return db['Schedule'][_0xfaa7('0x47')](_0x3fd802);})[_0xfaa7('0x26')](function(_0x5e0d7a){_0x51a505[_0xfaa7('0x48')]=_0x5e0d7a;return _0x51a505;})['then'](respondWithFilteredResult(_0x1491c7,_0x3fd802))[_0xfaa7('0x49')](handleError(_0x1491c7,null));};exports[_0xfaa7('0x4a')]=function(_0x27eeab,_0x430d08){var _0x299fa7={'raw':![],'where':{'id':_0x27eeab[_0xfaa7('0x4b')]['id']}},_0x55a1e4={};_0x55a1e4[_0xfaa7('0x34')]=_[_0xfaa7('0x36')](db[_0xfaa7('0x2f')][_0xfaa7('0x30')]);_0x55a1e4[_0xfaa7('0x35')]=_[_0xfaa7('0x36')](_0x27eeab[_0xfaa7('0x35')]);_0x55a1e4['filters']=_[_0xfaa7('0x38')](_0x55a1e4[_0xfaa7('0x34')],_0x55a1e4[_0xfaa7('0x35')]);_0x299fa7[_0xfaa7('0x3a')]=_['intersection'](_0x55a1e4[_0xfaa7('0x34')],qs['fields'](_0x27eeab[_0xfaa7('0x35')][_0xfaa7('0x39')]));_0x299fa7[_0xfaa7('0x3a')]=_0x299fa7['attributes'][_0xfaa7('0x4c')]?_0x299fa7['attributes']:_0x55a1e4[_0xfaa7('0x34')];if(_0x27eeab[_0xfaa7('0x35')][_0xfaa7('0x4d')]){_0x299fa7[_0xfaa7('0x46')]=[{'all':!![]}];}_0x299fa7=_[_0xfaa7('0x41')]({},_0x299fa7,_0x27eeab['options']);return db[_0xfaa7('0x2f')][_0xfaa7('0x4e')](_0x299fa7)[_0xfaa7('0x26')](handleEntityNotFound(_0x430d08,null))['then'](respondWithResult(_0x430d08,null))[_0xfaa7('0x49')](handleError(_0x430d08,null));};exports['create']=function(_0x43f47a,_0x1a7ce3){return db[_0xfaa7('0x2f')][_0xfaa7('0x4f')](_0x43f47a[_0xfaa7('0x50')],{})[_0xfaa7('0x26')](function(_0x1ffe1d){var _0x5c70ee=_0x43f47a[_0xfaa7('0x51')][_0xfaa7('0x28')]({'plain':!![]});if(!_0x5c70ee)throw new Error(_0xfaa7('0x52'));if(_0x5c70ee[_0xfaa7('0x53')]===_0xfaa7('0x51')){var _0x3e0f22=_0x1ffe1d[_0xfaa7('0x28')]({'plain':!![]});var _0x4afe94=_0xfaa7('0x54');return db[_0xfaa7('0x55')][_0xfaa7('0x4e')]({'where':{'name':_0x4afe94,'userProfileId':_0x5c70ee['userProfileId']},'raw':!![]})['then'](function(_0x4719ec){if(_0x4719ec&&_0x4719ec[_0xfaa7('0x56')]===0x0){return db[_0xfaa7('0x57')][_0xfaa7('0x4f')]({'name':_0x3e0f22[_0xfaa7('0x2c')],'resourceId':_0x3e0f22['id'],'type':_0x4719ec[_0xfaa7('0x2c')],'sectionId':_0x4719ec['id']},{})[_0xfaa7('0x26')](function(){return _0x1ffe1d;});}else{return _0x1ffe1d;}})[_0xfaa7('0x49')](function(_0x15e3f3){logger['error'](_0xfaa7('0x58'),_0x15e3f3);throw _0x15e3f3;});}return _0x1ffe1d;})[_0xfaa7('0x26')](respondWithResult(_0x1a7ce3,0xc9))[_0xfaa7('0x49')](handleError(_0x1a7ce3,null));};exports[_0xfaa7('0x59')]=function(_0x2750ac,_0x217644){if(_0x2750ac[_0xfaa7('0x50')]['id']){delete _0x2750ac['body']['id'];}return db[_0xfaa7('0x2f')][_0xfaa7('0x4e')]({'where':{'id':_0x2750ac[_0xfaa7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x217644,null))['then'](saveUpdates(_0x2750ac['body'],null))['then'](respondWithResult(_0x217644,null))[_0xfaa7('0x49')](handleError(_0x217644,null));};exports[_0xfaa7('0x27')]=function(_0x372ace,_0xf0cb70){return db[_0xfaa7('0x2f')][_0xfaa7('0x4e')]({'where':{'id':_0x372ace['params']['id']}})[_0xfaa7('0x26')](handleEntityNotFound(_0xf0cb70,null))[_0xfaa7('0x26')](removeEntity(_0xf0cb70,null))['catch'](handleError(_0xf0cb70,null));};exports[_0xfaa7('0x5a')]=function(_0x18061d,_0x1c0973,_0x3f98b8){var _0x20cd18=require(_0xfaa7('0x5b'));return db[_0xfaa7('0x2f')][_0xfaa7('0x4e')]({'where':{'id':_0x18061d[_0xfaa7('0x4b')]['id']},'raw':!![]})[_0xfaa7('0x26')](handleEntityNotFound(_0x1c0973,null))['then'](function(){_0x20cd18[_0xfaa7('0x5a')](_0x18061d['params']['id']);})[_0xfaa7('0x26')](respondWithStatusCode(_0x1c0973,null))['catch'](handleError(_0x1c0973,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1d8940e..a431d5e 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 _0xdc84=['request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api'];(function(_0x18051c,_0x1b29e5){var _0x9700c9=function(_0x29a9c8){while(--_0x29a9c8){_0x18051c['push'](_0x18051c['shift']());}};_0x9700c9(++_0x1b29e5);}(_0xdc84,0x1ad));var _0x4dc8=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0xdc84[_0x4843f9];return _0x193c6a;};'use strict';var _=require(_0x4dc8('0x0'));var util=require('util');var logger=require(_0x4dc8('0x1'))(_0x4dc8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4dc8('0x3'));var fs=require('fs');var path=require(_0x4dc8('0x4'));var rimraf=require(_0x4dc8('0x5'));var config=require(_0x4dc8('0x6'));var attributes=require(_0x4dc8('0x7'));module[_0x4dc8('0x8')]=function(_0x2c75c9,_0x28f242){return _0x2c75c9[_0x4dc8('0x9')](_0x4dc8('0xa'),attributes,{'tableName':_0x4dc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe914=['bluebird','request-promise','path','rimraf','./schedule.attributes','define','Schedule','tools_schedules','lodash','api'];(function(_0x33f00b,_0x6cf445){var _0x410562=function(_0x22482d){while(--_0x22482d){_0x33f00b['push'](_0x33f00b['shift']());}};_0x410562(++_0x6cf445);}(_0xe914,0x1b6));var _0x4e91=function(_0x1ed354,_0x4bb5be){_0x1ed354=_0x1ed354-0x0;var _0x532757=_0xe914[_0x1ed354];return _0x532757;};'use strict';var _=require(_0x4e91('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e91('0x1'));var moment=require('moment');var BPromise=require(_0x4e91('0x2'));var rp=require(_0x4e91('0x3'));var fs=require('fs');var path=require(_0x4e91('0x4'));var rimraf=require(_0x4e91('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e91('0x6'));module['exports']=function(_0x148737,_0x21f96f){return _0x148737[_0x4e91('0x7')](_0x4e91('0x8'),attributes,{'tableName':_0x4e91('0x9'),'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 c76be57..4ca11d5 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 _0xfb37=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x273c7e,_0x46034f){var _0x320ad9=function(_0x1695e7){while(--_0x1695e7){_0x273c7e['push'](_0x273c7e['shift']());}};_0x320ad9(++_0x46034f);}(_0xfb37,0xa6));var _0x7fb3=function(_0x208bc9,_0x4f36f6){_0x208bc9=_0x208bc9-0x0;var _0x2675a8=_0xfb37[_0x208bc9];return _0x2675a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7fb3('0x0'));var BPromise=require(_0x7fb3('0x1'));var rs=require(_0x7fb3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fb3('0x3'))['db'];var utils=require(_0x7fb3('0x4'));var logger=require(_0x7fb3('0x5'))(_0x7fb3('0x6'));var config=require(_0x7fb3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7fb3('0x8')][_0x7fb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49825c,_0x4ec9e5,_0x2f4418){return new BPromise(function(_0x4b59a1,_0x27c4b5){return client[_0x7fb3('0xa')](_0x49825c,_0x2f4418)[_0x7fb3('0xb')](function(_0x594f0a){logger[_0x7fb3('0xc')](_0x7fb3('0xd'),_0x4ec9e5,_0x7fb3('0xe'));logger['debug'](_0x7fb3('0xf'),_0x4ec9e5,_0x7fb3('0xe'),JSON[_0x7fb3('0x10')](_0x594f0a));if(_0x594f0a[_0x7fb3('0x11')]){if(_0x594f0a['error'][_0x7fb3('0x12')]===0x1f4){logger[_0x7fb3('0x11')]('Schedule,\x20%s,\x20%s',_0x4ec9e5,_0x594f0a[_0x7fb3('0x11')][_0x7fb3('0x13')]);return _0x27c4b5(_0x594f0a['error'][_0x7fb3('0x13')]);}logger[_0x7fb3('0x11')](_0x7fb3('0xd'),_0x4ec9e5,_0x594f0a[_0x7fb3('0x11')][_0x7fb3('0x13')]);return _0x4b59a1(_0x594f0a[_0x7fb3('0x11')][_0x7fb3('0x13')]);}else{logger[_0x7fb3('0xc')](_0x7fb3('0xd'),_0x4ec9e5,_0x7fb3('0xe'));_0x4b59a1(_0x594f0a[_0x7fb3('0x14')][_0x7fb3('0x13')]);}})[_0x7fb3('0x15')](function(_0xb5bf4a){logger['error'](_0x7fb3('0xd'),_0x4ec9e5,_0xb5bf4a);_0x27c4b5(_0xb5bf4a);});});} \ No newline at end of file +var _0x4364=['http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','Schedule,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ebca3,_0x200f96){var _0x353d06=function(_0x4ee5fa){while(--_0x4ee5fa){_0x5ebca3['push'](_0x5ebca3['shift']());}};_0x353d06(++_0x200f96);}(_0x4364,0x109));var _0x4436=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x4364[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x4436('0x0'));var util=require(_0x4436('0x1'));var moment=require(_0x4436('0x2'));var BPromise=require(_0x4436('0x3'));var rs=require(_0x4436('0x4'));var fs=require('fs');var Redis=require(_0x4436('0x5'));var db=require(_0x4436('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4436('0x7'))(_0x4436('0x8'));var config=require(_0x4436('0x9'));var jayson=require(_0x4436('0xa'));var client=jayson['client'][_0x4436('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d1a6b,_0x255556,_0x5a204a){return new BPromise(function(_0x3fa62d,_0x29222d){return client[_0x4436('0xc')](_0x2d1a6b,_0x5a204a)[_0x4436('0xd')](function(_0x4b3032){logger[_0x4436('0xe')]('Schedule,\x20%s,\x20%s',_0x255556,_0x4436('0xf'));logger[_0x4436('0x10')](_0x4436('0x11'),_0x255556,_0x4436('0xf'),JSON['stringify'](_0x4b3032));if(_0x4b3032[_0x4436('0x12')]){if(_0x4b3032['error'][_0x4436('0x13')]===0x1f4){logger[_0x4436('0x12')]('Schedule,\x20%s,\x20%s',_0x255556,_0x4b3032['error'][_0x4436('0x14')]);return _0x29222d(_0x4b3032['error']['message']);}logger[_0x4436('0x12')]('Schedule,\x20%s,\x20%s',_0x255556,_0x4b3032[_0x4436('0x12')][_0x4436('0x14')]);return _0x3fa62d(_0x4b3032[_0x4436('0x12')][_0x4436('0x14')]);}else{logger[_0x4436('0xe')](_0x4436('0x15'),_0x255556,'request\x20sent');_0x3fa62d(_0x4b3032['result']['message']);}})[_0x4436('0x16')](function(_0x13e0e1){logger[_0x4436('0x12')](_0x4436('0x15'),_0x255556,_0x13e0e1);_0x29222d(_0x13e0e1);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 52d1512..3c83fd0 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 _0x573c=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','download','post','put','update'];(function(_0x5cffe5,_0x2bc865){var _0xf5501c=function(_0x1f582d){while(--_0x1f582d){_0x5cffe5['push'](_0x5cffe5['shift']());}};_0xf5501c(++_0x2bc865);}(_0x573c,0xaa));var _0xc573=function(_0x5315bf,_0x140a59){_0x5315bf=_0x5315bf-0x0;var _0x30aa1f=_0x573c[_0x5315bf];return _0x30aa1f;};'use strict';var multer=require(_0xc573('0x0'));var util=require(_0xc573('0x1'));var path=require(_0xc573('0x2'));var timeout=require(_0xc573('0x3'));var express=require(_0xc573('0x4'));var router=express[_0xc573('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc573('0x6'));var config=require(_0xc573('0x7'));var controller=require(_0xc573('0x8'));router[_0xc573('0x9')]('/',auth[_0xc573('0xa')](),controller[_0xc573('0xb')]);router[_0xc573('0x9')](_0xc573('0xc'),auth[_0xc573('0xa')](),controller['describe']);router['get'](_0xc573('0xd'),auth[_0xc573('0xa')](),controller['show']);router[_0xc573('0x9')](_0xc573('0xe'),auth[_0xc573('0xa')](),controller[_0xc573('0xf')]);router[_0xc573('0x10')]('/',auth[_0xc573('0xa')](),controller['create']);router[_0xc573('0x11')](_0xc573('0xd'),auth[_0xc573('0xa')](),controller[_0xc573('0x12')]);router[_0xc573('0x13')](_0xc573('0xd'),auth[_0xc573('0xa')](),controller['destroy']);module[_0xc573('0x14')]=router; \ No newline at end of file +var _0x7850=['get','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x34450e,_0x350b08){var _0x348049=function(_0x43e6ef){while(--_0x43e6ef){_0x34450e['push'](_0x34450e['shift']());}};_0x348049(++_0x350b08);}(_0x7850,0x6e));var _0x0785=function(_0x443bd4,_0x19502f){_0x443bd4=_0x443bd4-0x0;var _0x124f7c=_0x7850[_0x443bd4];return _0x124f7c;};'use strict';var multer=require(_0x0785('0x0'));var util=require(_0x0785('0x1'));var path=require(_0x0785('0x2'));var timeout=require(_0x0785('0x3'));var express=require(_0x0785('0x4'));var router=express[_0x0785('0x5')]();var auth=require(_0x0785('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0785('0x7'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0x0785('0x8')](),controller[_0x0785('0x9')]);router[_0x0785('0xa')](_0x0785('0xb'),auth['isAuthenticated'](),controller[_0x0785('0xc')]);router[_0x0785('0xa')](_0x0785('0xd'),auth['isAuthenticated'](),controller[_0x0785('0xe')]);router[_0x0785('0xa')](_0x0785('0xf'),auth[_0x0785('0x8')](),controller[_0x0785('0x10')]);router[_0x0785('0x11')]('/',auth[_0x0785('0x8')](),controller[_0x0785('0x12')]);router[_0x0785('0x13')](_0x0785('0xd'),auth['isAuthenticated'](),controller[_0x0785('0x14')]);router[_0x0785('0x15')](_0x0785('0xd'),auth['isAuthenticated'](),controller[_0x0785('0x16')]);module[_0x0785('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 9e4dde4..55ea781 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 _0xa630=['sequelize','moment','exports','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x5c3452,_0x2f737c){var _0x3bae84=function(_0x4f1eff){while(--_0x4f1eff){_0x5c3452['push'](_0x5c3452['shift']());}};_0x3bae84(++_0x2f737c);}(_0xa630,0xbe));var _0x0a63=function(_0x41b4db,_0x121cd0){_0x41b4db=_0x41b4db-0x0;var _0x4aa7a1=_0xa630[_0x41b4db];return _0x4aa7a1;};'use strict';var Sequelize=require(_0x0a63('0x0'));var moment=require(_0x0a63('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x0a63('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a63('0x3')]('value')?path[_0x0a63('0x4')](this[_0x0a63('0x3')](_0x0a63('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x0a63('0x6')]},'channel':{'type':Sequelize[_0x0a63('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2760b0){var _0x3d5f0b=_0x2760b0[_0x0a63('0x7')](/\\/g,'/');this[_0x0a63('0x8')](_0x0a63('0x5'),_0x3d5f0b);}},'rating':{'type':Sequelize[_0x0a63('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x688acd){this[_0x0a63('0x8')](_0x0a63('0xa'),moment()[_0x0a63('0xb')](_0x688acd,'ms'));this[_0x0a63('0x8')](_0x0a63('0xc'),moment());this[_0x0a63('0x8')](_0x0a63('0xd'),_0x688acd);}},'startedAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this[_0x0a63('0x3')]('startedAt'))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'closedAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this['getDataValue'](_0x0a63('0xc')))['format'](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'createdAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this[_0x0a63('0x3')](_0x0a63('0x12')))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a63('0x3')]('updatedAt'))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}}}; \ No newline at end of file +var _0x9a19=['VIRTUAL','getDataValue','value','extname','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x9a19,0x114));var _0x99a1=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x9a19[_0x351509];return _0x4e9861;};'use strict';var Sequelize=require(_0x99a1('0x0'));var moment=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var config=require('../../config/environment');module[_0x99a1('0x3')]={'format':{'type':Sequelize[_0x99a1('0x4')],'get':function(){return this[_0x99a1('0x5')](_0x99a1('0x6'))?path[_0x99a1('0x7')](this[_0x99a1('0x5')](_0x99a1('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x99a1('0x8')]},'channel':{'type':Sequelize[_0x99a1('0x8')]},'value':{'type':Sequelize[_0x99a1('0x8')],'set':function(_0x65045d){var _0x523b9e=_0x65045d['replace'](/\\/g,'/');this['setDataValue'](_0x99a1('0x6'),_0x523b9e);}},'rating':{'type':Sequelize[_0x99a1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5874fc){this[_0x99a1('0xa')](_0x99a1('0xb'),moment()[_0x99a1('0xc')](_0x5874fc,'ms'));this[_0x99a1('0xa')](_0x99a1('0xd'),moment());this['setDataValue'](_0x99a1('0xe'),_0x5874fc);}},'startedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0xb')))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'closedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0xd')))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'createdAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')]('createdAt'))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'updatedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0x13')))[_0x99a1('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 780b835..7569d31 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 _0x3b6e=['rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','count','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','duration','describe','download','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','unlinkSync','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','to-csv','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','Content-Range','json','apply','save','update','destroy','then','end','stack','name','send','index','map','ScreenRecording'];(function(_0xcf4260,_0xe48af6){var _0x5ad781=function(_0x4ab8c9){while(--_0x4ab8c9){_0xcf4260['push'](_0xcf4260['shift']());}};_0x5ad781(++_0xe48af6);}(_0x3b6e,0xfe));var _0xe3b6=function(_0x2cb02d,_0x3e40e0){_0x2cb02d=_0x2cb02d-0x0;var _0x4501df=_0x3b6e[_0x2cb02d];return _0x4501df;};'use strict';var pdf=require(_0xe3b6('0x0'));var emlformat=require(_0xe3b6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe3b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3b6('0x3'));var BPromise=require(_0xe3b6('0x4'));var Mustache=require('mustache');var util=require(_0xe3b6('0x5'));var path=require(_0xe3b6('0x6'));var sox=require('sox');var csv=require(_0xe3b6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe3b6('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe3b6('0x7'));var querystring=require(_0xe3b6('0x9'));var Papa=require(_0xe3b6('0xa'));var Redis=require(_0xe3b6('0xb'));var authService=require(_0xe3b6('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe3b6('0xd'));var hardwareService=require(_0xe3b6('0xe'));var logger=require(_0xe3b6('0xf'))('api');var utils=require(_0xe3b6('0x10'));var config=require(_0xe3b6('0x11'));var db=require(_0xe3b6('0x12'))['db'];function respondWithStatusCode(_0x1391d0,_0x581ee7){_0x581ee7=_0x581ee7||0xcc;return function(_0x51eaad){if(_0x51eaad){return _0x1391d0[_0xe3b6('0x13')](_0x581ee7);}return _0x1391d0['status'](_0x581ee7)['end']();};}function respondWithResult(_0x1c63ec,_0x503c6c){_0x503c6c=_0x503c6c||0xc8;return function(_0x3b23af){if(_0x3b23af){return _0x1c63ec[_0xe3b6('0x14')](_0x503c6c)['json'](_0x3b23af);}};}function respondWithFilteredResult(_0x544bf4,_0x3f726e){return function(_0x163cd8){if(_0x163cd8){var _0x496c27=_0x163cd8['count'],_0x261657=_0x3f726e[_0xe3b6('0x15')],_0x476ab9=_0x3f726e[_0xe3b6('0x15')]+_0x3f726e[_0xe3b6('0x16')],_0x50bec1;if(_0x476ab9>=_0x496c27){_0x476ab9=_0x496c27;_0x50bec1=0xc8;}else{_0x50bec1=0xce;}_0x544bf4[_0xe3b6('0x14')](_0x50bec1);return _0x544bf4['set'](_0xe3b6('0x17'),_0x261657+'-'+_0x476ab9+'/'+_0x496c27)[_0xe3b6('0x18')](_0x163cd8);}return null;};}function patchUpdates(_0x461f5f){return function(_0x59200d){try{jsonpatch[_0xe3b6('0x19')](_0x59200d,_0x461f5f,!![]);}catch(_0x5ddae5){return BPromise['reject'](_0x5ddae5);}return _0x59200d[_0xe3b6('0x1a')]();};}function saveUpdates(_0x566e38,_0x4240ef){return function(_0x17c7bc){if(_0x17c7bc){return _0x17c7bc[_0xe3b6('0x1b')](_0x566e38)['then'](function(_0x4de236){return _0x4de236;});}return null;};}function removeEntity(_0x326837,_0xc03490){return function(_0x44a3b8){if(_0x44a3b8){return _0x44a3b8[_0xe3b6('0x1c')]()[_0xe3b6('0x1d')](function(){_0x326837[_0xe3b6('0x14')](0xcc)[_0xe3b6('0x1e')]();});}};}function handleEntityNotFound(_0x1fcb04,_0x21da2e){return function(_0x145383){if(!_0x145383){_0x1fcb04[_0xe3b6('0x13')](0x194);}return _0x145383;};}function handleError(_0x373dbf,_0x264f02){_0x264f02=_0x264f02||0x1f4;return function(_0x290f5c){logger['error'](_0x290f5c[_0xe3b6('0x1f')]);if(_0x290f5c['name']){delete _0x290f5c[_0xe3b6('0x20')];}_0x373dbf[_0xe3b6('0x14')](_0x264f02)[_0xe3b6('0x21')](_0x290f5c);};}exports[_0xe3b6('0x22')]=function(_0x5ab61f,_0x237dc7){var _0x5b6720={},_0x2853d5={},_0x3e22c1={'count':0x0,'rows':[]};var _0x296f6f=_[_0xe3b6('0x23')](db[_0xe3b6('0x24')][_0xe3b6('0x25')],function(_0x5960c4){return{'name':_0x5960c4[_0xe3b6('0x26')],'type':_0x5960c4[_0xe3b6('0x27')][_0xe3b6('0x28')]};});_0x2853d5[_0xe3b6('0x29')]=_[_0xe3b6('0x2a')](_[_0xe3b6('0x23')](_0x296f6f,_0xe3b6('0x20')),[_0xe3b6('0x2b')]);_0x2853d5[_0xe3b6('0x2c')]=_[_0xe3b6('0x2d')](_0x5ab61f[_0xe3b6('0x2c')]);_0x2853d5['filters']=_['intersection'](_0x2853d5[_0xe3b6('0x29')],_0x2853d5[_0xe3b6('0x2c')]);_0x5b6720['attributes']=_[_0xe3b6('0x2e')](_0x2853d5[_0xe3b6('0x29')],qs['fields'](_0x5ab61f[_0xe3b6('0x2c')][_0xe3b6('0x2f')]));_0x5b6720[_0xe3b6('0x30')]=_0x5b6720[_0xe3b6('0x30')][_0xe3b6('0x31')]?_0x5b6720['attributes']:_0x2853d5['model'];if(!_0x5ab61f[_0xe3b6('0x2c')]['hasOwnProperty'](_0xe3b6('0x32'))){_0x5b6720[_0xe3b6('0x16')]=qs['limit'](_0x5ab61f[_0xe3b6('0x2c')]['limit']);_0x5b6720[_0xe3b6('0x15')]=qs[_0xe3b6('0x15')](_0x5ab61f[_0xe3b6('0x2c')][_0xe3b6('0x15')]);}_0x5b6720[_0xe3b6('0x33')]=qs[_0xe3b6('0x34')](_0x5ab61f[_0xe3b6('0x2c')][_0xe3b6('0x34')]);_0x5b6720[_0xe3b6('0x35')]=qs[_0xe3b6('0x36')](_[_0xe3b6('0x37')](_0x5ab61f[_0xe3b6('0x2c')],_0x2853d5[_0xe3b6('0x36')]),_0x296f6f);if(_0x5ab61f[_0xe3b6('0x2c')][_0xe3b6('0x38')]){_0x5b6720['where']=_[_0xe3b6('0x39')](_0x5b6720['where'],{'$or':_[_0xe3b6('0x23')](_0x296f6f,function(_0x51666c){if(_0x51666c[_0xe3b6('0x27')]!=='VIRTUAL'){var _0x1e6bc4={};_0x1e6bc4[_0x51666c['name']]={'$like':'%'+_0x5ab61f[_0xe3b6('0x2c')]['filter']+'%'};return _0x1e6bc4;}})});}_0x5b6720=_[_0xe3b6('0x39')]({},_0x5b6720,_0x5ab61f['options']);var _0x3e440c={'where':_0x5b6720[_0xe3b6('0x35')]};return db[_0xe3b6('0x24')][_0xe3b6('0x3a')](_0x3e440c)['then'](function(_0x5c78ea){_0x3e22c1[_0xe3b6('0x3a')]=_0x5c78ea;if(_0x5ab61f[_0xe3b6('0x2c')]['includeAll']){_0x5b6720[_0xe3b6('0x3b')]=[{'all':!![]}];}return db[_0xe3b6('0x24')][_0xe3b6('0x3c')](_0x5b6720);})[_0xe3b6('0x1d')](function(_0x323968){_0x3e22c1[_0xe3b6('0x3d')]=_0x323968;return _0x3e22c1;})['then'](respondWithFilteredResult(_0x237dc7,_0x5b6720))[_0xe3b6('0x3e')](handleError(_0x237dc7,null));};exports[_0xe3b6('0x3f')]=function(_0x30f8ab,_0x8b70c7){var _0x52b73c={'raw':![],'where':{'id':_0x30f8ab[_0xe3b6('0x40')]['id']}},_0x4512a0={};_0x4512a0['model']=_['keys'](db[_0xe3b6('0x24')]['rawAttributes']);_0x4512a0['query']=_['keys'](_0x30f8ab['query']);_0x4512a0[_0xe3b6('0x36')]=_[_0xe3b6('0x2e')](_0x4512a0[_0xe3b6('0x29')],_0x4512a0['query']);_0x52b73c[_0xe3b6('0x30')]=_[_0xe3b6('0x2e')](_0x4512a0[_0xe3b6('0x29')],qs[_0xe3b6('0x2f')](_0x30f8ab[_0xe3b6('0x2c')][_0xe3b6('0x2f')]));_0x52b73c[_0xe3b6('0x30')]=_0x52b73c['attributes'][_0xe3b6('0x31')]?_0x52b73c[_0xe3b6('0x30')]:_0x4512a0['model'];if(_0x30f8ab['query'][_0xe3b6('0x41')]){_0x52b73c[_0xe3b6('0x3b')]=[{'all':!![]}];}_0x52b73c=_[_0xe3b6('0x39')]({},_0x52b73c,_0x30f8ab[_0xe3b6('0x42')]);return db[_0xe3b6('0x24')][_0xe3b6('0x43')](_0x52b73c)['then'](handleEntityNotFound(_0x8b70c7,null))['then'](respondWithResult(_0x8b70c7,null))[_0xe3b6('0x3e')](handleError(_0x8b70c7,null));};exports[_0xe3b6('0x44')]=function(_0x4a8050,_0x5cf81c){return db[_0xe3b6('0x24')][_0xe3b6('0x44')](_0x4a8050['body'],{})[_0xe3b6('0x1d')](respondWithResult(_0x5cf81c,0xc9))[_0xe3b6('0x3e')](handleError(_0x5cf81c,null));};exports['update']=function(_0x434932,_0x10b782){if(_0x434932[_0xe3b6('0x45')]['id']){delete _0x434932['body']['id'];}delete _0x434932[_0xe3b6('0x45')][_0xe3b6('0x46')];delete _0x434932[_0xe3b6('0x45')]['createdAt'];delete _0x434932[_0xe3b6('0x45')]['closedAt'];delete _0x434932[_0xe3b6('0x45')]['value'];return db[_0xe3b6('0x24')][_0xe3b6('0x43')]({'where':{'id':_0x434932[_0xe3b6('0x40')]['id']}})['then'](handleEntityNotFound(_0x10b782,null))[_0xe3b6('0x1d')](saveUpdates(_0x434932['body'],null))[_0xe3b6('0x1d')](respondWithResult(_0x10b782,null))[_0xe3b6('0x3e')](handleError(_0x10b782,null));};exports[_0xe3b6('0x47')]=function(_0x273e19,_0x45402c){return db[_0xe3b6('0x24')][_0xe3b6('0x47')]()[_0xe3b6('0x1d')](respondWithResult(_0x45402c,null))[_0xe3b6('0x3e')](handleError(_0x45402c,null));};exports[_0xe3b6('0x48')]=function(_0x474ccf,_0x4bc7ec,_0x11bc24){var _0x3df018=require('../../components/encryptor');var _0x2c4eed=![];var _0x581a13={};if(_0x474ccf[_0xe3b6('0x2c')][_0xe3b6('0x27')]&&_0x474ccf['query'][_0xe3b6('0x27')]===_0xe3b6('0x49')){_0x581a13[_0xe3b6('0x49')]=_0x474ccf['params']['id'];}else{_0x581a13['id']=_0x474ccf[_0xe3b6('0x40')]['id'];}return db[_0xe3b6('0x24')][_0xe3b6('0x43')]({'where':_0x581a13,'attributes':['id',_0xe3b6('0x4a')],'raw':!![]})[_0xe3b6('0x1d')](handleEntityNotFound(_0x4bc7ec,null))[_0xe3b6('0x1d')](function(_0x4041fb){if(_0x4041fb){var _0x2cdef7=path[_0xe3b6('0x4b')](config[_0xe3b6('0x4c')],_0xe3b6('0x4d'),_0x4041fb[_0xe3b6('0x4a')]);var _0x53b2fc=util[_0xe3b6('0x2b')](_0xe3b6('0x4e'),_0x2cdef7);if(fs[_0xe3b6('0x4f')](_0x53b2fc)){_0x2c4eed=!![];return _0x3df018[_0xe3b6('0x50')](_0x53b2fc,_0x2cdef7,config[_0xe3b6('0x51')][_0xe3b6('0x52')])[_0xe3b6('0x1d')](function(){return _0x4041fb;});}return _0x4041fb;}})['then'](function(_0x18a63e){if(_0x18a63e){var _0x34f70b=path['join'](config[_0xe3b6('0x4c')],_0xe3b6('0x4d'),_0x18a63e[_0xe3b6('0x4a')]);if(!fs['existsSync'](_0x34f70b)){throw new db['Sequelize'][(_0xe3b6('0x53'))]('ScreenRecording\x20not\x20found');}if(_0x18a63e[_0xe3b6('0x54')]){return _0x4bc7ec['download'](_0x34f70b,_0x18a63e['filename']+path[_0xe3b6('0x55')](_0x34f70b),function(){if(_0x2c4eed){fs[_0xe3b6('0x56')](_0x34f70b);}});}else{return _0x4bc7ec[_0xe3b6('0x48')](_0x34f70b,function(_0x569f40){if(_0x2c4eed){fs['unlink'](_0x34f70b);}});}}})[_0xe3b6('0x3e')](function(_0x26aacf){if(_0x26aacf[_0xe3b6('0x57')]===_0xe3b6('0x58')){_0x4bc7ec[_0xe3b6('0x14')](0x194)[_0xe3b6('0x21')](_0xe3b6('0x59'));}else{return handleError(_0x4bc7ec,null);}});};exports[_0xe3b6('0x1c')]=function(_0xa72bb1,_0x53ca2b){return db[_0xe3b6('0x24')][_0xe3b6('0x43')]({'where':{'id':_0xa72bb1['params']['id']}})[_0xe3b6('0x1d')](function(_0x222b6c){if(!_0x222b6c)throw new ReferenceError(_0xe3b6('0x5a'));return _0x222b6c;})[_0xe3b6('0x1d')](function(_0x226ec8){var _0xba1a29=path[_0xe3b6('0x4b')](config[_0xe3b6('0x4c')],_0xe3b6('0x4d'),_0x226ec8[_0xe3b6('0x4a')]);logger[_0xe3b6('0x5b')](_0xe3b6('0x5c'),_0xba1a29);if(!_[_0xe3b6('0x5d')](_0x226ec8[_0xe3b6('0x4a')])&&fs[_0xe3b6('0x4f')](_0xba1a29)){logger[_0xe3b6('0x5b')]('File:\x20\x22'+_0xba1a29+_0xe3b6('0x5e'));fs['unlinkSync'](_0xba1a29);}_0xba1a29=_0xba1a29+'.cypher';if(!_['isNil'](_0x226ec8['value'])&&fs[_0xe3b6('0x4f')](_0xba1a29)){logger['info'](_0xe3b6('0x5f')+_0xba1a29+_0xe3b6('0x5e'));fs[_0xe3b6('0x60')](_0xba1a29);}return _0x226ec8;})[_0xe3b6('0x1d')](function(_0x381185){if(!_0x381185)throw new InternalError();return _0x381185[_0xe3b6('0x1c')]();})['then'](function(){_0x53ca2b[_0xe3b6('0x14')](0xcc)[_0xe3b6('0x1e')]();})['catch'](handleError(_0x53ca2b,null));}; \ No newline at end of file +var _0x9f91=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','length','options','find','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','server/files/screen_recordings','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x2cbab9,_0x1fa591){var _0x3a77a9=function(_0x2824b8){while(--_0x2824b8){_0x2cbab9['push'](_0x2cbab9['shift']());}};_0x3a77a9(++_0x1fa591);}(_0x9f91,0x11c));var _0x19f9=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0x9f91[_0x51cc1d];return _0x2eb9f2;};'use strict';var pdf=require(_0x19f9('0x0'));var emlformat=require(_0x19f9('0x1'));var rimraf=require(_0x19f9('0x2'));var zipdir=require(_0x19f9('0x3'));var jsonpatch=require(_0x19f9('0x4'));var rp=require('request-promise');var moment=require(_0x19f9('0x5'));var BPromise=require(_0x19f9('0x6'));var Mustache=require('mustache');var util=require(_0x19f9('0x7'));var path=require(_0x19f9('0x8'));var sox=require(_0x19f9('0x9'));var csv=require(_0x19f9('0xa'));var ejs=require(_0x19f9('0xb'));var fs=require('fs');var _=require(_0x19f9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x19f9('0xd'));var deskjs=require(_0x19f9('0xe'));var toCsv=require(_0x19f9('0xa'));var querystring=require(_0x19f9('0xf'));var Papa=require(_0x19f9('0x10'));var Redis=require(_0x19f9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x19f9('0x12'));var as=require(_0x19f9('0x13'));var hardwareService=require(_0x19f9('0x14'));var logger=require(_0x19f9('0x15'))('api');var utils=require(_0x19f9('0x16'));var config=require(_0x19f9('0x17'));var db=require(_0x19f9('0x18'))['db'];function respondWithStatusCode(_0x387fcf,_0x11b1ab){_0x11b1ab=_0x11b1ab||0xcc;return function(_0x5ea836){if(_0x5ea836){return _0x387fcf['sendStatus'](_0x11b1ab);}return _0x387fcf[_0x19f9('0x19')](_0x11b1ab)[_0x19f9('0x1a')]();};}function respondWithResult(_0x526a86,_0x4602a2){_0x4602a2=_0x4602a2||0xc8;return function(_0x7970b3){if(_0x7970b3){return _0x526a86[_0x19f9('0x19')](_0x4602a2)[_0x19f9('0x1b')](_0x7970b3);}};}function respondWithFilteredResult(_0x5c9a59,_0x419dc8){return function(_0x570004){if(_0x570004){var _0x436792=_0x570004[_0x19f9('0x1c')],_0x285ddb=_0x419dc8['offset'],_0x1764ba=_0x419dc8[_0x19f9('0x1d')]+_0x419dc8[_0x19f9('0x1e')],_0x54ac41;if(_0x1764ba>=_0x436792){_0x1764ba=_0x436792;_0x54ac41=0xc8;}else{_0x54ac41=0xce;}_0x5c9a59[_0x19f9('0x19')](_0x54ac41);return _0x5c9a59[_0x19f9('0x1f')](_0x19f9('0x20'),_0x285ddb+'-'+_0x1764ba+'/'+_0x436792)[_0x19f9('0x1b')](_0x570004);}return null;};}function patchUpdates(_0x530ce7){return function(_0x15947b){try{jsonpatch[_0x19f9('0x21')](_0x15947b,_0x530ce7,!![]);}catch(_0x25fe74){return BPromise['reject'](_0x25fe74);}return _0x15947b[_0x19f9('0x22')]();};}function saveUpdates(_0x37ff40,_0x4bad29){return function(_0x46ede6){if(_0x46ede6){return _0x46ede6[_0x19f9('0x23')](_0x37ff40)[_0x19f9('0x24')](function(_0x835108){return _0x835108;});}return null;};}function removeEntity(_0x3a9e26,_0xd7355b){return function(_0x343417){if(_0x343417){return _0x343417[_0x19f9('0x25')]()[_0x19f9('0x24')](function(){_0x3a9e26['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c06ad,_0xdb554f){return function(_0x166d13){if(!_0x166d13){_0x3c06ad[_0x19f9('0x26')](0x194);}return _0x166d13;};}function handleError(_0x17d974,_0xc72d62){_0xc72d62=_0xc72d62||0x1f4;return function(_0x2cff8c){logger[_0x19f9('0x27')](_0x2cff8c['stack']);if(_0x2cff8c[_0x19f9('0x28')]){delete _0x2cff8c[_0x19f9('0x28')];}_0x17d974[_0x19f9('0x19')](_0xc72d62)[_0x19f9('0x29')](_0x2cff8c);};}exports['index']=function(_0x4721c6,_0x568d04){var _0x104a20={},_0x18123f={},_0x222bc5={'count':0x0,'rows':[]};var _0x32d6f7=_[_0x19f9('0x2a')](db[_0x19f9('0x2b')][_0x19f9('0x2c')],function(_0x588e61){return{'name':_0x588e61[_0x19f9('0x2d')],'type':_0x588e61[_0x19f9('0x2e')][_0x19f9('0x2f')]};});_0x18123f[_0x19f9('0x30')]=_['differenceBy'](_[_0x19f9('0x2a')](_0x32d6f7,'name'),['format']);_0x18123f[_0x19f9('0x31')]=_[_0x19f9('0x32')](_0x4721c6[_0x19f9('0x31')]);_0x18123f[_0x19f9('0x33')]=_[_0x19f9('0x34')](_0x18123f[_0x19f9('0x30')],_0x18123f[_0x19f9('0x31')]);_0x104a20[_0x19f9('0x35')]=_['intersection'](_0x18123f[_0x19f9('0x30')],qs[_0x19f9('0x36')](_0x4721c6[_0x19f9('0x31')][_0x19f9('0x36')]));_0x104a20[_0x19f9('0x35')]=_0x104a20[_0x19f9('0x35')]['length']?_0x104a20[_0x19f9('0x35')]:_0x18123f['model'];if(!_0x4721c6[_0x19f9('0x31')][_0x19f9('0x37')](_0x19f9('0x38'))){_0x104a20[_0x19f9('0x1e')]=qs['limit'](_0x4721c6[_0x19f9('0x31')][_0x19f9('0x1e')]);_0x104a20[_0x19f9('0x1d')]=qs[_0x19f9('0x1d')](_0x4721c6[_0x19f9('0x31')][_0x19f9('0x1d')]);}_0x104a20['order']=qs[_0x19f9('0x39')](_0x4721c6['query'][_0x19f9('0x39')]);_0x104a20[_0x19f9('0x3a')]=qs['filters'](_[_0x19f9('0x3b')](_0x4721c6['query'],_0x18123f[_0x19f9('0x33')]),_0x32d6f7);if(_0x4721c6[_0x19f9('0x31')]['filter']){_0x104a20['where']=_['merge'](_0x104a20['where'],{'$or':_['map'](_0x32d6f7,function(_0x2e231e){if(_0x2e231e['type']!==_0x19f9('0x3c')){var _0x1a7b11={};_0x1a7b11[_0x2e231e[_0x19f9('0x28')]]={'$like':'%'+_0x4721c6[_0x19f9('0x31')][_0x19f9('0x3d')]+'%'};return _0x1a7b11;}})});}_0x104a20=_[_0x19f9('0x3e')]({},_0x104a20,_0x4721c6['options']);var _0x4d3703={'where':_0x104a20[_0x19f9('0x3a')]};return db[_0x19f9('0x2b')][_0x19f9('0x1c')](_0x4d3703)[_0x19f9('0x24')](function(_0x2a57c3){_0x222bc5[_0x19f9('0x1c')]=_0x2a57c3;if(_0x4721c6[_0x19f9('0x31')][_0x19f9('0x3f')]){_0x104a20[_0x19f9('0x40')]=[{'all':!![]}];}return db[_0x19f9('0x2b')][_0x19f9('0x41')](_0x104a20);})[_0x19f9('0x24')](function(_0xb7903){_0x222bc5['rows']=_0xb7903;return _0x222bc5;})[_0x19f9('0x24')](respondWithFilteredResult(_0x568d04,_0x104a20))[_0x19f9('0x42')](handleError(_0x568d04,null));};exports[_0x19f9('0x43')]=function(_0x48c162,_0x2b1e55){var _0x5dd0af={'raw':![],'where':{'id':_0x48c162[_0x19f9('0x44')]['id']}},_0x4c80af={};_0x4c80af['model']=_[_0x19f9('0x32')](db[_0x19f9('0x2b')][_0x19f9('0x2c')]);_0x4c80af[_0x19f9('0x31')]=_[_0x19f9('0x32')](_0x48c162[_0x19f9('0x31')]);_0x4c80af[_0x19f9('0x33')]=_['intersection'](_0x4c80af[_0x19f9('0x30')],_0x4c80af['query']);_0x5dd0af[_0x19f9('0x35')]=_[_0x19f9('0x34')](_0x4c80af[_0x19f9('0x30')],qs['fields'](_0x48c162[_0x19f9('0x31')][_0x19f9('0x36')]));_0x5dd0af[_0x19f9('0x35')]=_0x5dd0af[_0x19f9('0x35')][_0x19f9('0x45')]?_0x5dd0af[_0x19f9('0x35')]:_0x4c80af['model'];if(_0x48c162[_0x19f9('0x31')][_0x19f9('0x3f')]){_0x5dd0af[_0x19f9('0x40')]=[{'all':!![]}];}_0x5dd0af=_[_0x19f9('0x3e')]({},_0x5dd0af,_0x48c162[_0x19f9('0x46')]);return db[_0x19f9('0x2b')][_0x19f9('0x47')](_0x5dd0af)[_0x19f9('0x24')](handleEntityNotFound(_0x2b1e55,null))[_0x19f9('0x24')](respondWithResult(_0x2b1e55,null))[_0x19f9('0x42')](handleError(_0x2b1e55,null));};exports['create']=function(_0x46319b,_0x294cca){return db[_0x19f9('0x2b')]['create'](_0x46319b[_0x19f9('0x48')],{})[_0x19f9('0x24')](respondWithResult(_0x294cca,0xc9))[_0x19f9('0x42')](handleError(_0x294cca,null));};exports['update']=function(_0x1438fe,_0x499dd1){if(_0x1438fe[_0x19f9('0x48')]['id']){delete _0x1438fe[_0x19f9('0x48')]['id'];}delete _0x1438fe[_0x19f9('0x48')][_0x19f9('0x49')];delete _0x1438fe[_0x19f9('0x48')][_0x19f9('0x4a')];delete _0x1438fe[_0x19f9('0x48')][_0x19f9('0x4b')];delete _0x1438fe['body'][_0x19f9('0x4c')];return db[_0x19f9('0x2b')][_0x19f9('0x47')]({'where':{'id':_0x1438fe[_0x19f9('0x44')]['id']}})['then'](handleEntityNotFound(_0x499dd1,null))[_0x19f9('0x24')](saveUpdates(_0x1438fe['body'],null))[_0x19f9('0x24')](respondWithResult(_0x499dd1,null))[_0x19f9('0x42')](handleError(_0x499dd1,null));};exports[_0x19f9('0x4d')]=function(_0x9f842f,_0x423fea){return db[_0x19f9('0x2b')][_0x19f9('0x4d')]()[_0x19f9('0x24')](respondWithResult(_0x423fea,null))[_0x19f9('0x42')](handleError(_0x423fea,null));};exports[_0x19f9('0x4e')]=function(_0x3dbd60,_0x475a37,_0xc49e36){var _0x24b1de=require('../../components/encryptor');var _0xa0a159=![];var _0x489215={};if(_0x3dbd60['query']['type']&&_0x3dbd60[_0x19f9('0x31')]['type']===_0x19f9('0x4f')){_0x489215[_0x19f9('0x4f')]=_0x3dbd60[_0x19f9('0x44')]['id'];}else{_0x489215['id']=_0x3dbd60[_0x19f9('0x44')]['id'];}return db[_0x19f9('0x2b')][_0x19f9('0x47')]({'where':_0x489215,'attributes':['id',_0x19f9('0x4c')],'raw':!![]})[_0x19f9('0x24')](handleEntityNotFound(_0x475a37,null))['then'](function(_0x37de57){if(_0x37de57){var _0x64aa8f=path[_0x19f9('0x50')](config[_0x19f9('0x51')],'server/files/screen_recordings',_0x37de57[_0x19f9('0x4c')]);var _0x33815d=util[_0x19f9('0x52')]('%s.cypher',_0x64aa8f);if(fs[_0x19f9('0x53')](_0x33815d)){_0xa0a159=!![];return _0x24b1de[_0x19f9('0x54')](_0x33815d,_0x64aa8f,config[_0x19f9('0x55')][_0x19f9('0x56')])[_0x19f9('0x24')](function(){return _0x37de57;});}return _0x37de57;}})[_0x19f9('0x24')](function(_0xece391){if(_0xece391){var _0x4a16e9=path[_0x19f9('0x50')](config[_0x19f9('0x51')],'server/files/screen_recordings',_0xece391['value']);if(!fs['existsSync'](_0x4a16e9)){throw new db[(_0x19f9('0x57'))][(_0x19f9('0x58'))](_0x19f9('0x59'));}if(_0xece391['filename']){return _0x475a37[_0x19f9('0x4e')](_0x4a16e9,_0xece391[_0x19f9('0x5a')]+path['extname'](_0x4a16e9),function(){if(_0xa0a159){fs[_0x19f9('0x5b')](_0x4a16e9);}});}else{return _0x475a37['download'](_0x4a16e9,function(_0x4bf42e){if(_0xa0a159){fs['unlink'](_0x4a16e9);}});}}})[_0x19f9('0x42')](function(_0x370662){if(_0x370662[_0x19f9('0x5c')]==='ScreenRecording\x20not\x20found'){_0x475a37['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x475a37,null);}});};exports[_0x19f9('0x25')]=function(_0x57ca83,_0x404d8d){return db['ScreenRecording'][_0x19f9('0x47')]({'where':{'id':_0x57ca83['params']['id']}})[_0x19f9('0x24')](function(_0x3c1a3b){if(!_0x3c1a3b)throw new ReferenceError('Entity\x20not\x20found');return _0x3c1a3b;})[_0x19f9('0x24')](function(_0x2bac09){var _0x1b45b7=path[_0x19f9('0x50')](config[_0x19f9('0x51')],_0x19f9('0x5d'),_0x2bac09['value']);logger[_0x19f9('0x5e')](_0x19f9('0x5f'),_0x1b45b7);if(!_[_0x19f9('0x60')](_0x2bac09[_0x19f9('0x4c')])&&fs['existsSync'](_0x1b45b7)){logger[_0x19f9('0x5e')]('File:\x20\x22'+_0x1b45b7+_0x19f9('0x61'));fs[_0x19f9('0x62')](_0x1b45b7);}_0x1b45b7=_0x1b45b7+_0x19f9('0x63');if(!_[_0x19f9('0x60')](_0x2bac09['value'])&&fs[_0x19f9('0x53')](_0x1b45b7)){logger[_0x19f9('0x5e')](_0x19f9('0x64')+_0x1b45b7+_0x19f9('0x61'));fs['unlinkSync'](_0x1b45b7);}return _0x2bac09;})['then'](function(_0x3ec825){if(!_0x3ec825)throw new InternalError();return _0x3ec825[_0x19f9('0x25')]();})[_0x19f9('0x24')](function(){_0x404d8d[_0x19f9('0x19')](0xcc)[_0x19f9('0x1a')]();})[_0x19f9('0x42')](handleError(_0x404d8d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e02e5f0..11da274 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 _0xee30=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x18f45b,_0x64b4f8){var _0xe5bc88=function(_0x175807){while(--_0x175807){_0x18f45b['push'](_0x18f45b['shift']());}};_0xe5bc88(++_0x64b4f8);}(_0xee30,0x159));var _0x0ee3=function(_0x59a272,_0x54e02d){_0x59a272=_0x59a272-0x0;var _0x5ec9a1=_0xee30[_0x59a272];return _0x5ec9a1;};'use strict';var _=require(_0x0ee3('0x0'));var util=require(_0x0ee3('0x1'));var logger=require(_0x0ee3('0x2'))(_0x0ee3('0x3'));var moment=require(_0x0ee3('0x4'));var BPromise=require(_0x0ee3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ee3('0x6'));var rimraf=require(_0x0ee3('0x7'));var config=require(_0x0ee3('0x8'));var attributes=require(_0x0ee3('0x9'));module[_0x0ee3('0xa')]=function(_0xc9dc91,_0x289ea3){return _0xc9dc91[_0x0ee3('0xb')](_0x0ee3('0xc'),attributes,{'tableName':_0x0ee3('0xd'),'paranoid':![],'indexes':[{'name':_0x0ee3('0xe'),'fields':[_0x0ee3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e0c=['define','interactionid','util','moment','bluebird','request-promise','path','./screenRecording.attributes'];(function(_0x4887c3,_0x4cc111){var _0x4b8784=function(_0x281ac1){while(--_0x281ac1){_0x4887c3['push'](_0x4887c3['shift']());}};_0x4b8784(++_0x4cc111);}(_0x4e0c,0xb2));var _0xc4e0=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x4e0c[_0x391c55];return _0xa434e0;};'use strict';var _=require('lodash');var util=require(_0xc4e0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc4e0('0x1'));var BPromise=require(_0xc4e0('0x2'));var rp=require(_0xc4e0('0x3'));var fs=require('fs');var path=require(_0xc4e0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc4e0('0x5'));module['exports']=function(_0x223c45,_0x335d10){return _0x223c45[_0xc4e0('0x6')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xc4e0('0x7'),'fields':[_0xc4e0('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 98f889d..19d5f0f 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(_0x2dfe8e,_0x20784f){var _0x591e69=function(_0xd92696){while(--_0xd92696){_0x2dfe8e['push'](_0x2dfe8e['shift']());}};_0x591e69(++_0x20784f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x95d4cf,_0x1a7301){var _0x49549d=function(_0x2c3cbc){while(--_0x2c3cbc){_0x95d4cf['push'](_0x95d4cf['shift']());}};_0x49549d(++_0x1a7301);}(_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 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 ca6d473..3fdda74 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 _0xbdf3=['single','file','addLogo','diskStorage','originalname','preferred','addFavicon','put','update','exports','multer','util','path','Router','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','post'];(function(_0x53daae,_0x51a400){var _0x12be55=function(_0x312d46){while(--_0x312d46){_0x53daae['push'](_0x53daae['shift']());}};_0x12be55(++_0x51a400);}(_0xbdf3,0x1de));var _0x3bdf=function(_0x2c1e7a,_0x155f86){_0x2c1e7a=_0x2c1e7a-0x0;var _0xcacb4f=_0xbdf3[_0x2c1e7a];return _0xcacb4f;};'use strict';var multer=require(_0x3bdf('0x0'));var util=require(_0x3bdf('0x1'));var path=require(_0x3bdf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3bdf('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3bdf('0x4'));var controller=require(_0x3bdf('0x5'));router[_0x3bdf('0x6')]('/',auth[_0x3bdf('0x7')](),controller[_0x3bdf('0x8')]);router[_0x3bdf('0x6')](_0x3bdf('0x9'),controller[_0x3bdf('0xa')]);router[_0x3bdf('0x6')](_0x3bdf('0xb'),controller['getLogo']);router['get'](_0x3bdf('0xc'),controller[_0x3bdf('0xd')]);router['get'](_0x3bdf('0xe'),controller['gdpr']);router[_0x3bdf('0x6')](_0x3bdf('0xf'),controller['getPreferred']);router[_0x3bdf('0x6')](_0x3bdf('0x10'),controller[_0x3bdf('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4c9b9b,_0xe9e8f4,_0x3ddbf9){_0x3ddbf9(null,path[_0x3bdf('0x12')](config[_0x3bdf('0x13')],_0x3bdf('0x14')));},'filename':function(_0x5aadca,_0x1f234b,_0x175a15){_0x175a15(null,util[_0x3bdf('0x15')](_0x3bdf('0x16'),_0x3bdf('0x17'),path[_0x3bdf('0x18')](_0x1f234b['originalname'])));}})});router[_0x3bdf('0x19')](_0x3bdf('0xb'),upload[_0x3bdf('0x1a')](_0x3bdf('0x1b')),controller[_0x3bdf('0x1c')]);var upload=multer({'storage':multer[_0x3bdf('0x1d')]({'destination':function(_0x3f1f46,_0x5dcb1,_0xa9aa9b){_0xa9aa9b(null,path['join'](config[_0x3bdf('0x13')],_0x3bdf('0x14')));},'filename':function(_0xda8f0c,_0x5c2212,_0xcb8781){_0xcb8781(null,util['format'](_0x3bdf('0x16'),'logologin',path[_0x3bdf('0x18')](_0x5c2212[_0x3bdf('0x1e')])));}})});router[_0x3bdf('0x19')](_0x3bdf('0xc'),upload[_0x3bdf('0x1a')](_0x3bdf('0x1b')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x3bdf('0x1d')]({'destination':function(_0x17b925,_0x502d7a,_0x5c51cc){_0x5c51cc(null,path[_0x3bdf('0x12')](config[_0x3bdf('0x13')],_0x3bdf('0x14')));},'filename':function(_0x51275d,_0x2742df,_0x182f7b){_0x182f7b(null,util['format']('%s%s',_0x3bdf('0x1f'),path[_0x3bdf('0x18')](_0x2742df[_0x3bdf('0x1e')])));}})});router['post'](_0x3bdf('0xf'),upload[_0x3bdf('0x1a')](_0x3bdf('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0x3bdf('0x1d')]({'destination':function(_0x109b98,_0x816bb,_0x5326dc){_0x5326dc(null,path[_0x3bdf('0x12')](config['root'],_0x3bdf('0x14')));},'filename':function(_0x41eae3,_0x491c5f,_0x5a56bb){_0x5a56bb(null,util['format']('%s%s','favicon',path[_0x3bdf('0x18')](_0x491c5f[_0x3bdf('0x1e')])));}})});router['post']('/:id/favicon',upload['single'](_0x3bdf('0x1b')),controller[_0x3bdf('0x20')]);router[_0x3bdf('0x21')]('/:id',auth[_0x3bdf('0x7')](),controller[_0x3bdf('0x22')]);module[_0x3bdf('0x23')]=router; \ No newline at end of file +var _0x52e6=['Router','../../components/auth/service','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','single','addLogo','originalname','post','file','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x52e6,0x1ca));var _0x652e=function(_0x26eb67,_0x438d55){_0x26eb67=_0x26eb67-0x0;var _0x2de906=_0x52e6[_0x26eb67];return _0x2de906;};'use strict';var multer=require(_0x652e('0x0'));var util=require(_0x652e('0x1'));var path=require('path');var timeout=require(_0x652e('0x2'));var express=require(_0x652e('0x3'));var router=express[_0x652e('0x4')]();var auth=require(_0x652e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x652e('0x6'));router[_0x652e('0x7')]('/',auth[_0x652e('0x8')](),controller[_0x652e('0x9')]);router[_0x652e('0x7')](_0x652e('0xa'),controller[_0x652e('0xb')]);router[_0x652e('0x7')](_0x652e('0xc'),controller[_0x652e('0xd')]);router['get'](_0x652e('0xe'),controller[_0x652e('0xf')]);router[_0x652e('0x7')]('/:id/gdpr',controller[_0x652e('0x10')]);router[_0x652e('0x7')]('/:id/preferred',controller[_0x652e('0x11')]);router[_0x652e('0x7')](_0x652e('0x12'),controller[_0x652e('0x13')]);var upload=multer({'storage':multer[_0x652e('0x14')]({'destination':function(_0x163791,_0x4fcd36,_0x25a990){_0x25a990(null,path[_0x652e('0x15')](config[_0x652e('0x16')],_0x652e('0x17')));},'filename':function(_0x2ea5d7,_0x3a1375,_0x42f675){_0x42f675(null,util[_0x652e('0x18')](_0x652e('0x19'),_0x652e('0x1a'),path[_0x652e('0x1b')](_0x3a1375['originalname'])));}})});router['post'](_0x652e('0xc'),upload[_0x652e('0x1c')]('file'),controller[_0x652e('0x1d')]);var upload=multer({'storage':multer[_0x652e('0x14')]({'destination':function(_0x4e2a8c,_0x14d67c,_0x5daf1a){_0x5daf1a(null,path['join'](config[_0x652e('0x16')],_0x652e('0x17')));},'filename':function(_0x2559e,_0x534d1e,_0x6aa81b){_0x6aa81b(null,util[_0x652e('0x18')](_0x652e('0x19'),'logologin',path[_0x652e('0x1b')](_0x534d1e[_0x652e('0x1e')])));}})});router[_0x652e('0x1f')](_0x652e('0xe'),upload[_0x652e('0x1c')](_0x652e('0x20')),controller[_0x652e('0x21')]);var upload=multer({'storage':multer[_0x652e('0x14')]({'destination':function(_0x33e151,_0x39632d,_0x49f2ec){_0x49f2ec(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x58ed5d,_0x5c8b4a,_0x3df432){_0x3df432(null,util[_0x652e('0x18')](_0x652e('0x19'),_0x652e('0x22'),path[_0x652e('0x1b')](_0x5c8b4a[_0x652e('0x1e')])));}})});router['post'](_0x652e('0x23'),upload[_0x652e('0x1c')](_0x652e('0x20')),controller[_0x652e('0x24')]);var upload=multer({'storage':multer[_0x652e('0x14')]({'destination':function(_0x529f36,_0x21a9ca,_0x48e17a){_0x48e17a(null,path[_0x652e('0x15')](config[_0x652e('0x16')],_0x652e('0x17')));},'filename':function(_0x4c7f74,_0x56ec75,_0x1644fd){_0x1644fd(null,util[_0x652e('0x18')](_0x652e('0x19'),_0x652e('0x25'),path[_0x652e('0x1b')](_0x56ec75[_0x652e('0x1e')])));}})});router[_0x652e('0x1f')](_0x652e('0x12'),upload['single'](_0x652e('0x20')),controller[_0x652e('0x26')]);router[_0x652e('0x27')](_0x652e('0xa'),auth[_0x652e('0x8')](),controller[_0x652e('0x28')]);module[_0x652e('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 78dd3a3..2976bed 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 _0xeaa2=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x4218a8,_0x2cb39d){var _0x3f0b53=function(_0x203c04){while(--_0x203c04){_0x4218a8['push'](_0x4218a8['shift']());}};_0x3f0b53(++_0x2cb39d);}(_0xeaa2,0x171));var _0x2eaa=function(_0x4662e3,_0x3c9e27){_0x4662e3=_0x4662e3-0x0;var _0x3ab0e7=_0xeaa2[_0x4662e3];return _0x3ab0e7;};'use strict';var Sequelize=require(_0x2eaa('0x0'));module[_0x2eaa('0x1')]={'min_internal':{'type':Sequelize[_0x2eaa('0x2')](0xb),'unique':_0x2eaa('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2eaa('0x2')](0xb),'unique':_0x2eaa('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2eaa('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2eaa('0x5')],'defaultValue':_0x2eaa('0x6')},'logo':{'type':Sequelize[_0x2eaa('0x5')]},'defaultLogo':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2eaa('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2eaa('0x5')]},'turnaddr':{'type':Sequelize[_0x2eaa('0x5')]},'turnusername':{'type':Sequelize[_0x2eaa('0x5')]},'turnpassword':{'type':Sequelize[_0x2eaa('0x5')]},'pageTitle':{'type':Sequelize[_0x2eaa('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2eaa('0x5')],'defaultValue':_0x2eaa('0x8')},'enableEmailPreview':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2eaa('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x2eaa('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x2eaa('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2eaa('0x5')]},'defaultFavicon':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x2eaa('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2eaa('0x2')]},'transcribeRegion':{'type':Sequelize[_0x2eaa('0x5')]},'sentiment':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x2eaa('0x5')]},'language':{'type':Sequelize[_0x2eaa('0x5')]},'bucket':{'type':Sequelize[_0x2eaa('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x2eaa('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xbda0=['sequelize','exports','INTEGER','min_internal','STRING','BOOLEAN'];(function(_0x2f0b82,_0xa07e26){var _0x5d6fb1=function(_0x178f3f){while(--_0x178f3f){_0x2f0b82['push'](_0x2f0b82['shift']());}};_0x5d6fb1(++_0xa07e26);}(_0xbda0,0xf0));var _0x0bda=function(_0xcc6b8e,_0x1e4585){_0xcc6b8e=_0xcc6b8e-0x0;var _0x2a7362=_0xbda0[_0xcc6b8e];return _0x2a7362;};'use strict';var Sequelize=require(_0x0bda('0x0'));module[_0x0bda('0x1')]={'min_internal':{'type':Sequelize[_0x0bda('0x2')](0xb),'unique':_0x0bda('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x0bda('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0bda('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x0bda('0x4')]},'defaultLogo':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0bda('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0bda('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0bda('0x4')]},'turnaddr':{'type':Sequelize[_0x0bda('0x4')]},'turnusername':{'type':Sequelize[_0x0bda('0x4')]},'turnpassword':{'type':Sequelize[_0x0bda('0x4')]},'pageTitle':{'type':Sequelize[_0x0bda('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0bda('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0bda('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0bda('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0bda('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0bda('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0bda('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x0bda('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0bda('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0bda('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0bda('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0bda('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0bda('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x0bda('0x2')]},'transcribeRegion':{'type':Sequelize[_0x0bda('0x4')]},'sentiment':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0bda('0x2')]},'sentimentRegion':{'type':Sequelize[_0x0bda('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x0bda('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 7806264..acb7a80 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 _0xe335=['params','include','find','update','body','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLicense','logo','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','getLogoLogin','server/files/images/logos','preferred','defaultLoginLogo','default_loginLogo.svg','download','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','ValidationError','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','offset','limit','set','Content-Range','apply','reject','end','sendStatus','stack','name','send','index','map','Setting','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','options','count','rows','show'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xe335,0x10e));var _0x5e33=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe335[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x5e33('0x0'));var emlformat=require(_0x5e33('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5e33('0x2'));var jsonpatch=require(_0x5e33('0x3'));var rp=require(_0x5e33('0x4'));var moment=require(_0x5e33('0x5'));var BPromise=require(_0x5e33('0x6'));var Mustache=require(_0x5e33('0x7'));var util=require(_0x5e33('0x8'));var path=require(_0x5e33('0x9'));var sox=require(_0x5e33('0xa'));var csv=require('to-csv');var ejs=require(_0x5e33('0xb'));var fs=require('fs');var _=require(_0x5e33('0xc'));var squel=require(_0x5e33('0xd'));var crypto=require(_0x5e33('0xe'));var jsforce=require(_0x5e33('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5e33('0x10'));var querystring=require(_0x5e33('0x11'));var Papa=require(_0x5e33('0x12'));var Redis=require(_0x5e33('0x13'));var authService=require(_0x5e33('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e33('0x15'));var logger=require(_0x5e33('0x16'))(_0x5e33('0x17'));var utils=require(_0x5e33('0x18'));var config=require(_0x5e33('0x19'));var db=require(_0x5e33('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5e33('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x29e717,_0x49a8cb,_0x403937){if(_0x403937){var _0x4a49e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a49e8['test'](_0x49a8cb)){return _0x29e717;}else{throw new db['Sequelize'][(_0x5e33('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 _0x29e717;}}function respondWithRpcPromise(_0x10f1b9,_0x125f23,_0x39420b,_0x3baa5e){return new BPromise(function(_0x300059,_0x92fd44){var _0x2170b9=_0x3baa5e||client;return _0x2170b9['request'](_0x10f1b9,_0x39420b)[_0x5e33('0x1d')](function(_0x50dd04){logger[_0x5e33('0x1e')](_0x5e33('0x1f'),_0x125f23,_0x5e33('0x20'));logger['debug'](_0x5e33('0x21'),_0x125f23,_0x5e33('0x20'),JSON['stringify'](_0x50dd04));if(_0x50dd04[_0x5e33('0x22')]){if(_0x50dd04[_0x5e33('0x22')][_0x5e33('0x23')]===0x1f4){logger[_0x5e33('0x22')](_0x5e33('0x1f'),_0x125f23,_0x50dd04[_0x5e33('0x22')]['message']);return _0x92fd44(_0x50dd04[_0x5e33('0x22')][_0x5e33('0x24')]);}logger['error'](_0x5e33('0x1f'),_0x125f23,_0x50dd04[_0x5e33('0x22')][_0x5e33('0x24')]);return _0x300059(_0x50dd04[_0x5e33('0x22')][_0x5e33('0x24')]);}else{logger[_0x5e33('0x1e')](_0x5e33('0x1f'),_0x125f23,_0x5e33('0x20'));_0x300059(_0x50dd04[_0x5e33('0x25')][_0x5e33('0x24')]);}})[_0x5e33('0x26')](function(_0x35905c){logger['error'](_0x5e33('0x1f'),_0x125f23,_0x35905c);_0x92fd44(_0x35905c);});});}function respondWithStatusCode(_0x35130c,_0x4a41b8){_0x4a41b8=_0x4a41b8||0xcc;return function(_0x24ee6d){if(_0x24ee6d){return _0x35130c['sendStatus'](_0x4a41b8);}return _0x35130c[_0x5e33('0x27')](_0x4a41b8)['end']();};}function respondWithResult(_0x3ca5b5,_0x5467f8){_0x5467f8=_0x5467f8||0xc8;return function(_0x29ac51){if(_0x29ac51){return _0x3ca5b5[_0x5e33('0x27')](_0x5467f8)['json'](_0x29ac51);}};}function respondWithFilteredResult(_0x31f68a,_0x4ccfd2){return function(_0x29107c){if(_0x29107c){var _0x462e41=_0x29107c['count'],_0x362d16=_0x4ccfd2['offset'],_0x4373e9=_0x4ccfd2[_0x5e33('0x28')]+_0x4ccfd2[_0x5e33('0x29')],_0x147bbe;if(_0x4373e9>=_0x462e41){_0x4373e9=_0x462e41;_0x147bbe=0xc8;}else{_0x147bbe=0xce;}_0x31f68a['status'](_0x147bbe);return _0x31f68a[_0x5e33('0x2a')](_0x5e33('0x2b'),_0x362d16+'-'+_0x4373e9+'/'+_0x462e41)['json'](_0x29107c);}return null;};}function patchUpdates(_0x519b10){return function(_0x17bf69){try{jsonpatch[_0x5e33('0x2c')](_0x17bf69,_0x519b10,!![]);}catch(_0x32da59){return BPromise[_0x5e33('0x2d')](_0x32da59);}return _0x17bf69['save']();};}function saveUpdates(_0x124cab,_0x5daaf6){return function(_0x55cf3e){if(_0x55cf3e){return _0x55cf3e['update'](_0x124cab)[_0x5e33('0x1d')](function(_0x323189){return _0x323189;});}return null;};}function removeEntity(_0x2d9572,_0x15fea1){return function(_0x4b803f){if(_0x4b803f){return _0x4b803f['destroy']()[_0x5e33('0x1d')](function(){_0x2d9572[_0x5e33('0x27')](0xcc)[_0x5e33('0x2e')]();});}};}function handleEntityNotFound(_0x1d2e76,_0x434717){return function(_0x467d54){if(!_0x467d54){_0x1d2e76[_0x5e33('0x2f')](0x194);}return _0x467d54;};}function handleError(_0x154af1,_0x739d8f){_0x739d8f=_0x739d8f||0x1f4;return function(_0x401a64){logger[_0x5e33('0x22')](_0x401a64[_0x5e33('0x30')]);if(_0x401a64[_0x5e33('0x31')]){delete _0x401a64[_0x5e33('0x31')];}_0x154af1['status'](_0x739d8f)[_0x5e33('0x32')](_0x401a64);};}exports[_0x5e33('0x33')]=function(_0x23965d,_0x228d96){var _0x173780={},_0x34dde7={},_0x5c3e3b={'count':0x0,'rows':[]};var _0x42821b=_[_0x5e33('0x34')](db[_0x5e33('0x35')][_0x5e33('0x36')],function(_0x128df3){return{'name':_0x128df3['fieldName'],'type':_0x128df3[_0x5e33('0x37')][_0x5e33('0x38')]};});_0x34dde7[_0x5e33('0x39')]=_['map'](_0x42821b,_0x5e33('0x31'));_0x34dde7[_0x5e33('0x3a')]=_[_0x5e33('0x3b')](_0x23965d[_0x5e33('0x3a')]);_0x34dde7['filters']=_[_0x5e33('0x3c')](_0x34dde7[_0x5e33('0x39')],_0x34dde7['query']);_0x173780[_0x5e33('0x3d')]=_[_0x5e33('0x3c')](_0x34dde7['model'],qs['fields'](_0x23965d[_0x5e33('0x3a')][_0x5e33('0x3e')]));_0x173780[_0x5e33('0x3d')]=_0x173780['attributes'][_0x5e33('0x3f')]?_0x173780[_0x5e33('0x3d')]:_0x34dde7['model'];if(!_0x23965d[_0x5e33('0x3a')][_0x5e33('0x40')]('nolimit')){_0x173780[_0x5e33('0x29')]=qs[_0x5e33('0x29')](_0x23965d['query'][_0x5e33('0x29')]);_0x173780[_0x5e33('0x28')]=qs['offset'](_0x23965d[_0x5e33('0x3a')][_0x5e33('0x28')]);}_0x173780['order']=qs[_0x5e33('0x41')](_0x23965d[_0x5e33('0x3a')][_0x5e33('0x41')]);_0x173780[_0x5e33('0x42')]=qs['filters'](_[_0x5e33('0x43')](_0x23965d[_0x5e33('0x3a')],_0x34dde7[_0x5e33('0x44')]),_0x42821b);if(_0x23965d[_0x5e33('0x3a')][_0x5e33('0x45')]){_0x173780['where']=_[_0x5e33('0x46')](_0x173780[_0x5e33('0x42')],{'$or':_[_0x5e33('0x34')](_0x42821b,function(_0x4edcc7){if(_0x4edcc7[_0x5e33('0x37')]!=='VIRTUAL'){var _0x268fc5={};_0x268fc5[_0x4edcc7[_0x5e33('0x31')]]={'$like':'%'+_0x23965d[_0x5e33('0x3a')]['filter']+'%'};return _0x268fc5;}})});}_0x173780=_[_0x5e33('0x46')]({},_0x173780,_0x23965d[_0x5e33('0x47')]);var _0x135f65={'where':_0x173780['where']};return db[_0x5e33('0x35')][_0x5e33('0x48')](_0x135f65)[_0x5e33('0x1d')](function(_0x133fac){_0x5c3e3b['count']=_0x133fac;if(_0x23965d['query']['includeAll']){_0x173780['include']=[{'all':!![]}];}return db[_0x5e33('0x35')]['findAll'](_0x173780);})[_0x5e33('0x1d')](function(_0x18b0f7){_0x5c3e3b[_0x5e33('0x49')]=_0x18b0f7;return _0x5c3e3b;})[_0x5e33('0x1d')](respondWithFilteredResult(_0x228d96,_0x173780))[_0x5e33('0x26')](handleError(_0x228d96,null));};exports[_0x5e33('0x4a')]=function(_0xa5e192,_0x116414){var _0x13bb3b={'raw':![],'where':{'id':_0xa5e192[_0x5e33('0x4b')]['id']}},_0x11e5f4={};_0x11e5f4['model']=_[_0x5e33('0x3b')](db['Setting'][_0x5e33('0x36')]);_0x11e5f4[_0x5e33('0x3a')]=_[_0x5e33('0x3b')](_0xa5e192['query']);_0x11e5f4[_0x5e33('0x44')]=_[_0x5e33('0x3c')](_0x11e5f4['model'],_0x11e5f4[_0x5e33('0x3a')]);_0x13bb3b['attributes']=_[_0x5e33('0x3c')](_0x11e5f4[_0x5e33('0x39')],qs[_0x5e33('0x3e')](_0xa5e192[_0x5e33('0x3a')][_0x5e33('0x3e')]));_0x13bb3b['attributes']=_0x13bb3b['attributes'][_0x5e33('0x3f')]?_0x13bb3b[_0x5e33('0x3d')]:_0x11e5f4[_0x5e33('0x39')];if(_0xa5e192[_0x5e33('0x3a')]['includeAll']){_0x13bb3b[_0x5e33('0x4c')]=[{'all':!![]}];}_0x13bb3b=_['merge']({},_0x13bb3b,_0xa5e192[_0x5e33('0x47')]);return db[_0x5e33('0x35')][_0x5e33('0x4d')](_0x13bb3b)['then'](handleEntityNotFound(_0x116414,null))[_0x5e33('0x1d')](respondWithResult(_0x116414,null))[_0x5e33('0x26')](handleError(_0x116414,null));};exports[_0x5e33('0x4e')]=function(_0x279292,_0x97f5d7){if(_0x279292[_0x5e33('0x4f')]['id']){delete _0x279292[_0x5e33('0x4f')]['id'];}return db[_0x5e33('0x35')]['find']({'where':{'id':_0x279292[_0x5e33('0x4b')]['id']}})[_0x5e33('0x1d')](handleEntityNotFound(_0x97f5d7,null))[_0x5e33('0x1d')](saveUpdates(_0x279292[_0x5e33('0x4f')],null))[_0x5e33('0x1d')](respondWithResult(_0x97f5d7,null))[_0x5e33('0x26')](handleError(_0x97f5d7,null));};exports[_0x5e33('0x50')]=function(_0x17b217,_0x13cc87,_0x559137){if(_0x17b217['file']&&_0x17b217[_0x5e33('0x51')]['filename']){_0x17b217['body']['logo']=_0x17b217[_0x5e33('0x51')][_0x5e33('0x52')];}return db[_0x5e33('0x35')][_0x5e33('0x4d')]({'where':{'id':_0x17b217['params']['id']}})[_0x5e33('0x1d')](handleEntityNotFound(_0x13cc87,null))['then'](saveUpdates(_0x17b217['body'],null))[_0x5e33('0x1d')](respondWithResult(_0x13cc87,null))[_0x5e33('0x26')](handleError(_0x13cc87,null));};exports[_0x5e33('0x53')]=function(_0x11f601,_0x4bd4bf,_0x26a761){if(_0x11f601['file']&&_0x11f601[_0x5e33('0x51')][_0x5e33('0x52')]){_0x11f601['body'][_0x5e33('0x54')]=_0x11f601[_0x5e33('0x51')]['filename'];}return db['Setting']['find']({'where':{'id':_0x11f601[_0x5e33('0x4b')]['id']}})[_0x5e33('0x1d')](handleEntityNotFound(_0x4bd4bf,null))[_0x5e33('0x1d')](saveUpdates(_0x11f601[_0x5e33('0x4f')],null))[_0x5e33('0x1d')](respondWithResult(_0x4bd4bf,null))[_0x5e33('0x26')](handleError(_0x4bd4bf,null));};var utilLicense=require(_0x5e33('0x55'));exports['getLogo']=function(_0x5c00d3,_0x57502f,_0x4d8862){var _0xf9584b='server/files/images/logos';var _0x4ebdfe={'custom':![]};return utilLicense[_0x5e33('0x56')]()[_0x5e33('0x1d')](function(_0x41c6d7){if(_0x41c6d7){_0x4ebdfe=_0x41c6d7;}return db['Setting'][_0x5e33('0x4d')]({'where':{'id':_0x5c00d3[_0x5e33('0x4b')]['id']},'attributes':[_0x5e33('0x57'),_0x5e33('0x54'),'preferred',_0x5e33('0x58'),_0x5e33('0x59'),'defaultLoginLogo',_0x5e33('0x5a'),_0x5e33('0x5b')],'raw':!![]});})[_0x5e33('0x1d')](handleEntityNotFound(_0x57502f,null))[_0x5e33('0x1d')](function(_0x1a8359){if(_0x1a8359){var _0x2a435f=_0x1a8359['logo']&&fs[_0x5e33('0x5c')](path['join'](config['root'],_0xf9584b,_['toLower'](_0x1a8359[_0x5e33('0x57')])))?path['join'](config[_0x5e33('0x5d')],_0xf9584b,_[_0x5e33('0x5e')](_0x1a8359[_0x5e33('0x57')])):path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0xf9584b,_['toLower'](_0x5e33('0x60')));var _0x49272e=_0x5e33('0x61')+_[_0x5e33('0x62')](_0x5e33('0x57'));if(_0x1a8359[_0x49272e]||!_0x4ebdfe[_0x5e33('0x63')]){_0x2a435f=path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0xf9584b,_['toLower'](_0x5e33('0x60')));}if(!fs[_0x5e33('0x5c')](_0x2a435f)){throw new db[(_0x5e33('0x64'))][(_0x5e33('0x1c'))](_[_0x5e33('0x62')](_0x5e33('0x57'))+_0x5e33('0x65'));}return _0x57502f['download'](_0x2a435f);}})[_0x5e33('0x26')](handleError(_0x57502f,null));};var utilLicense=require('../../config/license/util');exports[_0x5e33('0x66')]=function(_0x559b8b,_0xc7c0e7,_0x4e74e5){var _0x2b4213=_0x5e33('0x67');var _0x593669={'custom':![]};return utilLicense[_0x5e33('0x56')]()['then'](function(_0x115d27){if(_0x115d27){_0x593669=_0x115d27;}return db[_0x5e33('0x35')][_0x5e33('0x4d')]({'where':{'id':_0x559b8b['params']['id']},'attributes':[_0x5e33('0x57'),_0x5e33('0x54'),_0x5e33('0x68'),_0x5e33('0x58'),_0x5e33('0x59'),_0x5e33('0x69'),'defaultPreferred',_0x5e33('0x5b')],'raw':!![]});})[_0x5e33('0x1d')](handleEntityNotFound(_0xc7c0e7,null))[_0x5e33('0x1d')](function(_0x5cd56e){if(_0x5cd56e){var _0x564bb9=_0x5cd56e[_0x5e33('0x54')]&&fs[_0x5e33('0x5c')](path[_0x5e33('0x5f')](config['root'],_0x2b4213,_[_0x5e33('0x5e')](_0x5cd56e[_0x5e33('0x54')])))?path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0x2b4213,_[_0x5e33('0x5e')](_0x5cd56e[_0x5e33('0x54')])):path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0x2b4213,_[_0x5e33('0x5e')](_0x5e33('0x6a')));var _0x261c19=_0x5e33('0x61')+_[_0x5e33('0x62')]('loginLogo');if(_0x5cd56e[_0x261c19]||!_0x593669[_0x5e33('0x63')]){_0x564bb9=path['join'](config[_0x5e33('0x5d')],_0x2b4213,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x5e33('0x5c')](_0x564bb9)){throw new db['Sequelize'][(_0x5e33('0x1c'))](_[_0x5e33('0x62')](_0x5e33('0x54'))+_0x5e33('0x65'));}return _0xc7c0e7[_0x5e33('0x6b')](_0x564bb9);}})['catch'](handleError(_0xc7c0e7,null));};exports[_0x5e33('0x6c')]=function(_0x1aa19c,_0x38b2a5){return db[_0x5e33('0x35')][_0x5e33('0x4d')]({'where':{'id':_0x1aa19c['params']['id']},'attributes':[_0x5e33('0x6d')]})[_0x5e33('0x1d')](respondWithResult(_0x38b2a5,null))[_0x5e33('0x26')](handleError(_0x38b2a5,null));};exports['addPreferred']=function(_0x4c28a4,_0x1d8fee,_0x1fdc65){if(_0x4c28a4[_0x5e33('0x51')]&&_0x4c28a4['file'][_0x5e33('0x52')]){_0x4c28a4[_0x5e33('0x4f')][_0x5e33('0x68')]=_0x4c28a4[_0x5e33('0x51')]['filename'];}return db[_0x5e33('0x35')][_0x5e33('0x4d')]({'where':{'id':_0x4c28a4[_0x5e33('0x4b')]['id']}})[_0x5e33('0x1d')](handleEntityNotFound(_0x1d8fee,null))[_0x5e33('0x1d')](saveUpdates(_0x4c28a4[_0x5e33('0x4f')],null))[_0x5e33('0x1d')](respondWithResult(_0x1d8fee,null))[_0x5e33('0x26')](handleError(_0x1d8fee,null));};var utilLicense=require(_0x5e33('0x55'));exports[_0x5e33('0x6e')]=function(_0x1c6ca6,_0x56829c,_0x5c850c){var _0x5c029d=_0x5e33('0x67');var _0x7e06a0={'custom':![]};return utilLicense['getLicense']()[_0x5e33('0x1d')](function(_0x1a3a11){if(_0x1a3a11){_0x7e06a0=_0x1a3a11;}return db[_0x5e33('0x35')][_0x5e33('0x4d')]({'where':{'id':_0x1c6ca6['params']['id']},'attributes':[_0x5e33('0x57'),_0x5e33('0x54'),_0x5e33('0x68'),'favicon','defaultLogo',_0x5e33('0x69'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x56829c,null))[_0x5e33('0x1d')](function(_0x3fb785){if(_0x3fb785){var _0x43f02e=_0x3fb785[_0x5e33('0x68')]&&fs[_0x5e33('0x5c')](path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0x5c029d,_['toLower'](_0x3fb785['preferred'])))?path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0x5c029d,_[_0x5e33('0x5e')](_0x3fb785['preferred'])):path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0x5c029d,_['toLower'](_0x5e33('0x6f')));var _0x2256c7=_0x5e33('0x61')+_[_0x5e33('0x62')](_0x5e33('0x68'));if(_0x3fb785[_0x2256c7]||!_0x7e06a0[_0x5e33('0x63')]||!_0x7e06a0[_0x5e33('0x68')]){_0x43f02e=path['join'](config['root'],_0x5c029d,_[_0x5e33('0x5e')](_0x5e33('0x6f')));}if(!fs[_0x5e33('0x5c')](_0x43f02e)){throw new db[(_0x5e33('0x64'))][(_0x5e33('0x1c'))](_[_0x5e33('0x62')](_0x5e33('0x68'))+'\x20not\x20found');}return _0x56829c[_0x5e33('0x6b')](_0x43f02e);}})['catch'](handleError(_0x56829c,null));};exports[_0x5e33('0x70')]=function(_0x366961,_0x55a057,_0x4bfbe0){if(_0x366961[_0x5e33('0x51')]&&_0x366961[_0x5e33('0x51')][_0x5e33('0x52')]){_0x366961[_0x5e33('0x4f')]['favicon']=_0x366961[_0x5e33('0x51')][_0x5e33('0x52')];}return db[_0x5e33('0x35')][_0x5e33('0x4d')]({'where':{'id':_0x366961[_0x5e33('0x4b')]['id']}})['then'](handleEntityNotFound(_0x55a057,null))[_0x5e33('0x1d')](saveUpdates(_0x366961[_0x5e33('0x4f')],null))[_0x5e33('0x1d')](respondWithResult(_0x55a057,null))['catch'](handleError(_0x55a057,null));};var utilLicense=require(_0x5e33('0x55'));exports[_0x5e33('0x71')]=function(_0x5690ef,_0x229afd,_0x390c21){var _0x57657e='server/files/images/logos';var _0xfb2827={'custom':![]};return utilLicense[_0x5e33('0x56')]()['then'](function(_0x2defb6){if(_0x2defb6){_0xfb2827=_0x2defb6;}return db['Setting'][_0x5e33('0x4d')]({'where':{'id':_0x5690ef[_0x5e33('0x4b')]['id']},'attributes':['logo','loginLogo',_0x5e33('0x68'),_0x5e33('0x58'),_0x5e33('0x59'),_0x5e33('0x69'),'defaultPreferred',_0x5e33('0x5b')],'raw':!![]});})[_0x5e33('0x1d')](handleEntityNotFound(_0x229afd,null))[_0x5e33('0x1d')](function(_0x4134bb){if(_0x4134bb){var _0x5c5620=_0x4134bb[_0x5e33('0x58')]&&fs[_0x5e33('0x5c')](path['join'](config[_0x5e33('0x5d')],_0x57657e,_[_0x5e33('0x5e')](_0x4134bb[_0x5e33('0x58')])))?path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0x57657e,_[_0x5e33('0x5e')](_0x4134bb[_0x5e33('0x58')])):path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0x57657e,_[_0x5e33('0x5e')](_0x5e33('0x72')));var _0x1d1902='default'+_[_0x5e33('0x62')](_0x5e33('0x58'));if(_0x4134bb[_0x1d1902]||!_0xfb2827[_0x5e33('0x63')]){_0x5c5620=path[_0x5e33('0x5f')](config[_0x5e33('0x5d')],_0x57657e,_[_0x5e33('0x5e')](_0x5e33('0x72')));}if(!fs[_0x5e33('0x5c')](_0x5c5620)){throw new db['Sequelize'][(_0x5e33('0x1c'))](_['upperFirst'](_0x5e33('0x58'))+'\x20not\x20found');}return _0x229afd[_0x5e33('0x6b')](_0x5c5620);}})['catch'](handleError(_0x229afd,null));}; \ No newline at end of file +var _0xfea9=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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','info','request\x20sent','debug','error','Setting,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','Setting','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','body','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','custom','existsSync','upperFirst','\x20not\x20found','download','../../config/license/util','default_loginLogo.svg','gdpr','addPreferred','getPreferred','favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','rimraf','zip-dir','moment','mustache','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x5a58de,_0x5aca3f){var _0x24aa83=function(_0x764e0e){while(--_0x764e0e){_0x5a58de['push'](_0x5a58de['shift']());}};_0x24aa83(++_0x5aca3f);}(_0xfea9,0x1c5));var _0x9fea=function(_0x315508,_0x517b76){_0x315508=_0x315508-0x0;var _0x14767a=_0xfea9[_0x315508];return _0x14767a;};'use strict';var pdf=require(_0x9fea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9fea('0x1'));var zipdir=require(_0x9fea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9fea('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9fea('0x4'));var util=require('util');var path=require(_0x9fea('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9fea('0x6'));var squel=require(_0x9fea('0x7'));var crypto=require(_0x9fea('0x8'));var jsforce=require(_0x9fea('0x9'));var deskjs=require(_0x9fea('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9fea('0xb'));var Papa=require(_0x9fea('0xc'));var Redis=require(_0x9fea('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9fea('0xe'));var as=require(_0x9fea('0xf'));var hardwareService=require(_0x9fea('0x10'));var logger=require(_0x9fea('0x11'))(_0x9fea('0x12'));var utils=require(_0x9fea('0x13'));var config=require('../../config/environment');var db=require(_0x9fea('0x14'))['db'];var jayson=require(_0x9fea('0x15'));var client=jayson[_0x9fea('0x16')][_0x9fea('0x17')]({'port':0x232a});function checkPasswordPattern(_0x41f860,_0x48ab2e,_0xb0e2b3){if(_0xb0e2b3){var _0x3fc060=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fc060[_0x9fea('0x18')](_0x48ab2e)){return _0x41f860;}else{throw new db[(_0x9fea('0x19'))][(_0x9fea('0x1a'))](_0x9fea('0x1b'));}}else{return _0x41f860;}}function respondWithRpcPromise(_0x526e66,_0x6fd779,_0x365a5d,_0x471c0d){return new BPromise(function(_0xfd86dc,_0x1b12d7){var _0x448bda=_0x471c0d||client;return _0x448bda[_0x9fea('0x1c')](_0x526e66,_0x365a5d)['then'](function(_0x59f2b8){logger[_0x9fea('0x1d')]('Setting,\x20%s,\x20%s',_0x6fd779,_0x9fea('0x1e'));logger[_0x9fea('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x6fd779,_0x9fea('0x1e'),JSON['stringify'](_0x59f2b8));if(_0x59f2b8['error']){if(_0x59f2b8[_0x9fea('0x20')]['code']===0x1f4){logger[_0x9fea('0x20')](_0x9fea('0x21'),_0x6fd779,_0x59f2b8[_0x9fea('0x20')][_0x9fea('0x22')]);return _0x1b12d7(_0x59f2b8[_0x9fea('0x20')][_0x9fea('0x22')]);}logger[_0x9fea('0x20')](_0x9fea('0x21'),_0x6fd779,_0x59f2b8['error']['message']);return _0xfd86dc(_0x59f2b8[_0x9fea('0x20')][_0x9fea('0x22')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x6fd779,_0x9fea('0x1e'));_0xfd86dc(_0x59f2b8['result'][_0x9fea('0x22')]);}})[_0x9fea('0x23')](function(_0x3b39c5){logger[_0x9fea('0x20')](_0x9fea('0x21'),_0x6fd779,_0x3b39c5);_0x1b12d7(_0x3b39c5);});});}function respondWithStatusCode(_0x38f013,_0x1f5b13){_0x1f5b13=_0x1f5b13||0xcc;return function(_0x174b68){if(_0x174b68){return _0x38f013[_0x9fea('0x24')](_0x1f5b13);}return _0x38f013[_0x9fea('0x25')](_0x1f5b13)[_0x9fea('0x26')]();};}function respondWithResult(_0xe28562,_0x188f03){_0x188f03=_0x188f03||0xc8;return function(_0x2e866b){if(_0x2e866b){return _0xe28562[_0x9fea('0x25')](_0x188f03)[_0x9fea('0x27')](_0x2e866b);}};}function respondWithFilteredResult(_0x436a19,_0x274555){return function(_0x44bc4c){if(_0x44bc4c){var _0x3b819d=_0x44bc4c[_0x9fea('0x28')],_0x25be71=_0x274555[_0x9fea('0x29')],_0x115db4=_0x274555[_0x9fea('0x29')]+_0x274555[_0x9fea('0x2a')],_0x1c3680;if(_0x115db4>=_0x3b819d){_0x115db4=_0x3b819d;_0x1c3680=0xc8;}else{_0x1c3680=0xce;}_0x436a19[_0x9fea('0x25')](_0x1c3680);return _0x436a19[_0x9fea('0x2b')](_0x9fea('0x2c'),_0x25be71+'-'+_0x115db4+'/'+_0x3b819d)[_0x9fea('0x27')](_0x44bc4c);}return null;};}function patchUpdates(_0x26d6b0){return function(_0x11a610){try{jsonpatch[_0x9fea('0x2d')](_0x11a610,_0x26d6b0,!![]);}catch(_0x37ef38){return BPromise[_0x9fea('0x2e')](_0x37ef38);}return _0x11a610['save']();};}function saveUpdates(_0x4ae927,_0x5a2450){return function(_0x241897){if(_0x241897){return _0x241897[_0x9fea('0x2f')](_0x4ae927)[_0x9fea('0x30')](function(_0x2cedee){return _0x2cedee;});}return null;};}function removeEntity(_0x451418,_0x71784c){return function(_0x30fd17){if(_0x30fd17){return _0x30fd17[_0x9fea('0x31')]()[_0x9fea('0x30')](function(){_0x451418[_0x9fea('0x25')](0xcc)[_0x9fea('0x26')]();});}};}function handleEntityNotFound(_0x30f84e,_0x278e92){return function(_0x422ed3){if(!_0x422ed3){_0x30f84e[_0x9fea('0x24')](0x194);}return _0x422ed3;};}function handleError(_0x30c9da,_0x30f70d){_0x30f70d=_0x30f70d||0x1f4;return function(_0xfd3904){logger[_0x9fea('0x20')](_0xfd3904[_0x9fea('0x32')]);if(_0xfd3904[_0x9fea('0x33')]){delete _0xfd3904[_0x9fea('0x33')];}_0x30c9da['status'](_0x30f70d)[_0x9fea('0x34')](_0xfd3904);};}exports[_0x9fea('0x35')]=function(_0x457c34,_0x384d36){var _0x32a71d={},_0x258a25={},_0x146174={'count':0x0,'rows':[]};var _0x5c7eb6=_['map'](db[_0x9fea('0x36')]['rawAttributes'],function(_0x306f91){return{'name':_0x306f91[_0x9fea('0x37')],'type':_0x306f91[_0x9fea('0x38')]['key']};});_0x258a25[_0x9fea('0x39')]=_[_0x9fea('0x3a')](_0x5c7eb6,_0x9fea('0x33'));_0x258a25['query']=_[_0x9fea('0x3b')](_0x457c34[_0x9fea('0x3c')]);_0x258a25[_0x9fea('0x3d')]=_[_0x9fea('0x3e')](_0x258a25[_0x9fea('0x39')],_0x258a25[_0x9fea('0x3c')]);_0x32a71d['attributes']=_[_0x9fea('0x3e')](_0x258a25[_0x9fea('0x39')],qs['fields'](_0x457c34[_0x9fea('0x3c')][_0x9fea('0x3f')]));_0x32a71d['attributes']=_0x32a71d[_0x9fea('0x40')]['length']?_0x32a71d[_0x9fea('0x40')]:_0x258a25[_0x9fea('0x39')];if(!_0x457c34[_0x9fea('0x3c')][_0x9fea('0x41')](_0x9fea('0x42'))){_0x32a71d[_0x9fea('0x2a')]=qs[_0x9fea('0x2a')](_0x457c34[_0x9fea('0x3c')][_0x9fea('0x2a')]);_0x32a71d[_0x9fea('0x29')]=qs[_0x9fea('0x29')](_0x457c34[_0x9fea('0x3c')][_0x9fea('0x29')]);}_0x32a71d[_0x9fea('0x43')]=qs['sort'](_0x457c34[_0x9fea('0x3c')][_0x9fea('0x44')]);_0x32a71d[_0x9fea('0x45')]=qs[_0x9fea('0x3d')](_[_0x9fea('0x46')](_0x457c34[_0x9fea('0x3c')],_0x258a25['filters']),_0x5c7eb6);if(_0x457c34[_0x9fea('0x3c')][_0x9fea('0x47')]){_0x32a71d[_0x9fea('0x45')]=_[_0x9fea('0x48')](_0x32a71d[_0x9fea('0x45')],{'$or':_['map'](_0x5c7eb6,function(_0x4901f2){if(_0x4901f2['type']!=='VIRTUAL'){var _0x2b25bc={};_0x2b25bc[_0x4901f2[_0x9fea('0x33')]]={'$like':'%'+_0x457c34['query']['filter']+'%'};return _0x2b25bc;}})});}_0x32a71d=_[_0x9fea('0x48')]({},_0x32a71d,_0x457c34[_0x9fea('0x49')]);var _0x4e60ff={'where':_0x32a71d[_0x9fea('0x45')]};return db[_0x9fea('0x36')][_0x9fea('0x28')](_0x4e60ff)[_0x9fea('0x30')](function(_0xe89311){_0x146174[_0x9fea('0x28')]=_0xe89311;if(_0x457c34[_0x9fea('0x3c')]['includeAll']){_0x32a71d[_0x9fea('0x4a')]=[{'all':!![]}];}return db[_0x9fea('0x36')][_0x9fea('0x4b')](_0x32a71d);})[_0x9fea('0x30')](function(_0x51c061){_0x146174[_0x9fea('0x4c')]=_0x51c061;return _0x146174;})['then'](respondWithFilteredResult(_0x384d36,_0x32a71d))[_0x9fea('0x23')](handleError(_0x384d36,null));};exports[_0x9fea('0x4d')]=function(_0x174bbd,_0x4dc22e){var _0x15f5cc={'raw':![],'where':{'id':_0x174bbd[_0x9fea('0x4e')]['id']}},_0x4e4be1={};_0x4e4be1[_0x9fea('0x39')]=_[_0x9fea('0x3b')](db[_0x9fea('0x36')][_0x9fea('0x4f')]);_0x4e4be1['query']=_[_0x9fea('0x3b')](_0x174bbd['query']);_0x4e4be1[_0x9fea('0x3d')]=_[_0x9fea('0x3e')](_0x4e4be1[_0x9fea('0x39')],_0x4e4be1[_0x9fea('0x3c')]);_0x15f5cc[_0x9fea('0x40')]=_['intersection'](_0x4e4be1['model'],qs[_0x9fea('0x3f')](_0x174bbd[_0x9fea('0x3c')][_0x9fea('0x3f')]));_0x15f5cc[_0x9fea('0x40')]=_0x15f5cc['attributes'][_0x9fea('0x50')]?_0x15f5cc[_0x9fea('0x40')]:_0x4e4be1[_0x9fea('0x39')];if(_0x174bbd[_0x9fea('0x3c')][_0x9fea('0x51')]){_0x15f5cc['include']=[{'all':!![]}];}_0x15f5cc=_[_0x9fea('0x48')]({},_0x15f5cc,_0x174bbd[_0x9fea('0x49')]);return db[_0x9fea('0x36')][_0x9fea('0x52')](_0x15f5cc)[_0x9fea('0x30')](handleEntityNotFound(_0x4dc22e,null))[_0x9fea('0x30')](respondWithResult(_0x4dc22e,null))[_0x9fea('0x23')](handleError(_0x4dc22e,null));};exports[_0x9fea('0x2f')]=function(_0x4e764e,_0x332c62){if(_0x4e764e[_0x9fea('0x53')]['id']){delete _0x4e764e[_0x9fea('0x53')]['id'];}return db[_0x9fea('0x36')]['find']({'where':{'id':_0x4e764e[_0x9fea('0x4e')]['id']}})[_0x9fea('0x30')](handleEntityNotFound(_0x332c62,null))[_0x9fea('0x30')](saveUpdates(_0x4e764e[_0x9fea('0x53')],null))[_0x9fea('0x30')](respondWithResult(_0x332c62,null))[_0x9fea('0x23')](handleError(_0x332c62,null));};exports['addLogo']=function(_0x2c5fe4,_0x4c5fb4,_0x30a06e){if(_0x2c5fe4['file']&&_0x2c5fe4[_0x9fea('0x54')]['filename']){_0x2c5fe4[_0x9fea('0x53')][_0x9fea('0x55')]=_0x2c5fe4[_0x9fea('0x54')][_0x9fea('0x56')];}return db[_0x9fea('0x36')][_0x9fea('0x52')]({'where':{'id':_0x2c5fe4[_0x9fea('0x4e')]['id']}})[_0x9fea('0x30')](handleEntityNotFound(_0x4c5fb4,null))['then'](saveUpdates(_0x2c5fe4[_0x9fea('0x53')],null))[_0x9fea('0x30')](respondWithResult(_0x4c5fb4,null))[_0x9fea('0x23')](handleError(_0x4c5fb4,null));};exports[_0x9fea('0x57')]=function(_0x279402,_0x5eb0a4,_0x3edee4){if(_0x279402[_0x9fea('0x54')]&&_0x279402['file']['filename']){_0x279402['body'][_0x9fea('0x58')]=_0x279402[_0x9fea('0x54')][_0x9fea('0x56')];}return db[_0x9fea('0x36')][_0x9fea('0x52')]({'where':{'id':_0x279402[_0x9fea('0x4e')]['id']}})[_0x9fea('0x30')](handleEntityNotFound(_0x5eb0a4,null))['then'](saveUpdates(_0x279402[_0x9fea('0x53')],null))[_0x9fea('0x30')](respondWithResult(_0x5eb0a4,null))[_0x9fea('0x23')](handleError(_0x5eb0a4,null));};var utilLicense=require('../../config/license/util');exports[_0x9fea('0x59')]=function(_0x4b2d24,_0x5a9a84,_0x2c3d4e){var _0x1a9382=_0x9fea('0x5a');var _0x294ee1={'custom':![]};return utilLicense[_0x9fea('0x5b')]()['then'](function(_0x33860f){if(_0x33860f){_0x294ee1=_0x33860f;}return db[_0x9fea('0x36')][_0x9fea('0x52')]({'where':{'id':_0x4b2d24[_0x9fea('0x4e')]['id']},'attributes':[_0x9fea('0x55'),_0x9fea('0x58'),_0x9fea('0x5c'),'favicon',_0x9fea('0x5d'),_0x9fea('0x5e'),_0x9fea('0x5f'),_0x9fea('0x60')],'raw':!![]});})[_0x9fea('0x30')](handleEntityNotFound(_0x5a9a84,null))['then'](function(_0x535506){if(_0x535506){var _0x314598=_0x535506['logo']&&fs['existsSync'](path[_0x9fea('0x61')](config[_0x9fea('0x62')],_0x1a9382,_[_0x9fea('0x63')](_0x535506[_0x9fea('0x55')])))?path['join'](config[_0x9fea('0x62')],_0x1a9382,_[_0x9fea('0x63')](_0x535506['logo'])):path['join'](config['root'],_0x1a9382,_[_0x9fea('0x63')](_0x9fea('0x64')));var _0x46c1c7=_0x9fea('0x65')+_['upperFirst'](_0x9fea('0x55'));if(_0x535506[_0x46c1c7]||!_0x294ee1[_0x9fea('0x66')]){_0x314598=path['join'](config[_0x9fea('0x62')],_0x1a9382,_[_0x9fea('0x63')]('default_logo.svg'));}if(!fs[_0x9fea('0x67')](_0x314598)){throw new db['Sequelize'][(_0x9fea('0x1a'))](_[_0x9fea('0x68')]('logo')+_0x9fea('0x69'));}return _0x5a9a84[_0x9fea('0x6a')](_0x314598);}})[_0x9fea('0x23')](handleError(_0x5a9a84,null));};var utilLicense=require(_0x9fea('0x6b'));exports['getLogoLogin']=function(_0x37afb6,_0x3499c0,_0x259bad){var _0xb4b7a0=_0x9fea('0x5a');var _0x4827a0={'custom':![]};return utilLicense[_0x9fea('0x5b')]()[_0x9fea('0x30')](function(_0x3d871f){if(_0x3d871f){_0x4827a0=_0x3d871f;}return db['Setting'][_0x9fea('0x52')]({'where':{'id':_0x37afb6['params']['id']},'attributes':[_0x9fea('0x55'),_0x9fea('0x58'),'preferred','favicon',_0x9fea('0x5d'),_0x9fea('0x5e'),'defaultPreferred',_0x9fea('0x60')],'raw':!![]});})[_0x9fea('0x30')](handleEntityNotFound(_0x3499c0,null))['then'](function(_0x5f1410){if(_0x5f1410){var _0x3763ac=_0x5f1410[_0x9fea('0x58')]&&fs[_0x9fea('0x67')](path['join'](config[_0x9fea('0x62')],_0xb4b7a0,_[_0x9fea('0x63')](_0x5f1410[_0x9fea('0x58')])))?path['join'](config['root'],_0xb4b7a0,_[_0x9fea('0x63')](_0x5f1410[_0x9fea('0x58')])):path[_0x9fea('0x61')](config[_0x9fea('0x62')],_0xb4b7a0,_[_0x9fea('0x63')](_0x9fea('0x6c')));var _0x2a65f1='default'+_[_0x9fea('0x68')](_0x9fea('0x58'));if(_0x5f1410[_0x2a65f1]||!_0x4827a0[_0x9fea('0x66')]){_0x3763ac=path[_0x9fea('0x61')](config['root'],_0xb4b7a0,_[_0x9fea('0x63')]('default_loginLogo.svg'));}if(!fs[_0x9fea('0x67')](_0x3763ac)){throw new db['Sequelize'][(_0x9fea('0x1a'))](_[_0x9fea('0x68')](_0x9fea('0x58'))+_0x9fea('0x69'));}return _0x3499c0[_0x9fea('0x6a')](_0x3763ac);}})[_0x9fea('0x23')](handleError(_0x3499c0,null));};exports[_0x9fea('0x6d')]=function(_0x770bcd,_0x3ac43c){return db[_0x9fea('0x36')][_0x9fea('0x52')]({'where':{'id':_0x770bcd[_0x9fea('0x4e')]['id']},'attributes':['securePassword']})[_0x9fea('0x30')](respondWithResult(_0x3ac43c,null))[_0x9fea('0x23')](handleError(_0x3ac43c,null));};exports[_0x9fea('0x6e')]=function(_0x4e421c,_0x454bc2,_0x435e61){if(_0x4e421c[_0x9fea('0x54')]&&_0x4e421c[_0x9fea('0x54')]['filename']){_0x4e421c[_0x9fea('0x53')][_0x9fea('0x5c')]=_0x4e421c['file'][_0x9fea('0x56')];}return db[_0x9fea('0x36')]['find']({'where':{'id':_0x4e421c[_0x9fea('0x4e')]['id']}})[_0x9fea('0x30')](handleEntityNotFound(_0x454bc2,null))['then'](saveUpdates(_0x4e421c[_0x9fea('0x53')],null))[_0x9fea('0x30')](respondWithResult(_0x454bc2,null))[_0x9fea('0x23')](handleError(_0x454bc2,null));};var utilLicense=require('../../config/license/util');exports[_0x9fea('0x6f')]=function(_0x5757a6,_0x5dbba0,_0x1f6b5c){var _0x31b9b0=_0x9fea('0x5a');var _0x2a0fc5={'custom':![]};return utilLicense[_0x9fea('0x5b')]()['then'](function(_0x4c6b28){if(_0x4c6b28){_0x2a0fc5=_0x4c6b28;}return db[_0x9fea('0x36')][_0x9fea('0x52')]({'where':{'id':_0x5757a6[_0x9fea('0x4e')]['id']},'attributes':[_0x9fea('0x55'),_0x9fea('0x58'),'preferred',_0x9fea('0x70'),_0x9fea('0x5d'),'defaultLoginLogo',_0x9fea('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x5dbba0,null))[_0x9fea('0x30')](function(_0x2a5bf2){if(_0x2a5bf2){var _0x458d21=_0x2a5bf2[_0x9fea('0x5c')]&&fs[_0x9fea('0x67')](path[_0x9fea('0x61')](config['root'],_0x31b9b0,_[_0x9fea('0x63')](_0x2a5bf2[_0x9fea('0x5c')])))?path[_0x9fea('0x61')](config[_0x9fea('0x62')],_0x31b9b0,_[_0x9fea('0x63')](_0x2a5bf2['preferred'])):path[_0x9fea('0x61')](config['root'],_0x31b9b0,_[_0x9fea('0x63')](_0x9fea('0x71')));var _0x36ef2f=_0x9fea('0x65')+_[_0x9fea('0x68')]('preferred');if(_0x2a5bf2[_0x36ef2f]||!_0x2a0fc5[_0x9fea('0x66')]||!_0x2a0fc5[_0x9fea('0x5c')]){_0x458d21=path['join'](config[_0x9fea('0x62')],_0x31b9b0,_['toLower'](_0x9fea('0x71')));}if(!fs[_0x9fea('0x67')](_0x458d21)){throw new db['Sequelize'][(_0x9fea('0x1a'))](_[_0x9fea('0x68')](_0x9fea('0x5c'))+'\x20not\x20found');}return _0x5dbba0[_0x9fea('0x6a')](_0x458d21);}})['catch'](handleError(_0x5dbba0,null));};exports[_0x9fea('0x72')]=function(_0x323f4b,_0xe4130,_0xa8cc32){if(_0x323f4b[_0x9fea('0x54')]&&_0x323f4b[_0x9fea('0x54')]['filename']){_0x323f4b[_0x9fea('0x53')][_0x9fea('0x70')]=_0x323f4b[_0x9fea('0x54')]['filename'];}return db['Setting'][_0x9fea('0x52')]({'where':{'id':_0x323f4b[_0x9fea('0x4e')]['id']}})[_0x9fea('0x30')](handleEntityNotFound(_0xe4130,null))[_0x9fea('0x30')](saveUpdates(_0x323f4b[_0x9fea('0x53')],null))[_0x9fea('0x30')](respondWithResult(_0xe4130,null))[_0x9fea('0x23')](handleError(_0xe4130,null));};var utilLicense=require('../../config/license/util');exports[_0x9fea('0x73')]=function(_0x5236a7,_0x507c7f,_0x122772){var _0x41195a=_0x9fea('0x5a');var _0x3d8d2b={'custom':![]};return utilLicense[_0x9fea('0x5b')]()[_0x9fea('0x30')](function(_0xce2358){if(_0xce2358){_0x3d8d2b=_0xce2358;}return db['Setting'][_0x9fea('0x52')]({'where':{'id':_0x5236a7[_0x9fea('0x4e')]['id']},'attributes':[_0x9fea('0x55'),'loginLogo',_0x9fea('0x5c'),'favicon',_0x9fea('0x5d'),_0x9fea('0x5e'),_0x9fea('0x5f'),_0x9fea('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x507c7f,null))['then'](function(_0x39b5b4){if(_0x39b5b4){var _0x4b40a7=_0x39b5b4[_0x9fea('0x70')]&&fs[_0x9fea('0x67')](path[_0x9fea('0x61')](config['root'],_0x41195a,_[_0x9fea('0x63')](_0x39b5b4[_0x9fea('0x70')])))?path[_0x9fea('0x61')](config[_0x9fea('0x62')],_0x41195a,_['toLower'](_0x39b5b4[_0x9fea('0x70')])):path[_0x9fea('0x61')](config['root'],_0x41195a,_[_0x9fea('0x63')]('default_favicon.ico'));var _0x4c61c5='default'+_[_0x9fea('0x68')](_0x9fea('0x70'));if(_0x39b5b4[_0x4c61c5]||!_0x3d8d2b['custom']){_0x4b40a7=path[_0x9fea('0x61')](config[_0x9fea('0x62')],_0x41195a,_[_0x9fea('0x63')](_0x9fea('0x74')));}if(!fs['existsSync'](_0x4b40a7)){throw new db[(_0x9fea('0x19'))][(_0x9fea('0x1a'))](_[_0x9fea('0x68')](_0x9fea('0x70'))+_0x9fea('0x69'));}return _0x507c7f[_0x9fea('0x6a')](_0x4b40a7);}})[_0x9fea('0x23')](handleError(_0x507c7f,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c4089af..fdd91ef 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 _0x6c69=['../../config/logger','api','moment','rimraf','../../config/environment','./setting.attributes','exports','Setting','settings','lodash'];(function(_0x23d72e,_0x128a4f){var _0xb0aa78=function(_0x18df60){while(--_0x18df60){_0x23d72e['push'](_0x23d72e['shift']());}};_0xb0aa78(++_0x128a4f);}(_0x6c69,0x117));var _0x96c6=function(_0x2b5062,_0x12b234){_0x2b5062=_0x2b5062-0x0;var _0x15b1e1=_0x6c69[_0x2b5062];return _0x15b1e1;};'use strict';var _=require(_0x96c6('0x0'));var util=require('util');var logger=require(_0x96c6('0x1'))(_0x96c6('0x2'));var moment=require(_0x96c6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x96c6('0x4'));var config=require(_0x96c6('0x5'));var attributes=require(_0x96c6('0x6'));module[_0x96c6('0x7')]=function(_0x282d78,_0x1ddd05){return _0x282d78['define'](_0x96c6('0x8'),attributes,{'tableName':_0x96c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3364=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','lodash'];(function(_0x2ebacc,_0xdc5ab3){var _0x44e8ad=function(_0x300190){while(--_0x300190){_0x2ebacc['push'](_0x2ebacc['shift']());}};_0x44e8ad(++_0xdc5ab3);}(_0x3364,0x1a3));var _0x4336=function(_0x163a55,_0x1ce9ba){_0x163a55=_0x163a55-0x0;var _0x190622=_0x3364[_0x163a55];return _0x190622;};'use strict';var _=require(_0x4336('0x0'));var util=require(_0x4336('0x1'));var logger=require(_0x4336('0x2'))(_0x4336('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4336('0x4'));var fs=require('fs');var path=require(_0x4336('0x5'));var rimraf=require(_0x4336('0x6'));var config=require(_0x4336('0x7'));var attributes=require(_0x4336('0x8'));module[_0x4336('0x9')]=function(_0x42fea6,_0x45e0e3){return _0x42fea6['define']('Setting',attributes,{'tableName':'settings','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 37bed41..8374342 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 _0x46b7=['stringify','error','Setting,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x46b7,0x1bd));var _0x746b=function(_0xedc36e,_0x2918c6){_0xedc36e=_0xedc36e-0x0;var _0x4e365e=_0x46b7[_0xedc36e];return _0x4e365e;};'use strict';var _=require(_0x746b('0x0'));var util=require(_0x746b('0x1'));var moment=require(_0x746b('0x2'));var BPromise=require(_0x746b('0x3'));var rs=require(_0x746b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x746b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x746b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x746b('0x7')][_0x746b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc648df,_0x412af7,_0xb17e36){return new BPromise(function(_0x55bec8,_0x4d801d){return client[_0x746b('0x9')](_0xc648df,_0xb17e36)[_0x746b('0xa')](function(_0x557b31){logger[_0x746b('0xb')]('Setting,\x20%s,\x20%s',_0x412af7,_0x746b('0xc'));logger[_0x746b('0xd')](_0x746b('0xe'),_0x412af7,'request\x20sent',JSON[_0x746b('0xf')](_0x557b31));if(_0x557b31[_0x746b('0x10')]){if(_0x557b31[_0x746b('0x10')]['code']===0x1f4){logger['error'](_0x746b('0x11'),_0x412af7,_0x557b31[_0x746b('0x10')]['message']);return _0x4d801d(_0x557b31['error'][_0x746b('0x12')]);}logger[_0x746b('0x10')](_0x746b('0x11'),_0x412af7,_0x557b31['error'][_0x746b('0x12')]);return _0x55bec8(_0x557b31['error']['message']);}else{logger[_0x746b('0xb')]('Setting,\x20%s,\x20%s',_0x412af7,'request\x20sent');_0x55bec8(_0x557b31['result'][_0x746b('0x12')]);}})[_0x746b('0x13')](function(_0xbdca7d){logger[_0x746b('0x10')]('Setting,\x20%s,\x20%s',_0x412af7,_0xbdca7d);_0x4d801d(_0xbdca7d);});});} \ No newline at end of file +var _0x9c93=['http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1ed2bc,_0x156791){var _0x25fa6a=function(_0x104f8b){while(--_0x104f8b){_0x1ed2bc['push'](_0x1ed2bc['shift']());}};_0x25fa6a(++_0x156791);}(_0x9c93,0x11d));var _0x39c9=function(_0x9ca21f,_0x437553){_0x9ca21f=_0x9ca21f-0x0;var _0x9ef54b=_0x9c93[_0x9ca21f];return _0x9ef54b;};'use strict';var _=require(_0x39c9('0x0'));var util=require(_0x39c9('0x1'));var moment=require(_0x39c9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39c9('0x3'));var db=require(_0x39c9('0x4'))['db'];var utils=require(_0x39c9('0x5'));var logger=require(_0x39c9('0x6'))(_0x39c9('0x7'));var config=require('../../config/environment');var jayson=require(_0x39c9('0x8'));var client=jayson['client'][_0x39c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5925c0,_0x192a4d,_0x1f5354){return new BPromise(function(_0x4b6f07,_0x51ec32){return client[_0x39c9('0xa')](_0x5925c0,_0x1f5354)[_0x39c9('0xb')](function(_0x186f4e){logger[_0x39c9('0xc')]('Setting,\x20%s,\x20%s',_0x192a4d,_0x39c9('0xd'));logger['debug'](_0x39c9('0xe'),_0x192a4d,_0x39c9('0xd'),JSON[_0x39c9('0xf')](_0x186f4e));if(_0x186f4e[_0x39c9('0x10')]){if(_0x186f4e[_0x39c9('0x10')][_0x39c9('0x11')]===0x1f4){logger[_0x39c9('0x10')](_0x39c9('0x12'),_0x192a4d,_0x186f4e[_0x39c9('0x10')]['message']);return _0x51ec32(_0x186f4e[_0x39c9('0x10')][_0x39c9('0x13')]);}logger[_0x39c9('0x10')](_0x39c9('0x12'),_0x192a4d,_0x186f4e[_0x39c9('0x10')][_0x39c9('0x13')]);return _0x4b6f07(_0x186f4e['error'][_0x39c9('0x13')]);}else{logger['info'](_0x39c9('0x12'),_0x192a4d,_0x39c9('0xd'));_0x4b6f07(_0x186f4e[_0x39c9('0x14')][_0x39c9('0x13')]);}})['catch'](function(_0xb22676){logger['error']('Setting,\x20%s,\x20%s',_0x192a4d,_0xb22676);_0x51ec32(_0xb22676);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 864884f..45ec1f0 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 _0x8d8a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','/:id/applications','addApplications','put','update','delete','removeDispositions','removeAnswers','multer','util','express'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x8d8a,0x189));var _0xa8d8=function(_0x483a38,_0x2bf2c6){_0x483a38=_0x483a38-0x0;var _0x5239d2=_0x8d8a[_0x483a38];return _0x5239d2;};'use strict';var multer=require(_0xa8d8('0x0'));var util=require(_0xa8d8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa8d8('0x2'));var router=express[_0xa8d8('0x3')]();var auth=require(_0xa8d8('0x4'));var interaction=require(_0xa8d8('0x5'));var config=require(_0xa8d8('0x6'));var controller=require(_0xa8d8('0x7'));router[_0xa8d8('0x8')]('/',auth[_0xa8d8('0x9')](),controller[_0xa8d8('0xa')]);router['get'](_0xa8d8('0xb'),auth['isAuthenticated'](),controller[_0xa8d8('0xc')]);router[_0xa8d8('0x8')](_0xa8d8('0xd'),auth[_0xa8d8('0x9')](),controller[_0xa8d8('0xe')]);router['get'](_0xa8d8('0xf'),auth[_0xa8d8('0x9')](),controller[_0xa8d8('0x10')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xa8d8('0x11')]);router[_0xa8d8('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0xa8d8('0x12')]);router[_0xa8d8('0x8')](_0xa8d8('0x13'),auth[_0xa8d8('0x9')](),controller['getInteractions']);router['get'](_0xa8d8('0x14'),controller[_0xa8d8('0x15')]);router[_0xa8d8('0x8')](_0xa8d8('0x16'),auth[_0xa8d8('0x9')](),controller[_0xa8d8('0x17')]);router[_0xa8d8('0x18')]('/',auth[_0xa8d8('0x9')](),controller[_0xa8d8('0x19')]);router[_0xa8d8('0x18')](_0xa8d8('0xf'),auth[_0xa8d8('0x9')](),controller[_0xa8d8('0x1a')]);router[_0xa8d8('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xa8d8('0x1b')]);router[_0xa8d8('0x18')]('/:id/notify',controller[_0xa8d8('0x1c')]);router[_0xa8d8('0x18')](_0xa8d8('0x1d'),auth['isAuthenticated'](),controller[_0xa8d8('0x1e')]);router[_0xa8d8('0x18')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xa8d8('0x18')](_0xa8d8('0x14'),controller['status']);router[_0xa8d8('0x18')](_0xa8d8('0x16'),auth[_0xa8d8('0x9')](),controller['addAgents']);router[_0xa8d8('0x1f')](_0xa8d8('0xd'),auth[_0xa8d8('0x9')](),controller[_0xa8d8('0x20')]);router[_0xa8d8('0x21')](_0xa8d8('0xd'),auth[_0xa8d8('0x9')](),controller['destroy']);router[_0xa8d8('0x21')](_0xa8d8('0xf'),auth[_0xa8d8('0x9')](),controller[_0xa8d8('0x22')]);router[_0xa8d8('0x21')]('/:id/canned_answers',auth[_0xa8d8('0x9')](),controller[_0xa8d8('0x23')]);router[_0xa8d8('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xa2b5=['getInteractions','statusGet','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','/:id/status','status','addAgents','put','update','destroy','delete','removeDispositions','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0xa2b5,0xb2));var _0x5a2b=function(_0x2548b3,_0x2bd6c7){_0x2548b3=_0x2548b3-0x0;var _0x4c9b6f=_0xa2b5[_0x2548b3];return _0x4c9b6f;};'use strict';var multer=require('multer');var util=require(_0x5a2b('0x0'));var path=require('path');var timeout=require(_0x5a2b('0x1'));var express=require('express');var router=express[_0x5a2b('0x2')]();var auth=require(_0x5a2b('0x3'));var interaction=require(_0x5a2b('0x4'));var config=require(_0x5a2b('0x5'));var controller=require(_0x5a2b('0x6'));router[_0x5a2b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5a2b('0x7')](_0x5a2b('0x8'),auth[_0x5a2b('0x9')](),controller[_0x5a2b('0xa')]);router['get'](_0x5a2b('0xb'),auth[_0x5a2b('0x9')](),controller[_0x5a2b('0xc')]);router[_0x5a2b('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x5a2b('0x7')](_0x5a2b('0xd'),auth[_0x5a2b('0x9')](),controller[_0x5a2b('0xe')]);router[_0x5a2b('0x7')](_0x5a2b('0xf'),auth[_0x5a2b('0x9')](),controller[_0x5a2b('0x10')]);router['get']('/:id/interactions',auth[_0x5a2b('0x9')](),controller[_0x5a2b('0x11')]);router[_0x5a2b('0x7')]('/:id/status',controller[_0x5a2b('0x12')]);router[_0x5a2b('0x7')](_0x5a2b('0x13'),auth['isAuthenticated'](),controller[_0x5a2b('0x14')]);router[_0x5a2b('0x15')]('/',auth[_0x5a2b('0x9')](),controller[_0x5a2b('0x16')]);router[_0x5a2b('0x15')](_0x5a2b('0x17'),auth[_0x5a2b('0x9')](),controller[_0x5a2b('0x18')]);router['post'](_0x5a2b('0xd'),auth['isAuthenticated'](),controller[_0x5a2b('0x19')]);router[_0x5a2b('0x15')](_0x5a2b('0x1a'),controller[_0x5a2b('0x1b')]);router[_0x5a2b('0x15')](_0x5a2b('0xf'),auth['isAuthenticated'](),controller[_0x5a2b('0x1c')]);router[_0x5a2b('0x15')]('/:id/send',auth[_0x5a2b('0x9')](),controller[_0x5a2b('0x1d')]);router[_0x5a2b('0x15')](_0x5a2b('0x1e'),controller[_0x5a2b('0x1f')]);router[_0x5a2b('0x15')]('/:id/users',auth[_0x5a2b('0x9')](),controller[_0x5a2b('0x20')]);router[_0x5a2b('0x21')](_0x5a2b('0xb'),auth[_0x5a2b('0x9')](),controller[_0x5a2b('0x22')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5a2b('0x23')]);router[_0x5a2b('0x24')]('/:id/dispositions',auth[_0x5a2b('0x9')](),controller[_0x5a2b('0x25')]);router[_0x5a2b('0x24')](_0x5a2b('0xd'),auth[_0x5a2b('0x9')](),controller['removeAnswers']);router[_0x5a2b('0x24')](_0x5a2b('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x5a2b('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 4aca38f..295a7ed 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 _0x5362=['infobip','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','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','csc'];(function(_0x426395,_0x140fa0){var _0x6f3597=function(_0x3c0611){while(--_0x3c0611){_0x426395['push'](_0x426395['shift']());}};_0x6f3597(++_0x140fa0);}(_0x5362,0x16d));var _0x2536=function(_0x26d667,_0x18234c){_0x26d667=_0x26d667-0x0;var _0x260928=_0x5362[_0x26d667];return _0x260928;};'use strict';var Sequelize=require(_0x2536('0x0'));var rs=require(_0x2536('0x1'));module[_0x2536('0x2')]={'name':{'type':Sequelize[_0x2536('0x3')],'unique':_0x2536('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x2536('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2536('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2536('0x3')],'defaultValue':function(){return rs[_0x2536('0x5')]();}},'phone':{'type':Sequelize[_0x2536('0x3')]},'type':{'type':Sequelize[_0x2536('0x6')](_0x2536('0x7'),_0x2536('0x8'),'connectel',_0x2536('0x9'),_0x2536('0xa'),_0x2536('0xb'),_0x2536('0xc'),_0x2536('0xd'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x2536('0x3')]},'authToken':{'type':Sequelize[_0x2536('0x3')]},'smsMethod':{'type':Sequelize[_0x2536('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2536('0x3')]},'apiKey':{'type':Sequelize[_0x2536('0x3')]},'senderString':{'type':Sequelize[_0x2536('0x3')]},'deliveryReport':{'type':Sequelize[_0x2536('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x2536('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2536('0xf')],'defaultValue':function(){return _0x2536('0x10');}},'notificationSound':{'type':Sequelize[_0x2536('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2536('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2536('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2536('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2536('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2536('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2536('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x2536('0xe')],'defaultValue':![],'comment':_0x2536('0x13'),'set':function(_0x893b55){if(!_0x893b55)this[_0x2536('0x14')]('mandatoryDispositionPauseId',null);this[_0x2536('0x14')]('mandatoryDisposition',_0x893b55);}}}; \ No newline at end of file +var _0xff76=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','clickatell','infobip','intelepeer','TEXT'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xff76,0x1d3));var _0x6ff7=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xff76[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x6ff7('0x0'));var rs=require(_0x6ff7('0x1'));module[_0x6ff7('0x2')]={'name':{'type':Sequelize[_0x6ff7('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x6ff7('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6ff7('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6ff7('0x5')]('twilio',_0x6ff7('0x6'),_0x6ff7('0x7'),_0x6ff7('0x8'),'plivo',_0x6ff7('0x9'),'csc',_0x6ff7('0xa'),_0x6ff7('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x6ff7('0x3')]},'authToken':{'type':Sequelize[_0x6ff7('0x3')]},'smsMethod':{'type':Sequelize[_0x6ff7('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6ff7('0x3')]},'password':{'type':Sequelize[_0x6ff7('0x3')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x6ff7('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x6ff7('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6ff7('0xc')],'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[_0x6ff7('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ff7('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6ff7('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6ff7('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ff7('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ff7('0xe')],'comment':_0x6ff7('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x6ff7('0xd')],'defaultValue':![],'comment':_0x6ff7('0x10'),'set':function(_0x1f4d10){if(!_0x1f4d10)this[_0x6ff7('0x11')](_0x6ff7('0x12'),null);this[_0x6ff7('0x11')](_0x6ff7('0x13'),_0x1f4d10);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 0292317..ede45c0 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(_0x19b386,_0x5b5238){var _0xcf2e1e=function(_0x1ae29f){while(--_0x1ae29f){_0x19b386['push'](_0x19b386['shift']());}};_0xcf2e1e(++_0x5b5238);}(_0x7a54,0x106));var _0x47a5=function(_0x5d5a70,_0x4b0998){_0x5d5a70=_0x5d5a70-0x0;var _0x36f23a=_0x7a54[_0x5d5a70];return _0x36f23a;};'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(_0xe53033,_0x191b7b){var _0x544dbf=function(_0x46b3f3){while(--_0x46b3f3){_0xe53033['push'](_0xe53033['shift']());}};_0x544dbf(++_0x191b7b);}(_0x7a54,0x106));var _0x47a5=function(_0x4f50d5,_0x549563){_0x4f50d5=_0x4f50d5-0x0;var _0x103c33=_0x7a54[_0x4f50d5];return _0x103c33;};'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 9211376..bb6972f 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 _0x9af5=['../../mysqldb','SmsAccount','save','remove','emit','hook','exports','events'];(function(_0x34b5ca,_0x594010){var _0x2d72c0=function(_0x4ae1d3){while(--_0x4ae1d3){_0x34b5ca['push'](_0x34b5ca['shift']());}};_0x2d72c0(++_0x594010);}(_0x9af5,0xa7));var _0x59af=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9af5[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x59af('0x0'));var SmsAccount=require(_0x59af('0x1'))['db'][_0x59af('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x59af('0x3'),'afterUpdate':'update','afterDestroy':_0x59af('0x4')};function emitEvent(_0x73937c){return function(_0x406a3b,_0x21d625,_0x162a86){SmsAccountEvents[_0x59af('0x5')](_0x73937c+':'+_0x406a3b['id'],_0x406a3b);SmsAccountEvents[_0x59af('0x5')](_0x73937c,_0x406a3b);_0x162a86(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x59af('0x6')](e,emitEvent(event));}}module[_0x59af('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x95a4=['hook','exports','events','../../mysqldb','SmsAccount','save','update','remove','emit'];(function(_0x42c91d,_0x5dd75e){var _0x29d5fe=function(_0x26a509){while(--_0x26a509){_0x42c91d['push'](_0x42c91d['shift']());}};_0x29d5fe(++_0x5dd75e);}(_0x95a4,0x6e));var _0x495a=function(_0x4a452d,_0x3d27a6){_0x4a452d=_0x4a452d-0x0;var _0x45fb05=_0x95a4[_0x4a452d];return _0x45fb05;};'use strict';var EventEmitter=require(_0x495a('0x0'));var SmsAccount=require(_0x495a('0x1'))['db'][_0x495a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x495a('0x3'),'afterUpdate':_0x495a('0x4'),'afterDestroy':_0x495a('0x5')};function emitEvent(_0x1eee3e){return function(_0x4b4a3d,_0x570013,_0x24039c){SmsAccountEvents[_0x495a('0x6')](_0x1eee3e+':'+_0x4b4a3d['id'],_0x4b4a3d);SmsAccountEvents[_0x495a('0x6')](_0x1eee3e,_0x4b4a3d);_0x24039c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x495a('0x7')](e,emitEvent(event));}}module[_0x495a('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 749c264..cd747c5 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(_0x3e7eee,_0x476514){var _0xa4485=function(_0x3d3825){while(--_0x3d3825){_0x3e7eee['push'](_0x3e7eee['shift']());}};_0xa4485(++_0x476514);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x24a378,_0x443d34){var _0x43c588=function(_0x2b951a){while(--_0x2b951a){_0x24a378['push'](_0x24a378['shift']());}};_0x43c588(++_0x443d34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 13c56ed..0d79b60 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 _0xbc54=['info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','map','model','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register'];(function(_0x274222,_0x20bb9a){var _0x34a71f=function(_0xd185ee){while(--_0xd185ee){_0x274222['push'](_0x274222['shift']());}};_0x34a71f(++_0x20bb9a);}(_0xbc54,0x79));var _0x4bc5=function(_0x3d8c9b,_0x49e6ea){_0x3d8c9b=_0x3d8c9b-0x0;var _0xc31fc0=_0xbc54[_0x3d8c9b];return _0xc31fc0;};'use strict';var _=require(_0x4bc5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4bc5('0x1'));var rs=require(_0x4bc5('0x2'));var fs=require('fs');var Redis=require(_0x4bc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4bc5('0x4'))(_0x4bc5('0x5'));var config=require('../../config/environment');var jayson=require(_0x4bc5('0x6'));var client=jayson[_0x4bc5('0x7')][_0x4bc5('0x8')]({'port':0x232a});config['redis']=_[_0x4bc5('0x9')](config[_0x4bc5('0xa')],{'host':_0x4bc5('0xb'),'port':0x18eb});var socket=require(_0x4bc5('0xc'))(new Redis(config[_0x4bc5('0xa')]));require(_0x4bc5('0xd'))[_0x4bc5('0xe')](socket);function respondWithRpcPromise(_0x490448,_0x25aa91,_0x1bed49){return new BPromise(function(_0x493106,_0x3c5d2a){return client['request'](_0x490448,_0x1bed49)['then'](function(_0x8d25a7){logger[_0x4bc5('0xf')]('SmsAccount,\x20%s,\x20%s',_0x25aa91,_0x4bc5('0x10'));logger[_0x4bc5('0x11')](_0x4bc5('0x12'),_0x25aa91,_0x4bc5('0x10'),JSON[_0x4bc5('0x13')](_0x8d25a7));if(_0x8d25a7[_0x4bc5('0x14')]){if(_0x8d25a7[_0x4bc5('0x14')][_0x4bc5('0x15')]===0x1f4){logger[_0x4bc5('0x14')](_0x4bc5('0x16'),_0x25aa91,_0x8d25a7[_0x4bc5('0x14')]['message']);return _0x3c5d2a(_0x8d25a7[_0x4bc5('0x14')][_0x4bc5('0x17')]);}logger[_0x4bc5('0x14')](_0x4bc5('0x16'),_0x25aa91,_0x8d25a7[_0x4bc5('0x14')]['message']);return _0x493106(_0x8d25a7['error'][_0x4bc5('0x17')]);}else{logger[_0x4bc5('0xf')](_0x4bc5('0x16'),_0x25aa91,_0x4bc5('0x10'));_0x493106(_0x8d25a7[_0x4bc5('0x18')][_0x4bc5('0x17')]);}})[_0x4bc5('0x19')](function(_0x18fc3d){logger[_0x4bc5('0x14')](_0x4bc5('0x16'),_0x25aa91,_0x18fc3d);_0x3c5d2a(_0x18fc3d);});});}exports[_0x4bc5('0x1a')]=function(_0x44516a){var _0x3194e8=this;return new Promise(function(_0x411454,_0x3c6b7d){return db[_0x4bc5('0x1b')]['find']({'raw':_0x44516a[_0x4bc5('0x1c')]?_0x44516a[_0x4bc5('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x44516a[_0x4bc5('0x1c')]?_0x44516a[_0x4bc5('0x1c')][_0x4bc5('0x1d')]||null:null,'attributes':_0x44516a['options']?_0x44516a['options'][_0x4bc5('0x1e')]||null:null,'include':_0x44516a[_0x4bc5('0x1c')]?_0x44516a[_0x4bc5('0x1c')][_0x4bc5('0x1f')]?_[_0x4bc5('0x20')](_0x44516a[_0x4bc5('0x1c')][_0x4bc5('0x1f')],function(_0x210bbf){return{'model':db[_0x210bbf[_0x4bc5('0x21')]],'as':_0x210bbf['as'],'attributes':_0x210bbf['attributes'],'include':_0x210bbf[_0x4bc5('0x1f')]?_['map'](_0x210bbf[_0x4bc5('0x1f')],function(_0x9c4c6d){return{'model':db[_0x9c4c6d[_0x4bc5('0x21')]],'as':_0x9c4c6d['as'],'attributes':_0x9c4c6d[_0x4bc5('0x1e')],'include':_0x9c4c6d['include']?_['map'](_0x9c4c6d[_0x4bc5('0x1f')],function(_0x1398a6){return{'model':db[_0x1398a6['model']],'as':_0x1398a6['as'],'attributes':_0x1398a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5436f7){logger[_0x4bc5('0xf')](_0x4bc5('0x1a'),_0x44516a);logger[_0x4bc5('0x11')](_0x4bc5('0x1a'),_0x44516a,JSON[_0x4bc5('0x13')](_0x5436f7));_0x411454(_0x5436f7);})[_0x4bc5('0x19')](function(_0x4a7d9f){logger[_0x4bc5('0x14')]('ShowSmsAccount',_0x4a7d9f[_0x4bc5('0x17')],_0x44516a);_0x3c6b7d(_0x3194e8[_0x4bc5('0x14')](0x1f4,_0x4a7d9f['message']));});});}; \ No newline at end of file +var _0x54f5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','register','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring'];(function(_0xaf9c97,_0x3acbd4){var _0x42ad92=function(_0x5a3b62){while(--_0x5a3b62){_0xaf9c97['push'](_0xaf9c97['shift']());}};_0x42ad92(++_0x3acbd4);}(_0x54f5,0x7c));var _0x554f=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x54f5[_0xfc406a];return _0x395473;};'use strict';var _=require('lodash');var util=require(_0x554f('0x0'));var moment=require(_0x554f('0x1'));var BPromise=require(_0x554f('0x2'));var rs=require(_0x554f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x554f('0x4'))['db'];var utils=require(_0x554f('0x5'));var logger=require(_0x554f('0x6'))(_0x554f('0x7'));var config=require(_0x554f('0x8'));var jayson=require(_0x554f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x554f('0xa')]=_['defaults'](config[_0x554f('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x554f('0xa')]));require('./smsAccount.socket')[_0x554f('0xb')](socket);function respondWithRpcPromise(_0x4f61e7,_0x473281,_0x50cd66){return new BPromise(function(_0x1bac5c,_0x108dc8){return client['request'](_0x4f61e7,_0x50cd66)['then'](function(_0x5c3a60){logger[_0x554f('0xc')](_0x554f('0xd'),_0x473281,'request\x20sent');logger[_0x554f('0xe')](_0x554f('0xf'),_0x473281,_0x554f('0x10'),JSON[_0x554f('0x11')](_0x5c3a60));if(_0x5c3a60[_0x554f('0x12')]){if(_0x5c3a60['error'][_0x554f('0x13')]===0x1f4){logger[_0x554f('0x12')](_0x554f('0xd'),_0x473281,_0x5c3a60[_0x554f('0x12')]['message']);return _0x108dc8(_0x5c3a60[_0x554f('0x12')][_0x554f('0x14')]);}logger[_0x554f('0x12')]('SmsAccount,\x20%s,\x20%s',_0x473281,_0x5c3a60[_0x554f('0x12')][_0x554f('0x14')]);return _0x1bac5c(_0x5c3a60[_0x554f('0x12')][_0x554f('0x14')]);}else{logger[_0x554f('0xc')](_0x554f('0xd'),_0x473281,_0x554f('0x10'));_0x1bac5c(_0x5c3a60[_0x554f('0x15')][_0x554f('0x14')]);}})[_0x554f('0x16')](function(_0x57f8a5){logger[_0x554f('0x12')](_0x554f('0xd'),_0x473281,_0x57f8a5);_0x108dc8(_0x57f8a5);});});}exports[_0x554f('0x17')]=function(_0x5caec6){var _0x4a9a6c=this;return new Promise(function(_0x552744,_0xff6d07){return db[_0x554f('0x18')][_0x554f('0x19')]({'raw':_0x5caec6[_0x554f('0x1a')]?_0x5caec6['options'][_0x554f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5caec6[_0x554f('0x1a')]?_0x5caec6[_0x554f('0x1a')]['where']||null:null,'attributes':_0x5caec6['options']?_0x5caec6[_0x554f('0x1a')][_0x554f('0x1c')]||null:null,'include':_0x5caec6['options']?_0x5caec6['options'][_0x554f('0x1d')]?_[_0x554f('0x1e')](_0x5caec6['options'][_0x554f('0x1d')],function(_0x5443d2){return{'model':db[_0x5443d2[_0x554f('0x1f')]],'as':_0x5443d2['as'],'attributes':_0x5443d2['attributes'],'include':_0x5443d2[_0x554f('0x1d')]?_['map'](_0x5443d2[_0x554f('0x1d')],function(_0x5b754a){return{'model':db[_0x5b754a[_0x554f('0x1f')]],'as':_0x5b754a['as'],'attributes':_0x5b754a['attributes'],'include':_0x5b754a['include']?_[_0x554f('0x1e')](_0x5b754a[_0x554f('0x1d')],function(_0x78216b){return{'model':db[_0x78216b[_0x554f('0x1f')]],'as':_0x78216b['as'],'attributes':_0x78216b[_0x554f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46e947){logger[_0x554f('0xc')](_0x554f('0x17'),_0x5caec6);logger['debug'](_0x554f('0x17'),_0x5caec6,JSON[_0x554f('0x11')](_0x46e947));_0x552744(_0x46e947);})[_0x554f('0x16')](function(_0x11f637){logger[_0x554f('0x12')](_0x554f('0x17'),_0x11f637[_0x554f('0x14')],_0x5caec6);_0xff6d07(_0x4a9a6c[_0x554f('0x12')](0x1f4,_0x11f637[_0x554f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f1b12ac..845c581 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 _0x0d01=['save','remove','update','emit','removeListener','register','length','./smsAccount.events'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0x0d01,0x9f));var _0x10d0=function(_0x2177ee,_0x18436c){_0x2177ee=_0x2177ee-0x0;var _0x447615=_0x0d01[_0x2177ee];return _0x447615;};'use strict';var SmsAccountEvents=require(_0x10d0('0x0'));var events=[_0x10d0('0x1'),_0x10d0('0x2'),_0x10d0('0x3')];function createListener(_0x5e3b51,_0x1c1a43){return function(_0x24594b){_0x1c1a43[_0x10d0('0x4')](_0x5e3b51,_0x24594b);};}function removeListener(_0x4e08e3,_0x4f66f5){return function(){SmsAccountEvents[_0x10d0('0x5')](_0x4e08e3,_0x4f66f5);};}exports[_0x10d0('0x6')]=function(_0x4a5e6d){for(var _0x458cca=0x0,_0x3c6343=events[_0x10d0('0x7')];_0x458cca<_0x3c6343;_0x458cca++){var _0x8bed1=events[_0x458cca];var _0x303b53=createListener('smsAccount:'+_0x8bed1,_0x4a5e6d);SmsAccountEvents['on'](_0x8bed1,_0x303b53);}}; \ No newline at end of file +var _0x98e7=['length','smsAccount:','save','remove','update','emit','register'];(function(_0xbedcf5,_0x1820af){var _0x319194=function(_0x5b78d2){while(--_0x5b78d2){_0xbedcf5['push'](_0xbedcf5['shift']());}};_0x319194(++_0x1820af);}(_0x98e7,0x1c2));var _0x798e=function(_0x52dfa9,_0x306d3f){_0x52dfa9=_0x52dfa9-0x0;var _0xdfaa57=_0x98e7[_0x52dfa9];return _0xdfaa57;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x798e('0x0'),_0x798e('0x1'),_0x798e('0x2')];function createListener(_0x4478b2,_0x320e4d){return function(_0x1571c4){_0x320e4d[_0x798e('0x3')](_0x4478b2,_0x1571c4);};}function removeListener(_0x5e750c,_0x808ffe){return function(){SmsAccountEvents['removeListener'](_0x5e750c,_0x808ffe);};}exports[_0x798e('0x4')]=function(_0x1b5f85){for(var _0x2119a8=0x0,_0x155f0c=events[_0x798e('0x5')];_0x2119a8<_0x155f0c;_0x2119a8++){var _0x1a60d5=events[_0x2119a8];var _0x4c48db=createListener(_0x798e('0x6')+_0x1a60d5,_0x1b5f85);SmsAccountEvents['on'](_0x1a60d5,_0x4c48db);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index a0820b8..22f68f3 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 _0xf53d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3544c8,_0x3449b1){var _0x306613=function(_0x45059f){while(--_0x45059f){_0x3544c8['push'](_0x3544c8['shift']());}};_0x306613(++_0x3449b1);}(_0xf53d,0x178));var _0xdf53=function(_0x5c16b8,_0x3b9c70){_0x5c16b8=_0x5c16b8-0x0;var _0x34a8de=_0xf53d[_0x5c16b8];return _0x34a8de;};'use strict';var multer=require(_0xdf53('0x0'));var util=require(_0xdf53('0x1'));var path=require(_0xdf53('0x2'));var timeout=require(_0xdf53('0x3'));var express=require(_0xdf53('0x4'));var router=express[_0xdf53('0x5')]();var auth=require(_0xdf53('0x6'));var interaction=require(_0xdf53('0x7'));var config=require(_0xdf53('0x8'));var controller=require('./smsApplication.controller');router[_0xdf53('0x9')]('/',auth[_0xdf53('0xa')](),controller[_0xdf53('0xb')]);router[_0xdf53('0x9')](_0xdf53('0xc'),auth[_0xdf53('0xa')](),controller[_0xdf53('0xd')]);router[_0xdf53('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf53('0xf')]);router[_0xdf53('0x10')](_0xdf53('0xc'),auth[_0xdf53('0xa')](),controller[_0xdf53('0x11')]);router[_0xdf53('0x12')]('/:id',auth[_0xdf53('0xa')](),controller[_0xdf53('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1d2b=['./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x102977,_0x41f7ac){var _0x3050f5=function(_0x1aa495){while(--_0x1aa495){_0x102977['push'](_0x102977['shift']());}};_0x3050f5(++_0x41f7ac);}(_0x1d2b,0x1d4));var _0xb1d2=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x1d2b[_0x20c9b2];return _0x2c6030;};'use strict';var multer=require('multer');var util=require(_0xb1d2('0x0'));var path=require(_0xb1d2('0x1'));var timeout=require('connect-timeout');var express=require(_0xb1d2('0x2'));var router=express[_0xb1d2('0x3')]();var auth=require(_0xb1d2('0x4'));var interaction=require(_0xb1d2('0x5'));var config=require(_0xb1d2('0x6'));var controller=require(_0xb1d2('0x7'));router[_0xb1d2('0x8')]('/',auth['isAuthenticated'](),controller[_0xb1d2('0x9')]);router['get'](_0xb1d2('0xa'),auth[_0xb1d2('0xb')](),controller[_0xb1d2('0xc')]);router[_0xb1d2('0xd')]('/',auth[_0xb1d2('0xb')](),controller[_0xb1d2('0xe')]);router['put'](_0xb1d2('0xa'),auth[_0xb1d2('0xb')](),controller[_0xb1d2('0xf')]);router[_0xb1d2('0x10')](_0xb1d2('0xa'),auth[_0xb1d2('0xb')](),controller[_0xb1d2('0x11')]);module[_0xb1d2('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 8236d1a..1a5e011 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 _0x5b7b=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0x3e1a10,_0x6aeaf2){var _0x2fb8ee=function(_0x473aa3){while(--_0x473aa3){_0x3e1a10['push'](_0x3e1a10['shift']());}};_0x2fb8ee(++_0x6aeaf2);}(_0x5b7b,0x1d0));var _0xb5b7=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x5b7b[_0x58ee19];return _0x49af25;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb5b7('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb5b7('0x1')],'allowNull':![],'defaultValue':_0xb5b7('0x2')},'appdata':{'type':Sequelize[_0xb5b7('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb5b7('0x1')],'defaultValue':_0xb5b7('0x4')}}; \ No newline at end of file +var _0xeab9=['TEXT','sequelize','STRING','noop'];(function(_0x4fc430,_0x3190fb){var _0x1667c4=function(_0x529c55){while(--_0x529c55){_0x4fc430['push'](_0x4fc430['shift']());}};_0x1667c4(++_0x3190fb);}(_0xeab9,0x65));var _0x9eab=function(_0x102b93,_0x329aa3){_0x102b93=_0x102b93-0x0;var _0x4bdd0a=_0xeab9[_0x102b93];return _0x4bdd0a;};'use strict';var Sequelize=require(_0x9eab('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9eab('0x1')],'allowNull':![],'defaultValue':_0x9eab('0x2')},'appdata':{'type':Sequelize[_0x9eab('0x3')]()},'description':{'type':Sequelize[_0x9eab('0x1')]},'interval':{'type':Sequelize[_0x9eab('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 2ad35b1..05e2f5d 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 _0x373d=['to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x37ac17,_0x1a440c){var _0x15f938=function(_0x456153){while(--_0x456153){_0x37ac17['push'](_0x37ac17['shift']());}};_0x15f938(++_0x1a440c);}(_0x373d,0x1e2));var _0xd373=function(_0xf937d7,_0x59d955){_0xf937d7=_0xf937d7-0x0;var _0x39edc8=_0x373d[_0xf937d7];return _0x39edc8;};'use strict';var pdf=require(_0xd373('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd373('0x1'));var zipdir=require(_0xd373('0x2'));var jsonpatch=require(_0xd373('0x3'));var rp=require(_0xd373('0x4'));var moment=require('moment');var BPromise=require(_0xd373('0x5'));var Mustache=require(_0xd373('0x6'));var util=require(_0xd373('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd373('0x8'));var ejs=require(_0xd373('0x9'));var fs=require('fs');var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var db=require(_0xd373('0x14'))['db'];function respondWithStatusCode(_0x53ec4d,_0x4c7f91){_0x4c7f91=_0x4c7f91||0xcc;return function(_0x5ab89c){if(_0x5ab89c){return _0x53ec4d[_0xd373('0x15')](_0x4c7f91);}return _0x53ec4d[_0xd373('0x16')](_0x4c7f91)['end']();};}function respondWithResult(_0x32e0e4,_0x129475){_0x129475=_0x129475||0xc8;return function(_0x27c161){if(_0x27c161){return _0x32e0e4[_0xd373('0x16')](_0x129475)[_0xd373('0x17')](_0x27c161);}};}function respondWithFilteredResult(_0x1a9df9,_0x20aca5){return function(_0x2eacb1){if(_0x2eacb1){var _0x5a286a=_0x2eacb1[_0xd373('0x18')],_0x2c5854=_0x20aca5['offset'],_0x3a5316=_0x20aca5[_0xd373('0x19')]+_0x20aca5['limit'],_0x263ae3;if(_0x3a5316>=_0x5a286a){_0x3a5316=_0x5a286a;_0x263ae3=0xc8;}else{_0x263ae3=0xce;}_0x1a9df9[_0xd373('0x16')](_0x263ae3);return _0x1a9df9[_0xd373('0x1a')]('Content-Range',_0x2c5854+'-'+_0x3a5316+'/'+_0x5a286a)[_0xd373('0x17')](_0x2eacb1);}return null;};}function patchUpdates(_0x4f5366){return function(_0x4d7d72){try{jsonpatch[_0xd373('0x1b')](_0x4d7d72,_0x4f5366,!![]);}catch(_0x186fdd){return BPromise[_0xd373('0x1c')](_0x186fdd);}return _0x4d7d72[_0xd373('0x1d')]();};}function saveUpdates(_0x16b147,_0x181eb2){return function(_0x4ba510){if(_0x4ba510){return _0x4ba510[_0xd373('0x1e')](_0x16b147)[_0xd373('0x1f')](function(_0x1378a0){return _0x1378a0;});}return null;};}function removeEntity(_0x3a4d15,_0x165e21){return function(_0x3aa1c5){if(_0x3aa1c5){return _0x3aa1c5['destroy']()[_0xd373('0x1f')](function(){_0x3a4d15[_0xd373('0x16')](0xcc)[_0xd373('0x20')]();});}};}function handleEntityNotFound(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(!_0x238ffd){_0x209ca7[_0xd373('0x15')](0x194);}return _0x238ffd;};}function handleError(_0x109e4c,_0x1ab540){_0x1ab540=_0x1ab540||0x1f4;return function(_0x1bf642){logger[_0xd373('0x21')](_0x1bf642[_0xd373('0x22')]);if(_0x1bf642[_0xd373('0x23')]){delete _0x1bf642[_0xd373('0x23')];}_0x109e4c[_0xd373('0x16')](_0x1ab540)[_0xd373('0x24')](_0x1bf642);};}exports[_0xd373('0x25')]=function(_0x13a012,_0x3e657b){var _0x470612={},_0x45ee58={},_0x3ad8c={'count':0x0,'rows':[]};var _0x71c5c=_[_0xd373('0x26')](db[_0xd373('0x27')][_0xd373('0x28')],function(_0x158825){return{'name':_0x158825[_0xd373('0x29')],'type':_0x158825[_0xd373('0x2a')][_0xd373('0x2b')]};});_0x45ee58['model']=_[_0xd373('0x26')](_0x71c5c,'name');_0x45ee58['query']=_[_0xd373('0x2c')](_0x13a012[_0xd373('0x2d')]);_0x45ee58[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x45ee58[_0xd373('0x30')],_0x45ee58['query']);_0x470612[_0xd373('0x31')]=_[_0xd373('0x2f')](_0x45ee58['model'],qs[_0xd373('0x32')](_0x13a012[_0xd373('0x2d')][_0xd373('0x32')]));_0x470612[_0xd373('0x31')]=_0x470612[_0xd373('0x31')][_0xd373('0x33')]?_0x470612[_0xd373('0x31')]:_0x45ee58[_0xd373('0x30')];if(!_0x13a012[_0xd373('0x2d')]['hasOwnProperty'](_0xd373('0x34'))){_0x470612[_0xd373('0x35')]=qs[_0xd373('0x35')](_0x13a012[_0xd373('0x2d')][_0xd373('0x35')]);_0x470612[_0xd373('0x19')]=qs[_0xd373('0x19')](_0x13a012[_0xd373('0x2d')][_0xd373('0x19')]);}_0x470612[_0xd373('0x36')]=qs[_0xd373('0x37')](_0x13a012[_0xd373('0x2d')][_0xd373('0x37')]);_0x470612[_0xd373('0x38')]=qs[_0xd373('0x2e')](_['pick'](_0x13a012[_0xd373('0x2d')],_0x45ee58[_0xd373('0x2e')]),_0x71c5c);if(_0x13a012[_0xd373('0x2d')][_0xd373('0x39')]){_0x470612['where']=_[_0xd373('0x3a')](_0x470612[_0xd373('0x38')],{'$or':_[_0xd373('0x26')](_0x71c5c,function(_0x3af9f7){if(_0x3af9f7[_0xd373('0x2a')]!==_0xd373('0x3b')){var _0x4aab80={};_0x4aab80[_0x3af9f7['name']]={'$like':'%'+_0x13a012[_0xd373('0x2d')]['filter']+'%'};return _0x4aab80;}})});}_0x470612=_[_0xd373('0x3a')]({},_0x470612,_0x13a012[_0xd373('0x3c')]);var _0x1d9b7a={'where':_0x470612['where']};return db[_0xd373('0x27')][_0xd373('0x18')](_0x1d9b7a)[_0xd373('0x1f')](function(_0x2a691a){_0x3ad8c['count']=_0x2a691a;if(_0x13a012['query']['includeAll']){_0x470612[_0xd373('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0xd373('0x3e')](_0x470612);})[_0xd373('0x1f')](function(_0x4e5e80){_0x3ad8c['rows']=_0x4e5e80;return _0x3ad8c;})['then'](respondWithFilteredResult(_0x3e657b,_0x470612))[_0xd373('0x3f')](handleError(_0x3e657b,null));};exports[_0xd373('0x40')]=function(_0x107e2f,_0x501f8b){var _0x5c3b22={'raw':!![],'where':{'id':_0x107e2f[_0xd373('0x41')]['id']}},_0xb87e16={};_0xb87e16['model']=_[_0xd373('0x2c')](db[_0xd373('0x27')][_0xd373('0x28')]);_0xb87e16[_0xd373('0x2d')]=_[_0xd373('0x2c')](_0x107e2f['query']);_0xb87e16['filters']=_[_0xd373('0x2f')](_0xb87e16[_0xd373('0x30')],_0xb87e16[_0xd373('0x2d')]);_0x5c3b22[_0xd373('0x31')]=_['intersection'](_0xb87e16[_0xd373('0x30')],qs['fields'](_0x107e2f[_0xd373('0x2d')][_0xd373('0x32')]));_0x5c3b22[_0xd373('0x31')]=_0x5c3b22[_0xd373('0x31')][_0xd373('0x33')]?_0x5c3b22['attributes']:_0xb87e16[_0xd373('0x30')];if(_0x107e2f[_0xd373('0x2d')]['includeAll']){_0x5c3b22[_0xd373('0x3d')]=[{'all':!![]}];}_0x5c3b22=_[_0xd373('0x3a')]({},_0x5c3b22,_0x107e2f[_0xd373('0x3c')]);return db[_0xd373('0x27')][_0xd373('0x42')](_0x5c3b22)[_0xd373('0x1f')](handleEntityNotFound(_0x501f8b,null))[_0xd373('0x1f')](respondWithResult(_0x501f8b,null))[_0xd373('0x3f')](handleError(_0x501f8b,null));};exports[_0xd373('0x43')]=function(_0xfcedb3,_0x5d759f){return db['SmsApplication'][_0xd373('0x43')](_0xfcedb3['body'],{})[_0xd373('0x1f')](respondWithResult(_0x5d759f,0xc9))['catch'](handleError(_0x5d759f,null));};exports['update']=function(_0x5cbc16,_0x280598){if(_0x5cbc16[_0xd373('0x44')]['id']){delete _0x5cbc16[_0xd373('0x44')]['id'];}return db[_0xd373('0x27')][_0xd373('0x42')]({'where':{'id':_0x5cbc16[_0xd373('0x41')]['id']}})[_0xd373('0x1f')](handleEntityNotFound(_0x280598,null))['then'](saveUpdates(_0x5cbc16[_0xd373('0x44')],null))['then'](respondWithResult(_0x280598,null))[_0xd373('0x3f')](handleError(_0x280598,null));};exports[_0xd373('0x45')]=function(_0x5502e5,_0x4517ab){return db['SmsApplication'][_0xd373('0x42')]({'where':{'id':_0x5502e5[_0xd373('0x41')]['id']}})[_0xd373('0x1f')](handleEntityNotFound(_0x4517ab,null))[_0xd373('0x1f')](removeEntity(_0x4517ab,null))[_0xd373('0x3f')](handleError(_0x4517ab,null));}; \ No newline at end of file +var _0xed3c=['ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','error','name','send','index','map','SmsApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xed3c,0x1a6));var _0xced3=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0xed3c[_0x1b4002];return _0x1716f3;};'use strict';var pdf=require(_0xced3('0x0'));var emlformat=require(_0xced3('0x1'));var rimraf=require(_0xced3('0x2'));var zipdir=require(_0xced3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xced3('0x4'));var moment=require(_0xced3('0x5'));var BPromise=require(_0xced3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xced3('0x7'));var sox=require(_0xced3('0x8'));var csv=require(_0xced3('0x9'));var ejs=require(_0xced3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var db=require(_0xced3('0x14'))['db'];function respondWithStatusCode(_0x19b8c2,_0x42d879){_0x42d879=_0x42d879||0xcc;return function(_0x3b2ac4){if(_0x3b2ac4){return _0x19b8c2[_0xced3('0x15')](_0x42d879);}return _0x19b8c2[_0xced3('0x16')](_0x42d879)[_0xced3('0x17')]();};}function respondWithResult(_0x5aadb6,_0x65bb58){_0x65bb58=_0x65bb58||0xc8;return function(_0x5e186e){if(_0x5e186e){return _0x5aadb6[_0xced3('0x16')](_0x65bb58)[_0xced3('0x18')](_0x5e186e);}};}function respondWithFilteredResult(_0x20d099,_0x39e4aa){return function(_0x4dd4c3){if(_0x4dd4c3){var _0x146a21=_0x4dd4c3[_0xced3('0x19')],_0x322c2d=_0x39e4aa[_0xced3('0x1a')],_0x4acae6=_0x39e4aa[_0xced3('0x1a')]+_0x39e4aa['limit'],_0x3b5962;if(_0x4acae6>=_0x146a21){_0x4acae6=_0x146a21;_0x3b5962=0xc8;}else{_0x3b5962=0xce;}_0x20d099[_0xced3('0x16')](_0x3b5962);return _0x20d099['set'](_0xced3('0x1b'),_0x322c2d+'-'+_0x4acae6+'/'+_0x146a21)[_0xced3('0x18')](_0x4dd4c3);}return null;};}function patchUpdates(_0x32c402){return function(_0x1fb300){try{jsonpatch[_0xced3('0x1c')](_0x1fb300,_0x32c402,!![]);}catch(_0x688c97){return BPromise[_0xced3('0x1d')](_0x688c97);}return _0x1fb300[_0xced3('0x1e')]();};}function saveUpdates(_0x3f688c,_0x17c011){return function(_0x2008f2){if(_0x2008f2){return _0x2008f2['update'](_0x3f688c)['then'](function(_0x5e8c44){return _0x5e8c44;});}return null;};}function removeEntity(_0x1e8450,_0x342b9e){return function(_0x21e074){if(_0x21e074){return _0x21e074['destroy']()[_0xced3('0x1f')](function(){_0x1e8450[_0xced3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x559fa2,_0x3adf14){return function(_0x101708){if(!_0x101708){_0x559fa2[_0xced3('0x15')](0x194);}return _0x101708;};}function handleError(_0x15c6c5,_0x50f7c1){_0x50f7c1=_0x50f7c1||0x1f4;return function(_0x1905a3){logger[_0xced3('0x20')](_0x1905a3['stack']);if(_0x1905a3[_0xced3('0x21')]){delete _0x1905a3['name'];}_0x15c6c5[_0xced3('0x16')](_0x50f7c1)[_0xced3('0x22')](_0x1905a3);};}exports[_0xced3('0x23')]=function(_0x23a570,_0x2ec2c4){var _0x502cf1={},_0x5454c0={},_0x36b1fe={'count':0x0,'rows':[]};var _0x5bb425=_[_0xced3('0x24')](db[_0xced3('0x25')]['rawAttributes'],function(_0x3db664){return{'name':_0x3db664[_0xced3('0x26')],'type':_0x3db664[_0xced3('0x27')][_0xced3('0x28')]};});_0x5454c0[_0xced3('0x29')]=_[_0xced3('0x24')](_0x5bb425,_0xced3('0x21'));_0x5454c0[_0xced3('0x2a')]=_[_0xced3('0x2b')](_0x23a570['query']);_0x5454c0[_0xced3('0x2c')]=_[_0xced3('0x2d')](_0x5454c0[_0xced3('0x29')],_0x5454c0[_0xced3('0x2a')]);_0x502cf1[_0xced3('0x2e')]=_[_0xced3('0x2d')](_0x5454c0[_0xced3('0x29')],qs[_0xced3('0x2f')](_0x23a570[_0xced3('0x2a')][_0xced3('0x2f')]));_0x502cf1[_0xced3('0x2e')]=_0x502cf1[_0xced3('0x2e')][_0xced3('0x30')]?_0x502cf1[_0xced3('0x2e')]:_0x5454c0[_0xced3('0x29')];if(!_0x23a570[_0xced3('0x2a')][_0xced3('0x31')](_0xced3('0x32'))){_0x502cf1[_0xced3('0x33')]=qs[_0xced3('0x33')](_0x23a570[_0xced3('0x2a')]['limit']);_0x502cf1[_0xced3('0x1a')]=qs['offset'](_0x23a570[_0xced3('0x2a')][_0xced3('0x1a')]);}_0x502cf1[_0xced3('0x34')]=qs[_0xced3('0x35')](_0x23a570[_0xced3('0x2a')][_0xced3('0x35')]);_0x502cf1[_0xced3('0x36')]=qs[_0xced3('0x2c')](_[_0xced3('0x37')](_0x23a570[_0xced3('0x2a')],_0x5454c0['filters']),_0x5bb425);if(_0x23a570[_0xced3('0x2a')][_0xced3('0x38')]){_0x502cf1['where']=_[_0xced3('0x39')](_0x502cf1[_0xced3('0x36')],{'$or':_[_0xced3('0x24')](_0x5bb425,function(_0x4f6ada){if(_0x4f6ada['type']!==_0xced3('0x3a')){var _0x529d5e={};_0x529d5e[_0x4f6ada[_0xced3('0x21')]]={'$like':'%'+_0x23a570[_0xced3('0x2a')]['filter']+'%'};return _0x529d5e;}})});}_0x502cf1=_[_0xced3('0x39')]({},_0x502cf1,_0x23a570[_0xced3('0x3b')]);var _0x2a6dbf={'where':_0x502cf1['where']};return db[_0xced3('0x25')]['count'](_0x2a6dbf)['then'](function(_0x34d5db){_0x36b1fe[_0xced3('0x19')]=_0x34d5db;if(_0x23a570[_0xced3('0x2a')]['includeAll']){_0x502cf1[_0xced3('0x3c')]=[{'all':!![]}];}return db[_0xced3('0x25')][_0xced3('0x3d')](_0x502cf1);})[_0xced3('0x1f')](function(_0x28506e){_0x36b1fe[_0xced3('0x3e')]=_0x28506e;return _0x36b1fe;})[_0xced3('0x1f')](respondWithFilteredResult(_0x2ec2c4,_0x502cf1))[_0xced3('0x3f')](handleError(_0x2ec2c4,null));};exports[_0xced3('0x40')]=function(_0x3eca11,_0x2b4a18){var _0x38855f={'raw':!![],'where':{'id':_0x3eca11[_0xced3('0x41')]['id']}},_0x16b2c7={};_0x16b2c7[_0xced3('0x29')]=_['keys'](db[_0xced3('0x25')][_0xced3('0x42')]);_0x16b2c7[_0xced3('0x2a')]=_[_0xced3('0x2b')](_0x3eca11[_0xced3('0x2a')]);_0x16b2c7[_0xced3('0x2c')]=_[_0xced3('0x2d')](_0x16b2c7[_0xced3('0x29')],_0x16b2c7[_0xced3('0x2a')]);_0x38855f['attributes']=_[_0xced3('0x2d')](_0x16b2c7['model'],qs[_0xced3('0x2f')](_0x3eca11[_0xced3('0x2a')][_0xced3('0x2f')]));_0x38855f['attributes']=_0x38855f[_0xced3('0x2e')][_0xced3('0x30')]?_0x38855f[_0xced3('0x2e')]:_0x16b2c7[_0xced3('0x29')];if(_0x3eca11['query'][_0xced3('0x43')]){_0x38855f[_0xced3('0x3c')]=[{'all':!![]}];}_0x38855f=_[_0xced3('0x39')]({},_0x38855f,_0x3eca11[_0xced3('0x3b')]);return db[_0xced3('0x25')]['find'](_0x38855f)[_0xced3('0x1f')](handleEntityNotFound(_0x2b4a18,null))[_0xced3('0x1f')](respondWithResult(_0x2b4a18,null))[_0xced3('0x3f')](handleError(_0x2b4a18,null));};exports[_0xced3('0x44')]=function(_0x334474,_0x740743){return db[_0xced3('0x25')]['create'](_0x334474[_0xced3('0x45')],{})[_0xced3('0x1f')](respondWithResult(_0x740743,0xc9))['catch'](handleError(_0x740743,null));};exports['update']=function(_0x140df2,_0x59b586){if(_0x140df2[_0xced3('0x45')]['id']){delete _0x140df2[_0xced3('0x45')]['id'];}return db[_0xced3('0x25')][_0xced3('0x46')]({'where':{'id':_0x140df2[_0xced3('0x41')]['id']}})[_0xced3('0x1f')](handleEntityNotFound(_0x59b586,null))[_0xced3('0x1f')](saveUpdates(_0x140df2[_0xced3('0x45')],null))[_0xced3('0x1f')](respondWithResult(_0x59b586,null))['catch'](handleError(_0x59b586,null));};exports[_0xced3('0x47')]=function(_0x8df206,_0x2aa876){return db[_0xced3('0x25')][_0xced3('0x46')]({'where':{'id':_0x8df206[_0xced3('0x41')]['id']}})['then'](handleEntityNotFound(_0x2aa876,null))[_0xced3('0x1f')](removeEntity(_0x2aa876,null))[_0xced3('0x3f')](handleError(_0x2aa876,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0320dbe..5ca8f9c 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 _0x651f=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','exports','SmsApplication','sms_applications','utf8mb4'];(function(_0xf44627,_0x3a000e){var _0x1e95b3=function(_0x5579e2){while(--_0x5579e2){_0xf44627['push'](_0xf44627['shift']());}};_0x1e95b3(++_0x3a000e);}(_0x651f,0x8f));var _0xf651=function(_0x17be9f,_0x9d0264){_0x17be9f=_0x17be9f-0x0;var _0x5795db=_0x651f[_0x17be9f];return _0x5795db;};'use strict';var _=require(_0xf651('0x0'));var util=require(_0xf651('0x1'));var logger=require(_0xf651('0x2'))(_0xf651('0x3'));var moment=require(_0xf651('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf651('0x5'));var config=require(_0xf651('0x6'));var attributes=require('./smsApplication.attributes');module[_0xf651('0x7')]=function(_0x136726,_0x31d40e){return _0x136726['define'](_0xf651('0x8'),attributes,{'tableName':_0xf651('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf651('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x34ec=['request-promise','path','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','util','../../config/logger','api','moment'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0x34ec,0x128));var _0xc34e=function(_0x35194d,_0x53151b){_0x35194d=_0x35194d-0x0;var _0x2f028b=_0x34ec[_0x35194d];return _0x2f028b;};'use strict';var _=require('lodash');var util=require(_0xc34e('0x0'));var logger=require(_0xc34e('0x1'))(_0xc34e('0x2'));var moment=require(_0xc34e('0x3'));var BPromise=require('bluebird');var rp=require(_0xc34e('0x4'));var fs=require('fs');var path=require(_0xc34e('0x5'));var rimraf=require('rimraf');var config=require(_0xc34e('0x6'));var attributes=require(_0xc34e('0x7'));module[_0xc34e('0x8')]=function(_0x196870,_0xe9e61c){return _0x196870['define'](_0xc34e('0x9'),attributes,{'tableName':_0xc34e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc34e('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 44be0c8..b9cde42 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 _0x3663=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','result'];(function(_0x84fce1,_0x33fcc4){var _0x170dbf=function(_0x32b70b){while(--_0x32b70b){_0x84fce1['push'](_0x84fce1['shift']());}};_0x170dbf(++_0x33fcc4);}(_0x3663,0x1cf));var _0x3366=function(_0x310926,_0x226e01){_0x310926=_0x310926-0x0;var _0x205927=_0x3663[_0x310926];return _0x205927;};'use strict';var _=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var moment=require(_0x3366('0x2'));var BPromise=require('bluebird');var rs=require(_0x3366('0x3'));var fs=require('fs');var Redis=require(_0x3366('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3366('0x5'));var logger=require(_0x3366('0x6'))(_0x3366('0x7'));var config=require(_0x3366('0x8'));var jayson=require(_0x3366('0x9'));var client=jayson['client'][_0x3366('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x348f53,_0x4c734f,_0x5c10c1){return new BPromise(function(_0x1d802b,_0x304f68){return client['request'](_0x348f53,_0x5c10c1)[_0x3366('0xb')](function(_0x2a681e){logger[_0x3366('0xc')]('SmsApplication,\x20%s,\x20%s',_0x4c734f,_0x3366('0xd'));logger[_0x3366('0xe')](_0x3366('0xf'),_0x4c734f,_0x3366('0xd'),JSON[_0x3366('0x10')](_0x2a681e));if(_0x2a681e[_0x3366('0x11')]){if(_0x2a681e[_0x3366('0x11')]['code']===0x1f4){logger['error'](_0x3366('0x12'),_0x4c734f,_0x2a681e[_0x3366('0x11')][_0x3366('0x13')]);return _0x304f68(_0x2a681e[_0x3366('0x11')][_0x3366('0x13')]);}logger[_0x3366('0x11')]('SmsApplication,\x20%s,\x20%s',_0x4c734f,_0x2a681e['error'][_0x3366('0x13')]);return _0x1d802b(_0x2a681e['error'][_0x3366('0x13')]);}else{logger[_0x3366('0xc')](_0x3366('0x12'),_0x4c734f,_0x3366('0xd'));_0x1d802b(_0x2a681e[_0x3366('0x14')]['message']);}})[_0x3366('0x15')](function(_0x14139a){logger[_0x3366('0x11')](_0x3366('0x12'),_0x4c734f,_0x14139a);_0x304f68(_0x14139a);});});} \ No newline at end of file +var _0x93bb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x372826,_0x24dd3c){var _0x197bda=function(_0xfc119f){while(--_0xfc119f){_0x372826['push'](_0x372826['shift']());}};_0x197bda(++_0x24dd3c);}(_0x93bb,0x135));var _0xb93b=function(_0x5f5b30,_0x32b0b6){_0x5f5b30=_0x5f5b30-0x0;var _0x34be0d=_0x93bb[_0x5f5b30];return _0x34be0d;};'use strict';var _=require(_0xb93b('0x0'));var util=require(_0xb93b('0x1'));var moment=require(_0xb93b('0x2'));var BPromise=require(_0xb93b('0x3'));var rs=require(_0xb93b('0x4'));var fs=require('fs');var Redis=require(_0xb93b('0x5'));var db=require(_0xb93b('0x6'))['db'];var utils=require(_0xb93b('0x7'));var logger=require(_0xb93b('0x8'))(_0xb93b('0x9'));var config=require('../../config/environment');var jayson=require(_0xb93b('0xa'));var client=jayson[_0xb93b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4dcf,_0x2c27ca,_0x516b0b){return new BPromise(function(_0x35c135,_0x455cb2){return client[_0xb93b('0xc')](_0x3c4dcf,_0x516b0b)[_0xb93b('0xd')](function(_0x1c9b11){logger[_0xb93b('0xe')](_0xb93b('0xf'),_0x2c27ca,_0xb93b('0x10'));logger[_0xb93b('0x11')](_0xb93b('0x12'),_0x2c27ca,_0xb93b('0x10'),JSON['stringify'](_0x1c9b11));if(_0x1c9b11[_0xb93b('0x13')]){if(_0x1c9b11[_0xb93b('0x13')][_0xb93b('0x14')]===0x1f4){logger[_0xb93b('0x13')]('SmsApplication,\x20%s,\x20%s',_0x2c27ca,_0x1c9b11[_0xb93b('0x13')][_0xb93b('0x15')]);return _0x455cb2(_0x1c9b11[_0xb93b('0x13')][_0xb93b('0x15')]);}logger[_0xb93b('0x13')](_0xb93b('0xf'),_0x2c27ca,_0x1c9b11[_0xb93b('0x13')]['message']);return _0x35c135(_0x1c9b11[_0xb93b('0x13')][_0xb93b('0x15')]);}else{logger[_0xb93b('0xe')](_0xb93b('0xf'),_0x2c27ca,_0xb93b('0x10'));_0x35c135(_0x1c9b11[_0xb93b('0x16')]['message']);}})[_0xb93b('0x17')](function(_0x5ee3c4){logger[_0xb93b('0x13')](_0xb93b('0xf'),_0x2c27ca,_0x5ee3c4);_0x455cb2(_0x5ee3c4);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index b1f5f40..d4cba7a 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 _0xb016=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','describe','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','put','sms','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','util','express'];(function(_0x2ced3b,_0xe131cf){var _0xed9aed=function(_0x5db1d0){while(--_0x5db1d0){_0x2ced3b['push'](_0x2ced3b['shift']());}};_0xed9aed(++_0xe131cf);}(_0xb016,0x159));var _0x6b01=function(_0x379041,_0x3d3d35){_0x379041=_0x379041-0x0;var _0x1e9e28=_0xb016[_0x379041];return _0x1e9e28;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var auth=require(_0x6b01('0x3'));var interaction=require(_0x6b01('0x4'));var config=require(_0x6b01('0x5'));var controller=require(_0x6b01('0x6'));router['get']('/',auth[_0x6b01('0x7')](),controller[_0x6b01('0x8')]);router[_0x6b01('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6b01('0xa')]);router[_0x6b01('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6b01('0xb')]);router[_0x6b01('0x9')](_0x6b01('0xc'),auth[_0x6b01('0x7')](),controller[_0x6b01('0xd')]);router['get']('/:id/download',auth[_0x6b01('0x7')](),controller[_0x6b01('0xe')]);router[_0x6b01('0xf')]('/',auth['isAuthenticated'](),controller[_0x6b01('0x10')]);router['post']('/:id/messages',auth[_0x6b01('0x7')](),controller['addMessage']);router[_0x6b01('0xf')](_0x6b01('0x11'),auth['isAuthenticated'](),interaction[_0x6b01('0x12')]('sms','smsinteraction:addtags'),controller['addTags']);router[_0x6b01('0x13')]('/:id',auth['isAuthenticated'](),interaction[_0x6b01('0x12')](_0x6b01('0x14'),_0x6b01('0x15')),controller[_0x6b01('0x16')]);router[_0x6b01('0x17')](_0x6b01('0x18'),auth[_0x6b01('0x7')](),interaction[_0x6b01('0x12')](_0x6b01('0x14'),_0x6b01('0x19')),controller[_0x6b01('0x1a')]);router['delete'](_0x6b01('0x11'),auth[_0x6b01('0x7')](),controller[_0x6b01('0x1b')]);module[_0x6b01('0x1c')]=router; \ No newline at end of file +var _0x1c45=['/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages'];(function(_0x100070,_0x15333b){var _0x12d824=function(_0x3ae061){while(--_0x3ae061){_0x100070['push'](_0x100070['shift']());}};_0x12d824(++_0x15333b);}(_0x1c45,0x1b0));var _0x51c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c45[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x51c4('0x0'));var util=require(_0x51c4('0x1'));var path=require(_0x51c4('0x2'));var timeout=require(_0x51c4('0x3'));var express=require(_0x51c4('0x4'));var router=express[_0x51c4('0x5')]();var auth=require(_0x51c4('0x6'));var interaction=require(_0x51c4('0x7'));var config=require('../../config/environment');var controller=require('./smsInteraction.controller');router[_0x51c4('0x8')]('/',auth[_0x51c4('0x9')](),controller[_0x51c4('0xa')]);router[_0x51c4('0x8')](_0x51c4('0xb'),auth[_0x51c4('0x9')](),controller[_0x51c4('0xc')]);router[_0x51c4('0x8')](_0x51c4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x51c4('0x8')](_0x51c4('0xe'),auth[_0x51c4('0x9')](),controller[_0x51c4('0xf')]);router[_0x51c4('0x8')](_0x51c4('0x10'),auth['isAuthenticated'](),controller[_0x51c4('0x11')]);router[_0x51c4('0x12')]('/',auth[_0x51c4('0x9')](),controller[_0x51c4('0x13')]);router[_0x51c4('0x12')](_0x51c4('0xe'),auth[_0x51c4('0x9')](),controller[_0x51c4('0x14')]);router[_0x51c4('0x12')](_0x51c4('0x15'),auth[_0x51c4('0x9')](),interaction[_0x51c4('0x16')](_0x51c4('0x17'),'smsinteraction:addtags'),controller[_0x51c4('0x18')]);router[_0x51c4('0x19')]('/:id',auth[_0x51c4('0x9')](),interaction[_0x51c4('0x16')](_0x51c4('0x17'),_0x51c4('0x1a')),controller[_0x51c4('0x1b')]);router[_0x51c4('0x1c')](_0x51c4('0xd'),auth['isAuthenticated'](),interaction[_0x51c4('0x16')](_0x51c4('0x17'),'smsinteraction:destroy'),controller[_0x51c4('0x1d')]);router['delete'](_0x51c4('0x15'),auth[_0x51c4('0x9')](),controller[_0x51c4('0x1e')]);module[_0x51c4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index c60e631..07c91a6 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x54a5cb,_0x4e5f16){var _0x168e1c=function(_0x3c97a9){while(--_0x3c97a9){_0x54a5cb['push'](_0x54a5cb['shift']());}};_0x168e1c(++_0x4e5f16);}(_0x757a,0xde));var _0xa757=function(_0x4916c6,_0x33dc6d){_0x4916c6=_0x4916c6-0x0;var _0x257b9=_0x757a[_0x4916c6];return _0x257b9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x49b9ef,_0x55547f){var _0x4de813=function(_0x4647cb){while(--_0x4647cb){_0x49b9ef['push'](_0x49b9ef['shift']());}};_0x4de813(++_0x55547f);}(_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 7b83987..79bf0b3 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 _0x2e54=['Account','Owner','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','out','System','firstName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','all','rows','catch','show','params','rawAttributes','includeAll','include','create','body','describe','SmsMessage','addMessage','ids','getMessages','findOne','format','options','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','transcript-%d-%s.zip','CmContact','lastName','direction','secret','SmsAccount'];(function(_0x5f2239,_0x4a49bb){var _0x526a9d=function(_0x4c6cc6){while(--_0x4c6cc6){_0x5f2239['push'](_0x5f2239['shift']());}};_0x526a9d(++_0x4a49bb);}(_0x2e54,0x1dd));var _0x42e5=function(_0x299d49,_0x1527fa){_0x299d49=_0x299d49-0x0;var _0x4b1a35=_0x2e54[_0x299d49];return _0x4b1a35;};'use strict';var pdf=require(_0x42e5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x42e5('0x1'));var jsonpatch=require(_0x42e5('0x2'));var rp=require(_0x42e5('0x3'));var moment=require(_0x42e5('0x4'));var BPromise=require(_0x42e5('0x5'));var Mustache=require(_0x42e5('0x6'));var util=require(_0x42e5('0x7'));var path=require('path');var sox=require(_0x42e5('0x8'));var csv=require(_0x42e5('0x9'));var ejs=require(_0x42e5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x9'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var db=require('../../mysqldb')['db'];config[_0x42e5('0x17')]=_[_0x42e5('0x18')](config[_0x42e5('0x17')],{'host':_0x42e5('0x19'),'port':0x18eb});var socket=require(_0x42e5('0x1a'))(new Redis(config[_0x42e5('0x17')]));require(_0x42e5('0x1b'))[_0x42e5('0x1c')](socket);function respondWithStatusCode(_0x447648,_0x23957f){_0x23957f=_0x23957f||0xcc;return function(_0x51b2f4){if(_0x51b2f4){return _0x447648[_0x42e5('0x1d')](_0x23957f);}return _0x447648[_0x42e5('0x1e')](_0x23957f)[_0x42e5('0x1f')]();};}function respondWithResult(_0x388300,_0x2f4999){_0x2f4999=_0x2f4999||0xc8;return function(_0x263a3d){if(_0x263a3d){return _0x388300[_0x42e5('0x1e')](_0x2f4999)[_0x42e5('0x20')](_0x263a3d);}};}function respondWithFilteredResult(_0x16c753,_0x3c7b79){return function(_0x22655f){if(_0x22655f){var _0x38282d=_0x22655f[_0x42e5('0x21')],_0x11550e=_0x3c7b79['offset'],_0x23fe09=_0x3c7b79['offset']+_0x3c7b79[_0x42e5('0x22')],_0x54fcfc;if(_0x23fe09>=_0x38282d){_0x23fe09=_0x38282d;_0x54fcfc=0xc8;}else{_0x54fcfc=0xce;}_0x16c753[_0x42e5('0x1e')](_0x54fcfc);return _0x16c753['set'](_0x42e5('0x23'),_0x11550e+'-'+_0x23fe09+'/'+_0x38282d)[_0x42e5('0x20')](_0x22655f);}return null;};}function patchUpdates(_0x1c2169){return function(_0x3fde76){try{jsonpatch[_0x42e5('0x24')](_0x3fde76,_0x1c2169,!![]);}catch(_0xa6825e){return BPromise[_0x42e5('0x25')](_0xa6825e);}return _0x3fde76['save']();};}function saveUpdates(_0x4da508,_0x283d44){return function(_0x52d319){if(_0x52d319){return _0x52d319[_0x42e5('0x26')](_0x4da508)[_0x42e5('0x27')](function(_0x37d10e){return _0x37d10e;});}return null;};}function removeEntity(_0x49490f,_0x32380f){return function(_0x5d6b24){if(_0x5d6b24){return _0x5d6b24[_0x42e5('0x28')]()[_0x42e5('0x27')](function(){_0x49490f[_0x42e5('0x1e')](0xcc)[_0x42e5('0x1f')]();});}};}function handleEntityNotFound(_0x4638bc,_0x4f52b2){return function(_0x4fb147){if(!_0x4fb147){_0x4638bc[_0x42e5('0x1d')](0x194);}return _0x4fb147;};}function handleError(_0x534a26,_0x56f812){_0x56f812=_0x56f812||0x1f4;return function(_0x1b60be){logger['error'](_0x1b60be[_0x42e5('0x29')]);if(_0x1b60be[_0x42e5('0x2a')]){delete _0x1b60be[_0x42e5('0x2a')];}_0x534a26[_0x42e5('0x1e')](_0x56f812)[_0x42e5('0x2b')](_0x1b60be);};}function getInteractionUsers(_0x2f1edc,_0x59a46b){return new BPromise(function(_0x3e2ea5,_0x201d9e){try{if(_0x59a46b[_0x2f1edc['id']]){_0x2f1edc[_0x42e5('0x2c')]=_[_0x42e5('0x2d')](_0x59a46b[_0x2f1edc['id']],function(_0x1d22ba){return{'id':_0x1d22ba['id'],'fullname':_0x1d22ba[_0x42e5('0x2e')]};});}}catch(_0x383e97){_0x201d9e(_0x383e97);}_0x3e2ea5(_0x2f1edc);});}function getInteractionTags(_0x282cbf,_0x5a4930){return new BPromise(function(_0x2ba9ef,_0x2c7542){try{if(_0x282cbf[_0x42e5('0x2f')]){_0x282cbf[_0x42e5('0x30')]=[];_0x282cbf['TagIds'][_0x42e5('0x31')](',')[_0x42e5('0x32')](function(_0x14c8fd){_0x282cbf[_0x42e5('0x30')]['push'](_0x5a4930[_0x14c8fd]);});}delete _0x282cbf['TagIds'];}catch(_0x21d933){_0x2c7542(_0x21d933);}_0x2ba9ef(_0x282cbf);});}function updateSmsInteraction(_0x59f8d6,_0x45f402,_0x4988a2){return new BPromise(function(_0x472600,_0x188d9d){return getInteractionUsers(_0x59f8d6,_0x4988a2)[_0x42e5('0x27')](function(_0x49a22e){return getInteractionTags(_0x49a22e,_0x45f402);})[_0x42e5('0x27')](function(_0x3a8d1c){_0x472600(_0x3a8d1c);})['catch'](function(_0x1ae59c){_0x188d9d(_0x1ae59c);});});}exports['index']=function(_0x470ac5,_0x1cfc1d){var _0x25a040={},_0x2a1d23={},_0x3c12c6={'count':0x0,'rows':[]};var _0x41f891=_[_0x42e5('0x2d')](db['SmsInteraction']['rawAttributes'],function(_0xba86e2){return{'name':_0xba86e2[_0x42e5('0x33')],'type':_0xba86e2[_0x42e5('0x34')]['key']};});_0x2a1d23['model']=_['map'](_0x41f891,'name');_0x2a1d23[_0x42e5('0x35')]=_[_0x42e5('0x36')](_0x470ac5[_0x42e5('0x35')]);_0x2a1d23[_0x42e5('0x37')]=_[_0x42e5('0x38')](_0x2a1d23[_0x42e5('0x39')],_0x2a1d23[_0x42e5('0x35')]);_0x25a040[_0x42e5('0x3a')]=_['intersection'](_0x2a1d23[_0x42e5('0x39')],qs['fields'](_0x470ac5[_0x42e5('0x35')][_0x42e5('0x3b')]));_0x25a040[_0x42e5('0x3a')]=_0x25a040[_0x42e5('0x3a')][_0x42e5('0x3c')]?_0x25a040[_0x42e5('0x3a')]:_0x2a1d23[_0x42e5('0x39')];if(!_0x470ac5['query'][_0x42e5('0x3d')](_0x42e5('0x3e'))){_0x25a040['limit']=qs[_0x42e5('0x22')](_0x470ac5['query']['limit']);_0x25a040['offset']=qs[_0x42e5('0x3f')](_0x470ac5[_0x42e5('0x35')][_0x42e5('0x3f')]);}_0x25a040[_0x42e5('0x40')]=qs[_0x42e5('0x41')](_0x470ac5[_0x42e5('0x35')][_0x42e5('0x41')]);_0x25a040['where']=qs[_0x42e5('0x37')](_[_0x42e5('0x42')](_0x470ac5['query'],_0x2a1d23[_0x42e5('0x37')]),_0x41f891);var _0x1c697a=[];var _0x5db771=squel[_0x42e5('0x43')]()[_0x42e5('0x44')]('id')[_0x42e5('0x44')](_0x42e5('0x2a'))[_0x42e5('0x44')]('color')[_0x42e5('0x45')](_0x42e5('0x46'));var _0x19f684=squel[_0x42e5('0x43')]()['field'](_0x42e5('0x47'))[_0x42e5('0x44')](_0x42e5('0x48'))[_0x42e5('0x44')](_0x42e5('0x49'))[_0x42e5('0x45')](_0x42e5('0x4a'),'ui')[_0x42e5('0x4b')]('users','u',_0x42e5('0x4c'));var _0x5b27f6=squel['select']()[_0x42e5('0x45')](_0x42e5('0x4d'),'i')[_0x42e5('0x4b')](_0x42e5('0x4e'),'c',_0x42e5('0x4f'))[_0x42e5('0x4b')](_0x42e5('0x50'),'o','o.id\x20=\x20i.UserId')[_0x42e5('0x4b')](_0x42e5('0x51'),'a',_0x42e5('0x52'))[_0x42e5('0x4b')](_0x42e5('0x53'),'me',_0x42e5('0x54'))[_0x42e5('0x4b')](_0x42e5('0x55'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x42e5('0x4b')](_0x42e5('0x46'),'t',_0x42e5('0x56'));var _0x48757e=squel[_0x42e5('0x57')]();var _0x1ddc39=[];var _0xffc1e2=squel[_0x42e5('0x57')]();var _0x2586b0;if(_0x470ac5['query'][_0x42e5('0x58')]){_0x2586b0=as['parseSearch'](_0x470ac5[_0x42e5('0x35')][_0x42e5('0x58')]);var _0x326086=_0x2586b0['sqlOperator'];for(var _0x50f59c=0x0;_0x50f59c<_0x2586b0['conditions'][_0x42e5('0x3c')];_0x50f59c++){var _0x2601c6=_0x2586b0[_0x42e5('0x59')][_0x50f59c];var _0x148d2c='i';var _0x53edc8=_[_0x42e5('0x5a')](_0x41f891,[_0x42e5('0x2a'),_0x2601c6[_0x42e5('0x44')]]);if(!_0x53edc8){switch(_0x2601c6['field']){case _0x42e5('0x5b'):if(_0x2601c6['value']==0x1){_0x5b27f6[_0x42e5('0x5c')]('`'+_0x2601c6[_0x42e5('0x44')]+'`\x20=\x200');}else{_0x5b27f6[_0x42e5('0x5c')]('`'+_0x2601c6[_0x42e5('0x44')]+_0x42e5('0x5d'));}break;case _0x42e5('0x5e'):if(_0x2601c6[_0x42e5('0x5f')]===_0x42e5('0x60')){if(_0x2601c6[_0x42e5('0x61')][_0x42e5('0x31')]('\x20')[_0x42e5('0x3c')]>0x1){_0x48757e[_0x326086](_0x42e5('0x62'),qs['getFullTextValue'](_0x2601c6[_0x42e5('0x61')]),null);}else{var _0x384057='%'+_0x2601c6[_0x42e5('0x61')]+'%';_0x48757e[_0x326086](_0x42e5('0x63'),_0x384057,_0x384057,_0x384057);}}else{_0x53edc8=_[_0x42e5('0x5a')](_0x41f891,['name',_0x42e5('0x64')]);_0x2601c6[_0x42e5('0x44')]=_0x42e5('0x64');_0x304891=as[_0x42e5('0x65')](_0x148d2c,_0x53edc8['type'],_0x2601c6);_0x48757e[_0x326086](_0x304891['text'],_0x304891['value'][_0x42e5('0x66')],_0x304891[_0x42e5('0x61')]['end']);}break;case _0x42e5('0x67'):var _0xb73aa8=_0x2601c6[_0x42e5('0x61')][_0x42e5('0x31')](',')[_0x42e5('0x2d')](function(_0x4361cb){return Number(_0x4361cb);});_0xb73aa8[_0x42e5('0x32')](function(_0x2c76e0){_0xffc1e2['or'](_0x42e5('0x68'),'%,'+_0x2c76e0+',%');});_0x1ddc39=_['union'](_0x1ddc39,_0xb73aa8);break;case _0x42e5('0x69'):if(_0x2601c6['operator']===_0x42e5('0x60')){_0x48757e[_0x326086](_0x42e5('0x6a'),'%'+_0x2601c6[_0x42e5('0x61')]+'%',null);}else{_0x53edc8=_[_0x42e5('0x5a')](_0x41f891,[_0x42e5('0x2a'),_0x42e5('0x6b')]);_0x2601c6[_0x42e5('0x44')]=_0x42e5('0x6b');_0x304891=as[_0x42e5('0x65')](_0x148d2c,_0x53edc8[_0x42e5('0x34')],_0x2601c6);_0x48757e[_0x326086](_0x304891[_0x42e5('0x6c')],_0x304891['value'][_0x42e5('0x66')],_0x304891['value'][_0x42e5('0x1f')]);}break;case'body':_0x304891=as[_0x42e5('0x65')]('me',null,_0x2601c6);_0x48757e[_0x326086](_0x304891[_0x42e5('0x6c')],_0x304891['value'][_0x42e5('0x66')],_0x304891[_0x42e5('0x61')]['end']);break;}}else{var _0x304891=as[_0x42e5('0x65')](_0x148d2c,_0x53edc8['type'],_0x2601c6);_0x48757e[_0x326086](_0x304891[_0x42e5('0x6c')],_0x304891[_0x42e5('0x61')][_0x42e5('0x66')],_0x304891['value'][_0x42e5('0x1f')]);}}}else{var _0x3cdc61=_(_0x470ac5[_0x42e5('0x35')])[_0x42e5('0x36')]()['map'](function(_0x42db50){return _['some'](_0x41f891,[_0x42e5('0x2a'),_0x42db50])?_0x42db50:undefined;})[_0x42e5('0x6d')]()[_0x42e5('0x61')]();if(!_[_0x42e5('0x6e')](_0x3cdc61)){_0x3cdc61[_0x42e5('0x32')](function(_0x3c6914){if(_0x3c6914===_0x42e5('0x6f')){_0x5b27f6['where'](_0x42e5('0x70'),[][_0x42e5('0x71')](_0x470ac5[_0x42e5('0x35')][_0x3c6914]));}else if(_0x3c6914===_0x42e5('0x72')){var _0x21a8aa=JSON[_0x42e5('0x73')](_0x470ac5[_0x42e5('0x35')][_0x3c6914])[_0x42e5('0x74')];var _0x292249=JSON['parse'](_0x470ac5[_0x42e5('0x35')][_0x3c6914])[_0x42e5('0x75')];_0x5b27f6[_0x42e5('0x76')](_0x42e5('0x77'),_0x21a8aa,_0x292249);}else{if(_0x470ac5['query'][_0x3c6914]===_0x42e5('0x78')){_0x5b27f6[_0x42e5('0x76')]('i.'+_0x3c6914+_0x42e5('0x79'));}else{_0x5b27f6[_0x42e5('0x76')]('i.'+_0x3c6914+'\x20=\x20?',_0x470ac5['query'][_0x3c6914]);}}});}if(_0x470ac5['query'][_0x42e5('0x7a')]){if(_0x470ac5[_0x42e5('0x35')][_0x42e5('0x7a')]==0x1){_0x5b27f6[_0x42e5('0x5c')](_0x42e5('0x7b'));}else{_0x5b27f6[_0x42e5('0x5c')](_0x42e5('0x7c'));}}if(_0x470ac5[_0x42e5('0x35')][_0x42e5('0x7d')]){_0x1ddc39=_['isArray'](_0x470ac5[_0x42e5('0x35')][_0x42e5('0x7d')])?_0x470ac5[_0x42e5('0x35')][_0x42e5('0x7d')]:new Array(_0x470ac5[_0x42e5('0x35')][_0x42e5('0x7d')]);_0x1ddc39[_0x42e5('0x32')](function(_0x147613){_0xffc1e2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x147613+',%');});}if(_0x470ac5['query'][_0x42e5('0x7e')]){var _0x201650=_0x470ac5['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x42e5('0x7f')]('\x27\x27',_0x42e5('0x80'));if(qs['isNumeric'](_0x201650)){_0x48757e['or'](_0x42e5('0x81'),_0x201650+'%')['or'](_0x42e5('0x82'),_0x201650+'%');}else{_0x48757e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x42e5('0x83')](_0x201650))['or'](_0x42e5('0x84'),_0x201650+'%');}}}_0x5b27f6['where'](_0x48757e);_0x5b27f6[_0x42e5('0x85')]('i.id');var _0x49945e={'type':db['Sequelize']['QueryTypes'][_0x42e5('0x86')],'raw':!![]};var _0x234e29=_0x5b27f6['clone']();_0x234e29[_0x42e5('0x44')](_0x42e5('0x87'));_0x234e29[_0x42e5('0x44')](_0x42e5('0x88'),_0x42e5('0x5b'));if(_0x25a040[_0x42e5('0x40')]){_0x25a040['order'][_0x42e5('0x32')](function(_0xe0f6ab){_0x5b27f6['order']('i.'+_0xe0f6ab[0x0],_0xe0f6ab[0x1]==='DESC'?![]:!![]);});}if(!_[_0x42e5('0x6e')](_0x1ddc39)){_0x5b27f6[_0x42e5('0x5c')](_0xffc1e2);_0x234e29[_0x42e5('0x76')](_0x42e5('0x89'),_0x1ddc39);}BPromise[_0x42e5('0x8a')]()[_0x42e5('0x27')](function(){if(!_0x2586b0){if(_0x470ac5[_0x42e5('0x35')]['SmsAccountId']||_0x470ac5['query']['journey'])return;_0x234e29['where'](_0x42e5('0x8b'));_0x5b27f6[_0x42e5('0x76')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x470ac5[_0x42e5('0x8c')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x42e5('0x27')](function(_0x2982a2){if(_[_0x42e5('0x6e')](_0x2982a2)){_0x234e29[_0x42e5('0x76')](_0x42e5('0x8d'));_0x5b27f6[_0x42e5('0x76')](_0x42e5('0x8d'));}else{_0x234e29[_0x42e5('0x76')](_0x42e5('0x70'),_[_0x42e5('0x2d')](_0x2982a2,'id'));_0x5b27f6[_0x42e5('0x76')](_0x42e5('0x70'),_[_0x42e5('0x2d')](_0x2982a2,'id'));}});})[_0x42e5('0x27')](function(){db[_0x42e5('0x8e')][_0x42e5('0x35')](_0x234e29[_0x42e5('0x8f')](),_0x49945e)[_0x42e5('0x27')](function(_0x511e71){_0x3c12c6[_0x42e5('0x21')]=_0x511e71[_0x42e5('0x3c')];if(_0x3c12c6[_0x42e5('0x21')]===0x0)return[];return db[_0x42e5('0x8e')][_0x42e5('0x35')](_0x5db771[_0x42e5('0x8f')](),_0x49945e)[_0x42e5('0x27')](function(_0x103338){_0x1c697a=_['keyBy'](_0x103338,'id');_0x49945e=_[_0x42e5('0x90')](_0x49945e,{'model':db[_0x42e5('0x91')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x470ac5[_0x42e5('0x35')][_0x42e5('0x3b')]){_0x25a040[_0x42e5('0x3a')]['forEach'](function(_0x590cc8){_0x5b27f6[_0x42e5('0x44')]('i.'+_0x590cc8);});}else{_0x5b27f6[_0x42e5('0x44')](_0x42e5('0x88'),_0x42e5('0x5b'));_0x5b27f6[_0x42e5('0x44')](_0x42e5('0x92'),_0x42e5('0x93'));_0x5b27f6[_0x42e5('0x44')](_0x42e5('0x94'),'Account.mandatoryDisposition');_0x5b27f6[_0x42e5('0x44')](_0x42e5('0x95'));_0x5b27f6['field'](_0x42e5('0x96'),_0x42e5('0x97'));_0x5b27f6[_0x42e5('0x44')](_0x42e5('0x98'),'Contact.lastName');_0x5b27f6['field']('c.email',_0x42e5('0x99'));_0x5b27f6[_0x42e5('0x44')](_0x42e5('0x9a'),_0x42e5('0x9b'));_0x5b27f6[_0x42e5('0x44')](_0x42e5('0x9c'),_0x42e5('0x9d'));_0x5b27f6['field'](_0x42e5('0x9e'),_0x42e5('0x9f'));_0x5b27f6[_0x42e5('0x44')]('o.fullname',_0x42e5('0xa0'));_0x5b27f6['field']('o.internal',_0x42e5('0xa1'));_0x5b27f6[_0x42e5('0x44')](_0x42e5('0xa2'),'TagIds');}if(_0x25a040['limit'])_0x5b27f6[_0x42e5('0x22')](_0x25a040['limit']);if(_0x25a040['offset'])_0x5b27f6[_0x42e5('0x3f')](_0x25a040[_0x42e5('0x3f')]);return db['sequelize'][_0x42e5('0x35')](_0x5b27f6[_0x42e5('0x8f')](),_0x49945e);})[_0x42e5('0x27')](function(_0x161f3d){_0x19f684[_0x42e5('0x76')](_0x42e5('0xa3'),_['map'](_0x161f3d,'id'));return db[_0x42e5('0x8e')][_0x42e5('0x35')](_0x19f684[_0x42e5('0x8f')](),_0x49945e)['then'](function(_0x27ee6e){var _0x13c9fd=_['groupBy'](_0x27ee6e,_0x42e5('0xa4'));var _0x3aa7be=[];_0x161f3d[_0x42e5('0x32')](function(_0x4a1bb8){_0x3aa7be[_0x42e5('0xa5')](updateSmsInteraction(_0x4a1bb8,_0x1c697a,_0x13c9fd));});return BPromise[_0x42e5('0xa6')](_0x3aa7be);});});})['then'](function(_0x4fcc38){_0x3c12c6[_0x42e5('0xa7')]=_0x4fcc38;return _0x3c12c6;})['then'](respondWithFilteredResult(_0x1cfc1d,_0x25a040));})[_0x42e5('0xa8')](handleError(_0x1cfc1d,null));};exports[_0x42e5('0xa9')]=function(_0x7e8361,_0x1d3c01){var _0x1ece99={'raw':![],'where':{'id':_0x7e8361[_0x42e5('0xaa')]['id']}},_0x5cf7e1={};_0x5cf7e1[_0x42e5('0x39')]=_[_0x42e5('0x36')](db['SmsInteraction'][_0x42e5('0xab')]);_0x5cf7e1[_0x42e5('0x35')]=_[_0x42e5('0x36')](_0x7e8361[_0x42e5('0x35')]);_0x5cf7e1['filters']=_[_0x42e5('0x38')](_0x5cf7e1['model'],_0x5cf7e1['query']);_0x1ece99[_0x42e5('0x3a')]=_[_0x42e5('0x38')](_0x5cf7e1[_0x42e5('0x39')],qs[_0x42e5('0x3b')](_0x7e8361[_0x42e5('0x35')]['fields']));_0x1ece99[_0x42e5('0x3a')]=_0x1ece99[_0x42e5('0x3a')][_0x42e5('0x3c')]?_0x1ece99[_0x42e5('0x3a')]:_0x5cf7e1[_0x42e5('0x39')];if(_0x7e8361[_0x42e5('0x35')][_0x42e5('0xac')]){_0x1ece99[_0x42e5('0xad')]=[{'all':!![]}];}_0x1ece99=_[_0x42e5('0x90')]({},_0x1ece99,_0x7e8361['options']);return db[_0x42e5('0x91')][_0x42e5('0x5a')](_0x1ece99)[_0x42e5('0x27')](handleEntityNotFound(_0x1d3c01,null))[_0x42e5('0x27')](respondWithResult(_0x1d3c01,null))[_0x42e5('0xa8')](handleError(_0x1d3c01,null));};exports[_0x42e5('0xae')]=function(_0x39c46,_0x432105){return db[_0x42e5('0x91')][_0x42e5('0xae')](_0x39c46['body'],{})['then'](respondWithResult(_0x432105,0xc9))['catch'](handleError(_0x432105,null));};exports[_0x42e5('0x26')]=function(_0x2b6553,_0x4b284a){if(_0x2b6553[_0x42e5('0xaf')]['id']){delete _0x2b6553['body']['id'];}return db[_0x42e5('0x91')]['find']({'where':{'id':_0x2b6553['params']['id']}})['then'](handleEntityNotFound(_0x4b284a,null))[_0x42e5('0x27')](saveUpdates(_0x2b6553[_0x42e5('0xaf')],null))[_0x42e5('0x27')](respondWithResult(_0x4b284a,null))[_0x42e5('0xa8')](handleError(_0x4b284a,null));};exports[_0x42e5('0x28')]=function(_0x5398c3,_0x4b5500){return db[_0x42e5('0x91')][_0x42e5('0x5a')]({'where':{'id':_0x5398c3[_0x42e5('0xaa')]['id']}})[_0x42e5('0x27')](handleEntityNotFound(_0x4b5500,null))[_0x42e5('0x27')](removeEntity(_0x4b5500,null))['catch'](handleError(_0x4b5500,null));};exports[_0x42e5('0xb0')]=function(_0x3d3b01,_0x3ec86e){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x3ec86e,null))[_0x42e5('0xa8')](handleError(_0x3ec86e,null));};exports['addMessage']=function(_0x164146,_0x333376,_0x4fb2fd){return db[_0x42e5('0xb1')][_0x42e5('0x5a')]({'where':{'id':_0x164146[_0x42e5('0xaa')]['id']}})['then'](handleEntityNotFound(_0x333376,null))[_0x42e5('0x27')](function(_0xa1efc){if(_0xa1efc){return _0xa1efc[_0x42e5('0xb2')](_0x164146[_0x42e5('0xaf')][_0x42e5('0xb3')],_['omit'](_0x164146[_0x42e5('0xaf')],[_0x42e5('0xb3'),'id'])||{});}})[_0x42e5('0x27')](respondWithResult(_0x333376,null))[_0x42e5('0xa8')](handleError(_0x333376,null));};exports[_0x42e5('0xb4')]=function(_0x59a32e,_0x1b74eb,_0x3d7d9c){var _0x4ca710={'raw':![],'where':{}};var _0x2cf42b={};var _0x11b2b8={'count':0x0,'rows':[]};return db[_0x42e5('0x91')][_0x42e5('0xb5')]({'where':{'id':_0x59a32e[_0x42e5('0xaa')]['id']}})[_0x42e5('0x27')](handleEntityNotFound(_0x1b74eb,null))[_0x42e5('0x27')](function(_0x279dea){if(_0x279dea){_0x2cf42b['model']=_[_0x42e5('0x36')](db[_0x42e5('0xb1')][_0x42e5('0xab')]);_0x2cf42b[_0x42e5('0x35')]=_[_0x42e5('0x36')](_0x59a32e['query']);_0x2cf42b[_0x42e5('0x37')]=_[_0x42e5('0x38')](_0x2cf42b[_0x42e5('0x39')],_0x2cf42b[_0x42e5('0x35')]);_0x4ca710['attributes']=_[_0x42e5('0x38')](_0x2cf42b[_0x42e5('0x39')],qs[_0x42e5('0x3b')](_0x59a32e[_0x42e5('0x35')][_0x42e5('0x3b')]));_0x4ca710[_0x42e5('0x3a')]=_0x4ca710[_0x42e5('0x3a')][_0x42e5('0x3c')]?_0x4ca710[_0x42e5('0x3a')]:_0x2cf42b[_0x42e5('0x39')];if(!_0x59a32e['query'][_0x42e5('0x3d')]('nolimit')){_0x4ca710[_0x42e5('0x22')]=qs['limit'](_0x59a32e['query'][_0x42e5('0x22')]);_0x4ca710[_0x42e5('0x3f')]=qs[_0x42e5('0x3f')](_0x59a32e[_0x42e5('0x35')][_0x42e5('0x3f')]);}_0x4ca710[_0x42e5('0x40')]=qs[_0x42e5('0x41')](_0x59a32e[_0x42e5('0x35')][_0x42e5('0x41')]);_0x4ca710[_0x42e5('0x76')]=qs[_0x42e5('0x37')](_[_0x42e5('0x42')](_0x59a32e[_0x42e5('0x35')],_0x2cf42b[_0x42e5('0x37')]));_0x4ca710['where'][_0x42e5('0xa4')]=_0x279dea['id'];if(_0x59a32e[_0x42e5('0x35')][_0x42e5('0x7e')]){_0x4ca710['where']=_[_0x42e5('0x90')](_0x4ca710['where'],{'$or':_['map'](_0x4ca710[_0x42e5('0x3a')],function(_0x1ad5ee){var _0x51ca3b={};_0x51ca3b[_0x1ad5ee]={'$like':'%'+_0x59a32e[_0x42e5('0x35')][_0x42e5('0x7e')]+'%'};return _0x51ca3b;})});}if(_0x59a32e[_0x42e5('0x35')]['$gte']){var _0x38653a=_0x59a32e[_0x42e5('0x35')][_0x42e5('0x74')]['split'](',');var _0x1f173f={};_0x1f173f[_0x38653a[0x0]]={'$gte':moment(_0x38653a[0x1])[_0x42e5('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4ca710[_0x42e5('0x76')]=_[_0x42e5('0x90')](_0x4ca710[_0x42e5('0x76')],_0x1f173f);}_0x4ca710=_['merge']({},_0x4ca710,_0x59a32e[_0x42e5('0xb7')]);return db[_0x42e5('0xb1')]['count']({'where':_0x4ca710[_0x42e5('0x76')]})['then'](function(_0x3ceac8){_0x11b2b8[_0x42e5('0x21')]=_0x3ceac8;if(_0x59a32e['query'][_0x42e5('0xac')]){_0x4ca710[_0x42e5('0xad')]=[{'all':!![]}];}return db[_0x42e5('0xb1')][_0x42e5('0xb8')](_0x4ca710);})[_0x42e5('0x27')](function(_0x3ebfd5){_0x11b2b8[_0x42e5('0xa7')]=_0x3ebfd5;return _0x11b2b8;});}})[_0x42e5('0x27')](respondWithFilteredResult(_0x1b74eb,_0x4ca710))[_0x42e5('0xa8')](handleError(_0x1b74eb,null));};exports[_0x42e5('0xb9')]=function(_0xe589e5,_0x44daee,_0x1d99b2){return db['SmsInteraction']['find']({'where':{'id':_0xe589e5[_0x42e5('0xaa')]['id']}})[_0x42e5('0x27')](handleEntityNotFound(_0x44daee,null))[_0x42e5('0x27')](function(_0x315f86){if(_0x315f86){return _0x315f86[_0x42e5('0xba')](_0xe589e5[_0x42e5('0xaf')][_0x42e5('0xb3')],_['omit'](_0xe589e5[_0x42e5('0xaf')],[_0x42e5('0xb3'),'id'])||{})[_0x42e5('0xbb')](function(){return db[_0x42e5('0x67')][_0x42e5('0xb8')]({'attributes':['id',_0x42e5('0x2a'),'color'],'where':{'id':_0xe589e5[_0x42e5('0xaf')][_0x42e5('0xb3')]}});})['then'](function(_0x2c18bd){socket[_0x42e5('0xbc')](_0x42e5('0xbd'),{'id':Number(_0xe589e5['params']['id']),'tags':_0x2c18bd||[]});return{'id':Number(_0xe589e5[_0x42e5('0xaa')]['id']),'tags':_0x2c18bd||[]};});}})['then'](respondWithResult(_0x44daee,null))[_0x42e5('0xa8')](handleError(_0x44daee,null));};exports[_0x42e5('0xbe')]=function(_0xa14584,_0x4a816b,_0x29d879){return db[_0x42e5('0x91')][_0x42e5('0x5a')]({'where':{'id':_0xa14584[_0x42e5('0xaa')]['id']}})[_0x42e5('0x27')](handleEntityNotFound(_0x4a816b,null))[_0x42e5('0x27')](function(_0x35f5f2){if(_0x35f5f2){return _0x35f5f2['removeTags'](_0xa14584[_0x42e5('0x35')][_0x42e5('0xb3')]);}})[_0x42e5('0x27')](respondWithStatusCode(_0x4a816b,null))[_0x42e5('0xa8')](handleError(_0x4a816b,null));};exports[_0x42e5('0xbf')]=function(_0x584da4,_0x359fe2){var _0x25ca2c=moment()[_0x42e5('0xc0')]()['toString']();var _0x4f35a4=path[_0x42e5('0xc1')](config['root'],_0x42e5('0xc2'),'files',_0x42e5('0xc3'));var _0x5f0e8e=path['join'](config[_0x42e5('0xc4')],_0x42e5('0xc2'),_0x42e5('0xc5'),'attachments');var _0x33f870=path[_0x42e5('0xc1')](_0x4f35a4,_0x25ca2c);var _0x7d3bd2=util['format'](_0x42e5('0xc6'),_0x584da4[_0x42e5('0xaa')]['id'],_0x25ca2c);var _0x22c7dd=path[_0x42e5('0xc1')](_0x4f35a4,_0x7d3bd2);var _0x5b0001=[];_0x5b0001['push']({'model':db[_0x42e5('0x69')],'as':_0x42e5('0x69'),'attributes':['id',_0x42e5('0x2e')],'raw':!![]});_0x5b0001[_0x42e5('0xa5')]({'model':db[_0x42e5('0xc7')],'as':_0x42e5('0x5e'),'attributes':['id','firstName',_0x42e5('0xc8')],'raw':!![]});var _0x147fc3=[{'model':db[_0x42e5('0xb1')],'as':'Messages','attributes':['id',_0x42e5('0xaf'),_0x42e5('0x72'),_0x42e5('0xc9'),_0x42e5('0xca'),_0x42e5('0x7a')],'include':_0x5b0001}];_0x147fc3[_0x42e5('0xa5')]({'model':db[_0x42e5('0xcb')],'as':_0x42e5('0xcc'),'attributes':['id','name']});_0x147fc3['push']({'model':db['User'],'as':_0x42e5('0xcd'),'attributes':['id',_0x42e5('0x2e')]});return db[_0x42e5('0x91')]['find']({'where':{'id':_0x584da4[_0x42e5('0xaa')]['id']},'include':_0x147fc3})[_0x42e5('0x27')](handleEntityNotFound(_0x359fe2,null))['then'](function(_0x1442a2){if(_0x1442a2){var _0x566515=_0x1442a2['get']({'plain':!![]});fs[_0x42e5('0xce')](_0x33f870);var _0x2ec7c6={'format':'A4','border':'10px','header':{'height':_0x42e5('0xcf'),'contents':{'first':_0x42e5('0xd0')}},'footer':{'height':_0x42e5('0xd1'),'contents':{'default':util[_0x42e5('0xb6')](_0x42e5('0xd2'),util[_0x42e5('0xb6')](_0x42e5('0xd3'),'Sms',_0x566515['id']),moment()[_0x42e5('0xb6')]('YYYY-MM-DD')['toString']())}}};var _0x347698={'channel':_0x42e5('0xd4'),'account':_0x566515['Account']['name'],'agent':_0x566515['Owner']?_0x566515['Owner']['fullname']:_0x42e5('0xd5'),'createdAt':moment(_0x566515[_0x42e5('0x72')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x566515[_0x42e5('0xd6')]?moment(_0x566515[_0x42e5('0xd7')])[_0x42e5('0xb6')](_0x42e5('0xd8'))['toString']():'','disposition':_0x566515[_0x42e5('0xd9')],'messages':_(_0x566515['Messages'])[_0x42e5('0x7e')]({'secret':![]})[_0x42e5('0x2d')](function(_0x4070c2){return{'date':moment(_0x4070c2[_0x42e5('0x72')])[_0x42e5('0xb6')](_0x42e5('0xd8'))[_0x42e5('0x8f')](),'sender':_0x4070c2[_0x42e5('0xc9')]===_0x42e5('0xda')?_0x4070c2[_0x42e5('0x69')]?_0x4070c2['User'][_0x42e5('0x2e')]:_0x42e5('0xdb'):_0x4070c2[_0x42e5('0x5e')][_0x42e5('0xdc')]+(_0x4070c2[_0x42e5('0x5e')][_0x42e5('0xc8')]?'\x20'+_0x4070c2[_0x42e5('0x5e')][_0x42e5('0xc8')]:''),'body':_0x4070c2['body'],'direction':_0x4070c2[_0x42e5('0xc9')]===_0x42e5('0xda')?'A':'C','secret':_0x4070c2[_0x42e5('0xca')],'read':_0x4070c2[_0x42e5('0x7a')]};})['value']()};return ejs[_0x42e5('0xdd')](path[_0x42e5('0xc1')](config[_0x42e5('0xc4')],_0x42e5('0xc2'),_0x42e5('0xde'),_0x42e5('0xdf')),{'interaction':_0x347698})['then'](function(_0x5d6ba1){return new BPromise(function(_0x42249f,_0x27dc39){pdf['create'](_0x5d6ba1,_0x2ec7c6)[_0x42e5('0xe0')](path[_0x42e5('0xc1')](_0x33f870,_0x42e5('0xe1')+_0x566515['id']+'-'+_0x25ca2c+_0x42e5('0xe2')),function(_0x223402,_0x5e14e7){if(_0x223402)return _0x27dc39(_0x223402);_0x42249f(_0x5e14e7);});});})[_0x42e5('0x27')](function(){return new BPromise(function(_0x4a9099,_0x397dbb){zipdir(_0x33f870,{'saveTo':_0x22c7dd},function(_0x40cc1a,_0x12d54c){if(_0x40cc1a)return _0x397dbb(_0x40cc1a);return _0x4a9099(_0x12d54c);});})[_0x42e5('0x27')](function(){return new BPromise(function(_0x3f9c68,_0x2e9459){rimraf(_0x33f870,function(_0x3cdc8c){if(_0x3cdc8c)_0x2e9459(_0x3cdc8c);return _0x3f9c68();});});})[_0x42e5('0x27')](function(){return _0x359fe2[_0x42e5('0xbf')](_0x22c7dd,_0x7d3bd2,function(_0x495bca){if(_0x495bca){console['log']('err',_0x495bca);}else{fs['unlinkSync'](_0x22c7dd);}});});});}else{return _0x359fe2['sendStatus'](0xc8);}})['catch'](handleError(_0x359fe2,null));}; \ No newline at end of file +var _0xb688=['defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','Users','map','fullname','Tags','TagIds','forEach','catch','index','SmsInteraction','rawAttributes','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','field','color','tools_tags','select','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','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?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`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?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','filters','includeAll','include','options','create','SmsMessage','addMessage','ids','omit','findOne','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','smsInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','SmsAccount','Account','Owner','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','N.A.','closed','closedAt','Messages','out','System','firstName','lastName','direction','secret','renderFile','transcript-','.pdf','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0xadd417,_0x207028){var _0x5c79e7=function(_0xa07df0){while(--_0xa07df0){_0xadd417['push'](_0xadd417['shift']());}};_0x5c79e7(++_0x207028);}(_0xb688,0xcf));var _0x8b68=function(_0xcd9837,_0x5a0efd){_0xcd9837=_0xcd9837-0x0;var _0x57f1ba=_0xb688[_0xcd9837];return _0x57f1ba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require(_0x8b68('0x2'));var jsonpatch=require(_0x8b68('0x3'));var rp=require(_0x8b68('0x4'));var moment=require(_0x8b68('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0xf'));var querystring=require(_0x8b68('0x10'));var Papa=require(_0x8b68('0x11'));var Redis=require(_0x8b68('0x12'));var authService=require(_0x8b68('0x13'));var qs=require(_0x8b68('0x14'));var as=require(_0x8b68('0x15'));var hardwareService=require(_0x8b68('0x16'));var logger=require(_0x8b68('0x17'))('api');var utils=require(_0x8b68('0x18'));var config=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];config[_0x8b68('0x1b')]=_[_0x8b68('0x1c')](config[_0x8b68('0x1b')],{'host':_0x8b68('0x1d'),'port':0x18eb});var socket=require(_0x8b68('0x1e'))(new Redis(config[_0x8b68('0x1b')]));require('./smsInteraction.socket')[_0x8b68('0x1f')](socket);function respondWithStatusCode(_0x509033,_0x5e3c66){_0x5e3c66=_0x5e3c66||0xcc;return function(_0x22f75b){if(_0x22f75b){return _0x509033[_0x8b68('0x20')](_0x5e3c66);}return _0x509033[_0x8b68('0x21')](_0x5e3c66)['end']();};}function respondWithResult(_0x5c8d0e,_0x23bd52){_0x23bd52=_0x23bd52||0xc8;return function(_0x5c1e44){if(_0x5c1e44){return _0x5c8d0e[_0x8b68('0x21')](_0x23bd52)[_0x8b68('0x22')](_0x5c1e44);}};}function respondWithFilteredResult(_0x1df44f,_0x10c9c6){return function(_0x491695){if(_0x491695){var _0xd17693=_0x491695[_0x8b68('0x23')],_0x203dd4=_0x10c9c6[_0x8b68('0x24')],_0x4a68c7=_0x10c9c6[_0x8b68('0x24')]+_0x10c9c6[_0x8b68('0x25')],_0x42b3bd;if(_0x4a68c7>=_0xd17693){_0x4a68c7=_0xd17693;_0x42b3bd=0xc8;}else{_0x42b3bd=0xce;}_0x1df44f['status'](_0x42b3bd);return _0x1df44f[_0x8b68('0x26')](_0x8b68('0x27'),_0x203dd4+'-'+_0x4a68c7+'/'+_0xd17693)[_0x8b68('0x22')](_0x491695);}return null;};}function patchUpdates(_0x1a9788){return function(_0x35d055){try{jsonpatch[_0x8b68('0x28')](_0x35d055,_0x1a9788,!![]);}catch(_0x5603d4){return BPromise['reject'](_0x5603d4);}return _0x35d055[_0x8b68('0x29')]();};}function saveUpdates(_0x59cb26,_0x332202){return function(_0x30b6d0){if(_0x30b6d0){return _0x30b6d0[_0x8b68('0x2a')](_0x59cb26)[_0x8b68('0x2b')](function(_0x32ddc5){return _0x32ddc5;});}return null;};}function removeEntity(_0x173524,_0x59bb8a){return function(_0x1a6fe8){if(_0x1a6fe8){return _0x1a6fe8[_0x8b68('0x2c')]()['then'](function(){_0x173524[_0x8b68('0x21')](0xcc)[_0x8b68('0x2d')]();});}};}function handleEntityNotFound(_0x240b0b,_0x5590ec){return function(_0x511ccf){if(!_0x511ccf){_0x240b0b['sendStatus'](0x194);}return _0x511ccf;};}function handleError(_0x92d186,_0x448e43){_0x448e43=_0x448e43||0x1f4;return function(_0x2ba2a3){logger['error'](_0x2ba2a3[_0x8b68('0x2e')]);if(_0x2ba2a3['name']){delete _0x2ba2a3['name'];}_0x92d186[_0x8b68('0x21')](_0x448e43)['send'](_0x2ba2a3);};}function getInteractionUsers(_0x26cad7,_0x3ac356){return new BPromise(function(_0x48e2c8,_0x494ce4){try{if(_0x3ac356[_0x26cad7['id']]){_0x26cad7[_0x8b68('0x2f')]=_[_0x8b68('0x30')](_0x3ac356[_0x26cad7['id']],function(_0x1e7c06){return{'id':_0x1e7c06['id'],'fullname':_0x1e7c06[_0x8b68('0x31')]};});}}catch(_0x210926){_0x494ce4(_0x210926);}_0x48e2c8(_0x26cad7);});}function getInteractionTags(_0x2ad2df,_0x460c37){return new BPromise(function(_0x5b7ed1,_0x3b6d1b){try{if(_0x2ad2df['TagIds']){_0x2ad2df[_0x8b68('0x32')]=[];_0x2ad2df[_0x8b68('0x33')]['split'](',')[_0x8b68('0x34')](function(_0x93daf7){_0x2ad2df[_0x8b68('0x32')]['push'](_0x460c37[_0x93daf7]);});}delete _0x2ad2df['TagIds'];}catch(_0x13c26b){_0x3b6d1b(_0x13c26b);}_0x5b7ed1(_0x2ad2df);});}function updateSmsInteraction(_0x8c11aa,_0x3e905a,_0x394cca){return new BPromise(function(_0x2c0ace,_0x334b13){return getInteractionUsers(_0x8c11aa,_0x394cca)[_0x8b68('0x2b')](function(_0x3e646e){return getInteractionTags(_0x3e646e,_0x3e905a);})[_0x8b68('0x2b')](function(_0x7fe301){_0x2c0ace(_0x7fe301);})[_0x8b68('0x35')](function(_0x15027a){_0x334b13(_0x15027a);});});}exports[_0x8b68('0x36')]=function(_0x439d36,_0x10aca9){var _0x151277={},_0x23336e={},_0x2a7dd5={'count':0x0,'rows':[]};var _0x120b34=_[_0x8b68('0x30')](db[_0x8b68('0x37')][_0x8b68('0x38')],function(_0x48abb7){return{'name':_0x48abb7['fieldName'],'type':_0x48abb7[_0x8b68('0x39')][_0x8b68('0x3a')]};});_0x23336e[_0x8b68('0x3b')]=_[_0x8b68('0x30')](_0x120b34,_0x8b68('0x3c'));_0x23336e[_0x8b68('0x3d')]=_[_0x8b68('0x3e')](_0x439d36[_0x8b68('0x3d')]);_0x23336e['filters']=_[_0x8b68('0x3f')](_0x23336e[_0x8b68('0x3b')],_0x23336e[_0x8b68('0x3d')]);_0x151277[_0x8b68('0x40')]=_[_0x8b68('0x3f')](_0x23336e[_0x8b68('0x3b')],qs[_0x8b68('0x41')](_0x439d36[_0x8b68('0x3d')]['fields']));_0x151277[_0x8b68('0x40')]=_0x151277[_0x8b68('0x40')][_0x8b68('0x42')]?_0x151277[_0x8b68('0x40')]:_0x23336e[_0x8b68('0x3b')];if(!_0x439d36[_0x8b68('0x3d')][_0x8b68('0x43')]('nolimit')){_0x151277[_0x8b68('0x25')]=qs[_0x8b68('0x25')](_0x439d36['query'][_0x8b68('0x25')]);_0x151277[_0x8b68('0x24')]=qs['offset'](_0x439d36['query']['offset']);}_0x151277['order']=qs[_0x8b68('0x44')](_0x439d36[_0x8b68('0x3d')]['sort']);_0x151277[_0x8b68('0x45')]=qs['filters'](_[_0x8b68('0x46')](_0x439d36[_0x8b68('0x3d')],_0x23336e['filters']),_0x120b34);var _0x2f90d9=[];var _0x5ae345=squel['select']()['field']('id')[_0x8b68('0x47')](_0x8b68('0x3c'))[_0x8b68('0x47')](_0x8b68('0x48'))['from'](_0x8b68('0x49'));var _0x58a5e3=squel[_0x8b68('0x4a')]()[_0x8b68('0x47')]('u.id')[_0x8b68('0x47')](_0x8b68('0x4b'))[_0x8b68('0x47')](_0x8b68('0x4c'))['from'](_0x8b68('0x4d'),'ui')[_0x8b68('0x4e')](_0x8b68('0x4f'),'u',_0x8b68('0x50'));var _0xae2c2a=squel[_0x8b68('0x4a')]()[_0x8b68('0x51')](_0x8b68('0x52'),'i')[_0x8b68('0x4e')](_0x8b68('0x53'),'c',_0x8b68('0x54'))[_0x8b68('0x4e')](_0x8b68('0x4f'),'o',_0x8b68('0x55'))[_0x8b68('0x4e')](_0x8b68('0x56'),'a','a.id\x20=\x20i.SmsAccountId')[_0x8b68('0x4e')](_0x8b68('0x57'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x8b68('0x4e')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0x8b68('0x49'),'t',_0x8b68('0x58'));var _0x34047c=squel[_0x8b68('0x59')]();var _0x49e279=[];var _0x522f47=squel[_0x8b68('0x59')]();var _0x163fd5;if(_0x439d36[_0x8b68('0x3d')]['search']){_0x163fd5=as[_0x8b68('0x5a')](_0x439d36[_0x8b68('0x3d')]['search']);var _0x429ebb=_0x163fd5[_0x8b68('0x5b')];for(var _0x595942=0x0;_0x595942<_0x163fd5[_0x8b68('0x5c')][_0x8b68('0x42')];_0x595942++){var _0x51bf1b=_0x163fd5[_0x8b68('0x5c')][_0x595942];var _0x735e17='i';var _0x48f886=_['find'](_0x120b34,['name',_0x51bf1b[_0x8b68('0x47')]]);if(!_0x48f886){switch(_0x51bf1b[_0x8b68('0x47')]){case _0x8b68('0x5d'):if(_0x51bf1b[_0x8b68('0x5e')]==0x1){_0xae2c2a['having']('`'+_0x51bf1b['field']+_0x8b68('0x5f'));}else{_0xae2c2a[_0x8b68('0x60')]('`'+_0x51bf1b[_0x8b68('0x47')]+'`\x20>\x200');}break;case _0x8b68('0x61'):if(_0x51bf1b[_0x8b68('0x62')]===_0x8b68('0x63')){if(_0x51bf1b['value'][_0x8b68('0x64')]('\x20')['length']>0x1){_0x34047c[_0x429ebb](_0x8b68('0x65'),qs[_0x8b68('0x66')](_0x51bf1b['value']),null);}else{var _0xba7139='%'+_0x51bf1b[_0x8b68('0x5e')]+'%';_0x34047c[_0x429ebb](_0x8b68('0x67'),_0xba7139,_0xba7139,_0xba7139);}}else{_0x48f886=_[_0x8b68('0x68')](_0x120b34,[_0x8b68('0x3c'),'ContactId']);_0x51bf1b[_0x8b68('0x47')]=_0x8b68('0x69');_0x401c20=as[_0x8b68('0x6a')](_0x735e17,_0x48f886[_0x8b68('0x39')],_0x51bf1b);_0x34047c[_0x429ebb](_0x401c20[_0x8b68('0x6b')],_0x401c20[_0x8b68('0x5e')][_0x8b68('0x6c')],_0x401c20[_0x8b68('0x5e')]['end']);}break;case _0x8b68('0x6d'):var _0x1a85da=_0x51bf1b[_0x8b68('0x5e')][_0x8b68('0x64')](',')[_0x8b68('0x30')](function(_0x4677b6){return Number(_0x4677b6);});_0x1a85da[_0x8b68('0x34')](function(_0x37c4cb){_0x522f47['or'](_0x8b68('0x6e'),'%,'+_0x37c4cb+',%');});_0x49e279=_[_0x8b68('0x6f')](_0x49e279,_0x1a85da);break;case _0x8b68('0x70'):if(_0x51bf1b[_0x8b68('0x62')]===_0x8b68('0x63')){_0x34047c[_0x429ebb](_0x8b68('0x71'),'%'+_0x51bf1b[_0x8b68('0x5e')]+'%',null);}else{_0x48f886=_[_0x8b68('0x68')](_0x120b34,[_0x8b68('0x3c'),_0x8b68('0x72')]);_0x51bf1b[_0x8b68('0x47')]=_0x8b68('0x72');_0x401c20=as['buildExpression'](_0x735e17,_0x48f886[_0x8b68('0x39')],_0x51bf1b);_0x34047c[_0x429ebb](_0x401c20['text'],_0x401c20['value'][_0x8b68('0x6c')],_0x401c20['value'][_0x8b68('0x2d')]);}break;case _0x8b68('0x73'):_0x401c20=as[_0x8b68('0x6a')]('me',null,_0x51bf1b);_0x34047c[_0x429ebb](_0x401c20['text'],_0x401c20[_0x8b68('0x5e')][_0x8b68('0x6c')],_0x401c20[_0x8b68('0x5e')][_0x8b68('0x2d')]);break;}}else{var _0x401c20=as[_0x8b68('0x6a')](_0x735e17,_0x48f886[_0x8b68('0x39')],_0x51bf1b);_0x34047c[_0x429ebb](_0x401c20['text'],_0x401c20['value'][_0x8b68('0x6c')],_0x401c20[_0x8b68('0x5e')][_0x8b68('0x2d')]);}}}else{var _0x371526=_(_0x439d36[_0x8b68('0x3d')])[_0x8b68('0x3e')]()[_0x8b68('0x30')](function(_0x314f1e){return _[_0x8b68('0x74')](_0x120b34,[_0x8b68('0x3c'),_0x314f1e])?_0x314f1e:undefined;})[_0x8b68('0x75')]()[_0x8b68('0x5e')]();if(!_[_0x8b68('0x76')](_0x371526)){_0x371526[_0x8b68('0x34')](function(_0x38fedf){if(_0x38fedf===_0x8b68('0x77')){_0xae2c2a[_0x8b68('0x45')](_0x8b68('0x78'),[]['concat'](_0x439d36['query'][_0x38fedf]));}else if(_0x38fedf===_0x8b68('0x79')){var _0x23e01a=JSON['parse'](_0x439d36['query'][_0x38fedf])['$gte'];var _0x39a04e=JSON[_0x8b68('0x7a')](_0x439d36[_0x8b68('0x3d')][_0x38fedf])[_0x8b68('0x7b')];_0xae2c2a[_0x8b68('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x23e01a,_0x39a04e);}else{if(_0x439d36[_0x8b68('0x3d')][_0x38fedf]===_0x8b68('0x7c')){_0xae2c2a['where']('i.'+_0x38fedf+_0x8b68('0x7d'));}else{_0xae2c2a['where']('i.'+_0x38fedf+'\x20=\x20?',_0x439d36['query'][_0x38fedf]);}}});}if(_0x439d36[_0x8b68('0x3d')][_0x8b68('0x7e')]){if(_0x439d36[_0x8b68('0x3d')][_0x8b68('0x7e')]==0x1){_0xae2c2a[_0x8b68('0x60')](_0x8b68('0x7f'));}else{_0xae2c2a[_0x8b68('0x60')](_0x8b68('0x80'));}}if(_0x439d36[_0x8b68('0x3d')][_0x8b68('0x81')]){_0x49e279=_['isArray'](_0x439d36[_0x8b68('0x3d')][_0x8b68('0x81')])?_0x439d36[_0x8b68('0x3d')]['tag']:new Array(_0x439d36['query'][_0x8b68('0x81')]);_0x49e279[_0x8b68('0x34')](function(_0x525b41){_0x522f47['or'](_0x8b68('0x6e'),'%,'+_0x525b41+',%');});}if(_0x439d36[_0x8b68('0x3d')][_0x8b68('0x82')]){var _0x2c2f6d=_0x439d36['query'][_0x8b68('0x82')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x8b68('0x83'));if(qs['isNumeric'](_0x2c2f6d)){_0x34047c['or'](_0x8b68('0x84'),_0x2c2f6d+'%')['or'](_0x8b68('0x85'),_0x2c2f6d+'%');}else{_0x34047c['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8b68('0x66')](_0x2c2f6d))['or'](_0x8b68('0x86'),_0x2c2f6d+'%');}}}_0xae2c2a[_0x8b68('0x45')](_0x34047c);_0xae2c2a[_0x8b68('0x87')](_0x8b68('0x88'));var _0x4afa60={'type':db[_0x8b68('0x89')][_0x8b68('0x8a')][_0x8b68('0x8b')],'raw':!![]};var _0x2f87e8=_0xae2c2a[_0x8b68('0x8c')]();_0x2f87e8['field']('i.id');_0x2f87e8[_0x8b68('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8b68('0x5d'));if(_0x151277[_0x8b68('0x8d')]){_0x151277[_0x8b68('0x8d')][_0x8b68('0x34')](function(_0x3f3b31){_0xae2c2a[_0x8b68('0x8d')]('i.'+_0x3f3b31[0x0],_0x3f3b31[0x1]===_0x8b68('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x49e279)){_0xae2c2a[_0x8b68('0x60')](_0x522f47);_0x2f87e8['where'](_0x8b68('0x8f'),_0x49e279);}BPromise[_0x8b68('0x90')]()[_0x8b68('0x2b')](function(){if(!_0x163fd5){if(_0x439d36['query'][_0x8b68('0x77')]||_0x439d36['query'][_0x8b68('0x91')])return;_0x2f87e8['where'](_0x8b68('0x92'));_0xae2c2a[_0x8b68('0x45')](_0x8b68('0x92'));return;}return _0x439d36['user'][_0x8b68('0x93')]({'attributes':['id'],'raw':!![]})[_0x8b68('0x2b')](function(_0x3d8a44){if(_[_0x8b68('0x76')](_0x3d8a44)){_0x2f87e8[_0x8b68('0x45')](_0x8b68('0x94'));_0xae2c2a[_0x8b68('0x45')](_0x8b68('0x94'));}else{_0x2f87e8[_0x8b68('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0x8b68('0x30')](_0x3d8a44,'id'));_0xae2c2a[_0x8b68('0x45')](_0x8b68('0x78'),_[_0x8b68('0x30')](_0x3d8a44,'id'));}});})[_0x8b68('0x2b')](function(){db['sequelize'][_0x8b68('0x3d')](_0x2f87e8['toString'](),_0x4afa60)[_0x8b68('0x2b')](function(_0x2de166){_0x2a7dd5['count']=_0x2de166[_0x8b68('0x42')];if(_0x2a7dd5[_0x8b68('0x23')]===0x0)return[];return db[_0x8b68('0x95')]['query'](_0x5ae345[_0x8b68('0x96')](),_0x4afa60)[_0x8b68('0x2b')](function(_0x43a874){_0x2f90d9=_[_0x8b68('0x97')](_0x43a874,'id');_0x4afa60=_[_0x8b68('0x98')](_0x4afa60,{'model':db[_0x8b68('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x439d36['query'][_0x8b68('0x41')]){_0x151277[_0x8b68('0x40')][_0x8b68('0x34')](function(_0x4e5d13){_0xae2c2a[_0x8b68('0x47')]('i.'+_0x4e5d13);});}else{_0xae2c2a[_0x8b68('0x47')](_0x8b68('0x99'),_0x8b68('0x5d'));_0xae2c2a[_0x8b68('0x47')](_0x8b68('0x9a'),_0x8b68('0x9b'));_0xae2c2a[_0x8b68('0x47')](_0x8b68('0x9c'),_0x8b68('0x9d'));_0xae2c2a[_0x8b68('0x47')]('i.*');_0xae2c2a['field'](_0x8b68('0x9e'),_0x8b68('0x9f'));_0xae2c2a[_0x8b68('0x47')](_0x8b68('0xa0'),_0x8b68('0xa1'));_0xae2c2a['field'](_0x8b68('0xa2'),_0x8b68('0xa3'));_0xae2c2a[_0x8b68('0x47')](_0x8b68('0xa4'),'Contact.phone');_0xae2c2a['field'](_0x8b68('0xa5'),_0x8b68('0xa6'));_0xae2c2a[_0x8b68('0x47')](_0x8b68('0xa7'),_0x8b68('0xa8'));_0xae2c2a[_0x8b68('0x47')](_0x8b68('0xa9'),_0x8b68('0xaa'));_0xae2c2a['field'](_0x8b68('0xab'),_0x8b68('0xac'));_0xae2c2a[_0x8b68('0x47')](_0x8b68('0xad'),_0x8b68('0x33'));}if(_0x151277[_0x8b68('0x25')])_0xae2c2a['limit'](_0x151277[_0x8b68('0x25')]);if(_0x151277[_0x8b68('0x24')])_0xae2c2a[_0x8b68('0x24')](_0x151277['offset']);return db[_0x8b68('0x95')]['query'](_0xae2c2a[_0x8b68('0x96')](),_0x4afa60);})['then'](function(_0x21399f){_0x58a5e3[_0x8b68('0x45')](_0x8b68('0xae'),_[_0x8b68('0x30')](_0x21399f,'id'));return db[_0x8b68('0x95')][_0x8b68('0x3d')](_0x58a5e3['toString'](),_0x4afa60)['then'](function(_0x58e99a){var _0xa20bfd=_[_0x8b68('0xaf')](_0x58e99a,_0x8b68('0xb0'));var _0x198b79=[];_0x21399f[_0x8b68('0x34')](function(_0x401229){_0x198b79[_0x8b68('0xb1')](updateSmsInteraction(_0x401229,_0x2f90d9,_0xa20bfd));});return BPromise[_0x8b68('0xb2')](_0x198b79);});});})[_0x8b68('0x2b')](function(_0x60f6e5){_0x2a7dd5[_0x8b68('0xb3')]=_0x60f6e5;return _0x2a7dd5;})[_0x8b68('0x2b')](respondWithFilteredResult(_0x10aca9,_0x151277));})[_0x8b68('0x35')](handleError(_0x10aca9,null));};exports[_0x8b68('0xb4')]=function(_0x322e3c,_0x5e76ac){var _0x4b5045={'raw':![],'where':{'id':_0x322e3c[_0x8b68('0xb5')]['id']}},_0x5b042c={};_0x5b042c[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](db[_0x8b68('0x37')][_0x8b68('0x38')]);_0x5b042c['query']=_[_0x8b68('0x3e')](_0x322e3c['query']);_0x5b042c[_0x8b68('0xb6')]=_['intersection'](_0x5b042c[_0x8b68('0x3b')],_0x5b042c['query']);_0x4b5045[_0x8b68('0x40')]=_['intersection'](_0x5b042c[_0x8b68('0x3b')],qs[_0x8b68('0x41')](_0x322e3c['query'][_0x8b68('0x41')]));_0x4b5045[_0x8b68('0x40')]=_0x4b5045['attributes'][_0x8b68('0x42')]?_0x4b5045['attributes']:_0x5b042c[_0x8b68('0x3b')];if(_0x322e3c['query'][_0x8b68('0xb7')]){_0x4b5045[_0x8b68('0xb8')]=[{'all':!![]}];}_0x4b5045=_[_0x8b68('0x98')]({},_0x4b5045,_0x322e3c[_0x8b68('0xb9')]);return db[_0x8b68('0x37')][_0x8b68('0x68')](_0x4b5045)[_0x8b68('0x2b')](handleEntityNotFound(_0x5e76ac,null))['then'](respondWithResult(_0x5e76ac,null))[_0x8b68('0x35')](handleError(_0x5e76ac,null));};exports[_0x8b68('0xba')]=function(_0x1e34f8,_0x22c8cb){return db[_0x8b68('0x37')][_0x8b68('0xba')](_0x1e34f8[_0x8b68('0x73')],{})[_0x8b68('0x2b')](respondWithResult(_0x22c8cb,0xc9))[_0x8b68('0x35')](handleError(_0x22c8cb,null));};exports[_0x8b68('0x2a')]=function(_0x334bdc,_0x18305f){if(_0x334bdc[_0x8b68('0x73')]['id']){delete _0x334bdc[_0x8b68('0x73')]['id'];}return db['SmsInteraction'][_0x8b68('0x68')]({'where':{'id':_0x334bdc[_0x8b68('0xb5')]['id']}})[_0x8b68('0x2b')](handleEntityNotFound(_0x18305f,null))[_0x8b68('0x2b')](saveUpdates(_0x334bdc[_0x8b68('0x73')],null))[_0x8b68('0x2b')](respondWithResult(_0x18305f,null))['catch'](handleError(_0x18305f,null));};exports[_0x8b68('0x2c')]=function(_0x2433a5,_0x3a24f8){return db[_0x8b68('0x37')][_0x8b68('0x68')]({'where':{'id':_0x2433a5[_0x8b68('0xb5')]['id']}})[_0x8b68('0x2b')](handleEntityNotFound(_0x3a24f8,null))[_0x8b68('0x2b')](removeEntity(_0x3a24f8,null))[_0x8b68('0x35')](handleError(_0x3a24f8,null));};exports['describe']=function(_0x31d70c,_0x4df181){return db['SmsInteraction']['describe']()[_0x8b68('0x2b')](respondWithResult(_0x4df181,null))[_0x8b68('0x35')](handleError(_0x4df181,null));};exports['addMessage']=function(_0x39258e,_0x1dba7b,_0x56f8af){return db[_0x8b68('0xbb')][_0x8b68('0x68')]({'where':{'id':_0x39258e[_0x8b68('0xb5')]['id']}})[_0x8b68('0x2b')](handleEntityNotFound(_0x1dba7b,null))[_0x8b68('0x2b')](function(_0x14bbfc){if(_0x14bbfc){return _0x14bbfc[_0x8b68('0xbc')](_0x39258e['body'][_0x8b68('0xbd')],_[_0x8b68('0xbe')](_0x39258e['body'],[_0x8b68('0xbd'),'id'])||{});}})[_0x8b68('0x2b')](respondWithResult(_0x1dba7b,null))['catch'](handleError(_0x1dba7b,null));};exports['getMessages']=function(_0x798a24,_0xed7a85,_0x2f62ab){var _0x1c5aaa={'raw':![],'where':{}};var _0x20d8ff={};var _0x15897a={'count':0x0,'rows':[]};return db[_0x8b68('0x37')][_0x8b68('0xbf')]({'where':{'id':_0x798a24['params']['id']}})[_0x8b68('0x2b')](handleEntityNotFound(_0xed7a85,null))['then'](function(_0x4d26aa){if(_0x4d26aa){_0x20d8ff[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](db['SmsMessage'][_0x8b68('0x38')]);_0x20d8ff['query']=_[_0x8b68('0x3e')](_0x798a24[_0x8b68('0x3d')]);_0x20d8ff[_0x8b68('0xb6')]=_['intersection'](_0x20d8ff[_0x8b68('0x3b')],_0x20d8ff['query']);_0x1c5aaa['attributes']=_[_0x8b68('0x3f')](_0x20d8ff[_0x8b68('0x3b')],qs[_0x8b68('0x41')](_0x798a24[_0x8b68('0x3d')][_0x8b68('0x41')]));_0x1c5aaa[_0x8b68('0x40')]=_0x1c5aaa[_0x8b68('0x40')]['length']?_0x1c5aaa[_0x8b68('0x40')]:_0x20d8ff[_0x8b68('0x3b')];if(!_0x798a24[_0x8b68('0x3d')][_0x8b68('0x43')](_0x8b68('0xc0'))){_0x1c5aaa[_0x8b68('0x25')]=qs[_0x8b68('0x25')](_0x798a24['query'][_0x8b68('0x25')]);_0x1c5aaa[_0x8b68('0x24')]=qs['offset'](_0x798a24['query'][_0x8b68('0x24')]);}_0x1c5aaa[_0x8b68('0x8d')]=qs['sort'](_0x798a24[_0x8b68('0x3d')][_0x8b68('0x44')]);_0x1c5aaa[_0x8b68('0x45')]=qs[_0x8b68('0xb6')](_[_0x8b68('0x46')](_0x798a24[_0x8b68('0x3d')],_0x20d8ff[_0x8b68('0xb6')]));_0x1c5aaa['where'][_0x8b68('0xb0')]=_0x4d26aa['id'];if(_0x798a24[_0x8b68('0x3d')][_0x8b68('0x82')]){_0x1c5aaa['where']=_['merge'](_0x1c5aaa[_0x8b68('0x45')],{'$or':_[_0x8b68('0x30')](_0x1c5aaa[_0x8b68('0x40')],function(_0x54d99a){var _0x4c8fb8={};_0x4c8fb8[_0x54d99a]={'$like':'%'+_0x798a24[_0x8b68('0x3d')][_0x8b68('0x82')]+'%'};return _0x4c8fb8;})});}if(_0x798a24[_0x8b68('0x3d')]['$gte']){var _0x48e035=_0x798a24['query'][_0x8b68('0xc1')][_0x8b68('0x64')](',');var _0xb1e53c={};_0xb1e53c[_0x48e035[0x0]]={'$gte':moment(_0x48e035[0x1])[_0x8b68('0xc2')](_0x8b68('0xc3'))};_0x1c5aaa['where']=_['merge'](_0x1c5aaa[_0x8b68('0x45')],_0xb1e53c);}_0x1c5aaa=_['merge']({},_0x1c5aaa,_0x798a24['options']);return db['SmsMessage'][_0x8b68('0x23')]({'where':_0x1c5aaa[_0x8b68('0x45')]})[_0x8b68('0x2b')](function(_0x53602b){_0x15897a[_0x8b68('0x23')]=_0x53602b;if(_0x798a24['query'][_0x8b68('0xb7')]){_0x1c5aaa[_0x8b68('0xb8')]=[{'all':!![]}];}return db[_0x8b68('0xbb')][_0x8b68('0xc4')](_0x1c5aaa);})[_0x8b68('0x2b')](function(_0x8beb27){_0x15897a[_0x8b68('0xb3')]=_0x8beb27;return _0x15897a;});}})[_0x8b68('0x2b')](respondWithFilteredResult(_0xed7a85,_0x1c5aaa))[_0x8b68('0x35')](handleError(_0xed7a85,null));};exports[_0x8b68('0xc5')]=function(_0x25e8cd,_0x14e073,_0x21e601){return db[_0x8b68('0x37')][_0x8b68('0x68')]({'where':{'id':_0x25e8cd[_0x8b68('0xb5')]['id']}})[_0x8b68('0x2b')](handleEntityNotFound(_0x14e073,null))[_0x8b68('0x2b')](function(_0x1bf8fb){if(_0x1bf8fb){return _0x1bf8fb['setTags'](_0x25e8cd[_0x8b68('0x73')]['ids'],_[_0x8b68('0xbe')](_0x25e8cd[_0x8b68('0x73')],[_0x8b68('0xbd'),'id'])||{})[_0x8b68('0xc6')](function(){return db[_0x8b68('0x6d')][_0x8b68('0xc4')]({'attributes':['id',_0x8b68('0x3c'),_0x8b68('0x48')],'where':{'id':_0x25e8cd[_0x8b68('0x73')][_0x8b68('0xbd')]}});})[_0x8b68('0x2b')](function(_0x477cd1){socket['emit'](_0x8b68('0xc7'),{'id':Number(_0x25e8cd[_0x8b68('0xb5')]['id']),'tags':_0x477cd1||[]});return{'id':Number(_0x25e8cd[_0x8b68('0xb5')]['id']),'tags':_0x477cd1||[]};});}})[_0x8b68('0x2b')](respondWithResult(_0x14e073,null))[_0x8b68('0x35')](handleError(_0x14e073,null));};exports[_0x8b68('0xc8')]=function(_0x16eea0,_0x45b488,_0x3a3f59){return db[_0x8b68('0x37')][_0x8b68('0x68')]({'where':{'id':_0x16eea0['params']['id']}})[_0x8b68('0x2b')](handleEntityNotFound(_0x45b488,null))[_0x8b68('0x2b')](function(_0x17251d){if(_0x17251d){return _0x17251d[_0x8b68('0xc8')](_0x16eea0[_0x8b68('0x3d')]['ids']);}})[_0x8b68('0x2b')](respondWithStatusCode(_0x45b488,null))[_0x8b68('0x35')](handleError(_0x45b488,null));};exports['download']=function(_0x14021d,_0x420ed6){var _0x4a524e=moment()['unix']()[_0x8b68('0x96')]();var _0x25684b=path[_0x8b68('0xc9')](config[_0x8b68('0xca')],_0x8b68('0xcb'),_0x8b68('0xcc'),_0x8b68('0xcd'));var _0x44fa68=path['join'](config[_0x8b68('0xca')],_0x8b68('0xcb'),_0x8b68('0xcc'),_0x8b68('0xce'));var _0x5124b2=path[_0x8b68('0xc9')](_0x25684b,_0x4a524e);var _0x5df8a1=util[_0x8b68('0xc2')](_0x8b68('0xcf'),_0x14021d[_0x8b68('0xb5')]['id'],_0x4a524e);var _0x3c2fb6=path[_0x8b68('0xc9')](_0x25684b,_0x5df8a1);var _0x2f92d1=[];_0x2f92d1['push']({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x2f92d1['push']({'model':db[_0x8b68('0xd0')],'as':_0x8b68('0x61'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x416662=[{'model':db[_0x8b68('0xbb')],'as':'Messages','attributes':['id',_0x8b68('0x73'),_0x8b68('0x79'),'direction','secret',_0x8b68('0x7e')],'include':_0x2f92d1}];_0x416662[_0x8b68('0xb1')]({'model':db[_0x8b68('0xd1')],'as':_0x8b68('0xd2'),'attributes':['id',_0x8b68('0x3c')]});_0x416662[_0x8b68('0xb1')]({'model':db[_0x8b68('0x70')],'as':_0x8b68('0xd3'),'attributes':['id','fullname']});return db[_0x8b68('0x37')][_0x8b68('0x68')]({'where':{'id':_0x14021d[_0x8b68('0xb5')]['id']},'include':_0x416662})[_0x8b68('0x2b')](handleEntityNotFound(_0x420ed6,null))[_0x8b68('0x2b')](function(_0x54bac7){if(_0x54bac7){var _0x4442a9=_0x54bac7['get']({'plain':!![]});fs[_0x8b68('0xd4')](_0x5124b2);var _0x5c5190={'format':'A4','border':_0x8b68('0xd5'),'header':{'height':_0x8b68('0xd6'),'contents':{'first':_0x8b68('0xd7')}},'footer':{'height':'30px','contents':{'default':util[_0x8b68('0xc2')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x8b68('0xc2')](_0x8b68('0xd8'),_0x8b68('0xd9'),_0x4442a9['id']),moment()[_0x8b68('0xc2')]('YYYY-MM-DD')[_0x8b68('0x96')]())}}};var _0x1b12a6={'channel':_0x8b68('0xd9'),'account':_0x4442a9[_0x8b68('0xd2')][_0x8b68('0x3c')],'agent':_0x4442a9[_0x8b68('0xd3')]?_0x4442a9[_0x8b68('0xd3')][_0x8b68('0x31')]:_0x8b68('0xda'),'createdAt':moment(_0x4442a9[_0x8b68('0x79')])[_0x8b68('0xc2')](_0x8b68('0xc3'))[_0x8b68('0x96')](),'closedAt':_0x4442a9[_0x8b68('0xdb')]?moment(_0x4442a9[_0x8b68('0xdc')])[_0x8b68('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8b68('0x96')]():'','disposition':_0x4442a9['disposition'],'messages':_(_0x4442a9[_0x8b68('0xdd')])[_0x8b68('0x82')]({'secret':![]})[_0x8b68('0x30')](function(_0x44f4a9){return{'date':moment(_0x44f4a9[_0x8b68('0x79')])[_0x8b68('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x44f4a9['direction']===_0x8b68('0xde')?_0x44f4a9[_0x8b68('0x70')]?_0x44f4a9[_0x8b68('0x70')][_0x8b68('0x31')]:_0x8b68('0xdf'):_0x44f4a9[_0x8b68('0x61')][_0x8b68('0xe0')]+(_0x44f4a9[_0x8b68('0x61')][_0x8b68('0xe1')]?'\x20'+_0x44f4a9[_0x8b68('0x61')]['lastName']:''),'body':_0x44f4a9['body'],'direction':_0x44f4a9[_0x8b68('0xe2')]==='out'?'A':'C','secret':_0x44f4a9[_0x8b68('0xe3')],'read':_0x44f4a9[_0x8b68('0x7e')]};})[_0x8b68('0x5e')]()};return ejs[_0x8b68('0xe4')](path[_0x8b68('0xc9')](config[_0x8b68('0xca')],_0x8b68('0xcb'),'views','downloadInteraction.html'),{'interaction':_0x1b12a6})[_0x8b68('0x2b')](function(_0x475c22){return new BPromise(function(_0x271be8,_0x2da7fa){pdf[_0x8b68('0xba')](_0x475c22,_0x5c5190)['toFile'](path[_0x8b68('0xc9')](_0x5124b2,_0x8b68('0xe5')+_0x4442a9['id']+'-'+_0x4a524e+_0x8b68('0xe6')),function(_0x28e5f1,_0x13896b){if(_0x28e5f1)return _0x2da7fa(_0x28e5f1);_0x271be8(_0x13896b);});});})['then'](function(){return new BPromise(function(_0x9d6042,_0x309c7b){zipdir(_0x5124b2,{'saveTo':_0x3c2fb6},function(_0x2df561,_0x3dae61){if(_0x2df561)return _0x309c7b(_0x2df561);return _0x9d6042(_0x3dae61);});})[_0x8b68('0x2b')](function(){return new BPromise(function(_0x5b85a6,_0x2489fa){rimraf(_0x5124b2,function(_0x564e76){if(_0x564e76)_0x2489fa(_0x564e76);return _0x5b85a6();});});})[_0x8b68('0x2b')](function(){return _0x420ed6[_0x8b68('0xe7')](_0x3c2fb6,_0x5df8a1,function(_0x55f08d){if(_0x55f08d){console[_0x8b68('0xe8')](_0x8b68('0xe9'),_0x55f08d);}else{fs[_0x8b68('0xea')](_0x3c2fb6);}});});});}else{return _0x420ed6['sendStatus'](0xc8);}})[_0x8b68('0x35')](handleError(_0x420ed6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 3aaf100..e610b01 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 _0x4006=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','update','then','setDataValue','Users'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x4006,0x1c7));var _0x6400=function(_0x59a075,_0x10b566){_0x59a075=_0x59a075-0x0;var _0xdc68cd=_0x4006[_0x59a075];return _0xdc68cd;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x6400('0x0'))['db'][_0x6400('0x1')];var SmsMessage=require(_0x6400('0x0'))['db'][_0x6400('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6400('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd858df){return function(_0x59fba5,_0x4a0d3f,_0x2dbd03){_0x59fba5['getUsers']({'attributes':['id'],'raw':!![]})[_0x6400('0x4')](function(_0x2d365b){_0x59fba5[_0x6400('0x5')](_0x6400('0x6'),_0x2d365b['map'](function(_0x31cc99){return{'id':_0x31cc99['id']};}));return SmsMessage[_0x6400('0x7')]({'where':{'SmsInteractionId':_0x59fba5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6400('0x4')](function(_0x356982){_0x59fba5[_0x6400('0x5')](_0x6400('0x8'),_0x356982[_0x6400('0x9')]);SmsInteractionEvents[_0x6400('0xa')](_0xd858df+':'+_0x59fba5['id'],_0x59fba5);SmsInteractionEvents[_0x6400('0xa')](_0xd858df,_0x59fba5);_0x2dbd03(null);})[_0x6400('0xb')](_0x2dbd03(null));};}for(var e in events){if(events[_0x6400('0xc')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x6400('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0xed95=['length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xed95,0xb9));var _0x5ed9=function(_0xed0084,_0x1837a3){_0xed0084=_0xed0084-0x0;var _0x2461cc=_0xed95[_0xed0084];return _0x2461cc;};'use strict';var EventEmitter=require(_0x5ed9('0x0'));var SmsInteraction=require(_0x5ed9('0x1'))['db'][_0x5ed9('0x2')];var SmsMessage=require(_0x5ed9('0x1'))['db'][_0x5ed9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5ed9('0x4')](0x0);var events={'afterCreate':_0x5ed9('0x5'),'afterUpdate':_0x5ed9('0x6'),'afterDestroy':_0x5ed9('0x7')};function emitEvent(_0x7b84d6){return function(_0x206a5e,_0x15b734,_0x52a57d){_0x206a5e['getUsers']({'attributes':['id'],'raw':!![]})[_0x5ed9('0x8')](function(_0x217c71){_0x206a5e[_0x5ed9('0x9')](_0x5ed9('0xa'),_0x217c71[_0x5ed9('0xb')](function(_0x40e8eb){return{'id':_0x40e8eb['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x206a5e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3cbaf0){_0x206a5e[_0x5ed9('0x9')](_0x5ed9('0xc'),_0x3cbaf0[_0x5ed9('0xd')]);SmsInteractionEvents['emit'](_0x7b84d6+':'+_0x206a5e['id'],_0x206a5e);SmsInteractionEvents['emit'](_0x7b84d6,_0x206a5e);_0x52a57d(null);})[_0x5ed9('0xe')](_0x52a57d(null));};}for(var e in events){if(events[_0x5ed9('0xf')](e)){var event=events[e];SmsInteraction[_0x5ed9('0x10')](e,emitEvent(event));}}module[_0x5ed9('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index e2d9c4a..0f68fec 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 _0x1f4f=['path','exports','SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird'];(function(_0x573d04,_0x476145){var _0x3fdf14=function(_0x22bba3){while(--_0x22bba3){_0x573d04['push'](_0x573d04['shift']());}};_0x3fdf14(++_0x476145);}(_0x1f4f,0x1a8));var _0xf1f4=function(_0x58b62a,_0x1205a6){_0x58b62a=_0x58b62a-0x0;var _0x5c86be=_0x1f4f[_0x58b62a];return _0x5c86be;};'use strict';var _=require(_0xf1f4('0x0'));var util=require(_0xf1f4('0x1'));var logger=require(_0xf1f4('0x2'))('api');var moment=require(_0xf1f4('0x3'));var BPromise=require(_0xf1f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1f4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xf1f4('0x6')]=function(_0xbc11df,_0x526d25){return _0xbc11df['define'](_0xf1f4('0x7'),attributes,{'tableName':_0xf1f4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52c79a,_0x268637,_0x5c976d){if(_0x52c79a[_0xf1f4('0x9')]('closed')){_0x52c79a[_0xf1f4('0xa')]=moment()[_0xf1f4('0xb')](_0xf1f4('0xc'));}_0x5c976d(null,_0x52c79a);}}});}; \ No newline at end of file +var _0x744a=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','api','moment','request-promise','path','rimraf'];(function(_0x1648f8,_0x51870b){var _0x1185df=function(_0x373b83){while(--_0x373b83){_0x1648f8['push'](_0x1648f8['shift']());}};_0x1185df(++_0x51870b);}(_0x744a,0xf9));var _0xa744=function(_0x30e92b,_0x5d65be){_0x30e92b=_0x30e92b-0x0;var _0x4b8961=_0x744a[_0x30e92b];return _0x4b8961;};'use strict';var _=require(_0xa744('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa744('0x1'));var moment=require(_0xa744('0x2'));var BPromise=require('bluebird');var rp=require(_0xa744('0x3'));var fs=require('fs');var path=require(_0xa744('0x4'));var rimraf=require(_0xa744('0x5'));var config=require('../../config/environment');var attributes=require(_0xa744('0x6'));module[_0xa744('0x7')]=function(_0x21e4f1,_0x5094cb){return _0x21e4f1[_0xa744('0x8')](_0xa744('0x9'),attributes,{'tableName':_0xa744('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3aadbd,_0x30a2d3,_0x398837){if(_0x3aadbd[_0xa744('0xb')](_0xa744('0xc'))){_0x3aadbd[_0xa744('0xd')]=moment()[_0xa744('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x398837(null,_0x3aadbd);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 4b8b534..87dd702 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 _0x62e4=['./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','options','raw','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x53c0d0,_0x5cadac){var _0x249c79=function(_0x4e5d1e){while(--_0x4e5d1e){_0x53c0d0['push'](_0x53c0d0['shift']());}};_0x249c79(++_0x5cadac);}(_0x62e4,0x7a));var _0x462e=function(_0x122c7f,_0x4ce495){_0x122c7f=_0x122c7f-0x0;var _0x3598ec=_0x62e4[_0x122c7f];return _0x3598ec;};'use strict';var _=require(_0x462e('0x0'));var util=require(_0x462e('0x1'));var moment=require('moment');var BPromise=require(_0x462e('0x2'));var rs=require(_0x462e('0x3'));var fs=require('fs');var Redis=require(_0x462e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x462e('0x5'));var logger=require(_0x462e('0x6'))(_0x462e('0x7'));var config=require(_0x462e('0x8'));var jayson=require(_0x462e('0x9'));var client=jayson[_0x462e('0xa')][_0x462e('0xb')]({'port':0x232a});config[_0x462e('0xc')]=_[_0x462e('0xd')](config[_0x462e('0xc')],{'host':_0x462e('0xe'),'port':0x18eb});var socket=require(_0x462e('0xf'))(new Redis(config[_0x462e('0xc')]));require(_0x462e('0x10'))[_0x462e('0x11')](socket);function respondWithRpcPromise(_0x6fdab8,_0x2ad6b6,_0x77edbd){return new BPromise(function(_0x1f9614,_0x2ae427){return client[_0x462e('0x12')](_0x6fdab8,_0x77edbd)[_0x462e('0x13')](function(_0x599407){logger[_0x462e('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2ad6b6,_0x462e('0x15'));logger[_0x462e('0x16')](_0x462e('0x17'),_0x2ad6b6,_0x462e('0x15'),JSON[_0x462e('0x18')](_0x599407));if(_0x599407[_0x462e('0x19')]){if(_0x599407['error'][_0x462e('0x1a')]===0x1f4){logger[_0x462e('0x19')](_0x462e('0x1b'),_0x2ad6b6,_0x599407[_0x462e('0x19')][_0x462e('0x1c')]);return _0x2ae427(_0x599407[_0x462e('0x19')][_0x462e('0x1c')]);}logger['error'](_0x462e('0x1b'),_0x2ad6b6,_0x599407['error'][_0x462e('0x1c')]);return _0x1f9614(_0x599407[_0x462e('0x19')][_0x462e('0x1c')]);}else{logger[_0x462e('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2ad6b6,_0x462e('0x15'));_0x1f9614(_0x599407[_0x462e('0x1d')]['message']);}})[_0x462e('0x1e')](function(_0x3d106c){logger['error'](_0x462e('0x1b'),_0x2ad6b6,_0x3d106c);_0x2ae427(_0x3d106c);});});}exports['UpdateSmsInteraction']=function(_0x36bc59){var _0x181a91=this;return new Promise(function(_0x441256,_0x45bf38){return db[_0x462e('0x1f')][_0x462e('0x20')](_0x36bc59['body'],{'raw':_0x36bc59[_0x462e('0x21')]?_0x36bc59[_0x462e('0x21')][_0x462e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36bc59[_0x462e('0x21')]?_0x36bc59[_0x462e('0x21')][_0x462e('0x23')]||null:null,'attributes':_0x36bc59[_0x462e('0x21')]?_0x36bc59['options']['attributes']||null:null,'limit':_0x36bc59[_0x462e('0x21')]?_0x36bc59[_0x462e('0x21')][_0x462e('0x24')]||null:null})['then'](function(_0x2fb649){logger[_0x462e('0x14')](_0x462e('0x25'),_0x36bc59);logger[_0x462e('0x16')](_0x462e('0x25'),_0x36bc59,JSON['stringify'](_0x2fb649));_0x441256(_0x2fb649);})[_0x462e('0x1e')](function(_0x5d17ca){logger['error'](_0x462e('0x25'),_0x5d17ca[_0x462e('0x1c')],_0x36bc59);_0x45bf38(_0x181a91[_0x462e('0x19')](0x1f4,_0x5d17ca[_0x462e('0x1c')]));});});};exports[_0x462e('0x26')]=function(_0x26e3b5){return new Promise(function(_0x3c12b4,_0x3a3c1b){return db[_0x462e('0x1f')][_0x462e('0x27')]({'where':_0x26e3b5[_0x462e('0x21')]?_0x26e3b5[_0x462e('0x21')]['where']||null:null})[_0x462e('0x13')](function(_0x15f164){if(_0x15f164){return _0x15f164[_0x462e('0x28')](_0x26e3b5[_0x462e('0x29')][_0x462e('0x2a')],_[_0x462e('0x2b')](_0x26e3b5[_0x462e('0x29')],['ids','id'])||{});}})[_0x462e('0x2c')](function(_0x202462){logger[_0x462e('0x14')](_0x462e('0x2d'),_0x26e3b5);logger[_0x462e('0x16')](_0x462e('0x2d'),_0x26e3b5,JSON['stringify'](_0x202462));_0x3c12b4(_0x202462);})[_0x462e('0x1e')](function(_0x40b954){logger[_0x462e('0x19')](_0x462e('0x2d'),_0x40b954[_0x462e('0x1c')],_0x26e3b5);_0x3a3c1b(_this[_0x462e('0x19')](0x1f4,_0x40b954[_0x462e('0x1c')]));});});}; \ No newline at end of file +var _0x1f6a=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','body','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1fbb37,_0x5840b8){var _0x591a30=function(_0x2a6573){while(--_0x2a6573){_0x1fbb37['push'](_0x1fbb37['shift']());}};_0x591a30(++_0x5840b8);}(_0x1f6a,0x184));var _0xa1f6=function(_0x311df2,_0x5b6291){_0x311df2=_0x311df2-0x0;var _0x2d70d7=_0x1f6a[_0x311df2];return _0x2d70d7;};'use strict';var _=require(_0xa1f6('0x0'));var util=require(_0xa1f6('0x1'));var moment=require(_0xa1f6('0x2'));var BPromise=require(_0xa1f6('0x3'));var rs=require(_0xa1f6('0x4'));var fs=require('fs');var Redis=require(_0xa1f6('0x5'));var db=require(_0xa1f6('0x6'))['db'];var utils=require(_0xa1f6('0x7'));var logger=require(_0xa1f6('0x8'))(_0xa1f6('0x9'));var config=require('../../config/environment');var jayson=require(_0xa1f6('0xa'));var client=jayson[_0xa1f6('0xb')][_0xa1f6('0xc')]({'port':0x232a});config[_0xa1f6('0xd')]=_[_0xa1f6('0xe')](config[_0xa1f6('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1f6('0xf'))(new Redis(config[_0xa1f6('0xd')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2f528d,_0x1631eb,_0x30560e){return new BPromise(function(_0x108e25,_0x271569){return client[_0xa1f6('0x10')](_0x2f528d,_0x30560e)[_0xa1f6('0x11')](function(_0x55b1c5){logger[_0xa1f6('0x12')](_0xa1f6('0x13'),_0x1631eb,_0xa1f6('0x14'));logger[_0xa1f6('0x15')](_0xa1f6('0x16'),_0x1631eb,_0xa1f6('0x14'),JSON[_0xa1f6('0x17')](_0x55b1c5));if(_0x55b1c5[_0xa1f6('0x18')]){if(_0x55b1c5[_0xa1f6('0x18')][_0xa1f6('0x19')]===0x1f4){logger[_0xa1f6('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x1631eb,_0x55b1c5[_0xa1f6('0x18')][_0xa1f6('0x1a')]);return _0x271569(_0x55b1c5['error']['message']);}logger[_0xa1f6('0x18')](_0xa1f6('0x13'),_0x1631eb,_0x55b1c5[_0xa1f6('0x18')][_0xa1f6('0x1a')]);return _0x108e25(_0x55b1c5[_0xa1f6('0x18')][_0xa1f6('0x1a')]);}else{logger[_0xa1f6('0x12')](_0xa1f6('0x13'),_0x1631eb,'request\x20sent');_0x108e25(_0x55b1c5[_0xa1f6('0x1b')]['message']);}})[_0xa1f6('0x1c')](function(_0x2e6e8d){logger['error'](_0xa1f6('0x13'),_0x1631eb,_0x2e6e8d);_0x271569(_0x2e6e8d);});});}exports[_0xa1f6('0x1d')]=function(_0x26277c){var _0x1dca47=this;return new Promise(function(_0x1d157a,_0x3fb38f){return db[_0xa1f6('0x1e')][_0xa1f6('0x1f')](_0x26277c['body'],{'raw':_0x26277c[_0xa1f6('0x20')]?_0x26277c[_0xa1f6('0x20')][_0xa1f6('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26277c['options']?_0x26277c[_0xa1f6('0x20')][_0xa1f6('0x22')]||null:null,'attributes':_0x26277c[_0xa1f6('0x20')]?_0x26277c[_0xa1f6('0x20')][_0xa1f6('0x23')]||null:null,'limit':_0x26277c[_0xa1f6('0x20')]?_0x26277c[_0xa1f6('0x20')][_0xa1f6('0x24')]||null:null})[_0xa1f6('0x11')](function(_0x2ab65){logger[_0xa1f6('0x12')](_0xa1f6('0x1d'),_0x26277c);logger['debug'](_0xa1f6('0x1d'),_0x26277c,JSON[_0xa1f6('0x17')](_0x2ab65));_0x1d157a(_0x2ab65);})[_0xa1f6('0x1c')](function(_0x46cf52){logger[_0xa1f6('0x18')]('UpdateSmsInteraction',_0x46cf52[_0xa1f6('0x1a')],_0x26277c);_0x3fb38f(_0x1dca47['error'](0x1f4,_0x46cf52[_0xa1f6('0x1a')]));});});};exports[_0xa1f6('0x25')]=function(_0x596dbb){return new Promise(function(_0x274896,_0x3857f3){return db[_0xa1f6('0x1e')][_0xa1f6('0x26')]({'where':_0x596dbb[_0xa1f6('0x20')]?_0x596dbb[_0xa1f6('0x20')][_0xa1f6('0x22')]||null:null})[_0xa1f6('0x11')](function(_0x196470){if(_0x196470){return _0x196470[_0xa1f6('0x27')](_0x596dbb[_0xa1f6('0x28')]['ids'],_[_0xa1f6('0x29')](_0x596dbb[_0xa1f6('0x28')],['ids','id'])||{});}})[_0xa1f6('0x2a')](function(_0x399852){logger['info']('AddTags',_0x596dbb);logger[_0xa1f6('0x15')]('AddTags',_0x596dbb,JSON['stringify'](_0x399852));_0x274896(_0x399852);})[_0xa1f6('0x1c')](function(_0xe214bf){logger[_0xa1f6('0x18')](_0xa1f6('0x2b'),_0xe214bf[_0xa1f6('0x1a')],_0x596dbb);_0x3857f3(_this[_0xa1f6('0x18')](0x1f4,_0xe214bf['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index bcb08e2..1ed6db1 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 _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0x51b3b8,_0x56b752){var _0x22f32f=function(_0x1bde37){while(--_0x1bde37){_0x51b3b8['push'](_0x51b3b8['shift']());}};_0x22f32f(++_0x56b752);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xb10b,0x12a));var _0xbb10=function(_0x559233,_0x4f4408){_0x559233=_0x559233-0x0;var _0x1a9acb=_0xb10b[_0x559233];return _0x1a9acb;};'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 ebe5384..b68b7f3 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 _0xb656=['create','/:id/status','status','put','update','/:id/accept','/:id/reject','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','sms','smsmessage:create'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb656,0x190));var _0x6b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb656[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6b65('0x0'));var path=require('path');var timeout=require(_0x6b65('0x1'));var express=require('express');var router=express[_0x6b65('0x2')]();var auth=require(_0x6b65('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6b65('0x4'));var controller=require(_0x6b65('0x5'));router[_0x6b65('0x6')]('/',auth[_0x6b65('0x7')](),controller[_0x6b65('0x8')]);router['get']('/describe',auth[_0x6b65('0x7')](),controller[_0x6b65('0x9')]);router[_0x6b65('0x6')](_0x6b65('0xa'),auth['isAuthenticated'](),controller[_0x6b65('0xb')]);router[_0x6b65('0xc')]('/',auth[_0x6b65('0x7')](),interaction[_0x6b65('0xd')](_0x6b65('0xe'),_0x6b65('0xf')),controller[_0x6b65('0x10')]);router[_0x6b65('0xc')](_0x6b65('0x11'),controller[_0x6b65('0x12')]);router[_0x6b65('0x13')]('/:id',auth[_0x6b65('0x7')](),controller[_0x6b65('0x14')]);router['put'](_0x6b65('0x15'),auth[_0x6b65('0x7')](),controller['accept']);router[_0x6b65('0x13')](_0x6b65('0x16'),auth[_0x6b65('0x7')](),controller['reject']);router[_0x6b65('0x17')]('/:id',auth[_0x6b65('0x7')](),controller[_0x6b65('0x18')]);module[_0x6b65('0x19')]=router; \ No newline at end of file +var _0xcec8=['put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','express','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','sms','smsmessage:create','create','/:id/status'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0xcec8,0xda));var _0x8cec=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0xcec8[_0x2d6197];return _0x4d0e75;};'use strict';var multer=require(_0x8cec('0x0'));var util=require(_0x8cec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8cec('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8cec('0x3'));var config=require('../../config/environment');var controller=require(_0x8cec('0x4'));router[_0x8cec('0x5')]('/',auth[_0x8cec('0x6')](),controller[_0x8cec('0x7')]);router[_0x8cec('0x5')](_0x8cec('0x8'),auth[_0x8cec('0x6')](),controller['describe']);router[_0x8cec('0x5')]('/:id',auth[_0x8cec('0x6')](),controller[_0x8cec('0x9')]);router[_0x8cec('0xa')]('/',auth[_0x8cec('0x6')](),interaction[_0x8cec('0xb')](_0x8cec('0xc'),_0x8cec('0xd')),controller[_0x8cec('0xe')]);router[_0x8cec('0xa')](_0x8cec('0xf'),controller['status']);router[_0x8cec('0x10')](_0x8cec('0x11'),auth[_0x8cec('0x6')](),controller[_0x8cec('0x12')]);router[_0x8cec('0x10')](_0x8cec('0x13'),auth['isAuthenticated'](),controller[_0x8cec('0x14')]);router[_0x8cec('0x10')](_0x8cec('0x15'),auth['isAuthenticated'](),controller[_0x8cec('0x16')]);router[_0x8cec('0x17')]('/:id',auth[_0x8cec('0x6')](),controller[_0x8cec('0x18')]);module[_0x8cec('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index ec528fd..f882131 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 _0xa937=['out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0xa01dc9,_0x4203df){var _0x54d089=function(_0x34d716){while(--_0x34d716){_0xa01dc9['push'](_0xa01dc9['shift']());}};_0x54d089(++_0x4203df);}(_0xa937,0x163));var _0x7a93=function(_0x306d86,_0xa5e212){_0x306d86=_0x306d86-0x0;var _0x14666e=_0xa937[_0x306d86];return _0x14666e;};'use strict';var Sequelize=require(_0x7a93('0x0'));module['exports']={'body':{'type':Sequelize[_0x7a93('0x1')](_0x7a93('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7a93('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7a93('0x4')]('in','out'),'defaultValue':_0x7a93('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7a93('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7a93('0x6')]},'readAt':{'type':Sequelize[_0x7a93('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9fee=['ENUM','out','STRING','DATE','BOOLEAN','exports','TEXT','medium'];(function(_0x14ac07,_0x4973f6){var _0x19e6af=function(_0xe6e1fe){while(--_0xe6e1fe){_0x14ac07['push'](_0x14ac07['shift']());}};_0x19e6af(++_0x4973f6);}(_0x9fee,0xc5));var _0xe9fe=function(_0x57f8f0,_0x20d876){_0x57f8f0=_0x57f8f0-0x0;var _0x5e41b9=_0x9fee[_0x57f8f0];return _0x5e41b9;};'use strict';var Sequelize=require('sequelize');module[_0xe9fe('0x0')]={'body':{'type':Sequelize[_0xe9fe('0x1')](_0xe9fe('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe9fe('0x3')]('in',_0xe9fe('0x4')),'defaultValue':_0xe9fe('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe9fe('0x5')]},'readAt':{'type':Sequelize[_0xe9fe('0x6')]},'secret':{'type':Sequelize[_0xe9fe('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index b248524..f1133e6 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 _0x0f88=['read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','interface','channel','EventManager','acceptmessage','sms-interactions','reject','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','event','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./smsMessage.socket','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','options','find','create','body','describe','accept','sms','read','UserId','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0x0f88,0x1d9));var _0x80f8=function(_0x3a376f,_0x4694fb){_0x3a376f=_0x3a376f-0x0;var _0x2cc9ae=_0x0f88[_0x3a376f];return _0x2cc9ae;};'use strict';var pdf=require(_0x80f8('0x0'));var emlformat=require(_0x80f8('0x1'));var rimraf=require(_0x80f8('0x2'));var zipdir=require(_0x80f8('0x3'));var jsonpatch=require(_0x80f8('0x4'));var rp=require(_0x80f8('0x5'));var moment=require(_0x80f8('0x6'));var BPromise=require(_0x80f8('0x7'));var Mustache=require('mustache');var util=require(_0x80f8('0x8'));var path=require('path');var sox=require(_0x80f8('0x9'));var csv=require(_0x80f8('0xa'));var ejs=require(_0x80f8('0xb'));var fs=require('fs');var _=require(_0x80f8('0xc'));var squel=require(_0x80f8('0xd'));var crypto=require(_0x80f8('0xe'));var jsforce=require(_0x80f8('0xf'));var deskjs=require(_0x80f8('0x10'));var toCsv=require(_0x80f8('0xa'));var querystring=require(_0x80f8('0x11'));var Papa=require(_0x80f8('0x12'));var Redis=require(_0x80f8('0x13'));var authService=require(_0x80f8('0x14'));var qs=require(_0x80f8('0x15'));var as=require(_0x80f8('0x16'));var hardwareService=require(_0x80f8('0x17'));var logger=require(_0x80f8('0x18'))(_0x80f8('0x19'));var utils=require(_0x80f8('0x1a'));var config=require(_0x80f8('0x1b'));var db=require('../../mysqldb')['db'];config[_0x80f8('0x1c')]=_[_0x80f8('0x1d')](config[_0x80f8('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x80f8('0x1e'))(new Redis(config[_0x80f8('0x1c')]));require(_0x80f8('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x80f8('0x20')]['http']({'port':0x232a});function checkPasswordPattern(_0x2c9b94,_0x25c36b,_0x381355){if(_0x381355){var _0x3817be=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3817be[_0x80f8('0x21')](_0x25c36b)){return _0x2c9b94;}else{throw new db[(_0x80f8('0x22'))][(_0x80f8('0x23'))](_0x80f8('0x24'));}}else{return _0x2c9b94;}}function respondWithRpcPromise(_0x375f42,_0xeff401,_0x581196,_0x450b77){return new BPromise(function(_0x981e13,_0x1fe500){var _0x1e2ae6=_0x450b77||client;return _0x1e2ae6[_0x80f8('0x25')](_0x375f42,_0x581196)['then'](function(_0x1c8bb7){logger[_0x80f8('0x26')]('SmsMessage,\x20%s,\x20%s',_0xeff401,_0x80f8('0x27'));logger[_0x80f8('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeff401,_0x80f8('0x27'),JSON[_0x80f8('0x29')](_0x1c8bb7));if(_0x1c8bb7[_0x80f8('0x2a')]){if(_0x1c8bb7[_0x80f8('0x2a')][_0x80f8('0x2b')]===0x1f4){logger[_0x80f8('0x2a')](_0x80f8('0x2c'),_0xeff401,_0x1c8bb7[_0x80f8('0x2a')]['message']);return _0x1fe500(_0x1c8bb7[_0x80f8('0x2a')]['message']);}logger[_0x80f8('0x2a')]('SmsMessage,\x20%s,\x20%s',_0xeff401,_0x1c8bb7[_0x80f8('0x2a')]['message']);return _0x981e13(_0x1c8bb7[_0x80f8('0x2a')][_0x80f8('0x2d')]);}else{logger[_0x80f8('0x26')]('SmsMessage,\x20%s,\x20%s',_0xeff401,'request\x20sent');_0x981e13(_0x1c8bb7[_0x80f8('0x2e')][_0x80f8('0x2d')]);}})['catch'](function(_0x40ed3e){logger['error'](_0x80f8('0x2c'),_0xeff401,_0x40ed3e);_0x1fe500(_0x40ed3e);});});}function respondWithStatusCode(_0x4fc1f6,_0x25bf6e){_0x25bf6e=_0x25bf6e||0xcc;return function(_0x5f3f44){if(_0x5f3f44){return _0x4fc1f6[_0x80f8('0x2f')](_0x25bf6e);}return _0x4fc1f6[_0x80f8('0x30')](_0x25bf6e)[_0x80f8('0x31')]();};}function respondWithResult(_0x46d379,_0x42e871){_0x42e871=_0x42e871||0xc8;return function(_0x14fcce){if(_0x14fcce){return _0x46d379[_0x80f8('0x30')](_0x42e871)[_0x80f8('0x32')](_0x14fcce);}};}function respondWithFilteredResult(_0xb37fff,_0x13cb3a){return function(_0x5ca948){if(_0x5ca948){var _0x545f3c=_0x5ca948[_0x80f8('0x33')],_0x2955f9=_0x13cb3a['offset'],_0xe2e619=_0x13cb3a[_0x80f8('0x34')]+_0x13cb3a[_0x80f8('0x35')],_0x266be7;if(_0xe2e619>=_0x545f3c){_0xe2e619=_0x545f3c;_0x266be7=0xc8;}else{_0x266be7=0xce;}_0xb37fff['status'](_0x266be7);return _0xb37fff[_0x80f8('0x36')]('Content-Range',_0x2955f9+'-'+_0xe2e619+'/'+_0x545f3c)[_0x80f8('0x32')](_0x5ca948);}return null;};}function patchUpdates(_0x5d7644){return function(_0x387a28){try{jsonpatch[_0x80f8('0x37')](_0x387a28,_0x5d7644,!![]);}catch(_0x48984c){return BPromise['reject'](_0x48984c);}return _0x387a28[_0x80f8('0x38')]();};}function saveUpdates(_0x26ac72,_0x2898cc){return function(_0x42e93a){if(_0x42e93a){return _0x42e93a[_0x80f8('0x39')](_0x26ac72)[_0x80f8('0x3a')](function(_0x449d26){return _0x449d26;});}return null;};}function removeEntity(_0x515f45,_0x2c0c74){return function(_0x234f8d){if(_0x234f8d){return _0x234f8d[_0x80f8('0x3b')]()[_0x80f8('0x3a')](function(){_0x515f45['status'](0xcc)[_0x80f8('0x31')]();});}};}function handleEntityNotFound(_0x935fc7,_0x2ded8e){return function(_0x21eb28){if(!_0x21eb28){_0x935fc7['sendStatus'](0x194);}return _0x21eb28;};}function handleError(_0x132868,_0x4a4cec){_0x4a4cec=_0x4a4cec||0x1f4;return function(_0x496ce3){logger[_0x80f8('0x2a')](_0x496ce3[_0x80f8('0x3c')]);if(_0x496ce3[_0x80f8('0x3d')]){delete _0x496ce3[_0x80f8('0x3d')];}_0x132868['status'](_0x4a4cec)[_0x80f8('0x3e')](_0x496ce3);};}exports[_0x80f8('0x3f')]=function(_0x15773d,_0xce3c19){var _0x43c7b7={},_0x1d932d={},_0x2e1692={'count':0x0,'rows':[]};var _0x1f9e3e=_[_0x80f8('0x40')](db[_0x80f8('0x41')][_0x80f8('0x42')],function(_0x592de){return{'name':_0x592de[_0x80f8('0x43')],'type':_0x592de[_0x80f8('0x44')][_0x80f8('0x45')]};});_0x1d932d[_0x80f8('0x46')]=_[_0x80f8('0x40')](_0x1f9e3e,_0x80f8('0x3d'));_0x1d932d[_0x80f8('0x47')]=_['keys'](_0x15773d[_0x80f8('0x47')]);_0x1d932d[_0x80f8('0x48')]=_[_0x80f8('0x49')](_0x1d932d['model'],_0x1d932d['query']);_0x43c7b7['attributes']=_['intersection'](_0x1d932d[_0x80f8('0x46')],qs[_0x80f8('0x4a')](_0x15773d[_0x80f8('0x47')][_0x80f8('0x4a')]));_0x43c7b7[_0x80f8('0x4b')]=_0x43c7b7[_0x80f8('0x4b')]['length']?_0x43c7b7['attributes']:_0x1d932d[_0x80f8('0x46')];if(!_0x15773d[_0x80f8('0x47')][_0x80f8('0x4c')](_0x80f8('0x4d'))){_0x43c7b7[_0x80f8('0x35')]=qs['limit'](_0x15773d[_0x80f8('0x47')][_0x80f8('0x35')]);_0x43c7b7[_0x80f8('0x34')]=qs[_0x80f8('0x34')](_0x15773d[_0x80f8('0x47')][_0x80f8('0x34')]);}_0x43c7b7[_0x80f8('0x4e')]=qs[_0x80f8('0x4f')](_0x15773d[_0x80f8('0x47')][_0x80f8('0x4f')]);_0x43c7b7[_0x80f8('0x50')]=qs[_0x80f8('0x48')](_[_0x80f8('0x51')](_0x15773d[_0x80f8('0x47')],_0x1d932d[_0x80f8('0x48')]),_0x1f9e3e);if(_0x15773d[_0x80f8('0x47')][_0x80f8('0x52')]){_0x43c7b7['where']=_[_0x80f8('0x53')](_0x43c7b7[_0x80f8('0x50')],{'$or':_['map'](_0x1f9e3e,function(_0x52b016){if(_0x52b016[_0x80f8('0x44')]!==_0x80f8('0x54')){var _0x22f506={};_0x22f506[_0x52b016[_0x80f8('0x3d')]]={'$like':'%'+_0x15773d['query'][_0x80f8('0x52')]+'%'};return _0x22f506;}})});}_0x43c7b7=_[_0x80f8('0x53')]({},_0x43c7b7,_0x15773d['options']);var _0x8f4e26={'where':_0x43c7b7[_0x80f8('0x50')]};return db['SmsMessage'][_0x80f8('0x33')](_0x8f4e26)[_0x80f8('0x3a')](function(_0x4aa81e){_0x2e1692[_0x80f8('0x33')]=_0x4aa81e;if(_0x15773d['query'][_0x80f8('0x55')]){_0x43c7b7['include']=[{'all':!![]}];}return db[_0x80f8('0x41')][_0x80f8('0x56')](_0x43c7b7);})[_0x80f8('0x3a')](function(_0x1bfd5a){_0x2e1692[_0x80f8('0x57')]=_0x1bfd5a;return _0x2e1692;})[_0x80f8('0x3a')](respondWithFilteredResult(_0xce3c19,_0x43c7b7))[_0x80f8('0x58')](handleError(_0xce3c19,null));};exports[_0x80f8('0x59')]=function(_0x50e19c,_0x3dc2f2){var _0x5d783a={'raw':!![],'where':{'id':_0x50e19c[_0x80f8('0x5a')]['id']}},_0x21ff26={};_0x21ff26[_0x80f8('0x46')]=_[_0x80f8('0x5b')](db[_0x80f8('0x41')][_0x80f8('0x42')]);_0x21ff26[_0x80f8('0x47')]=_[_0x80f8('0x5b')](_0x50e19c[_0x80f8('0x47')]);_0x21ff26[_0x80f8('0x48')]=_[_0x80f8('0x49')](_0x21ff26[_0x80f8('0x46')],_0x21ff26[_0x80f8('0x47')]);_0x5d783a[_0x80f8('0x4b')]=_[_0x80f8('0x49')](_0x21ff26[_0x80f8('0x46')],qs[_0x80f8('0x4a')](_0x50e19c[_0x80f8('0x47')][_0x80f8('0x4a')]));_0x5d783a['attributes']=_0x5d783a[_0x80f8('0x4b')]['length']?_0x5d783a[_0x80f8('0x4b')]:_0x21ff26[_0x80f8('0x46')];if(_0x50e19c[_0x80f8('0x47')]['includeAll']){_0x5d783a['include']=[{'all':!![]}];}_0x5d783a=_['merge']({},_0x5d783a,_0x50e19c[_0x80f8('0x5c')]);return db[_0x80f8('0x41')][_0x80f8('0x5d')](_0x5d783a)[_0x80f8('0x3a')](handleEntityNotFound(_0x3dc2f2,null))[_0x80f8('0x3a')](respondWithResult(_0x3dc2f2,null))[_0x80f8('0x58')](handleError(_0x3dc2f2,null));};exports[_0x80f8('0x5e')]=function(_0x4e23c7,_0x3a85c2){return db[_0x80f8('0x41')][_0x80f8('0x5e')](_0x4e23c7[_0x80f8('0x5f')],{})['then'](respondWithResult(_0x3a85c2,0xc9))[_0x80f8('0x58')](handleError(_0x3a85c2,null));};exports['update']=function(_0x3e6523,_0x350ac4){if(_0x3e6523['body']['id']){delete _0x3e6523[_0x80f8('0x5f')]['id'];}return db[_0x80f8('0x41')][_0x80f8('0x5d')]({'where':{'id':_0x3e6523['params']['id']}})[_0x80f8('0x3a')](handleEntityNotFound(_0x350ac4,null))['then'](saveUpdates(_0x3e6523[_0x80f8('0x5f')],null))[_0x80f8('0x3a')](respondWithResult(_0x350ac4,null))['catch'](handleError(_0x350ac4,null));};exports[_0x80f8('0x3b')]=function(_0x41e210,_0x2f95bf){return db[_0x80f8('0x41')]['find']({'where':{'id':_0x41e210[_0x80f8('0x5a')]['id']}})[_0x80f8('0x3a')](handleEntityNotFound(_0x2f95bf,null))[_0x80f8('0x3a')](removeEntity(_0x2f95bf,null))[_0x80f8('0x58')](handleError(_0x2f95bf,null));};exports[_0x80f8('0x60')]=function(_0x2e6264,_0x29a598){return db[_0x80f8('0x41')][_0x80f8('0x60')]()[_0x80f8('0x3a')](respondWithResult(_0x29a598,null))[_0x80f8('0x58')](handleError(_0x29a598,null));};var interaction_log=require(_0x80f8('0x18'))('sms-interactions');exports[_0x80f8('0x61')]=function(_0xfdf3ac,_0x29affa,_0x1bf5be){var _0x432e67={'channel':_0x80f8('0x62')};if(_0xfdf3ac[_0x80f8('0x5f')]['id']){delete _0xfdf3ac[_0x80f8('0x5f')]['id'];}_0xfdf3ac[_0x80f8('0x5f')][_0x80f8('0x63')]=!![];_0xfdf3ac[_0x80f8('0x5f')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xfdf3ac[_0x80f8('0x5f')][_0x80f8('0x64')]=_0xfdf3ac['body'][_0x80f8('0x64')]||_0xfdf3ac['user']['id'];return db[_0x80f8('0x41')][_0x80f8('0x5d')]({'where':{'id':_0xfdf3ac['params']['id'],'UserId':null},'include':[{'model':db[_0x80f8('0x65')],'as':_0x80f8('0x66')}]})[_0x80f8('0x3a')](handleEntityNotFound(_0x29affa,null))[_0x80f8('0x3a')](saveUpdates(_0xfdf3ac[_0x80f8('0x5f')],null))[_0x80f8('0x3a')](function(_0x34561d){if(_0x34561d){_0x432e67['message']=_0x34561d[_0x80f8('0x67')]({'plain':!![]});return db[_0x80f8('0x68')][_0x80f8('0x5d')]({'where':{'id':_0x34561d[_0x80f8('0x69')]}});}return null;})[_0x80f8('0x3a')](handleEntityNotFound(_0x29affa,null))[_0x80f8('0x3a')](function(_0x18e707){if(_0x18e707){return _0x18e707['update']({'UserId':_0xfdf3ac[_0x80f8('0x5f')][_0x80f8('0x64')],'read1stAt':_[_0x80f8('0x6a')](_0x18e707[_0x80f8('0x6b')])?moment()[_0x80f8('0x6c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x80f8('0x3a')](function(_0x385945){if(_0x385945){_0x432e67[_0x80f8('0x6d')]=_0x385945[_0x80f8('0x67')]({'plain':!![]});interaction_log[_0x80f8('0x26')](_0x80f8('0x6e'),_0xfdf3ac[_0x80f8('0x6f')]['id'],_0xfdf3ac[_0x80f8('0x6f')][_0x80f8('0x3d')],_0xfdf3ac['user'][_0x80f8('0x70')],_0x432e67[_0x80f8('0x6d')]['id'],_0xfdf3ac[_0x80f8('0x5f')]?JSON[_0x80f8('0x29')](_0xfdf3ac[_0x80f8('0x5f')]):_0x80f8('0x71'));return respondWithRpcPromise(_0x80f8('0x72'),_0x80f8('0x73'),_0x432e67);}return null;})['then'](function(_0x503798){if(_0x503798){if(_0xfdf3ac[_0x80f8('0x5f')]['manual']){_0x432e67[_0x80f8('0x2d')][_0x80f8('0x74')]=util[_0x80f8('0x6c')]('SIP/%s',_0xfdf3ac[_0x80f8('0x6f')][_0x80f8('0x3d')]);_0x432e67[_0x80f8('0x2d')]['channel']=_0x432e67[_0x80f8('0x75')];_0x432e67[_0x80f8('0x2d')]['event']='accept';return respondWithRpcPromise(_0x80f8('0x76'),_0x80f8('0x76'),{'event':_0x80f8('0x77'),'message':_0x432e67['message']},client9002)['then'](function(){return _0x432e67;});}return _0x432e67;}return null;})[_0x80f8('0x3a')](respondWithResult(_0x29affa,null))[_0x80f8('0x58')](handleError(_0x29affa,null));};var interaction_log=require(_0x80f8('0x18'))(_0x80f8('0x78'));exports[_0x80f8('0x79')]=function(_0x5b3463,_0x55334c,_0x59c667){var _0x44b670={'agent':{},'channel':'sms'};if(_0x5b3463[_0x80f8('0x5f')]['id']){delete _0x5b3463[_0x80f8('0x5f')]['id'];}_0x5b3463['body'][_0x80f8('0x64')]=_0x5b3463[_0x80f8('0x5f')][_0x80f8('0x64')]||_0x5b3463[_0x80f8('0x6f')]['id'];_0x44b670[_0x80f8('0x7a')]['id']=_0x5b3463[_0x80f8('0x5f')][_0x80f8('0x64')];return db[_0x80f8('0x41')][_0x80f8('0x5d')]({'where':{'id':_0x5b3463[_0x80f8('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x55334c,null))[_0x80f8('0x3a')](function(_0x1dc52a){if(_0x1dc52a){_0x44b670[_0x80f8('0x2d')]=_0x1dc52a[_0x80f8('0x67')]({'plain':!![]});return db[_0x80f8('0x68')][_0x80f8('0x5d')]({'where':{'id':_0x1dc52a[_0x80f8('0x69')]}});}return null;})[_0x80f8('0x3a')](handleEntityNotFound(_0x55334c,null))[_0x80f8('0x3a')](function(_0x4d26b1){if(_0x4d26b1){_0x44b670[_0x80f8('0x6d')]=_0x4d26b1[_0x80f8('0x67')]({'plain':!![]});interaction_log[_0x80f8('0x26')](_0x80f8('0x7b'),_0x5b3463[_0x80f8('0x6f')]['id'],_0x5b3463[_0x80f8('0x6f')][_0x80f8('0x3d')],_0x5b3463[_0x80f8('0x6f')][_0x80f8('0x70')],_0x44b670[_0x80f8('0x6d')]['id'],_0x5b3463[_0x80f8('0x5f')]?JSON[_0x80f8('0x29')](_0x5b3463['body']):_0x80f8('0x71'));return respondWithRpcPromise(_0x80f8('0x7c'),_0x80f8('0x7d'),_0x44b670);}return null;})[_0x80f8('0x3a')](function(_0x109b4e){if(_0x109b4e){_0x109b4e[_0x80f8('0x2d')]['interface']=util['format'](_0x80f8('0x7e'),_0x5b3463[_0x80f8('0x6f')][_0x80f8('0x3d')]);_0x109b4e[_0x80f8('0x2d')][_0x80f8('0x75')]=_0x44b670[_0x80f8('0x75')];_0x109b4e[_0x80f8('0x2d')][_0x80f8('0x7f')]=_0x80f8('0x79');respondWithRpcPromise(_0x80f8('0x76'),_0x80f8('0x76'),{'event':_0x80f8('0x80'),'message':_0x109b4e['message']},client9002);return _0x44b670;}return null;})[_0x80f8('0x3a')](respondWithResult(_0x55334c,null))[_0x80f8('0x58')](handleError(_0x55334c,null));};exports[_0x80f8('0x30')]=function(_0x1d4aea,_0x4de65f,_0x319e9b){if(_0x1d4aea[_0x80f8('0x5f')]['id']){delete _0x1d4aea[_0x80f8('0x5f')]['id'];}var _0x5d5d8c;return db[_0x80f8('0x41')][_0x80f8('0x5d')]({'where':{'id':_0x1d4aea[_0x80f8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4de65f,null))[_0x80f8('0x3a')](function(_0x57a4fd){if(_0x57a4fd){_0x5d5d8c=_0x57a4fd;return db[_0x80f8('0x81')][_0x80f8('0x5d')]({'where':{'id':_0x57a4fd[_0x80f8('0x82')]}});}})[_0x80f8('0x3a')](handleEntityNotFound(_0x4de65f,null))[_0x80f8('0x3a')](function(_0x3fa600){if(_0x3fa600){logger['debug'](_0x80f8('0x83'),_0x80f8('0x30'),_0x80f8('0x84'),_0x3fa600[_0x80f8('0x44')],util[_0x80f8('0x85')](_0x1d4aea[_0x80f8('0x5f')],{'showHidden':![],'depth':null}));switch(_0x3fa600[_0x80f8('0x44')]){case _0x80f8('0x86'):if(_0x1d4aea[_0x80f8('0x5f')][_0x80f8('0x87')]&&_0x1d4aea['body']['MessageSid']===_0x5d5d8c[_0x80f8('0x88')]){return _0x5d5d8c[_0x80f8('0x39')]({'read':!![]});}else{logger[_0x80f8('0x2a')](_0x80f8('0x89'),_0x80f8('0x30'),_0x80f8('0x86'),util[_0x80f8('0x85')](_0x1d4aea[_0x80f8('0x5f')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1d4aea[_0x80f8('0x5f')][_0x80f8('0x8a')]&&_0x1d4aea['body'][_0x80f8('0x8a')]===_0x5d5d8c[_0x80f8('0x88')]&&_[_0x80f8('0x8b')](['sent','delivered'],_0x1d4aea[_0x80f8('0x5f')]['Status'])>=0x0){return _0x5d5d8c[_0x80f8('0x39')]({'read':!![]});}else{logger[_0x80f8('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x80f8('0x30'),_0x80f8('0x8c'),util['inspect'](_0x1d4aea[_0x80f8('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x80f8('0x8d'):var _0x3a46fc=_0x1d4aea[_0x80f8('0x5f')][_0x80f8('0x8e')][0x0];if(_0x3a46fc[_0x80f8('0x30')][_0x80f8('0x8f')]===_0x80f8('0x90')){return _0x5d5d8c[_0x80f8('0x39')]({'read':!![]});}else{logger[_0x80f8('0x2a')](_0x80f8('0x89'),_0x80f8('0x30'),_0x80f8('0x8d'),util[_0x80f8('0x85')](_0x1d4aea['body'],{'showHidden':![],'depth':null}));}break;}return _0x5d5d8c;}})[_0x80f8('0x3a')](respondWithResult(_0x4de65f,null))[_0x80f8('0x58')](handleError(_0x4de65f,null));}; \ No newline at end of file +var _0x7b05=['groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsMessage.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','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','end','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SmsMessage','includeAll','findAll','rows','show','include','find','create','update','body','params','describe','sms-interactions','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','sms','agent','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results'];(function(_0x41cdea,_0x4563cf){var _0x12cbd2=function(_0x426316){while(--_0x426316){_0x41cdea['push'](_0x41cdea['shift']());}};_0x12cbd2(++_0x4563cf);}(_0x7b05,0x91));var _0x57b0=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x7b05[_0x13b392];return _0x39db24;};'use strict';var pdf=require(_0x57b0('0x0'));var emlformat=require(_0x57b0('0x1'));var rimraf=require(_0x57b0('0x2'));var zipdir=require(_0x57b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57b0('0x4'));var moment=require('moment');var BPromise=require(_0x57b0('0x5'));var Mustache=require(_0x57b0('0x6'));var util=require(_0x57b0('0x7'));var path=require(_0x57b0('0x8'));var sox=require(_0x57b0('0x9'));var csv=require('to-csv');var ejs=require(_0x57b0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var db=require(_0x57b0('0x14'))['db'];config['redis']=_[_0x57b0('0x15')](config[_0x57b0('0x16')],{'host':_0x57b0('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x57b0('0x18'))[_0x57b0('0x19')](socket);var jayson=require(_0x57b0('0x1a'));var client=jayson[_0x57b0('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x57b0('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x235d4a,_0xa20423,_0x55fd9c){if(_0x55fd9c){var _0x1ad3c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ad3c9[_0x57b0('0x1c')](_0xa20423)){return _0x235d4a;}else{throw new db[(_0x57b0('0x1d'))][(_0x57b0('0x1e'))](_0x57b0('0x1f'));}}else{return _0x235d4a;}}function respondWithRpcPromise(_0x545c29,_0x37bd5d,_0x4ac304,_0x592b2d){return new BPromise(function(_0x1f18a7,_0x26c6ed){var _0x310d2a=_0x592b2d||client;return _0x310d2a[_0x57b0('0x20')](_0x545c29,_0x4ac304)[_0x57b0('0x21')](function(_0x28af98){logger['info'](_0x57b0('0x22'),_0x37bd5d,_0x57b0('0x23'));logger[_0x57b0('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x37bd5d,_0x57b0('0x23'),JSON[_0x57b0('0x25')](_0x28af98));if(_0x28af98[_0x57b0('0x26')]){if(_0x28af98[_0x57b0('0x26')][_0x57b0('0x27')]===0x1f4){logger[_0x57b0('0x26')](_0x57b0('0x22'),_0x37bd5d,_0x28af98[_0x57b0('0x26')][_0x57b0('0x28')]);return _0x26c6ed(_0x28af98['error']['message']);}logger[_0x57b0('0x26')]('SmsMessage,\x20%s,\x20%s',_0x37bd5d,_0x28af98[_0x57b0('0x26')][_0x57b0('0x28')]);return _0x1f18a7(_0x28af98[_0x57b0('0x26')][_0x57b0('0x28')]);}else{logger[_0x57b0('0x29')](_0x57b0('0x22'),_0x37bd5d,_0x57b0('0x23'));_0x1f18a7(_0x28af98[_0x57b0('0x2a')][_0x57b0('0x28')]);}})[_0x57b0('0x2b')](function(_0x3e4e5f){logger[_0x57b0('0x26')](_0x57b0('0x22'),_0x37bd5d,_0x3e4e5f);_0x26c6ed(_0x3e4e5f);});});}function respondWithStatusCode(_0x508288,_0x285522){_0x285522=_0x285522||0xcc;return function(_0x114cd7){if(_0x114cd7){return _0x508288[_0x57b0('0x2c')](_0x285522);}return _0x508288[_0x57b0('0x2d')](_0x285522)['end']();};}function respondWithResult(_0x552f3e,_0x325e39){_0x325e39=_0x325e39||0xc8;return function(_0x3aaf57){if(_0x3aaf57){return _0x552f3e[_0x57b0('0x2d')](_0x325e39)['json'](_0x3aaf57);}};}function respondWithFilteredResult(_0x52d2bc,_0x9d9195){return function(_0x577dae){if(_0x577dae){var _0x12f4bf=_0x577dae[_0x57b0('0x2e')],_0x5b6c1d=_0x9d9195['offset'],_0x5d19a6=_0x9d9195[_0x57b0('0x2f')]+_0x9d9195[_0x57b0('0x30')],_0x2fb4b7;if(_0x5d19a6>=_0x12f4bf){_0x5d19a6=_0x12f4bf;_0x2fb4b7=0xc8;}else{_0x2fb4b7=0xce;}_0x52d2bc['status'](_0x2fb4b7);return _0x52d2bc[_0x57b0('0x31')](_0x57b0('0x32'),_0x5b6c1d+'-'+_0x5d19a6+'/'+_0x12f4bf)[_0x57b0('0x33')](_0x577dae);}return null;};}function patchUpdates(_0x547ea6){return function(_0x575a07){try{jsonpatch[_0x57b0('0x34')](_0x575a07,_0x547ea6,!![]);}catch(_0x46ccd7){return BPromise[_0x57b0('0x35')](_0x46ccd7);}return _0x575a07[_0x57b0('0x36')]();};}function saveUpdates(_0x5cafcb,_0x4fb841){return function(_0x4ab6cd){if(_0x4ab6cd){return _0x4ab6cd['update'](_0x5cafcb)[_0x57b0('0x21')](function(_0xb44fff){return _0xb44fff;});}return null;};}function removeEntity(_0x1592ac,_0x443881){return function(_0x46513d){if(_0x46513d){return _0x46513d['destroy']()[_0x57b0('0x21')](function(){_0x1592ac[_0x57b0('0x2d')](0xcc)[_0x57b0('0x37')]();});}};}function handleEntityNotFound(_0x208b30,_0x5b1c28){return function(_0x3dab86){if(!_0x3dab86){_0x208b30[_0x57b0('0x2c')](0x194);}return _0x3dab86;};}function handleError(_0x4b0739,_0xbf8d86){_0xbf8d86=_0xbf8d86||0x1f4;return function(_0x530d66){logger['error'](_0x530d66['stack']);if(_0x530d66[_0x57b0('0x38')]){delete _0x530d66[_0x57b0('0x38')];}_0x4b0739[_0x57b0('0x2d')](_0xbf8d86)[_0x57b0('0x39')](_0x530d66);};}exports[_0x57b0('0x3a')]=function(_0x43ca03,_0x30c9b7){var _0x451a88={},_0x3e90f5={},_0x33f0b2={'count':0x0,'rows':[]};var _0x37e0a7=_[_0x57b0('0x3b')](db['SmsMessage'][_0x57b0('0x3c')],function(_0x145b80){return{'name':_0x145b80[_0x57b0('0x3d')],'type':_0x145b80['type']['key']};});_0x3e90f5['model']=_[_0x57b0('0x3b')](_0x37e0a7,_0x57b0('0x38'));_0x3e90f5[_0x57b0('0x3e')]=_[_0x57b0('0x3f')](_0x43ca03['query']);_0x3e90f5[_0x57b0('0x40')]=_[_0x57b0('0x41')](_0x3e90f5['model'],_0x3e90f5[_0x57b0('0x3e')]);_0x451a88[_0x57b0('0x42')]=_[_0x57b0('0x41')](_0x3e90f5[_0x57b0('0x43')],qs[_0x57b0('0x44')](_0x43ca03['query'][_0x57b0('0x44')]));_0x451a88[_0x57b0('0x42')]=_0x451a88[_0x57b0('0x42')][_0x57b0('0x45')]?_0x451a88['attributes']:_0x3e90f5['model'];if(!_0x43ca03[_0x57b0('0x3e')][_0x57b0('0x46')]('nolimit')){_0x451a88[_0x57b0('0x30')]=qs[_0x57b0('0x30')](_0x43ca03[_0x57b0('0x3e')]['limit']);_0x451a88['offset']=qs[_0x57b0('0x2f')](_0x43ca03[_0x57b0('0x3e')][_0x57b0('0x2f')]);}_0x451a88[_0x57b0('0x47')]=qs[_0x57b0('0x48')](_0x43ca03['query'][_0x57b0('0x48')]);_0x451a88[_0x57b0('0x49')]=qs[_0x57b0('0x40')](_[_0x57b0('0x4a')](_0x43ca03[_0x57b0('0x3e')],_0x3e90f5['filters']),_0x37e0a7);if(_0x43ca03['query']['filter']){_0x451a88['where']=_[_0x57b0('0x4b')](_0x451a88[_0x57b0('0x49')],{'$or':_[_0x57b0('0x3b')](_0x37e0a7,function(_0x2af039){if(_0x2af039[_0x57b0('0x4c')]!==_0x57b0('0x4d')){var _0x1f2fd7={};_0x1f2fd7[_0x2af039['name']]={'$like':'%'+_0x43ca03[_0x57b0('0x3e')][_0x57b0('0x4e')]+'%'};return _0x1f2fd7;}})});}_0x451a88=_[_0x57b0('0x4b')]({},_0x451a88,_0x43ca03[_0x57b0('0x4f')]);var _0x3b1f16={'where':_0x451a88[_0x57b0('0x49')]};return db[_0x57b0('0x50')]['count'](_0x3b1f16)[_0x57b0('0x21')](function(_0x535f22){_0x33f0b2[_0x57b0('0x2e')]=_0x535f22;if(_0x43ca03['query'][_0x57b0('0x51')]){_0x451a88['include']=[{'all':!![]}];}return db[_0x57b0('0x50')][_0x57b0('0x52')](_0x451a88);})['then'](function(_0x30b4dd){_0x33f0b2[_0x57b0('0x53')]=_0x30b4dd;return _0x33f0b2;})[_0x57b0('0x21')](respondWithFilteredResult(_0x30c9b7,_0x451a88))['catch'](handleError(_0x30c9b7,null));};exports[_0x57b0('0x54')]=function(_0xb8f21,_0x5d02f4){var _0x2ee9de={'raw':!![],'where':{'id':_0xb8f21['params']['id']}},_0x1f4774={};_0x1f4774[_0x57b0('0x43')]=_[_0x57b0('0x3f')](db[_0x57b0('0x50')][_0x57b0('0x3c')]);_0x1f4774[_0x57b0('0x3e')]=_['keys'](_0xb8f21['query']);_0x1f4774[_0x57b0('0x40')]=_[_0x57b0('0x41')](_0x1f4774[_0x57b0('0x43')],_0x1f4774['query']);_0x2ee9de[_0x57b0('0x42')]=_[_0x57b0('0x41')](_0x1f4774[_0x57b0('0x43')],qs[_0x57b0('0x44')](_0xb8f21[_0x57b0('0x3e')][_0x57b0('0x44')]));_0x2ee9de[_0x57b0('0x42')]=_0x2ee9de[_0x57b0('0x42')][_0x57b0('0x45')]?_0x2ee9de[_0x57b0('0x42')]:_0x1f4774[_0x57b0('0x43')];if(_0xb8f21[_0x57b0('0x3e')][_0x57b0('0x51')]){_0x2ee9de[_0x57b0('0x55')]=[{'all':!![]}];}_0x2ee9de=_[_0x57b0('0x4b')]({},_0x2ee9de,_0xb8f21[_0x57b0('0x4f')]);return db[_0x57b0('0x50')][_0x57b0('0x56')](_0x2ee9de)['then'](handleEntityNotFound(_0x5d02f4,null))[_0x57b0('0x21')](respondWithResult(_0x5d02f4,null))[_0x57b0('0x2b')](handleError(_0x5d02f4,null));};exports[_0x57b0('0x57')]=function(_0x4b7511,_0x56bcec){return db[_0x57b0('0x50')]['create'](_0x4b7511['body'],{})[_0x57b0('0x21')](respondWithResult(_0x56bcec,0xc9))['catch'](handleError(_0x56bcec,null));};exports[_0x57b0('0x58')]=function(_0x4ad368,_0x1ee98e){if(_0x4ad368[_0x57b0('0x59')]['id']){delete _0x4ad368['body']['id'];}return db['SmsMessage'][_0x57b0('0x56')]({'where':{'id':_0x4ad368[_0x57b0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1ee98e,null))[_0x57b0('0x21')](saveUpdates(_0x4ad368[_0x57b0('0x59')],null))[_0x57b0('0x21')](respondWithResult(_0x1ee98e,null))[_0x57b0('0x2b')](handleError(_0x1ee98e,null));};exports['destroy']=function(_0x88b313,_0x3a881d){return db['SmsMessage'][_0x57b0('0x56')]({'where':{'id':_0x88b313[_0x57b0('0x5a')]['id']}})[_0x57b0('0x21')](handleEntityNotFound(_0x3a881d,null))['then'](removeEntity(_0x3a881d,null))[_0x57b0('0x2b')](handleError(_0x3a881d,null));};exports[_0x57b0('0x5b')]=function(_0x358ded,_0x55fde5){return db['SmsMessage'][_0x57b0('0x5b')]()['then'](respondWithResult(_0x55fde5,null))[_0x57b0('0x2b')](handleError(_0x55fde5,null));};var interaction_log=require('../../config/logger')(_0x57b0('0x5c'));exports['accept']=function(_0x5aa588,_0x323f57,_0x224853){var _0x4a8ad4={'channel':'sms'};if(_0x5aa588['body']['id']){delete _0x5aa588[_0x57b0('0x59')]['id'];}_0x5aa588[_0x57b0('0x59')][_0x57b0('0x5d')]=!![];_0x5aa588[_0x57b0('0x59')]['readAt']=moment()['format'](_0x57b0('0x5e'));_0x5aa588[_0x57b0('0x59')][_0x57b0('0x5f')]=_0x5aa588[_0x57b0('0x59')][_0x57b0('0x5f')]||_0x5aa588[_0x57b0('0x60')]['id'];return db['SmsMessage'][_0x57b0('0x56')]({'where':{'id':_0x5aa588[_0x57b0('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x57b0('0x61')],'as':_0x57b0('0x62')}]})[_0x57b0('0x21')](handleEntityNotFound(_0x323f57,null))['then'](saveUpdates(_0x5aa588[_0x57b0('0x59')],null))[_0x57b0('0x21')](function(_0x19f35d){if(_0x19f35d){_0x4a8ad4[_0x57b0('0x28')]=_0x19f35d[_0x57b0('0x63')]({'plain':!![]});return db[_0x57b0('0x64')]['find']({'where':{'id':_0x19f35d['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x323f57,null))[_0x57b0('0x21')](function(_0x40d188){if(_0x40d188){return _0x40d188['update']({'UserId':_0x5aa588[_0x57b0('0x59')][_0x57b0('0x5f')],'read1stAt':_[_0x57b0('0x65')](_0x40d188[_0x57b0('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x46d600){if(_0x46d600){_0x4a8ad4[_0x57b0('0x67')]=_0x46d600[_0x57b0('0x63')]({'plain':!![]});interaction_log['info'](_0x57b0('0x68'),_0x5aa588['user']['id'],_0x5aa588['user']['name'],_0x5aa588[_0x57b0('0x60')]['role'],_0x4a8ad4[_0x57b0('0x67')]['id'],_0x5aa588[_0x57b0('0x59')]?JSON[_0x57b0('0x25')](_0x5aa588[_0x57b0('0x59')]):_0x57b0('0x69'));return respondWithRpcPromise(_0x57b0('0x6a'),_0x57b0('0x6b'),_0x4a8ad4);}return null;})[_0x57b0('0x21')](function(_0x12d801){if(_0x12d801){if(_0x5aa588['body'][_0x57b0('0x6c')]){_0x4a8ad4[_0x57b0('0x28')][_0x57b0('0x6d')]=util['format'](_0x57b0('0x6e'),_0x5aa588[_0x57b0('0x60')][_0x57b0('0x38')]);_0x4a8ad4[_0x57b0('0x28')][_0x57b0('0x6f')]=_0x4a8ad4['channel'];_0x4a8ad4['message'][_0x57b0('0x70')]=_0x57b0('0x71');return respondWithRpcPromise('EventManager',_0x57b0('0x72'),{'event':_0x57b0('0x73'),'message':_0x4a8ad4[_0x57b0('0x28')]},client9002)['then'](function(){return _0x4a8ad4;});}return _0x4a8ad4;}return null;})['then'](respondWithResult(_0x323f57,null))[_0x57b0('0x2b')](handleError(_0x323f57,null));};var interaction_log=require('../../config/logger')(_0x57b0('0x5c'));exports[_0x57b0('0x35')]=function(_0x371cd3,_0x199877,_0x32f519){var _0x44fa33={'agent':{},'channel':_0x57b0('0x74')};if(_0x371cd3[_0x57b0('0x59')]['id']){delete _0x371cd3['body']['id'];}_0x371cd3[_0x57b0('0x59')][_0x57b0('0x5f')]=_0x371cd3[_0x57b0('0x59')][_0x57b0('0x5f')]||_0x371cd3['user']['id'];_0x44fa33[_0x57b0('0x75')]['id']=_0x371cd3[_0x57b0('0x59')]['UserId'];return db[_0x57b0('0x50')][_0x57b0('0x56')]({'where':{'id':_0x371cd3[_0x57b0('0x5a')]['id'],'UserId':null}})[_0x57b0('0x21')](handleEntityNotFound(_0x199877,null))['then'](function(_0x54d0f6){if(_0x54d0f6){_0x44fa33[_0x57b0('0x28')]=_0x54d0f6[_0x57b0('0x63')]({'plain':!![]});return db[_0x57b0('0x64')][_0x57b0('0x56')]({'where':{'id':_0x54d0f6[_0x57b0('0x76')]}});}return null;})[_0x57b0('0x21')](handleEntityNotFound(_0x199877,null))[_0x57b0('0x21')](function(_0x46633d){if(_0x46633d){_0x44fa33[_0x57b0('0x67')]=_0x46633d[_0x57b0('0x63')]({'plain':!![]});interaction_log[_0x57b0('0x29')](_0x57b0('0x77'),_0x371cd3['user']['id'],_0x371cd3[_0x57b0('0x60')]['name'],_0x371cd3[_0x57b0('0x60')][_0x57b0('0x78')],_0x44fa33[_0x57b0('0x67')]['id'],_0x371cd3[_0x57b0('0x59')]?JSON[_0x57b0('0x25')](_0x371cd3[_0x57b0('0x59')]):_0x57b0('0x69'));return respondWithRpcPromise(_0x57b0('0x79'),'rejectMessage',_0x44fa33);}return null;})[_0x57b0('0x21')](function(_0x2d6808){if(_0x2d6808){_0x2d6808[_0x57b0('0x28')][_0x57b0('0x6d')]=util['format'](_0x57b0('0x6e'),_0x371cd3['user'][_0x57b0('0x38')]);_0x2d6808[_0x57b0('0x28')]['channel']=_0x44fa33[_0x57b0('0x6f')];_0x2d6808['message']['event']=_0x57b0('0x35');respondWithRpcPromise(_0x57b0('0x72'),'EventManager',{'event':_0x57b0('0x7a'),'message':_0x2d6808[_0x57b0('0x28')]},client9002);return _0x44fa33;}return null;})[_0x57b0('0x21')](respondWithResult(_0x199877,null))['catch'](handleError(_0x199877,null));};exports['status']=function(_0x369eba,_0xb5becf,_0x85a087){if(_0x369eba[_0x57b0('0x59')]['id']){delete _0x369eba[_0x57b0('0x59')]['id'];}var _0x3f14f1;return db[_0x57b0('0x50')]['find']({'where':{'id':_0x369eba['params']['id']}})['then'](handleEntityNotFound(_0xb5becf,null))['then'](function(_0x3a4e43){if(_0x3a4e43){_0x3f14f1=_0x3a4e43;return db[_0x57b0('0x7b')][_0x57b0('0x56')]({'where':{'id':_0x3a4e43[_0x57b0('0x7c')]}});}})['then'](handleEntityNotFound(_0xb5becf,null))[_0x57b0('0x21')](function(_0x40b843){if(_0x40b843){logger[_0x57b0('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x57b0('0x7d'),_0x40b843['type'],util['inspect'](_0x369eba[_0x57b0('0x59')],{'showHidden':![],'depth':null}));switch(_0x40b843[_0x57b0('0x4c')]){case _0x57b0('0x7e'):if(_0x369eba[_0x57b0('0x59')][_0x57b0('0x7f')]&&_0x369eba[_0x57b0('0x59')]['MessageSid']===_0x3f14f1[_0x57b0('0x80')]){return _0x3f14f1[_0x57b0('0x58')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x57b0('0x2d'),_0x57b0('0x7e'),util[_0x57b0('0x81')](_0x369eba[_0x57b0('0x59')],{'showHidden':![],'depth':null}));}break;case _0x57b0('0x82'):if(_0x369eba[_0x57b0('0x59')][_0x57b0('0x83')]&&_0x369eba[_0x57b0('0x59')][_0x57b0('0x83')]===_0x3f14f1[_0x57b0('0x80')]&&_[_0x57b0('0x84')]([_0x57b0('0x85'),_0x57b0('0x86')],_0x369eba['body'][_0x57b0('0x87')])>=0x0){return _0x3f14f1[_0x57b0('0x58')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x57b0('0x2d'),_0x57b0('0x88'),util[_0x57b0('0x81')](_0x369eba[_0x57b0('0x59')],{'showHidden':![],'depth':null}));}break;case _0x57b0('0x89'):var _0x552ac3=_0x369eba['body'][_0x57b0('0x8a')][0x0];if(_0x552ac3[_0x57b0('0x2d')][_0x57b0('0x8b')]===_0x57b0('0x8c')){return _0x3f14f1[_0x57b0('0x58')]({'read':!![]});}else{logger['error'](_0x57b0('0x8d'),_0x57b0('0x2d'),_0x57b0('0x89'),util[_0x57b0('0x81')](_0x369eba['body'],{'showHidden':![],'depth':null}));}break;}return _0x3f14f1;}})['then'](respondWithResult(_0xb5becf,null))['catch'](handleError(_0xb5becf,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 10e33df..d422a96 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 _0x2261=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x5b1981,_0x310935){var _0x59b3e3=function(_0x2a6f9d){while(--_0x2a6f9d){_0x5b1981['push'](_0x5b1981['shift']());}};_0x59b3e3(++_0x310935);}(_0x2261,0x113));var _0x1226=function(_0x46993a,_0x5e582c){_0x46993a=_0x46993a-0x0;var _0x51e95a=_0x2261[_0x46993a];return _0x51e95a;};'use strict';var EventEmitter=require(_0x1226('0x0'));var SmsMessage=require(_0x1226('0x1'))['db'][_0x1226('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1226('0x3')](0x0);var events={'afterCreate':_0x1226('0x4'),'afterUpdate':_0x1226('0x5'),'afterDestroy':_0x1226('0x6')};function emitEvent(_0x4a459b){return function(_0x1be0e0,_0x19e541,_0x172b41){SmsMessageEvents[_0x1226('0x7')](_0x4a459b+':'+_0x1be0e0['id'],_0x1be0e0);SmsMessageEvents[_0x1226('0x7')](_0x4a459b,_0x1be0e0);_0x172b41(null);};}for(var e in events){if(events[_0x1226('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xbb1c=['hook','exports','events','../../mysqldb','SmsMessage','save','update','emit','hasOwnProperty'];(function(_0x98607e,_0x36181e){var _0x308cd0=function(_0x226ab9){while(--_0x226ab9){_0x98607e['push'](_0x98607e['shift']());}};_0x308cd0(++_0x36181e);}(_0xbb1c,0x16a));var _0xcbb1=function(_0x52c841,_0x1a77af){_0x52c841=_0x52c841-0x0;var _0x3f52dc=_0xbb1c[_0x52c841];return _0x3f52dc;};'use strict';var EventEmitter=require(_0xcbb1('0x0'));var SmsMessage=require(_0xcbb1('0x1'))['db'][_0xcbb1('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcbb1('0x3'),'afterUpdate':_0xcbb1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x196188){return function(_0x147536,_0x5c5368,_0x54a0da){SmsMessageEvents[_0xcbb1('0x5')](_0x196188+':'+_0x147536['id'],_0x147536);SmsMessageEvents['emit'](_0x196188,_0x147536);_0x54a0da(null);};}for(var e in events){if(events[_0xcbb1('0x6')](e)){var event=events[e];SmsMessage[_0xcbb1('0x7')](e,emitEvent(event));}}module[_0xcbb1('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index f1e9390..e35ece9 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 _0xca6f=['authToken','accountSid','messages','create','phone','/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=','&password=','GET','split','sms','POST','user_key','session_key','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','crypto','apiKey','text','timestamp','keys','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','SmsAccount','find','SmsAccountId','type','twilio'];(function(_0x5a946a,_0x100701){var _0x27530f=function(_0x42b2f9){while(--_0x42b2f9){_0x5a946a['push'](_0x5a946a['shift']());}};_0x27530f(++_0x100701);}(_0xca6f,0xcf));var _0xfca6=function(_0x5ab26d,_0x1a6cad){_0x5ab26d=_0x5ab26d-0x0;var _0x1fa998=_0xca6f[_0x5ab26d];return _0x1fa998;};'use strict';var _=require(_0xfca6('0x0'));var util=require(_0xfca6('0x1'));var logger=require(_0xfca6('0x2'))(_0xfca6('0x3'));var moment=require(_0xfca6('0x4'));var BPromise=require(_0xfca6('0x5'));var rp=require(_0xfca6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfca6('0x7'));var config=require(_0xfca6('0x8'));var attributes=require(_0xfca6('0x9'));module[_0xfca6('0xa')]=function(_0x11c162,_0x17e091){return _0x11c162[_0xfca6('0xb')](_0xfca6('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xfca6('0xd'),'fields':['messageId']},{'name':_0xfca6('0xe'),'fields':[_0xfca6('0xf')],'type':_0xfca6('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b55b4,_0x121bb1,_0x4635bd){var _0x47fb48=_0x11c162['models'];var _0xa9654e=_0x5b55b4[_0xfca6('0x11')]({'plain':!![]});if(_0xa9654e[_0xfca6('0x12')][_0xfca6('0x13')]()==='in'||_0xa9654e[_0xfca6('0x12')][_0xfca6('0x13')]()===_0xfca6('0x14')&&!_0xa9654e[_0xfca6('0x15')]&&!_[_0xfca6('0x16')](_0xa9654e[_0xfca6('0x17')])){_0x47fb48['SmsInteraction'][_0xfca6('0x18')]({'where':{'id':_0xa9654e['SmsInteractionId']}})[_0xfca6('0x19')](function(_0xac2448){if(_0xac2448){_0xac2448[_0xfca6('0x1a')]({'lastMsgAt':_0xa9654e[_0xfca6('0x1b')],'lastMsgDirection':_0xa9654e[_0xfca6('0x12')]['toLowerCase']()});}})['catch'](function(_0xf8d0db){console['error'](_0xf8d0db);});}if(_0xa9654e[_0xfca6('0x12')]==='out'&&!_0xa9654e[_0xfca6('0x15')]){var _0x3337c3;_0x47fb48[_0xfca6('0x1c')][_0xfca6('0x1d')]({'where':{'id':_0xa9654e[_0xfca6('0x1e')]},'raw':!![]})[_0xfca6('0x19')](function(_0x1c5b32){_0x3337c3=_0x1c5b32;if(_0x3337c3&&_0x3337c3[_0xfca6('0x1f')]){switch(_0x3337c3[_0xfca6('0x1f')]){case _0xfca6('0x20'):var _0x135de8=require(_0xfca6('0x20'));if(_0x3337c3['accountSid']&&_0x3337c3[_0xfca6('0x21')]&&_0x3337c3['phone']){var _0x49093d=new _0x135de8(_0x3337c3[_0xfca6('0x22')],_0x3337c3['authToken']);_0x49093d[_0xfca6('0x23')][_0xfca6('0x24')]({'body':_0xa9654e[_0xfca6('0xf')],'to':_0xa9654e[_0xfca6('0x25')],'from':_0x3337c3['phone'],'statusCallback':_0x3337c3['remote']+_0xfca6('0x26')+_0xa9654e['id']+_0xfca6('0x27')+_0x3337c3[_0xfca6('0x28')]})[_0xfca6('0x19')](function(_0x1dc88e){if(_0x1dc88e[_0xfca6('0x29')]){return _0x5b55b4['update']({'messageId':_0x1dc88e[_0xfca6('0x29')]});}})[_0xfca6('0x2a')](function(_0x272938){logger[_0xfca6('0x2b')](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x20'),util[_0xfca6('0x2e')](_0x272938,{'showHidden':![],'depth':null}));});}else{logger[_0xfca6('0x2b')](_0xfca6('0x2c'),_0xfca6('0x2d'),'twilio',_0xfca6('0x2f'));}break;case _0xfca6('0x30'):var _0x32f3d6=_0xfca6('0x31');if(_0x3337c3[_0xfca6('0x32')]&&_0x3337c3[_0xfca6('0x33')]){var _0x387523={'recipient':[_0xa9654e[_0xfca6('0x25')]],'message':_0xa9654e[_0xfca6('0xf')],'message_type':_0x3337c3[_0xfca6('0x34')]};if(_0x3337c3['smsMethod']&&_0x3337c3['smsMethod']!=='SI'){_0x387523[_0xfca6('0x35')]=_0x3337c3['phone'];}var _0x12f82a={'url':_0x32f3d6+_0xfca6('0x36')+_0x3337c3[_0xfca6('0x32')]+_0xfca6('0x37')+_0x3337c3['password'],'method':_0xfca6('0x38')};rp(_0x12f82a)[_0xfca6('0x19')](function(_0x1264a1){var _0x2e3bb0=_0x1264a1[_0xfca6('0x39')](';');var _0x3b74ce={'user_key':_0x2e3bb0[0x0],'session_key':_0x2e3bb0[0x1]};_0x12f82a={'url':_0x32f3d6+_0xfca6('0x3a'),'method':_0xfca6('0x3b'),'headers':{'user_key':_0x3b74ce[_0xfca6('0x3c')],'Session_key':_0x3b74ce[_0xfca6('0x3d')]},'json':!![],'body':_0x387523};return rp(_0x12f82a);})[_0xfca6('0x19')](function(_0x5a95d3){if(_0x5a95d3['total_sent']>=0x1){var _0x419508={'messageId':_0x5a95d3['internal_order_id']};if(_0x3337c3[_0xfca6('0x34')]!=='GP'||!_0x3337c3[_0xfca6('0x3e')]){_0x419508[_0xfca6('0x3f')]=!![];}return _0x5b55b4['update'](_0x419508);}else{return logger['error'](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x30'),util[_0xfca6('0x2e')](_0x5a95d3,{'showHidden':![],'depth':null}));}})[_0xfca6('0x2a')](function(_0x574b66){return logger['error'](_0xfca6('0x2c'),'afterCreate',_0xfca6('0x30'),util[_0xfca6('0x2e')](_0x574b66,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfca6('0x2d'),_0xfca6('0x30'),_0xfca6('0x40'));}break;case'connectel':if(_0x3337c3[_0xfca6('0x21')]){var _0x97b33a={'recipient':_0xa9654e[_0xfca6('0x25')],'message':_0xa9654e['body'],'sender':_0x3337c3['senderString']||_0x3337c3[_0xfca6('0x25')],'authorization':_0x3337c3[_0xfca6('0x21')]};var _0x121bb1={'method':_0xfca6('0x3b'),'uri':_0xfca6('0x41'),'body':_0x97b33a,'json':!![]};rp(_0x121bb1)[_0xfca6('0x19')](function(_0x818446){var _0x2a207b={'messageId':_0x818446[_0xfca6('0x42')]};if(!_0x3337c3[_0xfca6('0x3e')]){_0x2a207b['read']=!![];}return _0x5b55b4[_0xfca6('0x1a')](_0x2a207b);})[_0xfca6('0x2a')](function(_0x1c76a3){logger[_0xfca6('0x2b')](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x43'),util[_0xfca6('0x2e')](_0x1c76a3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x43'),_0xfca6('0x44'));}break;case _0xfca6('0x45'):if(_0x3337c3['username']&&_0x3337c3['password']){var _0x97b33a={'messages':[{'source':_0xfca6('0x46'),'to':_0xa9654e['phone'],'body':_0xa9654e[_0xfca6('0xf')],'from':_0x3337c3[_0xfca6('0x47')]||_0x3337c3[_0xfca6('0x25')]}]};var _0x5b020b=util[_0xfca6('0x48')](_0xfca6('0x49'),_0x3337c3['username'],_0x3337c3['password']);var _0x121bb1={'method':_0xfca6('0x3b'),'uri':_0xfca6('0x4a'),'body':_0x97b33a,'headers':{'Authorization':util[_0xfca6('0x48')]('Basic\x20%s',new Buffer(_0x5b020b)[_0xfca6('0x4b')](_0xfca6('0x4c')))},'json':!![]};rp(_0x121bb1)[_0xfca6('0x19')](function(_0x37df9a){if(_0x37df9a[_0xfca6('0x4d')]>=0xc8&&_0x37df9a[_0xfca6('0x4d')]<=0xce){if(_0x37df9a[_0xfca6('0x4e')]&&_0x37df9a[_0xfca6('0x4e')][_0xfca6('0x4f')]>0x0){var _0x21dd21=_['head'](_0x37df9a['data'][_0xfca6('0x23')]);var _0x3a414b={'messageId':_0x21dd21['message_id']};if(!_0x3337c3[_0xfca6('0x3e')]){_0x3a414b[_0xfca6('0x3f')]=!![];}return _0x5b55b4[_0xfca6('0x1a')](_0x3a414b);}else{logger['error'](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x50'),util[_0xfca6('0x2e')](_0x37df9a,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x50'),util[_0xfca6('0x2e')](_0x37df9a,{'showHidden':![],'depth':null}));}})[_0xfca6('0x2a')](function(_0x1aa5f2){logger[_0xfca6('0x2b')](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x50'),util[_0xfca6('0x2e')](_0x1aa5f2,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfca6('0x2d'),_0xfca6('0x50'),_0xfca6('0x40'));}break;case _0xfca6('0x51'):if(_0x3337c3[_0xfca6('0x52')]&&_0x3337c3[_0xfca6('0x21')]){var _0x97b33a={'dst':_0xa9654e[_0xfca6('0x25')],'text':_0xa9654e[_0xfca6('0xf')],'src':_0x3337c3[_0xfca6('0x47')]||_0x3337c3[_0xfca6('0x25')],'url':_0x3337c3[_0xfca6('0x53')]+_0xfca6('0x26')+_0xa9654e['id']+_0xfca6('0x27')+_0x3337c3[_0xfca6('0x28')]};var _0x5b020b=util[_0xfca6('0x48')](_0xfca6('0x49'),_0x3337c3['authId'],_0x3337c3[_0xfca6('0x21')]);var _0x121bb1={'method':_0xfca6('0x3b'),'uri':util[_0xfca6('0x48')](_0xfca6('0x54'),_0x3337c3[_0xfca6('0x52')]),'body':_0x97b33a,'headers':{'Authorization':util[_0xfca6('0x48')]('Basic\x20%s',new Buffer(_0x5b020b)[_0xfca6('0x4b')](_0xfca6('0x4c')))},'json':!![]};rp(_0x121bb1)[_0xfca6('0x19')](function(_0x40a8e0){var _0xc21666={'messageId':_0x40a8e0[_0xfca6('0x55')][0x0]};return _0x5b55b4['update'](_0xc21666);})[_0xfca6('0x2a')](function(_0x2cec28){logger[_0xfca6('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfca6('0x2d'),'plivo',util[_0xfca6('0x2e')](_0x2cec28,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfca6('0x2d'),'plivo',_0xfca6('0x56'));}break;case _0xfca6('0x57'):if(_0x3337c3['username']&&_0x3337c3[_0xfca6('0x33')]){if(_0x3337c3['baseUrl']){var _0x3fe980={'method':_0xfca6('0x3b'),'uri':_0x3337c3[_0xfca6('0x58')]+_0xfca6('0x59'),'body':{'username':_0x3337c3['username'],'password':_0x3337c3['password']},'json':!![]};return rp(_0x3fe980)[_0xfca6('0x19')](function(_0x3d7834){var _0x297bb5={'method':_0xfca6('0x3b'),'uri':_0x3337c3[_0xfca6('0x58')]+_0xfca6('0x5a'),'body':{'messages':[{'from':_0x3337c3['phone'],'destinations':[{'to':_0xa9654e[_0xfca6('0x25')]}],'text':_0xa9654e[_0xfca6('0xf')],'notifyUrl':_0x3337c3['remote']+_0xfca6('0x26')+_0xa9654e['id']+_0xfca6('0x27')+_0x3337c3[_0xfca6('0x28')],'notifyContentType':_0xfca6('0x5b'),'callbackData':_0x3337c3[_0xfca6('0x25')]+';'+_0xa9654e[_0xfca6('0xf')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x3d7834[_0xfca6('0x28')]},'json':!![]};return rp(_0x297bb5)[_0xfca6('0x19')](function(_0x2b9002){if(_0x2b9002[_0xfca6('0x23')]){var _0x55c5af={'messageId':_0x2b9002[_0xfca6('0x23')][0x0][_0xfca6('0xd')]};if(!_0x3337c3['deliveryReport']){_0x55c5af[_0xfca6('0x3f')]=!![];}return _0x5b55b4[_0xfca6('0x1a')](_0x55c5af);}else{return logger[_0xfca6('0x2b')](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x57'),util[_0xfca6('0x2e')](_0x2b9002,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1b26be){return logger[_0xfca6('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfca6('0x2d'),_0xfca6('0x57'),util['inspect'](_0x1b26be,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfca6('0x2c'),'afterCreate','infobip',_0xfca6('0x5c'));}}else{logger[_0xfca6('0x2b')](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x57'),_0xfca6('0x40'));}break;case'csc':var _0x2ee7ce=require(_0xfca6('0x5d'));if(_0x3337c3[_0xfca6('0x5e')]){var _0x196cbe={};_0x196cbe['login']=_0x3337c3[_0xfca6('0x32')];_0x196cbe[_0xfca6('0x25')]=_0xa9654e[_0xfca6('0x25')];_0x196cbe[_0xfca6('0x35')]=_0x3337c3['phone'];_0x196cbe[_0xfca6('0x5f')]=_0xa9654e['body'];_0x196cbe[_0xfca6('0x60')]=+new Date();var _0x169174='';var _0x3cabbf='';var _0x399cb7=Object[_0xfca6('0x61')](_0x196cbe);_0x399cb7[_0xfca6('0x62')]();for(var _0x4c5be9=0x0;_0x4c5be9<_0x399cb7[_0xfca6('0x63')];_0x4c5be9++){if(_0x169174!=''){_0x169174+='&';}_0x169174+=_0x399cb7[_0x4c5be9]+'='+encodeURIComponent(_0x196cbe[_0x399cb7[_0x4c5be9]]);_0x3cabbf+=_0x196cbe[_0x399cb7[_0x4c5be9]];}_0x3cabbf+=_0x3337c3[_0xfca6('0x5e')];_0x3cabbf=_0x2ee7ce[_0xfca6('0x64')](_0xfca6('0x65'))[_0xfca6('0x1a')](_0x3cabbf)['digest'](_0xfca6('0x66'));if(_0x169174!==''){_0x169174+='&';}_0x169174+=_0xfca6('0x67')+_0x3cabbf;var _0x12f82a={'method':_0xfca6('0x38'),'uri':_0x3337c3[_0xfca6('0x58')]+_0xfca6('0x68')+_0x169174,'json':!![]};return rp(_0x12f82a)[_0xfca6('0x19')](function(_0x2d3e2e){var _0x1f7822=Object[_0xfca6('0x61')](_0x2d3e2e);if(_0x2d3e2e[_0x1f7822[0x0]]['error']&&parseInt(_0x2d3e2e[_0x1f7822[0x0]][_0xfca6('0x2b')])===0x0){var _0x57716f={'messageId':_0x2d3e2e[_0x1f7822[0x0]][_0xfca6('0x69')]};if(!_0x3337c3[_0xfca6('0x3e')]){_0x57716f[_0xfca6('0x3f')]=!![];}return _0x5b55b4[_0xfca6('0x1a')](_0x57716f);}else{return logger[_0xfca6('0x2b')](_0xfca6('0x2c'),'afterCreate','csc',util[_0xfca6('0x2e')](_0x2d3e2e['error'],{'showHidden':![],'depth':null}));}})[_0xfca6('0x2a')](function(_0x5803fd){return logger['error'](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x6a'),util[_0xfca6('0x2e')](_0x5803fd,{'showHidden':![],'depth':null}));});}else{logger[_0xfca6('0x2b')](_0xfca6('0x2c'),'afterCreate',_0xfca6('0x6a'),_0xfca6('0x6b'));}break;case _0xfca6('0x6c'):if(_0x3337c3[_0xfca6('0x5e')]){var _0x20d709={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3337c3['apiKey']},'body':{'content':_0xa9654e[_0xfca6('0xf')],'to':[_0xa9654e[_0xfca6('0x25')]],'from':_0x3337c3[_0xfca6('0x25')],'binary':![],'clientMessageId':_0xfca6('0x6d'),'charset':_0xfca6('0x6e')},'json':!![]};rp(_0x20d709)['then'](function(_0x5b462e){if(!_0x5b462e[_0xfca6('0x2b')]){var _0x39965c={'messageId':_0x5b462e[_0xfca6('0x23')][0x0][_0xfca6('0x6f')]};if(!_0x3337c3['deliveryReport']){_0x39965c[_0xfca6('0x3f')]=!![];}return _0x5b55b4[_0xfca6('0x1a')](_0x39965c);}else{return logger[_0xfca6('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfca6('0x2d'),_0xfca6('0x6c'),util['inspect'](_0x5b462e['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1159b9){return logger[_0xfca6('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfca6('0x2d'),_0xfca6('0x6c'),util[_0xfca6('0x2e')](_0x1159b9,{'showHidden':![],'depth':null}));});}else{logger[_0xfca6('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfca6('0x2d'),_0xfca6('0x6c'),_0xfca6('0x6b'));}break;case _0xfca6('0x70'):if(_0x3337c3[_0xfca6('0x5e')]){var _0x3bac5b={};var _0x12f82a={'method':_0xfca6('0x3b'),'uri':_0xfca6('0x71'),'headers':{'Authorization':_0xfca6('0x72')+_0x3337c3[_0xfca6('0x5e')],'Content-Type':_0xfca6('0x5b')},'body':{'from':_0x3337c3[_0xfca6('0x25')],'to':_0xa9654e[_0xfca6('0x25')],'text':_0xa9654e['body']},'json':!![]};return rp(_0x12f82a)[_0xfca6('0x19')](function(_0x4ebb98){if(_0x4ebb98[_0xfca6('0x73')]==0xca){_0x3bac5b[_0xfca6('0x74')]=_0x4ebb98;var _0x11c475={'method':_0xfca6('0x3b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xfca6('0x72')+_0x3337c3[_0xfca6('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0x3bac5b[_0xfca6('0x74')][_0xfca6('0x75')]},'json':!![]};return rp(_0x11c475)[_0xfca6('0x19')](function(_0x1e98c7){_0x3bac5b['status']=_0x1e98c7;var _0x19b68f={'messageId':_0x3bac5b[_0xfca6('0x74')][_0xfca6('0x75')],'read':!![]};return _0x5b55b4[_0xfca6('0x1a')](_0x19b68f);});}else{return logger[_0xfca6('0x2b')](_0xfca6('0x2c'),_0xfca6('0x2d'),'intelepeer',util[_0xfca6('0x2e')](_0x4ebb98,{'showHidden':![],'depth':null}));}})[_0xfca6('0x2a')](function(_0x5e2921){return logger['error'](_0xfca6('0x2c'),_0xfca6('0x2d'),_0xfca6('0x70'),util[_0xfca6('0x2e')](_0x5e2921,{'showHidden':![],'depth':null}));});}else{return logger[_0xfca6('0x2b')](_0xfca6('0x2c'),_0xfca6('0x2d'),'intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0x4635bd();});}else{_0x4635bd();}}},'charset':_0xfca6('0x76'),'collate':_0xfca6('0x77')});}; \ No newline at end of file +var _0x037e=['requestid','deliveryReport','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','Basic\x20%s','toString','http_code','queued_count','head','data','message_id','clickSend','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','base64','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/status?token=','token','sid','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/','password','smsMethod','sender','login?username=','username','GET','split','sms','POST','user_key','total_sent','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/'];(function(_0x8b8d7c,_0x313171){var _0x5c498c=function(_0x389b12){while(--_0x389b12){_0x8b8d7c['push'](_0x8b8d7c['shift']());}};_0x5c498c(++_0x313171);}(_0x037e,0x129));var _0xe037=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x037e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe037('0x0'));var util=require(_0xe037('0x1'));var logger=require(_0xe037('0x2'))(_0xe037('0x3'));var moment=require(_0xe037('0x4'));var BPromise=require(_0xe037('0x5'));var rp=require(_0xe037('0x6'));var fs=require('fs');var path=require(_0xe037('0x7'));var rimraf=require(_0xe037('0x8'));var config=require('../../config/environment');var attributes=require(_0xe037('0x9'));module[_0xe037('0xa')]=function(_0xfe0a2,_0x9ef8bd){return _0xfe0a2[_0xe037('0xb')]('SmsMessage',attributes,{'tableName':_0xe037('0xc'),'paranoid':![],'indexes':[{'name':_0xe037('0xd'),'fields':[_0xe037('0xd')]},{'name':_0xe037('0xe'),'fields':['body'],'type':_0xe037('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53c06e,_0x1555d8,_0x30652f){var _0x35c8d7=_0xfe0a2['models'];var _0x31311e=_0x53c06e[_0xe037('0x10')]({'plain':!![]});if(_0x31311e[_0xe037('0x11')][_0xe037('0x12')]()==='in'||_0x31311e[_0xe037('0x11')]['toLowerCase']()==='out'&&!_0x31311e[_0xe037('0x13')]&&!_[_0xe037('0x14')](_0x31311e[_0xe037('0x15')])){_0x35c8d7[_0xe037('0x16')]['findOne']({'where':{'id':_0x31311e[_0xe037('0x17')]}})[_0xe037('0x18')](function(_0xd402f8){if(_0xd402f8){_0xd402f8[_0xe037('0x19')]({'lastMsgAt':_0x31311e[_0xe037('0x1a')],'lastMsgDirection':_0x31311e[_0xe037('0x11')][_0xe037('0x12')]()});}})[_0xe037('0x1b')](function(_0x30e641){console['error'](_0x30e641);});}if(_0x31311e['direction']===_0xe037('0x1c')&&!_0x31311e['secret']){var _0x20ea21;_0x35c8d7[_0xe037('0x1d')][_0xe037('0x1e')]({'where':{'id':_0x31311e[_0xe037('0x1f')]},'raw':!![]})[_0xe037('0x18')](function(_0x459aa8){_0x20ea21=_0x459aa8;if(_0x20ea21&&_0x20ea21[_0xe037('0x20')]){switch(_0x20ea21['type']){case _0xe037('0x21'):var _0x1afea2=require(_0xe037('0x21'));if(_0x20ea21[_0xe037('0x22')]&&_0x20ea21[_0xe037('0x23')]&&_0x20ea21[_0xe037('0x24')]){var _0x47b013=new _0x1afea2(_0x20ea21['accountSid'],_0x20ea21['authToken']);_0x47b013[_0xe037('0x25')][_0xe037('0x26')]({'body':_0x31311e[_0xe037('0x27')],'to':_0x31311e[_0xe037('0x24')],'from':_0x20ea21[_0xe037('0x24')],'statusCallback':_0x20ea21[_0xe037('0x28')]+'/api/sms/messages/'+_0x31311e['id']+_0xe037('0x29')+_0x20ea21[_0xe037('0x2a')]})[_0xe037('0x18')](function(_0x35313c){if(_0x35313c[_0xe037('0x2b')]){return _0x53c06e[_0xe037('0x19')]({'messageId':_0x35313c[_0xe037('0x2b')]});}})[_0xe037('0x1b')](function(_0x320cf1){logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x21'),util[_0xe037('0x2f')](_0x320cf1,{'showHidden':![],'depth':null}));});}else{logger[_0xe037('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe037('0x2e'),'twilio',_0xe037('0x30'));}break;case _0xe037('0x31'):var _0x52f420=_0xe037('0x32');if(_0x20ea21['username']&&_0x20ea21[_0xe037('0x33')]){var _0x24ddb2={'recipient':[_0x31311e['phone']],'message':_0x31311e[_0xe037('0x27')],'message_type':_0x20ea21[_0xe037('0x34')]};if(_0x20ea21[_0xe037('0x34')]&&_0x20ea21[_0xe037('0x34')]!=='SI'){_0x24ddb2[_0xe037('0x35')]=_0x20ea21[_0xe037('0x24')];}var _0xa889ff={'url':_0x52f420+_0xe037('0x36')+_0x20ea21[_0xe037('0x37')]+'&password='+_0x20ea21[_0xe037('0x33')],'method':_0xe037('0x38')};rp(_0xa889ff)[_0xe037('0x18')](function(_0x2d5235){var _0x3d4be=_0x2d5235[_0xe037('0x39')](';');var _0x27475e={'user_key':_0x3d4be[0x0],'session_key':_0x3d4be[0x1]};_0xa889ff={'url':_0x52f420+_0xe037('0x3a'),'method':_0xe037('0x3b'),'headers':{'user_key':_0x27475e[_0xe037('0x3c')],'Session_key':_0x27475e['session_key']},'json':!![],'body':_0x24ddb2};return rp(_0xa889ff);})[_0xe037('0x18')](function(_0x17a03d){if(_0x17a03d[_0xe037('0x3d')]>=0x1){var _0x5b49d1={'messageId':_0x17a03d['internal_order_id']};if(_0x20ea21[_0xe037('0x34')]!=='GP'||!_0x20ea21['deliveryReport']){_0x5b49d1['read']=!![];}return _0x53c06e[_0xe037('0x19')](_0x5b49d1);}else{return logger[_0xe037('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe037('0x31'),util[_0xe037('0x2f')](_0x17a03d,{'showHidden':![],'depth':null}));}})[_0xe037('0x1b')](function(_0xbedc23){return logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),'skebby',util[_0xe037('0x2f')](_0xbedc23,{'showHidden':![],'depth':null}));});}else{logger[_0xe037('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe037('0x2e'),_0xe037('0x31'),_0xe037('0x3e'));}break;case _0xe037('0x3f'):if(_0x20ea21[_0xe037('0x23')]){var _0x47a580={'recipient':_0x31311e[_0xe037('0x24')],'message':_0x31311e[_0xe037('0x27')],'sender':_0x20ea21[_0xe037('0x40')]||_0x20ea21['phone'],'authorization':_0x20ea21[_0xe037('0x23')]};var _0x1555d8={'method':_0xe037('0x3b'),'uri':_0xe037('0x41'),'body':_0x47a580,'json':!![]};rp(_0x1555d8)[_0xe037('0x18')](function(_0x4a3afd){var _0xa9359e={'messageId':_0x4a3afd[_0xe037('0x42')]};if(!_0x20ea21[_0xe037('0x43')]){_0xa9359e[_0xe037('0x44')]=!![];}return _0x53c06e['update'](_0xa9359e);})[_0xe037('0x1b')](function(_0x201d1b){logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x3f'),util[_0xe037('0x2f')](_0x201d1b,{'showHidden':![],'depth':null}));});}else{logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x3f'),_0xe037('0x45'));}break;case _0xe037('0x46'):if(_0x20ea21['username']&&_0x20ea21[_0xe037('0x33')]){var _0x47a580={'messages':[{'source':_0xe037('0x47'),'to':_0x31311e['phone'],'body':_0x31311e[_0xe037('0x27')],'from':_0x20ea21[_0xe037('0x40')]||_0x20ea21[_0xe037('0x24')]}]};var _0x3e4298=util[_0xe037('0x48')]('%s:%s',_0x20ea21['username'],_0x20ea21[_0xe037('0x33')]);var _0x1555d8={'method':_0xe037('0x3b'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x47a580,'headers':{'Authorization':util['format'](_0xe037('0x49'),new Buffer(_0x3e4298)[_0xe037('0x4a')]('base64'))},'json':!![]};rp(_0x1555d8)[_0xe037('0x18')](function(_0x21d7ba){if(_0x21d7ba[_0xe037('0x4b')]>=0xc8&&_0x21d7ba[_0xe037('0x4b')]<=0xce){if(_0x21d7ba['data']&&_0x21d7ba['data'][_0xe037('0x4c')]>0x0){var _0x393fa7=_[_0xe037('0x4d')](_0x21d7ba[_0xe037('0x4e')]['messages']);var _0x245205={'messageId':_0x393fa7[_0xe037('0x4f')]};if(!_0x20ea21['deliveryReport']){_0x245205['read']=!![];}return _0x53c06e[_0xe037('0x19')](_0x245205);}else{logger['error'](_0xe037('0x2d'),_0xe037('0x2e'),'clickSend',util[_0xe037('0x2f')](_0x21d7ba,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xe037('0x2d'),'afterCreate','clickSend',util['inspect'](_0x21d7ba,{'showHidden':![],'depth':null}));}})[_0xe037('0x1b')](function(_0x93bd0f){logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x50'),util[_0xe037('0x2f')](_0x93bd0f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x50'),_0xe037('0x3e'));}break;case'plivo':if(_0x20ea21[_0xe037('0x51')]&&_0x20ea21[_0xe037('0x23')]){var _0x47a580={'dst':_0x31311e[_0xe037('0x24')],'text':_0x31311e['body'],'src':_0x20ea21[_0xe037('0x40')]||_0x20ea21[_0xe037('0x24')],'url':_0x20ea21[_0xe037('0x28')]+_0xe037('0x52')+_0x31311e['id']+_0xe037('0x29')+_0x20ea21[_0xe037('0x2a')]};var _0x3e4298=util[_0xe037('0x48')]('%s:%s',_0x20ea21['authId'],_0x20ea21[_0xe037('0x23')]);var _0x1555d8={'method':_0xe037('0x3b'),'uri':util[_0xe037('0x48')](_0xe037('0x53'),_0x20ea21[_0xe037('0x51')]),'body':_0x47a580,'headers':{'Authorization':util[_0xe037('0x48')]('Basic\x20%s',new Buffer(_0x3e4298)['toString'](_0xe037('0x54')))},'json':!![]};rp(_0x1555d8)['then'](function(_0x299027){var _0x57c2ec={'messageId':_0x299027['message_uuid'][0x0]};return _0x53c06e[_0xe037('0x19')](_0x57c2ec);})[_0xe037('0x1b')](function(_0x1a65f3){logger[_0xe037('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe037('0x2e'),_0xe037('0x55'),util[_0xe037('0x2f')](_0x1a65f3,{'showHidden':![],'depth':null}));});}else{logger[_0xe037('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe037('0x2e'),_0xe037('0x55'),_0xe037('0x56'));}break;case _0xe037('0x57'):if(_0x20ea21[_0xe037('0x37')]&&_0x20ea21[_0xe037('0x33')]){if(_0x20ea21['baseUrl']){var _0x241147={'method':_0xe037('0x3b'),'uri':_0x20ea21['baseUrl']+'/auth/1/session','body':{'username':_0x20ea21['username'],'password':_0x20ea21[_0xe037('0x33')]},'json':!![]};return rp(_0x241147)[_0xe037('0x18')](function(_0x63c208){var _0x420200={'method':_0xe037('0x3b'),'uri':_0x20ea21[_0xe037('0x58')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x20ea21[_0xe037('0x24')],'destinations':[{'to':_0x31311e[_0xe037('0x24')]}],'text':_0x31311e[_0xe037('0x27')],'notifyUrl':_0x20ea21[_0xe037('0x28')]+_0xe037('0x52')+_0x31311e['id']+'/status?token='+_0x20ea21[_0xe037('0x2a')],'notifyContentType':_0xe037('0x59'),'callbackData':_0x20ea21['phone']+';'+_0x31311e[_0xe037('0x27')]}]},'headers':{'Authorization':_0xe037('0x5a')+_0x63c208[_0xe037('0x2a')]},'json':!![]};return rp(_0x420200)[_0xe037('0x18')](function(_0x2ab1e0){if(_0x2ab1e0[_0xe037('0x25')]){var _0x4e0f5a={'messageId':_0x2ab1e0[_0xe037('0x25')][0x0][_0xe037('0xd')]};if(!_0x20ea21[_0xe037('0x43')]){_0x4e0f5a[_0xe037('0x44')]=!![];}return _0x53c06e[_0xe037('0x19')](_0x4e0f5a);}else{return logger[_0xe037('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe037('0x2e'),_0xe037('0x57'),util[_0xe037('0x2f')](_0x2ab1e0,{'showHidden':![],'depth':null}));}});})[_0xe037('0x1b')](function(_0x1dd607){return logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x57'),util['inspect'](_0x1dd607,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x57'),_0xe037('0x5b'));}}else{logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),'infobip',_0xe037('0x3e'));}break;case _0xe037('0x5c'):var _0x31113f=require(_0xe037('0x5d'));if(_0x20ea21[_0xe037('0x5e')]){var _0x5cbe9a={};_0x5cbe9a[_0xe037('0x5f')]=_0x20ea21[_0xe037('0x37')];_0x5cbe9a[_0xe037('0x24')]=_0x31311e['phone'];_0x5cbe9a[_0xe037('0x35')]=_0x20ea21[_0xe037('0x24')];_0x5cbe9a[_0xe037('0x60')]=_0x31311e[_0xe037('0x27')];_0x5cbe9a[_0xe037('0x61')]=+new Date();var _0x5a3e1b='';var _0xc81c2a='';var _0x576990=Object[_0xe037('0x62')](_0x5cbe9a);_0x576990[_0xe037('0x63')]();for(var _0x2ebb2e=0x0;_0x2ebb2e<_0x576990[_0xe037('0x64')];_0x2ebb2e++){if(_0x5a3e1b!=''){_0x5a3e1b+='&';}_0x5a3e1b+=_0x576990[_0x2ebb2e]+'='+encodeURIComponent(_0x5cbe9a[_0x576990[_0x2ebb2e]]);_0xc81c2a+=_0x5cbe9a[_0x576990[_0x2ebb2e]];}_0xc81c2a+=_0x20ea21[_0xe037('0x5e')];_0xc81c2a=_0x31113f[_0xe037('0x65')]('md5')[_0xe037('0x19')](_0xc81c2a)['digest'](_0xe037('0x66'));if(_0x5a3e1b!==''){_0x5a3e1b+='&';}_0x5a3e1b+='signature='+_0xc81c2a;var _0xa889ff={'method':_0xe037('0x38'),'uri':_0x20ea21['baseUrl']+_0xe037('0x67')+_0x5a3e1b,'json':!![]};return rp(_0xa889ff)[_0xe037('0x18')](function(_0x1ad596){var _0x4c197a=Object[_0xe037('0x62')](_0x1ad596);if(_0x1ad596[_0x4c197a[0x0]][_0xe037('0x2c')]&&parseInt(_0x1ad596[_0x4c197a[0x0]]['error'])===0x0){var _0x32c518={'messageId':_0x1ad596[_0x4c197a[0x0]]['id_sms']};if(!_0x20ea21['deliveryReport']){_0x32c518[_0xe037('0x44')]=!![];}return _0x53c06e[_0xe037('0x19')](_0x32c518);}else{return logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x5c'),util[_0xe037('0x2f')](_0x1ad596['error'],{'showHidden':![],'depth':null}));}})[_0xe037('0x1b')](function(_0x1b7bb9){return logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),'csc',util[_0xe037('0x2f')](_0x1b7bb9,{'showHidden':![],'depth':null}));});}else{logger[_0xe037('0x2c')](_0xe037('0x2d'),'afterCreate','csc',_0xe037('0x68'));}break;case _0xe037('0x69'):if(_0x20ea21[_0xe037('0x5e')]){var _0x5d0ffd={'method':'POST','uri':_0xe037('0x6a'),'headers':{'Authorization':_0x20ea21[_0xe037('0x5e')]},'body':{'content':_0x31311e[_0xe037('0x27')],'to':[_0x31311e[_0xe037('0x24')]],'from':_0x20ea21[_0xe037('0x24')],'binary':![],'clientMessageId':_0xe037('0x6b'),'charset':_0xe037('0x6c')},'json':!![]};rp(_0x5d0ffd)[_0xe037('0x18')](function(_0x14ddb3){if(!_0x14ddb3[_0xe037('0x2c')]){var _0x22594d={'messageId':_0x14ddb3[_0xe037('0x25')][0x0]['apiMessageId']};if(!_0x20ea21['deliveryReport']){_0x22594d[_0xe037('0x44')]=!![];}return _0x53c06e['update'](_0x22594d);}else{return logger[_0xe037('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe037('0x2e'),_0xe037('0x69'),util[_0xe037('0x2f')](_0x14ddb3[_0xe037('0x2c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3473a8){return logger['error'](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x69'),util[_0xe037('0x2f')](_0x3473a8,{'showHidden':![],'depth':null}));});}else{logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),_0xe037('0x69'),_0xe037('0x68'));}break;case _0xe037('0x6d'):if(_0x20ea21[_0xe037('0x5e')]){var _0x52dec4={};var _0xa889ff={'method':_0xe037('0x3b'),'uri':_0xe037('0x6e'),'headers':{'Authorization':_0xe037('0x6f')+_0x20ea21[_0xe037('0x5e')],'Content-Type':_0xe037('0x59')},'body':{'from':_0x20ea21[_0xe037('0x24')],'to':_0x31311e[_0xe037('0x24')],'text':_0x31311e[_0xe037('0x27')]},'json':!![]};return rp(_0xa889ff)[_0xe037('0x18')](function(_0x5a700d){if(_0x5a700d[_0xe037('0x70')]==0xca){_0x52dec4['message']=_0x5a700d;var _0xfdd280={'method':_0xe037('0x3b'),'uri':_0xe037('0x71'),'headers':{'Authorization':_0xe037('0x6f')+_0x20ea21[_0xe037('0x5e')],'Content-Type':_0xe037('0x59')},'body':{'refid':_0x52dec4['message']['refid']},'json':!![]};return rp(_0xfdd280)[_0xe037('0x18')](function(_0x1b8779){_0x52dec4[_0xe037('0x72')]=_0x1b8779;var _0x41b604={'messageId':_0x52dec4[_0xe037('0x73')][_0xe037('0x74')],'read':!![]};return _0x53c06e[_0xe037('0x19')](_0x41b604);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe037('0x2e'),_0xe037('0x6d'),util[_0xe037('0x2f')](_0x5a700d,{'showHidden':![],'depth':null}));}})[_0xe037('0x1b')](function(_0x381ad9){return logger[_0xe037('0x2c')](_0xe037('0x2d'),'afterCreate','intelepeer',util[_0xe037('0x2f')](_0x381ad9,{'showHidden':![],'depth':null}));});}else{return logger[_0xe037('0x2c')](_0xe037('0x2d'),_0xe037('0x2e'),'intelepeer',_0xe037('0x75'));}break;}}})[_0xe037('0x76')](function(){_0x30652f();});}else{_0x30652f();}}},'charset':_0xe037('0x77'),'collate':_0xe037('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 56bc3d7..b23d474 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 _0x757a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','info','catch','CreateSmsMessage','SmsMessage','create','body','raw','debug','stringify','util','moment'];(function(_0x332c32,_0x4c9ffb){var _0x2e4f35=function(_0x1ab3a9){while(--_0x1ab3a9){_0x332c32['push'](_0x332c32['shift']());}};_0x2e4f35(++_0x4c9ffb);}(_0x757a,0xde));var _0xa757=function(_0x4dfc58,_0x90aad8){_0x4dfc58=_0x4dfc58-0x0;var _0xb5c320=_0x757a[_0x4dfc58];return _0xb5c320;};'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});config[_0xa757('0x9')]=_['defaults'](config[_0xa757('0x9')],{'host':_0xa757('0xa'),'port':0x18eb});var socket=require(_0xa757('0xb'))(new Redis(config[_0xa757('0x9')]));require(_0xa757('0xc'))['register'](socket);function respondWithRpcPromise(_0x89c630,_0x2ca96f,_0x32f0ec){return new BPromise(function(_0x3e2c9a,_0xb7610b){return client[_0xa757('0xd')](_0x89c630,_0x32f0ec)[_0xa757('0xe')](function(_0x483d77){logger['info']('SmsMessage,\x20%s,\x20%s',_0x2ca96f,'request\x20sent');logger['debug'](_0xa757('0xf'),_0x2ca96f,'request\x20sent',JSON['stringify'](_0x483d77));if(_0x483d77[_0xa757('0x10')]){if(_0x483d77['error']['code']===0x1f4){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0xb7610b(_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);}logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0x3e2c9a(_0x483d77['error'][_0xa757('0x12')]);}else{logger[_0xa757('0x13')](_0xa757('0x11'),_0x2ca96f,'request\x20sent');_0x3e2c9a(_0x483d77['result'][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x1bd14c){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x1bd14c);_0xb7610b(_0x1bd14c);});});}exports[_0xa757('0x15')]=function(_0x4bd137){var _0x58954=this;return new Promise(function(_0x4fec52,_0x32c2a1){return db[_0xa757('0x16')][_0xa757('0x17')](_0x4bd137[_0xa757('0x18')],{'raw':_0x4bd137['options']?_0x4bd137['options'][_0xa757('0x19')]===undefined?!![]:![]:!![]})[_0xa757('0xe')](function(_0x2ba923){logger[_0xa757('0x13')](_0xa757('0x15'),_0x4bd137);logger[_0xa757('0x1a')](_0xa757('0x15'),_0x4bd137,JSON[_0xa757('0x1b')](_0x2ba923));_0x4fec52(_0x2ba923);})[_0xa757('0x14')](function(_0x59fae6){logger[_0xa757('0x10')]('CreateSmsMessage',_0x59fae6[_0xa757('0x12')],_0x4bd137);_0x32c2a1(_0x58954['error'](0x1f4,_0x59fae6[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0x8603=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','util','moment','bluebird'];(function(_0x5752ee,_0x2b4f71){var _0x542f87=function(_0x1360c1){while(--_0x1360c1){_0x5752ee['push'](_0x5752ee['shift']());}};_0x542f87(++_0x2b4f71);}(_0x8603,0x190));var _0x3860=function(_0x2f3238,_0x99ca05){_0x2f3238=_0x2f3238-0x0;var _0x509fb0=_0x8603[_0x2f3238];return _0x509fb0;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});config[_0x3860('0x9')]=_[_0x3860('0xa')](config[_0x3860('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3860('0xb'))[_0x3860('0xc')](socket);function respondWithRpcPromise(_0x52c277,_0x2fb169,_0x38737e){return new BPromise(function(_0x5909b8,_0x101263){return client[_0x3860('0xd')](_0x52c277,_0x38737e)['then'](function(_0x365579){logger[_0x3860('0xe')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x3860('0xf'));logger[_0x3860('0x10')](_0x3860('0x11'),_0x2fb169,_0x3860('0xf'),JSON[_0x3860('0x12')](_0x365579));if(_0x365579[_0x3860('0x13')]){if(_0x365579[_0x3860('0x13')][_0x3860('0x14')]===0x1f4){logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579['error'][_0x3860('0x16')]);return _0x101263(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579[_0x3860('0x13')][_0x3860('0x16')]);return _0x5909b8(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}else{logger[_0x3860('0xe')](_0x3860('0x15'),_0x2fb169,_0x3860('0xf'));_0x5909b8(_0x365579['result']['message']);}})[_0x3860('0x17')](function(_0x41ce59){logger[_0x3860('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x41ce59);_0x101263(_0x41ce59);});});}exports[_0x3860('0x18')]=function(_0x145b26){var _0x22e873=this;return new Promise(function(_0x3af33a,_0x20a5b0){return db[_0x3860('0x19')][_0x3860('0x1a')](_0x145b26[_0x3860('0x1b')],{'raw':_0x145b26[_0x3860('0x1c')]?_0x145b26[_0x3860('0x1c')][_0x3860('0x1d')]===undefined?!![]:![]:!![]})[_0x3860('0x1e')](function(_0x280ea9){logger[_0x3860('0xe')](_0x3860('0x18'),_0x145b26);logger['debug'](_0x3860('0x18'),_0x145b26,JSON[_0x3860('0x12')](_0x280ea9));_0x3af33a(_0x280ea9);})[_0x3860('0x17')](function(_0x301e03){logger[_0x3860('0x13')]('CreateSmsMessage',_0x301e03[_0x3860('0x16')],_0x145b26);_0x20a5b0(_0x22e873['error'](0x1f4,_0x301e03['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 4898c16..ea91968 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 _0x3682=['register','length','smsMessage:','./smsMessage.events','save','update'];(function(_0x435f71,_0x2ff13d){var _0x6811ae=function(_0x13bdf4){while(--_0x13bdf4){_0x435f71['push'](_0x435f71['shift']());}};_0x6811ae(++_0x2ff13d);}(_0x3682,0xb1));var _0x2368=function(_0x20412f,_0x32b502){_0x20412f=_0x20412f-0x0;var _0x16d840=_0x3682[_0x20412f];return _0x16d840;};'use strict';var SmsMessageEvents=require(_0x2368('0x0'));var events=[_0x2368('0x1'),'remove',_0x2368('0x2')];function createListener(_0x23cc56,_0x9c8f3){return function(_0x176fd0){_0x9c8f3['emit'](_0x23cc56,_0x176fd0);};}function removeListener(_0x3050f8,_0x4a2b1f){return function(){SmsMessageEvents['removeListener'](_0x3050f8,_0x4a2b1f);};}exports[_0x2368('0x3')]=function(_0x4c793e){for(var _0x994b55=0x0,_0x12444b=events[_0x2368('0x4')];_0x994b55<_0x12444b;_0x994b55++){var _0x45f2a0=events[_0x994b55];var _0x47d852=createListener(_0x2368('0x5')+_0x45f2a0,_0x4c793e);SmsMessageEvents['on'](_0x45f2a0,_0x47d852);}}; \ No newline at end of file +var _0xa5b1=['./smsMessage.events','save','update','emit','register','length'];(function(_0x79c912,_0x593f5d){var _0x5b0fb3=function(_0x1d28ea){while(--_0x1d28ea){_0x79c912['push'](_0x79c912['shift']());}};_0x5b0fb3(++_0x593f5d);}(_0xa5b1,0x1f2));var _0x1a5b=function(_0xed9c99,_0x2217b1){_0xed9c99=_0xed9c99-0x0;var _0x5443a1=_0xa5b1[_0xed9c99];return _0x5443a1;};'use strict';var SmsMessageEvents=require(_0x1a5b('0x0'));var events=[_0x1a5b('0x1'),'remove',_0x1a5b('0x2')];function createListener(_0x1e58bd,_0x1e0228){return function(_0x348a45){_0x1e0228[_0x1a5b('0x3')](_0x1e58bd,_0x348a45);};}function removeListener(_0x2f453b,_0x1a4c0f){return function(){SmsMessageEvents['removeListener'](_0x2f453b,_0x1a4c0f);};}exports[_0x1a5b('0x4')]=function(_0x25e3e2){for(var _0x5e7ba9=0x0,_0x1a665a=events[_0x1a5b('0x5')];_0x5e7ba9<_0x1a665a;_0x5e7ba9++){var _0x5ac1c5=events[_0x5e7ba9];var _0x262201=createListener('smsMessage:'+_0x5ac1c5,_0x25e3e2);SmsMessageEvents['on'](_0x5ac1c5,_0x262201);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 4ae34e2..c6720ed 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 _0x9829=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports'];(function(_0x1ff645,_0x3d461a){var _0x569648=function(_0x41a5d3){while(--_0x41a5d3){_0x1ff645['push'](_0x1ff645['shift']());}};_0x569648(++_0x3d461a);}(_0x9829,0xc4));var _0x9982=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x9829[_0x46efd7];return _0x5637e4;};'use strict';var multer=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var path=require(_0x9982('0x2'));var timeout=require(_0x9982('0x3'));var express=require(_0x9982('0x4'));var router=express['Router']();var auth=require(_0x9982('0x5'));var interaction=require(_0x9982('0x6'));var config=require(_0x9982('0x7'));var controller=require('./smsQueue.controller');router[_0x9982('0x8')]('/',auth[_0x9982('0x9')](),controller['index']);router['get'](_0x9982('0xa'),auth[_0x9982('0x9')](),controller['describe']);router[_0x9982('0x8')](_0x9982('0xb'),auth[_0x9982('0x9')](),controller[_0x9982('0xc')]);router[_0x9982('0x8')](_0x9982('0xd'),auth[_0x9982('0x9')](),controller[_0x9982('0xe')]);router[_0x9982('0x8')](_0x9982('0xf'),auth[_0x9982('0x9')](),controller[_0x9982('0x10')]);router[_0x9982('0x8')](_0x9982('0x11'),auth[_0x9982('0x9')](),controller[_0x9982('0x12')]);router[_0x9982('0x13')]('/',auth[_0x9982('0x9')](),controller['create']);router[_0x9982('0x13')](_0x9982('0xf'),auth['isAuthenticated'](),controller[_0x9982('0x14')]);router['post'](_0x9982('0x11'),auth[_0x9982('0x9')](),controller[_0x9982('0x15')]);router[_0x9982('0x16')](_0x9982('0xb'),auth[_0x9982('0x9')](),controller[_0x9982('0x17')]);router[_0x9982('0x18')](_0x9982('0xb'),auth['isAuthenticated'](),controller[_0x9982('0x19')]);router['delete'](_0x9982('0xf'),auth[_0x9982('0x9')](),controller['removeTeams']);router[_0x9982('0x18')](_0x9982('0x11'),auth[_0x9982('0x9')](),controller[_0x9982('0x1a')]);module[_0x9982('0x1b')]=router; \ No newline at end of file +var _0xad78=['addAgents','destroy','delete','removeTeams','removeAgents','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x3f3b4a,_0x5fe176){var _0x158c59=function(_0x527ae3){while(--_0x527ae3){_0x3f3b4a['push'](_0x3f3b4a['shift']());}};_0x158c59(++_0x5fe176);}(_0xad78,0x149));var _0x8ad7=function(_0x3f5c14,_0x2ccbce){_0x3f5c14=_0x3f5c14-0x0;var _0x219a4e=_0xad78[_0x3f5c14];return _0x219a4e;};'use strict';var multer=require(_0x8ad7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ad7('0x1'));var express=require(_0x8ad7('0x2'));var router=express['Router']();var auth=require(_0x8ad7('0x3'));var interaction=require(_0x8ad7('0x4'));var config=require(_0x8ad7('0x5'));var controller=require(_0x8ad7('0x6'));router[_0x8ad7('0x7')]('/',auth[_0x8ad7('0x8')](),controller[_0x8ad7('0x9')]);router[_0x8ad7('0x7')](_0x8ad7('0xa'),auth[_0x8ad7('0x8')](),controller['describe']);router['get'](_0x8ad7('0xb'),auth[_0x8ad7('0x8')](),controller[_0x8ad7('0xc')]);router[_0x8ad7('0x7')](_0x8ad7('0xd'),auth[_0x8ad7('0x8')](),controller[_0x8ad7('0xe')]);router['get'](_0x8ad7('0xf'),auth[_0x8ad7('0x8')](),controller[_0x8ad7('0x10')]);router['get'](_0x8ad7('0x11'),auth[_0x8ad7('0x8')](),controller[_0x8ad7('0x12')]);router[_0x8ad7('0x13')]('/',auth[_0x8ad7('0x8')](),controller[_0x8ad7('0x14')]);router[_0x8ad7('0x13')](_0x8ad7('0xf'),auth[_0x8ad7('0x8')](),controller[_0x8ad7('0x15')]);router[_0x8ad7('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x8ad7('0x16')]);router['put'](_0x8ad7('0xb'),auth[_0x8ad7('0x8')](),controller['update']);router['delete'](_0x8ad7('0xb'),auth[_0x8ad7('0x8')](),controller[_0x8ad7('0x17')]);router[_0x8ad7('0x18')](_0x8ad7('0xf'),auth[_0x8ad7('0x8')](),controller[_0x8ad7('0x19')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x8ad7('0x1a')]);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 dca822b..419722d 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 _0x258a=['STRING','name','rrmemory','roundrobin','sequelize','exports'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x258a,0xd6));var _0xa258=function(_0x4f5248,_0x1eeba7){_0x4f5248=_0x4f5248-0x0;var _0x7b9d33=_0x258a[_0x4f5248];return _0x7b9d33;};'use strict';var Sequelize=require(_0xa258('0x0'));module[_0xa258('0x1')]={'name':{'type':Sequelize[_0xa258('0x2')],'unique':_0xa258('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa258('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa258('0x4'),'beepall',_0xa258('0x5'))}}; \ No newline at end of file +var _0xf908=['name','INTEGER','ENUM','rrmemory','sequelize','exports','STRING'];(function(_0x39bf2e,_0x47b583){var _0x4fb4b5=function(_0x4a4295){while(--_0x4a4295){_0x39bf2e['push'](_0x39bf2e['shift']());}};_0x4fb4b5(++_0x47b583);}(_0xf908,0x1bd));var _0x8f90=function(_0x3fedd5,_0x4123a3){_0x3fedd5=_0x3fedd5-0x0;var _0x3b602e=_0xf908[_0x3fedd5];return _0x3b602e;};'use strict';var Sequelize=require(_0x8f90('0x0'));module[_0x8f90('0x1')]={'name':{'type':Sequelize[_0x8f90('0x2')],'unique':_0x8f90('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8f90('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f90('0x5')](_0x8f90('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index bb97c3e..b695122 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 _0x87f0=['VIRTUAL','includeAll','catch','show','params','keys','rawAttributes','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','nolimit','SmsQueueId','UserSmsQueue','findAll','UserId','agent','smsPause','createdAt','rows','format','updatedAt','Team','getTeams','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','isArray','findOne','getAgents','html-pdf','rimraf','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','SmsQueue','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge'];(function(_0x3d3a8a,_0x1a8661){var _0x248e3e=function(_0x41df27){while(--_0x41df27){_0x3d3a8a['push'](_0x3d3a8a['shift']());}};_0x248e3e(++_0x1a8661);}(_0x87f0,0x1dc));var _0x087f=function(_0x5df2b1,_0x320cfd){_0x5df2b1=_0x5df2b1-0x0;var _0x9a0042=_0x87f0[_0x5df2b1];return _0x9a0042;};'use strict';var pdf=require(_0x087f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x087f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x087f('0x2'));var BPromise=require(_0x087f('0x3'));var Mustache=require(_0x087f('0x4'));var util=require(_0x087f('0x5'));var path=require(_0x087f('0x6'));var sox=require(_0x087f('0x7'));var csv=require('to-csv');var ejs=require(_0x087f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x087f('0x9'));var crypto=require(_0x087f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x087f('0xb'));var Papa=require(_0x087f('0xc'));var Redis=require(_0x087f('0xd'));var authService=require(_0x087f('0xe'));var qs=require(_0x087f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x087f('0x10'));var logger=require(_0x087f('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x087f('0x12'));var db=require(_0x087f('0x13'))['db'];config[_0x087f('0x14')]=_[_0x087f('0x15')](config[_0x087f('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x087f('0x16'))(new Redis(config[_0x087f('0x14')]));require(_0x087f('0x17'))['register'](socket);function respondWithStatusCode(_0x29f539,_0x4c415c){_0x4c415c=_0x4c415c||0xcc;return function(_0x502b77){if(_0x502b77){return _0x29f539[_0x087f('0x18')](_0x4c415c);}return _0x29f539['status'](_0x4c415c)[_0x087f('0x19')]();};}function respondWithResult(_0x4a3cc1,_0x1187e0){_0x1187e0=_0x1187e0||0xc8;return function(_0x5ce501){if(_0x5ce501){return _0x4a3cc1[_0x087f('0x1a')](_0x1187e0)[_0x087f('0x1b')](_0x5ce501);}};}function respondWithFilteredResult(_0x2a310d,_0x2c111f){return function(_0x13b174){if(_0x13b174){var _0x56d473=_0x13b174[_0x087f('0x1c')],_0x99a99e=_0x2c111f[_0x087f('0x1d')],_0x1f85ad=_0x2c111f[_0x087f('0x1d')]+_0x2c111f[_0x087f('0x1e')],_0x3d4860;if(_0x1f85ad>=_0x56d473){_0x1f85ad=_0x56d473;_0x3d4860=0xc8;}else{_0x3d4860=0xce;}_0x2a310d['status'](_0x3d4860);return _0x2a310d[_0x087f('0x1f')]('Content-Range',_0x99a99e+'-'+_0x1f85ad+'/'+_0x56d473)[_0x087f('0x1b')](_0x13b174);}return null;};}function patchUpdates(_0x10dadb){return function(_0x2afb4b){try{jsonpatch[_0x087f('0x20')](_0x2afb4b,_0x10dadb,!![]);}catch(_0x543a6b){return BPromise['reject'](_0x543a6b);}return _0x2afb4b[_0x087f('0x21')]();};}function saveUpdates(_0x47cabd,_0x2c40d3){return function(_0x456be1){if(_0x456be1){return _0x456be1[_0x087f('0x22')](_0x47cabd)[_0x087f('0x23')](function(_0x511149){return _0x511149;});}return null;};}function removeEntity(_0x4908be,_0x44354f){return function(_0x4a5992){if(_0x4a5992){return _0x4a5992[_0x087f('0x24')]()[_0x087f('0x23')](function(){var _0x29d8fc=_0x4a5992[_0x087f('0x25')]({'plain':!![]});var _0x30bd4a='SmsQueues';return db[_0x087f('0x26')][_0x087f('0x24')]({'where':{'type':_0x30bd4a,'resourceId':_0x29d8fc['id']}})[_0x087f('0x23')](function(){return _0x4a5992;});})['then'](function(){_0x4908be['status'](0xcc)[_0x087f('0x19')]();});}};}function handleEntityNotFound(_0x3e1994,_0x40a882){return function(_0x3906d3){if(!_0x3906d3){_0x3e1994[_0x087f('0x18')](0x194);}return _0x3906d3;};}function handleError(_0x5b5f1b,_0x3bf47e){_0x3bf47e=_0x3bf47e||0x1f4;return function(_0x3003b9){logger[_0x087f('0x27')](_0x3003b9['stack']);if(_0x3003b9[_0x087f('0x28')]){delete _0x3003b9[_0x087f('0x28')];}_0x5b5f1b[_0x087f('0x1a')](_0x3bf47e)[_0x087f('0x29')](_0x3003b9);};}exports[_0x087f('0x2a')]=function(_0x3335a2,_0x179061){var _0x536050={},_0x5c9abc={},_0x46eebf={'count':0x0,'rows':[]};var _0x59e6cf=_[_0x087f('0x2b')](db[_0x087f('0x2c')]['rawAttributes'],function(_0x2e028b){return{'name':_0x2e028b['fieldName'],'type':_0x2e028b['type'][_0x087f('0x2d')]};});_0x5c9abc['model']=_[_0x087f('0x2b')](_0x59e6cf,_0x087f('0x28'));_0x5c9abc[_0x087f('0x2e')]=_['keys'](_0x3335a2[_0x087f('0x2e')]);_0x5c9abc[_0x087f('0x2f')]=_[_0x087f('0x30')](_0x5c9abc['model'],_0x5c9abc[_0x087f('0x2e')]);_0x536050[_0x087f('0x31')]=_[_0x087f('0x30')](_0x5c9abc[_0x087f('0x32')],qs[_0x087f('0x33')](_0x3335a2[_0x087f('0x2e')][_0x087f('0x33')]));_0x536050[_0x087f('0x31')]=_0x536050[_0x087f('0x31')][_0x087f('0x34')]?_0x536050['attributes']:_0x5c9abc[_0x087f('0x32')];if(!_0x3335a2[_0x087f('0x2e')][_0x087f('0x35')]('nolimit')){_0x536050[_0x087f('0x1e')]=qs[_0x087f('0x1e')](_0x3335a2['query'][_0x087f('0x1e')]);_0x536050[_0x087f('0x1d')]=qs[_0x087f('0x1d')](_0x3335a2[_0x087f('0x2e')][_0x087f('0x1d')]);}_0x536050[_0x087f('0x36')]=qs[_0x087f('0x37')](_0x3335a2['query'][_0x087f('0x37')]);_0x536050['where']=qs['filters'](_[_0x087f('0x38')](_0x3335a2['query'],_0x5c9abc['filters']),_0x59e6cf);if(_0x3335a2[_0x087f('0x2e')][_0x087f('0x39')]){_0x536050[_0x087f('0x3a')]=_[_0x087f('0x3b')](_0x536050[_0x087f('0x3a')],{'$or':_[_0x087f('0x2b')](_0x59e6cf,function(_0x15765b){if(_0x15765b['type']!==_0x087f('0x3c')){var _0x12d794={};_0x12d794[_0x15765b['name']]={'$like':'%'+_0x3335a2[_0x087f('0x2e')][_0x087f('0x39')]+'%'};return _0x12d794;}})});}_0x536050=_[_0x087f('0x3b')]({},_0x536050,_0x3335a2['options']);var _0x32b56b={'where':_0x536050['where']};return db[_0x087f('0x2c')][_0x087f('0x1c')](_0x32b56b)['then'](function(_0x5e35a7){_0x46eebf[_0x087f('0x1c')]=_0x5e35a7;if(_0x3335a2[_0x087f('0x2e')][_0x087f('0x3d')]){_0x536050['include']=[{'all':!![]}];}return db[_0x087f('0x2c')]['findAll'](_0x536050);})[_0x087f('0x23')](function(_0x289d4e){_0x46eebf['rows']=_0x289d4e;return _0x46eebf;})[_0x087f('0x23')](respondWithFilteredResult(_0x179061,_0x536050))[_0x087f('0x3e')](handleError(_0x179061,null));};exports[_0x087f('0x3f')]=function(_0x4bca1b,_0x25107e){var _0x29e987={'raw':!![],'where':{'id':_0x4bca1b[_0x087f('0x40')]['id']}},_0x380428={};_0x380428[_0x087f('0x32')]=_[_0x087f('0x41')](db[_0x087f('0x2c')][_0x087f('0x42')]);_0x380428[_0x087f('0x2e')]=_[_0x087f('0x41')](_0x4bca1b[_0x087f('0x2e')]);_0x380428[_0x087f('0x2f')]=_[_0x087f('0x30')](_0x380428['model'],_0x380428['query']);_0x29e987[_0x087f('0x31')]=_[_0x087f('0x30')](_0x380428[_0x087f('0x32')],qs[_0x087f('0x33')](_0x4bca1b[_0x087f('0x2e')][_0x087f('0x33')]));_0x29e987[_0x087f('0x31')]=_0x29e987[_0x087f('0x31')][_0x087f('0x34')]?_0x29e987[_0x087f('0x31')]:_0x380428[_0x087f('0x32')];if(_0x4bca1b['query'][_0x087f('0x3d')]){_0x29e987[_0x087f('0x43')]=[{'all':!![]}];}_0x29e987=_[_0x087f('0x3b')]({},_0x29e987,_0x4bca1b[_0x087f('0x44')]);return db['SmsQueue'][_0x087f('0x45')](_0x29e987)['then'](handleEntityNotFound(_0x25107e,null))[_0x087f('0x23')](respondWithResult(_0x25107e,null))[_0x087f('0x3e')](handleError(_0x25107e,null));};exports[_0x087f('0x46')]=function(_0x586cb7,_0x3d3c0e){return db[_0x087f('0x2c')]['create'](_0x586cb7[_0x087f('0x47')],{})['then'](function(_0xdc22c4){var _0x2a5e64=_0x586cb7['user'][_0x087f('0x25')]({'plain':!![]});if(!_0x2a5e64)throw new Error(_0x087f('0x48'));if(_0x2a5e64[_0x087f('0x49')]===_0x087f('0x4a')){var _0x24b9d0=_0xdc22c4[_0x087f('0x25')]({'plain':!![]});var _0x33850f=_0x087f('0x4b');return db[_0x087f('0x4c')][_0x087f('0x45')]({'where':{'name':_0x33850f,'userProfileId':_0x2a5e64['userProfileId']},'raw':!![]})['then'](function(_0x23598f){if(_0x23598f&&_0x23598f[_0x087f('0x4d')]===0x0){return db[_0x087f('0x26')][_0x087f('0x46')]({'name':_0x24b9d0[_0x087f('0x28')],'resourceId':_0x24b9d0['id'],'type':_0x23598f[_0x087f('0x28')],'sectionId':_0x23598f['id']},{})['then'](function(){return _0xdc22c4;});}else{return _0xdc22c4;}})['catch'](function(_0x2db26f){logger[_0x087f('0x27')](_0x087f('0x4e'),_0x2db26f);throw _0x2db26f;});}return _0xdc22c4;})['then'](respondWithResult(_0x3d3c0e,0xc9))[_0x087f('0x3e')](handleError(_0x3d3c0e,null));};exports[_0x087f('0x22')]=function(_0x23baec,_0xf88e6b){if(_0x23baec[_0x087f('0x47')]['id']){delete _0x23baec[_0x087f('0x47')]['id'];}return db['SmsQueue'][_0x087f('0x45')]({'where':{'id':_0x23baec['params']['id']}})['then'](handleEntityNotFound(_0xf88e6b,null))[_0x087f('0x23')](saveUpdates(_0x23baec[_0x087f('0x47')],null))[_0x087f('0x23')](respondWithResult(_0xf88e6b,null))['catch'](handleError(_0xf88e6b,null));};exports[_0x087f('0x24')]=function(_0x194860,_0x5b8855){return db['SmsQueue'][_0x087f('0x45')]({'where':{'id':_0x194860[_0x087f('0x40')]['id']}})[_0x087f('0x23')](handleEntityNotFound(_0x5b8855,null))['then'](removeEntity(_0x5b8855,null))[_0x087f('0x3e')](handleError(_0x5b8855,null));};exports[_0x087f('0x4f')]=function(_0x11ad50,_0xf64563){return db[_0x087f('0x2c')][_0x087f('0x4f')]()[_0x087f('0x23')](respondWithResult(_0xf64563,null))[_0x087f('0x3e')](handleError(_0xf64563,null));};exports['getMembers']=function(_0x283e31,_0x180644,_0x3d4dd2){var _0x4fa1a8={'raw':!![],'where':{}},_0x1c66a3={},_0x54f999;return db[_0x087f('0x2c')]['findOne']({'where':{'id':_0x283e31[_0x087f('0x40')]['id']}})['then'](handleEntityNotFound(_0x180644,null))[_0x087f('0x23')](function(_0x3f9840){if(_0x3f9840){_0x54f999=_0x3f9840[_0x087f('0x25')]({'plain':!![]});_0x1c66a3['model']=_[_0x087f('0x41')](db['UserSmsQueue'][_0x087f('0x42')]);_0x1c66a3[_0x087f('0x2e')]=_[_0x087f('0x41')](_0x283e31['query']);_0x1c66a3[_0x087f('0x2f')]=_[_0x087f('0x30')](_0x1c66a3[_0x087f('0x32')],_0x1c66a3[_0x087f('0x2e')]);_0x4fa1a8['attributes']=_['intersection'](_0x1c66a3['model'],qs[_0x087f('0x33')](_0x283e31['query'][_0x087f('0x33')]));_0x4fa1a8[_0x087f('0x31')]=_0x4fa1a8[_0x087f('0x31')][_0x087f('0x34')]?_0x4fa1a8['attributes']:_0x1c66a3[_0x087f('0x32')];if(!_0x283e31[_0x087f('0x2e')][_0x087f('0x35')](_0x087f('0x50'))){_0x4fa1a8[_0x087f('0x1e')]=qs[_0x087f('0x1e')](_0x283e31['query'][_0x087f('0x1e')]);_0x4fa1a8[_0x087f('0x1d')]=qs[_0x087f('0x1d')](_0x283e31[_0x087f('0x2e')][_0x087f('0x1d')]);}_0x4fa1a8[_0x087f('0x36')]=qs[_0x087f('0x37')](_0x283e31['query'][_0x087f('0x37')]);_0x4fa1a8[_0x087f('0x3a')]=qs[_0x087f('0x2f')](_[_0x087f('0x38')](_0x283e31[_0x087f('0x2e')],_0x1c66a3[_0x087f('0x2f')]));_0x4fa1a8[_0x087f('0x3a')][_0x087f('0x51')]=_0x3f9840['id'];if(_0x283e31[_0x087f('0x2e')][_0x087f('0x39')]){_0x4fa1a8['where']=_[_0x087f('0x3b')](_0x4fa1a8[_0x087f('0x3a')],{'$or':_[_0x087f('0x2b')](_0x4fa1a8[_0x087f('0x31')],function(_0x5f4eb5){var _0x238788={};_0x238788[_0x5f4eb5]={'$like':'%'+_0x283e31['query'][_0x087f('0x39')]+'%'};return _0x238788;})});}_0x4fa1a8=_[_0x087f('0x3b')]({},_0x4fa1a8,_0x283e31['options']);return db[_0x087f('0x52')][_0x087f('0x53')](_0x4fa1a8);}})[_0x087f('0x23')](function(_0x3acdd4){if(_0x3acdd4){return db['User']['findAndCountAll']({'where':{'id':_[_0x087f('0x2b')](_0x3acdd4,_0x087f('0x54')),'role':_0x087f('0x55')},'attributes':['id',_0x087f('0x28'),_0x087f('0x56'),'updatedAt',_0x087f('0x57')]});}})[_0x087f('0x23')](function(_0x515f00){if(_0x515f00){return{'count':_0x515f00['count'],'rows':_[_0x087f('0x2b')](_0x515f00[_0x087f('0x58')],function(_0x2aa722){return{'membername':_0x2aa722[_0x087f('0x28')],'UserId':_0x2aa722['id'],'queue_name':_0x54f999[_0x087f('0x28')],'SmsQueueId':_0x54f999['id'],'interface':util[_0x087f('0x59')]('%s/%s','SIP',_0x2aa722[_0x087f('0x28')]),'penalty':0x0,'paused':_0x2aa722['smsPause'],'createdAt':_0x2aa722[_0x087f('0x57')],'updatedAt':_0x2aa722[_0x087f('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x180644,_0x4fa1a8))[_0x087f('0x3e')](handleError(_0x180644,null));};exports['getTeams']=function(_0x4a371c,_0x27d959,_0xc20c45){var _0x595872={};var _0x1743e0={};var _0x282d29;var _0x325dea;return db[_0x087f('0x2c')]['findOne']({'where':{'id':_0x4a371c[_0x087f('0x40')]['id']}})['then'](handleEntityNotFound(_0x27d959,null))[_0x087f('0x23')](function(_0x41eb42){if(_0x41eb42){_0x282d29=_0x41eb42;_0x1743e0[_0x087f('0x32')]=_[_0x087f('0x41')](db[_0x087f('0x5b')][_0x087f('0x42')]);_0x1743e0[_0x087f('0x2e')]=_[_0x087f('0x41')](_0x4a371c[_0x087f('0x2e')]);_0x1743e0[_0x087f('0x2f')]=_['intersection'](_0x1743e0['model'],_0x1743e0['query']);_0x595872['attributes']=_['intersection'](_0x1743e0['model'],qs[_0x087f('0x33')](_0x4a371c['query']['fields']));_0x595872[_0x087f('0x31')]=_0x595872[_0x087f('0x31')]['length']?_0x595872[_0x087f('0x31')]:_0x1743e0[_0x087f('0x32')];_0x595872['order']=qs['sort'](_0x4a371c['query'][_0x087f('0x37')]);_0x595872[_0x087f('0x3a')]=qs[_0x087f('0x2f')](_['pick'](_0x4a371c['query'],_0x1743e0[_0x087f('0x2f')]));if(_0x4a371c[_0x087f('0x2e')]['filter']){_0x595872[_0x087f('0x3a')]=_[_0x087f('0x3b')](_0x595872[_0x087f('0x3a')],{'$or':_[_0x087f('0x2b')](_0x595872[_0x087f('0x31')],function(_0x39b3dc){var _0x452c68={};_0x452c68[_0x39b3dc]={'$like':'%'+_0x4a371c[_0x087f('0x2e')][_0x087f('0x39')]+'%'};return _0x452c68;})});}_0x595872=_[_0x087f('0x3b')]({},_0x595872,_0x4a371c[_0x087f('0x44')]);return _0x282d29[_0x087f('0x5c')](_0x595872);}})['then'](function(_0x31f86a){if(_0x31f86a){_0x325dea=_0x31f86a[_0x087f('0x34')];if(!_0x4a371c[_0x087f('0x2e')][_0x087f('0x35')](_0x087f('0x50'))){_0x595872[_0x087f('0x1e')]=qs[_0x087f('0x1e')](_0x4a371c['query']['limit']);_0x595872[_0x087f('0x1d')]=qs['offset'](_0x4a371c[_0x087f('0x2e')][_0x087f('0x1d')]);}return _0x282d29[_0x087f('0x5c')](_0x595872);}})[_0x087f('0x23')](function(_0x12432f){if(_0x12432f){return _0x12432f?{'count':_0x325dea,'rows':_0x12432f}:null;}})[_0x087f('0x23')](respondWithResult(_0x27d959,null))[_0x087f('0x3e')](handleError(_0x27d959,null));};exports[_0x087f('0x5d')]=function(_0x947140,_0x1ae272,_0x3265f7){var _0x3dd03e=_0x947140[_0x087f('0x47')][_0x087f('0x5e')];return db['Team'][_0x087f('0x53')]({'where':{'id':_0x3dd03e},'attributes':['id'],'include':[{'model':db[_0x087f('0x5f')],'as':_0x087f('0x60'),'attributes':['id',_0x087f('0x28'),_0x087f('0x61'),'voicePause',_0x087f('0x62')],'raw':!![]}]})[_0x087f('0x23')](function(_0x2cfa43){if(_0x2cfa43){var _0x4158a2=_[_0x087f('0x63')](_0x2cfa43,function(_0x52625b){var _0x1e3643=_0x52625b[_0x087f('0x25')]({'plain':!![]});return _0x1e3643[_0x087f('0x60')];});return db[_0x087f('0x2c')]['find']({'where':{'id':_0x947140[_0x087f('0x40')]['id']}})[_0x087f('0x23')](function(_0x214bbc){return db[_0x087f('0x64')][_0x087f('0x65')](function(_0x53b58a){return _0x214bbc[_0x087f('0x5d')](_0x3dd03e,{'transaction':_0x53b58a})[_0x087f('0x23')](function(){return BPromise[_0x087f('0x66')](_0x4158a2,function(_0x3f4801){return db[_0x087f('0x52')][_0x087f('0x67')]({'where':{'UserId':_0x3f4801['id'],'SmsQueueId':_0x947140['params']['id']},'transaction':_0x53b58a});});})[_0x087f('0x23')](function(){_0x4158a2['forEach'](function(_0x13867c){socket[_0x087f('0x68')](_0x087f('0x69'),{'UserId':_0x13867c['id'],'SmsQueueId':_0x214bbc['id']});});});});});}})['then'](respondWithStatusCode(_0x1ae272,null))[_0x087f('0x3e')](handleError(_0x1ae272,null));};exports[_0x087f('0x6a')]=function(_0x37387f,_0x16f4c2,_0x51f66c){return db['Team']['findAll']({'where':{'id':_0x37387f['query'][_0x087f('0x5e')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x087f('0x23')](handleEntityNotFound(_0x16f4c2,null))[_0x087f('0x23')](function(_0x1a9cbe){var _0x2ca234=_[_0x087f('0x2b')](_0x1a9cbe,'id');var _0x3bf1dd=[];var _0x281157=[];var _0xfbe64=squel[_0x087f('0x6b')]();_0xfbe64[_0x087f('0x6c')](_0x087f('0x6d'))['from'](_0x087f('0x6e'),'tq')[_0x087f('0x6f')](_0x087f('0x70'),'ut',_0x087f('0x71'))[_0x087f('0x3a')](_0x087f('0x72'),_0x37387f[_0x087f('0x40')]['id']);for(var _0x520693=0x0;_0x520693<_0x1a9cbe[_0x087f('0x34')];_0x520693+=0x1){let _0xb4bfed=_0x1a9cbe[_0x520693];for(var _0x4e17a4=0x0;_0x4e17a4<_0xb4bfed[_0x087f('0x60')]['length'];_0x4e17a4+=0x1){let _0x2fb541=_0xb4bfed[_0x087f('0x60')][_0x4e17a4];var _0x1cfb21=_0xfbe64[_0x087f('0x73')]();_0x1cfb21[_0x087f('0x3a')](_0x087f('0x74'),_0x2fb541['id']);_0x281157[_0x087f('0x75')](db[_0x087f('0x64')][_0x087f('0x2e')](_0x1cfb21[_0x087f('0x76')](),{'type':db['sequelize']['QueryTypes'][_0x087f('0x77')]})[_0x087f('0x23')](function(_0xdd04af){if(_0xdd04af[_0x087f('0x34')]===0x1){return _0x2fb541['id'];}else{var _0x5774ab=_['every'](_[_0x087f('0x2b')](_0xdd04af,_0x087f('0x78')),function(_0x3f57b9){return _[_0x087f('0x79')](_0x2ca234,_0x3f57b9);});if(_0x5774ab){return _0x2fb541['id'];}}}));}}return BPromise[_0x087f('0x7a')](_0x281157)[_0x087f('0x23')](function(_0x137d57){_0x3bf1dd=_(_0x3bf1dd)[_0x087f('0x7b')](_0x137d57)['compact']()[_0x087f('0x7c')]();return db[_0x087f('0x2c')]['find']({'where':{'id':_0x37387f[_0x087f('0x40')]['id']}})[_0x087f('0x23')](function(_0x28c2ab){return db[_0x087f('0x64')]['transaction'](function(_0x54ab6f){return _0x28c2ab[_0x087f('0x6a')](_0x37387f[_0x087f('0x2e')]['ids'],{'transaction':_0x54ab6f})[_0x087f('0x23')](function(){if(!_[_0x087f('0x7d')](_0x3bf1dd)){return _0x28c2ab[_0x087f('0x7e')](_0x3bf1dd,{'transaction':_0x54ab6f});}})[_0x087f('0x23')](function(){_0x3bf1dd[_0x087f('0x7f')](function(_0x5b758c){socket['emit'](_0x087f('0x80'),{'UserId':_0x5b758c,'SmsQueueId':_0x28c2ab['id']});});});});});});})[_0x087f('0x23')](respondWithStatusCode(_0x16f4c2,null))[_0x087f('0x3e')](handleError(_0x16f4c2,null));};exports[_0x087f('0x81')]=function(_0x1812ea,_0x7a4f90,_0x57c2de){return db[_0x087f('0x2c')]['find']({'where':{'id':_0x1812ea[_0x087f('0x40')]['id']}})[_0x087f('0x23')](handleEntityNotFound(_0x7a4f90,null))[_0x087f('0x23')](function(_0xfd55a7){if(_0xfd55a7){return _0xfd55a7['addAgents'](_0x1812ea[_0x087f('0x47')]['ids'],_[_0x087f('0x82')](_0x1812ea['body'],[_0x087f('0x5e'),'id'])||{})['spread'](function(_0x235c9f){for(var _0xb1603c=0x0;_0xb1603c<_0x1812ea[_0x087f('0x47')]['ids'][_0x087f('0x34')];_0xb1603c+=0x1){socket['emit'](_0x087f('0x69'),{'UserId':_0x1812ea[_0x087f('0x47')][_0x087f('0x5e')][_0xb1603c],'SmsQueueId':_0x1812ea[_0x087f('0x40')]['id']});}return _0x235c9f;});}})[_0x087f('0x23')](respondWithResult(_0x7a4f90,null))[_0x087f('0x3e')](handleError(_0x7a4f90,null));};exports[_0x087f('0x7e')]=function(_0x2e1969,_0x39fe2b,_0x559afc){return db['SmsQueue'][_0x087f('0x45')]({'where':{'id':_0x2e1969[_0x087f('0x40')]['id']}})[_0x087f('0x23')](handleEntityNotFound(_0x39fe2b,null))['then'](function(_0x14f33e){if(_0x14f33e){return _0x14f33e[_0x087f('0x7e')](_0x2e1969[_0x087f('0x2e')][_0x087f('0x5e')])[_0x087f('0x23')](function(){if(_[_0x087f('0x83')](_0x2e1969[_0x087f('0x2e')]['ids'])){for(var _0x1faa77=0x0;_0x1faa77<_0x2e1969[_0x087f('0x2e')][_0x087f('0x5e')][_0x087f('0x34')];_0x1faa77+=0x1){socket[_0x087f('0x68')](_0x087f('0x80'),{'UserId':Number(_0x2e1969[_0x087f('0x2e')][_0x087f('0x5e')][_0x1faa77]),'SmsQueueId':Number(_0x2e1969[_0x087f('0x40')]['id'])});}}else{socket[_0x087f('0x68')](_0x087f('0x80'),{'UserId':Number(_0x2e1969[_0x087f('0x2e')][_0x087f('0x5e')]),'SmsQueueId':Number(_0x2e1969[_0x087f('0x40')]['id'])});}});}})[_0x087f('0x23')](respondWithStatusCode(_0x39fe2b,null))[_0x087f('0x3e')](handleError(_0x39fe2b,null));};exports['getAgents']=function(_0x546d3a,_0x332001,_0x2370a2){var _0x71f8cb={};var _0x651846={};var _0x4f3c4d;var _0x2e067d;return db['SmsQueue'][_0x087f('0x84')]({'where':{'id':_0x546d3a[_0x087f('0x40')]['id']}})[_0x087f('0x23')](handleEntityNotFound(_0x332001,null))[_0x087f('0x23')](function(_0x40bda9){if(_0x40bda9){_0x4f3c4d=_0x40bda9;_0x651846['model']=_[_0x087f('0x41')](db[_0x087f('0x5f')][_0x087f('0x42')]);_0x651846[_0x087f('0x2e')]=_[_0x087f('0x41')](_0x546d3a[_0x087f('0x2e')]);_0x651846[_0x087f('0x2f')]=_[_0x087f('0x30')](_0x651846[_0x087f('0x32')],_0x651846[_0x087f('0x2e')]);_0x71f8cb[_0x087f('0x31')]=_[_0x087f('0x30')](_0x651846['model'],qs[_0x087f('0x33')](_0x546d3a[_0x087f('0x2e')][_0x087f('0x33')]));_0x71f8cb[_0x087f('0x31')]=_0x71f8cb[_0x087f('0x31')][_0x087f('0x34')]?_0x71f8cb[_0x087f('0x31')]:_0x651846[_0x087f('0x32')];_0x71f8cb[_0x087f('0x36')]=qs[_0x087f('0x37')](_0x546d3a[_0x087f('0x2e')][_0x087f('0x37')]);_0x71f8cb[_0x087f('0x3a')]=qs[_0x087f('0x2f')](_[_0x087f('0x38')](_0x546d3a['query'],_0x651846[_0x087f('0x2f')]));if(_0x546d3a[_0x087f('0x2e')][_0x087f('0x39')]){_0x71f8cb['where']=_['merge'](_0x71f8cb[_0x087f('0x3a')],{'$or':_[_0x087f('0x2b')](_0x71f8cb[_0x087f('0x31')],function(_0x5cbbb7){var _0x10ded0={};_0x10ded0[_0x5cbbb7]={'$like':'%'+_0x546d3a[_0x087f('0x2e')][_0x087f('0x39')]+'%'};return _0x10ded0;})});}_0x71f8cb=_[_0x087f('0x3b')]({},_0x71f8cb,_0x546d3a[_0x087f('0x44')]);return _0x4f3c4d[_0x087f('0x85')](_0x71f8cb);}})['then'](function(_0x31ee33){if(_0x31ee33){_0x2e067d=_0x31ee33['length'];if(!_0x546d3a[_0x087f('0x2e')]['hasOwnProperty'](_0x087f('0x50'))){_0x71f8cb[_0x087f('0x1e')]=qs['limit'](_0x546d3a[_0x087f('0x2e')][_0x087f('0x1e')]);_0x71f8cb[_0x087f('0x1d')]=qs[_0x087f('0x1d')](_0x546d3a[_0x087f('0x2e')][_0x087f('0x1d')]);}return _0x4f3c4d[_0x087f('0x85')](_0x71f8cb);}})['then'](function(_0x20ec46){if(_0x20ec46){return _0x20ec46?{'count':_0x2e067d,'rows':_0x20ec46}:null;}})[_0x087f('0x23')](respondWithResult(_0x332001,null))['catch'](handleError(_0x332001,null));}; \ No newline at end of file +var _0x9119=['type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','SmsQueue','includeAll','include','findAll','rows','show','keys','rawAttributes','options','find','create','user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','User','findAndCountAll','agent','createdAt','format','%s/%s','SIP','smsPause','updatedAt','getTeams','addTeams','ids','Team','Agents','interface','flatMap','transaction','each','UserSmsQueue','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','TeamId','includes','all','compact','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','SmsQueues','UserProfileResource','error','stack','name','send','index','fieldName'];(function(_0x137fdc,_0x350ef5){var _0x4594b8=function(_0x3bc436){while(--_0x3bc436){_0x137fdc['push'](_0x137fdc['shift']());}};_0x4594b8(++_0x350ef5);}(_0x9119,0x16c));var _0x9911=function(_0x563413,_0x57fb7b){_0x563413=_0x563413-0x0;var _0x1cbb55=_0x9119[_0x563413];return _0x1cbb55;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9911('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9911('0x1'));var jsonpatch=require(_0x9911('0x2'));var rp=require(_0x9911('0x3'));var moment=require(_0x9911('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9911('0x5'));var util=require(_0x9911('0x6'));var path=require(_0x9911('0x7'));var sox=require(_0x9911('0x8'));var csv=require('to-csv');var ejs=require(_0x9911('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9911('0xa'));var crypto=require(_0x9911('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9911('0xc'));var Redis=require(_0x9911('0xd'));var authService=require(_0x9911('0xe'));var qs=require(_0x9911('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9911('0x10'));var logger=require(_0x9911('0x11'))(_0x9911('0x12'));var utils=require(_0x9911('0x13'));var config=require(_0x9911('0x14'));var db=require(_0x9911('0x15'))['db'];config[_0x9911('0x16')]=_[_0x9911('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9911('0x18'))[_0x9911('0x19')](socket);function respondWithStatusCode(_0x556cb9,_0x1e66ff){_0x1e66ff=_0x1e66ff||0xcc;return function(_0x463b47){if(_0x463b47){return _0x556cb9[_0x9911('0x1a')](_0x1e66ff);}return _0x556cb9[_0x9911('0x1b')](_0x1e66ff)[_0x9911('0x1c')]();};}function respondWithResult(_0x34218e,_0x52022f){_0x52022f=_0x52022f||0xc8;return function(_0x3d184f){if(_0x3d184f){return _0x34218e['status'](_0x52022f)[_0x9911('0x1d')](_0x3d184f);}};}function respondWithFilteredResult(_0x1b0fd8,_0x848b8a){return function(_0x4eb456){if(_0x4eb456){var _0x2b3fc5=_0x4eb456[_0x9911('0x1e')],_0x5630bb=_0x848b8a[_0x9911('0x1f')],_0x15817e=_0x848b8a[_0x9911('0x1f')]+_0x848b8a[_0x9911('0x20')],_0x58b1ee;if(_0x15817e>=_0x2b3fc5){_0x15817e=_0x2b3fc5;_0x58b1ee=0xc8;}else{_0x58b1ee=0xce;}_0x1b0fd8[_0x9911('0x1b')](_0x58b1ee);return _0x1b0fd8[_0x9911('0x21')](_0x9911('0x22'),_0x5630bb+'-'+_0x15817e+'/'+_0x2b3fc5)[_0x9911('0x1d')](_0x4eb456);}return null;};}function patchUpdates(_0x5177a4){return function(_0x4834a2){try{jsonpatch[_0x9911('0x23')](_0x4834a2,_0x5177a4,!![]);}catch(_0x1513db){return BPromise[_0x9911('0x24')](_0x1513db);}return _0x4834a2[_0x9911('0x25')]();};}function saveUpdates(_0x4ffc7d,_0x115776){return function(_0x50bd6c){if(_0x50bd6c){return _0x50bd6c[_0x9911('0x26')](_0x4ffc7d)['then'](function(_0x4c59e5){return _0x4c59e5;});}return null;};}function removeEntity(_0x2b843c,_0x4114d4){return function(_0x14cc00){if(_0x14cc00){return _0x14cc00[_0x9911('0x27')]()[_0x9911('0x28')](function(){var _0x1e744b=_0x14cc00[_0x9911('0x29')]({'plain':!![]});var _0x2cefdb=_0x9911('0x2a');return db[_0x9911('0x2b')][_0x9911('0x27')]({'where':{'type':_0x2cefdb,'resourceId':_0x1e744b['id']}})[_0x9911('0x28')](function(){return _0x14cc00;});})[_0x9911('0x28')](function(){_0x2b843c['status'](0xcc)[_0x9911('0x1c')]();});}};}function handleEntityNotFound(_0x387e53,_0x392dd4){return function(_0x5aa9d6){if(!_0x5aa9d6){_0x387e53[_0x9911('0x1a')](0x194);}return _0x5aa9d6;};}function handleError(_0x1980d1,_0x5d9ed8){_0x5d9ed8=_0x5d9ed8||0x1f4;return function(_0x35a9cc){logger[_0x9911('0x2c')](_0x35a9cc[_0x9911('0x2d')]);if(_0x35a9cc['name']){delete _0x35a9cc[_0x9911('0x2e')];}_0x1980d1[_0x9911('0x1b')](_0x5d9ed8)[_0x9911('0x2f')](_0x35a9cc);};}exports[_0x9911('0x30')]=function(_0xc1a71a,_0x1dbffd){var _0x5c805c={},_0x354892={},_0x325e06={'count':0x0,'rows':[]};var _0x156f5d=_['map'](db['SmsQueue']['rawAttributes'],function(_0x713181){return{'name':_0x713181[_0x9911('0x31')],'type':_0x713181[_0x9911('0x32')][_0x9911('0x33')]};});_0x354892[_0x9911('0x34')]=_[_0x9911('0x35')](_0x156f5d,_0x9911('0x2e'));_0x354892[_0x9911('0x36')]=_['keys'](_0xc1a71a[_0x9911('0x36')]);_0x354892[_0x9911('0x37')]=_[_0x9911('0x38')](_0x354892['model'],_0x354892['query']);_0x5c805c[_0x9911('0x39')]=_[_0x9911('0x38')](_0x354892[_0x9911('0x34')],qs[_0x9911('0x3a')](_0xc1a71a[_0x9911('0x36')]['fields']));_0x5c805c[_0x9911('0x39')]=_0x5c805c[_0x9911('0x39')][_0x9911('0x3b')]?_0x5c805c[_0x9911('0x39')]:_0x354892[_0x9911('0x34')];if(!_0xc1a71a[_0x9911('0x36')][_0x9911('0x3c')](_0x9911('0x3d'))){_0x5c805c[_0x9911('0x20')]=qs[_0x9911('0x20')](_0xc1a71a[_0x9911('0x36')][_0x9911('0x20')]);_0x5c805c[_0x9911('0x1f')]=qs['offset'](_0xc1a71a[_0x9911('0x36')]['offset']);}_0x5c805c[_0x9911('0x3e')]=qs[_0x9911('0x3f')](_0xc1a71a[_0x9911('0x36')][_0x9911('0x3f')]);_0x5c805c[_0x9911('0x40')]=qs['filters'](_[_0x9911('0x41')](_0xc1a71a[_0x9911('0x36')],_0x354892[_0x9911('0x37')]),_0x156f5d);if(_0xc1a71a['query'][_0x9911('0x42')]){_0x5c805c['where']=_['merge'](_0x5c805c[_0x9911('0x40')],{'$or':_[_0x9911('0x35')](_0x156f5d,function(_0x2dfd5b){if(_0x2dfd5b[_0x9911('0x32')]!==_0x9911('0x43')){var _0x36960e={};_0x36960e[_0x2dfd5b['name']]={'$like':'%'+_0xc1a71a['query'][_0x9911('0x42')]+'%'};return _0x36960e;}})});}_0x5c805c=_[_0x9911('0x44')]({},_0x5c805c,_0xc1a71a['options']);var _0x2f6592={'where':_0x5c805c['where']};return db[_0x9911('0x45')][_0x9911('0x1e')](_0x2f6592)[_0x9911('0x28')](function(_0xe1f159){_0x325e06[_0x9911('0x1e')]=_0xe1f159;if(_0xc1a71a[_0x9911('0x36')][_0x9911('0x46')]){_0x5c805c[_0x9911('0x47')]=[{'all':!![]}];}return db[_0x9911('0x45')][_0x9911('0x48')](_0x5c805c);})[_0x9911('0x28')](function(_0x2fe401){_0x325e06[_0x9911('0x49')]=_0x2fe401;return _0x325e06;})[_0x9911('0x28')](respondWithFilteredResult(_0x1dbffd,_0x5c805c))['catch'](handleError(_0x1dbffd,null));};exports[_0x9911('0x4a')]=function(_0x16b0b7,_0x5639c2){var _0x2eca62={'raw':!![],'where':{'id':_0x16b0b7['params']['id']}},_0x1ed777={};_0x1ed777[_0x9911('0x34')]=_[_0x9911('0x4b')](db[_0x9911('0x45')][_0x9911('0x4c')]);_0x1ed777[_0x9911('0x36')]=_['keys'](_0x16b0b7[_0x9911('0x36')]);_0x1ed777[_0x9911('0x37')]=_[_0x9911('0x38')](_0x1ed777[_0x9911('0x34')],_0x1ed777['query']);_0x2eca62[_0x9911('0x39')]=_[_0x9911('0x38')](_0x1ed777[_0x9911('0x34')],qs[_0x9911('0x3a')](_0x16b0b7[_0x9911('0x36')][_0x9911('0x3a')]));_0x2eca62[_0x9911('0x39')]=_0x2eca62[_0x9911('0x39')][_0x9911('0x3b')]?_0x2eca62[_0x9911('0x39')]:_0x1ed777[_0x9911('0x34')];if(_0x16b0b7[_0x9911('0x36')]['includeAll']){_0x2eca62[_0x9911('0x47')]=[{'all':!![]}];}_0x2eca62=_['merge']({},_0x2eca62,_0x16b0b7[_0x9911('0x4d')]);return db[_0x9911('0x45')][_0x9911('0x4e')](_0x2eca62)[_0x9911('0x28')](handleEntityNotFound(_0x5639c2,null))[_0x9911('0x28')](respondWithResult(_0x5639c2,null))['catch'](handleError(_0x5639c2,null));};exports[_0x9911('0x4f')]=function(_0x53e404,_0x375e9e){return db[_0x9911('0x45')][_0x9911('0x4f')](_0x53e404['body'],{})['then'](function(_0x22d4fd){var _0x918612=_0x53e404[_0x9911('0x50')]['get']({'plain':!![]});if(!_0x918612)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x918612[_0x9911('0x51')]==='user'){var _0x4acaf4=_0x22d4fd['get']({'plain':!![]});var _0x55c422=_0x9911('0x2a');return db['UserProfileSection'][_0x9911('0x4e')]({'where':{'name':_0x55c422,'userProfileId':_0x918612[_0x9911('0x52')]},'raw':!![]})[_0x9911('0x28')](function(_0x32c135){if(_0x32c135&&_0x32c135[_0x9911('0x53')]===0x0){return db['UserProfileResource'][_0x9911('0x4f')]({'name':_0x4acaf4[_0x9911('0x2e')],'resourceId':_0x4acaf4['id'],'type':_0x32c135[_0x9911('0x2e')],'sectionId':_0x32c135['id']},{})['then'](function(){return _0x22d4fd;});}else{return _0x22d4fd;}})[_0x9911('0x54')](function(_0x217ef8){logger[_0x9911('0x2c')](_0x9911('0x55'),_0x217ef8);throw _0x217ef8;});}return _0x22d4fd;})['then'](respondWithResult(_0x375e9e,0xc9))[_0x9911('0x54')](handleError(_0x375e9e,null));};exports['update']=function(_0x5dbdfc,_0x48603a){if(_0x5dbdfc[_0x9911('0x56')]['id']){delete _0x5dbdfc[_0x9911('0x56')]['id'];}return db[_0x9911('0x45')]['find']({'where':{'id':_0x5dbdfc[_0x9911('0x57')]['id']}})[_0x9911('0x28')](handleEntityNotFound(_0x48603a,null))['then'](saveUpdates(_0x5dbdfc[_0x9911('0x56')],null))[_0x9911('0x28')](respondWithResult(_0x48603a,null))[_0x9911('0x54')](handleError(_0x48603a,null));};exports[_0x9911('0x27')]=function(_0x4076d7,_0x52c49c){return db[_0x9911('0x45')][_0x9911('0x4e')]({'where':{'id':_0x4076d7[_0x9911('0x57')]['id']}})[_0x9911('0x28')](handleEntityNotFound(_0x52c49c,null))[_0x9911('0x28')](removeEntity(_0x52c49c,null))[_0x9911('0x54')](handleError(_0x52c49c,null));};exports[_0x9911('0x58')]=function(_0x43a84a,_0x270d61){return db[_0x9911('0x45')][_0x9911('0x58')]()[_0x9911('0x28')](respondWithResult(_0x270d61,null))[_0x9911('0x54')](handleError(_0x270d61,null));};exports[_0x9911('0x59')]=function(_0x438e03,_0xdee7dd,_0x32c8b3){var _0x254bf7={'raw':!![],'where':{}},_0x545abf={},_0x41be7c;return db['SmsQueue'][_0x9911('0x5a')]({'where':{'id':_0x438e03[_0x9911('0x57')]['id']}})[_0x9911('0x28')](handleEntityNotFound(_0xdee7dd,null))[_0x9911('0x28')](function(_0x14e207){if(_0x14e207){_0x41be7c=_0x14e207['get']({'plain':!![]});_0x545abf[_0x9911('0x34')]=_[_0x9911('0x4b')](db['UserSmsQueue'][_0x9911('0x4c')]);_0x545abf[_0x9911('0x36')]=_[_0x9911('0x4b')](_0x438e03[_0x9911('0x36')]);_0x545abf[_0x9911('0x37')]=_['intersection'](_0x545abf[_0x9911('0x34')],_0x545abf[_0x9911('0x36')]);_0x254bf7['attributes']=_[_0x9911('0x38')](_0x545abf['model'],qs[_0x9911('0x3a')](_0x438e03[_0x9911('0x36')][_0x9911('0x3a')]));_0x254bf7[_0x9911('0x39')]=_0x254bf7['attributes']['length']?_0x254bf7[_0x9911('0x39')]:_0x545abf[_0x9911('0x34')];if(!_0x438e03[_0x9911('0x36')]['hasOwnProperty'](_0x9911('0x3d'))){_0x254bf7[_0x9911('0x20')]=qs[_0x9911('0x20')](_0x438e03[_0x9911('0x36')][_0x9911('0x20')]);_0x254bf7['offset']=qs[_0x9911('0x1f')](_0x438e03['query']['offset']);}_0x254bf7[_0x9911('0x3e')]=qs['sort'](_0x438e03[_0x9911('0x36')][_0x9911('0x3f')]);_0x254bf7['where']=qs[_0x9911('0x37')](_[_0x9911('0x41')](_0x438e03['query'],_0x545abf[_0x9911('0x37')]));_0x254bf7[_0x9911('0x40')]['SmsQueueId']=_0x14e207['id'];if(_0x438e03[_0x9911('0x36')][_0x9911('0x42')]){_0x254bf7[_0x9911('0x40')]=_['merge'](_0x254bf7[_0x9911('0x40')],{'$or':_[_0x9911('0x35')](_0x254bf7[_0x9911('0x39')],function(_0x470cb3){var _0x4d6156={};_0x4d6156[_0x470cb3]={'$like':'%'+_0x438e03[_0x9911('0x36')][_0x9911('0x42')]+'%'};return _0x4d6156;})});}_0x254bf7=_[_0x9911('0x44')]({},_0x254bf7,_0x438e03[_0x9911('0x4d')]);return db['UserSmsQueue'][_0x9911('0x48')](_0x254bf7);}})[_0x9911('0x28')](function(_0x17faca){if(_0x17faca){return db[_0x9911('0x5b')][_0x9911('0x5c')]({'where':{'id':_[_0x9911('0x35')](_0x17faca,'UserId'),'role':_0x9911('0x5d')},'attributes':['id','name','smsPause','updatedAt',_0x9911('0x5e')]});}})[_0x9911('0x28')](function(_0x2a39d3){if(_0x2a39d3){return{'count':_0x2a39d3[_0x9911('0x1e')],'rows':_[_0x9911('0x35')](_0x2a39d3[_0x9911('0x49')],function(_0x44e0e4){return{'membername':_0x44e0e4[_0x9911('0x2e')],'UserId':_0x44e0e4['id'],'queue_name':_0x41be7c[_0x9911('0x2e')],'SmsQueueId':_0x41be7c['id'],'interface':util[_0x9911('0x5f')](_0x9911('0x60'),_0x9911('0x61'),_0x44e0e4['name']),'penalty':0x0,'paused':_0x44e0e4[_0x9911('0x62')],'createdAt':_0x44e0e4[_0x9911('0x5e')],'updatedAt':_0x44e0e4[_0x9911('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xdee7dd,_0x254bf7))['catch'](handleError(_0xdee7dd,null));};exports['getTeams']=function(_0x5732e6,_0x2eedd4,_0x46eb61){var _0x4e49f9={};var _0x62c5f3={};var _0x4ccb08;var _0x4ad279;return db[_0x9911('0x45')][_0x9911('0x5a')]({'where':{'id':_0x5732e6[_0x9911('0x57')]['id']}})[_0x9911('0x28')](handleEntityNotFound(_0x2eedd4,null))[_0x9911('0x28')](function(_0x252dd0){if(_0x252dd0){_0x4ccb08=_0x252dd0;_0x62c5f3['model']=_[_0x9911('0x4b')](db['Team'][_0x9911('0x4c')]);_0x62c5f3[_0x9911('0x36')]=_['keys'](_0x5732e6[_0x9911('0x36')]);_0x62c5f3['filters']=_[_0x9911('0x38')](_0x62c5f3['model'],_0x62c5f3[_0x9911('0x36')]);_0x4e49f9[_0x9911('0x39')]=_[_0x9911('0x38')](_0x62c5f3[_0x9911('0x34')],qs[_0x9911('0x3a')](_0x5732e6[_0x9911('0x36')][_0x9911('0x3a')]));_0x4e49f9[_0x9911('0x39')]=_0x4e49f9[_0x9911('0x39')]['length']?_0x4e49f9['attributes']:_0x62c5f3[_0x9911('0x34')];_0x4e49f9[_0x9911('0x3e')]=qs['sort'](_0x5732e6['query'][_0x9911('0x3f')]);_0x4e49f9[_0x9911('0x40')]=qs[_0x9911('0x37')](_[_0x9911('0x41')](_0x5732e6[_0x9911('0x36')],_0x62c5f3['filters']));if(_0x5732e6['query'][_0x9911('0x42')]){_0x4e49f9[_0x9911('0x40')]=_[_0x9911('0x44')](_0x4e49f9[_0x9911('0x40')],{'$or':_['map'](_0x4e49f9[_0x9911('0x39')],function(_0x12a086){var _0x30eca7={};_0x30eca7[_0x12a086]={'$like':'%'+_0x5732e6[_0x9911('0x36')][_0x9911('0x42')]+'%'};return _0x30eca7;})});}_0x4e49f9=_[_0x9911('0x44')]({},_0x4e49f9,_0x5732e6[_0x9911('0x4d')]);return _0x4ccb08[_0x9911('0x64')](_0x4e49f9);}})[_0x9911('0x28')](function(_0x13502c){if(_0x13502c){_0x4ad279=_0x13502c[_0x9911('0x3b')];if(!_0x5732e6[_0x9911('0x36')][_0x9911('0x3c')](_0x9911('0x3d'))){_0x4e49f9['limit']=qs['limit'](_0x5732e6[_0x9911('0x36')][_0x9911('0x20')]);_0x4e49f9[_0x9911('0x1f')]=qs['offset'](_0x5732e6[_0x9911('0x36')][_0x9911('0x1f')]);}return _0x4ccb08[_0x9911('0x64')](_0x4e49f9);}})[_0x9911('0x28')](function(_0x1a63f0){if(_0x1a63f0){return _0x1a63f0?{'count':_0x4ad279,'rows':_0x1a63f0}:null;}})[_0x9911('0x28')](respondWithResult(_0x2eedd4,null))[_0x9911('0x54')](handleError(_0x2eedd4,null));};exports[_0x9911('0x65')]=function(_0x2aff8e,_0x29616a,_0x43b7a0){var _0x409a2d=_0x2aff8e[_0x9911('0x56')][_0x9911('0x66')];return db[_0x9911('0x67')][_0x9911('0x48')]({'where':{'id':_0x409a2d},'attributes':['id'],'include':[{'model':db[_0x9911('0x5b')],'as':_0x9911('0x68'),'attributes':['id',_0x9911('0x2e'),'online','voicePause',_0x9911('0x69')],'raw':!![]}]})[_0x9911('0x28')](function(_0x383575){if(_0x383575){var _0x3d623e=_[_0x9911('0x6a')](_0x383575,function(_0x114e25){var _0x42f2ef=_0x114e25['get']({'plain':!![]});return _0x42f2ef['Agents'];});return db[_0x9911('0x45')][_0x9911('0x4e')]({'where':{'id':_0x2aff8e['params']['id']}})[_0x9911('0x28')](function(_0x19afc0){return db['sequelize'][_0x9911('0x6b')](function(_0x125c07){return _0x19afc0['addTeams'](_0x409a2d,{'transaction':_0x125c07})[_0x9911('0x28')](function(){return BPromise[_0x9911('0x6c')](_0x3d623e,function(_0x16dae9){return db[_0x9911('0x6d')][_0x9911('0x6e')]({'where':{'UserId':_0x16dae9['id'],'SmsQueueId':_0x2aff8e[_0x9911('0x57')]['id']},'transaction':_0x125c07});});})[_0x9911('0x28')](function(){_0x3d623e[_0x9911('0x6f')](function(_0x22e077){socket[_0x9911('0x70')](_0x9911('0x71'),{'UserId':_0x22e077['id'],'SmsQueueId':_0x19afc0['id']});});});});});}})[_0x9911('0x28')](respondWithStatusCode(_0x29616a,null))[_0x9911('0x54')](handleError(_0x29616a,null));};exports[_0x9911('0x72')]=function(_0xd68cc3,_0x54e855,_0x19d0dd){return db[_0x9911('0x67')][_0x9911('0x48')]({'where':{'id':_0xd68cc3[_0x9911('0x36')][_0x9911('0x66')]},'attributes':['id'],'include':[{'model':db[_0x9911('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9911('0x28')](handleEntityNotFound(_0x54e855,null))[_0x9911('0x28')](function(_0x5942ff){var _0x1b3893=_[_0x9911('0x35')](_0x5942ff,'id');var _0x5d4f7f=[];var _0x26b062=[];var _0x4f1303=squel[_0x9911('0x73')]();_0x4f1303[_0x9911('0x74')]('tq.TeamId')[_0x9911('0x75')](_0x9911('0x76'),'tq')[_0x9911('0x77')]('user_has_teams','ut',_0x9911('0x78'))[_0x9911('0x40')](_0x9911('0x79'),_0xd68cc3['params']['id']);for(var _0x3412b9=0x0;_0x3412b9<_0x5942ff['length'];_0x3412b9+=0x1){let _0x32dab9=_0x5942ff[_0x3412b9];for(var _0x24932a=0x0;_0x24932a<_0x32dab9['Agents'][_0x9911('0x3b')];_0x24932a+=0x1){let _0x2af386=_0x32dab9[_0x9911('0x68')][_0x24932a];var _0x3a5e2e=_0x4f1303[_0x9911('0x7a')]();_0x3a5e2e[_0x9911('0x40')](_0x9911('0x7b'),_0x2af386['id']);_0x26b062[_0x9911('0x7c')](db[_0x9911('0x7d')][_0x9911('0x36')](_0x3a5e2e[_0x9911('0x7e')](),{'type':db[_0x9911('0x7d')]['QueryTypes'][_0x9911('0x7f')]})['then'](function(_0x230561){if(_0x230561['length']===0x1){return _0x2af386['id'];}else{var _0x2dbaec=_['every'](_[_0x9911('0x35')](_0x230561,_0x9911('0x80')),function(_0x77ba66){return _[_0x9911('0x81')](_0x1b3893,_0x77ba66);});if(_0x2dbaec){return _0x2af386['id'];}}}));}}return BPromise[_0x9911('0x82')](_0x26b062)['then'](function(_0x30cf1b){_0x5d4f7f=_(_0x5d4f7f)['union'](_0x30cf1b)[_0x9911('0x83')]()['value']();return db[_0x9911('0x45')][_0x9911('0x4e')]({'where':{'id':_0xd68cc3['params']['id']}})[_0x9911('0x28')](function(_0x3b92c0){return db[_0x9911('0x7d')][_0x9911('0x6b')](function(_0x35b14d){return _0x3b92c0[_0x9911('0x72')](_0xd68cc3['query'][_0x9911('0x66')],{'transaction':_0x35b14d})[_0x9911('0x28')](function(){if(!_['isEmpty'](_0x5d4f7f)){return _0x3b92c0[_0x9911('0x84')](_0x5d4f7f,{'transaction':_0x35b14d});}})[_0x9911('0x28')](function(){_0x5d4f7f[_0x9911('0x6f')](function(_0xcf7fd8){socket[_0x9911('0x70')](_0x9911('0x85'),{'UserId':_0xcf7fd8,'SmsQueueId':_0x3b92c0['id']});});});});});});})['then'](respondWithStatusCode(_0x54e855,null))[_0x9911('0x54')](handleError(_0x54e855,null));};exports[_0x9911('0x86')]=function(_0x17cd5f,_0x29a93d,_0x426a31){return db[_0x9911('0x45')][_0x9911('0x4e')]({'where':{'id':_0x17cd5f[_0x9911('0x57')]['id']}})[_0x9911('0x28')](handleEntityNotFound(_0x29a93d,null))[_0x9911('0x28')](function(_0x243cc0){if(_0x243cc0){return _0x243cc0[_0x9911('0x86')](_0x17cd5f[_0x9911('0x56')][_0x9911('0x66')],_[_0x9911('0x87')](_0x17cd5f[_0x9911('0x56')],[_0x9911('0x66'),'id'])||{})['spread'](function(_0x53630c){for(var _0x21ecaa=0x0;_0x21ecaa<_0x17cd5f['body'][_0x9911('0x66')][_0x9911('0x3b')];_0x21ecaa+=0x1){socket[_0x9911('0x70')](_0x9911('0x71'),{'UserId':_0x17cd5f[_0x9911('0x56')][_0x9911('0x66')][_0x21ecaa],'SmsQueueId':_0x17cd5f['params']['id']});}return _0x53630c;});}})[_0x9911('0x28')](respondWithResult(_0x29a93d,null))[_0x9911('0x54')](handleError(_0x29a93d,null));};exports['removeAgents']=function(_0x3d50c7,_0x238175,_0x405793){return db['SmsQueue'][_0x9911('0x4e')]({'where':{'id':_0x3d50c7['params']['id']}})[_0x9911('0x28')](handleEntityNotFound(_0x238175,null))[_0x9911('0x28')](function(_0x2c6c69){if(_0x2c6c69){return _0x2c6c69[_0x9911('0x84')](_0x3d50c7[_0x9911('0x36')][_0x9911('0x66')])['then'](function(){if(_[_0x9911('0x88')](_0x3d50c7['query'][_0x9911('0x66')])){for(var _0x41db72=0x0;_0x41db72<_0x3d50c7['query']['ids']['length'];_0x41db72+=0x1){socket[_0x9911('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x3d50c7[_0x9911('0x36')][_0x9911('0x66')][_0x41db72]),'SmsQueueId':Number(_0x3d50c7[_0x9911('0x57')]['id'])});}}else{socket['emit'](_0x9911('0x85'),{'UserId':Number(_0x3d50c7[_0x9911('0x36')][_0x9911('0x66')]),'SmsQueueId':Number(_0x3d50c7[_0x9911('0x57')]['id'])});}});}})[_0x9911('0x28')](respondWithStatusCode(_0x238175,null))[_0x9911('0x54')](handleError(_0x238175,null));};exports[_0x9911('0x89')]=function(_0x86b710,_0x173684,_0x579fcf){var _0x5af4cc={};var _0x3da856={};var _0x45a7ad;var _0x10d8d4;return db[_0x9911('0x45')][_0x9911('0x5a')]({'where':{'id':_0x86b710[_0x9911('0x57')]['id']}})[_0x9911('0x28')](handleEntityNotFound(_0x173684,null))['then'](function(_0x32c25a){if(_0x32c25a){_0x45a7ad=_0x32c25a;_0x3da856['model']=_['keys'](db[_0x9911('0x5b')][_0x9911('0x4c')]);_0x3da856[_0x9911('0x36')]=_[_0x9911('0x4b')](_0x86b710[_0x9911('0x36')]);_0x3da856[_0x9911('0x37')]=_[_0x9911('0x38')](_0x3da856[_0x9911('0x34')],_0x3da856[_0x9911('0x36')]);_0x5af4cc[_0x9911('0x39')]=_['intersection'](_0x3da856[_0x9911('0x34')],qs[_0x9911('0x3a')](_0x86b710[_0x9911('0x36')][_0x9911('0x3a')]));_0x5af4cc[_0x9911('0x39')]=_0x5af4cc[_0x9911('0x39')][_0x9911('0x3b')]?_0x5af4cc[_0x9911('0x39')]:_0x3da856[_0x9911('0x34')];_0x5af4cc['order']=qs[_0x9911('0x3f')](_0x86b710[_0x9911('0x36')][_0x9911('0x3f')]);_0x5af4cc[_0x9911('0x40')]=qs[_0x9911('0x37')](_[_0x9911('0x41')](_0x86b710[_0x9911('0x36')],_0x3da856[_0x9911('0x37')]));if(_0x86b710[_0x9911('0x36')][_0x9911('0x42')]){_0x5af4cc['where']=_[_0x9911('0x44')](_0x5af4cc[_0x9911('0x40')],{'$or':_[_0x9911('0x35')](_0x5af4cc[_0x9911('0x39')],function(_0x38fe47){var _0x69cca={};_0x69cca[_0x38fe47]={'$like':'%'+_0x86b710[_0x9911('0x36')][_0x9911('0x42')]+'%'};return _0x69cca;})});}_0x5af4cc=_[_0x9911('0x44')]({},_0x5af4cc,_0x86b710[_0x9911('0x4d')]);return _0x45a7ad[_0x9911('0x89')](_0x5af4cc);}})['then'](function(_0x203f24){if(_0x203f24){_0x10d8d4=_0x203f24[_0x9911('0x3b')];if(!_0x86b710[_0x9911('0x36')][_0x9911('0x3c')](_0x9911('0x3d'))){_0x5af4cc[_0x9911('0x20')]=qs['limit'](_0x86b710['query'][_0x9911('0x20')]);_0x5af4cc[_0x9911('0x1f')]=qs['offset'](_0x86b710['query'][_0x9911('0x1f')]);}return _0x45a7ad['getAgents'](_0x5af4cc);}})[_0x9911('0x28')](function(_0x2bc055){if(_0x2bc055){return _0x2bc055?{'count':_0x10d8d4,'rows':_0x2bc055}:null;}})[_0x9911('0x28')](respondWithResult(_0x173684,null))[_0x9911('0x54')](handleError(_0x173684,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 7a1b5b6..f537285 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 _0x06a0=['exports','events','SmsQueue','update','remove','emit','hasOwnProperty','hook'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0x06a0,0x1e1));var _0x006a=function(_0x3e2435,_0xc531a1){_0x3e2435=_0x3e2435-0x0;var _0x5d49e7=_0x06a0[_0x3e2435];return _0x5d49e7;};'use strict';var EventEmitter=require(_0x006a('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x006a('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x006a('0x2'),'afterDestroy':_0x006a('0x3')};function emitEvent(_0x31c7e5){return function(_0x5f1afd,_0x4d2c1a,_0x3bb2a1){SmsQueueEvents[_0x006a('0x4')](_0x31c7e5+':'+_0x5f1afd['id'],_0x5f1afd);SmsQueueEvents[_0x006a('0x4')](_0x31c7e5,_0x5f1afd);_0x3bb2a1(null);};}for(var e in events){if(events[_0x006a('0x5')](e)){var event=events[e];SmsQueue[_0x006a('0x6')](e,emitEvent(event));}}module[_0x006a('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x6995=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2c8641,_0x5d09a1){var _0x476901=function(_0x20e34f){while(--_0x20e34f){_0x2c8641['push'](_0x2c8641['shift']());}};_0x476901(++_0x5d09a1);}(_0x6995,0xfd));var _0x5699=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6995[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x5699('0x0'));var SmsQueue=require(_0x5699('0x1'))['db'][_0x5699('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5699('0x3')](0x0);var events={'afterCreate':_0x5699('0x4'),'afterUpdate':_0x5699('0x5'),'afterDestroy':_0x5699('0x6')};function emitEvent(_0xb7d57a){return function(_0x5bea44,_0x237520,_0x249701){SmsQueueEvents['emit'](_0xb7d57a+':'+_0x5bea44['id'],_0x5bea44);SmsQueueEvents[_0x5699('0x7')](_0xb7d57a,_0x5bea44);_0x249701(null);};}for(var e in events){if(events[_0x5699('0x8')](e)){var event=events[e];SmsQueue[_0x5699('0x9')](e,emitEvent(event));}}module[_0x5699('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0eb5ce3..f66b334 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 _0xb377=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x5c0cf4,_0x265aa9){var _0x3d9f50=function(_0x10f73d){while(--_0x10f73d){_0x5c0cf4['push'](_0x5c0cf4['shift']());}};_0x3d9f50(++_0x265aa9);}(_0xb377,0x1b6));var _0x7b37=function(_0x20ce02,_0x302a4b){_0x20ce02=_0x20ce02-0x0;var _0x2b78af=_0xb377[_0x20ce02];return _0x2b78af;};'use strict';var _=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var logger=require(_0x7b37('0x2'))(_0x7b37('0x3'));var moment=require(_0x7b37('0x4'));var BPromise=require(_0x7b37('0x5'));var rp=require(_0x7b37('0x6'));var fs=require('fs');var path=require(_0x7b37('0x7'));var rimraf=require(_0x7b37('0x8'));var config=require(_0x7b37('0x9'));var attributes=require(_0x7b37('0xa'));module[_0x7b37('0xb')]=function(_0x58edf9,_0x516b62){return _0x58edf9[_0x7b37('0xc')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x303a=['bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','../../config/logger','api','moment'];(function(_0x5a59a0,_0x4f2cee){var _0x233883=function(_0x73a1ab){while(--_0x73a1ab){_0x5a59a0['push'](_0x5a59a0['shift']());}};_0x233883(++_0x4f2cee);}(_0x303a,0x1a0));var _0xa303=function(_0x5be892,_0x68238a){_0x5be892=_0x5be892-0x0;var _0x53fc35=_0x303a[_0x5be892];return _0x53fc35;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var logger=require(_0xa303('0x1'))(_0xa303('0x2'));var moment=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa303('0x5'));var rimraf=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var attributes=require(_0xa303('0x8'));module[_0xa303('0x9')]=function(_0x1c7ee9,_0x2bc3d7){return _0x1c7ee9[_0xa303('0xa')](_0xa303('0xb'),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 422407b..735049c 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 _0x97a3=['attributes','stringify','ShowSmsQueue','find','raw','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetSmsQueue','findAll','options','where','limit','map','include','model'];(function(_0x525534,_0x5eccfe){var _0x55e231=function(_0x2ae8fb){while(--_0x2ae8fb){_0x525534['push'](_0x525534['shift']());}};_0x55e231(++_0x5eccfe);}(_0x97a3,0x1be));var _0x397a=function(_0x324700,_0x4bccb9){_0x324700=_0x324700-0x0;var _0x35ad72=_0x97a3[_0x324700];return _0x35ad72;};'use strict';var _=require(_0x397a('0x0'));var util=require('util');var moment=require(_0x397a('0x1'));var BPromise=require('bluebird');var rs=require(_0x397a('0x2'));var fs=require('fs');var Redis=require(_0x397a('0x3'));var db=require(_0x397a('0x4'))['db'];var utils=require(_0x397a('0x5'));var logger=require('../../config/logger')(_0x397a('0x6'));var config=require(_0x397a('0x7'));var jayson=require(_0x397a('0x8'));var client=jayson[_0x397a('0x9')][_0x397a('0xa')]({'port':0x232a});config[_0x397a('0xb')]=_['defaults'](config[_0x397a('0xb')],{'host':_0x397a('0xc'),'port':0x18eb});var socket=require(_0x397a('0xd'))(new Redis(config[_0x397a('0xb')]));require(_0x397a('0xe'))[_0x397a('0xf')](socket);function respondWithRpcPromise(_0x5f4c5f,_0x57c4de,_0x1eef32){return new BPromise(function(_0x425835,_0x2595ee){return client[_0x397a('0x10')](_0x5f4c5f,_0x1eef32)[_0x397a('0x11')](function(_0x4a3c39){logger['info'](_0x397a('0x12'),_0x57c4de,_0x397a('0x13'));logger[_0x397a('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x57c4de,_0x397a('0x13'),JSON['stringify'](_0x4a3c39));if(_0x4a3c39['error']){if(_0x4a3c39[_0x397a('0x15')][_0x397a('0x16')]===0x1f4){logger['error'](_0x397a('0x12'),_0x57c4de,_0x4a3c39[_0x397a('0x15')][_0x397a('0x17')]);return _0x2595ee(_0x4a3c39[_0x397a('0x15')][_0x397a('0x17')]);}logger[_0x397a('0x15')](_0x397a('0x12'),_0x57c4de,_0x4a3c39['error'][_0x397a('0x17')]);return _0x425835(_0x4a3c39[_0x397a('0x15')][_0x397a('0x17')]);}else{logger[_0x397a('0x18')](_0x397a('0x12'),_0x57c4de,'request\x20sent');_0x425835(_0x4a3c39[_0x397a('0x19')][_0x397a('0x17')]);}})['catch'](function(_0x474e44){logger[_0x397a('0x15')](_0x397a('0x12'),_0x57c4de,_0x474e44);_0x2595ee(_0x474e44);});});}exports[_0x397a('0x1a')]=function(_0x42a855){var _0x170399=this;return new Promise(function(_0x10d4bf,_0x12aa04){return db['SmsQueue'][_0x397a('0x1b')]({'raw':_0x42a855['options']?_0x42a855['options']['raw']===undefined?!![]:![]:!![],'where':_0x42a855[_0x397a('0x1c')]?_0x42a855[_0x397a('0x1c')][_0x397a('0x1d')]||null:null,'attributes':_0x42a855[_0x397a('0x1c')]?_0x42a855[_0x397a('0x1c')]['attributes']||null:null,'limit':_0x42a855[_0x397a('0x1c')]?_0x42a855['options'][_0x397a('0x1e')]||null:null,'include':_0x42a855[_0x397a('0x1c')]?_0x42a855[_0x397a('0x1c')]['include']?_[_0x397a('0x1f')](_0x42a855[_0x397a('0x1c')][_0x397a('0x20')],function(_0x52c9d2){return{'model':db[_0x52c9d2[_0x397a('0x21')]],'as':_0x52c9d2['as'],'attributes':_0x52c9d2[_0x397a('0x22')],'include':_0x52c9d2[_0x397a('0x20')]?_[_0x397a('0x1f')](_0x52c9d2[_0x397a('0x20')],function(_0x53ce6a){return{'model':db[_0x53ce6a['model']],'as':_0x53ce6a['as'],'attributes':_0x53ce6a[_0x397a('0x22')],'include':_0x53ce6a[_0x397a('0x20')]?_[_0x397a('0x1f')](_0x53ce6a[_0x397a('0x20')],function(_0x54f42d){return{'model':db[_0x54f42d[_0x397a('0x21')]],'as':_0x54f42d['as'],'attributes':_0x54f42d[_0x397a('0x22')]};}):[]};}):[]};}):[]:[]})[_0x397a('0x11')](function(_0x20f048){logger[_0x397a('0x18')](_0x397a('0x1a'),_0x42a855);logger[_0x397a('0x14')](_0x397a('0x1a'),_0x42a855,JSON[_0x397a('0x23')](_0x20f048));_0x10d4bf(_0x20f048);})['catch'](function(_0x2e5eeb){logger['error'](_0x397a('0x1a'),_0x2e5eeb[_0x397a('0x17')],_0x42a855);_0x12aa04(_0x170399[_0x397a('0x15')](0x1f4,_0x2e5eeb[_0x397a('0x17')]));});});};exports[_0x397a('0x24')]=function(_0x18a1e7){var _0xe694b8=this;return new Promise(function(_0x2cff13,_0x194cc1){return db['SmsQueue'][_0x397a('0x25')]({'raw':_0x18a1e7[_0x397a('0x1c')]?_0x18a1e7[_0x397a('0x1c')][_0x397a('0x26')]===undefined?!![]:![]:!![],'where':_0x18a1e7['options']?_0x18a1e7['options'][_0x397a('0x1d')]||null:null,'attributes':_0x18a1e7[_0x397a('0x1c')]?_0x18a1e7[_0x397a('0x1c')][_0x397a('0x22')]||null:null,'include':_0x18a1e7['options']?_0x18a1e7[_0x397a('0x1c')][_0x397a('0x20')]?_['map'](_0x18a1e7[_0x397a('0x1c')]['include'],function(_0x53193f){return{'model':db[_0x53193f[_0x397a('0x21')]],'as':_0x53193f['as'],'attributes':_0x53193f[_0x397a('0x22')],'include':_0x53193f[_0x397a('0x20')]?_['map'](_0x53193f[_0x397a('0x20')],function(_0x2db7a0){return{'model':db[_0x2db7a0['model']],'as':_0x2db7a0['as'],'attributes':_0x2db7a0[_0x397a('0x22')],'include':_0x2db7a0['include']?_['map'](_0x2db7a0[_0x397a('0x20')],function(_0x2ef4ed){return{'model':db[_0x2ef4ed[_0x397a('0x21')]],'as':_0x2ef4ed['as'],'attributes':_0x2ef4ed[_0x397a('0x22')]};}):[]};}):[]};}):[]:[]})[_0x397a('0x11')](function(_0x34d1e6){logger[_0x397a('0x18')](_0x397a('0x24'),_0x18a1e7);logger[_0x397a('0x14')](_0x397a('0x24'),_0x18a1e7,JSON[_0x397a('0x23')](_0x34d1e6));_0x2cff13(_0x34d1e6);})[_0x397a('0x27')](function(_0x51acad){logger['error'](_0x397a('0x24'),_0x51acad[_0x397a('0x17')],_0x18a1e7);_0x194cc1(_0xe694b8[_0x397a('0x15')](0x1f4,_0x51acad[_0x397a('0x17')]));});});}; \ No newline at end of file +var _0x726f=['client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','attributes','limit','include','map','model','catch','raw','where','info','ShowSmsQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x27fcf2,_0x29d206){var _0x3b6a19=function(_0x10fc05){while(--_0x10fc05){_0x27fcf2['push'](_0x27fcf2['shift']());}};_0x3b6a19(++_0x29d206);}(_0x726f,0x188));var _0xf726=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x726f[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xf726('0x0'));var moment=require(_0xf726('0x1'));var BPromise=require(_0xf726('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf726('0x3'));var db=require(_0xf726('0x4'))['db'];var utils=require(_0xf726('0x5'));var logger=require(_0xf726('0x6'))('rpc');var config=require(_0xf726('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf726('0x8')][_0xf726('0x9')]({'port':0x232a});config[_0xf726('0xa')]=_[_0xf726('0xb')](config[_0xf726('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf726('0xc'))(new Redis(config[_0xf726('0xa')]));require(_0xf726('0xd'))[_0xf726('0xe')](socket);function respondWithRpcPromise(_0x4f948c,_0x586282,_0x3b9274){return new BPromise(function(_0x20ca71,_0x547539){return client[_0xf726('0xf')](_0x4f948c,_0x3b9274)[_0xf726('0x10')](function(_0x55c7){logger['info'](_0xf726('0x11'),_0x586282,_0xf726('0x12'));logger[_0xf726('0x13')](_0xf726('0x14'),_0x586282,_0xf726('0x12'),JSON[_0xf726('0x15')](_0x55c7));if(_0x55c7[_0xf726('0x16')]){if(_0x55c7[_0xf726('0x16')][_0xf726('0x17')]===0x1f4){logger['error'](_0xf726('0x11'),_0x586282,_0x55c7[_0xf726('0x16')][_0xf726('0x18')]);return _0x547539(_0x55c7['error'][_0xf726('0x18')]);}logger['error'](_0xf726('0x11'),_0x586282,_0x55c7[_0xf726('0x16')][_0xf726('0x18')]);return _0x20ca71(_0x55c7[_0xf726('0x16')][_0xf726('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x586282,_0xf726('0x12'));_0x20ca71(_0x55c7[_0xf726('0x19')][_0xf726('0x18')]);}})['catch'](function(_0x900a29){logger[_0xf726('0x16')](_0xf726('0x11'),_0x586282,_0x900a29);_0x547539(_0x900a29);});});}exports[_0xf726('0x1a')]=function(_0x72e7c4){var _0x123662=this;return new Promise(function(_0x300954,_0x327f92){return db[_0xf726('0x1b')][_0xf726('0x1c')]({'raw':_0x72e7c4[_0xf726('0x1d')]?_0x72e7c4[_0xf726('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x72e7c4[_0xf726('0x1d')]?_0x72e7c4['options']['where']||null:null,'attributes':_0x72e7c4[_0xf726('0x1d')]?_0x72e7c4[_0xf726('0x1d')][_0xf726('0x1e')]||null:null,'limit':_0x72e7c4[_0xf726('0x1d')]?_0x72e7c4[_0xf726('0x1d')][_0xf726('0x1f')]||null:null,'include':_0x72e7c4[_0xf726('0x1d')]?_0x72e7c4['options'][_0xf726('0x20')]?_[_0xf726('0x21')](_0x72e7c4['options'][_0xf726('0x20')],function(_0x611473){return{'model':db[_0x611473[_0xf726('0x22')]],'as':_0x611473['as'],'attributes':_0x611473[_0xf726('0x1e')],'include':_0x611473[_0xf726('0x20')]?_[_0xf726('0x21')](_0x611473[_0xf726('0x20')],function(_0x388e95){return{'model':db[_0x388e95[_0xf726('0x22')]],'as':_0x388e95['as'],'attributes':_0x388e95[_0xf726('0x1e')],'include':_0x388e95[_0xf726('0x20')]?_[_0xf726('0x21')](_0x388e95['include'],function(_0x3248bf){return{'model':db[_0x3248bf[_0xf726('0x22')]],'as':_0x3248bf['as'],'attributes':_0x3248bf[_0xf726('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2082e3){logger['info']('GetSmsQueue',_0x72e7c4);logger['debug'](_0xf726('0x1a'),_0x72e7c4,JSON[_0xf726('0x15')](_0x2082e3));_0x300954(_0x2082e3);})[_0xf726('0x23')](function(_0x43fa6b){logger[_0xf726('0x16')](_0xf726('0x1a'),_0x43fa6b[_0xf726('0x18')],_0x72e7c4);_0x327f92(_0x123662[_0xf726('0x16')](0x1f4,_0x43fa6b[_0xf726('0x18')]));});});};exports['ShowSmsQueue']=function(_0x2d8d55){var _0x2b1161=this;return new Promise(function(_0xe999e1,_0x19814f){return db['SmsQueue']['find']({'raw':_0x2d8d55[_0xf726('0x1d')]?_0x2d8d55[_0xf726('0x1d')][_0xf726('0x24')]===undefined?!![]:![]:!![],'where':_0x2d8d55[_0xf726('0x1d')]?_0x2d8d55[_0xf726('0x1d')][_0xf726('0x25')]||null:null,'attributes':_0x2d8d55[_0xf726('0x1d')]?_0x2d8d55[_0xf726('0x1d')][_0xf726('0x1e')]||null:null,'include':_0x2d8d55[_0xf726('0x1d')]?_0x2d8d55[_0xf726('0x1d')][_0xf726('0x20')]?_['map'](_0x2d8d55['options'][_0xf726('0x20')],function(_0x383202){return{'model':db[_0x383202[_0xf726('0x22')]],'as':_0x383202['as'],'attributes':_0x383202['attributes'],'include':_0x383202[_0xf726('0x20')]?_['map'](_0x383202[_0xf726('0x20')],function(_0x55f2a5){return{'model':db[_0x55f2a5['model']],'as':_0x55f2a5['as'],'attributes':_0x55f2a5['attributes'],'include':_0x55f2a5[_0xf726('0x20')]?_['map'](_0x55f2a5[_0xf726('0x20')],function(_0x59475b){return{'model':db[_0x59475b[_0xf726('0x22')]],'as':_0x59475b['as'],'attributes':_0x59475b[_0xf726('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28c51a){logger[_0xf726('0x26')]('ShowSmsQueue',_0x2d8d55);logger[_0xf726('0x13')](_0xf726('0x27'),_0x2d8d55,JSON[_0xf726('0x15')](_0x28c51a));_0xe999e1(_0x28c51a);})[_0xf726('0x23')](function(_0x279265){logger[_0xf726('0x16')](_0xf726('0x27'),_0x279265[_0xf726('0x18')],_0x2d8d55);_0x19814f(_0x2b1161[_0xf726('0x16')](0x1f4,_0x279265[_0xf726('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8005509..fecaafd 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 _0xc6b2=['update','emit','removeListener','register','smsQueue:','./smsQueue.events','save','remove'];(function(_0x17f85f,_0x5c6ff9){var _0x38100a=function(_0x1dca1f){while(--_0x1dca1f){_0x17f85f['push'](_0x17f85f['shift']());}};_0x38100a(++_0x5c6ff9);}(_0xc6b2,0x10d));var _0x2c6b=function(_0x3edc24,_0x35775a){_0x3edc24=_0x3edc24-0x0;var _0x253a3b=_0xc6b2[_0x3edc24];return _0x253a3b;};'use strict';var SmsQueueEvents=require(_0x2c6b('0x0'));var events=[_0x2c6b('0x1'),_0x2c6b('0x2'),_0x2c6b('0x3')];function createListener(_0xafa45c,_0x44af63){return function(_0x51eb14){_0x44af63[_0x2c6b('0x4')](_0xafa45c,_0x51eb14);};}function removeListener(_0x3f65aa,_0x28af4f){return function(){SmsQueueEvents[_0x2c6b('0x5')](_0x3f65aa,_0x28af4f);};}exports[_0x2c6b('0x6')]=function(_0x3aa3a6){for(var _0x564118=0x0,_0x255914=events['length'];_0x564118<_0x255914;_0x564118++){var _0x3d06cb=events[_0x564118];var _0x5005a1=createListener(_0x2c6b('0x7')+_0x3d06cb,_0x3aa3a6);SmsQueueEvents['on'](_0x3d06cb,_0x5005a1);}}; \ No newline at end of file +var _0x9c63=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0xcb95ba,_0x16dd5c){var _0x3867f9=function(_0x2462ee){while(--_0x2462ee){_0xcb95ba['push'](_0xcb95ba['shift']());}};_0x3867f9(++_0x16dd5c);}(_0x9c63,0x159));var _0x39c6=function(_0x59eb01,_0x487436){_0x59eb01=_0x59eb01-0x0;var _0x35941e=_0x9c63[_0x59eb01];return _0x35941e;};'use strict';var SmsQueueEvents=require(_0x39c6('0x0'));var events=[_0x39c6('0x1'),_0x39c6('0x2'),_0x39c6('0x3')];function createListener(_0x4fa320,_0x163328){return function(_0x518d85){_0x163328[_0x39c6('0x4')](_0x4fa320,_0x518d85);};}function removeListener(_0x581338,_0x4b17e6){return function(){SmsQueueEvents[_0x39c6('0x5')](_0x581338,_0x4b17e6);};}exports[_0x39c6('0x6')]=function(_0x364d48){for(var _0x179a8d=0x0,_0x55756b=events['length'];_0x179a8d<_0x55756b;_0x179a8d++){var _0x4a9cf4=events[_0x179a8d];var _0x23ad01=createListener(_0x39c6('0x7')+_0x4a9cf4,_0x364d48);SmsQueueEvents['on'](_0x4a9cf4,_0x23ad01);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 5b3143c..e53f8ad 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 _0x7002=['exports','multer','util','path','express','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','/describe','isAuthenticated','describe','show','put','/:id','update'];(function(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0x7002,0x121));var _0x2700=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x7002[_0x26462c];return _0x509a42;};'use strict';var multer=require(_0x2700('0x0'));var util=require(_0x2700('0x1'));var path=require(_0x2700('0x2'));var timeout=require('connect-timeout');var express=require(_0x2700('0x3'));var router=express['Router']();var auth=require(_0x2700('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2700('0x5'));var controller=require(_0x2700('0x6'));router[_0x2700('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2700('0x7')](_0x2700('0x8'),auth[_0x2700('0x9')](),controller[_0x2700('0xa')]);router[_0x2700('0x7')]('/:id',auth[_0x2700('0x9')](),controller[_0x2700('0xb')]);router['post']('/',auth[_0x2700('0x9')](),controller['create']);router[_0x2700('0xc')](_0x2700('0xd'),auth[_0x2700('0x9')](),controller[_0x2700('0xe')]);router['delete'](_0x2700('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x2700('0xf')]=router; \ No newline at end of file +var _0x43c4=['put','delete','exports','multer','util','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x43c4,0x8b));var _0x443c=function(_0x39dd9f,_0x36b1af){_0x39dd9f=_0x39dd9f-0x0;var _0x5351e7=_0x43c4[_0x39dd9f];return _0x5351e7;};'use strict';var multer=require(_0x443c('0x0'));var util=require(_0x443c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x443c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x443c('0x3'));var config=require(_0x443c('0x4'));var controller=require('./smsQueueReport.controller');router[_0x443c('0x5')]('/',auth[_0x443c('0x6')](),controller[_0x443c('0x7')]);router['get'](_0x443c('0x8'),auth[_0x443c('0x6')](),controller[_0x443c('0x9')]);router['get'](_0x443c('0xa'),auth[_0x443c('0x6')](),controller[_0x443c('0xb')]);router[_0x443c('0xc')]('/',auth[_0x443c('0x6')](),controller[_0x443c('0xd')]);router[_0x443c('0xe')]('/:id',auth[_0x443c('0x6')](),controller['update']);router[_0x443c('0xf')](_0x443c('0xa'),auth[_0x443c('0x6')](),controller['destroy']);module[_0x443c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1eb6b68..e8b02be 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 _0x4f41=['moment','sequelize','STRING','DATE'];(function(_0xdc8af2,_0x513455){var _0x1e2c15=function(_0x4f8397){while(--_0x4f8397){_0xdc8af2['push'](_0xdc8af2['shift']());}};_0x1e2c15(++_0x513455);}(_0x4f41,0x1c8));var _0x14f4=function(_0x26297c,_0x25e593){_0x26297c=_0x26297c-0x0;var _0x47c4c1=_0x4f41[_0x26297c];return _0x47c4c1;};'use strict';var moment=require(_0x14f4('0x0'));var Sequelize=require(_0x14f4('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x14f4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x14f4('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x14f4('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x14f4('0x3')]},'reason':{'type':Sequelize[_0x14f4('0x2')]}}; \ No newline at end of file +var _0xfd4b=['DATE','moment','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfd4b,0x1f0));var _0xbfd4=function(_0x22afb6,_0x483c7c){_0x22afb6=_0x22afb6-0x0;var _0x23b7ba=_0xfd4b[_0x22afb6];return _0x23b7ba;};'use strict';var moment=require(_0xbfd4('0x0'));var Sequelize=require(_0xbfd4('0x1'));module[_0xbfd4('0x2')]={'uniqueid':{'type':Sequelize[_0xbfd4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbfd4('0x3')]},'joinAt':{'type':Sequelize[_0xbfd4('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbfd4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbfd4('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 56e0424..0fd450c 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 _0x814b=['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','SmsQueueReport','options','find','create','body','params','describe','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','destroy','then','error','stack','name','send'];(function(_0x10aebb,_0x2fd10a){var _0x1b1b8f=function(_0x1161be){while(--_0x1161be){_0x10aebb['push'](_0x10aebb['shift']());}};_0x1b1b8f(++_0x2fd10a);}(_0x814b,0x1a2));var _0xb814=function(_0x80bea0,_0x4c30f4){_0x80bea0=_0x80bea0-0x0;var _0x50fb90=_0x814b[_0x80bea0];return _0x50fb90;};'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['SmsQueueReport'][_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['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_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));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0x814b=['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','SmsQueueReport','options','find','create','body','params','describe','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','destroy','then','error','stack','name','send'];(function(_0x5679e5,_0x4e45c9){var _0x34a94=function(_0xda168c){while(--_0xda168c){_0x5679e5['push'](_0x5679e5['shift']());}};_0x34a94(++_0x4e45c9);}(_0x814b,0x1a2));var _0xb814=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x814b[_0x13f980];return _0x27153c;};'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['SmsQueueReport'][_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['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_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));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9fc8793..e15bf6b 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 _0xa298=['util','../../config/logger','api','request-promise','path','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','uniqueid','lodash'];(function(_0x3da697,_0x9c1500){var _0x452bb3=function(_0xc8d790){while(--_0xc8d790){_0x3da697['push'](_0x3da697['shift']());}};_0x452bb3(++_0x9c1500);}(_0xa298,0xbf));var _0x8a29=function(_0x44e14f,_0x16a878){_0x44e14f=_0x44e14f-0x0;var _0x17a9c6=_0xa298[_0x44e14f];return _0x17a9c6;};'use strict';var _=require(_0x8a29('0x0'));var util=require(_0x8a29('0x1'));var logger=require(_0x8a29('0x2'))(_0x8a29('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8a29('0x4'));var fs=require('fs');var path=require(_0x8a29('0x5'));var rimraf=require('rimraf');var config=require(_0x8a29('0x6'));var attributes=require(_0x8a29('0x7'));module[_0x8a29('0x8')]=function(_0x4f0e02,_0x11bf13){return _0x4f0e02[_0x8a29('0x9')](_0x8a29('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x8a29('0xb'),'fields':[_0x8a29('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe103=['report_sms_queue','uniqueid','util','../../config/logger','bluebird','path','../../config/environment','./smsQueueReport.attributes','exports','SmsQueueReport'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0xe103,0x1ce));var _0x3e10=function(_0x26adcb,_0x516ac9){_0x26adcb=_0x26adcb-0x0;var _0x4ab9cc=_0xe103[_0x26adcb];return _0x4ab9cc;};'use strict';var _=require('lodash');var util=require(_0x3e10('0x0'));var logger=require(_0x3e10('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3e10('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e10('0x3'));var rimraf=require('rimraf');var config=require(_0x3e10('0x4'));var attributes=require(_0x3e10('0x5'));module[_0x3e10('0x6')]=function(_0x41806c,_0x166a7e){return _0x41806c['define'](_0x3e10('0x7'),attributes,{'tableName':_0x3e10('0x8'),'paranoid':![],'indexes':[{'name':_0x3e10('0x9'),'fields':[_0x3e10('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 08b80c5..e9d4534 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 _0x5cb5=['UpdateSmsQueueReport','SmsQueueReport','body','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateSmsQueueReport','create','options','raw','info','debug','stringify','catch'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x5cb5,0x1c8));var _0x55cb=function(_0x470168,_0x39b014){_0x470168=_0x470168-0x0;var _0x565b93=_0x5cb5[_0x470168];return _0x565b93;};'use strict';var _=require('lodash');var util=require(_0x55cb('0x0'));var moment=require(_0x55cb('0x1'));var BPromise=require(_0x55cb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55cb('0x3'));var db=require(_0x55cb('0x4'))['db'];var utils=require(_0x55cb('0x5'));var logger=require(_0x55cb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x55cb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15ec61,_0x4e1a72,_0x36caac){return new BPromise(function(_0x5dab82,_0x2308d9){return client[_0x55cb('0x8')](_0x15ec61,_0x36caac)[_0x55cb('0x9')](function(_0x1ee860){logger['info'](_0x55cb('0xa'),_0x4e1a72,_0x55cb('0xb'));logger['debug'](_0x55cb('0xc'),_0x4e1a72,_0x55cb('0xb'),JSON['stringify'](_0x1ee860));if(_0x1ee860['error']){if(_0x1ee860[_0x55cb('0xd')][_0x55cb('0xe')]===0x1f4){logger[_0x55cb('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x4e1a72,_0x1ee860[_0x55cb('0xd')]['message']);return _0x2308d9(_0x1ee860[_0x55cb('0xd')][_0x55cb('0xf')]);}logger[_0x55cb('0xd')](_0x55cb('0xa'),_0x4e1a72,_0x1ee860[_0x55cb('0xd')][_0x55cb('0xf')]);return _0x5dab82(_0x1ee860[_0x55cb('0xd')]['message']);}else{logger['info'](_0x55cb('0xa'),_0x4e1a72,'request\x20sent');_0x5dab82(_0x1ee860['result'][_0x55cb('0xf')]);}})['catch'](function(_0x555a39){logger['error'](_0x55cb('0xa'),_0x4e1a72,_0x555a39);_0x2308d9(_0x555a39);});});}exports[_0x55cb('0x10')]=function(_0x43c5d0){var _0x36bb=this;return new Promise(function(_0x258a6d,_0x31810c){return db['SmsQueueReport'][_0x55cb('0x11')](_0x43c5d0['body'],{'raw':_0x43c5d0[_0x55cb('0x12')]?_0x43c5d0[_0x55cb('0x12')][_0x55cb('0x13')]===undefined?!![]:![]:!![]})[_0x55cb('0x9')](function(_0x30c1a8){logger[_0x55cb('0x14')](_0x55cb('0x10'),_0x43c5d0);logger[_0x55cb('0x15')]('CreateSmsQueueReport',_0x43c5d0,JSON[_0x55cb('0x16')](_0x30c1a8));_0x258a6d(_0x30c1a8);})[_0x55cb('0x17')](function(_0x1f3711){logger[_0x55cb('0xd')](_0x55cb('0x10'),_0x1f3711['message'],_0x43c5d0);_0x31810c(_0x36bb['error'](0x1f4,_0x1f3711['message']));});});};exports[_0x55cb('0x18')]=function(_0x2d5b2c){var _0x43b0fd=this;return new Promise(function(_0x4dd406,_0x53c183){return db[_0x55cb('0x19')]['update'](_0x2d5b2c[_0x55cb('0x1a')],{'raw':_0x2d5b2c[_0x55cb('0x12')]?_0x2d5b2c[_0x55cb('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d5b2c['options']?_0x2d5b2c[_0x55cb('0x12')][_0x55cb('0x1b')]||null:null,'attributes':_0x2d5b2c['options']?_0x2d5b2c[_0x55cb('0x12')][_0x55cb('0x1c')]||null:null,'limit':_0x2d5b2c[_0x55cb('0x12')]?_0x2d5b2c['options'][_0x55cb('0x1d')]||null:null})[_0x55cb('0x9')](function(_0x1ebbbb){logger[_0x55cb('0x14')](_0x55cb('0x18'),_0x2d5b2c);logger[_0x55cb('0x15')](_0x55cb('0x18'),_0x2d5b2c,JSON[_0x55cb('0x16')](_0x1ebbbb));_0x4dd406(_0x1ebbbb);})[_0x55cb('0x17')](function(_0x2d1e62){logger[_0x55cb('0xd')](_0x55cb('0x18'),_0x2d1e62[_0x55cb('0xf')],_0x2d5b2c);_0x53c183(_0x43b0fd[_0x55cb('0xd')](0x1f4,_0x2d1e62[_0x55cb('0xf')]));});});}; \ No newline at end of file +var _0x9756=['options','then','debug','UpdateSmsQueueReport','update','raw','where','attributes','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','request','info','SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport'];(function(_0x10ad13,_0x397757){var _0x2f4298=function(_0xffe3d4){while(--_0xffe3d4){_0x10ad13['push'](_0x10ad13['shift']());}};_0x2f4298(++_0x397757);}(_0x9756,0x190));var _0x6975=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9756[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require(_0x6975('0x0'));var moment=require(_0x6975('0x1'));var BPromise=require(_0x6975('0x2'));var rs=require(_0x6975('0x3'));var fs=require('fs');var Redis=require(_0x6975('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6975('0x5'))('rpc');var config=require(_0x6975('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6975('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49c0f1,_0x3f3012,_0x5dec50){return new BPromise(function(_0x4349cb,_0x1ac002){return client[_0x6975('0x8')](_0x49c0f1,_0x5dec50)['then'](function(_0x2631c5){logger[_0x6975('0x9')](_0x6975('0xa'),_0x3f3012,'request\x20sent');logger['debug'](_0x6975('0xb'),_0x3f3012,_0x6975('0xc'),JSON[_0x6975('0xd')](_0x2631c5));if(_0x2631c5[_0x6975('0xe')]){if(_0x2631c5['error'][_0x6975('0xf')]===0x1f4){logger[_0x6975('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x3f3012,_0x2631c5[_0x6975('0xe')][_0x6975('0x10')]);return _0x1ac002(_0x2631c5[_0x6975('0xe')][_0x6975('0x10')]);}logger[_0x6975('0xe')](_0x6975('0xa'),_0x3f3012,_0x2631c5[_0x6975('0xe')][_0x6975('0x10')]);return _0x4349cb(_0x2631c5['error'][_0x6975('0x10')]);}else{logger[_0x6975('0x9')](_0x6975('0xa'),_0x3f3012,'request\x20sent');_0x4349cb(_0x2631c5[_0x6975('0x11')][_0x6975('0x10')]);}})['catch'](function(_0x385b3c){logger[_0x6975('0xe')](_0x6975('0xa'),_0x3f3012,_0x385b3c);_0x1ac002(_0x385b3c);});});}exports[_0x6975('0x12')]=function(_0x45c14b){var _0x4a8181=this;return new Promise(function(_0xf3244b,_0x2b928e){return db[_0x6975('0x13')]['create'](_0x45c14b['body'],{'raw':_0x45c14b[_0x6975('0x14')]?_0x45c14b[_0x6975('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x6975('0x15')](function(_0x40f05f){logger[_0x6975('0x9')]('CreateSmsQueueReport',_0x45c14b);logger[_0x6975('0x16')]('CreateSmsQueueReport',_0x45c14b,JSON['stringify'](_0x40f05f));_0xf3244b(_0x40f05f);})['catch'](function(_0x1dc6c4){logger['error']('CreateSmsQueueReport',_0x1dc6c4[_0x6975('0x10')],_0x45c14b);_0x2b928e(_0x4a8181[_0x6975('0xe')](0x1f4,_0x1dc6c4[_0x6975('0x10')]));});});};exports[_0x6975('0x17')]=function(_0x262caf){var _0x33e191=this;return new Promise(function(_0x45fb4c,_0x26fecd){return db[_0x6975('0x13')][_0x6975('0x18')](_0x262caf['body'],{'raw':_0x262caf[_0x6975('0x14')]?_0x262caf[_0x6975('0x14')][_0x6975('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x262caf['options']?_0x262caf[_0x6975('0x14')][_0x6975('0x1a')]||null:null,'attributes':_0x262caf[_0x6975('0x14')]?_0x262caf[_0x6975('0x14')][_0x6975('0x1b')]||null:null,'limit':_0x262caf[_0x6975('0x14')]?_0x262caf[_0x6975('0x14')]['limit']||null:null})[_0x6975('0x15')](function(_0x527ea9){logger['info'](_0x6975('0x17'),_0x262caf);logger['debug']('UpdateSmsQueueReport',_0x262caf,JSON[_0x6975('0xd')](_0x527ea9));_0x45fb4c(_0x527ea9);})['catch'](function(_0x455b59){logger['error'](_0x6975('0x17'),_0x455b59['message'],_0x262caf);_0x26fecd(_0x33e191['error'](0x1f4,_0x455b59[_0x6975('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 57e2084..03dc9d0 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 _0x13f6=['post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','index','/:id','isAuthenticated','show'];(function(_0x2e0763,_0x37e6e4){var _0x189643=function(_0x20802b){while(--_0x20802b){_0x2e0763['push'](_0x2e0763['shift']());}};_0x189643(++_0x37e6e4);}(_0x13f6,0x124));var _0x613f=function(_0x21e6d0,_0x15fa42){_0x21e6d0=_0x21e6d0-0x0;var _0x3422b6=_0x13f6[_0x21e6d0];return _0x3422b6;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var auth=require(_0x613f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x613f('0x5'));var controller=require(_0x613f('0x6'));router[_0x613f('0x7')]('/',auth['isAuthenticated'](),controller[_0x613f('0x8')]);router[_0x613f('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x613f('0x9'),auth[_0x613f('0xa')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/',auth['isAuthenticated'](),controller[_0x613f('0xd')]);router[_0x613f('0xe')](_0x613f('0x9'),auth['isAuthenticated'](),controller[_0x613f('0xf')]);router[_0x613f('0x10')](_0x613f('0x9'),auth['isAuthenticated'](),controller[_0x613f('0x11')]);module[_0x613f('0x12')]=router; \ No newline at end of file +var _0x4fc2=['./smsTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1f9a8e,_0x435967){var _0x3bd851=function(_0x246d27){while(--_0x246d27){_0x1f9a8e['push'](_0x1f9a8e['shift']());}};_0x3bd851(++_0x435967);}(_0x4fc2,0x111));var _0x24fc=function(_0x334e39,_0x16f47f){_0x334e39=_0x334e39-0x0;var _0x158b6c=_0x4fc2[_0x334e39];return _0x158b6c;};'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')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/describe',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['post']('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0xe')]);router[_0x24fc('0xf')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x10')]);router[_0x24fc('0x11')](_0x24fc('0xc'),auth['isAuthenticated'](),controller[_0x24fc('0x12')]);module[_0x24fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a6f85aa..a099893 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 _0x471e=['ENUM','agent','queue','DATE','exports'];(function(_0x5db1a7,_0x5853d0){var _0x16fc33=function(_0x951905){while(--_0x951905){_0x5db1a7['push'](_0x5db1a7['shift']());}};_0x16fc33(++_0x5853d0);}(_0x471e,0x1bc));var _0xe471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471e[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe471('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe471('0x1')]('account',_0xe471('0x2'),_0xe471('0x3')),'allowNull':![],'defaultValue':_0xe471('0x3')},'transferredAt':{'type':Sequelize[_0xe471('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xc7c3=['agent','DATE','sequelize','exports','STRING'];(function(_0x37d2c3,_0x2ef0cd){var _0x2583f1=function(_0x5d40c5){while(--_0x5d40c5){_0x37d2c3['push'](_0x37d2c3['shift']());}};_0x2583f1(++_0x2ef0cd);}(_0xc7c3,0xcf));var _0x3c7c=function(_0x26736e,_0x4abc98){_0x26736e=_0x26736e-0x0;var _0x3746e2=_0xc7c3[_0x26736e];return _0x3746e2;};'use strict';var moment=require('moment');var Sequelize=require(_0x3c7c('0x0'));module[_0x3c7c('0x1')]={'uniqueid':{'type':Sequelize[_0x3c7c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x3c7c('0x3'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x3c7c('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 2da9c46..b69cd09 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 _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5a66e2,_0x217ae8){var _0x1a23b8=function(_0x32727b){while(--_0x32727b){_0x5a66e2['push'](_0x5a66e2['shift']());}};_0x1a23b8(++_0x217ae8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['SmsTransferReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['SmsTransferReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file +var _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5c1dbe,_0x1e32d9){var _0x5c037d=function(_0x24784d){while(--_0x24784d){_0x5c1dbe['push'](_0x5c1dbe['shift']());}};_0x5c037d(++_0x1e32d9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['SmsTransferReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['SmsTransferReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3186dc1..4d58b67 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 _0xe8fe=['bluebird','path','rimraf','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','moment'];(function(_0x13e9d4,_0x25483d){var _0x2c62b8=function(_0x4c5ffb){while(--_0x4c5ffb){_0x13e9d4['push'](_0x13e9d4['shift']());}};_0x2c62b8(++_0x25483d);}(_0xe8fe,0xee));var _0xee8f=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xe8fe[_0xe0b81f];return _0x290e5e;};'use strict';var _=require(_0xee8f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xee8f('0x1'));var BPromise=require(_0xee8f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee8f('0x3'));var rimraf=require(_0xee8f('0x4'));var config=require('../../config/environment');var attributes=require(_0xee8f('0x5'));module['exports']=function(_0x598433,_0x56b247){return _0x598433[_0xee8f('0x6')](_0xee8f('0x7'),attributes,{'tableName':_0xee8f('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xee8f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21c7=['path','rimraf','./smsTransferReport.attributes','define','uniqueid','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x21c7,0x7d));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x721c('0x0'))(_0x721c('0x1'));var moment=require(_0x721c('0x2'));var BPromise=require(_0x721c('0x3'));var rp=require(_0x721c('0x4'));var fs=require('fs');var path=require(_0x721c('0x5'));var rimraf=require(_0x721c('0x6'));var config=require('../../config/environment');var attributes=require(_0x721c('0x7'));module['exports']=function(_0x1bd285,_0x852b8e){return _0x1bd285[_0x721c('0x8')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x721c('0x9'),'fields':[_0x721c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 9140440..4c35435 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 _0xd648=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xd648,0x149));var _0x8d64=function(_0x535617,_0x4ab728){_0x535617=_0x535617-0x0;var _0x4bf3c5=_0xd648[_0x535617];return _0x4bf3c5;};'use strict';var _=require(_0x8d64('0x0'));var util=require(_0x8d64('0x1'));var moment=require('moment');var BPromise=require(_0x8d64('0x2'));var rs=require(_0x8d64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d64('0x4'))['db'];var utils=require(_0x8d64('0x5'));var logger=require(_0x8d64('0x6'))(_0x8d64('0x7'));var config=require(_0x8d64('0x8'));var jayson=require(_0x8d64('0x9'));var client=jayson['client'][_0x8d64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x178548,_0x1604a6,_0x242370){return new BPromise(function(_0x535c52,_0xe54dcd){return client[_0x8d64('0xb')](_0x178548,_0x242370)[_0x8d64('0xc')](function(_0x1ab523){logger[_0x8d64('0xd')](_0x8d64('0xe'),_0x1604a6,_0x8d64('0xf'));logger['debug'](_0x8d64('0x10'),_0x1604a6,'request\x20sent',JSON[_0x8d64('0x11')](_0x1ab523));if(_0x1ab523[_0x8d64('0x12')]){if(_0x1ab523[_0x8d64('0x12')][_0x8d64('0x13')]===0x1f4){logger[_0x8d64('0x12')](_0x8d64('0xe'),_0x1604a6,_0x1ab523[_0x8d64('0x12')]['message']);return _0xe54dcd(_0x1ab523['error'][_0x8d64('0x14')]);}logger[_0x8d64('0x12')](_0x8d64('0xe'),_0x1604a6,_0x1ab523[_0x8d64('0x12')]['message']);return _0x535c52(_0x1ab523[_0x8d64('0x12')][_0x8d64('0x14')]);}else{logger[_0x8d64('0xd')](_0x8d64('0xe'),_0x1604a6,_0x8d64('0xf'));_0x535c52(_0x1ab523[_0x8d64('0x15')]['message']);}})[_0x8d64('0x16')](function(_0x185cca){logger[_0x8d64('0x12')](_0x8d64('0xe'),_0x1604a6,_0x185cca);_0xe54dcd(_0x185cca);});});} \ No newline at end of file +var _0x43a1=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x43a1,0x6d));var _0x143a=function(_0x24c86a,_0x4131b5){_0x24c86a=_0x24c86a-0x0;var _0x3412ff=_0x43a1[_0x24c86a];return _0x3412ff;};'use strict';var _=require(_0x143a('0x0'));var util=require(_0x143a('0x1'));var moment=require(_0x143a('0x2'));var BPromise=require(_0x143a('0x3'));var rs=require(_0x143a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x143a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x143a('0x6'));var config=require('../../config/environment');var jayson=require(_0x143a('0x7'));var client=jayson[_0x143a('0x8')][_0x143a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x263ca7,_0x384e5d,_0x1d8e04){return new BPromise(function(_0x33095d,_0x493f68){return client[_0x143a('0xa')](_0x263ca7,_0x1d8e04)['then'](function(_0x4b67bd){logger[_0x143a('0xb')](_0x143a('0xc'),_0x384e5d,_0x143a('0xd'));logger['debug'](_0x143a('0xe'),_0x384e5d,_0x143a('0xd'),JSON[_0x143a('0xf')](_0x4b67bd));if(_0x4b67bd[_0x143a('0x10')]){if(_0x4b67bd['error'][_0x143a('0x11')]===0x1f4){logger[_0x143a('0x10')](_0x143a('0xc'),_0x384e5d,_0x4b67bd['error'][_0x143a('0x12')]);return _0x493f68(_0x4b67bd[_0x143a('0x10')][_0x143a('0x12')]);}logger[_0x143a('0x10')](_0x143a('0xc'),_0x384e5d,_0x4b67bd[_0x143a('0x10')]['message']);return _0x33095d(_0x4b67bd['error'][_0x143a('0x12')]);}else{logger[_0x143a('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x384e5d,_0x143a('0xd'));_0x33095d(_0x4b67bd[_0x143a('0x13')][_0x143a('0x12')]);}})[_0x143a('0x14')](function(_0x5a8c8b){logger['error'](_0x143a('0xc'),_0x384e5d,_0x5a8c8b);_0x493f68(_0x5a8c8b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0a81e9a..8fd002f 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 _0x7f46=['now','post','single','file','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','download','diskStorage','join','root','originalname','replace','%s-%s%s','basename','extname'];(function(_0x238d71,_0x16cf3b){var _0x22491a=function(_0x3b3ce3){while(--_0x3b3ce3){_0x238d71['push'](_0x238d71['shift']());}};_0x22491a(++_0x16cf3b);}(_0x7f46,0xd3));var _0x67f4=function(_0x372915,_0x2dbd58){_0x372915=_0x372915-0x0;var _0x42ea51=_0x7f46[_0x372915];return _0x42ea51;};'use strict';var multer=require('multer');var util=require(_0x67f4('0x0'));var path=require(_0x67f4('0x1'));var timeout=require(_0x67f4('0x2'));var express=require(_0x67f4('0x3'));var router=express[_0x67f4('0x4')]();var auth=require(_0x67f4('0x5'));var interaction=require(_0x67f4('0x6'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x67f4('0x7')]('/',auth[_0x67f4('0x8')](),controller[_0x67f4('0x9')]);router[_0x67f4('0x7')](_0x67f4('0xa'),auth['isAuthenticated'](),controller[_0x67f4('0xb')]);router[_0x67f4('0x7')]('/:id/download',auth[_0x67f4('0x8')](),controller[_0x67f4('0xc')]);var upload=multer({'storage':multer[_0x67f4('0xd')]({'destination':function(_0x4eb775,_0x474029,_0x57a942){_0x57a942(null,path[_0x67f4('0xe')](config[_0x67f4('0xf')],'server/files/sounds/original/'));},'filename':function(_0x2dd405,_0x21a177,_0x6c39e7){_0x21a177[_0x67f4('0x10')]=_0x21a177[_0x67f4('0x10')][_0x67f4('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x6c39e7(null,util['format'](_0x67f4('0x12'),path[_0x67f4('0x13')](_0x21a177[_0x67f4('0x10')],path[_0x67f4('0x14')](_0x21a177[_0x67f4('0x10')])),Date[_0x67f4('0x15')](),path[_0x67f4('0x14')](_0x21a177['originalname'])));}})});router[_0x67f4('0x16')]('/',upload[_0x67f4('0x17')](_0x67f4('0x18')),controller['create']);router[_0x67f4('0x19')]('/:id',auth[_0x67f4('0x8')](),controller[_0x67f4('0x1a')]);router[_0x67f4('0x1b')](_0x67f4('0xa'),auth[_0x67f4('0x8')](),controller[_0x67f4('0x1b')]);module[_0x67f4('0x1c')]=router; \ No newline at end of file +var _0xd6bd=['../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','format','basename','extname','post','single','file','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xb4a263,_0x260cab){var _0x3179af=function(_0x13c55a){while(--_0x13c55a){_0xb4a263['push'](_0xb4a263['shift']());}};_0x3179af(++_0x260cab);}(_0xd6bd,0xe9));var _0xdd6b=function(_0x5c08ae,_0x504511){_0x5c08ae=_0x5c08ae-0x0;var _0x191f67=_0xd6bd[_0x5c08ae];return _0x191f67;};'use strict';var multer=require(_0xdd6b('0x0'));var util=require(_0xdd6b('0x1'));var path=require(_0xdd6b('0x2'));var timeout=require(_0xdd6b('0x3'));var express=require(_0xdd6b('0x4'));var router=express[_0xdd6b('0x5')]();var auth=require(_0xdd6b('0x6'));var interaction=require(_0xdd6b('0x7'));var config=require('../../config/environment');var controller=require(_0xdd6b('0x8'));router[_0xdd6b('0x9')]('/',auth['isAuthenticated'](),controller[_0xdd6b('0xa')]);router[_0xdd6b('0x9')](_0xdd6b('0xb'),auth[_0xdd6b('0xc')](),controller[_0xdd6b('0xd')]);router[_0xdd6b('0x9')](_0xdd6b('0xe'),auth['isAuthenticated'](),controller[_0xdd6b('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52deb2,_0x52e996,_0x11964f){_0x11964f(null,path[_0xdd6b('0x10')](config[_0xdd6b('0x11')],_0xdd6b('0x12')));},'filename':function(_0xd51072,_0x517f9d,_0x15dab5){_0x517f9d['originalname']=_0x517f9d[_0xdd6b('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x15dab5(null,util[_0xdd6b('0x14')]('%s-%s%s',path[_0xdd6b('0x15')](_0x517f9d[_0xdd6b('0x13')],path[_0xdd6b('0x16')](_0x517f9d['originalname'])),Date['now'](),path[_0xdd6b('0x16')](_0x517f9d[_0xdd6b('0x13')])));}})});router[_0xdd6b('0x17')]('/',upload[_0xdd6b('0x18')](_0xdd6b('0x19')),controller[_0xdd6b('0x1a')]);router[_0xdd6b('0x1b')](_0xdd6b('0xb'),auth[_0xdd6b('0xc')](),controller['update']);router[_0xdd6b('0x1c')](_0xdd6b('0xb'),auth[_0xdd6b('0xc')](),controller[_0xdd6b('0x1c')]);module[_0xdd6b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 8d45667..a552030 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 _0x2ba4=['exports','STRING','FLOAT','INTEGER','BIGINT'];(function(_0x4c8be8,_0x513efa){var _0x12ea7c=function(_0x11f43f){while(--_0x11f43f){_0x4c8be8['push'](_0x4c8be8['shift']());}};_0x12ea7c(++_0x513efa);}(_0x2ba4,0x91));var _0x42ba=function(_0x271db5,_0x3d62c8){_0x271db5=_0x271db5-0x0;var _0x5363a8=_0x2ba4[_0x271db5];return _0x5363a8;};'use strict';var Sequelize=require('sequelize');module[_0x42ba('0x0')]={'name':{'type':Sequelize[_0x42ba('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x42ba('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x42ba('0x1')]},'original_duration':{'type':Sequelize[_0x42ba('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x42ba('0x3')]},'original_bitRate':{'type':Sequelize[_0x42ba('0x4')]},'original_sampleRate':{'type':Sequelize[_0x42ba('0x3')]},'converted_format':{'type':Sequelize[_0x42ba('0x1')]},'converted_duration':{'type':Sequelize[_0x42ba('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x42ba('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x42ba('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x42ba('0x3')]}}; \ No newline at end of file +var _0x3937=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x3937,0x1a5));var _0x7393=function(_0x20d443,_0x2d6a87){_0x20d443=_0x20d443-0x0;var _0x249cc4=_0x3937[_0x20d443];return _0x249cc4;};'use strict';var Sequelize=require(_0x7393('0x0'));module[_0x7393('0x1')]={'name':{'type':Sequelize[_0x7393('0x2')],'unique':_0x7393('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7393('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x7393('0x2')]},'original_format':{'type':Sequelize[_0x7393('0x2')]},'original_duration':{'type':Sequelize[_0x7393('0x4')]},'original_sampleCount':{'type':Sequelize[_0x7393('0x5')]},'original_channelCount':{'type':Sequelize[_0x7393('0x6')]},'original_bitRate':{'type':Sequelize[_0x7393('0x5')]},'original_sampleRate':{'type':Sequelize[_0x7393('0x6')]},'converted_format':{'type':Sequelize[_0x7393('0x2')]},'converted_duration':{'type':Sequelize[_0x7393('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x7393('0x5')]},'converted_channelCount':{'type':Sequelize[_0x7393('0x6')]},'converted_bitRate':{'type':Sequelize[_0x7393('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1755e5e..5cbb680 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 _0xdf72=['desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','map','Sound','fieldName','type','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','rawAttributes','keys','find','params','converted_format','join','save_name','Sequelize','ValidationError','Sound\x20not\x20found','download','root','server/files/sounds/converted','format','create','basename','file','originalname','filename','extname','server/files/sounds/original','%s.%s','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','delete','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','crypto','jsforce'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0xdf72,0x155));var _0x2df7=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xdf72[_0x38c652];return _0x218a37;};'use strict';var pdf=require(_0x2df7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2df7('0x1'));var zipdir=require(_0x2df7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2df7('0x3'));var moment=require(_0x2df7('0x4'));var BPromise=require(_0x2df7('0x5'));var Mustache=require(_0x2df7('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2df7('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2df7('0x8'));var jsforce=require(_0x2df7('0x9'));var deskjs=require(_0x2df7('0xa'));var toCsv=require(_0x2df7('0x7'));var querystring=require(_0x2df7('0xb'));var Papa=require(_0x2df7('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2df7('0xd'));var as=require(_0x2df7('0xe'));var hardwareService=require(_0x2df7('0xf'));var logger=require(_0x2df7('0x10'))(_0x2df7('0x11'));var utils=require(_0x2df7('0x12'));var config=require(_0x2df7('0x13'));var db=require(_0x2df7('0x14'))['db'];function respondWithStatusCode(_0x4bd23a,_0x55cb12){_0x55cb12=_0x55cb12||0xcc;return function(_0x1f03ea){if(_0x1f03ea){return _0x4bd23a[_0x2df7('0x15')](_0x55cb12);}return _0x4bd23a['status'](_0x55cb12)['end']();};}function respondWithResult(_0x20f593,_0x57f2ce){_0x57f2ce=_0x57f2ce||0xc8;return function(_0x4b36d0){if(_0x4b36d0){return _0x20f593[_0x2df7('0x16')](_0x57f2ce)[_0x2df7('0x17')](_0x4b36d0);}};}function respondWithFilteredResult(_0x13cc45,_0x2607f3){return function(_0x3e4bce){if(_0x3e4bce){var _0x4fa453=_0x3e4bce['count'],_0x1322ca=_0x2607f3[_0x2df7('0x18')],_0x4bae65=_0x2607f3[_0x2df7('0x18')]+_0x2607f3[_0x2df7('0x19')],_0x4777bb;if(_0x4bae65>=_0x4fa453){_0x4bae65=_0x4fa453;_0x4777bb=0xc8;}else{_0x4777bb=0xce;}_0x13cc45['status'](_0x4777bb);return _0x13cc45[_0x2df7('0x1a')](_0x2df7('0x1b'),_0x1322ca+'-'+_0x4bae65+'/'+_0x4fa453)[_0x2df7('0x17')](_0x3e4bce);}return null;};}function patchUpdates(_0x465959){return function(_0xd8c44e){try{jsonpatch[_0x2df7('0x1c')](_0xd8c44e,_0x465959,!![]);}catch(_0x5b71b3){return BPromise['reject'](_0x5b71b3);}return _0xd8c44e['save']();};}function saveUpdates(_0x12b3ea,_0x236ff9){return function(_0x2a446c){if(_0x2a446c){return _0x2a446c['update'](_0x12b3ea)[_0x2df7('0x1d')](function(_0x1805bf){return _0x1805bf;});}return null;};}function removeEntity(_0x89212e,_0xcf3337){return function(_0x32d936){if(_0x32d936){return _0x32d936['destroy']()[_0x2df7('0x1d')](function(){var _0x234a2c=_0x32d936[_0x2df7('0x1e')]({'plain':!![]});var _0x5e421f='Sounds';return db[_0x2df7('0x1f')][_0x2df7('0x20')]({'where':{'type':_0x5e421f,'resourceId':_0x234a2c['id']}})[_0x2df7('0x1d')](function(){return _0x32d936;});})[_0x2df7('0x1d')](function(){_0x89212e[_0x2df7('0x16')](0xcc)[_0x2df7('0x21')]();});}};}function handleEntityNotFound(_0x5a207a,_0x33bbfa){return function(_0x4cc73d){if(!_0x4cc73d){_0x5a207a['sendStatus'](0x194);}return _0x4cc73d;};}function handleError(_0x5bebb9,_0x18a558){_0x18a558=_0x18a558||0x1f4;return function(_0x58d36b){logger[_0x2df7('0x22')](_0x58d36b[_0x2df7('0x23')]);if(_0x58d36b[_0x2df7('0x24')]){delete _0x58d36b[_0x2df7('0x24')];}_0x5bebb9[_0x2df7('0x16')](_0x18a558)[_0x2df7('0x25')](_0x58d36b);};}exports[_0x2df7('0x26')]=function(_0xa12041,_0x2eae65){var _0x244083={},_0x17296d={},_0x54c5c4={'count':0x0,'rows':[]};var _0x43e051=_[_0x2df7('0x27')](db[_0x2df7('0x28')]['rawAttributes'],function(_0x1d3b62){return{'name':_0x1d3b62[_0x2df7('0x29')],'type':_0x1d3b62[_0x2df7('0x2a')]['key']};});_0x17296d['model']=_[_0x2df7('0x27')](_0x43e051,_0x2df7('0x24'));_0x17296d['query']=_['keys'](_0xa12041['query']);_0x17296d[_0x2df7('0x2b')]=_['intersection'](_0x17296d[_0x2df7('0x2c')],_0x17296d[_0x2df7('0x2d')]);_0x244083[_0x2df7('0x2e')]=_[_0x2df7('0x2f')](_0x17296d[_0x2df7('0x2c')],qs[_0x2df7('0x30')](_0xa12041[_0x2df7('0x2d')][_0x2df7('0x30')]));_0x244083['attributes']=_0x244083[_0x2df7('0x2e')][_0x2df7('0x31')]?_0x244083[_0x2df7('0x2e')]:_0x17296d[_0x2df7('0x2c')];if(!_0xa12041[_0x2df7('0x2d')][_0x2df7('0x32')]('nolimit')){_0x244083['limit']=qs['limit'](_0xa12041[_0x2df7('0x2d')][_0x2df7('0x19')]);_0x244083[_0x2df7('0x18')]=qs[_0x2df7('0x18')](_0xa12041['query'][_0x2df7('0x18')]);}_0x244083[_0x2df7('0x33')]=qs[_0x2df7('0x34')](_0xa12041[_0x2df7('0x2d')]['sort']);_0x244083[_0x2df7('0x35')]=qs['filters'](_[_0x2df7('0x36')](_0xa12041[_0x2df7('0x2d')],_0x17296d[_0x2df7('0x2b')]),_0x43e051);if(_0xa12041[_0x2df7('0x2d')][_0x2df7('0x37')]){_0x244083[_0x2df7('0x35')]=_[_0x2df7('0x38')](_0x244083[_0x2df7('0x35')],{'$or':_['map'](_0x43e051,function(_0x234301){if(_0x234301['type']!==_0x2df7('0x39')){var _0xe3372a={};_0xe3372a[_0x234301[_0x2df7('0x24')]]={'$like':'%'+_0xa12041[_0x2df7('0x2d')]['filter']+'%'};return _0xe3372a;}})});}_0x244083=_[_0x2df7('0x38')]({},_0x244083,_0xa12041[_0x2df7('0x3a')]);var _0x4b0e4f={'where':_0x244083['where']};return db[_0x2df7('0x28')][_0x2df7('0x3b')](_0x4b0e4f)[_0x2df7('0x1d')](function(_0x48517b){_0x54c5c4[_0x2df7('0x3b')]=_0x48517b;if(_0xa12041[_0x2df7('0x2d')][_0x2df7('0x3c')]){_0x244083[_0x2df7('0x3d')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x244083);})[_0x2df7('0x1d')](function(_0x4d888d){_0x54c5c4['rows']=_0x4d888d;return _0x54c5c4;})[_0x2df7('0x1d')](respondWithFilteredResult(_0x2eae65,_0x244083))[_0x2df7('0x3e')](handleError(_0x2eae65,null));};exports[_0x2df7('0x3f')]=function(_0xae7331,_0x2fb727){var _0x267878={'raw':!![],'where':{'id':_0xae7331['params']['id']}},_0x512fe4={};_0x512fe4[_0x2df7('0x2c')]=_['keys'](db[_0x2df7('0x28')][_0x2df7('0x40')]);_0x512fe4['query']=_[_0x2df7('0x41')](_0xae7331[_0x2df7('0x2d')]);_0x512fe4[_0x2df7('0x2b')]=_[_0x2df7('0x2f')](_0x512fe4[_0x2df7('0x2c')],_0x512fe4[_0x2df7('0x2d')]);_0x267878[_0x2df7('0x2e')]=_[_0x2df7('0x2f')](_0x512fe4[_0x2df7('0x2c')],qs[_0x2df7('0x30')](_0xae7331['query'][_0x2df7('0x30')]));_0x267878[_0x2df7('0x2e')]=_0x267878[_0x2df7('0x2e')]['length']?_0x267878['attributes']:_0x512fe4[_0x2df7('0x2c')];if(_0xae7331['query'][_0x2df7('0x3c')]){_0x267878['include']=[{'all':!![]}];}_0x267878=_[_0x2df7('0x38')]({},_0x267878,_0xae7331['options']);return db[_0x2df7('0x28')][_0x2df7('0x42')](_0x267878)[_0x2df7('0x1d')](handleEntityNotFound(_0x2fb727,null))[_0x2df7('0x1d')](respondWithResult(_0x2fb727,null))[_0x2df7('0x3e')](handleError(_0x2fb727,null));};exports['download']=function(_0x3de01f,_0x3b1cfa,_0x21d358){return db[_0x2df7('0x28')]['find']({'where':{'id':_0x3de01f[_0x2df7('0x43')]['id']},'attributes':[_0x2df7('0x24'),'save_name',_0x2df7('0x44')],'raw':!![]})[_0x2df7('0x1d')](handleEntityNotFound(_0x3b1cfa,null))[_0x2df7('0x1d')](function(_0x69e59e){if(_0x69e59e){if(!fs['existsSync'](path[_0x2df7('0x45')](config['root'],'server/files/sounds/converted',_0x69e59e[_0x2df7('0x46')]+'.'+_0x69e59e[_0x2df7('0x44')]))){throw new db[(_0x2df7('0x47'))][(_0x2df7('0x48'))](_0x2df7('0x49'));}return _0x3b1cfa[_0x2df7('0x4a')](path[_0x2df7('0x45')](config[_0x2df7('0x4b')],_0x2df7('0x4c'),util[_0x2df7('0x4d')]('%s.%s',_0x69e59e[_0x2df7('0x46')],_0x69e59e[_0x2df7('0x44')])),util['format']('%s.%s',_0x69e59e[_0x2df7('0x24')],_0x69e59e[_0x2df7('0x44')]));}return null;})[_0x2df7('0x3e')](handleError(_0x3b1cfa,null));};exports[_0x2df7('0x4e')]=function(_0x2cc641,_0x5ee59f,_0x521837){var _0x15b45d={'name':path[_0x2df7('0x4f')](_0x2cc641[_0x2df7('0x50')][_0x2df7('0x51')],path['extname'](_0x2cc641['file']['originalname'])),'save_name':path[_0x2df7('0x4f')](_0x2cc641[_0x2df7('0x50')][_0x2df7('0x52')],path['extname'](_0x2cc641[_0x2df7('0x50')][_0x2df7('0x52')])),'original_format':path[_0x2df7('0x53')](_0x2cc641[_0x2df7('0x50')][_0x2df7('0x51')])['substring'](0x1),'converted_format':'wav'};var _0x449a3e=path[_0x2df7('0x45')](config[_0x2df7('0x4b')],_0x2df7('0x54'),_0x2cc641[_0x2df7('0x50')][_0x2df7('0x52')]);var _0x3a493e=path[_0x2df7('0x45')](config[_0x2df7('0x4b')],_0x2df7('0x4c'),util[_0x2df7('0x4d')](_0x2df7('0x55'),path[_0x2df7('0x4f')](_0x2cc641[_0x2df7('0x50')]['filename'],path['extname'](_0x2cc641[_0x2df7('0x50')][_0x2df7('0x52')])),_0x15b45d['converted_format']));logger['info'](_0x2df7('0x56'),_0x449a3e);logger[_0x2df7('0x57')](_0x2df7('0x58'),_0x3a493e);try{fs['chmodSync'](_0x449a3e,parseInt(_0x2df7('0x59'),0x8));var _0x54d12b=sox[_0x2df7('0x5a')](_0x449a3e,_0x3a493e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x54d12b['on'](_0x2df7('0x22'),function(_0x37f5bf){fs[_0x2df7('0x5b')](_0x449a3e);_0x5ee59f['status'](0x1f4)[_0x2df7('0x25')](_0x37f5bf);});_0x54d12b['on'](_0x2df7('0x5c'),function(_0x1e200b){_0x15b45d[_0x2df7('0x5d')]=isNaN(_0x1e200b[_0x2df7('0x5e')])?null:_0x1e200b[_0x2df7('0x5e')]*0x3e8;_0x15b45d[_0x2df7('0x5f')]=isNaN(_0x1e200b[_0x2df7('0x60')])?null:_0x1e200b[_0x2df7('0x60')];_0x15b45d[_0x2df7('0x61')]=isNaN(_0x1e200b[_0x2df7('0x62')])?null:_0x1e200b[_0x2df7('0x62')];_0x15b45d['original_bitRate']=isNaN(_0x1e200b['bitRate'])?null:_0x1e200b['bitRate'];_0x15b45d[_0x2df7('0x63')]=isNaN(_0x1e200b['sampleRate'])?null:_0x1e200b[_0x2df7('0x64')];});_0x54d12b['on'](_0x2df7('0x65'),function(_0x577ebc){_0x15b45d[_0x2df7('0x66')]=isNaN(_0x577ebc[_0x2df7('0x5e')])?null:_0x577ebc[_0x2df7('0x5e')]*0x3e8;_0x15b45d[_0x2df7('0x67')]=isNaN(_0x577ebc[_0x2df7('0x60')])?null:_0x577ebc[_0x2df7('0x60')];_0x15b45d['converted_channelCount']=isNaN(_0x577ebc['channelCount'])?null:_0x577ebc[_0x2df7('0x62')];_0x15b45d['converted_bitRate']=isNaN(_0x577ebc[_0x2df7('0x68')])?null:_0x577ebc[_0x2df7('0x68')];_0x15b45d[_0x2df7('0x69')]=isNaN(_0x577ebc[_0x2df7('0x64')])?null:_0x577ebc['sampleRate'];});_0x54d12b['on'](_0x2df7('0x21'),function(){fs['chmodSync'](_0x3a493e,parseInt('0777',0x8));return db['Sound'][_0x2df7('0x4e')](_0x15b45d)['then'](function(_0x4739a2){var _0x188b87={'role':_0x2cc641[_0x2df7('0x6a')][_0x2df7('0x6b')],'userProfileId':_0x2cc641[_0x2df7('0x6a')][_0x2df7('0x6c')]};if(!_0x188b87)throw new Error(_0x2df7('0x6d'));if(_0x188b87[_0x2df7('0x6b')]===_0x2df7('0x6e')){var _0x33f5a8=_0x4739a2[_0x2df7('0x1e')]({'plain':!![]});return db[_0x2df7('0x6f')][_0x2df7('0x42')]({'where':{'name':_0x2df7('0x70'),'userProfileId':_0x188b87['userProfileId']},'raw':!![]})[_0x2df7('0x1d')](function(_0xec40b){if(_0xec40b&&_0xec40b[_0x2df7('0x71')]===0x0){return db[_0x2df7('0x1f')]['create']({'name':_0x33f5a8[_0x2df7('0x24')],'resourceId':_0x33f5a8['id'],'type':_0xec40b['name'],'sectionId':_0xec40b['id']},{})[_0x2df7('0x1d')](function(){return _0x4739a2;});}else{return _0x4739a2;}})['catch'](function(_0x3a0de5){logger['error'](_0x2df7('0x72'),_0x3a0de5);throw _0x3a0de5;});}return _0x4739a2;})[_0x2df7('0x1d')](respondWithResult(_0x5ee59f,null))[_0x2df7('0x3e')](handleError(_0x5ee59f,null));});_0x54d12b['start']();}catch(_0x466e08){_0x5ee59f['status'](0x1f4)[_0x2df7('0x25')](_0x466e08);}};exports[_0x2df7('0x73')]=function(_0x42e811,_0x37c3aa,_0x5ee957){return db['Sound'][_0x2df7('0x42')]({'where':{'id':_0x42e811[_0x2df7('0x43')]['id']}})['then'](handleEntityNotFound(_0x37c3aa,null))['then'](saveUpdates(_[_0x2df7('0x36')](_0x42e811[_0x2df7('0x6a')],[_0x2df7('0x24'),'description']),null))[_0x2df7('0x1d')](respondWithResult(_0x37c3aa,null))[_0x2df7('0x3e')](handleError(_0x37c3aa,null));};exports[_0x2df7('0x74')]=function(_0x172e33,_0x4ae0f8,_0x215121){return db['Sound'][_0x2df7('0x42')]({'where':{'id':_0x172e33[_0x2df7('0x43')]['id']}})[_0x2df7('0x1d')](function(_0x16d1fa){if(_0x16d1fa){return _0x16d1fa[_0x2df7('0x20')]();}})[_0x2df7('0x1d')](function(_0x4223b2){var _0x2efa16=path[_0x2df7('0x45')](config[_0x2df7('0x4b')],_0x2df7('0x54'),util[_0x2df7('0x4d')](_0x2df7('0x55'),_0x4223b2['save_name'],_0x4223b2['original_format']));var _0x58b080=path[_0x2df7('0x45')](config[_0x2df7('0x4b')],_0x2df7('0x4c'),util[_0x2df7('0x4d')]('%s.%s',_0x4223b2['save_name'],_0x4223b2[_0x2df7('0x44')]));fs['unlinkSync'](_0x2efa16);fs['unlinkSync'](_0x58b080);return _0x4223b2;})[_0x2df7('0x1d')](function(_0x5e7b54){if(_0x5e7b54){return _0x4ae0f8['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x4ae0f8,null))[_0x2df7('0x3e')](handleError(_0x4ae0f8,null));}; \ No newline at end of file +var _0x0c53=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','Sound','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x42f840,_0x1aa32e){var _0x47539f=function(_0x390a4b){while(--_0x390a4b){_0x42f840['push'](_0x42f840['shift']());}};_0x47539f(++_0x1aa32e);}(_0x0c53,0x1e1));var _0x30c5=function(_0x56b497,_0x388b63){_0x56b497=_0x56b497-0x0;var _0x95041=_0x0c53[_0x56b497];return _0x95041;};'use strict';var pdf=require(_0x30c5('0x0'));var emlformat=require(_0x30c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x30c5('0x2'));var jsonpatch=require(_0x30c5('0x3'));var rp=require(_0x30c5('0x4'));var moment=require(_0x30c5('0x5'));var BPromise=require(_0x30c5('0x6'));var Mustache=require('mustache');var util=require(_0x30c5('0x7'));var path=require(_0x30c5('0x8'));var sox=require(_0x30c5('0x9'));var csv=require('to-csv');var ejs=require(_0x30c5('0xa'));var fs=require('fs');var _=require(_0x30c5('0xb'));var squel=require(_0x30c5('0xc'));var crypto=require('crypto');var jsforce=require(_0x30c5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x30c5('0xe'));var querystring=require(_0x30c5('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x30c5('0x10'));var qs=require(_0x30c5('0x11'));var as=require(_0x30c5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x30c5('0x13'))(_0x30c5('0x14'));var utils=require(_0x30c5('0x15'));var config=require(_0x30c5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e8a6e,_0x55f04c){_0x55f04c=_0x55f04c||0xcc;return function(_0x3365d7){if(_0x3365d7){return _0x5e8a6e[_0x30c5('0x17')](_0x55f04c);}return _0x5e8a6e['status'](_0x55f04c)[_0x30c5('0x18')]();};}function respondWithResult(_0x4eba1a,_0x486de2){_0x486de2=_0x486de2||0xc8;return function(_0x1c12e2){if(_0x1c12e2){return _0x4eba1a['status'](_0x486de2)[_0x30c5('0x19')](_0x1c12e2);}};}function respondWithFilteredResult(_0xaa99d,_0xe2b3d8){return function(_0x54835f){if(_0x54835f){var _0x4611ee=_0x54835f[_0x30c5('0x1a')],_0x2fd335=_0xe2b3d8[_0x30c5('0x1b')],_0x263a1d=_0xe2b3d8[_0x30c5('0x1b')]+_0xe2b3d8[_0x30c5('0x1c')],_0x55143d;if(_0x263a1d>=_0x4611ee){_0x263a1d=_0x4611ee;_0x55143d=0xc8;}else{_0x55143d=0xce;}_0xaa99d[_0x30c5('0x1d')](_0x55143d);return _0xaa99d[_0x30c5('0x1e')](_0x30c5('0x1f'),_0x2fd335+'-'+_0x263a1d+'/'+_0x4611ee)[_0x30c5('0x19')](_0x54835f);}return null;};}function patchUpdates(_0x139de7){return function(_0x3df6d0){try{jsonpatch[_0x30c5('0x20')](_0x3df6d0,_0x139de7,!![]);}catch(_0x48b40f){return BPromise[_0x30c5('0x21')](_0x48b40f);}return _0x3df6d0[_0x30c5('0x22')]();};}function saveUpdates(_0x40ca13,_0x1e152f){return function(_0x3f2bfd){if(_0x3f2bfd){return _0x3f2bfd['update'](_0x40ca13)[_0x30c5('0x23')](function(_0x378496){return _0x378496;});}return null;};}function removeEntity(_0x27a45c,_0x5c22b1){return function(_0x580652){if(_0x580652){return _0x580652[_0x30c5('0x24')]()[_0x30c5('0x23')](function(){var _0xad22d5=_0x580652['get']({'plain':!![]});var _0x5386cc=_0x30c5('0x25');return db[_0x30c5('0x26')][_0x30c5('0x24')]({'where':{'type':_0x5386cc,'resourceId':_0xad22d5['id']}})[_0x30c5('0x23')](function(){return _0x580652;});})[_0x30c5('0x23')](function(){_0x27a45c['status'](0xcc)[_0x30c5('0x18')]();});}};}function handleEntityNotFound(_0x43ab27,_0x4cc81b){return function(_0x542cf1){if(!_0x542cf1){_0x43ab27[_0x30c5('0x17')](0x194);}return _0x542cf1;};}function handleError(_0x14cd82,_0x44576a){_0x44576a=_0x44576a||0x1f4;return function(_0x409104){logger[_0x30c5('0x27')](_0x409104[_0x30c5('0x28')]);if(_0x409104[_0x30c5('0x29')]){delete _0x409104[_0x30c5('0x29')];}_0x14cd82[_0x30c5('0x1d')](_0x44576a)[_0x30c5('0x2a')](_0x409104);};}exports[_0x30c5('0x2b')]=function(_0x3e2abe,_0x573ac2){var _0x2e9709={},_0x5224e3={},_0x495aa9={'count':0x0,'rows':[]};var _0x1b2257=_['map'](db[_0x30c5('0x2c')]['rawAttributes'],function(_0x2e5bc7){return{'name':_0x2e5bc7[_0x30c5('0x2d')],'type':_0x2e5bc7['type'][_0x30c5('0x2e')]};});_0x5224e3[_0x30c5('0x2f')]=_[_0x30c5('0x30')](_0x1b2257,'name');_0x5224e3[_0x30c5('0x31')]=_[_0x30c5('0x32')](_0x3e2abe[_0x30c5('0x31')]);_0x5224e3[_0x30c5('0x33')]=_[_0x30c5('0x34')](_0x5224e3[_0x30c5('0x2f')],_0x5224e3[_0x30c5('0x31')]);_0x2e9709[_0x30c5('0x35')]=_['intersection'](_0x5224e3[_0x30c5('0x2f')],qs[_0x30c5('0x36')](_0x3e2abe[_0x30c5('0x31')][_0x30c5('0x36')]));_0x2e9709['attributes']=_0x2e9709[_0x30c5('0x35')]['length']?_0x2e9709[_0x30c5('0x35')]:_0x5224e3[_0x30c5('0x2f')];if(!_0x3e2abe['query']['hasOwnProperty']('nolimit')){_0x2e9709[_0x30c5('0x1c')]=qs['limit'](_0x3e2abe['query'][_0x30c5('0x1c')]);_0x2e9709[_0x30c5('0x1b')]=qs[_0x30c5('0x1b')](_0x3e2abe['query'][_0x30c5('0x1b')]);}_0x2e9709[_0x30c5('0x37')]=qs[_0x30c5('0x38')](_0x3e2abe[_0x30c5('0x31')][_0x30c5('0x38')]);_0x2e9709[_0x30c5('0x39')]=qs[_0x30c5('0x33')](_[_0x30c5('0x3a')](_0x3e2abe['query'],_0x5224e3['filters']),_0x1b2257);if(_0x3e2abe[_0x30c5('0x31')][_0x30c5('0x3b')]){_0x2e9709[_0x30c5('0x39')]=_[_0x30c5('0x3c')](_0x2e9709[_0x30c5('0x39')],{'$or':_[_0x30c5('0x30')](_0x1b2257,function(_0x4539b6){if(_0x4539b6[_0x30c5('0x3d')]!==_0x30c5('0x3e')){var _0x1927c8={};_0x1927c8[_0x4539b6['name']]={'$like':'%'+_0x3e2abe[_0x30c5('0x31')][_0x30c5('0x3b')]+'%'};return _0x1927c8;}})});}_0x2e9709=_[_0x30c5('0x3c')]({},_0x2e9709,_0x3e2abe[_0x30c5('0x3f')]);var _0x389167={'where':_0x2e9709[_0x30c5('0x39')]};return db[_0x30c5('0x2c')][_0x30c5('0x1a')](_0x389167)[_0x30c5('0x23')](function(_0x2f4bd3){_0x495aa9[_0x30c5('0x1a')]=_0x2f4bd3;if(_0x3e2abe['query'][_0x30c5('0x40')]){_0x2e9709[_0x30c5('0x41')]=[{'all':!![]}];}return db[_0x30c5('0x2c')]['findAll'](_0x2e9709);})['then'](function(_0x4b92c3){_0x495aa9[_0x30c5('0x42')]=_0x4b92c3;return _0x495aa9;})[_0x30c5('0x23')](respondWithFilteredResult(_0x573ac2,_0x2e9709))[_0x30c5('0x43')](handleError(_0x573ac2,null));};exports['show']=function(_0x1bddcd,_0x844337){var _0x5b0a51={'raw':!![],'where':{'id':_0x1bddcd[_0x30c5('0x44')]['id']}},_0x5416c9={};_0x5416c9['model']=_['keys'](db[_0x30c5('0x2c')][_0x30c5('0x45')]);_0x5416c9[_0x30c5('0x31')]=_[_0x30c5('0x32')](_0x1bddcd['query']);_0x5416c9[_0x30c5('0x33')]=_['intersection'](_0x5416c9['model'],_0x5416c9[_0x30c5('0x31')]);_0x5b0a51[_0x30c5('0x35')]=_[_0x30c5('0x34')](_0x5416c9[_0x30c5('0x2f')],qs[_0x30c5('0x36')](_0x1bddcd[_0x30c5('0x31')]['fields']));_0x5b0a51[_0x30c5('0x35')]=_0x5b0a51[_0x30c5('0x35')]['length']?_0x5b0a51['attributes']:_0x5416c9['model'];if(_0x1bddcd[_0x30c5('0x31')][_0x30c5('0x40')]){_0x5b0a51[_0x30c5('0x41')]=[{'all':!![]}];}_0x5b0a51=_['merge']({},_0x5b0a51,_0x1bddcd['options']);return db['Sound'][_0x30c5('0x46')](_0x5b0a51)[_0x30c5('0x23')](handleEntityNotFound(_0x844337,null))[_0x30c5('0x23')](respondWithResult(_0x844337,null))[_0x30c5('0x43')](handleError(_0x844337,null));};exports[_0x30c5('0x47')]=function(_0x4f35c9,_0xeac05e,_0x5db9a7){return db[_0x30c5('0x2c')]['find']({'where':{'id':_0x4f35c9[_0x30c5('0x44')]['id']},'attributes':[_0x30c5('0x29'),_0x30c5('0x48'),_0x30c5('0x49')],'raw':!![]})[_0x30c5('0x23')](handleEntityNotFound(_0xeac05e,null))[_0x30c5('0x23')](function(_0x297bc8){if(_0x297bc8){if(!fs[_0x30c5('0x4a')](path[_0x30c5('0x4b')](config[_0x30c5('0x4c')],_0x30c5('0x4d'),_0x297bc8[_0x30c5('0x48')]+'.'+_0x297bc8[_0x30c5('0x49')]))){throw new db[(_0x30c5('0x4e'))][(_0x30c5('0x4f'))](_0x30c5('0x50'));}return _0xeac05e['download'](path['join'](config[_0x30c5('0x4c')],_0x30c5('0x4d'),util[_0x30c5('0x51')](_0x30c5('0x52'),_0x297bc8[_0x30c5('0x48')],_0x297bc8[_0x30c5('0x49')])),util[_0x30c5('0x51')](_0x30c5('0x52'),_0x297bc8[_0x30c5('0x29')],_0x297bc8[_0x30c5('0x49')]));}return null;})['catch'](handleError(_0xeac05e,null));};exports[_0x30c5('0x53')]=function(_0x5734c8,_0x4b02e6,_0x3abc7c){var _0x3c5bbf={'name':path[_0x30c5('0x54')](_0x5734c8[_0x30c5('0x55')]['originalname'],path['extname'](_0x5734c8[_0x30c5('0x55')][_0x30c5('0x56')])),'save_name':path['basename'](_0x5734c8[_0x30c5('0x55')][_0x30c5('0x57')],path[_0x30c5('0x58')](_0x5734c8[_0x30c5('0x55')][_0x30c5('0x57')])),'original_format':path[_0x30c5('0x58')](_0x5734c8['file'][_0x30c5('0x56')])[_0x30c5('0x59')](0x1),'converted_format':'wav'};var _0x18b586=path[_0x30c5('0x4b')](config[_0x30c5('0x4c')],_0x30c5('0x5a'),_0x5734c8[_0x30c5('0x55')]['filename']);var _0x507cdb=path['join'](config['root'],_0x30c5('0x4d'),util[_0x30c5('0x51')](_0x30c5('0x52'),path[_0x30c5('0x54')](_0x5734c8[_0x30c5('0x55')][_0x30c5('0x57')],path[_0x30c5('0x58')](_0x5734c8[_0x30c5('0x55')][_0x30c5('0x57')])),_0x3c5bbf[_0x30c5('0x49')]));logger['info'](_0x30c5('0x5b'),_0x18b586);logger[_0x30c5('0x5c')](_0x30c5('0x5d'),_0x507cdb);try{fs[_0x30c5('0x5e')](_0x18b586,parseInt(_0x30c5('0x5f'),0x8));var _0x587caf=sox[_0x30c5('0x60')](_0x18b586,_0x507cdb,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x587caf['on']('error',function(_0x4d56fb){fs[_0x30c5('0x61')](_0x18b586);_0x4b02e6[_0x30c5('0x1d')](0x1f4)[_0x30c5('0x2a')](_0x4d56fb);});_0x587caf['on'](_0x30c5('0x62'),function(_0xe9c70f){_0x3c5bbf[_0x30c5('0x63')]=isNaN(_0xe9c70f[_0x30c5('0x64')])?null:_0xe9c70f[_0x30c5('0x64')]*0x3e8;_0x3c5bbf[_0x30c5('0x65')]=isNaN(_0xe9c70f[_0x30c5('0x66')])?null:_0xe9c70f['sampleCount'];_0x3c5bbf[_0x30c5('0x67')]=isNaN(_0xe9c70f[_0x30c5('0x68')])?null:_0xe9c70f[_0x30c5('0x68')];_0x3c5bbf[_0x30c5('0x69')]=isNaN(_0xe9c70f[_0x30c5('0x6a')])?null:_0xe9c70f['bitRate'];_0x3c5bbf[_0x30c5('0x6b')]=isNaN(_0xe9c70f['sampleRate'])?null:_0xe9c70f[_0x30c5('0x6c')];});_0x587caf['on'](_0x30c5('0x6d'),function(_0x516549){_0x3c5bbf['converted_duration']=isNaN(_0x516549[_0x30c5('0x64')])?null:_0x516549[_0x30c5('0x64')]*0x3e8;_0x3c5bbf[_0x30c5('0x6e')]=isNaN(_0x516549[_0x30c5('0x66')])?null:_0x516549[_0x30c5('0x66')];_0x3c5bbf[_0x30c5('0x6f')]=isNaN(_0x516549[_0x30c5('0x68')])?null:_0x516549[_0x30c5('0x68')];_0x3c5bbf[_0x30c5('0x70')]=isNaN(_0x516549['bitRate'])?null:_0x516549['bitRate'];_0x3c5bbf[_0x30c5('0x71')]=isNaN(_0x516549['sampleRate'])?null:_0x516549['sampleRate'];});_0x587caf['on'](_0x30c5('0x18'),function(){fs['chmodSync'](_0x507cdb,parseInt(_0x30c5('0x5f'),0x8));return db['Sound'][_0x30c5('0x53')](_0x3c5bbf)[_0x30c5('0x23')](function(_0x2ca535){var _0x464fee={'role':_0x5734c8['body'][_0x30c5('0x72')],'userProfileId':_0x5734c8[_0x30c5('0x73')][_0x30c5('0x74')]};if(!_0x464fee)throw new Error(_0x30c5('0x75'));if(_0x464fee[_0x30c5('0x72')]==='user'){var _0x1710a6=_0x2ca535['get']({'plain':!![]});return db[_0x30c5('0x76')][_0x30c5('0x46')]({'where':{'name':_0x30c5('0x25'),'userProfileId':_0x464fee['userProfileId']},'raw':!![]})[_0x30c5('0x23')](function(_0x4c5272){if(_0x4c5272&&_0x4c5272['autoAssociation']===0x0){return db[_0x30c5('0x26')]['create']({'name':_0x1710a6[_0x30c5('0x29')],'resourceId':_0x1710a6['id'],'type':_0x4c5272[_0x30c5('0x29')],'sectionId':_0x4c5272['id']},{})[_0x30c5('0x23')](function(){return _0x2ca535;});}else{return _0x2ca535;}})[_0x30c5('0x43')](function(_0x4c8eab){logger[_0x30c5('0x27')](_0x30c5('0x77'),_0x4c8eab);throw _0x4c8eab;});}return _0x2ca535;})[_0x30c5('0x23')](respondWithResult(_0x4b02e6,null))['catch'](handleError(_0x4b02e6,null));});_0x587caf[_0x30c5('0x78')]();}catch(_0x544e4e){_0x4b02e6[_0x30c5('0x1d')](0x1f4)[_0x30c5('0x2a')](_0x544e4e);}};exports[_0x30c5('0x79')]=function(_0x1447bf,_0x58e45a,_0x5b5990){return db[_0x30c5('0x2c')][_0x30c5('0x46')]({'where':{'id':_0x1447bf[_0x30c5('0x44')]['id']}})[_0x30c5('0x23')](handleEntityNotFound(_0x58e45a,null))[_0x30c5('0x23')](saveUpdates(_[_0x30c5('0x3a')](_0x1447bf[_0x30c5('0x73')],[_0x30c5('0x29'),_0x30c5('0x7a')]),null))['then'](respondWithResult(_0x58e45a,null))['catch'](handleError(_0x58e45a,null));};exports[_0x30c5('0x7b')]=function(_0x45a127,_0x312363,_0x345e45){return db[_0x30c5('0x2c')][_0x30c5('0x46')]({'where':{'id':_0x45a127['params']['id']}})[_0x30c5('0x23')](function(_0x2bd7fd){if(_0x2bd7fd){return _0x2bd7fd[_0x30c5('0x24')]();}})['then'](function(_0x3f5712){var _0x1bc448=path[_0x30c5('0x4b')](config[_0x30c5('0x4c')],_0x30c5('0x5a'),util['format'](_0x30c5('0x52'),_0x3f5712[_0x30c5('0x48')],_0x3f5712[_0x30c5('0x7c')]));var _0x22d318=path[_0x30c5('0x4b')](config['root'],_0x30c5('0x4d'),util['format'](_0x30c5('0x52'),_0x3f5712[_0x30c5('0x48')],_0x3f5712[_0x30c5('0x49')]));fs['unlinkSync'](_0x1bc448);fs['unlinkSync'](_0x22d318);return _0x3f5712;})['then'](function(_0x3db872){if(_0x3db872){return _0x312363['status'](0xcc)[_0x30c5('0x18')]();}})['then'](handleEntityNotFound(_0x312363,null))[_0x30c5('0x43')](handleError(_0x312363,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 253e864..ab04d7c 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 _0x0597=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','../../config/logger'];(function(_0x576d5b,_0x1b8b7b){var _0x5b1f5e=function(_0xc8aa04){while(--_0xc8aa04){_0x576d5b['push'](_0x576d5b['shift']());}};_0x5b1f5e(++_0x1b8b7b);}(_0x0597,0xd7));var _0x7059=function(_0x1a4904,_0x2ad4c7){_0x1a4904=_0x1a4904-0x0;var _0x365663=_0x0597[_0x1a4904];return _0x365663;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7059('0x0'))(_0x7059('0x1'));var moment=require(_0x7059('0x2'));var BPromise=require(_0x7059('0x3'));var rp=require(_0x7059('0x4'));var fs=require('fs');var path=require(_0x7059('0x5'));var rimraf=require(_0x7059('0x6'));var config=require(_0x7059('0x7'));var attributes=require(_0x7059('0x8'));module[_0x7059('0x9')]=function(_0x1d95c0,_0x5d415e){return _0x1d95c0[_0x7059('0xa')](_0x7059('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20ae=['util','api','request-promise','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash'];(function(_0x3780c6,_0x126a4d){var _0xa2eae5=function(_0xf39820){while(--_0xf39820){_0x3780c6['push'](_0x3780c6['shift']());}};_0xa2eae5(++_0x126a4d);}(_0x20ae,0xd0));var _0xe20a=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x20ae[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xe20a('0x0'));var util=require(_0xe20a('0x1'));var logger=require('../../config/logger')(_0xe20a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe20a('0x3'));var fs=require('fs');var path=require(_0xe20a('0x4'));var rimraf=require(_0xe20a('0x5'));var config=require('../../config/environment');var attributes=require(_0xe20a('0x6'));module[_0xe20a('0x7')]=function(_0x4e2407,_0x2acc50){return _0x4e2407[_0xe20a('0x8')](_0xe20a('0x9'),attributes,{'tableName':_0xe20a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index bee9ebb..6866daf 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 _0x951d=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','Sound,\x20%s,\x20%s','result','catch','ShowSound','find','options','raw','where','attributes','map','include','model','util'];(function(_0x3d4e74,_0x21b4e5){var _0x57613d=function(_0x2fa3b3){while(--_0x2fa3b3){_0x3d4e74['push'](_0x3d4e74['shift']());}};_0x57613d(++_0x21b4e5);}(_0x951d,0xe7));var _0xd951=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x951d[_0x26d6d9];return _0x1b4875;};'use strict';var _=require('lodash');var util=require(_0xd951('0x0'));var moment=require(_0xd951('0x1'));var BPromise=require('bluebird');var rs=require(_0xd951('0x2'));var fs=require('fs');var Redis=require(_0xd951('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd951('0x4'));var logger=require(_0xd951('0x5'))(_0xd951('0x6'));var config=require(_0xd951('0x7'));var jayson=require(_0xd951('0x8'));var client=jayson['client'][_0xd951('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d34fa,_0x3a7e05,_0x44250e){return new BPromise(function(_0x4a29a1,_0x28fff6){return client['request'](_0x3d34fa,_0x44250e)['then'](function(_0x543e21){logger[_0xd951('0xa')]('Sound,\x20%s,\x20%s',_0x3a7e05,_0xd951('0xb'));logger[_0xd951('0xc')](_0xd951('0xd'),_0x3a7e05,_0xd951('0xb'),JSON[_0xd951('0xe')](_0x543e21));if(_0x543e21[_0xd951('0xf')]){if(_0x543e21[_0xd951('0xf')]['code']===0x1f4){logger[_0xd951('0xf')]('Sound,\x20%s,\x20%s',_0x3a7e05,_0x543e21[_0xd951('0xf')][_0xd951('0x10')]);return _0x28fff6(_0x543e21[_0xd951('0xf')]['message']);}logger['error'](_0xd951('0x11'),_0x3a7e05,_0x543e21[_0xd951('0xf')]['message']);return _0x4a29a1(_0x543e21[_0xd951('0xf')][_0xd951('0x10')]);}else{logger[_0xd951('0xa')](_0xd951('0x11'),_0x3a7e05,_0xd951('0xb'));_0x4a29a1(_0x543e21[_0xd951('0x12')][_0xd951('0x10')]);}})[_0xd951('0x13')](function(_0x1cc04d){logger['error'](_0xd951('0x11'),_0x3a7e05,_0x1cc04d);_0x28fff6(_0x1cc04d);});});}exports[_0xd951('0x14')]=function(_0x5a402c){var _0x4cb79f=this;return new Promise(function(_0x57141d,_0x2df2fb){return db['Sound'][_0xd951('0x15')]({'raw':_0x5a402c[_0xd951('0x16')]?_0x5a402c[_0xd951('0x16')][_0xd951('0x17')]===undefined?!![]:![]:!![],'where':_0x5a402c[_0xd951('0x16')]?_0x5a402c['options'][_0xd951('0x18')]||null:null,'attributes':_0x5a402c[_0xd951('0x16')]?_0x5a402c[_0xd951('0x16')][_0xd951('0x19')]||null:null,'include':_0x5a402c[_0xd951('0x16')]?_0x5a402c['options']['include']?_[_0xd951('0x1a')](_0x5a402c['options'][_0xd951('0x1b')],function(_0x4eef28){return{'model':db[_0x4eef28['model']],'as':_0x4eef28['as'],'attributes':_0x4eef28['attributes'],'include':_0x4eef28['include']?_[_0xd951('0x1a')](_0x4eef28[_0xd951('0x1b')],function(_0x105a63){return{'model':db[_0x105a63[_0xd951('0x1c')]],'as':_0x105a63['as'],'attributes':_0x105a63['attributes'],'include':_0x105a63[_0xd951('0x1b')]?_['map'](_0x105a63['include'],function(_0x39d321){return{'model':db[_0x39d321[_0xd951('0x1c')]],'as':_0x39d321['as'],'attributes':_0x39d321[_0xd951('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4876a2){logger[_0xd951('0xa')](_0xd951('0x14'),_0x5a402c);logger[_0xd951('0xc')](_0xd951('0x14'),_0x5a402c,JSON['stringify'](_0x4876a2));_0x57141d(_0x4876a2);})[_0xd951('0x13')](function(_0x29e5cb){logger[_0xd951('0xf')](_0xd951('0x14'),_0x29e5cb[_0xd951('0x10')],_0x5a402c);_0x2df2fb(_0x4cb79f[_0xd951('0xf')](0x1f4,_0x29e5cb['message']));});});}; \ No newline at end of file +var _0xdd15=['find','options','where','attributes','include','map','model','then','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSound','Sound'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdd15,0x169));var _0x5dd1=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0xdd15[_0x531d15];return _0x271a18;};'use strict';var _=require(_0x5dd1('0x0'));var util=require(_0x5dd1('0x1'));var moment=require(_0x5dd1('0x2'));var BPromise=require(_0x5dd1('0x3'));var rs=require(_0x5dd1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5dd1('0x5'));var logger=require(_0x5dd1('0x6'))(_0x5dd1('0x7'));var config=require(_0x5dd1('0x8'));var jayson=require(_0x5dd1('0x9'));var client=jayson['client'][_0x5dd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea127,_0x5ccaec,_0x329149){return new BPromise(function(_0x1ff2ac,_0x50d0cf){return client[_0x5dd1('0xb')](_0x4ea127,_0x329149)['then'](function(_0x42a989){logger[_0x5dd1('0xc')](_0x5dd1('0xd'),_0x5ccaec,_0x5dd1('0xe'));logger[_0x5dd1('0xf')](_0x5dd1('0x10'),_0x5ccaec,_0x5dd1('0xe'),JSON['stringify'](_0x42a989));if(_0x42a989[_0x5dd1('0x11')]){if(_0x42a989['error'][_0x5dd1('0x12')]===0x1f4){logger[_0x5dd1('0x11')](_0x5dd1('0xd'),_0x5ccaec,_0x42a989[_0x5dd1('0x11')][_0x5dd1('0x13')]);return _0x50d0cf(_0x42a989['error'][_0x5dd1('0x13')]);}logger['error'](_0x5dd1('0xd'),_0x5ccaec,_0x42a989[_0x5dd1('0x11')][_0x5dd1('0x13')]);return _0x1ff2ac(_0x42a989[_0x5dd1('0x11')][_0x5dd1('0x13')]);}else{logger[_0x5dd1('0xc')](_0x5dd1('0xd'),_0x5ccaec,_0x5dd1('0xe'));_0x1ff2ac(_0x42a989['result'][_0x5dd1('0x13')]);}})[_0x5dd1('0x14')](function(_0x2c4144){logger[_0x5dd1('0x11')]('Sound,\x20%s,\x20%s',_0x5ccaec,_0x2c4144);_0x50d0cf(_0x2c4144);});});}exports[_0x5dd1('0x15')]=function(_0x3d512b){var _0x4296b5=this;return new Promise(function(_0x344362,_0x1da6d4){return db[_0x5dd1('0x16')][_0x5dd1('0x17')]({'raw':_0x3d512b['options']?_0x3d512b[_0x5dd1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3d512b[_0x5dd1('0x18')]?_0x3d512b[_0x5dd1('0x18')][_0x5dd1('0x19')]||null:null,'attributes':_0x3d512b[_0x5dd1('0x18')]?_0x3d512b[_0x5dd1('0x18')][_0x5dd1('0x1a')]||null:null,'include':_0x3d512b[_0x5dd1('0x18')]?_0x3d512b[_0x5dd1('0x18')][_0x5dd1('0x1b')]?_[_0x5dd1('0x1c')](_0x3d512b['options'][_0x5dd1('0x1b')],function(_0x29f300){return{'model':db[_0x29f300['model']],'as':_0x29f300['as'],'attributes':_0x29f300[_0x5dd1('0x1a')],'include':_0x29f300['include']?_['map'](_0x29f300[_0x5dd1('0x1b')],function(_0x2b0981){return{'model':db[_0x2b0981[_0x5dd1('0x1d')]],'as':_0x2b0981['as'],'attributes':_0x2b0981[_0x5dd1('0x1a')],'include':_0x2b0981['include']?_[_0x5dd1('0x1c')](_0x2b0981[_0x5dd1('0x1b')],function(_0x30a2de){return{'model':db[_0x30a2de['model']],'as':_0x30a2de['as'],'attributes':_0x30a2de['attributes']};}):[]};}):[]};}):[]:[]})[_0x5dd1('0x1e')](function(_0x9ed649){logger[_0x5dd1('0xc')](_0x5dd1('0x15'),_0x3d512b);logger[_0x5dd1('0xf')]('ShowSound',_0x3d512b,JSON[_0x5dd1('0x1f')](_0x9ed649));_0x344362(_0x9ed649);})[_0x5dd1('0x14')](function(_0x9142eb){logger[_0x5dd1('0x11')]('ShowSound',_0x9142eb[_0x5dd1('0x13')],_0x3d512b);_0x1da6d4(_0x4296b5[_0x5dd1('0x11')](0x1f4,_0x9142eb[_0x5dd1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index f1d6ea9..96b1437 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 _0xb37e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','util'];(function(_0x419e67,_0x31e145){var _0x5f0945=function(_0x27ffcd){while(--_0x27ffcd){_0x419e67['push'](_0x419e67['shift']());}};_0x5f0945(++_0x31e145);}(_0xb37e,0x167));var _0xeb37=function(_0x1fc5f0,_0x3b1425){_0x1fc5f0=_0x1fc5f0-0x0;var _0x3fff72=_0xb37e[_0x1fc5f0];return _0x3fff72;};'use strict';var multer=require('multer');var util=require(_0xeb37('0x0'));var path=require(_0xeb37('0x1'));var timeout=require(_0xeb37('0x2'));var express=require(_0xeb37('0x3'));var router=express[_0xeb37('0x4')]();var auth=require(_0xeb37('0x5'));var interaction=require(_0xeb37('0x6'));var config=require(_0xeb37('0x7'));var controller=require(_0xeb37('0x8'));router['get']('/',auth[_0xeb37('0x9')](),controller[_0xeb37('0xa')]);router[_0xeb37('0xb')](_0xeb37('0xc'),auth[_0xeb37('0x9')](),controller[_0xeb37('0xd')]);router['post']('/',auth[_0xeb37('0x9')](),controller[_0xeb37('0xe')]);router[_0xeb37('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xeb37('0x10')]);router[_0xeb37('0x11')]('/:id',auth[_0xeb37('0x9')](),controller[_0xeb37('0x12')]);module[_0xeb37('0x13')]=router; \ No newline at end of file +var _0xb2c8=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb2c8,0x1ce));var _0x8b2c=function(_0x5e3806,_0x5c5c1b){_0x5e3806=_0x5e3806-0x0;var _0x25ccac=_0xb2c8[_0x5e3806];return _0x25ccac;};'use strict';var multer=require(_0x8b2c('0x0'));var util=require(_0x8b2c('0x1'));var path=require(_0x8b2c('0x2'));var timeout=require(_0x8b2c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8b2c('0x4'));var interaction=require(_0x8b2c('0x5'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router[_0x8b2c('0x6')]('/',auth[_0x8b2c('0x7')](),controller[_0x8b2c('0x8')]);router['get'](_0x8b2c('0x9'),auth[_0x8b2c('0x7')](),controller[_0x8b2c('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8b2c('0xb')]);router[_0x8b2c('0xc')]('/:id',auth[_0x8b2c('0x7')](),controller[_0x8b2c('0xd')]);router[_0x8b2c('0xe')]('/:id',auth[_0x8b2c('0x7')](),controller[_0x8b2c('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 d5d5a09..16e8d0f 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 _0x4aaa=['TEXT','sequelize','exports','STRING'];(function(_0x4236da,_0x1dce55){var _0x3b5b84=function(_0x309d64){while(--_0x309d64){_0x4236da['push'](_0x4236da['shift']());}};_0x3b5b84(++_0x1dce55);}(_0x4aaa,0x16d));var _0xa4aa=function(_0x490615,_0x162c9c){_0x490615=_0x490615-0x0;var _0x35a774=_0x4aaa[_0x490615];return _0x35a774;};'use strict';var Sequelize=require(_0xa4aa('0x0'));module[_0xa4aa('0x1')]={'uniqueid':{'type':Sequelize[_0xa4aa('0x2')]},'body':{'type':Sequelize[_0xa4aa('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0x7f16=['ENUM','out','sequelize','STRING','TEXT'];(function(_0x59edc5,_0x452840){var _0x345d3f=function(_0x1a785d){while(--_0x1a785d){_0x59edc5['push'](_0x59edc5['shift']());}};_0x345d3f(++_0x452840);}(_0x7f16,0xd4));var _0x67f1=function(_0x304c69,_0x335d76){_0x304c69=_0x304c69-0x0;var _0x30c438=_0x7f16[_0x304c69];return _0x30c438;};'use strict';var Sequelize=require(_0x67f1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x67f1('0x1')]},'body':{'type':Sequelize[_0x67f1('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x67f1('0x3')]('in',_0x67f1('0x4')),'defaultValue':_0x67f1('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 4578ffe..c8af5ba 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 _0x277e=['Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','set'];(function(_0x4896cd,_0x5d5055){var _0x339b5c=function(_0x4994c2){while(--_0x4994c2){_0x4896cd['push'](_0x4896cd['shift']());}};_0x339b5c(++_0x5d5055);}(_0x277e,0xc0));var _0xe277=function(_0x5f5317,_0x225861){_0x5f5317=_0x5f5317-0x0;var _0x485022=_0x277e[_0x5f5317];return _0x485022;};'use strict';var pdf=require(_0xe277('0x0'));var emlformat=require(_0xe277('0x1'));var rimraf=require(_0xe277('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe277('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe277('0x4'));var util=require(_0xe277('0x5'));var path=require(_0xe277('0x6'));var sox=require(_0xe277('0x7'));var csv=require(_0xe277('0x8'));var ejs=require(_0xe277('0x9'));var fs=require('fs');var _=require(_0xe277('0xa'));var squel=require(_0xe277('0xb'));var crypto=require(_0xe277('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe277('0xd'));var toCsv=require(_0xe277('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe277('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe277('0xf'));var hardwareService=require(_0xe277('0x10'));var logger=require(_0xe277('0x11'))(_0xe277('0x12'));var utils=require(_0xe277('0x13'));var config=require(_0xe277('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x80f901,_0xa3c9db){_0xa3c9db=_0xa3c9db||0xcc;return function(_0x6a76d4){if(_0x6a76d4){return _0x80f901[_0xe277('0x15')](_0xa3c9db);}return _0x80f901[_0xe277('0x16')](_0xa3c9db)[_0xe277('0x17')]();};}function respondWithResult(_0x27dc55,_0x2f1d2b){_0x2f1d2b=_0x2f1d2b||0xc8;return function(_0x467004){if(_0x467004){return _0x27dc55['status'](_0x2f1d2b)[_0xe277('0x18')](_0x467004);}};}function respondWithFilteredResult(_0x25c70a,_0x347412){return function(_0x1e621a){if(_0x1e621a){var _0x26c891=_0x1e621a[_0xe277('0x19')],_0x3829b2=_0x347412['offset'],_0x386304=_0x347412['offset']+_0x347412['limit'],_0xb329ca;if(_0x386304>=_0x26c891){_0x386304=_0x26c891;_0xb329ca=0xc8;}else{_0xb329ca=0xce;}_0x25c70a[_0xe277('0x16')](_0xb329ca);return _0x25c70a[_0xe277('0x1a')](_0xe277('0x1b'),_0x3829b2+'-'+_0x386304+'/'+_0x26c891)['json'](_0x1e621a);}return null;};}function patchUpdates(_0x3212e6){return function(_0x296aff){try{jsonpatch[_0xe277('0x1c')](_0x296aff,_0x3212e6,!![]);}catch(_0x337ab1){return BPromise['reject'](_0x337ab1);}return _0x296aff[_0xe277('0x1d')]();};}function saveUpdates(_0x16776a,_0x33d385){return function(_0x3fb837){if(_0x3fb837){return _0x3fb837[_0xe277('0x1e')](_0x16776a)['then'](function(_0x532461){return _0x532461;});}return null;};}function removeEntity(_0x291611,_0x197a06){return function(_0x4413d6){if(_0x4413d6){return _0x4413d6[_0xe277('0x1f')]()['then'](function(){_0x291611[_0xe277('0x16')](0xcc)[_0xe277('0x17')]();});}};}function handleEntityNotFound(_0xde73e9,_0x516b09){return function(_0xe61701){if(!_0xe61701){_0xde73e9[_0xe277('0x15')](0x194);}return _0xe61701;};}function handleError(_0x472c9f,_0x35512c){_0x35512c=_0x35512c||0x1f4;return function(_0x196d23){logger[_0xe277('0x20')](_0x196d23[_0xe277('0x21')]);if(_0x196d23[_0xe277('0x22')]){delete _0x196d23[_0xe277('0x22')];}_0x472c9f['status'](_0x35512c)[_0xe277('0x23')](_0x196d23);};}exports[_0xe277('0x24')]=function(_0x4f2028,_0x5ec978){var _0x232efa={},_0x2377cc={},_0x837080={'count':0x0,'rows':[]};var _0x1f617c=_[_0xe277('0x25')](db[_0xe277('0x26')]['rawAttributes'],function(_0x396640){return{'name':_0x396640[_0xe277('0x27')],'type':_0x396640['type'][_0xe277('0x28')]};});_0x2377cc[_0xe277('0x29')]=_[_0xe277('0x25')](_0x1f617c,'name');_0x2377cc[_0xe277('0x2a')]=_[_0xe277('0x2b')](_0x4f2028[_0xe277('0x2a')]);_0x2377cc[_0xe277('0x2c')]=_[_0xe277('0x2d')](_0x2377cc[_0xe277('0x29')],_0x2377cc['query']);_0x232efa['attributes']=_['intersection'](_0x2377cc['model'],qs[_0xe277('0x2e')](_0x4f2028[_0xe277('0x2a')][_0xe277('0x2e')]));_0x232efa[_0xe277('0x2f')]=_0x232efa[_0xe277('0x2f')][_0xe277('0x30')]?_0x232efa[_0xe277('0x2f')]:_0x2377cc[_0xe277('0x29')];if(!_0x4f2028[_0xe277('0x2a')][_0xe277('0x31')](_0xe277('0x32'))){_0x232efa['limit']=qs[_0xe277('0x33')](_0x4f2028[_0xe277('0x2a')]['limit']);_0x232efa[_0xe277('0x34')]=qs[_0xe277('0x34')](_0x4f2028[_0xe277('0x2a')][_0xe277('0x34')]);}_0x232efa[_0xe277('0x35')]=qs[_0xe277('0x36')](_0x4f2028[_0xe277('0x2a')][_0xe277('0x36')]);_0x232efa[_0xe277('0x37')]=qs['filters'](_[_0xe277('0x38')](_0x4f2028[_0xe277('0x2a')],_0x2377cc[_0xe277('0x2c')]),_0x1f617c);if(_0x4f2028['query'][_0xe277('0x39')]){_0x232efa[_0xe277('0x37')]=_[_0xe277('0x3a')](_0x232efa[_0xe277('0x37')],{'$or':_[_0xe277('0x25')](_0x1f617c,function(_0xe266aa){if(_0xe266aa[_0xe277('0x3b')]!==_0xe277('0x3c')){var _0x190e7d={};_0x190e7d[_0xe266aa['name']]={'$like':'%'+_0x4f2028['query'][_0xe277('0x39')]+'%'};return _0x190e7d;}})});}_0x232efa=_['merge']({},_0x232efa,_0x4f2028[_0xe277('0x3d')]);var _0x2e575e={'where':_0x232efa[_0xe277('0x37')]};return db[_0xe277('0x26')][_0xe277('0x19')](_0x2e575e)[_0xe277('0x3e')](function(_0x31598d){_0x837080[_0xe277('0x19')]=_0x31598d;if(_0x4f2028[_0xe277('0x2a')][_0xe277('0x3f')]){_0x232efa[_0xe277('0x40')]=[{'all':!![]}];}return db[_0xe277('0x26')][_0xe277('0x41')](_0x232efa);})[_0xe277('0x3e')](function(_0x29075b){_0x837080[_0xe277('0x42')]=_0x29075b;return _0x837080;})[_0xe277('0x3e')](respondWithFilteredResult(_0x5ec978,_0x232efa))[_0xe277('0x43')](handleError(_0x5ec978,null));};exports[_0xe277('0x44')]=function(_0x2e2256,_0x126fa2){var _0x36a8e2={'raw':!![],'where':{'id':_0x2e2256[_0xe277('0x45')]['id']}},_0x8bc858={};_0x8bc858[_0xe277('0x29')]=_[_0xe277('0x2b')](db[_0xe277('0x26')]['rawAttributes']);_0x8bc858[_0xe277('0x2a')]=_[_0xe277('0x2b')](_0x2e2256[_0xe277('0x2a')]);_0x8bc858[_0xe277('0x2c')]=_['intersection'](_0x8bc858['model'],_0x8bc858[_0xe277('0x2a')]);_0x36a8e2['attributes']=_[_0xe277('0x2d')](_0x8bc858[_0xe277('0x29')],qs[_0xe277('0x2e')](_0x2e2256[_0xe277('0x2a')][_0xe277('0x2e')]));_0x36a8e2['attributes']=_0x36a8e2[_0xe277('0x2f')]['length']?_0x36a8e2[_0xe277('0x2f')]:_0x8bc858[_0xe277('0x29')];if(_0x2e2256[_0xe277('0x2a')][_0xe277('0x3f')]){_0x36a8e2[_0xe277('0x40')]=[{'all':!![]}];}_0x36a8e2=_[_0xe277('0x3a')]({},_0x36a8e2,_0x2e2256[_0xe277('0x3d')]);return db[_0xe277('0x26')]['find'](_0x36a8e2)[_0xe277('0x3e')](handleEntityNotFound(_0x126fa2,null))[_0xe277('0x3e')](respondWithResult(_0x126fa2,null))[_0xe277('0x43')](handleError(_0x126fa2,null));};exports[_0xe277('0x46')]=function(_0x979349,_0x4584d6){return db[_0xe277('0x26')][_0xe277('0x46')](_0x979349[_0xe277('0x47')],{})[_0xe277('0x3e')](respondWithResult(_0x4584d6,0xc9))[_0xe277('0x43')](handleError(_0x4584d6,null));};exports['update']=function(_0x5b2214,_0x289c92){if(_0x5b2214[_0xe277('0x47')]['id']){delete _0x5b2214['body']['id'];}return db[_0xe277('0x26')][_0xe277('0x48')]({'where':{'id':_0x5b2214[_0xe277('0x45')]['id']}})[_0xe277('0x3e')](handleEntityNotFound(_0x289c92,null))[_0xe277('0x3e')](saveUpdates(_0x5b2214[_0xe277('0x47')],null))[_0xe277('0x3e')](respondWithResult(_0x289c92,null))['catch'](handleError(_0x289c92,null));};exports[_0xe277('0x1f')]=function(_0x20ad72,_0x1fedbd){return db[_0xe277('0x26')]['find']({'where':{'id':_0x20ad72['params']['id']}})[_0xe277('0x3e')](handleEntityNotFound(_0x1fedbd,null))[_0xe277('0x3e')](removeEntity(_0x1fedbd,null))[_0xe277('0x43')](handleError(_0x1fedbd,null));}; \ No newline at end of file +var _0x1349=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x872f6f,_0x5efe7b){var _0x59a5f4=function(_0x147463){while(--_0x147463){_0x872f6f['push'](_0x872f6f['shift']());}};_0x59a5f4(++_0x5efe7b);}(_0x1349,0xc8));var _0x9134=function(_0x4b3ac0,_0x372d11){_0x4b3ac0=_0x4b3ac0-0x0;var _0x3f7ce6=_0x1349[_0x4b3ac0];return _0x3f7ce6;};'use strict';var pdf=require(_0x9134('0x0'));var emlformat=require(_0x9134('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9134('0x2'));var jsonpatch=require(_0x9134('0x3'));var rp=require(_0x9134('0x4'));var moment=require(_0x9134('0x5'));var BPromise=require(_0x9134('0x6'));var Mustache=require(_0x9134('0x7'));var util=require(_0x9134('0x8'));var path=require(_0x9134('0x9'));var sox=require('sox');var csv=require(_0x9134('0xa'));var ejs=require(_0x9134('0xb'));var fs=require('fs');var _=require(_0x9134('0xc'));var squel=require(_0x9134('0xd'));var crypto=require(_0x9134('0xe'));var jsforce=require(_0x9134('0xf'));var deskjs=require(_0x9134('0x10'));var toCsv=require(_0x9134('0xa'));var querystring=require('querystring');var Papa=require(_0x9134('0x11'));var Redis=require(_0x9134('0x12'));var authService=require(_0x9134('0x13'));var qs=require(_0x9134('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9134('0x15'));var logger=require(_0x9134('0x16'))('api');var utils=require(_0x9134('0x17'));var config=require(_0x9134('0x18'));var db=require(_0x9134('0x19'))['db'];function respondWithStatusCode(_0x329c34,_0x59f1f7){_0x59f1f7=_0x59f1f7||0xcc;return function(_0x566461){if(_0x566461){return _0x329c34[_0x9134('0x1a')](_0x59f1f7);}return _0x329c34['status'](_0x59f1f7)[_0x9134('0x1b')]();};}function respondWithResult(_0x107a83,_0x4f35ab){_0x4f35ab=_0x4f35ab||0xc8;return function(_0x42808c){if(_0x42808c){return _0x107a83[_0x9134('0x1c')](_0x4f35ab)[_0x9134('0x1d')](_0x42808c);}};}function respondWithFilteredResult(_0x30bccb,_0x1880ef){return function(_0x14e950){if(_0x14e950){var _0x14b0c0=_0x14e950[_0x9134('0x1e')],_0x59a149=_0x1880ef[_0x9134('0x1f')],_0x4104c2=_0x1880ef['offset']+_0x1880ef[_0x9134('0x20')],_0x2a538c;if(_0x4104c2>=_0x14b0c0){_0x4104c2=_0x14b0c0;_0x2a538c=0xc8;}else{_0x2a538c=0xce;}_0x30bccb['status'](_0x2a538c);return _0x30bccb['set'](_0x9134('0x21'),_0x59a149+'-'+_0x4104c2+'/'+_0x14b0c0)[_0x9134('0x1d')](_0x14e950);}return null;};}function patchUpdates(_0x7d4a73){return function(_0x249a4a){try{jsonpatch[_0x9134('0x22')](_0x249a4a,_0x7d4a73,!![]);}catch(_0x14c737){return BPromise['reject'](_0x14c737);}return _0x249a4a[_0x9134('0x23')]();};}function saveUpdates(_0x174ed6,_0x53f37b){return function(_0x40e78a){if(_0x40e78a){return _0x40e78a[_0x9134('0x24')](_0x174ed6)[_0x9134('0x25')](function(_0x597c07){return _0x597c07;});}return null;};}function removeEntity(_0x4cdcba,_0x348b24){return function(_0x34808c){if(_0x34808c){return _0x34808c[_0x9134('0x26')]()[_0x9134('0x25')](function(){_0x4cdcba[_0x9134('0x1c')](0xcc)[_0x9134('0x1b')]();});}};}function handleEntityNotFound(_0x4140d2,_0x42b371){return function(_0x310bec){if(!_0x310bec){_0x4140d2[_0x9134('0x1a')](0x194);}return _0x310bec;};}function handleError(_0x52c98f,_0x124d45){_0x124d45=_0x124d45||0x1f4;return function(_0x4d27f1){logger['error'](_0x4d27f1[_0x9134('0x27')]);if(_0x4d27f1[_0x9134('0x28')]){delete _0x4d27f1['name'];}_0x52c98f[_0x9134('0x1c')](_0x124d45)[_0x9134('0x29')](_0x4d27f1);};}exports['index']=function(_0x5644a9,_0x1b6231){var _0x2007ff={},_0x5e7141={},_0x4c850a={'count':0x0,'rows':[]};var _0x38f6ce=_[_0x9134('0x2a')](db[_0x9134('0x2b')][_0x9134('0x2c')],function(_0x40a295){return{'name':_0x40a295[_0x9134('0x2d')],'type':_0x40a295[_0x9134('0x2e')][_0x9134('0x2f')]};});_0x5e7141['model']=_[_0x9134('0x2a')](_0x38f6ce,_0x9134('0x28'));_0x5e7141[_0x9134('0x30')]=_[_0x9134('0x31')](_0x5644a9[_0x9134('0x30')]);_0x5e7141['filters']=_[_0x9134('0x32')](_0x5e7141['model'],_0x5e7141['query']);_0x2007ff[_0x9134('0x33')]=_['intersection'](_0x5e7141[_0x9134('0x34')],qs['fields'](_0x5644a9[_0x9134('0x30')]['fields']));_0x2007ff[_0x9134('0x33')]=_0x2007ff['attributes'][_0x9134('0x35')]?_0x2007ff[_0x9134('0x33')]:_0x5e7141[_0x9134('0x34')];if(!_0x5644a9['query'][_0x9134('0x36')]('nolimit')){_0x2007ff[_0x9134('0x20')]=qs['limit'](_0x5644a9['query'][_0x9134('0x20')]);_0x2007ff[_0x9134('0x1f')]=qs[_0x9134('0x1f')](_0x5644a9['query'][_0x9134('0x1f')]);}_0x2007ff[_0x9134('0x37')]=qs[_0x9134('0x38')](_0x5644a9[_0x9134('0x30')]['sort']);_0x2007ff[_0x9134('0x39')]=qs[_0x9134('0x3a')](_[_0x9134('0x3b')](_0x5644a9[_0x9134('0x30')],_0x5e7141[_0x9134('0x3a')]),_0x38f6ce);if(_0x5644a9['query'][_0x9134('0x3c')]){_0x2007ff[_0x9134('0x39')]=_[_0x9134('0x3d')](_0x2007ff[_0x9134('0x39')],{'$or':_[_0x9134('0x2a')](_0x38f6ce,function(_0x54aea2){if(_0x54aea2[_0x9134('0x2e')]!==_0x9134('0x3e')){var _0x281a27={};_0x281a27[_0x54aea2[_0x9134('0x28')]]={'$like':'%'+_0x5644a9[_0x9134('0x30')][_0x9134('0x3c')]+'%'};return _0x281a27;}})});}_0x2007ff=_[_0x9134('0x3d')]({},_0x2007ff,_0x5644a9[_0x9134('0x3f')]);var _0x3c9b5c={'where':_0x2007ff[_0x9134('0x39')]};return db['SquareMessage']['count'](_0x3c9b5c)[_0x9134('0x25')](function(_0x14a7a9){_0x4c850a['count']=_0x14a7a9;if(_0x5644a9['query'][_0x9134('0x40')]){_0x2007ff[_0x9134('0x41')]=[{'all':!![]}];}return db[_0x9134('0x2b')]['findAll'](_0x2007ff);})['then'](function(_0x122429){_0x4c850a[_0x9134('0x42')]=_0x122429;return _0x4c850a;})[_0x9134('0x25')](respondWithFilteredResult(_0x1b6231,_0x2007ff))[_0x9134('0x43')](handleError(_0x1b6231,null));};exports[_0x9134('0x44')]=function(_0x38a5aa,_0x3ee3bb){var _0x3effbe={'raw':!![],'where':{'id':_0x38a5aa[_0x9134('0x45')]['id']}},_0x371723={};_0x371723[_0x9134('0x34')]=_[_0x9134('0x31')](db[_0x9134('0x2b')][_0x9134('0x2c')]);_0x371723[_0x9134('0x30')]=_[_0x9134('0x31')](_0x38a5aa[_0x9134('0x30')]);_0x371723[_0x9134('0x3a')]=_['intersection'](_0x371723[_0x9134('0x34')],_0x371723[_0x9134('0x30')]);_0x3effbe[_0x9134('0x33')]=_[_0x9134('0x32')](_0x371723[_0x9134('0x34')],qs[_0x9134('0x46')](_0x38a5aa['query']['fields']));_0x3effbe['attributes']=_0x3effbe[_0x9134('0x33')][_0x9134('0x35')]?_0x3effbe['attributes']:_0x371723[_0x9134('0x34')];if(_0x38a5aa[_0x9134('0x30')][_0x9134('0x40')]){_0x3effbe[_0x9134('0x41')]=[{'all':!![]}];}_0x3effbe=_['merge']({},_0x3effbe,_0x38a5aa[_0x9134('0x3f')]);return db[_0x9134('0x2b')][_0x9134('0x47')](_0x3effbe)[_0x9134('0x25')](handleEntityNotFound(_0x3ee3bb,null))['then'](respondWithResult(_0x3ee3bb,null))[_0x9134('0x43')](handleError(_0x3ee3bb,null));};exports[_0x9134('0x48')]=function(_0x2d0eb3,_0x469f5d){return db[_0x9134('0x2b')][_0x9134('0x48')](_0x2d0eb3[_0x9134('0x49')],{})[_0x9134('0x25')](respondWithResult(_0x469f5d,0xc9))[_0x9134('0x43')](handleError(_0x469f5d,null));};exports[_0x9134('0x24')]=function(_0x243b82,_0x1af471){if(_0x243b82[_0x9134('0x49')]['id']){delete _0x243b82[_0x9134('0x49')]['id'];}return db['SquareMessage'][_0x9134('0x47')]({'where':{'id':_0x243b82['params']['id']}})[_0x9134('0x25')](handleEntityNotFound(_0x1af471,null))[_0x9134('0x25')](saveUpdates(_0x243b82[_0x9134('0x49')],null))['then'](respondWithResult(_0x1af471,null))[_0x9134('0x43')](handleError(_0x1af471,null));};exports[_0x9134('0x26')]=function(_0x489521,_0x37a81c){return db['SquareMessage'][_0x9134('0x47')]({'where':{'id':_0x489521[_0x9134('0x45')]['id']}})[_0x9134('0x25')](handleEntityNotFound(_0x37a81c,null))['then'](removeEntity(_0x37a81c,null))[_0x9134('0x43')](handleError(_0x37a81c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 07872f2..03f45df 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 _0x326f=['square_messages','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x1dbf06,_0x59141d){var _0x35c421=function(_0x1160b7){while(--_0x1160b7){_0x1dbf06['push'](_0x1dbf06['shift']());}};_0x35c421(++_0x59141d);}(_0x326f,0xd1));var _0xf326=function(_0x45e451,_0x520167){_0x45e451=_0x45e451-0x0;var _0xf9fa37=_0x326f[_0x45e451];return _0xf9fa37;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util'];(function(_0xbefd3c,_0xbc56f0){var _0x253ad5=function(_0x284b82){while(--_0x284b82){_0xbefd3c['push'](_0xbefd3c['shift']());}};_0x253ad5(++_0xbc56f0);}(_0x7a54,0x106));var _0x47a5=function(_0x358cbf,_0x34e228){_0x358cbf=_0x358cbf-0x0;var _0x156c16=_0x7a54[_0x358cbf];return _0x156c16;};'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 625cd44..b6d3f31 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 _0x7eff=['../../config/logger','jayson/promise','client','http','then','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','CreateSquareMessage','SquareMessage','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5ee5fb,_0x32031b){var _0x19cb60=function(_0x448bcf){while(--_0x448bcf){_0x5ee5fb['push'](_0x5ee5fb['shift']());}};_0x19cb60(++_0x32031b);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf7ef('0x0'));var moment=require(_0xf7ef('0x1'));var BPromise=require(_0xf7ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7ef('0x3'));var db=require(_0xf7ef('0x4'))['db'];var utils=require(_0xf7ef('0x5'));var logger=require(_0xf7ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7ef('0x7'));var client=jayson[_0xf7ef('0x8')][_0xf7ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21eb16,_0x4f08b0,_0xcf20c7){return new BPromise(function(_0x1022af,_0xd8bc8d){return client['request'](_0x21eb16,_0xcf20c7)[_0xf7ef('0xa')](function(_0x116448){logger['info'](_0xf7ef('0xb'),_0x4f08b0,'request\x20sent');logger['debug'](_0xf7ef('0xc'),_0x4f08b0,'request\x20sent',JSON[_0xf7ef('0xd')](_0x116448));if(_0x116448['error']){if(_0x116448['error']['code']===0x1f4){logger[_0xf7ef('0xe')]('SquareMessage,\x20%s,\x20%s',_0x4f08b0,_0x116448['error']['message']);return _0xd8bc8d(_0x116448[_0xf7ef('0xe')][_0xf7ef('0xf')]);}logger[_0xf7ef('0xe')](_0xf7ef('0xb'),_0x4f08b0,_0x116448['error'][_0xf7ef('0xf')]);return _0x1022af(_0x116448['error'][_0xf7ef('0xf')]);}else{logger[_0xf7ef('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4f08b0,_0xf7ef('0x11'));_0x1022af(_0x116448['result'][_0xf7ef('0xf')]);}})[_0xf7ef('0x12')](function(_0x1695c1){logger[_0xf7ef('0xe')](_0xf7ef('0xb'),_0x4f08b0,_0x1695c1);_0xd8bc8d(_0x1695c1);});});}exports[_0xf7ef('0x13')]=function(_0x466612){var _0x514e73=this;return new Promise(function(_0x4fa0c6,_0x4bc8ff){return db[_0xf7ef('0x14')]['create'](_0x466612[_0xf7ef('0x15')],{'raw':_0x466612[_0xf7ef('0x16')]?_0x466612[_0xf7ef('0x16')][_0xf7ef('0x17')]===undefined?!![]:![]:!![]})[_0xf7ef('0xa')](function(_0x29cbf1){logger['info']('CreateSquareMessage',_0x466612);logger['debug'](_0xf7ef('0x13'),_0x466612,JSON[_0xf7ef('0xd')](_0x29cbf1));_0x4fa0c6(_0x29cbf1);})[_0xf7ef('0x12')](function(_0x20c27b){logger['error']('CreateSquareMessage',_0x20c27b[_0xf7ef('0xf')],_0x466612);_0x4bc8ff(_0x514e73[_0xf7ef('0xe')](0x1f4,_0x20c27b[_0xf7ef('0xf')]));});});}; \ No newline at end of file +var _0x0650=['request\x20sent','stringify','error','message','info','result','CreateSquareMessage','SquareMessage','create','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','then','SquareMessage,\x20%s,\x20%s'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x0650,0x1aa));var _0x0065=function(_0x233ba9,_0x581b20){_0x233ba9=_0x233ba9-0x0;var _0x3704da=_0x0650[_0x233ba9];return _0x3704da;};'use strict';var _=require(_0x0065('0x0'));var util=require(_0x0065('0x1'));var moment=require(_0x0065('0x2'));var BPromise=require(_0x0065('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0065('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0065('0x5'))(_0x0065('0x6'));var config=require(_0x0065('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0065('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5792dc,_0x517b9f,_0x49d04d){return new BPromise(function(_0x576ca0,_0x25892a){return client['request'](_0x5792dc,_0x49d04d)[_0x0065('0x9')](function(_0x141e01){logger['info'](_0x0065('0xa'),_0x517b9f,_0x0065('0xb'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x517b9f,_0x0065('0xb'),JSON[_0x0065('0xc')](_0x141e01));if(_0x141e01[_0x0065('0xd')]){if(_0x141e01[_0x0065('0xd')]['code']===0x1f4){logger['error'](_0x0065('0xa'),_0x517b9f,_0x141e01['error']['message']);return _0x25892a(_0x141e01[_0x0065('0xd')]['message']);}logger[_0x0065('0xd')]('SquareMessage,\x20%s,\x20%s',_0x517b9f,_0x141e01['error'][_0x0065('0xe')]);return _0x576ca0(_0x141e01[_0x0065('0xd')][_0x0065('0xe')]);}else{logger[_0x0065('0xf')](_0x0065('0xa'),_0x517b9f,_0x0065('0xb'));_0x576ca0(_0x141e01[_0x0065('0x10')][_0x0065('0xe')]);}})['catch'](function(_0x26f491){logger[_0x0065('0xd')](_0x0065('0xa'),_0x517b9f,_0x26f491);_0x25892a(_0x26f491);});});}exports[_0x0065('0x11')]=function(_0x20adaa){var _0x9c1723=this;return new Promise(function(_0x244937,_0xcf4ea1){return db[_0x0065('0x12')][_0x0065('0x13')](_0x20adaa['body'],{'raw':_0x20adaa['options']?_0x20adaa[_0x0065('0x14')][_0x0065('0x15')]===undefined?!![]:![]:!![]})[_0x0065('0x9')](function(_0x2efd09){logger[_0x0065('0xf')](_0x0065('0x11'),_0x20adaa);logger['debug'](_0x0065('0x11'),_0x20adaa,JSON[_0x0065('0xc')](_0x2efd09));_0x244937(_0x2efd09);})[_0x0065('0x16')](function(_0x502c7a){logger[_0x0065('0xd')]('CreateSquareMessage',_0x502c7a[_0x0065('0xe')],_0x20adaa);_0xcf4ea1(_0x9c1723[_0x0065('0xd')](0x1f4,_0x502c7a[_0x0065('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 08c7223..cdbd8ab 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 _0xda73=['get','/:id','isAuthenticated','show','15s','post','create','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x540518,_0x358aee){var _0x2f1224=function(_0x427191){while(--_0x427191){_0x540518['push'](_0x540518['shift']());}};_0x2f1224(++_0x358aee);}(_0xda73,0x160));var _0x3da7=function(_0x1e1064,_0x1dbc3b){_0x1e1064=_0x1e1064-0x0;var _0x253ec4=_0xda73[_0x1e1064];return _0x253ec4;};'use strict';var multer=require(_0x3da7('0x0'));var util=require(_0x3da7('0x1'));var path=require(_0x3da7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3da7('0x3')]();var auth=require(_0x3da7('0x4'));var interaction=require(_0x3da7('0x5'));var config=require(_0x3da7('0x6'));var controller=require(_0x3da7('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3da7('0x8')](_0x3da7('0x9'),auth[_0x3da7('0xa')](),controller[_0x3da7('0xb')]);router[_0x3da7('0x8')]('/:id/test',auth[_0x3da7('0xa')](),timeout(_0x3da7('0xc')),controller['test']);router[_0x3da7('0xd')]('/',auth[_0x3da7('0xa')](),controller[_0x3da7('0xe')]);router['put'](_0x3da7('0x9'),auth[_0x3da7('0xa')](),controller[_0x3da7('0xf')]);router[_0x3da7('0x10')](_0x3da7('0x9'),auth[_0x3da7('0xa')](),controller[_0x3da7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4127=['/:id','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s','test','post','create','put'];(function(_0x4a2cd8,_0x13983c){var _0x6a647d=function(_0x33b87e){while(--_0x33b87e){_0x4a2cd8['push'](_0x4a2cd8['shift']());}};_0x6a647d(++_0x13983c);}(_0x4127,0x72));var _0x7412=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4127[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7412('0x0'));var util=require('util');var path=require(_0x7412('0x1'));var timeout=require(_0x7412('0x2'));var express=require('express');var router=express[_0x7412('0x3')]();var auth=require(_0x7412('0x4'));var interaction=require(_0x7412('0x5'));var config=require(_0x7412('0x6'));var controller=require(_0x7412('0x7'));router[_0x7412('0x8')]('/',auth[_0x7412('0x9')](),controller[_0x7412('0xa')]);router[_0x7412('0x8')]('/:id',auth[_0x7412('0x9')](),controller[_0x7412('0xb')]);router['get'](_0x7412('0xc'),auth[_0x7412('0x9')](),timeout(_0x7412('0xd')),controller[_0x7412('0xe')]);router[_0x7412('0xf')]('/',auth[_0x7412('0x9')](),controller[_0x7412('0x10')]);router[_0x7412('0x11')](_0x7412('0x12'),auth['isAuthenticated'](),controller[_0x7412('0x13')]);router[_0x7412('0x14')]('/:id',auth[_0x7412('0x9')](),controller[_0x7412('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 6998f3d..24ba673 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 _0x4ea3=['exports','STRING','sequelize'];(function(_0x3dbc79,_0x426f83){var _0x10db9d=function(_0xa90d0a){while(--_0xa90d0a){_0x3dbc79['push'](_0x3dbc79['shift']());}};_0x10db9d(++_0x426f83);}(_0x4ea3,0x158));var _0x34ea=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x4ea3[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'name':{'type':Sequelize[_0x34ea('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x34ea('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbc58=['STRING','name','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbc58,0x162));var _0x8bc5=function(_0x8f2524,_0xec48ba){_0x8f2524=_0x8f2524-0x0;var _0x171af3=_0xbc58[_0x8f2524];return _0x171af3;};'use strict';var Sequelize=require(_0x8bc5('0x0'));module[_0x8bc5('0x1')]={'name':{'type':Sequelize[_0x8bc5('0x2')],'unique':_0x8bc5('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8bc5('0x2')]},'description':{'type':Sequelize[_0x8bc5('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 12363bc..3a26da5 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 _0xda7d=['query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ODBC','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','dsn','odbc','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','name'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0xda7d,0xca));var _0xdda7=function(_0x5a4b5a,_0x16af6e){_0x5a4b5a=_0x5a4b5a-0x0;var _0x2f57bf=_0xda7d[_0x5a4b5a];return _0x2f57bf;};'use strict';var pdf=require(_0xdda7('0x0'));var emlformat=require(_0xdda7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdda7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdda7('0x3'));var Mustache=require(_0xdda7('0x4'));var util=require(_0xdda7('0x5'));var path=require('path');var sox=require(_0xdda7('0x6'));var csv=require(_0xdda7('0x7'));var ejs=require(_0xdda7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdda7('0x9'));var crypto=require(_0xdda7('0xa'));var jsforce=require(_0xdda7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdda7('0x7'));var querystring=require('querystring');var Papa=require(_0xdda7('0xc'));var Redis=require('ioredis');var authService=require(_0xdda7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xdda7('0xe'));var hardwareService=require(_0xdda7('0xf'));var logger=require(_0xdda7('0x10'))(_0xdda7('0x11'));var utils=require(_0xdda7('0x12'));var config=require('../../config/environment');var db=require(_0xdda7('0x13'))['db'];function respondWithStatusCode(_0x30e441,_0x2f9ca9){_0x2f9ca9=_0x2f9ca9||0xcc;return function(_0x51aa0c){if(_0x51aa0c){return _0x30e441[_0xdda7('0x14')](_0x2f9ca9);}return _0x30e441[_0xdda7('0x15')](_0x2f9ca9)['end']();};}function respondWithResult(_0x4c3436,_0x5ca58e){_0x5ca58e=_0x5ca58e||0xc8;return function(_0x5e925e){if(_0x5e925e){return _0x4c3436[_0xdda7('0x15')](_0x5ca58e)[_0xdda7('0x16')](_0x5e925e);}};}function respondWithFilteredResult(_0x4c5b0f,_0x15ffe3){return function(_0x5260a3){if(_0x5260a3){var _0x127f28=_0x5260a3[_0xdda7('0x17')],_0x37d5ce=_0x15ffe3[_0xdda7('0x18')],_0x4a5fef=_0x15ffe3['offset']+_0x15ffe3[_0xdda7('0x19')],_0x3245f5;if(_0x4a5fef>=_0x127f28){_0x4a5fef=_0x127f28;_0x3245f5=0xc8;}else{_0x3245f5=0xce;}_0x4c5b0f['status'](_0x3245f5);return _0x4c5b0f[_0xdda7('0x1a')](_0xdda7('0x1b'),_0x37d5ce+'-'+_0x4a5fef+'/'+_0x127f28)[_0xdda7('0x16')](_0x5260a3);}return null;};}function patchUpdates(_0xf363a0){return function(_0x217d34){try{jsonpatch[_0xdda7('0x1c')](_0x217d34,_0xf363a0,!![]);}catch(_0x3a3d9f){return BPromise[_0xdda7('0x1d')](_0x3a3d9f);}return _0x217d34['save']();};}function saveUpdates(_0xe05a40,_0xdf14d){return function(_0x397944){if(_0x397944){return _0x397944[_0xdda7('0x1e')](_0xe05a40)[_0xdda7('0x1f')](function(_0x1b3a95){return _0x1b3a95;});}return null;};}function removeEntity(_0x5ebfb8,_0x163cd6){return function(_0x24961b){if(_0x24961b){return _0x24961b[_0xdda7('0x20')]()[_0xdda7('0x1f')](function(){var _0x31060e=_0x24961b[_0xdda7('0x21')]({'plain':!![]});var _0x237334='ODBC';return db[_0xdda7('0x22')][_0xdda7('0x20')]({'where':{'type':_0x237334,'resourceId':_0x31060e['id']}})[_0xdda7('0x1f')](function(){return _0x24961b;});})[_0xdda7('0x1f')](function(){_0x5ebfb8['status'](0xcc)[_0xdda7('0x23')]();});}};}function handleEntityNotFound(_0x44f33e,_0x3b9380){return function(_0x2c6091){if(!_0x2c6091){_0x44f33e['sendStatus'](0x194);}return _0x2c6091;};}function handleError(_0x335534,_0x35ef88){_0x35ef88=_0x35ef88||0x1f4;return function(_0x7007e8){logger[_0xdda7('0x24')](_0x7007e8[_0xdda7('0x25')]);if(_0x7007e8['name']){delete _0x7007e8['name'];}_0x335534[_0xdda7('0x15')](_0x35ef88)[_0xdda7('0x26')](_0x7007e8);};}exports[_0xdda7('0x27')]=function(_0x32adc5,_0x4607d0){var _0x248176={},_0x3e8cb6={},_0x216631={'count':0x0,'rows':[]};var _0x143b99=_[_0xdda7('0x28')](db[_0xdda7('0x29')][_0xdda7('0x2a')],function(_0x214712){return{'name':_0x214712[_0xdda7('0x2b')],'type':_0x214712['type'][_0xdda7('0x2c')]};});_0x3e8cb6[_0xdda7('0x2d')]=_['map'](_0x143b99,_0xdda7('0x2e'));_0x3e8cb6[_0xdda7('0x2f')]=_[_0xdda7('0x30')](_0x32adc5[_0xdda7('0x2f')]);_0x3e8cb6['filters']=_['intersection'](_0x3e8cb6[_0xdda7('0x2d')],_0x3e8cb6[_0xdda7('0x2f')]);_0x248176[_0xdda7('0x31')]=_[_0xdda7('0x32')](_0x3e8cb6[_0xdda7('0x2d')],qs[_0xdda7('0x33')](_0x32adc5['query'][_0xdda7('0x33')]));_0x248176[_0xdda7('0x31')]=_0x248176['attributes'][_0xdda7('0x34')]?_0x248176['attributes']:_0x3e8cb6['model'];if(!_0x32adc5[_0xdda7('0x2f')][_0xdda7('0x35')]('nolimit')){_0x248176[_0xdda7('0x19')]=qs[_0xdda7('0x19')](_0x32adc5['query']['limit']);_0x248176['offset']=qs[_0xdda7('0x18')](_0x32adc5[_0xdda7('0x2f')][_0xdda7('0x18')]);}_0x248176[_0xdda7('0x36')]=qs['sort'](_0x32adc5[_0xdda7('0x2f')][_0xdda7('0x37')]);_0x248176[_0xdda7('0x38')]=qs[_0xdda7('0x39')](_[_0xdda7('0x3a')](_0x32adc5['query'],_0x3e8cb6['filters']),_0x143b99);if(_0x32adc5[_0xdda7('0x2f')][_0xdda7('0x3b')]){_0x248176[_0xdda7('0x38')]=_['merge'](_0x248176['where'],{'$or':_[_0xdda7('0x28')](_0x143b99,function(_0x1a0d91){if(_0x1a0d91[_0xdda7('0x3c')]!==_0xdda7('0x3d')){var _0x5e26cc={};_0x5e26cc[_0x1a0d91[_0xdda7('0x2e')]]={'$like':'%'+_0x32adc5[_0xdda7('0x2f')][_0xdda7('0x3b')]+'%'};return _0x5e26cc;}})});}_0x248176=_[_0xdda7('0x3e')]({},_0x248176,_0x32adc5[_0xdda7('0x3f')]);var _0x187730={'where':_0x248176[_0xdda7('0x38')]};return db[_0xdda7('0x29')][_0xdda7('0x17')](_0x187730)[_0xdda7('0x1f')](function(_0xe9b307){_0x216631[_0xdda7('0x17')]=_0xe9b307;if(_0x32adc5[_0xdda7('0x2f')][_0xdda7('0x40')]){_0x248176[_0xdda7('0x41')]=[{'all':!![]}];}return db[_0xdda7('0x29')][_0xdda7('0x42')](_0x248176);})[_0xdda7('0x1f')](function(_0x49eb3b){_0x216631[_0xdda7('0x43')]=_0x49eb3b;return _0x216631;})['then'](respondWithFilteredResult(_0x4607d0,_0x248176))[_0xdda7('0x44')](handleError(_0x4607d0,null));};exports[_0xdda7('0x45')]=function(_0x171cc5,_0x3391bb){var _0x440d03={'raw':!![],'where':{'id':_0x171cc5['params']['id']}},_0x2a18f6={};_0x2a18f6[_0xdda7('0x2d')]=_[_0xdda7('0x30')](db[_0xdda7('0x29')][_0xdda7('0x2a')]);_0x2a18f6[_0xdda7('0x2f')]=_[_0xdda7('0x30')](_0x171cc5[_0xdda7('0x2f')]);_0x2a18f6[_0xdda7('0x39')]=_[_0xdda7('0x32')](_0x2a18f6[_0xdda7('0x2d')],_0x2a18f6['query']);_0x440d03[_0xdda7('0x31')]=_['intersection'](_0x2a18f6['model'],qs[_0xdda7('0x33')](_0x171cc5['query']['fields']));_0x440d03[_0xdda7('0x31')]=_0x440d03[_0xdda7('0x31')][_0xdda7('0x34')]?_0x440d03['attributes']:_0x2a18f6['model'];if(_0x171cc5[_0xdda7('0x2f')][_0xdda7('0x40')]){_0x440d03[_0xdda7('0x41')]=[{'all':!![]}];}_0x440d03=_[_0xdda7('0x3e')]({},_0x440d03,_0x171cc5[_0xdda7('0x3f')]);return db[_0xdda7('0x29')][_0xdda7('0x46')](_0x440d03)[_0xdda7('0x1f')](handleEntityNotFound(_0x3391bb,null))[_0xdda7('0x1f')](respondWithResult(_0x3391bb,null))[_0xdda7('0x44')](handleError(_0x3391bb,null));};exports[_0xdda7('0x47')]=function(_0x5f221d,_0x1216aa){return db[_0xdda7('0x29')][_0xdda7('0x47')](_0x5f221d['body'],{})['then'](function(_0x40d3cf){var _0x3f94e8=_0x5f221d['user'][_0xdda7('0x21')]({'plain':!![]});if(!_0x3f94e8)throw new Error(_0xdda7('0x48'));if(_0x3f94e8[_0xdda7('0x49')]===_0xdda7('0x4a')){var _0x241196=_0x40d3cf[_0xdda7('0x21')]({'plain':!![]});var _0x22c2e3=_0xdda7('0x4b');return db[_0xdda7('0x4c')][_0xdda7('0x46')]({'where':{'name':_0x22c2e3,'userProfileId':_0x3f94e8['userProfileId']},'raw':!![]})['then'](function(_0x16cde1){if(_0x16cde1&&_0x16cde1['autoAssociation']===0x0){return db[_0xdda7('0x22')]['create']({'name':_0x241196[_0xdda7('0x2e')],'resourceId':_0x241196['id'],'type':_0x16cde1[_0xdda7('0x2e')],'sectionId':_0x16cde1['id']},{})['then'](function(){return _0x40d3cf;});}else{return _0x40d3cf;}})[_0xdda7('0x44')](function(_0x266522){logger['error'](_0xdda7('0x4d'),_0x266522);throw _0x266522;});}return _0x40d3cf;})[_0xdda7('0x1f')](respondWithResult(_0x1216aa,0xc9))['catch'](handleError(_0x1216aa,null));};exports[_0xdda7('0x1e')]=function(_0x1228f6,_0x381422){if(_0x1228f6['body']['id']){delete _0x1228f6[_0xdda7('0x4e')]['id'];}return db[_0xdda7('0x29')][_0xdda7('0x46')]({'where':{'id':_0x1228f6[_0xdda7('0x4f')]['id']}})[_0xdda7('0x1f')](handleEntityNotFound(_0x381422,null))['then'](saveUpdates(_0x1228f6[_0xdda7('0x4e')],null))[_0xdda7('0x1f')](respondWithResult(_0x381422,null))[_0xdda7('0x44')](handleError(_0x381422,null));};exports[_0xdda7('0x20')]=function(_0x9174f7,_0x48d140){return db[_0xdda7('0x29')][_0xdda7('0x46')]({'where':{'id':_0x9174f7[_0xdda7('0x4f')]['id']}})[_0xdda7('0x1f')](handleEntityNotFound(_0x48d140,null))[_0xdda7('0x1f')](removeEntity(_0x48d140,null))[_0xdda7('0x44')](handleError(_0x48d140,null));};exports[_0xdda7('0x50')]=function(_0x222c14,_0x5c9bc4,_0x4c4ec0){var _0x1ed627;return db['SquareOdbc'][_0xdda7('0x46')]({'where':{'id':_0x222c14[_0xdda7('0x4f')]['id']},'attributes':['id',_0xdda7('0x51')]})[_0xdda7('0x1f')](handleEntityNotFound(_0x5c9bc4,null))['then'](function(_0x17c836){if(_0x17c836){var _0x249686=require(_0xdda7('0x52'))();_0x249686['openSync'](_0x17c836[_0xdda7('0x51')]);_0x249686['closeSync']();return _0x17c836;}})[_0xdda7('0x1f')](respondWithResult(_0x5c9bc4,null))[_0xdda7('0x44')](handleError(_0x5c9bc4,null));}; \ No newline at end of file +var _0x28ea=['desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','stack','name','send','index','type','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','SquareOdbc','include','findAll','catch','show','params','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','openSync','closeSync','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x1bef2a,_0x5becb3){var _0x10f24b=function(_0x1b9b83){while(--_0x1b9b83){_0x1bef2a['push'](_0x1bef2a['shift']());}};_0x10f24b(++_0x5becb3);}(_0x28ea,0x139));var _0xa28e=function(_0x356916,_0x5b963a){_0x356916=_0x356916-0x0;var _0x40c4a0=_0x28ea[_0x356916];return _0x40c4a0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa28e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa28e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa28e('0x2'));var moment=require('moment');var BPromise=require(_0xa28e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa28e('0x4'));var sox=require(_0xa28e('0x5'));var csv=require(_0xa28e('0x6'));var ejs=require(_0xa28e('0x7'));var fs=require('fs');var _=require(_0xa28e('0x8'));var squel=require('squel');var crypto=require(_0xa28e('0x9'));var jsforce=require(_0xa28e('0xa'));var deskjs=require(_0xa28e('0xb'));var toCsv=require(_0xa28e('0x6'));var querystring=require(_0xa28e('0xc'));var Papa=require(_0xa28e('0xd'));var Redis=require('ioredis');var authService=require(_0xa28e('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa28e('0xf'));var logger=require(_0xa28e('0x10'))(_0xa28e('0x11'));var utils=require(_0xa28e('0x12'));var config=require(_0xa28e('0x13'));var db=require(_0xa28e('0x14'))['db'];function respondWithStatusCode(_0x14ddc4,_0x46d9a8){_0x46d9a8=_0x46d9a8||0xcc;return function(_0x459895){if(_0x459895){return _0x14ddc4[_0xa28e('0x15')](_0x46d9a8);}return _0x14ddc4[_0xa28e('0x16')](_0x46d9a8)[_0xa28e('0x17')]();};}function respondWithResult(_0x5c63e5,_0x31ee80){_0x31ee80=_0x31ee80||0xc8;return function(_0x165d73){if(_0x165d73){return _0x5c63e5[_0xa28e('0x16')](_0x31ee80)[_0xa28e('0x18')](_0x165d73);}};}function respondWithFilteredResult(_0x272156,_0x35a9ce){return function(_0x244272){if(_0x244272){var _0x5ae9fa=_0x244272[_0xa28e('0x19')],_0x19a2b7=_0x35a9ce[_0xa28e('0x1a')],_0x3d9f06=_0x35a9ce[_0xa28e('0x1a')]+_0x35a9ce[_0xa28e('0x1b')],_0x520958;if(_0x3d9f06>=_0x5ae9fa){_0x3d9f06=_0x5ae9fa;_0x520958=0xc8;}else{_0x520958=0xce;}_0x272156['status'](_0x520958);return _0x272156['set'](_0xa28e('0x1c'),_0x19a2b7+'-'+_0x3d9f06+'/'+_0x5ae9fa)[_0xa28e('0x18')](_0x244272);}return null;};}function patchUpdates(_0x4fcb48){return function(_0x3c10ed){try{jsonpatch[_0xa28e('0x1d')](_0x3c10ed,_0x4fcb48,!![]);}catch(_0x32e25b){return BPromise[_0xa28e('0x1e')](_0x32e25b);}return _0x3c10ed[_0xa28e('0x1f')]();};}function saveUpdates(_0x1fb2d1,_0x2c2712){return function(_0xcd90bd){if(_0xcd90bd){return _0xcd90bd['update'](_0x1fb2d1)[_0xa28e('0x20')](function(_0x514cde){return _0x514cde;});}return null;};}function removeEntity(_0xe73a1e,_0x5ad456){return function(_0x54d675){if(_0x54d675){return _0x54d675[_0xa28e('0x21')]()[_0xa28e('0x20')](function(){var _0x4ad403=_0x54d675[_0xa28e('0x22')]({'plain':!![]});var _0x2db5f2=_0xa28e('0x23');return db[_0xa28e('0x24')]['destroy']({'where':{'type':_0x2db5f2,'resourceId':_0x4ad403['id']}})['then'](function(){return _0x54d675;});})[_0xa28e('0x20')](function(){_0xe73a1e[_0xa28e('0x16')](0xcc)[_0xa28e('0x17')]();});}};}function handleEntityNotFound(_0x3ebdef,_0x3a7d05){return function(_0x386b74){if(!_0x386b74){_0x3ebdef[_0xa28e('0x15')](0x194);}return _0x386b74;};}function handleError(_0x311540,_0x15f22f){_0x15f22f=_0x15f22f||0x1f4;return function(_0x1fcff6){logger['error'](_0x1fcff6[_0xa28e('0x25')]);if(_0x1fcff6[_0xa28e('0x26')]){delete _0x1fcff6['name'];}_0x311540['status'](_0x15f22f)[_0xa28e('0x27')](_0x1fcff6);};}exports[_0xa28e('0x28')]=function(_0x14caae,_0xc2cdd4){var _0x3a8f4b={},_0xaaf84c={},_0x18bcd4={'count':0x0,'rows':[]};var _0x23ec2e=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x11961a){return{'name':_0x11961a['fieldName'],'type':_0x11961a[_0xa28e('0x29')][_0xa28e('0x2a')]};});_0xaaf84c['model']=_[_0xa28e('0x2b')](_0x23ec2e,_0xa28e('0x26'));_0xaaf84c[_0xa28e('0x2c')]=_['keys'](_0x14caae[_0xa28e('0x2c')]);_0xaaf84c['filters']=_[_0xa28e('0x2d')](_0xaaf84c['model'],_0xaaf84c[_0xa28e('0x2c')]);_0x3a8f4b[_0xa28e('0x2e')]=_[_0xa28e('0x2d')](_0xaaf84c[_0xa28e('0x2f')],qs[_0xa28e('0x30')](_0x14caae[_0xa28e('0x2c')][_0xa28e('0x30')]));_0x3a8f4b[_0xa28e('0x2e')]=_0x3a8f4b[_0xa28e('0x2e')][_0xa28e('0x31')]?_0x3a8f4b['attributes']:_0xaaf84c[_0xa28e('0x2f')];if(!_0x14caae[_0xa28e('0x2c')][_0xa28e('0x32')](_0xa28e('0x33'))){_0x3a8f4b['limit']=qs[_0xa28e('0x1b')](_0x14caae[_0xa28e('0x2c')]['limit']);_0x3a8f4b[_0xa28e('0x1a')]=qs['offset'](_0x14caae[_0xa28e('0x2c')]['offset']);}_0x3a8f4b[_0xa28e('0x34')]=qs[_0xa28e('0x35')](_0x14caae[_0xa28e('0x2c')][_0xa28e('0x35')]);_0x3a8f4b[_0xa28e('0x36')]=qs[_0xa28e('0x37')](_['pick'](_0x14caae[_0xa28e('0x2c')],_0xaaf84c[_0xa28e('0x37')]),_0x23ec2e);if(_0x14caae['query'][_0xa28e('0x38')]){_0x3a8f4b[_0xa28e('0x36')]=_[_0xa28e('0x39')](_0x3a8f4b[_0xa28e('0x36')],{'$or':_[_0xa28e('0x2b')](_0x23ec2e,function(_0x5084ea){if(_0x5084ea[_0xa28e('0x29')]!=='VIRTUAL'){var _0x4b098b={};_0x4b098b[_0x5084ea[_0xa28e('0x26')]]={'$like':'%'+_0x14caae[_0xa28e('0x2c')][_0xa28e('0x38')]+'%'};return _0x4b098b;}})});}_0x3a8f4b=_[_0xa28e('0x39')]({},_0x3a8f4b,_0x14caae[_0xa28e('0x3a')]);var _0x3fba8e={'where':_0x3a8f4b[_0xa28e('0x36')]};return db[_0xa28e('0x3b')]['count'](_0x3fba8e)['then'](function(_0x41ffee){_0x18bcd4['count']=_0x41ffee;if(_0x14caae[_0xa28e('0x2c')]['includeAll']){_0x3a8f4b[_0xa28e('0x3c')]=[{'all':!![]}];}return db[_0xa28e('0x3b')][_0xa28e('0x3d')](_0x3a8f4b);})[_0xa28e('0x20')](function(_0x285351){_0x18bcd4['rows']=_0x285351;return _0x18bcd4;})[_0xa28e('0x20')](respondWithFilteredResult(_0xc2cdd4,_0x3a8f4b))[_0xa28e('0x3e')](handleError(_0xc2cdd4,null));};exports[_0xa28e('0x3f')]=function(_0x49243f,_0x262917){var _0x2d3c69={'raw':!![],'where':{'id':_0x49243f[_0xa28e('0x40')]['id']}},_0x3751b5={};_0x3751b5['model']=_['keys'](db['SquareOdbc'][_0xa28e('0x41')]);_0x3751b5[_0xa28e('0x2c')]=_[_0xa28e('0x42')](_0x49243f['query']);_0x3751b5['filters']=_['intersection'](_0x3751b5['model'],_0x3751b5[_0xa28e('0x2c')]);_0x2d3c69['attributes']=_[_0xa28e('0x2d')](_0x3751b5['model'],qs[_0xa28e('0x30')](_0x49243f[_0xa28e('0x2c')]['fields']));_0x2d3c69[_0xa28e('0x2e')]=_0x2d3c69[_0xa28e('0x2e')]['length']?_0x2d3c69[_0xa28e('0x2e')]:_0x3751b5[_0xa28e('0x2f')];if(_0x49243f[_0xa28e('0x2c')]['includeAll']){_0x2d3c69['include']=[{'all':!![]}];}_0x2d3c69=_['merge']({},_0x2d3c69,_0x49243f[_0xa28e('0x3a')]);return db[_0xa28e('0x3b')][_0xa28e('0x43')](_0x2d3c69)[_0xa28e('0x20')](handleEntityNotFound(_0x262917,null))[_0xa28e('0x20')](respondWithResult(_0x262917,null))['catch'](handleError(_0x262917,null));};exports[_0xa28e('0x44')]=function(_0x2657ff,_0x87485e){return db['SquareOdbc']['create'](_0x2657ff[_0xa28e('0x45')],{})[_0xa28e('0x20')](function(_0x1b18db){var _0x57ebb3=_0x2657ff[_0xa28e('0x46')][_0xa28e('0x22')]({'plain':!![]});if(!_0x57ebb3)throw new Error(_0xa28e('0x47'));if(_0x57ebb3[_0xa28e('0x48')]===_0xa28e('0x46')){var _0x2a080a=_0x1b18db[_0xa28e('0x22')]({'plain':!![]});var _0x3e512b=_0xa28e('0x23');return db['UserProfileSection'][_0xa28e('0x43')]({'where':{'name':_0x3e512b,'userProfileId':_0x57ebb3[_0xa28e('0x49')]},'raw':!![]})[_0xa28e('0x20')](function(_0x157f4){if(_0x157f4&&_0x157f4['autoAssociation']===0x0){return db[_0xa28e('0x24')][_0xa28e('0x44')]({'name':_0x2a080a[_0xa28e('0x26')],'resourceId':_0x2a080a['id'],'type':_0x157f4[_0xa28e('0x26')],'sectionId':_0x157f4['id']},{})['then'](function(){return _0x1b18db;});}else{return _0x1b18db;}})['catch'](function(_0x53bf60){logger[_0xa28e('0x4a')](_0xa28e('0x4b'),_0x53bf60);throw _0x53bf60;});}return _0x1b18db;})['then'](respondWithResult(_0x87485e,0xc9))[_0xa28e('0x3e')](handleError(_0x87485e,null));};exports[_0xa28e('0x4c')]=function(_0x344166,_0x28dbd2){if(_0x344166[_0xa28e('0x45')]['id']){delete _0x344166[_0xa28e('0x45')]['id'];}return db[_0xa28e('0x3b')][_0xa28e('0x43')]({'where':{'id':_0x344166['params']['id']}})['then'](handleEntityNotFound(_0x28dbd2,null))['then'](saveUpdates(_0x344166['body'],null))['then'](respondWithResult(_0x28dbd2,null))['catch'](handleError(_0x28dbd2,null));};exports[_0xa28e('0x21')]=function(_0x170ceb,_0x165010){return db[_0xa28e('0x3b')][_0xa28e('0x43')]({'where':{'id':_0x170ceb['params']['id']}})[_0xa28e('0x20')](handleEntityNotFound(_0x165010,null))[_0xa28e('0x20')](removeEntity(_0x165010,null))[_0xa28e('0x3e')](handleError(_0x165010,null));};exports['test']=function(_0x1a6105,_0x57401f,_0x34af87){var _0x59f657;return db[_0xa28e('0x3b')]['find']({'where':{'id':_0x1a6105['params']['id']},'attributes':['id',_0xa28e('0x4d')]})[_0xa28e('0x20')](handleEntityNotFound(_0x57401f,null))[_0xa28e('0x20')](function(_0x1923e3){if(_0x1923e3){var _0x277e2a=require(_0xa28e('0x4e'))();_0x277e2a[_0xa28e('0x4f')](_0x1923e3[_0xa28e('0x4d')]);_0x277e2a[_0xa28e('0x50')]();return _0x1923e3;}})[_0xa28e('0x20')](respondWithResult(_0x57401f,null))[_0xa28e('0x3e')](handleError(_0x57401f,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 63c0c3a..ae5a101 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 _0xd71d=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xd71d,0xbf));var _0xdd71=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xd71d[_0x32b542];return _0x554d54;};'use strict';var _=require(_0xdd71('0x0'));var util=require(_0xdd71('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdd71('0x2'));var BPromise=require(_0xdd71('0x3'));var rp=require(_0xdd71('0x4'));var fs=require('fs');var path=require(_0xdd71('0x5'));var rimraf=require(_0xdd71('0x6'));var config=require(_0xdd71('0x7'));var attributes=require(_0xdd71('0x8'));module[_0xdd71('0x9')]=function(_0x368778,_0x35530c){return _0x368778[_0xdd71('0xa')](_0xdd71('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf84a=['../../config/logger','api','moment','bluebird','request-promise','path','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util'];(function(_0x1fd2e6,_0x319411){var _0x38284b=function(_0x220170){while(--_0x220170){_0x1fd2e6['push'](_0x1fd2e6['shift']());}};_0x38284b(++_0x319411);}(_0xf84a,0x1c7));var _0xaf84=function(_0x1d550d,_0x5130db){_0x1d550d=_0x1d550d-0x0;var _0x19b8bb=_0xf84a[_0x1d550d];return _0x19b8bb;};'use strict';var _=require('lodash');var util=require(_0xaf84('0x0'));var logger=require(_0xaf84('0x1'))(_0xaf84('0x2'));var moment=require(_0xaf84('0x3'));var BPromise=require(_0xaf84('0x4'));var rp=require(_0xaf84('0x5'));var fs=require('fs');var path=require(_0xaf84('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaf84('0x7'));module[_0xaf84('0x8')]=function(_0x5e5e79,_0x4c14ea){return _0x5e5e79[_0xaf84('0x9')](_0xaf84('0xa'),attributes,{'tableName':_0xaf84('0xb'),'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 fcd898f..9667fe1 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x55ca,0x126));var _0xa55c=function(_0x26a74d,_0x37ecfc){_0x26a74d=_0x26a74d-0x0;var _0xcbb1a3=_0x55ca[_0x26a74d];return _0xcbb1a3;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x46eb55,_0x3cbe36){var _0x2a98af=function(_0x52c26f){while(--_0x52c26f){_0x46eb55['push'](_0x46eb55['shift']());}};_0x2a98af(++_0x3cbe36);}(_0x55ca,0x126));var _0xa55c=function(_0x457c96,_0x13785c){_0x457c96=_0x457c96-0x0;var _0x4e5ebc=_0x55ca[_0x457c96];return _0x4e5ebc;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 49b2a9f..87270d9 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 _0x4b17=['exports','multer','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','addUsers','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b17,0x10f));var _0x74b1=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x4b17[_0x4d40dd];return _0x1c51f2;};'use strict';var multer=require(_0x74b1('0x0'));var util=require('util');var path=require(_0x74b1('0x1'));var timeout=require('connect-timeout');var express=require(_0x74b1('0x2'));var router=express[_0x74b1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x74b1('0x4'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0x74b1('0x5')]('/',auth[_0x74b1('0x6')](),controller[_0x74b1('0x7')]);router[_0x74b1('0x5')](_0x74b1('0x8'),auth[_0x74b1('0x6')](),controller[_0x74b1('0x9')]);router['get'](_0x74b1('0xa'),auth[_0x74b1('0x6')](),controller[_0x74b1('0xb')]);router[_0x74b1('0xc')]('/',auth[_0x74b1('0x6')](),controller['create']);router[_0x74b1('0xc')](_0x74b1('0xa'),auth['isAuthenticated'](),controller[_0x74b1('0xd')]);router[_0x74b1('0xe')](_0x74b1('0x8'),auth[_0x74b1('0x6')](),controller['update']);router[_0x74b1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x74b1('0x10')]);router[_0x74b1('0xf')]('/:id/users',auth['isAuthenticated'](),controller['removeUsers']);module[_0x74b1('0x11')]=router; \ No newline at end of file +var _0x3423=['./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','create','put','update','delete','removeUsers','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40e53a,_0x2f0d79){var _0x43700a=function(_0xea50a4){while(--_0xea50a4){_0x40e53a['push'](_0x40e53a['shift']());}};_0x43700a(++_0x2f0d79);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0x8')](_0x3342('0xd'),auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3342('0xf')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addUsers']);router[_0x3342('0x10')](_0x3342('0xb'),auth['isAuthenticated'](),controller[_0x3342('0x11')]);router['delete'](_0x3342('0xb'),auth[_0x3342('0x9')](),controller['destroy']);router[_0x3342('0x12')](_0x3342('0xd'),auth[_0x3342('0x9')](),controller[_0x3342('0x13')]);module[_0x3342('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 2971d88..85b7a0a 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 _0x85cf=['STRING','name','TEXT','BLOB','getDataValue','toString','utf8','production'];(function(_0x38f3a5,_0x56f869){var _0x446bbc=function(_0x1190df){while(--_0x1190df){_0x38f3a5['push'](_0x38f3a5['shift']());}};_0x446bbc(++_0x56f869);}(_0x85cf,0x70));var _0xf85c=function(_0xf548e8,_0x3591e8){_0xf548e8=_0xf548e8-0x0;var _0x39827b=_0x85cf[_0xf548e8];return _0x39827b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf85c('0x0')],'unique':_0xf85c('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xf85c('0x0')]},'notes':{'type':Sequelize[_0xf85c('0x2')]},'preproduction':{'type':Sequelize[_0xf85c('0x3')]('long'),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xf85c('0x4')]('preproduction')[_0xf85c('0x5')](_0xf85c('0x6'));}}},'production':{'type':Sequelize[_0xf85c('0x3')]('long'),'get':function(){if(this['getDataValue'](_0xf85c('0x7'))){return this['getDataValue'](_0xf85c('0x7'))[_0xf85c('0x5')]('utf8');}}}}; \ No newline at end of file +var _0xe3e1=['STRING','BLOB','preproduction','toString','utf8','long','production','sequelize'];(function(_0x4ccaf9,_0x2e20f0){var _0x5229b9=function(_0x1269d3){while(--_0x1269d3){_0x4ccaf9['push'](_0x4ccaf9['shift']());}};_0x5229b9(++_0x2e20f0);}(_0xe3e1,0xaf));var _0x1e3e=function(_0x8bfd20,_0x4ca91a){_0x8bfd20=_0x8bfd20-0x0;var _0x5853dc=_0xe3e1[_0x8bfd20];return _0x5853dc;};'use strict';var Sequelize=require(_0x1e3e('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e3e('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1e3e('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x1e3e('0x2')]('long'),'get':function(){if(this['getDataValue'](_0x1e3e('0x3'))){return this['getDataValue'](_0x1e3e('0x3'))[_0x1e3e('0x4')](_0x1e3e('0x5'));}}},'production':{'type':Sequelize[_0x1e3e('0x2')](_0x1e3e('0x6')),'get':function(){if(this['getDataValue'](_0x1e3e('0x7'))){return this['getDataValue'](_0x1e3e('0x7'))[_0x1e3e('0x4')](_0x1e3e('0x5'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1586594..754e957 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 _0x8c61=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','findOne','User','order','getUsers','nolimit','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','SquareProjects','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','map','VIRTUAL','merge','options','include','findAll','rows','show','params','create','body'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x8c61,0x7a));var _0x18c6=function(_0x22d62d,_0x33b816){_0x22d62d=_0x22d62d-0x0;var _0x20ef48=_0x8c61[_0x22d62d];return _0x20ef48;};'use strict';var pdf=require(_0x18c6('0x0'));var emlformat=require(_0x18c6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x18c6('0x2'));var jsonpatch=require(_0x18c6('0x3'));var rp=require(_0x18c6('0x4'));var moment=require(_0x18c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x18c6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x18c6('0x7'));var csv=require(_0x18c6('0x8'));var ejs=require(_0x18c6('0x9'));var fs=require('fs');var _=require(_0x18c6('0xa'));var squel=require(_0x18c6('0xb'));var crypto=require(_0x18c6('0xc'));var jsforce=require(_0x18c6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x18c6('0x8'));var querystring=require(_0x18c6('0xe'));var Papa=require(_0x18c6('0xf'));var Redis=require(_0x18c6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x18c6('0x11'));var as=require(_0x18c6('0x12'));var hardwareService=require(_0x18c6('0x13'));var logger=require(_0x18c6('0x14'))(_0x18c6('0x15'));var utils=require(_0x18c6('0x16'));var config=require(_0x18c6('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x18c6('0x18')],{'host':_0x18c6('0x19'),'port':0x18eb});var socket=require(_0x18c6('0x1a'))(new Redis(config[_0x18c6('0x18')]));require(_0x18c6('0x1b'))[_0x18c6('0x1c')](socket);function respondWithStatusCode(_0xfd0278,_0x5e4db6){_0x5e4db6=_0x5e4db6||0xcc;return function(_0x23fd06){if(_0x23fd06){return _0xfd0278['sendStatus'](_0x5e4db6);}return _0xfd0278[_0x18c6('0x1d')](_0x5e4db6)[_0x18c6('0x1e')]();};}function respondWithResult(_0x35829f,_0x15641c){_0x15641c=_0x15641c||0xc8;return function(_0x20f8ff){if(_0x20f8ff){return _0x35829f[_0x18c6('0x1d')](_0x15641c)[_0x18c6('0x1f')](_0x20f8ff);}};}function respondWithFilteredResult(_0x27a130,_0x54fa45){return function(_0x335bb6){if(_0x335bb6){var _0x2aece5=_0x335bb6[_0x18c6('0x20')],_0x16c848=_0x54fa45[_0x18c6('0x21')],_0x4e18c2=_0x54fa45[_0x18c6('0x21')]+_0x54fa45[_0x18c6('0x22')],_0x3db0ee;if(_0x4e18c2>=_0x2aece5){_0x4e18c2=_0x2aece5;_0x3db0ee=0xc8;}else{_0x3db0ee=0xce;}_0x27a130[_0x18c6('0x1d')](_0x3db0ee);return _0x27a130[_0x18c6('0x23')](_0x18c6('0x24'),_0x16c848+'-'+_0x4e18c2+'/'+_0x2aece5)[_0x18c6('0x1f')](_0x335bb6);}return null;};}function patchUpdates(_0x3e634e){return function(_0x5b72dd){try{jsonpatch[_0x18c6('0x25')](_0x5b72dd,_0x3e634e,!![]);}catch(_0x227676){return BPromise[_0x18c6('0x26')](_0x227676);}return _0x5b72dd[_0x18c6('0x27')]();};}function saveUpdates(_0x17f902,_0x1d1067){return function(_0x4d3bf4){if(_0x4d3bf4){return _0x4d3bf4['update'](_0x17f902)[_0x18c6('0x28')](function(_0x1d9df8){return _0x1d9df8;});}return null;};}function removeEntity(_0x27cbd0,_0x3c96b2){return function(_0x5adac7){if(_0x5adac7){return _0x5adac7['destroy']()['then'](function(){var _0x28d54f=_0x5adac7[_0x18c6('0x29')]({'plain':!![]});var _0x1e1489=_0x18c6('0x2a');return db[_0x18c6('0x2b')][_0x18c6('0x2c')]({'where':{'type':_0x1e1489,'resourceId':_0x28d54f['id']}})['then'](function(){return _0x5adac7;});})[_0x18c6('0x28')](function(){_0x27cbd0[_0x18c6('0x1d')](0xcc)[_0x18c6('0x1e')]();});}};}function handleEntityNotFound(_0x2c0d53,_0x314b64){return function(_0x169395){if(!_0x169395){_0x2c0d53[_0x18c6('0x2d')](0x194);}return _0x169395;};}function handleError(_0x202bf3,_0x5bf3ec){_0x5bf3ec=_0x5bf3ec||0x1f4;return function(_0x3fcaca){logger[_0x18c6('0x2e')](_0x3fcaca[_0x18c6('0x2f')]);if(_0x3fcaca[_0x18c6('0x30')]){delete _0x3fcaca[_0x18c6('0x30')];}_0x202bf3[_0x18c6('0x1d')](_0x5bf3ec)[_0x18c6('0x31')](_0x3fcaca);};}exports[_0x18c6('0x32')]=function(_0x39fcf3,_0x1f00e1){var _0x1f2596={},_0x531a15={},_0x4fbff2={'count':0x0,'rows':[]};var _0x22ed87=_['map'](db[_0x18c6('0x33')][_0x18c6('0x34')],function(_0x1c7898){return{'name':_0x1c7898[_0x18c6('0x35')],'type':_0x1c7898[_0x18c6('0x36')][_0x18c6('0x37')]};});_0x531a15['model']=_['map'](_0x22ed87,_0x18c6('0x30'));_0x531a15[_0x18c6('0x38')]=_[_0x18c6('0x39')](_0x39fcf3[_0x18c6('0x38')]);_0x531a15[_0x18c6('0x3a')]=_[_0x18c6('0x3b')](_0x531a15[_0x18c6('0x3c')],_0x531a15[_0x18c6('0x38')]);_0x1f2596[_0x18c6('0x3d')]=_[_0x18c6('0x3b')](_0x531a15[_0x18c6('0x3c')],qs['fields'](_0x39fcf3[_0x18c6('0x38')][_0x18c6('0x3e')]));_0x1f2596[_0x18c6('0x3d')]=_0x1f2596[_0x18c6('0x3d')][_0x18c6('0x3f')]?_0x1f2596['attributes']:_0x531a15['model'];if(!_0x39fcf3[_0x18c6('0x38')][_0x18c6('0x40')]('nolimit')){_0x1f2596[_0x18c6('0x22')]=qs[_0x18c6('0x22')](_0x39fcf3[_0x18c6('0x38')][_0x18c6('0x22')]);_0x1f2596[_0x18c6('0x21')]=qs['offset'](_0x39fcf3[_0x18c6('0x38')][_0x18c6('0x21')]);}_0x1f2596['order']=qs['sort'](_0x39fcf3[_0x18c6('0x38')][_0x18c6('0x41')]);_0x1f2596[_0x18c6('0x42')]=qs['filters'](_[_0x18c6('0x43')](_0x39fcf3[_0x18c6('0x38')],_0x531a15['filters']),_0x22ed87);if(_0x39fcf3['query'][_0x18c6('0x44')]){_0x1f2596[_0x18c6('0x42')]=_['merge'](_0x1f2596[_0x18c6('0x42')],{'$or':_[_0x18c6('0x45')](_0x22ed87,function(_0x5e19fd){if(_0x5e19fd[_0x18c6('0x36')]!==_0x18c6('0x46')){var _0x1e5d96={};_0x1e5d96[_0x5e19fd[_0x18c6('0x30')]]={'$like':'%'+_0x39fcf3[_0x18c6('0x38')][_0x18c6('0x44')]+'%'};return _0x1e5d96;}})});}_0x1f2596=_[_0x18c6('0x47')]({},_0x1f2596,_0x39fcf3[_0x18c6('0x48')]);var _0x13b8e4={'where':_0x1f2596['where']};return db[_0x18c6('0x33')][_0x18c6('0x20')](_0x13b8e4)[_0x18c6('0x28')](function(_0x565997){_0x4fbff2[_0x18c6('0x20')]=_0x565997;if(_0x39fcf3[_0x18c6('0x38')]['includeAll']){_0x1f2596[_0x18c6('0x49')]=[{'all':!![]}];}return db[_0x18c6('0x33')][_0x18c6('0x4a')](_0x1f2596);})[_0x18c6('0x28')](function(_0x4f1d7d){_0x4fbff2[_0x18c6('0x4b')]=_0x4f1d7d;return _0x4fbff2;})[_0x18c6('0x28')](respondWithFilteredResult(_0x1f00e1,_0x1f2596))['catch'](handleError(_0x1f00e1,null));};exports[_0x18c6('0x4c')]=function(_0x36e620,_0x31d9c5){var _0x1f8020={'raw':![],'where':{'id':_0x36e620[_0x18c6('0x4d')]['id']}},_0x3df5a2={};_0x3df5a2['model']=_[_0x18c6('0x39')](db[_0x18c6('0x33')][_0x18c6('0x34')]);_0x3df5a2[_0x18c6('0x38')]=_[_0x18c6('0x39')](_0x36e620[_0x18c6('0x38')]);_0x3df5a2[_0x18c6('0x3a')]=_[_0x18c6('0x3b')](_0x3df5a2[_0x18c6('0x3c')],_0x3df5a2['query']);_0x1f8020[_0x18c6('0x3d')]=_[_0x18c6('0x3b')](_0x3df5a2[_0x18c6('0x3c')],qs[_0x18c6('0x3e')](_0x36e620['query']['fields']));_0x1f8020[_0x18c6('0x3d')]=_0x1f8020[_0x18c6('0x3d')][_0x18c6('0x3f')]?_0x1f8020['attributes']:_0x3df5a2['model'];if(_0x36e620[_0x18c6('0x38')]['includeAll']){_0x1f8020['include']=[{'all':!![]}];}_0x1f8020=_[_0x18c6('0x47')]({},_0x1f8020,_0x36e620[_0x18c6('0x48')]);return db[_0x18c6('0x33')]['find'](_0x1f8020)['then'](handleEntityNotFound(_0x31d9c5,null))[_0x18c6('0x28')](respondWithResult(_0x31d9c5,null))['catch'](handleError(_0x31d9c5,null));};exports[_0x18c6('0x4e')]=function(_0x39ad38,_0x37e405){return db['SquareProject'][_0x18c6('0x4e')](_0x39ad38[_0x18c6('0x4f')],{})['then'](function(_0x360436){var _0x1e72a6=_0x39ad38['user'][_0x18c6('0x29')]({'plain':!![]});if(!_0x1e72a6)throw new Error(_0x18c6('0x50'));if(_0x1e72a6[_0x18c6('0x51')]===_0x18c6('0x52')){var _0x4f2d8d=_0x360436[_0x18c6('0x29')]({'plain':!![]});var _0x59632a=_0x18c6('0x2a');return db[_0x18c6('0x53')][_0x18c6('0x54')]({'where':{'name':_0x59632a,'userProfileId':_0x1e72a6[_0x18c6('0x55')]},'raw':!![]})[_0x18c6('0x28')](function(_0x2632d9){if(_0x2632d9&&_0x2632d9['autoAssociation']===0x0){return db['UserProfileResource'][_0x18c6('0x4e')]({'name':_0x4f2d8d[_0x18c6('0x30')],'resourceId':_0x4f2d8d['id'],'type':_0x2632d9[_0x18c6('0x30')],'sectionId':_0x2632d9['id']},{})['then'](function(){return _0x360436;});}else{return _0x360436;}})[_0x18c6('0x56')](function(_0x33e285){logger[_0x18c6('0x2e')](_0x18c6('0x57'),_0x33e285);throw _0x33e285;});}return _0x360436;})[_0x18c6('0x28')](respondWithResult(_0x37e405,0xc9))['catch'](handleError(_0x37e405,null));};exports[_0x18c6('0x58')]=function(_0x30fd90,_0x23f3dc){if(_0x30fd90[_0x18c6('0x4f')]['id']){delete _0x30fd90[_0x18c6('0x4f')]['id'];}return db[_0x18c6('0x33')][_0x18c6('0x54')]({'where':{'id':_0x30fd90['params']['id']}})[_0x18c6('0x28')](handleEntityNotFound(_0x23f3dc,null))[_0x18c6('0x28')](saveUpdates(_0x30fd90[_0x18c6('0x4f')],null))[_0x18c6('0x28')](respondWithResult(_0x23f3dc,null))[_0x18c6('0x56')](handleError(_0x23f3dc,null));};exports[_0x18c6('0x2c')]=function(_0xe7ab4a,_0x3cf745){return db[_0x18c6('0x33')][_0x18c6('0x54')]({'where':{'id':_0xe7ab4a[_0x18c6('0x4d')]['id']}})[_0x18c6('0x28')](handleEntityNotFound(_0x3cf745,null))[_0x18c6('0x28')](removeEntity(_0x3cf745,null))[_0x18c6('0x56')](handleError(_0x3cf745,null));};exports['addUsers']=function(_0x171b8a,_0x2c82a6,_0x391ae3){return db[_0x18c6('0x33')][_0x18c6('0x54')]({'where':{'id':_0x171b8a[_0x18c6('0x4d')]['id']}})[_0x18c6('0x28')](handleEntityNotFound(_0x2c82a6,null))[_0x18c6('0x28')](function(_0x5f1f8b){if(_0x5f1f8b){return _0x5f1f8b[_0x18c6('0x59')](_0x171b8a[_0x18c6('0x4f')][_0x18c6('0x5a')],_[_0x18c6('0x5b')](_0x171b8a['body'],[_0x18c6('0x5a'),'id'])||{});}})[_0x18c6('0x28')](respondWithResult(_0x2c82a6,null))[_0x18c6('0x56')](handleError(_0x2c82a6,null));};exports[_0x18c6('0x5c')]=function(_0x2d20f6,_0x5499b7,_0x5b86aa){return db[_0x18c6('0x33')][_0x18c6('0x54')]({'where':{'id':_0x2d20f6[_0x18c6('0x4d')]['id']}})[_0x18c6('0x28')](handleEntityNotFound(_0x5499b7,null))[_0x18c6('0x28')](function(_0x31f5b1){if(_0x31f5b1){return _0x31f5b1[_0x18c6('0x5c')](_0x2d20f6[_0x18c6('0x38')][_0x18c6('0x5a')])[_0x18c6('0x28')](function(){if(_[_0x18c6('0x5d')](_0x2d20f6[_0x18c6('0x38')][_0x18c6('0x5a')])){for(var _0xe0a490=0x0;_0xe0a490<_0x2d20f6['query'][_0x18c6('0x5a')][_0x18c6('0x3f')];_0xe0a490+=0x1){socket['emit'](_0x18c6('0x5e'),{'UserId':Number(_0x2d20f6['query'][_0x18c6('0x5a')][_0xe0a490]),'SquareProjectId':Number(_0x2d20f6[_0x18c6('0x4d')]['id'])});}}else{socket[_0x18c6('0x5f')](_0x18c6('0x5e'),{'UserId':Number(_0x2d20f6[_0x18c6('0x38')]['ids']),'SquareProjectId':Number(_0x2d20f6[_0x18c6('0x4d')]['id'])});}});}})[_0x18c6('0x28')](respondWithStatusCode(_0x5499b7,null))[_0x18c6('0x56')](handleError(_0x5499b7,null));};exports['getUsers']=function(_0x37ba5e,_0x5a5616,_0x4f2927){var _0x33c7f4={};var _0xbbd3af={};var _0x27b972;var _0x2866aa;return db[_0x18c6('0x33')][_0x18c6('0x60')]({'where':{'id':_0x37ba5e[_0x18c6('0x4d')]['id']}})[_0x18c6('0x28')](handleEntityNotFound(_0x5a5616,null))['then'](function(_0x5814eb){if(_0x5814eb){_0x27b972=_0x5814eb;_0xbbd3af[_0x18c6('0x3c')]=_[_0x18c6('0x39')](db[_0x18c6('0x61')][_0x18c6('0x34')]);_0xbbd3af[_0x18c6('0x38')]=_[_0x18c6('0x39')](_0x37ba5e[_0x18c6('0x38')]);_0xbbd3af[_0x18c6('0x3a')]=_['intersection'](_0xbbd3af[_0x18c6('0x3c')],_0xbbd3af[_0x18c6('0x38')]);_0x33c7f4[_0x18c6('0x3d')]=_[_0x18c6('0x3b')](_0xbbd3af[_0x18c6('0x3c')],qs[_0x18c6('0x3e')](_0x37ba5e[_0x18c6('0x38')]['fields']));_0x33c7f4['attributes']=_0x33c7f4[_0x18c6('0x3d')][_0x18c6('0x3f')]?_0x33c7f4['attributes']:_0xbbd3af[_0x18c6('0x3c')];_0x33c7f4[_0x18c6('0x62')]=qs[_0x18c6('0x41')](_0x37ba5e['query']['sort']);_0x33c7f4[_0x18c6('0x42')]=qs['filters'](_[_0x18c6('0x43')](_0x37ba5e[_0x18c6('0x38')],_0xbbd3af['filters']));if(_0x37ba5e['query'][_0x18c6('0x44')]){_0x33c7f4[_0x18c6('0x42')]=_[_0x18c6('0x47')](_0x33c7f4[_0x18c6('0x42')],{'$or':_[_0x18c6('0x45')](_0x33c7f4[_0x18c6('0x3d')],function(_0x165522){var _0x65742f={};_0x65742f[_0x165522]={'$like':'%'+_0x37ba5e[_0x18c6('0x38')][_0x18c6('0x44')]+'%'};return _0x65742f;})});}_0x33c7f4=_[_0x18c6('0x47')]({},_0x33c7f4,_0x37ba5e['options']);return _0x27b972[_0x18c6('0x63')](_0x33c7f4);}})[_0x18c6('0x28')](function(_0x2d3a10){if(_0x2d3a10){_0x2866aa=_0x2d3a10[_0x18c6('0x3f')];if(!_0x37ba5e[_0x18c6('0x38')][_0x18c6('0x40')](_0x18c6('0x64'))){_0x33c7f4[_0x18c6('0x22')]=qs['limit'](_0x37ba5e[_0x18c6('0x38')][_0x18c6('0x22')]);_0x33c7f4[_0x18c6('0x21')]=qs[_0x18c6('0x21')](_0x37ba5e[_0x18c6('0x38')]['offset']);}return _0x27b972[_0x18c6('0x63')](_0x33c7f4);}})[_0x18c6('0x28')](function(_0x360f5d){if(_0x360f5d){return _0x360f5d?{'count':_0x2866aa,'rows':_0x360f5d}:null;}})['then'](respondWithResult(_0x5a5616,null))[_0x18c6('0x56')](handleError(_0x5a5616,null));}; \ No newline at end of file +var _0xf51b=['path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','options','include','catch','show','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','body','addUsers','params','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','order','filter','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x4e8165,_0x4aac69){var _0x56f576=function(_0x2ce95c){while(--_0x2ce95c){_0x4e8165['push'](_0x4e8165['shift']());}};_0x56f576(++_0x4aac69);}(_0xf51b,0x10b));var _0xbf51=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf51b[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf51('0x0'));var rimraf=require(_0xbf51('0x1'));var zipdir=require(_0xbf51('0x2'));var jsonpatch=require(_0xbf51('0x3'));var rp=require(_0xbf51('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf51('0x5'));var util=require('util');var path=require(_0xbf51('0x6'));var sox=require(_0xbf51('0x7'));var csv=require(_0xbf51('0x8'));var ejs=require(_0xbf51('0x9'));var fs=require('fs');var _=require(_0xbf51('0xa'));var squel=require(_0xbf51('0xb'));var crypto=require('crypto');var jsforce=require(_0xbf51('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf51('0xd'));var Papa=require('papaparse');var Redis=require(_0xbf51('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf51('0xf'));var logger=require(_0xbf51('0x10'))(_0xbf51('0x11'));var utils=require(_0xbf51('0x12'));var config=require(_0xbf51('0x13'));var db=require('../../mysqldb')['db'];config[_0xbf51('0x14')]=_[_0xbf51('0x15')](config[_0xbf51('0x14')],{'host':_0xbf51('0x16'),'port':0x18eb});var socket=require(_0xbf51('0x17'))(new Redis(config[_0xbf51('0x14')]));require(_0xbf51('0x18'))[_0xbf51('0x19')](socket);function respondWithStatusCode(_0x3217fc,_0x4656d9){_0x4656d9=_0x4656d9||0xcc;return function(_0x41c122){if(_0x41c122){return _0x3217fc['sendStatus'](_0x4656d9);}return _0x3217fc['status'](_0x4656d9)[_0xbf51('0x1a')]();};}function respondWithResult(_0x4eb2f9,_0xf8b104){_0xf8b104=_0xf8b104||0xc8;return function(_0x594aff){if(_0x594aff){return _0x4eb2f9[_0xbf51('0x1b')](_0xf8b104)[_0xbf51('0x1c')](_0x594aff);}};}function respondWithFilteredResult(_0x24eb78,_0x17cf0c){return function(_0x577f61){if(_0x577f61){var _0x153cf3=_0x577f61[_0xbf51('0x1d')],_0x98312e=_0x17cf0c[_0xbf51('0x1e')],_0x5a2c9f=_0x17cf0c[_0xbf51('0x1e')]+_0x17cf0c[_0xbf51('0x1f')],_0x3e8ce0;if(_0x5a2c9f>=_0x153cf3){_0x5a2c9f=_0x153cf3;_0x3e8ce0=0xc8;}else{_0x3e8ce0=0xce;}_0x24eb78[_0xbf51('0x1b')](_0x3e8ce0);return _0x24eb78[_0xbf51('0x20')](_0xbf51('0x21'),_0x98312e+'-'+_0x5a2c9f+'/'+_0x153cf3)[_0xbf51('0x1c')](_0x577f61);}return null;};}function patchUpdates(_0x3dae8d){return function(_0x30b4f8){try{jsonpatch[_0xbf51('0x22')](_0x30b4f8,_0x3dae8d,!![]);}catch(_0x31f78f){return BPromise['reject'](_0x31f78f);}return _0x30b4f8[_0xbf51('0x23')]();};}function saveUpdates(_0x3b736e,_0x44f538){return function(_0xf26d86){if(_0xf26d86){return _0xf26d86[_0xbf51('0x24')](_0x3b736e)[_0xbf51('0x25')](function(_0x3ac569){return _0x3ac569;});}return null;};}function removeEntity(_0x3baf88,_0x19620e){return function(_0x14d86a){if(_0x14d86a){return _0x14d86a[_0xbf51('0x26')]()[_0xbf51('0x25')](function(){var _0x2c0d53=_0x14d86a[_0xbf51('0x27')]({'plain':!![]});var _0x2c388f=_0xbf51('0x28');return db[_0xbf51('0x29')][_0xbf51('0x26')]({'where':{'type':_0x2c388f,'resourceId':_0x2c0d53['id']}})['then'](function(){return _0x14d86a;});})[_0xbf51('0x25')](function(){_0x3baf88[_0xbf51('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fabd,_0x286c9b){return function(_0x6b8cf1){if(!_0x6b8cf1){_0x33fabd['sendStatus'](0x194);}return _0x6b8cf1;};}function handleError(_0x6953fe,_0x3d1b8d){_0x3d1b8d=_0x3d1b8d||0x1f4;return function(_0x45b0e2){logger[_0xbf51('0x2a')](_0x45b0e2[_0xbf51('0x2b')]);if(_0x45b0e2[_0xbf51('0x2c')]){delete _0x45b0e2[_0xbf51('0x2c')];}_0x6953fe['status'](_0x3d1b8d)['send'](_0x45b0e2);};}exports[_0xbf51('0x2d')]=function(_0x2b6468,_0x31af64){var _0x3b401d={},_0x2594c3={},_0x2f9c55={'count':0x0,'rows':[]};var _0x309d81=_[_0xbf51('0x2e')](db[_0xbf51('0x2f')][_0xbf51('0x30')],function(_0x23cea6){return{'name':_0x23cea6[_0xbf51('0x31')],'type':_0x23cea6[_0xbf51('0x32')]['key']};});_0x2594c3[_0xbf51('0x33')]=_['map'](_0x309d81,_0xbf51('0x2c'));_0x2594c3[_0xbf51('0x34')]=_['keys'](_0x2b6468['query']);_0x2594c3['filters']=_[_0xbf51('0x35')](_0x2594c3[_0xbf51('0x33')],_0x2594c3[_0xbf51('0x34')]);_0x3b401d['attributes']=_['intersection'](_0x2594c3[_0xbf51('0x33')],qs[_0xbf51('0x36')](_0x2b6468[_0xbf51('0x34')]['fields']));_0x3b401d[_0xbf51('0x37')]=_0x3b401d[_0xbf51('0x37')][_0xbf51('0x38')]?_0x3b401d[_0xbf51('0x37')]:_0x2594c3[_0xbf51('0x33')];if(!_0x2b6468[_0xbf51('0x34')][_0xbf51('0x39')](_0xbf51('0x3a'))){_0x3b401d['limit']=qs[_0xbf51('0x1f')](_0x2b6468[_0xbf51('0x34')]['limit']);_0x3b401d[_0xbf51('0x1e')]=qs[_0xbf51('0x1e')](_0x2b6468[_0xbf51('0x34')]['offset']);}_0x3b401d['order']=qs[_0xbf51('0x3b')](_0x2b6468[_0xbf51('0x34')][_0xbf51('0x3b')]);_0x3b401d[_0xbf51('0x3c')]=qs[_0xbf51('0x3d')](_[_0xbf51('0x3e')](_0x2b6468[_0xbf51('0x34')],_0x2594c3[_0xbf51('0x3d')]),_0x309d81);if(_0x2b6468['query']['filter']){_0x3b401d[_0xbf51('0x3c')]=_[_0xbf51('0x3f')](_0x3b401d[_0xbf51('0x3c')],{'$or':_['map'](_0x309d81,function(_0x2042ba){if(_0x2042ba[_0xbf51('0x32')]!=='VIRTUAL'){var _0x304a2f={};_0x304a2f[_0x2042ba[_0xbf51('0x2c')]]={'$like':'%'+_0x2b6468['query']['filter']+'%'};return _0x304a2f;}})});}_0x3b401d=_[_0xbf51('0x3f')]({},_0x3b401d,_0x2b6468[_0xbf51('0x40')]);var _0x2d21c5={'where':_0x3b401d['where']};return db[_0xbf51('0x2f')][_0xbf51('0x1d')](_0x2d21c5)[_0xbf51('0x25')](function(_0x20d9c5){_0x2f9c55[_0xbf51('0x1d')]=_0x20d9c5;if(_0x2b6468[_0xbf51('0x34')]['includeAll']){_0x3b401d[_0xbf51('0x41')]=[{'all':!![]}];}return db[_0xbf51('0x2f')]['findAll'](_0x3b401d);})[_0xbf51('0x25')](function(_0x4b2a13){_0x2f9c55['rows']=_0x4b2a13;return _0x2f9c55;})['then'](respondWithFilteredResult(_0x31af64,_0x3b401d))[_0xbf51('0x42')](handleError(_0x31af64,null));};exports[_0xbf51('0x43')]=function(_0x1600a3,_0x4ed61d){var _0x2a24f1={'raw':![],'where':{'id':_0x1600a3['params']['id']}},_0x169b00={};_0x169b00[_0xbf51('0x33')]=_[_0xbf51('0x44')](db[_0xbf51('0x2f')][_0xbf51('0x30')]);_0x169b00[_0xbf51('0x34')]=_[_0xbf51('0x44')](_0x1600a3[_0xbf51('0x34')]);_0x169b00[_0xbf51('0x3d')]=_['intersection'](_0x169b00['model'],_0x169b00[_0xbf51('0x34')]);_0x2a24f1['attributes']=_[_0xbf51('0x35')](_0x169b00['model'],qs['fields'](_0x1600a3[_0xbf51('0x34')][_0xbf51('0x36')]));_0x2a24f1[_0xbf51('0x37')]=_0x2a24f1['attributes'][_0xbf51('0x38')]?_0x2a24f1[_0xbf51('0x37')]:_0x169b00['model'];if(_0x1600a3[_0xbf51('0x34')][_0xbf51('0x45')]){_0x2a24f1['include']=[{'all':!![]}];}_0x2a24f1=_[_0xbf51('0x3f')]({},_0x2a24f1,_0x1600a3[_0xbf51('0x40')]);return db['SquareProject'][_0xbf51('0x46')](_0x2a24f1)[_0xbf51('0x25')](handleEntityNotFound(_0x4ed61d,null))[_0xbf51('0x25')](respondWithResult(_0x4ed61d,null))['catch'](handleError(_0x4ed61d,null));};exports[_0xbf51('0x47')]=function(_0x9a0465,_0x3cab3c){return db['SquareProject'][_0xbf51('0x47')](_0x9a0465['body'],{})['then'](function(_0x2d68b0){var _0x2ea119=_0x9a0465[_0xbf51('0x48')][_0xbf51('0x27')]({'plain':!![]});if(!_0x2ea119)throw new Error(_0xbf51('0x49'));if(_0x2ea119[_0xbf51('0x4a')]==='user'){var _0x3a9930=_0x2d68b0[_0xbf51('0x27')]({'plain':!![]});var _0x3693a1=_0xbf51('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x3693a1,'userProfileId':_0x2ea119[_0xbf51('0x4b')]},'raw':!![]})[_0xbf51('0x25')](function(_0x307e60){if(_0x307e60&&_0x307e60[_0xbf51('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x3a9930[_0xbf51('0x2c')],'resourceId':_0x3a9930['id'],'type':_0x307e60['name'],'sectionId':_0x307e60['id']},{})['then'](function(){return _0x2d68b0;});}else{return _0x2d68b0;}})[_0xbf51('0x42')](function(_0x314fcf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x314fcf);throw _0x314fcf;});}return _0x2d68b0;})[_0xbf51('0x25')](respondWithResult(_0x3cab3c,0xc9))['catch'](handleError(_0x3cab3c,null));};exports[_0xbf51('0x24')]=function(_0x2fda8a,_0x3a8740){if(_0x2fda8a[_0xbf51('0x4d')]['id']){delete _0x2fda8a[_0xbf51('0x4d')]['id'];}return db[_0xbf51('0x2f')]['find']({'where':{'id':_0x2fda8a['params']['id']}})['then'](handleEntityNotFound(_0x3a8740,null))[_0xbf51('0x25')](saveUpdates(_0x2fda8a[_0xbf51('0x4d')],null))['then'](respondWithResult(_0x3a8740,null))[_0xbf51('0x42')](handleError(_0x3a8740,null));};exports['destroy']=function(_0x25d5ea,_0x3727c3){return db[_0xbf51('0x2f')][_0xbf51('0x46')]({'where':{'id':_0x25d5ea['params']['id']}})[_0xbf51('0x25')](handleEntityNotFound(_0x3727c3,null))[_0xbf51('0x25')](removeEntity(_0x3727c3,null))[_0xbf51('0x42')](handleError(_0x3727c3,null));};exports[_0xbf51('0x4e')]=function(_0x168204,_0xef57c2,_0x3eb18e){return db[_0xbf51('0x2f')][_0xbf51('0x46')]({'where':{'id':_0x168204[_0xbf51('0x4f')]['id']}})[_0xbf51('0x25')](handleEntityNotFound(_0xef57c2,null))[_0xbf51('0x25')](function(_0x59bd77){if(_0x59bd77){return _0x59bd77[_0xbf51('0x4e')](_0x168204['body']['ids'],_[_0xbf51('0x50')](_0x168204[_0xbf51('0x4d')],[_0xbf51('0x51'),'id'])||{});}})[_0xbf51('0x25')](respondWithResult(_0xef57c2,null))[_0xbf51('0x42')](handleError(_0xef57c2,null));};exports[_0xbf51('0x52')]=function(_0x44b39a,_0x473742,_0x106645){return db[_0xbf51('0x2f')]['find']({'where':{'id':_0x44b39a[_0xbf51('0x4f')]['id']}})[_0xbf51('0x25')](handleEntityNotFound(_0x473742,null))[_0xbf51('0x25')](function(_0x44e3b9){if(_0x44e3b9){return _0x44e3b9[_0xbf51('0x52')](_0x44b39a['query'][_0xbf51('0x51')])[_0xbf51('0x25')](function(){if(_[_0xbf51('0x53')](_0x44b39a[_0xbf51('0x34')][_0xbf51('0x51')])){for(var _0x40122b=0x0;_0x40122b<_0x44b39a[_0xbf51('0x34')]['ids'][_0xbf51('0x38')];_0x40122b+=0x1){socket[_0xbf51('0x54')](_0xbf51('0x55'),{'UserId':Number(_0x44b39a[_0xbf51('0x34')][_0xbf51('0x51')][_0x40122b]),'SquareProjectId':Number(_0x44b39a['params']['id'])});}}else{socket[_0xbf51('0x54')](_0xbf51('0x55'),{'UserId':Number(_0x44b39a[_0xbf51('0x34')][_0xbf51('0x51')]),'SquareProjectId':Number(_0x44b39a['params']['id'])});}});}})[_0xbf51('0x25')](respondWithStatusCode(_0x473742,null))[_0xbf51('0x42')](handleError(_0x473742,null));};exports['getUsers']=function(_0x4b71eb,_0x3d37cc,_0x135ab4){var _0x37ad04={};var _0x410eba={};var _0x191676;var _0x20b4c7;return db[_0xbf51('0x2f')][_0xbf51('0x56')]({'where':{'id':_0x4b71eb[_0xbf51('0x4f')]['id']}})[_0xbf51('0x25')](handleEntityNotFound(_0x3d37cc,null))[_0xbf51('0x25')](function(_0xe0241c){if(_0xe0241c){_0x191676=_0xe0241c;_0x410eba[_0xbf51('0x33')]=_[_0xbf51('0x44')](db[_0xbf51('0x57')][_0xbf51('0x30')]);_0x410eba[_0xbf51('0x34')]=_['keys'](_0x4b71eb[_0xbf51('0x34')]);_0x410eba[_0xbf51('0x3d')]=_['intersection'](_0x410eba[_0xbf51('0x33')],_0x410eba[_0xbf51('0x34')]);_0x37ad04[_0xbf51('0x37')]=_[_0xbf51('0x35')](_0x410eba[_0xbf51('0x33')],qs[_0xbf51('0x36')](_0x4b71eb[_0xbf51('0x34')][_0xbf51('0x36')]));_0x37ad04[_0xbf51('0x37')]=_0x37ad04[_0xbf51('0x37')][_0xbf51('0x38')]?_0x37ad04[_0xbf51('0x37')]:_0x410eba[_0xbf51('0x33')];_0x37ad04[_0xbf51('0x58')]=qs[_0xbf51('0x3b')](_0x4b71eb['query'][_0xbf51('0x3b')]);_0x37ad04[_0xbf51('0x3c')]=qs[_0xbf51('0x3d')](_[_0xbf51('0x3e')](_0x4b71eb['query'],_0x410eba[_0xbf51('0x3d')]));if(_0x4b71eb[_0xbf51('0x34')][_0xbf51('0x59')]){_0x37ad04[_0xbf51('0x3c')]=_[_0xbf51('0x3f')](_0x37ad04[_0xbf51('0x3c')],{'$or':_['map'](_0x37ad04[_0xbf51('0x37')],function(_0x1c06e4){var _0x13c43a={};_0x13c43a[_0x1c06e4]={'$like':'%'+_0x4b71eb[_0xbf51('0x34')][_0xbf51('0x59')]+'%'};return _0x13c43a;})});}_0x37ad04=_[_0xbf51('0x3f')]({},_0x37ad04,_0x4b71eb[_0xbf51('0x40')]);return _0x191676[_0xbf51('0x5a')](_0x37ad04);}})[_0xbf51('0x25')](function(_0x5c0e9d){if(_0x5c0e9d){_0x20b4c7=_0x5c0e9d[_0xbf51('0x38')];if(!_0x4b71eb[_0xbf51('0x34')][_0xbf51('0x39')](_0xbf51('0x3a'))){_0x37ad04['limit']=qs[_0xbf51('0x1f')](_0x4b71eb[_0xbf51('0x34')][_0xbf51('0x1f')]);_0x37ad04[_0xbf51('0x1e')]=qs[_0xbf51('0x1e')](_0x4b71eb[_0xbf51('0x34')][_0xbf51('0x1e')]);}return _0x191676[_0xbf51('0x5a')](_0x37ad04);}})[_0xbf51('0x25')](function(_0x4ccf99){if(_0x4ccf99){return _0x4ccf99?{'count':_0x20b4c7,'rows':_0x4ccf99}:null;}})[_0xbf51('0x25')](respondWithResult(_0x3d37cc,null))[_0xbf51('0x42')](handleError(_0x3d37cc,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 8bad8ea..94cc503 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 _0x374f=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x431a28,_0x1854ca){var _0x3885b7=function(_0x482f7f){while(--_0x482f7f){_0x431a28['push'](_0x431a28['shift']());}};_0x3885b7(++_0x1854ca);}(_0x374f,0x13f));var _0xf374=function(_0x5579ae,_0xf83ee){_0x5579ae=_0x5579ae-0x0;var _0x6490f0=_0x374f[_0x5579ae];return _0x6490f0;};'use strict';var EventEmitter=require(_0xf374('0x0'));var SquareProject=require(_0xf374('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf374('0x2')](0x0);var events={'afterCreate':_0xf374('0x3'),'afterUpdate':_0xf374('0x4'),'afterDestroy':_0xf374('0x5')};function emitEvent(_0x3a54de){return function(_0x344992,_0x391918,_0x148e4a){SquareProjectEvents[_0xf374('0x6')](_0x3a54de+':'+_0x344992['id'],_0x344992);SquareProjectEvents[_0xf374('0x6')](_0x3a54de,_0x344992);_0x148e4a(null);};}for(var e in events){if(events[_0xf374('0x7')](e)){var event=events[e];SquareProject[_0xf374('0x8')](e,emitEvent(event));}}module[_0xf374('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xca66=['save','remove','emit','exports','events','SquareProject','setMaxListeners'];(function(_0x5d03c7,_0x5f5725){var _0x4dd1e0=function(_0x4a8523){while(--_0x4a8523){_0x5d03c7['push'](_0x5d03c7['shift']());}};_0x4dd1e0(++_0x5f5725);}(_0xca66,0xb3));var _0x6ca6=function(_0x26d290,_0x2de876){_0x26d290=_0x26d290-0x0;var _0x244a20=_0xca66[_0x26d290];return _0x244a20;};'use strict';var EventEmitter=require(_0x6ca6('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x6ca6('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6ca6('0x2')](0x0);var events={'afterCreate':_0x6ca6('0x3'),'afterUpdate':'update','afterDestroy':_0x6ca6('0x4')};function emitEvent(_0x4a1f25){return function(_0x292b53,_0xf0e76,_0x1603ee){SquareProjectEvents[_0x6ca6('0x5')](_0x4a1f25+':'+_0x292b53['id'],_0x292b53);SquareProjectEvents[_0x6ca6('0x5')](_0x4a1f25,_0x292b53);_0x1603ee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x6ca6('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 4962bbf..b504fdf 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 _0x2ef3=['exports','define','SquareProject','square_projects','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareProject.attributes'];(function(_0x29f9d6,_0x5e232b){var _0xb9d84c=function(_0x1807c2){while(--_0x1807c2){_0x29f9d6['push'](_0x29f9d6['shift']());}};_0xb9d84c(++_0x5e232b);}(_0x2ef3,0xba));var _0x32ef=function(_0x19195c,_0x4118e6){_0x19195c=_0x19195c-0x0;var _0x35a85d=_0x2ef3[_0x19195c];return _0x35a85d;};'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 +var _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./squareProject.attributes','exports','SquareProject','square_projects','util'];(function(_0x5a5d36,_0x403479){var _0xa1d458=function(_0x49bed0){while(--_0x49bed0){_0x5a5d36['push'](_0x5a5d36['shift']());}};_0xa1d458(++_0x403479);}(_0x14a0,0x8e));var _0x014a=function(_0x1b38ec,_0x13ec29){_0x1b38ec=_0x1b38ec-0x0;var _0x523f01=_0x14a0[_0x1b38ec];return _0x523f01;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6aae1b4..3f3a4f2 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 _0x49b6=['where','attributes','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSquareProject','find','options'];(function(_0x1f797e,_0x2c40a0){var _0x32ee44=function(_0x74bb8d){while(--_0x74bb8d){_0x1f797e['push'](_0x1f797e['shift']());}};_0x32ee44(++_0x2c40a0);}(_0x49b6,0x11d));var _0x649b=function(_0x4b6f5c,_0x56f7ce){_0x4b6f5c=_0x4b6f5c-0x0;var _0x55548b=_0x49b6[_0x4b6f5c];return _0x55548b;};'use strict';var _=require('lodash');var util=require(_0x649b('0x0'));var moment=require(_0x649b('0x1'));var BPromise=require(_0x649b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x649b('0x3'));var db=require(_0x649b('0x4'))['db'];var utils=require(_0x649b('0x5'));var logger=require(_0x649b('0x6'))(_0x649b('0x7'));var config=require(_0x649b('0x8'));var jayson=require(_0x649b('0x9'));var client=jayson[_0x649b('0xa')]['http']({'port':0x232a});config[_0x649b('0xb')]=_[_0x649b('0xc')](config[_0x649b('0xb')],{'host':_0x649b('0xd'),'port':0x18eb});var socket=require(_0x649b('0xe'))(new Redis(config[_0x649b('0xb')]));require('./squareProject.socket')[_0x649b('0xf')](socket);function respondWithRpcPromise(_0x250328,_0x77b3fa,_0x5cc099){return new BPromise(function(_0x56ca9c,_0x56b0f5){return client['request'](_0x250328,_0x5cc099)[_0x649b('0x10')](function(_0x51a0fc){logger['info'](_0x649b('0x11'),_0x77b3fa,_0x649b('0x12'));logger[_0x649b('0x13')](_0x649b('0x14'),_0x77b3fa,_0x649b('0x12'),JSON[_0x649b('0x15')](_0x51a0fc));if(_0x51a0fc[_0x649b('0x16')]){if(_0x51a0fc[_0x649b('0x16')]['code']===0x1f4){logger[_0x649b('0x16')](_0x649b('0x11'),_0x77b3fa,_0x51a0fc['error'][_0x649b('0x17')]);return _0x56b0f5(_0x51a0fc[_0x649b('0x16')][_0x649b('0x17')]);}logger['error'](_0x649b('0x11'),_0x77b3fa,_0x51a0fc['error'][_0x649b('0x17')]);return _0x56ca9c(_0x51a0fc[_0x649b('0x16')]['message']);}else{logger[_0x649b('0x18')](_0x649b('0x11'),_0x77b3fa,_0x649b('0x12'));_0x56ca9c(_0x51a0fc[_0x649b('0x19')][_0x649b('0x17')]);}})[_0x649b('0x1a')](function(_0x14e1f9){logger[_0x649b('0x16')]('SquareProject,\x20%s,\x20%s',_0x77b3fa,_0x14e1f9);_0x56b0f5(_0x14e1f9);});});}exports[_0x649b('0x1b')]=function(_0x5c89ee){var _0x1d7267=this;return new Promise(function(_0x1881b6,_0x459717){return db['SquareProject'][_0x649b('0x1c')]({'raw':_0x5c89ee[_0x649b('0x1d')]?_0x5c89ee[_0x649b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c89ee[_0x649b('0x1d')]?_0x5c89ee[_0x649b('0x1d')][_0x649b('0x1e')]||null:null,'attributes':_0x5c89ee['options']?_0x5c89ee['options'][_0x649b('0x1f')]||null:null,'include':_0x5c89ee[_0x649b('0x1d')]?_0x5c89ee['options'][_0x649b('0x20')]?_[_0x649b('0x21')](_0x5c89ee[_0x649b('0x1d')]['include'],function(_0x346f36){return{'model':db[_0x346f36['model']],'as':_0x346f36['as'],'attributes':_0x346f36[_0x649b('0x1f')],'include':_0x346f36[_0x649b('0x20')]?_[_0x649b('0x21')](_0x346f36['include'],function(_0x112871){return{'model':db[_0x112871['model']],'as':_0x112871['as'],'attributes':_0x112871[_0x649b('0x1f')],'include':_0x112871[_0x649b('0x20')]?_[_0x649b('0x21')](_0x112871['include'],function(_0x4261b9){return{'model':db[_0x4261b9[_0x649b('0x22')]],'as':_0x4261b9['as'],'attributes':_0x4261b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x649b('0x10')](function(_0x3c91a5){logger[_0x649b('0x18')](_0x649b('0x1b'),_0x5c89ee);logger[_0x649b('0x13')](_0x649b('0x1b'),_0x5c89ee,JSON[_0x649b('0x15')](_0x3c91a5));_0x1881b6(_0x3c91a5);})[_0x649b('0x1a')](function(_0x538fb4){logger['error']('ShowSquareProject',_0x538fb4[_0x649b('0x17')],_0x5c89ee);_0x459717(_0x1d7267[_0x649b('0x16')](0x1f4,_0x538fb4['message']));});});}; \ No newline at end of file +var _0x08af=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes','include','map','model','debug','lodash'];(function(_0x4e9e0b,_0x1d4aa8){var _0x280541=function(_0x1034cd){while(--_0x1034cd){_0x4e9e0b['push'](_0x4e9e0b['shift']());}};_0x280541(++_0x1d4aa8);}(_0x08af,0x102));var _0xf08a=function(_0x48a928,_0x430727){_0x48a928=_0x48a928-0x0;var _0x11c1e9=_0x08af[_0x48a928];return _0x11c1e9;};'use strict';var _=require(_0xf08a('0x0'));var util=require(_0xf08a('0x1'));var moment=require(_0xf08a('0x2'));var BPromise=require(_0xf08a('0x3'));var rs=require(_0xf08a('0x4'));var fs=require('fs');var Redis=require(_0xf08a('0x5'));var db=require(_0xf08a('0x6'))['db'];var utils=require(_0xf08a('0x7'));var logger=require(_0xf08a('0x8'))(_0xf08a('0x9'));var config=require(_0xf08a('0xa'));var jayson=require(_0xf08a('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xf08a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf08a('0xd'))(new Redis(config[_0xf08a('0xc')]));require('./squareProject.socket')[_0xf08a('0xe')](socket);function respondWithRpcPromise(_0x1a3eb2,_0x1dfecc,_0x3e8ff1){return new BPromise(function(_0x179c62,_0x1f03c9){return client[_0xf08a('0xf')](_0x1a3eb2,_0x3e8ff1)[_0xf08a('0x10')](function(_0x35abc6){logger[_0xf08a('0x11')](_0xf08a('0x12'),_0x1dfecc,_0xf08a('0x13'));logger['debug'](_0xf08a('0x14'),_0x1dfecc,_0xf08a('0x13'),JSON[_0xf08a('0x15')](_0x35abc6));if(_0x35abc6[_0xf08a('0x16')]){if(_0x35abc6[_0xf08a('0x16')][_0xf08a('0x17')]===0x1f4){logger[_0xf08a('0x16')](_0xf08a('0x12'),_0x1dfecc,_0x35abc6[_0xf08a('0x16')]['message']);return _0x1f03c9(_0x35abc6[_0xf08a('0x16')]['message']);}logger[_0xf08a('0x16')](_0xf08a('0x12'),_0x1dfecc,_0x35abc6['error'][_0xf08a('0x18')]);return _0x179c62(_0x35abc6['error']['message']);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x1dfecc,_0xf08a('0x13'));_0x179c62(_0x35abc6[_0xf08a('0x19')][_0xf08a('0x18')]);}})[_0xf08a('0x1a')](function(_0x374e82){logger[_0xf08a('0x16')](_0xf08a('0x12'),_0x1dfecc,_0x374e82);_0x1f03c9(_0x374e82);});});}exports[_0xf08a('0x1b')]=function(_0x139836){var _0x3e16fe=this;return new Promise(function(_0x4202f0,_0x55bf68){return db[_0xf08a('0x1c')][_0xf08a('0x1d')]({'raw':_0x139836[_0xf08a('0x1e')]?_0x139836[_0xf08a('0x1e')][_0xf08a('0x1f')]===undefined?!![]:![]:!![],'where':_0x139836[_0xf08a('0x1e')]?_0x139836['options']['where']||null:null,'attributes':_0x139836[_0xf08a('0x1e')]?_0x139836[_0xf08a('0x1e')][_0xf08a('0x20')]||null:null,'include':_0x139836['options']?_0x139836['options'][_0xf08a('0x21')]?_[_0xf08a('0x22')](_0x139836[_0xf08a('0x1e')][_0xf08a('0x21')],function(_0xaa156c){return{'model':db[_0xaa156c['model']],'as':_0xaa156c['as'],'attributes':_0xaa156c[_0xf08a('0x20')],'include':_0xaa156c['include']?_[_0xf08a('0x22')](_0xaa156c[_0xf08a('0x21')],function(_0x42b1e4){return{'model':db[_0x42b1e4['model']],'as':_0x42b1e4['as'],'attributes':_0x42b1e4[_0xf08a('0x20')],'include':_0x42b1e4[_0xf08a('0x21')]?_[_0xf08a('0x22')](_0x42b1e4[_0xf08a('0x21')],function(_0x3a5576){return{'model':db[_0x3a5576[_0xf08a('0x23')]],'as':_0x3a5576['as'],'attributes':_0x3a5576['attributes']};}):[]};}):[]};}):[]:[]})[_0xf08a('0x10')](function(_0x3e8681){logger['info'](_0xf08a('0x1b'),_0x139836);logger[_0xf08a('0x24')]('ShowSquareProject',_0x139836,JSON[_0xf08a('0x15')](_0x3e8681));_0x4202f0(_0x3e8681);})[_0xf08a('0x1a')](function(_0x4058f9){logger[_0xf08a('0x16')](_0xf08a('0x1b'),_0x4058f9[_0xf08a('0x18')],_0x139836);_0x55bf68(_0x3e16fe[_0xf08a('0x16')](0x1f4,_0x4058f9[_0xf08a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index e18e029..6edc06a 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 _0x5d17=['./squareProject.events','save','removeListener','register','length','squareProject:'];(function(_0x4d20ae,_0x5123e2){var _0x5c04a0=function(_0x537049){while(--_0x537049){_0x4d20ae['push'](_0x4d20ae['shift']());}};_0x5c04a0(++_0x5123e2);}(_0x5d17,0x114));var _0x75d1=function(_0xb03c1c,_0x2f98ed){_0xb03c1c=_0xb03c1c-0x0;var _0x507e93=_0x5d17[_0xb03c1c];return _0x507e93;};'use strict';var SquareProjectEvents=require(_0x75d1('0x0'));var events=[_0x75d1('0x1'),'remove','update'];function createListener(_0x39c0ec,_0x426717){return function(_0x1c9ba6){_0x426717['emit'](_0x39c0ec,_0x1c9ba6);};}function removeListener(_0x177460,_0x45d03a){return function(){SquareProjectEvents[_0x75d1('0x2')](_0x177460,_0x45d03a);};}exports[_0x75d1('0x3')]=function(_0x56ac0a){for(var _0x458681=0x0,_0x116a51=events[_0x75d1('0x4')];_0x458681<_0x116a51;_0x458681++){var _0x1ee61b=events[_0x458681];var _0x3a9d5e=createListener(_0x75d1('0x5')+_0x1ee61b,_0x56ac0a);SquareProjectEvents['on'](_0x1ee61b,_0x3a9d5e);}}; \ No newline at end of file +var _0xc2c7=['register','squareProject:','save','remove','update','emit'];(function(_0x3d21d0,_0x3a69dc){var _0x347843=function(_0x55baf4){while(--_0x55baf4){_0x3d21d0['push'](_0x3d21d0['shift']());}};_0x347843(++_0x3a69dc);}(_0xc2c7,0x134));var _0x7c2c=function(_0x36aceb,_0x438884){_0x36aceb=_0x36aceb-0x0;var _0x1da135=_0xc2c7[_0x36aceb];return _0x1da135;};'use strict';var SquareProjectEvents=require('./squareProject.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(){SquareProjectEvents['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);SquareProjectEvents['on'](_0x5a1027,_0x2274cd);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 953230d..50c65f6 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 _0xd5d5=['index','/:id','isAuthenticated','show','post','create','put','update','delete','/:id/delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x30f36b,_0x3fa65f){var _0x16b237=function(_0x681fd){while(--_0x681fd){_0x30f36b['push'](_0x30f36b['shift']());}};_0x16b237(++_0x3fa65f);}(_0xd5d5,0x1c0));var _0x5d5d=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xd5d5[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x5d5d('0x0'));var util=require(_0x5d5d('0x1'));var path=require('path');var timeout=require(_0x5d5d('0x2'));var express=require(_0x5d5d('0x3'));var router=express[_0x5d5d('0x4')]();var auth=require(_0x5d5d('0x5'));var interaction=require(_0x5d5d('0x6'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0x5d5d('0x7')]('/',auth['isAuthenticated'](),controller[_0x5d5d('0x8')]);router[_0x5d5d('0x7')](_0x5d5d('0x9'),auth[_0x5d5d('0xa')](),controller[_0x5d5d('0xb')]);router['get']('/:id/download',auth[_0x5d5d('0xa')](),controller['download']);router[_0x5d5d('0xc')]('/',auth[_0x5d5d('0xa')](),controller[_0x5d5d('0xd')]);router[_0x5d5d('0xe')]('/:id',auth[_0x5d5d('0xa')](),controller[_0x5d5d('0xf')]);router[_0x5d5d('0x10')](_0x5d5d('0x11'),auth['isAuthenticated'](),controller[_0x5d5d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x67ec=['/:id/delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete'];(function(_0x2f797e,_0x415057){var _0x4ced18=function(_0x858aad){while(--_0x858aad){_0x2f797e['push'](_0x2f797e['shift']());}};_0x4ced18(++_0x415057);}(_0x67ec,0x100));var _0xc67e=function(_0x272b36,_0x3a8acb){_0x272b36=_0x272b36-0x0;var _0x350765=_0x67ec[_0x272b36];return _0x350765;};'use strict';var multer=require(_0xc67e('0x0'));var util=require('util');var path=require(_0xc67e('0x1'));var timeout=require(_0xc67e('0x2'));var express=require(_0xc67e('0x3'));var router=express[_0xc67e('0x4')]();var auth=require(_0xc67e('0x5'));var interaction=require(_0xc67e('0x6'));var config=require(_0xc67e('0x7'));var controller=require(_0xc67e('0x8'));router[_0xc67e('0x9')]('/',auth[_0xc67e('0xa')](),controller[_0xc67e('0xb')]);router['get'](_0xc67e('0xc'),auth[_0xc67e('0xa')](),controller['show']);router['get'](_0xc67e('0xd'),auth['isAuthenticated'](),controller[_0xc67e('0xe')]);router[_0xc67e('0xf')]('/',auth[_0xc67e('0xa')](),controller[_0xc67e('0x10')]);router[_0xc67e('0x11')](_0xc67e('0xc'),auth[_0xc67e('0xa')](),controller[_0xc67e('0x12')]);router[_0xc67e('0x13')](_0xc67e('0x14'),auth[_0xc67e('0xa')](),controller[_0xc67e('0x15')]);module[_0xc67e('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 b22ec16..fc3a186 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 _0xfe8f=['getDataValue','STRING'];(function(_0x4ec34d,_0xff9e78){var _0x26c8cf=function(_0x19921d){while(--_0x19921d){_0x4ec34d['push'](_0x4ec34d['shift']());}};_0x26c8cf(++_0xff9e78);}(_0xfe8f,0xdb));var _0xffe8=function(_0x1860bd,_0x258af1){_0x1860bd=_0x1860bd-0x0;var _0x5674d5=_0xfe8f[_0x1860bd];return _0x5674d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xffe8('0x0')]},'calleridname':{'type':Sequelize[_0xffe8('0x0')]},'context':{'type':Sequelize[_0xffe8('0x0')]},'extension':{'type':Sequelize[_0xffe8('0x0')]},'priority':{'type':Sequelize[_0xffe8('0x0')]},'accountcode':{'type':Sequelize[_0xffe8('0x0')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xffe8('0x0')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xffe8('0x0')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x1bd244='';var _0x244f9f=this[_0xffe8('0x1')]('savePath');if(_0x244f9f){_0x1bd244=_0x244f9f['substring'](_0x244f9f['lastIndexOf']('.'));}return _0x1bd244;}}}; \ No newline at end of file +var _0xf37a=['savePath','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xf37a,0x1f4));var _0xaf37=function(_0x6704d5,_0xb7141f){_0x6704d5=_0x6704d5-0x0;var _0x296387=_0xf37a[_0x6704d5];return _0x296387;};'use strict';var Sequelize=require(_0xaf37('0x0'));module[_0xaf37('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaf37('0x2')]},'calleridname':{'type':Sequelize[_0xaf37('0x2')]},'context':{'type':Sequelize[_0xaf37('0x2')]},'extension':{'type':Sequelize[_0xaf37('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf37('0x2')]},'dnid':{'type':Sequelize[_0xaf37('0x2')]},'projectName':{'type':Sequelize[_0xaf37('0x2')]},'saveName':{'type':Sequelize[_0xaf37('0x2')]},'filename':{'type':Sequelize[_0xaf37('0x2')]},'savePath':{'type':Sequelize[_0xaf37('0x2')]},'format':{'type':Sequelize[_0xaf37('0x3')],'get':function(){var _0x2e4e73='';var _0x2e6aac=this['getDataValue'](_0xaf37('0x4'));if(_0x2e6aac){_0x2e4e73=_0x2e6aac[_0xaf37('0x5')](_0x2e6aac[_0xaf37('0x6')]('.'));}return _0x2e4e73;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 41f6812..6621ffd 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 _0x30c7=['apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareRecording','type','key','model','filters','query','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','intersection','length','find','create','body','download','../../components/encryptor','uniqueid','format','%s.cypher','existsSync','decryptFile','secrets','recording','savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','params','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','end','status','json','offset','limit','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30c7,0x1b1));var _0x730c=function(_0x58fc70,_0x1451c0){_0x58fc70=_0x58fc70-0x0;var _0x15b785=_0x30c7[_0x58fc70];return _0x15b785;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x730c('0x0'));var zipdir=require(_0x730c('0x1'));var jsonpatch=require(_0x730c('0x2'));var rp=require('request-promise');var moment=require(_0x730c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x730c('0x4'));var util=require(_0x730c('0x5'));var path=require(_0x730c('0x6'));var sox=require(_0x730c('0x7'));var csv=require(_0x730c('0x8'));var ejs=require(_0x730c('0x9'));var fs=require('fs');var _=require(_0x730c('0xa'));var squel=require(_0x730c('0xb'));var crypto=require(_0x730c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x730c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x730c('0xe'));var Papa=require(_0x730c('0xf'));var Redis=require('ioredis');var authService=require(_0x730c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x730c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x730c('0x12'));var utils=require(_0x730c('0x13'));var config=require(_0x730c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f2f88,_0x421d49){_0x421d49=_0x421d49||0xcc;return function(_0x7cb1d0){if(_0x7cb1d0){return _0x5f2f88['sendStatus'](_0x421d49);}return _0x5f2f88['status'](_0x421d49)[_0x730c('0x15')]();};}function respondWithResult(_0x339c56,_0x11ef22){_0x11ef22=_0x11ef22||0xc8;return function(_0x1e6181){if(_0x1e6181){return _0x339c56[_0x730c('0x16')](_0x11ef22)[_0x730c('0x17')](_0x1e6181);}};}function respondWithFilteredResult(_0x243a90,_0x2579e0){return function(_0x4dec32){if(_0x4dec32){var _0x42a0b0=_0x4dec32['count'],_0x34efeb=_0x2579e0['offset'],_0x5697f9=_0x2579e0[_0x730c('0x18')]+_0x2579e0[_0x730c('0x19')],_0x3c2804;if(_0x5697f9>=_0x42a0b0){_0x5697f9=_0x42a0b0;_0x3c2804=0xc8;}else{_0x3c2804=0xce;}_0x243a90['status'](_0x3c2804);return _0x243a90['set'](_0x730c('0x1a'),_0x34efeb+'-'+_0x5697f9+'/'+_0x42a0b0)[_0x730c('0x17')](_0x4dec32);}return null;};}function patchUpdates(_0x40fd35){return function(_0x276e69){try{jsonpatch[_0x730c('0x1b')](_0x276e69,_0x40fd35,!![]);}catch(_0x339473){return BPromise[_0x730c('0x1c')](_0x339473);}return _0x276e69[_0x730c('0x1d')]();};}function saveUpdates(_0x45e09b,_0x56b824){return function(_0x42b9e2){if(_0x42b9e2){return _0x42b9e2[_0x730c('0x1e')](_0x45e09b)[_0x730c('0x1f')](function(_0x2ee3ea){return _0x2ee3ea;});}return null;};}function removeEntity(_0x10a6b1,_0x3f51a5){return function(_0xfe9509){if(_0xfe9509){return _0xfe9509[_0x730c('0x20')]()['then'](function(){_0x10a6b1[_0x730c('0x16')](0xcc)[_0x730c('0x15')]();});}};}function handleEntityNotFound(_0x1b53f5,_0x5dd903){return function(_0x329825){if(!_0x329825){_0x1b53f5[_0x730c('0x21')](0x194);}return _0x329825;};}function handleError(_0x5cf37d,_0x6ecddd){_0x6ecddd=_0x6ecddd||0x1f4;return function(_0x32fc58){logger[_0x730c('0x22')](_0x32fc58[_0x730c('0x23')]);if(_0x32fc58[_0x730c('0x24')]){delete _0x32fc58[_0x730c('0x24')];}_0x5cf37d[_0x730c('0x16')](_0x6ecddd)[_0x730c('0x25')](_0x32fc58);};}exports[_0x730c('0x26')]=function(_0x10fefa,_0x2e1a6c){var _0x520c20={},_0x3a5761={},_0x3f5f97={'count':0x0,'rows':[]};var _0x44a18e=_[_0x730c('0x27')](db[_0x730c('0x28')]['rawAttributes'],function(_0x11ff45){return{'name':_0x11ff45['fieldName'],'type':_0x11ff45[_0x730c('0x29')][_0x730c('0x2a')]};});_0x3a5761[_0x730c('0x2b')]=_[_0x730c('0x27')](_0x44a18e,_0x730c('0x24'));_0x3a5761['query']=_['keys'](_0x10fefa['query']);_0x3a5761[_0x730c('0x2c')]=_['intersection'](_0x3a5761[_0x730c('0x2b')],_0x3a5761[_0x730c('0x2d')]);_0x520c20['attributes']=_['intersection'](_0x3a5761[_0x730c('0x2b')],qs[_0x730c('0x2e')](_0x10fefa['query']['fields']));_0x520c20['attributes']=_0x520c20[_0x730c('0x2f')]['length']?_0x520c20[_0x730c('0x2f')]:_0x3a5761['model'];if(!_0x10fefa[_0x730c('0x2d')][_0x730c('0x30')](_0x730c('0x31'))){_0x520c20['limit']=qs[_0x730c('0x19')](_0x10fefa['query']['limit']);_0x520c20[_0x730c('0x18')]=qs[_0x730c('0x18')](_0x10fefa['query'][_0x730c('0x18')]);}_0x520c20['order']=qs[_0x730c('0x32')](_0x10fefa[_0x730c('0x2d')][_0x730c('0x32')]);_0x520c20[_0x730c('0x33')]=qs[_0x730c('0x2c')](_[_0x730c('0x34')](_0x10fefa[_0x730c('0x2d')],_0x3a5761[_0x730c('0x2c')]),_0x44a18e);if(_0x10fefa['query'][_0x730c('0x35')]){_0x520c20[_0x730c('0x33')]=_[_0x730c('0x36')](_0x520c20['where'],{'$or':_[_0x730c('0x27')](_0x44a18e,function(_0x55caa0){if(_0x55caa0[_0x730c('0x29')]!==_0x730c('0x37')){var _0x58d136={};_0x58d136[_0x55caa0[_0x730c('0x24')]]={'$like':'%'+_0x10fefa['query'][_0x730c('0x35')]+'%'};return _0x58d136;}})});}_0x520c20=_[_0x730c('0x36')]({},_0x520c20,_0x10fefa[_0x730c('0x38')]);var _0x2dd82d={'where':_0x520c20['where']};return db[_0x730c('0x28')][_0x730c('0x39')](_0x2dd82d)[_0x730c('0x1f')](function(_0x4f2a18){_0x3f5f97['count']=_0x4f2a18;if(_0x10fefa[_0x730c('0x2d')][_0x730c('0x3a')]){_0x520c20[_0x730c('0x3b')]=[{'all':!![]}];}return db[_0x730c('0x28')][_0x730c('0x3c')](_0x520c20);})[_0x730c('0x1f')](function(_0x5c844e){_0x3f5f97['rows']=_0x5c844e;return _0x3f5f97;})[_0x730c('0x1f')](respondWithFilteredResult(_0x2e1a6c,_0x520c20))[_0x730c('0x3d')](handleError(_0x2e1a6c,null));};exports['show']=function(_0x21310f,_0x3c8c7d){var _0x10b4ca={'raw':!![],'where':{'id':_0x21310f['params']['id']}},_0x51962a={};_0x51962a['model']=_['keys'](db['SquareRecording']['rawAttributes']);_0x51962a[_0x730c('0x2d')]=_['keys'](_0x21310f[_0x730c('0x2d')]);_0x51962a[_0x730c('0x2c')]=_[_0x730c('0x3e')](_0x51962a['model'],_0x51962a['query']);_0x10b4ca[_0x730c('0x2f')]=_[_0x730c('0x3e')](_0x51962a['model'],qs[_0x730c('0x2e')](_0x21310f['query'][_0x730c('0x2e')]));_0x10b4ca[_0x730c('0x2f')]=_0x10b4ca[_0x730c('0x2f')][_0x730c('0x3f')]?_0x10b4ca[_0x730c('0x2f')]:_0x51962a['model'];if(_0x21310f[_0x730c('0x2d')][_0x730c('0x3a')]){_0x10b4ca[_0x730c('0x3b')]=[{'all':!![]}];}_0x10b4ca=_[_0x730c('0x36')]({},_0x10b4ca,_0x21310f[_0x730c('0x38')]);return db['SquareRecording'][_0x730c('0x40')](_0x10b4ca)['then'](handleEntityNotFound(_0x3c8c7d,null))[_0x730c('0x1f')](respondWithResult(_0x3c8c7d,null))[_0x730c('0x3d')](handleError(_0x3c8c7d,null));};exports[_0x730c('0x41')]=function(_0x204839,_0x1fe1b3){return db['SquareRecording'][_0x730c('0x41')](_0x204839[_0x730c('0x42')],{})['then'](respondWithResult(_0x1fe1b3,0xc9))[_0x730c('0x3d')](handleError(_0x1fe1b3,null));};exports[_0x730c('0x1e')]=function(_0x5807fd,_0x278136){if(_0x5807fd[_0x730c('0x42')]['id']){delete _0x5807fd['body']['id'];}return db[_0x730c('0x28')][_0x730c('0x40')]({'where':{'id':_0x5807fd['params']['id']}})[_0x730c('0x1f')](handleEntityNotFound(_0x278136,null))['then'](saveUpdates(_0x5807fd[_0x730c('0x42')],null))[_0x730c('0x1f')](respondWithResult(_0x278136,null))[_0x730c('0x3d')](handleError(_0x278136,null));};exports[_0x730c('0x43')]=function(_0x4b5f72,_0x189b3f,_0x245871){var _0x59392b=require(_0x730c('0x44'));var _0x1a1d60=![];var _0x30b542={};if(_0x4b5f72[_0x730c('0x2d')]['type']&&_0x4b5f72[_0x730c('0x2d')]['type']==='uniqueid'){_0x30b542[_0x730c('0x45')]=_0x4b5f72['params']['id'];}else{_0x30b542['id']=_0x4b5f72['params']['id'];}return db[_0x730c('0x28')]['find']({'where':_0x30b542,'attributes':['id','savePath','filename'],'raw':!![]})[_0x730c('0x1f')](handleEntityNotFound(_0x189b3f,null))[_0x730c('0x1f')](function(_0x29d847){if(_0x29d847){var _0x9d72ca=_0x29d847['savePath'];var _0x378764=util[_0x730c('0x46')](_0x730c('0x47'),_0x9d72ca);if(fs[_0x730c('0x48')](_0x378764)){_0x1a1d60=!![];return _0x59392b[_0x730c('0x49')](_0x378764,_0x9d72ca,config[_0x730c('0x4a')][_0x730c('0x4b')])['then'](function(){return _0x29d847;});}return _0x29d847;}})[_0x730c('0x1f')](function(_0x5462e3){if(_0x5462e3){var _0x485896=_0x5462e3[_0x730c('0x4c')];if(!fs[_0x730c('0x48')](_0x485896)){throw new db[(_0x730c('0x4d'))][(_0x730c('0x4e'))](_0x730c('0x4f'));}if(_0x5462e3[_0x730c('0x50')]){return _0x189b3f[_0x730c('0x43')](_0x485896,_0x5462e3[_0x730c('0x50')]+path[_0x730c('0x51')](_0x485896),function(){if(_0x1a1d60){fs['unlink'](_0x485896);}});}else{return _0x189b3f[_0x730c('0x43')](_0x485896,function(_0x516968){if(_0x1a1d60){fs[_0x730c('0x52')](_0x485896);}});}}})[_0x730c('0x3d')](function(_0x241978){if(_0x241978['message']===_0x730c('0x4f')){_0x189b3f[_0x730c('0x16')](0x194)[_0x730c('0x25')](_0x730c('0x53'));}else{return handleError(_0x189b3f,null);}});};exports[_0x730c('0x20')]=function(_0x4d7b6e,_0x4a5fbb){return db['SquareRecording'][_0x730c('0x40')]({'where':{'id':_0x4d7b6e[_0x730c('0x54')]['id']}})[_0x730c('0x1f')](function(_0x1a3c10){if(!_0x1a3c10)throw new ReferenceError(_0x730c('0x55'));return _0x1a3c10;})[_0x730c('0x1f')](function(_0x15b7f3){var _0x39386f=_0x15b7f3[_0x730c('0x4c')];logger[_0x730c('0x56')]('cancellazione\x20fisica\x20documento\x20%s',_0x39386f);if(!_[_0x730c('0x57')](_0x15b7f3[_0x730c('0x4c')])&&fs[_0x730c('0x48')](_0x39386f)){logger[_0x730c('0x56')]('File:\x20\x22'+_0x39386f+_0x730c('0x58'));fs[_0x730c('0x59')](_0x39386f);}_0x39386f=_0x39386f+_0x730c('0x5a');if(!_['isNil'](_0x15b7f3[_0x730c('0x4c')])&&fs[_0x730c('0x48')](_0x39386f)){logger[_0x730c('0x56')](_0x730c('0x5b')+_0x39386f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x730c('0x59')](_0x39386f);}return _0x15b7f3;})[_0x730c('0x1f')](function(_0x118842){if(!_0x118842)throw new InternalError();return _0x118842['destroy']();})[_0x730c('0x1f')](function(){_0x4a5fbb[_0x730c('0x16')](0xcc)[_0x730c('0x15')]();})[_0x730c('0x3d')](handleError(_0x4a5fbb,null));}; \ No newline at end of file +var _0xdf72=['unlink','message','send','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','uniqueid','savePath','format','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','filename','extname'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0xdf72,0x68));var _0x2df7=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0xdf72[_0x1b95a1];return _0x57aef1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2df7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2df7('0x1'));var rp=require(_0x2df7('0x2'));var moment=require(_0x2df7('0x3'));var BPromise=require(_0x2df7('0x4'));var Mustache=require(_0x2df7('0x5'));var util=require(_0x2df7('0x6'));var path=require(_0x2df7('0x7'));var sox=require(_0x2df7('0x8'));var csv=require(_0x2df7('0x9'));var ejs=require(_0x2df7('0xa'));var fs=require('fs');var _=require(_0x2df7('0xb'));var squel=require(_0x2df7('0xc'));var crypto=require('crypto');var jsforce=require(_0x2df7('0xd'));var deskjs=require(_0x2df7('0xe'));var toCsv=require(_0x2df7('0x9'));var querystring=require(_0x2df7('0xf'));var Papa=require(_0x2df7('0x10'));var Redis=require(_0x2df7('0x11'));var authService=require(_0x2df7('0x12'));var qs=require(_0x2df7('0x13'));var as=require(_0x2df7('0x14'));var hardwareService=require(_0x2df7('0x15'));var logger=require('../../config/logger')(_0x2df7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a23e6,_0x10d9d7){_0x10d9d7=_0x10d9d7||0xcc;return function(_0x1bf388){if(_0x1bf388){return _0x4a23e6[_0x2df7('0x17')](_0x10d9d7);}return _0x4a23e6[_0x2df7('0x18')](_0x10d9d7)[_0x2df7('0x19')]();};}function respondWithResult(_0x5caf12,_0x2389a5){_0x2389a5=_0x2389a5||0xc8;return function(_0x5e0b7e){if(_0x5e0b7e){return _0x5caf12[_0x2df7('0x18')](_0x2389a5)[_0x2df7('0x1a')](_0x5e0b7e);}};}function respondWithFilteredResult(_0x5ee1ba,_0x4b9bbc){return function(_0x1bd882){if(_0x1bd882){var _0x41982a=_0x1bd882[_0x2df7('0x1b')],_0x1598b=_0x4b9bbc['offset'],_0x26cbe5=_0x4b9bbc[_0x2df7('0x1c')]+_0x4b9bbc['limit'],_0x4d5a90;if(_0x26cbe5>=_0x41982a){_0x26cbe5=_0x41982a;_0x4d5a90=0xc8;}else{_0x4d5a90=0xce;}_0x5ee1ba[_0x2df7('0x18')](_0x4d5a90);return _0x5ee1ba[_0x2df7('0x1d')](_0x2df7('0x1e'),_0x1598b+'-'+_0x26cbe5+'/'+_0x41982a)[_0x2df7('0x1a')](_0x1bd882);}return null;};}function patchUpdates(_0x5beec0){return function(_0xbfdd0e){try{jsonpatch[_0x2df7('0x1f')](_0xbfdd0e,_0x5beec0,!![]);}catch(_0x39b4a7){return BPromise[_0x2df7('0x20')](_0x39b4a7);}return _0xbfdd0e['save']();};}function saveUpdates(_0x5b4c2a,_0x205dc2){return function(_0x5144ed){if(_0x5144ed){return _0x5144ed[_0x2df7('0x21')](_0x5b4c2a)[_0x2df7('0x22')](function(_0x32a266){return _0x32a266;});}return null;};}function removeEntity(_0x11547c,_0x3c14e6){return function(_0x50f534){if(_0x50f534){return _0x50f534[_0x2df7('0x23')]()[_0x2df7('0x22')](function(){_0x11547c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1abd0b,_0x36102d){return function(_0x41c519){if(!_0x41c519){_0x1abd0b[_0x2df7('0x17')](0x194);}return _0x41c519;};}function handleError(_0x17efd3,_0x506aaf){_0x506aaf=_0x506aaf||0x1f4;return function(_0x4c2f44){logger['error'](_0x4c2f44[_0x2df7('0x24')]);if(_0x4c2f44['name']){delete _0x4c2f44[_0x2df7('0x25')];}_0x17efd3[_0x2df7('0x18')](_0x506aaf)['send'](_0x4c2f44);};}exports[_0x2df7('0x26')]=function(_0x2cd6af,_0x22e418){var _0x5091b4={},_0x159097={},_0x1b6b8a={'count':0x0,'rows':[]};var _0x132ac3=_[_0x2df7('0x27')](db['SquareRecording'][_0x2df7('0x28')],function(_0x585ac9){return{'name':_0x585ac9['fieldName'],'type':_0x585ac9[_0x2df7('0x29')][_0x2df7('0x2a')]};});_0x159097[_0x2df7('0x2b')]=_['map'](_0x132ac3,_0x2df7('0x25'));_0x159097[_0x2df7('0x2c')]=_['keys'](_0x2cd6af[_0x2df7('0x2c')]);_0x159097[_0x2df7('0x2d')]=_[_0x2df7('0x2e')](_0x159097[_0x2df7('0x2b')],_0x159097['query']);_0x5091b4[_0x2df7('0x2f')]=_[_0x2df7('0x2e')](_0x159097['model'],qs[_0x2df7('0x30')](_0x2cd6af[_0x2df7('0x2c')][_0x2df7('0x30')]));_0x5091b4[_0x2df7('0x2f')]=_0x5091b4[_0x2df7('0x2f')]['length']?_0x5091b4[_0x2df7('0x2f')]:_0x159097[_0x2df7('0x2b')];if(!_0x2cd6af['query'][_0x2df7('0x31')](_0x2df7('0x32'))){_0x5091b4[_0x2df7('0x33')]=qs[_0x2df7('0x33')](_0x2cd6af[_0x2df7('0x2c')][_0x2df7('0x33')]);_0x5091b4[_0x2df7('0x1c')]=qs['offset'](_0x2cd6af['query']['offset']);}_0x5091b4[_0x2df7('0x34')]=qs['sort'](_0x2cd6af['query'][_0x2df7('0x35')]);_0x5091b4['where']=qs[_0x2df7('0x2d')](_[_0x2df7('0x36')](_0x2cd6af['query'],_0x159097['filters']),_0x132ac3);if(_0x2cd6af[_0x2df7('0x2c')][_0x2df7('0x37')]){_0x5091b4['where']=_[_0x2df7('0x38')](_0x5091b4['where'],{'$or':_[_0x2df7('0x27')](_0x132ac3,function(_0x5e9489){if(_0x5e9489[_0x2df7('0x29')]!==_0x2df7('0x39')){var _0x5cfe25={};_0x5cfe25[_0x5e9489['name']]={'$like':'%'+_0x2cd6af[_0x2df7('0x2c')][_0x2df7('0x37')]+'%'};return _0x5cfe25;}})});}_0x5091b4=_[_0x2df7('0x38')]({},_0x5091b4,_0x2cd6af[_0x2df7('0x3a')]);var _0x1e31c9={'where':_0x5091b4['where']};return db[_0x2df7('0x3b')][_0x2df7('0x1b')](_0x1e31c9)[_0x2df7('0x22')](function(_0x4000da){_0x1b6b8a['count']=_0x4000da;if(_0x2cd6af[_0x2df7('0x2c')][_0x2df7('0x3c')]){_0x5091b4[_0x2df7('0x3d')]=[{'all':!![]}];}return db[_0x2df7('0x3b')][_0x2df7('0x3e')](_0x5091b4);})[_0x2df7('0x22')](function(_0x5dbbcf){_0x1b6b8a[_0x2df7('0x3f')]=_0x5dbbcf;return _0x1b6b8a;})[_0x2df7('0x22')](respondWithFilteredResult(_0x22e418,_0x5091b4))[_0x2df7('0x40')](handleError(_0x22e418,null));};exports[_0x2df7('0x41')]=function(_0xa105,_0x18062d){var _0x295653={'raw':!![],'where':{'id':_0xa105[_0x2df7('0x42')]['id']}},_0x74c49b={};_0x74c49b['model']=_[_0x2df7('0x43')](db['SquareRecording'][_0x2df7('0x28')]);_0x74c49b[_0x2df7('0x2c')]=_['keys'](_0xa105['query']);_0x74c49b[_0x2df7('0x2d')]=_[_0x2df7('0x2e')](_0x74c49b[_0x2df7('0x2b')],_0x74c49b['query']);_0x295653[_0x2df7('0x2f')]=_[_0x2df7('0x2e')](_0x74c49b['model'],qs[_0x2df7('0x30')](_0xa105[_0x2df7('0x2c')]['fields']));_0x295653[_0x2df7('0x2f')]=_0x295653[_0x2df7('0x2f')][_0x2df7('0x44')]?_0x295653[_0x2df7('0x2f')]:_0x74c49b[_0x2df7('0x2b')];if(_0xa105[_0x2df7('0x2c')][_0x2df7('0x3c')]){_0x295653[_0x2df7('0x3d')]=[{'all':!![]}];}_0x295653=_['merge']({},_0x295653,_0xa105[_0x2df7('0x3a')]);return db[_0x2df7('0x3b')][_0x2df7('0x45')](_0x295653)[_0x2df7('0x22')](handleEntityNotFound(_0x18062d,null))[_0x2df7('0x22')](respondWithResult(_0x18062d,null))[_0x2df7('0x40')](handleError(_0x18062d,null));};exports[_0x2df7('0x46')]=function(_0x149b7c,_0x1a901e){return db['SquareRecording']['create'](_0x149b7c[_0x2df7('0x47')],{})[_0x2df7('0x22')](respondWithResult(_0x1a901e,0xc9))[_0x2df7('0x40')](handleError(_0x1a901e,null));};exports[_0x2df7('0x21')]=function(_0x5c2114,_0x4ea0a5){if(_0x5c2114[_0x2df7('0x47')]['id']){delete _0x5c2114[_0x2df7('0x47')]['id'];}return db[_0x2df7('0x3b')][_0x2df7('0x45')]({'where':{'id':_0x5c2114['params']['id']}})[_0x2df7('0x22')](handleEntityNotFound(_0x4ea0a5,null))[_0x2df7('0x22')](saveUpdates(_0x5c2114[_0x2df7('0x47')],null))[_0x2df7('0x22')](respondWithResult(_0x4ea0a5,null))[_0x2df7('0x40')](handleError(_0x4ea0a5,null));};exports['download']=function(_0xd79fe5,_0x4a2bb4,_0x3229ce){var _0x582e58=require('../../components/encryptor');var _0x2cc64a=![];var _0x331560={};if(_0xd79fe5[_0x2df7('0x2c')][_0x2df7('0x29')]&&_0xd79fe5['query'][_0x2df7('0x29')]===_0x2df7('0x48')){_0x331560[_0x2df7('0x48')]=_0xd79fe5['params']['id'];}else{_0x331560['id']=_0xd79fe5[_0x2df7('0x42')]['id'];}return db[_0x2df7('0x3b')][_0x2df7('0x45')]({'where':_0x331560,'attributes':['id',_0x2df7('0x49'),'filename'],'raw':!![]})[_0x2df7('0x22')](handleEntityNotFound(_0x4a2bb4,null))['then'](function(_0x2bb07b){if(_0x2bb07b){var _0x72e7b1=_0x2bb07b[_0x2df7('0x49')];var _0x18357b=util[_0x2df7('0x4a')]('%s.cypher',_0x72e7b1);if(fs[_0x2df7('0x4b')](_0x18357b)){_0x2cc64a=!![];return _0x582e58[_0x2df7('0x4c')](_0x18357b,_0x72e7b1,config[_0x2df7('0x4d')]['recording'])[_0x2df7('0x22')](function(){return _0x2bb07b;});}return _0x2bb07b;}})['then'](function(_0x3dd247){if(_0x3dd247){var _0x343577=_0x3dd247['savePath'];if(!fs[_0x2df7('0x4b')](_0x343577)){throw new db[(_0x2df7('0x4e'))][(_0x2df7('0x4f'))](_0x2df7('0x50'));}if(_0x3dd247['filename']){return _0x4a2bb4[_0x2df7('0x51')](_0x343577,_0x3dd247[_0x2df7('0x52')]+path[_0x2df7('0x53')](_0x343577),function(){if(_0x2cc64a){fs['unlink'](_0x343577);}});}else{return _0x4a2bb4['download'](_0x343577,function(_0xe5c1ae){if(_0x2cc64a){fs[_0x2df7('0x54')](_0x343577);}});}}})[_0x2df7('0x40')](function(_0x521c44){if(_0x521c44[_0x2df7('0x55')]===_0x2df7('0x50')){_0x4a2bb4['status'](0x194)[_0x2df7('0x56')]('Not\x20found');}else{return handleError(_0x4a2bb4,null);}});};exports[_0x2df7('0x23')]=function(_0x17414e,_0x17f00c){return db[_0x2df7('0x3b')][_0x2df7('0x45')]({'where':{'id':_0x17414e[_0x2df7('0x42')]['id']}})[_0x2df7('0x22')](function(_0x3f45e3){if(!_0x3f45e3)throw new ReferenceError(_0x2df7('0x57'));return _0x3f45e3;})[_0x2df7('0x22')](function(_0x40242d){var _0x444600=_0x40242d[_0x2df7('0x49')];logger[_0x2df7('0x58')](_0x2df7('0x59'),_0x444600);if(!_[_0x2df7('0x5a')](_0x40242d[_0x2df7('0x49')])&&fs[_0x2df7('0x4b')](_0x444600)){logger[_0x2df7('0x58')]('File:\x20\x22'+_0x444600+_0x2df7('0x5b'));fs[_0x2df7('0x5c')](_0x444600);}_0x444600=_0x444600+'.cypher';if(!_[_0x2df7('0x5a')](_0x40242d['savePath'])&&fs[_0x2df7('0x4b')](_0x444600)){logger['info'](_0x2df7('0x5d')+_0x444600+_0x2df7('0x5b'));fs['unlinkSync'](_0x444600);}return _0x40242d;})[_0x2df7('0x22')](function(_0x46cfcb){if(!_0x46cfcb)throw new InternalError();return _0x46cfcb[_0x2df7('0x23')]();})[_0x2df7('0x22')](function(){_0x17f00c['status'](0xcc)[_0x2df7('0x19')]();})[_0x2df7('0x40')](handleError(_0x17f00c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index cb86d24..6045ca0 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 _0x3fd9=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareRecording','square_recordings','lodash'];(function(_0x34273f,_0xbc7e5c){var _0x3165bd=function(_0x4b65e6){while(--_0x4b65e6){_0x34273f['push'](_0x34273f['shift']());}};_0x3165bd(++_0xbc7e5c);}(_0x3fd9,0x1c6));var _0x93fd=function(_0x4bbcef,_0x1b4a5c){_0x4bbcef=_0x4bbcef-0x0;var _0x534d5a=_0x3fd9[_0x4bbcef];return _0x534d5a;};'use strict';var _=require(_0x93fd('0x0'));var util=require(_0x93fd('0x1'));var logger=require(_0x93fd('0x2'))(_0x93fd('0x3'));var moment=require(_0x93fd('0x4'));var BPromise=require(_0x93fd('0x5'));var rp=require(_0x93fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93fd('0x7'));var config=require(_0x93fd('0x8'));var attributes=require('./squareRecording.attributes');module[_0x93fd('0x9')]=function(_0x49ad04,_0x4d464f){return _0x49ad04[_0x93fd('0xa')](_0x93fd('0xb'),attributes,{'tableName':_0x93fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aa8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings'];(function(_0x4a617c,_0x2b3334){var _0xc47d=function(_0x218dda){while(--_0x218dda){_0x4a617c['push'](_0x4a617c['shift']());}};_0xc47d(++_0x2b3334);}(_0x0aa8,0x1d1));var _0x80aa=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x0aa8[_0x289891];return _0x31cf2e;};'use strict';var _=require(_0x80aa('0x0'));var util=require(_0x80aa('0x1'));var logger=require(_0x80aa('0x2'))(_0x80aa('0x3'));var moment=require(_0x80aa('0x4'));var BPromise=require(_0x80aa('0x5'));var rp=require(_0x80aa('0x6'));var fs=require('fs');var path=require(_0x80aa('0x7'));var rimraf=require(_0x80aa('0x8'));var config=require(_0x80aa('0x9'));var attributes=require(_0x80aa('0xa'));module[_0x80aa('0xb')]=function(_0x1a6fdb,_0x53cda2){return _0x1a6fdb[_0x80aa('0xc')](_0x80aa('0xd'),attributes,{'tableName':_0x80aa('0xe'),'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 4cda809..7d0747f 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 _0x97b9=['http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareRecording','create','body','options','CreateSquareRecording','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1dc337,_0x163446){var _0x2c4d04=function(_0x849e1){while(--_0x849e1){_0x1dc337['push'](_0x1dc337['shift']());}};_0x2c4d04(++_0x163446);}(_0x97b9,0xdc));var _0x997b=function(_0x3f91e1,_0x2b3f49){_0x3f91e1=_0x3f91e1-0x0;var _0x199fc4=_0x97b9[_0x3f91e1];return _0x199fc4;};'use strict';var _=require(_0x997b('0x0'));var util=require(_0x997b('0x1'));var moment=require(_0x997b('0x2'));var BPromise=require('bluebird');var rs=require(_0x997b('0x3'));var fs=require('fs');var Redis=require(_0x997b('0x4'));var db=require(_0x997b('0x5'))['db'];var utils=require(_0x997b('0x6'));var logger=require(_0x997b('0x7'))(_0x997b('0x8'));var config=require(_0x997b('0x9'));var jayson=require(_0x997b('0xa'));var client=jayson[_0x997b('0xb')][_0x997b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ab502,_0x6da814,_0x20e5ee){return new BPromise(function(_0xf87106,_0x4158fe){return client['request'](_0x5ab502,_0x20e5ee)[_0x997b('0xd')](function(_0x15b6a7){logger[_0x997b('0xe')](_0x997b('0xf'),_0x6da814,_0x997b('0x10'));logger[_0x997b('0x11')](_0x997b('0x12'),_0x6da814,_0x997b('0x10'),JSON[_0x997b('0x13')](_0x15b6a7));if(_0x15b6a7[_0x997b('0x14')]){if(_0x15b6a7[_0x997b('0x14')][_0x997b('0x15')]===0x1f4){logger['error'](_0x997b('0xf'),_0x6da814,_0x15b6a7['error'][_0x997b('0x16')]);return _0x4158fe(_0x15b6a7[_0x997b('0x14')][_0x997b('0x16')]);}logger[_0x997b('0x14')]('SquareRecording,\x20%s,\x20%s',_0x6da814,_0x15b6a7[_0x997b('0x14')][_0x997b('0x16')]);return _0xf87106(_0x15b6a7[_0x997b('0x14')][_0x997b('0x16')]);}else{logger['info'](_0x997b('0xf'),_0x6da814,'request\x20sent');_0xf87106(_0x15b6a7['result']['message']);}})[_0x997b('0x17')](function(_0x1ab96e){logger['error'](_0x997b('0xf'),_0x6da814,_0x1ab96e);_0x4158fe(_0x1ab96e);});});}exports['CreateSquareRecording']=function(_0x197a21){var _0x57481c=this;return new Promise(function(_0x1e0adb,_0x864b24){return db[_0x997b('0x18')][_0x997b('0x19')](_0x197a21[_0x997b('0x1a')],{'raw':_0x197a21[_0x997b('0x1b')]?_0x197a21['options']['raw']===undefined?!![]:![]:!![]})[_0x997b('0xd')](function(_0x40d193){logger[_0x997b('0xe')](_0x997b('0x1c'),_0x197a21);logger[_0x997b('0x11')](_0x997b('0x1c'),_0x197a21,JSON[_0x997b('0x13')](_0x40d193));_0x1e0adb(_0x40d193);})['catch'](function(_0x20f0d3){logger[_0x997b('0x14')](_0x997b('0x1c'),_0x20f0d3[_0x997b('0x16')],_0x197a21);_0x864b24(_0x57481c[_0x997b('0x14')](0x1f4,_0x20f0d3[_0x997b('0x16')]));});});}; \ No newline at end of file +var _0x02fc=['debug','error','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','create','body','options','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x02fc,0x134));var _0xc02f=function(_0x142433,_0x5e8a10){_0x142433=_0x142433-0x0;var _0x2aa168=_0x02fc[_0x142433];return _0x2aa168;};'use strict';var _=require(_0xc02f('0x0'));var util=require('util');var moment=require(_0xc02f('0x1'));var BPromise=require(_0xc02f('0x2'));var rs=require(_0xc02f('0x3'));var fs=require('fs');var Redis=require(_0xc02f('0x4'));var db=require(_0xc02f('0x5'))['db'];var utils=require(_0xc02f('0x6'));var logger=require('../../config/logger')(_0xc02f('0x7'));var config=require(_0xc02f('0x8'));var jayson=require(_0xc02f('0x9'));var client=jayson[_0xc02f('0xa')][_0xc02f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x310b4c,_0x4e60fd,_0x7e10fa){return new BPromise(function(_0x6b234d,_0x35f79e){return client[_0xc02f('0xc')](_0x310b4c,_0x7e10fa)[_0xc02f('0xd')](function(_0x2c07fc){logger[_0xc02f('0xe')]('SquareRecording,\x20%s,\x20%s',_0x4e60fd,_0xc02f('0xf'));logger[_0xc02f('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4e60fd,_0xc02f('0xf'),JSON['stringify'](_0x2c07fc));if(_0x2c07fc[_0xc02f('0x11')]){if(_0x2c07fc[_0xc02f('0x11')]['code']===0x1f4){logger['error'](_0xc02f('0x12'),_0x4e60fd,_0x2c07fc[_0xc02f('0x11')][_0xc02f('0x13')]);return _0x35f79e(_0x2c07fc[_0xc02f('0x11')][_0xc02f('0x13')]);}logger[_0xc02f('0x11')](_0xc02f('0x12'),_0x4e60fd,_0x2c07fc[_0xc02f('0x11')]['message']);return _0x6b234d(_0x2c07fc[_0xc02f('0x11')][_0xc02f('0x13')]);}else{logger[_0xc02f('0xe')]('SquareRecording,\x20%s,\x20%s',_0x4e60fd,'request\x20sent');_0x6b234d(_0x2c07fc[_0xc02f('0x14')]['message']);}})[_0xc02f('0x15')](function(_0x5b34bc){logger['error'](_0xc02f('0x12'),_0x4e60fd,_0x5b34bc);_0x35f79e(_0x5b34bc);});});}exports[_0xc02f('0x16')]=function(_0x5e53a7){var _0x240e97=this;return new Promise(function(_0x457cd7,_0x5e827e){return db['SquareRecording'][_0xc02f('0x17')](_0x5e53a7[_0xc02f('0x18')],{'raw':_0x5e53a7[_0xc02f('0x19')]?_0x5e53a7[_0xc02f('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x23ceb6){logger[_0xc02f('0xe')](_0xc02f('0x16'),_0x5e53a7);logger[_0xc02f('0x10')]('CreateSquareRecording',_0x5e53a7,JSON[_0xc02f('0x1a')](_0x23ceb6));_0x457cd7(_0x23ceb6);})['catch'](function(_0x4d8298){logger[_0xc02f('0x11')](_0xc02f('0x16'),_0x4d8298['message'],_0x5e53a7);_0x5e827e(_0x240e97[_0xc02f('0x11')](0x1f4,_0x4d8298[_0xc02f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index dfc3e78..497c9e2 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 _0x2edc=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','destroy'];(function(_0x601214,_0x5acee0){var _0x8958b1=function(_0x5ad9e2){while(--_0x5ad9e2){_0x601214['push'](_0x601214['shift']());}};_0x8958b1(++_0x5acee0);}(_0x2edc,0x99));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc2ed('0x0'));var util=require(_0xc2ed('0x1'));var path=require(_0xc2ed('0x2'));var timeout=require(_0xc2ed('0x3'));var express=require(_0xc2ed('0x4'));var router=express[_0xc2ed('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc2ed('0x6'));var config=require(_0xc2ed('0x7'));var controller=require('./squareReport.controller');router[_0xc2ed('0x8')]('/',auth[_0xc2ed('0x9')](),controller[_0xc2ed('0xa')]);router[_0xc2ed('0x8')](_0xc2ed('0xb'),auth[_0xc2ed('0x9')](),controller[_0xc2ed('0xc')]);router[_0xc2ed('0x8')](_0xc2ed('0xd'),auth[_0xc2ed('0x9')](),controller[_0xc2ed('0xe')]);router[_0xc2ed('0xf')]('/',auth[_0xc2ed('0x9')](),controller[_0xc2ed('0x10')]);router['put'](_0xc2ed('0xd'),auth[_0xc2ed('0x9')](),controller['update']);router['delete'](_0xc2ed('0xd'),auth[_0xc2ed('0x9')](),controller[_0xc2ed('0x11')]);module[_0xc2ed('0x12')]=router; \ No newline at end of file +var _0x71bb=['/:id','show','create','delete','exports','express','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe'];(function(_0x44d853,_0x687284){var _0xfa3100=function(_0x571eba){while(--_0x571eba){_0x44d853['push'](_0x44d853['shift']());}};_0xfa3100(++_0x687284);}(_0x71bb,0x161));var _0xb71b=function(_0x2f0b72,_0x2a3653){_0x2f0b72=_0x2f0b72-0x0;var _0x513d56=_0x71bb[_0x2f0b72];return _0x513d56;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb71b('0x0'));var router=express['Router']();var auth=require(_0xb71b('0x1'));var interaction=require(_0xb71b('0x2'));var config=require('../../config/environment');var controller=require('./squareReport.controller');router[_0xb71b('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb71b('0x3')](_0xb71b('0x4'),auth[_0xb71b('0x5')](),controller[_0xb71b('0x6')]);router[_0xb71b('0x3')](_0xb71b('0x7'),auth[_0xb71b('0x5')](),controller[_0xb71b('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb71b('0x9')]);router['put'](_0xb71b('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xb71b('0xa')](_0xb71b('0x7'),auth[_0xb71b('0x5')](),controller['destroy']);module[_0xb71b('0xb')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a4f6540..fe048cf 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 _0xecfc=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xecfc,0x157));var _0xcecf=function(_0x20b06b,_0x4f9b70){_0x20b06b=_0x20b06b-0x0;var _0xc36e99=_0xecfc[_0x20b06b];return _0xc36e99;};'use strict';var Sequelize=require(_0xcecf('0x0'));module['exports']={'network':{'type':Sequelize[_0xcecf('0x1')]},'network_script':{'type':Sequelize[_0xcecf('0x1')]},'request':{'type':Sequelize[_0xcecf('0x1')]},'channel':{'type':Sequelize[_0xcecf('0x1')]},'language':{'type':Sequelize[_0xcecf('0x1')]},'type':{'type':Sequelize[_0xcecf('0x1')]},'uniqueid':{'type':Sequelize[_0xcecf('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xcecf('0x1')]},'calleridname':{'type':Sequelize[_0xcecf('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xcecf('0x1')]},'callingtns':{'type':Sequelize[_0xcecf('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcecf('0x1')]},'extension':{'type':Sequelize[_0xcecf('0x1')]},'priority':{'type':Sequelize[_0xcecf('0x1')]},'enhanced':{'type':Sequelize[_0xcecf('0x1')]},'accountcode':{'type':Sequelize[_0xcecf('0x1')]},'threadid':{'type':Sequelize[_0xcecf('0x1')]},'project_name':{'type':Sequelize[_0xcecf('0x1')]},'joinAt':{'type':Sequelize[_0xcecf('0x2')]},'leaveAt':{'type':Sequelize[_0xcecf('0x2')]},'bot':{'type':Sequelize[_0xcecf('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xac7d=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x3d9f5d,_0x51db56){var _0x1b2d1e=function(_0x478a0b){while(--_0x478a0b){_0x3d9f5d['push'](_0x3d9f5d['shift']());}};_0x1b2d1e(++_0x51db56);}(_0xac7d,0x6f));var _0xdac7=function(_0x24bb95,_0x159f95){_0x24bb95=_0x24bb95-0x0;var _0xfa9158=_0xac7d[_0x24bb95];return _0xfa9158;};'use strict';var Sequelize=require(_0xdac7('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xdac7('0x1')]},'request':{'type':Sequelize[_0xdac7('0x1')]},'channel':{'type':Sequelize[_0xdac7('0x1')]},'language':{'type':Sequelize[_0xdac7('0x1')]},'type':{'type':Sequelize[_0xdac7('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xdac7('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xdac7('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xdac7('0x1')]},'rdnis':{'type':Sequelize[_0xdac7('0x1')]},'context':{'type':Sequelize[_0xdac7('0x1')]},'extension':{'type':Sequelize[_0xdac7('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xdac7('0x1')]},'accountcode':{'type':Sequelize[_0xdac7('0x1')]},'threadid':{'type':Sequelize[_0xdac7('0x1')]},'project_name':{'type':Sequelize[_0xdac7('0x1')]},'joinAt':{'type':Sequelize[_0xdac7('0x2')]},'leaveAt':{'type':Sequelize[_0xdac7('0x2')]},'bot':{'type':Sequelize[_0xdac7('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index c4ccdde..38f10f9 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 _0xe867=['body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','SquareReport','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','count','include','findAll','rows','catch','show','params','includeAll','create'];(function(_0x53780f,_0x509fec){var _0x398575=function(_0x458271){while(--_0x458271){_0x53780f['push'](_0x53780f['shift']());}};_0x398575(++_0x509fec);}(_0xe867,0x176));var _0x7e86=function(_0x4d284c,_0x5e4620){_0x4d284c=_0x4d284c-0x0;var _0x5bfb77=_0xe867[_0x4d284c];return _0x5bfb77;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7e86('0x0'));var zipdir=require(_0x7e86('0x1'));var jsonpatch=require(_0x7e86('0x2'));var rp=require(_0x7e86('0x3'));var moment=require('moment');var BPromise=require(_0x7e86('0x4'));var Mustache=require(_0x7e86('0x5'));var util=require(_0x7e86('0x6'));var path=require('path');var sox=require(_0x7e86('0x7'));var csv=require(_0x7e86('0x8'));var ejs=require(_0x7e86('0x9'));var fs=require('fs');var _=require(_0x7e86('0xa'));var squel=require('squel');var crypto=require(_0x7e86('0xb'));var jsforce=require(_0x7e86('0xc'));var deskjs=require(_0x7e86('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7e86('0xe'));var Papa=require(_0x7e86('0xf'));var Redis=require(_0x7e86('0x10'));var authService=require(_0x7e86('0x11'));var qs=require(_0x7e86('0x12'));var as=require(_0x7e86('0x13'));var hardwareService=require(_0x7e86('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7e86('0x15'));var config=require(_0x7e86('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x517a2e,_0x5f1406){_0x5f1406=_0x5f1406||0xcc;return function(_0x1ae411){if(_0x1ae411){return _0x517a2e[_0x7e86('0x17')](_0x5f1406);}return _0x517a2e[_0x7e86('0x18')](_0x5f1406)[_0x7e86('0x19')]();};}function respondWithResult(_0x2ddb61,_0x2cad61){_0x2cad61=_0x2cad61||0xc8;return function(_0x4f2504){if(_0x4f2504){return _0x2ddb61[_0x7e86('0x18')](_0x2cad61)[_0x7e86('0x1a')](_0x4f2504);}};}function respondWithFilteredResult(_0x8ee039,_0x3f49cf){return function(_0x7c1199){if(_0x7c1199){var _0x8c8973=_0x7c1199['count'],_0x250d37=_0x3f49cf[_0x7e86('0x1b')],_0x173b83=_0x3f49cf[_0x7e86('0x1b')]+_0x3f49cf[_0x7e86('0x1c')],_0x4b44d1;if(_0x173b83>=_0x8c8973){_0x173b83=_0x8c8973;_0x4b44d1=0xc8;}else{_0x4b44d1=0xce;}_0x8ee039[_0x7e86('0x18')](_0x4b44d1);return _0x8ee039['set'](_0x7e86('0x1d'),_0x250d37+'-'+_0x173b83+'/'+_0x8c8973)['json'](_0x7c1199);}return null;};}function patchUpdates(_0xa1a2e8){return function(_0x22f702){try{jsonpatch[_0x7e86('0x1e')](_0x22f702,_0xa1a2e8,!![]);}catch(_0x3cc7a8){return BPromise[_0x7e86('0x1f')](_0x3cc7a8);}return _0x22f702[_0x7e86('0x20')]();};}function saveUpdates(_0x367db4,_0x13e519){return function(_0x204b3e){if(_0x204b3e){return _0x204b3e[_0x7e86('0x21')](_0x367db4)[_0x7e86('0x22')](function(_0x54d2fe){return _0x54d2fe;});}return null;};}function removeEntity(_0x27cfde,_0x33db0a){return function(_0x364cd3){if(_0x364cd3){return _0x364cd3['destroy']()[_0x7e86('0x22')](function(){_0x27cfde['status'](0xcc)[_0x7e86('0x19')]();});}};}function handleEntityNotFound(_0x3e528d,_0x596dc8){return function(_0x14dc6e){if(!_0x14dc6e){_0x3e528d[_0x7e86('0x17')](0x194);}return _0x14dc6e;};}function handleError(_0x1317b8,_0x397580){_0x397580=_0x397580||0x1f4;return function(_0xd6104){logger[_0x7e86('0x23')](_0xd6104[_0x7e86('0x24')]);if(_0xd6104[_0x7e86('0x25')]){delete _0xd6104[_0x7e86('0x25')];}_0x1317b8[_0x7e86('0x18')](_0x397580)[_0x7e86('0x26')](_0xd6104);};}exports['index']=function(_0x5271b3,_0x390602){var _0x43f125={},_0x57ebc1={},_0x24b74b={'count':0x0,'rows':[]};var _0x53b2f6=_[_0x7e86('0x27')](db[_0x7e86('0x28')][_0x7e86('0x29')],function(_0x1c1edd){return{'name':_0x1c1edd['fieldName'],'type':_0x1c1edd[_0x7e86('0x2a')][_0x7e86('0x2b')]};});_0x57ebc1[_0x7e86('0x2c')]=_[_0x7e86('0x27')](_0x53b2f6,'name');_0x57ebc1['query']=_[_0x7e86('0x2d')](_0x5271b3['query']);_0x57ebc1['filters']=_[_0x7e86('0x2e')](_0x57ebc1['model'],_0x57ebc1[_0x7e86('0x2f')]);_0x43f125[_0x7e86('0x30')]=_[_0x7e86('0x2e')](_0x57ebc1[_0x7e86('0x2c')],qs['fields'](_0x5271b3[_0x7e86('0x2f')][_0x7e86('0x31')]));_0x43f125['attributes']=_0x43f125['attributes'][_0x7e86('0x32')]?_0x43f125['attributes']:_0x57ebc1[_0x7e86('0x2c')];if(!_0x5271b3[_0x7e86('0x2f')][_0x7e86('0x33')](_0x7e86('0x34'))){_0x43f125['limit']=qs['limit'](_0x5271b3['query'][_0x7e86('0x1c')]);_0x43f125[_0x7e86('0x1b')]=qs['offset'](_0x5271b3[_0x7e86('0x2f')][_0x7e86('0x1b')]);}_0x43f125[_0x7e86('0x35')]=qs[_0x7e86('0x36')](_0x5271b3[_0x7e86('0x2f')]['sort']);_0x43f125[_0x7e86('0x37')]=qs[_0x7e86('0x38')](_[_0x7e86('0x39')](_0x5271b3[_0x7e86('0x2f')],_0x57ebc1['filters']),_0x53b2f6);if(_0x5271b3[_0x7e86('0x2f')]['filter']){_0x43f125[_0x7e86('0x37')]=_[_0x7e86('0x3a')](_0x43f125[_0x7e86('0x37')],{'$or':_[_0x7e86('0x27')](_0x53b2f6,function(_0x5b2559){if(_0x5b2559[_0x7e86('0x2a')]!==_0x7e86('0x3b')){var _0x2e5e24={};_0x2e5e24[_0x5b2559[_0x7e86('0x25')]]={'$like':'%'+_0x5271b3[_0x7e86('0x2f')][_0x7e86('0x3c')]+'%'};return _0x2e5e24;}})});}_0x43f125=_[_0x7e86('0x3a')]({},_0x43f125,_0x5271b3['options']);var _0x5f3635={'where':_0x43f125[_0x7e86('0x37')]};return db[_0x7e86('0x28')][_0x7e86('0x3d')](_0x5f3635)[_0x7e86('0x22')](function(_0x958a2a){_0x24b74b[_0x7e86('0x3d')]=_0x958a2a;if(_0x5271b3[_0x7e86('0x2f')]['includeAll']){_0x43f125[_0x7e86('0x3e')]=[{'all':!![]}];}return db[_0x7e86('0x28')][_0x7e86('0x3f')](_0x43f125);})['then'](function(_0x43432e){_0x24b74b[_0x7e86('0x40')]=_0x43432e;return _0x24b74b;})[_0x7e86('0x22')](respondWithFilteredResult(_0x390602,_0x43f125))[_0x7e86('0x41')](handleError(_0x390602,null));};exports[_0x7e86('0x42')]=function(_0xf070b2,_0x5f56f3){var _0x574309={'raw':!![],'where':{'id':_0xf070b2[_0x7e86('0x43')]['id']}},_0x490a58={};_0x490a58[_0x7e86('0x2c')]=_[_0x7e86('0x2d')](db[_0x7e86('0x28')][_0x7e86('0x29')]);_0x490a58[_0x7e86('0x2f')]=_[_0x7e86('0x2d')](_0xf070b2['query']);_0x490a58[_0x7e86('0x38')]=_['intersection'](_0x490a58['model'],_0x490a58[_0x7e86('0x2f')]);_0x574309['attributes']=_[_0x7e86('0x2e')](_0x490a58[_0x7e86('0x2c')],qs[_0x7e86('0x31')](_0xf070b2[_0x7e86('0x2f')]['fields']));_0x574309[_0x7e86('0x30')]=_0x574309[_0x7e86('0x30')]['length']?_0x574309[_0x7e86('0x30')]:_0x490a58[_0x7e86('0x2c')];if(_0xf070b2[_0x7e86('0x2f')][_0x7e86('0x44')]){_0x574309['include']=[{'all':!![]}];}_0x574309=_[_0x7e86('0x3a')]({},_0x574309,_0xf070b2['options']);return db[_0x7e86('0x28')]['find'](_0x574309)[_0x7e86('0x22')](handleEntityNotFound(_0x5f56f3,null))['then'](respondWithResult(_0x5f56f3,null))[_0x7e86('0x41')](handleError(_0x5f56f3,null));};exports[_0x7e86('0x45')]=function(_0xd73bf,_0x4352f2){return db['SquareReport'][_0x7e86('0x45')](_0xd73bf[_0x7e86('0x46')],{})[_0x7e86('0x22')](respondWithResult(_0x4352f2,0xc9))[_0x7e86('0x41')](handleError(_0x4352f2,null));};exports[_0x7e86('0x21')]=function(_0x476514,_0x3464e6){if(_0x476514[_0x7e86('0x46')]['id']){delete _0x476514[_0x7e86('0x46')]['id'];}return db[_0x7e86('0x28')][_0x7e86('0x47')]({'where':{'id':_0x476514['params']['id']}})['then'](handleEntityNotFound(_0x3464e6,null))['then'](saveUpdates(_0x476514[_0x7e86('0x46')],null))[_0x7e86('0x22')](respondWithResult(_0x3464e6,null))[_0x7e86('0x41')](handleError(_0x3464e6,null));};exports[_0x7e86('0x48')]=function(_0x422052,_0x27576e){return db['SquareReport'][_0x7e86('0x47')]({'where':{'id':_0x422052['params']['id']}})[_0x7e86('0x22')](handleEntityNotFound(_0x27576e,null))[_0x7e86('0x22')](removeEntity(_0x27576e,null))[_0x7e86('0x41')](handleError(_0x27576e,null));};exports[_0x7e86('0x49')]=function(_0x55682a,_0x366aed){return db[_0x7e86('0x28')]['describe']()['then'](respondWithResult(_0x366aed,null))[_0x7e86('0x41')](handleError(_0x366aed,null));}; \ No newline at end of file +var _0xfd51=['jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','crypto'];(function(_0x4783bd,_0x47805c){var _0x534bac=function(_0x9c9ddb){while(--_0x9c9ddb){_0x4783bd['push'](_0x4783bd['shift']());}};_0x534bac(++_0x47805c);}(_0xfd51,0x8a));var _0x1fd5=function(_0x5e9d29,_0x43c663){_0x5e9d29=_0x5e9d29-0x0;var _0x24947d=_0xfd51[_0x5e9d29];return _0x24947d;};'use strict';var pdf=require(_0x1fd5('0x0'));var emlformat=require(_0x1fd5('0x1'));var rimraf=require(_0x1fd5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fd5('0x3'));var rp=require(_0x1fd5('0x4'));var moment=require(_0x1fd5('0x5'));var BPromise=require(_0x1fd5('0x6'));var Mustache=require(_0x1fd5('0x7'));var util=require('util');var path=require(_0x1fd5('0x8'));var sox=require(_0x1fd5('0x9'));var csv=require('to-csv');var ejs=require(_0x1fd5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1fd5('0xb'));var jsforce=require(_0x1fd5('0xc'));var deskjs=require(_0x1fd5('0xd'));var toCsv=require(_0x1fd5('0xe'));var querystring=require('querystring');var Papa=require(_0x1fd5('0xf'));var Redis=require(_0x1fd5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1fd5('0x11'));var as=require(_0x1fd5('0x12'));var hardwareService=require(_0x1fd5('0x13'));var logger=require(_0x1fd5('0x14'))(_0x1fd5('0x15'));var utils=require(_0x1fd5('0x16'));var config=require(_0x1fd5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x570534,_0x44ede0){_0x44ede0=_0x44ede0||0xcc;return function(_0x23124c){if(_0x23124c){return _0x570534['sendStatus'](_0x44ede0);}return _0x570534['status'](_0x44ede0)[_0x1fd5('0x18')]();};}function respondWithResult(_0x21a961,_0x2735ab){_0x2735ab=_0x2735ab||0xc8;return function(_0xc47ba){if(_0xc47ba){return _0x21a961[_0x1fd5('0x19')](_0x2735ab)[_0x1fd5('0x1a')](_0xc47ba);}};}function respondWithFilteredResult(_0x453858,_0x5af697){return function(_0x243dcf){if(_0x243dcf){var _0x45a6fb=_0x243dcf[_0x1fd5('0x1b')],_0x3426f4=_0x5af697[_0x1fd5('0x1c')],_0x5c19a9=_0x5af697[_0x1fd5('0x1c')]+_0x5af697['limit'],_0x4b0df7;if(_0x5c19a9>=_0x45a6fb){_0x5c19a9=_0x45a6fb;_0x4b0df7=0xc8;}else{_0x4b0df7=0xce;}_0x453858[_0x1fd5('0x19')](_0x4b0df7);return _0x453858[_0x1fd5('0x1d')](_0x1fd5('0x1e'),_0x3426f4+'-'+_0x5c19a9+'/'+_0x45a6fb)[_0x1fd5('0x1a')](_0x243dcf);}return null;};}function patchUpdates(_0x2175e6){return function(_0x4d74a0){try{jsonpatch[_0x1fd5('0x1f')](_0x4d74a0,_0x2175e6,!![]);}catch(_0x14afac){return BPromise[_0x1fd5('0x20')](_0x14afac);}return _0x4d74a0['save']();};}function saveUpdates(_0x2f49b7,_0x5dccdf){return function(_0x264262){if(_0x264262){return _0x264262[_0x1fd5('0x21')](_0x2f49b7)[_0x1fd5('0x22')](function(_0x5b8756){return _0x5b8756;});}return null;};}function removeEntity(_0x184df1,_0x5cb193){return function(_0x3f959c){if(_0x3f959c){return _0x3f959c[_0x1fd5('0x23')]()[_0x1fd5('0x22')](function(){_0x184df1['status'](0xcc)[_0x1fd5('0x18')]();});}};}function handleEntityNotFound(_0x534fcb,_0xea81de){return function(_0x233e83){if(!_0x233e83){_0x534fcb[_0x1fd5('0x24')](0x194);}return _0x233e83;};}function handleError(_0x17869b,_0x59fc8e){_0x59fc8e=_0x59fc8e||0x1f4;return function(_0x16bd4b){logger[_0x1fd5('0x25')](_0x16bd4b[_0x1fd5('0x26')]);if(_0x16bd4b[_0x1fd5('0x27')]){delete _0x16bd4b[_0x1fd5('0x27')];}_0x17869b[_0x1fd5('0x19')](_0x59fc8e)[_0x1fd5('0x28')](_0x16bd4b);};}exports[_0x1fd5('0x29')]=function(_0x4dd5b5,_0xe4c6e3){var _0x1c7c07={},_0x3243ab={},_0x11075c={'count':0x0,'rows':[]};var _0x1b640e=_[_0x1fd5('0x2a')](db[_0x1fd5('0x2b')][_0x1fd5('0x2c')],function(_0x135c56){return{'name':_0x135c56['fieldName'],'type':_0x135c56[_0x1fd5('0x2d')][_0x1fd5('0x2e')]};});_0x3243ab[_0x1fd5('0x2f')]=_[_0x1fd5('0x2a')](_0x1b640e,_0x1fd5('0x27'));_0x3243ab[_0x1fd5('0x30')]=_[_0x1fd5('0x31')](_0x4dd5b5['query']);_0x3243ab[_0x1fd5('0x32')]=_[_0x1fd5('0x33')](_0x3243ab['model'],_0x3243ab['query']);_0x1c7c07[_0x1fd5('0x34')]=_[_0x1fd5('0x33')](_0x3243ab[_0x1fd5('0x2f')],qs[_0x1fd5('0x35')](_0x4dd5b5[_0x1fd5('0x30')][_0x1fd5('0x35')]));_0x1c7c07[_0x1fd5('0x34')]=_0x1c7c07[_0x1fd5('0x34')][_0x1fd5('0x36')]?_0x1c7c07['attributes']:_0x3243ab[_0x1fd5('0x2f')];if(!_0x4dd5b5[_0x1fd5('0x30')][_0x1fd5('0x37')](_0x1fd5('0x38'))){_0x1c7c07[_0x1fd5('0x39')]=qs[_0x1fd5('0x39')](_0x4dd5b5['query'][_0x1fd5('0x39')]);_0x1c7c07[_0x1fd5('0x1c')]=qs[_0x1fd5('0x1c')](_0x4dd5b5[_0x1fd5('0x30')][_0x1fd5('0x1c')]);}_0x1c7c07[_0x1fd5('0x3a')]=qs[_0x1fd5('0x3b')](_0x4dd5b5[_0x1fd5('0x30')][_0x1fd5('0x3b')]);_0x1c7c07[_0x1fd5('0x3c')]=qs['filters'](_[_0x1fd5('0x3d')](_0x4dd5b5[_0x1fd5('0x30')],_0x3243ab[_0x1fd5('0x32')]),_0x1b640e);if(_0x4dd5b5['query'][_0x1fd5('0x3e')]){_0x1c7c07[_0x1fd5('0x3c')]=_['merge'](_0x1c7c07[_0x1fd5('0x3c')],{'$or':_['map'](_0x1b640e,function(_0x161a62){if(_0x161a62[_0x1fd5('0x2d')]!==_0x1fd5('0x3f')){var _0x19890a={};_0x19890a[_0x161a62[_0x1fd5('0x27')]]={'$like':'%'+_0x4dd5b5[_0x1fd5('0x30')][_0x1fd5('0x3e')]+'%'};return _0x19890a;}})});}_0x1c7c07=_[_0x1fd5('0x40')]({},_0x1c7c07,_0x4dd5b5[_0x1fd5('0x41')]);var _0x7be9ab={'where':_0x1c7c07[_0x1fd5('0x3c')]};return db[_0x1fd5('0x2b')]['count'](_0x7be9ab)['then'](function(_0x4948d4){_0x11075c[_0x1fd5('0x1b')]=_0x4948d4;if(_0x4dd5b5['query'][_0x1fd5('0x42')]){_0x1c7c07[_0x1fd5('0x43')]=[{'all':!![]}];}return db[_0x1fd5('0x2b')]['findAll'](_0x1c7c07);})[_0x1fd5('0x22')](function(_0x4fa7fb){_0x11075c[_0x1fd5('0x44')]=_0x4fa7fb;return _0x11075c;})['then'](respondWithFilteredResult(_0xe4c6e3,_0x1c7c07))[_0x1fd5('0x45')](handleError(_0xe4c6e3,null));};exports['show']=function(_0x6d5f94,_0x2969df){var _0x4ce451={'raw':!![],'where':{'id':_0x6d5f94[_0x1fd5('0x46')]['id']}},_0x1a1088={};_0x1a1088[_0x1fd5('0x2f')]=_[_0x1fd5('0x31')](db[_0x1fd5('0x2b')][_0x1fd5('0x2c')]);_0x1a1088['query']=_[_0x1fd5('0x31')](_0x6d5f94['query']);_0x1a1088[_0x1fd5('0x32')]=_[_0x1fd5('0x33')](_0x1a1088[_0x1fd5('0x2f')],_0x1a1088[_0x1fd5('0x30')]);_0x4ce451[_0x1fd5('0x34')]=_[_0x1fd5('0x33')](_0x1a1088['model'],qs[_0x1fd5('0x35')](_0x6d5f94[_0x1fd5('0x30')][_0x1fd5('0x35')]));_0x4ce451['attributes']=_0x4ce451['attributes'][_0x1fd5('0x36')]?_0x4ce451[_0x1fd5('0x34')]:_0x1a1088[_0x1fd5('0x2f')];if(_0x6d5f94[_0x1fd5('0x30')][_0x1fd5('0x42')]){_0x4ce451[_0x1fd5('0x43')]=[{'all':!![]}];}_0x4ce451=_['merge']({},_0x4ce451,_0x6d5f94['options']);return db['SquareReport']['find'](_0x4ce451)['then'](handleEntityNotFound(_0x2969df,null))[_0x1fd5('0x22')](respondWithResult(_0x2969df,null))['catch'](handleError(_0x2969df,null));};exports[_0x1fd5('0x47')]=function(_0x57555b,_0x329534){return db['SquareReport']['create'](_0x57555b['body'],{})[_0x1fd5('0x22')](respondWithResult(_0x329534,0xc9))[_0x1fd5('0x45')](handleError(_0x329534,null));};exports[_0x1fd5('0x21')]=function(_0x273c57,_0x3fde42){if(_0x273c57[_0x1fd5('0x48')]['id']){delete _0x273c57['body']['id'];}return db[_0x1fd5('0x2b')][_0x1fd5('0x49')]({'where':{'id':_0x273c57[_0x1fd5('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fde42,null))[_0x1fd5('0x22')](saveUpdates(_0x273c57[_0x1fd5('0x48')],null))['then'](respondWithResult(_0x3fde42,null))[_0x1fd5('0x45')](handleError(_0x3fde42,null));};exports[_0x1fd5('0x23')]=function(_0x417253,_0x4b82ee){return db['SquareReport'][_0x1fd5('0x49')]({'where':{'id':_0x417253[_0x1fd5('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b82ee,null))[_0x1fd5('0x22')](removeEntity(_0x4b82ee,null))['catch'](handleError(_0x4b82ee,null));};exports['describe']=function(_0x428f7f,_0x270c02){return db[_0x1fd5('0x2b')][_0x1fd5('0x4a')]()[_0x1fd5('0x22')](respondWithResult(_0x270c02,null))[_0x1fd5('0x45')](handleError(_0x270c02,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a6cf268..bb3cd32 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 _0x9b2e=['project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x291754,_0x5e565b){var _0x40a674=function(_0x55ef13){while(--_0x55ef13){_0x291754['push'](_0x291754['shift']());}};_0x40a674(++_0x5e565b);}(_0x9b2e,0x6e));var _0xe9b2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9b2e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe9b2('0x0'));var util=require('util');var logger=require(_0xe9b2('0x1'))(_0xe9b2('0x2'));var moment=require(_0xe9b2('0x3'));var BPromise=require(_0xe9b2('0x4'));var rp=require(_0xe9b2('0x5'));var fs=require('fs');var path=require(_0xe9b2('0x6'));var rimraf=require(_0xe9b2('0x7'));var config=require(_0xe9b2('0x8'));var attributes=require(_0xe9b2('0x9'));module[_0xe9b2('0xa')]=function(_0x3c72d8,_0x463483){return _0x3c72d8[_0xe9b2('0xb')](_0xe9b2('0xc'),attributes,{'tableName':_0xe9b2('0xd'),'paranoid':![],'indexes':[{'name':_0xe9b2('0xe'),'fields':[_0xe9b2('0xf'),_0xe9b2('0x10')]},{'name':'leaveAt','fields':[_0xe9b2('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6861=['project_name','leaveAt','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uniqueid'];(function(_0x352833,_0x348f7f){var _0x29c92b=function(_0x44751a){while(--_0x44751a){_0x352833['push'](_0x352833['shift']());}};_0x29c92b(++_0x348f7f);}(_0x6861,0x132));var _0x1686=function(_0x239d82,_0x37a4cd){_0x239d82=_0x239d82-0x0;var _0x55380d=_0x6861[_0x239d82];return _0x55380d;};'use strict';var _=require(_0x1686('0x0'));var util=require(_0x1686('0x1'));var logger=require(_0x1686('0x2'))(_0x1686('0x3'));var moment=require(_0x1686('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1686('0x5'));var rimraf=require(_0x1686('0x6'));var config=require(_0x1686('0x7'));var attributes=require(_0x1686('0x8'));module[_0x1686('0x9')]=function(_0x9b2837,_0x49e4d1){return _0x9b2837[_0x1686('0xa')](_0x1686('0xb'),attributes,{'tableName':_0x1686('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1686('0xd'),_0x1686('0xe')]},{'name':_0x1686('0xf'),'fields':[_0x1686('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a678fc5..0795c48 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 _0x8207=['UpdateSquareReport','update','body','raw','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','CreateSquareReport','create','options','debug','catch'];(function(_0x292507,_0x296175){var _0x56c975=function(_0x20f6c3){while(--_0x20f6c3){_0x292507['push'](_0x292507['shift']());}};_0x56c975(++_0x296175);}(_0x8207,0x82));var _0x7820=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8207[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7820('0x0'));var util=require(_0x7820('0x1'));var moment=require('moment');var BPromise=require(_0x7820('0x2'));var rs=require(_0x7820('0x3'));var fs=require('fs');var Redis=require(_0x7820('0x4'));var db=require(_0x7820('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7820('0x6'))(_0x7820('0x7'));var config=require(_0x7820('0x8'));var jayson=require(_0x7820('0x9'));var client=jayson['client'][_0x7820('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c49a1,_0x368f0d,_0x16d656){return new BPromise(function(_0xe262c1,_0x2cae28){return client['request'](_0x2c49a1,_0x16d656)[_0x7820('0xb')](function(_0x4e3923){logger[_0x7820('0xc')]('SquareReport,\x20%s,\x20%s',_0x368f0d,_0x7820('0xd'));logger['debug'](_0x7820('0xe'),_0x368f0d,_0x7820('0xd'),JSON[_0x7820('0xf')](_0x4e3923));if(_0x4e3923[_0x7820('0x10')]){if(_0x4e3923[_0x7820('0x10')][_0x7820('0x11')]===0x1f4){logger[_0x7820('0x10')](_0x7820('0x12'),_0x368f0d,_0x4e3923[_0x7820('0x10')][_0x7820('0x13')]);return _0x2cae28(_0x4e3923[_0x7820('0x10')][_0x7820('0x13')]);}logger[_0x7820('0x10')]('SquareReport,\x20%s,\x20%s',_0x368f0d,_0x4e3923[_0x7820('0x10')]['message']);return _0xe262c1(_0x4e3923[_0x7820('0x10')][_0x7820('0x13')]);}else{logger[_0x7820('0xc')](_0x7820('0x12'),_0x368f0d,_0x7820('0xd'));_0xe262c1(_0x4e3923['result']['message']);}})['catch'](function(_0x3a931f){logger[_0x7820('0x10')](_0x7820('0x12'),_0x368f0d,_0x3a931f);_0x2cae28(_0x3a931f);});});}exports[_0x7820('0x14')]=function(_0x543738){var _0x12ba8d=this;return new Promise(function(_0x4b6def,_0x4de1cb){return db['SquareReport'][_0x7820('0x15')](_0x543738['body'],{'raw':_0x543738[_0x7820('0x16')]?_0x543738['options']['raw']===undefined?!![]:![]:!![]})[_0x7820('0xb')](function(_0x25aa17){logger[_0x7820('0xc')](_0x7820('0x14'),_0x543738);logger[_0x7820('0x17')]('CreateSquareReport',_0x543738,JSON['stringify'](_0x25aa17));_0x4b6def(_0x25aa17);})[_0x7820('0x18')](function(_0x418e40){logger[_0x7820('0x10')](_0x7820('0x14'),_0x418e40[_0x7820('0x13')],_0x543738);_0x4de1cb(_0x12ba8d[_0x7820('0x10')](0x1f4,_0x418e40[_0x7820('0x13')]));});});};exports[_0x7820('0x19')]=function(_0xeba28c){var _0x484a7f=this;return new Promise(function(_0x53ae29,_0x426367){return db['SquareReport'][_0x7820('0x1a')](_0xeba28c[_0x7820('0x1b')],{'raw':_0xeba28c[_0x7820('0x16')]?_0xeba28c[_0x7820('0x16')][_0x7820('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeba28c[_0x7820('0x16')]?_0xeba28c[_0x7820('0x16')]['where']||null:null,'attributes':_0xeba28c['options']?_0xeba28c[_0x7820('0x16')][_0x7820('0x1d')]||null:null,'limit':_0xeba28c[_0x7820('0x16')]?_0xeba28c[_0x7820('0x16')][_0x7820('0x1e')]||null:null})[_0x7820('0xb')](function(_0x3133ef){logger['info'](_0x7820('0x19'),_0xeba28c);logger[_0x7820('0x17')](_0x7820('0x19'),_0xeba28c,JSON[_0x7820('0xf')](_0x3133ef));_0x53ae29(_0x3133ef);})[_0x7820('0x18')](function(_0x5754bc){logger[_0x7820('0x10')](_0x7820('0x19'),_0x5754bc['message'],_0xeba28c);_0x426367(_0x484a7f[_0x7820('0x10')](0x1f4,_0x5754bc['message']));});});}; \ No newline at end of file +var _0xa61b=['rpc','../../config/environment','jayson/promise','request','then','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','create','options','CreateSquareReport','UpdateSquareReport','SquareReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x40edc7,_0x154969){var _0x3334c9=function(_0x40957c){while(--_0x40957c){_0x40edc7['push'](_0x40edc7['shift']());}};_0x3334c9(++_0x154969);}(_0xa61b,0xe9));var _0xba61=function(_0x58609b,_0x4b9fc7){_0x58609b=_0x58609b-0x0;var _0x4c9ace=_0xa61b[_0x58609b];return _0x4c9ace;};'use strict';var _=require(_0xba61('0x0'));var util=require(_0xba61('0x1'));var moment=require(_0xba61('0x2'));var BPromise=require(_0xba61('0x3'));var rs=require(_0xba61('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba61('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba61('0x6'))(_0xba61('0x7'));var config=require(_0xba61('0x8'));var jayson=require(_0xba61('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x255600,_0x19e3c6,_0x14463d){return new BPromise(function(_0x5c1b17,_0x4dc15){return client[_0xba61('0xa')](_0x255600,_0x14463d)[_0xba61('0xb')](function(_0x248b72){logger['info'](_0xba61('0xc'),_0x19e3c6,'request\x20sent');logger[_0xba61('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x19e3c6,_0xba61('0xe'),JSON[_0xba61('0xf')](_0x248b72));if(_0x248b72[_0xba61('0x10')]){if(_0x248b72['error'][_0xba61('0x11')]===0x1f4){logger[_0xba61('0x10')](_0xba61('0xc'),_0x19e3c6,_0x248b72[_0xba61('0x10')]['message']);return _0x4dc15(_0x248b72[_0xba61('0x10')][_0xba61('0x12')]);}logger['error'](_0xba61('0xc'),_0x19e3c6,_0x248b72[_0xba61('0x10')][_0xba61('0x12')]);return _0x5c1b17(_0x248b72[_0xba61('0x10')]['message']);}else{logger[_0xba61('0x13')]('SquareReport,\x20%s,\x20%s',_0x19e3c6,_0xba61('0xe'));_0x5c1b17(_0x248b72[_0xba61('0x14')][_0xba61('0x12')]);}})[_0xba61('0x15')](function(_0x4fe4d1){logger[_0xba61('0x10')](_0xba61('0xc'),_0x19e3c6,_0x4fe4d1);_0x4dc15(_0x4fe4d1);});});}exports['CreateSquareReport']=function(_0x2b0839){var _0xdcab4e=this;return new Promise(function(_0x58ced3,_0x31557b){return db['SquareReport'][_0xba61('0x16')](_0x2b0839['body'],{'raw':_0x2b0839['options']?_0x2b0839[_0xba61('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xba61('0xb')](function(_0x559c88){logger[_0xba61('0x13')](_0xba61('0x18'),_0x2b0839);logger[_0xba61('0xd')](_0xba61('0x18'),_0x2b0839,JSON[_0xba61('0xf')](_0x559c88));_0x58ced3(_0x559c88);})[_0xba61('0x15')](function(_0x1e01c8){logger['error'](_0xba61('0x18'),_0x1e01c8[_0xba61('0x12')],_0x2b0839);_0x31557b(_0xdcab4e[_0xba61('0x10')](0x1f4,_0x1e01c8['message']));});});};exports[_0xba61('0x19')]=function(_0x3a3f89){var _0x5b5402=this;return new Promise(function(_0x1e3714,_0xda39c3){return db[_0xba61('0x1a')][_0xba61('0x1b')](_0x3a3f89['body'],{'raw':_0x3a3f89[_0xba61('0x17')]?_0x3a3f89[_0xba61('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a3f89[_0xba61('0x17')]?_0x3a3f89[_0xba61('0x17')][_0xba61('0x1c')]||null:null,'attributes':_0x3a3f89[_0xba61('0x17')]?_0x3a3f89[_0xba61('0x17')][_0xba61('0x1d')]||null:null,'limit':_0x3a3f89[_0xba61('0x17')]?_0x3a3f89[_0xba61('0x17')]['limit']||null:null})[_0xba61('0xb')](function(_0x19cc65){logger[_0xba61('0x13')](_0xba61('0x19'),_0x3a3f89);logger['debug']('UpdateSquareReport',_0x3a3f89,JSON[_0xba61('0xf')](_0x19cc65));_0x1e3714(_0x19cc65);})['catch'](function(_0xa65fa5){logger['error'](_0xba61('0x19'),_0xa65fa5[_0xba61('0x12')],_0x3a3f89);_0xda39c3(_0x5b5402[_0xba61('0x10')](0x1f4,_0xa65fa5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 745e8e0..b4600a9 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(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0x7a54,0x106));var _0x47a5=function(_0x4e3906,_0xa02830){_0x4e3906=_0x4e3906-0x0;var _0x478563=_0x7a54[_0x4e3906];return _0x478563;};'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 _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x13a5b4,_0x649bea){var _0x30afd4=function(_0xaeb65a){while(--_0xaeb65a){_0x13a5b4['push'](_0x13a5b4['shift']());}};_0x30afd4(++_0x649bea);}(_0x5f2f,0x73));var _0xf5f2=function(_0x54fda5,_0x1093c6){_0x54fda5=_0x54fda5-0x0;var _0x34c133=_0x5f2f[_0x54fda5];return _0x34c133;};'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('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 99dd019..2001eaf 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 _0x1b9a=['TEXT','sequelize','STRING'];(function(_0x3575e7,_0x4414e2){var _0x1fe1c6=function(_0x38afda){while(--_0x38afda){_0x3575e7['push'](_0x3575e7['shift']());}};_0x1fe1c6(++_0x4414e2);}(_0x1b9a,0x10c));var _0xa1b9=function(_0x14ee95,_0x239f70){_0x14ee95=_0x14ee95-0x0;var _0x470402=_0x1b9a[_0x14ee95];return _0x470402;};'use strict';var Sequelize=require(_0xa1b9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa1b9('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xa1b9('0x1')]},'data':{'type':Sequelize[_0xa1b9('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe7d7=['exports','STRING','sequelize'];(function(_0x5e3f88,_0xf9b218){var _0x161d3f=function(_0x5b7ac1){while(--_0x5b7ac1){_0x5e3f88['push'](_0x5e3f88['shift']());}};_0x161d3f(++_0xf9b218);}(_0xe7d7,0x1e5));var _0x7e7d=function(_0x238793,_0x4a3755){_0x238793=_0x238793-0x0;var _0x109e7b=_0xe7d7[_0x238793];return _0x109e7b;};'use strict';var Sequelize=require(_0x7e7d('0x0'));module[_0x7e7d('0x1')]={'uniqueid':{'type':Sequelize[_0x7e7d('0x2')]},'node':{'type':Sequelize[_0x7e7d('0x2')]},'application':{'type':Sequelize[_0x7e7d('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x7e7d('0x2')]},'callerid':{'type':Sequelize[_0x7e7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 48651a1..345c7dd 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 _0xd6d2=['crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','send','index','map','SquareDetailsReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','filter','merge','VIRTUAL','name','options','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','lodash'];(function(_0x4b952f,_0x50afd4){var _0x15b0b5=function(_0x4f02b9){while(--_0x4f02b9){_0x4b952f['push'](_0x4b952f['shift']());}};_0x15b0b5(++_0x50afd4);}(_0xd6d2,0x10a));var _0x2d6d=function(_0x46800e,_0x52b992){_0x46800e=_0x46800e-0x0;var _0x4d00f9=_0xd6d2[_0x46800e];return _0x4d00f9;};'use strict';var pdf=require(_0x2d6d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2d6d('0x1'));var zipdir=require(_0x2d6d('0x2'));var jsonpatch=require(_0x2d6d('0x3'));var rp=require('request-promise');var moment=require(_0x2d6d('0x4'));var BPromise=require(_0x2d6d('0x5'));var Mustache=require(_0x2d6d('0x6'));var util=require('util');var path=require(_0x2d6d('0x7'));var sox=require(_0x2d6d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2d6d('0x9'));var squel=require('squel');var crypto=require(_0x2d6d('0xa'));var jsforce=require(_0x2d6d('0xb'));var deskjs=require(_0x2d6d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2d6d('0xd'));var Redis=require('ioredis');var authService=require(_0x2d6d('0xe'));var qs=require(_0x2d6d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d6d('0x10'))(_0x2d6d('0x11'));var utils=require(_0x2d6d('0x12'));var config=require(_0x2d6d('0x13'));var db=require(_0x2d6d('0x14'))['db'];function respondWithStatusCode(_0x306ce2,_0x8f30cc){_0x8f30cc=_0x8f30cc||0xcc;return function(_0x6e4cba){if(_0x6e4cba){return _0x306ce2[_0x2d6d('0x15')](_0x8f30cc);}return _0x306ce2[_0x2d6d('0x16')](_0x8f30cc)[_0x2d6d('0x17')]();};}function respondWithResult(_0xafb63f,_0x2a1a6b){_0x2a1a6b=_0x2a1a6b||0xc8;return function(_0x256432){if(_0x256432){return _0xafb63f[_0x2d6d('0x16')](_0x2a1a6b)[_0x2d6d('0x18')](_0x256432);}};}function respondWithFilteredResult(_0x4b44f7,_0x4c2642){return function(_0x6242df){if(_0x6242df){var _0x4def5a=_0x6242df[_0x2d6d('0x19')],_0x183eb7=_0x4c2642[_0x2d6d('0x1a')],_0x143303=_0x4c2642[_0x2d6d('0x1a')]+_0x4c2642['limit'],_0x1465d8;if(_0x143303>=_0x4def5a){_0x143303=_0x4def5a;_0x1465d8=0xc8;}else{_0x1465d8=0xce;}_0x4b44f7['status'](_0x1465d8);return _0x4b44f7[_0x2d6d('0x1b')](_0x2d6d('0x1c'),_0x183eb7+'-'+_0x143303+'/'+_0x4def5a)[_0x2d6d('0x18')](_0x6242df);}return null;};}function patchUpdates(_0x4a7632){return function(_0x258ce0){try{jsonpatch['apply'](_0x258ce0,_0x4a7632,!![]);}catch(_0x157977){return BPromise[_0x2d6d('0x1d')](_0x157977);}return _0x258ce0[_0x2d6d('0x1e')]();};}function saveUpdates(_0x44407e,_0x20ca2b){return function(_0x48465b){if(_0x48465b){return _0x48465b[_0x2d6d('0x1f')](_0x44407e)['then'](function(_0x54bcf7){return _0x54bcf7;});}return null;};}function removeEntity(_0x3ca23b,_0x5edadc){return function(_0x728fb4){if(_0x728fb4){return _0x728fb4[_0x2d6d('0x20')]()[_0x2d6d('0x21')](function(){_0x3ca23b[_0x2d6d('0x16')](0xcc)[_0x2d6d('0x17')]();});}};}function handleEntityNotFound(_0xaed2fc,_0x4e5bd0){return function(_0x556cc4){if(!_0x556cc4){_0xaed2fc[_0x2d6d('0x15')](0x194);}return _0x556cc4;};}function handleError(_0x12593c,_0x28ea76){_0x28ea76=_0x28ea76||0x1f4;return function(_0x2a40f3){logger[_0x2d6d('0x22')](_0x2a40f3[_0x2d6d('0x23')]);if(_0x2a40f3['name']){delete _0x2a40f3['name'];}_0x12593c[_0x2d6d('0x16')](_0x28ea76)[_0x2d6d('0x24')](_0x2a40f3);};}exports[_0x2d6d('0x25')]=function(_0x8d5f6e,_0x46e159){var _0x3622a0={},_0x14868c={},_0x3c5c13={'count':0x0,'rows':[]};var _0x5a70b1=_[_0x2d6d('0x26')](db[_0x2d6d('0x27')][_0x2d6d('0x28')],function(_0x52fafa){return{'name':_0x52fafa['fieldName'],'type':_0x52fafa[_0x2d6d('0x29')]['key']};});_0x14868c[_0x2d6d('0x2a')]=_[_0x2d6d('0x26')](_0x5a70b1,'name');_0x14868c[_0x2d6d('0x2b')]=_[_0x2d6d('0x2c')](_0x8d5f6e[_0x2d6d('0x2b')]);_0x14868c[_0x2d6d('0x2d')]=_[_0x2d6d('0x2e')](_0x14868c[_0x2d6d('0x2a')],_0x14868c['query']);_0x3622a0[_0x2d6d('0x2f')]=_['intersection'](_0x14868c[_0x2d6d('0x2a')],qs['fields'](_0x8d5f6e[_0x2d6d('0x2b')][_0x2d6d('0x30')]));_0x3622a0[_0x2d6d('0x2f')]=_0x3622a0[_0x2d6d('0x2f')][_0x2d6d('0x31')]?_0x3622a0[_0x2d6d('0x2f')]:_0x14868c[_0x2d6d('0x2a')];if(!_0x8d5f6e[_0x2d6d('0x2b')]['hasOwnProperty'](_0x2d6d('0x32'))){_0x3622a0[_0x2d6d('0x33')]=qs[_0x2d6d('0x33')](_0x8d5f6e[_0x2d6d('0x2b')][_0x2d6d('0x33')]);_0x3622a0[_0x2d6d('0x1a')]=qs[_0x2d6d('0x1a')](_0x8d5f6e['query'][_0x2d6d('0x1a')]);}_0x3622a0['order']=qs[_0x2d6d('0x34')](_0x8d5f6e[_0x2d6d('0x2b')][_0x2d6d('0x34')]);_0x3622a0[_0x2d6d('0x35')]=qs[_0x2d6d('0x2d')](_['pick'](_0x8d5f6e[_0x2d6d('0x2b')],_0x14868c[_0x2d6d('0x2d')]),_0x5a70b1);if(_0x8d5f6e[_0x2d6d('0x2b')][_0x2d6d('0x36')]){_0x3622a0['where']=_[_0x2d6d('0x37')](_0x3622a0[_0x2d6d('0x35')],{'$or':_[_0x2d6d('0x26')](_0x5a70b1,function(_0x254b02){if(_0x254b02[_0x2d6d('0x29')]!==_0x2d6d('0x38')){var _0x265c28={};_0x265c28[_0x254b02[_0x2d6d('0x39')]]={'$like':'%'+_0x8d5f6e['query']['filter']+'%'};return _0x265c28;}})});}_0x3622a0=_[_0x2d6d('0x37')]({},_0x3622a0,_0x8d5f6e[_0x2d6d('0x3a')]);var _0x2780cb={'where':_0x3622a0[_0x2d6d('0x35')]};return db[_0x2d6d('0x27')]['count'](_0x2780cb)[_0x2d6d('0x21')](function(_0x59550e){_0x3c5c13[_0x2d6d('0x19')]=_0x59550e;if(_0x8d5f6e['query']['includeAll']){_0x3622a0[_0x2d6d('0x3b')]=[{'all':!![]}];}return db[_0x2d6d('0x27')][_0x2d6d('0x3c')](_0x3622a0);})['then'](function(_0x1f4d1b){_0x3c5c13[_0x2d6d('0x3d')]=_0x1f4d1b;return _0x3c5c13;})[_0x2d6d('0x21')](respondWithFilteredResult(_0x46e159,_0x3622a0))[_0x2d6d('0x3e')](handleError(_0x46e159,null));};exports[_0x2d6d('0x3f')]=function(_0x2cf7be,_0x2e7c7c){var _0x18c50b={'raw':!![],'where':{'id':_0x2cf7be[_0x2d6d('0x40')]['id']}},_0x489c36={};_0x489c36[_0x2d6d('0x2a')]=_[_0x2d6d('0x2c')](db['SquareDetailsReport']['rawAttributes']);_0x489c36[_0x2d6d('0x2b')]=_[_0x2d6d('0x2c')](_0x2cf7be[_0x2d6d('0x2b')]);_0x489c36[_0x2d6d('0x2d')]=_[_0x2d6d('0x2e')](_0x489c36['model'],_0x489c36['query']);_0x18c50b[_0x2d6d('0x2f')]=_[_0x2d6d('0x2e')](_0x489c36[_0x2d6d('0x2a')],qs[_0x2d6d('0x30')](_0x2cf7be[_0x2d6d('0x2b')]['fields']));_0x18c50b[_0x2d6d('0x2f')]=_0x18c50b[_0x2d6d('0x2f')]['length']?_0x18c50b['attributes']:_0x489c36[_0x2d6d('0x2a')];if(_0x2cf7be['query']['includeAll']){_0x18c50b[_0x2d6d('0x3b')]=[{'all':!![]}];}_0x18c50b=_[_0x2d6d('0x37')]({},_0x18c50b,_0x2cf7be[_0x2d6d('0x3a')]);return db[_0x2d6d('0x27')][_0x2d6d('0x41')](_0x18c50b)[_0x2d6d('0x21')](handleEntityNotFound(_0x2e7c7c,null))['then'](respondWithResult(_0x2e7c7c,null))[_0x2d6d('0x3e')](handleError(_0x2e7c7c,null));};exports[_0x2d6d('0x42')]=function(_0x502fe3,_0x23ba8a){return db['SquareDetailsReport'][_0x2d6d('0x42')](_0x502fe3[_0x2d6d('0x43')],{})[_0x2d6d('0x21')](respondWithResult(_0x23ba8a,0xc9))[_0x2d6d('0x3e')](handleError(_0x23ba8a,null));};exports[_0x2d6d('0x1f')]=function(_0x23ae60,_0x4c21df){if(_0x23ae60[_0x2d6d('0x43')]['id']){delete _0x23ae60[_0x2d6d('0x43')]['id'];}return db[_0x2d6d('0x27')][_0x2d6d('0x41')]({'where':{'id':_0x23ae60[_0x2d6d('0x40')]['id']}})[_0x2d6d('0x21')](handleEntityNotFound(_0x4c21df,null))['then'](saveUpdates(_0x23ae60['body'],null))[_0x2d6d('0x21')](respondWithResult(_0x4c21df,null))[_0x2d6d('0x3e')](handleError(_0x4c21df,null));};exports[_0x2d6d('0x20')]=function(_0x244caf,_0x2b58a9){return db[_0x2d6d('0x27')][_0x2d6d('0x41')]({'where':{'id':_0x244caf[_0x2d6d('0x40')]['id']}})[_0x2d6d('0x21')](handleEntityNotFound(_0x2b58a9,null))[_0x2d6d('0x21')](removeEntity(_0x2b58a9,null))[_0x2d6d('0x3e')](handleError(_0x2b58a9,null));};exports[_0x2d6d('0x44')]=function(_0x1ddec0,_0x55438e){return db[_0x2d6d('0x27')][_0x2d6d('0x44')]()[_0x2d6d('0x21')](respondWithResult(_0x55438e,null))[_0x2d6d('0x3e')](handleError(_0x55438e,null));}; \ No newline at end of file +var _0xc812=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','bluebird','util','to-csv','ejs','crypto','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','then','destroy','error','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc812,0x1eb));var _0x2c81=function(_0x39ad23,_0x1ef6a5){_0x39ad23=_0x39ad23-0x0;var _0x710d93=_0xc812[_0x39ad23];return _0x710d93;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2c81('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c81('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2c81('0x2'));var Mustache=require('mustache');var util=require(_0x2c81('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x2c81('0x4'));var ejs=require(_0x2c81('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c81('0x6'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2c81('0x4'));var querystring=require('querystring');var Papa=require(_0x2c81('0x7'));var Redis=require(_0x2c81('0x8'));var authService=require(_0x2c81('0x9'));var qs=require('../../components/parsers/qs');var as=require(_0x2c81('0xa'));var hardwareService=require(_0x2c81('0xb'));var logger=require(_0x2c81('0xc'))(_0x2c81('0xd'));var utils=require('../../config/utils');var config=require(_0x2c81('0xe'));var db=require(_0x2c81('0xf'))['db'];function respondWithStatusCode(_0x20e9a3,_0x594bd3){_0x594bd3=_0x594bd3||0xcc;return function(_0x462c2c){if(_0x462c2c){return _0x20e9a3[_0x2c81('0x10')](_0x594bd3);}return _0x20e9a3[_0x2c81('0x11')](_0x594bd3)[_0x2c81('0x12')]();};}function respondWithResult(_0x46613f,_0x4a7c37){_0x4a7c37=_0x4a7c37||0xc8;return function(_0x51a97f){if(_0x51a97f){return _0x46613f[_0x2c81('0x11')](_0x4a7c37)[_0x2c81('0x13')](_0x51a97f);}};}function respondWithFilteredResult(_0x29a7d1,_0x1dc488){return function(_0x4563ae){if(_0x4563ae){var _0xa6fb84=_0x4563ae[_0x2c81('0x14')],_0x13287d=_0x1dc488[_0x2c81('0x15')],_0x1aaf83=_0x1dc488[_0x2c81('0x15')]+_0x1dc488[_0x2c81('0x16')],_0x33dbed;if(_0x1aaf83>=_0xa6fb84){_0x1aaf83=_0xa6fb84;_0x33dbed=0xc8;}else{_0x33dbed=0xce;}_0x29a7d1[_0x2c81('0x11')](_0x33dbed);return _0x29a7d1[_0x2c81('0x17')](_0x2c81('0x18'),_0x13287d+'-'+_0x1aaf83+'/'+_0xa6fb84)['json'](_0x4563ae);}return null;};}function patchUpdates(_0x22bdd6){return function(_0x56525b){try{jsonpatch['apply'](_0x56525b,_0x22bdd6,!![]);}catch(_0x24caf2){return BPromise[_0x2c81('0x19')](_0x24caf2);}return _0x56525b[_0x2c81('0x1a')]();};}function saveUpdates(_0x181905,_0x4941cd){return function(_0x2d43c0){if(_0x2d43c0){return _0x2d43c0[_0x2c81('0x1b')](_0x181905)[_0x2c81('0x1c')](function(_0x4547b4){return _0x4547b4;});}return null;};}function removeEntity(_0x32fd32,_0x1b2622){return function(_0x19fced){if(_0x19fced){return _0x19fced[_0x2c81('0x1d')]()[_0x2c81('0x1c')](function(){_0x32fd32[_0x2c81('0x11')](0xcc)[_0x2c81('0x12')]();});}};}function handleEntityNotFound(_0x34857c,_0x2e7cac){return function(_0x1a7935){if(!_0x1a7935){_0x34857c[_0x2c81('0x10')](0x194);}return _0x1a7935;};}function handleError(_0x1d6e22,_0x178bd3){_0x178bd3=_0x178bd3||0x1f4;return function(_0x2d534e){logger[_0x2c81('0x1e')](_0x2d534e[_0x2c81('0x1f')]);if(_0x2d534e['name']){delete _0x2d534e['name'];}_0x1d6e22['status'](_0x178bd3)['send'](_0x2d534e);};}exports[_0x2c81('0x20')]=function(_0x3a998d,_0xf3d66d){var _0x5ca29b={},_0x52fdea={},_0x3d68d0={'count':0x0,'rows':[]};var _0x163e8f=_[_0x2c81('0x21')](db['SquareDetailsReport'][_0x2c81('0x22')],function(_0x317804){return{'name':_0x317804[_0x2c81('0x23')],'type':_0x317804[_0x2c81('0x24')][_0x2c81('0x25')]};});_0x52fdea[_0x2c81('0x26')]=_[_0x2c81('0x21')](_0x163e8f,_0x2c81('0x27'));_0x52fdea[_0x2c81('0x28')]=_['keys'](_0x3a998d[_0x2c81('0x28')]);_0x52fdea[_0x2c81('0x29')]=_[_0x2c81('0x2a')](_0x52fdea[_0x2c81('0x26')],_0x52fdea['query']);_0x5ca29b[_0x2c81('0x2b')]=_[_0x2c81('0x2a')](_0x52fdea[_0x2c81('0x26')],qs[_0x2c81('0x2c')](_0x3a998d[_0x2c81('0x28')][_0x2c81('0x2c')]));_0x5ca29b['attributes']=_0x5ca29b[_0x2c81('0x2b')][_0x2c81('0x2d')]?_0x5ca29b[_0x2c81('0x2b')]:_0x52fdea['model'];if(!_0x3a998d[_0x2c81('0x28')][_0x2c81('0x2e')](_0x2c81('0x2f'))){_0x5ca29b[_0x2c81('0x16')]=qs[_0x2c81('0x16')](_0x3a998d[_0x2c81('0x28')][_0x2c81('0x16')]);_0x5ca29b['offset']=qs['offset'](_0x3a998d[_0x2c81('0x28')][_0x2c81('0x15')]);}_0x5ca29b[_0x2c81('0x30')]=qs[_0x2c81('0x31')](_0x3a998d[_0x2c81('0x28')][_0x2c81('0x31')]);_0x5ca29b[_0x2c81('0x32')]=qs[_0x2c81('0x29')](_['pick'](_0x3a998d['query'],_0x52fdea[_0x2c81('0x29')]),_0x163e8f);if(_0x3a998d[_0x2c81('0x28')][_0x2c81('0x33')]){_0x5ca29b[_0x2c81('0x32')]=_[_0x2c81('0x34')](_0x5ca29b['where'],{'$or':_['map'](_0x163e8f,function(_0x2db49b){if(_0x2db49b[_0x2c81('0x24')]!==_0x2c81('0x35')){var _0xfd06d7={};_0xfd06d7[_0x2db49b[_0x2c81('0x27')]]={'$like':'%'+_0x3a998d[_0x2c81('0x28')][_0x2c81('0x33')]+'%'};return _0xfd06d7;}})});}_0x5ca29b=_[_0x2c81('0x34')]({},_0x5ca29b,_0x3a998d[_0x2c81('0x36')]);var _0x534070={'where':_0x5ca29b[_0x2c81('0x32')]};return db[_0x2c81('0x37')][_0x2c81('0x14')](_0x534070)[_0x2c81('0x1c')](function(_0x30dd95){_0x3d68d0['count']=_0x30dd95;if(_0x3a998d[_0x2c81('0x28')][_0x2c81('0x38')]){_0x5ca29b[_0x2c81('0x39')]=[{'all':!![]}];}return db[_0x2c81('0x37')][_0x2c81('0x3a')](_0x5ca29b);})[_0x2c81('0x1c')](function(_0x14993a){_0x3d68d0['rows']=_0x14993a;return _0x3d68d0;})[_0x2c81('0x1c')](respondWithFilteredResult(_0xf3d66d,_0x5ca29b))[_0x2c81('0x3b')](handleError(_0xf3d66d,null));};exports[_0x2c81('0x3c')]=function(_0x3366b0,_0xf1e7e3){var _0x57f648={'raw':!![],'where':{'id':_0x3366b0[_0x2c81('0x3d')]['id']}},_0x17beef={};_0x17beef[_0x2c81('0x26')]=_[_0x2c81('0x3e')](db[_0x2c81('0x37')]['rawAttributes']);_0x17beef[_0x2c81('0x28')]=_[_0x2c81('0x3e')](_0x3366b0['query']);_0x17beef[_0x2c81('0x29')]=_[_0x2c81('0x2a')](_0x17beef[_0x2c81('0x26')],_0x17beef['query']);_0x57f648[_0x2c81('0x2b')]=_[_0x2c81('0x2a')](_0x17beef[_0x2c81('0x26')],qs[_0x2c81('0x2c')](_0x3366b0[_0x2c81('0x28')][_0x2c81('0x2c')]));_0x57f648['attributes']=_0x57f648[_0x2c81('0x2b')][_0x2c81('0x2d')]?_0x57f648['attributes']:_0x17beef[_0x2c81('0x26')];if(_0x3366b0['query'][_0x2c81('0x38')]){_0x57f648[_0x2c81('0x39')]=[{'all':!![]}];}_0x57f648=_[_0x2c81('0x34')]({},_0x57f648,_0x3366b0[_0x2c81('0x36')]);return db['SquareDetailsReport'][_0x2c81('0x3f')](_0x57f648)[_0x2c81('0x1c')](handleEntityNotFound(_0xf1e7e3,null))[_0x2c81('0x1c')](respondWithResult(_0xf1e7e3,null))['catch'](handleError(_0xf1e7e3,null));};exports['create']=function(_0x4f92f4,_0x8291e1){return db[_0x2c81('0x37')][_0x2c81('0x40')](_0x4f92f4[_0x2c81('0x41')],{})[_0x2c81('0x1c')](respondWithResult(_0x8291e1,0xc9))[_0x2c81('0x3b')](handleError(_0x8291e1,null));};exports[_0x2c81('0x1b')]=function(_0x42c5a1,_0x21807a){if(_0x42c5a1[_0x2c81('0x41')]['id']){delete _0x42c5a1[_0x2c81('0x41')]['id'];}return db['SquareDetailsReport'][_0x2c81('0x3f')]({'where':{'id':_0x42c5a1[_0x2c81('0x3d')]['id']}})['then'](handleEntityNotFound(_0x21807a,null))[_0x2c81('0x1c')](saveUpdates(_0x42c5a1[_0x2c81('0x41')],null))[_0x2c81('0x1c')](respondWithResult(_0x21807a,null))[_0x2c81('0x3b')](handleError(_0x21807a,null));};exports[_0x2c81('0x1d')]=function(_0x1431e0,_0x471871){return db[_0x2c81('0x37')][_0x2c81('0x3f')]({'where':{'id':_0x1431e0[_0x2c81('0x3d')]['id']}})[_0x2c81('0x1c')](handleEntityNotFound(_0x471871,null))['then'](removeEntity(_0x471871,null))[_0x2c81('0x3b')](handleError(_0x471871,null));};exports[_0x2c81('0x42')]=function(_0x34083d,_0x42a949){return db['SquareDetailsReport'][_0x2c81('0x42')]()[_0x2c81('0x1c')](respondWithResult(_0x42a949,null))[_0x2c81('0x3b')](handleError(_0x42a949,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index db0db3a..6374e25 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 _0xb67b=['SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x6c6dd2,_0x4ff66d){var _0x4f6595=function(_0x57ba9e){while(--_0x57ba9e){_0x6c6dd2['push'](_0x6c6dd2['shift']());}};_0x4f6595(++_0x4ff66d);}(_0xb67b,0x91));var _0xbb67=function(_0x4e707e,_0x208eb5){_0x4e707e=_0x4e707e-0x0;var _0x3d346e=_0xb67b[_0x4e707e];return _0x3d346e;};'use strict';var _=require(_0xbb67('0x0'));var util=require(_0xbb67('0x1'));var logger=require(_0xbb67('0x2'))(_0xbb67('0x3'));var moment=require(_0xbb67('0x4'));var BPromise=require(_0xbb67('0x5'));var rp=require(_0xbb67('0x6'));var fs=require('fs');var path=require(_0xbb67('0x7'));var rimraf=require(_0xbb67('0x8'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0xbb67('0x9')]=function(_0xd6326f,_0xe5a41b){return _0xd6326f[_0xbb67('0xa')](_0xbb67('0xb'),attributes,{'tableName':_0xbb67('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70cd=['define','SquareDetailsReport','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x3bd97c,_0x5d1daa){var _0x3a9a14=function(_0x57911f){while(--_0x57911f){_0x3bd97c['push'](_0x3bd97c['shift']());}};_0x3a9a14(++_0x5d1daa);}(_0x70cd,0x178));var _0xd70c=function(_0x1b9cd5,_0x103dc4){_0x1b9cd5=_0x1b9cd5-0x0;var _0x4c74ca=_0x70cd[_0x1b9cd5];return _0x4c74ca;};'use strict';var _=require('lodash');var util=require(_0xd70c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd70c('0x1'));var BPromise=require(_0xd70c('0x2'));var rp=require(_0xd70c('0x3'));var fs=require('fs');var path=require(_0xd70c('0x4'));var rimraf=require(_0xd70c('0x5'));var config=require(_0xd70c('0x6'));var attributes=require(_0xd70c('0x7'));module[_0xd70c('0x8')]=function(_0x171fbf,_0x290c14){return _0x171fbf[_0xd70c('0x9')](_0xd70c('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 3903302..40253f8 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 _0x41b6=['rpc','../../config/environment','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x365143,_0x46fd86){var _0x45bb49=function(_0x20bb4b){while(--_0x20bb4b){_0x365143['push'](_0x365143['shift']());}};_0x45bb49(++_0x46fd86);}(_0x41b6,0x110));var _0x641b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x641b('0x0'));var util=require(_0x641b('0x1'));var moment=require(_0x641b('0x2'));var BPromise=require(_0x641b('0x3'));var rs=require(_0x641b('0x4'));var fs=require('fs');var Redis=require(_0x641b('0x5'));var db=require(_0x641b('0x6'))['db'];var utils=require(_0x641b('0x7'));var logger=require('../../config/logger')(_0x641b('0x8'));var config=require(_0x641b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x641b('0xa')][_0x641b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8fc,_0x1d52b3,_0x4c637e){return new BPromise(function(_0x47bb10,_0x2ecb2f){return client[_0x641b('0xc')](_0x1dd8fc,_0x4c637e)[_0x641b('0xd')](function(_0x5e601f){logger[_0x641b('0xe')](_0x641b('0xf'),_0x1d52b3,_0x641b('0x10'));logger[_0x641b('0x11')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1d52b3,_0x641b('0x10'),JSON[_0x641b('0x12')](_0x5e601f));if(_0x5e601f['error']){if(_0x5e601f[_0x641b('0x13')]['code']===0x1f4){logger[_0x641b('0x13')](_0x641b('0xf'),_0x1d52b3,_0x5e601f[_0x641b('0x13')]['message']);return _0x2ecb2f(_0x5e601f[_0x641b('0x13')][_0x641b('0x14')]);}logger[_0x641b('0x13')](_0x641b('0xf'),_0x1d52b3,_0x5e601f[_0x641b('0x13')][_0x641b('0x14')]);return _0x47bb10(_0x5e601f[_0x641b('0x13')][_0x641b('0x14')]);}else{logger[_0x641b('0xe')](_0x641b('0xf'),_0x1d52b3,_0x641b('0x10'));_0x47bb10(_0x5e601f[_0x641b('0x15')]['message']);}})[_0x641b('0x16')](function(_0x27b216){logger[_0x641b('0x13')](_0x641b('0xf'),_0x1d52b3,_0x27b216);_0x2ecb2f(_0x27b216);});});}exports[_0x641b('0x17')]=function(_0x4f6cd2){var _0x341fbf=this;return new Promise(function(_0x657c13,_0x53d3a2){return db['SquareDetailsReport'][_0x641b('0x18')](_0x4f6cd2[_0x641b('0x19')],{'raw':_0x4f6cd2[_0x641b('0x1a')]?_0x4f6cd2[_0x641b('0x1a')][_0x641b('0x1b')]===undefined?!![]:![]:!![]})[_0x641b('0xd')](function(_0x20d1f7){logger[_0x641b('0xe')]('CreateSquareDetailsReport',_0x4f6cd2);logger[_0x641b('0x11')]('CreateSquareDetailsReport',_0x4f6cd2,JSON[_0x641b('0x12')](_0x20d1f7));_0x657c13(_0x20d1f7);})[_0x641b('0x16')](function(_0x106776){logger['error']('CreateSquareDetailsReport',_0x106776['message'],_0x4f6cd2);_0x53d3a2(_0x341fbf['error'](0x1f4,_0x106776[_0x641b('0x14')]));});});}; \ No newline at end of file +var _0x2f13=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw'];(function(_0x488616,_0xd42426){var _0x45ee9a=function(_0x16a4b5){while(--_0x16a4b5){_0x488616['push'](_0x488616['shift']());}};_0x45ee9a(++_0xd42426);}(_0x2f13,0x114));var _0x32f1=function(_0x5e67e4,_0x4cc627){_0x5e67e4=_0x5e67e4-0x0;var _0x508abd=_0x2f13[_0x5e67e4];return _0x508abd;};'use strict';var _=require('lodash');var util=require(_0x32f1('0x0'));var moment=require(_0x32f1('0x1'));var BPromise=require(_0x32f1('0x2'));var rs=require(_0x32f1('0x3'));var fs=require('fs');var Redis=require(_0x32f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x32f1('0x5'))(_0x32f1('0x6'));var config=require('../../config/environment');var jayson=require(_0x32f1('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42bda0,_0x155ecd,_0x25e4c2){return new BPromise(function(_0x39dfa0,_0x4eb44a){return client['request'](_0x42bda0,_0x25e4c2)[_0x32f1('0x8')](function(_0x234f16){logger[_0x32f1('0x9')](_0x32f1('0xa'),_0x155ecd,'request\x20sent');logger[_0x32f1('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x155ecd,_0x32f1('0xc'),JSON[_0x32f1('0xd')](_0x234f16));if(_0x234f16[_0x32f1('0xe')]){if(_0x234f16[_0x32f1('0xe')]['code']===0x1f4){logger[_0x32f1('0xe')](_0x32f1('0xa'),_0x155ecd,_0x234f16['error'][_0x32f1('0xf')]);return _0x4eb44a(_0x234f16[_0x32f1('0xe')][_0x32f1('0xf')]);}logger[_0x32f1('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x155ecd,_0x234f16[_0x32f1('0xe')][_0x32f1('0xf')]);return _0x39dfa0(_0x234f16[_0x32f1('0xe')]['message']);}else{logger['info'](_0x32f1('0xa'),_0x155ecd,_0x32f1('0xc'));_0x39dfa0(_0x234f16[_0x32f1('0x10')][_0x32f1('0xf')]);}})[_0x32f1('0x11')](function(_0xc7d2de){logger[_0x32f1('0xe')](_0x32f1('0xa'),_0x155ecd,_0xc7d2de);_0x4eb44a(_0xc7d2de);});});}exports[_0x32f1('0x12')]=function(_0x573680){var _0x5dfd6e=this;return new Promise(function(_0xc67611,_0x46f892){return db[_0x32f1('0x13')]['create'](_0x573680[_0x32f1('0x14')],{'raw':_0x573680[_0x32f1('0x15')]?_0x573680[_0x32f1('0x15')][_0x32f1('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xb50070){logger['info']('CreateSquareDetailsReport',_0x573680);logger[_0x32f1('0xb')]('CreateSquareDetailsReport',_0x573680,JSON[_0x32f1('0xd')](_0xb50070));_0xc67611(_0xb50070);})[_0x32f1('0x11')](function(_0x2a787e){logger[_0x32f1('0xe')](_0x32f1('0x12'),_0x2a787e[_0x32f1('0xf')],_0x573680);_0x46f892(_0x5dfd6e[_0x32f1('0xe')](0x1f4,_0x2a787e[_0x32f1('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5ebae5c..b9eb1cd 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 _0xdb2e=['./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x519d90,_0x4abb16){var _0x16a830=function(_0x20a442){while(--_0x20a442){_0x519d90['push'](_0x519d90['shift']());}};_0x16a830(++_0x4abb16);}(_0xdb2e,0x14e));var _0xedb2=function(_0x149cf0,_0x55c9a1){_0x149cf0=_0x149cf0-0x0;var _0x350d0d=_0xdb2e[_0x149cf0];return _0x350d0d;};'use strict';var express=require(_0xedb2('0x0'));var router=express[_0xedb2('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xedb2('0x2'));router[_0xedb2('0x3')]('/',auth[_0xedb2('0x4')](),controller['index']);router[_0xedb2('0x3')](_0xedb2('0x5'),auth[_0xedb2('0x4')](),controller[_0xedb2('0x6')]);module[_0xedb2('0x7')]=router; \ No newline at end of file +var _0xe413=['/process/:pid/kill','exports','Router','./system.controller','get','isAuthenticated','index'];(function(_0x5be1ef,_0x109e19){var _0xdf34bb=function(_0x2e0172){while(--_0x2e0172){_0x5be1ef['push'](_0x5be1ef['shift']());}};_0xdf34bb(++_0x109e19);}(_0xe413,0xa3));var _0x3e41=function(_0x5a57fa,_0x25ca6c){_0x5a57fa=_0x5a57fa-0x0;var _0x4561c5=_0xe413[_0x5a57fa];return _0x4561c5;};'use strict';var express=require('express');var router=express[_0x3e41('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x3e41('0x1'));router[_0x3e41('0x2')]('/',auth[_0x3e41('0x3')](),controller[_0x3e41('0x4')]);router[_0x3e41('0x2')](_0x3e41('0x5'),auth[_0x3e41('0x3')](),controller['killProcess']);module[_0x3e41('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 96b62dc..4790f29 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 _0x96dd=['split','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','status','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','then'];(function(_0x39ce57,_0x2d7808){var _0x387775=function(_0x10c5c5){while(--_0x10c5c5){_0x39ce57['push'](_0x39ce57['shift']());}};_0x387775(++_0x2d7808);}(_0x96dd,0x73));var _0xd96d=function(_0x1fdd69,_0x2ee434){_0x1fdd69=_0x1fdd69-0x0;var _0x46db20=_0x96dd[_0x1fdd69];return _0x46db20;};'use strict';var info=require(_0xd96d('0x0'));var exec=require(_0xd96d('0x1'))[_0xd96d('0x2')];var logger=require(_0xd96d('0x3'))(_0xd96d('0x4'));var util=require(_0xd96d('0x5'));var BPromise=require(_0xd96d('0x6'));var _=require(_0xd96d('0x7'));function handleError(_0x1a5a8f,_0x359252,_0xd5cb20){_0x359252=_0x359252||0x1f4;return function(_0x631e54){logger[_0xd96d('0x8')](_0xd96d('0x9'),_0xd5cb20,_0x359252,util[_0xd96d('0xa')](_0x631e54,{'showHidden':![],'depth':null}));delete _0x631e54[_0xd96d('0xb')];_0x1a5a8f['status'](_0x359252)['send'](_0x631e54);};}exports[_0xd96d('0xc')]=function(_0x541ad0,_0x563e13){return info['getAllData']()['then'](function(_0x4395b2){return _0x563e13[_0xd96d('0xd')](0xc8)[_0xd96d('0xe')](_0x4395b2);})[_0xd96d('0xf')](function(_0xd380ea){return _0x563e13[_0xd96d('0xd')](0x1f4)[_0xd96d('0xe')](_0xd380ea);});};exports[_0xd96d('0x10')]=function(_0x3160c1,_0x1e2ab0){var _0x54e819=[_0xd96d('0x11')];return new BPromise(function(_0x49e5f8,_0x442685){return exec(util['format'](_0xd96d('0x12'),_0x3160c1['params']['pid']),function(_0xed0c54,_0x434c33,_0x5384cb){if(_0xed0c54){return _0x442685(_0xed0c54);}return _0x49e5f8(_0x434c33);});})[_0xd96d('0x13')](function(_0x402a9c){var _0x5e21e6=![];var _0x1df6b5=_0x402a9c[_0xd96d('0x14')](/\n/);for(var _0x2fecdc=0x0,_0x4e086=_0x54e819['length'];_0x2fecdc<_0x4e086,_0x5e21e6===![];_0x2fecdc+=0x1){if(_0x402a9c['indexOf'](_0x54e819[_0x2fecdc])>=0x0){_0x5e21e6=!![];}}if(!_0x5e21e6){throw new Error(util[_0xd96d('0x15')](_0xd96d('0x16'),_0x3160c1[_0xd96d('0x17')][_0xd96d('0x18')]));}process[_0xd96d('0x19')](_0x3160c1[_0xd96d('0x17')][_0xd96d('0x18')],'SIGINT');return _0x1e2ab0[_0xd96d('0xd')](0xc8)[_0xd96d('0xe')]({'message':util['format'](_0xd96d('0x1a'),_0x3160c1[_0xd96d('0x17')][_0xd96d('0x18')])});})[_0xd96d('0xf')](handleError(_0x1e2ab0,null,'killProcess'));}; \ No newline at end of file +var _0xe9e4=['util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','child_process','exec','../../config/logger','api'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0xe9e4,0x1e2));var _0x4e9e=function(_0x106a43,_0x5823a5){_0x106a43=_0x106a43-0x0;var _0x2b211e=_0xe9e4[_0x106a43];return _0x2b211e;};'use strict';var info=require('systeminformation');var exec=require(_0x4e9e('0x0'))[_0x4e9e('0x1')];var logger=require(_0x4e9e('0x2'))(_0x4e9e('0x3'));var util=require(_0x4e9e('0x4'));var BPromise=require('bluebird');var _=require(_0x4e9e('0x5'));function handleError(_0x4b041e,_0x2b2237,_0x15fb23){_0x2b2237=_0x2b2237||0x1f4;return function(_0x15f0ba){logger[_0x4e9e('0x6')](_0x4e9e('0x7'),_0x15fb23,_0x2b2237,util[_0x4e9e('0x8')](_0x15f0ba,{'showHidden':![],'depth':null}));delete _0x15f0ba[_0x4e9e('0x9')];_0x4b041e[_0x4e9e('0xa')](_0x2b2237)[_0x4e9e('0xb')](_0x15f0ba);};}exports[_0x4e9e('0xc')]=function(_0x540861,_0x635ce4){return info['getAllData']()[_0x4e9e('0xd')](function(_0x3c6c5b){return _0x635ce4['status'](0xc8)[_0x4e9e('0xe')](_0x3c6c5b);})[_0x4e9e('0xf')](function(_0x341a40){return _0x635ce4['status'](0x1f4)['json'](_0x341a40);});};exports[_0x4e9e('0x10')]=function(_0x82b9b4,_0x425b39){var _0x188849=[_0x4e9e('0x11')];return new BPromise(function(_0x18ba56,_0x5995b4){return exec(util[_0x4e9e('0x12')](_0x4e9e('0x13'),_0x82b9b4['params'][_0x4e9e('0x14')]),function(_0x186c18,_0x2cfe01,_0x2cae41){if(_0x186c18){return _0x5995b4(_0x186c18);}return _0x18ba56(_0x2cfe01);});})[_0x4e9e('0xd')](function(_0x3732ce){var _0x51bd26=![];var _0x1c68b1=_0x3732ce[_0x4e9e('0x15')](/\n/);for(var _0xe5102e=0x0,_0x1275a6=_0x188849[_0x4e9e('0x16')];_0xe5102e<_0x1275a6,_0x51bd26===![];_0xe5102e+=0x1){if(_0x3732ce[_0x4e9e('0x17')](_0x188849[_0xe5102e])>=0x0){_0x51bd26=!![];}}if(!_0x51bd26){throw new Error(util[_0x4e9e('0x12')](_0x4e9e('0x18'),_0x82b9b4[_0x4e9e('0x19')][_0x4e9e('0x14')]));}process[_0x4e9e('0x1a')](_0x82b9b4[_0x4e9e('0x19')][_0x4e9e('0x14')],'SIGINT');return _0x425b39[_0x4e9e('0xa')](0xc8)[_0x4e9e('0xe')]({'message':util[_0x4e9e('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x82b9b4[_0x4e9e('0x19')][_0x4e9e('0x14')])});})[_0x4e9e('0xf')](handleError(_0x425b39,null,_0x4e9e('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 98fb246..eb2d85a 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 _0x6f0d=['delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','post','put','update'];(function(_0x3cf445,_0x2de8d2){var _0x3ddef5=function(_0x3ec942){while(--_0x3ec942){_0x3cf445['push'](_0x3cf445['shift']());}};_0x3ddef5(++_0x2de8d2);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x32bbf2,_0x73f155){_0x32bbf2=_0x32bbf2-0x0;var _0x9277db=_0x6f0d[_0x32bbf2];return _0x9277db;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var auth=require(_0xd6f0('0x4'));var interaction=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var controller=require(_0xd6f0('0x7'));router[_0xd6f0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6f0('0x9')]);router['get'](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd6f0('0xe')](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xf')]);router[_0xd6f0('0x10')]('/:id',auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x11')]);module[_0xd6f0('0x12')]=router; \ No newline at end of file +var _0x54ef=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','/:id'];(function(_0x1bced0,_0x57973c){var _0x20f37d=function(_0xf0030a){while(--_0xf0030a){_0x1bced0['push'](_0x1bced0['shift']());}};_0x20f37d(++_0x57973c);}(_0x54ef,0x112));var _0xf54e=function(_0x2811e3,_0x210f51){_0x2811e3=_0x2811e3-0x0;var _0x4c40e6=_0x54ef[_0x2811e3];return _0x4c40e6;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var auth=require(_0xf54e('0x5'));var interaction=require(_0xf54e('0x6'));var config=require(_0xf54e('0x7'));var controller=require(_0xf54e('0x8'));router[_0xf54e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf54e('0x9')](_0xf54e('0xa'),auth[_0xf54e('0xb')](),controller['show']);router[_0xf54e('0xc')]('/',auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router[_0xf54e('0xe')]('/:id',auth[_0xf54e('0xb')](),controller[_0xf54e('0xf')]);router[_0xf54e('0x10')](_0xf54e('0xa'),auth['isAuthenticated'](),controller[_0xf54e('0x11')]);module[_0xf54e('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 21e9bea..f10aef0 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 _0xdd4f=['sequelize','STRING','#0091EA'];(function(_0x5745e6,_0x5e54fc){var _0x199886=function(_0x311dfc){while(--_0x311dfc){_0x5745e6['push'](_0x5745e6['shift']());}};_0x199886(++_0x5e54fc);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xba6b11,_0x419838){_0xba6b11=_0xba6b11-0x0;var _0x42b69d=_0xdd4f[_0xba6b11];return _0x42b69d;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xfdd4('0x1')],'defaultValue':_0xfdd4('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 05ba1b5..7c10be2 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 _0xe2f3=['get','Tags','UserProfileResource','error','stack','name','send','map','Tag','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','json','apply','update','destroy','then'];(function(_0x3e5325,_0x55af33){var _0x5a1c63=function(_0x545694){while(--_0x545694){_0x3e5325['push'](_0x3e5325['shift']());}};_0x5a1c63(++_0x55af33);}(_0xe2f3,0x1c2));var _0x3e2f=function(_0x97d4b6,_0x1b8eab){_0x97d4b6=_0x97d4b6-0x0;var _0x364238=_0xe2f3[_0x97d4b6];return _0x364238;};'use strict';var pdf=require(_0x3e2f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3e2f('0x1'));var zipdir=require(_0x3e2f('0x2'));var jsonpatch=require(_0x3e2f('0x3'));var rp=require('request-promise');var moment=require(_0x3e2f('0x4'));var BPromise=require(_0x3e2f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e2f('0x6'));var sox=require(_0x3e2f('0x7'));var csv=require(_0x3e2f('0x8'));var ejs=require(_0x3e2f('0x9'));var fs=require('fs');var _=require(_0x3e2f('0xa'));var squel=require(_0x3e2f('0xb'));var crypto=require(_0x3e2f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3e2f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3e2f('0xe'));var Papa=require(_0x3e2f('0xf'));var Redis=require(_0x3e2f('0x10'));var authService=require(_0x3e2f('0x11'));var qs=require(_0x3e2f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e2f('0x13'));var logger=require(_0x3e2f('0x14'))(_0x3e2f('0x15'));var utils=require(_0x3e2f('0x16'));var config=require(_0x3e2f('0x17'));var db=require(_0x3e2f('0x18'))['db'];function respondWithStatusCode(_0x252df3,_0x2eff51){_0x2eff51=_0x2eff51||0xcc;return function(_0x19b1ef){if(_0x19b1ef){return _0x252df3[_0x3e2f('0x19')](_0x2eff51);}return _0x252df3['status'](_0x2eff51)[_0x3e2f('0x1a')]();};}function respondWithResult(_0x261f9b,_0x27bfbd){_0x27bfbd=_0x27bfbd||0xc8;return function(_0x1b216b){if(_0x1b216b){return _0x261f9b[_0x3e2f('0x1b')](_0x27bfbd)['json'](_0x1b216b);}};}function respondWithFilteredResult(_0x3b34f0,_0x27e54f){return function(_0x4c68ea){if(_0x4c68ea){var _0x2a6cdd=_0x4c68ea[_0x3e2f('0x1c')],_0x5c544a=_0x27e54f[_0x3e2f('0x1d')],_0xdee0be=_0x27e54f[_0x3e2f('0x1d')]+_0x27e54f['limit'],_0x8ed5e5;if(_0xdee0be>=_0x2a6cdd){_0xdee0be=_0x2a6cdd;_0x8ed5e5=0xc8;}else{_0x8ed5e5=0xce;}_0x3b34f0[_0x3e2f('0x1b')](_0x8ed5e5);return _0x3b34f0['set'](_0x3e2f('0x1e'),_0x5c544a+'-'+_0xdee0be+'/'+_0x2a6cdd)[_0x3e2f('0x1f')](_0x4c68ea);}return null;};}function patchUpdates(_0x26fb3e){return function(_0x7b7a2){try{jsonpatch[_0x3e2f('0x20')](_0x7b7a2,_0x26fb3e,!![]);}catch(_0x398601){return BPromise['reject'](_0x398601);}return _0x7b7a2['save']();};}function saveUpdates(_0x3a5519,_0xc9eed8){return function(_0x42bf2f){if(_0x42bf2f){return _0x42bf2f[_0x3e2f('0x21')](_0x3a5519)['then'](function(_0x3edefd){return _0x3edefd;});}return null;};}function removeEntity(_0x2ffd8a,_0x1c4fc5){return function(_0x4a2cdf){if(_0x4a2cdf){return _0x4a2cdf[_0x3e2f('0x22')]()[_0x3e2f('0x23')](function(){var _0x2e6af9=_0x4a2cdf[_0x3e2f('0x24')]({'plain':!![]});var _0x38de4b=_0x3e2f('0x25');return db[_0x3e2f('0x26')][_0x3e2f('0x22')]({'where':{'type':_0x38de4b,'resourceId':_0x2e6af9['id']}})[_0x3e2f('0x23')](function(){return _0x4a2cdf;});})['then'](function(){_0x2ffd8a[_0x3e2f('0x1b')](0xcc)[_0x3e2f('0x1a')]();});}};}function handleEntityNotFound(_0x586fd6,_0x5d2139){return function(_0x1242bd){if(!_0x1242bd){_0x586fd6[_0x3e2f('0x19')](0x194);}return _0x1242bd;};}function handleError(_0x28ed0b,_0x19f924){_0x19f924=_0x19f924||0x1f4;return function(_0x395211){logger[_0x3e2f('0x27')](_0x395211[_0x3e2f('0x28')]);if(_0x395211['name']){delete _0x395211[_0x3e2f('0x29')];}_0x28ed0b[_0x3e2f('0x1b')](_0x19f924)[_0x3e2f('0x2a')](_0x395211);};}exports['index']=function(_0xf5f6c7,_0x652159){var _0x142db9={},_0x342554={},_0x704996={'count':0x0,'rows':[]};var _0x182e44=_[_0x3e2f('0x2b')](db[_0x3e2f('0x2c')]['rawAttributes'],function(_0x2ae8e2){return{'name':_0x2ae8e2['fieldName'],'type':_0x2ae8e2[_0x3e2f('0x2d')][_0x3e2f('0x2e')]};});_0x342554[_0x3e2f('0x2f')]=_[_0x3e2f('0x2b')](_0x182e44,_0x3e2f('0x29'));_0x342554[_0x3e2f('0x30')]=_[_0x3e2f('0x31')](_0xf5f6c7[_0x3e2f('0x30')]);_0x342554[_0x3e2f('0x32')]=_['intersection'](_0x342554[_0x3e2f('0x2f')],_0x342554[_0x3e2f('0x30')]);_0x142db9[_0x3e2f('0x33')]=_[_0x3e2f('0x34')](_0x342554['model'],qs[_0x3e2f('0x35')](_0xf5f6c7[_0x3e2f('0x30')][_0x3e2f('0x35')]));_0x142db9['attributes']=_0x142db9[_0x3e2f('0x33')]['length']?_0x142db9[_0x3e2f('0x33')]:_0x342554[_0x3e2f('0x2f')];if(!_0xf5f6c7[_0x3e2f('0x30')][_0x3e2f('0x36')](_0x3e2f('0x37'))){_0x142db9['limit']=qs[_0x3e2f('0x38')](_0xf5f6c7['query'][_0x3e2f('0x38')]);_0x142db9['offset']=qs[_0x3e2f('0x1d')](_0xf5f6c7[_0x3e2f('0x30')]['offset']);}_0x142db9[_0x3e2f('0x39')]=qs[_0x3e2f('0x3a')](_0xf5f6c7[_0x3e2f('0x30')][_0x3e2f('0x3a')]);_0x142db9[_0x3e2f('0x3b')]=qs[_0x3e2f('0x32')](_[_0x3e2f('0x3c')](_0xf5f6c7['query'],_0x342554[_0x3e2f('0x32')]),_0x182e44);if(_0xf5f6c7[_0x3e2f('0x30')][_0x3e2f('0x3d')]){_0x142db9[_0x3e2f('0x3b')]=_[_0x3e2f('0x3e')](_0x142db9[_0x3e2f('0x3b')],{'$or':_[_0x3e2f('0x2b')](_0x182e44,function(_0x52e2da){if(_0x52e2da[_0x3e2f('0x2d')]!==_0x3e2f('0x3f')){var _0x30a603={};_0x30a603[_0x52e2da['name']]={'$like':'%'+_0xf5f6c7['query']['filter']+'%'};return _0x30a603;}})});}_0x142db9=_[_0x3e2f('0x3e')]({},_0x142db9,_0xf5f6c7[_0x3e2f('0x40')]);var _0x58bd74={'where':_0x142db9['where']};return db['Tag'][_0x3e2f('0x1c')](_0x58bd74)['then'](function(_0x428964){_0x704996[_0x3e2f('0x1c')]=_0x428964;if(_0xf5f6c7[_0x3e2f('0x30')][_0x3e2f('0x41')]){_0x142db9[_0x3e2f('0x42')]=[{'all':!![]}];}return db[_0x3e2f('0x2c')][_0x3e2f('0x43')](_0x142db9);})[_0x3e2f('0x23')](function(_0x57850a){_0x704996[_0x3e2f('0x44')]=_0x57850a;return _0x704996;})[_0x3e2f('0x23')](respondWithFilteredResult(_0x652159,_0x142db9))['catch'](handleError(_0x652159,null));};exports[_0x3e2f('0x45')]=function(_0x12a23e,_0x1cb7e5){var _0x5e1452={'raw':!![],'where':{'id':_0x12a23e[_0x3e2f('0x46')]['id']}},_0xf9012b={};_0xf9012b['model']=_[_0x3e2f('0x31')](db[_0x3e2f('0x2c')]['rawAttributes']);_0xf9012b['query']=_[_0x3e2f('0x31')](_0x12a23e[_0x3e2f('0x30')]);_0xf9012b[_0x3e2f('0x32')]=_['intersection'](_0xf9012b[_0x3e2f('0x2f')],_0xf9012b[_0x3e2f('0x30')]);_0x5e1452[_0x3e2f('0x33')]=_[_0x3e2f('0x34')](_0xf9012b['model'],qs[_0x3e2f('0x35')](_0x12a23e[_0x3e2f('0x30')][_0x3e2f('0x35')]));_0x5e1452['attributes']=_0x5e1452[_0x3e2f('0x33')][_0x3e2f('0x47')]?_0x5e1452[_0x3e2f('0x33')]:_0xf9012b['model'];if(_0x12a23e[_0x3e2f('0x30')][_0x3e2f('0x41')]){_0x5e1452[_0x3e2f('0x42')]=[{'all':!![]}];}_0x5e1452=_[_0x3e2f('0x3e')]({},_0x5e1452,_0x12a23e[_0x3e2f('0x40')]);return db[_0x3e2f('0x2c')][_0x3e2f('0x48')](_0x5e1452)[_0x3e2f('0x23')](handleEntityNotFound(_0x1cb7e5,null))[_0x3e2f('0x23')](respondWithResult(_0x1cb7e5,null))[_0x3e2f('0x49')](handleError(_0x1cb7e5,null));};exports[_0x3e2f('0x4a')]=function(_0x2c3175,_0x42bdbc){return db[_0x3e2f('0x2c')]['create'](_0x2c3175['body'],{})['then'](function(_0x46f9a2){var _0x42c9f7=_0x2c3175[_0x3e2f('0x4b')][_0x3e2f('0x24')]({'plain':!![]});if(!_0x42c9f7)throw new Error(_0x3e2f('0x4c'));if(_0x42c9f7[_0x3e2f('0x4d')]==='user'){var _0x29aa97=_0x46f9a2[_0x3e2f('0x24')]({'plain':!![]});var _0x5e3cdf=_0x3e2f('0x25');return db[_0x3e2f('0x4e')][_0x3e2f('0x48')]({'where':{'name':_0x5e3cdf,'userProfileId':_0x42c9f7[_0x3e2f('0x4f')]},'raw':!![]})[_0x3e2f('0x23')](function(_0x57438f){if(_0x57438f&&_0x57438f['autoAssociation']===0x0){return db['UserProfileResource'][_0x3e2f('0x4a')]({'name':_0x29aa97[_0x3e2f('0x29')],'resourceId':_0x29aa97['id'],'type':_0x57438f[_0x3e2f('0x29')],'sectionId':_0x57438f['id']},{})[_0x3e2f('0x23')](function(){return _0x46f9a2;});}else{return _0x46f9a2;}})['catch'](function(_0x40f23b){logger[_0x3e2f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40f23b);throw _0x40f23b;});}return _0x46f9a2;})[_0x3e2f('0x23')](respondWithResult(_0x42bdbc,0xc9))[_0x3e2f('0x49')](handleError(_0x42bdbc,null));};exports[_0x3e2f('0x21')]=function(_0x3af376,_0x219e4d){if(_0x3af376[_0x3e2f('0x50')]['id']){delete _0x3af376[_0x3e2f('0x50')]['id'];}return db[_0x3e2f('0x2c')]['find']({'where':{'id':_0x3af376[_0x3e2f('0x46')]['id']}})['then'](handleEntityNotFound(_0x219e4d,null))[_0x3e2f('0x23')](saveUpdates(_0x3af376[_0x3e2f('0x50')],null))[_0x3e2f('0x23')](respondWithResult(_0x219e4d,null))[_0x3e2f('0x49')](handleError(_0x219e4d,null));};exports[_0x3e2f('0x22')]=function(_0x815ca5,_0x1997ec){return db[_0x3e2f('0x2c')][_0x3e2f('0x48')]({'where':{'id':_0x815ca5[_0x3e2f('0x46')]['id']}})[_0x3e2f('0x23')](handleEntityNotFound(_0x1997ec,null))[_0x3e2f('0x23')](removeEntity(_0x1997ec,null))[_0x3e2f('0x49')](handleError(_0x1997ec,null));}; \ No newline at end of file +var _0x985d=['UserProfileResource','then','sendStatus','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','get','Tags'];(function(_0x189393,_0xa27223){var _0x3c6661=function(_0xacf6dd){while(--_0xacf6dd){_0x189393['push'](_0x189393['shift']());}};_0x3c6661(++_0xa27223);}(_0x985d,0x1c1));var _0xd985=function(_0x114fd0,_0x3c2caf){_0x114fd0=_0x114fd0-0x0;var _0x1f660d=_0x985d[_0x114fd0];return _0x1f660d;};'use strict';var pdf=require(_0xd985('0x0'));var emlformat=require(_0xd985('0x1'));var rimraf=require(_0xd985('0x2'));var zipdir=require(_0xd985('0x3'));var jsonpatch=require(_0xd985('0x4'));var rp=require(_0xd985('0x5'));var moment=require(_0xd985('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd985('0x7'));var path=require(_0xd985('0x8'));var sox=require('sox');var csv=require(_0xd985('0x9'));var ejs=require(_0xd985('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd985('0xb'));var crypto=require(_0xd985('0xc'));var jsforce=require(_0xd985('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd985('0xe'));var Redis=require(_0xd985('0xf'));var authService=require(_0xd985('0x10'));var qs=require(_0xd985('0x11'));var as=require(_0xd985('0x12'));var hardwareService=require(_0xd985('0x13'));var logger=require('../../config/logger')(_0xd985('0x14'));var utils=require('../../config/utils');var config=require(_0xd985('0x15'));var db=require(_0xd985('0x16'))['db'];function respondWithStatusCode(_0x380dac,_0x8e8959){_0x8e8959=_0x8e8959||0xcc;return function(_0x1a916a){if(_0x1a916a){return _0x380dac['sendStatus'](_0x8e8959);}return _0x380dac[_0xd985('0x17')](_0x8e8959)[_0xd985('0x18')]();};}function respondWithResult(_0xf30a8f,_0x32fbbe){_0x32fbbe=_0x32fbbe||0xc8;return function(_0x2941f1){if(_0x2941f1){return _0xf30a8f[_0xd985('0x17')](_0x32fbbe)['json'](_0x2941f1);}};}function respondWithFilteredResult(_0x3eed1c,_0x1670ff){return function(_0x423e74){if(_0x423e74){var _0x5ef3d3=_0x423e74[_0xd985('0x19')],_0x44fffd=_0x1670ff[_0xd985('0x1a')],_0x52f082=_0x1670ff['offset']+_0x1670ff[_0xd985('0x1b')],_0x414466;if(_0x52f082>=_0x5ef3d3){_0x52f082=_0x5ef3d3;_0x414466=0xc8;}else{_0x414466=0xce;}_0x3eed1c['status'](_0x414466);return _0x3eed1c['set'](_0xd985('0x1c'),_0x44fffd+'-'+_0x52f082+'/'+_0x5ef3d3)[_0xd985('0x1d')](_0x423e74);}return null;};}function patchUpdates(_0x49fbd1){return function(_0x32583a){try{jsonpatch[_0xd985('0x1e')](_0x32583a,_0x49fbd1,!![]);}catch(_0x4e573c){return BPromise[_0xd985('0x1f')](_0x4e573c);}return _0x32583a[_0xd985('0x20')]();};}function saveUpdates(_0x55b7f2,_0x2bc51d){return function(_0x59f4e7){if(_0x59f4e7){return _0x59f4e7[_0xd985('0x21')](_0x55b7f2)['then'](function(_0x45798){return _0x45798;});}return null;};}function removeEntity(_0x93fd94,_0x21b6fb){return function(_0x361813){if(_0x361813){return _0x361813[_0xd985('0x22')]()['then'](function(){var _0x8f590e=_0x361813[_0xd985('0x23')]({'plain':!![]});var _0x3aa129=_0xd985('0x24');return db[_0xd985('0x25')]['destroy']({'where':{'type':_0x3aa129,'resourceId':_0x8f590e['id']}})[_0xd985('0x26')](function(){return _0x361813;});})['then'](function(){_0x93fd94[_0xd985('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e90e,_0x29dfd6){return function(_0x4072cf){if(!_0x4072cf){_0x44e90e[_0xd985('0x27')](0x194);}return _0x4072cf;};}function handleError(_0x12b20d,_0x63c84c){_0x63c84c=_0x63c84c||0x1f4;return function(_0x4fdd2e){logger[_0xd985('0x28')](_0x4fdd2e[_0xd985('0x29')]);if(_0x4fdd2e[_0xd985('0x2a')]){delete _0x4fdd2e[_0xd985('0x2a')];}_0x12b20d[_0xd985('0x17')](_0x63c84c)['send'](_0x4fdd2e);};}exports[_0xd985('0x2b')]=function(_0x3b9faf,_0x352eee){var _0x441519={},_0x846f2e={},_0x3720b7={'count':0x0,'rows':[]};var _0x18e200=_[_0xd985('0x2c')](db[_0xd985('0x2d')][_0xd985('0x2e')],function(_0x2c0e32){return{'name':_0x2c0e32[_0xd985('0x2f')],'type':_0x2c0e32[_0xd985('0x30')][_0xd985('0x31')]};});_0x846f2e['model']=_[_0xd985('0x2c')](_0x18e200,_0xd985('0x2a'));_0x846f2e[_0xd985('0x32')]=_['keys'](_0x3b9faf['query']);_0x846f2e[_0xd985('0x33')]=_[_0xd985('0x34')](_0x846f2e[_0xd985('0x35')],_0x846f2e['query']);_0x441519['attributes']=_['intersection'](_0x846f2e[_0xd985('0x35')],qs[_0xd985('0x36')](_0x3b9faf[_0xd985('0x32')][_0xd985('0x36')]));_0x441519[_0xd985('0x37')]=_0x441519['attributes'][_0xd985('0x38')]?_0x441519[_0xd985('0x37')]:_0x846f2e[_0xd985('0x35')];if(!_0x3b9faf['query'][_0xd985('0x39')](_0xd985('0x3a'))){_0x441519['limit']=qs[_0xd985('0x1b')](_0x3b9faf['query'][_0xd985('0x1b')]);_0x441519[_0xd985('0x1a')]=qs[_0xd985('0x1a')](_0x3b9faf[_0xd985('0x32')][_0xd985('0x1a')]);}_0x441519['order']=qs[_0xd985('0x3b')](_0x3b9faf['query'][_0xd985('0x3b')]);_0x441519[_0xd985('0x3c')]=qs['filters'](_[_0xd985('0x3d')](_0x3b9faf[_0xd985('0x32')],_0x846f2e['filters']),_0x18e200);if(_0x3b9faf[_0xd985('0x32')]['filter']){_0x441519[_0xd985('0x3c')]=_[_0xd985('0x3e')](_0x441519[_0xd985('0x3c')],{'$or':_[_0xd985('0x2c')](_0x18e200,function(_0x588852){if(_0x588852[_0xd985('0x30')]!==_0xd985('0x3f')){var _0x1c718f={};_0x1c718f[_0x588852[_0xd985('0x2a')]]={'$like':'%'+_0x3b9faf[_0xd985('0x32')][_0xd985('0x40')]+'%'};return _0x1c718f;}})});}_0x441519=_[_0xd985('0x3e')]({},_0x441519,_0x3b9faf[_0xd985('0x41')]);var _0x117f04={'where':_0x441519[_0xd985('0x3c')]};return db[_0xd985('0x2d')][_0xd985('0x19')](_0x117f04)['then'](function(_0xe8f3a5){_0x3720b7[_0xd985('0x19')]=_0xe8f3a5;if(_0x3b9faf[_0xd985('0x32')][_0xd985('0x42')]){_0x441519[_0xd985('0x43')]=[{'all':!![]}];}return db[_0xd985('0x2d')][_0xd985('0x44')](_0x441519);})['then'](function(_0x321b03){_0x3720b7['rows']=_0x321b03;return _0x3720b7;})[_0xd985('0x26')](respondWithFilteredResult(_0x352eee,_0x441519))['catch'](handleError(_0x352eee,null));};exports[_0xd985('0x45')]=function(_0x3b6be4,_0x1ccd8d){var _0x7b7c22={'raw':!![],'where':{'id':_0x3b6be4[_0xd985('0x46')]['id']}},_0x3f5216={};_0x3f5216[_0xd985('0x35')]=_[_0xd985('0x47')](db[_0xd985('0x2d')][_0xd985('0x2e')]);_0x3f5216[_0xd985('0x32')]=_[_0xd985('0x47')](_0x3b6be4[_0xd985('0x32')]);_0x3f5216[_0xd985('0x33')]=_['intersection'](_0x3f5216[_0xd985('0x35')],_0x3f5216[_0xd985('0x32')]);_0x7b7c22[_0xd985('0x37')]=_[_0xd985('0x34')](_0x3f5216['model'],qs['fields'](_0x3b6be4[_0xd985('0x32')][_0xd985('0x36')]));_0x7b7c22['attributes']=_0x7b7c22[_0xd985('0x37')][_0xd985('0x38')]?_0x7b7c22[_0xd985('0x37')]:_0x3f5216[_0xd985('0x35')];if(_0x3b6be4[_0xd985('0x32')][_0xd985('0x42')]){_0x7b7c22[_0xd985('0x43')]=[{'all':!![]}];}_0x7b7c22=_[_0xd985('0x3e')]({},_0x7b7c22,_0x3b6be4['options']);return db[_0xd985('0x2d')][_0xd985('0x48')](_0x7b7c22)[_0xd985('0x26')](handleEntityNotFound(_0x1ccd8d,null))['then'](respondWithResult(_0x1ccd8d,null))[_0xd985('0x49')](handleError(_0x1ccd8d,null));};exports[_0xd985('0x4a')]=function(_0x1704c9,_0x3ad411){return db[_0xd985('0x2d')]['create'](_0x1704c9[_0xd985('0x4b')],{})[_0xd985('0x26')](function(_0x49350b){var _0x34f797=_0x1704c9['user'][_0xd985('0x23')]({'plain':!![]});if(!_0x34f797)throw new Error(_0xd985('0x4c'));if(_0x34f797[_0xd985('0x4d')]==='user'){var _0x4520a2=_0x49350b['get']({'plain':!![]});var _0x1176b5=_0xd985('0x24');return db[_0xd985('0x4e')][_0xd985('0x48')]({'where':{'name':_0x1176b5,'userProfileId':_0x34f797[_0xd985('0x4f')]},'raw':!![]})[_0xd985('0x26')](function(_0x2b3036){if(_0x2b3036&&_0x2b3036['autoAssociation']===0x0){return db[_0xd985('0x25')]['create']({'name':_0x4520a2[_0xd985('0x2a')],'resourceId':_0x4520a2['id'],'type':_0x2b3036[_0xd985('0x2a')],'sectionId':_0x2b3036['id']},{})[_0xd985('0x26')](function(){return _0x49350b;});}else{return _0x49350b;}})[_0xd985('0x49')](function(_0x38e703){logger[_0xd985('0x28')](_0xd985('0x50'),_0x38e703);throw _0x38e703;});}return _0x49350b;})[_0xd985('0x26')](respondWithResult(_0x3ad411,0xc9))[_0xd985('0x49')](handleError(_0x3ad411,null));};exports[_0xd985('0x21')]=function(_0x1187f4,_0x5757d6){if(_0x1187f4['body']['id']){delete _0x1187f4[_0xd985('0x4b')]['id'];}return db[_0xd985('0x2d')]['find']({'where':{'id':_0x1187f4[_0xd985('0x46')]['id']}})['then'](handleEntityNotFound(_0x5757d6,null))[_0xd985('0x26')](saveUpdates(_0x1187f4[_0xd985('0x4b')],null))['then'](respondWithResult(_0x5757d6,null))['catch'](handleError(_0x5757d6,null));};exports[_0xd985('0x22')]=function(_0xe066e0,_0x4e41d5){return db['Tag'][_0xd985('0x48')]({'where':{'id':_0xe066e0[_0xd985('0x46')]['id']}})[_0xd985('0x26')](handleEntityNotFound(_0x4e41d5,null))[_0xd985('0x26')](removeEntity(_0x4e41d5,null))[_0xd985('0x49')](handleError(_0x4e41d5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 68869ee..550d547 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 _0x3b71=['moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','../../config/logger','api'];(function(_0x57506a,_0x3ff153){var _0xac0866=function(_0x2ecc02){while(--_0x2ecc02){_0x57506a['push'](_0x57506a['shift']());}};_0xac0866(++_0x3ff153);}(_0x3b71,0x1ea));var _0x13b7=function(_0x4751f9,_0x1b572b){_0x4751f9=_0x4751f9-0x0;var _0x5ba16b=_0x3b71[_0x4751f9];return _0x5ba16b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13b7('0x0'))(_0x13b7('0x1'));var moment=require(_0x13b7('0x2'));var BPromise=require('bluebird');var rp=require(_0x13b7('0x3'));var fs=require('fs');var path=require(_0x13b7('0x4'));var rimraf=require(_0x13b7('0x5'));var config=require(_0x13b7('0x6'));var attributes=require(_0x13b7('0x7'));module[_0x13b7('0x8')]=function(_0x55df74,_0x434b77){return _0x55df74[_0x13b7('0x9')](_0x13b7('0xa'),attributes,{'tableName':_0x13b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51df=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash'];(function(_0x2e7845,_0x4adc29){var _0x18b4ab=function(_0x5d47dd){while(--_0x5d47dd){_0x2e7845['push'](_0x2e7845['shift']());}};_0x18b4ab(++_0x4adc29);}(_0x51df,0xcb));var _0xf51d=function(_0xfb9be1,_0x18c3ef){_0xfb9be1=_0xfb9be1-0x0;var _0x174de0=_0x51df[_0xfb9be1];return _0x174de0;};'use strict';var _=require(_0xf51d('0x0'));var util=require('util');var logger=require(_0xf51d('0x1'))(_0xf51d('0x2'));var moment=require('moment');var BPromise=require(_0xf51d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf51d('0x4'));var rimraf=require(_0xf51d('0x5'));var config=require(_0xf51d('0x6'));var attributes=require(_0xf51d('0x7'));module[_0xf51d('0x8')]=function(_0x110592,_0x389adb){return _0x110592[_0xf51d('0x9')](_0xf51d('0xa'),attributes,{'tableName':_0xf51d('0xb'),'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 578bfd0..5f198d6 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 _0xf4eb=['Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x256851,_0x50f1a3){var _0x1db300=function(_0x322d11){while(--_0x322d11){_0x256851['push'](_0x256851['shift']());}};_0x1db300(++_0x50f1a3);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3cfaa2,_0xd3814d){_0x3cfaa2=_0x3cfaa2-0x0;var _0x241ffb=_0xf4eb[_0x3cfaa2];return _0x241ffb;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('Tag,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0x4ded=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','Tag,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x4ded,0x116));var _0xd4de=function(_0x26a291,_0x57666c){_0x26a291=_0x26a291-0x0;var _0x26d352=_0x4ded[_0x26a291];return _0x26d352;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2433b8,_0x15eb91,_0x2c56d5){return new BPromise(function(_0x4453c2,_0x1e8c35){return client['request'](_0x2433b8,_0x2c56d5)[_0xd4de('0xd')](function(_0x5ebcf3){logger['info']('Tag,\x20%s,\x20%s',_0x15eb91,_0xd4de('0xe'));logger[_0xd4de('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x15eb91,'request\x20sent',JSON['stringify'](_0x5ebcf3));if(_0x5ebcf3[_0xd4de('0x10')]){if(_0x5ebcf3['error'][_0xd4de('0x11')]===0x1f4){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x1e8c35(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x4453c2(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}else{logger[_0xd4de('0x14')](_0xd4de('0x12'),_0x15eb91,_0xd4de('0xe'));_0x4453c2(_0x5ebcf3[_0xd4de('0x15')]['message']);}})['catch'](function(_0x3df820){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x3df820);_0x1e8c35(_0x3df820);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 7484f2f..4fed5eb 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 _0xcd61=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','/:id','isAuthenticated','show','/:id/queues','getQueues','/:id/users','post','addQueues','update','delete','destroy','removeQueues','removeAgents','exports'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0xcd61,0x198));var _0x1cd6=function(_0x2cf199,_0x464d56){_0x2cf199=_0x2cf199-0x0;var _0x3fdf8d=_0xcd61[_0x2cf199];return _0x3fdf8d;};'use strict';var multer=require(_0x1cd6('0x0'));var util=require(_0x1cd6('0x1'));var path=require(_0x1cd6('0x2'));var timeout=require(_0x1cd6('0x3'));var express=require(_0x1cd6('0x4'));var router=express['Router']();var auth=require(_0x1cd6('0x5'));var interaction=require(_0x1cd6('0x6'));var config=require(_0x1cd6('0x7'));var controller=require(_0x1cd6('0x8'));router[_0x1cd6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1cd6('0xa'),auth[_0x1cd6('0xb')](),controller[_0x1cd6('0xc')]);router[_0x1cd6('0x9')](_0x1cd6('0xd'),auth['isAuthenticated'](),controller[_0x1cd6('0xe')]);router[_0x1cd6('0x9')](_0x1cd6('0xf'),auth[_0x1cd6('0xb')](),controller['getAgents']);router[_0x1cd6('0x10')]('/',auth[_0x1cd6('0xb')](),controller['create']);router[_0x1cd6('0x10')]('/:id/queues',auth['isAuthenticated'](),controller[_0x1cd6('0x11')]);router[_0x1cd6('0x10')](_0x1cd6('0xf'),auth[_0x1cd6('0xb')](),controller['addAgents']);router['put'](_0x1cd6('0xa'),auth[_0x1cd6('0xb')](),controller[_0x1cd6('0x12')]);router[_0x1cd6('0x13')](_0x1cd6('0xa'),auth[_0x1cd6('0xb')](),controller[_0x1cd6('0x14')]);router[_0x1cd6('0x13')]('/:id/queues',auth[_0x1cd6('0xb')](),controller[_0x1cd6('0x15')]);router[_0x1cd6('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x1cd6('0x16')]);module[_0x1cd6('0x17')]=router; \ No newline at end of file +var _0xe7be=['/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put','delete','removeQueues','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show'];(function(_0x9a24b6,_0x15b682){var _0x274729=function(_0x13d7f4){while(--_0x13d7f4){_0x9a24b6['push'](_0x9a24b6['shift']());}};_0x274729(++_0x15b682);}(_0xe7be,0x12b));var _0xee7b=function(_0x3cdf8f,_0x5adb9c){_0x3cdf8f=_0x3cdf8f-0x0;var _0x35344f=_0xe7be[_0x3cdf8f];return _0x35344f;};'use strict';var multer=require(_0xee7b('0x0'));var util=require('util');var path=require(_0xee7b('0x1'));var timeout=require('connect-timeout');var express=require(_0xee7b('0x2'));var router=express[_0xee7b('0x3')]();var auth=require(_0xee7b('0x4'));var interaction=require(_0xee7b('0x5'));var config=require(_0xee7b('0x6'));var controller=require(_0xee7b('0x7'));router[_0xee7b('0x8')]('/',auth[_0xee7b('0x9')](),controller[_0xee7b('0xa')]);router['get'](_0xee7b('0xb'),auth[_0xee7b('0x9')](),controller[_0xee7b('0xc')]);router[_0xee7b('0x8')](_0xee7b('0xd'),auth[_0xee7b('0x9')](),controller[_0xee7b('0xe')]);router[_0xee7b('0x8')](_0xee7b('0xf'),auth[_0xee7b('0x9')](),controller[_0xee7b('0x10')]);router[_0xee7b('0x11')]('/',auth[_0xee7b('0x9')](),controller[_0xee7b('0x12')]);router[_0xee7b('0x11')](_0xee7b('0xd'),auth['isAuthenticated'](),controller[_0xee7b('0x13')]);router[_0xee7b('0x11')]('/:id/users',auth[_0xee7b('0x9')](),controller[_0xee7b('0x14')]);router[_0xee7b('0x15')](_0xee7b('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xee7b('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xee7b('0x16')]('/:id/queues',auth['isAuthenticated'](),controller[_0xee7b('0x17')]);router['delete'](_0xee7b('0xf'),auth[_0xee7b('0x9')](),controller[_0xee7b('0x18')]);module[_0xee7b('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index b0644d7..1388fce 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 _0x47ff=['name','exports','STRING'];(function(_0x5b4daa,_0xc385e4){var _0x9b569c=function(_0x76fdb6){while(--_0x76fdb6){_0x5b4daa['push'](_0x5b4daa['shift']());}};_0x9b569c(++_0xc385e4);}(_0x47ff,0xbb));var _0xf47f=function(_0x465147,_0x240ccd){_0x465147=_0x465147-0x0;var _0x5449b5=_0x47ff[_0x465147];return _0x5449b5;};'use strict';var Sequelize=require('sequelize');module[_0xf47f('0x0')]={'name':{'type':Sequelize[_0xf47f('0x1')],'allowNull':![],'unique':_0xf47f('0x2')},'description':{'type':Sequelize[_0xf47f('0x1')]}}; \ No newline at end of file +var _0xce6a=['sequelize','exports','STRING'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xce6a,0x8a));var _0xace6=function(_0x4b7fea,_0x2f8cf6){_0x4b7fea=_0x4b7fea-0x0;var _0x236120=_0xce6a[_0x4b7fea];return _0x236120;};'use strict';var Sequelize=require(_0xace6('0x0'));module[_0xace6('0x1')]={'name':{'type':Sequelize[_0xace6('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xace6('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index ccdd221..18c1827 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 _0x5d74=['query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','Team','findAll','rows','catch','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getQueues','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','order','Queues','addQueues','add','removeQueues','ValidationError','ids','addAgents','Chat','Mail','Sms','Fax','Whatsapp','Voice','User','online','voicePause','interface','UserVoiceQueueRt','isNil','format','spread','emit','userTeam:save','removeAgents','each','voice','chat','mail','sms','fax','openchannel','isArray','userTeam:remove','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','offset','limit','Content-Range','json','reject','save','then','get','UserProfileResource','destroy','end','error','name','send','index','map','rawAttributes','type','model'];(function(_0x4e2a3f,_0x4e28b7){var _0x328a5e=function(_0x1bca76){while(--_0x1bca76){_0x4e2a3f['push'](_0x4e2a3f['shift']());}};_0x328a5e(++_0x4e28b7);}(_0x5d74,0x14a));var _0x45d7=function(_0x4f7caa,_0x4b7b60){_0x4f7caa=_0x4f7caa-0x0;var _0x57671e=_0x5d74[_0x4f7caa];return _0x57671e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x45d7('0x0'));var zipdir=require(_0x45d7('0x1'));var jsonpatch=require(_0x45d7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x45d7('0x3'));var Mustache=require(_0x45d7('0x4'));var util=require(_0x45d7('0x5'));var path=require(_0x45d7('0x6'));var sox=require(_0x45d7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x45d7('0x8'));var squel=require(_0x45d7('0x9'));var crypto=require(_0x45d7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x45d7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x45d7('0xc'));var Papa=require(_0x45d7('0xd'));var Redis=require(_0x45d7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x45d7('0xf'));var as=require(_0x45d7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45d7('0x11'))(_0x45d7('0x12'));var utils=require(_0x45d7('0x13'));var config=require(_0x45d7('0x14'));var db=require(_0x45d7('0x15'))['db'];config[_0x45d7('0x16')]=_[_0x45d7('0x17')](config['redis'],{'host':_0x45d7('0x18'),'port':0x18eb});var socket=require(_0x45d7('0x19'))(new Redis(config['redis']));require(_0x45d7('0x1a'))['register'](socket);function respondWithStatusCode(_0x2ad630,_0x1ddf75){_0x1ddf75=_0x1ddf75||0xcc;return function(_0x4d0d49){if(_0x4d0d49){return _0x2ad630[_0x45d7('0x1b')](_0x1ddf75);}return _0x2ad630['status'](_0x1ddf75)['end']();};}function respondWithResult(_0x13101b,_0x1be6ef){_0x1be6ef=_0x1be6ef||0xc8;return function(_0x3e6996){if(_0x3e6996){return _0x13101b[_0x45d7('0x1c')](_0x1be6ef)['json'](_0x3e6996);}};}function respondWithFilteredResult(_0x4efb41,_0x62560a){return function(_0x25a123){if(_0x25a123){var _0xa65483=_0x25a123['count'],_0x516083=_0x62560a['offset'],_0x4e983e=_0x62560a[_0x45d7('0x1d')]+_0x62560a[_0x45d7('0x1e')],_0xe3bfa8;if(_0x4e983e>=_0xa65483){_0x4e983e=_0xa65483;_0xe3bfa8=0xc8;}else{_0xe3bfa8=0xce;}_0x4efb41[_0x45d7('0x1c')](_0xe3bfa8);return _0x4efb41['set'](_0x45d7('0x1f'),_0x516083+'-'+_0x4e983e+'/'+_0xa65483)[_0x45d7('0x20')](_0x25a123);}return null;};}function patchUpdates(_0x927b5c){return function(_0x525b8a){try{jsonpatch['apply'](_0x525b8a,_0x927b5c,!![]);}catch(_0x1cda59){return BPromise[_0x45d7('0x21')](_0x1cda59);}return _0x525b8a[_0x45d7('0x22')]();};}function saveUpdates(_0x553667,_0x17b118){return function(_0x55339d){if(_0x55339d){return _0x55339d['update'](_0x553667)[_0x45d7('0x23')](function(_0x740dba){return _0x740dba;});}return null;};}function removeEntity(_0x413a31,_0x57d3a9){return function(_0x5e8211){if(_0x5e8211){return _0x5e8211['destroy']()[_0x45d7('0x23')](function(){var _0x229507=_0x5e8211[_0x45d7('0x24')]({'plain':!![]});var _0x10d2dc='Teams';return db[_0x45d7('0x25')][_0x45d7('0x26')]({'where':{'type':_0x10d2dc,'resourceId':_0x229507['id']}})[_0x45d7('0x23')](function(){return _0x5e8211;});})[_0x45d7('0x23')](function(){_0x413a31[_0x45d7('0x1c')](0xcc)[_0x45d7('0x27')]();});}};}function handleEntityNotFound(_0x32a615,_0x4d8bd3){return function(_0x37c143){if(!_0x37c143){_0x32a615[_0x45d7('0x1b')](0x194);}return _0x37c143;};}function handleError(_0x565d2d,_0x141740){_0x141740=_0x141740||0x1f4;return function(_0x255ec6){logger[_0x45d7('0x28')](_0x255ec6['stack']);if(_0x255ec6[_0x45d7('0x29')]){delete _0x255ec6[_0x45d7('0x29')];}_0x565d2d[_0x45d7('0x1c')](_0x141740)[_0x45d7('0x2a')](_0x255ec6);};}exports[_0x45d7('0x2b')]=function(_0x31ec24,_0xc2fc7a){var _0x262caf={},_0xeea323={},_0xbbd081={'count':0x0,'rows':[]};var _0xa07b82=_[_0x45d7('0x2c')](db['Team'][_0x45d7('0x2d')],function(_0x3cc5e1){return{'name':_0x3cc5e1['fieldName'],'type':_0x3cc5e1[_0x45d7('0x2e')]['key']};});_0xeea323[_0x45d7('0x2f')]=_[_0x45d7('0x2c')](_0xa07b82,_0x45d7('0x29'));_0xeea323[_0x45d7('0x30')]=_[_0x45d7('0x31')](_0x31ec24[_0x45d7('0x30')]);_0xeea323[_0x45d7('0x32')]=_['intersection'](_0xeea323[_0x45d7('0x2f')],_0xeea323[_0x45d7('0x30')]);_0x262caf[_0x45d7('0x33')]=_[_0x45d7('0x34')](_0xeea323['model'],qs['fields'](_0x31ec24[_0x45d7('0x30')][_0x45d7('0x35')]));_0x262caf[_0x45d7('0x33')]=_0x262caf[_0x45d7('0x33')]['length']?_0x262caf[_0x45d7('0x33')]:_0xeea323[_0x45d7('0x2f')];if(!_0x31ec24[_0x45d7('0x30')][_0x45d7('0x36')]('nolimit')){_0x262caf['limit']=qs['limit'](_0x31ec24[_0x45d7('0x30')]['limit']);_0x262caf[_0x45d7('0x1d')]=qs['offset'](_0x31ec24['query'][_0x45d7('0x1d')]);}_0x262caf['order']=qs[_0x45d7('0x37')](_0x31ec24[_0x45d7('0x30')][_0x45d7('0x37')]);_0x262caf[_0x45d7('0x38')]=qs[_0x45d7('0x32')](_[_0x45d7('0x39')](_0x31ec24[_0x45d7('0x30')],_0xeea323[_0x45d7('0x32')]),_0xa07b82);if(_0x31ec24[_0x45d7('0x30')][_0x45d7('0x3a')]){_0x262caf[_0x45d7('0x38')]=_[_0x45d7('0x3b')](_0x262caf[_0x45d7('0x38')],{'$or':_['map'](_0xa07b82,function(_0x57ee00){if(_0x57ee00[_0x45d7('0x2e')]!==_0x45d7('0x3c')){var _0x107698={};_0x107698[_0x57ee00[_0x45d7('0x29')]]={'$like':'%'+_0x31ec24['query'][_0x45d7('0x3a')]+'%'};return _0x107698;}})});}_0x262caf=_['merge']({},_0x262caf,_0x31ec24[_0x45d7('0x3d')]);var _0x1ae4c5={'where':_0x262caf[_0x45d7('0x38')]};return db['Team']['count'](_0x1ae4c5)['then'](function(_0x35f75d){_0xbbd081[_0x45d7('0x3e')]=_0x35f75d;if(_0x31ec24[_0x45d7('0x30')][_0x45d7('0x3f')]){_0x262caf[_0x45d7('0x40')]=[{'all':!![]}];}return db[_0x45d7('0x41')][_0x45d7('0x42')](_0x262caf);})[_0x45d7('0x23')](function(_0x4fb6f1){_0xbbd081[_0x45d7('0x43')]=_0x4fb6f1;return _0xbbd081;})[_0x45d7('0x23')](respondWithFilteredResult(_0xc2fc7a,_0x262caf))[_0x45d7('0x44')](handleError(_0xc2fc7a,null));};exports['show']=function(_0x5446ec,_0x9f55d3){var _0x3cf8fc={'raw':![],'where':{'id':_0x5446ec['params']['id']}},_0x2193b2={};_0x2193b2[_0x45d7('0x2f')]=_[_0x45d7('0x31')](db[_0x45d7('0x41')][_0x45d7('0x2d')]);_0x2193b2['query']=_[_0x45d7('0x31')](_0x5446ec[_0x45d7('0x30')]);_0x2193b2[_0x45d7('0x32')]=_['intersection'](_0x2193b2[_0x45d7('0x2f')],_0x2193b2[_0x45d7('0x30')]);_0x3cf8fc[_0x45d7('0x33')]=_[_0x45d7('0x34')](_0x2193b2[_0x45d7('0x2f')],qs[_0x45d7('0x35')](_0x5446ec[_0x45d7('0x30')][_0x45d7('0x35')]));_0x3cf8fc[_0x45d7('0x33')]=_0x3cf8fc['attributes'][_0x45d7('0x45')]?_0x3cf8fc['attributes']:_0x2193b2[_0x45d7('0x2f')];if(_0x5446ec[_0x45d7('0x30')][_0x45d7('0x3f')]){_0x3cf8fc[_0x45d7('0x40')]=[{'all':!![]}];}_0x3cf8fc=_[_0x45d7('0x3b')]({},_0x3cf8fc,_0x5446ec[_0x45d7('0x3d')]);return db[_0x45d7('0x41')][_0x45d7('0x46')](_0x3cf8fc)[_0x45d7('0x23')](handleEntityNotFound(_0x9f55d3,null))[_0x45d7('0x23')](respondWithResult(_0x9f55d3,null))['catch'](handleError(_0x9f55d3,null));};exports[_0x45d7('0x47')]=function(_0x9e1601,_0x140e9b){return db[_0x45d7('0x41')][_0x45d7('0x47')](_0x9e1601[_0x45d7('0x48')],{})['then'](function(_0xeb96a7){var _0x5b0065=_0x9e1601[_0x45d7('0x49')][_0x45d7('0x24')]({'plain':!![]});if(!_0x5b0065)throw new Error(_0x45d7('0x4a'));if(_0x5b0065[_0x45d7('0x4b')]==='user'){var _0x4b8b9d=_0xeb96a7[_0x45d7('0x24')]({'plain':!![]});var _0x14f85c=_0x45d7('0x4c');return db[_0x45d7('0x4d')][_0x45d7('0x46')]({'where':{'name':_0x14f85c,'userProfileId':_0x5b0065[_0x45d7('0x4e')]},'raw':!![]})['then'](function(_0x539116){if(_0x539116&&_0x539116[_0x45d7('0x4f')]===0x0){return db[_0x45d7('0x25')][_0x45d7('0x47')]({'name':_0x4b8b9d[_0x45d7('0x29')],'resourceId':_0x4b8b9d['id'],'type':_0x539116[_0x45d7('0x29')],'sectionId':_0x539116['id']},{})[_0x45d7('0x23')](function(){return _0xeb96a7;});}else{return _0xeb96a7;}})[_0x45d7('0x44')](function(_0x3d0781){logger[_0x45d7('0x28')](_0x45d7('0x50'),_0x3d0781);throw _0x3d0781;});}return _0xeb96a7;})[_0x45d7('0x23')](respondWithResult(_0x140e9b,0xc9))[_0x45d7('0x44')](handleError(_0x140e9b,null));};exports[_0x45d7('0x51')]=function(_0x24aa1a,_0x5e8962){if(_0x24aa1a['body']['id']){delete _0x24aa1a[_0x45d7('0x48')]['id'];}return db[_0x45d7('0x41')][_0x45d7('0x46')]({'where':{'id':_0x24aa1a[_0x45d7('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e8962,null))['then'](saveUpdates(_0x24aa1a[_0x45d7('0x48')],null))[_0x45d7('0x23')](respondWithResult(_0x5e8962,null))[_0x45d7('0x44')](handleError(_0x5e8962,null));};exports[_0x45d7('0x26')]=function(_0x213bea,_0x46fb5e){return db['Team'][_0x45d7('0x46')]({'where':{'id':_0x213bea[_0x45d7('0x52')]['id']}})[_0x45d7('0x23')](handleEntityNotFound(_0x46fb5e,null))[_0x45d7('0x23')](removeEntity(_0x46fb5e,null))[_0x45d7('0x44')](handleError(_0x46fb5e,null));};exports[_0x45d7('0x53')]=function(_0x4a56ed,_0x6126ba,_0x4a2e28){return db['Team'][_0x45d7('0x54')]({'where':{'id':_0x4a56ed[_0x45d7('0x52')]['id']}})[_0x45d7('0x23')](handleEntityNotFound(_0x6126ba,null))[_0x45d7('0x23')](function(_0x39787e){if(!_0x4a56ed[_0x45d7('0x30')][_0x45d7('0x55')]||!utils[_0x45d7('0x56')](_0x4a56ed[_0x45d7('0x30')][_0x45d7('0x55')])){throw new db[(_0x45d7('0x57'))]['ValidationError'](_0x45d7('0x58'));}var _0x12d31b={};var _0x2dd927={};_0x2dd927[_0x45d7('0x2f')]=_[_0x45d7('0x31')](db[_[_0x45d7('0x59')](_0x4a56ed[_0x45d7('0x30')][_0x45d7('0x55')][_0x45d7('0x5a')]())+'Queue'][_0x45d7('0x2d')]);_0x2dd927[_0x45d7('0x30')]=_['keys'](_0x4a56ed[_0x45d7('0x30')]);_0x2dd927['filters']=_[_0x45d7('0x34')](_0x2dd927[_0x45d7('0x2f')],_0x2dd927['query']);_0x12d31b[_0x45d7('0x33')]=_[_0x45d7('0x34')](_0x2dd927[_0x45d7('0x2f')],qs[_0x45d7('0x35')](_0x4a56ed[_0x45d7('0x30')][_0x45d7('0x35')]));_0x12d31b[_0x45d7('0x33')]=_0x12d31b[_0x45d7('0x33')]['length']?_0x12d31b[_0x45d7('0x33')]:_0x2dd927[_0x45d7('0x2f')];_0x12d31b[_0x45d7('0x1e')]=qs[_0x45d7('0x1e')](_0x4a56ed[_0x45d7('0x30')]['limit']);_0x12d31b[_0x45d7('0x1d')]=qs[_0x45d7('0x1d')](_0x4a56ed[_0x45d7('0x30')][_0x45d7('0x1d')]);_0x12d31b[_0x45d7('0x5b')]=qs[_0x45d7('0x37')](_0x4a56ed[_0x45d7('0x30')][_0x45d7('0x37')]);_0x12d31b[_0x45d7('0x38')]=qs['filters'](_[_0x45d7('0x39')](_0x4a56ed['query'],_0x2dd927[_0x45d7('0x32')]));_0x12d31b=_[_0x45d7('0x3b')]({},_0x12d31b,_0x4a56ed[_0x45d7('0x3d')]);return _0x39787e['get'+_['capitalize'](_0x4a56ed[_0x45d7('0x30')][_0x45d7('0x55')][_0x45d7('0x5a')]())+_0x45d7('0x5c')](_0x12d31b);})[_0x45d7('0x23')](respondWithResult(_0x6126ba,null))['catch'](handleError(_0x6126ba,null));};exports[_0x45d7('0x5d')]=function(_0x58a5c3,_0x2c105f,_0x1470f9){return db[_0x45d7('0x41')][_0x45d7('0x54')]({'where':{'id':_0x58a5c3['params']['id']}})[_0x45d7('0x23')](function(_0x938fd1){if(_0x938fd1){if(!_0x58a5c3[_0x45d7('0x48')][_0x45d7('0x55')]||!utils[_0x45d7('0x56')](_0x58a5c3[_0x45d7('0x48')][_0x45d7('0x55')])){throw new db[(_0x45d7('0x57'))]['ValidationError'](_0x45d7('0x58'));}return _0x938fd1[_0x45d7('0x5e')+_[_0x45d7('0x59')](_0x58a5c3[_0x45d7('0x48')]['channel'][_0x45d7('0x5a')]())+_0x45d7('0x5c')](_0x58a5c3[_0x45d7('0x48')]['ids']);}return null;})[_0x45d7('0x23')](handleEntityNotFound(_0x2c105f,null))[_0x45d7('0x23')](respondWithStatusCode(_0x2c105f,null))['catch'](handleError(_0x2c105f,null));};exports[_0x45d7('0x5f')]=function(_0x378d10,_0x1aef3b,_0x1b6158){return db[_0x45d7('0x41')][_0x45d7('0x54')]({'where':{'id':_0x378d10[_0x45d7('0x52')]['id']}})[_0x45d7('0x23')](function(_0x4e055b){if(_0x4e055b){if(!_0x378d10[_0x45d7('0x30')][_0x45d7('0x55')]||!utils[_0x45d7('0x56')](_0x378d10['query']['channel'])){throw new db[(_0x45d7('0x57'))][(_0x45d7('0x60'))](_0x45d7('0x58'));}return _0x4e055b['remove'+_[_0x45d7('0x59')](_0x378d10[_0x45d7('0x30')]['channel'][_0x45d7('0x5a')]())+_0x45d7('0x5c')](_0x378d10[_0x45d7('0x30')][_0x45d7('0x61')]);}return null;})[_0x45d7('0x23')](handleEntityNotFound(_0x1aef3b,null))[_0x45d7('0x23')](respondWithStatusCode(_0x1aef3b,null))['catch'](handleError(_0x1aef3b,null));};exports[_0x45d7('0x62')]=function(_0x3d8c34,_0x5dc95e,_0x39fab3){return db['Team']['find']({'where':{'id':_0x3d8c34['params']['id']}})[_0x45d7('0x23')](handleEntityNotFound(_0x5dc95e,null))[_0x45d7('0x23')](function(_0x20d5cb){if(_0x20d5cb){var _0x27af03=['Voice',_0x45d7('0x63'),_0x45d7('0x64'),_0x45d7('0x65'),_0x45d7('0x66'),'Openchannel',_0x45d7('0x67')];return BPromise['each'](_0x27af03,function(_0x224865){return _0x20d5cb[_0x45d7('0x24')+_0x224865+_0x45d7('0x5c')]({'attributes':['id','name']})[_0x45d7('0x23')](function(_0x18d1b9){return BPromise['each'](_0x18d1b9,function(_0x4002aa){return _0x4002aa['addAgents'](_0x3d8c34[_0x45d7('0x48')][_0x45d7('0x61')])['then'](function(){if(_0x224865===_0x45d7('0x68')){return db[_0x45d7('0x69')][_0x45d7('0x42')]({'where':{'id':_0x3d8c34[_0x45d7('0x48')][_0x45d7('0x61')]},'attributes':['id','name',_0x45d7('0x6a'),_0x45d7('0x6b'),_0x45d7('0x6c')],'raw':!![]})[_0x45d7('0x23')](function(_0x2d40be){return BPromise['each'](_[_0x45d7('0x3a')](_0x2d40be,{'online':0x1}),function(_0x2b982b){return db[_0x45d7('0x6d')]['upsert']({'membername':_0x2b982b[_0x45d7('0x29')],'UserId':_0x2b982b['id'],'queue_name':_0x4002aa['name'],'VoiceQueueId':_0x4002aa['id'],'interface':_[_0x45d7('0x6e')](_0x2b982b[_0x45d7('0x6c')])?util[_0x45d7('0x6f')]('SIP/%s',_0x2b982b[_0x45d7('0x29')]):_0x2b982b[_0x45d7('0x6c')],'paused':_0x2b982b[_0x45d7('0x6b')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x20d5cb;});})['then'](function(){return _0x20d5cb;});}})[_0x45d7('0x23')](function(_0x44c650){if(_0x44c650){return _0x44c650[_0x45d7('0x62')](_0x3d8c34['body'][_0x45d7('0x61')],_['omit'](_0x3d8c34[_0x45d7('0x48')],[_0x45d7('0x61'),'id'])||{})[_0x45d7('0x70')](function(_0xa3e17a){for(var _0x13e83f=0x0;_0x13e83f<_0x3d8c34['body'][_0x45d7('0x61')]['length'];_0x13e83f+=0x1){socket[_0x45d7('0x71')](_0x45d7('0x72'),{'UserId':_0x3d8c34[_0x45d7('0x48')][_0x45d7('0x61')][_0x13e83f],'TeamId':_0x3d8c34[_0x45d7('0x52')]['id']});}return _0xa3e17a;});}})[_0x45d7('0x23')](respondWithResult(_0x5dc95e,null))['catch'](handleError(_0x5dc95e,null));};exports[_0x45d7('0x73')]=function(_0x25f67a,_0x546d5d,_0x17b85c){return db[_0x45d7('0x41')][_0x45d7('0x46')]({'where':{'id':_0x25f67a[_0x45d7('0x52')]['id']}})[_0x45d7('0x23')](handleEntityNotFound(_0x546d5d,null))[_0x45d7('0x23')](function(_0x49a8e0){if(_0x49a8e0){return BPromise[_0x45d7('0x74')]([_0x45d7('0x75'),_0x45d7('0x76'),_0x45d7('0x77'),_0x45d7('0x78'),_0x45d7('0x79'),_0x45d7('0x7a'),'whatsapp'],function(_0x54076f){return _0x49a8e0[_0x45d7('0x24')+_[_0x45d7('0x59')](_0x54076f)+_0x45d7('0x5c')]({'attributes':['id',_0x45d7('0x29')]})[_0x45d7('0x23')](function(_0x27d35a){return BPromise['each'](_0x27d35a,function(_0x3a6a46){return _0x3a6a46['removeAgents'](_0x25f67a['query'][_0x45d7('0x61')])[_0x45d7('0x23')](function(){if(_0x54076f===_0x45d7('0x75')){return db[_0x45d7('0x6d')][_0x45d7('0x26')]({'where':{'VoiceQueueId':_0x3a6a46['id'],'UserId':_0x25f67a[_0x45d7('0x30')][_0x45d7('0x61')]}});}});});})[_0x45d7('0x23')](function(){return _0x49a8e0;});})['then'](function(){return _0x49a8e0;});}})[_0x45d7('0x23')](function(_0x38b032){if(_0x38b032){return _0x38b032[_0x45d7('0x73')](_0x25f67a[_0x45d7('0x30')][_0x45d7('0x61')])[_0x45d7('0x23')](function(){if(_[_0x45d7('0x7b')](_0x25f67a['query']['ids'])){for(var _0x1cdc06=0x0;_0x1cdc06<_0x25f67a[_0x45d7('0x30')][_0x45d7('0x61')][_0x45d7('0x45')];_0x1cdc06+=0x1){socket[_0x45d7('0x71')](_0x45d7('0x7c'),{'UserId':Number(_0x25f67a['query'][_0x45d7('0x61')][_0x1cdc06]),'TeamId':Number(_0x25f67a[_0x45d7('0x52')]['id'])});}}else{socket[_0x45d7('0x71')](_0x45d7('0x7c'),{'UserId':Number(_0x25f67a[_0x45d7('0x30')][_0x45d7('0x61')]),'TeamId':Number(_0x25f67a[_0x45d7('0x52')]['id'])});}});}})[_0x45d7('0x23')](respondWithStatusCode(_0x546d5d,null))[_0x45d7('0x44')](handleError(_0x546d5d,null));};exports[_0x45d7('0x7d')]=function(_0x18e5f8,_0x24dab5,_0x46371e){var _0x5d4a54={};var _0x3e92d3={};var _0x384b67;var _0x30bfd7;return db[_0x45d7('0x41')][_0x45d7('0x54')]({'where':{'id':_0x18e5f8['params']['id']}})[_0x45d7('0x23')](handleEntityNotFound(_0x24dab5,null))[_0x45d7('0x23')](function(_0x10d8b0){if(_0x10d8b0){_0x384b67=_0x10d8b0;_0x3e92d3[_0x45d7('0x2f')]=_['keys'](db[_0x45d7('0x69')][_0x45d7('0x2d')]);_0x3e92d3['query']=_[_0x45d7('0x31')](_0x18e5f8['query']);_0x3e92d3[_0x45d7('0x32')]=_[_0x45d7('0x34')](_0x3e92d3[_0x45d7('0x2f')],_0x3e92d3[_0x45d7('0x30')]);_0x5d4a54['attributes']=_[_0x45d7('0x34')](_0x3e92d3[_0x45d7('0x2f')],qs[_0x45d7('0x35')](_0x18e5f8[_0x45d7('0x30')][_0x45d7('0x35')]));_0x5d4a54[_0x45d7('0x33')]=_0x5d4a54[_0x45d7('0x33')][_0x45d7('0x45')]?_0x5d4a54[_0x45d7('0x33')]:_0x3e92d3[_0x45d7('0x2f')];_0x5d4a54[_0x45d7('0x5b')]=qs[_0x45d7('0x37')](_0x18e5f8[_0x45d7('0x30')]['sort']);_0x5d4a54['where']=qs[_0x45d7('0x32')](_[_0x45d7('0x39')](_0x18e5f8[_0x45d7('0x30')],_0x3e92d3[_0x45d7('0x32')]));if(_0x18e5f8['query'][_0x45d7('0x3a')]){_0x5d4a54[_0x45d7('0x38')]=_['merge'](_0x5d4a54['where'],{'$or':_[_0x45d7('0x2c')](_0x5d4a54[_0x45d7('0x33')],function(_0x417b5b){var _0x1ae0cc={};_0x1ae0cc[_0x417b5b]={'$like':'%'+_0x18e5f8['query'][_0x45d7('0x3a')]+'%'};return _0x1ae0cc;})});}_0x5d4a54=_[_0x45d7('0x3b')]({},_0x5d4a54,_0x18e5f8[_0x45d7('0x3d')]);return _0x384b67['getAgents'](_0x5d4a54);}})['then'](function(_0x5255fd){if(_0x5255fd){_0x30bfd7=_0x5255fd['length'];if(!_0x18e5f8[_0x45d7('0x30')][_0x45d7('0x36')]('nolimit')){_0x5d4a54[_0x45d7('0x1e')]=qs[_0x45d7('0x1e')](_0x18e5f8[_0x45d7('0x30')][_0x45d7('0x1e')]);_0x5d4a54[_0x45d7('0x1d')]=qs[_0x45d7('0x1d')](_0x18e5f8[_0x45d7('0x30')]['offset']);}return _0x384b67[_0x45d7('0x7d')](_0x5d4a54);}})[_0x45d7('0x23')](function(_0x5e1bda){if(_0x5e1bda){return _0x5e1bda?{'count':_0x30bfd7,'rows':_0x5e1bda}:null;}})[_0x45d7('0x23')](respondWithResult(_0x24dab5,null))[_0x45d7('0x44')](handleError(_0x24dab5,null));}; \ No newline at end of file +var _0x67d6=['path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','get','Teams','sendStatus','error','stack','name','map','Team','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','toLowerCase','Queue','capitalize','Queues','addQueues','ValidationError','add','ids','remove','Voice','Sms','Fax','Openchannel','each','addAgents','voicePause','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','sms','openchannel','whatsapp','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x3c0ccc,_0x38f2f4){var _0x2dd4e5=function(_0x407ddc){while(--_0x407ddc){_0x3c0ccc['push'](_0x3c0ccc['shift']());}};_0x2dd4e5(++_0x38f2f4);}(_0x67d6,0x16c));var _0x667d=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0x67d6[_0x5ad07c];return _0x204bae;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x667d('0x0'));var rimraf=require(_0x667d('0x1'));var zipdir=require(_0x667d('0x2'));var jsonpatch=require(_0x667d('0x3'));var rp=require(_0x667d('0x4'));var moment=require(_0x667d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x667d('0x6'));var util=require(_0x667d('0x7'));var path=require(_0x667d('0x8'));var sox=require(_0x667d('0x9'));var csv=require(_0x667d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x667d('0xb'));var squel=require(_0x667d('0xc'));var crypto=require('crypto');var jsforce=require(_0x667d('0xd'));var deskjs=require(_0x667d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x667d('0xf'));var Papa=require('papaparse');var Redis=require(_0x667d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x667d('0x11'));var as=require(_0x667d('0x12'));var hardwareService=require(_0x667d('0x13'));var logger=require(_0x667d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x667d('0x15'));var db=require('../../mysqldb')['db'];config[_0x667d('0x16')]=_[_0x667d('0x17')](config[_0x667d('0x16')],{'host':_0x667d('0x18'),'port':0x18eb});var socket=require(_0x667d('0x19'))(new Redis(config[_0x667d('0x16')]));require('./team.socket')[_0x667d('0x1a')](socket);function respondWithStatusCode(_0x1b2f55,_0x91e34b){_0x91e34b=_0x91e34b||0xcc;return function(_0x31b7d6){if(_0x31b7d6){return _0x1b2f55['sendStatus'](_0x91e34b);}return _0x1b2f55[_0x667d('0x1b')](_0x91e34b)[_0x667d('0x1c')]();};}function respondWithResult(_0x6f8b72,_0x12f1ec){_0x12f1ec=_0x12f1ec||0xc8;return function(_0x1319f3){if(_0x1319f3){return _0x6f8b72[_0x667d('0x1b')](_0x12f1ec)[_0x667d('0x1d')](_0x1319f3);}};}function respondWithFilteredResult(_0x1fd3e8,_0x4bfec4){return function(_0x3462b3){if(_0x3462b3){var _0x14843d=_0x3462b3[_0x667d('0x1e')],_0x8cbda6=_0x4bfec4[_0x667d('0x1f')],_0x1e6138=_0x4bfec4[_0x667d('0x1f')]+_0x4bfec4[_0x667d('0x20')],_0x2d0847;if(_0x1e6138>=_0x14843d){_0x1e6138=_0x14843d;_0x2d0847=0xc8;}else{_0x2d0847=0xce;}_0x1fd3e8[_0x667d('0x1b')](_0x2d0847);return _0x1fd3e8[_0x667d('0x21')]('Content-Range',_0x8cbda6+'-'+_0x1e6138+'/'+_0x14843d)[_0x667d('0x1d')](_0x3462b3);}return null;};}function patchUpdates(_0x180175){return function(_0x347458){try{jsonpatch[_0x667d('0x22')](_0x347458,_0x180175,!![]);}catch(_0x48bba4){return BPromise[_0x667d('0x23')](_0x48bba4);}return _0x347458[_0x667d('0x24')]();};}function saveUpdates(_0x5d6d95,_0x250b33){return function(_0x429d56){if(_0x429d56){return _0x429d56['update'](_0x5d6d95)[_0x667d('0x25')](function(_0xe4aa5){return _0xe4aa5;});}return null;};}function removeEntity(_0x4a482a,_0x32809c){return function(_0x19ca91){if(_0x19ca91){return _0x19ca91[_0x667d('0x26')]()[_0x667d('0x25')](function(){var _0x2b008c=_0x19ca91[_0x667d('0x27')]({'plain':!![]});var _0x39e41e=_0x667d('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x39e41e,'resourceId':_0x2b008c['id']}})['then'](function(){return _0x19ca91;});})[_0x667d('0x25')](function(){_0x4a482a[_0x667d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x354b87,_0xa10520){return function(_0x4074d5){if(!_0x4074d5){_0x354b87[_0x667d('0x29')](0x194);}return _0x4074d5;};}function handleError(_0x3e2b45,_0x1092ac){_0x1092ac=_0x1092ac||0x1f4;return function(_0x449721){logger[_0x667d('0x2a')](_0x449721[_0x667d('0x2b')]);if(_0x449721['name']){delete _0x449721[_0x667d('0x2c')];}_0x3e2b45[_0x667d('0x1b')](_0x1092ac)['send'](_0x449721);};}exports['index']=function(_0x58868d,_0x5c7dad){var _0x579167={},_0x564744={},_0x242f3b={'count':0x0,'rows':[]};var _0x65452c=_[_0x667d('0x2d')](db[_0x667d('0x2e')][_0x667d('0x2f')],function(_0x48a414){return{'name':_0x48a414[_0x667d('0x30')],'type':_0x48a414[_0x667d('0x31')][_0x667d('0x32')]};});_0x564744[_0x667d('0x33')]=_[_0x667d('0x2d')](_0x65452c,_0x667d('0x2c'));_0x564744[_0x667d('0x34')]=_['keys'](_0x58868d[_0x667d('0x34')]);_0x564744['filters']=_[_0x667d('0x35')](_0x564744[_0x667d('0x33')],_0x564744[_0x667d('0x34')]);_0x579167['attributes']=_['intersection'](_0x564744[_0x667d('0x33')],qs[_0x667d('0x36')](_0x58868d[_0x667d('0x34')][_0x667d('0x36')]));_0x579167[_0x667d('0x37')]=_0x579167[_0x667d('0x37')]['length']?_0x579167[_0x667d('0x37')]:_0x564744[_0x667d('0x33')];if(!_0x58868d[_0x667d('0x34')][_0x667d('0x38')](_0x667d('0x39'))){_0x579167[_0x667d('0x20')]=qs['limit'](_0x58868d[_0x667d('0x34')][_0x667d('0x20')]);_0x579167['offset']=qs['offset'](_0x58868d[_0x667d('0x34')][_0x667d('0x1f')]);}_0x579167[_0x667d('0x3a')]=qs[_0x667d('0x3b')](_0x58868d['query'][_0x667d('0x3b')]);_0x579167[_0x667d('0x3c')]=qs[_0x667d('0x3d')](_[_0x667d('0x3e')](_0x58868d[_0x667d('0x34')],_0x564744['filters']),_0x65452c);if(_0x58868d[_0x667d('0x34')]['filter']){_0x579167['where']=_['merge'](_0x579167['where'],{'$or':_[_0x667d('0x2d')](_0x65452c,function(_0xcd760f){if(_0xcd760f[_0x667d('0x31')]!==_0x667d('0x3f')){var _0x555da5={};_0x555da5[_0xcd760f[_0x667d('0x2c')]]={'$like':'%'+_0x58868d[_0x667d('0x34')][_0x667d('0x40')]+'%'};return _0x555da5;}})});}_0x579167=_[_0x667d('0x41')]({},_0x579167,_0x58868d[_0x667d('0x42')]);var _0x2f651e={'where':_0x579167[_0x667d('0x3c')]};return db['Team'][_0x667d('0x1e')](_0x2f651e)[_0x667d('0x25')](function(_0x1e6901){_0x242f3b['count']=_0x1e6901;if(_0x58868d[_0x667d('0x34')][_0x667d('0x43')]){_0x579167[_0x667d('0x44')]=[{'all':!![]}];}return db[_0x667d('0x2e')][_0x667d('0x45')](_0x579167);})['then'](function(_0x4040aa){_0x242f3b[_0x667d('0x46')]=_0x4040aa;return _0x242f3b;})['then'](respondWithFilteredResult(_0x5c7dad,_0x579167))[_0x667d('0x47')](handleError(_0x5c7dad,null));};exports[_0x667d('0x48')]=function(_0x5182fc,_0x330c3e){var _0x121b12={'raw':![],'where':{'id':_0x5182fc[_0x667d('0x49')]['id']}},_0x38819e={};_0x38819e[_0x667d('0x33')]=_[_0x667d('0x4a')](db['Team']['rawAttributes']);_0x38819e[_0x667d('0x34')]=_[_0x667d('0x4a')](_0x5182fc[_0x667d('0x34')]);_0x38819e['filters']=_['intersection'](_0x38819e['model'],_0x38819e[_0x667d('0x34')]);_0x121b12[_0x667d('0x37')]=_['intersection'](_0x38819e[_0x667d('0x33')],qs['fields'](_0x5182fc[_0x667d('0x34')][_0x667d('0x36')]));_0x121b12[_0x667d('0x37')]=_0x121b12[_0x667d('0x37')][_0x667d('0x4b')]?_0x121b12[_0x667d('0x37')]:_0x38819e[_0x667d('0x33')];if(_0x5182fc[_0x667d('0x34')]['includeAll']){_0x121b12[_0x667d('0x44')]=[{'all':!![]}];}_0x121b12=_[_0x667d('0x41')]({},_0x121b12,_0x5182fc['options']);return db['Team'][_0x667d('0x4c')](_0x121b12)['then'](handleEntityNotFound(_0x330c3e,null))[_0x667d('0x25')](respondWithResult(_0x330c3e,null))[_0x667d('0x47')](handleError(_0x330c3e,null));};exports[_0x667d('0x4d')]=function(_0x527d27,_0x18fdd0){return db[_0x667d('0x2e')][_0x667d('0x4d')](_0x527d27[_0x667d('0x4e')],{})[_0x667d('0x25')](function(_0x210e13){var _0x47683f=_0x527d27[_0x667d('0x4f')][_0x667d('0x27')]({'plain':!![]});if(!_0x47683f)throw new Error(_0x667d('0x50'));if(_0x47683f[_0x667d('0x51')]===_0x667d('0x4f')){var _0x14ecfe=_0x210e13[_0x667d('0x27')]({'plain':!![]});var _0x3193a1=_0x667d('0x28');return db[_0x667d('0x52')][_0x667d('0x4c')]({'where':{'name':_0x3193a1,'userProfileId':_0x47683f['userProfileId']},'raw':!![]})[_0x667d('0x25')](function(_0x4da15c){if(_0x4da15c&&_0x4da15c['autoAssociation']===0x0){return db['UserProfileResource'][_0x667d('0x4d')]({'name':_0x14ecfe[_0x667d('0x2c')],'resourceId':_0x14ecfe['id'],'type':_0x4da15c[_0x667d('0x2c')],'sectionId':_0x4da15c['id']},{})[_0x667d('0x25')](function(){return _0x210e13;});}else{return _0x210e13;}})['catch'](function(_0x323669){logger[_0x667d('0x2a')](_0x667d('0x53'),_0x323669);throw _0x323669;});}return _0x210e13;})[_0x667d('0x25')](respondWithResult(_0x18fdd0,0xc9))['catch'](handleError(_0x18fdd0,null));};exports[_0x667d('0x54')]=function(_0x25a51c,_0x1dcc88){if(_0x25a51c['body']['id']){delete _0x25a51c['body']['id'];}return db[_0x667d('0x2e')][_0x667d('0x4c')]({'where':{'id':_0x25a51c['params']['id']}})['then'](handleEntityNotFound(_0x1dcc88,null))['then'](saveUpdates(_0x25a51c['body'],null))['then'](respondWithResult(_0x1dcc88,null))['catch'](handleError(_0x1dcc88,null));};exports[_0x667d('0x26')]=function(_0x147fef,_0x4dd1c0){return db[_0x667d('0x2e')][_0x667d('0x4c')]({'where':{'id':_0x147fef[_0x667d('0x49')]['id']}})['then'](handleEntityNotFound(_0x4dd1c0,null))[_0x667d('0x25')](removeEntity(_0x4dd1c0,null))[_0x667d('0x47')](handleError(_0x4dd1c0,null));};exports['getQueues']=function(_0x350fd6,_0x1e3fe0,_0x22ac09){return db['Team'][_0x667d('0x55')]({'where':{'id':_0x350fd6['params']['id']}})[_0x667d('0x25')](handleEntityNotFound(_0x1e3fe0,null))[_0x667d('0x25')](function(_0x3f926c){if(!_0x350fd6['query'][_0x667d('0x56')]||!utils[_0x667d('0x57')](_0x350fd6['query'][_0x667d('0x56')])){throw new db[(_0x667d('0x58'))]['ValidationError'](_0x667d('0x59'));}var _0xb0b5fe={};var _0x488647={};_0x488647[_0x667d('0x33')]=_[_0x667d('0x4a')](db[_['capitalize'](_0x350fd6[_0x667d('0x34')]['channel'][_0x667d('0x5a')]())+_0x667d('0x5b')][_0x667d('0x2f')]);_0x488647[_0x667d('0x34')]=_[_0x667d('0x4a')](_0x350fd6['query']);_0x488647[_0x667d('0x3d')]=_[_0x667d('0x35')](_0x488647['model'],_0x488647[_0x667d('0x34')]);_0xb0b5fe[_0x667d('0x37')]=_[_0x667d('0x35')](_0x488647[_0x667d('0x33')],qs[_0x667d('0x36')](_0x350fd6['query'][_0x667d('0x36')]));_0xb0b5fe[_0x667d('0x37')]=_0xb0b5fe[_0x667d('0x37')][_0x667d('0x4b')]?_0xb0b5fe[_0x667d('0x37')]:_0x488647[_0x667d('0x33')];_0xb0b5fe[_0x667d('0x20')]=qs['limit'](_0x350fd6['query']['limit']);_0xb0b5fe[_0x667d('0x1f')]=qs[_0x667d('0x1f')](_0x350fd6[_0x667d('0x34')][_0x667d('0x1f')]);_0xb0b5fe[_0x667d('0x3a')]=qs[_0x667d('0x3b')](_0x350fd6[_0x667d('0x34')][_0x667d('0x3b')]);_0xb0b5fe[_0x667d('0x3c')]=qs[_0x667d('0x3d')](_[_0x667d('0x3e')](_0x350fd6[_0x667d('0x34')],_0x488647[_0x667d('0x3d')]));_0xb0b5fe=_[_0x667d('0x41')]({},_0xb0b5fe,_0x350fd6[_0x667d('0x42')]);return _0x3f926c[_0x667d('0x27')+_[_0x667d('0x5c')](_0x350fd6[_0x667d('0x34')][_0x667d('0x56')][_0x667d('0x5a')]())+_0x667d('0x5d')](_0xb0b5fe);})[_0x667d('0x25')](respondWithResult(_0x1e3fe0,null))[_0x667d('0x47')](handleError(_0x1e3fe0,null));};exports[_0x667d('0x5e')]=function(_0x5c2d2d,_0x5cd913,_0x4122d3){return db[_0x667d('0x2e')][_0x667d('0x55')]({'where':{'id':_0x5c2d2d[_0x667d('0x49')]['id']}})[_0x667d('0x25')](function(_0x585458){if(_0x585458){if(!_0x5c2d2d[_0x667d('0x4e')][_0x667d('0x56')]||!utils[_0x667d('0x57')](_0x5c2d2d[_0x667d('0x4e')]['channel'])){throw new db['Sequelize'][(_0x667d('0x5f'))](_0x667d('0x59'));}return _0x585458[_0x667d('0x60')+_['capitalize'](_0x5c2d2d['body'][_0x667d('0x56')]['toLowerCase']())+_0x667d('0x5d')](_0x5c2d2d[_0x667d('0x4e')][_0x667d('0x61')]);}return null;})[_0x667d('0x25')](handleEntityNotFound(_0x5cd913,null))['then'](respondWithStatusCode(_0x5cd913,null))['catch'](handleError(_0x5cd913,null));};exports['removeQueues']=function(_0x4c6ad7,_0x2db0ef,_0x1b9e51){return db[_0x667d('0x2e')]['findOne']({'where':{'id':_0x4c6ad7[_0x667d('0x49')]['id']}})[_0x667d('0x25')](function(_0x4cfb36){if(_0x4cfb36){if(!_0x4c6ad7[_0x667d('0x34')][_0x667d('0x56')]||!utils[_0x667d('0x57')](_0x4c6ad7['query']['channel'])){throw new db[(_0x667d('0x58'))][(_0x667d('0x5f'))](_0x667d('0x59'));}return _0x4cfb36[_0x667d('0x62')+_[_0x667d('0x5c')](_0x4c6ad7['query'][_0x667d('0x56')][_0x667d('0x5a')]())+_0x667d('0x5d')](_0x4c6ad7['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x2db0ef,null))[_0x667d('0x25')](respondWithStatusCode(_0x2db0ef,null))[_0x667d('0x47')](handleError(_0x2db0ef,null));};exports['addAgents']=function(_0xba4d2a,_0x239134,_0x582233){return db[_0x667d('0x2e')][_0x667d('0x4c')]({'where':{'id':_0xba4d2a['params']['id']}})[_0x667d('0x25')](handleEntityNotFound(_0x239134,null))[_0x667d('0x25')](function(_0x5247a4){if(_0x5247a4){var _0x2b2d92=[_0x667d('0x63'),'Chat','Mail',_0x667d('0x64'),_0x667d('0x65'),_0x667d('0x66'),'Whatsapp'];return BPromise['each'](_0x2b2d92,function(_0x44279b){return _0x5247a4[_0x667d('0x27')+_0x44279b+_0x667d('0x5d')]({'attributes':['id',_0x667d('0x2c')]})[_0x667d('0x25')](function(_0x9fc957){return BPromise[_0x667d('0x67')](_0x9fc957,function(_0x2977be){return _0x2977be[_0x667d('0x68')](_0xba4d2a[_0x667d('0x4e')][_0x667d('0x61')])[_0x667d('0x25')](function(){if(_0x44279b===_0x667d('0x63')){return db['User'][_0x667d('0x45')]({'where':{'id':_0xba4d2a[_0x667d('0x4e')][_0x667d('0x61')]},'attributes':['id',_0x667d('0x2c'),'online',_0x667d('0x69'),'interface'],'raw':!![]})[_0x667d('0x25')](function(_0x3979d6){return BPromise[_0x667d('0x67')](_['filter'](_0x3979d6,{'online':0x1}),function(_0x1eb6dd){return db[_0x667d('0x6a')][_0x667d('0x6b')]({'membername':_0x1eb6dd['name'],'UserId':_0x1eb6dd['id'],'queue_name':_0x2977be['name'],'VoiceQueueId':_0x2977be['id'],'interface':_[_0x667d('0x6c')](_0x1eb6dd['interface'])?util[_0x667d('0x6d')](_0x667d('0x6e'),_0x1eb6dd['name']):_0x1eb6dd[_0x667d('0x6f')],'paused':_0x1eb6dd['voicePause']||![],'penalty':0x0});});});}});});})[_0x667d('0x25')](function(){return _0x5247a4;});})[_0x667d('0x25')](function(){return _0x5247a4;});}})[_0x667d('0x25')](function(_0x3d88c2){if(_0x3d88c2){return _0x3d88c2['addAgents'](_0xba4d2a[_0x667d('0x4e')][_0x667d('0x61')],_[_0x667d('0x70')](_0xba4d2a[_0x667d('0x4e')],[_0x667d('0x61'),'id'])||{})[_0x667d('0x71')](function(_0x2e6ac8){for(var _0xf48a5=0x0;_0xf48a5<_0xba4d2a[_0x667d('0x4e')][_0x667d('0x61')]['length'];_0xf48a5+=0x1){socket[_0x667d('0x72')](_0x667d('0x73'),{'UserId':_0xba4d2a[_0x667d('0x4e')][_0x667d('0x61')][_0xf48a5],'TeamId':_0xba4d2a['params']['id']});}return _0x2e6ac8;});}})[_0x667d('0x25')](respondWithResult(_0x239134,null))[_0x667d('0x47')](handleError(_0x239134,null));};exports[_0x667d('0x74')]=function(_0x536522,_0x4330bc,_0x59d709){return db[_0x667d('0x2e')][_0x667d('0x4c')]({'where':{'id':_0x536522[_0x667d('0x49')]['id']}})[_0x667d('0x25')](handleEntityNotFound(_0x4330bc,null))[_0x667d('0x25')](function(_0x36a865){if(_0x36a865){return BPromise[_0x667d('0x67')]([_0x667d('0x75'),_0x667d('0x76'),_0x667d('0x77'),_0x667d('0x78'),'fax',_0x667d('0x79'),_0x667d('0x7a')],function(_0xb4c43c){return _0x36a865['get'+_[_0x667d('0x5c')](_0xb4c43c)+_0x667d('0x5d')]({'attributes':['id',_0x667d('0x2c')]})[_0x667d('0x25')](function(_0x3dd497){return BPromise[_0x667d('0x67')](_0x3dd497,function(_0x21129d){return _0x21129d[_0x667d('0x74')](_0x536522[_0x667d('0x34')]['ids'])['then'](function(){if(_0xb4c43c===_0x667d('0x75')){return db[_0x667d('0x6a')][_0x667d('0x26')]({'where':{'VoiceQueueId':_0x21129d['id'],'UserId':_0x536522[_0x667d('0x34')]['ids']}});}});});})[_0x667d('0x25')](function(){return _0x36a865;});})['then'](function(){return _0x36a865;});}})['then'](function(_0x38be18){if(_0x38be18){return _0x38be18['removeAgents'](_0x536522['query'][_0x667d('0x61')])['then'](function(){if(_['isArray'](_0x536522[_0x667d('0x34')]['ids'])){for(var _0x26a0c1=0x0;_0x26a0c1<_0x536522[_0x667d('0x34')]['ids']['length'];_0x26a0c1+=0x1){socket[_0x667d('0x72')]('userTeam:remove',{'UserId':Number(_0x536522[_0x667d('0x34')][_0x667d('0x61')][_0x26a0c1]),'TeamId':Number(_0x536522['params']['id'])});}}else{socket[_0x667d('0x72')]('userTeam:remove',{'UserId':Number(_0x536522[_0x667d('0x34')][_0x667d('0x61')]),'TeamId':Number(_0x536522['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4330bc,null))[_0x667d('0x47')](handleError(_0x4330bc,null));};exports[_0x667d('0x7b')]=function(_0x1a16de,_0x4dc37c,_0x27e4d2){var _0x483e82={};var _0x8f911d={};var _0x5e9364;var _0x5f37eb;return db[_0x667d('0x2e')][_0x667d('0x55')]({'where':{'id':_0x1a16de[_0x667d('0x49')]['id']}})[_0x667d('0x25')](handleEntityNotFound(_0x4dc37c,null))[_0x667d('0x25')](function(_0x238381){if(_0x238381){_0x5e9364=_0x238381;_0x8f911d[_0x667d('0x33')]=_[_0x667d('0x4a')](db['User'][_0x667d('0x2f')]);_0x8f911d[_0x667d('0x34')]=_['keys'](_0x1a16de[_0x667d('0x34')]);_0x8f911d[_0x667d('0x3d')]=_[_0x667d('0x35')](_0x8f911d['model'],_0x8f911d['query']);_0x483e82[_0x667d('0x37')]=_[_0x667d('0x35')](_0x8f911d[_0x667d('0x33')],qs[_0x667d('0x36')](_0x1a16de['query'][_0x667d('0x36')]));_0x483e82[_0x667d('0x37')]=_0x483e82[_0x667d('0x37')]['length']?_0x483e82['attributes']:_0x8f911d[_0x667d('0x33')];_0x483e82[_0x667d('0x3a')]=qs['sort'](_0x1a16de[_0x667d('0x34')][_0x667d('0x3b')]);_0x483e82[_0x667d('0x3c')]=qs['filters'](_[_0x667d('0x3e')](_0x1a16de[_0x667d('0x34')],_0x8f911d[_0x667d('0x3d')]));if(_0x1a16de['query'][_0x667d('0x40')]){_0x483e82[_0x667d('0x3c')]=_[_0x667d('0x41')](_0x483e82[_0x667d('0x3c')],{'$or':_[_0x667d('0x2d')](_0x483e82[_0x667d('0x37')],function(_0x459831){var _0x4de5e4={};_0x4de5e4[_0x459831]={'$like':'%'+_0x1a16de[_0x667d('0x34')][_0x667d('0x40')]+'%'};return _0x4de5e4;})});}_0x483e82=_['merge']({},_0x483e82,_0x1a16de[_0x667d('0x42')]);return _0x5e9364[_0x667d('0x7b')](_0x483e82);}})[_0x667d('0x25')](function(_0x3a8fe0){if(_0x3a8fe0){_0x5f37eb=_0x3a8fe0[_0x667d('0x4b')];if(!_0x1a16de[_0x667d('0x34')][_0x667d('0x38')](_0x667d('0x39'))){_0x483e82[_0x667d('0x20')]=qs['limit'](_0x1a16de['query'][_0x667d('0x20')]);_0x483e82['offset']=qs[_0x667d('0x1f')](_0x1a16de[_0x667d('0x34')]['offset']);}return _0x5e9364[_0x667d('0x7b')](_0x483e82);}})['then'](function(_0x609c35){if(_0x609c35){return _0x609c35?{'count':_0x5f37eb,'rows':_0x609c35}:null;}})[_0x667d('0x25')](respondWithResult(_0x4dc37c,null))[_0x667d('0x47')](handleError(_0x4dc37c,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d3d64e8..b5ec966 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 _0x299e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','Team'];(function(_0x18d595,_0x214a96){var _0x58135c=function(_0x48db8e){while(--_0x48db8e){_0x18d595['push'](_0x18d595['shift']());}};_0x58135c(++_0x214a96);}(_0x299e,0x1b6));var _0xe299=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x299e[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var Team=require(_0xe299('0x0'))['db'][_0xe299('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xe299('0x2')](0x0);var events={'afterCreate':_0xe299('0x3'),'afterUpdate':_0xe299('0x4'),'afterDestroy':_0xe299('0x5')};function emitEvent(_0x8dd780){return function(_0x271514,_0x1ea47a,_0x410228){TeamEvents[_0xe299('0x6')](_0x8dd780+':'+_0x271514['id'],_0x271514);TeamEvents[_0xe299('0x6')](_0x8dd780,_0x271514);_0x410228(null);};}for(var e in events){if(events[_0xe299('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x297c=['events','setMaxListeners','remove','emit','hasOwnProperty','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x297c,0x14a));var _0xc297=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x297c[_0x102ff9];return _0x24fa97;};'use strict';var EventEmitter=require(_0xc297('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xc297('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc297('0x2')};function emitEvent(_0x5dfb1a){return function(_0x5e681a,_0x120c58,_0x220f19){TeamEvents[_0xc297('0x3')](_0x5dfb1a+':'+_0x5e681a['id'],_0x5e681a);TeamEvents[_0xc297('0x3')](_0x5dfb1a,_0x5e681a);_0x220f19(null);};}for(var e in events){if(events[_0xc297('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xc297('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 31146c8..200c32c 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 _0x3ca9=['lodash','util','../../config/logger','api','moment','exports','define'];(function(_0x5ba858,_0x1e42e2){var _0xc702fb=function(_0x3d2e9e){while(--_0x3d2e9e){_0x5ba858['push'](_0x5ba858['shift']());}};_0xc702fb(++_0x1e42e2);}(_0x3ca9,0x9a));var _0x93ca=function(_0x1f4fa1,_0x40ba30){_0x1f4fa1=_0x1f4fa1-0x0;var _0x5a606e=_0x3ca9[_0x1f4fa1];return _0x5a606e;};'use strict';var _=require(_0x93ca('0x0'));var util=require(_0x93ca('0x1'));var logger=require(_0x93ca('0x2'))(_0x93ca('0x3'));var moment=require(_0x93ca('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x93ca('0x5')]=function(_0x1e67d1,_0x2eb5ce){return _0x1e67d1[_0x93ca('0x6')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x588f=['api','moment','bluebird','rimraf','exports','define','teams','lodash','../../config/logger'];(function(_0x9fb085,_0x2251a3){var _0x400c75=function(_0x1455ed){while(--_0x1455ed){_0x9fb085['push'](_0x9fb085['shift']());}};_0x400c75(++_0x2251a3);}(_0x588f,0x130));var _0xf588=function(_0x5a1fb0,_0x2364ea){_0x5a1fb0=_0x5a1fb0-0x0;var _0x3806ef=_0x588f[_0x5a1fb0];return _0x3806ef;};'use strict';var _=require(_0xf588('0x0'));var util=require('util');var logger=require(_0xf588('0x1'))(_0xf588('0x2'));var moment=require(_0xf588('0x3'));var BPromise=require(_0xf588('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf588('0x5'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0xf588('0x6')]=function(_0x4e5408,_0x1eb8c3){return _0x4e5408[_0xf588('0x7')]('Team',attributes,{'tableName':_0xf588('0x8'),'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 5819daa..15f7629 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 _0xbaad=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x38cc1f,_0x5bea2b){var _0x3f2909=function(_0x35de4e){while(--_0x35de4e){_0x38cc1f['push'](_0x38cc1f['shift']());}};_0x3f2909(++_0x5bea2b);}(_0xbaad,0x15f));var _0xdbaa=function(_0x5ae723,_0x10eedb){_0x5ae723=_0x5ae723-0x0;var _0x351542=_0xbaad[_0x5ae723];return _0x351542;};'use strict';var _=require(_0xdbaa('0x0'));var util=require('util');var moment=require(_0xdbaa('0x1'));var BPromise=require(_0xdbaa('0x2'));var rs=require(_0xdbaa('0x3'));var fs=require('fs');var Redis=require(_0xdbaa('0x4'));var db=require(_0xdbaa('0x5'))['db'];var utils=require(_0xdbaa('0x6'));var logger=require(_0xdbaa('0x7'))('rpc');var config=require(_0xdbaa('0x8'));var jayson=require(_0xdbaa('0x9'));var client=jayson[_0xdbaa('0xa')]['http']({'port':0x232a});config[_0xdbaa('0xb')]=_[_0xdbaa('0xc')](config[_0xdbaa('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdbaa('0xd'))(new Redis(config['redis']));require('./team.socket')[_0xdbaa('0xe')](socket);function respondWithRpcPromise(_0x41a8bf,_0x38712f,_0x51aafa){return new BPromise(function(_0xb2617a,_0x45f616){return client[_0xdbaa('0xf')](_0x41a8bf,_0x51aafa)[_0xdbaa('0x10')](function(_0x784083){logger['info'](_0xdbaa('0x11'),_0x38712f,_0xdbaa('0x12'));logger[_0xdbaa('0x13')](_0xdbaa('0x14'),_0x38712f,'request\x20sent',JSON['stringify'](_0x784083));if(_0x784083[_0xdbaa('0x15')]){if(_0x784083[_0xdbaa('0x15')][_0xdbaa('0x16')]===0x1f4){logger[_0xdbaa('0x15')](_0xdbaa('0x11'),_0x38712f,_0x784083[_0xdbaa('0x15')][_0xdbaa('0x17')]);return _0x45f616(_0x784083['error']['message']);}logger[_0xdbaa('0x15')](_0xdbaa('0x11'),_0x38712f,_0x784083[_0xdbaa('0x15')][_0xdbaa('0x17')]);return _0xb2617a(_0x784083[_0xdbaa('0x15')]['message']);}else{logger[_0xdbaa('0x18')](_0xdbaa('0x11'),_0x38712f,'request\x20sent');_0xb2617a(_0x784083[_0xdbaa('0x19')][_0xdbaa('0x17')]);}})[_0xdbaa('0x1a')](function(_0x5ad12d){logger[_0xdbaa('0x15')]('Team,\x20%s,\x20%s',_0x38712f,_0x5ad12d);_0x45f616(_0x5ad12d);});});} \ No newline at end of file +var _0x4149=['debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s'];(function(_0x5b7971,_0x44d12f){var _0x5e10fa=function(_0x4f8e14){while(--_0x4f8e14){_0x5b7971['push'](_0x5b7971['shift']());}};_0x5e10fa(++_0x44d12f);}(_0x4149,0x117));var _0x9414=function(_0x53e06a,_0x26c264){_0x53e06a=_0x53e06a-0x0;var _0x4a84d5=_0x4149[_0x53e06a];return _0x4a84d5;};'use strict';var _=require('lodash');var util=require(_0x9414('0x0'));var moment=require(_0x9414('0x1'));var BPromise=require(_0x9414('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9414('0x3'));var db=require(_0x9414('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9414('0x5'))(_0x9414('0x6'));var config=require(_0x9414('0x7'));var jayson=require(_0x9414('0x8'));var client=jayson['client'][_0x9414('0x9')]({'port':0x232a});config[_0x9414('0xa')]=_['defaults'](config['redis'],{'host':_0x9414('0xb'),'port':0x18eb});var socket=require(_0x9414('0xc'))(new Redis(config[_0x9414('0xa')]));require(_0x9414('0xd'))[_0x9414('0xe')](socket);function respondWithRpcPromise(_0x3f1411,_0x415d95,_0x34f5b3){return new BPromise(function(_0x5ef7c7,_0x1222bc){return client['request'](_0x3f1411,_0x34f5b3)[_0x9414('0xf')](function(_0x2de504){logger[_0x9414('0x10')](_0x9414('0x11'),_0x415d95,'request\x20sent');logger[_0x9414('0x12')](_0x9414('0x13'),_0x415d95,_0x9414('0x14'),JSON[_0x9414('0x15')](_0x2de504));if(_0x2de504['error']){if(_0x2de504[_0x9414('0x16')][_0x9414('0x17')]===0x1f4){logger[_0x9414('0x16')](_0x9414('0x11'),_0x415d95,_0x2de504['error']['message']);return _0x1222bc(_0x2de504[_0x9414('0x16')][_0x9414('0x18')]);}logger[_0x9414('0x16')](_0x9414('0x11'),_0x415d95,_0x2de504[_0x9414('0x16')][_0x9414('0x18')]);return _0x5ef7c7(_0x2de504[_0x9414('0x16')]['message']);}else{logger[_0x9414('0x10')]('Team,\x20%s,\x20%s',_0x415d95,'request\x20sent');_0x5ef7c7(_0x2de504[_0x9414('0x19')][_0x9414('0x18')]);}})[_0x9414('0x1a')](function(_0x1bb6a5){logger[_0x9414('0x16')]('Team,\x20%s,\x20%s',_0x415d95,_0x1bb6a5);_0x1222bc(_0x1bb6a5);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d016f15..3a78c07 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 _0xcddb=['emit','removeListener','length','team:','./team.events','save','remove'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x33d861,_0x301101){_0x33d861=_0x33d861-0x0;var _0x1f1bbe=_0xcddb[_0x33d861];return _0x1f1bbe;};'use strict';var TeamEvents=require(_0xbcdd('0x0'));var events=[_0xbcdd('0x1'),_0xbcdd('0x2'),'update'];function createListener(_0x49d70b,_0x2a6202){return function(_0x5e7cff){_0x2a6202[_0xbcdd('0x3')](_0x49d70b,_0x5e7cff);};}function removeListener(_0x38c955,_0x1119ba){return function(){TeamEvents[_0xbcdd('0x4')](_0x38c955,_0x1119ba);};}exports['register']=function(_0x1ee9da){for(var _0x5d9553=0x0,_0x1d00d4=events[_0xbcdd('0x5')];_0x5d9553<_0x1d00d4;_0x5d9553++){var _0x586e64=events[_0x5d9553];var _0x46f26c=createListener(_0xbcdd('0x6')+_0x586e64,_0x1ee9da);TeamEvents['on'](_0x586e64,_0x46f26c);}}; \ No newline at end of file +var _0x202a=['removeListener','team:','save','remove','update'];(function(_0x25a536,_0x451301){var _0x53a449=function(_0x2e551d){while(--_0x2e551d){_0x25a536['push'](_0x25a536['shift']());}};_0x53a449(++_0x451301);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var TeamEvents=require('./team.events');var events=[_0xa202('0x0'),_0xa202('0x1'),_0xa202('0x2')];function createListener(_0x47ca75,_0x3739bd){return function(_0x5a7f7d){_0x3739bd['emit'](_0x47ca75,_0x5a7f7d);};}function removeListener(_0x595945,_0x32f8b7){return function(){TeamEvents[_0xa202('0x3')](_0x595945,_0x32f8b7);};}exports['register']=function(_0x49e186){for(var _0x8e05f0=0x0,_0x4cb469=events['length'];_0x8e05f0<_0x4cb469;_0x8e05f0++){var _0x4d8dcc=events[_0x8e05f0];var _0x216b4c=createListener(_0xa202('0x4')+_0x4d8dcc,_0x49e186);TeamEvents['on'](_0x4d8dcc,_0x216b4c);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 786c3df..2bdff98 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 _0x77cc=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','delete','destroy','exports','multer','path','express'];(function(_0x28d7c4,_0x197dfc){var _0x2f51cf=function(_0x4ea249){while(--_0x4ea249){_0x28d7c4['push'](_0x28d7c4['shift']());}};_0x2f51cf(++_0x197dfc);}(_0x77cc,0x1ed));var _0xc77c=function(_0x32a89b,_0xc3b8e2){_0x32a89b=_0x32a89b-0x0;var _0x119ba5=_0x77cc[_0x32a89b];return _0x119ba5;};'use strict';var multer=require(_0xc77c('0x0'));var util=require('util');var path=require(_0xc77c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc77c('0x2'));var router=express[_0xc77c('0x3')]();var auth=require(_0xc77c('0x4'));var interaction=require(_0xc77c('0x5'));var config=require(_0xc77c('0x6'));var controller=require('./template.controller');router['get']('/',auth[_0xc77c('0x7')](),controller[_0xc77c('0x8')]);router[_0xc77c('0x9')](_0xc77c('0xa'),auth[_0xc77c('0x7')](),controller[_0xc77c('0xb')]);router[_0xc77c('0xc')]('/',auth[_0xc77c('0x7')](),controller['create']);router['put']('/:id',auth[_0xc77c('0x7')](),controller['update']);router[_0xc77c('0xd')](_0xc77c('0xa'),auth[_0xc77c('0x7')](),controller[_0xc77c('0xe')]);module[_0xc77c('0xf')]=router; \ No newline at end of file +var _0x1b0d=['/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','put'];(function(_0x11ae49,_0x59de01){var _0x31be93=function(_0x42f145){while(--_0x42f145){_0x11ae49['push'](_0x11ae49['shift']());}};_0x31be93(++_0x59de01);}(_0x1b0d,0x1e0));var _0xd1b0=function(_0x4fd940,_0x40969f){_0x4fd940=_0x4fd940-0x0;var _0x23e599=_0x1b0d[_0x4fd940];return _0x23e599;};'use strict';var multer=require(_0xd1b0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd1b0('0x1'));var express=require(_0xd1b0('0x2'));var router=express[_0xd1b0('0x3')]();var auth=require(_0xd1b0('0x4'));var interaction=require(_0xd1b0('0x5'));var config=require(_0xd1b0('0x6'));var controller=require(_0xd1b0('0x7'));router[_0xd1b0('0x8')]('/',auth[_0xd1b0('0x9')](),controller[_0xd1b0('0xa')]);router[_0xd1b0('0x8')]('/:id',auth[_0xd1b0('0x9')](),controller[_0xd1b0('0xb')]);router[_0xd1b0('0xc')]('/',auth[_0xd1b0('0x9')](),controller['create']);router[_0xd1b0('0xd')](_0xd1b0('0xe'),auth[_0xd1b0('0x9')](),controller[_0xd1b0('0xf')]);router[_0xd1b0('0x10')](_0xd1b0('0xe'),auth[_0xd1b0('0x9')](),controller[_0xd1b0('0x11')]);module[_0xd1b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 86cae97..32311f4 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 _0xcc78=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc78,0xdb));var _0x8cc7=function(_0x59790c,_0x3f21a9){_0x59790c=_0x59790c-0x0;var _0x58ae3a=_0xcc78[_0x59790c];return _0x58ae3a;};'use strict';var Sequelize=require(_0x8cc7('0x0'));module[_0x8cc7('0x1')]={'name':{'type':Sequelize[_0x8cc7('0x2')]},'description':{'type':Sequelize[_0x8cc7('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf695=['TEXT','sequelize','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf695,0x103));var _0x5f69=function(_0x265340,_0x1281a9){_0x265340=_0x265340-0x0;var _0x451049=_0xf695[_0x265340];return _0x451049;};'use strict';var Sequelize=require(_0x5f69('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5f69('0x1')]},'html':{'type':Sequelize[_0x5f69('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 737f631..08981a0 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 _0xead1=['show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','Templates','UserProfileResource','end','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch'];(function(_0x10d020,_0x594e14){var _0x3c5ae7=function(_0x58c23b){while(--_0x58c23b){_0x10d020['push'](_0x10d020['shift']());}};_0x3c5ae7(++_0x594e14);}(_0xead1,0xff));var _0x1ead=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xead1[_0x481bf7];return _0x461787;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1ead('0x0'));var zipdir=require(_0x1ead('0x1'));var jsonpatch=require(_0x1ead('0x2'));var rp=require(_0x1ead('0x3'));var moment=require(_0x1ead('0x4'));var BPromise=require(_0x1ead('0x5'));var Mustache=require('mustache');var util=require(_0x1ead('0x6'));var path=require('path');var sox=require(_0x1ead('0x7'));var csv=require(_0x1ead('0x8'));var ejs=require(_0x1ead('0x9'));var fs=require('fs');var _=require(_0x1ead('0xa'));var squel=require('squel');var crypto=require(_0x1ead('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1ead('0xc'));var toCsv=require(_0x1ead('0x8'));var querystring=require(_0x1ead('0xd'));var Papa=require(_0x1ead('0xe'));var Redis=require('ioredis');var authService=require(_0x1ead('0xf'));var qs=require(_0x1ead('0x10'));var as=require(_0x1ead('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ead('0x12'))('api');var utils=require(_0x1ead('0x13'));var config=require(_0x1ead('0x14'));var db=require(_0x1ead('0x15'))['db'];function respondWithStatusCode(_0x4ebcd2,_0x4568fd){_0x4568fd=_0x4568fd||0xcc;return function(_0x333306){if(_0x333306){return _0x4ebcd2[_0x1ead('0x16')](_0x4568fd);}return _0x4ebcd2[_0x1ead('0x17')](_0x4568fd)['end']();};}function respondWithResult(_0x34785e,_0x26137e){_0x26137e=_0x26137e||0xc8;return function(_0x739ac1){if(_0x739ac1){return _0x34785e['status'](_0x26137e)[_0x1ead('0x18')](_0x739ac1);}};}function respondWithFilteredResult(_0x196995,_0x4dadad){return function(_0x4344b3){if(_0x4344b3){var _0x510b48=_0x4344b3[_0x1ead('0x19')],_0x32b3b6=_0x4dadad[_0x1ead('0x1a')],_0x42dbb0=_0x4dadad[_0x1ead('0x1a')]+_0x4dadad[_0x1ead('0x1b')],_0x4e6b06;if(_0x42dbb0>=_0x510b48){_0x42dbb0=_0x510b48;_0x4e6b06=0xc8;}else{_0x4e6b06=0xce;}_0x196995['status'](_0x4e6b06);return _0x196995['set'](_0x1ead('0x1c'),_0x32b3b6+'-'+_0x42dbb0+'/'+_0x510b48)[_0x1ead('0x18')](_0x4344b3);}return null;};}function patchUpdates(_0x41724b){return function(_0x31a744){try{jsonpatch[_0x1ead('0x1d')](_0x31a744,_0x41724b,!![]);}catch(_0x350685){return BPromise[_0x1ead('0x1e')](_0x350685);}return _0x31a744['save']();};}function saveUpdates(_0x290e9f,_0x44b4da){return function(_0x33241b){if(_0x33241b){return _0x33241b[_0x1ead('0x1f')](_0x290e9f)['then'](function(_0x4f616b){return _0x4f616b;});}return null;};}function removeEntity(_0xd074c5,_0x2ba15c){return function(_0x5161cf){if(_0x5161cf){return _0x5161cf[_0x1ead('0x20')]()[_0x1ead('0x21')](function(){var _0x2706ee=_0x5161cf['get']({'plain':!![]});var _0x489069=_0x1ead('0x22');return db[_0x1ead('0x23')]['destroy']({'where':{'type':_0x489069,'resourceId':_0x2706ee['id']}})[_0x1ead('0x21')](function(){return _0x5161cf;});})[_0x1ead('0x21')](function(){_0xd074c5['status'](0xcc)[_0x1ead('0x24')]();});}};}function handleEntityNotFound(_0x5779a7,_0xd80b26){return function(_0x39375f){if(!_0x39375f){_0x5779a7[_0x1ead('0x16')](0x194);}return _0x39375f;};}function handleError(_0x12166b,_0x32e01d){_0x32e01d=_0x32e01d||0x1f4;return function(_0x4a9e00){logger[_0x1ead('0x25')](_0x4a9e00[_0x1ead('0x26')]);if(_0x4a9e00[_0x1ead('0x27')]){delete _0x4a9e00[_0x1ead('0x27')];}_0x12166b[_0x1ead('0x17')](_0x32e01d)[_0x1ead('0x28')](_0x4a9e00);};}exports[_0x1ead('0x29')]=function(_0x76fed4,_0x2dbe1c){var _0x4b79da={},_0x4f154f={},_0x25020d={'count':0x0,'rows':[]};var _0xeaabed=_[_0x1ead('0x2a')](db[_0x1ead('0x2b')][_0x1ead('0x2c')],function(_0x1a7e87){return{'name':_0x1a7e87[_0x1ead('0x2d')],'type':_0x1a7e87[_0x1ead('0x2e')][_0x1ead('0x2f')]};});_0x4f154f[_0x1ead('0x30')]=_[_0x1ead('0x2a')](_0xeaabed,_0x1ead('0x27'));_0x4f154f[_0x1ead('0x31')]=_[_0x1ead('0x32')](_0x76fed4[_0x1ead('0x31')]);_0x4f154f[_0x1ead('0x33')]=_['intersection'](_0x4f154f[_0x1ead('0x30')],_0x4f154f['query']);_0x4b79da[_0x1ead('0x34')]=_[_0x1ead('0x35')](_0x4f154f[_0x1ead('0x30')],qs['fields'](_0x76fed4['query'][_0x1ead('0x36')]));_0x4b79da[_0x1ead('0x34')]=_0x4b79da[_0x1ead('0x34')][_0x1ead('0x37')]?_0x4b79da[_0x1ead('0x34')]:_0x4f154f[_0x1ead('0x30')];if(!_0x76fed4['query'][_0x1ead('0x38')](_0x1ead('0x39'))){_0x4b79da[_0x1ead('0x1b')]=qs[_0x1ead('0x1b')](_0x76fed4[_0x1ead('0x31')][_0x1ead('0x1b')]);_0x4b79da['offset']=qs[_0x1ead('0x1a')](_0x76fed4[_0x1ead('0x31')][_0x1ead('0x1a')]);}_0x4b79da[_0x1ead('0x3a')]=qs['sort'](_0x76fed4[_0x1ead('0x31')][_0x1ead('0x3b')]);_0x4b79da[_0x1ead('0x3c')]=qs[_0x1ead('0x33')](_[_0x1ead('0x3d')](_0x76fed4['query'],_0x4f154f[_0x1ead('0x33')]),_0xeaabed);if(_0x76fed4['query'][_0x1ead('0x3e')]){_0x4b79da['where']=_[_0x1ead('0x3f')](_0x4b79da[_0x1ead('0x3c')],{'$or':_[_0x1ead('0x2a')](_0xeaabed,function(_0x2c421b){if(_0x2c421b[_0x1ead('0x2e')]!==_0x1ead('0x40')){var _0x1a8652={};_0x1a8652[_0x2c421b[_0x1ead('0x27')]]={'$like':'%'+_0x76fed4['query'][_0x1ead('0x3e')]+'%'};return _0x1a8652;}})});}_0x4b79da=_[_0x1ead('0x3f')]({},_0x4b79da,_0x76fed4[_0x1ead('0x41')]);var _0x1a809={'where':_0x4b79da[_0x1ead('0x3c')]};return db[_0x1ead('0x2b')][_0x1ead('0x19')](_0x1a809)['then'](function(_0x1a215e){_0x25020d[_0x1ead('0x19')]=_0x1a215e;if(_0x76fed4[_0x1ead('0x31')][_0x1ead('0x42')]){_0x4b79da[_0x1ead('0x43')]=[{'all':!![]}];}return db[_0x1ead('0x2b')]['findAll'](_0x4b79da);})[_0x1ead('0x21')](function(_0x2541a1){_0x25020d['rows']=_0x2541a1;return _0x25020d;})[_0x1ead('0x21')](respondWithFilteredResult(_0x2dbe1c,_0x4b79da))[_0x1ead('0x44')](handleError(_0x2dbe1c,null));};exports[_0x1ead('0x45')]=function(_0x16d51d,_0x33ccf4){var _0x1b1d20={'raw':!![],'where':{'id':_0x16d51d[_0x1ead('0x46')]['id']}},_0x38e51d={};_0x38e51d['model']=_[_0x1ead('0x32')](db[_0x1ead('0x2b')][_0x1ead('0x2c')]);_0x38e51d[_0x1ead('0x31')]=_['keys'](_0x16d51d['query']);_0x38e51d['filters']=_[_0x1ead('0x35')](_0x38e51d['model'],_0x38e51d[_0x1ead('0x31')]);_0x1b1d20['attributes']=_[_0x1ead('0x35')](_0x38e51d[_0x1ead('0x30')],qs[_0x1ead('0x36')](_0x16d51d[_0x1ead('0x31')][_0x1ead('0x36')]));_0x1b1d20[_0x1ead('0x34')]=_0x1b1d20[_0x1ead('0x34')][_0x1ead('0x37')]?_0x1b1d20['attributes']:_0x38e51d[_0x1ead('0x30')];if(_0x16d51d[_0x1ead('0x31')][_0x1ead('0x42')]){_0x1b1d20[_0x1ead('0x43')]=[{'all':!![]}];}_0x1b1d20=_[_0x1ead('0x3f')]({},_0x1b1d20,_0x16d51d['options']);return db['Template'][_0x1ead('0x47')](_0x1b1d20)['then'](handleEntityNotFound(_0x33ccf4,null))[_0x1ead('0x21')](respondWithResult(_0x33ccf4,null))[_0x1ead('0x44')](handleError(_0x33ccf4,null));};exports['create']=function(_0x3cda08,_0x48b1ac){return db[_0x1ead('0x2b')][_0x1ead('0x48')](_0x3cda08[_0x1ead('0x49')],{})[_0x1ead('0x21')](function(_0x86a2c0){var _0x3feb73=_0x3cda08['user']['get']({'plain':!![]});if(!_0x3feb73)throw new Error(_0x1ead('0x4a'));if(_0x3feb73[_0x1ead('0x4b')]===_0x1ead('0x4c')){var _0x3d5599=_0x86a2c0[_0x1ead('0x4d')]({'plain':!![]});var _0x5a8d0d=_0x1ead('0x22');return db[_0x1ead('0x4e')][_0x1ead('0x47')]({'where':{'name':_0x5a8d0d,'userProfileId':_0x3feb73['userProfileId']},'raw':!![]})[_0x1ead('0x21')](function(_0x4df846){if(_0x4df846&&_0x4df846[_0x1ead('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x3d5599[_0x1ead('0x27')],'resourceId':_0x3d5599['id'],'type':_0x4df846[_0x1ead('0x27')],'sectionId':_0x4df846['id']},{})[_0x1ead('0x21')](function(){return _0x86a2c0;});}else{return _0x86a2c0;}})[_0x1ead('0x44')](function(_0x4e241f){logger[_0x1ead('0x25')](_0x1ead('0x50'),_0x4e241f);throw _0x4e241f;});}return _0x86a2c0;})[_0x1ead('0x21')](respondWithResult(_0x48b1ac,0xc9))[_0x1ead('0x44')](handleError(_0x48b1ac,null));};exports[_0x1ead('0x1f')]=function(_0x54f4a6,_0x2ee42a){if(_0x54f4a6[_0x1ead('0x49')]['id']){delete _0x54f4a6[_0x1ead('0x49')]['id'];}return db['Template'][_0x1ead('0x47')]({'where':{'id':_0x54f4a6[_0x1ead('0x46')]['id']}})[_0x1ead('0x21')](handleEntityNotFound(_0x2ee42a,null))['then'](saveUpdates(_0x54f4a6[_0x1ead('0x49')],null))[_0x1ead('0x21')](respondWithResult(_0x2ee42a,null))[_0x1ead('0x44')](handleError(_0x2ee42a,null));};exports[_0x1ead('0x20')]=function(_0x217f08,_0x1a8526){return db[_0x1ead('0x2b')][_0x1ead('0x47')]({'where':{'id':_0x217f08[_0x1ead('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a8526,null))[_0x1ead('0x21')](removeEntity(_0x1a8526,null))['catch'](handleError(_0x1a8526,null));}; \ No newline at end of file +var _0xca20=['fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','type','VIRTUAL','options','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','then','Templates','UserProfileResource','destroy','name','send','index','map','Template','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xca20,0x72));var _0x0ca2=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0xca20[_0x28f1de];return _0x5b5dad;};'use strict';var pdf=require(_0x0ca2('0x0'));var emlformat=require(_0x0ca2('0x1'));var rimraf=require(_0x0ca2('0x2'));var zipdir=require(_0x0ca2('0x3'));var jsonpatch=require(_0x0ca2('0x4'));var rp=require(_0x0ca2('0x5'));var moment=require(_0x0ca2('0x6'));var BPromise=require(_0x0ca2('0x7'));var Mustache=require(_0x0ca2('0x8'));var util=require(_0x0ca2('0x9'));var path=require(_0x0ca2('0xa'));var sox=require('sox');var csv=require(_0x0ca2('0xb'));var ejs=require(_0x0ca2('0xc'));var fs=require('fs');var _=require(_0x0ca2('0xd'));var squel=require(_0x0ca2('0xe'));var crypto=require(_0x0ca2('0xf'));var jsforce=require(_0x0ca2('0x10'));var deskjs=require(_0x0ca2('0x11'));var toCsv=require(_0x0ca2('0xb'));var querystring=require('querystring');var Papa=require(_0x0ca2('0x12'));var Redis=require(_0x0ca2('0x13'));var authService=require(_0x0ca2('0x14'));var qs=require(_0x0ca2('0x15'));var as=require(_0x0ca2('0x16'));var hardwareService=require(_0x0ca2('0x17'));var logger=require(_0x0ca2('0x18'))(_0x0ca2('0x19'));var utils=require(_0x0ca2('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a7c54,_0x381e5f){_0x381e5f=_0x381e5f||0xcc;return function(_0x5ee70b){if(_0x5ee70b){return _0x4a7c54[_0x0ca2('0x1b')](_0x381e5f);}return _0x4a7c54[_0x0ca2('0x1c')](_0x381e5f)[_0x0ca2('0x1d')]();};}function respondWithResult(_0x438eaf,_0x5f105b){_0x5f105b=_0x5f105b||0xc8;return function(_0x3102a0){if(_0x3102a0){return _0x438eaf[_0x0ca2('0x1c')](_0x5f105b)[_0x0ca2('0x1e')](_0x3102a0);}};}function respondWithFilteredResult(_0x3c9d83,_0x573f32){return function(_0x4f567d){if(_0x4f567d){var _0x9433aa=_0x4f567d[_0x0ca2('0x1f')],_0x22f771=_0x573f32['offset'],_0x3146fc=_0x573f32['offset']+_0x573f32[_0x0ca2('0x20')],_0x482c3c;if(_0x3146fc>=_0x9433aa){_0x3146fc=_0x9433aa;_0x482c3c=0xc8;}else{_0x482c3c=0xce;}_0x3c9d83[_0x0ca2('0x1c')](_0x482c3c);return _0x3c9d83[_0x0ca2('0x21')](_0x0ca2('0x22'),_0x22f771+'-'+_0x3146fc+'/'+_0x9433aa)[_0x0ca2('0x1e')](_0x4f567d);}return null;};}function patchUpdates(_0x1c4f63){return function(_0x1c4f4c){try{jsonpatch[_0x0ca2('0x23')](_0x1c4f4c,_0x1c4f63,!![]);}catch(_0x1a6805){return BPromise['reject'](_0x1a6805);}return _0x1c4f4c[_0x0ca2('0x24')]();};}function saveUpdates(_0x17d5cf,_0xf25c86){return function(_0x54b956){if(_0x54b956){return _0x54b956[_0x0ca2('0x25')](_0x17d5cf)[_0x0ca2('0x26')](function(_0x54e731){return _0x54e731;});}return null;};}function removeEntity(_0x446e33,_0x310892){return function(_0x554391){if(_0x554391){return _0x554391['destroy']()[_0x0ca2('0x26')](function(){var _0x1e7723=_0x554391['get']({'plain':!![]});var _0x65980e=_0x0ca2('0x27');return db[_0x0ca2('0x28')][_0x0ca2('0x29')]({'where':{'type':_0x65980e,'resourceId':_0x1e7723['id']}})[_0x0ca2('0x26')](function(){return _0x554391;});})['then'](function(){_0x446e33[_0x0ca2('0x1c')](0xcc)[_0x0ca2('0x1d')]();});}};}function handleEntityNotFound(_0x5f1c8b,_0x2916e8){return function(_0x2a937f){if(!_0x2a937f){_0x5f1c8b[_0x0ca2('0x1b')](0x194);}return _0x2a937f;};}function handleError(_0x3b94f3,_0x35a0a5){_0x35a0a5=_0x35a0a5||0x1f4;return function(_0x31ec17){logger['error'](_0x31ec17['stack']);if(_0x31ec17[_0x0ca2('0x2a')]){delete _0x31ec17[_0x0ca2('0x2a')];}_0x3b94f3[_0x0ca2('0x1c')](_0x35a0a5)[_0x0ca2('0x2b')](_0x31ec17);};}exports[_0x0ca2('0x2c')]=function(_0x4d857b,_0x3a06cd){var _0xdb0402={},_0x1da6da={},_0x354587={'count':0x0,'rows':[]};var _0xf98f62=_[_0x0ca2('0x2d')](db[_0x0ca2('0x2e')][_0x0ca2('0x2f')],function(_0x5569c4){return{'name':_0x5569c4[_0x0ca2('0x30')],'type':_0x5569c4['type'][_0x0ca2('0x31')]};});_0x1da6da[_0x0ca2('0x32')]=_['map'](_0xf98f62,_0x0ca2('0x2a'));_0x1da6da[_0x0ca2('0x33')]=_[_0x0ca2('0x34')](_0x4d857b[_0x0ca2('0x33')]);_0x1da6da[_0x0ca2('0x35')]=_['intersection'](_0x1da6da['model'],_0x1da6da['query']);_0xdb0402[_0x0ca2('0x36')]=_[_0x0ca2('0x37')](_0x1da6da[_0x0ca2('0x32')],qs[_0x0ca2('0x38')](_0x4d857b[_0x0ca2('0x33')]['fields']));_0xdb0402['attributes']=_0xdb0402[_0x0ca2('0x36')][_0x0ca2('0x39')]?_0xdb0402[_0x0ca2('0x36')]:_0x1da6da[_0x0ca2('0x32')];if(!_0x4d857b[_0x0ca2('0x33')][_0x0ca2('0x3a')](_0x0ca2('0x3b'))){_0xdb0402['limit']=qs[_0x0ca2('0x20')](_0x4d857b[_0x0ca2('0x33')][_0x0ca2('0x20')]);_0xdb0402[_0x0ca2('0x3c')]=qs[_0x0ca2('0x3c')](_0x4d857b['query']['offset']);}_0xdb0402[_0x0ca2('0x3d')]=qs[_0x0ca2('0x3e')](_0x4d857b[_0x0ca2('0x33')]['sort']);_0xdb0402['where']=qs['filters'](_[_0x0ca2('0x3f')](_0x4d857b[_0x0ca2('0x33')],_0x1da6da[_0x0ca2('0x35')]),_0xf98f62);if(_0x4d857b[_0x0ca2('0x33')]['filter']){_0xdb0402[_0x0ca2('0x40')]=_[_0x0ca2('0x41')](_0xdb0402[_0x0ca2('0x40')],{'$or':_[_0x0ca2('0x2d')](_0xf98f62,function(_0x410e1b){if(_0x410e1b[_0x0ca2('0x42')]!==_0x0ca2('0x43')){var _0x5093e2={};_0x5093e2[_0x410e1b[_0x0ca2('0x2a')]]={'$like':'%'+_0x4d857b['query']['filter']+'%'};return _0x5093e2;}})});}_0xdb0402=_[_0x0ca2('0x41')]({},_0xdb0402,_0x4d857b[_0x0ca2('0x44')]);var _0x5783f7={'where':_0xdb0402[_0x0ca2('0x40')]};return db[_0x0ca2('0x2e')][_0x0ca2('0x1f')](_0x5783f7)[_0x0ca2('0x26')](function(_0x509991){_0x354587[_0x0ca2('0x1f')]=_0x509991;if(_0x4d857b[_0x0ca2('0x33')]['includeAll']){_0xdb0402[_0x0ca2('0x45')]=[{'all':!![]}];}return db[_0x0ca2('0x2e')]['findAll'](_0xdb0402);})[_0x0ca2('0x26')](function(_0x1cff69){_0x354587[_0x0ca2('0x46')]=_0x1cff69;return _0x354587;})['then'](respondWithFilteredResult(_0x3a06cd,_0xdb0402))[_0x0ca2('0x47')](handleError(_0x3a06cd,null));};exports[_0x0ca2('0x48')]=function(_0x11912a,_0x5a61fd){var _0x18944d={'raw':!![],'where':{'id':_0x11912a[_0x0ca2('0x49')]['id']}},_0x2e1c36={};_0x2e1c36[_0x0ca2('0x32')]=_['keys'](db[_0x0ca2('0x2e')][_0x0ca2('0x2f')]);_0x2e1c36[_0x0ca2('0x33')]=_[_0x0ca2('0x34')](_0x11912a['query']);_0x2e1c36[_0x0ca2('0x35')]=_['intersection'](_0x2e1c36[_0x0ca2('0x32')],_0x2e1c36[_0x0ca2('0x33')]);_0x18944d[_0x0ca2('0x36')]=_[_0x0ca2('0x37')](_0x2e1c36[_0x0ca2('0x32')],qs[_0x0ca2('0x38')](_0x11912a['query'][_0x0ca2('0x38')]));_0x18944d[_0x0ca2('0x36')]=_0x18944d[_0x0ca2('0x36')][_0x0ca2('0x39')]?_0x18944d[_0x0ca2('0x36')]:_0x2e1c36[_0x0ca2('0x32')];if(_0x11912a['query']['includeAll']){_0x18944d[_0x0ca2('0x45')]=[{'all':!![]}];}_0x18944d=_[_0x0ca2('0x41')]({},_0x18944d,_0x11912a['options']);return db[_0x0ca2('0x2e')][_0x0ca2('0x4a')](_0x18944d)[_0x0ca2('0x26')](handleEntityNotFound(_0x5a61fd,null))[_0x0ca2('0x26')](respondWithResult(_0x5a61fd,null))['catch'](handleError(_0x5a61fd,null));};exports['create']=function(_0xce8f68,_0x47ad39){return db['Template'][_0x0ca2('0x4b')](_0xce8f68[_0x0ca2('0x4c')],{})[_0x0ca2('0x26')](function(_0x24fb54){var _0x13e6d4=_0xce8f68[_0x0ca2('0x4d')][_0x0ca2('0x4e')]({'plain':!![]});if(!_0x13e6d4)throw new Error(_0x0ca2('0x4f'));if(_0x13e6d4[_0x0ca2('0x50')]===_0x0ca2('0x4d')){var _0x3ecbff=_0x24fb54[_0x0ca2('0x4e')]({'plain':!![]});var _0x1d44b4=_0x0ca2('0x27');return db[_0x0ca2('0x51')]['find']({'where':{'name':_0x1d44b4,'userProfileId':_0x13e6d4[_0x0ca2('0x52')]},'raw':!![]})['then'](function(_0x438080){if(_0x438080&&_0x438080[_0x0ca2('0x53')]===0x0){return db['UserProfileResource'][_0x0ca2('0x4b')]({'name':_0x3ecbff['name'],'resourceId':_0x3ecbff['id'],'type':_0x438080[_0x0ca2('0x2a')],'sectionId':_0x438080['id']},{})[_0x0ca2('0x26')](function(){return _0x24fb54;});}else{return _0x24fb54;}})[_0x0ca2('0x47')](function(_0x27f9f5){logger['error'](_0x0ca2('0x54'),_0x27f9f5);throw _0x27f9f5;});}return _0x24fb54;})[_0x0ca2('0x26')](respondWithResult(_0x47ad39,0xc9))[_0x0ca2('0x47')](handleError(_0x47ad39,null));};exports[_0x0ca2('0x25')]=function(_0x1c85aa,_0x4b340b){if(_0x1c85aa[_0x0ca2('0x4c')]['id']){delete _0x1c85aa['body']['id'];}return db[_0x0ca2('0x2e')][_0x0ca2('0x4a')]({'where':{'id':_0x1c85aa[_0x0ca2('0x49')]['id']}})[_0x0ca2('0x26')](handleEntityNotFound(_0x4b340b,null))[_0x0ca2('0x26')](saveUpdates(_0x1c85aa[_0x0ca2('0x4c')],null))[_0x0ca2('0x26')](respondWithResult(_0x4b340b,null))[_0x0ca2('0x47')](handleError(_0x4b340b,null));};exports['destroy']=function(_0x197b6d,_0x2ffa8c){return db[_0x0ca2('0x2e')][_0x0ca2('0x4a')]({'where':{'id':_0x197b6d[_0x0ca2('0x49')]['id']}})[_0x0ca2('0x26')](handleEntityNotFound(_0x2ffa8c,null))['then'](removeEntity(_0x2ffa8c,null))['catch'](handleError(_0x2ffa8c,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0e39595..5e907a2 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 _0x10e7=['rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x27773e,_0x1fb5bd){var _0x24895c=function(_0x2c240d){while(--_0x2c240d){_0x27773e['push'](_0x27773e['shift']());}};_0x24895c(++_0x1fb5bd);}(_0x10e7,0x6f));var _0x710e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x10e7[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x710e('0x0'));var util=require(_0x710e('0x1'));var logger=require(_0x710e('0x2'))(_0x710e('0x3'));var moment=require(_0x710e('0x4'));var BPromise=require(_0x710e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x710e('0x6'));var config=require(_0x710e('0x7'));var attributes=require(_0x710e('0x8'));module[_0x710e('0x9')]=function(_0x5bf7cb,_0x378caa){return _0x5bf7cb[_0x710e('0xa')](_0x710e('0xb'),attributes,{'tableName':_0x710e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a5=['moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','util','../../config/logger','api'];(function(_0x448f4d,_0x437a06){var _0x1d950e=function(_0x1528ba){while(--_0x1528ba){_0x448f4d['push'](_0x448f4d['shift']());}};_0x1d950e(++_0x437a06);}(_0xc2a5,0x14e));var _0x5c2a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc2a5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5c2a('0x0'));var util=require(_0x5c2a('0x1'));var logger=require(_0x5c2a('0x2'))(_0x5c2a('0x3'));var moment=require(_0x5c2a('0x4'));var BPromise=require('bluebird');var rp=require(_0x5c2a('0x5'));var fs=require('fs');var path=require(_0x5c2a('0x6'));var rimraf=require(_0x5c2a('0x7'));var config=require(_0x5c2a('0x8'));var attributes=require(_0x5c2a('0x9'));module[_0x5c2a('0xa')]=function(_0x14c4ad,_0x45da5b){return _0x14c4ad['define'](_0x5c2a('0xb'),attributes,{'tableName':_0x5c2a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index a558785..4a1e23c 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 _0x5550=['limit','include','map','model','attributes','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','message','catch','GetTemplate','Template','findAll','options','raw','where'];(function(_0x1bc750,_0x23f442){var _0xcd51da=function(_0x323854){while(--_0x323854){_0x1bc750['push'](_0x1bc750['shift']());}};_0xcd51da(++_0x23f442);}(_0x5550,0x179));var _0x0555=function(_0x1cbb99,_0x33d4e0){_0x1cbb99=_0x1cbb99-0x0;var _0x1ee9c1=_0x5550[_0x1cbb99];return _0x1ee9c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0555('0x0'));var rs=require(_0x0555('0x1'));var fs=require('fs');var Redis=require(_0x0555('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0555('0x3'))(_0x0555('0x4'));var config=require(_0x0555('0x5'));var jayson=require(_0x0555('0x6'));var client=jayson[_0x0555('0x7')][_0x0555('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa5cf01,_0x4c38a4,_0x57c2db){return new BPromise(function(_0x11486a,_0x5be5e1){return client[_0x0555('0x9')](_0xa5cf01,_0x57c2db)[_0x0555('0xa')](function(_0x533f2e){logger[_0x0555('0xb')]('Template,\x20%s,\x20%s',_0x4c38a4,_0x0555('0xc'));logger[_0x0555('0xd')](_0x0555('0xe'),_0x4c38a4,_0x0555('0xc'),JSON['stringify'](_0x533f2e));if(_0x533f2e[_0x0555('0xf')]){if(_0x533f2e['error'][_0x0555('0x10')]===0x1f4){logger['error'](_0x0555('0x11'),_0x4c38a4,_0x533f2e[_0x0555('0xf')][_0x0555('0x12')]);return _0x5be5e1(_0x533f2e[_0x0555('0xf')]['message']);}logger[_0x0555('0xf')]('Template,\x20%s,\x20%s',_0x4c38a4,_0x533f2e[_0x0555('0xf')]['message']);return _0x11486a(_0x533f2e[_0x0555('0xf')][_0x0555('0x12')]);}else{logger['info'](_0x0555('0x11'),_0x4c38a4,_0x0555('0xc'));_0x11486a(_0x533f2e['result'][_0x0555('0x12')]);}})[_0x0555('0x13')](function(_0x589047){logger[_0x0555('0xf')]('Template,\x20%s,\x20%s',_0x4c38a4,_0x589047);_0x5be5e1(_0x589047);});});}exports[_0x0555('0x14')]=function(_0x11719c){var _0x10cd46=this;return new Promise(function(_0x161b71,_0x21df75){return db[_0x0555('0x15')][_0x0555('0x16')]({'raw':_0x11719c[_0x0555('0x17')]?_0x11719c['options'][_0x0555('0x18')]===undefined?!![]:![]:!![],'where':_0x11719c[_0x0555('0x17')]?_0x11719c[_0x0555('0x17')][_0x0555('0x19')]||null:null,'attributes':_0x11719c['options']?_0x11719c['options']['attributes']||null:null,'limit':_0x11719c[_0x0555('0x17')]?_0x11719c[_0x0555('0x17')][_0x0555('0x1a')]||null:null,'include':_0x11719c[_0x0555('0x17')]?_0x11719c[_0x0555('0x17')][_0x0555('0x1b')]?_[_0x0555('0x1c')](_0x11719c[_0x0555('0x17')][_0x0555('0x1b')],function(_0x26babf){return{'model':db[_0x26babf[_0x0555('0x1d')]],'as':_0x26babf['as'],'attributes':_0x26babf['attributes'],'include':_0x26babf['include']?_['map'](_0x26babf[_0x0555('0x1b')],function(_0x5163ab){return{'model':db[_0x5163ab[_0x0555('0x1d')]],'as':_0x5163ab['as'],'attributes':_0x5163ab[_0x0555('0x1e')],'include':_0x5163ab['include']?_[_0x0555('0x1c')](_0x5163ab[_0x0555('0x1b')],function(_0xbd6eb){return{'model':db[_0xbd6eb['model']],'as':_0xbd6eb['as'],'attributes':_0xbd6eb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56fa7d){logger[_0x0555('0xb')](_0x0555('0x14'),_0x11719c);logger[_0x0555('0xd')](_0x0555('0x14'),_0x11719c,JSON['stringify'](_0x56fa7d));_0x161b71(_0x56fa7d);})[_0x0555('0x13')](function(_0x2668de){logger[_0x0555('0xf')](_0x0555('0x14'),_0x2668de[_0x0555('0x12')],_0x11719c);_0x21df75(_0x10cd46[_0x0555('0xf')](0x1f4,_0x2668de[_0x0555('0x12')]));});});}; \ No newline at end of file +var _0xfd94=['Template','findAll','options','raw','limit','include','map','model','attributes','debug','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetTemplate'];(function(_0x4ebf10,_0x2ea42a){var _0x12453b=function(_0x13643b){while(--_0x13643b){_0x4ebf10['push'](_0x4ebf10['shift']());}};_0x12453b(++_0x2ea42a);}(_0xfd94,0x1bc));var _0x4fd9=function(_0x4b067d,_0x5d7bb5){_0x4b067d=_0x4b067d-0x0;var _0x273272=_0xfd94[_0x4b067d];return _0x273272;};'use strict';var _=require(_0x4fd9('0x0'));var util=require('util');var moment=require(_0x4fd9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fd9('0x2'));var db=require(_0x4fd9('0x3'))['db'];var utils=require(_0x4fd9('0x4'));var logger=require(_0x4fd9('0x5'))(_0x4fd9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4fd9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e7212,_0x4c875c,_0x3453a1){return new BPromise(function(_0x3345fa,_0x1319d6){return client[_0x4fd9('0x8')](_0x5e7212,_0x3453a1)[_0x4fd9('0x9')](function(_0x58de8f){logger[_0x4fd9('0xa')](_0x4fd9('0xb'),_0x4c875c,'request\x20sent');logger['debug'](_0x4fd9('0xc'),_0x4c875c,'request\x20sent',JSON[_0x4fd9('0xd')](_0x58de8f));if(_0x58de8f['error']){if(_0x58de8f[_0x4fd9('0xe')][_0x4fd9('0xf')]===0x1f4){logger[_0x4fd9('0xe')]('Template,\x20%s,\x20%s',_0x4c875c,_0x58de8f[_0x4fd9('0xe')][_0x4fd9('0x10')]);return _0x1319d6(_0x58de8f[_0x4fd9('0xe')][_0x4fd9('0x10')]);}logger[_0x4fd9('0xe')](_0x4fd9('0xb'),_0x4c875c,_0x58de8f[_0x4fd9('0xe')]['message']);return _0x3345fa(_0x58de8f[_0x4fd9('0xe')][_0x4fd9('0x10')]);}else{logger[_0x4fd9('0xa')](_0x4fd9('0xb'),_0x4c875c,_0x4fd9('0x11'));_0x3345fa(_0x58de8f[_0x4fd9('0x12')][_0x4fd9('0x10')]);}})[_0x4fd9('0x13')](function(_0x2368b8){logger[_0x4fd9('0xe')](_0x4fd9('0xb'),_0x4c875c,_0x2368b8);_0x1319d6(_0x2368b8);});});}exports[_0x4fd9('0x14')]=function(_0x67b81a){var _0x22e3c0=this;return new Promise(function(_0x13060b,_0x488267){return db[_0x4fd9('0x15')][_0x4fd9('0x16')]({'raw':_0x67b81a['options']?_0x67b81a[_0x4fd9('0x17')][_0x4fd9('0x18')]===undefined?!![]:![]:!![],'where':_0x67b81a[_0x4fd9('0x17')]?_0x67b81a['options']['where']||null:null,'attributes':_0x67b81a['options']?_0x67b81a[_0x4fd9('0x17')]['attributes']||null:null,'limit':_0x67b81a[_0x4fd9('0x17')]?_0x67b81a['options'][_0x4fd9('0x19')]||null:null,'include':_0x67b81a[_0x4fd9('0x17')]?_0x67b81a['options'][_0x4fd9('0x1a')]?_[_0x4fd9('0x1b')](_0x67b81a['options'][_0x4fd9('0x1a')],function(_0x68e735){return{'model':db[_0x68e735[_0x4fd9('0x1c')]],'as':_0x68e735['as'],'attributes':_0x68e735[_0x4fd9('0x1d')],'include':_0x68e735[_0x4fd9('0x1a')]?_[_0x4fd9('0x1b')](_0x68e735[_0x4fd9('0x1a')],function(_0x384d22){return{'model':db[_0x384d22[_0x4fd9('0x1c')]],'as':_0x384d22['as'],'attributes':_0x384d22[_0x4fd9('0x1d')],'include':_0x384d22[_0x4fd9('0x1a')]?_[_0x4fd9('0x1b')](_0x384d22['include'],function(_0x40642c){return{'model':db[_0x40642c[_0x4fd9('0x1c')]],'as':_0x40642c['as'],'attributes':_0x40642c[_0x4fd9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x548512){logger['info'](_0x4fd9('0x14'),_0x67b81a);logger[_0x4fd9('0x1e')](_0x4fd9('0x14'),_0x67b81a,JSON[_0x4fd9('0xd')](_0x548512));_0x13060b(_0x548512);})[_0x4fd9('0x13')](function(_0x1cecd3){logger['error'](_0x4fd9('0x14'),_0x1cecd3[_0x4fd9('0x10')],_0x67b81a);_0x488267(_0x22e3c0['error'](0x1f4,_0x1cecd3[_0x4fd9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 63b881d..863ec5c 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 _0x0c7d=['Router','../../components/interaction/service','get','isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAction','put','/:id','update','delete','destroy','exports','util','path','express'];(function(_0x42aba3,_0x4ef48f){var _0x33b03c=function(_0x424739){while(--_0x424739){_0x42aba3['push'](_0x42aba3['shift']());}};_0x33b03c(++_0x4ef48f);}(_0x0c7d,0x1e0));var _0xd0c7=function(_0x102b48,_0x1ffa36){_0x102b48=_0x102b48-0x0;var _0x1819c4=_0x0c7d[_0x102b48];return _0x1819c4;};'use strict';var multer=require('multer');var util=require(_0xd0c7('0x0'));var path=require(_0xd0c7('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0c7('0x2'));var router=express[_0xd0c7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd0c7('0x4'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xd0c7('0x5')]('/',auth[_0xd0c7('0x6')](),controller[_0xd0c7('0x7')]);router[_0xd0c7('0x5')]('/:id',auth[_0xd0c7('0x6')](),controller[_0xd0c7('0x8')]);router['get'](_0xd0c7('0x9'),auth[_0xd0c7('0x6')](),controller['getAllConditions']);router['get'](_0xd0c7('0xa'),auth['isAuthenticated'](),controller[_0xd0c7('0xb')]);router[_0xd0c7('0x5')](_0xd0c7('0xc'),auth['isAuthenticated'](),controller['getActions']);router[_0xd0c7('0xd')]('/',auth[_0xd0c7('0x6')](),controller[_0xd0c7('0xe')]);router[_0xd0c7('0xd')](_0xd0c7('0x9'),auth[_0xd0c7('0x6')](),controller[_0xd0c7('0xf')]);router['post'](_0xd0c7('0xa'),auth[_0xd0c7('0x6')](),controller['addAnyCondition']);router['post'](_0xd0c7('0xc'),auth[_0xd0c7('0x6')](),controller[_0xd0c7('0x10')]);router[_0xd0c7('0x11')](_0xd0c7('0x12'),auth[_0xd0c7('0x6')](),controller[_0xd0c7('0x13')]);router[_0xd0c7('0x14')](_0xd0c7('0x12'),auth['isAuthenticated'](),controller[_0xd0c7('0x15')]);module[_0xd0c7('0x16')]=router; \ No newline at end of file +var _0x724b=['getActions','post','create','/:id/any_conditions','addAnyCondition','addAction','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','getAllConditions','getAnyConditions','/:id/actions'];(function(_0x54c0e4,_0x38fbe6){var _0x33e259=function(_0x265a3f){while(--_0x265a3f){_0x54c0e4['push'](_0x54c0e4['shift']());}};_0x33e259(++_0x38fbe6);}(_0x724b,0x1e9));var _0xb724=function(_0x230333,_0x351eb2){_0x230333=_0x230333-0x0;var _0x2b012e=_0x724b[_0x230333];return _0x2b012e;};'use strict';var multer=require(_0xb724('0x0'));var util=require(_0xb724('0x1'));var path=require(_0xb724('0x2'));var timeout=require(_0xb724('0x3'));var express=require(_0xb724('0x4'));var router=express[_0xb724('0x5')]();var auth=require(_0xb724('0x6'));var interaction=require(_0xb724('0x7'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0xb724('0x8')](),controller[_0xb724('0x9')]);router[_0xb724('0xa')](_0xb724('0xb'),auth[_0xb724('0x8')](),controller['show']);router[_0xb724('0xa')]('/:id/all_conditions',auth[_0xb724('0x8')](),controller[_0xb724('0xc')]);router['get']('/:id/any_conditions',auth[_0xb724('0x8')](),controller[_0xb724('0xd')]);router[_0xb724('0xa')](_0xb724('0xe'),auth['isAuthenticated'](),controller[_0xb724('0xf')]);router[_0xb724('0x10')]('/',auth[_0xb724('0x8')](),controller[_0xb724('0x11')]);router[_0xb724('0x10')]('/:id/all_conditions',auth[_0xb724('0x8')](),controller['addAllCondition']);router[_0xb724('0x10')](_0xb724('0x12'),auth[_0xb724('0x8')](),controller[_0xb724('0x13')]);router[_0xb724('0x10')](_0xb724('0xe'),auth['isAuthenticated'](),controller[_0xb724('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb724('0x15')]);router[_0xb724('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb724('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d73c9fd..96b9b30 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 _0x3a56=['STRING','sequelize','exports'];(function(_0x29edb5,_0x5bdc4f){var _0x3218ee=function(_0x52e3dd){while(--_0x52e3dd){_0x29edb5['push'](_0x29edb5['shift']());}};_0x3218ee(++_0x5bdc4f);}(_0x3a56,0x160));var _0x63a5=function(_0xf93076,_0x1acb30){_0xf93076=_0xf93076-0x0;var _0x33d1da=_0x3a56[_0xf93076];return _0x33d1da;};'use strict';var Sequelize=require(_0x63a5('0x0'));module[_0x63a5('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x63a5('0x2')]},'description':{'type':Sequelize[_0x63a5('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2afa=['STRING','BOOLEAN','sequelize','exports'];(function(_0x25c020,_0x1a1db6){var _0xa05517=function(_0x5f17d7){while(--_0x5f17d7){_0x25c020['push'](_0x25c020['shift']());}};_0xa05517(++_0x1a1db6);}(_0x2afa,0x6e));var _0xa2af=function(_0x5a7790,_0x29dce2){_0x5a7790=_0x5a7790-0x0;var _0x23dc47=_0x2afa[_0x5a7790];return _0x23dc47;};'use strict';var Sequelize=require(_0xa2af('0x0'));module[_0xa2af('0x1')]={'name':{'type':Sequelize[_0xa2af('0x2')]},'channel':{'type':Sequelize[_0xa2af('0x2')]},'description':{'type':Sequelize[_0xa2af('0x2')]},'status':{'type':Sequelize[_0xa2af('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 627c02c..9bc6d02 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 _0x99fc=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trigger','include','rows','catch','show','params','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource'];(function(_0x2e15c0,_0x1d4e79){var _0x385d1b=function(_0x1cc592){while(--_0x1cc592){_0x2e15c0['push'](_0x2e15c0['shift']());}};_0x385d1b(++_0x1d4e79);}(_0x99fc,0x1ed));var _0xc99f=function(_0x350b69,_0x41fc00){_0x350b69=_0x350b69-0x0;var _0x2872aa=_0x99fc[_0x350b69];return _0x2872aa;};'use strict';var pdf=require(_0xc99f('0x0'));var emlformat=require(_0xc99f('0x1'));var rimraf=require(_0xc99f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc99f('0x3'));var rp=require(_0xc99f('0x4'));var moment=require(_0xc99f('0x5'));var BPromise=require(_0xc99f('0x6'));var Mustache=require(_0xc99f('0x7'));var util=require(_0xc99f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc99f('0x9'));var ejs=require(_0xc99f('0xa'));var fs=require('fs');var _=require(_0xc99f('0xb'));var squel=require(_0xc99f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc99f('0xd'));var toCsv=require(_0xc99f('0x9'));var querystring=require(_0xc99f('0xe'));var Papa=require('papaparse');var Redis=require(_0xc99f('0xf'));var authService=require(_0xc99f('0x10'));var qs=require(_0xc99f('0x11'));var as=require(_0xc99f('0x12'));var hardwareService=require(_0xc99f('0x13'));var logger=require(_0xc99f('0x14'))(_0xc99f('0x15'));var utils=require(_0xc99f('0x16'));var config=require('../../config/environment');var db=require(_0xc99f('0x17'))['db'];function respondWithStatusCode(_0x5bf460,_0xef636c){_0xef636c=_0xef636c||0xcc;return function(_0x454e10){if(_0x454e10){return _0x5bf460[_0xc99f('0x18')](_0xef636c);}return _0x5bf460[_0xc99f('0x19')](_0xef636c)[_0xc99f('0x1a')]();};}function respondWithResult(_0x8cacd6,_0x43229e){_0x43229e=_0x43229e||0xc8;return function(_0x349d5e){if(_0x349d5e){return _0x8cacd6['status'](_0x43229e)[_0xc99f('0x1b')](_0x349d5e);}};}function respondWithFilteredResult(_0x354f7d,_0x338cd7){return function(_0x7f1b0c){if(_0x7f1b0c){var _0x18dbaa=_0x7f1b0c[_0xc99f('0x1c')],_0x1edaae=_0x338cd7[_0xc99f('0x1d')],_0x50e1bf=_0x338cd7[_0xc99f('0x1d')]+_0x338cd7[_0xc99f('0x1e')],_0x45ad96;if(_0x50e1bf>=_0x18dbaa){_0x50e1bf=_0x18dbaa;_0x45ad96=0xc8;}else{_0x45ad96=0xce;}_0x354f7d[_0xc99f('0x19')](_0x45ad96);return _0x354f7d[_0xc99f('0x1f')](_0xc99f('0x20'),_0x1edaae+'-'+_0x50e1bf+'/'+_0x18dbaa)[_0xc99f('0x1b')](_0x7f1b0c);}return null;};}function patchUpdates(_0x34e2b8){return function(_0x3f5997){try{jsonpatch[_0xc99f('0x21')](_0x3f5997,_0x34e2b8,!![]);}catch(_0x3d46a6){return BPromise[_0xc99f('0x22')](_0x3d46a6);}return _0x3f5997[_0xc99f('0x23')]();};}function saveUpdates(_0x44707f,_0x22542a){return function(_0x4045d4){if(_0x4045d4){return _0x4045d4[_0xc99f('0x24')](_0x44707f)[_0xc99f('0x25')](function(_0x611c39){return _0x611c39;});}return null;};}function removeEntity(_0x1c95a5,_0x41ba4e){return function(_0x5cdf30){if(_0x5cdf30){return _0x5cdf30[_0xc99f('0x26')]()[_0xc99f('0x25')](function(){var _0x3dbc16=_0x5cdf30[_0xc99f('0x27')]({'plain':!![]});var _0x247932=_0xc99f('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x247932,'resourceId':_0x3dbc16['id']}})[_0xc99f('0x25')](function(){return _0x5cdf30;});})[_0xc99f('0x25')](function(){_0x1c95a5[_0xc99f('0x19')](0xcc)[_0xc99f('0x1a')]();});}};}function handleEntityNotFound(_0x4ad609,_0x2c86c2){return function(_0x397f4a){if(!_0x397f4a){_0x4ad609['sendStatus'](0x194);}return _0x397f4a;};}function handleError(_0x3f065d,_0x49d62e){_0x49d62e=_0x49d62e||0x1f4;return function(_0x51eadc){logger[_0xc99f('0x29')](_0x51eadc['stack']);if(_0x51eadc[_0xc99f('0x2a')]){delete _0x51eadc['name'];}_0x3f065d['status'](_0x49d62e)[_0xc99f('0x2b')](_0x51eadc);};}exports[_0xc99f('0x2c')]=function(_0x150cef,_0x2023f5){var _0x27be32={},_0x436612={},_0x354212={'count':0x0,'rows':[]};var _0x3d9529=_[_0xc99f('0x2d')](db['Trigger'][_0xc99f('0x2e')],function(_0xdafc45){return{'name':_0xdafc45[_0xc99f('0x2f')],'type':_0xdafc45['type']['key']};});_0x436612[_0xc99f('0x30')]=_[_0xc99f('0x2d')](_0x3d9529,_0xc99f('0x2a'));_0x436612[_0xc99f('0x31')]=_[_0xc99f('0x32')](_0x150cef['query']);_0x436612[_0xc99f('0x33')]=_[_0xc99f('0x34')](_0x436612[_0xc99f('0x30')],_0x436612['query']);_0x27be32['attributes']=_[_0xc99f('0x34')](_0x436612[_0xc99f('0x30')],qs[_0xc99f('0x35')](_0x150cef[_0xc99f('0x31')][_0xc99f('0x35')]));_0x27be32['attributes']=_0x27be32[_0xc99f('0x36')][_0xc99f('0x37')]?_0x27be32[_0xc99f('0x36')]:_0x436612[_0xc99f('0x30')];if(!_0x150cef[_0xc99f('0x31')][_0xc99f('0x38')](_0xc99f('0x39'))){_0x27be32['limit']=qs[_0xc99f('0x1e')](_0x150cef[_0xc99f('0x31')][_0xc99f('0x1e')]);_0x27be32[_0xc99f('0x1d')]=qs[_0xc99f('0x1d')](_0x150cef[_0xc99f('0x31')]['offset']);}_0x27be32[_0xc99f('0x3a')]=qs[_0xc99f('0x3b')](_0x150cef['query'][_0xc99f('0x3b')]);_0x27be32[_0xc99f('0x3c')]=qs['filters'](_[_0xc99f('0x3d')](_0x150cef[_0xc99f('0x31')],_0x436612[_0xc99f('0x33')]),_0x3d9529);if(_0x150cef['query'][_0xc99f('0x3e')]){_0x27be32[_0xc99f('0x3c')]=_[_0xc99f('0x3f')](_0x27be32['where'],{'$or':_['map'](_0x3d9529,function(_0xef0b4d){if(_0xef0b4d[_0xc99f('0x40')]!==_0xc99f('0x41')){var _0x5d5bc7={};_0x5d5bc7[_0xef0b4d['name']]={'$like':'%'+_0x150cef[_0xc99f('0x31')][_0xc99f('0x3e')]+'%'};return _0x5d5bc7;}})});}_0x27be32=_[_0xc99f('0x3f')]({},_0x27be32,_0x150cef[_0xc99f('0x42')]);var _0xfd3d53={'where':_0x27be32[_0xc99f('0x3c')]};return db[_0xc99f('0x43')][_0xc99f('0x1c')](_0xfd3d53)[_0xc99f('0x25')](function(_0x51417e){_0x354212[_0xc99f('0x1c')]=_0x51417e;if(_0x150cef[_0xc99f('0x31')]['includeAll']){_0x27be32[_0xc99f('0x44')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x27be32);})[_0xc99f('0x25')](function(_0xdd4d25){_0x354212[_0xc99f('0x45')]=_0xdd4d25;return _0x354212;})[_0xc99f('0x25')](respondWithFilteredResult(_0x2023f5,_0x27be32))[_0xc99f('0x46')](handleError(_0x2023f5,null));};exports[_0xc99f('0x47')]=function(_0x17f233,_0x3c55d6){var _0x1be791={'raw':![],'where':{'id':_0x17f233[_0xc99f('0x48')]['id']}},_0x5775e7={};_0x5775e7['model']=_[_0xc99f('0x32')](db[_0xc99f('0x43')][_0xc99f('0x2e')]);_0x5775e7[_0xc99f('0x31')]=_['keys'](_0x17f233['query']);_0x5775e7['filters']=_[_0xc99f('0x34')](_0x5775e7[_0xc99f('0x30')],_0x5775e7[_0xc99f('0x31')]);_0x1be791[_0xc99f('0x36')]=_[_0xc99f('0x34')](_0x5775e7[_0xc99f('0x30')],qs[_0xc99f('0x35')](_0x17f233[_0xc99f('0x31')][_0xc99f('0x35')]));_0x1be791[_0xc99f('0x36')]=_0x1be791[_0xc99f('0x36')][_0xc99f('0x37')]?_0x1be791[_0xc99f('0x36')]:_0x5775e7[_0xc99f('0x30')];if(_0x17f233[_0xc99f('0x31')][_0xc99f('0x49')]){_0x1be791[_0xc99f('0x44')]=[{'all':!![]}];}_0x1be791=_['merge']({},_0x1be791,_0x17f233[_0xc99f('0x42')]);return db[_0xc99f('0x43')]['find'](_0x1be791)[_0xc99f('0x25')](handleEntityNotFound(_0x3c55d6,null))[_0xc99f('0x25')](respondWithResult(_0x3c55d6,null))[_0xc99f('0x46')](handleError(_0x3c55d6,null));};exports[_0xc99f('0x4a')]=function(_0x2885ad,_0x594b2d){return db[_0xc99f('0x43')][_0xc99f('0x4a')](_0x2885ad[_0xc99f('0x4b')],{})[_0xc99f('0x25')](function(_0x42e48c){var _0x4153f8=_0x2885ad[_0xc99f('0x4c')][_0xc99f('0x27')]({'plain':!![]});if(!_0x4153f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4153f8[_0xc99f('0x4d')]===_0xc99f('0x4c')){var _0x4935a3=_0x42e48c['get']({'plain':!![]});var _0x2d4b22='Triggers';return db[_0xc99f('0x4e')][_0xc99f('0x4f')]({'where':{'name':_0x2d4b22,'userProfileId':_0x4153f8[_0xc99f('0x50')]},'raw':!![]})[_0xc99f('0x25')](function(_0x4a1ea2){if(_0x4a1ea2&&_0x4a1ea2[_0xc99f('0x51')]===0x0){return db[_0xc99f('0x52')][_0xc99f('0x4a')]({'name':_0x4935a3['name'],'resourceId':_0x4935a3['id'],'type':_0x4a1ea2['name'],'sectionId':_0x4a1ea2['id']},{})[_0xc99f('0x25')](function(){return _0x42e48c;});}else{return _0x42e48c;}})[_0xc99f('0x46')](function(_0x1610e9){logger[_0xc99f('0x29')](_0xc99f('0x53'),_0x1610e9);throw _0x1610e9;});}return _0x42e48c;})[_0xc99f('0x25')](respondWithResult(_0x594b2d,0xc9))[_0xc99f('0x46')](handleError(_0x594b2d,null));};exports[_0xc99f('0x24')]=function(_0x1d0533,_0x44b9ad){if(_0x1d0533['body']['id']){delete _0x1d0533[_0xc99f('0x4b')]['id'];}return db[_0xc99f('0x43')][_0xc99f('0x4f')]({'where':{'id':_0x1d0533[_0xc99f('0x48')]['id']}})[_0xc99f('0x25')](handleEntityNotFound(_0x44b9ad,null))[_0xc99f('0x25')](saveUpdates(_0x1d0533['body'],null))[_0xc99f('0x25')](respondWithResult(_0x44b9ad,null))['catch'](handleError(_0x44b9ad,null));};exports[_0xc99f('0x26')]=function(_0x13eee6,_0x577bcc){return db[_0xc99f('0x43')][_0xc99f('0x4f')]({'where':{'id':_0x13eee6['params']['id']}})[_0xc99f('0x25')](handleEntityNotFound(_0x577bcc,null))['then'](removeEntity(_0x577bcc,null))[_0xc99f('0x46')](handleError(_0x577bcc,null));};exports[_0xc99f('0x54')]=function(_0x1d48c4,_0x3d105a,_0x42850a){if(_0x1d48c4[_0xc99f('0x4b')]['id']){delete _0x1d48c4[_0xc99f('0x4b')]['id'];}return db[_0xc99f('0x43')][_0xc99f('0x4f')]({'where':{'id':_0x1d48c4[_0xc99f('0x48')]['id']}})[_0xc99f('0x25')](handleEntityNotFound(_0x3d105a,null))[_0xc99f('0x25')](function(_0x9c699d){if(_0x9c699d){_0x1d48c4[_0xc99f('0x4b')][_0xc99f('0x55')]=_0x9c699d['id'];return db[_0xc99f('0x56')][_0xc99f('0x4a')](_0x1d48c4[_0xc99f('0x4b')]);}})['then'](respondWithResult(_0x3d105a,null))[_0xc99f('0x46')](handleError(_0x3d105a,null));};exports[_0xc99f('0x57')]=function(_0x3d22fc,_0xe27c5c,_0x4ae578){if(_0x3d22fc['body']['id']){delete _0x3d22fc['body']['id'];}return db['Trigger'][_0xc99f('0x4f')]({'where':{'id':_0x3d22fc['params']['id']}})[_0xc99f('0x25')](handleEntityNotFound(_0xe27c5c,null))[_0xc99f('0x25')](function(_0x1efb5f){if(_0x1efb5f){_0x3d22fc[_0xc99f('0x4b')][_0xc99f('0x58')]=_0x1efb5f['id'];return db[_0xc99f('0x56')][_0xc99f('0x4a')](_0x3d22fc[_0xc99f('0x4b')]);}})[_0xc99f('0x25')](respondWithResult(_0xe27c5c,null))['catch'](handleError(_0xe27c5c,null));};exports[_0xc99f('0x59')]=function(_0xb85eec,_0x51eb01,_0x7948a4){var _0x17ca15={};var _0x93ec86={};var _0x12fc1d;var _0x1f8fac;return db[_0xc99f('0x43')][_0xc99f('0x5a')]({'where':{'id':_0xb85eec[_0xc99f('0x48')]['id']}})['then'](handleEntityNotFound(_0x51eb01,null))[_0xc99f('0x25')](function(_0x2d1d92){if(_0x2d1d92){_0x12fc1d=_0x2d1d92;_0x93ec86[_0xc99f('0x30')]=_[_0xc99f('0x32')](db[_0xc99f('0x56')][_0xc99f('0x2e')]);_0x93ec86[_0xc99f('0x31')]=_['keys'](_0xb85eec[_0xc99f('0x31')]);_0x93ec86[_0xc99f('0x33')]=_[_0xc99f('0x34')](_0x93ec86[_0xc99f('0x30')],_0x93ec86[_0xc99f('0x31')]);_0x17ca15['attributes']=_[_0xc99f('0x34')](_0x93ec86[_0xc99f('0x30')],qs[_0xc99f('0x35')](_0xb85eec[_0xc99f('0x31')]['fields']));_0x17ca15[_0xc99f('0x36')]=_0x17ca15[_0xc99f('0x36')][_0xc99f('0x37')]?_0x17ca15[_0xc99f('0x36')]:_0x93ec86[_0xc99f('0x30')];_0x17ca15[_0xc99f('0x3a')]=qs['sort'](_0xb85eec[_0xc99f('0x31')][_0xc99f('0x3b')]);_0x17ca15[_0xc99f('0x3c')]=qs[_0xc99f('0x33')](_[_0xc99f('0x3d')](_0xb85eec[_0xc99f('0x31')],_0x93ec86['filters']));if(_0xb85eec[_0xc99f('0x31')][_0xc99f('0x3e')]){_0x17ca15['where']=_[_0xc99f('0x3f')](_0x17ca15[_0xc99f('0x3c')],{'$or':_[_0xc99f('0x2d')](_0x17ca15[_0xc99f('0x36')],function(_0x17d53d){var _0x13989e={};_0x13989e[_0x17d53d]={'$like':'%'+_0xb85eec[_0xc99f('0x31')][_0xc99f('0x3e')]+'%'};return _0x13989e;})});}_0x17ca15=_[_0xc99f('0x3f')]({},_0x17ca15,_0xb85eec[_0xc99f('0x42')]);return _0x12fc1d[_0xc99f('0x59')](_0x17ca15);}})[_0xc99f('0x25')](function(_0x425c07){if(_0x425c07){_0x1f8fac=_0x425c07[_0xc99f('0x37')];if(!_0xb85eec[_0xc99f('0x31')][_0xc99f('0x38')]('nolimit')){_0x17ca15[_0xc99f('0x1e')]=qs[_0xc99f('0x1e')](_0xb85eec[_0xc99f('0x31')][_0xc99f('0x1e')]);_0x17ca15['offset']=qs['offset'](_0xb85eec[_0xc99f('0x31')][_0xc99f('0x1d')]);}return _0x12fc1d[_0xc99f('0x59')](_0x17ca15);}})[_0xc99f('0x25')](function(_0x66aed3){if(_0x66aed3){return _0x66aed3?{'count':_0x1f8fac,'rows':_0x66aed3}:null;}})[_0xc99f('0x25')](respondWithResult(_0x51eb01,null))[_0xc99f('0x46')](handleError(_0x51eb01,null));};exports[_0xc99f('0x5b')]=function(_0x4f75d3,_0x44d584,_0x12c6c2){var _0x95df3c={};var _0x2ece36={};var _0x53f5e8;var _0x55c13a;return db[_0xc99f('0x43')][_0xc99f('0x5a')]({'where':{'id':_0x4f75d3[_0xc99f('0x48')]['id']}})[_0xc99f('0x25')](handleEntityNotFound(_0x44d584,null))[_0xc99f('0x25')](function(_0x3572db){if(_0x3572db){_0x53f5e8=_0x3572db;_0x2ece36[_0xc99f('0x30')]=_[_0xc99f('0x32')](db['Condition']['rawAttributes']);_0x2ece36[_0xc99f('0x31')]=_[_0xc99f('0x32')](_0x4f75d3[_0xc99f('0x31')]);_0x2ece36[_0xc99f('0x33')]=_[_0xc99f('0x34')](_0x2ece36[_0xc99f('0x30')],_0x2ece36['query']);_0x95df3c[_0xc99f('0x36')]=_['intersection'](_0x2ece36[_0xc99f('0x30')],qs[_0xc99f('0x35')](_0x4f75d3[_0xc99f('0x31')][_0xc99f('0x35')]));_0x95df3c[_0xc99f('0x36')]=_0x95df3c['attributes'][_0xc99f('0x37')]?_0x95df3c[_0xc99f('0x36')]:_0x2ece36['model'];_0x95df3c[_0xc99f('0x3a')]=qs[_0xc99f('0x3b')](_0x4f75d3[_0xc99f('0x31')][_0xc99f('0x3b')]);_0x95df3c['where']=qs[_0xc99f('0x33')](_[_0xc99f('0x3d')](_0x4f75d3[_0xc99f('0x31')],_0x2ece36[_0xc99f('0x33')]));if(_0x4f75d3[_0xc99f('0x31')][_0xc99f('0x3e')]){_0x95df3c[_0xc99f('0x3c')]=_[_0xc99f('0x3f')](_0x95df3c[_0xc99f('0x3c')],{'$or':_['map'](_0x95df3c[_0xc99f('0x36')],function(_0x2707b8){var _0x109749={};_0x109749[_0x2707b8]={'$like':'%'+_0x4f75d3[_0xc99f('0x31')]['filter']+'%'};return _0x109749;})});}_0x95df3c=_[_0xc99f('0x3f')]({},_0x95df3c,_0x4f75d3['options']);return _0x53f5e8[_0xc99f('0x5b')](_0x95df3c);}})[_0xc99f('0x25')](function(_0x464a4c){if(_0x464a4c){_0x55c13a=_0x464a4c['length'];if(!_0x4f75d3['query'][_0xc99f('0x38')](_0xc99f('0x39'))){_0x95df3c[_0xc99f('0x1e')]=qs[_0xc99f('0x1e')](_0x4f75d3['query'][_0xc99f('0x1e')]);_0x95df3c[_0xc99f('0x1d')]=qs[_0xc99f('0x1d')](_0x4f75d3[_0xc99f('0x31')][_0xc99f('0x1d')]);}return _0x53f5e8['getAnyConditions'](_0x95df3c);}})[_0xc99f('0x25')](function(_0x6c1bd3){if(_0x6c1bd3){return _0x6c1bd3?{'count':_0x55c13a,'rows':_0x6c1bd3}:null;}})[_0xc99f('0x25')](respondWithResult(_0x44d584,null))[_0xc99f('0x46')](handleError(_0x44d584,null));};exports[_0xc99f('0x5c')]=function(_0x407647,_0x6af2ee,_0x5e11ab){if(_0x407647[_0xc99f('0x4b')]['id']){delete _0x407647[_0xc99f('0x4b')]['id'];}return db[_0xc99f('0x43')]['find']({'where':{'id':_0x407647['params']['id']}})['then'](handleEntityNotFound(_0x6af2ee,null))['then'](function(_0x2d7033){if(_0x2d7033){_0x407647[_0xc99f('0x4b')][_0xc99f('0x5d')]=_0x2d7033['id'];return db[_0xc99f('0x5e')]['create'](_0x407647[_0xc99f('0x4b')]);}})[_0xc99f('0x25')](respondWithResult(_0x6af2ee,null))[_0xc99f('0x46')](handleError(_0x6af2ee,null));};exports[_0xc99f('0x5f')]=function(_0x3ac34b,_0x21b3e3,_0x552bb9){var _0x1b7ef2={};var _0x3dce40={};var _0x48981d;var _0x5679fc;return db[_0xc99f('0x43')]['findOne']({'where':{'id':_0x3ac34b['params']['id']}})['then'](handleEntityNotFound(_0x21b3e3,null))[_0xc99f('0x25')](function(_0x554d04){if(_0x554d04){_0x48981d=_0x554d04;_0x3dce40['model']=_[_0xc99f('0x32')](db[_0xc99f('0x5e')][_0xc99f('0x2e')]);_0x3dce40[_0xc99f('0x31')]=_[_0xc99f('0x32')](_0x3ac34b[_0xc99f('0x31')]);_0x3dce40[_0xc99f('0x33')]=_[_0xc99f('0x34')](_0x3dce40['model'],_0x3dce40[_0xc99f('0x31')]);_0x1b7ef2[_0xc99f('0x36')]=_[_0xc99f('0x34')](_0x3dce40[_0xc99f('0x30')],qs[_0xc99f('0x35')](_0x3ac34b[_0xc99f('0x31')][_0xc99f('0x35')]));_0x1b7ef2['attributes']=_0x1b7ef2['attributes']['length']?_0x1b7ef2[_0xc99f('0x36')]:_0x3dce40[_0xc99f('0x30')];_0x1b7ef2[_0xc99f('0x3a')]=qs[_0xc99f('0x3b')](_0x3ac34b[_0xc99f('0x31')][_0xc99f('0x3b')]);_0x1b7ef2['where']=qs[_0xc99f('0x33')](_[_0xc99f('0x3d')](_0x3ac34b['query'],_0x3dce40['filters']));if(_0x3ac34b[_0xc99f('0x31')]['filter']){_0x1b7ef2[_0xc99f('0x3c')]=_[_0xc99f('0x3f')](_0x1b7ef2[_0xc99f('0x3c')],{'$or':_[_0xc99f('0x2d')](_0x1b7ef2[_0xc99f('0x36')],function(_0x4ea8f6){var _0x24571a={};_0x24571a[_0x4ea8f6]={'$like':'%'+_0x3ac34b[_0xc99f('0x31')][_0xc99f('0x3e')]+'%'};return _0x24571a;})});}_0x1b7ef2=_[_0xc99f('0x3f')]({},_0x1b7ef2,_0x3ac34b[_0xc99f('0x42')]);return _0x48981d[_0xc99f('0x5f')](_0x1b7ef2);}})[_0xc99f('0x25')](function(_0x8ea206){if(_0x8ea206){_0x5679fc=_0x8ea206[_0xc99f('0x37')];if(!_0x3ac34b[_0xc99f('0x31')]['hasOwnProperty'](_0xc99f('0x39'))){_0x1b7ef2[_0xc99f('0x1e')]=qs[_0xc99f('0x1e')](_0x3ac34b[_0xc99f('0x31')][_0xc99f('0x1e')]);_0x1b7ef2[_0xc99f('0x1d')]=qs['offset'](_0x3ac34b['query'][_0xc99f('0x1d')]);}return _0x48981d[_0xc99f('0x5f')](_0x1b7ef2);}})[_0xc99f('0x25')](function(_0x3a30ae){if(_0x3a30ae){return _0x3a30ae?{'count':_0x5679fc,'rows':_0x3a30ae}:null;}})['then'](respondWithResult(_0x21b3e3,null))[_0xc99f('0x46')](handleError(_0x21b3e3,null));}; \ No newline at end of file +var _0x66df=['length','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','getAllConditions','findOne','Condition','getAnyConditions','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','then','get','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','Trigger','findAll','catch','show','params'];(function(_0x3034fd,_0x3f33fd){var _0x2276f1=function(_0x1d404e){while(--_0x1d404e){_0x3034fd['push'](_0x3034fd['shift']());}};_0x2276f1(++_0x3f33fd);}(_0x66df,0x126));var _0xf66d=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x66df[_0xa9a245];return _0x2d0eaa;};'use strict';var pdf=require(_0xf66d('0x0'));var emlformat=require(_0xf66d('0x1'));var rimraf=require(_0xf66d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf66d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf66d('0x4'));var Mustache=require(_0xf66d('0x5'));var util=require(_0xf66d('0x6'));var path=require(_0xf66d('0x7'));var sox=require(_0xf66d('0x8'));var csv=require(_0xf66d('0x9'));var ejs=require(_0xf66d('0xa'));var fs=require('fs');var _=require(_0xf66d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf66d('0xc'));var deskjs=require(_0xf66d('0xd'));var toCsv=require(_0xf66d('0x9'));var querystring=require(_0xf66d('0xe'));var Papa=require('papaparse');var Redis=require(_0xf66d('0xf'));var authService=require(_0xf66d('0x10'));var qs=require(_0xf66d('0x11'));var as=require(_0xf66d('0x12'));var hardwareService=require(_0xf66d('0x13'));var logger=require(_0xf66d('0x14'))(_0xf66d('0x15'));var utils=require(_0xf66d('0x16'));var config=require(_0xf66d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d7677,_0x191e5f){_0x191e5f=_0x191e5f||0xcc;return function(_0x50792a){if(_0x50792a){return _0x5d7677[_0xf66d('0x18')](_0x191e5f);}return _0x5d7677[_0xf66d('0x19')](_0x191e5f)[_0xf66d('0x1a')]();};}function respondWithResult(_0x3f5a3b,_0x11b310){_0x11b310=_0x11b310||0xc8;return function(_0x47cb22){if(_0x47cb22){return _0x3f5a3b['status'](_0x11b310)[_0xf66d('0x1b')](_0x47cb22);}};}function respondWithFilteredResult(_0xbc5cce,_0x5dcc23){return function(_0x1b402e){if(_0x1b402e){var _0x4c5112=_0x1b402e[_0xf66d('0x1c')],_0x2b78e7=_0x5dcc23[_0xf66d('0x1d')],_0x5571df=_0x5dcc23[_0xf66d('0x1d')]+_0x5dcc23[_0xf66d('0x1e')],_0x3fec6c;if(_0x5571df>=_0x4c5112){_0x5571df=_0x4c5112;_0x3fec6c=0xc8;}else{_0x3fec6c=0xce;}_0xbc5cce['status'](_0x3fec6c);return _0xbc5cce['set'](_0xf66d('0x1f'),_0x2b78e7+'-'+_0x5571df+'/'+_0x4c5112)[_0xf66d('0x1b')](_0x1b402e);}return null;};}function patchUpdates(_0x364d8e){return function(_0x163052){try{jsonpatch['apply'](_0x163052,_0x364d8e,!![]);}catch(_0x4d7c3a){return BPromise[_0xf66d('0x20')](_0x4d7c3a);}return _0x163052['save']();};}function saveUpdates(_0x404655,_0x440487){return function(_0xd271bd){if(_0xd271bd){return _0xd271bd[_0xf66d('0x21')](_0x404655)['then'](function(_0x51e5e1){return _0x51e5e1;});}return null;};}function removeEntity(_0x292f10,_0x3d07d7){return function(_0x50fd34){if(_0x50fd34){return _0x50fd34[_0xf66d('0x22')]()[_0xf66d('0x23')](function(){var _0x1b826f=_0x50fd34[_0xf66d('0x24')]({'plain':!![]});var _0xa7ded7=_0xf66d('0x25');return db[_0xf66d('0x26')][_0xf66d('0x22')]({'where':{'type':_0xa7ded7,'resourceId':_0x1b826f['id']}})[_0xf66d('0x23')](function(){return _0x50fd34;});})[_0xf66d('0x23')](function(){_0x292f10[_0xf66d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49aa7a,_0x51145c){return function(_0x30fc85){if(!_0x30fc85){_0x49aa7a[_0xf66d('0x18')](0x194);}return _0x30fc85;};}function handleError(_0x26f088,_0x438687){_0x438687=_0x438687||0x1f4;return function(_0x105607){logger[_0xf66d('0x27')](_0x105607[_0xf66d('0x28')]);if(_0x105607[_0xf66d('0x29')]){delete _0x105607[_0xf66d('0x29')];}_0x26f088[_0xf66d('0x19')](_0x438687)[_0xf66d('0x2a')](_0x105607);};}exports[_0xf66d('0x2b')]=function(_0x3074e7,_0x3fcbbe){var _0x3efcb5={},_0x2bf22c={},_0x3ce305={'count':0x0,'rows':[]};var _0x22e977=_[_0xf66d('0x2c')](db['Trigger'][_0xf66d('0x2d')],function(_0x5ead6d){return{'name':_0x5ead6d[_0xf66d('0x2e')],'type':_0x5ead6d['type'][_0xf66d('0x2f')]};});_0x2bf22c[_0xf66d('0x30')]=_[_0xf66d('0x2c')](_0x22e977,_0xf66d('0x29'));_0x2bf22c[_0xf66d('0x31')]=_[_0xf66d('0x32')](_0x3074e7[_0xf66d('0x31')]);_0x2bf22c[_0xf66d('0x33')]=_['intersection'](_0x2bf22c['model'],_0x2bf22c[_0xf66d('0x31')]);_0x3efcb5[_0xf66d('0x34')]=_[_0xf66d('0x35')](_0x2bf22c['model'],qs[_0xf66d('0x36')](_0x3074e7[_0xf66d('0x31')]['fields']));_0x3efcb5['attributes']=_0x3efcb5['attributes']['length']?_0x3efcb5[_0xf66d('0x34')]:_0x2bf22c[_0xf66d('0x30')];if(!_0x3074e7[_0xf66d('0x31')][_0xf66d('0x37')](_0xf66d('0x38'))){_0x3efcb5[_0xf66d('0x1e')]=qs[_0xf66d('0x1e')](_0x3074e7[_0xf66d('0x31')]['limit']);_0x3efcb5[_0xf66d('0x1d')]=qs[_0xf66d('0x1d')](_0x3074e7[_0xf66d('0x31')][_0xf66d('0x1d')]);}_0x3efcb5[_0xf66d('0x39')]=qs[_0xf66d('0x3a')](_0x3074e7[_0xf66d('0x31')][_0xf66d('0x3a')]);_0x3efcb5[_0xf66d('0x3b')]=qs[_0xf66d('0x33')](_[_0xf66d('0x3c')](_0x3074e7['query'],_0x2bf22c[_0xf66d('0x33')]),_0x22e977);if(_0x3074e7['query'][_0xf66d('0x3d')]){_0x3efcb5[_0xf66d('0x3b')]=_[_0xf66d('0x3e')](_0x3efcb5['where'],{'$or':_['map'](_0x22e977,function(_0x201478){if(_0x201478[_0xf66d('0x3f')]!=='VIRTUAL'){var _0x37cbec={};_0x37cbec[_0x201478[_0xf66d('0x29')]]={'$like':'%'+_0x3074e7[_0xf66d('0x31')][_0xf66d('0x3d')]+'%'};return _0x37cbec;}})});}_0x3efcb5=_[_0xf66d('0x3e')]({},_0x3efcb5,_0x3074e7['options']);var _0x5522b6={'where':_0x3efcb5[_0xf66d('0x3b')]};return db['Trigger'][_0xf66d('0x1c')](_0x5522b6)[_0xf66d('0x23')](function(_0x1e4e7a){_0x3ce305[_0xf66d('0x1c')]=_0x1e4e7a;if(_0x3074e7['query'][_0xf66d('0x40')]){_0x3efcb5['include']=[{'all':!![]}];}return db[_0xf66d('0x41')][_0xf66d('0x42')](_0x3efcb5);})[_0xf66d('0x23')](function(_0x1a7b84){_0x3ce305['rows']=_0x1a7b84;return _0x3ce305;})[_0xf66d('0x23')](respondWithFilteredResult(_0x3fcbbe,_0x3efcb5))[_0xf66d('0x43')](handleError(_0x3fcbbe,null));};exports[_0xf66d('0x44')]=function(_0xf48b88,_0x3bceca){var _0x36c1c3={'raw':![],'where':{'id':_0xf48b88[_0xf66d('0x45')]['id']}},_0x10ec7e={};_0x10ec7e['model']=_['keys'](db['Trigger'][_0xf66d('0x2d')]);_0x10ec7e['query']=_[_0xf66d('0x32')](_0xf48b88[_0xf66d('0x31')]);_0x10ec7e[_0xf66d('0x33')]=_[_0xf66d('0x35')](_0x10ec7e[_0xf66d('0x30')],_0x10ec7e[_0xf66d('0x31')]);_0x36c1c3['attributes']=_[_0xf66d('0x35')](_0x10ec7e[_0xf66d('0x30')],qs[_0xf66d('0x36')](_0xf48b88['query'][_0xf66d('0x36')]));_0x36c1c3['attributes']=_0x36c1c3['attributes'][_0xf66d('0x46')]?_0x36c1c3[_0xf66d('0x34')]:_0x10ec7e[_0xf66d('0x30')];if(_0xf48b88[_0xf66d('0x31')][_0xf66d('0x40')]){_0x36c1c3[_0xf66d('0x47')]=[{'all':!![]}];}_0x36c1c3=_[_0xf66d('0x3e')]({},_0x36c1c3,_0xf48b88[_0xf66d('0x48')]);return db[_0xf66d('0x41')][_0xf66d('0x49')](_0x36c1c3)[_0xf66d('0x23')](handleEntityNotFound(_0x3bceca,null))[_0xf66d('0x23')](respondWithResult(_0x3bceca,null))['catch'](handleError(_0x3bceca,null));};exports[_0xf66d('0x4a')]=function(_0x5588ad,_0x391141){return db[_0xf66d('0x41')][_0xf66d('0x4a')](_0x5588ad[_0xf66d('0x4b')],{})['then'](function(_0x22f10f){var _0x1911c4=_0x5588ad['user']['get']({'plain':!![]});if(!_0x1911c4)throw new Error(_0xf66d('0x4c'));if(_0x1911c4[_0xf66d('0x4d')]===_0xf66d('0x4e')){var _0x3c63c9=_0x22f10f[_0xf66d('0x24')]({'plain':!![]});var _0x3a5f12=_0xf66d('0x25');return db['UserProfileSection'][_0xf66d('0x49')]({'where':{'name':_0x3a5f12,'userProfileId':_0x1911c4['userProfileId']},'raw':!![]})[_0xf66d('0x23')](function(_0x2c42cc){if(_0x2c42cc&&_0x2c42cc[_0xf66d('0x4f')]===0x0){return db[_0xf66d('0x26')][_0xf66d('0x4a')]({'name':_0x3c63c9['name'],'resourceId':_0x3c63c9['id'],'type':_0x2c42cc['name'],'sectionId':_0x2c42cc['id']},{})[_0xf66d('0x23')](function(){return _0x22f10f;});}else{return _0x22f10f;}})[_0xf66d('0x43')](function(_0x22acbc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22acbc);throw _0x22acbc;});}return _0x22f10f;})[_0xf66d('0x23')](respondWithResult(_0x391141,0xc9))['catch'](handleError(_0x391141,null));};exports[_0xf66d('0x21')]=function(_0xa0c1c9,_0x397904){if(_0xa0c1c9[_0xf66d('0x4b')]['id']){delete _0xa0c1c9[_0xf66d('0x4b')]['id'];}return db[_0xf66d('0x41')][_0xf66d('0x49')]({'where':{'id':_0xa0c1c9[_0xf66d('0x45')]['id']}})[_0xf66d('0x23')](handleEntityNotFound(_0x397904,null))[_0xf66d('0x23')](saveUpdates(_0xa0c1c9['body'],null))[_0xf66d('0x23')](respondWithResult(_0x397904,null))[_0xf66d('0x43')](handleError(_0x397904,null));};exports[_0xf66d('0x22')]=function(_0x2d6b57,_0x4a8e6b){return db[_0xf66d('0x41')][_0xf66d('0x49')]({'where':{'id':_0x2d6b57[_0xf66d('0x45')]['id']}})[_0xf66d('0x23')](handleEntityNotFound(_0x4a8e6b,null))[_0xf66d('0x23')](removeEntity(_0x4a8e6b,null))[_0xf66d('0x43')](handleError(_0x4a8e6b,null));};exports[_0xf66d('0x50')]=function(_0x312c79,_0x1b1bac,_0x5c9c95){if(_0x312c79['body']['id']){delete _0x312c79[_0xf66d('0x4b')]['id'];}return db[_0xf66d('0x41')][_0xf66d('0x49')]({'where':{'id':_0x312c79[_0xf66d('0x45')]['id']}})[_0xf66d('0x23')](handleEntityNotFound(_0x1b1bac,null))[_0xf66d('0x23')](function(_0x329e5a){if(_0x329e5a){_0x312c79[_0xf66d('0x4b')][_0xf66d('0x51')]=_0x329e5a['id'];return db['Condition'][_0xf66d('0x4a')](_0x312c79[_0xf66d('0x4b')]);}})[_0xf66d('0x23')](respondWithResult(_0x1b1bac,null))['catch'](handleError(_0x1b1bac,null));};exports[_0xf66d('0x52')]=function(_0x3e5453,_0x1df20e,_0x5cc646){if(_0x3e5453['body']['id']){delete _0x3e5453[_0xf66d('0x4b')]['id'];}return db[_0xf66d('0x41')]['find']({'where':{'id':_0x3e5453[_0xf66d('0x45')]['id']}})[_0xf66d('0x23')](handleEntityNotFound(_0x1df20e,null))[_0xf66d('0x23')](function(_0x1cb194){if(_0x1cb194){_0x3e5453[_0xf66d('0x4b')][_0xf66d('0x53')]=_0x1cb194['id'];return db['Condition'][_0xf66d('0x4a')](_0x3e5453[_0xf66d('0x4b')]);}})[_0xf66d('0x23')](respondWithResult(_0x1df20e,null))[_0xf66d('0x43')](handleError(_0x1df20e,null));};exports[_0xf66d('0x54')]=function(_0x5e0880,_0x515c4e,_0x4f5779){var _0x18a7e5={};var _0x4e6069={};var _0x2842db;var _0x170d80;return db[_0xf66d('0x41')][_0xf66d('0x55')]({'where':{'id':_0x5e0880['params']['id']}})['then'](handleEntityNotFound(_0x515c4e,null))[_0xf66d('0x23')](function(_0x38dc21){if(_0x38dc21){_0x2842db=_0x38dc21;_0x4e6069[_0xf66d('0x30')]=_[_0xf66d('0x32')](db[_0xf66d('0x56')][_0xf66d('0x2d')]);_0x4e6069['query']=_[_0xf66d('0x32')](_0x5e0880[_0xf66d('0x31')]);_0x4e6069[_0xf66d('0x33')]=_['intersection'](_0x4e6069[_0xf66d('0x30')],_0x4e6069[_0xf66d('0x31')]);_0x18a7e5[_0xf66d('0x34')]=_['intersection'](_0x4e6069[_0xf66d('0x30')],qs[_0xf66d('0x36')](_0x5e0880[_0xf66d('0x31')][_0xf66d('0x36')]));_0x18a7e5[_0xf66d('0x34')]=_0x18a7e5[_0xf66d('0x34')][_0xf66d('0x46')]?_0x18a7e5[_0xf66d('0x34')]:_0x4e6069[_0xf66d('0x30')];_0x18a7e5[_0xf66d('0x39')]=qs['sort'](_0x5e0880[_0xf66d('0x31')][_0xf66d('0x3a')]);_0x18a7e5[_0xf66d('0x3b')]=qs['filters'](_['pick'](_0x5e0880[_0xf66d('0x31')],_0x4e6069[_0xf66d('0x33')]));if(_0x5e0880[_0xf66d('0x31')][_0xf66d('0x3d')]){_0x18a7e5[_0xf66d('0x3b')]=_[_0xf66d('0x3e')](_0x18a7e5['where'],{'$or':_[_0xf66d('0x2c')](_0x18a7e5[_0xf66d('0x34')],function(_0x11f4d7){var _0x209767={};_0x209767[_0x11f4d7]={'$like':'%'+_0x5e0880['query'][_0xf66d('0x3d')]+'%'};return _0x209767;})});}_0x18a7e5=_['merge']({},_0x18a7e5,_0x5e0880[_0xf66d('0x48')]);return _0x2842db['getAllConditions'](_0x18a7e5);}})[_0xf66d('0x23')](function(_0x134768){if(_0x134768){_0x170d80=_0x134768[_0xf66d('0x46')];if(!_0x5e0880[_0xf66d('0x31')][_0xf66d('0x37')](_0xf66d('0x38'))){_0x18a7e5[_0xf66d('0x1e')]=qs[_0xf66d('0x1e')](_0x5e0880[_0xf66d('0x31')][_0xf66d('0x1e')]);_0x18a7e5[_0xf66d('0x1d')]=qs[_0xf66d('0x1d')](_0x5e0880[_0xf66d('0x31')][_0xf66d('0x1d')]);}return _0x2842db[_0xf66d('0x54')](_0x18a7e5);}})[_0xf66d('0x23')](function(_0x50ec5c){if(_0x50ec5c){return _0x50ec5c?{'count':_0x170d80,'rows':_0x50ec5c}:null;}})['then'](respondWithResult(_0x515c4e,null))[_0xf66d('0x43')](handleError(_0x515c4e,null));};exports[_0xf66d('0x57')]=function(_0x393a3d,_0x1cdbef,_0x563e77){var _0x5047ea={};var _0x374761={};var _0x21a80e;var _0x238452;return db[_0xf66d('0x41')][_0xf66d('0x55')]({'where':{'id':_0x393a3d['params']['id']}})[_0xf66d('0x23')](handleEntityNotFound(_0x1cdbef,null))[_0xf66d('0x23')](function(_0x35b9be){if(_0x35b9be){_0x21a80e=_0x35b9be;_0x374761[_0xf66d('0x30')]=_[_0xf66d('0x32')](db[_0xf66d('0x56')]['rawAttributes']);_0x374761[_0xf66d('0x31')]=_[_0xf66d('0x32')](_0x393a3d[_0xf66d('0x31')]);_0x374761[_0xf66d('0x33')]=_['intersection'](_0x374761[_0xf66d('0x30')],_0x374761['query']);_0x5047ea[_0xf66d('0x34')]=_[_0xf66d('0x35')](_0x374761['model'],qs[_0xf66d('0x36')](_0x393a3d['query']['fields']));_0x5047ea[_0xf66d('0x34')]=_0x5047ea[_0xf66d('0x34')][_0xf66d('0x46')]?_0x5047ea['attributes']:_0x374761[_0xf66d('0x30')];_0x5047ea[_0xf66d('0x39')]=qs[_0xf66d('0x3a')](_0x393a3d[_0xf66d('0x31')][_0xf66d('0x3a')]);_0x5047ea[_0xf66d('0x3b')]=qs[_0xf66d('0x33')](_[_0xf66d('0x3c')](_0x393a3d[_0xf66d('0x31')],_0x374761[_0xf66d('0x33')]));if(_0x393a3d[_0xf66d('0x31')][_0xf66d('0x3d')]){_0x5047ea[_0xf66d('0x3b')]=_[_0xf66d('0x3e')](_0x5047ea['where'],{'$or':_[_0xf66d('0x2c')](_0x5047ea['attributes'],function(_0x496d6d){var _0x3de9fa={};_0x3de9fa[_0x496d6d]={'$like':'%'+_0x393a3d[_0xf66d('0x31')][_0xf66d('0x3d')]+'%'};return _0x3de9fa;})});}_0x5047ea=_['merge']({},_0x5047ea,_0x393a3d[_0xf66d('0x48')]);return _0x21a80e['getAnyConditions'](_0x5047ea);}})[_0xf66d('0x23')](function(_0x2d1cfa){if(_0x2d1cfa){_0x238452=_0x2d1cfa[_0xf66d('0x46')];if(!_0x393a3d[_0xf66d('0x31')][_0xf66d('0x37')]('nolimit')){_0x5047ea[_0xf66d('0x1e')]=qs[_0xf66d('0x1e')](_0x393a3d['query'][_0xf66d('0x1e')]);_0x5047ea[_0xf66d('0x1d')]=qs[_0xf66d('0x1d')](_0x393a3d[_0xf66d('0x31')][_0xf66d('0x1d')]);}return _0x21a80e['getAnyConditions'](_0x5047ea);}})['then'](function(_0x1e1507){if(_0x1e1507){return _0x1e1507?{'count':_0x238452,'rows':_0x1e1507}:null;}})[_0xf66d('0x23')](respondWithResult(_0x1cdbef,null))[_0xf66d('0x43')](handleError(_0x1cdbef,null));};exports['addAction']=function(_0x3f3a42,_0x2067d8,_0x40d65c){if(_0x3f3a42[_0xf66d('0x4b')]['id']){delete _0x3f3a42[_0xf66d('0x4b')]['id'];}return db[_0xf66d('0x41')][_0xf66d('0x49')]({'where':{'id':_0x3f3a42[_0xf66d('0x45')]['id']}})[_0xf66d('0x23')](handleEntityNotFound(_0x2067d8,null))[_0xf66d('0x23')](function(_0xcd3b82){if(_0xcd3b82){_0x3f3a42[_0xf66d('0x4b')][_0xf66d('0x58')]=_0xcd3b82['id'];return db[_0xf66d('0x59')][_0xf66d('0x4a')](_0x3f3a42['body']);}})[_0xf66d('0x23')](respondWithResult(_0x2067d8,null))[_0xf66d('0x43')](handleError(_0x2067d8,null));};exports[_0xf66d('0x5a')]=function(_0x44b8d9,_0x5c7c32,_0x2cb6a3){var _0x3cd93d={};var _0x5e6d56={};var _0x4e7fb4;var _0x598737;return db[_0xf66d('0x41')][_0xf66d('0x55')]({'where':{'id':_0x44b8d9[_0xf66d('0x45')]['id']}})[_0xf66d('0x23')](handleEntityNotFound(_0x5c7c32,null))[_0xf66d('0x23')](function(_0x307210){if(_0x307210){_0x4e7fb4=_0x307210;_0x5e6d56[_0xf66d('0x30')]=_[_0xf66d('0x32')](db[_0xf66d('0x59')][_0xf66d('0x2d')]);_0x5e6d56[_0xf66d('0x31')]=_[_0xf66d('0x32')](_0x44b8d9[_0xf66d('0x31')]);_0x5e6d56[_0xf66d('0x33')]=_['intersection'](_0x5e6d56[_0xf66d('0x30')],_0x5e6d56[_0xf66d('0x31')]);_0x3cd93d[_0xf66d('0x34')]=_[_0xf66d('0x35')](_0x5e6d56['model'],qs[_0xf66d('0x36')](_0x44b8d9[_0xf66d('0x31')]['fields']));_0x3cd93d['attributes']=_0x3cd93d[_0xf66d('0x34')][_0xf66d('0x46')]?_0x3cd93d['attributes']:_0x5e6d56[_0xf66d('0x30')];_0x3cd93d['order']=qs['sort'](_0x44b8d9['query'][_0xf66d('0x3a')]);_0x3cd93d[_0xf66d('0x3b')]=qs[_0xf66d('0x33')](_[_0xf66d('0x3c')](_0x44b8d9[_0xf66d('0x31')],_0x5e6d56[_0xf66d('0x33')]));if(_0x44b8d9[_0xf66d('0x31')][_0xf66d('0x3d')]){_0x3cd93d['where']=_[_0xf66d('0x3e')](_0x3cd93d[_0xf66d('0x3b')],{'$or':_[_0xf66d('0x2c')](_0x3cd93d[_0xf66d('0x34')],function(_0x37f698){var _0x1a9e93={};_0x1a9e93[_0x37f698]={'$like':'%'+_0x44b8d9[_0xf66d('0x31')]['filter']+'%'};return _0x1a9e93;})});}_0x3cd93d=_[_0xf66d('0x3e')]({},_0x3cd93d,_0x44b8d9[_0xf66d('0x48')]);return _0x4e7fb4[_0xf66d('0x5a')](_0x3cd93d);}})[_0xf66d('0x23')](function(_0x2037df){if(_0x2037df){_0x598737=_0x2037df[_0xf66d('0x46')];if(!_0x44b8d9[_0xf66d('0x31')][_0xf66d('0x37')](_0xf66d('0x38'))){_0x3cd93d[_0xf66d('0x1e')]=qs['limit'](_0x44b8d9['query'][_0xf66d('0x1e')]);_0x3cd93d[_0xf66d('0x1d')]=qs[_0xf66d('0x1d')](_0x44b8d9[_0xf66d('0x31')][_0xf66d('0x1d')]);}return _0x4e7fb4[_0xf66d('0x5a')](_0x3cd93d);}})[_0xf66d('0x23')](function(_0x5565b8){if(_0x5565b8){return _0x5565b8?{'count':_0x598737,'rows':_0x5565b8}:null;}})[_0xf66d('0x23')](respondWithResult(_0x5c7c32,null))[_0xf66d('0x43')](handleError(_0x5c7c32,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index aab7874..6d2b566 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 _0x2ef3=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes'];(function(_0x1f705f,_0x5cddc8){var _0x4d815a=function(_0x363686){while(--_0x363686){_0x1f705f['push'](_0x1f705f['shift']());}};_0x4d815a(++_0x5cddc8);}(_0x2ef3,0xba));var _0x32ef=function(_0x3de20d,_0x542c76){_0x3de20d=_0x3de20d-0x0;var _0x240710=_0x2ef3[_0x3de20d];return _0x240710;};'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 +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util'];(function(_0x5ac791,_0x504d37){var _0x9e3a19=function(_0x2d4821){while(--_0x2d4821){_0x5ac791['push'](_0x5ac791['shift']());}};_0x9e3a19(++_0x504d37);}(_0x7a54,0x106));var _0x47a5=function(_0x10f085,_0x108e1b){_0x10f085=_0x10f085-0x0;var _0x57f51e=_0x7a54[_0x10f085];return _0x57f51e;};'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/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 8a39cae..5f95566 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 _0xb7e7=['request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','ShowTrigger','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x27b83a,_0x3410b6){var _0x30b185=function(_0x2a39eb){while(--_0x2a39eb){_0x27b83a['push'](_0x27b83a['shift']());}};_0x30b185(++_0x3410b6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb7e7[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Trigger,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetTrigger',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['Trigger'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowTrigger',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file +var _0x9348=['http','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','Trigger','findAll','options','raw','attributes','limit','include','map','model','then','GetTrigger','catch','ShowTrigger','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4e4dfe,_0x68269f){var _0xeeaed3=function(_0x4f957c){while(--_0x4f957c){_0x4e4dfe['push'](_0x4e4dfe['shift']());}};_0xeeaed3(++_0x68269f);}(_0x9348,0x10d));var _0x8934=function(_0x410918,_0x4f2fee){_0x410918=_0x410918-0x0;var _0x36ebed=_0x9348[_0x410918];return _0x36ebed;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('Trigger,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});}exports['GetTrigger']=function(_0x47f25e){var _0x597eed=this;return new Promise(function(_0x2ff9ce,_0x51f9ed){return db[_0x8934('0x16')][_0x8934('0x17')]({'raw':_0x47f25e[_0x8934('0x18')]?_0x47f25e[_0x8934('0x18')][_0x8934('0x19')]===undefined?!![]:![]:!![],'where':_0x47f25e['options']?_0x47f25e[_0x8934('0x18')]['where']||null:null,'attributes':_0x47f25e[_0x8934('0x18')]?_0x47f25e[_0x8934('0x18')][_0x8934('0x1a')]||null:null,'limit':_0x47f25e[_0x8934('0x18')]?_0x47f25e[_0x8934('0x18')][_0x8934('0x1b')]||null:null,'include':_0x47f25e[_0x8934('0x18')]?_0x47f25e['options'][_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x47f25e[_0x8934('0x18')][_0x8934('0x1c')],function(_0x43b89a){return{'model':db[_0x43b89a['model']],'as':_0x43b89a['as'],'attributes':_0x43b89a[_0x8934('0x1a')],'include':_0x43b89a[_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x43b89a['include'],function(_0x16cfc2){return{'model':db[_0x16cfc2['model']],'as':_0x16cfc2['as'],'attributes':_0x16cfc2[_0x8934('0x1a')],'include':_0x16cfc2[_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x16cfc2['include'],function(_0x1fd5eb){return{'model':db[_0x1fd5eb[_0x8934('0x1e')]],'as':_0x1fd5eb['as'],'attributes':_0x1fd5eb[_0x8934('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8934('0x1f')](function(_0x4b5780){logger[_0x8934('0x14')](_0x8934('0x20'),_0x47f25e);logger[_0x8934('0xd')](_0x8934('0x20'),_0x47f25e,JSON[_0x8934('0x10')](_0x4b5780));_0x2ff9ce(_0x4b5780);})[_0x8934('0x21')](function(_0x3f328a){logger[_0x8934('0x11')](_0x8934('0x20'),_0x3f328a[_0x8934('0x13')],_0x47f25e);_0x51f9ed(_0x597eed['error'](0x1f4,_0x3f328a[_0x8934('0x13')]));});});};exports[_0x8934('0x22')]=function(_0x54d28d){var _0x2aa18e=this;return new Promise(function(_0x3d60f9,_0x1a17b5){return db[_0x8934('0x16')]['find']({'raw':_0x54d28d[_0x8934('0x18')]?_0x54d28d[_0x8934('0x18')][_0x8934('0x19')]===undefined?!![]:![]:!![],'where':_0x54d28d[_0x8934('0x18')]?_0x54d28d[_0x8934('0x18')]['where']||null:null,'attributes':_0x54d28d[_0x8934('0x18')]?_0x54d28d['options']['attributes']||null:null,'include':_0x54d28d[_0x8934('0x18')]?_0x54d28d[_0x8934('0x18')][_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x54d28d['options'][_0x8934('0x1c')],function(_0x22aebe){return{'model':db[_0x22aebe[_0x8934('0x1e')]],'as':_0x22aebe['as'],'attributes':_0x22aebe[_0x8934('0x1a')],'include':_0x22aebe[_0x8934('0x1c')]?_['map'](_0x22aebe[_0x8934('0x1c')],function(_0x1ea0cd){return{'model':db[_0x1ea0cd['model']],'as':_0x1ea0cd['as'],'attributes':_0x1ea0cd['attributes'],'include':_0x1ea0cd[_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x1ea0cd['include'],function(_0x519273){return{'model':db[_0x519273[_0x8934('0x1e')]],'as':_0x519273['as'],'attributes':_0x519273[_0x8934('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8934('0x1f')](function(_0x207ad4){logger[_0x8934('0x14')](_0x8934('0x22'),_0x54d28d);logger[_0x8934('0xd')](_0x8934('0x22'),_0x54d28d,JSON[_0x8934('0x10')](_0x207ad4));_0x3d60f9(_0x207ad4);})[_0x8934('0x21')](function(_0x46611c){logger['error'](_0x8934('0x22'),_0x46611c[_0x8934('0x13')],_0x54d28d);_0x1a17b5(_0x2aa18e['error'](0x1f4,_0x46611c[_0x8934('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index dfe7d48..d19519f 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(_0x5aff53,_0x58a06c){var _0xe495e1=function(_0x16d3fc){while(--_0x16d3fc){_0x5aff53['push'](_0x5aff53['shift']());}};_0xe495e1(++_0x58a06c);}(_0x032e,0x124));var _0xe032=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x032e[_0x2bf141];return _0x48277b;};'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 _0x0e85=['connect-timeout','express','../../config/environment','get','isAuthenticated','index','show','post','/:id/clone','clone','create','put','/:id','update','delete','exports','multer','util'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0e85,0x7c));var _0x50e8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0e85[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50e8('0x4'));var controller=require('./trunk.controller');router[_0x50e8('0x5')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0x7')]);router[_0x50e8('0x5')]('/:id',auth[_0x50e8('0x6')](),controller[_0x50e8('0x8')]);router[_0x50e8('0x9')](_0x50e8('0xa'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xb')]);router['post']('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0xc')]);router[_0x50e8('0xd')](_0x50e8('0xe'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')](_0x50e8('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x50e8('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 41e8c05..7bbb6f8 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 _0x9202=['actpass','update,nonat','sequelize','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','certificate','active','passive'];(function(_0x3fe420,_0xd54a21){var _0xcffb06=function(_0x17f8b6){while(--_0x17f8b6){_0x3fe420['push'](_0x3fe420['shift']());}};_0xcffb06(++_0xd54a21);}(_0x9202,0x10b));var _0x2920=function(_0x504b2d,_0x34db64){_0x504b2d=_0x504b2d-0x0;var _0x35d0aa=_0x9202[_0x504b2d];return _0x35d0aa;};'use strict';var Sequelize=require(_0x2920('0x0'));module[_0x2920('0x1')]={'name':{'type':Sequelize[_0x2920('0x2')],'allowNull':![],'unique':_0x2920('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2920('0x4')]('friend',_0x2920('0x5'),_0x2920('0x6')),'allowNull':![],'defaultValue':_0x2920('0x7')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2920('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0x2920('0x9'),_0x2920('0xa'),_0x2920('0xb'),_0x2920('0xc'),_0x2920('0xd'),_0x2920('0xe'),_0x2920('0xf'),_0x2920('0x10'))},'deny':{'type':Sequelize[_0x2920('0x2')]},'permit':{'type':Sequelize[_0x2920('0x2')]},'secret':{'type':Sequelize[_0x2920('0x2')]},'md5secret':{'type':Sequelize[_0x2920('0x2')]},'remotesecret':{'type':Sequelize[_0x2920('0x2')]},'transport':{'type':Sequelize[_0x2920('0x2')],'defaultValue':'udp','set':function(_0x3a7ecb){this[_0x2920('0x11')](_0x2920('0x12'),_0x3a7ecb?_0x3a7ecb[_0x2920('0x13')](','):null);},'get':function(){return this[_0x2920('0x14')](_0x2920('0x12'))?this[_0x2920('0x14')](_0x2920('0x12'))[_0x2920('0x15')](','):null;},'comment':_0x2920('0x16')},'dtmfmode':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x17'),'info','shortinfo',_0x2920('0x18'),_0x2920('0x19')),'defaultValue':_0x2920('0x17')},'directmedia':{'type':Sequelize['ENUM'](_0x2920('0x1a'),'no',_0x2920('0x1b'),_0x2920('0x1c'),_0x2920('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2920('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2920('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x2920('0x2')],'defaultValue':_0x2920('0x1e'),'set':function(_0x5a723f){this[_0x2920('0x11')](_0x2920('0x1f'),_0x5a723f?_0x5a723f['join'](','):null);},'get':function(){return this['getDataValue'](_0x2920('0x1f'))?this[_0x2920('0x14')](_0x2920('0x1f'))[_0x2920('0x15')](','):null;},'comment':_0x2920('0x20')},'callgroup':{'type':Sequelize[_0x2920('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2920('0x2')]},'pickupgroup':{'type':Sequelize[_0x2920('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2920('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2920('0x2')],'defaultValue':_0x2920('0x21')},'allow':{'type':Sequelize[_0x2920('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3fc581){this['setDataValue'](_0x2920('0x22'),_0x3fc581?_0x3fc581[_0x2920('0x13')](';'):_0x2920('0x23'));},'get':function(){return this[_0x2920('0x14')](_0x2920('0x22'))?this[_0x2920('0x14')](_0x2920('0x22'))[_0x2920('0x15')](';'):null;},'comment':_0x2920('0x24')},'autoframing':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'insecure':{'type':Sequelize[_0x2920('0x2')],'defaultValue':_0x2920('0x25'),'set':function(_0x4bf05c){this[_0x2920('0x11')](_0x2920('0x26'),_0x4bf05c?_0x4bf05c[_0x2920('0x13')](','):null);},'get':function(){return this[_0x2920('0x14')](_0x2920('0x26'))?this[_0x2920('0x14')]('insecure')['split'](','):null;},'comment':_0x2920('0x27')},'trustrpid':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2920('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x2920('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x2920('0x28')](0xb)},'setvar':{'type':Sequelize[_0x2920('0x2')]},'callerid':{'type':Sequelize[_0x2920('0x2')],'defaultValue':_0x2920('0x29')},'amaflags':{'type':Sequelize[_0x2920('0x2')]},'callcounter':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no'),'defaultValue':_0x2920('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x2920('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x2920('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2920('0x4')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2920('0x1a'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x2920('0x2a'),_0x2920('0x2b'),_0x2920('0x2c'))},'session_expires':{'type':Sequelize[_0x2920('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x2920('0x28')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2920('0x2d'),_0x2920('0x2e')),'defaultValue':_0x2920('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0x2920('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x2920('0x2')]},'port':{'type':Sequelize[_0x2920('0x28')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x2920('0x1a')},'keepalive':{'type':Sequelize[_0x2920('0x28')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x2920('0x2')]},'rtptimeout':{'type':Sequelize[_0x2920('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2920('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2920('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no',_0x2920('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2920('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x2920('0x28')](0xb)},'timerb':{'type':Sequelize[_0x2920('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2920('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0x2920('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2920('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2920('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2920('0x2')]},'maxforwards':{'type':Sequelize[_0x2920('0x28')](0xb)},'encryption':{'type':Sequelize[_0x2920('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2920('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no','fingerprint',_0x2920('0x30'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2920('0x2')]},'dtlscipher':{'type':Sequelize[_0x2920('0x2')]},'dtlscafile':{'type':Sequelize[_0x2920('0x2')]},'dtlscapath':{'type':Sequelize[_0x2920('0x2')]},'dtlssetup':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x31'),_0x2920('0x32'),_0x2920('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2920('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x2920('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x2920('0x4')](_0x2920('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x2920('0x2')]},'mohinterpret':{'type':Sequelize[_0x2920('0x2')]},'mohsuggest':{'type':Sequelize[_0x2920('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x2920('0x4')]('yes','no',_0x2920('0x1b'),_0x2920('0x1c'),_0x2920('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2920('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2920('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x5fed=['INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','actpass','dynamic','update,nonat','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x34e639,_0x23ae3f){var _0x52823e=function(_0x12b835){while(--_0x12b835){_0x34e639['push'](_0x34e639['shift']());}};_0x52823e(++_0x23ae3f);}(_0x5fed,0x1cf));var _0xd5fe=function(_0x5b33be,_0x20b6e7){_0x5b33be=_0x5b33be-0x0;var _0x1497f4=_0x5fed[_0x5b33be];return _0x1497f4;};'use strict';var Sequelize=require('sequelize');module[_0xd5fe('0x0')]={'name':{'type':Sequelize[_0xd5fe('0x1')],'allowNull':![],'unique':_0xd5fe('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x4'),'user',_0xd5fe('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xd5fe('0x1')],'allowNull':![],'defaultValue':_0xd5fe('0x6')},'callingpres':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x7'),_0xd5fe('0x8'),_0xd5fe('0x9'),_0xd5fe('0xa'),'PROHIB_NOT_SCREENED',_0xd5fe('0xb'),'PROHIB_FAILED_SCREEN',_0xd5fe('0xc'))},'deny':{'type':Sequelize[_0xd5fe('0x1')]},'permit':{'type':Sequelize[_0xd5fe('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xd5fe('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xd5fe('0x1')],'defaultValue':'udp','set':function(_0x2b4bc1){this[_0xd5fe('0xd')](_0xd5fe('0xe'),_0x2b4bc1?_0x2b4bc1[_0xd5fe('0xf')](','):null);},'get':function(){return this[_0xd5fe('0x10')]('transport')?this[_0xd5fe('0x10')](_0xd5fe('0xe'))[_0xd5fe('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x12'),_0xd5fe('0x13'),_0xd5fe('0x14'),_0xd5fe('0x15'),_0xd5fe('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xd5fe('0x3')]('yes','no',_0xd5fe('0x17'),_0xd5fe('0x18'),_0xd5fe('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd5fe('0x1')]},'directmediadeny':{'type':Sequelize[_0xd5fe('0x1')]},'nat':{'type':Sequelize[_0xd5fe('0x1')],'defaultValue':_0xd5fe('0x1b'),'set':function(_0x501bbe){this[_0xd5fe('0xd')](_0xd5fe('0x1c'),_0x501bbe?_0x501bbe['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xd5fe('0x10')](_0xd5fe('0x1c'))['split'](','):null;},'comment':_0xd5fe('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xd5fe('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xd5fe('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd5fe('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd5fe('0x1')],'defaultValue':_0xd5fe('0x1e')},'allow':{'type':Sequelize[_0xd5fe('0x1')],'allowNull':![],'defaultValue':_0xd5fe('0x1f'),'set':function(_0x40ccec){this[_0xd5fe('0xd')](_0xd5fe('0x20'),_0x40ccec?_0x40ccec[_0xd5fe('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue']('allow')?this[_0xd5fe('0x10')](_0xd5fe('0x20'))[_0xd5fe('0x11')](';'):null;},'comment':_0xd5fe('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0xd5fe('0x1a'),'no')},'insecure':{'type':Sequelize[_0xd5fe('0x1')],'defaultValue':'port,invite','set':function(_0x3c66c8){this[_0xd5fe('0xd')](_0xd5fe('0x22'),_0x3c66c8?_0x3c66c8[_0xd5fe('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xd5fe('0x22'))?this[_0xd5fe('0x10')](_0xd5fe('0x22'))[_0xd5fe('0x11')](','):null;},'comment':_0xd5fe('0x23')},'trustrpid':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no',_0xd5fe('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0xd5fe('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'setvar':{'type':Sequelize[_0xd5fe('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd5fe('0x1')]},'callcounter':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no'),'defaultValue':_0xd5fe('0x1a')},'busylevel':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0xd5fe('0x1')]},'template':{'type':Sequelize[_0xd5fe('0x1')]},'videosupport':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no',_0xd5fe('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xd5fe('0x27'),_0xd5fe('0x28'),_0xd5fe('0x29'))},'session_expires':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x2a'),_0xd5fe('0x2b')),'defaultValue':_0xd5fe('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xd5fe('0x1')]},'regexten':{'type':Sequelize[_0xd5fe('0x1')]},'fromdomain':{'type':Sequelize[_0xd5fe('0x1')]},'fromuser':{'type':Sequelize[_0xd5fe('0x1')]},'port':{'type':Sequelize[_0xd5fe('0x25')](0x5)},'qualify':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no'),'defaultValue':_0xd5fe('0x1a')},'keepalive':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xd5fe('0x1')]},'defaultuser':{'type':Sequelize[_0xd5fe('0x1')]},'rtptimeout':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no',_0xd5fe('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd5fe('0x1')]},'callbackextension':{'type':Sequelize[_0xd5fe('0x1')]},'timert1':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xd5fe('0x1')]},'contactdeny':{'type':Sequelize[_0xd5fe('0x1')]},'contactacl':{'type':Sequelize[_0xd5fe('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xd5fe('0x1')]},'use_q850_reason':{'type':Sequelize[_0xd5fe('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xd5fe('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xd5fe('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xd5fe('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no',_0xd5fe('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xd5fe('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd5fe('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xd5fe('0x1')]},'dtlscipher':{'type':Sequelize[_0xd5fe('0x1')]},'dtlscafile':{'type':Sequelize[_0xd5fe('0x1')]},'dtlscapath':{'type':Sequelize[_0xd5fe('0x1')]},'dtlssetup':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x2e'),'passive',_0xd5fe('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd5fe('0x1')]},'recordofffeature':{'type':Sequelize[_0xd5fe('0x1')]},'call_limit':{'type':Sequelize[_0xd5fe('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xd5fe('0x3')](_0xd5fe('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xd5fe('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xd5fe('0x1')]},'parkinglot':{'type':Sequelize[_0xd5fe('0x1')]},'description':{'type':Sequelize[_0xd5fe('0x1')]},'host':{'type':Sequelize[_0xd5fe('0x1')],'defaultValue':_0xd5fe('0x30')},'canreinvite':{'type':Sequelize[_0xd5fe('0x3')]('yes','no','nonat','update',_0xd5fe('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xd5fe('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd5fe('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 2a46c34..f4f2e1e 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 _0x4f7b=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','set','save','update','destroy','Trunks','UserProfileResource','stack','name','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','include','show','params','find','clone','get','updatedAt','body','createdAt','includeAll','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','autoAssociation','findAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce'];(function(_0x5ad3d3,_0x2d400c){var _0x4344e7=function(_0x557356){while(--_0x557356){_0x5ad3d3['push'](_0x5ad3d3['shift']());}};_0x4344e7(++_0x2d400c);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x2ab495,_0x6abed5){_0x2ab495=_0x2ab495-0x0;var _0x503f92=_0x4f7b[_0x2ab495];return _0x503f92;};'use strict';var pdf=require(_0xb4f7('0x0'));var emlformat=require(_0xb4f7('0x1'));var rimraf=require(_0xb4f7('0x2'));var zipdir=require(_0xb4f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4f7('0x4'));var moment=require(_0xb4f7('0x5'));var BPromise=require(_0xb4f7('0x6'));var Mustache=require(_0xb4f7('0x7'));var util=require(_0xb4f7('0x8'));var path=require(_0xb4f7('0x9'));var sox=require(_0xb4f7('0xa'));var csv=require(_0xb4f7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb4f7('0xc'));var squel=require('squel');var crypto=require(_0xb4f7('0xd'));var jsforce=require(_0xb4f7('0xe'));var deskjs=require(_0xb4f7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb4f7('0x10'));var Papa=require('papaparse');var Redis=require(_0xb4f7('0x11'));var authService=require(_0xb4f7('0x12'));var qs=require(_0xb4f7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4f7('0x14'));var logger=require(_0xb4f7('0x15'))(_0xb4f7('0x16'));var utils=require(_0xb4f7('0x17'));var config=require(_0xb4f7('0x18'));var db=require(_0xb4f7('0x19'))['db'];var jayson=require(_0xb4f7('0x1a'));var client=jayson[_0xb4f7('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x28f487,_0x226994,_0x43e112){if(_0x43e112){var _0x989c29=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x989c29[_0xb4f7('0x1c')](_0x226994)){return _0x28f487;}else{throw new db[(_0xb4f7('0x1d'))]['ValidationError'](_0xb4f7('0x1e'));}}else{return _0x28f487;}}function respondWithRpcPromise(_0x58939f,_0x3db926,_0x2f4a91,_0x8bd17c){return new BPromise(function(_0x2c304b,_0x33e473){var _0x35ce44=_0x8bd17c||client;return _0x35ce44[_0xb4f7('0x1f')](_0x58939f,_0x2f4a91)[_0xb4f7('0x20')](function(_0x12ea5d){logger['info'](_0xb4f7('0x21'),_0x3db926,_0xb4f7('0x22'));logger[_0xb4f7('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3db926,_0xb4f7('0x22'),JSON[_0xb4f7('0x24')](_0x12ea5d));if(_0x12ea5d[_0xb4f7('0x25')]){if(_0x12ea5d['error']['code']===0x1f4){logger[_0xb4f7('0x25')](_0xb4f7('0x21'),_0x3db926,_0x12ea5d['error'][_0xb4f7('0x26')]);return _0x33e473(_0x12ea5d[_0xb4f7('0x25')][_0xb4f7('0x26')]);}logger[_0xb4f7('0x25')]('Trunk,\x20%s,\x20%s',_0x3db926,_0x12ea5d[_0xb4f7('0x25')]['message']);return _0x2c304b(_0x12ea5d[_0xb4f7('0x25')][_0xb4f7('0x26')]);}else{logger[_0xb4f7('0x27')](_0xb4f7('0x21'),_0x3db926,_0xb4f7('0x22'));_0x2c304b(_0x12ea5d[_0xb4f7('0x28')]['message']);}})[_0xb4f7('0x29')](function(_0x291166){logger[_0xb4f7('0x25')](_0xb4f7('0x21'),_0x3db926,_0x291166);_0x33e473(_0x291166);});});}function respondWithStatusCode(_0x2ec8d4,_0x2705e3){_0x2705e3=_0x2705e3||0xcc;return function(_0x57cf99){if(_0x57cf99){return _0x2ec8d4[_0xb4f7('0x2a')](_0x2705e3);}return _0x2ec8d4[_0xb4f7('0x2b')](_0x2705e3)[_0xb4f7('0x2c')]();};}function respondWithResult(_0x1f385d,_0x255199){_0x255199=_0x255199||0xc8;return function(_0x594c04){if(_0x594c04){return _0x1f385d[_0xb4f7('0x2b')](_0x255199)[_0xb4f7('0x2d')](_0x594c04);}};}function respondWithFilteredResult(_0x52922c,_0x18b1f3){return function(_0x467541){if(_0x467541){var _0x99a8bb=_0x467541[_0xb4f7('0x2e')],_0x35582a=_0x18b1f3[_0xb4f7('0x2f')],_0x47ba78=_0x18b1f3[_0xb4f7('0x2f')]+_0x18b1f3['limit'],_0x2cb1b3;if(_0x47ba78>=_0x99a8bb){_0x47ba78=_0x99a8bb;_0x2cb1b3=0xc8;}else{_0x2cb1b3=0xce;}_0x52922c['status'](_0x2cb1b3);return _0x52922c[_0xb4f7('0x30')]('Content-Range',_0x35582a+'-'+_0x47ba78+'/'+_0x99a8bb)[_0xb4f7('0x2d')](_0x467541);}return null;};}function patchUpdates(_0x2d61f0){return function(_0x4d21a1){try{jsonpatch['apply'](_0x4d21a1,_0x2d61f0,!![]);}catch(_0x1d6625){return BPromise['reject'](_0x1d6625);}return _0x4d21a1[_0xb4f7('0x31')]();};}function saveUpdates(_0x268449,_0x365b54){return function(_0x20d2ba){if(_0x20d2ba){return _0x20d2ba[_0xb4f7('0x32')](_0x268449)[_0xb4f7('0x20')](function(_0x6db48c){return _0x6db48c;});}return null;};}function removeEntity(_0x4824f5,_0x554f69){return function(_0x2d51c2){if(_0x2d51c2){return _0x2d51c2[_0xb4f7('0x33')]()['then'](function(){var _0x1dcd2b=_0x2d51c2['get']({'plain':!![]});var _0x107940=_0xb4f7('0x34');return db[_0xb4f7('0x35')][_0xb4f7('0x33')]({'where':{'type':_0x107940,'resourceId':_0x1dcd2b['id']}})[_0xb4f7('0x20')](function(){return _0x2d51c2;});})[_0xb4f7('0x20')](function(){_0x4824f5[_0xb4f7('0x2b')](0xcc)[_0xb4f7('0x2c')]();});}};}function handleEntityNotFound(_0x231f41,_0x13c36e){return function(_0x4a0b1b){if(!_0x4a0b1b){_0x231f41[_0xb4f7('0x2a')](0x194);}return _0x4a0b1b;};}function handleError(_0x13e7e5,_0x171a35){_0x171a35=_0x171a35||0x1f4;return function(_0x467203){logger[_0xb4f7('0x25')](_0x467203[_0xb4f7('0x36')]);if(_0x467203[_0xb4f7('0x37')]){delete _0x467203[_0xb4f7('0x37')];}_0x13e7e5[_0xb4f7('0x2b')](_0x171a35)['send'](_0x467203);};}exports[_0xb4f7('0x38')]=function(_0x8ccfef,_0x52304){var _0x16eb19={},_0x19999d={},_0x539858={'count':0x0,'rows':[]};var _0x4b8fbf=_['map'](db[_0xb4f7('0x39')][_0xb4f7('0x3a')],function(_0x5c59a0){return{'name':_0x5c59a0[_0xb4f7('0x3b')],'type':_0x5c59a0[_0xb4f7('0x3c')][_0xb4f7('0x3d')]};});_0x19999d[_0xb4f7('0x3e')]=_['map'](_0x4b8fbf,_0xb4f7('0x37'));_0x19999d[_0xb4f7('0x3f')]=_[_0xb4f7('0x40')](_0x8ccfef[_0xb4f7('0x3f')]);_0x19999d['filters']=_[_0xb4f7('0x41')](_0x19999d[_0xb4f7('0x3e')],_0x19999d[_0xb4f7('0x3f')]);_0x16eb19[_0xb4f7('0x42')]=_[_0xb4f7('0x41')](_0x19999d[_0xb4f7('0x3e')],qs[_0xb4f7('0x43')](_0x8ccfef[_0xb4f7('0x3f')][_0xb4f7('0x43')]));_0x16eb19[_0xb4f7('0x42')]=_0x16eb19[_0xb4f7('0x42')][_0xb4f7('0x44')]?_0x16eb19[_0xb4f7('0x42')]:_0x19999d[_0xb4f7('0x3e')];if(!_0x8ccfef[_0xb4f7('0x3f')][_0xb4f7('0x45')](_0xb4f7('0x46'))){_0x16eb19[_0xb4f7('0x47')]=qs[_0xb4f7('0x47')](_0x8ccfef[_0xb4f7('0x3f')][_0xb4f7('0x47')]);_0x16eb19[_0xb4f7('0x2f')]=qs[_0xb4f7('0x2f')](_0x8ccfef[_0xb4f7('0x3f')]['offset']);}_0x16eb19[_0xb4f7('0x48')]=qs['sort'](_0x8ccfef[_0xb4f7('0x3f')][_0xb4f7('0x49')]);_0x16eb19[_0xb4f7('0x4a')]=qs[_0xb4f7('0x4b')](_[_0xb4f7('0x4c')](_0x8ccfef[_0xb4f7('0x3f')],_0x19999d[_0xb4f7('0x4b')]),_0x4b8fbf);if(_0x8ccfef[_0xb4f7('0x3f')][_0xb4f7('0x4d')]){_0x16eb19[_0xb4f7('0x4a')]=_['merge'](_0x16eb19[_0xb4f7('0x4a')],{'$or':_['map'](_0x4b8fbf,function(_0x18e809){if(_0x18e809[_0xb4f7('0x3c')]!=='VIRTUAL'){var _0x2173df={};_0x2173df[_0x18e809[_0xb4f7('0x37')]]={'$like':'%'+_0x8ccfef[_0xb4f7('0x3f')][_0xb4f7('0x4d')]+'%'};return _0x2173df;}})});}_0x16eb19=_[_0xb4f7('0x4e')]({},_0x16eb19,_0x8ccfef[_0xb4f7('0x4f')]);var _0x5a9622={'where':_0x16eb19[_0xb4f7('0x4a')]};return db[_0xb4f7('0x39')][_0xb4f7('0x2e')](_0x5a9622)[_0xb4f7('0x20')](function(_0x35576b){_0x539858[_0xb4f7('0x2e')]=_0x35576b;if(_0x8ccfef['query']['includeAll']){_0x16eb19[_0xb4f7('0x50')]=[{'all':!![]}];}return db[_0xb4f7('0x39')]['findAll'](_0x16eb19);})[_0xb4f7('0x20')](function(_0xe24cb7){_0x539858['rows']=_0xe24cb7;return _0x539858;})['then'](respondWithFilteredResult(_0x52304,_0x16eb19))[_0xb4f7('0x29')](handleError(_0x52304,null));};exports[_0xb4f7('0x51')]=function(_0x4f6811,_0x396893){var _0x2dffc6={'raw':![],'where':{'id':_0x4f6811[_0xb4f7('0x52')]['id']}},_0xad9da7={};_0xad9da7[_0xb4f7('0x3e')]=_['keys'](db[_0xb4f7('0x39')]['rawAttributes']);_0xad9da7['query']=_[_0xb4f7('0x40')](_0x4f6811[_0xb4f7('0x3f')]);_0xad9da7[_0xb4f7('0x4b')]=_['intersection'](_0xad9da7[_0xb4f7('0x3e')],_0xad9da7[_0xb4f7('0x3f')]);_0x2dffc6['attributes']=_[_0xb4f7('0x41')](_0xad9da7[_0xb4f7('0x3e')],qs[_0xb4f7('0x43')](_0x4f6811[_0xb4f7('0x3f')][_0xb4f7('0x43')]));_0x2dffc6[_0xb4f7('0x42')]=_0x2dffc6[_0xb4f7('0x42')][_0xb4f7('0x44')]?_0x2dffc6['attributes']:_0xad9da7[_0xb4f7('0x3e')];if(_0x4f6811[_0xb4f7('0x3f')]['includeAll']){_0x2dffc6[_0xb4f7('0x50')]=[{'all':!![]}];}_0x2dffc6=_[_0xb4f7('0x4e')]({},_0x2dffc6,_0x4f6811['options']);return db['Trunk'][_0xb4f7('0x53')](_0x2dffc6)[_0xb4f7('0x20')](handleEntityNotFound(_0x396893,null))[_0xb4f7('0x20')](respondWithResult(_0x396893,null))[_0xb4f7('0x29')](handleError(_0x396893,null));};exports[_0xb4f7('0x54')]=function(_0x20dfdc,_0x42eed7){var _0x386b87={'where':{'id':_0x20dfdc['params']['id']}},_0x3132db={};_0x3132db[_0xb4f7('0x3e')]=_[_0xb4f7('0x40')](db[_0xb4f7('0x39')][_0xb4f7('0x3a')]);_0x386b87[_0xb4f7('0x42')]=_['intersection'](_0x3132db[_0xb4f7('0x3e')],qs['fields'](_0x20dfdc[_0xb4f7('0x3f')]['fields']));_0x386b87[_0xb4f7('0x42')]=_0x386b87[_0xb4f7('0x42')][_0xb4f7('0x44')]?_0x386b87[_0xb4f7('0x42')]:_0x3132db[_0xb4f7('0x3e')];if(_0x20dfdc[_0xb4f7('0x3f')]['includeAll']){_0x386b87[_0xb4f7('0x50')]=[{'all':!![]}];}_0x386b87=_[_0xb4f7('0x4e')]({},_0x386b87,_0x20dfdc[_0xb4f7('0x4f')]);return db['Trunk'][_0xb4f7('0x53')](_0x386b87)[_0xb4f7('0x20')](handleEntityNotFound(_0x42eed7,null))[_0xb4f7('0x20')](function(_0x59e068){if(_0x59e068){var _0x45f6d1=_0x59e068[_0xb4f7('0x55')]({'plain':!![]});_0x45f6d1=qs['omit'](_0x45f6d1,['id','createdAt',_0xb4f7('0x56')]);_0x20dfdc['body']=_['omit'](_0x20dfdc[_0xb4f7('0x57')],['id',_0xb4f7('0x58'),'updatedAt']);return db[_0xb4f7('0x39')]['create'](_[_0xb4f7('0x4e')](_0x45f6d1,_0x20dfdc[_0xb4f7('0x57')]),{'include':_0x20dfdc[_0xb4f7('0x3f')][_0xb4f7('0x59')]?[{'all':!![]}]:undefined})['then'](function(_0x59bf54){var _0x19634e=_0x20dfdc[_0xb4f7('0x5a')][_0xb4f7('0x55')]({'plain':!![]});if(!_0x19634e)throw new Error(_0xb4f7('0x5b'));if(_0x19634e[_0xb4f7('0x5c')]==='user'){var _0x350125=_0x59bf54[_0xb4f7('0x55')]({'plain':!![]});var _0x1a727f=_0xb4f7('0x34');return db[_0xb4f7('0x5d')][_0xb4f7('0x53')]({'where':{'name':_0x1a727f,'userProfileId':_0x19634e['userProfileId']},'raw':!![]})['then'](function(_0x210003){if(_0x210003&&_0x210003['autoAssociation']===0x0){return db[_0xb4f7('0x35')][_0xb4f7('0x5e')]({'name':_0x350125['name'],'resourceId':_0x350125['id'],'type':_0x210003['name'],'sectionId':_0x210003['id']},{})['then'](function(){return _0x59bf54;});}else{return _0x59bf54;}})['catch'](function(_0x30976f){logger[_0xb4f7('0x25')](_0xb4f7('0x5f'),_0x30976f);throw _0x30976f;});}return _0x59bf54;});}})[_0xb4f7('0x20')](respondWithResult(_0x42eed7,0xc9))[_0xb4f7('0x29')](handleError(_0x42eed7,null));};exports[_0xb4f7('0x5e')]=function(_0x19d98f,_0x4e54b9,_0x4f0057){var _0x151ad9;return db[_0xb4f7('0x39')]['create'](_0x19d98f['body'],{'raw':!![]})[_0xb4f7('0x20')](function(_0xcc6213){_0x151ad9=_0xcc6213;return db[_0xb4f7('0x39')]['findAll']({'raw':!![]});})[_0xb4f7('0x20')](function(_0x483ae3){var _0x30dfcb=fs['readFileSync'](path[_0xb4f7('0x60')](config[_0xb4f7('0x61')],_0xb4f7('0x62')),'utf8');var _0x5e5d53=fs[_0xb4f7('0x63')](path[_0xb4f7('0x60')](config[_0xb4f7('0x61')],_0xb4f7('0x64')),_0xb4f7('0x65'));var _0x20e5ec=ejs[_0xb4f7('0x66')](_0x30dfcb,{'trunks':_0x483ae3||[]});fs['writeFileSync'](_0xb4f7('0x67'),_0x20e5ec);if(_0x151ad9['registry']){var _0x202801=ejs[_0xb4f7('0x66')](_0x5e5d53,{'trunks':_0x483ae3||[]});fs[_0xb4f7('0x68')](_0xb4f7('0x69'),_0x202801);}})['then'](function(){return respondWithRpcPromise(_0xb4f7('0x6a'),_0xb4f7('0x5e'),{'module':_0xb4f7('0x6b')});})[_0xb4f7('0x20')](function(){var _0x50f537=_0x19d98f[_0xb4f7('0x5a')][_0xb4f7('0x55')]({'plain':!![]});if(!_0x50f537)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50f537[_0xb4f7('0x5c')]===_0xb4f7('0x5a')){var _0xf537ea=_0x151ad9[_0xb4f7('0x55')]({'plain':!![]});return db[_0xb4f7('0x5d')][_0xb4f7('0x53')]({'where':{'name':_0xb4f7('0x34'),'userProfileId':_0x50f537[_0xb4f7('0x6c')]},'raw':!![]})['then'](function(_0x51e8fe){if(_0x51e8fe&&_0x51e8fe[_0xb4f7('0x6d')]===0x0){return db[_0xb4f7('0x35')][_0xb4f7('0x5e')]({'name':_0xf537ea[_0xb4f7('0x37')],'resourceId':_0xf537ea['id'],'type':_0x51e8fe[_0xb4f7('0x37')],'sectionId':_0x51e8fe['id']},{})[_0xb4f7('0x20')](function(){return _0x151ad9;});}else{return _0x151ad9;}})['catch'](function(_0x1d6cd9){logger['error'](_0xb4f7('0x5f'),_0x1d6cd9);throw _0x1d6cd9;});}return _0x151ad9;})[_0xb4f7('0x20')](respondWithResult(_0x4e54b9,0xc9))[_0xb4f7('0x29')](handleError(_0x4e54b9,null));};exports['update']=function(_0x2c116d,_0x463ddb,_0x5b3ef9){var _0x8909ac;return db['Trunk'][_0xb4f7('0x53')]({'where':{'id':_0x2c116d[_0xb4f7('0x52')]['id']}})[_0xb4f7('0x20')](handleEntityNotFound(_0x463ddb,null))[_0xb4f7('0x20')](saveUpdates(_0x2c116d[_0xb4f7('0x57')],null))['then'](function(_0x290b4d){if(_0x290b4d){_0x8909ac=_0x290b4d;return db[_0xb4f7('0x39')][_0xb4f7('0x6e')]({'raw':!![]});}})[_0xb4f7('0x20')](function(_0xe70236){if(_0xe70236){var _0x591b90=fs['readFileSync'](path['join'](config[_0xb4f7('0x61')],_0xb4f7('0x62')),_0xb4f7('0x65'));var _0x30e4ac=fs[_0xb4f7('0x63')](path[_0xb4f7('0x60')](config[_0xb4f7('0x61')],_0xb4f7('0x64')),_0xb4f7('0x65'));var _0x42f970=ejs['render'](_0x591b90,{'trunks':_0xe70236||[]});fs[_0xb4f7('0x68')](_0xb4f7('0x67'),_0x42f970);var _0x360421=ejs[_0xb4f7('0x66')](_0x30e4ac,{'trunks':_0xe70236||[]});fs[_0xb4f7('0x68')](_0xb4f7('0x69'),_0x360421);return respondWithRpcPromise('Reload',_0xb4f7('0x32'),{'module':_0xb4f7('0x6b')});}return null;})[_0xb4f7('0x20')](function(_0x13dde4){if(_0x13dde4){return _0x8909ac;}})[_0xb4f7('0x20')](respondWithResult(_0x463ddb,null))['catch'](handleError(_0x463ddb,null));};exports['destroy']=function(_0x52c20b,_0x2afe68,_0x327b8d){var _0x16773e;return db[_0xb4f7('0x39')][_0xb4f7('0x53')]({'where':{'id':_0x52c20b[_0xb4f7('0x52')]['id']}})[_0xb4f7('0x20')](handleEntityNotFound(_0x2afe68,null))[_0xb4f7('0x20')](removeEntity(_0x2afe68,null))[_0xb4f7('0x20')](function(){return db[_0xb4f7('0x39')][_0xb4f7('0x6e')]({'raw':!![]});})[_0xb4f7('0x20')](function(_0x2cab72){var _0x145db3=fs['readFileSync'](path[_0xb4f7('0x60')](config[_0xb4f7('0x61')],_0xb4f7('0x62')),'utf8');var _0x53e68e=fs[_0xb4f7('0x63')](path[_0xb4f7('0x60')](config['root'],_0xb4f7('0x64')),_0xb4f7('0x65'));var _0xf3017d=ejs[_0xb4f7('0x66')](_0x145db3,{'trunks':_0x2cab72});var _0x5de40b=ejs[_0xb4f7('0x66')](_0x53e68e,{'trunks':_0x2cab72});fs[_0xb4f7('0x68')](_0xb4f7('0x67'),_0xf3017d);fs[_0xb4f7('0x68')](_0xb4f7('0x69'),_0x5de40b);return respondWithRpcPromise(_0xb4f7('0x6a'),_0xb4f7('0x33'),{'module':'chan_sip.so'});})[_0xb4f7('0x29')](handleError(_0x2afe68,null));}; \ No newline at end of file +var _0x9d9b=['filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','clone','intersection','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','UserProfileSection','update','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','destroy','get','Trunks','UserProfileResource','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','name','keys','query','attributes','fields','length','nolimit','order','sort','where'];(function(_0x3f1967,_0xd2cde6){var _0x125416=function(_0x3de135){while(--_0x3de135){_0x3f1967['push'](_0x3f1967['shift']());}};_0x125416(++_0xd2cde6);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x52c03c,_0x3b9384){_0x52c03c=_0x52c03c-0x0;var _0x975813=_0x9d9b[_0x52c03c];return _0x975813;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9d9('0x0'));var rimraf=require(_0xb9d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9d9('0x2'));var rp=require('request-promise');var moment=require(_0xb9d9('0x3'));var BPromise=require(_0xb9d9('0x4'));var Mustache=require(_0xb9d9('0x5'));var util=require('util');var path=require(_0xb9d9('0x6'));var sox=require('sox');var csv=require(_0xb9d9('0x7'));var ejs=require(_0xb9d9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb9d9('0x9'));var crypto=require(_0xb9d9('0xa'));var jsforce=require(_0xb9d9('0xb'));var deskjs=require(_0xb9d9('0xc'));var toCsv=require(_0xb9d9('0x7'));var querystring=require(_0xb9d9('0xd'));var Papa=require(_0xb9d9('0xe'));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(_0xb9d9('0xf'));var logger=require(_0xb9d9('0x10'))(_0xb9d9('0x11'));var utils=require('../../config/utils');var config=require(_0xb9d9('0x12'));var db=require(_0xb9d9('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb9d9('0x14')]['http']({'port':0x232a});function checkPasswordPattern(_0x1245e0,_0x3ad511,_0x1fa082){if(_0x1fa082){var _0x36c468=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36c468[_0xb9d9('0x15')](_0x3ad511)){return _0x1245e0;}else{throw new db[(_0xb9d9('0x16'))][(_0xb9d9('0x17'))](_0xb9d9('0x18'));}}else{return _0x1245e0;}}function respondWithRpcPromise(_0x4cbc4d,_0x4c8864,_0x3db648,_0x2c9039){return new BPromise(function(_0x3909ab,_0x168f07){var _0x5c6480=_0x2c9039||client;return _0x5c6480['request'](_0x4cbc4d,_0x3db648)[_0xb9d9('0x19')](function(_0x5617f1){logger['info'](_0xb9d9('0x1a'),_0x4c8864,_0xb9d9('0x1b'));logger[_0xb9d9('0x1c')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4c8864,_0xb9d9('0x1b'),JSON[_0xb9d9('0x1d')](_0x5617f1));if(_0x5617f1['error']){if(_0x5617f1[_0xb9d9('0x1e')][_0xb9d9('0x1f')]===0x1f4){logger['error'](_0xb9d9('0x1a'),_0x4c8864,_0x5617f1[_0xb9d9('0x1e')]['message']);return _0x168f07(_0x5617f1[_0xb9d9('0x1e')][_0xb9d9('0x20')]);}logger[_0xb9d9('0x1e')](_0xb9d9('0x1a'),_0x4c8864,_0x5617f1[_0xb9d9('0x1e')][_0xb9d9('0x20')]);return _0x3909ab(_0x5617f1['error'][_0xb9d9('0x20')]);}else{logger[_0xb9d9('0x21')]('Trunk,\x20%s,\x20%s',_0x4c8864,_0xb9d9('0x1b'));_0x3909ab(_0x5617f1[_0xb9d9('0x22')][_0xb9d9('0x20')]);}})[_0xb9d9('0x23')](function(_0x543d1a){logger[_0xb9d9('0x1e')](_0xb9d9('0x1a'),_0x4c8864,_0x543d1a);_0x168f07(_0x543d1a);});});}function respondWithStatusCode(_0x6fa6af,_0x436cb7){_0x436cb7=_0x436cb7||0xcc;return function(_0x2650f7){if(_0x2650f7){return _0x6fa6af[_0xb9d9('0x24')](_0x436cb7);}return _0x6fa6af['status'](_0x436cb7)[_0xb9d9('0x25')]();};}function respondWithResult(_0x42181d,_0x3cf063){_0x3cf063=_0x3cf063||0xc8;return function(_0x48493c){if(_0x48493c){return _0x42181d[_0xb9d9('0x26')](_0x3cf063)[_0xb9d9('0x27')](_0x48493c);}};}function respondWithFilteredResult(_0x63a35e,_0x290c01){return function(_0x3caaaf){if(_0x3caaaf){var _0x402968=_0x3caaaf[_0xb9d9('0x28')],_0x89f901=_0x290c01[_0xb9d9('0x29')],_0x5c74eb=_0x290c01[_0xb9d9('0x29')]+_0x290c01[_0xb9d9('0x2a')],_0x39f006;if(_0x5c74eb>=_0x402968){_0x5c74eb=_0x402968;_0x39f006=0xc8;}else{_0x39f006=0xce;}_0x63a35e[_0xb9d9('0x26')](_0x39f006);return _0x63a35e['set'](_0xb9d9('0x2b'),_0x89f901+'-'+_0x5c74eb+'/'+_0x402968)[_0xb9d9('0x27')](_0x3caaaf);}return null;};}function patchUpdates(_0x1f8192){return function(_0x212565){try{jsonpatch['apply'](_0x212565,_0x1f8192,!![]);}catch(_0x2af090){return BPromise[_0xb9d9('0x2c')](_0x2af090);}return _0x212565[_0xb9d9('0x2d')]();};}function saveUpdates(_0x847f59,_0x1960ee){return function(_0x3f146d){if(_0x3f146d){return _0x3f146d['update'](_0x847f59)['then'](function(_0x3cd620){return _0x3cd620;});}return null;};}function removeEntity(_0x560153,_0xaa8fe6){return function(_0x2b267b){if(_0x2b267b){return _0x2b267b[_0xb9d9('0x2e')]()['then'](function(){var _0x7aff17=_0x2b267b[_0xb9d9('0x2f')]({'plain':!![]});var _0x175d1b=_0xb9d9('0x30');return db[_0xb9d9('0x31')][_0xb9d9('0x2e')]({'where':{'type':_0x175d1b,'resourceId':_0x7aff17['id']}})[_0xb9d9('0x19')](function(){return _0x2b267b;});})[_0xb9d9('0x19')](function(){_0x560153[_0xb9d9('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f3d78,_0x4e8efd){return function(_0x3730aa){if(!_0x3730aa){_0x4f3d78[_0xb9d9('0x24')](0x194);}return _0x3730aa;};}function handleError(_0x25e252,_0x3099a5){_0x3099a5=_0x3099a5||0x1f4;return function(_0x680f63){logger[_0xb9d9('0x1e')](_0x680f63['stack']);if(_0x680f63['name']){delete _0x680f63['name'];}_0x25e252[_0xb9d9('0x26')](_0x3099a5)[_0xb9d9('0x32')](_0x680f63);};}exports[_0xb9d9('0x33')]=function(_0x275c1a,_0xc6fc9a){var _0x1f351d={},_0x3cf589={},_0x14962e={'count':0x0,'rows':[]};var _0x296d77=_[_0xb9d9('0x34')](db[_0xb9d9('0x35')][_0xb9d9('0x36')],function(_0x1cb825){return{'name':_0x1cb825[_0xb9d9('0x37')],'type':_0x1cb825[_0xb9d9('0x38')][_0xb9d9('0x39')]};});_0x3cf589[_0xb9d9('0x3a')]=_[_0xb9d9('0x34')](_0x296d77,_0xb9d9('0x3b'));_0x3cf589['query']=_[_0xb9d9('0x3c')](_0x275c1a[_0xb9d9('0x3d')]);_0x3cf589['filters']=_['intersection'](_0x3cf589[_0xb9d9('0x3a')],_0x3cf589['query']);_0x1f351d[_0xb9d9('0x3e')]=_['intersection'](_0x3cf589['model'],qs[_0xb9d9('0x3f')](_0x275c1a[_0xb9d9('0x3d')][_0xb9d9('0x3f')]));_0x1f351d[_0xb9d9('0x3e')]=_0x1f351d[_0xb9d9('0x3e')][_0xb9d9('0x40')]?_0x1f351d[_0xb9d9('0x3e')]:_0x3cf589[_0xb9d9('0x3a')];if(!_0x275c1a['query']['hasOwnProperty'](_0xb9d9('0x41'))){_0x1f351d[_0xb9d9('0x2a')]=qs[_0xb9d9('0x2a')](_0x275c1a['query'][_0xb9d9('0x2a')]);_0x1f351d[_0xb9d9('0x29')]=qs[_0xb9d9('0x29')](_0x275c1a[_0xb9d9('0x3d')][_0xb9d9('0x29')]);}_0x1f351d[_0xb9d9('0x42')]=qs[_0xb9d9('0x43')](_0x275c1a[_0xb9d9('0x3d')]['sort']);_0x1f351d[_0xb9d9('0x44')]=qs[_0xb9d9('0x45')](_[_0xb9d9('0x46')](_0x275c1a[_0xb9d9('0x3d')],_0x3cf589[_0xb9d9('0x45')]),_0x296d77);if(_0x275c1a[_0xb9d9('0x3d')][_0xb9d9('0x47')]){_0x1f351d[_0xb9d9('0x44')]=_[_0xb9d9('0x48')](_0x1f351d[_0xb9d9('0x44')],{'$or':_[_0xb9d9('0x34')](_0x296d77,function(_0x474562){if(_0x474562[_0xb9d9('0x38')]!==_0xb9d9('0x49')){var _0x431eb6={};_0x431eb6[_0x474562[_0xb9d9('0x3b')]]={'$like':'%'+_0x275c1a[_0xb9d9('0x3d')]['filter']+'%'};return _0x431eb6;}})});}_0x1f351d=_[_0xb9d9('0x48')]({},_0x1f351d,_0x275c1a[_0xb9d9('0x4a')]);var _0x51b064={'where':_0x1f351d[_0xb9d9('0x44')]};return db[_0xb9d9('0x35')][_0xb9d9('0x28')](_0x51b064)[_0xb9d9('0x19')](function(_0x22891f){_0x14962e[_0xb9d9('0x28')]=_0x22891f;if(_0x275c1a['query'][_0xb9d9('0x4b')]){_0x1f351d[_0xb9d9('0x4c')]=[{'all':!![]}];}return db[_0xb9d9('0x35')][_0xb9d9('0x4d')](_0x1f351d);})['then'](function(_0x20f6ed){_0x14962e[_0xb9d9('0x4e')]=_0x20f6ed;return _0x14962e;})[_0xb9d9('0x19')](respondWithFilteredResult(_0xc6fc9a,_0x1f351d))['catch'](handleError(_0xc6fc9a,null));};exports[_0xb9d9('0x4f')]=function(_0x1c317f,_0x38ce07){var _0x445f17={'raw':![],'where':{'id':_0x1c317f[_0xb9d9('0x50')]['id']}},_0x1be7ee={};_0x1be7ee['model']=_[_0xb9d9('0x3c')](db['Trunk'][_0xb9d9('0x36')]);_0x1be7ee[_0xb9d9('0x3d')]=_['keys'](_0x1c317f[_0xb9d9('0x3d')]);_0x1be7ee['filters']=_['intersection'](_0x1be7ee['model'],_0x1be7ee[_0xb9d9('0x3d')]);_0x445f17[_0xb9d9('0x3e')]=_['intersection'](_0x1be7ee['model'],qs[_0xb9d9('0x3f')](_0x1c317f['query']['fields']));_0x445f17[_0xb9d9('0x3e')]=_0x445f17['attributes'][_0xb9d9('0x40')]?_0x445f17[_0xb9d9('0x3e')]:_0x1be7ee[_0xb9d9('0x3a')];if(_0x1c317f[_0xb9d9('0x3d')]['includeAll']){_0x445f17['include']=[{'all':!![]}];}_0x445f17=_[_0xb9d9('0x48')]({},_0x445f17,_0x1c317f['options']);return db[_0xb9d9('0x35')][_0xb9d9('0x51')](_0x445f17)[_0xb9d9('0x19')](handleEntityNotFound(_0x38ce07,null))[_0xb9d9('0x19')](respondWithResult(_0x38ce07,null))[_0xb9d9('0x23')](handleError(_0x38ce07,null));};exports[_0xb9d9('0x52')]=function(_0x3578d5,_0x595e71){var _0x21adbb={'where':{'id':_0x3578d5['params']['id']}},_0x464698={};_0x464698['model']=_['keys'](db[_0xb9d9('0x35')]['rawAttributes']);_0x21adbb[_0xb9d9('0x3e')]=_[_0xb9d9('0x53')](_0x464698[_0xb9d9('0x3a')],qs[_0xb9d9('0x3f')](_0x3578d5[_0xb9d9('0x3d')][_0xb9d9('0x3f')]));_0x21adbb[_0xb9d9('0x3e')]=_0x21adbb['attributes'][_0xb9d9('0x40')]?_0x21adbb[_0xb9d9('0x3e')]:_0x464698['model'];if(_0x3578d5['query']['includeAll']){_0x21adbb[_0xb9d9('0x4c')]=[{'all':!![]}];}_0x21adbb=_[_0xb9d9('0x48')]({},_0x21adbb,_0x3578d5['options']);return db[_0xb9d9('0x35')][_0xb9d9('0x51')](_0x21adbb)[_0xb9d9('0x19')](handleEntityNotFound(_0x595e71,null))[_0xb9d9('0x19')](function(_0x26b772){if(_0x26b772){var _0x10fa4d=_0x26b772[_0xb9d9('0x2f')]({'plain':!![]});_0x10fa4d=qs[_0xb9d9('0x54')](_0x10fa4d,['id',_0xb9d9('0x55'),_0xb9d9('0x56')]);_0x3578d5[_0xb9d9('0x57')]=_[_0xb9d9('0x54')](_0x3578d5[_0xb9d9('0x57')],['id',_0xb9d9('0x55'),'updatedAt']);return db[_0xb9d9('0x35')]['create'](_['merge'](_0x10fa4d,_0x3578d5[_0xb9d9('0x57')]),{'include':_0x3578d5['query'][_0xb9d9('0x4b')]?[{'all':!![]}]:undefined})[_0xb9d9('0x19')](function(_0x16a749){var _0x2c59b4=_0x3578d5[_0xb9d9('0x58')]['get']({'plain':!![]});if(!_0x2c59b4)throw new Error(_0xb9d9('0x59'));if(_0x2c59b4[_0xb9d9('0x5a')]==='user'){var _0x1b9f4b=_0x16a749['get']({'plain':!![]});var _0x24e528=_0xb9d9('0x30');return db['UserProfileSection'][_0xb9d9('0x51')]({'where':{'name':_0x24e528,'userProfileId':_0x2c59b4[_0xb9d9('0x5b')]},'raw':!![]})[_0xb9d9('0x19')](function(_0x6b9c6b){if(_0x6b9c6b&&_0x6b9c6b[_0xb9d9('0x5c')]===0x0){return db[_0xb9d9('0x31')][_0xb9d9('0x5d')]({'name':_0x1b9f4b[_0xb9d9('0x3b')],'resourceId':_0x1b9f4b['id'],'type':_0x6b9c6b[_0xb9d9('0x3b')],'sectionId':_0x6b9c6b['id']},{})[_0xb9d9('0x19')](function(){return _0x16a749;});}else{return _0x16a749;}})[_0xb9d9('0x23')](function(_0x46d5aa){logger[_0xb9d9('0x1e')](_0xb9d9('0x5e'),_0x46d5aa);throw _0x46d5aa;});}return _0x16a749;});}})[_0xb9d9('0x19')](respondWithResult(_0x595e71,0xc9))[_0xb9d9('0x23')](handleError(_0x595e71,null));};exports['create']=function(_0x195627,_0x1a37fe,_0x2cc9be){var _0x6b701f;return db[_0xb9d9('0x35')][_0xb9d9('0x5d')](_0x195627['body'],{'raw':!![]})[_0xb9d9('0x19')](function(_0x2e57e4){_0x6b701f=_0x2e57e4;return db[_0xb9d9('0x35')][_0xb9d9('0x4d')]({'raw':!![]});})[_0xb9d9('0x19')](function(_0x3ce0a1){var _0xaab6da=fs['readFileSync'](path['join'](config['root'],_0xb9d9('0x5f')),_0xb9d9('0x60'));var _0x138b0d=fs['readFileSync'](path[_0xb9d9('0x61')](config[_0xb9d9('0x62')],_0xb9d9('0x63')),_0xb9d9('0x60'));var _0xcdf235=ejs[_0xb9d9('0x64')](_0xaab6da,{'trunks':_0x3ce0a1||[]});fs[_0xb9d9('0x65')](_0xb9d9('0x66'),_0xcdf235);if(_0x6b701f[_0xb9d9('0x67')]){var _0x220273=ejs['render'](_0x138b0d,{'trunks':_0x3ce0a1||[]});fs[_0xb9d9('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x220273);}})['then'](function(){return respondWithRpcPromise(_0xb9d9('0x68'),_0xb9d9('0x5d'),{'module':_0xb9d9('0x69')});})[_0xb9d9('0x19')](function(){var _0x424765=_0x195627[_0xb9d9('0x58')][_0xb9d9('0x2f')]({'plain':!![]});if(!_0x424765)throw new Error(_0xb9d9('0x59'));if(_0x424765[_0xb9d9('0x5a')]===_0xb9d9('0x58')){var _0x3726ee=_0x6b701f[_0xb9d9('0x2f')]({'plain':!![]});return db[_0xb9d9('0x6a')][_0xb9d9('0x51')]({'where':{'name':_0xb9d9('0x30'),'userProfileId':_0x424765['userProfileId']},'raw':!![]})[_0xb9d9('0x19')](function(_0x2aebe6){if(_0x2aebe6&&_0x2aebe6['autoAssociation']===0x0){return db[_0xb9d9('0x31')][_0xb9d9('0x5d')]({'name':_0x3726ee[_0xb9d9('0x3b')],'resourceId':_0x3726ee['id'],'type':_0x2aebe6['name'],'sectionId':_0x2aebe6['id']},{})[_0xb9d9('0x19')](function(){return _0x6b701f;});}else{return _0x6b701f;}})[_0xb9d9('0x23')](function(_0x243021){logger[_0xb9d9('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x243021);throw _0x243021;});}return _0x6b701f;})[_0xb9d9('0x19')](respondWithResult(_0x1a37fe,0xc9))['catch'](handleError(_0x1a37fe,null));};exports[_0xb9d9('0x6b')]=function(_0x5bcf47,_0x4a43c6,_0x2a3275){var _0x5984fe;return db[_0xb9d9('0x35')][_0xb9d9('0x51')]({'where':{'id':_0x5bcf47[_0xb9d9('0x50')]['id']}})[_0xb9d9('0x19')](handleEntityNotFound(_0x4a43c6,null))['then'](saveUpdates(_0x5bcf47['body'],null))[_0xb9d9('0x19')](function(_0x42d8c5){if(_0x42d8c5){_0x5984fe=_0x42d8c5;return db['Trunk'][_0xb9d9('0x4d')]({'raw':!![]});}})[_0xb9d9('0x19')](function(_0x1df6d9){if(_0x1df6d9){var _0x55e319=fs[_0xb9d9('0x6c')](path[_0xb9d9('0x61')](config['root'],'server/files/templates/trunk.ejs'),_0xb9d9('0x60'));var _0x5f263b=fs[_0xb9d9('0x6c')](path[_0xb9d9('0x61')](config[_0xb9d9('0x62')],'server/files/templates/registry.ejs'),_0xb9d9('0x60'));var _0x25340c=ejs[_0xb9d9('0x64')](_0x55e319,{'trunks':_0x1df6d9||[]});fs[_0xb9d9('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x25340c);var _0x501694=ejs[_0xb9d9('0x64')](_0x5f263b,{'trunks':_0x1df6d9||[]});fs[_0xb9d9('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x501694);return respondWithRpcPromise(_0xb9d9('0x68'),_0xb9d9('0x6b'),{'module':_0xb9d9('0x69')});}return null;})[_0xb9d9('0x19')](function(_0x236c67){if(_0x236c67){return _0x5984fe;}})['then'](respondWithResult(_0x4a43c6,null))['catch'](handleError(_0x4a43c6,null));};exports[_0xb9d9('0x2e')]=function(_0x1fa153,_0x200bdd,_0x2de0fe){var _0x1eacaa;return db['Trunk'][_0xb9d9('0x51')]({'where':{'id':_0x1fa153[_0xb9d9('0x50')]['id']}})['then'](handleEntityNotFound(_0x200bdd,null))[_0xb9d9('0x19')](removeEntity(_0x200bdd,null))[_0xb9d9('0x19')](function(){return db[_0xb9d9('0x35')]['findAll']({'raw':!![]});})[_0xb9d9('0x19')](function(_0x2de48a){var _0x2ef62d=fs['readFileSync'](path['join'](config[_0xb9d9('0x62')],_0xb9d9('0x5f')),_0xb9d9('0x60'));var _0x43762e=fs[_0xb9d9('0x6c')](path['join'](config[_0xb9d9('0x62')],_0xb9d9('0x63')),_0xb9d9('0x60'));var _0xc03f4b=ejs['render'](_0x2ef62d,{'trunks':_0x2de48a});var _0x5a8f96=ejs[_0xb9d9('0x64')](_0x43762e,{'trunks':_0x2de48a});fs[_0xb9d9('0x65')](_0xb9d9('0x66'),_0xc03f4b);fs[_0xb9d9('0x65')](_0xb9d9('0x6d'),_0x5a8f96);return respondWithRpcPromise(_0xb9d9('0x68'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x200bdd,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 378ae27..5f4cb9e 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 _0x8886=['./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0xccfd84,_0x56e25f){var _0x5be6af=function(_0x222539){while(--_0x222539){_0xccfd84['push'](_0xccfd84['shift']());}};_0x5be6af(++_0x56e25f);}(_0x8886,0xa9));var _0x6888=function(_0x7d5244,_0x50b321){_0x7d5244=_0x7d5244-0x0;var _0x229b01=_0x8886[_0x7d5244];return _0x229b01;};'use strict';var _=require(_0x6888('0x0'));var util=require(_0x6888('0x1'));var logger=require(_0x6888('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6888('0x3'));var rp=require(_0x6888('0x4'));var fs=require('fs');var path=require(_0x6888('0x5'));var rimraf=require(_0x6888('0x6'));var config=require('../../config/environment');var attributes=require(_0x6888('0x7'));module[_0x6888('0x8')]=function(_0x42a46a,_0x2355f4){return _0x42a46a[_0x6888('0x9')]('Trunk',attributes,{'tableName':_0x6888('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9003=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','lodash'];(function(_0x2fab06,_0x47ef86){var _0x1f19d7=function(_0x40a04f){while(--_0x40a04f){_0x2fab06['push'](_0x2fab06['shift']());}};_0x1f19d7(++_0x47ef86);}(_0x9003,0x1c7));var _0x3900=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9003[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x3900('0x0'));var util=require('util');var logger=require(_0x3900('0x1'))(_0x3900('0x2'));var moment=require(_0x3900('0x3'));var BPromise=require(_0x3900('0x4'));var rp=require(_0x3900('0x5'));var fs=require('fs');var path=require(_0x3900('0x6'));var rimraf=require(_0x3900('0x7'));var config=require(_0x3900('0x8'));var attributes=require(_0x3900('0x9'));module[_0x3900('0xa')]=function(_0x27819c,_0x6dc8ca){return _0x27819c[_0x3900('0xb')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 51184d2..5e8ae0e 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 _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46f448,_0x36d0b8){var _0x413c11=function(_0x4f8e40){while(--_0x4f8e40){_0x46f448['push'](_0x46f448['shift']());}};_0x413c11(++_0x36d0b8);}(_0x2032,0xd9));var _0x2203=function(_0x3301d1,_0x5d74bd){_0x3301d1=_0x3301d1-0x0;var _0x1a0f9d=_0x2032[_0x3301d1];return _0x1a0f9d;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0x59d691,_0x4a557e){var _0x1a058a=function(_0x179758){while(--_0x179758){_0x59d691['push'](_0x59d691['shift']());}};_0x1a058a(++_0x4a557e);}(_0x757a,0xde));var _0xa757=function(_0x2565bd,_0x1da86b){_0x2565bd=_0x2565bd-0x0;var _0x10db2d=_0x757a[_0x2565bd];return _0x10db2d;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetTrunk',_0x4d9f58);logger['debug']('GetTrunk',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrunk',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2247188..4b6e901 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 _0x3d14=['/describe','describe','get','/whoami','whoami','/:id','/:id/avatar','getAvatar','getContacts','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','/:id/contacts','addContacts','/:id/queues','diskStorage','server/files/images/','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','addTeams','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','changePassword','delete','removeQueues','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','/:id/fax_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x3d14,0x65));var _0x43d1=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x3d14[_0x33c9f8];return _0x2d7004;};'use strict';var multer=require(_0x43d1('0x0'));var util=require(_0x43d1('0x1'));var path=require(_0x43d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x43d1('0x3'));var router=express['Router']();var auth=require(_0x43d1('0x4'));var interaction=require(_0x43d1('0x5'));var config=require(_0x43d1('0x6'));var controller=require(_0x43d1('0x7'));router['get']('/',auth[_0x43d1('0x8')](),controller[_0x43d1('0x9')]);router['get'](_0x43d1('0xa'),auth[_0x43d1('0x8')](),controller[_0x43d1('0xb')]);router[_0x43d1('0xc')](_0x43d1('0xd'),auth[_0x43d1('0x8')](),controller[_0x43d1('0xe')]);router[_0x43d1('0xc')](_0x43d1('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x43d1('0xc')](_0x43d1('0x10'),controller[_0x43d1('0x11')]);router[_0x43d1('0xc')]('/:id/contacts',auth[_0x43d1('0x8')](),controller[_0x43d1('0x12')]);router['get']('/:id/queues',auth[_0x43d1('0x8')](),controller[_0x43d1('0x13')]);router[_0x43d1('0xc')]('/:id/queues_rt',auth[_0x43d1('0x8')](),controller[_0x43d1('0x14')]);router[_0x43d1('0xc')](_0x43d1('0x15'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x16')]);router['get'](_0x43d1('0x17'),auth['isAuthenticated'](),controller[_0x43d1('0x18')]);router['get']('/:id/screen_recordings',auth[_0x43d1('0x8')](),controller[_0x43d1('0x19')]);router[_0x43d1('0xc')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x43d1('0x1a')]);router['get'](_0x43d1('0x1b'),auth['isAuthenticated'](),controller[_0x43d1('0x1c')]);router[_0x43d1('0xc')](_0x43d1('0x1d'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x1e')]);router[_0x43d1('0xc')](_0x43d1('0x1f'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x20')]);router[_0x43d1('0xc')](_0x43d1('0x21'),auth['isAuthenticated'](),controller[_0x43d1('0x22')]);router['get'](_0x43d1('0x23'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x24')]);router[_0x43d1('0xc')]('/:id/teams',auth[_0x43d1('0x8')](),controller[_0x43d1('0x25')]);router[_0x43d1('0xc')](_0x43d1('0x26'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x27')]);router['get']('/:id/agents',auth[_0x43d1('0x8')](),controller[_0x43d1('0x28')]);router[_0x43d1('0xc')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x43d1('0x29')]);router[_0x43d1('0xc')](_0x43d1('0x2a'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x2b')]);router[_0x43d1('0xc')](_0x43d1('0x2c'),auth['isAuthenticated'](),controller[_0x43d1('0x2d')]);router[_0x43d1('0xc')]('/:id/openchannel_accounts',auth[_0x43d1('0x8')](),controller[_0x43d1('0x2e')]);router['get'](_0x43d1('0x2f'),auth['isAuthenticated'](),controller[_0x43d1('0x30')]);router[_0x43d1('0xc')](_0x43d1('0x31'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x43d1('0xc')](_0x43d1('0x32'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x33')]);router['get'](_0x43d1('0x34'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x35')]);router[_0x43d1('0xc')](_0x43d1('0x36'),auth['isAuthenticated'](),controller[_0x43d1('0x37')]);router[_0x43d1('0xc')](_0x43d1('0x38'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x39')]);router[_0x43d1('0x3a')](_0x43d1('0x3b'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x3c')]);router['post'](_0x43d1('0x3d'),auth['isAuthenticated'](),controller[_0x43d1('0x3e')]);router['post']('/',auth[_0x43d1('0x8')](),controller['create']);router[_0x43d1('0x3a')](_0x43d1('0x3f'),auth[_0x43d1('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x43d1('0x40')]({'destination':function(_0x5be5cf,_0x511313,_0x3ec8b5){_0x3ec8b5(null,path['join'](config['root'],_0x43d1('0x41')));},'filename':function(_0xdee096,_0x571afe,_0x1d571c){_0x1d571c(null,util['format']('%s-%s',Date['now'](),_0x571afe[_0x43d1('0x42')]));}})});router['post']('/:id/avatar',upload[_0x43d1('0x43')](_0x43d1('0x44')),controller[_0x43d1('0x45')]);router['post'](_0x43d1('0x46'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x47')]);router[_0x43d1('0x3a')](_0x43d1('0x48'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x49')]);router[_0x43d1('0x3a')](_0x43d1('0x4a'),auth[_0x43d1('0x8')](),controller['pause']);router['post']('/:id/unpause',auth[_0x43d1('0x8')](),controller[_0x43d1('0x4b')]);router[_0x43d1('0x3a')]('/:id/teams',auth[_0x43d1('0x8')](),controller[_0x43d1('0x4c')]);router[_0x43d1('0x3a')]('/:id/chat_interactions',auth[_0x43d1('0x8')](),controller[_0x43d1('0x4d')]);router['post']('/:id/mail_interactions',auth[_0x43d1('0x8')](),controller[_0x43d1('0x4e')]);router['post']('/:id/fax_interactions',auth[_0x43d1('0x8')](),controller[_0x43d1('0x4f')]);router[_0x43d1('0x3a')](_0x43d1('0x50'),auth[_0x43d1('0x8')](),controller['addSmsInteractions']);router[_0x43d1('0x3a')](_0x43d1('0x51'),auth['isAuthenticated'](),controller[_0x43d1('0x52')]);router['post'](_0x43d1('0x53'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x54')]);router['post'](_0x43d1('0x2a'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x55')]);router[_0x43d1('0x3a')](_0x43d1('0x2c'),auth[_0x43d1('0x8')](),controller['addMailAccounts']);router[_0x43d1('0x3a')](_0x43d1('0x56'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x57')]);router[_0x43d1('0x3a')]('/:id/sms_accounts',auth[_0x43d1('0x8')](),controller[_0x43d1('0x58')]);router[_0x43d1('0x3a')](_0x43d1('0x31'),auth[_0x43d1('0x8')](),controller['addChatWebsites']);router[_0x43d1('0x3a')](_0x43d1('0x32'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x59')]);router['post'](_0x43d1('0x34'),auth['isAuthenticated'](),controller[_0x43d1('0x5a')]);router[_0x43d1('0x3a')]('/:id/api_key',auth[_0x43d1('0x8')](),controller[_0x43d1('0x5b')]);router[_0x43d1('0x5c')](_0x43d1('0xf'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x5d')]);router[_0x43d1('0x5c')]('/:id/password',auth[_0x43d1('0x8')](),controller[_0x43d1('0x5e')]);router[_0x43d1('0x5f')](_0x43d1('0x3f'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x60')]);router[_0x43d1('0x5f')]('/:id/teams',auth[_0x43d1('0x8')](),controller['removeTeams']);router['delete']('/:id',auth[_0x43d1('0x8')](),controller['destroy']);router[_0x43d1('0x5f')](_0x43d1('0x61'),auth['isAuthenticated'](),controller[_0x43d1('0x62')]);router[_0x43d1('0x5f')](_0x43d1('0x63'),auth[_0x43d1('0x8')](),controller['removeMailInteractions']);router[_0x43d1('0x5f')](_0x43d1('0x64'),auth[_0x43d1('0x8')](),controller['removeFaxInteractions']);router[_0x43d1('0x5f')](_0x43d1('0x50'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x65')]);router[_0x43d1('0x5f')](_0x43d1('0x51'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x66')]);router[_0x43d1('0x5f')](_0x43d1('0x53'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete'](_0x43d1('0x2a'),auth['isAuthenticated'](),controller[_0x43d1('0x67')]);router[_0x43d1('0x5f')](_0x43d1('0x2c'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x68')]);router[_0x43d1('0x5f')](_0x43d1('0x56'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x69')]);router['delete'](_0x43d1('0x2f'),auth['isAuthenticated'](),controller[_0x43d1('0x6a')]);router['delete'](_0x43d1('0x31'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x6b')]);router[_0x43d1('0x5f')](_0x43d1('0x32'),auth[_0x43d1('0x8')](),controller['removeWhatsappAccounts']);router[_0x43d1('0x5f')](_0x43d1('0x34'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x6c')]);router[_0x43d1('0x5f')](_0x43d1('0x38'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x6d')]);module[_0x43d1('0x6e')]=router; \ No newline at end of file +var _0xd7bd=['/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','/create_many','addContacts','addQueues','diskStorage','join','format','%s-%s','now','file','addAvatar','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','put','update','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xd7bd,0x118));var _0xdd7b=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0xd7bd[_0x2353fe];return _0x4d43f6;};'use strict';var multer=require(_0xdd7b('0x0'));var util=require(_0xdd7b('0x1'));var path=require('path');var timeout=require(_0xdd7b('0x2'));var express=require(_0xdd7b('0x3'));var router=express['Router']();var auth=require(_0xdd7b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdd7b('0x5'));var controller=require('./user.controller');router[_0xdd7b('0x6')]('/',auth['isAuthenticated'](),controller[_0xdd7b('0x7')]);router[_0xdd7b('0x6')](_0xdd7b('0x8'),auth[_0xdd7b('0x9')](),controller['describe']);router[_0xdd7b('0x6')](_0xdd7b('0xa'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0xb')]);router[_0xdd7b('0x6')](_0xdd7b('0xc'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0xd')]);router[_0xdd7b('0x6')](_0xdd7b('0xe'),controller[_0xdd7b('0xf')]);router[_0xdd7b('0x6')](_0xdd7b('0x10'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x11')]);router[_0xdd7b('0x6')](_0xdd7b('0x12'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x13')]);router[_0xdd7b('0x6')](_0xdd7b('0x14'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x15')]);router['get'](_0xdd7b('0x16'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x17')]);router[_0xdd7b('0x6')](_0xdd7b('0x18'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x19')]);router[_0xdd7b('0x6')]('/:id/screen_recordings',auth[_0xdd7b('0x9')](),controller['getScreenRecordings']);router[_0xdd7b('0x6')](_0xdd7b('0x1a'),auth['isAuthenticated'](),controller[_0xdd7b('0x1b')]);router[_0xdd7b('0x6')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0xdd7b('0x1c')]);router[_0xdd7b('0x6')](_0xdd7b('0x1d'),auth['isAuthenticated'](),controller[_0xdd7b('0x1e')]);router['get']('/:id/sms/interactions',auth[_0xdd7b('0x9')](),controller['getSmsInteractions']);router[_0xdd7b('0x6')](_0xdd7b('0x1f'),auth[_0xdd7b('0x9')](),controller['getFaxInteractions']);router[_0xdd7b('0x6')](_0xdd7b('0x20'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x21')]);router[_0xdd7b('0x6')](_0xdd7b('0x22'),auth[_0xdd7b('0x9')](),controller['getTeams']);router[_0xdd7b('0x6')](_0xdd7b('0x23'),auth[_0xdd7b('0x9')](),controller['getLists']);router['get'](_0xdd7b('0x24'),auth['isAuthenticated'](),controller[_0xdd7b('0x25')]);router['get'](_0xdd7b('0x26'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x27')]);router['get'](_0xdd7b('0x28'),auth['isAuthenticated'](),controller[_0xdd7b('0x29')]);router[_0xdd7b('0x6')](_0xdd7b('0x2a'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x2b')]);router['get'](_0xdd7b('0x2c'),auth['isAuthenticated'](),controller[_0xdd7b('0x2d')]);router[_0xdd7b('0x6')](_0xdd7b('0x2e'),auth[_0xdd7b('0x9')](),controller['getSmsAccounts']);router[_0xdd7b('0x6')](_0xdd7b('0x2f'),auth['isAuthenticated'](),controller[_0xdd7b('0x30')]);router['get'](_0xdd7b('0x31'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x32')]);router['get'](_0xdd7b('0x33'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x34')]);router[_0xdd7b('0x6')](_0xdd7b('0x35'),auth[_0xdd7b('0x9')](),controller['getScheduledCalls']);router['get'](_0xdd7b('0x36'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x37')]);router[_0xdd7b('0x38')](_0xdd7b('0x39'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0xdd7b('0x38')](_0xdd7b('0x10'),auth['isAuthenticated'](),controller[_0xdd7b('0x3a')]);router[_0xdd7b('0x38')]('/',auth[_0xdd7b('0x9')](),controller['create']);router[_0xdd7b('0x38')](_0xdd7b('0x12'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x3b')]);var upload=multer({'storage':multer[_0xdd7b('0x3c')]({'destination':function(_0x4d9136,_0x1f13b8,_0x1b2825){_0x1b2825(null,path[_0xdd7b('0x3d')](config['root'],'server/files/images/'));},'filename':function(_0x4b6104,_0x20f1bf,_0x2f199c){_0x2f199c(null,util[_0xdd7b('0x3e')](_0xdd7b('0x3f'),Date[_0xdd7b('0x40')](),_0x20f1bf['originalname']));}})});router['post'](_0xdd7b('0xe'),upload['single'](_0xdd7b('0x41')),controller[_0xdd7b('0x42')]);router[_0xdd7b('0x38')]('/:id/login',auth[_0xdd7b('0x9')](),controller['login']);router[_0xdd7b('0x38')](_0xdd7b('0x43'),auth['isAuthenticated'](),controller[_0xdd7b('0x44')]);router[_0xdd7b('0x38')](_0xdd7b('0x45'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x46')]);router[_0xdd7b('0x38')](_0xdd7b('0x47'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x48')]);router[_0xdd7b('0x38')](_0xdd7b('0x22'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x49')]);router[_0xdd7b('0x38')]('/:id/chat_interactions',auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x4a')]);router[_0xdd7b('0x38')]('/:id/mail_interactions',auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x4b')]);router[_0xdd7b('0x38')](_0xdd7b('0x4c'),auth[_0xdd7b('0x9')](),controller['addFaxInteractions']);router[_0xdd7b('0x38')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xdd7b('0x4d')]);router[_0xdd7b('0x38')](_0xdd7b('0x4e'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x4f')]);router['post'](_0xdd7b('0x50'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x51')]);router[_0xdd7b('0x38')](_0xdd7b('0x28'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x52')]);router[_0xdd7b('0x38')](_0xdd7b('0x2a'),auth['isAuthenticated'](),controller[_0xdd7b('0x53')]);router[_0xdd7b('0x38')](_0xdd7b('0x2c'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x54')]);router[_0xdd7b('0x38')](_0xdd7b('0x2e'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x55')]);router[_0xdd7b('0x38')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xdd7b('0x56')]);router['post']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0xdd7b('0x38')]('/:id/square_projects',auth['isAuthenticated'](),controller['addSquareProjects']);router[_0xdd7b('0x38')](_0xdd7b('0x36'),auth[_0xdd7b('0x9')](),controller['createApiKey']);router[_0xdd7b('0x57')]('/:id',auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x58')]);router['put']('/:id/password',auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x59')]);router[_0xdd7b('0x5a')](_0xdd7b('0x12'),auth[_0xdd7b('0x9')](),controller['removeQueues']);router[_0xdd7b('0x5a')](_0xdd7b('0x22'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x5b')]);router[_0xdd7b('0x5a')]('/:id',auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x5c')]);router[_0xdd7b('0x5a')](_0xdd7b('0x5d'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x5e')]);router[_0xdd7b('0x5a')]('/:id/mail_interactions',auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x5f')]);router['delete']('/:id/fax_interactions',auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x60')]);router[_0xdd7b('0x5a')](_0xdd7b('0x61'),auth[_0xdd7b('0x9')](),controller['removeSmsInteractions']);router['delete']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xdd7b('0x62')]);router[_0xdd7b('0x5a')](_0xdd7b('0x50'),auth['isAuthenticated'](),controller[_0xdd7b('0x63')]);router[_0xdd7b('0x5a')](_0xdd7b('0x28'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x64')]);router['delete'](_0xdd7b('0x2a'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x65')]);router[_0xdd7b('0x5a')](_0xdd7b('0x2c'),auth['isAuthenticated'](),controller[_0xdd7b('0x66')]);router['delete']('/:id/sms_accounts',auth[_0xdd7b('0x9')](),controller['removeSmsAccounts']);router[_0xdd7b('0x5a')](_0xdd7b('0x2f'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x67')]);router[_0xdd7b('0x5a')](_0xdd7b('0x31'),auth[_0xdd7b('0x9')](),controller[_0xdd7b('0x68')]);router[_0xdd7b('0x5a')](_0xdd7b('0x33'),auth[_0xdd7b('0x9')](),controller['removeSquareProjects']);router[_0xdd7b('0x5a')](_0xdd7b('0x36'),auth['isAuthenticated'](),controller['removeApiKey']);module[_0xdd7b('0x69')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c11f7c3..2cc2e31 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 _0x3942=['agent','telephone','local','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','yes','nonat','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','originate','uac','uas','fingerprint','certificate','passive','actpass','update','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user'];(function(_0x3a7bdf,_0x58bdd8){var _0x35a9a8=function(_0x21da98){while(--_0x21da98){_0x3a7bdf['push'](_0x3a7bdf['shift']());}};_0x35a9a8(++_0x58bdd8);}(_0x3942,0xab));var _0x2394=function(_0x2a3170,_0xf53053){_0x2a3170=_0x2a3170-0x0;var _0x2f63ac=_0x3942[_0x2a3170];return _0x2f63ac;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2394('0x0'));var util=require(_0x2394('0x1'));var _=require(_0x2394('0x2'));module[_0x2394('0x3')]={'name':{'type':Sequelize[_0x2394('0x4')],'allowNull':![],'unique':_0x2394('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1e987b){this['setDataValue'](_0x2394('0x5'),_0x1e987b);this[_0x2394('0x6')](_0x2394('0x7'),_0x1e987b);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x43adca){this[_0x2394('0x6')]('fullname',_0x43adca);this['setDataValue'](_0x2394('0x8'),util[_0x2394('0x9')](_0x2394('0xa'),_0x43adca,this[_0x2394('0xb')](_0x2394('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2394('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2ffb8d){if(_0x2ffb8d){this[_0x2394('0x6')](_0x2394('0xd'),_0x2ffb8d['toLowerCase']());}}},'role':{'type':Sequelize[_0x2394('0xe')](_0x2394('0xf'),_0x2394('0x10'),_0x2394('0x11'),_0x2394('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x2394('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2394('0x4')],'defaultValue':_0x2394('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x208de8){this['setDataValue']('internal',_0x208de8);this[_0x2394('0x6')](_0x2394('0x14'),_0x208de8);this[_0x2394('0x6')](_0x2394('0x8'),util['format'](_0x2394('0xa'),this['getDataValue'](_0x2394('0x15')),_0x208de8));}},'salt':{'type':Sequelize[_0x2394('0x4')]},'phone':{'type':Sequelize[_0x2394('0x4')]},'mobile':{'type':Sequelize[_0x2394('0x4')]},'address':{'type':Sequelize[_0x2394('0x4')]},'zipcode':{'type':Sequelize[_0x2394('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x2394('0x4')]},'country':{'type':Sequelize[_0x2394('0x4')]},'online':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2394('0x17')]},'voicePause':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2394('0x4')],'defaultValue':_0x2394('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2394('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2394('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2394('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2394('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2394('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2394('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2394('0x19')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2394('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2394('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x2394('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user',_0x2394('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![],'defaultValue':_0x2394('0x1b')},'callingpres':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x1c'),'ALLOWED_PASSED_SCREEN',_0x2394('0x1d'),_0x2394('0x1e'),_0x2394('0x1f'),_0x2394('0x20'),_0x2394('0x21'),_0x2394('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![],'defaultValue':_0x2394('0x23'),'set':function(_0xdec99c){this[_0x2394('0x6')](_0x2394('0x24'),_0xdec99c?_0xdec99c['join'](','):null);},'get':function(){return this[_0x2394('0xb')](_0x2394('0x24'))?this[_0x2394('0xb')](_0x2394('0x24'))[_0x2394('0x25')](','):null;},'comment':_0x2394('0x26')},'dtmfmode':{'type':Sequelize['ENUM'](_0x2394('0x27'),_0x2394('0x28'),'shortinfo',_0x2394('0x29'),'auto'),'allowNull':!![],'defaultValue':_0x2394('0x27')},'directmedia':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no',_0x2394('0x2b'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![],'defaultValue':_0x2394('0x2c'),'set':function(_0x220857){this['setDataValue'](_0x2394('0x2d'),_0x220857?_0x220857[_0x2394('0x2e')](','):null);},'get':function(){return this[_0x2394('0xb')](_0x2394('0x2d'))?this[_0x2394('0xb')](_0x2394('0x2d'))[_0x2394('0x25')](','):null;},'comment':_0x2394('0x2f')},'callgroup':{'type':Sequelize[_0x2394('0x4')]},'namedcallgroup':{'type':Sequelize[_0x2394('0x4')]},'pickupgroup':{'type':Sequelize[_0x2394('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x2394('0x4')]},'language':{'type':Sequelize[_0x2394('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2394('0x4')]},'disallow':{'type':Sequelize[_0x2394('0x4')],'allowNull':![],'defaultValue':_0x2394('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2394('0x31'),'set':function(_0x45a698){this['setDataValue'](_0x2394('0x32'),_0x45a698?_0x45a698[_0x2394('0x2e')](';'):_0x2394('0x31'));},'get':function(){return this[_0x2394('0xb')](_0x2394('0x32'))?this['getDataValue'](_0x2394('0x32'))[_0x2394('0x25')](';'):null;},'comment':_0x2394('0x33')},'autoframing':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![],'set':function(_0xbb2d2){this['setDataValue']('insecure',_0xbb2d2?_0xbb2d2[_0x2394('0x2e')](','):null);},'get':function(){return this[_0x2394('0xb')](_0x2394('0x34'))?this[_0x2394('0xb')]('insecure')['split'](','):null;},'comment':_0x2394('0x35')},'trustrpid':{'type':Sequelize[_0x2394('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2394('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no',_0x2394('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x2394('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![],'defaultValue':_0x2394('0x37')},'amaflags':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x2394('0x2a')},'busylevel':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2394('0xe')]('yes','no',_0x2394('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2394('0xe')]('accept','refuse',_0x2394('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x3a'),_0x2394('0x3b')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x2394('0x2a')},'keepalive':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x2394('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x2394('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2394('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no',_0x2394('0x3c'),_0x2394('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2394('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2394('0xe')]('active',_0x2394('0x3e'),_0x2394('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2394('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no','nonat',_0x2394('0x40'),_0x2394('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2394('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x611ffe){this[_0x2394('0x6')](_0x2394('0x42'),_0x611ffe);var _0x4c0b1e=this[_0x2394('0x43')]({'plain':!![]});switch(_0x611ffe){case 0x0:case 0x1:var _0x1c41a1=_0x4c0b1e['transport']?_[_0x2394('0x44')](_0x4c0b1e[_0x2394('0x24')])?_0x4c0b1e[_0x2394('0x24')][_0x2394('0x2e')]():_0x4c0b1e['transport']:_0x2394('0x23');if(_0x1c41a1===_0x2394('0x45')){_0x1c41a1=_0x2394('0x23');}this['setDataValue']('transport',_0x1c41a1);this[_0x2394('0x6')](_0x2394('0x46'),'no');this[_0x2394('0x6')](_0x2394('0x47'),null);this[_0x2394('0x6')]('force_avp',null);this['setDataValue'](_0x2394('0x48'),null);this[_0x2394('0x6')](_0x2394('0x49'),null);this[_0x2394('0x6')](_0x2394('0x4a'),null);this[_0x2394('0x6')](_0x2394('0x4b'),null);this['setDataValue'](_0x2394('0x4c'),null);this['setDataValue'](_0x2394('0x4d'),null);this['setDataValue'](_0x2394('0x4e'),'no');break;case 0x2:this[_0x2394('0x6')](_0x2394('0x24'),'wss');this['setDataValue'](_0x2394('0x46'),_0x2394('0x2a'));this[_0x2394('0x6')](_0x2394('0x47'),_0x2394('0x2a'));this[_0x2394('0x6')](_0x2394('0x4f'),_0x2394('0x2a'));this[_0x2394('0x6')](_0x2394('0x48'),'yes');this[_0x2394('0x6')]('dtlsenable',_0x2394('0x2a'));this['setDataValue'](_0x2394('0x4a'),'no');this[_0x2394('0x6')](_0x2394('0x4b'),'actpass');this[_0x2394('0x6')](_0x2394('0x4c'),_0x4c0b1e[_0x2394('0x4c')]||_0x2394('0x50'));this[_0x2394('0x6')](_0x2394('0x4d'),_0x4c0b1e[_0x2394('0x4d')]||_0x2394('0x51'));this[_0x2394('0x6')]('rtcp_mux',_0x2394('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x2394('0x52')],'set':function(_0xe9a1c3){this[_0x2394('0x6')]('permissions',_0xe9a1c3?_0xe9a1c3[_0x2394('0x2e')](','):[]);},'get':function(){return this[_0x2394('0xb')](_0x2394('0x53'))?_[_0x2394('0x54')](this[_0x2394('0xb')]('permissions')['split'](','),function(_0x96273d){return parseInt(_0x96273d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2394('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2394('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2394('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2394('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2394('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2394('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2394('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2394('0xe')](_0x2394('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2394('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2394('0x4')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2394('0x55')],'get':function(){return this[_0x2394('0xb')](_0x2394('0x56'))?this[_0x2394('0xb')](_0x2394('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2394('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2394('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![],'set':function(_0x52bfd2){if(typeof _0x52bfd2===_0x2394('0x57')){var _0x508d20=_0x52bfd2==='1'?!![]:_0x52bfd2==='0'?![]:_0x52bfd2===_0x2394('0x58')?!![]:_0x52bfd2===_0x2394('0x59')?![]:![];this[_0x2394('0x6')](_0x2394('0x5a'),_0x508d20);}else{this[_0x2394('0x6')]('screenrecording',_0x52bfd2);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x320aec){this[_0x2394('0x6')](_0x2394('0x5b'),_0x320aec);if(_0x320aec===!![]){this[_0x2394('0x6')](_0x2394('0x5c'),moment());this[_0x2394('0x6')](_0x2394('0x5d'),0x0);}else{this[_0x2394('0x6')](_0x2394('0x5c'),null);}}},'blockedAt':{'type':Sequelize[_0x2394('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2394('0x19')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2394('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xba99=['showWebBar','get','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','local','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','peer','ALLOWED_NOT_SCREENED','PROHIB_NOT_SCREENED','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','nonat','outgoing','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass'];(function(_0x2bedab,_0x19f666){var _0x118ff5=function(_0x25670a){while(--_0x25670a){_0x2bedab['push'](_0x2bedab['shift']());}};_0x118ff5(++_0x19f666);}(_0xba99,0x168));var _0x9ba9=function(_0x3e525d,_0x1b7145){_0x3e525d=_0x3e525d-0x0;var _0xbf71e9=_0xba99[_0x3e525d];return _0xbf71e9;};'use strict';var Sequelize=require(_0x9ba9('0x0'));var moment=require('moment');var util=require('util');var _=require(_0x9ba9('0x1'));module['exports']={'name':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':![],'unique':_0x9ba9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x538ff7){this['setDataValue'](_0x9ba9('0x3'),_0x538ff7);this[_0x9ba9('0x4')](_0x9ba9('0x5'),_0x538ff7);},'comment':_0x9ba9('0x6')},'fullname':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':![],'set':function(_0xc32843){this[_0x9ba9('0x4')](_0x9ba9('0x7'),_0xc32843);this[_0x9ba9('0x4')](_0x9ba9('0x8'),util[_0x9ba9('0x9')](_0x9ba9('0xa'),_0xc32843,this['getDataValue'](_0x9ba9('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9ba9('0xc'),'validate':{'isEmail':!![]},'set':function(_0xb5209b){if(_0xb5209b){this[_0x9ba9('0x4')](_0x9ba9('0xc'),_0xb5209b[_0x9ba9('0xd')]());}}},'role':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0xf'),_0x9ba9('0x10'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x9ba9('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9ba9('0xb'),'set':function(_0x593793){this[_0x9ba9('0x4')](_0x9ba9('0xb'),_0x593793);this[_0x9ba9('0x4')]('accountcode',_0x593793);this['setDataValue']('callerid',util['format'](_0x9ba9('0xa'),this[_0x9ba9('0x12')](_0x9ba9('0x7')),_0x593793));}},'salt':{'type':Sequelize[_0x9ba9('0x2')]},'phone':{'type':Sequelize[_0x9ba9('0x2')]},'mobile':{'type':Sequelize[_0x9ba9('0x2')]},'address':{'type':Sequelize[_0x9ba9('0x2')]},'zipcode':{'type':Sequelize[_0x9ba9('0x2')]},'userpic':{'type':Sequelize[_0x9ba9('0x2')]},'city':{'type':Sequelize[_0x9ba9('0x2')]},'country':{'type':Sequelize[_0x9ba9('0x2')]},'online':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9ba9('0x2')],'defaultValue':_0x9ba9('0x14')},'lastPauseAt':{'type':Sequelize[_0x9ba9('0x15')]},'chatCapacity':{'type':Sequelize[_0x9ba9('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9ba9('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9ba9('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9ba9('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9ba9('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9ba9('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![],'defaultValue':_0x9ba9('0x17')},'ipaddr':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x9ba9('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x9ba9('0x18'),_0x9ba9('0x10'),_0x9ba9('0x19')),'allowNull':!![],'defaultValue':_0x9ba9('0x18')},'context':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x1a'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED',_0x9ba9('0x1b'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x9ba9('0x1c')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9ba9('0x1d'),'set':function(_0x48f6b9){this[_0x9ba9('0x4')]('transport',_0x48f6b9?_0x48f6b9[_0x9ba9('0x1e')](','):null);},'get':function(){return this[_0x9ba9('0x12')]('transport')?this['getDataValue'](_0x9ba9('0x1f'))['split'](','):null;},'comment':_0x9ba9('0x20')},'dtmfmode':{'type':Sequelize['ENUM'](_0x9ba9('0x21'),_0x9ba9('0x22'),'shortinfo',_0x9ba9('0x23'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x9ba9('0xe')]('yes','no',_0x9ba9('0x24'),'update',_0x9ba9('0x25')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9ba9('0x27'),'set':function(_0x8579b0){this['setDataValue'](_0x9ba9('0x28'),_0x8579b0?_0x8579b0[_0x9ba9('0x1e')](','):null);},'get':function(){return this[_0x9ba9('0x12')](_0x9ba9('0x28'))?this[_0x9ba9('0x12')](_0x9ba9('0x28'))[_0x9ba9('0x29')](','):null;},'comment':_0x9ba9('0x2a')},'callgroup':{'type':Sequelize[_0x9ba9('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x9ba9('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x9ba9('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':![],'defaultValue':_0x9ba9('0x2b')},'allow':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':![],'defaultValue':_0x9ba9('0x2c'),'set':function(_0x6e0acd){this[_0x9ba9('0x4')](_0x9ba9('0x2d'),_0x6e0acd?_0x6e0acd[_0x9ba9('0x1e')](';'):_0x9ba9('0x2c'));},'get':function(){return this[_0x9ba9('0x12')](_0x9ba9('0x2d'))?this[_0x9ba9('0x12')](_0x9ba9('0x2d'))[_0x9ba9('0x29')](';'):null;},'comment':_0x9ba9('0x2e')},'autoframing':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![],'set':function(_0x5875cb){this[_0x9ba9('0x4')]('insecure',_0x5875cb?_0x5875cb[_0x9ba9('0x1e')](','):null);},'get':function(){return this[_0x9ba9('0x12')](_0x9ba9('0x2f'))?this[_0x9ba9('0x12')](_0x9ba9('0x2f'))[_0x9ba9('0x29')](','):null;},'comment':_0x9ba9('0x30')},'trustrpid':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x9ba9('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x9ba9('0x26'),'no',_0x9ba9('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9ba9('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0x9ba9('0x26')},'busylevel':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x9ba9('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9ba9('0xe')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9ba9('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no',_0x9ba9('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9ba9('0xe')]('accept',_0x9ba9('0x33'),_0x9ba9('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x9ba9('0x35'),_0x9ba9('0x36')),'allowNull':!![],'defaultValue':_0x9ba9('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![],'defaultValue':_0x9ba9('0x26')},'keepalive':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x9ba9('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x9ba9('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9ba9('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9ba9('0xe')]('yes','no',_0x9ba9('0x37'),_0x9ba9('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x39'),_0x9ba9('0x3a'),_0x9ba9('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9ba9('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x9ba9('0x26'),'no',_0x9ba9('0x24'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x9ba9('0x15')]},'showWebBar':{'type':Sequelize[_0x9ba9('0x16')],'defaultValue':0x0,'set':function(_0xb0ced4){this[_0x9ba9('0x4')](_0x9ba9('0x3c'),_0xb0ced4);var _0x4ba97b=this[_0x9ba9('0x3d')]({'plain':!![]});switch(_0xb0ced4){case 0x0:case 0x1:var _0x1b9662=_0x4ba97b[_0x9ba9('0x1f')]?_['isArray'](_0x4ba97b['transport'])?_0x4ba97b[_0x9ba9('0x1f')]['join']():_0x4ba97b['transport']:_0x9ba9('0x1d');if(_0x1b9662==='wss'){_0x1b9662=_0x9ba9('0x1d');}this[_0x9ba9('0x4')](_0x9ba9('0x1f'),_0x1b9662);this[_0x9ba9('0x4')]('encryption','no');this[_0x9ba9('0x4')](_0x9ba9('0x3e'),null);this['setDataValue'](_0x9ba9('0x3f'),null);this[_0x9ba9('0x4')]('icesupport',null);this[_0x9ba9('0x4')](_0x9ba9('0x40'),null);this[_0x9ba9('0x4')](_0x9ba9('0x41'),null);this[_0x9ba9('0x4')](_0x9ba9('0x42'),null);this[_0x9ba9('0x4')](_0x9ba9('0x43'),null);this[_0x9ba9('0x4')](_0x9ba9('0x44'),null);this[_0x9ba9('0x4')](_0x9ba9('0x45'),'no');break;case 0x2:this[_0x9ba9('0x4')](_0x9ba9('0x1f'),'wss');this[_0x9ba9('0x4')](_0x9ba9('0x46'),_0x9ba9('0x26'));this[_0x9ba9('0x4')](_0x9ba9('0x3e'),_0x9ba9('0x26'));this[_0x9ba9('0x4')](_0x9ba9('0x3f'),_0x9ba9('0x26'));this[_0x9ba9('0x4')](_0x9ba9('0x47'),_0x9ba9('0x26'));this['setDataValue'](_0x9ba9('0x40'),_0x9ba9('0x26'));this['setDataValue'](_0x9ba9('0x41'),'no');this[_0x9ba9('0x4')](_0x9ba9('0x42'),_0x9ba9('0x3b'));this[_0x9ba9('0x4')](_0x9ba9('0x43'),_0x4ba97b['dtlscertfile']||_0x9ba9('0x48'));this['setDataValue'](_0x9ba9('0x44'),_0x4ba97b[_0x9ba9('0x44')]||_0x9ba9('0x49'));this[_0x9ba9('0x4')]('rtcp_mux',_0x9ba9('0x26'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x13fc4b){this[_0x9ba9('0x4')](_0x9ba9('0x4a'),_0x13fc4b?_0x13fc4b[_0x9ba9('0x1e')](','):[]);},'get':function(){return this[_0x9ba9('0x12')]('permissions')?_[_0x9ba9('0x4b')](this['getDataValue']('permissions')[_0x9ba9('0x29')](','),function(_0x5d67ab){return parseInt(_0x5d67ab,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9ba9('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9ba9('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9ba9('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9ba9('0xe')](_0x9ba9('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9ba9('0x2')]},'passwordResetAt':{'type':Sequelize[_0x9ba9('0x15')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9ba9('0x4c')],'get':function(){return this['getDataValue'](_0x9ba9('0x4d'))?this[_0x9ba9('0x12')](_0x9ba9('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9ba9('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9ba9('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![],'set':function(_0x532247){if(typeof _0x532247==='string'){var _0x355f54=_0x532247==='1'?!![]:_0x532247==='0'?![]:_0x532247===_0x9ba9('0x4e')?!![]:_0x532247===_0x9ba9('0x4f')?![]:![];this[_0x9ba9('0x4')](_0x9ba9('0x50'),_0x355f54);}else{this[_0x9ba9('0x4')]('screenrecording',_0x532247);}}},'blocked':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![],'set':function(_0x350188){this[_0x9ba9('0x4')](_0x9ba9('0x51'),_0x350188);if(_0x350188===!![]){this[_0x9ba9('0x4')](_0x9ba9('0x52'),moment());this[_0x9ba9('0x4')](_0x9ba9('0x53'),0x0);}else{this[_0x9ba9('0x4')](_0x9ba9('0x52'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9ba9('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x9ba9('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 8d761b0..3348197 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 _0x59b3=['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','User,\x20%s,\x20%s,\x20%s','code','User,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','get','Users','user','Telephones','telephone','filter','ignore','map','value','includes','role','find','name','UserProfileResource','stack','index','User','rawAttributes','fieldName','type','key','model','differenceBy','password','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','sequelize','col','lower','options','includeAll','include','rows','show','params','keys','salt','length','bulkCreate','body','describe','addContacts','ids','agent','admin','users','format','count\x20%s:\x20%s','internal','Setting','findById','securePassword','min_internal','max','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','fullname','permissions','102','103','113','110','106','107','108','109','100','111','114','create','Agents','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','penalty','spread','toLowerCase','emit','Queue:save','findAll','voice','SIP/%s','interface','each','remove','Queues','QueueId','UserVoiceQueueRt','addAvatar','file','filename','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getContacts','findOne','CmContact','pick','List','Tag','Tags','tag','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','push','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','concat','update','isMiddleware','resolve','logout','all','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','mail','fax','sms','whatsapp','openchannel','%s%s','getTeams','addTeams','Team','getVoiceQueues','setDataValue','Voice','getChatQueues','Chat','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','flatten','addAgent','upsert','removeTeams','getMailQueues','Sms','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction','removeAgent','getDataValue','Queue:remove','getLists','CmList','getAgents','values','send','omit','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$contains','$contained','firstName','lastName','Contact','VoiceQueue','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./user.socket','register','jayson/promise','test','Sequelize','ValidationError'];(function(_0x59c129,_0x224c8b){var _0x4f623d=function(_0x54c88e){while(--_0x54c88e){_0x59c129['push'](_0x59c129['shift']());}};_0x4f623d(++_0x224c8b);}(_0x59b3,0x14e));var _0x359b=function(_0x28e33b,_0x47eb28){_0x28e33b=_0x28e33b-0x0;var _0x50032b=_0x59b3[_0x28e33b];return _0x50032b;};'use strict';var pdf=require(_0x359b('0x0'));var emlformat=require(_0x359b('0x1'));var rimraf=require(_0x359b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x359b('0x3'));var rp=require(_0x359b('0x4'));var moment=require(_0x359b('0x5'));var BPromise=require(_0x359b('0x6'));var Mustache=require('mustache');var util=require(_0x359b('0x7'));var path=require(_0x359b('0x8'));var sox=require('sox');var csv=require(_0x359b('0x9'));var ejs=require(_0x359b('0xa'));var fs=require('fs');var _=require(_0x359b('0xb'));var squel=require(_0x359b('0xc'));var crypto=require(_0x359b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x359b('0xe'));var Redis=require('ioredis');var authService=require(_0x359b('0xf'));var qs=require(_0x359b('0x10'));var as=require(_0x359b('0x11'));var hardwareService=require(_0x359b('0x12'));var logger=require(_0x359b('0x13'))(_0x359b('0x14'));var utils=require(_0x359b('0x15'));var config=require('../../config/environment');var db=require(_0x359b('0x16'))['db'];config[_0x359b('0x17')]=_['defaults'](config[_0x359b('0x17')],{'host':_0x359b('0x18'),'port':0x18eb});var socket=require(_0x359b('0x19'))(new Redis(config[_0x359b('0x17')]));require(_0x359b('0x1a'))[_0x359b('0x1b')](socket);var jayson=require(_0x359b('0x1c'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3c3028,_0x49a637,_0x304390){if(_0x304390){var _0x529823=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x529823[_0x359b('0x1d')](_0x49a637)){return _0x3c3028;}else{throw new db[(_0x359b('0x1e'))][(_0x359b('0x1f'))](_0x359b('0x20'));}}else{return _0x3c3028;}}function respondWithRpcPromise(_0x440a11,_0x3094ab,_0x52a7ad,_0x15281d){return new BPromise(function(_0xa84c58,_0x3e1b92){var _0x16ea30=_0x15281d||client;return _0x16ea30[_0x359b('0x21')](_0x440a11,_0x52a7ad)[_0x359b('0x22')](function(_0x297114){logger['info']('User,\x20%s,\x20%s',_0x3094ab,_0x359b('0x23'));logger[_0x359b('0x24')](_0x359b('0x25'),_0x3094ab,_0x359b('0x23'),JSON['stringify'](_0x297114));if(_0x297114['error']){if(_0x297114['error'][_0x359b('0x26')]===0x1f4){logger['error'](_0x359b('0x27'),_0x3094ab,_0x297114['error']['message']);return _0x3e1b92(_0x297114[_0x359b('0x28')][_0x359b('0x29')]);}logger[_0x359b('0x28')](_0x359b('0x27'),_0x3094ab,_0x297114[_0x359b('0x28')][_0x359b('0x29')]);return _0xa84c58(_0x297114[_0x359b('0x28')]['message']);}else{logger[_0x359b('0x2a')](_0x359b('0x27'),_0x3094ab,_0x359b('0x23'));_0xa84c58(_0x297114[_0x359b('0x2b')][_0x359b('0x29')]);}})[_0x359b('0x2c')](function(_0x7176e0){logger[_0x359b('0x28')](_0x359b('0x27'),_0x3094ab,_0x7176e0);_0x3e1b92(_0x7176e0);});});}function respondWithStatusCode(_0x185856,_0x666d18){_0x666d18=_0x666d18||0xcc;return function(_0x4003b3){if(_0x4003b3){return _0x185856[_0x359b('0x2d')](_0x666d18);}return _0x185856[_0x359b('0x2e')](_0x666d18)[_0x359b('0x2f')]();};}function respondWithResult(_0x487dde,_0x18f5d0){_0x18f5d0=_0x18f5d0||0xc8;return function(_0x52d813){if(_0x52d813){return _0x487dde[_0x359b('0x2e')](_0x18f5d0)[_0x359b('0x30')](_0x52d813);}};}function respondWithFilteredResult(_0x56a4f1,_0x1dee88){return function(_0x5a4ae5){if(_0x5a4ae5){var _0x4d4506=_0x5a4ae5[_0x359b('0x31')],_0x410d33=_0x1dee88[_0x359b('0x32')],_0x4ac80e=_0x1dee88[_0x359b('0x32')]+_0x1dee88[_0x359b('0x33')],_0x2acf11;if(_0x4ac80e>=_0x4d4506){_0x4ac80e=_0x4d4506;_0x2acf11=0xc8;}else{_0x2acf11=0xce;}_0x56a4f1[_0x359b('0x2e')](_0x2acf11);return _0x56a4f1[_0x359b('0x34')]('Content-Range',_0x410d33+'-'+_0x4ac80e+'/'+_0x4d4506)['json'](_0x5a4ae5);}return null;};}function patchUpdates(_0x498620){return function(_0x257eb0){try{jsonpatch[_0x359b('0x35')](_0x257eb0,_0x498620,!![]);}catch(_0x35ed2b){return BPromise[_0x359b('0x36')](_0x35ed2b);}return _0x257eb0['save']();};}function saveUpdates(_0x1ba9b0,_0x2ef79b){return function(_0xf0f463){if(_0xf0f463){return _0xf0f463['update'](_0x1ba9b0)[_0x359b('0x22')](function(_0x4b3966){return _0x4b3966;});}return null;};}function removeEntity(_0x3795d1,_0x45c2e2){return function(_0xcee6e9){if(_0xcee6e9){return _0xcee6e9[_0x359b('0x37')]()[_0x359b('0x22')](function(){var _0xc89186=_0xcee6e9[_0x359b('0x38')]({'plain':!![]});var _0x42e666=[{'name':_0x359b('0x39'),'value':_0x359b('0x3a'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x359b('0x3b'),'value':_0x359b('0x3c'),'ignore':![]}];var _0x3621f3=_(_0x42e666)[_0x359b('0x3d')](_0x359b('0x3e'))[_0x359b('0x3f')](_0x359b('0x40'))[_0x359b('0x40')]();if(_[_0x359b('0x41')](_0x3621f3,_0xc89186[_0x359b('0x42')])){return;}var _0x2e8507=_[_0x359b('0x43')](_0x42e666,[_0x359b('0x40'),_0xc89186['role']])[_0x359b('0x44')];return db[_0x359b('0x45')]['destroy']({'where':{'type':_0x2e8507,'resourceId':_0xc89186['id']}})[_0x359b('0x22')](function(){return _0xcee6e9;});})[_0x359b('0x22')](function(){_0x3795d1[_0x359b('0x2e')](0xcc)[_0x359b('0x2f')]();});}};}function handleEntityNotFound(_0x354a02,_0x467057){return function(_0x5a3e71){if(!_0x5a3e71){_0x354a02['sendStatus'](0x194);}return _0x5a3e71;};}function handleError(_0x39cb39,_0x28ccc4){_0x28ccc4=_0x28ccc4||0x1f4;return function(_0x293972){logger[_0x359b('0x28')](_0x293972[_0x359b('0x46')]);if(_0x293972[_0x359b('0x44')]){delete _0x293972[_0x359b('0x44')];}_0x39cb39[_0x359b('0x2e')](_0x28ccc4)['send'](_0x293972);};}exports[_0x359b('0x47')]=function(_0x40c483,_0xfbf7bf){var _0x4c418c={},_0x1914a3={},_0x741c38={'count':0x0,'rows':[]};var _0x3d1a5d=_['map'](db[_0x359b('0x48')][_0x359b('0x49')],function(_0x2cb296){return{'name':_0x2cb296[_0x359b('0x4a')],'type':_0x2cb296[_0x359b('0x4b')][_0x359b('0x4c')]};});_0x1914a3[_0x359b('0x4d')]=_[_0x359b('0x4e')](_[_0x359b('0x3f')](_0x3d1a5d,'name'),[_0x359b('0x4f'),'salt']);_0x1914a3[_0x359b('0x50')]=_['keys'](_0x40c483[_0x359b('0x50')]);_0x1914a3[_0x359b('0x51')]=_[_0x359b('0x52')](_0x1914a3[_0x359b('0x4d')],_0x1914a3['query']);_0x4c418c[_0x359b('0x53')]=_['intersection'](_0x1914a3['model'],qs[_0x359b('0x54')](_0x40c483[_0x359b('0x50')]['fields']));_0x4c418c[_0x359b('0x53')]=_0x4c418c[_0x359b('0x53')]['length']?_0x4c418c[_0x359b('0x53')]:_0x1914a3['model'];if(!_0x40c483[_0x359b('0x50')][_0x359b('0x55')](_0x359b('0x56'))){_0x4c418c[_0x359b('0x33')]=qs[_0x359b('0x33')](_0x40c483[_0x359b('0x50')][_0x359b('0x33')]);_0x4c418c['offset']=qs['offset'](_0x40c483[_0x359b('0x50')][_0x359b('0x32')]);}_0x4c418c[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x40c483[_0x359b('0x50')]['sort']);_0x4c418c[_0x359b('0x59')]=qs[_0x359b('0x51')](_['pick'](_0x40c483['query'],_0x1914a3[_0x359b('0x51')]),_0x3d1a5d);if(_0x40c483[_0x359b('0x50')]['filter']){_0x4c418c[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x4c418c[_0x359b('0x59')],{'$or':_[_0x359b('0x3f')](_0x3d1a5d,function(_0x2be14f){if(_0x2be14f[_0x359b('0x4b')]!=='VIRTUAL'){return db[_0x359b('0x5b')][_0x359b('0x59')](db[_0x359b('0x5b')]['fn']('lower',db['sequelize'][_0x359b('0x5c')](_0x2be14f[_0x359b('0x44')])),{'$like':db[_0x359b('0x5b')]['fn'](_0x359b('0x5d'),'%'+_0x40c483[_0x359b('0x50')][_0x359b('0x3d')]+'%')});}})});}_0x4c418c=_['merge']({},_0x4c418c,_0x40c483[_0x359b('0x5e')]);var _0x286f7d={'where':_0x4c418c[_0x359b('0x59')]};return db['User'][_0x359b('0x31')](_0x286f7d)[_0x359b('0x22')](function(_0x7c48e4){_0x741c38['count']=_0x7c48e4;if(_0x40c483[_0x359b('0x50')][_0x359b('0x5f')]){_0x4c418c[_0x359b('0x60')]=[{'all':!![]}];}return db[_0x359b('0x48')]['findAll'](_0x4c418c);})[_0x359b('0x22')](function(_0x3a73cd){_0x741c38[_0x359b('0x61')]=_0x3a73cd;return _0x741c38;})[_0x359b('0x22')](respondWithFilteredResult(_0xfbf7bf,_0x4c418c))['catch'](handleError(_0xfbf7bf,null));};exports[_0x359b('0x62')]=function(_0x438244,_0x4eef2e){var _0x10dca3={'raw':![],'where':{'id':_0x438244[_0x359b('0x63')]['id']}},_0x1e5b27={};_0x1e5b27[_0x359b('0x4d')]=_[_0x359b('0x4e')](_[_0x359b('0x64')](db[_0x359b('0x48')][_0x359b('0x49')]),['password',_0x359b('0x65')]);_0x1e5b27[_0x359b('0x50')]=_[_0x359b('0x64')](_0x438244['query']);_0x1e5b27[_0x359b('0x51')]=_[_0x359b('0x52')](_0x1e5b27['model'],_0x1e5b27[_0x359b('0x50')]);_0x10dca3['attributes']=_[_0x359b('0x52')](_0x1e5b27[_0x359b('0x4d')],qs[_0x359b('0x54')](_0x438244[_0x359b('0x50')][_0x359b('0x54')]));_0x10dca3[_0x359b('0x53')]=_0x10dca3[_0x359b('0x53')][_0x359b('0x66')]?_0x10dca3[_0x359b('0x53')]:_0x1e5b27[_0x359b('0x4d')];if(_0x438244['query']['includeAll']){_0x10dca3[_0x359b('0x60')]=[{'all':!![]}];}_0x10dca3=_[_0x359b('0x5a')]({},_0x10dca3,_0x438244[_0x359b('0x5e')]);return db['User'][_0x359b('0x43')](_0x10dca3)['then'](handleEntityNotFound(_0x4eef2e,null))[_0x359b('0x22')](respondWithResult(_0x4eef2e,null))['catch'](handleError(_0x4eef2e,null));};exports[_0x359b('0x67')]=function(_0x251b76,_0x540d12){return db[_0x359b('0x48')][_0x359b('0x67')](_0x251b76[_0x359b('0x68')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x540d12,0xc9))[_0x359b('0x2c')](handleError(_0x540d12,null));};exports['update']=function(_0x358412,_0x48ccb5){if(_0x358412['body']['id']){delete _0x358412[_0x359b('0x68')]['id'];}delete _0x358412[_0x359b('0x68')][_0x359b('0x42')];return db[_0x359b('0x48')][_0x359b('0x43')]({'where':{'id':_0x358412['params']['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x48ccb5,null))['then'](saveUpdates(_0x358412[_0x359b('0x68')],null))[_0x359b('0x22')](respondWithResult(_0x48ccb5,null))['catch'](handleError(_0x48ccb5,null));};exports[_0x359b('0x69')]=function(_0x4eb675,_0x1ccaa9){return db[_0x359b('0x48')][_0x359b('0x69')]()[_0x359b('0x22')](respondWithResult(_0x1ccaa9,null))[_0x359b('0x2c')](handleError(_0x1ccaa9,null));};exports[_0x359b('0x6a')]=function(_0x410029,_0x4d2a9f,_0x34d3a3){return db['User'][_0x359b('0x43')]({'where':{'id':_0x410029[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x4d2a9f,null))[_0x359b('0x22')](function(_0xc898cc){if(_0xc898cc){return _0xc898cc[_0x359b('0x6a')](_0x410029[_0x359b('0x68')][_0x359b('0x6b')],_['omit'](_0x410029['body'],[_0x359b('0x6b'),'id'])||{});}})[_0x359b('0x22')](respondWithResult(_0x4d2a9f,null))['catch'](handleError(_0x4d2a9f,null));};var getLicense=function(_0x22b64a){return new BPromise(function(_0x179081,_0x4aa978){var _0x2e9551=0x0;_0x22b64a[_0x359b('0x68')][_0x359b('0x42')]===_0x359b('0x6c')&&_0x179081('agent\x20role');return db[_0x359b('0x48')]['count']({'where':{'$or':[{'role':_0x22b64a[_0x359b('0x68')][_0x359b('0x42')]==='telephone'?'telephone':[_0x359b('0x6d'),'user']}]}})[_0x359b('0x22')](function(_0x5b272f){_0x2e9551=_0x5b272f;return require('../../config/license/util')['getLicense']();})[_0x359b('0x22')](function(_0x41db0e){var _0x2b1bf7=_0x22b64a[_0x359b('0x68')]['role']==='telephone'?'telephones':_0x359b('0x6e');if(!_['isNil'](_0x41db0e[_0x2b1bf7])&&_0x2e9551>=_0x41db0e[_0x2b1bf7]){return _0x4aa978({'message':'License\x20limit\x20reached'});}return _0x179081(util[_0x359b('0x6f')](_0x359b('0x70'),_0x2b1bf7,_0x2e9551));})[_0x359b('0x2c')](function(_0x1dfc9e){return _0x4aa978(_0x1dfc9e);});});};exports['create']=function(_0x3e6faa,_0x15b93b){return getLicense(_0x3e6faa)['then'](function(_0x419acf){if(!_0x3e6faa['body'][_0x359b('0x71')]){var _0xac0a7c;return db[_0x359b('0x72')][_0x359b('0x73')](0x1)[_0x359b('0x22')](function(_0x547b36){return checkPasswordPattern(_0x547b36,_0x3e6faa['body'][_0x359b('0x4f')],_0x547b36[_0x359b('0x74')]);})['then'](function(_0x5b83dd){_0xac0a7c=_0x5b83dd[_0x359b('0x75')];return db[_0x359b('0x48')][_0x359b('0x76')](_0x359b('0x71'));})[_0x359b('0x22')](function(_0x5726e1){if(_[_0x359b('0x77')](_0x5726e1)){if(_0xac0a7c){_0x3e6faa['body'][_0x359b('0x71')]=_0xac0a7c;}else{_0x3e6faa[_0x359b('0x68')][_0x359b('0x71')]=0x1;}}else{if(_[_0x359b('0x77')](_0xac0a7c)||_0xac0a7c==_0x5726e1){_0x3e6faa['body'][_0x359b('0x71')]=_0x5726e1+0x1;}else if(_0xac0a7c>_0x5726e1){_0x3e6faa[_0x359b('0x68')]['internal']=_0xac0a7c;}else{return db['sequelize'][_0x359b('0x50')](_0x359b('0x78'),{'type':db[_0x359b('0x5b')][_0x359b('0x79')][_0x359b('0x7a')]})[_0x359b('0x22')](function(_0x3a4145){if(_0x3a4145&&_0x3a4145[_0x359b('0x66')]){for(var _0x34b9ef=0x0,_0x5c254a=_0x3a4145[_0x359b('0x66')];_0x34b9ef<_0x5c254a&&_[_0x359b('0x77')](_0x3e6faa['body'][_0x359b('0x71')]);_0x34b9ef++){if(_0xac0a7c<=_0x3a4145[_0x34b9ef][_0x359b('0x7b')]){_0x3e6faa[_0x359b('0x68')][_0x359b('0x71')]=_0x3a4145[_0x34b9ef][_0x359b('0x7b')];}else if(_0xac0a7c>_0x3a4145[_0x34b9ef]['from']&&_0xac0a7c<=_0x3a4145[_0x34b9ef]['to']){_0x3e6faa['body'][_0x359b('0x71')]=_0xac0a7c;}}}if(_[_0x359b('0x77')](_0x3e6faa[_0x359b('0x68')][_0x359b('0x71')])){_0x3e6faa[_0x359b('0x68')][_0x359b('0x71')]=_0x5726e1+0x1;}});}}});}})[_0x359b('0x22')](function(){if(_0x3e6faa[_0x359b('0x68')][_0x359b('0x7c')]){_0x3e6faa[_0x359b('0x68')]['mailbox']=_0x3e6faa[_0x359b('0x68')]['internal'];_0x3e6faa[_0x359b('0x68')][_0x359b('0x7d')]={'mailbox':_0x3e6faa[_0x359b('0x68')][_0x359b('0x71')],'password':_0x3e6faa[_0x359b('0x68')][_0x359b('0x4f')],'fullname':_0x3e6faa[_0x359b('0x68')][_0x359b('0x7e')],'email':_0x3e6faa[_0x359b('0x68')]['email']};}if(_0x3e6faa[_0x359b('0x68')]&&_0x3e6faa[_0x359b('0x68')][_0x359b('0x42')]===_0x359b('0x6c')){if(!_0x3e6faa[_0x359b('0x68')][_0x359b('0x7f')]){_0x3e6faa[_0x359b('0x68')][_0x359b('0x7f')]=['101',_0x359b('0x80'),_0x359b('0x81'),_0x359b('0x82'),_0x359b('0x83'),'104','105',_0x359b('0x84'),_0x359b('0x85'),_0x359b('0x86'),_0x359b('0x87'),_0x359b('0x88'),_0x359b('0x89'),_0x359b('0x8a')];}}return db[_0x359b('0x48')][_0x359b('0x8b')](_0x3e6faa['body'],{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x3406b8){if(_0x3e6faa[_0x359b('0x68')][_0x359b('0x42')]==='user')return _0x3406b8;var _0x107a05=_0x3e6faa[_0x359b('0x3a')][_0x359b('0x38')]({'plain':!![]});if(!_0x107a05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x107a05[_0x359b('0x42')]===_0x359b('0x3a')){var _0x1c08ff=_0x3406b8[_0x359b('0x38')]({'plain':!![]});var _0x5ae132=[{'name':_0x359b('0x8c'),'value':_0x359b('0x6c')},{'name':_0x359b('0x3b'),'value':_0x359b('0x3c')}];var _0x41b0b1=_[_0x359b('0x43')](_0x5ae132,[_0x359b('0x40'),_0x1c08ff[_0x359b('0x42')]])[_0x359b('0x44')];return db['UserProfileSection'][_0x359b('0x43')]({'where':{'name':_0x41b0b1,'userProfileId':_0x107a05[_0x359b('0x8d')]},'raw':!![]})[_0x359b('0x22')](function(_0x436744){if(_0x436744&&_0x436744[_0x359b('0x8e')]===0x0){return db[_0x359b('0x45')]['create']({'name':_0x1c08ff[_0x359b('0x44')],'resourceId':_0x1c08ff['id'],'type':_0x436744[_0x359b('0x44')],'sectionId':_0x436744['id']},{})[_0x359b('0x22')](function(){return _0x3406b8;});}else{return _0x3406b8;}})[_0x359b('0x2c')](function(_0x4ff89b){logger['error'](_0x359b('0x8f'),_0x4ff89b);throw _0x4ff89b;});}return _0x3406b8;})['then'](respondWithResult(_0x15b93b,0xc9))[_0x359b('0x2c')](handleError(_0x15b93b,null));};exports['changePassword']=function(_0x350bf7,_0x7a2eff,_0x1d2d76){var _0x3bc3cd=![];if(_0x350bf7[_0x359b('0x68')]['id']){delete _0x350bf7[_0x359b('0x68')]['id'];}return db[_0x359b('0x72')]['findOne']({'attributes':['id','securePassword']})[_0x359b('0x22')](function(_0x28c72b){_0x3bc3cd=_0x28c72b['securePassword'];return db['User'][_0x359b('0x43')]({'where':{'id':_0x350bf7[_0x359b('0x63')]['id']}});})['then'](function(_0x3ea702){if(_0x3ea702){if(_0x3ea702['id']==_0x350bf7[_0x359b('0x3a')]['id']){if(!_0x350bf7[_0x359b('0x68')][_0x359b('0x90')]||!_0x350bf7[_0x359b('0x68')][_0x359b('0x91')]){throw new db[(_0x359b('0x1e'))][(_0x359b('0x1f'))](_0x359b('0x92'));}if(!_0x3ea702[_0x359b('0x93')](_0x350bf7[_0x359b('0x68')]['oldPassword'])){throw new db[(_0x359b('0x1e'))]['ValidationError']('Wrong\x20credentials');}if(_0x350bf7[_0x359b('0x68')][_0x359b('0x90')]==_0x350bf7[_0x359b('0x68')][_0x359b('0x91')]){throw new db['Sequelize'][(_0x359b('0x1f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x3ea702;}else if(_0x350bf7['user'][_0x359b('0x42')]==_0x359b('0x6d')){if(!_0x350bf7[_0x359b('0x68')][_0x359b('0x91')]){throw new db[(_0x359b('0x1e'))][(_0x359b('0x1f'))](_0x359b('0x94'));}return _0x3ea702;}else if(_0x350bf7[_0x359b('0x3a')][_0x359b('0x42')]==_0x359b('0x3a')){if(!_0x350bf7[_0x359b('0x68')][_0x359b('0x91')]){throw new db[(_0x359b('0x1e'))][(_0x359b('0x1f'))](_0x359b('0x94'));}if(_0x3ea702[_0x359b('0x42')]!=_0x359b('0x6c')){throw new db[(_0x359b('0x1e'))]['ValidationError']('Unauthorized');}return _0x3ea702;}else{throw new db[(_0x359b('0x1e'))][(_0x359b('0x1f'))](_0x359b('0x95'));}}return null;})[_0x359b('0x22')](handleEntityNotFound(_0x7a2eff,null))[_0x359b('0x22')](function(_0x4766dd){return checkPasswordPattern(_0x4766dd,_0x350bf7[_0x359b('0x68')]['newPassword'],_0x3bc3cd);})[_0x359b('0x22')](saveUpdates({'password':_0x350bf7[_0x359b('0x68')]['newPassword'],'passwordResetAt':_0x350bf7[_0x359b('0x3a')]['id']==_0x350bf7[_0x359b('0x63')]['id']?moment():null},null))['then'](respondWithResult(_0x7a2eff,null))[_0x359b('0x2c')](handleError(_0x7a2eff,null));};exports['addQueues']=function(_0x41fd8a,_0x20388d,_0x457726){var _0x2c066f=_0x41fd8a[_0x359b('0x68')][_0x359b('0x96')];return db[_0x359b('0x48')][_0x359b('0x43')]({'where':{'id':_0x41fd8a[_0x359b('0x63')]['id']},'attributes':['id',_0x359b('0x44'),_0x359b('0x42'),_0x359b('0x97'),_0x359b('0x98'),_0x359b('0x99'),'interface']})['then'](handleEntityNotFound(_0x20388d,null))['then'](function(_0x2c1664){if(_0x2c1664){if(!utils[_0x359b('0x9a')](_0x2c066f)){throw new db['Sequelize'][(_0x359b('0x1f'))](_0x359b('0x9b'));}return _0x2c1664[_0x359b('0x9c')+_[_0x359b('0x9d')](_0x2c066f['toLowerCase']())+'Queues'](_0x41fd8a[_0x359b('0x68')][_0x359b('0x6b')],{'penalty':_0x41fd8a['body'][_0x359b('0x9e')]||0x0})[_0x359b('0x9f')](function(_0x22f8da){for(var _0x47bc99=0x0;_0x47bc99<_0x41fd8a[_0x359b('0x68')][_0x359b('0x6b')][_0x359b('0x66')];_0x47bc99+=0x1){var _0x370545={'UserId':_0x41fd8a[_0x359b('0x63')]['id']};_0x370545[_[_0x359b('0x9d')](_0x2c066f[_0x359b('0xa0')]())+'QueueId']=_0x41fd8a[_0x359b('0x68')][_0x359b('0x6b')][_0x47bc99];socket[_0x359b('0xa1')](_0x359b('0x3a')+_[_0x359b('0x9d')](_0x2c066f[_0x359b('0xa0')]())+_0x359b('0xa2'),_0x370545);}return _0x22f8da;})['then'](function(){if(_0x2c066f==='voice'){return db['VoiceQueue'][_0x359b('0xa3')]({'where':{'id':_0x41fd8a[_0x359b('0x68')][_0x359b('0x6b')]||[]},'raw':!![],'attributes':['id',_0x359b('0x44')]});}})[_0x359b('0x22')](function(_0x195636){var _0x437dcb=_0x2c1664['get']({'plain':!![]});var _0x4d09ca=[];if(_0x2c066f===_0x359b('0xa4')&&_0x437dcb[_0x359b('0x42')]===_0x359b('0x6c')&&_0x437dcb[_0x359b('0x97')]){for(var _0x5a78c8=0x0;_0x5a78c8<_0x195636[_0x359b('0x66')];_0x5a78c8+=0x1){_0x4d09ca['push']({'membername':_0x437dcb[_0x359b('0x44')],'UserId':_0x437dcb['id'],'queue_name':_0x195636[_0x5a78c8][_0x359b('0x44')],'VoiceQueueId':_0x195636[_0x5a78c8]['id'],'interface':_[_0x359b('0x77')](_0x437dcb['interface'])?util[_0x359b('0x6f')](_0x359b('0xa5'),_0x437dcb[_0x359b('0x44')]):_0x437dcb[_0x359b('0xa6')],'paused':_0x437dcb[_0x359b('0x99')]||![],'penalty':_0x41fd8a['body'][_0x359b('0x9e')]||0x0});}return BPromise[_0x359b('0xa7')](_0x4d09ca,function(_0x5f18da){return db['UserVoiceQueueRt']['upsert'](_0x5f18da);});}return _0x2c1664;});}})['then'](respondWithStatusCode(_0x20388d,null))['catch'](handleError(_0x20388d,null));};exports['removeQueues']=function(_0x5a5d00,_0x1c7a20,_0x1b787b){var _0xd030a;return db[_0x359b('0x48')]['find']({'where':{'id':_0x5a5d00['params']['id']},'attributes':['id',_0x359b('0x44'),'role']})[_0x359b('0x22')](handleEntityNotFound(_0x1c7a20,null))[_0x359b('0x22')](function(_0x3ca62f){if(_0x3ca62f){_0xd030a=_0x3ca62f;if(!_0x5a5d00[_0x359b('0x50')][_0x359b('0x96')]||!utils['isValidChannel'](_0x5a5d00['query']['channel'])){throw new db[(_0x359b('0x1e'))][(_0x359b('0x1f'))](_0x359b('0x9b'));}return _0x3ca62f[_0x359b('0xa8')+_[_0x359b('0x9d')](_0x5a5d00[_0x359b('0x50')][_0x359b('0x96')][_0x359b('0xa0')]())+_0x359b('0xa9')](_0x5a5d00[_0x359b('0x50')][_0x359b('0x6b')]);}})[_0x359b('0x22')](function(_0x3890f9){for(var _0x1d7924=0x0;_0x1d7924<_0x5a5d00['query'][_0x359b('0x6b')][_0x359b('0x66')];_0x1d7924+=0x1){var _0x499ade={'UserId':_0x5a5d00['params']['id']};_0x499ade[_['capitalize'](_0x5a5d00[_0x359b('0x50')]['channel']['toLowerCase']())+_0x359b('0xaa')]=_0x5a5d00[_0x359b('0x50')][_0x359b('0x6b')][_0x1d7924];socket['emit'](_0x359b('0x3a')+_[_0x359b('0x9d')](_0x5a5d00[_0x359b('0x50')][_0x359b('0x96')]['toLowerCase']())+'Queue:remove',_0x499ade);}return _0x3890f9;})[_0x359b('0x22')](function(){if(_0x5a5d00[_0x359b('0x50')][_0x359b('0x96')]===_0x359b('0xa4')){return db[_0x359b('0xab')]['destroy']({'where':{'UserId':_0x5a5d00['params']['id'],'VoiceQueueId':_0x5a5d00[_0x359b('0x50')][_0x359b('0x6b')]},'individualHooks':!![]})[_0x359b('0x22')](function(){return _0xd030a;});}return _0xd030a;})[_0x359b('0x22')](respondWithStatusCode(_0x1c7a20,null))[_0x359b('0x2c')](handleError(_0x1c7a20,null));};exports[_0x359b('0xac')]=function(_0x19ce91,_0x10606c,_0x446594){_0x19ce91[_0x359b('0x68')]['userpic']=_0x19ce91[_0x359b('0xad')][_0x359b('0xae')];return db[_0x359b('0x48')][_0x359b('0x43')]({'where':{'id':_0x19ce91[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x10606c,null))['then'](saveUpdates(_0x19ce91[_0x359b('0x68')],null))['then'](respondWithResult(_0x10606c,null))['catch'](handleError(_0x10606c,null));};exports['getAvatar']=function(_0x29377b,_0x2f79c7,_0x3f7b6e){var _0x125d5c=path[_0x359b('0xaf')](config[_0x359b('0xb0')],_0x359b('0xb1'));return db['User']['find']({'where':{'id':_0x29377b['params']['id']},'attributes':['id',_0x359b('0xb2')],'raw':!![]})[_0x359b('0x22')](handleEntityNotFound(_0x2f79c7,null))[_0x359b('0x22')](function(_0x7e9837){if(_0x7e9837){if(_[_0x359b('0x77')](_0x7e9837[_0x359b('0xb2')])){return _0x2f79c7[_0x359b('0xb3')](_0x125d5c);}else{if(!fs[_0x359b('0xb4')](path['join'](config[_0x359b('0xb0')],_0x359b('0xb5'),_0x7e9837['userpic']))){return _0x2f79c7['download'](_0x125d5c);}return _0x2f79c7['download'](path['join'](config[_0x359b('0xb0')],'server/files/images/',_0x7e9837[_0x359b('0xb2')]));}}})['catch'](handleError(_0x2f79c7,null));};exports[_0x359b('0xb6')]=function(_0x2154a3,_0x37eddb,_0x5cc817){var _0x1394cb={};var _0x1a3d51={};var _0x401db2;var _0x1459f0;return db['User'][_0x359b('0xb7')]({'where':{'id':_0x2154a3[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x37eddb,null))['then'](function(_0x19595e){if(_0x19595e){_0x401db2=_0x19595e;_0x1a3d51[_0x359b('0x4d')]=_['keys'](db[_0x359b('0xb8')][_0x359b('0x49')]);_0x1a3d51[_0x359b('0x50')]=_[_0x359b('0x64')](_0x2154a3[_0x359b('0x50')]);_0x1a3d51[_0x359b('0x51')]=_[_0x359b('0x52')](_0x1a3d51['model'],_0x1a3d51[_0x359b('0x50')]);_0x1394cb['attributes']=_['intersection'](_0x1a3d51[_0x359b('0x4d')],qs[_0x359b('0x54')](_0x2154a3[_0x359b('0x50')]['fields']));_0x1394cb[_0x359b('0x53')]=_0x1394cb[_0x359b('0x53')][_0x359b('0x66')]?_0x1394cb[_0x359b('0x53')]:_0x1a3d51['model'];_0x1394cb[_0x359b('0x57')]=qs['sort'](_0x2154a3[_0x359b('0x50')][_0x359b('0x58')]);_0x1394cb[_0x359b('0x59')]=qs[_0x359b('0x51')](_[_0x359b('0xb9')](_0x2154a3[_0x359b('0x50')],_0x1a3d51[_0x359b('0x51')]));if(_0x2154a3[_0x359b('0x50')][_0x359b('0x3d')]){_0x1394cb[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x1394cb['where'],{'$or':_[_0x359b('0x3f')](_0x1394cb['attributes'],function(_0x21afcd){var _0x3ecdf8={};_0x3ecdf8[_0x21afcd]={'$like':'%'+_0x2154a3['query'][_0x359b('0x3d')]+'%'};return _0x3ecdf8;})});}_0x1394cb=_['merge']({},_0x1394cb,_0x2154a3['options']);return _0x401db2['getContacts'](_0x1394cb);}})[_0x359b('0x22')](function(_0x41db78){if(_0x41db78){_0x1459f0=_0x41db78[_0x359b('0x66')];if(_0x2154a3['query'][_0x359b('0x55')]('includeAll')){_0x1394cb[_0x359b('0x60')]=[{'model':db['CmList'],'as':_0x359b('0xba'),'required':![]},{'model':db[_0x359b('0xbb')],'as':_0x359b('0xbc'),'attributes':['id',_0x359b('0x44'),'color'],'where':_0x2154a3['query'][_0x359b('0xbd')]?{'id':_0x2154a3[_0x359b('0x50')][_0x359b('0xbd')]}:undefined,'required':_0x2154a3[_0x359b('0x50')][_0x359b('0xbd')]?!![]:![]}];}if(!_0x2154a3[_0x359b('0x50')][_0x359b('0x55')](_0x359b('0x56'))){_0x1394cb['limit']=qs[_0x359b('0x33')](_0x2154a3[_0x359b('0x50')]['limit']);_0x1394cb['offset']=qs[_0x359b('0x32')](_0x2154a3[_0x359b('0x50')][_0x359b('0x32')]);}return _0x401db2['getContacts'](_0x1394cb);}})[_0x359b('0x22')](function(_0x3fed19){if(_0x3fed19){return _0x3fed19?{'count':_0x1459f0,'rows':_0x3fed19}:null;}})['then'](respondWithResult(_0x37eddb,null))[_0x359b('0x2c')](handleError(_0x37eddb,null));};exports['getQueues']=function(_0x3b329d,_0x46c7c8,_0x28805f){var _0x161b6c;var _0x5331d1;var _0x34b11c={};var _0x5a6f9c;return db[_0x359b('0x48')][_0x359b('0xb7')]({'where':{'id':_0x3b329d[_0x359b('0x63')]['id']},'attributes':['id','name',_0x359b('0x42')]})[_0x359b('0x22')](handleEntityNotFound(_0x46c7c8,null))[_0x359b('0x22')](function(_0x3129a5){if(!utils['isValidChannel'](_0x3b329d[_0x359b('0x50')][_0x359b('0x96')])){throw new db[(_0x359b('0x1e'))][(_0x359b('0x1f'))](_0x359b('0x9b'));}_0x161b6c=_0x3129a5;var _0x198b8b={};_0x198b8b[_0x359b('0x4d')]=_[_0x359b('0x64')](db[_['capitalize'](_0x3b329d[_0x359b('0x50')]['channel'])+_0x359b('0xbe')]['rawAttributes']);_0x198b8b[_0x359b('0x50')]=_[_0x359b('0x64')](_0x3b329d[_0x359b('0x50')]);_0x198b8b[_0x359b('0x51')]=_[_0x359b('0x52')](_0x198b8b['model'],_0x198b8b[_0x359b('0x50')]);_0x34b11c[_0x359b('0x53')]=_['intersection'](_0x198b8b[_0x359b('0x4d')],qs[_0x359b('0x54')](_0x3b329d[_0x359b('0x50')]['fields']));_0x34b11c[_0x359b('0x53')]=_0x34b11c[_0x359b('0x53')][_0x359b('0x66')]?_0x34b11c[_0x359b('0x53')]:_0x198b8b[_0x359b('0x4d')];_0x34b11c[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x3b329d[_0x359b('0x50')]['sort']);_0x34b11c[_0x359b('0x59')]=qs[_0x359b('0x51')](_[_0x359b('0xb9')](_0x3b329d[_0x359b('0x50')],_0x198b8b[_0x359b('0x51')]));if(_0x3b329d['query'][_0x359b('0x3d')]){_0x34b11c[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x34b11c[_0x359b('0x59')],{'$or':_[_0x359b('0x3f')](_0x34b11c[_0x359b('0x53')],function(_0x5dbf0c){var _0x28e8fe={};_0x28e8fe[_0x5dbf0c]={'$like':'%'+_0x3b329d[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x28e8fe;})});}_0x34b11c=_[_0x359b('0x5a')]({},_0x34b11c,_0x3b329d[_0x359b('0x5e')]);switch(_0x161b6c[_0x359b('0x42')]){case _0x359b('0x6d'):return db[_[_0x359b('0x9d')](_0x3b329d[_0x359b('0x50')][_0x359b('0x96')])+_0x359b('0xbe')][_0x359b('0xa3')](_0x34b11c);case _0x359b('0x3a'):case _0x359b('0x6c'):return _0x161b6c[_0x359b('0x38')+_[_0x359b('0x9d')](_0x3b329d[_0x359b('0x50')][_0x359b('0x96')])+_0x359b('0xa9')](_0x34b11c);default:throw new db['Sequelize'][(_0x359b('0x1f'))](_0x359b('0xbf'));}})[_0x359b('0x22')](function(_0x2b9845){_0x5a6f9c=_0x2b9845[_0x359b('0x66')];if(!_0x3b329d[_0x359b('0x50')][_0x359b('0x55')]('nolimit')){_0x34b11c[_0x359b('0x33')]=qs['limit'](_0x3b329d['query'][_0x359b('0x33')]);_0x34b11c['offset']=qs[_0x359b('0x32')](_0x3b329d[_0x359b('0x50')]['offset']);}switch(_0x161b6c[_0x359b('0x42')]){case'admin':return db[_[_0x359b('0x9d')](_0x3b329d[_0x359b('0x50')][_0x359b('0x96')])+'Queue']['findAll'](_0x34b11c);case _0x359b('0x3a'):case _0x359b('0x6c'):return _0x161b6c['get'+_[_0x359b('0x9d')](_0x3b329d[_0x359b('0x50')]['channel'])+_0x359b('0xa9')](_0x34b11c);}})[_0x359b('0x22')](function(_0x1770fd){return{'count':_0x5a6f9c,'rows':_0x1770fd};})[_0x359b('0x22')](respondWithResult(_0x46c7c8,null))[_0x359b('0x2c')](handleError(_0x46c7c8,null));};exports[_0x359b('0xc0')]=function(_0x653f,_0x26f657,_0x1575e0){var _0x4666e7={};var _0x212c03={};var _0x199e79;var _0x3e4832;return db[_0x359b('0x48')][_0x359b('0xb7')]({'where':{'id':_0x653f[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x26f657,null))[_0x359b('0x22')](function(_0x4befb9){if(_0x4befb9){_0x199e79=_0x4befb9;_0x212c03[_0x359b('0x4d')]=_[_0x359b('0x64')](db[_0x359b('0xab')][_0x359b('0x49')]);_0x212c03['query']=_[_0x359b('0x64')](_0x653f[_0x359b('0x50')]);_0x212c03[_0x359b('0x51')]=_[_0x359b('0x52')](_0x212c03[_0x359b('0x4d')],_0x212c03[_0x359b('0x50')]);_0x4666e7[_0x359b('0x53')]=_[_0x359b('0x52')](_0x212c03[_0x359b('0x4d')],qs[_0x359b('0x54')](_0x653f[_0x359b('0x50')][_0x359b('0x54')]));_0x4666e7[_0x359b('0x53')]=_0x4666e7[_0x359b('0x53')]['length']?_0x4666e7[_0x359b('0x53')]:_0x212c03[_0x359b('0x4d')];_0x4666e7['order']=qs[_0x359b('0x58')](_0x653f[_0x359b('0x50')][_0x359b('0x58')]);_0x4666e7[_0x359b('0x59')]=qs[_0x359b('0x51')](_['pick'](_0x653f[_0x359b('0x50')],_0x212c03[_0x359b('0x51')]));if(_0x653f[_0x359b('0x50')][_0x359b('0x3d')]){_0x4666e7[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x4666e7['where'],{'$or':_[_0x359b('0x3f')](_0x4666e7[_0x359b('0x53')],function(_0x48bff5){var _0x3ec62c={};_0x3ec62c[_0x48bff5]={'$like':'%'+_0x653f[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x3ec62c;})});}_0x4666e7=_[_0x359b('0x5a')]({},_0x4666e7,_0x653f[_0x359b('0x5e')]);return _0x199e79['getVoiceQueuesRt'](_0x4666e7);}})['then'](function(_0x14bb76){if(_0x14bb76){_0x3e4832=_0x14bb76[_0x359b('0x66')];if(!_0x653f[_0x359b('0x50')]['hasOwnProperty'](_0x359b('0x56'))){_0x4666e7[_0x359b('0x33')]=qs[_0x359b('0x33')](_0x653f['query'][_0x359b('0x33')]);_0x4666e7['offset']=qs[_0x359b('0x32')](_0x653f[_0x359b('0x50')]['offset']);}return _0x199e79[_0x359b('0xc0')](_0x4666e7);}})[_0x359b('0x22')](function(_0x1c7b66){if(_0x1c7b66){return _0x1c7b66?{'count':_0x3e4832,'rows':_0x1c7b66}:null;}})[_0x359b('0x22')](respondWithResult(_0x26f657,null))[_0x359b('0x2c')](handleError(_0x26f657,null));};exports[_0x359b('0xc1')]=function(_0x51a1e3,_0x3601b8,_0x89ea85){var _0xb75479={};var _0x40261e={};var _0x38c82d;var _0x36b7bb;return db[_0x359b('0x48')][_0x359b('0xb7')]({'where':{'id':_0x51a1e3[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x3601b8,null))[_0x359b('0x22')](function(_0x5d79b9){if(_0x5d79b9){_0x38c82d=_0x5d79b9;_0x40261e[_0x359b('0x4d')]=_['keys'](db[_0x359b('0xc2')]['rawAttributes']);_0x40261e[_0x359b('0x50')]=_[_0x359b('0x64')](_0x51a1e3[_0x359b('0x50')]);_0x40261e['filters']=_[_0x359b('0x52')](_0x40261e[_0x359b('0x4d')],_0x40261e[_0x359b('0x50')]);_0xb75479[_0x359b('0x53')]=_['intersection'](_0x40261e['model'],qs[_0x359b('0x54')](_0x51a1e3['query']['fields']));_0xb75479[_0x359b('0x53')]=_0xb75479['attributes'][_0x359b('0x66')]?_0xb75479[_0x359b('0x53')]:_0x40261e[_0x359b('0x4d')];_0xb75479[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x51a1e3[_0x359b('0x50')][_0x359b('0x58')]);_0xb75479[_0x359b('0x59')]=qs['filters'](_[_0x359b('0xb9')](_0x51a1e3[_0x359b('0x50')],_0x40261e['filters']));if(_0x51a1e3[_0x359b('0x50')][_0x359b('0x3d')]){_0xb75479[_0x359b('0x59')]=_[_0x359b('0x5a')](_0xb75479[_0x359b('0x59')],{'$or':_[_0x359b('0x3f')](_0xb75479[_0x359b('0x53')],function(_0x2715d2){var _0x37a7c5={};_0x37a7c5[_0x2715d2]={'$like':'%'+_0x51a1e3[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x37a7c5;})});}_0xb75479=_[_0x359b('0x5a')]({},_0xb75479,_0x51a1e3[_0x359b('0x5e')]);return _0x38c82d['getGroups'](_0xb75479);}})[_0x359b('0x22')](function(_0x1489e7){if(_0x1489e7){_0x36b7bb=_0x1489e7[_0x359b('0x66')];if(!_0x51a1e3[_0x359b('0x50')]['hasOwnProperty'](_0x359b('0x56'))){_0xb75479[_0x359b('0x33')]=qs[_0x359b('0x33')](_0x51a1e3[_0x359b('0x50')][_0x359b('0x33')]);_0xb75479['offset']=qs[_0x359b('0x32')](_0x51a1e3[_0x359b('0x50')][_0x359b('0x32')]);}return _0x38c82d['getGroups'](_0xb75479);}})[_0x359b('0x22')](function(_0x5e5cb7){if(_0x5e5cb7){return _0x5e5cb7?{'count':_0x36b7bb,'rows':_0x5e5cb7}:null;}})['then'](respondWithResult(_0x3601b8,null))[_0x359b('0x2c')](handleError(_0x3601b8,null));};exports[_0x359b('0xc3')]=function(_0x4f63d7,_0x182745,_0x2b66cf){var _0x570948={'raw':!![],'where':{}};var _0x587f2e={};var _0x332ece={'count':0x0,'rows':[]};return db[_0x359b('0x48')]['findOne']({'where':{'id':_0x4f63d7[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x182745,null))[_0x359b('0x22')](function(_0x143a7c){if(_0x143a7c){_0x587f2e[_0x359b('0x4d')]=_[_0x359b('0x64')](db[_0x359b('0xc4')]['rawAttributes']);_0x587f2e[_0x359b('0x50')]=_[_0x359b('0x64')](_0x4f63d7[_0x359b('0x50')]);_0x587f2e['filters']=_['intersection'](_0x587f2e['model'],_0x587f2e[_0x359b('0x50')]);_0x570948[_0x359b('0x53')]=_['intersection'](_0x587f2e['model'],qs[_0x359b('0x54')](_0x4f63d7[_0x359b('0x50')][_0x359b('0x54')]));_0x570948[_0x359b('0x53')]=_0x570948[_0x359b('0x53')][_0x359b('0x66')]?_0x570948['attributes']:_0x587f2e[_0x359b('0x4d')];if(!_0x4f63d7[_0x359b('0x50')][_0x359b('0x55')]('nolimit')){_0x570948[_0x359b('0x33')]=qs['limit'](_0x4f63d7[_0x359b('0x50')][_0x359b('0x33')]);_0x570948[_0x359b('0x32')]=qs[_0x359b('0x32')](_0x4f63d7[_0x359b('0x50')]['offset']);}_0x570948[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x4f63d7[_0x359b('0x50')]['sort']);_0x570948[_0x359b('0x59')]=qs[_0x359b('0x51')](_['pick'](_0x4f63d7[_0x359b('0x50')],_0x587f2e[_0x359b('0x51')]));_0x570948[_0x359b('0x59')]['UserId']=_0x143a7c['id'];if(_0x4f63d7[_0x359b('0x50')][_0x359b('0x3d')]){_0x570948[_0x359b('0x59')]=_['merge'](_0x570948[_0x359b('0x59')],{'$or':_[_0x359b('0x3f')](_0x570948[_0x359b('0x53')],function(_0x45bf61){var _0x32ffa7={};_0x32ffa7[_0x45bf61]={'$like':'%'+_0x4f63d7[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x32ffa7;})});}_0x570948=_[_0x359b('0x5a')]({},_0x570948,_0x4f63d7[_0x359b('0x5e')]);return db[_0x359b('0xc4')][_0x359b('0x31')]({'where':_0x570948[_0x359b('0x59')]})['then'](function(_0x542e67){_0x332ece[_0x359b('0x31')]=_0x542e67;if(_0x4f63d7[_0x359b('0x50')][_0x359b('0x5f')]){_0x570948['include']=[{'all':!![]}];}return db[_0x359b('0xc4')][_0x359b('0xa3')](_0x570948);})[_0x359b('0x22')](function(_0x1952b1){_0x332ece['rows']=_0x1952b1;return _0x332ece;});}})['then'](respondWithFilteredResult(_0x182745,_0x570948))[_0x359b('0x2c')](handleError(_0x182745,null));};exports['getScreenRecordings']=function(_0x4cf02c,_0x2911fb,_0x1f084c){var _0x1f81e6={'raw':!![],'where':{}};var _0x2871b9={};var _0x1d6dfa={'count':0x0,'rows':[]};return db[_0x359b('0x48')][_0x359b('0xb7')]({'where':{'id':_0x4cf02c[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x2911fb,null))['then'](function(_0x355786){if(_0x355786){_0x2871b9['model']=_['keys'](db['ScreenRecording'][_0x359b('0x49')]);_0x2871b9[_0x359b('0x50')]=_[_0x359b('0x64')](_0x4cf02c[_0x359b('0x50')]);_0x2871b9[_0x359b('0x51')]=_[_0x359b('0x52')](_0x2871b9[_0x359b('0x4d')],_0x2871b9['query']);_0x1f81e6[_0x359b('0x53')]=_[_0x359b('0x52')](_0x2871b9[_0x359b('0x4d')],qs['fields'](_0x4cf02c[_0x359b('0x50')]['fields']));_0x1f81e6[_0x359b('0x53')]=_0x1f81e6[_0x359b('0x53')]['length']?_0x1f81e6['attributes']:_0x2871b9[_0x359b('0x4d')];if(!_0x4cf02c['query'][_0x359b('0x55')](_0x359b('0x56'))){_0x1f81e6[_0x359b('0x33')]=qs[_0x359b('0x33')](_0x4cf02c[_0x359b('0x50')][_0x359b('0x33')]);_0x1f81e6[_0x359b('0x32')]=qs[_0x359b('0x32')](_0x4cf02c[_0x359b('0x50')][_0x359b('0x32')]);}_0x1f81e6['order']=qs[_0x359b('0x58')](_0x4cf02c[_0x359b('0x50')][_0x359b('0x58')]);_0x1f81e6[_0x359b('0x59')]=qs[_0x359b('0x51')](_[_0x359b('0xb9')](_0x4cf02c['query'],_0x2871b9[_0x359b('0x51')]));_0x1f81e6[_0x359b('0x59')][_0x359b('0xc5')]=_0x355786['id'];if(_0x4cf02c['query'][_0x359b('0x3d')]){_0x1f81e6[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x1f81e6['where'],{'$or':_[_0x359b('0x3f')](_0x1f81e6[_0x359b('0x53')],function(_0x1c835a){var _0x5a688c={};_0x5a688c[_0x1c835a]={'$like':'%'+_0x4cf02c[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x5a688c;})});}_0x1f81e6=_[_0x359b('0x5a')]({},_0x1f81e6,_0x4cf02c[_0x359b('0x5e')]);return db['ScreenRecording'][_0x359b('0x31')]({'where':_0x1f81e6[_0x359b('0x59')]})[_0x359b('0x22')](function(_0x486207){_0x1d6dfa['count']=_0x486207;if(_0x4cf02c[_0x359b('0x50')][_0x359b('0x5f')]){_0x1f81e6[_0x359b('0x60')]=[{'all':!![]}];}return db[_0x359b('0xc6')]['findAll'](_0x1f81e6);})[_0x359b('0x22')](function(_0xbaab08){_0x1d6dfa[_0x359b('0x61')]=_0xbaab08;return _0x1d6dfa;});}})[_0x359b('0x22')](respondWithFilteredResult(_0x2911fb,_0x1f81e6))[_0x359b('0x2c')](handleError(_0x2911fb,null));};exports['getChatInteractions']=function(_0x48a4f9,_0x40a651,_0x515077){var _0x806371={};var _0x988740={};var _0x109907;var _0x14bff9;return db[_0x359b('0x48')][_0x359b('0xb7')]({'where':{'id':_0x48a4f9[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x40a651,null))[_0x359b('0x22')](function(_0x56436b){if(_0x56436b){_0x109907=_0x56436b;_0x988740[_0x359b('0x4d')]=_[_0x359b('0x64')](db[_0x359b('0xc7')][_0x359b('0x49')]);_0x988740[_0x359b('0x50')]=_['keys'](_0x48a4f9[_0x359b('0x50')]);_0x988740[_0x359b('0x51')]=_[_0x359b('0x52')](_0x988740[_0x359b('0x4d')],_0x988740['query']);_0x806371[_0x359b('0x53')]=_['intersection'](_0x988740['model'],qs[_0x359b('0x54')](_0x48a4f9['query'][_0x359b('0x54')]));_0x806371[_0x359b('0x53')]=_0x806371['attributes']['length']?_0x806371['attributes']:_0x988740[_0x359b('0x4d')];_0x806371[_0x359b('0x57')]=qs['sort'](_0x48a4f9['query'][_0x359b('0x58')]);_0x806371['where']=qs[_0x359b('0x51')](_[_0x359b('0xb9')](_0x48a4f9[_0x359b('0x50')],_0x988740[_0x359b('0x51')]));if(_0x48a4f9['query'][_0x359b('0x3d')]){_0x806371['where']=_[_0x359b('0x5a')](_0x806371[_0x359b('0x59')],{'$or':_['map'](_0x806371[_0x359b('0x53')],function(_0x20fc4b){var _0x4d19fe={};_0x4d19fe[_0x20fc4b]={'$like':'%'+_0x48a4f9[_0x359b('0x50')]['filter']+'%'};return _0x4d19fe;})});}_0x806371=_[_0x359b('0x5a')]({},_0x806371,_0x48a4f9[_0x359b('0x5e')]);return _0x109907[_0x359b('0xc8')](_0x806371);}})[_0x359b('0x22')](function(_0x1989b2){if(_0x1989b2){_0x14bff9=_0x1989b2[_0x359b('0x66')];if(!_0x48a4f9['query'][_0x359b('0x55')](_0x359b('0x56'))){_0x806371['limit']=qs[_0x359b('0x33')](_0x48a4f9[_0x359b('0x50')][_0x359b('0x33')]);_0x806371[_0x359b('0x32')]=qs[_0x359b('0x32')](_0x48a4f9['query'][_0x359b('0x32')]);}return _0x109907[_0x359b('0xc8')](_0x806371);}})[_0x359b('0x22')](function(_0x3067b1){if(_0x3067b1){return _0x3067b1?{'count':_0x14bff9,'rows':_0x3067b1}:null;}})[_0x359b('0x22')](respondWithResult(_0x40a651,null))[_0x359b('0x2c')](handleError(_0x40a651,null));};exports[_0x359b('0xc9')]=function(_0x46537b,_0x4c81f8,_0x502b71){var _0x236593={};var _0x463133={};var _0x318807;var _0x122222;return db[_0x359b('0x48')][_0x359b('0xb7')]({'where':{'id':_0x46537b[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x4c81f8,null))[_0x359b('0x22')](function(_0xb7623f){if(_0xb7623f){_0x318807=_0xb7623f;_0x463133[_0x359b('0x4d')]=_[_0x359b('0x64')](db[_0x359b('0xca')][_0x359b('0x49')]);_0x463133[_0x359b('0x50')]=_[_0x359b('0x64')](_0x46537b[_0x359b('0x50')]);_0x463133['filters']=_[_0x359b('0x52')](_0x463133[_0x359b('0x4d')],_0x463133['query']);_0x236593[_0x359b('0x53')]=_[_0x359b('0x52')](_0x463133[_0x359b('0x4d')],qs['fields'](_0x46537b[_0x359b('0x50')][_0x359b('0x54')]));_0x236593['attributes']=_0x236593['attributes'][_0x359b('0x66')]?_0x236593['attributes']:_0x463133[_0x359b('0x4d')];_0x236593[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x46537b[_0x359b('0x50')]['sort']);_0x236593[_0x359b('0x59')]=qs[_0x359b('0x51')](_[_0x359b('0xb9')](_0x46537b['query'],_0x463133[_0x359b('0x51')]));if(_0x46537b[_0x359b('0x50')][_0x359b('0x3d')]){_0x236593[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x236593[_0x359b('0x59')],{'$or':_[_0x359b('0x3f')](_0x236593[_0x359b('0x53')],function(_0x1bd43d){var _0x6eee78={};_0x6eee78[_0x1bd43d]={'$like':'%'+_0x46537b[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x6eee78;})});}_0x236593=_[_0x359b('0x5a')]({},_0x236593,_0x46537b[_0x359b('0x5e')]);return _0x318807[_0x359b('0xc9')](_0x236593);}})[_0x359b('0x22')](function(_0xd2e9bc){if(_0xd2e9bc){_0x122222=_0xd2e9bc[_0x359b('0x66')];if(!_0x46537b[_0x359b('0x50')][_0x359b('0x55')](_0x359b('0x56'))){_0x236593[_0x359b('0x33')]=qs[_0x359b('0x33')](_0x46537b[_0x359b('0x50')][_0x359b('0x33')]);_0x236593[_0x359b('0x32')]=qs[_0x359b('0x32')](_0x46537b['query'][_0x359b('0x32')]);}return _0x318807[_0x359b('0xc9')](_0x236593);}})['then'](function(_0x3bea97){if(_0x3bea97){return _0x3bea97?{'count':_0x122222,'rows':_0x3bea97}:null;}})[_0x359b('0x22')](respondWithResult(_0x4c81f8,null))['catch'](handleError(_0x4c81f8,null));};exports[_0x359b('0xcb')]=function(_0x193bb3,_0x580728,_0x12d5d8){var _0xc4c8e0={'raw':!![],'where':{}};var _0x5388d7={};var _0x5dabfb={'count':0x0,'rows':[]};return db[_0x359b('0x48')]['findOne']({'where':{'id':_0x193bb3[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x580728,null))[_0x359b('0x22')](function(_0x538746){if(_0x538746){_0x5388d7[_0x359b('0x4d')]=_[_0x359b('0x64')](db['MailInteraction'][_0x359b('0x49')]);_0x5388d7['query']=_[_0x359b('0x64')](_0x193bb3[_0x359b('0x50')]);_0x5388d7[_0x359b('0x51')]=_['intersection'](_0x5388d7[_0x359b('0x4d')],_0x5388d7[_0x359b('0x50')]);_0xc4c8e0[_0x359b('0x53')]=_['intersection'](_0x5388d7['model'],qs[_0x359b('0x54')](_0x193bb3['query'][_0x359b('0x54')]));_0xc4c8e0[_0x359b('0x53')]=_0xc4c8e0[_0x359b('0x53')][_0x359b('0x66')]?_0xc4c8e0[_0x359b('0x53')]:_0x5388d7[_0x359b('0x4d')];if(!_0x193bb3[_0x359b('0x50')]['hasOwnProperty'](_0x359b('0x56'))){_0xc4c8e0[_0x359b('0x33')]=qs[_0x359b('0x33')](_0x193bb3['query'][_0x359b('0x33')]);_0xc4c8e0['offset']=qs[_0x359b('0x32')](_0x193bb3[_0x359b('0x50')]['offset']);}_0xc4c8e0[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x193bb3['query']['sort']);_0xc4c8e0[_0x359b('0x59')]=qs[_0x359b('0x51')](_[_0x359b('0xb9')](_0x193bb3[_0x359b('0x50')],_0x5388d7[_0x359b('0x51')]));_0xc4c8e0[_0x359b('0x59')]['UserId']=_0x538746['id'];if(_0x193bb3[_0x359b('0x50')][_0x359b('0x3d')]){_0xc4c8e0[_0x359b('0x59')]=_[_0x359b('0x5a')](_0xc4c8e0[_0x359b('0x59')],{'$or':_['map'](_0xc4c8e0[_0x359b('0x53')],function(_0x38bd09){var _0x414150={};_0x414150[_0x38bd09]={'$like':'%'+_0x193bb3[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x414150;})});}_0xc4c8e0=_['merge']({},_0xc4c8e0,_0x193bb3[_0x359b('0x5e')]);return db[_0x359b('0xcc')]['count']({'where':_0xc4c8e0[_0x359b('0x59')]})[_0x359b('0x22')](function(_0x51e365){_0x5dabfb['count']=_0x51e365;if(_0x193bb3[_0x359b('0x50')][_0x359b('0x5f')]){_0xc4c8e0['include']=[{'all':!![]}];}return db[_0x359b('0xcc')][_0x359b('0xa3')](_0xc4c8e0);})[_0x359b('0x22')](function(_0x375f00){_0x5dabfb[_0x359b('0x61')]=_0x375f00;return _0x5dabfb;});}})[_0x359b('0x22')](respondWithFilteredResult(_0x580728,_0xc4c8e0))[_0x359b('0x2c')](handleError(_0x580728,null));};exports['getSmsInteractions']=function(_0x43974c,_0x34bacc,_0x5ead08){var _0x3234bc={};var _0x2c9af4={};var _0x3452a6;var _0x5a9a1e;return db[_0x359b('0x48')]['findOne']({'where':{'id':_0x43974c['params']['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x34bacc,null))[_0x359b('0x22')](function(_0x4721e5){if(_0x4721e5){_0x3452a6=_0x4721e5;_0x2c9af4[_0x359b('0x4d')]=_[_0x359b('0x64')](db['SmsInteraction']['rawAttributes']);_0x2c9af4['query']=_[_0x359b('0x64')](_0x43974c[_0x359b('0x50')]);_0x2c9af4['filters']=_[_0x359b('0x52')](_0x2c9af4[_0x359b('0x4d')],_0x2c9af4[_0x359b('0x50')]);_0x3234bc[_0x359b('0x53')]=_['intersection'](_0x2c9af4[_0x359b('0x4d')],qs[_0x359b('0x54')](_0x43974c[_0x359b('0x50')]['fields']));_0x3234bc[_0x359b('0x53')]=_0x3234bc['attributes'][_0x359b('0x66')]?_0x3234bc[_0x359b('0x53')]:_0x2c9af4[_0x359b('0x4d')];_0x3234bc[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x43974c['query'][_0x359b('0x58')]);_0x3234bc[_0x359b('0x59')]=qs[_0x359b('0x51')](_['pick'](_0x43974c['query'],_0x2c9af4[_0x359b('0x51')]));if(_0x43974c[_0x359b('0x50')][_0x359b('0x3d')]){_0x3234bc[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x3234bc['where'],{'$or':_[_0x359b('0x3f')](_0x3234bc[_0x359b('0x53')],function(_0x20b8dc){var _0x218854={};_0x218854[_0x20b8dc]={'$like':'%'+_0x43974c[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x218854;})});}_0x3234bc=_[_0x359b('0x5a')]({},_0x3234bc,_0x43974c[_0x359b('0x5e')]);return _0x3452a6[_0x359b('0xcd')](_0x3234bc);}})[_0x359b('0x22')](function(_0x583a62){if(_0x583a62){_0x5a9a1e=_0x583a62[_0x359b('0x66')];if(!_0x43974c['query'][_0x359b('0x55')]('nolimit')){_0x3234bc[_0x359b('0x33')]=qs[_0x359b('0x33')](_0x43974c[_0x359b('0x50')]['limit']);_0x3234bc[_0x359b('0x32')]=qs[_0x359b('0x32')](_0x43974c[_0x359b('0x50')][_0x359b('0x32')]);}return _0x3452a6['getSmsInteractions'](_0x3234bc);}})['then'](function(_0x137ed0){if(_0x137ed0){return _0x137ed0?{'count':_0x5a9a1e,'rows':_0x137ed0}:null;}})[_0x359b('0x22')](respondWithResult(_0x34bacc,null))['catch'](handleError(_0x34bacc,null));};exports[_0x359b('0xce')]=function(_0x5c038e,_0x7dd696,_0x1025ee){var _0x330e5c={};var _0x4b1338={};var _0x52d754;var _0x341613;return db[_0x359b('0x48')]['findOne']({'where':{'id':_0x5c038e[_0x359b('0x63')]['id']}})['then'](handleEntityNotFound(_0x7dd696,null))[_0x359b('0x22')](function(_0x15def4){if(_0x15def4){_0x52d754=_0x15def4;_0x4b1338[_0x359b('0x4d')]=_['keys'](db[_0x359b('0xcf')][_0x359b('0x49')]);_0x4b1338['query']=_[_0x359b('0x64')](_0x5c038e[_0x359b('0x50')]);_0x4b1338[_0x359b('0x51')]=_[_0x359b('0x52')](_0x4b1338[_0x359b('0x4d')],_0x4b1338[_0x359b('0x50')]);_0x330e5c[_0x359b('0x53')]=_[_0x359b('0x52')](_0x4b1338[_0x359b('0x4d')],qs['fields'](_0x5c038e[_0x359b('0x50')][_0x359b('0x54')]));_0x330e5c['attributes']=_0x330e5c['attributes'][_0x359b('0x66')]?_0x330e5c[_0x359b('0x53')]:_0x4b1338['model'];_0x330e5c[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x5c038e['query'][_0x359b('0x58')]);_0x330e5c['where']=qs[_0x359b('0x51')](_[_0x359b('0xb9')](_0x5c038e[_0x359b('0x50')],_0x4b1338[_0x359b('0x51')]));if(_0x5c038e[_0x359b('0x50')][_0x359b('0x3d')]){_0x330e5c[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x330e5c[_0x359b('0x59')],{'$or':_[_0x359b('0x3f')](_0x330e5c['attributes'],function(_0xe7fc69){var _0x240d67={};_0x240d67[_0xe7fc69]={'$like':'%'+_0x5c038e['query'][_0x359b('0x3d')]+'%'};return _0x240d67;})});}_0x330e5c=_[_0x359b('0x5a')]({},_0x330e5c,_0x5c038e[_0x359b('0x5e')]);return _0x52d754[_0x359b('0xce')](_0x330e5c);}})['then'](function(_0x24d1c9){if(_0x24d1c9){_0x341613=_0x24d1c9[_0x359b('0x66')];if(!_0x5c038e['query']['hasOwnProperty']('nolimit')){_0x330e5c['limit']=qs[_0x359b('0x33')](_0x5c038e[_0x359b('0x50')][_0x359b('0x33')]);_0x330e5c[_0x359b('0x32')]=qs[_0x359b('0x32')](_0x5c038e[_0x359b('0x50')][_0x359b('0x32')]);}return _0x52d754[_0x359b('0xce')](_0x330e5c);}})[_0x359b('0x22')](function(_0x4d7c8a){if(_0x4d7c8a){return _0x4d7c8a?{'count':_0x341613,'rows':_0x4d7c8a}:null;}})[_0x359b('0x22')](respondWithResult(_0x7dd696,null))['catch'](handleError(_0x7dd696,null));};exports[_0x359b('0xd0')]=function(_0x1af573,_0x18674e,_0x21e82f){var _0x52ed39={};var _0xa6ca65={};var _0x3942fa;var _0x120dc;return db['User'][_0x359b('0xb7')]({'where':{'id':_0x1af573['params']['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x18674e,null))['then'](function(_0x2ffabd){if(_0x2ffabd){_0x3942fa=_0x2ffabd;_0xa6ca65[_0x359b('0x4d')]=_[_0x359b('0x64')](db[_0x359b('0xd1')][_0x359b('0x49')]);_0xa6ca65[_0x359b('0x50')]=_[_0x359b('0x64')](_0x1af573[_0x359b('0x50')]);_0xa6ca65[_0x359b('0x51')]=_[_0x359b('0x52')](_0xa6ca65[_0x359b('0x4d')],_0xa6ca65[_0x359b('0x50')]);_0x52ed39['attributes']=_[_0x359b('0x52')](_0xa6ca65[_0x359b('0x4d')],qs[_0x359b('0x54')](_0x1af573[_0x359b('0x50')][_0x359b('0x54')]));_0x52ed39[_0x359b('0x53')]=_0x52ed39['attributes'][_0x359b('0x66')]?_0x52ed39['attributes']:_0xa6ca65['model'];_0x52ed39[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x1af573[_0x359b('0x50')][_0x359b('0x58')]);_0x52ed39[_0x359b('0x59')]=qs['filters'](_[_0x359b('0xb9')](_0x1af573[_0x359b('0x50')],_0xa6ca65[_0x359b('0x51')]));if(_0x1af573[_0x359b('0x50')][_0x359b('0x3d')]){_0x52ed39['where']=_[_0x359b('0x5a')](_0x52ed39[_0x359b('0x59')],{'$or':_[_0x359b('0x3f')](_0x52ed39[_0x359b('0x53')],function(_0x6b2bbf){var _0x3729bc={};_0x3729bc[_0x6b2bbf]={'$like':'%'+_0x1af573[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x3729bc;})});}_0x52ed39=_['merge']({},_0x52ed39,_0x1af573[_0x359b('0x5e')]);return _0x3942fa[_0x359b('0xd0')](_0x52ed39);}})['then'](function(_0x1bbe04){if(_0x1bbe04){_0x120dc=_0x1bbe04[_0x359b('0x66')];if(!_0x1af573['query'][_0x359b('0x55')](_0x359b('0x56'))){_0x52ed39['limit']=qs[_0x359b('0x33')](_0x1af573[_0x359b('0x50')][_0x359b('0x33')]);_0x52ed39[_0x359b('0x32')]=qs[_0x359b('0x32')](_0x1af573['query'][_0x359b('0x32')]);}return _0x3942fa['getWhatsappInteractions'](_0x52ed39);}})['then'](function(_0x34fa39){if(_0x34fa39){return _0x34fa39?{'count':_0x120dc,'rows':_0x34fa39}:null;}})[_0x359b('0x22')](respondWithResult(_0x18674e,null))[_0x359b('0x2c')](handleError(_0x18674e,null));};exports[_0x359b('0xd2')]=function(_0x58ebd1,_0x130d7f,_0x2b2a6d){var _0x519387;var _0x46fff8;var _0x3a98ee;var _0x1f6efb=!_[_0x359b('0x77')](_0x58ebd1[_0x359b('0x63')]['id'])?_0x58ebd1[_0x359b('0x63')]['id']:!_[_0x359b('0x77')](_0x58ebd1[_0x359b('0x3a')]['id'])?_0x58ebd1[_0x359b('0x3a')]['id']:null;return db[_0x359b('0x48')][_0x359b('0x43')]({'where':{'id':_0x1f6efb,'role':{'$or':['admin','user',_0x359b('0x6c')]}},'attributes':['id',_0x359b('0x44'),_0x359b('0xd3'),'mobile','role','internal','loginInPause']})['then'](function(_0x209b67){if(_0x209b67){if(_0x209b67[_0x359b('0x42')]==='agent'){_0x519387=_0x209b67;if(_0x58ebd1[_0x359b('0x68')]['interface']){_0x3a98ee=util[_0x359b('0x6f')](_0x359b('0xd4'),_0x519387[_0x58ebd1[_0x359b('0x68')][_0x359b('0xa6')]]);}else if(_0x58ebd1[_0x359b('0x68')][_0x359b('0xd5')]){_0x3a98ee=util[_0x359b('0x6f')](_0x359b('0xa5'),_0x58ebd1[_0x359b('0x68')]['intrf']);}else{_0x3a98ee=util[_0x359b('0x6f')](_0x359b('0xa5'),_0x519387[_0x359b('0x44')]);}socket['to'](util[_0x359b('0x6f')](_0x359b('0xd6'),_0x519387[_0x359b('0x44')]))[_0x359b('0xa1')](_0x359b('0xd7'),{'ip':_0x58ebd1[_0x359b('0xd8')][_0x359b('0xd9')]||_0x58ebd1[_0x359b('0xda')][_0x359b('0xdb')]||_0x58ebd1[_0x359b('0xdc')][_0x359b('0xdb')]||_0x58ebd1[_0x359b('0xda')][_0x359b('0xdc')][_0x359b('0xdb')]});return db['UserVoiceQueueRt'][_0x359b('0x37')]({'where':{'membername':_0x519387['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x359b('0x1f'))](_0x359b('0xdd'));}})[_0x359b('0x22')](function(){if(_0x519387){return _0x519387['getVoiceQueues']({'raw':!![]});}})['then'](function(_0xdcf3e3){if(_0x519387){var _0x337c79=[];if(_0xdcf3e3){_0x46fff8=_0xdcf3e3;if(_0x46fff8[_0x359b('0x66')]){for(var _0x101162=0x0;_0x101162<_0x46fff8['length'];_0x101162++){_0x337c79[_0x359b('0xde')]({'membername':_0x519387[_0x359b('0x44')],'UserId':_0x519387['id'],'queue_name':_0x46fff8[_0x101162]['name'],'VoiceQueueId':_0x46fff8[_0x101162]['id'],'interface':_0x3a98ee,'paused':_0x519387[_0x359b('0x98')]||![],'penalty':_0x46fff8[_0x101162]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x337c79,function(_0x714249){return db[_0x359b('0xab')]['upsert'](_0x714249);});}}}})[_0x359b('0x22')](function(){if(_0x519387){return db[_0x359b('0xdf')][_0x359b('0xa3')]({'where':{'membername':_0x519387[_0x359b('0x44')],'exitAt':null}});}})[_0x359b('0x22')](function(_0x30e943){if(_0x519387){var _0x9da148=[];_0x30e943[_0x359b('0xe0')](function(_0x1b6cc0){_0x9da148[_0x359b('0xde')](_0x1b6cc0['update']({'exitAt':moment()[_0x359b('0x6f')](_0x359b('0xe1'))}));});return BPromise['all'](_0x9da148);}})['then'](function(){if(_0x519387){var _0x245e6b=[];var _0x1870f1=[];var _0x296c2f=utils[_0x359b('0xe2')]();var _0xc6be73={'membername':_0x519387['name'],'interface':_0x3a98ee,'enterAt':moment()['format'](_0x359b('0xe1')),'role':_0x519387[_0x359b('0x42')],'internal':_0x519387[_0x359b('0x71')]};_0x296c2f['forEach'](function(_0x3b0198){_0x245e6b[_0x359b('0xde')](_['merge']({'channel':_0x3b0198,'type':_0x359b('0xe3'),'data1':_0x58ebd1[_0x359b('0x68')]['device'],'data2':_0x3a98ee},_0xc6be73));if(_0x519387['loginInPause']){_0x1870f1[_0x359b('0xde')](_[_0x359b('0x5a')]({'channel':_0x3b0198,'type':_0x359b('0xe4'),'data1':_0x359b('0xe5')},_0xc6be73));}});return db[_0x359b('0xdf')][_0x359b('0x67')](_0x245e6b[_0x359b('0xe6')](_0x1870f1),{'individualHooks':!![]});}})['then'](function(){if(_0x519387){return _0x519387[_0x359b('0xe7')]({'online':!![],'lastLoginAt':moment()[_0x359b('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x519387[_0x359b('0x98')]||![],'mailPause':_0x519387[_0x359b('0x98')]||![],'chatPause':_0x519387[_0x359b('0x98')]||![],'faxPause':_0x519387[_0x359b('0x98')]||![],'smsPause':_0x519387[_0x359b('0x98')]||![],'openchannelPause':_0x519387['loginInPause']||![],'whatsappPause':_0x519387['loginInPause']||![],'pauseType':_0x519387[_0x359b('0x98')]?'LOGININPAUSE':null,'interface':_0x3a98ee,'lastPauseAt':moment()[_0x359b('0x6f')](_0x359b('0xe1'))});}})[_0x359b('0x22')](function(_0x48acd5){if(_0x58ebd1[_0x359b('0xe8')]){return _0x2b2a6d();}else{return BPromise[_0x359b('0xe9')](_0x48acd5)[_0x359b('0x22')](respondWithResult(_0x130d7f,null));}})[_0x359b('0x2c')](handleError(_0x130d7f,null));};exports[_0x359b('0xea')]=function(_0x3c1101,_0x3d178f,_0x1edaae){var _0x16a4c5;return db[_0x359b('0x48')]['find']({'where':{'id':_0x3c1101['params']['id'],'role':_0x359b('0x6c')},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x3d178f,null))[_0x359b('0x22')](function(_0x2a3121){if(_0x2a3121){_0x16a4c5=_0x2a3121;return db[_0x359b('0xab')][_0x359b('0x37')]({'where':{'membername':_0x16a4c5['name']},'individualHooks':!![]});}})[_0x359b('0x22')](function(){return db[_0x359b('0xdf')][_0x359b('0xa3')]({'where':{'membername':_0x16a4c5['name'],'exitAt':null}});})[_0x359b('0x22')](function(_0x1cadbc){var _0x2d28c8=[];_0x1cadbc[_0x359b('0xe0')](function(_0x2f94d1){_0x2d28c8[_0x359b('0xde')](_0x2f94d1[_0x359b('0xe7')]({'exitAt':moment()[_0x359b('0x6f')](_0x359b('0xe1'))}));});return BPromise[_0x359b('0xeb')](_0x2d28c8);})[_0x359b('0x22')](function(){return _0x16a4c5[_0x359b('0xe7')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x3d178f,null))[_0x359b('0x2c')](handleError(_0x3d178f,null));};exports[_0x359b('0xec')]=function(_0x53016b,_0xf5e774,_0x3a37d1){var _0x1dc8f3;return db[_0x359b('0xab')]['update']({'paused':0x1},{'where':{'UserId':_0x53016b[_0x359b('0x63')]['id']},'individualHooks':!![]})[_0x359b('0x22')](function(){return db['User'][_0x359b('0x43')]({'where':{'id':_0x53016b[_0x359b('0x63')]['id'],'role':'agent'},'attributes':['id','name',_0x359b('0x42'),'internal','interface']});})[_0x359b('0x22')](handleEntityNotFound(_0xf5e774,null))[_0x359b('0x22')](function(_0x4967fd){if(_0x4967fd){_0x1dc8f3=_0x4967fd;return respondWithRpcPromise(_0x359b('0xed'),'pause',{'id':_0x1dc8f3['id'],'name':_0x1dc8f3[_0x359b('0x44')],'pause':!![]});}})['then'](function(){if(_0x1dc8f3){return db[_0x359b('0xdf')][_0x359b('0xa3')]({'where':{'membername':_0x1dc8f3[_0x359b('0x44')],'type':_0x359b('0xe4'),'exitAt':null}});}})['then'](function(_0x3e4d8e){if(_0x3e4d8e[_0x359b('0x66')]){var _0x1dce8a=moment()['format'](_0x359b('0xe1'));for(var _0x2115ad=0x0,_0x4d6c94=_0x3e4d8e[_0x359b('0x66')];_0x2115ad<_0x4d6c94;_0x2115ad++){_0x3e4d8e[_0x2115ad][_0x359b('0xee')]({'exitAt':_0x1dce8a});}}})['then'](function(){var _0x1dbbd5=[];var _0xb4ab1=utils['getChannels']();_0xb4ab1[_0x359b('0xe0')](function(_0x369caa){_0x1dbbd5[_0x359b('0xde')]({'channel':_0x369caa,'membername':_0x1dc8f3[_0x359b('0x44')],'interface':_[_0x359b('0x77')](_0x1dc8f3[_0x359b('0xa6')])?util['format'](_0x359b('0xa5'),_0x1dc8f3[_0x359b('0x44')]):_0x1dc8f3[_0x359b('0xa6')],'type':_0x359b('0xe4'),'enterAt':moment()[_0x359b('0x6f')](_0x359b('0xe1')),'data1':_0x53016b[_0x359b('0x68')][_0x359b('0x4b')]||_0x359b('0xef'),'role':_0x1dc8f3[_0x359b('0x42')],'internal':_0x1dc8f3[_0x359b('0x71')]});});return db['MemberReport'][_0x359b('0x67')](_0x1dbbd5,{'individualHooks':!![]});})[_0x359b('0x22')](function(){return _0x1dc8f3['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x53016b[_0x359b('0x68')][_0x359b('0x4b')]||_0x359b('0xef'),'lastPauseAt':moment()[_0x359b('0x6f')](_0x359b('0xe1'))});})[_0x359b('0x22')](respondWithResult(_0xf5e774,null))[_0x359b('0x2c')](handleError(_0xf5e774,null));};exports[_0x359b('0xf0')]=function(_0x12f879,_0x3a00cd,_0x4b7793){var _0x3ec7e8;return db[_0x359b('0x48')][_0x359b('0x43')]({'where':{'id':_0x12f879[_0x359b('0x63')]['id']},'attributes':['id',_0x359b('0x44'),'role',_0x359b('0x99'),_0x359b('0xf1'),_0x359b('0xf2'),'faxPause','openchannelPause',_0x359b('0xf3'),_0x359b('0xf4'),_0x359b('0xf5'),_0x359b('0xf6')]})[_0x359b('0x22')](handleEntityNotFound(_0x3a00cd,null))['then'](function(_0x5b4732){if(_0x5b4732){_0x3ec7e8=_0x5b4732;if(_0x12f879[_0x359b('0x68')][_0x359b('0x96')]&&!utils['isValidChannel'](_0x12f879[_0x359b('0x68')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x359b('0x9b'));}switch(_0x12f879[_0x359b('0x68')][_0x359b('0x96')]){case _0x359b('0xa4'):return respondWithRpcPromise('QueuePause',_0x359b('0xf0'),{'id':_0x3ec7e8['id'],'name':_0x3ec7e8[_0x359b('0x44')],'pause':![]})[_0x359b('0x22')](function(){return db[_0x359b('0xab')][_0x359b('0xe7')]({'paused':0x0},{'where':{'UserId':_0x3ec7e8['id']},'individualHooks':!![]});})[_0x359b('0x22')](function(){return db[_0x359b('0xdf')][_0x359b('0x43')]({'where':{'channel':_0x12f879['body'][_0x359b('0x96')],'membername':_0x3ec7e8['name'],'type':'PAUSE','exitAt':null}});})['then'](function(_0x495f1a){if(_0x495f1a){return _0x495f1a[_0x359b('0xe7')]({'exitAt':moment()['format'](_0x359b('0xe1')),'data2':_0x359b('0xf7')},{'individualHooks':!![]});}return null;})[_0x359b('0x22')](function(){return _0x3ec7e8['update']({'voicePause':![]});});case _0x359b('0xf8'):case'chat':case _0x359b('0xf9'):case _0x359b('0xfa'):case _0x359b('0xfb'):case _0x359b('0xfc'):return db[_0x359b('0xdf')][_0x359b('0x43')]({'where':{'channel':_0x12f879[_0x359b('0x68')][_0x359b('0x96')],'membername':_0x3ec7e8[_0x359b('0x44')],'type':_0x359b('0xe4'),'exitAt':null}})[_0x359b('0x22')](function(_0x31f7fd){if(_0x31f7fd){return _0x31f7fd[_0x359b('0xe7')]({'exitAt':moment()[_0x359b('0x6f')](_0x359b('0xe1')),'data2':_0x359b('0xf7')},{'individualHooks':!![]});}return null;})[_0x359b('0x22')](function(){var _0x1fec66={};_[_0x359b('0x34')](_0x1fec66,util[_0x359b('0x6f')](_0x359b('0xfd'),_0x12f879['body']['channel'],'Pause'),![]);return _0x3ec7e8[_0x359b('0xe7')](_0x1fec66);});default:return respondWithRpcPromise('QueuePause',_0x359b('0xf0'),{'id':_0x3ec7e8['id'],'name':_0x3ec7e8[_0x359b('0x44')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x359b('0xe7')]({'paused':0x0},{'where':{'UserId':_0x3ec7e8['id']}});})['then'](function(){return db[_0x359b('0xdf')]['findAll']({'where':{'membername':_0x3ec7e8[_0x359b('0x44')],'type':_0x359b('0xe4'),'exitAt':null}});})['then'](function(_0x50bdc8){var _0x4e759b=[];_0x50bdc8[_0x359b('0xe0')](function(_0x450ac0){_0x4e759b[_0x359b('0xde')](_0x450ac0[_0x359b('0xe7')]({'exitAt':moment()[_0x359b('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x359b('0xf7')}));});return BPromise[_0x359b('0xeb')](_0x4e759b);})[_0x359b('0x22')](function(){return _0x3ec7e8[_0x359b('0xe7')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x359b('0x22')](respondWithResult(_0x3a00cd,null))[_0x359b('0x2c')](handleError(_0x3a00cd,null));};exports[_0x359b('0xfe')]=function(_0x255ade,_0x4236fd,_0x16dc8a){var _0x2f7c11={};var _0x570e32={};var _0x1d8a68;var _0xf25a35;return db[_0x359b('0x48')][_0x359b('0xb7')]({'where':{'id':_0x255ade[_0x359b('0x63')]['id']}})['then'](handleEntityNotFound(_0x4236fd,null))[_0x359b('0x22')](function(_0x5678dd){if(_0x5678dd){_0x1d8a68=_0x5678dd;_0x570e32[_0x359b('0x4d')]=_[_0x359b('0x64')](db['Team'][_0x359b('0x49')]);_0x570e32['query']=_[_0x359b('0x64')](_0x255ade[_0x359b('0x50')]);_0x570e32['filters']=_[_0x359b('0x52')](_0x570e32[_0x359b('0x4d')],_0x570e32[_0x359b('0x50')]);_0x2f7c11[_0x359b('0x53')]=_[_0x359b('0x52')](_0x570e32['model'],qs[_0x359b('0x54')](_0x255ade[_0x359b('0x50')][_0x359b('0x54')]));_0x2f7c11[_0x359b('0x53')]=_0x2f7c11[_0x359b('0x53')][_0x359b('0x66')]?_0x2f7c11[_0x359b('0x53')]:_0x570e32[_0x359b('0x4d')];_0x2f7c11[_0x359b('0x57')]=qs[_0x359b('0x58')](_0x255ade[_0x359b('0x50')][_0x359b('0x58')]);_0x2f7c11[_0x359b('0x59')]=qs['filters'](_['pick'](_0x255ade[_0x359b('0x50')],_0x570e32[_0x359b('0x51')]));if(_0x255ade[_0x359b('0x50')][_0x359b('0x3d')]){_0x2f7c11[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x2f7c11[_0x359b('0x59')],{'$or':_[_0x359b('0x3f')](_0x2f7c11[_0x359b('0x53')],function(_0xdf4128){var _0x1724b2={};_0x1724b2[_0xdf4128]={'$like':'%'+_0x255ade[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x1724b2;})});}_0x2f7c11=_[_0x359b('0x5a')]({},_0x2f7c11,_0x255ade[_0x359b('0x5e')]);return _0x1d8a68[_0x359b('0xfe')](_0x2f7c11);}})[_0x359b('0x22')](function(_0x5f4f85){if(_0x5f4f85){_0xf25a35=_0x5f4f85[_0x359b('0x66')];if(!_0x255ade[_0x359b('0x50')]['hasOwnProperty'](_0x359b('0x56'))){_0x2f7c11[_0x359b('0x33')]=qs[_0x359b('0x33')](_0x255ade[_0x359b('0x50')]['limit']);_0x2f7c11['offset']=qs['offset'](_0x255ade[_0x359b('0x50')]['offset']);}return _0x1d8a68[_0x359b('0xfe')](_0x2f7c11);}})[_0x359b('0x22')](function(_0x31d8a6){if(_0x31d8a6){return _0x31d8a6?{'count':_0xf25a35,'rows':_0x31d8a6}:null;}})[_0x359b('0x22')](respondWithResult(_0x4236fd,null))['catch'](handleError(_0x4236fd,null));};exports[_0x359b('0xff')]=function(_0x53e941,_0x39da40){return db['User'][_0x359b('0x43')]({'where':{'id':_0x53e941[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x39da40,null))[_0x359b('0x22')](function(_0x6e8c1b){if(_0x6e8c1b){var _0x45e517=_0x6e8c1b[_0x359b('0x38')]({'plain':!![]});return _0x6e8c1b[_0x359b('0xff')](_0x53e941['body']['ids'],_['omit'](_0x53e941['body'],['ids','id'])||{})[_0x359b('0x22')](function(){for(var _0xb4a895=0x0;_0xb4a895<_0x53e941[_0x359b('0x68')][_0x359b('0x6b')][_0x359b('0x66')];_0xb4a895++){var _0x38ab8e=[];db[_0x359b('0x100')][_0x359b('0xb7')]({'where':{'id':_0x53e941[_0x359b('0x68')][_0x359b('0x6b')][_0xb4a895]}})[_0x359b('0x22')](function(_0x30c9aa){_0x38ab8e['push'](_0x30c9aa[_0x359b('0x101')]()[_0x359b('0x22')](function(_0x55df21){for(var _0x3f8698=0x0;_0x3f8698<_0x55df21['length'];_0x3f8698++){_0x55df21[_0x3f8698][_0x359b('0x102')](_0x359b('0x96'),_0x359b('0x103'));}return _0x55df21;}));_0x38ab8e[_0x359b('0xde')](_0x30c9aa[_0x359b('0x104')]()['then'](function(_0x120840){for(var _0x570986=0x0;_0x570986<_0x120840['length'];_0x570986++){_0x120840[_0x570986][_0x359b('0x102')]('channel',_0x359b('0x105'));}return _0x120840;}));_0x38ab8e[_0x359b('0xde')](_0x30c9aa['getMailQueues']()[_0x359b('0x22')](function(_0x1a6dd7){for(var _0x265174=0x0;_0x265174<_0x1a6dd7[_0x359b('0x66')];_0x265174++){_0x1a6dd7[_0x265174][_0x359b('0x102')](_0x359b('0x96'),_0x359b('0x106'));}return _0x1a6dd7;}));_0x38ab8e['push'](_0x30c9aa[_0x359b('0x107')]()['then'](function(_0x10b607){for(var _0x4b9ea4=0x0;_0x4b9ea4<_0x10b607[_0x359b('0x66')];_0x4b9ea4++){_0x10b607[_0x4b9ea4][_0x359b('0x102')](_0x359b('0x96'),'Sms');}return _0x10b607;}));_0x38ab8e[_0x359b('0xde')](_0x30c9aa[_0x359b('0x108')]()['then'](function(_0x2b9478){for(var _0x485c1d=0x0;_0x485c1d<_0x2b9478[_0x359b('0x66')];_0x485c1d++){_0x2b9478[_0x485c1d]['setDataValue'](_0x359b('0x96'),_0x359b('0x109'));}return _0x2b9478;}));_0x38ab8e[_0x359b('0xde')](_0x30c9aa['getFaxQueues']()[_0x359b('0x22')](function(_0xf897f7){for(var _0x582289=0x0;_0x582289<_0xf897f7[_0x359b('0x66')];_0x582289++){_0xf897f7[_0x582289]['setDataValue'](_0x359b('0x96'),'Fax');}return _0xf897f7;}));_0x38ab8e[_0x359b('0xde')](_0x30c9aa['getOpenchannelQueues']()[_0x359b('0x22')](function(_0x500b9e){for(var _0x1027bb=0x0;_0x1027bb<_0x500b9e['length'];_0x1027bb++){_0x500b9e[_0x1027bb][_0x359b('0x102')](_0x359b('0x96'),'Openchannel');}return _0x500b9e;}));return BPromise[_0x359b('0xeb')](_0x38ab8e);})[_0x359b('0x22')](function(_0x3ffb4b){var _0x4cd4f1=_[_0x359b('0x10a')](_0x3ffb4b);_0x38ab8e=[];return db[_0x359b('0x5b')]['transaction'](function(_0x5cce4b){for(var _0x3eb4f5=0x0;_0x3eb4f5<_0x4cd4f1[_0x359b('0x66')];_0x3eb4f5++){_0x38ab8e['push'](_0x4cd4f1[_0x3eb4f5][_0x359b('0x10b')](_0x45e517['id']),{'transaction':_0x5cce4b});}return BPromise[_0x359b('0xeb')](_0x38ab8e)[_0x359b('0x22')](function(){if(_0x45e517[_0x359b('0x97')]){return BPromise['each'](_['filter'](_0x4cd4f1,function(_0x5afae0){return _0x5afae0['getDataValue'](_0x359b('0x96'))===_0x359b('0x103');}),function(_0x2da3c6){return db[_0x359b('0xab')][_0x359b('0x10c')]({'membername':_0x45e517['name'],'UserId':_0x45e517['id'],'queue_name':_0x2da3c6['name'],'VoiceQueueId':_0x2da3c6['id'],'interface':_[_0x359b('0x77')](_0x45e517[_0x359b('0xa6')])?util[_0x359b('0x6f')](_0x359b('0xa5'),_0x45e517['name']):_0x45e517[_0x359b('0xa6')],'paused':_0x45e517[_0x359b('0x99')]||![],'penalty':_0x45e517[_0x359b('0x9e')]},{'transaction':_0x5cce4b});});}else{return;}})[_0x359b('0x22')](function(){for(var _0x26b072=0x0;_0x26b072<_0x4cd4f1[_0x359b('0x66')];_0x26b072++){var _0x58fc1e=_0x4cd4f1[_0x26b072]['getDataValue'](_0x359b('0x96'));var _0x4ea670=_0x58fc1e+'QueueId';socket[_0x359b('0xa1')](_0x359b('0x3a')+_0x58fc1e+_0x359b('0xa2'),{'UserId':_0x45e517['id'],['queueField']:_0x4cd4f1[_0x26b072]['id']});}});});});}});}})[_0x359b('0x22')](respondWithStatusCode(_0x39da40,null))[_0x359b('0x2c')](handleError(_0x39da40,null));};exports['removeTeams']=function(_0x22a75b,_0x2d6c70){return db[_0x359b('0x48')][_0x359b('0xb7')]({'where':{'id':_0x22a75b[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x2d6c70,null))[_0x359b('0x22')](function(_0x4acde3){if(_0x4acde3){var _0x1035fd=_0x4acde3[_0x359b('0x38')]({'plain':!![]});var _0x3c1a17=_0x22a75b[_0x359b('0x50')][_0x359b('0x6b')];return _0x4acde3[_0x359b('0x10d')](_0x3c1a17)[_0x359b('0x22')](function(){for(var _0x305799=0x0;_0x305799<_0x3c1a17[_0x359b('0x66')];_0x305799++){var _0x35f4af=[];db[_0x359b('0x100')]['findOne']({'where':{'id':_0x3c1a17[_0x305799]}})['then'](function(_0x5e4739){_0x35f4af[_0x359b('0xde')](_0x5e4739['getVoiceQueues']()[_0x359b('0x22')](function(_0x3b7747){for(var _0x4ecddd=0x0;_0x4ecddd<_0x3b7747[_0x359b('0x66')];_0x4ecddd++){_0x3b7747[_0x4ecddd][_0x359b('0x102')](_0x359b('0x96'),_0x359b('0x103'));}return _0x3b7747;}));_0x35f4af[_0x359b('0xde')](_0x5e4739[_0x359b('0x104')]()['then'](function(_0x4fdf3e){for(var _0x5939d0=0x0;_0x5939d0<_0x4fdf3e[_0x359b('0x66')];_0x5939d0++){_0x4fdf3e[_0x5939d0][_0x359b('0x102')]('channel','Chat');}return _0x4fdf3e;}));_0x35f4af[_0x359b('0xde')](_0x5e4739[_0x359b('0x10e')]()[_0x359b('0x22')](function(_0x5d1078){for(var _0x3ba6a4=0x0;_0x3ba6a4<_0x5d1078['length'];_0x3ba6a4++){_0x5d1078[_0x3ba6a4]['setDataValue'](_0x359b('0x96'),_0x359b('0x106'));}return _0x5d1078;}));_0x35f4af[_0x359b('0xde')](_0x5e4739[_0x359b('0x107')]()['then'](function(_0x4a40b5){for(var _0x1ea52d=0x0;_0x1ea52d<_0x4a40b5[_0x359b('0x66')];_0x1ea52d++){_0x4a40b5[_0x1ea52d]['setDataValue'](_0x359b('0x96'),_0x359b('0x10f'));}return _0x4a40b5;}));_0x35f4af[_0x359b('0xde')](_0x5e4739[_0x359b('0x108')]()[_0x359b('0x22')](function(_0x4eacb3){for(var _0x5c9979=0x0;_0x5c9979<_0x4eacb3[_0x359b('0x66')];_0x5c9979++){_0x4eacb3[_0x5c9979][_0x359b('0x102')](_0x359b('0x96'),'Whatsapp');}return _0x4eacb3;}));_0x35f4af[_0x359b('0xde')](_0x5e4739[_0x359b('0x110')]()[_0x359b('0x22')](function(_0x589484){for(var _0x2ff386=0x0;_0x2ff386<_0x589484['length'];_0x2ff386++){_0x589484[_0x2ff386][_0x359b('0x102')](_0x359b('0x96'),_0x359b('0x111'));}return _0x589484;}));_0x35f4af[_0x359b('0xde')](_0x5e4739[_0x359b('0x112')]()[_0x359b('0x22')](function(_0x39c0f6){for(var _0x383808=0x0;_0x383808<_0x39c0f6[_0x359b('0x66')];_0x383808++){_0x39c0f6[_0x383808][_0x359b('0x102')](_0x359b('0x96'),_0x359b('0x113'));}return _0x39c0f6;}));return BPromise['all'](_0x35f4af);})['then'](function(_0x331cb0){var _0x1ce98b=_[_0x359b('0x10a')](_0x331cb0);_0x35f4af=[];return db['sequelize'][_0x359b('0x114')](function(_0x733959){for(var _0x12e619=0x0;_0x12e619<_0x1ce98b[_0x359b('0x66')];_0x12e619++){_0x35f4af['push'](_0x1ce98b[_0x12e619][_0x359b('0x115')](_0x1035fd['id']),{'transaction':_0x733959});}return BPromise['all'](_0x35f4af)[_0x359b('0x22')](function(){if(_0x1035fd[_0x359b('0x97')]){return BPromise['each'](_[_0x359b('0x3d')](_0x1ce98b,function(_0x53f15a){return _0x53f15a[_0x359b('0x116')](_0x359b('0x96'))==='Voice';}),function(_0x378bc8){return db[_0x359b('0xab')][_0x359b('0x37')]({'where':{'VoiceQueueId':_0x378bc8['id'],'UserId':_0x1035fd['id']},'transaction':_0x733959});});}else{return;}})[_0x359b('0x22')](function(){for(var _0x47ceb9=0x0;_0x47ceb9<_0x1ce98b[_0x359b('0x66')];_0x47ceb9++){var _0x44e7f6=_0x1ce98b[_0x47ceb9][_0x359b('0x116')](_0x359b('0x96'));var _0x49ed15=_0x44e7f6+_0x359b('0xaa');socket[_0x359b('0xa1')](_0x359b('0x3a')+_0x44e7f6+_0x359b('0x117'),{'UserId':_0x1035fd['id'],['queueField']:_0x1ce98b[_0x47ceb9]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x2d6c70,null))['catch'](handleError(_0x2d6c70,null));};exports[_0x359b('0x118')]=function(_0x4254fd,_0x1ca289,_0x200e40){var _0x10a69f={};var _0x5705b6={};var _0x75faf6;var _0x5d9e6c;return db[_0x359b('0x48')][_0x359b('0xb7')]({'where':{'id':_0x4254fd[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x1ca289,null))[_0x359b('0x22')](function(_0xb9b80f){if(_0xb9b80f){_0x75faf6=_0xb9b80f;_0x5705b6[_0x359b('0x4d')]=_['keys'](db[_0x359b('0x119')][_0x359b('0x49')]);_0x5705b6['query']=_['keys'](_0x4254fd['query']);_0x5705b6[_0x359b('0x51')]=_['intersection'](_0x5705b6[_0x359b('0x4d')],_0x5705b6['query']);_0x10a69f[_0x359b('0x53')]=_[_0x359b('0x52')](_0x5705b6[_0x359b('0x4d')],qs[_0x359b('0x54')](_0x4254fd[_0x359b('0x50')]['fields']));_0x10a69f[_0x359b('0x53')]=_0x10a69f[_0x359b('0x53')][_0x359b('0x66')]?_0x10a69f['attributes']:_0x5705b6[_0x359b('0x4d')];_0x10a69f['order']=qs['sort'](_0x4254fd[_0x359b('0x50')][_0x359b('0x58')]);_0x10a69f[_0x359b('0x59')]=qs[_0x359b('0x51')](_[_0x359b('0xb9')](_0x4254fd[_0x359b('0x50')],_0x5705b6[_0x359b('0x51')]));if(_0x4254fd[_0x359b('0x50')][_0x359b('0x3d')]){_0x10a69f[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x10a69f['where'],{'$or':_[_0x359b('0x3f')](_0x10a69f[_0x359b('0x53')],function(_0x307574){var _0x1deeb4={};_0x1deeb4[_0x307574]={'$like':'%'+_0x4254fd[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x1deeb4;})});}_0x10a69f=_['merge']({},_0x10a69f,_0x4254fd['options']);return _0x75faf6[_0x359b('0x118')](_0x10a69f);}})[_0x359b('0x22')](function(_0x4e80cb){if(_0x4e80cb){_0x5d9e6c=_0x4e80cb[_0x359b('0x66')];if(!_0x4254fd['query'][_0x359b('0x55')]('nolimit')){_0x10a69f['limit']=qs[_0x359b('0x33')](_0x4254fd['query'][_0x359b('0x33')]);_0x10a69f[_0x359b('0x32')]=qs[_0x359b('0x32')](_0x4254fd[_0x359b('0x50')][_0x359b('0x32')]);}return _0x75faf6[_0x359b('0x118')](_0x10a69f);}})[_0x359b('0x22')](function(_0x5c3a09){if(_0x5c3a09){return _0x5c3a09?{'count':_0x5d9e6c,'rows':_0x5c3a09}:null;}})[_0x359b('0x22')](respondWithResult(_0x1ca289,null))['catch'](handleError(_0x1ca289,null));};exports[_0x359b('0x11a')]=function(_0x287bc9,_0x5d8c83,_0x49cb73){var _0x13f0f2={};var _0x1fda53={};var _0x4433c7;var _0x336966;return db['User'][_0x359b('0xb7')]({'where':{'id':_0x287bc9[_0x359b('0x63')]['id']}})[_0x359b('0x22')](handleEntityNotFound(_0x5d8c83,null))['then'](function(_0xff8a54){if(_0xff8a54){_0x4433c7=_0xff8a54;_0x1fda53[_0x359b('0x4d')]=_[_0x359b('0x64')](db[_0x359b('0x48')][_0x359b('0x49')]);_0x1fda53[_0x359b('0x50')]=_[_0x359b('0x64')](_0x287bc9[_0x359b('0x50')]);_0x1fda53['filters']=_[_0x359b('0x52')](_0x1fda53['model'],_0x1fda53[_0x359b('0x50')]);_0x13f0f2[_0x359b('0x53')]=_[_0x359b('0x52')](_0x1fda53[_0x359b('0x4d')],qs[_0x359b('0x54')](_0x287bc9[_0x359b('0x50')][_0x359b('0x54')]));_0x13f0f2[_0x359b('0x53')]=_0x13f0f2['attributes'][_0x359b('0x66')]?_0x13f0f2['attributes']:_0x1fda53[_0x359b('0x4d')];_0x13f0f2['order']=qs[_0x359b('0x58')](_0x287bc9[_0x359b('0x50')][_0x359b('0x58')]);_0x13f0f2[_0x359b('0x59')]=qs[_0x359b('0x51')](_[_0x359b('0xb9')](_0x287bc9[_0x359b('0x50')],_0x1fda53['filters']));if(_0x287bc9[_0x359b('0x50')][_0x359b('0x3d')]){_0x13f0f2[_0x359b('0x59')]=_[_0x359b('0x5a')](_0x13f0f2[_0x359b('0x59')],{'$or':_[_0x359b('0x3f')](_0x13f0f2[_0x359b('0x53')],function(_0x4feeca){var _0x4c28d3={};_0x4c28d3[_0x4feeca]={'$like':'%'+_0x287bc9[_0x359b('0x50')][_0x359b('0x3d')]+'%'};return _0x4c28d3;})});}_0x13f0f2[_0x359b('0x4d')]=db[_0x359b('0x48')];_0x13f0f2['as']=_0x359b('0x8c');_0x13f0f2=_[_0x359b('0x5a')]({},_0x13f0f2,_0x287bc9[_0x359b('0x5e')]);return _0x4433c7[_0x359b('0x101')]({'include':[_0x13f0f2]});}})[_0x359b('0x22')](function(_0x28629a){if(_0x28629a){var _0xecc4ef={},_0x126deb=[],_0x24d050=0x0;for(var _0x4f90c2=0x0;_0x4f90c2<_0x28629a[_0x359b('0x66')];_0x4f90c2+=0x1){for(var _0x195dfa=0x0,_0x4772ea;_0x195dfa<_0x28629a[_0x4f90c2][_0x359b('0x8c')][_0x359b('0x66')];_0x195dfa+=0x1){_0x4772ea=_0x28629a[_0x4f90c2][_0x359b('0x8c')][_0x195dfa][_0x359b('0x38')]({'plain':!![]});_0xecc4ef[_0x4772ea['id']]=_0x4772ea;}}_0xecc4ef=_[_0x359b('0x11b')](_0xecc4ef);for(var _0x3602fd=qs[_0x359b('0x32')](_0x287bc9[_0x359b('0x50')]['offset']);_0x3602fd<_0xecc4ef[_0x359b('0x66')]&&_0x126deb[_0x359b('0x66')]=_0x1662ea){_0x38c348=_0x1662ea;_0x4fb3bb=0xc8;}else{_0x4fb3bb=0xce;}_0x8b3ba0[_0x23ff('0x2a')](_0x4fb3bb);return _0x8b3ba0['set'](_0x23ff('0x2f'),_0x379f9a+'-'+_0x38c348+'/'+_0x1662ea)['json'](_0x38591c);}return null;};}function patchUpdates(_0x5c8ce7){return function(_0x49ea48){try{jsonpatch[_0x23ff('0x30')](_0x49ea48,_0x5c8ce7,!![]);}catch(_0x5eb278){return BPromise[_0x23ff('0x31')](_0x5eb278);}return _0x49ea48['save']();};}function saveUpdates(_0x5f0559,_0x2a8e17){return function(_0x396be2){if(_0x396be2){return _0x396be2[_0x23ff('0x32')](_0x5f0559)['then'](function(_0xcb29bb){return _0xcb29bb;});}return null;};}function removeEntity(_0xfa6b2a,_0x23818f){return function(_0xd07147){if(_0xd07147){return _0xd07147[_0x23ff('0x33')]()[_0x23ff('0x20')](function(){var _0x3dce24=_0xd07147[_0x23ff('0x34')]({'plain':!![]});var _0x28b9d9=[{'name':_0x23ff('0x35'),'value':_0x23ff('0x36'),'ignore':!![]},{'name':_0x23ff('0x37'),'value':_0x23ff('0x38'),'ignore':![]},{'name':'Telephones','value':_0x23ff('0x39'),'ignore':![]}];var _0x1d73f1=_(_0x28b9d9)['filter'](_0x23ff('0x3a'))[_0x23ff('0x3b')](_0x23ff('0x3c'))[_0x23ff('0x3c')]();if(_[_0x23ff('0x3d')](_0x1d73f1,_0x3dce24['role'])){return;}var _0xa9df57=_[_0x23ff('0x3e')](_0x28b9d9,[_0x23ff('0x3c'),_0x3dce24[_0x23ff('0x3f')]])['name'];return db['UserProfileResource'][_0x23ff('0x33')]({'where':{'type':_0xa9df57,'resourceId':_0x3dce24['id']}})[_0x23ff('0x20')](function(){return _0xd07147;});})[_0x23ff('0x20')](function(){_0xfa6b2a['status'](0xcc)[_0x23ff('0x2b')]();});}};}function handleEntityNotFound(_0x461b4e,_0x455594){return function(_0x178506){if(!_0x178506){_0x461b4e[_0x23ff('0x29')](0x194);}return _0x178506;};}function handleError(_0x23e1b3,_0x40b13f){_0x40b13f=_0x40b13f||0x1f4;return function(_0x439024){logger[_0x23ff('0x23')](_0x439024['stack']);if(_0x439024[_0x23ff('0x40')]){delete _0x439024[_0x23ff('0x40')];}_0x23e1b3[_0x23ff('0x2a')](_0x40b13f)[_0x23ff('0x41')](_0x439024);};}exports[_0x23ff('0x42')]=function(_0x1a7ddc,_0x3fa8fb){var _0xfafb18={},_0x289009={},_0x33a015={'count':0x0,'rows':[]};var _0x3f65a1=_['map'](db[_0x23ff('0x43')][_0x23ff('0x44')],function(_0x36cc29){return{'name':_0x36cc29['fieldName'],'type':_0x36cc29[_0x23ff('0x45')]['key']};});_0x289009['model']=_[_0x23ff('0x46')](_[_0x23ff('0x3b')](_0x3f65a1,_0x23ff('0x40')),[_0x23ff('0x47'),_0x23ff('0x48')]);_0x289009[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x1a7ddc[_0x23ff('0x49')]);_0x289009[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x289009[_0x23ff('0x4d')],_0x289009['query']);_0xfafb18['attributes']=_[_0x23ff('0x4c')](_0x289009['model'],qs[_0x23ff('0x4e')](_0x1a7ddc[_0x23ff('0x49')][_0x23ff('0x4e')]));_0xfafb18[_0x23ff('0x4f')]=_0xfafb18['attributes'][_0x23ff('0x50')]?_0xfafb18[_0x23ff('0x4f')]:_0x289009[_0x23ff('0x4d')];if(!_0x1a7ddc[_0x23ff('0x49')]['hasOwnProperty']('nolimit')){_0xfafb18[_0x23ff('0x51')]=qs[_0x23ff('0x51')](_0x1a7ddc['query'][_0x23ff('0x51')]);_0xfafb18[_0x23ff('0x2e')]=qs[_0x23ff('0x2e')](_0x1a7ddc[_0x23ff('0x49')][_0x23ff('0x2e')]);}_0xfafb18[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x1a7ddc[_0x23ff('0x49')][_0x23ff('0x53')]);_0xfafb18[_0x23ff('0x54')]=qs[_0x23ff('0x4b')](_['pick'](_0x1a7ddc[_0x23ff('0x49')],_0x289009[_0x23ff('0x4b')]),_0x3f65a1);if(_0x1a7ddc['query']['filter']){_0xfafb18[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0xfafb18[_0x23ff('0x54')],{'$or':_[_0x23ff('0x3b')](_0x3f65a1,function(_0x44e384){if(_0x44e384[_0x23ff('0x45')]!==_0x23ff('0x56')){return db[_0x23ff('0x57')]['where'](db[_0x23ff('0x57')]['fn'](_0x23ff('0x58'),db['sequelize']['col'](_0x44e384[_0x23ff('0x40')])),{'$like':db[_0x23ff('0x57')]['fn'](_0x23ff('0x58'),'%'+_0x1a7ddc['query']['filter']+'%')});}})});}_0xfafb18=_[_0x23ff('0x55')]({},_0xfafb18,_0x1a7ddc['options']);var _0x15ed42={'where':_0xfafb18['where']};return db[_0x23ff('0x43')][_0x23ff('0x2d')](_0x15ed42)[_0x23ff('0x20')](function(_0x2c82df){_0x33a015[_0x23ff('0x2d')]=_0x2c82df;if(_0x1a7ddc[_0x23ff('0x49')][_0x23ff('0x59')]){_0xfafb18[_0x23ff('0x5a')]=[{'all':!![]}];}return db[_0x23ff('0x43')][_0x23ff('0x5b')](_0xfafb18);})[_0x23ff('0x20')](function(_0x4346bc){_0x33a015[_0x23ff('0x5c')]=_0x4346bc;return _0x33a015;})[_0x23ff('0x20')](respondWithFilteredResult(_0x3fa8fb,_0xfafb18))[_0x23ff('0x5d')](handleError(_0x3fa8fb,null));};exports[_0x23ff('0x5e')]=function(_0x37b28e,_0x1a299b){var _0x2c7337={'raw':![],'where':{'id':_0x37b28e['params']['id']}},_0x531784={};_0x531784[_0x23ff('0x4d')]=_[_0x23ff('0x46')](_[_0x23ff('0x4a')](db[_0x23ff('0x43')][_0x23ff('0x44')]),[_0x23ff('0x47'),_0x23ff('0x48')]);_0x531784['query']=_[_0x23ff('0x4a')](_0x37b28e[_0x23ff('0x49')]);_0x531784[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x531784[_0x23ff('0x4d')],_0x531784['query']);_0x2c7337['attributes']=_['intersection'](_0x531784['model'],qs['fields'](_0x37b28e[_0x23ff('0x49')][_0x23ff('0x4e')]));_0x2c7337[_0x23ff('0x4f')]=_0x2c7337['attributes']['length']?_0x2c7337['attributes']:_0x531784[_0x23ff('0x4d')];if(_0x37b28e['query'][_0x23ff('0x59')]){_0x2c7337[_0x23ff('0x5a')]=[{'all':!![]}];}_0x2c7337=_[_0x23ff('0x55')]({},_0x2c7337,_0x37b28e[_0x23ff('0x5f')]);return db[_0x23ff('0x43')][_0x23ff('0x3e')](_0x2c7337)['then'](handleEntityNotFound(_0x1a299b,null))[_0x23ff('0x20')](respondWithResult(_0x1a299b,null))[_0x23ff('0x5d')](handleError(_0x1a299b,null));};exports[_0x23ff('0x60')]=function(_0x4edd76,_0xcea64a){return db[_0x23ff('0x43')][_0x23ff('0x60')](_0x4edd76[_0x23ff('0x61')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xcea64a,0xc9))['catch'](handleError(_0xcea64a,null));};exports[_0x23ff('0x32')]=function(_0x7b57d4,_0x2b117e){if(_0x7b57d4[_0x23ff('0x61')]['id']){delete _0x7b57d4[_0x23ff('0x61')]['id'];}delete _0x7b57d4[_0x23ff('0x61')][_0x23ff('0x3f')];return db['User'][_0x23ff('0x3e')]({'where':{'id':_0x7b57d4[_0x23ff('0x62')]['id']}})['then'](handleEntityNotFound(_0x2b117e,null))[_0x23ff('0x20')](saveUpdates(_0x7b57d4[_0x23ff('0x61')],null))[_0x23ff('0x20')](respondWithResult(_0x2b117e,null))[_0x23ff('0x5d')](handleError(_0x2b117e,null));};exports['describe']=function(_0x47f951,_0x6ef7ba){return db[_0x23ff('0x43')][_0x23ff('0x63')]()[_0x23ff('0x20')](respondWithResult(_0x6ef7ba,null))['catch'](handleError(_0x6ef7ba,null));};exports[_0x23ff('0x64')]=function(_0x4ccb55,_0x1d1e81,_0x4a4554){return db['User'][_0x23ff('0x3e')]({'where':{'id':_0x4ccb55[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x1d1e81,null))[_0x23ff('0x20')](function(_0x249e50){if(_0x249e50){return _0x249e50['addContacts'](_0x4ccb55[_0x23ff('0x61')]['ids'],_['omit'](_0x4ccb55[_0x23ff('0x61')],['ids','id'])||{});}})[_0x23ff('0x20')](respondWithResult(_0x1d1e81,null))['catch'](handleError(_0x1d1e81,null));};var getLicense=function(_0x14f88d){return new BPromise(function(_0x312d76,_0x3653dd){var _0x3ba4fe=0x0;_0x14f88d['body'][_0x23ff('0x3f')]===_0x23ff('0x38')&&_0x312d76(_0x23ff('0x65'));return db['User'][_0x23ff('0x2d')]({'where':{'$or':[{'role':_0x14f88d[_0x23ff('0x61')][_0x23ff('0x3f')]===_0x23ff('0x39')?_0x23ff('0x39'):[_0x23ff('0x66'),_0x23ff('0x36')]}]}})[_0x23ff('0x20')](function(_0x278e3b){_0x3ba4fe=_0x278e3b;return require(_0x23ff('0x67'))[_0x23ff('0x68')]();})[_0x23ff('0x20')](function(_0x238e9b){var _0x3470dd=_0x14f88d[_0x23ff('0x61')][_0x23ff('0x3f')]===_0x23ff('0x39')?_0x23ff('0x69'):_0x23ff('0x6a');if(!_[_0x23ff('0x6b')](_0x238e9b[_0x3470dd])&&_0x3ba4fe>=_0x238e9b[_0x3470dd]){return _0x3653dd({'message':_0x23ff('0x6c')});}return _0x312d76(util['format']('count\x20%s:\x20%s',_0x3470dd,_0x3ba4fe));})[_0x23ff('0x5d')](function(_0x1696ab){return _0x3653dd(_0x1696ab);});});};exports[_0x23ff('0x6d')]=function(_0x39d257,_0x239664){return getLicense(_0x39d257)['then'](function(_0x327aa4){if(!_0x39d257['body'][_0x23ff('0x6e')]){var _0x59949f;return db[_0x23ff('0x6f')][_0x23ff('0x70')](0x1)['then'](function(_0x393750){return checkPasswordPattern(_0x393750,_0x39d257[_0x23ff('0x61')][_0x23ff('0x47')],_0x393750[_0x23ff('0x71')]);})[_0x23ff('0x20')](function(_0x1e92a1){_0x59949f=_0x1e92a1[_0x23ff('0x72')];return db[_0x23ff('0x43')]['max'](_0x23ff('0x6e'));})[_0x23ff('0x20')](function(_0x2d67be){if(_[_0x23ff('0x6b')](_0x2d67be)){if(_0x59949f){_0x39d257['body'][_0x23ff('0x6e')]=_0x59949f;}else{_0x39d257[_0x23ff('0x61')]['internal']=0x1;}}else{if(_[_0x23ff('0x6b')](_0x59949f)||_0x59949f==_0x2d67be){_0x39d257[_0x23ff('0x61')][_0x23ff('0x6e')]=_0x2d67be+0x1;}else if(_0x59949f>_0x2d67be){_0x39d257[_0x23ff('0x61')]['internal']=_0x59949f;}else{return db[_0x23ff('0x57')][_0x23ff('0x49')](_0x23ff('0x73'),{'type':db[_0x23ff('0x57')][_0x23ff('0x74')][_0x23ff('0x75')]})[_0x23ff('0x20')](function(_0x190379){if(_0x190379&&_0x190379[_0x23ff('0x50')]){for(var _0x35acd4=0x0,_0x1daa50=_0x190379[_0x23ff('0x50')];_0x35acd4<_0x1daa50&&_[_0x23ff('0x6b')](_0x39d257[_0x23ff('0x61')][_0x23ff('0x6e')]);_0x35acd4++){if(_0x59949f<=_0x190379[_0x35acd4][_0x23ff('0x76')]){_0x39d257[_0x23ff('0x61')][_0x23ff('0x6e')]=_0x190379[_0x35acd4][_0x23ff('0x76')];}else if(_0x59949f>_0x190379[_0x35acd4]['from']&&_0x59949f<=_0x190379[_0x35acd4]['to']){_0x39d257[_0x23ff('0x61')][_0x23ff('0x6e')]=_0x59949f;}}}if(_[_0x23ff('0x6b')](_0x39d257[_0x23ff('0x61')][_0x23ff('0x6e')])){_0x39d257[_0x23ff('0x61')][_0x23ff('0x6e')]=_0x2d67be+0x1;}});}}});}})[_0x23ff('0x20')](function(){if(_0x39d257[_0x23ff('0x61')][_0x23ff('0x77')]){_0x39d257[_0x23ff('0x61')][_0x23ff('0x78')]=_0x39d257[_0x23ff('0x61')][_0x23ff('0x6e')];_0x39d257[_0x23ff('0x61')][_0x23ff('0x79')]={'mailbox':_0x39d257[_0x23ff('0x61')][_0x23ff('0x6e')],'password':_0x39d257[_0x23ff('0x61')]['password'],'fullname':_0x39d257[_0x23ff('0x61')][_0x23ff('0x7a')],'email':_0x39d257['body'][_0x23ff('0x7b')]};}if(_0x39d257[_0x23ff('0x61')]&&_0x39d257[_0x23ff('0x61')][_0x23ff('0x3f')]===_0x23ff('0x38')){if(!_0x39d257['body'][_0x23ff('0x7c')]){_0x39d257['body'][_0x23ff('0x7c')]=[_0x23ff('0x7d'),'102',_0x23ff('0x7e'),'113','110','104',_0x23ff('0x7f'),_0x23ff('0x80'),'107',_0x23ff('0x81'),_0x23ff('0x82'),_0x23ff('0x83'),_0x23ff('0x84'),_0x23ff('0x85')];}}return db[_0x23ff('0x43')][_0x23ff('0x6d')](_0x39d257[_0x23ff('0x61')],{'include':[{'model':db[_0x23ff('0x79')],'as':_0x23ff('0x79')}]});})[_0x23ff('0x20')](function(_0x38e296){if(_0x39d257['body'][_0x23ff('0x3f')]==='user')return _0x38e296;var _0x119ad4=_0x39d257[_0x23ff('0x36')][_0x23ff('0x34')]({'plain':!![]});if(!_0x119ad4)throw new Error(_0x23ff('0x86'));if(_0x119ad4[_0x23ff('0x3f')]==='user'){var _0x3d9b35=_0x38e296['get']({'plain':!![]});var _0x1aae6c=[{'name':_0x23ff('0x37'),'value':_0x23ff('0x38')},{'name':_0x23ff('0x87'),'value':_0x23ff('0x39')}];var _0x62f625=_[_0x23ff('0x3e')](_0x1aae6c,[_0x23ff('0x3c'),_0x3d9b35[_0x23ff('0x3f')]])['name'];return db[_0x23ff('0x88')][_0x23ff('0x3e')]({'where':{'name':_0x62f625,'userProfileId':_0x119ad4[_0x23ff('0x89')]},'raw':!![]})['then'](function(_0x263e47){if(_0x263e47&&_0x263e47['autoAssociation']===0x0){return db[_0x23ff('0x8a')]['create']({'name':_0x3d9b35[_0x23ff('0x40')],'resourceId':_0x3d9b35['id'],'type':_0x263e47[_0x23ff('0x40')],'sectionId':_0x263e47['id']},{})[_0x23ff('0x20')](function(){return _0x38e296;});}else{return _0x38e296;}})[_0x23ff('0x5d')](function(_0x2156c7){logger[_0x23ff('0x23')](_0x23ff('0x8b'),_0x2156c7);throw _0x2156c7;});}return _0x38e296;})[_0x23ff('0x20')](respondWithResult(_0x239664,0xc9))['catch'](handleError(_0x239664,null));};exports[_0x23ff('0x8c')]=function(_0x9f4172,_0xd0f5e5,_0x311a49){var _0x23410a=![];if(_0x9f4172['body']['id']){delete _0x9f4172[_0x23ff('0x61')]['id'];}return db[_0x23ff('0x6f')][_0x23ff('0x8d')]({'attributes':['id',_0x23ff('0x71')]})[_0x23ff('0x20')](function(_0x42425a){_0x23410a=_0x42425a[_0x23ff('0x71')];return db['User']['find']({'where':{'id':_0x9f4172[_0x23ff('0x62')]['id']}});})['then'](function(_0x4daf3b){if(_0x4daf3b){if(_0x4daf3b['id']==_0x9f4172[_0x23ff('0x36')]['id']){if(!_0x9f4172[_0x23ff('0x61')][_0x23ff('0x8e')]||!_0x9f4172[_0x23ff('0x61')][_0x23ff('0x8f')]){throw new db[(_0x23ff('0x90'))][(_0x23ff('0x91'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x4daf3b[_0x23ff('0x92')](_0x9f4172[_0x23ff('0x61')]['oldPassword'])){throw new db['Sequelize'][(_0x23ff('0x91'))](_0x23ff('0x93'));}if(_0x9f4172[_0x23ff('0x61')][_0x23ff('0x8e')]==_0x9f4172['body'][_0x23ff('0x8f')]){throw new db[(_0x23ff('0x90'))][(_0x23ff('0x91'))](_0x23ff('0x94'));}return _0x4daf3b;}else if(_0x9f4172[_0x23ff('0x36')][_0x23ff('0x3f')]==_0x23ff('0x66')){if(!_0x9f4172[_0x23ff('0x61')]['newPassword']){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x4daf3b;}else if(_0x9f4172[_0x23ff('0x36')][_0x23ff('0x3f')]==_0x23ff('0x36')){if(!_0x9f4172[_0x23ff('0x61')][_0x23ff('0x8f')]){throw new db[(_0x23ff('0x90'))][(_0x23ff('0x91'))](_0x23ff('0x95'));}if(_0x4daf3b[_0x23ff('0x3f')]!=_0x23ff('0x38')){throw new db[(_0x23ff('0x90'))][(_0x23ff('0x91'))]('Unauthorized');}return _0x4daf3b;}else{throw new db[(_0x23ff('0x90'))][(_0x23ff('0x91'))](_0x23ff('0x96'));}}return null;})[_0x23ff('0x20')](handleEntityNotFound(_0xd0f5e5,null))[_0x23ff('0x20')](function(_0x580c41){return checkPasswordPattern(_0x580c41,_0x9f4172[_0x23ff('0x61')][_0x23ff('0x8f')],_0x23410a);})[_0x23ff('0x20')](saveUpdates({'password':_0x9f4172['body'][_0x23ff('0x8f')],'passwordResetAt':_0x9f4172[_0x23ff('0x36')]['id']==_0x9f4172[_0x23ff('0x62')]['id']?moment():null},null))['then'](respondWithResult(_0xd0f5e5,null))['catch'](handleError(_0xd0f5e5,null));};exports[_0x23ff('0x97')]=function(_0x3c9040,_0x5ebc55,_0xc2b749){var _0x4e2f51=_0x3c9040[_0x23ff('0x61')][_0x23ff('0x98')];return db[_0x23ff('0x43')][_0x23ff('0x3e')]({'where':{'id':_0x3c9040[_0x23ff('0x62')]['id']},'attributes':['id','name','role','online','loginInPause','voicePause',_0x23ff('0x99')]})[_0x23ff('0x20')](handleEntityNotFound(_0x5ebc55,null))[_0x23ff('0x20')](function(_0x1732c4){if(_0x1732c4){if(!utils[_0x23ff('0x9a')](_0x4e2f51)){throw new db[(_0x23ff('0x90'))][(_0x23ff('0x91'))]('Unknown\x20channel');}return _0x1732c4[_0x23ff('0x9b')+_[_0x23ff('0x9c')](_0x4e2f51[_0x23ff('0x9d')]())+_0x23ff('0x9e')](_0x3c9040[_0x23ff('0x61')]['ids'],{'penalty':_0x3c9040[_0x23ff('0x61')][_0x23ff('0x9f')]||0x0})[_0x23ff('0xa0')](function(_0x336325){for(var _0x8e976=0x0;_0x8e976<_0x3c9040['body']['ids'][_0x23ff('0x50')];_0x8e976+=0x1){var _0x419d14={'UserId':_0x3c9040['params']['id']};_0x419d14[_[_0x23ff('0x9c')](_0x4e2f51[_0x23ff('0x9d')]())+_0x23ff('0xa1')]=_0x3c9040[_0x23ff('0x61')][_0x23ff('0xa2')][_0x8e976];socket[_0x23ff('0xa3')](_0x23ff('0x36')+_[_0x23ff('0x9c')](_0x4e2f51[_0x23ff('0x9d')]())+'Queue:save',_0x419d14);}return _0x336325;})[_0x23ff('0x20')](function(){if(_0x4e2f51===_0x23ff('0xa4')){return db['VoiceQueue']['findAll']({'where':{'id':_0x3c9040[_0x23ff('0x61')][_0x23ff('0xa2')]||[]},'raw':!![],'attributes':['id',_0x23ff('0x40')]});}})[_0x23ff('0x20')](function(_0x5c8936){var _0x10f28b=_0x1732c4[_0x23ff('0x34')]({'plain':!![]});var _0x5eb3f3=[];if(_0x4e2f51===_0x23ff('0xa4')&&_0x10f28b[_0x23ff('0x3f')]===_0x23ff('0x38')&&_0x10f28b['online']){for(var _0x86bee1=0x0;_0x86bee1<_0x5c8936[_0x23ff('0x50')];_0x86bee1+=0x1){_0x5eb3f3[_0x23ff('0xa5')]({'membername':_0x10f28b[_0x23ff('0x40')],'UserId':_0x10f28b['id'],'queue_name':_0x5c8936[_0x86bee1]['name'],'VoiceQueueId':_0x5c8936[_0x86bee1]['id'],'interface':_[_0x23ff('0x6b')](_0x10f28b[_0x23ff('0x99')])?util['format'](_0x23ff('0xa6'),_0x10f28b[_0x23ff('0x40')]):_0x10f28b[_0x23ff('0x99')],'paused':_0x10f28b[_0x23ff('0xa7')]||![],'penalty':_0x3c9040[_0x23ff('0x61')][_0x23ff('0x9f')]||0x0});}return BPromise[_0x23ff('0xa8')](_0x5eb3f3,function(_0x2819a8){return db[_0x23ff('0xa9')]['upsert'](_0x2819a8);});}return _0x1732c4;});}})[_0x23ff('0x20')](respondWithStatusCode(_0x5ebc55,null))['catch'](handleError(_0x5ebc55,null));};exports[_0x23ff('0xaa')]=function(_0x5f44ea,_0x1b791c,_0x2b5542){var _0x5440d7;return db[_0x23ff('0x43')][_0x23ff('0x3e')]({'where':{'id':_0x5f44ea[_0x23ff('0x62')]['id']},'attributes':['id','name',_0x23ff('0x3f')]})[_0x23ff('0x20')](handleEntityNotFound(_0x1b791c,null))[_0x23ff('0x20')](function(_0x112277){if(_0x112277){_0x5440d7=_0x112277;if(!_0x5f44ea['query'][_0x23ff('0x98')]||!utils[_0x23ff('0x9a')](_0x5f44ea[_0x23ff('0x49')][_0x23ff('0x98')])){throw new db[(_0x23ff('0x90'))][(_0x23ff('0x91'))]('Unknown\x20channel');}return _0x112277[_0x23ff('0xab')+_[_0x23ff('0x9c')](_0x5f44ea['query'][_0x23ff('0x98')][_0x23ff('0x9d')]())+_0x23ff('0x9e')](_0x5f44ea[_0x23ff('0x49')][_0x23ff('0xa2')]);}})[_0x23ff('0x20')](function(_0x3c9975){for(var _0x3d3da8=0x0;_0x3d3da8<_0x5f44ea['query'][_0x23ff('0xa2')][_0x23ff('0x50')];_0x3d3da8+=0x1){var _0x187990={'UserId':_0x5f44ea['params']['id']};_0x187990[_['capitalize'](_0x5f44ea[_0x23ff('0x49')][_0x23ff('0x98')][_0x23ff('0x9d')]())+'QueueId']=_0x5f44ea['query'][_0x23ff('0xa2')][_0x3d3da8];socket[_0x23ff('0xa3')]('user'+_[_0x23ff('0x9c')](_0x5f44ea[_0x23ff('0x49')]['channel'][_0x23ff('0x9d')]())+_0x23ff('0xac'),_0x187990);}return _0x3c9975;})[_0x23ff('0x20')](function(){if(_0x5f44ea['query'][_0x23ff('0x98')]==='voice'){return db[_0x23ff('0xa9')][_0x23ff('0x33')]({'where':{'UserId':_0x5f44ea[_0x23ff('0x62')]['id'],'VoiceQueueId':_0x5f44ea[_0x23ff('0x49')]['ids']},'individualHooks':!![]})['then'](function(){return _0x5440d7;});}return _0x5440d7;})[_0x23ff('0x20')](respondWithStatusCode(_0x1b791c,null))[_0x23ff('0x5d')](handleError(_0x1b791c,null));};exports[_0x23ff('0xad')]=function(_0xe9a183,_0x28e07b,_0x5cfa99){_0xe9a183[_0x23ff('0x61')][_0x23ff('0xae')]=_0xe9a183[_0x23ff('0xaf')][_0x23ff('0xb0')];return db[_0x23ff('0x43')][_0x23ff('0x3e')]({'where':{'id':_0xe9a183[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x28e07b,null))[_0x23ff('0x20')](saveUpdates(_0xe9a183['body'],null))[_0x23ff('0x20')](respondWithResult(_0x28e07b,null))[_0x23ff('0x5d')](handleError(_0x28e07b,null));};exports[_0x23ff('0xb1')]=function(_0x110faa,_0x537e6f,_0x124bbf){var _0x1535dd=path[_0x23ff('0xb2')](config['root'],'server/files/images/logos/default_profile.png');return db['User'][_0x23ff('0x3e')]({'where':{'id':_0x110faa['params']['id']},'attributes':['id',_0x23ff('0xae')],'raw':!![]})[_0x23ff('0x20')](handleEntityNotFound(_0x537e6f,null))[_0x23ff('0x20')](function(_0x476f5e){if(_0x476f5e){if(_['isNil'](_0x476f5e[_0x23ff('0xae')])){return _0x537e6f[_0x23ff('0xb3')](_0x1535dd);}else{if(!fs[_0x23ff('0xb4')](path['join'](config['root'],_0x23ff('0xb5'),_0x476f5e[_0x23ff('0xae')]))){return _0x537e6f[_0x23ff('0xb3')](_0x1535dd);}return _0x537e6f[_0x23ff('0xb3')](path[_0x23ff('0xb2')](config['root'],'server/files/images/',_0x476f5e['userpic']));}}})[_0x23ff('0x5d')](handleError(_0x537e6f,null));};exports[_0x23ff('0xb6')]=function(_0x11c286,_0x55c740,_0x5c40fc){var _0x20c4ce={};var _0x1a00e2={};var _0x1137ae;var _0x227ef1;return db[_0x23ff('0x43')][_0x23ff('0x8d')]({'where':{'id':_0x11c286[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x55c740,null))['then'](function(_0x307789){if(_0x307789){_0x1137ae=_0x307789;_0x1a00e2['model']=_['keys'](db[_0x23ff('0xb7')][_0x23ff('0x44')]);_0x1a00e2[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x11c286[_0x23ff('0x49')]);_0x1a00e2['filters']=_[_0x23ff('0x4c')](_0x1a00e2[_0x23ff('0x4d')],_0x1a00e2[_0x23ff('0x49')]);_0x20c4ce['attributes']=_[_0x23ff('0x4c')](_0x1a00e2['model'],qs[_0x23ff('0x4e')](_0x11c286['query'][_0x23ff('0x4e')]));_0x20c4ce[_0x23ff('0x4f')]=_0x20c4ce['attributes']['length']?_0x20c4ce['attributes']:_0x1a00e2[_0x23ff('0x4d')];_0x20c4ce['order']=qs[_0x23ff('0x53')](_0x11c286[_0x23ff('0x49')][_0x23ff('0x53')]);_0x20c4ce['where']=qs[_0x23ff('0x4b')](_[_0x23ff('0xb8')](_0x11c286[_0x23ff('0x49')],_0x1a00e2[_0x23ff('0x4b')]));if(_0x11c286[_0x23ff('0x49')]['filter']){_0x20c4ce['where']=_['merge'](_0x20c4ce['where'],{'$or':_[_0x23ff('0x3b')](_0x20c4ce[_0x23ff('0x4f')],function(_0x4c250a){var _0x2b1fb6={};_0x2b1fb6[_0x4c250a]={'$like':'%'+_0x11c286[_0x23ff('0x49')]['filter']+'%'};return _0x2b1fb6;})});}_0x20c4ce=_[_0x23ff('0x55')]({},_0x20c4ce,_0x11c286[_0x23ff('0x5f')]);return _0x1137ae[_0x23ff('0xb6')](_0x20c4ce);}})[_0x23ff('0x20')](function(_0x40e3fb){if(_0x40e3fb){_0x227ef1=_0x40e3fb[_0x23ff('0x50')];if(_0x11c286['query']['hasOwnProperty']('includeAll')){_0x20c4ce[_0x23ff('0x5a')]=[{'model':db['CmList'],'as':_0x23ff('0xb9'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x23ff('0x40'),_0x23ff('0xba')],'where':_0x11c286[_0x23ff('0x49')][_0x23ff('0xbb')]?{'id':_0x11c286[_0x23ff('0x49')]['tag']}:undefined,'required':_0x11c286[_0x23ff('0x49')][_0x23ff('0xbb')]?!![]:![]}];}if(!_0x11c286[_0x23ff('0x49')][_0x23ff('0xbc')](_0x23ff('0xbd'))){_0x20c4ce[_0x23ff('0x51')]=qs[_0x23ff('0x51')](_0x11c286[_0x23ff('0x49')][_0x23ff('0x51')]);_0x20c4ce[_0x23ff('0x2e')]=qs['offset'](_0x11c286['query'][_0x23ff('0x2e')]);}return _0x1137ae['getContacts'](_0x20c4ce);}})['then'](function(_0x39e4aa){if(_0x39e4aa){return _0x39e4aa?{'count':_0x227ef1,'rows':_0x39e4aa}:null;}})[_0x23ff('0x20')](respondWithResult(_0x55c740,null))[_0x23ff('0x5d')](handleError(_0x55c740,null));};exports[_0x23ff('0xbe')]=function(_0x177c57,_0x1149bf,_0x3d18cf){var _0x53797f;var _0x3aa4aa;var _0x272f7e={};var _0x4d109a;return db[_0x23ff('0x43')][_0x23ff('0x8d')]({'where':{'id':_0x177c57[_0x23ff('0x62')]['id']},'attributes':['id',_0x23ff('0x40'),_0x23ff('0x3f')]})[_0x23ff('0x20')](handleEntityNotFound(_0x1149bf,null))[_0x23ff('0x20')](function(_0x55aab9){if(!utils['isValidChannel'](_0x177c57[_0x23ff('0x49')]['channel'])){throw new db[(_0x23ff('0x90'))][(_0x23ff('0x91'))]('Unknown\x20channel');}_0x53797f=_0x55aab9;var _0x155d87={};_0x155d87[_0x23ff('0x4d')]=_[_0x23ff('0x4a')](db[_[_0x23ff('0x9c')](_0x177c57[_0x23ff('0x49')][_0x23ff('0x98')])+_0x23ff('0xbf')]['rawAttributes']);_0x155d87[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x177c57[_0x23ff('0x49')]);_0x155d87[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x155d87[_0x23ff('0x4d')],_0x155d87[_0x23ff('0x49')]);_0x272f7e[_0x23ff('0x4f')]=_['intersection'](_0x155d87[_0x23ff('0x4d')],qs[_0x23ff('0x4e')](_0x177c57[_0x23ff('0x49')]['fields']));_0x272f7e[_0x23ff('0x4f')]=_0x272f7e[_0x23ff('0x4f')]['length']?_0x272f7e[_0x23ff('0x4f')]:_0x155d87[_0x23ff('0x4d')];_0x272f7e[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x177c57[_0x23ff('0x49')][_0x23ff('0x53')]);_0x272f7e[_0x23ff('0x54')]=qs['filters'](_[_0x23ff('0xb8')](_0x177c57['query'],_0x155d87['filters']));if(_0x177c57[_0x23ff('0x49')][_0x23ff('0xc0')]){_0x272f7e[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0x272f7e['where'],{'$or':_[_0x23ff('0x3b')](_0x272f7e[_0x23ff('0x4f')],function(_0x1307a0){var _0x55d478={};_0x55d478[_0x1307a0]={'$like':'%'+_0x177c57[_0x23ff('0x49')]['filter']+'%'};return _0x55d478;})});}_0x272f7e=_['merge']({},_0x272f7e,_0x177c57[_0x23ff('0x5f')]);switch(_0x53797f[_0x23ff('0x3f')]){case'admin':return db[_[_0x23ff('0x9c')](_0x177c57[_0x23ff('0x49')]['channel'])+_0x23ff('0xbf')][_0x23ff('0x5b')](_0x272f7e);case _0x23ff('0x36'):case _0x23ff('0x38'):return _0x53797f[_0x23ff('0x34')+_[_0x23ff('0x9c')](_0x177c57['query'][_0x23ff('0x98')])+'Queues'](_0x272f7e);default:throw new db[(_0x23ff('0x90'))]['ValidationError'](_0x23ff('0xc1'));}})['then'](function(_0xd42145){_0x4d109a=_0xd42145[_0x23ff('0x50')];if(!_0x177c57['query']['hasOwnProperty'](_0x23ff('0xbd'))){_0x272f7e[_0x23ff('0x51')]=qs[_0x23ff('0x51')](_0x177c57[_0x23ff('0x49')][_0x23ff('0x51')]);_0x272f7e[_0x23ff('0x2e')]=qs['offset'](_0x177c57[_0x23ff('0x49')][_0x23ff('0x2e')]);}switch(_0x53797f['role']){case'admin':return db[_[_0x23ff('0x9c')](_0x177c57[_0x23ff('0x49')][_0x23ff('0x98')])+'Queue'][_0x23ff('0x5b')](_0x272f7e);case'user':case _0x23ff('0x38'):return _0x53797f[_0x23ff('0x34')+_[_0x23ff('0x9c')](_0x177c57[_0x23ff('0x49')]['channel'])+_0x23ff('0x9e')](_0x272f7e);}})[_0x23ff('0x20')](function(_0x7d2d50){return{'count':_0x4d109a,'rows':_0x7d2d50};})[_0x23ff('0x20')](respondWithResult(_0x1149bf,null))[_0x23ff('0x5d')](handleError(_0x1149bf,null));};exports[_0x23ff('0xc2')]=function(_0x28880d,_0x3cf5ee,_0x9c8934){var _0x34728b={};var _0x3824af={};var _0x3204de;var _0x26fcd0;return db[_0x23ff('0x43')]['findOne']({'where':{'id':_0x28880d[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x3cf5ee,null))[_0x23ff('0x20')](function(_0xbc1f2a){if(_0xbc1f2a){_0x3204de=_0xbc1f2a;_0x3824af[_0x23ff('0x4d')]=_['keys'](db['UserVoiceQueueRt']['rawAttributes']);_0x3824af[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x28880d[_0x23ff('0x49')]);_0x3824af[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x3824af[_0x23ff('0x4d')],_0x3824af[_0x23ff('0x49')]);_0x34728b['attributes']=_[_0x23ff('0x4c')](_0x3824af['model'],qs['fields'](_0x28880d[_0x23ff('0x49')]['fields']));_0x34728b[_0x23ff('0x4f')]=_0x34728b[_0x23ff('0x4f')][_0x23ff('0x50')]?_0x34728b[_0x23ff('0x4f')]:_0x3824af[_0x23ff('0x4d')];_0x34728b['order']=qs['sort'](_0x28880d[_0x23ff('0x49')]['sort']);_0x34728b[_0x23ff('0x54')]=qs[_0x23ff('0x4b')](_[_0x23ff('0xb8')](_0x28880d['query'],_0x3824af[_0x23ff('0x4b')]));if(_0x28880d[_0x23ff('0x49')]['filter']){_0x34728b[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0x34728b[_0x23ff('0x54')],{'$or':_[_0x23ff('0x3b')](_0x34728b[_0x23ff('0x4f')],function(_0x498025){var _0x477ed6={};_0x477ed6[_0x498025]={'$like':'%'+_0x28880d[_0x23ff('0x49')][_0x23ff('0xc0')]+'%'};return _0x477ed6;})});}_0x34728b=_[_0x23ff('0x55')]({},_0x34728b,_0x28880d['options']);return _0x3204de['getVoiceQueuesRt'](_0x34728b);}})[_0x23ff('0x20')](function(_0x5cbae8){if(_0x5cbae8){_0x26fcd0=_0x5cbae8[_0x23ff('0x50')];if(!_0x28880d[_0x23ff('0x49')][_0x23ff('0xbc')](_0x23ff('0xbd'))){_0x34728b[_0x23ff('0x51')]=qs[_0x23ff('0x51')](_0x28880d[_0x23ff('0x49')][_0x23ff('0x51')]);_0x34728b[_0x23ff('0x2e')]=qs['offset'](_0x28880d[_0x23ff('0x49')]['offset']);}return _0x3204de[_0x23ff('0xc2')](_0x34728b);}})[_0x23ff('0x20')](function(_0x280f20){if(_0x280f20){return _0x280f20?{'count':_0x26fcd0,'rows':_0x280f20}:null;}})[_0x23ff('0x20')](respondWithResult(_0x3cf5ee,null))['catch'](handleError(_0x3cf5ee,null));};exports[_0x23ff('0xc3')]=function(_0x5a28ca,_0x59527b,_0x41752a){var _0x4b4b54={};var _0x1083a2={};var _0x1d05df;var _0x502ecc;return db[_0x23ff('0x43')]['findOne']({'where':{'id':_0x5a28ca[_0x23ff('0x62')]['id']}})['then'](handleEntityNotFound(_0x59527b,null))[_0x23ff('0x20')](function(_0x454efc){if(_0x454efc){_0x1d05df=_0x454efc;_0x1083a2[_0x23ff('0x4d')]=_[_0x23ff('0x4a')](db[_0x23ff('0xc4')][_0x23ff('0x44')]);_0x1083a2[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x5a28ca['query']);_0x1083a2[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x1083a2[_0x23ff('0x4d')],_0x1083a2[_0x23ff('0x49')]);_0x4b4b54['attributes']=_[_0x23ff('0x4c')](_0x1083a2[_0x23ff('0x4d')],qs[_0x23ff('0x4e')](_0x5a28ca[_0x23ff('0x49')][_0x23ff('0x4e')]));_0x4b4b54[_0x23ff('0x4f')]=_0x4b4b54[_0x23ff('0x4f')]['length']?_0x4b4b54[_0x23ff('0x4f')]:_0x1083a2[_0x23ff('0x4d')];_0x4b4b54[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x5a28ca[_0x23ff('0x49')]['sort']);_0x4b4b54['where']=qs[_0x23ff('0x4b')](_['pick'](_0x5a28ca[_0x23ff('0x49')],_0x1083a2[_0x23ff('0x4b')]));if(_0x5a28ca['query'][_0x23ff('0xc0')]){_0x4b4b54[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0x4b4b54[_0x23ff('0x54')],{'$or':_[_0x23ff('0x3b')](_0x4b4b54[_0x23ff('0x4f')],function(_0x1aa8c4){var _0x46e3e7={};_0x46e3e7[_0x1aa8c4]={'$like':'%'+_0x5a28ca['query'][_0x23ff('0xc0')]+'%'};return _0x46e3e7;})});}_0x4b4b54=_[_0x23ff('0x55')]({},_0x4b4b54,_0x5a28ca['options']);return _0x1d05df[_0x23ff('0xc3')](_0x4b4b54);}})[_0x23ff('0x20')](function(_0x558afc){if(_0x558afc){_0x502ecc=_0x558afc['length'];if(!_0x5a28ca[_0x23ff('0x49')]['hasOwnProperty']('nolimit')){_0x4b4b54[_0x23ff('0x51')]=qs['limit'](_0x5a28ca[_0x23ff('0x49')][_0x23ff('0x51')]);_0x4b4b54[_0x23ff('0x2e')]=qs[_0x23ff('0x2e')](_0x5a28ca[_0x23ff('0x49')]['offset']);}return _0x1d05df[_0x23ff('0xc3')](_0x4b4b54);}})['then'](function(_0x5816c4){if(_0x5816c4){return _0x5816c4?{'count':_0x502ecc,'rows':_0x5816c4}:null;}})[_0x23ff('0x20')](respondWithResult(_0x59527b,null))[_0x23ff('0x5d')](handleError(_0x59527b,null));};exports[_0x23ff('0xc5')]=function(_0x47d526,_0x180bf9,_0x5d1ad2){var _0x49ecba={'raw':!![],'where':{}};var _0x3794d4={};var _0x4bc30f={'count':0x0,'rows':[]};return db['User'][_0x23ff('0x8d')]({'where':{'id':_0x47d526[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x180bf9,null))['then'](function(_0x460f5c){if(_0x460f5c){_0x3794d4[_0x23ff('0x4d')]=_[_0x23ff('0x4a')](db[_0x23ff('0xc6')][_0x23ff('0x44')]);_0x3794d4[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x47d526['query']);_0x3794d4['filters']=_['intersection'](_0x3794d4['model'],_0x3794d4[_0x23ff('0x49')]);_0x49ecba[_0x23ff('0x4f')]=_[_0x23ff('0x4c')](_0x3794d4[_0x23ff('0x4d')],qs['fields'](_0x47d526[_0x23ff('0x49')]['fields']));_0x49ecba[_0x23ff('0x4f')]=_0x49ecba[_0x23ff('0x4f')][_0x23ff('0x50')]?_0x49ecba[_0x23ff('0x4f')]:_0x3794d4[_0x23ff('0x4d')];if(!_0x47d526[_0x23ff('0x49')][_0x23ff('0xbc')]('nolimit')){_0x49ecba['limit']=qs[_0x23ff('0x51')](_0x47d526[_0x23ff('0x49')]['limit']);_0x49ecba[_0x23ff('0x2e')]=qs[_0x23ff('0x2e')](_0x47d526['query'][_0x23ff('0x2e')]);}_0x49ecba[_0x23ff('0x52')]=qs['sort'](_0x47d526[_0x23ff('0x49')][_0x23ff('0x53')]);_0x49ecba[_0x23ff('0x54')]=qs['filters'](_['pick'](_0x47d526[_0x23ff('0x49')],_0x3794d4[_0x23ff('0x4b')]));_0x49ecba['where']['UserId']=_0x460f5c['id'];if(_0x47d526[_0x23ff('0x49')][_0x23ff('0xc0')]){_0x49ecba[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0x49ecba[_0x23ff('0x54')],{'$or':_[_0x23ff('0x3b')](_0x49ecba['attributes'],function(_0x60712){var _0x2b271f={};_0x2b271f[_0x60712]={'$like':'%'+_0x47d526[_0x23ff('0x49')]['filter']+'%'};return _0x2b271f;})});}_0x49ecba=_[_0x23ff('0x55')]({},_0x49ecba,_0x47d526[_0x23ff('0x5f')]);return db[_0x23ff('0xc6')]['count']({'where':_0x49ecba[_0x23ff('0x54')]})[_0x23ff('0x20')](function(_0x564a98){_0x4bc30f[_0x23ff('0x2d')]=_0x564a98;if(_0x47d526['query'][_0x23ff('0x59')]){_0x49ecba[_0x23ff('0x5a')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x49ecba);})['then'](function(_0x3a5578){_0x4bc30f[_0x23ff('0x5c')]=_0x3a5578;return _0x4bc30f;});}})[_0x23ff('0x20')](respondWithFilteredResult(_0x180bf9,_0x49ecba))[_0x23ff('0x5d')](handleError(_0x180bf9,null));};exports[_0x23ff('0xc7')]=function(_0x55d30b,_0x4b07ed,_0x14821b){var _0x1da44e={'raw':!![],'where':{}};var _0x41df13={};var _0x1c78b1={'count':0x0,'rows':[]};return db['User'][_0x23ff('0x8d')]({'where':{'id':_0x55d30b[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x4b07ed,null))[_0x23ff('0x20')](function(_0x22c8d0){if(_0x22c8d0){_0x41df13[_0x23ff('0x4d')]=_[_0x23ff('0x4a')](db['ScreenRecording'][_0x23ff('0x44')]);_0x41df13[_0x23ff('0x49')]=_['keys'](_0x55d30b[_0x23ff('0x49')]);_0x41df13[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x41df13[_0x23ff('0x4d')],_0x41df13[_0x23ff('0x49')]);_0x1da44e[_0x23ff('0x4f')]=_[_0x23ff('0x4c')](_0x41df13[_0x23ff('0x4d')],qs['fields'](_0x55d30b[_0x23ff('0x49')][_0x23ff('0x4e')]));_0x1da44e['attributes']=_0x1da44e[_0x23ff('0x4f')][_0x23ff('0x50')]?_0x1da44e[_0x23ff('0x4f')]:_0x41df13[_0x23ff('0x4d')];if(!_0x55d30b[_0x23ff('0x49')][_0x23ff('0xbc')]('nolimit')){_0x1da44e['limit']=qs['limit'](_0x55d30b['query'][_0x23ff('0x51')]);_0x1da44e[_0x23ff('0x2e')]=qs['offset'](_0x55d30b[_0x23ff('0x49')]['offset']);}_0x1da44e[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x55d30b[_0x23ff('0x49')][_0x23ff('0x53')]);_0x1da44e[_0x23ff('0x54')]=qs[_0x23ff('0x4b')](_[_0x23ff('0xb8')](_0x55d30b[_0x23ff('0x49')],_0x41df13['filters']));_0x1da44e[_0x23ff('0x54')]['UserId']=_0x22c8d0['id'];if(_0x55d30b[_0x23ff('0x49')][_0x23ff('0xc0')]){_0x1da44e['where']=_[_0x23ff('0x55')](_0x1da44e['where'],{'$or':_[_0x23ff('0x3b')](_0x1da44e[_0x23ff('0x4f')],function(_0x32e1c1){var _0x5a9dfa={};_0x5a9dfa[_0x32e1c1]={'$like':'%'+_0x55d30b[_0x23ff('0x49')]['filter']+'%'};return _0x5a9dfa;})});}_0x1da44e=_[_0x23ff('0x55')]({},_0x1da44e,_0x55d30b[_0x23ff('0x5f')]);return db[_0x23ff('0xc8')][_0x23ff('0x2d')]({'where':_0x1da44e[_0x23ff('0x54')]})[_0x23ff('0x20')](function(_0x120334){_0x1c78b1[_0x23ff('0x2d')]=_0x120334;if(_0x55d30b[_0x23ff('0x49')][_0x23ff('0x59')]){_0x1da44e[_0x23ff('0x5a')]=[{'all':!![]}];}return db['ScreenRecording'][_0x23ff('0x5b')](_0x1da44e);})[_0x23ff('0x20')](function(_0x5d4713){_0x1c78b1[_0x23ff('0x5c')]=_0x5d4713;return _0x1c78b1;});}})['then'](respondWithFilteredResult(_0x4b07ed,_0x1da44e))[_0x23ff('0x5d')](handleError(_0x4b07ed,null));};exports['getChatInteractions']=function(_0x3d6cf9,_0xf18163,_0x570769){var _0x2e2ca8={};var _0x5f149b={};var _0x3e371c;var _0x4f7313;return db[_0x23ff('0x43')][_0x23ff('0x8d')]({'where':{'id':_0x3d6cf9[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0xf18163,null))[_0x23ff('0x20')](function(_0x317ed4){if(_0x317ed4){_0x3e371c=_0x317ed4;_0x5f149b['model']=_[_0x23ff('0x4a')](db[_0x23ff('0xc9')][_0x23ff('0x44')]);_0x5f149b[_0x23ff('0x49')]=_['keys'](_0x3d6cf9['query']);_0x5f149b[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x5f149b['model'],_0x5f149b[_0x23ff('0x49')]);_0x2e2ca8[_0x23ff('0x4f')]=_[_0x23ff('0x4c')](_0x5f149b[_0x23ff('0x4d')],qs['fields'](_0x3d6cf9[_0x23ff('0x49')]['fields']));_0x2e2ca8['attributes']=_0x2e2ca8[_0x23ff('0x4f')]['length']?_0x2e2ca8['attributes']:_0x5f149b[_0x23ff('0x4d')];_0x2e2ca8[_0x23ff('0x52')]=qs['sort'](_0x3d6cf9['query'][_0x23ff('0x53')]);_0x2e2ca8[_0x23ff('0x54')]=qs[_0x23ff('0x4b')](_[_0x23ff('0xb8')](_0x3d6cf9['query'],_0x5f149b['filters']));if(_0x3d6cf9['query'][_0x23ff('0xc0')]){_0x2e2ca8['where']=_[_0x23ff('0x55')](_0x2e2ca8[_0x23ff('0x54')],{'$or':_[_0x23ff('0x3b')](_0x2e2ca8[_0x23ff('0x4f')],function(_0x4cc6e6){var _0x50ee23={};_0x50ee23[_0x4cc6e6]={'$like':'%'+_0x3d6cf9['query'][_0x23ff('0xc0')]+'%'};return _0x50ee23;})});}_0x2e2ca8=_[_0x23ff('0x55')]({},_0x2e2ca8,_0x3d6cf9[_0x23ff('0x5f')]);return _0x3e371c[_0x23ff('0xca')](_0x2e2ca8);}})['then'](function(_0x713e06){if(_0x713e06){_0x4f7313=_0x713e06[_0x23ff('0x50')];if(!_0x3d6cf9['query']['hasOwnProperty'](_0x23ff('0xbd'))){_0x2e2ca8['limit']=qs[_0x23ff('0x51')](_0x3d6cf9['query']['limit']);_0x2e2ca8[_0x23ff('0x2e')]=qs['offset'](_0x3d6cf9[_0x23ff('0x49')][_0x23ff('0x2e')]);}return _0x3e371c[_0x23ff('0xca')](_0x2e2ca8);}})[_0x23ff('0x20')](function(_0x363ba5){if(_0x363ba5){return _0x363ba5?{'count':_0x4f7313,'rows':_0x363ba5}:null;}})[_0x23ff('0x20')](respondWithResult(_0xf18163,null))[_0x23ff('0x5d')](handleError(_0xf18163,null));};exports[_0x23ff('0xcb')]=function(_0x4bec3f,_0x3d3690,_0x3f3da7){var _0x46e0e3={};var _0x132b12={};var _0x2906ee;var _0x31fabb;return db[_0x23ff('0x43')][_0x23ff('0x8d')]({'where':{'id':_0x4bec3f[_0x23ff('0x62')]['id']}})['then'](handleEntityNotFound(_0x3d3690,null))[_0x23ff('0x20')](function(_0x41dc51){if(_0x41dc51){_0x2906ee=_0x41dc51;_0x132b12[_0x23ff('0x4d')]=_[_0x23ff('0x4a')](db[_0x23ff('0xcc')][_0x23ff('0x44')]);_0x132b12[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x4bec3f[_0x23ff('0x49')]);_0x132b12[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x132b12[_0x23ff('0x4d')],_0x132b12['query']);_0x46e0e3['attributes']=_['intersection'](_0x132b12[_0x23ff('0x4d')],qs[_0x23ff('0x4e')](_0x4bec3f['query'][_0x23ff('0x4e')]));_0x46e0e3[_0x23ff('0x4f')]=_0x46e0e3['attributes']['length']?_0x46e0e3['attributes']:_0x132b12[_0x23ff('0x4d')];_0x46e0e3[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x4bec3f['query'][_0x23ff('0x53')]);_0x46e0e3[_0x23ff('0x54')]=qs[_0x23ff('0x4b')](_[_0x23ff('0xb8')](_0x4bec3f[_0x23ff('0x49')],_0x132b12[_0x23ff('0x4b')]));if(_0x4bec3f['query'][_0x23ff('0xc0')]){_0x46e0e3[_0x23ff('0x54')]=_['merge'](_0x46e0e3[_0x23ff('0x54')],{'$or':_[_0x23ff('0x3b')](_0x46e0e3[_0x23ff('0x4f')],function(_0x2e8a92){var _0x4defea={};_0x4defea[_0x2e8a92]={'$like':'%'+_0x4bec3f['query'][_0x23ff('0xc0')]+'%'};return _0x4defea;})});}_0x46e0e3=_['merge']({},_0x46e0e3,_0x4bec3f[_0x23ff('0x5f')]);return _0x2906ee['getOpenchannelInteractions'](_0x46e0e3);}})[_0x23ff('0x20')](function(_0x45e655){if(_0x45e655){_0x31fabb=_0x45e655[_0x23ff('0x50')];if(!_0x4bec3f['query']['hasOwnProperty'](_0x23ff('0xbd'))){_0x46e0e3['limit']=qs[_0x23ff('0x51')](_0x4bec3f[_0x23ff('0x49')][_0x23ff('0x51')]);_0x46e0e3[_0x23ff('0x2e')]=qs['offset'](_0x4bec3f[_0x23ff('0x49')][_0x23ff('0x2e')]);}return _0x2906ee[_0x23ff('0xcb')](_0x46e0e3);}})[_0x23ff('0x20')](function(_0x3e440b){if(_0x3e440b){return _0x3e440b?{'count':_0x31fabb,'rows':_0x3e440b}:null;}})[_0x23ff('0x20')](respondWithResult(_0x3d3690,null))[_0x23ff('0x5d')](handleError(_0x3d3690,null));};exports['getMailInteractions']=function(_0x2e9536,_0x5606c5,_0xa60a6){var _0x369b7f={'raw':!![],'where':{}};var _0x4b2a85={};var _0x18eb7e={'count':0x0,'rows':[]};return db['User'][_0x23ff('0x8d')]({'where':{'id':_0x2e9536[_0x23ff('0x62')]['id']}})['then'](handleEntityNotFound(_0x5606c5,null))[_0x23ff('0x20')](function(_0xe4234d){if(_0xe4234d){_0x4b2a85[_0x23ff('0x4d')]=_[_0x23ff('0x4a')](db[_0x23ff('0xcd')][_0x23ff('0x44')]);_0x4b2a85[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x2e9536[_0x23ff('0x49')]);_0x4b2a85[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x4b2a85['model'],_0x4b2a85[_0x23ff('0x49')]);_0x369b7f['attributes']=_[_0x23ff('0x4c')](_0x4b2a85[_0x23ff('0x4d')],qs[_0x23ff('0x4e')](_0x2e9536[_0x23ff('0x49')][_0x23ff('0x4e')]));_0x369b7f[_0x23ff('0x4f')]=_0x369b7f[_0x23ff('0x4f')]['length']?_0x369b7f[_0x23ff('0x4f')]:_0x4b2a85[_0x23ff('0x4d')];if(!_0x2e9536['query']['hasOwnProperty'](_0x23ff('0xbd'))){_0x369b7f[_0x23ff('0x51')]=qs[_0x23ff('0x51')](_0x2e9536['query'][_0x23ff('0x51')]);_0x369b7f[_0x23ff('0x2e')]=qs[_0x23ff('0x2e')](_0x2e9536[_0x23ff('0x49')][_0x23ff('0x2e')]);}_0x369b7f[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x2e9536[_0x23ff('0x49')][_0x23ff('0x53')]);_0x369b7f[_0x23ff('0x54')]=qs[_0x23ff('0x4b')](_['pick'](_0x2e9536[_0x23ff('0x49')],_0x4b2a85['filters']));_0x369b7f['where'][_0x23ff('0xce')]=_0xe4234d['id'];if(_0x2e9536[_0x23ff('0x49')][_0x23ff('0xc0')]){_0x369b7f['where']=_[_0x23ff('0x55')](_0x369b7f['where'],{'$or':_[_0x23ff('0x3b')](_0x369b7f[_0x23ff('0x4f')],function(_0x17c40e){var _0x5bed31={};_0x5bed31[_0x17c40e]={'$like':'%'+_0x2e9536[_0x23ff('0x49')][_0x23ff('0xc0')]+'%'};return _0x5bed31;})});}_0x369b7f=_[_0x23ff('0x55')]({},_0x369b7f,_0x2e9536[_0x23ff('0x5f')]);return db[_0x23ff('0xcd')][_0x23ff('0x2d')]({'where':_0x369b7f[_0x23ff('0x54')]})[_0x23ff('0x20')](function(_0x24fbb8){_0x18eb7e[_0x23ff('0x2d')]=_0x24fbb8;if(_0x2e9536[_0x23ff('0x49')][_0x23ff('0x59')]){_0x369b7f[_0x23ff('0x5a')]=[{'all':!![]}];}return db[_0x23ff('0xcd')][_0x23ff('0x5b')](_0x369b7f);})[_0x23ff('0x20')](function(_0x3819b1){_0x18eb7e[_0x23ff('0x5c')]=_0x3819b1;return _0x18eb7e;});}})[_0x23ff('0x20')](respondWithFilteredResult(_0x5606c5,_0x369b7f))[_0x23ff('0x5d')](handleError(_0x5606c5,null));};exports[_0x23ff('0xcf')]=function(_0x5f3d8d,_0x2b7b13,_0x253940){var _0x32dec4={};var _0x3f057a={};var _0x4453bc;var _0x5bfd2b;return db['User']['findOne']({'where':{'id':_0x5f3d8d[_0x23ff('0x62')]['id']}})['then'](handleEntityNotFound(_0x2b7b13,null))[_0x23ff('0x20')](function(_0x52abc0){if(_0x52abc0){_0x4453bc=_0x52abc0;_0x3f057a[_0x23ff('0x4d')]=_[_0x23ff('0x4a')](db[_0x23ff('0xd0')]['rawAttributes']);_0x3f057a[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x5f3d8d['query']);_0x3f057a[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x3f057a[_0x23ff('0x4d')],_0x3f057a[_0x23ff('0x49')]);_0x32dec4[_0x23ff('0x4f')]=_[_0x23ff('0x4c')](_0x3f057a[_0x23ff('0x4d')],qs[_0x23ff('0x4e')](_0x5f3d8d[_0x23ff('0x49')][_0x23ff('0x4e')]));_0x32dec4[_0x23ff('0x4f')]=_0x32dec4[_0x23ff('0x4f')][_0x23ff('0x50')]?_0x32dec4[_0x23ff('0x4f')]:_0x3f057a['model'];_0x32dec4[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x5f3d8d['query'][_0x23ff('0x53')]);_0x32dec4['where']=qs[_0x23ff('0x4b')](_[_0x23ff('0xb8')](_0x5f3d8d[_0x23ff('0x49')],_0x3f057a['filters']));if(_0x5f3d8d[_0x23ff('0x49')]['filter']){_0x32dec4[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0x32dec4[_0x23ff('0x54')],{'$or':_['map'](_0x32dec4[_0x23ff('0x4f')],function(_0x2996f9){var _0xa5a62b={};_0xa5a62b[_0x2996f9]={'$like':'%'+_0x5f3d8d[_0x23ff('0x49')][_0x23ff('0xc0')]+'%'};return _0xa5a62b;})});}_0x32dec4=_['merge']({},_0x32dec4,_0x5f3d8d[_0x23ff('0x5f')]);return _0x4453bc[_0x23ff('0xcf')](_0x32dec4);}})[_0x23ff('0x20')](function(_0x9ce52c){if(_0x9ce52c){_0x5bfd2b=_0x9ce52c['length'];if(!_0x5f3d8d[_0x23ff('0x49')][_0x23ff('0xbc')](_0x23ff('0xbd'))){_0x32dec4[_0x23ff('0x51')]=qs[_0x23ff('0x51')](_0x5f3d8d[_0x23ff('0x49')][_0x23ff('0x51')]);_0x32dec4['offset']=qs[_0x23ff('0x2e')](_0x5f3d8d[_0x23ff('0x49')][_0x23ff('0x2e')]);}return _0x4453bc[_0x23ff('0xcf')](_0x32dec4);}})['then'](function(_0x3a1b47){if(_0x3a1b47){return _0x3a1b47?{'count':_0x5bfd2b,'rows':_0x3a1b47}:null;}})['then'](respondWithResult(_0x2b7b13,null))[_0x23ff('0x5d')](handleError(_0x2b7b13,null));};exports[_0x23ff('0xd1')]=function(_0x5ef696,_0x4f3ec6,_0x44551c){var _0x308e8d={};var _0x65a18a={};var _0x478c0a;var _0x446e2b;return db[_0x23ff('0x43')]['findOne']({'where':{'id':_0x5ef696['params']['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x4f3ec6,null))[_0x23ff('0x20')](function(_0x4e501a){if(_0x4e501a){_0x478c0a=_0x4e501a;_0x65a18a[_0x23ff('0x4d')]=_['keys'](db['FaxInteraction'][_0x23ff('0x44')]);_0x65a18a[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x5ef696[_0x23ff('0x49')]);_0x65a18a['filters']=_[_0x23ff('0x4c')](_0x65a18a[_0x23ff('0x4d')],_0x65a18a[_0x23ff('0x49')]);_0x308e8d[_0x23ff('0x4f')]=_[_0x23ff('0x4c')](_0x65a18a[_0x23ff('0x4d')],qs[_0x23ff('0x4e')](_0x5ef696[_0x23ff('0x49')][_0x23ff('0x4e')]));_0x308e8d['attributes']=_0x308e8d[_0x23ff('0x4f')]['length']?_0x308e8d[_0x23ff('0x4f')]:_0x65a18a[_0x23ff('0x4d')];_0x308e8d[_0x23ff('0x52')]=qs['sort'](_0x5ef696['query'][_0x23ff('0x53')]);_0x308e8d[_0x23ff('0x54')]=qs['filters'](_[_0x23ff('0xb8')](_0x5ef696[_0x23ff('0x49')],_0x65a18a[_0x23ff('0x4b')]));if(_0x5ef696['query']['filter']){_0x308e8d[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0x308e8d[_0x23ff('0x54')],{'$or':_['map'](_0x308e8d['attributes'],function(_0x44b6d2){var _0x22be20={};_0x22be20[_0x44b6d2]={'$like':'%'+_0x5ef696[_0x23ff('0x49')]['filter']+'%'};return _0x22be20;})});}_0x308e8d=_[_0x23ff('0x55')]({},_0x308e8d,_0x5ef696['options']);return _0x478c0a[_0x23ff('0xd1')](_0x308e8d);}})[_0x23ff('0x20')](function(_0x40cc0b){if(_0x40cc0b){_0x446e2b=_0x40cc0b[_0x23ff('0x50')];if(!_0x5ef696[_0x23ff('0x49')][_0x23ff('0xbc')](_0x23ff('0xbd'))){_0x308e8d[_0x23ff('0x51')]=qs[_0x23ff('0x51')](_0x5ef696[_0x23ff('0x49')][_0x23ff('0x51')]);_0x308e8d[_0x23ff('0x2e')]=qs[_0x23ff('0x2e')](_0x5ef696['query'][_0x23ff('0x2e')]);}return _0x478c0a[_0x23ff('0xd1')](_0x308e8d);}})['then'](function(_0x38e0a3){if(_0x38e0a3){return _0x38e0a3?{'count':_0x446e2b,'rows':_0x38e0a3}:null;}})[_0x23ff('0x20')](respondWithResult(_0x4f3ec6,null))[_0x23ff('0x5d')](handleError(_0x4f3ec6,null));};exports[_0x23ff('0xd2')]=function(_0x238951,_0x3b5689,_0x3ee862){var _0x594b38={};var _0x3109be={};var _0x5eb8d9;var _0x270130;return db[_0x23ff('0x43')][_0x23ff('0x8d')]({'where':{'id':_0x238951[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x3b5689,null))[_0x23ff('0x20')](function(_0xcb439a){if(_0xcb439a){_0x5eb8d9=_0xcb439a;_0x3109be[_0x23ff('0x4d')]=_[_0x23ff('0x4a')](db[_0x23ff('0xd3')][_0x23ff('0x44')]);_0x3109be[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x238951[_0x23ff('0x49')]);_0x3109be['filters']=_['intersection'](_0x3109be[_0x23ff('0x4d')],_0x3109be[_0x23ff('0x49')]);_0x594b38[_0x23ff('0x4f')]=_[_0x23ff('0x4c')](_0x3109be[_0x23ff('0x4d')],qs[_0x23ff('0x4e')](_0x238951[_0x23ff('0x49')][_0x23ff('0x4e')]));_0x594b38[_0x23ff('0x4f')]=_0x594b38[_0x23ff('0x4f')][_0x23ff('0x50')]?_0x594b38[_0x23ff('0x4f')]:_0x3109be[_0x23ff('0x4d')];_0x594b38['order']=qs[_0x23ff('0x53')](_0x238951[_0x23ff('0x49')][_0x23ff('0x53')]);_0x594b38['where']=qs[_0x23ff('0x4b')](_[_0x23ff('0xb8')](_0x238951[_0x23ff('0x49')],_0x3109be[_0x23ff('0x4b')]));if(_0x238951[_0x23ff('0x49')][_0x23ff('0xc0')]){_0x594b38[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0x594b38[_0x23ff('0x54')],{'$or':_[_0x23ff('0x3b')](_0x594b38[_0x23ff('0x4f')],function(_0x3444de){var _0x4901e2={};_0x4901e2[_0x3444de]={'$like':'%'+_0x238951['query'][_0x23ff('0xc0')]+'%'};return _0x4901e2;})});}_0x594b38=_[_0x23ff('0x55')]({},_0x594b38,_0x238951[_0x23ff('0x5f')]);return _0x5eb8d9[_0x23ff('0xd2')](_0x594b38);}})[_0x23ff('0x20')](function(_0x50d781){if(_0x50d781){_0x270130=_0x50d781['length'];if(!_0x238951[_0x23ff('0x49')][_0x23ff('0xbc')]('nolimit')){_0x594b38[_0x23ff('0x51')]=qs[_0x23ff('0x51')](_0x238951[_0x23ff('0x49')][_0x23ff('0x51')]);_0x594b38[_0x23ff('0x2e')]=qs[_0x23ff('0x2e')](_0x238951[_0x23ff('0x49')][_0x23ff('0x2e')]);}return _0x5eb8d9[_0x23ff('0xd2')](_0x594b38);}})[_0x23ff('0x20')](function(_0x56459b){if(_0x56459b){return _0x56459b?{'count':_0x270130,'rows':_0x56459b}:null;}})[_0x23ff('0x20')](respondWithResult(_0x3b5689,null))[_0x23ff('0x5d')](handleError(_0x3b5689,null));};exports[_0x23ff('0xd4')]=function(_0x382017,_0xa4ba2a,_0x335507){var _0x54ed18;var _0x225fc1;var _0x4c8092;var _0x19f0e6=!_[_0x23ff('0x6b')](_0x382017['params']['id'])?_0x382017['params']['id']:!_['isNil'](_0x382017[_0x23ff('0x36')]['id'])?_0x382017[_0x23ff('0x36')]['id']:null;return db[_0x23ff('0x43')]['find']({'where':{'id':_0x19f0e6,'role':{'$or':[_0x23ff('0x66'),_0x23ff('0x36'),_0x23ff('0x38')]}},'attributes':['id','name',_0x23ff('0xd5'),'mobile',_0x23ff('0x3f'),_0x23ff('0x6e'),_0x23ff('0xd6')]})[_0x23ff('0x20')](function(_0x358d12){if(_0x358d12){if(_0x358d12['role']===_0x23ff('0x38')){_0x54ed18=_0x358d12;if(_0x382017[_0x23ff('0x61')][_0x23ff('0x99')]){_0x4c8092=util[_0x23ff('0xd7')](_0x23ff('0xd8'),_0x54ed18[_0x382017['body'][_0x23ff('0x99')]]);}else if(_0x382017[_0x23ff('0x61')][_0x23ff('0xd9')]){_0x4c8092=util[_0x23ff('0xd7')](_0x23ff('0xa6'),_0x382017[_0x23ff('0x61')]['intrf']);}else{_0x4c8092=util[_0x23ff('0xd7')](_0x23ff('0xa6'),_0x54ed18[_0x23ff('0x40')]);}socket['to'](util['format']('user:%s',_0x54ed18[_0x23ff('0x40')]))[_0x23ff('0xa3')](_0x23ff('0xda'),{'ip':_0x382017[_0x23ff('0xdb')][_0x23ff('0xdc')]||_0x382017['connection']['remoteAddress']||_0x382017[_0x23ff('0xdd')][_0x23ff('0xde')]||_0x382017[_0x23ff('0xdf')][_0x23ff('0xdd')][_0x23ff('0xde')]});return db[_0x23ff('0xa9')]['destroy']({'where':{'membername':_0x54ed18[_0x23ff('0x40')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x23ff('0x91'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x23ff('0x20')](function(){if(_0x54ed18){return _0x54ed18[_0x23ff('0xe0')]({'raw':!![]});}})[_0x23ff('0x20')](function(_0x36b5b0){if(_0x54ed18){var _0x5d8c7b=[];if(_0x36b5b0){_0x225fc1=_0x36b5b0;if(_0x225fc1['length']){for(var _0x18a7ad=0x0;_0x18a7ad<_0x225fc1[_0x23ff('0x50')];_0x18a7ad++){_0x5d8c7b['push']({'membername':_0x54ed18[_0x23ff('0x40')],'UserId':_0x54ed18['id'],'queue_name':_0x225fc1[_0x18a7ad]['name'],'VoiceQueueId':_0x225fc1[_0x18a7ad]['id'],'interface':_0x4c8092,'paused':_0x54ed18[_0x23ff('0xd6')]||![],'penalty':_0x225fc1[_0x18a7ad][_0x23ff('0xe1')]||0x0});}return BPromise[_0x23ff('0xa8')](_0x5d8c7b,function(_0x23128d){return db[_0x23ff('0xa9')][_0x23ff('0xe2')](_0x23128d);});}}}})[_0x23ff('0x20')](function(){if(_0x54ed18){return db[_0x23ff('0xe3')][_0x23ff('0x5b')]({'where':{'membername':_0x54ed18[_0x23ff('0x40')],'exitAt':null}});}})[_0x23ff('0x20')](function(_0xe354fa){if(_0x54ed18){var _0x368364=[];_0xe354fa['forEach'](function(_0x503f8b){_0x368364[_0x23ff('0xa5')](_0x503f8b[_0x23ff('0x32')]({'exitAt':moment()[_0x23ff('0xd7')](_0x23ff('0xe4'))}));});return BPromise[_0x23ff('0xe5')](_0x368364);}})[_0x23ff('0x20')](function(){if(_0x54ed18){var _0x3a5af8=[];var _0x5e8559=[];var _0x1d9f3c=utils[_0x23ff('0xe6')]();var _0x90f6ea={'membername':_0x54ed18[_0x23ff('0x40')],'interface':_0x4c8092,'enterAt':moment()[_0x23ff('0xd7')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x54ed18[_0x23ff('0x3f')],'internal':_0x54ed18[_0x23ff('0x6e')]};_0x1d9f3c[_0x23ff('0xe7')](function(_0x98c4ea){_0x3a5af8[_0x23ff('0xa5')](_[_0x23ff('0x55')]({'channel':_0x98c4ea,'type':_0x23ff('0xe8'),'data1':_0x382017[_0x23ff('0x61')][_0x23ff('0xe9')],'data2':_0x4c8092},_0x90f6ea));if(_0x54ed18[_0x23ff('0xd6')]){_0x5e8559[_0x23ff('0xa5')](_[_0x23ff('0x55')]({'channel':_0x98c4ea,'type':'PAUSE','data1':'LOGININPAUSE'},_0x90f6ea));}});return db[_0x23ff('0xe3')]['bulkCreate'](_0x3a5af8[_0x23ff('0xea')](_0x5e8559),{'individualHooks':!![]});}})[_0x23ff('0x20')](function(){if(_0x54ed18){return _0x54ed18['update']({'online':!![],'lastLoginAt':moment()[_0x23ff('0xd7')](_0x23ff('0xe4')),'voicePause':_0x54ed18[_0x23ff('0xd6')]||![],'mailPause':_0x54ed18[_0x23ff('0xd6')]||![],'chatPause':_0x54ed18[_0x23ff('0xd6')]||![],'faxPause':_0x54ed18[_0x23ff('0xd6')]||![],'smsPause':_0x54ed18[_0x23ff('0xd6')]||![],'openchannelPause':_0x54ed18[_0x23ff('0xd6')]||![],'whatsappPause':_0x54ed18[_0x23ff('0xd6')]||![],'pauseType':_0x54ed18[_0x23ff('0xd6')]?_0x23ff('0xeb'):null,'interface':_0x4c8092,'lastPauseAt':moment()[_0x23ff('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x23ff('0x20')](function(_0x2c7e21){if(_0x382017[_0x23ff('0xec')]){return _0x335507();}else{return BPromise[_0x23ff('0xed')](_0x2c7e21)[_0x23ff('0x20')](respondWithResult(_0xa4ba2a,null));}})[_0x23ff('0x5d')](handleError(_0xa4ba2a,null));};exports[_0x23ff('0xee')]=function(_0x470217,_0x234f5a,_0x3e35bf){var _0x18b2e0;return db[_0x23ff('0x43')][_0x23ff('0x3e')]({'where':{'id':_0x470217['params']['id'],'role':_0x23ff('0x38')},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x234f5a,null))[_0x23ff('0x20')](function(_0x156f28){if(_0x156f28){_0x18b2e0=_0x156f28;return db[_0x23ff('0xa9')][_0x23ff('0x33')]({'where':{'membername':_0x18b2e0[_0x23ff('0x40')]},'individualHooks':!![]});}})[_0x23ff('0x20')](function(){return db[_0x23ff('0xe3')]['findAll']({'where':{'membername':_0x18b2e0['name'],'exitAt':null}});})[_0x23ff('0x20')](function(_0x1342d9){var _0x40a17b=[];_0x1342d9['forEach'](function(_0xe98c51){_0x40a17b[_0x23ff('0xa5')](_0xe98c51[_0x23ff('0x32')]({'exitAt':moment()[_0x23ff('0xd7')](_0x23ff('0xe4'))}));});return BPromise[_0x23ff('0xe5')](_0x40a17b);})[_0x23ff('0x20')](function(){return _0x18b2e0[_0x23ff('0x32')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x23ff('0x20')](respondWithResult(_0x234f5a,null))[_0x23ff('0x5d')](handleError(_0x234f5a,null));};exports[_0x23ff('0xef')]=function(_0x51192b,_0x5db7bf,_0x21c5c6){var _0x314d72;return db[_0x23ff('0xa9')]['update']({'paused':0x1},{'where':{'UserId':_0x51192b['params']['id']},'individualHooks':!![]})[_0x23ff('0x20')](function(){return db[_0x23ff('0x43')]['find']({'where':{'id':_0x51192b[_0x23ff('0x62')]['id'],'role':'agent'},'attributes':['id','name',_0x23ff('0x3f'),_0x23ff('0x6e'),_0x23ff('0x99')]});})[_0x23ff('0x20')](handleEntityNotFound(_0x5db7bf,null))[_0x23ff('0x20')](function(_0x48f49e){if(_0x48f49e){_0x314d72=_0x48f49e;return respondWithRpcPromise(_0x23ff('0xf0'),_0x23ff('0xef'),{'id':_0x314d72['id'],'name':_0x314d72[_0x23ff('0x40')],'pause':!![]});}})[_0x23ff('0x20')](function(){if(_0x314d72){return db['MemberReport'][_0x23ff('0x5b')]({'where':{'membername':_0x314d72[_0x23ff('0x40')],'type':_0x23ff('0xf1'),'exitAt':null}});}})[_0x23ff('0x20')](function(_0x203a60){if(_0x203a60[_0x23ff('0x50')]){var _0x408c56=moment()[_0x23ff('0xd7')](_0x23ff('0xe4'));for(var _0x13c1c7=0x0,_0xd035be=_0x203a60[_0x23ff('0x50')];_0x13c1c7<_0xd035be;_0x13c1c7++){_0x203a60[_0x13c1c7][_0x23ff('0xf2')]({'exitAt':_0x408c56});}}})[_0x23ff('0x20')](function(){var _0x37db6a=[];var _0x43b63c=utils[_0x23ff('0xe6')]();_0x43b63c[_0x23ff('0xe7')](function(_0x16fe9b){_0x37db6a[_0x23ff('0xa5')]({'channel':_0x16fe9b,'membername':_0x314d72[_0x23ff('0x40')],'interface':_[_0x23ff('0x6b')](_0x314d72[_0x23ff('0x99')])?util[_0x23ff('0xd7')]('SIP/%s',_0x314d72[_0x23ff('0x40')]):_0x314d72[_0x23ff('0x99')],'type':_0x23ff('0xf1'),'enterAt':moment()[_0x23ff('0xd7')](_0x23ff('0xe4')),'data1':_0x51192b[_0x23ff('0x61')][_0x23ff('0x45')]||_0x23ff('0xf3'),'role':_0x314d72[_0x23ff('0x3f')],'internal':_0x314d72['internal']});});return db[_0x23ff('0xe3')][_0x23ff('0x60')](_0x37db6a,{'individualHooks':!![]});})[_0x23ff('0x20')](function(){return _0x314d72[_0x23ff('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x51192b[_0x23ff('0x61')]['type']||_0x23ff('0xf3'),'lastPauseAt':moment()[_0x23ff('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x23ff('0x20')](respondWithResult(_0x5db7bf,null))[_0x23ff('0x5d')](handleError(_0x5db7bf,null));};exports['unpause']=function(_0x8bde00,_0x3a323f,_0x92fdda){var _0x3efbff;return db['User'][_0x23ff('0x3e')]({'where':{'id':_0x8bde00[_0x23ff('0x62')]['id']},'attributes':['id',_0x23ff('0x40'),'role',_0x23ff('0xa7'),_0x23ff('0xf4'),_0x23ff('0xf5'),_0x23ff('0xf6'),_0x23ff('0xf7'),_0x23ff('0xf8'),'whatsapppause','pauseType',_0x23ff('0xf9')]})[_0x23ff('0x20')](handleEntityNotFound(_0x3a323f,null))[_0x23ff('0x20')](function(_0x258397){if(_0x258397){_0x3efbff=_0x258397;if(_0x8bde00['body'][_0x23ff('0x98')]&&!utils[_0x23ff('0x9a')](_0x8bde00['body'][_0x23ff('0x98')])){throw new db[(_0x23ff('0x90'))][(_0x23ff('0x91'))](_0x23ff('0xfa'));}switch(_0x8bde00[_0x23ff('0x61')]['channel']){case _0x23ff('0xa4'):return respondWithRpcPromise(_0x23ff('0xf0'),_0x23ff('0xfb'),{'id':_0x3efbff['id'],'name':_0x3efbff[_0x23ff('0x40')],'pause':![]})[_0x23ff('0x20')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x3efbff['id']},'individualHooks':!![]});})[_0x23ff('0x20')](function(){return db['MemberReport']['find']({'where':{'channel':_0x8bde00[_0x23ff('0x61')][_0x23ff('0x98')],'membername':_0x3efbff['name'],'type':_0x23ff('0xf1'),'exitAt':null}});})[_0x23ff('0x20')](function(_0x5c88be){if(_0x5c88be){return _0x5c88be[_0x23ff('0x32')]({'exitAt':moment()[_0x23ff('0xd7')](_0x23ff('0xe4')),'data2':_0x23ff('0xfc')},{'individualHooks':!![]});}return null;})[_0x23ff('0x20')](function(){return _0x3efbff[_0x23ff('0x32')]({'voicePause':![]});});case _0x23ff('0xfd'):case _0x23ff('0xfe'):case _0x23ff('0xff'):case _0x23ff('0x100'):case _0x23ff('0x101'):case'openchannel':return db[_0x23ff('0xe3')][_0x23ff('0x3e')]({'where':{'channel':_0x8bde00[_0x23ff('0x61')][_0x23ff('0x98')],'membername':_0x3efbff[_0x23ff('0x40')],'type':_0x23ff('0xf1'),'exitAt':null}})[_0x23ff('0x20')](function(_0x4af2fc){if(_0x4af2fc){return _0x4af2fc[_0x23ff('0x32')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x23ff('0xfc')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x3c2ac0={};_[_0x23ff('0x102')](_0x3c2ac0,util[_0x23ff('0xd7')]('%s%s',_0x8bde00[_0x23ff('0x61')][_0x23ff('0x98')],_0x23ff('0x103')),![]);return _0x3efbff[_0x23ff('0x32')](_0x3c2ac0);});default:return respondWithRpcPromise('QueuePause',_0x23ff('0xfb'),{'id':_0x3efbff['id'],'name':_0x3efbff[_0x23ff('0x40')],'pause':![]})[_0x23ff('0x20')](function(){return db[_0x23ff('0xa9')]['update']({'paused':0x0},{'where':{'UserId':_0x3efbff['id']}});})[_0x23ff('0x20')](function(){return db[_0x23ff('0xe3')][_0x23ff('0x5b')]({'where':{'membername':_0x3efbff[_0x23ff('0x40')],'type':_0x23ff('0xf1'),'exitAt':null}});})['then'](function(_0x479a7d){var _0x34dd0b=[];_0x479a7d[_0x23ff('0xe7')](function(_0x1bce45){_0x34dd0b['push'](_0x1bce45[_0x23ff('0x32')]({'exitAt':moment()['format'](_0x23ff('0xe4')),'data2':_0x23ff('0xfc')}));});return BPromise[_0x23ff('0xe5')](_0x34dd0b);})[_0x23ff('0x20')](function(){return _0x3efbff[_0x23ff('0x32')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x23ff('0x20')](respondWithResult(_0x3a323f,null))[_0x23ff('0x5d')](handleError(_0x3a323f,null));};exports[_0x23ff('0x104')]=function(_0x29f6ab,_0x5b7d02,_0x21ec96){var _0xfe101e={};var _0x4d1686={};var _0x2880af;var _0x118558;return db[_0x23ff('0x43')][_0x23ff('0x8d')]({'where':{'id':_0x29f6ab['params']['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x5b7d02,null))[_0x23ff('0x20')](function(_0x4cd0a9){if(_0x4cd0a9){_0x2880af=_0x4cd0a9;_0x4d1686[_0x23ff('0x4d')]=_['keys'](db[_0x23ff('0x105')][_0x23ff('0x44')]);_0x4d1686[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x29f6ab['query']);_0x4d1686['filters']=_[_0x23ff('0x4c')](_0x4d1686['model'],_0x4d1686[_0x23ff('0x49')]);_0xfe101e[_0x23ff('0x4f')]=_[_0x23ff('0x4c')](_0x4d1686[_0x23ff('0x4d')],qs[_0x23ff('0x4e')](_0x29f6ab[_0x23ff('0x49')][_0x23ff('0x4e')]));_0xfe101e['attributes']=_0xfe101e[_0x23ff('0x4f')]['length']?_0xfe101e[_0x23ff('0x4f')]:_0x4d1686[_0x23ff('0x4d')];_0xfe101e[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x29f6ab[_0x23ff('0x49')][_0x23ff('0x53')]);_0xfe101e['where']=qs[_0x23ff('0x4b')](_[_0x23ff('0xb8')](_0x29f6ab['query'],_0x4d1686[_0x23ff('0x4b')]));if(_0x29f6ab[_0x23ff('0x49')][_0x23ff('0xc0')]){_0xfe101e[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0xfe101e[_0x23ff('0x54')],{'$or':_[_0x23ff('0x3b')](_0xfe101e[_0x23ff('0x4f')],function(_0xb14003){var _0x3735c6={};_0x3735c6[_0xb14003]={'$like':'%'+_0x29f6ab[_0x23ff('0x49')][_0x23ff('0xc0')]+'%'};return _0x3735c6;})});}_0xfe101e=_[_0x23ff('0x55')]({},_0xfe101e,_0x29f6ab[_0x23ff('0x5f')]);return _0x2880af[_0x23ff('0x104')](_0xfe101e);}})[_0x23ff('0x20')](function(_0x2c11d7){if(_0x2c11d7){_0x118558=_0x2c11d7['length'];if(!_0x29f6ab[_0x23ff('0x49')][_0x23ff('0xbc')](_0x23ff('0xbd'))){_0xfe101e[_0x23ff('0x51')]=qs['limit'](_0x29f6ab[_0x23ff('0x49')]['limit']);_0xfe101e[_0x23ff('0x2e')]=qs[_0x23ff('0x2e')](_0x29f6ab[_0x23ff('0x49')][_0x23ff('0x2e')]);}return _0x2880af['getTeams'](_0xfe101e);}})['then'](function(_0x45540a){if(_0x45540a){return _0x45540a?{'count':_0x118558,'rows':_0x45540a}:null;}})[_0x23ff('0x20')](respondWithResult(_0x5b7d02,null))['catch'](handleError(_0x5b7d02,null));};exports[_0x23ff('0x106')]=function(_0x253c6f,_0x5e6357){return db[_0x23ff('0x43')][_0x23ff('0x3e')]({'where':{'id':_0x253c6f[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x5e6357,null))['then'](function(_0x1154db){if(_0x1154db){var _0x1b47ee=_0x1154db['get']({'plain':!![]});return _0x1154db[_0x23ff('0x106')](_0x253c6f['body'][_0x23ff('0xa2')],_[_0x23ff('0x107')](_0x253c6f[_0x23ff('0x61')],[_0x23ff('0xa2'),'id'])||{})[_0x23ff('0x20')](function(){for(var _0x8351ec=0x0;_0x8351ec<_0x253c6f[_0x23ff('0x61')][_0x23ff('0xa2')][_0x23ff('0x50')];_0x8351ec++){var _0x2c3ed3=[];db[_0x23ff('0x105')][_0x23ff('0x8d')]({'where':{'id':_0x253c6f['body'][_0x23ff('0xa2')][_0x8351ec]}})['then'](function(_0x1a8f5c){_0x2c3ed3[_0x23ff('0xa5')](_0x1a8f5c[_0x23ff('0xe0')]()['then'](function(_0xcd6893){for(var _0x14cae7=0x0;_0x14cae7<_0xcd6893['length'];_0x14cae7++){_0xcd6893[_0x14cae7][_0x23ff('0x108')](_0x23ff('0x98'),_0x23ff('0x109'));}return _0xcd6893;}));_0x2c3ed3[_0x23ff('0xa5')](_0x1a8f5c[_0x23ff('0x10a')]()[_0x23ff('0x20')](function(_0x159bb1){for(var _0xb602d9=0x0;_0xb602d9<_0x159bb1[_0x23ff('0x50')];_0xb602d9++){_0x159bb1[_0xb602d9][_0x23ff('0x108')]('channel',_0x23ff('0x10b'));}return _0x159bb1;}));_0x2c3ed3[_0x23ff('0xa5')](_0x1a8f5c[_0x23ff('0x10c')]()[_0x23ff('0x20')](function(_0x430cc8){for(var _0x239575=0x0;_0x239575<_0x430cc8[_0x23ff('0x50')];_0x239575++){_0x430cc8[_0x239575]['setDataValue']('channel','Mail');}return _0x430cc8;}));_0x2c3ed3[_0x23ff('0xa5')](_0x1a8f5c['getSmsQueues']()['then'](function(_0x3e53ca){for(var _0x4033b6=0x0;_0x4033b6<_0x3e53ca['length'];_0x4033b6++){_0x3e53ca[_0x4033b6][_0x23ff('0x108')](_0x23ff('0x98'),_0x23ff('0x10d'));}return _0x3e53ca;}));_0x2c3ed3[_0x23ff('0xa5')](_0x1a8f5c[_0x23ff('0x10e')]()[_0x23ff('0x20')](function(_0x3ed2b4){for(var _0x3e56dc=0x0;_0x3e56dc<_0x3ed2b4[_0x23ff('0x50')];_0x3e56dc++){_0x3ed2b4[_0x3e56dc]['setDataValue'](_0x23ff('0x98'),_0x23ff('0x10f'));}return _0x3ed2b4;}));_0x2c3ed3[_0x23ff('0xa5')](_0x1a8f5c[_0x23ff('0x110')]()['then'](function(_0xf04e22){for(var _0x581353=0x0;_0x581353<_0xf04e22['length'];_0x581353++){_0xf04e22[_0x581353][_0x23ff('0x108')](_0x23ff('0x98'),'Fax');}return _0xf04e22;}));_0x2c3ed3[_0x23ff('0xa5')](_0x1a8f5c['getOpenchannelQueues']()['then'](function(_0x28a43c){for(var _0x323efd=0x0;_0x323efd<_0x28a43c[_0x23ff('0x50')];_0x323efd++){_0x28a43c[_0x323efd]['setDataValue'](_0x23ff('0x98'),'Openchannel');}return _0x28a43c;}));return BPromise[_0x23ff('0xe5')](_0x2c3ed3);})['then'](function(_0xec44cf){var _0x3d72ea=_['flatten'](_0xec44cf);_0x2c3ed3=[];return db['sequelize'][_0x23ff('0x111')](function(_0x3bbcbe){for(var _0x9761be=0x0;_0x9761be<_0x3d72ea[_0x23ff('0x50')];_0x9761be++){_0x2c3ed3['push'](_0x3d72ea[_0x9761be][_0x23ff('0x112')](_0x1b47ee['id']),{'transaction':_0x3bbcbe});}return BPromise[_0x23ff('0xe5')](_0x2c3ed3)[_0x23ff('0x20')](function(){if(_0x1b47ee['online']){return BPromise['each'](_[_0x23ff('0xc0')](_0x3d72ea,function(_0x1118be){return _0x1118be[_0x23ff('0x113')]('channel')===_0x23ff('0x109');}),function(_0x3570aa){return db[_0x23ff('0xa9')][_0x23ff('0xe2')]({'membername':_0x1b47ee[_0x23ff('0x40')],'UserId':_0x1b47ee['id'],'queue_name':_0x3570aa['name'],'VoiceQueueId':_0x3570aa['id'],'interface':_[_0x23ff('0x6b')](_0x1b47ee['interface'])?util[_0x23ff('0xd7')]('SIP/%s',_0x1b47ee[_0x23ff('0x40')]):_0x1b47ee[_0x23ff('0x99')],'paused':_0x1b47ee[_0x23ff('0xa7')]||![],'penalty':_0x1b47ee[_0x23ff('0x9f')]},{'transaction':_0x3bbcbe});});}else{return;}})[_0x23ff('0x20')](function(){for(var _0x3f04b7=0x0;_0x3f04b7<_0x3d72ea[_0x23ff('0x50')];_0x3f04b7++){var _0x463f6c=_0x3d72ea[_0x3f04b7][_0x23ff('0x113')](_0x23ff('0x98'));var _0x1b43cd=_0x463f6c+'QueueId';socket[_0x23ff('0xa3')]('user'+_0x463f6c+_0x23ff('0x114'),{'UserId':_0x1b47ee['id'],['queueField']:_0x3d72ea[_0x3f04b7]['id']});}});});});}});}})[_0x23ff('0x20')](respondWithStatusCode(_0x5e6357,null))[_0x23ff('0x5d')](handleError(_0x5e6357,null));};exports[_0x23ff('0x115')]=function(_0xc98bf0,_0x3102fe){return db[_0x23ff('0x43')][_0x23ff('0x8d')]({'where':{'id':_0xc98bf0['params']['id']}})['then'](handleEntityNotFound(_0x3102fe,null))[_0x23ff('0x20')](function(_0x2c9a24){if(_0x2c9a24){var _0x17286f=_0x2c9a24[_0x23ff('0x34')]({'plain':!![]});var _0x2ccfd6=_0xc98bf0[_0x23ff('0x49')][_0x23ff('0xa2')];return _0x2c9a24[_0x23ff('0x115')](_0x2ccfd6)[_0x23ff('0x20')](function(){for(var _0x53993a=0x0;_0x53993a<_0x2ccfd6[_0x23ff('0x50')];_0x53993a++){var _0x29991a=[];db['Team']['findOne']({'where':{'id':_0x2ccfd6[_0x53993a]}})['then'](function(_0x4e2b2c){_0x29991a[_0x23ff('0xa5')](_0x4e2b2c[_0x23ff('0xe0')]()[_0x23ff('0x20')](function(_0x3f2c12){for(var _0xfbf808=0x0;_0xfbf808<_0x3f2c12[_0x23ff('0x50')];_0xfbf808++){_0x3f2c12[_0xfbf808][_0x23ff('0x108')]('channel',_0x23ff('0x109'));}return _0x3f2c12;}));_0x29991a[_0x23ff('0xa5')](_0x4e2b2c[_0x23ff('0x10a')]()[_0x23ff('0x20')](function(_0x40e094){for(var _0x1ae87e=0x0;_0x1ae87e<_0x40e094[_0x23ff('0x50')];_0x1ae87e++){_0x40e094[_0x1ae87e][_0x23ff('0x108')](_0x23ff('0x98'),'Chat');}return _0x40e094;}));_0x29991a[_0x23ff('0xa5')](_0x4e2b2c[_0x23ff('0x10c')]()['then'](function(_0x529104){for(var _0x3c6cec=0x0;_0x3c6cec<_0x529104[_0x23ff('0x50')];_0x3c6cec++){_0x529104[_0x3c6cec][_0x23ff('0x108')](_0x23ff('0x98'),_0x23ff('0x116'));}return _0x529104;}));_0x29991a[_0x23ff('0xa5')](_0x4e2b2c['getSmsQueues']()[_0x23ff('0x20')](function(_0x5d238a){for(var _0x50e9f8=0x0;_0x50e9f8<_0x5d238a[_0x23ff('0x50')];_0x50e9f8++){_0x5d238a[_0x50e9f8]['setDataValue']('channel',_0x23ff('0x10d'));}return _0x5d238a;}));_0x29991a[_0x23ff('0xa5')](_0x4e2b2c[_0x23ff('0x10e')]()[_0x23ff('0x20')](function(_0x5c1e69){for(var _0x3aad70=0x0;_0x3aad70<_0x5c1e69[_0x23ff('0x50')];_0x3aad70++){_0x5c1e69[_0x3aad70]['setDataValue'](_0x23ff('0x98'),_0x23ff('0x10f'));}return _0x5c1e69;}));_0x29991a['push'](_0x4e2b2c[_0x23ff('0x110')]()[_0x23ff('0x20')](function(_0x37b719){for(var _0x5ca204=0x0;_0x5ca204<_0x37b719[_0x23ff('0x50')];_0x5ca204++){_0x37b719[_0x5ca204]['setDataValue'](_0x23ff('0x98'),_0x23ff('0x117'));}return _0x37b719;}));_0x29991a[_0x23ff('0xa5')](_0x4e2b2c['getOpenchannelQueues']()[_0x23ff('0x20')](function(_0x5bb81c){for(var _0x598bbc=0x0;_0x598bbc<_0x5bb81c[_0x23ff('0x50')];_0x598bbc++){_0x5bb81c[_0x598bbc]['setDataValue'](_0x23ff('0x98'),_0x23ff('0x118'));}return _0x5bb81c;}));return BPromise[_0x23ff('0xe5')](_0x29991a);})['then'](function(_0x1cf0c4){var _0x5ce8b5=_[_0x23ff('0x119')](_0x1cf0c4);_0x29991a=[];return db[_0x23ff('0x57')][_0x23ff('0x111')](function(_0x2fb45b){for(var _0x1541a2=0x0;_0x1541a2<_0x5ce8b5[_0x23ff('0x50')];_0x1541a2++){_0x29991a['push'](_0x5ce8b5[_0x1541a2][_0x23ff('0x11a')](_0x17286f['id']),{'transaction':_0x2fb45b});}return BPromise['all'](_0x29991a)['then'](function(){if(_0x17286f['online']){return BPromise['each'](_[_0x23ff('0xc0')](_0x5ce8b5,function(_0x447bec){return _0x447bec[_0x23ff('0x113')](_0x23ff('0x98'))===_0x23ff('0x109');}),function(_0x2856fa){return db[_0x23ff('0xa9')]['destroy']({'where':{'VoiceQueueId':_0x2856fa['id'],'UserId':_0x17286f['id']},'transaction':_0x2fb45b});});}else{return;}})[_0x23ff('0x20')](function(){for(var _0x577f5f=0x0;_0x577f5f<_0x5ce8b5[_0x23ff('0x50')];_0x577f5f++){var _0x5ad25a=_0x5ce8b5[_0x577f5f][_0x23ff('0x113')](_0x23ff('0x98'));var _0x9d8a2=_0x5ad25a+_0x23ff('0xa1');socket[_0x23ff('0xa3')](_0x23ff('0x36')+_0x5ad25a+_0x23ff('0xac'),{'UserId':_0x17286f['id'],['queueField']:_0x5ce8b5[_0x577f5f]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x3102fe,null))[_0x23ff('0x5d')](handleError(_0x3102fe,null));};exports[_0x23ff('0x11b')]=function(_0x88c1,_0x149cd1,_0x510ce9){var _0x5d00b0={};var _0x22e4b3={};var _0x58e9ba;var _0x5870ed;return db[_0x23ff('0x43')][_0x23ff('0x8d')]({'where':{'id':_0x88c1[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x149cd1,null))[_0x23ff('0x20')](function(_0x2b5e35){if(_0x2b5e35){_0x58e9ba=_0x2b5e35;_0x22e4b3[_0x23ff('0x4d')]=_[_0x23ff('0x4a')](db[_0x23ff('0x11c')]['rawAttributes']);_0x22e4b3['query']=_['keys'](_0x88c1[_0x23ff('0x49')]);_0x22e4b3['filters']=_[_0x23ff('0x4c')](_0x22e4b3[_0x23ff('0x4d')],_0x22e4b3[_0x23ff('0x49')]);_0x5d00b0['attributes']=_[_0x23ff('0x4c')](_0x22e4b3[_0x23ff('0x4d')],qs[_0x23ff('0x4e')](_0x88c1[_0x23ff('0x49')][_0x23ff('0x4e')]));_0x5d00b0[_0x23ff('0x4f')]=_0x5d00b0[_0x23ff('0x4f')][_0x23ff('0x50')]?_0x5d00b0['attributes']:_0x22e4b3[_0x23ff('0x4d')];_0x5d00b0[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x88c1[_0x23ff('0x49')]['sort']);_0x5d00b0[_0x23ff('0x54')]=qs['filters'](_[_0x23ff('0xb8')](_0x88c1['query'],_0x22e4b3[_0x23ff('0x4b')]));if(_0x88c1[_0x23ff('0x49')][_0x23ff('0xc0')]){_0x5d00b0['where']=_[_0x23ff('0x55')](_0x5d00b0[_0x23ff('0x54')],{'$or':_['map'](_0x5d00b0[_0x23ff('0x4f')],function(_0x5cb17b){var _0x5834e8={};_0x5834e8[_0x5cb17b]={'$like':'%'+_0x88c1[_0x23ff('0x49')][_0x23ff('0xc0')]+'%'};return _0x5834e8;})});}_0x5d00b0=_[_0x23ff('0x55')]({},_0x5d00b0,_0x88c1['options']);return _0x58e9ba['getLists'](_0x5d00b0);}})[_0x23ff('0x20')](function(_0x2d70cc){if(_0x2d70cc){_0x5870ed=_0x2d70cc[_0x23ff('0x50')];if(!_0x88c1[_0x23ff('0x49')][_0x23ff('0xbc')]('nolimit')){_0x5d00b0[_0x23ff('0x51')]=qs[_0x23ff('0x51')](_0x88c1[_0x23ff('0x49')][_0x23ff('0x51')]);_0x5d00b0[_0x23ff('0x2e')]=qs['offset'](_0x88c1[_0x23ff('0x49')][_0x23ff('0x2e')]);}return _0x58e9ba[_0x23ff('0x11b')](_0x5d00b0);}})[_0x23ff('0x20')](function(_0x5bdf74){if(_0x5bdf74){return _0x5bdf74?{'count':_0x5870ed,'rows':_0x5bdf74}:null;}})[_0x23ff('0x20')](respondWithResult(_0x149cd1,null))[_0x23ff('0x5d')](handleError(_0x149cd1,null));};exports['getAgents']=function(_0x5e07d8,_0x53d4f9,_0x1c5b52){var _0x2f348b={};var _0x224280={};var _0x43771d;var _0x2ef319;return db[_0x23ff('0x43')][_0x23ff('0x8d')]({'where':{'id':_0x5e07d8[_0x23ff('0x62')]['id']}})[_0x23ff('0x20')](handleEntityNotFound(_0x53d4f9,null))[_0x23ff('0x20')](function(_0x4402b6){if(_0x4402b6){_0x43771d=_0x4402b6;_0x224280[_0x23ff('0x4d')]=_['keys'](db['User'][_0x23ff('0x44')]);_0x224280[_0x23ff('0x49')]=_[_0x23ff('0x4a')](_0x5e07d8['query']);_0x224280[_0x23ff('0x4b')]=_[_0x23ff('0x4c')](_0x224280[_0x23ff('0x4d')],_0x224280['query']);_0x2f348b[_0x23ff('0x4f')]=_[_0x23ff('0x4c')](_0x224280[_0x23ff('0x4d')],qs['fields'](_0x5e07d8[_0x23ff('0x49')]['fields']));_0x2f348b[_0x23ff('0x4f')]=_0x2f348b['attributes'][_0x23ff('0x50')]?_0x2f348b[_0x23ff('0x4f')]:_0x224280[_0x23ff('0x4d')];_0x2f348b[_0x23ff('0x52')]=qs[_0x23ff('0x53')](_0x5e07d8[_0x23ff('0x49')][_0x23ff('0x53')]);_0x2f348b['where']=qs[_0x23ff('0x4b')](_['pick'](_0x5e07d8[_0x23ff('0x49')],_0x224280['filters']));if(_0x5e07d8[_0x23ff('0x49')][_0x23ff('0xc0')]){_0x2f348b[_0x23ff('0x54')]=_[_0x23ff('0x55')](_0x2f348b['where'],{'$or':_[_0x23ff('0x3b')](_0x2f348b[_0x23ff('0x4f')],function(_0x2585de){var _0x107990={};_0x107990[_0x2585de]={'$like':'%'+_0x5e07d8[_0x23ff('0x49')][_0x23ff('0xc0')]+'%'};return _0x107990;})});}_0x2f348b[_0x23ff('0x4d')]=db['User'];_0x2f348b['as']=_0x23ff('0x37');_0x2f348b=_[_0x23ff('0x55')]({},_0x2f348b,_0x5e07d8[_0x23ff('0x5f')]);return _0x43771d['getVoiceQueues']({'include':[_0x2f348b]});}})[_0x23ff('0x20')](function(_0x140377){if(_0x140377){var _0x49e916={},_0x11252f=[],_0x17fd89=0x0;for(var _0x4141ae=0x0;_0x4141ae<_0x140377['length'];_0x4141ae+=0x1){for(var _0x5418a0=0x0,_0x314dbd;_0x5418a0<_0x140377[_0x4141ae][_0x23ff('0x37')][_0x23ff('0x50')];_0x5418a0+=0x1){_0x314dbd=_0x140377[_0x4141ae][_0x23ff('0x37')][_0x5418a0][_0x23ff('0x34')]({'plain':!![]});_0x49e916[_0x314dbd['id']]=_0x314dbd;}}_0x49e916=_['values'](_0x49e916);for(var _0x5b6171=qs['offset'](_0x5e07d8[_0x23ff('0x49')][_0x23ff('0x2e')]);_0x5b6171<_0x49e916[_0x23ff('0x50')]&&_0x11252f[_0x23ff('0x50')]=_0x301dab[_0x63e2('0x50')]){throw new Error(_0x63e2('0x51'));}})[_0x63e2('0x11')](function(){if(_0x21a95a){return db[_0x63e2('0x2c')][_0x63e2('0x48')]({'where':{'membername':_0x21a95a['name']},'individualHooks':!![]});}})['then'](function(){if(_0x21a95a){return _0x21a95a[_0x63e2('0x52')]({'raw':!![]});}})[_0x63e2('0x11')](function(_0x212630){if(_0x21a95a){if(_0x212630){var _0x594907=[];_0x447767=_0x212630;if(_0x447767['length']){for(var _0x3704f8=0x0;_0x3704f8<_0x447767[_0x63e2('0x31')];_0x3704f8++){_0x594907['push'](db['UserVoiceQueueRt'][_0x63e2('0x53')]({'membername':_0x21a95a[_0x63e2('0x28')],'UserId':_0x21a95a['id'],'queue_name':_0x447767[_0x3704f8]['name'],'VoiceQueueId':_0x447767[_0x3704f8]['id'],'interface':_0x58002a,'paused':_0x21a95a[_0x63e2('0x4c')]||![],'penalty':_0x447767[_0x3704f8][_0x63e2('0x54')]||0x0}));}return BPromise['all'](_0x594907);}}}})[_0x63e2('0x11')](function(){if(_0x21a95a){return db[_0x63e2('0x2e')][_0x63e2('0x1e')]({'where':{'membername':_0x21a95a[_0x63e2('0x28')],'exitAt':null}});}})[_0x63e2('0x11')](function(_0x210406){if(_0x21a95a){if(_0x210406&&_0x210406[_0x63e2('0x31')]){var _0x75b06d=[];_0x210406['forEach'](function(_0x5075df){_0x75b06d[_0x63e2('0x33')](_0x5075df[_0x63e2('0x2d')]({'exitAt':moment()[_0x63e2('0x2f')](_0x63e2('0x30'))}));});return BPromise[_0x63e2('0x47')](_0x75b06d);}}})[_0x63e2('0x11')](function(_0x29d75e){if(_0x21a95a){var _0x573ce0=[];var _0x29329c=[];var _0x570d22=utils[_0x63e2('0x55')]();var _0x5770a7={'membername':_0x21a95a[_0x63e2('0x28')],'interface':_0x58002a,'enterAt':moment()[_0x63e2('0x2f')](_0x63e2('0x30')),'role':_0x21a95a['role'],'internal':_0x21a95a[_0x63e2('0x2a')]};_0x570d22['forEach'](function(_0x4d7679){_0x573ce0[_0x63e2('0x33')](_[_0x63e2('0x56')]({'channel':_0x4d7679,'type':_0x63e2('0x57'),'data1':_0x63e2('0x58'),'data2':_0x58002a},_0x5770a7));if(_0x21a95a[_0x63e2('0x4c')]){_0x29329c[_0x63e2('0x33')](_[_0x63e2('0x56')]({'channel':_0x4d7679,'type':_0x63e2('0x36'),'data1':'LOGININPAUSE'},_0x5770a7));}});return db[_0x63e2('0x2e')][_0x63e2('0x59')](_0x573ce0['concat'](_0x29329c),{'individualHooks':!![]});}})['then'](function(){if(_0x21a95a){return _0x21a95a[_0x63e2('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x63e2('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x21a95a[_0x63e2('0x4c')]||![],'mailPause':_0x21a95a[_0x63e2('0x4c')]||![],'chatPause':_0x21a95a[_0x63e2('0x4c')]||![],'faxPause':_0x21a95a[_0x63e2('0x4c')]||![],'smsPause':_0x21a95a[_0x63e2('0x4c')]||![],'openchannelPause':_0x21a95a[_0x63e2('0x4c')]||![],'pauseType':_0x21a95a[_0x63e2('0x4c')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x63e2('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x58002a});}})[_0x63e2('0x11')](function(_0x4c58b0){_0x52b36a(_0x4c58b0);})['catch'](function(_0x1df86a){_0x3d8e1f(_0x30e4e3['error'](0x1f4,_0x1df86a[_0x63e2('0x19')]));});});}; \ No newline at end of file +var _0xf5e1=['map','ShowUser','find','stringify','PauseUser','name','internal','interface','UserVoiceQueueRt','update','MemberReport','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','forEach','push','isNil','SIP/%s','PAUSE','type','DEFAULT\x20PAUSE','role','body','uniqueid','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','fax','sms','set','%s%s','Pause','all','LogoutUser','destroy','LoginUser','phone','loginInPause','count','agent','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetUser','User','findAll','options','raw','where','attributes','include','model'];(function(_0x307bcf,_0x7072c1){var _0x15d4bc=function(_0x4962dc){while(--_0x4962dc){_0x307bcf['push'](_0x307bcf['shift']());}};_0x15d4bc(++_0x7072c1);}(_0xf5e1,0x14e));var _0x1f5e=function(_0x473a79,_0x5e608b){_0x473a79=_0x473a79-0x0;var _0x5a91b3=_0xf5e1[_0x473a79];return _0x5a91b3;};'use strict';var _=require('lodash');var util=require(_0x1f5e('0x0'));var moment=require(_0x1f5e('0x1'));var BPromise=require(_0x1f5e('0x2'));var rs=require(_0x1f5e('0x3'));var fs=require('fs');var Redis=require(_0x1f5e('0x4'));var db=require(_0x1f5e('0x5'))['db'];var utils=require(_0x1f5e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1f5e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1f5e('0x8')][_0x1f5e('0x9')]({'port':0x232a});config[_0x1f5e('0xa')]=_[_0x1f5e('0xb')](config['redis'],{'host':_0x1f5e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0x1f5e('0xd')](socket);function respondWithRpcPromise(_0x57d9b5,_0x27320d,_0x3f6c6b){return new BPromise(function(_0x33150f,_0x4647ed){return client[_0x1f5e('0xe')](_0x57d9b5,_0x3f6c6b)[_0x1f5e('0xf')](function(_0x3315cc){logger[_0x1f5e('0x10')](_0x1f5e('0x11'),_0x27320d,_0x1f5e('0x12'));logger[_0x1f5e('0x13')]('User,\x20%s,\x20%s,\x20%s',_0x27320d,'request\x20sent',JSON['stringify'](_0x3315cc));if(_0x3315cc['error']){if(_0x3315cc[_0x1f5e('0x14')][_0x1f5e('0x15')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x27320d,_0x3315cc[_0x1f5e('0x14')][_0x1f5e('0x16')]);return _0x4647ed(_0x3315cc[_0x1f5e('0x14')][_0x1f5e('0x16')]);}logger['error']('User,\x20%s,\x20%s',_0x27320d,_0x3315cc[_0x1f5e('0x14')][_0x1f5e('0x16')]);return _0x33150f(_0x3315cc['error']['message']);}else{logger[_0x1f5e('0x10')](_0x1f5e('0x11'),_0x27320d,_0x1f5e('0x12'));_0x33150f(_0x3315cc[_0x1f5e('0x17')][_0x1f5e('0x16')]);}})[_0x1f5e('0x18')](function(_0xc75d69){logger[_0x1f5e('0x14')](_0x1f5e('0x11'),_0x27320d,_0xc75d69);_0x4647ed(_0xc75d69);});});}exports[_0x1f5e('0x19')]=function(_0x124260){var _0x16d004=this;return new Promise(function(_0x29497e,_0x2e4380){return db[_0x1f5e('0x1a')][_0x1f5e('0x1b')]({'raw':_0x124260[_0x1f5e('0x1c')]?_0x124260[_0x1f5e('0x1c')][_0x1f5e('0x1d')]===undefined?!![]:![]:!![],'where':_0x124260[_0x1f5e('0x1c')]?_0x124260['options'][_0x1f5e('0x1e')]||null:null,'attributes':_0x124260[_0x1f5e('0x1c')]?_0x124260[_0x1f5e('0x1c')][_0x1f5e('0x1f')]||null:null,'limit':_0x124260[_0x1f5e('0x1c')]?_0x124260[_0x1f5e('0x1c')]['limit']||null:null,'include':_0x124260[_0x1f5e('0x1c')]?_0x124260[_0x1f5e('0x1c')][_0x1f5e('0x20')]?_['map'](_0x124260[_0x1f5e('0x1c')][_0x1f5e('0x20')],function(_0x432c8b){return{'model':db[_0x432c8b[_0x1f5e('0x21')]],'as':_0x432c8b['as'],'attributes':_0x432c8b[_0x1f5e('0x1f')],'include':_0x432c8b[_0x1f5e('0x20')]?_[_0x1f5e('0x22')](_0x432c8b[_0x1f5e('0x20')],function(_0x438d77){return{'model':db[_0x438d77['model']],'as':_0x438d77['as'],'attributes':_0x438d77[_0x1f5e('0x1f')],'include':_0x438d77[_0x1f5e('0x20')]?_[_0x1f5e('0x22')](_0x438d77['include'],function(_0x533045){return{'model':db[_0x533045[_0x1f5e('0x21')]],'as':_0x533045['as'],'attributes':_0x533045[_0x1f5e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1324a7){logger[_0x1f5e('0x10')](_0x1f5e('0x19'),_0x124260);logger[_0x1f5e('0x13')]('GetUser',_0x124260,JSON['stringify'](_0x1324a7));_0x29497e(_0x1324a7);})[_0x1f5e('0x18')](function(_0x1c97da){logger[_0x1f5e('0x14')]('GetUser',_0x1c97da[_0x1f5e('0x16')],_0x124260);_0x2e4380(_0x16d004[_0x1f5e('0x14')](0x1f4,_0x1c97da[_0x1f5e('0x16')]));});});};exports[_0x1f5e('0x23')]=function(_0x3536df){var _0x2d429f=this;return new Promise(function(_0x45c46b,_0x334c18){return db[_0x1f5e('0x1a')][_0x1f5e('0x24')]({'raw':_0x3536df[_0x1f5e('0x1c')]?_0x3536df[_0x1f5e('0x1c')][_0x1f5e('0x1d')]===undefined?!![]:![]:!![],'where':_0x3536df[_0x1f5e('0x1c')]?_0x3536df[_0x1f5e('0x1c')][_0x1f5e('0x1e')]||null:null,'attributes':_0x3536df[_0x1f5e('0x1c')]?_0x3536df[_0x1f5e('0x1c')][_0x1f5e('0x1f')]||null:null,'include':_0x3536df['options']?_0x3536df[_0x1f5e('0x1c')][_0x1f5e('0x20')]?_[_0x1f5e('0x22')](_0x3536df[_0x1f5e('0x1c')][_0x1f5e('0x20')],function(_0x5c2232){return{'model':db[_0x5c2232[_0x1f5e('0x21')]],'as':_0x5c2232['as'],'attributes':_0x5c2232[_0x1f5e('0x1f')],'include':_0x5c2232[_0x1f5e('0x20')]?_[_0x1f5e('0x22')](_0x5c2232[_0x1f5e('0x20')],function(_0x34012f){return{'model':db[_0x34012f[_0x1f5e('0x21')]],'as':_0x34012f['as'],'attributes':_0x34012f[_0x1f5e('0x1f')],'include':_0x34012f['include']?_[_0x1f5e('0x22')](_0x34012f[_0x1f5e('0x20')],function(_0x54b4e3){return{'model':db[_0x54b4e3['model']],'as':_0x54b4e3['as'],'attributes':_0x54b4e3['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f5e('0xf')](function(_0x2dee14){logger['info']('ShowUser',_0x3536df);logger[_0x1f5e('0x13')]('ShowUser',_0x3536df,JSON[_0x1f5e('0x25')](_0x2dee14));_0x45c46b(_0x2dee14);})[_0x1f5e('0x18')](function(_0x4a3c71){logger[_0x1f5e('0x14')](_0x1f5e('0x23'),_0x4a3c71['message'],_0x3536df);_0x334c18(_0x2d429f[_0x1f5e('0x14')](0x1f4,_0x4a3c71['message']));});});};exports[_0x1f5e('0x26')]=function(_0x2704d9){var _0x59d6a3=this;return new Promise(function(_0x297d2c,_0x4a08c2){var _0x1f2227;return db[_0x1f5e('0x1a')]['find']({'where':_0x2704d9[_0x1f5e('0x1c')][_0x1f5e('0x1e')]||{},'attributes':['id',_0x1f5e('0x27'),'role',_0x1f5e('0x28'),_0x1f5e('0x29')]})[_0x1f5e('0xf')](function(_0x718671){if(_0x718671){_0x1f2227=_0x718671;return db[_0x1f5e('0x2a')][_0x1f5e('0x2b')]({'paused':0x1},{'where':{'UserId':_0x1f2227['id']},'individualHooks':!![]});}})[_0x1f5e('0xf')](function(){if(_0x1f2227){return db[_0x1f5e('0x2c')][_0x1f5e('0x1b')]({'where':{'membername':_0x1f2227[_0x1f5e('0x27')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x1d52d3){if(_0x1f2227){if(_0x1d52d3&&_0x1d52d3['length']){var _0x5c0056=moment()[_0x1f5e('0x2d')](_0x1f5e('0x2e'));for(var _0x240245=0x0,_0x538c06=_0x1d52d3[_0x1f5e('0x2f')];_0x240245<_0x538c06;_0x240245++){_0x1d52d3[_0x240245][_0x1f5e('0x30')]({'exitAt':_0x5c0056});}}}})[_0x1f5e('0xf')](function(){if(_0x1f2227){var _0x5ae391=[];var _0x172586=utils['getChannels']();_0x172586[_0x1f5e('0x31')](function(_0x2b078a){_0x5ae391[_0x1f5e('0x32')]({'channel':_0x2b078a,'membername':_0x1f2227[_0x1f5e('0x27')],'interface':_[_0x1f5e('0x33')](_0x1f2227[_0x1f5e('0x29')])?util['format'](_0x1f5e('0x34'),_0x1f2227[_0x1f5e('0x27')]):_0x1f2227['interface'],'type':_0x1f5e('0x35'),'enterAt':moment()['format'](_0x1f5e('0x2e')),'data1':_0x2704d9['body'][_0x1f5e('0x36')]||_0x1f5e('0x37'),'role':_0x1f2227[_0x1f5e('0x38')],'internal':_0x1f2227[_0x1f5e('0x28')],'uniqueid':_0x2704d9[_0x1f5e('0x39')][_0x1f5e('0x3a')]||null});});return db[_0x1f5e('0x2c')][_0x1f5e('0x3b')](_0x5ae391,{'individualHooks':!![]});}})['then'](function(){if(_0x1f2227){return _0x1f2227[_0x1f5e('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x2704d9[_0x1f5e('0x39')][_0x1f5e('0x36')]||_0x1f5e('0x37'),'lastPauseAt':moment()[_0x1f5e('0x2d')](_0x1f5e('0x2e'))});}})[_0x1f5e('0xf')](function(_0x3475e1){_0x297d2c(_0x3475e1);})[_0x1f5e('0x18')](function(_0x48e82c){_0x4a08c2(_0x59d6a3[_0x1f5e('0x14')](0x1f4,_0x48e82c[_0x1f5e('0x16')]));});});};exports[_0x1f5e('0x3c')]=function(_0x2cc1e1){var _0x4c80e3=this;return new Promise(function(_0x597129,_0x3d2488){var _0x2bbc5a;return db['User'][_0x1f5e('0x3d')]({'where':_0x2cc1e1[_0x1f5e('0x1c')][_0x1f5e('0x1e')]||{},'attributes':['id',_0x1f5e('0x27')]})['then'](function(_0x2676d8){if(_0x2676d8){_0x2bbc5a=_0x2676d8;if(_0x2cc1e1[_0x1f5e('0x39')][_0x1f5e('0x3e')]&&!utils[_0x1f5e('0x3f')](_0x2cc1e1['body'][_0x1f5e('0x3e')])){throw new Error(_0x1f5e('0x40'));}switch(_0x2cc1e1['body'][_0x1f5e('0x3e')]){case _0x1f5e('0x41'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x2bbc5a['id']}})['then'](function(){return db[_0x1f5e('0x2c')][_0x1f5e('0x24')]({'where':{'channel':_0x2cc1e1['body'][_0x1f5e('0x3e')],'membername':_0x2bbc5a['name'],'type':_0x1f5e('0x35'),'exitAt':null}});})[_0x1f5e('0xf')](function(_0xe646fc){if(_0xe646fc){return _0xe646fc[_0x1f5e('0x2b')]({'exitAt':moment()[_0x1f5e('0x2d')](_0x1f5e('0x2e')),'data2':_0x1f5e('0x42')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x2bbc5a[_0x1f5e('0x2b')]({'voicePause':![]});});case _0x1f5e('0x43'):case _0x1f5e('0x44'):case _0x1f5e('0x45'):case _0x1f5e('0x46'):case'openchannel':return db[_0x1f5e('0x2c')]['find']({'where':{'channel':_0x2cc1e1[_0x1f5e('0x39')][_0x1f5e('0x3e')],'membername':_0x2bbc5a[_0x1f5e('0x27')],'type':_0x1f5e('0x35'),'exitAt':null}})[_0x1f5e('0xf')](function(_0x4e74bf){return _0x4e74bf[_0x1f5e('0x2b')]({'exitAt':moment()[_0x1f5e('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x1f5e('0x42')},{'individualHooks':!![]});})['then'](function(){var _0x53b3de={};_[_0x1f5e('0x47')](_0x53b3de,util[_0x1f5e('0x2d')](_0x1f5e('0x48'),_0x2cc1e1['body'][_0x1f5e('0x3e')],_0x1f5e('0x49')),![]);return _0x2bbc5a[_0x1f5e('0x2b')](_0x53b3de);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x2bbc5a['id']}})[_0x1f5e('0xf')](function(){return db[_0x1f5e('0x2c')][_0x1f5e('0x1b')]({'where':{'membername':_0x2bbc5a[_0x1f5e('0x27')],'type':_0x1f5e('0x35'),'exitAt':null}});})[_0x1f5e('0xf')](function(_0x2cf0e4){var _0x4705d8=[];_0x2cf0e4['forEach'](function(_0x4ef26d){_0x4705d8['push'](_0x4ef26d[_0x1f5e('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0x1f5e('0x4a')](_0x4705d8);})['then'](function(){return _0x2bbc5a[_0x1f5e('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](function(_0x434cf8){_0x597129(_0x434cf8);})[_0x1f5e('0x18')](function(_0x115233){_0x3d2488(_0x4c80e3[_0x1f5e('0x14')](0x1f4,_0x115233[_0x1f5e('0x16')]));});});};exports[_0x1f5e('0x4b')]=function(_0x3cf7f3){var _0x35af0e=this;return new Promise(function(_0x569892,_0x375eb6){var _0x2f74a9;return db[_0x1f5e('0x1a')][_0x1f5e('0x3d')]({'where':_0x3cf7f3[_0x1f5e('0x1c')][_0x1f5e('0x1e')]||{},'attributes':['id',_0x1f5e('0x27')]})[_0x1f5e('0xf')](function(_0x270dea){if(_0x270dea){_0x2f74a9=_0x270dea;return db[_0x1f5e('0x2a')][_0x1f5e('0x4c')]({'where':{'membername':_0x2f74a9[_0x1f5e('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x2f74a9){return db[_0x1f5e('0x2c')][_0x1f5e('0x1b')]({'where':{'membername':_0x2f74a9['name'],'exitAt':null}});}})['then'](function(_0x308629){if(_0x2f74a9){if(_0x308629&&_0x308629[_0x1f5e('0x2f')]){var _0x2a00e5=[];_0x308629[_0x1f5e('0x31')](function(_0x5ce0a){_0x2a00e5[_0x1f5e('0x32')](_0x5ce0a['update']({'exitAt':moment()[_0x1f5e('0x2d')](_0x1f5e('0x2e'))}));});return BPromise[_0x1f5e('0x4a')](_0x2a00e5);}}})[_0x1f5e('0xf')](function(){if(_0x2f74a9){return _0x2f74a9[_0x1f5e('0x2b')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0xbbb864){_0x569892(_0xbbb864);})[_0x1f5e('0x18')](function(_0x20b914){_0x375eb6(_0x35af0e['error'](0x1f4,_0x20b914['message']));});});};exports[_0x1f5e('0x4d')]=function(_0x1b0002){var _0xc31f51=this;return new Promise(function(_0xb2c633,_0xcd9cc7){var _0x4ce052;var _0x2f917f;var _0x2f1087;var _0x4e95c;return db[_0x1f5e('0x1a')][_0x1f5e('0x3d')]({'where':_0x1b0002['options'][_0x1f5e('0x1e')]||{},'attributes':['id',_0x1f5e('0x27'),_0x1f5e('0x38'),'mobile',_0x1f5e('0x4e'),'internal',_0x1f5e('0x4f'),_0x1f5e('0x29')]})[_0x1f5e('0xf')](function(_0xab6ef7){if(_0xab6ef7){_0x4ce052=_0xab6ef7;_0x4e95c=_0x1b0002[_0x1f5e('0x39')][_0x1f5e('0x29')]?_0x1b0002['body'][_0x1f5e('0x29')]:util[_0x1f5e('0x2d')](_0x1f5e('0x34'),_0x4ce052[_0x1f5e('0x27')]);return db[_0x1f5e('0x1a')][_0x1f5e('0x50')]({'where':{'role':_0x1f5e('0x51'),'online':!![],'id':{'$ne':_0x4ce052['id']}}});}})[_0x1f5e('0xf')](function(_0x355e8e){if(_0x355e8e){_0x2f1087=_0x355e8e;return require('../../config/license/util')[_0x1f5e('0x52')]();}})[_0x1f5e('0xf')](function(_0x59342f){if(_0x59342f&&_0x59342f['agents']&&_0x2f1087>=_0x59342f[_0x1f5e('0x53')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x1f5e('0xf')](function(){if(_0x4ce052){return db['UserVoiceQueueRt'][_0x1f5e('0x4c')]({'where':{'membername':_0x4ce052[_0x1f5e('0x27')]},'individualHooks':!![]});}})[_0x1f5e('0xf')](function(){if(_0x4ce052){return _0x4ce052[_0x1f5e('0x54')]({'raw':!![]});}})['then'](function(_0x305840){if(_0x4ce052){if(_0x305840){var _0x4774fb=[];_0x2f917f=_0x305840;if(_0x2f917f[_0x1f5e('0x2f')]){for(var _0x6453ef=0x0;_0x6453ef<_0x2f917f[_0x1f5e('0x2f')];_0x6453ef++){_0x4774fb[_0x1f5e('0x32')](db['UserVoiceQueueRt'][_0x1f5e('0x55')]({'membername':_0x4ce052[_0x1f5e('0x27')],'UserId':_0x4ce052['id'],'queue_name':_0x2f917f[_0x6453ef][_0x1f5e('0x27')],'VoiceQueueId':_0x2f917f[_0x6453ef]['id'],'interface':_0x4e95c,'paused':_0x4ce052['loginInPause']||![],'penalty':_0x2f917f[_0x6453ef][_0x1f5e('0x56')]||0x0}));}return BPromise[_0x1f5e('0x4a')](_0x4774fb);}}}})['then'](function(){if(_0x4ce052){return db['MemberReport']['findAll']({'where':{'membername':_0x4ce052[_0x1f5e('0x27')],'exitAt':null}});}})['then'](function(_0x40750a){if(_0x4ce052){if(_0x40750a&&_0x40750a[_0x1f5e('0x2f')]){var _0x502c26=[];_0x40750a['forEach'](function(_0x50cb6b){_0x502c26[_0x1f5e('0x32')](_0x50cb6b[_0x1f5e('0x2b')]({'exitAt':moment()['format'](_0x1f5e('0x2e'))}));});return BPromise[_0x1f5e('0x4a')](_0x502c26);}}})['then'](function(_0x210c44){if(_0x4ce052){var _0x57860b=[];var _0x58a94c=[];var _0x40932e=utils['getChannels']();var _0x32124b={'membername':_0x4ce052[_0x1f5e('0x27')],'interface':_0x4e95c,'enterAt':moment()[_0x1f5e('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4ce052[_0x1f5e('0x38')],'internal':_0x4ce052[_0x1f5e('0x28')]};_0x40932e[_0x1f5e('0x31')](function(_0x360dc5){_0x57860b[_0x1f5e('0x32')](_[_0x1f5e('0x57')]({'channel':_0x360dc5,'type':_0x1f5e('0x58'),'data1':_0x1f5e('0x59'),'data2':_0x4e95c},_0x32124b));if(_0x4ce052[_0x1f5e('0x4f')]){_0x58a94c['push'](_[_0x1f5e('0x57')]({'channel':_0x360dc5,'type':_0x1f5e('0x35'),'data1':_0x1f5e('0x5a')},_0x32124b));}});return db['MemberReport'][_0x1f5e('0x3b')](_0x57860b[_0x1f5e('0x5b')](_0x58a94c),{'individualHooks':!![]});}})[_0x1f5e('0xf')](function(){if(_0x4ce052){return _0x4ce052['update']({'online':!![],'lastLoginAt':moment()[_0x1f5e('0x2d')](_0x1f5e('0x2e')),'voicePause':_0x4ce052[_0x1f5e('0x4f')]||![],'mailPause':_0x4ce052[_0x1f5e('0x4f')]||![],'chatPause':_0x4ce052[_0x1f5e('0x4f')]||![],'faxPause':_0x4ce052['loginInPause']||![],'smsPause':_0x4ce052[_0x1f5e('0x4f')]||![],'openchannelPause':_0x4ce052[_0x1f5e('0x4f')]||![],'pauseType':_0x4ce052[_0x1f5e('0x4f')]?_0x1f5e('0x5a'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4e95c});}})[_0x1f5e('0xf')](function(_0x2026ca){_0xb2c633(_0x2026ca);})[_0x1f5e('0x18')](function(_0x2c9ab4){_0xcd9cc7(_0xc31f51[_0x1f5e('0x14')](0x1f4,_0x2c9ab4['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ebf4778..919c18c 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 _0x7349=['emit','removeListener','register','length','user:','./user.events','save','update'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7349,0x195));var _0x9734=function(_0x1cc598,_0x44db52){_0x1cc598=_0x1cc598-0x0;var _0x43f41b=_0x7349[_0x1cc598];return _0x43f41b;};'use strict';var UserEvents=require(_0x9734('0x0'));var events=[_0x9734('0x1'),'remove',_0x9734('0x2')];function createListener(_0xa9729c,_0x4a06e5){return function(_0x54a235){_0x4a06e5[_0x9734('0x3')](_0xa9729c,_0x54a235);};}function removeListener(_0x4efcf7,_0x118568){return function(){UserEvents[_0x9734('0x4')](_0x4efcf7,_0x118568);};}exports[_0x9734('0x5')]=function(_0x31c090){for(var _0x2980aa=0x0,_0x369c99=events[_0x9734('0x6')];_0x2980aa<_0x369c99;_0x2980aa++){var _0x5e9dbc=events[_0x2980aa];var _0x5e5b45=createListener(_0x9734('0x7')+_0x5e9dbc,_0x31c090);UserEvents['on'](_0x5e9dbc,_0x5e5b45);}}; \ No newline at end of file +var _0x8add=['emit','removeListener','length','user:','./user.events','remove','update'];(function(_0xe963fd,_0x4f8181){var _0x46a847=function(_0x7443d4){while(--_0x7443d4){_0xe963fd['push'](_0xe963fd['shift']());}};_0x46a847(++_0x4f8181);}(_0x8add,0xcf));var _0xd8ad=function(_0xde5fd0,_0x505e7e){_0xde5fd0=_0xde5fd0-0x0;var _0x267273=_0x8add[_0xde5fd0];return _0x267273;};'use strict';var UserEvents=require(_0xd8ad('0x0'));var events=['save',_0xd8ad('0x1'),_0xd8ad('0x2')];function createListener(_0x174e3e,_0x3f4e5d){return function(_0x293adf){_0x3f4e5d[_0xd8ad('0x3')](_0x174e3e,_0x293adf);};}function removeListener(_0x45eb59,_0x467171){return function(){UserEvents[_0xd8ad('0x4')](_0x45eb59,_0x467171);};}exports['register']=function(_0x55a4ed){for(var _0x88e05=0x0,_0x4e2ad3=events[_0xd8ad('0x5')];_0x88e05<_0x4e2ad3;_0x88e05++){var _0x4888c3=events[_0x88e05];var _0x15dd18=createListener(_0xd8ad('0x6')+_0x4888c3,_0x55a4ed);UserEvents['on'](_0x4888c3,_0x15dd18);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c3ee662..ff8ad75 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 _0xac39=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1cfe0c,_0x53eaf4){var _0x34534f=function(_0x115bf2){while(--_0x115bf2){_0x1cfe0c['push'](_0x1cfe0c['shift']());}};_0x34534f(++_0x53eaf4);}(_0xac39,0x11c));var _0x9ac3=function(_0x326e56,_0x43a54c){_0x326e56=_0x326e56-0x0;var _0x4d04f3=_0xac39[_0x326e56];return _0x4d04f3;};'use strict';var multer=require(_0x9ac3('0x0'));var util=require(_0x9ac3('0x1'));var path=require(_0x9ac3('0x2'));var timeout=require(_0x9ac3('0x3'));var express=require(_0x9ac3('0x4'));var router=express[_0x9ac3('0x5')]();var auth=require(_0x9ac3('0x6'));var interaction=require(_0x9ac3('0x7'));var config=require(_0x9ac3('0x8'));module[_0x9ac3('0x9')]=router; \ No newline at end of file +var _0x332b=['multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x332b,0x15c));var _0xb332=function(_0x305dd9,_0x512697){_0x305dd9=_0x305dd9-0x0;var _0x20a140=_0x332b[_0x305dd9];return _0x20a140;};'use strict';var multer=require(_0xb332('0x0'));var util=require(_0xb332('0x1'));var path=require('path');var timeout=require(_0xb332('0x2'));var express=require(_0xb332('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb332('0x4'));var config=require(_0xb332('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a90dd77..640a038 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x52f480,_0x48789b){var _0x53ba45=function(_0xd8e51){while(--_0xd8e51){_0x52f480['push'](_0x52f480['shift']());}};_0x53ba45(++_0x48789b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x1b2839,_0x211891){var _0x30e7e8=function(_0x40c0b0){while(--_0x40c0b0){_0x1b2839['push'](_0x1b2839['shift']());}};_0x30e7e8(++_0x211891);}(_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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 2c59b4a..712fdab 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 _0x83ea=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5540fd,_0x1d00d9){var _0x56906c=function(_0x492dd4){while(--_0x492dd4){_0x5540fd['push'](_0x5540fd['shift']());}};_0x56906c(++_0x1d00d9);}(_0x83ea,0x166));var _0xa83e=function(_0x538ae5,_0x2e7a44){_0x538ae5=_0x538ae5-0x0;var _0x2bcece=_0x83ea[_0x538ae5];return _0x2bcece;};'use strict';var _=require(_0xa83e('0x0'));var util=require(_0xa83e('0x1'));var logger=require('../../config/logger')(_0xa83e('0x2'));var moment=require(_0xa83e('0x3'));var BPromise=require(_0xa83e('0x4'));var rp=require(_0xa83e('0x5'));var fs=require('fs');var path=require(_0xa83e('0x6'));var rimraf=require(_0xa83e('0x7'));var config=require(_0xa83e('0x8'));var attributes=require(_0xa83e('0x9'));module[_0xa83e('0xa')]=function(_0xccb53c,_0x335d3a){return _0xccb53c[_0xa83e('0xb')](_0xa83e('0xc'),attributes,{'tableName':_0xa83e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f37=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8f37,0x1b0));var _0x78f3=function(_0x532c7f,_0x524a72){_0x532c7f=_0x532c7f-0x0;var _0x1e4a96=_0x8f37[_0x532c7f];return _0x1e4a96;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x78f3('0x0'))(_0x78f3('0x1'));var moment=require('moment');var BPromise=require(_0x78f3('0x2'));var rp=require(_0x78f3('0x3'));var fs=require('fs');var path=require(_0x78f3('0x4'));var rimraf=require(_0x78f3('0x5'));var config=require(_0x78f3('0x6'));var attributes=require(_0x78f3('0x7'));module[_0x78f3('0x8')]=function(_0x24cc8f,_0x1b01e4){return _0x24cc8f[_0x78f3('0x9')](_0x78f3('0xa'),attributes,{'tableName':_0x78f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 7c9bb6f..bc4e07a 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 _0xcd31=['catch','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','UserChatQueue,\x20%s,\x20%s','message','result'];(function(_0x3815e1,_0x2095c4){var _0x14293a=function(_0x3b005e){while(--_0x3b005e){_0x3815e1['push'](_0x3815e1['shift']());}};_0x14293a(++_0x2095c4);}(_0xcd31,0xdd));var _0x1cd3=function(_0x336275,_0xd26bb5){_0x336275=_0x336275-0x0;var _0x12ab42=_0xcd31[_0x336275];return _0x12ab42;};'use strict';var _=require('lodash');var util=require(_0x1cd3('0x0'));var moment=require(_0x1cd3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cd3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cd3('0x3'));var logger=require(_0x1cd3('0x4'))('rpc');var config=require(_0x1cd3('0x5'));var jayson=require(_0x1cd3('0x6'));var client=jayson[_0x1cd3('0x7')][_0x1cd3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ed38b,_0x57401f,_0x461260){return new BPromise(function(_0x29918c,_0x3ded37){return client[_0x1cd3('0x9')](_0x3ed38b,_0x461260)[_0x1cd3('0xa')](function(_0x626661){logger[_0x1cd3('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x57401f,_0x1cd3('0xc'));logger[_0x1cd3('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x57401f,_0x1cd3('0xc'),JSON[_0x1cd3('0xe')](_0x626661));if(_0x626661[_0x1cd3('0xf')]){if(_0x626661['error']['code']===0x1f4){logger[_0x1cd3('0xf')](_0x1cd3('0x10'),_0x57401f,_0x626661[_0x1cd3('0xf')][_0x1cd3('0x11')]);return _0x3ded37(_0x626661[_0x1cd3('0xf')]['message']);}logger[_0x1cd3('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x57401f,_0x626661[_0x1cd3('0xf')]['message']);return _0x29918c(_0x626661[_0x1cd3('0xf')][_0x1cd3('0x11')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x57401f,_0x1cd3('0xc'));_0x29918c(_0x626661[_0x1cd3('0x12')]['message']);}})[_0x1cd3('0x13')](function(_0x105860){logger[_0x1cd3('0xf')](_0x1cd3('0x10'),_0x57401f,_0x105860);_0x3ded37(_0x105860);});});} \ No newline at end of file +var _0x85b2=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x45d174,_0x47c6bb){var _0x3a0128=function(_0xdd4c62){while(--_0xdd4c62){_0x45d174['push'](_0x45d174['shift']());}};_0x3a0128(++_0x47c6bb);}(_0x85b2,0x11f));var _0x285b=function(_0x71988b,_0x253aa1){_0x71988b=_0x71988b-0x0;var _0x192602=_0x85b2[_0x71988b];return _0x192602;};'use strict';var _=require(_0x285b('0x0'));var util=require(_0x285b('0x1'));var moment=require(_0x285b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x285b('0x3'))['db'];var utils=require(_0x285b('0x4'));var logger=require('../../config/logger')(_0x285b('0x5'));var config=require(_0x285b('0x6'));var jayson=require(_0x285b('0x7'));var client=jayson[_0x285b('0x8')][_0x285b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x164392,_0x485db7,_0x4bc965){return new BPromise(function(_0x192a68,_0x2091ef){return client[_0x285b('0xa')](_0x164392,_0x4bc965)['then'](function(_0x3c81ec){logger[_0x285b('0xb')](_0x285b('0xc'),_0x485db7,_0x285b('0xd'));logger[_0x285b('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x485db7,_0x285b('0xd'),JSON[_0x285b('0xf')](_0x3c81ec));if(_0x3c81ec[_0x285b('0x10')]){if(_0x3c81ec[_0x285b('0x10')][_0x285b('0x11')]===0x1f4){logger[_0x285b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x485db7,_0x3c81ec[_0x285b('0x10')]['message']);return _0x2091ef(_0x3c81ec[_0x285b('0x10')][_0x285b('0x12')]);}logger['error'](_0x285b('0xc'),_0x485db7,_0x3c81ec[_0x285b('0x10')][_0x285b('0x12')]);return _0x192a68(_0x3c81ec[_0x285b('0x10')][_0x285b('0x12')]);}else{logger[_0x285b('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x485db7,_0x285b('0xd'));_0x192a68(_0x3c81ec['result'][_0x285b('0x12')]);}})[_0x285b('0x13')](function(_0x4fd4a7){logger[_0x285b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x485db7,_0x4fd4a7);_0x2091ef(_0x4fd4a7);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index bfe2370..a7f3271 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 _0xcd69=['../../components/interaction/service','../../config/environment','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xcd69,0x16b));var _0x9cd6=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xcd69[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9cd6('0x0'));var timeout=require(_0x9cd6('0x1'));var express=require(_0x9cd6('0x2'));var router=express[_0x9cd6('0x3')]();var auth=require(_0x9cd6('0x4'));var interaction=require(_0x9cd6('0x5'));var config=require(_0x9cd6('0x6'));module[_0x9cd6('0x7')]=router; \ No newline at end of file +var _0xa5c4=['../../config/environment','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3e4b55,_0x6632f7){var _0x3a51ba=function(_0x3158e5){while(--_0x3158e5){_0x3e4b55['push'](_0x3e4b55['shift']());}};_0x3a51ba(++_0x6632f7);}(_0xa5c4,0x18e));var _0x4a5c=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0xa5c4[_0x297eea];return _0x1c42d2;};'use strict';var multer=require(_0x4a5c('0x0'));var util=require(_0x4a5c('0x1'));var path=require(_0x4a5c('0x2'));var timeout=require(_0x4a5c('0x3'));var express=require('express');var router=express[_0x4a5c('0x4')]();var auth=require(_0x4a5c('0x5'));var interaction=require(_0x4a5c('0x6'));var config=require(_0x4a5c('0x7'));module[_0x4a5c('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 1341fe2..df3b310 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 _0xdd4f=['sequelize','STRING'];(function(_0x2a9796,_0x33a67b){var _0x5eddc9=function(_0x1a58fa){while(--_0x1a58fa){_0x2a9796['push'](_0x2a9796['shift']());}};_0x5eddc9(++_0x33a67b);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x29b67d,_0x1c0c14){_0x29b67d=_0x29b67d-0x0;var _0x53fa60=_0xdd4f[_0x29b67d];return _0x53fa60;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfdd4('0x1')]}}; \ No newline at end of file +var _0x8e3f=['STRING','sequelize','exports','INTEGER'];(function(_0x51df5e,_0x582a91){var _0x108d7d=function(_0x464a1e){while(--_0x464a1e){_0x51df5e['push'](_0x51df5e['shift']());}};_0x108d7d(++_0x582a91);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'penalty':{'type':Sequelize[_0xf8e3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf8e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 62c3d0a..8cc1bb3 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(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xb10b[_0x1b4b23];return _0x2a325b;};'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(_0xdd9a5f,_0x3ced93){var _0x3464b7=function(_0x35b534){while(--_0x35b534){_0xdd9a5f['push'](_0xdd9a5f['shift']());}};_0x3464b7(++_0x3ced93);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d4663,_0x17cb51){_0x1d4663=_0x1d4663-0x0;var _0x581eb5=_0xb10b[_0x1d4663];return _0x581eb5;};'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 69f35ce..5ce3ccb 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 _0xea92=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0xea92,0x1bb));var _0x2ea9=function(_0x2e49a5,_0x42e9a1){_0x2e49a5=_0x2e49a5-0x0;var _0x18bcf5=_0xea92[_0x2e49a5];return _0x18bcf5;};'use strict';var _=require(_0x2ea9('0x0'));var util=require(_0x2ea9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2ea9('0x2'));var fs=require('fs');var Redis=require(_0x2ea9('0x3'));var db=require(_0x2ea9('0x4'))['db'];var utils=require(_0x2ea9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2ea9('0x6'));var jayson=require(_0x2ea9('0x7'));var client=jayson[_0x2ea9('0x8')][_0x2ea9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b81d1,_0x4d46da,_0xfad6f3){return new BPromise(function(_0x163e91,_0x1efbc1){return client['request'](_0x2b81d1,_0xfad6f3)[_0x2ea9('0xa')](function(_0x4e8692){logger[_0x2ea9('0xb')](_0x2ea9('0xc'),_0x4d46da,'request\x20sent');logger['debug'](_0x2ea9('0xd'),_0x4d46da,_0x2ea9('0xe'),JSON[_0x2ea9('0xf')](_0x4e8692));if(_0x4e8692[_0x2ea9('0x10')]){if(_0x4e8692[_0x2ea9('0x10')]['code']===0x1f4){logger[_0x2ea9('0x10')](_0x2ea9('0xc'),_0x4d46da,_0x4e8692[_0x2ea9('0x10')]['message']);return _0x1efbc1(_0x4e8692[_0x2ea9('0x10')][_0x2ea9('0x11')]);}logger[_0x2ea9('0x10')](_0x2ea9('0xc'),_0x4d46da,_0x4e8692[_0x2ea9('0x10')][_0x2ea9('0x11')]);return _0x163e91(_0x4e8692['error'][_0x2ea9('0x11')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x4d46da,_0x2ea9('0xe'));_0x163e91(_0x4e8692[_0x2ea9('0x12')][_0x2ea9('0x11')]);}})[_0x2ea9('0x13')](function(_0x4db65c){logger[_0x2ea9('0x10')](_0x2ea9('0xc'),_0x4d46da,_0x4db65c);_0x1efbc1(_0x4db65c);});});} \ No newline at end of file +var _0x6bf1=['debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6bf1,0x71));var _0x16bf=function(_0x56ffb6,_0x27eab6){_0x56ffb6=_0x56ffb6-0x0;var _0x40b63=_0x6bf1[_0x56ffb6];return _0x40b63;};'use strict';var _=require(_0x16bf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x16bf('0x1'));var rs=require(_0x16bf('0x2'));var fs=require('fs');var Redis=require(_0x16bf('0x3'));var db=require(_0x16bf('0x4'))['db'];var utils=require(_0x16bf('0x5'));var logger=require('../../config/logger')(_0x16bf('0x6'));var config=require(_0x16bf('0x7'));var jayson=require(_0x16bf('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ff980,_0x166bb1,_0x248a00){return new BPromise(function(_0x3852d0,_0x150cf4){return client[_0x16bf('0x9')](_0x3ff980,_0x248a00)[_0x16bf('0xa')](function(_0x29a715){logger['info'](_0x16bf('0xb'),_0x166bb1,_0x16bf('0xc'));logger[_0x16bf('0xd')](_0x16bf('0xe'),_0x166bb1,_0x16bf('0xc'),JSON[_0x16bf('0xf')](_0x29a715));if(_0x29a715['error']){if(_0x29a715['error'][_0x16bf('0x10')]===0x1f4){logger[_0x16bf('0x11')](_0x16bf('0xb'),_0x166bb1,_0x29a715[_0x16bf('0x11')][_0x16bf('0x12')]);return _0x150cf4(_0x29a715[_0x16bf('0x11')][_0x16bf('0x12')]);}logger[_0x16bf('0x11')](_0x16bf('0xb'),_0x166bb1,_0x29a715['error'][_0x16bf('0x12')]);return _0x3852d0(_0x29a715[_0x16bf('0x11')]['message']);}else{logger[_0x16bf('0x13')](_0x16bf('0xb'),_0x166bb1,_0x16bf('0xc'));_0x3852d0(_0x29a715[_0x16bf('0x14')][_0x16bf('0x12')]);}})['catch'](function(_0x5456ee){logger['error'](_0x16bf('0xb'),_0x166bb1,_0x5456ee);_0x150cf4(_0x5456ee);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index fe7ff2d..58b1eb7 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 _0x9800=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1fc97e,_0x33aa22){var _0x189547=function(_0x11e15c){while(--_0x11e15c){_0x1fc97e['push'](_0x1fc97e['shift']());}};_0x189547(++_0x33aa22);}(_0x9800,0xf6));var _0x0980=function(_0x75d36f,_0x54af9e){_0x75d36f=_0x75d36f-0x0;var _0x2b0bab=_0x9800[_0x75d36f];return _0x2b0bab;};'use strict';var multer=require(_0x0980('0x0'));var util=require(_0x0980('0x1'));var path=require(_0x0980('0x2'));var timeout=require(_0x0980('0x3'));var express=require(_0x0980('0x4'));var router=express[_0x0980('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0980('0x6'));var config=require(_0x0980('0x7'));module['exports']=router; \ No newline at end of file +var _0x081e=['../../components/interaction/service','../../config/environment','exports','multer','path','express','Router'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x081e,0x129));var _0xe081=function(_0x13915f,_0x3d90c6){_0x13915f=_0x13915f-0x0;var _0x373181=_0x081e[_0x13915f];return _0x373181;};'use strict';var multer=require(_0xe081('0x0'));var util=require('util');var path=require(_0xe081('0x1'));var timeout=require('connect-timeout');var express=require(_0xe081('0x2'));var router=express[_0xe081('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe081('0x4'));var config=require(_0xe081('0x5'));module[_0xe081('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 01f73c2..dd8fee0 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x281305,_0x2998d6){var _0x56ffbe=function(_0x270b4c){while(--_0x270b4c){_0x281305['push'](_0x281305['shift']());}};_0x56ffbe(++_0x2998d6);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x469ab8,_0xeb5939){var _0x1f7a49=function(_0x3cb381){while(--_0x3cb381){_0x469ab8['push'](_0x469ab8['shift']());}};_0x1f7a49(++_0xeb5939);}(_0xe706,0xa3));var _0x6e70=function(_0x4612df,_0x37a8f7){_0x4612df=_0x4612df-0x0;var _0x2804c6=_0xe706[_0x4612df];return _0x2804c6;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index ec84246..b59612f 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(_0x2dbb9e,_0x41ae7a){var _0x394282=function(_0x5d5f8f){while(--_0x5d5f8f){_0x2dbb9e['push'](_0x2dbb9e['shift']());}};_0x394282(++_0x41ae7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x3b8080,_0x5ba504){var _0x573bdc=function(_0x56f7b0){while(--_0x56f7b0){_0x3b8080['push'](_0x3b8080['shift']());}};_0x573bdc(++_0x5ba504);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 d75ce1a..02e59e6 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 _0x6e64=['moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util'];(function(_0xaec935,_0x5f3d12){var _0x28a8e1=function(_0x4ca7a1){while(--_0x4ca7a1){_0xaec935['push'](_0xaec935['shift']());}};_0x28a8e1(++_0x5f3d12);}(_0x6e64,0x10f));var _0x46e6=function(_0x412ed6,_0x5ac827){_0x412ed6=_0x412ed6-0x0;var _0x3883d2=_0x6e64[_0x412ed6];return _0x3883d2;};'use strict';var _=require(_0x46e6('0x0'));var util=require(_0x46e6('0x1'));var moment=require(_0x46e6('0x2'));var BPromise=require(_0x46e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46e6('0x5'));var logger=require('../../config/logger')(_0x46e6('0x6'));var config=require(_0x46e6('0x7'));var jayson=require(_0x46e6('0x8'));var client=jayson[_0x46e6('0x9')][_0x46e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x420d3d,_0x5c7310,_0x1184c5){return new BPromise(function(_0x254590,_0x1af29f){return client[_0x46e6('0xb')](_0x420d3d,_0x1184c5)[_0x46e6('0xc')](function(_0x369de7){logger[_0x46e6('0xd')](_0x46e6('0xe'),_0x5c7310,_0x46e6('0xf'));logger[_0x46e6('0x10')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x5c7310,_0x46e6('0xf'),JSON['stringify'](_0x369de7));if(_0x369de7['error']){if(_0x369de7[_0x46e6('0x11')][_0x46e6('0x12')]===0x1f4){logger[_0x46e6('0x11')](_0x46e6('0xe'),_0x5c7310,_0x369de7['error']['message']);return _0x1af29f(_0x369de7[_0x46e6('0x11')][_0x46e6('0x13')]);}logger[_0x46e6('0x11')](_0x46e6('0xe'),_0x5c7310,_0x369de7[_0x46e6('0x11')][_0x46e6('0x13')]);return _0x254590(_0x369de7[_0x46e6('0x11')]['message']);}else{logger[_0x46e6('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x5c7310,_0x46e6('0xf'));_0x254590(_0x369de7[_0x46e6('0x14')]['message']);}})['catch'](function(_0x1f9e4f){logger[_0x46e6('0x11')](_0x46e6('0xe'),_0x5c7310,_0x1f9e4f);_0x1af29f(_0x1f9e4f);});});} \ No newline at end of file +var _0x254a=['http','request','info','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x254a,0x138));var _0xa254=function(_0x29782b,_0x33ff83){_0x29782b=_0x29782b-0x0;var _0x5c2c1f=_0x254a[_0x29782b];return _0x5c2c1f;};'use strict';var _=require(_0xa254('0x0'));var util=require(_0xa254('0x1'));var moment=require(_0xa254('0x2'));var BPromise=require('bluebird');var rs=require(_0xa254('0x3'));var fs=require('fs');var Redis=require(_0xa254('0x4'));var db=require(_0xa254('0x5'))['db'];var utils=require(_0xa254('0x6'));var logger=require('../../config/logger')(_0xa254('0x7'));var config=require('../../config/environment');var jayson=require(_0xa254('0x8'));var client=jayson[_0xa254('0x9')][_0xa254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597d72,_0x5951b2,_0xaeed42){return new BPromise(function(_0x352a44,_0x50c5a3){return client[_0xa254('0xb')](_0x597d72,_0xaeed42)['then'](function(_0x19d140){logger[_0xa254('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x5951b2,'request\x20sent');logger[_0xa254('0xd')](_0xa254('0xe'),_0x5951b2,_0xa254('0xf'),JSON[_0xa254('0x10')](_0x19d140));if(_0x19d140[_0xa254('0x11')]){if(_0x19d140['error'][_0xa254('0x12')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x5951b2,_0x19d140[_0xa254('0x11')][_0xa254('0x13')]);return _0x50c5a3(_0x19d140['error'][_0xa254('0x13')]);}logger[_0xa254('0x11')](_0xa254('0x14'),_0x5951b2,_0x19d140[_0xa254('0x11')][_0xa254('0x13')]);return _0x352a44(_0x19d140['error'][_0xa254('0x13')]);}else{logger[_0xa254('0xc')](_0xa254('0x14'),_0x5951b2,_0xa254('0xf'));_0x352a44(_0x19d140[_0xa254('0x15')][_0xa254('0x13')]);}})[_0xa254('0x16')](function(_0x1f21ae){logger[_0xa254('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x5951b2,_0x1f21ae);_0x50c5a3(_0x1f21ae);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 887a9ac..0600081 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 _0xfd8b=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0x8f7d2b,_0x1bebaf){var _0x13c298=function(_0x54717e){while(--_0x54717e){_0x8f7d2b['push'](_0x8f7d2b['shift']());}};_0x13c298(++_0x1bebaf);}(_0xfd8b,0xae));var _0xbfd8=function(_0x2ad2d1,_0x5886a5){_0x2ad2d1=_0x2ad2d1-0x0;var _0x235ef0=_0xfd8b[_0x2ad2d1];return _0x235ef0;};'use strict';var multer=require('multer');var util=require(_0xbfd8('0x0'));var path=require(_0xbfd8('0x1'));var timeout=require(_0xbfd8('0x2'));var express=require(_0xbfd8('0x3'));var router=express['Router']();var auth=require(_0xbfd8('0x4'));var interaction=require(_0xbfd8('0x5'));var config=require(_0xbfd8('0x6'));module[_0xbfd8('0x7')]=router; \ No newline at end of file +var _0xbe49=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbe49,0x1c1));var _0x9be4=function(_0x33678b,_0x528b1c){_0x33678b=_0x33678b-0x0;var _0x326df8=_0xbe49[_0x33678b];return _0x326df8;};'use strict';var multer=require('multer');var util=require(_0x9be4('0x0'));var path=require(_0x9be4('0x1'));var timeout=require(_0x9be4('0x2'));var express=require('express');var router=express[_0x9be4('0x3')]();var auth=require(_0x9be4('0x4'));var interaction=require(_0x9be4('0x5'));var config=require(_0x9be4('0x6'));module[_0x9be4('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index f545bbd..86cc148 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x1966f3,_0x210ea3){var _0x17575f=function(_0x7b18fb){while(--_0x7b18fb){_0x1966f3['push'](_0x1966f3['shift']());}};_0x17575f(++_0x210ea3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1bab80,_0x4eee84){var _0x8a83ae=function(_0x3e6555){while(--_0x3e6555){_0x1bab80['push'](_0x1bab80['shift']());}};_0x8a83ae(++_0x4eee84);}(_0xe706,0xa3));var _0x6e70=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xe706[_0x18cd5b];return _0x5eaa52;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 490e8b3..2bdd176 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 _0x14f5=['moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','lodash','api'];(function(_0x1de950,_0x325139){var _0x12dc31=function(_0x57409b){while(--_0x57409b){_0x1de950['push'](_0x1de950['shift']());}};_0x12dc31(++_0x325139);}(_0x14f5,0xbc));var _0x514f=function(_0x2f1089,_0x42d03d){_0x2f1089=_0x2f1089-0x0;var _0x1af573=_0x14f5[_0x2f1089];return _0x1af573;};'use strict';var _=require(_0x514f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x514f('0x1'));var moment=require(_0x514f('0x2'));var BPromise=require(_0x514f('0x3'));var rp=require(_0x514f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x514f('0x5'));var config=require(_0x514f('0x6'));var attributes=require(_0x514f('0x7'));module['exports']=function(_0x1b782c,_0x273f54){return _0x1b782c['define'](_0x514f('0x8'),attributes,{'tableName':_0x514f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3199=['user_has_openchannel_queues','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x11183a,_0x4b2f2b){var _0x2e779c=function(_0x4a2310){while(--_0x4a2310){_0x11183a['push'](_0x11183a['shift']());}};_0x2e779c(++_0x4b2f2b);}(_0x3199,0x169));var _0x9319=function(_0x344ebe,_0x43c595){_0x344ebe=_0x344ebe-0x0;var _0x54724a=_0x3199[_0x344ebe];return _0x54724a;};'use strict';var _=require(_0x9319('0x0'));var util=require('util');var logger=require(_0x9319('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9319('0x2'));var rp=require(_0x9319('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9319('0x4'));var config=require(_0x9319('0x5'));var attributes=require(_0x9319('0x6'));module[_0x9319('0x7')]=function(_0xa28833,_0x3a4082){return _0xa28833[_0x9319('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0x9319('0x9'),'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 e627db7..cb1b83c 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 _0x63ff=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x2b9aaf,_0x2e6714){var _0x5d167d=function(_0x174a3f){while(--_0x174a3f){_0x2b9aaf['push'](_0x2b9aaf['shift']());}};_0x5d167d(++_0x2e6714);}(_0x63ff,0x16d));var _0xf63f=function(_0x24cfd6,_0x1ac0df){_0x24cfd6=_0x24cfd6-0x0;var _0x4234cb=_0x63ff[_0x24cfd6];return _0x4234cb;};'use strict';var _=require(_0xf63f('0x0'));var util=require(_0xf63f('0x1'));var moment=require(_0xf63f('0x2'));var BPromise=require('bluebird');var rs=require(_0xf63f('0x3'));var fs=require('fs');var Redis=require(_0xf63f('0x4'));var db=require(_0xf63f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf63f('0x6'))(_0xf63f('0x7'));var config=require(_0xf63f('0x8'));var jayson=require(_0xf63f('0x9'));var client=jayson[_0xf63f('0xa')][_0xf63f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cfc87,_0x225775,_0x54179a){return new BPromise(function(_0x2a7999,_0x2da9c9){return client['request'](_0x4cfc87,_0x54179a)[_0xf63f('0xc')](function(_0x3a0096){logger['info'](_0xf63f('0xd'),_0x225775,'request\x20sent');logger[_0xf63f('0xe')](_0xf63f('0xf'),_0x225775,_0xf63f('0x10'),JSON[_0xf63f('0x11')](_0x3a0096));if(_0x3a0096[_0xf63f('0x12')]){if(_0x3a0096['error'][_0xf63f('0x13')]===0x1f4){logger[_0xf63f('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x225775,_0x3a0096[_0xf63f('0x12')]['message']);return _0x2da9c9(_0x3a0096[_0xf63f('0x12')][_0xf63f('0x14')]);}logger[_0xf63f('0x12')](_0xf63f('0xd'),_0x225775,_0x3a0096[_0xf63f('0x12')][_0xf63f('0x14')]);return _0x2a7999(_0x3a0096[_0xf63f('0x12')][_0xf63f('0x14')]);}else{logger[_0xf63f('0x15')](_0xf63f('0xd'),_0x225775,'request\x20sent');_0x2a7999(_0x3a0096['result'][_0xf63f('0x14')]);}})[_0xf63f('0x16')](function(_0x5e63ec){logger[_0xf63f('0x12')](_0xf63f('0xd'),_0x225775,_0x5e63ec);_0x2da9c9(_0x5e63ec);});});} \ No newline at end of file +var _0x792d=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x178bf7,_0x4e1f61){var _0x7080d6=function(_0xe253bb){while(--_0xe253bb){_0x178bf7['push'](_0x178bf7['shift']());}};_0x7080d6(++_0x4e1f61);}(_0x792d,0x160));var _0xd792=function(_0x3c95ba,_0x3355ea){_0x3c95ba=_0x3c95ba-0x0;var _0x2cdae7=_0x792d[_0x3c95ba];return _0x2cdae7;};'use strict';var _=require('lodash');var util=require(_0xd792('0x0'));var moment=require(_0xd792('0x1'));var BPromise=require('bluebird');var rs=require(_0xd792('0x2'));var fs=require('fs');var Redis=require(_0xd792('0x3'));var db=require(_0xd792('0x4'))['db'];var utils=require(_0xd792('0x5'));var logger=require('../../config/logger')(_0xd792('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd792('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41bbbc,_0x205ceb,_0x5c0ff0){return new BPromise(function(_0x52edaa,_0x3f4888){return client['request'](_0x41bbbc,_0x5c0ff0)[_0xd792('0x8')](function(_0x24aedf){logger[_0xd792('0x9')](_0xd792('0xa'),_0x205ceb,_0xd792('0xb'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x205ceb,_0xd792('0xb'),JSON[_0xd792('0xc')](_0x24aedf));if(_0x24aedf['error']){if(_0x24aedf[_0xd792('0xd')][_0xd792('0xe')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x205ceb,_0x24aedf[_0xd792('0xd')][_0xd792('0xf')]);return _0x3f4888(_0x24aedf[_0xd792('0xd')][_0xd792('0xf')]);}logger[_0xd792('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x205ceb,_0x24aedf[_0xd792('0xd')][_0xd792('0xf')]);return _0x52edaa(_0x24aedf[_0xd792('0xd')][_0xd792('0xf')]);}else{logger[_0xd792('0x9')](_0xd792('0xa'),_0x205ceb,_0xd792('0xb'));_0x52edaa(_0x24aedf[_0xd792('0x10')][_0xd792('0xf')]);}})[_0xd792('0x11')](function(_0x65426d){logger[_0xd792('0xd')](_0xd792('0xa'),_0x205ceb,_0x65426d);_0x3f4888(_0x65426d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7405184..6492bdd 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 _0x25b2=['/:id/sections','getResources','post','create','/:id/clone','addSections','/:id/resources','put','delete','destroy','removeResources','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x4f12b1,_0x3ed71d){var _0x54d002=function(_0x289678){while(--_0x289678){_0x4f12b1['push'](_0x4f12b1['shift']());}};_0x54d002(++_0x3ed71d);}(_0x25b2,0x1ee));var _0x225b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x25b2[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x225b('0x0'));var path=require(_0x225b('0x1'));var timeout=require(_0x225b('0x2'));var express=require('express');var router=express[_0x225b('0x3')]();var auth=require(_0x225b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x225b('0x5'));var controller=require('./userProfile.controller');router[_0x225b('0x6')]('/',auth['isAuthenticated'](),controller[_0x225b('0x7')]);router[_0x225b('0x6')](_0x225b('0x8'),auth['isAuthenticated'](),controller[_0x225b('0x9')]);router[_0x225b('0x6')](_0x225b('0xa'),auth[_0x225b('0xb')](),controller['show']);router[_0x225b('0x6')](_0x225b('0xc'),auth[_0x225b('0xb')](),controller['getSections']);router[_0x225b('0x6')]('/:id/resources',auth['isAuthenticated'](),controller[_0x225b('0xd')]);router[_0x225b('0xe')]('/',auth['isAuthenticated'](),controller[_0x225b('0xf')]);router[_0x225b('0xe')](_0x225b('0x10'),auth['isAuthenticated'](),controller['clone']);router[_0x225b('0xe')](_0x225b('0xc'),auth['isAuthenticated'](),controller[_0x225b('0x11')]);router[_0x225b('0xe')](_0x225b('0x12'),auth[_0x225b('0xb')](),controller['addResources']);router[_0x225b('0x13')]('/:id',auth[_0x225b('0xb')](),controller['update']);router[_0x225b('0x14')](_0x225b('0xa'),auth[_0x225b('0xb')](),controller[_0x225b('0x15')]);router['delete'](_0x225b('0xc'),auth[_0x225b('0xb')](),controller['removeSections']);router[_0x225b('0x14')]('/:id/resources',auth['isAuthenticated'](),controller[_0x225b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2bf1=['index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0x2bf1,0x1d4));var _0x12bf=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x2bf1[_0x23e7c1];return _0x1add43;};'use strict';var multer=require(_0x12bf('0x0'));var util=require(_0x12bf('0x1'));var path=require(_0x12bf('0x2'));var timeout=require(_0x12bf('0x3'));var express=require(_0x12bf('0x4'));var router=express[_0x12bf('0x5')]();var auth=require(_0x12bf('0x6'));var interaction=require(_0x12bf('0x7'));var config=require(_0x12bf('0x8'));var controller=require(_0x12bf('0x9'));router[_0x12bf('0xa')]('/',auth[_0x12bf('0xb')](),controller[_0x12bf('0xc')]);router[_0x12bf('0xa')](_0x12bf('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x12bf('0xa')](_0x12bf('0xe'),auth[_0x12bf('0xb')](),controller[_0x12bf('0xf')]);router[_0x12bf('0xa')](_0x12bf('0x10'),auth[_0x12bf('0xb')](),controller[_0x12bf('0x11')]);router[_0x12bf('0xa')](_0x12bf('0x12'),auth[_0x12bf('0xb')](),controller[_0x12bf('0x13')]);router[_0x12bf('0x14')]('/',auth[_0x12bf('0xb')](),controller[_0x12bf('0x15')]);router['post'](_0x12bf('0x16'),auth[_0x12bf('0xb')](),controller[_0x12bf('0x17')]);router['post']('/:id/sections',auth[_0x12bf('0xb')](),controller[_0x12bf('0x18')]);router['post'](_0x12bf('0x12'),auth[_0x12bf('0xb')](),controller[_0x12bf('0x19')]);router['put'](_0x12bf('0xe'),auth[_0x12bf('0xb')](),controller[_0x12bf('0x1a')]);router[_0x12bf('0x1b')](_0x12bf('0xe'),auth['isAuthenticated'](),controller[_0x12bf('0x1c')]);router[_0x12bf('0x1b')](_0x12bf('0x10'),auth[_0x12bf('0xb')](),controller[_0x12bf('0x1d')]);router[_0x12bf('0x1b')](_0x12bf('0x12'),auth[_0x12bf('0xb')](),controller[_0x12bf('0x1e')]);module[_0x12bf('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 893aa9c..4a7e2ee 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 _0x2136=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','name'];(function(_0x33608b,_0xff5330){var _0x51ac76=function(_0x3dd5ed){while(--_0x3dd5ed){_0x33608b['push'](_0x33608b['shift']());}};_0x51ac76(++_0xff5330);}(_0x2136,0x1eb));var _0x6213=function(_0x5c6968,_0x35f27a){_0x5c6968=_0x5c6968-0x0;var _0x243611=_0x2136[_0x5c6968];return _0x243611;};'use strict';var Sequelize=require(_0x6213('0x0'));module[_0x6213('0x1')]={'name':{'type':Sequelize[_0x6213('0x2')],'allowNull':![],'unique':_0x6213('0x3')},'crudPermissions':{'type':Sequelize[_0x6213('0x2')],'set':function(_0x31746c){this[_0x6213('0x4')](_0x6213('0x5'),_0x31746c?_0x31746c[_0x6213('0x6')](''):[]);},'get':function(){return this[_0x6213('0x7')]('crudPermissions')?this[_0x6213('0x7')](_0x6213('0x5'))[_0x6213('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x0e27=['crudPermissions','getDataValue','split','sequelize','exports','STRING','setDataValue'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x0e27,0x13e));var _0x70e2=function(_0x3d75da,_0x372212){_0x3d75da=_0x3d75da-0x0;var _0x1bd83f=_0x0e27[_0x3d75da];return _0x1bd83f;};'use strict';var Sequelize=require(_0x70e2('0x0'));module[_0x70e2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x70e2('0x2')],'set':function(_0x54c98e){this[_0x70e2('0x3')](_0x70e2('0x4'),_0x54c98e?_0x54c98e['join'](''):[]);},'get':function(){return this[_0x70e2('0x5')](_0x70e2('0x4'))?this[_0x70e2('0x5')]('crudPermissions')[_0x70e2('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 92b85a3..2d525ef 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 _0x4cc6=['sounds','Sound','tags','triggers','Trigger','trunks','Trunk','variables','Variable','extractedreports','Reports','metrics','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','catch','show','params','includeAll','include','options','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','push','removeSections','findAll','enabled','isEmpty','includes','subsections','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','findOne','all','ignore','union','childModel','nolimit','field','AnalyticExtractedReport','associatedResources','reportType','reportId','DefaultReports','custom','CustomReports','rows','CmContact','Tags','color','tag','Tag','ThroughTags','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','users','telephones','Users','user','Telephones','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','dispositions','Disposition','intervals','Interval','Pause','scheduler','Schedule'];(function(_0x1a897b,_0x33c762){var _0x54da75=function(_0x45054e){while(--_0x45054e){_0x1a897b['push'](_0x1a897b['shift']());}};_0x54da75(++_0x33c762);}(_0x4cc6,0x1ea));var _0x64cc=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x4cc6[_0x20fdc1];return _0x25397c;};'use strict';var pdf=require(_0x64cc('0x0'));var emlformat=require(_0x64cc('0x1'));var rimraf=require(_0x64cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64cc('0x3'));var rp=require(_0x64cc('0x4'));var moment=require(_0x64cc('0x5'));var BPromise=require(_0x64cc('0x6'));var Mustache=require('mustache');var util=require(_0x64cc('0x7'));var path=require(_0x64cc('0x8'));var sox=require(_0x64cc('0x9'));var csv=require(_0x64cc('0xa'));var ejs=require(_0x64cc('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x64cc('0xc'));var crypto=require(_0x64cc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x64cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x64cc('0xf'));var Papa=require(_0x64cc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64cc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64cc('0x12'));var logger=require(_0x64cc('0x13'))('api');var utils=require(_0x64cc('0x14'));var config=require(_0x64cc('0x15'));var db=require('../../mysqldb')['db'];config[_0x64cc('0x16')]=_[_0x64cc('0x17')](config[_0x64cc('0x16')],{'host':_0x64cc('0x18'),'port':0x18eb});var socket=require(_0x64cc('0x19'))(new Redis(config['redis']));require(_0x64cc('0x1a'))[_0x64cc('0x1b')](socket);function respondWithStatusCode(_0xecfd4b,_0x78bd3e){_0x78bd3e=_0x78bd3e||0xcc;return function(_0x431cd){if(_0x431cd){return _0xecfd4b['sendStatus'](_0x78bd3e);}return _0xecfd4b[_0x64cc('0x1c')](_0x78bd3e)[_0x64cc('0x1d')]();};}function respondWithResult(_0x2a2e19,_0x5ee86f){_0x5ee86f=_0x5ee86f||0xc8;return function(_0x2d0762){if(_0x2d0762){return _0x2a2e19['status'](_0x5ee86f)[_0x64cc('0x1e')](_0x2d0762);}};}function respondWithFilteredResult(_0xf3ce21,_0x5dd22){return function(_0x2ff02a){if(_0x2ff02a){var _0x3b4b6f=_0x2ff02a['count'],_0x8a28e1=_0x5dd22[_0x64cc('0x1f')],_0x590f85=_0x5dd22[_0x64cc('0x1f')]+_0x5dd22[_0x64cc('0x20')],_0x1d6c5f;if(_0x590f85>=_0x3b4b6f){_0x590f85=_0x3b4b6f;_0x1d6c5f=0xc8;}else{_0x1d6c5f=0xce;}_0xf3ce21[_0x64cc('0x1c')](_0x1d6c5f);return _0xf3ce21[_0x64cc('0x21')](_0x64cc('0x22'),_0x8a28e1+'-'+_0x590f85+'/'+_0x3b4b6f)['json'](_0x2ff02a);}return null;};}function patchUpdates(_0x562e3e){return function(_0x188ee6){try{jsonpatch['apply'](_0x188ee6,_0x562e3e,!![]);}catch(_0x521ca9){return BPromise[_0x64cc('0x23')](_0x521ca9);}return _0x188ee6[_0x64cc('0x24')]();};}function saveUpdates(_0x212bc9,_0xc8474e){return function(_0xac937a){if(_0xac937a){return _0xac937a[_0x64cc('0x25')](_0x212bc9)[_0x64cc('0x26')](function(_0x3820ce){return _0x3820ce;});}return null;};}function removeEntity(_0x459809,_0x124bf8){return function(_0x29503a){if(_0x29503a){return _0x29503a[_0x64cc('0x27')]()['then'](function(){_0x459809[_0x64cc('0x1c')](0xcc)[_0x64cc('0x1d')]();});}};}function handleEntityNotFound(_0x3cd537,_0x17779a){return function(_0x5969a2){if(!_0x5969a2){_0x3cd537[_0x64cc('0x28')](0x194);}return _0x5969a2;};}function handleError(_0x3848ec,_0x2bede8){_0x2bede8=_0x2bede8||0x1f4;return function(_0xa16e6c){logger['error'](_0xa16e6c[_0x64cc('0x29')]);if(_0xa16e6c[_0x64cc('0x2a')]){delete _0xa16e6c[_0x64cc('0x2a')];}_0x3848ec['status'](_0x2bede8)[_0x64cc('0x2b')](_0xa16e6c);};}exports['index']=function(_0xd6e99c,_0x436cbf){var _0x4fe251={},_0x3096a2={},_0x2b9e39={'count':0x0,'rows':[]};var _0x58d76c=_[_0x64cc('0x2c')](db[_0x64cc('0x2d')][_0x64cc('0x2e')],function(_0xc1d0b6){return{'name':_0xc1d0b6[_0x64cc('0x2f')],'type':_0xc1d0b6[_0x64cc('0x30')][_0x64cc('0x31')]};});_0x3096a2[_0x64cc('0x32')]=_['map'](_0x58d76c,_0x64cc('0x2a'));_0x3096a2[_0x64cc('0x33')]=_[_0x64cc('0x34')](_0xd6e99c[_0x64cc('0x33')]);_0x3096a2[_0x64cc('0x35')]=_[_0x64cc('0x36')](_0x3096a2[_0x64cc('0x32')],_0x3096a2[_0x64cc('0x33')]);_0x4fe251[_0x64cc('0x37')]=_[_0x64cc('0x36')](_0x3096a2[_0x64cc('0x32')],qs[_0x64cc('0x38')](_0xd6e99c['query'][_0x64cc('0x38')]));_0x4fe251[_0x64cc('0x37')]=_0x4fe251['attributes'][_0x64cc('0x39')]?_0x4fe251[_0x64cc('0x37')]:_0x3096a2[_0x64cc('0x32')];if(!_0xd6e99c[_0x64cc('0x33')][_0x64cc('0x3a')]('nolimit')){_0x4fe251[_0x64cc('0x20')]=qs[_0x64cc('0x20')](_0xd6e99c[_0x64cc('0x33')][_0x64cc('0x20')]);_0x4fe251[_0x64cc('0x1f')]=qs[_0x64cc('0x1f')](_0xd6e99c[_0x64cc('0x33')][_0x64cc('0x1f')]);}_0x4fe251[_0x64cc('0x3b')]=qs[_0x64cc('0x3c')](_0xd6e99c[_0x64cc('0x33')][_0x64cc('0x3c')]);_0x4fe251[_0x64cc('0x3d')]=qs[_0x64cc('0x35')](_[_0x64cc('0x3e')](_0xd6e99c[_0x64cc('0x33')],_0x3096a2[_0x64cc('0x35')]),_0x58d76c);if(_0xd6e99c[_0x64cc('0x33')][_0x64cc('0x3f')]){_0x4fe251[_0x64cc('0x3d')]=_[_0x64cc('0x40')](_0x4fe251[_0x64cc('0x3d')],{'$or':_['map'](_0x58d76c,function(_0x48d278){if(_0x48d278[_0x64cc('0x30')]!==_0x64cc('0x41')){var _0x45654e={};_0x45654e[_0x48d278[_0x64cc('0x2a')]]={'$like':'%'+_0xd6e99c[_0x64cc('0x33')][_0x64cc('0x3f')]+'%'};return _0x45654e;}})});}_0x4fe251=_[_0x64cc('0x40')]({},_0x4fe251,_0xd6e99c['options']);var _0x3a1ea6={'where':_0x4fe251[_0x64cc('0x3d')]};return db[_0x64cc('0x2d')][_0x64cc('0x42')](_0x3a1ea6)[_0x64cc('0x26')](function(_0x3587ea){_0x2b9e39[_0x64cc('0x42')]=_0x3587ea;if(_0xd6e99c[_0x64cc('0x33')]['includeAll']){_0x4fe251['include']=[{'all':!![]}];}return db[_0x64cc('0x2d')]['findAll'](_0x4fe251);})[_0x64cc('0x26')](function(_0x4ed4d8){_0x2b9e39['rows']=_0x4ed4d8;return _0x2b9e39;})[_0x64cc('0x26')](respondWithFilteredResult(_0x436cbf,_0x4fe251))[_0x64cc('0x43')](handleError(_0x436cbf,null));};exports[_0x64cc('0x44')]=function(_0x35201f,_0x443e3c){var _0x5cb004={'raw':![],'where':{'id':_0x35201f[_0x64cc('0x45')]['id']}},_0x30d7bc={};_0x30d7bc['model']=_[_0x64cc('0x34')](db[_0x64cc('0x2d')][_0x64cc('0x2e')]);_0x30d7bc[_0x64cc('0x33')]=_[_0x64cc('0x34')](_0x35201f[_0x64cc('0x33')]);_0x30d7bc['filters']=_['intersection'](_0x30d7bc['model'],_0x30d7bc['query']);_0x5cb004[_0x64cc('0x37')]=_[_0x64cc('0x36')](_0x30d7bc['model'],qs[_0x64cc('0x38')](_0x35201f[_0x64cc('0x33')][_0x64cc('0x38')]));_0x5cb004[_0x64cc('0x37')]=_0x5cb004[_0x64cc('0x37')][_0x64cc('0x39')]?_0x5cb004[_0x64cc('0x37')]:_0x30d7bc[_0x64cc('0x32')];if(_0x35201f[_0x64cc('0x33')][_0x64cc('0x46')]){_0x5cb004[_0x64cc('0x47')]=[{'all':!![]}];}_0x5cb004=_[_0x64cc('0x40')]({},_0x5cb004,_0x35201f[_0x64cc('0x48')]);return db['UserProfile']['find'](_0x5cb004)[_0x64cc('0x26')](handleEntityNotFound(_0x443e3c,null))[_0x64cc('0x26')](respondWithResult(_0x443e3c,null))[_0x64cc('0x43')](handleError(_0x443e3c,null));};exports[_0x64cc('0x49')]=function(_0x13f0ac,_0x1ede6c){return db['UserProfile']['create'](_0x13f0ac[_0x64cc('0x4a')],{})[_0x64cc('0x26')](respondWithResult(_0x1ede6c,0xc9))[_0x64cc('0x43')](handleError(_0x1ede6c,null));};exports[_0x64cc('0x4b')]=function(_0x10cf47,_0x4b8d4f){var _0x395832={'where':{'id':_0x10cf47[_0x64cc('0x45')]['id']}},_0x2c337e={};_0x2c337e[_0x64cc('0x32')]=_['keys'](db['UserProfile'][_0x64cc('0x2e')]);_0x395832[_0x64cc('0x37')]=_[_0x64cc('0x36')](_0x2c337e[_0x64cc('0x32')],qs['fields'](_0x10cf47['query'][_0x64cc('0x38')]));_0x395832[_0x64cc('0x37')]=_0x395832[_0x64cc('0x37')][_0x64cc('0x39')]?_0x395832[_0x64cc('0x37')]:_0x2c337e[_0x64cc('0x32')];if(_0x10cf47[_0x64cc('0x33')][_0x64cc('0x46')]){_0x395832[_0x64cc('0x47')]=[{'all':!![]}];}_0x395832=_[_0x64cc('0x40')]({},_0x395832,_0x10cf47[_0x64cc('0x48')]);return db[_0x64cc('0x2d')][_0x64cc('0x4c')](_0x395832)[_0x64cc('0x26')](handleEntityNotFound(_0x4b8d4f,null))[_0x64cc('0x26')](function(_0x3d1c61){if(_0x3d1c61){var _0x1256c8=_0x3d1c61[_0x64cc('0x4d')]({'plain':!![]});_0x1256c8=qs[_0x64cc('0x4e')](_0x1256c8,['id',_0x64cc('0x4f'),_0x64cc('0x50'),_0x64cc('0x51')]);_0x10cf47[_0x64cc('0x4a')]=_[_0x64cc('0x4e')](_0x10cf47[_0x64cc('0x4a')],['id',_0x64cc('0x4f'),_0x64cc('0x50')]);return db[_0x64cc('0x52')][_0x64cc('0x53')](function(_0x282f0b){return db[_0x64cc('0x2d')][_0x64cc('0x49')](_[_0x64cc('0x40')](_0x1256c8,_0x10cf47[_0x64cc('0x4a')]),{'include':_0x10cf47[_0x64cc('0x33')][_0x64cc('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x282f0b})[_0x64cc('0x26')](function(_0x58e312){var _0x483b8d=_0x58e312['get']({'plain':!![]});return db[_0x64cc('0x54')]['findAll']({'where':{'userProfileId':_0x10cf47[_0x64cc('0x45')]['id']},'raw':!![]})[_0x64cc('0x26')](function(_0x4a1a53){if(_0x4a1a53){return BPromise[_0x64cc('0x55')](_0x4a1a53,function(_0x61350b){return new BPromise(function(_0x412bb2,_0x44340b){if(_0x61350b[_0x64cc('0x56')]===null||_0x61350b['autoAssociation']===0x1)_0x412bb2(null);return db[_0x64cc('0x57')]['findAll']({'where':{'sectionId':_0x61350b['id']},'raw':!![]})[_0x64cc('0x26')](function(_0x31711e){var _0x270dd2=_['map'](_0x31711e,function(_0x1fbef4){return qs['omit'](_0x1fbef4,['id',_0x64cc('0x4f'),_0x64cc('0x50'),_0x64cc('0x58')]);});_0x412bb2(_0x270dd2);})['catch'](function(_0x29ad76){_0x44340b(_0x29ad76);});})[_0x64cc('0x26')](function(_0x7ef4b0){var _0x413ba0=qs['omit'](_0x61350b,['id',_0x64cc('0x4f'),_0x64cc('0x50')]);_0x413ba0[_0x64cc('0x59')]=_0x483b8d['id'];if(_0x7ef4b0)_0x413ba0[_0x64cc('0x5a')]=_0x7ef4b0;return _0x413ba0;})[_0x64cc('0x26')](function(_0xe60f5c){return db['UserProfileSection']['create'](_0xe60f5c,{'include':[{'model':db['UserProfileResource'],'as':_0x64cc('0x5a')}],'raw':!![],'transaction':_0x282f0b});});})[_0x64cc('0x26')](function(){return _0x483b8d;});}});});});}})[_0x64cc('0x26')](respondWithResult(_0x4b8d4f,0xc9))[_0x64cc('0x43')](handleError(_0x4b8d4f,null));};exports[_0x64cc('0x25')]=function(_0x3f3984,_0x2717cf){if(_0x3f3984[_0x64cc('0x4a')]['id']){delete _0x3f3984[_0x64cc('0x4a')]['id'];}return db[_0x64cc('0x2d')]['find']({'where':{'id':_0x3f3984[_0x64cc('0x45')]['id']}})[_0x64cc('0x26')](handleEntityNotFound(_0x2717cf,null))[_0x64cc('0x26')](saveUpdates(_0x3f3984[_0x64cc('0x4a')],null))['then'](respondWithResult(_0x2717cf,null))[_0x64cc('0x43')](handleError(_0x2717cf,null));};exports['destroy']=function(_0x5bf22f,_0x15d9e7){return db[_0x64cc('0x2d')][_0x64cc('0x4c')]({'where':{'id':_0x5bf22f[_0x64cc('0x45')]['id']}})['then'](handleEntityNotFound(_0x15d9e7,null))[_0x64cc('0x26')](removeEntity(_0x15d9e7,null))[_0x64cc('0x43')](handleError(_0x15d9e7,null));};exports[_0x64cc('0x5b')]=function(_0x5126f7,_0x25952c){return db[_0x64cc('0x2d')]['describe']()[_0x64cc('0x26')](respondWithResult(_0x25952c,null))['catch'](handleError(_0x25952c,null));};exports['addSections']=function(_0x2a232a,_0x1357fd){var _0x4dd31b=_0x2a232a[_0x64cc('0x4a')];return db[_0x64cc('0x2d')]['find']({'where':{'id':_0x2a232a[_0x64cc('0x45')]['id']}})['then'](handleEntityNotFound(_0x1357fd,null))[_0x64cc('0x26')](function(_0x52677b){if(_0x52677b){return db[_0x64cc('0x52')]['transaction'](function(_0x6b13d0){return db[_0x64cc('0x54')][_0x64cc('0x27')]({'where':{'userProfileId':_0x2a232a[_0x64cc('0x45')]['id'],'sectionId':_[_0x64cc('0x2c')](_0x4dd31b,function(_0x87def7){return _0x87def7[_0x64cc('0x58')];})},'transaction':_0x6b13d0})[_0x64cc('0x26')](function(){var _0x272bfb=_[_0x64cc('0x2c')](_0x4dd31b,function(_0x1ffbe9){_0x1ffbe9[_0x64cc('0x59')]=_0x2a232a['params']['id'];return _0x1ffbe9;});var _0xdf47d4=[];return BPromise['each'](_0x272bfb,function(_0x62b47f){return db[_0x64cc('0x54')][_0x64cc('0x49')](_0x62b47f,{'include':[{'model':db[_0x64cc('0x57')],'as':_0x64cc('0x5a')}],'raw':!![],'transaction':_0x6b13d0})['then'](function(_0xbc254){_0xdf47d4[_0x64cc('0x5c')](_0xbc254[_0x64cc('0x4d')]({'plain':!![]}));});})[_0x64cc('0x26')](function(){return _0xdf47d4;});});});}})[_0x64cc('0x26')](function(_0x211b52){return _0x211b52;})['then'](respondWithResult(_0x1357fd,null))[_0x64cc('0x43')](handleError(_0x1357fd,null));};exports[_0x64cc('0x5d')]=function(_0x3a0ea9,_0x2491ff){var _0x49f324;return db[_0x64cc('0x2d')][_0x64cc('0x4c')]({'where':{'id':_0x3a0ea9['params']['id']},'attributes':['id',_0x64cc('0x2a')]})[_0x64cc('0x26')](handleEntityNotFound(_0x2491ff,null))[_0x64cc('0x26')](function(_0x3797f4){if(_0x3797f4){_0x49f324=_0x3797f4;return db['UserProfileSection'][_0x64cc('0x27')]({'where':{'userProfileId':_0x3a0ea9[_0x64cc('0x45')]['id'],'sectionId':_0x3a0ea9[_0x64cc('0x33')]['ids']}});}})['then'](function(){return _0x49f324;})[_0x64cc('0x26')](respondWithStatusCode(_0x2491ff,null))[_0x64cc('0x43')](handleError(_0x2491ff,null));};exports['getSections']=function(_0x3d916e,_0x5abaf2){var _0x369666=[];var _0x3ab8e3=[];return db['UserProfileSection'][_0x64cc('0x5e')]({'where':{'userProfileId':_0x3d916e[_0x64cc('0x45')]['id']},'raw':!![]})[_0x64cc('0x26')](function(_0x3e5cbf){_0x369666=_[_0x64cc('0x3f')](_0x3e5cbf,function(_0x2e59b2){return _0x2e59b2[_0x64cc('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0x2e59b2[_0x64cc('0x58')]);});if(!_[_0x64cc('0x60')](_0x369666)){return _[_0x64cc('0x2c')](_0x369666,function(_0x1f8a2d){return _0x1f8a2d['sectionId'];});}else{return;}})[_0x64cc('0x26')](function(_0x2d5afe){if(_0x2d5afe)_0x3ab8e3=_0x2d5afe;if(_[_0x64cc('0x61')](_0x3ab8e3,0x64)){var _0x41e45b=_[_0x64cc('0x4c')](_0x369666,{'sectionId':0x64});return hasDefaultDashboard(_0x41e45b)[_0x64cc('0x26')](function(_0xa6a1a3){return _[_0x64cc('0x2c')](_0x369666,function(_0x27f223){if(_0x27f223[_0x64cc('0x58')]===0x64){_0x27f223[_0x64cc('0x62')]=_0xa6a1a3;}return _0x27f223;});});}else{return;}})['then'](function(_0x35dde7){if(_0x35dde7)_0x369666=_0x35dde7;if(_[_0x64cc('0x61')](_0x3ab8e3,0x3eb)){var _0x55c22f=_['find'](_0x369666,{'sectionId':0x3eb});return getCustomDashboards(_0x55c22f)['then'](function(_0x1061b1){return _[_0x64cc('0x2c')](_0x369666,function(_0x2073e7){if(_0x55c22f[_0x64cc('0x5f')]){if(_0x2073e7[_0x64cc('0x58')]===0x3eb){_0x2073e7[_0x64cc('0x62')]=_0x1061b1;}}else{if(_0x2073e7[_0x64cc('0x58')]===0x64){_0x2073e7['subsections']=_0x1061b1;}}return _0x2073e7;});});}else{return;}})[_0x64cc('0x26')](function(_0xd43a88){if(_0xd43a88)_0x369666=_0xd43a88;if(_[_0x64cc('0x61')](_0x3ab8e3,0x709)){var _0x3f9d89=_['find'](_0x369666,{'sectionId':0x709});return getPlugins(_0x3f9d89)['then'](function(_0x3e7c0){if(_0x3f9d89[_0x64cc('0x5f')]){return _[_0x64cc('0x2c')](_0x369666,function(_0x29bf30){if(_0x29bf30[_0x64cc('0x58')]===0x709){_0x29bf30[_0x64cc('0x62')]=_0x3e7c0;}return _0x29bf30;});}else{var _0x35cce4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3e7c0};var _0x55a6cb=_[_0x64cc('0x2c')](_0x369666);_0x55a6cb['push'](_0x35cce4);return _0x55a6cb;}});}else{return;}})[_0x64cc('0x26')](function(_0x31d761){if(_0x31d761)_0x369666=_0x31d761;return _[_0x64cc('0x3f')](_0x369666,[_0x64cc('0x5f'),0x1]);})['then'](respondWithResult(_0x5abaf2,null))['catch'](handleError(_0x5abaf2,null));};function hasDefaultDashboard(_0x5d70a6){var _0x532cfa=[0x65];return new BPromise(function(_0x5f3efb,_0x38c9cf){try{if(_0x5d70a6['autoAssociation']){_0x5f3efb(_0x532cfa);}else{return db[_0x64cc('0x57')]['findOne']({'where':{'sectionId':_0x5d70a6['id']},'raw':!![]})[_0x64cc('0x26')](function(_0x21479){_0x21479?_0x5f3efb(_0x532cfa):_0x5f3efb();});}}catch(_0x242c14){_0x38c9cf(_0x242c14);}});}function getCustomDashboards(_0x3b06f8){var _0x1a0b06=[];return new BPromise(function(_0x3f9d2d,_0x71e95a){try{if(_0x3b06f8[_0x64cc('0x56')]){return db[_0x64cc('0x63')][_0x64cc('0x5e')]({'raw':!![]})[_0x64cc('0x26')](function(_0xac3ea1){_0xac3ea1[_0x64cc('0x64')](function(_0x31081b){_0x1a0b06[_0x64cc('0x5c')](_0x31081b['id']+0x1869f);});_0x3f9d2d(_0x1a0b06);});}else{return db[_0x64cc('0x57')][_0x64cc('0x5e')]({'where':{'sectionId':_0x3b06f8['id']},'raw':!![]})[_0x64cc('0x26')](function(_0x165c42){_0x165c42[_0x64cc('0x64')](function(_0x1ec2a3){_0x1a0b06['push'](_0x1ec2a3[_0x64cc('0x65')]+0x1869f);});_0x3f9d2d(_0x1a0b06);});}}catch(_0x134073){_0x71e95a(_0x134073);}});}function getPlugins(_0x3288d2){var _0x474101=[];return new BPromise(function(_0x1158d2,_0x51b0b1){try{if(_0x3288d2[_0x64cc('0x56')]){return db[_0x64cc('0x66')]['findAll']({'raw':!![]})[_0x64cc('0x26')](function(_0x5305c1){_0x5305c1['forEach'](function(_0x34700f){_0x474101[_0x64cc('0x5c')](_0x34700f['id']+0x15b38);});_0x1158d2(_0x474101);});}else{return db[_0x64cc('0x57')][_0x64cc('0x5e')]({'where':{'sectionId':_0x3288d2['id']},'raw':!![]})['then'](function(_0xcf0dc5){_0xcf0dc5[_0x64cc('0x64')](function(_0x57fe8b){_0x474101[_0x64cc('0x5c')](_0x57fe8b[_0x64cc('0x65')]+0x15b38);});_0x1158d2(_0x474101);});}}catch(_0x598671){_0x51b0b1(_0x598671);}});}exports[_0x64cc('0x67')]=function(_0x66d960,_0x35b03c){return db['UserProfile'][_0x64cc('0x4c')]({'where':{'id':_0x66d960[_0x64cc('0x45')]['id']}})[_0x64cc('0x26')](handleEntityNotFound(_0x35b03c,null))[_0x64cc('0x26')](function(_0x650ab1){if(_0x650ab1){return db[_0x64cc('0x52')][_0x64cc('0x53')](function(_0x292d15){return db[_0x64cc('0x54')][_0x64cc('0x5e')]({'where':{'userProfileId':_0x66d960[_0x64cc('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x5e4e8d){if(_0x5e4e8d){return db[_0x64cc('0x54')]['destroy']({'where':{'userProfileId':_0x66d960[_0x64cc('0x45')]['id'],'id':_[_0x64cc('0x2c')](_0x5e4e8d,function(_0x46988b){return _0x46988b['id'];})},'transaction':_0x292d15});}})[_0x64cc('0x26')](function(_0x1c60e4){var _0x5685d5=_[_0x64cc('0x2c')](_0x66d960['body'],function(_0x233acf){_0x233acf['userProfileId']=_0x66d960[_0x64cc('0x45')]['id'];return _0x233acf;});return db[_0x64cc('0x54')]['bulkCreate'](_0x5685d5,{'raw':!![],'transaction':_0x292d15});})[_0x64cc('0x26')](function(_0xcd6ff2){var _0x25b5a6=_[_0x64cc('0x3f')](_[_0x64cc('0x2c')](_0xcd6ff2,function(_0x39d158){return _0x39d158['get']({'plain':!![]});}),{'includeAll':![]});if(_0x25b5a6){return db[_0x64cc('0x54')][_0x64cc('0x5e')]({'where':{'userProfileId':_0x66d960['params']['id'],'sectionId':_[_0x64cc('0x2c')](_0x25b5a6,function(_0x555adc){return _0x555adc[_0x64cc('0x58')];})},'attributes':['id',_0x64cc('0x58')],'raw':!![]})[_0x64cc('0x26')](function(_0x1e84e8){var _0x2a53bc=_[_0x64cc('0x2c')](_0x66d960[_0x64cc('0x4a')],function(_0x3ab4bb){_0x3ab4bb['userProfileId']=_0x66d960[_0x64cc('0x45')]['id'];return _0x3ab4bb;});return db['UserProfileResource'][_0x64cc('0x68')](_0x2a53bc,{'raw':!![],'transaction':_0x292d15});});}})[_0x64cc('0x43')](handleError(_0x35b03c,null));});}})['then'](function(_0x25e484){var _0x282c5e=_[_0x64cc('0x2c')](_0x25e484,function(_0x44635e){return _0x44635e[_0x64cc('0x4d')]({'plain':!![]});});})[_0x64cc('0x26')](respondWithResult(_0x35b03c,null))[_0x64cc('0x43')](handleError(_0x35b03c,null));};exports['removeResources']=function(_0x1ee8fe,_0xbe43bc,_0x217fbf){return db[_0x64cc('0x2d')][_0x64cc('0x4c')]({'where':{'id':_0x1ee8fe['params']['id']}})[_0x64cc('0x26')](handleEntityNotFound(_0xbe43bc,null))[_0x64cc('0x26')](function(_0x2d10b7){if(_0x2d10b7){return _0x2d10b7[_0x64cc('0x69')](_0x1ee8fe['query'][_0x64cc('0x6a')]);}})[_0x64cc('0x26')](respondWithStatusCode(_0xbe43bc,null))[_0x64cc('0x43')](handleError(_0xbe43bc,null));};exports[_0x64cc('0x6b')]=function(_0x2d8cb9,_0xb42859){var _0x44bcf2={'raw':![],'where':{}};var _0x334c66={};var _0x19c462={'count':0x0,'rows':[]};var _0x11579e=_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x6c')];if(typeof _0x11579e===_0x64cc('0x6d')){throw new db[(_0x64cc('0x6e'))][(_0x64cc('0x6f'))](_0x64cc('0x70'));}var _0x1fb46b=_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x71')]||![];var _0x391be2=getQueryModels(_0x11579e,_0x1fb46b);if(typeof _0x391be2['childModel']===_0x64cc('0x6d')){throw new db[(_0x64cc('0x6e'))][(_0x64cc('0x6f'))](_0x64cc('0x72')+_0x11579e+'\x27');}var _0x1314fc=[];if(!_[_0x64cc('0x60')](_0x391be2[_0x64cc('0x73')])){_0x1314fc=_0x391be2[_0x64cc('0x73')];}else{_0x1314fc=[{'name':_0x11579e}];}return db[_0x64cc('0x2d')][_0x64cc('0x74')]({'where':{'id':_0x2d8cb9[_0x64cc('0x45')]['id']}})[_0x64cc('0x26')](handleEntityNotFound(_0xb42859,null))[_0x64cc('0x26')](function(_0x411e38){if(_0x411e38){var _0x54f794=[];for(var _0x2891dd=0x0;_0x2891dd<_0x1314fc[_0x64cc('0x39')];_0x2891dd++){_0x54f794[_0x64cc('0x5c')](db[_0x64cc('0x54')]['findOne']({'where':{'userProfileId':_0x411e38['id'],'name':_0x1314fc[_0x2891dd]['name']},'raw':!![]}));}return BPromise[_0x64cc('0x75')](_0x54f794);}})['then'](function(_0x51c64b){var _0x50b91c=_[_0x64cc('0x3f')](_0x51c64b,function(_0x505def){return _0x505def?_0x505def:undefined;});var _0x14549f=_[_0x64cc('0x3f')](_0x1314fc,[_0x64cc('0x76'),!![]]);var _0x27e51d=_[_0x64cc('0x60')](_0x50b91c)&&_['isEmpty'](_0x14549f)?null:_[_0x64cc('0x77')](_0x14549f,_0x50b91c);if(_0x27e51d){var _0x293584=[];for(var _0x24fdff=0x0;_0x24fdff<_0x27e51d[_0x64cc('0x39')];_0x24fdff++){var _0x4b5e4e=_['find'](_0x1314fc,function(_0x11b8e3){return _0x27e51d[_0x24fdff]?_0x11b8e3[_0x64cc('0x2a')]===_0x27e51d[_0x24fdff][_0x64cc('0x2a')]:null;});if(_0x4b5e4e){if(_0x27e51d[_0x24fdff][_0x64cc('0x76')]){_0x293584[_0x64cc('0x5c')](getAllResources(_0x391be2[_0x64cc('0x78')],_0x27e51d[_0x24fdff]));}else{if(!_0x27e51d[_0x24fdff][_0x64cc('0x56')]){_0x293584[_0x64cc('0x5c')](getAllowedResources(_0x4b5e4e,_0x27e51d[_0x24fdff],_0x391be2[_0x64cc('0x78')]));}else{if(_0x4b5e4e[_0x64cc('0x32')]){_0x293584['push'](getAllFilteredResources(_0x4b5e4e,_0x27e51d[_0x24fdff]));}}}}}return BPromise[_0x64cc('0x75')](_0x293584);}else{return null;}})[_0x64cc('0x26')](function(_0x11351f){var _0x1bd1c7=_0x11351f;var _0x269d01=null;if(_0x1bd1c7){_0x269d01=_0x1bd1c7[_0x64cc('0x39')]===0x1?_0x1bd1c7[0x0]:null;}if(_0x269d01||_0x1bd1c7){var _0x214361=db[_0x391be2[_0x64cc('0x78')]]['rawAttributes'];_0x334c66['model']=_['keys'](_0x214361);_0x334c66[_0x64cc('0x33')]=_[_0x64cc('0x34')](_0x2d8cb9[_0x64cc('0x33')]);_0x334c66[_0x64cc('0x35')]=_[_0x64cc('0x36')](_0x334c66['model'],_0x334c66[_0x64cc('0x33')]);_0x44bcf2[_0x64cc('0x37')]=_[_0x64cc('0x36')](_0x334c66[_0x64cc('0x32')],qs[_0x64cc('0x38')](_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x38')]));_0x44bcf2[_0x64cc('0x37')]=_0x44bcf2[_0x64cc('0x37')]['length']?_0x44bcf2[_0x64cc('0x37')]:_0x334c66[_0x64cc('0x32')];if(!_0x2d8cb9['query']['hasOwnProperty'](_0x64cc('0x79'))){_0x44bcf2[_0x64cc('0x20')]=qs['limit'](_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x20')]);_0x44bcf2[_0x64cc('0x1f')]=qs[_0x64cc('0x1f')](_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x1f')]);}_0x44bcf2[_0x64cc('0x3b')]=qs[_0x64cc('0x3c')](_0x2d8cb9[_0x64cc('0x33')]['sort']);_0x44bcf2[_0x64cc('0x3d')]=qs[_0x64cc('0x35')](_[_0x64cc('0x3e')](_0x2d8cb9[_0x64cc('0x33')],_0x334c66['filters']));if(_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x3f')]){_0x44bcf2['where']=_[_0x64cc('0x40')](_0x44bcf2[_0x64cc('0x3d')],{'$or':_[_0x64cc('0x2c')](_0x214361,function(_0x49cd21){if(_0x49cd21[_0x64cc('0x30')][_0x64cc('0x31')]!==_0x64cc('0x41')){var _0x21803b={};_0x21803b[_0x49cd21[_0x64cc('0x7a')]]={'$like':'%'+_0x2d8cb9['query'][_0x64cc('0x3f')]+'%'};return _0x21803b;}})});}var _0x416b74=[];if(_0x269d01){var _0x32a9b5=_[_0x64cc('0x4c')](_0x1314fc,['name',_0x269d01[_0x64cc('0x2a')]]);if(_0x32a9b5[_0x64cc('0x7a')]){var _0x3e183e={};if(_0x391be2[_0x64cc('0x78')]===_0x64cc('0x7b')){_0x3e183e[_0x32a9b5['foreignKey']]=_['map'](_0x269d01[_0x64cc('0x7c')],'id');}else{_0x3e183e[_0x32a9b5['foreignKey']]=_0x269d01[_0x64cc('0x7c')];}_0x416b74[_0x64cc('0x5c')](_0x3e183e);}else{_0x44bcf2[_0x64cc('0x3d')]['id']=_0x269d01[_0x64cc('0x7c')];}}else{for(var _0x30511f=0x0;_0x30511f<_0x1bd1c7['length'];_0x30511f++){var _0x32a9b5=_[_0x64cc('0x4c')](_0x1314fc,['name',_0x1bd1c7[_0x30511f][_0x64cc('0x2a')]]);if(_0x32a9b5[_0x64cc('0x7a')]){var _0x3e183e={};_0x3e183e[_0x32a9b5['foreignKey']]=_0x1bd1c7[_0x30511f][_0x64cc('0x7c')];_0x416b74[_0x64cc('0x5c')](_0x3e183e);}else{if(!_0x44bcf2[_0x64cc('0x3d')]['id'])_0x44bcf2[_0x64cc('0x3d')]['id']=[];_0x1bd1c7[_0x30511f][_0x64cc('0x7c')][_0x64cc('0x64')](function(_0x4df78a){_0x44bcf2[_0x64cc('0x3d')]['id'][_0x64cc('0x5c')](_0x4df78a);});}}}if(!_[_0x64cc('0x60')](_0x416b74)){_0x44bcf2[_0x64cc('0x3d')]=_['merge'](_0x44bcf2[_0x64cc('0x3d')],{'$and':{'$or':_0x416b74}});}_0x44bcf2=_['merge']({},_0x44bcf2,_0x2d8cb9[_0x64cc('0x48')]);if(_0x269d01&&!_0x269d01['autoAssociation']&&_0x391be2[_0x64cc('0x78')]===_0x64cc('0x7b')){if(_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x46')]){_0x44bcf2['include']=[{'all':!![]}];}return db[_0x391be2[_0x64cc('0x78')]]['findAll'](_0x44bcf2)[_0x64cc('0x26')](function(_0x20fa9a){var _0x241e0d=[];_0x20fa9a[_0x64cc('0x64')](function(_0x22d0b2){var _0x129af2;switch(_0x22d0b2[_0x64cc('0x7d')]){case'default':_0x129af2=_[_0x64cc('0x4c')](_0x269d01[_0x64cc('0x7c')],function(_0x38692f){return _0x38692f['id']===_0x22d0b2[_0x64cc('0x7e')]&&_0x38692f[_0x64cc('0x30')]===_0x64cc('0x7f');});break;case _0x64cc('0x80'):_0x129af2=_[_0x64cc('0x4c')](_0x269d01[_0x64cc('0x7c')],function(_0x3585ad){return _0x3585ad['id']===_0x22d0b2[_0x64cc('0x7e')]&&_0x3585ad[_0x64cc('0x30')]===_0x64cc('0x81');});break;}if(_0x129af2)_0x241e0d['push'](_0x22d0b2);});_0x19c462[_0x64cc('0x42')]=_0x241e0d[_0x64cc('0x39')];_0x19c462[_0x64cc('0x82')]=_0x241e0d;return _0x19c462;});}else{return db[_0x391be2[_0x64cc('0x78')]][_0x64cc('0x42')]({'where':_0x44bcf2[_0x64cc('0x3d')]})['then'](function(_0x5526a0){_0x19c462[_0x64cc('0x42')]=_0x5526a0;if(_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x46')]){if(_0x391be2['childModel']===_0x64cc('0x83')){_0x44bcf2[_0x64cc('0x47')]=[{'model':db['Tag'],'as':_0x64cc('0x84'),'attributes':['id',_0x64cc('0x2a'),_0x64cc('0x85')],'required':_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x86')]?!![]:![]},{'model':db[_0x64cc('0x87')],'as':_0x64cc('0x88'),'attributes':['id',_0x64cc('0x2a'),_0x64cc('0x85')],'through':_0x2d8cb9['query']['tag']?{'attributes':[],'where':{'TagId':_0x2d8cb9['query']['tag']||undefined}}:{},'required':_0x2d8cb9[_0x64cc('0x33')][_0x64cc('0x86')]?!![]:![]}];}else{_0x44bcf2[_0x64cc('0x47')]=[{'all':!![]}];}}return db[_0x391be2[_0x64cc('0x78')]][_0x64cc('0x5e')](_0x44bcf2);})[_0x64cc('0x26')](function(_0xe9cc70){_0x19c462['rows']=_0xe9cc70;return _0x19c462;});}}else{return _0x19c462;}})[_0x64cc('0x26')](respondWithFilteredResult(_0xb42859,_0x44bcf2))['catch'](handleError(_0xb42859,null));};function getAllResources(_0x200267,_0xcb78db){return new BPromise(function(_0x46d9ce,_0x111a63){if(_0xcb78db){var _0x188d48=_0xcb78db[_0x64cc('0x3f')]?{[_0xcb78db[_0x64cc('0x3f')][_0x64cc('0x7a')]]:_0xcb78db['filter'][_0x64cc('0x89')]}:undefined;return db[_0x200267][_0x64cc('0x5e')]({'where':_0x188d48,'raw':!![]})['then'](function(_0x3c1c31){_0xcb78db['associatedResources']=_[_0x64cc('0x2c')](_0x3c1c31,'id');_0x46d9ce(_0xcb78db);})[_0x64cc('0x43')](function(_0x518a79){_0x111a63(_0x518a79);});}else{_0x46d9ce(null);}});}function getAllFilteredResources(_0x3e3fbf,_0x2fdbce){return new BPromise(function(_0x570260,_0x130ab3){var _0x36a970=_0x3e3fbf[_0x64cc('0x3f')]?{[_0x3e3fbf[_0x64cc('0x3f')]['field']]:_0x3e3fbf[_0x64cc('0x3f')][_0x64cc('0x89')]}:undefined;return db[_0x3e3fbf[_0x64cc('0x32')]][_0x64cc('0x5e')]({'where':_0x36a970,'raw':!![]})[_0x64cc('0x26')](function(_0x8f60df){_0x2fdbce[_0x64cc('0x7c')]=_[_0x64cc('0x2c')](_0x8f60df,function(_0x110373){return _0x110373['name'];});_0x570260(_0x2fdbce);})['catch'](function(_0x2375c8){_0x130ab3(_0x2375c8);});});}function getAllowedResources(_0x251221,_0x41eae9,_0x2c22c5){return new BPromise(function(_0x581b36,_0x4a38fc){if(_0x41eae9){return db[_0x64cc('0x57')][_0x64cc('0x5e')]({'where':{'sectionId':_0x41eae9['id']},'raw':!![]})['then'](function(_0x4f9804){if(_0x251221[_0x64cc('0x7a')]&&_0x251221[_0x64cc('0x7a')]!=='id'){_0x41eae9[_0x64cc('0x7c')]=_[_0x64cc('0x2c')](_0x4f9804,function(_0x23e136){return _0x23e136[_0x251221[_0x64cc('0x7a')]];});}else{if(_0x2c22c5==='AnalyticExtractedReport'){_0x41eae9[_0x64cc('0x7c')]=_[_0x64cc('0x2c')](_0x4f9804,function(_0x3abbda){return{'id':_0x3abbda['resourceId'],'type':_0x3abbda[_0x64cc('0x30')]};});}else{_0x41eae9[_0x64cc('0x7c')]=_[_0x64cc('0x2c')](_0x4f9804,function(_0x50dfe2){return _0x50dfe2[_0x64cc('0x65')];});}}_0x581b36(_0x41eae9);})['catch'](function(_0x3544af){_0x4a38fc(_0x3544af);});}else{_0x581b36(null);}});}function getQueryModels(_0x5f0316,_0x5679b5){var _0x4d2023=_0x5f0316[_0x64cc('0x8a')]();var _0x52e078={'childModel':undefined,'parentSections':[]};switch(_0x4d2023){case'squareprojects':_0x52e078[_0x64cc('0x78')]=_0x64cc('0x8b');break;case _0x64cc('0x8c'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0x8d');break;case _0x64cc('0x8e'):_0x52e078['childModel']=_0x64cc('0x8f');_0x52e078[_0x64cc('0x73')]=[{'name':_0x64cc('0x90'),'field':_0x64cc('0x2a'),'foreignKey':_0x64cc('0x91')}];break;case _0x64cc('0x92'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0x93');break;case _0x64cc('0x94'):_0x52e078['childModel']=_0x64cc('0x83');_0x52e078[_0x64cc('0x73')]=[{'name':'Lists','field':'id','foreignKey':_0x64cc('0x95')}];break;case _0x64cc('0x96'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0x97');break;case _0x64cc('0x98'):_0x52e078['childModel']='CmCompany';break;case _0x64cc('0x99'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0x9a');break;case _0x64cc('0x9b'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0x9c');break;case _0x64cc('0x9d'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0x9e');break;case _0x64cc('0x9f'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xa0');break;case _0x64cc('0xa1'):_0x52e078[_0x64cc('0x78')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0x64cc('0xa2'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xa3');break;case _0x64cc('0xa4'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xa5');break;case _0x64cc('0xa6'):_0x52e078['childModel']=_0x64cc('0xa7');break;case _0x64cc('0xa8'):_0x52e078['childModel']=_0x64cc('0xa9');_0x52e078[_0x64cc('0x73')]=[{'name':_0x64cc('0xaa'),'field':'name','foreignKey':_0x64cc('0xab'),'model':_0x64cc('0xac'),'filter':{'field':_0x64cc('0xad'),'value':[_0x64cc('0xae')]}},{'name':'Telephones','field':'name','foreignKey':_0x64cc('0xab'),'model':'User','filter':{'field':'role','value':['telephone']}},{'name':_0x64cc('0xaf'),'field':'name','foreignKey':_0x64cc('0xb0'),'model':_0x64cc('0xb1'),'filter':{'field':_0x64cc('0x30'),'value':[_0x64cc('0xb2')]}},{'name':_0x64cc('0xb3'),'field':_0x64cc('0x2a'),'foreignKey':_0x64cc('0xb0'),'model':_0x64cc('0xb1'),'filter':{'field':_0x64cc('0x30'),'value':[_0x64cc('0xb4')]}}];break;case'musiconholds':_0x52e078['childModel']=_0x64cc('0xb5');break;case _0x64cc('0xb6'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xb7');break;case _0x64cc('0xb8'):_0x52e078['childModel']=_0x64cc('0xb9');break;case _0x64cc('0xba'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xbb');break;case _0x64cc('0xbc'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xbd');break;case _0x64cc('0xbe'):_0x52e078['childModel']='MailAccount';break;case _0x64cc('0xbf'):_0x52e078[_0x64cc('0x78')]='MailSubstatus';break;case _0x64cc('0xc0'):_0x52e078['childModel']=_0x64cc('0xc1');break;case _0x64cc('0xc2'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xc3');break;case _0x64cc('0xc4'):_0x52e078['childModel']=_0x64cc('0xc5');break;case _0x64cc('0xc6'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xc7');break;case _0x64cc('0xc8'):_0x52e078['childModel']=_0x64cc('0xc9');break;case _0x64cc('0xca'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xcb');break;case'teams':_0x52e078[_0x64cc('0x78')]=_0x64cc('0xcc');break;case'voicequeues':case _0x64cc('0xcd'):_0x52e078[_0x64cc('0x78')]='VoiceQueue';if(_0x5679b5){_0x52e078[_0x64cc('0x73')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x64cc('0xce'):case'agents':case _0x64cc('0xcf'):_0x52e078['childModel']='User';if(_0x5679b5){_0x52e078[_0x64cc('0x73')]=[{'name':_0x64cc('0xd0'),'filter':{'field':'role','value':['admin',_0x64cc('0xd1')]},'ignore':!![]},{'name':_0x64cc('0xaa')},{'name':_0x64cc('0xd2')}];}break;case'zendeskaccounts':_0x52e078['childModel']='ZendeskAccount';break;case _0x64cc('0xd3'):_0x52e078['childModel']=_0x64cc('0xd4');break;case'freshdeskaccounts':_0x52e078[_0x64cc('0x78')]=_0x64cc('0xd5');break;case _0x64cc('0xd6'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xd7');break;case _0x64cc('0xd8'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xd9');break;case _0x64cc('0xda'):_0x52e078[_0x64cc('0x78')]='ZohoAccount';break;case'vtigeraccounts':_0x52e078[_0x64cc('0x78')]=_0x64cc('0xac');break;case _0x64cc('0xdb'):_0x52e078[_0x64cc('0x78')]='CannedAnswer';break;case _0x64cc('0xdc'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xdd');break;case'customdashboards':_0x52e078[_0x64cc('0x78')]=_0x64cc('0x63');break;case _0x64cc('0xde'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xdf');break;case'pauses':_0x52e078['childModel']=_0x64cc('0xe0');break;case _0x64cc('0xe1'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xe2');break;case _0x64cc('0xe3'):_0x52e078['childModel']=_0x64cc('0xe4');break;case _0x64cc('0xe5'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0x87');break;case'templates':_0x52e078[_0x64cc('0x78')]='Template';break;case _0x64cc('0xe6'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xe7');break;case _0x64cc('0xe8'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0xe9');break;case _0x64cc('0xea'):_0x52e078['childModel']=_0x64cc('0xeb');break;case'plugins':_0x52e078[_0x64cc('0x78')]=_0x64cc('0x66');break;case _0x64cc('0xec'):_0x52e078[_0x64cc('0x78')]=_0x64cc('0x7b');_0x52e078[_0x64cc('0x73')]=[{'name':_0x64cc('0xed'),'field':'id','foreignKey':'reportId'}];break;case _0x64cc('0xee'):_0x52e078[_0x64cc('0x78')]='AnalyticMetric';break;case _0x64cc('0xca'):_0x52e078['childModel']=_0x64cc('0xcb');break;default:return _0x52e078;}return _0x52e078;} \ No newline at end of file +var _0x7fc0=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','end','error','send','index','UserProfile','rawAttributes','type','key','model','map','name','query','filters','attributes','intersection','nolimit','order','sort','pick','where','filter','merge','options','include','findAll','rows','catch','show','params','keys','fields','includeAll','find','create','body','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','destroy','describe','sectionId','Resources','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','Sequelize','Unknown\x20section','childModel','ValidationError','Invalid\x20section\x20\x27','parentSections','length','all','ignore','union','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','reportId','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','resourceId','odbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','Lists','ListId','lists','companies','CmCompany','globalcustomfields','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','role','agent','Telephones','telephone','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','teams','Team','VoiceQueues','User','Users','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','Pause','sounds','Sound','tags','triggers','Trigger','trunks','Trunk','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x96a37b,_0x3ecb9e){var _0xb2d2f6=function(_0x319640){while(--_0x319640){_0x96a37b['push'](_0x96a37b['shift']());}};_0xb2d2f6(++_0x3ecb9e);}(_0x7fc0,0x1b7));var _0x07fc=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0x7fc0[_0xdeac17];return _0x33aabd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x07fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07fc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07fc('0x2'));var moment=require(_0x07fc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x07fc('0x4'));var util=require(_0x07fc('0x5'));var path=require(_0x07fc('0x6'));var sox=require('sox');var csv=require(_0x07fc('0x7'));var ejs=require(_0x07fc('0x8'));var fs=require('fs');var _=require(_0x07fc('0x9'));var squel=require('squel');var crypto=require(_0x07fc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x07fc('0xb'));var toCsv=require(_0x07fc('0x7'));var querystring=require(_0x07fc('0xc'));var Papa=require(_0x07fc('0xd'));var Redis=require(_0x07fc('0xe'));var authService=require(_0x07fc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x07fc('0x10'));var hardwareService=require(_0x07fc('0x11'));var logger=require('../../config/logger')(_0x07fc('0x12'));var utils=require(_0x07fc('0x13'));var config=require(_0x07fc('0x14'));var db=require(_0x07fc('0x15'))['db'];config[_0x07fc('0x16')]=_[_0x07fc('0x17')](config[_0x07fc('0x16')],{'host':_0x07fc('0x18'),'port':0x18eb});var socket=require(_0x07fc('0x19'))(new Redis(config[_0x07fc('0x16')]));require(_0x07fc('0x1a'))[_0x07fc('0x1b')](socket);function respondWithStatusCode(_0x9a1436,_0x2de9e3){_0x2de9e3=_0x2de9e3||0xcc;return function(_0x6f43e4){if(_0x6f43e4){return _0x9a1436[_0x07fc('0x1c')](_0x2de9e3);}return _0x9a1436[_0x07fc('0x1d')](_0x2de9e3)['end']();};}function respondWithResult(_0x3c254e,_0x1a9cb8){_0x1a9cb8=_0x1a9cb8||0xc8;return function(_0x502f90){if(_0x502f90){return _0x3c254e[_0x07fc('0x1d')](_0x1a9cb8)[_0x07fc('0x1e')](_0x502f90);}};}function respondWithFilteredResult(_0x49f894,_0x2b85b3){return function(_0x3d588d){if(_0x3d588d){var _0xa11506=_0x3d588d[_0x07fc('0x1f')],_0x3b4b6f=_0x2b85b3[_0x07fc('0x20')],_0x33870c=_0x2b85b3[_0x07fc('0x20')]+_0x2b85b3[_0x07fc('0x21')],_0x13051e;if(_0x33870c>=_0xa11506){_0x33870c=_0xa11506;_0x13051e=0xc8;}else{_0x13051e=0xce;}_0x49f894[_0x07fc('0x1d')](_0x13051e);return _0x49f894[_0x07fc('0x22')](_0x07fc('0x23'),_0x3b4b6f+'-'+_0x33870c+'/'+_0xa11506)[_0x07fc('0x1e')](_0x3d588d);}return null;};}function patchUpdates(_0x453395){return function(_0x5dc6f1){try{jsonpatch[_0x07fc('0x24')](_0x5dc6f1,_0x453395,!![]);}catch(_0x2133fc){return BPromise['reject'](_0x2133fc);}return _0x5dc6f1[_0x07fc('0x25')]();};}function saveUpdates(_0x4006e0,_0x3d1bd4){return function(_0x506fef){if(_0x506fef){return _0x506fef['update'](_0x4006e0)[_0x07fc('0x26')](function(_0x67001e){return _0x67001e;});}return null;};}function removeEntity(_0x36a506,_0x24599f){return function(_0x1e3ab8){if(_0x1e3ab8){return _0x1e3ab8['destroy']()[_0x07fc('0x26')](function(){_0x36a506[_0x07fc('0x1d')](0xcc)[_0x07fc('0x27')]();});}};}function handleEntityNotFound(_0x17e16a,_0x227165){return function(_0x31c7af){if(!_0x31c7af){_0x17e16a[_0x07fc('0x1c')](0x194);}return _0x31c7af;};}function handleError(_0x284773,_0x4434e1){_0x4434e1=_0x4434e1||0x1f4;return function(_0x5d181e){logger[_0x07fc('0x28')](_0x5d181e['stack']);if(_0x5d181e['name']){delete _0x5d181e['name'];}_0x284773[_0x07fc('0x1d')](_0x4434e1)[_0x07fc('0x29')](_0x5d181e);};}exports[_0x07fc('0x2a')]=function(_0x492cc5,_0x4b6a6c){var _0x5277ac={},_0x65e44f={},_0x198c77={'count':0x0,'rows':[]};var _0x12a8d5=_['map'](db[_0x07fc('0x2b')][_0x07fc('0x2c')],function(_0x2e9862){return{'name':_0x2e9862['fieldName'],'type':_0x2e9862[_0x07fc('0x2d')][_0x07fc('0x2e')]};});_0x65e44f[_0x07fc('0x2f')]=_[_0x07fc('0x30')](_0x12a8d5,_0x07fc('0x31'));_0x65e44f[_0x07fc('0x32')]=_['keys'](_0x492cc5[_0x07fc('0x32')]);_0x65e44f[_0x07fc('0x33')]=_['intersection'](_0x65e44f[_0x07fc('0x2f')],_0x65e44f['query']);_0x5277ac[_0x07fc('0x34')]=_[_0x07fc('0x35')](_0x65e44f[_0x07fc('0x2f')],qs['fields'](_0x492cc5[_0x07fc('0x32')]['fields']));_0x5277ac[_0x07fc('0x34')]=_0x5277ac[_0x07fc('0x34')]['length']?_0x5277ac['attributes']:_0x65e44f[_0x07fc('0x2f')];if(!_0x492cc5[_0x07fc('0x32')]['hasOwnProperty'](_0x07fc('0x36'))){_0x5277ac[_0x07fc('0x21')]=qs['limit'](_0x492cc5[_0x07fc('0x32')][_0x07fc('0x21')]);_0x5277ac['offset']=qs[_0x07fc('0x20')](_0x492cc5[_0x07fc('0x32')][_0x07fc('0x20')]);}_0x5277ac[_0x07fc('0x37')]=qs[_0x07fc('0x38')](_0x492cc5[_0x07fc('0x32')][_0x07fc('0x38')]);_0x5277ac['where']=qs[_0x07fc('0x33')](_[_0x07fc('0x39')](_0x492cc5['query'],_0x65e44f[_0x07fc('0x33')]),_0x12a8d5);if(_0x492cc5['query']['filter']){_0x5277ac[_0x07fc('0x3a')]=_['merge'](_0x5277ac[_0x07fc('0x3a')],{'$or':_[_0x07fc('0x30')](_0x12a8d5,function(_0x1d798a){if(_0x1d798a[_0x07fc('0x2d')]!=='VIRTUAL'){var _0x3f94fd={};_0x3f94fd[_0x1d798a['name']]={'$like':'%'+_0x492cc5[_0x07fc('0x32')][_0x07fc('0x3b')]+'%'};return _0x3f94fd;}})});}_0x5277ac=_[_0x07fc('0x3c')]({},_0x5277ac,_0x492cc5[_0x07fc('0x3d')]);var _0x1beb7a={'where':_0x5277ac[_0x07fc('0x3a')]};return db['UserProfile'][_0x07fc('0x1f')](_0x1beb7a)['then'](function(_0x4460d1){_0x198c77[_0x07fc('0x1f')]=_0x4460d1;if(_0x492cc5[_0x07fc('0x32')]['includeAll']){_0x5277ac[_0x07fc('0x3e')]=[{'all':!![]}];}return db[_0x07fc('0x2b')][_0x07fc('0x3f')](_0x5277ac);})[_0x07fc('0x26')](function(_0x4078a0){_0x198c77[_0x07fc('0x40')]=_0x4078a0;return _0x198c77;})[_0x07fc('0x26')](respondWithFilteredResult(_0x4b6a6c,_0x5277ac))[_0x07fc('0x41')](handleError(_0x4b6a6c,null));};exports[_0x07fc('0x42')]=function(_0x48badf,_0x2d0ec9){var _0x4f9ca9={'raw':![],'where':{'id':_0x48badf[_0x07fc('0x43')]['id']}},_0x42addd={};_0x42addd[_0x07fc('0x2f')]=_[_0x07fc('0x44')](db['UserProfile'][_0x07fc('0x2c')]);_0x42addd[_0x07fc('0x32')]=_[_0x07fc('0x44')](_0x48badf[_0x07fc('0x32')]);_0x42addd['filters']=_[_0x07fc('0x35')](_0x42addd[_0x07fc('0x2f')],_0x42addd[_0x07fc('0x32')]);_0x4f9ca9[_0x07fc('0x34')]=_['intersection'](_0x42addd[_0x07fc('0x2f')],qs[_0x07fc('0x45')](_0x48badf[_0x07fc('0x32')][_0x07fc('0x45')]));_0x4f9ca9['attributes']=_0x4f9ca9[_0x07fc('0x34')]['length']?_0x4f9ca9[_0x07fc('0x34')]:_0x42addd[_0x07fc('0x2f')];if(_0x48badf['query'][_0x07fc('0x46')]){_0x4f9ca9[_0x07fc('0x3e')]=[{'all':!![]}];}_0x4f9ca9=_['merge']({},_0x4f9ca9,_0x48badf[_0x07fc('0x3d')]);return db['UserProfile'][_0x07fc('0x47')](_0x4f9ca9)[_0x07fc('0x26')](handleEntityNotFound(_0x2d0ec9,null))[_0x07fc('0x26')](respondWithResult(_0x2d0ec9,null))[_0x07fc('0x41')](handleError(_0x2d0ec9,null));};exports[_0x07fc('0x48')]=function(_0x37c498,_0x4ac470){return db[_0x07fc('0x2b')][_0x07fc('0x48')](_0x37c498[_0x07fc('0x49')],{})[_0x07fc('0x26')](respondWithResult(_0x4ac470,0xc9))[_0x07fc('0x41')](handleError(_0x4ac470,null));};exports['clone']=function(_0x3f4995,_0x528344){var _0xad48a1={'where':{'id':_0x3f4995[_0x07fc('0x43')]['id']}},_0xf8c0e9={};_0xf8c0e9[_0x07fc('0x2f')]=_[_0x07fc('0x44')](db[_0x07fc('0x2b')][_0x07fc('0x2c')]);_0xad48a1[_0x07fc('0x34')]=_[_0x07fc('0x35')](_0xf8c0e9['model'],qs['fields'](_0x3f4995[_0x07fc('0x32')][_0x07fc('0x45')]));_0xad48a1['attributes']=_0xad48a1['attributes']['length']?_0xad48a1[_0x07fc('0x34')]:_0xf8c0e9['model'];if(_0x3f4995['query'][_0x07fc('0x46')]){_0xad48a1['include']=[{'all':!![]}];}_0xad48a1=_['merge']({},_0xad48a1,_0x3f4995[_0x07fc('0x3d')]);return db[_0x07fc('0x2b')][_0x07fc('0x47')](_0xad48a1)[_0x07fc('0x26')](handleEntityNotFound(_0x528344,null))[_0x07fc('0x26')](function(_0x4ad2a8){if(_0x4ad2a8){var _0x544ad7=_0x4ad2a8['get']({'plain':!![]});_0x544ad7=qs['omit'](_0x544ad7,['id',_0x07fc('0x4a'),_0x07fc('0x4b'),_0x07fc('0x4c')]);_0x3f4995[_0x07fc('0x49')]=_[_0x07fc('0x4d')](_0x3f4995[_0x07fc('0x49')],['id',_0x07fc('0x4a'),_0x07fc('0x4b')]);return db[_0x07fc('0x4e')][_0x07fc('0x4f')](function(_0x27a3cb){return db['UserProfile'][_0x07fc('0x48')](_[_0x07fc('0x3c')](_0x544ad7,_0x3f4995[_0x07fc('0x49')]),{'include':_0x3f4995[_0x07fc('0x32')][_0x07fc('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x27a3cb})['then'](function(_0x47187b){var _0x3c7e64=_0x47187b[_0x07fc('0x50')]({'plain':!![]});return db[_0x07fc('0x51')]['findAll']({'where':{'userProfileId':_0x3f4995['params']['id']},'raw':!![]})[_0x07fc('0x26')](function(_0x5610d8){if(_0x5610d8){return BPromise[_0x07fc('0x52')](_0x5610d8,function(_0x544ddc){return new BPromise(function(_0x1106d0,_0x571b32){if(_0x544ddc[_0x07fc('0x53')]===null||_0x544ddc[_0x07fc('0x53')]===0x1)_0x1106d0(null);return db[_0x07fc('0x54')]['findAll']({'where':{'sectionId':_0x544ddc['id']},'raw':!![]})['then'](function(_0x12680e){var _0x2ca473=_[_0x07fc('0x30')](_0x12680e,function(_0x475257){return qs[_0x07fc('0x4d')](_0x475257,['id',_0x07fc('0x4a'),'updatedAt','sectionId']);});_0x1106d0(_0x2ca473);})['catch'](function(_0x1059dc){_0x571b32(_0x1059dc);});})[_0x07fc('0x26')](function(_0x2c5919){var _0x5464c0=qs[_0x07fc('0x4d')](_0x544ddc,['id',_0x07fc('0x4a'),_0x07fc('0x4b')]);_0x5464c0[_0x07fc('0x55')]=_0x3c7e64['id'];if(_0x2c5919)_0x5464c0['Resources']=_0x2c5919;return _0x5464c0;})[_0x07fc('0x26')](function(_0x4c67ee){return db[_0x07fc('0x51')][_0x07fc('0x48')](_0x4c67ee,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x27a3cb});});})['then'](function(){return _0x3c7e64;});}});});});}})[_0x07fc('0x26')](respondWithResult(_0x528344,0xc9))[_0x07fc('0x41')](handleError(_0x528344,null));};exports['update']=function(_0x1d90c7,_0x2a9d50){if(_0x1d90c7['body']['id']){delete _0x1d90c7[_0x07fc('0x49')]['id'];}return db[_0x07fc('0x2b')][_0x07fc('0x47')]({'where':{'id':_0x1d90c7[_0x07fc('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a9d50,null))[_0x07fc('0x26')](saveUpdates(_0x1d90c7[_0x07fc('0x49')],null))[_0x07fc('0x26')](respondWithResult(_0x2a9d50,null))['catch'](handleError(_0x2a9d50,null));};exports[_0x07fc('0x56')]=function(_0x579b34,_0x4087a0){return db[_0x07fc('0x2b')][_0x07fc('0x47')]({'where':{'id':_0x579b34[_0x07fc('0x43')]['id']}})[_0x07fc('0x26')](handleEntityNotFound(_0x4087a0,null))[_0x07fc('0x26')](removeEntity(_0x4087a0,null))[_0x07fc('0x41')](handleError(_0x4087a0,null));};exports[_0x07fc('0x57')]=function(_0x21e370,_0x3db253){return db[_0x07fc('0x2b')][_0x07fc('0x57')]()['then'](respondWithResult(_0x3db253,null))[_0x07fc('0x41')](handleError(_0x3db253,null));};exports['addSections']=function(_0x5aedf0,_0xe6d39c){var _0x283c78=_0x5aedf0[_0x07fc('0x49')];return db['UserProfile'][_0x07fc('0x47')]({'where':{'id':_0x5aedf0[_0x07fc('0x43')]['id']}})[_0x07fc('0x26')](handleEntityNotFound(_0xe6d39c,null))[_0x07fc('0x26')](function(_0x49e014){if(_0x49e014){return db[_0x07fc('0x4e')]['transaction'](function(_0x2ad17e){return db[_0x07fc('0x51')][_0x07fc('0x56')]({'where':{'userProfileId':_0x5aedf0['params']['id'],'sectionId':_['map'](_0x283c78,function(_0x35b099){return _0x35b099[_0x07fc('0x58')];})},'transaction':_0x2ad17e})[_0x07fc('0x26')](function(){var _0x5a10bc=_[_0x07fc('0x30')](_0x283c78,function(_0x5256a5){_0x5256a5[_0x07fc('0x55')]=_0x5aedf0['params']['id'];return _0x5256a5;});var _0x5c2a64=[];return BPromise['each'](_0x5a10bc,function(_0x289bd7){return db[_0x07fc('0x51')]['create'](_0x289bd7,{'include':[{'model':db['UserProfileResource'],'as':_0x07fc('0x59')}],'raw':!![],'transaction':_0x2ad17e})['then'](function(_0x3d17f2){_0x5c2a64[_0x07fc('0x5a')](_0x3d17f2['get']({'plain':!![]}));});})[_0x07fc('0x26')](function(){return _0x5c2a64;});});});}})['then'](function(_0x58a464){return _0x58a464;})[_0x07fc('0x26')](respondWithResult(_0xe6d39c,null))[_0x07fc('0x41')](handleError(_0xe6d39c,null));};exports[_0x07fc('0x5b')]=function(_0x1e8731,_0x1e8033){var _0x143e08;return db[_0x07fc('0x2b')][_0x07fc('0x47')]({'where':{'id':_0x1e8731['params']['id']},'attributes':['id',_0x07fc('0x31')]})[_0x07fc('0x26')](handleEntityNotFound(_0x1e8033,null))[_0x07fc('0x26')](function(_0x166aca){if(_0x166aca){_0x143e08=_0x166aca;return db[_0x07fc('0x51')][_0x07fc('0x56')]({'where':{'userProfileId':_0x1e8731[_0x07fc('0x43')]['id'],'sectionId':_0x1e8731[_0x07fc('0x32')][_0x07fc('0x5c')]}});}})['then'](function(){return _0x143e08;})['then'](respondWithStatusCode(_0x1e8033,null))[_0x07fc('0x41')](handleError(_0x1e8033,null));};exports[_0x07fc('0x5d')]=function(_0x23eb42,_0x50c7be){var _0x422a6c=[];var _0x20e5d3=[];return db['UserProfileSection'][_0x07fc('0x3f')]({'where':{'userProfileId':_0x23eb42[_0x07fc('0x43')]['id']},'raw':!![]})[_0x07fc('0x26')](function(_0xfef95d){_0x422a6c=_['filter'](_0xfef95d,function(_0x1fae8c){return _0x1fae8c[_0x07fc('0x5e')]===0x1||_['includes']([0x3eb,0x709],_0x1fae8c['sectionId']);});if(!_[_0x07fc('0x5f')](_0x422a6c)){return _[_0x07fc('0x30')](_0x422a6c,function(_0x505bda){return _0x505bda[_0x07fc('0x58')];});}else{return;}})[_0x07fc('0x26')](function(_0x586dc0){if(_0x586dc0)_0x20e5d3=_0x586dc0;if(_[_0x07fc('0x60')](_0x20e5d3,0x64)){var _0x563425=_[_0x07fc('0x47')](_0x422a6c,{'sectionId':0x64});return hasDefaultDashboard(_0x563425)[_0x07fc('0x26')](function(_0x3f21a1){return _[_0x07fc('0x30')](_0x422a6c,function(_0x10b10e){if(_0x10b10e[_0x07fc('0x58')]===0x64){_0x10b10e[_0x07fc('0x61')]=_0x3f21a1;}return _0x10b10e;});});}else{return;}})[_0x07fc('0x26')](function(_0xd096fc){if(_0xd096fc)_0x422a6c=_0xd096fc;if(_[_0x07fc('0x60')](_0x20e5d3,0x3eb)){var _0x47b311=_[_0x07fc('0x47')](_0x422a6c,{'sectionId':0x3eb});return getCustomDashboards(_0x47b311)[_0x07fc('0x26')](function(_0x200b4d){return _[_0x07fc('0x30')](_0x422a6c,function(_0x62e403){if(_0x47b311[_0x07fc('0x5e')]){if(_0x62e403[_0x07fc('0x58')]===0x3eb){_0x62e403[_0x07fc('0x61')]=_0x200b4d;}}else{if(_0x62e403[_0x07fc('0x58')]===0x64){_0x62e403[_0x07fc('0x61')]=_0x200b4d;}}return _0x62e403;});});}else{return;}})['then'](function(_0x527434){if(_0x527434)_0x422a6c=_0x527434;if(_[_0x07fc('0x60')](_0x20e5d3,0x709)){var _0x51683e=_[_0x07fc('0x47')](_0x422a6c,{'sectionId':0x709});return getPlugins(_0x51683e)[_0x07fc('0x26')](function(_0x35dbe4){if(_0x51683e[_0x07fc('0x5e')]){return _[_0x07fc('0x30')](_0x422a6c,function(_0x3bdfb7){if(_0x3bdfb7[_0x07fc('0x58')]===0x709){_0x3bdfb7[_0x07fc('0x61')]=_0x35dbe4;}return _0x3bdfb7;});}else{var _0xebe310={'sectionId':0x76c,'enabled':0x1,'subsections':_0x35dbe4};var _0x5b4196=_[_0x07fc('0x30')](_0x422a6c);_0x5b4196[_0x07fc('0x5a')](_0xebe310);return _0x5b4196;}});}else{return;}})[_0x07fc('0x26')](function(_0x32bc09){if(_0x32bc09)_0x422a6c=_0x32bc09;return _['filter'](_0x422a6c,[_0x07fc('0x5e'),0x1]);})['then'](respondWithResult(_0x50c7be,null))[_0x07fc('0x41')](handleError(_0x50c7be,null));};function hasDefaultDashboard(_0x533a6c){var _0x3e8ff0=[0x65];return new BPromise(function(_0x5dc286,_0x3a4b56){try{if(_0x533a6c['autoAssociation']){_0x5dc286(_0x3e8ff0);}else{return db[_0x07fc('0x54')][_0x07fc('0x62')]({'where':{'sectionId':_0x533a6c['id']},'raw':!![]})[_0x07fc('0x26')](function(_0x2658d0){_0x2658d0?_0x5dc286(_0x3e8ff0):_0x5dc286();});}}catch(_0x40adae){_0x3a4b56(_0x40adae);}});}function getCustomDashboards(_0x49eda9){var _0x2d1921=[];return new BPromise(function(_0x8a9bf,_0x54f7f6){try{if(_0x49eda9[_0x07fc('0x53')]){return db[_0x07fc('0x63')]['findAll']({'raw':!![]})[_0x07fc('0x26')](function(_0x648060){_0x648060[_0x07fc('0x64')](function(_0x525045){_0x2d1921['push'](_0x525045['id']+0x1869f);});_0x8a9bf(_0x2d1921);});}else{return db[_0x07fc('0x54')][_0x07fc('0x3f')]({'where':{'sectionId':_0x49eda9['id']},'raw':!![]})[_0x07fc('0x26')](function(_0x234dec){_0x234dec[_0x07fc('0x64')](function(_0x3e5868){_0x2d1921['push'](_0x3e5868['resourceId']+0x1869f);});_0x8a9bf(_0x2d1921);});}}catch(_0x4715bf){_0x54f7f6(_0x4715bf);}});}function getPlugins(_0x4f8fec){var _0x40b465=[];return new BPromise(function(_0x448a41,_0x39346c){try{if(_0x4f8fec['autoAssociation']){return db[_0x07fc('0x65')][_0x07fc('0x3f')]({'raw':!![]})[_0x07fc('0x26')](function(_0x2bd700){_0x2bd700[_0x07fc('0x64')](function(_0x5246bb){_0x40b465[_0x07fc('0x5a')](_0x5246bb['id']+0x15b38);});_0x448a41(_0x40b465);});}else{return db[_0x07fc('0x54')][_0x07fc('0x3f')]({'where':{'sectionId':_0x4f8fec['id']},'raw':!![]})[_0x07fc('0x26')](function(_0x5307a2){_0x5307a2[_0x07fc('0x64')](function(_0x291f41){_0x40b465[_0x07fc('0x5a')](_0x291f41['resourceId']+0x15b38);});_0x448a41(_0x40b465);});}}catch(_0x498fcb){_0x39346c(_0x498fcb);}});}exports[_0x07fc('0x66')]=function(_0x507857,_0x12c45d){return db[_0x07fc('0x2b')][_0x07fc('0x47')]({'where':{'id':_0x507857[_0x07fc('0x43')]['id']}})[_0x07fc('0x26')](handleEntityNotFound(_0x12c45d,null))[_0x07fc('0x26')](function(_0x389785){if(_0x389785){return db[_0x07fc('0x4e')][_0x07fc('0x4f')](function(_0x2f6461){return db[_0x07fc('0x51')][_0x07fc('0x3f')]({'where':{'userProfileId':_0x507857['params']['id']},'attributes':['id'],'raw':!![]})[_0x07fc('0x26')](function(_0x26a9b3){if(_0x26a9b3){return db[_0x07fc('0x51')][_0x07fc('0x56')]({'where':{'userProfileId':_0x507857[_0x07fc('0x43')]['id'],'id':_[_0x07fc('0x30')](_0x26a9b3,function(_0x359dee){return _0x359dee['id'];})},'transaction':_0x2f6461});}})['then'](function(_0x59ebaf){var _0x531fa8=_[_0x07fc('0x30')](_0x507857[_0x07fc('0x49')],function(_0x11232b){_0x11232b[_0x07fc('0x55')]=_0x507857[_0x07fc('0x43')]['id'];return _0x11232b;});return db[_0x07fc('0x51')][_0x07fc('0x67')](_0x531fa8,{'raw':!![],'transaction':_0x2f6461});})['then'](function(_0x394cda){var _0x505aea=_['filter'](_[_0x07fc('0x30')](_0x394cda,function(_0x59b536){return _0x59b536[_0x07fc('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x505aea){return db[_0x07fc('0x51')][_0x07fc('0x3f')]({'where':{'userProfileId':_0x507857[_0x07fc('0x43')]['id'],'sectionId':_[_0x07fc('0x30')](_0x505aea,function(_0x556695){return _0x556695[_0x07fc('0x58')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x07fc('0x26')](function(_0x10d54b){var _0xb15dd0=_[_0x07fc('0x30')](_0x507857[_0x07fc('0x49')],function(_0x19a482){_0x19a482[_0x07fc('0x55')]=_0x507857[_0x07fc('0x43')]['id'];return _0x19a482;});return db['UserProfileResource']['bulkCreate'](_0xb15dd0,{'raw':!![],'transaction':_0x2f6461});});}})['catch'](handleError(_0x12c45d,null));});}})['then'](function(_0xd8cd88){var _0x27cbcf=_[_0x07fc('0x30')](_0xd8cd88,function(_0x33eb59){return _0x33eb59[_0x07fc('0x50')]({'plain':!![]});});})[_0x07fc('0x26')](respondWithResult(_0x12c45d,null))[_0x07fc('0x41')](handleError(_0x12c45d,null));};exports[_0x07fc('0x68')]=function(_0x116949,_0x269092,_0x8c7031){return db[_0x07fc('0x2b')]['find']({'where':{'id':_0x116949['params']['id']}})[_0x07fc('0x26')](handleEntityNotFound(_0x269092,null))[_0x07fc('0x26')](function(_0xda8d76){if(_0xda8d76){return _0xda8d76[_0x07fc('0x68')](_0x116949[_0x07fc('0x32')][_0x07fc('0x5c')]);}})[_0x07fc('0x26')](respondWithStatusCode(_0x269092,null))[_0x07fc('0x41')](handleError(_0x269092,null));};exports[_0x07fc('0x69')]=function(_0x283528,_0x502e23){var _0x5118b3={'raw':![],'where':{}};var _0x14ab1c={};var _0x3b9c69={'count':0x0,'rows':[]};var _0x2b9efa=_0x283528[_0x07fc('0x32')][_0x07fc('0x6a')];if(typeof _0x2b9efa==='undefined'){throw new db[(_0x07fc('0x6b'))]['ValidationError'](_0x07fc('0x6c'));}var _0x20ca1b=_0x283528[_0x07fc('0x32')]['mergeResources']||![];var _0x2d2476=getQueryModels(_0x2b9efa,_0x20ca1b);if(typeof _0x2d2476[_0x07fc('0x6d')]==='undefined'){throw new db[(_0x07fc('0x6b'))][(_0x07fc('0x6e'))](_0x07fc('0x6f')+_0x2b9efa+'\x27');}var _0x15142f=[];if(!_[_0x07fc('0x5f')](_0x2d2476['parentSections'])){_0x15142f=_0x2d2476[_0x07fc('0x70')];}else{_0x15142f=[{'name':_0x2b9efa}];}return db['UserProfile'][_0x07fc('0x62')]({'where':{'id':_0x283528[_0x07fc('0x43')]['id']}})['then'](handleEntityNotFound(_0x502e23,null))['then'](function(_0xa7a1d6){if(_0xa7a1d6){var _0x4fed62=[];for(var _0x41d776=0x0;_0x41d776<_0x15142f[_0x07fc('0x71')];_0x41d776++){_0x4fed62[_0x07fc('0x5a')](db[_0x07fc('0x51')]['findOne']({'where':{'userProfileId':_0xa7a1d6['id'],'name':_0x15142f[_0x41d776]['name']},'raw':!![]}));}return BPromise[_0x07fc('0x72')](_0x4fed62);}})[_0x07fc('0x26')](function(_0x1aba14){var _0x3df80a=_[_0x07fc('0x3b')](_0x1aba14,function(_0x7ae692){return _0x7ae692?_0x7ae692:undefined;});var _0x958b36=_[_0x07fc('0x3b')](_0x15142f,[_0x07fc('0x73'),!![]]);var _0x565cd1=_[_0x07fc('0x5f')](_0x3df80a)&&_[_0x07fc('0x5f')](_0x958b36)?null:_[_0x07fc('0x74')](_0x958b36,_0x3df80a);if(_0x565cd1){var _0x17772f=[];for(var _0x585328=0x0;_0x585328<_0x565cd1[_0x07fc('0x71')];_0x585328++){var _0x218107=_[_0x07fc('0x47')](_0x15142f,function(_0x1cd31f){return _0x565cd1[_0x585328]?_0x1cd31f[_0x07fc('0x31')]===_0x565cd1[_0x585328][_0x07fc('0x31')]:null;});if(_0x218107){if(_0x565cd1[_0x585328][_0x07fc('0x73')]){_0x17772f['push'](getAllResources(_0x2d2476[_0x07fc('0x6d')],_0x565cd1[_0x585328]));}else{if(!_0x565cd1[_0x585328][_0x07fc('0x53')]){_0x17772f['push'](getAllowedResources(_0x218107,_0x565cd1[_0x585328],_0x2d2476[_0x07fc('0x6d')]));}else{if(_0x218107['model']){_0x17772f['push'](getAllFilteredResources(_0x218107,_0x565cd1[_0x585328]));}}}}}return BPromise['all'](_0x17772f);}else{return null;}})['then'](function(_0x54bb0a){var _0x5a0c4c=_0x54bb0a;var _0x1d5232=null;if(_0x5a0c4c){_0x1d5232=_0x5a0c4c['length']===0x1?_0x5a0c4c[0x0]:null;}if(_0x1d5232||_0x5a0c4c){var _0x32bc40=db[_0x2d2476['childModel']][_0x07fc('0x2c')];_0x14ab1c[_0x07fc('0x2f')]=_[_0x07fc('0x44')](_0x32bc40);_0x14ab1c[_0x07fc('0x32')]=_[_0x07fc('0x44')](_0x283528['query']);_0x14ab1c[_0x07fc('0x33')]=_[_0x07fc('0x35')](_0x14ab1c['model'],_0x14ab1c[_0x07fc('0x32')]);_0x5118b3[_0x07fc('0x34')]=_[_0x07fc('0x35')](_0x14ab1c[_0x07fc('0x2f')],qs[_0x07fc('0x45')](_0x283528[_0x07fc('0x32')][_0x07fc('0x45')]));_0x5118b3[_0x07fc('0x34')]=_0x5118b3[_0x07fc('0x34')]['length']?_0x5118b3[_0x07fc('0x34')]:_0x14ab1c['model'];if(!_0x283528[_0x07fc('0x32')]['hasOwnProperty']('nolimit')){_0x5118b3[_0x07fc('0x21')]=qs[_0x07fc('0x21')](_0x283528[_0x07fc('0x32')][_0x07fc('0x21')]);_0x5118b3[_0x07fc('0x20')]=qs[_0x07fc('0x20')](_0x283528[_0x07fc('0x32')][_0x07fc('0x20')]);}_0x5118b3[_0x07fc('0x37')]=qs[_0x07fc('0x38')](_0x283528[_0x07fc('0x32')][_0x07fc('0x38')]);_0x5118b3[_0x07fc('0x3a')]=qs[_0x07fc('0x33')](_['pick'](_0x283528[_0x07fc('0x32')],_0x14ab1c['filters']));if(_0x283528[_0x07fc('0x32')][_0x07fc('0x3b')]){_0x5118b3[_0x07fc('0x3a')]=_[_0x07fc('0x3c')](_0x5118b3[_0x07fc('0x3a')],{'$or':_['map'](_0x32bc40,function(_0x38a46b){if(_0x38a46b[_0x07fc('0x2d')][_0x07fc('0x2e')]!==_0x07fc('0x75')){var _0x200e90={};_0x200e90[_0x38a46b['field']]={'$like':'%'+_0x283528['query']['filter']+'%'};return _0x200e90;}})});}var _0x4ed8eb=[];if(_0x1d5232){var _0x272c87=_[_0x07fc('0x47')](_0x15142f,[_0x07fc('0x31'),_0x1d5232[_0x07fc('0x31')]]);if(_0x272c87[_0x07fc('0x76')]){var _0xbaf445={};if(_0x2d2476[_0x07fc('0x6d')]===_0x07fc('0x77')){_0xbaf445[_0x272c87[_0x07fc('0x78')]]=_['map'](_0x1d5232['associatedResources'],'id');}else{_0xbaf445[_0x272c87[_0x07fc('0x78')]]=_0x1d5232[_0x07fc('0x79')];}_0x4ed8eb[_0x07fc('0x5a')](_0xbaf445);}else{_0x5118b3[_0x07fc('0x3a')]['id']=_0x1d5232[_0x07fc('0x79')];}}else{for(var _0xb17c89=0x0;_0xb17c89<_0x5a0c4c[_0x07fc('0x71')];_0xb17c89++){var _0x272c87=_[_0x07fc('0x47')](_0x15142f,['name',_0x5a0c4c[_0xb17c89][_0x07fc('0x31')]]);if(_0x272c87['field']){var _0xbaf445={};_0xbaf445[_0x272c87[_0x07fc('0x78')]]=_0x5a0c4c[_0xb17c89][_0x07fc('0x79')];_0x4ed8eb[_0x07fc('0x5a')](_0xbaf445);}else{if(!_0x5118b3[_0x07fc('0x3a')]['id'])_0x5118b3['where']['id']=[];_0x5a0c4c[_0xb17c89][_0x07fc('0x79')][_0x07fc('0x64')](function(_0x2bc8af){_0x5118b3[_0x07fc('0x3a')]['id'][_0x07fc('0x5a')](_0x2bc8af);});}}}if(!_[_0x07fc('0x5f')](_0x4ed8eb)){_0x5118b3[_0x07fc('0x3a')]=_[_0x07fc('0x3c')](_0x5118b3[_0x07fc('0x3a')],{'$and':{'$or':_0x4ed8eb}});}_0x5118b3=_[_0x07fc('0x3c')]({},_0x5118b3,_0x283528[_0x07fc('0x3d')]);if(_0x1d5232&&!_0x1d5232[_0x07fc('0x53')]&&_0x2d2476[_0x07fc('0x6d')]==='AnalyticExtractedReport'){if(_0x283528['query'][_0x07fc('0x46')]){_0x5118b3['include']=[{'all':!![]}];}return db[_0x2d2476[_0x07fc('0x6d')]][_0x07fc('0x3f')](_0x5118b3)[_0x07fc('0x26')](function(_0x2f6af2){var _0x426aeb=[];_0x2f6af2[_0x07fc('0x64')](function(_0x2692c4){var _0x2c9956;switch(_0x2692c4[_0x07fc('0x7a')]){case _0x07fc('0x7b'):_0x2c9956=_[_0x07fc('0x47')](_0x1d5232[_0x07fc('0x79')],function(_0x41afb1){return _0x41afb1['id']===_0x2692c4['reportId']&&_0x41afb1[_0x07fc('0x2d')]===_0x07fc('0x7c');});break;case'custom':_0x2c9956=_[_0x07fc('0x47')](_0x1d5232[_0x07fc('0x79')],function(_0x1669e8){return _0x1669e8['id']===_0x2692c4[_0x07fc('0x7d')]&&_0x1669e8['type']===_0x07fc('0x7e');});break;}if(_0x2c9956)_0x426aeb['push'](_0x2692c4);});_0x3b9c69[_0x07fc('0x1f')]=_0x426aeb[_0x07fc('0x71')];_0x3b9c69[_0x07fc('0x40')]=_0x426aeb;return _0x3b9c69;});}else{return db[_0x2d2476[_0x07fc('0x6d')]][_0x07fc('0x1f')]({'where':_0x5118b3[_0x07fc('0x3a')]})[_0x07fc('0x26')](function(_0x5bf117){_0x3b9c69[_0x07fc('0x1f')]=_0x5bf117;if(_0x283528[_0x07fc('0x32')][_0x07fc('0x46')]){if(_0x2d2476[_0x07fc('0x6d')]===_0x07fc('0x7f')){_0x5118b3[_0x07fc('0x3e')]=[{'model':db[_0x07fc('0x80')],'as':_0x07fc('0x81'),'attributes':['id','name',_0x07fc('0x82')],'required':_0x283528['query'][_0x07fc('0x83')]?!![]:![]},{'model':db[_0x07fc('0x80')],'as':_0x07fc('0x84'),'attributes':['id',_0x07fc('0x31'),_0x07fc('0x82')],'through':_0x283528[_0x07fc('0x32')][_0x07fc('0x83')]?{'attributes':[],'where':{'TagId':_0x283528['query'][_0x07fc('0x83')]||undefined}}:{},'required':_0x283528[_0x07fc('0x32')][_0x07fc('0x83')]?!![]:![]}];}else{_0x5118b3[_0x07fc('0x3e')]=[{'all':!![]}];}}return db[_0x2d2476['childModel']][_0x07fc('0x3f')](_0x5118b3);})[_0x07fc('0x26')](function(_0x3a4616){_0x3b9c69[_0x07fc('0x40')]=_0x3a4616;return _0x3b9c69;});}}else{return _0x3b9c69;}})[_0x07fc('0x26')](respondWithFilteredResult(_0x502e23,_0x5118b3))['catch'](handleError(_0x502e23,null));};function getAllResources(_0x52ca82,_0x4fadcf){return new BPromise(function(_0x4339c4,_0x2ee03e){if(_0x4fadcf){var _0x4067fe=_0x4fadcf[_0x07fc('0x3b')]?{[_0x4fadcf[_0x07fc('0x3b')][_0x07fc('0x76')]]:_0x4fadcf[_0x07fc('0x3b')][_0x07fc('0x85')]}:undefined;return db[_0x52ca82][_0x07fc('0x3f')]({'where':_0x4067fe,'raw':!![]})[_0x07fc('0x26')](function(_0x116b16){_0x4fadcf['associatedResources']=_['map'](_0x116b16,'id');_0x4339c4(_0x4fadcf);})[_0x07fc('0x41')](function(_0x54afb6){_0x2ee03e(_0x54afb6);});}else{_0x4339c4(null);}});}function getAllFilteredResources(_0x3ae8dc,_0x53249d){return new BPromise(function(_0x37f334,_0x292584){var _0x429a77=_0x3ae8dc[_0x07fc('0x3b')]?{[_0x3ae8dc[_0x07fc('0x3b')]['field']]:_0x3ae8dc['filter'][_0x07fc('0x85')]}:undefined;return db[_0x3ae8dc[_0x07fc('0x2f')]][_0x07fc('0x3f')]({'where':_0x429a77,'raw':!![]})[_0x07fc('0x26')](function(_0xaf49c1){_0x53249d[_0x07fc('0x79')]=_[_0x07fc('0x30')](_0xaf49c1,function(_0x40e89e){return _0x40e89e[_0x07fc('0x31')];});_0x37f334(_0x53249d);})[_0x07fc('0x41')](function(_0x157581){_0x292584(_0x157581);});});}function getAllowedResources(_0x747f15,_0x14099d,_0x481bb9){return new BPromise(function(_0xa85fb9,_0x315b7b){if(_0x14099d){return db[_0x07fc('0x54')][_0x07fc('0x3f')]({'where':{'sectionId':_0x14099d['id']},'raw':!![]})[_0x07fc('0x26')](function(_0x27563a){if(_0x747f15[_0x07fc('0x76')]&&_0x747f15[_0x07fc('0x76')]!=='id'){_0x14099d[_0x07fc('0x79')]=_[_0x07fc('0x30')](_0x27563a,function(_0x54ee7c){return _0x54ee7c[_0x747f15['field']];});}else{if(_0x481bb9==='AnalyticExtractedReport'){_0x14099d['associatedResources']=_['map'](_0x27563a,function(_0x12cb2f){return{'id':_0x12cb2f[_0x07fc('0x86')],'type':_0x12cb2f[_0x07fc('0x2d')]};});}else{_0x14099d[_0x07fc('0x79')]=_[_0x07fc('0x30')](_0x27563a,function(_0x428bb7){return _0x428bb7[_0x07fc('0x86')];});}}_0xa85fb9(_0x14099d);})[_0x07fc('0x41')](function(_0x36b7f9){_0x315b7b(_0x36b7f9);});}else{_0xa85fb9(null);}});}function getQueryModels(_0x3a442b,_0x3dd25e){var _0x1ed10c=_0x3a442b['toLowerCase']();var _0x1f7ddb={'childModel':undefined,'parentSections':[]};switch(_0x1ed10c){case'squareprojects':_0x1f7ddb[_0x07fc('0x6d')]='SquareProject';break;case _0x07fc('0x87'):_0x1f7ddb[_0x07fc('0x6d')]='SquareOdbc';break;case _0x07fc('0x88'):_0x1f7ddb['childModel']=_0x07fc('0x89');_0x1f7ddb[_0x07fc('0x70')]=[{'name':_0x07fc('0x8a'),'field':'name','foreignKey':'projectName'}];break;case _0x07fc('0x8b'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0x8c');break;case _0x07fc('0x8d'):_0x1f7ddb[_0x07fc('0x6d')]='CmContact';_0x1f7ddb['parentSections']=[{'name':_0x07fc('0x8e'),'field':'id','foreignKey':_0x07fc('0x8f')}];break;case _0x07fc('0x90'):_0x1f7ddb[_0x07fc('0x6d')]='CmList';break;case _0x07fc('0x91'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0x92');break;case _0x07fc('0x93'):_0x1f7ddb[_0x07fc('0x6d')]='CmCustomField';break;case'chatqueues':_0x1f7ddb[_0x07fc('0x6d')]='ChatQueue';break;case'chatwebsites':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0x94');break;case'faxqueues':_0x1f7ddb['childModel']=_0x07fc('0x95');break;case'faxaccounts':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0x96');break;case _0x07fc('0x97'):case _0x07fc('0x98'):case _0x07fc('0x99'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0x9a');break;case'contexts':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0x9b');break;case'voicemails':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0x9c');break;case _0x07fc('0x9d'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0x9e');_0x1f7ddb[_0x07fc('0x70')]=[{'name':_0x07fc('0x9f'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':_0x07fc('0xa0'),'value':[_0x07fc('0xa1')]}},{'name':_0x07fc('0xa2'),'field':_0x07fc('0x31'),'foreignKey':'membername','model':'User','filter':{'field':_0x07fc('0xa0'),'value':[_0x07fc('0xa3')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x07fc('0xa4'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x07fc('0xa5')]}},{'name':_0x07fc('0xa6'),'field':_0x07fc('0x31'),'foreignKey':_0x07fc('0xa4'),'model':_0x07fc('0xa7'),'filter':{'field':_0x07fc('0x2d'),'value':[_0x07fc('0xa8')]}}];break;case _0x07fc('0xa9'):_0x1f7ddb['childModel']=_0x07fc('0xaa');break;case _0x07fc('0xab'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xac');break;case _0x07fc('0xad'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xae');break;case _0x07fc('0xaf'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xb0');break;case'mailqueues':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xb1');break;case _0x07fc('0xb2'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xb3');break;case _0x07fc('0xb4'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xb5');break;case _0x07fc('0xb6'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xb7');break;case _0x07fc('0xb8'):_0x1f7ddb['childModel']=_0x07fc('0xb9');break;case _0x07fc('0xba'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xbb');break;case _0x07fc('0xbc'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xbd');break;case _0x07fc('0xbe'):_0x1f7ddb[_0x07fc('0x6d')]='WhatsappQueue';break;case'whatsappaccounts':_0x1f7ddb[_0x07fc('0x6d')]='WhatsappAccount';break;case _0x07fc('0xbf'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xc0');break;case'voicequeues':case'queuecampaigns':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xa7');if(_0x3dd25e){_0x1f7ddb[_0x07fc('0x70')]=[{'name':_0x07fc('0xc1')},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case'telephones':_0x1f7ddb['childModel']=_0x07fc('0xc2');if(_0x3dd25e){_0x1f7ddb[_0x07fc('0x70')]=[{'name':_0x07fc('0xc3'),'filter':{'field':_0x07fc('0xa0'),'value':['admin',_0x07fc('0xc4')]},'ignore':!![]},{'name':_0x07fc('0x9f')},{'name':_0x07fc('0xa2')}];}break;case _0x07fc('0xc5'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xc6');break;case'salesforceaccounts':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xc7');break;case _0x07fc('0xc8'):_0x1f7ddb[_0x07fc('0x6d')]='FreshdeskAccount';break;case _0x07fc('0xc9'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xca');break;case _0x07fc('0xcb'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xcc');break;case _0x07fc('0xcd'):_0x1f7ddb['childModel']=_0x07fc('0xce');break;case'vtigeraccounts':_0x1f7ddb['childModel']='User';break;case'cannedanswers':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xcf');break;case _0x07fc('0xd0'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xd1');break;case _0x07fc('0xd2'):_0x1f7ddb['childModel']='Dashboard';break;case'intervals':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xd3');break;case _0x07fc('0xd4'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xd5');break;case'scheduler':_0x1f7ddb[_0x07fc('0x6d')]='Schedule';break;case _0x07fc('0xd6'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xd7');break;case _0x07fc('0xd8'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0x80');break;case'templates':_0x1f7ddb[_0x07fc('0x6d')]='Template';break;case _0x07fc('0xd9'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xda');break;case _0x07fc('0xdb'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xdc');break;case'variables':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xdd');break;case _0x07fc('0xde'):_0x1f7ddb['childModel']='Plugin';break;case _0x07fc('0xdf'):_0x1f7ddb[_0x07fc('0x6d')]='AnalyticExtractedReport';_0x1f7ddb[_0x07fc('0x70')]=[{'name':_0x07fc('0xe0'),'field':'id','foreignKey':_0x07fc('0x7d')}];break;case _0x07fc('0xe1'):_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xe2');break;case'whatsappaccounts':_0x1f7ddb[_0x07fc('0x6d')]=_0x07fc('0xe3');break;default:return _0x1f7ddb;}return _0x1f7ddb;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 8c98220..fa7c31d 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 _0xf786=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xf786,0x136));var _0x6f78=function(_0x46b13a,_0x451458){_0x46b13a=_0x46b13a-0x0;var _0x1d260b=_0xf786[_0x46b13a];return _0x1d260b;};'use strict';var EventEmitter=require(_0x6f78('0x0'));var UserProfile=require(_0x6f78('0x1'))['db'][_0x6f78('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6f78('0x3')](0x0);var events={'afterCreate':_0x6f78('0x4'),'afterUpdate':_0x6f78('0x5'),'afterDestroy':_0x6f78('0x6')};function emitEvent(_0x528d30){return function(_0xba8f8,_0x3a2145,_0x38ff73){UserProfileEvents[_0x6f78('0x7')](_0x528d30+':'+_0xba8f8['id'],_0xba8f8);UserProfileEvents['emit'](_0x528d30,_0xba8f8);_0x38ff73(null);};}for(var e in events){if(events[_0x6f78('0x8')](e)){var event=events[e];UserProfile[_0x6f78('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xe0bc=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe0bc,0x166));var _0xce0b=function(_0x5af9,_0x13fd78){_0x5af9=_0x5af9-0x0;var _0x57969d=_0xe0bc[_0x5af9];return _0x57969d;};'use strict';var EventEmitter=require(_0xce0b('0x0'));var UserProfile=require(_0xce0b('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce0b('0x2'),'afterUpdate':_0xce0b('0x3'),'afterDestroy':_0xce0b('0x4')};function emitEvent(_0x13a124){return function(_0x16b0c4,_0x1b2219,_0x269246){UserProfileEvents[_0xce0b('0x5')](_0x13a124+':'+_0x16b0c4['id'],_0x16b0c4);UserProfileEvents['emit'](_0x13a124,_0x16b0c4);_0x269246(null);};}for(var e in events){if(events[_0xce0b('0x6')](e)){var event=events[e];UserProfile[_0xce0b('0x7')](e,emitEvent(event));}}module[_0xce0b('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 e075929..ae8324f 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 _0xd9a5=['user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfile.attributes','exports','define','UserProfile'];(function(_0x6e3003,_0x229342){var _0x324720=function(_0x4784a5){while(--_0x4784a5){_0x6e3003['push'](_0x6e3003['shift']());}};_0x324720(++_0x229342);}(_0xd9a5,0x135));var _0x5d9a=function(_0x5b4010,_0x212403){_0x5b4010=_0x5b4010-0x0;var _0x447c77=_0xd9a5[_0x5b4010];return _0x447c77;};'use strict';var _=require(_0x5d9a('0x0'));var util=require(_0x5d9a('0x1'));var logger=require(_0x5d9a('0x2'))(_0x5d9a('0x3'));var moment=require(_0x5d9a('0x4'));var BPromise=require(_0x5d9a('0x5'));var rp=require(_0x5d9a('0x6'));var fs=require('fs');var path=require(_0x5d9a('0x7'));var rimraf=require(_0x5d9a('0x8'));var config=require('../../config/environment');var attributes=require(_0x5d9a('0x9'));module[_0x5d9a('0xa')]=function(_0xfc074e,_0x8fee7a){return _0xfc074e[_0x5d9a('0xb')](_0x5d9a('0xc'),attributes,{'tableName':_0x5d9a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6806=['request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6806,0x1cf));var _0x6680=function(_0xc7b78b,_0x1f852e){_0xc7b78b=_0xc7b78b-0x0;var _0x4b5e17=_0x6806[_0xc7b78b];return _0x4b5e17;};'use strict';var _=require(_0x6680('0x0'));var util=require(_0x6680('0x1'));var logger=require(_0x6680('0x2'))(_0x6680('0x3'));var moment=require('moment');var BPromise=require(_0x6680('0x4'));var rp=require(_0x6680('0x5'));var fs=require('fs');var path=require(_0x6680('0x6'));var rimraf=require(_0x6680('0x7'));var config=require(_0x6680('0x8'));var attributes=require(_0x6680('0x9'));module[_0x6680('0xa')]=function(_0x48fc8f,_0x5bf654){return _0x48fc8f[_0x6680('0xb')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7a918c3..3aed7a6 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 _0x038b=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x2a7ab0,_0x586593){var _0x2d87c7=function(_0x363db0){while(--_0x363db0){_0x2a7ab0['push'](_0x2a7ab0['shift']());}};_0x2d87c7(++_0x586593);}(_0x038b,0x114));var _0xb038=function(_0x51cabe,_0x4af37a){_0x51cabe=_0x51cabe-0x0;var _0x1927d8=_0x038b[_0x51cabe];return _0x1927d8;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var moment=require(_0xb038('0x1'));var BPromise=require(_0xb038('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb038('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb038('0x4'));var logger=require(_0xb038('0x5'))('rpc');var config=require(_0xb038('0x6'));var jayson=require(_0xb038('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xb038('0x8')]=_[_0xb038('0x9')](config[_0xb038('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb038('0x8')]));require(_0xb038('0xa'))['register'](socket);function respondWithRpcPromise(_0x53bcc0,_0xe3d046,_0x2d1ae5){return new BPromise(function(_0x5c96b5,_0x2ede0b){return client[_0xb038('0xb')](_0x53bcc0,_0x2d1ae5)[_0xb038('0xc')](function(_0x3368c1){logger[_0xb038('0xd')](_0xb038('0xe'),_0xe3d046,_0xb038('0xf'));logger[_0xb038('0x10')](_0xb038('0x11'),_0xe3d046,_0xb038('0xf'),JSON[_0xb038('0x12')](_0x3368c1));if(_0x3368c1[_0xb038('0x13')]){if(_0x3368c1[_0xb038('0x13')][_0xb038('0x14')]===0x1f4){logger[_0xb038('0x13')](_0xb038('0xe'),_0xe3d046,_0x3368c1[_0xb038('0x13')]['message']);return _0x2ede0b(_0x3368c1[_0xb038('0x13')][_0xb038('0x15')]);}logger[_0xb038('0x13')](_0xb038('0xe'),_0xe3d046,_0x3368c1[_0xb038('0x13')][_0xb038('0x15')]);return _0x5c96b5(_0x3368c1['error'][_0xb038('0x15')]);}else{logger[_0xb038('0xd')](_0xb038('0xe'),_0xe3d046,_0xb038('0xf'));_0x5c96b5(_0x3368c1['result']['message']);}})[_0xb038('0x16')](function(_0x3f48e6){logger[_0xb038('0x13')](_0xb038('0xe'),_0xe3d046,_0x3f48e6);_0x2ede0b(_0x3f48e6);});});} \ No newline at end of file +var _0x8958=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','info'];(function(_0x347536,_0x372840){var _0x150450=function(_0x22117a){while(--_0x22117a){_0x347536['push'](_0x347536['shift']());}};_0x150450(++_0x372840);}(_0x8958,0x93));var _0x8895=function(_0x1a13a9,_0x45be9f){_0x1a13a9=_0x1a13a9-0x0;var _0x3ab895=_0x8958[_0x1a13a9];return _0x3ab895;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});config[_0x8895('0x7')]=_[_0x8895('0x8')](config[_0x8895('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x8895('0x9'))(new Redis(config[_0x8895('0x7')]));require(_0x8895('0xa'))[_0x8895('0xb')](socket);function respondWithRpcPromise(_0x6eab1e,_0x29c126,_0x22a12b){return new BPromise(function(_0xdb3d59,_0x46c467){return client[_0x8895('0xc')](_0x6eab1e,_0x22a12b)['then'](function(_0x1cf600){logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));logger[_0x8895('0x10')](_0x8895('0x11'),_0x29c126,'request\x20sent',JSON[_0x8895('0x12')](_0x1cf600));if(_0x1cf600[_0x8895('0x13')]){if(_0x1cf600[_0x8895('0x13')]['code']===0x1f4){logger['error'](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0x46c467(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0xdb3d59(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}else{logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));_0xdb3d59(_0x1cf600[_0x8895('0x15')][_0x8895('0x14')]);}})[_0x8895('0x16')](function(_0x2da618){logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x2da618);_0x46c467(_0x2da618);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 9f1452b..84ac0fa 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 _0xc0ad=['userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register','length'];(function(_0x53ab8b,_0x21c10f){var _0xd8be=function(_0xba0668){while(--_0xba0668){_0x53ab8b['push'](_0x53ab8b['shift']());}};_0xd8be(++_0x21c10f);}(_0xc0ad,0x121));var _0xdc0a=function(_0x2f3064,_0x23a256){_0x2f3064=_0x2f3064-0x0;var _0x473bf4=_0xc0ad[_0x2f3064];return _0x473bf4;};'use strict';var UserProfileEvents=require(_0xdc0a('0x0'));var events=[_0xdc0a('0x1'),_0xdc0a('0x2'),_0xdc0a('0x3')];function createListener(_0xaedb08,_0x24eee8){return function(_0xa81aea){_0x24eee8[_0xdc0a('0x4')](_0xaedb08,_0xa81aea);};}function removeListener(_0x4408b5,_0x28cb72){return function(){UserProfileEvents[_0xdc0a('0x5')](_0x4408b5,_0x28cb72);};}exports[_0xdc0a('0x6')]=function(_0x25cd4d){for(var _0x2aec6f=0x0,_0x59a902=events[_0xdc0a('0x7')];_0x2aec6f<_0x59a902;_0x2aec6f++){var _0x255094=events[_0x2aec6f];var _0x156fed=createListener(_0xdc0a('0x8')+_0x255094,_0x25cd4d);UserProfileEvents['on'](_0x255094,_0x156fed);}}; \ No newline at end of file +var _0xa09a=['remove','emit','register','length','userProfile:','./userProfile.events','save'];(function(_0x56a3ff,_0x440807){var _0x1d94a7=function(_0x109289){while(--_0x109289){_0x56a3ff['push'](_0x56a3ff['shift']());}};_0x1d94a7(++_0x440807);}(_0xa09a,0xc2));var _0xaa09=function(_0x341253,_0x5ae6cc){_0x341253=_0x341253-0x0;var _0x34c558=_0xa09a[_0x341253];return _0x34c558;};'use strict';var UserProfileEvents=require(_0xaa09('0x0'));var events=[_0xaa09('0x1'),_0xaa09('0x2'),'update'];function createListener(_0xdacb9b,_0x32a54e){return function(_0x5982a6){_0x32a54e[_0xaa09('0x3')](_0xdacb9b,_0x5982a6);};}function removeListener(_0x36647e,_0x259a7f){return function(){UserProfileEvents['removeListener'](_0x36647e,_0x259a7f);};}exports[_0xaa09('0x4')]=function(_0x10d27f){for(var _0x1804cd=0x0,_0x7768b5=events[_0xaa09('0x5')];_0x1804cd<_0x7768b5;_0x1804cd++){var _0x4dd4c4=events[_0x1804cd];var _0x19a219=createListener(_0xaa09('0x6')+_0x4dd4c4,_0x10d27f);UserProfileEvents['on'](_0x4dd4c4,_0x19a219);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 08bc69b..2ad3bec 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 _0xa846=['isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller'];(function(_0x539898,_0x1bb48a){var _0x5d6856=function(_0x214583){while(--_0x214583){_0x539898['push'](_0x539898['shift']());}};_0x5d6856(++_0x1bb48a);}(_0xa846,0x70));var _0x6a84=function(_0x55fdf1,_0x133350){_0x55fdf1=_0x55fdf1-0x0;var _0x18857d=_0xa846[_0x55fdf1];return _0x18857d;};'use strict';var multer=require('multer');var util=require(_0x6a84('0x0'));var path=require(_0x6a84('0x1'));var timeout=require(_0x6a84('0x2'));var express=require(_0x6a84('0x3'));var router=express[_0x6a84('0x4')]();var auth=require(_0x6a84('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6a84('0x6'));var controller=require(_0x6a84('0x7'));router['get']('/',auth[_0x6a84('0x8')](),controller[_0x6a84('0x9')]);router[_0x6a84('0xa')](_0x6a84('0xb'),auth['isAuthenticated'](),controller[_0x6a84('0xc')]);router['get'](_0x6a84('0xd'),auth['isAuthenticated'](),controller[_0x6a84('0xe')]);router['post']('/',auth[_0x6a84('0x8')](),controller[_0x6a84('0xf')]);router[_0x6a84('0x10')](_0x6a84('0xd'),auth[_0x6a84('0x8')](),controller[_0x6a84('0x11')]);router[_0x6a84('0x12')]('/:id',auth[_0x6a84('0x8')](),controller[_0x6a84('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0f0e=['delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','describe','/:id','isAuthenticated','show','put','update'];(function(_0x578c42,_0x2f51b2){var _0x13268d=function(_0x571a84){while(--_0x571a84){_0x578c42['push'](_0x578c42['shift']());}};_0x13268d(++_0x2f51b2);}(_0x0f0e,0x17e));var _0xe0f0=function(_0x4a7ca3,_0x52cc2e){_0x4a7ca3=_0x4a7ca3-0x0;var _0x21fd6e=_0x0f0e[_0x4a7ca3];return _0x21fd6e;};'use strict';var multer=require(_0xe0f0('0x0'));var util=require('util');var path=require(_0xe0f0('0x1'));var timeout=require(_0xe0f0('0x2'));var express=require(_0xe0f0('0x3'));var router=express[_0xe0f0('0x4')]();var auth=require(_0xe0f0('0x5'));var interaction=require(_0xe0f0('0x6'));var config=require(_0xe0f0('0x7'));var controller=require(_0xe0f0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xe0f0('0x9')]);router[_0xe0f0('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xe0f0('0xb')]);router[_0xe0f0('0xa')](_0xe0f0('0xc'),auth[_0xe0f0('0xd')](),controller[_0xe0f0('0xe')]);router['post']('/',auth[_0xe0f0('0xd')](),controller['create']);router[_0xe0f0('0xf')](_0xe0f0('0xc'),auth[_0xe0f0('0xd')](),controller[_0xe0f0('0x10')]);router[_0xe0f0('0x11')](_0xe0f0('0xc'),auth[_0xe0f0('0xd')](),controller['destroy']);module[_0xe0f0('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 5e838b6..e50fc37 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 _0x85a8=['INTEGER','exports','STRING'];(function(_0x14b3a6,_0x95a918){var _0x245603=function(_0x571a46){while(--_0x571a46){_0x14b3a6['push'](_0x14b3a6['shift']());}};_0x245603(++_0x95a918);}(_0x85a8,0xd3));var _0x885a=function(_0x45fbc3,_0x5d5c98){_0x45fbc3=_0x45fbc3-0x0;var _0x4a599b=_0x85a8[_0x45fbc3];return _0x4a599b;};'use strict';var Sequelize=require('sequelize');module[_0x885a('0x0')]={'name':{'type':Sequelize[_0x885a('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x885a('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xad18=['STRING','INTEGER','sequelize','exports'];(function(_0x34dd85,_0xe4e875){var _0x34a973=function(_0x4ce53b){while(--_0x4ce53b){_0x34dd85['push'](_0x34dd85['shift']());}};_0x34a973(++_0xe4e875);}(_0xad18,0x12a));var _0x8ad1=function(_0xb381b2,_0x1d209f){_0xb381b2=_0xb381b2-0x0;var _0x3e24fd=_0xad18[_0xb381b2];return _0x3e24fd;};'use strict';var Sequelize=require(_0x8ad1('0x0'));module[_0x8ad1('0x1')]={'name':{'type':Sequelize[_0x8ad1('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8ad1('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8ad1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 3e9d63b..6403338 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 _0x31f0=['index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','merge','type','VIRTUAL','filter','options','where','includeAll','include','findAll','catch','show','find','create','body','params','destroy','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x31f0,0xb7));var _0x031f=function(_0x3420b3,_0x5a31c3){_0x3420b3=_0x3420b3-0x0;var _0x4a7c0a=_0x31f0[_0x3420b3];return _0x4a7c0a;};'use strict';var pdf=require(_0x031f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x031f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x031f('0x2'));var rp=require(_0x031f('0x3'));var moment=require(_0x031f('0x4'));var BPromise=require(_0x031f('0x5'));var Mustache=require('mustache');var util=require(_0x031f('0x6'));var path=require(_0x031f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var db=require(_0x031f('0x16'))['db'];function respondWithStatusCode(_0x28da6e,_0x351052){_0x351052=_0x351052||0xcc;return function(_0x3819bb){if(_0x3819bb){return _0x28da6e[_0x031f('0x17')](_0x351052);}return _0x28da6e[_0x031f('0x18')](_0x351052)['end']();};}function respondWithResult(_0x1614d6,_0x23b40c){_0x23b40c=_0x23b40c||0xc8;return function(_0x17a699){if(_0x17a699){return _0x1614d6[_0x031f('0x18')](_0x23b40c)[_0x031f('0x19')](_0x17a699);}};}function respondWithFilteredResult(_0x57f9c0,_0x4b7011){return function(_0x1f08db){if(_0x1f08db){var _0x3a10aa=_0x1f08db[_0x031f('0x1a')],_0xe4fc1d=_0x4b7011[_0x031f('0x1b')],_0x286177=_0x4b7011['offset']+_0x4b7011[_0x031f('0x1c')],_0x5196b1;if(_0x286177>=_0x3a10aa){_0x286177=_0x3a10aa;_0x5196b1=0xc8;}else{_0x5196b1=0xce;}_0x57f9c0['status'](_0x5196b1);return _0x57f9c0[_0x031f('0x1d')](_0x031f('0x1e'),_0xe4fc1d+'-'+_0x286177+'/'+_0x3a10aa)[_0x031f('0x19')](_0x1f08db);}return null;};}function patchUpdates(_0xaa155){return function(_0x1ceddc){try{jsonpatch[_0x031f('0x1f')](_0x1ceddc,_0xaa155,!![]);}catch(_0x1b76d6){return BPromise[_0x031f('0x20')](_0x1b76d6);}return _0x1ceddc[_0x031f('0x21')]();};}function saveUpdates(_0x345bde,_0x29dd6e){return function(_0x48a76e){if(_0x48a76e){return _0x48a76e[_0x031f('0x22')](_0x345bde)[_0x031f('0x23')](function(_0x451328){return _0x451328;});}return null;};}function removeEntity(_0x4d6706,_0x5c4184){return function(_0xa11a2b){if(_0xa11a2b){return _0xa11a2b['destroy']()[_0x031f('0x23')](function(){_0x4d6706['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47d639,_0x971691){return function(_0x12c406){if(!_0x12c406){_0x47d639[_0x031f('0x17')](0x194);}return _0x12c406;};}function handleError(_0x4c8126,_0x494568){_0x494568=_0x494568||0x1f4;return function(_0x374b65){logger['error'](_0x374b65[_0x031f('0x24')]);if(_0x374b65[_0x031f('0x25')]){delete _0x374b65[_0x031f('0x25')];}_0x4c8126['status'](_0x494568)[_0x031f('0x26')](_0x374b65);};}exports[_0x031f('0x27')]=function(_0x54b44e,_0x3847b2){var _0x28a617={},_0x2403e9={},_0x5395ea={'count':0x0,'rows':[]};var _0xa308b=_[_0x031f('0x28')](db[_0x031f('0x29')][_0x031f('0x2a')],function(_0xfaa36){return{'name':_0xfaa36[_0x031f('0x2b')],'type':_0xfaa36['type'][_0x031f('0x2c')]};});_0x2403e9[_0x031f('0x2d')]=_[_0x031f('0x28')](_0xa308b,_0x031f('0x25'));_0x2403e9[_0x031f('0x2e')]=_[_0x031f('0x2f')](_0x54b44e[_0x031f('0x2e')]);_0x2403e9[_0x031f('0x30')]=_[_0x031f('0x31')](_0x2403e9[_0x031f('0x2d')],_0x2403e9[_0x031f('0x2e')]);_0x28a617['attributes']=_[_0x031f('0x31')](_0x2403e9[_0x031f('0x2d')],qs[_0x031f('0x32')](_0x54b44e[_0x031f('0x2e')][_0x031f('0x32')]));_0x28a617[_0x031f('0x33')]=_0x28a617[_0x031f('0x33')][_0x031f('0x34')]?_0x28a617[_0x031f('0x33')]:_0x2403e9[_0x031f('0x2d')];if(!_0x54b44e[_0x031f('0x2e')][_0x031f('0x35')](_0x031f('0x36'))){_0x28a617['limit']=qs[_0x031f('0x1c')](_0x54b44e[_0x031f('0x2e')]['limit']);_0x28a617[_0x031f('0x1b')]=qs[_0x031f('0x1b')](_0x54b44e['query'][_0x031f('0x1b')]);}_0x28a617[_0x031f('0x37')]=qs[_0x031f('0x38')](_0x54b44e[_0x031f('0x2e')]['sort']);_0x28a617['where']=qs[_0x031f('0x30')](_['pick'](_0x54b44e[_0x031f('0x2e')],_0x2403e9[_0x031f('0x30')]),_0xa308b);if(_0x54b44e[_0x031f('0x2e')]['filter']){_0x28a617['where']=_[_0x031f('0x39')](_0x28a617['where'],{'$or':_['map'](_0xa308b,function(_0x2d489a){if(_0x2d489a[_0x031f('0x3a')]!==_0x031f('0x3b')){var _0x1a44df={};_0x1a44df[_0x2d489a[_0x031f('0x25')]]={'$like':'%'+_0x54b44e[_0x031f('0x2e')][_0x031f('0x3c')]+'%'};return _0x1a44df;}})});}_0x28a617=_['merge']({},_0x28a617,_0x54b44e[_0x031f('0x3d')]);var _0x2e580f={'where':_0x28a617[_0x031f('0x3e')]};return db[_0x031f('0x29')]['count'](_0x2e580f)[_0x031f('0x23')](function(_0x10f590){_0x5395ea[_0x031f('0x1a')]=_0x10f590;if(_0x54b44e['query'][_0x031f('0x3f')]){_0x28a617[_0x031f('0x40')]=[{'all':!![]}];}return db['UserProfileResource'][_0x031f('0x41')](_0x28a617);})[_0x031f('0x23')](function(_0x56a8f3){_0x5395ea['rows']=_0x56a8f3;return _0x5395ea;})[_0x031f('0x23')](respondWithFilteredResult(_0x3847b2,_0x28a617))[_0x031f('0x42')](handleError(_0x3847b2,null));};exports[_0x031f('0x43')]=function(_0x46885f,_0x2691b7){var _0xf0fb95={'raw':![],'where':{'id':_0x46885f['params']['id']}},_0xe07087={};_0xe07087[_0x031f('0x2d')]=_[_0x031f('0x2f')](db['UserProfileResource'][_0x031f('0x2a')]);_0xe07087['query']=_[_0x031f('0x2f')](_0x46885f[_0x031f('0x2e')]);_0xe07087['filters']=_[_0x031f('0x31')](_0xe07087[_0x031f('0x2d')],_0xe07087[_0x031f('0x2e')]);_0xf0fb95['attributes']=_[_0x031f('0x31')](_0xe07087[_0x031f('0x2d')],qs[_0x031f('0x32')](_0x46885f[_0x031f('0x2e')][_0x031f('0x32')]));_0xf0fb95[_0x031f('0x33')]=_0xf0fb95[_0x031f('0x33')][_0x031f('0x34')]?_0xf0fb95[_0x031f('0x33')]:_0xe07087['model'];if(_0x46885f[_0x031f('0x2e')][_0x031f('0x3f')]){_0xf0fb95[_0x031f('0x40')]=[{'all':!![]}];}_0xf0fb95=_[_0x031f('0x39')]({},_0xf0fb95,_0x46885f[_0x031f('0x3d')]);return db[_0x031f('0x29')][_0x031f('0x44')](_0xf0fb95)[_0x031f('0x23')](handleEntityNotFound(_0x2691b7,null))[_0x031f('0x23')](respondWithResult(_0x2691b7,null))['catch'](handleError(_0x2691b7,null));};exports[_0x031f('0x45')]=function(_0x5ec593,_0x512937){return db[_0x031f('0x29')][_0x031f('0x45')](_0x5ec593[_0x031f('0x46')],{})[_0x031f('0x23')](respondWithResult(_0x512937,0xc9))[_0x031f('0x42')](handleError(_0x512937,null));};exports['update']=function(_0x309642,_0x365f8c){if(_0x309642[_0x031f('0x46')]['id']){delete _0x309642['body']['id'];}return db[_0x031f('0x29')][_0x031f('0x44')]({'where':{'id':_0x309642[_0x031f('0x47')]['id']}})[_0x031f('0x23')](handleEntityNotFound(_0x365f8c,null))[_0x031f('0x23')](saveUpdates(_0x309642[_0x031f('0x46')],null))['then'](respondWithResult(_0x365f8c,null))['catch'](handleError(_0x365f8c,null));};exports[_0x031f('0x48')]=function(_0x579b17,_0x3b8c04){return db[_0x031f('0x29')]['find']({'where':{'id':_0x579b17[_0x031f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b8c04,null))['then'](removeEntity(_0x3b8c04,null))[_0x031f('0x42')](handleError(_0x3b8c04,null));};exports['describe']=function(_0x16bade,_0x57e9dc){return db[_0x031f('0x29')][_0x031f('0x49')]()['then'](respondWithResult(_0x57e9dc,null))[_0x031f('0x42')](handleError(_0x57e9dc,null));}; \ No newline at end of file +var _0x7217=['type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName'];(function(_0x1a2ed8,_0x1ea1ab){var _0x4b8ba0=function(_0x4b9bd8){while(--_0x4b9bd8){_0x1a2ed8['push'](_0x1a2ed8['shift']());}};_0x4b8ba0(++_0x1ea1ab);}(_0x7217,0x19e));var _0x7721=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7217[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var db=require(_0x7721('0x1a'))['db'];function respondWithStatusCode(_0x27b36b,_0x55b4ca){_0x55b4ca=_0x55b4ca||0xcc;return function(_0x2911ec){if(_0x2911ec){return _0x27b36b[_0x7721('0x1b')](_0x55b4ca);}return _0x27b36b['status'](_0x55b4ca)[_0x7721('0x1c')]();};}function respondWithResult(_0x30da54,_0x3f01c5){_0x3f01c5=_0x3f01c5||0xc8;return function(_0x2e9752){if(_0x2e9752){return _0x30da54['status'](_0x3f01c5)[_0x7721('0x1d')](_0x2e9752);}};}function respondWithFilteredResult(_0x25b1c0,_0x534f1b){return function(_0x4e199a){if(_0x4e199a){var _0x4b183e=_0x4e199a[_0x7721('0x1e')],_0x5ed54=_0x534f1b['offset'],_0x25a628=_0x534f1b[_0x7721('0x1f')]+_0x534f1b['limit'],_0x3cc909;if(_0x25a628>=_0x4b183e){_0x25a628=_0x4b183e;_0x3cc909=0xc8;}else{_0x3cc909=0xce;}_0x25b1c0[_0x7721('0x20')](_0x3cc909);return _0x25b1c0['set'](_0x7721('0x21'),_0x5ed54+'-'+_0x25a628+'/'+_0x4b183e)[_0x7721('0x1d')](_0x4e199a);}return null;};}function patchUpdates(_0x3ab5a5){return function(_0x3e140d){try{jsonpatch[_0x7721('0x22')](_0x3e140d,_0x3ab5a5,!![]);}catch(_0x40af90){return BPromise[_0x7721('0x23')](_0x40af90);}return _0x3e140d[_0x7721('0x24')]();};}function saveUpdates(_0x3b29ac,_0xaeccc4){return function(_0x4ce1db){if(_0x4ce1db){return _0x4ce1db[_0x7721('0x25')](_0x3b29ac)[_0x7721('0x26')](function(_0x3a053f){return _0x3a053f;});}return null;};}function removeEntity(_0xd8ad3c,_0x57140c){return function(_0x28f5a6){if(_0x28f5a6){return _0x28f5a6['destroy']()[_0x7721('0x26')](function(){_0xd8ad3c[_0x7721('0x20')](0xcc)[_0x7721('0x1c')]();});}};}function handleEntityNotFound(_0x1caad8,_0x121cc4){return function(_0x395b15){if(!_0x395b15){_0x1caad8[_0x7721('0x1b')](0x194);}return _0x395b15;};}function handleError(_0x5b4d74,_0x216f20){_0x216f20=_0x216f20||0x1f4;return function(_0x1abedb){logger[_0x7721('0x27')](_0x1abedb[_0x7721('0x28')]);if(_0x1abedb[_0x7721('0x29')]){delete _0x1abedb[_0x7721('0x29')];}_0x5b4d74[_0x7721('0x20')](_0x216f20)[_0x7721('0x2a')](_0x1abedb);};}exports[_0x7721('0x2b')]=function(_0x52316e,_0x258ddf){var _0x5b0551={},_0x499b87={},_0x315202={'count':0x0,'rows':[]};var _0x343c19=_[_0x7721('0x2c')](db[_0x7721('0x2d')][_0x7721('0x2e')],function(_0x37b9f0){return{'name':_0x37b9f0[_0x7721('0x2f')],'type':_0x37b9f0[_0x7721('0x30')]['key']};});_0x499b87[_0x7721('0x31')]=_[_0x7721('0x2c')](_0x343c19,'name');_0x499b87['query']=_[_0x7721('0x32')](_0x52316e[_0x7721('0x33')]);_0x499b87['filters']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],_0x499b87[_0x7721('0x33')]);_0x5b0551['attributes']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52316e[_0x7721('0x33')][_0x7721('0x35')]));_0x5b0551['attributes']=_0x5b0551[_0x7721('0x36')][_0x7721('0x37')]?_0x5b0551[_0x7721('0x36')]:_0x499b87['model'];if(!_0x52316e[_0x7721('0x33')][_0x7721('0x38')]('nolimit')){_0x5b0551[_0x7721('0x39')]=qs['limit'](_0x52316e[_0x7721('0x33')][_0x7721('0x39')]);_0x5b0551[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x52316e[_0x7721('0x33')][_0x7721('0x1f')]);}_0x5b0551[_0x7721('0x3a')]=qs[_0x7721('0x3b')](_0x52316e[_0x7721('0x33')][_0x7721('0x3b')]);_0x5b0551[_0x7721('0x3c')]=qs['filters'](_[_0x7721('0x3d')](_0x52316e['query'],_0x499b87[_0x7721('0x3e')]),_0x343c19);if(_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]){_0x5b0551[_0x7721('0x3c')]=_[_0x7721('0x40')](_0x5b0551[_0x7721('0x3c')],{'$or':_['map'](_0x343c19,function(_0x557c34){if(_0x557c34['type']!=='VIRTUAL'){var _0x18001c={};_0x18001c[_0x557c34[_0x7721('0x29')]]={'$like':'%'+_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]+'%'};return _0x18001c;}})});}_0x5b0551=_['merge']({},_0x5b0551,_0x52316e[_0x7721('0x41')]);var _0x4cf659={'where':_0x5b0551[_0x7721('0x3c')]};return db[_0x7721('0x2d')]['count'](_0x4cf659)[_0x7721('0x26')](function(_0x3a47c8){_0x315202['count']=_0x3a47c8;if(_0x52316e['query'][_0x7721('0x42')]){_0x5b0551[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x2d')][_0x7721('0x44')](_0x5b0551);})['then'](function(_0x2db173){_0x315202[_0x7721('0x45')]=_0x2db173;return _0x315202;})[_0x7721('0x26')](respondWithFilteredResult(_0x258ddf,_0x5b0551))[_0x7721('0x46')](handleError(_0x258ddf,null));};exports[_0x7721('0x47')]=function(_0x52ab67,_0x490d4){var _0x4a2c28={'raw':![],'where':{'id':_0x52ab67['params']['id']}},_0xaa3216={};_0xaa3216[_0x7721('0x31')]=_[_0x7721('0x32')](db[_0x7721('0x2d')]['rawAttributes']);_0xaa3216[_0x7721('0x33')]=_[_0x7721('0x32')](_0x52ab67[_0x7721('0x33')]);_0xaa3216['filters']=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],_0xaa3216[_0x7721('0x33')]);_0x4a2c28[_0x7721('0x36')]=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52ab67['query']['fields']));_0x4a2c28[_0x7721('0x36')]=_0x4a2c28[_0x7721('0x36')][_0x7721('0x37')]?_0x4a2c28[_0x7721('0x36')]:_0xaa3216[_0x7721('0x31')];if(_0x52ab67[_0x7721('0x33')][_0x7721('0x42')]){_0x4a2c28[_0x7721('0x43')]=[{'all':!![]}];}_0x4a2c28=_[_0x7721('0x40')]({},_0x4a2c28,_0x52ab67[_0x7721('0x41')]);return db['UserProfileResource']['find'](_0x4a2c28)[_0x7721('0x26')](handleEntityNotFound(_0x490d4,null))[_0x7721('0x26')](respondWithResult(_0x490d4,null))[_0x7721('0x46')](handleError(_0x490d4,null));};exports[_0x7721('0x48')]=function(_0x589e95,_0x30107e){return db[_0x7721('0x2d')]['create'](_0x589e95[_0x7721('0x49')],{})['then'](respondWithResult(_0x30107e,0xc9))[_0x7721('0x46')](handleError(_0x30107e,null));};exports['update']=function(_0x334f23,_0x196be4){if(_0x334f23[_0x7721('0x49')]['id']){delete _0x334f23['body']['id'];}return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0x334f23['params']['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x196be4,null))[_0x7721('0x26')](saveUpdates(_0x334f23[_0x7721('0x49')],null))['then'](respondWithResult(_0x196be4,null))[_0x7721('0x46')](handleError(_0x196be4,null));};exports['destroy']=function(_0xdb1ca8,_0x310549){return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0xdb1ca8[_0x7721('0x4b')]['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x310549,null))[_0x7721('0x26')](removeEntity(_0x310549,null))[_0x7721('0x46')](handleError(_0x310549,null));};exports[_0x7721('0x4c')]=function(_0x3386aa,_0x31770e){return db[_0x7721('0x2d')][_0x7721('0x4c')]()[_0x7721('0x26')](respondWithResult(_0x31770e,null))[_0x7721('0x46')](handleError(_0x31770e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0d9a338..be16a37 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 _0x702d=['exports','define','UserProfileResource','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x578eb2,_0x1a7547){var _0x91a5e=function(_0x44eb39){while(--_0x44eb39){_0x578eb2['push'](_0x578eb2['shift']());}};_0x91a5e(++_0x1a7547);}(_0x702d,0x147));var _0xd702=function(_0x3902e1,_0x2675c8){_0x3902e1=_0x3902e1-0x0;var _0xcfb71a=_0x702d[_0x3902e1];return _0xcfb71a;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./userProfileResource.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xd702('0xc'),'fields':['resourceId',_0xd702('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x96cc=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','moment','bluebird'];(function(_0x318066,_0x51636f){var _0x14f526=function(_0x46f895){while(--_0x46f895){_0x318066['push'](_0x318066['shift']());}};_0x14f526(++_0x51636f);}(_0x96cc,0x16c));var _0xc96c=function(_0x53ca92,_0x3af852){_0x53ca92=_0x53ca92-0x0;var _0x138062=_0x96cc[_0x53ca92];return _0x138062;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var logger=require(_0xc96c('0x1'))('api');var moment=require(_0xc96c('0x2'));var BPromise=require(_0xc96c('0x3'));var rp=require(_0xc96c('0x4'));var fs=require('fs');var path=require(_0xc96c('0x5'));var rimraf=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var attributes=require(_0xc96c('0x8'));module[_0xc96c('0x9')]=function(_0x3b7f45,_0x5142cd){return _0x3b7f45[_0xc96c('0xa')](_0xc96c('0xb'),attributes,{'tableName':_0xc96c('0xc'),'paranoid':![],'indexes':[{'name':_0xc96c('0xd'),'fields':[_0xc96c('0xe'),_0xc96c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index faf9253..58633f9 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 _0x455f=['UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x467ce3,_0xa1102f){var _0xd0fe10=function(_0x42bf1f){while(--_0x42bf1f){_0x467ce3['push'](_0x467ce3['shift']());}};_0xd0fe10(++_0xa1102f);}(_0x455f,0x134));var _0xf455=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x455f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf455('0x0'));var BPromise=require(_0xf455('0x1'));var rs=require(_0xf455('0x2'));var fs=require('fs');var Redis=require(_0xf455('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf455('0x4'));var logger=require(_0xf455('0x5'))(_0xf455('0x6'));var config=require(_0xf455('0x7'));var jayson=require(_0xf455('0x8'));var client=jayson[_0xf455('0x9')][_0xf455('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4906fe,_0x4ff0fa,_0x219bc8){return new BPromise(function(_0x524373,_0x5be45b){return client[_0xf455('0xb')](_0x4906fe,_0x219bc8)[_0xf455('0xc')](function(_0x2a27c7){logger[_0xf455('0xd')](_0xf455('0xe'),_0x4ff0fa,_0xf455('0xf'));logger[_0xf455('0x10')](_0xf455('0x11'),_0x4ff0fa,'request\x20sent',JSON[_0xf455('0x12')](_0x2a27c7));if(_0x2a27c7[_0xf455('0x13')]){if(_0x2a27c7[_0xf455('0x13')][_0xf455('0x14')]===0x1f4){logger[_0xf455('0x13')](_0xf455('0xe'),_0x4ff0fa,_0x2a27c7[_0xf455('0x13')][_0xf455('0x15')]);return _0x5be45b(_0x2a27c7[_0xf455('0x13')][_0xf455('0x15')]);}logger[_0xf455('0x13')](_0xf455('0xe'),_0x4ff0fa,_0x2a27c7[_0xf455('0x13')][_0xf455('0x15')]);return _0x524373(_0x2a27c7[_0xf455('0x13')][_0xf455('0x15')]);}else{logger[_0xf455('0xd')](_0xf455('0xe'),_0x4ff0fa,_0xf455('0xf'));_0x524373(_0x2a27c7[_0xf455('0x16')][_0xf455('0x15')]);}})['catch'](function(_0x322b21){logger[_0xf455('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x4ff0fa,_0x322b21);_0x5be45b(_0x322b21);});});} \ No newline at end of file +var _0xf7fa=['http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x2dac51,_0x5530df){var _0x5d8b12=function(_0x55c837){while(--_0x55c837){_0x2dac51['push'](_0x2dac51['shift']());}};_0x5d8b12(++_0x5530df);}(_0xf7fa,0x14d));var _0xaf7f=function(_0x5e7721,_0x4ca59f){_0x5e7721=_0x5e7721-0x0;var _0x5a0f22=_0xf7fa[_0x5e7721];return _0x5a0f22;};'use strict';var _=require('lodash');var util=require(_0xaf7f('0x0'));var moment=require(_0xaf7f('0x1'));var BPromise=require(_0xaf7f('0x2'));var rs=require(_0xaf7f('0x3'));var fs=require('fs');var Redis=require(_0xaf7f('0x4'));var db=require(_0xaf7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf7f('0x6'));var config=require(_0xaf7f('0x7'));var jayson=require(_0xaf7f('0x8'));var client=jayson['client'][_0xaf7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5883,_0x43ccff,_0x421b2d){return new BPromise(function(_0x2e1046,_0x5c4aa9){return client[_0xaf7f('0xa')](_0x3c5883,_0x421b2d)['then'](function(_0x1d3377){logger[_0xaf7f('0xb')](_0xaf7f('0xc'),_0x43ccff,_0xaf7f('0xd'));logger['debug'](_0xaf7f('0xe'),_0x43ccff,_0xaf7f('0xd'),JSON['stringify'](_0x1d3377));if(_0x1d3377[_0xaf7f('0xf')]){if(_0x1d3377['error'][_0xaf7f('0x10')]===0x1f4){logger['error'](_0xaf7f('0xc'),_0x43ccff,_0x1d3377[_0xaf7f('0xf')]['message']);return _0x5c4aa9(_0x1d3377[_0xaf7f('0xf')][_0xaf7f('0x11')]);}logger[_0xaf7f('0xf')](_0xaf7f('0xc'),_0x43ccff,_0x1d3377[_0xaf7f('0xf')][_0xaf7f('0x11')]);return _0x2e1046(_0x1d3377[_0xaf7f('0xf')]['message']);}else{logger[_0xaf7f('0xb')](_0xaf7f('0xc'),_0x43ccff,'request\x20sent');_0x2e1046(_0x1d3377['result']['message']);}})[_0xaf7f('0x12')](function(_0x1613c9){logger[_0xaf7f('0xf')](_0xaf7f('0xc'),_0x43ccff,_0x1613c9);_0x5c4aa9(_0x1613c9);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index afdb8db..adc274a 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 _0xb150=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3ea125,_0x46c6de){var _0x56838f=function(_0x43fef9){while(--_0x43fef9){_0x3ea125['push'](_0x3ea125['shift']());}};_0x56838f(++_0x46c6de);}(_0xb150,0x18e));var _0x0b15=function(_0x2d25b4,_0x35bca7){_0x2d25b4=_0x2d25b4-0x0;var _0x33defe=_0xb150[_0x2d25b4];return _0x33defe;};'use strict';var multer=require(_0x0b15('0x0'));var util=require(_0x0b15('0x1'));var path=require(_0x0b15('0x2'));var timeout=require(_0x0b15('0x3'));var express=require(_0x0b15('0x4'));var router=express[_0x0b15('0x5')]();var auth=require(_0x0b15('0x6'));var interaction=require(_0x0b15('0x7'));var config=require(_0x0b15('0x8'));var controller=require('./userProfileSection.controller');router[_0x0b15('0x9')]('/',auth[_0x0b15('0xa')](),controller[_0x0b15('0xb')]);router[_0x0b15('0x9')](_0x0b15('0xc'),auth[_0x0b15('0xa')](),controller[_0x0b15('0xd')]);router[_0x0b15('0x9')](_0x0b15('0xe'),auth['isAuthenticated'](),controller[_0x0b15('0xf')]);router[_0x0b15('0x10')]('/',auth[_0x0b15('0xa')](),controller[_0x0b15('0x11')]);router[_0x0b15('0x12')](_0x0b15('0xe'),auth[_0x0b15('0xa')](),controller[_0x0b15('0x13')]);router[_0x0b15('0x14')]('/:id',auth[_0x0b15('0xa')](),controller[_0x0b15('0x15')]);module[_0x0b15('0x16')]=router; \ No newline at end of file +var _0xc6b4=['destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','/:id','show','post','create','put','delete'];(function(_0x4b25bc,_0x1a7c95){var _0x47ac96=function(_0x4d0c52){while(--_0x4d0c52){_0x4b25bc['push'](_0x4b25bc['shift']());}};_0x47ac96(++_0x1a7c95);}(_0xc6b4,0x1aa));var _0x4c6b=function(_0x18baf4,_0x33086b){_0x18baf4=_0x18baf4-0x0;var _0x278ed1=_0xc6b4[_0x18baf4];return _0x278ed1;};'use strict';var multer=require(_0x4c6b('0x0'));var util=require('util');var path=require(_0x4c6b('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c6b('0x2'));var router=express[_0x4c6b('0x3')]();var auth=require(_0x4c6b('0x4'));var interaction=require(_0x4c6b('0x5'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x4c6b('0x6')]('/',auth['isAuthenticated'](),controller[_0x4c6b('0x7')]);router[_0x4c6b('0x6')](_0x4c6b('0x8'),auth[_0x4c6b('0x9')](),controller['describe']);router[_0x4c6b('0x6')](_0x4c6b('0xa'),auth[_0x4c6b('0x9')](),controller[_0x4c6b('0xb')]);router[_0x4c6b('0xc')]('/',auth[_0x4c6b('0x9')](),controller[_0x4c6b('0xd')]);router[_0x4c6b('0xe')]('/:id',auth[_0x4c6b('0x9')](),controller['update']);router[_0x4c6b('0xf')]('/:id',auth[_0x4c6b('0x9')](),controller[_0x4c6b('0x10')]);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 d87d0ab..1571f30 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 _0x6873=['crudPermissions','join','getDataValue','split','STRING','INTEGER','BOOLEAN'];(function(_0x39b4f3,_0xa9a5e3){var _0x40dcb0=function(_0x426258){while(--_0x426258){_0x39b4f3['push'](_0x39b4f3['shift']());}};_0x40dcb0(++_0xa9a5e3);}(_0x6873,0xac));var _0x3687=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x6873[_0x36d703];return _0x12c909;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3687('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x3687('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3687('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3687('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3687('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x247d96){this['setDataValue'](_0x3687('0x3'),_0x247d96?_0x247d96[_0x3687('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x3687('0x3'))?this[_0x3687('0x5')](_0x3687('0x3'))[_0x3687('0x6')](''):[];}}}; \ No newline at end of file +var _0x0e9f=['INTEGER','STRING','crudPermissions','join','split','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e9f,0x116));var _0xf0e9=function(_0x47e28c,_0x5a76eb){_0x47e28c=_0x47e28c-0x0;var _0x3cda5d=_0x0e9f[_0x47e28c];return _0x3cda5d;};'use strict';var Sequelize=require(_0xf0e9('0x0'));module[_0xf0e9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf0e9('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xf0e9('0x3')],'set':function(_0x559cad){this['setDataValue'](_0xf0e9('0x4'),_0x559cad?_0x559cad[_0xf0e9('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xf0e9('0x4'))?this['getDataValue'](_0xf0e9('0x4'))[_0xf0e9('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 4bac397..17386d0 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 _0xd200=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','destroy','then','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','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','../../config/logger','api','../../config/utils'];(function(_0xae9024,_0x17f58e){var _0x23e7d3=function(_0x5911fb){while(--_0x5911fb){_0xae9024['push'](_0xae9024['shift']());}};_0x23e7d3(++_0x17f58e);}(_0xd200,0x7d));var _0x0d20=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xd200[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require(_0x0d20('0x0'));var emlformat=require(_0x0d20('0x1'));var rimraf=require(_0x0d20('0x2'));var zipdir=require(_0x0d20('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d20('0x4'));var moment=require(_0x0d20('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0d20('0x6'));var util=require('util');var path=require(_0x0d20('0x7'));var sox=require(_0x0d20('0x8'));var csv=require(_0x0d20('0x9'));var ejs=require(_0x0d20('0xa'));var fs=require('fs');var _=require(_0x0d20('0xb'));var squel=require(_0x0d20('0xc'));var crypto=require('crypto');var jsforce=require(_0x0d20('0xd'));var deskjs=require(_0x0d20('0xe'));var toCsv=require(_0x0d20('0x9'));var querystring=require(_0x0d20('0xf'));var Papa=require(_0x0d20('0x10'));var Redis=require(_0x0d20('0x11'));var authService=require(_0x0d20('0x12'));var qs=require(_0x0d20('0x13'));var as=require(_0x0d20('0x14'));var hardwareService=require(_0x0d20('0x15'));var logger=require(_0x0d20('0x16'))(_0x0d20('0x17'));var utils=require(_0x0d20('0x18'));var config=require(_0x0d20('0x19'));var db=require(_0x0d20('0x1a'))['db'];function respondWithStatusCode(_0x294b9c,_0xfccf55){_0xfccf55=_0xfccf55||0xcc;return function(_0x3c45c4){if(_0x3c45c4){return _0x294b9c[_0x0d20('0x1b')](_0xfccf55);}return _0x294b9c[_0x0d20('0x1c')](_0xfccf55)[_0x0d20('0x1d')]();};}function respondWithResult(_0xf41aae,_0x597447){_0x597447=_0x597447||0xc8;return function(_0x28076c){if(_0x28076c){return _0xf41aae['status'](_0x597447)[_0x0d20('0x1e')](_0x28076c);}};}function respondWithFilteredResult(_0x467e2a,_0x54e1f4){return function(_0x4e4127){if(_0x4e4127){var _0x35fdaf=_0x4e4127[_0x0d20('0x1f')],_0x579b0d=_0x54e1f4[_0x0d20('0x20')],_0x33bbd1=_0x54e1f4[_0x0d20('0x20')]+_0x54e1f4['limit'],_0x45da8d;if(_0x33bbd1>=_0x35fdaf){_0x33bbd1=_0x35fdaf;_0x45da8d=0xc8;}else{_0x45da8d=0xce;}_0x467e2a['status'](_0x45da8d);return _0x467e2a[_0x0d20('0x21')]('Content-Range',_0x579b0d+'-'+_0x33bbd1+'/'+_0x35fdaf)['json'](_0x4e4127);}return null;};}function patchUpdates(_0x542aeb){return function(_0x2dd718){try{jsonpatch[_0x0d20('0x22')](_0x2dd718,_0x542aeb,!![]);}catch(_0x55c4ba){return BPromise['reject'](_0x55c4ba);}return _0x2dd718['save']();};}function saveUpdates(_0x326ce2,_0x33e8f5){return function(_0x5e1bf5){if(_0x5e1bf5){return _0x5e1bf5['update'](_0x326ce2)['then'](function(_0x5e73bf){return _0x5e73bf;});}return null;};}function removeEntity(_0x29eb1a,_0x194842){return function(_0x38f1c4){if(_0x38f1c4){return _0x38f1c4[_0x0d20('0x23')]()[_0x0d20('0x24')](function(){_0x29eb1a[_0x0d20('0x1c')](0xcc)[_0x0d20('0x1d')]();});}};}function handleEntityNotFound(_0x4c673a,_0x522b46){return function(_0xe4c24b){if(!_0xe4c24b){_0x4c673a[_0x0d20('0x1b')](0x194);}return _0xe4c24b;};}function handleError(_0xc45c08,_0x11f524){_0x11f524=_0x11f524||0x1f4;return function(_0x4e5562){logger[_0x0d20('0x25')](_0x4e5562[_0x0d20('0x26')]);if(_0x4e5562[_0x0d20('0x27')]){delete _0x4e5562['name'];}_0xc45c08[_0x0d20('0x1c')](_0x11f524)['send'](_0x4e5562);};}exports[_0x0d20('0x28')]=function(_0x565ec3,_0x2a9cc9){var _0x570add={},_0x257e88={},_0xc822e0={'count':0x0,'rows':[]};var _0xa55046=_[_0x0d20('0x29')](db[_0x0d20('0x2a')][_0x0d20('0x2b')],function(_0x1d9138){return{'name':_0x1d9138[_0x0d20('0x2c')],'type':_0x1d9138[_0x0d20('0x2d')][_0x0d20('0x2e')]};});_0x257e88[_0x0d20('0x2f')]=_['map'](_0xa55046,_0x0d20('0x27'));_0x257e88[_0x0d20('0x30')]=_[_0x0d20('0x31')](_0x565ec3[_0x0d20('0x30')]);_0x257e88['filters']=_[_0x0d20('0x32')](_0x257e88['model'],_0x257e88[_0x0d20('0x30')]);_0x570add[_0x0d20('0x33')]=_[_0x0d20('0x32')](_0x257e88[_0x0d20('0x2f')],qs[_0x0d20('0x34')](_0x565ec3['query'][_0x0d20('0x34')]));_0x570add[_0x0d20('0x33')]=_0x570add[_0x0d20('0x33')][_0x0d20('0x35')]?_0x570add[_0x0d20('0x33')]:_0x257e88[_0x0d20('0x2f')];if(!_0x565ec3[_0x0d20('0x30')][_0x0d20('0x36')](_0x0d20('0x37'))){_0x570add[_0x0d20('0x38')]=qs[_0x0d20('0x38')](_0x565ec3[_0x0d20('0x30')]['limit']);_0x570add['offset']=qs[_0x0d20('0x20')](_0x565ec3[_0x0d20('0x30')][_0x0d20('0x20')]);}_0x570add['order']=qs['sort'](_0x565ec3['query']['sort']);_0x570add['where']=qs[_0x0d20('0x39')](_['pick'](_0x565ec3['query'],_0x257e88[_0x0d20('0x39')]),_0xa55046);if(_0x565ec3[_0x0d20('0x30')][_0x0d20('0x3a')]){_0x570add[_0x0d20('0x3b')]=_[_0x0d20('0x3c')](_0x570add[_0x0d20('0x3b')],{'$or':_['map'](_0xa55046,function(_0x51c662){if(_0x51c662[_0x0d20('0x2d')]!==_0x0d20('0x3d')){var _0x3a5c25={};_0x3a5c25[_0x51c662['name']]={'$like':'%'+_0x565ec3[_0x0d20('0x30')][_0x0d20('0x3a')]+'%'};return _0x3a5c25;}})});}_0x570add=_[_0x0d20('0x3c')]({},_0x570add,_0x565ec3[_0x0d20('0x3e')]);var _0x409571={'where':_0x570add['where']};return db[_0x0d20('0x2a')][_0x0d20('0x1f')](_0x409571)[_0x0d20('0x24')](function(_0x5f5280){_0xc822e0[_0x0d20('0x1f')]=_0x5f5280;if(_0x565ec3['query'][_0x0d20('0x3f')]){_0x570add[_0x0d20('0x40')]=[{'all':!![]}];}return db['UserProfileSection'][_0x0d20('0x41')](_0x570add);})['then'](function(_0x4a159a){_0xc822e0[_0x0d20('0x42')]=_0x4a159a;return _0xc822e0;})['then'](respondWithFilteredResult(_0x2a9cc9,_0x570add))[_0x0d20('0x43')](handleError(_0x2a9cc9,null));};exports[_0x0d20('0x44')]=function(_0x5c9cb7,_0x222c6c){var _0x10fea6={'raw':![],'where':{'id':_0x5c9cb7[_0x0d20('0x45')]['id']}},_0x4f3dc5={};_0x4f3dc5[_0x0d20('0x2f')]=_[_0x0d20('0x31')](db['UserProfileSection'][_0x0d20('0x2b')]);_0x4f3dc5[_0x0d20('0x30')]=_[_0x0d20('0x31')](_0x5c9cb7[_0x0d20('0x30')]);_0x4f3dc5[_0x0d20('0x39')]=_[_0x0d20('0x32')](_0x4f3dc5[_0x0d20('0x2f')],_0x4f3dc5[_0x0d20('0x30')]);_0x10fea6[_0x0d20('0x33')]=_['intersection'](_0x4f3dc5[_0x0d20('0x2f')],qs[_0x0d20('0x34')](_0x5c9cb7['query'][_0x0d20('0x34')]));_0x10fea6['attributes']=_0x10fea6[_0x0d20('0x33')][_0x0d20('0x35')]?_0x10fea6[_0x0d20('0x33')]:_0x4f3dc5['model'];if(_0x5c9cb7[_0x0d20('0x30')][_0x0d20('0x3f')]){_0x10fea6['include']=[{'all':!![]}];}_0x10fea6=_[_0x0d20('0x3c')]({},_0x10fea6,_0x5c9cb7[_0x0d20('0x3e')]);return db[_0x0d20('0x2a')][_0x0d20('0x46')](_0x10fea6)[_0x0d20('0x24')](handleEntityNotFound(_0x222c6c,null))['then'](respondWithResult(_0x222c6c,null))[_0x0d20('0x43')](handleError(_0x222c6c,null));};exports[_0x0d20('0x47')]=function(_0xe37d6b,_0x24a80c){return db[_0x0d20('0x2a')][_0x0d20('0x47')](_0xe37d6b[_0x0d20('0x48')],{})[_0x0d20('0x24')](respondWithResult(_0x24a80c,0xc9))[_0x0d20('0x43')](handleError(_0x24a80c,null));};exports[_0x0d20('0x49')]=function(_0x105936,_0x4fd697){if(_0x105936['body']['id']){delete _0x105936[_0x0d20('0x48')]['id'];}return db[_0x0d20('0x2a')][_0x0d20('0x46')]({'where':{'id':_0x105936[_0x0d20('0x45')]['id']}})[_0x0d20('0x24')](handleEntityNotFound(_0x4fd697,null))['then'](saveUpdates(_0x105936[_0x0d20('0x48')],null))['then'](respondWithResult(_0x4fd697,null))[_0x0d20('0x43')](handleError(_0x4fd697,null));};exports[_0x0d20('0x23')]=function(_0x519d3e,_0x3c6f6a){return db[_0x0d20('0x2a')]['find']({'where':{'id':_0x519d3e[_0x0d20('0x45')]['id']}})[_0x0d20('0x24')](handleEntityNotFound(_0x3c6f6a,null))[_0x0d20('0x24')](removeEntity(_0x3c6f6a,null))[_0x0d20('0x43')](handleError(_0x3c6f6a,null));};exports[_0x0d20('0x4a')]=function(_0x14c8a2,_0x458328){return db['UserProfileSection'][_0x0d20('0x4a')]()['then'](respondWithResult(_0x458328,null))[_0x0d20('0x43')](handleError(_0x458328,null));}; \ No newline at end of file +var _0xed8c=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','merge','where','filter','UserProfileSection','includeAll','findAll','rows','show','params','length','include','options','find','create','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','count','offset','set','json','reject','save','update','then','destroy','status','stack','name','send','map','rawAttributes','fieldName','type','query','keys'];(function(_0xe56fcb,_0x42f237){var _0x6037c7=function(_0x489ccf){while(--_0x489ccf){_0xe56fcb['push'](_0xe56fcb['shift']());}};_0x6037c7(++_0x42f237);}(_0xed8c,0x64));var _0xced8=function(_0x32d36b,_0x2a5044){_0x32d36b=_0x32d36b-0x0;var _0x261c3c=_0xed8c[_0x32d36b];return _0x261c3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xced8('0x0'));var rimraf=require(_0xced8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xced8('0x2'));var rp=require(_0xced8('0x3'));var moment=require(_0xced8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xced8('0x5'));var util=require(_0xced8('0x6'));var path=require(_0xced8('0x7'));var sox=require(_0xced8('0x8'));var csv=require(_0xced8('0x9'));var ejs=require(_0xced8('0xa'));var fs=require('fs');var _=require(_0xced8('0xb'));var squel=require(_0xced8('0xc'));var crypto=require(_0xced8('0xd'));var jsforce=require(_0xced8('0xe'));var deskjs=require(_0xced8('0xf'));var toCsv=require(_0xced8('0x9'));var querystring=require('querystring');var Papa=require(_0xced8('0x10'));var Redis=require(_0xced8('0x11'));var authService=require(_0xced8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xced8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced8('0x14'))(_0xced8('0x15'));var utils=require(_0xced8('0x16'));var config=require(_0xced8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a8756,_0x249f6b){_0x249f6b=_0x249f6b||0xcc;return function(_0x235e7d){if(_0x235e7d){return _0x3a8756[_0xced8('0x18')](_0x249f6b);}return _0x3a8756['status'](_0x249f6b)['end']();};}function respondWithResult(_0x474426,_0x4dc722){_0x4dc722=_0x4dc722||0xc8;return function(_0x3e1f5e){if(_0x3e1f5e){return _0x474426['status'](_0x4dc722)['json'](_0x3e1f5e);}};}function respondWithFilteredResult(_0x2397b5,_0x32b2b8){return function(_0x13a15d){if(_0x13a15d){var _0x454728=_0x13a15d[_0xced8('0x19')],_0x525381=_0x32b2b8[_0xced8('0x1a')],_0x1de61b=_0x32b2b8[_0xced8('0x1a')]+_0x32b2b8['limit'],_0x2abb98;if(_0x1de61b>=_0x454728){_0x1de61b=_0x454728;_0x2abb98=0xc8;}else{_0x2abb98=0xce;}_0x2397b5['status'](_0x2abb98);return _0x2397b5[_0xced8('0x1b')]('Content-Range',_0x525381+'-'+_0x1de61b+'/'+_0x454728)[_0xced8('0x1c')](_0x13a15d);}return null;};}function patchUpdates(_0xea88b1){return function(_0xb4e62a){try{jsonpatch['apply'](_0xb4e62a,_0xea88b1,!![]);}catch(_0x4c67fc){return BPromise[_0xced8('0x1d')](_0x4c67fc);}return _0xb4e62a[_0xced8('0x1e')]();};}function saveUpdates(_0x192715,_0xcd03ab){return function(_0x5ab2d4){if(_0x5ab2d4){return _0x5ab2d4[_0xced8('0x1f')](_0x192715)[_0xced8('0x20')](function(_0x73a08){return _0x73a08;});}return null;};}function removeEntity(_0x555856,_0x289777){return function(_0x44a94e){if(_0x44a94e){return _0x44a94e[_0xced8('0x21')]()[_0xced8('0x20')](function(){_0x555856[_0xced8('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb7743,_0x5d0794){return function(_0x26ce56){if(!_0x26ce56){_0xdb7743[_0xced8('0x18')](0x194);}return _0x26ce56;};}function handleError(_0x3baca5,_0x111381){_0x111381=_0x111381||0x1f4;return function(_0x338cf2){logger['error'](_0x338cf2[_0xced8('0x23')]);if(_0x338cf2[_0xced8('0x24')]){delete _0x338cf2[_0xced8('0x24')];}_0x3baca5['status'](_0x111381)[_0xced8('0x25')](_0x338cf2);};}exports['index']=function(_0x223d04,_0xdb6325){var _0x569ccf={},_0x4db3b6={},_0x48eef3={'count':0x0,'rows':[]};var _0x578a66=_[_0xced8('0x26')](db['UserProfileSection'][_0xced8('0x27')],function(_0x3918dc){return{'name':_0x3918dc[_0xced8('0x28')],'type':_0x3918dc[_0xced8('0x29')]['key']};});_0x4db3b6['model']=_[_0xced8('0x26')](_0x578a66,_0xced8('0x24'));_0x4db3b6[_0xced8('0x2a')]=_[_0xced8('0x2b')](_0x223d04[_0xced8('0x2a')]);_0x4db3b6[_0xced8('0x2c')]=_[_0xced8('0x2d')](_0x4db3b6[_0xced8('0x2e')],_0x4db3b6[_0xced8('0x2a')]);_0x569ccf[_0xced8('0x2f')]=_['intersection'](_0x4db3b6[_0xced8('0x2e')],qs[_0xced8('0x30')](_0x223d04[_0xced8('0x2a')]['fields']));_0x569ccf[_0xced8('0x2f')]=_0x569ccf[_0xced8('0x2f')]['length']?_0x569ccf[_0xced8('0x2f')]:_0x4db3b6[_0xced8('0x2e')];if(!_0x223d04[_0xced8('0x2a')][_0xced8('0x31')](_0xced8('0x32'))){_0x569ccf[_0xced8('0x33')]=qs[_0xced8('0x33')](_0x223d04[_0xced8('0x2a')]['limit']);_0x569ccf['offset']=qs[_0xced8('0x1a')](_0x223d04[_0xced8('0x2a')]['offset']);}_0x569ccf[_0xced8('0x34')]=qs[_0xced8('0x35')](_0x223d04['query'][_0xced8('0x35')]);_0x569ccf['where']=qs[_0xced8('0x2c')](_[_0xced8('0x36')](_0x223d04[_0xced8('0x2a')],_0x4db3b6['filters']),_0x578a66);if(_0x223d04[_0xced8('0x2a')]['filter']){_0x569ccf['where']=_[_0xced8('0x37')](_0x569ccf[_0xced8('0x38')],{'$or':_[_0xced8('0x26')](_0x578a66,function(_0xb8c945){if(_0xb8c945[_0xced8('0x29')]!=='VIRTUAL'){var _0x37583a={};_0x37583a[_0xb8c945['name']]={'$like':'%'+_0x223d04[_0xced8('0x2a')][_0xced8('0x39')]+'%'};return _0x37583a;}})});}_0x569ccf=_[_0xced8('0x37')]({},_0x569ccf,_0x223d04['options']);var _0x3e26ad={'where':_0x569ccf[_0xced8('0x38')]};return db[_0xced8('0x3a')][_0xced8('0x19')](_0x3e26ad)['then'](function(_0x4dedbd){_0x48eef3[_0xced8('0x19')]=_0x4dedbd;if(_0x223d04[_0xced8('0x2a')][_0xced8('0x3b')]){_0x569ccf['include']=[{'all':!![]}];}return db[_0xced8('0x3a')][_0xced8('0x3c')](_0x569ccf);})[_0xced8('0x20')](function(_0xb3502c){_0x48eef3[_0xced8('0x3d')]=_0xb3502c;return _0x48eef3;})[_0xced8('0x20')](respondWithFilteredResult(_0xdb6325,_0x569ccf))['catch'](handleError(_0xdb6325,null));};exports[_0xced8('0x3e')]=function(_0x3dbd5d,_0x5ea098){var _0x4dd1c2={'raw':![],'where':{'id':_0x3dbd5d[_0xced8('0x3f')]['id']}},_0x45657b={};_0x45657b[_0xced8('0x2e')]=_['keys'](db['UserProfileSection']['rawAttributes']);_0x45657b[_0xced8('0x2a')]=_[_0xced8('0x2b')](_0x3dbd5d[_0xced8('0x2a')]);_0x45657b[_0xced8('0x2c')]=_['intersection'](_0x45657b[_0xced8('0x2e')],_0x45657b[_0xced8('0x2a')]);_0x4dd1c2[_0xced8('0x2f')]=_['intersection'](_0x45657b[_0xced8('0x2e')],qs[_0xced8('0x30')](_0x3dbd5d[_0xced8('0x2a')][_0xced8('0x30')]));_0x4dd1c2[_0xced8('0x2f')]=_0x4dd1c2[_0xced8('0x2f')][_0xced8('0x40')]?_0x4dd1c2[_0xced8('0x2f')]:_0x45657b['model'];if(_0x3dbd5d['query'][_0xced8('0x3b')]){_0x4dd1c2[_0xced8('0x41')]=[{'all':!![]}];}_0x4dd1c2=_['merge']({},_0x4dd1c2,_0x3dbd5d[_0xced8('0x42')]);return db['UserProfileSection'][_0xced8('0x43')](_0x4dd1c2)[_0xced8('0x20')](handleEntityNotFound(_0x5ea098,null))[_0xced8('0x20')](respondWithResult(_0x5ea098,null))['catch'](handleError(_0x5ea098,null));};exports['create']=function(_0x31e3e0,_0x25bea5){return db[_0xced8('0x3a')][_0xced8('0x44')](_0x31e3e0['body'],{})['then'](respondWithResult(_0x25bea5,0xc9))[_0xced8('0x45')](handleError(_0x25bea5,null));};exports[_0xced8('0x1f')]=function(_0x58a820,_0x40a82d){if(_0x58a820[_0xced8('0x46')]['id']){delete _0x58a820['body']['id'];}return db['UserProfileSection'][_0xced8('0x43')]({'where':{'id':_0x58a820[_0xced8('0x3f')]['id']}})[_0xced8('0x20')](handleEntityNotFound(_0x40a82d,null))[_0xced8('0x20')](saveUpdates(_0x58a820[_0xced8('0x46')],null))['then'](respondWithResult(_0x40a82d,null))['catch'](handleError(_0x40a82d,null));};exports[_0xced8('0x21')]=function(_0x220c22,_0x340bbb){return db['UserProfileSection'][_0xced8('0x43')]({'where':{'id':_0x220c22[_0xced8('0x3f')]['id']}})[_0xced8('0x20')](handleEntityNotFound(_0x340bbb,null))[_0xced8('0x20')](removeEntity(_0x340bbb,null))['catch'](handleError(_0x340bbb,null));};exports[_0xced8('0x47')]=function(_0x281a3a,_0x10ca5e){return db['UserProfileSection']['describe']()[_0xced8('0x20')](respondWithResult(_0x10ca5e,null))[_0xced8('0x45')](handleError(_0x10ca5e,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ed4a235..9028180 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 _0x5f30=['moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger'];(function(_0x16adf0,_0x393b27){var _0xa14ae4=function(_0x5b1aa0){while(--_0x5b1aa0){_0x16adf0['push'](_0x16adf0['shift']());}};_0xa14ae4(++_0x393b27);}(_0x5f30,0x1eb));var _0x05f3=function(_0x59dcb6,_0x5ce72e){_0x59dcb6=_0x59dcb6-0x0;var _0x47d643=_0x5f30[_0x59dcb6];return _0x47d643;};'use strict';var _=require(_0x05f3('0x0'));var util=require(_0x05f3('0x1'));var logger=require(_0x05f3('0x2'))('api');var moment=require(_0x05f3('0x3'));var BPromise=require(_0x05f3('0x4'));var rp=require(_0x05f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05f3('0x6'));var config=require(_0x05f3('0x7'));var attributes=require(_0x05f3('0x8'));module['exports']=function(_0x324e03,_0x544cf2){return _0x324e03['define'](_0x05f3('0x9'),attributes,{'tableName':_0x05f3('0xa'),'paranoid':![],'indexes':[{'name':_0x05f3('0xb'),'fields':['sectionId',_0x05f3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7bc4=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7bc4,0x1ed));var _0x47bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bc4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x47bc('0x0'));var util=require(_0x47bc('0x1'));var logger=require(_0x47bc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x47bc('0x3'));var rp=require(_0x47bc('0x4'));var fs=require('fs');var path=require(_0x47bc('0x5'));var rimraf=require(_0x47bc('0x6'));var config=require(_0x47bc('0x7'));var attributes=require(_0x47bc('0x8'));module[_0x47bc('0x9')]=function(_0x4c7657,_0x1a5c5f){return _0x4c7657[_0x47bc('0xa')](_0x47bc('0xb'),attributes,{'tableName':_0x47bc('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x47bc('0xd'),_0x47bc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c34f553..befc620 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 _0xd8f3=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x11f226,_0x491e30){var _0x30be77=function(_0x2049bd){while(--_0x2049bd){_0x11f226['push'](_0x11f226['shift']());}};_0x30be77(++_0x491e30);}(_0xd8f3,0xc4));var _0x3d8f=function(_0xb18520,_0x86cc57){_0xb18520=_0xb18520-0x0;var _0x260f4d=_0xd8f3[_0xb18520];return _0x260f4d;};'use strict';var _=require(_0x3d8f('0x0'));var util=require(_0x3d8f('0x1'));var moment=require(_0x3d8f('0x2'));var BPromise=require(_0x3d8f('0x3'));var rs=require(_0x3d8f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d8f('0x5'));var logger=require(_0x3d8f('0x6'))(_0x3d8f('0x7'));var config=require(_0x3d8f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3d8f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bd6b2,_0x567bc6,_0x2c98a0){return new BPromise(function(_0x2be605,_0x157b64){return client['request'](_0x1bd6b2,_0x2c98a0)[_0x3d8f('0xa')](function(_0x1e4c32){logger[_0x3d8f('0xb')](_0x3d8f('0xc'),_0x567bc6,_0x3d8f('0xd'));logger[_0x3d8f('0xe')](_0x3d8f('0xf'),_0x567bc6,'request\x20sent',JSON[_0x3d8f('0x10')](_0x1e4c32));if(_0x1e4c32[_0x3d8f('0x11')]){if(_0x1e4c32['error']['code']===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x567bc6,_0x1e4c32[_0x3d8f('0x11')]['message']);return _0x157b64(_0x1e4c32[_0x3d8f('0x11')][_0x3d8f('0x12')]);}logger[_0x3d8f('0x11')](_0x3d8f('0xc'),_0x567bc6,_0x1e4c32[_0x3d8f('0x11')][_0x3d8f('0x12')]);return _0x2be605(_0x1e4c32[_0x3d8f('0x11')]['message']);}else{logger[_0x3d8f('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x567bc6,_0x3d8f('0xd'));_0x2be605(_0x1e4c32[_0x3d8f('0x13')][_0x3d8f('0x12')]);}})[_0x3d8f('0x14')](function(_0x28e7e6){logger[_0x3d8f('0x11')](_0x3d8f('0xc'),_0x567bc6,_0x28e7e6);_0x157b64(_0x28e7e6);});});} \ No newline at end of file +var _0xb71c=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error'];(function(_0x406dfd,_0x3b48cb){var _0x5a9101=function(_0x11cd9e){while(--_0x11cd9e){_0x406dfd['push'](_0x406dfd['shift']());}};_0x5a9101(++_0x3b48cb);}(_0xb71c,0x174));var _0xcb71=function(_0x2d3d24,_0x460bbe){_0x2d3d24=_0x2d3d24-0x0;var _0x848554=_0xb71c[_0x2d3d24];return _0x848554;};'use strict';var _=require(_0xcb71('0x0'));var util=require(_0xcb71('0x1'));var moment=require(_0xcb71('0x2'));var BPromise=require(_0xcb71('0x3'));var rs=require(_0xcb71('0x4'));var fs=require('fs');var Redis=require(_0xcb71('0x5'));var db=require(_0xcb71('0x6'))['db'];var utils=require(_0xcb71('0x7'));var logger=require(_0xcb71('0x8'))(_0xcb71('0x9'));var config=require('../../config/environment');var jayson=require(_0xcb71('0xa'));var client=jayson[_0xcb71('0xb')][_0xcb71('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23cceb,_0x21803e,_0x4e5886){return new BPromise(function(_0x29b258,_0x316dbc){return client['request'](_0x23cceb,_0x4e5886)[_0xcb71('0xd')](function(_0x50dc4c){logger['info'](_0xcb71('0xe'),_0x21803e,_0xcb71('0xf'));logger[_0xcb71('0x10')](_0xcb71('0x11'),_0x21803e,'request\x20sent',JSON['stringify'](_0x50dc4c));if(_0x50dc4c[_0xcb71('0x12')]){if(_0x50dc4c[_0xcb71('0x12')][_0xcb71('0x13')]===0x1f4){logger[_0xcb71('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x21803e,_0x50dc4c['error']['message']);return _0x316dbc(_0x50dc4c[_0xcb71('0x12')][_0xcb71('0x14')]);}logger[_0xcb71('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x21803e,_0x50dc4c[_0xcb71('0x12')][_0xcb71('0x14')]);return _0x29b258(_0x50dc4c['error'][_0xcb71('0x14')]);}else{logger[_0xcb71('0x15')](_0xcb71('0xe'),_0x21803e,_0xcb71('0xf'));_0x29b258(_0x50dc4c[_0xcb71('0x16')][_0xcb71('0x14')]);}})['catch'](function(_0x42208c){logger[_0xcb71('0x12')](_0xcb71('0xe'),_0x21803e,_0x42208c);_0x316dbc(_0x42208c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 13c4e0b..a57c976 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 _0xbffc=['../../config/environment','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3a804e,_0x108e9b){var _0x335529=function(_0xebf6d1){while(--_0xebf6d1){_0x3a804e['push'](_0x3a804e['shift']());}};_0x335529(++_0x108e9b);}(_0xbffc,0x172));var _0xcbff=function(_0xfa2f9b,_0x230c4f){_0xfa2f9b=_0xfa2f9b-0x0;var _0x2d007c=_0xbffc[_0xfa2f9b];return _0x2d007c;};'use strict';var multer=require('multer');var util=require(_0xcbff('0x0'));var path=require(_0xcbff('0x1'));var timeout=require(_0xcbff('0x2'));var express=require(_0xcbff('0x3'));var router=express[_0xcbff('0x4')]();var auth=require(_0xcbff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcbff('0x6'));module[_0xcbff('0x7')]=router; \ No newline at end of file +var _0x32dd=['Router','../../components/auth/service','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x32dd,0xbb));var _0xd32d=function(_0x40e00e,_0xe3ddfa){_0x40e00e=_0x40e00e-0x0;var _0x1050de=_0x32dd[_0x40e00e];return _0x1050de;};'use strict';var multer=require(_0xd32d('0x0'));var util=require(_0xd32d('0x1'));var path=require(_0xd32d('0x2'));var timeout=require(_0xd32d('0x3'));var express=require(_0xd32d('0x4'));var router=express[_0xd32d('0x5')]();var auth=require(_0xd32d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd32d('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index d3f034e..c92d938 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x406948,_0xad6754){var _0x506eb5=function(_0xfbfa9a){while(--_0xfbfa9a){_0x406948['push'](_0x406948['shift']());}};_0x506eb5(++_0xad6754);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x5e89d8,_0x30a21a){var _0x5c1153=function(_0x2dcba0){while(--_0x2dcba0){_0x5e89d8['push'](_0x5e89d8['shift']());}};_0x5c1153(++_0x30a21a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index ff8df2a..d3ff5db 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 _0xc961=['exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x20b741,_0xf30bc5){var _0x2f75bd=function(_0x5963cc){while(--_0x5963cc){_0x20b741['push'](_0x20b741['shift']());}};_0x2f75bd(++_0xf30bc5);}(_0xc961,0x17a));var _0x1c96=function(_0x494fa2,_0x84b5d8){_0x494fa2=_0x494fa2-0x0;var _0xf013c7=_0xc961[_0x494fa2];return _0xf013c7;};'use strict';var _=require(_0x1c96('0x0'));var util=require(_0x1c96('0x1'));var logger=require(_0x1c96('0x2'))(_0x1c96('0x3'));var moment=require(_0x1c96('0x4'));var BPromise=require(_0x1c96('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1c96('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x1c96('0x7')]=function(_0x5594ee,_0x19d78b){return _0x5594ee[_0x1c96('0x8')](_0x1c96('0x9'),attributes,{'tableName':_0x1c96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x292b=['rimraf','../../config/environment','define','UserSmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3ee351,_0x1b40c0){var _0x44364a=function(_0x1af16c){while(--_0x1af16c){_0x3ee351['push'](_0x3ee351['shift']());}};_0x44364a(++_0x1b40c0);}(_0x292b,0x64));var _0xb292=function(_0x19ad7b,_0x2ae8fa){_0x19ad7b=_0x19ad7b-0x0;var _0x8a0f00=_0x292b[_0x19ad7b];return _0x8a0f00;};'use strict';var _=require(_0xb292('0x0'));var util=require(_0xb292('0x1'));var logger=require(_0xb292('0x2'))(_0xb292('0x3'));var moment=require(_0xb292('0x4'));var BPromise=require(_0xb292('0x5'));var rp=require(_0xb292('0x6'));var fs=require('fs');var path=require(_0xb292('0x7'));var rimraf=require(_0xb292('0x8'));var config=require(_0xb292('0x9'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x4d2ef0,_0x13ffef){return _0x4d2ef0[_0xb292('0xa')](_0xb292('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index c3fa241..f7c6a83 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 _0x373b=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x355775,_0x125dc7){var _0x28b602=function(_0x3faf49){while(--_0x3faf49){_0x355775['push'](_0x355775['shift']());}};_0x28b602(++_0x125dc7);}(_0x373b,0x1e5));var _0xb373=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x373b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xb373('0x0'));var util=require(_0xb373('0x1'));var moment=require(_0xb373('0x2'));var BPromise=require(_0xb373('0x3'));var rs=require(_0xb373('0x4'));var fs=require('fs');var Redis=require(_0xb373('0x5'));var db=require(_0xb373('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb373('0x7'))(_0xb373('0x8'));var config=require(_0xb373('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb373('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4628c7,_0x48f5e5,_0xf4c680){return new BPromise(function(_0x56478f,_0xd5de5b){return client['request'](_0x4628c7,_0xf4c680)[_0xb373('0xb')](function(_0x1df541){logger[_0xb373('0xc')](_0xb373('0xd'),_0x48f5e5,_0xb373('0xe'));logger[_0xb373('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x48f5e5,_0xb373('0xe'),JSON['stringify'](_0x1df541));if(_0x1df541[_0xb373('0x10')]){if(_0x1df541['error'][_0xb373('0x11')]===0x1f4){logger['error'](_0xb373('0xd'),_0x48f5e5,_0x1df541[_0xb373('0x10')]['message']);return _0xd5de5b(_0x1df541['error']['message']);}logger[_0xb373('0x10')](_0xb373('0xd'),_0x48f5e5,_0x1df541[_0xb373('0x10')][_0xb373('0x12')]);return _0x56478f(_0x1df541[_0xb373('0x10')]['message']);}else{logger[_0xb373('0xc')](_0xb373('0xd'),_0x48f5e5,_0xb373('0xe'));_0x56478f(_0x1df541[_0xb373('0x13')][_0xb373('0x12')]);}})[_0xb373('0x14')](function(_0x58d770){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x48f5e5,_0x58d770);_0xd5de5b(_0x58d770);});});} \ No newline at end of file +var _0x96fc=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x3f5100,_0x2b4fef){var _0x32dea2=function(_0x37e48b){while(--_0x37e48b){_0x3f5100['push'](_0x3f5100['shift']());}};_0x32dea2(++_0x2b4fef);}(_0x96fc,0x169));var _0xc96f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x96fc[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc96f('0x0'));var util=require(_0xc96f('0x1'));var moment=require(_0xc96f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc96f('0x3'));var fs=require('fs');var Redis=require(_0xc96f('0x4'));var db=require(_0xc96f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc96f('0x6'))('rpc');var config=require(_0xc96f('0x7'));var jayson=require(_0xc96f('0x8'));var client=jayson[_0xc96f('0x9')][_0xc96f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1baf5a,_0x2b7d88,_0x87fd4b){return new BPromise(function(_0x2495f3,_0x564bb4){return client[_0xc96f('0xb')](_0x1baf5a,_0x87fd4b)['then'](function(_0x30ef83){logger[_0xc96f('0xc')](_0xc96f('0xd'),_0x2b7d88,_0xc96f('0xe'));logger[_0xc96f('0xf')](_0xc96f('0x10'),_0x2b7d88,_0xc96f('0xe'),JSON[_0xc96f('0x11')](_0x30ef83));if(_0x30ef83[_0xc96f('0x12')]){if(_0x30ef83[_0xc96f('0x12')][_0xc96f('0x13')]===0x1f4){logger[_0xc96f('0x12')](_0xc96f('0xd'),_0x2b7d88,_0x30ef83[_0xc96f('0x12')][_0xc96f('0x14')]);return _0x564bb4(_0x30ef83['error']['message']);}logger['error'](_0xc96f('0xd'),_0x2b7d88,_0x30ef83[_0xc96f('0x12')][_0xc96f('0x14')]);return _0x2495f3(_0x30ef83['error']['message']);}else{logger[_0xc96f('0xc')](_0xc96f('0xd'),_0x2b7d88,'request\x20sent');_0x2495f3(_0x30ef83['result']['message']);}})[_0xc96f('0x15')](function(_0x1cc28e){logger[_0xc96f('0x12')](_0xc96f('0xd'),_0x2b7d88,_0x1cc28e);_0x564bb4(_0x1cc28e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index eb7951b..58aa074 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 _0x6560=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0xb5b7f4,_0x590772){var _0x123237=function(_0x1b8718){while(--_0x1b8718){_0xb5b7f4['push'](_0xb5b7f4['shift']());}};_0x123237(++_0x590772);}(_0x6560,0x162));var _0x0656=function(_0x3e98b7,_0x3f93e0){_0x3e98b7=_0x3e98b7-0x0;var _0x2fbd43=_0x6560[_0x3e98b7];return _0x2fbd43;};'use strict';var multer=require(_0x0656('0x0'));var util=require(_0x0656('0x1'));var path=require(_0x0656('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0656('0x3')]();var auth=require(_0x0656('0x4'));var interaction=require(_0x0656('0x5'));var config=require(_0x0656('0x6'));module['exports']=router; \ No newline at end of file +var _0xdf83=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x28510d,_0x1bdffe){var _0x4d9d2=function(_0x53b08b){while(--_0x53b08b){_0x28510d['push'](_0x28510d['shift']());}};_0x4d9d2(++_0x1bdffe);}(_0xdf83,0xe8));var _0x3df8=function(_0x2c3a47,_0x170687){_0x2c3a47=_0x2c3a47-0x0;var _0x1c04de=_0xdf83[_0x2c3a47];return _0x1c04de;};'use strict';var multer=require(_0x3df8('0x0'));var util=require('util');var path=require(_0x3df8('0x1'));var timeout=require(_0x3df8('0x2'));var express=require(_0x3df8('0x3'));var router=express['Router']();var auth=require(_0x3df8('0x4'));var interaction=require(_0x3df8('0x5'));var config=require('../../config/environment');module[_0x3df8('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 4dcf942..d516590 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x137f1a,_0x2887df){var _0x439923=function(_0x3d3075){while(--_0x3d3075){_0x137f1a['push'](_0x137f1a['shift']());}};_0x439923(++_0x2887df);}(_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 +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x387b84,_0x17c17b){var _0x572db8=function(_0x190d8c){while(--_0x190d8c){_0x387b84['push'](_0x387b84['shift']());}};_0x572db8(++_0x17c17b);}(_0xe706,0xa3));var _0x6e70=function(_0x2e5a17,_0x558f0e){_0x2e5a17=_0x2e5a17-0x0;var _0x24f53d=_0xe706[_0x2e5a17];return _0x24f53d;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 994f62e..a9a600a 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 _0x57b9=['moment','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x2d6944,_0x332a0f){var _0x51b198=function(_0x14ad2f){while(--_0x14ad2f){_0x2d6944['push'](_0x2d6944['shift']());}};_0x51b198(++_0x332a0f);}(_0x57b9,0x15b));var _0x957b=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x57b9[_0x172747];return _0x509692;};'use strict';var _=require(_0x957b('0x0'));var util=require(_0x957b('0x1'));var logger=require(_0x957b('0x2'))(_0x957b('0x3'));var moment=require(_0x957b('0x4'));var BPromise=require('bluebird');var rp=require(_0x957b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x957b('0x6'));var config=require(_0x957b('0x7'));var attributes=require(_0x957b('0x8'));module[_0x957b('0x9')]=function(_0x3f4149,_0x18ee57){return _0x3f4149[_0x957b('0xa')](_0x957b('0xb'),attributes,{'tableName':_0x957b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad42=['define','user_has_voice_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xad42,0xb6));var _0x2ad4=function(_0x3b075f,_0x58cb87){_0x3b075f=_0x3b075f-0x0;var _0x9cbb40=_0xad42[_0x3b075f];return _0x9cbb40;};'use strict';var _=require(_0x2ad4('0x0'));var util=require(_0x2ad4('0x1'));var logger=require(_0x2ad4('0x2'))('api');var moment=require(_0x2ad4('0x3'));var BPromise=require('bluebird');var rp=require(_0x2ad4('0x4'));var fs=require('fs');var path=require(_0x2ad4('0x5'));var rimraf=require(_0x2ad4('0x6'));var config=require(_0x2ad4('0x7'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x4ba45e,_0x4a1e3b){return _0x4ba45e[_0x2ad4('0x8')]('UserVoiceQueue',attributes,{'tableName':_0x2ad4('0x9'),'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 7502bc1..11ac1a6 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 _0x9da6=['stringify','error','message','catch','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1abd7d,_0x17e2d8){var _0x5923c6=function(_0x3df741){while(--_0x3df741){_0x1abd7d['push'](_0x1abd7d['shift']());}};_0x5923c6(++_0x17e2d8);}(_0x9da6,0xa6));var _0x69da=function(_0x59146b,_0x22b05c){_0x59146b=_0x59146b-0x0;var _0x5b1af8=_0x9da6[_0x59146b];return _0x5b1af8;};'use strict';var _=require('lodash');var util=require(_0x69da('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69da('0x1'))['db'];var utils=require(_0x69da('0x2'));var logger=require(_0x69da('0x3'))(_0x69da('0x4'));var config=require('../../config/environment');var jayson=require(_0x69da('0x5'));var client=jayson[_0x69da('0x6')][_0x69da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x126d33,_0x22d1fb,_0x5b2325){return new BPromise(function(_0xd27f05,_0x405163){return client['request'](_0x126d33,_0x5b2325)[_0x69da('0x8')](function(_0x4365da){logger[_0x69da('0x9')](_0x69da('0xa'),_0x22d1fb,_0x69da('0xb'));logger[_0x69da('0xc')](_0x69da('0xd'),_0x22d1fb,'request\x20sent',JSON[_0x69da('0xe')](_0x4365da));if(_0x4365da['error']){if(_0x4365da['error']['code']===0x1f4){logger[_0x69da('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x22d1fb,_0x4365da[_0x69da('0xf')][_0x69da('0x10')]);return _0x405163(_0x4365da[_0x69da('0xf')][_0x69da('0x10')]);}logger[_0x69da('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x22d1fb,_0x4365da[_0x69da('0xf')]['message']);return _0xd27f05(_0x4365da['error']['message']);}else{logger[_0x69da('0x9')](_0x69da('0xa'),_0x22d1fb,'request\x20sent');_0xd27f05(_0x4365da['result'][_0x69da('0x10')]);}})[_0x69da('0x11')](function(_0x339823){logger[_0x69da('0xf')](_0x69da('0xa'),_0x22d1fb,_0x339823);_0x405163(_0x339823);});});} \ No newline at end of file +var _0x9772=['http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x291f3e,_0x5e5ca1){var _0x21962c=function(_0x1f8c6a){while(--_0x1f8c6a){_0x291f3e['push'](_0x291f3e['shift']());}};_0x21962c(++_0x5e5ca1);}(_0x9772,0x175));var _0x2977=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9772[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x2977('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2977('0x1'));var db=require(_0x2977('0x2'))['db'];var utils=require(_0x2977('0x3'));var logger=require(_0x2977('0x4'))(_0x2977('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2977('0x6')][_0x2977('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x436e96,_0x39c50f,_0x48e753){return new BPromise(function(_0x5a3018,_0x43d233){return client[_0x2977('0x8')](_0x436e96,_0x48e753)[_0x2977('0x9')](function(_0x47f0e1){logger[_0x2977('0xa')](_0x2977('0xb'),_0x39c50f,_0x2977('0xc'));logger[_0x2977('0xd')](_0x2977('0xe'),_0x39c50f,_0x2977('0xc'),JSON[_0x2977('0xf')](_0x47f0e1));if(_0x47f0e1[_0x2977('0x10')]){if(_0x47f0e1[_0x2977('0x10')][_0x2977('0x11')]===0x1f4){logger[_0x2977('0x10')](_0x2977('0xb'),_0x39c50f,_0x47f0e1[_0x2977('0x10')][_0x2977('0x12')]);return _0x43d233(_0x47f0e1[_0x2977('0x10')][_0x2977('0x12')]);}logger['error'](_0x2977('0xb'),_0x39c50f,_0x47f0e1[_0x2977('0x10')][_0x2977('0x12')]);return _0x5a3018(_0x47f0e1[_0x2977('0x10')][_0x2977('0x12')]);}else{logger[_0x2977('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x39c50f,'request\x20sent');_0x5a3018(_0x47f0e1['result'][_0x2977('0x12')]);}})[_0x2977('0x13')](function(_0x2b0d92){logger[_0x2977('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x39c50f,_0x2b0d92);_0x43d233(_0x2b0d92);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e3b11fe..92dc7ea 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 _0x56ab=['../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x56ab,0x174));var _0xb56a=function(_0x577ce4,_0x4964b3){_0x577ce4=_0x577ce4-0x0;var _0x1eac2a=_0x56ab[_0x577ce4];return _0x1eac2a;};'use strict';var multer=require('multer');var util=require(_0xb56a('0x0'));var path=require(_0xb56a('0x1'));var timeout=require(_0xb56a('0x2'));var express=require(_0xb56a('0x3'));var router=express[_0xb56a('0x4')]();var auth=require(_0xb56a('0x5'));var interaction=require(_0xb56a('0x6'));var config=require(_0xb56a('0x7'));module[_0xb56a('0x8')]=router; \ No newline at end of file +var _0xad7b=['../../config/environment','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x46f748,_0x1209d5){var _0x3f82fd=function(_0xa24ad5){while(--_0xa24ad5){_0x46f748['push'](_0x46f748['shift']());}};_0x3f82fd(++_0x1209d5);}(_0xad7b,0xec));var _0xbad7=function(_0x731802,_0xc9d169){_0x731802=_0x731802-0x0;var _0x5cede5=_0xad7b[_0x731802];return _0x5cede5;};'use strict';var multer=require(_0xbad7('0x0'));var util=require(_0xbad7('0x1'));var path=require(_0xbad7('0x2'));var timeout=require(_0xbad7('0x3'));var express=require('express');var router=express[_0xbad7('0x4')]();var auth=require(_0xbad7('0x5'));var interaction=require(_0xbad7('0x6'));var config=require(_0xbad7('0x7'));module[_0xbad7('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 2015940..19f9520 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 _0x32a4=['STRING','Required\x20by\x20Asterisk','INTEGER','queue_interface','sequelize','exports'];(function(_0x3399e5,_0x41b40b){var _0x468821=function(_0x497aa8){while(--_0x497aa8){_0x3399e5['push'](_0x3399e5['shift']());}};_0x468821(++_0x41b40b);}(_0x32a4,0x142));var _0x432a=function(_0x327c69,_0x27e755){_0x327c69=_0x327c69-0x0;var _0x49c1af=_0x32a4[_0x327c69];return _0x49c1af;};'use strict';var Sequelize=require(_0x432a('0x0'));module[_0x432a('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x432a('0x2')],'allowNull':![],'comment':_0x432a('0x3')},'UserId':{'type':Sequelize[_0x432a('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x432a('0x2')],'allowNull':![],'unique':_0x432a('0x5'),'comment':_0x432a('0x3')},'VoiceQueueId':{'type':Sequelize[_0x432a('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x432a('0x2')],'allowNull':![],'unique':_0x432a('0x5'),'comment':_0x432a('0x3')},'penalty':{'type':Sequelize[_0x432a('0x4')](0xb),'defaultValue':0x0,'comment':_0x432a('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x09c4=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x17283a,_0x1a3f0a){var _0x4b64bc=function(_0x8513ca){while(--_0x8513ca){_0x17283a['push'](_0x17283a['shift']());}};_0x4b64bc(++_0x1a3f0a);}(_0x09c4,0xd3));var _0x409c=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x09c4[_0x145b3c];return _0x1b6e36;};'use strict';var Sequelize=require(_0x409c('0x0'));module[_0x409c('0x1')]={'uniqueid':{'type':Sequelize[_0x409c('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x409c('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x409c('0x3')},'UserId':{'type':Sequelize[_0x409c('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x409c('0x4')],'allowNull':![],'unique':_0x409c('0x5'),'comment':_0x409c('0x3')},'VoiceQueueId':{'type':Sequelize[_0x409c('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x409c('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x409c('0x3')},'penalty':{'type':Sequelize[_0x409c('0x2')](0xb),'defaultValue':0x0,'comment':_0x409c('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x409c('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3920ec1..418904b 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 _0xefd5=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x58b169,_0x20dceb){var _0x21c8c1=function(_0x17fb49){while(--_0x17fb49){_0x58b169['push'](_0x58b169['shift']());}};_0x21c8c1(++_0x20dceb);}(_0xefd5,0x11f));var _0x5efd=function(_0x5f1a55,_0x23438b){_0x5f1a55=_0x5f1a55-0x0;var _0x3fc268=_0xefd5[_0x5f1a55];return _0x3fc268;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x5efd('0x0'))['db'][_0x5efd('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5efd('0x2')](0x0);var events={'afterCreate':_0x5efd('0x3'),'afterUpdate':_0x5efd('0x4'),'afterDestroy':_0x5efd('0x5')};function emitEvent(_0xf9b77b){return function(_0x43b5ae,_0x6ed724,_0x1e00bc){UserVoiceQueueRtEvents[_0x5efd('0x6')](_0xf9b77b+':'+_0x43b5ae['id'],_0x43b5ae);UserVoiceQueueRtEvents[_0x5efd('0x6')](_0xf9b77b,_0x43b5ae);_0x1e00bc(null);};}for(var e in events){if(events[_0x5efd('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x5efd('0x8')](e,emitEvent(event));}}module[_0x5efd('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x1285=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x864135,_0x364ac5){var _0x474a35=function(_0x3833a4){while(--_0x3833a4){_0x864135['push'](_0x864135['shift']());}};_0x474a35(++_0x364ac5);}(_0x1285,0x10e));var _0x5128=function(_0x4b9ce3,_0x5688da){_0x4b9ce3=_0x4b9ce3-0x0;var _0x124cfe=_0x1285[_0x4b9ce3];return _0x124cfe;};'use strict';var EventEmitter=require(_0x5128('0x0'));var UserVoiceQueueRt=require(_0x5128('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5128('0x2')](0x0);var events={'afterCreate':_0x5128('0x3'),'afterUpdate':_0x5128('0x4'),'afterDestroy':_0x5128('0x5')};function emitEvent(_0x2c5e64){return function(_0x5151e5,_0xd2a5e2,_0xb8696f){UserVoiceQueueRtEvents[_0x5128('0x6')](_0x2c5e64+':'+_0x5151e5['id'],_0x5151e5);UserVoiceQueueRtEvents[_0x5128('0x6')](_0x2c5e64,_0x5151e5);_0xb8696f(null);};}for(var e in events){if(events[_0x5128('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x5128('0x8')](e,emitEvent(event));}}module[_0x5128('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ca025ae..b68f741 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 _0x6130=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x2e282b,_0x385fb9){var _0x280de3=function(_0x198264){while(--_0x198264){_0x2e282b['push'](_0x2e282b['shift']());}};_0x280de3(++_0x385fb9);}(_0x6130,0x65));var _0x0613=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x6130[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x0613('0x0'));var util=require(_0x0613('0x1'));var logger=require(_0x0613('0x2'))('api');var moment=require(_0x0613('0x3'));var BPromise=require(_0x0613('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0613('0x5'));var rimraf=require(_0x0613('0x6'));var config=require(_0x0613('0x7'));var attributes=require(_0x0613('0x8'));module[_0x0613('0x9')]=function(_0x4d7549,_0x1007c0){return _0x4d7549[_0x0613('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x0613('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9605=['rimraf','../../config/environment','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','api','moment','request-promise','path'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x9605,0x70));var _0x5960=function(_0x262d9f,_0x4b1a85){_0x262d9f=_0x262d9f-0x0;var _0xb2d592=_0x9605[_0x262d9f];return _0xb2d592;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5960('0x0'))(_0x5960('0x1'));var moment=require(_0x5960('0x2'));var BPromise=require('bluebird');var rp=require(_0x5960('0x3'));var fs=require('fs');var path=require(_0x5960('0x4'));var rimraf=require(_0x5960('0x5'));var config=require(_0x5960('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x199d25,_0xbbab11){return _0x199d25['define'](_0x5960('0x7'),attributes,{'tableName':_0x5960('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 8abca08..530a020 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 _0x56f0=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','randomstring'];(function(_0x4cd685,_0x472697){var _0x37743e=function(_0x238ec8){while(--_0x238ec8){_0x4cd685['push'](_0x4cd685['shift']());}};_0x37743e(++_0x472697);}(_0x56f0,0x1f4));var _0x056f=function(_0x501695,_0xda9d02){_0x501695=_0x501695-0x0;var _0xca4b6c=_0x56f0[_0x501695];return _0xca4b6c;};'use strict';var _=require(_0x056f('0x0'));var util=require(_0x056f('0x1'));var moment=require(_0x056f('0x2'));var BPromise=require('bluebird');var rs=require(_0x056f('0x3'));var fs=require('fs');var Redis=require(_0x056f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x056f('0x5'));var logger=require(_0x056f('0x6'))(_0x056f('0x7'));var config=require('../../config/environment');var jayson=require(_0x056f('0x8'));var client=jayson[_0x056f('0x9')][_0x056f('0xa')]({'port':0x232a});config[_0x056f('0xb')]=_[_0x056f('0xc')](config[_0x056f('0xb')],{'host':_0x056f('0xd'),'port':0x18eb});var socket=require(_0x056f('0xe'))(new Redis(config[_0x056f('0xb')]));require('./userVoiceQueueRt.socket')[_0x056f('0xf')](socket);function respondWithRpcPromise(_0x5d25ae,_0x3ff501,_0x3c4883){return new BPromise(function(_0xe9e7db,_0x5ee3b3){return client['request'](_0x5d25ae,_0x3c4883)[_0x056f('0x10')](function(_0x19257e){logger[_0x056f('0x11')](_0x056f('0x12'),_0x3ff501,_0x056f('0x13'));logger[_0x056f('0x14')](_0x056f('0x15'),_0x3ff501,_0x056f('0x13'),JSON[_0x056f('0x16')](_0x19257e));if(_0x19257e[_0x056f('0x17')]){if(_0x19257e['error']['code']===0x1f4){logger[_0x056f('0x17')](_0x056f('0x12'),_0x3ff501,_0x19257e[_0x056f('0x17')][_0x056f('0x18')]);return _0x5ee3b3(_0x19257e[_0x056f('0x17')][_0x056f('0x18')]);}logger[_0x056f('0x17')](_0x056f('0x12'),_0x3ff501,_0x19257e[_0x056f('0x17')]['message']);return _0xe9e7db(_0x19257e['error'][_0x056f('0x18')]);}else{logger[_0x056f('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3ff501,_0x056f('0x13'));_0xe9e7db(_0x19257e[_0x056f('0x19')]['message']);}})['catch'](function(_0x124dfb){logger[_0x056f('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3ff501,_0x124dfb);_0x5ee3b3(_0x124dfb);});});}exports[_0x056f('0x1a')]=function(_0x2db333){var _0x4c44b1=this;return new Promise(function(_0x45320e,_0x8ce0d0){return db['UserVoiceQueueRt'][_0x056f('0x1b')]({'raw':_0x2db333[_0x056f('0x1c')]?_0x2db333['options'][_0x056f('0x1d')]===undefined?!![]:![]:!![],'where':_0x2db333['options']?_0x2db333['options'][_0x056f('0x1e')]||null:null,'attributes':[[db[_0x056f('0x1f')]['fn'](_0x056f('0x20'),db[_0x056f('0x1f')]['fn']('IF',db[_0x056f('0x1f')]['literal'](_0x056f('0x21')))),_0x056f('0x22')]]})[_0x056f('0x10')](function(_0x52d600){logger['info'](_0x056f('0x1a'),_0x2db333);logger['debug'](_0x056f('0x1a'),_0x2db333,JSON[_0x056f('0x16')](_0x52d600));_0x45320e(_0x52d600);})[_0x056f('0x23')](function(_0x38fdfb){logger[_0x056f('0x17')](_0x056f('0x1a'),_0x38fdfb[_0x056f('0x18')],_0x2db333);_0x8ce0d0(_0x4c44b1[_0x056f('0x17')](0x1f4,_0x38fdfb['message']));});});}; \ No newline at end of file +var _0xb66d=['sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xb66d,0xc5));var _0xdb66=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0xb66d[_0x49d280];return _0x25274a;};'use strict';var _=require(_0xdb66('0x0'));var util=require(_0xdb66('0x1'));var moment=require('moment');var BPromise=require(_0xdb66('0x2'));var rs=require(_0xdb66('0x3'));var fs=require('fs');var Redis=require(_0xdb66('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb66('0x5'));var logger=require(_0xdb66('0x6'))(_0xdb66('0x7'));var config=require(_0xdb66('0x8'));var jayson=require(_0xdb66('0x9'));var client=jayson['client'][_0xdb66('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdb66('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb66('0xc'))(new Redis(config[_0xdb66('0xb')]));require(_0xdb66('0xd'))[_0xdb66('0xe')](socket);function respondWithRpcPromise(_0x1e1945,_0x1e4e5d,_0x4288ee){return new BPromise(function(_0x5d9b19,_0x251e38){return client[_0xdb66('0xf')](_0x1e1945,_0x4288ee)['then'](function(_0x547c72){logger[_0xdb66('0x10')](_0xdb66('0x11'),_0x1e4e5d,'request\x20sent');logger[_0xdb66('0x12')](_0xdb66('0x13'),_0x1e4e5d,_0xdb66('0x14'),JSON[_0xdb66('0x15')](_0x547c72));if(_0x547c72[_0xdb66('0x16')]){if(_0x547c72[_0xdb66('0x16')][_0xdb66('0x17')]===0x1f4){logger['error'](_0xdb66('0x11'),_0x1e4e5d,_0x547c72[_0xdb66('0x16')]['message']);return _0x251e38(_0x547c72[_0xdb66('0x16')][_0xdb66('0x18')]);}logger[_0xdb66('0x16')](_0xdb66('0x11'),_0x1e4e5d,_0x547c72[_0xdb66('0x16')][_0xdb66('0x18')]);return _0x5d9b19(_0x547c72[_0xdb66('0x16')]['message']);}else{logger[_0xdb66('0x10')](_0xdb66('0x11'),_0x1e4e5d,'request\x20sent');_0x5d9b19(_0x547c72[_0xdb66('0x19')][_0xdb66('0x18')]);}})['catch'](function(_0x146314){logger[_0xdb66('0x16')](_0xdb66('0x11'),_0x1e4e5d,_0x146314);_0x251e38(_0x146314);});});}exports[_0xdb66('0x1a')]=function(_0x159f00){var _0x2f442c=this;return new Promise(function(_0x449758,_0x266cfa){return db[_0xdb66('0x1b')][_0xdb66('0x1c')]({'raw':_0x159f00[_0xdb66('0x1d')]?_0x159f00[_0xdb66('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x159f00[_0xdb66('0x1d')]?_0x159f00['options'][_0xdb66('0x1e')]||null:null,'attributes':[[db[_0xdb66('0x1f')]['fn'](_0xdb66('0x20'),db['sequelize']['fn']('IF',db[_0xdb66('0x1f')][_0xdb66('0x21')](_0xdb66('0x22')))),_0xdb66('0x23')]]})[_0xdb66('0x24')](function(_0x22541c){logger['info']('GetVoiceQueueRtPauses',_0x159f00);logger[_0xdb66('0x12')](_0xdb66('0x1a'),_0x159f00,JSON[_0xdb66('0x15')](_0x22541c));_0x449758(_0x22541c);})[_0xdb66('0x25')](function(_0x133112){logger[_0xdb66('0x16')](_0xdb66('0x1a'),_0x133112[_0xdb66('0x18')],_0x159f00);_0x266cfa(_0x2f442c[_0xdb66('0x16')](0x1f4,_0x133112[_0xdb66('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8d87e99..a72a1cf 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 _0xa1cb=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','emit','removeListener'];(function(_0x392306,_0x539ca2){var _0x2343ec=function(_0x5e1dd4){while(--_0x5e1dd4){_0x392306['push'](_0x392306['shift']());}};_0x2343ec(++_0x539ca2);}(_0xa1cb,0x89));var _0xba1c=function(_0x514b3a,_0x20b75d){_0x514b3a=_0x514b3a-0x0;var _0x36939d=_0xa1cb[_0x514b3a];return _0x36939d;};'use strict';var UserVoiceQueueRtEvents=require(_0xba1c('0x0'));var events=['save','remove','update'];function createListener(_0x3befb9,_0x217c67){return function(_0x38cdfd){_0x217c67[_0xba1c('0x1')](_0x3befb9,_0x38cdfd);};}function removeListener(_0x4326c2,_0x2f72fe){return function(){UserVoiceQueueRtEvents[_0xba1c('0x2')](_0x4326c2,_0x2f72fe);};}exports[_0xba1c('0x3')]=function(_0x4f9970){for(var _0x2a07a2=0x0,_0x1216ff=events['length'];_0x2a07a2<_0x1216ff;_0x2a07a2++){var _0x570b2f=events[_0x2a07a2];var _0x72ed0d=createListener(_0xba1c('0x4')+_0x570b2f,_0x4f9970);UserVoiceQueueRtEvents['on'](_0x570b2f,_0x72ed0d);}}; \ No newline at end of file +var _0x4b16=['removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit'];(function(_0x515e0f,_0x41c828){var _0x1fe5fd=function(_0x59a99a){while(--_0x59a99a){_0x515e0f['push'](_0x515e0f['shift']());}};_0x1fe5fd(++_0x41c828);}(_0x4b16,0xf8));var _0x64b1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4b16[_0x20a584];return _0x4b41a8;};'use strict';var UserVoiceQueueRtEvents=require(_0x64b1('0x0'));var events=['save',_0x64b1('0x1'),_0x64b1('0x2')];function createListener(_0x16beb6,_0x539438){return function(_0x1dccc0){_0x539438[_0x64b1('0x3')](_0x16beb6,_0x1dccc0);};}function removeListener(_0x15aaec,_0x4175a6){return function(){UserVoiceQueueRtEvents[_0x64b1('0x4')](_0x15aaec,_0x4175a6);};}exports['register']=function(_0x43ed06){for(var _0x59817b=0x0,_0x854309=events[_0x64b1('0x5')];_0x59817b<_0x854309;_0x59817b++){var _0x256873=events[_0x59817b];var _0x324cdc=createListener(_0x64b1('0x6')+_0x256873,_0x43ed06);UserVoiceQueueRtEvents['on'](_0x256873,_0x324cdc);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index c8f0143..060ce41 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 _0xbe49=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbe49,0x1c1));var _0x9be4=function(_0x358d63,_0x21d7c6){_0x358d63=_0x358d63-0x0;var _0x4ef21b=_0xbe49[_0x358d63];return _0x4ef21b;};'use strict';var multer=require('multer');var util=require(_0x9be4('0x0'));var path=require(_0x9be4('0x1'));var timeout=require(_0x9be4('0x2'));var express=require('express');var router=express[_0x9be4('0x3')]();var auth=require(_0x9be4('0x4'));var interaction=require(_0x9be4('0x5'));var config=require(_0x9be4('0x6'));module[_0x9be4('0x7')]=router; \ No newline at end of file +var _0x5947=['../../components/auth/service','exports','util','path','express'];(function(_0x68cae0,_0x7d78cd){var _0x5e7200=function(_0x4a709f){while(--_0x4a709f){_0x68cae0['push'](_0x68cae0['shift']());}};_0x5e7200(++_0x7d78cd);}(_0x5947,0x179));var _0x7594=function(_0x59ecce,_0x6482d7){_0x59ecce=_0x59ecce-0x0;var _0xdf1e7a=_0x5947[_0x59ecce];return _0xdf1e7a;};'use strict';var multer=require('multer');var util=require(_0x7594('0x0'));var path=require(_0x7594('0x1'));var timeout=require('connect-timeout');var express=require(_0x7594('0x2'));var router=express['Router']();var auth=require(_0x7594('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x7594('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 bb941b3..67d85c4 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x268a20,_0x33b621){var _0x3bc3eb=function(_0x35def0){while(--_0x35def0){_0x268a20['push'](_0x268a20['shift']());}};_0x3bc3eb(++_0x33b621);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x3060e3,_0x14f2c6){var _0x497d2c=function(_0x2a274a){while(--_0x2a274a){_0x3060e3['push'](_0x3060e3['shift']());}};_0x497d2c(++_0x14f2c6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 f3652ce..2dc7ad8 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 _0x935c=['rimraf','../../config/environment','exports','define','user_has_whatsapp_queues','lodash','util','moment','bluebird','request-promise'];(function(_0xb56fb6,_0x49f7d7){var _0x4e3959=function(_0x3ec629){while(--_0x3ec629){_0xb56fb6['push'](_0xb56fb6['shift']());}};_0x4e3959(++_0x49f7d7);}(_0x935c,0x195));var _0xc935=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x935c[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xc935('0x0'));var util=require(_0xc935('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc935('0x2'));var BPromise=require(_0xc935('0x3'));var rp=require(_0xc935('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc935('0x5'));var config=require(_0xc935('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0xc935('0x7')]=function(_0x1a75b3,_0x42ea4c){return _0x1a75b3[_0xc935('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0xc935('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3469=['bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','../../config/logger','api','moment'];(function(_0x9c6822,_0x1e6b95){var _0x43dff3=function(_0x43493e){while(--_0x43493e){_0x9c6822['push'](_0x9c6822['shift']());}};_0x43dff3(++_0x1e6b95);}(_0x3469,0x168));var _0x9346=function(_0x59ff69,_0x459aee){_0x59ff69=_0x59ff69-0x0;var _0x2f846f=_0x3469[_0x59ff69];return _0x2f846f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9346('0x0'))(_0x9346('0x1'));var moment=require(_0x9346('0x2'));var BPromise=require(_0x9346('0x3'));var rp=require(_0x9346('0x4'));var fs=require('fs');var path=require(_0x9346('0x5'));var rimraf=require('rimraf');var config=require(_0x9346('0x6'));var attributes=require(_0x9346('0x7'));module[_0x9346('0x8')]=function(_0x4dd092,_0x20695e){return _0x4dd092[_0x9346('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0x9346('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index c05a8ea..4463f2a 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(_0x16bbea,_0x52f0da){var _0x87dd5f=function(_0x282bf4){while(--_0x282bf4){_0x16bbea['push'](_0x16bbea['shift']());}};_0x87dd5f(++_0x52f0da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x186acf,_0x33d5ce){var _0x36062a=function(_0x1b295a){while(--_0x1b295a){_0x186acf['push'](_0x186acf['shift']());}};_0x36062a(++_0x33d5ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 4b83218..ca1459f 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 _0x4565=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','create','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5820b5,_0x5b92e2){var _0x3dffcb=function(_0x2854be){while(--_0x2854be){_0x5820b5['push'](_0x5820b5['shift']());}};_0x3dffcb(++_0x5b92e2);}(_0x4565,0x11b));var _0x5456=function(_0x43be21,_0x1a1140){_0x43be21=_0x43be21-0x0;var _0x535370=_0x4565[_0x43be21];return _0x535370;};'use strict';var multer=require(_0x5456('0x0'));var util=require(_0x5456('0x1'));var path=require(_0x5456('0x2'));var timeout=require(_0x5456('0x3'));var express=require(_0x5456('0x4'));var router=express[_0x5456('0x5')]();var auth=require(_0x5456('0x6'));var interaction=require(_0x5456('0x7'));var config=require(_0x5456('0x8'));var controller=require(_0x5456('0x9'));router[_0x5456('0xa')]('/',auth[_0x5456('0xb')](),controller['index']);router[_0x5456('0xa')](_0x5456('0xc'),auth[_0x5456('0xb')](),controller[_0x5456('0xd')]);router['post']('/',auth[_0x5456('0xb')](),controller[_0x5456('0xe')]);router['put']('/:id',auth[_0x5456('0xb')](),controller['update']);router[_0x5456('0xf')](_0x5456('0xc'),auth[_0x5456('0xb')](),controller[_0x5456('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3889=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x5876a6,_0x410ead){var _0x566826=function(_0x587874){while(--_0x587874){_0x5876a6['push'](_0x5876a6['shift']());}};_0x566826(++_0x410ead);}(_0x3889,0x130));var _0x9388=function(_0x2e77b8,_0x1a23e4){_0x2e77b8=_0x2e77b8-0x0;var _0x371ee9=_0x3889[_0x2e77b8];return _0x371ee9;};'use strict';var multer=require(_0x9388('0x0'));var util=require(_0x9388('0x1'));var path=require('path');var timeout=require(_0x9388('0x2'));var express=require(_0x9388('0x3'));var router=express[_0x9388('0x4')]();var auth=require(_0x9388('0x5'));var interaction=require(_0x9388('0x6'));var config=require(_0x9388('0x7'));var controller=require('./variable.controller');router['get']('/',auth[_0x9388('0x8')](),controller[_0x9388('0x9')]);router[_0x9388('0xa')](_0x9388('0xb'),auth[_0x9388('0x8')](),controller[_0x9388('0xc')]);router[_0x9388('0xd')]('/',auth['isAuthenticated'](),controller[_0x9388('0xe')]);router[_0x9388('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9388('0x10')]);router[_0x9388('0x11')](_0x9388('0xb'),auth[_0x9388('0x8')](),controller[_0x9388('0x12')]);module[_0x9388('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c48677e..c7ad404 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 _0xde3b=['STRING','name','exports'];(function(_0x3ec9b1,_0x33f663){var _0x5231a4=function(_0x5ccfa7){while(--_0x5ccfa7){_0x3ec9b1['push'](_0x3ec9b1['shift']());}};_0x5231a4(++_0x33f663);}(_0xde3b,0x9e));var _0xbde3=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xde3b[_0x819464];return _0x49dcc0;};'use strict';var Sequelize=require('sequelize');module[_0xbde3('0x0')]={'name':{'type':Sequelize[_0xbde3('0x1')],'unique':_0xbde3('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbb8e=['STRING','exports'];(function(_0x18c627,_0x926f18){var _0x1e9cbf=function(_0x63fb22){while(--_0x63fb22){_0x18c627['push'](_0x18c627['shift']());}};_0x1e9cbf(++_0x926f18);}(_0xbb8e,0x93));var _0xebb8=function(_0x408599,_0x4db917){_0x408599=_0x408599-0x0;var _0x44e7d6=_0xbb8e[_0x408599];return _0x44e7d6;};'use strict';var Sequelize=require('sequelize');module[_0xebb8('0x0')]={'name':{'type':Sequelize[_0xebb8('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xebb8('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 38e628c..c4bc78f 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 _0x4441=['end','json','offset','limit','apply','reject','update','destroy','then','Variables','UserProfileResource','error','stack','name','send','Variable','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','count','findAll','rows','catch','show','params','length','includeAll','include','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','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','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x1b9825,_0x425af5){var _0x5297a3=function(_0x14a02e){while(--_0x14a02e){_0x1b9825['push'](_0x1b9825['shift']());}};_0x5297a3(++_0x425af5);}(_0x4441,0xd4));var _0x1444=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4441[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x1444('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1444('0x1'));var zipdir=require(_0x1444('0x2'));var jsonpatch=require(_0x1444('0x3'));var rp=require(_0x1444('0x4'));var moment=require(_0x1444('0x5'));var BPromise=require(_0x1444('0x6'));var Mustache=require(_0x1444('0x7'));var util=require(_0x1444('0x8'));var path=require(_0x1444('0x9'));var sox=require(_0x1444('0xa'));var csv=require(_0x1444('0xb'));var ejs=require(_0x1444('0xc'));var fs=require('fs');var _=require(_0x1444('0xd'));var squel=require(_0x1444('0xe'));var crypto=require(_0x1444('0xf'));var jsforce=require(_0x1444('0x10'));var deskjs=require(_0x1444('0x11'));var toCsv=require(_0x1444('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1444('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1444('0x13'))(_0x1444('0x14'));var utils=require(_0x1444('0x15'));var config=require(_0x1444('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1277c4,_0x3777d2){_0x3777d2=_0x3777d2||0xcc;return function(_0x512483){if(_0x512483){return _0x1277c4[_0x1444('0x17')](_0x3777d2);}return _0x1277c4[_0x1444('0x18')](_0x3777d2)[_0x1444('0x19')]();};}function respondWithResult(_0x49e7f2,_0x562c3d){_0x562c3d=_0x562c3d||0xc8;return function(_0x1c7a3f){if(_0x1c7a3f){return _0x49e7f2['status'](_0x562c3d)[_0x1444('0x1a')](_0x1c7a3f);}};}function respondWithFilteredResult(_0x22c577,_0x1c750b){return function(_0x22f78d){if(_0x22f78d){var _0xd9d26f=_0x22f78d['count'],_0x5ae944=_0x1c750b[_0x1444('0x1b')],_0x1cd988=_0x1c750b[_0x1444('0x1b')]+_0x1c750b[_0x1444('0x1c')],_0x15f775;if(_0x1cd988>=_0xd9d26f){_0x1cd988=_0xd9d26f;_0x15f775=0xc8;}else{_0x15f775=0xce;}_0x22c577[_0x1444('0x18')](_0x15f775);return _0x22c577['set']('Content-Range',_0x5ae944+'-'+_0x1cd988+'/'+_0xd9d26f)[_0x1444('0x1a')](_0x22f78d);}return null;};}function patchUpdates(_0x2fda4c){return function(_0x5e4ef0){try{jsonpatch[_0x1444('0x1d')](_0x5e4ef0,_0x2fda4c,!![]);}catch(_0x3a443f){return BPromise[_0x1444('0x1e')](_0x3a443f);}return _0x5e4ef0['save']();};}function saveUpdates(_0x1941f9,_0x5e4009){return function(_0x154a36){if(_0x154a36){return _0x154a36[_0x1444('0x1f')](_0x1941f9)['then'](function(_0x54768a){return _0x54768a;});}return null;};}function removeEntity(_0x30de1d,_0x1c67d6){return function(_0xb2f9fe){if(_0xb2f9fe){return _0xb2f9fe[_0x1444('0x20')]()[_0x1444('0x21')](function(){var _0x5e5d12=_0xb2f9fe['get']({'plain':!![]});var _0x2dd643=_0x1444('0x22');return db[_0x1444('0x23')]['destroy']({'where':{'type':_0x2dd643,'resourceId':_0x5e5d12['id']}})[_0x1444('0x21')](function(){return _0xb2f9fe;});})[_0x1444('0x21')](function(){_0x30de1d[_0x1444('0x18')](0xcc)[_0x1444('0x19')]();});}};}function handleEntityNotFound(_0x1479fe,_0x34a632){return function(_0x3075fc){if(!_0x3075fc){_0x1479fe[_0x1444('0x17')](0x194);}return _0x3075fc;};}function handleError(_0x893e3a,_0x56cbd7){_0x56cbd7=_0x56cbd7||0x1f4;return function(_0x4737a9){logger[_0x1444('0x24')](_0x4737a9[_0x1444('0x25')]);if(_0x4737a9[_0x1444('0x26')]){delete _0x4737a9[_0x1444('0x26')];}_0x893e3a[_0x1444('0x18')](_0x56cbd7)[_0x1444('0x27')](_0x4737a9);};}exports['index']=function(_0x3d58ec,_0x236509){var _0x223d21={},_0x289d52={},_0x2e2f8d={'count':0x0,'rows':[]};var _0x1b075b=_['map'](db[_0x1444('0x28')][_0x1444('0x29')],function(_0x262aa1){return{'name':_0x262aa1['fieldName'],'type':_0x262aa1[_0x1444('0x2a')][_0x1444('0x2b')]};});_0x289d52[_0x1444('0x2c')]=_[_0x1444('0x2d')](_0x1b075b,_0x1444('0x26'));_0x289d52[_0x1444('0x2e')]=_[_0x1444('0x2f')](_0x3d58ec[_0x1444('0x2e')]);_0x289d52[_0x1444('0x30')]=_[_0x1444('0x31')](_0x289d52[_0x1444('0x2c')],_0x289d52[_0x1444('0x2e')]);_0x223d21[_0x1444('0x32')]=_[_0x1444('0x31')](_0x289d52[_0x1444('0x2c')],qs[_0x1444('0x33')](_0x3d58ec[_0x1444('0x2e')]['fields']));_0x223d21[_0x1444('0x32')]=_0x223d21[_0x1444('0x32')]['length']?_0x223d21[_0x1444('0x32')]:_0x289d52['model'];if(!_0x3d58ec['query'][_0x1444('0x34')]('nolimit')){_0x223d21[_0x1444('0x1c')]=qs['limit'](_0x3d58ec[_0x1444('0x2e')][_0x1444('0x1c')]);_0x223d21[_0x1444('0x1b')]=qs[_0x1444('0x1b')](_0x3d58ec[_0x1444('0x2e')]['offset']);}_0x223d21[_0x1444('0x35')]=qs['sort'](_0x3d58ec[_0x1444('0x2e')][_0x1444('0x36')]);_0x223d21[_0x1444('0x37')]=qs['filters'](_['pick'](_0x3d58ec[_0x1444('0x2e')],_0x289d52[_0x1444('0x30')]),_0x1b075b);if(_0x3d58ec[_0x1444('0x2e')][_0x1444('0x38')]){_0x223d21['where']=_['merge'](_0x223d21[_0x1444('0x37')],{'$or':_[_0x1444('0x2d')](_0x1b075b,function(_0x46b204){if(_0x46b204[_0x1444('0x2a')]!==_0x1444('0x39')){var _0x3f4458={};_0x3f4458[_0x46b204[_0x1444('0x26')]]={'$like':'%'+_0x3d58ec['query'][_0x1444('0x38')]+'%'};return _0x3f4458;}})});}_0x223d21=_[_0x1444('0x3a')]({},_0x223d21,_0x3d58ec[_0x1444('0x3b')]);var _0x32fc51={'where':_0x223d21[_0x1444('0x37')]};return db[_0x1444('0x28')][_0x1444('0x3c')](_0x32fc51)['then'](function(_0x12bdec){_0x2e2f8d['count']=_0x12bdec;if(_0x3d58ec[_0x1444('0x2e')]['includeAll']){_0x223d21['include']=[{'all':!![]}];}return db[_0x1444('0x28')][_0x1444('0x3d')](_0x223d21);})[_0x1444('0x21')](function(_0x2aba70){_0x2e2f8d[_0x1444('0x3e')]=_0x2aba70;return _0x2e2f8d;})[_0x1444('0x21')](respondWithFilteredResult(_0x236509,_0x223d21))[_0x1444('0x3f')](handleError(_0x236509,null));};exports[_0x1444('0x40')]=function(_0x545ac7,_0x262f7e){var _0x649ccb={'raw':!![],'where':{'id':_0x545ac7[_0x1444('0x41')]['id']}},_0x42c8c8={};_0x42c8c8['model']=_[_0x1444('0x2f')](db[_0x1444('0x28')][_0x1444('0x29')]);_0x42c8c8[_0x1444('0x2e')]=_[_0x1444('0x2f')](_0x545ac7['query']);_0x42c8c8['filters']=_[_0x1444('0x31')](_0x42c8c8[_0x1444('0x2c')],_0x42c8c8['query']);_0x649ccb[_0x1444('0x32')]=_[_0x1444('0x31')](_0x42c8c8[_0x1444('0x2c')],qs[_0x1444('0x33')](_0x545ac7['query']['fields']));_0x649ccb[_0x1444('0x32')]=_0x649ccb['attributes'][_0x1444('0x42')]?_0x649ccb['attributes']:_0x42c8c8['model'];if(_0x545ac7['query'][_0x1444('0x43')]){_0x649ccb[_0x1444('0x44')]=[{'all':!![]}];}_0x649ccb=_[_0x1444('0x3a')]({},_0x649ccb,_0x545ac7[_0x1444('0x3b')]);return db[_0x1444('0x28')][_0x1444('0x45')](_0x649ccb)['then'](handleEntityNotFound(_0x262f7e,null))[_0x1444('0x21')](respondWithResult(_0x262f7e,null))[_0x1444('0x3f')](handleError(_0x262f7e,null));};exports[_0x1444('0x46')]=function(_0x138f54,_0x1ba7df){return db[_0x1444('0x28')][_0x1444('0x46')](_0x138f54[_0x1444('0x47')],{})[_0x1444('0x21')](function(_0x5dc63a){var _0x3022e8=_0x138f54[_0x1444('0x48')][_0x1444('0x49')]({'plain':!![]});if(!_0x3022e8)throw new Error(_0x1444('0x4a'));if(_0x3022e8[_0x1444('0x4b')]===_0x1444('0x48')){var _0x11c440=_0x5dc63a[_0x1444('0x49')]({'plain':!![]});var _0x1ba9e9=_0x1444('0x22');return db[_0x1444('0x4c')][_0x1444('0x45')]({'where':{'name':_0x1ba9e9,'userProfileId':_0x3022e8['userProfileId']},'raw':!![]})[_0x1444('0x21')](function(_0x235de9){if(_0x235de9&&_0x235de9[_0x1444('0x4d')]===0x0){return db[_0x1444('0x23')]['create']({'name':_0x11c440[_0x1444('0x26')],'resourceId':_0x11c440['id'],'type':_0x235de9['name'],'sectionId':_0x235de9['id']},{})[_0x1444('0x21')](function(){return _0x5dc63a;});}else{return _0x5dc63a;}})[_0x1444('0x3f')](function(_0xf2aea4){logger[_0x1444('0x24')](_0x1444('0x4e'),_0xf2aea4);throw _0xf2aea4;});}return _0x5dc63a;})[_0x1444('0x21')](respondWithResult(_0x1ba7df,0xc9))[_0x1444('0x3f')](handleError(_0x1ba7df,null));};exports[_0x1444('0x1f')]=function(_0x305627,_0xfad8ce){if(_0x305627[_0x1444('0x47')]['id']){delete _0x305627['body']['id'];}return db[_0x1444('0x28')][_0x1444('0x45')]({'where':{'id':_0x305627[_0x1444('0x41')]['id']}})[_0x1444('0x21')](handleEntityNotFound(_0xfad8ce,null))['then'](saveUpdates(_0x305627[_0x1444('0x47')],null))[_0x1444('0x21')](respondWithResult(_0xfad8ce,null))[_0x1444('0x3f')](handleError(_0xfad8ce,null));};exports[_0x1444('0x20')]=function(_0x1f8482,_0xf3af9c){return db[_0x1444('0x28')][_0x1444('0x45')]({'where':{'id':_0x1f8482[_0x1444('0x41')]['id']}})[_0x1444('0x21')](handleEntityNotFound(_0xf3af9c,null))['then'](removeEntity(_0xf3af9c,null))[_0x1444('0x3f')](handleError(_0xf3af9c,null));}; \ No newline at end of file +var _0xc28e=['index','Variable','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','options','includeAll','include','findAll','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','Variables','UserProfileResource','destroy','stack','name','send'];(function(_0x3dc256,_0x1ee88b){var _0x76841=function(_0x488115){while(--_0x488115){_0x3dc256['push'](_0x3dc256['shift']());}};_0x76841(++_0x1ee88b);}(_0xc28e,0x1af));var _0xec28=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xc28e[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0xec28('0x0'));var emlformat=require(_0xec28('0x1'));var rimraf=require(_0xec28('0x2'));var zipdir=require(_0xec28('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xec28('0x4'));var BPromise=require(_0xec28('0x5'));var Mustache=require(_0xec28('0x6'));var util=require(_0xec28('0x7'));var path=require(_0xec28('0x8'));var sox=require(_0xec28('0x9'));var csv=require(_0xec28('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec28('0xb'));var squel=require(_0xec28('0xc'));var crypto=require('crypto');var jsforce=require(_0xec28('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xec28('0xa'));var querystring=require('querystring');var Papa=require(_0xec28('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xec28('0xf'));var as=require(_0xec28('0x10'));var hardwareService=require(_0xec28('0x11'));var logger=require(_0xec28('0x12'))(_0xec28('0x13'));var utils=require(_0xec28('0x14'));var config=require(_0xec28('0x15'));var db=require(_0xec28('0x16'))['db'];function respondWithStatusCode(_0x1049a0,_0x25466f){_0x25466f=_0x25466f||0xcc;return function(_0x5bd9fd){if(_0x5bd9fd){return _0x1049a0[_0xec28('0x17')](_0x25466f);}return _0x1049a0[_0xec28('0x18')](_0x25466f)[_0xec28('0x19')]();};}function respondWithResult(_0x15554a,_0x53e1f5){_0x53e1f5=_0x53e1f5||0xc8;return function(_0x506d5d){if(_0x506d5d){return _0x15554a[_0xec28('0x18')](_0x53e1f5)[_0xec28('0x1a')](_0x506d5d);}};}function respondWithFilteredResult(_0x2ce43d,_0x33eb14){return function(_0x39e0b5){if(_0x39e0b5){var _0x5bd95f=_0x39e0b5[_0xec28('0x1b')],_0x1ab3c7=_0x33eb14[_0xec28('0x1c')],_0x50551f=_0x33eb14['offset']+_0x33eb14[_0xec28('0x1d')],_0x2c6eb2;if(_0x50551f>=_0x5bd95f){_0x50551f=_0x5bd95f;_0x2c6eb2=0xc8;}else{_0x2c6eb2=0xce;}_0x2ce43d[_0xec28('0x18')](_0x2c6eb2);return _0x2ce43d[_0xec28('0x1e')](_0xec28('0x1f'),_0x1ab3c7+'-'+_0x50551f+'/'+_0x5bd95f)[_0xec28('0x1a')](_0x39e0b5);}return null;};}function patchUpdates(_0x18cab3){return function(_0x980c5f){try{jsonpatch['apply'](_0x980c5f,_0x18cab3,!![]);}catch(_0x41d756){return BPromise[_0xec28('0x20')](_0x41d756);}return _0x980c5f[_0xec28('0x21')]();};}function saveUpdates(_0x4950e9,_0x1f2eac){return function(_0x435c5b){if(_0x435c5b){return _0x435c5b[_0xec28('0x22')](_0x4950e9)[_0xec28('0x23')](function(_0xb8c0a6){return _0xb8c0a6;});}return null;};}function removeEntity(_0x20ee1b,_0x4cafb1){return function(_0x2db3b9){if(_0x2db3b9){return _0x2db3b9['destroy']()['then'](function(){var _0x5811ab=_0x2db3b9[_0xec28('0x24')]({'plain':!![]});var _0x14f5e1=_0xec28('0x25');return db[_0xec28('0x26')][_0xec28('0x27')]({'where':{'type':_0x14f5e1,'resourceId':_0x5811ab['id']}})[_0xec28('0x23')](function(){return _0x2db3b9;});})['then'](function(){_0x20ee1b[_0xec28('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475b61,_0x3828c9){return function(_0x5c5d51){if(!_0x5c5d51){_0x475b61['sendStatus'](0x194);}return _0x5c5d51;};}function handleError(_0x4b7122,_0x1c7d8a){_0x1c7d8a=_0x1c7d8a||0x1f4;return function(_0x5e9f32){logger['error'](_0x5e9f32[_0xec28('0x28')]);if(_0x5e9f32[_0xec28('0x29')]){delete _0x5e9f32[_0xec28('0x29')];}_0x4b7122['status'](_0x1c7d8a)[_0xec28('0x2a')](_0x5e9f32);};}exports[_0xec28('0x2b')]=function(_0x24c068,_0xda9f5e){var _0x37092c={},_0x337c1f={},_0x2a667e={'count':0x0,'rows':[]};var _0x3cc71f=_['map'](db[_0xec28('0x2c')][_0xec28('0x2d')],function(_0x59ba59){return{'name':_0x59ba59[_0xec28('0x2e')],'type':_0x59ba59['type'][_0xec28('0x2f')]};});_0x337c1f[_0xec28('0x30')]=_['map'](_0x3cc71f,_0xec28('0x29'));_0x337c1f['query']=_[_0xec28('0x31')](_0x24c068[_0xec28('0x32')]);_0x337c1f[_0xec28('0x33')]=_[_0xec28('0x34')](_0x337c1f[_0xec28('0x30')],_0x337c1f[_0xec28('0x32')]);_0x37092c[_0xec28('0x35')]=_[_0xec28('0x34')](_0x337c1f['model'],qs[_0xec28('0x36')](_0x24c068[_0xec28('0x32')][_0xec28('0x36')]));_0x37092c[_0xec28('0x35')]=_0x37092c[_0xec28('0x35')][_0xec28('0x37')]?_0x37092c['attributes']:_0x337c1f[_0xec28('0x30')];if(!_0x24c068[_0xec28('0x32')][_0xec28('0x38')](_0xec28('0x39'))){_0x37092c[_0xec28('0x1d')]=qs[_0xec28('0x1d')](_0x24c068[_0xec28('0x32')]['limit']);_0x37092c[_0xec28('0x1c')]=qs[_0xec28('0x1c')](_0x24c068[_0xec28('0x32')][_0xec28('0x1c')]);}_0x37092c[_0xec28('0x3a')]=qs[_0xec28('0x3b')](_0x24c068[_0xec28('0x32')]['sort']);_0x37092c[_0xec28('0x3c')]=qs[_0xec28('0x33')](_['pick'](_0x24c068['query'],_0x337c1f[_0xec28('0x33')]),_0x3cc71f);if(_0x24c068[_0xec28('0x32')][_0xec28('0x3d')]){_0x37092c[_0xec28('0x3c')]=_[_0xec28('0x3e')](_0x37092c[_0xec28('0x3c')],{'$or':_[_0xec28('0x3f')](_0x3cc71f,function(_0x6636f0){if(_0x6636f0[_0xec28('0x40')]!=='VIRTUAL'){var _0x70939b={};_0x70939b[_0x6636f0['name']]={'$like':'%'+_0x24c068[_0xec28('0x32')]['filter']+'%'};return _0x70939b;}})});}_0x37092c=_[_0xec28('0x3e')]({},_0x37092c,_0x24c068[_0xec28('0x41')]);var _0x4ae26c={'where':_0x37092c[_0xec28('0x3c')]};return db[_0xec28('0x2c')][_0xec28('0x1b')](_0x4ae26c)[_0xec28('0x23')](function(_0x33bfda){_0x2a667e[_0xec28('0x1b')]=_0x33bfda;if(_0x24c068[_0xec28('0x32')][_0xec28('0x42')]){_0x37092c[_0xec28('0x43')]=[{'all':!![]}];}return db[_0xec28('0x2c')][_0xec28('0x44')](_0x37092c);})['then'](function(_0xd7b639){_0x2a667e[_0xec28('0x45')]=_0xd7b639;return _0x2a667e;})[_0xec28('0x23')](respondWithFilteredResult(_0xda9f5e,_0x37092c))[_0xec28('0x46')](handleError(_0xda9f5e,null));};exports['show']=function(_0x2d7a2c,_0x1d26c6){var _0x2ca4bb={'raw':!![],'where':{'id':_0x2d7a2c['params']['id']}},_0xe599c={};_0xe599c['model']=_[_0xec28('0x31')](db[_0xec28('0x2c')]['rawAttributes']);_0xe599c[_0xec28('0x32')]=_[_0xec28('0x31')](_0x2d7a2c[_0xec28('0x32')]);_0xe599c['filters']=_[_0xec28('0x34')](_0xe599c[_0xec28('0x30')],_0xe599c[_0xec28('0x32')]);_0x2ca4bb[_0xec28('0x35')]=_[_0xec28('0x34')](_0xe599c['model'],qs['fields'](_0x2d7a2c[_0xec28('0x32')][_0xec28('0x36')]));_0x2ca4bb[_0xec28('0x35')]=_0x2ca4bb[_0xec28('0x35')][_0xec28('0x37')]?_0x2ca4bb['attributes']:_0xe599c[_0xec28('0x30')];if(_0x2d7a2c[_0xec28('0x32')][_0xec28('0x42')]){_0x2ca4bb[_0xec28('0x43')]=[{'all':!![]}];}_0x2ca4bb=_[_0xec28('0x3e')]({},_0x2ca4bb,_0x2d7a2c['options']);return db[_0xec28('0x2c')][_0xec28('0x47')](_0x2ca4bb)['then'](handleEntityNotFound(_0x1d26c6,null))[_0xec28('0x23')](respondWithResult(_0x1d26c6,null))[_0xec28('0x46')](handleError(_0x1d26c6,null));};exports[_0xec28('0x48')]=function(_0x375bfa,_0x5201fd){return db[_0xec28('0x2c')][_0xec28('0x48')](_0x375bfa[_0xec28('0x49')],{})['then'](function(_0x35faa2){var _0x120370=_0x375bfa['user'][_0xec28('0x24')]({'plain':!![]});if(!_0x120370)throw new Error(_0xec28('0x4a'));if(_0x120370[_0xec28('0x4b')]==='user'){var _0x1cf5de=_0x35faa2[_0xec28('0x24')]({'plain':!![]});var _0xbed68=_0xec28('0x25');return db['UserProfileSection'][_0xec28('0x47')]({'where':{'name':_0xbed68,'userProfileId':_0x120370[_0xec28('0x4c')]},'raw':!![]})[_0xec28('0x23')](function(_0x4d6580){if(_0x4d6580&&_0x4d6580[_0xec28('0x4d')]===0x0){return db[_0xec28('0x26')][_0xec28('0x48')]({'name':_0x1cf5de[_0xec28('0x29')],'resourceId':_0x1cf5de['id'],'type':_0x4d6580[_0xec28('0x29')],'sectionId':_0x4d6580['id']},{})[_0xec28('0x23')](function(){return _0x35faa2;});}else{return _0x35faa2;}})[_0xec28('0x46')](function(_0x5abcd6){logger['error'](_0xec28('0x4e'),_0x5abcd6);throw _0x5abcd6;});}return _0x35faa2;})[_0xec28('0x23')](respondWithResult(_0x5201fd,0xc9))[_0xec28('0x46')](handleError(_0x5201fd,null));};exports['update']=function(_0x114145,_0x259cf6){if(_0x114145[_0xec28('0x49')]['id']){delete _0x114145[_0xec28('0x49')]['id'];}return db[_0xec28('0x2c')]['find']({'where':{'id':_0x114145['params']['id']}})[_0xec28('0x23')](handleEntityNotFound(_0x259cf6,null))['then'](saveUpdates(_0x114145['body'],null))[_0xec28('0x23')](respondWithResult(_0x259cf6,null))['catch'](handleError(_0x259cf6,null));};exports[_0xec28('0x27')]=function(_0x3120b8,_0x10c0fd){return db['Variable'][_0xec28('0x47')]({'where':{'id':_0x3120b8['params']['id']}})[_0xec28('0x23')](handleEntityNotFound(_0x10c0fd,null))['then'](removeEntity(_0x10c0fd,null))[_0xec28('0x46')](handleError(_0x10c0fd,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 8ecd5d1..67bf798 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 _0x0081=['../../config/environment','define','tools_variables','lodash','../../config/logger','api','bluebird','rimraf'];(function(_0x3489ee,_0x145bca){var _0x2c7dbc=function(_0x36222c){while(--_0x36222c){_0x3489ee['push'](_0x3489ee['shift']());}};_0x2c7dbc(++_0x145bca);}(_0x0081,0xa3));var _0x1008=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x0081[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x1008('0x0'));var util=require('util');var logger=require(_0x1008('0x1'))(_0x1008('0x2'));var moment=require('moment');var BPromise=require(_0x1008('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1008('0x4'));var config=require(_0x1008('0x5'));var attributes=require('./variable.attributes');module['exports']=function(_0x210207,_0x2aca13){return _0x210207[_0x1008('0x6')]('Variable',attributes,{'tableName':_0x1008('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf89b=['define','Variable','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf89b,0x157));var _0xbf89=function(_0x49e479,_0x30b274){_0x49e479=_0x49e479-0x0;var _0x27aa63=_0xf89b[_0x49e479];return _0x27aa63;};'use strict';var _=require(_0xbf89('0x0'));var util=require(_0xbf89('0x1'));var logger=require('../../config/logger')(_0xbf89('0x2'));var moment=require(_0xbf89('0x3'));var BPromise=require(_0xbf89('0x4'));var rp=require(_0xbf89('0x5'));var fs=require('fs');var path=require(_0xbf89('0x6'));var rimraf=require('rimraf');var config=require(_0xbf89('0x7'));var attributes=require('./variable.attributes');module[_0xbf89('0x8')]=function(_0x49e25f,_0x1b09d6){return _0x49e25f[_0xbf89('0x9')](_0xbf89('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index d89fe40..0a1bea4 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 _0xab35=['Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','catch','Variable','find','options','attributes','include','map','model','ShowVariable','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0xdafaf2,_0x5100e7){var _0x3c8496=function(_0x106b2e){while(--_0x106b2e){_0xdafaf2['push'](_0xdafaf2['shift']());}};_0x3c8496(++_0x5100e7);}(_0xab35,0xfe));var _0x5ab3=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0xab35[_0x10dbf6];return _0x452147;};'use strict';var _=require(_0x5ab3('0x0'));var util=require(_0x5ab3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ab3('0x2'));var fs=require('fs');var Redis=require(_0x5ab3('0x3'));var db=require(_0x5ab3('0x4'))['db'];var utils=require(_0x5ab3('0x5'));var logger=require(_0x5ab3('0x6'))(_0x5ab3('0x7'));var config=require(_0x5ab3('0x8'));var jayson=require(_0x5ab3('0x9'));var client=jayson[_0x5ab3('0xa')][_0x5ab3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd80ae3,_0x2b0f93,_0x35bd51){return new BPromise(function(_0x267c16,_0x5de4a6){return client[_0x5ab3('0xc')](_0xd80ae3,_0x35bd51)[_0x5ab3('0xd')](function(_0x12f1b4){logger[_0x5ab3('0xe')]('Variable,\x20%s,\x20%s',_0x2b0f93,'request\x20sent');logger[_0x5ab3('0xf')](_0x5ab3('0x10'),_0x2b0f93,'request\x20sent',JSON[_0x5ab3('0x11')](_0x12f1b4));if(_0x12f1b4[_0x5ab3('0x12')]){if(_0x12f1b4['error']['code']===0x1f4){logger[_0x5ab3('0x12')](_0x5ab3('0x13'),_0x2b0f93,_0x12f1b4['error'][_0x5ab3('0x14')]);return _0x5de4a6(_0x12f1b4[_0x5ab3('0x12')][_0x5ab3('0x14')]);}logger['error'](_0x5ab3('0x13'),_0x2b0f93,_0x12f1b4[_0x5ab3('0x12')]['message']);return _0x267c16(_0x12f1b4[_0x5ab3('0x12')][_0x5ab3('0x14')]);}else{logger[_0x5ab3('0xe')]('Variable,\x20%s,\x20%s',_0x2b0f93,'request\x20sent');_0x267c16(_0x12f1b4['result'][_0x5ab3('0x14')]);}})[_0x5ab3('0x15')](function(_0x452184){logger[_0x5ab3('0x12')](_0x5ab3('0x13'),_0x2b0f93,_0x452184);_0x5de4a6(_0x452184);});});}exports['ShowVariable']=function(_0x1da252){var _0xd08125=this;return new Promise(function(_0x577ed1,_0x41b354){return db[_0x5ab3('0x16')][_0x5ab3('0x17')]({'raw':_0x1da252[_0x5ab3('0x18')]?_0x1da252[_0x5ab3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1da252[_0x5ab3('0x18')]?_0x1da252['options']['where']||null:null,'attributes':_0x1da252[_0x5ab3('0x18')]?_0x1da252['options'][_0x5ab3('0x19')]||null:null,'include':_0x1da252[_0x5ab3('0x18')]?_0x1da252[_0x5ab3('0x18')][_0x5ab3('0x1a')]?_[_0x5ab3('0x1b')](_0x1da252[_0x5ab3('0x18')]['include'],function(_0x239894){return{'model':db[_0x239894[_0x5ab3('0x1c')]],'as':_0x239894['as'],'attributes':_0x239894[_0x5ab3('0x19')],'include':_0x239894[_0x5ab3('0x1a')]?_[_0x5ab3('0x1b')](_0x239894[_0x5ab3('0x1a')],function(_0x1d2ccd){return{'model':db[_0x1d2ccd[_0x5ab3('0x1c')]],'as':_0x1d2ccd['as'],'attributes':_0x1d2ccd['attributes'],'include':_0x1d2ccd[_0x5ab3('0x1a')]?_[_0x5ab3('0x1b')](_0x1d2ccd[_0x5ab3('0x1a')],function(_0x39b284){return{'model':db[_0x39b284[_0x5ab3('0x1c')]],'as':_0x39b284['as'],'attributes':_0x39b284['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x14dce6){logger[_0x5ab3('0xe')](_0x5ab3('0x1d'),_0x1da252);logger[_0x5ab3('0xf')](_0x5ab3('0x1d'),_0x1da252,JSON['stringify'](_0x14dce6));_0x577ed1(_0x14dce6);})[_0x5ab3('0x15')](function(_0x41674c){logger['error'](_0x5ab3('0x1d'),_0x41674c[_0x5ab3('0x14')],_0x1da252);_0x41b354(_0xd08125['error'](0x1f4,_0x41674c[_0x5ab3('0x14')]));});});}; \ No newline at end of file +var _0x5b8c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','ShowVariable','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0x5b8c,0x110));var _0xc5b8=function(_0xdcda3,_0x4252fb){_0xdcda3=_0xdcda3-0x0;var _0x2bec82=_0x5b8c[_0xdcda3];return _0x2bec82;};'use strict';var _=require(_0xc5b8('0x0'));var util=require(_0xc5b8('0x1'));var moment=require(_0xc5b8('0x2'));var BPromise=require(_0xc5b8('0x3'));var rs=require(_0xc5b8('0x4'));var fs=require('fs');var Redis=require(_0xc5b8('0x5'));var db=require(_0xc5b8('0x6'))['db'];var utils=require(_0xc5b8('0x7'));var logger=require(_0xc5b8('0x8'))(_0xc5b8('0x9'));var config=require(_0xc5b8('0xa'));var jayson=require(_0xc5b8('0xb'));var client=jayson['client'][_0xc5b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1190a1,_0x4c2806,_0x88c24){return new BPromise(function(_0x4cb0d9,_0x294ae5){return client['request'](_0x1190a1,_0x88c24)[_0xc5b8('0xd')](function(_0x1d0d6b){logger[_0xc5b8('0xe')](_0xc5b8('0xf'),_0x4c2806,_0xc5b8('0x10'));logger[_0xc5b8('0x11')](_0xc5b8('0x12'),_0x4c2806,_0xc5b8('0x10'),JSON['stringify'](_0x1d0d6b));if(_0x1d0d6b[_0xc5b8('0x13')]){if(_0x1d0d6b[_0xc5b8('0x13')]['code']===0x1f4){logger[_0xc5b8('0x13')](_0xc5b8('0xf'),_0x4c2806,_0x1d0d6b['error']['message']);return _0x294ae5(_0x1d0d6b['error'][_0xc5b8('0x14')]);}logger[_0xc5b8('0x13')](_0xc5b8('0xf'),_0x4c2806,_0x1d0d6b[_0xc5b8('0x13')][_0xc5b8('0x14')]);return _0x4cb0d9(_0x1d0d6b['error'][_0xc5b8('0x14')]);}else{logger[_0xc5b8('0xe')]('Variable,\x20%s,\x20%s',_0x4c2806,_0xc5b8('0x10'));_0x4cb0d9(_0x1d0d6b[_0xc5b8('0x15')][_0xc5b8('0x14')]);}})['catch'](function(_0x527fb8){logger[_0xc5b8('0x13')](_0xc5b8('0xf'),_0x4c2806,_0x527fb8);_0x294ae5(_0x527fb8);});});}exports[_0xc5b8('0x16')]=function(_0x51e8f4){var _0x2f2127=this;return new Promise(function(_0x2b0747,_0x2fadba){return db['Variable']['find']({'raw':_0x51e8f4[_0xc5b8('0x17')]?_0x51e8f4['options'][_0xc5b8('0x18')]===undefined?!![]:![]:!![],'where':_0x51e8f4[_0xc5b8('0x17')]?_0x51e8f4[_0xc5b8('0x17')][_0xc5b8('0x19')]||null:null,'attributes':_0x51e8f4[_0xc5b8('0x17')]?_0x51e8f4[_0xc5b8('0x17')][_0xc5b8('0x1a')]||null:null,'include':_0x51e8f4[_0xc5b8('0x17')]?_0x51e8f4[_0xc5b8('0x17')][_0xc5b8('0x1b')]?_[_0xc5b8('0x1c')](_0x51e8f4[_0xc5b8('0x17')]['include'],function(_0x36bead){return{'model':db[_0x36bead['model']],'as':_0x36bead['as'],'attributes':_0x36bead['attributes'],'include':_0x36bead['include']?_[_0xc5b8('0x1c')](_0x36bead['include'],function(_0x163702){return{'model':db[_0x163702[_0xc5b8('0x1d')]],'as':_0x163702['as'],'attributes':_0x163702[_0xc5b8('0x1a')],'include':_0x163702['include']?_[_0xc5b8('0x1c')](_0x163702['include'],function(_0x4bda45){return{'model':db[_0x4bda45[_0xc5b8('0x1d')]],'as':_0x4bda45['as'],'attributes':_0x4bda45[_0xc5b8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc5b8('0xd')](function(_0x26cb8b){logger[_0xc5b8('0xe')](_0xc5b8('0x16'),_0x51e8f4);logger[_0xc5b8('0x11')](_0xc5b8('0x16'),_0x51e8f4,JSON[_0xc5b8('0x1e')](_0x26cb8b));_0x2b0747(_0x26cb8b);})['catch'](function(_0x475f6b){logger['error'](_0xc5b8('0x16'),_0x475f6b[_0xc5b8('0x14')],_0x51e8f4);_0x2fadba(_0x2f2127[_0xc5b8('0x13')](0x1f4,_0x475f6b['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 501af39..a2c1610 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 _0x1521=['index','/fetch','canUpdate','/reset','isAuthenticated','reset','/pull','pull','/restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get'];(function(_0x476c5a,_0x822288){var _0x88a8b3=function(_0xad820e){while(--_0xad820e){_0x476c5a['push'](_0x476c5a['shift']());}};_0x88a8b3(++_0x822288);}(_0x1521,0x11c));var _0x1152=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x1521[_0xbd08b4];return _0x314f1e;};'use strict';var express=require('express');var router=express[_0x1152('0x0')]();var auth=require(_0x1152('0x1'));var controller=require(_0x1152('0x2'));router[_0x1152('0x3')]('/',controller[_0x1152('0x4')]);router[_0x1152('0x3')](_0x1152('0x5'),auth['isAuthenticated'](),auth[_0x1152('0x6')](),controller['fetch']);router[_0x1152('0x3')](_0x1152('0x7'),auth[_0x1152('0x8')](),auth['canUpdate'](),controller[_0x1152('0x9')]);router[_0x1152('0x3')](_0x1152('0xa'),auth['isAuthenticated'](),auth[_0x1152('0x6')](),controller[_0x1152('0xb')]);router[_0x1152('0x3')](_0x1152('0xc'),auth[_0x1152('0x8')](),controller['restart']);router[_0x1152('0x3')](_0x1152('0xd'),controller[_0x1152('0xe')]);module[_0x1152('0xf')]=router; \ No newline at end of file +var _0xa5a6=['get','/fetch','isAuthenticated','canUpdate','reset','/pull','restart','/migrations','exports','../../components/auth/service','./version.controller','index'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa5a6,0x1a1));var _0x6a5a=function(_0x82f586,_0x382c19){_0x82f586=_0x82f586-0x0;var _0x591ec8=_0xa5a6[_0x82f586];return _0x591ec8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x6a5a('0x0'));var controller=require(_0x6a5a('0x1'));router['get']('/',controller[_0x6a5a('0x2')]);router[_0x6a5a('0x3')](_0x6a5a('0x4'),auth[_0x6a5a('0x5')](),auth[_0x6a5a('0x6')](),controller['fetch']);router[_0x6a5a('0x3')]('/reset',auth['isAuthenticated'](),auth[_0x6a5a('0x6')](),controller[_0x6a5a('0x7')]);router['get'](_0x6a5a('0x8'),auth[_0x6a5a('0x5')](),auth[_0x6a5a('0x6')](),controller['pull']);router[_0x6a5a('0x3')]('/restart',auth[_0x6a5a('0x5')](),controller[_0x6a5a('0x9')]);router[_0x6a5a('0x3')](_0x6a5a('0xa'),controller['migrations']);module[_0x6a5a('0xb')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index f4c12a3..80a9922 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 _0x8a21=['../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','../../mysqldb'];(function(_0x449d1f,_0x8b9e56){var _0x4998af=function(_0x1365f3){while(--_0x1365f3){_0x449d1f['push'](_0x449d1f['shift']());}};_0x4998af(++_0x8b9e56);}(_0x8a21,0x1d8));var _0x18a2=function(_0x29d932,_0x97f2a7){_0x29d932=_0x29d932-0x0;var _0x5cd611=_0x8a21[_0x29d932];return _0x5cd611;};'use strict';var Umzug=require(_0x18a2('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x18a2('0x1'))(module,_0x18a2('0x2'));var compareVersions=require(_0x18a2('0x3'));var exec=require('child_process')['exec'];var db=require(_0x18a2('0x4'))['db'];var config=require(_0x18a2('0x5'));var pm2=require(_0x18a2('0x6'));var logger=require(_0x18a2('0x7'))(_0x18a2('0x8'));var git=require(_0x18a2('0x9'))(config[_0x18a2('0xa')]);exports[_0x18a2('0xb')]=function(_0x5d030e,_0x40d23c){var _0x2ed80f={'current':module[_0x18a2('0xc')]['version'],'phonebar':0x2};if(_0x5d030e[_0x18a2('0xd')]&&_0x5d030e[_0x18a2('0xd')][_0x18a2('0xe')]){return git[_0x18a2('0xf')]()[_0x18a2('0x10')](function(_0x54ce08,_0x44c60c){_0x2ed80f[_0x18a2('0xe')]=(_0x54ce08?module['exports'][_0x18a2('0x2')]:_0x44c60c[_0x18a2('0xe')])||'2.0.0';return _0x40d23c[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')](_0x2ed80f);});}else{return _0x40d23c['status'](0xc8)[_0x18a2('0x12')](_0x2ed80f);}};exports[_0x18a2('0xf')]=function(_0xab519a,_0x2d03c0){return git['fetch'](['origin',_0x18a2('0x13')],function(_0x537943){if(_0x537943){logger[_0x18a2('0x14')](_0x537943);return _0x2d03c0['status'](0x1f4)[_0x18a2('0x12')](_0x537943);}logger[_0x18a2('0x15')](_0x18a2('0x16'));return _0x2d03c0['status'](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x17')});});};exports[_0x18a2('0x18')]=function(_0xa5894d,_0x22296a){return git['reset']([_0x18a2('0x19'),'FETCH_HEAD'],function(_0x922c0e){if(_0x922c0e){logger['error'](_0x922c0e);return _0x22296a[_0x18a2('0x11')](0x1f4)[_0x18a2('0x12')](_0x922c0e);}logger[_0x18a2('0x15')](_0x18a2('0x1a'));return _0x22296a[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x1b')});});};exports[_0x18a2('0x1c')]=function(_0x5f3252,_0x2ac173){exec(_0x18a2('0x1d'),function(_0x3a063a,_0x5c5164,_0x1ed01f){logger[_0x18a2('0x15')](_0x5c5164);logger[_0x18a2('0x15')](_0x1ed01f);if(_0x3a063a){logger[_0x18a2('0x14')](_0x3a063a);return _0x2ac173[_0x18a2('0x11')](0x1f4)['json'](_0x3a063a);}return _0x2ac173['status'](0xc8)['json']({'output':_0x5c5164});});};exports[_0x18a2('0x1e')]=function(_0x1c0da1,_0x55f10c){return pm2[_0x18a2('0x1e')](_0x18a2('0x1f'))['then'](function(_0x4e7003){logger[_0x18a2('0x15')](_0x18a2('0x20'),_0x4e7003);return _0x55f10c[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x21')});})[_0x18a2('0x22')](function(_0x3e9543){logger[_0x18a2('0x14')](_0x3e9543);return _0x55f10c[_0x18a2('0x11')](0x1f4)[_0x18a2('0x12')](_0x3e9543);});};exports['migrations']=function(_0x43a4f8,_0x2df574){var _0x490410=fs[_0x18a2('0x23')](path[_0x18a2('0x24')](config[_0x18a2('0xa')],_0x18a2('0x25'),_0x18a2('0x26')));var _0x56b765=[];for(var _0x2bad4c=0x0;_0x2bad4c<_0x490410[_0x18a2('0x27')];_0x2bad4c++){var _0x368fd4=_0x490410[_0x2bad4c][_0x18a2('0x28')](_0x18a2('0x29'),'');if(compareVersions(module['exports'][_0x18a2('0x2')],_0x368fd4)===-0x1){_0x56b765[_0x18a2('0x2a')](_0x368fd4);}}if(_0x56b765[_0x18a2('0x27')]){var _0x11a086=_0x56b765['sort'](compareVersions);var _0x31c583=new Umzug({'storage':_0x18a2('0x2b'),'storageOptions':{'model':db[_0x18a2('0x2c')],'modelName':_0x18a2('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x18a2('0x2b')][_0x18a2('0x2d')](),db[_0x18a2('0x2b')][_0x18a2('0x2e')],function(){throw new Error(_0x18a2('0x2f'));}],'path':path[_0x18a2('0x24')](config['root'],_0x18a2('0x25'),_0x18a2('0x26')),'pattern':/\.js$/}});_0x31c583['up']({'migrations':_[_0x18a2('0x30')](_0x11a086,function(_0x24cd88){return _0x24cd88+_0x18a2('0x29');})})['then'](function(){return _0x2df574[_0x18a2('0x11')](0xc8)['json']({'output':_0x18a2('0x31')+module[_0x18a2('0xc')][_0x18a2('0x2')]+_0x18a2('0x32')+_['last'](_0x11a086),'migrations':_[_0x18a2('0x24')](_0x11a086)});})[_0x18a2('0x22')](function(_0x52ef03){if(_0x52ef03 instanceof db[_0x18a2('0x2b')][_0x18a2('0x33')]){return _0x2df574[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x34')});}else{return _0x2df574['status'](0x1f4)[_0x18a2('0x12')](_0x52ef03);}});}else{return _0x2df574[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x34')});}}; \ No newline at end of file +var _0x68fd=['git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','root','length','.js','sort','Migration','sequelize','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','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','version','query','fetch','latest','2.0.0','origin','master','error','status','json'];(function(_0x2bc188,_0xbcc2fc){var _0x3b0a0a=function(_0x1aa31e){while(--_0x1aa31e){_0x2bc188['push'](_0x2bc188['shift']());}};_0x3b0a0a(++_0xbcc2fc);}(_0x68fd,0x1e9));var _0xd68f=function(_0x1fae76,_0x2d852d){_0x1fae76=_0x1fae76-0x0;var _0x5e5bf1=_0x68fd[_0x1fae76];return _0x5e5bf1;};'use strict';var Umzug=require(_0xd68f('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xd68f('0x1'));var pkginfo=require(_0xd68f('0x2'))(module,'version');var compareVersions=require(_0xd68f('0x3'));var exec=require(_0xd68f('0x4'))[_0xd68f('0x5')];var db=require(_0xd68f('0x6'))['db'];var config=require(_0xd68f('0x7'));var pm2=require(_0xd68f('0x8'));var logger=require(_0xd68f('0x9'))(_0xd68f('0xa'));var git=require(_0xd68f('0xb'))(config['root']);exports[_0xd68f('0xc')]=function(_0x182353,_0x26f6ca){var _0x22c199={'current':module[_0xd68f('0xd')][_0xd68f('0xe')],'phonebar':0x2};if(_0x182353[_0xd68f('0xf')]&&_0x182353['query']['latest']){return git[_0xd68f('0x10')]()['tags'](function(_0x114bda,_0x41a7e7){_0x22c199[_0xd68f('0x11')]=(_0x114bda?module[_0xd68f('0xd')][_0xd68f('0xe')]:_0x41a7e7[_0xd68f('0x11')])||_0xd68f('0x12');return _0x26f6ca['status'](0xc8)['json'](_0x22c199);});}else{return _0x26f6ca['status'](0xc8)['json'](_0x22c199);}};exports[_0xd68f('0x10')]=function(_0x305c19,_0x48f357){return git[_0xd68f('0x10')]([_0xd68f('0x13'),_0xd68f('0x14')],function(_0x36441f){if(_0x36441f){logger[_0xd68f('0x15')](_0x36441f);return _0x48f357[_0xd68f('0x16')](0x1f4)[_0xd68f('0x17')](_0x36441f);}logger['info'](_0xd68f('0x18'));return _0x48f357['status'](0xc8)['json']({'output':_0xd68f('0x19')});});};exports[_0xd68f('0x1a')]=function(_0x451450,_0x3fdfbf){return git[_0xd68f('0x1a')]([_0xd68f('0x1b'),_0xd68f('0x1c')],function(_0x47fdbc){if(_0x47fdbc){logger['error'](_0x47fdbc);return _0x3fdfbf[_0xd68f('0x16')](0x1f4)[_0xd68f('0x17')](_0x47fdbc);}logger[_0xd68f('0x1d')](_0xd68f('0x1e'));return _0x3fdfbf[_0xd68f('0x16')](0xc8)['json']({'output':_0xd68f('0x1f')});});};exports[_0xd68f('0x20')]=function(_0x3fbc0b,_0x4e00c0){exec(_0xd68f('0x21'),function(_0x1379e2,_0xeba444,_0x590e04){logger['info'](_0xeba444);logger[_0xd68f('0x1d')](_0x590e04);if(_0x1379e2){logger['error'](_0x1379e2);return _0x4e00c0['status'](0x1f4)[_0xd68f('0x17')](_0x1379e2);}return _0x4e00c0[_0xd68f('0x16')](0xc8)[_0xd68f('0x17')]({'output':_0xeba444});});};exports[_0xd68f('0x22')]=function(_0x4595bf,_0x434fde){return pm2[_0xd68f('0x22')](_0xd68f('0x23'))[_0xd68f('0x24')](function(_0x2d2df4){logger[_0xd68f('0x1d')](_0xd68f('0x25'),_0x2d2df4);return _0x434fde[_0xd68f('0x16')](0xc8)['json']({'output':_0xd68f('0x26')});})[_0xd68f('0x27')](function(_0x4b1515){logger[_0xd68f('0x15')](_0x4b1515);return _0x434fde['status'](0x1f4)['json'](_0x4b1515);});};exports[_0xd68f('0x28')]=function(_0x42f8d2,_0x1eaebc){var _0x52a2dc=fs[_0xd68f('0x29')](path['join'](config[_0xd68f('0x2a')],'server',_0xd68f('0x28')));var _0x2dd737=[];for(var _0x426ad2=0x0;_0x426ad2<_0x52a2dc[_0xd68f('0x2b')];_0x426ad2++){var _0x38df7f=_0x52a2dc[_0x426ad2]['replace'](_0xd68f('0x2c'),'');if(compareVersions(module['exports'][_0xd68f('0xe')],_0x38df7f)===-0x1){_0x2dd737['push'](_0x38df7f);}}if(_0x2dd737[_0xd68f('0x2b')]){var _0x2d3b04=_0x2dd737[_0xd68f('0x2d')](compareVersions);var _0x1f6266=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xd68f('0x2e')],'modelName':_0xd68f('0x2e'),'columnName':_0xd68f('0xe')},'migrations':{'params':[db[_0xd68f('0x2f')]['getQueryInterface'](),db[_0xd68f('0x2f')][_0xd68f('0x30')],function(){throw new Error(_0xd68f('0x31'));}],'path':path[_0xd68f('0x32')](config[_0xd68f('0x2a')],_0xd68f('0x33'),_0xd68f('0x28')),'pattern':/\.js$/}});_0x1f6266['up']({'migrations':_[_0xd68f('0x34')](_0x2d3b04,function(_0x5590e0){return _0x5590e0+_0xd68f('0x2c');})})[_0xd68f('0x24')](function(){return _0x1eaebc[_0xd68f('0x16')](0xc8)[_0xd68f('0x17')]({'output':_0xd68f('0x35')+module[_0xd68f('0xd')][_0xd68f('0xe')]+_0xd68f('0x36')+_['last'](_0x2d3b04),'migrations':_[_0xd68f('0x32')](_0x2d3b04)});})[_0xd68f('0x27')](function(_0x13f773){if(_0x13f773 instanceof db[_0xd68f('0x2f')][_0xd68f('0x37')]){return _0x1eaebc['status'](0xc8)[_0xd68f('0x17')]({'output':_0xd68f('0x38')});}else{return _0x1eaebc[_0xd68f('0x16')](0x1f4)[_0xd68f('0x17')](_0x13f773);}});}else{return _0x1eaebc[_0xd68f('0x16')](0xc8)[_0xd68f('0x17')]({'output':_0xd68f('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 70ec50c..3083d1f 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 _0x7120=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4286ad,_0x5a99ed){var _0x4382d3=function(_0xdc43a8){while(--_0xdc43a8){_0x4286ad['push'](_0x4286ad['shift']());}};_0x4382d3(++_0x5a99ed);}(_0x7120,0x1ce));var _0x0712=function(_0x4b645e,_0x1a09f1){_0x4b645e=_0x4b645e-0x0;var _0x444da3=_0x7120[_0x4b645e];return _0x444da3;};'use strict';var multer=require(_0x0712('0x0'));var util=require(_0x0712('0x1'));var path=require(_0x0712('0x2'));var timeout=require(_0x0712('0x3'));var express=require(_0x0712('0x4'));var router=express[_0x0712('0x5')]();var auth=require(_0x0712('0x6'));var interaction=require(_0x0712('0x7'));var config=require(_0x0712('0x8'));var controller=require('./voiceAgentReport.controller');router[_0x0712('0x9')]('/',auth[_0x0712('0xa')](),controller[_0x0712('0xb')]);router[_0x0712('0x9')]('/describe',auth[_0x0712('0xa')](),controller[_0x0712('0xc')]);router[_0x0712('0x9')](_0x0712('0xd'),auth[_0x0712('0xa')](),controller['show']);router[_0x0712('0xe')]('/',auth[_0x0712('0xa')](),controller[_0x0712('0xf')]);router[_0x0712('0x10')]('/:id',auth[_0x0712('0xa')](),controller['update']);router['delete'](_0x0712('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0712('0x11')]=router; \ No newline at end of file +var _0x7124=['../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','exports','path','connect-timeout','express','Router'];(function(_0x46b756,_0x3ab820){var _0x3ec4ea=function(_0x26f76f){while(--_0x26f76f){_0x46b756['push'](_0x46b756['shift']());}};_0x3ec4ea(++_0x3ab820);}(_0x7124,0xc2));var _0x4712=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x7124[_0x173452];return _0xee3fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4712('0x0'));var timeout=require(_0x4712('0x1'));var express=require(_0x4712('0x2'));var router=express[_0x4712('0x3')]();var auth=require(_0x4712('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4712('0x5'));var controller=require(_0x4712('0x6'));router[_0x4712('0x7')]('/',auth[_0x4712('0x8')](),controller['index']);router[_0x4712('0x7')](_0x4712('0x9'),auth[_0x4712('0x8')](),controller[_0x4712('0xa')]);router['get'](_0x4712('0xb'),auth['isAuthenticated'](),controller[_0x4712('0xc')]);router[_0x4712('0xd')]('/',auth[_0x4712('0x8')](),controller[_0x4712('0xe')]);router[_0x4712('0xf')](_0x4712('0xb'),auth[_0x4712('0x8')](),controller['update']);router[_0x4712('0x10')](_0x4712('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4712('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 390097f..01e2430 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 _0xda19=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE'];(function(_0xfd3370,_0x200773){var _0x231cc8=function(_0x12b220){while(--_0x12b220){_0xfd3370['push'](_0xfd3370['shift']());}};_0x231cc8(++_0x200773);}(_0xda19,0xd5));var _0x9da1=function(_0x1de5b9,_0xc54801){_0x1de5b9=_0x1de5b9-0x0;var _0x53a4ab=_0xda19[_0x1de5b9];return _0x53a4ab;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'type':{'type':Sequelize[_0x9da1('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9da1('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9da1('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9da1('0x1')]},'agentcalledAt':{'type':Sequelize[_0x9da1('0x2')]},'agentconnectAt':{'type':Sequelize[_0x9da1('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x9da1('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x9da1('0x2')]},'agentdumpAt':{'type':Sequelize[_0x9da1('0x2')]},'holdtime':{'type':Sequelize[_0x9da1('0x3')]},'agentcomplete':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9da1('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9da1('0x1')]},'channelstate':{'type':Sequelize[_0x9da1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x9da1('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9da1('0x1')]},'connectedlinename':{'type':Sequelize[_0x9da1('0x1')]},'language':{'type':Sequelize[_0x9da1('0x1')]},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9da1('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x9da1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x9da1('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9da1('0x1')]},'destcalleridname':{'type':Sequelize[_0x9da1('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x9da1('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9da1('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9da1('0x1')]},'destuniqueid':{'type':Sequelize[_0x9da1('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9da1('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x9da1('0x1')]},'transfer':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9da1('0x5')},'transferexten':{'type':Sequelize[_0x9da1('0x1')]},'transferuniqueid':{'type':Sequelize[_0x9da1('0x1')]},'agententerreason':{'type':Sequelize[_0x9da1('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1cb9=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x2ab392,_0x25b98f){var _0x2c1a96=function(_0x592be3){while(--_0x592be3){_0x2ab392['push'](_0x2ab392['shift']());}};_0x2c1a96(++_0x25b98f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x192720,_0x12ae5c){_0x192720=_0x192720-0x0;var _0x4fe058=_0x1cb9[_0x192720];return _0x4fe058;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'type':{'type':Sequelize[_0x91cb('0x1')]},'uniqueid':{'type':Sequelize[_0x91cb('0x1')]},'calleridnum':{'type':Sequelize[_0x91cb('0x1')]},'calleridname':{'type':Sequelize[_0x91cb('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x91cb('0x1')]},'membername':{'type':Sequelize[_0x91cb('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x91cb('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x91cb('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x91cb('0x2')]},'agentdumpAt':{'type':Sequelize[_0x91cb('0x2')]},'holdtime':{'type':Sequelize[_0x91cb('0x3')]},'agentcomplete':{'type':Sequelize[_0x91cb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x91cb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x91cb('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x91cb('0x1')]},'lastevent':{'type':Sequelize[_0x91cb('0x1')]},'channel':{'type':Sequelize[_0x91cb('0x1')]},'channelstate':{'type':Sequelize[_0x91cb('0x3')]},'channelstatedesc':{'type':Sequelize[_0x91cb('0x1')]},'connectedlinenum':{'type':Sequelize[_0x91cb('0x1')]},'connectedlinename':{'type':Sequelize[_0x91cb('0x1')]},'language':{'type':Sequelize[_0x91cb('0x1')]},'accountcode':{'type':Sequelize[_0x91cb('0x1')]},'context':{'type':Sequelize[_0x91cb('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x91cb('0x1')]},'destchannel':{'type':Sequelize[_0x91cb('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x91cb('0x1')]},'destcalleridnum':{'type':Sequelize[_0x91cb('0x1')]},'destcalleridname':{'type':Sequelize[_0x91cb('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x91cb('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x91cb('0x1')]},'destcontext':{'type':Sequelize[_0x91cb('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x91cb('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x91cb('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x91cb('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x91cb('0x1')],'comment':_0x91cb('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x91cb('0x1')]},'agententerreason':{'type':Sequelize[_0x91cb('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 2acaa16..45fcbc6 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 _0x4292=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','VoiceAgentReport','includeAll','include','rows','catch','show','find','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x20355f,_0x42f61d){var _0x4372a5=function(_0x3df89e){while(--_0x3df89e){_0x20355f['push'](_0x20355f['shift']());}};_0x4372a5(++_0x42f61d);}(_0x4292,0x1b1));var _0x2429=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0x4292[_0x552fce];return _0x3e27a2;};'use strict';var pdf=require(_0x2429('0x0'));var emlformat=require(_0x2429('0x1'));var rimraf=require(_0x2429('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2429('0x3'));var rp=require(_0x2429('0x4'));var moment=require(_0x2429('0x5'));var BPromise=require(_0x2429('0x6'));var Mustache=require(_0x2429('0x7'));var util=require(_0x2429('0x8'));var path=require(_0x2429('0x9'));var sox=require(_0x2429('0xa'));var csv=require(_0x2429('0xb'));var ejs=require(_0x2429('0xc'));var fs=require('fs');var _=require(_0x2429('0xd'));var squel=require(_0x2429('0xe'));var crypto=require(_0x2429('0xf'));var jsforce=require(_0x2429('0x10'));var deskjs=require(_0x2429('0x11'));var toCsv=require(_0x2429('0xb'));var querystring=require('querystring');var Papa=require(_0x2429('0x12'));var Redis=require(_0x2429('0x13'));var authService=require(_0x2429('0x14'));var qs=require(_0x2429('0x15'));var as=require(_0x2429('0x16'));var hardwareService=require(_0x2429('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2429('0x18'));var config=require(_0x2429('0x19'));var db=require(_0x2429('0x1a'))['db'];function respondWithStatusCode(_0x2ed4df,_0x879685){_0x879685=_0x879685||0xcc;return function(_0x456988){if(_0x456988){return _0x2ed4df[_0x2429('0x1b')](_0x879685);}return _0x2ed4df[_0x2429('0x1c')](_0x879685)[_0x2429('0x1d')]();};}function respondWithResult(_0x253939,_0x146f69){_0x146f69=_0x146f69||0xc8;return function(_0x3cb437){if(_0x3cb437){return _0x253939['status'](_0x146f69)[_0x2429('0x1e')](_0x3cb437);}};}function respondWithFilteredResult(_0x32ed55,_0x2db614){return function(_0x2075f2){if(_0x2075f2){var _0x420b55=_0x2075f2[_0x2429('0x1f')],_0x5343c2=_0x2db614[_0x2429('0x20')],_0xfcc5c3=_0x2db614[_0x2429('0x20')]+_0x2db614[_0x2429('0x21')],_0x15e3cd;if(_0xfcc5c3>=_0x420b55){_0xfcc5c3=_0x420b55;_0x15e3cd=0xc8;}else{_0x15e3cd=0xce;}_0x32ed55[_0x2429('0x1c')](_0x15e3cd);return _0x32ed55['set'](_0x2429('0x22'),_0x5343c2+'-'+_0xfcc5c3+'/'+_0x420b55)[_0x2429('0x1e')](_0x2075f2);}return null;};}function patchUpdates(_0x324f55){return function(_0x576de1){try{jsonpatch[_0x2429('0x23')](_0x576de1,_0x324f55,!![]);}catch(_0x422008){return BPromise[_0x2429('0x24')](_0x422008);}return _0x576de1[_0x2429('0x25')]();};}function saveUpdates(_0x56335a,_0x398385){return function(_0x46add4){if(_0x46add4){return _0x46add4[_0x2429('0x26')](_0x56335a)[_0x2429('0x27')](function(_0x1b5ee3){return _0x1b5ee3;});}return null;};}function removeEntity(_0x2edda7,_0x3a8066){return function(_0x3db81f){if(_0x3db81f){return _0x3db81f[_0x2429('0x28')]()[_0x2429('0x27')](function(){_0x2edda7[_0x2429('0x1c')](0xcc)[_0x2429('0x1d')]();});}};}function handleEntityNotFound(_0x3c5377,_0x34a33d){return function(_0x3bdec2){if(!_0x3bdec2){_0x3c5377[_0x2429('0x1b')](0x194);}return _0x3bdec2;};}function handleError(_0x4acc81,_0xe990d6){_0xe990d6=_0xe990d6||0x1f4;return function(_0x4e0b45){logger[_0x2429('0x29')](_0x4e0b45['stack']);if(_0x4e0b45[_0x2429('0x2a')]){delete _0x4e0b45[_0x2429('0x2a')];}_0x4acc81[_0x2429('0x1c')](_0xe990d6)[_0x2429('0x2b')](_0x4e0b45);};}exports['index']=function(_0x17109b,_0x183aba){var _0x103379={},_0x5e8281={},_0x11b282={'count':0x0,'rows':[]};var _0x57f664=_['map'](db['VoiceAgentReport'][_0x2429('0x2c')],function(_0x201dd0){return{'name':_0x201dd0[_0x2429('0x2d')],'type':_0x201dd0[_0x2429('0x2e')]['key']};});_0x5e8281[_0x2429('0x2f')]=_[_0x2429('0x30')](_0x57f664,_0x2429('0x2a'));_0x5e8281[_0x2429('0x31')]=_[_0x2429('0x32')](_0x17109b[_0x2429('0x31')]);_0x5e8281['filters']=_[_0x2429('0x33')](_0x5e8281[_0x2429('0x2f')],_0x5e8281['query']);_0x103379[_0x2429('0x34')]=_['intersection'](_0x5e8281[_0x2429('0x2f')],qs[_0x2429('0x35')](_0x17109b[_0x2429('0x31')]['fields']));_0x103379[_0x2429('0x34')]=_0x103379[_0x2429('0x34')][_0x2429('0x36')]?_0x103379[_0x2429('0x34')]:_0x5e8281[_0x2429('0x2f')];if(!_0x17109b[_0x2429('0x31')][_0x2429('0x37')](_0x2429('0x38'))){_0x103379[_0x2429('0x21')]=qs[_0x2429('0x21')](_0x17109b[_0x2429('0x31')]['limit']);_0x103379[_0x2429('0x20')]=qs[_0x2429('0x20')](_0x17109b[_0x2429('0x31')]['offset']);}_0x103379[_0x2429('0x39')]=qs['sort'](_0x17109b[_0x2429('0x31')][_0x2429('0x3a')]);_0x103379[_0x2429('0x3b')]=qs[_0x2429('0x3c')](_['pick'](_0x17109b['query'],_0x5e8281[_0x2429('0x3c')]),_0x57f664);if(_0x17109b[_0x2429('0x31')]['filter']){_0x103379[_0x2429('0x3b')]=_['merge'](_0x103379[_0x2429('0x3b')],{'$or':_[_0x2429('0x30')](_0x57f664,function(_0x392c15){if(_0x392c15[_0x2429('0x2e')]!==_0x2429('0x3d')){var _0x589e91={};_0x589e91[_0x392c15['name']]={'$like':'%'+_0x17109b[_0x2429('0x31')][_0x2429('0x3e')]+'%'};return _0x589e91;}})});}_0x103379=_[_0x2429('0x3f')]({},_0x103379,_0x17109b[_0x2429('0x40')]);var _0x13cec6={'where':_0x103379[_0x2429('0x3b')]};return db[_0x2429('0x41')][_0x2429('0x1f')](_0x13cec6)['then'](function(_0x2e2f0a){_0x11b282[_0x2429('0x1f')]=_0x2e2f0a;if(_0x17109b[_0x2429('0x31')][_0x2429('0x42')]){_0x103379[_0x2429('0x43')]=[{'all':!![]}];}return db[_0x2429('0x41')]['findAll'](_0x103379);})[_0x2429('0x27')](function(_0x376968){_0x11b282[_0x2429('0x44')]=_0x376968;return _0x11b282;})[_0x2429('0x27')](respondWithFilteredResult(_0x183aba,_0x103379))[_0x2429('0x45')](handleError(_0x183aba,null));};exports[_0x2429('0x46')]=function(_0x27959d,_0x470ef3){var _0x6d967b={'raw':![],'where':{'id':_0x27959d['params']['id']}},_0x46ecc2={};_0x46ecc2[_0x2429('0x2f')]=_[_0x2429('0x32')](db[_0x2429('0x41')][_0x2429('0x2c')]);_0x46ecc2['query']=_[_0x2429('0x32')](_0x27959d[_0x2429('0x31')]);_0x46ecc2[_0x2429('0x3c')]=_[_0x2429('0x33')](_0x46ecc2[_0x2429('0x2f')],_0x46ecc2[_0x2429('0x31')]);_0x6d967b['attributes']=_['intersection'](_0x46ecc2['model'],qs['fields'](_0x27959d[_0x2429('0x31')][_0x2429('0x35')]));_0x6d967b[_0x2429('0x34')]=_0x6d967b[_0x2429('0x34')][_0x2429('0x36')]?_0x6d967b[_0x2429('0x34')]:_0x46ecc2['model'];if(_0x27959d['query'][_0x2429('0x42')]){_0x6d967b[_0x2429('0x43')]=[{'all':!![]}];}_0x6d967b=_['merge']({},_0x6d967b,_0x27959d[_0x2429('0x40')]);return db[_0x2429('0x41')][_0x2429('0x47')](_0x6d967b)[_0x2429('0x27')](handleEntityNotFound(_0x470ef3,null))[_0x2429('0x27')](respondWithResult(_0x470ef3,null))[_0x2429('0x45')](handleError(_0x470ef3,null));};exports['create']=function(_0x5cfce8,_0x4f35b8){return db[_0x2429('0x41')]['create'](_0x5cfce8['body'],{})[_0x2429('0x27')](respondWithResult(_0x4f35b8,0xc9))[_0x2429('0x45')](handleError(_0x4f35b8,null));};exports[_0x2429('0x26')]=function(_0x5ea70c,_0x168bbb){if(_0x5ea70c[_0x2429('0x48')]['id']){delete _0x5ea70c['body']['id'];}return db[_0x2429('0x41')][_0x2429('0x47')]({'where':{'id':_0x5ea70c[_0x2429('0x49')]['id']}})['then'](handleEntityNotFound(_0x168bbb,null))[_0x2429('0x27')](saveUpdates(_0x5ea70c[_0x2429('0x48')],null))[_0x2429('0x27')](respondWithResult(_0x168bbb,null))['catch'](handleError(_0x168bbb,null));};exports[_0x2429('0x28')]=function(_0x181d50,_0x1b8a7e){return db['VoiceAgentReport']['find']({'where':{'id':_0x181d50['params']['id']}})[_0x2429('0x27')](handleEntityNotFound(_0x1b8a7e,null))[_0x2429('0x27')](removeEntity(_0x1b8a7e,null))[_0x2429('0x45')](handleError(_0x1b8a7e,null));};exports['describe']=function(_0x1eb1c8,_0x216371){return db[_0x2429('0x41')]['describe']()[_0x2429('0x27')](respondWithResult(_0x216371,null))[_0x2429('0x45')](handleError(_0x216371,null));}; \ No newline at end of file +var _0x5f80=['destroy','sendStatus','error','stack','name','send','index','map','VoiceAgentReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','limit','set','Content-Range','json','apply','save','update','then'];(function(_0x59166d,_0x415c2d){var _0x2184e1=function(_0xb7af45){while(--_0xb7af45){_0x59166d['push'](_0x59166d['shift']());}};_0x2184e1(++_0x415c2d);}(_0x5f80,0x1dd));var _0x05f8=function(_0x1e4638,_0x98fe2d){_0x1e4638=_0x1e4638-0x0;var _0x2c5a34=_0x5f80[_0x1e4638];return _0x2c5a34;};'use strict';var pdf=require(_0x05f8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x05f8('0x1'));var zipdir=require(_0x05f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x05f8('0x3'));var BPromise=require(_0x05f8('0x4'));var Mustache=require(_0x05f8('0x5'));var util=require('util');var path=require(_0x05f8('0x6'));var sox=require(_0x05f8('0x7'));var csv=require(_0x05f8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x05f8('0x9'));var squel=require(_0x05f8('0xa'));var crypto=require(_0x05f8('0xb'));var jsforce=require(_0x05f8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x05f8('0x8'));var querystring=require(_0x05f8('0xd'));var Papa=require(_0x05f8('0xe'));var Redis=require(_0x05f8('0xf'));var authService=require(_0x05f8('0x10'));var qs=require(_0x05f8('0x11'));var as=require(_0x05f8('0x12'));var hardwareService=require(_0x05f8('0x13'));var logger=require(_0x05f8('0x14'))(_0x05f8('0x15'));var utils=require(_0x05f8('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31b73c,_0x4998fc){_0x4998fc=_0x4998fc||0xcc;return function(_0x4a1912){if(_0x4a1912){return _0x31b73c['sendStatus'](_0x4998fc);}return _0x31b73c[_0x05f8('0x17')](_0x4998fc)[_0x05f8('0x18')]();};}function respondWithResult(_0x4c857e,_0x5f5b37){_0x5f5b37=_0x5f5b37||0xc8;return function(_0xc1ba0c){if(_0xc1ba0c){return _0x4c857e[_0x05f8('0x17')](_0x5f5b37)['json'](_0xc1ba0c);}};}function respondWithFilteredResult(_0xaede42,_0x124bc9){return function(_0x285f2c){if(_0x285f2c){var _0x5e4989=_0x285f2c['count'],_0x914a41=_0x124bc9[_0x05f8('0x19')],_0x1c42c2=_0x124bc9['offset']+_0x124bc9[_0x05f8('0x1a')],_0x10d877;if(_0x1c42c2>=_0x5e4989){_0x1c42c2=_0x5e4989;_0x10d877=0xc8;}else{_0x10d877=0xce;}_0xaede42[_0x05f8('0x17')](_0x10d877);return _0xaede42[_0x05f8('0x1b')](_0x05f8('0x1c'),_0x914a41+'-'+_0x1c42c2+'/'+_0x5e4989)[_0x05f8('0x1d')](_0x285f2c);}return null;};}function patchUpdates(_0x1f932e){return function(_0x240aac){try{jsonpatch[_0x05f8('0x1e')](_0x240aac,_0x1f932e,!![]);}catch(_0x284aee){return BPromise['reject'](_0x284aee);}return _0x240aac[_0x05f8('0x1f')]();};}function saveUpdates(_0x346e3f,_0x328d70){return function(_0x51a552){if(_0x51a552){return _0x51a552[_0x05f8('0x20')](_0x346e3f)[_0x05f8('0x21')](function(_0x27b25b){return _0x27b25b;});}return null;};}function removeEntity(_0x276bb3,_0x46d879){return function(_0xf22666){if(_0xf22666){return _0xf22666[_0x05f8('0x22')]()[_0x05f8('0x21')](function(){_0x276bb3[_0x05f8('0x17')](0xcc)[_0x05f8('0x18')]();});}};}function handleEntityNotFound(_0x43fbc5,_0x462838){return function(_0x2c70e3){if(!_0x2c70e3){_0x43fbc5[_0x05f8('0x23')](0x194);}return _0x2c70e3;};}function handleError(_0x4d272a,_0x13c54d){_0x13c54d=_0x13c54d||0x1f4;return function(_0x28ce9f){logger[_0x05f8('0x24')](_0x28ce9f[_0x05f8('0x25')]);if(_0x28ce9f[_0x05f8('0x26')]){delete _0x28ce9f[_0x05f8('0x26')];}_0x4d272a[_0x05f8('0x17')](_0x13c54d)[_0x05f8('0x27')](_0x28ce9f);};}exports[_0x05f8('0x28')]=function(_0x46d1a9,_0x3a7fba){var _0x3176ac={},_0xdbb2f5={},_0x39ddfe={'count':0x0,'rows':[]};var _0x5b9d53=_[_0x05f8('0x29')](db[_0x05f8('0x2a')]['rawAttributes'],function(_0x36a7d1){return{'name':_0x36a7d1[_0x05f8('0x2b')],'type':_0x36a7d1['type'][_0x05f8('0x2c')]};});_0xdbb2f5[_0x05f8('0x2d')]=_[_0x05f8('0x29')](_0x5b9d53,_0x05f8('0x26'));_0xdbb2f5[_0x05f8('0x2e')]=_[_0x05f8('0x2f')](_0x46d1a9[_0x05f8('0x2e')]);_0xdbb2f5[_0x05f8('0x30')]=_[_0x05f8('0x31')](_0xdbb2f5[_0x05f8('0x2d')],_0xdbb2f5['query']);_0x3176ac[_0x05f8('0x32')]=_['intersection'](_0xdbb2f5[_0x05f8('0x2d')],qs['fields'](_0x46d1a9['query'][_0x05f8('0x33')]));_0x3176ac[_0x05f8('0x32')]=_0x3176ac['attributes'][_0x05f8('0x34')]?_0x3176ac[_0x05f8('0x32')]:_0xdbb2f5[_0x05f8('0x2d')];if(!_0x46d1a9[_0x05f8('0x2e')][_0x05f8('0x35')]('nolimit')){_0x3176ac[_0x05f8('0x1a')]=qs[_0x05f8('0x1a')](_0x46d1a9[_0x05f8('0x2e')][_0x05f8('0x1a')]);_0x3176ac[_0x05f8('0x19')]=qs[_0x05f8('0x19')](_0x46d1a9[_0x05f8('0x2e')][_0x05f8('0x19')]);}_0x3176ac[_0x05f8('0x36')]=qs[_0x05f8('0x37')](_0x46d1a9[_0x05f8('0x2e')][_0x05f8('0x37')]);_0x3176ac[_0x05f8('0x38')]=qs[_0x05f8('0x30')](_['pick'](_0x46d1a9[_0x05f8('0x2e')],_0xdbb2f5[_0x05f8('0x30')]),_0x5b9d53);if(_0x46d1a9[_0x05f8('0x2e')][_0x05f8('0x39')]){_0x3176ac[_0x05f8('0x38')]=_[_0x05f8('0x3a')](_0x3176ac['where'],{'$or':_['map'](_0x5b9d53,function(_0x6d9f3d){if(_0x6d9f3d[_0x05f8('0x3b')]!=='VIRTUAL'){var _0x2d3e33={};_0x2d3e33[_0x6d9f3d[_0x05f8('0x26')]]={'$like':'%'+_0x46d1a9['query'][_0x05f8('0x39')]+'%'};return _0x2d3e33;}})});}_0x3176ac=_[_0x05f8('0x3a')]({},_0x3176ac,_0x46d1a9[_0x05f8('0x3c')]);var _0x31d936={'where':_0x3176ac[_0x05f8('0x38')]};return db['VoiceAgentReport']['count'](_0x31d936)[_0x05f8('0x21')](function(_0x4ec369){_0x39ddfe[_0x05f8('0x3d')]=_0x4ec369;if(_0x46d1a9['query'][_0x05f8('0x3e')]){_0x3176ac[_0x05f8('0x3f')]=[{'all':!![]}];}return db[_0x05f8('0x2a')][_0x05f8('0x40')](_0x3176ac);})['then'](function(_0x3ea5a8){_0x39ddfe[_0x05f8('0x41')]=_0x3ea5a8;return _0x39ddfe;})['then'](respondWithFilteredResult(_0x3a7fba,_0x3176ac))[_0x05f8('0x42')](handleError(_0x3a7fba,null));};exports[_0x05f8('0x43')]=function(_0x5df9fd,_0x327e3e){var _0x1463a7={'raw':![],'where':{'id':_0x5df9fd['params']['id']}},_0x1c3898={};_0x1c3898[_0x05f8('0x2d')]=_[_0x05f8('0x2f')](db[_0x05f8('0x2a')]['rawAttributes']);_0x1c3898[_0x05f8('0x2e')]=_[_0x05f8('0x2f')](_0x5df9fd[_0x05f8('0x2e')]);_0x1c3898[_0x05f8('0x30')]=_['intersection'](_0x1c3898[_0x05f8('0x2d')],_0x1c3898[_0x05f8('0x2e')]);_0x1463a7[_0x05f8('0x32')]=_['intersection'](_0x1c3898['model'],qs[_0x05f8('0x33')](_0x5df9fd[_0x05f8('0x2e')][_0x05f8('0x33')]));_0x1463a7[_0x05f8('0x32')]=_0x1463a7[_0x05f8('0x32')]['length']?_0x1463a7[_0x05f8('0x32')]:_0x1c3898[_0x05f8('0x2d')];if(_0x5df9fd[_0x05f8('0x2e')][_0x05f8('0x3e')]){_0x1463a7[_0x05f8('0x3f')]=[{'all':!![]}];}_0x1463a7=_[_0x05f8('0x3a')]({},_0x1463a7,_0x5df9fd[_0x05f8('0x3c')]);return db[_0x05f8('0x2a')][_0x05f8('0x44')](_0x1463a7)[_0x05f8('0x21')](handleEntityNotFound(_0x327e3e,null))[_0x05f8('0x21')](respondWithResult(_0x327e3e,null))[_0x05f8('0x42')](handleError(_0x327e3e,null));};exports[_0x05f8('0x45')]=function(_0x3ccae3,_0x3e4ba3){return db['VoiceAgentReport']['create'](_0x3ccae3['body'],{})[_0x05f8('0x21')](respondWithResult(_0x3e4ba3,0xc9))[_0x05f8('0x42')](handleError(_0x3e4ba3,null));};exports[_0x05f8('0x20')]=function(_0x49dbb4,_0x1bb1cd){if(_0x49dbb4['body']['id']){delete _0x49dbb4[_0x05f8('0x46')]['id'];}return db[_0x05f8('0x2a')][_0x05f8('0x44')]({'where':{'id':_0x49dbb4[_0x05f8('0x47')]['id']}})[_0x05f8('0x21')](handleEntityNotFound(_0x1bb1cd,null))['then'](saveUpdates(_0x49dbb4[_0x05f8('0x46')],null))[_0x05f8('0x21')](respondWithResult(_0x1bb1cd,null))[_0x05f8('0x42')](handleError(_0x1bb1cd,null));};exports[_0x05f8('0x22')]=function(_0x13dcd1,_0x33a3cd){return db[_0x05f8('0x2a')]['find']({'where':{'id':_0x13dcd1['params']['id']}})[_0x05f8('0x21')](handleEntityNotFound(_0x33a3cd,null))[_0x05f8('0x21')](removeEntity(_0x33a3cd,null))[_0x05f8('0x42')](handleError(_0x33a3cd,null));};exports[_0x05f8('0x48')]=function(_0x23cfed,_0x4afdc1){return db[_0x05f8('0x2a')][_0x05f8('0x48')]()[_0x05f8('0x21')](respondWithResult(_0x4afdc1,null))['catch'](handleError(_0x4afdc1,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index e964958..7b9e41b 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 _0x9c44=['report_agent','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','define','VoiceAgentReport'];(function(_0x37e8c0,_0x5ccede){var _0xb098e4=function(_0x5a682a){while(--_0x5a682a){_0x37e8c0['push'](_0x37e8c0['shift']());}};_0xb098e4(++_0x5ccede);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x49c4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['report_agent','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','define','VoiceAgentReport'];(function(_0xfd3a03,_0x232f89){var _0x3b3380=function(_0x2b59fc){while(--_0x2b59fc){_0xfd3a03['push'](_0xfd3a03['shift']());}};_0x3b3380(++_0x232f89);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x49c4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index be78f52..d2e8ebb 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 _0xe17f=['UpdateVoiceAgentReport','update','body','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw'];(function(_0x49f836,_0x4f1d95){var _0x3a74db=function(_0x8c46c2){while(--_0x8c46c2){_0x49f836['push'](_0x49f836['shift']());}};_0x3a74db(++_0x4f1d95);}(_0xe17f,0x1ce));var _0xfe17=function(_0x24a86a,_0x3a9dfd){_0x24a86a=_0x24a86a-0x0;var _0x30bbef=_0xe17f[_0x24a86a];return _0x30bbef;};'use strict';var _=require(_0xfe17('0x0'));var util=require(_0xfe17('0x1'));var moment=require(_0xfe17('0x2'));var BPromise=require(_0xfe17('0x3'));var rs=require(_0xfe17('0x4'));var fs=require('fs');var Redis=require(_0xfe17('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe17('0x6'));var logger=require(_0xfe17('0x7'))(_0xfe17('0x8'));var config=require('../../config/environment');var jayson=require(_0xfe17('0x9'));var client=jayson[_0xfe17('0xa')][_0xfe17('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1eb9de,_0x139942,_0xd0e777){return new BPromise(function(_0x2ba31b,_0x34d02f){return client[_0xfe17('0xc')](_0x1eb9de,_0xd0e777)['then'](function(_0x3304ba){logger[_0xfe17('0xd')](_0xfe17('0xe'),_0x139942,_0xfe17('0xf'));logger[_0xfe17('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x139942,_0xfe17('0xf'),JSON[_0xfe17('0x11')](_0x3304ba));if(_0x3304ba[_0xfe17('0x12')]){if(_0x3304ba[_0xfe17('0x12')][_0xfe17('0x13')]===0x1f4){logger[_0xfe17('0x12')](_0xfe17('0xe'),_0x139942,_0x3304ba['error'][_0xfe17('0x14')]);return _0x34d02f(_0x3304ba[_0xfe17('0x12')][_0xfe17('0x14')]);}logger['error'](_0xfe17('0xe'),_0x139942,_0x3304ba[_0xfe17('0x12')]['message']);return _0x2ba31b(_0x3304ba[_0xfe17('0x12')][_0xfe17('0x14')]);}else{logger[_0xfe17('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x139942,_0xfe17('0xf'));_0x2ba31b(_0x3304ba[_0xfe17('0x15')][_0xfe17('0x14')]);}})[_0xfe17('0x16')](function(_0x2a4b05){logger[_0xfe17('0x12')](_0xfe17('0xe'),_0x139942,_0x2a4b05);_0x34d02f(_0x2a4b05);});});}exports[_0xfe17('0x17')]=function(_0x513298){var _0x2c79ea=this;return new Promise(function(_0x2232ee,_0x3fa329){return db[_0xfe17('0x18')][_0xfe17('0x19')](_0x513298['body'],{'raw':_0x513298[_0xfe17('0x1a')]?_0x513298[_0xfe17('0x1a')][_0xfe17('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x307904){logger['info'](_0xfe17('0x17'),_0x513298);logger[_0xfe17('0x10')]('CreateVoiceAgentReport',_0x513298,JSON[_0xfe17('0x11')](_0x307904));_0x2232ee(_0x307904);})[_0xfe17('0x16')](function(_0x2bcf29){logger[_0xfe17('0x12')](_0xfe17('0x17'),_0x2bcf29[_0xfe17('0x14')],_0x513298);_0x3fa329(_0x2c79ea[_0xfe17('0x12')](0x1f4,_0x2bcf29[_0xfe17('0x14')]));});});};exports[_0xfe17('0x1c')]=function(_0xb699f8){var _0xafb033=this;return new Promise(function(_0x24ab00,_0x290129){return db[_0xfe17('0x18')][_0xfe17('0x1d')](_0xb699f8[_0xfe17('0x1e')],{'raw':_0xb699f8[_0xfe17('0x1a')]?_0xb699f8['options'][_0xfe17('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb699f8['options']?_0xb699f8[_0xfe17('0x1a')][_0xfe17('0x1f')]||null:null,'attributes':_0xb699f8['options']?_0xb699f8[_0xfe17('0x1a')][_0xfe17('0x20')]||null:null,'limit':_0xb699f8[_0xfe17('0x1a')]?_0xb699f8[_0xfe17('0x1a')][_0xfe17('0x21')]||null:null})[_0xfe17('0x22')](function(_0x2bb31d){logger[_0xfe17('0xd')]('UpdateVoiceAgentReport',_0xb699f8);logger['debug']('UpdateVoiceAgentReport',_0xb699f8,JSON[_0xfe17('0x11')](_0x2bb31d));_0x24ab00(_0x2bb31d);})['catch'](function(_0x515496){logger[_0xfe17('0x12')](_0xfe17('0x1c'),_0x515496[_0xfe17('0x14')],_0xb699f8);_0x290129(_0xafb033[_0xfe17('0x12')](0x1f4,_0x515496[_0xfe17('0x14')]));});});}; \ No newline at end of file +var _0x761a=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','update','where','attributes','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x761a,0x1b2));var _0xa761=function(_0x373ce6,_0x1a0131){_0x373ce6=_0x373ce6-0x0;var _0x49c3b3=_0x761a[_0x373ce6];return _0x49c3b3;};'use strict';var _=require(_0xa761('0x0'));var util=require(_0xa761('0x1'));var moment=require(_0xa761('0x2'));var BPromise=require(_0xa761('0x3'));var rs=require(_0xa761('0x4'));var fs=require('fs');var Redis=require(_0xa761('0x5'));var db=require(_0xa761('0x6'))['db'];var utils=require(_0xa761('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa761('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa761('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b8e50,_0x385a40,_0x10057a){return new BPromise(function(_0xa75c70,_0x1220c5){return client[_0xa761('0xa')](_0x3b8e50,_0x10057a)[_0xa761('0xb')](function(_0x1372ee){logger[_0xa761('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x385a40,'request\x20sent');logger[_0xa761('0xd')](_0xa761('0xe'),_0x385a40,'request\x20sent',JSON[_0xa761('0xf')](_0x1372ee));if(_0x1372ee[_0xa761('0x10')]){if(_0x1372ee[_0xa761('0x10')][_0xa761('0x11')]===0x1f4){logger[_0xa761('0x10')](_0xa761('0x12'),_0x385a40,_0x1372ee[_0xa761('0x10')]['message']);return _0x1220c5(_0x1372ee[_0xa761('0x10')][_0xa761('0x13')]);}logger[_0xa761('0x10')](_0xa761('0x12'),_0x385a40,_0x1372ee[_0xa761('0x10')]['message']);return _0xa75c70(_0x1372ee[_0xa761('0x10')][_0xa761('0x13')]);}else{logger[_0xa761('0xc')](_0xa761('0x12'),_0x385a40,_0xa761('0x14'));_0xa75c70(_0x1372ee[_0xa761('0x15')][_0xa761('0x13')]);}})[_0xa761('0x16')](function(_0x3f302d){logger[_0xa761('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x385a40,_0x3f302d);_0x1220c5(_0x3f302d);});});}exports[_0xa761('0x17')]=function(_0x3cfcea){var _0x1af2d7=this;return new Promise(function(_0x388912,_0xa43ffc){return db[_0xa761('0x18')][_0xa761('0x19')](_0x3cfcea[_0xa761('0x1a')],{'raw':_0x3cfcea[_0xa761('0x1b')]?_0x3cfcea[_0xa761('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xa761('0xb')](function(_0x46cfca){logger[_0xa761('0xc')]('CreateVoiceAgentReport',_0x3cfcea);logger['debug'](_0xa761('0x17'),_0x3cfcea,JSON['stringify'](_0x46cfca));_0x388912(_0x46cfca);})[_0xa761('0x16')](function(_0x1e413b){logger[_0xa761('0x10')](_0xa761('0x17'),_0x1e413b[_0xa761('0x13')],_0x3cfcea);_0xa43ffc(_0x1af2d7['error'](0x1f4,_0x1e413b[_0xa761('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x199abb){var _0x5df178=this;return new Promise(function(_0xda9c42,_0x3ad18b){return db[_0xa761('0x18')][_0xa761('0x1c')](_0x199abb[_0xa761('0x1a')],{'raw':_0x199abb[_0xa761('0x1b')]?_0x199abb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x199abb[_0xa761('0x1b')]?_0x199abb[_0xa761('0x1b')][_0xa761('0x1d')]||null:null,'attributes':_0x199abb['options']?_0x199abb[_0xa761('0x1b')][_0xa761('0x1e')]||null:null,'limit':_0x199abb[_0xa761('0x1b')]?_0x199abb[_0xa761('0x1b')]['limit']||null:null})[_0xa761('0xb')](function(_0x14a3d2){logger[_0xa761('0xc')](_0xa761('0x1f'),_0x199abb);logger[_0xa761('0xd')](_0xa761('0x1f'),_0x199abb,JSON[_0xa761('0xf')](_0x14a3d2));_0xda9c42(_0x14a3d2);})[_0xa761('0x16')](function(_0x532469){logger['error'](_0xa761('0x1f'),_0x532469[_0xa761('0x13')],_0x199abb);_0x3ad18b(_0x5df178[_0xa761('0x10')](0x1f4,_0x532469['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7306c8e..7b1dba3 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 _0xe196=['/:id','destroy','exports','path','express','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','get','describe','post','create','put'];(function(_0xc587ed,_0x11cbc2){var _0x41d137=function(_0x2d288f){while(--_0x2d288f){_0xc587ed['push'](_0xc587ed['shift']());}};_0x41d137(++_0x11cbc2);}(_0xe196,0x137));var _0x6e19=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe196[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6e19('0x0'));var timeout=require('connect-timeout');var express=require(_0x6e19('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6e19('0x2'));var config=require(_0x6e19('0x3'));var controller=require(_0x6e19('0x4'));router['get']('/',auth[_0x6e19('0x5')](),controller['index']);router[_0x6e19('0x6')]('/describe',auth[_0x6e19('0x5')](),controller[_0x6e19('0x7')]);router[_0x6e19('0x6')]('/:id',auth[_0x6e19('0x5')](),controller['show']);router[_0x6e19('0x8')]('/',auth[_0x6e19('0x5')](),controller[_0x6e19('0x9')]);router[_0x6e19('0xa')](_0x6e19('0xb'),auth[_0x6e19('0x5')](),controller['update']);router['delete'](_0x6e19('0xb'),auth[_0x6e19('0x5')](),controller[_0x6e19('0xc')]);module[_0x6e19('0xd')]=router; \ No newline at end of file +var _0x8705=['index','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','./voiceCallReport.controller'];(function(_0x4342fa,_0x4bdb14){var _0x3d4c67=function(_0x385656){while(--_0x385656){_0x4342fa['push'](_0x4342fa['shift']());}};_0x3d4c67(++_0x4bdb14);}(_0x8705,0x7f));var _0x5870=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8705[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x5870('0x0'));var util=require(_0x5870('0x1'));var path=require(_0x5870('0x2'));var timeout=require('connect-timeout');var express=require(_0x5870('0x3'));var router=express['Router']();var auth=require(_0x5870('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5870('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x5870('0x6')]);router[_0x5870('0x7')](_0x5870('0x8'),auth[_0x5870('0x9')](),controller[_0x5870('0xa')]);router['get']('/:id',auth[_0x5870('0x9')](),controller['show']);router[_0x5870('0xb')]('/',auth[_0x5870('0x9')](),controller[_0x5870('0xc')]);router[_0x5870('0xd')](_0x5870('0xe'),auth[_0x5870('0x9')](),controller[_0x5870('0xf')]);router[_0x5870('0x10')](_0x5870('0xe'),auth[_0x5870('0x9')](),controller[_0x5870('0x11')]);module[_0x5870('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 4bf711d..ae4a07b 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(_0x28ac4a,_0x40172f){var _0x407f92=function(_0xef99ae){while(--_0xef99ae){_0x28ac4a['push'](_0x28ac4a['shift']());}};_0x407f92(++_0x40172f);}(_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')]={'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(_0x199d63,_0x89a1c8){var _0x42cea=function(_0x425d3d){while(--_0x425d3d){_0x199d63['push'](_0x199d63['shift']());}};_0x42cea(++_0x89a1c8);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 9192839..21bf4c5 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 _0xc697=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','VoiceCallReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','merge','VIRTUAL','options','include','fullname','User','findAll','rows','show','params','includeAll','find','catch','create','uniqueid','body','user','rimraf','zip-dir'];(function(_0xb4df7d,_0xd352df){var _0x43bdc0=function(_0x1acafc){while(--_0x1acafc){_0xb4df7d['push'](_0xb4df7d['shift']());}};_0x43bdc0(++_0xd352df);}(_0xc697,0x126));var _0x7c69=function(_0x502372,_0x304dd9){_0x502372=_0x502372-0x0;var _0xf99629=_0xc697[_0x502372];return _0xf99629;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7c69('0x0'));var zipdir=require(_0x7c69('0x1'));var jsonpatch=require(_0x7c69('0x2'));var rp=require(_0x7c69('0x3'));var moment=require(_0x7c69('0x4'));var BPromise=require(_0x7c69('0x5'));var Mustache=require(_0x7c69('0x6'));var util=require(_0x7c69('0x7'));var path=require(_0x7c69('0x8'));var sox=require(_0x7c69('0x9'));var csv=require(_0x7c69('0xa'));var ejs=require(_0x7c69('0xb'));var fs=require('fs');var _=require(_0x7c69('0xc'));var squel=require(_0x7c69('0xd'));var crypto=require(_0x7c69('0xe'));var jsforce=require(_0x7c69('0xf'));var deskjs=require(_0x7c69('0x10'));var toCsv=require(_0x7c69('0xa'));var querystring=require(_0x7c69('0x11'));var Papa=require(_0x7c69('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c69('0x13'));var as=require(_0x7c69('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c69('0x15'))('api');var utils=require(_0x7c69('0x16'));var config=require('../../config/environment');var db=require(_0x7c69('0x17'))['db'];function respondWithStatusCode(_0x25c9ea,_0x2015c8){_0x2015c8=_0x2015c8||0xcc;return function(_0x876673){if(_0x876673){return _0x25c9ea[_0x7c69('0x18')](_0x2015c8);}return _0x25c9ea[_0x7c69('0x19')](_0x2015c8)['end']();};}function respondWithResult(_0x5568af,_0x22f9f8){_0x22f9f8=_0x22f9f8||0xc8;return function(_0x40006e){if(_0x40006e){return _0x5568af[_0x7c69('0x19')](_0x22f9f8)[_0x7c69('0x1a')](_0x40006e);}};}function respondWithFilteredResult(_0x128222,_0x3941ce){return function(_0x25a6ae){if(_0x25a6ae){var _0x5d220a=_0x25a6ae[_0x7c69('0x1b')],_0x2a5874=_0x3941ce[_0x7c69('0x1c')],_0x37fa54=_0x3941ce[_0x7c69('0x1c')]+_0x3941ce[_0x7c69('0x1d')],_0x3a3e67;if(_0x37fa54>=_0x5d220a){_0x37fa54=_0x5d220a;_0x3a3e67=0xc8;}else{_0x3a3e67=0xce;}_0x128222[_0x7c69('0x19')](_0x3a3e67);return _0x128222['set'](_0x7c69('0x1e'),_0x2a5874+'-'+_0x37fa54+'/'+_0x5d220a)[_0x7c69('0x1a')](_0x25a6ae);}return null;};}function patchUpdates(_0x596218){return function(_0x431c78){try{jsonpatch['apply'](_0x431c78,_0x596218,!![]);}catch(_0x2d50a5){return BPromise[_0x7c69('0x1f')](_0x2d50a5);}return _0x431c78[_0x7c69('0x20')]();};}function saveUpdates(_0x5a73be,_0x50b6f8){return function(_0x526b35){if(_0x526b35){return _0x526b35[_0x7c69('0x21')](_0x5a73be)[_0x7c69('0x22')](function(_0x14256e){return _0x14256e;});}return null;};}function removeEntity(_0x2ac228,_0x1a2677){return function(_0xa39474){if(_0xa39474){return _0xa39474[_0x7c69('0x23')]()[_0x7c69('0x22')](function(){_0x2ac228[_0x7c69('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb06c,_0x1d8070){return function(_0x29ab71){if(!_0x29ab71){_0x3fb06c[_0x7c69('0x18')](0x194);}return _0x29ab71;};}function handleError(_0x13ac8e,_0x256f62){_0x256f62=_0x256f62||0x1f4;return function(_0xf96ef3){logger['error'](_0xf96ef3[_0x7c69('0x24')]);if(_0xf96ef3[_0x7c69('0x25')]){delete _0xf96ef3[_0x7c69('0x25')];}_0x13ac8e[_0x7c69('0x19')](_0x256f62)[_0x7c69('0x26')](_0xf96ef3);};}exports[_0x7c69('0x27')]=function(_0x183425,_0x246314){var _0x1b6fdc={},_0x31f4df={},_0x3a66ee={'count':0x0,'rows':[]};var _0x3e0c85=_[_0x7c69('0x28')](db[_0x7c69('0x29')][_0x7c69('0x2a')],function(_0x1fb1bd){return{'name':_0x1fb1bd['fieldName'],'type':_0x1fb1bd[_0x7c69('0x2b')][_0x7c69('0x2c')]};});_0x31f4df[_0x7c69('0x2d')]=_[_0x7c69('0x28')](_0x3e0c85,_0x7c69('0x25'));_0x31f4df[_0x7c69('0x2e')]=_[_0x7c69('0x2f')](_0x183425['query']);_0x31f4df[_0x7c69('0x30')]=_[_0x7c69('0x31')](_0x31f4df[_0x7c69('0x2d')],_0x31f4df[_0x7c69('0x2e')]);_0x1b6fdc[_0x7c69('0x32')]=_[_0x7c69('0x31')](_0x31f4df['model'],qs[_0x7c69('0x33')](_0x183425[_0x7c69('0x2e')][_0x7c69('0x33')]));_0x1b6fdc[_0x7c69('0x32')]=_0x1b6fdc[_0x7c69('0x32')][_0x7c69('0x34')]?_0x1b6fdc[_0x7c69('0x32')]:_0x31f4df[_0x7c69('0x2d')];if(!_0x183425[_0x7c69('0x2e')]['hasOwnProperty'](_0x7c69('0x35'))){_0x1b6fdc[_0x7c69('0x1d')]=qs['limit'](_0x183425[_0x7c69('0x2e')][_0x7c69('0x1d')]);_0x1b6fdc['offset']=qs[_0x7c69('0x1c')](_0x183425[_0x7c69('0x2e')][_0x7c69('0x1c')]);}_0x1b6fdc['order']=qs['sort'](_0x183425[_0x7c69('0x2e')]['sort']);_0x1b6fdc[_0x7c69('0x36')]=qs[_0x7c69('0x30')](_[_0x7c69('0x37')](_0x183425[_0x7c69('0x2e')],_0x31f4df[_0x7c69('0x30')]),_0x3e0c85);if(_0x183425['query'][_0x7c69('0x38')]){_0x1b6fdc[_0x7c69('0x36')]=_[_0x7c69('0x39')](_0x1b6fdc[_0x7c69('0x36')],{'$or':_[_0x7c69('0x28')](_0x3e0c85,function(_0x5caac0){if(_0x5caac0[_0x7c69('0x2b')]!==_0x7c69('0x3a')){var _0x2a1dab={};_0x2a1dab[_0x5caac0[_0x7c69('0x25')]]={'$like':'%'+_0x183425[_0x7c69('0x2e')][_0x7c69('0x38')]+'%'};return _0x2a1dab;}})});}_0x1b6fdc=_[_0x7c69('0x39')]({},_0x1b6fdc,_0x183425[_0x7c69('0x3b')]);var _0x2024ba={'where':_0x1b6fdc[_0x7c69('0x36')]};return db[_0x7c69('0x29')][_0x7c69('0x1b')](_0x2024ba)[_0x7c69('0x22')](function(_0x2f747b){_0x3a66ee['count']=_0x2f747b;if(_0x183425[_0x7c69('0x2e')]['includeAll']){_0x1b6fdc[_0x7c69('0x3c')]=[{'attributes':['id','name',_0x7c69('0x3d'),'alias'],'model':db[_0x7c69('0x3e')],'as':_0x7c69('0x3e')}];}return db[_0x7c69('0x29')][_0x7c69('0x3f')](_0x1b6fdc);})['then'](function(_0x7a04b){_0x3a66ee[_0x7c69('0x40')]=_0x7a04b;return _0x3a66ee;})[_0x7c69('0x22')](respondWithFilteredResult(_0x246314,_0x1b6fdc))['catch'](handleError(_0x246314,null));};exports[_0x7c69('0x41')]=function(_0x53ff67,_0x170678){var _0xa81a00={'raw':!![],'where':{'id':_0x53ff67[_0x7c69('0x42')]['id']}},_0x5381c8={};_0x5381c8[_0x7c69('0x2d')]=_[_0x7c69('0x2f')](db[_0x7c69('0x29')]['rawAttributes']);_0x5381c8['query']=_['keys'](_0x53ff67[_0x7c69('0x2e')]);_0x5381c8[_0x7c69('0x30')]=_[_0x7c69('0x31')](_0x5381c8[_0x7c69('0x2d')],_0x5381c8[_0x7c69('0x2e')]);_0xa81a00[_0x7c69('0x32')]=_['intersection'](_0x5381c8[_0x7c69('0x2d')],qs[_0x7c69('0x33')](_0x53ff67['query']['fields']));_0xa81a00[_0x7c69('0x32')]=_0xa81a00[_0x7c69('0x32')][_0x7c69('0x34')]?_0xa81a00[_0x7c69('0x32')]:_0x5381c8[_0x7c69('0x2d')];if(_0x53ff67[_0x7c69('0x2e')][_0x7c69('0x43')]){_0xa81a00[_0x7c69('0x3c')]=[{'all':!![]}];}_0xa81a00=_[_0x7c69('0x39')]({},_0xa81a00,_0x53ff67[_0x7c69('0x3b')]);return db[_0x7c69('0x29')][_0x7c69('0x44')](_0xa81a00)[_0x7c69('0x22')](handleEntityNotFound(_0x170678,null))[_0x7c69('0x22')](respondWithResult(_0x170678,null))[_0x7c69('0x45')](handleError(_0x170678,null));};exports[_0x7c69('0x46')]=function(_0x5958b5,_0x23eb78){return db[_0x7c69('0x29')]['create'](_0x5958b5['body'],{})[_0x7c69('0x22')](respondWithResult(_0x23eb78,0xc9))[_0x7c69('0x45')](handleError(_0x23eb78,null));};exports['destroy']=function(_0x22004b,_0x1dd89b){return db[_0x7c69('0x29')][_0x7c69('0x44')]({'where':{'id':_0x22004b['params']['id']}})[_0x7c69('0x22')](handleEntityNotFound(_0x1dd89b,null))[_0x7c69('0x22')](removeEntity(_0x1dd89b,null))[_0x7c69('0x45')](handleError(_0x1dd89b,null));};exports['describe']=function(_0x1f7135,_0x4dc841){return db['VoiceCallReport']['describe']()[_0x7c69('0x22')](respondWithResult(_0x4dc841,null))[_0x7c69('0x45')](handleError(_0x4dc841,null));};exports[_0x7c69('0x21')]=function(_0x40114c,_0x2d5190){if(_0x40114c['body'][_0x7c69('0x47')]){delete _0x40114c[_0x7c69('0x48')][_0x7c69('0x47')];}return db[_0x7c69('0x29')][_0x7c69('0x44')]({'where':{'uniqueid':_0x40114c[_0x7c69('0x42')]['id'],'UserId':{'$or':[null,_0x40114c[_0x7c69('0x49')]['id']]}}})[_0x7c69('0x22')](handleEntityNotFound(_0x2d5190,null))['then'](saveUpdates(_0x40114c['body'],null))[_0x7c69('0x22')](respondWithResult(_0x2d5190,null))[_0x7c69('0x45')](handleError(_0x2d5190,null));}; \ No newline at end of file +var _0x4aaf=['mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','fullname','User','findAll','rows','show','find','create','body','catch','describe','uniqueid','user','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x38dbfd,_0x2ebe55){var _0x217efe=function(_0x5d5114){while(--_0x5d5114){_0x38dbfd['push'](_0x38dbfd['shift']());}};_0x217efe(++_0x2ebe55);}(_0x4aaf,0xe1));var _0xf4aa=function(_0x27ac32,_0x42771f){_0x27ac32=_0x27ac32-0x0;var _0x20c811=_0x4aaf[_0x27ac32];return _0x20c811;};'use strict';var pdf=require(_0xf4aa('0x0'));var emlformat=require(_0xf4aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf4aa('0x2'));var jsonpatch=require(_0xf4aa('0x3'));var rp=require(_0xf4aa('0x4'));var moment=require(_0xf4aa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf4aa('0x6'));var util=require(_0xf4aa('0x7'));var path=require(_0xf4aa('0x8'));var sox=require('sox');var csv=require(_0xf4aa('0x9'));var ejs=require(_0xf4aa('0xa'));var fs=require('fs');var _=require(_0xf4aa('0xb'));var squel=require(_0xf4aa('0xc'));var crypto=require('crypto');var jsforce=require(_0xf4aa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf4aa('0x9'));var querystring=require(_0xf4aa('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf4aa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf4aa('0x10'));var hardwareService=require(_0xf4aa('0x11'));var logger=require(_0xf4aa('0x12'))(_0xf4aa('0x13'));var utils=require(_0xf4aa('0x14'));var config=require(_0xf4aa('0x15'));var db=require(_0xf4aa('0x16'))['db'];function respondWithStatusCode(_0x542ff1,_0x3eb79f){_0x3eb79f=_0x3eb79f||0xcc;return function(_0x4d35f1){if(_0x4d35f1){return _0x542ff1[_0xf4aa('0x17')](_0x3eb79f);}return _0x542ff1[_0xf4aa('0x18')](_0x3eb79f)[_0xf4aa('0x19')]();};}function respondWithResult(_0x5c8541,_0x2fc466){_0x2fc466=_0x2fc466||0xc8;return function(_0x2696da){if(_0x2696da){return _0x5c8541[_0xf4aa('0x18')](_0x2fc466)[_0xf4aa('0x1a')](_0x2696da);}};}function respondWithFilteredResult(_0x67347e,_0x4f7865){return function(_0x1b0662){if(_0x1b0662){var _0x24e072=_0x1b0662[_0xf4aa('0x1b')],_0x382f10=_0x4f7865['offset'],_0x16b727=_0x4f7865[_0xf4aa('0x1c')]+_0x4f7865[_0xf4aa('0x1d')],_0x48e809;if(_0x16b727>=_0x24e072){_0x16b727=_0x24e072;_0x48e809=0xc8;}else{_0x48e809=0xce;}_0x67347e[_0xf4aa('0x18')](_0x48e809);return _0x67347e[_0xf4aa('0x1e')]('Content-Range',_0x382f10+'-'+_0x16b727+'/'+_0x24e072)[_0xf4aa('0x1a')](_0x1b0662);}return null;};}function patchUpdates(_0x10ca37){return function(_0x5bed72){try{jsonpatch[_0xf4aa('0x1f')](_0x5bed72,_0x10ca37,!![]);}catch(_0x43c34a){return BPromise[_0xf4aa('0x20')](_0x43c34a);}return _0x5bed72[_0xf4aa('0x21')]();};}function saveUpdates(_0x13baa8,_0x13748d){return function(_0x1c5e41){if(_0x1c5e41){return _0x1c5e41[_0xf4aa('0x22')](_0x13baa8)[_0xf4aa('0x23')](function(_0x1db117){return _0x1db117;});}return null;};}function removeEntity(_0x4f9c19,_0x471d0c){return function(_0x376f0a){if(_0x376f0a){return _0x376f0a[_0xf4aa('0x24')]()[_0xf4aa('0x23')](function(){_0x4f9c19[_0xf4aa('0x18')](0xcc)[_0xf4aa('0x19')]();});}};}function handleEntityNotFound(_0xa73b7a,_0x76c1c6){return function(_0x3716e9){if(!_0x3716e9){_0xa73b7a[_0xf4aa('0x17')](0x194);}return _0x3716e9;};}function handleError(_0x4caab4,_0x35b7c9){_0x35b7c9=_0x35b7c9||0x1f4;return function(_0x12153e){logger[_0xf4aa('0x25')](_0x12153e['stack']);if(_0x12153e[_0xf4aa('0x26')]){delete _0x12153e['name'];}_0x4caab4['status'](_0x35b7c9)['send'](_0x12153e);};}exports[_0xf4aa('0x27')]=function(_0x34b761,_0x12f954){var _0x246253={},_0x7c2d56={},_0x38582a={'count':0x0,'rows':[]};var _0xd2cabe=_[_0xf4aa('0x28')](db[_0xf4aa('0x29')][_0xf4aa('0x2a')],function(_0x4b781d){return{'name':_0x4b781d[_0xf4aa('0x2b')],'type':_0x4b781d[_0xf4aa('0x2c')][_0xf4aa('0x2d')]};});_0x7c2d56[_0xf4aa('0x2e')]=_[_0xf4aa('0x28')](_0xd2cabe,_0xf4aa('0x26'));_0x7c2d56['query']=_[_0xf4aa('0x2f')](_0x34b761['query']);_0x7c2d56[_0xf4aa('0x30')]=_[_0xf4aa('0x31')](_0x7c2d56[_0xf4aa('0x2e')],_0x7c2d56[_0xf4aa('0x32')]);_0x246253[_0xf4aa('0x33')]=_[_0xf4aa('0x31')](_0x7c2d56[_0xf4aa('0x2e')],qs[_0xf4aa('0x34')](_0x34b761[_0xf4aa('0x32')][_0xf4aa('0x34')]));_0x246253[_0xf4aa('0x33')]=_0x246253[_0xf4aa('0x33')][_0xf4aa('0x35')]?_0x246253[_0xf4aa('0x33')]:_0x7c2d56[_0xf4aa('0x2e')];if(!_0x34b761[_0xf4aa('0x32')]['hasOwnProperty'](_0xf4aa('0x36'))){_0x246253[_0xf4aa('0x1d')]=qs[_0xf4aa('0x1d')](_0x34b761[_0xf4aa('0x32')]['limit']);_0x246253['offset']=qs['offset'](_0x34b761[_0xf4aa('0x32')][_0xf4aa('0x1c')]);}_0x246253[_0xf4aa('0x37')]=qs[_0xf4aa('0x38')](_0x34b761[_0xf4aa('0x32')][_0xf4aa('0x38')]);_0x246253[_0xf4aa('0x39')]=qs[_0xf4aa('0x30')](_[_0xf4aa('0x3a')](_0x34b761[_0xf4aa('0x32')],_0x7c2d56[_0xf4aa('0x30')]),_0xd2cabe);if(_0x34b761[_0xf4aa('0x32')]['filter']){_0x246253[_0xf4aa('0x39')]=_['merge'](_0x246253[_0xf4aa('0x39')],{'$or':_[_0xf4aa('0x28')](_0xd2cabe,function(_0x5b2f5d){if(_0x5b2f5d['type']!==_0xf4aa('0x3b')){var _0x56a53c={};_0x56a53c[_0x5b2f5d[_0xf4aa('0x26')]]={'$like':'%'+_0x34b761['query'][_0xf4aa('0x3c')]+'%'};return _0x56a53c;}})});}_0x246253=_[_0xf4aa('0x3d')]({},_0x246253,_0x34b761[_0xf4aa('0x3e')]);var _0x2832c7={'where':_0x246253['where']};return db['VoiceCallReport']['count'](_0x2832c7)[_0xf4aa('0x23')](function(_0x46a33c){_0x38582a[_0xf4aa('0x1b')]=_0x46a33c;if(_0x34b761['query'][_0xf4aa('0x3f')]){_0x246253[_0xf4aa('0x40')]=[{'attributes':['id','name',_0xf4aa('0x41'),'alias'],'model':db[_0xf4aa('0x42')],'as':'User'}];}return db[_0xf4aa('0x29')][_0xf4aa('0x43')](_0x246253);})[_0xf4aa('0x23')](function(_0x3c140b){_0x38582a[_0xf4aa('0x44')]=_0x3c140b;return _0x38582a;})[_0xf4aa('0x23')](respondWithFilteredResult(_0x12f954,_0x246253))['catch'](handleError(_0x12f954,null));};exports[_0xf4aa('0x45')]=function(_0x15d9e2,_0xcff104){var _0x4ca6f6={'raw':!![],'where':{'id':_0x15d9e2['params']['id']}},_0x22902d={};_0x22902d[_0xf4aa('0x2e')]=_['keys'](db[_0xf4aa('0x29')][_0xf4aa('0x2a')]);_0x22902d[_0xf4aa('0x32')]=_['keys'](_0x15d9e2['query']);_0x22902d[_0xf4aa('0x30')]=_['intersection'](_0x22902d[_0xf4aa('0x2e')],_0x22902d['query']);_0x4ca6f6[_0xf4aa('0x33')]=_[_0xf4aa('0x31')](_0x22902d[_0xf4aa('0x2e')],qs['fields'](_0x15d9e2[_0xf4aa('0x32')][_0xf4aa('0x34')]));_0x4ca6f6[_0xf4aa('0x33')]=_0x4ca6f6[_0xf4aa('0x33')][_0xf4aa('0x35')]?_0x4ca6f6[_0xf4aa('0x33')]:_0x22902d[_0xf4aa('0x2e')];if(_0x15d9e2[_0xf4aa('0x32')][_0xf4aa('0x3f')]){_0x4ca6f6[_0xf4aa('0x40')]=[{'all':!![]}];}_0x4ca6f6=_['merge']({},_0x4ca6f6,_0x15d9e2[_0xf4aa('0x3e')]);return db[_0xf4aa('0x29')][_0xf4aa('0x46')](_0x4ca6f6)[_0xf4aa('0x23')](handleEntityNotFound(_0xcff104,null))[_0xf4aa('0x23')](respondWithResult(_0xcff104,null))['catch'](handleError(_0xcff104,null));};exports[_0xf4aa('0x47')]=function(_0xcdba81,_0xbf4cc9){return db['VoiceCallReport'][_0xf4aa('0x47')](_0xcdba81[_0xf4aa('0x48')],{})[_0xf4aa('0x23')](respondWithResult(_0xbf4cc9,0xc9))[_0xf4aa('0x49')](handleError(_0xbf4cc9,null));};exports['destroy']=function(_0x448cb3,_0xd60d06){return db['VoiceCallReport'][_0xf4aa('0x46')]({'where':{'id':_0x448cb3['params']['id']}})['then'](handleEntityNotFound(_0xd60d06,null))[_0xf4aa('0x23')](removeEntity(_0xd60d06,null))[_0xf4aa('0x49')](handleError(_0xd60d06,null));};exports[_0xf4aa('0x4a')]=function(_0x38f13b,_0x321336){return db[_0xf4aa('0x29')][_0xf4aa('0x4a')]()[_0xf4aa('0x23')](respondWithResult(_0x321336,null))[_0xf4aa('0x49')](handleError(_0x321336,null));};exports['update']=function(_0x3a4021,_0x2a969d){if(_0x3a4021['body']['uniqueid']){delete _0x3a4021[_0xf4aa('0x48')][_0xf4aa('0x4b')];}return db[_0xf4aa('0x29')][_0xf4aa('0x46')]({'where':{'uniqueid':_0x3a4021['params']['id'],'UserId':{'$or':[null,_0x3a4021[_0xf4aa('0x4c')]['id']]}}})[_0xf4aa('0x23')](handleEntityNotFound(_0x2a969d,null))[_0xf4aa('0x23')](saveUpdates(_0x3a4021[_0xf4aa('0x48')],null))[_0xf4aa('0x23')](respondWithResult(_0x2a969d,null))['catch'](handleError(_0x2a969d,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 37398db..fba628e 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 _0x9845=['bluebird','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','lodash','moment'];(function(_0x3d6935,_0x15ef2c){var _0x38fd9f=function(_0x42b580){while(--_0x42b580){_0x3d6935['push'](_0x3d6935['shift']());}};_0x38fd9f(++_0x15ef2c);}(_0x9845,0x142));var _0x5984=function(_0x499185,_0x9342ce){_0x499185=_0x499185-0x0;var _0x232a15=_0x9845[_0x499185];return _0x232a15;};'use strict';var _=require(_0x5984('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5984('0x1'));var BPromise=require(_0x5984('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5984('0x3'));var config=require(_0x5984('0x4'));var attributes=require(_0x5984('0x5'));module[_0x5984('0x6')]=function(_0x3f3b4a,_0xcf0d91){return _0x3f3b4a[_0x5984('0x7')](_0x5984('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xde11=['report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x488dd0,_0x1e0044){var _0xb0577d=function(_0x5045d0){while(--_0x5045d0){_0x488dd0['push'](_0x488dd0['shift']());}};_0xb0577d(++_0x1e0044);}(_0xde11,0x11f));var _0x1de1=function(_0x1a635e,_0x241651){_0x1a635e=_0x1a635e-0x0;var _0x5b3345=_0xde11[_0x1a635e];return _0x5b3345;};'use strict';var _=require(_0x1de1('0x0'));var util=require(_0x1de1('0x1'));var logger=require(_0x1de1('0x2'))(_0x1de1('0x3'));var moment=require(_0x1de1('0x4'));var BPromise=require(_0x1de1('0x5'));var rp=require(_0x1de1('0x6'));var fs=require('fs');var path=require(_0x1de1('0x7'));var rimraf=require('rimraf');var config=require(_0x1de1('0x8'));var attributes=require(_0x1de1('0x9'));module[_0x1de1('0xa')]=function(_0x19ba84,_0x4f1f11){return _0x19ba84[_0x1de1('0xb')](_0x1de1('0xc'),attributes,{'tableName':_0x1de1('0xd'),'paranoid':![],'indexes':[{'fields':[_0x1de1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 86e9a65..6df0375 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 _0x028c=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','VoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x22085a,_0x589318){var _0x528c36=function(_0x4bcd66){while(--_0x4bcd66){_0x22085a['push'](_0x22085a['shift']());}};_0x528c36(++_0x589318);}(_0x028c,0x92));var _0xc028=function(_0x21d1eb,_0x56f664){_0x21d1eb=_0x21d1eb-0x0;var _0x4cb8cd=_0x028c[_0x21d1eb];return _0x4cb8cd;};'use strict';var _=require(_0xc028('0x0'));var util=require(_0xc028('0x1'));var moment=require(_0xc028('0x2'));var BPromise=require(_0xc028('0x3'));var rs=require(_0xc028('0x4'));var fs=require('fs');var Redis=require(_0xc028('0x5'));var db=require(_0xc028('0x6'))['db'];var utils=require(_0xc028('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc028('0x8'));var jayson=require(_0xc028('0x9'));var client=jayson[_0xc028('0xa')][_0xc028('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55c6e4,_0x29673c,_0x50e9bd){return new BPromise(function(_0x156906,_0x2ac6c2){return client['request'](_0x55c6e4,_0x50e9bd)[_0xc028('0xc')](function(_0x40767d){logger[_0xc028('0xd')](_0xc028('0xe'),_0x29673c,_0xc028('0xf'));logger[_0xc028('0x10')](_0xc028('0x11'),_0x29673c,_0xc028('0xf'),JSON[_0xc028('0x12')](_0x40767d));if(_0x40767d[_0xc028('0x13')]){if(_0x40767d[_0xc028('0x13')]['code']===0x1f4){logger[_0xc028('0x13')](_0xc028('0xe'),_0x29673c,_0x40767d[_0xc028('0x13')][_0xc028('0x14')]);return _0x2ac6c2(_0x40767d['error'][_0xc028('0x14')]);}logger['error'](_0xc028('0xe'),_0x29673c,_0x40767d['error'][_0xc028('0x14')]);return _0x156906(_0x40767d[_0xc028('0x13')][_0xc028('0x14')]);}else{logger['info'](_0xc028('0xe'),_0x29673c,_0xc028('0xf'));_0x156906(_0x40767d['result']['message']);}})[_0xc028('0x15')](function(_0x22f005){logger[_0xc028('0x13')](_0xc028('0xe'),_0x29673c,_0x22f005);_0x2ac6c2(_0x22f005);});});}exports[_0xc028('0x16')]=function(_0x1f921c){var _0x108f9d=this;return new Promise(function(_0x352c31,_0x2f4f71){return db['VoiceCallReport'][_0xc028('0x17')]({'raw':_0x1f921c[_0xc028('0x18')]?_0x1f921c[_0xc028('0x18')][_0xc028('0x19')]===undefined?!![]:![]:!![],'where':_0x1f921c[_0xc028('0x18')]?_0x1f921c[_0xc028('0x18')][_0xc028('0x1a')]||null:null,'attributes':_0x1f921c[_0xc028('0x18')]?_0x1f921c[_0xc028('0x18')][_0xc028('0x1b')]||null:null,'limit':_0x1f921c[_0xc028('0x18')]?_0x1f921c[_0xc028('0x18')][_0xc028('0x1c')]||null:null,'include':_0x1f921c[_0xc028('0x18')]?_0x1f921c[_0xc028('0x18')][_0xc028('0x1d')]?_[_0xc028('0x1e')](_0x1f921c['options'][_0xc028('0x1d')],function(_0x2b2aa9){return{'model':db[_0x2b2aa9[_0xc028('0x1f')]],'as':_0x2b2aa9['as'],'attributes':_0x2b2aa9[_0xc028('0x1b')],'include':_0x2b2aa9[_0xc028('0x1d')]?_[_0xc028('0x1e')](_0x2b2aa9[_0xc028('0x1d')],function(_0xea94e8){return{'model':db[_0xea94e8[_0xc028('0x1f')]],'as':_0xea94e8['as'],'attributes':_0xea94e8[_0xc028('0x1b')],'include':_0xea94e8[_0xc028('0x1d')]?_[_0xc028('0x1e')](_0xea94e8[_0xc028('0x1d')],function(_0x268b5a){return{'model':db[_0x268b5a['model']],'as':_0x268b5a['as'],'attributes':_0x268b5a[_0xc028('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc028('0xc')](function(_0x560f09){logger[_0xc028('0xd')](_0xc028('0x16'),_0x1f921c);logger['debug'](_0xc028('0x16'),_0x1f921c,JSON[_0xc028('0x12')](_0x560f09));_0x352c31(_0x560f09);})[_0xc028('0x15')](function(_0x304127){logger['error']('GetVoiceCallReport',_0x304127[_0xc028('0x14')],_0x1f921c);_0x2f4f71(_0x108f9d[_0xc028('0x13')](0x1f4,_0x304127[_0xc028('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x154c82){var _0x19155d=this;return new Promise(function(_0x346ea5,_0x48dc69){return db['VoiceCallReport'][_0xc028('0x20')](_0x154c82[_0xc028('0x21')],{'raw':_0x154c82['options']?_0x154c82[_0xc028('0x18')][_0xc028('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x57a845){logger[_0xc028('0xd')](_0xc028('0x22'),_0x154c82);logger[_0xc028('0x10')]('CreateVoiceCallReport',_0x154c82,JSON[_0xc028('0x12')](_0x57a845));_0x346ea5(_0x57a845);})[_0xc028('0x15')](function(_0x55bdda){logger[_0xc028('0x13')](_0xc028('0x22'),_0x55bdda[_0xc028('0x14')],_0x154c82);_0x48dc69(_0x19155d['error'](0x1f4,_0x55bdda[_0xc028('0x14')]));});});};exports[_0xc028('0x23')]=function(_0x3a56e2){var _0x298d3e=this;return new Promise(function(_0x16f2ae,_0x22d7e2){return db[_0xc028('0x24')][_0xc028('0x25')](_0x3a56e2[_0xc028('0x21')],{'raw':_0x3a56e2[_0xc028('0x18')]?_0x3a56e2[_0xc028('0x18')][_0xc028('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a56e2['options']?_0x3a56e2[_0xc028('0x18')]['where']||null:null,'attributes':_0x3a56e2[_0xc028('0x18')]?_0x3a56e2['options']['attributes']||null:null,'limit':_0x3a56e2[_0xc028('0x18')]?_0x3a56e2['options']['limit']||null:null})[_0xc028('0xc')](function(_0x23b1af){logger['info'](_0xc028('0x23'),_0x3a56e2);logger['debug'](_0xc028('0x23'),_0x3a56e2,JSON[_0xc028('0x12')](_0x23b1af));_0x16f2ae(_0x23b1af);})[_0xc028('0x15')](function(_0x55ba56){logger[_0xc028('0x13')](_0xc028('0x23'),_0x55ba56[_0xc028('0x14')],_0x3a56e2);_0x22d7e2(_0x298d3e['error'](0x1f4,_0x55ba56[_0xc028('0x14')]));});});}; \ No newline at end of file +var _0x2add=['raw','limit','map','include','attributes','model','info','GetVoiceCallReport','debug','create','body','CreateVoiceCallReport','VoiceCallReport','where','UpdateVoiceCallReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options'];(function(_0x1fbafd,_0x1ba0a5){var _0x2ccceb=function(_0x1b71cf){while(--_0x1b71cf){_0x1fbafd['push'](_0x1fbafd['shift']());}};_0x2ccceb(++_0x1ba0a5);}(_0x2add,0x7b));var _0xd2ad=function(_0x9e2b66,_0x1ee46f){_0x9e2b66=_0x9e2b66-0x0;var _0x2eb8ad=_0x2add[_0x9e2b66];return _0x2eb8ad;};'use strict';var _=require(_0xd2ad('0x0'));var util=require(_0xd2ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd2ad('0x2'));var fs=require('fs');var Redis=require(_0xd2ad('0x3'));var db=require(_0xd2ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2ad('0x5'))('rpc');var config=require(_0xd2ad('0x6'));var jayson=require(_0xd2ad('0x7'));var client=jayson['client'][_0xd2ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56a76b,_0x3d6f40,_0x5483ea){return new BPromise(function(_0x328a71,_0x56dc03){return client[_0xd2ad('0x9')](_0x56a76b,_0x5483ea)[_0xd2ad('0xa')](function(_0x12d0df){logger['info'](_0xd2ad('0xb'),_0x3d6f40,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3d6f40,_0xd2ad('0xc'),JSON[_0xd2ad('0xd')](_0x12d0df));if(_0x12d0df[_0xd2ad('0xe')]){if(_0x12d0df[_0xd2ad('0xe')][_0xd2ad('0xf')]===0x1f4){logger[_0xd2ad('0xe')](_0xd2ad('0xb'),_0x3d6f40,_0x12d0df[_0xd2ad('0xe')][_0xd2ad('0x10')]);return _0x56dc03(_0x12d0df[_0xd2ad('0xe')]['message']);}logger[_0xd2ad('0xe')](_0xd2ad('0xb'),_0x3d6f40,_0x12d0df['error'][_0xd2ad('0x10')]);return _0x328a71(_0x12d0df[_0xd2ad('0xe')]['message']);}else{logger['info'](_0xd2ad('0xb'),_0x3d6f40,_0xd2ad('0xc'));_0x328a71(_0x12d0df[_0xd2ad('0x11')]['message']);}})[_0xd2ad('0x12')](function(_0x5147c1){logger[_0xd2ad('0xe')](_0xd2ad('0xb'),_0x3d6f40,_0x5147c1);_0x56dc03(_0x5147c1);});});}exports['GetVoiceCallReport']=function(_0x6ab337){var _0x4beb4c=this;return new Promise(function(_0x1693b3,_0x1e9854){return db['VoiceCallReport'][_0xd2ad('0x13')]({'raw':_0x6ab337[_0xd2ad('0x14')]?_0x6ab337[_0xd2ad('0x14')][_0xd2ad('0x15')]===undefined?!![]:![]:!![],'where':_0x6ab337[_0xd2ad('0x14')]?_0x6ab337[_0xd2ad('0x14')]['where']||null:null,'attributes':_0x6ab337[_0xd2ad('0x14')]?_0x6ab337['options']['attributes']||null:null,'limit':_0x6ab337[_0xd2ad('0x14')]?_0x6ab337['options'][_0xd2ad('0x16')]||null:null,'include':_0x6ab337['options']?_0x6ab337[_0xd2ad('0x14')]['include']?_[_0xd2ad('0x17')](_0x6ab337[_0xd2ad('0x14')][_0xd2ad('0x18')],function(_0xdb3709){return{'model':db[_0xdb3709['model']],'as':_0xdb3709['as'],'attributes':_0xdb3709[_0xd2ad('0x19')],'include':_0xdb3709[_0xd2ad('0x18')]?_[_0xd2ad('0x17')](_0xdb3709['include'],function(_0x1ca6b1){return{'model':db[_0x1ca6b1[_0xd2ad('0x1a')]],'as':_0x1ca6b1['as'],'attributes':_0x1ca6b1['attributes'],'include':_0x1ca6b1[_0xd2ad('0x18')]?_[_0xd2ad('0x17')](_0x1ca6b1[_0xd2ad('0x18')],function(_0x58ce60){return{'model':db[_0x58ce60[_0xd2ad('0x1a')]],'as':_0x58ce60['as'],'attributes':_0x58ce60[_0xd2ad('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd2ad('0xa')](function(_0x40c6c2){logger[_0xd2ad('0x1b')](_0xd2ad('0x1c'),_0x6ab337);logger[_0xd2ad('0x1d')](_0xd2ad('0x1c'),_0x6ab337,JSON[_0xd2ad('0xd')](_0x40c6c2));_0x1693b3(_0x40c6c2);})[_0xd2ad('0x12')](function(_0x1597f7){logger['error'](_0xd2ad('0x1c'),_0x1597f7[_0xd2ad('0x10')],_0x6ab337);_0x1e9854(_0x4beb4c[_0xd2ad('0xe')](0x1f4,_0x1597f7[_0xd2ad('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x5b34aa){var _0x349f28=this;return new Promise(function(_0x1e21f6,_0x2db8d8){return db['VoiceCallReport'][_0xd2ad('0x1e')](_0x5b34aa[_0xd2ad('0x1f')],{'raw':_0x5b34aa[_0xd2ad('0x14')]?_0x5b34aa['options'][_0xd2ad('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x1a9cff){logger[_0xd2ad('0x1b')](_0xd2ad('0x20'),_0x5b34aa);logger[_0xd2ad('0x1d')](_0xd2ad('0x20'),_0x5b34aa,JSON[_0xd2ad('0xd')](_0x1a9cff));_0x1e21f6(_0x1a9cff);})['catch'](function(_0xa60174){logger['error'](_0xd2ad('0x20'),_0xa60174['message'],_0x5b34aa);_0x2db8d8(_0x349f28[_0xd2ad('0xe')](0x1f4,_0xa60174[_0xd2ad('0x10')]));});});};exports['UpdateVoiceCallReport']=function(_0x3ed217){var _0x4ca54d=this;return new Promise(function(_0x2a5d0a,_0x30d44d){return db[_0xd2ad('0x21')]['update'](_0x3ed217[_0xd2ad('0x1f')],{'raw':_0x3ed217[_0xd2ad('0x14')]?_0x3ed217[_0xd2ad('0x14')][_0xd2ad('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ed217[_0xd2ad('0x14')]?_0x3ed217[_0xd2ad('0x14')][_0xd2ad('0x22')]||null:null,'attributes':_0x3ed217[_0xd2ad('0x14')]?_0x3ed217['options'][_0xd2ad('0x19')]||null:null,'limit':_0x3ed217[_0xd2ad('0x14')]?_0x3ed217[_0xd2ad('0x14')][_0xd2ad('0x16')]||null:null})[_0xd2ad('0xa')](function(_0x5e9af1){logger['info'](_0xd2ad('0x23'),_0x3ed217);logger[_0xd2ad('0x1d')](_0xd2ad('0x23'),_0x3ed217,JSON[_0xd2ad('0xd')](_0x5e9af1));_0x2a5d0a(_0x5e9af1);})[_0xd2ad('0x12')](function(_0x475451){logger[_0xd2ad('0xe')](_0xd2ad('0x23'),_0x475451[_0xd2ad('0x10')],_0x3ed217);_0x30d44d(_0x4ca54d[_0xd2ad('0xe')](0x1f4,_0x475451[_0xd2ad('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 4b2694d..968e70a 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 _0xb957=['../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','put','destroy','path','express','Router'];(function(_0x1e8f40,_0x154ac7){var _0x466638=function(_0x1ee019){while(--_0x1ee019){_0x1e8f40['push'](_0x1e8f40['shift']());}};_0x466638(++_0x154ac7);}(_0xb957,0x6d));var _0x7b95=function(_0x190764,_0x96731f){_0x190764=_0x190764-0x0;var _0x5c676c=_0xb957[_0x190764];return _0x5c676c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b95('0x0'));var timeout=require('connect-timeout');var express=require(_0x7b95('0x1'));var router=express[_0x7b95('0x2')]();var auth=require(_0x7b95('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b95('0x4'));var controller=require(_0x7b95('0x5'));router[_0x7b95('0x6')]('/',auth[_0x7b95('0x7')](),controller[_0x7b95('0x8')]);router['get'](_0x7b95('0x9'),auth[_0x7b95('0x7')](),controller[_0x7b95('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b95('0xb')]);router[_0x7b95('0xc')](_0x7b95('0x9'),auth[_0x7b95('0x7')](),controller['update']);router['delete']('/:id',auth[_0x7b95('0x7')](),controller[_0x7b95('0xd')]);module['exports']=router; \ No newline at end of file +var _0xc00e=['exports','multer','util','express','Router','../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','destroy'];(function(_0x53a167,_0x4bf6c7){var _0x150263=function(_0x422191){while(--_0x422191){_0x53a167['push'](_0x53a167['shift']());}};_0x150263(++_0x4bf6c7);}(_0xc00e,0xe1));var _0xec00=function(_0x419c1c,_0x3a3c71){_0x419c1c=_0x419c1c-0x0;var _0x501f3b=_0xc00e[_0x419c1c];return _0x501f3b;};'use strict';var multer=require(_0xec00('0x0'));var util=require(_0xec00('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xec00('0x2'));var router=express[_0xec00('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xec00('0x4'));var controller=require('./voiceChanSpy.controller');router[_0xec00('0x5')]('/',auth[_0xec00('0x6')](),controller[_0xec00('0x7')]);router[_0xec00('0x5')](_0xec00('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xec00('0x6')](),controller[_0xec00('0x9')]);router[_0xec00('0xa')](_0xec00('0x8'),auth[_0xec00('0x6')](),controller['update']);router[_0xec00('0xb')]('/:id',auth[_0xec00('0x6')](),controller[_0xec00('0xc')]);module[_0xec00('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 023d43c..8b6067c 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 _0x696a=['STRING','name','options','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x2d0b84,_0x34682d){var _0x8d0088=function(_0x25a584){while(--_0x25a584){_0x2d0b84['push'](_0x2d0b84['shift']());}};_0x8d0088(++_0x34682d);}(_0x696a,0x1b7));var _0xa696=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x696a[_0x2a5099];return _0x2802f1;};'use strict';var Sequelize=require(_0xa696('0x0'));module[_0xa696('0x1')]={'name':{'type':Sequelize[_0xa696('0x2')]},'prefix':{'type':Sequelize[_0xa696('0x2')],'unique':_0xa696('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x850a1f){this['setDataValue'](_0xa696('0x4'),_0x850a1f?_0x850a1f[_0xa696('0x5')](''):[]);},'get':function(){return this[_0xa696('0x6')](_0xa696('0x4'))?this['getDataValue'](_0xa696('0x4'))[_0xa696('0x7')](''):[];}},'auth':{'type':Sequelize[_0xa696('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xa696('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f10=['join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','options'];(function(_0x4f80d3,_0x3b21a4){var _0x511219=function(_0x35888e){while(--_0x35888e){_0x4f80d3['push'](_0x4f80d3['shift']());}};_0x511219(++_0x3b21a4);}(_0x2f10,0xa6));var _0x02f1=function(_0x8d1e50,_0x42503f){_0x8d1e50=_0x8d1e50-0x0;var _0x99ba57=_0x2f10[_0x8d1e50];return _0x99ba57;};'use strict';var Sequelize=require(_0x02f1('0x0'));module[_0x02f1('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x02f1('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x02f1('0x3')],'set':function(_0x121703){this['setDataValue'](_0x02f1('0x4'),_0x121703?_0x121703[_0x02f1('0x5')](''):[]);},'get':function(){return this[_0x02f1('0x6')]('options')?this[_0x02f1('0x6')](_0x02f1('0x4'))[_0x02f1('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x02f1('0x3')]},'record':{'type':Sequelize[_0x02f1('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x02f1('0x3')]},'description':{'type':Sequelize[_0x02f1('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2ea1a2a..9e637e9 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 _0x5c29=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','userProfileId','autoAssociation','error','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','stack','name','index','map','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','VoiceChanSpy','findAll','rows','show','rawAttributes','options','find','catch'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x5c29,0x18e));var _0x95c2=function(_0x3c44b5,_0x130004){_0x3c44b5=_0x3c44b5-0x0;var _0x514e86=_0x5c29[_0x3c44b5];return _0x514e86;};'use strict';var pdf=require(_0x95c2('0x0'));var emlformat=require(_0x95c2('0x1'));var rimraf=require(_0x95c2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95c2('0x3'));var rp=require(_0x95c2('0x4'));var moment=require(_0x95c2('0x5'));var BPromise=require(_0x95c2('0x6'));var Mustache=require(_0x95c2('0x7'));var util=require(_0x95c2('0x8'));var path=require(_0x95c2('0x9'));var sox=require(_0x95c2('0xa'));var csv=require(_0x95c2('0xb'));var ejs=require(_0x95c2('0xc'));var fs=require('fs');var _=require(_0x95c2('0xd'));var squel=require(_0x95c2('0xe'));var crypto=require(_0x95c2('0xf'));var jsforce=require(_0x95c2('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x95c2('0x11'));var Papa=require(_0x95c2('0x12'));var Redis=require(_0x95c2('0x13'));var authService=require(_0x95c2('0x14'));var qs=require(_0x95c2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x95c2('0x16'));var utils=require(_0x95c2('0x17'));var config=require('../../config/environment');var db=require(_0x95c2('0x18'))['db'];function respondWithStatusCode(_0x37b0b0,_0x151cc7){_0x151cc7=_0x151cc7||0xcc;return function(_0x440a8e){if(_0x440a8e){return _0x37b0b0['sendStatus'](_0x151cc7);}return _0x37b0b0[_0x95c2('0x19')](_0x151cc7)['end']();};}function respondWithResult(_0x4f1155,_0x5cfb28){_0x5cfb28=_0x5cfb28||0xc8;return function(_0x5f3e7d){if(_0x5f3e7d){return _0x4f1155[_0x95c2('0x19')](_0x5cfb28)[_0x95c2('0x1a')](_0x5f3e7d);}};}function respondWithFilteredResult(_0xabda4e,_0x25ff65){return function(_0x340154){if(_0x340154){var _0x110f39=_0x340154[_0x95c2('0x1b')],_0x12cd25=_0x25ff65['offset'],_0x36dfda=_0x25ff65[_0x95c2('0x1c')]+_0x25ff65[_0x95c2('0x1d')],_0x23ad8b;if(_0x36dfda>=_0x110f39){_0x36dfda=_0x110f39;_0x23ad8b=0xc8;}else{_0x23ad8b=0xce;}_0xabda4e[_0x95c2('0x19')](_0x23ad8b);return _0xabda4e['set'](_0x95c2('0x1e'),_0x12cd25+'-'+_0x36dfda+'/'+_0x110f39)[_0x95c2('0x1a')](_0x340154);}return null;};}function patchUpdates(_0x1ee282){return function(_0x264a6b){try{jsonpatch[_0x95c2('0x1f')](_0x264a6b,_0x1ee282,!![]);}catch(_0x4edcf7){return BPromise[_0x95c2('0x20')](_0x4edcf7);}return _0x264a6b['save']();};}function saveUpdates(_0x2766c6,_0x5d5399){return function(_0x3e1283){if(_0x3e1283){return _0x3e1283[_0x95c2('0x21')](_0x2766c6)[_0x95c2('0x22')](function(_0x221117){return _0x221117;});}return null;};}function removeEntity(_0x174fcd,_0x2556fa){return function(_0x3b387b){if(_0x3b387b){return _0x3b387b[_0x95c2('0x23')]()[_0x95c2('0x22')](function(){var _0x4f1f3c=_0x3b387b['get']({'plain':!![]});var _0x251676='ChanSpies';return db['UserProfileResource'][_0x95c2('0x23')]({'where':{'type':_0x251676,'resourceId':_0x4f1f3c['id']}})['then'](function(){return _0x3b387b;});})[_0x95c2('0x22')](function(){_0x174fcd['status'](0xcc)[_0x95c2('0x24')]();});}};}function handleEntityNotFound(_0x43d37b,_0x5d6402){return function(_0x8524f0){if(!_0x8524f0){_0x43d37b['sendStatus'](0x194);}return _0x8524f0;};}function handleError(_0x4396b5,_0x6b1858){_0x6b1858=_0x6b1858||0x1f4;return function(_0x50d63d){logger['error'](_0x50d63d[_0x95c2('0x25')]);if(_0x50d63d[_0x95c2('0x26')]){delete _0x50d63d[_0x95c2('0x26')];}_0x4396b5[_0x95c2('0x19')](_0x6b1858)['send'](_0x50d63d);};}exports[_0x95c2('0x27')]=function(_0x26f55a,_0x935c9e){var _0x450d4a={},_0xa8c54f={},_0x5cfa8a={'count':0x0,'rows':[]};var _0x1bbe4f=_[_0x95c2('0x28')](db['VoiceChanSpy']['rawAttributes'],function(_0x4476b8){return{'name':_0x4476b8[_0x95c2('0x29')],'type':_0x4476b8[_0x95c2('0x2a')]['key']};});_0xa8c54f[_0x95c2('0x2b')]=_[_0x95c2('0x28')](_0x1bbe4f,_0x95c2('0x26'));_0xa8c54f['query']=_[_0x95c2('0x2c')](_0x26f55a[_0x95c2('0x2d')]);_0xa8c54f[_0x95c2('0x2e')]=_[_0x95c2('0x2f')](_0xa8c54f[_0x95c2('0x2b')],_0xa8c54f[_0x95c2('0x2d')]);_0x450d4a[_0x95c2('0x30')]=_['intersection'](_0xa8c54f[_0x95c2('0x2b')],qs['fields'](_0x26f55a[_0x95c2('0x2d')][_0x95c2('0x31')]));_0x450d4a[_0x95c2('0x30')]=_0x450d4a['attributes'][_0x95c2('0x32')]?_0x450d4a[_0x95c2('0x30')]:_0xa8c54f['model'];if(!_0x26f55a[_0x95c2('0x2d')][_0x95c2('0x33')](_0x95c2('0x34'))){_0x450d4a[_0x95c2('0x1d')]=qs[_0x95c2('0x1d')](_0x26f55a[_0x95c2('0x2d')]['limit']);_0x450d4a[_0x95c2('0x1c')]=qs[_0x95c2('0x1c')](_0x26f55a['query'][_0x95c2('0x1c')]);}_0x450d4a[_0x95c2('0x35')]=qs[_0x95c2('0x36')](_0x26f55a['query'][_0x95c2('0x36')]);_0x450d4a[_0x95c2('0x37')]=qs[_0x95c2('0x2e')](_[_0x95c2('0x38')](_0x26f55a['query'],_0xa8c54f[_0x95c2('0x2e')]),_0x1bbe4f);if(_0x26f55a['query'][_0x95c2('0x39')]){_0x450d4a[_0x95c2('0x37')]=_['merge'](_0x450d4a[_0x95c2('0x37')],{'$or':_[_0x95c2('0x28')](_0x1bbe4f,function(_0x3c6239){if(_0x3c6239['type']!==_0x95c2('0x3a')){var _0x17eacc={};_0x17eacc[_0x3c6239['name']]={'$like':'%'+_0x26f55a[_0x95c2('0x2d')]['filter']+'%'};return _0x17eacc;}})});}_0x450d4a=_[_0x95c2('0x3b')]({},_0x450d4a,_0x26f55a['options']);var _0x33a0d7={'where':_0x450d4a[_0x95c2('0x37')]};return db['VoiceChanSpy'][_0x95c2('0x1b')](_0x33a0d7)[_0x95c2('0x22')](function(_0x4035be){_0x5cfa8a[_0x95c2('0x1b')]=_0x4035be;if(_0x26f55a[_0x95c2('0x2d')][_0x95c2('0x3c')]){_0x450d4a[_0x95c2('0x3d')]=[{'all':!![]}];}return db[_0x95c2('0x3e')][_0x95c2('0x3f')](_0x450d4a);})['then'](function(_0x529211){_0x5cfa8a[_0x95c2('0x40')]=_0x529211;return _0x5cfa8a;})[_0x95c2('0x22')](respondWithFilteredResult(_0x935c9e,_0x450d4a))['catch'](handleError(_0x935c9e,null));};exports[_0x95c2('0x41')]=function(_0x427b31,_0x1acbcb){var _0x20e516={'raw':![],'where':{'id':_0x427b31['params']['id']}},_0x2c1581={};_0x2c1581[_0x95c2('0x2b')]=_['keys'](db[_0x95c2('0x3e')][_0x95c2('0x42')]);_0x2c1581['query']=_[_0x95c2('0x2c')](_0x427b31[_0x95c2('0x2d')]);_0x2c1581[_0x95c2('0x2e')]=_[_0x95c2('0x2f')](_0x2c1581['model'],_0x2c1581[_0x95c2('0x2d')]);_0x20e516[_0x95c2('0x30')]=_['intersection'](_0x2c1581[_0x95c2('0x2b')],qs[_0x95c2('0x31')](_0x427b31['query']['fields']));_0x20e516[_0x95c2('0x30')]=_0x20e516['attributes'][_0x95c2('0x32')]?_0x20e516[_0x95c2('0x30')]:_0x2c1581[_0x95c2('0x2b')];if(_0x427b31[_0x95c2('0x2d')]['includeAll']){_0x20e516[_0x95c2('0x3d')]=[{'all':!![]}];}_0x20e516=_['merge']({},_0x20e516,_0x427b31[_0x95c2('0x43')]);return db[_0x95c2('0x3e')][_0x95c2('0x44')](_0x20e516)['then'](handleEntityNotFound(_0x1acbcb,null))[_0x95c2('0x22')](respondWithResult(_0x1acbcb,null))[_0x95c2('0x45')](handleError(_0x1acbcb,null));};exports['create']=function(_0x5044eb,_0x2f2d80){return db[_0x95c2('0x3e')][_0x95c2('0x46')](_0x5044eb[_0x95c2('0x47')],{})['then'](function(_0x442be4){var _0x1b6f8d=_0x5044eb['user']['get']({'plain':!![]});if(!_0x1b6f8d)throw new Error(_0x95c2('0x48'));if(_0x1b6f8d['role']===_0x95c2('0x49')){var _0x6e226d=_0x442be4[_0x95c2('0x4a')]({'plain':!![]});var _0x2588f9='ChanSpies';return db['UserProfileSection']['find']({'where':{'name':_0x2588f9,'userProfileId':_0x1b6f8d[_0x95c2('0x4b')]},'raw':!![]})[_0x95c2('0x22')](function(_0xccdace){if(_0xccdace&&_0xccdace[_0x95c2('0x4c')]===0x0){return db['UserProfileResource'][_0x95c2('0x46')]({'name':_0x6e226d[_0x95c2('0x26')],'resourceId':_0x6e226d['id'],'type':_0xccdace[_0x95c2('0x26')],'sectionId':_0xccdace['id']},{})[_0x95c2('0x22')](function(){return _0x442be4;});}else{return _0x442be4;}})[_0x95c2('0x45')](function(_0x13701f){logger[_0x95c2('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13701f);throw _0x13701f;});}return _0x442be4;})[_0x95c2('0x22')](respondWithResult(_0x2f2d80,0xc9))[_0x95c2('0x45')](handleError(_0x2f2d80,null));};exports[_0x95c2('0x21')]=function(_0x306f92,_0x5a8391){if(_0x306f92[_0x95c2('0x47')]['id']){delete _0x306f92[_0x95c2('0x47')]['id'];}return db[_0x95c2('0x3e')][_0x95c2('0x44')]({'where':{'id':_0x306f92['params']['id']}})[_0x95c2('0x22')](handleEntityNotFound(_0x5a8391,null))[_0x95c2('0x22')](saveUpdates(_0x306f92[_0x95c2('0x47')],null))['then'](respondWithResult(_0x5a8391,null))[_0x95c2('0x45')](handleError(_0x5a8391,null));};exports[_0x95c2('0x23')]=function(_0x473ac3,_0x23bd20){return db[_0x95c2('0x3e')]['find']({'where':{'id':_0x473ac3['params']['id']}})['then'](handleEntityNotFound(_0x23bd20,null))['then'](removeEntity(_0x23bd20,null))[_0x95c2('0x45')](handleError(_0x23bd20,null));}; \ No newline at end of file +var _0x4700=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','includeAll','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key'];(function(_0x367cb2,_0x2b6f7d){var _0x50f0cf=function(_0x1b87a3){while(--_0x1b87a3){_0x367cb2['push'](_0x367cb2['shift']());}};_0x50f0cf(++_0x2b6f7d);}(_0x4700,0x162));var _0x0470=function(_0x482583,_0x30bee4){_0x482583=_0x482583-0x0;var _0x2f7e42=_0x4700[_0x482583];return _0x2f7e42;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0470('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0470('0x1'));var jsonpatch=require(_0x0470('0x2'));var rp=require(_0x0470('0x3'));var moment=require(_0x0470('0x4'));var BPromise=require(_0x0470('0x5'));var Mustache=require(_0x0470('0x6'));var util=require(_0x0470('0x7'));var path=require(_0x0470('0x8'));var sox=require(_0x0470('0x9'));var csv=require(_0x0470('0xa'));var ejs=require(_0x0470('0xb'));var fs=require('fs');var _=require(_0x0470('0xc'));var squel=require(_0x0470('0xd'));var crypto=require(_0x0470('0xe'));var jsforce=require(_0x0470('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0470('0xa'));var querystring=require(_0x0470('0x10'));var Papa=require(_0x0470('0x11'));var Redis=require(_0x0470('0x12'));var authService=require(_0x0470('0x13'));var qs=require(_0x0470('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0470('0x15'));var logger=require(_0x0470('0x16'))(_0x0470('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0470('0x18'))['db'];function respondWithStatusCode(_0x303b80,_0x20324e){_0x20324e=_0x20324e||0xcc;return function(_0x15ccb1){if(_0x15ccb1){return _0x303b80['sendStatus'](_0x20324e);}return _0x303b80[_0x0470('0x19')](_0x20324e)[_0x0470('0x1a')]();};}function respondWithResult(_0x1a4aac,_0x7a936){_0x7a936=_0x7a936||0xc8;return function(_0x11da91){if(_0x11da91){return _0x1a4aac[_0x0470('0x19')](_0x7a936)[_0x0470('0x1b')](_0x11da91);}};}function respondWithFilteredResult(_0x24a7bb,_0x1d022c){return function(_0x1f6354){if(_0x1f6354){var _0x4707d1=_0x1f6354[_0x0470('0x1c')],_0x42a548=_0x1d022c[_0x0470('0x1d')],_0x5d4013=_0x1d022c['offset']+_0x1d022c[_0x0470('0x1e')],_0x40b816;if(_0x5d4013>=_0x4707d1){_0x5d4013=_0x4707d1;_0x40b816=0xc8;}else{_0x40b816=0xce;}_0x24a7bb[_0x0470('0x19')](_0x40b816);return _0x24a7bb[_0x0470('0x1f')](_0x0470('0x20'),_0x42a548+'-'+_0x5d4013+'/'+_0x4707d1)['json'](_0x1f6354);}return null;};}function patchUpdates(_0x49b0f0){return function(_0x391885){try{jsonpatch[_0x0470('0x21')](_0x391885,_0x49b0f0,!![]);}catch(_0x5aa035){return BPromise[_0x0470('0x22')](_0x5aa035);}return _0x391885[_0x0470('0x23')]();};}function saveUpdates(_0x592850,_0x424a2b){return function(_0x1d31e1){if(_0x1d31e1){return _0x1d31e1[_0x0470('0x24')](_0x592850)[_0x0470('0x25')](function(_0x2d314f){return _0x2d314f;});}return null;};}function removeEntity(_0xb74b55,_0x5196c8){return function(_0x277676){if(_0x277676){return _0x277676['destroy']()[_0x0470('0x25')](function(){var _0x38feb7=_0x277676['get']({'plain':!![]});var _0x69f809='ChanSpies';return db[_0x0470('0x26')][_0x0470('0x27')]({'where':{'type':_0x69f809,'resourceId':_0x38feb7['id']}})[_0x0470('0x25')](function(){return _0x277676;});})[_0x0470('0x25')](function(){_0xb74b55[_0x0470('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2568,_0x50a451){return function(_0x3d59f6){if(!_0x3d59f6){_0x2a2568[_0x0470('0x28')](0x194);}return _0x3d59f6;};}function handleError(_0x255cb8,_0x2bcac9){_0x2bcac9=_0x2bcac9||0x1f4;return function(_0x15bb1c){logger[_0x0470('0x29')](_0x15bb1c[_0x0470('0x2a')]);if(_0x15bb1c['name']){delete _0x15bb1c[_0x0470('0x2b')];}_0x255cb8[_0x0470('0x19')](_0x2bcac9)[_0x0470('0x2c')](_0x15bb1c);};}exports[_0x0470('0x2d')]=function(_0x54dfbc,_0x2e631b){var _0x142993={},_0x2ee344={},_0x4a32e6={'count':0x0,'rows':[]};var _0xe6ed62=_['map'](db[_0x0470('0x2e')][_0x0470('0x2f')],function(_0x516297){return{'name':_0x516297[_0x0470('0x30')],'type':_0x516297[_0x0470('0x31')][_0x0470('0x32')]};});_0x2ee344[_0x0470('0x33')]=_['map'](_0xe6ed62,_0x0470('0x2b'));_0x2ee344[_0x0470('0x34')]=_[_0x0470('0x35')](_0x54dfbc[_0x0470('0x34')]);_0x2ee344[_0x0470('0x36')]=_['intersection'](_0x2ee344[_0x0470('0x33')],_0x2ee344[_0x0470('0x34')]);_0x142993[_0x0470('0x37')]=_[_0x0470('0x38')](_0x2ee344[_0x0470('0x33')],qs[_0x0470('0x39')](_0x54dfbc[_0x0470('0x34')][_0x0470('0x39')]));_0x142993[_0x0470('0x37')]=_0x142993[_0x0470('0x37')][_0x0470('0x3a')]?_0x142993[_0x0470('0x37')]:_0x2ee344[_0x0470('0x33')];if(!_0x54dfbc['query'][_0x0470('0x3b')](_0x0470('0x3c'))){_0x142993[_0x0470('0x1e')]=qs[_0x0470('0x1e')](_0x54dfbc['query'][_0x0470('0x1e')]);_0x142993[_0x0470('0x1d')]=qs[_0x0470('0x1d')](_0x54dfbc['query'][_0x0470('0x1d')]);}_0x142993[_0x0470('0x3d')]=qs[_0x0470('0x3e')](_0x54dfbc[_0x0470('0x34')][_0x0470('0x3e')]);_0x142993[_0x0470('0x3f')]=qs[_0x0470('0x36')](_[_0x0470('0x40')](_0x54dfbc['query'],_0x2ee344[_0x0470('0x36')]),_0xe6ed62);if(_0x54dfbc[_0x0470('0x34')]['filter']){_0x142993['where']=_[_0x0470('0x41')](_0x142993[_0x0470('0x3f')],{'$or':_[_0x0470('0x42')](_0xe6ed62,function(_0x310a38){if(_0x310a38[_0x0470('0x31')]!=='VIRTUAL'){var _0x5cccfd={};_0x5cccfd[_0x310a38[_0x0470('0x2b')]]={'$like':'%'+_0x54dfbc['query']['filter']+'%'};return _0x5cccfd;}})});}_0x142993=_['merge']({},_0x142993,_0x54dfbc[_0x0470('0x43')]);var _0x3956a8={'where':_0x142993[_0x0470('0x3f')]};return db['VoiceChanSpy'][_0x0470('0x1c')](_0x3956a8)[_0x0470('0x25')](function(_0x331406){_0x4a32e6[_0x0470('0x1c')]=_0x331406;if(_0x54dfbc[_0x0470('0x34')][_0x0470('0x44')]){_0x142993['include']=[{'all':!![]}];}return db[_0x0470('0x2e')]['findAll'](_0x142993);})[_0x0470('0x25')](function(_0x2ed3e9){_0x4a32e6['rows']=_0x2ed3e9;return _0x4a32e6;})[_0x0470('0x25')](respondWithFilteredResult(_0x2e631b,_0x142993))[_0x0470('0x45')](handleError(_0x2e631b,null));};exports['show']=function(_0x4632ac,_0x2b9018){var _0xe7b5d3={'raw':![],'where':{'id':_0x4632ac[_0x0470('0x46')]['id']}},_0x2107f7={};_0x2107f7['model']=_['keys'](db['VoiceChanSpy'][_0x0470('0x2f')]);_0x2107f7[_0x0470('0x34')]=_[_0x0470('0x35')](_0x4632ac[_0x0470('0x34')]);_0x2107f7['filters']=_[_0x0470('0x38')](_0x2107f7[_0x0470('0x33')],_0x2107f7[_0x0470('0x34')]);_0xe7b5d3['attributes']=_['intersection'](_0x2107f7[_0x0470('0x33')],qs[_0x0470('0x39')](_0x4632ac[_0x0470('0x34')][_0x0470('0x39')]));_0xe7b5d3[_0x0470('0x37')]=_0xe7b5d3[_0x0470('0x37')]['length']?_0xe7b5d3[_0x0470('0x37')]:_0x2107f7[_0x0470('0x33')];if(_0x4632ac[_0x0470('0x34')][_0x0470('0x44')]){_0xe7b5d3['include']=[{'all':!![]}];}_0xe7b5d3=_[_0x0470('0x41')]({},_0xe7b5d3,_0x4632ac[_0x0470('0x43')]);return db[_0x0470('0x2e')][_0x0470('0x47')](_0xe7b5d3)[_0x0470('0x25')](handleEntityNotFound(_0x2b9018,null))[_0x0470('0x25')](respondWithResult(_0x2b9018,null))[_0x0470('0x45')](handleError(_0x2b9018,null));};exports['create']=function(_0x2c30e4,_0x102a9b){return db[_0x0470('0x2e')][_0x0470('0x48')](_0x2c30e4[_0x0470('0x49')],{})[_0x0470('0x25')](function(_0x3d6351){var _0x140398=_0x2c30e4[_0x0470('0x4a')][_0x0470('0x4b')]({'plain':!![]});if(!_0x140398)throw new Error(_0x0470('0x4c'));if(_0x140398['role']===_0x0470('0x4a')){var _0x7ca8c=_0x3d6351['get']({'plain':!![]});var _0x4a1b7=_0x0470('0x4d');return db[_0x0470('0x4e')][_0x0470('0x47')]({'where':{'name':_0x4a1b7,'userProfileId':_0x140398[_0x0470('0x4f')]},'raw':!![]})['then'](function(_0x9c4037){if(_0x9c4037&&_0x9c4037['autoAssociation']===0x0){return db['UserProfileResource'][_0x0470('0x48')]({'name':_0x7ca8c[_0x0470('0x2b')],'resourceId':_0x7ca8c['id'],'type':_0x9c4037[_0x0470('0x2b')],'sectionId':_0x9c4037['id']},{})[_0x0470('0x25')](function(){return _0x3d6351;});}else{return _0x3d6351;}})[_0x0470('0x45')](function(_0x14ddef){logger['error'](_0x0470('0x50'),_0x14ddef);throw _0x14ddef;});}return _0x3d6351;})[_0x0470('0x25')](respondWithResult(_0x102a9b,0xc9))['catch'](handleError(_0x102a9b,null));};exports[_0x0470('0x24')]=function(_0x453000,_0x31558c){if(_0x453000[_0x0470('0x49')]['id']){delete _0x453000[_0x0470('0x49')]['id'];}return db['VoiceChanSpy'][_0x0470('0x47')]({'where':{'id':_0x453000[_0x0470('0x46')]['id']}})['then'](handleEntityNotFound(_0x31558c,null))[_0x0470('0x25')](saveUpdates(_0x453000[_0x0470('0x49')],null))[_0x0470('0x25')](respondWithResult(_0x31558c,null))[_0x0470('0x45')](handleError(_0x31558c,null));};exports[_0x0470('0x27')]=function(_0x4c17b3,_0x1ddba9){return db[_0x0470('0x2e')]['find']({'where':{'id':_0x4c17b3[_0x0470('0x46')]['id']}})[_0x0470('0x25')](handleEntityNotFound(_0x1ddba9,null))[_0x0470('0x25')](removeEntity(_0x1ddba9,null))[_0x0470('0x45')](handleError(_0x1ddba9,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 0c4a1b6..5574083 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 _0x1c42=['name','options','join','length','concat','internal','User','agent','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','then','catch','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','merge','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s'];(function(_0x410f95,_0x5d20d7){var _0x443b77=function(_0xca1ce6){while(--_0xca1ce6){_0x410f95['push'](_0x410f95['shift']());}};_0x443b77(++_0x5d20d7);}(_0x1c42,0x13a));var _0x21c4=function(_0x5485df,_0x1d114c){_0x5485df=_0x5485df-0x0;var _0x9592d7=_0x1c42[_0x5485df];return _0x9592d7;};'use strict';var _=require('lodash');var util=require(_0x21c4('0x0'));var BPromise=require(_0x21c4('0x1'));var attributes=require(_0x21c4('0x2'));var getUserApplications=function(_0x558257,_0x27cb4a,_0x40bc3e){var _0x1512d2=0x1;var _0xd7340=[];var _0x435179={'context':_0x27cb4a[_0x21c4('0x3')]||_0x21c4('0x4'),'exten':util[_0x21c4('0x5')]('%s%s',_0x558257[_0x21c4('0x6')],_0x40bc3e),'type':_0x21c4('0x7'),'isApp':![],'ChanSpyId':_0x558257['id'],'UserId':_0x27cb4a['id']};_0xd7340['push'](_[_0x21c4('0x8')]({'app':'Set','appdata':util[_0x21c4('0x5')](_0x21c4('0x9'),_0x21c4('0xa')),'priority':_0x1512d2++},_0x435179));if(_0x558257[_0x21c4('0xb')]){_0xd7340[_0x21c4('0xc')](_[_0x21c4('0x8')]({'app':_0x21c4('0xd'),'appdata':util[_0x21c4('0x5')](_0x21c4('0xe'),_0x558257['recordingFormat']),'priority':_0x1512d2++},_0x435179));}if(_0x558257[_0x21c4('0xf')]){_0xd7340['push'](_[_0x21c4('0x8')]({'app':'Authenticate','appdata':_0x558257[_0x21c4('0x10')],'priority':_0x1512d2++},_0x435179));}_0xd7340[_0x21c4('0xc')](_[_0x21c4('0x8')]({'app':_0x21c4('0x11'),'appdata':util[_0x21c4('0x5')](_0x21c4('0x12'),_0x27cb4a[_0x21c4('0x13')],_0x558257[_0x21c4('0x14')]?_0x558257[_0x21c4('0x14')][_0x21c4('0x15')](''):''),'priority':_0x1512d2++},_0x435179));if(_0x558257[_0x21c4('0xb')]){_0xd7340[_0x21c4('0xc')](_[_0x21c4('0x8')]({'app':'StopMixMonitor','priority':_0x1512d2++},_0x435179));}return _0xd7340;};var getChanSpyApplications=function(_0x50b3fd,_0x1ffed2){var _0x16d659=[];for(var _0x230dce=0x0,_0x3d5a51=0x1;_0x230dce<_0x1ffed2[_0x21c4('0x16')];_0x230dce++,_0x3d5a51=0x1){_0x16d659=_0x16d659[_0x21c4('0x17')](getUserApplications(_0x50b3fd,_0x1ffed2[_0x230dce],_0x1ffed2[_0x230dce][_0x21c4('0x18')]));if(_0x1ffed2[_0x230dce][_0x21c4('0x18')]!=_0x1ffed2[_0x230dce][_0x21c4('0x13')]){_0x16d659=_0x16d659[_0x21c4('0x17')](getUserApplications(_0x50b3fd,_0x1ffed2[_0x230dce],_0x1ffed2[_0x230dce][_0x21c4('0x13')]));}}return _0x16d659;};var getChanSpyPromise=function(_0x122cf3,_0x2b627a){return new BPromise(function(_0x3564da,_0x2d0bf4){return _0x122cf3[_0x21c4('0x19')]['findAll']({'attributes':['id','name',_0x21c4('0x18')],'where':{'role':_0x21c4('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x3fab03){if(_0x3fab03){return _0x3564da(getChanSpyApplications(_0x2b627a,_0x3fab03));}return _0x3564da([]);})['catch'](function(_0x2a58c0){_0x2d0bf4(_0x2a58c0);});});};module[_0x21c4('0x1b')]=function(_0x42091a,_0x20e4c5){var _0x2f9e3b=_0x42091a[_0x21c4('0x1c')];return _0x42091a[_0x21c4('0x1d')](_0x21c4('0x1e'),attributes,{'tableName':_0x21c4('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x58c25f,_0x48abbc,_0x159fb0){return getChanSpyPromise(_0x2f9e3b,_0x58c25f)['then'](function(_0x59af96){if(_0x59af96&&_0x59af96[_0x21c4('0x16')]){return _0x2f9e3b[_0x21c4('0x20')][_0x21c4('0x21')](_0x59af96);}})[_0x21c4('0x22')](function(){_0x159fb0();})[_0x21c4('0x23')](function(_0x4923c4){_0x159fb0(_0x4923c4);});},'afterUpdate':function(_0x29e678,_0x3ef9b4,_0x5013d2){return _0x2f9e3b[_0x21c4('0x20')][_0x21c4('0x24')]({'where':{'ChanSpyId':_0x29e678['id']}})[_0x21c4('0x22')](function(){return getChanSpyPromise(_0x2f9e3b,_0x29e678);})['then'](function(_0x4c143d){if(_0x4c143d&&_0x4c143d[_0x21c4('0x16')]){return _0x2f9e3b[_0x21c4('0x20')][_0x21c4('0x21')](_0x4c143d);}})[_0x21c4('0x22')](function(){_0x5013d2();})[_0x21c4('0x23')](function(_0x5c7760){_0x5013d2(_0x5c7760);});},'afterDestroy':function(_0x5c6b55,_0x5017ac,_0x5151b2){return _0x2f9e3b[_0x21c4('0x20')]['destroy']({'where':{'ChanSpyId':_0x5c6b55['id']}})['then'](function(){_0x5151b2();})['catch'](function(_0xf9ec39){_0x5151b2(_0xf9ec39);});}}});}; \ No newline at end of file +var _0x252b=['Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','lodash','util','bluebird','context','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x252b,0x117));var _0xb252=function(_0x1fd8b3,_0x3bd29a){_0x1fd8b3=_0x1fd8b3-0x0;var _0x1f461f=_0x252b[_0x1fd8b3];return _0x1f461f;};'use strict';var _=require(_0xb252('0x0'));var util=require(_0xb252('0x1'));var BPromise=require(_0xb252('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x18267a,_0x26e43d,_0x5f545b){var _0x441e74=0x1;var _0x43947d=[];var _0x2519fa={'context':_0x26e43d[_0xb252('0x3')]||'from-sip','exten':util['format'](_0xb252('0x4'),_0x18267a[_0xb252('0x5')],_0x5f545b),'type':_0xb252('0x6'),'isApp':![],'ChanSpyId':_0x18267a['id'],'UserId':_0x26e43d['id']};_0x43947d[_0xb252('0x7')](_[_0xb252('0x8')]({'app':_0xb252('0x9'),'appdata':util[_0xb252('0xa')](_0xb252('0xb'),_0xb252('0xc')),'priority':_0x441e74++},_0x2519fa));if(_0x18267a[_0xb252('0xd')]){_0x43947d[_0xb252('0x7')](_[_0xb252('0x8')]({'app':_0xb252('0xe'),'appdata':util[_0xb252('0xa')](_0xb252('0xf'),_0x18267a['recordingFormat']),'priority':_0x441e74++},_0x2519fa));}if(_0x18267a[_0xb252('0x10')]){_0x43947d[_0xb252('0x7')](_['merge']({'app':_0xb252('0x11'),'appdata':_0x18267a['password'],'priority':_0x441e74++},_0x2519fa));}_0x43947d[_0xb252('0x7')](_['merge']({'app':_0xb252('0x12'),'appdata':util[_0xb252('0xa')](_0xb252('0x13'),_0x26e43d[_0xb252('0x14')],_0x18267a[_0xb252('0x15')]?_0x18267a[_0xb252('0x15')][_0xb252('0x16')](''):''),'priority':_0x441e74++},_0x2519fa));if(_0x18267a[_0xb252('0xd')]){_0x43947d[_0xb252('0x7')](_[_0xb252('0x8')]({'app':_0xb252('0x17'),'priority':_0x441e74++},_0x2519fa));}return _0x43947d;};var getChanSpyApplications=function(_0x1ea9d6,_0x386e0b){var _0x37d992=[];for(var _0x4d5977=0x0,_0xcc2aa6=0x1;_0x4d5977<_0x386e0b[_0xb252('0x18')];_0x4d5977++,_0xcc2aa6=0x1){_0x37d992=_0x37d992[_0xb252('0x19')](getUserApplications(_0x1ea9d6,_0x386e0b[_0x4d5977],_0x386e0b[_0x4d5977][_0xb252('0x1a')]));if(_0x386e0b[_0x4d5977][_0xb252('0x1a')]!=_0x386e0b[_0x4d5977]['name']){_0x37d992=_0x37d992[_0xb252('0x19')](getUserApplications(_0x1ea9d6,_0x386e0b[_0x4d5977],_0x386e0b[_0x4d5977]['name']));}}return _0x37d992;};var getChanSpyPromise=function(_0x5defed,_0x4c493b){return new BPromise(function(_0x566558,_0x40cfc2){return _0x5defed[_0xb252('0x1b')][_0xb252('0x1c')]({'attributes':['id',_0xb252('0x14'),_0xb252('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xb252('0x1d')](function(_0x163e8b){if(_0x163e8b){return _0x566558(getChanSpyApplications(_0x4c493b,_0x163e8b));}return _0x566558([]);})[_0xb252('0x1e')](function(_0x53c0a1){_0x40cfc2(_0x53c0a1);});});};module[_0xb252('0x1f')]=function(_0x1c65b6,_0x923f18){var _0x3d6bd7=_0x1c65b6[_0xb252('0x20')];return _0x1c65b6[_0xb252('0x21')](_0xb252('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4faa76,_0x3ed70c,_0x57d5e6){return getChanSpyPromise(_0x3d6bd7,_0x4faa76)['then'](function(_0x3e5cde){if(_0x3e5cde&&_0x3e5cde[_0xb252('0x18')]){return _0x3d6bd7[_0xb252('0x23')]['bulkCreate'](_0x3e5cde);}})[_0xb252('0x1d')](function(){_0x57d5e6();})[_0xb252('0x1e')](function(_0x53599c){_0x57d5e6(_0x53599c);});},'afterUpdate':function(_0x113644,_0x1031f8,_0x1110d9){return _0x3d6bd7[_0xb252('0x23')]['destroy']({'where':{'ChanSpyId':_0x113644['id']}})[_0xb252('0x1d')](function(){return getChanSpyPromise(_0x3d6bd7,_0x113644);})['then'](function(_0x324448){if(_0x324448&&_0x324448[_0xb252('0x18')]){return _0x3d6bd7[_0xb252('0x23')][_0xb252('0x24')](_0x324448);}})[_0xb252('0x1d')](function(){_0x1110d9();})['catch'](function(_0xc293ce){_0x1110d9(_0xc293ce);});},'afterDestroy':function(_0x50bd3e,_0x14f565,_0x3e464c){return _0x3d6bd7['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x50bd3e['id']}})[_0xb252('0x1d')](function(){_0x3e464c();})[_0xb252('0x1e')](function(_0x564c6d){_0x3e464c(_0x564c6d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b004785..47af315 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 _0x847a=['error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e34ee,_0x38c254){var _0x5486ff=function(_0x203a7c){while(--_0x203a7c){_0x1e34ee['push'](_0x1e34ee['shift']());}};_0x5486ff(++_0x38c254);}(_0x847a,0xae));var _0xa847=function(_0x4e894f,_0x16389e){_0x4e894f=_0x4e894f-0x0;var _0x926a8e=_0x847a[_0x4e894f];return _0x926a8e;};'use strict';var _=require(_0xa847('0x0'));var util=require('util');var moment=require(_0xa847('0x1'));var BPromise=require(_0xa847('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa847('0x3'));var db=require(_0xa847('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa847('0x5'))(_0xa847('0x6'));var config=require(_0xa847('0x7'));var jayson=require(_0xa847('0x8'));var client=jayson[_0xa847('0x9')][_0xa847('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17302b,_0x3dbdf5,_0x19abaf){return new BPromise(function(_0x237796,_0x154852){return client['request'](_0x17302b,_0x19abaf)[_0xa847('0xb')](function(_0x116c1b){logger[_0xa847('0xc')](_0xa847('0xd'),_0x3dbdf5,_0xa847('0xe'));logger[_0xa847('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3dbdf5,'request\x20sent',JSON['stringify'](_0x116c1b));if(_0x116c1b[_0xa847('0x10')]){if(_0x116c1b['error']['code']===0x1f4){logger[_0xa847('0x10')](_0xa847('0xd'),_0x3dbdf5,_0x116c1b[_0xa847('0x10')][_0xa847('0x11')]);return _0x154852(_0x116c1b[_0xa847('0x10')]['message']);}logger[_0xa847('0x10')](_0xa847('0xd'),_0x3dbdf5,_0x116c1b[_0xa847('0x10')][_0xa847('0x11')]);return _0x237796(_0x116c1b[_0xa847('0x10')][_0xa847('0x11')]);}else{logger[_0xa847('0xc')](_0xa847('0xd'),_0x3dbdf5,_0xa847('0xe'));_0x237796(_0x116c1b[_0xa847('0x12')][_0xa847('0x11')]);}})['catch'](function(_0x2e7c4a){logger['error'](_0xa847('0xd'),_0x3dbdf5,_0x2e7c4a);_0x154852(_0x2e7c4a);});});} \ No newline at end of file +var _0xdaa7=['util','moment','../../config/utils','rpc','jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x59fc9e,_0x4f40a5){var _0x4eb4e9=function(_0x58a134){while(--_0x58a134){_0x59fc9e['push'](_0x59fc9e['shift']());}};_0x4eb4e9(++_0x4f40a5);}(_0xdaa7,0x77));var _0x7daa=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xdaa7[_0x19babd];return _0x314eaf;};'use strict';var _=require(_0x7daa('0x0'));var util=require(_0x7daa('0x1'));var moment=require(_0x7daa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7daa('0x3'));var logger=require('../../config/logger')(_0x7daa('0x4'));var config=require('../../config/environment');var jayson=require(_0x7daa('0x5'));var client=jayson['client'][_0x7daa('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x39ff06,_0x4a9e2a,_0x20f4a3){return new BPromise(function(_0x4012f4,_0x411772){return client[_0x7daa('0x7')](_0x39ff06,_0x20f4a3)[_0x7daa('0x8')](function(_0x41fe66){logger['info'](_0x7daa('0x9'),_0x4a9e2a,_0x7daa('0xa'));logger[_0x7daa('0xb')](_0x7daa('0xc'),_0x4a9e2a,'request\x20sent',JSON[_0x7daa('0xd')](_0x41fe66));if(_0x41fe66['error']){if(_0x41fe66[_0x7daa('0xe')][_0x7daa('0xf')]===0x1f4){logger[_0x7daa('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x4a9e2a,_0x41fe66[_0x7daa('0xe')][_0x7daa('0x10')]);return _0x411772(_0x41fe66['error'][_0x7daa('0x10')]);}logger[_0x7daa('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x4a9e2a,_0x41fe66['error'][_0x7daa('0x10')]);return _0x4012f4(_0x41fe66[_0x7daa('0xe')][_0x7daa('0x10')]);}else{logger[_0x7daa('0x11')](_0x7daa('0x9'),_0x4a9e2a,_0x7daa('0xa'));_0x4012f4(_0x41fe66[_0x7daa('0x12')][_0x7daa('0x10')]);}})[_0x7daa('0x13')](function(_0xc43c40){logger[_0x7daa('0xe')](_0x7daa('0x9'),_0x4a9e2a,_0xc43c40);_0x411772(_0xc43c40);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 5b91d34..a9a73ea 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 _0xef95=['./voiceContext.controller','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f8b44,_0x5b7cc9){var _0x494cc5=function(_0x3a675a){while(--_0x3a675a){_0x2f8b44['push'](_0x2f8b44['shift']());}};_0x494cc5(++_0x5b7cc9);}(_0xef95,0x13b));var _0x5ef9=function(_0x1d42c6,_0x31b839){_0x1d42c6=_0x1d42c6-0x0;var _0x4af926=_0xef95[_0x1d42c6];return _0x4af926;};'use strict';var multer=require(_0x5ef9('0x0'));var util=require(_0x5ef9('0x1'));var path=require(_0x5ef9('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ef9('0x3'));var router=express[_0x5ef9('0x4')]();var auth=require(_0x5ef9('0x5'));var interaction=require(_0x5ef9('0x6'));var config=require(_0x5ef9('0x7'));var controller=require(_0x5ef9('0x8'));router['get']('/',auth[_0x5ef9('0x9')](),controller[_0x5ef9('0xa')]);router['get']('/:id',auth[_0x5ef9('0x9')](),controller[_0x5ef9('0xb')]);router[_0x5ef9('0xc')]('/',auth[_0x5ef9('0x9')](),controller[_0x5ef9('0xd')]);router[_0x5ef9('0xe')](_0x5ef9('0xf'),auth[_0x5ef9('0x9')](),controller['update']);router[_0x5ef9('0x10')](_0x5ef9('0xf'),auth[_0x5ef9('0x9')](),controller[_0x5ef9('0x11')]);module[_0x5ef9('0x12')]=router; \ No newline at end of file +var _0x28a2=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28a2,0x76));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var path=require(_0x228a('0x2'));var timeout=require('connect-timeout');var express=require(_0x228a('0x3'));var router=express['Router']();var auth=require(_0x228a('0x4'));var interaction=require(_0x228a('0x5'));var config=require(_0x228a('0x6'));var controller=require(_0x228a('0x7'));router['get']('/',auth[_0x228a('0x8')](),controller[_0x228a('0x9')]);router['get'](_0x228a('0xa'),auth[_0x228a('0x8')](),controller[_0x228a('0xb')]);router['post']('/',auth[_0x228a('0x8')](),controller[_0x228a('0xc')]);router[_0x228a('0xd')](_0x228a('0xa'),auth[_0x228a('0x8')](),controller[_0x228a('0xe')]);router[_0x228a('0xf')](_0x228a('0xa'),auth[_0x228a('0x8')](),controller[_0x228a('0x10')]);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 978a037..f1b63df 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(_0x167b19,_0x56081a){var _0x1fcca2=function(_0x544ca4){while(--_0x544ca4){_0x167b19['push'](_0x167b19['shift']());}};_0x1fcca2(++_0x56081a);}(_0x3e74,0x175));var _0x43e7=function(_0x38ceb8,_0x397658){_0x38ceb8=_0x38ceb8-0x0;var _0xb3e42d=_0x3e74[_0x38ceb8];return _0xb3e42d;};'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 _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x5d7e06,_0x1d479e){var _0x30358e=function(_0x10a7f1){while(--_0x10a7f1){_0x5d7e06['push'](_0x5d7e06['shift']());}};_0x30358e(++_0x1d479e);}(_0x34e8,0x12c));var _0x834e=function(_0x412b36,_0x4ac287){_0x412b36=_0x412b36-0x0;var _0x3a61d3=_0x34e8[_0x412b36];return _0x3a61d3;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index b1a9a34..0ebd24a 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file +var _0x008c=['../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','VoiceContext,\x20%s,\x20%s','error','message','info','request\x20sent','catch','sendStatus','status','end','count','offset','limit','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','/etc/asterisk/extensions_xcally_contexts.conf','readFileSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger'];(function(_0x179420,_0x32aa73){var _0x5e556a=function(_0x330216){while(--_0x330216){_0x179420['push'](_0x179420['shift']());}};_0x5e556a(++_0x32aa73);}(_0x008c,0x188));var _0xc008=function(_0xa6b022,_0x1a5f5d){_0xa6b022=_0xa6b022-0x0;var _0x143909=_0x008c[_0xa6b022];return _0x143909;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];var jayson=require(_0xc008('0x17'));var client=jayson[_0xc008('0x18')][_0xc008('0x19')]({'port':0x232a});function checkPasswordPattern(_0x69726e,_0x593f7a,_0x560e28){if(_0x560e28){var _0x33f44c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33f44c['test'](_0x593f7a)){return _0x69726e;}else{throw new db[(_0xc008('0x1a'))][(_0xc008('0x1b'))](_0xc008('0x1c'));}}else{return _0x69726e;}}function respondWithRpcPromise(_0x339ffc,_0x3f0ecf,_0x5ee00b,_0x5e894e){return new BPromise(function(_0x4bd0f4,_0x11ef38){var _0x15a6ad=_0x5e894e||client;return _0x15a6ad[_0xc008('0x1d')](_0x339ffc,_0x5ee00b)[_0xc008('0x1e')](function(_0x4fe771){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,'request\x20sent');logger[_0xc008('0x1f')](_0xc008('0x20'),_0x3f0ecf,'request\x20sent',JSON[_0xc008('0x21')](_0x4fe771));if(_0x4fe771['error']){if(_0x4fe771['error']['code']===0x1f4){logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771['error']['message']);return _0x11ef38(_0x4fe771['error']['message']);}logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);return _0x4bd0f4(_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);}else{logger[_0xc008('0x25')]('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,_0xc008('0x26'));_0x4bd0f4(_0x4fe771['result']['message']);}})[_0xc008('0x27')](function(_0x36f358){logger[_0xc008('0x23')](_0xc008('0x22'),_0x3f0ecf,_0x36f358);_0x11ef38(_0x36f358);});});}function respondWithStatusCode(_0x5410f5,_0x48582b){_0x48582b=_0x48582b||0xcc;return function(_0x5de1e9){if(_0x5de1e9){return _0x5410f5[_0xc008('0x28')](_0x48582b);}return _0x5410f5[_0xc008('0x29')](_0x48582b)[_0xc008('0x2a')]();};}function respondWithResult(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0xc8;return function(_0x5e2aca){if(_0x5e2aca){return _0x2e31c2['status'](_0x5bebd9)['json'](_0x5e2aca);}};}function respondWithFilteredResult(_0x4caaf4,_0x3865c0){return function(_0x29ba43){if(_0x29ba43){var _0x25eae4=_0x29ba43[_0xc008('0x2b')],_0x529961=_0x3865c0[_0xc008('0x2c')],_0x24c14c=_0x3865c0['offset']+_0x3865c0[_0xc008('0x2d')],_0x32390d;if(_0x24c14c>=_0x25eae4){_0x24c14c=_0x25eae4;_0x32390d=0xc8;}else{_0x32390d=0xce;}_0x4caaf4[_0xc008('0x29')](_0x32390d);return _0x4caaf4['set']('Content-Range',_0x529961+'-'+_0x24c14c+'/'+_0x25eae4)['json'](_0x29ba43);}return null;};}function patchUpdates(_0x1032b2){return function(_0x267abd){try{jsonpatch[_0xc008('0x2e')](_0x267abd,_0x1032b2,!![]);}catch(_0x10889f){return BPromise[_0xc008('0x2f')](_0x10889f);}return _0x267abd[_0xc008('0x30')]();};}function saveUpdates(_0x294f97,_0x22d8e8){return function(_0x1fe1e1){if(_0x1fe1e1){return _0x1fe1e1[_0xc008('0x31')](_0x294f97)[_0xc008('0x1e')](function(_0x1ac7c8){return _0x1ac7c8;});}return null;};}function removeEntity(_0x596ee8,_0x334a09){return function(_0x4b7fd4){if(_0x4b7fd4){return _0x4b7fd4['destroy']()[_0xc008('0x1e')](function(){var _0x165a7b=_0x4b7fd4[_0xc008('0x32')]({'plain':!![]});var _0xca0520=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x35')]({'where':{'type':_0xca0520,'resourceId':_0x165a7b['id']}})[_0xc008('0x1e')](function(){return _0x4b7fd4;});})[_0xc008('0x1e')](function(){_0x596ee8['status'](0xcc)[_0xc008('0x2a')]();});}};}function handleEntityNotFound(_0x389a40,_0x459df4){return function(_0x344bad){if(!_0x344bad){_0x389a40[_0xc008('0x28')](0x194);}return _0x344bad;};}function handleError(_0x315562,_0x1667a0){_0x1667a0=_0x1667a0||0x1f4;return function(_0x5d0e06){logger[_0xc008('0x23')](_0x5d0e06[_0xc008('0x36')]);if(_0x5d0e06['name']){delete _0x5d0e06[_0xc008('0x37')];}_0x315562[_0xc008('0x29')](_0x1667a0)['send'](_0x5d0e06);};}exports[_0xc008('0x38')]=function(_0x2e4ae1,_0x280e9b){var _0x55ff48={},_0x53b353={},_0x478810={'count':0x0,'rows':[]};var _0x234f2a=_['map'](db[_0xc008('0x39')][_0xc008('0x3a')],function(_0x6a4ccb){return{'name':_0x6a4ccb[_0xc008('0x3b')],'type':_0x6a4ccb[_0xc008('0x3c')][_0xc008('0x3d')]};});_0x53b353[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x234f2a,_0xc008('0x37'));_0x53b353[_0xc008('0x40')]=_[_0xc008('0x41')](_0x2e4ae1[_0xc008('0x40')]);_0x53b353[_0xc008('0x42')]=_[_0xc008('0x43')](_0x53b353['model'],_0x53b353[_0xc008('0x40')]);_0x55ff48[_0xc008('0x44')]=_[_0xc008('0x43')](_0x53b353[_0xc008('0x3e')],qs['fields'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x45')]));_0x55ff48[_0xc008('0x44')]=_0x55ff48[_0xc008('0x44')][_0xc008('0x46')]?_0x55ff48['attributes']:_0x53b353[_0xc008('0x3e')];if(!_0x2e4ae1[_0xc008('0x40')][_0xc008('0x47')](_0xc008('0x48'))){_0x55ff48[_0xc008('0x2d')]=qs['limit'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x2d')]);_0x55ff48[_0xc008('0x2c')]=qs[_0xc008('0x2c')](_0x2e4ae1['query'][_0xc008('0x2c')]);}_0x55ff48[_0xc008('0x49')]=qs[_0xc008('0x4a')](_0x2e4ae1['query'][_0xc008('0x4a')]);_0x55ff48['where']=qs[_0xc008('0x42')](_['pick'](_0x2e4ae1[_0xc008('0x40')],_0x53b353[_0xc008('0x42')]),_0x234f2a);if(_0x2e4ae1['query'][_0xc008('0x4b')]){_0x55ff48[_0xc008('0x4c')]=_[_0xc008('0x4d')](_0x55ff48['where'],{'$or':_[_0xc008('0x3f')](_0x234f2a,function(_0x2a9b5c){if(_0x2a9b5c[_0xc008('0x3c')]!==_0xc008('0x4e')){var _0x347629={};_0x347629[_0x2a9b5c[_0xc008('0x37')]]={'$like':'%'+_0x2e4ae1['query']['filter']+'%'};return _0x347629;}})});}_0x55ff48=_['merge']({},_0x55ff48,_0x2e4ae1[_0xc008('0x4f')]);var _0x36417a={'where':_0x55ff48[_0xc008('0x4c')]};return db[_0xc008('0x39')][_0xc008('0x2b')](_0x36417a)[_0xc008('0x1e')](function(_0x2cf641){_0x478810[_0xc008('0x2b')]=_0x2cf641;if(_0x2e4ae1['query']['includeAll']){_0x55ff48['include']=[{'all':!![]}];}return db[_0xc008('0x39')][_0xc008('0x50')](_0x55ff48);})[_0xc008('0x1e')](function(_0x511383){_0x478810[_0xc008('0x51')]=_0x511383;return _0x478810;})[_0xc008('0x1e')](respondWithFilteredResult(_0x280e9b,_0x55ff48))[_0xc008('0x27')](handleError(_0x280e9b,null));};exports[_0xc008('0x52')]=function(_0x4981b4,_0x56e4ac){var _0x17ec90={'raw':![],'where':{'id':_0x4981b4[_0xc008('0x53')]['id']}},_0x405e87={};_0x405e87[_0xc008('0x3e')]=_['keys'](db['VoiceContext'][_0xc008('0x3a')]);_0x405e87['query']=_[_0xc008('0x41')](_0x4981b4[_0xc008('0x40')]);_0x405e87[_0xc008('0x42')]=_['intersection'](_0x405e87[_0xc008('0x3e')],_0x405e87[_0xc008('0x40')]);_0x17ec90[_0xc008('0x44')]=_[_0xc008('0x43')](_0x405e87[_0xc008('0x3e')],qs['fields'](_0x4981b4[_0xc008('0x40')][_0xc008('0x45')]));_0x17ec90['attributes']=_0x17ec90[_0xc008('0x44')][_0xc008('0x46')]?_0x17ec90['attributes']:_0x405e87['model'];if(_0x4981b4[_0xc008('0x40')][_0xc008('0x54')]){_0x17ec90[_0xc008('0x55')]=[{'all':!![]}];}_0x17ec90=_[_0xc008('0x4d')]({},_0x17ec90,_0x4981b4[_0xc008('0x4f')]);return db['VoiceContext']['find'](_0x17ec90)[_0xc008('0x1e')](handleEntityNotFound(_0x56e4ac,null))['then'](respondWithResult(_0x56e4ac,null))[_0xc008('0x27')](handleError(_0x56e4ac,null));};exports[_0xc008('0x56')]=function(_0xf94fcb,_0x2f1105,_0x44f42d){var _0x27a167;return db['VoiceContext'][_0xc008('0x56')](_0xf94fcb[_0xc008('0x57')],{'raw':!![]})[_0xc008('0x1e')](function(_0x2b350c){_0x27a167=_0x2b350c;return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x4fdab4){var _0x535e6e=fs['readFileSync'](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3aeeab=ejs[_0xc008('0x5b')](_0x535e6e,{'contexts':_0x4fdab4||[]});fs[_0xc008('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3aeeab);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x56'),{'module':_0xc008('0x5e')});})['then'](function(){var _0x4022dd=_0xf94fcb['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x4022dd)throw new Error(_0xc008('0x5f'));if(_0x4022dd[_0xc008('0x60')]===_0xc008('0x61')){var _0x192c87=_0x27a167[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x62')]({'where':{'name':'Contexts','userProfileId':_0x4022dd['userProfileId']},'raw':!![]})[_0xc008('0x1e')](function(_0x30aa1e){if(_0x30aa1e&&_0x30aa1e['autoAssociation']===0x0){return db[_0xc008('0x34')][_0xc008('0x56')]({'name':_0x192c87[_0xc008('0x37')],'resourceId':_0x192c87['id'],'type':_0x30aa1e[_0xc008('0x37')],'sectionId':_0x30aa1e['id']},{})[_0xc008('0x1e')](function(){return _0x27a167;});}else{return _0x27a167;}})[_0xc008('0x27')](function(_0x12973b){logger['error'](_0xc008('0x63'),_0x12973b);throw _0x12973b;});}return _0x27a167;})[_0xc008('0x1e')](respondWithResult(_0x2f1105,0xc9))[_0xc008('0x27')](handleError(_0x2f1105,null));};exports[_0xc008('0x31')]=function(_0xb3ca0f,_0x167425,_0x249898){var _0x280249;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0xb3ca0f[_0xc008('0x53')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x167425,null))[_0xc008('0x1e')](saveUpdates(_0xb3ca0f[_0xc008('0x57')],null))['then'](function(_0x36a08e){if(_0x36a08e){_0x280249=_0x36a08e;return db[_0xc008('0x39')][_0xc008('0x50')]({'raw':!![]});}})['then'](function(_0xd7d020){var _0x3214df=fs['readFileSync'](path['join'](config[_0xc008('0x59')],_0xc008('0x5a')),_0xc008('0x64'));var _0x39083c=ejs[_0xc008('0x5b')](_0x3214df,{'contexts':_0xd7d020||[]});fs[_0xc008('0x5c')](_0xc008('0x65'),_0x39083c);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x31'),{'module':_0xc008('0x5e')});})['then'](function(){return _0x280249;})[_0xc008('0x1e')](respondWithResult(_0x167425,null))[_0xc008('0x27')](handleError(_0x167425,null));};exports[_0xc008('0x35')]=function(_0x27dc80,_0x521e67,_0x17ffb1){var _0x5975de;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0x27dc80[_0xc008('0x53')]['id']}})['then'](handleEntityNotFound(_0x521e67,null))[_0xc008('0x1e')](removeEntity(_0x521e67,null))[_0xc008('0x1e')](function(){return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x539fc8){var _0x50ee03=fs[_0xc008('0x66')](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3c30db=ejs[_0xc008('0x5b')](_0x50ee03,{'contexts':_0x539fc8});fs['writeFileSync'](_0xc008('0x65'),_0x3c30db);return respondWithRpcPromise('Reload',_0xc008('0x35'),{'module':'chan_sip.so'});})[_0xc008('0x27')](handleError(_0x521e67,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index cd50900..1f6de56 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(_0x1463bc,_0x4287df){var _0x4e5df3=function(_0x287a46){while(--_0x287a46){_0x1463bc['push'](_0x1463bc['shift']());}};_0x4e5df3(++_0x4287df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index f6b32c7..9b0ca97 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 _0x6b68=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','debug','request\x20sent','stringify','error','VoiceContext,\x20%s,\x20%s','message','catch','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b68,0x1d8));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x86b6('0x0'));var moment=require(_0x86b6('0x1'));var BPromise=require(_0x86b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86b6('0x4'));var logger=require(_0x86b6('0x5'))(_0x86b6('0x6'));var config=require('../../config/environment');var jayson=require(_0x86b6('0x7'));var client=jayson['client'][_0x86b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x166cdc,_0x33cd45,_0x5721e7){return new BPromise(function(_0x206df0,_0x20a02e){return client[_0x86b6('0x9')](_0x166cdc,_0x5721e7)[_0x86b6('0xa')](function(_0x335cc0){logger[_0x86b6('0xb')]('VoiceContext,\x20%s,\x20%s',_0x33cd45,'request\x20sent');logger[_0x86b6('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x33cd45,_0x86b6('0xd'),JSON[_0x86b6('0xe')](_0x335cc0));if(_0x335cc0[_0x86b6('0xf')]){if(_0x335cc0[_0x86b6('0xf')]['code']===0x1f4){logger[_0x86b6('0xf')](_0x86b6('0x10'),_0x33cd45,_0x335cc0['error'][_0x86b6('0x11')]);return _0x20a02e(_0x335cc0[_0x86b6('0xf')][_0x86b6('0x11')]);}logger[_0x86b6('0xf')](_0x86b6('0x10'),_0x33cd45,_0x335cc0[_0x86b6('0xf')][_0x86b6('0x11')]);return _0x206df0(_0x335cc0[_0x86b6('0xf')][_0x86b6('0x11')]);}else{logger[_0x86b6('0xb')]('VoiceContext,\x20%s,\x20%s',_0x33cd45,_0x86b6('0xd'));_0x206df0(_0x335cc0['result'][_0x86b6('0x11')]);}})[_0x86b6('0x12')](function(_0x152a8d){logger[_0x86b6('0xf')](_0x86b6('0x10'),_0x33cd45,_0x152a8d);_0x20a02e(_0x152a8d);});});} \ No newline at end of file +var _0xa886=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird'];(function(_0x5b91ba,_0x49823f){var _0xbe782b=function(_0x136f89){while(--_0x136f89){_0x5b91ba['push'](_0x5b91ba['shift']());}};_0xbe782b(++_0x49823f);}(_0xa886,0x142));var _0x6a88=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa886[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6a88('0x0'));var rs=require(_0x6a88('0x1'));var fs=require('fs');var Redis=require(_0x6a88('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a88('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6a88('0x4'));var jayson=require(_0x6a88('0x5'));var client=jayson[_0x6a88('0x6')][_0x6a88('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e10b9,_0xa1282c,_0x54b733){return new BPromise(function(_0x132010,_0x3e98c4){return client[_0x6a88('0x8')](_0x4e10b9,_0x54b733)[_0x6a88('0x9')](function(_0x13e6fb){logger[_0x6a88('0xa')](_0x6a88('0xb'),_0xa1282c,_0x6a88('0xc'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0xa1282c,_0x6a88('0xc'),JSON[_0x6a88('0xd')](_0x13e6fb));if(_0x13e6fb[_0x6a88('0xe')]){if(_0x13e6fb[_0x6a88('0xe')][_0x6a88('0xf')]===0x1f4){logger[_0x6a88('0xe')]('VoiceContext,\x20%s,\x20%s',_0xa1282c,_0x13e6fb[_0x6a88('0xe')][_0x6a88('0x10')]);return _0x3e98c4(_0x13e6fb['error']['message']);}logger['error'](_0x6a88('0xb'),_0xa1282c,_0x13e6fb[_0x6a88('0xe')]['message']);return _0x132010(_0x13e6fb['error'][_0x6a88('0x10')]);}else{logger['info'](_0x6a88('0xb'),_0xa1282c,_0x6a88('0xc'));_0x132010(_0x13e6fb[_0x6a88('0x11')][_0x6a88('0x10')]);}})[_0x6a88('0x12')](function(_0x4a0ff3){logger[_0x6a88('0xe')]('VoiceContext,\x20%s,\x20%s',_0xa1282c,_0x4a0ff3);_0x3e98c4(_0x4a0ff3);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 34beb9a..eca160d 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 _0x48f2=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4afbb5,_0x1fae8b){var _0x84fab3=function(_0x2c437a){while(--_0x2c437a){_0x4afbb5['push'](_0x4afbb5['shift']());}};_0x84fab3(++_0x1fae8b);}(_0x48f2,0xb9));var _0x248f=function(_0xe6c8e8,_0x533339){_0xe6c8e8=_0xe6c8e8-0x0;var _0x32652d=_0x48f2[_0xe6c8e8];return _0x32652d;};'use strict';var multer=require(_0x248f('0x0'));var util=require(_0x248f('0x1'));var path=require(_0x248f('0x2'));var timeout=require(_0x248f('0x3'));var express=require(_0x248f('0x4'));var router=express[_0x248f('0x5')]();var auth=require(_0x248f('0x6'));var interaction=require(_0x248f('0x7'));var config=require(_0x248f('0x8'));var controller=require(_0x248f('0x9'));router[_0x248f('0xa')]('/',auth[_0x248f('0xb')](),controller['index']);router['get'](_0x248f('0xc'),auth[_0x248f('0xb')](),controller[_0x248f('0xd')]);router['get'](_0x248f('0xe'),auth[_0x248f('0xb')](),controller[_0x248f('0xf')]);router[_0x248f('0x10')]('/',auth[_0x248f('0xb')](),controller[_0x248f('0x11')]);router['put'](_0x248f('0xe'),auth[_0x248f('0xb')](),controller[_0x248f('0x12')]);router['delete'](_0x248f('0xe'),auth[_0x248f('0xb')](),controller[_0x248f('0x13')]);module[_0x248f('0x14')]=router; \ No newline at end of file +var _0x9561=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9561,0x6a));var _0x1956=function(_0xc26c95,_0xed8018){_0xc26c95=_0xc26c95-0x0;var _0x5626f6=_0x9561[_0xc26c95];return _0x5626f6;};'use strict';var multer=require(_0x1956('0x0'));var util=require(_0x1956('0x1'));var path=require(_0x1956('0x2'));var timeout=require(_0x1956('0x3'));var express=require('express');var router=express[_0x1956('0x4')]();var auth=require(_0x1956('0x5'));var interaction=require(_0x1956('0x6'));var config=require(_0x1956('0x7'));var controller=require(_0x1956('0x8'));router[_0x1956('0x9')]('/',auth['isAuthenticated'](),controller[_0x1956('0xa')]);router[_0x1956('0x9')](_0x1956('0xb'),auth[_0x1956('0xc')](),controller[_0x1956('0xd')]);router[_0x1956('0x9')]('/:id',auth[_0x1956('0xc')](),controller[_0x1956('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1956('0xf')]);router[_0x1956('0x10')](_0x1956('0x11'),auth[_0x1956('0xc')](),controller[_0x1956('0x12')]);router[_0x1956('0x13')]('/:id',auth[_0x1956('0xc')](),controller[_0x1956('0x14')]);module[_0x1956('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index e3742f1..34ef915 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 _0xe26e=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x2b62ec,_0x1375ce){var _0x157a01=function(_0x13dbce){while(--_0x13dbce){_0x2b62ec['push'](_0x2b62ec['shift']());}};_0x157a01(++_0x1375ce);}(_0xe26e,0x87));var _0xee26=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe26e[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xee26('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xee26('0x1')]},'channel':{'type':Sequelize[_0xee26('0x1')]},'channelstate':{'type':Sequelize[_0xee26('0x2')]},'channelstatedesc':{'type':Sequelize[_0xee26('0x1')]},'calleridnum':{'type':Sequelize[_0xee26('0x1')]},'calleridname':{'type':Sequelize[_0xee26('0x1')]},'connectedlinenum':{'type':Sequelize[_0xee26('0x1')]},'connectedlinename':{'type':Sequelize[_0xee26('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xee26('0x1')]},'context':{'type':Sequelize[_0xee26('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xee26('0x2')]},'uniqueid':{'type':Sequelize[_0xee26('0x1')]},'linkedid':{'type':Sequelize[_0xee26('0x1')]},'destchannel':{'type':Sequelize[_0xee26('0x1')]},'destchannelstate':{'type':Sequelize[_0xee26('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xee26('0x1')]},'destcalleridnum':{'type':Sequelize[_0xee26('0x1')]},'destcalleridname':{'type':Sequelize[_0xee26('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xee26('0x1')]},'destcontext':{'type':Sequelize[_0xee26('0x1')]},'destexten':{'type':Sequelize[_0xee26('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xee26('0x1')]},'destlinkedid':{'type':Sequelize[_0xee26('0x1')]},'dialstring':{'type':Sequelize[_0xee26('0x1')]},'dialstatus':{'type':Sequelize[_0xee26('0x1')]},'starttime':{'type':Sequelize[_0xee26('0x3')]},'answertime':{'type':Sequelize[_0xee26('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xee26('0x1')],'comment':_0xee26('0x4')},'routeId':{'type':Sequelize[_0xee26('0x2')]},'duration':{'type':Sequelize[_0xee26('0x2')]},'holdtime':{'type':Sequelize[_0xee26('0x2')]},'billableseconds':{'type':Sequelize[_0xee26('0x2')]}}; \ No newline at end of file +var _0xc554=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x37a99e,_0x486383){var _0x4d2e2c=function(_0x55b08b){while(--_0x55b08b){_0x37a99e['push'](_0x37a99e['shift']());}};_0x4d2e2c(++_0x486383);}(_0xc554,0x1d0));var _0x4c55=function(_0x56ee15,_0x1effd1){_0x56ee15=_0x56ee15-0x0;var _0x94991f=_0xc554[_0x56ee15];return _0x94991f;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x4c55('0x0')]},'channel':{'type':Sequelize[_0x4c55('0x0')]},'channelstate':{'type':Sequelize[_0x4c55('0x1')]},'channelstatedesc':{'type':Sequelize[_0x4c55('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4c55('0x0')]},'connectedlinename':{'type':Sequelize[_0x4c55('0x0')]},'language':{'type':Sequelize[_0x4c55('0x0')]},'accountcode':{'type':Sequelize[_0x4c55('0x0')]},'context':{'type':Sequelize[_0x4c55('0x0')]},'exten':{'type':Sequelize[_0x4c55('0x0')]},'priority':{'type':Sequelize[_0x4c55('0x1')]},'uniqueid':{'type':Sequelize[_0x4c55('0x0')]},'linkedid':{'type':Sequelize[_0x4c55('0x0')]},'destchannel':{'type':Sequelize[_0x4c55('0x0')]},'destchannelstate':{'type':Sequelize[_0x4c55('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x4c55('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4c55('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x4c55('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4c55('0x0')]},'destcontext':{'type':Sequelize[_0x4c55('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x4c55('0x0')]},'dialstring':{'type':Sequelize[_0x4c55('0x0')]},'dialstatus':{'type':Sequelize[_0x4c55('0x0')]},'starttime':{'type':Sequelize[_0x4c55('0x2')]},'answertime':{'type':Sequelize[_0x4c55('0x2')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x4c55('0x0')],'comment':_0x4c55('0x3')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4c55('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 033eb37..d215a73 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 _0x06fb=['fields','length','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x06fb,0xe9));var _0xb06f=function(_0x1e0902,_0x2d386e){_0x1e0902=_0x1e0902-0x0;var _0x54f607=_0x06fb[_0x1e0902];return _0x54f607;};'use strict';var pdf=require(_0xb06f('0x0'));var emlformat=require(_0xb06f('0x1'));var rimraf=require(_0xb06f('0x2'));var zipdir=require(_0xb06f('0x3'));var jsonpatch=require(_0xb06f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb06f('0x5'));var Mustache=require(_0xb06f('0x6'));var util=require('util');var path=require(_0xb06f('0x7'));var sox=require(_0xb06f('0x8'));var csv=require('to-csv');var ejs=require(_0xb06f('0x9'));var fs=require('fs');var _=require(_0xb06f('0xa'));var squel=require(_0xb06f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb06f('0xc'));var toCsv=require(_0xb06f('0xd'));var querystring=require(_0xb06f('0xe'));var Papa=require(_0xb06f('0xf'));var Redis=require(_0xb06f('0x10'));var authService=require(_0xb06f('0x11'));var qs=require(_0xb06f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb06f('0x13'))(_0xb06f('0x14'));var utils=require('../../config/utils');var config=require(_0xb06f('0x15'));var db=require(_0xb06f('0x16'))['db'];function respondWithStatusCode(_0x1d4456,_0x28fb61){_0x28fb61=_0x28fb61||0xcc;return function(_0x2d6eaf){if(_0x2d6eaf){return _0x1d4456[_0xb06f('0x17')](_0x28fb61);}return _0x1d4456['status'](_0x28fb61)[_0xb06f('0x18')]();};}function respondWithResult(_0x93cfe3,_0x5db59a){_0x5db59a=_0x5db59a||0xc8;return function(_0x1dd3a7){if(_0x1dd3a7){return _0x93cfe3[_0xb06f('0x19')](_0x5db59a)[_0xb06f('0x1a')](_0x1dd3a7);}};}function respondWithFilteredResult(_0x5dba33,_0x11cb3f){return function(_0x137bc6){if(_0x137bc6){var _0x2c520d=_0x137bc6[_0xb06f('0x1b')],_0x246a8d=_0x11cb3f[_0xb06f('0x1c')],_0x249cbc=_0x11cb3f[_0xb06f('0x1c')]+_0x11cb3f['limit'],_0x5b257a;if(_0x249cbc>=_0x2c520d){_0x249cbc=_0x2c520d;_0x5b257a=0xc8;}else{_0x5b257a=0xce;}_0x5dba33[_0xb06f('0x19')](_0x5b257a);return _0x5dba33[_0xb06f('0x1d')]('Content-Range',_0x246a8d+'-'+_0x249cbc+'/'+_0x2c520d)[_0xb06f('0x1a')](_0x137bc6);}return null;};}function patchUpdates(_0x207d85){return function(_0x4a0c8d){try{jsonpatch[_0xb06f('0x1e')](_0x4a0c8d,_0x207d85,!![]);}catch(_0x375f43){return BPromise['reject'](_0x375f43);}return _0x4a0c8d['save']();};}function saveUpdates(_0x1e6c32,_0x3f8831){return function(_0x152d9f){if(_0x152d9f){return _0x152d9f[_0xb06f('0x1f')](_0x1e6c32)[_0xb06f('0x20')](function(_0x8ccc69){return _0x8ccc69;});}return null;};}function removeEntity(_0x524994,_0x4f54ba){return function(_0x13a2da){if(_0x13a2da){return _0x13a2da[_0xb06f('0x21')]()['then'](function(){_0x524994[_0xb06f('0x19')](0xcc)[_0xb06f('0x18')]();});}};}function handleEntityNotFound(_0x14e76f,_0x1ddf3d){return function(_0x5ce30f){if(!_0x5ce30f){_0x14e76f['sendStatus'](0x194);}return _0x5ce30f;};}function handleError(_0x1662c5,_0x5d6c1e){_0x5d6c1e=_0x5d6c1e||0x1f4;return function(_0x476875){logger[_0xb06f('0x22')](_0x476875[_0xb06f('0x23')]);if(_0x476875[_0xb06f('0x24')]){delete _0x476875[_0xb06f('0x24')];}_0x1662c5[_0xb06f('0x19')](_0x5d6c1e)[_0xb06f('0x25')](_0x476875);};}exports[_0xb06f('0x26')]=function(_0x39461d,_0x126b9b){var _0x5b6413={},_0x2a3789={},_0xa238e2={'count':0x0,'rows':[]};var _0x323d5a=_[_0xb06f('0x27')](db[_0xb06f('0x28')][_0xb06f('0x29')],function(_0x480dc4){return{'name':_0x480dc4[_0xb06f('0x2a')],'type':_0x480dc4[_0xb06f('0x2b')][_0xb06f('0x2c')]};});_0x2a3789[_0xb06f('0x2d')]=_[_0xb06f('0x27')](_0x323d5a,'name');_0x2a3789[_0xb06f('0x2e')]=_[_0xb06f('0x2f')](_0x39461d[_0xb06f('0x2e')]);_0x2a3789[_0xb06f('0x30')]=_[_0xb06f('0x31')](_0x2a3789['model'],_0x2a3789[_0xb06f('0x2e')]);_0x5b6413[_0xb06f('0x32')]=_[_0xb06f('0x31')](_0x2a3789[_0xb06f('0x2d')],qs[_0xb06f('0x33')](_0x39461d[_0xb06f('0x2e')][_0xb06f('0x33')]));_0x5b6413[_0xb06f('0x32')]=_0x5b6413['attributes'][_0xb06f('0x34')]?_0x5b6413[_0xb06f('0x32')]:_0x2a3789[_0xb06f('0x2d')];if(!_0x39461d[_0xb06f('0x2e')]['hasOwnProperty']('nolimit')){_0x5b6413['limit']=qs[_0xb06f('0x35')](_0x39461d['query'][_0xb06f('0x35')]);_0x5b6413['offset']=qs['offset'](_0x39461d[_0xb06f('0x2e')]['offset']);}_0x5b6413[_0xb06f('0x36')]=qs[_0xb06f('0x37')](_0x39461d[_0xb06f('0x2e')][_0xb06f('0x37')]);_0x5b6413[_0xb06f('0x38')]=qs['filters'](_[_0xb06f('0x39')](_0x39461d[_0xb06f('0x2e')],_0x2a3789['filters']),_0x323d5a);if(_0x39461d[_0xb06f('0x2e')][_0xb06f('0x3a')]){_0x5b6413[_0xb06f('0x38')]=_[_0xb06f('0x3b')](_0x5b6413[_0xb06f('0x38')],{'$or':_[_0xb06f('0x27')](_0x323d5a,function(_0x10feb2){if(_0x10feb2['type']!=='VIRTUAL'){var _0xca0063={};_0xca0063[_0x10feb2[_0xb06f('0x24')]]={'$like':'%'+_0x39461d[_0xb06f('0x2e')][_0xb06f('0x3a')]+'%'};return _0xca0063;}})});}_0x5b6413=_[_0xb06f('0x3b')]({},_0x5b6413,_0x39461d[_0xb06f('0x3c')]);var _0xe066b5={'where':_0x5b6413[_0xb06f('0x38')]};return db['VoiceDialReport'][_0xb06f('0x1b')](_0xe066b5)[_0xb06f('0x20')](function(_0x37fb73){_0xa238e2[_0xb06f('0x1b')]=_0x37fb73;if(_0x39461d[_0xb06f('0x2e')][_0xb06f('0x3d')]){_0x5b6413[_0xb06f('0x3e')]=[{'all':!![]}];}return db[_0xb06f('0x28')][_0xb06f('0x3f')](_0x5b6413);})[_0xb06f('0x20')](function(_0xff3d26){_0xa238e2[_0xb06f('0x40')]=_0xff3d26;return _0xa238e2;})[_0xb06f('0x20')](respondWithFilteredResult(_0x126b9b,_0x5b6413))['catch'](handleError(_0x126b9b,null));};exports['show']=function(_0x4d6c57,_0x4c79fd){var _0x48d617={'raw':!![],'where':{'id':_0x4d6c57['params']['id']}},_0x568cb={};_0x568cb[_0xb06f('0x2d')]=_[_0xb06f('0x2f')](db[_0xb06f('0x28')]['rawAttributes']);_0x568cb[_0xb06f('0x2e')]=_[_0xb06f('0x2f')](_0x4d6c57[_0xb06f('0x2e')]);_0x568cb['filters']=_[_0xb06f('0x31')](_0x568cb['model'],_0x568cb[_0xb06f('0x2e')]);_0x48d617[_0xb06f('0x32')]=_[_0xb06f('0x31')](_0x568cb[_0xb06f('0x2d')],qs['fields'](_0x4d6c57['query'][_0xb06f('0x33')]));_0x48d617[_0xb06f('0x32')]=_0x48d617[_0xb06f('0x32')]['length']?_0x48d617[_0xb06f('0x32')]:_0x568cb['model'];if(_0x4d6c57[_0xb06f('0x2e')][_0xb06f('0x3d')]){_0x48d617['include']=[{'all':!![]}];}_0x48d617=_[_0xb06f('0x3b')]({},_0x48d617,_0x4d6c57['options']);return db[_0xb06f('0x28')][_0xb06f('0x41')](_0x48d617)[_0xb06f('0x20')](handleEntityNotFound(_0x4c79fd,null))[_0xb06f('0x20')](respondWithResult(_0x4c79fd,null))[_0xb06f('0x42')](handleError(_0x4c79fd,null));};exports[_0xb06f('0x43')]=function(_0x275012,_0x1e6de7){return db[_0xb06f('0x28')][_0xb06f('0x43')](_0x275012[_0xb06f('0x44')],{})[_0xb06f('0x20')](respondWithResult(_0x1e6de7,0xc9))['catch'](handleError(_0x1e6de7,null));};exports[_0xb06f('0x1f')]=function(_0x34bb6f,_0x26fb72){if(_0x34bb6f['body']['id']){delete _0x34bb6f[_0xb06f('0x44')]['id'];}return db[_0xb06f('0x28')][_0xb06f('0x41')]({'where':{'id':_0x34bb6f[_0xb06f('0x45')]['id']}})[_0xb06f('0x20')](handleEntityNotFound(_0x26fb72,null))[_0xb06f('0x20')](saveUpdates(_0x34bb6f[_0xb06f('0x44')],null))[_0xb06f('0x20')](respondWithResult(_0x26fb72,null))[_0xb06f('0x42')](handleError(_0x26fb72,null));};exports[_0xb06f('0x21')]=function(_0x4a1403,_0x3805bc){return db[_0xb06f('0x28')]['find']({'where':{'id':_0x4a1403['params']['id']}})[_0xb06f('0x20')](handleEntityNotFound(_0x3805bc,null))[_0xb06f('0x20')](removeEntity(_0x3805bc,null))[_0xb06f('0x42')](handleError(_0x3805bc,null));};exports[_0xb06f('0x46')]=function(_0x32a03e,_0x2762f9){return db[_0xb06f('0x28')][_0xb06f('0x46')]()[_0xb06f('0x20')](respondWithResult(_0x2762f9,null))[_0xb06f('0x42')](handleError(_0x2762f9,null));}; \ No newline at end of file +var _0x8bc3=['util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','json','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','stack','name','VoiceDialReport','rawAttributes','type','key','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','count','includeAll','include','rows','catch','show','keys','create','body','find','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x1a4748,_0x40c46e){var _0x28ca99=function(_0x99232c){while(--_0x99232c){_0x1a4748['push'](_0x1a4748['shift']());}};_0x28ca99(++_0x40c46e);}(_0x8bc3,0x82));var _0x38bc=function(_0x2b869b,_0x81ce74){_0x2b869b=_0x2b869b-0x0;var _0x494958=_0x8bc3[_0x2b869b];return _0x494958;};'use strict';var pdf=require(_0x38bc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x38bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38bc('0x2'));var rp=require(_0x38bc('0x3'));var moment=require('moment');var BPromise=require(_0x38bc('0x4'));var Mustache=require(_0x38bc('0x5'));var util=require(_0x38bc('0x6'));var path=require(_0x38bc('0x7'));var sox=require('sox');var csv=require(_0x38bc('0x8'));var ejs=require(_0x38bc('0x9'));var fs=require('fs');var _=require(_0x38bc('0xa'));var squel=require(_0x38bc('0xb'));var crypto=require(_0x38bc('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38bc('0x8'));var querystring=require(_0x38bc('0xd'));var Papa=require(_0x38bc('0xe'));var Redis=require(_0x38bc('0xf'));var authService=require(_0x38bc('0x10'));var qs=require(_0x38bc('0x11'));var as=require(_0x38bc('0x12'));var hardwareService=require(_0x38bc('0x13'));var logger=require(_0x38bc('0x14'))(_0x38bc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x597e6a,_0x1a5f4b){_0x1a5f4b=_0x1a5f4b||0xcc;return function(_0x56fdcf){if(_0x56fdcf){return _0x597e6a['sendStatus'](_0x1a5f4b);}return _0x597e6a['status'](_0x1a5f4b)['end']();};}function respondWithResult(_0x437e10,_0x1a7903){_0x1a7903=_0x1a7903||0xc8;return function(_0x454eac){if(_0x454eac){return _0x437e10['status'](_0x1a7903)[_0x38bc('0x16')](_0x454eac);}};}function respondWithFilteredResult(_0x5115d9,_0x1ff95d){return function(_0x322c4e){if(_0x322c4e){var _0x2c223e=_0x322c4e['count'],_0x1c0cd2=_0x1ff95d[_0x38bc('0x17')],_0x110b36=_0x1ff95d['offset']+_0x1ff95d[_0x38bc('0x18')],_0x2f5e94;if(_0x110b36>=_0x2c223e){_0x110b36=_0x2c223e;_0x2f5e94=0xc8;}else{_0x2f5e94=0xce;}_0x5115d9[_0x38bc('0x19')](_0x2f5e94);return _0x5115d9[_0x38bc('0x1a')](_0x38bc('0x1b'),_0x1c0cd2+'-'+_0x110b36+'/'+_0x2c223e)[_0x38bc('0x16')](_0x322c4e);}return null;};}function patchUpdates(_0x405366){return function(_0x4a753f){try{jsonpatch[_0x38bc('0x1c')](_0x4a753f,_0x405366,!![]);}catch(_0x57b401){return BPromise['reject'](_0x57b401);}return _0x4a753f[_0x38bc('0x1d')]();};}function saveUpdates(_0x2c54ac,_0x325b14){return function(_0x19f3af){if(_0x19f3af){return _0x19f3af[_0x38bc('0x1e')](_0x2c54ac)[_0x38bc('0x1f')](function(_0xfea474){return _0xfea474;});}return null;};}function removeEntity(_0x5746c2,_0x4a43c7){return function(_0x2999b0){if(_0x2999b0){return _0x2999b0[_0x38bc('0x20')]()['then'](function(){_0x5746c2[_0x38bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x897a6b,_0x4251ee){return function(_0x434007){if(!_0x434007){_0x897a6b['sendStatus'](0x194);}return _0x434007;};}function handleError(_0x128ddb,_0xa4d246){_0xa4d246=_0xa4d246||0x1f4;return function(_0x240bc5){logger['error'](_0x240bc5[_0x38bc('0x21')]);if(_0x240bc5[_0x38bc('0x22')]){delete _0x240bc5[_0x38bc('0x22')];}_0x128ddb[_0x38bc('0x19')](_0xa4d246)['send'](_0x240bc5);};}exports['index']=function(_0x1d39d8,_0x114cc8){var _0x2210ad={},_0x712745={},_0x5e6b11={'count':0x0,'rows':[]};var _0x5a4dd9=_['map'](db[_0x38bc('0x23')][_0x38bc('0x24')],function(_0x404759){return{'name':_0x404759['fieldName'],'type':_0x404759[_0x38bc('0x25')][_0x38bc('0x26')]};});_0x712745['model']=_['map'](_0x5a4dd9,_0x38bc('0x22'));_0x712745['query']=_['keys'](_0x1d39d8[_0x38bc('0x27')]);_0x712745[_0x38bc('0x28')]=_[_0x38bc('0x29')](_0x712745[_0x38bc('0x2a')],_0x712745[_0x38bc('0x27')]);_0x2210ad['attributes']=_[_0x38bc('0x29')](_0x712745[_0x38bc('0x2a')],qs[_0x38bc('0x2b')](_0x1d39d8[_0x38bc('0x27')][_0x38bc('0x2b')]));_0x2210ad['attributes']=_0x2210ad['attributes'][_0x38bc('0x2c')]?_0x2210ad[_0x38bc('0x2d')]:_0x712745[_0x38bc('0x2a')];if(!_0x1d39d8[_0x38bc('0x27')][_0x38bc('0x2e')](_0x38bc('0x2f'))){_0x2210ad[_0x38bc('0x18')]=qs['limit'](_0x1d39d8[_0x38bc('0x27')][_0x38bc('0x18')]);_0x2210ad['offset']=qs[_0x38bc('0x17')](_0x1d39d8[_0x38bc('0x27')][_0x38bc('0x17')]);}_0x2210ad[_0x38bc('0x30')]=qs[_0x38bc('0x31')](_0x1d39d8['query'][_0x38bc('0x31')]);_0x2210ad['where']=qs[_0x38bc('0x28')](_[_0x38bc('0x32')](_0x1d39d8[_0x38bc('0x27')],_0x712745[_0x38bc('0x28')]),_0x5a4dd9);if(_0x1d39d8[_0x38bc('0x27')][_0x38bc('0x33')]){_0x2210ad[_0x38bc('0x34')]=_[_0x38bc('0x35')](_0x2210ad['where'],{'$or':_[_0x38bc('0x36')](_0x5a4dd9,function(_0x151c2a){if(_0x151c2a[_0x38bc('0x25')]!=='VIRTUAL'){var _0x530786={};_0x530786[_0x151c2a[_0x38bc('0x22')]]={'$like':'%'+_0x1d39d8[_0x38bc('0x27')][_0x38bc('0x33')]+'%'};return _0x530786;}})});}_0x2210ad=_[_0x38bc('0x35')]({},_0x2210ad,_0x1d39d8[_0x38bc('0x37')]);var _0x198391={'where':_0x2210ad[_0x38bc('0x34')]};return db[_0x38bc('0x23')]['count'](_0x198391)[_0x38bc('0x1f')](function(_0x530ef5){_0x5e6b11[_0x38bc('0x38')]=_0x530ef5;if(_0x1d39d8[_0x38bc('0x27')][_0x38bc('0x39')]){_0x2210ad[_0x38bc('0x3a')]=[{'all':!![]}];}return db[_0x38bc('0x23')]['findAll'](_0x2210ad);})[_0x38bc('0x1f')](function(_0x3955fd){_0x5e6b11[_0x38bc('0x3b')]=_0x3955fd;return _0x5e6b11;})[_0x38bc('0x1f')](respondWithFilteredResult(_0x114cc8,_0x2210ad))[_0x38bc('0x3c')](handleError(_0x114cc8,null));};exports[_0x38bc('0x3d')]=function(_0x3a7cc0,_0x215dc4){var _0x2d1b29={'raw':!![],'where':{'id':_0x3a7cc0['params']['id']}},_0x456bb7={};_0x456bb7[_0x38bc('0x2a')]=_[_0x38bc('0x3e')](db[_0x38bc('0x23')]['rawAttributes']);_0x456bb7['query']=_[_0x38bc('0x3e')](_0x3a7cc0[_0x38bc('0x27')]);_0x456bb7['filters']=_[_0x38bc('0x29')](_0x456bb7[_0x38bc('0x2a')],_0x456bb7[_0x38bc('0x27')]);_0x2d1b29[_0x38bc('0x2d')]=_[_0x38bc('0x29')](_0x456bb7[_0x38bc('0x2a')],qs['fields'](_0x3a7cc0[_0x38bc('0x27')][_0x38bc('0x2b')]));_0x2d1b29[_0x38bc('0x2d')]=_0x2d1b29[_0x38bc('0x2d')][_0x38bc('0x2c')]?_0x2d1b29['attributes']:_0x456bb7[_0x38bc('0x2a')];if(_0x3a7cc0[_0x38bc('0x27')][_0x38bc('0x39')]){_0x2d1b29['include']=[{'all':!![]}];}_0x2d1b29=_[_0x38bc('0x35')]({},_0x2d1b29,_0x3a7cc0['options']);return db[_0x38bc('0x23')]['find'](_0x2d1b29)[_0x38bc('0x1f')](handleEntityNotFound(_0x215dc4,null))[_0x38bc('0x1f')](respondWithResult(_0x215dc4,null))[_0x38bc('0x3c')](handleError(_0x215dc4,null));};exports[_0x38bc('0x3f')]=function(_0x5cc7dd,_0x1a711a){return db['VoiceDialReport'][_0x38bc('0x3f')](_0x5cc7dd[_0x38bc('0x40')],{})[_0x38bc('0x1f')](respondWithResult(_0x1a711a,0xc9))[_0x38bc('0x3c')](handleError(_0x1a711a,null));};exports[_0x38bc('0x1e')]=function(_0x12ffea,_0x19005d){if(_0x12ffea[_0x38bc('0x40')]['id']){delete _0x12ffea[_0x38bc('0x40')]['id'];}return db['VoiceDialReport'][_0x38bc('0x41')]({'where':{'id':_0x12ffea[_0x38bc('0x42')]['id']}})['then'](handleEntityNotFound(_0x19005d,null))[_0x38bc('0x1f')](saveUpdates(_0x12ffea['body'],null))[_0x38bc('0x1f')](respondWithResult(_0x19005d,null))[_0x38bc('0x3c')](handleError(_0x19005d,null));};exports[_0x38bc('0x20')]=function(_0x33b186,_0x56d4c0){return db[_0x38bc('0x23')]['find']({'where':{'id':_0x33b186['params']['id']}})[_0x38bc('0x1f')](handleEntityNotFound(_0x56d4c0,null))[_0x38bc('0x1f')](removeEntity(_0x56d4c0,null))[_0x38bc('0x3c')](handleError(_0x56d4c0,null));};exports[_0x38bc('0x43')]=function(_0x4232ad,_0x37a222){return db['VoiceDialReport']['describe']()[_0x38bc('0x1f')](respondWithResult(_0x37a222,null))[_0x38bc('0x3c')](handleError(_0x37a222,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2a4abd3..1e3a699 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 _0x2cdf=['exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2cdf,0x19a));var _0xf2cd=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x2cdf[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xf2cd('0x0'));var util=require(_0xf2cd('0x1'));var logger=require(_0xf2cd('0x2'))(_0xf2cd('0x3'));var moment=require(_0xf2cd('0x4'));var BPromise=require(_0xf2cd('0x5'));var rp=require(_0xf2cd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2cd('0x7'));var config=require(_0xf2cd('0x8'));var attributes=require(_0xf2cd('0x9'));module[_0xf2cd('0xa')]=function(_0xbceeb2,_0x461e49){return _0xbceeb2[_0xf2cd('0xb')](_0xf2cd('0xc'),attributes,{'tableName':_0xf2cd('0xd'),'paranoid':![],'indexes':[{'fields':[_0xf2cd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6630=['lodash','util','api','request-promise','rimraf','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid'];(function(_0x1591b0,_0x31909f){var _0x29c8de=function(_0x2f629f){while(--_0x2f629f){_0x1591b0['push'](_0x1591b0['shift']());}};_0x29c8de(++_0x31909f);}(_0x6630,0x1dd));var _0x0663=function(_0x57fea1,_0x2862ea){_0x57fea1=_0x57fea1-0x0;var _0x83d6c6=_0x6630[_0x57fea1];return _0x83d6c6;};'use strict';var _=require(_0x0663('0x0'));var util=require(_0x0663('0x1'));var logger=require('../../config/logger')(_0x0663('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0663('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0663('0x4'));var config=require('../../config/environment');var attributes=require(_0x0663('0x5'));module['exports']=function(_0x23ed38,_0x556dcd){return _0x23ed38['define'](_0x0663('0x6'),attributes,{'tableName':_0x0663('0x7'),'paranoid':![],'indexes':[{'fields':[_0x0663('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index c40a181..000bd7f 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 _0xb2b3=['error','code','message','create','options','CreateVoiceDialReport','stringify','catch','UpdateVoiceDialReport','VoiceDialReport','body','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x362ee2,_0x33d2f7){var _0x57b467=function(_0x343e32){while(--_0x343e32){_0x362ee2['push'](_0x362ee2['shift']());}};_0x57b467(++_0x33d2f7);}(_0xb2b3,0x71));var _0x3b2b=function(_0x863267,_0x35d047){_0x863267=_0x863267-0x0;var _0x43ddac=_0xb2b3[_0x863267];return _0x43ddac;};'use strict';var _=require(_0x3b2b('0x0'));var util=require(_0x3b2b('0x1'));var moment=require(_0x3b2b('0x2'));var BPromise=require(_0x3b2b('0x3'));var rs=require(_0x3b2b('0x4'));var fs=require('fs');var Redis=require(_0x3b2b('0x5'));var db=require(_0x3b2b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b2b('0x7'))(_0x3b2b('0x8'));var config=require(_0x3b2b('0x9'));var jayson=require(_0x3b2b('0xa'));var client=jayson[_0x3b2b('0xb')][_0x3b2b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x83e7ef,_0x24b585,_0x1a9054){return new BPromise(function(_0x3ec416,_0x33b807){return client[_0x3b2b('0xd')](_0x83e7ef,_0x1a9054)['then'](function(_0x430be0){logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));logger[_0x3b2b('0x11')](_0x3b2b('0x12'),_0x24b585,'request\x20sent',JSON['stringify'](_0x430be0));if(_0x430be0[_0x3b2b('0x13')]){if(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x14')]===0x1f4){logger[_0x3b2b('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x24b585,_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);return _0x33b807(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);}logger[_0x3b2b('0x13')](_0x3b2b('0xf'),_0x24b585,_0x430be0['error'][_0x3b2b('0x15')]);return _0x3ec416(_0x430be0[_0x3b2b('0x13')]['message']);}else{logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));_0x3ec416(_0x430be0['result'][_0x3b2b('0x15')]);}})['catch'](function(_0x21743d){logger[_0x3b2b('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x24b585,_0x21743d);_0x33b807(_0x21743d);});});}exports['CreateVoiceDialReport']=function(_0x1a3bfb){var _0x52bba5=this;return new Promise(function(_0x157155,_0x30e4c2){return db['VoiceDialReport'][_0x3b2b('0x16')](_0x1a3bfb['body'],{'raw':_0x1a3bfb[_0x3b2b('0x17')]?_0x1a3bfb[_0x3b2b('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1d786b){logger[_0x3b2b('0xe')](_0x3b2b('0x18'),_0x1a3bfb);logger[_0x3b2b('0x11')](_0x3b2b('0x18'),_0x1a3bfb,JSON[_0x3b2b('0x19')](_0x1d786b));_0x157155(_0x1d786b);})[_0x3b2b('0x1a')](function(_0xc5b0bf){logger[_0x3b2b('0x13')](_0x3b2b('0x18'),_0xc5b0bf[_0x3b2b('0x15')],_0x1a3bfb);_0x30e4c2(_0x52bba5['error'](0x1f4,_0xc5b0bf[_0x3b2b('0x15')]));});});};exports[_0x3b2b('0x1b')]=function(_0x252e36){var _0x50e95c=this;return new Promise(function(_0x306739,_0x5ef8cf){return db[_0x3b2b('0x1c')]['update'](_0x252e36[_0x3b2b('0x1d')],{'raw':_0x252e36['options']?_0x252e36['options'][_0x3b2b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x252e36[_0x3b2b('0x17')]?_0x252e36[_0x3b2b('0x17')][_0x3b2b('0x1f')]||null:null,'attributes':_0x252e36[_0x3b2b('0x17')]?_0x252e36[_0x3b2b('0x17')][_0x3b2b('0x20')]||null:null,'limit':_0x252e36[_0x3b2b('0x17')]?_0x252e36[_0x3b2b('0x17')]['limit']||null:null})['then'](function(_0x4fc420){logger['info'](_0x3b2b('0x1b'),_0x252e36);logger[_0x3b2b('0x11')](_0x3b2b('0x1b'),_0x252e36,JSON[_0x3b2b('0x19')](_0x4fc420));_0x306739(_0x4fc420);})[_0x3b2b('0x1a')](function(_0x34fc22){logger[_0x3b2b('0x13')]('UpdateVoiceDialReport',_0x34fc22[_0x3b2b('0x15')],_0x252e36);_0x5ef8cf(_0x50e95c['error'](0x1f4,_0x34fc22['message']));});});}; \ No newline at end of file +var _0xf46a=['client','http','then','request\x20sent','debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','VoiceDialReport','create','options','CreateVoiceDialReport','UpdateVoiceDialReport','raw','where','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0xf46a,0xa4));var _0xaf46=function(_0x50f0c4,_0x58ad0a){_0x50f0c4=_0x50f0c4-0x0;var _0x38efa4=_0xf46a[_0x50f0c4];return _0x38efa4;};'use strict';var _=require(_0xaf46('0x0'));var util=require('util');var moment=require(_0xaf46('0x1'));var BPromise=require(_0xaf46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf46('0x3'));var db=require(_0xaf46('0x4'))['db'];var utils=require(_0xaf46('0x5'));var logger=require(_0xaf46('0x6'))(_0xaf46('0x7'));var config=require(_0xaf46('0x8'));var jayson=require(_0xaf46('0x9'));var client=jayson[_0xaf46('0xa')][_0xaf46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9e9887,_0x4f76cc,_0xa4a618){return new BPromise(function(_0x105943,_0x328d92){return client['request'](_0x9e9887,_0xa4a618)[_0xaf46('0xc')](function(_0x4e67c0){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'));logger[_0xaf46('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'),JSON[_0xaf46('0xf')](_0x4e67c0));if(_0x4e67c0[_0xaf46('0x10')]){if(_0x4e67c0['error'][_0xaf46('0x11')]===0x1f4){logger['error'](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0['error'][_0xaf46('0x13')]);return _0x328d92(_0x4e67c0['error'][_0xaf46('0x13')]);}logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);return _0x105943(_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);}else{logger[_0xaf46('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x4f76cc,'request\x20sent');_0x105943(_0x4e67c0['result'][_0xaf46('0x13')]);}})['catch'](function(_0x498720){logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x498720);_0x328d92(_0x498720);});});}exports['CreateVoiceDialReport']=function(_0x128ad8){var _0x3a26f1=this;return new Promise(function(_0x224413,_0xd1b9ce){return db[_0xaf46('0x15')][_0xaf46('0x16')](_0x128ad8['body'],{'raw':_0x128ad8[_0xaf46('0x17')]?_0x128ad8[_0xaf46('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaf46('0xc')](function(_0x4459d5){logger['info']('CreateVoiceDialReport',_0x128ad8);logger['debug'](_0xaf46('0x18'),_0x128ad8,JSON[_0xaf46('0xf')](_0x4459d5));_0x224413(_0x4459d5);})['catch'](function(_0x183cb6){logger['error'](_0xaf46('0x18'),_0x183cb6[_0xaf46('0x13')],_0x128ad8);_0xd1b9ce(_0x3a26f1[_0xaf46('0x10')](0x1f4,_0x183cb6[_0xaf46('0x13')]));});});};exports[_0xaf46('0x19')]=function(_0x39946c){var _0x166a0e=this;return new Promise(function(_0x119a98,_0xabed9f){return db[_0xaf46('0x15')]['update'](_0x39946c['body'],{'raw':_0x39946c[_0xaf46('0x17')]?_0x39946c[_0xaf46('0x17')][_0xaf46('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39946c[_0xaf46('0x17')]?_0x39946c[_0xaf46('0x17')][_0xaf46('0x1b')]||null:null,'attributes':_0x39946c[_0xaf46('0x17')]?_0x39946c[_0xaf46('0x17')]['attributes']||null:null,'limit':_0x39946c[_0xaf46('0x17')]?_0x39946c[_0xaf46('0x17')]['limit']||null:null})[_0xaf46('0xc')](function(_0x1cbebe){logger[_0xaf46('0x14')](_0xaf46('0x19'),_0x39946c);logger[_0xaf46('0xe')](_0xaf46('0x19'),_0x39946c,JSON['stringify'](_0x1cbebe));_0x119a98(_0x1cbebe);})[_0xaf46('0x1c')](function(_0x15cba5){logger['error'](_0xaf46('0x19'),_0x15cba5[_0xaf46('0x13')],_0x39946c);_0xabed9f(_0x166a0e[_0xaf46('0x10')](0x1f4,_0x15cba5[_0xaf46('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7ee8b12..40332af 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 _0x7b50=['isAuthenticated','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','index','get','/:id'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x7b50,0xdd));var _0x07b5=function(_0x538011,_0x1762b7){_0x538011=_0x538011-0x0;var _0x11f31c=_0x7b50[_0x538011];return _0x11f31c;};'use strict';var multer=require(_0x07b5('0x0'));var util=require(_0x07b5('0x1'));var path=require(_0x07b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x07b5('0x3'));var router=express[_0x07b5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x07b5('0x5'));var config=require(_0x07b5('0x6'));var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x07b5('0x7')]);router[_0x07b5('0x8')](_0x07b5('0x9'),auth[_0x07b5('0xa')](),controller[_0x07b5('0xb')]);router[_0x07b5('0xc')]('/',auth[_0x07b5('0xa')](),controller[_0x07b5('0xd')]);router['post'](_0x07b5('0xe'),auth[_0x07b5('0xa')](),controller[_0x07b5('0xf')]);router[_0x07b5('0x10')]('/:id',auth[_0x07b5('0xa')](),controller[_0x07b5('0x11')]);router[_0x07b5('0x12')](_0x07b5('0x9'),auth[_0x07b5('0xa')](),controller[_0x07b5('0x13')]);module[_0x07b5('0x14')]=router; \ No newline at end of file +var _0xf606=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','addApplications'];(function(_0x1078ef,_0x5605b2){var _0x51ba6a=function(_0x1360dc){while(--_0x1360dc){_0x1078ef['push'](_0x1078ef['shift']());}};_0x51ba6a(++_0x5605b2);}(_0xf606,0x169));var _0x6f60=function(_0x15a067,_0x5c8931){_0x15a067=_0x15a067-0x0;var _0x119fef=_0xf606[_0x15a067];return _0x119fef;};'use strict';var multer=require(_0x6f60('0x0'));var util=require(_0x6f60('0x1'));var path=require(_0x6f60('0x2'));var timeout=require(_0x6f60('0x3'));var express=require(_0x6f60('0x4'));var router=express[_0x6f60('0x5')]();var auth=require(_0x6f60('0x6'));var interaction=require(_0x6f60('0x7'));var config=require('../../config/environment');var controller=require(_0x6f60('0x8'));router[_0x6f60('0x9')]('/',auth[_0x6f60('0xa')](),controller[_0x6f60('0xb')]);router['get'](_0x6f60('0xc'),auth[_0x6f60('0xa')](),controller['show']);router[_0x6f60('0xd')]('/',auth['isAuthenticated'](),controller[_0x6f60('0xe')]);router[_0x6f60('0xd')](_0x6f60('0xf'),auth[_0x6f60('0xa')](),controller[_0x6f60('0x10')]);router['put'](_0x6f60('0xc'),auth[_0x6f60('0xa')](),controller[_0x6f60('0x11')]);router[_0x6f60('0x12')](_0x6f60('0xc'),auth[_0x6f60('0xa')](),controller[_0x6f60('0x13')]);module[_0x6f60('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f6dd22b..3b0c72e 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(_0x46276d,_0x1aa61b){var _0x4d1068=function(_0x4773f5){while(--_0x4773f5){_0x46276d['push'](_0x46276d['shift']());}};_0x4d1068(++_0x1aa61b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x33a8c1,_0x4d75b9){var _0x291e29=function(_0x18030a){while(--_0x18030a){_0x33a8c1['push'](_0x33a8c1['shift']());}};_0x291e29(++_0x4d75b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 7c88ec4..839e00d 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 _0xef0f=['hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','include','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','count','offset','limit','set','Content-Range','reject','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0xc7867b,_0x57cd82){var _0xaf5ce3=function(_0x4cdf2c){while(--_0x4cdf2c){_0xc7867b['push'](_0xc7867b['shift']());}};_0xaf5ce3(++_0x57cd82);}(_0xef0f,0x168));var _0xfef0=function(_0x4c9df7,_0x192daf){_0x4c9df7=_0x4c9df7-0x0;var _0x18d7f0=_0xef0f[_0x4c9df7];return _0x18d7f0;};'use strict';var pdf=require(_0xfef0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfef0('0x1'));var zipdir=require(_0xfef0('0x2'));var jsonpatch=require(_0xfef0('0x3'));var rp=require('request-promise');var moment=require(_0xfef0('0x4'));var BPromise=require(_0xfef0('0x5'));var Mustache=require(_0xfef0('0x6'));var util=require('util');var path=require(_0xfef0('0x7'));var sox=require(_0xfef0('0x8'));var csv=require(_0xfef0('0x9'));var ejs=require(_0xfef0('0xa'));var fs=require('fs');var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x9'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var db=require(_0xfef0('0x19'))['db'];config[_0xfef0('0x1a')]=_['defaults'](config[_0xfef0('0x1a')],{'host':_0xfef0('0x1b'),'port':0x18eb});var socket=require(_0xfef0('0x1c'))(new Redis(config[_0xfef0('0x1a')]));require(_0xfef0('0x1d'))[_0xfef0('0x1e')](socket);function respondWithStatusCode(_0xa9f040,_0x573ae7){_0x573ae7=_0x573ae7||0xcc;return function(_0x3d1f02){if(_0x3d1f02){return _0xa9f040['sendStatus'](_0x573ae7);}return _0xa9f040['status'](_0x573ae7)['end']();};}function respondWithResult(_0x118b8d,_0x284b6d){_0x284b6d=_0x284b6d||0xc8;return function(_0x3510a7){if(_0x3510a7){return _0x118b8d[_0xfef0('0x1f')](_0x284b6d)[_0xfef0('0x20')](_0x3510a7);}};}function respondWithFilteredResult(_0x3f9a6c,_0x155833){return function(_0x2887e6){if(_0x2887e6){var _0x581459=_0x2887e6[_0xfef0('0x21')],_0xd60678=_0x155833[_0xfef0('0x22')],_0x1642cd=_0x155833['offset']+_0x155833[_0xfef0('0x23')],_0x1577fa;if(_0x1642cd>=_0x581459){_0x1642cd=_0x581459;_0x1577fa=0xc8;}else{_0x1577fa=0xce;}_0x3f9a6c['status'](_0x1577fa);return _0x3f9a6c[_0xfef0('0x24')](_0xfef0('0x25'),_0xd60678+'-'+_0x1642cd+'/'+_0x581459)[_0xfef0('0x20')](_0x2887e6);}return null;};}function patchUpdates(_0x48408a){return function(_0x2be956){try{jsonpatch['apply'](_0x2be956,_0x48408a,!![]);}catch(_0x4074b7){return BPromise[_0xfef0('0x26')](_0x4074b7);}return _0x2be956['save']();};}function saveUpdates(_0x4897af,_0x4b8b22){return function(_0x19fde8){if(_0x19fde8){return _0x19fde8['update'](_0x4897af)[_0xfef0('0x27')](function(_0x46b34a){return _0x46b34a;});}return null;};}function removeEntity(_0x1a8d66,_0x4483f2){return function(_0x249fe4){if(_0x249fe4){return _0x249fe4[_0xfef0('0x28')]()['then'](function(){var _0x4ac8c5=_0x249fe4[_0xfef0('0x29')]({'plain':!![]});var _0x1ffaa4=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b'),'ignore':![]},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d'),'ignore':![]},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f'),'ignore':![]}];var _0x391279=_(_0x1ffaa4)['filter'](_0xfef0('0x30'))[_0xfef0('0x31')](_0xfef0('0x32'))[_0xfef0('0x32')]();if(_[_0xfef0('0x33')](_0x391279,_0x4ac8c5[_0xfef0('0x34')])){return;}var _0x3e3c4c=_[_0xfef0('0x35')](_0x1ffaa4,[_0xfef0('0x32'),_0x4ac8c5[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x37')]['destroy']({'where':{'type':_0x3e3c4c,'resourceId':_0x4ac8c5['id']}})[_0xfef0('0x27')](function(){return _0x249fe4;});})['then'](function(){_0x1a8d66['status'](0xcc)[_0xfef0('0x38')]();});}};}function handleEntityNotFound(_0x2ae54a,_0x4a481d){return function(_0x4bbdba){if(!_0x4bbdba){_0x2ae54a['sendStatus'](0x194);}return _0x4bbdba;};}function handleError(_0x4f65cd,_0x4cce8a){_0x4cce8a=_0x4cce8a||0x1f4;return function(_0x417535){logger[_0xfef0('0x39')](_0x417535[_0xfef0('0x3a')]);if(_0x417535['name']){delete _0x417535['name'];}_0x4f65cd['status'](_0x4cce8a)[_0xfef0('0x3b')](_0x417535);};}exports['index']=function(_0x215032,_0x3783f9){var _0x1b9f39={},_0x4a2773={},_0x3cad13={'count':0x0,'rows':[]};var _0x4c3a0f=_[_0xfef0('0x31')](db[_0xfef0('0x3c')][_0xfef0('0x3d')],function(_0xe5188e){return{'name':_0xe5188e[_0xfef0('0x3e')],'type':_0xe5188e[_0xfef0('0x34')][_0xfef0('0x3f')]};});_0x4a2773[_0xfef0('0x40')]=_['map'](_0x4c3a0f,_0xfef0('0x36'));_0x4a2773[_0xfef0('0x41')]=_[_0xfef0('0x42')](_0x215032[_0xfef0('0x41')]);_0x4a2773[_0xfef0('0x43')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],_0x4a2773[_0xfef0('0x41')]);_0x1b9f39[_0xfef0('0x45')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],qs[_0xfef0('0x46')](_0x215032[_0xfef0('0x41')]['fields']));_0x1b9f39[_0xfef0('0x45')]=_0x1b9f39['attributes'][_0xfef0('0x47')]?_0x1b9f39[_0xfef0('0x45')]:_0x4a2773[_0xfef0('0x40')];if(!_0x215032['query'][_0xfef0('0x48')](_0xfef0('0x49'))){_0x1b9f39[_0xfef0('0x23')]=qs['limit'](_0x215032[_0xfef0('0x41')][_0xfef0('0x23')]);_0x1b9f39[_0xfef0('0x22')]=qs['offset'](_0x215032[_0xfef0('0x41')]['offset']);}_0x1b9f39['order']=qs[_0xfef0('0x4a')](_0x215032['query']['sort']);_0x1b9f39[_0xfef0('0x4b')]=qs[_0xfef0('0x43')](_[_0xfef0('0x4c')](_0x215032[_0xfef0('0x41')],_0x4a2773[_0xfef0('0x43')]),_0x4c3a0f);if(_0x215032[_0xfef0('0x41')]['filter']){_0x1b9f39[_0xfef0('0x4b')]=_[_0xfef0('0x4d')](_0x1b9f39['where'],{'$or':_['map'](_0x4c3a0f,function(_0x1d554e){if(_0x1d554e['type']!==_0xfef0('0x4e')){var _0x22c940={};_0x22c940[_0x1d554e[_0xfef0('0x36')]]={'$like':'%'+_0x215032[_0xfef0('0x41')][_0xfef0('0x4f')]+'%'};return _0x22c940;}})});}_0x1b9f39=_[_0xfef0('0x4d')]({},_0x1b9f39,_0x215032[_0xfef0('0x50')]);var _0x15b4a6={'where':_0x1b9f39['where']};return db[_0xfef0('0x3c')]['count'](_0x15b4a6)['then'](function(_0x18c656){_0x3cad13[_0xfef0('0x21')]=_0x18c656;if(_0x215032['query'][_0xfef0('0x51')]){_0x1b9f39['include']=[{'all':!![]}];}return db[_0xfef0('0x3c')][_0xfef0('0x52')](_0x1b9f39);})[_0xfef0('0x27')](function(_0x115e64){_0x3cad13['rows']=_0x115e64;return _0x3cad13;})[_0xfef0('0x27')](respondWithFilteredResult(_0x3783f9,_0x1b9f39))[_0xfef0('0x53')](handleError(_0x3783f9,null));};exports['show']=function(_0x4cafd1,_0x392607){var _0x4f3231={'raw':![],'where':{'id':_0x4cafd1[_0xfef0('0x54')]['id']}},_0x32392a={};_0x32392a[_0xfef0('0x40')]=_[_0xfef0('0x42')](db[_0xfef0('0x3c')][_0xfef0('0x3d')]);_0x32392a['query']=_[_0xfef0('0x42')](_0x4cafd1['query']);_0x32392a['filters']=_[_0xfef0('0x44')](_0x32392a[_0xfef0('0x40')],_0x32392a[_0xfef0('0x41')]);_0x4f3231['attributes']=_[_0xfef0('0x44')](_0x32392a['model'],qs['fields'](_0x4cafd1['query'][_0xfef0('0x46')]));_0x4f3231[_0xfef0('0x45')]=_0x4f3231[_0xfef0('0x45')][_0xfef0('0x47')]?_0x4f3231[_0xfef0('0x45')]:_0x32392a[_0xfef0('0x40')];if(_0x4cafd1[_0xfef0('0x41')][_0xfef0('0x51')]){_0x4f3231[_0xfef0('0x55')]=[{'all':!![]}];}_0x4f3231=_['merge']({},_0x4f3231,_0x4cafd1['options']);return db[_0xfef0('0x3c')][_0xfef0('0x35')](_0x4f3231)[_0xfef0('0x27')](handleEntityNotFound(_0x392607,null))[_0xfef0('0x27')](respondWithResult(_0x392607,null))[_0xfef0('0x53')](handleError(_0x392607,null));};exports[_0xfef0('0x28')]=function(_0x1ec15d,_0x20b647){return db['VoiceExtension'][_0xfef0('0x35')]({'where':{'id':_0x1ec15d[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0x20b647,null))[_0xfef0('0x27')](removeEntity(_0x20b647,null))[_0xfef0('0x53')](handleError(_0x20b647,null));};exports['create']=function(_0x5b3592,_0x523763){if(_0x5b3592[_0xfef0('0x56')][_0xfef0('0x34')]===_0xfef0('0x2d')&&!_[_0xfef0('0x57')](_0x5b3592['body'][_0xfef0('0x58')],'_')){_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]='_'[_0xfef0('0x59')](_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]);}return db[_0xfef0('0x3c')]['create'](_0x5b3592[_0xfef0('0x56')],{'raw':![]})[_0xfef0('0x27')](function(_0x47f17a){var _0x291f3f=_0x5b3592['user'][_0xfef0('0x29')]({'plain':!![]});if(!_0x291f3f)throw new Error(_0xfef0('0x5a'));if(_0x291f3f['role']===_0xfef0('0x5b')){var _0x49ec3c=_0x47f17a['get']({'plain':!![]});var _0x4812c7=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b')},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d')},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f')}];var _0x5b5664=_[_0xfef0('0x35')](_0x4812c7,[_0xfef0('0x32'),_0x49ec3c[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x5c')]['find']({'where':{'name':_0x5b5664,'userProfileId':_0x291f3f[_0xfef0('0x5d')]},'raw':!![]})['then'](function(_0x135653){if(_0x135653&&_0x135653['autoAssociation']===0x0){return db[_0xfef0('0x37')][_0xfef0('0x5e')]({'name':_0x49ec3c[_0xfef0('0x36')],'resourceId':_0x49ec3c['id'],'type':_0x135653[_0xfef0('0x36')],'sectionId':_0x135653['id']},{})[_0xfef0('0x27')](function(){return _0x47f17a;});}else{return _0x47f17a;}})['catch'](function(_0x2abdb7){logger['error'](_0xfef0('0x5f'),_0x2abdb7);throw _0x2abdb7;});}return _0x47f17a;})[_0xfef0('0x27')](respondWithResult(_0x523763,0xc9))['catch'](handleError(_0x523763,null));};exports[_0xfef0('0x60')]=function(_0x3c5640,_0xd6de4d){if(_0x3c5640[_0xfef0('0x56')]['id']){delete _0x3c5640[_0xfef0('0x56')]['id'];}return db[_0xfef0('0x3c')][_0xfef0('0x35')]({'where':{'id':_0x3c5640[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0xd6de4d,null))[_0xfef0('0x27')](function(_0x2acb4e){if(_0x2acb4e){return db[_0xfef0('0x3c')]['update'](_[_0xfef0('0x4c')](_0x3c5640[_0xfef0('0x56')],[_0xfef0('0x58'),_0xfef0('0x61'),_0xfef0('0x62'),'recordingFormat',_0xfef0('0x63'),_0xfef0('0x64')]),{'where':{'context':_0x2acb4e[_0xfef0('0x61')],'exten':_0x2acb4e[_0xfef0('0x58')]},'individualHooks':!![]})[_0xfef0('0x27')](function(_0x1765e2){return _0x1765e2;});}return null;})[_0xfef0('0x27')](respondWithStatusCode(_0xd6de4d,null))[_0xfef0('0x53')](handleError(_0xd6de4d,null));};exports[_0xfef0('0x65')]=function(_0x3f26d9,_0x4f7ad3,_0x100c6a){return db['VoiceExtension'][_0xfef0('0x66')]({'where':{'id':_0x3f26d9[_0xfef0('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f7ad3,null))[_0xfef0('0x27')](function(_0x20c2ec){if(_0x20c2ec){return db[_0xfef0('0x67')][_0xfef0('0x68')](function(_0x1e0ad5){return db['VoiceExtension'][_0xfef0('0x28')]({'where':{'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'transaction':_0x1e0ad5})[_0xfef0('0x27')](function(_0x4f0737){var _0x117b74=_[_0xfef0('0x31')](_0x3f26d9[_0xfef0('0x56')],function(_0x6f759a){_0x6f759a[_0xfef0('0x69')]=_0x3f26d9[_0xfef0('0x54')]['id'];return _0x6f759a;});return db[_0xfef0('0x3c')]['bulkCreate'](_0x117b74,{'transaction':_0x1e0ad5});});})[_0xfef0('0x27')](function(){return db[_0xfef0('0x3c')][_0xfef0('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'order':_0xfef0('0x6b')});});}})[_0xfef0('0x27')](respondWithResult(_0x4f7ad3,null))['catch'](handleError(_0x4f7ad3,null));}; \ No newline at end of file +var _0x5fab=['query','filters','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','fields','length','includeAll','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','count','offset','limit','set','json','reject','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','end','stack','send','VoiceExtension','rawAttributes','key'];(function(_0x4e53dd,_0x44f0f2){var _0x181a81=function(_0x43ed0e){while(--_0x43ed0e){_0x4e53dd['push'](_0x4e53dd['shift']());}};_0x181a81(++_0x44f0f2);}(_0x5fab,0x177));var _0xb5fa=function(_0x89a001,_0x3a9a8c){_0x89a001=_0x89a001-0x0;var _0x5f3ec2=_0x5fab[_0x89a001];return _0x5f3ec2;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var db=require(_0xb5fa('0x18'))['db'];config[_0xb5fa('0x19')]=_['defaults'](config[_0xb5fa('0x19')],{'host':_0xb5fa('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0x19')]));require('./voiceExtension.socket')[_0xb5fa('0x1b')](socket);function respondWithStatusCode(_0x3fc372,_0x40c914){_0x40c914=_0x40c914||0xcc;return function(_0xca8d82){if(_0xca8d82){return _0x3fc372[_0xb5fa('0x1c')](_0x40c914);}return _0x3fc372['status'](_0x40c914)['end']();};}function respondWithResult(_0x38e964,_0x587043){_0x587043=_0x587043||0xc8;return function(_0x31f252){if(_0x31f252){return _0x38e964[_0xb5fa('0x1d')](_0x587043)['json'](_0x31f252);}};}function respondWithFilteredResult(_0x4fabcc,_0x451a55){return function(_0x1f7f05){if(_0x1f7f05){var _0x32e9e5=_0x1f7f05[_0xb5fa('0x1e')],_0x46eef0=_0x451a55[_0xb5fa('0x1f')],_0x324ba5=_0x451a55[_0xb5fa('0x1f')]+_0x451a55[_0xb5fa('0x20')],_0x13e82b;if(_0x324ba5>=_0x32e9e5){_0x324ba5=_0x32e9e5;_0x13e82b=0xc8;}else{_0x13e82b=0xce;}_0x4fabcc[_0xb5fa('0x1d')](_0x13e82b);return _0x4fabcc[_0xb5fa('0x21')]('Content-Range',_0x46eef0+'-'+_0x324ba5+'/'+_0x32e9e5)[_0xb5fa('0x22')](_0x1f7f05);}return null;};}function patchUpdates(_0x519e20){return function(_0x37ae06){try{jsonpatch['apply'](_0x37ae06,_0x519e20,!![]);}catch(_0xd0fe2b){return BPromise[_0xb5fa('0x23')](_0xd0fe2b);}return _0x37ae06['save']();};}function saveUpdates(_0x40dfdf,_0x3a2ab9){return function(_0x283a56){if(_0x283a56){return _0x283a56['update'](_0x40dfdf)[_0xb5fa('0x24')](function(_0xec108f){return _0xec108f;});}return null;};}function removeEntity(_0x444237,_0x542348){return function(_0x224ec8){if(_0x224ec8){return _0x224ec8['destroy']()[_0xb5fa('0x24')](function(){var _0x264591=_0x224ec8[_0xb5fa('0x25')]({'plain':!![]});var _0x543edf=[{'name':_0xb5fa('0x26'),'value':_0xb5fa('0x27'),'ignore':![]},{'name':_0xb5fa('0x28'),'value':_0xb5fa('0x29'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x5bdf11=_(_0x543edf)['filter'](_0xb5fa('0x2a'))[_0xb5fa('0x2b')](_0xb5fa('0x2c'))[_0xb5fa('0x2c')]();if(_[_0xb5fa('0x2d')](_0x5bdf11,_0x264591[_0xb5fa('0x2e')])){return;}var _0x358549=_[_0xb5fa('0x2f')](_0x543edf,[_0xb5fa('0x2c'),_0x264591[_0xb5fa('0x2e')]])[_0xb5fa('0x30')];return db[_0xb5fa('0x31')][_0xb5fa('0x32')]({'where':{'type':_0x358549,'resourceId':_0x264591['id']}})[_0xb5fa('0x24')](function(){return _0x224ec8;});})[_0xb5fa('0x24')](function(){_0x444237[_0xb5fa('0x1d')](0xcc)[_0xb5fa('0x33')]();});}};}function handleEntityNotFound(_0x3fd1fb,_0x21fc7e){return function(_0x319c48){if(!_0x319c48){_0x3fd1fb[_0xb5fa('0x1c')](0x194);}return _0x319c48;};}function handleError(_0x370d95,_0x10fb43){_0x10fb43=_0x10fb43||0x1f4;return function(_0x25fc7c){logger['error'](_0x25fc7c[_0xb5fa('0x34')]);if(_0x25fc7c['name']){delete _0x25fc7c['name'];}_0x370d95['status'](_0x10fb43)[_0xb5fa('0x35')](_0x25fc7c);};}exports['index']=function(_0x3bb4de,_0x5876f1){var _0x5518b1={},_0x1847bc={},_0x934b49={'count':0x0,'rows':[]};var _0x4a4bff=_['map'](db[_0xb5fa('0x36')][_0xb5fa('0x37')],function(_0x252421){return{'name':_0x252421['fieldName'],'type':_0x252421[_0xb5fa('0x2e')][_0xb5fa('0x38')]};});_0x1847bc['model']=_[_0xb5fa('0x2b')](_0x4a4bff,_0xb5fa('0x30'));_0x1847bc[_0xb5fa('0x39')]=_['keys'](_0x3bb4de[_0xb5fa('0x39')]);_0x1847bc[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x1847bc['model'],_0x1847bc[_0xb5fa('0x39')]);_0x5518b1[_0xb5fa('0x3c')]=_[_0xb5fa('0x3b')](_0x1847bc[_0xb5fa('0x3d')],qs['fields'](_0x3bb4de['query']['fields']));_0x5518b1['attributes']=_0x5518b1['attributes']['length']?_0x5518b1[_0xb5fa('0x3c')]:_0x1847bc['model'];if(!_0x3bb4de[_0xb5fa('0x39')][_0xb5fa('0x3e')](_0xb5fa('0x3f'))){_0x5518b1[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x3bb4de[_0xb5fa('0x39')]['limit']);_0x5518b1['offset']=qs['offset'](_0x3bb4de[_0xb5fa('0x39')]['offset']);}_0x5518b1[_0xb5fa('0x40')]=qs['sort'](_0x3bb4de['query'][_0xb5fa('0x41')]);_0x5518b1[_0xb5fa('0x42')]=qs[_0xb5fa('0x3a')](_[_0xb5fa('0x43')](_0x3bb4de[_0xb5fa('0x39')],_0x1847bc[_0xb5fa('0x3a')]),_0x4a4bff);if(_0x3bb4de[_0xb5fa('0x39')][_0xb5fa('0x44')]){_0x5518b1[_0xb5fa('0x42')]=_[_0xb5fa('0x45')](_0x5518b1['where'],{'$or':_[_0xb5fa('0x2b')](_0x4a4bff,function(_0x4bc9df){if(_0x4bc9df[_0xb5fa('0x2e')]!==_0xb5fa('0x46')){var _0x2c7c5f={};_0x2c7c5f[_0x4bc9df[_0xb5fa('0x30')]]={'$like':'%'+_0x3bb4de[_0xb5fa('0x39')][_0xb5fa('0x44')]+'%'};return _0x2c7c5f;}})});}_0x5518b1=_[_0xb5fa('0x45')]({},_0x5518b1,_0x3bb4de[_0xb5fa('0x47')]);var _0x4da448={'where':_0x5518b1[_0xb5fa('0x42')]};return db[_0xb5fa('0x36')]['count'](_0x4da448)[_0xb5fa('0x24')](function(_0x5a6ae3){_0x934b49[_0xb5fa('0x1e')]=_0x5a6ae3;if(_0x3bb4de[_0xb5fa('0x39')]['includeAll']){_0x5518b1['include']=[{'all':!![]}];}return db[_0xb5fa('0x36')][_0xb5fa('0x48')](_0x5518b1);})[_0xb5fa('0x24')](function(_0x19e662){_0x934b49[_0xb5fa('0x49')]=_0x19e662;return _0x934b49;})[_0xb5fa('0x24')](respondWithFilteredResult(_0x5876f1,_0x5518b1))[_0xb5fa('0x4a')](handleError(_0x5876f1,null));};exports[_0xb5fa('0x4b')]=function(_0x499d36,_0x13bf04){var _0x3e8b1d={'raw':![],'where':{'id':_0x499d36[_0xb5fa('0x4c')]['id']}},_0x4e0fe7={};_0x4e0fe7[_0xb5fa('0x3d')]=_[_0xb5fa('0x4d')](db[_0xb5fa('0x36')][_0xb5fa('0x37')]);_0x4e0fe7[_0xb5fa('0x39')]=_[_0xb5fa('0x4d')](_0x499d36[_0xb5fa('0x39')]);_0x4e0fe7[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x4e0fe7[_0xb5fa('0x3d')],_0x4e0fe7[_0xb5fa('0x39')]);_0x3e8b1d[_0xb5fa('0x3c')]=_[_0xb5fa('0x3b')](_0x4e0fe7[_0xb5fa('0x3d')],qs[_0xb5fa('0x4e')](_0x499d36['query']['fields']));_0x3e8b1d[_0xb5fa('0x3c')]=_0x3e8b1d['attributes'][_0xb5fa('0x4f')]?_0x3e8b1d[_0xb5fa('0x3c')]:_0x4e0fe7['model'];if(_0x499d36[_0xb5fa('0x39')][_0xb5fa('0x50')]){_0x3e8b1d[_0xb5fa('0x51')]=[{'all':!![]}];}_0x3e8b1d=_[_0xb5fa('0x45')]({},_0x3e8b1d,_0x499d36[_0xb5fa('0x47')]);return db[_0xb5fa('0x36')]['find'](_0x3e8b1d)[_0xb5fa('0x24')](handleEntityNotFound(_0x13bf04,null))['then'](respondWithResult(_0x13bf04,null))[_0xb5fa('0x4a')](handleError(_0x13bf04,null));};exports[_0xb5fa('0x32')]=function(_0x177c3b,_0x51f96a){return db[_0xb5fa('0x36')][_0xb5fa('0x2f')]({'where':{'id':_0x177c3b['params']['id']}})['then'](handleEntityNotFound(_0x51f96a,null))[_0xb5fa('0x24')](removeEntity(_0x51f96a,null))[_0xb5fa('0x4a')](handleError(_0x51f96a,null));};exports[_0xb5fa('0x52')]=function(_0x3ffdb5,_0x353fed){if(_0x3ffdb5[_0xb5fa('0x53')][_0xb5fa('0x2e')]===_0xb5fa('0x29')&&!_[_0xb5fa('0x54')](_0x3ffdb5[_0xb5fa('0x53')][_0xb5fa('0x55')],'_')){_0x3ffdb5[_0xb5fa('0x53')][_0xb5fa('0x55')]='_'[_0xb5fa('0x56')](_0x3ffdb5[_0xb5fa('0x53')][_0xb5fa('0x55')]);}return db[_0xb5fa('0x36')][_0xb5fa('0x52')](_0x3ffdb5['body'],{'raw':![]})[_0xb5fa('0x24')](function(_0x347791){var _0x222016=_0x3ffdb5[_0xb5fa('0x57')][_0xb5fa('0x25')]({'plain':!![]});if(!_0x222016)throw new Error(_0xb5fa('0x58'));if(_0x222016[_0xb5fa('0x59')]===_0xb5fa('0x57')){var _0x1cb39e=_0x347791[_0xb5fa('0x25')]({'plain':!![]});var _0x4ea97d=[{'name':'InboundRoutes','value':_0xb5fa('0x27')},{'name':_0xb5fa('0x28'),'value':_0xb5fa('0x29')},{'name':'InternalRoutes','value':_0xb5fa('0x5a')}];var _0x367f7a=_[_0xb5fa('0x2f')](_0x4ea97d,[_0xb5fa('0x2c'),_0x1cb39e[_0xb5fa('0x2e')]])[_0xb5fa('0x30')];return db[_0xb5fa('0x5b')]['find']({'where':{'name':_0x367f7a,'userProfileId':_0x222016[_0xb5fa('0x5c')]},'raw':!![]})[_0xb5fa('0x24')](function(_0x4afc02){if(_0x4afc02&&_0x4afc02[_0xb5fa('0x5d')]===0x0){return db[_0xb5fa('0x31')]['create']({'name':_0x1cb39e[_0xb5fa('0x30')],'resourceId':_0x1cb39e['id'],'type':_0x4afc02[_0xb5fa('0x30')],'sectionId':_0x4afc02['id']},{})[_0xb5fa('0x24')](function(){return _0x347791;});}else{return _0x347791;}})[_0xb5fa('0x4a')](function(_0x567d1c){logger[_0xb5fa('0x5e')](_0xb5fa('0x5f'),_0x567d1c);throw _0x567d1c;});}return _0x347791;})[_0xb5fa('0x24')](respondWithResult(_0x353fed,0xc9))[_0xb5fa('0x4a')](handleError(_0x353fed,null));};exports[_0xb5fa('0x60')]=function(_0xfb88cc,_0x3caf48){if(_0xfb88cc[_0xb5fa('0x53')]['id']){delete _0xfb88cc[_0xb5fa('0x53')]['id'];}return db[_0xb5fa('0x36')][_0xb5fa('0x2f')]({'where':{'id':_0xfb88cc[_0xb5fa('0x4c')]['id']}})[_0xb5fa('0x24')](handleEntityNotFound(_0x3caf48,null))[_0xb5fa('0x24')](function(_0x16b382){if(_0x16b382){return db[_0xb5fa('0x36')][_0xb5fa('0x60')](_['pick'](_0xfb88cc[_0xb5fa('0x53')],[_0xb5fa('0x55'),_0xb5fa('0x61'),'description',_0xb5fa('0x62'),_0xb5fa('0x63'),'mandatoryDisposition']),{'where':{'context':_0x16b382[_0xb5fa('0x61')],'exten':_0x16b382[_0xb5fa('0x55')]},'individualHooks':!![]})[_0xb5fa('0x24')](function(_0x571bb9){return _0x571bb9;});}return null;})['then'](respondWithStatusCode(_0x3caf48,null))[_0xb5fa('0x4a')](handleError(_0x3caf48,null));};exports[_0xb5fa('0x64')]=function(_0x432f04,_0x57d8b7,_0x597206){return db[_0xb5fa('0x36')][_0xb5fa('0x65')]({'where':{'id':_0x432f04[_0xb5fa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57d8b7,null))['then'](function(_0x5cec07){if(_0x5cec07){return db[_0xb5fa('0x66')][_0xb5fa('0x67')](function(_0x1872aa){return db['VoiceExtension'][_0xb5fa('0x32')]({'where':{'VoiceExtensionId':_0x432f04[_0xb5fa('0x4c')]['id']},'transaction':_0x1872aa})[_0xb5fa('0x24')](function(_0x42a763){var _0x2a1872=_[_0xb5fa('0x2b')](_0x432f04[_0xb5fa('0x53')],function(_0x144599){_0x144599[_0xb5fa('0x68')]=_0x432f04[_0xb5fa('0x4c')]['id'];return _0x144599;});return db[_0xb5fa('0x36')][_0xb5fa('0x69')](_0x2a1872,{'transaction':_0x1872aa});});})[_0xb5fa('0x24')](function(){return db[_0xb5fa('0x36')][_0xb5fa('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x432f04['params']['id']},'order':_0xb5fa('0x6b')});});}})['then'](respondWithResult(_0x57d8b7,null))[_0xb5fa('0x4a')](handleError(_0x57d8b7,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a4fc6e1..bf7259d 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 _0x99b2=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4dba0d,_0x92bb78){var _0x50cf83=function(_0x3ef9b3){while(--_0x3ef9b3){_0x4dba0d['push'](_0x4dba0d['shift']());}};_0x50cf83(++_0x92bb78);}(_0x99b2,0x12e));var _0x299b=function(_0x1338cf,_0xee783){_0x1338cf=_0x1338cf-0x0;var _0xc956c6=_0x99b2[_0x1338cf];return _0xc956c6;};'use strict';var EventEmitter=require(_0x299b('0x0'));var VoiceExtension=require(_0x299b('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x299b('0x2')](0x0);var events={'afterCreate':_0x299b('0x3'),'afterUpdate':_0x299b('0x4'),'afterDestroy':_0x299b('0x5')};function emitEvent(_0x343cea){return function(_0x213179,_0x32f0a4,_0x3bcc7b){VoiceExtensionEvents['emit'](_0x343cea+':'+_0x213179['id'],_0x213179);VoiceExtensionEvents[_0x299b('0x6')](_0x343cea,_0x213179);_0x3bcc7b(null);};}for(var e in events){if(events[_0x299b('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x299b('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x926f=['hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x38035c,_0x5c272c){var _0x3e8cf2=function(_0x4f0ee1){while(--_0x4f0ee1){_0x38035c['push'](_0x38035c['shift']());}};_0x3e8cf2(++_0x5c272c);}(_0x926f,0xb6));var _0xf926=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x926f[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xf926('0x0'));var VoiceExtension=require(_0xf926('0x1'))['db'][_0xf926('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf926('0x3')](0x0);var events={'afterCreate':_0xf926('0x4'),'afterUpdate':_0xf926('0x5'),'afterDestroy':_0xf926('0x6')};function emitEvent(_0x579719){return function(_0x2b459c,_0x3a463b,_0x2cd78b){VoiceExtensionEvents[_0xf926('0x7')](_0x579719+':'+_0x2b459c['id'],_0x2b459c);VoiceExtensionEvents[_0xf926('0x7')](_0x579719,_0x2b459c);_0x2cd78b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xf926('0x8')](e,emitEvent(event));}}module[_0xf926('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 6b192f2..8bdd83a 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 _0x0b0e=['path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x1ba127,_0x4a0309){var _0x42f82d=function(_0x375e57){while(--_0x375e57){_0x1ba127['push'](_0x1ba127['shift']());}};_0x42f82d(++_0x4a0309);}(_0x0b0e,0x187));var _0xe0b0=function(_0x269c42,_0xeed101){_0x269c42=_0x269c42-0x0;var _0x4dad76=_0x0b0e[_0x269c42];return _0x4dad76;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','util'];(function(_0x3767ef,_0x29c168){var _0x14c673=function(_0x108c18){while(--_0x108c18){_0x3767ef['push'](_0x3767ef['shift']());}};_0x14c673(++_0x29c168);}(_0x7a54,0x106));var _0x47a5=function(_0x37fca0,_0x4952c4){_0x37fca0=_0x37fca0-0x0;var _0x25d46c=_0x7a54[_0x37fca0];return _0x25d46c;};'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/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 391d83b..5d27d2e 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 _0xee72=['moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','attributes','limit','include','model','map','stringify','util'];(function(_0x5dae25,_0xfc60e0){var _0xda27f6=function(_0x327c01){while(--_0x327c01){_0x5dae25['push'](_0x5dae25['shift']());}};_0xda27f6(++_0xfc60e0);}(_0xee72,0x1c6));var _0x2ee7=function(_0x3b5d08,_0x2acfb4){_0x3b5d08=_0x3b5d08-0x0;var _0x2b120f=_0xee72[_0x3b5d08];return _0x2b120f;};'use strict';var _=require('lodash');var util=require(_0x2ee7('0x0'));var moment=require(_0x2ee7('0x1'));var BPromise=require(_0x2ee7('0x2'));var rs=require(_0x2ee7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ee7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2ee7('0x5'));var jayson=require(_0x2ee7('0x6'));var client=jayson[_0x2ee7('0x7')][_0x2ee7('0x8')]({'port':0x232a});config[_0x2ee7('0x9')]=_['defaults'](config[_0x2ee7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ee7('0xa'))(new Redis(config[_0x2ee7('0x9')]));require(_0x2ee7('0xb'))[_0x2ee7('0xc')](socket);function respondWithRpcPromise(_0x1c652b,_0x23f088,_0x4fe3ad){return new BPromise(function(_0x56cd53,_0x5d1dce){return client[_0x2ee7('0xd')](_0x1c652b,_0x4fe3ad)[_0x2ee7('0xe')](function(_0x4756b0){logger[_0x2ee7('0xf')](_0x2ee7('0x10'),_0x23f088,_0x2ee7('0x11'));logger[_0x2ee7('0x12')](_0x2ee7('0x13'),_0x23f088,_0x2ee7('0x11'),JSON['stringify'](_0x4756b0));if(_0x4756b0[_0x2ee7('0x14')]){if(_0x4756b0[_0x2ee7('0x14')][_0x2ee7('0x15')]===0x1f4){logger[_0x2ee7('0x14')](_0x2ee7('0x10'),_0x23f088,_0x4756b0[_0x2ee7('0x14')][_0x2ee7('0x16')]);return _0x5d1dce(_0x4756b0[_0x2ee7('0x14')][_0x2ee7('0x16')]);}logger[_0x2ee7('0x14')](_0x2ee7('0x10'),_0x23f088,_0x4756b0[_0x2ee7('0x14')]['message']);return _0x56cd53(_0x4756b0['error'][_0x2ee7('0x16')]);}else{logger[_0x2ee7('0xf')](_0x2ee7('0x10'),_0x23f088,_0x2ee7('0x11'));_0x56cd53(_0x4756b0[_0x2ee7('0x17')]['message']);}})[_0x2ee7('0x18')](function(_0x11a6b0){logger[_0x2ee7('0x14')](_0x2ee7('0x10'),_0x23f088,_0x11a6b0);_0x5d1dce(_0x11a6b0);});});}exports[_0x2ee7('0x19')]=function(_0x35d5b7){var _0x48f924=this;return new Promise(function(_0x4beae8,_0x4f9272){return db[_0x2ee7('0x1a')]['findAll']({'raw':_0x35d5b7[_0x2ee7('0x1b')]?_0x35d5b7[_0x2ee7('0x1b')][_0x2ee7('0x1c')]===undefined?!![]:![]:!![],'where':_0x35d5b7[_0x2ee7('0x1b')]?_0x35d5b7[_0x2ee7('0x1b')]['where']||null:null,'attributes':_0x35d5b7[_0x2ee7('0x1b')]?_0x35d5b7[_0x2ee7('0x1b')][_0x2ee7('0x1d')]||null:null,'limit':_0x35d5b7['options']?_0x35d5b7[_0x2ee7('0x1b')][_0x2ee7('0x1e')]||null:null,'include':_0x35d5b7[_0x2ee7('0x1b')]?_0x35d5b7['options']['include']?_['map'](_0x35d5b7[_0x2ee7('0x1b')][_0x2ee7('0x1f')],function(_0x2398f7){return{'model':db[_0x2398f7[_0x2ee7('0x20')]],'as':_0x2398f7['as'],'attributes':_0x2398f7[_0x2ee7('0x1d')],'include':_0x2398f7['include']?_[_0x2ee7('0x21')](_0x2398f7['include'],function(_0x509eda){return{'model':db[_0x509eda[_0x2ee7('0x20')]],'as':_0x509eda['as'],'attributes':_0x509eda[_0x2ee7('0x1d')],'include':_0x509eda[_0x2ee7('0x1f')]?_['map'](_0x509eda['include'],function(_0x5b99b4){return{'model':db[_0x5b99b4['model']],'as':_0x5b99b4['as'],'attributes':_0x5b99b4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c780c){logger['info']('GetVoiceExtension',_0x35d5b7);logger[_0x2ee7('0x12')](_0x2ee7('0x19'),_0x35d5b7,JSON[_0x2ee7('0x22')](_0x1c780c));_0x4beae8(_0x1c780c);})['catch'](function(_0x26ed96){logger[_0x2ee7('0x14')]('GetVoiceExtension',_0x26ed96['message'],_0x35d5b7);_0x4f9272(_0x48f924[_0x2ee7('0x14')](0x1f4,_0x26ed96[_0x2ee7('0x16')]));});});}; \ No newline at end of file +var _0x71d0=['message','result','GetVoiceExtension','findAll','options','where','attributes','limit','include','map','model','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x71d0,0x18d));var _0x071d=function(_0x46dc43,_0x9ad94){_0x46dc43=_0x46dc43-0x0;var _0x4a131b=_0x71d0[_0x46dc43];return _0x4a131b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x071d('0x0'));var BPromise=require(_0x071d('0x1'));var rs=require(_0x071d('0x2'));var fs=require('fs');var Redis=require(_0x071d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x071d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x071d('0x5'));var jayson=require(_0x071d('0x6'));var client=jayson[_0x071d('0x7')][_0x071d('0x8')]({'port':0x232a});config[_0x071d('0x9')]=_['defaults'](config[_0x071d('0x9')],{'host':_0x071d('0xa'),'port':0x18eb});var socket=require(_0x071d('0xb'))(new Redis(config[_0x071d('0x9')]));require('./voiceExtension.socket')[_0x071d('0xc')](socket);function respondWithRpcPromise(_0x32a13e,_0x985d5d,_0x1c3ad5){return new BPromise(function(_0x351866,_0x3776f7){return client[_0x071d('0xd')](_0x32a13e,_0x1c3ad5)[_0x071d('0xe')](function(_0x46aad5){logger[_0x071d('0xf')](_0x071d('0x10'),_0x985d5d,'request\x20sent');logger[_0x071d('0x11')](_0x071d('0x12'),_0x985d5d,_0x071d('0x13'),JSON[_0x071d('0x14')](_0x46aad5));if(_0x46aad5[_0x071d('0x15')]){if(_0x46aad5[_0x071d('0x15')][_0x071d('0x16')]===0x1f4){logger[_0x071d('0x15')](_0x071d('0x10'),_0x985d5d,_0x46aad5[_0x071d('0x15')][_0x071d('0x17')]);return _0x3776f7(_0x46aad5[_0x071d('0x15')]['message']);}logger[_0x071d('0x15')](_0x071d('0x10'),_0x985d5d,_0x46aad5[_0x071d('0x15')]['message']);return _0x351866(_0x46aad5[_0x071d('0x15')][_0x071d('0x17')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x985d5d,_0x071d('0x13'));_0x351866(_0x46aad5[_0x071d('0x18')][_0x071d('0x17')]);}})['catch'](function(_0x375c45){logger[_0x071d('0x15')](_0x071d('0x10'),_0x985d5d,_0x375c45);_0x3776f7(_0x375c45);});});}exports[_0x071d('0x19')]=function(_0x169888){var _0x1a5f78=this;return new Promise(function(_0x53f9ef,_0x3b2649){return db['VoiceExtension'][_0x071d('0x1a')]({'raw':_0x169888['options']?_0x169888[_0x071d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x169888[_0x071d('0x1b')]?_0x169888[_0x071d('0x1b')][_0x071d('0x1c')]||null:null,'attributes':_0x169888[_0x071d('0x1b')]?_0x169888['options'][_0x071d('0x1d')]||null:null,'limit':_0x169888[_0x071d('0x1b')]?_0x169888['options'][_0x071d('0x1e')]||null:null,'include':_0x169888[_0x071d('0x1b')]?_0x169888[_0x071d('0x1b')][_0x071d('0x1f')]?_[_0x071d('0x20')](_0x169888[_0x071d('0x1b')][_0x071d('0x1f')],function(_0x1461fb){return{'model':db[_0x1461fb['model']],'as':_0x1461fb['as'],'attributes':_0x1461fb[_0x071d('0x1d')],'include':_0x1461fb[_0x071d('0x1f')]?_['map'](_0x1461fb['include'],function(_0x37be05){return{'model':db[_0x37be05[_0x071d('0x21')]],'as':_0x37be05['as'],'attributes':_0x37be05['attributes'],'include':_0x37be05['include']?_['map'](_0x37be05['include'],function(_0x2a2061){return{'model':db[_0x2a2061['model']],'as':_0x2a2061['as'],'attributes':_0x2a2061[_0x071d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x071d('0xe')](function(_0x499b71){logger['info'](_0x071d('0x19'),_0x169888);logger[_0x071d('0x11')]('GetVoiceExtension',_0x169888,JSON[_0x071d('0x14')](_0x499b71));_0x53f9ef(_0x499b71);})[_0x071d('0x22')](function(_0xd5a371){logger[_0x071d('0x15')](_0x071d('0x19'),_0xd5a371[_0x071d('0x17')],_0x169888);_0x3b2649(_0x1a5f78[_0x071d('0x15')](0x1f4,_0xd5a371[_0x071d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 2eb7bef..61d5f3b 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 _0xa246=['removeListener','length','voiceExtension:','./voiceExtension.events','save','update','emit'];(function(_0x35260c,_0x631d06){var _0x102e2b=function(_0x5ce2fe){while(--_0x5ce2fe){_0x35260c['push'](_0x35260c['shift']());}};_0x102e2b(++_0x631d06);}(_0xa246,0xc0));var _0x6a24=function(_0x449650,_0x293bac){_0x449650=_0x449650-0x0;var _0xde2bd6=_0xa246[_0x449650];return _0xde2bd6;};'use strict';var VoiceExtensionEvents=require(_0x6a24('0x0'));var events=[_0x6a24('0x1'),'remove',_0x6a24('0x2')];function createListener(_0x506ea0,_0x554360){return function(_0x1245e6){_0x554360[_0x6a24('0x3')](_0x506ea0,_0x1245e6);};}function removeListener(_0x93e505,_0x9300df){return function(){VoiceExtensionEvents[_0x6a24('0x4')](_0x93e505,_0x9300df);};}exports['register']=function(_0x33270f){for(var _0x895a57=0x0,_0x4246de=events[_0x6a24('0x5')];_0x895a57<_0x4246de;_0x895a57++){var _0x29f6b2=events[_0x895a57];var _0x3fe244=createListener(_0x6a24('0x6')+_0x29f6b2,_0x33270f);VoiceExtensionEvents['on'](_0x29f6b2,_0x3fe244);}}; \ No newline at end of file +var _0xa671=['save','remove','removeListener','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x226080,_0x5cb137){var _0x162f40=function(_0x4033ff){while(--_0x4033ff){_0x226080['push'](_0x226080['shift']());}};_0x162f40(++_0x5cb137);}(_0xa671,0x76));var _0x1a67=function(_0x572165,_0x6a45cc){_0x572165=_0x572165-0x0;var _0x8c8709=_0xa671[_0x572165];return _0x8c8709;};'use strict';var VoiceExtensionEvents=require(_0x1a67('0x0'));var events=[_0x1a67('0x1'),_0x1a67('0x2'),'update'];function createListener(_0x46a0a1,_0x46048b){return function(_0xc64f3a){_0x46048b['emit'](_0x46a0a1,_0xc64f3a);};}function removeListener(_0x1c4f29,_0x34d2bb){return function(){VoiceExtensionEvents[_0x1a67('0x3')](_0x1c4f29,_0x34d2bb);};}exports[_0x1a67('0x4')]=function(_0x4f232a){for(var _0x4a041d=0x0,_0x4741ac=events[_0x1a67('0x5')];_0x4a041d<_0x4741ac;_0x4a041d++){var _0xcdbf7d=events[_0x4a041d];var _0x1187b3=createListener(_0x1a67('0x6')+_0xcdbf7d,_0x4f232a);VoiceExtensionEvents['on'](_0xcdbf7d,_0x1187b3);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 9b6793c..4363e55 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 _0x034f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id/messages','getMessages','post','/:id','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x145da2,_0x2de58f){var _0x32e0aa=function(_0x4edd4a){while(--_0x4edd4a){_0x145da2['push'](_0x145da2['shift']());}};_0x32e0aa(++_0x2de58f);}(_0x034f,0xf3));var _0xf034=function(_0x1f9124,_0x3c3d72){_0x1f9124=_0x1f9124-0x0;var _0x303e66=_0x034f[_0x1f9124];return _0x303e66;};'use strict';var multer=require(_0xf034('0x0'));var util=require('util');var path=require(_0xf034('0x1'));var timeout=require('connect-timeout');var express=require(_0xf034('0x2'));var router=express[_0xf034('0x3')]();var auth=require(_0xf034('0x4'));var interaction=require(_0xf034('0x5'));var config=require(_0xf034('0x6'));var controller=require(_0xf034('0x7'));router[_0xf034('0x8')]('/',auth[_0xf034('0x9')](),controller[_0xf034('0xa')]);router[_0xf034('0x8')]('/:id',auth[_0xf034('0x9')](),controller['show']);router[_0xf034('0x8')](_0xf034('0xb'),auth[_0xf034('0x9')](),controller[_0xf034('0xc')]);router[_0xf034('0xd')]('/',auth[_0xf034('0x9')](),controller['create']);router['put'](_0xf034('0xe'),auth[_0xf034('0x9')](),controller[_0xf034('0xf')]);router[_0xf034('0x10')](_0xf034('0xe'),auth['isAuthenticated'](),controller[_0xf034('0x11')]);module[_0xf034('0x12')]=router; \ No newline at end of file +var _0xc77a=['get','index','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./voiceMail.controller'];(function(_0x1086d0,_0x57cd8c){var _0x599bfb=function(_0x5a7601){while(--_0x5a7601){_0x1086d0['push'](_0x1086d0['shift']());}};_0x599bfb(++_0x57cd8c);}(_0xc77a,0x13d));var _0xac77=function(_0x3b0b07,_0xc927c6){_0x3b0b07=_0x3b0b07-0x0;var _0x198e38=_0xc77a[_0x3b0b07];return _0x198e38;};'use strict';var multer=require(_0xac77('0x0'));var util=require(_0xac77('0x1'));var path=require(_0xac77('0x2'));var timeout=require(_0xac77('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xac77('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac77('0x5'));router[_0xac77('0x6')]('/',auth['isAuthenticated'](),controller[_0xac77('0x7')]);router[_0xac77('0x6')]('/:id',auth[_0xac77('0x8')](),controller[_0xac77('0x9')]);router[_0xac77('0x6')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xac77('0xa')]('/',auth[_0xac77('0x8')](),controller['create']);router[_0xac77('0xb')]('/:id',auth[_0xac77('0x8')](),controller[_0xac77('0xc')]);router[_0xac77('0xd')](_0xac77('0xe'),auth[_0xac77('0x8')](),controller[_0xac77('0xf')]);module[_0xac77('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 06209ea..74e39cf 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 _0xd8b0=['trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','contest_mailbox','STRING','setDataValue','email','string'];(function(_0x2f23c6,_0x8eacbc){var _0x12e26a=function(_0x2b2b4b){while(--_0x2b2b4b){_0x2f23c6['push'](_0x2f23c6['shift']());}};_0x12e26a(++_0x8eacbc);}(_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')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0x0d8b('0x2')},'mailbox':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':'','allowNull':![],'unique':_0x0d8b('0x2')},'password':{'type':Sequelize[_0x0d8b('0x3')]},'fullname':{'type':Sequelize[_0x0d8b('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x5e15e6){this[_0x0d8b('0x4')](_0x0d8b('0x5'),typeof _0x5e15e6===_0x0d8b('0x6')&&_0x5e15e6['trim']()?_0x5e15e6[_0x0d8b('0x7')]():null);}},'pager':{'type':Sequelize[_0x0d8b('0x3')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x8')},'attach':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':_0x0d8b('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':_0x0d8b('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0d8b('0x3')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x0d8b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0d8b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':_0x0d8b('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0d8b('0xc')},'emailsubject':{'type':Sequelize[_0x0d8b('0x3')]},'emailbody':{'type':Sequelize[_0x0d8b('0x3')]},'maxsecs':{'type':Sequelize[_0x0d8b('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0d8b('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'))+'\x20-\x20'+this[_0x0d8b('0xf')](_0x0d8b('0x11'));}}}; \ No newline at end of file +var _0x2547=['central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim'];(function(_0x331e07,_0x5aa6db){var _0x5716d4=function(_0x173b19){while(--_0x173b19){_0x331e07['push'](_0x331e07['shift']());}};_0x5716d4(++_0x5aa6db);}(_0x2547,0x1cd));var _0x7254=function(_0x36936c,_0x30c739){_0x36936c=_0x36936c-0x0;var _0x13eedb=_0x2547[_0x36936c];return _0x13eedb;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'customer_id':{'type':Sequelize[_0x7254('0x1')]},'context':{'type':Sequelize[_0x7254('0x1')],'defaultValue':_0x7254('0x2'),'unique':_0x7254('0x3')},'mailbox':{'type':Sequelize[_0x7254('0x1')],'defaultValue':'','allowNull':![],'unique':_0x7254('0x3')},'password':{'type':Sequelize[_0x7254('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7254('0x1')],'validate':{'isEmail':!![]},'set':function(_0x59705f){this[_0x7254('0x4')](_0x7254('0x5'),typeof _0x59705f==='string'&&_0x59705f[_0x7254('0x6')]()?_0x59705f[_0x7254('0x6')]():null);}},'pager':{'type':Sequelize[_0x7254('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x7254('0x7')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x7254('0x8')](_0x7254('0x9'),'no'),'defaultValue':_0x7254('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7254('0x1')]},'callback':{'type':Sequelize[_0x7254('0x1')]},'review':{'type':Sequelize[_0x7254('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7254('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7254('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7254('0x8')](_0x7254('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7254('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7254('0x8')](_0x7254('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7254('0x8')](_0x7254('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7254('0x8')](_0x7254('0x9'),'no'),'defaultValue':_0x7254('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7254('0x8')](_0x7254('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7254('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7254('0x8')](_0x7254('0x9'),'no'),'defaultValue':_0x7254('0x9'),'allowNull':![]},'stamp':{'type':_0x7254('0xb')},'emailsubject':{'type':Sequelize[_0x7254('0x1')]},'emailbody':{'type':Sequelize[_0x7254('0x1')]},'maxsecs':{'type':Sequelize[_0x7254('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7254('0xd')],'get':function(){return this[_0x7254('0xe')](_0x7254('0xf'))+_0x7254('0x10')+this[_0x7254('0xe')](_0x7254('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0899c09..66248a3 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 _0x2089=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','hasOwnProperty','order','sort','filter','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','set','Content-Range','json','reject','update','then','destroy','get','Voicemails','end','sendStatus','error','name','send','index','map','VoiceMail','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','where','pick','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2421f4,_0x9ac08b){var _0x32ba39=function(_0x10ec80){while(--_0x10ec80){_0x2421f4['push'](_0x2421f4['shift']());}};_0x32ba39(++_0x9ac08b);}(_0x2089,0x164));var _0x9208=function(_0x2245c0,_0x124aa2){_0x2245c0=_0x2245c0-0x0;var _0x78420e=_0x2089[_0x2245c0];return _0x78420e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9208('0x0'));var rimraf=require(_0x9208('0x1'));var zipdir=require(_0x9208('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9208('0x3'));var moment=require(_0x9208('0x4'));var BPromise=require(_0x9208('0x5'));var Mustache=require(_0x9208('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9208('0x7'));var csv=require('to-csv');var ejs=require(_0x9208('0x8'));var fs=require('fs');var _=require(_0x9208('0x9'));var squel=require(_0x9208('0xa'));var crypto=require(_0x9208('0xb'));var jsforce=require(_0x9208('0xc'));var deskjs=require(_0x9208('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9208('0xe'));var Papa=require(_0x9208('0xf'));var Redis=require(_0x9208('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9208('0x11'));var as=require(_0x9208('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9208('0x13'))(_0x9208('0x14'));var utils=require(_0x9208('0x15'));var config=require(_0x9208('0x16'));var db=require(_0x9208('0x17'))['db'];function respondWithStatusCode(_0x5459c1,_0x3e01fe){_0x3e01fe=_0x3e01fe||0xcc;return function(_0x505f54){if(_0x505f54){return _0x5459c1['sendStatus'](_0x3e01fe);}return _0x5459c1[_0x9208('0x18')](_0x3e01fe)['end']();};}function respondWithResult(_0x4cdacb,_0x1d88a1){_0x1d88a1=_0x1d88a1||0xc8;return function(_0x36dd1d){if(_0x36dd1d){return _0x4cdacb[_0x9208('0x18')](_0x1d88a1)['json'](_0x36dd1d);}};}function respondWithFilteredResult(_0x4d8836,_0x103132){return function(_0x33379d){if(_0x33379d){var _0x55cdf4=_0x33379d['count'],_0x2265e2=_0x103132[_0x9208('0x19')],_0x35a8b5=_0x103132[_0x9208('0x19')]+_0x103132[_0x9208('0x1a')],_0x493ff1;if(_0x35a8b5>=_0x55cdf4){_0x35a8b5=_0x55cdf4;_0x493ff1=0xc8;}else{_0x493ff1=0xce;}_0x4d8836[_0x9208('0x18')](_0x493ff1);return _0x4d8836[_0x9208('0x1b')](_0x9208('0x1c'),_0x2265e2+'-'+_0x35a8b5+'/'+_0x55cdf4)[_0x9208('0x1d')](_0x33379d);}return null;};}function patchUpdates(_0x29109b){return function(_0xa1322a){try{jsonpatch['apply'](_0xa1322a,_0x29109b,!![]);}catch(_0x3f5e61){return BPromise[_0x9208('0x1e')](_0x3f5e61);}return _0xa1322a['save']();};}function saveUpdates(_0x1598f0,_0x549388){return function(_0x4cc79f){if(_0x4cc79f){return _0x4cc79f[_0x9208('0x1f')](_0x1598f0)[_0x9208('0x20')](function(_0x13feb7){return _0x13feb7;});}return null;};}function removeEntity(_0x33ca5a,_0x242cda){return function(_0x419b79){if(_0x419b79){return _0x419b79[_0x9208('0x21')]()[_0x9208('0x20')](function(){var _0x53a350=_0x419b79[_0x9208('0x22')]({'plain':!![]});var _0x127d76=_0x9208('0x23');return db['UserProfileResource'][_0x9208('0x21')]({'where':{'type':_0x127d76,'resourceId':_0x53a350['id']}})[_0x9208('0x20')](function(){return _0x419b79;});})[_0x9208('0x20')](function(){_0x33ca5a['status'](0xcc)[_0x9208('0x24')]();});}};}function handleEntityNotFound(_0x1dd16b,_0x2378e2){return function(_0x39251e){if(!_0x39251e){_0x1dd16b[_0x9208('0x25')](0x194);}return _0x39251e;};}function handleError(_0x2250c7,_0x3d15de){_0x3d15de=_0x3d15de||0x1f4;return function(_0x2fe911){logger[_0x9208('0x26')](_0x2fe911['stack']);if(_0x2fe911[_0x9208('0x27')]){delete _0x2fe911['name'];}_0x2250c7[_0x9208('0x18')](_0x3d15de)[_0x9208('0x28')](_0x2fe911);};}exports[_0x9208('0x29')]=function(_0x9d6ad6,_0x58a322){var _0x30bb0a={},_0x1508b5={},_0x24111b={'count':0x0,'rows':[]};var _0x4c95fc=_[_0x9208('0x2a')](db[_0x9208('0x2b')]['rawAttributes'],function(_0x435b){return{'name':_0x435b[_0x9208('0x2c')],'type':_0x435b[_0x9208('0x2d')][_0x9208('0x2e')]};});_0x1508b5['model']=_[_0x9208('0x2a')](_0x4c95fc,_0x9208('0x27'));_0x1508b5['query']=_[_0x9208('0x2f')](_0x9d6ad6['query']);_0x1508b5[_0x9208('0x30')]=_[_0x9208('0x31')](_0x1508b5[_0x9208('0x32')],_0x1508b5[_0x9208('0x33')]);_0x30bb0a[_0x9208('0x34')]=_['intersection'](_0x1508b5[_0x9208('0x32')],qs[_0x9208('0x35')](_0x9d6ad6['query'][_0x9208('0x35')]));_0x30bb0a[_0x9208('0x34')]=_0x30bb0a[_0x9208('0x34')][_0x9208('0x36')]?_0x30bb0a[_0x9208('0x34')]:_0x1508b5[_0x9208('0x32')];if(!_0x9d6ad6[_0x9208('0x33')]['hasOwnProperty'](_0x9208('0x37'))){_0x30bb0a[_0x9208('0x1a')]=qs[_0x9208('0x1a')](_0x9d6ad6['query'][_0x9208('0x1a')]);_0x30bb0a[_0x9208('0x19')]=qs[_0x9208('0x19')](_0x9d6ad6[_0x9208('0x33')][_0x9208('0x19')]);}_0x30bb0a['order']=qs['sort'](_0x9d6ad6[_0x9208('0x33')]['sort']);_0x30bb0a[_0x9208('0x38')]=qs[_0x9208('0x30')](_[_0x9208('0x39')](_0x9d6ad6[_0x9208('0x33')],_0x1508b5[_0x9208('0x30')]),_0x4c95fc);if(_0x9d6ad6['query']['filter']){_0x30bb0a[_0x9208('0x38')]=_[_0x9208('0x3a')](_0x30bb0a[_0x9208('0x38')],{'$or':_[_0x9208('0x2a')](_0x4c95fc,function(_0x45deeb){if(_0x45deeb[_0x9208('0x2d')]!==_0x9208('0x3b')){var _0x196d80={};_0x196d80[_0x45deeb[_0x9208('0x27')]]={'$like':'%'+_0x9d6ad6[_0x9208('0x33')]['filter']+'%'};return _0x196d80;}})});}_0x30bb0a=_[_0x9208('0x3a')]({},_0x30bb0a,_0x9d6ad6[_0x9208('0x3c')]);var _0x4a05c5={'where':_0x30bb0a[_0x9208('0x38')]};return db['VoiceMail'][_0x9208('0x3d')](_0x4a05c5)[_0x9208('0x20')](function(_0xb9a9a8){_0x24111b['count']=_0xb9a9a8;if(_0x9d6ad6[_0x9208('0x33')][_0x9208('0x3e')]){_0x30bb0a[_0x9208('0x3f')]=[{'all':!![]}];}return db[_0x9208('0x2b')]['findAll'](_0x30bb0a);})[_0x9208('0x20')](function(_0x551e23){_0x24111b[_0x9208('0x40')]=_0x551e23;return _0x24111b;})[_0x9208('0x20')](respondWithFilteredResult(_0x58a322,_0x30bb0a))[_0x9208('0x41')](handleError(_0x58a322,null));};exports['show']=function(_0x2e622e,_0x99e991){var _0x402a88={'raw':!![],'where':{'id':_0x2e622e[_0x9208('0x42')]['id']}},_0x41962f={};_0x41962f[_0x9208('0x32')]=_['keys'](db[_0x9208('0x2b')][_0x9208('0x43')]);_0x41962f['query']=_[_0x9208('0x2f')](_0x2e622e[_0x9208('0x33')]);_0x41962f['filters']=_[_0x9208('0x31')](_0x41962f[_0x9208('0x32')],_0x41962f[_0x9208('0x33')]);_0x402a88[_0x9208('0x34')]=_[_0x9208('0x31')](_0x41962f[_0x9208('0x32')],qs[_0x9208('0x35')](_0x2e622e[_0x9208('0x33')][_0x9208('0x35')]));_0x402a88[_0x9208('0x34')]=_0x402a88['attributes']['length']?_0x402a88[_0x9208('0x34')]:_0x41962f[_0x9208('0x32')];if(_0x2e622e[_0x9208('0x33')][_0x9208('0x3e')]){_0x402a88[_0x9208('0x3f')]=[{'all':!![]}];}_0x402a88=_['merge']({},_0x402a88,_0x2e622e['options']);return db[_0x9208('0x2b')][_0x9208('0x44')](_0x402a88)[_0x9208('0x20')](handleEntityNotFound(_0x99e991,null))[_0x9208('0x20')](respondWithResult(_0x99e991,null))[_0x9208('0x41')](handleError(_0x99e991,null));};exports[_0x9208('0x45')]=function(_0x3735ad,_0x135798){return db['VoiceMail'][_0x9208('0x45')](_0x3735ad[_0x9208('0x46')],{})[_0x9208('0x20')](function(_0x30284b){var _0x422fc1=_0x3735ad[_0x9208('0x47')][_0x9208('0x22')]({'plain':!![]});if(!_0x422fc1)throw new Error(_0x9208('0x48'));if(_0x422fc1[_0x9208('0x49')]===_0x9208('0x47')){var _0x2a3d8b=_0x30284b['get']({'plain':!![]});var _0x98618f=_0x9208('0x23');return db[_0x9208('0x4a')][_0x9208('0x44')]({'where':{'name':_0x98618f,'userProfileId':_0x422fc1[_0x9208('0x4b')]},'raw':!![]})[_0x9208('0x20')](function(_0x2c8610){if(_0x2c8610&&_0x2c8610[_0x9208('0x4c')]===0x0){return db[_0x9208('0x4d')][_0x9208('0x45')]({'name':_0x2a3d8b['name'],'resourceId':_0x2a3d8b['id'],'type':_0x2c8610['name'],'sectionId':_0x2c8610['id']},{})['then'](function(){return _0x30284b;});}else{return _0x30284b;}})[_0x9208('0x41')](function(_0x476d23){logger[_0x9208('0x26')](_0x9208('0x4e'),_0x476d23);throw _0x476d23;});}return _0x30284b;})[_0x9208('0x20')](respondWithResult(_0x135798,0xc9))[_0x9208('0x41')](handleError(_0x135798,null));};exports[_0x9208('0x1f')]=function(_0x5c9a6c,_0x394e0b){if(_0x5c9a6c[_0x9208('0x46')]['id']){delete _0x5c9a6c[_0x9208('0x46')]['id'];}return db['VoiceMail'][_0x9208('0x44')]({'where':{'id':_0x5c9a6c['params']['id']}})['then'](handleEntityNotFound(_0x394e0b,null))['then'](saveUpdates(_0x5c9a6c[_0x9208('0x46')],null))[_0x9208('0x20')](respondWithResult(_0x394e0b,null))[_0x9208('0x41')](handleError(_0x394e0b,null));};exports[_0x9208('0x21')]=function(_0x47200b,_0x24d810){return db[_0x9208('0x2b')][_0x9208('0x44')]({'where':{'id':_0x47200b[_0x9208('0x42')]['id']}})[_0x9208('0x20')](handleEntityNotFound(_0x24d810,null))['then'](removeEntity(_0x24d810,null))['catch'](handleError(_0x24d810,null));};exports[_0x9208('0x4f')]=function(_0x33e403,_0x1a5b54,_0x40075a){return db[_0x9208('0x2b')]['findOne']({'where':{'id':_0x33e403[_0x9208('0x42')]['id']}})[_0x9208('0x20')](handleEntityNotFound(_0x1a5b54,null))[_0x9208('0x20')](function(_0x517c4c){var _0x2a6406;var _0x3a0bc8={},_0x357446={};_0x357446[_0x9208('0x32')]=_[_0x9208('0x2f')](db['VoiceMailMessage']['rawAttributes']);_0x357446[_0x9208('0x33')]=_[_0x9208('0x2f')](_0x33e403[_0x9208('0x33')]);_0x357446[_0x9208('0x30')]=_[_0x9208('0x31')](_0x357446[_0x9208('0x32')],_0x357446[_0x9208('0x33')]);_0x3a0bc8[_0x9208('0x34')]=_['intersection'](_0x357446['model'],qs[_0x9208('0x35')](_0x33e403[_0x9208('0x33')]['fields']));_0x3a0bc8[_0x9208('0x34')]=_0x3a0bc8[_0x9208('0x34')][_0x9208('0x36')]?_0x3a0bc8[_0x9208('0x34')]:_0x357446[_0x9208('0x32')];if(!_0x33e403[_0x9208('0x33')][_0x9208('0x50')]('nolimit')){_0x3a0bc8[_0x9208('0x1a')]=qs[_0x9208('0x1a')](_0x33e403[_0x9208('0x33')][_0x9208('0x1a')]);_0x3a0bc8[_0x9208('0x19')]=qs[_0x9208('0x19')](_0x33e403[_0x9208('0x33')]['offset']);}_0x3a0bc8[_0x9208('0x51')]=qs[_0x9208('0x52')](_0x33e403[_0x9208('0x33')][_0x9208('0x52')]);_0x3a0bc8['where']=qs['filters'](_[_0x9208('0x39')](_0x33e403['query'],_0x357446['filters']));if(_0x33e403['query'][_0x9208('0x53')]){_0x3a0bc8[_0x9208('0x38')]=_[_0x9208('0x3a')](_0x3a0bc8[_0x9208('0x38')],{'$or':_[_0x9208('0x2a')](_0x3a0bc8['attributes'],function(_0x23c2fe){var _0x5e9bc2={};_0x5e9bc2[_0x23c2fe]={'$like':'%'+_0x33e403[_0x9208('0x33')][_0x9208('0x53')]+'%'};return _0x5e9bc2;})});}_0x3a0bc8['where']=_[_0x9208('0x3a')](_0x3a0bc8[_0x9208('0x38')],{'mailboxuser':_0x517c4c['mailbox']});_0x3a0bc8=_[_0x9208('0x3a')]({},_0x3a0bc8,_0x33e403[_0x9208('0x3c')]);return db[_0x9208('0x54')][_0x9208('0x55')](_0x3a0bc8)[_0x9208('0x20')](respondWithFilteredResult(_0x1a5b54,_0x3a0bc8));})[_0x9208('0x41')](handleError(_0x1a5b54,null));}; \ No newline at end of file +var _0x6a57=['VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','findOne','VoiceMailMessage','length','nolimit','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','name','send','index','map'];(function(_0x731b4f,_0x2e62fd){var _0xc85634=function(_0x1dfba4){while(--_0x1dfba4){_0x731b4f['push'](_0x731b4f['shift']());}};_0xc85634(++_0x2e62fd);}(_0x6a57,0xd5));var _0x76a5=function(_0x5b22e5,_0x50a727){_0x5b22e5=_0x5b22e5-0x0;var _0x50aa89=_0x6a57[_0x5b22e5];return _0x50aa89;};'use strict';var pdf=require(_0x76a5('0x0'));var emlformat=require(_0x76a5('0x1'));var rimraf=require(_0x76a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76a5('0x3'));var rp=require(_0x76a5('0x4'));var moment=require('moment');var BPromise=require(_0x76a5('0x5'));var Mustache=require(_0x76a5('0x6'));var util=require('util');var path=require(_0x76a5('0x7'));var sox=require(_0x76a5('0x8'));var csv=require('to-csv');var ejs=require(_0x76a5('0x9'));var fs=require('fs');var _=require(_0x76a5('0xa'));var squel=require('squel');var crypto=require(_0x76a5('0xb'));var jsforce=require(_0x76a5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x76a5('0xd'));var querystring=require(_0x76a5('0xe'));var Papa=require(_0x76a5('0xf'));var Redis=require(_0x76a5('0x10'));var authService=require(_0x76a5('0x11'));var qs=require(_0x76a5('0x12'));var as=require(_0x76a5('0x13'));var hardwareService=require(_0x76a5('0x14'));var logger=require(_0x76a5('0x15'))(_0x76a5('0x16'));var utils=require(_0x76a5('0x17'));var config=require(_0x76a5('0x18'));var db=require(_0x76a5('0x19'))['db'];function respondWithStatusCode(_0x2fdac2,_0x1766e0){_0x1766e0=_0x1766e0||0xcc;return function(_0x431574){if(_0x431574){return _0x2fdac2[_0x76a5('0x1a')](_0x1766e0);}return _0x2fdac2['status'](_0x1766e0)[_0x76a5('0x1b')]();};}function respondWithResult(_0x5680ed,_0x2477a1){_0x2477a1=_0x2477a1||0xc8;return function(_0x3766b6){if(_0x3766b6){return _0x5680ed[_0x76a5('0x1c')](_0x2477a1)[_0x76a5('0x1d')](_0x3766b6);}};}function respondWithFilteredResult(_0x131f4f,_0x390a94){return function(_0x7a2224){if(_0x7a2224){var _0x1bdf82=_0x7a2224[_0x76a5('0x1e')],_0x7e07b1=_0x390a94[_0x76a5('0x1f')],_0x513067=_0x390a94[_0x76a5('0x1f')]+_0x390a94['limit'],_0x3215f3;if(_0x513067>=_0x1bdf82){_0x513067=_0x1bdf82;_0x3215f3=0xc8;}else{_0x3215f3=0xce;}_0x131f4f[_0x76a5('0x1c')](_0x3215f3);return _0x131f4f['set'](_0x76a5('0x20'),_0x7e07b1+'-'+_0x513067+'/'+_0x1bdf82)[_0x76a5('0x1d')](_0x7a2224);}return null;};}function patchUpdates(_0x2d5fc3){return function(_0x79ae17){try{jsonpatch[_0x76a5('0x21')](_0x79ae17,_0x2d5fc3,!![]);}catch(_0xd04d1a){return BPromise[_0x76a5('0x22')](_0xd04d1a);}return _0x79ae17[_0x76a5('0x23')]();};}function saveUpdates(_0x1249c2,_0x1ea5e7){return function(_0x448502){if(_0x448502){return _0x448502['update'](_0x1249c2)[_0x76a5('0x24')](function(_0x382f28){return _0x382f28;});}return null;};}function removeEntity(_0x83c963,_0x6eb456){return function(_0x2edece){if(_0x2edece){return _0x2edece[_0x76a5('0x25')]()[_0x76a5('0x24')](function(){var _0x4ac451=_0x2edece['get']({'plain':!![]});var _0x233145=_0x76a5('0x26');return db[_0x76a5('0x27')][_0x76a5('0x25')]({'where':{'type':_0x233145,'resourceId':_0x4ac451['id']}})['then'](function(){return _0x2edece;});})[_0x76a5('0x24')](function(){_0x83c963['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ee4b0,_0x1aba38){return function(_0x3e79e2){if(!_0x3e79e2){_0x2ee4b0[_0x76a5('0x1a')](0x194);}return _0x3e79e2;};}function handleError(_0x18579d,_0x1a126a){_0x1a126a=_0x1a126a||0x1f4;return function(_0x40501e){logger[_0x76a5('0x28')](_0x40501e['stack']);if(_0x40501e[_0x76a5('0x29')]){delete _0x40501e['name'];}_0x18579d[_0x76a5('0x1c')](_0x1a126a)[_0x76a5('0x2a')](_0x40501e);};}exports[_0x76a5('0x2b')]=function(_0x3bf293,_0x47661d){var _0x18cf2b={},_0x274825={},_0x300b6={'count':0x0,'rows':[]};var _0x60e2f6=_[_0x76a5('0x2c')](db[_0x76a5('0x2d')][_0x76a5('0x2e')],function(_0x1dfbe3){return{'name':_0x1dfbe3[_0x76a5('0x2f')],'type':_0x1dfbe3[_0x76a5('0x30')][_0x76a5('0x31')]};});_0x274825['model']=_[_0x76a5('0x2c')](_0x60e2f6,_0x76a5('0x29'));_0x274825[_0x76a5('0x32')]=_[_0x76a5('0x33')](_0x3bf293[_0x76a5('0x32')]);_0x274825[_0x76a5('0x34')]=_[_0x76a5('0x35')](_0x274825[_0x76a5('0x36')],_0x274825[_0x76a5('0x32')]);_0x18cf2b['attributes']=_[_0x76a5('0x35')](_0x274825[_0x76a5('0x36')],qs[_0x76a5('0x37')](_0x3bf293[_0x76a5('0x32')][_0x76a5('0x37')]));_0x18cf2b[_0x76a5('0x38')]=_0x18cf2b[_0x76a5('0x38')]['length']?_0x18cf2b['attributes']:_0x274825[_0x76a5('0x36')];if(!_0x3bf293[_0x76a5('0x32')][_0x76a5('0x39')]('nolimit')){_0x18cf2b[_0x76a5('0x3a')]=qs[_0x76a5('0x3a')](_0x3bf293[_0x76a5('0x32')][_0x76a5('0x3a')]);_0x18cf2b[_0x76a5('0x1f')]=qs[_0x76a5('0x1f')](_0x3bf293[_0x76a5('0x32')][_0x76a5('0x1f')]);}_0x18cf2b['order']=qs[_0x76a5('0x3b')](_0x3bf293[_0x76a5('0x32')]['sort']);_0x18cf2b[_0x76a5('0x3c')]=qs[_0x76a5('0x34')](_[_0x76a5('0x3d')](_0x3bf293[_0x76a5('0x32')],_0x274825[_0x76a5('0x34')]),_0x60e2f6);if(_0x3bf293[_0x76a5('0x32')]['filter']){_0x18cf2b[_0x76a5('0x3c')]=_[_0x76a5('0x3e')](_0x18cf2b[_0x76a5('0x3c')],{'$or':_['map'](_0x60e2f6,function(_0x264638){if(_0x264638['type']!==_0x76a5('0x3f')){var _0x23c1f0={};_0x23c1f0[_0x264638[_0x76a5('0x29')]]={'$like':'%'+_0x3bf293['query'][_0x76a5('0x40')]+'%'};return _0x23c1f0;}})});}_0x18cf2b=_[_0x76a5('0x3e')]({},_0x18cf2b,_0x3bf293[_0x76a5('0x41')]);var _0x35162f={'where':_0x18cf2b[_0x76a5('0x3c')]};return db['VoiceMail']['count'](_0x35162f)[_0x76a5('0x24')](function(_0xff6f60){_0x300b6['count']=_0xff6f60;if(_0x3bf293[_0x76a5('0x32')][_0x76a5('0x42')]){_0x18cf2b[_0x76a5('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x76a5('0x44')](_0x18cf2b);})[_0x76a5('0x24')](function(_0x37f5f9){_0x300b6['rows']=_0x37f5f9;return _0x300b6;})[_0x76a5('0x24')](respondWithFilteredResult(_0x47661d,_0x18cf2b))[_0x76a5('0x45')](handleError(_0x47661d,null));};exports['show']=function(_0x530531,_0x4a75f0){var _0x403e54={'raw':!![],'where':{'id':_0x530531['params']['id']}},_0x90ca59={};_0x90ca59[_0x76a5('0x36')]=_[_0x76a5('0x33')](db['VoiceMail'][_0x76a5('0x2e')]);_0x90ca59['query']=_[_0x76a5('0x33')](_0x530531[_0x76a5('0x32')]);_0x90ca59[_0x76a5('0x34')]=_[_0x76a5('0x35')](_0x90ca59[_0x76a5('0x36')],_0x90ca59['query']);_0x403e54['attributes']=_[_0x76a5('0x35')](_0x90ca59[_0x76a5('0x36')],qs[_0x76a5('0x37')](_0x530531[_0x76a5('0x32')][_0x76a5('0x37')]));_0x403e54[_0x76a5('0x38')]=_0x403e54[_0x76a5('0x38')]['length']?_0x403e54[_0x76a5('0x38')]:_0x90ca59[_0x76a5('0x36')];if(_0x530531[_0x76a5('0x32')][_0x76a5('0x42')]){_0x403e54['include']=[{'all':!![]}];}_0x403e54=_[_0x76a5('0x3e')]({},_0x403e54,_0x530531[_0x76a5('0x41')]);return db[_0x76a5('0x2d')][_0x76a5('0x46')](_0x403e54)[_0x76a5('0x24')](handleEntityNotFound(_0x4a75f0,null))[_0x76a5('0x24')](respondWithResult(_0x4a75f0,null))['catch'](handleError(_0x4a75f0,null));};exports[_0x76a5('0x47')]=function(_0x36ba14,_0xa079c1){return db[_0x76a5('0x2d')][_0x76a5('0x47')](_0x36ba14['body'],{})[_0x76a5('0x24')](function(_0x5a1cd5){var _0x5044e4=_0x36ba14[_0x76a5('0x48')]['get']({'plain':!![]});if(!_0x5044e4)throw new Error(_0x76a5('0x49'));if(_0x5044e4[_0x76a5('0x4a')]===_0x76a5('0x48')){var _0x3b3be4=_0x5a1cd5['get']({'plain':!![]});var _0x27cc65=_0x76a5('0x26');return db[_0x76a5('0x4b')][_0x76a5('0x46')]({'where':{'name':_0x27cc65,'userProfileId':_0x5044e4[_0x76a5('0x4c')]},'raw':!![]})[_0x76a5('0x24')](function(_0x395591){if(_0x395591&&_0x395591[_0x76a5('0x4d')]===0x0){return db[_0x76a5('0x27')][_0x76a5('0x47')]({'name':_0x3b3be4[_0x76a5('0x29')],'resourceId':_0x3b3be4['id'],'type':_0x395591[_0x76a5('0x29')],'sectionId':_0x395591['id']},{})[_0x76a5('0x24')](function(){return _0x5a1cd5;});}else{return _0x5a1cd5;}})[_0x76a5('0x45')](function(_0x50dcce){logger[_0x76a5('0x28')](_0x76a5('0x4e'),_0x50dcce);throw _0x50dcce;});}return _0x5a1cd5;})['then'](respondWithResult(_0xa079c1,0xc9))[_0x76a5('0x45')](handleError(_0xa079c1,null));};exports['update']=function(_0x42f06e,_0x3c05a4){if(_0x42f06e[_0x76a5('0x4f')]['id']){delete _0x42f06e[_0x76a5('0x4f')]['id'];}return db['VoiceMail'][_0x76a5('0x46')]({'where':{'id':_0x42f06e[_0x76a5('0x50')]['id']}})[_0x76a5('0x24')](handleEntityNotFound(_0x3c05a4,null))[_0x76a5('0x24')](saveUpdates(_0x42f06e['body'],null))['then'](respondWithResult(_0x3c05a4,null))[_0x76a5('0x45')](handleError(_0x3c05a4,null));};exports['destroy']=function(_0x4e2481,_0x232738){return db[_0x76a5('0x2d')][_0x76a5('0x46')]({'where':{'id':_0x4e2481['params']['id']}})[_0x76a5('0x24')](handleEntityNotFound(_0x232738,null))['then'](removeEntity(_0x232738,null))[_0x76a5('0x45')](handleError(_0x232738,null));};exports[_0x76a5('0x51')]=function(_0x33b52e,_0x59419f,_0x1361d2){return db[_0x76a5('0x2d')][_0x76a5('0x52')]({'where':{'id':_0x33b52e[_0x76a5('0x50')]['id']}})[_0x76a5('0x24')](handleEntityNotFound(_0x59419f,null))[_0x76a5('0x24')](function(_0x564fc2){var _0x507ff6;var _0x38d5c8={},_0x2a9333={};_0x2a9333[_0x76a5('0x36')]=_[_0x76a5('0x33')](db[_0x76a5('0x53')][_0x76a5('0x2e')]);_0x2a9333[_0x76a5('0x32')]=_[_0x76a5('0x33')](_0x33b52e[_0x76a5('0x32')]);_0x2a9333['filters']=_['intersection'](_0x2a9333['model'],_0x2a9333[_0x76a5('0x32')]);_0x38d5c8[_0x76a5('0x38')]=_[_0x76a5('0x35')](_0x2a9333[_0x76a5('0x36')],qs[_0x76a5('0x37')](_0x33b52e['query'][_0x76a5('0x37')]));_0x38d5c8[_0x76a5('0x38')]=_0x38d5c8['attributes'][_0x76a5('0x54')]?_0x38d5c8[_0x76a5('0x38')]:_0x2a9333[_0x76a5('0x36')];if(!_0x33b52e[_0x76a5('0x32')][_0x76a5('0x39')](_0x76a5('0x55'))){_0x38d5c8[_0x76a5('0x3a')]=qs[_0x76a5('0x3a')](_0x33b52e[_0x76a5('0x32')][_0x76a5('0x3a')]);_0x38d5c8['offset']=qs['offset'](_0x33b52e[_0x76a5('0x32')]['offset']);}_0x38d5c8['order']=qs[_0x76a5('0x3b')](_0x33b52e['query'][_0x76a5('0x3b')]);_0x38d5c8[_0x76a5('0x3c')]=qs[_0x76a5('0x34')](_[_0x76a5('0x3d')](_0x33b52e['query'],_0x2a9333[_0x76a5('0x34')]));if(_0x33b52e['query'][_0x76a5('0x40')]){_0x38d5c8['where']=_[_0x76a5('0x3e')](_0x38d5c8['where'],{'$or':_[_0x76a5('0x2c')](_0x38d5c8[_0x76a5('0x38')],function(_0x7d3fd7){var _0x5a7ff7={};_0x5a7ff7[_0x7d3fd7]={'$like':'%'+_0x33b52e[_0x76a5('0x32')][_0x76a5('0x40')]+'%'};return _0x5a7ff7;})});}_0x38d5c8[_0x76a5('0x3c')]=_[_0x76a5('0x3e')](_0x38d5c8[_0x76a5('0x3c')],{'mailboxuser':_0x564fc2['mailbox']});_0x38d5c8=_['merge']({},_0x38d5c8,_0x33b52e[_0x76a5('0x41')]);return db[_0x76a5('0x53')]['findAndCountAll'](_0x38d5c8)[_0x76a5('0x24')](respondWithFilteredResult(_0x59419f,_0x38d5c8));})[_0x76a5('0x45')](handleError(_0x59419f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 832944d..4e64796 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 _0x6986=['define','VoiceMail','voice_voicemail','mailbox_context','mailbox','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports'];(function(_0x2687d6,_0x358c86){var _0x264c44=function(_0x4ff59d){while(--_0x4ff59d){_0x2687d6['push'](_0x2687d6['shift']());}};_0x264c44(++_0x358c86);}(_0x6986,0x122));var _0x6698=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x6986[_0x1d426f];return _0x17f71a;};'use strict';var _=require('lodash');var util=require(_0x6698('0x0'));var logger=require(_0x6698('0x1'))(_0x6698('0x2'));var moment=require(_0x6698('0x3'));var BPromise=require(_0x6698('0x4'));var rp=require(_0x6698('0x5'));var fs=require('fs');var path=require(_0x6698('0x6'));var rimraf=require(_0x6698('0x7'));var config=require('../../config/environment');var attributes=require(_0x6698('0x8'));module[_0x6698('0x9')]=function(_0x495780,_0x24d968){return _0x495780[_0x6698('0xa')](_0x6698('0xb'),attributes,{'tableName':_0x6698('0xc'),'paranoid':![],'indexes':[{'name':_0x6698('0xd'),'fields':[_0x6698('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x969b=['mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail'];(function(_0x290e9b,_0x146711){var _0x588154=function(_0x92c358){while(--_0x92c358){_0x290e9b['push'](_0x290e9b['shift']());}};_0x588154(++_0x146711);}(_0x969b,0x1a7));var _0xb969=function(_0x1c0ca7,_0x96134a){_0x1c0ca7=_0x1c0ca7-0x0;var _0x527ef6=_0x969b[_0x1c0ca7];return _0x527ef6;};'use strict';var _=require(_0xb969('0x0'));var util=require(_0xb969('0x1'));var logger=require(_0xb969('0x2'))(_0xb969('0x3'));var moment=require(_0xb969('0x4'));var BPromise=require(_0xb969('0x5'));var rp=require(_0xb969('0x6'));var fs=require('fs');var path=require(_0xb969('0x7'));var rimraf=require(_0xb969('0x8'));var config=require(_0xb969('0x9'));var attributes=require(_0xb969('0xa'));module['exports']=function(_0x527c0e,_0x597aae){return _0x527c0e['define'](_0xb969('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xb969('0xc'),'fields':[_0xb969('0xd'),_0xb969('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 d47e645..4bdf52c 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 _0x8060=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x336ca2,_0x1a813a){var _0xda59a6=function(_0x47caa6){while(--_0x47caa6){_0x336ca2['push'](_0x336ca2['shift']());}};_0xda59a6(++_0x1a813a);}(_0x8060,0x18b));var _0x0806=function(_0x29d4b5,_0x1913e2){_0x29d4b5=_0x29d4b5-0x0;var _0x3fbb01=_0x8060[_0x29d4b5];return _0x3fbb01;};'use strict';var _=require(_0x0806('0x0'));var util=require(_0x0806('0x1'));var moment=require(_0x0806('0x2'));var BPromise=require(_0x0806('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0806('0x4'));var db=require(_0x0806('0x5'))['db'];var utils=require(_0x0806('0x6'));var logger=require('../../config/logger')(_0x0806('0x7'));var config=require(_0x0806('0x8'));var jayson=require(_0x0806('0x9'));var client=jayson[_0x0806('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50200b,_0x2ff852,_0x1287a4){return new BPromise(function(_0x384cb2,_0x12ef7d){return client[_0x0806('0xb')](_0x50200b,_0x1287a4)[_0x0806('0xc')](function(_0x333561){logger[_0x0806('0xd')]('VoiceMail,\x20%s,\x20%s',_0x2ff852,_0x0806('0xe'));logger[_0x0806('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2ff852,_0x0806('0xe'),JSON[_0x0806('0x10')](_0x333561));if(_0x333561[_0x0806('0x11')]){if(_0x333561[_0x0806('0x11')]['code']===0x1f4){logger[_0x0806('0x11')](_0x0806('0x12'),_0x2ff852,_0x333561[_0x0806('0x11')][_0x0806('0x13')]);return _0x12ef7d(_0x333561['error']['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x2ff852,_0x333561[_0x0806('0x11')]['message']);return _0x384cb2(_0x333561[_0x0806('0x11')][_0x0806('0x13')]);}else{logger[_0x0806('0xd')]('VoiceMail,\x20%s,\x20%s',_0x2ff852,'request\x20sent');_0x384cb2(_0x333561[_0x0806('0x14')]['message']);}})[_0x0806('0x15')](function(_0x279bc9){logger[_0x0806('0x11')](_0x0806('0x12'),_0x2ff852,_0x279bc9);_0x12ef7d(_0x279bc9);});});} \ No newline at end of file +var _0x1b2d=['message','catch','lodash','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x203225,_0xe97446){var _0x29c45a=function(_0x5bdd71){while(--_0x5bdd71){_0x203225['push'](_0x203225['shift']());}};_0x29c45a(++_0xe97446);}(_0x1b2d,0x18e));var _0xd1b2=function(_0x36ad44,_0x390c18){_0x36ad44=_0x36ad44-0x0;var _0x5bb132=_0x1b2d[_0x36ad44];return _0x5bb132;};'use strict';var _=require(_0xd1b2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1b2('0x1'));var db=require(_0xd1b2('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1b2('0x3'));var config=require(_0xd1b2('0x4'));var jayson=require(_0xd1b2('0x5'));var client=jayson[_0xd1b2('0x6')][_0xd1b2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6c78ce,_0x462f98,_0x1e61b8){return new BPromise(function(_0x41bb21,_0x337b34){return client[_0xd1b2('0x8')](_0x6c78ce,_0x1e61b8)[_0xd1b2('0x9')](function(_0x4a3aed){logger[_0xd1b2('0xa')](_0xd1b2('0xb'),_0x462f98,'request\x20sent');logger['debug'](_0xd1b2('0xc'),_0x462f98,_0xd1b2('0xd'),JSON[_0xd1b2('0xe')](_0x4a3aed));if(_0x4a3aed['error']){if(_0x4a3aed['error']['code']===0x1f4){logger['error'](_0xd1b2('0xb'),_0x462f98,_0x4a3aed[_0xd1b2('0xf')][_0xd1b2('0x10')]);return _0x337b34(_0x4a3aed[_0xd1b2('0xf')]['message']);}logger[_0xd1b2('0xf')]('VoiceMail,\x20%s,\x20%s',_0x462f98,_0x4a3aed[_0xd1b2('0xf')][_0xd1b2('0x10')]);return _0x41bb21(_0x4a3aed[_0xd1b2('0xf')]['message']);}else{logger[_0xd1b2('0xa')](_0xd1b2('0xb'),_0x462f98,_0xd1b2('0xd'));_0x41bb21(_0x4a3aed['result'][_0xd1b2('0x10')]);}})[_0xd1b2('0x11')](function(_0x27f07f){logger[_0xd1b2('0xf')](_0xd1b2('0xb'),_0x462f98,_0x27f07f);_0x337b34(_0x27f07f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3c6793e..6ff81bd 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','show','/:id/download','isAuthenticated','download','create','put','destroy'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x1261,0x144));var _0x1126=function(_0x2ed51e,_0x20d606){_0x2ed51e=_0x2ed51e-0x0;var _0x44318c=_0x1261[_0x2ed51e];return _0x44318c;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0x9')](_0x1126('0xc'),auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router['post']('/',auth[_0x1126('0xd')](),controller[_0x1126('0xf')]);router[_0x1126('0x10')]('/:id',auth[_0x1126('0xd')](),controller['update']);router['delete'](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0x11')]);module[_0x1126('0x12')]=router; \ No newline at end of file +var _0x4975=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x157162,_0xe1327a){var _0x2cd4ce=function(_0x3afe9c){while(--_0x3afe9c){_0x157162['push'](_0x157162['shift']());}};_0x2cd4ce(++_0xe1327a);}(_0x4975,0x86));var _0x5497=function(_0x46ad4f,_0x3ea9f1){_0x46ad4f=_0x46ad4f-0x0;var _0x5dafe0=_0x4975[_0x46ad4f];return _0x5dafe0;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var auth=require(_0x5497('0x5'));var interaction=require(_0x5497('0x6'));var config=require(_0x5497('0x7'));var controller=require(_0x5497('0x8'));router[_0x5497('0x9')]('/',auth[_0x5497('0xa')](),controller['index']);router[_0x5497('0x9')]('/:id',auth[_0x5497('0xa')](),controller[_0x5497('0xb')]);router[_0x5497('0x9')]('/:id/download',auth[_0x5497('0xa')](),controller['download']);router[_0x5497('0xc')]('/',auth[_0x5497('0xa')](),controller[_0x5497('0xd')]);router[_0x5497('0xe')](_0x5497('0xf'),auth[_0x5497('0xa')](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5497('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 0fd8166..d57e191 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 _0x7743=['BLOB','TIMESTAMP','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x849e7c,_0x34014e){var _0x11722f=function(_0x1a3fa3){while(--_0x1a3fa3){_0x849e7c['push'](_0x849e7c['shift']());}};_0x11722f(++_0x34014e);}(_0x7743,0x176));var _0x3774=function(_0x1ff486,_0x34042c){_0x1ff486=_0x1ff486-0x0;var _0x48f5f2=_0x7743[_0x1ff486];return _0x48f5f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3774('0x0')],'get':function(_0x317e63){return this[_0x3774('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x3774('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3774('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x3774('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x3774('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x3774('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x3774('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3774('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x3774('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x3774('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3774('0x3')],'defaultValue':''},'stamp':{'type':_0x3774('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x8723=['VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP','sequelize','exports'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x8723,0x11e));var _0x3872=function(_0x512911,_0x47ca9c){_0x512911=_0x512911-0x0;var _0x54d25d=_0x8723[_0x512911];return _0x54d25d;};'use strict';var Sequelize=require(_0x3872('0x0'));module[_0x3872('0x1')]={'name':{'type':Sequelize[_0x3872('0x2')],'get':function(_0x4484c1){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x3872('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3872('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x3872('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x3872('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3872('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3872('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x3872('0x5')](_0x3872('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x3872('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3872('0x4')],'defaultValue':''},'stamp':{'type':_0x3872('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 9b8fe46..125aa43 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 _0x39cb=['map','VoiceMailMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index'];(function(_0x52f412,_0x32b546){var _0x2b5a83=function(_0x26e30b){while(--_0x26e30b){_0x52f412['push'](_0x52f412['shift']());}};_0x2b5a83(++_0x32b546);}(_0x39cb,0x1bd));var _0xb39c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39cb[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb39c('0x0'));var rimraf=require(_0xb39c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb39c('0x2'));var rp=require(_0xb39c('0x3'));var moment=require('moment');var BPromise=require(_0xb39c('0x4'));var Mustache=require(_0xb39c('0x5'));var util=require(_0xb39c('0x6'));var path=require(_0xb39c('0x7'));var sox=require(_0xb39c('0x8'));var csv=require('to-csv');var ejs=require(_0xb39c('0x9'));var fs=require('fs');var _=require(_0xb39c('0xa'));var squel=require(_0xb39c('0xb'));var crypto=require(_0xb39c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb39c('0xd'));var querystring=require(_0xb39c('0xe'));var Papa=require(_0xb39c('0xf'));var Redis=require(_0xb39c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39c('0x11'));var logger=require(_0xb39c('0x12'))(_0xb39c('0x13'));var utils=require(_0xb39c('0x14'));var config=require(_0xb39c('0x15'));var db=require(_0xb39c('0x16'))['db'];function respondWithStatusCode(_0x2a5c79,_0x18d12e){_0x18d12e=_0x18d12e||0xcc;return function(_0x51ff24){if(_0x51ff24){return _0x2a5c79[_0xb39c('0x17')](_0x18d12e);}return _0x2a5c79[_0xb39c('0x18')](_0x18d12e)[_0xb39c('0x19')]();};}function respondWithResult(_0x5e4caf,_0xf4662a){_0xf4662a=_0xf4662a||0xc8;return function(_0x40a6d3){if(_0x40a6d3){return _0x5e4caf[_0xb39c('0x18')](_0xf4662a)[_0xb39c('0x1a')](_0x40a6d3);}};}function respondWithFilteredResult(_0x469fa9,_0x27c22a){return function(_0x8e9181){if(_0x8e9181){var _0x5277ce=_0x8e9181[_0xb39c('0x1b')],_0x316c9b=_0x27c22a[_0xb39c('0x1c')],_0x3223f6=_0x27c22a[_0xb39c('0x1c')]+_0x27c22a[_0xb39c('0x1d')],_0x10989d;if(_0x3223f6>=_0x5277ce){_0x3223f6=_0x5277ce;_0x10989d=0xc8;}else{_0x10989d=0xce;}_0x469fa9[_0xb39c('0x18')](_0x10989d);return _0x469fa9[_0xb39c('0x1e')](_0xb39c('0x1f'),_0x316c9b+'-'+_0x3223f6+'/'+_0x5277ce)['json'](_0x8e9181);}return null;};}function patchUpdates(_0x1d2f49){return function(_0x1a8e12){try{jsonpatch[_0xb39c('0x20')](_0x1a8e12,_0x1d2f49,!![]);}catch(_0x447352){return BPromise['reject'](_0x447352);}return _0x1a8e12[_0xb39c('0x21')]();};}function saveUpdates(_0x2da46a,_0x5e4a0b){return function(_0x2d8e93){if(_0x2d8e93){return _0x2d8e93[_0xb39c('0x22')](_0x2da46a)[_0xb39c('0x23')](function(_0x4ebfca){return _0x4ebfca;});}return null;};}function removeEntity(_0x539d27,_0x2789fd){return function(_0x1a5b9d){if(_0x1a5b9d){return _0x1a5b9d[_0xb39c('0x24')]()['then'](function(){_0x539d27[_0xb39c('0x18')](0xcc)[_0xb39c('0x19')]();});}};}function handleEntityNotFound(_0x1bb895,_0x16f3b0){return function(_0x3b03ed){if(!_0x3b03ed){_0x1bb895['sendStatus'](0x194);}return _0x3b03ed;};}function handleError(_0x3036f5,_0xbeab7e){_0xbeab7e=_0xbeab7e||0x1f4;return function(_0x583ee5){logger[_0xb39c('0x25')](_0x583ee5[_0xb39c('0x26')]);if(_0x583ee5[_0xb39c('0x27')]){delete _0x583ee5[_0xb39c('0x27')];}_0x3036f5[_0xb39c('0x18')](_0xbeab7e)['send'](_0x583ee5);};}exports[_0xb39c('0x28')]=function(_0x299c27,_0x132769){var _0x4c06fa={},_0x41fff2={},_0x337532={'count':0x0,'rows':[]};var _0x52eb5e=_[_0xb39c('0x29')](db[_0xb39c('0x2a')][_0xb39c('0x2b')],function(_0x4e9672){return{'name':_0x4e9672[_0xb39c('0x2c')],'type':_0x4e9672[_0xb39c('0x2d')]['key']};});_0x41fff2[_0xb39c('0x2e')]=_['differenceBy'](_[_0xb39c('0x29')](_0x52eb5e,_0xb39c('0x27')),[_0xb39c('0x27')]);_0x41fff2[_0xb39c('0x2f')]=_[_0xb39c('0x30')](_0x299c27['query']);_0x41fff2[_0xb39c('0x31')]=_['intersection'](_0x41fff2[_0xb39c('0x2e')],_0x41fff2['query']);_0x4c06fa[_0xb39c('0x32')]=_[_0xb39c('0x33')](_0x41fff2[_0xb39c('0x2e')],qs[_0xb39c('0x34')](_0x299c27['query']['fields']));_0x4c06fa[_0xb39c('0x32')]=_0x4c06fa[_0xb39c('0x32')]['length']?_0x4c06fa[_0xb39c('0x32')]:_0x41fff2[_0xb39c('0x2e')];if(!_0x299c27[_0xb39c('0x2f')][_0xb39c('0x35')](_0xb39c('0x36'))){_0x4c06fa[_0xb39c('0x1d')]=qs[_0xb39c('0x1d')](_0x299c27[_0xb39c('0x2f')][_0xb39c('0x1d')]);_0x4c06fa[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x299c27[_0xb39c('0x2f')][_0xb39c('0x1c')]);}_0x4c06fa[_0xb39c('0x37')]=qs[_0xb39c('0x38')](_0x299c27[_0xb39c('0x2f')][_0xb39c('0x38')]);_0x4c06fa[_0xb39c('0x39')]=qs[_0xb39c('0x31')](_['pick'](_0x299c27[_0xb39c('0x2f')],_0x41fff2[_0xb39c('0x31')]),_0x52eb5e);if(_0x299c27['query']['filter']){_0x4c06fa['where']=_[_0xb39c('0x3a')](_0x4c06fa[_0xb39c('0x39')],{'$or':_[_0xb39c('0x29')](_0x52eb5e,function(_0x5522ce){if(_0x5522ce[_0xb39c('0x2d')]!==_0xb39c('0x3b')){var _0x44afba={};_0x44afba[_0x5522ce[_0xb39c('0x27')]]={'$like':'%'+_0x299c27[_0xb39c('0x2f')]['filter']+'%'};return _0x44afba;}})});}_0x4c06fa=_[_0xb39c('0x3a')]({},_0x4c06fa,_0x299c27[_0xb39c('0x3c')]);var _0x51b489={'where':_0x4c06fa[_0xb39c('0x39')]};return db['VoiceMailMessage'][_0xb39c('0x1b')](_0x51b489)[_0xb39c('0x23')](function(_0x3eaf96){_0x337532['count']=_0x3eaf96;if(_0x299c27[_0xb39c('0x2f')][_0xb39c('0x3d')]){_0x4c06fa[_0xb39c('0x3e')]=[{'all':!![]}];}return db[_0xb39c('0x2a')][_0xb39c('0x3f')](_0x4c06fa);})[_0xb39c('0x23')](function(_0x17ed52){_0x337532[_0xb39c('0x40')]=_0x17ed52;return _0x337532;})[_0xb39c('0x23')](respondWithFilteredResult(_0x132769,_0x4c06fa))[_0xb39c('0x41')](handleError(_0x132769,null));};exports[_0xb39c('0x42')]=function(_0xd1136f,_0x53347e){var _0x38e8ba={'raw':!![],'where':{'id':_0xd1136f[_0xb39c('0x43')]['id']}},_0xbeb7b3={};_0xbeb7b3[_0xb39c('0x2e')]=_[_0xb39c('0x30')](db[_0xb39c('0x2a')][_0xb39c('0x2b')]);_0xbeb7b3[_0xb39c('0x2f')]=_[_0xb39c('0x30')](_0xd1136f['query']);_0xbeb7b3['filters']=_[_0xb39c('0x33')](_0xbeb7b3[_0xb39c('0x2e')],_0xbeb7b3['query']);_0x38e8ba['attributes']=_[_0xb39c('0x33')](_0xbeb7b3['model'],qs[_0xb39c('0x34')](_0xd1136f[_0xb39c('0x2f')][_0xb39c('0x34')]));_0x38e8ba[_0xb39c('0x32')]=_0x38e8ba[_0xb39c('0x32')]['length']?_0x38e8ba[_0xb39c('0x32')]:_0xbeb7b3[_0xb39c('0x2e')];if(_0xd1136f['query']['includeAll']){_0x38e8ba[_0xb39c('0x3e')]=[{'all':!![]}];}_0x38e8ba=_['merge']({},_0x38e8ba,_0xd1136f['options']);return db[_0xb39c('0x2a')][_0xb39c('0x44')](_0x38e8ba)[_0xb39c('0x23')](handleEntityNotFound(_0x53347e,null))[_0xb39c('0x23')](respondWithResult(_0x53347e,null))[_0xb39c('0x41')](handleError(_0x53347e,null));};exports[_0xb39c('0x45')]=function(_0x25ca4e,_0x164c82){return db[_0xb39c('0x2a')][_0xb39c('0x45')](_0x25ca4e['body'],{})[_0xb39c('0x23')](respondWithResult(_0x164c82,0xc9))[_0xb39c('0x41')](handleError(_0x164c82,null));};exports[_0xb39c('0x22')]=function(_0x2f790e,_0x40e1dc){if(_0x2f790e[_0xb39c('0x46')]['id']){delete _0x2f790e[_0xb39c('0x46')]['id'];}return db[_0xb39c('0x2a')][_0xb39c('0x44')]({'where':{'id':_0x2f790e[_0xb39c('0x43')]['id']}})[_0xb39c('0x23')](handleEntityNotFound(_0x40e1dc,null))[_0xb39c('0x23')](saveUpdates(_0x2f790e[_0xb39c('0x46')],null))[_0xb39c('0x23')](respondWithResult(_0x40e1dc,null))[_0xb39c('0x41')](handleError(_0x40e1dc,null));};exports[_0xb39c('0x24')]=function(_0x4ee3fc,_0x283acf){return db[_0xb39c('0x2a')][_0xb39c('0x44')]({'where':{'id':_0x4ee3fc[_0xb39c('0x43')]['id']}})[_0xb39c('0x23')](handleEntityNotFound(_0x283acf,null))[_0xb39c('0x23')](removeEntity(_0x283acf,null))[_0xb39c('0x41')](handleError(_0x283acf,null));};exports[_0xb39c('0x47')]=function(_0x4b0917,_0x4886ab,_0x32bba9){return db[_0xb39c('0x2a')]['find']({'where':{'id':_0x4b0917['params']['id']},'attributes':['id',_0xb39c('0x48'),_0xb39c('0x49')]})['then'](handleEntityNotFound(_0x4886ab,null))[_0xb39c('0x23')](function(_0x55b6b1){if(_0x55b6b1){if(!_0x55b6b1['recording']){throw new db[(_0xb39c('0x4a'))]['ValidationError'](_0xb39c('0x4b'));}var _0x3fe9db={'Content-Type':_0xb39c('0x4c'),'Content-Disposition':_0xb39c('0x4d')};if(_0x55b6b1[_0xb39c('0x49')]){_0x3fe9db[_0xb39c('0x4e')]='attachment;\x20filename=\x22'+_0x55b6b1[_0xb39c('0x49')]+_0xb39c('0x4f');}_0x4886ab[_0xb39c('0x1e')](_0x3fe9db);return _0x4886ab[_0xb39c('0x50')](new Buffer(_0x55b6b1[_0xb39c('0x48')]));}})['catch'](handleError(_0x4886ab,null));}; \ No newline at end of file +var _0x0bb5=['html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','VIRTUAL','count','then','includeAll','include','findAll','catch','show','params','options','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','send'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0bb5,0x148));var _0x50bb=function(_0x1917a4,_0x27d521){_0x1917a4=_0x1917a4-0x0;var _0xa05d84=_0x0bb5[_0x1917a4];return _0xa05d84;};'use strict';var pdf=require(_0x50bb('0x0'));var emlformat=require(_0x50bb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50bb('0x2'));var rp=require(_0x50bb('0x3'));var moment=require(_0x50bb('0x4'));var BPromise=require(_0x50bb('0x5'));var Mustache=require(_0x50bb('0x6'));var util=require(_0x50bb('0x7'));var path=require(_0x50bb('0x8'));var sox=require(_0x50bb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var db=require(_0x50bb('0x18'))['db'];function respondWithStatusCode(_0x4d7e3d,_0x226370){_0x226370=_0x226370||0xcc;return function(_0x58837d){if(_0x58837d){return _0x4d7e3d[_0x50bb('0x19')](_0x226370);}return _0x4d7e3d[_0x50bb('0x1a')](_0x226370)[_0x50bb('0x1b')]();};}function respondWithResult(_0x502250,_0x17007f){_0x17007f=_0x17007f||0xc8;return function(_0x309986){if(_0x309986){return _0x502250[_0x50bb('0x1a')](_0x17007f)['json'](_0x309986);}};}function respondWithFilteredResult(_0xbbc6a0,_0x5e8478){return function(_0x21befa){if(_0x21befa){var _0x3e1a51=_0x21befa['count'],_0x253073=_0x5e8478[_0x50bb('0x1c')],_0x42ffab=_0x5e8478[_0x50bb('0x1c')]+_0x5e8478['limit'],_0x908950;if(_0x42ffab>=_0x3e1a51){_0x42ffab=_0x3e1a51;_0x908950=0xc8;}else{_0x908950=0xce;}_0xbbc6a0[_0x50bb('0x1a')](_0x908950);return _0xbbc6a0['set'](_0x50bb('0x1d'),_0x253073+'-'+_0x42ffab+'/'+_0x3e1a51)[_0x50bb('0x1e')](_0x21befa);}return null;};}function patchUpdates(_0x4b06f5){return function(_0x4f1c0a){try{jsonpatch[_0x50bb('0x1f')](_0x4f1c0a,_0x4b06f5,!![]);}catch(_0x1499dc){return BPromise[_0x50bb('0x20')](_0x1499dc);}return _0x4f1c0a[_0x50bb('0x21')]();};}function saveUpdates(_0x56b25a,_0x19dc5d){return function(_0x32bfc3){if(_0x32bfc3){return _0x32bfc3[_0x50bb('0x22')](_0x56b25a)['then'](function(_0x3104c8){return _0x3104c8;});}return null;};}function removeEntity(_0x879fea,_0x1344ec){return function(_0x4825f8){if(_0x4825f8){return _0x4825f8[_0x50bb('0x23')]()['then'](function(){_0x879fea[_0x50bb('0x1a')](0xcc)[_0x50bb('0x1b')]();});}};}function handleEntityNotFound(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(!_0x846311){_0x1a2a0b[_0x50bb('0x19')](0x194);}return _0x846311;};}function handleError(_0x4f7f73,_0xad17ac){_0xad17ac=_0xad17ac||0x1f4;return function(_0xee0af0){logger[_0x50bb('0x24')](_0xee0af0[_0x50bb('0x25')]);if(_0xee0af0['name']){delete _0xee0af0[_0x50bb('0x26')];}_0x4f7f73['status'](_0xad17ac)['send'](_0xee0af0);};}exports[_0x50bb('0x27')]=function(_0x491632,_0x5cfe4b){var _0x41fd89={},_0x12ee2c={},_0x3004a3={'count':0x0,'rows':[]};var _0x1b74f9=_[_0x50bb('0x28')](db[_0x50bb('0x29')][_0x50bb('0x2a')],function(_0x41d479){return{'name':_0x41d479['fieldName'],'type':_0x41d479[_0x50bb('0x2b')][_0x50bb('0x2c')]};});_0x12ee2c[_0x50bb('0x2d')]=_[_0x50bb('0x2e')](_['map'](_0x1b74f9,_0x50bb('0x26')),[_0x50bb('0x26')]);_0x12ee2c[_0x50bb('0x2f')]=_[_0x50bb('0x30')](_0x491632[_0x50bb('0x2f')]);_0x12ee2c[_0x50bb('0x31')]=_[_0x50bb('0x32')](_0x12ee2c[_0x50bb('0x2d')],_0x12ee2c[_0x50bb('0x2f')]);_0x41fd89[_0x50bb('0x33')]=_[_0x50bb('0x32')](_0x12ee2c[_0x50bb('0x2d')],qs['fields'](_0x491632[_0x50bb('0x2f')][_0x50bb('0x34')]));_0x41fd89[_0x50bb('0x33')]=_0x41fd89[_0x50bb('0x33')][_0x50bb('0x35')]?_0x41fd89[_0x50bb('0x33')]:_0x12ee2c[_0x50bb('0x2d')];if(!_0x491632[_0x50bb('0x2f')][_0x50bb('0x36')](_0x50bb('0x37'))){_0x41fd89[_0x50bb('0x38')]=qs['limit'](_0x491632[_0x50bb('0x2f')][_0x50bb('0x38')]);_0x41fd89[_0x50bb('0x1c')]=qs[_0x50bb('0x1c')](_0x491632[_0x50bb('0x2f')][_0x50bb('0x1c')]);}_0x41fd89['order']=qs['sort'](_0x491632[_0x50bb('0x2f')]['sort']);_0x41fd89[_0x50bb('0x39')]=qs[_0x50bb('0x31')](_[_0x50bb('0x3a')](_0x491632[_0x50bb('0x2f')],_0x12ee2c[_0x50bb('0x31')]),_0x1b74f9);if(_0x491632['query'][_0x50bb('0x3b')]){_0x41fd89['where']=_[_0x50bb('0x3c')](_0x41fd89[_0x50bb('0x39')],{'$or':_[_0x50bb('0x28')](_0x1b74f9,function(_0x4c29c9){if(_0x4c29c9['type']!==_0x50bb('0x3d')){var _0x2e904e={};_0x2e904e[_0x4c29c9[_0x50bb('0x26')]]={'$like':'%'+_0x491632[_0x50bb('0x2f')]['filter']+'%'};return _0x2e904e;}})});}_0x41fd89=_[_0x50bb('0x3c')]({},_0x41fd89,_0x491632['options']);var _0x52059b={'where':_0x41fd89[_0x50bb('0x39')]};return db['VoiceMailMessage'][_0x50bb('0x3e')](_0x52059b)[_0x50bb('0x3f')](function(_0x1ef231){_0x3004a3[_0x50bb('0x3e')]=_0x1ef231;if(_0x491632[_0x50bb('0x2f')][_0x50bb('0x40')]){_0x41fd89[_0x50bb('0x41')]=[{'all':!![]}];}return db[_0x50bb('0x29')][_0x50bb('0x42')](_0x41fd89);})[_0x50bb('0x3f')](function(_0x594f16){_0x3004a3['rows']=_0x594f16;return _0x3004a3;})[_0x50bb('0x3f')](respondWithFilteredResult(_0x5cfe4b,_0x41fd89))[_0x50bb('0x43')](handleError(_0x5cfe4b,null));};exports[_0x50bb('0x44')]=function(_0x1d929d,_0x5e8085){var _0x41243a={'raw':!![],'where':{'id':_0x1d929d[_0x50bb('0x45')]['id']}},_0x4d34f5={};_0x4d34f5[_0x50bb('0x2d')]=_[_0x50bb('0x30')](db[_0x50bb('0x29')][_0x50bb('0x2a')]);_0x4d34f5[_0x50bb('0x2f')]=_[_0x50bb('0x30')](_0x1d929d[_0x50bb('0x2f')]);_0x4d34f5[_0x50bb('0x31')]=_[_0x50bb('0x32')](_0x4d34f5[_0x50bb('0x2d')],_0x4d34f5[_0x50bb('0x2f')]);_0x41243a[_0x50bb('0x33')]=_[_0x50bb('0x32')](_0x4d34f5[_0x50bb('0x2d')],qs[_0x50bb('0x34')](_0x1d929d['query'][_0x50bb('0x34')]));_0x41243a['attributes']=_0x41243a[_0x50bb('0x33')][_0x50bb('0x35')]?_0x41243a[_0x50bb('0x33')]:_0x4d34f5[_0x50bb('0x2d')];if(_0x1d929d[_0x50bb('0x2f')][_0x50bb('0x40')]){_0x41243a[_0x50bb('0x41')]=[{'all':!![]}];}_0x41243a=_[_0x50bb('0x3c')]({},_0x41243a,_0x1d929d[_0x50bb('0x46')]);return db[_0x50bb('0x29')][_0x50bb('0x47')](_0x41243a)[_0x50bb('0x3f')](handleEntityNotFound(_0x5e8085,null))[_0x50bb('0x3f')](respondWithResult(_0x5e8085,null))[_0x50bb('0x43')](handleError(_0x5e8085,null));};exports['create']=function(_0x3eb429,_0x4e545f){return db[_0x50bb('0x29')][_0x50bb('0x48')](_0x3eb429[_0x50bb('0x49')],{})[_0x50bb('0x3f')](respondWithResult(_0x4e545f,0xc9))[_0x50bb('0x43')](handleError(_0x4e545f,null));};exports[_0x50bb('0x22')]=function(_0x133dd9,_0x358b3a){if(_0x133dd9['body']['id']){delete _0x133dd9[_0x50bb('0x49')]['id'];}return db[_0x50bb('0x29')][_0x50bb('0x47')]({'where':{'id':_0x133dd9[_0x50bb('0x45')]['id']}})[_0x50bb('0x3f')](handleEntityNotFound(_0x358b3a,null))['then'](saveUpdates(_0x133dd9[_0x50bb('0x49')],null))[_0x50bb('0x3f')](respondWithResult(_0x358b3a,null))[_0x50bb('0x43')](handleError(_0x358b3a,null));};exports[_0x50bb('0x23')]=function(_0x77f534,_0x5e050f){return db['VoiceMailMessage'][_0x50bb('0x47')]({'where':{'id':_0x77f534['params']['id']}})[_0x50bb('0x3f')](handleEntityNotFound(_0x5e050f,null))['then'](removeEntity(_0x5e050f,null))[_0x50bb('0x43')](handleError(_0x5e050f,null));};exports[_0x50bb('0x4a')]=function(_0x186bfb,_0x4e67c1,_0x2ce0a9){return db[_0x50bb('0x29')]['find']({'where':{'id':_0x186bfb[_0x50bb('0x45')]['id']},'attributes':['id',_0x50bb('0x4b'),_0x50bb('0x4c')]})[_0x50bb('0x3f')](handleEntityNotFound(_0x4e67c1,null))['then'](function(_0x33e71f){if(_0x33e71f){if(!_0x33e71f[_0x50bb('0x4b')]){throw new db[(_0x50bb('0x4d'))][(_0x50bb('0x4e'))](_0x50bb('0x4f'));}var _0x5e61fe={'Content-Type':_0x50bb('0x50'),'Content-Disposition':'attachment'};if(_0x33e71f[_0x50bb('0x4c')]){_0x5e61fe['Content-Disposition']='attachment;\x20filename=\x22'+_0x33e71f[_0x50bb('0x4c')]+'.wav\x22';}_0x4e67c1['set'](_0x5e61fe);return _0x4e67c1[_0x50bb('0x51')](new Buffer(_0x33e71f[_0x50bb('0x4b')]));}})[_0x50bb('0x43')](handleError(_0x4e67c1,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1b8dbf2..99ed663 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 _0x1c8a=['moment','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c8a,0x140));var _0xa1c8=function(_0x53d903,_0x48a43c){_0x53d903=_0x53d903-0x0;var _0xf33453=_0x1c8a[_0x53d903];return _0xf33453;};'use strict';var _=require(_0xa1c8('0x0'));var util=require(_0xa1c8('0x1'));var logger=require(_0xa1c8('0x2'))(_0xa1c8('0x3'));var moment=require(_0xa1c8('0x4'));var BPromise=require('bluebird');var rp=require(_0xa1c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1c8('0x6'));var config=require(_0xa1c8('0x7'));var attributes=require(_0xa1c8('0x8'));module['exports']=function(_0x331282,_0x14b85c){return _0x331282[_0xa1c8('0x9')]('VoiceMailMessage',attributes,{'tableName':_0xa1c8('0xa'),'paranoid':![],'indexes':[{'name':_0xa1c8('0xb'),'fields':[_0xa1c8('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6b47=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util'];(function(_0x355959,_0x586702){var _0x210e41=function(_0x2de19c){while(--_0x2de19c){_0x355959['push'](_0x355959['shift']());}};_0x210e41(++_0x586702);}(_0x6b47,0xe9));var _0x76b4=function(_0x1c101f,_0x52141d){_0x1c101f=_0x1c101f-0x0;var _0xe02ee4=_0x6b47[_0x1c101f];return _0xe02ee4;};'use strict';var _=require('lodash');var util=require(_0x76b4('0x0'));var logger=require('../../config/logger')(_0x76b4('0x1'));var moment=require(_0x76b4('0x2'));var BPromise=require(_0x76b4('0x3'));var rp=require(_0x76b4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76b4('0x5'));var config=require(_0x76b4('0x6'));var attributes=require(_0x76b4('0x7'));module[_0x76b4('0x8')]=function(_0x292e27,_0x49fc2a){return _0x292e27[_0x76b4('0x9')](_0x76b4('0xa'),attributes,{'tableName':_0x76b4('0xb'),'paranoid':![],'indexes':[{'name':_0x76b4('0xc'),'fields':[_0x76b4('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0c0c3a6..80c7b09 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x27b7d2,_0x56c091){_0x27b7d2=_0x27b7d2-0x0;var _0x3ef6be=_0x0b0e[_0x27b7d2];return _0x3ef6be;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x41c6c4,_0x5aab3d){var _0x569b9b=function(_0x5cdef8){while(--_0x5cdef8){_0x41c6c4['push'](_0x41c6c4['shift']());}};_0x569b9b(++_0x5aab3d);}(_0x57ca,0x108));var _0xa57c=function(_0x14204c,_0x3b3b9b){_0x14204c=_0x14204c-0x0;var _0x5dbc33=_0x57ca[_0x14204c];return _0x5dbc33;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 7b33558..6191517 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 _0xde8b=['addSound','put','delete','/:id','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','show','getSounds','post','/:id/sounds'];(function(_0x2ca6af,_0x74834a){var _0x24fa29=function(_0x5d3f81){while(--_0x5d3f81){_0x2ca6af['push'](_0x2ca6af['shift']());}};_0x24fa29(++_0x74834a);}(_0xde8b,0x80));var _0xbde8=function(_0x1c92a0,_0x1a55b5){_0x1c92a0=_0x1c92a0-0x0;var _0x4ad53f=_0xde8b[_0x1c92a0];return _0x4ad53f;};'use strict';var multer=require(_0xbde8('0x0'));var util=require(_0xbde8('0x1'));var path=require(_0xbde8('0x2'));var timeout=require(_0xbde8('0x3'));var express=require(_0xbde8('0x4'));var router=express[_0xbde8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbde8('0x6'));var config=require(_0xbde8('0x7'));var controller=require(_0xbde8('0x8'));router['get']('/',auth[_0xbde8('0x9')](),controller[_0xbde8('0xa')]);router[_0xbde8('0xb')]('/:id',auth[_0xbde8('0x9')](),controller[_0xbde8('0xc')]);router[_0xbde8('0xb')]('/:id/sounds',auth[_0xbde8('0x9')](),controller[_0xbde8('0xd')]);router[_0xbde8('0xe')]('/',auth[_0xbde8('0x9')](),controller['create']);router[_0xbde8('0xe')](_0xbde8('0xf'),auth[_0xbde8('0x9')](),controller[_0xbde8('0x10')]);router[_0xbde8('0x11')]('/:id',auth[_0xbde8('0x9')](),controller['update']);router[_0xbde8('0x12')](_0xbde8('0x13'),auth[_0xbde8('0x9')](),controller[_0xbde8('0x14')]);router[_0xbde8('0x12')](_0xbde8('0x15'),auth['isAuthenticated'](),controller[_0xbde8('0x16')]);module[_0xbde8('0x17')]=router; \ No newline at end of file +var _0x8679=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','put','destroy','delete','/:id/sounds/:id2','removeSound','exports'];(function(_0x3f3e5f,_0x450d84){var _0x2f105f=function(_0x2ea0d9){while(--_0x2ea0d9){_0x3f3e5f['push'](_0x3f3e5f['shift']());}};_0x2f105f(++_0x450d84);}(_0x8679,0x138));var _0x9867=function(_0x24ccde,_0x2de230){_0x24ccde=_0x24ccde-0x0;var _0x3bcd33=_0x8679[_0x24ccde];return _0x3bcd33;};'use strict';var multer=require(_0x9867('0x0'));var util=require('util');var path=require(_0x9867('0x1'));var timeout=require(_0x9867('0x2'));var express=require(_0x9867('0x3'));var router=express[_0x9867('0x4')]();var auth=require(_0x9867('0x5'));var interaction=require(_0x9867('0x6'));var config=require(_0x9867('0x7'));var controller=require(_0x9867('0x8'));router[_0x9867('0x9')]('/',auth[_0x9867('0xa')](),controller[_0x9867('0xb')]);router[_0x9867('0x9')](_0x9867('0xc'),auth[_0x9867('0xa')](),controller[_0x9867('0xd')]);router[_0x9867('0x9')](_0x9867('0xe'),auth[_0x9867('0xa')](),controller['getSounds']);router[_0x9867('0xf')]('/',auth[_0x9867('0xa')](),controller[_0x9867('0x10')]);router['post']('/:id/sounds',auth[_0x9867('0xa')](),controller[_0x9867('0x11')]);router[_0x9867('0x12')]('/:id',auth[_0x9867('0xa')](),controller['update']);router['delete'](_0x9867('0xc'),auth[_0x9867('0xa')](),controller[_0x9867('0x13')]);router[_0x9867('0x14')](_0x9867('0x15'),auth[_0x9867('0xa')](),controller[_0x9867('0x16')]);module[_0x9867('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 1b89cdc..bbc7604 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 _0x8921=['name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING'];(function(_0x246dae,_0x17ced5){var _0x426065=function(_0x5f447e){while(--_0x5f447e){_0x246dae['push'](_0x246dae['shift']());}};_0x426065(++_0x17ced5);}(_0x8921,0x9a));var _0x1892=function(_0x5f5606,_0x38704c){_0x5f5606=_0x5f5606-0x0;var _0x883c3c=_0x8921[_0x5f5606];return _0x883c3c;};'use strict';var Sequelize=require(_0x1892('0x0'));module['exports']={'name':{'type':Sequelize[_0x1892('0x1')],'allowNull':![],'unique':_0x1892('0x2')},'mode':{'type':Sequelize[_0x1892('0x3')](_0x1892('0x4'),_0x1892('0x5'),_0x1892('0x6'),_0x1892('0x7'),_0x1892('0x8'),_0x1892('0x9')),'allowNull':!![],'defaultValue':_0x1892('0x5')},'directory':{'type':Sequelize[_0x1892('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x1892('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x1892('0x1')],'allowNull':!![],'defaultValue':_0x1892('0xa')},'format':{'type':Sequelize[_0x1892('0x1')],'allowNull':!![]},'stamp':{'type':_0x1892('0xb')},'defaultEntry':{'type':Sequelize[_0x1892('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0041=['ENUM','custom','quietmp3nb','mp3','files','alpha','sequelize','STRING','name'];(function(_0x4fee41,_0x2a1b3b){var _0x35a6d1=function(_0xa5a5d9){while(--_0xa5a5d9){_0x4fee41['push'](_0x4fee41['shift']());}};_0x35a6d1(++_0x2a1b3b);}(_0x0041,0x72));var _0x1004=function(_0x3e3b54,_0x49254d){_0x3e3b54=_0x3e3b54-0x0;var _0x15f092=_0x0041[_0x3e3b54];return _0x15f092;};'use strict';var Sequelize=require(_0x1004('0x0'));module['exports']={'name':{'type':Sequelize[_0x1004('0x1')],'allowNull':![],'unique':_0x1004('0x2')},'mode':{'type':Sequelize[_0x1004('0x3')](_0x1004('0x4'),'files','mp3nb',_0x1004('0x5'),'quietmp3',_0x1004('0x6')),'allowNull':!![],'defaultValue':_0x1004('0x7')},'directory':{'type':Sequelize[_0x1004('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x1004('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x1004('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x1004('0x1')],'allowNull':!![],'defaultValue':_0x1004('0x8')},'format':{'type':Sequelize[_0x1004('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 6576770..9dcce90 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(_0x4c897a,_0x166fbb){var _0x39a99c=function(_0x5292ec){while(--_0x5292ec){_0x4c897a['push'](_0x4c897a['shift']());}};_0x39a99c(++_0x166fbb);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0xb10b[_0x1e03a6];return _0x295b64;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file +var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x5d7d9f,_0x58ff11){var _0xd118fc=function(_0x4963df){while(--_0x4963df){_0x5d7d9f['push'](_0x5d7d9f['shift']());}};_0xd118fc(++_0x58ff11);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a6e77,_0x4a677c){_0x4a6e77=_0x4a6e77-0x0;var _0x1c137e=_0xb10b[_0x4a6e77];return _0x1c137e;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 61ff0f4..8aaf650 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 _0x372a=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','moment','request-promise'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x372a,0x14c));var _0xa372=function(_0x1110d8,_0x10fc0b){_0x1110d8=_0x1110d8-0x0;var _0x4f38a4=_0x372a[_0x1110d8];return _0x4f38a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa372('0x0'))(_0xa372('0x1'));var moment=require(_0xa372('0x2'));var BPromise=require('bluebird');var rp=require(_0xa372('0x3'));var fs=require('fs');var path=require(_0xa372('0x4'));var rimraf=require(_0xa372('0x5'));var config=require(_0xa372('0x6'));var attributes=require(_0xa372('0x7'));module[_0xa372('0x8')]=function(_0x29707e,_0x45f7e4){return _0x29707e[_0xa372('0x9')](_0xa372('0xa'),attributes,{'tableName':_0xa372('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd02=['define','VoiceMusicOnHold','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x37017e,_0x40f1e6){var _0xdeedc6=function(_0x46a836){while(--_0x46a836){_0x37017e['push'](_0x37017e['shift']());}};_0xdeedc6(++_0x40f1e6);}(_0xfd02,0xd2));var _0x2fd0=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0xfd02[_0x187279];return _0x3da59d;};'use strict';var _=require(_0x2fd0('0x0'));var util=require(_0x2fd0('0x1'));var logger=require(_0x2fd0('0x2'))(_0x2fd0('0x3'));var moment=require('moment');var BPromise=require(_0x2fd0('0x4'));var rp=require(_0x2fd0('0x5'));var fs=require('fs');var path=require(_0x2fd0('0x6'));var rimraf=require(_0x2fd0('0x7'));var config=require(_0x2fd0('0x8'));var attributes=require(_0x2fd0('0x9'));module[_0x2fd0('0xa')]=function(_0x22afea,_0x5b9bc3){return _0x22afea[_0x2fd0('0xb')](_0x2fd0('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 477e59c..e3c7e5a 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 _0xdf4b=['debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info'];(function(_0x3ad27a,_0x1c5bf0){var _0x5cedcc=function(_0x129a08){while(--_0x129a08){_0x3ad27a['push'](_0x3ad27a['shift']());}};_0x5cedcc(++_0x1c5bf0);}(_0xdf4b,0x12f));var _0xbdf4=function(_0x34fca1,_0x4e0342){_0x34fca1=_0x34fca1-0x0;var _0x4991d6=_0xdf4b[_0x34fca1];return _0x4991d6;};'use strict';var _=require(_0xbdf4('0x0'));var util=require(_0xbdf4('0x1'));var moment=require('moment');var BPromise=require(_0xbdf4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdf4('0x3'));var db=require(_0xbdf4('0x4'))['db'];var utils=require(_0xbdf4('0x5'));var logger=require('../../config/logger')(_0xbdf4('0x6'));var config=require('../../config/environment');var jayson=require(_0xbdf4('0x7'));var client=jayson[_0xbdf4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cf45b,_0x5f15a5,_0x3b7e23){return new BPromise(function(_0x4415d6,_0x4219b3){return client[_0xbdf4('0x9')](_0x1cf45b,_0x3b7e23)[_0xbdf4('0xa')](function(_0x5f2b9b){logger[_0xbdf4('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5f15a5,'request\x20sent');logger[_0xbdf4('0xc')](_0xbdf4('0xd'),_0x5f15a5,_0xbdf4('0xe'),JSON[_0xbdf4('0xf')](_0x5f2b9b));if(_0x5f2b9b[_0xbdf4('0x10')]){if(_0x5f2b9b['error']['code']===0x1f4){logger[_0xbdf4('0x10')](_0xbdf4('0x11'),_0x5f15a5,_0x5f2b9b[_0xbdf4('0x10')][_0xbdf4('0x12')]);return _0x4219b3(_0x5f2b9b[_0xbdf4('0x10')][_0xbdf4('0x12')]);}logger[_0xbdf4('0x10')](_0xbdf4('0x11'),_0x5f15a5,_0x5f2b9b[_0xbdf4('0x10')][_0xbdf4('0x12')]);return _0x4415d6(_0x5f2b9b[_0xbdf4('0x10')][_0xbdf4('0x12')]);}else{logger[_0xbdf4('0xb')](_0xbdf4('0x11'),_0x5f15a5,_0xbdf4('0xe'));_0x4415d6(_0x5f2b9b[_0xbdf4('0x13')][_0xbdf4('0x12')]);}})[_0xbdf4('0x14')](function(_0x520e0a){logger[_0xbdf4('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5f15a5,_0x520e0a);_0x4219b3(_0x520e0a);});});} \ No newline at end of file +var _0xf46e=['error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x13f194,_0x28ef40){var _0xe9e697=function(_0x21dc47){while(--_0x21dc47){_0x13f194['push'](_0x13f194['shift']());}};_0xe9e697(++_0x28ef40);}(_0xf46e,0x165));var _0xef46=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf46e[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xef46('0x0'));var BPromise=require('bluebird');var rs=require(_0xef46('0x1'));var fs=require('fs');var Redis=require(_0xef46('0x2'));var db=require(_0xef46('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xef46('0x4'))(_0xef46('0x5'));var config=require(_0xef46('0x6'));var jayson=require(_0xef46('0x7'));var client=jayson[_0xef46('0x8')][_0xef46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fa266,_0x3f8cd6,_0x22a696){return new BPromise(function(_0x10d9b1,_0x49a669){return client[_0xef46('0xa')](_0x3fa266,_0x22a696)[_0xef46('0xb')](function(_0x212589){logger[_0xef46('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3f8cd6,'request\x20sent');logger[_0xef46('0xd')](_0xef46('0xe'),_0x3f8cd6,_0xef46('0xf'),JSON[_0xef46('0x10')](_0x212589));if(_0x212589[_0xef46('0x11')]){if(_0x212589[_0xef46('0x11')][_0xef46('0x12')]===0x1f4){logger[_0xef46('0x11')](_0xef46('0x13'),_0x3f8cd6,_0x212589[_0xef46('0x11')][_0xef46('0x14')]);return _0x49a669(_0x212589[_0xef46('0x11')][_0xef46('0x14')]);}logger[_0xef46('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3f8cd6,_0x212589[_0xef46('0x11')][_0xef46('0x14')]);return _0x10d9b1(_0x212589[_0xef46('0x11')]['message']);}else{logger[_0xef46('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3f8cd6,_0xef46('0xf'));_0x10d9b1(_0x212589['result']['message']);}})[_0xef46('0x15')](function(_0x2fe5dd){logger[_0xef46('0x11')](_0xef46('0x13'),_0x3f8cd6,_0x2fe5dd);_0x49a669(_0x2fe5dd);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 730e8a5..c08fa8f 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 _0xe2c9=['../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','describe','/:id/users','getAgents','post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x477d4,_0x4a72a7){var _0x5c72f9=function(_0x42f569){while(--_0x42f569){_0x477d4['push'](_0x477d4['shift']());}};_0x5c72f9(++_0x4a72a7);}(_0xe2c9,0x102));var _0x9e2c=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe2c9[_0x484e36];return _0xafc85d;};'use strict';var multer=require('multer');var util=require(_0x9e2c('0x0'));var path=require(_0x9e2c('0x1'));var timeout=require('connect-timeout');var express=require(_0x9e2c('0x2'));var router=express[_0x9e2c('0x3')]();var auth=require(_0x9e2c('0x4'));var interaction=require(_0x9e2c('0x5'));var config=require(_0x9e2c('0x6'));var controller=require(_0x9e2c('0x7'));router['get']('/',auth[_0x9e2c('0x8')](),controller[_0x9e2c('0x9')]);router[_0x9e2c('0xa')]('/describe',auth[_0x9e2c('0x8')](),controller[_0x9e2c('0xb')]);router[_0x9e2c('0xa')]('/:id',auth[_0x9e2c('0x8')](),controller['show']);router['get'](_0x9e2c('0xc'),auth['isAuthenticated'](),controller[_0x9e2c('0xd')]);router[_0x9e2c('0xe')]('/',auth[_0x9e2c('0x8')](),controller[_0x9e2c('0xf')]);router[_0x9e2c('0xe')]('/:id/users',auth[_0x9e2c('0x8')](),controller['addAgents']);router[_0x9e2c('0x10')](_0x9e2c('0x11'),auth[_0x9e2c('0x8')](),controller[_0x9e2c('0x12')]);router[_0x9e2c('0x13')](_0x9e2c('0x11'),auth['isAuthenticated'](),controller[_0x9e2c('0x14')]);router[_0x9e2c('0x13')](_0x9e2c('0xc'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x9e2c('0x15')]=router; \ No newline at end of file +var _0x79de=['show','/:id/users','getAgents','post','create','addAgents','put','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2785ac,_0x473f24){var _0x39fee7=function(_0x4b2944){while(--_0x4b2944){_0x2785ac['push'](_0x2785ac['shift']());}};_0x39fee7(++_0x473f24);}(_0x79de,0x1a8));var _0xe79d=function(_0x9400db,_0x4cbfd6){_0x9400db=_0x9400db-0x0;var _0x1eba72=_0x79de[_0x9400db];return _0x1eba72;};'use strict';var multer=require(_0xe79d('0x0'));var util=require('util');var path=require(_0xe79d('0x1'));var timeout=require(_0xe79d('0x2'));var express=require(_0xe79d('0x3'));var router=express[_0xe79d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe79d('0x5'));var controller=require(_0xe79d('0x6'));router[_0xe79d('0x7')]('/',auth[_0xe79d('0x8')](),controller[_0xe79d('0x9')]);router[_0xe79d('0x7')](_0xe79d('0xa'),auth[_0xe79d('0x8')](),controller[_0xe79d('0xb')]);router[_0xe79d('0x7')](_0xe79d('0xc'),auth['isAuthenticated'](),controller[_0xe79d('0xd')]);router[_0xe79d('0x7')](_0xe79d('0xe'),auth[_0xe79d('0x8')](),controller[_0xe79d('0xf')]);router[_0xe79d('0x10')]('/',auth[_0xe79d('0x8')](),controller[_0xe79d('0x11')]);router[_0xe79d('0x10')]('/:id/users',auth[_0xe79d('0x8')](),controller[_0xe79d('0x12')]);router[_0xe79d('0x13')](_0xe79d('0xc'),auth[_0xe79d('0x8')](),controller['update']);router[_0xe79d('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xe79d('0x14')](_0xe79d('0xe'),auth[_0xe79d('0x8')](),controller[_0xe79d('0x15')]);module[_0xe79d('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ab8bb13..64757da 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 _0xb7a9=['exports','STRING','name','getDataValue','INTEGER','sequelize'];(function(_0x3d1463,_0x166e2a){var _0x256cda=function(_0x3383b8){while(--_0x3383b8){_0x3d1463['push'](_0x3d1463['shift']());}};_0x256cda(++_0x166e2a);}(_0xb7a9,0x1a3));var _0x9b7a=function(_0x566b4f,_0x53a57a){_0x566b4f=_0x566b4f-0x0;var _0x569996=_0xb7a9[_0x566b4f];return _0x569996;};'use strict';var Sequelize=require(_0x9b7a('0x0'));module[_0x9b7a('0x1')]={'name':{'type':Sequelize[_0x9b7a('0x2')],'allowNull':![],'unique':_0x9b7a('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2bbb9a){return'system-'+this[_0x9b7a('0x4')](_0x9b7a('0x3'))+'-';}},'description':{'type':Sequelize[_0x9b7a('0x2')]},'callerIdAll':{'type':Sequelize[_0x9b7a('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x9b7a('0x5')]}}; \ No newline at end of file +var _0x07cf=['STRING','sequelize','exports','VIRTUAL','name'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x07cf,0xce));var _0xf07c=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x07cf[_0x13ff53];return _0x290228;};'use strict';var Sequelize=require(_0xf07c('0x0'));module[_0xf07c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xf07c('0x2')],'get':function(_0x1ca88e){return'system-'+this['getDataValue'](_0xf07c('0x3'))+'-';}},'description':{'type':Sequelize[_0xf07c('0x4')]},'callerIdAll':{'type':Sequelize[_0xf07c('0x4')]},'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 cad32bd..320dd5f 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 _0xc4d1=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','prefix','push','Set','PREFIX-CALLERIDALL=','callerIdAll','goto','charAt','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3c09da,_0xc3f6dc){var _0x592b3c=function(_0x528321){while(--_0x528321){_0x3c09da['push'](_0x3c09da['shift']());}};_0x592b3c(++_0xc3f6dc);}(_0xc4d1,0xdf));var _0x1c4d=function(_0x40b66c,_0x578758){_0x40b66c=_0x40b66c-0x0;var _0x2fd22b=_0xc4d1[_0x40b66c];return _0x2fd22b;};'use strict';var pdf=require(_0x1c4d('0x0'));var emlformat=require(_0x1c4d('0x1'));var rimraf=require(_0x1c4d('0x2'));var zipdir=require(_0x1c4d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c4d('0x4'));var moment=require(_0x1c4d('0x5'));var BPromise=require(_0x1c4d('0x6'));var Mustache=require(_0x1c4d('0x7'));var util=require('util');var path=require(_0x1c4d('0x8'));var sox=require(_0x1c4d('0x9'));var csv=require(_0x1c4d('0xa'));var ejs=require(_0x1c4d('0xb'));var fs=require('fs');var _=require(_0x1c4d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1c4d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1c4d('0xa'));var querystring=require(_0x1c4d('0xe'));var Papa=require(_0x1c4d('0xf'));var Redis=require(_0x1c4d('0x10'));var authService=require(_0x1c4d('0x11'));var qs=require(_0x1c4d('0x12'));var as=require(_0x1c4d('0x13'));var hardwareService=require(_0x1c4d('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1c4d('0x15'));var db=require(_0x1c4d('0x16'))['db'];config[_0x1c4d('0x17')]=_[_0x1c4d('0x18')](config[_0x1c4d('0x17')],{'host':_0x1c4d('0x19'),'port':0x18eb});var socket=require(_0x1c4d('0x1a'))(new Redis(config[_0x1c4d('0x17')]));require('./voicePrefix.socket')[_0x1c4d('0x1b')](socket);function respondWithStatusCode(_0x361888,_0x5af68b){_0x5af68b=_0x5af68b||0xcc;return function(_0x25a31c){if(_0x25a31c){return _0x361888[_0x1c4d('0x1c')](_0x5af68b);}return _0x361888[_0x1c4d('0x1d')](_0x5af68b)[_0x1c4d('0x1e')]();};}function respondWithResult(_0x45e066,_0x10cc7c){_0x10cc7c=_0x10cc7c||0xc8;return function(_0x33d674){if(_0x33d674){return _0x45e066[_0x1c4d('0x1d')](_0x10cc7c)[_0x1c4d('0x1f')](_0x33d674);}};}function respondWithFilteredResult(_0x1f85a1,_0x56620f){return function(_0x4e3686){if(_0x4e3686){var _0x157c14=_0x4e3686[_0x1c4d('0x20')],_0x15a491=_0x56620f[_0x1c4d('0x21')],_0x1244f4=_0x56620f['offset']+_0x56620f[_0x1c4d('0x22')],_0x1608e3;if(_0x1244f4>=_0x157c14){_0x1244f4=_0x157c14;_0x1608e3=0xc8;}else{_0x1608e3=0xce;}_0x1f85a1[_0x1c4d('0x1d')](_0x1608e3);return _0x1f85a1[_0x1c4d('0x23')](_0x1c4d('0x24'),_0x15a491+'-'+_0x1244f4+'/'+_0x157c14)[_0x1c4d('0x1f')](_0x4e3686);}return null;};}function patchUpdates(_0x117d31){return function(_0xd47b94){try{jsonpatch[_0x1c4d('0x25')](_0xd47b94,_0x117d31,!![]);}catch(_0xace787){return BPromise[_0x1c4d('0x26')](_0xace787);}return _0xd47b94[_0x1c4d('0x27')]();};}function saveUpdates(_0x832c9f,_0x1b3702){return function(_0x1c3220){if(_0x1c3220){return _0x1c3220[_0x1c4d('0x28')](_0x832c9f)[_0x1c4d('0x29')](function(_0x587d34){return _0x587d34;});}return null;};}function removeEntity(_0x111d05,_0x38900d){return function(_0x11dc06){if(_0x11dc06){return _0x11dc06[_0x1c4d('0x2a')]()['then'](function(){var _0x546054=_0x11dc06[_0x1c4d('0x2b')]({'plain':!![]});var _0x19af15=_0x1c4d('0x2c');return db['UserProfileResource'][_0x1c4d('0x2a')]({'where':{'type':_0x19af15,'resourceId':_0x546054['id']}})[_0x1c4d('0x29')](function(){return _0x11dc06;});})['then'](function(){_0x111d05[_0x1c4d('0x1d')](0xcc)[_0x1c4d('0x1e')]();});}};}function handleEntityNotFound(_0xe95a5e,_0x521593){return function(_0x1e368b){if(!_0x1e368b){_0xe95a5e['sendStatus'](0x194);}return _0x1e368b;};}function handleError(_0x73bf99,_0x472792){_0x472792=_0x472792||0x1f4;return function(_0x2adba3){logger['error'](_0x2adba3[_0x1c4d('0x2d')]);if(_0x2adba3[_0x1c4d('0x2e')]){delete _0x2adba3[_0x1c4d('0x2e')];}_0x73bf99['status'](_0x472792)[_0x1c4d('0x2f')](_0x2adba3);};}exports['index']=function(_0x1b638d,_0x1ff608){var _0x80bcbb={},_0xa210b9={},_0x399676={'count':0x0,'rows':[]};var _0x17cb9c=_[_0x1c4d('0x30')](db[_0x1c4d('0x31')][_0x1c4d('0x32')],function(_0x2d9c10){return{'name':_0x2d9c10[_0x1c4d('0x33')],'type':_0x2d9c10[_0x1c4d('0x34')][_0x1c4d('0x35')]};});_0xa210b9[_0x1c4d('0x36')]=_[_0x1c4d('0x30')](_0x17cb9c,'name');_0xa210b9[_0x1c4d('0x37')]=_['keys'](_0x1b638d[_0x1c4d('0x37')]);_0xa210b9[_0x1c4d('0x38')]=_[_0x1c4d('0x39')](_0xa210b9[_0x1c4d('0x36')],_0xa210b9[_0x1c4d('0x37')]);_0x80bcbb[_0x1c4d('0x3a')]=_['intersection'](_0xa210b9['model'],qs[_0x1c4d('0x3b')](_0x1b638d['query'][_0x1c4d('0x3b')]));_0x80bcbb[_0x1c4d('0x3a')]=_0x80bcbb['attributes'][_0x1c4d('0x3c')]?_0x80bcbb['attributes']:_0xa210b9[_0x1c4d('0x36')];if(!_0x1b638d['query']['hasOwnProperty']('nolimit')){_0x80bcbb[_0x1c4d('0x22')]=qs[_0x1c4d('0x22')](_0x1b638d[_0x1c4d('0x37')]['limit']);_0x80bcbb[_0x1c4d('0x21')]=qs[_0x1c4d('0x21')](_0x1b638d[_0x1c4d('0x37')][_0x1c4d('0x21')]);}_0x80bcbb[_0x1c4d('0x3d')]=qs[_0x1c4d('0x3e')](_0x1b638d['query']['sort']);_0x80bcbb[_0x1c4d('0x3f')]=qs['filters'](_[_0x1c4d('0x40')](_0x1b638d[_0x1c4d('0x37')],_0xa210b9[_0x1c4d('0x38')]),_0x17cb9c);if(_0x1b638d[_0x1c4d('0x37')][_0x1c4d('0x41')]){_0x80bcbb['where']=_[_0x1c4d('0x42')](_0x80bcbb[_0x1c4d('0x3f')],{'$or':_[_0x1c4d('0x30')](_0x17cb9c,function(_0x4a47e3){if(_0x4a47e3['type']!==_0x1c4d('0x43')){var _0xd522cf={};_0xd522cf[_0x4a47e3[_0x1c4d('0x2e')]]={'$like':'%'+_0x1b638d[_0x1c4d('0x37')][_0x1c4d('0x41')]+'%'};return _0xd522cf;}})});}_0x80bcbb=_[_0x1c4d('0x42')]({},_0x80bcbb,_0x1b638d[_0x1c4d('0x44')]);var _0x5dcab7={'where':_0x80bcbb[_0x1c4d('0x3f')]};return db[_0x1c4d('0x31')][_0x1c4d('0x20')](_0x5dcab7)[_0x1c4d('0x29')](function(_0x3f61be){_0x399676[_0x1c4d('0x20')]=_0x3f61be;if(_0x1b638d[_0x1c4d('0x37')][_0x1c4d('0x45')]){_0x80bcbb[_0x1c4d('0x46')]=[{'all':!![]}];}return db[_0x1c4d('0x31')][_0x1c4d('0x47')](_0x80bcbb);})[_0x1c4d('0x29')](function(_0x23d04e){_0x399676[_0x1c4d('0x48')]=_0x23d04e;return _0x399676;})[_0x1c4d('0x29')](respondWithFilteredResult(_0x1ff608,_0x80bcbb))['catch'](handleError(_0x1ff608,null));};exports['show']=function(_0x329a8d,_0x52ce99){var _0x2fbe8e={'raw':![],'where':{'id':_0x329a8d[_0x1c4d('0x49')]['id']}},_0x33be8e={};_0x33be8e[_0x1c4d('0x36')]=_[_0x1c4d('0x4a')](db[_0x1c4d('0x31')][_0x1c4d('0x32')]);_0x33be8e[_0x1c4d('0x37')]=_[_0x1c4d('0x4a')](_0x329a8d[_0x1c4d('0x37')]);_0x33be8e[_0x1c4d('0x38')]=_[_0x1c4d('0x39')](_0x33be8e[_0x1c4d('0x36')],_0x33be8e['query']);_0x2fbe8e[_0x1c4d('0x3a')]=_[_0x1c4d('0x39')](_0x33be8e[_0x1c4d('0x36')],qs['fields'](_0x329a8d[_0x1c4d('0x37')][_0x1c4d('0x3b')]));_0x2fbe8e[_0x1c4d('0x3a')]=_0x2fbe8e[_0x1c4d('0x3a')]['length']?_0x2fbe8e[_0x1c4d('0x3a')]:_0x33be8e[_0x1c4d('0x36')];if(_0x329a8d[_0x1c4d('0x37')]['includeAll']){_0x2fbe8e['include']=[{'all':!![]}];}_0x2fbe8e=_[_0x1c4d('0x42')]({},_0x2fbe8e,_0x329a8d[_0x1c4d('0x44')]);return db['VoicePrefix'][_0x1c4d('0x4b')](_0x2fbe8e)['then'](handleEntityNotFound(_0x52ce99,null))['then'](respondWithResult(_0x52ce99,null))['catch'](handleError(_0x52ce99,null));};exports[_0x1c4d('0x2a')]=function(_0xb7b6ea,_0x27fb5a){return db[_0x1c4d('0x31')]['find']({'where':{'id':_0xb7b6ea[_0x1c4d('0x49')]['id']}})[_0x1c4d('0x29')](handleEntityNotFound(_0x27fb5a,null))[_0x1c4d('0x29')](removeEntity(_0x27fb5a,null))[_0x1c4d('0x4c')](handleError(_0x27fb5a,null));};exports[_0x1c4d('0x4d')]=function(_0x41cf60,_0x4a2d5f){return db[_0x1c4d('0x31')][_0x1c4d('0x4d')]()[_0x1c4d('0x29')](respondWithResult(_0x4a2d5f,null))[_0x1c4d('0x4c')](handleError(_0x4a2d5f,null));};exports[_0x1c4d('0x4e')]=function(_0x17f12f,_0x126fd5){var _0x886192;return db['sequelize'][_0x1c4d('0x4f')](function(_0x2413c7){return db[_0x1c4d('0x31')][_0x1c4d('0x4e')](_0x17f12f[_0x1c4d('0x50')],{'transaction':_0x2413c7})[_0x1c4d('0x29')](function(_0x1f6ff6){_0x886192=_0x1f6ff6[_0x1c4d('0x2b')]({'plain':!![]});return db[_0x1c4d('0x51')][_0x1c4d('0x4b')]({'where':{'id':_0x886192[_0x1c4d('0x52')]},'raw':!![]})[_0x1c4d('0x29')](function(_0x41fcdd){return createVoicePrefixExtensions(_0x886192,_0x41fcdd,_0x2413c7);});});})[_0x1c4d('0x29')](function(){var _0x50f15f=_0x17f12f['user'][_0x1c4d('0x2b')]({'plain':!![]});if(!_0x50f15f)throw new Error(_0x1c4d('0x53'));if(_0x50f15f[_0x1c4d('0x54')]===_0x1c4d('0x55')){var _0x3c560c=_0x886192;return db[_0x1c4d('0x56')][_0x1c4d('0x4b')]({'where':{'name':_0x1c4d('0x2c'),'userProfileId':_0x50f15f[_0x1c4d('0x57')]},'raw':!![]})[_0x1c4d('0x29')](function(_0x826fcd){if(_0x826fcd&&_0x826fcd[_0x1c4d('0x58')]===0x0){return db['UserProfileResource'][_0x1c4d('0x4e')]({'name':_0x3c560c[_0x1c4d('0x2e')],'resourceId':_0x3c560c['id'],'type':_0x826fcd[_0x1c4d('0x2e')],'sectionId':_0x826fcd['id']},{})[_0x1c4d('0x29')](function(){return _0x886192;});}else{return _0x886192;}})[_0x1c4d('0x4c')](function(_0xa5c080){logger[_0x1c4d('0x59')](_0x1c4d('0x5a'),_0xa5c080);throw _0xa5c080;});}return _0x886192;})[_0x1c4d('0x29')](respondWithResult(_0x126fd5,null))['catch'](handleError(_0x126fd5,null));};function Extension(_0x288c83,_0x4e47c2,_0x1beb06,_0x3479af){this[_0x1c4d('0x5b')]='from-sip';this[_0x1c4d('0x5c')]=_0x288c83;this[_0x1c4d('0x5d')]=_0x1beb06;this[_0x1c4d('0x34')]=_0x1c4d('0x5e');this[_0x1c4d('0x5f')]='Voice\x20Prefix\x20Extension';this['priority']=_0x4e47c2;this[_0x1c4d('0x60')]=_0x3479af;}function createVoicePrefixExtensions(_0x52138c,_0x5086b3,_0x2ae948){return new BPromise(function(_0x187ced,_0x316d2d){var _0x25e3d5=new Extension(formatPrefixName(_0x52138c['prefix']),0x1,_0x1c4d('0x61'),_0x1c4d('0x62'));_0x25e3d5[_0x1c4d('0x63')]=_0x52138c['id'];return db['VoiceExtension'][_0x1c4d('0x4e')](_0x25e3d5,{'transaction':_0x2ae948})[_0x1c4d('0x29')](function(_0x40faf0){var _0x1ace1a=_0x40faf0[_0x1c4d('0x2b')]({'plain':!![]});var _0x23b58f=_[_0x1c4d('0x30')](addVoicePrefixExtensions(_0x52138c,_0x5086b3),function(_0x4d62c0){_0x4d62c0[_0x1c4d('0x52')]=_0x1ace1a['id'];_0x4d62c0['VoicePrefixId']=_0x52138c['id'];return _0x4d62c0;});return db[_0x1c4d('0x51')]['bulkCreate'](_0x23b58f,{'transaction':_0x2ae948})[_0x1c4d('0x29')](function(_0x55b582){if(!_0x55b582){return _0x316d2d(_0x1c4d('0x64'));}else{return _0x187ced(_0x55b582);}})['catch'](function(_0x4085c5){return _0x316d2d(_0x4085c5);});});;});};function addVoicePrefixExtensions(_0x1c75a4,_0x52eaa5){var _0x4743d4=[];var _0x13b0d7=formatPrefixName(_0x1c75a4[_0x1c4d('0x65')]);_0x4743d4['push'](new Extension(_0x13b0d7,0x2,'Set','CDR(prefix)='+_0x1c75a4['name']));if(_0x1c75a4['callerIdAll']){_0x4743d4[_0x1c4d('0x66')](new Extension(_0x13b0d7,0x3,_0x1c4d('0x67'),_0x1c4d('0x68')+_0x1c75a4[_0x1c4d('0x69')]));}else{_0x4743d4[_0x1c4d('0x66')](new Extension(_0x13b0d7,0x3,_0x1c4d('0x61'),'No\x20callerid\x20available'));}_0x4743d4[_0x1c4d('0x66')](new Extension(_0x13b0d7,0x4,_0x1c4d('0x6a'),_0x52eaa5[_0x1c4d('0x5b')]+','+'${EXTEN:'+(0x8+_0x1c75a4[_0x1c4d('0x2e')]['length'])+'}'+','+0x1));return _0x4743d4;}function formatPrefixName(_0xa008ae){var _0xdfb314='_';for(var _0x5960fe=0x0;_0x5960fe<_0xa008ae['length'];_0x5960fe++){if(_0xa008ae[_0x1c4d('0x6b')](_0x5960fe)=='-'){_0xdfb314+=_0xa008ae[_0x1c4d('0x6b')](_0x5960fe);}else{_0xdfb314+='['+_0xa008ae['charAt'](_0x5960fe)+']';}}_0xdfb314+='.';return _0xdfb314;}exports[_0x1c4d('0x28')]=function(_0x19ad08,_0x41cb7a,_0x5290c9){var _0x1dc79f=_0x19ad08[_0x1c4d('0x50')];_0x1dc79f[_0x1c4d('0x65')]='system-'+_0x1dc79f[_0x1c4d('0x2e')]+'-';return db['sequelize'][_0x1c4d('0x4f')](function(_0x1ae055){return db[_0x1c4d('0x31')][_0x1c4d('0x28')](_0x1dc79f,{'where':{'id':_0x1dc79f['id']},'transaction':_0x1ae055})[_0x1c4d('0x29')](function(){return db['VoiceExtension'][_0x1c4d('0x2a')]({'where':{'VoicePrefixId':_0x1dc79f['id']},'transaction':_0x1ae055})[_0x1c4d('0x29')](function(){return db['VoiceExtension'][_0x1c4d('0x4b')]({'where':{'id':_0x1dc79f[_0x1c4d('0x52')]},'raw':!![]})[_0x1c4d('0x29')](function(_0x2cbd54){return createVoicePrefixExtensions(_0x1dc79f,_0x2cbd54,_0x1ae055);});});});})[_0x1c4d('0x29')](function(){return db[_0x1c4d('0x31')][_0x1c4d('0x6c')](_0x1dc79f['id']);})['then'](respondWithResult(_0x41cb7a,null))['catch'](handleError(_0x41cb7a,null));};exports[_0x1c4d('0x6d')]=function(_0x30a204,_0x2bea50,_0x5564ac){return db['VoicePrefix'][_0x1c4d('0x4b')]({'where':{'id':_0x30a204[_0x1c4d('0x49')]['id']}})[_0x1c4d('0x29')](handleEntityNotFound(_0x2bea50,null))[_0x1c4d('0x29')](function(_0x52309c){if(_0x52309c){return _0x52309c[_0x1c4d('0x6d')](_0x30a204[_0x1c4d('0x50')][_0x1c4d('0x6e')],_[_0x1c4d('0x6f')](_0x30a204[_0x1c4d('0x50')],[_0x1c4d('0x6e'),'id'])||{})[_0x1c4d('0x70')](function(_0x210431){for(var _0x199a63=0x0;_0x199a63<_0x30a204[_0x1c4d('0x50')][_0x1c4d('0x6e')][_0x1c4d('0x3c')];_0x199a63+=0x1){socket['emit'](_0x1c4d('0x71'),{'UserId':_0x30a204[_0x1c4d('0x50')][_0x1c4d('0x6e')][_0x199a63],'VoicePrefixId':_0x30a204['params']['id']});}return _0x210431;});}})[_0x1c4d('0x29')](respondWithResult(_0x2bea50,null))[_0x1c4d('0x4c')](handleError(_0x2bea50,null));};exports[_0x1c4d('0x72')]=function(_0x4461b5,_0x4078a7,_0x3d59bf){return db[_0x1c4d('0x31')][_0x1c4d('0x4b')]({'where':{'id':_0x4461b5[_0x1c4d('0x49')]['id']}})[_0x1c4d('0x29')](handleEntityNotFound(_0x4078a7,null))[_0x1c4d('0x29')](function(_0x326d86){if(_0x326d86){return _0x326d86['removeAgents'](_0x4461b5[_0x1c4d('0x37')][_0x1c4d('0x6e')])[_0x1c4d('0x29')](function(){if(_[_0x1c4d('0x73')](_0x4461b5[_0x1c4d('0x37')][_0x1c4d('0x6e')])){for(var _0x6c5926=0x0;_0x6c5926<_0x4461b5['query'][_0x1c4d('0x6e')]['length'];_0x6c5926+=0x1){socket[_0x1c4d('0x74')](_0x1c4d('0x75'),{'UserId':Number(_0x4461b5[_0x1c4d('0x37')][_0x1c4d('0x6e')][_0x6c5926]),'VoicePrefixId':Number(_0x4461b5['params']['id'])});}}else{socket[_0x1c4d('0x74')](_0x1c4d('0x75'),{'UserId':Number(_0x4461b5[_0x1c4d('0x37')][_0x1c4d('0x6e')]),'VoicePrefixId':Number(_0x4461b5[_0x1c4d('0x49')]['id'])});}});}})[_0x1c4d('0x29')](respondWithStatusCode(_0x4078a7,null))[_0x1c4d('0x4c')](handleError(_0x4078a7,null));};exports[_0x1c4d('0x76')]=function(_0x3655ea,_0x3e6539,_0x46934e){var _0x141a94={};var _0x803fa8={};var _0x30b557;var _0x48529c;return db['VoicePrefix'][_0x1c4d('0x77')]({'where':{'id':_0x3655ea['params']['id']}})['then'](handleEntityNotFound(_0x3e6539,null))[_0x1c4d('0x29')](function(_0x7a0753){if(_0x7a0753){_0x30b557=_0x7a0753;_0x803fa8[_0x1c4d('0x36')]=_[_0x1c4d('0x4a')](db[_0x1c4d('0x78')]['rawAttributes']);_0x803fa8[_0x1c4d('0x37')]=_[_0x1c4d('0x4a')](_0x3655ea[_0x1c4d('0x37')]);_0x803fa8['filters']=_[_0x1c4d('0x39')](_0x803fa8[_0x1c4d('0x36')],_0x803fa8[_0x1c4d('0x37')]);_0x141a94[_0x1c4d('0x3a')]=_['intersection'](_0x803fa8['model'],qs['fields'](_0x3655ea[_0x1c4d('0x37')][_0x1c4d('0x3b')]));_0x141a94[_0x1c4d('0x3a')]=_0x141a94[_0x1c4d('0x3a')][_0x1c4d('0x3c')]?_0x141a94[_0x1c4d('0x3a')]:_0x803fa8['model'];_0x141a94[_0x1c4d('0x3d')]=qs[_0x1c4d('0x3e')](_0x3655ea['query']['sort']);_0x141a94[_0x1c4d('0x3f')]=qs['filters'](_[_0x1c4d('0x40')](_0x3655ea[_0x1c4d('0x37')],_0x803fa8[_0x1c4d('0x38')]));if(_0x3655ea[_0x1c4d('0x37')][_0x1c4d('0x41')]){_0x141a94[_0x1c4d('0x3f')]=_[_0x1c4d('0x42')](_0x141a94[_0x1c4d('0x3f')],{'$or':_[_0x1c4d('0x30')](_0x141a94[_0x1c4d('0x3a')],function(_0x5b180d){var _0xcc8b0={};_0xcc8b0[_0x5b180d]={'$like':'%'+_0x3655ea['query'][_0x1c4d('0x41')]+'%'};return _0xcc8b0;})});}_0x141a94=_[_0x1c4d('0x42')]({},_0x141a94,_0x3655ea[_0x1c4d('0x44')]);return _0x30b557[_0x1c4d('0x76')](_0x141a94);}})[_0x1c4d('0x29')](function(_0x444f86){if(_0x444f86){_0x48529c=_0x444f86[_0x1c4d('0x3c')];if(!_0x3655ea[_0x1c4d('0x37')]['hasOwnProperty'](_0x1c4d('0x79'))){_0x141a94[_0x1c4d('0x22')]=qs[_0x1c4d('0x22')](_0x3655ea[_0x1c4d('0x37')][_0x1c4d('0x22')]);_0x141a94['offset']=qs[_0x1c4d('0x21')](_0x3655ea[_0x1c4d('0x37')]['offset']);}return _0x30b557['getAgents'](_0x141a94);}})[_0x1c4d('0x29')](function(_0x1382ea){if(_0x1382ea){return _0x1382ea?{'count':_0x48529c,'rows':_0x1382ea}:null;}})[_0x1c4d('0x29')](respondWithResult(_0x3e6539,null))['catch'](handleError(_0x3e6539,null));}; \ No newline at end of file +var _0x6a5c=['moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','VIRTUAL','filter','merge','options','VoicePrefix','include','findAll','rows','catch','show','params','includeAll','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','nolimit','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0xa45acd,_0x4c8b04){var _0x91e4ab=function(_0x232151){while(--_0x232151){_0xa45acd['push'](_0xa45acd['shift']());}};_0x91e4ab(++_0x4c8b04);}(_0x6a5c,0x76));var _0xc6a5=function(_0x35468d,_0x2a7240){_0x35468d=_0x35468d-0x0;var _0x30da52=_0x6a5c[_0x35468d];return _0x30da52;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc6a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6a5('0x1'));var jsonpatch=require(_0xc6a5('0x2'));var rp=require(_0xc6a5('0x3'));var moment=require(_0xc6a5('0x4'));var BPromise=require(_0xc6a5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc6a5('0x6'));var sox=require('sox');var csv=require(_0xc6a5('0x7'));var ejs=require(_0xc6a5('0x8'));var fs=require('fs');var _=require(_0xc6a5('0x9'));var squel=require(_0xc6a5('0xa'));var crypto=require(_0xc6a5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc6a5('0xc'));var toCsv=require(_0xc6a5('0x7'));var querystring=require(_0xc6a5('0xd'));var Papa=require(_0xc6a5('0xe'));var Redis=require(_0xc6a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc6a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6a5('0x11'))(_0xc6a5('0x12'));var utils=require(_0xc6a5('0x13'));var config=require(_0xc6a5('0x14'));var db=require(_0xc6a5('0x15'))['db'];config[_0xc6a5('0x16')]=_[_0xc6a5('0x17')](config[_0xc6a5('0x16')],{'host':_0xc6a5('0x18'),'port':0x18eb});var socket=require(_0xc6a5('0x19'))(new Redis(config[_0xc6a5('0x16')]));require(_0xc6a5('0x1a'))[_0xc6a5('0x1b')](socket);function respondWithStatusCode(_0x5a3c12,_0x2195b7){_0x2195b7=_0x2195b7||0xcc;return function(_0x497b65){if(_0x497b65){return _0x5a3c12[_0xc6a5('0x1c')](_0x2195b7);}return _0x5a3c12['status'](_0x2195b7)[_0xc6a5('0x1d')]();};}function respondWithResult(_0x11b692,_0xa3659c){_0xa3659c=_0xa3659c||0xc8;return function(_0x573192){if(_0x573192){return _0x11b692[_0xc6a5('0x1e')](_0xa3659c)[_0xc6a5('0x1f')](_0x573192);}};}function respondWithFilteredResult(_0x240654,_0x4be12f){return function(_0x7ac3b5){if(_0x7ac3b5){var _0x875fcf=_0x7ac3b5[_0xc6a5('0x20')],_0x5ba0e8=_0x4be12f['offset'],_0x15c60a=_0x4be12f[_0xc6a5('0x21')]+_0x4be12f[_0xc6a5('0x22')],_0x44e957;if(_0x15c60a>=_0x875fcf){_0x15c60a=_0x875fcf;_0x44e957=0xc8;}else{_0x44e957=0xce;}_0x240654[_0xc6a5('0x1e')](_0x44e957);return _0x240654['set'](_0xc6a5('0x23'),_0x5ba0e8+'-'+_0x15c60a+'/'+_0x875fcf)['json'](_0x7ac3b5);}return null;};}function patchUpdates(_0x1cfac4){return function(_0xd0dc2a){try{jsonpatch[_0xc6a5('0x24')](_0xd0dc2a,_0x1cfac4,!![]);}catch(_0x82127b){return BPromise[_0xc6a5('0x25')](_0x82127b);}return _0xd0dc2a[_0xc6a5('0x26')]();};}function saveUpdates(_0x33087a,_0x3a95da){return function(_0x26e89c){if(_0x26e89c){return _0x26e89c[_0xc6a5('0x27')](_0x33087a)[_0xc6a5('0x28')](function(_0x11f1e1){return _0x11f1e1;});}return null;};}function removeEntity(_0x3bbb4b,_0x471a6a){return function(_0x499e43){if(_0x499e43){return _0x499e43['destroy']()[_0xc6a5('0x28')](function(){var _0x2f6c8e=_0x499e43[_0xc6a5('0x29')]({'plain':!![]});var _0x5e5502=_0xc6a5('0x2a');return db['UserProfileResource'][_0xc6a5('0x2b')]({'where':{'type':_0x5e5502,'resourceId':_0x2f6c8e['id']}})[_0xc6a5('0x28')](function(){return _0x499e43;});})[_0xc6a5('0x28')](function(){_0x3bbb4b[_0xc6a5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x347ac6,_0x1c404c){return function(_0x43a80e){if(!_0x43a80e){_0x347ac6[_0xc6a5('0x1c')](0x194);}return _0x43a80e;};}function handleError(_0x46dbbd,_0x280c57){_0x280c57=_0x280c57||0x1f4;return function(_0x3de854){logger[_0xc6a5('0x2c')](_0x3de854[_0xc6a5('0x2d')]);if(_0x3de854[_0xc6a5('0x2e')]){delete _0x3de854[_0xc6a5('0x2e')];}_0x46dbbd[_0xc6a5('0x1e')](_0x280c57)[_0xc6a5('0x2f')](_0x3de854);};}exports[_0xc6a5('0x30')]=function(_0x12508e,_0x59a8c3){var _0x3e3459={},_0x243779={},_0x554a8d={'count':0x0,'rows':[]};var _0xb41df1=_[_0xc6a5('0x31')](db['VoicePrefix'][_0xc6a5('0x32')],function(_0x369f4e){return{'name':_0x369f4e['fieldName'],'type':_0x369f4e[_0xc6a5('0x33')]['key']};});_0x243779[_0xc6a5('0x34')]=_[_0xc6a5('0x31')](_0xb41df1,'name');_0x243779[_0xc6a5('0x35')]=_[_0xc6a5('0x36')](_0x12508e[_0xc6a5('0x35')]);_0x243779[_0xc6a5('0x37')]=_[_0xc6a5('0x38')](_0x243779['model'],_0x243779[_0xc6a5('0x35')]);_0x3e3459[_0xc6a5('0x39')]=_[_0xc6a5('0x38')](_0x243779[_0xc6a5('0x34')],qs[_0xc6a5('0x3a')](_0x12508e[_0xc6a5('0x35')][_0xc6a5('0x3a')]));_0x3e3459['attributes']=_0x3e3459[_0xc6a5('0x39')][_0xc6a5('0x3b')]?_0x3e3459[_0xc6a5('0x39')]:_0x243779[_0xc6a5('0x34')];if(!_0x12508e[_0xc6a5('0x35')][_0xc6a5('0x3c')]('nolimit')){_0x3e3459['limit']=qs[_0xc6a5('0x22')](_0x12508e[_0xc6a5('0x35')][_0xc6a5('0x22')]);_0x3e3459['offset']=qs[_0xc6a5('0x21')](_0x12508e['query'][_0xc6a5('0x21')]);}_0x3e3459['order']=qs[_0xc6a5('0x3d')](_0x12508e[_0xc6a5('0x35')][_0xc6a5('0x3d')]);_0x3e3459['where']=qs['filters'](_[_0xc6a5('0x3e')](_0x12508e[_0xc6a5('0x35')],_0x243779[_0xc6a5('0x37')]),_0xb41df1);if(_0x12508e['query']['filter']){_0x3e3459['where']=_['merge'](_0x3e3459[_0xc6a5('0x3f')],{'$or':_[_0xc6a5('0x31')](_0xb41df1,function(_0x563984){if(_0x563984[_0xc6a5('0x33')]!==_0xc6a5('0x40')){var _0x1d0982={};_0x1d0982[_0x563984[_0xc6a5('0x2e')]]={'$like':'%'+_0x12508e['query'][_0xc6a5('0x41')]+'%'};return _0x1d0982;}})});}_0x3e3459=_[_0xc6a5('0x42')]({},_0x3e3459,_0x12508e[_0xc6a5('0x43')]);var _0x19ab18={'where':_0x3e3459['where']};return db[_0xc6a5('0x44')][_0xc6a5('0x20')](_0x19ab18)['then'](function(_0x9c501a){_0x554a8d[_0xc6a5('0x20')]=_0x9c501a;if(_0x12508e[_0xc6a5('0x35')]['includeAll']){_0x3e3459[_0xc6a5('0x45')]=[{'all':!![]}];}return db[_0xc6a5('0x44')][_0xc6a5('0x46')](_0x3e3459);})[_0xc6a5('0x28')](function(_0x1f7668){_0x554a8d[_0xc6a5('0x47')]=_0x1f7668;return _0x554a8d;})['then'](respondWithFilteredResult(_0x59a8c3,_0x3e3459))[_0xc6a5('0x48')](handleError(_0x59a8c3,null));};exports[_0xc6a5('0x49')]=function(_0x3e85f7,_0xd4e79){var _0x2869b7={'raw':![],'where':{'id':_0x3e85f7[_0xc6a5('0x4a')]['id']}},_0x659823={};_0x659823[_0xc6a5('0x34')]=_[_0xc6a5('0x36')](db['VoicePrefix'][_0xc6a5('0x32')]);_0x659823[_0xc6a5('0x35')]=_['keys'](_0x3e85f7[_0xc6a5('0x35')]);_0x659823[_0xc6a5('0x37')]=_[_0xc6a5('0x38')](_0x659823['model'],_0x659823['query']);_0x2869b7[_0xc6a5('0x39')]=_[_0xc6a5('0x38')](_0x659823[_0xc6a5('0x34')],qs[_0xc6a5('0x3a')](_0x3e85f7['query'][_0xc6a5('0x3a')]));_0x2869b7[_0xc6a5('0x39')]=_0x2869b7[_0xc6a5('0x39')][_0xc6a5('0x3b')]?_0x2869b7[_0xc6a5('0x39')]:_0x659823[_0xc6a5('0x34')];if(_0x3e85f7[_0xc6a5('0x35')][_0xc6a5('0x4b')]){_0x2869b7[_0xc6a5('0x45')]=[{'all':!![]}];}_0x2869b7=_[_0xc6a5('0x42')]({},_0x2869b7,_0x3e85f7['options']);return db['VoicePrefix'][_0xc6a5('0x4c')](_0x2869b7)['then'](handleEntityNotFound(_0xd4e79,null))[_0xc6a5('0x28')](respondWithResult(_0xd4e79,null))[_0xc6a5('0x48')](handleError(_0xd4e79,null));};exports['destroy']=function(_0x1acce6,_0x4fbace){return db[_0xc6a5('0x44')][_0xc6a5('0x4c')]({'where':{'id':_0x1acce6[_0xc6a5('0x4a')]['id']}})[_0xc6a5('0x28')](handleEntityNotFound(_0x4fbace,null))[_0xc6a5('0x28')](removeEntity(_0x4fbace,null))[_0xc6a5('0x48')](handleError(_0x4fbace,null));};exports[_0xc6a5('0x4d')]=function(_0x1730fc,_0x437f0b){return db[_0xc6a5('0x44')][_0xc6a5('0x4d')]()[_0xc6a5('0x28')](respondWithResult(_0x437f0b,null))['catch'](handleError(_0x437f0b,null));};exports[_0xc6a5('0x4e')]=function(_0x6c0b6b,_0x2496c2){var _0x2bd64c;return db[_0xc6a5('0x4f')][_0xc6a5('0x50')](function(_0x1c68d6){return db[_0xc6a5('0x44')][_0xc6a5('0x4e')](_0x6c0b6b['body'],{'transaction':_0x1c68d6})[_0xc6a5('0x28')](function(_0x3b8deb){_0x2bd64c=_0x3b8deb['get']({'plain':!![]});return db[_0xc6a5('0x51')][_0xc6a5('0x4c')]({'where':{'id':_0x2bd64c[_0xc6a5('0x52')]},'raw':!![]})[_0xc6a5('0x28')](function(_0x4d8e71){return createVoicePrefixExtensions(_0x2bd64c,_0x4d8e71,_0x1c68d6);});});})['then'](function(){var _0x2a798c=_0x6c0b6b[_0xc6a5('0x53')][_0xc6a5('0x29')]({'plain':!![]});if(!_0x2a798c)throw new Error(_0xc6a5('0x54'));if(_0x2a798c['role']==='user'){var _0x160f70=_0x2bd64c;return db['UserProfileSection']['find']({'where':{'name':_0xc6a5('0x2a'),'userProfileId':_0x2a798c[_0xc6a5('0x55')]},'raw':!![]})[_0xc6a5('0x28')](function(_0x522741){if(_0x522741&&_0x522741[_0xc6a5('0x56')]===0x0){return db[_0xc6a5('0x57')][_0xc6a5('0x4e')]({'name':_0x160f70['name'],'resourceId':_0x160f70['id'],'type':_0x522741['name'],'sectionId':_0x522741['id']},{})[_0xc6a5('0x28')](function(){return _0x2bd64c;});}else{return _0x2bd64c;}})[_0xc6a5('0x48')](function(_0x276829){logger[_0xc6a5('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x276829);throw _0x276829;});}return _0x2bd64c;})[_0xc6a5('0x28')](respondWithResult(_0x2496c2,null))[_0xc6a5('0x48')](handleError(_0x2496c2,null));};function Extension(_0x113e43,_0x3ac204,_0x2e4950,_0x45b078){this[_0xc6a5('0x58')]=_0xc6a5('0x59');this[_0xc6a5('0x5a')]=_0x113e43;this['app']=_0x2e4950;this['type']=_0xc6a5('0x5b');this[_0xc6a5('0x5c')]=_0xc6a5('0x5d');this['priority']=_0x3ac204;this[_0xc6a5('0x5e')]=_0x45b078;}function createVoicePrefixExtensions(_0x1651ab,_0x2d4265,_0x171c4b){return new BPromise(function(_0x101663,_0x529862){var _0x3cb5f9=new Extension(formatPrefixName(_0x1651ab[_0xc6a5('0x5f')]),0x1,_0xc6a5('0x60'),_0xc6a5('0x61'));_0x3cb5f9[_0xc6a5('0x62')]=_0x1651ab['id'];return db[_0xc6a5('0x51')][_0xc6a5('0x4e')](_0x3cb5f9,{'transaction':_0x171c4b})[_0xc6a5('0x28')](function(_0x16ffca){var _0x10fa32=_0x16ffca[_0xc6a5('0x29')]({'plain':!![]});var _0x26b9d9=_[_0xc6a5('0x31')](addVoicePrefixExtensions(_0x1651ab,_0x2d4265),function(_0x31795a){_0x31795a[_0xc6a5('0x52')]=_0x10fa32['id'];_0x31795a['VoicePrefixId']=_0x1651ab['id'];return _0x31795a;});return db['VoiceExtension'][_0xc6a5('0x63')](_0x26b9d9,{'transaction':_0x171c4b})['then'](function(_0x4db184){if(!_0x4db184){return _0x529862(_0xc6a5('0x64'));}else{return _0x101663(_0x4db184);}})[_0xc6a5('0x48')](function(_0x32b2e2){return _0x529862(_0x32b2e2);});});;});};function addVoicePrefixExtensions(_0x20dcca,_0x26fce0){var _0x117b55=[];var _0x2bc22f=formatPrefixName(_0x20dcca[_0xc6a5('0x5f')]);_0x117b55[_0xc6a5('0x65')](new Extension(_0x2bc22f,0x2,_0xc6a5('0x66'),_0xc6a5('0x67')+_0x20dcca['name']));if(_0x20dcca['callerIdAll']){_0x117b55[_0xc6a5('0x65')](new Extension(_0x2bc22f,0x3,_0xc6a5('0x66'),'PREFIX-CALLERIDALL='+_0x20dcca['callerIdAll']));}else{_0x117b55[_0xc6a5('0x65')](new Extension(_0x2bc22f,0x3,_0xc6a5('0x60'),'No\x20callerid\x20available'));}_0x117b55[_0xc6a5('0x65')](new Extension(_0x2bc22f,0x4,'goto',_0x26fce0['context']+','+_0xc6a5('0x68')+(0x8+_0x20dcca[_0xc6a5('0x2e')]['length'])+'}'+','+0x1));return _0x117b55;}function formatPrefixName(_0x2b940b){var _0x1127d6='_';for(var _0x5d5cd6=0x0;_0x5d5cd6<_0x2b940b[_0xc6a5('0x3b')];_0x5d5cd6++){if(_0x2b940b['charAt'](_0x5d5cd6)=='-'){_0x1127d6+=_0x2b940b[_0xc6a5('0x69')](_0x5d5cd6);}else{_0x1127d6+='['+_0x2b940b[_0xc6a5('0x69')](_0x5d5cd6)+']';}}_0x1127d6+='.';return _0x1127d6;}exports[_0xc6a5('0x27')]=function(_0x51cf1d,_0x3771aa,_0x11208a){var _0x47d77e=_0x51cf1d[_0xc6a5('0x6a')];_0x47d77e[_0xc6a5('0x5f')]=_0xc6a5('0x6b')+_0x47d77e[_0xc6a5('0x2e')]+'-';return db[_0xc6a5('0x4f')][_0xc6a5('0x50')](function(_0x31b2e2){return db[_0xc6a5('0x44')][_0xc6a5('0x27')](_0x47d77e,{'where':{'id':_0x47d77e['id']},'transaction':_0x31b2e2})[_0xc6a5('0x28')](function(){return db[_0xc6a5('0x51')][_0xc6a5('0x2b')]({'where':{'VoicePrefixId':_0x47d77e['id']},'transaction':_0x31b2e2})[_0xc6a5('0x28')](function(){return db[_0xc6a5('0x51')][_0xc6a5('0x4c')]({'where':{'id':_0x47d77e[_0xc6a5('0x52')]},'raw':!![]})['then'](function(_0xdc230d){return createVoicePrefixExtensions(_0x47d77e,_0xdc230d,_0x31b2e2);});});});})[_0xc6a5('0x28')](function(){return db[_0xc6a5('0x44')][_0xc6a5('0x6c')](_0x47d77e['id']);})[_0xc6a5('0x28')](respondWithResult(_0x3771aa,null))['catch'](handleError(_0x3771aa,null));};exports[_0xc6a5('0x6d')]=function(_0x2ed1f7,_0x54eddd,_0x3172e1){return db[_0xc6a5('0x44')][_0xc6a5('0x4c')]({'where':{'id':_0x2ed1f7['params']['id']}})[_0xc6a5('0x28')](handleEntityNotFound(_0x54eddd,null))[_0xc6a5('0x28')](function(_0x16410d){if(_0x16410d){return _0x16410d[_0xc6a5('0x6d')](_0x2ed1f7[_0xc6a5('0x6a')][_0xc6a5('0x6e')],_[_0xc6a5('0x6f')](_0x2ed1f7[_0xc6a5('0x6a')],['ids','id'])||{})['spread'](function(_0x9af71e){for(var _0x4d228b=0x0;_0x4d228b<_0x2ed1f7['body'][_0xc6a5('0x6e')][_0xc6a5('0x3b')];_0x4d228b+=0x1){socket[_0xc6a5('0x70')](_0xc6a5('0x71'),{'UserId':_0x2ed1f7[_0xc6a5('0x6a')][_0xc6a5('0x6e')][_0x4d228b],'VoicePrefixId':_0x2ed1f7[_0xc6a5('0x4a')]['id']});}return _0x9af71e;});}})[_0xc6a5('0x28')](respondWithResult(_0x54eddd,null))['catch'](handleError(_0x54eddd,null));};exports[_0xc6a5('0x72')]=function(_0x4d1e58,_0x444648,_0x87afbd){return db[_0xc6a5('0x44')][_0xc6a5('0x4c')]({'where':{'id':_0x4d1e58[_0xc6a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x444648,null))[_0xc6a5('0x28')](function(_0x11436b){if(_0x11436b){return _0x11436b[_0xc6a5('0x72')](_0x4d1e58[_0xc6a5('0x35')][_0xc6a5('0x6e')])[_0xc6a5('0x28')](function(){if(_[_0xc6a5('0x73')](_0x4d1e58[_0xc6a5('0x35')][_0xc6a5('0x6e')])){for(var _0x33e111=0x0;_0x33e111<_0x4d1e58[_0xc6a5('0x35')]['ids'][_0xc6a5('0x3b')];_0x33e111+=0x1){socket[_0xc6a5('0x70')](_0xc6a5('0x74'),{'UserId':Number(_0x4d1e58[_0xc6a5('0x35')][_0xc6a5('0x6e')][_0x33e111]),'VoicePrefixId':Number(_0x4d1e58[_0xc6a5('0x4a')]['id'])});}}else{socket[_0xc6a5('0x70')](_0xc6a5('0x74'),{'UserId':Number(_0x4d1e58[_0xc6a5('0x35')][_0xc6a5('0x6e')]),'VoicePrefixId':Number(_0x4d1e58[_0xc6a5('0x4a')]['id'])});}});}})[_0xc6a5('0x28')](respondWithStatusCode(_0x444648,null))[_0xc6a5('0x48')](handleError(_0x444648,null));};exports[_0xc6a5('0x75')]=function(_0x3e81bb,_0x7dc1bc,_0x18dc38){var _0x3f41ce={};var _0x27781a={};var _0x3ea507;var _0x473d9c;return db[_0xc6a5('0x44')][_0xc6a5('0x76')]({'where':{'id':_0x3e81bb[_0xc6a5('0x4a')]['id']}})[_0xc6a5('0x28')](handleEntityNotFound(_0x7dc1bc,null))['then'](function(_0x2b6a9f){if(_0x2b6a9f){_0x3ea507=_0x2b6a9f;_0x27781a[_0xc6a5('0x34')]=_['keys'](db[_0xc6a5('0x77')][_0xc6a5('0x32')]);_0x27781a[_0xc6a5('0x35')]=_[_0xc6a5('0x36')](_0x3e81bb[_0xc6a5('0x35')]);_0x27781a['filters']=_['intersection'](_0x27781a[_0xc6a5('0x34')],_0x27781a[_0xc6a5('0x35')]);_0x3f41ce[_0xc6a5('0x39')]=_[_0xc6a5('0x38')](_0x27781a[_0xc6a5('0x34')],qs['fields'](_0x3e81bb[_0xc6a5('0x35')][_0xc6a5('0x3a')]));_0x3f41ce[_0xc6a5('0x39')]=_0x3f41ce[_0xc6a5('0x39')]['length']?_0x3f41ce['attributes']:_0x27781a[_0xc6a5('0x34')];_0x3f41ce[_0xc6a5('0x78')]=qs[_0xc6a5('0x3d')](_0x3e81bb['query'][_0xc6a5('0x3d')]);_0x3f41ce[_0xc6a5('0x3f')]=qs[_0xc6a5('0x37')](_['pick'](_0x3e81bb[_0xc6a5('0x35')],_0x27781a[_0xc6a5('0x37')]));if(_0x3e81bb[_0xc6a5('0x35')][_0xc6a5('0x41')]){_0x3f41ce[_0xc6a5('0x3f')]=_[_0xc6a5('0x42')](_0x3f41ce[_0xc6a5('0x3f')],{'$or':_[_0xc6a5('0x31')](_0x3f41ce['attributes'],function(_0x19dace){var _0x3f9275={};_0x3f9275[_0x19dace]={'$like':'%'+_0x3e81bb['query']['filter']+'%'};return _0x3f9275;})});}_0x3f41ce=_[_0xc6a5('0x42')]({},_0x3f41ce,_0x3e81bb[_0xc6a5('0x43')]);return _0x3ea507[_0xc6a5('0x75')](_0x3f41ce);}})[_0xc6a5('0x28')](function(_0xee8e5){if(_0xee8e5){_0x473d9c=_0xee8e5[_0xc6a5('0x3b')];if(!_0x3e81bb[_0xc6a5('0x35')]['hasOwnProperty'](_0xc6a5('0x79'))){_0x3f41ce[_0xc6a5('0x22')]=qs[_0xc6a5('0x22')](_0x3e81bb['query']['limit']);_0x3f41ce['offset']=qs[_0xc6a5('0x21')](_0x3e81bb[_0xc6a5('0x35')][_0xc6a5('0x21')]);}return _0x3ea507[_0xc6a5('0x75')](_0x3f41ce);}})[_0xc6a5('0x28')](function(_0x2e6a82){if(_0x2e6a82){return _0x2e6a82?{'count':_0x473d9c,'rows':_0x2e6a82}:null;}})[_0xc6a5('0x28')](respondWithResult(_0x7dc1bc,null))['catch'](handleError(_0x7dc1bc,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index cfc664f..4898d82 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 _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x4ac085,_0x15e331){var _0x7bfc6e=function(_0x38f222){while(--_0x38f222){_0x4ac085['push'](_0x4ac085['shift']());}};_0x7bfc6e(++_0x15e331);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0xcb91[_0x421196];return _0x2738af;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x3b3ca5,_0x294c71){var _0x168567=function(_0x2b4066){while(--_0x2b4066){_0x3b3ca5['push'](_0x3b3ca5['shift']());}};_0x168567(++_0x294c71);}(_0x008c,0x188));var _0xc008=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x008c[_0xbec8e6];return _0x4aa6f2;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 4eedeb2..58a5d37 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 _0xde6d=['voice_prefixes','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x2ddfa0,_0x185f5a){var _0x24c216=function(_0x1c4157){while(--_0x1c4157){_0x2ddfa0['push'](_0x2ddfa0['shift']());}};_0x24c216(++_0x185f5a);}(_0xde6d,0x6f));var _0xdde6=function(_0x3298e4,_0x32191f){_0x3298e4=_0x3298e4-0x0;var _0x336ec1=_0xde6d[_0x3298e4];return _0x336ec1;};'use strict';var _=require('lodash');var util=require(_0xdde6('0x0'));var logger=require(_0xdde6('0x1'))(_0xdde6('0x2'));var moment=require('moment');var BPromise=require(_0xdde6('0x3'));var rp=require(_0xdde6('0x4'));var fs=require('fs');var path=require(_0xdde6('0x5'));var rimraf=require(_0xdde6('0x6'));var config=require(_0xdde6('0x7'));var attributes=require(_0xdde6('0x8'));module[_0xdde6('0x9')]=function(_0x48d6dd,_0x36b652){return _0x48d6dd['define']('VoicePrefix',attributes,{'tableName':_0xdde6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9075=['exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x1c9cfb,_0x4efc3b){var _0x32436a=function(_0x6836da){while(--_0x6836da){_0x1c9cfb['push'](_0x1c9cfb['shift']());}};_0x32436a(++_0x4efc3b);}(_0x9075,0x154));var _0x5907=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x9075[_0x35a140];return _0x30ab82;};'use strict';var _=require(_0x5907('0x0'));var util=require('util');var logger=require(_0x5907('0x1'))(_0x5907('0x2'));var moment=require(_0x5907('0x3'));var BPromise=require(_0x5907('0x4'));var rp=require(_0x5907('0x5'));var fs=require('fs');var path=require(_0x5907('0x6'));var rimraf=require(_0x5907('0x7'));var config=require(_0x5907('0x8'));var attributes=require(_0x5907('0x9'));module[_0x5907('0xa')]=function(_0x5e3035,_0x3d2ff2){return _0x5e3035[_0x5907('0xb')](_0x5907('0xc'),attributes,{'tableName':_0x5907('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 2bdc4c2..a9d076d 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 _0x7136=['register','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket'];(function(_0x14a79d,_0xcdc4b9){var _0x25eead=function(_0xca7339){while(--_0xca7339){_0x14a79d['push'](_0x14a79d['shift']());}};_0x25eead(++_0xcdc4b9);}(_0x7136,0x1c0));var _0x6713=function(_0xf22003,_0x4daaad){_0xf22003=_0xf22003-0x0;var _0x1af727=_0x7136[_0xf22003];return _0x1af727;};'use strict';var _=require(_0x6713('0x0'));var util=require(_0x6713('0x1'));var moment=require(_0x6713('0x2'));var BPromise=require('bluebird');var rs=require(_0x6713('0x3'));var fs=require('fs');var Redis=require(_0x6713('0x4'));var db=require(_0x6713('0x5'))['db'];var utils=require(_0x6713('0x6'));var logger=require('../../config/logger')(_0x6713('0x7'));var config=require(_0x6713('0x8'));var jayson=require(_0x6713('0x9'));var client=jayson[_0x6713('0xa')][_0x6713('0xb')]({'port':0x232a});config[_0x6713('0xc')]=_[_0x6713('0xd')](config[_0x6713('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6713('0xe'))(new Redis(config[_0x6713('0xc')]));require(_0x6713('0xf'))[_0x6713('0x10')](socket);function respondWithRpcPromise(_0x5d431f,_0x28060c,_0x56351f){return new BPromise(function(_0x4b49bc,_0x4024ec){return client['request'](_0x5d431f,_0x56351f)[_0x6713('0x11')](function(_0x570cb9){logger[_0x6713('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x28060c,_0x6713('0x13'));logger[_0x6713('0x14')](_0x6713('0x15'),_0x28060c,_0x6713('0x13'),JSON[_0x6713('0x16')](_0x570cb9));if(_0x570cb9[_0x6713('0x17')]){if(_0x570cb9[_0x6713('0x17')][_0x6713('0x18')]===0x1f4){logger['error'](_0x6713('0x19'),_0x28060c,_0x570cb9[_0x6713('0x17')]['message']);return _0x4024ec(_0x570cb9[_0x6713('0x17')][_0x6713('0x1a')]);}logger[_0x6713('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x28060c,_0x570cb9[_0x6713('0x17')][_0x6713('0x1a')]);return _0x4b49bc(_0x570cb9[_0x6713('0x17')][_0x6713('0x1a')]);}else{logger[_0x6713('0x12')](_0x6713('0x19'),_0x28060c,_0x6713('0x13'));_0x4b49bc(_0x570cb9[_0x6713('0x1b')][_0x6713('0x1a')]);}})[_0x6713('0x1c')](function(_0x4ae59a){logger[_0x6713('0x17')](_0x6713('0x19'),_0x28060c,_0x4ae59a);_0x4024ec(_0x4ae59a);});});} \ No newline at end of file +var _0xe5fd=['http','redis','defaults','localhost','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5fd,0x161));var _0xde5f=function(_0x146831,_0x4ca380){_0x146831=_0x146831-0x0;var _0x21cc9b=_0xe5fd[_0x146831];return _0x21cc9b;};'use strict';var _=require(_0xde5f('0x0'));var util=require(_0xde5f('0x1'));var moment=require('moment');var BPromise=require(_0xde5f('0x2'));var rs=require(_0xde5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde5f('0x4'))['db'];var utils=require(_0xde5f('0x5'));var logger=require(_0xde5f('0x6'))(_0xde5f('0x7'));var config=require(_0xde5f('0x8'));var jayson=require(_0xde5f('0x9'));var client=jayson[_0xde5f('0xa')][_0xde5f('0xb')]({'port':0x232a});config[_0xde5f('0xc')]=_[_0xde5f('0xd')](config[_0xde5f('0xc')],{'host':_0xde5f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde5f('0xc')]));require(_0xde5f('0xf'))['register'](socket);function respondWithRpcPromise(_0x579462,_0x2e7d66,_0x2355e8){return new BPromise(function(_0x541728,_0x21cd59){return client[_0xde5f('0x10')](_0x579462,_0x2355e8)['then'](function(_0x277376){logger[_0xde5f('0x11')](_0xde5f('0x12'),_0x2e7d66,'request\x20sent');logger[_0xde5f('0x13')](_0xde5f('0x14'),_0x2e7d66,'request\x20sent',JSON[_0xde5f('0x15')](_0x277376));if(_0x277376[_0xde5f('0x16')]){if(_0x277376['error'][_0xde5f('0x17')]===0x1f4){logger[_0xde5f('0x16')](_0xde5f('0x12'),_0x2e7d66,_0x277376[_0xde5f('0x16')][_0xde5f('0x18')]);return _0x21cd59(_0x277376[_0xde5f('0x16')][_0xde5f('0x18')]);}logger[_0xde5f('0x16')](_0xde5f('0x12'),_0x2e7d66,_0x277376[_0xde5f('0x16')][_0xde5f('0x18')]);return _0x541728(_0x277376[_0xde5f('0x16')]['message']);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2e7d66,_0xde5f('0x19'));_0x541728(_0x277376[_0xde5f('0x1a')]['message']);}})[_0xde5f('0x1b')](function(_0x5d6680){logger[_0xde5f('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2e7d66,_0x5d6680);_0x21cd59(_0x5d6680);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b258aa4..9207d64 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 _0x29f9=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x1ba9f6,_0x2f88ed){var _0x3de66d=function(_0x222680){while(--_0x222680){_0x1ba9f6['push'](_0x1ba9f6['shift']());}};_0x3de66d(++_0x2f88ed);}(_0x29f9,0x6c));var _0x929f=function(_0x2c6ef0,_0x4fe18e){_0x2c6ef0=_0x2c6ef0-0x0;var _0x3f52e=_0x29f9[_0x2c6ef0];return _0x3f52e;};'use strict';var VoicePrefixEvents=require(_0x929f('0x0'));var events=[_0x929f('0x1'),_0x929f('0x2'),_0x929f('0x3')];function createListener(_0x4ba622,_0xc28df8){return function(_0x5b692a){_0xc28df8[_0x929f('0x4')](_0x4ba622,_0x5b692a);};}function removeListener(_0x524058,_0x35b047){return function(){VoicePrefixEvents[_0x929f('0x5')](_0x524058,_0x35b047);};}exports[_0x929f('0x6')]=function(_0x4dd007){for(var _0x172dbf=0x0,_0x1e6888=events[_0x929f('0x7')];_0x172dbf<_0x1e6888;_0x172dbf++){var _0x30b9c2=events[_0x172dbf];var _0x54769e=createListener(_0x929f('0x8')+_0x30b9c2,_0x4dd007);VoicePrefixEvents['on'](_0x30b9c2,_0x54769e);}}; \ No newline at end of file +var _0x022a=['register','voicePrefix:','./voicePrefix.events','save','update','emit','removeListener'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0x022a,0x167));var _0xa022=function(_0x3fc287,_0x5c3f36){_0x3fc287=_0x3fc287-0x0;var _0x33af9f=_0x022a[_0x3fc287];return _0x33af9f;};'use strict';var VoicePrefixEvents=require(_0xa022('0x0'));var events=[_0xa022('0x1'),'remove',_0xa022('0x2')];function createListener(_0x556fa8,_0x4bab30){return function(_0x1cad0a){_0x4bab30[_0xa022('0x3')](_0x556fa8,_0x1cad0a);};}function removeListener(_0x3da026,_0x325cc1){return function(){VoicePrefixEvents[_0xa022('0x4')](_0x3da026,_0x325cc1);};}exports[_0xa022('0x5')]=function(_0x232a0a){for(var _0x29cd2b=0x0,_0x3a6d6c=events['length'];_0x29cd2b<_0x3a6d6c;_0x29cd2b++){var _0x14ae93=events[_0x29cd2b];var _0x4b9322=createListener(_0xa022('0x6')+_0x14ae93,_0x232a0a);VoicePrefixEvents['on'](_0x14ae93,_0x4b9322);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ee4cec8..9dd444d 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 _0x19ae=['/:id/lists','getLists','post','create','/:id/clone','clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','destroy','delete','removeAgents','removeLists','/:id/blacklists','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers'];(function(_0x30219f,_0x51fe1f){var _0x51c835=function(_0x2ad9f6){while(--_0x2ad9f6){_0x30219f['push'](_0x30219f['shift']());}};_0x51c835(++_0x51fe1f);}(_0x19ae,0xb7));var _0xe19a=function(_0xfa327b,_0x95d92){_0xfa327b=_0xfa327b-0x0;var _0x182dcb=_0x19ae[_0xfa327b];return _0x182dcb;};'use strict';var multer=require('multer');var util=require(_0xe19a('0x0'));var path=require(_0xe19a('0x1'));var timeout=require(_0xe19a('0x2'));var express=require('express');var router=express[_0xe19a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe19a('0x4'));var config=require(_0xe19a('0x5'));var controller=require(_0xe19a('0x6'));router[_0xe19a('0x7')]('/',auth['isAuthenticated'](),controller[_0xe19a('0x8')]);router[_0xe19a('0x7')]('/:id',auth[_0xe19a('0x9')](),controller[_0xe19a('0xa')]);router[_0xe19a('0x7')](_0xe19a('0xb'),auth['isAuthenticated'](),controller['getHoppers']);router['get'](_0xe19a('0xc'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xe19a('0x7')]('/:id/hopper_finals',auth[_0xe19a('0x9')](),controller[_0xe19a('0xd')]);router[_0xe19a('0x7')](_0xe19a('0xe'),auth[_0xe19a('0x9')](),controller[_0xe19a('0xf')]);router[_0xe19a('0x7')](_0xe19a('0x10'),auth['isAuthenticated'](),controller[_0xe19a('0x11')]);router[_0xe19a('0x7')](_0xe19a('0x12'),auth[_0xe19a('0x9')](),controller[_0xe19a('0x13')]);router[_0xe19a('0x7')](_0xe19a('0x14'),auth[_0xe19a('0x9')](),controller[_0xe19a('0x15')]);router['get'](_0xe19a('0x16'),auth[_0xe19a('0x9')](),controller[_0xe19a('0x17')]);router[_0xe19a('0x7')]('/:id/blacklists',auth[_0xe19a('0x9')](),controller['getBlackLists']);router[_0xe19a('0x18')]('/',auth['isAuthenticated'](),controller[_0xe19a('0x19')]);router[_0xe19a('0x18')](_0xe19a('0x1a'),auth[_0xe19a('0x9')](),controller[_0xe19a('0x1b')]);router[_0xe19a('0x18')](_0xe19a('0x10'),auth[_0xe19a('0x9')](),controller[_0xe19a('0x1c')]);router[_0xe19a('0x18')](_0xe19a('0x12'),auth['isAuthenticated'](),controller[_0xe19a('0x1d')]);router[_0xe19a('0x18')](_0xe19a('0x16'),auth[_0xe19a('0x9')](),controller[_0xe19a('0x1e')]);router[_0xe19a('0x18')]('/:id/blacklists',auth[_0xe19a('0x9')](),controller[_0xe19a('0x1f')]);router[_0xe19a('0x20')](_0xe19a('0x21'),auth[_0xe19a('0x9')](),controller[_0xe19a('0x22')]);router['delete'](_0xe19a('0x21'),auth['isAuthenticated'](),controller[_0xe19a('0x23')]);router[_0xe19a('0x24')](_0xe19a('0x10'),auth[_0xe19a('0x9')](),controller['removeTeams']);router[_0xe19a('0x24')](_0xe19a('0x12'),auth[_0xe19a('0x9')](),controller[_0xe19a('0x25')]);router[_0xe19a('0x24')](_0xe19a('0x16'),auth[_0xe19a('0x9')](),controller[_0xe19a('0x26')]);router[_0xe19a('0x24')](_0xe19a('0x27'),auth[_0xe19a('0x9')](),controller['removeBlackLists']);module[_0xe19a('0x28')]=router; \ No newline at end of file +var _0xf1cb=['show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addTeams','/:id/users','addAgents','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id'];(function(_0x4c05fc,_0x3a1282){var _0x5953b8=function(_0x15cdbb){while(--_0x15cdbb){_0x4c05fc['push'](_0x4c05fc['shift']());}};_0x5953b8(++_0x3a1282);}(_0xf1cb,0xa4));var _0xbf1c=function(_0xb2c246,_0x55ebaf){_0xb2c246=_0xb2c246-0x0;var _0x55a51f=_0xf1cb[_0xb2c246];return _0x55a51f;};'use strict';var multer=require(_0xbf1c('0x0'));var util=require(_0xbf1c('0x1'));var path=require(_0xbf1c('0x2'));var timeout=require(_0xbf1c('0x3'));var express=require(_0xbf1c('0x4'));var router=express[_0xbf1c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf1c('0x6'));var config=require('../../config/environment');var controller=require(_0xbf1c('0x7'));router[_0xbf1c('0x8')]('/',auth[_0xbf1c('0x9')](),controller[_0xbf1c('0xa')]);router['get'](_0xbf1c('0xb'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0xc')]);router[_0xbf1c('0x8')](_0xbf1c('0xd'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0xe')]);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xbf1c('0xf')]);router[_0xbf1c('0x8')](_0xbf1c('0x10'),auth[_0xbf1c('0x9')](),controller['getHopperFinals']);router[_0xbf1c('0x8')](_0xbf1c('0x11'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x12')]);router[_0xbf1c('0x8')](_0xbf1c('0x13'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x14')]);router[_0xbf1c('0x8')]('/:id/users',auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x15')]);router[_0xbf1c('0x8')](_0xbf1c('0x16'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x17')]);router[_0xbf1c('0x8')](_0xbf1c('0x18'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x19')]);router['get'](_0xbf1c('0x1a'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xbf1c('0x1b')]('/',auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x1c')]);router['post'](_0xbf1c('0x1d'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x1e')]);router[_0xbf1c('0x1b')](_0xbf1c('0x13'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x1f')]);router['post'](_0xbf1c('0x20'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x21')]);router[_0xbf1c('0x1b')]('/:id/lists',auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x22')]);router[_0xbf1c('0x1b')](_0xbf1c('0x1a'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x23')]);router[_0xbf1c('0x24')](_0xbf1c('0xb'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x25')]);router[_0xbf1c('0x26')](_0xbf1c('0xb'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x27')]);router[_0xbf1c('0x26')](_0xbf1c('0x13'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x28')]);router['delete']('/:id/users',auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x29')]);router['delete'](_0xbf1c('0x18'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x2a')]);router[_0xbf1c('0x26')](_0xbf1c('0x1a'),auth[_0xbf1c('0x9')](),controller[_0xbf1c('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index c2345f0..e580a3b 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(_0x5e48f8,_0x54ea70){var _0x15f1da=function(_0x2ae67f){while(--_0x2ae67f){_0x5e48f8['push'](_0x5e48f8['shift']());}};_0x15f1da(++_0x54ea70);}(_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')]={'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(_0x29d60a,_0x2b4229){var _0x4efc39=function(_0x4844be){while(--_0x4844be){_0x29d60a['push'](_0x29d60a['shift']());}};_0x4efc39(++_0x2b4229);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 e73ca8b..7d5359a 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 _0x0ea7=['save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','error','stack','name','send','index','VoiceQueue','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','length','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','UserProfileSection','update','getHoppers','findOne','nolimit','VoiceQueueId','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueueRt','upsert','isNil','SIP/%s','userVoiceQueue:save','select','tq.TeamId','from','team_has_voice_queues','VoiceQueueId\x20=\x20?','push','toString','every','TeamId','compact','ids','isEmpty','removeAgents','emit','addAgents','spread','format','all','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ListId','field','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','insert','fromQuery','ContactId','NOW()','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','localhost','redis','./voiceQueue.socket','register','sendStatus','status','json','count','offset','limit','reject'];(function(_0x2e17f0,_0xacc452){var _0x16b4e7=function(_0x4ca85a){while(--_0x4ca85a){_0x2e17f0['push'](_0x2e17f0['shift']());}};_0x16b4e7(++_0xacc452);}(_0x0ea7,0x8b));var _0x70ea=function(_0x58eced,_0x571bf4){_0x58eced=_0x58eced-0x0;var _0x7dcff7=_0x0ea7[_0x58eced];return _0x7dcff7;};'use strict';var pdf=require(_0x70ea('0x0'));var emlformat=require(_0x70ea('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x70ea('0x2'));var jsonpatch=require(_0x70ea('0x3'));var rp=require(_0x70ea('0x4'));var moment=require(_0x70ea('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x70ea('0x6'));var util=require(_0x70ea('0x7'));var path=require(_0x70ea('0x8'));var sox=require(_0x70ea('0x9'));var csv=require(_0x70ea('0xa'));var ejs=require(_0x70ea('0xb'));var fs=require('fs');var _=require(_0x70ea('0xc'));var squel=require(_0x70ea('0xd'));var crypto=require(_0x70ea('0xe'));var jsforce=require(_0x70ea('0xf'));var deskjs=require(_0x70ea('0x10'));var toCsv=require(_0x70ea('0xa'));var querystring=require(_0x70ea('0x11'));var Papa=require(_0x70ea('0x12'));var Redis=require('ioredis');var authService=require(_0x70ea('0x13'));var qs=require(_0x70ea('0x14'));var as=require(_0x70ea('0x15'));var hardwareService=require(_0x70ea('0x16'));var logger=require('../../config/logger')(_0x70ea('0x17'));var utils=require(_0x70ea('0x18'));var config=require(_0x70ea('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x70ea('0x1a')](config['redis'],{'host':_0x70ea('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70ea('0x1c')]));require(_0x70ea('0x1d'))[_0x70ea('0x1e')](socket);function respondWithStatusCode(_0x4dcdee,_0x795ff){_0x795ff=_0x795ff||0xcc;return function(_0xd09321){if(_0xd09321){return _0x4dcdee[_0x70ea('0x1f')](_0x795ff);}return _0x4dcdee[_0x70ea('0x20')](_0x795ff)['end']();};}function respondWithResult(_0x2cfffc,_0x3f0bff){_0x3f0bff=_0x3f0bff||0xc8;return function(_0x3bf119){if(_0x3bf119){return _0x2cfffc['status'](_0x3f0bff)[_0x70ea('0x21')](_0x3bf119);}};}function respondWithFilteredResult(_0x543c5f,_0x1ab946){return function(_0x47d73f){if(_0x47d73f){var _0x61a8f9=_0x47d73f[_0x70ea('0x22')],_0x19f528=_0x1ab946[_0x70ea('0x23')],_0xb2962f=_0x1ab946[_0x70ea('0x23')]+_0x1ab946[_0x70ea('0x24')],_0x123281;if(_0xb2962f>=_0x61a8f9){_0xb2962f=_0x61a8f9;_0x123281=0xc8;}else{_0x123281=0xce;}_0x543c5f[_0x70ea('0x20')](_0x123281);return _0x543c5f['set']('Content-Range',_0x19f528+'-'+_0xb2962f+'/'+_0x61a8f9)['json'](_0x47d73f);}return null;};}function patchUpdates(_0x101893){return function(_0x3847aa){try{jsonpatch['apply'](_0x3847aa,_0x101893,!![]);}catch(_0x328d31){return BPromise[_0x70ea('0x25')](_0x328d31);}return _0x3847aa[_0x70ea('0x26')]();};}function saveUpdates(_0x3baae3,_0x14f0ee){return function(_0x8fa4d){if(_0x8fa4d){return _0x8fa4d['update'](_0x3baae3)[_0x70ea('0x27')](function(_0x4f5643){return _0x4f5643;});}return null;};}function removeEntity(_0x9c9887,_0x5ed8d0){return function(_0x4fc631){if(_0x4fc631){return _0x4fc631[_0x70ea('0x28')]()[_0x70ea('0x27')](function(){var _0x10172f=_0x4fc631[_0x70ea('0x29')]({'plain':!![]});var _0xa8cade=[{'name':_0x70ea('0x2a'),'value':_0x70ea('0x2b'),'ignore':![]},{'name':_0x70ea('0x2c'),'value':_0x70ea('0x2d'),'ignore':![]}];var _0x54c94f=_(_0xa8cade)['filter'](_0x70ea('0x2e'))[_0x70ea('0x2f')](_0x70ea('0x30'))['value']();if(_[_0x70ea('0x31')](_0x54c94f,_0x10172f[_0x70ea('0x32')])){return;}var _0x4802fa=_['find'](_0xa8cade,['value',_0x10172f[_0x70ea('0x32')]])['name'];return db['UserProfileResource'][_0x70ea('0x28')]({'where':{'type':_0x4802fa,'resourceId':_0x10172f['id']}})[_0x70ea('0x27')](function(){return _0x4fc631;});})['then'](function(){_0x9c9887['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x509085,_0x4c8d19){return function(_0x3c8684){if(!_0x3c8684){_0x509085[_0x70ea('0x1f')](0x194);}return _0x3c8684;};}function handleError(_0x49eb22,_0x577cfc){_0x577cfc=_0x577cfc||0x1f4;return function(_0x5a6ecf){logger[_0x70ea('0x33')](_0x5a6ecf[_0x70ea('0x34')]);if(_0x5a6ecf[_0x70ea('0x35')]){delete _0x5a6ecf['name'];}_0x49eb22[_0x70ea('0x20')](_0x577cfc)[_0x70ea('0x36')](_0x5a6ecf);};}exports[_0x70ea('0x37')]=function(_0x54af2e,_0x489872){var _0x143d58={},_0x1e901c={},_0x4c8898={'count':0x0,'rows':[]};var _0x15ae33=_['map'](db[_0x70ea('0x38')]['rawAttributes'],function(_0x2cb960){return{'name':_0x2cb960['fieldName'],'type':_0x2cb960[_0x70ea('0x32')][_0x70ea('0x39')]};});_0x1e901c[_0x70ea('0x3a')]=_['map'](_0x15ae33,_0x70ea('0x35'));_0x1e901c[_0x70ea('0x3b')]=_['keys'](_0x54af2e['query']);_0x1e901c[_0x70ea('0x3c')]=_[_0x70ea('0x3d')](_0x1e901c[_0x70ea('0x3a')],_0x1e901c['query']);_0x143d58[_0x70ea('0x3e')]=_[_0x70ea('0x3d')](_0x1e901c[_0x70ea('0x3a')],qs[_0x70ea('0x3f')](_0x54af2e[_0x70ea('0x3b')][_0x70ea('0x3f')]));_0x143d58['attributes']=_0x143d58['attributes']['length']?_0x143d58[_0x70ea('0x3e')]:_0x1e901c[_0x70ea('0x3a')];if(!_0x54af2e[_0x70ea('0x3b')][_0x70ea('0x40')]('nolimit')){_0x143d58[_0x70ea('0x24')]=qs[_0x70ea('0x24')](_0x54af2e[_0x70ea('0x3b')][_0x70ea('0x24')]);_0x143d58['offset']=qs[_0x70ea('0x23')](_0x54af2e[_0x70ea('0x3b')][_0x70ea('0x23')]);}_0x143d58[_0x70ea('0x41')]=qs[_0x70ea('0x42')](_0x54af2e[_0x70ea('0x3b')][_0x70ea('0x42')]);_0x143d58[_0x70ea('0x43')]=qs[_0x70ea('0x3c')](_[_0x70ea('0x44')](_0x54af2e['query'],_0x1e901c['filters']),_0x15ae33);if(_0x54af2e[_0x70ea('0x3b')][_0x70ea('0x45')]){_0x143d58['where']=_['merge'](_0x143d58[_0x70ea('0x43')],{'$or':_['map'](_0x15ae33,function(_0xde20a1){if(_0xde20a1[_0x70ea('0x32')]!==_0x70ea('0x46')){var _0x33e225={};_0x33e225[_0xde20a1[_0x70ea('0x35')]]={'$like':'%'+_0x54af2e[_0x70ea('0x3b')]['filter']+'%'};return _0x33e225;}})});}_0x143d58=_['merge']({},_0x143d58,_0x54af2e[_0x70ea('0x47')]);var _0x2ac4c9={'where':_0x143d58[_0x70ea('0x43')]};return db[_0x70ea('0x38')][_0x70ea('0x22')](_0x2ac4c9)[_0x70ea('0x27')](function(_0x555049){_0x4c8898[_0x70ea('0x22')]=_0x555049;if(_0x54af2e['query']['includeAll']){_0x143d58[_0x70ea('0x48')]=[{'all':!![]}];}return db[_0x70ea('0x38')][_0x70ea('0x49')](_0x143d58);})[_0x70ea('0x27')](function(_0xb7f2fd){_0x4c8898['rows']=_0xb7f2fd;return _0x4c8898;})['then'](respondWithFilteredResult(_0x489872,_0x143d58))[_0x70ea('0x4a')](handleError(_0x489872,null));};exports[_0x70ea('0x4b')]=function(_0x4c14d4,_0x1596d6){var _0x1fa4da={'raw':![],'where':{'id':_0x4c14d4[_0x70ea('0x4c')]['id']}},_0x25081f={};_0x25081f[_0x70ea('0x3a')]=_[_0x70ea('0x4d')](db[_0x70ea('0x38')][_0x70ea('0x4e')]);_0x25081f['query']=_[_0x70ea('0x4d')](_0x4c14d4[_0x70ea('0x3b')]);_0x25081f['filters']=_[_0x70ea('0x3d')](_0x25081f['model'],_0x25081f[_0x70ea('0x3b')]);_0x1fa4da[_0x70ea('0x3e')]=_[_0x70ea('0x3d')](_0x25081f[_0x70ea('0x3a')],qs[_0x70ea('0x3f')](_0x4c14d4[_0x70ea('0x3b')]['fields']));_0x1fa4da[_0x70ea('0x3e')]=_0x1fa4da['attributes'][_0x70ea('0x4f')]?_0x1fa4da[_0x70ea('0x3e')]:_0x25081f['model'];if(_0x4c14d4['query'][_0x70ea('0x50')]){_0x1fa4da[_0x70ea('0x48')]=[{'all':!![]}];}_0x1fa4da=_[_0x70ea('0x51')]({},_0x1fa4da,_0x4c14d4[_0x70ea('0x47')]);return db[_0x70ea('0x38')][_0x70ea('0x52')](_0x1fa4da)[_0x70ea('0x27')](handleEntityNotFound(_0x1596d6,null))[_0x70ea('0x27')](respondWithResult(_0x1596d6,null))[_0x70ea('0x4a')](handleError(_0x1596d6,null));};exports['create']=function(_0x31baf1,_0x556e10){return db[_0x70ea('0x38')][_0x70ea('0x53')](_0x31baf1['body'],{})[_0x70ea('0x27')](function(_0xcddfde){var _0x16be18=_0x31baf1[_0x70ea('0x54')][_0x70ea('0x29')]({'plain':!![]});if(!_0x16be18)throw new Error(_0x70ea('0x55'));if(_0x16be18['role']==='user'){var _0x3fe148=_0xcddfde['get']({'plain':!![]});var _0x1a2407=[{'name':_0x70ea('0x2a'),'value':_0x70ea('0x2b')},{'name':_0x70ea('0x2c'),'value':_0x70ea('0x2d')}];var _0x2298da=_[_0x70ea('0x52')](_0x1a2407,['value',_0x3fe148[_0x70ea('0x32')]])['name'];return db['UserProfileSection'][_0x70ea('0x52')]({'where':{'name':_0x2298da,'userProfileId':_0x16be18[_0x70ea('0x56')]},'raw':!![]})[_0x70ea('0x27')](function(_0x5c842a){if(_0x5c842a&&_0x5c842a[_0x70ea('0x57')]===0x0){return db[_0x70ea('0x58')]['create']({'name':_0x3fe148[_0x70ea('0x35')],'resourceId':_0x3fe148['id'],'type':_0x5c842a[_0x70ea('0x35')],'sectionId':_0x5c842a['id']},{})[_0x70ea('0x27')](function(){return _0xcddfde;});}else{return _0xcddfde;}})['catch'](function(_0x563ee8){logger[_0x70ea('0x33')](_0x70ea('0x59'),_0x563ee8);throw _0x563ee8;});}return _0xcddfde;})[_0x70ea('0x27')](respondWithResult(_0x556e10,0xc9))[_0x70ea('0x4a')](handleError(_0x556e10,null));};exports[_0x70ea('0x5a')]=function(_0x29cf25,_0x1483b5){var _0x4547fb={'where':{'id':_0x29cf25[_0x70ea('0x4c')]['id']}},_0x13d3e0={};_0x13d3e0[_0x70ea('0x3a')]=_[_0x70ea('0x4d')](db['VoiceQueue'][_0x70ea('0x4e')]);_0x4547fb[_0x70ea('0x3e')]=_[_0x70ea('0x3d')](_0x13d3e0['model'],qs[_0x70ea('0x3f')](_0x29cf25['query'][_0x70ea('0x3f')]));_0x4547fb[_0x70ea('0x3e')]=_0x4547fb['attributes'][_0x70ea('0x4f')]?_0x4547fb['attributes']:_0x13d3e0[_0x70ea('0x3a')];if(_0x29cf25[_0x70ea('0x3b')]['includeAll']){_0x4547fb[_0x70ea('0x48')]=[{'all':!![]}];}_0x4547fb=_[_0x70ea('0x51')]({},_0x4547fb,_0x29cf25[_0x70ea('0x47')]);return db[_0x70ea('0x38')][_0x70ea('0x52')](_0x4547fb)[_0x70ea('0x27')](handleEntityNotFound(_0x1483b5,null))[_0x70ea('0x27')](function(_0x3be21a){if(_0x3be21a){var _0x435361=_0x3be21a[_0x70ea('0x29')]({'plain':!![]});_0x435361=qs[_0x70ea('0x5b')](_0x435361,['id',_0x70ea('0x5c'),'updatedAt']);_0x29cf25[_0x70ea('0x5d')]=_['omit'](_0x29cf25[_0x70ea('0x5d')],['id','createdAt',_0x70ea('0x5e')]);return db['VoiceQueue'][_0x70ea('0x53')](_['merge'](_0x435361,_0x29cf25[_0x70ea('0x5d')]),{'include':_0x29cf25[_0x70ea('0x3b')][_0x70ea('0x50')]?[{'all':!![]}]:undefined})[_0x70ea('0x27')](function(_0x2e8c12){var _0x286255=_0x29cf25[_0x70ea('0x54')][_0x70ea('0x29')]({'plain':!![]});if(!_0x286255)throw new Error(_0x70ea('0x55'));if(_0x286255['role']===_0x70ea('0x54')){var _0x43dad7=_0x2e8c12['get']({'plain':!![]});var _0x1ae798=[{'name':_0x70ea('0x2a'),'value':_0x70ea('0x2b')},{'name':_0x70ea('0x2c'),'value':_0x70ea('0x2d')}];var _0x1cc240=_['find'](_0x1ae798,['value',_0x43dad7[_0x70ea('0x32')]])['name'];return db[_0x70ea('0x5f')][_0x70ea('0x52')]({'where':{'name':_0x1cc240,'userProfileId':_0x286255['userProfileId']},'raw':!![]})[_0x70ea('0x27')](function(_0x1206a8){if(_0x1206a8&&_0x1206a8['autoAssociation']===0x0){return db[_0x70ea('0x58')][_0x70ea('0x53')]({'name':_0x43dad7[_0x70ea('0x35')],'resourceId':_0x43dad7['id'],'type':_0x1206a8[_0x70ea('0x35')],'sectionId':_0x1206a8['id']},{})[_0x70ea('0x27')](function(){return _0x2e8c12;});}else{return _0x2e8c12;}})['catch'](function(_0x3910ec){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3910ec);throw _0x3910ec;});}return _0x2e8c12;});}})[_0x70ea('0x27')](respondWithResult(_0x1483b5,0xc9))['catch'](handleError(_0x1483b5,null));};exports[_0x70ea('0x60')]=function(_0xe8aa8a,_0x211626){if(_0xe8aa8a['body']['id']){delete _0xe8aa8a[_0x70ea('0x5d')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0xe8aa8a['params']['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x211626,null))['then'](saveUpdates(_0xe8aa8a['body'],null))[_0x70ea('0x27')](respondWithResult(_0x211626,null))[_0x70ea('0x4a')](handleError(_0x211626,null));};exports[_0x70ea('0x28')]=function(_0x4a62ed,_0x304804){return db['VoiceQueue'][_0x70ea('0x52')]({'where':{'id':_0x4a62ed[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x304804,null))['then'](removeEntity(_0x304804,null))[_0x70ea('0x4a')](handleError(_0x304804,null));};exports[_0x70ea('0x61')]=function(_0x102b9e,_0x3ed9a0,_0x57daf6){var _0x551415={'raw':![],'where':{}};var _0x37f0ed={};var _0x328a90={'count':0x0,'rows':[]};return db[_0x70ea('0x38')][_0x70ea('0x62')]({'where':{'id':_0x102b9e[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x3ed9a0,null))['then'](function(_0xa5a524){if(_0xa5a524){_0x37f0ed[_0x70ea('0x3a')]=_[_0x70ea('0x4d')](db['CmHopper'][_0x70ea('0x4e')]);_0x37f0ed['query']=_[_0x70ea('0x4d')](_0x102b9e[_0x70ea('0x3b')]);_0x37f0ed[_0x70ea('0x3c')]=_['intersection'](_0x37f0ed[_0x70ea('0x3a')],_0x37f0ed[_0x70ea('0x3b')]);_0x551415[_0x70ea('0x3e')]=_['intersection'](_0x37f0ed['model'],qs[_0x70ea('0x3f')](_0x102b9e[_0x70ea('0x3b')][_0x70ea('0x3f')]));_0x551415[_0x70ea('0x3e')]=_0x551415[_0x70ea('0x3e')][_0x70ea('0x4f')]?_0x551415[_0x70ea('0x3e')]:_0x37f0ed[_0x70ea('0x3a')];if(!_0x102b9e[_0x70ea('0x3b')]['hasOwnProperty'](_0x70ea('0x63'))){_0x551415[_0x70ea('0x24')]=qs[_0x70ea('0x24')](_0x102b9e[_0x70ea('0x3b')][_0x70ea('0x24')]);_0x551415[_0x70ea('0x23')]=qs[_0x70ea('0x23')](_0x102b9e[_0x70ea('0x3b')][_0x70ea('0x23')]);}_0x551415['order']=qs[_0x70ea('0x42')](_0x102b9e[_0x70ea('0x3b')][_0x70ea('0x42')]);_0x551415['where']=qs['filters'](_[_0x70ea('0x44')](_0x102b9e['query'],_0x37f0ed[_0x70ea('0x3c')]));_0x551415[_0x70ea('0x43')][_0x70ea('0x64')]=_0xa5a524['id'];if(_0x102b9e[_0x70ea('0x3b')][_0x70ea('0x45')]){_0x551415[_0x70ea('0x43')]=_[_0x70ea('0x51')](_0x551415[_0x70ea('0x43')],{'$or':_[_0x70ea('0x2f')](_0x551415[_0x70ea('0x3e')],function(_0x88f84f){var _0x1d0b56={};_0x1d0b56[_0x88f84f]={'$like':'%'+_0x102b9e[_0x70ea('0x3b')][_0x70ea('0x45')]+'%'};return _0x1d0b56;})});}_0x551415=_[_0x70ea('0x51')]({},_0x551415,_0x102b9e[_0x70ea('0x47')]);return db['CmHopper'][_0x70ea('0x22')]({'where':_0x551415[_0x70ea('0x43')]})['then'](function(_0x2274a0){_0x328a90[_0x70ea('0x22')]=_0x2274a0;if(_0x102b9e[_0x70ea('0x3b')][_0x70ea('0x50')]){_0x551415['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x551415);})[_0x70ea('0x27')](function(_0x51f109){_0x328a90['rows']=_0x51f109;return _0x328a90;});}})[_0x70ea('0x27')](respondWithFilteredResult(_0x3ed9a0,_0x551415))[_0x70ea('0x4a')](handleError(_0x3ed9a0,null));};exports[_0x70ea('0x65')]=function(_0x3da02d,_0x2023c7,_0xa189da){var _0x46f0b6={'raw':!![],'where':{}};var _0x5f4fac={};var _0x54b30e={'count':0x0,'rows':[]};return db[_0x70ea('0x38')][_0x70ea('0x62')]({'where':{'id':_0x3da02d['params']['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x2023c7,null))[_0x70ea('0x27')](function(_0x989388){if(_0x989388){_0x5f4fac['model']=_['keys'](db[_0x70ea('0x66')]['rawAttributes']);_0x5f4fac[_0x70ea('0x3b')]=_['keys'](_0x3da02d[_0x70ea('0x3b')]);_0x5f4fac['filters']=_['intersection'](_0x5f4fac[_0x70ea('0x3a')],_0x5f4fac[_0x70ea('0x3b')]);_0x46f0b6[_0x70ea('0x3e')]=_[_0x70ea('0x3d')](_0x5f4fac[_0x70ea('0x3a')],qs['fields'](_0x3da02d['query'][_0x70ea('0x3f')]));_0x46f0b6[_0x70ea('0x3e')]=_0x46f0b6[_0x70ea('0x3e')][_0x70ea('0x4f')]?_0x46f0b6['attributes']:_0x5f4fac[_0x70ea('0x3a')];if(!_0x3da02d['query']['hasOwnProperty']('nolimit')){_0x46f0b6[_0x70ea('0x24')]=qs[_0x70ea('0x24')](_0x3da02d[_0x70ea('0x3b')]['limit']);_0x46f0b6[_0x70ea('0x23')]=qs[_0x70ea('0x23')](_0x3da02d[_0x70ea('0x3b')][_0x70ea('0x23')]);}_0x46f0b6['order']=qs['sort'](_0x3da02d[_0x70ea('0x3b')][_0x70ea('0x42')]);_0x46f0b6[_0x70ea('0x43')]=qs[_0x70ea('0x3c')](_['pick'](_0x3da02d[_0x70ea('0x3b')],_0x5f4fac['filters']));_0x46f0b6[_0x70ea('0x43')][_0x70ea('0x64')]=_0x989388['id'];if(_0x3da02d[_0x70ea('0x3b')]['filter']){_0x46f0b6[_0x70ea('0x43')]=_['merge'](_0x46f0b6[_0x70ea('0x43')],{'$or':_[_0x70ea('0x2f')](_0x46f0b6['attributes'],function(_0x41863a){var _0x5e697c={};_0x5e697c[_0x41863a]={'$like':'%'+_0x3da02d['query'][_0x70ea('0x45')]+'%'};return _0x5e697c;})});}_0x46f0b6=_['merge']({},_0x46f0b6,_0x3da02d[_0x70ea('0x47')]);return db['CmHopperHistory'][_0x70ea('0x22')]({'where':_0x46f0b6[_0x70ea('0x43')]})['then'](function(_0x4e1784){_0x54b30e[_0x70ea('0x22')]=_0x4e1784;if(_0x3da02d['query'][_0x70ea('0x50')]){_0x46f0b6[_0x70ea('0x48')]=[{'all':!![]}];}return db[_0x70ea('0x66')]['findAll'](_0x46f0b6);})['then'](function(_0x53ac2c){_0x54b30e[_0x70ea('0x67')]=_0x53ac2c;return _0x54b30e;});}})[_0x70ea('0x27')](respondWithFilteredResult(_0x2023c7,_0x46f0b6))[_0x70ea('0x4a')](handleError(_0x2023c7,null));};exports[_0x70ea('0x68')]=function(_0x217242,_0x28d483,_0x1a07f8){var _0x56bfba={'raw':!![],'where':{}};var _0x3ce2ce={};var _0x5a1bb2={'count':0x0,'rows':[]};return db[_0x70ea('0x38')][_0x70ea('0x62')]({'where':{'id':_0x217242[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x28d483,null))[_0x70ea('0x27')](function(_0x722087){if(_0x722087){_0x3ce2ce[_0x70ea('0x3a')]=_['keys'](db[_0x70ea('0x69')][_0x70ea('0x4e')]);_0x3ce2ce[_0x70ea('0x3b')]=_[_0x70ea('0x4d')](_0x217242['query']);_0x3ce2ce['filters']=_[_0x70ea('0x3d')](_0x3ce2ce['model'],_0x3ce2ce[_0x70ea('0x3b')]);_0x56bfba['attributes']=_[_0x70ea('0x3d')](_0x3ce2ce[_0x70ea('0x3a')],qs[_0x70ea('0x3f')](_0x217242[_0x70ea('0x3b')][_0x70ea('0x3f')]));_0x56bfba[_0x70ea('0x3e')]=_0x56bfba[_0x70ea('0x3e')]['length']?_0x56bfba[_0x70ea('0x3e')]:_0x3ce2ce[_0x70ea('0x3a')];if(!_0x217242[_0x70ea('0x3b')]['hasOwnProperty'](_0x70ea('0x63'))){_0x56bfba[_0x70ea('0x24')]=qs['limit'](_0x217242[_0x70ea('0x3b')][_0x70ea('0x24')]);_0x56bfba[_0x70ea('0x23')]=qs[_0x70ea('0x23')](_0x217242['query'][_0x70ea('0x23')]);}_0x56bfba[_0x70ea('0x41')]=qs[_0x70ea('0x42')](_0x217242[_0x70ea('0x3b')][_0x70ea('0x42')]);_0x56bfba[_0x70ea('0x43')]=qs[_0x70ea('0x3c')](_['pick'](_0x217242[_0x70ea('0x3b')],_0x3ce2ce['filters']));_0x56bfba[_0x70ea('0x43')][_0x70ea('0x64')]=_0x722087['id'];if(_0x217242[_0x70ea('0x3b')][_0x70ea('0x45')]){_0x56bfba[_0x70ea('0x43')]=_[_0x70ea('0x51')](_0x56bfba[_0x70ea('0x43')],{'$or':_[_0x70ea('0x2f')](_0x56bfba[_0x70ea('0x3e')],function(_0x1cbb49){var _0x364dcb={};_0x364dcb[_0x1cbb49]={'$like':'%'+_0x217242['query']['filter']+'%'};return _0x364dcb;})});}_0x56bfba=_[_0x70ea('0x51')]({},_0x56bfba,_0x217242[_0x70ea('0x47')]);return db[_0x70ea('0x69')][_0x70ea('0x22')]({'where':_0x56bfba['where']})[_0x70ea('0x27')](function(_0x251141){_0x5a1bb2[_0x70ea('0x22')]=_0x251141;if(_0x217242['query'][_0x70ea('0x50')]){_0x56bfba[_0x70ea('0x48')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x70ea('0x49')](_0x56bfba);})[_0x70ea('0x27')](function(_0x9acacf){_0x5a1bb2[_0x70ea('0x67')]=_0x9acacf;return _0x5a1bb2;});}})[_0x70ea('0x27')](respondWithFilteredResult(_0x28d483,_0x56bfba))[_0x70ea('0x4a')](handleError(_0x28d483,null));};exports[_0x70ea('0x6a')]=function(_0x412740,_0x3ccc0b,_0xc25094){var _0x4c77a5={'raw':!![],'where':{}};var _0x365448={};var _0x2743ad={'count':0x0,'rows':[]};return db[_0x70ea('0x38')][_0x70ea('0x62')]({'where':{'id':_0x412740[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x3ccc0b,null))[_0x70ea('0x27')](function(_0x27995e){if(_0x27995e){_0x365448[_0x70ea('0x3a')]=_['keys'](db['CmHopperBlack'][_0x70ea('0x4e')]);_0x365448[_0x70ea('0x3b')]=_[_0x70ea('0x4d')](_0x412740['query']);_0x365448[_0x70ea('0x3c')]=_[_0x70ea('0x3d')](_0x365448['model'],_0x365448[_0x70ea('0x3b')]);_0x4c77a5[_0x70ea('0x3e')]=_[_0x70ea('0x3d')](_0x365448[_0x70ea('0x3a')],qs[_0x70ea('0x3f')](_0x412740['query'][_0x70ea('0x3f')]));_0x4c77a5[_0x70ea('0x3e')]=_0x4c77a5[_0x70ea('0x3e')][_0x70ea('0x4f')]?_0x4c77a5[_0x70ea('0x3e')]:_0x365448[_0x70ea('0x3a')];if(!_0x412740[_0x70ea('0x3b')]['hasOwnProperty'](_0x70ea('0x63'))){_0x4c77a5['limit']=qs[_0x70ea('0x24')](_0x412740['query'][_0x70ea('0x24')]);_0x4c77a5['offset']=qs[_0x70ea('0x23')](_0x412740[_0x70ea('0x3b')][_0x70ea('0x23')]);}_0x4c77a5[_0x70ea('0x41')]=qs['sort'](_0x412740[_0x70ea('0x3b')][_0x70ea('0x42')]);_0x4c77a5[_0x70ea('0x43')]=qs[_0x70ea('0x3c')](_['pick'](_0x412740[_0x70ea('0x3b')],_0x365448[_0x70ea('0x3c')]));_0x4c77a5[_0x70ea('0x43')][_0x70ea('0x64')]=_0x27995e['id'];if(_0x412740[_0x70ea('0x3b')][_0x70ea('0x45')]){_0x4c77a5[_0x70ea('0x43')]=_[_0x70ea('0x51')](_0x4c77a5[_0x70ea('0x43')],{'$or':_[_0x70ea('0x2f')](_0x4c77a5['attributes'],function(_0x3d0c61){var _0x376b00={};_0x376b00[_0x3d0c61]={'$like':'%'+_0x412740[_0x70ea('0x3b')][_0x70ea('0x45')]+'%'};return _0x376b00;})});}_0x4c77a5=_['merge']({},_0x4c77a5,_0x412740[_0x70ea('0x47')]);return db[_0x70ea('0x6b')][_0x70ea('0x22')]({'where':_0x4c77a5['where']})['then'](function(_0x392a2b){_0x2743ad['count']=_0x392a2b;if(_0x412740['query']['includeAll']){_0x4c77a5[_0x70ea('0x48')]=[{'all':!![]}];}return db[_0x70ea('0x6b')][_0x70ea('0x49')](_0x4c77a5);})[_0x70ea('0x27')](function(_0x37f2aa){_0x2743ad[_0x70ea('0x67')]=_0x37f2aa;return _0x2743ad;});}})[_0x70ea('0x27')](respondWithFilteredResult(_0x3ccc0b,_0x4c77a5))['catch'](handleError(_0x3ccc0b,null));};exports[_0x70ea('0x6c')]=function(_0x2e5f72,_0x34f2a0,_0x1f3a9d){var _0x316001={};var _0x2633c4={};var _0x2466e8;var _0xae7ab3;return db['VoiceQueue'][_0x70ea('0x62')]({'where':{'id':_0x2e5f72[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x34f2a0,null))[_0x70ea('0x27')](function(_0x18db14){if(_0x18db14){_0x2466e8=_0x18db14;_0x2633c4[_0x70ea('0x3a')]=_[_0x70ea('0x4d')](db['Team'][_0x70ea('0x4e')]);_0x2633c4[_0x70ea('0x3b')]=_[_0x70ea('0x4d')](_0x2e5f72[_0x70ea('0x3b')]);_0x2633c4[_0x70ea('0x3c')]=_[_0x70ea('0x3d')](_0x2633c4[_0x70ea('0x3a')],_0x2633c4[_0x70ea('0x3b')]);_0x316001[_0x70ea('0x3e')]=_['intersection'](_0x2633c4[_0x70ea('0x3a')],qs[_0x70ea('0x3f')](_0x2e5f72[_0x70ea('0x3b')][_0x70ea('0x3f')]));_0x316001['attributes']=_0x316001[_0x70ea('0x3e')][_0x70ea('0x4f')]?_0x316001['attributes']:_0x2633c4[_0x70ea('0x3a')];_0x316001[_0x70ea('0x41')]=qs[_0x70ea('0x42')](_0x2e5f72[_0x70ea('0x3b')][_0x70ea('0x42')]);_0x316001[_0x70ea('0x43')]=qs['filters'](_[_0x70ea('0x44')](_0x2e5f72[_0x70ea('0x3b')],_0x2633c4[_0x70ea('0x3c')]));if(_0x2e5f72[_0x70ea('0x3b')][_0x70ea('0x45')]){_0x316001['where']=_['merge'](_0x316001[_0x70ea('0x43')],{'$or':_[_0x70ea('0x2f')](_0x316001[_0x70ea('0x3e')],function(_0x2a18fa){var _0x220662={};_0x220662[_0x2a18fa]={'$like':'%'+_0x2e5f72[_0x70ea('0x3b')][_0x70ea('0x45')]+'%'};return _0x220662;})});}_0x316001=_[_0x70ea('0x51')]({},_0x316001,_0x2e5f72[_0x70ea('0x47')]);return _0x2466e8[_0x70ea('0x6c')](_0x316001);}})['then'](function(_0x56fa7f){if(_0x56fa7f){_0xae7ab3=_0x56fa7f[_0x70ea('0x4f')];if(!_0x2e5f72[_0x70ea('0x3b')][_0x70ea('0x40')](_0x70ea('0x63'))){_0x316001[_0x70ea('0x24')]=qs[_0x70ea('0x24')](_0x2e5f72[_0x70ea('0x3b')][_0x70ea('0x24')]);_0x316001[_0x70ea('0x23')]=qs[_0x70ea('0x23')](_0x2e5f72[_0x70ea('0x3b')][_0x70ea('0x23')]);}return _0x2466e8[_0x70ea('0x6c')](_0x316001);}})[_0x70ea('0x27')](function(_0x251f04){if(_0x251f04){return _0x251f04?{'count':_0xae7ab3,'rows':_0x251f04}:null;}})[_0x70ea('0x27')](respondWithResult(_0x34f2a0,null))[_0x70ea('0x4a')](handleError(_0x34f2a0,null));};exports[_0x70ea('0x6d')]=function(_0x80a413,_0x21af05,_0x5defa4){var _0x468502=_0x80a413[_0x70ea('0x5d')]['teams'];var _0x4cb14f=_[_0x70ea('0x2f')](_0x468502,'id');return db[_0x70ea('0x6e')][_0x70ea('0x49')]({'where':{'id':_0x4cb14f},'attributes':['id'],'include':[{'model':db[_0x70ea('0x6f')],'as':_0x70ea('0x70'),'attributes':['id',_0x70ea('0x35'),_0x70ea('0x71'),_0x70ea('0x72'),_0x70ea('0x73')],'raw':!![]}]})['then'](function(_0x137d14){if(_0x137d14){var _0x2b489a=_[_0x70ea('0x74')](_0x137d14,function(_0x157c9a){var _0x20949b=_0x157c9a[_0x70ea('0x29')]({'plain':!![]});_0x20949b[_0x70ea('0x70')][_0x70ea('0x75')](function(_0x289b2b){_0x289b2b[_0x70ea('0x76')]=_[_0x70ea('0x52')](_0x468502,{'id':_0x20949b['id']})[_0x70ea('0x76')];});return _0x20949b[_0x70ea('0x70')];});return db['VoiceQueue'][_0x70ea('0x52')]({'where':{'id':_0x80a413[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](function(_0xc99d88){return db[_0x70ea('0x77')][_0x70ea('0x78')](function(_0xe66a08){return _0xc99d88[_0x70ea('0x6d')](_0x4cb14f,{'transaction':_0xe66a08})[_0x70ea('0x27')](function(){return BPromise[_0x70ea('0x79')](_0x2b489a,function(_0x45f412){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x45f412['id'],'VoiceQueueId':_0x80a413[_0x70ea('0x4c')]['id']},'defaults':{'penalty':_0x45f412[_0x70ea('0x76')]},'transaction':_0xe66a08});});})[_0x70ea('0x27')](function(){return BPromise[_0x70ea('0x79')](_[_0x70ea('0x45')](_0x2b489a,{'online':!![]}),function(_0x3c6eb7){return db[_0x70ea('0x7a')][_0x70ea('0x7b')]({'membername':_0x3c6eb7[_0x70ea('0x35')],'UserId':_0x3c6eb7['id'],'queue_name':_0xc99d88[_0x70ea('0x35')],'VoiceQueueId':_0xc99d88['id'],'interface':_[_0x70ea('0x7c')](_0x3c6eb7[_0x70ea('0x73')])?util['format'](_0x70ea('0x7d'),_0x3c6eb7['name']):_0x3c6eb7[_0x70ea('0x73')],'paused':_0x3c6eb7[_0x70ea('0x72')]||![],'penalty':_0x3c6eb7[_0x70ea('0x76')]},{'transaction':_0xe66a08});});})[_0x70ea('0x27')](function(){_0x2b489a[_0x70ea('0x75')](function(_0x17443d){socket['emit'](_0x70ea('0x7e'),{'UserId':_0x17443d['id'],'VoiceQueueId':_0xc99d88['id']});});});});});}})[_0x70ea('0x27')](respondWithStatusCode(_0x21af05,null))[_0x70ea('0x4a')](handleError(_0x21af05,null));};exports['removeTeams']=function(_0x5d84cd,_0x4ba24d,_0x2ea418){return db[_0x70ea('0x6e')][_0x70ea('0x49')]({'where':{'id':_0x5d84cd[_0x70ea('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x70ea('0x6f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x70ea('0x27')](handleEntityNotFound(_0x4ba24d,null))['then'](function(_0xda00b){var _0x3a5d64=_[_0x70ea('0x2f')](_0xda00b,'id');var _0x117cb0=[];var _0x1481d6=[];var _0x166aee=squel[_0x70ea('0x7f')]();_0x166aee['field'](_0x70ea('0x80'))[_0x70ea('0x81')](_0x70ea('0x82'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x70ea('0x43')](_0x70ea('0x83'),_0x5d84cd[_0x70ea('0x4c')]['id']);for(var _0x5e3597=0x0;_0x5e3597<_0xda00b[_0x70ea('0x4f')];_0x5e3597+=0x1){let _0x228804=_0xda00b[_0x5e3597];for(var _0x157d23=0x0;_0x157d23<_0x228804[_0x70ea('0x70')][_0x70ea('0x4f')];_0x157d23+=0x1){let _0x1532f4=_0x228804['Agents'][_0x157d23];var _0x422c7b=_0x166aee['clone']();_0x422c7b[_0x70ea('0x43')]('ut.UserId\x20=\x20?',_0x1532f4['id']);_0x1481d6[_0x70ea('0x84')](db[_0x70ea('0x77')][_0x70ea('0x3b')](_0x422c7b[_0x70ea('0x85')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x70ea('0x27')](function(_0x3324a1){if(_0x3324a1['length']===0x1){return _0x1532f4['id'];}else{var _0x29ff8c=_[_0x70ea('0x86')](_[_0x70ea('0x2f')](_0x3324a1,_0x70ea('0x87')),function(_0x4d4f78){return _[_0x70ea('0x31')](_0x3a5d64,_0x4d4f78);});if(_0x29ff8c){return _0x1532f4['id'];}}}));}}return BPromise['all'](_0x1481d6)[_0x70ea('0x27')](function(_0x2761f0){_0x117cb0=_(_0x117cb0)['union'](_0x2761f0)[_0x70ea('0x88')]()[_0x70ea('0x30')]();return db[_0x70ea('0x38')][_0x70ea('0x52')]({'where':{'id':_0x5d84cd[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](function(_0x518c0a){return db[_0x70ea('0x77')][_0x70ea('0x78')](function(_0x154fb6){return _0x518c0a['removeTeams'](_0x5d84cd['query'][_0x70ea('0x89')],{'transaction':_0x154fb6})['then'](function(){if(!_[_0x70ea('0x8a')](_0x117cb0)){return _0x518c0a[_0x70ea('0x8b')](_0x117cb0,{'transaction':_0x154fb6})[_0x70ea('0x27')](function(){return db['UserVoiceQueueRt'][_0x70ea('0x28')]({'where':{'VoiceQueueId':_0x5d84cd[_0x70ea('0x4c')]['id'],'UserId':_0x117cb0},'transaction':_0x154fb6});});}})[_0x70ea('0x27')](function(){_0x117cb0[_0x70ea('0x75')](function(_0x34fe9c){socket[_0x70ea('0x8c')]('userVoiceQueue:remove',{'UserId':_0x34fe9c,'VoiceQueueId':_0x518c0a['id']});});});});});});})[_0x70ea('0x27')](respondWithStatusCode(_0x4ba24d,null))[_0x70ea('0x4a')](handleError(_0x4ba24d,null));};exports[_0x70ea('0x8d')]=function(_0x4beacf,_0x2af96c,_0x4ee5be){var _0x2097c7,_0x2ed54c;return db[_0x70ea('0x38')]['find']({'where':{'id':_0x4beacf[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x2af96c,null))['then'](function(_0x266f4a){if(_0x266f4a){_0x2ed54c=_0x266f4a;return _0x266f4a[_0x70ea('0x8d')](_0x4beacf[_0x70ea('0x5d')]['ids'],_[_0x70ea('0x5b')](_0x4beacf[_0x70ea('0x5d')],[_0x70ea('0x89'),'id'])||{})[_0x70ea('0x8e')](function(_0x4acb89){for(var _0x5c699f=0x0;_0x5c699f<_0x4beacf[_0x70ea('0x5d')]['ids'][_0x70ea('0x4f')];_0x5c699f+=0x1){socket[_0x70ea('0x8c')](_0x70ea('0x7e'),{'UserId':_0x4beacf[_0x70ea('0x5d')][_0x70ea('0x89')][_0x5c699f],'VoiceQueueId':_0x4beacf[_0x70ea('0x4c')]['id']});}return _0x4acb89;});}})[_0x70ea('0x27')](function(_0x2fa51e){_0x2097c7=_0x2fa51e||[];if(_0x2ed54c){return db[_0x70ea('0x6f')][_0x70ea('0x49')]({'where':{'id':_0x4beacf[_0x70ea('0x5d')][_0x70ea('0x89')]},'attributes':['id',_0x70ea('0x35'),'online',_0x70ea('0x72'),'interface'],'raw':!![]});}})[_0x70ea('0x27')](function(_0x2ad304){if(!_[_0x70ea('0x8a')](_0x2ad304)){var _0x52af95=[];for(var _0x2cbc2f=0x0;_0x2cbc2f<_0x2ad304[_0x70ea('0x4f')];_0x2cbc2f++){if(_0x2ad304[_0x2cbc2f]['online']){_0x52af95[_0x70ea('0x84')](db[_0x70ea('0x7a')][_0x70ea('0x7b')]({'membername':_0x2ad304[_0x2cbc2f][_0x70ea('0x35')],'UserId':_0x2ad304[_0x2cbc2f]['id'],'queue_name':_0x2ed54c[_0x70ea('0x35')],'VoiceQueueId':_0x2ed54c['id'],'interface':_[_0x70ea('0x7c')](_0x2ad304[_0x2cbc2f][_0x70ea('0x73')])?util[_0x70ea('0x8f')](_0x70ea('0x7d'),_0x2ad304[_0x2cbc2f][_0x70ea('0x35')]):_0x2ad304[_0x2cbc2f][_0x70ea('0x73')],'paused':_0x2ad304[_0x2cbc2f][_0x70ea('0x72')]||![],'penalty':_0x4beacf[_0x70ea('0x5d')][_0x70ea('0x76')]||0x0}));}}return BPromise[_0x70ea('0x90')](_0x52af95);}})[_0x70ea('0x27')](function(){return _0x2097c7;})[_0x70ea('0x27')](respondWithResult(_0x2af96c,null))[_0x70ea('0x4a')](handleError(_0x2af96c,null));};exports[_0x70ea('0x8b')]=function(_0xc43895,_0x154a01,_0x55c270){return db[_0x70ea('0x38')][_0x70ea('0x52')]({'where':{'id':_0xc43895[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x154a01,null))[_0x70ea('0x27')](function(_0x2541ff){if(_0x2541ff){return _0x2541ff[_0x70ea('0x8b')](_0xc43895[_0x70ea('0x3b')]['ids'])[_0x70ea('0x27')](function(){if(_['isArray'](_0xc43895['query'][_0x70ea('0x89')])){for(var _0x3836f7=0x0;_0x3836f7<_0xc43895[_0x70ea('0x3b')][_0x70ea('0x89')][_0x70ea('0x4f')];_0x3836f7+=0x1){socket[_0x70ea('0x8c')](_0x70ea('0x91'),{'UserId':Number(_0xc43895['query']['ids'][_0x3836f7]),'VoiceQueueId':Number(_0xc43895['params']['id'])});}}else{socket[_0x70ea('0x8c')](_0x70ea('0x91'),{'UserId':Number(_0xc43895[_0x70ea('0x3b')][_0x70ea('0x89')]),'VoiceQueueId':Number(_0xc43895[_0x70ea('0x4c')]['id'])});}});}})[_0x70ea('0x27')](function(_0x3d3139){return db[_0x70ea('0x7a')][_0x70ea('0x28')]({'where':{'VoiceQueueId':_0xc43895[_0x70ea('0x4c')]['id'],'UserId':_0xc43895['query']['ids']}})[_0x70ea('0x27')](function(){return _0x3d3139;});})['then'](respondWithStatusCode(_0x154a01,null))[_0x70ea('0x4a')](handleError(_0x154a01,null));};exports[_0x70ea('0x92')]=function(_0xede346,_0x2b68aa,_0x3d97eb){var _0x1fb546={};var _0x4e8c31={};var _0x12ad91;var _0x479cec;return db[_0x70ea('0x38')][_0x70ea('0x62')]({'where':{'id':_0xede346[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x2b68aa,null))['then'](function(_0x3a4852){if(_0x3a4852){_0x12ad91=_0x3a4852;_0x4e8c31[_0x70ea('0x3a')]=_[_0x70ea('0x4d')](db[_0x70ea('0x6f')][_0x70ea('0x4e')]);_0x4e8c31['query']=_['keys'](_0xede346[_0x70ea('0x3b')]);_0x4e8c31[_0x70ea('0x3c')]=_[_0x70ea('0x3d')](_0x4e8c31['model'],_0x4e8c31[_0x70ea('0x3b')]);_0x1fb546['attributes']=_['intersection'](_0x4e8c31['model'],qs[_0x70ea('0x3f')](_0xede346[_0x70ea('0x3b')][_0x70ea('0x3f')]));_0x1fb546[_0x70ea('0x3e')]=_0x1fb546[_0x70ea('0x3e')][_0x70ea('0x4f')]?_0x1fb546[_0x70ea('0x3e')]:_0x4e8c31[_0x70ea('0x3a')];_0x1fb546[_0x70ea('0x41')]=qs[_0x70ea('0x42')](_0xede346[_0x70ea('0x3b')]['sort']);_0x1fb546[_0x70ea('0x43')]=qs['filters'](_['pick'](_0xede346['query'],_0x4e8c31['filters']));if(_0xede346['query']['filter']){_0x1fb546[_0x70ea('0x43')]=_[_0x70ea('0x51')](_0x1fb546[_0x70ea('0x43')],{'$or':_[_0x70ea('0x2f')](_0x1fb546['attributes'],function(_0x3e866){var _0x2bb629={};_0x2bb629[_0x3e866]={'$like':'%'+_0xede346[_0x70ea('0x3b')][_0x70ea('0x45')]+'%'};return _0x2bb629;})});}_0x1fb546=_[_0x70ea('0x51')]({},_0x1fb546,_0xede346[_0x70ea('0x47')]);return _0x12ad91[_0x70ea('0x92')](_0x1fb546);}})[_0x70ea('0x27')](function(_0x23e30){if(_0x23e30){_0x479cec=_0x23e30['length'];if(!_0xede346[_0x70ea('0x3b')][_0x70ea('0x40')](_0x70ea('0x63'))){_0x1fb546[_0x70ea('0x24')]=qs['limit'](_0xede346[_0x70ea('0x3b')][_0x70ea('0x24')]);_0x1fb546[_0x70ea('0x23')]=qs[_0x70ea('0x23')](_0xede346[_0x70ea('0x3b')][_0x70ea('0x23')]);}return _0x12ad91['getAgents'](_0x1fb546);}})['then'](function(_0x54a40e){if(_0x54a40e){return _0x54a40e?{'count':_0x479cec,'rows':_0x54a40e}:null;}})[_0x70ea('0x27')](respondWithResult(_0x2b68aa,null))['catch'](handleError(_0x2b68aa,null));};exports[_0x70ea('0x93')]=function(_0x5362bf,_0x59a472,_0x35eadf){var _0x5f0d59={};var _0x208958={};var _0x27f26c;var _0x799ec8;return db[_0x70ea('0x38')][_0x70ea('0x62')]({'where':{'id':_0x5362bf[_0x70ea('0x4c')]['id']}})['then'](handleEntityNotFound(_0x59a472,null))['then'](function(_0x59ffb9){if(_0x59ffb9){_0x27f26c=_0x59ffb9;_0x208958[_0x70ea('0x3a')]=_['keys'](db[_0x70ea('0x7a')]['rawAttributes']);_0x208958[_0x70ea('0x3b')]=_['keys'](_0x5362bf['query']);_0x208958[_0x70ea('0x3c')]=_['intersection'](_0x208958['model'],_0x208958['query']);_0x5f0d59['attributes']=_[_0x70ea('0x3d')](_0x208958[_0x70ea('0x3a')],qs[_0x70ea('0x3f')](_0x5362bf['query'][_0x70ea('0x3f')]));_0x5f0d59['attributes']=_0x5f0d59[_0x70ea('0x3e')][_0x70ea('0x4f')]?_0x5f0d59[_0x70ea('0x3e')]:_0x208958[_0x70ea('0x3a')];_0x5f0d59[_0x70ea('0x41')]=qs[_0x70ea('0x42')](_0x5362bf[_0x70ea('0x3b')]['sort']);_0x5f0d59['where']=qs[_0x70ea('0x3c')](_[_0x70ea('0x44')](_0x5362bf[_0x70ea('0x3b')],_0x208958[_0x70ea('0x3c')]));if(_0x5362bf[_0x70ea('0x3b')][_0x70ea('0x45')]){_0x5f0d59[_0x70ea('0x43')]=_[_0x70ea('0x51')](_0x5f0d59[_0x70ea('0x43')],{'$or':_[_0x70ea('0x2f')](_0x5f0d59['attributes'],function(_0x13b0f2){var _0x58c4c3={};_0x58c4c3[_0x13b0f2]={'$like':'%'+_0x5362bf[_0x70ea('0x3b')][_0x70ea('0x45')]+'%'};return _0x58c4c3;})});}_0x5f0d59=_[_0x70ea('0x51')]({},_0x5f0d59,_0x5362bf['options']);return _0x27f26c[_0x70ea('0x93')](_0x5f0d59);}})[_0x70ea('0x27')](function(_0x1c4bf){if(_0x1c4bf){_0x799ec8=_0x1c4bf['length'];if(!_0x5362bf[_0x70ea('0x3b')]['hasOwnProperty']('nolimit')){_0x5f0d59[_0x70ea('0x24')]=qs[_0x70ea('0x24')](_0x5362bf[_0x70ea('0x3b')]['limit']);_0x5f0d59[_0x70ea('0x23')]=qs['offset'](_0x5362bf['query'][_0x70ea('0x23')]);}return _0x27f26c[_0x70ea('0x93')](_0x5f0d59);}})[_0x70ea('0x27')](function(_0x24feed){return _0x24feed?{'count':_0x799ec8,'rows':_0x24feed}:null;})[_0x70ea('0x27')](respondWithResult(_0x59a472,null))['catch'](handleError(_0x59a472,null));};exports[_0x70ea('0x94')]=function(_0x5e13d0,_0x46783a,_0x3f576f){var _0x1289a7={};var _0x147d53={};var _0x4ca29d;var _0x676c2a;return db[_0x70ea('0x38')][_0x70ea('0x62')]({'where':{'id':_0x5e13d0['params']['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x46783a,null))[_0x70ea('0x27')](function(_0x3a9973){if(_0x3a9973){_0x4ca29d=_0x3a9973;_0x147d53['model']=_[_0x70ea('0x4d')](db[_0x70ea('0x95')][_0x70ea('0x4e')]);_0x147d53[_0x70ea('0x3b')]=_[_0x70ea('0x4d')](_0x5e13d0[_0x70ea('0x3b')]);_0x147d53[_0x70ea('0x3c')]=_['intersection'](_0x147d53['model'],_0x147d53['query']);_0x1289a7['attributes']=_[_0x70ea('0x3d')](_0x147d53['model'],qs[_0x70ea('0x3f')](_0x5e13d0[_0x70ea('0x3b')]['fields']));_0x1289a7['attributes']=_0x1289a7[_0x70ea('0x3e')][_0x70ea('0x4f')]?_0x1289a7[_0x70ea('0x3e')]:_0x147d53[_0x70ea('0x3a')];_0x1289a7[_0x70ea('0x41')]=qs[_0x70ea('0x42')](_0x5e13d0['query']['sort']);_0x1289a7[_0x70ea('0x43')]=qs[_0x70ea('0x3c')](_[_0x70ea('0x44')](_0x5e13d0[_0x70ea('0x3b')],_0x147d53[_0x70ea('0x3c')]));if(_0x5e13d0[_0x70ea('0x3b')][_0x70ea('0x45')]){_0x1289a7[_0x70ea('0x43')]=_['merge'](_0x1289a7['where'],{'$or':_[_0x70ea('0x2f')](_0x1289a7[_0x70ea('0x3e')],function(_0x50e433){var _0xae9aba={};_0xae9aba[_0x50e433]={'$like':'%'+_0x5e13d0[_0x70ea('0x3b')]['filter']+'%'};return _0xae9aba;})});}_0x1289a7=_[_0x70ea('0x51')]({},_0x1289a7,_0x5e13d0[_0x70ea('0x47')]);return _0x4ca29d['getLists'](_0x1289a7);}})[_0x70ea('0x27')](function(_0x31e137){if(_0x31e137){_0x676c2a=_0x31e137['length'];if(!_0x5e13d0[_0x70ea('0x3b')][_0x70ea('0x40')]('nolimit')){_0x1289a7[_0x70ea('0x24')]=qs[_0x70ea('0x24')](_0x5e13d0[_0x70ea('0x3b')][_0x70ea('0x24')]);_0x1289a7[_0x70ea('0x23')]=qs[_0x70ea('0x23')](_0x5e13d0[_0x70ea('0x3b')][_0x70ea('0x23')]);}return _0x4ca29d[_0x70ea('0x94')](_0x1289a7);}})[_0x70ea('0x27')](function(_0x4d1685){if(_0x4d1685){return _0x4d1685?{'count':_0x676c2a,'rows':_0x4d1685}:null;}})['then'](respondWithResult(_0x46783a,null))[_0x70ea('0x4a')](handleError(_0x46783a,null));};exports[_0x70ea('0x96')]=function(_0x5db266,_0x4da8f2,_0x213cd4){var _0x3ea542,_0x5831fe;return db[_0x70ea('0x38')]['find']({'where':{'id':_0x5db266[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x4da8f2,null))['then'](function(_0x5c4dc6){if(_0x5c4dc6){_0x5831fe=_0x5c4dc6;return _0x5c4dc6[_0x70ea('0x96')](_0x5db266[_0x70ea('0x5d')][_0x70ea('0x89')],_['omit'](_0x5db266[_0x70ea('0x5d')],['ids','id'])||{});}return null;})[_0x70ea('0x8e')](function(_0x150775){var _0x100724;_0x3ea542=_0x150775||[];var _0x4db76d=[];if(_0x150775){for(var _0x87a737=0x0;_0x87a737<_0x150775[_0x70ea('0x4f')];_0x87a737+=0x1){var _0x1e1947=_0x150775[_0x87a737][_0x70ea('0x29')]({'plain':!![]});_0x5831fe[_0x70ea('0x97')]=_0x5db266[_0x70ea('0x5d')][_0x70ea('0x97')]?_0x5db266[_0x70ea('0x5d')]['dialCheckDuplicateType']:_0x5831fe[_0x70ea('0x97')];switch(_0x5831fe['dialCheckDuplicateType']){case _0x70ea('0x98'):_0x100724=squel['insert']()[_0x70ea('0x99')](_0x70ea('0x9a'))['fromQuery']([_0x70ea('0x9b'),_0x70ea('0x9c'),'ContactId',_0x70ea('0x9d'),_0x70ea('0x64'),_0x70ea('0x5c'),_0x70ea('0x5e')],squel[_0x70ea('0x7f')]()[_0x70ea('0x9e')](_0x70ea('0x9b'),_0x70ea('0x9b'))[_0x70ea('0x9e')]('NOW()',_0x70ea('0x9c'))['field']('id','ContactId')[_0x70ea('0x9e')](_0x1e1947[_0x70ea('0x9f')][_0x70ea('0x85')](),_0x70ea('0x9d'))[_0x70ea('0x9e')](_0x5db266[_0x70ea('0x4c')]['id']['toString'](),_0x70ea('0x64'))[_0x70ea('0x9e')]('NOW()',_0x70ea('0x5c'))['field']('NOW()',_0x70ea('0x5e'))[_0x70ea('0x81')](_0x70ea('0xa0'))[_0x70ea('0x43')]('deletedAt\x20IS\x20NULL')['where'](_0x70ea('0xa1'),_0x1e1947[_0x70ea('0x9f')][_0x70ea('0x85')]())[_0x70ea('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x70ea('0x43')](_0x70ea('0xa2'),squel[_0x70ea('0x7f')]()[_0x70ea('0x9e')](_0x70ea('0xa3'))[_0x70ea('0x81')](_0x70ea('0xa4'))[_0x70ea('0x43')](_0x70ea('0x83'),_0x5db266['params']['id']['toString']()))[_0x70ea('0x43')](_0x70ea('0xa2'),squel[_0x70ea('0x7f')]()[_0x70ea('0x9e')]('COALESCE(phone,\x27\x27)')[_0x70ea('0x81')](_0x70ea('0x9a'))[_0x70ea('0x43')](_0x70ea('0x83'),_0x5db266[_0x70ea('0x4c')]['id'][_0x70ea('0x85')]())))[_0x70ea('0x85')]();break;case _0x70ea('0xa5'):_0x100724=squel[_0x70ea('0xa6')]()[_0x70ea('0x99')](_0x70ea('0x9a'))[_0x70ea('0xa7')](['phone','scheduledAt',_0x70ea('0xa8'),'ListId',_0x70ea('0x64'),_0x70ea('0x5c'),_0x70ea('0x5e')],squel[_0x70ea('0x7f')]()[_0x70ea('0x9e')](_0x70ea('0x9b'),_0x70ea('0x9b'))[_0x70ea('0x9e')](_0x70ea('0xa9'),_0x70ea('0x9c'))[_0x70ea('0x9e')]('id','ContactId')[_0x70ea('0x9e')](_0x1e1947[_0x70ea('0x9f')][_0x70ea('0x85')](),_0x70ea('0x9d'))['field'](_0x5db266[_0x70ea('0x4c')]['id'][_0x70ea('0x85')](),_0x70ea('0x64'))[_0x70ea('0x9e')](_0x70ea('0xa9'),_0x70ea('0x5c'))[_0x70ea('0x9e')](_0x70ea('0xa9'),_0x70ea('0x5e'))[_0x70ea('0x81')]('cm_contacts')[_0x70ea('0x43')](_0x70ea('0xaa'))['where']('ListId\x20=\x20?',_0x1e1947[_0x70ea('0x9f')][_0x70ea('0x85')]())[_0x70ea('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x70ea('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x70ea('0x7f')]()[_0x70ea('0x9e')](_0x70ea('0xab'))[_0x70ea('0x81')](_0x70ea('0x9a'))[_0x70ea('0x43')](_0x70ea('0x83'),_0x5db266[_0x70ea('0x4c')]['id']['toString']())))[_0x70ea('0x85')]();break;default:_0x100724=squel[_0x70ea('0xa6')]()[_0x70ea('0x99')](_0x70ea('0x9a'))[_0x70ea('0xa7')]([_0x70ea('0x9b'),'scheduledAt','ContactId',_0x70ea('0x9d'),_0x70ea('0x64'),_0x70ea('0x5c'),'updatedAt'],squel[_0x70ea('0x7f')]()[_0x70ea('0x9e')](_0x70ea('0x9b'),_0x70ea('0x9b'))[_0x70ea('0x9e')](_0x70ea('0xa9'),_0x70ea('0x9c'))['field']('id',_0x70ea('0xa8'))[_0x70ea('0x9e')](_0x1e1947[_0x70ea('0x9f')][_0x70ea('0x85')](),_0x70ea('0x9d'))[_0x70ea('0x9e')](_0x5db266['params']['id']['toString'](),_0x70ea('0x64'))[_0x70ea('0x9e')]('NOW()',_0x70ea('0x5c'))['field'](_0x70ea('0xa9'),_0x70ea('0x5e'))[_0x70ea('0x81')](_0x70ea('0xa0'))['where'](_0x70ea('0xaa'))['where'](_0x70ea('0xa1'),_0x1e1947[_0x70ea('0x9f')][_0x70ea('0x85')]())[_0x70ea('0x43')](_0x70ea('0xac')))['toString']();}_0x4db76d[_0x70ea('0x84')](db[_0x70ea('0x77')][_0x70ea('0x3b')](_0x100724));}return BPromise[_0x70ea('0x90')](_0x4db76d);}})[_0x70ea('0x27')](function(){return _0x3ea542;})[_0x70ea('0x27')](respondWithResult(_0x4da8f2,null))[_0x70ea('0x4a')](handleError(_0x4da8f2,null));};exports[_0x70ea('0xad')]=function(_0x5b20b5,_0x43b310,_0x144efe){return db[_0x70ea('0x38')][_0x70ea('0x52')]({'where':{'id':_0x5b20b5[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x43b310,null))[_0x70ea('0x27')](function(_0x11aa0e){if(_0x11aa0e){return _0x11aa0e['removeLists'](_0x5b20b5[_0x70ea('0x3b')][_0x70ea('0x89')]);}})[_0x70ea('0x27')](function(_0x6d14b6){if(_0x6d14b6){return db['CmHopper'][_0x70ea('0x28')]({'where':{'ListId':_0x5b20b5[_0x70ea('0x3b')][_0x70ea('0x89')],'VoiceQueueId':_0x5b20b5[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](function(){return _0x6d14b6;});}})['then'](respondWithStatusCode(_0x43b310,null))[_0x70ea('0x4a')](handleError(_0x43b310,null));};exports[_0x70ea('0xae')]=function(_0x561fdd,_0x133a91,_0x5d20b4){var _0xef9a0={};var _0xc971f1={};var _0xc93f16;var _0x46d314;return db[_0x70ea('0x38')][_0x70ea('0x62')]({'where':{'id':_0x561fdd[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x133a91,null))[_0x70ea('0x27')](function(_0x200800){if(_0x200800){_0xc93f16=_0x200800;_0xc971f1[_0x70ea('0x3a')]=_[_0x70ea('0x4d')](db['CmList'][_0x70ea('0x4e')]);_0xc971f1[_0x70ea('0x3b')]=_['keys'](_0x561fdd['query']);_0xc971f1[_0x70ea('0x3c')]=_[_0x70ea('0x3d')](_0xc971f1[_0x70ea('0x3a')],_0xc971f1[_0x70ea('0x3b')]);_0xef9a0['attributes']=_[_0x70ea('0x3d')](_0xc971f1['model'],qs[_0x70ea('0x3f')](_0x561fdd[_0x70ea('0x3b')][_0x70ea('0x3f')]));_0xef9a0[_0x70ea('0x3e')]=_0xef9a0['attributes'][_0x70ea('0x4f')]?_0xef9a0[_0x70ea('0x3e')]:_0xc971f1['model'];_0xef9a0[_0x70ea('0x41')]=qs[_0x70ea('0x42')](_0x561fdd['query'][_0x70ea('0x42')]);_0xef9a0[_0x70ea('0x43')]=qs[_0x70ea('0x3c')](_[_0x70ea('0x44')](_0x561fdd[_0x70ea('0x3b')],_0xc971f1['filters']));if(_0x561fdd[_0x70ea('0x3b')][_0x70ea('0x45')]){_0xef9a0[_0x70ea('0x43')]=_['merge'](_0xef9a0[_0x70ea('0x43')],{'$or':_[_0x70ea('0x2f')](_0xef9a0['attributes'],function(_0x97c8fe){var _0x2673e3={};_0x2673e3[_0x97c8fe]={'$like':'%'+_0x561fdd[_0x70ea('0x3b')][_0x70ea('0x45')]+'%'};return _0x2673e3;})});}_0xef9a0=_[_0x70ea('0x51')]({},_0xef9a0,_0x561fdd[_0x70ea('0x47')]);return _0xc93f16[_0x70ea('0xae')](_0xef9a0);}})[_0x70ea('0x27')](function(_0x19e878){if(_0x19e878){_0x46d314=_0x19e878['length'];if(!_0x561fdd['query'][_0x70ea('0x40')](_0x70ea('0x63'))){_0xef9a0['limit']=qs['limit'](_0x561fdd[_0x70ea('0x3b')][_0x70ea('0x24')]);_0xef9a0[_0x70ea('0x23')]=qs[_0x70ea('0x23')](_0x561fdd[_0x70ea('0x3b')][_0x70ea('0x23')]);}return _0xc93f16['getBlackLists'](_0xef9a0);}})[_0x70ea('0x27')](function(_0x528943){if(_0x528943){return _0x528943?{'count':_0x46d314,'rows':_0x528943}:null;}})[_0x70ea('0x27')](respondWithResult(_0x133a91,null))[_0x70ea('0x4a')](handleError(_0x133a91,null));};exports[_0x70ea('0xaf')]=function(_0x26af77,_0x594595,_0x250d7c){var _0x2c8075,_0x3daf8e;return db[_0x70ea('0x38')][_0x70ea('0x52')]({'where':{'id':_0x26af77[_0x70ea('0x4c')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x594595,null))['then'](function(_0x577a9e){if(_0x577a9e){_0x3daf8e=_0x577a9e;return _0x577a9e['addBlackLists'](_0x26af77[_0x70ea('0x5d')][_0x70ea('0x89')],_[_0x70ea('0x5b')](_0x26af77[_0x70ea('0x5d')],[_0x70ea('0x89'),'id'])||{});}return null;})['spread'](function(_0x22f289){var _0x26f449;_0x2c8075=_0x22f289||[];var _0x2f4667=[];if(_0x22f289){for(var _0x5c2b8e=0x0;_0x5c2b8e<_0x22f289['length'];_0x5c2b8e+=0x1){var _0x1c7f8a=_0x22f289[_0x5c2b8e][_0x70ea('0x29')]({'plain':!![]});_0x26f449=squel[_0x70ea('0xa6')]()['into']('cm_hopper_black')[_0x70ea('0xa7')]([_0x70ea('0x9b'),_0x70ea('0xa8'),_0x70ea('0x9d'),'VoiceQueueId',_0x70ea('0x5c'),_0x70ea('0x5e')],squel[_0x70ea('0x7f')]()['field'](_0x70ea('0x9b'),_0x70ea('0x9b'))[_0x70ea('0x9e')]('id',_0x70ea('0xa8'))[_0x70ea('0x9e')](_0x1c7f8a[_0x70ea('0x9f')][_0x70ea('0x85')](),'ListId')[_0x70ea('0x9e')](_0x26af77[_0x70ea('0x4c')]['id'][_0x70ea('0x85')](),_0x70ea('0x64'))[_0x70ea('0x9e')]('NOW()',_0x70ea('0x5c'))[_0x70ea('0x9e')]('NOW()',_0x70ea('0x5e'))[_0x70ea('0x81')]('cm_contacts')['where'](_0x70ea('0xaa'))[_0x70ea('0x43')](_0x70ea('0xa1'),_0x1c7f8a[_0x70ea('0x9f')][_0x70ea('0x85')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x70ea('0x85')]();_0x2f4667[_0x70ea('0x84')](db[_0x70ea('0x77')]['query'](_0x26f449));}return BPromise[_0x70ea('0x90')](_0x2f4667);}})[_0x70ea('0x27')](function(){return _0x2c8075;})[_0x70ea('0x27')](respondWithResult(_0x594595,null))[_0x70ea('0x4a')](handleError(_0x594595,null));};exports[_0x70ea('0xb0')]=function(_0x319beb,_0x1f9125,_0x511361){return db[_0x70ea('0x38')][_0x70ea('0x52')]({'where':{'id':_0x319beb[_0x70ea('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f9125,null))[_0x70ea('0x27')](function(_0x29fdf2){if(_0x29fdf2){return _0x29fdf2[_0x70ea('0xb0')](_0x319beb[_0x70ea('0x3b')][_0x70ea('0x89')]);}})['then'](function(_0x1a3750){if(_0x1a3750){return db['CmHopperBlack'][_0x70ea('0x28')]({'where':{'ListId':_0x319beb[_0x70ea('0x3b')][_0x70ea('0x89')],'VoiceQueueId':_0x319beb[_0x70ea('0x4c')]['id']}})['then'](function(){return _0x1a3750;});}})['then'](respondWithStatusCode(_0x1f9125,null))[_0x70ea('0x4a')](handleError(_0x1f9125,null));}; \ No newline at end of file +var _0x7bf2=['ContactId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','VoiceQueueId\x20=\x20?','onlyIfOpen','insert','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','error','send','VoiceQueue','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','merge','VIRTUAL','options','includeAll','rows','show','length','include','catch','create','body','user','UserProfileSection','autoAssociation','clone','rawAttributes','omit','updatedAt','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','findOne','CmHopper','hasOwnProperty','pick','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','upsert','isNil','emit','userVoiceQueue:save','removeTeams','ids','User','select','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','format','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','field','NOW()'];(function(_0x61a493,_0x54e11e){var _0x3c1bbe=function(_0x3d4634){while(--_0x3d4634){_0x61a493['push'](_0x61a493['shift']());}};_0x3c1bbe(++_0x54e11e);}(_0x7bf2,0xc8));var _0x27bf=function(_0x5a0555,_0x499709){_0x5a0555=_0x5a0555-0x0;var _0x39f18c=_0x7bf2[_0x5a0555];return _0x39f18c;};'use strict';var pdf=require(_0x27bf('0x0'));var emlformat=require(_0x27bf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x27bf('0x2'));var jsonpatch=require(_0x27bf('0x3'));var rp=require(_0x27bf('0x4'));var moment=require('moment');var BPromise=require(_0x27bf('0x5'));var Mustache=require('mustache');var util=require(_0x27bf('0x6'));var path=require(_0x27bf('0x7'));var sox=require(_0x27bf('0x8'));var csv=require(_0x27bf('0x9'));var ejs=require(_0x27bf('0xa'));var fs=require('fs');var _=require(_0x27bf('0xb'));var squel=require(_0x27bf('0xc'));var crypto=require(_0x27bf('0xd'));var jsforce=require(_0x27bf('0xe'));var deskjs=require(_0x27bf('0xf'));var toCsv=require(_0x27bf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x27bf('0x10'));var authService=require(_0x27bf('0x11'));var qs=require(_0x27bf('0x12'));var as=require(_0x27bf('0x13'));var hardwareService=require(_0x27bf('0x14'));var logger=require('../../config/logger')(_0x27bf('0x15'));var utils=require(_0x27bf('0x16'));var config=require(_0x27bf('0x17'));var db=require(_0x27bf('0x18'))['db'];config[_0x27bf('0x19')]=_[_0x27bf('0x1a')](config['redis'],{'host':_0x27bf('0x1b'),'port':0x18eb});var socket=require(_0x27bf('0x1c'))(new Redis(config[_0x27bf('0x19')]));require('./voiceQueue.socket')[_0x27bf('0x1d')](socket);function respondWithStatusCode(_0x42ed48,_0x41908a){_0x41908a=_0x41908a||0xcc;return function(_0x3dca18){if(_0x3dca18){return _0x42ed48[_0x27bf('0x1e')](_0x41908a);}return _0x42ed48['status'](_0x41908a)[_0x27bf('0x1f')]();};}function respondWithResult(_0x4d0d43,_0xc92957){_0xc92957=_0xc92957||0xc8;return function(_0x18ce9b){if(_0x18ce9b){return _0x4d0d43[_0x27bf('0x20')](_0xc92957)[_0x27bf('0x21')](_0x18ce9b);}};}function respondWithFilteredResult(_0x22c19f,_0xfff594){return function(_0x294465){if(_0x294465){var _0x3b8e5e=_0x294465[_0x27bf('0x22')],_0x564bb5=_0xfff594[_0x27bf('0x23')],_0x9f9646=_0xfff594[_0x27bf('0x23')]+_0xfff594['limit'],_0x96f0cb;if(_0x9f9646>=_0x3b8e5e){_0x9f9646=_0x3b8e5e;_0x96f0cb=0xc8;}else{_0x96f0cb=0xce;}_0x22c19f['status'](_0x96f0cb);return _0x22c19f[_0x27bf('0x24')](_0x27bf('0x25'),_0x564bb5+'-'+_0x9f9646+'/'+_0x3b8e5e)[_0x27bf('0x21')](_0x294465);}return null;};}function patchUpdates(_0x265bb0){return function(_0x5c9a35){try{jsonpatch[_0x27bf('0x26')](_0x5c9a35,_0x265bb0,!![]);}catch(_0x69af7f){return BPromise[_0x27bf('0x27')](_0x69af7f);}return _0x5c9a35[_0x27bf('0x28')]();};}function saveUpdates(_0x265b7a,_0x14e049){return function(_0x312f2e){if(_0x312f2e){return _0x312f2e[_0x27bf('0x29')](_0x265b7a)[_0x27bf('0x2a')](function(_0x377715){return _0x377715;});}return null;};}function removeEntity(_0x127372,_0x2c2a45){return function(_0x3135f1){if(_0x3135f1){return _0x3135f1[_0x27bf('0x2b')]()[_0x27bf('0x2a')](function(){var _0x5ccac7=_0x3135f1[_0x27bf('0x2c')]({'plain':!![]});var _0x2b92b9=[{'name':_0x27bf('0x2d'),'value':_0x27bf('0x2e'),'ignore':![]},{'name':_0x27bf('0x2f'),'value':_0x27bf('0x30'),'ignore':![]}];var _0x7cce92=_(_0x2b92b9)[_0x27bf('0x31')]('ignore')[_0x27bf('0x32')]('value')[_0x27bf('0x33')]();if(_[_0x27bf('0x34')](_0x7cce92,_0x5ccac7[_0x27bf('0x35')])){return;}var _0x29d9b2=_[_0x27bf('0x36')](_0x2b92b9,[_0x27bf('0x33'),_0x5ccac7[_0x27bf('0x35')]])[_0x27bf('0x37')];return db[_0x27bf('0x38')][_0x27bf('0x2b')]({'where':{'type':_0x29d9b2,'resourceId':_0x5ccac7['id']}})[_0x27bf('0x2a')](function(){return _0x3135f1;});})[_0x27bf('0x2a')](function(){_0x127372[_0x27bf('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ada0,_0x224644){return function(_0xabc95c){if(!_0xabc95c){_0x52ada0['sendStatus'](0x194);}return _0xabc95c;};}function handleError(_0x449855,_0x50ee62){_0x50ee62=_0x50ee62||0x1f4;return function(_0x427c16){logger[_0x27bf('0x39')](_0x427c16['stack']);if(_0x427c16[_0x27bf('0x37')]){delete _0x427c16[_0x27bf('0x37')];}_0x449855['status'](_0x50ee62)[_0x27bf('0x3a')](_0x427c16);};}exports['index']=function(_0x59c609,_0x4c4f89){var _0x12c9fb={},_0x1a4b26={},_0x22d502={'count':0x0,'rows':[]};var _0x170d16=_['map'](db[_0x27bf('0x3b')]['rawAttributes'],function(_0x14753a){return{'name':_0x14753a[_0x27bf('0x3c')],'type':_0x14753a[_0x27bf('0x35')]['key']};});_0x1a4b26[_0x27bf('0x3d')]=_[_0x27bf('0x32')](_0x170d16,_0x27bf('0x37'));_0x1a4b26[_0x27bf('0x3e')]=_[_0x27bf('0x3f')](_0x59c609['query']);_0x1a4b26[_0x27bf('0x40')]=_[_0x27bf('0x41')](_0x1a4b26[_0x27bf('0x3d')],_0x1a4b26[_0x27bf('0x3e')]);_0x12c9fb[_0x27bf('0x42')]=_[_0x27bf('0x41')](_0x1a4b26[_0x27bf('0x3d')],qs[_0x27bf('0x43')](_0x59c609['query'][_0x27bf('0x43')]));_0x12c9fb['attributes']=_0x12c9fb[_0x27bf('0x42')]['length']?_0x12c9fb[_0x27bf('0x42')]:_0x1a4b26[_0x27bf('0x3d')];if(!_0x59c609[_0x27bf('0x3e')]['hasOwnProperty'](_0x27bf('0x44'))){_0x12c9fb[_0x27bf('0x45')]=qs[_0x27bf('0x45')](_0x59c609['query'][_0x27bf('0x45')]);_0x12c9fb[_0x27bf('0x23')]=qs[_0x27bf('0x23')](_0x59c609['query'][_0x27bf('0x23')]);}_0x12c9fb[_0x27bf('0x46')]=qs[_0x27bf('0x47')](_0x59c609[_0x27bf('0x3e')][_0x27bf('0x47')]);_0x12c9fb[_0x27bf('0x48')]=qs[_0x27bf('0x40')](_['pick'](_0x59c609[_0x27bf('0x3e')],_0x1a4b26[_0x27bf('0x40')]),_0x170d16);if(_0x59c609['query'][_0x27bf('0x31')]){_0x12c9fb[_0x27bf('0x48')]=_[_0x27bf('0x49')](_0x12c9fb[_0x27bf('0x48')],{'$or':_[_0x27bf('0x32')](_0x170d16,function(_0x549401){if(_0x549401[_0x27bf('0x35')]!==_0x27bf('0x4a')){var _0x2807eb={};_0x2807eb[_0x549401[_0x27bf('0x37')]]={'$like':'%'+_0x59c609[_0x27bf('0x3e')][_0x27bf('0x31')]+'%'};return _0x2807eb;}})});}_0x12c9fb=_[_0x27bf('0x49')]({},_0x12c9fb,_0x59c609[_0x27bf('0x4b')]);var _0x2b4289={'where':_0x12c9fb[_0x27bf('0x48')]};return db[_0x27bf('0x3b')][_0x27bf('0x22')](_0x2b4289)[_0x27bf('0x2a')](function(_0x117596){_0x22d502[_0x27bf('0x22')]=_0x117596;if(_0x59c609[_0x27bf('0x3e')][_0x27bf('0x4c')]){_0x12c9fb['include']=[{'all':!![]}];}return db[_0x27bf('0x3b')]['findAll'](_0x12c9fb);})[_0x27bf('0x2a')](function(_0x4f4b14){_0x22d502[_0x27bf('0x4d')]=_0x4f4b14;return _0x22d502;})[_0x27bf('0x2a')](respondWithFilteredResult(_0x4c4f89,_0x12c9fb))['catch'](handleError(_0x4c4f89,null));};exports[_0x27bf('0x4e')]=function(_0x489b0f,_0x32fd18){var _0x39febb={'raw':![],'where':{'id':_0x489b0f['params']['id']}},_0x3af6d5={};_0x3af6d5['model']=_[_0x27bf('0x3f')](db['VoiceQueue']['rawAttributes']);_0x3af6d5[_0x27bf('0x3e')]=_[_0x27bf('0x3f')](_0x489b0f[_0x27bf('0x3e')]);_0x3af6d5[_0x27bf('0x40')]=_[_0x27bf('0x41')](_0x3af6d5[_0x27bf('0x3d')],_0x3af6d5[_0x27bf('0x3e')]);_0x39febb[_0x27bf('0x42')]=_['intersection'](_0x3af6d5[_0x27bf('0x3d')],qs[_0x27bf('0x43')](_0x489b0f[_0x27bf('0x3e')][_0x27bf('0x43')]));_0x39febb['attributes']=_0x39febb[_0x27bf('0x42')][_0x27bf('0x4f')]?_0x39febb[_0x27bf('0x42')]:_0x3af6d5[_0x27bf('0x3d')];if(_0x489b0f['query']['includeAll']){_0x39febb[_0x27bf('0x50')]=[{'all':!![]}];}_0x39febb=_[_0x27bf('0x49')]({},_0x39febb,_0x489b0f['options']);return db[_0x27bf('0x3b')][_0x27bf('0x36')](_0x39febb)[_0x27bf('0x2a')](handleEntityNotFound(_0x32fd18,null))[_0x27bf('0x2a')](respondWithResult(_0x32fd18,null))[_0x27bf('0x51')](handleError(_0x32fd18,null));};exports[_0x27bf('0x52')]=function(_0x1a2ba3,_0x3935c0){return db['VoiceQueue'][_0x27bf('0x52')](_0x1a2ba3[_0x27bf('0x53')],{})[_0x27bf('0x2a')](function(_0x241b20){var _0x4233e3=_0x1a2ba3[_0x27bf('0x54')]['get']({'plain':!![]});if(!_0x4233e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4233e3['role']===_0x27bf('0x54')){var _0x3c9b7c=_0x241b20[_0x27bf('0x2c')]({'plain':!![]});var _0x291978=[{'name':_0x27bf('0x2d'),'value':_0x27bf('0x2e')},{'name':_0x27bf('0x2f'),'value':'outbound'}];var _0x3cb1a7=_['find'](_0x291978,[_0x27bf('0x33'),_0x3c9b7c['type']])['name'];return db[_0x27bf('0x55')]['find']({'where':{'name':_0x3cb1a7,'userProfileId':_0x4233e3['userProfileId']},'raw':!![]})['then'](function(_0x538917){if(_0x538917&&_0x538917[_0x27bf('0x56')]===0x0){return db[_0x27bf('0x38')][_0x27bf('0x52')]({'name':_0x3c9b7c[_0x27bf('0x37')],'resourceId':_0x3c9b7c['id'],'type':_0x538917['name'],'sectionId':_0x538917['id']},{})['then'](function(){return _0x241b20;});}else{return _0x241b20;}})[_0x27bf('0x51')](function(_0x41fd26){logger[_0x27bf('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41fd26);throw _0x41fd26;});}return _0x241b20;})[_0x27bf('0x2a')](respondWithResult(_0x3935c0,0xc9))[_0x27bf('0x51')](handleError(_0x3935c0,null));};exports[_0x27bf('0x57')]=function(_0x5b2dfe,_0x1f2fe0){var _0x37c93f={'where':{'id':_0x5b2dfe['params']['id']}},_0x172fe1={};_0x172fe1[_0x27bf('0x3d')]=_[_0x27bf('0x3f')](db[_0x27bf('0x3b')][_0x27bf('0x58')]);_0x37c93f['attributes']=_[_0x27bf('0x41')](_0x172fe1['model'],qs[_0x27bf('0x43')](_0x5b2dfe[_0x27bf('0x3e')][_0x27bf('0x43')]));_0x37c93f[_0x27bf('0x42')]=_0x37c93f['attributes'][_0x27bf('0x4f')]?_0x37c93f['attributes']:_0x172fe1['model'];if(_0x5b2dfe['query']['includeAll']){_0x37c93f[_0x27bf('0x50')]=[{'all':!![]}];}_0x37c93f=_[_0x27bf('0x49')]({},_0x37c93f,_0x5b2dfe['options']);return db[_0x27bf('0x3b')]['find'](_0x37c93f)[_0x27bf('0x2a')](handleEntityNotFound(_0x1f2fe0,null))[_0x27bf('0x2a')](function(_0x1d358a){if(_0x1d358a){var _0xa0b317=_0x1d358a[_0x27bf('0x2c')]({'plain':!![]});_0xa0b317=qs[_0x27bf('0x59')](_0xa0b317,['id','createdAt',_0x27bf('0x5a')]);_0x5b2dfe['body']=_['omit'](_0x5b2dfe['body'],['id',_0x27bf('0x5b'),_0x27bf('0x5a')]);return db[_0x27bf('0x3b')][_0x27bf('0x52')](_[_0x27bf('0x49')](_0xa0b317,_0x5b2dfe[_0x27bf('0x53')]),{'include':_0x5b2dfe[_0x27bf('0x3e')][_0x27bf('0x4c')]?[{'all':!![]}]:undefined})[_0x27bf('0x2a')](function(_0x3d577a){var _0x4052f2=_0x5b2dfe[_0x27bf('0x54')][_0x27bf('0x2c')]({'plain':!![]});if(!_0x4052f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4052f2['role']===_0x27bf('0x54')){var _0x47e674=_0x3d577a[_0x27bf('0x2c')]({'plain':!![]});var _0x5f18d9=[{'name':_0x27bf('0x2d'),'value':'inbound'},{'name':_0x27bf('0x2f'),'value':'outbound'}];var _0x4694fe=_[_0x27bf('0x36')](_0x5f18d9,[_0x27bf('0x33'),_0x47e674['type']])[_0x27bf('0x37')];return db[_0x27bf('0x55')][_0x27bf('0x36')]({'where':{'name':_0x4694fe,'userProfileId':_0x4052f2[_0x27bf('0x5c')]},'raw':!![]})['then'](function(_0xe8c69e){if(_0xe8c69e&&_0xe8c69e[_0x27bf('0x56')]===0x0){return db[_0x27bf('0x38')]['create']({'name':_0x47e674['name'],'resourceId':_0x47e674['id'],'type':_0xe8c69e[_0x27bf('0x37')],'sectionId':_0xe8c69e['id']},{})[_0x27bf('0x2a')](function(){return _0x3d577a;});}else{return _0x3d577a;}})['catch'](function(_0x48b65a){logger[_0x27bf('0x39')](_0x27bf('0x5d'),_0x48b65a);throw _0x48b65a;});}return _0x3d577a;});}})[_0x27bf('0x2a')](respondWithResult(_0x1f2fe0,0xc9))[_0x27bf('0x51')](handleError(_0x1f2fe0,null));};exports[_0x27bf('0x29')]=function(_0x4263c9,_0xdb48cf){if(_0x4263c9[_0x27bf('0x53')]['id']){delete _0x4263c9['body']['id'];}return db[_0x27bf('0x3b')]['find']({'where':{'id':_0x4263c9[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0xdb48cf,null))[_0x27bf('0x2a')](saveUpdates(_0x4263c9[_0x27bf('0x53')],null))[_0x27bf('0x2a')](respondWithResult(_0xdb48cf,null))[_0x27bf('0x51')](handleError(_0xdb48cf,null));};exports['destroy']=function(_0x4bae3a,_0x36150a){return db['VoiceQueue']['find']({'where':{'id':_0x4bae3a[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x36150a,null))['then'](removeEntity(_0x36150a,null))[_0x27bf('0x51')](handleError(_0x36150a,null));};exports[_0x27bf('0x5f')]=function(_0x13592f,_0x46eb7d,_0x17f7ff){var _0x578de0={'raw':![],'where':{}};var _0x53a4cf={};var _0x31a46b={'count':0x0,'rows':[]};return db[_0x27bf('0x3b')][_0x27bf('0x60')]({'where':{'id':_0x13592f['params']['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x46eb7d,null))[_0x27bf('0x2a')](function(_0x5783b3){if(_0x5783b3){_0x53a4cf[_0x27bf('0x3d')]=_['keys'](db[_0x27bf('0x61')][_0x27bf('0x58')]);_0x53a4cf['query']=_[_0x27bf('0x3f')](_0x13592f[_0x27bf('0x3e')]);_0x53a4cf[_0x27bf('0x40')]=_[_0x27bf('0x41')](_0x53a4cf[_0x27bf('0x3d')],_0x53a4cf['query']);_0x578de0['attributes']=_['intersection'](_0x53a4cf[_0x27bf('0x3d')],qs[_0x27bf('0x43')](_0x13592f[_0x27bf('0x3e')][_0x27bf('0x43')]));_0x578de0[_0x27bf('0x42')]=_0x578de0[_0x27bf('0x42')][_0x27bf('0x4f')]?_0x578de0[_0x27bf('0x42')]:_0x53a4cf[_0x27bf('0x3d')];if(!_0x13592f['query'][_0x27bf('0x62')](_0x27bf('0x44'))){_0x578de0[_0x27bf('0x45')]=qs[_0x27bf('0x45')](_0x13592f[_0x27bf('0x3e')][_0x27bf('0x45')]);_0x578de0[_0x27bf('0x23')]=qs[_0x27bf('0x23')](_0x13592f[_0x27bf('0x3e')][_0x27bf('0x23')]);}_0x578de0[_0x27bf('0x46')]=qs[_0x27bf('0x47')](_0x13592f[_0x27bf('0x3e')][_0x27bf('0x47')]);_0x578de0[_0x27bf('0x48')]=qs[_0x27bf('0x40')](_[_0x27bf('0x63')](_0x13592f[_0x27bf('0x3e')],_0x53a4cf[_0x27bf('0x40')]));_0x578de0['where'][_0x27bf('0x64')]=_0x5783b3['id'];if(_0x13592f['query']['filter']){_0x578de0[_0x27bf('0x48')]=_[_0x27bf('0x49')](_0x578de0[_0x27bf('0x48')],{'$or':_[_0x27bf('0x32')](_0x578de0[_0x27bf('0x42')],function(_0x12bc8f){var _0x924647={};_0x924647[_0x12bc8f]={'$like':'%'+_0x13592f[_0x27bf('0x3e')][_0x27bf('0x31')]+'%'};return _0x924647;})});}_0x578de0=_['merge']({},_0x578de0,_0x13592f[_0x27bf('0x4b')]);return db['CmHopper'][_0x27bf('0x22')]({'where':_0x578de0[_0x27bf('0x48')]})['then'](function(_0x5798b2){_0x31a46b[_0x27bf('0x22')]=_0x5798b2;if(_0x13592f[_0x27bf('0x3e')][_0x27bf('0x4c')]){_0x578de0[_0x27bf('0x50')]=[{'all':!![]}];}return db[_0x27bf('0x61')][_0x27bf('0x65')](_0x578de0);})[_0x27bf('0x2a')](function(_0x230553){_0x31a46b[_0x27bf('0x4d')]=_0x230553;return _0x31a46b;});}})['then'](respondWithFilteredResult(_0x46eb7d,_0x578de0))[_0x27bf('0x51')](handleError(_0x46eb7d,null));};exports[_0x27bf('0x66')]=function(_0x55702b,_0x5864df,_0x324585){var _0x289018={'raw':!![],'where':{}};var _0x4258be={};var _0x95c3c6={'count':0x0,'rows':[]};return db[_0x27bf('0x3b')]['findOne']({'where':{'id':_0x55702b['params']['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x5864df,null))[_0x27bf('0x2a')](function(_0x4f7eb9){if(_0x4f7eb9){_0x4258be[_0x27bf('0x3d')]=_[_0x27bf('0x3f')](db[_0x27bf('0x67')][_0x27bf('0x58')]);_0x4258be[_0x27bf('0x3e')]=_['keys'](_0x55702b[_0x27bf('0x3e')]);_0x4258be[_0x27bf('0x40')]=_['intersection'](_0x4258be[_0x27bf('0x3d')],_0x4258be['query']);_0x289018[_0x27bf('0x42')]=_[_0x27bf('0x41')](_0x4258be[_0x27bf('0x3d')],qs[_0x27bf('0x43')](_0x55702b[_0x27bf('0x3e')][_0x27bf('0x43')]));_0x289018[_0x27bf('0x42')]=_0x289018[_0x27bf('0x42')][_0x27bf('0x4f')]?_0x289018[_0x27bf('0x42')]:_0x4258be[_0x27bf('0x3d')];if(!_0x55702b[_0x27bf('0x3e')][_0x27bf('0x62')](_0x27bf('0x44'))){_0x289018['limit']=qs['limit'](_0x55702b['query'][_0x27bf('0x45')]);_0x289018[_0x27bf('0x23')]=qs[_0x27bf('0x23')](_0x55702b['query'][_0x27bf('0x23')]);}_0x289018['order']=qs[_0x27bf('0x47')](_0x55702b[_0x27bf('0x3e')][_0x27bf('0x47')]);_0x289018[_0x27bf('0x48')]=qs[_0x27bf('0x40')](_[_0x27bf('0x63')](_0x55702b[_0x27bf('0x3e')],_0x4258be[_0x27bf('0x40')]));_0x289018[_0x27bf('0x48')]['VoiceQueueId']=_0x4f7eb9['id'];if(_0x55702b['query'][_0x27bf('0x31')]){_0x289018[_0x27bf('0x48')]=_[_0x27bf('0x49')](_0x289018[_0x27bf('0x48')],{'$or':_['map'](_0x289018['attributes'],function(_0x53a401){var _0x1fd15f={};_0x1fd15f[_0x53a401]={'$like':'%'+_0x55702b[_0x27bf('0x3e')][_0x27bf('0x31')]+'%'};return _0x1fd15f;})});}_0x289018=_['merge']({},_0x289018,_0x55702b[_0x27bf('0x4b')]);return db[_0x27bf('0x67')][_0x27bf('0x22')]({'where':_0x289018[_0x27bf('0x48')]})['then'](function(_0x2729ff){_0x95c3c6[_0x27bf('0x22')]=_0x2729ff;if(_0x55702b[_0x27bf('0x3e')]['includeAll']){_0x289018[_0x27bf('0x50')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x27bf('0x65')](_0x289018);})['then'](function(_0x16974f){_0x95c3c6['rows']=_0x16974f;return _0x95c3c6;});}})['then'](respondWithFilteredResult(_0x5864df,_0x289018))['catch'](handleError(_0x5864df,null));};exports[_0x27bf('0x68')]=function(_0x4a6c48,_0x3d3eee,_0x59e032){var _0x239484={'raw':!![],'where':{}};var _0x199376={};var _0x458458={'count':0x0,'rows':[]};return db[_0x27bf('0x3b')][_0x27bf('0x60')]({'where':{'id':_0x4a6c48['params']['id']}})['then'](handleEntityNotFound(_0x3d3eee,null))['then'](function(_0x483bf2){if(_0x483bf2){_0x199376[_0x27bf('0x3d')]=_[_0x27bf('0x3f')](db['CmHopperFinal'][_0x27bf('0x58')]);_0x199376['query']=_[_0x27bf('0x3f')](_0x4a6c48[_0x27bf('0x3e')]);_0x199376[_0x27bf('0x40')]=_[_0x27bf('0x41')](_0x199376['model'],_0x199376[_0x27bf('0x3e')]);_0x239484[_0x27bf('0x42')]=_[_0x27bf('0x41')](_0x199376['model'],qs[_0x27bf('0x43')](_0x4a6c48[_0x27bf('0x3e')]['fields']));_0x239484[_0x27bf('0x42')]=_0x239484[_0x27bf('0x42')][_0x27bf('0x4f')]?_0x239484[_0x27bf('0x42')]:_0x199376[_0x27bf('0x3d')];if(!_0x4a6c48[_0x27bf('0x3e')]['hasOwnProperty']('nolimit')){_0x239484[_0x27bf('0x45')]=qs[_0x27bf('0x45')](_0x4a6c48[_0x27bf('0x3e')][_0x27bf('0x45')]);_0x239484[_0x27bf('0x23')]=qs[_0x27bf('0x23')](_0x4a6c48[_0x27bf('0x3e')]['offset']);}_0x239484['order']=qs['sort'](_0x4a6c48['query'][_0x27bf('0x47')]);_0x239484[_0x27bf('0x48')]=qs['filters'](_[_0x27bf('0x63')](_0x4a6c48[_0x27bf('0x3e')],_0x199376[_0x27bf('0x40')]));_0x239484[_0x27bf('0x48')][_0x27bf('0x64')]=_0x483bf2['id'];if(_0x4a6c48[_0x27bf('0x3e')][_0x27bf('0x31')]){_0x239484[_0x27bf('0x48')]=_[_0x27bf('0x49')](_0x239484[_0x27bf('0x48')],{'$or':_[_0x27bf('0x32')](_0x239484[_0x27bf('0x42')],function(_0x555395){var _0x8fb907={};_0x8fb907[_0x555395]={'$like':'%'+_0x4a6c48[_0x27bf('0x3e')][_0x27bf('0x31')]+'%'};return _0x8fb907;})});}_0x239484=_[_0x27bf('0x49')]({},_0x239484,_0x4a6c48[_0x27bf('0x4b')]);return db[_0x27bf('0x69')][_0x27bf('0x22')]({'where':_0x239484['where']})[_0x27bf('0x2a')](function(_0x12aa87){_0x458458[_0x27bf('0x22')]=_0x12aa87;if(_0x4a6c48['query'][_0x27bf('0x4c')]){_0x239484[_0x27bf('0x50')]=[{'all':!![]}];}return db[_0x27bf('0x69')]['findAll'](_0x239484);})[_0x27bf('0x2a')](function(_0x44d27d){_0x458458['rows']=_0x44d27d;return _0x458458;});}})['then'](respondWithFilteredResult(_0x3d3eee,_0x239484))[_0x27bf('0x51')](handleError(_0x3d3eee,null));};exports['getHopperBlacks']=function(_0x100afa,_0x2aa41f,_0x4da036){var _0x3b9ade={'raw':!![],'where':{}};var _0x1717d2={};var _0x57761f={'count':0x0,'rows':[]};return db[_0x27bf('0x3b')][_0x27bf('0x60')]({'where':{'id':_0x100afa[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x2aa41f,null))[_0x27bf('0x2a')](function(_0x4b1d02){if(_0x4b1d02){_0x1717d2[_0x27bf('0x3d')]=_[_0x27bf('0x3f')](db[_0x27bf('0x6a')]['rawAttributes']);_0x1717d2[_0x27bf('0x3e')]=_[_0x27bf('0x3f')](_0x100afa[_0x27bf('0x3e')]);_0x1717d2[_0x27bf('0x40')]=_[_0x27bf('0x41')](_0x1717d2[_0x27bf('0x3d')],_0x1717d2['query']);_0x3b9ade[_0x27bf('0x42')]=_[_0x27bf('0x41')](_0x1717d2[_0x27bf('0x3d')],qs['fields'](_0x100afa['query']['fields']));_0x3b9ade[_0x27bf('0x42')]=_0x3b9ade['attributes'][_0x27bf('0x4f')]?_0x3b9ade['attributes']:_0x1717d2['model'];if(!_0x100afa[_0x27bf('0x3e')][_0x27bf('0x62')]('nolimit')){_0x3b9ade[_0x27bf('0x45')]=qs[_0x27bf('0x45')](_0x100afa[_0x27bf('0x3e')]['limit']);_0x3b9ade[_0x27bf('0x23')]=qs[_0x27bf('0x23')](_0x100afa[_0x27bf('0x3e')][_0x27bf('0x23')]);}_0x3b9ade[_0x27bf('0x46')]=qs['sort'](_0x100afa[_0x27bf('0x3e')][_0x27bf('0x47')]);_0x3b9ade[_0x27bf('0x48')]=qs['filters'](_['pick'](_0x100afa['query'],_0x1717d2['filters']));_0x3b9ade[_0x27bf('0x48')][_0x27bf('0x64')]=_0x4b1d02['id'];if(_0x100afa[_0x27bf('0x3e')]['filter']){_0x3b9ade[_0x27bf('0x48')]=_[_0x27bf('0x49')](_0x3b9ade['where'],{'$or':_[_0x27bf('0x32')](_0x3b9ade[_0x27bf('0x42')],function(_0x385821){var _0x451922={};_0x451922[_0x385821]={'$like':'%'+_0x100afa[_0x27bf('0x3e')][_0x27bf('0x31')]+'%'};return _0x451922;})});}_0x3b9ade=_['merge']({},_0x3b9ade,_0x100afa[_0x27bf('0x4b')]);return db[_0x27bf('0x6a')]['count']({'where':_0x3b9ade['where']})[_0x27bf('0x2a')](function(_0x22af7c){_0x57761f[_0x27bf('0x22')]=_0x22af7c;if(_0x100afa[_0x27bf('0x3e')][_0x27bf('0x4c')]){_0x3b9ade['include']=[{'all':!![]}];}return db[_0x27bf('0x6a')][_0x27bf('0x65')](_0x3b9ade);})[_0x27bf('0x2a')](function(_0x3185df){_0x57761f[_0x27bf('0x4d')]=_0x3185df;return _0x57761f;});}})[_0x27bf('0x2a')](respondWithFilteredResult(_0x2aa41f,_0x3b9ade))[_0x27bf('0x51')](handleError(_0x2aa41f,null));};exports[_0x27bf('0x6b')]=function(_0x479722,_0x4de991,_0x2b4caa){var _0x2cbbec={};var _0x370544={};var _0x2451e6;var _0xcd6f24;return db['VoiceQueue'][_0x27bf('0x60')]({'where':{'id':_0x479722['params']['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x4de991,null))[_0x27bf('0x2a')](function(_0xf02578){if(_0xf02578){_0x2451e6=_0xf02578;_0x370544[_0x27bf('0x3d')]=_['keys'](db[_0x27bf('0x6c')][_0x27bf('0x58')]);_0x370544[_0x27bf('0x3e')]=_[_0x27bf('0x3f')](_0x479722['query']);_0x370544[_0x27bf('0x40')]=_[_0x27bf('0x41')](_0x370544[_0x27bf('0x3d')],_0x370544[_0x27bf('0x3e')]);_0x2cbbec['attributes']=_['intersection'](_0x370544['model'],qs[_0x27bf('0x43')](_0x479722['query'][_0x27bf('0x43')]));_0x2cbbec['attributes']=_0x2cbbec[_0x27bf('0x42')]['length']?_0x2cbbec['attributes']:_0x370544['model'];_0x2cbbec[_0x27bf('0x46')]=qs[_0x27bf('0x47')](_0x479722[_0x27bf('0x3e')][_0x27bf('0x47')]);_0x2cbbec[_0x27bf('0x48')]=qs[_0x27bf('0x40')](_[_0x27bf('0x63')](_0x479722[_0x27bf('0x3e')],_0x370544[_0x27bf('0x40')]));if(_0x479722['query'][_0x27bf('0x31')]){_0x2cbbec[_0x27bf('0x48')]=_[_0x27bf('0x49')](_0x2cbbec[_0x27bf('0x48')],{'$or':_[_0x27bf('0x32')](_0x2cbbec[_0x27bf('0x42')],function(_0x3f9bef){var _0x32d145={};_0x32d145[_0x3f9bef]={'$like':'%'+_0x479722[_0x27bf('0x3e')][_0x27bf('0x31')]+'%'};return _0x32d145;})});}_0x2cbbec=_[_0x27bf('0x49')]({},_0x2cbbec,_0x479722['options']);return _0x2451e6['getTeams'](_0x2cbbec);}})[_0x27bf('0x2a')](function(_0x216514){if(_0x216514){_0xcd6f24=_0x216514['length'];if(!_0x479722[_0x27bf('0x3e')]['hasOwnProperty'](_0x27bf('0x44'))){_0x2cbbec['limit']=qs[_0x27bf('0x45')](_0x479722[_0x27bf('0x3e')][_0x27bf('0x45')]);_0x2cbbec[_0x27bf('0x23')]=qs['offset'](_0x479722['query'][_0x27bf('0x23')]);}return _0x2451e6[_0x27bf('0x6b')](_0x2cbbec);}})[_0x27bf('0x2a')](function(_0x1a79b4){if(_0x1a79b4){return _0x1a79b4?{'count':_0xcd6f24,'rows':_0x1a79b4}:null;}})[_0x27bf('0x2a')](respondWithResult(_0x4de991,null))[_0x27bf('0x51')](handleError(_0x4de991,null));};exports['addTeams']=function(_0x5db708,_0x1f37b6,_0x4e44be){var _0x89ae45=_0x5db708[_0x27bf('0x53')][_0x27bf('0x6d')];var _0x1b59a2=_[_0x27bf('0x32')](_0x89ae45,'id');return db[_0x27bf('0x6c')][_0x27bf('0x65')]({'where':{'id':_0x1b59a2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x27bf('0x6e'),'attributes':['id',_0x27bf('0x37'),_0x27bf('0x6f'),_0x27bf('0x70'),_0x27bf('0x71')],'raw':!![]}]})['then'](function(_0x22ce11){if(_0x22ce11){var _0x48d7ec=_['flatMap'](_0x22ce11,function(_0x14c720){var _0x38fe59=_0x14c720['get']({'plain':!![]});_0x38fe59[_0x27bf('0x6e')][_0x27bf('0x72')](function(_0x363be0){_0x363be0[_0x27bf('0x73')]=_['find'](_0x89ae45,{'id':_0x38fe59['id']})[_0x27bf('0x73')];});return _0x38fe59[_0x27bf('0x6e')];});return db[_0x27bf('0x3b')][_0x27bf('0x36')]({'where':{'id':_0x5db708[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](function(_0x1d5ef9){return db[_0x27bf('0x74')][_0x27bf('0x75')](function(_0x4bb204){return _0x1d5ef9['addTeams'](_0x1b59a2,{'transaction':_0x4bb204})[_0x27bf('0x2a')](function(){return BPromise['each'](_0x48d7ec,function(_0x1013a0){return db[_0x27bf('0x76')][_0x27bf('0x77')]({'where':{'UserId':_0x1013a0['id'],'VoiceQueueId':_0x5db708[_0x27bf('0x5e')]['id']},'defaults':{'penalty':_0x1013a0[_0x27bf('0x73')]},'transaction':_0x4bb204});});})[_0x27bf('0x2a')](function(){return BPromise[_0x27bf('0x78')](_[_0x27bf('0x31')](_0x48d7ec,{'online':!![]}),function(_0x12735c){return db[_0x27bf('0x79')][_0x27bf('0x7a')]({'membername':_0x12735c[_0x27bf('0x37')],'UserId':_0x12735c['id'],'queue_name':_0x1d5ef9[_0x27bf('0x37')],'VoiceQueueId':_0x1d5ef9['id'],'interface':_[_0x27bf('0x7b')](_0x12735c[_0x27bf('0x71')])?util['format']('SIP/%s',_0x12735c[_0x27bf('0x37')]):_0x12735c['interface'],'paused':_0x12735c['voicePause']||![],'penalty':_0x12735c[_0x27bf('0x73')]},{'transaction':_0x4bb204});});})[_0x27bf('0x2a')](function(){_0x48d7ec['forEach'](function(_0x2c7b00){socket[_0x27bf('0x7c')](_0x27bf('0x7d'),{'UserId':_0x2c7b00['id'],'VoiceQueueId':_0x1d5ef9['id']});});});});});}})[_0x27bf('0x2a')](respondWithStatusCode(_0x1f37b6,null))[_0x27bf('0x51')](handleError(_0x1f37b6,null));};exports[_0x27bf('0x7e')]=function(_0x40601b,_0x42a739,_0x12c3fe){return db[_0x27bf('0x6c')][_0x27bf('0x65')]({'where':{'id':_0x40601b[_0x27bf('0x3e')][_0x27bf('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x27bf('0x80')],'as':_0x27bf('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x27bf('0x2a')](handleEntityNotFound(_0x42a739,null))[_0x27bf('0x2a')](function(_0x6efd21){var _0x34ae91=_[_0x27bf('0x32')](_0x6efd21,'id');var _0x4819fc=[];var _0x376488=[];var _0x5c6fcd=squel[_0x27bf('0x81')]();_0x5c6fcd['field']('tq.TeamId')[_0x27bf('0x82')](_0x27bf('0x83'),'tq')[_0x27bf('0x84')](_0x27bf('0x85'),'ut',_0x27bf('0x86'))[_0x27bf('0x48')]('VoiceQueueId\x20=\x20?',_0x40601b[_0x27bf('0x5e')]['id']);for(var _0x5c42c7=0x0;_0x5c42c7<_0x6efd21['length'];_0x5c42c7+=0x1){let _0x5060ec=_0x6efd21[_0x5c42c7];for(var _0x383ab8=0x0;_0x383ab8<_0x5060ec[_0x27bf('0x6e')][_0x27bf('0x4f')];_0x383ab8+=0x1){let _0x5cde3a=_0x5060ec[_0x27bf('0x6e')][_0x383ab8];var _0x20c956=_0x5c6fcd['clone']();_0x20c956[_0x27bf('0x48')](_0x27bf('0x87'),_0x5cde3a['id']);_0x376488[_0x27bf('0x88')](db[_0x27bf('0x74')][_0x27bf('0x3e')](_0x20c956[_0x27bf('0x89')](),{'type':db[_0x27bf('0x74')][_0x27bf('0x8a')][_0x27bf('0x8b')]})[_0x27bf('0x2a')](function(_0x47ba29){if(_0x47ba29[_0x27bf('0x4f')]===0x1){return _0x5cde3a['id'];}else{var _0x327af2=_[_0x27bf('0x8c')](_[_0x27bf('0x32')](_0x47ba29,_0x27bf('0x8d')),function(_0x1c9f30){return _[_0x27bf('0x34')](_0x34ae91,_0x1c9f30);});if(_0x327af2){return _0x5cde3a['id'];}}}));}}return BPromise[_0x27bf('0x8e')](_0x376488)['then'](function(_0x53eaff){_0x4819fc=_(_0x4819fc)['union'](_0x53eaff)[_0x27bf('0x8f')]()[_0x27bf('0x33')]();return db[_0x27bf('0x3b')]['find']({'where':{'id':_0x40601b[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](function(_0x4ff4e9){return db[_0x27bf('0x74')][_0x27bf('0x75')](function(_0x2c904e){return _0x4ff4e9[_0x27bf('0x7e')](_0x40601b[_0x27bf('0x3e')][_0x27bf('0x7f')],{'transaction':_0x2c904e})[_0x27bf('0x2a')](function(){if(!_[_0x27bf('0x90')](_0x4819fc)){return _0x4ff4e9[_0x27bf('0x91')](_0x4819fc,{'transaction':_0x2c904e})[_0x27bf('0x2a')](function(){return db[_0x27bf('0x79')][_0x27bf('0x2b')]({'where':{'VoiceQueueId':_0x40601b[_0x27bf('0x5e')]['id'],'UserId':_0x4819fc},'transaction':_0x2c904e});});}})[_0x27bf('0x2a')](function(){_0x4819fc[_0x27bf('0x72')](function(_0x3a64e5){socket[_0x27bf('0x7c')](_0x27bf('0x92'),{'UserId':_0x3a64e5,'VoiceQueueId':_0x4ff4e9['id']});});});});});});})[_0x27bf('0x2a')](respondWithStatusCode(_0x42a739,null))[_0x27bf('0x51')](handleError(_0x42a739,null));};exports[_0x27bf('0x93')]=function(_0x10556e,_0x2939a2,_0x57fa19){var _0x2cef8b,_0xb705e7;return db[_0x27bf('0x3b')]['find']({'where':{'id':_0x10556e[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x2939a2,null))[_0x27bf('0x2a')](function(_0x3fc727){if(_0x3fc727){_0xb705e7=_0x3fc727;return _0x3fc727[_0x27bf('0x93')](_0x10556e['body'][_0x27bf('0x7f')],_[_0x27bf('0x59')](_0x10556e['body'],['ids','id'])||{})[_0x27bf('0x94')](function(_0x174d45){for(var _0x276394=0x0;_0x276394<_0x10556e['body']['ids'][_0x27bf('0x4f')];_0x276394+=0x1){socket[_0x27bf('0x7c')](_0x27bf('0x7d'),{'UserId':_0x10556e[_0x27bf('0x53')][_0x27bf('0x7f')][_0x276394],'VoiceQueueId':_0x10556e[_0x27bf('0x5e')]['id']});}return _0x174d45;});}})[_0x27bf('0x2a')](function(_0x53baf3){_0x2cef8b=_0x53baf3||[];if(_0xb705e7){return db['User']['findAll']({'where':{'id':_0x10556e[_0x27bf('0x53')][_0x27bf('0x7f')]},'attributes':['id',_0x27bf('0x37'),_0x27bf('0x6f'),_0x27bf('0x70'),_0x27bf('0x71')],'raw':!![]});}})['then'](function(_0x9ad88d){if(!_[_0x27bf('0x90')](_0x9ad88d)){var _0x3875f9=[];for(var _0x271814=0x0;_0x271814<_0x9ad88d[_0x27bf('0x4f')];_0x271814++){if(_0x9ad88d[_0x271814][_0x27bf('0x6f')]){_0x3875f9[_0x27bf('0x88')](db[_0x27bf('0x79')]['upsert']({'membername':_0x9ad88d[_0x271814][_0x27bf('0x37')],'UserId':_0x9ad88d[_0x271814]['id'],'queue_name':_0xb705e7['name'],'VoiceQueueId':_0xb705e7['id'],'interface':_[_0x27bf('0x7b')](_0x9ad88d[_0x271814][_0x27bf('0x71')])?util[_0x27bf('0x95')]('SIP/%s',_0x9ad88d[_0x271814][_0x27bf('0x37')]):_0x9ad88d[_0x271814]['interface'],'paused':_0x9ad88d[_0x271814]['voicePause']||![],'penalty':_0x10556e[_0x27bf('0x53')][_0x27bf('0x73')]||0x0}));}}return BPromise[_0x27bf('0x8e')](_0x3875f9);}})[_0x27bf('0x2a')](function(){return _0x2cef8b;})[_0x27bf('0x2a')](respondWithResult(_0x2939a2,null))[_0x27bf('0x51')](handleError(_0x2939a2,null));};exports[_0x27bf('0x91')]=function(_0x15369f,_0x34df2c,_0x371b3a){return db[_0x27bf('0x3b')]['find']({'where':{'id':_0x15369f[_0x27bf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x34df2c,null))[_0x27bf('0x2a')](function(_0x2c643c){if(_0x2c643c){return _0x2c643c[_0x27bf('0x91')](_0x15369f[_0x27bf('0x3e')][_0x27bf('0x7f')])['then'](function(){if(_[_0x27bf('0x96')](_0x15369f['query'][_0x27bf('0x7f')])){for(var _0x6040f6=0x0;_0x6040f6<_0x15369f[_0x27bf('0x3e')][_0x27bf('0x7f')]['length'];_0x6040f6+=0x1){socket[_0x27bf('0x7c')](_0x27bf('0x92'),{'UserId':Number(_0x15369f[_0x27bf('0x3e')][_0x27bf('0x7f')][_0x6040f6]),'VoiceQueueId':Number(_0x15369f[_0x27bf('0x5e')]['id'])});}}else{socket[_0x27bf('0x7c')](_0x27bf('0x92'),{'UserId':Number(_0x15369f[_0x27bf('0x3e')]['ids']),'VoiceQueueId':Number(_0x15369f['params']['id'])});}});}})[_0x27bf('0x2a')](function(_0x481ef3){return db[_0x27bf('0x79')][_0x27bf('0x2b')]({'where':{'VoiceQueueId':_0x15369f[_0x27bf('0x5e')]['id'],'UserId':_0x15369f['query'][_0x27bf('0x7f')]}})[_0x27bf('0x2a')](function(){return _0x481ef3;});})['then'](respondWithStatusCode(_0x34df2c,null))[_0x27bf('0x51')](handleError(_0x34df2c,null));};exports[_0x27bf('0x97')]=function(_0x2e6263,_0x585023,_0x434bec){var _0x355aaa={};var _0x504faf={};var _0x18e8f0;var _0x22f4b3;return db[_0x27bf('0x3b')]['findOne']({'where':{'id':_0x2e6263['params']['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x585023,null))[_0x27bf('0x2a')](function(_0x3e5765){if(_0x3e5765){_0x18e8f0=_0x3e5765;_0x504faf[_0x27bf('0x3d')]=_[_0x27bf('0x3f')](db[_0x27bf('0x80')]['rawAttributes']);_0x504faf[_0x27bf('0x3e')]=_[_0x27bf('0x3f')](_0x2e6263[_0x27bf('0x3e')]);_0x504faf[_0x27bf('0x40')]=_[_0x27bf('0x41')](_0x504faf['model'],_0x504faf[_0x27bf('0x3e')]);_0x355aaa[_0x27bf('0x42')]=_[_0x27bf('0x41')](_0x504faf['model'],qs[_0x27bf('0x43')](_0x2e6263[_0x27bf('0x3e')][_0x27bf('0x43')]));_0x355aaa['attributes']=_0x355aaa[_0x27bf('0x42')][_0x27bf('0x4f')]?_0x355aaa['attributes']:_0x504faf[_0x27bf('0x3d')];_0x355aaa[_0x27bf('0x46')]=qs[_0x27bf('0x47')](_0x2e6263[_0x27bf('0x3e')][_0x27bf('0x47')]);_0x355aaa['where']=qs[_0x27bf('0x40')](_[_0x27bf('0x63')](_0x2e6263[_0x27bf('0x3e')],_0x504faf[_0x27bf('0x40')]));if(_0x2e6263['query'][_0x27bf('0x31')]){_0x355aaa[_0x27bf('0x48')]=_[_0x27bf('0x49')](_0x355aaa[_0x27bf('0x48')],{'$or':_[_0x27bf('0x32')](_0x355aaa['attributes'],function(_0xdf4fdf){var _0x3718ed={};_0x3718ed[_0xdf4fdf]={'$like':'%'+_0x2e6263[_0x27bf('0x3e')][_0x27bf('0x31')]+'%'};return _0x3718ed;})});}_0x355aaa=_['merge']({},_0x355aaa,_0x2e6263['options']);return _0x18e8f0[_0x27bf('0x97')](_0x355aaa);}})[_0x27bf('0x2a')](function(_0x99a3f6){if(_0x99a3f6){_0x22f4b3=_0x99a3f6[_0x27bf('0x4f')];if(!_0x2e6263[_0x27bf('0x3e')][_0x27bf('0x62')](_0x27bf('0x44'))){_0x355aaa[_0x27bf('0x45')]=qs[_0x27bf('0x45')](_0x2e6263[_0x27bf('0x3e')]['limit']);_0x355aaa['offset']=qs[_0x27bf('0x23')](_0x2e6263['query'][_0x27bf('0x23')]);}return _0x18e8f0[_0x27bf('0x97')](_0x355aaa);}})[_0x27bf('0x2a')](function(_0x3a897d){if(_0x3a897d){return _0x3a897d?{'count':_0x22f4b3,'rows':_0x3a897d}:null;}})[_0x27bf('0x2a')](respondWithResult(_0x585023,null))[_0x27bf('0x51')](handleError(_0x585023,null));};exports[_0x27bf('0x98')]=function(_0x335a7b,_0x5f495c,_0x55a1e2){var _0x5bdc11={};var _0x4525f5={};var _0x51b8e7;var _0x1bf921;return db[_0x27bf('0x3b')][_0x27bf('0x60')]({'where':{'id':_0x335a7b[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x5f495c,null))['then'](function(_0x48fef6){if(_0x48fef6){_0x51b8e7=_0x48fef6;_0x4525f5[_0x27bf('0x3d')]=_[_0x27bf('0x3f')](db['UserVoiceQueueRt'][_0x27bf('0x58')]);_0x4525f5[_0x27bf('0x3e')]=_['keys'](_0x335a7b[_0x27bf('0x3e')]);_0x4525f5[_0x27bf('0x40')]=_[_0x27bf('0x41')](_0x4525f5[_0x27bf('0x3d')],_0x4525f5[_0x27bf('0x3e')]);_0x5bdc11[_0x27bf('0x42')]=_[_0x27bf('0x41')](_0x4525f5['model'],qs[_0x27bf('0x43')](_0x335a7b['query']['fields']));_0x5bdc11[_0x27bf('0x42')]=_0x5bdc11[_0x27bf('0x42')][_0x27bf('0x4f')]?_0x5bdc11['attributes']:_0x4525f5['model'];_0x5bdc11['order']=qs[_0x27bf('0x47')](_0x335a7b[_0x27bf('0x3e')][_0x27bf('0x47')]);_0x5bdc11[_0x27bf('0x48')]=qs[_0x27bf('0x40')](_[_0x27bf('0x63')](_0x335a7b[_0x27bf('0x3e')],_0x4525f5['filters']));if(_0x335a7b[_0x27bf('0x3e')][_0x27bf('0x31')]){_0x5bdc11[_0x27bf('0x48')]=_[_0x27bf('0x49')](_0x5bdc11[_0x27bf('0x48')],{'$or':_['map'](_0x5bdc11[_0x27bf('0x42')],function(_0x2e90e9){var _0x19da18={};_0x19da18[_0x2e90e9]={'$like':'%'+_0x335a7b[_0x27bf('0x3e')]['filter']+'%'};return _0x19da18;})});}_0x5bdc11=_[_0x27bf('0x49')]({},_0x5bdc11,_0x335a7b[_0x27bf('0x4b')]);return _0x51b8e7[_0x27bf('0x98')](_0x5bdc11);}})['then'](function(_0x3179a9){if(_0x3179a9){_0x1bf921=_0x3179a9[_0x27bf('0x4f')];if(!_0x335a7b[_0x27bf('0x3e')][_0x27bf('0x62')](_0x27bf('0x44'))){_0x5bdc11[_0x27bf('0x45')]=qs[_0x27bf('0x45')](_0x335a7b['query'][_0x27bf('0x45')]);_0x5bdc11[_0x27bf('0x23')]=qs['offset'](_0x335a7b[_0x27bf('0x3e')]['offset']);}return _0x51b8e7[_0x27bf('0x98')](_0x5bdc11);}})[_0x27bf('0x2a')](function(_0x1e67f5){return _0x1e67f5?{'count':_0x1bf921,'rows':_0x1e67f5}:null;})[_0x27bf('0x2a')](respondWithResult(_0x5f495c,null))['catch'](handleError(_0x5f495c,null));};exports['getLists']=function(_0x125a9d,_0x5cda99,_0x22344a){var _0xd83d94={};var _0xb66456={};var _0x494622;var _0x9bfd9e;return db[_0x27bf('0x3b')][_0x27bf('0x60')]({'where':{'id':_0x125a9d[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x5cda99,null))[_0x27bf('0x2a')](function(_0x1e71de){if(_0x1e71de){_0x494622=_0x1e71de;_0xb66456['model']=_[_0x27bf('0x3f')](db[_0x27bf('0x99')]['rawAttributes']);_0xb66456[_0x27bf('0x3e')]=_['keys'](_0x125a9d[_0x27bf('0x3e')]);_0xb66456['filters']=_[_0x27bf('0x41')](_0xb66456[_0x27bf('0x3d')],_0xb66456[_0x27bf('0x3e')]);_0xd83d94[_0x27bf('0x42')]=_['intersection'](_0xb66456[_0x27bf('0x3d')],qs[_0x27bf('0x43')](_0x125a9d[_0x27bf('0x3e')]['fields']));_0xd83d94[_0x27bf('0x42')]=_0xd83d94[_0x27bf('0x42')]['length']?_0xd83d94['attributes']:_0xb66456[_0x27bf('0x3d')];_0xd83d94['order']=qs[_0x27bf('0x47')](_0x125a9d[_0x27bf('0x3e')][_0x27bf('0x47')]);_0xd83d94[_0x27bf('0x48')]=qs[_0x27bf('0x40')](_[_0x27bf('0x63')](_0x125a9d['query'],_0xb66456[_0x27bf('0x40')]));if(_0x125a9d['query'][_0x27bf('0x31')]){_0xd83d94['where']=_['merge'](_0xd83d94[_0x27bf('0x48')],{'$or':_[_0x27bf('0x32')](_0xd83d94['attributes'],function(_0x1af3e4){var _0x27d3fe={};_0x27d3fe[_0x1af3e4]={'$like':'%'+_0x125a9d[_0x27bf('0x3e')]['filter']+'%'};return _0x27d3fe;})});}_0xd83d94=_[_0x27bf('0x49')]({},_0xd83d94,_0x125a9d[_0x27bf('0x4b')]);return _0x494622[_0x27bf('0x9a')](_0xd83d94);}})[_0x27bf('0x2a')](function(_0x40fd10){if(_0x40fd10){_0x9bfd9e=_0x40fd10[_0x27bf('0x4f')];if(!_0x125a9d[_0x27bf('0x3e')][_0x27bf('0x62')](_0x27bf('0x44'))){_0xd83d94[_0x27bf('0x45')]=qs[_0x27bf('0x45')](_0x125a9d[_0x27bf('0x3e')][_0x27bf('0x45')]);_0xd83d94[_0x27bf('0x23')]=qs[_0x27bf('0x23')](_0x125a9d['query'][_0x27bf('0x23')]);}return _0x494622[_0x27bf('0x9a')](_0xd83d94);}})['then'](function(_0x416a24){if(_0x416a24){return _0x416a24?{'count':_0x9bfd9e,'rows':_0x416a24}:null;}})[_0x27bf('0x2a')](respondWithResult(_0x5cda99,null))[_0x27bf('0x51')](handleError(_0x5cda99,null));};exports[_0x27bf('0x9b')]=function(_0x3d24d2,_0x40885a,_0x3f9831){var _0x45dd20,_0x2ff07e;return db[_0x27bf('0x3b')][_0x27bf('0x36')]({'where':{'id':_0x3d24d2[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x40885a,null))[_0x27bf('0x2a')](function(_0x28a44b){if(_0x28a44b){_0x2ff07e=_0x28a44b;return _0x28a44b[_0x27bf('0x9b')](_0x3d24d2[_0x27bf('0x53')][_0x27bf('0x7f')],_['omit'](_0x3d24d2[_0x27bf('0x53')],[_0x27bf('0x7f'),'id'])||{});}return null;})[_0x27bf('0x94')](function(_0x5e0589){var _0xba8557;_0x45dd20=_0x5e0589||[];var _0x33020e=[];if(_0x5e0589){for(var _0x5c0d13=0x0;_0x5c0d13<_0x5e0589[_0x27bf('0x4f')];_0x5c0d13+=0x1){var _0x1d4a32=_0x5e0589[_0x5c0d13][_0x27bf('0x2c')]({'plain':!![]});_0x2ff07e[_0x27bf('0x9c')]=_0x3d24d2[_0x27bf('0x53')][_0x27bf('0x9c')]?_0x3d24d2[_0x27bf('0x53')][_0x27bf('0x9c')]:_0x2ff07e[_0x27bf('0x9c')];switch(_0x2ff07e[_0x27bf('0x9c')]){case _0x27bf('0x9d'):_0xba8557=squel['insert']()[_0x27bf('0x9e')]('cm_hopper')[_0x27bf('0x9f')]([_0x27bf('0xa0'),_0x27bf('0xa1'),'ContactId','ListId',_0x27bf('0x64'),'createdAt',_0x27bf('0x5a')],squel[_0x27bf('0x81')]()[_0x27bf('0xa2')]('phone',_0x27bf('0xa0'))[_0x27bf('0xa2')](_0x27bf('0xa3'),_0x27bf('0xa1'))[_0x27bf('0xa2')]('id',_0x27bf('0xa4'))[_0x27bf('0xa2')](_0x1d4a32['CmListId'][_0x27bf('0x89')](),_0x27bf('0xa5'))['field'](_0x3d24d2['params']['id']['toString'](),_0x27bf('0x64'))[_0x27bf('0xa2')]('NOW()',_0x27bf('0x5b'))[_0x27bf('0xa2')](_0x27bf('0xa3'),_0x27bf('0x5a'))[_0x27bf('0x82')](_0x27bf('0xa6'))['where'](_0x27bf('0xa7'))[_0x27bf('0x48')](_0x27bf('0xa8'),_0x1d4a32[_0x27bf('0xa9')][_0x27bf('0x89')]())[_0x27bf('0x48')](_0x27bf('0xaa'))[_0x27bf('0x48')](_0x27bf('0xab'),squel[_0x27bf('0x81')]()[_0x27bf('0xa2')]('COALESCE(calleridnum,\x27\x27)')[_0x27bf('0x82')](_0x27bf('0xac'))[_0x27bf('0x48')]('VoiceQueueId\x20=\x20?',_0x3d24d2[_0x27bf('0x5e')]['id'][_0x27bf('0x89')]()))[_0x27bf('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x27bf('0x81')]()['field'](_0x27bf('0xad'))[_0x27bf('0x82')](_0x27bf('0xae'))[_0x27bf('0x48')](_0x27bf('0xaf'),_0x3d24d2[_0x27bf('0x5e')]['id'][_0x27bf('0x89')]())))[_0x27bf('0x89')]();break;case _0x27bf('0xb0'):_0xba8557=squel['insert']()[_0x27bf('0x9e')](_0x27bf('0xae'))[_0x27bf('0x9f')](['phone',_0x27bf('0xa1'),_0x27bf('0xa4'),_0x27bf('0xa5'),_0x27bf('0x64'),_0x27bf('0x5b'),'updatedAt'],squel[_0x27bf('0x81')]()[_0x27bf('0xa2')](_0x27bf('0xa0'),_0x27bf('0xa0'))[_0x27bf('0xa2')](_0x27bf('0xa3'),'scheduledAt')[_0x27bf('0xa2')]('id',_0x27bf('0xa4'))['field'](_0x1d4a32['CmListId'][_0x27bf('0x89')](),_0x27bf('0xa5'))[_0x27bf('0xa2')](_0x3d24d2[_0x27bf('0x5e')]['id'][_0x27bf('0x89')](),_0x27bf('0x64'))[_0x27bf('0xa2')](_0x27bf('0xa3'),_0x27bf('0x5b'))[_0x27bf('0xa2')](_0x27bf('0xa3'),_0x27bf('0x5a'))[_0x27bf('0x82')](_0x27bf('0xa6'))[_0x27bf('0x48')](_0x27bf('0xa7'))['where'](_0x27bf('0xa8'),_0x1d4a32[_0x27bf('0xa9')][_0x27bf('0x89')]())[_0x27bf('0x48')](_0x27bf('0xaa'))[_0x27bf('0x48')](_0x27bf('0xab'),squel[_0x27bf('0x81')]()[_0x27bf('0xa2')](_0x27bf('0xad'))[_0x27bf('0x82')](_0x27bf('0xae'))[_0x27bf('0x48')](_0x27bf('0xaf'),_0x3d24d2['params']['id']['toString']())))['toString']();break;default:_0xba8557=squel[_0x27bf('0xb1')]()['into']('cm_hopper')[_0x27bf('0x9f')]([_0x27bf('0xa0'),_0x27bf('0xa1'),'ContactId',_0x27bf('0xa5'),_0x27bf('0x64'),_0x27bf('0x5b'),'updatedAt'],squel[_0x27bf('0x81')]()[_0x27bf('0xa2')](_0x27bf('0xa0'),_0x27bf('0xa0'))[_0x27bf('0xa2')](_0x27bf('0xa3'),'scheduledAt')[_0x27bf('0xa2')]('id',_0x27bf('0xa4'))[_0x27bf('0xa2')](_0x1d4a32['CmListId'][_0x27bf('0x89')](),_0x27bf('0xa5'))[_0x27bf('0xa2')](_0x3d24d2[_0x27bf('0x5e')]['id']['toString'](),'VoiceQueueId')[_0x27bf('0xa2')](_0x27bf('0xa3'),_0x27bf('0x5b'))[_0x27bf('0xa2')]('NOW()',_0x27bf('0x5a'))[_0x27bf('0x82')](_0x27bf('0xa6'))['where'](_0x27bf('0xa7'))[_0x27bf('0x48')](_0x27bf('0xa8'),_0x1d4a32[_0x27bf('0xa9')]['toString']())[_0x27bf('0x48')](_0x27bf('0xaa')))['toString']();}_0x33020e[_0x27bf('0x88')](db[_0x27bf('0x74')][_0x27bf('0x3e')](_0xba8557));}return BPromise['all'](_0x33020e);}})[_0x27bf('0x2a')](function(){return _0x45dd20;})[_0x27bf('0x2a')](respondWithResult(_0x40885a,null))[_0x27bf('0x51')](handleError(_0x40885a,null));};exports['removeLists']=function(_0xfaf305,_0x181bbc,_0x233f53){return db['VoiceQueue']['find']({'where':{'id':_0xfaf305['params']['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x181bbc,null))[_0x27bf('0x2a')](function(_0x3625e4){if(_0x3625e4){return _0x3625e4['removeLists'](_0xfaf305[_0x27bf('0x3e')][_0x27bf('0x7f')]);}})['then'](function(_0x28f8b9){if(_0x28f8b9){return db[_0x27bf('0x61')]['destroy']({'where':{'ListId':_0xfaf305[_0x27bf('0x3e')][_0x27bf('0x7f')],'VoiceQueueId':_0xfaf305[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](function(){return _0x28f8b9;});}})[_0x27bf('0x2a')](respondWithStatusCode(_0x181bbc,null))[_0x27bf('0x51')](handleError(_0x181bbc,null));};exports['getBlackLists']=function(_0x3dd3c1,_0x3345ad,_0x109757){var _0xa04565={};var _0x151b8c={};var _0x1fdb93;var _0x4eb66c;return db[_0x27bf('0x3b')][_0x27bf('0x60')]({'where':{'id':_0x3dd3c1[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x3345ad,null))['then'](function(_0x4656a6){if(_0x4656a6){_0x1fdb93=_0x4656a6;_0x151b8c[_0x27bf('0x3d')]=_[_0x27bf('0x3f')](db[_0x27bf('0x99')][_0x27bf('0x58')]);_0x151b8c['query']=_[_0x27bf('0x3f')](_0x3dd3c1[_0x27bf('0x3e')]);_0x151b8c['filters']=_['intersection'](_0x151b8c[_0x27bf('0x3d')],_0x151b8c[_0x27bf('0x3e')]);_0xa04565[_0x27bf('0x42')]=_['intersection'](_0x151b8c[_0x27bf('0x3d')],qs[_0x27bf('0x43')](_0x3dd3c1['query'][_0x27bf('0x43')]));_0xa04565[_0x27bf('0x42')]=_0xa04565['attributes'][_0x27bf('0x4f')]?_0xa04565[_0x27bf('0x42')]:_0x151b8c[_0x27bf('0x3d')];_0xa04565[_0x27bf('0x46')]=qs[_0x27bf('0x47')](_0x3dd3c1['query'][_0x27bf('0x47')]);_0xa04565[_0x27bf('0x48')]=qs['filters'](_[_0x27bf('0x63')](_0x3dd3c1[_0x27bf('0x3e')],_0x151b8c[_0x27bf('0x40')]));if(_0x3dd3c1['query'][_0x27bf('0x31')]){_0xa04565[_0x27bf('0x48')]=_[_0x27bf('0x49')](_0xa04565[_0x27bf('0x48')],{'$or':_['map'](_0xa04565[_0x27bf('0x42')],function(_0x1cbc37){var _0x5f3e03={};_0x5f3e03[_0x1cbc37]={'$like':'%'+_0x3dd3c1[_0x27bf('0x3e')]['filter']+'%'};return _0x5f3e03;})});}_0xa04565=_[_0x27bf('0x49')]({},_0xa04565,_0x3dd3c1['options']);return _0x1fdb93[_0x27bf('0xb2')](_0xa04565);}})[_0x27bf('0x2a')](function(_0x14b920){if(_0x14b920){_0x4eb66c=_0x14b920[_0x27bf('0x4f')];if(!_0x3dd3c1[_0x27bf('0x3e')]['hasOwnProperty'](_0x27bf('0x44'))){_0xa04565[_0x27bf('0x45')]=qs['limit'](_0x3dd3c1[_0x27bf('0x3e')][_0x27bf('0x45')]);_0xa04565[_0x27bf('0x23')]=qs[_0x27bf('0x23')](_0x3dd3c1[_0x27bf('0x3e')][_0x27bf('0x23')]);}return _0x1fdb93[_0x27bf('0xb2')](_0xa04565);}})['then'](function(_0x1a4424){if(_0x1a4424){return _0x1a4424?{'count':_0x4eb66c,'rows':_0x1a4424}:null;}})['then'](respondWithResult(_0x3345ad,null))['catch'](handleError(_0x3345ad,null));};exports['addBlackLists']=function(_0x5e9bd8,_0x42f0b2,_0x4f6f15){var _0x5e5cc7,_0x33bdfb;return db[_0x27bf('0x3b')][_0x27bf('0x36')]({'where':{'id':_0x5e9bd8['params']['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x42f0b2,null))[_0x27bf('0x2a')](function(_0x2e826c){if(_0x2e826c){_0x33bdfb=_0x2e826c;return _0x2e826c[_0x27bf('0xb3')](_0x5e9bd8['body'][_0x27bf('0x7f')],_[_0x27bf('0x59')](_0x5e9bd8['body'],['ids','id'])||{});}return null;})[_0x27bf('0x94')](function(_0x2b1054){var _0x3a73db;_0x5e5cc7=_0x2b1054||[];var _0x23c344=[];if(_0x2b1054){for(var _0x5c62ac=0x0;_0x5c62ac<_0x2b1054[_0x27bf('0x4f')];_0x5c62ac+=0x1){var _0x5b1675=_0x2b1054[_0x5c62ac]['get']({'plain':!![]});_0x3a73db=squel[_0x27bf('0xb1')]()[_0x27bf('0x9e')](_0x27bf('0xb4'))[_0x27bf('0x9f')]([_0x27bf('0xa0'),_0x27bf('0xa4'),_0x27bf('0xa5'),'VoiceQueueId','createdAt','updatedAt'],squel[_0x27bf('0x81')]()['field'](_0x27bf('0xa0'),_0x27bf('0xa0'))[_0x27bf('0xa2')]('id',_0x27bf('0xa4'))[_0x27bf('0xa2')](_0x5b1675[_0x27bf('0xa9')][_0x27bf('0x89')](),_0x27bf('0xa5'))['field'](_0x5e9bd8['params']['id']['toString'](),'VoiceQueueId')[_0x27bf('0xa2')](_0x27bf('0xa3'),_0x27bf('0x5b'))[_0x27bf('0xa2')](_0x27bf('0xa3'),'updatedAt')[_0x27bf('0x82')](_0x27bf('0xa6'))[_0x27bf('0x48')](_0x27bf('0xa7'))[_0x27bf('0x48')](_0x27bf('0xa8'),_0x5b1675[_0x27bf('0xa9')]['toString']())[_0x27bf('0x48')](_0x27bf('0xaa')))[_0x27bf('0x89')]();_0x23c344[_0x27bf('0x88')](db[_0x27bf('0x74')][_0x27bf('0x3e')](_0x3a73db));}return BPromise['all'](_0x23c344);}})['then'](function(){return _0x5e5cc7;})[_0x27bf('0x2a')](respondWithResult(_0x42f0b2,null))[_0x27bf('0x51')](handleError(_0x42f0b2,null));};exports[_0x27bf('0xb5')]=function(_0x252ffd,_0x2054b6,_0x19c3cc){return db[_0x27bf('0x3b')]['find']({'where':{'id':_0x252ffd[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](handleEntityNotFound(_0x2054b6,null))[_0x27bf('0x2a')](function(_0x952b54){if(_0x952b54){return _0x952b54[_0x27bf('0xb5')](_0x252ffd['query'][_0x27bf('0x7f')]);}})['then'](function(_0x1eb1cf){if(_0x1eb1cf){return db[_0x27bf('0x6a')][_0x27bf('0x2b')]({'where':{'ListId':_0x252ffd[_0x27bf('0x3e')][_0x27bf('0x7f')],'VoiceQueueId':_0x252ffd[_0x27bf('0x5e')]['id']}})[_0x27bf('0x2a')](function(){return _0x1eb1cf;});}})['then'](respondWithStatusCode(_0x2054b6,null))[_0x27bf('0x51')](handleError(_0x2054b6,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 551c27f..b708a87 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 _0xb26e=['setMaxListeners','save','update','emit','exports','../../mysqldb','VoiceQueue'];(function(_0x73fb6d,_0x1f160a){var _0xa96dd6=function(_0x35ac02){while(--_0x35ac02){_0x73fb6d['push'](_0x73fb6d['shift']());}};_0xa96dd6(++_0x1f160a);}(_0xb26e,0xb4));var _0xeb26=function(_0x2eefad,_0x378913){_0x2eefad=_0x2eefad-0x0;var _0x431c35=_0xb26e[_0x2eefad];return _0x431c35;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xeb26('0x0'))['db'][_0xeb26('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xeb26('0x2')](0x0);var events={'afterCreate':_0xeb26('0x3'),'afterUpdate':_0xeb26('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c1e82){return function(_0x35f2ec,_0x4d9a29,_0x46000b){VoiceQueueEvents[_0xeb26('0x5')](_0x2c1e82+':'+_0x35f2ec['id'],_0x35f2ec);VoiceQueueEvents[_0xeb26('0x5')](_0x2c1e82,_0x35f2ec);_0x46000b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xeb26('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xf056=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x8176c8,_0x185fa3){var _0x10f731=function(_0x13359f){while(--_0x13359f){_0x8176c8['push'](_0x8176c8['shift']());}};_0x10f731(++_0x185fa3);}(_0xf056,0x186));var _0x6f05=function(_0x3a04f1,_0x365f94){_0x3a04f1=_0x3a04f1-0x0;var _0x2b4d99=_0xf056[_0x3a04f1];return _0x2b4d99;};'use strict';var EventEmitter=require(_0x6f05('0x0'));var VoiceQueue=require(_0x6f05('0x1'))['db'][_0x6f05('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6f05('0x3')](0x0);var events={'afterCreate':_0x6f05('0x4'),'afterUpdate':_0x6f05('0x5'),'afterDestroy':'remove'};function emitEvent(_0x19bcab){return function(_0x8c1c1d,_0x331136,_0x2305a8){VoiceQueueEvents[_0x6f05('0x6')](_0x19bcab+':'+_0x8c1c1d['id'],_0x8c1c1d);VoiceQueueEvents[_0x6f05('0x6')](_0x19bcab,_0x8c1c1d);_0x2305a8(null);};}for(var e in events){if(events[_0x6f05('0x7')](e)){var event=events[e];VoiceQueue[_0x6f05('0x8')](e,emitEvent(event));}}module[_0x6f05('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 77f8556..fe47aa0 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 _0x7b26=['lodash','util','../../config/logger','api','moment','bluebird','path','./voiceQueue.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b26,0x168));var _0x67b2=function(_0x463b56,_0x38026e){_0x463b56=_0x463b56-0x0;var _0x1b47d6=_0x7b26[_0x463b56];return _0x1b47d6;};'use strict';var _=require(_0x67b2('0x0'));var util=require(_0x67b2('0x1'));var logger=require(_0x67b2('0x2'))(_0x67b2('0x3'));var moment=require(_0x67b2('0x4'));var BPromise=require(_0x67b2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67b2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x67b2('0x7'));module[_0x67b2('0x8')]=function(_0x498122,_0xd52dff){return _0x498122[_0x67b2('0x9')]('VoiceQueue',attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39d0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','VoiceQueue','voice_queues','lodash'];(function(_0x5d6480,_0x5c57d5){var _0x1d8a4a=function(_0x1e24be){while(--_0x1e24be){_0x5d6480['push'](_0x5d6480['shift']());}};_0x1d8a4a(++_0x5c57d5);}(_0x39d0,0x1b7));var _0x039d=function(_0x2cd352,_0x2387f2){_0x2cd352=_0x2cd352-0x0;var _0x35dd70=_0x39d0[_0x2cd352];return _0x35dd70;};'use strict';var _=require(_0x039d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x039d('0x1'));var moment=require(_0x039d('0x2'));var BPromise=require(_0x039d('0x3'));var rp=require(_0x039d('0x4'));var fs=require('fs');var path=require(_0x039d('0x5'));var rimraf=require(_0x039d('0x6'));var config=require(_0x039d('0x7'));var attributes=require(_0x039d('0x8'));module['exports']=function(_0x535d78,_0x10c18e){return _0x535d78['define'](_0x039d('0x9'),attributes,{'tableName':_0x039d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 5789ae7..adfe69f 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 _0x3a6f=['model','attributes','info','ShowVoiceQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','include','map'];(function(_0x202c99,_0x121caf){var _0x256a0f=function(_0x3a55fa){while(--_0x3a55fa){_0x202c99['push'](_0x202c99['shift']());}};_0x256a0f(++_0x121caf);}(_0x3a6f,0x18a));var _0xf3a6=function(_0x2995bd,_0x58bace){_0x2995bd=_0x2995bd-0x0;var _0x23ed93=_0x3a6f[_0x2995bd];return _0x23ed93;};'use strict';var _=require('lodash');var util=require(_0xf3a6('0x0'));var moment=require(_0xf3a6('0x1'));var BPromise=require('bluebird');var rs=require(_0xf3a6('0x2'));var fs=require('fs');var Redis=require(_0xf3a6('0x3'));var db=require(_0xf3a6('0x4'))['db'];var utils=require(_0xf3a6('0x5'));var logger=require(_0xf3a6('0x6'))('rpc');var config=require(_0xf3a6('0x7'));var jayson=require(_0xf3a6('0x8'));var client=jayson[_0xf3a6('0x9')][_0xf3a6('0xa')]({'port':0x232a});config[_0xf3a6('0xb')]=_['defaults'](config[_0xf3a6('0xb')],{'host':_0xf3a6('0xc'),'port':0x18eb});var socket=require(_0xf3a6('0xd'))(new Redis(config[_0xf3a6('0xb')]));require(_0xf3a6('0xe'))[_0xf3a6('0xf')](socket);function respondWithRpcPromise(_0x967eb5,_0x4c8356,_0x189caa){return new BPromise(function(_0x1fe511,_0x2edd2f){return client[_0xf3a6('0x10')](_0x967eb5,_0x189caa)[_0xf3a6('0x11')](function(_0x33cf21){logger['info'](_0xf3a6('0x12'),_0x4c8356,_0xf3a6('0x13'));logger[_0xf3a6('0x14')](_0xf3a6('0x15'),_0x4c8356,_0xf3a6('0x13'),JSON[_0xf3a6('0x16')](_0x33cf21));if(_0x33cf21['error']){if(_0x33cf21[_0xf3a6('0x17')][_0xf3a6('0x18')]===0x1f4){logger[_0xf3a6('0x17')](_0xf3a6('0x12'),_0x4c8356,_0x33cf21[_0xf3a6('0x17')][_0xf3a6('0x19')]);return _0x2edd2f(_0x33cf21[_0xf3a6('0x17')]['message']);}logger[_0xf3a6('0x17')](_0xf3a6('0x12'),_0x4c8356,_0x33cf21[_0xf3a6('0x17')]['message']);return _0x1fe511(_0x33cf21['error']['message']);}else{logger['info'](_0xf3a6('0x12'),_0x4c8356,_0xf3a6('0x13'));_0x1fe511(_0x33cf21['result'][_0xf3a6('0x19')]);}})[_0xf3a6('0x1a')](function(_0x36be51){logger[_0xf3a6('0x17')](_0xf3a6('0x12'),_0x4c8356,_0x36be51);_0x2edd2f(_0x36be51);});});}exports[_0xf3a6('0x1b')]=function(_0x248e01){var _0x4fe3b3=this;return new Promise(function(_0x4d0ccd,_0x2dd09e){return db[_0xf3a6('0x1c')][_0xf3a6('0x1d')]({'raw':_0x248e01['options']?_0x248e01[_0xf3a6('0x1e')][_0xf3a6('0x1f')]===undefined?!![]:![]:!![],'where':_0x248e01[_0xf3a6('0x1e')]?_0x248e01[_0xf3a6('0x1e')][_0xf3a6('0x20')]||null:null,'attributes':_0x248e01[_0xf3a6('0x1e')]?_0x248e01['options']['attributes']||null:null,'limit':_0x248e01[_0xf3a6('0x1e')]?_0x248e01[_0xf3a6('0x1e')]['limit']||null:null,'include':_0x248e01[_0xf3a6('0x1e')]?_0x248e01[_0xf3a6('0x1e')][_0xf3a6('0x21')]?_[_0xf3a6('0x22')](_0x248e01['options'][_0xf3a6('0x21')],function(_0x4d428d){return{'model':db[_0x4d428d[_0xf3a6('0x23')]],'as':_0x4d428d['as'],'attributes':_0x4d428d[_0xf3a6('0x24')],'include':_0x4d428d[_0xf3a6('0x21')]?_[_0xf3a6('0x22')](_0x4d428d[_0xf3a6('0x21')],function(_0x2a2535){return{'model':db[_0x2a2535['model']],'as':_0x2a2535['as'],'attributes':_0x2a2535[_0xf3a6('0x24')],'include':_0x2a2535['include']?_[_0xf3a6('0x22')](_0x2a2535[_0xf3a6('0x21')],function(_0x55b838){return{'model':db[_0x55b838[_0xf3a6('0x23')]],'as':_0x55b838['as'],'attributes':_0x55b838[_0xf3a6('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf3a6('0x11')](function(_0x2dc755){logger[_0xf3a6('0x25')](_0xf3a6('0x1b'),_0x248e01);logger[_0xf3a6('0x14')](_0xf3a6('0x1b'),_0x248e01,JSON[_0xf3a6('0x16')](_0x2dc755));_0x4d0ccd(_0x2dc755);})[_0xf3a6('0x1a')](function(_0x10c3f0){logger[_0xf3a6('0x17')]('GetVoiceQueue',_0x10c3f0[_0xf3a6('0x19')],_0x248e01);_0x2dd09e(_0x4fe3b3[_0xf3a6('0x17')](0x1f4,_0x10c3f0['message']));});});};exports[_0xf3a6('0x26')]=function(_0xbab23f){var _0x3a63cb=this;return new Promise(function(_0x57647d,_0x445eae){return db[_0xf3a6('0x1c')]['find']({'raw':_0xbab23f[_0xf3a6('0x1e')]?_0xbab23f['options'][_0xf3a6('0x1f')]===undefined?!![]:![]:!![],'where':_0xbab23f['options']?_0xbab23f[_0xf3a6('0x1e')]['where']||null:null,'attributes':_0xbab23f[_0xf3a6('0x1e')]?_0xbab23f[_0xf3a6('0x1e')][_0xf3a6('0x24')]||null:null,'include':_0xbab23f['options']?_0xbab23f['options'][_0xf3a6('0x21')]?_['map'](_0xbab23f[_0xf3a6('0x1e')]['include'],function(_0x37be1c){return{'model':db[_0x37be1c['model']],'as':_0x37be1c['as'],'attributes':_0x37be1c['attributes'],'include':_0x37be1c[_0xf3a6('0x21')]?_[_0xf3a6('0x22')](_0x37be1c[_0xf3a6('0x21')],function(_0x52fa32){return{'model':db[_0x52fa32[_0xf3a6('0x23')]],'as':_0x52fa32['as'],'attributes':_0x52fa32[_0xf3a6('0x24')],'include':_0x52fa32['include']?_['map'](_0x52fa32[_0xf3a6('0x21')],function(_0x447b9a){return{'model':db[_0x447b9a[_0xf3a6('0x23')]],'as':_0x447b9a['as'],'attributes':_0x447b9a[_0xf3a6('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf3a6('0x11')](function(_0x295fc4){logger[_0xf3a6('0x25')](_0xf3a6('0x26'),_0xbab23f);logger['debug'](_0xf3a6('0x26'),_0xbab23f,JSON[_0xf3a6('0x16')](_0x295fc4));_0x57647d(_0x295fc4);})[_0xf3a6('0x1a')](function(_0xf067b2){logger[_0xf3a6('0x17')](_0xf3a6('0x26'),_0xf067b2[_0xf3a6('0x19')],_0xbab23f);_0x445eae(_0x3a63cb[_0xf3a6('0x17')](0x1f4,_0xf067b2[_0xf3a6('0x19')]));});});}; \ No newline at end of file +var _0x1017=['VoiceQueue','findAll','options','where','attributes','limit','include','map','model','ShowVoiceQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue'];(function(_0x1a01cb,_0x203627){var _0x544841=function(_0x163394){while(--_0x163394){_0x1a01cb['push'](_0x1a01cb['shift']());}};_0x544841(++_0x203627);}(_0x1017,0x164));var _0x7101=function(_0xecf33f,_0x8ce7ec){_0xecf33f=_0xecf33f-0x0;var _0x2eb0f4=_0x1017[_0xecf33f];return _0x2eb0f4;};'use strict';var _=require(_0x7101('0x0'));var util=require(_0x7101('0x1'));var moment=require(_0x7101('0x2'));var BPromise=require(_0x7101('0x3'));var rs=require(_0x7101('0x4'));var fs=require('fs');var Redis=require(_0x7101('0x5'));var db=require(_0x7101('0x6'))['db'];var utils=require(_0x7101('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7101('0x8'));var jayson=require(_0x7101('0x9'));var client=jayson[_0x7101('0xa')][_0x7101('0xb')]({'port':0x232a});config[_0x7101('0xc')]=_[_0x7101('0xd')](config[_0x7101('0xc')],{'host':_0x7101('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7101('0xc')]));require(_0x7101('0xf'))[_0x7101('0x10')](socket);function respondWithRpcPromise(_0x59af00,_0x1b4b74,_0x1232d1){return new BPromise(function(_0x43e794,_0x32f0e2){return client[_0x7101('0x11')](_0x59af00,_0x1232d1)[_0x7101('0x12')](function(_0x3cc212){logger['info'](_0x7101('0x13'),_0x1b4b74,'request\x20sent');logger[_0x7101('0x14')](_0x7101('0x15'),_0x1b4b74,_0x7101('0x16'),JSON[_0x7101('0x17')](_0x3cc212));if(_0x3cc212['error']){if(_0x3cc212[_0x7101('0x18')][_0x7101('0x19')]===0x1f4){logger[_0x7101('0x18')](_0x7101('0x13'),_0x1b4b74,_0x3cc212[_0x7101('0x18')][_0x7101('0x1a')]);return _0x32f0e2(_0x3cc212[_0x7101('0x18')][_0x7101('0x1a')]);}logger[_0x7101('0x18')](_0x7101('0x13'),_0x1b4b74,_0x3cc212[_0x7101('0x18')]['message']);return _0x43e794(_0x3cc212[_0x7101('0x18')][_0x7101('0x1a')]);}else{logger[_0x7101('0x1b')]('VoiceQueue,\x20%s,\x20%s',_0x1b4b74,_0x7101('0x16'));_0x43e794(_0x3cc212[_0x7101('0x1c')][_0x7101('0x1a')]);}})[_0x7101('0x1d')](function(_0x196802){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x1b4b74,_0x196802);_0x32f0e2(_0x196802);});});}exports[_0x7101('0x1e')]=function(_0x7b4d63){var _0x5803a8=this;return new Promise(function(_0x2e8e32,_0x45ce44){return db[_0x7101('0x1f')][_0x7101('0x20')]({'raw':_0x7b4d63['options']?_0x7b4d63[_0x7101('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x7b4d63[_0x7101('0x21')]?_0x7b4d63[_0x7101('0x21')][_0x7101('0x22')]||null:null,'attributes':_0x7b4d63['options']?_0x7b4d63[_0x7101('0x21')][_0x7101('0x23')]||null:null,'limit':_0x7b4d63['options']?_0x7b4d63[_0x7101('0x21')][_0x7101('0x24')]||null:null,'include':_0x7b4d63[_0x7101('0x21')]?_0x7b4d63[_0x7101('0x21')][_0x7101('0x25')]?_[_0x7101('0x26')](_0x7b4d63[_0x7101('0x21')][_0x7101('0x25')],function(_0x43dda0){return{'model':db[_0x43dda0['model']],'as':_0x43dda0['as'],'attributes':_0x43dda0[_0x7101('0x23')],'include':_0x43dda0['include']?_[_0x7101('0x26')](_0x43dda0[_0x7101('0x25')],function(_0xb10d1a){return{'model':db[_0xb10d1a[_0x7101('0x27')]],'as':_0xb10d1a['as'],'attributes':_0xb10d1a[_0x7101('0x23')],'include':_0xb10d1a[_0x7101('0x25')]?_[_0x7101('0x26')](_0xb10d1a[_0x7101('0x25')],function(_0x1c3c58){return{'model':db[_0x1c3c58[_0x7101('0x27')]],'as':_0x1c3c58['as'],'attributes':_0x1c3c58['attributes']};}):[]};}):[]};}):[]:[]})[_0x7101('0x12')](function(_0x49f18c){logger[_0x7101('0x1b')](_0x7101('0x1e'),_0x7b4d63);logger[_0x7101('0x14')]('GetVoiceQueue',_0x7b4d63,JSON[_0x7101('0x17')](_0x49f18c));_0x2e8e32(_0x49f18c);})['catch'](function(_0x1fe43e){logger[_0x7101('0x18')](_0x7101('0x1e'),_0x1fe43e[_0x7101('0x1a')],_0x7b4d63);_0x45ce44(_0x5803a8[_0x7101('0x18')](0x1f4,_0x1fe43e[_0x7101('0x1a')]));});});};exports[_0x7101('0x28')]=function(_0x2bd726){var _0x50f95b=this;return new Promise(function(_0x512b1e,_0xf33ec6){return db['VoiceQueue'][_0x7101('0x29')]({'raw':_0x2bd726[_0x7101('0x21')]?_0x2bd726[_0x7101('0x21')][_0x7101('0x2a')]===undefined?!![]:![]:!![],'where':_0x2bd726[_0x7101('0x21')]?_0x2bd726[_0x7101('0x21')][_0x7101('0x22')]||null:null,'attributes':_0x2bd726['options']?_0x2bd726[_0x7101('0x21')]['attributes']||null:null,'include':_0x2bd726[_0x7101('0x21')]?_0x2bd726[_0x7101('0x21')][_0x7101('0x25')]?_[_0x7101('0x26')](_0x2bd726[_0x7101('0x21')]['include'],function(_0x2675d9){return{'model':db[_0x2675d9[_0x7101('0x27')]],'as':_0x2675d9['as'],'attributes':_0x2675d9['attributes'],'include':_0x2675d9[_0x7101('0x25')]?_[_0x7101('0x26')](_0x2675d9['include'],function(_0x11c340){return{'model':db[_0x11c340[_0x7101('0x27')]],'as':_0x11c340['as'],'attributes':_0x11c340[_0x7101('0x23')],'include':_0x11c340[_0x7101('0x25')]?_[_0x7101('0x26')](_0x11c340[_0x7101('0x25')],function(_0x56973c){return{'model':db[_0x56973c[_0x7101('0x27')]],'as':_0x56973c['as'],'attributes':_0x56973c[_0x7101('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7e5964){logger[_0x7101('0x1b')](_0x7101('0x28'),_0x2bd726);logger[_0x7101('0x14')](_0x7101('0x28'),_0x2bd726,JSON[_0x7101('0x17')](_0x7e5964));_0x512b1e(_0x7e5964);})['catch'](function(_0x285dc3){logger[_0x7101('0x18')](_0x7101('0x28'),_0x285dc3[_0x7101('0x1a')],_0x2bd726);_0xf33ec6(_0x50f95b[_0x7101('0x18')](0x1f4,_0x285dc3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index c9da74d..9caedde 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 _0xad55=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x17a0a0,_0x1befaa){var _0x4da752=function(_0x429829){while(--_0x429829){_0x17a0a0['push'](_0x17a0a0['shift']());}};_0x4da752(++_0x1befaa);}(_0xad55,0xe8));var _0x5ad5=function(_0x649a34,_0x131a6e){_0x649a34=_0x649a34-0x0;var _0x954a14=_0xad55[_0x649a34];return _0x954a14;};'use strict';var VoiceQueueEvents=require(_0x5ad5('0x0'));var events=[_0x5ad5('0x1'),_0x5ad5('0x2'),_0x5ad5('0x3')];function createListener(_0x3b1550,_0x445b7c){return function(_0xdbbce){_0x445b7c[_0x5ad5('0x4')](_0x3b1550,_0xdbbce);};}function removeListener(_0x40ee15,_0x3cdf34){return function(){VoiceQueueEvents[_0x5ad5('0x5')](_0x40ee15,_0x3cdf34);};}exports[_0x5ad5('0x6')]=function(_0x4fd75a){for(var _0x418d0d=0x0,_0x564bec=events[_0x5ad5('0x7')];_0x418d0d<_0x564bec;_0x418d0d++){var _0xb2dc4d=events[_0x418d0d];var _0x935202=createListener(_0x5ad5('0x8')+_0xb2dc4d,_0x4fd75a);VoiceQueueEvents['on'](_0xb2dc4d,_0x935202);}}; \ No newline at end of file +var _0xb575=['voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x43de93,_0x5daf15){var _0x168e48=function(_0x2f9c2e){while(--_0x2f9c2e){_0x43de93['push'](_0x43de93['shift']());}};_0x168e48(++_0x5daf15);}(_0xb575,0x1a8));var _0x5b57=function(_0x2e4e65,_0x2f3342){_0x2e4e65=_0x2e4e65-0x0;var _0x241ab0=_0xb575[_0x2e4e65];return _0x241ab0;};'use strict';var VoiceQueueEvents=require(_0x5b57('0x0'));var events=[_0x5b57('0x1'),_0x5b57('0x2'),_0x5b57('0x3')];function createListener(_0x1d4265,_0x26e258){return function(_0x5a5c67){_0x26e258[_0x5b57('0x4')](_0x1d4265,_0x5a5c67);};}function removeListener(_0x10b56f,_0x4d2871){return function(){VoiceQueueEvents[_0x5b57('0x5')](_0x10b56f,_0x4d2871);};}exports[_0x5b57('0x6')]=function(_0x4e3dca){for(var _0x50fd34=0x0,_0x3e4992=events[_0x5b57('0x7')];_0x50fd34<_0x3e4992;_0x50fd34++){var _0x4685fd=events[_0x50fd34];var _0x3095d3=createListener(_0x5b57('0x8')+_0x4685fd,_0x4e3dca);VoiceQueueEvents['on'](_0x4685fd,_0x3095d3);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1b950d7..7a42f48 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 _0x7278=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7278,0x161));var _0x8727=function(_0x2c841d,_0x2f60e8){_0x2c841d=_0x2c841d-0x0;var _0xbebfa3=_0x7278[_0x2c841d];return _0xbebfa3;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var auth=require(_0x8727('0x5'));var interaction=require(_0x8727('0x6'));var config=require(_0x8727('0x7'));var controller=require(_0x8727('0x8'));router[_0x8727('0x9')]('/',auth[_0x8727('0xa')](),controller[_0x8727('0xb')]);router['get'](_0x8727('0xc'),auth[_0x8727('0xa')](),controller[_0x8727('0xd')]);router[_0x8727('0x9')](_0x8727('0xe'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router['get'](_0x8727('0xf'),auth[_0x8727('0xa')](),controller[_0x8727('0x10')]);router[_0x8727('0x11')]('/',auth[_0x8727('0xa')](),controller[_0x8727('0x12')]);router[_0x8727('0x13')](_0x8727('0xf'),auth['isAuthenticated'](),controller[_0x8727('0x14')]);router[_0x8727('0x15')](_0x8727('0xf'),auth['isAuthenticated'](),controller[_0x8727('0x16')]);module[_0x8727('0x17')]=router; \ No newline at end of file +var _0x0424=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','show','post','create','put','/:id'];(function(_0x5f38ae,_0x4b964a){var _0x530936=function(_0x209d89){while(--_0x209d89){_0x5f38ae['push'](_0x5f38ae['shift']());}};_0x530936(++_0x4b964a);}(_0x0424,0x159));var _0x4042=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0x0424[_0x26721d];return _0x1035c5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4042('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x4042('0x5')]('/',auth[_0x4042('0x6')](),controller[_0x4042('0x7')]);router[_0x4042('0x5')](_0x4042('0x8'),auth[_0x4042('0x6')](),controller[_0x4042('0x9')]);router['get']('/index',auth[_0x4042('0x6')](),controller[_0x4042('0xa')]);router[_0x4042('0x5')]('/:id',auth[_0x4042('0x6')](),controller[_0x4042('0xb')]);router[_0x4042('0xc')]('/',auth[_0x4042('0x6')](),controller[_0x4042('0xd')]);router[_0x4042('0xe')](_0x4042('0xf'),auth[_0x4042('0x6')](),controller['update']);router[_0x4042('0x10')](_0x4042('0xf'),auth['isAuthenticated'](),controller[_0x4042('0x11')]);module[_0x4042('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a2fb82e..990d186 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 _0x3869=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue'];(function(_0x10cd9d,_0x3d2036){var _0x4a497b=function(_0x3cbcaa){while(--_0x3cbcaa){_0x10cd9d['push'](_0x10cd9d['shift']());}};_0x4a497b(++_0x3d2036);}(_0x3869,0x115));var _0x9386=function(_0x5a5a80,_0xadd7bf){_0x5a5a80=_0x5a5a80-0x0;var _0x481eb0=_0x3869[_0x5a5a80];return _0x481eb0;};'use strict';var Sequelize=require(_0x9386('0x0'));var moment=require(_0x9386('0x1'));module[_0x9386('0x2')]={'type':{'type':Sequelize[_0x9386('0x3')]},'uniqueid':{'type':Sequelize[_0x9386('0x3')]},'calleridnum':{'type':Sequelize[_0x9386('0x3')]},'calleridname':{'type':Sequelize[_0x9386('0x3')]},'queue':{'type':Sequelize[_0x9386('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x9386('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x9386('0x4')],'set':function(_0x2f739a){var _0x7da0e4=moment(_0x2f739a);var _0x40aa5b=moment(this[_0x9386('0x5')](_0x9386('0x6')))[_0x9386('0x7')](_0x9386('0x8'));var _0x23b736=_0x7da0e4[_0x9386('0x9')](_0x40aa5b,_0x9386('0xa'));this['setDataValue']('queuecallerleaveAt',_0x2f739a);this[_0x9386('0xb')](_0x9386('0xc'),_0x23b736||null);}},'position':{'type':Sequelize[_0x9386('0xd')]},'count':{'type':Sequelize[_0x9386('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x9386('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9386('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x9386('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9386('0x4')]},'queuecallerexit':{'type':Sequelize[_0x9386('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x9386('0x3')],'comment':_0x9386('0xf')},'originalposition':{'type':Sequelize[_0x9386('0xd')]},'channel':{'type':Sequelize[_0x9386('0x3')]},'connectedlinenum':{'type':Sequelize[_0x9386('0x3')]},'connectedlinename':{'type':Sequelize[_0x9386('0x3')]},'accountcode':{'type':Sequelize[_0x9386('0x3')]},'context':{'type':Sequelize[_0x9386('0x3')]},'exten':{'type':Sequelize[_0x9386('0x3')]},'priority':{'type':Sequelize[_0x9386('0x3')]},'holdtime':{'type':Sequelize[_0x9386('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9386('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9386('0x3')]},'transfer':{'type':Sequelize[_0x9386('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9386('0x10')},'transferexten':{'type':Sequelize[_0x9386('0x3')]},'transferuniqueid':{'type':Sequelize[_0x9386('0x3')]},'disposition':{'type':Sequelize[_0x9386('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x9386('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5cad=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment'];(function(_0x4bbb56,_0xc28037){var _0x523793=function(_0x2f9f4e){while(--_0x2f9f4e){_0x4bbb56['push'](_0x4bbb56['shift']());}};_0x523793(++_0xc28037);}(_0x5cad,0x116));var _0xd5ca=function(_0x32b9c9,_0x5881e6){_0x32b9c9=_0x32b9c9-0x0;var _0x1a837f=_0x5cad[_0x32b9c9];return _0x1a837f;};'use strict';var Sequelize=require(_0xd5ca('0x0'));var moment=require(_0xd5ca('0x1'));module[_0xd5ca('0x2')]={'type':{'type':Sequelize[_0xd5ca('0x3')]},'uniqueid':{'type':Sequelize[_0xd5ca('0x3')]},'calleridnum':{'type':Sequelize[_0xd5ca('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd5ca('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xd5ca('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xd5ca('0x4')],'set':function(_0x1085b7){var _0x560c84=moment(_0x1085b7);var _0x3af403=moment(this[_0xd5ca('0x5')](_0xd5ca('0x6')))[_0xd5ca('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5fc51f=_0x560c84[_0xd5ca('0x8')](_0x3af403,_0xd5ca('0x9'));this[_0xd5ca('0xa')]('queuecallerleaveAt',_0x1085b7);this[_0xd5ca('0xa')]('holdtime',_0x5fc51f||null);}},'position':{'type':Sequelize[_0xd5ca('0xb')]},'count':{'type':Sequelize[_0xd5ca('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xd5ca('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd5ca('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xd5ca('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd5ca('0x4')]},'queuecallerexit':{'type':Sequelize[_0xd5ca('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd5ca('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xd5ca('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd5ca('0x3')]},'connectedlinename':{'type':Sequelize[_0xd5ca('0x3')]},'accountcode':{'type':Sequelize[_0xd5ca('0x3')]},'context':{'type':Sequelize[_0xd5ca('0x3')]},'exten':{'type':Sequelize[_0xd5ca('0x3')]},'priority':{'type':Sequelize[_0xd5ca('0x3')]},'holdtime':{'type':Sequelize[_0xd5ca('0xb')]},'mohtime':{'type':Sequelize[_0xd5ca('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd5ca('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd5ca('0x3')]},'transfer':{'type':Sequelize[_0xd5ca('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd5ca('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd5ca('0x3')]},'disposition':{'type':Sequelize[_0xd5ca('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 66869aa..cf6744f 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(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x7a54,0x106));var _0x47a5=function(_0x4ea440,_0x3f645d){_0x4ea440=_0x4ea440-0x0;var _0x42e284=_0x7a54[_0x4ea440];return _0x42e284;};'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(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];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 2efd6d9..bea9a9c 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 _0x43ff=['../../mysqldb','VoiceQueueReport','save','update','remove','emit','events'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x43ff,0x11e));var _0xf43f=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x43ff[_0x43d16c];return _0x208cce;};'use strict';var EventEmitter=require(_0xf43f('0x0'));var VoiceQueueReport=require(_0xf43f('0x1'))['db'][_0xf43f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf43f('0x3'),'afterUpdate':_0xf43f('0x4'),'afterDestroy':_0xf43f('0x5')};function emitEvent(_0x2719bf){return function(_0x129245,_0x355c7a,_0x270ba7){VoiceQueueReportEvents[_0xf43f('0x6')](_0x2719bf+':'+_0x129245['id'],_0x129245);VoiceQueueReportEvents['emit'](_0x2719bf,_0x129245);_0x270ba7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x0a09=['../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','hasOwnProperty','hook','exports'];(function(_0x22b9c0,_0x50df78){var _0x1970ed=function(_0x3207da){while(--_0x3207da){_0x22b9c0['push'](_0x22b9c0['shift']());}};_0x1970ed(++_0x50df78);}(_0x0a09,0x1b8));var _0x90a0=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x0a09[_0x40bffc];return _0x3007e9;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x90a0('0x0'))['db'][_0x90a0('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x90a0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x90a0('0x3'),'afterDestroy':_0x90a0('0x4')};function emitEvent(_0x3725fd){return function(_0x1f1421,_0x4e0aa4,_0x586b88){VoiceQueueReportEvents['emit'](_0x3725fd+':'+_0x1f1421['id'],_0x1f1421);VoiceQueueReportEvents['emit'](_0x3725fd,_0x1f1421);_0x586b88(null);};}for(var e in events){if(events[_0x90a0('0x5')](e)){var event=events[e];VoiceQueueReport[_0x90a0('0x6')](e,emitEvent(event));}}module[_0x90a0('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 5e04393..edd54fc 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 _0x9a23=['exports','report_queue','uniqueid','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceQueueReport.attributes'];(function(_0x3f0c88,_0x4b45c4){var _0x434d6b=function(_0x12b433){while(--_0x12b433){_0x3f0c88['push'](_0x3f0c88['shift']());}};_0x434d6b(++_0x4b45c4);}(_0x9a23,0xac));var _0x39a2=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9a23[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x39a2('0x0'));var logger=require(_0x39a2('0x1'))(_0x39a2('0x2'));var moment=require(_0x39a2('0x3'));var BPromise=require(_0x39a2('0x4'));var rp=require(_0x39a2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x39a2('0x6'));var attributes=require(_0x39a2('0x7'));module[_0x39a2('0x8')]=function(_0x2d8d54,_0x20da07){return _0x2d8d54['define']('VoiceQueueReport',attributes,{'tableName':_0x39a2('0x9'),'paranoid':![],'indexes':[{'fields':[_0x39a2('0xa')]},{'fields':[_0x39a2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe171=['bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api'];(function(_0x47e0a0,_0x2c06bc){var _0x14c9bc=function(_0x381974){while(--_0x381974){_0x47e0a0['push'](_0x47e0a0['shift']());}};_0x14c9bc(++_0x2c06bc);}(_0xe171,0x1d1));var _0x1e17=function(_0x34010b,_0x255a63){_0x34010b=_0x34010b-0x0;var _0x186bde=_0xe171[_0x34010b];return _0x186bde;};'use strict';var _=require(_0x1e17('0x0'));var util=require('util');var logger=require(_0x1e17('0x1'))(_0x1e17('0x2'));var moment=require('moment');var BPromise=require(_0x1e17('0x3'));var rp=require(_0x1e17('0x4'));var fs=require('fs');var path=require(_0x1e17('0x5'));var rimraf=require(_0x1e17('0x6'));var config=require('../../config/environment');var attributes=require(_0x1e17('0x7'));module['exports']=function(_0x546b7d,_0x9d1691){return _0x546b7d[_0x1e17('0x8')](_0x1e17('0x9'),attributes,{'tableName':_0x1e17('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1e17('0xb')]},{'fields':[_0x1e17('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0c053e1..73d5fc5 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 _0x99ef=['request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x99ef,0x13e));var _0xf99e=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x99ef[_0x396466];return _0x5e9ab4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf99e('0x0'));var BPromise=require(_0xf99e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf99e('0x2'));var db=require(_0xf99e('0x3'))['db'];var utils=require(_0xf99e('0x4'));var logger=require('../../config/logger')(_0xf99e('0x5'));var config=require(_0xf99e('0x6'));var jayson=require(_0xf99e('0x7'));var client=jayson[_0xf99e('0x8')][_0xf99e('0x9')]({'port':0x232a});config['redis']=_[_0xf99e('0xa')](config['redis'],{'host':_0xf99e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf99e('0xc')]));require(_0xf99e('0xd'))[_0xf99e('0xe')](socket);function respondWithRpcPromise(_0x4a697f,_0x5a6eb4,_0x3724d0){return new BPromise(function(_0x1a9a94,_0x576e68){return client[_0xf99e('0xf')](_0x4a697f,_0x3724d0)[_0xf99e('0x10')](function(_0xe7536){logger['info'](_0xf99e('0x11'),_0x5a6eb4,_0xf99e('0x12'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5a6eb4,_0xf99e('0x12'),JSON[_0xf99e('0x13')](_0xe7536));if(_0xe7536[_0xf99e('0x14')]){if(_0xe7536['error'][_0xf99e('0x15')]===0x1f4){logger['error'](_0xf99e('0x11'),_0x5a6eb4,_0xe7536['error'][_0xf99e('0x16')]);return _0x576e68(_0xe7536['error'][_0xf99e('0x16')]);}logger[_0xf99e('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x5a6eb4,_0xe7536['error'][_0xf99e('0x16')]);return _0x1a9a94(_0xe7536[_0xf99e('0x14')][_0xf99e('0x16')]);}else{logger[_0xf99e('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x5a6eb4,_0xf99e('0x12'));_0x1a9a94(_0xe7536[_0xf99e('0x18')][_0xf99e('0x16')]);}})[_0xf99e('0x19')](function(_0x2b6e9b){logger[_0xf99e('0x14')](_0xf99e('0x11'),_0x5a6eb4,_0x2b6e9b);_0x576e68(_0x2b6e9b);});});}exports[_0xf99e('0x1a')]=function(_0x587540){var _0x13de78=this;return new Promise(function(_0x5c2fe1,_0x155353){return db[_0xf99e('0x1b')][_0xf99e('0x1c')]({'raw':_0x587540[_0xf99e('0x1d')]?_0x587540[_0xf99e('0x1d')][_0xf99e('0x1e')]===undefined?!![]:![]:!![],'where':_0x587540[_0xf99e('0x1d')]?_0x587540[_0xf99e('0x1d')][_0xf99e('0x1f')]||null:null,'attributes':_0x587540['options']?_0x587540[_0xf99e('0x1d')][_0xf99e('0x20')]||null:null,'limit':_0x587540[_0xf99e('0x1d')]?_0x587540[_0xf99e('0x1d')][_0xf99e('0x21')]||null:null,'include':_0x587540['options']?_0x587540['options'][_0xf99e('0x22')]?_[_0xf99e('0x23')](_0x587540[_0xf99e('0x1d')][_0xf99e('0x22')],function(_0x53d4db){return{'model':db[_0x53d4db[_0xf99e('0x24')]],'as':_0x53d4db['as'],'attributes':_0x53d4db[_0xf99e('0x20')],'include':_0x53d4db[_0xf99e('0x22')]?_[_0xf99e('0x23')](_0x53d4db[_0xf99e('0x22')],function(_0x25d3a8){return{'model':db[_0x25d3a8['model']],'as':_0x25d3a8['as'],'attributes':_0x25d3a8[_0xf99e('0x20')],'include':_0x25d3a8[_0xf99e('0x22')]?_[_0xf99e('0x23')](_0x25d3a8[_0xf99e('0x22')],function(_0x3beb30){return{'model':db[_0x3beb30[_0xf99e('0x24')]],'as':_0x3beb30['as'],'attributes':_0x3beb30[_0xf99e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf99e('0x10')](function(_0x3dbe7e){logger['info'](_0xf99e('0x1a'),_0x587540);logger[_0xf99e('0x25')](_0xf99e('0x1a'),_0x587540,JSON[_0xf99e('0x13')](_0x3dbe7e));_0x5c2fe1(_0x3dbe7e);})['catch'](function(_0x3240af){logger[_0xf99e('0x14')]('GetVoiceQueueReport',_0x3240af[_0xf99e('0x16')],_0x587540);_0x155353(_0x13de78[_0xf99e('0x14')](0x1f4,_0x3240af['message']));});});};exports[_0xf99e('0x26')]=function(_0x3610be){var _0x458490=this;return new Promise(function(_0x4a559a,_0x259823){return db[_0xf99e('0x1b')][_0xf99e('0x27')](_0x3610be[_0xf99e('0x28')],{'raw':_0x3610be[_0xf99e('0x1d')]?_0x3610be[_0xf99e('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xf99e('0x10')](function(_0x50c95c){logger['info']('CreateVoiceQueueReport',_0x3610be);logger[_0xf99e('0x25')]('CreateVoiceQueueReport',_0x3610be,JSON[_0xf99e('0x13')](_0x50c95c));_0x4a559a(_0x50c95c);})[_0xf99e('0x19')](function(_0x2b2f93){logger[_0xf99e('0x14')](_0xf99e('0x26'),_0x2b2f93[_0xf99e('0x16')],_0x3610be);_0x259823(_0x458490[_0xf99e('0x14')](0x1f4,_0x2b2f93[_0xf99e('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x1ecafa){var _0x4b37c1=this;return new Promise(function(_0x299b34,_0x3f7da7){return db['VoiceQueueReport']['update'](_0x1ecafa[_0xf99e('0x28')],{'raw':_0x1ecafa[_0xf99e('0x1d')]?_0x1ecafa[_0xf99e('0x1d')][_0xf99e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ecafa[_0xf99e('0x1d')]?_0x1ecafa[_0xf99e('0x1d')]['where']||null:null,'attributes':_0x1ecafa[_0xf99e('0x1d')]?_0x1ecafa[_0xf99e('0x1d')][_0xf99e('0x20')]||null:null,'limit':_0x1ecafa[_0xf99e('0x1d')]?_0x1ecafa[_0xf99e('0x1d')][_0xf99e('0x21')]||null:null})[_0xf99e('0x10')](function(_0x443efb){logger[_0xf99e('0x17')]('UpdateVoiceQueueReport',_0x1ecafa);logger['debug'](_0xf99e('0x29'),_0x1ecafa,JSON[_0xf99e('0x13')](_0x443efb));_0x299b34(_0x443efb);})[_0xf99e('0x19')](function(_0x5d4cda){logger[_0xf99e('0x14')](_0xf99e('0x29'),_0x5d4cda['message'],_0x1ecafa);_0x3f7da7(_0x4b37c1['error'](0x1f4,_0x5d4cda['message']));});});}; \ No newline at end of file +var _0x60dd=['update','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','map','include','model','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport'];(function(_0x35c774,_0x512268){var _0x1c4cd2=function(_0x5127bf){while(--_0x5127bf){_0x35c774['push'](_0x35c774['shift']());}};_0x1c4cd2(++_0x512268);}(_0x60dd,0x1af));var _0xd60d=function(_0x5e7f28,_0x233446){_0x5e7f28=_0x5e7f28-0x0;var _0x1532eb=_0x60dd[_0x5e7f28];return _0x1532eb;};'use strict';var _=require(_0xd60d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd60d('0x1'));var rs=require(_0xd60d('0x2'));var fs=require('fs');var Redis=require(_0xd60d('0x3'));var db=require(_0xd60d('0x4'))['db'];var utils=require(_0xd60d('0x5'));var logger=require('../../config/logger')(_0xd60d('0x6'));var config=require(_0xd60d('0x7'));var jayson=require(_0xd60d('0x8'));var client=jayson[_0xd60d('0x9')][_0xd60d('0xa')]({'port':0x232a});config[_0xd60d('0xb')]=_[_0xd60d('0xc')](config['redis'],{'host':_0xd60d('0xd'),'port':0x18eb});var socket=require(_0xd60d('0xe'))(new Redis(config[_0xd60d('0xb')]));require(_0xd60d('0xf'))[_0xd60d('0x10')](socket);function respondWithRpcPromise(_0x14e2d1,_0x230c4b,_0xef8320){return new BPromise(function(_0x2c9efd,_0x245d97){return client[_0xd60d('0x11')](_0x14e2d1,_0xef8320)[_0xd60d('0x12')](function(_0x3079e1){logger[_0xd60d('0x13')](_0xd60d('0x14'),_0x230c4b,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x230c4b,_0xd60d('0x15'),JSON[_0xd60d('0x16')](_0x3079e1));if(_0x3079e1[_0xd60d('0x17')]){if(_0x3079e1[_0xd60d('0x17')][_0xd60d('0x18')]===0x1f4){logger[_0xd60d('0x17')](_0xd60d('0x14'),_0x230c4b,_0x3079e1['error'][_0xd60d('0x19')]);return _0x245d97(_0x3079e1['error'][_0xd60d('0x19')]);}logger[_0xd60d('0x17')](_0xd60d('0x14'),_0x230c4b,_0x3079e1[_0xd60d('0x17')]['message']);return _0x2c9efd(_0x3079e1[_0xd60d('0x17')][_0xd60d('0x19')]);}else{logger['info'](_0xd60d('0x14'),_0x230c4b,_0xd60d('0x15'));_0x2c9efd(_0x3079e1['result'][_0xd60d('0x19')]);}})[_0xd60d('0x1a')](function(_0x21997c){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x230c4b,_0x21997c);_0x245d97(_0x21997c);});});}exports[_0xd60d('0x1b')]=function(_0x387576){var _0x323065=this;return new Promise(function(_0x251841,_0x399866){return db[_0xd60d('0x1c')]['findAll']({'raw':_0x387576[_0xd60d('0x1d')]?_0x387576[_0xd60d('0x1d')][_0xd60d('0x1e')]===undefined?!![]:![]:!![],'where':_0x387576[_0xd60d('0x1d')]?_0x387576[_0xd60d('0x1d')][_0xd60d('0x1f')]||null:null,'attributes':_0x387576['options']?_0x387576[_0xd60d('0x1d')][_0xd60d('0x20')]||null:null,'limit':_0x387576[_0xd60d('0x1d')]?_0x387576['options'][_0xd60d('0x21')]||null:null,'include':_0x387576['options']?_0x387576[_0xd60d('0x1d')]['include']?_[_0xd60d('0x22')](_0x387576[_0xd60d('0x1d')][_0xd60d('0x23')],function(_0x4d8350){return{'model':db[_0x4d8350[_0xd60d('0x24')]],'as':_0x4d8350['as'],'attributes':_0x4d8350[_0xd60d('0x20')],'include':_0x4d8350[_0xd60d('0x23')]?_[_0xd60d('0x22')](_0x4d8350[_0xd60d('0x23')],function(_0x4b9602){return{'model':db[_0x4b9602[_0xd60d('0x24')]],'as':_0x4b9602['as'],'attributes':_0x4b9602[_0xd60d('0x20')],'include':_0x4b9602[_0xd60d('0x23')]?_[_0xd60d('0x22')](_0x4b9602['include'],function(_0x1b6d0c){return{'model':db[_0x1b6d0c[_0xd60d('0x24')]],'as':_0x1b6d0c['as'],'attributes':_0x1b6d0c[_0xd60d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd60d('0x12')](function(_0xcd7513){logger[_0xd60d('0x13')]('GetVoiceQueueReport',_0x387576);logger[_0xd60d('0x25')](_0xd60d('0x1b'),_0x387576,JSON['stringify'](_0xcd7513));_0x251841(_0xcd7513);})['catch'](function(_0x23e468){logger[_0xd60d('0x17')]('GetVoiceQueueReport',_0x23e468[_0xd60d('0x19')],_0x387576);_0x399866(_0x323065[_0xd60d('0x17')](0x1f4,_0x23e468['message']));});});};exports[_0xd60d('0x26')]=function(_0x1e0865){var _0x1da526=this;return new Promise(function(_0x21c7a9,_0x4283be){return db[_0xd60d('0x1c')][_0xd60d('0x27')](_0x1e0865[_0xd60d('0x28')],{'raw':_0x1e0865[_0xd60d('0x1d')]?_0x1e0865[_0xd60d('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x341931){logger[_0xd60d('0x13')]('CreateVoiceQueueReport',_0x1e0865);logger[_0xd60d('0x25')]('CreateVoiceQueueReport',_0x1e0865,JSON['stringify'](_0x341931));_0x21c7a9(_0x341931);})['catch'](function(_0x528fe1){logger[_0xd60d('0x17')](_0xd60d('0x26'),_0x528fe1['message'],_0x1e0865);_0x4283be(_0x1da526[_0xd60d('0x17')](0x1f4,_0x528fe1[_0xd60d('0x19')]));});});};exports[_0xd60d('0x29')]=function(_0x8ec3de){var _0x20aa57=this;return new Promise(function(_0x1b2e22,_0xe326c1){return db['VoiceQueueReport'][_0xd60d('0x2a')](_0x8ec3de[_0xd60d('0x28')],{'raw':_0x8ec3de[_0xd60d('0x1d')]?_0x8ec3de['options'][_0xd60d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8ec3de[_0xd60d('0x1d')]?_0x8ec3de[_0xd60d('0x1d')]['where']||null:null,'attributes':_0x8ec3de[_0xd60d('0x1d')]?_0x8ec3de[_0xd60d('0x1d')][_0xd60d('0x20')]||null:null,'limit':_0x8ec3de['options']?_0x8ec3de['options'][_0xd60d('0x21')]||null:null})[_0xd60d('0x12')](function(_0xe9e018){logger[_0xd60d('0x13')](_0xd60d('0x29'),_0x8ec3de);logger[_0xd60d('0x25')](_0xd60d('0x29'),_0x8ec3de,JSON[_0xd60d('0x16')](_0xe9e018));_0x1b2e22(_0xe9e018);})[_0xd60d('0x1a')](function(_0xd08070){logger[_0xd60d('0x17')](_0xd60d('0x29'),_0xd08070['message'],_0x8ec3de);_0xe326c1(_0x20aa57[_0xd60d('0x17')](0x1f4,_0xd08070['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 2b284f7..10c70ef 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 _0x767d=['emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','remove','update'];(function(_0x11f4e1,_0x8958ca){var _0x47635b=function(_0x3e8e83){while(--_0x3e8e83){_0x11f4e1['push'](_0x11f4e1['shift']());}};_0x47635b(++_0x8958ca);}(_0x767d,0xcf));var _0xd767=function(_0x5f3361,_0x13d2ed){_0x5f3361=_0x5f3361-0x0;var _0x540456=_0x767d[_0x5f3361];return _0x540456;};'use strict';var VoiceQueueReportEvents=require(_0xd767('0x0'));var events=['save',_0xd767('0x1'),_0xd767('0x2')];function createListener(_0x425180,_0x121703){return function(_0x45accc){_0x121703[_0xd767('0x3')](_0x425180,_0x45accc);};}function removeListener(_0x1efed2,_0x144a15){return function(){VoiceQueueReportEvents[_0xd767('0x4')](_0x1efed2,_0x144a15);};}exports[_0xd767('0x5')]=function(_0x51156c){for(var _0x54adf8=0x0,_0x1e3810=events['length'];_0x54adf8<_0x1e3810;_0x54adf8++){var _0x4cb0ee=events[_0x54adf8];var _0x2e1da1=createListener(_0xd767('0x6')+_0x4cb0ee,_0x51156c);VoiceQueueReportEvents['on'](_0x4cb0ee,_0x2e1da1);}}; \ No newline at end of file +var _0x2780=['length','voiceQueueReport:','save','emit','register'];(function(_0x274c25,_0x2dc079){var _0x24d285=function(_0x166383){while(--_0x166383){_0x274c25['push'](_0x274c25['shift']());}};_0x24d285(++_0x2dc079);}(_0x2780,0x1a1));var _0x0278=function(_0x5ba103,_0x1e1f82){_0x5ba103=_0x5ba103-0x0;var _0x4d413c=_0x2780[_0x5ba103];return _0x4d413c;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x0278('0x0'),'remove','update'];function createListener(_0x3f44f1,_0x30027e){return function(_0x54ef61){_0x30027e[_0x0278('0x1')](_0x3f44f1,_0x54ef61);};}function removeListener(_0x15c628,_0x4d309f){return function(){VoiceQueueReportEvents['removeListener'](_0x15c628,_0x4d309f);};}exports[_0x0278('0x2')]=function(_0x4f1450){for(var _0x59bf51=0x0,_0x24d036=events[_0x0278('0x3')];_0x59bf51<_0x24d036;_0x59bf51++){var _0x4a78b1=events[_0x59bf51];var _0x4f3049=createListener(_0x0278('0x4')+_0x4a78b1,_0x4f1450);VoiceQueueReportEvents['on'](_0x4a78b1,_0x4f3049);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d83cf3b..2b8822f 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 _0xcb20=['./voiceQueuesLog.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1bf731,_0x52415b){var _0x491585=function(_0x562899){while(--_0x562899){_0x1bf731['push'](_0x1bf731['shift']());}};_0x491585(++_0x52415b);}(_0xcb20,0x129));var _0x0cb2=function(_0x3d6ca6,_0x3075b0){_0x3d6ca6=_0x3d6ca6-0x0;var _0x34065a=_0xcb20[_0x3d6ca6];return _0x34065a;};'use strict';var multer=require('multer');var util=require(_0x0cb2('0x0'));var path=require(_0x0cb2('0x1'));var timeout=require(_0x0cb2('0x2'));var express=require('express');var router=express[_0x0cb2('0x3')]();var auth=require(_0x0cb2('0x4'));var interaction=require(_0x0cb2('0x5'));var config=require(_0x0cb2('0x6'));var controller=require(_0x0cb2('0x7'));router[_0x0cb2('0x8')]('/',auth['isAuthenticated'](),controller[_0x0cb2('0x9')]);router['get'](_0x0cb2('0xa'),auth['isAuthenticated'](),controller[_0x0cb2('0xb')]);router[_0x0cb2('0xc')]('/',auth[_0x0cb2('0xd')](),controller[_0x0cb2('0xe')]);router[_0x0cb2('0xf')](_0x0cb2('0xa'),auth[_0x0cb2('0xd')](),controller[_0x0cb2('0x10')]);router['delete'](_0x0cb2('0xa'),auth[_0x0cb2('0xd')](),controller[_0x0cb2('0x11')]);module[_0x0cb2('0x12')]=router; \ No newline at end of file +var _0xec68=['./voiceQueuesLog.controller','get','index','isAuthenticated','/:id','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x4dafc1,_0x1ab01e){var _0x5e3d61=function(_0x48ea4f){while(--_0x48ea4f){_0x4dafc1['push'](_0x4dafc1['shift']());}};_0x5e3d61(++_0x1ab01e);}(_0xec68,0x174));var _0x8ec6=function(_0x280439,_0x553616){_0x280439=_0x280439-0x0;var _0x13109c=_0xec68[_0x280439];return _0x13109c;};'use strict';var multer=require(_0x8ec6('0x0'));var util=require('util');var path=require(_0x8ec6('0x1'));var timeout=require(_0x8ec6('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x8ec6('0x3'));var interaction=require(_0x8ec6('0x4'));var config=require('../../config/environment');var controller=require(_0x8ec6('0x5'));router[_0x8ec6('0x6')]('/',auth['isAuthenticated'](),controller[_0x8ec6('0x7')]);router[_0x8ec6('0x6')]('/:id',auth[_0x8ec6('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8ec6('0x9'),auth[_0x8ec6('0x8')](),controller[_0x8ec6('0xa')]);router[_0x8ec6('0xb')]('/:id',auth[_0x8ec6('0x8')](),controller['destroy']);module[_0x8ec6('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index f9189d8..5273b8a 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 _0xbd52=['moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x51e395,_0x5bfe2c){var _0x12ccef=function(_0x2ed6d1){while(--_0x2ed6d1){_0x51e395['push'](_0x51e395['shift']());}};_0x12ccef(++_0x5bfe2c);}(_0xbd52,0x1ce));var _0x2bd5=function(_0xd29892,_0x2b67b9){_0xd29892=_0xd29892-0x0;var _0x293dfd=_0xbd52[_0xd29892];return _0x293dfd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2bd5('0x0'));module[_0x2bd5('0x1')]={'time':{'type':Sequelize[_0x2bd5('0x2')]},'callid':{'type':Sequelize[_0x2bd5('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2bd5('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2bd5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2bd5('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x2bd5('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x2bd5('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2bd5('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2bd5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2bd5('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2bd5('0x3')],'allowNull':![],'defaultValue':moment()[_0x2bd5('0x4')](_0x2bd5('0x5'))}}; \ No newline at end of file +var _0x221f=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x6087b1,_0x41ce5e){var _0x103865=function(_0x4abb3a){while(--_0x4abb3a){_0x6087b1['push'](_0x6087b1['shift']());}};_0x103865(++_0x41ce5e);}(_0x221f,0x19d));var _0xf221=function(_0x3d8d0a,_0x11bb87){_0x3d8d0a=_0x3d8d0a-0x0;var _0x5b9df5=_0x221f[_0x3d8d0a];return _0x5b9df5;};'use strict';var Sequelize=require(_0xf221('0x0'));var moment=require('moment');module[_0xf221('0x1')]={'time':{'type':Sequelize[_0xf221('0x2')]},'callid':{'type':Sequelize[_0xf221('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf221('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf221('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf221('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf221('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf221('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf221('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf221('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xf221('0x3')],'allowNull':![],'defaultValue':moment()[_0xf221('0x4')](_0xf221('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1fa6964..d0ba03e 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(_0x5e3415,_0x14a028){var _0x39a0b4=function(_0x598657){while(--_0x598657){_0x5e3415['push'](_0x5e3415['shift']());}};_0x39a0b4(++_0x14a028);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x5b1efe,_0x31a192){var _0x1d601f=function(_0x33560a){while(--_0x33560a){_0x5b1efe['push'](_0x5b1efe['shift']());}};_0x1d601f(++_0x31a192);}(_0xb10b,0x12a));var _0xbb10=function(_0x477491,_0x5ca700){_0x477491=_0x477491-0x0;var _0xac6aec=_0xb10b[_0x477491];return _0xac6aec;};'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 c1d6f8b..348d630 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 _0x038b=['util','../../config/logger','api','bluebird','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','dtm'];(function(_0x47b13f,_0x5c9964){var _0x2ef091=function(_0x1a4e48){while(--_0x1a4e48){_0x47b13f['push'](_0x47b13f['shift']());}};_0x2ef091(++_0x5c9964);}(_0x038b,0x114));var _0xb038=function(_0x75a5a9,_0x3734e4){_0x75a5a9=_0x75a5a9-0x0;var _0x51a0f8=_0x038b[_0x75a5a9];return _0x51a0f8;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xb038('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3a6d=['../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','dtm','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x567889,_0x17f310){var _0x1d3bd5=function(_0x1bafb8){while(--_0x1bafb8){_0x567889['push'](_0x567889['shift']());}};_0x1d3bd5(++_0x17f310);}(_0x3a6d,0x143));var _0xd3a6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3a6d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require('../../config/logger')(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd3a6('0x7'));var attributes=require(_0xd3a6('0x8'));module[_0xd3a6('0x9')]=function(_0x1fc450,_0x25b042){return _0x1fc450[_0xd3a6('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0xd3a6('0xb'),'paranoid':![],'indexes':[{'name':_0xd3a6('0xc'),'fields':[_0xd3a6('0xd'),_0xd3a6('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 4ebac42..67b5e98 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 _0x36ee=['jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x261004,_0x482f06){var _0x14b236=function(_0x17125e){while(--_0x17125e){_0x261004['push'](_0x261004['shift']());}};_0x14b236(++_0x482f06);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});} \ No newline at end of file +var _0xa699=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x306c77,_0x3861bf){var _0x5951ea=function(_0xc63121){while(--_0xc63121){_0x306c77['push'](_0x306c77['shift']());}};_0x5951ea(++_0x3861bf);}(_0xa699,0x6b));var _0x9a69=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa699[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var moment=require(_0x9a69('0x2'));var BPromise=require(_0x9a69('0x3'));var rs=require(_0x9a69('0x4'));var fs=require('fs');var Redis=require(_0x9a69('0x5'));var db=require(_0x9a69('0x6'))['db'];var utils=require(_0x9a69('0x7'));var logger=require(_0x9a69('0x8'))(_0x9a69('0x9'));var config=require(_0x9a69('0xa'));var jayson=require(_0x9a69('0xb'));var client=jayson[_0x9a69('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b842,_0x3f9bce,_0x3bb021){return new BPromise(function(_0x4665a9,_0x5031b0){return client[_0x9a69('0xd')](_0x26b842,_0x3bb021)[_0x9a69('0xe')](function(_0x3fb953){logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,'request\x20sent');logger['debug'](_0x9a69('0x11'),_0x3f9bce,'request\x20sent',JSON[_0x9a69('0x12')](_0x3fb953));if(_0x3fb953[_0x9a69('0x13')]){if(_0x3fb953['error'][_0x9a69('0x14')]===0x1f4){logger[_0x9a69('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x5031b0(_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);}logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x4665a9(_0x3fb953[_0x9a69('0x13')]['message']);}else{logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,_0x9a69('0x16'));_0x4665a9(_0x3fb953['result'][_0x9a69('0x15')]);}})[_0x9a69('0x17')](function(_0x380e46){logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x380e46);_0x5031b0(_0x380e46);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 14bb8d6..96006ba 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(_0x31262c,_0x2cb537){var _0x17ab62=function(_0x4e1e6f){while(--_0x4e1e6f){_0x31262c['push'](_0x31262c['shift']());}};_0x17ab62(++_0x2cb537);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x205a12,_0x5d1d07){var _0x2ae9cc=function(_0x3b2e01){while(--_0x3b2e01){_0x205a12['push'](_0x205a12['shift']());}};_0x2ae9cc(++_0x5d1d07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 3052a71..d3335b0 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 _0x23c7=['VIRTUAL','getDataValue','extname','value','STRING','setDataValue','channel','split','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format','toString','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','exports'];(function(_0x315216,_0x15d0cc){var _0x4dfb84=function(_0x7e1a19){while(--_0x7e1a19){_0x315216['push'](_0x315216['shift']());}};_0x4dfb84(++_0x15d0cc);}(_0x23c7,0x1e0));var _0x723c=function(_0x19528f,_0x4605d1){_0x19528f=_0x19528f-0x0;var _0x1101ba=_0x23c7[_0x19528f];return _0x1101ba;};'use strict';var Sequelize=require(_0x723c('0x0'));var moment=require(_0x723c('0x1'));var path=require('path');module[_0x723c('0x2')]={'format':{'type':Sequelize[_0x723c('0x3')],'get':function(){return this[_0x723c('0x4')]('value')?path[_0x723c('0x5')](this[_0x723c('0x4')](_0x723c('0x6'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x723c('0x7')],'set':function(_0x18d5eb){if(_0x18d5eb){this[_0x723c('0x8')](_0x723c('0x9'),_0x18d5eb);this[_0x723c('0x8')]('membername',_0x18d5eb[_0x723c('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x723c('0x7')]},'calleridnum':{'type':Sequelize[_0x723c('0x7')]},'calleridname':{'type':Sequelize[_0x723c('0x7')]},'connectedlinenum':{'type':Sequelize[_0x723c('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x723c('0x7')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x723c('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x723c('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x723c('0x7')]},'location':{'type':Sequelize[_0x723c('0xb')]},'transcribeName':{'type':Sequelize[_0x723c('0x7')]},'transcribeStatus':{'type':Sequelize[_0x723c('0x7')],'defaultValue':_0x723c('0xc')},'fileUri':{'type':Sequelize[_0x723c('0xb')]},'fileText':{'type':Sequelize[_0x723c('0xb')]},'failureReason':{'type':Sequelize[_0x723c('0xb')]},'sentiment':{'type':Sequelize[_0x723c('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x723c('0xd')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x723c('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x723c('0xf')],'get':function(){return moment(this['getDataValue'](_0x723c('0x10')))[_0x723c('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x723c('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x723c('0x4')](_0x723c('0x13')))[_0x723c('0x11')](_0x723c('0x14'))[_0x723c('0x12')]();}}}; \ No newline at end of file +var _0x472c=['membername','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','sequelize','moment','path','getDataValue','value','STRING','setDataValue','channel'];(function(_0x473d87,_0x3069dd){var _0x17c64c=function(_0x36386f){while(--_0x36386f){_0x473d87['push'](_0x473d87['shift']());}};_0x17c64c(++_0x3069dd);}(_0x472c,0x188));var _0xc472=function(_0x160fec,_0x2c1a2f){_0x160fec=_0x160fec-0x0;var _0x53a804=_0x472c[_0x160fec];return _0x53a804;};'use strict';var Sequelize=require(_0xc472('0x0'));var moment=require(_0xc472('0x1'));var path=require(_0xc472('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc472('0x3')](_0xc472('0x4'))?path['extname'](this[_0xc472('0x3')](_0xc472('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0xc472('0x5')]},'channel':{'type':Sequelize[_0xc472('0x5')],'set':function(_0x2adc2a){if(_0x2adc2a){this[_0xc472('0x6')](_0xc472('0x7'),_0x2adc2a);this[_0xc472('0x6')](_0xc472('0x8'),_0x2adc2a['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xc472('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc472('0x5')]},'connectedlinenum':{'type':Sequelize[_0xc472('0x5')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc472('0x5')]},'context':{'type':Sequelize[_0xc472('0x5')]},'exten':{'type':Sequelize[_0xc472('0x5')]},'value':{'type':Sequelize[_0xc472('0x5')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xc472('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xc472('0x5')]},'userDisposition':{'type':Sequelize[_0xc472('0x5')]},'location':{'type':Sequelize[_0xc472('0xa')]},'transcribeName':{'type':Sequelize[_0xc472('0x5')]},'transcribeStatus':{'type':Sequelize[_0xc472('0x5')],'defaultValue':_0xc472('0xb')},'fileUri':{'type':Sequelize[_0xc472('0xa')]},'fileText':{'type':Sequelize[_0xc472('0xa')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0xc472('0x5')]},'sPositive':{'type':Sequelize[_0xc472('0xc')]},'sNegative':{'type':Sequelize[_0xc472('0xc')]},'sNeutral':{'type':Sequelize[_0xc472('0xc')]},'sMixed':{'type':Sequelize[_0xc472('0xc')]},'tempSentiment':{'type':Sequelize[_0xc472('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xc472('0xe')],'get':function(){return moment(this[_0xc472('0x3')](_0xc472('0xf')))['format'](_0xc472('0x10'))[_0xc472('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xc472('0x12')))[_0xc472('0x13')](_0xc472('0x10'))[_0xc472('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 3b0f747..0b56f3c 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 _0xe3f1=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','destroy','then','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','update','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','message','downloads','../../components/encryptor','sequelize','col','token','$and','push','format','extname','unlink','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[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','runTranscribe','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','findOne','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../config/logger'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xe3f1,0x79));var _0x1e3f=function(_0x6fee9b,_0x3341e2){_0x6fee9b=_0x6fee9b-0x0;var _0x4db234=_0xe3f1[_0x6fee9b];return _0x4db234;};'use strict';var pdf=require(_0x1e3f('0x0'));var emlformat=require(_0x1e3f('0x1'));var rimraf=require(_0x1e3f('0x2'));var zipdir=require(_0x1e3f('0x3'));var jsonpatch=require(_0x1e3f('0x4'));var rp=require(_0x1e3f('0x5'));var moment=require('moment');var BPromise=require(_0x1e3f('0x6'));var Mustache=require(_0x1e3f('0x7'));var util=require(_0x1e3f('0x8'));var path=require(_0x1e3f('0x9'));var sox=require(_0x1e3f('0xa'));var csv=require(_0x1e3f('0xb'));var ejs=require(_0x1e3f('0xc'));var fs=require('fs');var _=require(_0x1e3f('0xd'));var squel=require('squel');var crypto=require(_0x1e3f('0xe'));var jsforce=require(_0x1e3f('0xf'));var deskjs=require(_0x1e3f('0x10'));var toCsv=require(_0x1e3f('0xb'));var querystring=require(_0x1e3f('0x11'));var Papa=require(_0x1e3f('0x12'));var AWS=require(_0x1e3f('0x13'));var uuidv4=require(_0x1e3f('0x14'));var Redis=require(_0x1e3f('0x15'));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(_0x1e3f('0x16'))(_0x1e3f('0x17'));var utils=require(_0x1e3f('0x18'));var config=require(_0x1e3f('0x19'));var db=require(_0x1e3f('0x1a'))['db'];function respondWithStatusCode(_0x3e4b5c,_0x4f7b1c){_0x4f7b1c=_0x4f7b1c||0xcc;return function(_0x544eda){if(_0x544eda){return _0x3e4b5c[_0x1e3f('0x1b')](_0x4f7b1c);}return _0x3e4b5c[_0x1e3f('0x1c')](_0x4f7b1c)[_0x1e3f('0x1d')]();};}function respondWithResult(_0x1d7602,_0x2d7f9a){_0x2d7f9a=_0x2d7f9a||0xc8;return function(_0x2ace67){if(_0x2ace67){return _0x1d7602[_0x1e3f('0x1c')](_0x2d7f9a)['json'](_0x2ace67);}};}function respondWithFilteredResult(_0x194675,_0x1dc5cd){return function(_0x519b5b){if(_0x519b5b){var _0x48067b=_0x519b5b[_0x1e3f('0x1e')],_0xce7ff0=_0x1dc5cd[_0x1e3f('0x1f')],_0x1dc72b=_0x1dc5cd[_0x1e3f('0x1f')]+_0x1dc5cd[_0x1e3f('0x20')],_0x41ed7e;if(_0x1dc72b>=_0x48067b){_0x1dc72b=_0x48067b;_0x41ed7e=0xc8;}else{_0x41ed7e=0xce;}_0x194675[_0x1e3f('0x1c')](_0x41ed7e);return _0x194675['set'](_0x1e3f('0x21'),_0xce7ff0+'-'+_0x1dc72b+'/'+_0x48067b)[_0x1e3f('0x22')](_0x519b5b);}return null;};}function patchUpdates(_0x17dd79){return function(_0x30f18d){try{jsonpatch[_0x1e3f('0x23')](_0x30f18d,_0x17dd79,!![]);}catch(_0x6230b6){return BPromise[_0x1e3f('0x24')](_0x6230b6);}return _0x30f18d['save']();};}function saveUpdates(_0x2c40ef,_0x28e341){return function(_0x3aa84c){if(_0x3aa84c){return _0x3aa84c['update'](_0x2c40ef)['then'](function(_0x723622){return _0x723622;});}return null;};}function removeEntity(_0x5b84c8,_0x448b4b){return function(_0xe7d828){if(_0xe7d828){return _0xe7d828[_0x1e3f('0x25')]()[_0x1e3f('0x26')](function(){_0x5b84c8[_0x1e3f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x375ae5,_0x5abf97){return function(_0x166003){if(!_0x166003){_0x375ae5['sendStatus'](0x194);}return _0x166003;};}function handleError(_0x1add09,_0x311497){_0x311497=_0x311497||0x1f4;return function(_0x33b01f){logger[_0x1e3f('0x27')](_0x33b01f[_0x1e3f('0x28')]);if(_0x33b01f[_0x1e3f('0x29')]){delete _0x33b01f[_0x1e3f('0x29')];}_0x1add09[_0x1e3f('0x1c')](_0x311497)[_0x1e3f('0x2a')](_0x33b01f);};}exports[_0x1e3f('0x2b')]=function(_0x33da65,_0x238136){var _0x7d9e39={},_0x208cb3={},_0x5a1f76={'count':0x0,'rows':[]};var _0x4a3b52=_['map'](db[_0x1e3f('0x2c')][_0x1e3f('0x2d')],function(_0xdcf75a){return{'name':_0xdcf75a[_0x1e3f('0x2e')],'type':_0xdcf75a[_0x1e3f('0x2f')]['key']};});_0x208cb3[_0x1e3f('0x30')]=_[_0x1e3f('0x31')](_[_0x1e3f('0x32')](_0x4a3b52,'name'),['format']);_0x208cb3[_0x1e3f('0x33')]=_['keys'](_0x33da65[_0x1e3f('0x33')]);_0x208cb3[_0x1e3f('0x34')]=_[_0x1e3f('0x35')](_0x208cb3[_0x1e3f('0x30')],_0x208cb3[_0x1e3f('0x33')]);_0x7d9e39[_0x1e3f('0x36')]=_['intersection'](_0x208cb3[_0x1e3f('0x30')],qs[_0x1e3f('0x37')](_0x33da65[_0x1e3f('0x33')][_0x1e3f('0x37')]));_0x7d9e39[_0x1e3f('0x36')]=_0x7d9e39[_0x1e3f('0x36')][_0x1e3f('0x38')]?_0x7d9e39[_0x1e3f('0x36')]:_0x208cb3['model'];if(!_0x33da65[_0x1e3f('0x33')]['hasOwnProperty'](_0x1e3f('0x39'))){_0x7d9e39['limit']=qs[_0x1e3f('0x20')](_0x33da65[_0x1e3f('0x33')][_0x1e3f('0x20')]);_0x7d9e39[_0x1e3f('0x1f')]=qs[_0x1e3f('0x1f')](_0x33da65[_0x1e3f('0x33')][_0x1e3f('0x1f')]);}_0x7d9e39[_0x1e3f('0x3a')]=qs[_0x1e3f('0x3b')](_0x33da65[_0x1e3f('0x33')][_0x1e3f('0x3b')]);_0x7d9e39['where']=qs['filters'](_['pick'](_0x33da65['query'],_0x208cb3[_0x1e3f('0x34')]),_0x4a3b52);if(_0x33da65[_0x1e3f('0x33')][_0x1e3f('0x3c')]){_0x7d9e39[_0x1e3f('0x3d')]=_[_0x1e3f('0x3e')](_0x7d9e39[_0x1e3f('0x3d')],{'$or':_[_0x1e3f('0x32')](_0x4a3b52,function(_0x66fcf9){if(_0x66fcf9[_0x1e3f('0x2f')]!==_0x1e3f('0x3f')){var _0x53c117={};_0x53c117[_0x66fcf9['name']]={'$like':'%'+_0x33da65[_0x1e3f('0x33')]['filter']+'%'};return _0x53c117;}})});}_0x7d9e39=_[_0x1e3f('0x3e')]({},_0x7d9e39,_0x33da65[_0x1e3f('0x40')]);var _0xe8566={'where':_0x7d9e39[_0x1e3f('0x3d')]};return db[_0x1e3f('0x2c')]['count'](_0xe8566)[_0x1e3f('0x26')](function(_0x1d273c){_0x5a1f76['count']=_0x1d273c;if(_0x33da65['query'][_0x1e3f('0x41')]){_0x7d9e39[_0x1e3f('0x42')]=[{'all':!![]}];}return db[_0x1e3f('0x2c')]['findAll'](_0x7d9e39);})[_0x1e3f('0x26')](function(_0x5ded88){_0x5a1f76[_0x1e3f('0x43')]=_0x5ded88;return _0x5a1f76;})[_0x1e3f('0x26')](respondWithFilteredResult(_0x238136,_0x7d9e39))[_0x1e3f('0x44')](handleError(_0x238136,null));};exports['show']=function(_0x3a715e,_0x37292b){var _0x175b21={'raw':![],'where':{'id':_0x3a715e[_0x1e3f('0x45')]['id']}},_0x456792={};_0x456792[_0x1e3f('0x30')]=_['keys'](db[_0x1e3f('0x2c')][_0x1e3f('0x2d')]);_0x456792[_0x1e3f('0x33')]=_[_0x1e3f('0x46')](_0x3a715e[_0x1e3f('0x33')]);_0x456792['filters']=_[_0x1e3f('0x35')](_0x456792['model'],_0x456792[_0x1e3f('0x33')]);_0x175b21[_0x1e3f('0x36')]=_[_0x1e3f('0x35')](_0x456792[_0x1e3f('0x30')],qs[_0x1e3f('0x37')](_0x3a715e[_0x1e3f('0x33')][_0x1e3f('0x37')]));_0x175b21[_0x1e3f('0x36')]=_0x175b21[_0x1e3f('0x36')][_0x1e3f('0x38')]?_0x175b21[_0x1e3f('0x36')]:_0x456792[_0x1e3f('0x30')];if(_0x3a715e[_0x1e3f('0x33')][_0x1e3f('0x41')]){_0x175b21[_0x1e3f('0x42')]=[{'all':!![]}];}_0x175b21=_[_0x1e3f('0x3e')]({},_0x175b21,_0x3a715e[_0x1e3f('0x40')]);return db['VoiceRecording'][_0x1e3f('0x47')](_0x175b21)[_0x1e3f('0x26')](handleEntityNotFound(_0x37292b,null))[_0x1e3f('0x26')](respondWithResult(_0x37292b,null))[_0x1e3f('0x44')](handleError(_0x37292b,null));};exports[_0x1e3f('0x48')]=function(_0x2e28d8,_0x7066f2){return db['VoiceRecording'][_0x1e3f('0x48')](_0x2e28d8['body'],{})[_0x1e3f('0x26')](respondWithResult(_0x7066f2,0xc9))[_0x1e3f('0x44')](handleError(_0x7066f2,null));};exports[_0x1e3f('0x49')]=function(_0x49b2ad,_0x19262d){if(_0x49b2ad[_0x1e3f('0x4a')]['id']){delete _0x49b2ad[_0x1e3f('0x4a')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x49b2ad[_0x1e3f('0x45')]['id']}})['then'](handleEntityNotFound(_0x19262d,null))[_0x1e3f('0x26')](saveUpdates(_0x49b2ad[_0x1e3f('0x4a')],null))[_0x1e3f('0x26')](respondWithResult(_0x19262d,null))['catch'](handleError(_0x19262d,null));};exports[_0x1e3f('0x4b')]=function(_0xae837f,_0x68f943){return db[_0x1e3f('0x2c')]['describe']()[_0x1e3f('0x26')](respondWithResult(_0x68f943,null))[_0x1e3f('0x44')](handleError(_0x68f943,null));};exports[_0x1e3f('0x4c')]=function(_0x3316c3,_0x1a1358,_0x30a6b3){var _0x39cb85=require('../../components/encryptor');var _0xf2a5cf=![];var _0x1d1da7={};if(_0x3316c3[_0x1e3f('0x33')][_0x1e3f('0x2f')]&&_0x3316c3[_0x1e3f('0x33')][_0x1e3f('0x2f')]===_0x1e3f('0x4d')){_0x1d1da7[_0x1e3f('0x4d')]=_0x3316c3['params']['id'];}else{_0x1d1da7['id']=_0x3316c3['params']['id'];}return db['VoiceRecording'][_0x1e3f('0x47')]({'where':_0x1d1da7,'attributes':['id',_0x1e3f('0x4e')],'raw':!![]})[_0x1e3f('0x26')](handleEntityNotFound(_0x1a1358,null))['then'](function(_0x77066a){if(_0x77066a){var _0x4aa15e=_0x77066a[_0x1e3f('0x4e')];var _0x1bbb50=util['format'](_0x1e3f('0x4f'),_0x4aa15e);if(fs[_0x1e3f('0x50')](_0x1bbb50)){_0xf2a5cf=!![];return _0x39cb85[_0x1e3f('0x51')](_0x1bbb50,_0x4aa15e,config[_0x1e3f('0x52')]['recording'])[_0x1e3f('0x26')](function(){return _0x77066a;});}return _0x77066a;}})[_0x1e3f('0x26')](function(_0x46e3a6){if(_0x46e3a6){var _0x12459c=_0x46e3a6[_0x1e3f('0x4e')];if(!fs[_0x1e3f('0x50')](_0x12459c)){throw new db[(_0x1e3f('0x53'))][(_0x1e3f('0x54'))](_0x1e3f('0x55'));}if(_0x46e3a6[_0x1e3f('0x56')]){return _0x1a1358[_0x1e3f('0x4c')](_0x12459c,_0x46e3a6['filename']+path['extname'](_0x12459c),function(){if(_0xf2a5cf){fs['unlink'](_0x12459c);}});}else{return _0x1a1358['download'](_0x12459c,function(_0x106c8b){if(_0xf2a5cf){fs['unlink'](_0x12459c);}});}}})[_0x1e3f('0x44')](function(_0x547d62){if(_0x547d62[_0x1e3f('0x57')]===_0x1e3f('0x55')){_0x1a1358[_0x1e3f('0x1c')](0x194)[_0x1e3f('0x2a')]('Not\x20found');}else{return handleError(_0x1a1358,null);}});};exports[_0x1e3f('0x58')]=function(_0x4f5bab,_0x1012b6,_0x2f29c2){var _0x1448bd=require(_0x1e3f('0x59'));var _0x469b0f=![];var _0x36eb70={'$and':[db['sequelize'][_0x1e3f('0x3d')](db[_0x1e3f('0x5a')]['fn']('MD5',db[_0x1e3f('0x5a')][_0x1e3f('0x5b')](_0x1e3f('0x4d'))),_0x4f5bab[_0x1e3f('0x33')][_0x1e3f('0x5c')])]};if(_0x4f5bab[_0x1e3f('0x33')][_0x1e3f('0x2f')]&&_0x4f5bab[_0x1e3f('0x33')][_0x1e3f('0x2f')]===_0x1e3f('0x4d')){_0x36eb70['$and']['push']({'uniqueid':_0x4f5bab[_0x1e3f('0x45')]['id']});}else{_0x36eb70[_0x1e3f('0x5d')][_0x1e3f('0x5e')]({'id':_0x4f5bab['params']['id']});}return db[_0x1e3f('0x2c')][_0x1e3f('0x47')]({'where':_0x36eb70,'attributes':['id','value'],'raw':!![]})[_0x1e3f('0x26')](handleEntityNotFound(_0x1012b6,null))[_0x1e3f('0x26')](function(_0x1935c8){if(_0x1935c8){var _0x56935d=util[_0x1e3f('0x5f')](_0x1e3f('0x4f'),_0x1935c8[_0x1e3f('0x4e')]);if(fs['existsSync'](_0x56935d)){_0x469b0f=!![];return _0x1448bd[_0x1e3f('0x51')](_0x56935d,_0x1935c8[_0x1e3f('0x4e')],config['secrets']['recording'])[_0x1e3f('0x26')](function(){return _0x1935c8;});}return _0x1935c8;}})[_0x1e3f('0x26')](function(_0x446828){if(_0x446828){if(!fs[_0x1e3f('0x50')](_0x446828[_0x1e3f('0x4e')])){throw new db[(_0x1e3f('0x53'))][(_0x1e3f('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x446828[_0x1e3f('0x56')]){return _0x1012b6[_0x1e3f('0x4c')](_0x446828[_0x1e3f('0x4e')],_0x446828[_0x1e3f('0x56')]+path[_0x1e3f('0x60')](_0x446828['value']),function(){if(_0x469b0f){fs[_0x1e3f('0x61')](_0x446828[_0x1e3f('0x4e')]);}});}else{return _0x1012b6[_0x1e3f('0x4c')](_0x446828[_0x1e3f('0x4e')],function(_0x13cca7){if(_0x469b0f){fs['unlink'](_0x446828['value']);}});}}})[_0x1e3f('0x44')](handleError(_0x1012b6,null));};exports['destroy']=function(_0x1355f1,_0x2e8ce4){return db[_0x1e3f('0x2c')][_0x1e3f('0x47')]({'where':{'id':_0x1355f1[_0x1e3f('0x45')]['id']}})[_0x1e3f('0x26')](function(_0x45c017){if(!_0x45c017)throw new ReferenceError('Entity\x20not\x20found');return _0x45c017;})[_0x1e3f('0x26')](function(_0x2d444d){var _0x4a3c6f=_0x2d444d[_0x1e3f('0x4e')];logger[_0x1e3f('0x62')](_0x1e3f('0x63'),_0x4a3c6f);if(!_[_0x1e3f('0x64')](_0x2d444d['value'])&&fs[_0x1e3f('0x50')](_0x4a3c6f)){logger[_0x1e3f('0x62')](_0x1e3f('0x65')+_0x4a3c6f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1e3f('0x66')](_0x4a3c6f);}_0x4a3c6f=_0x4a3c6f+'.cypher';if(!_['isNil'](_0x2d444d[_0x1e3f('0x4e')])&&fs[_0x1e3f('0x50')](_0x4a3c6f)){logger[_0x1e3f('0x62')](_0x1e3f('0x65')+_0x4a3c6f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1e3f('0x66')](_0x4a3c6f);}return _0x2d444d;})[_0x1e3f('0x26')](function(_0x3a4e44){if(!_0x3a4e44)throw new InternalError();return _0x3a4e44[_0x1e3f('0x25')]();})[_0x1e3f('0x26')](function(){_0x2e8ce4[_0x1e3f('0x1c')](0xcc)[_0x1e3f('0x1d')]();})['catch'](handleError(_0x2e8ce4,null));};function getBucketslist(_0x5875a2,_0x1d80b6,_0x30b0fd){return new Promise(function(_0x11f16f,_0x1dc921){var _0x5c3294=new AWS['S3']({'accessKeyId':_0x1d80b6,'secretAccessKey':_0x5875a2,'region':_0x30b0fd});_0x5c3294[_0x1e3f('0x67')]({},function(_0xa5186e,_0x166ab9){if(_0xa5186e){return _0x1dc921(_0xa5186e);}else{return _0x11f16f(_0x166ab9);}});});}function createBucket(_0x182289,_0x2d86c2,_0x40ec63,_0x295a55){return new Promise(function(_0x2ed6cf,_0x318329){var _0x8a4316=new AWS['S3']({'accessKeyId':_0x2d86c2,'secretAccessKey':_0x182289,'region':_0x40ec63});_0x8a4316[_0x1e3f('0x68')]({'Bucket':_0x295a55},function(_0x51330,_0x43a1a8){if(_0x51330){return _0x318329(_0x51330);}else{return _0x2ed6cf(_0x43a1a8);}});});}function uploadFile(_0x28e483,_0x4206d6,_0x37ff42,_0x226d51,_0x4c980b,_0x3215c5){return new Promise(function(_0x175177,_0x4993ff){var _0x22d6ff=new AWS['S3']({'accessKeyId':_0x4206d6,'secretAccessKey':_0x28e483,'region':_0x37ff42});_0x22d6ff['upload']({'Bucket':_0x226d51,'Key':_0x4c980b,'Body':_0x3215c5},function(_0x504f24,_0x5dc687){if(_0x504f24){return _0x4993ff(_0x504f24);}else{return _0x175177(_0x5dc687);}});});}function startTranscribe(_0x22504a,_0x3c0ca3,_0x4cc4f5,_0x602f9e,_0x8f30c9,_0x54a3df){return new Promise(function(_0x51eb4a,_0x20c45e){var _0x51faf8=new AWS['TranscribeService']({'accessKeyId':_0x3c0ca3,'secretAccessKey':_0x22504a,'region':_0x4cc4f5});_0x51faf8[_0x1e3f('0x69')]({'TranscriptionJobName':_0x602f9e,'LanguageCode':_0x8f30c9,'Media':{'MediaFileUri':_0x54a3df}},function(_0x27757f,_0x5de6c4){if(_0x27757f){return _0x20c45e(_0x27757f);}else{return _0x51eb4a(_0x5de6c4);}});});}function transcribe(_0x2d00be,_0x4a6f43,_0x37f7e0,_0x5a6fb8,_0x6b085a,_0x3cc7ad,_0x262004){return new Promise(function(_0x3798c0,_0x4a3457){var _0x2503f2={};logger['info'](util[_0x1e3f('0x5f')](_0x1e3f('0x6a'),_0x2d00be,_0x6b085a));return uploadFile(_0x4a6f43,_0x37f7e0,_0x5a6fb8,_0x6b085a,path['basename'](_0x3cc7ad),fs['readFileSync'](_0x3cc7ad))[_0x1e3f('0x26')](function(_0x4d6684){logger[_0x1e3f('0x62')](util['format'](_0x1e3f('0x6b'),_0x2d00be,_0x6b085a,_0x4d6684[_0x1e3f('0x6c')]));_0x2503f2['bucket']=_0x4d6684[_0x1e3f('0x6d')];_0x2503f2[_0x1e3f('0x6e')]=_0x4d6684[_0x1e3f('0x6c')];logger[_0x1e3f('0x62')](util[_0x1e3f('0x5f')](_0x1e3f('0x6f'),_0x2d00be));return startTranscribe(_0x4a6f43,_0x37f7e0,_0x5a6fb8,uuidv4(),_0x262004,_0x4d6684[_0x1e3f('0x6c')]);})[_0x1e3f('0x26')](function(_0x258e18){logger['info'](util[_0x1e3f('0x5f')](_0x1e3f('0x70'),_0x2d00be,_0x258e18[_0x1e3f('0x71')][_0x1e3f('0x72')]));_0x2503f2['transcribeName']=_0x258e18[_0x1e3f('0x71')][_0x1e3f('0x72')];_0x2503f2['transcribeStatus']=_0x258e18[_0x1e3f('0x71')]['TranscriptionJobStatus'];return _0x3798c0(_0x2503f2);})['catch'](function(_0x222e22){return _0x4a3457(_0x222e22);});});}exports[_0x1e3f('0x73')]=function(_0x3e8824,_0x593bbf,_0x284715){var _0x21e9e8;var _0x28e318;var _0x58e5b2;var _0x4356d1=require(_0x1e3f('0x59'));return db[_0x1e3f('0x2c')]['findOne']({'where':{'id':_0x3e8824['params']['id']}})[_0x1e3f('0x26')](function(_0x290fe0){if(_0x290fe0){var _0x3b2c55=util['format'](_0x1e3f('0x4f'),_0x290fe0[_0x1e3f('0x4e')]);if(fs[_0x1e3f('0x50')](_0x3b2c55)){cypher=!![];return _0x4356d1[_0x1e3f('0x51')](_0x3b2c55,_0x290fe0[_0x1e3f('0x4e')],config['secrets']['recording'])[_0x1e3f('0x26')](function(){return _0x290fe0;});}return _0x290fe0;}})[_0x1e3f('0x26')](function(_0x3b4fa0){if(!_0x3b4fa0){throw new db[(_0x1e3f('0x53'))][(_0x1e3f('0x54'))]('Voice\x20Recording\x20not\x20found');}_0x28e318=_0x3b4fa0;return db[_0x1e3f('0x74')]['findOne']({'where':{'id':0x1}});})[_0x1e3f('0x26')](handleEntityNotFound(_0x593bbf,null))['then'](function(_0x15738f){if(_0x15738f){_0x21e9e8=_0x15738f;if(!_0x21e9e8[_0x1e3f('0x75')]||!_0x21e9e8[_0x1e3f('0x76')]||!_0x21e9e8[_0x1e3f('0x77')]||!_0x21e9e8['language']||!_0x21e9e8[_0x1e3f('0x78')]){throw new db[(_0x1e3f('0x53'))][(_0x1e3f('0x54'))](_0x1e3f('0x79'));}if(_0x3e8824[_0x1e3f('0x4a')][_0x1e3f('0x7a')]&&(!_0x21e9e8[_0x1e3f('0x7b')]||!_0x21e9e8[_0x1e3f('0x7c')]||!_0x21e9e8['sentimentRegion']||!_0x21e9e8['language']||!_0x21e9e8[_0x1e3f('0x78')])){throw new db['Sequelize'][(_0x1e3f('0x54'))](_0x1e3f('0x7d'));}return db['CloudProvider']['findOne']({'where':{'id':_0x21e9e8[_0x1e3f('0x76')]}});}})[_0x1e3f('0x26')](function(_0x48bd75){if(!_0x48bd75){throw new db[(_0x1e3f('0x53'))][(_0x1e3f('0x54'))](_0x1e3f('0x7e'));}if(!_0x48bd75[_0x1e3f('0x7f')]||!_0x48bd75[_0x1e3f('0x80')]){throw new db[(_0x1e3f('0x53'))]['ValidationError'](_0x1e3f('0x81'));}_0x58e5b2=_0x48bd75;return getBucketslist(_0x58e5b2[_0x1e3f('0x7f')],_0x58e5b2[_0x1e3f('0x80')],_0x21e9e8[_0x1e3f('0x77')]);})[_0x1e3f('0x26')](function(_0xd61d32){if(_0xd61d32&&_0xd61d32[_0x1e3f('0x82')]){var _0x456f6b=_[_0x1e3f('0x47')](_0xd61d32[_0x1e3f('0x82')],function(_0x1ba0c2){return _0x1ba0c2['Name']===_0x21e9e8['bucket'];});if(!_0x456f6b){logger['info'](util[_0x1e3f('0x5f')](_0x1e3f('0x83'),_0x3e8824[_0x1e3f('0x45')]['id'],_0x21e9e8['bucket']));return createBucket(_0x58e5b2[_0x1e3f('0x7f')],_0x58e5b2[_0x1e3f('0x80')],_0x21e9e8[_0x1e3f('0x77')],_0x21e9e8[_0x1e3f('0x78')]);}logger[_0x1e3f('0x62')](util[_0x1e3f('0x5f')](_0x1e3f('0x84'),_0x3e8824[_0x1e3f('0x45')]['id'],_0x21e9e8[_0x1e3f('0x78')]));return;}})[_0x1e3f('0x26')](function(_0x3ba4c4){if(_0x28e318['transcribeStatus']===_0x1e3f('0x85')){return transcribe(_0x3e8824[_0x1e3f('0x45')]['id'],_0x58e5b2['data1'],_0x58e5b2[_0x1e3f('0x80')],_0x21e9e8[_0x1e3f('0x77')],_0x21e9e8[_0x1e3f('0x78')],_0x28e318[_0x1e3f('0x4e')],_0x21e9e8[_0x1e3f('0x86')]);}else{logger[_0x1e3f('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3e8824[_0x1e3f('0x45')]['id']));return{'transcribeStatus':_0x1e3f('0x87')};}})[_0x1e3f('0x26')](function(_0x960e69){if(_0x960e69){_0x960e69[_0x1e3f('0x88')]=_0x3e8824[_0x1e3f('0x4a')][_0x1e3f('0x7a')];return _0x28e318['updateAttributes'](_0x960e69);}})['then'](respondWithResult(_0x593bbf,null))[_0x1e3f('0x44')](handleError(_0x593bbf,null));};function writeFile(_0x1cccf1,_0x383bee){return new Promise(function(_0x3af194,_0x387151){fs[_0x1e3f('0x89')](_0x383bee,_0x1cccf1,function(_0x579643,_0x4759aa){if(_0x579643){return _0x387151(_0x579643);}else{return _0x3af194(_0x4759aa);}});});}exports[_0x1e3f('0x8a')]=function(_0x254846,_0x2779e1,_0x4b8358){return db[_0x1e3f('0x2c')][_0x1e3f('0x8b')]({'where':{'id':_0x254846['params']['id']}})[_0x1e3f('0x26')](handleEntityNotFound(_0x2779e1))['then'](function(_0xfec8e5){if(_0xfec8e5&&_0xfec8e5[_0x1e3f('0x8c')]){var _0x4994ff=_0xfec8e5[_0x1e3f('0x8c')];var _0x53dfce=config[_0x1e3f('0x8d')]+_0x1e3f('0x8e')+_0xfec8e5['id']+'.txt';if(fs[_0x1e3f('0x50')](_0x53dfce)){return _0x53dfce;}return writeFile(_0x4994ff,_0x53dfce)[_0x1e3f('0x26')](function(){return _0x53dfce;});}else{throw new db[(_0x1e3f('0x53'))][(_0x1e3f('0x54'))](_0x1e3f('0x8f'));}})[_0x1e3f('0x26')](function(_0x255a59){return _0x2779e1['download'](_0x255a59);})[_0x1e3f('0x44')](handleError(_0x2779e1));}; \ No newline at end of file +var _0x0824=['recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','token','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','sentiment','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','VoiceRecording','rawAttributes','type','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','keys','options','find','create','body','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets'];(function(_0x332c1b,_0x28d711){var _0x21b49b=function(_0x3f00fd){while(--_0x3f00fd){_0x332c1b['push'](_0x332c1b['shift']());}};_0x21b49b(++_0x28d711);}(_0x0824,0x176));var _0x4082=function(_0x28645f,_0x1f27bb){_0x28645f=_0x28645f-0x0;var _0x1906ff=_0x0824[_0x28645f];return _0x1906ff;};'use strict';var pdf=require(_0x4082('0x0'));var emlformat=require(_0x4082('0x1'));var rimraf=require(_0x4082('0x2'));var zipdir=require(_0x4082('0x3'));var jsonpatch=require(_0x4082('0x4'));var rp=require(_0x4082('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4082('0x6'));var util=require(_0x4082('0x7'));var path=require(_0x4082('0x8'));var sox=require('sox');var csv=require(_0x4082('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4082('0xa'));var jsforce=require(_0x4082('0xb'));var deskjs=require(_0x4082('0xc'));var toCsv=require(_0x4082('0x9'));var querystring=require(_0x4082('0xd'));var Papa=require(_0x4082('0xe'));var AWS=require(_0x4082('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0x4082('0x10'));var authService=require(_0x4082('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4082('0x12'));var hardwareService=require(_0x4082('0x13'));var logger=require(_0x4082('0x14'))(_0x4082('0x15'));var utils=require(_0x4082('0x16'));var config=require(_0x4082('0x17'));var db=require(_0x4082('0x18'))['db'];function respondWithStatusCode(_0x4eeb90,_0x27dbb1){_0x27dbb1=_0x27dbb1||0xcc;return function(_0x172350){if(_0x172350){return _0x4eeb90['sendStatus'](_0x27dbb1);}return _0x4eeb90[_0x4082('0x19')](_0x27dbb1)['end']();};}function respondWithResult(_0x444e32,_0x267f86){_0x267f86=_0x267f86||0xc8;return function(_0xdb9601){if(_0xdb9601){return _0x444e32[_0x4082('0x19')](_0x267f86)[_0x4082('0x1a')](_0xdb9601);}};}function respondWithFilteredResult(_0x22e0f2,_0x13621e){return function(_0x421acc){if(_0x421acc){var _0xe53b52=_0x421acc[_0x4082('0x1b')],_0x5485b1=_0x13621e['offset'],_0x5a2a1c=_0x13621e[_0x4082('0x1c')]+_0x13621e[_0x4082('0x1d')],_0x40d1a9;if(_0x5a2a1c>=_0xe53b52){_0x5a2a1c=_0xe53b52;_0x40d1a9=0xc8;}else{_0x40d1a9=0xce;}_0x22e0f2[_0x4082('0x19')](_0x40d1a9);return _0x22e0f2[_0x4082('0x1e')](_0x4082('0x1f'),_0x5485b1+'-'+_0x5a2a1c+'/'+_0xe53b52)[_0x4082('0x1a')](_0x421acc);}return null;};}function patchUpdates(_0x409fa8){return function(_0x1d9c0a){try{jsonpatch['apply'](_0x1d9c0a,_0x409fa8,!![]);}catch(_0x211095){return BPromise[_0x4082('0x20')](_0x211095);}return _0x1d9c0a[_0x4082('0x21')]();};}function saveUpdates(_0x18e084,_0x5f20d8){return function(_0x2939ee){if(_0x2939ee){return _0x2939ee[_0x4082('0x22')](_0x18e084)['then'](function(_0x326b5b){return _0x326b5b;});}return null;};}function removeEntity(_0x44cf2e,_0xf639d6){return function(_0x31d817){if(_0x31d817){return _0x31d817[_0x4082('0x23')]()[_0x4082('0x24')](function(){_0x44cf2e[_0x4082('0x19')](0xcc)[_0x4082('0x25')]();});}};}function handleEntityNotFound(_0x55c017,_0x2fa712){return function(_0x2df2d5){if(!_0x2df2d5){_0x55c017[_0x4082('0x26')](0x194);}return _0x2df2d5;};}function handleError(_0x47fa74,_0x5154c7){_0x5154c7=_0x5154c7||0x1f4;return function(_0x1877b5){logger[_0x4082('0x27')](_0x1877b5[_0x4082('0x28')]);if(_0x1877b5[_0x4082('0x29')]){delete _0x1877b5['name'];}_0x47fa74[_0x4082('0x19')](_0x5154c7)[_0x4082('0x2a')](_0x1877b5);};}exports[_0x4082('0x2b')]=function(_0x417730,_0x1090e9){var _0xd933a2={},_0x2ceb97={},_0x3a6d77={'count':0x0,'rows':[]};var _0x320172=_[_0x4082('0x2c')](db[_0x4082('0x2d')][_0x4082('0x2e')],function(_0x1c49a7){return{'name':_0x1c49a7['fieldName'],'type':_0x1c49a7[_0x4082('0x2f')]['key']};});_0x2ceb97[_0x4082('0x30')]=_[_0x4082('0x31')](_[_0x4082('0x2c')](_0x320172,_0x4082('0x29')),[_0x4082('0x32')]);_0x2ceb97[_0x4082('0x33')]=_['keys'](_0x417730[_0x4082('0x33')]);_0x2ceb97[_0x4082('0x34')]=_[_0x4082('0x35')](_0x2ceb97[_0x4082('0x30')],_0x2ceb97[_0x4082('0x33')]);_0xd933a2['attributes']=_[_0x4082('0x35')](_0x2ceb97[_0x4082('0x30')],qs[_0x4082('0x36')](_0x417730[_0x4082('0x33')]['fields']));_0xd933a2['attributes']=_0xd933a2[_0x4082('0x37')][_0x4082('0x38')]?_0xd933a2[_0x4082('0x37')]:_0x2ceb97['model'];if(!_0x417730[_0x4082('0x33')][_0x4082('0x39')](_0x4082('0x3a'))){_0xd933a2[_0x4082('0x1d')]=qs[_0x4082('0x1d')](_0x417730[_0x4082('0x33')][_0x4082('0x1d')]);_0xd933a2['offset']=qs[_0x4082('0x1c')](_0x417730[_0x4082('0x33')]['offset']);}_0xd933a2[_0x4082('0x3b')]=qs[_0x4082('0x3c')](_0x417730[_0x4082('0x33')][_0x4082('0x3c')]);_0xd933a2[_0x4082('0x3d')]=qs[_0x4082('0x34')](_[_0x4082('0x3e')](_0x417730[_0x4082('0x33')],_0x2ceb97[_0x4082('0x34')]),_0x320172);if(_0x417730[_0x4082('0x33')][_0x4082('0x3f')]){_0xd933a2[_0x4082('0x3d')]=_['merge'](_0xd933a2[_0x4082('0x3d')],{'$or':_[_0x4082('0x2c')](_0x320172,function(_0x42cee8){if(_0x42cee8['type']!=='VIRTUAL'){var _0x4c8994={};_0x4c8994[_0x42cee8[_0x4082('0x29')]]={'$like':'%'+_0x417730[_0x4082('0x33')][_0x4082('0x3f')]+'%'};return _0x4c8994;}})});}_0xd933a2=_[_0x4082('0x40')]({},_0xd933a2,_0x417730['options']);var _0x2928d8={'where':_0xd933a2[_0x4082('0x3d')]};return db['VoiceRecording']['count'](_0x2928d8)[_0x4082('0x24')](function(_0x41c869){_0x3a6d77['count']=_0x41c869;if(_0x417730[_0x4082('0x33')][_0x4082('0x41')]){_0xd933a2[_0x4082('0x42')]=[{'all':!![]}];}return db[_0x4082('0x2d')][_0x4082('0x43')](_0xd933a2);})[_0x4082('0x24')](function(_0x29a5f2){_0x3a6d77['rows']=_0x29a5f2;return _0x3a6d77;})['then'](respondWithFilteredResult(_0x1090e9,_0xd933a2))[_0x4082('0x44')](handleError(_0x1090e9,null));};exports[_0x4082('0x45')]=function(_0x21d2a9,_0x5cbbf3){var _0x222e72={'raw':![],'where':{'id':_0x21d2a9['params']['id']}},_0xe7b2a={};_0xe7b2a[_0x4082('0x30')]=_[_0x4082('0x46')](db[_0x4082('0x2d')][_0x4082('0x2e')]);_0xe7b2a['query']=_[_0x4082('0x46')](_0x21d2a9[_0x4082('0x33')]);_0xe7b2a[_0x4082('0x34')]=_['intersection'](_0xe7b2a['model'],_0xe7b2a[_0x4082('0x33')]);_0x222e72[_0x4082('0x37')]=_['intersection'](_0xe7b2a[_0x4082('0x30')],qs['fields'](_0x21d2a9['query'][_0x4082('0x36')]));_0x222e72[_0x4082('0x37')]=_0x222e72[_0x4082('0x37')][_0x4082('0x38')]?_0x222e72[_0x4082('0x37')]:_0xe7b2a[_0x4082('0x30')];if(_0x21d2a9[_0x4082('0x33')][_0x4082('0x41')]){_0x222e72[_0x4082('0x42')]=[{'all':!![]}];}_0x222e72=_[_0x4082('0x40')]({},_0x222e72,_0x21d2a9[_0x4082('0x47')]);return db[_0x4082('0x2d')][_0x4082('0x48')](_0x222e72)[_0x4082('0x24')](handleEntityNotFound(_0x5cbbf3,null))['then'](respondWithResult(_0x5cbbf3,null))['catch'](handleError(_0x5cbbf3,null));};exports[_0x4082('0x49')]=function(_0x1502b6,_0x1f858c){return db[_0x4082('0x2d')][_0x4082('0x49')](_0x1502b6[_0x4082('0x4a')],{})[_0x4082('0x24')](respondWithResult(_0x1f858c,0xc9))[_0x4082('0x44')](handleError(_0x1f858c,null));};exports[_0x4082('0x22')]=function(_0x198b07,_0x54985f){if(_0x198b07[_0x4082('0x4a')]['id']){delete _0x198b07[_0x4082('0x4a')]['id'];}return db['VoiceRecording'][_0x4082('0x48')]({'where':{'id':_0x198b07['params']['id']}})[_0x4082('0x24')](handleEntityNotFound(_0x54985f,null))[_0x4082('0x24')](saveUpdates(_0x198b07['body'],null))[_0x4082('0x24')](respondWithResult(_0x54985f,null))[_0x4082('0x44')](handleError(_0x54985f,null));};exports[_0x4082('0x4b')]=function(_0x4dc08c,_0x50c6e8){return db[_0x4082('0x2d')][_0x4082('0x4b')]()[_0x4082('0x24')](respondWithResult(_0x50c6e8,null))[_0x4082('0x44')](handleError(_0x50c6e8,null));};exports[_0x4082('0x4c')]=function(_0x150f7f,_0x5b090d,_0x51fab3){var _0x270fc9=require(_0x4082('0x4d'));var _0x1e0b58=![];var _0x674912={};if(_0x150f7f[_0x4082('0x33')][_0x4082('0x2f')]&&_0x150f7f[_0x4082('0x33')][_0x4082('0x2f')]==='uniqueid'){_0x674912[_0x4082('0x4e')]=_0x150f7f[_0x4082('0x4f')]['id'];}else{_0x674912['id']=_0x150f7f[_0x4082('0x4f')]['id'];}return db[_0x4082('0x2d')][_0x4082('0x48')]({'where':_0x674912,'attributes':['id',_0x4082('0x50')],'raw':!![]})[_0x4082('0x24')](handleEntityNotFound(_0x5b090d,null))[_0x4082('0x24')](function(_0x522ba7){if(_0x522ba7){var _0x4f8681=_0x522ba7['value'];var _0x5c8fa2=util['format'](_0x4082('0x51'),_0x4f8681);if(fs[_0x4082('0x52')](_0x5c8fa2)){_0x1e0b58=!![];return _0x270fc9[_0x4082('0x53')](_0x5c8fa2,_0x4f8681,config[_0x4082('0x54')][_0x4082('0x55')])[_0x4082('0x24')](function(){return _0x522ba7;});}return _0x522ba7;}})[_0x4082('0x24')](function(_0x11c1c5){if(_0x11c1c5){var _0x5bc12c=_0x11c1c5[_0x4082('0x50')];if(!fs['existsSync'](_0x5bc12c)){throw new db[(_0x4082('0x56'))][(_0x4082('0x57'))](_0x4082('0x58'));}if(_0x11c1c5[_0x4082('0x59')]){return _0x5b090d['download'](_0x5bc12c,_0x11c1c5['filename']+path[_0x4082('0x5a')](_0x5bc12c),function(){if(_0x1e0b58){fs['unlink'](_0x5bc12c);}});}else{return _0x5b090d[_0x4082('0x4c')](_0x5bc12c,function(_0x5f0ce5){if(_0x1e0b58){fs[_0x4082('0x5b')](_0x5bc12c);}});}}})[_0x4082('0x44')](function(_0x575faf){if(_0x575faf[_0x4082('0x5c')]===_0x4082('0x58')){_0x5b090d[_0x4082('0x19')](0x194)[_0x4082('0x2a')]('Not\x20found');}else{return handleError(_0x5b090d,null);}});};exports[_0x4082('0x5d')]=function(_0x57a75c,_0x5bbcd0,_0x3b2027){var _0x211c3a=require(_0x4082('0x4d'));var _0x3b48ed=![];var _0x411af6={'$and':[db[_0x4082('0x5e')][_0x4082('0x3d')](db[_0x4082('0x5e')]['fn'](_0x4082('0x5f'),db[_0x4082('0x5e')]['col']('uniqueid')),_0x57a75c[_0x4082('0x33')][_0x4082('0x60')])]};if(_0x57a75c[_0x4082('0x33')][_0x4082('0x2f')]&&_0x57a75c[_0x4082('0x33')][_0x4082('0x2f')]===_0x4082('0x4e')){_0x411af6[_0x4082('0x61')][_0x4082('0x62')]({'uniqueid':_0x57a75c[_0x4082('0x4f')]['id']});}else{_0x411af6[_0x4082('0x61')]['push']({'id':_0x57a75c[_0x4082('0x4f')]['id']});}return db[_0x4082('0x2d')]['find']({'where':_0x411af6,'attributes':['id',_0x4082('0x50')],'raw':!![]})[_0x4082('0x24')](handleEntityNotFound(_0x5bbcd0,null))[_0x4082('0x24')](function(_0x1c3161){if(_0x1c3161){var _0x1b7030=util['format'](_0x4082('0x51'),_0x1c3161['value']);if(fs[_0x4082('0x52')](_0x1b7030)){_0x3b48ed=!![];return _0x211c3a[_0x4082('0x53')](_0x1b7030,_0x1c3161[_0x4082('0x50')],config[_0x4082('0x54')][_0x4082('0x55')])[_0x4082('0x24')](function(){return _0x1c3161;});}return _0x1c3161;}})['then'](function(_0x15eff6){if(_0x15eff6){if(!fs['existsSync'](_0x15eff6[_0x4082('0x50')])){throw new db[(_0x4082('0x56'))]['ValidationError'](_0x4082('0x58'));}if(_0x15eff6[_0x4082('0x59')]){return _0x5bbcd0[_0x4082('0x4c')](_0x15eff6[_0x4082('0x50')],_0x15eff6[_0x4082('0x59')]+path[_0x4082('0x5a')](_0x15eff6['value']),function(){if(_0x3b48ed){fs[_0x4082('0x5b')](_0x15eff6[_0x4082('0x50')]);}});}else{return _0x5bbcd0[_0x4082('0x4c')](_0x15eff6[_0x4082('0x50')],function(_0x39bbc6){if(_0x3b48ed){fs[_0x4082('0x5b')](_0x15eff6[_0x4082('0x50')]);}});}}})[_0x4082('0x44')](handleError(_0x5bbcd0,null));};exports[_0x4082('0x23')]=function(_0x138469,_0xa4af9d){return db[_0x4082('0x2d')][_0x4082('0x48')]({'where':{'id':_0x138469[_0x4082('0x4f')]['id']}})['then'](function(_0x3944d9){if(!_0x3944d9)throw new ReferenceError(_0x4082('0x63'));return _0x3944d9;})[_0x4082('0x24')](function(_0x4603a4){var _0x39d873=_0x4603a4[_0x4082('0x50')];logger[_0x4082('0x64')](_0x4082('0x65'),_0x39d873);if(!_[_0x4082('0x66')](_0x4603a4['value'])&&fs[_0x4082('0x52')](_0x39d873)){logger['info'](_0x4082('0x67')+_0x39d873+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4082('0x68')](_0x39d873);}_0x39d873=_0x39d873+'.cypher';if(!_['isNil'](_0x4603a4['value'])&&fs[_0x4082('0x52')](_0x39d873)){logger[_0x4082('0x64')]('File:\x20\x22'+_0x39d873+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4082('0x68')](_0x39d873);}return _0x4603a4;})['then'](function(_0x23de4f){if(!_0x23de4f)throw new InternalError();return _0x23de4f[_0x4082('0x23')]();})[_0x4082('0x24')](function(){_0xa4af9d['status'](0xcc)[_0x4082('0x25')]();})[_0x4082('0x44')](handleError(_0xa4af9d,null));};function getBucketslist(_0x3f65fa,_0xadcaeb,_0xf3aa4b){return new Promise(function(_0x250f06,_0x31104e){var _0x52af98=new AWS['S3']({'accessKeyId':_0xadcaeb,'secretAccessKey':_0x3f65fa,'region':_0xf3aa4b});_0x52af98[_0x4082('0x69')]({},function(_0x5664a2,_0x38640e){if(_0x5664a2){return _0x31104e(_0x5664a2);}else{return _0x250f06(_0x38640e);}});});}function createBucket(_0x41d097,_0x29420d,_0x574c81,_0x3c4fe1){return new Promise(function(_0x4c2cfb,_0xa35130){var _0x265aee=new AWS['S3']({'accessKeyId':_0x29420d,'secretAccessKey':_0x41d097,'region':_0x574c81});_0x265aee[_0x4082('0x6a')]({'Bucket':_0x3c4fe1},function(_0x2b694d,_0x3fd153){if(_0x2b694d){return _0xa35130(_0x2b694d);}else{return _0x4c2cfb(_0x3fd153);}});});}function uploadFile(_0xb3812d,_0x3651ba,_0x368376,_0x2b6253,_0x44dbdf,_0x5e3da3){return new Promise(function(_0xb0648a,_0x4a40a3){var _0x2a93fd=new AWS['S3']({'accessKeyId':_0x3651ba,'secretAccessKey':_0xb3812d,'region':_0x368376});_0x2a93fd[_0x4082('0x6b')]({'Bucket':_0x2b6253,'Key':_0x44dbdf,'Body':_0x5e3da3},function(_0x25d2ca,_0x2dd017){if(_0x25d2ca){return _0x4a40a3(_0x25d2ca);}else{return _0xb0648a(_0x2dd017);}});});}function startTranscribe(_0x56ddca,_0x3c2c17,_0x565cea,_0x202e31,_0x3e58ea,_0x568421){return new Promise(function(_0x35db81,_0x5dae88){var _0x8317aa=new AWS[(_0x4082('0x6c'))]({'accessKeyId':_0x3c2c17,'secretAccessKey':_0x56ddca,'region':_0x565cea});_0x8317aa['startTranscriptionJob']({'TranscriptionJobName':_0x202e31,'LanguageCode':_0x3e58ea,'Media':{'MediaFileUri':_0x568421}},function(_0x5371b9,_0x2845fa){if(_0x5371b9){return _0x5dae88(_0x5371b9);}else{return _0x35db81(_0x2845fa);}});});}function transcribe(_0x38a0f5,_0x2af5dd,_0x1017e9,_0x56ff87,_0x3f0f7f,_0x4ed50b,_0x298f36){return new Promise(function(_0x757fc3,_0x2072fe){var _0x26c993={};logger[_0x4082('0x64')](util[_0x4082('0x32')](_0x4082('0x6d'),_0x38a0f5,_0x3f0f7f));return uploadFile(_0x2af5dd,_0x1017e9,_0x56ff87,_0x3f0f7f,path[_0x4082('0x6e')](_0x4ed50b),fs[_0x4082('0x6f')](_0x4ed50b))[_0x4082('0x24')](function(_0x34a28f){logger[_0x4082('0x64')](util[_0x4082('0x32')](_0x4082('0x70'),_0x38a0f5,_0x3f0f7f,_0x34a28f[_0x4082('0x71')]));_0x26c993['bucket']=_0x34a28f[_0x4082('0x72')];_0x26c993[_0x4082('0x73')]=_0x34a28f[_0x4082('0x71')];logger[_0x4082('0x64')](util[_0x4082('0x32')](_0x4082('0x74'),_0x38a0f5));return startTranscribe(_0x2af5dd,_0x1017e9,_0x56ff87,uuidv4(),_0x298f36,_0x34a28f[_0x4082('0x71')]);})[_0x4082('0x24')](function(_0x37a692){logger[_0x4082('0x64')](util[_0x4082('0x32')](_0x4082('0x75'),_0x38a0f5,_0x37a692[_0x4082('0x76')]['TranscriptionJobName']));_0x26c993['transcribeName']=_0x37a692[_0x4082('0x76')][_0x4082('0x77')];_0x26c993[_0x4082('0x78')]=_0x37a692[_0x4082('0x76')][_0x4082('0x79')];return _0x757fc3(_0x26c993);})[_0x4082('0x44')](function(_0x4e15af){return _0x2072fe(_0x4e15af);});});}exports[_0x4082('0x7a')]=function(_0xc9d8ee,_0x2d70a3,_0x22a9a0){var _0xf5dfdc;var _0x2a1006;var _0xdbc8b7;var _0x42faf2=require(_0x4082('0x4d'));return db[_0x4082('0x2d')][_0x4082('0x7b')]({'where':{'id':_0xc9d8ee['params']['id']}})['then'](function(_0x250181){if(_0x250181){var _0x512d28=util[_0x4082('0x32')]('%s.cypher',_0x250181[_0x4082('0x50')]);if(fs[_0x4082('0x52')](_0x512d28)){cypher=!![];return _0x42faf2[_0x4082('0x53')](_0x512d28,_0x250181[_0x4082('0x50')],config[_0x4082('0x54')][_0x4082('0x55')])['then'](function(){return _0x250181;});}return _0x250181;}})['then'](function(_0x5b22e9){if(!_0x5b22e9){throw new db[(_0x4082('0x56'))][(_0x4082('0x57'))](_0x4082('0x7c'));}_0x2a1006=_0x5b22e9;return db[_0x4082('0x7d')][_0x4082('0x7b')]({'where':{'id':0x1}});})[_0x4082('0x24')](handleEntityNotFound(_0x2d70a3,null))[_0x4082('0x24')](function(_0x5b81e8){if(_0x5b81e8){_0xf5dfdc=_0x5b81e8;if(!_0xf5dfdc[_0x4082('0x7e')]||!_0xf5dfdc[_0x4082('0x7f')]||!_0xf5dfdc[_0x4082('0x80')]||!_0xf5dfdc['language']||!_0xf5dfdc[_0x4082('0x81')]){throw new db[(_0x4082('0x56'))][(_0x4082('0x57'))](_0x4082('0x82'));}if(_0xc9d8ee[_0x4082('0x4a')]['runSentiment']&&(!_0xf5dfdc[_0x4082('0x83')]||!_0xf5dfdc['sentimentAccountId']||!_0xf5dfdc[_0x4082('0x84')]||!_0xf5dfdc[_0x4082('0x85')]||!_0xf5dfdc[_0x4082('0x81')])){throw new db[(_0x4082('0x56'))][(_0x4082('0x57'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x4082('0x86')][_0x4082('0x7b')]({'where':{'id':_0xf5dfdc[_0x4082('0x7f')]}});}})[_0x4082('0x24')](function(_0x504798){if(!_0x504798){throw new db[(_0x4082('0x56'))]['ValidationError'](_0x4082('0x87'));}if(!_0x504798[_0x4082('0x88')]||!_0x504798['data2']){throw new db['Sequelize'][(_0x4082('0x57'))](_0x4082('0x89'));}_0xdbc8b7=_0x504798;return getBucketslist(_0xdbc8b7['data1'],_0xdbc8b7[_0x4082('0x8a')],_0xf5dfdc[_0x4082('0x80')]);})[_0x4082('0x24')](function(_0xa7fcd9){if(_0xa7fcd9&&_0xa7fcd9[_0x4082('0x8b')]){var _0x38bc26=_[_0x4082('0x48')](_0xa7fcd9[_0x4082('0x8b')],function(_0x17a6e7){return _0x17a6e7[_0x4082('0x8c')]===_0xf5dfdc[_0x4082('0x81')];});if(!_0x38bc26){logger[_0x4082('0x64')](util[_0x4082('0x32')](_0x4082('0x8d'),_0xc9d8ee['params']['id'],_0xf5dfdc['bucket']));return createBucket(_0xdbc8b7[_0x4082('0x88')],_0xdbc8b7[_0x4082('0x8a')],_0xf5dfdc[_0x4082('0x80')],_0xf5dfdc['bucket']);}logger[_0x4082('0x64')](util['format'](_0x4082('0x8e'),_0xc9d8ee['params']['id'],_0xf5dfdc[_0x4082('0x81')]));return;}})['then'](function(_0x3cc8be){if(_0x2a1006['transcribeStatus']===_0x4082('0x8f')){return transcribe(_0xc9d8ee[_0x4082('0x4f')]['id'],_0xdbc8b7[_0x4082('0x88')],_0xdbc8b7[_0x4082('0x8a')],_0xf5dfdc[_0x4082('0x80')],_0xf5dfdc[_0x4082('0x81')],_0x2a1006[_0x4082('0x50')],_0xf5dfdc[_0x4082('0x85')]);}else{logger[_0x4082('0x64')](util[_0x4082('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0xc9d8ee[_0x4082('0x4f')]['id']));return{'transcribeStatus':_0x4082('0x90')};}})[_0x4082('0x24')](function(_0x2716e0){if(_0x2716e0){_0x2716e0[_0x4082('0x91')]=_0xc9d8ee[_0x4082('0x4a')]['runSentiment'];return _0x2a1006[_0x4082('0x92')](_0x2716e0);}})[_0x4082('0x24')](respondWithResult(_0x2d70a3,null))['catch'](handleError(_0x2d70a3,null));};function writeFile(_0x4015e0,_0x2607f2){return new Promise(function(_0x8cc218,_0x16e924){fs[_0x4082('0x93')](_0x2607f2,_0x4015e0,function(_0x4d05c4,_0x2ac3a0){if(_0x4d05c4){return _0x16e924(_0x4d05c4);}else{return _0x8cc218(_0x2ac3a0);}});});}exports[_0x4082('0x94')]=function(_0x35b763,_0x366f14,_0x213c49){return db[_0x4082('0x2d')][_0x4082('0x7b')]({'where':{'id':_0x35b763[_0x4082('0x4f')]['id']}})[_0x4082('0x24')](handleEntityNotFound(_0x366f14))[_0x4082('0x24')](function(_0x5759aa){if(_0x5759aa&&_0x5759aa[_0x4082('0x95')]){var _0x4a15f3=_0x5759aa[_0x4082('0x95')];var _0x191e2f=config[_0x4082('0x96')]+_0x4082('0x97')+_0x5759aa['id']+'.txt';if(fs[_0x4082('0x52')](_0x191e2f)){return _0x191e2f;}return writeFile(_0x4a15f3,_0x191e2f)['then'](function(){return _0x191e2f;});}else{throw new db[(_0x4082('0x56'))][(_0x4082('0x57'))](_0x4082('0x98'));}})[_0x4082('0x24')](function(_0x171df6){return _0x366f14[_0x4082('0x4c')](_0x171df6);})[_0x4082('0x44')](handleError(_0x366f14));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 7e85d9e..898a546 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 _0x539d=['rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','request-promise','path'];(function(_0x4a3f1a,_0x319d23){var _0x3a72f5=function(_0x501308){while(--_0x501308){_0x4a3f1a['push'](_0x4a3f1a['shift']());}};_0x3a72f5(++_0x319d23);}(_0x539d,0x17b));var _0xd539=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0x539d[_0x3a7db0];return _0x17cbba;};'use strict';var _=require(_0xd539('0x0'));var util=require('util');var logger=require(_0xd539('0x1'))(_0xd539('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd539('0x3'));var fs=require('fs');var path=require(_0xd539('0x4'));var rimraf=require(_0xd539('0x5'));var config=require(_0xd539('0x6'));var attributes=require(_0xd539('0x7'));module['exports']=function(_0x341dd4,_0x158719){return _0x341dd4[_0xd539('0x8')](_0xd539('0x9'),attributes,{'tableName':_0xd539('0xa'),'paranoid':![],'indexes':[{'name':_0xd539('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf03a=['request-promise','path','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','util','../../config/logger','api','moment'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0xf03a,0x1a0));var _0xaf03=function(_0x1103c2,_0x49de54){_0x1103c2=_0x1103c2-0x0;var _0x2446bb=_0xf03a[_0x1103c2];return _0x2446bb;};'use strict';var _=require('lodash');var util=require(_0xaf03('0x0'));var logger=require(_0xaf03('0x1'))(_0xaf03('0x2'));var moment=require(_0xaf03('0x3'));var BPromise=require('bluebird');var rp=require(_0xaf03('0x4'));var fs=require('fs');var path=require(_0xaf03('0x5'));var rimraf=require('rimraf');var config=require(_0xaf03('0x6'));var attributes=require(_0xaf03('0x7'));module[_0xaf03('0x8')]=function(_0x2e05f7,_0x58a29b){return _0x2e05f7[_0xaf03('0x9')]('VoiceRecording',attributes,{'tableName':_0xaf03('0xa'),'paranoid':![],'indexes':[{'name':_0xaf03('0xb'),'fields':[_0xaf03('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c2fc004..675e604 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(_0x52ca59,_0x279dda){var _0x1ab7e5=function(_0x2b8c74){while(--_0x2b8c74){_0x52ca59['push'](_0x52ca59['shift']());}};_0x1ab7e5(++_0x279dda);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x46723d,_0x3d6bd5){var _0x5e2b3a=function(_0x1a3c33){while(--_0x1a3c33){_0x46723d['push'](_0x46723d['shift']());}};_0x5e2b3a(++_0x3d6bd5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 390b4db..9df829d 100644 --- a/server/api/voiceTransferReport/index.js +++ b/server/api/voiceTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7096=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x298f55,_0x7e9f0c){var _0x4dea4b=function(_0x149075){while(--_0x149075){_0x298f55['push'](_0x298f55['shift']());}};_0x4dea4b(++_0x7e9f0c);}(_0x7096,0x10c));var _0x6709=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7096[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var auth=require(_0x6709('0x3'));var interaction=require(_0x6709('0x4'));var config=require(_0x6709('0x5'));var controller=require(_0x6709('0x6'));router[_0x6709('0x7')]('/',auth[_0x6709('0x8')](),controller[_0x6709('0x9')]);router[_0x6709('0x7')](_0x6709('0xa'),auth[_0x6709('0x8')](),controller[_0x6709('0xb')]);router[_0x6709('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6709('0xd')](_0x6709('0xa'),auth[_0x6709('0x8')](),controller[_0x6709('0xe')]);router[_0x6709('0xf')](_0x6709('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6709('0x10')]=router; \ No newline at end of file +var _0x46ed=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x244932,_0x457590){var _0x570100=function(_0x2272cc){while(--_0x2272cc){_0x244932['push'](_0x244932['shift']());}};_0x570100(++_0x457590);}(_0x46ed,0x168));var _0xd46e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46ed[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xd46e('0x7')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0x9')]);router[_0xd46e('0x7')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')]('/:id',auth[_0xd46e('0x8')](),controller[_0xd46e('0xf')]);router['delete'](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 30ae941..7efbaa6 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 _0x8957=['exports','ENUM','blind','attended','STRING','Yes','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8957,0xed));var _0x7895=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x8957[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7895('0x0'));module[_0x7895('0x1')]={'type':{'type':Sequelize[_0x7895('0x2')](_0x7895('0x3'),_0x7895('0x4'))},'result':{'type':Sequelize[_0x7895('0x5')]},'transfererchannel':{'type':Sequelize[_0x7895('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x7895('0x5')]},'transferercalleridname':{'type':Sequelize[_0x7895('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x7895('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x7895('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x7895('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x7895('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x7895('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x7895('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7895('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7895('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x7895('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x7895('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x7895('0x2')](_0x7895('0x6'),'No')},'context':{'type':Sequelize[_0x7895('0x5')]},'extension':{'type':Sequelize[_0x7895('0x5')]}}; \ No newline at end of file +var _0x3dab=['STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x1c1e15,_0x566245){var _0x3b8679=function(_0x3437f1){while(--_0x3437f1){_0x1c1e15['push'](_0x1c1e15['shift']());}};_0x3b8679(++_0x566245);}(_0x3dab,0xd4));var _0xb3da=function(_0x11943f,_0x2b4caf){_0x11943f=_0x11943f-0x0;var _0x2a3d5c=_0x3dab[_0x11943f];return _0x2a3d5c;};'use strict';var Sequelize=require(_0xb3da('0x0'));var moment=require(_0xb3da('0x1'));module[_0xb3da('0x2')]={'type':{'type':Sequelize[_0xb3da('0x3')](_0xb3da('0x4'),'attended')},'result':{'type':Sequelize[_0xb3da('0x5')]},'transfererchannel':{'type':Sequelize[_0xb3da('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb3da('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb3da('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb3da('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb3da('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xb3da('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xb3da('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb3da('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb3da('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xb3da('0x5')]},'transfereecontext':{'type':Sequelize[_0xb3da('0x5')]},'transfereeexten':{'type':Sequelize[_0xb3da('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xb3da('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xb3da('0x6'),'No')},'context':{'type':Sequelize[_0xb3da('0x5')]},'extension':{'type':Sequelize[_0xb3da('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index d25621b..f32a77e 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 _0xdfe1=['key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','fields','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdfe1,0x1e1));var _0x1dfe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdfe1[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1dfe('0x0'));var emlformat=require(_0x1dfe('0x1'));var rimraf=require(_0x1dfe('0x2'));var zipdir=require(_0x1dfe('0x3'));var jsonpatch=require(_0x1dfe('0x4'));var rp=require(_0x1dfe('0x5'));var moment=require(_0x1dfe('0x6'));var BPromise=require(_0x1dfe('0x7'));var Mustache=require(_0x1dfe('0x8'));var util=require(_0x1dfe('0x9'));var path=require(_0x1dfe('0xa'));var sox=require(_0x1dfe('0xb'));var csv=require(_0x1dfe('0xc'));var ejs=require(_0x1dfe('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1dfe('0xe'));var deskjs=require(_0x1dfe('0xf'));var toCsv=require(_0x1dfe('0xc'));var querystring=require('querystring');var Papa=require(_0x1dfe('0x10'));var Redis=require(_0x1dfe('0x11'));var authService=require(_0x1dfe('0x12'));var qs=require(_0x1dfe('0x13'));var as=require(_0x1dfe('0x14'));var hardwareService=require(_0x1dfe('0x15'));var logger=require(_0x1dfe('0x16'))(_0x1dfe('0x17'));var utils=require(_0x1dfe('0x18'));var config=require(_0x1dfe('0x19'));var db=require(_0x1dfe('0x1a'))['db'];function respondWithStatusCode(_0x49432b,_0x382441){_0x382441=_0x382441||0xcc;return function(_0x1585c1){if(_0x1585c1){return _0x49432b[_0x1dfe('0x1b')](_0x382441);}return _0x49432b[_0x1dfe('0x1c')](_0x382441)[_0x1dfe('0x1d')]();};}function respondWithResult(_0x24d562,_0x39a90e){_0x39a90e=_0x39a90e||0xc8;return function(_0x1a9932){if(_0x1a9932){return _0x24d562[_0x1dfe('0x1c')](_0x39a90e)[_0x1dfe('0x1e')](_0x1a9932);}};}function respondWithFilteredResult(_0x53e745,_0x160b20){return function(_0x42e195){if(_0x42e195){var _0x4498f0=_0x42e195[_0x1dfe('0x1f')],_0x588f48=_0x160b20[_0x1dfe('0x20')],_0x57d1dc=_0x160b20[_0x1dfe('0x20')]+_0x160b20[_0x1dfe('0x21')],_0x165c2f;if(_0x57d1dc>=_0x4498f0){_0x57d1dc=_0x4498f0;_0x165c2f=0xc8;}else{_0x165c2f=0xce;}_0x53e745[_0x1dfe('0x1c')](_0x165c2f);return _0x53e745[_0x1dfe('0x22')](_0x1dfe('0x23'),_0x588f48+'-'+_0x57d1dc+'/'+_0x4498f0)[_0x1dfe('0x1e')](_0x42e195);}return null;};}function patchUpdates(_0x263830){return function(_0x1a7461){try{jsonpatch[_0x1dfe('0x24')](_0x1a7461,_0x263830,!![]);}catch(_0x460172){return BPromise[_0x1dfe('0x25')](_0x460172);}return _0x1a7461[_0x1dfe('0x26')]();};}function saveUpdates(_0x2774e4,_0xa96e18){return function(_0x1f4b7a){if(_0x1f4b7a){return _0x1f4b7a[_0x1dfe('0x27')](_0x2774e4)[_0x1dfe('0x28')](function(_0x983b6c){return _0x983b6c;});}return null;};}function removeEntity(_0x297647,_0x365b22){return function(_0x416926){if(_0x416926){return _0x416926[_0x1dfe('0x29')]()[_0x1dfe('0x28')](function(){_0x297647[_0x1dfe('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x222869,_0x909520){return function(_0x2016fb){if(!_0x2016fb){_0x222869[_0x1dfe('0x1b')](0x194);}return _0x2016fb;};}function handleError(_0x47cf94,_0x439fd4){_0x439fd4=_0x439fd4||0x1f4;return function(_0x49e21e){logger[_0x1dfe('0x2a')](_0x49e21e[_0x1dfe('0x2b')]);if(_0x49e21e[_0x1dfe('0x2c')]){delete _0x49e21e['name'];}_0x47cf94[_0x1dfe('0x1c')](_0x439fd4)['send'](_0x49e21e);};}exports[_0x1dfe('0x2d')]=function(_0x348aed,_0x26485f){var _0x51d7ec={},_0x5e4dc0={},_0x2bda55={'count':0x0,'rows':[]};var _0x2d45cf=_[_0x1dfe('0x2e')](db[_0x1dfe('0x2f')][_0x1dfe('0x30')],function(_0x5b534b){return{'name':_0x5b534b[_0x1dfe('0x31')],'type':_0x5b534b[_0x1dfe('0x32')][_0x1dfe('0x33')]};});_0x5e4dc0[_0x1dfe('0x34')]=_[_0x1dfe('0x2e')](_0x2d45cf,'name');_0x5e4dc0[_0x1dfe('0x35')]=_[_0x1dfe('0x36')](_0x348aed[_0x1dfe('0x35')]);_0x5e4dc0[_0x1dfe('0x37')]=_[_0x1dfe('0x38')](_0x5e4dc0['model'],_0x5e4dc0[_0x1dfe('0x35')]);_0x51d7ec['attributes']=_[_0x1dfe('0x38')](_0x5e4dc0[_0x1dfe('0x34')],qs['fields'](_0x348aed[_0x1dfe('0x35')]['fields']));_0x51d7ec[_0x1dfe('0x39')]=_0x51d7ec[_0x1dfe('0x39')][_0x1dfe('0x3a')]?_0x51d7ec[_0x1dfe('0x39')]:_0x5e4dc0[_0x1dfe('0x34')];if(!_0x348aed['query'][_0x1dfe('0x3b')](_0x1dfe('0x3c'))){_0x51d7ec['limit']=qs[_0x1dfe('0x21')](_0x348aed[_0x1dfe('0x35')][_0x1dfe('0x21')]);_0x51d7ec[_0x1dfe('0x20')]=qs[_0x1dfe('0x20')](_0x348aed[_0x1dfe('0x35')][_0x1dfe('0x20')]);}_0x51d7ec[_0x1dfe('0x3d')]=qs[_0x1dfe('0x3e')](_0x348aed[_0x1dfe('0x35')][_0x1dfe('0x3e')]);_0x51d7ec[_0x1dfe('0x3f')]=qs[_0x1dfe('0x37')](_[_0x1dfe('0x40')](_0x348aed[_0x1dfe('0x35')],_0x5e4dc0['filters']),_0x2d45cf);if(_0x348aed[_0x1dfe('0x35')]['filter']){_0x51d7ec['where']=_[_0x1dfe('0x41')](_0x51d7ec[_0x1dfe('0x3f')],{'$or':_[_0x1dfe('0x2e')](_0x2d45cf,function(_0x54d3a6){if(_0x54d3a6[_0x1dfe('0x32')]!=='VIRTUAL'){var _0xfd4e8c={};_0xfd4e8c[_0x54d3a6[_0x1dfe('0x2c')]]={'$like':'%'+_0x348aed[_0x1dfe('0x35')][_0x1dfe('0x42')]+'%'};return _0xfd4e8c;}})});}_0x51d7ec=_[_0x1dfe('0x41')]({},_0x51d7ec,_0x348aed[_0x1dfe('0x43')]);var _0x237b92={'where':_0x51d7ec[_0x1dfe('0x3f')]};return db[_0x1dfe('0x2f')][_0x1dfe('0x1f')](_0x237b92)[_0x1dfe('0x28')](function(_0x277d17){_0x2bda55['count']=_0x277d17;if(_0x348aed[_0x1dfe('0x35')]['includeAll']){_0x51d7ec[_0x1dfe('0x44')]=[{'all':!![]}];}return db[_0x1dfe('0x2f')][_0x1dfe('0x45')](_0x51d7ec);})['then'](function(_0x19fb45){_0x2bda55[_0x1dfe('0x46')]=_0x19fb45;return _0x2bda55;})[_0x1dfe('0x28')](respondWithFilteredResult(_0x26485f,_0x51d7ec))['catch'](handleError(_0x26485f,null));};exports['show']=function(_0x48d161,_0x1a815d){var _0x50f39d={'raw':!![],'where':{'id':_0x48d161['params']['id']}},_0x33bc31={};_0x33bc31[_0x1dfe('0x34')]=_['keys'](db['VoiceTransferReport'][_0x1dfe('0x30')]);_0x33bc31[_0x1dfe('0x35')]=_[_0x1dfe('0x36')](_0x48d161[_0x1dfe('0x35')]);_0x33bc31[_0x1dfe('0x37')]=_[_0x1dfe('0x38')](_0x33bc31[_0x1dfe('0x34')],_0x33bc31[_0x1dfe('0x35')]);_0x50f39d[_0x1dfe('0x39')]=_[_0x1dfe('0x38')](_0x33bc31[_0x1dfe('0x34')],qs[_0x1dfe('0x47')](_0x48d161[_0x1dfe('0x35')][_0x1dfe('0x47')]));_0x50f39d[_0x1dfe('0x39')]=_0x50f39d[_0x1dfe('0x39')][_0x1dfe('0x3a')]?_0x50f39d['attributes']:_0x33bc31['model'];if(_0x48d161['query']['includeAll']){_0x50f39d[_0x1dfe('0x44')]=[{'all':!![]}];}_0x50f39d=_['merge']({},_0x50f39d,_0x48d161[_0x1dfe('0x43')]);return db[_0x1dfe('0x2f')][_0x1dfe('0x48')](_0x50f39d)[_0x1dfe('0x28')](handleEntityNotFound(_0x1a815d,null))[_0x1dfe('0x28')](respondWithResult(_0x1a815d,null))[_0x1dfe('0x49')](handleError(_0x1a815d,null));};exports[_0x1dfe('0x4a')]=function(_0x3732c2,_0x30f66d){return db[_0x1dfe('0x2f')]['create'](_0x3732c2[_0x1dfe('0x4b')],{})[_0x1dfe('0x28')](respondWithResult(_0x30f66d,0xc9))['catch'](handleError(_0x30f66d,null));};exports[_0x1dfe('0x27')]=function(_0x35a2ac,_0x2adaf5){if(_0x35a2ac[_0x1dfe('0x4b')]['id']){delete _0x35a2ac[_0x1dfe('0x4b')]['id'];}return db[_0x1dfe('0x2f')][_0x1dfe('0x48')]({'where':{'id':_0x35a2ac['params']['id']}})[_0x1dfe('0x28')](handleEntityNotFound(_0x2adaf5,null))[_0x1dfe('0x28')](saveUpdates(_0x35a2ac[_0x1dfe('0x4b')],null))[_0x1dfe('0x28')](respondWithResult(_0x2adaf5,null))['catch'](handleError(_0x2adaf5,null));};exports[_0x1dfe('0x29')]=function(_0x55c906,_0x15beef){return db[_0x1dfe('0x2f')][_0x1dfe('0x48')]({'where':{'id':_0x55c906['params']['id']}})['then'](handleEntityNotFound(_0x15beef,null))['then'](removeEntity(_0x15beef,null))[_0x1dfe('0x49')](handleError(_0x15beef,null));}; \ No newline at end of file +var _0x1764=['map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','rawAttributes','intersection','includeAll','find','create','catch','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','json','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x1764,0x18e));var _0x4176=function(_0x359633,_0x4ec8fb){_0x359633=_0x359633-0x0;var _0x6dc7d6=_0x1764[_0x359633];return _0x6dc7d6;};'use strict';var pdf=require(_0x4176('0x0'));var emlformat=require(_0x4176('0x1'));var rimraf=require(_0x4176('0x2'));var zipdir=require(_0x4176('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4176('0x4'));var moment=require(_0x4176('0x5'));var BPromise=require(_0x4176('0x6'));var Mustache=require(_0x4176('0x7'));var util=require(_0x4176('0x8'));var path=require('path');var sox=require(_0x4176('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4176('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4176('0xb'));var toCsv=require(_0x4176('0xc'));var querystring=require('querystring');var Papa=require(_0x4176('0xd'));var Redis=require(_0x4176('0xe'));var authService=require(_0x4176('0xf'));var qs=require(_0x4176('0x10'));var as=require(_0x4176('0x11'));var hardwareService=require(_0x4176('0x12'));var logger=require(_0x4176('0x13'))('api');var utils=require(_0x4176('0x14'));var config=require(_0x4176('0x15'));var db=require(_0x4176('0x16'))['db'];function respondWithStatusCode(_0x14b66e,_0x3b28ed){_0x3b28ed=_0x3b28ed||0xcc;return function(_0x36c5a2){if(_0x36c5a2){return _0x14b66e['sendStatus'](_0x3b28ed);}return _0x14b66e[_0x4176('0x17')](_0x3b28ed)['end']();};}function respondWithResult(_0x39e70f,_0x511836){_0x511836=_0x511836||0xc8;return function(_0x379b50){if(_0x379b50){return _0x39e70f[_0x4176('0x17')](_0x511836)['json'](_0x379b50);}};}function respondWithFilteredResult(_0x27792b,_0x56a8b8){return function(_0x217803){if(_0x217803){var _0x592887=_0x217803[_0x4176('0x18')],_0x48511c=_0x56a8b8[_0x4176('0x19')],_0x33f1b4=_0x56a8b8[_0x4176('0x19')]+_0x56a8b8[_0x4176('0x1a')],_0x4b6bc6;if(_0x33f1b4>=_0x592887){_0x33f1b4=_0x592887;_0x4b6bc6=0xc8;}else{_0x4b6bc6=0xce;}_0x27792b[_0x4176('0x17')](_0x4b6bc6);return _0x27792b[_0x4176('0x1b')]('Content-Range',_0x48511c+'-'+_0x33f1b4+'/'+_0x592887)[_0x4176('0x1c')](_0x217803);}return null;};}function patchUpdates(_0x35e330){return function(_0x3d2b1a){try{jsonpatch[_0x4176('0x1d')](_0x3d2b1a,_0x35e330,!![]);}catch(_0x44a022){return BPromise[_0x4176('0x1e')](_0x44a022);}return _0x3d2b1a[_0x4176('0x1f')]();};}function saveUpdates(_0x337be4,_0x47b2c1){return function(_0x2bda61){if(_0x2bda61){return _0x2bda61[_0x4176('0x20')](_0x337be4)['then'](function(_0x1105a3){return _0x1105a3;});}return null;};}function removeEntity(_0x39e985,_0x503dba){return function(_0x3b7c74){if(_0x3b7c74){return _0x3b7c74[_0x4176('0x21')]()[_0x4176('0x22')](function(){_0x39e985['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1889b3,_0x5e2b94){return function(_0x1e809e){if(!_0x1e809e){_0x1889b3[_0x4176('0x23')](0x194);}return _0x1e809e;};}function handleError(_0x3bbbb3,_0x45d743){_0x45d743=_0x45d743||0x1f4;return function(_0x543b53){logger[_0x4176('0x24')](_0x543b53['stack']);if(_0x543b53[_0x4176('0x25')]){delete _0x543b53[_0x4176('0x25')];}_0x3bbbb3[_0x4176('0x17')](_0x45d743)[_0x4176('0x26')](_0x543b53);};}exports[_0x4176('0x27')]=function(_0x3082ed,_0x46e1a1){var _0x4a4247={},_0x395038={},_0x598472={'count':0x0,'rows':[]};var _0x25f747=_[_0x4176('0x28')](db[_0x4176('0x29')]['rawAttributes'],function(_0x280a88){return{'name':_0x280a88[_0x4176('0x2a')],'type':_0x280a88[_0x4176('0x2b')][_0x4176('0x2c')]};});_0x395038[_0x4176('0x2d')]=_[_0x4176('0x28')](_0x25f747,'name');_0x395038[_0x4176('0x2e')]=_[_0x4176('0x2f')](_0x3082ed[_0x4176('0x2e')]);_0x395038[_0x4176('0x30')]=_['intersection'](_0x395038[_0x4176('0x2d')],_0x395038[_0x4176('0x2e')]);_0x4a4247[_0x4176('0x31')]=_['intersection'](_0x395038[_0x4176('0x2d')],qs[_0x4176('0x32')](_0x3082ed[_0x4176('0x2e')]['fields']));_0x4a4247[_0x4176('0x31')]=_0x4a4247[_0x4176('0x31')][_0x4176('0x33')]?_0x4a4247[_0x4176('0x31')]:_0x395038[_0x4176('0x2d')];if(!_0x3082ed[_0x4176('0x2e')][_0x4176('0x34')](_0x4176('0x35'))){_0x4a4247[_0x4176('0x1a')]=qs[_0x4176('0x1a')](_0x3082ed['query']['limit']);_0x4a4247[_0x4176('0x19')]=qs['offset'](_0x3082ed[_0x4176('0x2e')]['offset']);}_0x4a4247[_0x4176('0x36')]=qs[_0x4176('0x37')](_0x3082ed[_0x4176('0x2e')]['sort']);_0x4a4247[_0x4176('0x38')]=qs['filters'](_[_0x4176('0x39')](_0x3082ed[_0x4176('0x2e')],_0x395038['filters']),_0x25f747);if(_0x3082ed['query'][_0x4176('0x3a')]){_0x4a4247[_0x4176('0x38')]=_[_0x4176('0x3b')](_0x4a4247[_0x4176('0x38')],{'$or':_[_0x4176('0x28')](_0x25f747,function(_0xcb4bec){if(_0xcb4bec['type']!==_0x4176('0x3c')){var _0x480be3={};_0x480be3[_0xcb4bec[_0x4176('0x25')]]={'$like':'%'+_0x3082ed['query'][_0x4176('0x3a')]+'%'};return _0x480be3;}})});}_0x4a4247=_[_0x4176('0x3b')]({},_0x4a4247,_0x3082ed[_0x4176('0x3d')]);var _0xbb28a5={'where':_0x4a4247['where']};return db['VoiceTransferReport'][_0x4176('0x18')](_0xbb28a5)[_0x4176('0x22')](function(_0x3b0110){_0x598472[_0x4176('0x18')]=_0x3b0110;if(_0x3082ed[_0x4176('0x2e')]['includeAll']){_0x4a4247[_0x4176('0x3e')]=[{'all':!![]}];}return db[_0x4176('0x29')][_0x4176('0x3f')](_0x4a4247);})[_0x4176('0x22')](function(_0x16d896){_0x598472['rows']=_0x16d896;return _0x598472;})['then'](respondWithFilteredResult(_0x46e1a1,_0x4a4247))['catch'](handleError(_0x46e1a1,null));};exports[_0x4176('0x40')]=function(_0x34a9f1,_0xeb1bee){var _0x2af8ba={'raw':!![],'where':{'id':_0x34a9f1[_0x4176('0x41')]['id']}},_0x165064={};_0x165064[_0x4176('0x2d')]=_[_0x4176('0x2f')](db[_0x4176('0x29')][_0x4176('0x42')]);_0x165064[_0x4176('0x2e')]=_['keys'](_0x34a9f1['query']);_0x165064[_0x4176('0x30')]=_[_0x4176('0x43')](_0x165064[_0x4176('0x2d')],_0x165064['query']);_0x2af8ba[_0x4176('0x31')]=_[_0x4176('0x43')](_0x165064[_0x4176('0x2d')],qs['fields'](_0x34a9f1[_0x4176('0x2e')][_0x4176('0x32')]));_0x2af8ba[_0x4176('0x31')]=_0x2af8ba[_0x4176('0x31')]['length']?_0x2af8ba[_0x4176('0x31')]:_0x165064['model'];if(_0x34a9f1[_0x4176('0x2e')][_0x4176('0x44')]){_0x2af8ba[_0x4176('0x3e')]=[{'all':!![]}];}_0x2af8ba=_[_0x4176('0x3b')]({},_0x2af8ba,_0x34a9f1[_0x4176('0x3d')]);return db[_0x4176('0x29')][_0x4176('0x45')](_0x2af8ba)['then'](handleEntityNotFound(_0xeb1bee,null))[_0x4176('0x22')](respondWithResult(_0xeb1bee,null))['catch'](handleError(_0xeb1bee,null));};exports['create']=function(_0xafff96,_0x364e7f){return db[_0x4176('0x29')][_0x4176('0x46')](_0xafff96['body'],{})[_0x4176('0x22')](respondWithResult(_0x364e7f,0xc9))[_0x4176('0x47')](handleError(_0x364e7f,null));};exports[_0x4176('0x20')]=function(_0x167a43,_0x5edca5){if(_0x167a43[_0x4176('0x48')]['id']){delete _0x167a43[_0x4176('0x48')]['id'];}return db[_0x4176('0x29')][_0x4176('0x45')]({'where':{'id':_0x167a43['params']['id']}})[_0x4176('0x22')](handleEntityNotFound(_0x5edca5,null))[_0x4176('0x22')](saveUpdates(_0x167a43[_0x4176('0x48')],null))[_0x4176('0x22')](respondWithResult(_0x5edca5,null))[_0x4176('0x47')](handleError(_0x5edca5,null));};exports[_0x4176('0x21')]=function(_0xf81c0b,_0x4f6133){return db[_0x4176('0x29')]['find']({'where':{'id':_0xf81c0b[_0x4176('0x41')]['id']}})[_0x4176('0x22')](handleEntityNotFound(_0x4f6133,null))[_0x4176('0x22')](removeEntity(_0x4f6133,null))[_0x4176('0x47')](handleError(_0x4f6133,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 23cf246..600da3c 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 _0x7c2d=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7c2d,0xb6));var _0xd7c2=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x7c2d[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0xd7c2('0x0'));var util=require(_0xd7c2('0x1'));var logger=require(_0xd7c2('0x2'))(_0xd7c2('0x3'));var moment=require(_0xd7c2('0x4'));var BPromise=require('bluebird');var rp=require(_0xd7c2('0x5'));var fs=require('fs');var path=require(_0xd7c2('0x6'));var rimraf=require('rimraf');var config=require(_0xd7c2('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0xd7c2('0x8')]=function(_0x5c9b10,_0x588bbb){return _0x5c9b10[_0xd7c2('0x9')](_0xd7c2('0xa'),attributes,{'tableName':_0xd7c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdb0=['../../config/environment','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcdb0,0x71));var _0x0cdb=function(_0x428a08,_0x226897){_0x428a08=_0x428a08-0x0;var _0xecd17b=_0xcdb0[_0x428a08];return _0xecd17b;};'use strict';var _=require(_0x0cdb('0x0'));var util=require(_0x0cdb('0x1'));var logger=require(_0x0cdb('0x2'))(_0x0cdb('0x3'));var moment=require('moment');var BPromise=require(_0x0cdb('0x4'));var rp=require(_0x0cdb('0x5'));var fs=require('fs');var path=require(_0x0cdb('0x6'));var rimraf=require('rimraf');var config=require(_0x0cdb('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x54f9e9,_0x26f5e7){return _0x54f9e9['define'](_0x0cdb('0x8'),attributes,{'tableName':_0x0cdb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index de94dc1..62dafc8 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 _0x5013=['raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5013,0xc6));var _0x3501=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x5013[_0x555b2f];return _0x81c0a6;};'use strict';var _=require(_0x3501('0x0'));var util=require(_0x3501('0x1'));var moment=require(_0x3501('0x2'));var BPromise=require(_0x3501('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3501('0x4'));var db=require(_0x3501('0x5'))['db'];var utils=require(_0x3501('0x6'));var logger=require(_0x3501('0x7'))(_0x3501('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3501('0x9')][_0x3501('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x237d36,_0x5c1f39,_0x23d317){return new BPromise(function(_0x40143f,_0x236226){return client['request'](_0x237d36,_0x23d317)[_0x3501('0xb')](function(_0x22dbfe){logger[_0x3501('0xc')](_0x3501('0xd'),_0x5c1f39,_0x3501('0xe'));logger['debug'](_0x3501('0xf'),_0x5c1f39,_0x3501('0xe'),JSON[_0x3501('0x10')](_0x22dbfe));if(_0x22dbfe[_0x3501('0x11')]){if(_0x22dbfe[_0x3501('0x11')][_0x3501('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x5c1f39,_0x22dbfe[_0x3501('0x11')][_0x3501('0x13')]);return _0x236226(_0x22dbfe[_0x3501('0x11')]['message']);}logger['error'](_0x3501('0xd'),_0x5c1f39,_0x22dbfe['error'][_0x3501('0x13')]);return _0x40143f(_0x22dbfe[_0x3501('0x11')][_0x3501('0x13')]);}else{logger[_0x3501('0xc')](_0x3501('0xd'),_0x5c1f39,'request\x20sent');_0x40143f(_0x22dbfe[_0x3501('0x14')]['message']);}})[_0x3501('0x15')](function(_0x13dcd5){logger['error'](_0x3501('0xd'),_0x5c1f39,_0x13dcd5);_0x236226(_0x13dcd5);});});}exports[_0x3501('0x16')]=function(_0x3191e2){var _0x46853b=this;return new Promise(function(_0x4e21c4,_0x51b897){return db[_0x3501('0x17')][_0x3501('0x18')](_0x3191e2[_0x3501('0x19')],{'raw':_0x3191e2['options']?_0x3191e2['options'][_0x3501('0x1a')]===undefined?!![]:![]:!![]})[_0x3501('0xb')](function(_0x128cb0){logger[_0x3501('0xc')](_0x3501('0x16'),_0x3191e2);logger[_0x3501('0x1b')](_0x3501('0x16'),_0x3191e2,JSON[_0x3501('0x10')](_0x128cb0));_0x4e21c4(_0x128cb0);})[_0x3501('0x15')](function(_0x105cc6){logger[_0x3501('0x11')]('CreateVoiceTransferReport',_0x105cc6[_0x3501('0x13')],_0x3191e2);_0x51b897(_0x46853b[_0x3501('0x11')](0x1f4,_0x105cc6[_0x3501('0x13')]));});});}; \ No newline at end of file +var _0xfabb=['then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x44feaf,_0x46068f){var _0x19ea54=function(_0x530743){while(--_0x530743){_0x44feaf['push'](_0x44feaf['shift']());}};_0x19ea54(++_0x46068f);}(_0xfabb,0x198));var _0xbfab=function(_0x44216f,_0x187779){_0x44216f=_0x44216f-0x0;var _0x3b6d3c=_0xfabb[_0x44216f];return _0x3b6d3c;};'use strict';var _=require(_0xbfab('0x0'));var util=require(_0xbfab('0x1'));var moment=require(_0xbfab('0x2'));var BPromise=require(_0xbfab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfab('0x5'));var logger=require(_0xbfab('0x6'))(_0xbfab('0x7'));var config=require(_0xbfab('0x8'));var jayson=require(_0xbfab('0x9'));var client=jayson[_0xbfab('0xa')][_0xbfab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x349326,_0x27877e,_0x1ae879){return new BPromise(function(_0x2b665a,_0xba3846){return client['request'](_0x349326,_0x1ae879)[_0xbfab('0xc')](function(_0x153a0b){logger[_0xbfab('0xd')](_0xbfab('0xe'),_0x27877e,_0xbfab('0xf'));logger[_0xbfab('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x27877e,'request\x20sent',JSON[_0xbfab('0x11')](_0x153a0b));if(_0x153a0b[_0xbfab('0x12')]){if(_0x153a0b[_0xbfab('0x12')]['code']===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x27877e,_0x153a0b[_0xbfab('0x12')][_0xbfab('0x13')]);return _0xba3846(_0x153a0b[_0xbfab('0x12')][_0xbfab('0x13')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x27877e,_0x153a0b['error'][_0xbfab('0x13')]);return _0x2b665a(_0x153a0b[_0xbfab('0x12')][_0xbfab('0x13')]);}else{logger['info'](_0xbfab('0xe'),_0x27877e,_0xbfab('0xf'));_0x2b665a(_0x153a0b[_0xbfab('0x14')][_0xbfab('0x13')]);}})[_0xbfab('0x15')](function(_0x5185e9){logger[_0xbfab('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x27877e,_0x5185e9);_0xba3846(_0x5185e9);});});}exports[_0xbfab('0x16')]=function(_0x3d4d09){var _0x151113=this;return new Promise(function(_0xb57133,_0x1eb656){return db[_0xbfab('0x17')][_0xbfab('0x18')](_0x3d4d09[_0xbfab('0x19')],{'raw':_0x3d4d09[_0xbfab('0x1a')]?_0x3d4d09['options'][_0xbfab('0x1b')]===undefined?!![]:![]:!![]})[_0xbfab('0xc')](function(_0x349b29){logger[_0xbfab('0xd')]('CreateVoiceTransferReport',_0x3d4d09);logger[_0xbfab('0x10')](_0xbfab('0x16'),_0x3d4d09,JSON[_0xbfab('0x11')](_0x349b29));_0xb57133(_0x349b29);})['catch'](function(_0x2ae730){logger[_0xbfab('0x12')](_0xbfab('0x16'),_0x2ae730[_0xbfab('0x13')],_0x3d4d09);_0x1eb656(_0x151113[_0xbfab('0x12')](0x1f4,_0x2ae730['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 6ec3990..e2eb068 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 _0x7846=['canUpdate','hangup','answer','/hold','hold','/unhold','unhold','/calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup'];(function(_0x5126ef,_0x3ef1fa){var _0x124a42=function(_0x40984e){while(--_0x40984e){_0x5126ef['push'](_0x5126ef['shift']());}};_0x124a42(++_0x3ef1fa);}(_0x7846,0xf4));var _0x6784=function(_0x589248,_0x31dea3){_0x589248=_0x589248-0x0;var _0x486750=_0x7846[_0x589248];return _0x486750;};'use strict';var express=require('express');var router=express[_0x6784('0x0')]();var auth=require(_0x6784('0x1'));var controller=require(_0x6784('0x2'));router[_0x6784('0x3')](_0x6784('0x4'),auth[_0x6784('0x5')](),auth['canUpdate'](),controller[_0x6784('0x6')]);router[_0x6784('0x3')](_0x6784('0x7'),auth[_0x6784('0x5')](),auth[_0x6784('0x8')](),controller[_0x6784('0x9')]);router[_0x6784('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6784('0x8')](),controller[_0x6784('0xa')]);router[_0x6784('0x3')](_0x6784('0xb'),auth[_0x6784('0x5')](),auth[_0x6784('0x8')](),controller[_0x6784('0xc')]);router[_0x6784('0x3')](_0x6784('0xd'),auth[_0x6784('0x5')](),auth[_0x6784('0x8')](),controller[_0x6784('0xe')]);router[_0x6784('0x3')](_0x6784('0xf'),auth[_0x6784('0x5')](),auth[_0x6784('0x8')](),controller['calls']);router[_0x6784('0x3')](_0x6784('0x10'),auth[_0x6784('0x5')](),auth[_0x6784('0x8')](),controller['transfer']);module[_0x6784('0x11')]=router; \ No newline at end of file +var _0xce9b=['express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','/hangup','hangup','/answer','answer','/unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x67624f,_0x335844){var _0x2235c9=function(_0x4a2df2){while(--_0x4a2df2){_0x67624f['push'](_0x67624f['shift']());}};_0x2235c9(++_0x335844);}(_0xce9b,0xc6));var _0xbce9=function(_0x21557f,_0x4a5291){_0x21557f=_0x21557f-0x0;var _0x22e491=_0xce9b[_0x21557f];return _0x22e491;};'use strict';var express=require(_0xbce9('0x0'));var router=express[_0xbce9('0x1')]();var auth=require(_0xbce9('0x2'));var controller=require(_0xbce9('0x3'));router[_0xbce9('0x4')](_0xbce9('0x5'),auth[_0xbce9('0x6')](),auth[_0xbce9('0x7')](),controller['originate']);router[_0xbce9('0x4')](_0xbce9('0x8'),auth[_0xbce9('0x6')](),auth[_0xbce9('0x7')](),controller[_0xbce9('0x9')]);router[_0xbce9('0x4')](_0xbce9('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xbce9('0xb')]);router[_0xbce9('0x4')]('/hold',auth[_0xbce9('0x6')](),auth[_0xbce9('0x7')](),controller['hold']);router['post'](_0xbce9('0xc'),auth[_0xbce9('0x6')](),auth[_0xbce9('0x7')](),controller['unhold']);router['post'](_0xbce9('0xd'),auth[_0xbce9('0x6')](),auth[_0xbce9('0x7')](),controller[_0xbce9('0xe')]);router[_0xbce9('0x4')](_0xbce9('0xf'),auth[_0xbce9('0x6')](),auth[_0xbce9('0x7')](),controller[_0xbce9('0x10')]);module[_0xbce9('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 514e2b9..cae681b 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 _0xdace=['sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','validate','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20executed!','unhold','webbar:unhold','calls','VoiceChannels','all','filter','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','send','status','NotFound','request','code','message','result','catch','User','findOne','agent','then','UserId','sessionId','length'];(function(_0x393d25,_0x375fed){var _0x4ff01c=function(_0x574c71){while(--_0x574c71){_0x393d25['push'](_0x393d25['shift']());}};_0x4ff01c(++_0x375fed);}(_0xdace,0xc5));var _0xedac=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xdace[_0x233cb1];return _0x29ee7e;};'use strict';var path=require(_0xedac('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xedac('0x1'))['db'];var config=require(_0xedac('0x2'));var util=require(_0xedac('0x3'));var BPromise=require('bluebird');var jayson=require(_0xedac('0x4'));var amiClient=jayson[_0xedac('0x5')][_0xedac('0x6')]({'port':0x232a});var logger=require(_0xedac('0x7'))('webbarapi');var Redis=require(_0xedac('0x8'));config[_0xedac('0x9')]=_[_0xedac('0xa')](config['redis'],{'host':_0xedac('0xb'),'port':0x18eb});var io=require(_0xedac('0xc'))(new Redis(config[_0xedac('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xedac('0xd'),'required':[!![],_0xedac('0xe')]},'callNumber':{'type':_0xedac('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xedac('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xedac('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xedac('0xd'),'required':[!![],_0xedac('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xedac('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xedac('0xf'),'required':[!![],_0xedac('0x10')]},'transferNumber':{'type':_0xedac('0xf'),'required':[!![],_0xedac('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xedac('0xd'),'required':[!![],_0xedac('0xe')]},'sessionId':{'type':_0xedac('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xedac('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xedac('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xedac('0xd'),'required':[!![],_0xedac('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xedac('0xd'),'required':[!![],_0xedac('0xe')]}});function emit(_0x590e9b,_0xed25bb,_0x594b11){logger[_0xedac('0x12')](_0x590e9b,_0xed25bb,JSON[_0xedac('0x13')](_0x594b11));io['to'](_0x590e9b)[_0xedac('0x14')](_0xed25bb,_0x594b11);}function handleError(_0xba0c93){return function(_0x4fb540){console['log'](_0xedac('0x15'),_0x4fb540,_0x4fb540 instanceof RangeError);logger[_0xedac('0x16')](_0x4fb540[_0xedac('0x17')]);if(_0x4fb540 instanceof RangeError){if(_0x4fb540[_0xedac('0x18')]){delete _0x4fb540['name'];}_0xba0c93['status'](0x194)[_0xedac('0x19')](_0x4fb540);}else{if(_0x4fb540[_0xedac('0x18')]){delete _0x4fb540[_0xedac('0x18')];}_0xba0c93[_0xedac('0x1a')](0x1f4)[_0xedac('0x19')](_0x4fb540);}};}function checkError(){return function(_0x4685f1){if(!_0x4685f1){throw new RangeError(_0xedac('0x1b'));}return _0x4685f1;};}function respondWithRpcPromise(_0x928ebe,_0x5353e3){return new BPromise(function(_0x4593e8,_0x510005){var _0x29cd40=amiClient;return _0x29cd40[_0xedac('0x1c')](_0x928ebe,_0x5353e3)['then'](function(_0x46e09d){if(_0x46e09d[_0xedac('0x16')]){if(_0x46e09d[_0xedac('0x16')][_0xedac('0x1d')]===0x1f4){return _0x510005(_0x46e09d[_0xedac('0x16')][_0xedac('0x1e')]);}return _0x4593e8(_0x46e09d['error'][_0xedac('0x1e')]);}else{_0x4593e8(_0x46e09d[_0xedac('0x1f')]);}})[_0xedac('0x20')](function(_0x41ad8d){_0x510005(_0x41ad8d);});});}function getAgent(_0x1ff33e){return db[_0xedac('0x21')][_0xedac('0x22')]({'where':{'id':_0x1ff33e,'role':_0xedac('0x23')}})[_0xedac('0x24')](checkError());}function getAgentCheckSession(_0x4663c0,_0x4c5566){return new BPromise(function(_0x25d7f5,_0xf0a2ce){var _0x19aed3=respondWithRpcPromise('VoiceChannels');var _0x313e06=getAgent(_0x4663c0);Promise['all']([_0x19aed3,_0x313e06])['then'](function(_0x3e28bf){var _0x457d81=_0x3e28bf[0x0];var _0x44ac60=_0x3e28bf[0x1];var _0x14522a=_['filter'](_0x457d81['rows'],function(_0xe813e6){return _0xe813e6[_0xedac('0x25')]==_0x44ac60['id']&&_0xe813e6[_0xedac('0x26')]==_0x4c5566;});if(_0x14522a[_0xedac('0x27')]==0x1){_0x25d7f5(_0x44ac60);}else{_0xf0a2ce(new RangeError(_0xedac('0x28')+_0x4c5566+_0xedac('0x29')));}});});}exports[_0xedac('0x2a')]=function(_0x483233,_0x3bc910){logger[_0xedac('0x12')](_0xedac('0x2b'),_0x483233['body']);var _0x1a8579=originateValidation[_0xedac('0x2c')](_0x483233['body']);if(_0x1a8579[_0xedac('0x27')]>0x0){return _0x3bc910[_0xedac('0x1a')](0x190)['json'](_0x1a8579);}var _0x4255b9=_0x483233[_0xedac('0x2d')][_0xedac('0x2e')];var _0x195f78=_0x483233[_0xedac('0x2d')][_0xedac('0x2f')];var _0x487ad7=_0x483233[_0xedac('0x2d')][_0xedac('0x30')];var _0x34be79=_0x483233['body'][_0xedac('0x31')];return getAgent(_0x4255b9)[_0xedac('0x24')](function(_0x2a87ae){logger[_0xedac('0x12')](_0xedac('0x32'),_0x2a87ae[_0xedac('0x18')]);emit(util[_0xedac('0x33')](_0xedac('0x34'),_0x2a87ae[_0xedac('0x18')]),_0xedac('0x35'),{'callNumber':_0x195f78,'callerId':_0x487ad7,'callbackUrl':_0x34be79});return _0x3bc910[_0xedac('0x1a')](0xc8)[_0xedac('0x36')]({'error':![],'message':_0xedac('0x37')});})[_0xedac('0x20')](handleError(_0x3bc910));};exports[_0xedac('0x38')]=function(_0x527878,_0x1ddcc1){logger[_0xedac('0x12')](_0xedac('0x39'),_0x527878[_0xedac('0x2d')]);var _0x5085ae=hangupValidation[_0xedac('0x2c')](_0x527878[_0xedac('0x2d')]);if(_0x5085ae[_0xedac('0x27')]>0x0){return _0x1ddcc1['status'](0x190)[_0xedac('0x36')](_0x5085ae);}var _0x24ec9c=_0x527878[_0xedac('0x2d')]['userId'];var _0x41c868=_0x527878[_0xedac('0x2d')]['sessionId'];return getAgent(_0x24ec9c)[_0xedac('0x24')](function(_0x2fa832){logger['info'](_0xedac('0x32'),_0x2fa832['name']);emit(util[_0xedac('0x33')](_0xedac('0x34'),_0x2fa832[_0xedac('0x18')]),_0xedac('0x3a'),{'sessionId':_0x41c868});return _0x1ddcc1[_0xedac('0x1a')](0xc8)[_0xedac('0x36')]({'error':![],'message':'hangup\x20executed!'});})[_0xedac('0x20')](handleError(_0x1ddcc1));};exports[_0xedac('0x3b')]=function(_0x9e998c,_0x114ceb){logger[_0xedac('0x12')](_0xedac('0x3c'),_0x9e998c[_0xedac('0x2d')]);var _0x6a17a9=answerValidation[_0xedac('0x2c')](_0x9e998c[_0xedac('0x2d')]);if(_0x6a17a9[_0xedac('0x27')]>0x0){return _0x114ceb[_0xedac('0x1a')](0x190)[_0xedac('0x36')](_0x6a17a9);}var _0x1418ff=_0x9e998c[_0xedac('0x2d')][_0xedac('0x2e')];var _0x4cbae0=_0x9e998c[_0xedac('0x2d')][_0xedac('0x26')];return getAgent(_0x1418ff)[_0xedac('0x24')](function(_0x4d2de3){logger['info']('entityFound:',_0x4d2de3[_0xedac('0x18')]);emit(util[_0xedac('0x33')]('user:%s',_0x4d2de3[_0xedac('0x18')]),'webbar:answer',{'sessionId':_0x4cbae0});return _0x114ceb[_0xedac('0x1a')](0xc8)['json']({'error':![],'message':_0xedac('0x3d')});})[_0xedac('0x20')](handleError(_0x114ceb));};exports[_0xedac('0x3e')]=function(_0x114b2e,_0x1b4cb4){logger['info']('hold\x20fired:',_0x114b2e[_0xedac('0x2d')]);var _0x51dc40=holdValidation[_0xedac('0x2c')](_0x114b2e[_0xedac('0x2d')]);if(_0x51dc40[_0xedac('0x27')]>0x0){return _0x1b4cb4['status'](0x190)[_0xedac('0x36')](_0x51dc40);}var _0x45189f=_0x114b2e[_0xedac('0x2d')]['userId'];var _0x7ea57c=_0x114b2e[_0xedac('0x2d')][_0xedac('0x26')];return getAgent(_0x45189f)['then'](function(_0x5e6079){logger[_0xedac('0x12')](_0xedac('0x32'),_0x5e6079['name']);emit(util['format'](_0xedac('0x34'),_0x5e6079[_0xedac('0x18')]),'webbar:hold',{'sessionId':_0x7ea57c});return _0x1b4cb4[_0xedac('0x1a')](0xc8)['json']({'error':![],'message':_0xedac('0x3f')});})[_0xedac('0x20')](handleError(_0x1b4cb4));};exports[_0xedac('0x40')]=function(_0x104842,_0x126bd3){logger[_0xedac('0x12')]('unhold\x20fired:',_0x104842[_0xedac('0x2d')]);var _0x3fb534=unholdValidation['validate'](_0x104842[_0xedac('0x2d')]);if(_0x3fb534[_0xedac('0x27')]>0x0){return _0x126bd3[_0xedac('0x1a')](0x190)['json'](_0x3fb534);}var _0x59bc68=_0x104842[_0xedac('0x2d')][_0xedac('0x2e')];var _0x543d7d=_0x104842[_0xedac('0x2d')][_0xedac('0x26')];return getAgent(_0x59bc68)[_0xedac('0x24')](function(_0x59d762){logger[_0xedac('0x12')](_0xedac('0x32'),_0x59d762[_0xedac('0x18')]);emit(util[_0xedac('0x33')]('user:%s',_0x59d762['name']),_0xedac('0x41'),{'sessionId':_0x543d7d});return _0x126bd3[_0xedac('0x1a')](0xc8)[_0xedac('0x36')]({'error':![],'message':'unhold\x20executed!'});})[_0xedac('0x20')](handleError(_0x126bd3));};exports[_0xedac('0x42')]=function(_0x5cb635,_0x4f44e){logger[_0xedac('0x12')]('calls\x20fired:',_0x4f44e['body']);var _0x5ad779=callsValidation[_0xedac('0x2c')](_0x5cb635['body']);if(_0x5ad779[_0xedac('0x27')]>0x0){return _0x4f44e['status'](0x190)['json'](_0x5ad779);}var _0x1d8e29=_0x5cb635[_0xedac('0x2d')][_0xedac('0x2e')];var _0x35b046=respondWithRpcPromise(_0xedac('0x43'));var _0x4af22f=getAgent(_0x1d8e29);return Promise[_0xedac('0x44')]([_0x35b046,_0x4af22f])['then'](function(_0x1ece76){var _0x2e33ed=_0x1ece76[0x0];var _0x2f3df5=_0x1ece76[0x1];var _0x862e0f=_[_0xedac('0x45')](_0x2e33ed[_0xedac('0x46')],function(_0x44b563){return _0x44b563['UserId']==_0x2f3df5['id'];});return _0x4f44e[_0xedac('0x1a')](0xc8)[_0xedac('0x36')]({'count':_0x862e0f[_0xedac('0x27')],'rows':_0x862e0f});})[_0xedac('0x20')](handleError(_0x4f44e));};exports[_0xedac('0x47')]=function(_0x3a7199,_0x3f313a){logger[_0xedac('0x12')](_0xedac('0x48'),_0x3a7199[_0xedac('0x2d')]);var _0x54b88e=conferenceValidation['validate'](_0x3a7199[_0xedac('0x2d')]);if(_0x54b88e[_0xedac('0x27')]>0x0){return _0x3f313a[_0xedac('0x1a')](0x190)[_0xedac('0x36')](_0x54b88e);}var _0x864600=_0x3a7199['body'][_0xedac('0x2e')];return getAgent(_0x864600)['then'](function(_0x8d20e7){logger[_0xedac('0x12')]('entityFound:',_0x8d20e7['name']);emit(util['format'](_0xedac('0x34'),_0x8d20e7[_0xedac('0x18')]),_0xedac('0x49'));return _0x3f313a[_0xedac('0x1a')](0xc8)[_0xedac('0x36')]({'error':![],'message':_0xedac('0x4a')});})[_0xedac('0x20')](handleError(_0x3f313a));};exports[_0xedac('0x4b')]=function(_0x396e89,_0x2f1443){logger['info'](_0xedac('0x4c'),_0x396e89[_0xedac('0x2d')]);var _0x4b1299=transferValidation[_0xedac('0x2c')](_0x396e89[_0xedac('0x2d')]);if(_0x4b1299[_0xedac('0x27')]>0x0){return _0x2f1443[_0xedac('0x1a')](0x190)[_0xedac('0x36')](_0x4b1299);}var _0x122850=_0x396e89[_0xedac('0x2d')][_0xedac('0x2e')];var _0x15997a=_0x396e89[_0xedac('0x2d')][_0xedac('0x26')];var _0x207b40=_0x396e89[_0xedac('0x2d')][_0xedac('0x4d')];return getAgent(_0x122850)[_0xedac('0x24')](function(_0x180be4){logger[_0xedac('0x12')](_0xedac('0x32'),_0x180be4['name']);emit(util[_0xedac('0x33')]('user:%s',_0x180be4[_0xedac('0x18')]),'webbar:transfer',{'sessionId':_0x15997a,'transferNumber':_0x207b40});return _0x2f1443[_0xedac('0x1a')](0xc8)[_0xedac('0x36')]({'error':![],'message':_0xedac('0x4e')});})[_0xedac('0x20')](handleError(_0x2f1443));}; \ No newline at end of file +var _0x6315=['format','user:%s','webbar:originate','json','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','handleError:','error','stack','name','send','status','request','then','code','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:'];(function(_0x375fcf,_0x3c9ed8){var _0x10bfef=function(_0x3434e3){while(--_0x3434e3){_0x375fcf['push'](_0x375fcf['shift']());}};_0x10bfef(++_0x3c9ed8);}(_0x6315,0x65));var _0x5631=function(_0x494d76,_0x10f1e9){_0x494d76=_0x494d76-0x0;var _0x44cefa=_0x6315[_0x494d76];return _0x44cefa;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x5631('0x0'));var db=require(_0x5631('0x1'))['db'];var config=require(_0x5631('0x2'));var util=require(_0x5631('0x3'));var BPromise=require(_0x5631('0x4'));var jayson=require(_0x5631('0x5'));var amiClient=jayson[_0x5631('0x6')][_0x5631('0x7')]({'port':0x232a});var logger=require(_0x5631('0x8'))(_0x5631('0x9'));var Redis=require(_0x5631('0xa'));config['redis']=_[_0x5631('0xb')](config[_0x5631('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x5631('0xd'))(new Redis(config[_0x5631('0xc')]));var Schema=require(_0x5631('0xe'));var originateValidation=new Schema({'userId':{'type':_0x5631('0xf'),'required':[!![],_0x5631('0x10')]},'callNumber':{'type':_0x5631('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5631('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x5631('0xf'),'required':[!![],_0x5631('0x10')]},'sessionId':{'type':_0x5631('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5631('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5631('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5631('0x11'),'required':[!![],_0x5631('0x12')]},'transferNumber':{'type':_0x5631('0x11'),'required':[!![],_0x5631('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x5631('0xf'),'required':[!![],_0x5631('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5631('0xf'),'required':[!![],_0x5631('0x10')]},'sessionId':{'type':_0x5631('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5631('0xf'),'required':[!![],_0x5631('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5631('0xf'),'required':[!![],_0x5631('0x10')]}});function emit(_0x510b5d,_0xa391cb,_0x54ab09){logger[_0x5631('0x14')](_0x510b5d,_0xa391cb,JSON['stringify'](_0x54ab09));io['to'](_0x510b5d)['emit'](_0xa391cb,_0x54ab09);}function handleError(_0x3fe62d){return function(_0x26a279){console['log'](_0x5631('0x15'),_0x26a279,_0x26a279 instanceof RangeError);logger[_0x5631('0x16')](_0x26a279[_0x5631('0x17')]);if(_0x26a279 instanceof RangeError){if(_0x26a279[_0x5631('0x18')]){delete _0x26a279[_0x5631('0x18')];}_0x3fe62d['status'](0x194)[_0x5631('0x19')](_0x26a279);}else{if(_0x26a279[_0x5631('0x18')]){delete _0x26a279[_0x5631('0x18')];}_0x3fe62d[_0x5631('0x1a')](0x1f4)[_0x5631('0x19')](_0x26a279);}};}function checkError(){return function(_0x1153d6){if(!_0x1153d6){throw new RangeError('NotFound');}return _0x1153d6;};}function respondWithRpcPromise(_0x1bc80b,_0x14a011){return new BPromise(function(_0x112ad5,_0x1b1c7a){var _0x176c14=amiClient;return _0x176c14[_0x5631('0x1b')](_0x1bc80b,_0x14a011)[_0x5631('0x1c')](function(_0x257a1a){if(_0x257a1a[_0x5631('0x16')]){if(_0x257a1a[_0x5631('0x16')][_0x5631('0x1d')]===0x1f4){return _0x1b1c7a(_0x257a1a[_0x5631('0x16')]['message']);}return _0x112ad5(_0x257a1a[_0x5631('0x16')]['message']);}else{_0x112ad5(_0x257a1a['result']);}})[_0x5631('0x1e')](function(_0x5dd1c1){_0x1b1c7a(_0x5dd1c1);});});}function getAgent(_0x50f9b7){return db[_0x5631('0x1f')][_0x5631('0x20')]({'where':{'id':_0x50f9b7,'role':_0x5631('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x27f456,_0x2907f3){return new BPromise(function(_0x6a53f3,_0xff9ad5){var _0x52bb38=respondWithRpcPromise(_0x5631('0x22'));var _0x11d514=getAgent(_0x27f456);Promise[_0x5631('0x23')]([_0x52bb38,_0x11d514])['then'](function(_0x473234){var _0x41a4b0=_0x473234[0x0];var _0x96f5af=_0x473234[0x1];var _0x36e208=_[_0x5631('0x24')](_0x41a4b0[_0x5631('0x25')],function(_0x448367){return _0x448367['UserId']==_0x96f5af['id']&&_0x448367[_0x5631('0x26')]==_0x2907f3;});if(_0x36e208[_0x5631('0x27')]==0x1){_0x6a53f3(_0x96f5af);}else{_0xff9ad5(new RangeError(_0x5631('0x28')+_0x2907f3+_0x5631('0x29')));}});});}exports[_0x5631('0x2a')]=function(_0x198eda,_0x24317b){logger['info'](_0x5631('0x2b'),_0x198eda[_0x5631('0x2c')]);var _0x4e3bbd=originateValidation[_0x5631('0xe')](_0x198eda['body']);if(_0x4e3bbd[_0x5631('0x27')]>0x0){return _0x24317b[_0x5631('0x1a')](0x190)['json'](_0x4e3bbd);}var _0x3b3893=_0x198eda[_0x5631('0x2c')][_0x5631('0x2d')];var _0x10d872=_0x198eda[_0x5631('0x2c')][_0x5631('0x2e')];var _0x37aa41=_0x198eda[_0x5631('0x2c')]['callerId'];var _0x105e73=_0x198eda[_0x5631('0x2c')][_0x5631('0x2f')];return getAgent(_0x3b3893)[_0x5631('0x1c')](function(_0x55e455){logger[_0x5631('0x14')](_0x5631('0x30'),_0x55e455[_0x5631('0x18')]);emit(util[_0x5631('0x31')](_0x5631('0x32'),_0x55e455[_0x5631('0x18')]),_0x5631('0x33'),{'callNumber':_0x10d872,'callerId':_0x37aa41,'callbackUrl':_0x105e73});return _0x24317b['status'](0xc8)[_0x5631('0x34')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x24317b));};exports[_0x5631('0x35')]=function(_0x115d04,_0x14288b){logger['info'](_0x5631('0x36'),_0x115d04[_0x5631('0x2c')]);var _0x5738c0=hangupValidation[_0x5631('0xe')](_0x115d04[_0x5631('0x2c')]);if(_0x5738c0['length']>0x0){return _0x14288b['status'](0x190)[_0x5631('0x34')](_0x5738c0);}var _0x4a6213=_0x115d04[_0x5631('0x2c')][_0x5631('0x2d')];var _0x4b9e68=_0x115d04[_0x5631('0x2c')]['sessionId'];return getAgent(_0x4a6213)[_0x5631('0x1c')](function(_0x3fd5e2){logger[_0x5631('0x14')](_0x5631('0x30'),_0x3fd5e2['name']);emit(util[_0x5631('0x31')]('user:%s',_0x3fd5e2[_0x5631('0x18')]),_0x5631('0x37'),{'sessionId':_0x4b9e68});return _0x14288b['status'](0xc8)[_0x5631('0x34')]({'error':![],'message':_0x5631('0x38')});})[_0x5631('0x1e')](handleError(_0x14288b));};exports[_0x5631('0x39')]=function(_0x3f26d1,_0x322195){logger['info'](_0x5631('0x3a'),_0x3f26d1['body']);var _0x182619=answerValidation[_0x5631('0xe')](_0x3f26d1[_0x5631('0x2c')]);if(_0x182619['length']>0x0){return _0x322195['status'](0x190)['json'](_0x182619);}var _0x4ff5ba=_0x3f26d1[_0x5631('0x2c')][_0x5631('0x2d')];var _0x5a6633=_0x3f26d1['body'][_0x5631('0x26')];return getAgent(_0x4ff5ba)['then'](function(_0x1493a0){logger['info'](_0x5631('0x30'),_0x1493a0[_0x5631('0x18')]);emit(util['format'](_0x5631('0x32'),_0x1493a0[_0x5631('0x18')]),_0x5631('0x3b'),{'sessionId':_0x5a6633});return _0x322195[_0x5631('0x1a')](0xc8)[_0x5631('0x34')]({'error':![],'message':_0x5631('0x3c')});})['catch'](handleError(_0x322195));};exports[_0x5631('0x3d')]=function(_0xfb7ad6,_0x2992eb){logger[_0x5631('0x14')](_0x5631('0x3e'),_0xfb7ad6[_0x5631('0x2c')]);var _0x42b193=holdValidation['validate'](_0xfb7ad6[_0x5631('0x2c')]);if(_0x42b193['length']>0x0){return _0x2992eb[_0x5631('0x1a')](0x190)[_0x5631('0x34')](_0x42b193);}var _0x29ea4b=_0xfb7ad6[_0x5631('0x2c')][_0x5631('0x2d')];var _0x2c0d39=_0xfb7ad6[_0x5631('0x2c')][_0x5631('0x26')];return getAgent(_0x29ea4b)[_0x5631('0x1c')](function(_0x55db8e){logger[_0x5631('0x14')](_0x5631('0x30'),_0x55db8e[_0x5631('0x18')]);emit(util['format'](_0x5631('0x32'),_0x55db8e['name']),_0x5631('0x3f'),{'sessionId':_0x2c0d39});return _0x2992eb[_0x5631('0x1a')](0xc8)[_0x5631('0x34')]({'error':![],'message':'hold\x20executed!'});})[_0x5631('0x1e')](handleError(_0x2992eb));};exports['unhold']=function(_0x4e1b4f,_0x5c126d){logger[_0x5631('0x14')](_0x5631('0x40'),_0x4e1b4f[_0x5631('0x2c')]);var _0x1f5c73=unholdValidation[_0x5631('0xe')](_0x4e1b4f[_0x5631('0x2c')]);if(_0x1f5c73[_0x5631('0x27')]>0x0){return _0x5c126d[_0x5631('0x1a')](0x190)[_0x5631('0x34')](_0x1f5c73);}var _0x15e59a=_0x4e1b4f['body'][_0x5631('0x2d')];var _0x1e277e=_0x4e1b4f[_0x5631('0x2c')][_0x5631('0x26')];return getAgent(_0x15e59a)[_0x5631('0x1c')](function(_0x3e045c){logger[_0x5631('0x14')](_0x5631('0x30'),_0x3e045c[_0x5631('0x18')]);emit(util['format'](_0x5631('0x32'),_0x3e045c[_0x5631('0x18')]),'webbar:unhold',{'sessionId':_0x1e277e});return _0x5c126d[_0x5631('0x1a')](0xc8)[_0x5631('0x34')]({'error':![],'message':_0x5631('0x41')});})[_0x5631('0x1e')](handleError(_0x5c126d));};exports['calls']=function(_0x10c77f,_0x29bcac){logger[_0x5631('0x14')](_0x5631('0x42'),_0x29bcac[_0x5631('0x2c')]);var _0x17c6b3=callsValidation[_0x5631('0xe')](_0x10c77f[_0x5631('0x2c')]);if(_0x17c6b3[_0x5631('0x27')]>0x0){return _0x29bcac[_0x5631('0x1a')](0x190)[_0x5631('0x34')](_0x17c6b3);}var _0x426732=_0x10c77f[_0x5631('0x2c')][_0x5631('0x2d')];var _0x4afbf5=respondWithRpcPromise(_0x5631('0x22'));var _0x2c548d=getAgent(_0x426732);return Promise[_0x5631('0x23')]([_0x4afbf5,_0x2c548d])[_0x5631('0x1c')](function(_0x1ea6a2){var _0x551a0f=_0x1ea6a2[0x0];var _0x317747=_0x1ea6a2[0x1];var _0x1bfff8=_[_0x5631('0x24')](_0x551a0f[_0x5631('0x25')],function(_0x1c1764){return _0x1c1764[_0x5631('0x43')]==_0x317747['id'];});return _0x29bcac[_0x5631('0x1a')](0xc8)[_0x5631('0x34')]({'count':_0x1bfff8[_0x5631('0x27')],'rows':_0x1bfff8});})[_0x5631('0x1e')](handleError(_0x29bcac));};exports[_0x5631('0x44')]=function(_0x486256,_0x338159){logger[_0x5631('0x14')](_0x5631('0x45'),_0x486256[_0x5631('0x2c')]);var _0x1ce1c4=conferenceValidation[_0x5631('0xe')](_0x486256[_0x5631('0x2c')]);if(_0x1ce1c4[_0x5631('0x27')]>0x0){return _0x338159[_0x5631('0x1a')](0x190)[_0x5631('0x34')](_0x1ce1c4);}var _0x4cf4d9=_0x486256[_0x5631('0x2c')][_0x5631('0x2d')];return getAgent(_0x4cf4d9)[_0x5631('0x1c')](function(_0x2ab615){logger[_0x5631('0x14')]('entityFound:',_0x2ab615[_0x5631('0x18')]);emit(util[_0x5631('0x31')]('user:%s',_0x2ab615['name']),'webbar:conference');return _0x338159[_0x5631('0x1a')](0xc8)[_0x5631('0x34')]({'error':![],'message':_0x5631('0x46')});})[_0x5631('0x1e')](handleError(_0x338159));};exports[_0x5631('0x47')]=function(_0x391213,_0x12a7b6){logger[_0x5631('0x14')]('transfer\x20fired:',_0x391213[_0x5631('0x2c')]);var _0xdfaed2=transferValidation[_0x5631('0xe')](_0x391213['body']);if(_0xdfaed2['length']>0x0){return _0x12a7b6[_0x5631('0x1a')](0x190)['json'](_0xdfaed2);}var _0x38ce72=_0x391213[_0x5631('0x2c')][_0x5631('0x2d')];var _0x526a99=_0x391213[_0x5631('0x2c')][_0x5631('0x26')];var _0xc92573=_0x391213[_0x5631('0x2c')][_0x5631('0x48')];return getAgent(_0x38ce72)[_0x5631('0x1c')](function(_0x1da041){logger['info'](_0x5631('0x30'),_0x1da041[_0x5631('0x18')]);emit(util[_0x5631('0x31')](_0x5631('0x32'),_0x1da041[_0x5631('0x18')]),_0x5631('0x49'),{'sessionId':_0x526a99,'transferNumber':_0xc92573});return _0x12a7b6[_0x5631('0x1a')](0xc8)[_0x5631('0x34')]({'error':![],'message':_0x5631('0x4a')});})[_0x5631('0x1e')](handleError(_0x12a7b6));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3e4b87a..0bd8cf5 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 _0xdf49=['notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','/:id/users','addAgents','addApplications','/:id/notify'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xdf49,0x13c));var _0x9df4=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0xdf49[_0x51ab83];return _0x14b6de;};'use strict';var multer=require(_0x9df4('0x0'));var util=require(_0x9df4('0x1'));var path=require(_0x9df4('0x2'));var timeout=require('connect-timeout');var express=require(_0x9df4('0x3'));var router=express[_0x9df4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9df4('0x5'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x9df4('0x6')]('/',auth[_0x9df4('0x7')](),controller['index']);router[_0x9df4('0x6')](_0x9df4('0x8'),auth[_0x9df4('0x7')](),controller[_0x9df4('0x9')]);router[_0x9df4('0x6')]('/:id',auth[_0x9df4('0x7')](),controller[_0x9df4('0xa')]);router[_0x9df4('0x6')](_0x9df4('0xb'),auth[_0x9df4('0x7')](),controller[_0x9df4('0xc')]);router['get'](_0x9df4('0xd'),auth[_0x9df4('0x7')](),controller[_0x9df4('0xe')]);router['get']('/:id/users',auth[_0x9df4('0x7')](),controller[_0x9df4('0xf')]);router[_0x9df4('0x6')](_0x9df4('0x10'),auth['isAuthenticated'](),controller[_0x9df4('0x11')]);router[_0x9df4('0x12')]('/',auth[_0x9df4('0x7')](),controller[_0x9df4('0x13')]);router['post'](_0x9df4('0xb'),auth[_0x9df4('0x7')](),controller['addDisposition']);router[_0x9df4('0x12')]('/:id/canned_answers',auth[_0x9df4('0x7')](),controller['addAnswer']);router[_0x9df4('0x12')](_0x9df4('0x14'),auth['isAuthenticated'](),controller[_0x9df4('0x15')]);router[_0x9df4('0x12')](_0x9df4('0x10'),auth['isAuthenticated'](),controller[_0x9df4('0x16')]);router[_0x9df4('0x12')](_0x9df4('0x17'),controller[_0x9df4('0x18')]);router[_0x9df4('0x12')](_0x9df4('0x19'),auth['isAuthenticated'](),controller[_0x9df4('0x1a')]);router[_0x9df4('0x1b')](_0x9df4('0x1c'),auth['isAuthenticated'](),controller[_0x9df4('0x1d')]);router[_0x9df4('0x1e')]('/:id',auth[_0x9df4('0x7')](),controller[_0x9df4('0x1f')]);router[_0x9df4('0x1e')](_0x9df4('0xb'),auth['isAuthenticated'](),controller[_0x9df4('0x20')]);router[_0x9df4('0x1e')](_0x9df4('0xd'),auth[_0x9df4('0x7')](),controller['removeAnswers']);router[_0x9df4('0x1e')]('/:id/users',auth[_0x9df4('0x7')](),controller[_0x9df4('0x21')]);module['exports']=router; \ No newline at end of file +var _0x3303=['removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy'];(function(_0x5960cd,_0x3bb2a1){var _0x472f93=function(_0xf44d6b){while(--_0xf44d6b){_0x5960cd['push'](_0x5960cd['shift']());}};_0x472f93(++_0x3bb2a1);}(_0x3303,0x8a));var _0x3330=function(_0x4811b2,_0x1296a4){_0x4811b2=_0x4811b2-0x0;var _0x703bc3=_0x3303[_0x4811b2];return _0x703bc3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3330('0x0'));var timeout=require(_0x3330('0x1'));var express=require(_0x3330('0x2'));var router=express[_0x3330('0x3')]();var auth=require(_0x3330('0x4'));var interaction=require(_0x3330('0x5'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x3330('0x6')]('/',auth[_0x3330('0x7')](),controller[_0x3330('0x8')]);router[_0x3330('0x6')](_0x3330('0x9'),auth[_0x3330('0x7')](),controller[_0x3330('0xa')]);router[_0x3330('0x6')](_0x3330('0xb'),auth[_0x3330('0x7')](),controller[_0x3330('0xc')]);router['get'](_0x3330('0xd'),auth[_0x3330('0x7')](),controller[_0x3330('0xe')]);router['get'](_0x3330('0xf'),auth[_0x3330('0x7')](),controller['getAnswers']);router['get'](_0x3330('0x10'),auth[_0x3330('0x7')](),controller['getAgents']);router[_0x3330('0x6')]('/:id/applications',auth[_0x3330('0x7')](),controller[_0x3330('0x11')]);router[_0x3330('0x12')]('/',auth['isAuthenticated'](),controller[_0x3330('0x13')]);router['post'](_0x3330('0xd'),auth[_0x3330('0x7')](),controller[_0x3330('0x14')]);router[_0x3330('0x12')](_0x3330('0xf'),auth['isAuthenticated'](),controller[_0x3330('0x15')]);router[_0x3330('0x12')](_0x3330('0x10'),auth[_0x3330('0x7')](),controller[_0x3330('0x16')]);router[_0x3330('0x12')](_0x3330('0x17'),auth['isAuthenticated'](),controller[_0x3330('0x18')]);router[_0x3330('0x12')](_0x3330('0x19'),controller[_0x3330('0x1a')]);router['post'](_0x3330('0x1b'),auth[_0x3330('0x7')](),controller['send']);router[_0x3330('0x1c')](_0x3330('0xb'),auth[_0x3330('0x7')](),controller[_0x3330('0x1d')]);router[_0x3330('0x1e')]('/:id',auth[_0x3330('0x7')](),controller[_0x3330('0x1f')]);router[_0x3330('0x1e')](_0x3330('0xd'),auth[_0x3330('0x7')](),controller['removeDispositions']);router[_0x3330('0x1e')](_0x3330('0xf'),auth[_0x3330('0x7')](),controller['removeAnswers']);router[_0x3330('0x1e')](_0x3330('0x10'),auth['isAuthenticated'](),controller[_0x3330('0x20')]);module[_0x3330('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 85fb1bc..c88751e 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 _0xea33=['ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate'];(function(_0x3d5cfa,_0x768461){var _0x23e598=function(_0x2e0e10){while(--_0x2e0e10){_0x3d5cfa['push'](_0x3d5cfa['shift']());}};_0x23e598(++_0x768461);}(_0xea33,0x19e));var _0x3ea3=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xea33[_0xd0a847];return _0x2536ec;};'use strict';var Sequelize=require(_0x3ea3('0x0'));var rs=require(_0x3ea3('0x1'));module[_0x3ea3('0x2')]={'name':{'type':Sequelize[_0x3ea3('0x3')],'unique':_0x3ea3('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3ea3('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3ea3('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3ea3('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3ea3('0x6')](_0x3ea3('0x7'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3ea3('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3ea3('0x8');}},'notificationSound':{'type':Sequelize[_0x3ea3('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3ea3('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3ea3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3ea3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3ea3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3ea3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x3ea3('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x3ea3('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xd31729){if(!_0xd31729){this[_0x3ea3('0xc')](_0x3ea3('0xd'),null);}this[_0x3ea3('0xc')](_0x3ea3('0xe'),_0xd31729);}},'description':{'type':Sequelize[_0x3ea3('0x3')]}}; \ No newline at end of file +var _0xe346=['twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate'];(function(_0x4784a8,_0x33480a){var _0x295886=function(_0x1d6d41){while(--_0x1d6d41){_0x4784a8['push'](_0x4784a8['shift']());}};_0x295886(++_0x33480a);}(_0xe346,0x13f));var _0x6e34=function(_0xdb09a8,_0x471a1c){_0xdb09a8=_0xdb09a8-0x0;var _0x40c1ad=_0xe346[_0xdb09a8];return _0x40c1ad;};'use strict';var Sequelize=require(_0x6e34('0x0'));var rs=require(_0x6e34('0x1'));module[_0x6e34('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x6e34('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6e34('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x6e34('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x6e34('0x4')],'defaultValue':function(){return rs[_0x6e34('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x6e34('0x6'))},'accountSid':{'type':Sequelize[_0x6e34('0x4')]},'authToken':{'type':Sequelize[_0x6e34('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6e34('0x7');}},'notificationSound':{'type':Sequelize[_0x6e34('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e34('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e34('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e34('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e34('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e34('0x9')],'comment':_0x6e34('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2750f2){if(!_0x2750f2){this[_0x6e34('0xb')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x6e34('0xc'),_0x2750f2);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index f8fb9ef..f385d6f 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(_0x1010c1,_0x51c95e){var _0x4283f8=function(_0xc94da2){while(--_0xc94da2){_0x1010c1['push'](_0x1010c1['shift']());}};_0x4283f8(++_0x51c95e);}(_0x593e,0xcb));var _0xe593=function(_0x20cc7a,_0x5b9b0f){_0x20cc7a=_0x20cc7a-0x0;var _0x227a63=_0x593e[_0x20cc7a];return _0x227a63;};'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 _0x9354=['then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','status','json','count','offset','Content-Range','reject','update','WhatsappAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','whatsapp','Applications','account','applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','messageId','MessageSid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','autoclose','push','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','send','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x82775c,_0x103c6e){var _0x36c571=function(_0x5e240f){while(--_0x5e240f){_0x82775c['push'](_0x82775c['shift']());}};_0x36c571(++_0x103c6e);}(_0x9354,0x96));var _0x4935=function(_0x4aa4af,_0x210cde){_0x4aa4af=_0x4aa4af-0x0;var _0x3bf44a=_0x9354[_0x4aa4af];return _0x3bf44a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4935('0x0'));var rimraf=require(_0x4935('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4935('0x2'));var rp=require(_0x4935('0x3'));var moment=require(_0x4935('0x4'));var BPromise=require(_0x4935('0x5'));var Mustache=require('mustache');var util=require(_0x4935('0x6'));var path=require(_0x4935('0x7'));var sox=require(_0x4935('0x8'));var csv=require(_0x4935('0x9'));var ejs=require(_0x4935('0xa'));var fs=require('fs');var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x9'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4935('0x16')]=_[_0x4935('0x17')](config[_0x4935('0x16')],{'host':_0x4935('0x18'),'port':0x18eb});var socket=require(_0x4935('0x19'))(new Redis(config[_0x4935('0x16')]));require(_0x4935('0x1a'))[_0x4935('0x1b')](socket);var jayson=require(_0x4935('0x1c'));var client=jayson[_0x4935('0x1d')][_0x4935('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x1799e4,_0xa41961,_0x3652c4){if(_0x3652c4){var _0x24cc99=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24cc99[_0x4935('0x1f')](_0xa41961)){return _0x1799e4;}else{throw new db['Sequelize'][(_0x4935('0x20'))](_0x4935('0x21'));}}else{return _0x1799e4;}}function respondWithRpcPromise(_0x165ed3,_0x123300,_0x1f0e81,_0x429ef3){return new BPromise(function(_0x4ebc63,_0xd70eff){var _0x145277=_0x429ef3||client;return _0x145277['request'](_0x165ed3,_0x1f0e81)[_0x4935('0x22')](function(_0x10407f){logger[_0x4935('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x123300,'request\x20sent');logger[_0x4935('0x24')](_0x4935('0x25'),_0x123300,_0x4935('0x26'),JSON[_0x4935('0x27')](_0x10407f));if(_0x10407f[_0x4935('0x28')]){if(_0x10407f[_0x4935('0x28')][_0x4935('0x29')]===0x1f4){logger[_0x4935('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x123300,_0x10407f[_0x4935('0x28')][_0x4935('0x2a')]);return _0xd70eff(_0x10407f[_0x4935('0x28')][_0x4935('0x2a')]);}logger[_0x4935('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x123300,_0x10407f['error'][_0x4935('0x2a')]);return _0x4ebc63(_0x10407f[_0x4935('0x28')][_0x4935('0x2a')]);}else{logger[_0x4935('0x23')](_0x4935('0x2b'),_0x123300,_0x4935('0x26'));_0x4ebc63(_0x10407f[_0x4935('0x2c')][_0x4935('0x2a')]);}})[_0x4935('0x2d')](function(_0xf4abb2){logger[_0x4935('0x28')](_0x4935('0x2b'),_0x123300,_0xf4abb2);_0xd70eff(_0xf4abb2);});});}function respondWithStatusCode(_0x2c47ab,_0xbb00d6){_0xbb00d6=_0xbb00d6||0xcc;return function(_0x359522){if(_0x359522){return _0x2c47ab['sendStatus'](_0xbb00d6);}return _0x2c47ab['status'](_0xbb00d6)['end']();};}function respondWithResult(_0x1fc218,_0x76ea7d){_0x76ea7d=_0x76ea7d||0xc8;return function(_0x4f1163){if(_0x4f1163){return _0x1fc218[_0x4935('0x2e')](_0x76ea7d)[_0x4935('0x2f')](_0x4f1163);}};}function respondWithFilteredResult(_0x24a3b6,_0x9fe9f6){return function(_0x1198e5){if(_0x1198e5){var _0x24262e=_0x1198e5[_0x4935('0x30')],_0x28afc2=_0x9fe9f6[_0x4935('0x31')],_0x2fe6da=_0x9fe9f6['offset']+_0x9fe9f6['limit'],_0x5b3c8e;if(_0x2fe6da>=_0x24262e){_0x2fe6da=_0x24262e;_0x5b3c8e=0xc8;}else{_0x5b3c8e=0xce;}_0x24a3b6[_0x4935('0x2e')](_0x5b3c8e);return _0x24a3b6['set'](_0x4935('0x32'),_0x28afc2+'-'+_0x2fe6da+'/'+_0x24262e)[_0x4935('0x2f')](_0x1198e5);}return null;};}function patchUpdates(_0x30fbc9){return function(_0x53722a){try{jsonpatch['apply'](_0x53722a,_0x30fbc9,!![]);}catch(_0x415260){return BPromise[_0x4935('0x33')](_0x415260);}return _0x53722a['save']();};}function saveUpdates(_0x47003b,_0x3260d2){return function(_0x9bfd48){if(_0x9bfd48){return _0x9bfd48[_0x4935('0x34')](_0x47003b)[_0x4935('0x22')](function(_0x4a69bc){return _0x4a69bc;});}return null;};}function removeEntity(_0x4b5c01,_0x3d8795){return function(_0x1016cc){if(_0x1016cc){return _0x1016cc['destroy']()['then'](function(){var _0xb3d934=_0x1016cc['get']({'plain':!![]});var _0x7b45d1=_0x4935('0x35');return db[_0x4935('0x36')][_0x4935('0x37')]({'where':{'type':_0x7b45d1,'resourceId':_0xb3d934['id']}})[_0x4935('0x22')](function(){return _0x1016cc;});})[_0x4935('0x22')](function(){_0x4b5c01['status'](0xcc)[_0x4935('0x38')]();});}};}function handleEntityNotFound(_0x51b7ac,_0x365e83){return function(_0x5db44b){if(!_0x5db44b){_0x51b7ac[_0x4935('0x39')](0x194);}return _0x5db44b;};}function handleError(_0x4c5a4e,_0x27ead0){_0x27ead0=_0x27ead0||0x1f4;return function(_0x59b749){logger[_0x4935('0x28')](_0x59b749[_0x4935('0x3a')]);if(_0x59b749[_0x4935('0x3b')]){delete _0x59b749[_0x4935('0x3b')];}_0x4c5a4e[_0x4935('0x2e')](_0x27ead0)['send'](_0x59b749);};}exports['index']=function(_0x2efc45,_0x4e4820){var _0x4e8b2e={'include':[{'model':db[_0x4935('0x3c')],'as':_0x4935('0x3d')}]},_0x1552b2={},_0x5c8012={'count':0x0,'rows':[]};var _0x2d67e3=_[_0x4935('0x3e')](db[_0x4935('0x3f')]['rawAttributes'],function(_0x5d4d7f){return{'name':_0x5d4d7f[_0x4935('0x40')],'type':_0x5d4d7f[_0x4935('0x41')][_0x4935('0x42')]};});_0x1552b2[_0x4935('0x43')]=_[_0x4935('0x3e')](_0x2d67e3,_0x4935('0x3b'));_0x1552b2[_0x4935('0x44')]=_[_0x4935('0x45')](_0x2efc45['query']);_0x1552b2['filters']=_[_0x4935('0x46')](_0x1552b2[_0x4935('0x43')],_0x1552b2['query']);_0x4e8b2e[_0x4935('0x47')]=_[_0x4935('0x46')](_0x1552b2[_0x4935('0x43')],qs[_0x4935('0x48')](_0x2efc45['query']['fields']));_0x4e8b2e[_0x4935('0x47')]=_0x4e8b2e[_0x4935('0x47')]['length']?_0x4e8b2e[_0x4935('0x47')]:_0x1552b2[_0x4935('0x43')];if(!_0x2efc45[_0x4935('0x44')]['hasOwnProperty'](_0x4935('0x49'))){_0x4e8b2e[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x2efc45[_0x4935('0x44')][_0x4935('0x4a')]);_0x4e8b2e[_0x4935('0x31')]=qs[_0x4935('0x31')](_0x2efc45[_0x4935('0x44')][_0x4935('0x31')]);}_0x4e8b2e[_0x4935('0x4b')]=qs[_0x4935('0x4c')](_0x2efc45[_0x4935('0x44')][_0x4935('0x4c')]);_0x4e8b2e[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x2efc45[_0x4935('0x44')],_0x1552b2[_0x4935('0x4e')]),_0x2d67e3);if(_0x2efc45['query'][_0x4935('0x50')]){_0x4e8b2e['where']=_[_0x4935('0x51')](_0x4e8b2e[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0x2d67e3,function(_0x33e94a){if(_0x33e94a['type']!==_0x4935('0x52')){var _0x9c8bad={};_0x9c8bad[_0x33e94a[_0x4935('0x3b')]]={'$like':'%'+_0x2efc45[_0x4935('0x44')][_0x4935('0x50')]+'%'};return _0x9c8bad;}})});}_0x4e8b2e=_[_0x4935('0x51')]({},_0x4e8b2e,_0x2efc45[_0x4935('0x53')]);var _0x31d137={'where':_0x4e8b2e[_0x4935('0x4d')]};return db[_0x4935('0x3f')]['count'](_0x31d137)[_0x4935('0x22')](function(_0x1c3d9c){_0x5c8012['count']=_0x1c3d9c;if(_0x2efc45[_0x4935('0x44')][_0x4935('0x54')]){_0x4e8b2e[_0x4935('0x55')]=[{'all':!![]}];}return db[_0x4935('0x3f')][_0x4935('0x56')](_0x4e8b2e);})[_0x4935('0x22')](function(_0x289c5e){_0x5c8012[_0x4935('0x57')]=_0x289c5e;return _0x5c8012;})['then'](respondWithFilteredResult(_0x4e4820,_0x4e8b2e))[_0x4935('0x2d')](handleError(_0x4e4820,null));};exports['show']=function(_0x561fa3,_0x15ce51){var _0x189071={'raw':![],'where':{'id':_0x561fa3[_0x4935('0x58')]['id']},'include':[{'model':db[_0x4935('0x3c')],'as':'mandatoryDispositionPause'}]},_0x41c6d0={};_0x41c6d0[_0x4935('0x43')]=_[_0x4935('0x45')](db[_0x4935('0x3f')][_0x4935('0x59')]);_0x41c6d0[_0x4935('0x44')]=_[_0x4935('0x45')](_0x561fa3[_0x4935('0x44')]);_0x41c6d0[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x41c6d0[_0x4935('0x43')],_0x41c6d0['query']);_0x189071[_0x4935('0x47')]=_['intersection'](_0x41c6d0[_0x4935('0x43')],qs[_0x4935('0x48')](_0x561fa3['query'][_0x4935('0x48')]));_0x189071['attributes']=_0x189071['attributes']['length']?_0x189071[_0x4935('0x47')]:_0x41c6d0[_0x4935('0x43')];if(_0x561fa3[_0x4935('0x44')][_0x4935('0x54')]){_0x189071[_0x4935('0x55')]=[{'all':!![]}];}_0x189071=_['merge']({},_0x189071,_0x561fa3['options']);return db[_0x4935('0x3f')][_0x4935('0x5a')](_0x189071)[_0x4935('0x22')](handleEntityNotFound(_0x15ce51,null))['then'](respondWithResult(_0x15ce51,null))[_0x4935('0x2d')](handleError(_0x15ce51,null));};exports[_0x4935('0x5b')]=function(_0x24141a,_0xc92288){return db['WhatsappAccount'][_0x4935('0x5b')](_0x24141a['body'],{})['then'](function(_0x513b0e){var _0x24d870=_0x24141a[_0x4935('0x5c')]['get']({'plain':!![]});if(!_0x24d870)throw new Error(_0x4935('0x5d'));if(_0x24d870[_0x4935('0x5e')]==='user'){var _0x114a96=_0x513b0e[_0x4935('0x5f')]({'plain':!![]});var _0x3551b6=_0x4935('0x35');return db[_0x4935('0x60')][_0x4935('0x5a')]({'where':{'name':_0x3551b6,'userProfileId':_0x24d870[_0x4935('0x61')]},'raw':!![]})['then'](function(_0x31b426){if(_0x31b426&&_0x31b426['autoAssociation']===0x0){return db['UserProfileResource'][_0x4935('0x5b')]({'name':_0x114a96[_0x4935('0x3b')],'resourceId':_0x114a96['id'],'type':_0x31b426['name'],'sectionId':_0x31b426['id']},{})['then'](function(){return _0x513b0e;});}else{return _0x513b0e;}})[_0x4935('0x2d')](function(_0x24841d){logger[_0x4935('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24841d);throw _0x24841d;});}return _0x513b0e;})[_0x4935('0x22')](respondWithResult(_0xc92288,0xc9))['catch'](handleError(_0xc92288,null));};exports[_0x4935('0x34')]=function(_0x3d2005,_0x10b18b){if(_0x3d2005[_0x4935('0x62')]['id']){delete _0x3d2005[_0x4935('0x62')]['id'];}return db['WhatsappAccount'][_0x4935('0x5a')]({'where':{'id':_0x3d2005[_0x4935('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x4935('0x3d')}]})[_0x4935('0x22')](handleEntityNotFound(_0x10b18b,null))[_0x4935('0x22')](saveUpdates(_0x3d2005[_0x4935('0x62')],null))[_0x4935('0x22')](respondWithResult(_0x10b18b,null))[_0x4935('0x2d')](handleError(_0x10b18b,null));};exports[_0x4935('0x37')]=function(_0x3e8b18,_0x15ebcc){return db[_0x4935('0x3f')][_0x4935('0x5a')]({'where':{'id':_0x3e8b18['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x15ebcc,null))[_0x4935('0x22')](removeEntity(_0x15ebcc,null))[_0x4935('0x2d')](handleError(_0x15ebcc,null));};exports[_0x4935('0x63')]=function(_0x45c56c,_0x95da52){return db[_0x4935('0x3f')][_0x4935('0x63')]()[_0x4935('0x22')](respondWithResult(_0x95da52,null))[_0x4935('0x2d')](handleError(_0x95da52,null));};exports[_0x4935('0x64')]=function(_0x225a1a,_0x3a427c,_0x4824fd){if(_0x225a1a['body']['id']){delete _0x225a1a[_0x4935('0x62')]['id'];}return db[_0x4935('0x3f')]['find']({'where':{'id':_0x225a1a[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x3a427c,null))['then'](function(_0x4c5cdc){if(_0x4c5cdc){_0x225a1a[_0x4935('0x62')][_0x4935('0x65')]=_0x4c5cdc['id'];return db[_0x4935('0x66')][_0x4935('0x5b')](_0x225a1a[_0x4935('0x62')]);}})['then'](respondWithResult(_0x3a427c,null))[_0x4935('0x2d')](handleError(_0x3a427c,null));};exports[_0x4935('0x67')]=function(_0x26bbe,_0x15232f,_0x583964){var _0xd97c04={'raw':![],'where':{}};var _0x4c235f={};var _0x54be3b={'count':0x0,'rows':[]};return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x26bbe['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x15232f,null))[_0x4935('0x22')](function(_0xfa309e){if(_0xfa309e){_0x4c235f['model']=_[_0x4935('0x45')](db['Disposition']['rawAttributes']);_0x4c235f[_0x4935('0x44')]=_[_0x4935('0x45')](_0x26bbe[_0x4935('0x44')]);_0x4c235f[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x4c235f[_0x4935('0x43')],_0x4c235f[_0x4935('0x44')]);_0xd97c04[_0x4935('0x47')]=_['intersection'](_0x4c235f[_0x4935('0x43')],qs[_0x4935('0x48')](_0x26bbe[_0x4935('0x44')]['fields']));_0xd97c04['attributes']=_0xd97c04[_0x4935('0x47')][_0x4935('0x69')]?_0xd97c04['attributes']:_0x4c235f[_0x4935('0x43')];if(!_0x26bbe['query']['hasOwnProperty'](_0x4935('0x49'))){_0xd97c04[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x26bbe['query']['limit']);_0xd97c04[_0x4935('0x31')]=qs['offset'](_0x26bbe[_0x4935('0x44')]['offset']);}_0xd97c04[_0x4935('0x4b')]=qs[_0x4935('0x4c')](_0x26bbe[_0x4935('0x44')][_0x4935('0x4c')]);_0xd97c04[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x26bbe['query'],_0x4c235f[_0x4935('0x4e')]));_0xd97c04['where'][_0x4935('0x65')]=_0xfa309e['id'];if(_0x26bbe[_0x4935('0x44')]['filter']){_0xd97c04[_0x4935('0x4d')]=_['merge'](_0xd97c04[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0xd97c04['attributes'],function(_0x582a2c){var _0x530e9f={};_0x530e9f[_0x582a2c]={'$like':'%'+_0x26bbe[_0x4935('0x44')]['filter']+'%'};return _0x530e9f;})});}_0xd97c04=_['merge']({},_0xd97c04,_0x26bbe[_0x4935('0x53')]);return db['Disposition'][_0x4935('0x30')]({'where':_0xd97c04['where']})['then'](function(_0x5c5978){_0x54be3b[_0x4935('0x30')]=_0x5c5978;if(_0x26bbe['query'][_0x4935('0x54')]){_0xd97c04[_0x4935('0x55')]=[{'all':!![]}];}return db[_0x4935('0x66')][_0x4935('0x56')](_0xd97c04);})[_0x4935('0x22')](function(_0x4a240b){_0x54be3b[_0x4935('0x57')]=_0x4a240b;return _0x54be3b;});}})[_0x4935('0x22')](respondWithFilteredResult(_0x15232f,_0xd97c04))['catch'](handleError(_0x15232f,null));};exports[_0x4935('0x6a')]=function(_0x9d01a9,_0x50df2a,_0x1ffef1){return db[_0x4935('0x3f')]['find']({'where':{'id':_0x9d01a9[_0x4935('0x58')]['id']}})['then'](handleEntityNotFound(_0x50df2a,null))[_0x4935('0x22')](function(_0x453bb1){if(_0x453bb1){return _0x453bb1['removeDispositions'](_0x9d01a9[_0x4935('0x44')][_0x4935('0x6b')]);}})['then'](respondWithStatusCode(_0x50df2a,null))['catch'](handleError(_0x50df2a,null));};exports[_0x4935('0x6c')]=function(_0x14dbfa,_0x49a767,_0x27ce22){if(_0x14dbfa[_0x4935('0x62')]['id']){delete _0x14dbfa[_0x4935('0x62')]['id'];}return db[_0x4935('0x3f')]['find']({'where':{'id':_0x14dbfa[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x49a767,null))['then'](function(_0x2f7897){if(_0x2f7897){_0x14dbfa[_0x4935('0x62')][_0x4935('0x65')]=_0x2f7897['id'];return db[_0x4935('0x6d')][_0x4935('0x5b')](_0x14dbfa[_0x4935('0x62')]);}})[_0x4935('0x22')](respondWithResult(_0x49a767,null))[_0x4935('0x2d')](handleError(_0x49a767,null));};exports[_0x4935('0x6e')]=function(_0x2978d7,_0x34f3d4,_0x50a14b){var _0x394367={'raw':![],'where':{}};var _0x3e8e54={};var _0x1e6d84={'count':0x0,'rows':[]};return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x2978d7['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x34f3d4,null))[_0x4935('0x22')](function(_0x4b9b39){if(_0x4b9b39){_0x3e8e54[_0x4935('0x43')]=_[_0x4935('0x45')](db['CannedAnswer'][_0x4935('0x59')]);_0x3e8e54[_0x4935('0x44')]=_[_0x4935('0x45')](_0x2978d7['query']);_0x3e8e54[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x3e8e54[_0x4935('0x43')],_0x3e8e54[_0x4935('0x44')]);_0x394367[_0x4935('0x47')]=_['intersection'](_0x3e8e54[_0x4935('0x43')],qs[_0x4935('0x48')](_0x2978d7[_0x4935('0x44')][_0x4935('0x48')]));_0x394367[_0x4935('0x47')]=_0x394367[_0x4935('0x47')]['length']?_0x394367[_0x4935('0x47')]:_0x3e8e54[_0x4935('0x43')];if(!_0x2978d7[_0x4935('0x44')][_0x4935('0x6f')](_0x4935('0x49'))){_0x394367[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x2978d7['query'][_0x4935('0x4a')]);_0x394367[_0x4935('0x31')]=qs[_0x4935('0x31')](_0x2978d7[_0x4935('0x44')][_0x4935('0x31')]);}_0x394367['order']=qs['sort'](_0x2978d7[_0x4935('0x44')][_0x4935('0x4c')]);_0x394367[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x2978d7['query'],_0x3e8e54[_0x4935('0x4e')]));_0x394367[_0x4935('0x4d')][_0x4935('0x65')]=_0x4b9b39['id'];if(_0x2978d7['query'][_0x4935('0x50')]){_0x394367[_0x4935('0x4d')]=_[_0x4935('0x51')](_0x394367[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0x394367[_0x4935('0x47')],function(_0xe60fe){var _0x47e1dd={};_0x47e1dd[_0xe60fe]={'$like':'%'+_0x2978d7[_0x4935('0x44')]['filter']+'%'};return _0x47e1dd;})});}_0x394367=_[_0x4935('0x51')]({},_0x394367,_0x2978d7['options']);return db['CannedAnswer'][_0x4935('0x30')]({'where':_0x394367['where']})['then'](function(_0x213fe3){_0x1e6d84[_0x4935('0x30')]=_0x213fe3;if(_0x2978d7['query'][_0x4935('0x54')]){_0x394367['include']=[{'all':!![]}];}return db[_0x4935('0x6d')][_0x4935('0x56')](_0x394367);})[_0x4935('0x22')](function(_0x22a8b8){_0x1e6d84[_0x4935('0x57')]=_0x22a8b8;return _0x1e6d84;});}})[_0x4935('0x22')](respondWithFilteredResult(_0x34f3d4,_0x394367))['catch'](handleError(_0x34f3d4,null));};exports[_0x4935('0x70')]=function(_0x16b1bb,_0xce134a,_0x5d53e6){return db[_0x4935('0x3f')][_0x4935('0x5a')]({'where':{'id':_0x16b1bb[_0x4935('0x58')]['id']}})['then'](handleEntityNotFound(_0xce134a,null))[_0x4935('0x22')](function(_0x44031e){if(_0x44031e){return _0x44031e[_0x4935('0x70')](_0x16b1bb[_0x4935('0x44')][_0x4935('0x6b')]);}})['then'](respondWithStatusCode(_0xce134a,null))[_0x4935('0x2d')](handleError(_0xce134a,null));};exports['addAgents']=function(_0x19fe30,_0x4bc3e7,_0x17dc59){return db['WhatsappAccount'][_0x4935('0x5a')]({'where':{'id':_0x19fe30[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4bc3e7,null))['then'](function(_0x31d209){if(_0x31d209){return _0x31d209[_0x4935('0x71')](_0x19fe30[_0x4935('0x62')][_0x4935('0x6b')],_[_0x4935('0x72')](_0x19fe30[_0x4935('0x62')],[_0x4935('0x6b'),'id'])||{})[_0x4935('0x73')](function(_0xc4ce1d){for(var _0x575ca2=0x0;_0x575ca2<_0x19fe30[_0x4935('0x62')][_0x4935('0x6b')][_0x4935('0x69')];_0x575ca2+=0x1){socket[_0x4935('0x74')](_0x4935('0x75'),{'UserId':_0x19fe30[_0x4935('0x62')][_0x4935('0x6b')][_0x575ca2],'WhatsappAccountId':_0x19fe30['params']['id']});}return _0xc4ce1d;});}})['then'](respondWithResult(_0x4bc3e7,null))[_0x4935('0x2d')](handleError(_0x4bc3e7,null));};exports['removeAgents']=function(_0x47ee06,_0x451ea8,_0x3a4266){return db[_0x4935('0x3f')][_0x4935('0x5a')]({'where':{'id':_0x47ee06['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x451ea8,null))[_0x4935('0x22')](function(_0x59e6b4){if(_0x59e6b4){return _0x59e6b4['removeAgents'](_0x47ee06['query']['ids'])['then'](function(){if(_[_0x4935('0x76')](_0x47ee06[_0x4935('0x44')]['ids'])){for(var _0x492bfb=0x0;_0x492bfb<_0x47ee06['query'][_0x4935('0x6b')][_0x4935('0x69')];_0x492bfb+=0x1){socket[_0x4935('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x47ee06['query']['ids'][_0x492bfb]),'WhatsappAccountId':Number(_0x47ee06[_0x4935('0x58')]['id'])});}}else{socket[_0x4935('0x74')](_0x4935('0x77'),{'UserId':Number(_0x47ee06[_0x4935('0x44')]['ids']),'WhatsappAccountId':Number(_0x47ee06[_0x4935('0x58')]['id'])});}});}})[_0x4935('0x22')](respondWithStatusCode(_0x451ea8,null))[_0x4935('0x2d')](handleError(_0x451ea8,null));};exports['getAgents']=function(_0x4f6984,_0x3568ea,_0x2f4b61){var _0x81f969={};var _0x281db3={};var _0x415fc2;var _0x255a60;return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x4f6984[_0x4935('0x58')]['id']}})['then'](handleEntityNotFound(_0x3568ea,null))[_0x4935('0x22')](function(_0x4120db){if(_0x4120db){_0x415fc2=_0x4120db;_0x281db3['model']=_['keys'](db[_0x4935('0x78')]['rawAttributes']);_0x281db3[_0x4935('0x44')]=_[_0x4935('0x45')](_0x4f6984['query']);_0x281db3[_0x4935('0x4e')]=_['intersection'](_0x281db3[_0x4935('0x43')],_0x281db3[_0x4935('0x44')]);_0x81f969['attributes']=_['intersection'](_0x281db3[_0x4935('0x43')],qs[_0x4935('0x48')](_0x4f6984[_0x4935('0x44')][_0x4935('0x48')]));_0x81f969[_0x4935('0x47')]=_0x81f969[_0x4935('0x47')][_0x4935('0x69')]?_0x81f969[_0x4935('0x47')]:_0x281db3['model'];_0x81f969['order']=qs[_0x4935('0x4c')](_0x4f6984[_0x4935('0x44')][_0x4935('0x4c')]);_0x81f969[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x4f6984[_0x4935('0x44')],_0x281db3[_0x4935('0x4e')]));if(_0x4f6984['query'][_0x4935('0x50')]){_0x81f969['where']=_[_0x4935('0x51')](_0x81f969['where'],{'$or':_[_0x4935('0x3e')](_0x81f969[_0x4935('0x47')],function(_0x31eaee){var _0x409d86={};_0x409d86[_0x31eaee]={'$like':'%'+_0x4f6984[_0x4935('0x44')]['filter']+'%'};return _0x409d86;})});}_0x81f969=_[_0x4935('0x51')]({},_0x81f969,_0x4f6984[_0x4935('0x53')]);return _0x415fc2[_0x4935('0x79')](_0x81f969);}})['then'](function(_0x4d4085){if(_0x4d4085){_0x255a60=_0x4d4085[_0x4935('0x69')];if(!_0x4f6984['query'][_0x4935('0x6f')](_0x4935('0x49'))){_0x81f969[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x4f6984[_0x4935('0x44')]['limit']);_0x81f969[_0x4935('0x31')]=qs[_0x4935('0x31')](_0x4f6984[_0x4935('0x44')][_0x4935('0x31')]);}return _0x415fc2[_0x4935('0x79')](_0x81f969);}})['then'](function(_0x1058f2){if(_0x1058f2){return _0x1058f2?{'count':_0x255a60,'rows':_0x1058f2}:null;}})[_0x4935('0x22')](respondWithResult(_0x3568ea,null))[_0x4935('0x2d')](handleError(_0x3568ea,null));};exports[_0x4935('0x7a')]=function(_0x51a95e,_0x4aa286,_0x5b303b){return db['WhatsappAccount'][_0x4935('0x68')]({'where':{'id':_0x51a95e[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4aa286,null))[_0x4935('0x22')](function(_0x13921c){if(_0x13921c){return db[_0x4935('0x7b')][_0x4935('0x7c')](function(_0x9afab9){return db[_0x4935('0x7d')][_0x4935('0x37')]({'where':{'WhatsappAccountId':_0x51a95e['params']['id']},'transaction':_0x9afab9})[_0x4935('0x22')](function(_0x3508ac){var _0x37f88a=_[_0x4935('0x3e')](_0x51a95e[_0x4935('0x62')],function(_0x8ef56f){_0x8ef56f[_0x4935('0x65')]=_0x51a95e[_0x4935('0x58')]['id'];return _0x8ef56f;});return db[_0x4935('0x7d')]['bulkCreate'](_0x37f88a,{'transaction':_0x9afab9});});})['then'](function(){return db[_0x4935('0x7d')][_0x4935('0x7e')]({'where':{'WhatsappAccountId':_0x51a95e[_0x4935('0x58')]['id']},'order':_0x4935('0x7f')});});}})[_0x4935('0x22')](respondWithResult(_0x4aa286,null))[_0x4935('0x2d')](handleError(_0x4aa286,null));};exports[_0x4935('0x80')]=function(_0x15b50e,_0x4c6b62,_0xc2892a){var _0x290e25={};var _0x4f968d={};var _0x46f309;var _0x4bfd8f;return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x15b50e[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4c6b62,null))[_0x4935('0x22')](function(_0x37a095){if(_0x37a095){_0x46f309=_0x37a095;_0x4f968d[_0x4935('0x43')]=_[_0x4935('0x45')](db[_0x4935('0x7d')][_0x4935('0x59')]);_0x4f968d['query']=_[_0x4935('0x45')](_0x15b50e['query']);_0x4f968d[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x4f968d[_0x4935('0x43')],_0x4f968d[_0x4935('0x44')]);_0x290e25[_0x4935('0x47')]=_['intersection'](_0x4f968d[_0x4935('0x43')],qs[_0x4935('0x48')](_0x15b50e[_0x4935('0x44')][_0x4935('0x48')]));_0x290e25[_0x4935('0x47')]=_0x290e25[_0x4935('0x47')][_0x4935('0x69')]?_0x290e25[_0x4935('0x47')]:_0x4f968d[_0x4935('0x43')];_0x290e25[_0x4935('0x4b')]=qs[_0x4935('0x4c')](_0x15b50e[_0x4935('0x44')]['sort']);_0x290e25[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x15b50e['query'],_0x4f968d[_0x4935('0x4e')]));if(_0x15b50e['query'][_0x4935('0x50')]){_0x290e25[_0x4935('0x4d')]=_[_0x4935('0x51')](_0x290e25[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0x290e25['attributes'],function(_0x3450d2){var _0x380f3d={};_0x380f3d[_0x3450d2]={'$like':'%'+_0x15b50e[_0x4935('0x44')][_0x4935('0x50')]+'%'};return _0x380f3d;})});}_0x290e25=_['merge']({},_0x290e25,_0x15b50e[_0x4935('0x53')]);return _0x46f309[_0x4935('0x80')](_0x290e25);}})[_0x4935('0x22')](function(_0x44de80){if(_0x44de80){_0x4bfd8f=_0x44de80[_0x4935('0x69')];if(!_0x15b50e[_0x4935('0x44')][_0x4935('0x6f')](_0x4935('0x49'))){_0x290e25['limit']=qs[_0x4935('0x4a')](_0x15b50e[_0x4935('0x44')][_0x4935('0x4a')]);_0x290e25['offset']=qs[_0x4935('0x31')](_0x15b50e[_0x4935('0x44')]['offset']);}return _0x46f309['getApplications'](_0x290e25);}})[_0x4935('0x22')](function(_0x30f6cd){if(_0x30f6cd){return _0x30f6cd?{'count':_0x4bfd8f,'rows':_0x30f6cd}:null;}})[_0x4935('0x22')](respondWithResult(_0x4c6b62,null))['catch'](handleError(_0x4c6b62,null));};exports['notify']=function(_0x4d0fc2,_0x1488f3,_0x8ca869){var _0x215de6={'channel':_0x4935('0x81')};var _0x303e9e=[];var _0x4ccbb7=[];var _0x15c87c={};return db['WhatsappAccount']['find']({'where':{'id':_0x4d0fc2['params']['id']},'include':[{'model':db[_0x4935('0x7d')],'as':_0x4935('0x82')}]})[_0x4935('0x22')](handleEntityNotFound(_0x1488f3,null))['then'](function(_0x384144){_0x215de6[_0x4935('0x83')]=_0x384144;_0x215de6[_0x4935('0x84')]=_['orderBy'](_0x384144[_0x4935('0x82')],[_0x4935('0x7f')],['asc']);if(_0x215de6['account'][_0x4935('0x82')]){delete _0x215de6['account'][_0x4935('0x82')];}return db[_0x4935('0x85')]['describe']();})[_0x4935('0x22')](function(_0x47a116){if(!_0x47a116){throw new db['Sequelize'][(_0x4935('0x20'))](_0x4935('0x86'));}_0x303e9e=_[_0x4935('0x87')](_[_0x4935('0x45')](_0x47a116),[_0x4935('0x88'),_0x4935('0x89')]);_0x4ccbb7=_[_0x4935('0x87')](_['keys'](_0x47a116),[_0x4935('0x88'),'updatedAt',_0x4935('0x8a'),_0x4935('0x8b')]);_0x215de6[_0x4935('0x62')]={'mapKey':_0x4935('0x8c')};if(_0x215de6[_0x4935('0x83')][_0x4935('0x41')]&&_0x215de6['account']['type']===_0x4935('0x8d')){_0x215de6[_0x4935('0x62')][_0x4935('0x8e')]=_0x4d0fc2[_0x4935('0x62')][_0x4935('0x8f')][_0x4935('0x90')]('whatsapp:','');_0x215de6[_0x4935('0x62')][_0x4935('0x62')]=_0x4d0fc2[_0x4935('0x62')]['Body'];_0x215de6['body'][_0x4935('0x91')]=_0x4d0fc2[_0x4935('0x62')][_0x4935('0x92')];}if(_0x215de6[_0x4935('0x62')]['id']){delete _0x215de6['body']['id'];}if(_[_0x4935('0x93')](_0x215de6[_0x4935('0x62')][_0x4935('0x8e')])){throw new db['Sequelize']['ValidationError'](_0x4935('0x94'));}if(_[_0x4935('0x93')](_0x215de6['body']['body'])||_0x215de6[_0x4935('0x62')][_0x4935('0x62')]===''){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))](_0x4935('0x96'));}if(_[_0x4935('0x93')](_0x215de6['body'][_0x4935('0x97')])){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))](_0x4935('0x98')+_0x4ccbb7);}if(!_[_0x4935('0x99')](_0x4ccbb7,_0x215de6[_0x4935('0x62')]['mapKey'])){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ccbb7);}_0x15c87c[_0x215de6[_0x4935('0x62')][_0x4935('0x97')]]=_0x215de6[_0x4935('0x62')]['from'];return db[_0x4935('0x9a')]['find']({'where':{'id':_0x215de6[_0x4935('0x83')]['ListId']},'include':[{'model':db[_0x4935('0x85')],'as':'Contacts','where':_0x15c87c,'limit':0x1,'order':[[_0x4935('0x89'),_0x4935('0x9b')]]}]});})[_0x4935('0x22')](handleEntityNotFound(_0x1488f3,null))[_0x4935('0x22')](function(_0x480708){if(_0x480708){_0x215de6[_0x4935('0x9c')]=_[_0x4935('0x72')](_0x480708,[_0x4935('0x9d')]);if(_0x480708[_0x4935('0x9d')][_0x4935('0x69')]){return _0x480708[_0x4935('0x9d')][0x0];}var _0x512e48=_['defaults'](_0x215de6['body'],{'firstName':_0x215de6['body']['from'],'ListId':_0x480708['id']});_0x512e48[_0x215de6[_0x4935('0x62')][_0x4935('0x97')]]=_0x215de6['body'][_0x4935('0x8e')];return db['CmContact'][_0x4935('0x5b')](_0x512e48,{'fields':_0x303e9e,'raw':!![]});}})[_0x4935('0x22')](handleEntityNotFound(_0x1488f3,null))['then'](function(_0x59154b){if(_0x59154b){_0x215de6[_0x4935('0x9e')]=_0x59154b;var _0x9d154a={'ContactId':_0x59154b['id'],'phone':_0x215de6['body']['from'],'WhatsappAccountId':_0x4d0fc2[_0x4935('0x58')]['id']};var _0x5bc89d={'ContactId':_0x59154b['id'],'WhatsappAccountId':_0x4d0fc2[_0x4935('0x58')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x4935('0x5a')]({'where':_0x5bc89d})[_0x4935('0x22')](function(_0x2b47e8){if(_0x2b47e8){return[_0x2b47e8,![]];}return db[_0x4935('0x9f')][_0x4935('0x5b')](_0x9d154a)[_0x4935('0x22')](function(_0x3c61a9){return[_0x3c61a9,!![]];});});}})[_0x4935('0x73')](function(_0x4e1079,_0x48b8f5){_0x215de6[_0x4935('0xa0')]=_0x4e1079[_0x4935('0x5f')]({'plain':!![]});_0x215de6[_0x4935('0xa0')]['created']=![];if(_0x48b8f5){if(_0x215de6['account'][_0x4935('0xa1')]){_0x215de6['applications'][_0x4935('0xa2')]({'id':0x0,'priority':_0x215de6[_0x4935('0x84')][_0x4935('0x69')]+0x1,'app':'close','appdata':_0x4935('0xa3'),'interval':_0x4935('0xa4')});}_0x215de6[_0x4935('0xa0')][_0x4935('0xa5')]=!![];}return db[_0x4935('0xa6')][_0x4935('0x5b')]({'phone':_0x215de6[_0x4935('0x62')][_0x4935('0x8e')],'messageId':_0x215de6[_0x4935('0x62')][_0x4935('0x91')],'body':_0x215de6[_0x4935('0x62')][_0x4935('0x62')],'WhatsappAccountId':_0x4d0fc2[_0x4935('0x58')]['id'],'WhatsappInteractionId':_0x4e1079['id'],'direction':'in','ContactId':_0x4e1079[_0x4935('0xa7')],'AttachmentId':_0x215de6['body'][_0x4935('0xa8')]});})[_0x4935('0x22')](function(_0x445218){_0x215de6[_0x4935('0x2a')]=_0x445218;if(_0x215de6[_0x4935('0xa0')][_0x4935('0xa9')]){return db[_0x4935('0x78')][_0x4935('0x5a')]({'attributes':['id',_0x4935('0x3b')],'where':{'id':_0x215de6[_0x4935('0xa0')][_0x4935('0xa9')]}})[_0x4935('0x22')](function(_0x3a3f21){if(_0x3a3f21){_0x215de6[_0x4935('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4935('0xaa'),'appdata':_0x3a3f21[_0x4935('0x3b')]+','+(_0x215de6[_0x4935('0x83')][_0x4935('0xab')]||0xa),'interval':_0x4935('0xa4')});}return respondWithRpcPromise(_0x4935('0xac'),_0x4935('0xad'),_0x215de6);});}return respondWithRpcPromise(_0x4935('0xac'),'startRouting',_0x215de6);})['then'](function(_0x4ec0bb){if(_0x4ec0bb){var _0x1e0387=0xc8;var _0xbdfff=_0x4935('0xae');logger['info'](_0x4935('0x25'),_0xbdfff,_0x1e0387,_0x4935('0xaf'));logger[_0x4935('0x24')](_0x4935('0xb0'),_0xbdfff,_0x1e0387,_0x4935('0xaf'),JSON[_0x4935('0x27')](_0x4ec0bb));if(_0x215de6[_0x4935('0x83')]['type']===_0x4935('0x8d')){return _0x1488f3[_0x4935('0x2e')](_0x1e0387)[_0x4935('0xb1')](_0x4935('0xb2'),'text/xml')[_0x4935('0xb3')]('\x0a');}else{return _0x1488f3[_0x4935('0x2e')](_0x1e0387)['json'](_0x4ec0bb);}}})[_0x4935('0x2d')](handleError(_0x1488f3,null));};exports[_0x4935('0xb3')]=function(_0x4d26cc,_0x21d58e,_0x1603a3){var _0x12b0be,_0x80f86f,_0x594ae5;if(_[_0x4935('0x93')](_0x4d26cc[_0x4935('0x62')][_0x4935('0x62')])||_0x4d26cc[_0x4935('0x62')]['body']===''){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))](_0x4935('0x96'));}if(_[_0x4935('0x93')](_0x4d26cc[_0x4935('0x62')]['to'])){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))]('to\x20is\x20mandatory');}_0x12b0be=_0x4d26cc[_0x4935('0x62')]['to'];return db[_0x4935('0x3f')]['find']({'where':{'id':_0x4d26cc[_0x4935('0x58')]['id']},'include':[{'model':db[_0x4935('0x9a')],'as':'List','include':[{'model':db[_0x4935('0x85')],'as':_0x4935('0x9d'),'where':{'mobile':_0x12b0be},'limit':0x1,'order':[[_0x4935('0x89'),'DESC']]}]}]})[_0x4935('0x22')](handleEntityNotFound(_0x21d58e,null))[_0x4935('0x22')](function(_0x3414ef){if(_0x3414ef&&_0x3414ef['List']){_0x80f86f=_0x3414ef[_0x4935('0x5f')]({'plain':!![]});if(_0x80f86f[_0x4935('0xb4')]&&_0x80f86f[_0x4935('0xb4')][_0x4935('0x9d')][_0x4935('0x69')]){return _0x80f86f[_0x4935('0xb4')][_0x4935('0x9d')][0x0];}return db[_0x4935('0x85')][_0x4935('0x5b')](_[_0x4935('0x17')](_0x4d26cc[_0x4935('0x62')],{'firstName':_0x12b0be,'mobile':_0x12b0be,'phone':_0x12b0be,'ListId':_0x80f86f['ListId']}));}})[_0x4935('0x22')](handleEntityNotFound(_0x21d58e,null))['then'](function(_0x1f705e){if(_0x1f705e){_0x594ae5=_0x1f705e;return db[_0x4935('0x9f')][_0x4935('0x5a')]({'where':{'ContactId':_0x594ae5['id'],'closed':![],'WhatsappAccountId':_0x80f86f['id']}})[_0x4935('0x22')](function(_0x1ed5c3){if(_0x1ed5c3){return[_0x1ed5c3,![]];}return db['WhatsappInteraction'][_0x4935('0x5b')]({'UserId':_0x4d26cc['user']['id'],'ContactId':_0x594ae5['id'],'WhatsappAccountId':_0x80f86f['id'],'phone':_0x12b0be,'firstMsgDirection':_0x4935('0xb5'),'Messages':[_[_0x4935('0x51')](_0x4d26cc[_0x4935('0x62')],{'read':![],'body':_0x4d26cc[_0x4935('0x62')][_0x4935('0x62')],'phone':_0x12b0be,'WhatsappAccountId':_0x80f86f['id'],'UserId':_0x4d26cc[_0x4935('0x5c')]['id'],'ContactId':_0x594ae5['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x4935('0xb6')}]})[_0x4935('0x22')](function(_0xb8fab5){return[_0xb8fab5,!![]];});});}})[_0x4935('0x73')](function(_0x5a6050,_0x16f8e2){if(_0x16f8e2){return _0x5a6050;}return db['WhatsappMessage']['create'](_[_0x4935('0x51')](_0x4d26cc['body'],{'read':![],'body':_0x4d26cc[_0x4935('0x62')][_0x4935('0x62')],'phone':_0x12b0be,'WhatsappAccountId':_0x80f86f['id'],'WhatsappInteractionId':_0x5a6050['id'],'UserId':_0x4d26cc[_0x4935('0x5c')]['id'],'ContactId':_0x594ae5['id']}))[_0x4935('0x22')](function(_0x37f9b6){_0x5a6050[_0x4935('0xb7')]['Messages']=[];_0x5a6050['dataValues'][_0x4935('0xb6')][_0x4935('0xa2')](_0x37f9b6['dataValues']);return _0x5a6050;});})[_0x4935('0x22')](respondWithResult(_0x21d58e,null))[_0x4935('0x2d')](handleError(_0x21d58e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2cf6792..d101d8d 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 _0xa6b0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x4bfd93,_0x3f3044){_0x4bfd93=_0x4bfd93-0x0;var _0x455133=_0xa6b0[_0x4bfd93];return _0x455133;};'use strict';var EventEmitter=require(_0x0a6b('0x0'));var WhatsappAccount=require(_0x0a6b('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0a6b('0x2'),'afterUpdate':_0x0a6b('0x3'),'afterDestroy':_0x0a6b('0x4')};function emitEvent(_0x4c9a84){return function(_0x29ff80,_0x33e8c3,_0x195697){WhatsappAccountEvents[_0x0a6b('0x5')](_0x4c9a84+':'+_0x29ff80['id'],_0x29ff80);WhatsappAccountEvents[_0x0a6b('0x5')](_0x4c9a84,_0x29ff80);_0x195697(null);};}for(var e in events){if(events[_0x0a6b('0x6')](e)){var event=events[e];WhatsappAccount[_0x0a6b('0x7')](e,emitEvent(event));}}module[_0x0a6b('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x187d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount','setMaxListeners'];(function(_0x2fcf16,_0x344dcb){var _0x54013e=function(_0x167ef3){while(--_0x167ef3){_0x2fcf16['push'](_0x2fcf16['shift']());}};_0x54013e(++_0x344dcb);}(_0x187d,0x93));var _0xd187=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x187d[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xd187('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xd187('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd187('0x2')](0x0);var events={'afterCreate':_0xd187('0x3'),'afterUpdate':_0xd187('0x4'),'afterDestroy':_0xd187('0x5')};function emitEvent(_0x201b79){return function(_0x58622a,_0x28fa0b,_0x163807){WhatsappAccountEvents['emit'](_0x201b79+':'+_0x58622a['id'],_0x58622a);WhatsappAccountEvents[_0xd187('0x6')](_0x201b79,_0x58622a);_0x163807(null);};}for(var e in events){if(events[_0xd187('0x7')](e)){var event=events[e];WhatsappAccount[_0xd187('0x8')](e,emitEvent(event));}}module[_0xd187('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2f36d24..3847675 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 _0x6ab0=['../../config/environment','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash','util','api','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6ab0,0xea));var _0x06ab=function(_0x1584c8,_0x255d61){_0x1584c8=_0x1584c8-0x0;var _0x49b5a7=_0x6ab0[_0x1584c8];return _0x49b5a7;};'use strict';var _=require(_0x06ab('0x0'));var util=require(_0x06ab('0x1'));var logger=require('../../config/logger')(_0x06ab('0x2'));var moment=require('moment');var BPromise=require(_0x06ab('0x3'));var rp=require(_0x06ab('0x4'));var fs=require('fs');var path=require(_0x06ab('0x5'));var rimraf=require('rimraf');var config=require(_0x06ab('0x6'));var attributes=require(_0x06ab('0x7'));module['exports']=function(_0x62b892,_0x335468){return _0x62b892['define'](_0x06ab('0x8'),attributes,{'tableName':_0x06ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0414=['./whatsappAccount.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x442c96,_0x5c2947){var _0x97951d=function(_0xe0cc47){while(--_0xe0cc47){_0x442c96['push'](_0x442c96['shift']());}};_0x97951d(++_0x5c2947);}(_0x0414,0x1cb));var _0x4041=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0x0414[_0x5dc03e];return _0x466a07;};'use strict';var _=require(_0x4041('0x0'));var util=require(_0x4041('0x1'));var logger=require('../../config/logger')(_0x4041('0x2'));var moment=require(_0x4041('0x3'));var BPromise=require(_0x4041('0x4'));var rp=require(_0x4041('0x5'));var fs=require('fs');var path=require(_0x4041('0x6'));var rimraf=require(_0x4041('0x7'));var config=require(_0x4041('0x8'));var attributes=require(_0x4041('0x9'));module[_0x4041('0xa')]=function(_0x1b62d1,_0x543cb2){return _0x1b62d1[_0x4041('0xb')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','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 a2066da..0454f4f 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 _0xe3da=['catch','find','options','where','include','map','model','attributes','then','debug','ShowWhatsappAccount','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','register','request','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','WhatsappAccount,\x20%s,\x20%s'];(function(_0x1652c2,_0x5682ec){var _0x3ed5df=function(_0x2be014){while(--_0x2be014){_0x1652c2['push'](_0x1652c2['shift']());}};_0x3ed5df(++_0x5682ec);}(_0xe3da,0x1e8));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require('moment');var BPromise=require(_0xae3d('0x2'));var rs=require(_0xae3d('0x3'));var fs=require('fs');var Redis=require(_0xae3d('0x4'));var db=require(_0xae3d('0x5'))['db'];var utils=require(_0xae3d('0x6'));var logger=require(_0xae3d('0x7'))(_0xae3d('0x8'));var config=require('../../config/environment');var jayson=require(_0xae3d('0x9'));var client=jayson['client'][_0xae3d('0xa')]({'port':0x232a});config['redis']=_[_0xae3d('0xb')](config[_0xae3d('0xc')],{'host':_0xae3d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae3d('0xc')]));require('./whatsappAccount.socket')[_0xae3d('0xe')](socket);function respondWithRpcPromise(_0x441ca1,_0x4bf467,_0x5891a2){return new BPromise(function(_0x30d9c1,_0x4bef2c){return client[_0xae3d('0xf')](_0x441ca1,_0x5891a2)['then'](function(_0xe967ab){logger[_0xae3d('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x4bf467,'request\x20sent');logger['debug'](_0xae3d('0x11'),_0x4bf467,_0xae3d('0x12'),JSON['stringify'](_0xe967ab));if(_0xe967ab[_0xae3d('0x13')]){if(_0xe967ab['error']['code']===0x1f4){logger[_0xae3d('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x4bf467,_0xe967ab[_0xae3d('0x13')][_0xae3d('0x14')]);return _0x4bef2c(_0xe967ab['error']['message']);}logger[_0xae3d('0x13')](_0xae3d('0x15'),_0x4bf467,_0xe967ab['error'][_0xae3d('0x14')]);return _0x30d9c1(_0xe967ab['error']['message']);}else{logger[_0xae3d('0x10')](_0xae3d('0x15'),_0x4bf467,'request\x20sent');_0x30d9c1(_0xe967ab['result']['message']);}})[_0xae3d('0x16')](function(_0x2421e0){logger[_0xae3d('0x13')](_0xae3d('0x15'),_0x4bf467,_0x2421e0);_0x4bef2c(_0x2421e0);});});}exports['ShowWhatsappAccount']=function(_0x1c90e2){var _0x107591=this;return new Promise(function(_0xecba70,_0x5b52b0){return db['WhatsappAccount'][_0xae3d('0x17')]({'raw':_0x1c90e2[_0xae3d('0x18')]?_0x1c90e2['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c90e2[_0xae3d('0x18')]?_0x1c90e2[_0xae3d('0x18')][_0xae3d('0x19')]||null:null,'attributes':_0x1c90e2[_0xae3d('0x18')]?_0x1c90e2['options']['attributes']||null:null,'include':_0x1c90e2[_0xae3d('0x18')]?_0x1c90e2[_0xae3d('0x18')][_0xae3d('0x1a')]?_[_0xae3d('0x1b')](_0x1c90e2['options'][_0xae3d('0x1a')],function(_0x5504f4){return{'model':db[_0x5504f4[_0xae3d('0x1c')]],'as':_0x5504f4['as'],'attributes':_0x5504f4['attributes'],'include':_0x5504f4[_0xae3d('0x1a')]?_[_0xae3d('0x1b')](_0x5504f4[_0xae3d('0x1a')],function(_0x2ac6d6){return{'model':db[_0x2ac6d6[_0xae3d('0x1c')]],'as':_0x2ac6d6['as'],'attributes':_0x2ac6d6['attributes'],'include':_0x2ac6d6[_0xae3d('0x1a')]?_['map'](_0x2ac6d6[_0xae3d('0x1a')],function(_0x22786d){return{'model':db[_0x22786d['model']],'as':_0x22786d['as'],'attributes':_0x22786d[_0xae3d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x1e')](function(_0x2e96be){logger[_0xae3d('0x10')]('ShowWhatsappAccount',_0x1c90e2);logger[_0xae3d('0x1f')](_0xae3d('0x20'),_0x1c90e2,JSON[_0xae3d('0x21')](_0x2e96be));_0xecba70(_0x2e96be);})[_0xae3d('0x16')](function(_0x183a68){logger['error'](_0xae3d('0x20'),_0x183a68[_0xae3d('0x14')],_0x1c90e2);_0x5b52b0(_0x107591[_0xae3d('0x13')](0x1f4,_0x183a68[_0xae3d('0x14')]));});});}; \ No newline at end of file +var _0xbee0=['client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowWhatsappAccount','find','options','attributes','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4e4b61,_0x40a4a3){var _0x406690=function(_0x14df38){while(--_0x14df38){_0x4e4b61['push'](_0x4e4b61['shift']());}};_0x406690(++_0x40a4a3);}(_0xbee0,0xae));var _0x0bee=function(_0xc7e06,_0x3f0146){_0xc7e06=_0xc7e06-0x0;var _0x3e57c8=_0xbee0[_0xc7e06];return _0x3e57c8;};'use strict';var _=require(_0x0bee('0x0'));var util=require(_0x0bee('0x1'));var moment=require(_0x0bee('0x2'));var BPromise=require(_0x0bee('0x3'));var rs=require(_0x0bee('0x4'));var fs=require('fs');var Redis=require(_0x0bee('0x5'));var db=require(_0x0bee('0x6'))['db'];var utils=require(_0x0bee('0x7'));var logger=require('../../config/logger')(_0x0bee('0x8'));var config=require(_0x0bee('0x9'));var jayson=require(_0x0bee('0xa'));var client=jayson[_0x0bee('0xb')][_0x0bee('0xc')]({'port':0x232a});config['redis']=_[_0x0bee('0xd')](config[_0x0bee('0xe')],{'host':_0x0bee('0xf'),'port':0x18eb});var socket=require(_0x0bee('0x10'))(new Redis(config[_0x0bee('0xe')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x43ba40,_0x119cec,_0x2d7b4f){return new BPromise(function(_0x596948,_0x36a5ac){return client[_0x0bee('0x11')](_0x43ba40,_0x2d7b4f)[_0x0bee('0x12')](function(_0x301fa2){logger[_0x0bee('0x13')](_0x0bee('0x14'),_0x119cec,_0x0bee('0x15'));logger[_0x0bee('0x16')](_0x0bee('0x17'),_0x119cec,_0x0bee('0x15'),JSON['stringify'](_0x301fa2));if(_0x301fa2[_0x0bee('0x18')]){if(_0x301fa2['error'][_0x0bee('0x19')]===0x1f4){logger[_0x0bee('0x18')](_0x0bee('0x14'),_0x119cec,_0x301fa2[_0x0bee('0x18')][_0x0bee('0x1a')]);return _0x36a5ac(_0x301fa2['error'][_0x0bee('0x1a')]);}logger[_0x0bee('0x18')](_0x0bee('0x14'),_0x119cec,_0x301fa2[_0x0bee('0x18')][_0x0bee('0x1a')]);return _0x596948(_0x301fa2[_0x0bee('0x18')][_0x0bee('0x1a')]);}else{logger['info'](_0x0bee('0x14'),_0x119cec,'request\x20sent');_0x596948(_0x301fa2[_0x0bee('0x1b')][_0x0bee('0x1a')]);}})[_0x0bee('0x1c')](function(_0x320f21){logger[_0x0bee('0x18')](_0x0bee('0x14'),_0x119cec,_0x320f21);_0x36a5ac(_0x320f21);});});}exports[_0x0bee('0x1d')]=function(_0x13ee09){var _0x453c25=this;return new Promise(function(_0x19e099,_0x3715de){return db['WhatsappAccount'][_0x0bee('0x1e')]({'raw':_0x13ee09[_0x0bee('0x1f')]?_0x13ee09[_0x0bee('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x13ee09[_0x0bee('0x1f')]?_0x13ee09[_0x0bee('0x1f')]['where']||null:null,'attributes':_0x13ee09[_0x0bee('0x1f')]?_0x13ee09['options'][_0x0bee('0x20')]||null:null,'include':_0x13ee09['options']?_0x13ee09[_0x0bee('0x1f')][_0x0bee('0x21')]?_['map'](_0x13ee09[_0x0bee('0x1f')][_0x0bee('0x21')],function(_0x49274e){return{'model':db[_0x49274e[_0x0bee('0x22')]],'as':_0x49274e['as'],'attributes':_0x49274e[_0x0bee('0x20')],'include':_0x49274e['include']?_[_0x0bee('0x23')](_0x49274e['include'],function(_0xdc3ee3){return{'model':db[_0xdc3ee3['model']],'as':_0xdc3ee3['as'],'attributes':_0xdc3ee3[_0x0bee('0x20')],'include':_0xdc3ee3[_0x0bee('0x21')]?_['map'](_0xdc3ee3[_0x0bee('0x21')],function(_0x4339b4){return{'model':db[_0x4339b4[_0x0bee('0x22')]],'as':_0x4339b4['as'],'attributes':_0x4339b4[_0x0bee('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0bee('0x12')](function(_0x4c221c){logger[_0x0bee('0x13')](_0x0bee('0x1d'),_0x13ee09);logger['debug'](_0x0bee('0x1d'),_0x13ee09,JSON[_0x0bee('0x24')](_0x4c221c));_0x19e099(_0x4c221c);})[_0x0bee('0x1c')](function(_0x3323d6){logger['error'](_0x0bee('0x1d'),_0x3323d6[_0x0bee('0x1a')],_0x13ee09);_0x3715de(_0x453c25['error'](0x1f4,_0x3323d6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 688af81..42bfb2e 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 _0xe9d5=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove','update'];(function(_0x42160c,_0x30e856){var _0xdba9cb=function(_0x3b1f82){while(--_0x3b1f82){_0x42160c['push'](_0x42160c['shift']());}};_0xdba9cb(++_0x30e856);}(_0xe9d5,0xcd));var _0x5e9d=function(_0xed5729,_0x4979b1){_0xed5729=_0xed5729-0x0;var _0x4607e4=_0xe9d5[_0xed5729];return _0x4607e4;};'use strict';var WhatsappAccountEvents=require(_0x5e9d('0x0'));var events=['save',_0x5e9d('0x1'),_0x5e9d('0x2')];function createListener(_0x49c744,_0xac6c23){return function(_0x4b3c7d){_0xac6c23[_0x5e9d('0x3')](_0x49c744,_0x4b3c7d);};}function removeListener(_0x5f22ab,_0x208d73){return function(){WhatsappAccountEvents[_0x5e9d('0x4')](_0x5f22ab,_0x208d73);};}exports[_0x5e9d('0x5')]=function(_0x484887){for(var _0x28655c=0x0,_0x24cc53=events[_0x5e9d('0x6')];_0x28655c<_0x24cc53;_0x28655c++){var _0x16802a=events[_0x28655c];var _0x433315=createListener(_0x5e9d('0x7')+_0x16802a,_0x484887);WhatsappAccountEvents['on'](_0x16802a,_0x433315);}}; \ No newline at end of file +var _0xa9b0=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove','emit'];(function(_0x7841f9,_0x227504){var _0x2d8151=function(_0x144fd0){while(--_0x144fd0){_0x7841f9['push'](_0x7841f9['shift']());}};_0x2d8151(++_0x227504);}(_0xa9b0,0x13f));var _0x0a9b=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xa9b0[_0x82129b];return _0x2ae5dc;};'use strict';var WhatsappAccountEvents=require(_0x0a9b('0x0'));var events=['save',_0x0a9b('0x1'),'update'];function createListener(_0x2ecdc0,_0x3a1553){return function(_0x3299ce){_0x3a1553[_0x0a9b('0x2')](_0x2ecdc0,_0x3299ce);};}function removeListener(_0x220a76,_0x32f369){return function(){WhatsappAccountEvents[_0x0a9b('0x3')](_0x220a76,_0x32f369);};}exports[_0x0a9b('0x4')]=function(_0x16c6a4){for(var _0x5def20=0x0,_0x3fbbfb=events[_0x0a9b('0x5')];_0x5def20<_0x3fbbfb;_0x5def20++){var _0x54ac96=events[_0x5def20];var _0x320ecd=createListener(_0x0a9b('0x6')+_0x54ac96,_0x16c6a4);WhatsappAccountEvents['on'](_0x54ac96,_0x320ecd);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 99d6074..e7452fd 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 _0x1489=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','path','connect-timeout'];(function(_0x1b051c,_0x27e62d){var _0x4b7956=function(_0x228f91){while(--_0x228f91){_0x1b051c['push'](_0x1b051c['shift']());}};_0x4b7956(++_0x27e62d);}(_0x1489,0x11f));var _0x9148=function(_0x4f1d29,_0x4f33c6){_0x4f1d29=_0x4f1d29-0x0;var _0x8486f7=_0x1489[_0x4f1d29];return _0x8486f7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9148('0x0'));var timeout=require(_0x9148('0x1'));var express=require(_0x9148('0x2'));var router=express[_0x9148('0x3')]();var auth=require(_0x9148('0x4'));var interaction=require(_0x9148('0x5'));var config=require(_0x9148('0x6'));var controller=require('./whatsappApplication.controller');router[_0x9148('0x7')]('/',auth[_0x9148('0x8')](),controller[_0x9148('0x9')]);router[_0x9148('0x7')](_0x9148('0xa'),auth[_0x9148('0x8')](),controller[_0x9148('0xb')]);router[_0x9148('0xc')]('/',auth[_0x9148('0x8')](),controller[_0x9148('0xd')]);router[_0x9148('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9148('0xf')](_0x9148('0xa'),auth[_0x9148('0x8')](),controller['destroy']);module[_0x9148('0x10')]=router; \ No newline at end of file +var _0x27de=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x41daa3,_0x27f14f){var _0x9d8d5a=function(_0x4bc598){while(--_0x4bc598){_0x41daa3['push'](_0x41daa3['shift']());}};_0x9d8d5a(++_0x27f14f);}(_0x27de,0x160));var _0xe27d=function(_0x34d0f6,_0x3298a0){_0x34d0f6=_0x34d0f6-0x0;var _0x57daf1=_0x27de[_0x34d0f6];return _0x57daf1;};'use strict';var multer=require(_0xe27d('0x0'));var util=require(_0xe27d('0x1'));var path=require(_0xe27d('0x2'));var timeout=require(_0xe27d('0x3'));var express=require('express');var router=express[_0xe27d('0x4')]();var auth=require(_0xe27d('0x5'));var interaction=require(_0xe27d('0x6'));var config=require(_0xe27d('0x7'));var controller=require(_0xe27d('0x8'));router[_0xe27d('0x9')]('/',auth['isAuthenticated'](),controller[_0xe27d('0xa')]);router[_0xe27d('0x9')](_0xe27d('0xb'),auth[_0xe27d('0xc')](),controller[_0xe27d('0xd')]);router[_0xe27d('0xe')]('/',auth['isAuthenticated'](),controller[_0xe27d('0xf')]);router[_0xe27d('0x10')]('/:id',auth[_0xe27d('0xc')](),controller[_0xe27d('0x11')]);router[_0xe27d('0x12')](_0xe27d('0xb'),auth[_0xe27d('0xc')](),controller[_0xe27d('0x13')]);module[_0xe27d('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index fe34aea..13a20a5 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 _0x37cf=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xe2794,_0x42caa5){var _0x578b5e=function(_0x3df5dd){while(--_0x3df5dd){_0xe2794['push'](_0xe2794['shift']());}};_0x578b5e(++_0x42caa5);}(_0x37cf,0xcc));var _0xf37c=function(_0x3222ad,_0x2df6b3){_0x3222ad=_0x3222ad-0x0;var _0x69314b=_0x37cf[_0x3222ad];return _0x69314b;};'use strict';var Sequelize=require(_0xf37c('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf37c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf37c('0x2')],'allowNull':![],'defaultValue':_0xf37c('0x3')},'appdata':{'type':Sequelize[_0xf37c('0x4')]()},'description':{'type':Sequelize[_0xf37c('0x2')]},'interval':{'type':Sequelize[_0xf37c('0x2')],'defaultValue':_0xf37c('0x5')}}; \ No newline at end of file +var _0xed3d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x13fdf5,_0x219c79){var _0x875d04=function(_0x2ae43c){while(--_0x2ae43c){_0x13fdf5['push'](_0x13fdf5['shift']());}};_0x875d04(++_0x219c79);}(_0xed3d,0x1ea));var _0xded3=function(_0x5866dc,_0x5a3003){_0x5866dc=_0x5866dc-0x0;var _0x428d91=_0xed3d[_0x5866dc];return _0x428d91;};'use strict';var Sequelize=require(_0xded3('0x0'));module[_0xded3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xded3('0x2')],'allowNull':![],'defaultValue':_0xded3('0x3')},'appdata':{'type':Sequelize[_0xded3('0x4')]()},'description':{'type':Sequelize[_0xded3('0x2')]},'interval':{'type':Sequelize[_0xded3('0x2')],'defaultValue':_0xded3('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 58bcb65..03240ae 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 _0xbec5=['then','error','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','update','body','catch','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy'];(function(_0x17e5ae,_0x49509f){var _0x2c86af=function(_0x3e6017){while(--_0x3e6017){_0x17e5ae['push'](_0x17e5ae['shift']());}};_0x2c86af(++_0x49509f);}(_0xbec5,0x184));var _0x5bec=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0xbec5[_0x28e2cd];return _0x11fd46;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5bec('0x0'));var zipdir=require(_0x5bec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var Mustache=require(_0x5bec('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5bec('0x6'));var csv=require(_0x5bec('0x7'));var ejs=require(_0x5bec('0x8'));var fs=require('fs');var _=require(_0x5bec('0x9'));var squel=require(_0x5bec('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5bec('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5bec('0xc'));var authService=require(_0x5bec('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5bec('0xe'));var hardwareService=require(_0x5bec('0xf'));var logger=require(_0x5bec('0x10'))(_0x5bec('0x11'));var utils=require(_0x5bec('0x12'));var config=require('../../config/environment');var db=require(_0x5bec('0x13'))['db'];function respondWithStatusCode(_0x538ad2,_0x592956){_0x592956=_0x592956||0xcc;return function(_0x91e920){if(_0x91e920){return _0x538ad2['sendStatus'](_0x592956);}return _0x538ad2[_0x5bec('0x14')](_0x592956)[_0x5bec('0x15')]();};}function respondWithResult(_0x197136,_0x118444){_0x118444=_0x118444||0xc8;return function(_0x1e2c55){if(_0x1e2c55){return _0x197136['status'](_0x118444)[_0x5bec('0x16')](_0x1e2c55);}};}function respondWithFilteredResult(_0x14aa9f,_0x353acb){return function(_0x4653f3){if(_0x4653f3){var _0x13c048=_0x4653f3[_0x5bec('0x17')],_0x554bd6=_0x353acb['offset'],_0x21871a=_0x353acb[_0x5bec('0x18')]+_0x353acb[_0x5bec('0x19')],_0x14334e;if(_0x21871a>=_0x13c048){_0x21871a=_0x13c048;_0x14334e=0xc8;}else{_0x14334e=0xce;}_0x14aa9f[_0x5bec('0x14')](_0x14334e);return _0x14aa9f[_0x5bec('0x1a')](_0x5bec('0x1b'),_0x554bd6+'-'+_0x21871a+'/'+_0x13c048)[_0x5bec('0x16')](_0x4653f3);}return null;};}function patchUpdates(_0x35fa35){return function(_0x22f3ea){try{jsonpatch[_0x5bec('0x1c')](_0x22f3ea,_0x35fa35,!![]);}catch(_0x48310d){return BPromise[_0x5bec('0x1d')](_0x48310d);}return _0x22f3ea[_0x5bec('0x1e')]();};}function saveUpdates(_0x2be56b,_0x351550){return function(_0x16c2b9){if(_0x16c2b9){return _0x16c2b9['update'](_0x2be56b)['then'](function(_0x3dd570){return _0x3dd570;});}return null;};}function removeEntity(_0x55beaa,_0x37bb3c){return function(_0x3a221a){if(_0x3a221a){return _0x3a221a[_0x5bec('0x1f')]()[_0x5bec('0x20')](function(){_0x55beaa[_0x5bec('0x14')](0xcc)[_0x5bec('0x15')]();});}};}function handleEntityNotFound(_0xc05ba3,_0x3e2cff){return function(_0x41662c){if(!_0x41662c){_0xc05ba3['sendStatus'](0x194);}return _0x41662c;};}function handleError(_0x103c1a,_0x4ee844){_0x4ee844=_0x4ee844||0x1f4;return function(_0x4493f8){logger[_0x5bec('0x21')](_0x4493f8['stack']);if(_0x4493f8[_0x5bec('0x22')]){delete _0x4493f8[_0x5bec('0x22')];}_0x103c1a[_0x5bec('0x14')](_0x4ee844)[_0x5bec('0x23')](_0x4493f8);};}exports[_0x5bec('0x24')]=function(_0x396a49,_0x4916d2){var _0x3bcefb={},_0x39ea90={},_0x34f5e5={'count':0x0,'rows':[]};var _0x345d52=_['map'](db[_0x5bec('0x25')][_0x5bec('0x26')],function(_0x2374f5){return{'name':_0x2374f5[_0x5bec('0x27')],'type':_0x2374f5[_0x5bec('0x28')][_0x5bec('0x29')]};});_0x39ea90['model']=_[_0x5bec('0x2a')](_0x345d52,_0x5bec('0x22'));_0x39ea90[_0x5bec('0x2b')]=_[_0x5bec('0x2c')](_0x396a49[_0x5bec('0x2b')]);_0x39ea90[_0x5bec('0x2d')]=_['intersection'](_0x39ea90[_0x5bec('0x2e')],_0x39ea90['query']);_0x3bcefb[_0x5bec('0x2f')]=_[_0x5bec('0x30')](_0x39ea90[_0x5bec('0x2e')],qs[_0x5bec('0x31')](_0x396a49[_0x5bec('0x2b')][_0x5bec('0x31')]));_0x3bcefb[_0x5bec('0x2f')]=_0x3bcefb['attributes'][_0x5bec('0x32')]?_0x3bcefb[_0x5bec('0x2f')]:_0x39ea90[_0x5bec('0x2e')];if(!_0x396a49[_0x5bec('0x2b')][_0x5bec('0x33')](_0x5bec('0x34'))){_0x3bcefb[_0x5bec('0x19')]=qs[_0x5bec('0x19')](_0x396a49['query'][_0x5bec('0x19')]);_0x3bcefb[_0x5bec('0x18')]=qs[_0x5bec('0x18')](_0x396a49[_0x5bec('0x2b')]['offset']);}_0x3bcefb['order']=qs['sort'](_0x396a49['query'][_0x5bec('0x35')]);_0x3bcefb[_0x5bec('0x36')]=qs[_0x5bec('0x2d')](_[_0x5bec('0x37')](_0x396a49[_0x5bec('0x2b')],_0x39ea90['filters']),_0x345d52);if(_0x396a49[_0x5bec('0x2b')][_0x5bec('0x38')]){_0x3bcefb[_0x5bec('0x36')]=_['merge'](_0x3bcefb['where'],{'$or':_[_0x5bec('0x2a')](_0x345d52,function(_0x3a7ba2){if(_0x3a7ba2[_0x5bec('0x28')]!==_0x5bec('0x39')){var _0x537b9e={};_0x537b9e[_0x3a7ba2['name']]={'$like':'%'+_0x396a49[_0x5bec('0x2b')]['filter']+'%'};return _0x537b9e;}})});}_0x3bcefb=_[_0x5bec('0x3a')]({},_0x3bcefb,_0x396a49[_0x5bec('0x3b')]);var _0x15b1a6={'where':_0x3bcefb[_0x5bec('0x36')]};return db[_0x5bec('0x25')][_0x5bec('0x17')](_0x15b1a6)[_0x5bec('0x20')](function(_0x4810cb){_0x34f5e5[_0x5bec('0x17')]=_0x4810cb;if(_0x396a49[_0x5bec('0x2b')][_0x5bec('0x3c')]){_0x3bcefb[_0x5bec('0x3d')]=[{'all':!![]}];}return db[_0x5bec('0x25')][_0x5bec('0x3e')](_0x3bcefb);})['then'](function(_0x5a481d){_0x34f5e5[_0x5bec('0x3f')]=_0x5a481d;return _0x34f5e5;})[_0x5bec('0x20')](respondWithFilteredResult(_0x4916d2,_0x3bcefb))['catch'](handleError(_0x4916d2,null));};exports[_0x5bec('0x40')]=function(_0x4b2577,_0x39165){var _0x469a9d={'raw':!![],'where':{'id':_0x4b2577[_0x5bec('0x41')]['id']}},_0x3c3c14={};_0x3c3c14[_0x5bec('0x2e')]=_[_0x5bec('0x2c')](db[_0x5bec('0x25')]['rawAttributes']);_0x3c3c14[_0x5bec('0x2b')]=_[_0x5bec('0x2c')](_0x4b2577[_0x5bec('0x2b')]);_0x3c3c14['filters']=_['intersection'](_0x3c3c14[_0x5bec('0x2e')],_0x3c3c14[_0x5bec('0x2b')]);_0x469a9d['attributes']=_[_0x5bec('0x30')](_0x3c3c14['model'],qs[_0x5bec('0x31')](_0x4b2577[_0x5bec('0x2b')][_0x5bec('0x31')]));_0x469a9d['attributes']=_0x469a9d[_0x5bec('0x2f')][_0x5bec('0x32')]?_0x469a9d['attributes']:_0x3c3c14['model'];if(_0x4b2577[_0x5bec('0x2b')][_0x5bec('0x3c')]){_0x469a9d[_0x5bec('0x3d')]=[{'all':!![]}];}_0x469a9d=_[_0x5bec('0x3a')]({},_0x469a9d,_0x4b2577[_0x5bec('0x3b')]);return db[_0x5bec('0x25')][_0x5bec('0x42')](_0x469a9d)[_0x5bec('0x20')](handleEntityNotFound(_0x39165,null))[_0x5bec('0x20')](respondWithResult(_0x39165,null))['catch'](handleError(_0x39165,null));};exports['create']=function(_0x3575ba,_0x138197){return db[_0x5bec('0x25')]['create'](_0x3575ba['body'],{})[_0x5bec('0x20')](respondWithResult(_0x138197,0xc9))['catch'](handleError(_0x138197,null));};exports[_0x5bec('0x43')]=function(_0xa845f7,_0x4ef70a){if(_0xa845f7[_0x5bec('0x44')]['id']){delete _0xa845f7[_0x5bec('0x44')]['id'];}return db[_0x5bec('0x25')][_0x5bec('0x42')]({'where':{'id':_0xa845f7[_0x5bec('0x41')]['id']}})[_0x5bec('0x20')](handleEntityNotFound(_0x4ef70a,null))[_0x5bec('0x20')](saveUpdates(_0xa845f7[_0x5bec('0x44')],null))['then'](respondWithResult(_0x4ef70a,null))['catch'](handleError(_0x4ef70a,null));};exports['destroy']=function(_0x2bde61,_0x31d2da){return db[_0x5bec('0x25')][_0x5bec('0x42')]({'where':{'id':_0x2bde61[_0x5bec('0x41')]['id']}})[_0x5bec('0x20')](handleEntityNotFound(_0x31d2da,null))[_0x5bec('0x20')](removeEntity(_0x31d2da,null))[_0x5bec('0x45')](handleError(_0x31d2da,null));}; \ No newline at end of file +var _0x8481=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','body','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv'];(function(_0x19c957,_0x4d8840){var _0x2ae926=function(_0x4796b4){while(--_0x4796b4){_0x19c957['push'](_0x19c957['shift']());}};_0x2ae926(++_0x4d8840);}(_0x8481,0x123));var _0x1848=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x8481[_0x3747ae];return _0x339035;};'use strict';var pdf=require(_0x1848('0x0'));var emlformat=require(_0x1848('0x1'));var rimraf=require(_0x1848('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1848('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1848('0x4'));var Mustache=require('mustache');var util=require(_0x1848('0x5'));var path=require(_0x1848('0x6'));var sox=require(_0x1848('0x7'));var csv=require(_0x1848('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1848('0x9'));var squel=require(_0x1848('0xa'));var crypto=require(_0x1848('0xb'));var jsforce=require(_0x1848('0xc'));var deskjs=require(_0x1848('0xd'));var toCsv=require(_0x1848('0x8'));var querystring=require(_0x1848('0xe'));var Papa=require(_0x1848('0xf'));var Redis=require(_0x1848('0x10'));var authService=require(_0x1848('0x11'));var qs=require(_0x1848('0x12'));var as=require(_0x1848('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1848('0x14'))(_0x1848('0x15'));var utils=require('../../config/utils');var config=require(_0x1848('0x16'));var db=require(_0x1848('0x17'))['db'];function respondWithStatusCode(_0x1686d9,_0x21eb8d){_0x21eb8d=_0x21eb8d||0xcc;return function(_0x2664da){if(_0x2664da){return _0x1686d9[_0x1848('0x18')](_0x21eb8d);}return _0x1686d9[_0x1848('0x19')](_0x21eb8d)[_0x1848('0x1a')]();};}function respondWithResult(_0x24bca9,_0x1a7913){_0x1a7913=_0x1a7913||0xc8;return function(_0x56673f){if(_0x56673f){return _0x24bca9[_0x1848('0x19')](_0x1a7913)[_0x1848('0x1b')](_0x56673f);}};}function respondWithFilteredResult(_0x1fe7d1,_0x3c67d1){return function(_0x7feca){if(_0x7feca){var _0x3818aa=_0x7feca['count'],_0x4202eb=_0x3c67d1[_0x1848('0x1c')],_0x57e7ba=_0x3c67d1[_0x1848('0x1c')]+_0x3c67d1[_0x1848('0x1d')],_0x300e69;if(_0x57e7ba>=_0x3818aa){_0x57e7ba=_0x3818aa;_0x300e69=0xc8;}else{_0x300e69=0xce;}_0x1fe7d1[_0x1848('0x19')](_0x300e69);return _0x1fe7d1[_0x1848('0x1e')](_0x1848('0x1f'),_0x4202eb+'-'+_0x57e7ba+'/'+_0x3818aa)[_0x1848('0x1b')](_0x7feca);}return null;};}function patchUpdates(_0x3b1bdf){return function(_0x16e729){try{jsonpatch[_0x1848('0x20')](_0x16e729,_0x3b1bdf,!![]);}catch(_0x17bd52){return BPromise[_0x1848('0x21')](_0x17bd52);}return _0x16e729[_0x1848('0x22')]();};}function saveUpdates(_0x4ff051,_0x1055a){return function(_0x32c640){if(_0x32c640){return _0x32c640['update'](_0x4ff051)[_0x1848('0x23')](function(_0x181ffd){return _0x181ffd;});}return null;};}function removeEntity(_0x172b37,_0x295f9a){return function(_0x46e97a){if(_0x46e97a){return _0x46e97a[_0x1848('0x24')]()[_0x1848('0x23')](function(){_0x172b37[_0x1848('0x19')](0xcc)[_0x1848('0x1a')]();});}};}function handleEntityNotFound(_0x1aea51,_0x5922cd){return function(_0x14dd34){if(!_0x14dd34){_0x1aea51[_0x1848('0x18')](0x194);}return _0x14dd34;};}function handleError(_0x5abf9c,_0x3f23b1){_0x3f23b1=_0x3f23b1||0x1f4;return function(_0x4f38d8){logger[_0x1848('0x25')](_0x4f38d8['stack']);if(_0x4f38d8['name']){delete _0x4f38d8[_0x1848('0x26')];}_0x5abf9c[_0x1848('0x19')](_0x3f23b1)[_0x1848('0x27')](_0x4f38d8);};}exports['index']=function(_0x25b62b,_0x40acfd){var _0x48dfc8={},_0xc3e55c={},_0x36624a={'count':0x0,'rows':[]};var _0x17e94c=_['map'](db[_0x1848('0x28')][_0x1848('0x29')],function(_0x541eff){return{'name':_0x541eff[_0x1848('0x2a')],'type':_0x541eff[_0x1848('0x2b')][_0x1848('0x2c')]};});_0xc3e55c[_0x1848('0x2d')]=_[_0x1848('0x2e')](_0x17e94c,'name');_0xc3e55c[_0x1848('0x2f')]=_['keys'](_0x25b62b[_0x1848('0x2f')]);_0xc3e55c[_0x1848('0x30')]=_['intersection'](_0xc3e55c[_0x1848('0x2d')],_0xc3e55c[_0x1848('0x2f')]);_0x48dfc8[_0x1848('0x31')]=_[_0x1848('0x32')](_0xc3e55c[_0x1848('0x2d')],qs[_0x1848('0x33')](_0x25b62b[_0x1848('0x2f')][_0x1848('0x33')]));_0x48dfc8['attributes']=_0x48dfc8[_0x1848('0x31')][_0x1848('0x34')]?_0x48dfc8[_0x1848('0x31')]:_0xc3e55c[_0x1848('0x2d')];if(!_0x25b62b[_0x1848('0x2f')][_0x1848('0x35')](_0x1848('0x36'))){_0x48dfc8[_0x1848('0x1d')]=qs[_0x1848('0x1d')](_0x25b62b[_0x1848('0x2f')][_0x1848('0x1d')]);_0x48dfc8[_0x1848('0x1c')]=qs[_0x1848('0x1c')](_0x25b62b[_0x1848('0x2f')][_0x1848('0x1c')]);}_0x48dfc8['order']=qs[_0x1848('0x37')](_0x25b62b[_0x1848('0x2f')][_0x1848('0x37')]);_0x48dfc8['where']=qs['filters'](_[_0x1848('0x38')](_0x25b62b[_0x1848('0x2f')],_0xc3e55c[_0x1848('0x30')]),_0x17e94c);if(_0x25b62b[_0x1848('0x2f')][_0x1848('0x39')]){_0x48dfc8['where']=_[_0x1848('0x3a')](_0x48dfc8[_0x1848('0x3b')],{'$or':_[_0x1848('0x2e')](_0x17e94c,function(_0x1a0708){if(_0x1a0708[_0x1848('0x2b')]!==_0x1848('0x3c')){var _0x6175c7={};_0x6175c7[_0x1a0708[_0x1848('0x26')]]={'$like':'%'+_0x25b62b[_0x1848('0x2f')]['filter']+'%'};return _0x6175c7;}})});}_0x48dfc8=_[_0x1848('0x3a')]({},_0x48dfc8,_0x25b62b[_0x1848('0x3d')]);var _0x5905d6={'where':_0x48dfc8[_0x1848('0x3b')]};return db[_0x1848('0x28')][_0x1848('0x3e')](_0x5905d6)[_0x1848('0x23')](function(_0x2f3ac6){_0x36624a[_0x1848('0x3e')]=_0x2f3ac6;if(_0x25b62b[_0x1848('0x2f')][_0x1848('0x3f')]){_0x48dfc8[_0x1848('0x40')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x1848('0x41')](_0x48dfc8);})['then'](function(_0x103cac){_0x36624a[_0x1848('0x42')]=_0x103cac;return _0x36624a;})['then'](respondWithFilteredResult(_0x40acfd,_0x48dfc8))[_0x1848('0x43')](handleError(_0x40acfd,null));};exports[_0x1848('0x44')]=function(_0x4f9933,_0x48a532){var _0x12aaa6={'raw':!![],'where':{'id':_0x4f9933[_0x1848('0x45')]['id']}},_0x430bd2={};_0x430bd2['model']=_[_0x1848('0x46')](db[_0x1848('0x28')][_0x1848('0x29')]);_0x430bd2[_0x1848('0x2f')]=_['keys'](_0x4f9933[_0x1848('0x2f')]);_0x430bd2[_0x1848('0x30')]=_[_0x1848('0x32')](_0x430bd2[_0x1848('0x2d')],_0x430bd2['query']);_0x12aaa6[_0x1848('0x31')]=_['intersection'](_0x430bd2[_0x1848('0x2d')],qs[_0x1848('0x33')](_0x4f9933[_0x1848('0x2f')][_0x1848('0x33')]));_0x12aaa6[_0x1848('0x31')]=_0x12aaa6[_0x1848('0x31')]['length']?_0x12aaa6[_0x1848('0x31')]:_0x430bd2[_0x1848('0x2d')];if(_0x4f9933['query'][_0x1848('0x3f')]){_0x12aaa6['include']=[{'all':!![]}];}_0x12aaa6=_[_0x1848('0x3a')]({},_0x12aaa6,_0x4f9933[_0x1848('0x3d')]);return db[_0x1848('0x28')][_0x1848('0x47')](_0x12aaa6)['then'](handleEntityNotFound(_0x48a532,null))[_0x1848('0x23')](respondWithResult(_0x48a532,null))[_0x1848('0x43')](handleError(_0x48a532,null));};exports[_0x1848('0x48')]=function(_0x234270,_0xccbdab){return db[_0x1848('0x28')][_0x1848('0x48')](_0x234270['body'],{})[_0x1848('0x23')](respondWithResult(_0xccbdab,0xc9))[_0x1848('0x43')](handleError(_0xccbdab,null));};exports[_0x1848('0x49')]=function(_0x511cdf,_0x104f47){if(_0x511cdf['body']['id']){delete _0x511cdf['body']['id'];}return db[_0x1848('0x28')][_0x1848('0x47')]({'where':{'id':_0x511cdf[_0x1848('0x45')]['id']}})['then'](handleEntityNotFound(_0x104f47,null))[_0x1848('0x23')](saveUpdates(_0x511cdf[_0x1848('0x4a')],null))[_0x1848('0x23')](respondWithResult(_0x104f47,null))[_0x1848('0x43')](handleError(_0x104f47,null));};exports[_0x1848('0x24')]=function(_0xbe738b,_0x7d714c){return db[_0x1848('0x28')][_0x1848('0x47')]({'where':{'id':_0xbe738b[_0x1848('0x45')]['id']}})[_0x1848('0x23')](handleEntityNotFound(_0x7d714c,null))[_0x1848('0x23')](removeEntity(_0x7d714c,null))[_0x1848('0x43')](handleError(_0x7d714c,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f50976f..634be75 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 _0x49f8=['./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','api','moment','request-promise','rimraf'];(function(_0x518cc0,_0x4e38ab){var _0x281183=function(_0x2ffafe){while(--_0x2ffafe){_0x518cc0['push'](_0x518cc0['shift']());}};_0x281183(++_0x4e38ab);}(_0x49f8,0xff));var _0x849f=function(_0x2009c8,_0x407d34){_0x2009c8=_0x2009c8-0x0;var _0x2560c4=_0x49f8[_0x2009c8];return _0x2560c4;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x849f('0x1'));var moment=require(_0x849f('0x2'));var BPromise=require('bluebird');var rp=require(_0x849f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x849f('0x4'));var config=require('../../config/environment');var attributes=require(_0x849f('0x5'));module['exports']=function(_0x1e8405,_0x30ebab){return _0x1e8405[_0x849f('0x6')](_0x849f('0x7'),attributes,{'tableName':_0x849f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x849f('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbb59=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbb59,0xec));var _0x9bb5=function(_0x55d14b,_0x3c8aa1){_0x55d14b=_0x55d14b-0x0;var _0x2f8248=_0xbb59[_0x55d14b];return _0x2f8248;};'use strict';var _=require(_0x9bb5('0x0'));var util=require(_0x9bb5('0x1'));var logger=require(_0x9bb5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9bb5('0x3'));var rp=require(_0x9bb5('0x4'));var fs=require('fs');var path=require(_0x9bb5('0x5'));var rimraf=require(_0x9bb5('0x6'));var config=require(_0x9bb5('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0x9bb5('0x8')]=function(_0x2c85f4,_0x1e57b2){return _0x2c85f4[_0x9bb5('0x9')](_0x9bb5('0xa'),attributes,{'tableName':_0x9bb5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9bb5('0xc'),'collate':_0x9bb5('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 10edb18..4714671 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 _0xa751=['rpc','jayson/promise','client','http','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x16cb23,_0x598d53){var _0x560160=function(_0x3a7c7a){while(--_0x3a7c7a){_0x16cb23['push'](_0x16cb23['shift']());}};_0x560160(++_0x598d53);}(_0xa751,0x175));var _0x1a75=function(_0x43ec4d,_0x486dd5){_0x43ec4d=_0x43ec4d-0x0;var _0xe1b58d=_0xa751[_0x43ec4d];return _0xe1b58d;};'use strict';var _=require(_0x1a75('0x0'));var util=require(_0x1a75('0x1'));var moment=require(_0x1a75('0x2'));var BPromise=require(_0x1a75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a75('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a75('0x5'));var logger=require(_0x1a75('0x6'))(_0x1a75('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a75('0x8'));var client=jayson[_0x1a75('0x9')][_0x1a75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2af95b,_0x1ec106,_0x692ac0){return new BPromise(function(_0x4537f6,_0x5d6faa){return client['request'](_0x2af95b,_0x692ac0)['then'](function(_0x41aa8f){logger[_0x1a75('0xb')](_0x1a75('0xc'),_0x1ec106,_0x1a75('0xd'));logger[_0x1a75('0xe')](_0x1a75('0xf'),_0x1ec106,_0x1a75('0xd'),JSON[_0x1a75('0x10')](_0x41aa8f));if(_0x41aa8f['error']){if(_0x41aa8f['error']['code']===0x1f4){logger[_0x1a75('0x11')](_0x1a75('0xc'),_0x1ec106,_0x41aa8f[_0x1a75('0x11')][_0x1a75('0x12')]);return _0x5d6faa(_0x41aa8f['error']['message']);}logger[_0x1a75('0x11')](_0x1a75('0xc'),_0x1ec106,_0x41aa8f['error'][_0x1a75('0x12')]);return _0x4537f6(_0x41aa8f[_0x1a75('0x11')]['message']);}else{logger[_0x1a75('0xb')](_0x1a75('0xc'),_0x1ec106,_0x1a75('0xd'));_0x4537f6(_0x41aa8f['result']['message']);}})['catch'](function(_0x471b90){logger[_0x1a75('0x11')](_0x1a75('0xc'),_0x1ec106,_0x471b90);_0x5d6faa(_0x471b90);});});} \ No newline at end of file +var _0x363e=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x363e,0x179));var _0xe363=function(_0x42015a,_0x459f91){_0x42015a=_0x42015a-0x0;var _0xdafdfb=_0x363e[_0x42015a];return _0xdafdfb;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var moment=require('moment');var BPromise=require(_0xe363('0x2'));var rs=require(_0xe363('0x3'));var fs=require('fs');var Redis=require(_0xe363('0x4'));var db=require(_0xe363('0x5'))['db'];var utils=require(_0xe363('0x6'));var logger=require(_0xe363('0x7'))(_0xe363('0x8'));var config=require(_0xe363('0x9'));var jayson=require(_0xe363('0xa'));var client=jayson[_0xe363('0xb')][_0xe363('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fe10b,_0x1fc808,_0x30bffc){return new BPromise(function(_0xc5df66,_0x29d330){return client['request'](_0x4fe10b,_0x30bffc)[_0xe363('0xd')](function(_0x308de7){logger[_0xe363('0xe')](_0xe363('0xf'),_0x1fc808,_0xe363('0x10'));logger[_0xe363('0x11')](_0xe363('0x12'),_0x1fc808,'request\x20sent',JSON[_0xe363('0x13')](_0x308de7));if(_0x308de7[_0xe363('0x14')]){if(_0x308de7['error'][_0xe363('0x15')]===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0x29d330(_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);}logger[_0xe363('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0xc5df66(_0x308de7['error'][_0xe363('0x16')]);}else{logger[_0xe363('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1fc808,_0xe363('0x10'));_0xc5df66(_0x308de7[_0xe363('0x17')]['message']);}})[_0xe363('0x18')](function(_0xc94d0a){logger['error'](_0xe363('0xf'),_0x1fc808,_0xc94d0a);_0x29d330(_0xc94d0a);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 156b9f0..f61fbdf 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 _0xbe60=['../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','create','/:id/messages','addMessage','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:destroy','destroy','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x43c76e,_0x3be843){var _0x5c7652=function(_0x13c8a5){while(--_0x13c8a5){_0x43c76e['push'](_0x43c76e['shift']());}};_0x5c7652(++_0x3be843);}(_0xbe60,0x1b9));var _0x0be6=function(_0x3cd1b9,_0x375f5d){_0x3cd1b9=_0x3cd1b9-0x0;var _0x54ebe0=_0xbe60[_0x3cd1b9];return _0x54ebe0;};'use strict';var multer=require(_0x0be6('0x0'));var util=require(_0x0be6('0x1'));var path=require(_0x0be6('0x2'));var timeout=require(_0x0be6('0x3'));var express=require(_0x0be6('0x4'));var router=express[_0x0be6('0x5')]();var auth=require(_0x0be6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0be6('0x7'));var controller=require(_0x0be6('0x8'));router[_0x0be6('0x9')]('/',auth[_0x0be6('0xa')](),controller[_0x0be6('0xb')]);router[_0x0be6('0x9')]('/describe',auth[_0x0be6('0xa')](),controller[_0x0be6('0xc')]);router[_0x0be6('0x9')](_0x0be6('0xd'),auth[_0x0be6('0xa')](),controller[_0x0be6('0xe')]);router['get']('/:id/messages',auth[_0x0be6('0xa')](),controller[_0x0be6('0xf')]);router[_0x0be6('0x9')](_0x0be6('0x10'),auth['isAuthenticated'](),controller[_0x0be6('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0be6('0x12')]);router['post'](_0x0be6('0x13'),auth['isAuthenticated'](),controller[_0x0be6('0x14')]);router[_0x0be6('0x15')](_0x0be6('0x16'),auth['isAuthenticated'](),interaction[_0x0be6('0x17')](_0x0be6('0x18'),_0x0be6('0x19')),controller[_0x0be6('0x1a')]);router[_0x0be6('0x1b')](_0x0be6('0xd'),auth['isAuthenticated'](),interaction[_0x0be6('0x17')]('whatsapp','whatsappinteraction:update'),controller['update']);router['delete'](_0x0be6('0xd'),auth[_0x0be6('0xa')](),interaction[_0x0be6('0x17')](_0x0be6('0x18'),_0x0be6('0x1c')),controller[_0x0be6('0x1d')]);router[_0x0be6('0x1e')]('/:id/tags',auth[_0x0be6('0xa')](),controller['removeTags']);module[_0x0be6('0x1f')]=router; \ No newline at end of file +var _0xdc52=['Router','../../config/environment','get','index','isAuthenticated','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','addTags','put','whatsapp','whatsappinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc52,0x1bd));var _0x2dc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc52[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2dc5('0x0'));var util=require(_0x2dc5('0x1'));var path=require(_0x2dc5('0x2'));var timeout=require(_0x2dc5('0x3'));var express=require(_0x2dc5('0x4'));var router=express[_0x2dc5('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2dc5('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x2dc5('0x7')]('/',auth['isAuthenticated'](),controller[_0x2dc5('0x8')]);router[_0x2dc5('0x7')]('/describe',auth[_0x2dc5('0x9')](),controller['describe']);router[_0x2dc5('0x7')](_0x2dc5('0xa'),auth['isAuthenticated'](),controller[_0x2dc5('0xb')]);router[_0x2dc5('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2dc5('0xc')]);router[_0x2dc5('0x7')](_0x2dc5('0xd'),auth['isAuthenticated'](),controller[_0x2dc5('0xe')]);router[_0x2dc5('0xf')]('/',auth[_0x2dc5('0x9')](),controller[_0x2dc5('0x10')]);router[_0x2dc5('0xf')](_0x2dc5('0x11'),auth['isAuthenticated'](),controller[_0x2dc5('0x12')]);router[_0x2dc5('0xf')](_0x2dc5('0x13'),auth[_0x2dc5('0x9')](),interaction[_0x2dc5('0x14')]('whatsapp','whatsappinteraction:addtags'),controller[_0x2dc5('0x15')]);router[_0x2dc5('0x16')]('/:id',auth[_0x2dc5('0x9')](),interaction[_0x2dc5('0x14')](_0x2dc5('0x17'),_0x2dc5('0x18')),controller[_0x2dc5('0x19')]);router['delete']('/:id',auth[_0x2dc5('0x9')](),interaction['tracked'](_0x2dc5('0x17'),'whatsappinteraction:destroy'),controller[_0x2dc5('0x1a')]);router[_0x2dc5('0x1b')]('/:id/tags',auth[_0x2dc5('0x9')](),controller[_0x2dc5('0x1c')]);module[_0x2dc5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c4a3cc1..e8fb09b 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 _0xaf7f=['STRING','DATE','ENUM','out','sequelize','moment','BOOLEAN'];(function(_0x350220,_0x5f49f5){var _0x4251b9=function(_0xcaa79f){while(--_0xcaa79f){_0x350220['push'](_0x350220['shift']());}};_0x4251b9(++_0x5f49f5);}(_0xaf7f,0x177));var _0xfaf7=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xaf7f[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0xfaf7('0x0'));var moment=require(_0xfaf7('0x1'));module['exports']={'closed':{'type':Sequelize[_0xfaf7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfaf7('0x3')]},'phone':{'type':Sequelize[_0xfaf7('0x3')]},'read1stAt':{'type':Sequelize[_0xfaf7('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfaf7('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfaf7('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xfaf7('0x5')]('in',_0xfaf7('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x76a1=['DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0xdb1bf2,_0x243b95){var _0x1f76d1=function(_0x8cf2c1){while(--_0x8cf2c1){_0xdb1bf2['push'](_0xdb1bf2['shift']());}};_0x1f76d1(++_0x243b95);}(_0x76a1,0x115));var _0x176a=function(_0x5b037a,_0x18cfbc){_0x5b037a=_0x5b037a-0x0;var _0x3240e7=_0x76a1[_0x5b037a];return _0x3240e7;};'use strict';var Sequelize=require(_0x176a('0x0'));var moment=require(_0x176a('0x1'));module[_0x176a('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x176a('0x3')]},'disposition':{'type':Sequelize[_0x176a('0x4')]},'note':{'type':Sequelize[_0x176a('0x4')]},'phone':{'type':Sequelize[_0x176a('0x4')]},'read1stAt':{'type':Sequelize[_0x176a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x176a('0x5')]('in',_0x176a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x176a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x176a('0x5')]('in',_0x176a('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 84d6deb..8ff9e2d 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(_0x70327a,_0x3ca3df){var _0x255206=function(_0x4f4652){while(--_0x4f4652){_0x70327a['push'](_0x70327a['shift']());}};_0x255206(++_0x3ca3df);}(_0x814b,0x1a2));var _0xb814=function(_0x250f95,_0x5a5728){_0x250f95=_0x250f95-0x0;var _0x4ada97=_0x814b[_0x250f95];return _0x4ada97;};'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 _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x7a54,0x106));var _0x47a5=function(_0x5a2e1b,_0x55bd53){_0x5a2e1b=_0x5a2e1b-0x0;var _0x956bc3=_0x7a54[_0x5a2e1b];return _0x956bc3;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 239681e..99111f5 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 _0xc7c6=['findAll','emit','catch','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x2bcb1e,_0x2afd1d){var _0x53e732=function(_0x38a0d4){while(--_0x38a0d4){_0x2bcb1e['push'](_0x2bcb1e['shift']());}};_0x53e732(++_0x2afd1d);}(_0xc7c6,0x85));var _0x6c7c=function(_0x17c7d4,_0x2e0021){_0x17c7d4=_0x17c7d4-0x0;var _0x5757a7=_0xc7c6[_0x17c7d4];return _0x5757a7;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x6c7c('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x6c7c('0x0'))['db'][_0x6c7c('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6c7c('0x2')](0x0);var events={'afterCreate':_0x6c7c('0x3'),'afterUpdate':_0x6c7c('0x4'),'afterDestroy':_0x6c7c('0x5')};function emitEvent(_0x168a15){return function(_0x66b4,_0x28ed18,_0x1aa8b0){_0x66b4[_0x6c7c('0x6')]({'attributes':['id'],'raw':!![]})[_0x6c7c('0x7')](function(_0x403328){_0x66b4[_0x6c7c('0x8')](_0x6c7c('0x9'),_0x403328[_0x6c7c('0xa')](function(_0x1111b2){return{'id':_0x1111b2['id']};}));return WhatsappMessage[_0x6c7c('0xb')]({'where':{'WhatsappInteractionId':_0x66b4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1dee0f){_0x66b4[_0x6c7c('0x8')]('unreadMessages',_0x1dee0f['length']);WhatsappInteractionEvents[_0x6c7c('0xc')](_0x168a15+':'+_0x66b4['id'],_0x66b4);WhatsappInteractionEvents[_0x6c7c('0xc')](_0x168a15,_0x66b4);_0x1aa8b0(null);})[_0x6c7c('0xd')](_0x1aa8b0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x6c7c('0xe')](e,emitEvent(event));}}module[_0x6c7c('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xb8a9=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit'];(function(_0x5413eb,_0x108c04){var _0x6bf7c9=function(_0x2ddcbd){while(--_0x2ddcbd){_0x5413eb['push'](_0x5413eb['shift']());}};_0x6bf7c9(++_0x108c04);}(_0xb8a9,0x1f2));var _0x9b8a=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xb8a9[_0x5216e0];return _0x5b3f40;};'use strict';var EventEmitter=require(_0x9b8a('0x0'));var WhatsappInteraction=require(_0x9b8a('0x1'))['db'][_0x9b8a('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x9b8a('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9b8a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b8a('0x5'),'afterDestroy':_0x9b8a('0x6')};function emitEvent(_0x3cee91){return function(_0x579257,_0x36b479,_0x1cc118){_0x579257[_0x9b8a('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x43cdb8){_0x579257[_0x9b8a('0x8')]('Users',_0x43cdb8[_0x9b8a('0x9')](function(_0x13255c){return{'id':_0x13255c['id']};}));return WhatsappMessage[_0x9b8a('0xa')]({'where':{'WhatsappInteractionId':_0x579257['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9b8a('0xb')](function(_0x55746e){_0x579257['setDataValue'](_0x9b8a('0xc'),_0x55746e[_0x9b8a('0xd')]);WhatsappInteractionEvents[_0x9b8a('0xe')](_0x3cee91+':'+_0x579257['id'],_0x579257);WhatsappInteractionEvents['emit'](_0x3cee91,_0x579257);_0x1cc118(null);})[_0x9b8a('0xf')](_0x1cc118(null));};}for(var e in events){if(events[_0x9b8a('0x10')](e)){var event=events[e];WhatsappInteraction[_0x9b8a('0x11')](e,emitEvent(event));}}module[_0x9b8a('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index d616e6e..41d0e1f 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(_0xc6d77a,_0x4cd6fe){var _0x567b42=function(_0x48a279){while(--_0x48a279){_0xc6d77a['push'](_0xc6d77a['shift']());}};_0x567b42(++_0x4cd6fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x2efafb,_0x15c166){var _0xb3ffce=function(_0x5c8bc4){while(--_0x5c8bc4){_0x2efafb['push'](_0x2efafb['shift']());}};_0xb3ffce(++_0x15c166);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 e3a54b4..7071176 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 _0x6dc5=['catch','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappInteraction.socket','register','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','limit','addTags','ids','omit','spread','AddTags'];(function(_0x2ce033,_0x43fc42){var _0x5410c1=function(_0x4c4bb9){while(--_0x4c4bb9){_0x2ce033['push'](_0x2ce033['shift']());}};_0x5410c1(++_0x43fc42);}(_0x6dc5,0x1a3));var _0x56dc=function(_0x385e05,_0x5d25ca){_0x385e05=_0x385e05-0x0;var _0x10660d=_0x6dc5[_0x385e05];return _0x10660d;};'use strict';var _=require('lodash');var util=require(_0x56dc('0x0'));var moment=require(_0x56dc('0x1'));var BPromise=require('bluebird');var rs=require(_0x56dc('0x2'));var fs=require('fs');var Redis=require(_0x56dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x56dc('0x4'))(_0x56dc('0x5'));var config=require(_0x56dc('0x6'));var jayson=require(_0x56dc('0x7'));var client=jayson['client'][_0x56dc('0x8')]({'port':0x232a});config[_0x56dc('0x9')]=_[_0x56dc('0xa')](config[_0x56dc('0x9')],{'host':_0x56dc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56dc('0x9')]));require(_0x56dc('0xc'))[_0x56dc('0xd')](socket);function respondWithRpcPromise(_0x1a7bd8,_0x1d93e9,_0x56d57d){return new BPromise(function(_0x1e6739,_0x5b802f){return client['request'](_0x1a7bd8,_0x56d57d)[_0x56dc('0xe')](function(_0x7015e8){logger[_0x56dc('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d93e9,_0x56dc('0x10'));logger[_0x56dc('0x11')](_0x56dc('0x12'),_0x1d93e9,_0x56dc('0x10'),JSON[_0x56dc('0x13')](_0x7015e8));if(_0x7015e8[_0x56dc('0x14')]){if(_0x7015e8[_0x56dc('0x14')][_0x56dc('0x15')]===0x1f4){logger[_0x56dc('0x14')](_0x56dc('0x16'),_0x1d93e9,_0x7015e8[_0x56dc('0x14')][_0x56dc('0x17')]);return _0x5b802f(_0x7015e8[_0x56dc('0x14')]['message']);}logger[_0x56dc('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d93e9,_0x7015e8[_0x56dc('0x14')][_0x56dc('0x17')]);return _0x1e6739(_0x7015e8[_0x56dc('0x14')][_0x56dc('0x17')]);}else{logger[_0x56dc('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d93e9,'request\x20sent');_0x1e6739(_0x7015e8[_0x56dc('0x18')]['message']);}})['catch'](function(_0x2a11cb){logger[_0x56dc('0x14')](_0x56dc('0x16'),_0x1d93e9,_0x2a11cb);_0x5b802f(_0x2a11cb);});});}exports[_0x56dc('0x19')]=function(_0x5ec0ae){var _0x25ee11=this;return new Promise(function(_0x315c25,_0x35fa98){return db[_0x56dc('0x1a')]['update'](_0x5ec0ae[_0x56dc('0x1b')],{'raw':_0x5ec0ae[_0x56dc('0x1c')]?_0x5ec0ae[_0x56dc('0x1c')][_0x56dc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ec0ae[_0x56dc('0x1c')]?_0x5ec0ae[_0x56dc('0x1c')][_0x56dc('0x1e')]||null:null,'attributes':_0x5ec0ae[_0x56dc('0x1c')]?_0x5ec0ae['options']['attributes']||null:null,'limit':_0x5ec0ae[_0x56dc('0x1c')]?_0x5ec0ae[_0x56dc('0x1c')][_0x56dc('0x1f')]||null:null})['then'](function(_0x577d6c){logger[_0x56dc('0xf')](_0x56dc('0x19'),_0x5ec0ae);logger[_0x56dc('0x11')](_0x56dc('0x19'),_0x5ec0ae,JSON[_0x56dc('0x13')](_0x577d6c));_0x315c25(_0x577d6c);})['catch'](function(_0x447e13){logger[_0x56dc('0x14')](_0x56dc('0x19'),_0x447e13['message'],_0x5ec0ae);_0x35fa98(_0x25ee11['error'](0x1f4,_0x447e13[_0x56dc('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x10465f){return new Promise(function(_0xafa366,_0x299a95){return db[_0x56dc('0x1a')]['find']({'where':_0x10465f[_0x56dc('0x1c')]?_0x10465f['options']['where']||null:null})[_0x56dc('0xe')](function(_0x26a0cd){if(_0x26a0cd){return _0x26a0cd[_0x56dc('0x20')](_0x10465f[_0x56dc('0x1b')][_0x56dc('0x21')],_[_0x56dc('0x22')](_0x10465f[_0x56dc('0x1b')],[_0x56dc('0x21'),'id'])||{});}})[_0x56dc('0x23')](function(_0x43b173){logger[_0x56dc('0xf')](_0x56dc('0x24'),_0x10465f);logger[_0x56dc('0x11')](_0x56dc('0x24'),_0x10465f,JSON[_0x56dc('0x13')](_0x43b173));_0xafa366(_0x43b173);})[_0x56dc('0x25')](function(_0x2b8dfa){logger[_0x56dc('0x14')](_0x56dc('0x24'),_0x2b8dfa[_0x56dc('0x17')],_0x10465f);_0x299a95(_this['error'](0x1f4,_0x2b8dfa['message']));});});}; \ No newline at end of file +var _0xdb6b=['rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateWhatsappInteraction','update','body','options','raw','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','addTags','ids','spread','AddTags','debug','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x26baca,_0x1b0e33){var _0xbb37e5=function(_0xa7bf28){while(--_0xa7bf28){_0x26baca['push'](_0x26baca['shift']());}};_0xbb37e5(++_0x1b0e33);}(_0xdb6b,0x139));var _0xbdb6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb6b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbdb6('0x0'));var util=require(_0xbdb6('0x1'));var moment=require(_0xbdb6('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdb6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdb6('0x4'))['db'];var utils=require(_0xbdb6('0x5'));var logger=require(_0xbdb6('0x6'))(_0xbdb6('0x7'));var config=require(_0xbdb6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbdb6('0x9')]['http']({'port':0x232a});config['redis']=_[_0xbdb6('0xa')](config[_0xbdb6('0xb')],{'host':_0xbdb6('0xc'),'port':0x18eb});var socket=require(_0xbdb6('0xd'))(new Redis(config[_0xbdb6('0xb')]));require(_0xbdb6('0xe'))[_0xbdb6('0xf')](socket);function respondWithRpcPromise(_0x37b907,_0x4e920d,_0x8410e9){return new BPromise(function(_0x2dae85,_0x502db9){return client[_0xbdb6('0x10')](_0x37b907,_0x8410e9)[_0xbdb6('0x11')](function(_0xe17f1a){logger[_0xbdb6('0x12')](_0xbdb6('0x13'),_0x4e920d,_0xbdb6('0x14'));logger['debug'](_0xbdb6('0x15'),_0x4e920d,'request\x20sent',JSON[_0xbdb6('0x16')](_0xe17f1a));if(_0xe17f1a[_0xbdb6('0x17')]){if(_0xe17f1a[_0xbdb6('0x17')]['code']===0x1f4){logger['error'](_0xbdb6('0x13'),_0x4e920d,_0xe17f1a[_0xbdb6('0x17')][_0xbdb6('0x18')]);return _0x502db9(_0xe17f1a['error'][_0xbdb6('0x18')]);}logger[_0xbdb6('0x17')](_0xbdb6('0x13'),_0x4e920d,_0xe17f1a['error'][_0xbdb6('0x18')]);return _0x2dae85(_0xe17f1a[_0xbdb6('0x17')]['message']);}else{logger['info'](_0xbdb6('0x13'),_0x4e920d,'request\x20sent');_0x2dae85(_0xe17f1a['result'][_0xbdb6('0x18')]);}})['catch'](function(_0x3ca2b9){logger[_0xbdb6('0x17')](_0xbdb6('0x13'),_0x4e920d,_0x3ca2b9);_0x502db9(_0x3ca2b9);});});}exports[_0xbdb6('0x19')]=function(_0x5d0326){var _0x3e1550=this;return new Promise(function(_0x1fbba2,_0x7d2d35){return db['WhatsappInteraction'][_0xbdb6('0x1a')](_0x5d0326[_0xbdb6('0x1b')],{'raw':_0x5d0326[_0xbdb6('0x1c')]?_0x5d0326[_0xbdb6('0x1c')][_0xbdb6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d0326['options']?_0x5d0326[_0xbdb6('0x1c')]['where']||null:null,'attributes':_0x5d0326[_0xbdb6('0x1c')]?_0x5d0326['options']['attributes']||null:null,'limit':_0x5d0326[_0xbdb6('0x1c')]?_0x5d0326['options']['limit']||null:null})['then'](function(_0x1f7fb7){logger[_0xbdb6('0x12')]('UpdateWhatsappInteraction',_0x5d0326);logger['debug'](_0xbdb6('0x19'),_0x5d0326,JSON['stringify'](_0x1f7fb7));_0x1fbba2(_0x1f7fb7);})['catch'](function(_0x3e5599){logger['error'](_0xbdb6('0x19'),_0x3e5599['message'],_0x5d0326);_0x7d2d35(_0x3e1550[_0xbdb6('0x17')](0x1f4,_0x3e5599[_0xbdb6('0x18')]));});});};exports[_0xbdb6('0x1e')]=function(_0x3370ac){return new Promise(function(_0x2779c3,_0x362681){return db[_0xbdb6('0x1f')][_0xbdb6('0x20')]({'where':_0x3370ac[_0xbdb6('0x1c')]?_0x3370ac[_0xbdb6('0x1c')][_0xbdb6('0x21')]||null:null})['then'](function(_0x47d8e4){if(_0x47d8e4){return _0x47d8e4[_0xbdb6('0x22')](_0x3370ac[_0xbdb6('0x1b')][_0xbdb6('0x23')],_['omit'](_0x3370ac[_0xbdb6('0x1b')],['ids','id'])||{});}})[_0xbdb6('0x24')](function(_0x7cb20f){logger['info'](_0xbdb6('0x25'),_0x3370ac);logger[_0xbdb6('0x26')](_0xbdb6('0x25'),_0x3370ac,JSON[_0xbdb6('0x16')](_0x7cb20f));_0x2779c3(_0x7cb20f);})[_0xbdb6('0x27')](function(_0x21b9ad){logger['error'](_0xbdb6('0x25'),_0x21b9ad[_0xbdb6('0x18')],_0x3370ac);_0x362681(_this[_0xbdb6('0x17')](0x1f4,_0x21b9ad['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index aa617c7..69d637a 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 _0xb44d=['emit','removeListener','register','./whatsappInteraction.events','save','remove','update'];(function(_0x133675,_0x2f3b8c){var _0xc19366=function(_0x491264){while(--_0x491264){_0x133675['push'](_0x133675['shift']());}};_0xc19366(++_0x2f3b8c);}(_0xb44d,0x1d1));var _0xdb44=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb44d[_0x2f5ac5];return _0x37c9a8;};'use strict';var WhatsappInteractionEvents=require(_0xdb44('0x0'));var events=[_0xdb44('0x1'),_0xdb44('0x2'),_0xdb44('0x3')];function createListener(_0x2e9128,_0x2d929a){return function(_0x5da684){_0x2d929a[_0xdb44('0x4')](_0x2e9128,_0x5da684);};}function removeListener(_0x4a14c7,_0x2d22ea){return function(){WhatsappInteractionEvents[_0xdb44('0x5')](_0x4a14c7,_0x2d22ea);};}exports[_0xdb44('0x6')]=function(_0x27d030){for(var _0x35b6b7=0x0,_0x29cd5e=events['length'];_0x35b6b7<_0x29cd5e;_0x35b6b7++){var _0x5189b9=events[_0x35b6b7];var _0x18ddee=createListener('whatsappInteraction:'+_0x5189b9,_0x27d030);WhatsappInteractionEvents['on'](_0x5189b9,_0x18ddee);}}; \ No newline at end of file +var _0x2d48=['removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x4324e3,_0x17d826){var _0x114577=function(_0x65c5bb){while(--_0x65c5bb){_0x4324e3['push'](_0x4324e3['shift']());}};_0x114577(++_0x17d826);}(_0x2d48,0x153));var _0x82d4=function(_0x426323,_0x2ce530){_0x426323=_0x426323-0x0;var _0xa347f6=_0x2d48[_0x426323];return _0xa347f6;};'use strict';var WhatsappInteractionEvents=require(_0x82d4('0x0'));var events=[_0x82d4('0x1'),_0x82d4('0x2'),_0x82d4('0x3')];function createListener(_0x58b08d,_0x3cde8b){return function(_0x5b8ea5){_0x3cde8b[_0x82d4('0x4')](_0x58b08d,_0x5b8ea5);};}function removeListener(_0x2fe022,_0x2d0fc9){return function(){WhatsappInteractionEvents[_0x82d4('0x5')](_0x2fe022,_0x2d0fc9);};}exports[_0x82d4('0x6')]=function(_0x37c8ae){for(var _0x332ca4=0x0,_0x174a36=events['length'];_0x332ca4<_0x174a36;_0x332ca4++){var _0x3a90bb=events[_0x332ca4];var _0x58c16d=createListener(_0x82d4('0x7')+_0x3a90bb,_0x37c8ae);WhatsappInteractionEvents['on'](_0x3a90bb,_0x58c16d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d5661c9..5ca192f 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 _0x05a8=['isAuthenticated','describe','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id','accept','reject','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./whatsappMessage.controller','get'];(function(_0x5ae549,_0x5858c1){var _0x5ba749=function(_0x14efa6){while(--_0x14efa6){_0x5ae549['push'](_0x5ae549['shift']());}};_0x5ba749(++_0x5858c1);}(_0x05a8,0x1f1));var _0x805a=function(_0x5670af,_0x5a8e09){_0x5670af=_0x5670af-0x0;var _0x41b33a=_0x05a8[_0x5670af];return _0x41b33a;};'use strict';var multer=require(_0x805a('0x0'));var util=require(_0x805a('0x1'));var path=require(_0x805a('0x2'));var timeout=require(_0x805a('0x3'));var express=require(_0x805a('0x4'));var router=express[_0x805a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x805a('0x6'));var controller=require(_0x805a('0x7'));router[_0x805a('0x8')]('/',auth[_0x805a('0x9')](),controller['index']);router[_0x805a('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x805a('0xa')]);router[_0x805a('0x8')]('/:id',auth[_0x805a('0x9')](),controller[_0x805a('0xb')]);router[_0x805a('0xc')]('/',auth[_0x805a('0x9')](),interaction[_0x805a('0xd')](_0x805a('0xe'),_0x805a('0xf')),controller['create']);router[_0x805a('0xc')](_0x805a('0x10'),controller[_0x805a('0x11')]);router[_0x805a('0x12')](_0x805a('0x13'),auth[_0x805a('0x9')](),controller['update']);router[_0x805a('0x12')]('/:id/accept',auth[_0x805a('0x9')](),controller[_0x805a('0x14')]);router[_0x805a('0x12')]('/:id/reject',auth[_0x805a('0x9')](),controller[_0x805a('0x15')]);router['delete']('/:id',auth[_0x805a('0x9')](),controller['destroy']);module[_0x805a('0x16')]=router; \ No newline at end of file +var _0x7780=['post','/:id/status','status','put','update','accept','/:id/reject','delete','/:id','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','show','whatsappmessage:create','create'];(function(_0x4853a3,_0x2661bf){var _0x2d2f30=function(_0x5716f0){while(--_0x5716f0){_0x4853a3['push'](_0x4853a3['shift']());}};_0x2d2f30(++_0x2661bf);}(_0x7780,0x181));var _0x0778=function(_0x4d93c9,_0x4775ae){_0x4d93c9=_0x4d93c9-0x0;var _0x48536d=_0x7780[_0x4d93c9];return _0x48536d;};'use strict';var multer=require(_0x0778('0x0'));var util=require(_0x0778('0x1'));var path=require(_0x0778('0x2'));var timeout=require(_0x0778('0x3'));var express=require(_0x0778('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0778('0x5'));var config=require(_0x0778('0x6'));var controller=require(_0x0778('0x7'));router[_0x0778('0x8')]('/',auth[_0x0778('0x9')](),controller[_0x0778('0xa')]);router[_0x0778('0x8')](_0x0778('0xb'),auth[_0x0778('0x9')](),controller['describe']);router[_0x0778('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0778('0xc')]);router['post']('/',auth[_0x0778('0x9')](),interaction['tracked']('whatsapp',_0x0778('0xd')),controller[_0x0778('0xe')]);router[_0x0778('0xf')](_0x0778('0x10'),controller[_0x0778('0x11')]);router[_0x0778('0x12')]('/:id',auth[_0x0778('0x9')](),controller[_0x0778('0x13')]);router['put']('/:id/accept',auth[_0x0778('0x9')](),controller[_0x0778('0x14')]);router[_0x0778('0x12')](_0x0778('0x15'),auth[_0x0778('0x9')](),controller['reject']);router[_0x0778('0x16')](_0x0778('0x17'),auth[_0x0778('0x9')](),controller[_0x0778('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c43103b..7510638 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 _0x56dc=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc56d('0x0'));module['exports']={'body':{'type':Sequelize[_0xc56d('0x1')](_0xc56d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc56d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc56d('0x4')]('in',_0xc56d('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xc56d('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc56d('0x6')]},'readAt':{'type':Sequelize[_0xc56d('0x7')]},'secret':{'type':Sequelize[_0xc56d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xba92=['DATE','BOOLEAN','sequelize','exports','TEXT','ENUM','out','STRING'];(function(_0x3bd36e,_0x4b29df){var _0x1f731f=function(_0x2fd8aa){while(--_0x2fd8aa){_0x3bd36e['push'](_0x3bd36e['shift']());}};_0x1f731f(++_0x4b29df);}(_0xba92,0x1e2));var _0x2ba9=function(_0xff41d7,_0x3fde9c){_0xff41d7=_0xff41d7-0x0;var _0x4f831e=_0xba92[_0xff41d7];return _0x4f831e;};'use strict';var Sequelize=require(_0x2ba9('0x0'));module[_0x2ba9('0x1')]={'body':{'type':Sequelize[_0x2ba9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2ba9('0x3')]('in',_0x2ba9('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2ba9('0x5')](0xbe)},'phone':{'type':Sequelize[_0x2ba9('0x5')]},'readAt':{'type':Sequelize[_0x2ba9('0x6')]},'secret':{'type':Sequelize[_0x2ba9('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5706544..8bc6a5f 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 _0x3ff6=['messageId','MessageStatus','inspect','rimraf','zip-dir','bluebird','mustache','util','sox','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','apply','reject','save','destroy','end','stack','name','send','index','WhatsappMessage','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','show','params','include','create','update','body','find','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp','agent','interaction','info','role','RejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid'];(function(_0x2aa2f4,_0xc8626d){var _0xbdee62=function(_0x413ca6){while(--_0x413ca6){_0x2aa2f4['push'](_0x2aa2f4['shift']());}};_0xbdee62(++_0xc8626d);}(_0x3ff6,0x84));var _0x63ff=function(_0x51db73,_0x4e32f8){_0x51db73=_0x51db73-0x0;var _0x6e43d2=_0x3ff6[_0x51db73];return _0x6e43d2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x63ff('0x0'));var zipdir=require(_0x63ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x63ff('0x2'));var Mustache=require(_0x63ff('0x3'));var util=require(_0x63ff('0x4'));var path=require('path');var sox=require(_0x63ff('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x63ff('0x6'));var crypto=require('crypto');var jsforce=require(_0x63ff('0x7'));var deskjs=require(_0x63ff('0x8'));var toCsv=require(_0x63ff('0x9'));var querystring=require('querystring');var Papa=require(_0x63ff('0xa'));var Redis=require(_0x63ff('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x63ff('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63ff('0xd'));var logger=require(_0x63ff('0xe'))(_0x63ff('0xf'));var utils=require(_0x63ff('0x10'));var config=require(_0x63ff('0x11'));var db=require(_0x63ff('0x12'))['db'];config[_0x63ff('0x13')]=_[_0x63ff('0x14')](config[_0x63ff('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x63ff('0x15'))(new Redis(config[_0x63ff('0x13')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x63ff('0x16'));var client=jayson[_0x63ff('0x17')][_0x63ff('0x18')]({'port':0x232c});var client9002=jayson['client'][_0x63ff('0x18')]({'port':0x232a});function checkPasswordPattern(_0x1e2e65,_0x39f461,_0x28f126){if(_0x28f126){var _0x41f687=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41f687[_0x63ff('0x19')](_0x39f461)){return _0x1e2e65;}else{throw new db[(_0x63ff('0x1a'))][(_0x63ff('0x1b'))](_0x63ff('0x1c'));}}else{return _0x1e2e65;}}function respondWithRpcPromise(_0x8c4e09,_0x5d7c50,_0x2cdec2,_0x462e88){return new BPromise(function(_0x7d6658,_0x1560a5){var _0x2f4c4a=_0x462e88||client;return _0x2f4c4a[_0x63ff('0x1d')](_0x8c4e09,_0x2cdec2)[_0x63ff('0x1e')](function(_0x390197){logger['info'](_0x63ff('0x1f'),_0x5d7c50,_0x63ff('0x20'));logger['debug'](_0x63ff('0x21'),_0x5d7c50,_0x63ff('0x20'),JSON[_0x63ff('0x22')](_0x390197));if(_0x390197[_0x63ff('0x23')]){if(_0x390197[_0x63ff('0x23')][_0x63ff('0x24')]===0x1f4){logger['error'](_0x63ff('0x1f'),_0x5d7c50,_0x390197[_0x63ff('0x23')][_0x63ff('0x25')]);return _0x1560a5(_0x390197[_0x63ff('0x23')][_0x63ff('0x25')]);}logger[_0x63ff('0x23')](_0x63ff('0x1f'),_0x5d7c50,_0x390197['error'][_0x63ff('0x25')]);return _0x7d6658(_0x390197[_0x63ff('0x23')][_0x63ff('0x25')]);}else{logger['info'](_0x63ff('0x1f'),_0x5d7c50,'request\x20sent');_0x7d6658(_0x390197[_0x63ff('0x26')][_0x63ff('0x25')]);}})[_0x63ff('0x27')](function(_0x4dc54a){logger[_0x63ff('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x5d7c50,_0x4dc54a);_0x1560a5(_0x4dc54a);});});}function respondWithStatusCode(_0x33d1ab,_0x555133){_0x555133=_0x555133||0xcc;return function(_0x583058){if(_0x583058){return _0x33d1ab[_0x63ff('0x28')](_0x555133);}return _0x33d1ab[_0x63ff('0x29')](_0x555133)['end']();};}function respondWithResult(_0x403bf1,_0x34a86d){_0x34a86d=_0x34a86d||0xc8;return function(_0x4569b4){if(_0x4569b4){return _0x403bf1['status'](_0x34a86d)[_0x63ff('0x2a')](_0x4569b4);}};}function respondWithFilteredResult(_0x1dd92f,_0x5eb0ce){return function(_0x488734){if(_0x488734){var _0x463def=_0x488734['count'],_0x5ecac7=_0x5eb0ce[_0x63ff('0x2b')],_0x5306f9=_0x5eb0ce[_0x63ff('0x2b')]+_0x5eb0ce[_0x63ff('0x2c')],_0x46c6f5;if(_0x5306f9>=_0x463def){_0x5306f9=_0x463def;_0x46c6f5=0xc8;}else{_0x46c6f5=0xce;}_0x1dd92f[_0x63ff('0x29')](_0x46c6f5);return _0x1dd92f[_0x63ff('0x2d')]('Content-Range',_0x5ecac7+'-'+_0x5306f9+'/'+_0x463def)[_0x63ff('0x2a')](_0x488734);}return null;};}function patchUpdates(_0x5e931e){return function(_0x48ebb0){try{jsonpatch[_0x63ff('0x2e')](_0x48ebb0,_0x5e931e,!![]);}catch(_0x3baa15){return BPromise[_0x63ff('0x2f')](_0x3baa15);}return _0x48ebb0[_0x63ff('0x30')]();};}function saveUpdates(_0x26f097,_0x38aab3){return function(_0x284b9f){if(_0x284b9f){return _0x284b9f['update'](_0x26f097)[_0x63ff('0x1e')](function(_0x489c40){return _0x489c40;});}return null;};}function removeEntity(_0x248917,_0x23c443){return function(_0x393c25){if(_0x393c25){return _0x393c25[_0x63ff('0x31')]()[_0x63ff('0x1e')](function(){_0x248917[_0x63ff('0x29')](0xcc)[_0x63ff('0x32')]();});}};}function handleEntityNotFound(_0x285331,_0x11bff9){return function(_0xa94611){if(!_0xa94611){_0x285331['sendStatus'](0x194);}return _0xa94611;};}function handleError(_0x1fbe0f,_0x54cd73){_0x54cd73=_0x54cd73||0x1f4;return function(_0x2a3f21){logger[_0x63ff('0x23')](_0x2a3f21[_0x63ff('0x33')]);if(_0x2a3f21['name']){delete _0x2a3f21[_0x63ff('0x34')];}_0x1fbe0f['status'](_0x54cd73)[_0x63ff('0x35')](_0x2a3f21);};}exports[_0x63ff('0x36')]=function(_0x2f1c97,_0x5911d2){var _0x40f401={},_0x1eb8d2={},_0x59956d={'count':0x0,'rows':[]};var _0x4cbc52=_['map'](db[_0x63ff('0x37')][_0x63ff('0x38')],function(_0x322841){return{'name':_0x322841['fieldName'],'type':_0x322841[_0x63ff('0x39')][_0x63ff('0x3a')]};});_0x1eb8d2[_0x63ff('0x3b')]=_[_0x63ff('0x3c')](_0x4cbc52,_0x63ff('0x34'));_0x1eb8d2['query']=_[_0x63ff('0x3d')](_0x2f1c97[_0x63ff('0x3e')]);_0x1eb8d2[_0x63ff('0x3f')]=_['intersection'](_0x1eb8d2[_0x63ff('0x3b')],_0x1eb8d2[_0x63ff('0x3e')]);_0x40f401['attributes']=_[_0x63ff('0x40')](_0x1eb8d2[_0x63ff('0x3b')],qs[_0x63ff('0x41')](_0x2f1c97[_0x63ff('0x3e')][_0x63ff('0x41')]));_0x40f401[_0x63ff('0x42')]=_0x40f401[_0x63ff('0x42')][_0x63ff('0x43')]?_0x40f401[_0x63ff('0x42')]:_0x1eb8d2[_0x63ff('0x3b')];if(!_0x2f1c97[_0x63ff('0x3e')][_0x63ff('0x44')](_0x63ff('0x45'))){_0x40f401[_0x63ff('0x2c')]=qs[_0x63ff('0x2c')](_0x2f1c97[_0x63ff('0x3e')]['limit']);_0x40f401[_0x63ff('0x2b')]=qs['offset'](_0x2f1c97['query'][_0x63ff('0x2b')]);}_0x40f401[_0x63ff('0x46')]=qs['sort'](_0x2f1c97[_0x63ff('0x3e')][_0x63ff('0x47')]);_0x40f401[_0x63ff('0x48')]=qs['filters'](_[_0x63ff('0x49')](_0x2f1c97[_0x63ff('0x3e')],_0x1eb8d2[_0x63ff('0x3f')]),_0x4cbc52);if(_0x2f1c97['query'][_0x63ff('0x4a')]){_0x40f401[_0x63ff('0x48')]=_[_0x63ff('0x4b')](_0x40f401['where'],{'$or':_[_0x63ff('0x3c')](_0x4cbc52,function(_0x24c952){if(_0x24c952[_0x63ff('0x39')]!==_0x63ff('0x4c')){var _0x41fab8={};_0x41fab8[_0x24c952[_0x63ff('0x34')]]={'$like':'%'+_0x2f1c97[_0x63ff('0x3e')]['filter']+'%'};return _0x41fab8;}})});}_0x40f401=_[_0x63ff('0x4b')]({},_0x40f401,_0x2f1c97[_0x63ff('0x4d')]);var _0x2c0468={'where':_0x40f401[_0x63ff('0x48')]};return db[_0x63ff('0x37')]['count'](_0x2c0468)[_0x63ff('0x1e')](function(_0x5e98cb){_0x59956d[_0x63ff('0x4e')]=_0x5e98cb;if(_0x2f1c97[_0x63ff('0x3e')][_0x63ff('0x4f')]){_0x40f401['include']=[{'all':!![]}];}return db[_0x63ff('0x37')]['findAll'](_0x40f401);})[_0x63ff('0x1e')](function(_0x54d6ea){_0x59956d[_0x63ff('0x50')]=_0x54d6ea;return _0x59956d;})['then'](respondWithFilteredResult(_0x5911d2,_0x40f401))[_0x63ff('0x27')](handleError(_0x5911d2,null));};exports[_0x63ff('0x51')]=function(_0x63fe68,_0x4fef76){var _0x3f2002={'raw':!![],'where':{'id':_0x63fe68[_0x63ff('0x52')]['id']}},_0x32063d={};_0x32063d[_0x63ff('0x3b')]=_['keys'](db['WhatsappMessage'][_0x63ff('0x38')]);_0x32063d['query']=_['keys'](_0x63fe68['query']);_0x32063d[_0x63ff('0x3f')]=_[_0x63ff('0x40')](_0x32063d[_0x63ff('0x3b')],_0x32063d[_0x63ff('0x3e')]);_0x3f2002[_0x63ff('0x42')]=_[_0x63ff('0x40')](_0x32063d[_0x63ff('0x3b')],qs[_0x63ff('0x41')](_0x63fe68['query']['fields']));_0x3f2002[_0x63ff('0x42')]=_0x3f2002[_0x63ff('0x42')][_0x63ff('0x43')]?_0x3f2002['attributes']:_0x32063d['model'];if(_0x63fe68[_0x63ff('0x3e')][_0x63ff('0x4f')]){_0x3f2002[_0x63ff('0x53')]=[{'all':!![]}];}_0x3f2002=_[_0x63ff('0x4b')]({},_0x3f2002,_0x63fe68['options']);return db['WhatsappMessage']['find'](_0x3f2002)[_0x63ff('0x1e')](handleEntityNotFound(_0x4fef76,null))[_0x63ff('0x1e')](respondWithResult(_0x4fef76,null))[_0x63ff('0x27')](handleError(_0x4fef76,null));};exports['create']=function(_0x479643,_0xdeda45){return db[_0x63ff('0x37')][_0x63ff('0x54')](_0x479643['body'],{})[_0x63ff('0x1e')](respondWithResult(_0xdeda45,0xc9))[_0x63ff('0x27')](handleError(_0xdeda45,null));};exports[_0x63ff('0x55')]=function(_0x12d0f0,_0x76bf81){if(_0x12d0f0[_0x63ff('0x56')]['id']){delete _0x12d0f0[_0x63ff('0x56')]['id'];}return db[_0x63ff('0x37')][_0x63ff('0x57')]({'where':{'id':_0x12d0f0['params']['id']}})[_0x63ff('0x1e')](handleEntityNotFound(_0x76bf81,null))['then'](saveUpdates(_0x12d0f0[_0x63ff('0x56')],null))[_0x63ff('0x1e')](respondWithResult(_0x76bf81,null))[_0x63ff('0x27')](handleError(_0x76bf81,null));};exports[_0x63ff('0x31')]=function(_0x536b17,_0x20c10f){return db[_0x63ff('0x37')][_0x63ff('0x57')]({'where':{'id':_0x536b17['params']['id']}})[_0x63ff('0x1e')](handleEntityNotFound(_0x20c10f,null))[_0x63ff('0x1e')](removeEntity(_0x20c10f,null))[_0x63ff('0x27')](handleError(_0x20c10f,null));};exports[_0x63ff('0x58')]=function(_0x2dec66,_0x3803d5){return db['WhatsappMessage'][_0x63ff('0x58')]()[_0x63ff('0x1e')](respondWithResult(_0x3803d5,null))['catch'](handleError(_0x3803d5,null));};var interaction_log=require(_0x63ff('0xe'))(_0x63ff('0x59'));exports[_0x63ff('0x5a')]=function(_0x164cd3,_0x1de834,_0x1b5691){var _0x569515={'channel':'whatsapp'};if(_0x164cd3[_0x63ff('0x56')]['id']){delete _0x164cd3[_0x63ff('0x56')]['id'];}_0x164cd3[_0x63ff('0x56')][_0x63ff('0x5b')]=!![];_0x164cd3[_0x63ff('0x56')][_0x63ff('0x5c')]=moment()[_0x63ff('0x5d')](_0x63ff('0x5e'));_0x164cd3[_0x63ff('0x56')]['UserId']=_0x164cd3[_0x63ff('0x56')][_0x63ff('0x5f')]||_0x164cd3[_0x63ff('0x60')]['id'];return db[_0x63ff('0x37')][_0x63ff('0x57')]({'where':{'id':_0x164cd3[_0x63ff('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x63ff('0x61')],'as':'Contact'}]})[_0x63ff('0x1e')](handleEntityNotFound(_0x1de834,null))[_0x63ff('0x1e')](saveUpdates(_0x164cd3[_0x63ff('0x56')],null))[_0x63ff('0x1e')](function(_0x5add71){if(_0x5add71){_0x569515[_0x63ff('0x25')]=_0x5add71['get']({'plain':!![]});return db[_0x63ff('0x62')]['find']({'where':{'id':_0x5add71[_0x63ff('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x1de834,null))['then'](function(_0x289f68){if(_0x289f68){return _0x289f68[_0x63ff('0x55')]({'UserId':_0x164cd3[_0x63ff('0x56')][_0x63ff('0x5f')],'read1stAt':_[_0x63ff('0x64')](_0x289f68[_0x63ff('0x65')])?moment()['format'](_0x63ff('0x5e')):undefined});}return null;})['then'](function(_0x48018c){if(_0x48018c){_0x569515['interaction']=_0x48018c[_0x63ff('0x66')]({'plain':!![]});interaction_log['info'](_0x63ff('0x67'),_0x164cd3['user']['id'],_0x164cd3[_0x63ff('0x60')]['name'],_0x164cd3[_0x63ff('0x60')]['role'],_0x569515['interaction']['id'],_0x164cd3['body']?JSON[_0x63ff('0x22')](_0x164cd3[_0x63ff('0x56')]):_0x63ff('0x68'));return respondWithRpcPromise(_0x63ff('0x69'),_0x63ff('0x6a'),_0x569515);}return null;})['then'](function(_0xeba0f3){if(_0xeba0f3){if(_0x164cd3[_0x63ff('0x56')]['manual']){_0x569515[_0x63ff('0x25')][_0x63ff('0x6b')]=util[_0x63ff('0x5d')](_0x63ff('0x6c'),_0x164cd3[_0x63ff('0x60')][_0x63ff('0x34')]);_0x569515[_0x63ff('0x25')]['channel']=_0x569515[_0x63ff('0x6d')];_0x569515[_0x63ff('0x25')][_0x63ff('0x6e')]=_0x63ff('0x5a');return respondWithRpcPromise(_0x63ff('0x6f'),'EventManager',{'event':_0x63ff('0x70'),'message':_0x569515[_0x63ff('0x25')]},client9002)[_0x63ff('0x1e')](function(){return _0x569515;});}return _0x569515;}return null;})[_0x63ff('0x1e')](respondWithResult(_0x1de834,null))[_0x63ff('0x27')](handleError(_0x1de834,null));};var interaction_log=require('../../config/logger')(_0x63ff('0x59'));exports[_0x63ff('0x2f')]=function(_0x494846,_0x3db9a3,_0x483061){var _0x3a7120={'agent':{},'channel':_0x63ff('0x71')};if(_0x494846[_0x63ff('0x56')]['id']){delete _0x494846[_0x63ff('0x56')]['id'];}_0x494846[_0x63ff('0x56')][_0x63ff('0x5f')]=_0x494846['body'][_0x63ff('0x5f')]||_0x494846[_0x63ff('0x60')]['id'];_0x3a7120[_0x63ff('0x72')]['id']=_0x494846['body']['UserId'];return db[_0x63ff('0x37')][_0x63ff('0x57')]({'where':{'id':_0x494846[_0x63ff('0x52')]['id'],'UserId':null}})[_0x63ff('0x1e')](handleEntityNotFound(_0x3db9a3,null))[_0x63ff('0x1e')](function(_0x31d890){if(_0x31d890){_0x3a7120[_0x63ff('0x25')]=_0x31d890[_0x63ff('0x66')]({'plain':!![]});return db[_0x63ff('0x62')][_0x63ff('0x57')]({'where':{'id':_0x31d890[_0x63ff('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x3db9a3,null))['then'](function(_0x54e28f){if(_0x54e28f){_0x3a7120[_0x63ff('0x73')]=_0x54e28f[_0x63ff('0x66')]({'plain':!![]});interaction_log[_0x63ff('0x74')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x494846[_0x63ff('0x60')]['id'],_0x494846['user']['name'],_0x494846[_0x63ff('0x60')][_0x63ff('0x75')],_0x3a7120[_0x63ff('0x73')]['id'],_0x494846[_0x63ff('0x56')]?JSON[_0x63ff('0x22')](_0x494846['body']):'null');return respondWithRpcPromise(_0x63ff('0x76'),'rejectMessage',_0x3a7120);}return null;})['then'](function(_0x98925b){if(_0x98925b){_0x98925b[_0x63ff('0x25')][_0x63ff('0x6b')]=util[_0x63ff('0x5d')](_0x63ff('0x6c'),_0x494846[_0x63ff('0x60')][_0x63ff('0x34')]);_0x98925b[_0x63ff('0x25')][_0x63ff('0x6d')]=_0x3a7120[_0x63ff('0x6d')];_0x98925b[_0x63ff('0x25')]['event']='reject';respondWithRpcPromise('EventManager',_0x63ff('0x6f'),{'event':_0x63ff('0x77'),'message':_0x98925b['message']},client9002);return _0x3a7120;}return null;})[_0x63ff('0x1e')](respondWithResult(_0x3db9a3,null))[_0x63ff('0x27')](handleError(_0x3db9a3,null));};exports[_0x63ff('0x29')]=function(_0x45ac47,_0x4ec6c5,_0x1b265e){if(_0x45ac47[_0x63ff('0x56')]['id']){delete _0x45ac47[_0x63ff('0x56')]['id'];}var _0x54d8cb;return db[_0x63ff('0x37')][_0x63ff('0x57')]({'where':{'id':_0x45ac47[_0x63ff('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ec6c5,null))['then'](function(_0x40acf1){if(_0x40acf1){_0x54d8cb=_0x40acf1;return db[_0x63ff('0x78')][_0x63ff('0x57')]({'where':{'id':_0x40acf1[_0x63ff('0x79')]}});}})['then'](handleEntityNotFound(_0x4ec6c5,null))[_0x63ff('0x1e')](function(_0xa6467e){if(_0xa6467e){logger[_0x63ff('0x7a')](_0x63ff('0x7b'),_0x63ff('0x29'),'received\x20delivery\x20report\x20from',_0xa6467e['type'],util['inspect'](_0x45ac47[_0x63ff('0x56')],{'showHidden':![],'depth':null}));switch(_0xa6467e[_0x63ff('0x39')]){case _0x63ff('0x7c'):if(_0x45ac47[_0x63ff('0x56')][_0x63ff('0x7d')]&&_0x45ac47[_0x63ff('0x56')][_0x63ff('0x7d')]===_0x54d8cb[_0x63ff('0x7e')]&&_0x45ac47[_0x63ff('0x56')]['MessageStatus']&&_0x45ac47['body'][_0x63ff('0x7f')]===_0x63ff('0x5b')){return _0x54d8cb['update']({'read':!![]});}else{logger[_0x63ff('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x63ff('0x7c'),util[_0x63ff('0x80')](_0x45ac47[_0x63ff('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x54d8cb;}})[_0x63ff('0x1e')](respondWithResult(_0x4ec6c5,null))[_0x63ff('0x27')](handleError(_0x4ec6c5,null));}; \ No newline at end of file +var _0x71a0=['redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','test','Sequelize','ValidationError','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','model','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','keys','include','find','create','body','destroy','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','read1stAt','interaction','role','null','acceptMessage','interface','channel','EventManager','acceptmessage','params','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','event','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xfe6afe,_0xa1a594){var _0x406ff5=function(_0x377ede){while(--_0x377ede){_0xfe6afe['push'](_0xfe6afe['shift']());}};_0x406ff5(++_0xa1a594);}(_0x71a0,0xe9));var _0x071a=function(_0x163ebb,_0x12848e){_0x163ebb=_0x163ebb-0x0;var _0x24675d=_0x71a0[_0x163ebb];return _0x24675d;};'use strict';var pdf=require(_0x071a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x071a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x071a('0x2'));var rp=require(_0x071a('0x3'));var moment=require(_0x071a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x071a('0x5'));var util=require(_0x071a('0x6'));var path=require(_0x071a('0x7'));var sox=require(_0x071a('0x8'));var csv=require(_0x071a('0x9'));var ejs=require(_0x071a('0xa'));var fs=require('fs');var _=require(_0x071a('0xb'));var squel=require(_0x071a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x071a('0xd'));var toCsv=require(_0x071a('0x9'));var querystring=require(_0x071a('0xe'));var Papa=require(_0x071a('0xf'));var Redis=require(_0x071a('0x10'));var authService=require(_0x071a('0x11'));var qs=require(_0x071a('0x12'));var as=require(_0x071a('0x13'));var hardwareService=require(_0x071a('0x14'));var logger=require(_0x071a('0x15'))(_0x071a('0x16'));var utils=require(_0x071a('0x17'));var config=require(_0x071a('0x18'));var db=require('../../mysqldb')['db'];config[_0x071a('0x19')]=_[_0x071a('0x1a')](config[_0x071a('0x19')],{'host':_0x071a('0x1b'),'port':0x18eb});var socket=require(_0x071a('0x1c'))(new Redis(config[_0x071a('0x19')]));require(_0x071a('0x1d'))[_0x071a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x071a('0x1f')][_0x071a('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x071a('0x20')]({'port':0x232a});function checkPasswordPattern(_0xe0cdca,_0x1e7426,_0x1a31c1){if(_0x1a31c1){var _0x3680a7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3680a7[_0x071a('0x21')](_0x1e7426)){return _0xe0cdca;}else{throw new db[(_0x071a('0x22'))][(_0x071a('0x23'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xe0cdca;}}function respondWithRpcPromise(_0x77ac07,_0x29b127,_0x4d4687,_0x4e848f){return new BPromise(function(_0x2d2b5b,_0x162b26){var _0x230b5e=_0x4e848f||client;return _0x230b5e[_0x071a('0x24')](_0x77ac07,_0x4d4687)[_0x071a('0x25')](function(_0x25cec5){logger[_0x071a('0x26')](_0x071a('0x27'),_0x29b127,_0x071a('0x28'));logger['debug'](_0x071a('0x29'),_0x29b127,'request\x20sent',JSON[_0x071a('0x2a')](_0x25cec5));if(_0x25cec5['error']){if(_0x25cec5[_0x071a('0x2b')]['code']===0x1f4){logger[_0x071a('0x2b')](_0x071a('0x27'),_0x29b127,_0x25cec5[_0x071a('0x2b')][_0x071a('0x2c')]);return _0x162b26(_0x25cec5[_0x071a('0x2b')]['message']);}logger[_0x071a('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x29b127,_0x25cec5[_0x071a('0x2b')][_0x071a('0x2c')]);return _0x2d2b5b(_0x25cec5[_0x071a('0x2b')][_0x071a('0x2c')]);}else{logger[_0x071a('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x29b127,'request\x20sent');_0x2d2b5b(_0x25cec5[_0x071a('0x2d')][_0x071a('0x2c')]);}})[_0x071a('0x2e')](function(_0x3587e1){logger[_0x071a('0x2b')](_0x071a('0x27'),_0x29b127,_0x3587e1);_0x162b26(_0x3587e1);});});}function respondWithStatusCode(_0x2b5ecd,_0x28a868){_0x28a868=_0x28a868||0xcc;return function(_0x456f0e){if(_0x456f0e){return _0x2b5ecd[_0x071a('0x2f')](_0x28a868);}return _0x2b5ecd[_0x071a('0x30')](_0x28a868)[_0x071a('0x31')]();};}function respondWithResult(_0x5a2211,_0x3c790b){_0x3c790b=_0x3c790b||0xc8;return function(_0x141c58){if(_0x141c58){return _0x5a2211['status'](_0x3c790b)[_0x071a('0x32')](_0x141c58);}};}function respondWithFilteredResult(_0x5a709a,_0x33df43){return function(_0x2f6975){if(_0x2f6975){var _0x21bba8=_0x2f6975[_0x071a('0x33')],_0x49811f=_0x33df43[_0x071a('0x34')],_0x107667=_0x33df43['offset']+_0x33df43[_0x071a('0x35')],_0x433d75;if(_0x107667>=_0x21bba8){_0x107667=_0x21bba8;_0x433d75=0xc8;}else{_0x433d75=0xce;}_0x5a709a[_0x071a('0x30')](_0x433d75);return _0x5a709a['set'](_0x071a('0x36'),_0x49811f+'-'+_0x107667+'/'+_0x21bba8)['json'](_0x2f6975);}return null;};}function patchUpdates(_0x9ebfb6){return function(_0x340407){try{jsonpatch['apply'](_0x340407,_0x9ebfb6,!![]);}catch(_0x4fd2da){return BPromise[_0x071a('0x37')](_0x4fd2da);}return _0x340407[_0x071a('0x38')]();};}function saveUpdates(_0x22c116,_0x11a0ee){return function(_0x7828c8){if(_0x7828c8){return _0x7828c8[_0x071a('0x39')](_0x22c116)[_0x071a('0x25')](function(_0x446d81){return _0x446d81;});}return null;};}function removeEntity(_0x58e0a5,_0x20b3b0){return function(_0x1a6aca){if(_0x1a6aca){return _0x1a6aca['destroy']()['then'](function(){_0x58e0a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc070,_0x55d1c5){return function(_0x1501e0){if(!_0x1501e0){_0x1cc070[_0x071a('0x2f')](0x194);}return _0x1501e0;};}function handleError(_0x426b41,_0x5cf1bd){_0x5cf1bd=_0x5cf1bd||0x1f4;return function(_0x5de58e){logger[_0x071a('0x2b')](_0x5de58e[_0x071a('0x3a')]);if(_0x5de58e[_0x071a('0x3b')]){delete _0x5de58e[_0x071a('0x3b')];}_0x426b41[_0x071a('0x30')](_0x5cf1bd)[_0x071a('0x3c')](_0x5de58e);};}exports[_0x071a('0x3d')]=function(_0xed92e6,_0x39546b){var _0x186253={},_0x44b40c={},_0x39cea8={'count':0x0,'rows':[]};var _0x474e30=_[_0x071a('0x3e')](db[_0x071a('0x3f')][_0x071a('0x40')],function(_0x10cf6a){return{'name':_0x10cf6a[_0x071a('0x41')],'type':_0x10cf6a['type']['key']};});_0x44b40c[_0x071a('0x42')]=_['map'](_0x474e30,'name');_0x44b40c[_0x071a('0x43')]=_['keys'](_0xed92e6['query']);_0x44b40c['filters']=_[_0x071a('0x44')](_0x44b40c[_0x071a('0x42')],_0x44b40c[_0x071a('0x43')]);_0x186253['attributes']=_[_0x071a('0x44')](_0x44b40c[_0x071a('0x42')],qs[_0x071a('0x45')](_0xed92e6[_0x071a('0x43')][_0x071a('0x45')]));_0x186253['attributes']=_0x186253['attributes'][_0x071a('0x46')]?_0x186253[_0x071a('0x47')]:_0x44b40c[_0x071a('0x42')];if(!_0xed92e6['query'][_0x071a('0x48')](_0x071a('0x49'))){_0x186253[_0x071a('0x35')]=qs[_0x071a('0x35')](_0xed92e6[_0x071a('0x43')]['limit']);_0x186253[_0x071a('0x34')]=qs['offset'](_0xed92e6[_0x071a('0x43')]['offset']);}_0x186253['order']=qs[_0x071a('0x4a')](_0xed92e6[_0x071a('0x43')]['sort']);_0x186253[_0x071a('0x4b')]=qs[_0x071a('0x4c')](_['pick'](_0xed92e6['query'],_0x44b40c['filters']),_0x474e30);if(_0xed92e6['query'][_0x071a('0x4d')]){_0x186253[_0x071a('0x4b')]=_[_0x071a('0x4e')](_0x186253['where'],{'$or':_[_0x071a('0x3e')](_0x474e30,function(_0x5a320b){if(_0x5a320b[_0x071a('0x4f')]!==_0x071a('0x50')){var _0x5e95b7={};_0x5e95b7[_0x5a320b[_0x071a('0x3b')]]={'$like':'%'+_0xed92e6['query'][_0x071a('0x4d')]+'%'};return _0x5e95b7;}})});}_0x186253=_[_0x071a('0x4e')]({},_0x186253,_0xed92e6[_0x071a('0x51')]);var _0x1df46e={'where':_0x186253[_0x071a('0x4b')]};return db['WhatsappMessage']['count'](_0x1df46e)[_0x071a('0x25')](function(_0x290acb){_0x39cea8[_0x071a('0x33')]=_0x290acb;if(_0xed92e6[_0x071a('0x43')][_0x071a('0x52')]){_0x186253['include']=[{'all':!![]}];}return db[_0x071a('0x3f')][_0x071a('0x53')](_0x186253);})[_0x071a('0x25')](function(_0x425a81){_0x39cea8['rows']=_0x425a81;return _0x39cea8;})[_0x071a('0x25')](respondWithFilteredResult(_0x39546b,_0x186253))[_0x071a('0x2e')](handleError(_0x39546b,null));};exports['show']=function(_0x3ff646,_0x6013f4){var _0x502c76={'raw':!![],'where':{'id':_0x3ff646['params']['id']}},_0x3abf12={};_0x3abf12[_0x071a('0x42')]=_[_0x071a('0x54')](db[_0x071a('0x3f')][_0x071a('0x40')]);_0x3abf12[_0x071a('0x43')]=_[_0x071a('0x54')](_0x3ff646[_0x071a('0x43')]);_0x3abf12[_0x071a('0x4c')]=_[_0x071a('0x44')](_0x3abf12[_0x071a('0x42')],_0x3abf12['query']);_0x502c76[_0x071a('0x47')]=_[_0x071a('0x44')](_0x3abf12[_0x071a('0x42')],qs['fields'](_0x3ff646[_0x071a('0x43')][_0x071a('0x45')]));_0x502c76[_0x071a('0x47')]=_0x502c76['attributes']['length']?_0x502c76[_0x071a('0x47')]:_0x3abf12[_0x071a('0x42')];if(_0x3ff646[_0x071a('0x43')][_0x071a('0x52')]){_0x502c76[_0x071a('0x55')]=[{'all':!![]}];}_0x502c76=_[_0x071a('0x4e')]({},_0x502c76,_0x3ff646[_0x071a('0x51')]);return db[_0x071a('0x3f')][_0x071a('0x56')](_0x502c76)[_0x071a('0x25')](handleEntityNotFound(_0x6013f4,null))[_0x071a('0x25')](respondWithResult(_0x6013f4,null))[_0x071a('0x2e')](handleError(_0x6013f4,null));};exports['create']=function(_0x39f50e,_0x33f0d5){return db[_0x071a('0x3f')][_0x071a('0x57')](_0x39f50e[_0x071a('0x58')],{})[_0x071a('0x25')](respondWithResult(_0x33f0d5,0xc9))['catch'](handleError(_0x33f0d5,null));};exports[_0x071a('0x39')]=function(_0x96fc56,_0x1d1b4f){if(_0x96fc56[_0x071a('0x58')]['id']){delete _0x96fc56['body']['id'];}return db[_0x071a('0x3f')]['find']({'where':{'id':_0x96fc56['params']['id']}})['then'](handleEntityNotFound(_0x1d1b4f,null))['then'](saveUpdates(_0x96fc56['body'],null))[_0x071a('0x25')](respondWithResult(_0x1d1b4f,null))['catch'](handleError(_0x1d1b4f,null));};exports[_0x071a('0x59')]=function(_0xb94ae9,_0x137e8e){return db[_0x071a('0x3f')]['find']({'where':{'id':_0xb94ae9['params']['id']}})[_0x071a('0x25')](handleEntityNotFound(_0x137e8e,null))[_0x071a('0x25')](removeEntity(_0x137e8e,null))[_0x071a('0x2e')](handleError(_0x137e8e,null));};exports['describe']=function(_0x1105d0,_0x243b17){return db['WhatsappMessage']['describe']()[_0x071a('0x25')](respondWithResult(_0x243b17,null))[_0x071a('0x2e')](handleError(_0x243b17,null));};var interaction_log=require(_0x071a('0x15'))(_0x071a('0x5a'));exports[_0x071a('0x5b')]=function(_0x2b701e,_0x35bea2,_0x231d5a){var _0x555ec1={'channel':_0x071a('0x5c')};if(_0x2b701e[_0x071a('0x58')]['id']){delete _0x2b701e[_0x071a('0x58')]['id'];}_0x2b701e[_0x071a('0x58')]['read']=!![];_0x2b701e['body'][_0x071a('0x5d')]=moment()[_0x071a('0x5e')](_0x071a('0x5f'));_0x2b701e[_0x071a('0x58')][_0x071a('0x60')]=_0x2b701e[_0x071a('0x58')][_0x071a('0x60')]||_0x2b701e[_0x071a('0x61')]['id'];return db[_0x071a('0x3f')][_0x071a('0x56')]({'where':{'id':_0x2b701e['params']['id'],'UserId':null},'include':[{'model':db[_0x071a('0x62')],'as':_0x071a('0x63')}]})['then'](handleEntityNotFound(_0x35bea2,null))['then'](saveUpdates(_0x2b701e[_0x071a('0x58')],null))[_0x071a('0x25')](function(_0xae274){if(_0xae274){_0x555ec1[_0x071a('0x2c')]=_0xae274[_0x071a('0x64')]({'plain':!![]});return db[_0x071a('0x65')][_0x071a('0x56')]({'where':{'id':_0xae274['WhatsappInteractionId']}});}return null;})[_0x071a('0x25')](handleEntityNotFound(_0x35bea2,null))[_0x071a('0x25')](function(_0x208fce){if(_0x208fce){return _0x208fce[_0x071a('0x39')]({'UserId':_0x2b701e['body'][_0x071a('0x60')],'read1stAt':_['isNil'](_0x208fce[_0x071a('0x66')])?moment()[_0x071a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x071a('0x25')](function(_0x4d1f80){if(_0x4d1f80){_0x555ec1[_0x071a('0x67')]=_0x4d1f80['get']({'plain':!![]});interaction_log[_0x071a('0x26')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b701e[_0x071a('0x61')]['id'],_0x2b701e['user']['name'],_0x2b701e[_0x071a('0x61')][_0x071a('0x68')],_0x555ec1['interaction']['id'],_0x2b701e[_0x071a('0x58')]?JSON[_0x071a('0x2a')](_0x2b701e[_0x071a('0x58')]):_0x071a('0x69'));return respondWithRpcPromise('AcceptMessage',_0x071a('0x6a'),_0x555ec1);}return null;})[_0x071a('0x25')](function(_0x4e907e){if(_0x4e907e){if(_0x2b701e[_0x071a('0x58')]['manual']){_0x555ec1['message'][_0x071a('0x6b')]=util[_0x071a('0x5e')]('SIP/%s',_0x2b701e['user']['name']);_0x555ec1[_0x071a('0x2c')][_0x071a('0x6c')]=_0x555ec1[_0x071a('0x6c')];_0x555ec1[_0x071a('0x2c')]['event']=_0x071a('0x5b');return respondWithRpcPromise(_0x071a('0x6d'),'EventManager',{'event':_0x071a('0x6e'),'message':_0x555ec1[_0x071a('0x2c')]},client9002)['then'](function(){return _0x555ec1;});}return _0x555ec1;}return null;})[_0x071a('0x25')](respondWithResult(_0x35bea2,null))['catch'](handleError(_0x35bea2,null));};var interaction_log=require('../../config/logger')(_0x071a('0x5a'));exports[_0x071a('0x37')]=function(_0x3f47f8,_0x19286b,_0x17e46d){var _0x5e930d={'agent':{},'channel':_0x071a('0x5c')};if(_0x3f47f8[_0x071a('0x58')]['id']){delete _0x3f47f8[_0x071a('0x58')]['id'];}_0x3f47f8[_0x071a('0x58')][_0x071a('0x60')]=_0x3f47f8[_0x071a('0x58')][_0x071a('0x60')]||_0x3f47f8[_0x071a('0x61')]['id'];_0x5e930d['agent']['id']=_0x3f47f8[_0x071a('0x58')][_0x071a('0x60')];return db['WhatsappMessage'][_0x071a('0x56')]({'where':{'id':_0x3f47f8[_0x071a('0x6f')]['id'],'UserId':null}})[_0x071a('0x25')](handleEntityNotFound(_0x19286b,null))['then'](function(_0x18b253){if(_0x18b253){_0x5e930d[_0x071a('0x2c')]=_0x18b253['get']({'plain':!![]});return db['WhatsappInteraction'][_0x071a('0x56')]({'where':{'id':_0x18b253[_0x071a('0x70')]}});}return null;})[_0x071a('0x25')](handleEntityNotFound(_0x19286b,null))[_0x071a('0x25')](function(_0x33d2de){if(_0x33d2de){_0x5e930d['interaction']=_0x33d2de[_0x071a('0x64')]({'plain':!![]});interaction_log[_0x071a('0x26')](_0x071a('0x71'),_0x3f47f8['user']['id'],_0x3f47f8['user'][_0x071a('0x3b')],_0x3f47f8[_0x071a('0x61')][_0x071a('0x68')],_0x5e930d[_0x071a('0x67')]['id'],_0x3f47f8[_0x071a('0x58')]?JSON[_0x071a('0x2a')](_0x3f47f8[_0x071a('0x58')]):_0x071a('0x69'));return respondWithRpcPromise('RejectMessage',_0x071a('0x72'),_0x5e930d);}return null;})[_0x071a('0x25')](function(_0x4119c7){if(_0x4119c7){_0x4119c7[_0x071a('0x2c')][_0x071a('0x6b')]=util[_0x071a('0x5e')](_0x071a('0x73'),_0x3f47f8['user'][_0x071a('0x3b')]);_0x4119c7[_0x071a('0x2c')]['channel']=_0x5e930d['channel'];_0x4119c7['message'][_0x071a('0x74')]='reject';respondWithRpcPromise(_0x071a('0x6d'),_0x071a('0x6d'),{'event':_0x071a('0x75'),'message':_0x4119c7['message']},client9002);return _0x5e930d;}return null;})[_0x071a('0x25')](respondWithResult(_0x19286b,null))['catch'](handleError(_0x19286b,null));};exports[_0x071a('0x30')]=function(_0x4134bd,_0x1d9efa,_0x5d638a){if(_0x4134bd['body']['id']){delete _0x4134bd[_0x071a('0x58')]['id'];}var _0x4124a8;return db[_0x071a('0x3f')]['find']({'where':{'id':_0x4134bd[_0x071a('0x6f')]['id']}})['then'](handleEntityNotFound(_0x1d9efa,null))[_0x071a('0x25')](function(_0x41ac0a){if(_0x41ac0a){_0x4124a8=_0x41ac0a;return db[_0x071a('0x76')][_0x071a('0x56')]({'where':{'id':_0x41ac0a[_0x071a('0x77')]}});}})[_0x071a('0x25')](handleEntityNotFound(_0x1d9efa,null))['then'](function(_0x4a20c9){if(_0x4a20c9){logger[_0x071a('0x78')](_0x071a('0x79'),_0x071a('0x30'),'received\x20delivery\x20report\x20from',_0x4a20c9[_0x071a('0x4f')],util['inspect'](_0x4134bd[_0x071a('0x58')],{'showHidden':![],'depth':null}));switch(_0x4a20c9[_0x071a('0x4f')]){case _0x071a('0x7a'):if(_0x4134bd[_0x071a('0x58')][_0x071a('0x7b')]&&_0x4134bd[_0x071a('0x58')][_0x071a('0x7b')]===_0x4124a8[_0x071a('0x7c')]&&_0x4134bd[_0x071a('0x58')][_0x071a('0x7d')]&&_0x4134bd[_0x071a('0x58')]['MessageStatus']===_0x071a('0x7e')){return _0x4124a8[_0x071a('0x39')]({'read':!![]});}else{logger[_0x071a('0x2b')](_0x071a('0x7f'),_0x071a('0x30'),_0x071a('0x7a'),util[_0x071a('0x80')](_0x4134bd[_0x071a('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4124a8;}})[_0x071a('0x25')](respondWithResult(_0x1d9efa,null))[_0x071a('0x2e')](handleError(_0x1d9efa,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 3c66be2..850366d 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x11267b,_0x5bbccb){var _0x236da4=function(_0x3afb06){while(--_0x3afb06){_0x11267b['push'](_0x11267b['shift']());}};_0x236da4(++_0x5bbccb);}(_0x7a54,0x106));var _0x47a5=function(_0x18b235,_0x3ca132){_0x18b235=_0x18b235-0x0;var _0x1c4347=_0x7a54[_0x18b235];return _0x1c4347;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0xb097d5,_0x581be5){var _0x1587bd=function(_0x4f1f0d){while(--_0x4f1f0d){_0xb097d5['push'](_0xb097d5['shift']());}};_0x1587bd(++_0x581be5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x457d60,_0x2347ce){_0x457d60=_0x457d60-0x0;var _0x59fa2d=_0x5f2f[_0x457d60];return _0x59fa2d;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 54975bd..2da241f 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 _0xe6dd=['rimraf','exports','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','findOne','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','token','sid','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0xe6dd,0x1e8));var _0xde6d=function(_0x21a63f,_0x2341b0){_0x21a63f=_0x21a63f-0x0;var _0xde115f=_0xe6dd[_0x21a63f];return _0xde115f;};'use strict';var _=require(_0xde6d('0x0'));var util=require(_0xde6d('0x1'));var logger=require(_0xde6d('0x2'))(_0xde6d('0x3'));var moment=require(_0xde6d('0x4'));var BPromise=require(_0xde6d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde6d('0x6'));var rimraf=require(_0xde6d('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0xde6d('0x8')]=function(_0x1f54d8,_0x4d1c21){return _0x1f54d8['define'](_0xde6d('0x9'),attributes,{'tableName':_0xde6d('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xde6d('0xb'),'fields':[_0xde6d('0xc')],'type':_0xde6d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x627f8c,_0x3c4d32,_0x518747){var _0x355d07=_0x1f54d8['models'];var _0x6d1dd7=_0x627f8c[_0xde6d('0xe')]({'plain':!![]});if(_0x6d1dd7[_0xde6d('0xf')][_0xde6d('0x10')]()==='in'||_0x6d1dd7[_0xde6d('0xf')]['toLowerCase']()===_0xde6d('0x11')&&!_0x6d1dd7[_0xde6d('0x12')]&&!_['isNil'](_0x6d1dd7[_0xde6d('0x13')])){_0x355d07['WhatsappInteraction'][_0xde6d('0x14')]({'where':{'id':_0x6d1dd7[_0xde6d('0x15')]}})['then'](function(_0x573dfa){if(_0x573dfa){_0x573dfa[_0xde6d('0x16')]({'lastMsgAt':_0x6d1dd7[_0xde6d('0x17')],'lastMsgDirection':_0x6d1dd7[_0xde6d('0xf')][_0xde6d('0x10')]()});}})[_0xde6d('0x18')](function(_0x5367a5){console[_0xde6d('0x19')](_0x5367a5);});}if(_0x6d1dd7['direction']===_0xde6d('0x11')&&!_0x6d1dd7['secret']){var _0x9d3c15;_0x355d07[_0xde6d('0x1a')]['find']({'where':{'id':_0x6d1dd7[_0xde6d('0x1b')]},'raw':!![]})[_0xde6d('0x1c')](function(_0x3aba0d){_0x9d3c15=_0x3aba0d;if(_0x9d3c15&&_0x9d3c15[_0xde6d('0x1d')]){switch(_0x9d3c15[_0xde6d('0x1d')]){case _0xde6d('0x1e'):var _0x55d9d0=require(_0xde6d('0x1e'));if(_0x9d3c15[_0xde6d('0x1f')]&&_0x9d3c15[_0xde6d('0x20')]&&_0x9d3c15[_0xde6d('0x21')]){var _0x33e741=new _0x55d9d0(_0x9d3c15[_0xde6d('0x1f')],_0x9d3c15[_0xde6d('0x20')]);_0x33e741[_0xde6d('0x22')][_0xde6d('0x23')]({'body':_0x6d1dd7['body'],'to':_0xde6d('0x24')+_0x6d1dd7[_0xde6d('0x21')],'from':_0xde6d('0x24')+_0x9d3c15[_0xde6d('0x21')],'statusCallback':_0x9d3c15[_0xde6d('0x25')]+'/api/whatsapp/messages/'+_0x6d1dd7['id']+_0xde6d('0x26')+_0x9d3c15[_0xde6d('0x27')]})[_0xde6d('0x1c')](function(_0x5458ad){if(_0x5458ad[_0xde6d('0x28')]){return _0x627f8c[_0xde6d('0x16')]({'messageId':_0x5458ad[_0xde6d('0x28')]});}})['catch'](function(_0x5b1466){logger[_0xde6d('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xde6d('0x29'),_0xde6d('0x1e'),util['inspect'](_0x5b1466,{'showHidden':![],'depth':null}));});}else{logger[_0xde6d('0x19')](_0xde6d('0x2a'),'afterCreate',_0xde6d('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x518747();});}else{_0x518747();}}},'charset':_0xde6d('0x2b'),'collate':_0xde6d('0x2c')});}; \ No newline at end of file +var _0x3ebd=['twilio','authToken','phone','accountSid','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','then','update','createdAt','WhatsappAccount','find','WhatsappAccountId','type'];(function(_0x4d931c,_0x340eaa){var _0x2d61c8=function(_0x5591f9){while(--_0x5591f9){_0x4d931c['push'](_0x4d931c['shift']());}};_0x2d61c8(++_0x340eaa);}(_0x3ebd,0x1f1));var _0xd3eb=function(_0xf2b128,_0x2f0464){_0xf2b128=_0xf2b128-0x0;var _0x149252=_0x3ebd[_0xf2b128];return _0x149252;};'use strict';var _=require(_0xd3eb('0x0'));var util=require('util');var logger=require(_0xd3eb('0x1'))(_0xd3eb('0x2'));var moment=require(_0xd3eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3eb('0x4'));var rimraf=require(_0xd3eb('0x5'));var config=require(_0xd3eb('0x6'));var attributes=require(_0xd3eb('0x7'));module[_0xd3eb('0x8')]=function(_0x4b8917,_0x3dc6c0){return _0x4b8917[_0xd3eb('0x9')](_0xd3eb('0xa'),attributes,{'tableName':_0xd3eb('0xb'),'paranoid':![],'indexes':[{'name':_0xd3eb('0xc'),'fields':[_0xd3eb('0xc')]},{'name':_0xd3eb('0xd'),'fields':[_0xd3eb('0xe')],'type':_0xd3eb('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dd144,_0x34e39b,_0x3e8ca5){var _0x3706a0=_0x4b8917['models'];var _0x36fa8f=_0x3dd144[_0xd3eb('0x10')]({'plain':!![]});if(_0x36fa8f[_0xd3eb('0x11')][_0xd3eb('0x12')]()==='in'||_0x36fa8f['direction']['toLowerCase']()===_0xd3eb('0x13')&&!_0x36fa8f[_0xd3eb('0x14')]&&!_[_0xd3eb('0x15')](_0x36fa8f['UserId'])){_0x3706a0[_0xd3eb('0x16')][_0xd3eb('0x17')]({'where':{'id':_0x36fa8f['WhatsappInteractionId']}})[_0xd3eb('0x18')](function(_0x38e93e){if(_0x38e93e){_0x38e93e[_0xd3eb('0x19')]({'lastMsgAt':_0x36fa8f[_0xd3eb('0x1a')],'lastMsgDirection':_0x36fa8f[_0xd3eb('0x11')][_0xd3eb('0x12')]()});}})['catch'](function(_0x5278db){console['error'](_0x5278db);});}if(_0x36fa8f['direction']===_0xd3eb('0x13')&&!_0x36fa8f['secret']){var _0x34d367;_0x3706a0[_0xd3eb('0x1b')][_0xd3eb('0x1c')]({'where':{'id':_0x36fa8f[_0xd3eb('0x1d')]},'raw':!![]})[_0xd3eb('0x18')](function(_0x43ee32){_0x34d367=_0x43ee32;if(_0x34d367&&_0x34d367[_0xd3eb('0x1e')]){switch(_0x34d367['type']){case'twilio':var _0x150739=require(_0xd3eb('0x1f'));if(_0x34d367['accountSid']&&_0x34d367[_0xd3eb('0x20')]&&_0x34d367[_0xd3eb('0x21')]){var _0x186c15=new _0x150739(_0x34d367[_0xd3eb('0x22')],_0x34d367['authToken']);_0x186c15['messages']['create']({'body':_0x36fa8f[_0xd3eb('0xe')],'to':_0xd3eb('0x23')+_0x36fa8f[_0xd3eb('0x21')],'from':_0xd3eb('0x23')+_0x34d367[_0xd3eb('0x21')],'statusCallback':_0x34d367[_0xd3eb('0x24')]+_0xd3eb('0x25')+_0x36fa8f['id']+'/status?token='+_0x34d367[_0xd3eb('0x26')]})[_0xd3eb('0x18')](function(_0x249e11){if(_0x249e11[_0xd3eb('0x27')]){return _0x3dd144[_0xd3eb('0x19')]({'messageId':_0x249e11[_0xd3eb('0x27')]});}})[_0xd3eb('0x28')](function(_0x367f4b){logger[_0xd3eb('0x29')](_0xd3eb('0x2a'),'afterCreate',_0xd3eb('0x1f'),util[_0xd3eb('0x2b')](_0x367f4b,{'showHidden':![],'depth':null}));});}else{logger[_0xd3eb('0x29')](_0xd3eb('0x2a'),_0xd3eb('0x2c'),_0xd3eb('0x1f'),_0xd3eb('0x2d'));}break;}}})['finally'](function(){_0x3e8ca5();});}else{_0x3e8ca5();}}},'charset':_0xd3eb('0x2e'),'collate':_0xd3eb('0x2f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a1dc45e..06e8409 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 _0x1a00=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','create','body','options','raw'];(function(_0x3a41a8,_0x1e25b9){var _0x19dfeb=function(_0x4f6567){while(--_0x4f6567){_0x3a41a8['push'](_0x3a41a8['shift']());}};_0x19dfeb(++_0x1e25b9);}(_0x1a00,0xe0));var _0x01a0=function(_0x3551f1,_0x1997b1){_0x3551f1=_0x3551f1-0x0;var _0x5ced3b=_0x1a00[_0x3551f1];return _0x5ced3b;};'use strict';var _=require('lodash');var util=require(_0x01a0('0x0'));var moment=require(_0x01a0('0x1'));var BPromise=require(_0x01a0('0x2'));var rs=require(_0x01a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01a0('0x4'))['db'];var utils=require(_0x01a0('0x5'));var logger=require(_0x01a0('0x6'))('rpc');var config=require(_0x01a0('0x7'));var jayson=require(_0x01a0('0x8'));var client=jayson[_0x01a0('0x9')]['http']({'port':0x232a});config[_0x01a0('0xa')]=_[_0x01a0('0xb')](config[_0x01a0('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01a0('0xa')]));require(_0x01a0('0xc'))[_0x01a0('0xd')](socket);function respondWithRpcPromise(_0x391a33,_0xb4350b,_0x1e5412){return new BPromise(function(_0x448edd,_0x2f0f88){return client[_0x01a0('0xe')](_0x391a33,_0x1e5412)[_0x01a0('0xf')](function(_0x2f23a5){logger[_0x01a0('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0xb4350b,_0x01a0('0x11'));logger[_0x01a0('0x12')](_0x01a0('0x13'),_0xb4350b,_0x01a0('0x11'),JSON[_0x01a0('0x14')](_0x2f23a5));if(_0x2f23a5[_0x01a0('0x15')]){if(_0x2f23a5[_0x01a0('0x15')][_0x01a0('0x16')]===0x1f4){logger[_0x01a0('0x15')](_0x01a0('0x17'),_0xb4350b,_0x2f23a5['error'][_0x01a0('0x18')]);return _0x2f0f88(_0x2f23a5[_0x01a0('0x15')][_0x01a0('0x18')]);}logger['error'](_0x01a0('0x17'),_0xb4350b,_0x2f23a5['error'][_0x01a0('0x18')]);return _0x448edd(_0x2f23a5[_0x01a0('0x15')][_0x01a0('0x18')]);}else{logger[_0x01a0('0x10')](_0x01a0('0x17'),_0xb4350b,_0x01a0('0x11'));_0x448edd(_0x2f23a5[_0x01a0('0x19')][_0x01a0('0x18')]);}})[_0x01a0('0x1a')](function(_0x575a44){logger[_0x01a0('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0xb4350b,_0x575a44);_0x2f0f88(_0x575a44);});});}exports[_0x01a0('0x1b')]=function(_0x4adbdf){var _0x4d8583=this;return new Promise(function(_0x1b132d,_0x164b6a){return db['WhatsappMessage'][_0x01a0('0x1c')](_0x4adbdf[_0x01a0('0x1d')],{'raw':_0x4adbdf[_0x01a0('0x1e')]?_0x4adbdf[_0x01a0('0x1e')][_0x01a0('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x4d69bf){logger[_0x01a0('0x10')](_0x01a0('0x1b'),_0x4adbdf);logger['debug'](_0x01a0('0x1b'),_0x4adbdf,JSON[_0x01a0('0x14')](_0x4d69bf));_0x1b132d(_0x4d69bf);})['catch'](function(_0x57b72d){logger['error'](_0x01a0('0x1b'),_0x57b72d[_0x01a0('0x18')],_0x4adbdf);_0x164b6a(_0x4d8583[_0x01a0('0x15')](0x1f4,_0x57b72d[_0x01a0('0x18')]));});});}; \ No newline at end of file +var _0x7bdc=['stringify','error','code','message','CreateWhatsappMessage','WhatsappMessage','body','options','raw','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x7bdc,0x8a));var _0xc7bd=function(_0x318183,_0x179842){_0x318183=_0x318183-0x0;var _0x49914c=_0x7bdc[_0x318183];return _0x49914c;};'use strict';var _=require('lodash');var util=require(_0xc7bd('0x0'));var moment=require('moment');var BPromise=require(_0xc7bd('0x1'));var rs=require(_0xc7bd('0x2'));var fs=require('fs');var Redis=require(_0xc7bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7bd('0x4'));var logger=require(_0xc7bd('0x5'))(_0xc7bd('0x6'));var config=require(_0xc7bd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc7bd('0x8')][_0xc7bd('0x9')]({'port':0x232a});config[_0xc7bd('0xa')]=_[_0xc7bd('0xb')](config['redis'],{'host':_0xc7bd('0xc'),'port':0x18eb});var socket=require(_0xc7bd('0xd'))(new Redis(config[_0xc7bd('0xa')]));require(_0xc7bd('0xe'))[_0xc7bd('0xf')](socket);function respondWithRpcPromise(_0xd38afb,_0x305a28,_0x2c458a){return new BPromise(function(_0x49892b,_0x5ddbce){return client[_0xc7bd('0x10')](_0xd38afb,_0x2c458a)[_0xc7bd('0x11')](function(_0x5978b4){logger[_0xc7bd('0x12')](_0xc7bd('0x13'),_0x305a28,_0xc7bd('0x14'));logger[_0xc7bd('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x305a28,'request\x20sent',JSON[_0xc7bd('0x16')](_0x5978b4));if(_0x5978b4['error']){if(_0x5978b4[_0xc7bd('0x17')][_0xc7bd('0x18')]===0x1f4){logger[_0xc7bd('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x305a28,_0x5978b4[_0xc7bd('0x17')][_0xc7bd('0x19')]);return _0x5ddbce(_0x5978b4[_0xc7bd('0x17')][_0xc7bd('0x19')]);}logger[_0xc7bd('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x305a28,_0x5978b4[_0xc7bd('0x17')][_0xc7bd('0x19')]);return _0x49892b(_0x5978b4['error']['message']);}else{logger[_0xc7bd('0x12')](_0xc7bd('0x13'),_0x305a28,_0xc7bd('0x14'));_0x49892b(_0x5978b4['result']['message']);}})['catch'](function(_0x39a13c){logger['error'](_0xc7bd('0x13'),_0x305a28,_0x39a13c);_0x5ddbce(_0x39a13c);});});}exports[_0xc7bd('0x1a')]=function(_0x972ffb){var _0x584dc9=this;return new Promise(function(_0x27e7cf,_0x15e5d3){return db[_0xc7bd('0x1b')]['create'](_0x972ffb[_0xc7bd('0x1c')],{'raw':_0x972ffb[_0xc7bd('0x1d')]?_0x972ffb[_0xc7bd('0x1d')][_0xc7bd('0x1e')]===undefined?!![]:![]:!![]})[_0xc7bd('0x11')](function(_0x219d2a){logger['info'](_0xc7bd('0x1a'),_0x972ffb);logger['debug'](_0xc7bd('0x1a'),_0x972ffb,JSON['stringify'](_0x219d2a));_0x27e7cf(_0x219d2a);})[_0xc7bd('0x1f')](function(_0x201854){logger[_0xc7bd('0x17')]('CreateWhatsappMessage',_0x201854[_0xc7bd('0x19')],_0x972ffb);_0x15e5d3(_0x584dc9[_0xc7bd('0x17')](0x1f4,_0x201854[_0xc7bd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e3d818d..bcaeb18 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 _0x0811=['removeListener','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x19acbe,_0x804cf4){var _0x241f33=function(_0x5dffa1){while(--_0x5dffa1){_0x19acbe['push'](_0x19acbe['shift']());}};_0x241f33(++_0x804cf4);}(_0x0811,0xb3));var _0x1081=function(_0x50af9c,_0xf03b1e){_0x50af9c=_0x50af9c-0x0;var _0x5b5e5a=_0x0811[_0x50af9c];return _0x5b5e5a;};'use strict';var WhatsappMessageEvents=require(_0x1081('0x0'));var events=[_0x1081('0x1'),_0x1081('0x2'),_0x1081('0x3')];function createListener(_0x14d6d2,_0x1a733c){return function(_0x2224d3){_0x1a733c[_0x1081('0x4')](_0x14d6d2,_0x2224d3);};}function removeListener(_0x4d7a81,_0x5c4b77){return function(){WhatsappMessageEvents[_0x1081('0x5')](_0x4d7a81,_0x5c4b77);};}exports['register']=function(_0x4c332a){for(var _0xdb1f60=0x0,_0x6555bc=events[_0x1081('0x6')];_0xdb1f60<_0x6555bc;_0xdb1f60++){var _0x7da53a=events[_0xdb1f60];var _0x25d7c5=createListener(_0x1081('0x7')+_0x7da53a,_0x4c332a);WhatsappMessageEvents['on'](_0x7da53a,_0x25d7c5);}}; \ No newline at end of file +var _0x14ee=['whatsappMessage:','./whatsappMessage.events','update','emit','removeListener','length'];(function(_0x338708,_0x211f8d){var _0x24188a=function(_0x1001a6){while(--_0x1001a6){_0x338708['push'](_0x338708['shift']());}};_0x24188a(++_0x211f8d);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0xe14e('0x0'));var events=['save','remove',_0xe14e('0x1')];function createListener(_0x43dba9,_0x9df8cf){return function(_0xdff449){_0x9df8cf[_0xe14e('0x2')](_0x43dba9,_0xdff449);};}function removeListener(_0x5db128,_0x1c8074){return function(){WhatsappMessageEvents[_0xe14e('0x3')](_0x5db128,_0x1c8074);};}exports['register']=function(_0x55d396){for(var _0x4c78d1=0x0,_0x1113a9=events[_0xe14e('0x4')];_0x4c78d1<_0x1113a9;_0x4c78d1++){var _0x29b76d=events[_0x4c78d1];var _0x10b6ac=createListener(_0xe14e('0x5')+_0x29b76d,_0x55d396);WhatsappMessageEvents['on'](_0x29b76d,_0x10b6ac);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e22bd95..ca00675 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 _0xef12=['isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xef12,0x130));var _0x2ef1=function(_0x2826b2,_0x4e5433){_0x2826b2=_0x2826b2-0x0;var _0x3ab75d=_0xef12[_0x2826b2];return _0x3ab75d;};'use strict';var multer=require('multer');var util=require(_0x2ef1('0x0'));var path=require(_0x2ef1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ef1('0x2')]();var auth=require(_0x2ef1('0x3'));var interaction=require(_0x2ef1('0x4'));var config=require(_0x2ef1('0x5'));var controller=require(_0x2ef1('0x6'));router[_0x2ef1('0x7')]('/',auth[_0x2ef1('0x8')](),controller[_0x2ef1('0x9')]);router[_0x2ef1('0x7')](_0x2ef1('0xa'),auth['isAuthenticated'](),controller[_0x2ef1('0xb')]);router[_0x2ef1('0x7')](_0x2ef1('0xc'),auth[_0x2ef1('0x8')](),controller[_0x2ef1('0xd')]);router[_0x2ef1('0x7')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x2ef1('0x7')](_0x2ef1('0xe'),auth[_0x2ef1('0x8')](),controller[_0x2ef1('0xf')]);router['get'](_0x2ef1('0x10'),auth[_0x2ef1('0x8')](),controller['getAgents']);router[_0x2ef1('0x11')]('/',auth[_0x2ef1('0x8')](),controller['create']);router[_0x2ef1('0x11')](_0x2ef1('0xe'),auth[_0x2ef1('0x8')](),controller[_0x2ef1('0x12')]);router['post'](_0x2ef1('0x10'),auth[_0x2ef1('0x8')](),controller[_0x2ef1('0x13')]);router[_0x2ef1('0x14')](_0x2ef1('0xc'),auth[_0x2ef1('0x8')](),controller[_0x2ef1('0x15')]);router[_0x2ef1('0x16')]('/:id',auth[_0x2ef1('0x8')](),controller[_0x2ef1('0x17')]);router[_0x2ef1('0x16')](_0x2ef1('0xe'),auth[_0x2ef1('0x8')](),controller[_0x2ef1('0x18')]);router['delete'](_0x2ef1('0x10'),auth[_0x2ef1('0x8')](),controller['removeAgents']);module[_0x2ef1('0x19')]=router; \ No newline at end of file +var _0x3bdd=['getAgents','post','create','addTeams','put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x3bdd,0x1e5));var _0xd3bd=function(_0x50ab6c,_0x1dafb4){_0x50ab6c=_0x50ab6c-0x0;var _0x1198b0=_0x3bdd[_0x50ab6c];return _0x1198b0;};'use strict';var multer=require(_0xd3bd('0x0'));var util=require('util');var path=require(_0xd3bd('0x1'));var timeout=require(_0xd3bd('0x2'));var express=require('express');var router=express[_0xd3bd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd3bd('0x4'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xd3bd('0x5')]('/',auth[_0xd3bd('0x6')](),controller[_0xd3bd('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd3bd('0x8')]);router[_0xd3bd('0x5')](_0xd3bd('0x9'),auth[_0xd3bd('0x6')](),controller[_0xd3bd('0xa')]);router['get'](_0xd3bd('0xb'),auth[_0xd3bd('0x6')](),controller[_0xd3bd('0xc')]);router[_0xd3bd('0x5')](_0xd3bd('0xd'),auth[_0xd3bd('0x6')](),controller['getTeams']);router[_0xd3bd('0x5')](_0xd3bd('0xe'),auth[_0xd3bd('0x6')](),controller[_0xd3bd('0xf')]);router[_0xd3bd('0x10')]('/',auth[_0xd3bd('0x6')](),controller[_0xd3bd('0x11')]);router[_0xd3bd('0x10')](_0xd3bd('0xd'),auth[_0xd3bd('0x6')](),controller[_0xd3bd('0x12')]);router[_0xd3bd('0x10')]('/:id/users',auth[_0xd3bd('0x6')](),controller['addAgents']);router[_0xd3bd('0x13')](_0xd3bd('0x9'),auth[_0xd3bd('0x6')](),controller[_0xd3bd('0x14')]);router[_0xd3bd('0x15')](_0xd3bd('0x9'),auth[_0xd3bd('0x6')](),controller[_0xd3bd('0x16')]);router[_0xd3bd('0x15')](_0xd3bd('0xd'),auth[_0xd3bd('0x6')](),controller['removeTeams']);router['delete'](_0xd3bd('0xe'),auth[_0xd3bd('0x6')](),controller[_0xd3bd('0x17')]);module[_0xd3bd('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index fb20d4f..51ec32f 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 _0xde35=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','beepall'];(function(_0xd13171,_0xc54453){var _0x452bd0=function(_0x3c0628){while(--_0x3c0628){_0xd13171['push'](_0xd13171['shift']());}};_0x452bd0(++_0xc54453);}(_0xde35,0x17b));var _0x5de3=function(_0x3cfabe,_0x371a0a){_0x3cfabe=_0x3cfabe-0x0;var _0x231c98=_0xde35[_0x3cfabe];return _0x231c98;};'use strict';var Sequelize=require(_0x5de3('0x0'));module[_0x5de3('0x1')]={'name':{'type':Sequelize[_0x5de3('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5de3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5de3('0x4')]('rrmemory',_0x5de3('0x5'),_0x5de3('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x96e7=['roundrobin','STRING','sequelize','exports','name','beepall'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x96e7,0x1b8));var _0x796e=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0x96e7[_0x1b25c1];return _0x1e4447;};'use strict';var Sequelize=require(_0x796e('0x0'));module[_0x796e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x796e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x796e('0x3'),_0x796e('0x4'))},'description':{'type':Sequelize[_0x796e('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 87a0779..fc8acaa 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 _0x90fe=['type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','WhatsappQueue','includeAll','findAll','catch','show','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','update','body','describe','UserWhatsappQueue','rawAttributes','pick','WhatsappQueueId','User','UserId','agent','createdAt','format','%s/%s','SIP','whatsappPause','updatedAt','getTeams','findOne','ids','Team','Agents','online','voicePause','interface','sequelize','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','toString','every','all','union','value','transaction','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','error','stack','name','send','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90fe,0xdf));var _0xe90f=function(_0x2f109f,_0x5d78af){_0x2f109f=_0x2f109f-0x0;var _0x4da548=_0x90fe[_0x2f109f];return _0x4da548;};'use strict';var pdf=require(_0xe90f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe90f('0x1'));var zipdir=require(_0xe90f('0x2'));var jsonpatch=require(_0xe90f('0x3'));var rp=require(_0xe90f('0x4'));var moment=require('moment');var BPromise=require(_0xe90f('0x5'));var Mustache=require(_0xe90f('0x6'));var util=require('util');var path=require(_0xe90f('0x7'));var sox=require(_0xe90f('0x8'));var csv=require(_0xe90f('0x9'));var ejs=require(_0xe90f('0xa'));var fs=require('fs');var _=require(_0xe90f('0xb'));var squel=require(_0xe90f('0xc'));var crypto=require('crypto');var jsforce=require(_0xe90f('0xd'));var deskjs=require(_0xe90f('0xe'));var toCsv=require(_0xe90f('0x9'));var querystring=require(_0xe90f('0xf'));var Papa=require(_0xe90f('0x10'));var Redis=require(_0xe90f('0x11'));var authService=require(_0xe90f('0x12'));var qs=require(_0xe90f('0x13'));var as=require(_0xe90f('0x14'));var hardwareService=require(_0xe90f('0x15'));var logger=require('../../config/logger')(_0xe90f('0x16'));var utils=require(_0xe90f('0x17'));var config=require(_0xe90f('0x18'));var db=require('../../mysqldb')['db'];config[_0xe90f('0x19')]=_[_0xe90f('0x1a')](config[_0xe90f('0x19')],{'host':_0xe90f('0x1b'),'port':0x18eb});var socket=require(_0xe90f('0x1c'))(new Redis(config['redis']));require(_0xe90f('0x1d'))[_0xe90f('0x1e')](socket);function respondWithStatusCode(_0x175097,_0x46ffa6){_0x46ffa6=_0x46ffa6||0xcc;return function(_0x11adc2){if(_0x11adc2){return _0x175097[_0xe90f('0x1f')](_0x46ffa6);}return _0x175097['status'](_0x46ffa6)[_0xe90f('0x20')]();};}function respondWithResult(_0x42c9f8,_0x2a8fd3){_0x2a8fd3=_0x2a8fd3||0xc8;return function(_0x58319a){if(_0x58319a){return _0x42c9f8[_0xe90f('0x21')](_0x2a8fd3)[_0xe90f('0x22')](_0x58319a);}};}function respondWithFilteredResult(_0x2291a9,_0x1e509b){return function(_0x199ab9){if(_0x199ab9){var _0x17c872=_0x199ab9[_0xe90f('0x23')],_0x31b851=_0x1e509b[_0xe90f('0x24')],_0x4e04f0=_0x1e509b[_0xe90f('0x24')]+_0x1e509b[_0xe90f('0x25')],_0x11d487;if(_0x4e04f0>=_0x17c872){_0x4e04f0=_0x17c872;_0x11d487=0xc8;}else{_0x11d487=0xce;}_0x2291a9[_0xe90f('0x21')](_0x11d487);return _0x2291a9[_0xe90f('0x26')](_0xe90f('0x27'),_0x31b851+'-'+_0x4e04f0+'/'+_0x17c872)[_0xe90f('0x22')](_0x199ab9);}return null;};}function patchUpdates(_0x2e8cc7){return function(_0x51d58e){try{jsonpatch['apply'](_0x51d58e,_0x2e8cc7,!![]);}catch(_0x348626){return BPromise[_0xe90f('0x28')](_0x348626);}return _0x51d58e[_0xe90f('0x29')]();};}function saveUpdates(_0x261f44,_0x30509f){return function(_0x39cde8){if(_0x39cde8){return _0x39cde8['update'](_0x261f44)[_0xe90f('0x2a')](function(_0x1ff3a0){return _0x1ff3a0;});}return null;};}function removeEntity(_0x1345e7,_0x28cbe9){return function(_0xedca6a){if(_0xedca6a){return _0xedca6a[_0xe90f('0x2b')]()[_0xe90f('0x2a')](function(){var _0x484672=_0xedca6a[_0xe90f('0x2c')]({'plain':!![]});var _0x4d593b='WhatsappQueues';return db['UserProfileResource'][_0xe90f('0x2b')]({'where':{'type':_0x4d593b,'resourceId':_0x484672['id']}})[_0xe90f('0x2a')](function(){return _0xedca6a;});})[_0xe90f('0x2a')](function(){_0x1345e7[_0xe90f('0x21')](0xcc)[_0xe90f('0x20')]();});}};}function handleEntityNotFound(_0x3500bd,_0xae8550){return function(_0x5bb17d){if(!_0x5bb17d){_0x3500bd[_0xe90f('0x1f')](0x194);}return _0x5bb17d;};}function handleError(_0x3b1031,_0xf32fa9){_0xf32fa9=_0xf32fa9||0x1f4;return function(_0xba1dd9){logger[_0xe90f('0x2d')](_0xba1dd9[_0xe90f('0x2e')]);if(_0xba1dd9[_0xe90f('0x2f')]){delete _0xba1dd9[_0xe90f('0x2f')];}_0x3b1031['status'](_0xf32fa9)[_0xe90f('0x30')](_0xba1dd9);};}exports[_0xe90f('0x31')]=function(_0x22d004,_0x5cb057){var _0x1f72f4={},_0x1b926b={},_0x315c4f={'count':0x0,'rows':[]};var _0x101e12=_[_0xe90f('0x32')](db['WhatsappQueue']['rawAttributes'],function(_0x426d73){return{'name':_0x426d73['fieldName'],'type':_0x426d73[_0xe90f('0x33')]['key']};});_0x1b926b[_0xe90f('0x34')]=_[_0xe90f('0x32')](_0x101e12,'name');_0x1b926b[_0xe90f('0x35')]=_[_0xe90f('0x36')](_0x22d004[_0xe90f('0x35')]);_0x1b926b[_0xe90f('0x37')]=_['intersection'](_0x1b926b[_0xe90f('0x34')],_0x1b926b[_0xe90f('0x35')]);_0x1f72f4['attributes']=_[_0xe90f('0x38')](_0x1b926b[_0xe90f('0x34')],qs[_0xe90f('0x39')](_0x22d004['query'][_0xe90f('0x39')]));_0x1f72f4['attributes']=_0x1f72f4[_0xe90f('0x3a')][_0xe90f('0x3b')]?_0x1f72f4[_0xe90f('0x3a')]:_0x1b926b[_0xe90f('0x34')];if(!_0x22d004[_0xe90f('0x35')][_0xe90f('0x3c')](_0xe90f('0x3d'))){_0x1f72f4[_0xe90f('0x25')]=qs['limit'](_0x22d004[_0xe90f('0x35')]['limit']);_0x1f72f4[_0xe90f('0x24')]=qs[_0xe90f('0x24')](_0x22d004['query'][_0xe90f('0x24')]);}_0x1f72f4[_0xe90f('0x3e')]=qs[_0xe90f('0x3f')](_0x22d004[_0xe90f('0x35')][_0xe90f('0x3f')]);_0x1f72f4['where']=qs[_0xe90f('0x37')](_['pick'](_0x22d004[_0xe90f('0x35')],_0x1b926b[_0xe90f('0x37')]),_0x101e12);if(_0x22d004[_0xe90f('0x35')][_0xe90f('0x40')]){_0x1f72f4[_0xe90f('0x41')]=_['merge'](_0x1f72f4[_0xe90f('0x41')],{'$or':_['map'](_0x101e12,function(_0x237f79){if(_0x237f79['type']!==_0xe90f('0x42')){var _0xbec356={};_0xbec356[_0x237f79[_0xe90f('0x2f')]]={'$like':'%'+_0x22d004[_0xe90f('0x35')][_0xe90f('0x40')]+'%'};return _0xbec356;}})});}_0x1f72f4=_[_0xe90f('0x43')]({},_0x1f72f4,_0x22d004[_0xe90f('0x44')]);var _0x1a582d={'where':_0x1f72f4[_0xe90f('0x41')]};return db[_0xe90f('0x45')][_0xe90f('0x23')](_0x1a582d)[_0xe90f('0x2a')](function(_0x5926f3){_0x315c4f[_0xe90f('0x23')]=_0x5926f3;if(_0x22d004[_0xe90f('0x35')][_0xe90f('0x46')]){_0x1f72f4['include']=[{'all':!![]}];}return db[_0xe90f('0x45')][_0xe90f('0x47')](_0x1f72f4);})[_0xe90f('0x2a')](function(_0x93028e){_0x315c4f['rows']=_0x93028e;return _0x315c4f;})['then'](respondWithFilteredResult(_0x5cb057,_0x1f72f4))[_0xe90f('0x48')](handleError(_0x5cb057,null));};exports[_0xe90f('0x49')]=function(_0x1aba81,_0xb48582){var _0x5ef5ab={'raw':!![],'where':{'id':_0x1aba81[_0xe90f('0x4a')]['id']}},_0x238615={};_0x238615['model']=_[_0xe90f('0x36')](db['WhatsappQueue']['rawAttributes']);_0x238615['query']=_[_0xe90f('0x36')](_0x1aba81[_0xe90f('0x35')]);_0x238615[_0xe90f('0x37')]=_[_0xe90f('0x38')](_0x238615[_0xe90f('0x34')],_0x238615[_0xe90f('0x35')]);_0x5ef5ab[_0xe90f('0x3a')]=_[_0xe90f('0x38')](_0x238615['model'],qs[_0xe90f('0x39')](_0x1aba81[_0xe90f('0x35')][_0xe90f('0x39')]));_0x5ef5ab['attributes']=_0x5ef5ab[_0xe90f('0x3a')][_0xe90f('0x3b')]?_0x5ef5ab[_0xe90f('0x3a')]:_0x238615[_0xe90f('0x34')];if(_0x1aba81[_0xe90f('0x35')][_0xe90f('0x46')]){_0x5ef5ab[_0xe90f('0x4b')]=[{'all':!![]}];}_0x5ef5ab=_['merge']({},_0x5ef5ab,_0x1aba81[_0xe90f('0x44')]);return db[_0xe90f('0x45')][_0xe90f('0x4c')](_0x5ef5ab)[_0xe90f('0x2a')](handleEntityNotFound(_0xb48582,null))[_0xe90f('0x2a')](respondWithResult(_0xb48582,null))['catch'](handleError(_0xb48582,null));};exports['create']=function(_0x22ba02,_0x479cde){return db['WhatsappQueue'][_0xe90f('0x4d')](_0x22ba02['body'],{})[_0xe90f('0x2a')](function(_0x4d24c8){var _0x5361eb=_0x22ba02['user'][_0xe90f('0x2c')]({'plain':!![]});if(!_0x5361eb)throw new Error(_0xe90f('0x4e'));if(_0x5361eb[_0xe90f('0x4f')]===_0xe90f('0x50')){var _0x4bdc7f=_0x4d24c8['get']({'plain':!![]});var _0x5ae6eb=_0xe90f('0x51');return db[_0xe90f('0x52')][_0xe90f('0x4c')]({'where':{'name':_0x5ae6eb,'userProfileId':_0x5361eb[_0xe90f('0x53')]},'raw':!![]})['then'](function(_0x569252){if(_0x569252&&_0x569252[_0xe90f('0x54')]===0x0){return db['UserProfileResource'][_0xe90f('0x4d')]({'name':_0x4bdc7f['name'],'resourceId':_0x4bdc7f['id'],'type':_0x569252[_0xe90f('0x2f')],'sectionId':_0x569252['id']},{})[_0xe90f('0x2a')](function(){return _0x4d24c8;});}else{return _0x4d24c8;}})[_0xe90f('0x48')](function(_0xd0d406){logger[_0xe90f('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd0d406);throw _0xd0d406;});}return _0x4d24c8;})['then'](respondWithResult(_0x479cde,0xc9))[_0xe90f('0x48')](handleError(_0x479cde,null));};exports[_0xe90f('0x55')]=function(_0x46b86d,_0x121c9f){if(_0x46b86d[_0xe90f('0x56')]['id']){delete _0x46b86d['body']['id'];}return db[_0xe90f('0x45')]['find']({'where':{'id':_0x46b86d['params']['id']}})[_0xe90f('0x2a')](handleEntityNotFound(_0x121c9f,null))[_0xe90f('0x2a')](saveUpdates(_0x46b86d[_0xe90f('0x56')],null))[_0xe90f('0x2a')](respondWithResult(_0x121c9f,null))[_0xe90f('0x48')](handleError(_0x121c9f,null));};exports[_0xe90f('0x2b')]=function(_0x399e6a,_0x193ceb){return db[_0xe90f('0x45')][_0xe90f('0x4c')]({'where':{'id':_0x399e6a[_0xe90f('0x4a')]['id']}})[_0xe90f('0x2a')](handleEntityNotFound(_0x193ceb,null))[_0xe90f('0x2a')](removeEntity(_0x193ceb,null))[_0xe90f('0x48')](handleError(_0x193ceb,null));};exports[_0xe90f('0x57')]=function(_0x5ad65d,_0x5d94f8){return db[_0xe90f('0x45')][_0xe90f('0x57')]()['then'](respondWithResult(_0x5d94f8,null))[_0xe90f('0x48')](handleError(_0x5d94f8,null));};exports['getMembers']=function(_0x404d52,_0x5df0ad,_0x44f4ba){var _0x50f25c={'raw':!![],'where':{}},_0x3bb1ba={},_0xf8f3da;return db['WhatsappQueue']['findOne']({'where':{'id':_0x404d52['params']['id']}})['then'](handleEntityNotFound(_0x5df0ad,null))[_0xe90f('0x2a')](function(_0x1b9ad9){if(_0x1b9ad9){_0xf8f3da=_0x1b9ad9[_0xe90f('0x2c')]({'plain':!![]});_0x3bb1ba[_0xe90f('0x34')]=_['keys'](db[_0xe90f('0x58')][_0xe90f('0x59')]);_0x3bb1ba[_0xe90f('0x35')]=_[_0xe90f('0x36')](_0x404d52[_0xe90f('0x35')]);_0x3bb1ba['filters']=_[_0xe90f('0x38')](_0x3bb1ba[_0xe90f('0x34')],_0x3bb1ba[_0xe90f('0x35')]);_0x50f25c[_0xe90f('0x3a')]=_[_0xe90f('0x38')](_0x3bb1ba[_0xe90f('0x34')],qs[_0xe90f('0x39')](_0x404d52[_0xe90f('0x35')]['fields']));_0x50f25c['attributes']=_0x50f25c[_0xe90f('0x3a')]['length']?_0x50f25c[_0xe90f('0x3a')]:_0x3bb1ba[_0xe90f('0x34')];if(!_0x404d52[_0xe90f('0x35')]['hasOwnProperty'](_0xe90f('0x3d'))){_0x50f25c[_0xe90f('0x25')]=qs['limit'](_0x404d52['query']['limit']);_0x50f25c[_0xe90f('0x24')]=qs[_0xe90f('0x24')](_0x404d52[_0xe90f('0x35')][_0xe90f('0x24')]);}_0x50f25c[_0xe90f('0x3e')]=qs[_0xe90f('0x3f')](_0x404d52[_0xe90f('0x35')][_0xe90f('0x3f')]);_0x50f25c[_0xe90f('0x41')]=qs[_0xe90f('0x37')](_[_0xe90f('0x5a')](_0x404d52[_0xe90f('0x35')],_0x3bb1ba[_0xe90f('0x37')]));_0x50f25c[_0xe90f('0x41')][_0xe90f('0x5b')]=_0x1b9ad9['id'];if(_0x404d52[_0xe90f('0x35')][_0xe90f('0x40')]){_0x50f25c[_0xe90f('0x41')]=_['merge'](_0x50f25c['where'],{'$or':_[_0xe90f('0x32')](_0x50f25c[_0xe90f('0x3a')],function(_0xd643e9){var _0x40c4fc={};_0x40c4fc[_0xd643e9]={'$like':'%'+_0x404d52[_0xe90f('0x35')][_0xe90f('0x40')]+'%'};return _0x40c4fc;})});}_0x50f25c=_['merge']({},_0x50f25c,_0x404d52[_0xe90f('0x44')]);return db[_0xe90f('0x58')][_0xe90f('0x47')](_0x50f25c);}})[_0xe90f('0x2a')](function(_0x429167){if(_0x429167){return db[_0xe90f('0x5c')]['findAndCountAll']({'where':{'id':_[_0xe90f('0x32')](_0x429167,_0xe90f('0x5d')),'role':_0xe90f('0x5e')},'attributes':['id',_0xe90f('0x2f'),'whatsappPause','updatedAt',_0xe90f('0x5f')]});}})[_0xe90f('0x2a')](function(_0x5018d2){if(_0x5018d2){return{'count':_0x5018d2[_0xe90f('0x23')],'rows':_['map'](_0x5018d2['rows'],function(_0x360ce4){return{'membername':_0x360ce4['name'],'UserId':_0x360ce4['id'],'queue_name':_0xf8f3da[_0xe90f('0x2f')],'WhatsappQueueId':_0xf8f3da['id'],'interface':util[_0xe90f('0x60')](_0xe90f('0x61'),_0xe90f('0x62'),_0x360ce4['name']),'penalty':0x0,'paused':_0x360ce4[_0xe90f('0x63')],'createdAt':_0x360ce4[_0xe90f('0x5f')],'updatedAt':_0x360ce4[_0xe90f('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe90f('0x2a')](respondWithFilteredResult(_0x5df0ad,_0x50f25c))['catch'](handleError(_0x5df0ad,null));};exports[_0xe90f('0x65')]=function(_0x510299,_0xb2f239,_0xf1f7ad){var _0x598e37={};var _0x169c46={};var _0x325d1d;var _0x56dcf8;return db[_0xe90f('0x45')][_0xe90f('0x66')]({'where':{'id':_0x510299['params']['id']}})['then'](handleEntityNotFound(_0xb2f239,null))[_0xe90f('0x2a')](function(_0x3bdcc7){if(_0x3bdcc7){_0x325d1d=_0x3bdcc7;_0x169c46[_0xe90f('0x34')]=_[_0xe90f('0x36')](db['Team']['rawAttributes']);_0x169c46['query']=_['keys'](_0x510299['query']);_0x169c46[_0xe90f('0x37')]=_[_0xe90f('0x38')](_0x169c46['model'],_0x169c46[_0xe90f('0x35')]);_0x598e37['attributes']=_[_0xe90f('0x38')](_0x169c46[_0xe90f('0x34')],qs[_0xe90f('0x39')](_0x510299[_0xe90f('0x35')][_0xe90f('0x39')]));_0x598e37['attributes']=_0x598e37[_0xe90f('0x3a')][_0xe90f('0x3b')]?_0x598e37['attributes']:_0x169c46[_0xe90f('0x34')];_0x598e37['order']=qs[_0xe90f('0x3f')](_0x510299['query'][_0xe90f('0x3f')]);_0x598e37['where']=qs[_0xe90f('0x37')](_[_0xe90f('0x5a')](_0x510299['query'],_0x169c46['filters']));if(_0x510299[_0xe90f('0x35')]['filter']){_0x598e37[_0xe90f('0x41')]=_[_0xe90f('0x43')](_0x598e37['where'],{'$or':_['map'](_0x598e37[_0xe90f('0x3a')],function(_0x148240){var _0x24bf0f={};_0x24bf0f[_0x148240]={'$like':'%'+_0x510299[_0xe90f('0x35')][_0xe90f('0x40')]+'%'};return _0x24bf0f;})});}_0x598e37=_['merge']({},_0x598e37,_0x510299[_0xe90f('0x44')]);return _0x325d1d[_0xe90f('0x65')](_0x598e37);}})[_0xe90f('0x2a')](function(_0xa831d){if(_0xa831d){_0x56dcf8=_0xa831d[_0xe90f('0x3b')];if(!_0x510299[_0xe90f('0x35')]['hasOwnProperty']('nolimit')){_0x598e37[_0xe90f('0x25')]=qs['limit'](_0x510299['query'][_0xe90f('0x25')]);_0x598e37['offset']=qs[_0xe90f('0x24')](_0x510299[_0xe90f('0x35')][_0xe90f('0x24')]);}return _0x325d1d[_0xe90f('0x65')](_0x598e37);}})[_0xe90f('0x2a')](function(_0x59e9b0){if(_0x59e9b0){return _0x59e9b0?{'count':_0x56dcf8,'rows':_0x59e9b0}:null;}})[_0xe90f('0x2a')](respondWithResult(_0xb2f239,null))[_0xe90f('0x48')](handleError(_0xb2f239,null));};exports['addTeams']=function(_0x563d7c,_0x2258a5,_0x4b9d13){var _0x5a32ea=_0x563d7c[_0xe90f('0x56')][_0xe90f('0x67')];return db[_0xe90f('0x68')][_0xe90f('0x47')]({'where':{'id':_0x5a32ea},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe90f('0x69'),'attributes':['id',_0xe90f('0x2f'),_0xe90f('0x6a'),_0xe90f('0x6b'),_0xe90f('0x6c')],'raw':!![]}]})[_0xe90f('0x2a')](function(_0x2cc8af){if(_0x2cc8af){var _0x1edbf5=_['flatMap'](_0x2cc8af,function(_0xa83c5c){var _0x4036ad=_0xa83c5c[_0xe90f('0x2c')]({'plain':!![]});return _0x4036ad[_0xe90f('0x69')];});return db['WhatsappQueue'][_0xe90f('0x4c')]({'where':{'id':_0x563d7c['params']['id']}})[_0xe90f('0x2a')](function(_0x4ed653){return db[_0xe90f('0x6d')]['transaction'](function(_0x50f954){return _0x4ed653[_0xe90f('0x6e')](_0x5a32ea,{'transaction':_0x50f954})['then'](function(){return BPromise['each'](_0x1edbf5,function(_0x5e46fd){return db['UserWhatsappQueue'][_0xe90f('0x6f')]({'where':{'UserId':_0x5e46fd['id'],'WhatsappQueueId':_0x563d7c[_0xe90f('0x4a')]['id']},'transaction':_0x50f954});});})['then'](function(){_0x1edbf5[_0xe90f('0x70')](function(_0x9ce807){socket[_0xe90f('0x71')](_0xe90f('0x72'),{'UserId':_0x9ce807['id'],'WhatsappQueueId':_0x4ed653['id']});});});});});}})['then'](respondWithStatusCode(_0x2258a5,null))[_0xe90f('0x48')](handleError(_0x2258a5,null));};exports[_0xe90f('0x73')]=function(_0x2cc3d2,_0x35a3bd,_0x375269){return db['Team'][_0xe90f('0x47')]({'where':{'id':_0x2cc3d2[_0xe90f('0x35')][_0xe90f('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe90f('0x2a')](handleEntityNotFound(_0x35a3bd,null))[_0xe90f('0x2a')](function(_0x4da872){var _0x47903a=_['map'](_0x4da872,'id');var _0x52731a=[];var _0x2d50a7=[];var _0x5849f4=squel[_0xe90f('0x74')]();_0x5849f4[_0xe90f('0x75')]('tq.TeamId')[_0xe90f('0x76')](_0xe90f('0x77'),'tq')[_0xe90f('0x78')]('user_has_teams','ut',_0xe90f('0x79'))['where']('WhatsappQueueId\x20=\x20?',_0x2cc3d2['params']['id']);for(var _0x320555=0x0;_0x320555<_0x4da872[_0xe90f('0x3b')];_0x320555+=0x1){let _0x8c7704=_0x4da872[_0x320555];for(var _0x52b206=0x0;_0x52b206<_0x8c7704[_0xe90f('0x69')][_0xe90f('0x3b')];_0x52b206+=0x1){let _0x482210=_0x8c7704[_0xe90f('0x69')][_0x52b206];var _0x71b157=_0x5849f4[_0xe90f('0x7a')]();_0x71b157[_0xe90f('0x41')]('ut.UserId\x20=\x20?',_0x482210['id']);_0x2d50a7['push'](db[_0xe90f('0x6d')][_0xe90f('0x35')](_0x71b157[_0xe90f('0x7b')](),{'type':db[_0xe90f('0x6d')]['QueryTypes']['SELECT']})[_0xe90f('0x2a')](function(_0x3a33ee){if(_0x3a33ee[_0xe90f('0x3b')]===0x1){return _0x482210['id'];}else{var _0x3d8dac=_[_0xe90f('0x7c')](_[_0xe90f('0x32')](_0x3a33ee,'TeamId'),function(_0x2e7071){return _['includes'](_0x47903a,_0x2e7071);});if(_0x3d8dac){return _0x482210['id'];}}}));}}return BPromise[_0xe90f('0x7d')](_0x2d50a7)[_0xe90f('0x2a')](function(_0x1043b5){_0x52731a=_(_0x52731a)[_0xe90f('0x7e')](_0x1043b5)['compact']()[_0xe90f('0x7f')]();return db[_0xe90f('0x45')][_0xe90f('0x4c')]({'where':{'id':_0x2cc3d2[_0xe90f('0x4a')]['id']}})[_0xe90f('0x2a')](function(_0x42687c){return db[_0xe90f('0x6d')][_0xe90f('0x80')](function(_0x28c795){return _0x42687c[_0xe90f('0x73')](_0x2cc3d2['query']['ids'],{'transaction':_0x28c795})[_0xe90f('0x2a')](function(){if(!_[_0xe90f('0x81')](_0x52731a)){return _0x42687c['removeAgents'](_0x52731a,{'transaction':_0x28c795});}})[_0xe90f('0x2a')](function(){_0x52731a['forEach'](function(_0x1c9ba1){socket[_0xe90f('0x71')](_0xe90f('0x82'),{'UserId':_0x1c9ba1,'WhatsappQueueId':_0x42687c['id']});});});});});});})[_0xe90f('0x2a')](respondWithStatusCode(_0x35a3bd,null))[_0xe90f('0x48')](handleError(_0x35a3bd,null));};exports[_0xe90f('0x83')]=function(_0x3e3df5,_0x10ddc9,_0x336df7){return db[_0xe90f('0x45')][_0xe90f('0x4c')]({'where':{'id':_0x3e3df5[_0xe90f('0x4a')]['id']}})[_0xe90f('0x2a')](handleEntityNotFound(_0x10ddc9,null))[_0xe90f('0x2a')](function(_0x1dabd1){if(_0x1dabd1){return _0x1dabd1[_0xe90f('0x83')](_0x3e3df5['body']['ids'],_[_0xe90f('0x84')](_0x3e3df5['body'],[_0xe90f('0x67'),'id'])||{})[_0xe90f('0x85')](function(_0x2e2c3e){for(var _0x20a27a=0x0;_0x20a27a<_0x3e3df5['body'][_0xe90f('0x67')][_0xe90f('0x3b')];_0x20a27a+=0x1){socket[_0xe90f('0x71')](_0xe90f('0x72'),{'UserId':_0x3e3df5['body']['ids'][_0x20a27a],'WhatsappQueueId':_0x3e3df5[_0xe90f('0x4a')]['id']});}return _0x2e2c3e;});}})[_0xe90f('0x2a')](respondWithResult(_0x10ddc9,null))[_0xe90f('0x48')](handleError(_0x10ddc9,null));};exports[_0xe90f('0x86')]=function(_0x68825c,_0x5968fc,_0x5c69b4){return db[_0xe90f('0x45')]['find']({'where':{'id':_0x68825c[_0xe90f('0x4a')]['id']}})[_0xe90f('0x2a')](handleEntityNotFound(_0x5968fc,null))[_0xe90f('0x2a')](function(_0x4d46d4){if(_0x4d46d4){return _0x4d46d4[_0xe90f('0x86')](_0x68825c['query'][_0xe90f('0x67')])[_0xe90f('0x2a')](function(){if(_[_0xe90f('0x87')](_0x68825c[_0xe90f('0x35')][_0xe90f('0x67')])){for(var _0xf32a8b=0x0;_0xf32a8b<_0x68825c[_0xe90f('0x35')][_0xe90f('0x67')][_0xe90f('0x3b')];_0xf32a8b+=0x1){socket[_0xe90f('0x71')](_0xe90f('0x82'),{'UserId':Number(_0x68825c[_0xe90f('0x35')][_0xe90f('0x67')][_0xf32a8b]),'WhatsappQueueId':Number(_0x68825c[_0xe90f('0x4a')]['id'])});}}else{socket[_0xe90f('0x71')](_0xe90f('0x82'),{'UserId':Number(_0x68825c['query'][_0xe90f('0x67')]),'WhatsappQueueId':Number(_0x68825c[_0xe90f('0x4a')]['id'])});}});}})[_0xe90f('0x2a')](respondWithStatusCode(_0x5968fc,null))[_0xe90f('0x48')](handleError(_0x5968fc,null));};exports[_0xe90f('0x88')]=function(_0x2b77d4,_0x5ecc90,_0x17b4dd){var _0x5bf9cc={};var _0x569519={};var _0xb8bb1e;var _0x38b1ed;return db[_0xe90f('0x45')][_0xe90f('0x66')]({'where':{'id':_0x2b77d4[_0xe90f('0x4a')]['id']}})[_0xe90f('0x2a')](handleEntityNotFound(_0x5ecc90,null))[_0xe90f('0x2a')](function(_0x2fbd47){if(_0x2fbd47){_0xb8bb1e=_0x2fbd47;_0x569519[_0xe90f('0x34')]=_[_0xe90f('0x36')](db[_0xe90f('0x5c')][_0xe90f('0x59')]);_0x569519[_0xe90f('0x35')]=_['keys'](_0x2b77d4[_0xe90f('0x35')]);_0x569519[_0xe90f('0x37')]=_['intersection'](_0x569519['model'],_0x569519[_0xe90f('0x35')]);_0x5bf9cc[_0xe90f('0x3a')]=_[_0xe90f('0x38')](_0x569519[_0xe90f('0x34')],qs[_0xe90f('0x39')](_0x2b77d4['query'][_0xe90f('0x39')]));_0x5bf9cc[_0xe90f('0x3a')]=_0x5bf9cc[_0xe90f('0x3a')][_0xe90f('0x3b')]?_0x5bf9cc[_0xe90f('0x3a')]:_0x569519[_0xe90f('0x34')];_0x5bf9cc['order']=qs[_0xe90f('0x3f')](_0x2b77d4['query'][_0xe90f('0x3f')]);_0x5bf9cc[_0xe90f('0x41')]=qs['filters'](_[_0xe90f('0x5a')](_0x2b77d4[_0xe90f('0x35')],_0x569519['filters']));if(_0x2b77d4['query'][_0xe90f('0x40')]){_0x5bf9cc[_0xe90f('0x41')]=_[_0xe90f('0x43')](_0x5bf9cc[_0xe90f('0x41')],{'$or':_[_0xe90f('0x32')](_0x5bf9cc[_0xe90f('0x3a')],function(_0x3e4721){var _0x31e8d8={};_0x31e8d8[_0x3e4721]={'$like':'%'+_0x2b77d4['query'][_0xe90f('0x40')]+'%'};return _0x31e8d8;})});}_0x5bf9cc=_[_0xe90f('0x43')]({},_0x5bf9cc,_0x2b77d4['options']);return _0xb8bb1e['getAgents'](_0x5bf9cc);}})[_0xe90f('0x2a')](function(_0x2a15c9){if(_0x2a15c9){_0x38b1ed=_0x2a15c9[_0xe90f('0x3b')];if(!_0x2b77d4[_0xe90f('0x35')]['hasOwnProperty']('nolimit')){_0x5bf9cc[_0xe90f('0x25')]=qs[_0xe90f('0x25')](_0x2b77d4[_0xe90f('0x35')][_0xe90f('0x25')]);_0x5bf9cc['offset']=qs[_0xe90f('0x24')](_0x2b77d4['query'][_0xe90f('0x24')]);}return _0xb8bb1e[_0xe90f('0x88')](_0x5bf9cc);}})['then'](function(_0x3329bb){if(_0x3329bb){return _0x3329bb?{'count':_0x38b1ed,'rows':_0x3329bb}:null;}})['then'](respondWithResult(_0x5ecc90,null))[_0xe90f('0x48')](handleError(_0x5ecc90,null));}; \ No newline at end of file +var _0x283b=['redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','get','WhatsappQueues','destroy','error','name','send','map','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappQueue','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserWhatsappQueue','intersection','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','whatsappPause','getTeams','findOne','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','includes','all','union','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','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'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x283b,0x188));var _0xb283=function(_0x57b27a,_0x2b05da){_0x57b27a=_0x57b27a-0x0;var _0x4187a3=_0x283b[_0x57b27a];return _0x4187a3;};'use strict';var pdf=require(_0xb283('0x0'));var emlformat=require(_0xb283('0x1'));var rimraf=require(_0xb283('0x2'));var zipdir=require(_0xb283('0x3'));var jsonpatch=require(_0xb283('0x4'));var rp=require(_0xb283('0x5'));var moment=require(_0xb283('0x6'));var BPromise=require(_0xb283('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb283('0x8'));var fs=require('fs');var _=require(_0xb283('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb283('0xa'));var deskjs=require(_0xb283('0xb'));var toCsv=require(_0xb283('0xc'));var querystring=require(_0xb283('0xd'));var Papa=require(_0xb283('0xe'));var Redis=require(_0xb283('0xf'));var authService=require(_0xb283('0x10'));var qs=require(_0xb283('0x11'));var as=require(_0xb283('0x12'));var hardwareService=require(_0xb283('0x13'));var logger=require(_0xb283('0x14'))(_0xb283('0x15'));var utils=require(_0xb283('0x16'));var config=require(_0xb283('0x17'));var db=require(_0xb283('0x18'))['db'];config[_0xb283('0x19')]=_[_0xb283('0x1a')](config[_0xb283('0x19')],{'host':_0xb283('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb283('0x19')]));require('./whatsappQueue.socket')[_0xb283('0x1c')](socket);function respondWithStatusCode(_0x129380,_0x26796e){_0x26796e=_0x26796e||0xcc;return function(_0x3b63aa){if(_0x3b63aa){return _0x129380[_0xb283('0x1d')](_0x26796e);}return _0x129380[_0xb283('0x1e')](_0x26796e)[_0xb283('0x1f')]();};}function respondWithResult(_0x283d6a,_0x32bf95){_0x32bf95=_0x32bf95||0xc8;return function(_0x5137ca){if(_0x5137ca){return _0x283d6a[_0xb283('0x1e')](_0x32bf95)[_0xb283('0x20')](_0x5137ca);}};}function respondWithFilteredResult(_0x18cfaa,_0x20c66b){return function(_0xdc07e2){if(_0xdc07e2){var _0x391509=_0xdc07e2[_0xb283('0x21')],_0x270291=_0x20c66b[_0xb283('0x22')],_0x47aed7=_0x20c66b[_0xb283('0x22')]+_0x20c66b[_0xb283('0x23')],_0x49ac3c;if(_0x47aed7>=_0x391509){_0x47aed7=_0x391509;_0x49ac3c=0xc8;}else{_0x49ac3c=0xce;}_0x18cfaa[_0xb283('0x1e')](_0x49ac3c);return _0x18cfaa[_0xb283('0x24')](_0xb283('0x25'),_0x270291+'-'+_0x47aed7+'/'+_0x391509)['json'](_0xdc07e2);}return null;};}function patchUpdates(_0x4c9183){return function(_0x409afc){try{jsonpatch[_0xb283('0x26')](_0x409afc,_0x4c9183,!![]);}catch(_0x3aa7ae){return BPromise['reject'](_0x3aa7ae);}return _0x409afc[_0xb283('0x27')]();};}function saveUpdates(_0x291f38,_0xc235cd){return function(_0x19d50c){if(_0x19d50c){return _0x19d50c['update'](_0x291f38)[_0xb283('0x28')](function(_0x8c33d8){return _0x8c33d8;});}return null;};}function removeEntity(_0x4a195c,_0x1bf2d5){return function(_0x4419bb){if(_0x4419bb){return _0x4419bb['destroy']()[_0xb283('0x28')](function(){var _0xa08b51=_0x4419bb[_0xb283('0x29')]({'plain':!![]});var _0x1d7c41=_0xb283('0x2a');return db['UserProfileResource'][_0xb283('0x2b')]({'where':{'type':_0x1d7c41,'resourceId':_0xa08b51['id']}})['then'](function(){return _0x4419bb;});})['then'](function(){_0x4a195c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49eb44,_0x141c8d){return function(_0x2b9dfd){if(!_0x2b9dfd){_0x49eb44[_0xb283('0x1d')](0x194);}return _0x2b9dfd;};}function handleError(_0x3bfe30,_0x293e30){_0x293e30=_0x293e30||0x1f4;return function(_0x2a3fa4){logger[_0xb283('0x2c')](_0x2a3fa4['stack']);if(_0x2a3fa4[_0xb283('0x2d')]){delete _0x2a3fa4[_0xb283('0x2d')];}_0x3bfe30[_0xb283('0x1e')](_0x293e30)[_0xb283('0x2e')](_0x2a3fa4);};}exports['index']=function(_0x38fd53,_0x948007){var _0x1cfb96={},_0x5db127={},_0x55d7b3={'count':0x0,'rows':[]};var _0x5b0bb4=_[_0xb283('0x2f')](db['WhatsappQueue']['rawAttributes'],function(_0x5609c5){return{'name':_0x5609c5[_0xb283('0x30')],'type':_0x5609c5[_0xb283('0x31')][_0xb283('0x32')]};});_0x5db127[_0xb283('0x33')]=_[_0xb283('0x2f')](_0x5b0bb4,_0xb283('0x2d'));_0x5db127[_0xb283('0x34')]=_[_0xb283('0x35')](_0x38fd53[_0xb283('0x34')]);_0x5db127[_0xb283('0x36')]=_['intersection'](_0x5db127['model'],_0x5db127[_0xb283('0x34')]);_0x1cfb96['attributes']=_['intersection'](_0x5db127[_0xb283('0x33')],qs['fields'](_0x38fd53['query']['fields']));_0x1cfb96[_0xb283('0x37')]=_0x1cfb96['attributes'][_0xb283('0x38')]?_0x1cfb96['attributes']:_0x5db127[_0xb283('0x33')];if(!_0x38fd53[_0xb283('0x34')][_0xb283('0x39')]('nolimit')){_0x1cfb96['limit']=qs[_0xb283('0x23')](_0x38fd53['query']['limit']);_0x1cfb96[_0xb283('0x22')]=qs[_0xb283('0x22')](_0x38fd53[_0xb283('0x34')][_0xb283('0x22')]);}_0x1cfb96[_0xb283('0x3a')]=qs[_0xb283('0x3b')](_0x38fd53[_0xb283('0x34')][_0xb283('0x3b')]);_0x1cfb96[_0xb283('0x3c')]=qs[_0xb283('0x36')](_[_0xb283('0x3d')](_0x38fd53[_0xb283('0x34')],_0x5db127[_0xb283('0x36')]),_0x5b0bb4);if(_0x38fd53[_0xb283('0x34')][_0xb283('0x3e')]){_0x1cfb96[_0xb283('0x3c')]=_[_0xb283('0x3f')](_0x1cfb96[_0xb283('0x3c')],{'$or':_[_0xb283('0x2f')](_0x5b0bb4,function(_0x103a2e){if(_0x103a2e[_0xb283('0x31')]!==_0xb283('0x40')){var _0x3c54f9={};_0x3c54f9[_0x103a2e[_0xb283('0x2d')]]={'$like':'%'+_0x38fd53[_0xb283('0x34')]['filter']+'%'};return _0x3c54f9;}})});}_0x1cfb96=_[_0xb283('0x3f')]({},_0x1cfb96,_0x38fd53[_0xb283('0x41')]);var _0x1bac2b={'where':_0x1cfb96[_0xb283('0x3c')]};return db['WhatsappQueue']['count'](_0x1bac2b)[_0xb283('0x28')](function(_0x33bf89){_0x55d7b3['count']=_0x33bf89;if(_0x38fd53[_0xb283('0x34')][_0xb283('0x42')]){_0x1cfb96[_0xb283('0x43')]=[{'all':!![]}];}return db[_0xb283('0x44')][_0xb283('0x45')](_0x1cfb96);})['then'](function(_0x47a27f){_0x55d7b3[_0xb283('0x46')]=_0x47a27f;return _0x55d7b3;})[_0xb283('0x28')](respondWithFilteredResult(_0x948007,_0x1cfb96))[_0xb283('0x47')](handleError(_0x948007,null));};exports[_0xb283('0x48')]=function(_0x3ba2fb,_0x2942e5){var _0x238dc8={'raw':!![],'where':{'id':_0x3ba2fb[_0xb283('0x49')]['id']}},_0x2eeabe={};_0x2eeabe[_0xb283('0x33')]=_['keys'](db[_0xb283('0x44')][_0xb283('0x4a')]);_0x2eeabe[_0xb283('0x34')]=_['keys'](_0x3ba2fb[_0xb283('0x34')]);_0x2eeabe['filters']=_['intersection'](_0x2eeabe[_0xb283('0x33')],_0x2eeabe[_0xb283('0x34')]);_0x238dc8[_0xb283('0x37')]=_['intersection'](_0x2eeabe[_0xb283('0x33')],qs['fields'](_0x3ba2fb[_0xb283('0x34')][_0xb283('0x4b')]));_0x238dc8[_0xb283('0x37')]=_0x238dc8[_0xb283('0x37')][_0xb283('0x38')]?_0x238dc8[_0xb283('0x37')]:_0x2eeabe[_0xb283('0x33')];if(_0x3ba2fb[_0xb283('0x34')]['includeAll']){_0x238dc8['include']=[{'all':!![]}];}_0x238dc8=_[_0xb283('0x3f')]({},_0x238dc8,_0x3ba2fb[_0xb283('0x41')]);return db[_0xb283('0x44')][_0xb283('0x4c')](_0x238dc8)[_0xb283('0x28')](handleEntityNotFound(_0x2942e5,null))['then'](respondWithResult(_0x2942e5,null))[_0xb283('0x47')](handleError(_0x2942e5,null));};exports[_0xb283('0x4d')]=function(_0x390cf1,_0x5994ce){return db[_0xb283('0x44')][_0xb283('0x4d')](_0x390cf1[_0xb283('0x4e')],{})[_0xb283('0x28')](function(_0x11788d){var _0x7bcfa8=_0x390cf1[_0xb283('0x4f')]['get']({'plain':!![]});if(!_0x7bcfa8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7bcfa8[_0xb283('0x50')]===_0xb283('0x4f')){var _0x36ce59=_0x11788d['get']({'plain':!![]});var _0x5360cd=_0xb283('0x2a');return db[_0xb283('0x51')][_0xb283('0x4c')]({'where':{'name':_0x5360cd,'userProfileId':_0x7bcfa8['userProfileId']},'raw':!![]})[_0xb283('0x28')](function(_0x6ed273){if(_0x6ed273&&_0x6ed273[_0xb283('0x52')]===0x0){return db['UserProfileResource'][_0xb283('0x4d')]({'name':_0x36ce59['name'],'resourceId':_0x36ce59['id'],'type':_0x6ed273[_0xb283('0x2d')],'sectionId':_0x6ed273['id']},{})[_0xb283('0x28')](function(){return _0x11788d;});}else{return _0x11788d;}})[_0xb283('0x47')](function(_0x15abac){logger[_0xb283('0x2c')](_0xb283('0x53'),_0x15abac);throw _0x15abac;});}return _0x11788d;})[_0xb283('0x28')](respondWithResult(_0x5994ce,0xc9))[_0xb283('0x47')](handleError(_0x5994ce,null));};exports[_0xb283('0x54')]=function(_0x3a2c2d,_0xfea5ce){if(_0x3a2c2d[_0xb283('0x4e')]['id']){delete _0x3a2c2d[_0xb283('0x4e')]['id'];}return db[_0xb283('0x44')][_0xb283('0x4c')]({'where':{'id':_0x3a2c2d[_0xb283('0x49')]['id']}})[_0xb283('0x28')](handleEntityNotFound(_0xfea5ce,null))[_0xb283('0x28')](saveUpdates(_0x3a2c2d[_0xb283('0x4e')],null))[_0xb283('0x28')](respondWithResult(_0xfea5ce,null))[_0xb283('0x47')](handleError(_0xfea5ce,null));};exports['destroy']=function(_0x51851f,_0x1d01ac){return db[_0xb283('0x44')][_0xb283('0x4c')]({'where':{'id':_0x51851f[_0xb283('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d01ac,null))[_0xb283('0x28')](removeEntity(_0x1d01ac,null))[_0xb283('0x47')](handleError(_0x1d01ac,null));};exports['describe']=function(_0x3bdc61,_0x31ae32){return db[_0xb283('0x44')][_0xb283('0x55')]()[_0xb283('0x28')](respondWithResult(_0x31ae32,null))['catch'](handleError(_0x31ae32,null));};exports[_0xb283('0x56')]=function(_0x4852e1,_0x22a2ce,_0x20c2d1){var _0x41bd3c={'raw':!![],'where':{}},_0x3f5495={},_0x421aa5;return db[_0xb283('0x44')]['findOne']({'where':{'id':_0x4852e1[_0xb283('0x49')]['id']}})[_0xb283('0x28')](handleEntityNotFound(_0x22a2ce,null))[_0xb283('0x28')](function(_0x5e4d00){if(_0x5e4d00){_0x421aa5=_0x5e4d00[_0xb283('0x29')]({'plain':!![]});_0x3f5495[_0xb283('0x33')]=_[_0xb283('0x35')](db[_0xb283('0x57')][_0xb283('0x4a')]);_0x3f5495[_0xb283('0x34')]=_['keys'](_0x4852e1['query']);_0x3f5495['filters']=_[_0xb283('0x58')](_0x3f5495[_0xb283('0x33')],_0x3f5495[_0xb283('0x34')]);_0x41bd3c['attributes']=_[_0xb283('0x58')](_0x3f5495[_0xb283('0x33')],qs[_0xb283('0x4b')](_0x4852e1['query'][_0xb283('0x4b')]));_0x41bd3c[_0xb283('0x37')]=_0x41bd3c[_0xb283('0x37')][_0xb283('0x38')]?_0x41bd3c['attributes']:_0x3f5495[_0xb283('0x33')];if(!_0x4852e1[_0xb283('0x34')][_0xb283('0x39')](_0xb283('0x59'))){_0x41bd3c[_0xb283('0x23')]=qs[_0xb283('0x23')](_0x4852e1[_0xb283('0x34')][_0xb283('0x23')]);_0x41bd3c[_0xb283('0x22')]=qs['offset'](_0x4852e1[_0xb283('0x34')]['offset']);}_0x41bd3c[_0xb283('0x3a')]=qs[_0xb283('0x3b')](_0x4852e1[_0xb283('0x34')][_0xb283('0x3b')]);_0x41bd3c[_0xb283('0x3c')]=qs['filters'](_[_0xb283('0x3d')](_0x4852e1['query'],_0x3f5495['filters']));_0x41bd3c[_0xb283('0x3c')][_0xb283('0x5a')]=_0x5e4d00['id'];if(_0x4852e1[_0xb283('0x34')]['filter']){_0x41bd3c[_0xb283('0x3c')]=_[_0xb283('0x3f')](_0x41bd3c[_0xb283('0x3c')],{'$or':_['map'](_0x41bd3c[_0xb283('0x37')],function(_0x2d3cb4){var _0x3e6da4={};_0x3e6da4[_0x2d3cb4]={'$like':'%'+_0x4852e1[_0xb283('0x34')][_0xb283('0x3e')]+'%'};return _0x3e6da4;})});}_0x41bd3c=_[_0xb283('0x3f')]({},_0x41bd3c,_0x4852e1[_0xb283('0x41')]);return db[_0xb283('0x57')]['findAll'](_0x41bd3c);}})['then'](function(_0xc06853){if(_0xc06853){return db[_0xb283('0x5b')][_0xb283('0x5c')]({'where':{'id':_[_0xb283('0x2f')](_0xc06853,_0xb283('0x5d')),'role':_0xb283('0x5e')},'attributes':['id',_0xb283('0x2d'),'whatsappPause',_0xb283('0x5f'),_0xb283('0x60')]});}})[_0xb283('0x28')](function(_0x5522e0){if(_0x5522e0){return{'count':_0x5522e0[_0xb283('0x21')],'rows':_[_0xb283('0x2f')](_0x5522e0[_0xb283('0x46')],function(_0x22197e){return{'membername':_0x22197e[_0xb283('0x2d')],'UserId':_0x22197e['id'],'queue_name':_0x421aa5['name'],'WhatsappQueueId':_0x421aa5['id'],'interface':util[_0xb283('0x61')]('%s/%s',_0xb283('0x62'),_0x22197e[_0xb283('0x2d')]),'penalty':0x0,'paused':_0x22197e[_0xb283('0x63')],'createdAt':_0x22197e[_0xb283('0x60')],'updatedAt':_0x22197e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb283('0x28')](respondWithFilteredResult(_0x22a2ce,_0x41bd3c))[_0xb283('0x47')](handleError(_0x22a2ce,null));};exports[_0xb283('0x64')]=function(_0x2725c2,_0xf17198,_0x22a621){var _0x5cf8b9={};var _0x45be30={};var _0x2d3d40;var _0x420056;return db[_0xb283('0x44')][_0xb283('0x65')]({'where':{'id':_0x2725c2[_0xb283('0x49')]['id']}})[_0xb283('0x28')](handleEntityNotFound(_0xf17198,null))[_0xb283('0x28')](function(_0x53cde4){if(_0x53cde4){_0x2d3d40=_0x53cde4;_0x45be30[_0xb283('0x33')]=_[_0xb283('0x35')](db['Team'][_0xb283('0x4a')]);_0x45be30[_0xb283('0x34')]=_[_0xb283('0x35')](_0x2725c2['query']);_0x45be30[_0xb283('0x36')]=_['intersection'](_0x45be30[_0xb283('0x33')],_0x45be30[_0xb283('0x34')]);_0x5cf8b9[_0xb283('0x37')]=_[_0xb283('0x58')](_0x45be30[_0xb283('0x33')],qs[_0xb283('0x4b')](_0x2725c2[_0xb283('0x34')][_0xb283('0x4b')]));_0x5cf8b9[_0xb283('0x37')]=_0x5cf8b9[_0xb283('0x37')]['length']?_0x5cf8b9[_0xb283('0x37')]:_0x45be30[_0xb283('0x33')];_0x5cf8b9[_0xb283('0x3a')]=qs[_0xb283('0x3b')](_0x2725c2[_0xb283('0x34')][_0xb283('0x3b')]);_0x5cf8b9[_0xb283('0x3c')]=qs[_0xb283('0x36')](_[_0xb283('0x3d')](_0x2725c2[_0xb283('0x34')],_0x45be30[_0xb283('0x36')]));if(_0x2725c2[_0xb283('0x34')][_0xb283('0x3e')]){_0x5cf8b9[_0xb283('0x3c')]=_[_0xb283('0x3f')](_0x5cf8b9[_0xb283('0x3c')],{'$or':_[_0xb283('0x2f')](_0x5cf8b9['attributes'],function(_0x1fe3a6){var _0x12f6ab={};_0x12f6ab[_0x1fe3a6]={'$like':'%'+_0x2725c2['query'][_0xb283('0x3e')]+'%'};return _0x12f6ab;})});}_0x5cf8b9=_[_0xb283('0x3f')]({},_0x5cf8b9,_0x2725c2['options']);return _0x2d3d40[_0xb283('0x64')](_0x5cf8b9);}})['then'](function(_0xaad7ab){if(_0xaad7ab){_0x420056=_0xaad7ab[_0xb283('0x38')];if(!_0x2725c2['query'][_0xb283('0x39')]('nolimit')){_0x5cf8b9[_0xb283('0x23')]=qs[_0xb283('0x23')](_0x2725c2[_0xb283('0x34')][_0xb283('0x23')]);_0x5cf8b9[_0xb283('0x22')]=qs['offset'](_0x2725c2[_0xb283('0x34')][_0xb283('0x22')]);}return _0x2d3d40[_0xb283('0x64')](_0x5cf8b9);}})[_0xb283('0x28')](function(_0x2a7148){if(_0x2a7148){return _0x2a7148?{'count':_0x420056,'rows':_0x2a7148}:null;}})['then'](respondWithResult(_0xf17198,null))[_0xb283('0x47')](handleError(_0xf17198,null));};exports[_0xb283('0x66')]=function(_0x13a64f,_0x281dc6,_0x663075){var _0x23f8b9=_0x13a64f[_0xb283('0x4e')][_0xb283('0x67')];return db[_0xb283('0x68')]['findAll']({'where':{'id':_0x23f8b9},'attributes':['id'],'include':[{'model':db[_0xb283('0x5b')],'as':_0xb283('0x69'),'attributes':['id',_0xb283('0x2d'),_0xb283('0x6a'),_0xb283('0x6b'),_0xb283('0x6c')],'raw':!![]}]})[_0xb283('0x28')](function(_0xe27d34){if(_0xe27d34){var _0x22bb31=_[_0xb283('0x6d')](_0xe27d34,function(_0x51f7d1){var _0x538dbd=_0x51f7d1[_0xb283('0x29')]({'plain':!![]});return _0x538dbd[_0xb283('0x69')];});return db['WhatsappQueue'][_0xb283('0x4c')]({'where':{'id':_0x13a64f[_0xb283('0x49')]['id']}})[_0xb283('0x28')](function(_0x5b7554){return db[_0xb283('0x6e')]['transaction'](function(_0x52a5d4){return _0x5b7554['addTeams'](_0x23f8b9,{'transaction':_0x52a5d4})['then'](function(){return BPromise[_0xb283('0x6f')](_0x22bb31,function(_0x419498){return db['UserWhatsappQueue'][_0xb283('0x70')]({'where':{'UserId':_0x419498['id'],'WhatsappQueueId':_0x13a64f[_0xb283('0x49')]['id']},'transaction':_0x52a5d4});});})[_0xb283('0x28')](function(){_0x22bb31['forEach'](function(_0x3ba081){socket[_0xb283('0x71')](_0xb283('0x72'),{'UserId':_0x3ba081['id'],'WhatsappQueueId':_0x5b7554['id']});});});});});}})[_0xb283('0x28')](respondWithStatusCode(_0x281dc6,null))[_0xb283('0x47')](handleError(_0x281dc6,null));};exports[_0xb283('0x73')]=function(_0xfd8b30,_0x54d457,_0x52c4a9){return db[_0xb283('0x68')][_0xb283('0x45')]({'where':{'id':_0xfd8b30[_0xb283('0x34')][_0xb283('0x67')]},'attributes':['id'],'include':[{'model':db[_0xb283('0x5b')],'as':_0xb283('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x54d457,null))[_0xb283('0x28')](function(_0x497676){var _0x5347e0=_[_0xb283('0x2f')](_0x497676,'id');var _0xf40c52=[];var _0x433afb=[];var _0x154f45=squel[_0xb283('0x74')]();_0x154f45[_0xb283('0x75')](_0xb283('0x76'))[_0xb283('0x77')]('team_has_whatsapp_queues','tq')[_0xb283('0x78')](_0xb283('0x79'),'ut',_0xb283('0x7a'))['where'](_0xb283('0x7b'),_0xfd8b30[_0xb283('0x49')]['id']);for(var _0x395547=0x0;_0x395547<_0x497676[_0xb283('0x38')];_0x395547+=0x1){let _0x55242e=_0x497676[_0x395547];for(var _0x342257=0x0;_0x342257<_0x55242e[_0xb283('0x69')][_0xb283('0x38')];_0x342257+=0x1){let _0x1b7d8f=_0x55242e['Agents'][_0x342257];var _0x5a56aa=_0x154f45[_0xb283('0x7c')]();_0x5a56aa[_0xb283('0x3c')](_0xb283('0x7d'),_0x1b7d8f['id']);_0x433afb['push'](db['sequelize'][_0xb283('0x34')](_0x5a56aa['toString'](),{'type':db[_0xb283('0x6e')][_0xb283('0x7e')]['SELECT']})[_0xb283('0x28')](function(_0x5e737f){if(_0x5e737f[_0xb283('0x38')]===0x1){return _0x1b7d8f['id'];}else{var _0x45a2c0=_[_0xb283('0x7f')](_[_0xb283('0x2f')](_0x5e737f,'TeamId'),function(_0x374460){return _[_0xb283('0x80')](_0x5347e0,_0x374460);});if(_0x45a2c0){return _0x1b7d8f['id'];}}}));}}return BPromise[_0xb283('0x81')](_0x433afb)[_0xb283('0x28')](function(_0x5c3393){_0xf40c52=_(_0xf40c52)[_0xb283('0x82')](_0x5c3393)['compact']()['value']();return db[_0xb283('0x44')][_0xb283('0x4c')]({'where':{'id':_0xfd8b30['params']['id']}})[_0xb283('0x28')](function(_0x313930){return db[_0xb283('0x6e')]['transaction'](function(_0x3739ca){return _0x313930[_0xb283('0x73')](_0xfd8b30[_0xb283('0x34')]['ids'],{'transaction':_0x3739ca})['then'](function(){if(!_[_0xb283('0x83')](_0xf40c52)){return _0x313930[_0xb283('0x84')](_0xf40c52,{'transaction':_0x3739ca});}})[_0xb283('0x28')](function(){_0xf40c52[_0xb283('0x85')](function(_0x295674){socket[_0xb283('0x71')](_0xb283('0x86'),{'UserId':_0x295674,'WhatsappQueueId':_0x313930['id']});});});});});});})[_0xb283('0x28')](respondWithStatusCode(_0x54d457,null))['catch'](handleError(_0x54d457,null));};exports[_0xb283('0x87')]=function(_0x628116,_0x58543a,_0x37468e){return db[_0xb283('0x44')][_0xb283('0x4c')]({'where':{'id':_0x628116['params']['id']}})[_0xb283('0x28')](handleEntityNotFound(_0x58543a,null))[_0xb283('0x28')](function(_0x56735c){if(_0x56735c){return _0x56735c['addAgents'](_0x628116[_0xb283('0x4e')][_0xb283('0x67')],_[_0xb283('0x88')](_0x628116[_0xb283('0x4e')],[_0xb283('0x67'),'id'])||{})['spread'](function(_0x227bc2){for(var _0x3d2536=0x0;_0x3d2536<_0x628116[_0xb283('0x4e')][_0xb283('0x67')][_0xb283('0x38')];_0x3d2536+=0x1){socket['emit'](_0xb283('0x72'),{'UserId':_0x628116[_0xb283('0x4e')][_0xb283('0x67')][_0x3d2536],'WhatsappQueueId':_0x628116['params']['id']});}return _0x227bc2;});}})['then'](respondWithResult(_0x58543a,null))['catch'](handleError(_0x58543a,null));};exports[_0xb283('0x84')]=function(_0x3bb49b,_0x3a75e7,_0x128570){return db[_0xb283('0x44')][_0xb283('0x4c')]({'where':{'id':_0x3bb49b[_0xb283('0x49')]['id']}})[_0xb283('0x28')](handleEntityNotFound(_0x3a75e7,null))['then'](function(_0x5cf8cf){if(_0x5cf8cf){return _0x5cf8cf[_0xb283('0x84')](_0x3bb49b['query'][_0xb283('0x67')])[_0xb283('0x28')](function(){if(_[_0xb283('0x89')](_0x3bb49b['query'][_0xb283('0x67')])){for(var _0x401e7a=0x0;_0x401e7a<_0x3bb49b[_0xb283('0x34')][_0xb283('0x67')][_0xb283('0x38')];_0x401e7a+=0x1){socket['emit'](_0xb283('0x86'),{'UserId':Number(_0x3bb49b[_0xb283('0x34')][_0xb283('0x67')][_0x401e7a]),'WhatsappQueueId':Number(_0x3bb49b[_0xb283('0x49')]['id'])});}}else{socket[_0xb283('0x71')](_0xb283('0x86'),{'UserId':Number(_0x3bb49b[_0xb283('0x34')][_0xb283('0x67')]),'WhatsappQueueId':Number(_0x3bb49b['params']['id'])});}});}})[_0xb283('0x28')](respondWithStatusCode(_0x3a75e7,null))[_0xb283('0x47')](handleError(_0x3a75e7,null));};exports[_0xb283('0x8a')]=function(_0x173986,_0x4c4cf6,_0x1b29b8){var _0x50f904={};var _0x55210c={};var _0x3a20ec;var _0x3f55d7;return db[_0xb283('0x44')]['findOne']({'where':{'id':_0x173986[_0xb283('0x49')]['id']}})[_0xb283('0x28')](handleEntityNotFound(_0x4c4cf6,null))[_0xb283('0x28')](function(_0x3dd4b5){if(_0x3dd4b5){_0x3a20ec=_0x3dd4b5;_0x55210c[_0xb283('0x33')]=_['keys'](db[_0xb283('0x5b')][_0xb283('0x4a')]);_0x55210c['query']=_[_0xb283('0x35')](_0x173986['query']);_0x55210c[_0xb283('0x36')]=_[_0xb283('0x58')](_0x55210c[_0xb283('0x33')],_0x55210c[_0xb283('0x34')]);_0x50f904[_0xb283('0x37')]=_[_0xb283('0x58')](_0x55210c['model'],qs[_0xb283('0x4b')](_0x173986[_0xb283('0x34')]['fields']));_0x50f904[_0xb283('0x37')]=_0x50f904[_0xb283('0x37')]['length']?_0x50f904[_0xb283('0x37')]:_0x55210c[_0xb283('0x33')];_0x50f904[_0xb283('0x3a')]=qs['sort'](_0x173986[_0xb283('0x34')][_0xb283('0x3b')]);_0x50f904[_0xb283('0x3c')]=qs[_0xb283('0x36')](_[_0xb283('0x3d')](_0x173986['query'],_0x55210c[_0xb283('0x36')]));if(_0x173986[_0xb283('0x34')][_0xb283('0x3e')]){_0x50f904['where']=_[_0xb283('0x3f')](_0x50f904['where'],{'$or':_[_0xb283('0x2f')](_0x50f904[_0xb283('0x37')],function(_0x5166de){var _0x53eb84={};_0x53eb84[_0x5166de]={'$like':'%'+_0x173986[_0xb283('0x34')]['filter']+'%'};return _0x53eb84;})});}_0x50f904=_['merge']({},_0x50f904,_0x173986['options']);return _0x3a20ec[_0xb283('0x8a')](_0x50f904);}})[_0xb283('0x28')](function(_0xba35d7){if(_0xba35d7){_0x3f55d7=_0xba35d7[_0xb283('0x38')];if(!_0x173986['query'][_0xb283('0x39')](_0xb283('0x59'))){_0x50f904[_0xb283('0x23')]=qs[_0xb283('0x23')](_0x173986['query']['limit']);_0x50f904[_0xb283('0x22')]=qs[_0xb283('0x22')](_0x173986['query'][_0xb283('0x22')]);}return _0x3a20ec[_0xb283('0x8a')](_0x50f904);}})[_0xb283('0x28')](function(_0x2fb4e3){if(_0x2fb4e3){return _0x2fb4e3?{'count':_0x3f55d7,'rows':_0x2fb4e3}:null;}})['then'](respondWithResult(_0x4c4cf6,null))[_0xb283('0x47')](handleError(_0x4c4cf6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index dec9e5b..1dbaf12 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 _0xb4c2=['exports','events','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x41e734,_0x5ac32d){var _0x14a935=function(_0x5444e7){while(--_0x5444e7){_0x41e734['push'](_0x41e734['shift']());}};_0x14a935(++_0x5ac32d);}(_0xb4c2,0x64));var _0x2b4c=function(_0xf85c23,_0x433083){_0xf85c23=_0xf85c23-0x0;var _0xc64657=_0xb4c2[_0xf85c23];return _0xc64657;};'use strict';var EventEmitter=require(_0x2b4c('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x2b4c('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2b4c('0x2')](0x0);var events={'afterCreate':_0x2b4c('0x3'),'afterUpdate':_0x2b4c('0x4'),'afterDestroy':_0x2b4c('0x5')};function emitEvent(_0x50912c){return function(_0x3c78ca,_0x2feef3,_0x2e38ee){WhatsappQueueEvents[_0x2b4c('0x6')](_0x50912c+':'+_0x3c78ca['id'],_0x3c78ca);WhatsappQueueEvents[_0x2b4c('0x6')](_0x50912c,_0x3c78ca);_0x2e38ee(null);};}for(var e in events){if(events[_0x2b4c('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x2b4c('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x9bac=['hook','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x9bac,0x17b));var _0xc9ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9bac[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xc9ba('0x0'))['db'][_0xc9ba('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc9ba('0x2')](0x0);var events={'afterCreate':_0xc9ba('0x3'),'afterUpdate':_0xc9ba('0x4'),'afterDestroy':_0xc9ba('0x5')};function emitEvent(_0x524e56){return function(_0x18dc51,_0x5c0223,_0xd721bf){WhatsappQueueEvents[_0xc9ba('0x6')](_0x524e56+':'+_0x18dc51['id'],_0x18dc51);WhatsappQueueEvents[_0xc9ba('0x6')](_0x524e56,_0x18dc51);_0xd721bf(null);};}for(var e in events){if(events[_0xc9ba('0x7')](e)){var event=events[e];WhatsappQueue[_0xc9ba('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 210064c..5ffff4d 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 _0x4344=['define','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x2901df,_0x3dff3f){var _0x12119a=function(_0x54e43c){while(--_0x54e43c){_0x2901df['push'](_0x2901df['shift']());}};_0x12119a(++_0x3dff3f);}(_0x4344,0x111));var _0x4434=function(_0x3faf45,_0x8bb345){_0x3faf45=_0x3faf45-0x0;var _0x11dfb6=_0x4344[_0x3faf45];return _0x11dfb6;};'use strict';var _=require(_0x4434('0x0'));var util=require(_0x4434('0x1'));var logger=require(_0x4434('0x2'))(_0x4434('0x3'));var moment=require(_0x4434('0x4'));var BPromise=require(_0x4434('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4434('0x6'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x25acd7,_0x180c5d){return _0x25acd7[_0x4434('0x7')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2890=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4ff236,_0x4cb8b6){var _0x138b9d=function(_0x168b74){while(--_0x168b74){_0x4ff236['push'](_0x4ff236['shift']());}};_0x138b9d(++_0x4cb8b6);}(_0x2890,0x119));var _0x0289=function(_0x2ebe9e,_0x5e3747){_0x2ebe9e=_0x2ebe9e-0x0;var _0x44b434=_0x2890[_0x2ebe9e];return _0x44b434;};'use strict';var _=require(_0x0289('0x0'));var util=require(_0x0289('0x1'));var logger=require(_0x0289('0x2'))('api');var moment=require(_0x0289('0x3'));var BPromise=require('bluebird');var rp=require(_0x0289('0x4'));var fs=require('fs');var path=require(_0x0289('0x5'));var rimraf=require(_0x0289('0x6'));var config=require(_0x0289('0x7'));var attributes=require(_0x0289('0x8'));module[_0x0289('0x9')]=function(_0x3475ad,_0x401657){return _0x3475ad['define']('WhatsappQueue',attributes,{'tableName':_0x0289('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 40c09d9..2edfa04 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 _0x4344=['model','map','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappQueue.socket','register','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','where','attributes','limit','include'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x4344,0x133));var _0x4434=function(_0x9ffe1b,_0x26f6c3){_0x9ffe1b=_0x9ffe1b-0x0;var _0x5d1892=_0x4344[_0x9ffe1b];return _0x5d1892;};'use strict';var _=require(_0x4434('0x0'));var util=require(_0x4434('0x1'));var moment=require(_0x4434('0x2'));var BPromise=require(_0x4434('0x3'));var rs=require(_0x4434('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4434('0x5'))['db'];var utils=require(_0x4434('0x6'));var logger=require('../../config/logger')(_0x4434('0x7'));var config=require(_0x4434('0x8'));var jayson=require(_0x4434('0x9'));var client=jayson['client'][_0x4434('0xa')]({'port':0x232a});config[_0x4434('0xb')]=_[_0x4434('0xc')](config['redis'],{'host':_0x4434('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4434('0xb')]));require(_0x4434('0xe'))[_0x4434('0xf')](socket);function respondWithRpcPromise(_0x2188b6,_0x390a52,_0x4af337){return new BPromise(function(_0xa3e903,_0x2ade07){return client['request'](_0x2188b6,_0x4af337)[_0x4434('0x10')](function(_0x53c57c){logger[_0x4434('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x390a52,_0x4434('0x12'));logger[_0x4434('0x13')](_0x4434('0x14'),_0x390a52,_0x4434('0x12'),JSON[_0x4434('0x15')](_0x53c57c));if(_0x53c57c[_0x4434('0x16')]){if(_0x53c57c[_0x4434('0x16')][_0x4434('0x17')]===0x1f4){logger[_0x4434('0x16')](_0x4434('0x18'),_0x390a52,_0x53c57c[_0x4434('0x16')][_0x4434('0x19')]);return _0x2ade07(_0x53c57c['error'][_0x4434('0x19')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x390a52,_0x53c57c[_0x4434('0x16')][_0x4434('0x19')]);return _0xa3e903(_0x53c57c[_0x4434('0x16')][_0x4434('0x19')]);}else{logger[_0x4434('0x11')](_0x4434('0x18'),_0x390a52,_0x4434('0x12'));_0xa3e903(_0x53c57c[_0x4434('0x1a')][_0x4434('0x19')]);}})[_0x4434('0x1b')](function(_0x42bd24){logger[_0x4434('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x390a52,_0x42bd24);_0x2ade07(_0x42bd24);});});}exports[_0x4434('0x1c')]=function(_0x5e4ba7){var _0x307dd5=this;return new Promise(function(_0x2358bc,_0x1c23ae){return db[_0x4434('0x1d')]['findAll']({'raw':_0x5e4ba7[_0x4434('0x1e')]?_0x5e4ba7[_0x4434('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5e4ba7[_0x4434('0x1e')]?_0x5e4ba7[_0x4434('0x1e')][_0x4434('0x1f')]||null:null,'attributes':_0x5e4ba7[_0x4434('0x1e')]?_0x5e4ba7[_0x4434('0x1e')][_0x4434('0x20')]||null:null,'limit':_0x5e4ba7[_0x4434('0x1e')]?_0x5e4ba7['options'][_0x4434('0x21')]||null:null,'include':_0x5e4ba7[_0x4434('0x1e')]?_0x5e4ba7['options'][_0x4434('0x22')]?_['map'](_0x5e4ba7[_0x4434('0x1e')][_0x4434('0x22')],function(_0x2c7948){return{'model':db[_0x2c7948[_0x4434('0x23')]],'as':_0x2c7948['as'],'attributes':_0x2c7948['attributes'],'include':_0x2c7948[_0x4434('0x22')]?_['map'](_0x2c7948[_0x4434('0x22')],function(_0x518ea6){return{'model':db[_0x518ea6['model']],'as':_0x518ea6['as'],'attributes':_0x518ea6[_0x4434('0x20')],'include':_0x518ea6[_0x4434('0x22')]?_[_0x4434('0x24')](_0x518ea6[_0x4434('0x22')],function(_0x48d94b){return{'model':db[_0x48d94b[_0x4434('0x23')]],'as':_0x48d94b['as'],'attributes':_0x48d94b[_0x4434('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4434('0x10')](function(_0x471af0){logger['info'](_0x4434('0x1c'),_0x5e4ba7);logger['debug'](_0x4434('0x1c'),_0x5e4ba7,JSON[_0x4434('0x15')](_0x471af0));_0x2358bc(_0x471af0);})[_0x4434('0x1b')](function(_0xda5b35){logger['error'](_0x4434('0x1c'),_0xda5b35[_0x4434('0x19')],_0x5e4ba7);_0x1c23ae(_0x307dd5['error'](0x1f4,_0xda5b35[_0x4434('0x19')]));});});};exports[_0x4434('0x25')]=function(_0x1fd8f6){var _0x54b574=this;return new Promise(function(_0x42cf82,_0x3d75e1){return db['WhatsappQueue']['find']({'raw':_0x1fd8f6[_0x4434('0x1e')]?_0x1fd8f6[_0x4434('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1fd8f6[_0x4434('0x1e')]?_0x1fd8f6['options'][_0x4434('0x1f')]||null:null,'attributes':_0x1fd8f6[_0x4434('0x1e')]?_0x1fd8f6['options']['attributes']||null:null,'include':_0x1fd8f6[_0x4434('0x1e')]?_0x1fd8f6[_0x4434('0x1e')][_0x4434('0x22')]?_['map'](_0x1fd8f6[_0x4434('0x1e')][_0x4434('0x22')],function(_0x2814){return{'model':db[_0x2814['model']],'as':_0x2814['as'],'attributes':_0x2814['attributes'],'include':_0x2814[_0x4434('0x22')]?_['map'](_0x2814[_0x4434('0x22')],function(_0x5d20a6){return{'model':db[_0x5d20a6[_0x4434('0x23')]],'as':_0x5d20a6['as'],'attributes':_0x5d20a6[_0x4434('0x20')],'include':_0x5d20a6[_0x4434('0x22')]?_['map'](_0x5d20a6[_0x4434('0x22')],function(_0x507be8){return{'model':db[_0x507be8[_0x4434('0x23')]],'as':_0x507be8['as'],'attributes':_0x507be8[_0x4434('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4434('0x10')](function(_0x57d844){logger[_0x4434('0x11')](_0x4434('0x25'),_0x1fd8f6);logger[_0x4434('0x13')](_0x4434('0x25'),_0x1fd8f6,JSON[_0x4434('0x15')](_0x57d844));_0x42cf82(_0x57d844);})[_0x4434('0x1b')](function(_0x54d12f){logger[_0x4434('0x16')](_0x4434('0x25'),_0x54d12f[_0x4434('0x19')],_0x1fd8f6);_0x3d75e1(_0x54b574['error'](0x1f4,_0x54d12f[_0x4434('0x19')]));});});}; \ No newline at end of file +var _0x9edc=['attributes','limit','include','map','model','info','GetWhatsappQueue','catch','ShowWhatsappQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','WhatsappQueue','findAll','options','where'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x9edc,0x8c));var _0xc9ed=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0x9edc[_0x39caaa];return _0x9b9c7d;};'use strict';var _=require(_0xc9ed('0x0'));var util=require(_0xc9ed('0x1'));var moment=require(_0xc9ed('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9ed('0x3'));var fs=require('fs');var Redis=require(_0xc9ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9ed('0x5'));var logger=require(_0xc9ed('0x6'))(_0xc9ed('0x7'));var config=require(_0xc9ed('0x8'));var jayson=require(_0xc9ed('0x9'));var client=jayson[_0xc9ed('0xa')][_0xc9ed('0xb')]({'port':0x232a});config[_0xc9ed('0xc')]=_[_0xc9ed('0xd')](config[_0xc9ed('0xc')],{'host':_0xc9ed('0xe'),'port':0x18eb});var socket=require(_0xc9ed('0xf'))(new Redis(config[_0xc9ed('0xc')]));require(_0xc9ed('0x10'))[_0xc9ed('0x11')](socket);function respondWithRpcPromise(_0x19aca0,_0x39aa10,_0x3f06d6){return new BPromise(function(_0x2369f0,_0x5800f3){return client['request'](_0x19aca0,_0x3f06d6)[_0xc9ed('0x12')](function(_0x42a225){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x39aa10,'request\x20sent');logger[_0xc9ed('0x13')](_0xc9ed('0x14'),_0x39aa10,_0xc9ed('0x15'),JSON[_0xc9ed('0x16')](_0x42a225));if(_0x42a225[_0xc9ed('0x17')]){if(_0x42a225['error'][_0xc9ed('0x18')]===0x1f4){logger[_0xc9ed('0x17')](_0xc9ed('0x19'),_0x39aa10,_0x42a225[_0xc9ed('0x17')][_0xc9ed('0x1a')]);return _0x5800f3(_0x42a225[_0xc9ed('0x17')]['message']);}logger[_0xc9ed('0x17')](_0xc9ed('0x19'),_0x39aa10,_0x42a225[_0xc9ed('0x17')][_0xc9ed('0x1a')]);return _0x2369f0(_0x42a225[_0xc9ed('0x17')][_0xc9ed('0x1a')]);}else{logger['info'](_0xc9ed('0x19'),_0x39aa10,_0xc9ed('0x15'));_0x2369f0(_0x42a225[_0xc9ed('0x1b')]['message']);}})['catch'](function(_0x38c15b){logger[_0xc9ed('0x17')](_0xc9ed('0x19'),_0x39aa10,_0x38c15b);_0x5800f3(_0x38c15b);});});}exports['GetWhatsappQueue']=function(_0x28620f){var _0x5eacb0=this;return new Promise(function(_0x5ed13b,_0x4bb55b){return db[_0xc9ed('0x1c')][_0xc9ed('0x1d')]({'raw':_0x28620f[_0xc9ed('0x1e')]?_0x28620f['options']['raw']===undefined?!![]:![]:!![],'where':_0x28620f['options']?_0x28620f[_0xc9ed('0x1e')][_0xc9ed('0x1f')]||null:null,'attributes':_0x28620f[_0xc9ed('0x1e')]?_0x28620f[_0xc9ed('0x1e')][_0xc9ed('0x20')]||null:null,'limit':_0x28620f['options']?_0x28620f[_0xc9ed('0x1e')][_0xc9ed('0x21')]||null:null,'include':_0x28620f[_0xc9ed('0x1e')]?_0x28620f[_0xc9ed('0x1e')][_0xc9ed('0x22')]?_[_0xc9ed('0x23')](_0x28620f[_0xc9ed('0x1e')][_0xc9ed('0x22')],function(_0x1e4060){return{'model':db[_0x1e4060[_0xc9ed('0x24')]],'as':_0x1e4060['as'],'attributes':_0x1e4060[_0xc9ed('0x20')],'include':_0x1e4060[_0xc9ed('0x22')]?_[_0xc9ed('0x23')](_0x1e4060[_0xc9ed('0x22')],function(_0x39288e){return{'model':db[_0x39288e[_0xc9ed('0x24')]],'as':_0x39288e['as'],'attributes':_0x39288e[_0xc9ed('0x20')],'include':_0x39288e[_0xc9ed('0x22')]?_[_0xc9ed('0x23')](_0x39288e[_0xc9ed('0x22')],function(_0xfad844){return{'model':db[_0xfad844[_0xc9ed('0x24')]],'as':_0xfad844['as'],'attributes':_0xfad844[_0xc9ed('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc9ed('0x12')](function(_0x77d4e4){logger[_0xc9ed('0x25')](_0xc9ed('0x26'),_0x28620f);logger[_0xc9ed('0x13')](_0xc9ed('0x26'),_0x28620f,JSON[_0xc9ed('0x16')](_0x77d4e4));_0x5ed13b(_0x77d4e4);})[_0xc9ed('0x27')](function(_0x16c215){logger['error'](_0xc9ed('0x26'),_0x16c215[_0xc9ed('0x1a')],_0x28620f);_0x4bb55b(_0x5eacb0[_0xc9ed('0x17')](0x1f4,_0x16c215[_0xc9ed('0x1a')]));});});};exports[_0xc9ed('0x28')]=function(_0x428c20){var _0x1f6998=this;return new Promise(function(_0x4afbee,_0x508a48){return db['WhatsappQueue'][_0xc9ed('0x29')]({'raw':_0x428c20[_0xc9ed('0x1e')]?_0x428c20[_0xc9ed('0x1e')][_0xc9ed('0x2a')]===undefined?!![]:![]:!![],'where':_0x428c20[_0xc9ed('0x1e')]?_0x428c20[_0xc9ed('0x1e')][_0xc9ed('0x1f')]||null:null,'attributes':_0x428c20[_0xc9ed('0x1e')]?_0x428c20[_0xc9ed('0x1e')]['attributes']||null:null,'include':_0x428c20[_0xc9ed('0x1e')]?_0x428c20[_0xc9ed('0x1e')][_0xc9ed('0x22')]?_[_0xc9ed('0x23')](_0x428c20[_0xc9ed('0x1e')]['include'],function(_0x5210ca){return{'model':db[_0x5210ca[_0xc9ed('0x24')]],'as':_0x5210ca['as'],'attributes':_0x5210ca[_0xc9ed('0x20')],'include':_0x5210ca[_0xc9ed('0x22')]?_['map'](_0x5210ca[_0xc9ed('0x22')],function(_0x6b6565){return{'model':db[_0x6b6565[_0xc9ed('0x24')]],'as':_0x6b6565['as'],'attributes':_0x6b6565['attributes'],'include':_0x6b6565[_0xc9ed('0x22')]?_[_0xc9ed('0x23')](_0x6b6565[_0xc9ed('0x22')],function(_0x3609e0){return{'model':db[_0x3609e0[_0xc9ed('0x24')]],'as':_0x3609e0['as'],'attributes':_0x3609e0[_0xc9ed('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5be582){logger[_0xc9ed('0x25')](_0xc9ed('0x28'),_0x428c20);logger[_0xc9ed('0x13')](_0xc9ed('0x28'),_0x428c20,JSON['stringify'](_0x5be582));_0x4afbee(_0x5be582);})[_0xc9ed('0x27')](function(_0x37bc8d){logger[_0xc9ed('0x17')](_0xc9ed('0x28'),_0x37bc8d[_0xc9ed('0x1a')],_0x428c20);_0x508a48(_0x1f6998[_0xc9ed('0x17')](0x1f4,_0x37bc8d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5a10211..bcc7cc8 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 _0x58ea=['remove','update','emit','removeListener','register','whatsappQueue:','save'];(function(_0x23d3fa,_0x2d5783){var _0x299b2c=function(_0x176547){while(--_0x176547){_0x23d3fa['push'](_0x23d3fa['shift']());}};_0x299b2c(++_0x2d5783);}(_0x58ea,0xa7));var _0xa58e=function(_0x157029,_0x3df47a){_0x157029=_0x157029-0x0;var _0x2f384c=_0x58ea[_0x157029];return _0x2f384c;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xa58e('0x0'),_0xa58e('0x1'),_0xa58e('0x2')];function createListener(_0x1a8ac9,_0xfbec1f){return function(_0x230017){_0xfbec1f[_0xa58e('0x3')](_0x1a8ac9,_0x230017);};}function removeListener(_0x46cf21,_0x420d0d){return function(){WhatsappQueueEvents[_0xa58e('0x4')](_0x46cf21,_0x420d0d);};}exports[_0xa58e('0x5')]=function(_0x24249e){for(var _0x1182a3=0x0,_0x2c1e42=events['length'];_0x1182a3<_0x2c1e42;_0x1182a3++){var _0xf9c3e5=events[_0x1182a3];var _0x45426f=createListener(_0xa58e('0x6')+_0xf9c3e5,_0x24249e);WhatsappQueueEvents['on'](_0xf9c3e5,_0x45426f);}}; \ No newline at end of file +var _0xac3d=['removeListener','whatsappQueue:','./whatsappQueue.events','save','update','emit'];(function(_0x55dbd0,_0x5c6216){var _0x293891=function(_0x29fe42){while(--_0x29fe42){_0x55dbd0['push'](_0x55dbd0['shift']());}};_0x293891(++_0x5c6216);}(_0xac3d,0x92));var _0xdac3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac3d[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require(_0xdac3('0x0'));var events=[_0xdac3('0x1'),'remove',_0xdac3('0x2')];function createListener(_0x13a3c5,_0x42e49f){return function(_0x16a51e){_0x42e49f[_0xdac3('0x3')](_0x13a3c5,_0x16a51e);};}function removeListener(_0x3ba5ab,_0x8dbbda){return function(){WhatsappQueueEvents[_0xdac3('0x4')](_0x3ba5ab,_0x8dbbda);};}exports['register']=function(_0x29b537){for(var _0x56cda3=0x0,_0x1731f3=events['length'];_0x56cda3<_0x1731f3;_0x56cda3++){var _0x1218be=events[_0x56cda3];var _0xafc0f8=createListener(_0xdac3('0x5')+_0x1218be,_0x29b537);WhatsappQueueEvents['on'](_0x1218be,_0xafc0f8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 1fb249b..954c753 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 _0xa7b3=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','index','describe','isAuthenticated','show','create','put','/:id','update','destroy','exports'];(function(_0xf130d,_0x3bc2c9){var _0x58c72c=function(_0x3cfa9){while(--_0x3cfa9){_0xf130d['push'](_0xf130d['shift']());}};_0x58c72c(++_0x3bc2c9);}(_0xa7b3,0x1ee));var _0x3a7b=function(_0x2afe8d,_0x36b9df){_0x2afe8d=_0x2afe8d-0x0;var _0x2a7365=_0xa7b3[_0x2afe8d];return _0x2a7365;};'use strict';var multer=require('multer');var util=require(_0x3a7b('0x0'));var path=require(_0x3a7b('0x1'));var timeout=require(_0x3a7b('0x2'));var express=require(_0x3a7b('0x3'));var router=express[_0x3a7b('0x4')]();var auth=require(_0x3a7b('0x5'));var interaction=require(_0x3a7b('0x6'));var config=require('../../config/environment');var controller=require(_0x3a7b('0x7'));router[_0x3a7b('0x8')]('/',auth['isAuthenticated'](),controller[_0x3a7b('0x9')]);router[_0x3a7b('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x3a7b('0xa')]);router[_0x3a7b('0x8')]('/:id',auth[_0x3a7b('0xb')](),controller[_0x3a7b('0xc')]);router['post']('/',auth[_0x3a7b('0xb')](),controller[_0x3a7b('0xd')]);router[_0x3a7b('0xe')](_0x3a7b('0xf'),auth[_0x3a7b('0xb')](),controller[_0x3a7b('0x10')]);router['delete'](_0x3a7b('0xf'),auth[_0x3a7b('0xb')](),controller[_0x3a7b('0x11')]);module[_0x3a7b('0x12')]=router; \ No newline at end of file +var _0xe135=['connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','exports','util','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe135,0x1a7));var _0x5e13=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0xe135[_0x5162ed];return _0x4c579b;};'use strict';var multer=require('multer');var util=require(_0x5e13('0x0'));var path=require(_0x5e13('0x1'));var timeout=require(_0x5e13('0x2'));var express=require(_0x5e13('0x3'));var router=express['Router']();var auth=require(_0x5e13('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0x5e13('0x5')]('/',auth[_0x5e13('0x6')](),controller[_0x5e13('0x7')]);router[_0x5e13('0x5')]('/describe',auth[_0x5e13('0x6')](),controller[_0x5e13('0x8')]);router[_0x5e13('0x5')](_0x5e13('0x9'),auth['isAuthenticated'](),controller[_0x5e13('0xa')]);router[_0x5e13('0xb')]('/',auth['isAuthenticated'](),controller[_0x5e13('0xc')]);router['put']('/:id',auth[_0x5e13('0x6')](),controller[_0x5e13('0xd')]);router[_0x5e13('0xe')](_0x5e13('0x9'),auth['isAuthenticated'](),controller[_0x5e13('0xf')]);module[_0x5e13('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index a79d57d..7549e17 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 _0x7217=['sequelize','STRING','DATE'];(function(_0x4d7c09,_0x50c87b){var _0x303838=function(_0x2e53b2){while(--_0x2e53b2){_0x4d7c09['push'](_0x4d7c09['shift']());}};_0x303838(++_0x50c87b);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7721('0x1')]},'joinAt':{'type':Sequelize[_0x7721('0x2')]},'leaveAt':{'type':Sequelize[_0x7721('0x2')]},'acceptAt':{'type':Sequelize[_0x7721('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x224521,_0x389675){var _0x22ff46=function(_0x19277c){while(--_0x19277c){_0x224521['push'](_0x224521['shift']());}};_0x22ff46(++_0x389675);}(_0x55ca,0x126));var _0xa55c=function(_0x166146,_0x1f34c6){_0x166146=_0x166146-0x0;var _0x9c7390=_0x55ca[_0x166146];return _0x9c7390;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 4929dd7..179904d 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 _0xef66=['limit','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filters','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x2de5cf,_0x4668fc){var _0x131b2b=function(_0x552987){while(--_0x552987){_0x2de5cf['push'](_0x2de5cf['shift']());}};_0x131b2b(++_0x4668fc);}(_0xef66,0x1db));var _0x6ef6=function(_0x50ba20,_0xcba0){_0x50ba20=_0x50ba20-0x0;var _0xa95697=_0xef66[_0x50ba20];return _0xa95697;};'use strict';var pdf=require(_0x6ef6('0x0'));var emlformat=require(_0x6ef6('0x1'));var rimraf=require(_0x6ef6('0x2'));var zipdir=require(_0x6ef6('0x3'));var jsonpatch=require(_0x6ef6('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ef6('0x5'));var Mustache=require(_0x6ef6('0x6'));var util=require(_0x6ef6('0x7'));var path=require(_0x6ef6('0x8'));var sox=require(_0x6ef6('0x9'));var csv=require(_0x6ef6('0xa'));var ejs=require(_0x6ef6('0xb'));var fs=require('fs');var _=require(_0x6ef6('0xc'));var squel=require(_0x6ef6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ef6('0xe'));var toCsv=require(_0x6ef6('0xa'));var querystring=require(_0x6ef6('0xf'));var Papa=require(_0x6ef6('0x10'));var Redis=require(_0x6ef6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ef6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ef6('0x13'))('api');var utils=require(_0x6ef6('0x14'));var config=require(_0x6ef6('0x15'));var db=require(_0x6ef6('0x16'))['db'];function respondWithStatusCode(_0x331113,_0x596b91){_0x596b91=_0x596b91||0xcc;return function(_0x3aa045){if(_0x3aa045){return _0x331113[_0x6ef6('0x17')](_0x596b91);}return _0x331113[_0x6ef6('0x18')](_0x596b91)[_0x6ef6('0x19')]();};}function respondWithResult(_0x5ba663,_0x265583){_0x265583=_0x265583||0xc8;return function(_0x5845b7){if(_0x5845b7){return _0x5ba663[_0x6ef6('0x18')](_0x265583)[_0x6ef6('0x1a')](_0x5845b7);}};}function respondWithFilteredResult(_0x587806,_0x248ab3){return function(_0x1f4c3d){if(_0x1f4c3d){var _0x453aa3=_0x1f4c3d[_0x6ef6('0x1b')],_0x3f0a84=_0x248ab3[_0x6ef6('0x1c')],_0x3fa688=_0x248ab3[_0x6ef6('0x1c')]+_0x248ab3[_0x6ef6('0x1d')],_0x2e6eb6;if(_0x3fa688>=_0x453aa3){_0x3fa688=_0x453aa3;_0x2e6eb6=0xc8;}else{_0x2e6eb6=0xce;}_0x587806['status'](_0x2e6eb6);return _0x587806[_0x6ef6('0x1e')](_0x6ef6('0x1f'),_0x3f0a84+'-'+_0x3fa688+'/'+_0x453aa3)[_0x6ef6('0x1a')](_0x1f4c3d);}return null;};}function patchUpdates(_0x37d2ef){return function(_0x2a3364){try{jsonpatch[_0x6ef6('0x20')](_0x2a3364,_0x37d2ef,!![]);}catch(_0xb9a5fa){return BPromise['reject'](_0xb9a5fa);}return _0x2a3364[_0x6ef6('0x21')]();};}function saveUpdates(_0x20ef96,_0x2903ea){return function(_0x11ade5){if(_0x11ade5){return _0x11ade5['update'](_0x20ef96)[_0x6ef6('0x22')](function(_0xc0514c){return _0xc0514c;});}return null;};}function removeEntity(_0xed332b,_0x4f6df6){return function(_0x4257d8){if(_0x4257d8){return _0x4257d8[_0x6ef6('0x23')]()['then'](function(){_0xed332b[_0x6ef6('0x18')](0xcc)[_0x6ef6('0x19')]();});}};}function handleEntityNotFound(_0x4d7f90,_0x366f2c){return function(_0xb1c6b0){if(!_0xb1c6b0){_0x4d7f90[_0x6ef6('0x17')](0x194);}return _0xb1c6b0;};}function handleError(_0x414def,_0x43bb8d){_0x43bb8d=_0x43bb8d||0x1f4;return function(_0x3246df){logger[_0x6ef6('0x24')](_0x3246df['stack']);if(_0x3246df[_0x6ef6('0x25')]){delete _0x3246df['name'];}_0x414def[_0x6ef6('0x18')](_0x43bb8d)[_0x6ef6('0x26')](_0x3246df);};}exports[_0x6ef6('0x27')]=function(_0xada7a8,_0x1faa2c){var _0xf69d3d={},_0x23eb77={},_0x3e027d={'count':0x0,'rows':[]};var _0x20c7f4=_[_0x6ef6('0x28')](db[_0x6ef6('0x29')][_0x6ef6('0x2a')],function(_0x483f4d){return{'name':_0x483f4d[_0x6ef6('0x2b')],'type':_0x483f4d[_0x6ef6('0x2c')][_0x6ef6('0x2d')]};});_0x23eb77[_0x6ef6('0x2e')]=_[_0x6ef6('0x28')](_0x20c7f4,_0x6ef6('0x25'));_0x23eb77[_0x6ef6('0x2f')]=_['keys'](_0xada7a8[_0x6ef6('0x2f')]);_0x23eb77['filters']=_[_0x6ef6('0x30')](_0x23eb77[_0x6ef6('0x2e')],_0x23eb77[_0x6ef6('0x2f')]);_0xf69d3d['attributes']=_['intersection'](_0x23eb77[_0x6ef6('0x2e')],qs[_0x6ef6('0x31')](_0xada7a8[_0x6ef6('0x2f')]['fields']));_0xf69d3d[_0x6ef6('0x32')]=_0xf69d3d['attributes'][_0x6ef6('0x33')]?_0xf69d3d[_0x6ef6('0x32')]:_0x23eb77['model'];if(!_0xada7a8['query'][_0x6ef6('0x34')]('nolimit')){_0xf69d3d[_0x6ef6('0x1d')]=qs['limit'](_0xada7a8[_0x6ef6('0x2f')]['limit']);_0xf69d3d['offset']=qs[_0x6ef6('0x1c')](_0xada7a8[_0x6ef6('0x2f')]['offset']);}_0xf69d3d[_0x6ef6('0x35')]=qs['sort'](_0xada7a8[_0x6ef6('0x2f')]['sort']);_0xf69d3d[_0x6ef6('0x36')]=qs['filters'](_[_0x6ef6('0x37')](_0xada7a8[_0x6ef6('0x2f')],_0x23eb77[_0x6ef6('0x38')]),_0x20c7f4);if(_0xada7a8['query']['filter']){_0xf69d3d[_0x6ef6('0x36')]=_[_0x6ef6('0x39')](_0xf69d3d[_0x6ef6('0x36')],{'$or':_[_0x6ef6('0x28')](_0x20c7f4,function(_0x47b474){if(_0x47b474['type']!==_0x6ef6('0x3a')){var _0x55212c={};_0x55212c[_0x47b474['name']]={'$like':'%'+_0xada7a8[_0x6ef6('0x2f')]['filter']+'%'};return _0x55212c;}})});}_0xf69d3d=_[_0x6ef6('0x39')]({},_0xf69d3d,_0xada7a8[_0x6ef6('0x3b')]);var _0x30649c={'where':_0xf69d3d[_0x6ef6('0x36')]};return db[_0x6ef6('0x29')][_0x6ef6('0x1b')](_0x30649c)[_0x6ef6('0x22')](function(_0x5c5e8a){_0x3e027d[_0x6ef6('0x1b')]=_0x5c5e8a;if(_0xada7a8['query']['includeAll']){_0xf69d3d[_0x6ef6('0x3c')]=[{'all':!![]}];}return db[_0x6ef6('0x29')][_0x6ef6('0x3d')](_0xf69d3d);})['then'](function(_0x335afd){_0x3e027d[_0x6ef6('0x3e')]=_0x335afd;return _0x3e027d;})[_0x6ef6('0x22')](respondWithFilteredResult(_0x1faa2c,_0xf69d3d))['catch'](handleError(_0x1faa2c,null));};exports[_0x6ef6('0x3f')]=function(_0x22c1c3,_0x19a0ab){var _0x1bf2af={'raw':!![],'where':{'id':_0x22c1c3[_0x6ef6('0x40')]['id']}},_0xba84ba={};_0xba84ba[_0x6ef6('0x2e')]=_[_0x6ef6('0x41')](db[_0x6ef6('0x29')][_0x6ef6('0x2a')]);_0xba84ba['query']=_[_0x6ef6('0x41')](_0x22c1c3[_0x6ef6('0x2f')]);_0xba84ba[_0x6ef6('0x38')]=_[_0x6ef6('0x30')](_0xba84ba[_0x6ef6('0x2e')],_0xba84ba[_0x6ef6('0x2f')]);_0x1bf2af[_0x6ef6('0x32')]=_[_0x6ef6('0x30')](_0xba84ba[_0x6ef6('0x2e')],qs[_0x6ef6('0x31')](_0x22c1c3[_0x6ef6('0x2f')]['fields']));_0x1bf2af[_0x6ef6('0x32')]=_0x1bf2af['attributes'][_0x6ef6('0x33')]?_0x1bf2af['attributes']:_0xba84ba[_0x6ef6('0x2e')];if(_0x22c1c3[_0x6ef6('0x2f')]['includeAll']){_0x1bf2af[_0x6ef6('0x3c')]=[{'all':!![]}];}_0x1bf2af=_[_0x6ef6('0x39')]({},_0x1bf2af,_0x22c1c3[_0x6ef6('0x3b')]);return db[_0x6ef6('0x29')][_0x6ef6('0x42')](_0x1bf2af)['then'](handleEntityNotFound(_0x19a0ab,null))[_0x6ef6('0x22')](respondWithResult(_0x19a0ab,null))[_0x6ef6('0x43')](handleError(_0x19a0ab,null));};exports[_0x6ef6('0x44')]=function(_0x315d1a,_0x26e869){return db[_0x6ef6('0x29')][_0x6ef6('0x44')](_0x315d1a[_0x6ef6('0x45')],{})['then'](respondWithResult(_0x26e869,0xc9))[_0x6ef6('0x43')](handleError(_0x26e869,null));};exports[_0x6ef6('0x46')]=function(_0x52e93f,_0x5d6b40){if(_0x52e93f[_0x6ef6('0x45')]['id']){delete _0x52e93f['body']['id'];}return db[_0x6ef6('0x29')]['find']({'where':{'id':_0x52e93f[_0x6ef6('0x40')]['id']}})[_0x6ef6('0x22')](handleEntityNotFound(_0x5d6b40,null))[_0x6ef6('0x22')](saveUpdates(_0x52e93f[_0x6ef6('0x45')],null))['then'](respondWithResult(_0x5d6b40,null))['catch'](handleError(_0x5d6b40,null));};exports['destroy']=function(_0x537be2,_0x2fdb50){return db[_0x6ef6('0x29')][_0x6ef6('0x42')]({'where':{'id':_0x537be2['params']['id']}})[_0x6ef6('0x22')](handleEntityNotFound(_0x2fdb50,null))[_0x6ef6('0x22')](removeEntity(_0x2fdb50,null))[_0x6ef6('0x43')](handleError(_0x2fdb50,null));};exports[_0x6ef6('0x47')]=function(_0x1d5be1,_0x2be927){return db[_0x6ef6('0x29')]['describe']()[_0x6ef6('0x22')](respondWithResult(_0x2be927,null))['catch'](handleError(_0x2be927,null));}; \ No newline at end of file +var _0x3f48=['attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','WhatsappQueueReport','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x3f48,0x17c));var _0x83f4=function(_0x214f60,_0x47cf14){_0x214f60=_0x214f60-0x0;var _0x495b37=_0x3f48[_0x214f60];return _0x495b37;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x83f4('0x0'));var zipdir=require(_0x83f4('0x1'));var jsonpatch=require(_0x83f4('0x2'));var rp=require(_0x83f4('0x3'));var moment=require('moment');var BPromise=require(_0x83f4('0x4'));var Mustache=require(_0x83f4('0x5'));var util=require('util');var path=require(_0x83f4('0x6'));var sox=require('sox');var csv=require(_0x83f4('0x7'));var ejs=require(_0x83f4('0x8'));var fs=require('fs');var _=require(_0x83f4('0x9'));var squel=require(_0x83f4('0xa'));var crypto=require(_0x83f4('0xb'));var jsforce=require(_0x83f4('0xc'));var deskjs=require(_0x83f4('0xd'));var toCsv=require(_0x83f4('0x7'));var querystring=require('querystring');var Papa=require(_0x83f4('0xe'));var Redis=require(_0x83f4('0xf'));var authService=require(_0x83f4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x83f4('0x11'))(_0x83f4('0x12'));var utils=require(_0x83f4('0x13'));var config=require('../../config/environment');var db=require(_0x83f4('0x14'))['db'];function respondWithStatusCode(_0x54ec95,_0x51b5b6){_0x51b5b6=_0x51b5b6||0xcc;return function(_0x455e42){if(_0x455e42){return _0x54ec95[_0x83f4('0x15')](_0x51b5b6);}return _0x54ec95[_0x83f4('0x16')](_0x51b5b6)[_0x83f4('0x17')]();};}function respondWithResult(_0xdcfc5e,_0x3aee93){_0x3aee93=_0x3aee93||0xc8;return function(_0xcdaf6c){if(_0xcdaf6c){return _0xdcfc5e['status'](_0x3aee93)[_0x83f4('0x18')](_0xcdaf6c);}};}function respondWithFilteredResult(_0x18c56d,_0x204164){return function(_0x8062f){if(_0x8062f){var _0x38f762=_0x8062f[_0x83f4('0x19')],_0x11dc6d=_0x204164[_0x83f4('0x1a')],_0x4f0f62=_0x204164[_0x83f4('0x1a')]+_0x204164[_0x83f4('0x1b')],_0x1b5626;if(_0x4f0f62>=_0x38f762){_0x4f0f62=_0x38f762;_0x1b5626=0xc8;}else{_0x1b5626=0xce;}_0x18c56d['status'](_0x1b5626);return _0x18c56d[_0x83f4('0x1c')]('Content-Range',_0x11dc6d+'-'+_0x4f0f62+'/'+_0x38f762)[_0x83f4('0x18')](_0x8062f);}return null;};}function patchUpdates(_0x3b08d8){return function(_0x411b03){try{jsonpatch[_0x83f4('0x1d')](_0x411b03,_0x3b08d8,!![]);}catch(_0x30ac1d){return BPromise[_0x83f4('0x1e')](_0x30ac1d);}return _0x411b03['save']();};}function saveUpdates(_0x79c248,_0x14575b){return function(_0x2fa788){if(_0x2fa788){return _0x2fa788[_0x83f4('0x1f')](_0x79c248)['then'](function(_0x596ec8){return _0x596ec8;});}return null;};}function removeEntity(_0x2522da,_0x32e3b0){return function(_0x23b228){if(_0x23b228){return _0x23b228[_0x83f4('0x20')]()['then'](function(){_0x2522da[_0x83f4('0x16')](0xcc)[_0x83f4('0x17')]();});}};}function handleEntityNotFound(_0x4115da,_0x10c3b8){return function(_0x5e4f28){if(!_0x5e4f28){_0x4115da[_0x83f4('0x15')](0x194);}return _0x5e4f28;};}function handleError(_0x570ec3,_0x386530){_0x386530=_0x386530||0x1f4;return function(_0x201b2f){logger[_0x83f4('0x21')](_0x201b2f[_0x83f4('0x22')]);if(_0x201b2f[_0x83f4('0x23')]){delete _0x201b2f[_0x83f4('0x23')];}_0x570ec3[_0x83f4('0x16')](_0x386530)[_0x83f4('0x24')](_0x201b2f);};}exports[_0x83f4('0x25')]=function(_0x22ff3f,_0x3ab54d){var _0x4fa94f={},_0x2530be={},_0x4eeab6={'count':0x0,'rows':[]};var _0x5d260d=_[_0x83f4('0x26')](db['WhatsappQueueReport'][_0x83f4('0x27')],function(_0xbc819e){return{'name':_0xbc819e[_0x83f4('0x28')],'type':_0xbc819e['type']['key']};});_0x2530be['model']=_[_0x83f4('0x26')](_0x5d260d,_0x83f4('0x23'));_0x2530be[_0x83f4('0x29')]=_[_0x83f4('0x2a')](_0x22ff3f['query']);_0x2530be[_0x83f4('0x2b')]=_[_0x83f4('0x2c')](_0x2530be[_0x83f4('0x2d')],_0x2530be[_0x83f4('0x29')]);_0x4fa94f[_0x83f4('0x2e')]=_[_0x83f4('0x2c')](_0x2530be[_0x83f4('0x2d')],qs[_0x83f4('0x2f')](_0x22ff3f['query'][_0x83f4('0x2f')]));_0x4fa94f['attributes']=_0x4fa94f[_0x83f4('0x2e')]['length']?_0x4fa94f[_0x83f4('0x2e')]:_0x2530be['model'];if(!_0x22ff3f[_0x83f4('0x29')][_0x83f4('0x30')]('nolimit')){_0x4fa94f[_0x83f4('0x1b')]=qs['limit'](_0x22ff3f[_0x83f4('0x29')]['limit']);_0x4fa94f[_0x83f4('0x1a')]=qs['offset'](_0x22ff3f[_0x83f4('0x29')][_0x83f4('0x1a')]);}_0x4fa94f[_0x83f4('0x31')]=qs[_0x83f4('0x32')](_0x22ff3f[_0x83f4('0x29')][_0x83f4('0x32')]);_0x4fa94f['where']=qs[_0x83f4('0x2b')](_[_0x83f4('0x33')](_0x22ff3f[_0x83f4('0x29')],_0x2530be[_0x83f4('0x2b')]),_0x5d260d);if(_0x22ff3f[_0x83f4('0x29')][_0x83f4('0x34')]){_0x4fa94f[_0x83f4('0x35')]=_[_0x83f4('0x36')](_0x4fa94f[_0x83f4('0x35')],{'$or':_[_0x83f4('0x26')](_0x5d260d,function(_0x2bd764){if(_0x2bd764[_0x83f4('0x37')]!==_0x83f4('0x38')){var _0x6370fa={};_0x6370fa[_0x2bd764[_0x83f4('0x23')]]={'$like':'%'+_0x22ff3f[_0x83f4('0x29')][_0x83f4('0x34')]+'%'};return _0x6370fa;}})});}_0x4fa94f=_[_0x83f4('0x36')]({},_0x4fa94f,_0x22ff3f[_0x83f4('0x39')]);var _0x437853={'where':_0x4fa94f[_0x83f4('0x35')]};return db['WhatsappQueueReport'][_0x83f4('0x19')](_0x437853)['then'](function(_0x583edd){_0x4eeab6[_0x83f4('0x19')]=_0x583edd;if(_0x22ff3f[_0x83f4('0x29')][_0x83f4('0x3a')]){_0x4fa94f[_0x83f4('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x83f4('0x3c')](_0x4fa94f);})[_0x83f4('0x3d')](function(_0x357112){_0x4eeab6[_0x83f4('0x3e')]=_0x357112;return _0x4eeab6;})['then'](respondWithFilteredResult(_0x3ab54d,_0x4fa94f))[_0x83f4('0x3f')](handleError(_0x3ab54d,null));};exports[_0x83f4('0x40')]=function(_0x116f62,_0x1f9e8c){var _0x224ec8={'raw':!![],'where':{'id':_0x116f62[_0x83f4('0x41')]['id']}},_0x2ebe5b={};_0x2ebe5b[_0x83f4('0x2d')]=_['keys'](db[_0x83f4('0x42')][_0x83f4('0x27')]);_0x2ebe5b['query']=_['keys'](_0x116f62[_0x83f4('0x29')]);_0x2ebe5b[_0x83f4('0x2b')]=_[_0x83f4('0x2c')](_0x2ebe5b[_0x83f4('0x2d')],_0x2ebe5b[_0x83f4('0x29')]);_0x224ec8[_0x83f4('0x2e')]=_[_0x83f4('0x2c')](_0x2ebe5b[_0x83f4('0x2d')],qs['fields'](_0x116f62[_0x83f4('0x29')]['fields']));_0x224ec8[_0x83f4('0x2e')]=_0x224ec8[_0x83f4('0x2e')][_0x83f4('0x43')]?_0x224ec8[_0x83f4('0x2e')]:_0x2ebe5b[_0x83f4('0x2d')];if(_0x116f62['query']['includeAll']){_0x224ec8[_0x83f4('0x3b')]=[{'all':!![]}];}_0x224ec8=_[_0x83f4('0x36')]({},_0x224ec8,_0x116f62[_0x83f4('0x39')]);return db[_0x83f4('0x42')][_0x83f4('0x44')](_0x224ec8)['then'](handleEntityNotFound(_0x1f9e8c,null))[_0x83f4('0x3d')](respondWithResult(_0x1f9e8c,null))[_0x83f4('0x3f')](handleError(_0x1f9e8c,null));};exports[_0x83f4('0x45')]=function(_0x2668b7,_0xe90704){return db['WhatsappQueueReport'][_0x83f4('0x45')](_0x2668b7[_0x83f4('0x46')],{})[_0x83f4('0x3d')](respondWithResult(_0xe90704,0xc9))['catch'](handleError(_0xe90704,null));};exports[_0x83f4('0x1f')]=function(_0x515ad7,_0x5014f1){if(_0x515ad7['body']['id']){delete _0x515ad7[_0x83f4('0x46')]['id'];}return db[_0x83f4('0x42')][_0x83f4('0x44')]({'where':{'id':_0x515ad7[_0x83f4('0x41')]['id']}})[_0x83f4('0x3d')](handleEntityNotFound(_0x5014f1,null))[_0x83f4('0x3d')](saveUpdates(_0x515ad7[_0x83f4('0x46')],null))[_0x83f4('0x3d')](respondWithResult(_0x5014f1,null))[_0x83f4('0x3f')](handleError(_0x5014f1,null));};exports[_0x83f4('0x20')]=function(_0x2a2e77,_0x4ec4a7){return db['WhatsappQueueReport']['find']({'where':{'id':_0x2a2e77[_0x83f4('0x41')]['id']}})[_0x83f4('0x3d')](handleEntityNotFound(_0x4ec4a7,null))[_0x83f4('0x3d')](removeEntity(_0x4ec4a7,null))[_0x83f4('0x3f')](handleError(_0x4ec4a7,null));};exports['describe']=function(_0x3d5d61,_0x459c26){return db['WhatsappQueueReport']['describe']()[_0x83f4('0x3d')](respondWithResult(_0x459c26,null))[_0x83f4('0x3f')](handleError(_0x459c26,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 64b5114..f571198 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 _0x869b=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport'];(function(_0xbb70f5,_0x40bfb3){var _0x30b1a9=function(_0x2a778d){while(--_0x2a778d){_0xbb70f5['push'](_0xbb70f5['shift']());}};_0x30b1a9(++_0x40bfb3);}(_0x869b,0xaa));var _0xb869=function(_0x4c3f4b,_0x440546){_0x4c3f4b=_0x4c3f4b-0x0;var _0x39daae=_0x869b[_0x4c3f4b];return _0x39daae;};'use strict';var _=require(_0xb869('0x0'));var util=require(_0xb869('0x1'));var logger=require(_0xb869('0x2'))(_0xb869('0x3'));var moment=require(_0xb869('0x4'));var BPromise=require(_0xb869('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb869('0x6'));var rimraf=require(_0xb869('0x7'));var config=require(_0xb869('0x8'));var attributes=require(_0xb869('0x9'));module['exports']=function(_0x15b266,_0x4ec375){return _0x15b266[_0xb869('0xa')](_0xb869('0xb'),attributes,{'tableName':_0xb869('0xc'),'paranoid':![],'indexes':[{'name':_0xb869('0xd'),'fields':[_0xb869('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6cb6=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport'];(function(_0x21e97b,_0x65a77f){var _0x10ba44=function(_0x239ef2){while(--_0x239ef2){_0x21e97b['push'](_0x21e97b['shift']());}};_0x10ba44(++_0x65a77f);}(_0x6cb6,0x120));var _0x66cb=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6cb6[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x66cb('0x0'));var util=require(_0x66cb('0x1'));var logger=require(_0x66cb('0x2'))('api');var moment=require(_0x66cb('0x3'));var BPromise=require(_0x66cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x66cb('0x5'));var rimraf=require(_0x66cb('0x6'));var config=require(_0x66cb('0x7'));var attributes=require(_0x66cb('0x8'));module[_0x66cb('0x9')]=function(_0x3cb408,_0x103ef8){return _0x3cb408['define'](_0x66cb('0xa'),attributes,{'tableName':_0x66cb('0xb'),'paranoid':![],'indexes':[{'name':_0x66cb('0xc'),'fields':[_0x66cb('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 d273ea2..7190441 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 _0xa83c=['../../config/utils','../../config/logger','rpc','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','result','catch','CreateWhatsappQueueReport','body','options','raw','then','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x8256f,_0x4caeeb){var _0x49891d=function(_0x3288be){while(--_0x3288be){_0x8256f['push'](_0x8256f['shift']());}};_0x49891d(++_0x4caeeb);}(_0xa83c,0xa9));var _0xca83=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xa83c[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0xca83('0x0'));var util=require(_0xca83('0x1'));var moment=require(_0xca83('0x2'));var BPromise=require(_0xca83('0x3'));var rs=require(_0xca83('0x4'));var fs=require('fs');var Redis=require(_0xca83('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xca83('0x6'));var logger=require(_0xca83('0x7'))(_0xca83('0x8'));var config=require('../../config/environment');var jayson=require(_0xca83('0x9'));var client=jayson[_0xca83('0xa')][_0xca83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29a73b,_0x295a88,_0x5f58aa){return new BPromise(function(_0x3914b7,_0x217329){return client[_0xca83('0xc')](_0x29a73b,_0x5f58aa)['then'](function(_0x5e66c3){logger[_0xca83('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x295a88,_0xca83('0xe'));logger[_0xca83('0xf')](_0xca83('0x10'),_0x295a88,_0xca83('0xe'),JSON[_0xca83('0x11')](_0x5e66c3));if(_0x5e66c3[_0xca83('0x12')]){if(_0x5e66c3[_0xca83('0x12')][_0xca83('0x13')]===0x1f4){logger[_0xca83('0x12')](_0xca83('0x14'),_0x295a88,_0x5e66c3[_0xca83('0x12')]['message']);return _0x217329(_0x5e66c3[_0xca83('0x12')][_0xca83('0x15')]);}logger[_0xca83('0x12')](_0xca83('0x14'),_0x295a88,_0x5e66c3[_0xca83('0x12')]['message']);return _0x3914b7(_0x5e66c3['error']['message']);}else{logger['info'](_0xca83('0x14'),_0x295a88,_0xca83('0xe'));_0x3914b7(_0x5e66c3[_0xca83('0x16')]['message']);}})[_0xca83('0x17')](function(_0x1e6e0d){logger[_0xca83('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x295a88,_0x1e6e0d);_0x217329(_0x1e6e0d);});});}exports[_0xca83('0x18')]=function(_0x46dbc8){var _0x3f46b9=this;return new Promise(function(_0x1e6d9b,_0x411727){return db['WhatsappQueueReport']['create'](_0x46dbc8[_0xca83('0x19')],{'raw':_0x46dbc8[_0xca83('0x1a')]?_0x46dbc8[_0xca83('0x1a')][_0xca83('0x1b')]===undefined?!![]:![]:!![]})[_0xca83('0x1c')](function(_0x373766){logger[_0xca83('0xd')]('CreateWhatsappQueueReport',_0x46dbc8);logger[_0xca83('0xf')](_0xca83('0x18'),_0x46dbc8,JSON[_0xca83('0x11')](_0x373766));_0x1e6d9b(_0x373766);})[_0xca83('0x17')](function(_0x5c193a){logger[_0xca83('0x12')](_0xca83('0x18'),_0x5c193a[_0xca83('0x15')],_0x46dbc8);_0x411727(_0x3f46b9[_0xca83('0x12')](0x1f4,_0x5c193a['message']));});});};exports[_0xca83('0x1d')]=function(_0x10037e){var _0x3e4d93=this;return new Promise(function(_0x1a7e4c,_0x377800){return db[_0xca83('0x1e')][_0xca83('0x1f')](_0x10037e[_0xca83('0x19')],{'raw':_0x10037e[_0xca83('0x1a')]?_0x10037e[_0xca83('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10037e[_0xca83('0x1a')]?_0x10037e['options'][_0xca83('0x20')]||null:null,'attributes':_0x10037e[_0xca83('0x1a')]?_0x10037e[_0xca83('0x1a')][_0xca83('0x21')]||null:null,'limit':_0x10037e[_0xca83('0x1a')]?_0x10037e['options'][_0xca83('0x22')]||null:null})[_0xca83('0x1c')](function(_0x41686a){logger[_0xca83('0xd')](_0xca83('0x1d'),_0x10037e);logger[_0xca83('0xf')]('UpdateWhatsappQueueReport',_0x10037e,JSON[_0xca83('0x11')](_0x41686a));_0x1a7e4c(_0x41686a);})[_0xca83('0x17')](function(_0x3939d0){logger[_0xca83('0x12')](_0xca83('0x1d'),_0x3939d0['message'],_0x10037e);_0x377800(_0x3e4d93[_0xca83('0x12')](0x1f4,_0x3939d0[_0xca83('0x15')]));});});}; \ No newline at end of file +var _0x94c5=['message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','where','limit','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5124e1,_0x47efc6){var _0x5e4a22=function(_0x2a4ba8){while(--_0x2a4ba8){_0x5124e1['push'](_0x5124e1['shift']());}};_0x5e4a22(++_0x47efc6);}(_0x94c5,0x1ad));var _0x594c=function(_0x61bb5e,_0x626cf7){_0x61bb5e=_0x61bb5e-0x0;var _0x4f4258=_0x94c5[_0x61bb5e];return _0x4f4258;};'use strict';var _=require(_0x594c('0x0'));var util=require('util');var moment=require(_0x594c('0x1'));var BPromise=require(_0x594c('0x2'));var rs=require(_0x594c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x594c('0x4'))['db'];var utils=require(_0x594c('0x5'));var logger=require(_0x594c('0x6'))('rpc');var config=require(_0x594c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x594c('0x8')][_0x594c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x291f59,_0x54b43f,_0x42db27){return new BPromise(function(_0x585199,_0x39efde){return client[_0x594c('0xa')](_0x291f59,_0x42db27)['then'](function(_0x1e5511){logger[_0x594c('0xb')](_0x594c('0xc'),_0x54b43f,_0x594c('0xd'));logger[_0x594c('0xe')](_0x594c('0xf'),_0x54b43f,_0x594c('0xd'),JSON[_0x594c('0x10')](_0x1e5511));if(_0x1e5511[_0x594c('0x11')]){if(_0x1e5511[_0x594c('0x11')][_0x594c('0x12')]===0x1f4){logger[_0x594c('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x54b43f,_0x1e5511[_0x594c('0x11')][_0x594c('0x13')]);return _0x39efde(_0x1e5511[_0x594c('0x11')][_0x594c('0x13')]);}logger[_0x594c('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x54b43f,_0x1e5511[_0x594c('0x11')][_0x594c('0x13')]);return _0x585199(_0x1e5511[_0x594c('0x11')]['message']);}else{logger[_0x594c('0xb')](_0x594c('0xc'),_0x54b43f,'request\x20sent');_0x585199(_0x1e5511[_0x594c('0x14')][_0x594c('0x13')]);}})['catch'](function(_0xb67288){logger[_0x594c('0x11')](_0x594c('0xc'),_0x54b43f,_0xb67288);_0x39efde(_0xb67288);});});}exports[_0x594c('0x15')]=function(_0x532765){var _0x24e497=this;return new Promise(function(_0x41e1b3,_0x56e1c7){return db[_0x594c('0x16')][_0x594c('0x17')](_0x532765[_0x594c('0x18')],{'raw':_0x532765[_0x594c('0x19')]?_0x532765[_0x594c('0x19')][_0x594c('0x1a')]===undefined?!![]:![]:!![]})[_0x594c('0x1b')](function(_0x3b1d07){logger[_0x594c('0xb')](_0x594c('0x15'),_0x532765);logger[_0x594c('0xe')](_0x594c('0x15'),_0x532765,JSON[_0x594c('0x10')](_0x3b1d07));_0x41e1b3(_0x3b1d07);})['catch'](function(_0x2d3d5d){logger[_0x594c('0x11')]('CreateWhatsappQueueReport',_0x2d3d5d[_0x594c('0x13')],_0x532765);_0x56e1c7(_0x24e497['error'](0x1f4,_0x2d3d5d[_0x594c('0x13')]));});});};exports[_0x594c('0x1c')]=function(_0x55b598){var _0x3ffb8b=this;return new Promise(function(_0x21c182,_0xb1ffcd){return db[_0x594c('0x16')]['update'](_0x55b598['body'],{'raw':_0x55b598[_0x594c('0x19')]?_0x55b598['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55b598[_0x594c('0x19')]?_0x55b598[_0x594c('0x19')][_0x594c('0x1d')]||null:null,'attributes':_0x55b598[_0x594c('0x19')]?_0x55b598[_0x594c('0x19')]['attributes']||null:null,'limit':_0x55b598['options']?_0x55b598[_0x594c('0x19')][_0x594c('0x1e')]||null:null})[_0x594c('0x1b')](function(_0x234ac9){logger[_0x594c('0xb')](_0x594c('0x1c'),_0x55b598);logger['debug'](_0x594c('0x1c'),_0x55b598,JSON[_0x594c('0x10')](_0x234ac9));_0x21c182(_0x234ac9);})[_0x594c('0x1f')](function(_0x32b6bb){logger['error'](_0x594c('0x1c'),_0x32b6bb[_0x594c('0x13')],_0x55b598);_0xb1ffcd(_0x3ffb8b['error'](0x1f4,_0x32b6bb[_0x594c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 971c077..536e879 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 _0xd38e=['delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','describe','/:id','show','post','isAuthenticated','create','update'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xd38e,0x17d));var _0xed38=function(_0x40dac3,_0x1332a2){_0x40dac3=_0x40dac3-0x0;var _0x8367fe=_0xd38e[_0x40dac3];return _0x8367fe;};'use strict';var multer=require(_0xed38('0x0'));var util=require('util');var path=require(_0xed38('0x1'));var timeout=require(_0xed38('0x2'));var express=require(_0xed38('0x3'));var router=express[_0xed38('0x4')]();var auth=require(_0xed38('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed38('0x6'));var controller=require(_0xed38('0x7'));router[_0xed38('0x8')]('/',auth['isAuthenticated'](),controller[_0xed38('0x9')]);router[_0xed38('0x8')](_0xed38('0xa'),auth['isAuthenticated'](),controller[_0xed38('0xb')]);router[_0xed38('0x8')](_0xed38('0xc'),auth['isAuthenticated'](),controller[_0xed38('0xd')]);router[_0xed38('0xe')]('/',auth[_0xed38('0xf')](),controller[_0xed38('0x10')]);router['put'](_0xed38('0xc'),auth[_0xed38('0xf')](),controller[_0xed38('0x11')]);router[_0xed38('0x12')](_0xed38('0xc'),auth[_0xed38('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x46c1=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x46c1,0x7c));var _0x146c=function(_0x4054cb,_0x10c1b9){_0x4054cb=_0x4054cb-0x0;var _0xd384a6=_0x46c1[_0x4054cb];return _0xd384a6;};'use strict';var multer=require('multer');var util=require(_0x146c('0x0'));var path=require(_0x146c('0x1'));var timeout=require(_0x146c('0x2'));var express=require(_0x146c('0x3'));var router=express[_0x146c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x146c('0x5'));var config=require(_0x146c('0x6'));var controller=require(_0x146c('0x7'));router[_0x146c('0x8')]('/',auth[_0x146c('0x9')](),controller['index']);router['get'](_0x146c('0xa'),auth[_0x146c('0x9')](),controller[_0x146c('0xb')]);router['get'](_0x146c('0xc'),auth['isAuthenticated'](),controller[_0x146c('0xd')]);router[_0x146c('0xe')]('/',auth['isAuthenticated'](),controller[_0x146c('0xf')]);router[_0x146c('0x10')](_0x146c('0xc'),auth[_0x146c('0x9')](),controller['update']);router[_0x146c('0x11')]('/:id',auth[_0x146c('0x9')](),controller[_0x146c('0x12')]);module[_0x146c('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 680fb6e..c56ee1f 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 _0x757a=['queue','DATE','exports','STRING'];(function(_0x46066f,_0x23105c){var _0x411977=function(_0x5743ff){while(--_0x5743ff){_0x46066f['push'](_0x46066f['shift']());}};_0x411977(++_0x23105c);}(_0x757a,0xde));var _0xa757=function(_0x544ce8,_0xd5ff3a){_0x544ce8=_0x544ce8-0x0;var _0x25e05f=_0x757a[_0x544ce8];return _0x25e05f;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file +var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0x0b0e[_0x2f37e0];return _0x43ccce;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2c8c47e..f77b0de 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 _0x4627=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','fieldName','key','model','keys','attributes','intersection','fields','length','hasOwnProperty','query','where','filters','pick','filter','merge','VIRTUAL','options','count','include','WhatsappTransferReport','findAll','catch','show','rawAttributes','includeAll','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x383e61,_0x5319ec){var _0x2b1a9c=function(_0x4834b5){while(--_0x4834b5){_0x383e61['push'](_0x383e61['shift']());}};_0x2b1a9c(++_0x5319ec);}(_0x4627,0x7d));var _0x7462=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x4627[_0x51fe5f];return _0x4abce9;};'use strict';var pdf=require(_0x7462('0x0'));var emlformat=require(_0x7462('0x1'));var rimraf=require(_0x7462('0x2'));var zipdir=require(_0x7462('0x3'));var jsonpatch=require(_0x7462('0x4'));var rp=require(_0x7462('0x5'));var moment=require(_0x7462('0x6'));var BPromise=require(_0x7462('0x7'));var Mustache=require(_0x7462('0x8'));var util=require(_0x7462('0x9'));var path=require(_0x7462('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7462('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7462('0xc'));var deskjs=require(_0x7462('0xd'));var toCsv=require(_0x7462('0xe'));var querystring=require(_0x7462('0xf'));var Papa=require('papaparse');var Redis=require(_0x7462('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7462('0x11'));var as=require(_0x7462('0x12'));var hardwareService=require(_0x7462('0x13'));var logger=require(_0x7462('0x14'))(_0x7462('0x15'));var utils=require(_0x7462('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18ea29,_0x462c32){_0x462c32=_0x462c32||0xcc;return function(_0x44052f){if(_0x44052f){return _0x18ea29['sendStatus'](_0x462c32);}return _0x18ea29[_0x7462('0x17')](_0x462c32)[_0x7462('0x18')]();};}function respondWithResult(_0x5ceb95,_0x1d423d){_0x1d423d=_0x1d423d||0xc8;return function(_0x353877){if(_0x353877){return _0x5ceb95['status'](_0x1d423d)[_0x7462('0x19')](_0x353877);}};}function respondWithFilteredResult(_0x533ee0,_0x336293){return function(_0x2e6cf0){if(_0x2e6cf0){var _0x351d43=_0x2e6cf0['count'],_0x422d1a=_0x336293['offset'],_0x4b7a52=_0x336293[_0x7462('0x1a')]+_0x336293[_0x7462('0x1b')],_0x63e4d5;if(_0x4b7a52>=_0x351d43){_0x4b7a52=_0x351d43;_0x63e4d5=0xc8;}else{_0x63e4d5=0xce;}_0x533ee0['status'](_0x63e4d5);return _0x533ee0['set'](_0x7462('0x1c'),_0x422d1a+'-'+_0x4b7a52+'/'+_0x351d43)[_0x7462('0x19')](_0x2e6cf0);}return null;};}function patchUpdates(_0x241c8b){return function(_0x5077f2){try{jsonpatch[_0x7462('0x1d')](_0x5077f2,_0x241c8b,!![]);}catch(_0x138ce2){return BPromise[_0x7462('0x1e')](_0x138ce2);}return _0x5077f2[_0x7462('0x1f')]();};}function saveUpdates(_0x265e7c,_0x264ca2){return function(_0x5aaa24){if(_0x5aaa24){return _0x5aaa24[_0x7462('0x20')](_0x265e7c)['then'](function(_0x42ee7d){return _0x42ee7d;});}return null;};}function removeEntity(_0x6ecf31,_0x58520c){return function(_0x3e4528){if(_0x3e4528){return _0x3e4528[_0x7462('0x21')]()[_0x7462('0x22')](function(){_0x6ecf31['status'](0xcc)[_0x7462('0x18')]();});}};}function handleEntityNotFound(_0x165326,_0x13f810){return function(_0xc3fce4){if(!_0xc3fce4){_0x165326[_0x7462('0x23')](0x194);}return _0xc3fce4;};}function handleError(_0x5b87bc,_0x319ebb){_0x319ebb=_0x319ebb||0x1f4;return function(_0x271ddd){logger[_0x7462('0x24')](_0x271ddd[_0x7462('0x25')]);if(_0x271ddd[_0x7462('0x26')]){delete _0x271ddd[_0x7462('0x26')];}_0x5b87bc['status'](_0x319ebb)[_0x7462('0x27')](_0x271ddd);};}exports['index']=function(_0xeed570,_0x177072){var _0x469843={},_0x4f1b20={},_0x45fd0c={'count':0x0,'rows':[]};var _0x88d0e8=_[_0x7462('0x28')](db['WhatsappTransferReport']['rawAttributes'],function(_0x6e833b){return{'name':_0x6e833b[_0x7462('0x29')],'type':_0x6e833b['type'][_0x7462('0x2a')]};});_0x4f1b20[_0x7462('0x2b')]=_['map'](_0x88d0e8,_0x7462('0x26'));_0x4f1b20['query']=_[_0x7462('0x2c')](_0xeed570['query']);_0x4f1b20['filters']=_['intersection'](_0x4f1b20[_0x7462('0x2b')],_0x4f1b20['query']);_0x469843[_0x7462('0x2d')]=_[_0x7462('0x2e')](_0x4f1b20[_0x7462('0x2b')],qs[_0x7462('0x2f')](_0xeed570['query'][_0x7462('0x2f')]));_0x469843[_0x7462('0x2d')]=_0x469843[_0x7462('0x2d')][_0x7462('0x30')]?_0x469843[_0x7462('0x2d')]:_0x4f1b20[_0x7462('0x2b')];if(!_0xeed570['query'][_0x7462('0x31')]('nolimit')){_0x469843[_0x7462('0x1b')]=qs['limit'](_0xeed570[_0x7462('0x32')]['limit']);_0x469843['offset']=qs['offset'](_0xeed570['query'][_0x7462('0x1a')]);}_0x469843['order']=qs['sort'](_0xeed570[_0x7462('0x32')]['sort']);_0x469843[_0x7462('0x33')]=qs[_0x7462('0x34')](_[_0x7462('0x35')](_0xeed570[_0x7462('0x32')],_0x4f1b20[_0x7462('0x34')]),_0x88d0e8);if(_0xeed570[_0x7462('0x32')][_0x7462('0x36')]){_0x469843[_0x7462('0x33')]=_[_0x7462('0x37')](_0x469843['where'],{'$or':_[_0x7462('0x28')](_0x88d0e8,function(_0x1c05f8){if(_0x1c05f8['type']!==_0x7462('0x38')){var _0x580df4={};_0x580df4[_0x1c05f8[_0x7462('0x26')]]={'$like':'%'+_0xeed570[_0x7462('0x32')][_0x7462('0x36')]+'%'};return _0x580df4;}})});}_0x469843=_[_0x7462('0x37')]({},_0x469843,_0xeed570[_0x7462('0x39')]);var _0x4845f3={'where':_0x469843['where']};return db['WhatsappTransferReport'][_0x7462('0x3a')](_0x4845f3)[_0x7462('0x22')](function(_0xde110e){_0x45fd0c[_0x7462('0x3a')]=_0xde110e;if(_0xeed570['query']['includeAll']){_0x469843[_0x7462('0x3b')]=[{'all':!![]}];}return db[_0x7462('0x3c')][_0x7462('0x3d')](_0x469843);})[_0x7462('0x22')](function(_0x241d50){_0x45fd0c['rows']=_0x241d50;return _0x45fd0c;})[_0x7462('0x22')](respondWithFilteredResult(_0x177072,_0x469843))[_0x7462('0x3e')](handleError(_0x177072,null));};exports[_0x7462('0x3f')]=function(_0x1395b1,_0x3a41d5){var _0x407ece={'raw':!![],'where':{'id':_0x1395b1['params']['id']}},_0x389ee8={};_0x389ee8[_0x7462('0x2b')]=_['keys'](db[_0x7462('0x3c')][_0x7462('0x40')]);_0x389ee8['query']=_[_0x7462('0x2c')](_0x1395b1[_0x7462('0x32')]);_0x389ee8[_0x7462('0x34')]=_[_0x7462('0x2e')](_0x389ee8[_0x7462('0x2b')],_0x389ee8[_0x7462('0x32')]);_0x407ece['attributes']=_[_0x7462('0x2e')](_0x389ee8['model'],qs[_0x7462('0x2f')](_0x1395b1['query'][_0x7462('0x2f')]));_0x407ece[_0x7462('0x2d')]=_0x407ece[_0x7462('0x2d')]['length']?_0x407ece[_0x7462('0x2d')]:_0x389ee8[_0x7462('0x2b')];if(_0x1395b1[_0x7462('0x32')][_0x7462('0x41')]){_0x407ece['include']=[{'all':!![]}];}_0x407ece=_[_0x7462('0x37')]({},_0x407ece,_0x1395b1['options']);return db['WhatsappTransferReport'][_0x7462('0x42')](_0x407ece)['then'](handleEntityNotFound(_0x3a41d5,null))['then'](respondWithResult(_0x3a41d5,null))['catch'](handleError(_0x3a41d5,null));};exports[_0x7462('0x43')]=function(_0x5d8e20,_0x383785){return db['WhatsappTransferReport'][_0x7462('0x43')](_0x5d8e20[_0x7462('0x44')],{})[_0x7462('0x22')](respondWithResult(_0x383785,0xc9))[_0x7462('0x3e')](handleError(_0x383785,null));};exports[_0x7462('0x20')]=function(_0x1cdfba,_0x1da450){if(_0x1cdfba['body']['id']){delete _0x1cdfba[_0x7462('0x44')]['id'];}return db[_0x7462('0x3c')][_0x7462('0x42')]({'where':{'id':_0x1cdfba['params']['id']}})['then'](handleEntityNotFound(_0x1da450,null))[_0x7462('0x22')](saveUpdates(_0x1cdfba[_0x7462('0x44')],null))[_0x7462('0x22')](respondWithResult(_0x1da450,null))[_0x7462('0x3e')](handleError(_0x1da450,null));};exports[_0x7462('0x21')]=function(_0x3bc99f,_0xdb7c9f){return db[_0x7462('0x3c')][_0x7462('0x42')]({'where':{'id':_0x3bc99f[_0x7462('0x45')]['id']}})[_0x7462('0x22')](handleEntityNotFound(_0xdb7c9f,null))[_0x7462('0x22')](removeEntity(_0xdb7c9f,null))[_0x7462('0x3e')](handleError(_0xdb7c9f,null));};exports[_0x7462('0x46')]=function(_0x3be028,_0x323bce){return db[_0x7462('0x3c')][_0x7462('0x46')]()[_0x7462('0x22')](respondWithResult(_0x323bce,null))[_0x7462('0x3e')](handleError(_0x323bce,null));}; \ No newline at end of file +var _0x9a01=['fields','length','order','sort','where','pick','merge','VIRTUAL','filter','count','findAll','rows','show','includeAll','include','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection'];(function(_0x398fdb,_0x3ab81d){var _0x344d14=function(_0x1cb8cd){while(--_0x1cb8cd){_0x398fdb['push'](_0x398fdb['shift']());}};_0x344d14(++_0x3ab81d);}(_0x9a01,0x1d8));var _0x19a0=function(_0x1b4165,_0x443661){_0x1b4165=_0x1b4165-0x0;var _0x44c1b1=_0x9a01[_0x1b4165];return _0x44c1b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x19a0('0x0'));var rimraf=require(_0x19a0('0x1'));var zipdir=require(_0x19a0('0x2'));var jsonpatch=require(_0x19a0('0x3'));var rp=require(_0x19a0('0x4'));var moment=require('moment');var BPromise=require(_0x19a0('0x5'));var Mustache=require(_0x19a0('0x6'));var util=require(_0x19a0('0x7'));var path=require(_0x19a0('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x19a0('0x9'));var fs=require('fs');var _=require(_0x19a0('0xa'));var squel=require(_0x19a0('0xb'));var crypto=require(_0x19a0('0xc'));var jsforce=require(_0x19a0('0xd'));var deskjs=require(_0x19a0('0xe'));var toCsv=require(_0x19a0('0xf'));var querystring=require(_0x19a0('0x10'));var Papa=require(_0x19a0('0x11'));var Redis=require(_0x19a0('0x12'));var authService=require(_0x19a0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x19a0('0x14'));var hardwareService=require(_0x19a0('0x15'));var logger=require(_0x19a0('0x16'))(_0x19a0('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x19a0('0x18'))['db'];function respondWithStatusCode(_0x443a3c,_0xdbb0e0){_0xdbb0e0=_0xdbb0e0||0xcc;return function(_0x12254c){if(_0x12254c){return _0x443a3c[_0x19a0('0x19')](_0xdbb0e0);}return _0x443a3c[_0x19a0('0x1a')](_0xdbb0e0)[_0x19a0('0x1b')]();};}function respondWithResult(_0x5562e8,_0x1cee6a){_0x1cee6a=_0x1cee6a||0xc8;return function(_0x429c47){if(_0x429c47){return _0x5562e8[_0x19a0('0x1a')](_0x1cee6a)['json'](_0x429c47);}};}function respondWithFilteredResult(_0x195665,_0xb2c84c){return function(_0x2e8942){if(_0x2e8942){var _0xa2a430=_0x2e8942['count'],_0x5d2d8d=_0xb2c84c[_0x19a0('0x1c')],_0x46614f=_0xb2c84c[_0x19a0('0x1c')]+_0xb2c84c[_0x19a0('0x1d')],_0x2ef32a;if(_0x46614f>=_0xa2a430){_0x46614f=_0xa2a430;_0x2ef32a=0xc8;}else{_0x2ef32a=0xce;}_0x195665['status'](_0x2ef32a);return _0x195665[_0x19a0('0x1e')]('Content-Range',_0x5d2d8d+'-'+_0x46614f+'/'+_0xa2a430)[_0x19a0('0x1f')](_0x2e8942);}return null;};}function patchUpdates(_0x2d866f){return function(_0x4e462d){try{jsonpatch[_0x19a0('0x20')](_0x4e462d,_0x2d866f,!![]);}catch(_0x2174e4){return BPromise[_0x19a0('0x21')](_0x2174e4);}return _0x4e462d[_0x19a0('0x22')]();};}function saveUpdates(_0x306780,_0x5c6006){return function(_0x169bca){if(_0x169bca){return _0x169bca[_0x19a0('0x23')](_0x306780)[_0x19a0('0x24')](function(_0x4c73a4){return _0x4c73a4;});}return null;};}function removeEntity(_0x3d227e,_0x3c747a){return function(_0x3d9ee9){if(_0x3d9ee9){return _0x3d9ee9[_0x19a0('0x25')]()[_0x19a0('0x24')](function(){_0x3d227e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e1186,_0x430d57){return function(_0x5d13b8){if(!_0x5d13b8){_0x5e1186[_0x19a0('0x19')](0x194);}return _0x5d13b8;};}function handleError(_0x5420ff,_0x2a5391){_0x2a5391=_0x2a5391||0x1f4;return function(_0x2ae650){logger[_0x19a0('0x26')](_0x2ae650[_0x19a0('0x27')]);if(_0x2ae650[_0x19a0('0x28')]){delete _0x2ae650['name'];}_0x5420ff[_0x19a0('0x1a')](_0x2a5391)['send'](_0x2ae650);};}exports[_0x19a0('0x29')]=function(_0x357842,_0x56653d){var _0x3f984e={},_0x5f3217={},_0x448719={'count':0x0,'rows':[]};var _0x32adbc=_[_0x19a0('0x2a')](db[_0x19a0('0x2b')][_0x19a0('0x2c')],function(_0x233a94){return{'name':_0x233a94[_0x19a0('0x2d')],'type':_0x233a94[_0x19a0('0x2e')]['key']};});_0x5f3217[_0x19a0('0x2f')]=_[_0x19a0('0x2a')](_0x32adbc,_0x19a0('0x28'));_0x5f3217['query']=_[_0x19a0('0x30')](_0x357842[_0x19a0('0x31')]);_0x5f3217[_0x19a0('0x32')]=_['intersection'](_0x5f3217[_0x19a0('0x2f')],_0x5f3217[_0x19a0('0x31')]);_0x3f984e[_0x19a0('0x33')]=_[_0x19a0('0x34')](_0x5f3217[_0x19a0('0x2f')],qs['fields'](_0x357842[_0x19a0('0x31')][_0x19a0('0x35')]));_0x3f984e['attributes']=_0x3f984e[_0x19a0('0x33')][_0x19a0('0x36')]?_0x3f984e[_0x19a0('0x33')]:_0x5f3217[_0x19a0('0x2f')];if(!_0x357842[_0x19a0('0x31')]['hasOwnProperty']('nolimit')){_0x3f984e['limit']=qs[_0x19a0('0x1d')](_0x357842[_0x19a0('0x31')][_0x19a0('0x1d')]);_0x3f984e['offset']=qs[_0x19a0('0x1c')](_0x357842[_0x19a0('0x31')][_0x19a0('0x1c')]);}_0x3f984e[_0x19a0('0x37')]=qs[_0x19a0('0x38')](_0x357842['query'][_0x19a0('0x38')]);_0x3f984e[_0x19a0('0x39')]=qs[_0x19a0('0x32')](_[_0x19a0('0x3a')](_0x357842['query'],_0x5f3217[_0x19a0('0x32')]),_0x32adbc);if(_0x357842[_0x19a0('0x31')]['filter']){_0x3f984e['where']=_[_0x19a0('0x3b')](_0x3f984e['where'],{'$or':_[_0x19a0('0x2a')](_0x32adbc,function(_0x1a6ac1){if(_0x1a6ac1['type']!==_0x19a0('0x3c')){var _0x4a228b={};_0x4a228b[_0x1a6ac1[_0x19a0('0x28')]]={'$like':'%'+_0x357842[_0x19a0('0x31')][_0x19a0('0x3d')]+'%'};return _0x4a228b;}})});}_0x3f984e=_['merge']({},_0x3f984e,_0x357842['options']);var _0x435c34={'where':_0x3f984e['where']};return db[_0x19a0('0x2b')][_0x19a0('0x3e')](_0x435c34)['then'](function(_0x4282eb){_0x448719[_0x19a0('0x3e')]=_0x4282eb;if(_0x357842['query']['includeAll']){_0x3f984e['include']=[{'all':!![]}];}return db[_0x19a0('0x2b')][_0x19a0('0x3f')](_0x3f984e);})[_0x19a0('0x24')](function(_0x48c2ba){_0x448719[_0x19a0('0x40')]=_0x48c2ba;return _0x448719;})[_0x19a0('0x24')](respondWithFilteredResult(_0x56653d,_0x3f984e))['catch'](handleError(_0x56653d,null));};exports[_0x19a0('0x41')]=function(_0x401533,_0x5bf487){var _0x64a15={'raw':!![],'where':{'id':_0x401533['params']['id']}},_0xeb36cc={};_0xeb36cc['model']=_[_0x19a0('0x30')](db[_0x19a0('0x2b')][_0x19a0('0x2c')]);_0xeb36cc['query']=_[_0x19a0('0x30')](_0x401533[_0x19a0('0x31')]);_0xeb36cc['filters']=_[_0x19a0('0x34')](_0xeb36cc[_0x19a0('0x2f')],_0xeb36cc[_0x19a0('0x31')]);_0x64a15[_0x19a0('0x33')]=_[_0x19a0('0x34')](_0xeb36cc['model'],qs[_0x19a0('0x35')](_0x401533[_0x19a0('0x31')][_0x19a0('0x35')]));_0x64a15[_0x19a0('0x33')]=_0x64a15['attributes'][_0x19a0('0x36')]?_0x64a15[_0x19a0('0x33')]:_0xeb36cc[_0x19a0('0x2f')];if(_0x401533['query'][_0x19a0('0x42')]){_0x64a15[_0x19a0('0x43')]=[{'all':!![]}];}_0x64a15=_['merge']({},_0x64a15,_0x401533[_0x19a0('0x44')]);return db[_0x19a0('0x2b')][_0x19a0('0x45')](_0x64a15)['then'](handleEntityNotFound(_0x5bf487,null))[_0x19a0('0x24')](respondWithResult(_0x5bf487,null))[_0x19a0('0x46')](handleError(_0x5bf487,null));};exports[_0x19a0('0x47')]=function(_0x438227,_0x5315eb){return db[_0x19a0('0x2b')][_0x19a0('0x47')](_0x438227[_0x19a0('0x48')],{})['then'](respondWithResult(_0x5315eb,0xc9))[_0x19a0('0x46')](handleError(_0x5315eb,null));};exports[_0x19a0('0x23')]=function(_0x1ba18a,_0x195cba){if(_0x1ba18a[_0x19a0('0x48')]['id']){delete _0x1ba18a[_0x19a0('0x48')]['id'];}return db['WhatsappTransferReport'][_0x19a0('0x45')]({'where':{'id':_0x1ba18a[_0x19a0('0x49')]['id']}})['then'](handleEntityNotFound(_0x195cba,null))[_0x19a0('0x24')](saveUpdates(_0x1ba18a[_0x19a0('0x48')],null))[_0x19a0('0x24')](respondWithResult(_0x195cba,null))[_0x19a0('0x46')](handleError(_0x195cba,null));};exports[_0x19a0('0x25')]=function(_0x340410,_0x3004e8){return db[_0x19a0('0x2b')][_0x19a0('0x45')]({'where':{'id':_0x340410[_0x19a0('0x49')]['id']}})['then'](handleEntityNotFound(_0x3004e8,null))['then'](removeEntity(_0x3004e8,null))[_0x19a0('0x46')](handleError(_0x3004e8,null));};exports[_0x19a0('0x4a')]=function(_0x598c98,_0x4f4aaf){return db['WhatsappTransferReport'][_0x19a0('0x4a')]()['then'](respondWithResult(_0x4f4aaf,null))[_0x19a0('0x46')](handleError(_0x4f4aaf,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 29228ea..90762e9 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 _0x98ae=['../../config/environment','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x98ae,0x75));var _0xe98a=function(_0x38895d,_0xfb2fae){_0x38895d=_0x38895d-0x0;var _0x1b8911=_0x98ae[_0x38895d];return _0x1b8911;};'use strict';var _=require(_0xe98a('0x0'));var util=require(_0xe98a('0x1'));var logger=require(_0xe98a('0x2'))(_0xe98a('0x3'));var moment=require(_0xe98a('0x4'));var BPromise=require(_0xe98a('0x5'));var rp=require(_0xe98a('0x6'));var fs=require('fs');var path=require(_0xe98a('0x7'));var rimraf=require(_0xe98a('0x8'));var config=require(_0xe98a('0x9'));var attributes=require(_0xe98a('0xa'));module['exports']=function(_0x3be752,_0x2422cf){return _0x3be752['define'](_0xe98a('0xb'),attributes,{'tableName':_0xe98a('0xc'),'paranoid':![],'indexes':[{'name':_0xe98a('0xd'),'fields':[_0xe98a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xebf3=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x1de38f,_0x5da597){var _0x3a053f=function(_0x1ee8da){while(--_0x1ee8da){_0x1de38f['push'](_0x1de38f['shift']());}};_0x3a053f(++_0x5da597);}(_0xebf3,0xef));var _0x3ebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ebf('0x0'));var util=require(_0x3ebf('0x1'));var logger=require(_0x3ebf('0x2'))(_0x3ebf('0x3'));var moment=require(_0x3ebf('0x4'));var BPromise=require('bluebird');var rp=require(_0x3ebf('0x5'));var fs=require('fs');var path=require(_0x3ebf('0x6'));var rimraf=require(_0x3ebf('0x7'));var config=require(_0x3ebf('0x8'));var attributes=require(_0x3ebf('0x9'));module[_0x3ebf('0xa')]=function(_0x3a4a4f,_0x1b9615){return _0x3a4a4f['define'](_0x3ebf('0xb'),attributes,{'tableName':_0x3ebf('0xc'),'paranoid':![],'indexes':[{'name':_0x3ebf('0xd'),'fields':[_0x3ebf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 8b1438d..598e5df 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(_0x4f4c9e,_0x72aebd){var _0x1324ac=function(_0x191346){while(--_0x191346){_0x4f4c9e['push'](_0x4f4c9e['shift']());}};_0x1324ac(++_0x72aebd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x577e3c,_0x5a51bb){var _0x2edfb3=function(_0x3c2dc5){while(--_0x3c2dc5){_0x577e3c['push'](_0x577e3c['shift']());}};_0x2edfb3(++_0x5a51bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 504d4a2..77259a6 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9da2=['./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/transcribe','sequelize','sync','then','start','info','filter','online','name','join','map','status','None','./config/seedDB','default','./config/license','error','exit','lodash'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x9da2,0xd7));var _0x29da=function(_0x53174f,_0x986a3b){_0x53174f=_0x53174f-0x0;var _0x1cbd1c=_0x9da2[_0x53174f];return _0x1cbd1c;};'use strict';var _=require(_0x29da('0x0'));var mysqldb=require(_0x29da('0x1'));var rpc=require(_0x29da('0x2'));var config=require(_0x29da('0x3'));var logger=require(_0x29da('0x4'))(_0x29da('0x5'));var pm2=require(_0x29da('0x6'));var pm2Config=require(_0x29da('0x7'));var schedule=require(_0x29da('0x8'));var chat=require('./config/schedule/chat');var transcribe=require(_0x29da('0x9'));function main(){return mysqldb['db'][_0x29da('0xa')][_0x29da('0xb')]()[_0x29da('0xc')](function(){return rpc['listen']();})[_0x29da('0xc')](function(_0x4a4825){logger['info'](_0x4a4825);return chat[_0x29da('0xd')]();})['then'](function(){return schedule[_0x29da('0xd')]();})[_0x29da('0xc')](function(){return transcribe[_0x29da('0xd')]();})[_0x29da('0xc')](function(_0x2c4c47){logger[_0x29da('0xe')](_0x2c4c47);return pm2[_0x29da('0xd')](pm2Config);})[_0x29da('0xc')](function(_0x46546c){logger[_0x29da('0xe')]('Online\x20apps:',_['map'](_[_0x29da('0xf')](_0x46546c,{'status':_0x29da('0x10')}),_0x29da('0x11'))[_0x29da('0x12')]());logger['info']('Offline\x20apps:',_[_0x29da('0x13')](_[_0x29da('0xf')](_0x46546c,function(_0x58b393){return _0x58b393[_0x29da('0x14')]!==_0x29da('0x10');}),_0x29da('0x11'))[_0x29da('0x12')]()||_0x29da('0x15'));config['seedDB']&&require(_0x29da('0x16'))[_0x29da('0x17')]();require(_0x29da('0x18'))[_0x29da('0x17')]();})['catch'](function(_0x149931){logger[_0x29da('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x149931);process[_0x29da('0x1a')](0x1);});}main(); \ No newline at end of file +var _0xd27d=['./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','None','./config/license','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment'];(function(_0x1e76be,_0x24ee32){var _0x519556=function(_0x3bff62){while(--_0x3bff62){_0x1e76be['push'](_0x1e76be['shift']());}};_0x519556(++_0x24ee32);}(_0xd27d,0x71));var _0xdd27=function(_0x459879,_0x16b25d){_0x459879=_0x459879-0x0;var _0xa84228=_0xd27d[_0x459879];return _0xa84228;};'use strict';var _=require('lodash');var mysqldb=require(_0xdd27('0x0'));var rpc=require(_0xdd27('0x1'));var config=require(_0xdd27('0x2'));var logger=require(_0xdd27('0x3'))(_0xdd27('0x4'));var pm2=require(_0xdd27('0x5'));var pm2Config=require(_0xdd27('0x6'));var schedule=require(_0xdd27('0x7'));var chat=require(_0xdd27('0x8'));var transcribe=require(_0xdd27('0x9'));function main(){return mysqldb['db']['sequelize']['sync']()[_0xdd27('0xa')](function(){return rpc[_0xdd27('0xb')]();})[_0xdd27('0xa')](function(_0x1285e8){logger[_0xdd27('0xc')](_0x1285e8);return chat[_0xdd27('0xd')]();})[_0xdd27('0xa')](function(){return schedule[_0xdd27('0xd')]();})[_0xdd27('0xa')](function(){return transcribe[_0xdd27('0xd')]();})[_0xdd27('0xa')](function(_0x3aa426){logger[_0xdd27('0xc')](_0x3aa426);return pm2[_0xdd27('0xd')](pm2Config);})['then'](function(_0x2eed14){logger[_0xdd27('0xc')](_0xdd27('0xe'),_[_0xdd27('0xf')](_[_0xdd27('0x10')](_0x2eed14,{'status':_0xdd27('0x11')}),_0xdd27('0x12'))[_0xdd27('0x13')]());logger[_0xdd27('0xc')](_0xdd27('0x14'),_[_0xdd27('0xf')](_['filter'](_0x2eed14,function(_0x29d45b){return _0x29d45b[_0xdd27('0x15')]!==_0xdd27('0x11');}),_0xdd27('0x12'))[_0xdd27('0x13')]()||_0xdd27('0x16'));config['seedDB']&&require('./config/seedDB')['default']();require(_0xdd27('0x17'))[_0xdd27('0x18')]();})[_0xdd27('0x19')](function(_0x21b75a){logger[_0xdd27('0x1a')](_0xdd27('0x1b'),_0x21b75a);process[_0xdd27('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1c15564..1799311 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 _0x225e=['isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','secret','payload','verify','randomBytes','toString','now','HS512','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','secrets','session','role','fullname','name','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','status','json','Forbidden.','catch','headers','startsWith','authorization','User','find','authenticate','pass','Wrong\x20credentials.','Bearer','apikey','getUuid','query','sub','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','getLicense','update','Forbidden'];(function(_0x46a394,_0x2026fb){var _0x51e7e5=function(_0x1a99eb){while(--_0x1a99eb){_0x46a394['push'](_0x46a394['shift']());}};_0x51e7e5(++_0x2026fb);}(_0x225e,0x19a));var _0xe225=function(_0x1aa38d,_0x14f873){_0x1aa38d=_0x1aa38d-0x0;var _0x43808e=_0x225e[_0x1aa38d];return _0x43808e;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0xe225('0x0'));var _=require(_0xe225('0x1'));var jwt=require(_0xe225('0x2'));var expressJwt=require(_0xe225('0x3'));var compose=require(_0xe225('0x4'));var basicAuth=require('basic-auth');var crypto=require(_0xe225('0x5'));var BPromise=require(_0xe225('0x6'));var validateJwt=expressJwt({'secret':config[_0xe225('0x7')][_0xe225('0x8')]});var userAttributes=['id',_0xe225('0x9'),_0xe225('0xa'),_0xe225('0xb'),_0xe225('0xc'),_0xe225('0xd'),'userpic','permissions',_0xe225('0xe'),_0xe225('0xf'),_0xe225('0x10'),_0xe225('0x11'),_0xe225('0x12'),_0xe225('0x13'),_0xe225('0x14'),'pauseType','showWebBar',_0xe225('0x15'),_0xe225('0x16'),_0xe225('0x17'),_0xe225('0x18'),_0xe225('0x19'),_0xe225('0x1a'),_0xe225('0x1b'),'phoneBarAutoAnswerDelay',_0xe225('0x1c'),_0xe225('0x1d'),_0xe225('0x1e'),_0xe225('0x1f'),_0xe225('0x20'),_0xe225('0x21'),_0xe225('0x22'),_0xe225('0x23'),_0xe225('0x24'),_0xe225('0x25'),'userProfileId'];exports[_0xe225('0x26')]=function(){return this[_0xe225('0x27')](!![])[_0xe225('0x28')](function(_0x238ef2,_0x3eb89e,_0x2000fd){if(_0x238ef2[_0xe225('0x29')]){_0x2000fd();}else{return db[_0xe225('0x2a')]['findOne']({'where':{'id':_0x238ef2[_0xe225('0x2b')]['id']},'attributes':['id',_0xe225('0x2c'),_0xe225('0x2d')],'raw':!![]})[_0xe225('0x2e')](function(_0x5e3916){if(_0x5e3916&&_0x5e3916[_0xe225('0x2c')]){return _0x3eb89e[_0xe225('0x2f')](_0x5e3916[_0xe225('0x2d')]==='unmanaged'?0x195:0x193)[_0xe225('0x30')]({'message':_0x5e3916[_0xe225('0x2d')]==='unmanaged'?'Unmanaged.':_0xe225('0x31')});}else{_0x2000fd();}})[_0xe225('0x32')](function(_0x3a8717){_0x2000fd(_0x3a8717);});}});};exports['isAuthenticated']=function isAuthenticated(_0x26815e){return compose()[_0xe225('0x28')](function(_0x42e385,_0x4e9d05,_0x45d8a9){if(_0x42e385[_0xe225('0x33')]['authorization']){if(_[_0xe225('0x34')](_0x42e385['headers'][_0xe225('0x35')],'Basic')){var _0x4f781f=basicAuth(_0x42e385);db[_0xe225('0x36')][_0xe225('0x37')]({'where':{'name':_0x4f781f['name']}})['then'](function(_0x32a77c){if(!_0x32a77c||!_0x32a77c[_0xe225('0x38')](_0x4f781f[_0xe225('0x39')])){return _0x4e9d05['status'](0x191)[_0xe225('0x30')]({'message':_0xe225('0x3a')});}_0x42e385[_0xe225('0x29')]={'id':_0x32a77c['id']};_0x45d8a9();})['catch'](function(_0x5f28f0){_0x45d8a9(_0x5f28f0);});}else if(_[_0xe225('0x34')](_0x42e385['headers'][_0xe225('0x35')],_0xe225('0x3b'))){validateJwt(_0x42e385,_0x4e9d05,_0x45d8a9);}else{if(_0x26815e){_0x45d8a9();}else{return _0x4e9d05['status'](0x193)[_0xe225('0x30')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x42e385['query'][_0xe225('0x3c')]){try{var _0x37be53={'audience':hardwareConf[_0xe225('0x3d')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x42e385[_0xe225('0x3e')]['apikey'],_0x37be53)['then'](function(_0x1bbcc7){return db[_0xe225('0x36')][_0xe225('0x37')]({'where':{'id':_0x1bbcc7[_0xe225('0x3f')]}})[_0xe225('0x2e')](function(_0x116002){if(!_0x116002||!_[_0xe225('0x40')](_0x116002[_0xe225('0x41')],_0x1bbcc7[_0xe225('0x42')])){return _0x4e9d05['status'](0x191)[_0xe225('0x30')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x42e385['user']={'id':_0x116002['id']};_0x45d8a9();});})[_0xe225('0x32')](function(){return _0x4e9d05['status'](0x191)[_0xe225('0x30')]({'message':_0xe225('0x43')});});}catch(_0x41fbf9){_0x45d8a9(_0x41fbf9);}}else if(_0x26815e){_0x45d8a9();}else{return _0x4e9d05[_0xe225('0x2f')](0x193)[_0xe225('0x30')]({'message':_0xe225('0x44')});}})[_0xe225('0x28')](function(_0x47e75a,_0x4ad630,_0x2f2452){if(_0x47e75a[_0xe225('0x29')]){db['User'][_0xe225('0x37')]({'where':{'id':_0x47e75a[_0xe225('0x29')]['id']},'attributes':userAttributes})['then'](function(_0x265f95){if(!_0x265f95){return _0x4ad630[_0xe225('0x2f')](0x194)[_0xe225('0x30')]({'message':_0xe225('0x45')});}_0x47e75a['user']=_0x265f95;_0x2f2452();})[_0xe225('0x32')](function(_0x167fe2){_0x2f2452(_0x167fe2);});}else if(_0x26815e){_0x2f2452();}else{return _0x4ad630[_0xe225('0x2f')](0x194)[_0xe225('0x30')]({'message':_0xe225('0x46')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x4360a6,_0x261426,_0x4b251f){return require(_0xe225('0x47'))[_0xe225('0x48')]()[_0xe225('0x2e')](function(_0x742307){if(_0x742307[_0xe225('0x49')]){_0x4b251f();}else{return _0x261426[_0xe225('0x2f')](0x193)[_0xe225('0x30')]({'message':_0xe225('0x4a')});}})[_0xe225('0x32')](function(_0x287413){_0x4b251f(_0x287413);});});};exports['isMiddleware']=function(_0x4e69e9,_0x1e59d9,_0x4a4864){_0x4e69e9[_0xe225('0x4b')]=!![];return _0x4a4864();};exports[_0xe225('0x4c')]=function signToken(_0x121a8a){return signJwt(_0x121a8a);};exports['setTokenCookie']=function(_0x2aef4d,_0x2646e5){if(!_0x2aef4d['user']){return _0x2646e5[_0xe225('0x2f')](0x194)['json']({'message':_0xe225('0x4d')});}var _0x3a7b80={'payload':{'id':_0x2aef4d['user']['id'],'role':_0x2aef4d['user'][_0xe225('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3a7b80)[_0xe225('0x2e')](function(_0x9d719f){_0x2646e5[_0xe225('0x4e')](_0xe225('0x4f'),_0x9d719f);_0x2646e5[_0xe225('0x50')](_0xe225('0x51'));})['catch'](function(_0x1aadbd){return _0x2646e5['status'](0x1f4)[_0xe225('0x52')](_0x1aadbd);});};exports[_0xe225('0x53')]=function(_0x1753f4){if(_[_0xe225('0x54')](_0x1753f4[_0xe225('0x41')])||_['isNil'](_0x1753f4['apiKeyIat'])){return null;}else{return createJwt(_0x1753f4);}};exports[_0xe225('0x55')]=function(_0x3c58c1){_0x3c58c1[_0xe225('0x41')]=generateNonce();_0x3c58c1[_0xe225('0x56')]=generateIssuedAt();return createJwt(_0x3c58c1);};exports[_0xe225('0x57')]=function(_0x53c19d,_0x4b704c){var _0x947e76=_0x53c19d['query'][_0xe225('0x3c')];if(_0x947e76){var _0xbf644d={'nonce':_0x4b704c[_0xe225('0x41')],'iat':_0x4b704c[_0xe225('0x56')],'audience':hardwareConf[_0xe225('0x3d')](),'issuer':hardwareConf[_0xe225('0x3d')]()};return verifyJwt(_0x947e76,_0xbf644d)[_0xe225('0x2e')](function(){return generateApiKey(_0x4b704c);});}else{throw{'message':_0xe225('0x58')};}};function signJwt(_0x4738b3){var _0x2ec369=BPromise[_0xe225('0x59')](jwt['sign'],{'context':jwt});var _0x2309cd=_0x4738b3[_0xe225('0x5a')]||config[_0xe225('0x7')][_0xe225('0x8')];return new BPromise(function(_0x2d4320,_0x5759c5){_0x2ec369(_0x4738b3[_0xe225('0x5b')],_0x2309cd,_0x4738b3['options'])[_0xe225('0x2e')](function(_0x4169f1){_0x2d4320(_0x4169f1);})[_0xe225('0x32')](function(_0x4cd25a){_0x5759c5(_0x4cd25a);});});}function verifyJwt(_0x30e349,_0x4e513d,_0x213fc){var _0x45ca8b=BPromise[_0xe225('0x59')](jwt[_0xe225('0x5c')],{'context':jwt});var _0x54c60a=_0x213fc||config[_0xe225('0x7')][_0xe225('0x8')];return new BPromise(function(_0x569879,_0x31f7d0){_0x45ca8b(_0x30e349,_0x54c60a,_0x4e513d)[_0xe225('0x2e')](function(_0x5d3fa2){_0x569879(_0x5d3fa2);})[_0xe225('0x32')](function(_0x456f1b){_0x31f7d0(_0x456f1b);});});}function generateNonce(){return crypto[_0xe225('0x5d')](0x10)[_0xe225('0x5e')]('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xe225('0x5f')]()/0x3e8)['toString']();}function createJwt(_0x17e289){var _0x181c3a={'payload':{'iat':_0x17e289[_0xe225('0x56')],'nonce':_0x17e289[_0xe225('0x41')]},'options':{'algorithm':_0xe225('0x60'),'subject':_0x17e289['id'][_0xe225('0x5e')](),'issuer':hardwareConf[_0xe225('0x3d')](),'audience':hardwareConf[_0xe225('0x3d')]()}};return signJwt(_0x181c3a)['then'](function(_0x11db11){return{'iat':_0x17e289[_0xe225('0x56')],'nonce':_0x17e289[_0xe225('0x41')],'token':_0x11db11};});} \ No newline at end of file +var _0x6a9b=['phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','status','json','unmanaged','Forbidden.','headers','startsWith','authorization','Basic','User','find','pass','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','then','sub','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','Forbidden','isMiddleware','signToken','cookie','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','options','verify','toString','hex','floor','now','HS512','../../mysqldb','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires'];(function(_0x18c08a,_0x46e340){var _0x388429=function(_0x27d239){while(--_0x27d239){_0x18c08a['push'](_0x18c08a['shift']());}};_0x388429(++_0x46e340);}(_0x6a9b,0x97));var _0xb6a9=function(_0x2d1f6f,_0x239dec){_0x2d1f6f=_0x2d1f6f-0x0;var _0x2b8c80=_0x6a9b[_0x2d1f6f];return _0x2b8c80;};'use strict';var db=require(_0xb6a9('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var _=require(_0xb6a9('0x1'));var jwt=require(_0xb6a9('0x2'));var expressJwt=require(_0xb6a9('0x3'));var compose=require(_0xb6a9('0x4'));var basicAuth=require(_0xb6a9('0x5'));var crypto=require(_0xb6a9('0x6'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0xb6a9('0x7')][_0xb6a9('0x8')]});var userAttributes=['id',_0xb6a9('0x9'),_0xb6a9('0xa'),_0xb6a9('0xb'),_0xb6a9('0xc'),_0xb6a9('0xd'),_0xb6a9('0xe'),_0xb6a9('0xf'),_0xb6a9('0x10'),'voicePause',_0xb6a9('0x11'),_0xb6a9('0x12'),_0xb6a9('0x13'),_0xb6a9('0x14'),_0xb6a9('0x15'),_0xb6a9('0x16'),_0xb6a9('0x17'),'lastLoginAt','lastPauseAt',_0xb6a9('0x18'),'allowmessenger',_0xb6a9('0x19'),_0xb6a9('0x1a'),_0xb6a9('0x1b'),_0xb6a9('0x1c'),_0xb6a9('0x1d'),_0xb6a9('0x1e'),'phoneBarEnableDtmfTone',_0xb6a9('0x1f'),_0xb6a9('0x20'),_0xb6a9('0x21'),_0xb6a9('0x22'),_0xb6a9('0x23'),_0xb6a9('0x24'),_0xb6a9('0x25'),'userProfileId'];exports[_0xb6a9('0x26')]=function(){return this[_0xb6a9('0x27')](!![])[_0xb6a9('0x28')](function(_0x29204f,_0x239aa3,_0x348bb8){if(_0x29204f[_0xb6a9('0x29')]){_0x348bb8();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x29204f[_0xb6a9('0x2a')]['id']},'attributes':['id',_0xb6a9('0x2b'),'disposition'],'raw':!![]})['then'](function(_0x718cbb){if(_0x718cbb&&_0x718cbb[_0xb6a9('0x2b')]){return _0x239aa3[_0xb6a9('0x2c')](_0x718cbb['disposition']==='unmanaged'?0x195:0x193)[_0xb6a9('0x2d')]({'message':_0x718cbb['disposition']===_0xb6a9('0x2e')?'Unmanaged.':_0xb6a9('0x2f')});}else{_0x348bb8();}})['catch'](function(_0x16538f){_0x348bb8(_0x16538f);});}});};exports[_0xb6a9('0x27')]=function isAuthenticated(_0xc8da1f){return compose()['use'](function(_0x22f04f,_0x41e186,_0x47e5c3){if(_0x22f04f[_0xb6a9('0x30')]['authorization']){if(_[_0xb6a9('0x31')](_0x22f04f['headers'][_0xb6a9('0x32')],_0xb6a9('0x33'))){var _0x1dafe6=basicAuth(_0x22f04f);db[_0xb6a9('0x34')][_0xb6a9('0x35')]({'where':{'name':_0x1dafe6[_0xb6a9('0xb')]}})['then'](function(_0x28d95f){if(!_0x28d95f||!_0x28d95f['authenticate'](_0x1dafe6[_0xb6a9('0x36')])){return _0x41e186[_0xb6a9('0x2c')](0x191)[_0xb6a9('0x2d')]({'message':_0xb6a9('0x37')});}_0x22f04f[_0xb6a9('0x29')]={'id':_0x28d95f['id']};_0x47e5c3();})[_0xb6a9('0x38')](function(_0x296175){_0x47e5c3(_0x296175);});}else if(_['startsWith'](_0x22f04f['headers'][_0xb6a9('0x32')],_0xb6a9('0x39'))){validateJwt(_0x22f04f,_0x41e186,_0x47e5c3);}else{if(_0xc8da1f){_0x47e5c3();}else{return _0x41e186['status'](0x193)[_0xb6a9('0x2d')]({'message':_0xb6a9('0x3a')});}}}else if(_0x22f04f[_0xb6a9('0x3b')]['apikey']){try{var _0x3e35b1={'audience':hardwareConf[_0xb6a9('0x3c')](),'issuer':hardwareConf[_0xb6a9('0x3c')]()};verifyJwt(_0x22f04f[_0xb6a9('0x3b')][_0xb6a9('0x3d')],_0x3e35b1)[_0xb6a9('0x3e')](function(_0x518caa){return db[_0xb6a9('0x34')][_0xb6a9('0x35')]({'where':{'id':_0x518caa[_0xb6a9('0x3f')]}})[_0xb6a9('0x3e')](function(_0xaf0ba3){if(!_0xaf0ba3||!_[_0xb6a9('0x40')](_0xaf0ba3[_0xb6a9('0x41')],_0x518caa['nonce'])){return _0x41e186[_0xb6a9('0x2c')](0x191)[_0xb6a9('0x2d')]({'message':_0xb6a9('0x42')});}_0x22f04f['user']={'id':_0xaf0ba3['id']};_0x47e5c3();});})['catch'](function(){return _0x41e186['status'](0x191)[_0xb6a9('0x2d')]({'message':_0xb6a9('0x43')});});}catch(_0x34973f){_0x47e5c3(_0x34973f);}}else if(_0xc8da1f){_0x47e5c3();}else{return _0x41e186[_0xb6a9('0x2c')](0x193)[_0xb6a9('0x2d')]({'message':_0xb6a9('0x3a')});}})[_0xb6a9('0x28')](function(_0x2130e3,_0x1acc47,_0x83c725){if(_0x2130e3['user']){db['User']['find']({'where':{'id':_0x2130e3[_0xb6a9('0x29')]['id']},'attributes':userAttributes})[_0xb6a9('0x3e')](function(_0x137ec2){if(!_0x137ec2){return _0x1acc47[_0xb6a9('0x2c')](0x194)[_0xb6a9('0x2d')]({'message':_0xb6a9('0x44')});}_0x2130e3['user']=_0x137ec2;_0x83c725();})['catch'](function(_0x3455bd){_0x83c725(_0x3455bd);});}else if(_0xc8da1f){_0x83c725();}else{return _0x1acc47[_0xb6a9('0x2c')](0x194)[_0xb6a9('0x2d')]({'message':_0xb6a9('0x45')});}});};exports[_0xb6a9('0x46')]=function canUpdate(){return compose()[_0xb6a9('0x28')](function(_0x2231f9,_0x12ca82,_0x3b64d2){return require(_0xb6a9('0x47'))['getLicense']()[_0xb6a9('0x3e')](function(_0x28b6d1){if(_0x28b6d1['update']){_0x3b64d2();}else{return _0x12ca82[_0xb6a9('0x2c')](0x193)['json']({'message':_0xb6a9('0x48')});}})[_0xb6a9('0x38')](function(_0x94b9b5){_0x3b64d2(_0x94b9b5);});});};exports[_0xb6a9('0x49')]=function(_0x5ae362,_0x1fde14,_0xb1640c){_0x5ae362['isMiddleware']=!![];return _0xb1640c();};exports[_0xb6a9('0x4a')]=function signToken(_0x5e974d){return signJwt(_0x5e974d);};exports['setTokenCookie']=function(_0x1e527c,_0x2408d5){if(!_0x1e527c[_0xb6a9('0x29')]){return _0x2408d5[_0xb6a9('0x2c')](0x194)[_0xb6a9('0x2d')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x789ce4={'payload':{'id':_0x1e527c['user']['id'],'role':_0x1e527c[_0xb6a9('0x29')][_0xb6a9('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x789ce4)[_0xb6a9('0x3e')](function(_0x459675){_0x2408d5[_0xb6a9('0x4b')]('motion.token',_0x459675);_0x2408d5['redirect']('/dashboards/general');})['catch'](function(_0x3cd523){return _0x2408d5[_0xb6a9('0x2c')](0x1f4)['send'](_0x3cd523);});};exports[_0xb6a9('0x4c')]=function(_0x264110){if(_[_0xb6a9('0x4d')](_0x264110[_0xb6a9('0x41')])||_['isNil'](_0x264110[_0xb6a9('0x4e')])){return null;}else{return createJwt(_0x264110);}};exports[_0xb6a9('0x4f')]=function(_0x462a1b){_0x462a1b[_0xb6a9('0x41')]=generateNonce();_0x462a1b[_0xb6a9('0x4e')]=generateIssuedAt();return createJwt(_0x462a1b);};exports[_0xb6a9('0x50')]=function(_0x1a0e76,_0x5e5b29){var _0x1408f8=_0x1a0e76['query'][_0xb6a9('0x3d')];if(_0x1408f8){var _0xefdbd5={'nonce':_0x5e5b29[_0xb6a9('0x41')],'iat':_0x5e5b29['apiKeyIat'],'audience':hardwareConf[_0xb6a9('0x3c')](),'issuer':hardwareConf[_0xb6a9('0x3c')]()};return verifyJwt(_0x1408f8,_0xefdbd5)[_0xb6a9('0x3e')](function(){return generateApiKey(_0x5e5b29);});}else{throw{'message':_0xb6a9('0x51')};}};function signJwt(_0x1495bb){var _0x458f95=BPromise[_0xb6a9('0x52')](jwt[_0xb6a9('0x53')],{'context':jwt});var _0x5ea92d=_0x1495bb[_0xb6a9('0x54')]||config['secrets'][_0xb6a9('0x8')];return new BPromise(function(_0x336304,_0x45fa77){_0x458f95(_0x1495bb['payload'],_0x5ea92d,_0x1495bb[_0xb6a9('0x55')])['then'](function(_0x538c31){_0x336304(_0x538c31);})[_0xb6a9('0x38')](function(_0x1ce246){_0x45fa77(_0x1ce246);});});}function verifyJwt(_0x326849,_0x2f11db,_0x2867ae){var _0x2ebe15=BPromise[_0xb6a9('0x52')](jwt[_0xb6a9('0x56')],{'context':jwt});var _0x1206ec=_0x2867ae||config[_0xb6a9('0x7')]['session'];return new BPromise(function(_0x1cf25a,_0x5e79bc){_0x2ebe15(_0x326849,_0x1206ec,_0x2f11db)[_0xb6a9('0x3e')](function(_0x5cd003){_0x1cf25a(_0x5cd003);})[_0xb6a9('0x38')](function(_0x5a686c){_0x5e79bc(_0x5a686c);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb6a9('0x57')](_0xb6a9('0x58'));}function generateIssuedAt(){return Math[_0xb6a9('0x59')](Date[_0xb6a9('0x5a')]()/0x3e8)[_0xb6a9('0x57')]();}function createJwt(_0x4f8ba){var _0x583de8={'payload':{'iat':_0x4f8ba[_0xb6a9('0x4e')],'nonce':_0x4f8ba['apiKeyNonce']},'options':{'algorithm':_0xb6a9('0x5b'),'subject':_0x4f8ba['id'][_0xb6a9('0x57')](),'issuer':hardwareConf[_0xb6a9('0x3c')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x583de8)[_0xb6a9('0x3e')](function(_0xd741a7){return{'iat':_0x4f8ba[_0xb6a9('0x4e')],'nonce':_0x4f8ba[_0xb6a9('0x41')],'token':_0xd741a7};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index c648c1c..e608bbd 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x1f4674,_0x146085){var _0x3e7f42=function(_0x4bd366){while(--_0x4bd366){_0x1f4674['push'](_0x1f4674['shift']());}};_0x3e7f42(++_0x146085);}(_0xe706,0xa3));var _0x6e70=function(_0x4c99d0,_0x1febe1){_0x4c99d0=_0x4c99d0-0x0;var _0x5e541f=_0xe706[_0x4c99d0];return _0x5e541f;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file +var _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0x3c6310,_0x13601d){var _0x320122=function(_0x596176){while(--_0x596176){_0x3c6310['push'](_0x3c6310['shift']());}};_0x320122(++_0x13601d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5a633bd..219197e 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 _0x6c76=['argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','analytics'];(function(_0x289330,_0x54f85a){var _0x22d2d0=function(_0x4bdcf9){while(--_0x4bdcf9){_0x289330['push'](_0x289330['shift']());}};_0x22d2d0(++_0x54f85a);}(_0x6c76,0x184));var _0x66c7=function(_0x961b28,_0x1fdbaa){_0x961b28=_0x961b28-0x0;var _0x477083=_0x6c76[_0x961b28];return _0x477083;};'use strict';var util=require(_0x66c7('0x0'));var path=require(_0x66c7('0x1'));var _=require(_0x66c7('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x66c7('0x3'));var zipdir=require(_0x66c7('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x66c7('0x5'))[_0x66c7('0x6')];var logger=require('../../config/logger')(_0x66c7('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x66c7('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x66c7('0x8')][0x4];function analyticExtractedReport(_0x4dffcd,_0x4fa6ce){var _0x208d06={'status':_0x4dffcd};var _0x2b0065={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fa6ce){_0x208d06[_0x66c7('0x9')]=_0x4fa6ce;}return db['AnalyticExtractedReport'][_0x66c7('0xa')](_0x208d06,_0x2b0065);}function main(){var _0xbc35d9=0x1388;var _0xf44e2;logger[_0x66c7('0xb')](util['format'](_0x66c7('0xc'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return db[_0x66c7('0xe')][_0x66c7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x66c7('0x10'),_0x66c7('0x11')]})[_0x66c7('0x12')](function(_0x5176a3){if(_0x5176a3){_0xf44e2=_0x5176a3;_0xbc35d9=_0xf44e2[_0x66c7('0x11')]||0x1388;}})[_0x66c7('0x12')](function(){return dbH[_0x66c7('0x13')][_0x66c7('0x14')](util[_0x66c7('0x15')](_0x66c7('0x16'),QUERY),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]});})['then'](function(_0x110f6d){if(!_0x110f6d[0x0]['num']){return analyticExtractedReport(_0x66c7('0x19'));}var _0x39f951=[];var _0x3c81c0=0x0;var _0x42e930=!![];if(_0x110f6d&&_0x110f6d[_0x66c7('0x1a')]){var _0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9);if(_0xf44e2['split']){for(;_0x42e930;_0x3c81c0+=_0xbc35d9,_0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9)){if(_0x4e229a==0x0||_0x4e229a==_0x110f6d[0x0][_0x66c7('0x1b')]){_0x42e930=![];}_0x39f951[_0x66c7('0x1c')](dbH['sequelize']['query'](util[_0x66c7('0x15')](_0x66c7('0x1d'),QUERY,_0xbc35d9,_0x3c81c0),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')]['SELECT']}));}}else{_0x39f951['push'](dbH[_0x66c7('0x13')][_0x66c7('0x14')](QUERY,{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]}));}}var _0x75f118=path['dirname'](PATH);var _0x4ddbd2=path[_0x66c7('0x1e')](PATH,'.csv');var _0x7462f1=_0xf44e2[_0x66c7('0x10')]&&_0x39f951[_0x66c7('0x1a')]>0x1;var _0x1fc9d3=[];if(!fs['existsSync'](path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2))&&_0x7462f1){fs[_0x66c7('0x20')](path['join'](_0x75f118,_0x4ddbd2));}return BPromise[_0x66c7('0x21')](_0x39f951,function(_0x11a6b9){_0x1fc9d3[_0x66c7('0x1c')](_0x11a6b9);})[_0x66c7('0x12')](function(){for(var _0x2af0a3=0x0;_0x2af0a3<_0x1fc9d3['length'];_0x2af0a3+=0x1){var _0x5bc4e6;var _0x4e514a=_0x1fc9d3[_0x2af0a3];if(_0x7462f1){_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2,util[_0x66c7('0x15')]('%s%d.%s',_0x4ddbd2,_0x2af0a3,_0x66c7('0x22')));}else{_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x22')));}fs[_0x66c7('0x24')](_0x5bc4e6,csv(_0x4e514a));}})['then'](function(){if(_0x7462f1){zipdir(path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2),{'saveTo':path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x25')))},function(_0x592f0e,_0x263b48){});rimraf(path['join'](_0x75f118,_0x4ddbd2),function(){});}})[_0x66c7('0x12')](function(){logger['info'](util[_0x66c7('0x15')](_0x66c7('0x26'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return analyticExtractedReport(_0x66c7('0x27'),_0x7462f1?util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x7462f1?'zip':'csv'):null);});})[_0x66c7('0x28')](function(_0x12e7c6){logger[_0x66c7('0xb')](util[_0x66c7('0x15')](_0x66c7('0x29'),EXTRACTED_REPORT_ID,_0x66c7('0xd')),util[_0x66c7('0x2a')](_0x12e7c6,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x66c7('0x2b'));});}main(); \ No newline at end of file +var _0x91a7=['push','csv','%s.%s','writeFileSync','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','path','lodash','to-csv','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.csv','length','existsSync','join','each'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0x91a7,0xe7));var _0x791a=function(_0x6c8fc3,_0x439e62){_0x6c8fc3=_0x6c8fc3-0x0;var _0x48d628=_0x91a7[_0x6c8fc3];return _0x48d628;};'use strict';var util=require('util');var path=require(_0x791a('0x0'));var _=require(_0x791a('0x1'));var csv=require(_0x791a('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x791a('0x3'));var rimraf=require('rimraf');var db=require(_0x791a('0x4'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x791a('0x5'))(_0x791a('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x791a('0x7')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x33baac,_0x159e24){var _0x5aa10a={'status':_0x33baac};var _0x1a32b4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x159e24){_0x5aa10a[_0x791a('0x8')]=_0x159e24;}return db[_0x791a('0x9')][_0x791a('0xa')](_0x5aa10a,_0x1a32b4);}function main(){var _0x266e4b=0x1388;var _0x5249d5;logger[_0x791a('0xb')](util[_0x791a('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x791a('0xd')));return db[_0x791a('0xe')][_0x791a('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x791a('0x10'),_0x791a('0x11')]})[_0x791a('0x12')](function(_0x53dc41){if(_0x53dc41){_0x5249d5=_0x53dc41;_0x266e4b=_0x5249d5['splitSizeCsv']||0x1388;}})[_0x791a('0x12')](function(){return dbH[_0x791a('0x13')]['query'](util[_0x791a('0xc')](_0x791a('0x14'),QUERY),{'type':dbH['sequelize'][_0x791a('0x15')][_0x791a('0x16')]});})[_0x791a('0x12')](function(_0x5cdf2){if(!_0x5cdf2[0x0]['num']){return analyticExtractedReport(_0x791a('0x17'));}var _0x575d11=[];var _0x43dea6=0x0;var _0x355155=!![];if(_0x5cdf2&&_0x5cdf2['length']){var _0x237adb=_0x5cdf2[0x0]['num']%(_0x43dea6+_0x266e4b);if(_0x5249d5[_0x791a('0x10')]){for(;_0x355155;_0x43dea6+=_0x266e4b,_0x237adb=_0x5cdf2[0x0]['num']%(_0x43dea6+_0x266e4b)){if(_0x237adb==0x0||_0x237adb==_0x5cdf2[0x0]['num']){_0x355155=![];}_0x575d11['push'](dbH[_0x791a('0x13')]['query'](util['format'](_0x791a('0x18'),QUERY,_0x266e4b,_0x43dea6),{'type':dbH[_0x791a('0x13')][_0x791a('0x15')][_0x791a('0x16')]}));}}else{_0x575d11['push'](dbH[_0x791a('0x13')][_0x791a('0x19')](QUERY,{'type':dbH[_0x791a('0x13')][_0x791a('0x15')]['SELECT']}));}}var _0x448085=path[_0x791a('0x1a')](PATH);var _0x25bae5=path[_0x791a('0x1b')](PATH,_0x791a('0x1c'));var _0x1091af=_0x5249d5[_0x791a('0x10')]&&_0x575d11[_0x791a('0x1d')]>0x1;var _0x323c6a=[];if(!fs[_0x791a('0x1e')](path[_0x791a('0x1f')](_0x448085,_0x25bae5))&&_0x1091af){fs['mkdirSync'](path[_0x791a('0x1f')](_0x448085,_0x25bae5));}return BPromise[_0x791a('0x20')](_0x575d11,function(_0x380329){_0x323c6a[_0x791a('0x21')](_0x380329);})['then'](function(){for(var _0x456480=0x0;_0x456480<_0x323c6a[_0x791a('0x1d')];_0x456480+=0x1){var _0x51dcca;var _0xdfa84f=_0x323c6a[_0x456480];if(_0x1091af){_0x51dcca=path[_0x791a('0x1f')](_0x448085,_0x25bae5,util[_0x791a('0xc')]('%s%d.%s',_0x25bae5,_0x456480,_0x791a('0x22')));}else{_0x51dcca=path[_0x791a('0x1f')](_0x448085,util[_0x791a('0xc')](_0x791a('0x23'),_0x25bae5,_0x791a('0x22')));}fs[_0x791a('0x24')](_0x51dcca,csv(_0xdfa84f));}})[_0x791a('0x12')](function(){if(_0x1091af){zipdir(path[_0x791a('0x1f')](_0x448085,_0x25bae5),{'saveTo':path['join'](_0x448085,util[_0x791a('0xc')](_0x791a('0x23'),_0x25bae5,_0x791a('0x25')))},function(_0x59d2c0,_0x1cdda9){});rimraf(path['join'](_0x448085,_0x25bae5),function(){});}})[_0x791a('0x12')](function(){logger[_0x791a('0xb')](util[_0x791a('0xc')](_0x791a('0x26'),EXTRACTED_REPORT_ID,_0x791a('0xd')));return analyticExtractedReport(_0x791a('0x27'),_0x1091af?util[_0x791a('0xc')]('%s.%s',_0x25bae5,_0x1091af?_0x791a('0x25'):_0x791a('0x22')):null);});})[_0x791a('0x28')](function(_0x27f758){logger[_0x791a('0xb')](util['format'](_0x791a('0x29'),EXTRACTED_REPORT_ID,_0x791a('0xd')),util[_0x791a('0x2a')](_0x27f758,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x791a('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index ac6e6ee..519c1eb 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x5e547d,_0x5e1e61){var _0x5644f3=function(_0x2406cf){while(--_0x2406cf){_0x5e547d['push'](_0x5e547d['shift']());}};_0x5644f3(++_0x5e1e61);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e87a3,_0x58c1d1){_0x5e87a3=_0x5e87a3-0x0;var _0x69c6ab=_0xb10b[_0x5e87a3];return _0x69c6ab;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x16ba76,_0x3cf3f9){var _0xd87418=function(_0x1a8628){while(--_0x1a8628){_0x16ba76['push'](_0x16ba76['shift']());}};_0xd87418(++_0x3cf3f9);}(_0xb10b,0x12a));var _0xbb10=function(_0x174202,_0x5c5292){_0x174202=_0x174202-0x0;var _0x4daa4a=_0xb10b[_0x174202];return _0x4daa4a;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 82cf53e..b7f3f1f 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 _0x74cd=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','splitSizeXlsx','then','sequelize','SELECT','num','Empty','split','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','query','dirname','basename','.xlsx','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x74cd,0x162));var _0xd74c=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x74cd[_0x5e3b04];return _0x1fc44d;};'use strict';var util=require(_0xd74c('0x0'));var path=require(_0xd74c('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xd74c('0x2'));var BPromise=require(_0xd74c('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xd74c('0x4'));var db=require(_0xd74c('0x5'))['db'];var dbH=require(_0xd74c('0x5'))[_0xd74c('0x6')];var logger=require(_0xd74c('0x7'))(_0xd74c('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xd74c('0x9')][0x2]);var QUERY=process[_0xd74c('0x9')][0x3];var PATH=process[_0xd74c('0x9')][0x4];function analyticExtractedReport(_0x5e70c1,_0x2740b1){var _0x5df310={'status':_0x5e70c1};var _0x5ad58e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2740b1){_0x5df310[_0xd74c('0xa')]=_0x2740b1;}return db[_0xd74c('0xb')][_0xd74c('0xc')](_0x5df310,_0x5ad58e);}function main(){var _0x385396=0x1388;var _0x44857e;logger[_0xd74c('0xd')](util[_0xd74c('0xe')](_0xd74c('0xf'),EXTRACTED_REPORT_ID,_0xd74c('0x10')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd74c('0x11')]})[_0xd74c('0x12')](function(_0x1e93dd){if(_0x1e93dd){_0x44857e=_0x1e93dd;_0x385396=_0x44857e[_0xd74c('0x11')]||0x1388;}})['then'](function(){return dbH[_0xd74c('0x13')]['query'](util[_0xd74c('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd74c('0x13')]['QueryTypes'][_0xd74c('0x14')]});})[_0xd74c('0x12')](function(_0xf3c41f){if(!_0xf3c41f[0x0][_0xd74c('0x15')]){return analyticExtractedReport(_0xd74c('0x16'));}var _0x1a1305=[];var _0x1babe2=0x0;var _0x155ecd=!![];if(_0x44857e[_0xd74c('0x17')]){if(_0xf3c41f&&_0xf3c41f[_0xd74c('0x18')]){var _0x1f5e00=_0xf3c41f[0x0][_0xd74c('0x15')]%(_0x1babe2+_0x385396);for(;_0x155ecd;_0x1babe2+=_0x385396,_0x1f5e00=_0xf3c41f[0x0][_0xd74c('0x15')]%(_0x1babe2+_0x385396)){if(_0x1f5e00==0x0||_0x1f5e00==_0xf3c41f[0x0][_0xd74c('0x15')]){_0x155ecd=![];}_0x1a1305['push'](dbH[_0xd74c('0x13')]['query'](util[_0xd74c('0xe')](_0xd74c('0x19'),QUERY,_0x385396,_0x1babe2),{'type':dbH['sequelize'][_0xd74c('0x1a')][_0xd74c('0x14')]}));}}}else{_0x1a1305[_0xd74c('0x1b')](dbH[_0xd74c('0x13')][_0xd74c('0x1c')](QUERY,{'type':dbH[_0xd74c('0x13')][_0xd74c('0x1a')][_0xd74c('0x14')]}));}var _0x6a8439=path[_0xd74c('0x1d')](PATH);var _0x49788f=path[_0xd74c('0x1e')](PATH,_0xd74c('0x1f'));var _0x3a5295=_0x44857e['split']&&_0x1a1305[_0xd74c('0x18')]>0x1;var _0x27fc9e=[];if(!fs['existsSync'](path[_0xd74c('0x20')](_0x6a8439,_0x49788f))&&_0x3a5295){fs[_0xd74c('0x21')](path[_0xd74c('0x20')](_0x6a8439,_0x49788f));}return BPromise[_0xd74c('0x22')](_0x1a1305,function(_0x1cd3cc){_0x27fc9e[_0xd74c('0x1b')](_0x1cd3cc);})[_0xd74c('0x12')](function(){for(var _0x5a4ac7=0x0;_0x5a4ac7<_0x27fc9e[_0xd74c('0x18')];_0x5a4ac7+=0x1){var _0x5a0cb;var _0x23e5a2=_0x27fc9e[_0x5a4ac7];if(_0x3a5295){_0x5a0cb=path['join'](_0x6a8439,_0x49788f,util[_0xd74c('0xe')](_0xd74c('0x23'),_0x49788f,_0x5a4ac7,_0xd74c('0x24')));}else{_0x5a0cb=path[_0xd74c('0x20')](_0x6a8439,util[_0xd74c('0xe')](_0xd74c('0x25'),_0x49788f,_0xd74c('0x24')));}fs[_0xd74c('0x26')](_0x5a0cb,json2xls(_0x23e5a2),_0xd74c('0x27'));}})[_0xd74c('0x12')](function(){if(_0x3a5295){zipdir(path['join'](_0x6a8439,_0x49788f),{'saveTo':path[_0xd74c('0x20')](_0x6a8439,util['format']('%s.%s',_0x49788f,_0xd74c('0x28')))},function(_0x1db895,_0x188db6){});rimraf(path['join'](_0x6a8439,_0x49788f),function(){});}})[_0xd74c('0x12')](function(){logger[_0xd74c('0xd')](util[_0xd74c('0xe')](_0xd74c('0x29'),EXTRACTED_REPORT_ID,_0xd74c('0x10')));return analyticExtractedReport(_0xd74c('0x2a'),_0x3a5295?util[_0xd74c('0xe')](_0xd74c('0x25'),_0x49788f,_0x3a5295?_0xd74c('0x28'):_0xd74c('0x24')):null);});})['catch'](function(_0x112a68){logger[_0xd74c('0xd')](util['format'](_0xd74c('0x2b'),EXTRACTED_REPORT_ID,_0xd74c('0x10')),util[_0xd74c('0x2c')](_0x112a68,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xd74c('0x2d'));});}main(); \ No newline at end of file +var _0x8bcf=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','xlsx','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','XLSX','Setting','splitSizeXlsx','then','sequelize','SELECT','num','Empty','split','query','push','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','length','writeFileSync','binary','%s.%s','zip'];(function(_0x3f7879,_0x32cca7){var _0x2817ac=function(_0x5e963e){while(--_0x5e963e){_0x3f7879['push'](_0x3f7879['shift']());}};_0x2817ac(++_0x32cca7);}(_0x8bcf,0x1be));var _0xf8bc=function(_0x193b5c,_0x8bd1f9){_0x193b5c=_0x193b5c-0x0;var _0x40c961=_0x8bcf[_0x193b5c];return _0x40c961;};'use strict';var util=require(_0xf8bc('0x0'));var path=require('path');var _=require(_0xf8bc('0x1'));var fs=require('fs');var json2xls=require(_0xf8bc('0x2'));var BPromise=require(_0xf8bc('0x3'));var zipdir=require(_0xf8bc('0x4'));var rimraf=require(_0xf8bc('0x5'));var db=require(_0xf8bc('0x6'))['db'];var dbH=require(_0xf8bc('0x6'))[_0xf8bc('0x7')];var logger=require(_0xf8bc('0x8'))(_0xf8bc('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xf8bc('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf8bc('0xa')][0x4];function analyticExtractedReport(_0x3d2f85,_0x454a2f){var _0x37df5b={'status':_0x3d2f85};var _0x287723={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x454a2f){_0x37df5b['savename']=_0x454a2f;}return db[_0xf8bc('0xb')][_0xf8bc('0xc')](_0x37df5b,_0x287723);}function main(){var _0x5b656c=0x1388;var _0x437de3;logger[_0xf8bc('0xd')](util[_0xf8bc('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf8bc('0xf')));return db[_0xf8bc('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf8bc('0x11')]})[_0xf8bc('0x12')](function(_0x320946){if(_0x320946){_0x437de3=_0x320946;_0x5b656c=_0x437de3[_0xf8bc('0x11')]||0x1388;}})[_0xf8bc('0x12')](function(){return dbH[_0xf8bc('0x13')]['query'](util[_0xf8bc('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf8bc('0x13')]['QueryTypes'][_0xf8bc('0x14')]});})[_0xf8bc('0x12')](function(_0x52be1f){if(!_0x52be1f[0x0][_0xf8bc('0x15')]){return analyticExtractedReport(_0xf8bc('0x16'));}var _0x2f31b0=[];var _0x10ad98=0x0;var _0x146ffe=!![];if(_0x437de3[_0xf8bc('0x17')]){if(_0x52be1f&&_0x52be1f['length']){var _0x3a2f98=_0x52be1f[0x0][_0xf8bc('0x15')]%(_0x10ad98+_0x5b656c);for(;_0x146ffe;_0x10ad98+=_0x5b656c,_0x3a2f98=_0x52be1f[0x0][_0xf8bc('0x15')]%(_0x10ad98+_0x5b656c)){if(_0x3a2f98==0x0||_0x3a2f98==_0x52be1f[0x0][_0xf8bc('0x15')]){_0x146ffe=![];}_0x2f31b0['push'](dbH[_0xf8bc('0x13')][_0xf8bc('0x18')](util[_0xf8bc('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5b656c,_0x10ad98),{'type':dbH[_0xf8bc('0x13')]['QueryTypes'][_0xf8bc('0x14')]}));}}}else{_0x2f31b0[_0xf8bc('0x19')](dbH[_0xf8bc('0x13')][_0xf8bc('0x18')](QUERY,{'type':dbH[_0xf8bc('0x13')]['QueryTypes'][_0xf8bc('0x14')]}));}var _0x1a531e=path[_0xf8bc('0x1a')](PATH);var _0x4169a2=path[_0xf8bc('0x1b')](PATH,_0xf8bc('0x1c'));var _0x4459a2=_0x437de3['split']&&_0x2f31b0['length']>0x1;var _0x211715=[];if(!fs[_0xf8bc('0x1d')](path[_0xf8bc('0x1e')](_0x1a531e,_0x4169a2))&&_0x4459a2){fs[_0xf8bc('0x1f')](path[_0xf8bc('0x1e')](_0x1a531e,_0x4169a2));}return BPromise[_0xf8bc('0x20')](_0x2f31b0,function(_0x4457fc){_0x211715[_0xf8bc('0x19')](_0x4457fc);})[_0xf8bc('0x12')](function(){for(var _0x5a5d44=0x0;_0x5a5d44<_0x211715[_0xf8bc('0x21')];_0x5a5d44+=0x1){var _0x24bfba;var _0x34f569=_0x211715[_0x5a5d44];if(_0x4459a2){_0x24bfba=path['join'](_0x1a531e,_0x4169a2,util['format']('%s%d.%s',_0x4169a2,_0x5a5d44,'xlsx'));}else{_0x24bfba=path['join'](_0x1a531e,util['format']('%s.%s',_0x4169a2,'xlsx'));}fs[_0xf8bc('0x22')](_0x24bfba,json2xls(_0x34f569),_0xf8bc('0x23'));}})[_0xf8bc('0x12')](function(){if(_0x4459a2){zipdir(path[_0xf8bc('0x1e')](_0x1a531e,_0x4169a2),{'saveTo':path[_0xf8bc('0x1e')](_0x1a531e,util['format'](_0xf8bc('0x24'),_0x4169a2,_0xf8bc('0x25')))},function(_0x2cd54d,_0x233c0b){});rimraf(path[_0xf8bc('0x1e')](_0x1a531e,_0x4169a2),function(){});}})['then'](function(){logger['info'](util[_0xf8bc('0xe')](_0xf8bc('0x26'),EXTRACTED_REPORT_ID,_0xf8bc('0xf')));return analyticExtractedReport(_0xf8bc('0x27'),_0x4459a2?util[_0xf8bc('0xe')](_0xf8bc('0x24'),_0x4169a2,_0x4459a2?'zip':_0xf8bc('0x28')):null);});})['catch'](function(_0x1eba5e){logger[_0xf8bc('0xd')](util['format'](_0xf8bc('0x29'),EXTRACTED_REPORT_ID,_0xf8bc('0xf')),util[_0xf8bc('0x2a')](_0x1eba5e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xf8bc('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 494ecbc..94d474a 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 _0x3aa2=['):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','updatedAt','interval','*,*,*,*','intervals','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','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','Interval','findAll','models','VoiceExtension','IntervalId','then','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','exten','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','push','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('];(function(_0x3c5cc8,_0x336027){var _0x44675c=function(_0xf9543e){while(--_0xf9543e){_0x3c5cc8['push'](_0x3c5cc8['shift']());}};_0x44675c(++_0x336027);}(_0x3aa2,0x13b));var _0x23aa=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0x3aa2[_0x257841];return _0x1b87ed;};'use strict';var _=require(_0x23aa('0x0'));var util=require(_0x23aa('0x1'));function rewrite(_0x546b6c,_0x151513){var _0x57325d=this;return _0x546b6c['models'][_0x23aa('0x2')][_0x23aa('0x3')]({'raw':!![]})['then'](function(_0x38c0ab){_0x57325d['intervals']=_0x38c0ab;return _0x546b6c[_0x23aa('0x4')][_0x23aa('0x5')]['findAll']({'where':{'IntervalId':_0x151513[_0x23aa('0x6')]},'raw':!![]});})[_0x23aa('0x7')](function(_0x31e9e4){return _0x546b6c['models'][_0x23aa('0x5')][_0x23aa('0x3')]({'where':{'exten':{'$in':_[_0x23aa('0x8')](_['map'](_0x31e9e4,'exten'))}},'order':[{'raw':_0x23aa('0x9')}],'raw':!![]});})['then'](function(_0x3f9456){var _0x155c20=_[_0x23aa('0xa')](_0x3f9456,{'priority':'1'});var _0x1891c7=_[_0x23aa('0xa')](_0x3f9456,{'isApp':0x1});var _0x459412=_[_0x23aa('0xb')](_0x1891c7,'exten');var _0x4fdd70=['queue',_0x23aa('0xc')];var _0x1c664b=[];var _0x109649=[];for(var _0x1d3725 in _0x459412){if(_0x459412[_0x23aa('0xd')](_0x1d3725)){_0x57325d[_0x23aa('0xe')]=0x2;_0x57325d[_0x23aa('0xf')]=[];_0x57325d[_0x23aa('0x10')]=_['find'](_0x155c20,{'exten':_0x459412[_0x1d3725][0x0][_0x23aa('0x11')]});_0x57325d['extensions']['push']({'type':_0x459412[_0x1d3725][0x0][_0x23aa('0x12')],'app':_0x23aa('0x13'),'appdata':util[_0x23aa('0x14')](_0x23aa('0x15'),_0x459412[_0x1d3725][0x0][_0x23aa('0x12')]),'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0]['exten'],'priority':_0x57325d[_0x23aa('0xe')]++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0][_0x23aa('0x17')]});if(_0x459412[_0x1d3725][0x0]['type']==='outbound'){if(_0x57325d['extension']){_0x57325d['extensions'][_0x23aa('0x18')]({'type':_0x459412[_0x1d3725][0x0][_0x23aa('0x12')],'app':_0x23aa('0x13'),'appdata':'CDR(destination)='+(_0x57325d[_0x23aa('0x10')][_0x23aa('0x19')]?'${EXTEN:'+_0x57325d[_0x23aa('0x10')][_0x23aa('0x19')]+'}':_0x23aa('0x1a')),'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0][_0x23aa('0x11')],'priority':_0x57325d[_0x23aa('0xe')]++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0][_0x23aa('0x17')]});}_0x57325d[_0x23aa('0xf')][_0x23aa('0x18')]({'type':_0x459412[_0x1d3725][0x0]['type'],'app':_0x23aa('0x13'),'appdata':_0x23aa('0x1b')+_0x459412[_0x1d3725][0x0][_0x23aa('0x17')],'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0]['exten'],'priority':_0x57325d[_0x23aa('0xe')]++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0]['VoiceExtensionId']});var _0x44b337=_0x57325d[_0x23aa('0xe')]++;_0x57325d[_0x23aa('0xf')]['push']({'type':_0x459412[_0x1d3725][0x0][_0x23aa('0x12')],'app':_0x23aa('0x1c'),'appdata':_0x23aa('0x1d')+(_0x44b337+0x2)+_0x23aa('0x1e')+(_0x44b337+0x1)+')','context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0]['exten'],'priority':_0x44b337,'VoiceExtensionId':_0x459412[_0x1d3725][0x0]['VoiceExtensionId']});if(_0x57325d[_0x23aa('0x10')]){_0x57325d[_0x23aa('0xf')][_0x23aa('0x18')]({'type':_0x459412[_0x1d3725][0x0][_0x23aa('0x12')],'app':_0x23aa('0x13'),'appdata':_0x57325d[_0x23aa('0x10')][_0x23aa('0x19')]?_0x23aa('0x1f')+_0x57325d[_0x23aa('0x10')][_0x23aa('0x19')]+'}':_0x23aa('0x20'),'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0][_0x23aa('0x11')],'priority':_0x57325d[_0x23aa('0xe')]++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0]['VoiceExtensionId']});}_0x57325d['extensions'][_0x23aa('0x18')]({'type':_0x459412[_0x1d3725][0x0][_0x23aa('0x12')],'app':_0x23aa('0x13'),'appdata':'outboundrouteid='+_0x459412[_0x1d3725][0x0]['VoiceExtensionId'],'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0][_0x23aa('0x11')],'priority':_0x57325d[_0x23aa('0xe')]++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0]['VoiceExtensionId']});if(_0x57325d[_0x23aa('0x10')]&&_0x57325d[_0x23aa('0x10')]['hasOwnProperty'](_0x23aa('0x21'))&&_0x57325d[_0x23aa('0x10')]['recordingFormat']!==_0x23aa('0x22')){_0x57325d[_0x23aa('0xf')]['push']({'type':_0x459412[_0x1d3725][0x0][_0x23aa('0x12')],'app':_0x23aa('0x13'),'appdata':_0x23aa('0x23'),'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0][_0x23aa('0x11')],'priority':_0x57325d[_0x23aa('0xe')]++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0][_0x23aa('0x17')]});_0x57325d['extensions'][_0x23aa('0x18')]({'type':_0x459412[_0x1d3725][0x0][_0x23aa('0x12')],'app':_0x23aa('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x57325d['extension'][_0x23aa('0x21')]||_0x23aa('0x24'),'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0]['exten'],'priority':_0x57325d[_0x23aa('0xe')]++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0][_0x23aa('0x17')]});}}_0x57325d[_0x23aa('0xf')][_0x23aa('0x18')]({'type':_0x459412[_0x1d3725][0x0][_0x23aa('0x12')],'app':_0x23aa('0x13'),'appdata':_0x23aa('0x25'),'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0][_0x23aa('0x11')],'priority':_0x57325d[_0x23aa('0xe')]++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0][_0x23aa('0x17')]});_0x57325d[_0x23aa('0xf')]['push']({'type':_0x459412[_0x1d3725][0x0]['type'],'app':_0x23aa('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x459412[_0x1d3725][0x0]['context'],'exten':_0x459412[_0x1d3725][0x0][_0x23aa('0x11')],'priority':_0x57325d['priority']++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0][_0x23aa('0x17')]});_0x57325d[_0x23aa('0xf')][_0x23aa('0x18')]({'type':_0x459412[_0x1d3725][0x0]['type'],'app':_0x23aa('0x13'),'appdata':_0x23aa('0x26'),'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'exten':_0x459412[_0x1d3725][0x0][_0x23aa('0x11')],'priority':_0x57325d[_0x23aa('0xe')]++,'VoiceExtensionId':_0x459412[_0x1d3725][0x0][_0x23aa('0x17')]});for(var _0x20b565=0x0,_0x5c8c42=0x0;_0x20b565<_0x459412[_0x1d3725][_0x23aa('0x27')];_0x20b565+=0x1,_0x5c8c42=0x0){var _0x49f994=_0x459412[_0x1d3725][_0x20b565];if(_0x49f994[_0x23aa('0x12')]){_0x49f994['type']=_0x49f994['type']['toLowerCase']();}var _0x284b94=[];var _0x4e04de=[];delete _0x49f994['id'];delete _0x49f994['createdAt'];delete _0x49f994[_0x23aa('0x28')];var _0x173007=_0x49f994[_0x23aa('0x29')]!==_0x23aa('0x2a')?[_0x49f994[_0x23aa('0x29')]]:_0x49f994['IntervalId']?_['map'](_[_0x23aa('0xa')](_0x57325d[_0x23aa('0x2b')],{'IntervalId':_0x49f994[_0x23aa('0x6')]}),'interval'):[];if(_0x49f994[_0x23aa('0xd')]('tag')){if(_0x49f994[_0x23aa('0x2c')]&&_0x49f994[_0x23aa('0x2c')]!=='--'){_0x284b94[_0x23aa('0x18')]({'type':_0x49f994['type'],'app':_0x23aa('0x13'),'appdata':_0x23aa('0x2d')+_0x49f994['tag'],'context':_0x49f994[_0x23aa('0x16')],'exten':_0x49f994['exten'],'priority':_0x173007[_0x23aa('0x27')]+_0x57325d[_0x23aa('0xe')]+_0x5c8c42++,'VoiceExtensionId':_0x49f994[_0x23aa('0x17')]});}}if(_0x49f994[_0x23aa('0x12')]===_0x23aa('0x2e')&&_0x49f994['hasOwnProperty'](_0x23aa('0x2f'))){if(_0x49f994[_0x23aa('0x2f')]){_0x284b94['push']({'type':_0x49f994[_0x23aa('0x12')],'app':_0x23aa('0x1c'),'appdata':_0x23aa('0x30')+_0x49f994['callerID']+')','context':_0x49f994[_0x23aa('0x16')],'exten':_0x49f994['exten'],'priority':_0x173007[_0x23aa('0x27')]+_0x57325d[_0x23aa('0xe')]+_0x5c8c42++,'VoiceExtensionId':_0x49f994[_0x23aa('0x17')]});}else{_0x284b94[_0x23aa('0x18')]({'type':_0x49f994[_0x23aa('0x12')],'app':'ExecIf','appdata':_0x23aa('0x31'),'context':_0x49f994[_0x23aa('0x16')],'exten':_0x49f994['exten'],'priority':_0x173007[_0x23aa('0x27')]+_0x57325d[_0x23aa('0xe')]+_0x5c8c42++,'VoiceExtensionId':_0x49f994[_0x23aa('0x17')]});}}if(_0x49f994[_0x23aa('0xd')](_0x23aa('0x32'))){if(_0x4fdd70['indexOf'](_0x49f994[_0x23aa('0x33')][_0x23aa('0x34')]())>=0x0&&_0x49f994[_0x23aa('0x35')]!==_0x23aa('0x36')){if(_0x49f994[_0x23aa('0x32')]){_0x284b94[_0x23aa('0x18')]({'type':_0x49f994[_0x23aa('0x12')],'app':_0x23aa('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x49f994[_0x23aa('0x16')],'exten':_0x49f994[_0x23aa('0x11')],'priority':_0x173007[_0x23aa('0x27')]+_0x57325d[_0x23aa('0xe')]+_0x5c8c42++,'VoiceExtensionId':_0x49f994['VoiceExtensionId']});_0x284b94[_0x23aa('0x18')]({'type':_0x49f994[_0x23aa('0x12')],'app':_0x23aa('0x13'),'appdata':_0x23aa('0x37'),'context':_0x49f994['context'],'exten':_0x49f994['exten'],'priority':_0x173007[_0x23aa('0x27')]+_0x57325d[_0x23aa('0xe')]+_0x5c8c42++,'VoiceExtensionId':_0x49f994[_0x23aa('0x17')]});}else{_0x284b94[_0x23aa('0x18')]({'type':_0x49f994[_0x23aa('0x12')],'app':_0x23aa('0x1c'),'appdata':_0x23aa('0x38'),'context':_0x49f994[_0x23aa('0x16')],'exten':_0x49f994[_0x23aa('0x11')],'priority':_0x173007[_0x23aa('0x27')]+_0x57325d[_0x23aa('0xe')]+_0x5c8c42++,'VoiceExtensionId':_0x49f994[_0x23aa('0x17')]});_0x284b94[_0x23aa('0x18')]({'type':_0x49f994[_0x23aa('0x12')],'app':_0x23aa('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x49f994[_0x23aa('0x16')],'exten':_0x49f994[_0x23aa('0x11')],'priority':_0x173007[_0x23aa('0x27')]+_0x57325d[_0x23aa('0xe')]+_0x5c8c42++,'VoiceExtensionId':_0x49f994[_0x23aa('0x17')]});}}}for(var _0x37aca6=0x0;_0x37aca6<_0x173007[_0x23aa('0x27')];_0x37aca6+=0x1){var _0x47924c=_0x57325d[_0x23aa('0xe')]+_0x173007[_0x23aa('0x27')];var _0x544aa3=_0x37aca6===_0x173007[_0x23aa('0x27')]-0x1?_0x57325d[_0x23aa('0xe')]+_0x284b94[_0x23aa('0x27')]+_0x4e04de[_0x23aa('0x27')]+0x2:_0x57325d[_0x23aa('0xe')]+_0x37aca6+0x1;_0x284b94[_0x23aa('0x39')](_0x37aca6,0x0,{'type':_0x49f994['type'],'app':_0x23aa('0x3a'),'appdata':_0x173007[_0x37aca6]+'?'+_0x49f994[_0x23aa('0x16')]+_0x23aa('0x3b')+_0x47924c+':'+_0x49f994[_0x23aa('0x16')]+',${EXTEN},'+_0x544aa3,'exten':_0x49f994[_0x23aa('0x11')],'context':_0x49f994[_0x23aa('0x16')],'priority':_0x57325d[_0x23aa('0xe')]+_0x37aca6,'VoiceExtensionId':_0x459412[_0x1d3725][0x0][_0x23aa('0x17')]});}_0x49f994[_0x23aa('0xe')]=_0x284b94[_0x23aa('0x27')]?_[_0x23aa('0x3c')](_0x284b94)[_0x23aa('0xe')]+0x1:_0x57325d[_0x23aa('0xe')];_0x57325d[_0x23aa('0xe')]=(_0x4e04de[_0x23aa('0x27')]?_[_0x23aa('0x3c')](_0x4e04de)['priority']:_0x49f994[_0x23aa('0xe')])+0x1;_0x57325d[_0x23aa('0xf')]=_['concat'](_0x57325d[_0x23aa('0xf')],_0x284b94,[_0x49f994],_0x4e04de);}_0x57325d['extensions'][_0x23aa('0x18')]({'type':_0x459412[_0x1d3725][0x0]['type'],'app':_0x23aa('0x3d'),'exten':_0x459412[_0x1d3725][0x0][_0x23aa('0x11')],'context':_0x459412[_0x1d3725][0x0][_0x23aa('0x16')],'priority':_0x57325d[_0x23aa('0xe')],'VoiceExtensionId':_0x459412[_0x1d3725][0x0][_0x23aa('0x17')]});_0x1c664b[_0x23aa('0x18')](_0x459412[_0x1d3725][0x0]['VoiceExtensionId']);_0x109649=_[_0x23aa('0x3e')](_0x109649,_0x57325d['extensions']);}}return _0x546b6c[_0x23aa('0x3f')](function(_0x29ddb9){return _0x546b6c['models'][_0x23aa('0x5')][_0x23aa('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x1c664b}},'transaction':_0x29ddb9})[_0x23aa('0x7')](function(_0x121076){return _0x546b6c['models'][_0x23aa('0x5')][_0x23aa('0x41')](_[_0x23aa('0x42')](_0x109649,_0x23aa('0xe')),{'transaction':_0x29ddb9});});});})[_0x23aa('0x43')](function(_0x4fe580){console[_0x23aa('0x44')](_0x4fe580);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x46f0=['splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','util','Interval','then','VoiceExtension','findAll','IntervalId','models','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','find','extensions','type','Set','format','CDR(type)=%s','VoiceExtensionId','outbound','push','CDR(destination)=','extension','cutdigits','${EXTEN}','context','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','intervals','tag','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','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1'];(function(_0x56730a,_0x9055fb){var _0x12125a=function(_0x298fe6){while(--_0x298fe6){_0x56730a['push'](_0x56730a['shift']());}};_0x12125a(++_0x9055fb);}(_0x46f0,0x1a7));var _0x046f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46f0[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x046f('0x0'));function rewrite(_0x235819,_0x9a4ff5){var _0x104c05=this;return _0x235819['models'][_0x046f('0x1')]['findAll']({'raw':!![]})[_0x046f('0x2')](function(_0x1cb4a1){_0x104c05['intervals']=_0x1cb4a1;return _0x235819['models'][_0x046f('0x3')][_0x046f('0x4')]({'where':{'IntervalId':_0x9a4ff5[_0x046f('0x5')]},'raw':!![]});})[_0x046f('0x2')](function(_0x57930f){return _0x235819[_0x046f('0x6')][_0x046f('0x3')][_0x046f('0x4')]({'where':{'exten':{'$in':_[_0x046f('0x7')](_[_0x046f('0x8')](_0x57930f,_0x046f('0x9')))}},'order':[{'raw':_0x046f('0xa')}],'raw':!![]});})[_0x046f('0x2')](function(_0x27c9f2){var _0x1f556f=_[_0x046f('0xb')](_0x27c9f2,{'priority':'1'});var _0x16ee3c=_[_0x046f('0xb')](_0x27c9f2,{'isApp':0x1});var _0x2dfc81=_[_0x046f('0xc')](_0x16ee3c,'exten');var _0x2fa862=[_0x046f('0xd'),_0x046f('0xe')];var _0x81a26d=[];var _0x574460=[];for(var _0x38a2a8 in _0x2dfc81){if(_0x2dfc81['hasOwnProperty'](_0x38a2a8)){_0x104c05[_0x046f('0xf')]=0x2;_0x104c05['extensions']=[];_0x104c05['extension']=_[_0x046f('0x10')](_0x1f556f,{'exten':_0x2dfc81[_0x38a2a8][0x0]['exten']});_0x104c05[_0x046f('0x11')]['push']({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':_0x046f('0x13'),'appdata':util[_0x046f('0x14')](_0x046f('0x15'),_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')]),'context':_0x2dfc81[_0x38a2a8][0x0]['context'],'exten':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x9')],'priority':_0x104c05[_0x046f('0xf')]++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});if(_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')]===_0x046f('0x17')){if(_0x104c05['extension']){_0x104c05[_0x046f('0x11')][_0x046f('0x18')]({'type':_0x2dfc81[_0x38a2a8][0x0]['type'],'app':_0x046f('0x13'),'appdata':_0x046f('0x19')+(_0x104c05[_0x046f('0x1a')][_0x046f('0x1b')]?'${EXTEN:'+_0x104c05[_0x046f('0x1a')][_0x046f('0x1b')]+'}':_0x046f('0x1c')),'context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'exten':_0x2dfc81[_0x38a2a8][0x0]['exten'],'priority':_0x104c05[_0x046f('0xf')]++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});}_0x104c05['extensions'][_0x046f('0x18')]({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':_0x046f('0x13'),'appdata':_0x046f('0x1e')+_0x2dfc81[_0x38a2a8][0x0]['VoiceExtensionId'],'context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'exten':_0x2dfc81[_0x38a2a8][0x0]['exten'],'priority':_0x104c05[_0x046f('0xf')]++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});var _0xca550c=_0x104c05[_0x046f('0xf')]++;_0x104c05[_0x046f('0x11')][_0x046f('0x18')]({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':_0x046f('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xca550c+0x2)+'):Goto('+(_0xca550c+0x1)+')','context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'exten':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x9')],'priority':_0xca550c,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0]['VoiceExtensionId']});if(_0x104c05['extension']){_0x104c05[_0x046f('0x11')]['push']({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':'Set','appdata':_0x104c05[_0x046f('0x1a')][_0x046f('0x1b')]?_0x046f('0x20')+_0x104c05[_0x046f('0x1a')][_0x046f('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x2dfc81[_0x38a2a8][0x0]['context'],'exten':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x9')],'priority':_0x104c05['priority']++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});}_0x104c05[_0x046f('0x11')][_0x046f('0x18')]({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':_0x046f('0x13'),'appdata':_0x046f('0x21')+_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')],'context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'exten':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x9')],'priority':_0x104c05['priority']++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});if(_0x104c05['extension']&&_0x104c05[_0x046f('0x1a')][_0x046f('0x22')](_0x046f('0x23'))&&_0x104c05[_0x046f('0x1a')][_0x046f('0x23')]!==_0x046f('0x24')){_0x104c05[_0x046f('0x11')]['push']({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':'Set','appdata':_0x046f('0x25'),'context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'exten':_0x2dfc81[_0x38a2a8][0x0]['exten'],'priority':_0x104c05['priority']++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});_0x104c05[_0x046f('0x11')][_0x046f('0x18')]({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':_0x046f('0x13'),'appdata':_0x046f('0x26')+_0x104c05[_0x046f('0x1a')][_0x046f('0x23')]||_0x046f('0x27'),'context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'exten':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x9')],'priority':_0x104c05[_0x046f('0xf')]++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});}}_0x104c05[_0x046f('0x11')][_0x046f('0x18')]({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':_0x046f('0x13'),'appdata':_0x046f('0x28'),'context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'exten':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x9')],'priority':_0x104c05[_0x046f('0xf')]++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});_0x104c05[_0x046f('0x11')]['push']({'type':_0x2dfc81[_0x38a2a8][0x0]['type'],'app':_0x046f('0x13'),'appdata':_0x046f('0x29'),'context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'exten':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x9')],'priority':_0x104c05['priority']++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});_0x104c05[_0x046f('0x11')][_0x046f('0x18')]({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':'Set','appdata':_0x046f('0x2a'),'context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'exten':_0x2dfc81[_0x38a2a8][0x0]['exten'],'priority':_0x104c05[_0x046f('0xf')]++,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});for(var _0x4c92bc=0x0,_0x40e508=0x0;_0x4c92bc<_0x2dfc81[_0x38a2a8][_0x046f('0x2b')];_0x4c92bc+=0x1,_0x40e508=0x0){var _0x33b411=_0x2dfc81[_0x38a2a8][_0x4c92bc];if(_0x33b411[_0x046f('0x12')]){_0x33b411['type']=_0x33b411[_0x046f('0x12')][_0x046f('0x2c')]();}var _0x52dabf=[];var _0x287528=[];delete _0x33b411['id'];delete _0x33b411[_0x046f('0x2d')];delete _0x33b411['updatedAt'];var _0x30922e=_0x33b411[_0x046f('0x2e')]!==_0x046f('0x2f')?[_0x33b411[_0x046f('0x2e')]]:_0x33b411[_0x046f('0x5')]?_['map'](_[_0x046f('0xb')](_0x104c05[_0x046f('0x30')],{'IntervalId':_0x33b411['IntervalId']}),_0x046f('0x2e')):[];if(_0x33b411[_0x046f('0x22')](_0x046f('0x31'))){if(_0x33b411[_0x046f('0x31')]&&_0x33b411[_0x046f('0x31')]!=='--'){_0x52dabf[_0x046f('0x18')]({'type':_0x33b411[_0x046f('0x12')],'app':_0x046f('0x13'),'appdata':'CDR(tag)='+_0x33b411['tag'],'context':_0x33b411[_0x046f('0x1d')],'exten':_0x33b411[_0x046f('0x9')],'priority':_0x30922e[_0x046f('0x2b')]+_0x104c05[_0x046f('0xf')]+_0x40e508++,'VoiceExtensionId':_0x33b411[_0x046f('0x16')]});}}if(_0x33b411[_0x046f('0x12')]===_0x046f('0x17')&&_0x33b411[_0x046f('0x22')](_0x046f('0x32'))){if(_0x33b411['callerID']){_0x52dabf['push']({'type':_0x33b411[_0x046f('0x12')],'app':'ExecIf','appdata':_0x046f('0x33')+_0x33b411[_0x046f('0x32')]+')','context':_0x33b411['context'],'exten':_0x33b411[_0x046f('0x9')],'priority':_0x30922e[_0x046f('0x2b')]+_0x104c05[_0x046f('0xf')]+_0x40e508++,'VoiceExtensionId':_0x33b411[_0x046f('0x16')]});}else{_0x52dabf[_0x046f('0x18')]({'type':_0x33b411['type'],'app':_0x046f('0x1f'),'appdata':_0x046f('0x34'),'context':_0x33b411[_0x046f('0x1d')],'exten':_0x33b411['exten'],'priority':_0x30922e[_0x046f('0x2b')]+_0x104c05[_0x046f('0xf')]+_0x40e508++,'VoiceExtensionId':_0x33b411[_0x046f('0x16')]});}}if(_0x33b411[_0x046f('0x22')](_0x046f('0x35'))){if(_0x2fa862[_0x046f('0x36')](_0x33b411['app']['toLowerCase']())>=0x0&&_0x33b411[_0x046f('0x37')]!==_0x046f('0x38')){if(_0x33b411['answer']){_0x52dabf[_0x046f('0x18')]({'type':_0x33b411[_0x046f('0x12')],'app':_0x046f('0x1f'),'appdata':_0x046f('0x39'),'context':_0x33b411[_0x046f('0x1d')],'exten':_0x33b411[_0x046f('0x9')],'priority':_0x30922e[_0x046f('0x2b')]+_0x104c05[_0x046f('0xf')]+_0x40e508++,'VoiceExtensionId':_0x33b411[_0x046f('0x16')]});_0x52dabf[_0x046f('0x18')]({'type':_0x33b411[_0x046f('0x12')],'app':_0x046f('0x13'),'appdata':_0x046f('0x3a'),'context':_0x33b411[_0x046f('0x1d')],'exten':_0x33b411['exten'],'priority':_0x30922e[_0x046f('0x2b')]+_0x104c05[_0x046f('0xf')]+_0x40e508++,'VoiceExtensionId':_0x33b411[_0x046f('0x16')]});}else{_0x52dabf[_0x046f('0x18')]({'type':_0x33b411['type'],'app':_0x046f('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x33b411[_0x046f('0x1d')],'exten':_0x33b411[_0x046f('0x9')],'priority':_0x30922e[_0x046f('0x2b')]+_0x104c05[_0x046f('0xf')]+_0x40e508++,'VoiceExtensionId':_0x33b411[_0x046f('0x16')]});_0x52dabf[_0x046f('0x18')]({'type':_0x33b411[_0x046f('0x12')],'app':_0x046f('0x13'),'appdata':_0x046f('0x3b'),'context':_0x33b411[_0x046f('0x1d')],'exten':_0x33b411[_0x046f('0x9')],'priority':_0x30922e[_0x046f('0x2b')]+_0x104c05[_0x046f('0xf')]+_0x40e508++,'VoiceExtensionId':_0x33b411[_0x046f('0x16')]});}}}for(var _0x1362d5=0x0;_0x1362d5<_0x30922e[_0x046f('0x2b')];_0x1362d5+=0x1){var _0x225f54=_0x104c05['priority']+_0x30922e['length'];var _0x33b7d1=_0x1362d5===_0x30922e['length']-0x1?_0x104c05[_0x046f('0xf')]+_0x52dabf[_0x046f('0x2b')]+_0x287528[_0x046f('0x2b')]+0x2:_0x104c05[_0x046f('0xf')]+_0x1362d5+0x1;_0x52dabf[_0x046f('0x3c')](_0x1362d5,0x0,{'type':_0x33b411['type'],'app':_0x046f('0x3d'),'appdata':_0x30922e[_0x1362d5]+'?'+_0x33b411[_0x046f('0x1d')]+_0x046f('0x3e')+_0x225f54+':'+_0x33b411[_0x046f('0x1d')]+',${EXTEN},'+_0x33b7d1,'exten':_0x33b411[_0x046f('0x9')],'context':_0x33b411[_0x046f('0x1d')],'priority':_0x104c05[_0x046f('0xf')]+_0x1362d5,'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]});}_0x33b411[_0x046f('0xf')]=_0x52dabf[_0x046f('0x2b')]?_[_0x046f('0x3f')](_0x52dabf)['priority']+0x1:_0x104c05[_0x046f('0xf')];_0x104c05[_0x046f('0xf')]=(_0x287528[_0x046f('0x2b')]?_[_0x046f('0x3f')](_0x287528)[_0x046f('0xf')]:_0x33b411[_0x046f('0xf')])+0x1;_0x104c05[_0x046f('0x11')]=_[_0x046f('0x40')](_0x104c05[_0x046f('0x11')],_0x52dabf,[_0x33b411],_0x287528);}_0x104c05[_0x046f('0x11')][_0x046f('0x18')]({'type':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x12')],'app':_0x046f('0x41'),'exten':_0x2dfc81[_0x38a2a8][0x0]['exten'],'context':_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x1d')],'priority':_0x104c05[_0x046f('0xf')],'VoiceExtensionId':_0x2dfc81[_0x38a2a8][0x0]['VoiceExtensionId']});_0x81a26d['push'](_0x2dfc81[_0x38a2a8][0x0][_0x046f('0x16')]);_0x574460=_[_0x046f('0x40')](_0x574460,_0x104c05[_0x046f('0x11')]);}}return _0x235819[_0x046f('0x42')](function(_0x34252e){return _0x235819['models']['VoiceExtension'][_0x046f('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x81a26d}},'transaction':_0x34252e})[_0x046f('0x2')](function(_0x46e946){return _0x235819[_0x046f('0x6')][_0x046f('0x3')]['bulkCreate'](_[_0x046f('0x44')](_0x574460,_0x046f('0xf')),{'transaction':_0x34252e});});});})['catch'](function(_0x5880d7){console['error'](_0x5880d7);});}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 d315ea2..8e60199 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 _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);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(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){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'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file +var _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate'];(function(_0x372d65,_0x3dd521){var _0x424e26=function(_0x48be9d){while(--_0x48be9d){_0x372d65['push'](_0x372d65['shift']());}};_0x424e26(++_0x3dd521);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index aca4582..591a27b 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(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x7a54,0x106));var _0x47a5=function(_0x27c6bc,_0xc5cf4e){_0x27c6bc=_0x27c6bc-0x0;var _0x5a10b5=_0x7a54[_0x27c6bc];return _0x5a10b5;};'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(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0x7a54,0x106));var _0x47a5=function(_0x4d250b,_0xeff66b){_0x4d250b=_0x4d250b-0x0;var _0x10a3b2=_0x7a54[_0x4d250b];return _0x10a3b2;};'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 79f03db..1688b52 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 _0xa2ec=['CmContactHasItem','updated','inserted','CmContact','CmHopper','update','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','priority','UserId','recallme','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','into','cm_hopper_black','updatedAt','fields','cm_contacts.createdAt\x20=\x20?','field','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','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?','keys','CompanyId','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','header','writeFileSync','parse','data','rows','find','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','contact:import:','abort','step','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','DROP\x20TABLE\x20','finish','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','from','where','\x20=\x20','sequelize','query','spread','length','phone','isNil','AdditionalPhones','push','then','catch','all'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa2ec,0x10e));var _0xca2e=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xa2ec[_0x386c3e];return _0x4b8e13;};'use strict';var fs=require('fs');var path=require(_0xca2e('0x0'));var _=require(_0xca2e('0x1'));var Papa=require(_0xca2e('0x2'));var util=require(_0xca2e('0x3'));var BPromise=require(_0xca2e('0x4'));var moment=require('moment');var squel=require(_0xca2e('0x5'));var Redis=require(_0xca2e('0x6'));var db=require(_0xca2e('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0xca2e('0x8'))(_0xca2e('0x9'));config[_0xca2e('0xa')]=_[_0xca2e('0xb')](config[_0xca2e('0xa')],{'host':_0xca2e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca2e('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()[_0xca2e('0xd')](_0xca2e('0xe'));var tempTableName='cm_contacts_temp_'+moment()[_0xca2e('0xd')](_0xca2e('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x519248){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))*$/[_0xca2e('0x10')](_0x519248);}function selectNotIn(_0x5740fa,_0x1355c9,_0x4bb55d,_0x5d44cf,_0x4cf392){return squel[_0xca2e('0x11')]()['field']('phone')[_0xca2e('0x12')](_0x5d44cf)['join'](_0x1355c9,null,_0x1355c9+'.id\x20=\x20'+_0x5d44cf+'.'+_0x4bb55d)[_0xca2e('0x13')](_0x5d44cf+'.'+_0x4bb55d+_0xca2e('0x14')+_0x5740fa+'.'+_0x4bb55d)[_0xca2e('0x13')](_0x1355c9+'.dialCheckDuplicateType\x20IN\x20('+_0x4cf392['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0xb77d0b,_0x2faf77){promisesAdditionalPhones=[];promisesContact=[];return db[_0xca2e('0x15')][_0xca2e('0x16')]('select\x20*\x20from\x20'+tempTableName)[_0xca2e('0x17')](function(_0x59acba){if(_0x59acba!==null){var _0x245319=[];for(var _0xb19360=0x0;_0xb19360<_0x59acba[_0xca2e('0x18')];_0xb19360++){var _0x19327d=_0x59acba[_0xb19360];if(!_['isNil'](_0x19327d[_0xca2e('0x19')])){if(!_[_0xca2e('0x1a')](_0x19327d[_0xca2e('0x1b')]))_0x245319['push'](insertAdditionalPhones(_0x19327d));promisesContact[_0xca2e('0x1c')]({'contact':_0x19327d});}}}Promise['all'](_0x245319)[_0xca2e('0x1d')](function(){_0xb77d0b({'val':0x1});});})[_0xca2e('0x1e')](function(_0x53a9a6){logger['error'](_0x53a9a6['message']);});});}function insertAdditionalPhones(_0x498054){return new Promise(function(_0x572019,_0x2f33e0){var _0x5195dd=_0x498054['AdditionalPhones'];if(_[_0xca2e('0x1a')](_0x5195dd))_0x2f33e0({'val':0x0});else{var _0x13dbe7=_0x5195dd['split'](';');var _0x1a9a80=[];orderBy=0x0;for(var _0x91e70e=0x0;_0x91e70e<_0x13dbe7['length'];_0x91e70e++){_0x1a9a80[_0xca2e('0x1c')](splitAdditionalPhone(_0x498054['id'],_0x13dbe7[_0x91e70e]));}Promise[_0xca2e('0x1f')](_0x1a9a80)[_0xca2e('0x1d')](function(){_0x572019({'val':_0x13dbe7[_0xca2e('0x18')]});});}});}function splitAdditionalPhone(_0x4f8502,_0x3b9b4b){return new Promise(function(_0x5883da,_0xd3d1f){var _0x325fc9=_0x3b9b4b['split'](':');var _0x5135b6=_0x325fc9[0x0];var _0x1ab242=_0x325fc9[0x1];if(_0x1ab242!==''){var _0x3ce55b=_0x1ab242['split']('|');var _0x37059c=[];for(var _0x4aa25d=0x0;_0x4aa25d<_0x3ce55b['length'];_0x4aa25d++){if(_0x3ce55b[_0x4aa25d]!==''){var _0x481052=_['filter'](promisesAdditionalPhones,{'contactId':_0x4f8502,'phone':_0x3ce55b[_0x4aa25d]});if(_0x481052['length']==0x0){orderBy++;promisesAdditionalPhones[_0xca2e('0x1c')]({'contactId':_0x4f8502,'contactTypeId':_0x5135b6,'phone':_0x3ce55b[_0x4aa25d],'orderBy':orderBy});}}}_0x5883da({'ok':0x1});}else _0x5883da({'res':0x0});});}function createAdditionalPhone(_0xfd7daa,_0x433b9d,_0x1f0061,_0x2d8f15){return new Promise(function(_0x3ba9a1,_0x331814){return db[_0xca2e('0x20')]['findOne']({'where':{'CmContactId':_0xfd7daa,'item':_0x1f0061}})['then'](function(_0x8df0b6){if(_0x8df0b6){return db[_0xca2e('0x20')]['update']({'ItemTypeId':_0x433b9d,'OrderBy':_0x2d8f15},{'where':{'CmContactId':_0xfd7daa,'item':_0x1f0061}})[_0xca2e('0x1d')](function(_0x3dfa7d){_0x3ba9a1({'res':_0xca2e('0x21')});});}else{return db[_0xca2e('0x20')]['create']({'CmContactId':_0xfd7daa,'item':_0x1f0061,'ItemTypeId':_0x433b9d,'OrderBy':_0x2d8f15,'ItemClass':'PHONE'})[_0xca2e('0x1d')](function(_0x611f71){_0x3ba9a1({'res':_0xca2e('0x22')});});}});});}function updateContact(_0x3c11ef){return new Promise(function(_0x5ceaf9,_0x3b5591){var _0x20ac66=_0x3c11ef['id'];delete _0x3c11ef['id'];return db[_0xca2e('0x23')]['update'](_0x3c11ef,{'where':{'id':_0x20ac66}})['then'](function(_0x147318){updatedRows+=0x1;return db[_0xca2e('0x24')][_0xca2e('0x25')]({'phone':_0x3c11ef[_0xca2e('0x19')]},{'where':{'ContactId':_0x20ac66}})['then'](function(_0x1e4ba3){_0x5ceaf9({'ret':'OK'});});});});}function insertCmHopper(_0x1efd2e,_0x4d6947,_0x43a37f,_0x23f6d6,_0x47e7d5){var _0x399773=['cm_contacts.phone','cm_contacts.scheduledat',_0xca2e('0x26'),_0xca2e('0x27'),_0x4d6947+'.'+_0x23f6d6,'cm_contacts.createdAt',_0xca2e('0x28'),_0xca2e('0x29'),_0xca2e('0x2a'),'\x22'+_0x47e7d5+'\x22'];return squel[_0xca2e('0x2b')]()['into'](_0xca2e('0x2c'))[_0xca2e('0x2d')]([_0xca2e('0x19'),'scheduledat',_0xca2e('0x2e'),_0xca2e('0x2f'),_0x23f6d6,_0xca2e('0x30'),'updatedAt',_0xca2e('0x31'),_0xca2e('0x32'),_0xca2e('0x33')],squel['select']()['fields'](_0x399773)[_0xca2e('0x12')](_0x4d6947)[_0xca2e('0x34')](_0xca2e('0x35'),null,_0xca2e('0x36')+_0x4d6947+_0xca2e('0x37'))[_0xca2e('0x34')](_0x43a37f,null,_0x43a37f+_0xca2e('0x38')+_0x4d6947+'.'+_0x23f6d6)[_0xca2e('0x13')](_0x4d6947+_0xca2e('0x39'),_0x1efd2e)[_0xca2e('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xca2e('0x13')](_0xca2e('0x3a'),selectNotIn(_0x4d6947,_0x43a37f,_0x23f6d6,_0xca2e('0x2c'),[_0xca2e('0x3b'),_0xca2e('0x3c')]))[_0xca2e('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4d6947,_0x43a37f,_0x23f6d6,'cm_hopper',[_0xca2e('0x3b')])))[_0xca2e('0x3d')]();}function insertCmHopperBlack(_0xcc5631,_0x17c864,_0x3526ed,_0x2dd787){var _0x57cc95=[_0xca2e('0x3e'),_0xca2e('0x26'),'cm_contacts.ListId',_0x17c864+'.'+_0x2dd787,'cm_contacts.createdAt',_0xca2e('0x28')];return squel['insert']()[_0xca2e('0x3f')](_0xca2e('0x40'))[_0xca2e('0x2d')]([_0xca2e('0x19'),_0xca2e('0x2e'),_0xca2e('0x2f'),_0x2dd787,'createdAt',_0xca2e('0x41')],squel[_0xca2e('0x11')]()[_0xca2e('0x42')](_0x57cc95)[_0xca2e('0x12')](_0x17c864)['join']('cm_contacts',null,_0xca2e('0x36')+_0x17c864+_0xca2e('0x37'))['join'](_0x3526ed,null,_0x3526ed+_0xca2e('0x38')+_0x17c864+'.'+_0x2dd787)[_0xca2e('0x13')](_0x17c864+_0xca2e('0x39'),_0xcc5631)[_0xca2e('0x13')](_0xca2e('0x43'),NOW)[_0xca2e('0x13')](_0xca2e('0x3a'),squel['select']()[_0xca2e('0x44')](_0xca2e('0x19'))['from'](_0xca2e('0x40'))[_0xca2e('0x13')]('ListId\x20=\x20?',_0xcc5631)[_0xca2e('0x13')](_0x2dd787+_0xca2e('0x45'),_0x17c864+'.'+_0x2dd787)))[_0xca2e('0x3d')]();}function insertCmHopperAdditionalPhones(_0x1cf01f){var _0x457427=[_0xca2e('0x46'),_0xca2e('0x47'),_0xca2e('0x48'),_0xca2e('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0xca2e('0x2b')]()[_0xca2e('0x3f')](_0xca2e('0x4a'))[_0xca2e('0x2d')](['CmHopperId',_0xca2e('0x19'),_0xca2e('0x4b'),'createdAt','updatedAt'],squel[_0xca2e('0x11')]()[_0xca2e('0x42')](_0x457427)[_0xca2e('0x12')](_0xca2e('0x2c'))['join']('cm_contacts',null,_0xca2e('0x4c'))[_0xca2e('0x34')](_0xca2e('0x4d'),null,_0xca2e('0x4e'))[_0xca2e('0x13')](_0xca2e('0x4f'),_0x1cf01f)[_0xca2e('0x13')](_0xca2e('0x43'),NOW))[_0xca2e('0x3d')]();}function insertCmContact(_0x5e8cb7,_0x45c349,_0x200fc6,_0x710b2e){var _0x5cb28f=_['concat'](_[_0xca2e('0x50')](_0x710b2e),[_0xca2e('0x2f'),_0xca2e('0x51'),_0xca2e('0x30'),_0xca2e('0x41')]);return squel[_0xca2e('0x2b')]()[_0xca2e('0x3f')](_0xca2e('0x35'))[_0xca2e('0x2d')](_0x5cb28f,squel[_0xca2e('0x11')]()['fields'](_0x5cb28f)[_0xca2e('0x12')](_0x45c349)[_0xca2e('0x13')]('('+_0x200fc6[_0xca2e('0x34')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xca2e('0x42')](_0x200fc6)[_0xca2e('0x12')]('cm_contacts')['where'](_0xca2e('0x52'),_0x5e8cb7))[_0xca2e('0x13')](_0xca2e('0x53'),squel['select']()[_0xca2e('0x44')](_0xca2e('0x54'),_0xca2e('0x55'))[_0xca2e('0x12')](_0x45c349)[_0xca2e('0x56')](_0x200fc6[_0xca2e('0x34')](','))))[_0xca2e('0x3d')]();}function handleStop(){logger[_0xca2e('0x57')](_0xca2e('0x58'));stopped=!![];}function handleUncaughtException(_0x365e92){logger[_0xca2e('0x59')](_0x365e92[_0xca2e('0x5a')]);process[_0xca2e('0x5b')](0x1);}function handleError(_0x312ab2,_0x433e25){stats[_0xca2e('0x5c')][_0xca2e('0x1c')]({'name':_0x433e25[_0xca2e('0x5d')],'message':_0x433e25['message'],'row':_0x312ab2});}function handleQuery(_0x450985){logger[_0xca2e('0x57')](_0x450985);return db[_0xca2e('0x15')][_0xca2e('0x16')](_0x450985)['spread'](function(_0x1ebede){results[_0xca2e('0x1c')](_0x1ebede);})['catch'](function(_0x2b51de){logger['error'](_0x2b51de[_0xca2e('0x5a')]);});}function main(_0x2979b2,_0x400bf4,_0x47f73e,_0xd354b1){logger[_0xca2e('0x57')](_0xca2e('0x5e'),_0x2979b2,JSON[_0xca2e('0x5f')](_0x400bf4));process[_0xca2e('0x60')](_0xca2e('0x61'));var _0x5e5592=_0x400bf4[_0xca2e('0x62')];var _0xc29a7=_[_0xca2e('0x63')](_0x5e5592);var _0x25c729=_0x400bf4[_0xca2e('0x64')];var _0x384a59=path['join'](config[_0xca2e('0x65')],_0xca2e('0x66'),_0x25c729+_0xca2e('0x67'));logger[_0xca2e('0x57')](_0xca2e('0x68'),_0x400bf4);db[_0xca2e('0x69')]['findAll']({'raw':!![],'attributes':['id',_0xca2e('0x6a')]})['then'](function(_0x3c5ecb){for(var _0xfcc191=0x0;_0xfcc191<_0x3c5ecb[_0xca2e('0x18')];_0xfcc191++){if(_0x3c5ecb[_0xfcc191]['name']in _0x5e5592){contactItemTypes[_0xca2e('0x1c')](_0x3c5ecb[_0xfcc191]);delete _0xc29a7[_0x3c5ecb[_0xfcc191][_0xca2e('0x6a')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0xc29a7['AdditionalPhones']='';var _0x3bda2f=_[_0xca2e('0x50')](_0xc29a7)['join']();logger['info'](_0xca2e('0x6b'),_0x3bda2f);fs[_0xca2e('0x6c')](_0x384a59,_0x3bda2f+'\x0a');Papa[_0xca2e('0x6d')](fs['createReadStream'](_0x2979b2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x34dc8e,_0x13d571){try{for(var _0x388bc7=0x0,_0x40c2ed=[];_0x388bc7<_0x34dc8e[_0xca2e('0x6e')][_0xca2e('0x18')];_0x388bc7++){stats[_0xca2e('0x6f')]+=0x1;if(_0x34dc8e[_0xca2e('0x5c')][_0x388bc7]){handleError(_0x34dc8e['data'][_0x388bc7],_0x34dc8e[_0xca2e('0x5c')][_0x388bc7]);}else{var _0x113375=[];var _0x3ad9c0=[];for(var _0x2e4c4f in _0x5e5592){let _0x418a28=contactItemTypes[_0xca2e('0x70')](_0x1207cc=>_0x1207cc[_0xca2e('0x6a')]===_0x2e4c4f);if(_[_0xca2e('0x1a')](_0x418a28)){if(_0x5e5592[_0xca2e('0x71')](_0x2e4c4f)){if(_0x34dc8e['data'][_0x388bc7][_0x5e5592[_0x2e4c4f]]){var _0x26f917=_[_0xca2e('0x72')](_0x34dc8e[_0xca2e('0x6e')][_0x388bc7][_0x5e5592[_0x2e4c4f]][_0xca2e('0x73')](/"/g,'\x27'));switch(_0x2e4c4f){case _0xca2e('0x74'):var _0x3e1f5b=moment(_0x26f917,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3e1f5b[_0xca2e('0x75')]()){_0x40c2ed[_0xca2e('0x1c')]('\x22'+_0x26f917+'\x22');}else{_0x113375[_0xca2e('0x1c')](_0xca2e('0x76'));}break;case _0xca2e('0x31'):var _0x253e56=parseInt(_0x26f917);_0x26f917=_[_0xca2e('0x77')](_0x253e56)||_0x253e56<0x0||_0x253e56>0x4?_0xd354b1?0x3:0x2:_0x253e56;_0x40c2ed['push']('\x22'+_0x26f917+'\x22');break;case _0xca2e('0x32'):var _0x134a3b=parseInt(_0x26f917);if(_[_0xca2e('0x78')](_0x134a3b)&&_[_0xca2e('0x79')](_0x47f73e,_0x134a3b)){_0x40c2ed[_0xca2e('0x1c')]('\x22'+_0x134a3b+'\x22');}else{_0x113375[_0xca2e('0x1c')](_0xca2e('0x7a'));}break;case'email':if(isEmail(_0x26f917)){_0x40c2ed[_0xca2e('0x1c')]('\x22'+_0x26f917+'\x22');}else{_0x113375[_0xca2e('0x1c')]('email\x20wrong\x20format');}break;case _0xca2e('0x7b'):var _0x38738d=moment(_0x26f917,_0xca2e('0x7c'),!![]);if(_0x38738d[_0xca2e('0x75')]()){_0x40c2ed[_0xca2e('0x1c')]('\x22'+_0x26f917+'\x22');}else{_0x113375[_0xca2e('0x1c')](_0xca2e('0x7d'));}break;default:_0x40c2ed['push']('\x22'+_0x26f917+'\x22');}}else{switch(_0x2e4c4f){case'firstName':case'phone':_0x113375['push'](_0x2e4c4f+_0xca2e('0x7e'));break;default:_0x40c2ed['push']('\x22\x22');}}}}else{var _0x5a0863='';for(var _0x3ca2c9=0x0;_0x3ca2c9<_0x5e5592[_0x2e4c4f][_0xca2e('0x18')];_0x3ca2c9++){var _0x26f917=_[_0xca2e('0x72')](_0x34dc8e[_0xca2e('0x6e')][_0x388bc7][_0x5e5592[_0x2e4c4f][_0x3ca2c9]][_0xca2e('0x73')](/"/g,'\x27'));if(_0x5a0863=='')_0x5a0863=_0x26f917;else _0x5a0863+='|'+_0x26f917;}_0x3ad9c0[_0xca2e('0x1c')](_0x418a28['id']+':'+_0x5a0863);}}if(hasAdditionalPhones){_0x40c2ed['push']('\x22'+_0x3ad9c0[_0xca2e('0x34')](';')+'\x22');}if(_0x113375[_0xca2e('0x18')]){handleError(_0x34dc8e[_0xca2e('0x6e')][_0x388bc7],{'code':_0xca2e('0x7f'),'message':_0x113375[_0xca2e('0x34')]()});}else{fs['appendFileSync'](_0x384a59,_0x40c2ed['join']()+'\x0a');}_0x40c2ed=[];}if(!(stats[_0xca2e('0x6f')]%0xc8)){socket['emit'](_0xca2e('0x80')+_0x25c729,stats);stats['errors']=[];}}if(stopped){logger[_0xca2e('0x57')]('Abort\x20parser');_0x13d571[_0xca2e('0x81')]();}}catch(_0x1e303c){handleError(_0x34dc8e[_0xca2e('0x6e')][_0x388bc7],{'code':'SystemError','message':_0x1e303c['message']});logger[_0xca2e('0x59')](_0xca2e('0x82'),_0x1e303c[_0xca2e('0x5a')]);}},'complete':function(){try{var _0x1d2a0a=[];var _0x4ede3d=tempTableName;_0x1d2a0a[_0xca2e('0x1c')]('CREATE\x20TABLE\x20'+_0x4ede3d+'\x20LIKE\x20cm_contacts;');logger['info'](_0xca2e('0x83'),contactItemTypes[_0xca2e('0x18')]);var _0x557c3a=util[_0xca2e('0xd')](_0xca2e('0x84'),_0x384a59,_0x4ede3d,_0x3bda2f,_0x400bf4['ListId'],_0x400bf4[_0xca2e('0x51')]||null,NOW,NOW);if(_[_0xca2e('0x1a')](_0x5e5592[_0xca2e('0x74')])){_0x557c3a+=_0xca2e('0x85');}_0x1d2a0a[_0xca2e('0x1c')](_0x557c3a);BPromise[_0xca2e('0x86')](_0x1d2a0a,handleQuery)[_0xca2e('0x1d')](function(_0x12d9f5){BPromise[_0xca2e('0x1f')]([handleAdditionalPhones()])['then'](function(){_0x1d2a0a=[];for(var _0x1490ab=0x0;_0x1490ab\x20\x20','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','socket.io-emitter','format'];(function(_0x1734ab,_0x254bb2){var _0x41008e=function(_0x131727){while(--_0x131727){_0x1734ab['push'](_0x1734ab['shift']());}};_0x41008e(++_0x254bb2);}(_0xf9c8,0x1c6));var _0x8f9c=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0xf9c8[_0x2fd160];return _0x5c2031;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8f9c('0x0'));var Papa=require(_0x8f9c('0x1'));var util=require(_0x8f9c('0x2'));var BPromise=require(_0x8f9c('0x3'));var moment=require(_0x8f9c('0x4'));var squel=require(_0x8f9c('0x5'));var Redis=require(_0x8f9c('0x6'));var db=require(_0x8f9c('0x7'))['db'];var config=require(_0x8f9c('0x8'));var logger=require('../../../config/logger')(_0x8f9c('0x9'));config[_0x8f9c('0xa')]=_[_0x8f9c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8f9c('0xc'))(new Redis(config[_0x8f9c('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()[_0x8f9c('0xd')](_0x8f9c('0xe'));var tempTableName=_0x8f9c('0xf')+moment()[_0x8f9c('0xd')](_0x8f9c('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x6b1f0a){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))*$/[_0x8f9c('0x11')](_0x6b1f0a);}function selectNotIn(_0x25bf1c,_0x1a22ba,_0x3f5828,_0x1c36dc,_0x130836){return squel[_0x8f9c('0x12')]()[_0x8f9c('0x13')]('phone')[_0x8f9c('0x14')](_0x1c36dc)[_0x8f9c('0x15')](_0x1a22ba,null,_0x1a22ba+_0x8f9c('0x16')+_0x1c36dc+'.'+_0x3f5828)[_0x8f9c('0x17')](_0x1c36dc+'.'+_0x3f5828+_0x8f9c('0x18')+_0x25bf1c+'.'+_0x3f5828)[_0x8f9c('0x17')](_0x1a22ba+_0x8f9c('0x19')+_0x130836[_0x8f9c('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x43908f,_0x2e0d15){promisesAdditionalPhones=[];promisesContact=[];return db[_0x8f9c('0x1a')][_0x8f9c('0x1b')]('select\x20*\x20from\x20'+tempTableName)[_0x8f9c('0x1c')](function(_0x167346){if(_0x167346!==null){var _0x343df6=[];for(var _0x4f30e2=0x0;_0x4f30e2<_0x167346[_0x8f9c('0x1d')];_0x4f30e2++){var _0x5174f2=_0x167346[_0x4f30e2];if(!_['isNil'](_0x5174f2[_0x8f9c('0x1e')])){if(!_[_0x8f9c('0x1f')](_0x5174f2['AdditionalPhones']))_0x343df6[_0x8f9c('0x20')](insertAdditionalPhones(_0x5174f2));promisesContact[_0x8f9c('0x20')]({'contact':_0x5174f2});}}}Promise[_0x8f9c('0x21')](_0x343df6)[_0x8f9c('0x22')](function(){_0x43908f({'val':0x1});});})['catch'](function(_0x238f08){logger['error'](_0x238f08[_0x8f9c('0x23')]);});});}function insertAdditionalPhones(_0x403736){return new Promise(function(_0x285c88,_0x52d31d){var _0x565e17=_0x403736[_0x8f9c('0x24')];if(_['isNil'](_0x565e17))_0x52d31d({'val':0x0});else{var _0x422d11=_0x565e17[_0x8f9c('0x25')](';');var _0x3da1d0=[];orderBy=0x0;for(var _0x5b452d=0x0;_0x5b452d<_0x422d11[_0x8f9c('0x1d')];_0x5b452d++){_0x3da1d0[_0x8f9c('0x20')](splitAdditionalPhone(_0x403736['id'],_0x422d11[_0x5b452d]));}Promise[_0x8f9c('0x21')](_0x3da1d0)[_0x8f9c('0x22')](function(){_0x285c88({'val':_0x422d11[_0x8f9c('0x1d')]});});}});}function splitAdditionalPhone(_0x24029a,_0x36aad5){return new Promise(function(_0x4d8de4,_0x40065a){var _0x12eeb3=_0x36aad5[_0x8f9c('0x25')](':');var _0x5b353d=_0x12eeb3[0x0];var _0x42700=_0x12eeb3[0x1];if(_0x42700!==''){var _0x5977e5=_0x42700[_0x8f9c('0x25')]('|');var _0x4f67f0=[];for(var _0x1c953d=0x0;_0x1c953d<_0x5977e5[_0x8f9c('0x1d')];_0x1c953d++){if(_0x5977e5[_0x1c953d]!==''){var _0x2717e4=_[_0x8f9c('0x26')](promisesAdditionalPhones,{'contactId':_0x24029a,'phone':_0x5977e5[_0x1c953d]});if(_0x2717e4[_0x8f9c('0x1d')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x24029a,'contactTypeId':_0x5b353d,'phone':_0x5977e5[_0x1c953d],'orderBy':orderBy});}}}_0x4d8de4({'ok':0x1});}else _0x4d8de4({'res':0x0});});}function createAdditionalPhone(_0x4497cd,_0x2cbbd5,_0x49fcbe,_0x160110){return new Promise(function(_0x22444f,_0x131e09){return db['CmContactHasItem'][_0x8f9c('0x27')]({'where':{'CmContactId':_0x4497cd,'item':_0x49fcbe}})[_0x8f9c('0x22')](function(_0x221d3d){if(_0x221d3d){return db[_0x8f9c('0x28')][_0x8f9c('0x29')]({'ItemTypeId':_0x2cbbd5,'OrderBy':_0x160110},{'where':{'CmContactId':_0x4497cd,'item':_0x49fcbe}})[_0x8f9c('0x22')](function(_0x333979){_0x22444f({'res':_0x8f9c('0x2a')});});}else{return db[_0x8f9c('0x28')][_0x8f9c('0x2b')]({'CmContactId':_0x4497cd,'item':_0x49fcbe,'ItemTypeId':_0x2cbbd5,'OrderBy':_0x160110,'ItemClass':_0x8f9c('0x2c')})['then'](function(_0x1003ee){_0x22444f({'res':'inserted'});});}});});}function updateContact(_0x583ec4){return new Promise(function(_0x43183b,_0x417810){var _0x47f0d1=_0x583ec4['id'];delete _0x583ec4['id'];return db['CmContact'][_0x8f9c('0x29')](_0x583ec4,{'where':{'id':_0x47f0d1}})[_0x8f9c('0x22')](function(_0x4ed2d5){updatedRows+=0x1;return db['CmHopper'][_0x8f9c('0x29')]({'phone':_0x583ec4['phone']},{'where':{'ContactId':_0x47f0d1}})[_0x8f9c('0x22')](function(_0x38cb83){_0x43183b({'ret':'OK'});});});});}function insertCmHopper(_0x266cdb,_0x2db82b,_0x3ccd67,_0x297267,_0x3da55f){var _0x2dc872=[_0x8f9c('0x2d'),_0x8f9c('0x2e'),_0x8f9c('0x2f'),_0x8f9c('0x30'),_0x2db82b+'.'+_0x297267,_0x8f9c('0x31'),_0x8f9c('0x32'),'cm_contacts.priority',_0x8f9c('0x33'),'\x22'+_0x3da55f+'\x22'];return squel[_0x8f9c('0x34')]()['into'](_0x8f9c('0x35'))[_0x8f9c('0x36')](['phone',_0x8f9c('0x37'),'ContactId',_0x8f9c('0x38'),_0x297267,_0x8f9c('0x39'),_0x8f9c('0x3a'),'priority',_0x8f9c('0x3b'),'recallme'],squel[_0x8f9c('0x12')]()[_0x8f9c('0x3c')](_0x2dc872)[_0x8f9c('0x14')](_0x2db82b)[_0x8f9c('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x2db82b+_0x8f9c('0x3d'))[_0x8f9c('0x15')](_0x3ccd67,null,_0x3ccd67+'.id\x20=\x20'+_0x2db82b+'.'+_0x297267)[_0x8f9c('0x17')](_0x2db82b+_0x8f9c('0x3e'),_0x266cdb)[_0x8f9c('0x17')](_0x8f9c('0x3f'),NOW)['where'](_0x8f9c('0x40'),selectNotIn(_0x2db82b,_0x3ccd67,_0x297267,_0x8f9c('0x35'),['\x22always\x22',_0x8f9c('0x41')]))['where'](_0x8f9c('0x40'),selectNotIn(_0x2db82b,_0x3ccd67,_0x297267,_0x8f9c('0x35'),['\x22always\x22'])))[_0x8f9c('0x42')]();}function insertCmHopperBlack(_0x25c601,_0x1c06a1,_0x4e9b79,_0x5c0060){var _0x40be09=[_0x8f9c('0x2d'),_0x8f9c('0x2f'),_0x8f9c('0x30'),_0x1c06a1+'.'+_0x5c0060,_0x8f9c('0x31'),_0x8f9c('0x32')];return squel[_0x8f9c('0x34')]()[_0x8f9c('0x43')](_0x8f9c('0x44'))[_0x8f9c('0x36')]([_0x8f9c('0x1e'),_0x8f9c('0x45'),_0x8f9c('0x38'),_0x5c0060,_0x8f9c('0x39'),'updatedAt'],squel['select']()['fields'](_0x40be09)[_0x8f9c('0x14')](_0x1c06a1)[_0x8f9c('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1c06a1+'.CmListId')[_0x8f9c('0x15')](_0x4e9b79,null,_0x4e9b79+_0x8f9c('0x16')+_0x1c06a1+'.'+_0x5c0060)['where'](_0x1c06a1+_0x8f9c('0x3e'),_0x25c601)[_0x8f9c('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8f9c('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8f9c('0x12')]()['field'](_0x8f9c('0x1e'))['from'](_0x8f9c('0x44'))[_0x8f9c('0x17')](_0x8f9c('0x46'),_0x25c601)[_0x8f9c('0x17')](_0x5c0060+_0x8f9c('0x47'),_0x1c06a1+'.'+_0x5c0060)))[_0x8f9c('0x42')]();}function insertCmHopperAdditionalPhones(_0x2d52c3){var _0x4069b7=['cm_hopper.id',_0x8f9c('0x48'),_0x8f9c('0x49'),_0x8f9c('0x4a'),_0x8f9c('0x4b')];return squel[_0x8f9c('0x34')]()['into'](_0x8f9c('0x4c'))[_0x8f9c('0x36')]([_0x8f9c('0x4d'),_0x8f9c('0x1e'),_0x8f9c('0x4e'),_0x8f9c('0x39'),_0x8f9c('0x3a')],squel[_0x8f9c('0x12')]()['fields'](_0x4069b7)[_0x8f9c('0x14')](_0x8f9c('0x35'))[_0x8f9c('0x15')]('cm_contacts',null,_0x8f9c('0x4f'))[_0x8f9c('0x15')](_0x8f9c('0x50'),null,_0x8f9c('0x51'))[_0x8f9c('0x17')](_0x8f9c('0x52'),_0x2d52c3)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x8f9c('0x42')]();}function insertCmContact(_0x2967c8,_0x3e5398,_0x44d253,_0x11d29b){var _0x1f6f68=_[_0x8f9c('0x53')](_['keys'](_0x11d29b),[_0x8f9c('0x38'),'CompanyId',_0x8f9c('0x39'),_0x8f9c('0x3a')]);return squel['insert']()['into'](_0x8f9c('0x54'))[_0x8f9c('0x36')](_0x1f6f68,squel[_0x8f9c('0x12')]()[_0x8f9c('0x3c')](_0x1f6f68)[_0x8f9c('0x14')](_0x3e5398)['where']('('+_0x44d253[_0x8f9c('0x15')](',')+_0x8f9c('0x55'),squel['select']()[_0x8f9c('0x3c')](_0x44d253)['from'](_0x8f9c('0x54'))['where'](_0x8f9c('0x46'),_0x2967c8))[_0x8f9c('0x17')]('id\x20IN\x20?',squel[_0x8f9c('0x12')]()[_0x8f9c('0x13')](_0x8f9c('0x56'),_0x8f9c('0x57'))[_0x8f9c('0x14')](_0x3e5398)[_0x8f9c('0x58')](_0x44d253[_0x8f9c('0x15')](','))))[_0x8f9c('0x42')]();}function handleStop(){logger['info'](_0x8f9c('0x59'));stopped=!![];}function handleUncaughtException(_0x49b3b7){logger['error'](_0x49b3b7[_0x8f9c('0x23')]);process['exit'](0x1);}function handleError(_0x91f0b0,_0x5b148c){stats[_0x8f9c('0x5a')][_0x8f9c('0x20')]({'name':_0x5b148c[_0x8f9c('0x5b')],'message':_0x5b148c[_0x8f9c('0x23')],'row':_0x91f0b0});}function handleQuery(_0x51afb4){logger[_0x8f9c('0x5c')](_0x51afb4);return db['sequelize'][_0x8f9c('0x1b')](_0x51afb4)[_0x8f9c('0x1c')](function(_0x4a5483){results['push'](_0x4a5483);})[_0x8f9c('0x5d')](function(_0x26a798){logger['error'](_0x26a798[_0x8f9c('0x23')]);});}function main(_0x1879a0,_0x458086,_0x37b97,_0x162300){logger['info']('main',_0x1879a0,JSON['stringify'](_0x458086));process['send']('start');var _0x47b739=_0x458086[_0x8f9c('0x5e')];var _0x20282a=_[_0x8f9c('0x5f')](_0x47b739);var _0x58bd82=_0x458086[_0x8f9c('0x60')];var _0x4d5cf9=path[_0x8f9c('0x15')](config[_0x8f9c('0x61')],'server/files/tmp',_0x58bd82+_0x8f9c('0x62'));logger[_0x8f9c('0x5c')]('body',_0x458086);db[_0x8f9c('0x63')][_0x8f9c('0x64')]({'raw':!![],'attributes':['id','name']})[_0x8f9c('0x22')](function(_0x31dc0b){for(var _0x4d8771=0x0;_0x4d8771<_0x31dc0b['length'];_0x4d8771++){if(_0x31dc0b[_0x4d8771][_0x8f9c('0x65')]in _0x47b739){contactItemTypes[_0x8f9c('0x20')](_0x31dc0b[_0x4d8771]);delete _0x20282a[_0x31dc0b[_0x4d8771]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x20282a[_0x8f9c('0x24')]='';var _0x2756cd=_[_0x8f9c('0x66')](_0x20282a)[_0x8f9c('0x15')]();logger['info'](_0x8f9c('0x67'),_0x2756cd);fs[_0x8f9c('0x68')](_0x4d5cf9,_0x2756cd+'\x0a');Papa[_0x8f9c('0x69')](fs[_0x8f9c('0x6a')](_0x1879a0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x362570,_0x415e5b){try{for(var _0x2a2fa5=0x0,_0xf84b56=[];_0x2a2fa5<_0x362570[_0x8f9c('0x6b')][_0x8f9c('0x1d')];_0x2a2fa5++){stats[_0x8f9c('0x6c')]+=0x1;if(_0x362570[_0x8f9c('0x5a')][_0x2a2fa5]){handleError(_0x362570[_0x8f9c('0x6b')][_0x2a2fa5],_0x362570['errors'][_0x2a2fa5]);}else{var _0x897a1b=[];var _0x415bc8=[];for(var _0x5820d9 in _0x47b739){let _0x314a4f=contactItemTypes[_0x8f9c('0x6d')](_0x20d7ea=>_0x20d7ea['name']===_0x5820d9);if(_[_0x8f9c('0x1f')](_0x314a4f)){if(_0x47b739[_0x8f9c('0x6e')](_0x5820d9)){if(_0x362570['data'][_0x2a2fa5][_0x47b739[_0x5820d9]]){var _0x5ba0e1=_[_0x8f9c('0x6f')](_0x362570['data'][_0x2a2fa5][_0x47b739[_0x5820d9]][_0x8f9c('0x70')](/"/g,'\x27'));switch(_0x5820d9){case _0x8f9c('0x37'):var _0x1b0e83=moment(_0x5ba0e1,_0x8f9c('0xe'),!![]);if(_0x1b0e83[_0x8f9c('0x71')]()){_0xf84b56[_0x8f9c('0x20')]('\x22'+_0x5ba0e1+'\x22');}else{_0x897a1b['push'](_0x8f9c('0x72'));}break;case _0x8f9c('0x73'):var _0x104271=parseInt(_0x5ba0e1);_0x5ba0e1=_[_0x8f9c('0x74')](_0x104271)||_0x104271<0x0||_0x104271>0x4?_0x162300?0x3:0x2:_0x104271;_0xf84b56[_0x8f9c('0x20')]('\x22'+_0x5ba0e1+'\x22');break;case _0x8f9c('0x3b'):var _0x15d3fa=parseInt(_0x5ba0e1);if(_['isNumber'](_0x15d3fa)&&_[_0x8f9c('0x75')](_0x37b97,_0x15d3fa)){_0xf84b56['push']('\x22'+_0x15d3fa+'\x22');}else{_0x897a1b[_0x8f9c('0x20')](_0x8f9c('0x76'));}break;case _0x8f9c('0x77'):if(isEmail(_0x5ba0e1)){_0xf84b56['push']('\x22'+_0x5ba0e1+'\x22');}else{_0x897a1b[_0x8f9c('0x20')]('email\x20wrong\x20format');}break;case _0x8f9c('0x78'):var _0x392581=moment(_0x5ba0e1,'YYYY-MM-DD',!![]);if(_0x392581[_0x8f9c('0x71')]()){_0xf84b56[_0x8f9c('0x20')]('\x22'+_0x5ba0e1+'\x22');}else{_0x897a1b['push'](_0x8f9c('0x79'));}break;default:_0xf84b56['push']('\x22'+_0x5ba0e1+'\x22');}}else{switch(_0x5820d9){case _0x8f9c('0x7a'):case'phone':_0x897a1b[_0x8f9c('0x20')](_0x5820d9+_0x8f9c('0x7b'));break;default:_0xf84b56[_0x8f9c('0x20')]('\x22\x22');}}}}else{var _0x3ecee5='';for(var _0x260c71=0x0;_0x260c71<_0x47b739[_0x5820d9][_0x8f9c('0x1d')];_0x260c71++){var _0x5ba0e1=_[_0x8f9c('0x6f')](_0x362570[_0x8f9c('0x6b')][_0x2a2fa5][_0x47b739[_0x5820d9][_0x260c71]][_0x8f9c('0x70')](/"/g,'\x27'));if(_0x3ecee5=='')_0x3ecee5=_0x5ba0e1;else _0x3ecee5+='|'+_0x5ba0e1;}_0x415bc8[_0x8f9c('0x20')](_0x314a4f['id']+':'+_0x3ecee5);}}if(hasAdditionalPhones){_0xf84b56[_0x8f9c('0x20')]('\x22'+_0x415bc8[_0x8f9c('0x15')](';')+'\x22');}if(_0x897a1b[_0x8f9c('0x1d')]){handleError(_0x362570[_0x8f9c('0x6b')][_0x2a2fa5],{'code':_0x8f9c('0x7c'),'message':_0x897a1b[_0x8f9c('0x15')]()});}else{fs[_0x8f9c('0x7d')](_0x4d5cf9,_0xf84b56[_0x8f9c('0x15')]()+'\x0a');}_0xf84b56=[];}if(!(stats[_0x8f9c('0x6c')]%0xc8)){socket[_0x8f9c('0x7e')](_0x8f9c('0x7f')+_0x58bd82,stats);stats[_0x8f9c('0x5a')]=[];}}if(stopped){logger[_0x8f9c('0x5c')](_0x8f9c('0x80'));_0x415e5b[_0x8f9c('0x81')]();}}catch(_0xb23fa6){handleError(_0x362570[_0x8f9c('0x6b')][_0x2a2fa5],{'code':_0x8f9c('0x82'),'message':_0xb23fa6[_0x8f9c('0x23')]});logger[_0x8f9c('0x83')](_0x8f9c('0x84'),_0xb23fa6[_0x8f9c('0x23')]);}},'complete':function(){try{var _0xea9be0=[];var _0x295460=tempTableName;_0xea9be0[_0x8f9c('0x20')](_0x8f9c('0x85')+_0x295460+_0x8f9c('0x86'));logger[_0x8f9c('0x5c')](_0x8f9c('0x87'),contactItemTypes['length']);var _0x44748f=util[_0x8f9c('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4d5cf9,_0x295460,_0x2756cd,_0x458086[_0x8f9c('0x38')],_0x458086[_0x8f9c('0x88')]||null,NOW,NOW);if(_['isNil'](_0x47b739[_0x8f9c('0x37')])){_0x44748f+=_0x8f9c('0x89');}_0xea9be0[_0x8f9c('0x20')](_0x44748f);BPromise[_0x8f9c('0x8a')](_0xea9be0,handleQuery)['then'](function(_0x289ec0){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0xea9be0=[];for(var _0x587e38=0x0;_0x587e38=_0x45ad02){return _0x400cbb['status'](0x193)['json']({'message':util[_0x15eb('0x12')](_0x15eb('0x13'),_0x1ea52e)});}_0x1470f7();})[_0x15eb('0x14')](function(_0x5c8a1a){_0x1470f7(_0x5c8a1a);});});}function isUserLimit(){return isLimit(_0x15eb('0x15'),0x1,db[_0x15eb('0x16')],{'where':{'$or':[{'role':_0x15eb('0x17')},{'role':'user'}]}});}exports[_0x15eb('0x18')]=isUserLimit; \ No newline at end of file +var _0x0218=['count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','use','License','findOne','then'];(function(_0x399fa6,_0x5cce5b){var _0x5320c2=function(_0x768e6a){while(--_0x768e6a){_0x399fa6['push'](_0x399fa6['shift']());}};_0x5320c2(++_0x5cce5b);}(_0x0218,0x120));var _0x8021=function(_0x41cdde,_0x4bd78c){_0x41cdde=_0x41cdde-0x0;var _0x2dec1e=_0x0218[_0x41cdde];return _0x2dec1e;};'use strict';var crypto=require(_0x8021('0x0'));var util=require(_0x8021('0x1'));var compose=require(_0x8021('0x2'));var db=require(_0x8021('0x3'))['db'];var config=require(_0x8021('0x4'));function getValueFromLicense(_0x52cb0c,_0x5544ec){if(_0x52cb0c&&_0x5544ec){if(_0x5544ec[_0x8021('0x5')]&&_0x5544ec[_0x8021('0x6')]){var _0x5e12de=_0x5544ec[_0x8021('0x5')];var _0x55681a=_0x5544ec['license'];var _0x9d599a=_0x5e12de[_0x8021('0x7')]('-')[0x4];var _0x240283=_0x5e12de['split']('-')[0x0];var _0x5a5f97=crypto[_0x8021('0x8')](_0x8021('0x9'),util[_0x8021('0xa')](_0x8021('0xb'),_0x9d599a,_0x5e12de,_0x240283));var _0x48e8e4=_0x5a5f97[_0x8021('0xc')](_0x55681a,_0x8021('0xd'),_0x8021('0xe'));_0x48e8e4+=_0x5a5f97['final'](_0x8021('0xe'));var _0x1db499=JSON[_0x8021('0xf')](_0x48e8e4);return _0x1db499['hasOwnProperty'](_0x52cb0c)?_0x1db499[_0x52cb0c]:null;}}return null;}function isLimit(_0xcf04a5,_0x3cdd03,_0x41fd1e,_0x36fe1a){var _0x24e0f9=_0x3cdd03;return compose()[_0x8021('0x10')](function(_0x1e0f1d,_0x43f587,_0x494d17){return db[_0x8021('0x11')][_0x8021('0x12')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x339ce0){var _0x527437=getValueFromLicense(_0xcf04a5,_0x339ce0);return _0x527437?_0x527437:_0x24e0f9;})[_0x8021('0x13')](function(_0x498253){_0x24e0f9=_0x498253;return _0x41fd1e[_0x8021('0x14')](_0x36fe1a);})[_0x8021('0x13')](function(_0x831508){if(_0x831508>=_0x24e0f9){return _0x43f587['status'](0x193)[_0x8021('0x15')]({'message':util[_0x8021('0xa')](_0x8021('0x16'),_0xcf04a5)});}_0x494d17();})[_0x8021('0x17')](function(_0x592664){_0x494d17(_0x592664);});});}function isUserLimit(){return isLimit(_0x8021('0x18'),0x1,db[_0x8021('0x19')],{'where':{'$or':[{'role':'admin'},{'role':_0x8021('0x1a')}]}});}exports[_0x8021('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index b0601cb..7d17d5b 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 _0xb722=['map','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','text','CAST(','field','\x20AS\x20','castTo','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$eq','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','start','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','[$or]','[$and]','replace','split','length','slice','shift','match','forEach'];(function(_0x52b34e,_0x5a7866){var _0x32cd15=function(_0x9f1238){while(--_0x9f1238){_0x52b34e['push'](_0x52b34e['shift']());}};_0x32cd15(++_0x5a7866);}(_0xb722,0x90));var _0x2b72=function(_0x51ce33,_0x65e79){_0x51ce33=_0x51ce33-0x0;var _0x180f00=_0xb722[_0x51ce33];return _0x180f00;};'use strict';var _=require(_0x2b72('0x0'));var moment=require('moment');exports[_0x2b72('0x1')]=function(_0x3bf58a){var _0x32611f={'conditions':[]};_0x32611f[_0x2b72('0x2')]=_['startsWith'](_0x3bf58a,_0x2b72('0x3'))?'or':'and';var _0x5aeac9=_0x3bf58a['replace'](_0x2b72('0x4'),'')[_0x2b72('0x5')](_0x2b72('0x3'),'')[_0x2b72('0x6')]('||');for(var _0x317b6f=0x0;_0x317b6f<_0x5aeac9[_0x2b72('0x7')];_0x317b6f++){var _0x310940=_0x5aeac9[_0x317b6f][_0x2b72('0x6')](':=');var _0x1fb499=_0x310940[0x0];var _0xc85950=_0x310940[_0x2b72('0x8')](0x1);_0xc85950['forEach'](function(_0x1ef222){var _0x4a2c1a=_0x1ef222['split']('[')[_0x2b72('0x9')]();var _0x20d66a=_0x1ef222[_0x2b72('0xa')](/\[(.*?)\]/g);_0x20d66a[_0x2b72('0xb')](function(_0x2dbc3a){var _0x48712c=_0x2dbc3a[_0x2b72('0x6')]('[')['filter'](function(_0x14c5fb){return _0x14c5fb['indexOf'](']')>-0x1;})[_0x2b72('0xc')](function(_0x7f07d8){return _0x7f07d8['split'](']')[0x0];})[0x0];_0x32611f['conditions'][_0x2b72('0xd')]({'field':_0x1fb499,'operator':_0x4a2c1a,'value':_0x48712c});});});}return _0x32611f;};exports[_0x2b72('0xe')]=function(_0x5ca1e3,_0x58b97a,_0x4678fe){var _0x25c10f={};if(_0x58b97a===_0x2b72('0xf')){if(_0x4678fe[_0x2b72('0x10')]==='$eq'){_0x4678fe[_0x2b72('0x10')]=_0x2b72('0x11');_0x4678fe[_0x2b72('0x12')]+=','+_0x4678fe[_0x2b72('0x12')];}else if(_[_0x2b72('0x13')]([_0x2b72('0x14'),_0x2b72('0x15')],_0x4678fe[_0x2b72('0x10')])){_0x4678fe[_0x2b72('0x12')]=moment(_0x4678fe[_0x2b72('0x12')])[_0x2b72('0x16')](0x1,_0x2b72('0x17'))[_0x2b72('0x18')](_0x2b72('0x19'));}}if(_0x4678fe['castTo']){_0x58b97a=_0x4678fe['castTo'];_0x25c10f[_0x2b72('0x1a')]=_0x2b72('0x1b')+_0x5ca1e3+'.'+_0x4678fe[_0x2b72('0x1c')]+_0x2b72('0x1d')+_0x4678fe[_0x2b72('0x1e')]+')\x20'+parseOperator(_0x4678fe['operator']);}else{_0x25c10f[_0x2b72('0x1a')]=_0x5ca1e3+'.'+_0x4678fe[_0x2b72('0x1c')]+'\x20'+parseOperator(_0x4678fe['operator']);}if(_['includes']([_0x2b72('0x1f'),'$notIn'],_0x4678fe[_0x2b72('0x10')]))_0x25c10f[_0x2b72('0x1a')]='('+_0x25c10f[_0x2b72('0x1a')]+_0x2b72('0x20')+_0x5ca1e3+'.'+_0x4678fe[_0x2b72('0x1c')]+_0x2b72('0x21');_0x25c10f[_0x2b72('0x12')]=parseValue(_0x58b97a,_0x4678fe['operator'],_0x4678fe[_0x2b72('0x12')]);return _0x25c10f;};function parseOperator(_0x2f2f2d){var _0x477676;switch(_0x2f2f2d){case _0x2b72('0x22'):_0x477676=_0x2b72('0x23');break;case'$notIn':_0x477676='NOT\x20IN\x20?';break;case _0x2b72('0x24'):_0x477676='=\x20?';break;case'$ne':_0x477676=_0x2b72('0x25');break;case _0x2b72('0x26'):case _0x2b72('0x27'):case'$endsWith':_0x477676=_0x2b72('0x28');break;case _0x2b72('0x29'):_0x477676=_0x2b72('0x2a');break;case _0x2b72('0x14'):_0x477676=_0x2b72('0x2b');break;case _0x2b72('0x15'):_0x477676=_0x2b72('0x2c');break;case _0x2b72('0x2d'):_0x477676='>=\x20?';break;case _0x2b72('0x11'):_0x477676='BETWEEN\x20?\x20AND\x20?';break;}return _0x477676;}function parseValue(_0x480c67,_0x37e77b,_0x554875){var _0x59af08={'start':undefined,'end':undefined};switch(_0x37e77b){case _0x2b72('0x22'):case'$notIn':_0x59af08['start']=_0x554875[_0x2b72('0x6')](',');break;case _0x2b72('0x26'):_0x59af08['start']='%'+_0x554875+'%';break;case _0x2b72('0x27'):_0x59af08[_0x2b72('0x2e')]=_0x554875+'%';break;case'$endsWith':_0x59af08[_0x2b72('0x2e')]='%'+_0x554875;break;case _0x2b72('0x11'):var _0x19fbe2=_0x554875['split'](',');var _0x554875=_0x19fbe2['shift']();var _0x48655f=_0x19fbe2[_0x2b72('0x2f')]();if(_0x480c67===_0x2b72('0xf')){_0x554875=moment(_0x554875)[_0x2b72('0x30')](0x0,!![])['format']();_0x48655f=moment(_0x48655f)['utcOffset'](0x0,!![])['add'](0x17,_0x2b72('0x31'))[_0x2b72('0x16')](0x3b,_0x2b72('0x32'))[_0x2b72('0x16')](0x3b,_0x2b72('0x33'))['format']();}_0x59af08={'start':_0x554875,'end':_0x48655f};break;default:_0x59af08['start']=_0x554875;break;}return _0x59af08;} \ No newline at end of file +var _0x4654=['value','$lte','format','castTo','CAST(','text','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','$gt','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','add','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','split','forEach','shift','match','indexOf','conditions','push','buildExpression','operator','$between'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4654,0x167));var _0x4465=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4654[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4465('0x0'));var moment=require(_0x4465('0x1'));exports[_0x4465('0x2')]=function(_0x4bc8af){var _0x4e1681={'conditions':[]};_0x4e1681[_0x4465('0x3')]=_[_0x4465('0x4')](_0x4bc8af,_0x4465('0x5'))?'or':'and';var _0x4fefa0=_0x4bc8af[_0x4465('0x6')]('[$and]','')[_0x4465('0x6')](_0x4465('0x5'),'')[_0x4465('0x7')]('||');for(var _0x470f55=0x0;_0x470f55<_0x4fefa0['length'];_0x470f55++){var _0x4a07c0=_0x4fefa0[_0x470f55][_0x4465('0x7')](':=');var _0x3f8e74=_0x4a07c0[0x0];var _0x37ad77=_0x4a07c0['slice'](0x1);_0x37ad77[_0x4465('0x8')](function(_0x244afd){var _0x4edbb2=_0x244afd[_0x4465('0x7')]('[')[_0x4465('0x9')]();var _0x4429e2=_0x244afd[_0x4465('0xa')](/\[(.*?)\]/g);_0x4429e2[_0x4465('0x8')](function(_0x58dbe7){var _0xa65fd5=_0x58dbe7[_0x4465('0x7')]('[')['filter'](function(_0x27698e){return _0x27698e[_0x4465('0xb')](']')>-0x1;})['map'](function(_0x1b294b){return _0x1b294b[_0x4465('0x7')](']')[0x0];})[0x0];_0x4e1681[_0x4465('0xc')][_0x4465('0xd')]({'field':_0x3f8e74,'operator':_0x4edbb2,'value':_0xa65fd5});});});}return _0x4e1681;};exports[_0x4465('0xe')]=function(_0x364bec,_0x1a3e36,_0x37941b){var _0x155c2b={};if(_0x1a3e36==='DATE'){if(_0x37941b[_0x4465('0xf')]==='$eq'){_0x37941b[_0x4465('0xf')]=_0x4465('0x10');_0x37941b[_0x4465('0x11')]+=','+_0x37941b['value'];}else if(_['includes'](['$gt',_0x4465('0x12')],_0x37941b['operator'])){_0x37941b['value']=moment(_0x37941b['value'])['add'](0x1,'days')[_0x4465('0x13')]('YYYY-MM-DD');}}if(_0x37941b['castTo']){_0x1a3e36=_0x37941b[_0x4465('0x14')];_0x155c2b['text']=_0x4465('0x15')+_0x364bec+'.'+_0x37941b['field']+'\x20AS\x20'+_0x37941b[_0x4465('0x14')]+')\x20'+parseOperator(_0x37941b[_0x4465('0xf')]);}else{_0x155c2b[_0x4465('0x16')]=_0x364bec+'.'+_0x37941b[_0x4465('0x17')]+'\x20'+parseOperator(_0x37941b[_0x4465('0xf')]);}if(_[_0x4465('0x18')]([_0x4465('0x19'),_0x4465('0x1a')],_0x37941b['operator']))_0x155c2b[_0x4465('0x16')]='('+_0x155c2b['text']+_0x4465('0x1b')+_0x364bec+'.'+_0x37941b[_0x4465('0x17')]+_0x4465('0x1c');_0x155c2b['value']=parseValue(_0x1a3e36,_0x37941b['operator'],_0x37941b[_0x4465('0x11')]);return _0x155c2b;};function parseOperator(_0x291084){var _0x82d8ba;switch(_0x291084){case _0x4465('0x1d'):_0x82d8ba=_0x4465('0x1e');break;case'$notIn':_0x82d8ba=_0x4465('0x1f');break;case'$eq':_0x82d8ba='=\x20?';break;case _0x4465('0x19'):_0x82d8ba='<>\x20?';break;case _0x4465('0x20'):case _0x4465('0x21'):case _0x4465('0x22'):_0x82d8ba=_0x4465('0x23');break;case'$lt':_0x82d8ba=_0x4465('0x24');break;case _0x4465('0x25'):_0x82d8ba='>\x20?';break;case'$lte':_0x82d8ba='<=\x20?';break;case'$gte':_0x82d8ba=_0x4465('0x26');break;case _0x4465('0x10'):_0x82d8ba=_0x4465('0x27');break;}return _0x82d8ba;}function parseValue(_0x414577,_0x5dad91,_0x171e57){var _0x4a2517={'start':undefined,'end':undefined};switch(_0x5dad91){case'$in':case _0x4465('0x1a'):_0x4a2517[_0x4465('0x28')]=_0x171e57[_0x4465('0x7')](',');break;case _0x4465('0x20'):_0x4a2517[_0x4465('0x28')]='%'+_0x171e57+'%';break;case'$startsWith':_0x4a2517[_0x4465('0x28')]=_0x171e57+'%';break;case _0x4465('0x22'):_0x4a2517['start']='%'+_0x171e57;break;case _0x4465('0x10'):var _0x33665d=_0x171e57[_0x4465('0x7')](',');var _0x171e57=_0x33665d[_0x4465('0x9')]();var _0x343a96=_0x33665d[_0x4465('0x29')]();if(_0x414577===_0x4465('0x2a')){_0x171e57=moment(_0x171e57)['utcOffset'](0x0,!![])[_0x4465('0x13')]();_0x343a96=moment(_0x343a96)[_0x4465('0x2b')](0x0,!![])[_0x4465('0x2c')](0x17,_0x4465('0x2d'))[_0x4465('0x2c')](0x3b,'minutes')[_0x4465('0x2c')](0x3b,_0x4465('0x2e'))[_0x4465('0x13')]();}_0x4a2517={'start':_0x171e57,'end':_0x343a96};break;default:_0x4a2517[_0x4465('0x28')]=_0x171e57;break;}return _0x4a2517;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 29dce80..d4b9e90 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 _0x2c47=['fields','split','filters','isEmpty','type','isPlainObject','parse','$gte','$lte','format','YYYY-MM-DD','utc','subtract','isArray','limit','offset','sort','map','indexOf','priority','cast','DESC','col','unsigned','ASC','length','omit','isObject','isString','hasOwnProperty','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','lodash','moment'];(function(_0x3d7a9e,_0x1686d7){var _0x28c9b8=function(_0x1c136d){while(--_0x1c136d){_0x3d7a9e['push'](_0x3d7a9e['shift']());}};_0x28c9b8(++_0x1686d7);}(_0x2c47,0xe8));var _0x72c4=function(_0x193943,_0x39550c){_0x193943=_0x193943-0x0;var _0x37ca16=_0x2c47[_0x193943];return _0x37ca16;};'use strict';var _=require(_0x72c4('0x0'));var sequelize=require('sequelize');var moment=require(_0x72c4('0x1'));var LIMIT_VALUE=0xfa;exports[_0x72c4('0x2')]=function(_0x31215d){var _0x428222=null;if(_0x31215d){_0x428222=_0x31215d[_0x72c4('0x3')](',');}return _0x428222;};exports[_0x72c4('0x4')]=function(_0x10bc35,_0x28052e){var _0x37dabc={};if(!_[_0x72c4('0x5')](_0x10bc35)){_['forOwn'](_0x10bc35,function(_0x39bdc9,_0xf22e9c){try{if(_0x28052e){var _0x332f32=_['find'](_0x28052e,{'name':_0xf22e9c})||{};if(_0x332f32[_0x72c4('0x6')]==='DATE'&&_[_0x72c4('0x7')](_0x39bdc9)){var _0x167f79=JSON[_0x72c4('0x8')](_0x39bdc9);var _0x1748e9={'$gte':moment(moment(_0x167f79[_0x72c4('0x9')])['format']('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0x167f79[_0x72c4('0xa')])[_0x72c4('0xb')](_0x72c4('0xc')))[_0x72c4('0xd')]()[_0x72c4('0xe')](0x1,'s')[_0x72c4('0xb')]()};_0x37dabc[_0xf22e9c]=_0x1748e9;}else{_0x37dabc[_0xf22e9c]=_['isArray'](_0x39bdc9)?_0x39bdc9:JSON[_0x72c4('0x8')](_0x39bdc9);}}else{_0x37dabc[_0xf22e9c]=_[_0x72c4('0xf')](_0x39bdc9)?_0x39bdc9:JSON['parse'](_0x39bdc9);}}catch(_0x413df5){_0x37dabc[_0xf22e9c]=_0x39bdc9[_0x72c4('0x3')](',');}});}return _0x37dabc;};exports[_0x72c4('0x10')]=function(_0x34af53){_0x34af53=parseInt(_0x34af53,0xa);if(!_0x34af53||_0x34af53<0x0){_0x34af53=LIMIT_VALUE;}return _0x34af53;};exports[_0x72c4('0x11')]=function(_0x42951a){_0x42951a=parseInt(_0x42951a,0xa);if(!_0x42951a||_0x42951a<0x0){_0x42951a=0x0;}return _0x42951a;};exports[_0x72c4('0x12')]=function(_0x4b4553){var _0x185ff0,_0xfd1876=null;if(_0x4b4553){_0x185ff0=_0x4b4553[_0x72c4('0x3')](',');_0xfd1876=_[_0x72c4('0x13')](_0x185ff0,function(_0x287b61){if(_0x287b61[_0x72c4('0x14')]('-')===0x0){return[_0x287b61===_0x72c4('0x15')?sequelize[_0x72c4('0x16')](sequelize['col'](_0x72c4('0x15')),'unsigned'):_0x287b61['substr'](0x1),_0x72c4('0x17')];}else{return[_0x287b61===_0x72c4('0x15')?sequelize['cast'](sequelize[_0x72c4('0x18')](_0x72c4('0x15')),_0x72c4('0x19')):_0x287b61,_0x72c4('0x1a')];}});}return _0xfd1876;};exports['omit']=function(_0x415619,_0x1c7fce){if(_[_0x72c4('0x5')](_0x415619)){return _0x415619;}if(_[_0x72c4('0xf')](_0x415619)){for(var _0x6475d3=0x0;_0x6475d3<_0x415619[_0x72c4('0x1b')];_0x6475d3+=0x1){_0x415619[_0x6475d3]=this[_0x72c4('0x1c')](_0x415619[_0x6475d3],_0x1c7fce);}return _0x415619;}if(!_[_0x72c4('0x1d')](_0x415619)){return _0x415619;}if(_[_0x72c4('0x1e')](_0x1c7fce)){_0x1c7fce=[_0x1c7fce];}if(!_[_0x72c4('0xf')](_0x1c7fce)){return _0x415619;}for(var _0x3451e=0x0;_0x3451e<_0x1c7fce[_0x72c4('0x1b')];_0x3451e+=0x1){_['unset'](_0x415619,_0x1c7fce[_0x3451e]);}for(var _0x430500 in _0x415619){if(_0x415619[_0x72c4('0x1f')](_0x430500)){_0x415619[_0x430500]=this[_0x72c4('0x1c')](_0x415619[_0x430500],_0x1c7fce);}}return _0x415619;};exports['isNumeric']=function(_0x85d432){return _0x85d432[_0x72c4('0x20')](RegExp(_0x72c4('0x21')))?!![]:![];};exports[_0x72c4('0x22')]=function(_0x1c85bc){return _0x1c85bc[_0x72c4('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x72c4('0x23')]=function(_0x44e566){var _0x1dac96=[];_0x44e566[_0x72c4('0x3')]('\x20')[_0x72c4('0x24')](function(_0x47f616){_0x1dac96[_0x72c4('0x25')]('+'+_0x47f616[_0x72c4('0x26')]()+'*');});return _0x1dac96['join']('\x20');}; \ No newline at end of file +var _0xe8f8=['cast','col','unsigned','substr','DESC','priority','omit','length','isString','hasOwnProperty','isNumeric','match','^[0-9]*$','isEmail','forEach','push','toString','join','lodash','moment','filters','isEmpty','find','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','split','limit','offset','sort','map','indexOf'];(function(_0xc42ecf,_0x2819ee){var _0x5d8dc3=function(_0x472e88){while(--_0x472e88){_0xc42ecf['push'](_0xc42ecf['shift']());}};_0x5d8dc3(++_0x2819ee);}(_0xe8f8,0x1da));var _0x8e8f=function(_0x2d6abe,_0x29fd4c){_0x2d6abe=_0x2d6abe-0x0;var _0x5b983f=_0xe8f8[_0x2d6abe];return _0x5b983f;};'use strict';var _=require(_0x8e8f('0x0'));var sequelize=require('sequelize');var moment=require(_0x8e8f('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0xff13f0){var _0x122d85=null;if(_0xff13f0){_0x122d85=_0xff13f0['split'](',');}return _0x122d85;};exports[_0x8e8f('0x2')]=function(_0x4b3528,_0x5a82ca){var _0x2896af={};if(!_[_0x8e8f('0x3')](_0x4b3528)){_['forOwn'](_0x4b3528,function(_0x10df4c,_0x388dc2){try{if(_0x5a82ca){var _0x1b227d=_[_0x8e8f('0x4')](_0x5a82ca,{'name':_0x388dc2})||{};if(_0x1b227d['type']==='DATE'&&_[_0x8e8f('0x5')](_0x10df4c)){var _0x191a1b=JSON[_0x8e8f('0x6')](_0x10df4c);var _0x599601={'$gte':moment(moment(_0x191a1b[_0x8e8f('0x7')])[_0x8e8f('0x8')](_0x8e8f('0x9')))[_0x8e8f('0xa')]()[_0x8e8f('0x8')](),'$lte':moment(moment(_0x191a1b[_0x8e8f('0xb')])['format']('YYYY-MM-DD'))[_0x8e8f('0xa')]()[_0x8e8f('0xc')](0x1,'s')[_0x8e8f('0x8')]()};_0x2896af[_0x388dc2]=_0x599601;}else{_0x2896af[_0x388dc2]=_[_0x8e8f('0xd')](_0x10df4c)?_0x10df4c:JSON[_0x8e8f('0x6')](_0x10df4c);}}else{_0x2896af[_0x388dc2]=_[_0x8e8f('0xd')](_0x10df4c)?_0x10df4c:JSON[_0x8e8f('0x6')](_0x10df4c);}}catch(_0xce87fa){_0x2896af[_0x388dc2]=_0x10df4c[_0x8e8f('0xe')](',');}});}return _0x2896af;};exports[_0x8e8f('0xf')]=function(_0xc68ee){_0xc68ee=parseInt(_0xc68ee,0xa);if(!_0xc68ee||_0xc68ee<0x0){_0xc68ee=LIMIT_VALUE;}return _0xc68ee;};exports[_0x8e8f('0x10')]=function(_0x363de0){_0x363de0=parseInt(_0x363de0,0xa);if(!_0x363de0||_0x363de0<0x0){_0x363de0=0x0;}return _0x363de0;};exports[_0x8e8f('0x11')]=function(_0x5c2ef4){var _0x206671,_0x222001=null;if(_0x5c2ef4){_0x206671=_0x5c2ef4['split'](',');_0x222001=_[_0x8e8f('0x12')](_0x206671,function(_0x2e0f47){if(_0x2e0f47[_0x8e8f('0x13')]('-')===0x0){return[_0x2e0f47==='priority'?sequelize[_0x8e8f('0x14')](sequelize[_0x8e8f('0x15')]('priority'),_0x8e8f('0x16')):_0x2e0f47[_0x8e8f('0x17')](0x1),_0x8e8f('0x18')];}else{return[_0x2e0f47===_0x8e8f('0x19')?sequelize[_0x8e8f('0x14')](sequelize[_0x8e8f('0x15')](_0x8e8f('0x19')),_0x8e8f('0x16')):_0x2e0f47,'ASC'];}});}return _0x222001;};exports[_0x8e8f('0x1a')]=function(_0x235f9f,_0x4e0e4b){if(_[_0x8e8f('0x3')](_0x235f9f)){return _0x235f9f;}if(_[_0x8e8f('0xd')](_0x235f9f)){for(var _0xae10c0=0x0;_0xae10c0<_0x235f9f[_0x8e8f('0x1b')];_0xae10c0+=0x1){_0x235f9f[_0xae10c0]=this['omit'](_0x235f9f[_0xae10c0],_0x4e0e4b);}return _0x235f9f;}if(!_['isObject'](_0x235f9f)){return _0x235f9f;}if(_[_0x8e8f('0x1c')](_0x4e0e4b)){_0x4e0e4b=[_0x4e0e4b];}if(!_[_0x8e8f('0xd')](_0x4e0e4b)){return _0x235f9f;}for(var _0xafb002=0x0;_0xafb002<_0x4e0e4b[_0x8e8f('0x1b')];_0xafb002+=0x1){_['unset'](_0x235f9f,_0x4e0e4b[_0xafb002]);}for(var _0x2b31af in _0x235f9f){if(_0x235f9f[_0x8e8f('0x1d')](_0x2b31af)){_0x235f9f[_0x2b31af]=this[_0x8e8f('0x1a')](_0x235f9f[_0x2b31af],_0x4e0e4b);}}return _0x235f9f;};exports[_0x8e8f('0x1e')]=function(_0xf71aec){return _0xf71aec[_0x8e8f('0x1f')](RegExp(_0x8e8f('0x20')))?!![]:![];};exports[_0x8e8f('0x21')]=function(_0x14d8a4){return _0x14d8a4[_0x8e8f('0x1f')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x27c888){var _0x9ae544=[];_0x27c888['split']('\x20')[_0x8e8f('0x22')](function(_0x4a68b3){_0x9ae544[_0x8e8f('0x23')]('+'+_0x4a68b3[_0x8e8f('0x24')]()+'*');});return _0x9ae544[_0x8e8f('0x25')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a377b9a..5644f68 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fee=['toISOString','static','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','./environment','../mysqldb','get','set','appPath','join','root','public','development','test','client','use','json\x20replacer'];(function(_0x34a2e0,_0x3a8452){var _0x2d5ac1=function(_0x4aa06a){while(--_0x4aa06a){_0x34a2e0['push'](_0x34a2e0['shift']());}};_0x2d5ac1(++_0x3a8452);}(_0x5fee,0x136));var _0xe5fe=function(_0xbcc69e,_0x2c35ca){_0xbcc69e=_0xbcc69e-0x0;var _0x376392=_0x5fee[_0xbcc69e];return _0x376392;};'use strict';var express=require(_0xe5fe('0x0'));var favicon=require(_0xe5fe('0x1'));var bodyParser=require(_0xe5fe('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0xe5fe('0x3'));var errorHandler=require(_0xe5fe('0x4'));var path=require(_0xe5fe('0x5'));var passport=require(_0xe5fe('0x6'));var cors=require('cors');var moment=require('moment');var config=require(_0xe5fe('0x7'));var db=require(_0xe5fe('0x8'))['db'];exports['default']=function(_0xf4a3e0){var _0x9c77bd=_0xf4a3e0[_0xe5fe('0x9')]('env');if(_0x9c77bd==='production'){_0xf4a3e0[_0xe5fe('0xa')](_0xe5fe('0xb'),path[_0xe5fe('0xc')](config[_0xe5fe('0xd')],_0xe5fe('0xe')));}if(_0x9c77bd===_0xe5fe('0xf')||_0x9c77bd===_0xe5fe('0x10')){_0xf4a3e0[_0xe5fe('0xa')]('appPath',path[_0xe5fe('0xc')](config[_0xe5fe('0xd')],_0xe5fe('0x11')));_0xf4a3e0[_0xe5fe('0x12')](errorHandler());}_0xf4a3e0['set'](_0xe5fe('0x13'),function(_0x257126,_0x258e86){if(this[_0x257126]instanceof Date){_0x258e86=this[_0x257126][_0xe5fe('0x14')]()['split']('.')[0x0]+'Z';}return _0x258e86;});_0xf4a3e0[_0xe5fe('0x12')](express[_0xe5fe('0x15')](_0xf4a3e0[_0xe5fe('0x9')](_0xe5fe('0xb'))));_0xf4a3e0['set'](_0xe5fe('0x16'),config[_0xe5fe('0xd')]+_0xe5fe('0x17'));_0xf4a3e0[_0xe5fe('0x18')](_0xe5fe('0x19'),require(_0xe5fe('0x1a'))[_0xe5fe('0x1b')]);_0xf4a3e0['set'](_0xe5fe('0x1c'),_0xe5fe('0x19'));_0xf4a3e0[_0xe5fe('0x12')](bodyParser[_0xe5fe('0x1d')]({'limit':_0xe5fe('0x1e'),'extended':!![]}));_0xf4a3e0[_0xe5fe('0x12')](bodyParser[_0xe5fe('0x1f')]({'limit':_0xe5fe('0x1e')}));_0xf4a3e0[_0xe5fe('0x12')](cors());_0xf4a3e0['use'](methodOverride());_0xf4a3e0['use'](cookieParser());_0xf4a3e0['use'](passport[_0xe5fe('0x20')]());}; \ No newline at end of file +var _0xa60b=['use','static','views','root','/server/views','ejs','renderFile','view\x20engine','html','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','errorhandler','passport','./environment','../mysqldb','default','get','set','join','public','test','appPath','client','json\x20replacer','toISOString','split'];(function(_0x3db9ff,_0x437eb7){var _0x184158=function(_0x3f0884){while(--_0x3f0884){_0x3db9ff['push'](_0x3db9ff['shift']());}};_0x184158(++_0x437eb7);}(_0xa60b,0x10d));var _0xba60=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa60b[_0x21a9d9];return _0x46adce;};'use strict';var express=require(_0xba60('0x0'));var favicon=require(_0xba60('0x1'));var bodyParser=require(_0xba60('0x2'));var methodOverride=require(_0xba60('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xba60('0x4'));var path=require('path');var passport=require(_0xba60('0x5'));var cors=require('cors');var moment=require('moment');var config=require(_0xba60('0x6'));var db=require(_0xba60('0x7'))['db'];exports[_0xba60('0x8')]=function(_0xc839b7){var _0x1b6e83=_0xc839b7[_0xba60('0x9')]('env');if(_0x1b6e83==='production'){_0xc839b7[_0xba60('0xa')]('appPath',path[_0xba60('0xb')](config['root'],_0xba60('0xc')));}if(_0x1b6e83==='development'||_0x1b6e83===_0xba60('0xd')){_0xc839b7['set'](_0xba60('0xe'),path[_0xba60('0xb')](config['root'],_0xba60('0xf')));_0xc839b7['use'](errorHandler());}_0xc839b7['set'](_0xba60('0x10'),function(_0x1481bf,_0x3a365e){if(this[_0x1481bf]instanceof Date){_0x3a365e=this[_0x1481bf][_0xba60('0x11')]()[_0xba60('0x12')]('.')[0x0]+'Z';}return _0x3a365e;});_0xc839b7[_0xba60('0x13')](express[_0xba60('0x14')](_0xc839b7['get']('appPath')));_0xc839b7['set'](_0xba60('0x15'),config[_0xba60('0x16')]+_0xba60('0x17'));_0xc839b7['engine']('html',require(_0xba60('0x18'))[_0xba60('0x19')]);_0xc839b7['set'](_0xba60('0x1a'),_0xba60('0x1b'));_0xc839b7[_0xba60('0x13')](bodyParser[_0xba60('0x1c')]({'limit':_0xba60('0x1d'),'extended':!![]}));_0xc839b7[_0xba60('0x13')](bodyParser[_0xba60('0x1e')]({'limit':'50mb'}));_0xc839b7[_0xba60('0x13')](cors());_0xc839b7[_0xba60('0x13')](methodOverride());_0xc839b7[_0xba60('0x13')](cookieParser());_0xc839b7[_0xba60('0x13')](passport[_0xba60('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index e0526df..e0ad2f4 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 _0x07d7=['model','join','createHash','update','hex','getUuid','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07d7,0x85));var _0x707d=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0x07d7[_0x534c8f];return _0x5a57f5;};'use strict';var _=require(_0x707d('0x0'));var os=require('os');var crypto=require(_0x707d('0x1'));var machine=require(_0x707d('0x2'));var exec=require(_0x707d('0x3'))[_0x707d('0x4')];function getInterfaces(){var _0x38a92e=[];var _0x100f39=os[_0x707d('0x5')]();var _0x38c520=_[_0x707d('0x6')](_[_0x707d('0x7')](_0x100f39));for(var _0x16cc4a=0x0;_0x16cc4a<_0x38c520[_0x707d('0x8')];_0x16cc4a++){var _0x1456bd=_0x100f39[_0x38c520[_0x16cc4a]][_0x707d('0x9')](function(_0x13df54){return _0x13df54['family']==='IPv4'&&_0x13df54[_0x707d('0xa')]===![];});_0x38a92e=_0x38a92e[_0x707d('0xb')](_0x1456bd);}return _0x38a92e;}function getFirstInterface(){var _0x375e87=_[_0x707d('0xc')](getInterfaces());return{'macAddress':_0x375e87&&_0x375e87[_0x707d('0xd')]?_0x375e87['mac']:_0x707d('0xe'),'ipAddress':_0x375e87&&_0x375e87[_0x707d('0xf')]?_0x375e87[_0x707d('0xf')]:'127.0.0.1'};}exports[_0x707d('0x10')]=getFirstInterface;function getCPUhash(){var _0x355ce4=_[_0x707d('0x6')](os['cpus']()['map'](function(_0x5aabfe){return _0x5aabfe[_0x707d('0x11')];}))[_0x707d('0x12')](':');return crypto[_0x707d('0x13')]('md5')[_0x707d('0x14')](_0x355ce4)['digest'](_0x707d('0x15'));}exports[_0x707d('0x16')]=function(){switch(os['platform']()){case'win32':return exec(_0x707d('0x17'),{'encoding':'utf8'})[_0x707d('0x18')]('\x0d\x0a','');default:var _0x2c63c9=getFirstInterface();var _0xeed67d=getCPUhash();var _0x1f4f0e=_0xeed67d+'|'+os[_0x707d('0x19')]()+'|'+_0x2c63c9[_0x707d('0x1a')]+'|'+_0x2c63c9[_0x707d('0x1b')];var _0x50869d=crypto[_0x707d('0x13')](_0x707d('0x1c'))[_0x707d('0x14')](_0x1f4f0e)['digest'](_0x707d('0x15'));return _0x50869d[_0x707d('0x1d')](0x0,0x8)+'-'+_0x50869d[_0x707d('0x1d')](0x8,0xc)+'-'+_0x50869d[_0x707d('0x1d')](0xc,0x10)+'-'+_0x50869d[_0x707d('0x1d')](0x10,0x14)+'-'+_0x50869d[_0x707d('0x1d')](0x14);}}; \ No newline at end of file +var _0x21d1=['join','md5','update','digest','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','address','127.0.0.1','cpus','map'];(function(_0xc5c6aa,_0x29fa3a){var _0x4e379d=function(_0x1f881f){while(--_0x1f881f){_0xc5c6aa['push'](_0xc5c6aa['shift']());}};_0x4e379d(++_0x29fa3a);}(_0x21d1,0x1c9));var _0x121d=function(_0x3aae45,_0x2da6de){_0x3aae45=_0x3aae45-0x0;var _0x2004cd=_0x21d1[_0x3aae45];return _0x2004cd;};'use strict';var _=require(_0x121d('0x0'));var os=require('os');var crypto=require(_0x121d('0x1'));var machine=require(_0x121d('0x2'));var exec=require(_0x121d('0x3'))[_0x121d('0x4')];function getInterfaces(){var _0x14fd65=[];var _0x550ab5=os['networkInterfaces']();var _0x20b991=_[_0x121d('0x5')](_[_0x121d('0x6')](_0x550ab5));for(var _0x44fa5c=0x0;_0x44fa5c<_0x20b991[_0x121d('0x7')];_0x44fa5c++){var _0x4c47ee=_0x550ab5[_0x20b991[_0x44fa5c]][_0x121d('0x8')](function(_0x2bd1e8){return _0x2bd1e8[_0x121d('0x9')]===_0x121d('0xa')&&_0x2bd1e8[_0x121d('0xb')]===![];});_0x14fd65=_0x14fd65[_0x121d('0xc')](_0x4c47ee);}return _0x14fd65;}function getFirstInterface(){var _0x12df3e=_[_0x121d('0xd')](getInterfaces());return{'macAddress':_0x12df3e&&_0x12df3e[_0x121d('0xe')]?_0x12df3e[_0x121d('0xe')]:'00:00:00:00:00:00','ipAddress':_0x12df3e&&_0x12df3e[_0x121d('0xf')]?_0x12df3e[_0x121d('0xf')]:_0x121d('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x54b308=_[_0x121d('0x5')](os[_0x121d('0x11')]()[_0x121d('0x12')](function(_0x50c279){return _0x50c279['model'];}))[_0x121d('0x13')](':');return crypto['createHash'](_0x121d('0x14'))[_0x121d('0x15')](_0x54b308)[_0x121d('0x16')]('hex');}exports[_0x121d('0x17')]=function(){switch(os[_0x121d('0x18')]()){case _0x121d('0x19'):return exec(_0x121d('0x1a'),{'encoding':_0x121d('0x1b')})[_0x121d('0x1c')]('\x0d\x0a','');default:var _0xbd872f=getFirstInterface();var _0x317b8a=getCPUhash();var _0x37cb0d=_0x317b8a+'|'+os[_0x121d('0x1d')]()+'|'+_0xbd872f[_0x121d('0x1e')]+'|'+_0xbd872f[_0x121d('0x1f')];var _0x1f93d=crypto['createHash']('md5')['update'](_0x37cb0d)[_0x121d('0x16')](_0x121d('0x20'));return _0x1f93d['substring'](0x0,0x8)+'-'+_0x1f93d[_0x121d('0x21')](0x8,0xc)+'-'+_0x1f93d[_0x121d('0x21')](0xc,0x10)+'-'+_0x1f93d[_0x121d('0x21')](0x10,0x14)+'-'+_0x1f93d[_0x121d('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index df80e14..b42339b 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 _0x8383=['||FIELD||VALUE||\x0a','findOne','admin','fullname','email','|uuid|','|name|','|email|','getFirstInterface','openIssue','Motion\x20License\x20Alert','Alert','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','format','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','secrets','update','utf8','base64','final','createDecipher','aes-256-ctr'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8383,0x98));var _0x3838=function(_0x598d43,_0x58e247){_0x598d43=_0x598d43-0x0;var _0x489488=_0x8383[_0x598d43];return _0x489488;};'use strict';var util=require(_0x3838('0x0'));var crypto=require('crypto');var moment=require('moment');var rp=require(_0x3838('0x1'));var BPromise=require(_0x3838('0x2'));var pkginfo=require(_0x3838('0x3'))(module,_0x3838('0x4'));var db=require(_0x3838('0x5'))['db'];var config=require(_0x3838('0x6'));var hardware=require(_0x3838('0x7'));var logger=require(_0x3838('0x8'))(_0x3838('0x9'));var jira=require(_0x3838('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x239750){return new BPromise(function(_0x235001,_0x4cf52b){var _0x2abbda=util['format'](_0x3838('0xb'),HOST,_0x239750,module[_0x3838('0xc')][_0x3838('0x4')]);if(oldToken){_0x2abbda=util['format'](_0x3838('0xd'),HOST,_0x239750,module[_0x3838('0xc')][_0x3838('0x4')],oldToken);}var _0x545100={'uri':_0x2abbda,'method':_0x3838('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x545100)[_0x3838('0xf')](function(_0x9161a2){_0x235001(_0x9161a2);})[_0x3838('0x10')](function(_0x5f33d5){_0x4cf52b(_0x5f33d5);});});}function encryptDate(_0x3572d6){var _0x276d98=crypto[_0x3838('0x11')]('aes-256-ctr',config[_0x3838('0x12')]['session']);var _0x38e779=_0x276d98[_0x3838('0x13')](_0x3572d6,_0x3838('0x14'),_0x3838('0x15'));_0x38e779+=_0x276d98[_0x3838('0x16')]('base64');return _0x38e779;}function decryptDate(_0x284ec1){var _0xb4bf82=crypto[_0x3838('0x17')](_0x3838('0x18'),config[_0x3838('0x12')]['session']);var _0x464fd9=_0xb4bf82[_0x3838('0x13')](_0x284ec1,_0x3838('0x15'),'utf8');_0x464fd9+=_0xb4bf82[_0x3838('0x16')](_0x3838('0x14'));return _0x464fd9;}function sendJiraAlert(_0x4a9a7a,_0xf69d52,_0x2fe3c8){var _0x50c9a1=_0x3838('0x19');return db['User'][_0x3838('0x1a')]({'where':{'role':_0x3838('0x1b')},'attributes':[_0x3838('0x1c'),_0x3838('0x1d')],'raw':!![]})[_0x3838('0xf')](function(_0x58175e){ADMIN=_0x58175e;_0x50c9a1+='|reason|'+_0x2fe3c8+'|\x0a';_0x50c9a1+=_0x3838('0x1e')+_0x4a9a7a+'|\x0a';_0x50c9a1+='|machineUuid|'+_0xf69d52+'|\x0a';_0x50c9a1+=_0x3838('0x1f')+ADMIN[_0x3838('0x1c')]+'|\x0a';_0x50c9a1+=_0x3838('0x20')+ADMIN[_0x3838('0x1d')]+'|\x0a';return _0x50c9a1;})[_0x3838('0xf')](function(_0x30e98f){var _0xbd0fd1=hardware[_0x3838('0x21')]()['ipAddress'];return jira[_0x3838('0x22')]({'key':'MOTLICENSE','summary':_0x3838('0x23'),'description':_0x30e98f,'issuetype':_0x3838('0x24'),'oldToken':_0x4a9a7a,'newToken':_0xf69d52,'email':ADMIN['email'],'name':ADMIN[_0x3838('0x1c')],'reason':GRAY_PERIOD_REASON,'ip':_0xbd0fd1});});}function manageLicense(_0x265099,_0x5b181a){var _0x12cf42=_0x5b181a[_0x3838('0x25')]({'plain':!![]});httpRequest(_0x265099)['then'](function(_0x1754b2){if(oldToken){oldToken=undefined;}if(_0x1754b2['active']){if(!_0x12cf42[_0x3838('0x9')]&&_0x12cf42['license']!=_0x1754b2['license']||_0x12cf42[_0x3838('0x9')]&&_0x12cf42[_0x3838('0x26')]){logger[_0x3838('0x27')](_0x3838('0x28'));}if(_0x12cf42[_0x3838('0x9')]&&!_0x12cf42['data2']&&_0x12cf42[_0x3838('0x9')]!=_0x1754b2[_0x3838('0x9')]){logger[_0x3838('0x27')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x12cf42[_0x3838('0x9')]&&!_0x12cf42['data2']&&_0x12cf42[_0x3838('0x9')]==_0x1754b2['license']){return _0x5b181a;}return _0x5b181a[_0x3838('0x13')]({'data1':_0x265099,'data2':null,'license':_0x1754b2[_0x3838('0x9')]});}else{if(_0x1754b2['license']||_0x12cf42[_0x3838('0x9')]){if(!_0x12cf42['data2']){if(_0x12cf42['data1']==_0x265099){GRAY_PERIOD_REASON=_0x3838('0x29');logger[_0x3838('0x27')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x12cf42[_0x3838('0x2a')];logger['info'](_0x3838('0x2b'),_0x12cf42[_0x3838('0x2a')],_0x265099);}sendJiraAlert(_0x12cf42[_0x3838('0x2a')],_0x1754b2[_0x3838('0x2c')],GRAY_PERIOD_REASON);logger[_0x3838('0x27')](_0x3838('0x2d'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x3838('0x2e')](_0x3838('0x2f')));return _0x5b181a[_0x3838('0x13')]({'data2':encryptDate(moment()[_0x3838('0x2e')](_0x3838('0x2f')))});}else{if(moment()[_0x3838('0x30')](decryptDate(_0x12cf42[_0x3838('0x26')]),_0x3838('0x31'))>DAYS){logger[_0x3838('0x27')](_0x3838('0x32'),moment()[_0x3838('0x2e')]('YYYY-MM-DD\x20HH:mm'));return _0x5b181a[_0x3838('0x13')]({'data1':_0x265099,'data2':null,'license':null});}}}else{if(_0x12cf42[_0x3838('0x2a')]!=_0x265099){logger[_0x3838('0x27')](_0x3838('0x2b'),_0x12cf42['data1'],_0x265099);return _0x5b181a[_0x3838('0x13')]({'data1':_0x265099,'data2':null,'license':null});}}}return _0x5b181a;})[_0x3838('0xf')](function(_0x23b711){_0x5b181a=_0x23b711;})[_0x3838('0x10')](function(_0x4d727c){logger[_0x3838('0x33')](_0x4d727c[_0x3838('0x34')]);})[_0x3838('0x35')](function(){setTimeout(function(){manageLicense(hardware[_0x3838('0x36')](),_0x5b181a);},TIME);});}function defaultLicense(){var _0x5ea658=hardware[_0x3838('0x36')]();if(_0x5ea658){return db[_0x3838('0x37')][_0x3838('0x38')]({'where':{'id':0x1},'defaults':{'data1':_0x5ea658}})['spread'](function(_0x5b3383,_0x403078){logger[_0x3838('0x27')](_0x3838('0x39'),_0x5ea658);manageLicense(_0x5ea658,_0x5b3383);})[_0x3838('0x10')](function(_0x341588){logger[_0x3838('0x33')](_0x341588[_0x3838('0x34')]);});}}exports[_0x3838('0x3a')]=defaultLicense; \ No newline at end of file +var _0x0d91=['../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','createCipher','aes-256-ctr','session','update','utf8','base64','final','createDecipher','secrets','User','findOne','email','|reason|','|machineUuid|','|name|','fullname','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','info','data2','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','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','crypto','moment','request-promise','pkginfo','version'];(function(_0x23099a,_0x2b5805){var _0x37d69c=function(_0xd2830e){while(--_0xd2830e){_0x23099a['push'](_0x23099a['shift']());}};_0x37d69c(++_0x2b5805);}(_0x0d91,0x76));var _0x10d9=function(_0x28bc89,_0x1edcd4){_0x28bc89=_0x28bc89-0x0;var _0x31aaa2=_0x0d91[_0x28bc89];return _0x31aaa2;};'use strict';var util=require(_0x10d9('0x0'));var crypto=require(_0x10d9('0x1'));var moment=require(_0x10d9('0x2'));var rp=require(_0x10d9('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0x10d9('0x4'))(module,_0x10d9('0x5'));var db=require(_0x10d9('0x6'))['db'];var config=require('../environment');var hardware=require(_0x10d9('0x7'));var logger=require(_0x10d9('0x8'))(_0x10d9('0x9'));var jira=require('../../api/jira/jira.controller');var HOST=_0x10d9('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x3a49ab){return new BPromise(function(_0x946fc7,_0x26b6cf){var _0x2558bb=util[_0x10d9('0xb')](_0x10d9('0xc'),HOST,_0x3a49ab,module[_0x10d9('0xd')][_0x10d9('0x5')]);if(oldToken){_0x2558bb=util[_0x10d9('0xb')](_0x10d9('0xe'),HOST,_0x3a49ab,module[_0x10d9('0xd')][_0x10d9('0x5')],oldToken);}var _0x2332c7={'uri':_0x2558bb,'method':_0x10d9('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x2332c7)[_0x10d9('0x10')](function(_0x273a4c){_0x946fc7(_0x273a4c);})['catch'](function(_0x2e327c){_0x26b6cf(_0x2e327c);});});}function encryptDate(_0x23f582){var _0x12a2b4=crypto[_0x10d9('0x11')](_0x10d9('0x12'),config['secrets'][_0x10d9('0x13')]);var _0x5b3be6=_0x12a2b4[_0x10d9('0x14')](_0x23f582,_0x10d9('0x15'),_0x10d9('0x16'));_0x5b3be6+=_0x12a2b4[_0x10d9('0x17')](_0x10d9('0x16'));return _0x5b3be6;}function decryptDate(_0x198778){var _0x211df6=crypto[_0x10d9('0x18')](_0x10d9('0x12'),config[_0x10d9('0x19')]['session']);var _0x5658b5=_0x211df6[_0x10d9('0x14')](_0x198778,_0x10d9('0x16'),_0x10d9('0x15'));_0x5658b5+=_0x211df6[_0x10d9('0x17')]('utf8');return _0x5658b5;}function sendJiraAlert(_0x3f5819,_0x206045,_0x1cff55){var _0x8441a5='||FIELD||VALUE||\x0a';return db[_0x10d9('0x1a')][_0x10d9('0x1b')]({'where':{'role':'admin'},'attributes':['fullname',_0x10d9('0x1c')],'raw':!![]})['then'](function(_0x11be56){ADMIN=_0x11be56;_0x8441a5+=_0x10d9('0x1d')+_0x1cff55+'|\x0a';_0x8441a5+='|uuid|'+_0x3f5819+'|\x0a';_0x8441a5+=_0x10d9('0x1e')+_0x206045+'|\x0a';_0x8441a5+=_0x10d9('0x1f')+ADMIN[_0x10d9('0x20')]+'|\x0a';_0x8441a5+=_0x10d9('0x21')+ADMIN[_0x10d9('0x1c')]+'|\x0a';return _0x8441a5;})[_0x10d9('0x10')](function(_0x26ff84){var _0x3a2e97=hardware[_0x10d9('0x22')]()[_0x10d9('0x23')];return jira[_0x10d9('0x24')]({'key':_0x10d9('0x25'),'summary':_0x10d9('0x26'),'description':_0x26ff84,'issuetype':_0x10d9('0x27'),'oldToken':_0x3f5819,'newToken':_0x206045,'email':ADMIN[_0x10d9('0x1c')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x3a2e97});});}function manageLicense(_0x14c4ec,_0x295489){var _0xce87ca=_0x295489[_0x10d9('0x28')]({'plain':!![]});httpRequest(_0x14c4ec)['then'](function(_0x3ba01f){if(oldToken){oldToken=undefined;}if(_0x3ba01f[_0x10d9('0x29')]){if(!_0xce87ca[_0x10d9('0x9')]&&_0xce87ca[_0x10d9('0x9')]!=_0x3ba01f[_0x10d9('0x9')]||_0xce87ca[_0x10d9('0x9')]&&_0xce87ca['data2']){logger[_0x10d9('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xce87ca[_0x10d9('0x9')]&&!_0xce87ca[_0x10d9('0x2b')]&&_0xce87ca[_0x10d9('0x9')]!=_0x3ba01f[_0x10d9('0x9')]){logger[_0x10d9('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xce87ca['license']&&!_0xce87ca[_0x10d9('0x2b')]&&_0xce87ca[_0x10d9('0x9')]==_0x3ba01f['license']){return _0x295489;}return _0x295489['update']({'data1':_0x14c4ec,'data2':null,'license':_0x3ba01f[_0x10d9('0x9')]});}else{if(_0x3ba01f[_0x10d9('0x9')]||_0xce87ca[_0x10d9('0x9')]){if(!_0xce87ca['data2']){if(_0xce87ca[_0x10d9('0x2c')]==_0x14c4ec){GRAY_PERIOD_REASON='Disabled';logger[_0x10d9('0x2a')](_0x10d9('0x2d'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0xce87ca['data1'];logger[_0x10d9('0x2a')](_0x10d9('0x2e'),_0xce87ca['data1'],_0x14c4ec);}sendJiraAlert(_0xce87ca[_0x10d9('0x2c')],_0x3ba01f[_0x10d9('0x2f')],GRAY_PERIOD_REASON);logger['info'](_0x10d9('0x30'),GRAY_PERIOD_REASON[_0x10d9('0x31')](),moment()[_0x10d9('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x295489[_0x10d9('0x14')]({'data2':encryptDate(moment()[_0x10d9('0xb')](_0x10d9('0x32')))});}else{if(moment()['diff'](decryptDate(_0xce87ca[_0x10d9('0x2b')]),_0x10d9('0x33'))>DAYS){logger['info'](_0x10d9('0x34'),moment()[_0x10d9('0xb')](_0x10d9('0x32')));return _0x295489[_0x10d9('0x14')]({'data1':_0x14c4ec,'data2':null,'license':null});}}}else{if(_0xce87ca[_0x10d9('0x2c')]!=_0x14c4ec){logger[_0x10d9('0x2a')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xce87ca['data1'],_0x14c4ec);return _0x295489['update']({'data1':_0x14c4ec,'data2':null,'license':null});}}}return _0x295489;})[_0x10d9('0x10')](function(_0x3d4ee8){_0x295489=_0x3d4ee8;})[_0x10d9('0x35')](function(_0x3bc4ab){logger[_0x10d9('0x36')](_0x3bc4ab['message']);})[_0x10d9('0x37')](function(){setTimeout(function(){manageLicense(hardware[_0x10d9('0x38')](),_0x295489);},TIME);});}function defaultLicense(){var _0x24e998=hardware[_0x10d9('0x38')]();if(_0x24e998){return db['License'][_0x10d9('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x24e998}})[_0x10d9('0x3a')](function(_0xdd2c0d,_0x36a13f){logger[_0x10d9('0x2a')](_0x10d9('0x3b'),_0x24e998);manageLicense(_0x24e998,_0xdd2c0d);})['catch'](function(_0x1eebad){logger[_0x10d9('0x36')](_0x1eebad[_0x10d9('0x3c')]);});}}exports[_0x10d9('0x3d')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 406f332..0566929 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 _0x1ed0=['base64','gray','deadline','days','uuid','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','getLicense','License','find','defaults','then','crypto','util','lodash','./hardware','../environment','../../mysqldb','license','isEmpty','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','demo','machineUuid','getUuid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ed0,0x103));var _0x01ed=function(_0x52d7df,_0x5d5742){_0x52d7df=_0x52d7df-0x0;var _0x6163fc=_0x1ed0[_0x52d7df];return _0x6163fc;};'use strict';var crypto=require(_0x01ed('0x0'));var util=require(_0x01ed('0x1'));var _=require(_0x01ed('0x2'));var moment=require('moment');var hardware=require(_0x01ed('0x3'));var config=require(_0x01ed('0x4'));var db=require(_0x01ed('0x5'))['db'];function checkLicense(_0x2ce2ee,_0x52f4dc){if(_0x2ce2ee){try{var _0xbc3fbe=_0x52f4dc||_0x2ce2ee[_0x01ed('0x6')];if(_[_0x01ed('0x7')](_0xbc3fbe)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xf2ca2c=_0x2ce2ee[_0x01ed('0x8')];var _0x3b5450=_0x2ce2ee[_0x01ed('0x9')];var _0x41f68c=_0xf2ca2c['split']('-')[0x4];var _0x3cd055=_0xf2ca2c[_0x01ed('0xa')]('-')[0x0];var _0x35db8c=crypto[_0x01ed('0xb')](_0x01ed('0xc'),util[_0x01ed('0xd')](_0x01ed('0xe'),_0x41f68c,_0xf2ca2c,_0x3cd055));var _0x56482c=_0x35db8c[_0x01ed('0xf')](_0xbc3fbe,'base64',_0x01ed('0x10'));_0x56482c+=_0x35db8c[_0x01ed('0x11')](_0x01ed('0x10'));var _0x157ad6=JSON['parse'](_0x56482c);_0x157ad6[_0x01ed('0x12')]=![];_0x157ad6['uuid']=_0xf2ca2c;_0x157ad6[_0x01ed('0x13')]=hardware[_0x01ed('0x14')]();if(_0x3b5450){var _0x2762e4=crypto[_0x01ed('0xb')](_0x01ed('0xc'),config['secrets']['session']);var _0xff842f=_0x2762e4['update'](_0x3b5450,_0x01ed('0x15'),_0x01ed('0x10'));_0xff842f+=_0x2762e4[_0x01ed('0x11')]('utf8');_0x157ad6[_0x01ed('0x16')]=_0xff842f;_0x157ad6[_0x01ed('0x17')]=moment(_0xff842f)['add'](0x7,_0x01ed('0x18'))[_0x01ed('0xd')]();_0x157ad6['grayReason']=_0x157ad6[_0x01ed('0x19')]!=_0x157ad6[_0x01ed('0x13')]?'changed':_0x01ed('0x1a');}return _0x157ad6;}catch(_0x174116){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x01ed('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x01ed('0x1c'),'uuid':_0x2ce2ee[_0x01ed('0x8')],'machineUuid':hardware[_0x01ed('0x14')](),'message':_0x174116[_0x01ed('0x1d')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x01ed('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x2ce2ee[_0x01ed('0x8')],'machineUuid':hardware[_0x01ed('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x01ed('0x1e')]=function(_0x2478a9){return db[_0x01ed('0x1f')][_0x01ed('0x20')](_[_0x01ed('0x21')](_0x2478a9,{'raw':!![],'where':{'id':0x1}}))[_0x01ed('0x22')](function(_0x48e5b4){return checkLicense(_0x48e5b4,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0x21dc=['message','Demo\x20license','getLicense','License','defaults','crypto','util','lodash','moment','./hardware','../../mysqldb','license','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','uuid','getUuid','createDecipher','secrets','gray','add','days','grayReason','machineUuid','changed','2027-01-01T00:00:00.000Z','Breaking\x20license'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x21dc,0x170));var _0xc21d=function(_0x575462,_0xca5071){_0x575462=_0x575462-0x0;var _0x4ef256=_0x21dc[_0x575462];return _0x4ef256;};'use strict';var crypto=require(_0xc21d('0x0'));var util=require(_0xc21d('0x1'));var _=require(_0xc21d('0x2'));var moment=require(_0xc21d('0x3'));var hardware=require(_0xc21d('0x4'));var config=require('../environment');var db=require(_0xc21d('0x5'))['db'];function checkLicense(_0x3de1d3,_0x57fa4e){if(_0x3de1d3){try{var _0x57cdaa=_0x57fa4e||_0x3de1d3[_0xc21d('0x6')];if(_['isEmpty'](_0x57cdaa)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x51637a=_0x3de1d3[_0xc21d('0x7')];var _0x49cd82=_0x3de1d3['data2'];var _0x4be453=_0x51637a[_0xc21d('0x8')]('-')[0x4];var _0xa1366c=_0x51637a[_0xc21d('0x8')]('-')[0x0];var _0x14cf59=crypto['createDecipher'](_0xc21d('0x9'),util[_0xc21d('0xa')](_0xc21d('0xb'),_0x4be453,_0x51637a,_0xa1366c));var _0x3dfbdb=_0x14cf59[_0xc21d('0xc')](_0x57cdaa,_0xc21d('0xd'),_0xc21d('0xe'));_0x3dfbdb+=_0x14cf59[_0xc21d('0xf')]('utf8');var _0xfab17=JSON['parse'](_0x3dfbdb);_0xfab17['demo']=![];_0xfab17[_0xc21d('0x10')]=_0x51637a;_0xfab17['machineUuid']=hardware[_0xc21d('0x11')]();if(_0x49cd82){var _0x4aaee9=crypto[_0xc21d('0x12')](_0xc21d('0x9'),config[_0xc21d('0x13')]['session']);var _0x48d27a=_0x4aaee9[_0xc21d('0xc')](_0x49cd82,_0xc21d('0xd'),_0xc21d('0xe'));_0x48d27a+=_0x4aaee9[_0xc21d('0xf')](_0xc21d('0xe'));_0xfab17[_0xc21d('0x14')]=_0x48d27a;_0xfab17['deadline']=moment(_0x48d27a)[_0xc21d('0x15')](0x7,_0xc21d('0x16'))[_0xc21d('0xa')]();_0xfab17[_0xc21d('0x17')]=_0xfab17[_0xc21d('0x10')]!=_0xfab17[_0xc21d('0x18')]?_0xc21d('0x19'):'disabled';}return _0xfab17;}catch(_0x2bb1bc){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc21d('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc21d('0x1b'),'uuid':_0x3de1d3[_0xc21d('0x7')],'machineUuid':hardware['getUuid'](),'message':_0x2bb1bc[_0xc21d('0x1c')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc21d('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc21d('0x1d'),'uuid':_0x3de1d3[_0xc21d('0x7')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0xc21d('0x1e')]=function(_0x2cb418){return db[_0xc21d('0x1f')]['find'](_[_0xc21d('0x20')](_0x2cb418,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3536ab){return checkLicense(_0x3536ab,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 135c701..a570cfd 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 _0x7957=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x424144,_0x580e1f){var _0x1841b7=function(_0xd18c39){while(--_0xd18c39){_0x424144['push'](_0x424144['shift']());}};_0x1841b7(++_0x580e1f);}(_0x7957,0x8b));var _0x7795=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x7957[_0x1992f1];return _0x413dfe;};'use strict';module[_0x7795('0x0')]={'DOMAIN':_0x7795('0x1'),'SESSION_SECRET':_0x7795('0x2'),'GOOGLE_ID':_0x7795('0x3'),'GOOGLE_SECRET':_0x7795('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xb3f6=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xb3f6,0x198));var _0x6b3f=function(_0x3cca75,_0x20543b){_0x3cca75=_0x3cca75-0x0;var _0x54658b=_0xb3f6[_0x3cca75];return _0x54658b;};'use strict';module[_0x6b3f('0x0')]={'DOMAIN':_0x6b3f('0x1'),'SESSION_SECRET':_0x6b3f('0x2'),'GOOGLE_ID':_0x6b3f('0x3'),'GOOGLE_SECRET':_0x6b3f('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index b5812eb..5e2efcc 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2350=['message','exports','Logger','transports','File','%s-%s','error','info','Console','env','moment','path','INFO','join','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase'];(function(_0x11efff,_0x16c4c2){var _0x466108=function(_0x41f580){while(--_0x41f580){_0x11efff['push'](_0x11efff['shift']());}};_0x466108(++_0x16c4c2);}(_0x2350,0x106));var _0x0235=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x2350[_0x5d6e30];return _0x3d3f3b;};'use strict';var moment=require(_0x0235('0x0'));var winston=require('winston');var util=require('util');var path=require(_0x0235('0x1'));var debugLevel=_0x0235('0x2');function filename(_0x20a716,_0x52568d){return path[_0x0235('0x3')](_0x0235('0x4'),_0x0235('0x5'),_0x0235('0x6'),util[_0x0235('0x7')](_0x0235('0x8'),_0x20a716,_0x52568d));}function formatter(_0x34b2ba,_0x330cb4){return util[_0x0235('0x7')](_0x0235('0x9'),moment()[_0x0235('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x330cb4['level'][_0x0235('0xa')](),_0x34b2ba,_0x330cb4[_0x0235('0xb')]);}module[_0x0235('0xc')]=function(_0x9fc3df){return new winston[(_0x0235('0xd'))]({'transports':[new winston[(_0x0235('0xe'))][(_0x0235('0xf'))]({'name':util['format'](_0x0235('0x10'),_0x9fc3df,_0x0235('0x11')),'filename':filename(_0x9fc3df,_0x0235('0x11')),'level':_0x0235('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x16ce4d){return formatter(_0x9fc3df,_0x16ce4d);}}),new winston['transports'][(_0x0235('0xf'))]({'name':util[_0x0235('0x7')]('%s-%s',_0x9fc3df,_0x0235('0x12')),'filename':filename(_0x9fc3df,_0x0235('0x12')),'level':_0x0235('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1ebbf2){return formatter(_0x9fc3df,_0x1ebbf2);}}),new winston[(_0x0235('0xe'))][(_0x0235('0x13'))]({'level':process[_0x0235('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x5181d8){return formatter(_0x9fc3df,_0x5181d8);}})]});}; \ No newline at end of file +var _0x0a9b=['%s-%s.log','level','message','Logger','transports','File','%s-%s','error','info','Console','env','moment','winston','util','path','INFO','join','/var','xcally','format'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x0a9b,0x10f));var _0xb0a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a9b[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xb0a9('0x0'));var winston=require(_0xb0a9('0x1'));var util=require(_0xb0a9('0x2'));var path=require(_0xb0a9('0x3'));var debugLevel=_0xb0a9('0x4');function filename(_0x5e68c7,_0x2e10db){return path[_0xb0a9('0x5')](_0xb0a9('0x6'),'log',_0xb0a9('0x7'),util[_0xb0a9('0x8')](_0xb0a9('0x9'),_0x5e68c7,_0x2e10db));}function formatter(_0x3bdb90,_0x17c436){return util[_0xb0a9('0x8')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xb0a9('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),_0x17c436[_0xb0a9('0xa')]['toUpperCase'](),_0x3bdb90,_0x17c436[_0xb0a9('0xb')]);}module['exports']=function(_0x515530){return new winston[(_0xb0a9('0xc'))]({'transports':[new winston[(_0xb0a9('0xd'))][(_0xb0a9('0xe'))]({'name':util['format'](_0xb0a9('0xf'),_0x515530,_0xb0a9('0x10')),'filename':filename(_0x515530,_0xb0a9('0x10')),'level':_0xb0a9('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x101ce8){return formatter(_0x515530,_0x101ce8);}}),new winston[(_0xb0a9('0xd'))][(_0xb0a9('0xe'))]({'name':util[_0xb0a9('0x8')](_0xb0a9('0xf'),_0x515530,'info'),'filename':filename(_0x515530,_0xb0a9('0x11')),'level':_0xb0a9('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1449fb){return formatter(_0x515530,_0x1449fb);}}),new winston[(_0xb0a9('0xd'))][(_0xb0a9('0x12'))]({'level':process[_0xb0a9('0x13')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x25a244){return formatter(_0x515530,_0x25a244);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a5d359f..348ac59 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 _0xbdb0=['ami','../../services/ami/index.js','agi','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join'];(function(_0x8dd519,_0x2f5484){var _0x267c69=function(_0x181b42){while(--_0x181b42){_0x8dd519['push'](_0x8dd519['shift']());}};_0x267c69(++_0x2f5484);}(_0xbdb0,0x189));var _0x0bdb=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0xbdb0[_0x26efac];return _0x8482e4;};'use strict';var path=require(_0x0bdb('0x0'));var os=require('os');var config={'apps':[{'name':_0x0bdb('0x1'),'script':path[_0x0bdb('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x0bdb('0x3'),'script':path[_0x0bdb('0x2')](__dirname,_0x0bdb('0x4'))},{'name':_0x0bdb('0x5'),'script':path[_0x0bdb('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x0bdb('0x6'),'script':path['join'](__dirname,_0x0bdb('0x7'))},{'name':'routing','script':path[_0x0bdb('0x2')](__dirname,_0x0bdb('0x8'))},{'name':_0x0bdb('0x9'),'script':path[_0x0bdb('0x2')](__dirname,_0x0bdb('0xa'))}]};module[_0x0bdb('0xb')]=config; \ No newline at end of file +var _0x8521=['../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x9c173a,_0x461c9c){var _0x88d611=function(_0x4900c7){while(--_0x4900c7){_0x9c173a['push'](_0x9c173a['shift']());}};_0x88d611(++_0x461c9c);}(_0x8521,0xf1));var _0x1852=function(_0x4b4d75,_0x18d077){_0x4b4d75=_0x4b4d75-0x0;var _0x54c7a7=_0x8521[_0x4b4d75];return _0x54c7a7;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x1852('0x0'),'script':path[_0x1852('0x1')](__dirname,_0x1852('0x2'))},{'name':_0x1852('0x3'),'script':path[_0x1852('0x1')](__dirname,_0x1852('0x4'))},{'name':_0x1852('0x5'),'script':path[_0x1852('0x1')](__dirname,_0x1852('0x6'))},{'name':_0x1852('0x7'),'script':path['join'](__dirname,_0x1852('0x8'))},{'name':_0x1852('0x9'),'script':path['join'](__dirname,_0x1852('0xa'))},{'name':'xdr','script':path[_0x1852('0x1')](__dirname,_0x1852('0xb'))}]};module[_0x1852('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 8b47e1d..fb26165 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 _0x3975=['describe','delete','dump','saved','pm2','bluebird','connected','then','start','disconnect','stop','restart','list'];(function(_0x168fd3,_0x11fbbd){var _0x47f2b7=function(_0x5971ed){while(--_0x5971ed){_0x168fd3['push'](_0x168fd3['shift']());}};_0x47f2b7(++_0x11fbbd);}(_0x3975,0x197));var _0x5397=function(_0x5d6986,_0x597309){_0x5d6986=_0x5d6986-0x0;var _0x26f74e=_0x3975[_0x5d6986];return _0x26f74e;};'use strict';var pm2=require(_0x5397('0x0'));var BPromise=require(_0x5397('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x30e982,_0x5d2737){return pm2['connect'](function(_0xee7ee0){if(_0xee7ee0){return _0x5d2737(_0xee7ee0);}return _0x30e982(_0x5397('0x2'));});});};exports['start']=function(_0x428db9){return connect()[_0x5397('0x3')](function(){return new BPromise(function(_0xff755e,_0xda67de){return pm2[_0x5397('0x4')](_0x428db9,function(_0x286060,_0x3a85a0){if(_0x286060){return _0xda67de(_0x286060);}pm2[_0x5397('0x5')]();return _0xff755e(_0x3a85a0);});});});};exports[_0x5397('0x6')]=function(_0x49876f){return connect()['then'](function(){return new BPromise(function(_0xb99845,_0x5ef45b){return pm2[_0x5397('0x6')](_0x49876f,function(_0x49383a,_0x1168b4){if(_0x49383a){return _0x5ef45b(_0x49383a);}pm2[_0x5397('0x5')]();return _0xb99845(_0x1168b4);});});});};exports[_0x5397('0x7')]=function(_0x16af62){return connect()[_0x5397('0x3')](function(){return new BPromise(function(_0x31f1e8,_0x17d74f){return pm2[_0x5397('0x7')](_0x16af62,function(_0x299397,_0x2aaea6){if(_0x299397){return _0x17d74f(_0x299397);}pm2[_0x5397('0x5')]();return _0x31f1e8(_0x2aaea6);});});});};exports['list']=function(){return connect()[_0x5397('0x3')](function(){return new BPromise(function(_0x197490,_0x5dff91){return pm2[_0x5397('0x8')](function(_0x4e8bed,_0x299ea1){if(_0x4e8bed){return _0x5dff91(_0x4e8bed);}pm2[_0x5397('0x5')]();return _0x197490(_0x299ea1);});});});};exports['describe']=function(_0x13d561){return connect()[_0x5397('0x3')](function(){return new BPromise(function(_0x2c9c59,_0x520116){return pm2[_0x5397('0x9')](_0x13d561,function(_0x41ca45,_0x1972bc){if(_0x41ca45){return _0x520116(_0x41ca45);}pm2[_0x5397('0x5')]();return _0x2c9c59(_0x1972bc);});});});};exports[_0x5397('0xa')]=function(_0x3bd11f){return connect()['then'](function(){return new BPromise(function(_0x27d330,_0x954aa9){return pm2[_0x5397('0xa')](_0x3bd11f,function(_0x8a6940,_0x4f975b){if(_0x8a6940){return _0x954aa9(_0x8a6940);}pm2[_0x5397('0x5')]();return _0x27d330(_0x4f975b);});});});};exports[_0x5397('0xb')]=function(){return connect()[_0x5397('0x3')](function(){return new BPromise(function(_0x2ba432,_0x5b79e1){return pm2[_0x5397('0xb')](function(_0x2c5a5f){if(_0x2c5a5f){return _0x5b79e1(_0x2c5a5f);}return _0x2ba432(_0x5397('0xc'));});});});}; \ No newline at end of file +var _0x3c94=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0x3c94,0xcd));var _0x43c9=function(_0x49ff3f,_0x531e8f){_0x49ff3f=_0x49ff3f-0x0;var _0x4f9703=_0x3c94[_0x49ff3f];return _0x4f9703;};'use strict';var pm2=require(_0x43c9('0x0'));var BPromise=require(_0x43c9('0x1'));var config=require(_0x43c9('0x2'));function connect(){return new BPromise(function(_0x20116b,_0x188507){return pm2[_0x43c9('0x3')](function(_0xe05adb){if(_0xe05adb){return _0x188507(_0xe05adb);}return _0x20116b(_0x43c9('0x4'));});});};exports[_0x43c9('0x5')]=function(_0x44fc3){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x3da043,_0x4fdfc2){return pm2[_0x43c9('0x5')](_0x44fc3,function(_0xf03007,_0x695b4f){if(_0xf03007){return _0x4fdfc2(_0xf03007);}pm2[_0x43c9('0x7')]();return _0x3da043(_0x695b4f);});});});};exports[_0x43c9('0x8')]=function(_0x7a0f6b){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x4725aa,_0x45f3a1){return pm2['stop'](_0x7a0f6b,function(_0x31d997,_0x18a5c9){if(_0x31d997){return _0x45f3a1(_0x31d997);}pm2[_0x43c9('0x7')]();return _0x4725aa(_0x18a5c9);});});});};exports[_0x43c9('0x9')]=function(_0x27ad97){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x690bde,_0x305fcb){return pm2[_0x43c9('0x9')](_0x27ad97,function(_0x18f520,_0x62bb3b){if(_0x18f520){return _0x305fcb(_0x18f520);}pm2[_0x43c9('0x7')]();return _0x690bde(_0x62bb3b);});});});};exports[_0x43c9('0xa')]=function(){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0xa98d2f,_0x45546d){return pm2[_0x43c9('0xa')](function(_0x569fa9,_0x37932f){if(_0x569fa9){return _0x45546d(_0x569fa9);}pm2[_0x43c9('0x7')]();return _0xa98d2f(_0x37932f);});});});};exports[_0x43c9('0xb')]=function(_0xe02707){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x5cc1fa,_0x549d3f){return pm2[_0x43c9('0xb')](_0xe02707,function(_0x9a0f50,_0x15035a){if(_0x9a0f50){return _0x549d3f(_0x9a0f50);}pm2[_0x43c9('0x7')]();return _0x5cc1fa(_0x15035a);});});});};exports['delete']=function(_0x1d63cf){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x38fe46,_0x22bf3d){return pm2[_0x43c9('0xc')](_0x1d63cf,function(_0x2ab239,_0x24db4e){if(_0x2ab239){return _0x22bf3d(_0x2ab239);}pm2[_0x43c9('0x7')]();return _0x38fe46(_0x24db4e);});});});};exports[_0x43c9('0xd')]=function(){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x3f841a,_0x4847b2){return pm2[_0x43c9('0xd')](function(_0x772b71){if(_0x772b71){return _0x4847b2(_0x772b71);}return _0x3f841a(_0x43c9('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 39d4335..14f3209 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 _0x180e=['lastMsgAt','subtract','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','emit','catch','start','moment','ioredis','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll'];(function(_0x44b5ed,_0x2ed256){var _0x26edab=function(_0x5536c3){while(--_0x5536c3){_0x44b5ed['push'](_0x44b5ed['shift']());}};_0x26edab(++_0x2ed256);}(_0x180e,0x121));var _0xe180=function(_0x2e0bed,_0x24b28d){_0x2e0bed=_0x2e0bed-0x0;var _0x45e74e=_0x180e[_0x2e0bed];return _0x45e74e;};'use strict';var _=require('lodash');var moment=require(_0xe180('0x0'));var Redis=require(_0xe180('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');config[_0xe180('0x2')]=_['defaults'](config[_0xe180('0x2')],{'host':_0xe180('0x3'),'port':0x18eb});var io=require(_0xe180('0x4'))(new Redis(config['redis']));function closeInteractions(){var _0x1d6622=0x0;var _0x4e0051=[];return db[_0xe180('0x5')][_0xe180('0x6')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xe180('0x7')](function(_0x2b9a61){_0x1d6622=_0x2b9a61[_0xe180('0x8')];if(_0x1d6622){return db[_0xe180('0x9')][_0xe180('0xa')]({'raw':!![],'attributes':['id',_0xe180('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe180('0xc')](_0x2b9a61[_0xe180('0x8')],'minutes')}}});}else{return[];}})['then'](function(_0x1f53a7){_0x4e0051=_0x1f53a7;if(_0x1d6622){return db[_0xe180('0x9')]['update']({'closeReason':'system','disposition':_0xe180('0xd'),'closed':!![],'closedAt':moment()[_0xe180('0xe')](_0xe180('0xf'))},{'where':{'id':_[_0xe180('0x10')](_0x4e0051||[],'id')}});}})['then'](function(_0x243f26){for(var _0x3a06e6=0x0;_0x3a06e6<_0x4e0051['length'];_0x3a06e6++){io[_0xe180('0x11')]('chatInteraction:update',{'id':_0x4e0051[_0x3a06e6]['id'],'closed':!![]});}})[_0xe180('0x12')](function(_0x598c69){console['error'](_0x598c69);});}exports[_0xe180('0x13')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf740=['localhost','Setting','find','chatTimeout','ChatInteraction','findAll','subtract','minutes','then','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults'];(function(_0x142c7e,_0x8fe03a){var _0x1978dd=function(_0x4cd1f1){while(--_0x4cd1f1){_0x142c7e['push'](_0x142c7e['shift']());}};_0x1978dd(++_0x8fe03a);}(_0xf740,0x9b));var _0x0f74=function(_0x48326a,_0x8cfa0c){_0x48326a=_0x48326a-0x0;var _0x466709=_0xf740[_0x48326a];return _0x466709;};'use strict';var _=require(_0x0f74('0x0'));var moment=require(_0x0f74('0x1'));var Redis=require(_0x0f74('0x2'));var db=require(_0x0f74('0x3'))['db'];var config=require(_0x0f74('0x4'));config[_0x0f74('0x5')]=_[_0x0f74('0x6')](config[_0x0f74('0x5')],{'host':_0x0f74('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0f74('0x5')]));function closeInteractions(){var _0x264c5c=0x0;var _0x38131f=[];return db[_0x0f74('0x8')][_0x0f74('0x9')]({'raw':!![],'attributes':['id',_0x0f74('0xa')],'where':{'id':0x1}})['then'](function(_0x2f4baa){_0x264c5c=_0x2f4baa[_0x0f74('0xa')];if(_0x264c5c){return db[_0x0f74('0xb')][_0x0f74('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0f74('0xd')](_0x2f4baa[_0x0f74('0xa')],_0x0f74('0xe'))}}});}else{return[];}})[_0x0f74('0xf')](function(_0x107c9a){_0x38131f=_0x107c9a;if(_0x264c5c){return db[_0x0f74('0xb')]['update']({'closeReason':_0x0f74('0x10'),'disposition':_0x0f74('0x11'),'closed':!![],'closedAt':moment()[_0x0f74('0x12')](_0x0f74('0x13'))},{'where':{'id':_[_0x0f74('0x14')](_0x38131f||[],'id')}});}})[_0x0f74('0xf')](function(_0x4f02c9){for(var _0x50c09d=0x0;_0x50c09d<_0x38131f[_0x0f74('0x15')];_0x50c09d++){io[_0x0f74('0x16')](_0x0f74('0x17'),{'id':_0x38131f[_0x50c09d]['id'],'closed':!![]});}})[_0x0f74('0x18')](function(_0x3f143e){console[_0x0f74('0x19')](_0x3f143e);});}exports[_0x0f74('0x1a')]=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 838a563..d501045 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 _0x05cb=['auth','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','catch','error\x20mail','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','Schedule','findAll','MailServerOut','toString','keyBy','difference','length','stop','deleteJob','delete\x20cron','toRun','index','resolve','cron','active','startAt','endAt','add','start','add\x20cron','stop\x20cron','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','MailAccount','service','Smtp','host','port','secure','authentication'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x05cb,0x1f2));var _0xb05c=function(_0x11f300,_0xf1fb97){_0x11f300=_0x11f300-0x0;var _0x2ef990=_0x05cb[_0x11f300];return _0x2ef990;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xb05c('0x0'));var _=require('lodash');var moment=require(_0xb05c('0x1'));var CronJobManager=require(_0xb05c('0x2'));var jayson=require(_0xb05c('0x3'));var BPromise=require(_0xb05c('0x4'));var logger=require(_0xb05c('0x5'))('schedule');var db=require(_0xb05c('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xb05c('0x7'));var client=jayson[_0xb05c('0x8')][_0xb05c('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3dbd44,_0x24e42e){return function(){logger[_0xb05c('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x3dbd44['email']);var _0x48fef4=!![];var _0xba330e={'tls':{'rejectUnauthorized':![]}};if(_0x3dbd44[_0xb05c('0xb')]['Smtp'][_0xb05c('0xc')]){_0xba330e[_0xb05c('0xc')]=_0x3dbd44[_0xb05c('0xb')][_0xb05c('0xd')]['service'];}else{_0xba330e[_0xb05c('0xe')]=_0x3dbd44['MailAccount'][_0xb05c('0xd')][_0xb05c('0xe')];_0xba330e['port']=_0x3dbd44['MailAccount'][_0xb05c('0xd')][_0xb05c('0xf')];_0xba330e[_0xb05c('0x10')]=_0x3dbd44['MailAccount']['Smtp'][_0xb05c('0x10')];}if(_0x3dbd44[_0xb05c('0xb')][_0xb05c('0xd')][_0xb05c('0x11')]){_0xba330e[_0xb05c('0x12')]={'user':_0x3dbd44[_0xb05c('0xb')][_0xb05c('0xd')][_0xb05c('0x13')],'pass':_0x3dbd44[_0xb05c('0xb')][_0xb05c('0xd')][_0xb05c('0x14')]};}var _0x519905={'account':_0xba330e,'message':{'from':util[_0xb05c('0x15')](_0xb05c('0x16'),_0x3dbd44['MailAccount'][_0xb05c('0x17')],_0x3dbd44[_0xb05c('0xb')][_0xb05c('0x18')]||_0x3dbd44['MailAccount'][_0xb05c('0xd')][_0xb05c('0x13')]),'to':_0x3dbd44[_0xb05c('0x18')],'cc':_0x3dbd44['cc'],'bcc':_0x3dbd44[_0xb05c('0x19')],'subject':util[_0xb05c('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0x24e42e[_0xb05c('0x17')],_0x3dbd44['subtractNumber'],_0x3dbd44[_0xb05c('0x1a')])}};var _0x3a90b0=path[_0xb05c('0x1b')](__dirname,_0xb05c('0x1c'));var _0x10ceef=_0x24e42e[_0xb05c('0x1d')];var _0x427c68=util[_0xb05c('0x15')](_0xb05c('0x1e'),path[_0xb05c('0x1f')](_0x24e42e[_0xb05c('0x1d')],path[_0xb05c('0x20')](_0x24e42e['savename'])),'zip');var _0x7334fe=path[_0xb05c('0x1b')](_0x3a90b0,_0x10ceef);var _0x22121c=path[_0xb05c('0x1b')](_0x3a90b0,_0x427c68);if(fs[_0xb05c('0x21')](_0x7334fe)){_0x24e42e[_0xb05c('0x22')]='Sent';_0x519905[_0xb05c('0x23')]['attachments']=[{'filename':_0x10ceef,'path':_0x7334fe}];_0x519905[_0xb05c('0x23')][_0xb05c('0x24')]=util['format'](_0xb05c('0x25'),JSON[_0xb05c('0x26')](_0x24e42e,null,0x2));}else if(fs[_0xb05c('0x21')](_0x22121c)){_0x24e42e[_0xb05c('0x22')]=_0xb05c('0x27');_0x519905[_0xb05c('0x23')][_0xb05c('0x28')]=[{'filename':_0x427c68,'path':_0x22121c}];}else{_0x519905['message'][_0xb05c('0x24')]=_0xb05c('0x29');if(!_0x3dbd44[_0xb05c('0x2a')]){_0x48fef4=![];logger[_0xb05c('0xa')](_0xb05c('0x2b'));}}if(_0x48fef4){return client[_0xb05c('0x2c')](_0xb05c('0x2d'),_0x519905)['then'](function(_0x51f090){if(_0x51f090[_0xb05c('0x2e')]){return logger[_0xb05c('0x2e')]('error\x20mail',JSON['stringify'](_0x51f090));}return logger[_0xb05c('0xa')]('email\x20sent');})[_0xb05c('0x2f')](function(_0xc27630){return logger['error'](_0xb05c('0x30'),JSON[_0xb05c('0x26')](_0xc27630));});}};}function handleError(){return function(_0x45c0be){return logger[_0xb05c('0x2e')](JSON[_0xb05c('0x26')](_0x45c0be));};}function handleResult(_0x44600a){return function(_0x49e393){logger['info'](_0xb05c('0x31'),JSON[_0xb05c('0x26')](_0x49e393));if(_0x44600a[_0xb05c('0xb')]&&_0x44600a[_0xb05c('0xb')][_0xb05c('0xd')]&&!_['isNil'](_0x44600a[_0xb05c('0x18')])){setTimeout(handleSendEmail(_0x44600a,_0x49e393),0x3c*0x3e8);}};}function handleJob(_0x921ead){return function(){try{if(_[_0xb05c('0x32')](_0x921ead[_0xb05c('0x33')])){return logger['info'](_0xb05c('0x34'));}if(_[_0xb05c('0x32')](_0x921ead['subtractUnit'])){return logger[_0xb05c('0xa')](_0xb05c('0x35'));}var _0x342721={'startDate':moment()[_0xb05c('0x36')](_0x921ead[_0xb05c('0x33')],_0x921ead['subtractUnit'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xb05c('0x15')](_0xb05c('0x37')),'type':_0xb05c('0x38'),'output':_0x921ead[_0xb05c('0x39')],'name':_0x921ead[_0xb05c('0x17')]};if(!_[_0xb05c('0x32')](_0x921ead[_0xb05c('0x3a')])){logger[_0xb05c('0xa')](_0xb05c('0x3b'),_0x921ead['DefaultReportId']);return analyticDefaultReportController[_0xb05c('0x3c')]({'id':_0x921ead[_0xb05c('0x3a')]},_0x342721)['then'](handleResult(_0x921ead))[_0xb05c('0x2f')](handleError());}if(!_[_0xb05c('0x32')](_0x921ead[_0xb05c('0x3d')])){logger[_0xb05c('0xa')](_0xb05c('0x3e'),_0x921ead[_0xb05c('0x3d')]);return analyticCustomReportController[_0xb05c('0x3c')]({'id':_0x921ead['CustomReportId']},_0x342721)[_0xb05c('0x3f')](handleResult(_0x921ead))['catch'](handleError());}}catch(_0x50caff){logger[_0xb05c('0x2e')](JSON[_0xb05c('0x26')](_0x50caff));}return logger[_0xb05c('0xa')](_0xb05c('0x40'));};}function getJobs(_0x2180a1){var _0x2cf0b7={};if(_0x2180a1){_0x2cf0b7['id']=_0x2180a1;}return db[_0xb05c('0x41')][_0xb05c('0x42')]({'where':_0x2cf0b7,'include':[{'model':db[_0xb05c('0xb')],'attributes':['id','name',_0xb05c('0x18')],'include':[{'model':db[_0xb05c('0x43')],'as':_0xb05c('0xd')}]}]})[_0xb05c('0x3f')](function(_0x3f1390){var _0x4d2ce0=_['keys'](manager['jobs']);var _0x4e4dbc=_['map'](_0x3f1390,function(_0x52dae3){return _0x52dae3['id'][_0xb05c('0x44')]();});var _0x27341b=_[_0xb05c('0x45')](_0x3f1390,function(_0x5d7cfe){return _0x5d7cfe['id'][_0xb05c('0x44')]();});var _0x56ad1b=_0x2180a1?_0x4e4dbc:_[_0xb05c('0x46')](_0x4e4dbc,_0x4d2ce0);var _0x64568c=_['intersection'](_0x4e4dbc,_0x4d2ce0);var _0x1d7713=_[_0xb05c('0x46')](_0x4d2ce0,_0x4e4dbc);var _0x39cdde;var _0x1ba508;for(_0x39cdde=0x0;_0x39cdde<_0x1d7713[_0xb05c('0x47')]&&!_0x2180a1;_0x39cdde+=0x1){_0x1ba508=_0x1d7713[_0x39cdde][_0xb05c('0x44')]();if(manager['exists'](_0x1ba508)){manager[_0xb05c('0x48')](_0x1ba508);manager[_0xb05c('0x49')](_0x1ba508);logger[_0xb05c('0xa')](_0xb05c('0x4a'),_0x1ba508);}}logger['info'](_0xb05c('0x4b'),JSON[_0xb05c('0x26')](_0x56ad1b));for(_0x39cdde=0x0;_0x39cdde<_0x56ad1b[_0xb05c('0x47')];_0x39cdde+=0x1){_0x1ba508=_0x56ad1b[_0x39cdde][_0xb05c('0x44')]();logger[_0xb05c('0xa')](_0xb05c('0x4c'),_0x1ba508);if(_0x2180a1){logger[_0xb05c('0xa')]('my\x20id',_0x2180a1);logger[_0xb05c('0xa')](JSON['stringify'](_0x27341b[_0x1ba508]));BPromise[_0xb05c('0x4d')]()[_0xb05c('0x3f')](handleJob(_0x27341b[_0x1ba508]));logger[_0xb05c('0xa')]('run\x20job',_0x27341b[_0x1ba508][_0xb05c('0x17')],_0x27341b[_0x1ba508][_0xb05c('0x4e')]);}else if(_0x27341b[_0x1ba508]['cron']&&_0x27341b[_0x1ba508][_0xb05c('0x4f')]&&moment()['isBetween'](_0x27341b[_0x1ba508][_0xb05c('0x50')],_0x27341b[_0x1ba508][_0xb05c('0x51')])){manager[_0xb05c('0x52')](_0x1ba508,_0x27341b[_0x1ba508][_0xb05c('0x4e')],handleJob(_0x27341b[_0x1ba508]));manager[_0xb05c('0x53')](_0x1ba508);logger[_0xb05c('0xa')](_0xb05c('0x54'),_0x27341b[_0x1ba508][_0xb05c('0x17')],_0x27341b[_0x1ba508][_0xb05c('0x4e')]);}else if(manager['exists'](_0x1ba508)){manager[_0xb05c('0x48')](_0x1ba508);manager['deleteJob'](_0x1ba508);logger['info'](_0xb05c('0x55'),_0x27341b[_0x1ba508][_0xb05c('0x17')],_0x27341b[_0x1ba508]['cron']);}}for(_0x39cdde=0x0,_0x1ba508;_0x39cdde<_0x64568c['length']&&!_0x2180a1;_0x39cdde+=0x1){_0x1ba508=_0x64568c[_0x39cdde][_0xb05c('0x44')]();if(manager['exists'](_0x1ba508)){if(_0x27341b[_0x1ba508][_0xb05c('0x4e')]&&_0x27341b[_0x1ba508][_0xb05c('0x4f')]&&moment()['isBetween'](_0x27341b[_0x1ba508][_0xb05c('0x50')],_0x27341b[_0x1ba508][_0xb05c('0x51')])){manager['update'](_0x1ba508,_0x27341b[_0x1ba508][_0xb05c('0x4e')],handleJob(_0x27341b[_0x1ba508]));logger['info']('update\x20cron',_0x27341b[_0x1ba508][_0xb05c('0x17')],_0x27341b[_0x1ba508]['cron']);}else{manager[_0xb05c('0x48')](_0x1ba508);manager[_0xb05c('0x49')](_0x1ba508);logger[_0xb05c('0xa')]('stop\x20cron',_0x27341b[_0x1ba508][_0xb05c('0x17')],_0x27341b[_0x1ba508][_0xb05c('0x4e')]);}}}})['catch'](function(_0x485330){logger['error'](JSON[_0xb05c('0x26')](_0x485330));});}exports['run']=function(_0x301d89){return getJobs(_0x301d89);};exports[_0xb05c('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb297=['auth','user','pass','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','email\x20sent','catch','error\x20mail','isNil','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','Schedule','MailServerOut','jobs','map','toString','keyBy','intersection','difference','exists','stop','length','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','deleteJob','stop\x20cron','update','run','util','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','secure','authentication'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xb297,0x135));var _0x7b29=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xb297[_0x19babd];return _0x314eaf;};'use strict';var fs=require('fs');var util=require(_0x7b29('0x0'));var path=require('path');var _=require(_0x7b29('0x1'));var moment=require(_0x7b29('0x2'));var CronJobManager=require(_0x7b29('0x3'));var jayson=require(_0x7b29('0x4'));var BPromise=require('bluebird');var logger=require(_0x7b29('0x5'))(_0x7b29('0x6'));var db=require(_0x7b29('0x7'))['db'];var analyticCustomReportController=require(_0x7b29('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x7b29('0x9')][_0x7b29('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xc57220,_0x4ca514){return function(){logger['info'](_0x7b29('0xb'),_0xc57220[_0x7b29('0xc')]);var _0x3cf3cc=!![];var _0x23d082={'tls':{'rejectUnauthorized':![]}};if(_0xc57220[_0x7b29('0xd')][_0x7b29('0xe')][_0x7b29('0xf')]){_0x23d082['service']=_0xc57220['MailAccount']['Smtp']['service'];}else{_0x23d082[_0x7b29('0x10')]=_0xc57220['MailAccount'][_0x7b29('0xe')][_0x7b29('0x10')];_0x23d082['port']=_0xc57220['MailAccount'][_0x7b29('0xe')]['port'];_0x23d082[_0x7b29('0x11')]=_0xc57220[_0x7b29('0xd')][_0x7b29('0xe')][_0x7b29('0x11')];}if(_0xc57220[_0x7b29('0xd')][_0x7b29('0xe')][_0x7b29('0x12')]){_0x23d082[_0x7b29('0x13')]={'user':_0xc57220['MailAccount'][_0x7b29('0xe')][_0x7b29('0x14')],'pass':_0xc57220[_0x7b29('0xd')][_0x7b29('0xe')][_0x7b29('0x15')]};}var _0x472ec1={'account':_0x23d082,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0xc57220[_0x7b29('0xd')]['name'],_0xc57220[_0x7b29('0xd')]['email']||_0xc57220[_0x7b29('0xd')][_0x7b29('0xe')][_0x7b29('0x14')]),'to':_0xc57220[_0x7b29('0xc')],'cc':_0xc57220['cc'],'bcc':_0xc57220[_0x7b29('0x16')],'subject':util[_0x7b29('0x17')](_0x7b29('0x18'),_0x4ca514[_0x7b29('0x19')],_0xc57220[_0x7b29('0x1a')],_0xc57220[_0x7b29('0x1b')])}};var _0x25b71c=path[_0x7b29('0x1c')](__dirname,_0x7b29('0x1d'));var _0x59a19f=_0x4ca514[_0x7b29('0x1e')];var _0x3b63c0=util[_0x7b29('0x17')]('%s.%s',path[_0x7b29('0x1f')](_0x4ca514[_0x7b29('0x1e')],path['extname'](_0x4ca514['savename'])),_0x7b29('0x20'));var _0x10b1a9=path['join'](_0x25b71c,_0x59a19f);var _0x5c8180=path[_0x7b29('0x1c')](_0x25b71c,_0x3b63c0);if(fs[_0x7b29('0x21')](_0x10b1a9)){_0x4ca514[_0x7b29('0x22')]=_0x7b29('0x23');_0x472ec1[_0x7b29('0x24')][_0x7b29('0x25')]=[{'filename':_0x59a19f,'path':_0x10b1a9}];_0x472ec1[_0x7b29('0x24')][_0x7b29('0x26')]=util[_0x7b29('0x17')](_0x7b29('0x27'),JSON[_0x7b29('0x28')](_0x4ca514,null,0x2));}else if(fs[_0x7b29('0x21')](_0x5c8180)){_0x4ca514[_0x7b29('0x22')]=_0x7b29('0x23');_0x472ec1[_0x7b29('0x24')][_0x7b29('0x25')]=[{'filename':_0x3b63c0,'path':_0x5c8180}];}else{_0x472ec1[_0x7b29('0x24')][_0x7b29('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xc57220[_0x7b29('0x29')]){_0x3cf3cc=![];logger[_0x7b29('0x2a')](_0x7b29('0x2b'));}}if(_0x3cf3cc){return client[_0x7b29('0x2c')]('SendMail',_0x472ec1)[_0x7b29('0x2d')](function(_0x72a21c){if(_0x72a21c[_0x7b29('0x2e')]){return logger[_0x7b29('0x2e')]('error\x20mail',JSON['stringify'](_0x72a21c));}return logger[_0x7b29('0x2a')](_0x7b29('0x2f'));})[_0x7b29('0x30')](function(_0x3d61a3){return logger[_0x7b29('0x2e')](_0x7b29('0x31'),JSON[_0x7b29('0x28')](_0x3d61a3));});}};}function handleError(){return function(_0x52c0b0){return logger['error'](JSON[_0x7b29('0x28')](_0x52c0b0));};}function handleResult(_0x445ae6){return function(_0x3f4f5c){logger[_0x7b29('0x2a')]('data',JSON[_0x7b29('0x28')](_0x3f4f5c));if(_0x445ae6[_0x7b29('0xd')]&&_0x445ae6[_0x7b29('0xd')][_0x7b29('0xe')]&&!_['isNil'](_0x445ae6[_0x7b29('0xc')])){setTimeout(handleSendEmail(_0x445ae6,_0x3f4f5c),0x3c*0x3e8);}};}function handleJob(_0x13f086){return function(){try{if(_[_0x7b29('0x32')](_0x13f086[_0x7b29('0x1a')])){return logger[_0x7b29('0x2a')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x7b29('0x32')](_0x13f086[_0x7b29('0x1b')])){return logger[_0x7b29('0x2a')]('subtractUnit\x20null\x20or\x20undefined');}var _0x414110={'startDate':moment()['subtract'](_0x13f086['subtractNumber'],_0x13f086[_0x7b29('0x1b')])[_0x7b29('0x17')](_0x7b29('0x33')),'endDate':moment()['format'](_0x7b29('0x33')),'type':_0x7b29('0x34'),'output':_0x13f086['output'],'name':_0x13f086[_0x7b29('0x19')]};if(!_[_0x7b29('0x32')](_0x13f086[_0x7b29('0x35')])){logger[_0x7b29('0x2a')]('exec\x20defaul\x20report\x20id:%s',_0x13f086[_0x7b29('0x35')]);return analyticDefaultReportController['runReport']({'id':_0x13f086[_0x7b29('0x35')]},_0x414110)[_0x7b29('0x2d')](handleResult(_0x13f086))[_0x7b29('0x30')](handleError());}if(!_['isNil'](_0x13f086[_0x7b29('0x36')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x13f086[_0x7b29('0x36')]);return analyticCustomReportController[_0x7b29('0x37')]({'id':_0x13f086['CustomReportId']},_0x414110)[_0x7b29('0x2d')](handleResult(_0x13f086))[_0x7b29('0x30')](handleError());}}catch(_0x2ecb98){logger[_0x7b29('0x2e')](JSON[_0x7b29('0x28')](_0x2ecb98));}return logger[_0x7b29('0x2a')](_0x7b29('0x38'));};}function getJobs(_0x4fd55f){var _0x1e2012={};if(_0x4fd55f){_0x1e2012['id']=_0x4fd55f;}return db[_0x7b29('0x39')]['findAll']({'where':_0x1e2012,'include':[{'model':db[_0x7b29('0xd')],'attributes':['id',_0x7b29('0x19'),_0x7b29('0xc')],'include':[{'model':db[_0x7b29('0x3a')],'as':_0x7b29('0xe')}]}]})[_0x7b29('0x2d')](function(_0x18308e){var _0x46ac86=_['keys'](manager[_0x7b29('0x3b')]);var _0x39fe43=_[_0x7b29('0x3c')](_0x18308e,function(_0x2753aa){return _0x2753aa['id'][_0x7b29('0x3d')]();});var _0x234040=_[_0x7b29('0x3e')](_0x18308e,function(_0x21d607){return _0x21d607['id'][_0x7b29('0x3d')]();});var _0x4c082f=_0x4fd55f?_0x39fe43:_['difference'](_0x39fe43,_0x46ac86);var _0x30ba9f=_[_0x7b29('0x3f')](_0x39fe43,_0x46ac86);var _0x356e6b=_[_0x7b29('0x40')](_0x46ac86,_0x39fe43);var _0x5b1849;var _0x3f5cd7;for(_0x5b1849=0x0;_0x5b1849<_0x356e6b['length']&&!_0x4fd55f;_0x5b1849+=0x1){_0x3f5cd7=_0x356e6b[_0x5b1849][_0x7b29('0x3d')]();if(manager[_0x7b29('0x41')](_0x3f5cd7)){manager[_0x7b29('0x42')](_0x3f5cd7);manager['deleteJob'](_0x3f5cd7);logger[_0x7b29('0x2a')]('delete\x20cron',_0x3f5cd7);}}logger[_0x7b29('0x2a')]('toRun',JSON['stringify'](_0x4c082f));for(_0x5b1849=0x0;_0x5b1849<_0x4c082f[_0x7b29('0x43')];_0x5b1849+=0x1){_0x3f5cd7=_0x4c082f[_0x5b1849][_0x7b29('0x3d')]();logger[_0x7b29('0x2a')](_0x7b29('0x44'),_0x3f5cd7);if(_0x4fd55f){logger[_0x7b29('0x2a')](_0x7b29('0x45'),_0x4fd55f);logger[_0x7b29('0x2a')](JSON[_0x7b29('0x28')](_0x234040[_0x3f5cd7]));BPromise[_0x7b29('0x46')]()[_0x7b29('0x2d')](handleJob(_0x234040[_0x3f5cd7]));logger[_0x7b29('0x2a')]('run\x20job',_0x234040[_0x3f5cd7][_0x7b29('0x19')],_0x234040[_0x3f5cd7][_0x7b29('0x47')]);}else if(_0x234040[_0x3f5cd7]['cron']&&_0x234040[_0x3f5cd7][_0x7b29('0x48')]&&moment()[_0x7b29('0x49')](_0x234040[_0x3f5cd7][_0x7b29('0x4a')],_0x234040[_0x3f5cd7][_0x7b29('0x4b')])){manager[_0x7b29('0x4c')](_0x3f5cd7,_0x234040[_0x3f5cd7][_0x7b29('0x47')],handleJob(_0x234040[_0x3f5cd7]));manager[_0x7b29('0x4d')](_0x3f5cd7);logger['info']('add\x20cron',_0x234040[_0x3f5cd7][_0x7b29('0x19')],_0x234040[_0x3f5cd7]['cron']);}else if(manager[_0x7b29('0x41')](_0x3f5cd7)){manager[_0x7b29('0x42')](_0x3f5cd7);manager[_0x7b29('0x4e')](_0x3f5cd7);logger[_0x7b29('0x2a')](_0x7b29('0x4f'),_0x234040[_0x3f5cd7][_0x7b29('0x19')],_0x234040[_0x3f5cd7][_0x7b29('0x47')]);}}for(_0x5b1849=0x0,_0x3f5cd7;_0x5b1849<_0x30ba9f[_0x7b29('0x43')]&&!_0x4fd55f;_0x5b1849+=0x1){_0x3f5cd7=_0x30ba9f[_0x5b1849][_0x7b29('0x3d')]();if(manager['exists'](_0x3f5cd7)){if(_0x234040[_0x3f5cd7][_0x7b29('0x47')]&&_0x234040[_0x3f5cd7][_0x7b29('0x48')]&&moment()[_0x7b29('0x49')](_0x234040[_0x3f5cd7][_0x7b29('0x4a')],_0x234040[_0x3f5cd7][_0x7b29('0x4b')])){manager[_0x7b29('0x50')](_0x3f5cd7,_0x234040[_0x3f5cd7][_0x7b29('0x47')],handleJob(_0x234040[_0x3f5cd7]));logger['info']('update\x20cron',_0x234040[_0x3f5cd7][_0x7b29('0x19')],_0x234040[_0x3f5cd7][_0x7b29('0x47')]);}else{manager[_0x7b29('0x42')](_0x3f5cd7);manager['deleteJob'](_0x3f5cd7);logger[_0x7b29('0x2a')]('stop\x20cron',_0x234040[_0x3f5cd7][_0x7b29('0x19')],_0x234040[_0x3f5cd7][_0x7b29('0x47')]);}}}})['catch'](function(_0x526c5d){logger[_0x7b29('0x2e')](JSON[_0x7b29('0x28')](_0x526c5d));});}exports[_0x7b29('0x51')]=function(_0x327566){return getJobs(_0x327566);};exports[_0x7b29('0x4d')]=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 8826191..c705135 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 _0x0f97=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','findOne','COMPLETED','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','ValidationError','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20configured','data1','then','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason'];(function(_0x184ab1,_0x54af78){var _0x2896aa=function(_0x1c857b){while(--_0x1c857b){_0x184ab1['push'](_0x184ab1['shift']());}};_0x2896aa(++_0x54af78);}(_0x0f97,0x1c0));var _0x70f9=function(_0x79a6e8,_0x1c2b24){_0x79a6e8=_0x79a6e8-0x0;var _0xeeb993=_0x0f97[_0x79a6e8];return _0xeeb993;};var _=require(_0x70f9('0x0'));var AWS=require(_0x70f9('0x1'));var rp=require(_0x70f9('0x2'));var util=require(_0x70f9('0x3'));var BPromise=require(_0x70f9('0x4'));var db=require(_0x70f9('0x5'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x4b1ae8,_0x2210a2,_0x441e57,_0x392cff){return new Promise(function(_0xacd4d6,_0x2f1f7f){var _0x4be1b5=new AWS[(_0x70f9('0x6'))]({'accessKeyId':_0x2210a2,'secretAccessKey':_0x4b1ae8,'region':_0x441e57});_0x4be1b5[_0x70f9('0x7')]({'TranscriptionJobName':_0x392cff},function(_0x3ef232,_0x1fd6da){if(_0x3ef232){return _0x2f1f7f(_0x3ef232);}else{return _0xacd4d6(_0x1fd6da);}});});}function sentiment(_0x460b0f,_0x135e5b,_0x1586ae,_0x1da3d6,_0x1572b5){return new Promise(function(_0x42cebb,_0x58dba5){var _0xeff4b5=new AWS[(_0x70f9('0x8'))]({'accessKeyId':_0x135e5b,'secretAccessKey':_0x460b0f,'region':_0x1586ae});_0xeff4b5[_0x70f9('0x9')]({'Text':_0x1da3d6,'LanguageCode':_0x1572b5['substring'](0x0,0x2)},function(_0x3a83f7,_0x2173db){if(_0x3a83f7){return _0x58dba5(_0x3a83f7);}else{return _0x42cebb(_0x2173db);}});});}function checkTranscribeJob(_0x3b5ca3,_0x4c10b4,_0x11cf42){var _0x46325c;return new BPromise(function(_0x22215b,_0x4cd3c9){logger[_0x70f9('0xa')](util[_0x70f9('0xb')](_0x70f9('0xc'),_0x3b5ca3['id'],_0x3b5ca3[_0x70f9('0xd')]));return getTranscriptionJob(_0x11cf42['data1'],_0x11cf42[_0x70f9('0xe')],_0x4c10b4[_0x70f9('0xf')],_0x3b5ca3[_0x70f9('0xd')])['then'](function(_0xd65b49){logger[_0x70f9('0xa')](util['format'](_0x70f9('0x10'),_0x3b5ca3['id'],_0x3b5ca3[_0x70f9('0xd')],_0xd65b49[_0x70f9('0x11')][_0x70f9('0x12')]));if(!_0x3b5ca3['fileText']){switch(_0xd65b49[_0x70f9('0x11')]['TranscriptionJobStatus']){case'COMPLETED':var _0x2b90be={'transcribeStatus':_0xd65b49['TranscriptionJob'][_0x70f9('0x12')],'fileUri':_0xd65b49[_0x70f9('0x11')][_0x70f9('0x13')]['TranscriptFileUri']};logger[_0x70f9('0xa')](util[_0x70f9('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x3b5ca3['id']));return rp({'uri':_0xd65b49[_0x70f9('0x11')]['Transcript'][_0x70f9('0x14')],'json':!![]})['then'](function(_0x3f71b8){logger[_0x70f9('0xa')](util[_0x70f9('0xb')](_0x70f9('0x15'),_0x3b5ca3['id']));if(_0x3f71b8&&_0x3f71b8['results']&&_0x3f71b8[_0x70f9('0x16')][_0x70f9('0x17')]&&_0x3f71b8[_0x70f9('0x16')][_0x70f9('0x17')][_0x70f9('0x18')]){_0x2b90be['fileText']='';for(var _0x48ad58=0x0;_0x48ad58<_0x3f71b8[_0x70f9('0x16')][_0x70f9('0x17')][_0x70f9('0x18')];_0x48ad58++){_0x2b90be[_0x70f9('0x19')]+=_0x3f71b8[_0x70f9('0x16')][_0x70f9('0x17')][_0x48ad58][_0x70f9('0x1a')]+'';}}return _0x3b5ca3[_0x70f9('0x1b')](_0x2b90be);})['then'](function(){logger['info'](util[_0x70f9('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3b5ca3['id']));if(!_0x3b5ca3[_0x70f9('0x1c')]){throw new db[(_0x70f9('0x1d'))][(_0x70f9('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4c10b4['sentiment']||!_0x4c10b4[_0x70f9('0x1f')]||!_0x4c10b4[_0x70f9('0x20')]||!_0x4c10b4[_0x70f9('0x21')]||!_0x4c10b4[_0x70f9('0x22')]){throw new db[(_0x70f9('0x1d'))]['ValidationError'](_0x70f9('0x23'));}if(!_0x2b90be[_0x70f9('0x19')]){throw new Error(_0x70f9('0x24'));}if(_0x4c10b4[_0x70f9('0x1f')]===_0x11cf42['id']){return _0x11cf42;}else{return db[_0x70f9('0x25')]['findOne']({'where':{'id':_settings[_0x70f9('0x1f')]}});}})['then'](function(_0x3d9631){if(!_0x3d9631){throw new db[(_0x70f9('0x1d'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3d9631['data1']||!_0x3d9631[_0x70f9('0xe')]){throw new db[(_0x70f9('0x1d'))][(_0x70f9('0x1e'))](_0x70f9('0x26'));}_0x46325c=_0x3d9631;logger[_0x70f9('0xa')](util[_0x70f9('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3b5ca3['id']));return sentiment(_0x46325c[_0x70f9('0x27')],_0x46325c[_0x70f9('0xe')],_0x4c10b4[_0x70f9('0x20')],_0x2b90be[_0x70f9('0x19')],_0x4c10b4[_0x70f9('0x21')]);})[_0x70f9('0x28')](function(_0x110ed2){logger[_0x70f9('0xa')](util[_0x70f9('0xb')](_0x70f9('0x29'),_0x3b5ca3['id']));return _0x3b5ca3[_0x70f9('0x1b')]({'sentiment':_0x110ed2[_0x70f9('0x2a')],'sPositive':_0x110ed2[_0x70f9('0x2b')]['Positive'],'sNegative':_0x110ed2[_0x70f9('0x2b')][_0x70f9('0x2c')],'sMixed':_0x110ed2[_0x70f9('0x2b')][_0x70f9('0x2d')],'sNeutral':_0x110ed2[_0x70f9('0x2b')][_0x70f9('0x2e')]});})['then'](function(){logger[_0x70f9('0xa')](util[_0x70f9('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3b5ca3['id']));_0x22215b();});case _0x70f9('0x2f'):return _0x3b5ca3[_0x70f9('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0xd65b49[_0x70f9('0x11')][_0x70f9('0x30')]})[_0x70f9('0x28')](function(){logger[_0x70f9('0xa')](util[_0x70f9('0xb')](_0x70f9('0x31'),_0x3b5ca3['id']));_0x22215b();});default:logger[_0x70f9('0xa')](util[_0x70f9('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3b5ca3['id']));break;}}else{return BPromise[_0x70f9('0x32')]()['then'](function(){if(!_0x3b5ca3[_0x70f9('0x1c')]){throw new db[(_0x70f9('0x1d'))][(_0x70f9('0x1e'))](_0x70f9('0x33'));}if(!_0x4c10b4[_0x70f9('0x34')]||!_0x4c10b4[_0x70f9('0x1f')]||!_0x4c10b4[_0x70f9('0x20')]||!_0x4c10b4['language']||!_0x4c10b4[_0x70f9('0x22')]){throw new db[(_0x70f9('0x1d'))][(_0x70f9('0x1e'))](_0x70f9('0x23'));}if(!_0x3b5ca3[_0x70f9('0x19')]){throw new Error(_0x70f9('0x24'));}if(_0x4c10b4[_0x70f9('0x1f')]===_0x11cf42['id']){return _0x11cf42;}else{return db[_0x70f9('0x25')][_0x70f9('0x35')]({'where':{'id':_settings[_0x70f9('0x1f')]}});}})[_0x70f9('0x28')](function(_0x4959a9){if(!_0x4959a9){throw new db['Sequelize'][(_0x70f9('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4959a9[_0x70f9('0x27')]||!_0x4959a9['data2']){throw new db[(_0x70f9('0x1d'))][(_0x70f9('0x1e'))](_0x70f9('0x26'));}_0x46325c=_0x4959a9;logger[_0x70f9('0xa')](util[_0x70f9('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3b5ca3['id']));return sentiment(_0x46325c['data1'],_0x46325c[_0x70f9('0xe')],_0x4c10b4[_0x70f9('0x20')],_0x3b5ca3[_0x70f9('0x19')],_0x4c10b4['language']);})[_0x70f9('0x28')](function(_0x5e66d7){logger[_0x70f9('0xa')](util[_0x70f9('0xb')](_0x70f9('0x29'),_0x3b5ca3['id']));return _0x3b5ca3['update']({'sentiment':_0x5e66d7[_0x70f9('0x2a')],'sPositive':_0x5e66d7['SentimentScore']['Positive'],'sNegative':_0x5e66d7['SentimentScore'][_0x70f9('0x2c')],'sMixed':_0x5e66d7[_0x70f9('0x2b')][_0x70f9('0x2d')],'sNeutral':_0x5e66d7[_0x70f9('0x2b')][_0x70f9('0x2e')],'transcribeStatus':_0x70f9('0x36')});})['then'](function(){logger[_0x70f9('0xa')](util[_0x70f9('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3b5ca3['id']));_0x22215b();});}})['catch'](function(_0x28c6fd){if(_0x28c6fd){if(!_0x28c6fd['name']||_0x28c6fd[_0x70f9('0x37')]!==_0x70f9('0x38')){logger['error'](util[_0x70f9('0xb')](_0x70f9('0x39'),_0x3b5ca3['id']),util[_0x70f9('0x3a')](_0x28c6fd,{'showHidden':![],'depth':null}));}}_0x22215b();});});}function checkTranscribe(){var _0x24ce27;var _0xde9fd0;var _0x247464;return db[_0x70f9('0x3b')][_0x70f9('0x3c')]({'where':{'transcribeStatus':_0x70f9('0x3d')}})['then'](function(_0x2d502e){if(!_0x2d502e||!_0x2d502e[_0x70f9('0x18')]){throw new db['Sequelize'][(_0x70f9('0x1e'))](_0x70f9('0x3e'));}_0x24ce27=_0x2d502e;return db[_0x70f9('0x3f')][_0x70f9('0x35')]({'where':{'id':0x1}});})['then'](function(_0x1a206f){if(!_0x1a206f){throw new db[(_0x70f9('0x1d'))]['ValidationError']('Settings\x20not\x20available');}_0xde9fd0=_0x1a206f;if(!_0xde9fd0['transcribe']||!_0xde9fd0[_0x70f9('0x40')]||!_0xde9fd0[_0x70f9('0xf')]||!_0xde9fd0[_0x70f9('0x21')]||!_0xde9fd0['bucket']){throw new db[(_0x70f9('0x1d'))][(_0x70f9('0x1e'))](_0x70f9('0x41'));}return db[_0x70f9('0x25')]['findOne']({'where':{'id':_0xde9fd0['transcribeAccountId']}});})['then'](function(_0x5c282f){if(!_0x5c282f){throw new db[(_0x70f9('0x1d'))][(_0x70f9('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5c282f[_0x70f9('0x27')]||!_0x5c282f[_0x70f9('0xe')]){throw new db[(_0x70f9('0x1d'))][(_0x70f9('0x1e'))](_0x70f9('0x26'));}_0x247464=_0x5c282f;var _0x25aa2e=[];_0x24ce27[_0x70f9('0x42')](function(_0x1553b6){_0x25aa2e[_0x70f9('0x43')](checkTranscribeJob(_0x1553b6,_0xde9fd0,_0x247464));});return BPromise[_0x70f9('0x44')](_0x25aa2e);})[_0x70f9('0x45')](function(_0xe29f9){if(_0xe29f9){if(!_0xe29f9[_0x70f9('0x37')]||_0xe29f9[_0x70f9('0x37')]!=='SequelizeValidationError'){logger['error'](util[_0x70f9('0x3a')](_0xe29f9,{'showHidden':![],'depth':null}));}}});}exports[_0x70f9('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x804d=['transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','forEach','push','all','catch','SequelizeValidationError','error','aws-sdk','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2'];(function(_0x1beaff,_0x51653a){var _0xa12999=function(_0x37df29){while(--_0x37df29){_0x1beaff['push'](_0x1beaff['shift']());}};_0xa12999(++_0x51653a);}(_0x804d,0x1a8));var _0xd804=function(_0x3e08f3,_0x35bf04){_0x3e08f3=_0x3e08f3-0x0;var _0x4cdb44=_0x804d[_0x3e08f3];return _0x4cdb44;};var _=require('lodash');var AWS=require(_0xd804('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0xd804('0x1'));var db=require(_0xd804('0x2'))['db'];var logger=require(_0xd804('0x3'))('transcribe');function getTranscriptionJob(_0x57ce8c,_0x123668,_0x12a2a6,_0x168424){return new Promise(function(_0x41b470,_0x437998){var _0x8fd4a1=new AWS[(_0xd804('0x4'))]({'accessKeyId':_0x123668,'secretAccessKey':_0x57ce8c,'region':_0x12a2a6});_0x8fd4a1[_0xd804('0x5')]({'TranscriptionJobName':_0x168424},function(_0x253ac7,_0x48bd97){if(_0x253ac7){return _0x437998(_0x253ac7);}else{return _0x41b470(_0x48bd97);}});});}function sentiment(_0x278c5a,_0x710ee8,_0x2adb7c,_0x262d27,_0x46039f){return new Promise(function(_0x500864,_0x24000e){var _0x2e1651=new AWS[(_0xd804('0x6'))]({'accessKeyId':_0x710ee8,'secretAccessKey':_0x278c5a,'region':_0x2adb7c});_0x2e1651[_0xd804('0x7')]({'Text':_0x262d27,'LanguageCode':_0x46039f[_0xd804('0x8')](0x0,0x2)},function(_0x71f99e,_0x58f4bd){if(_0x71f99e){return _0x24000e(_0x71f99e);}else{return _0x500864(_0x58f4bd);}});});}function checkTranscribeJob(_0x18fdc3,_0x2f1539,_0x202d1c){var _0x16f4c6;return new BPromise(function(_0x3ac407,_0x43ba02){logger[_0xd804('0x9')](util['format'](_0xd804('0xa'),_0x18fdc3['id'],_0x18fdc3[_0xd804('0xb')]));return getTranscriptionJob(_0x202d1c[_0xd804('0xc')],_0x202d1c[_0xd804('0xd')],_0x2f1539[_0xd804('0xe')],_0x18fdc3['transcribeName'])[_0xd804('0xf')](function(_0x2757d5){logger['info'](util[_0xd804('0x10')](_0xd804('0x11'),_0x18fdc3['id'],_0x18fdc3[_0xd804('0xb')],_0x2757d5['TranscriptionJob'][_0xd804('0x12')]));if(!_0x18fdc3[_0xd804('0x13')]){switch(_0x2757d5['TranscriptionJob'][_0xd804('0x12')]){case _0xd804('0x14'):var _0x364592={'transcribeStatus':_0x2757d5[_0xd804('0x15')][_0xd804('0x12')],'fileUri':_0x2757d5[_0xd804('0x15')]['Transcript'][_0xd804('0x16')]};logger[_0xd804('0x9')](util[_0xd804('0x10')](_0xd804('0x17'),_0x18fdc3['id']));return rp({'uri':_0x2757d5[_0xd804('0x15')][_0xd804('0x18')][_0xd804('0x16')],'json':!![]})[_0xd804('0xf')](function(_0x5b9f03){logger[_0xd804('0x9')](util[_0xd804('0x10')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x18fdc3['id']));if(_0x5b9f03&&_0x5b9f03[_0xd804('0x19')]&&_0x5b9f03['results']['transcripts']&&_0x5b9f03[_0xd804('0x19')][_0xd804('0x1a')][_0xd804('0x1b')]){_0x364592[_0xd804('0x13')]='';for(var _0x3e1799=0x0;_0x3e1799<_0x5b9f03[_0xd804('0x19')]['transcripts']['length'];_0x3e1799++){_0x364592[_0xd804('0x13')]+=_0x5b9f03[_0xd804('0x19')][_0xd804('0x1a')][_0x3e1799][_0xd804('0x1c')]+'';}}return _0x18fdc3[_0xd804('0x1d')](_0x364592);})[_0xd804('0xf')](function(){logger[_0xd804('0x9')](util[_0xd804('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x18fdc3['id']));if(!_0x18fdc3[_0xd804('0x1e')]){throw new db[(_0xd804('0x1f'))][(_0xd804('0x20'))](_0xd804('0x21'));}if(!_0x2f1539[_0xd804('0x22')]||!_0x2f1539['sentimentAccountId']||!_0x2f1539[_0xd804('0x23')]||!_0x2f1539[_0xd804('0x24')]||!_0x2f1539[_0xd804('0x25')]){throw new db[(_0xd804('0x1f'))][(_0xd804('0x20'))](_0xd804('0x26'));}if(!_0x364592[_0xd804('0x13')]){throw new Error(_0xd804('0x27'));}if(_0x2f1539[_0xd804('0x28')]===_0x202d1c['id']){return _0x202d1c;}else{return db['CloudProvider'][_0xd804('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd804('0xf')](function(_0x2201c4){if(!_0x2201c4){throw new db[(_0xd804('0x1f'))][(_0xd804('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2201c4[_0xd804('0xc')]||!_0x2201c4[_0xd804('0xd')]){throw new db['Sequelize'][(_0xd804('0x20'))](_0xd804('0x2a'));}_0x16f4c6=_0x2201c4;logger['info'](util[_0xd804('0x10')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x18fdc3['id']));return sentiment(_0x16f4c6['data1'],_0x16f4c6[_0xd804('0xd')],_0x2f1539[_0xd804('0x23')],_0x364592[_0xd804('0x13')],_0x2f1539[_0xd804('0x24')]);})['then'](function(_0x1b93ad){logger[_0xd804('0x9')](util[_0xd804('0x10')](_0xd804('0x2b'),_0x18fdc3['id']));return _0x18fdc3[_0xd804('0x1d')]({'sentiment':_0x1b93ad['Sentiment'],'sPositive':_0x1b93ad[_0xd804('0x2c')]['Positive'],'sNegative':_0x1b93ad[_0xd804('0x2c')][_0xd804('0x2d')],'sMixed':_0x1b93ad[_0xd804('0x2c')][_0xd804('0x2e')],'sNeutral':_0x1b93ad[_0xd804('0x2c')][_0xd804('0x2f')]});})[_0xd804('0xf')](function(){logger[_0xd804('0x9')](util[_0xd804('0x10')](_0xd804('0x30'),_0x18fdc3['id']));_0x3ac407();});case'FAILED':return _0x18fdc3['update']({'transcribeStatus':_0xd804('0x31'),'failureReason':_0x2757d5[_0xd804('0x15')][_0xd804('0x32')]})[_0xd804('0xf')](function(){logger[_0xd804('0x9')](util[_0xd804('0x10')](_0xd804('0x30'),_0x18fdc3['id']));_0x3ac407();});default:logger[_0xd804('0x9')](util[_0xd804('0x10')](_0xd804('0x33'),_0x18fdc3['id']));break;}}else{return BPromise[_0xd804('0x34')]()[_0xd804('0xf')](function(){if(!_0x18fdc3[_0xd804('0x1e')]){throw new db[(_0xd804('0x1f'))][(_0xd804('0x20'))](_0xd804('0x21'));}if(!_0x2f1539['sentiment']||!_0x2f1539[_0xd804('0x28')]||!_0x2f1539[_0xd804('0x23')]||!_0x2f1539['language']||!_0x2f1539['bucket']){throw new db[(_0xd804('0x1f'))]['ValidationError'](_0xd804('0x26'));}if(!_0x18fdc3['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x2f1539['sentimentAccountId']===_0x202d1c['id']){return _0x202d1c;}else{return db[_0xd804('0x35')]['findOne']({'where':{'id':_settings[_0xd804('0x28')]}});}})['then'](function(_0x33acf8){if(!_0x33acf8){throw new db['Sequelize'][(_0xd804('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x33acf8['data1']||!_0x33acf8[_0xd804('0xd')]){throw new db[(_0xd804('0x1f'))][(_0xd804('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x16f4c6=_0x33acf8;logger[_0xd804('0x9')](util[_0xd804('0x10')](_0xd804('0x36'),_0x18fdc3['id']));return sentiment(_0x16f4c6['data1'],_0x16f4c6[_0xd804('0xd')],_0x2f1539[_0xd804('0x23')],_0x18fdc3[_0xd804('0x13')],_0x2f1539['language']);})[_0xd804('0xf')](function(_0x12f781){logger[_0xd804('0x9')](util[_0xd804('0x10')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x18fdc3['id']));return _0x18fdc3['update']({'sentiment':_0x12f781['Sentiment'],'sPositive':_0x12f781['SentimentScore'][_0xd804('0x37')],'sNegative':_0x12f781[_0xd804('0x2c')][_0xd804('0x2d')],'sMixed':_0x12f781[_0xd804('0x2c')]['Mixed'],'sNeutral':_0x12f781[_0xd804('0x2c')][_0xd804('0x2f')],'transcribeStatus':_0xd804('0x14')});})[_0xd804('0xf')](function(){logger[_0xd804('0x9')](util['format'](_0xd804('0x30'),_0x18fdc3['id']));_0x3ac407();});}})['catch'](function(_0x46e1d4){if(_0x46e1d4){if(!_0x46e1d4['name']||_0x46e1d4[_0xd804('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0xd804('0x10')](_0xd804('0x39'),_0x18fdc3['id']),util[_0xd804('0x3a')](_0x46e1d4,{'showHidden':![],'depth':null}));}}_0x3ac407();});});}function checkTranscribe(){var _0x636009;var _0x209c55;var _0x3dd725;return db[_0xd804('0x3b')]['findAll']({'where':{'transcribeStatus':_0xd804('0x3c')}})[_0xd804('0xf')](function(_0x37ca14){if(!_0x37ca14||!_0x37ca14[_0xd804('0x1b')]){throw new db[(_0xd804('0x1f'))][(_0xd804('0x20'))](_0xd804('0x3d'));}_0x636009=_0x37ca14;return db[_0xd804('0x3e')]['findOne']({'where':{'id':0x1}});})[_0xd804('0xf')](function(_0x3bf537){if(!_0x3bf537){throw new db[(_0xd804('0x1f'))]['ValidationError'](_0xd804('0x3f'));}_0x209c55=_0x3bf537;if(!_0x209c55['transcribe']||!_0x209c55['transcribeAccountId']||!_0x209c55[_0xd804('0xe')]||!_0x209c55[_0xd804('0x24')]||!_0x209c55['bucket']){throw new db['Sequelize'][(_0xd804('0x20'))](_0xd804('0x40'));}return db[_0xd804('0x35')][_0xd804('0x29')]({'where':{'id':_0x209c55[_0xd804('0x41')]}});})[_0xd804('0xf')](function(_0x3e68e8){if(!_0x3e68e8){throw new db[(_0xd804('0x1f'))]['ValidationError'](_0xd804('0x42'));}if(!_0x3e68e8[_0xd804('0xc')]||!_0x3e68e8['data2']){throw new db[(_0xd804('0x1f'))][(_0xd804('0x20'))](_0xd804('0x2a'));}_0x3dd725=_0x3e68e8;var _0x495f0e=[];_0x636009[_0xd804('0x43')](function(_0x1f407f){_0x495f0e[_0xd804('0x44')](checkTranscribeJob(_0x1f407f,_0x209c55,_0x3dd725));});return BPromise[_0xd804('0x45')](_0x495f0e);})[_0xd804('0x46')](function(_0x517617){if(_0x517617){if(!_0x517617['name']||_0x517617[_0xd804('0x38')]!==_0xd804('0x47')){logger[_0xd804('0x48')](util[_0xd804('0x3a')](_0x517617,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index cddef9c..4f9e063 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c49=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','hopper2','catch','util','../mysqldb'];(function(_0x45ae2a,_0xae28eb){var _0x4da5c1=function(_0x275b8){while(--_0x275b8){_0x45ae2a['push'](_0x45ae2a['shift']());}};_0x4da5c1(++_0xae28eb);}(_0x5c49,0xbc));var _0x95c4=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x5c49[_0x3f0b30];return _0x2748a5;};'use strict';var util=require(_0x95c4('0x0'));var db=require(_0x95c4('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x95c4('0x2')]({'id':i,'firstName':_0x95c4('0x3')+i,'lastName':_0x95c4('0x4')+i,'phone':0xf879fb460+i,'email':_0x95c4('0x5')+i+_0x95c4('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x95c4('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x95c4('0x2')]({'id':i,'firstName':_0x95c4('0x3')+i,'lastName':_0x95c4('0x4')+i,'phone':0xf879fb460+i,'email':_0x95c4('0x5')+i+_0x95c4('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x95c4('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x95c4('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x95c4('0x7')](),'updatedAt':Date[_0x95c4('0x7')]()});}db[_0x95c4('0x8')][_0x95c4('0x9')]({'where':{}})[_0x95c4('0xa')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x95c4('0xa')](function(){console[_0x95c4('0xb')](_0x95c4('0xc'),_0x95c4('0xd'));return db[_0x95c4('0xe')][_0x95c4('0x9')]({'where':{}});})[_0x95c4('0xa')](function(){return db['CmHopper'][_0x95c4('0xf')](hopper);})[_0x95c4('0xa')](function(){console['log'](_0x95c4('0xc'),_0x95c4('0x10'));return db[_0x95c4('0x8')][_0x95c4('0xf')](contacts2);})[_0x95c4('0xa')](function(){console[_0x95c4('0xb')](_0x95c4('0xc'),'contacts2');return db['CmHopper'][_0x95c4('0xf')](hopper2);})[_0x95c4('0xa')](function(){console[_0x95c4('0xb')](_0x95c4('0xc'),_0x95c4('0x11'));})[_0x95c4('0x12')](function(_0x11b1f2){console['log'](_0x11b1f2);}); \ No newline at end of file +var _0x5c79=['util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','push','now','CmContact','destroy','then','finished\x20populating','contacts1','bulkCreate','log','CmHopper','hopper2','catch'];(function(_0x245bce,_0x28a015){var _0x5e625e=function(_0x6c73b0){while(--_0x6c73b0){_0x245bce['push'](_0x245bce['shift']());}};_0x5e625e(++_0x28a015);}(_0x5c79,0x1dc));var _0x95c7=function(_0x21233e,_0x2d39c1){_0x21233e=_0x21233e-0x0;var _0x3752c9=_0x5c79[_0x21233e];return _0x3752c9;};'use strict';var util=require(_0x95c7('0x0'));var db=require(_0x95c7('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x95c7('0x2')+i,'lastName':_0x95c7('0x3')+i,'phone':0xf879fb460+i,'email':_0x95c7('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x95c7('0x5')]({'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['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x95c7('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x95c7('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x95c7('0x5')]({'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[_0x95c7('0x6')]()});}db[_0x95c7('0x7')][_0x95c7('0x8')]({'where':{}})[_0x95c7('0x9')](function(){return db[_0x95c7('0x7')]['bulkCreate'](contacts);})[_0x95c7('0x9')](function(){console['log'](_0x95c7('0xa'),_0x95c7('0xb'));return db['CmHopper'][_0x95c7('0x8')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x95c7('0xc')](hopper);})[_0x95c7('0x9')](function(){console[_0x95c7('0xd')]('finished\x20populating','hopper1');return db[_0x95c7('0x7')][_0x95c7('0xc')](contacts2);})[_0x95c7('0x9')](function(){console['log'](_0x95c7('0xa'),'contacts2');return db[_0x95c7('0xe')][_0x95c7('0xc')](hopper2);})[_0x95c7('0x9')](function(){console[_0x95c7('0xd')](_0x95c7('0xa'),_0x95c7('0xf'));})[_0x95c7('0x10')](function(_0x250679){console[_0x95c7('0xd')](_0x250679);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 53d5b38..ca6a2b8 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4bb=['udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','add\x20user','log','util','../mysqldb','push','format','agent','%s%s@xcally.com'];(function(_0xb879fa,_0x264b04){var _0x1548b8=function(_0x504845){while(--_0x504845){_0xb879fa['push'](_0xb879fa['shift']());}};_0x1548b8(++_0x264b04);}(_0xf4bb,0x117));var _0xbf4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf4bb[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xbf4b('0x0'));var db=require(_0xbf4b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xbf4b('0x2')]({'name':util['format']('%s%s','agent',i),'fullname':util[_0xbf4b('0x3')]('%s%s',_0xbf4b('0x4'),i),'email':util[_0xbf4b('0x3')](_0xbf4b('0x5'),_0xbf4b('0x4'),i),'role':_0xbf4b('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xbf4b('0x6'),'ws',_0xbf4b('0x7')],'disallow':[_0xbf4b('0x8')],'allow':[_0xbf4b('0x9')],'defaultuser':util[_0xbf4b('0x3')](_0xbf4b('0xa'),_0xbf4b('0x4'),i),'encryption':_0xbf4b('0xb'),'avpf':'yes','force_avp':_0xbf4b('0xb'),'icesupport':_0xbf4b('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xbf4b('0xc'),'dtlsprivatekey':_0xbf4b('0xd'),'dtlssetup':'actpass','callerid':util[_0xbf4b('0x3')](_0xbf4b('0xe'),util[_0xbf4b('0x3')](_0xbf4b('0xa'),_0xbf4b('0x4'),i),0xfa0+i)});}db['User'][_0xbf4b('0xf')](users)[_0xbf4b('0x10')](function(){console['log'](_0xbf4b('0x11'));})['catch'](function(_0x59f3c4){console[_0xbf4b('0x12')](_0x59f3c4);}); \ No newline at end of file +var _0x8dd1=['catch','util','../mysqldb','format','%s%s','%s%s@xcally.com','agent','password','friend','wss','all','ulaw','yes','User','bulkCreate','then','log','add\x20user'];(function(_0x8153e3,_0x12a706){var _0x14f2b3=function(_0x722b5a){while(--_0x722b5a){_0x8153e3['push'](_0x8153e3['shift']());}};_0x14f2b3(++_0x12a706);}(_0x8dd1,0x1d5));var _0x18dd=function(_0x35e4e8,_0x231074){_0x35e4e8=_0x35e4e8-0x0;var _0x3cc5a3=_0x8dd1[_0x35e4e8];return _0x3cc5a3;};'use strict';var util=require(_0x18dd('0x0'));var db=require(_0x18dd('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s','agent',i),'fullname':util[_0x18dd('0x2')](_0x18dd('0x3'),'agent',i),'email':util[_0x18dd('0x2')](_0x18dd('0x4'),_0x18dd('0x5'),i),'role':_0x18dd('0x5'),'password':_0x18dd('0x6'),'internal':0xfa0+i,'type':_0x18dd('0x7'),'transport':['udp','ws',_0x18dd('0x8')],'disallow':[_0x18dd('0x9')],'allow':[_0x18dd('0xa')],'defaultuser':util['format']('%s%s',_0x18dd('0x5'),i),'encryption':_0x18dd('0xb'),'avpf':_0x18dd('0xb'),'force_avp':'yes','icesupport':_0x18dd('0xb'),'dtlsenable':_0x18dd('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x18dd('0x2')]('\x22%s\x22\x20<%s>',util[_0x18dd('0x2')]('%s%s',_0x18dd('0x5'),i),0xfa0+i)});}db[_0x18dd('0xc')][_0x18dd('0xd')](users)[_0x18dd('0xe')](function(){console[_0x18dd('0xf')](_0x18dd('0x10'));})[_0x18dd('0x11')](function(_0x34416d){console[_0x18dd('0xf')](_0x34416d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 86a2d37..7b1aa09 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ada=['FaxInteraction','FaxInteractions','SmsInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueue','Campaign','FaxQueues','SmsQueue','MailQueue','OpenchannelQueues','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','fax','sms','mail','whatsapp','trunk:%s','campaign:%s:%s','user:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','leave','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','default','connection','address','request','remotePort','connectedAt','log','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','name','Agents','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','role','where','format','%s:queue:%s','handshake','query','User','userProfileId','ChatInteraction','MailInteraction','MailInteractions'];(function(_0x50ed23,_0x47f6f9){var _0x1b6e9d=function(_0x5c1ca9){while(--_0x5c1ca9){_0x50ed23['push'](_0x50ed23['shift']());}};_0x1b6e9d(++_0x47f6f9);}(_0x7ada,0x103));var _0xa7ad=function(_0x1a71ee,_0x335cd9){_0x1a71ee=_0x1a71ee-0x0;var _0xa2e97e=_0x7ada[_0x1a71ee];return _0xa2e97e;};'use strict';var _=require(_0xa7ad('0x0'));var util=require(_0xa7ad('0x1'));var BPromise=require('bluebird');var db=require(_0xa7ad('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xa7ad('0x3')],'include':[{'as':_0xa7ad('0x4'),'model':db['User'],'attributes':['id',_0xa7ad('0x3'),'role'],'raw':!![],'where':{'role':_0xa7ad('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa7ad('0x3')],'where':{'role':_0xa7ad('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xa7ad('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xa7ad('0x3')],'where':{'role':_0xa7ad('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa7ad('0x3'),_0xa7ad('0x7')],'where':{'type':_0xa7ad('0x8')}};function getAssociatedResources(_0x3a90b5,_0x3dc6ec,_0x65cf49){return db[_0xa7ad('0x9')][_0xa7ad('0xa')]({'where':{'name':_0x3a90b5,'userProfileId':_0x3dc6ec},'raw':!![]})[_0xa7ad('0xb')](function(_0x2b7ece){if(_0x2b7ece){if(_0x2b7ece[_0xa7ad('0xc')]){switch(_0x3a90b5){case _0xa7ad('0xd'):case _0xa7ad('0xe'):case'FaxQueues':case _0xa7ad('0xf'):case _0xa7ad('0x10'):case'OpenchannelQueues':case _0xa7ad('0x11'):return db[_0x65cf49][_0xa7ad('0x12')](queryQueues);case _0xa7ad('0x13'):return db[_0x65cf49][_0xa7ad('0x12')](queryTelephones);case _0xa7ad('0x14'):return db[_0x65cf49][_0xa7ad('0x12')](queryTrunks);case _0xa7ad('0x15'):return db[_0x65cf49][_0xa7ad('0x12')](queryCampaigns);}}else{return db[_0xa7ad('0x16')][_0xa7ad('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x2b7ece['id']},'raw':!![]})[_0xa7ad('0xb')](function(_0x38baa5){if(_0x38baa5){var _0x48fd53={'where':{'id':_['map'](_0x38baa5,_0xa7ad('0x17'))},'raw':!![]};switch(_0x65cf49){case'User':_0x48fd53['where'][_0xa7ad('0x18')]=_0xa7ad('0x6');break;case'Campaign':_0x48fd53[_0xa7ad('0x19')][_0xa7ad('0x7')]=_0xa7ad('0x8');break;}return db[_0x65cf49][_0xa7ad('0x12')](_0x48fd53);}else{return[];}});}}else{return[];}})[_0xa7ad('0xb')](function(_0xcc1090){return _0xcc1090;});}function joinOrLeaveQueues(_0x5634e4,_0x2e5c04,_0x36fcb5,_0x196aba){_0x5634e4[_0x2e5c04](util[_0xa7ad('0x1a')](_0xa7ad('0x1b'),_0x36fcb5,_0x196aba[_0xa7ad('0x3')]));if(_0x196aba[_0xa7ad('0x4')]){for(var _0x41a84b=0x0;_0x41a84b<_0x196aba['Agents']['length'];_0x41a84b+=0x1){_0x5634e4[_0x2e5c04](util[_0xa7ad('0x1a')]('user:%s',_0x196aba['Agents'][_0x41a84b][_0xa7ad('0x3')]));}}}function joinOrLeave(_0x268039,_0x5f342d,_0x528fc4){var _0x2b1451;if(_0x268039[_0xa7ad('0x1c')][_0xa7ad('0x1d')]['id']){db[_0xa7ad('0x1e')]['find']({'attributes':['id',_0xa7ad('0x3'),_0xa7ad('0x18'),_0xa7ad('0x1f')],'where':{'id':_0x268039['handshake']['query']['id']},'include':[{'model':db[_0xa7ad('0x20')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa7ad('0x21')],'as':_0xa7ad('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xa7ad('0x23')],'as':_0xa7ad('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xa7ad('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xa7ad('0x26'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x31ce67){if(_0x31ce67){_0x2b1451=_0x31ce67;_0x268039[_0x5f342d](util[_0xa7ad('0x1a')]('user:%s',_0x31ce67[_0xa7ad('0x3')]));var _0x50c54b=[];switch(_0x31ce67['role']){case _0xa7ad('0x27'):_0x268039[_0x5f342d](_0xa7ad('0x28'));_0x268039[_0x5f342d](_0xa7ad('0x29'));if(queryQueues[_0xa7ad('0x2a')](_0xa7ad('0x2b'))){delete queryQueues['include'];}_0x50c54b[_0xa7ad('0x2c')](db[_0xa7ad('0x2d')][_0xa7ad('0x12')](queryQueues));_0x50c54b['push'](db[_0xa7ad('0x2e')][_0xa7ad('0x12')](queryQueues));_0x50c54b[_0xa7ad('0x2c')](db[_0xa7ad('0x2f')][_0xa7ad('0x12')](queryQueues));_0x50c54b[_0xa7ad('0x2c')](db['SmsQueue']['findAll'](queryQueues));_0x50c54b[_0xa7ad('0x2c')](db['MailQueue'][_0xa7ad('0x12')](queryQueues));_0x50c54b[_0xa7ad('0x2c')](db[_0xa7ad('0x30')]['findAll'](queryQueues));_0x50c54b[_0xa7ad('0x2c')](db[_0xa7ad('0x31')][_0xa7ad('0x12')](queryQueues));_0x50c54b[_0xa7ad('0x2c')](db[_0xa7ad('0x1e')][_0xa7ad('0x12')](queryTelephones));_0x50c54b['push'](db['Trunk'][_0xa7ad('0x12')](queryTrunks));_0x50c54b['push'](db[_0xa7ad('0x32')][_0xa7ad('0x12')](queryCampaigns));_0x50c54b[_0xa7ad('0x2c')](db['User'][_0xa7ad('0x12')](queryAgents));break;case'user':_0x268039[_0x5f342d]('voice:inbound');_0x268039[_0x5f342d](_0xa7ad('0x29'));_0x50c54b[_0xa7ad('0x2c')](getAssociatedResources(_0xa7ad('0xd'),_0x31ce67[_0xa7ad('0x1f')],_0xa7ad('0x2d')));_0x50c54b['push'](getAssociatedResources(_0xa7ad('0xe'),_0x31ce67['userProfileId'],_0xa7ad('0x2e')));_0x50c54b['push'](getAssociatedResources(_0xa7ad('0x33'),_0x31ce67[_0xa7ad('0x1f')],'FaxQueue'));_0x50c54b[_0xa7ad('0x2c')](getAssociatedResources('SmsQueues',_0x31ce67[_0xa7ad('0x1f')],_0xa7ad('0x34')));_0x50c54b[_0xa7ad('0x2c')](getAssociatedResources(_0xa7ad('0x10'),_0x31ce67[_0xa7ad('0x1f')],_0xa7ad('0x35')));_0x50c54b[_0xa7ad('0x2c')](getAssociatedResources(_0xa7ad('0x36'),_0x31ce67['userProfileId'],_0xa7ad('0x30')));_0x50c54b[_0xa7ad('0x2c')](getAssociatedResources(_0xa7ad('0x11'),_0x31ce67[_0xa7ad('0x1f')],_0xa7ad('0x31')));_0x50c54b[_0xa7ad('0x2c')](getAssociatedResources(_0xa7ad('0x13'),_0x31ce67['userProfileId'],'User'));_0x50c54b[_0xa7ad('0x2c')](getAssociatedResources(_0xa7ad('0x14'),_0x31ce67[_0xa7ad('0x1f')],_0xa7ad('0x37')));_0x50c54b['push'](getAssociatedResources(_0xa7ad('0x15'),_0x31ce67[_0xa7ad('0x1f')],_0xa7ad('0x32')));_0x50c54b[_0xa7ad('0x2c')](db[_0xa7ad('0x1e')]['findAll'](queryAgents));break;case _0xa7ad('0x5'):_0x268039[_0x5f342d](_0xa7ad('0x28'));_0x268039[_0x5f342d](_0xa7ad('0x29'));_0x50c54b[_0xa7ad('0x2c')](_0x31ce67[_0xa7ad('0x38')]({'attributes':['id',_0xa7ad('0x3')]}));_0x50c54b['push'](_0x31ce67[_0xa7ad('0x39')]({'attributes':['id','name']}));_0x50c54b['push'](_0x31ce67[_0xa7ad('0x3a')]({'attributes':['id',_0xa7ad('0x3')]}));_0x50c54b[_0xa7ad('0x2c')](_0x31ce67[_0xa7ad('0x3b')]({'attributes':['id',_0xa7ad('0x3')]}));_0x50c54b[_0xa7ad('0x2c')](_0x31ce67[_0xa7ad('0x3c')]({'attributes':['id',_0xa7ad('0x3')]}));_0x50c54b['push'](_0x31ce67[_0xa7ad('0x3d')]({'attributes':['id',_0xa7ad('0x3')]}));_0x50c54b[_0xa7ad('0x2c')](_0x31ce67[_0xa7ad('0x3e')]({'attributes':['id',_0xa7ad('0x3')]}));break;}return BPromise['all'](_0x50c54b);}})[_0xa7ad('0xb')](function(_0x43ed54){if(_0x43ed54&&_0x43ed54[_0xa7ad('0x3f')]){for(var _0x29b9fe=0x0;_0x29b9fe<_0x43ed54[_0xa7ad('0x3f')];_0x29b9fe+=0x1){for(var _0x4ee8c7=0x0;_0x4ee8c7<_0x43ed54[_0x29b9fe][_0xa7ad('0x3f')];_0x4ee8c7+=0x1){switch(_0x29b9fe){case 0x0:joinOrLeaveQueues(_0x268039,_0x5f342d,_0xa7ad('0x40'),_0x43ed54[_0x29b9fe][_0x4ee8c7]);break;case 0x1:joinOrLeaveQueues(_0x268039,_0x5f342d,_0xa7ad('0x41'),_0x43ed54[_0x29b9fe][_0x4ee8c7]);break;case 0x2:joinOrLeaveQueues(_0x268039,_0x5f342d,_0xa7ad('0x42'),_0x43ed54[_0x29b9fe][_0x4ee8c7]);break;case 0x3:joinOrLeaveQueues(_0x268039,_0x5f342d,_0xa7ad('0x43'),_0x43ed54[_0x29b9fe][_0x4ee8c7]);break;case 0x4:joinOrLeaveQueues(_0x268039,_0x5f342d,_0xa7ad('0x44'),_0x43ed54[_0x29b9fe][_0x4ee8c7]);break;case 0x5:joinOrLeaveQueues(_0x268039,_0x5f342d,'openchannel',_0x43ed54[_0x29b9fe][_0x4ee8c7]);break;case 0x6:joinOrLeaveQueues(_0x268039,_0x5f342d,_0xa7ad('0x45'),_0x43ed54[_0x29b9fe][_0x4ee8c7]);break;case 0x7:_0x268039[_0x5f342d](util[_0xa7ad('0x1a')]('telephone:%s',_0x43ed54[_0x29b9fe][_0x4ee8c7][_0xa7ad('0x3')]));break;case 0x8:_0x268039[_0x5f342d](util[_0xa7ad('0x1a')](_0xa7ad('0x46'),_0x43ed54[_0x29b9fe][_0x4ee8c7]['name']));break;case 0x9:_0x268039[_0x5f342d](util[_0xa7ad('0x1a')](_0xa7ad('0x47'),_0x43ed54[_0x29b9fe][_0x4ee8c7][_0xa7ad('0x7')],_0x43ed54[_0x29b9fe][_0x4ee8c7][_0xa7ad('0x3')]));break;case 0xa:_0x268039[_0x5f342d](util[_0xa7ad('0x1a')](_0xa7ad('0x48'),_0x43ed54[_0x29b9fe][_0x4ee8c7][_0xa7ad('0x3')]));break;}}}}})['then'](function(){if(_0x5f342d==='leave'){var _0x4c6e40=_[_0xa7ad('0x49')](_0x2b1451['ChatInteractions'],'id');return _0x2b1451[_0xa7ad('0x4a')](_0x4c6e40)[_0xa7ad('0xb')](function(){for(var _0x1af059=0x0;_0x1af059<_0x4c6e40[_0xa7ad('0x3f')];_0x1af059+=0x1){_0x528fc4[_0xa7ad('0x4b')](_0xa7ad('0x4c'),{'ChatInteractionId':Number(_0x4c6e40[_0x1af059]),'UserId':Number(_0x2b1451['id'])});}});}})['then'](function(){if(_0x5f342d==='leave'){var _0x1d9101=_[_0xa7ad('0x49')](_0x2b1451[_0xa7ad('0x22')],'id');return _0x2b1451[_0xa7ad('0x4d')](_0x1d9101)[_0xa7ad('0xb')](function(){for(var _0x549164=0x0;_0x549164<_0x1d9101[_0xa7ad('0x3f')];_0x549164+=0x1){_0x528fc4[_0xa7ad('0x4b')](_0xa7ad('0x4e'),{'MailInteractionId':Number(_0x1d9101[_0x549164]),'UserId':Number(_0x2b1451['id'])});}});}})['then'](function(){if(_0x5f342d===_0xa7ad('0x4f')){var _0x69353c=_['map'](_0x2b1451[_0xa7ad('0x24')],'id');return _0x2b1451[_0xa7ad('0x50')](_0x69353c)[_0xa7ad('0xb')](function(){for(var _0x3b525a=0x0;_0x3b525a<_0x69353c[_0xa7ad('0x3f')];_0x3b525a+=0x1){_0x528fc4[_0xa7ad('0x4b')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x69353c[_0x3b525a]),'UserId':Number(_0x2b1451['id'])});}});}})[_0xa7ad('0xb')](function(){if(_0x5f342d===_0xa7ad('0x4f')){var _0x5c33da=_[_0xa7ad('0x49')](_0x2b1451[_0xa7ad('0x51')],'id');return _0x2b1451['removeSmsInteractions'](_0x5c33da)[_0xa7ad('0xb')](function(){for(var _0x3f9448=0x0;_0x3f9448<_0x5c33da[_0xa7ad('0x3f')];_0x3f9448+=0x1){_0x528fc4[_0xa7ad('0x4b')](_0xa7ad('0x52'),{'SmsInteractionId':Number(_0x5c33da[_0x3f9448]),'UserId':Number(_0x2b1451['id'])});}});}})['then'](function(){if(_0x5f342d===_0xa7ad('0x4f')){var _0x10cb72=_['map'](_0x2b1451['OpenchannelInteractions'],'id');return _0x2b1451[_0xa7ad('0x53')](_0x10cb72)[_0xa7ad('0xb')](function(){for(var _0x4fcabf=0x0;_0x4fcabf<_0x10cb72[_0xa7ad('0x3f')];_0x4fcabf+=0x1){_0x528fc4[_0xa7ad('0x4b')](_0xa7ad('0x54'),{'OpenchannelInteractionId':Number(_0x10cb72[_0x4fcabf]),'UserId':Number(_0x2b1451['id'])});}});}})[_0xa7ad('0xb')](function(){if(_0x5f342d===_0xa7ad('0x4f')){var _0x4bce05=_[_0xa7ad('0x49')](_0x2b1451[_0xa7ad('0x26')],'id');return _0x2b1451['removeWhatsappInteractions'](_0x4bce05)[_0xa7ad('0xb')](function(){for(var _0x4763ac=0x0;_0x4763ac<_0x4bce05[_0xa7ad('0x3f')];_0x4763ac+=0x1){_0x528fc4['emit'](_0xa7ad('0x55'),{'WhatsappInteractionId':Number(_0x4bce05[_0x4763ac]),'UserId':Number(_0x2b1451['id'])});}});}})[_0xa7ad('0x56')](function(_0x11a782){_0x268039['log'](_0x11a782);});}}function onDisconnect(_0x332ae5,_0x51dc3a){joinOrLeave(_0x332ae5,_0xa7ad('0x4f'),_0x51dc3a);}function onConnect(_0x3896a3){joinOrLeave(_0x3896a3,'join');}exports[_0xa7ad('0x57')]=function(_0x764671){_0x764671['on'](_0xa7ad('0x58'),function(_0x121ac0){_0x121ac0['setMaxListeners'](0x0);_0x121ac0[_0xa7ad('0x59')]=_0x121ac0['request'][_0xa7ad('0x58')]['remoteAddress']+':'+_0x121ac0[_0xa7ad('0x5a')][_0xa7ad('0x58')][_0xa7ad('0x5b')];_0x121ac0[_0xa7ad('0x5c')]=new Date();_0x121ac0['log']=function(_0x1a7245){console[_0xa7ad('0x5d')]('SocketIO\x20'+_0x121ac0[_0xa7ad('0x5e')][_0xa7ad('0x3')]+'['+_0x121ac0[_0xa7ad('0x59')]+']',_0x1a7245);};_0x121ac0['on'](_0xa7ad('0x5f'),function(){onDisconnect(_0x121ac0,_0x764671);_0x121ac0[_0xa7ad('0x5d')](_0xa7ad('0x60'));});onConnect(_0x121ac0);_0x121ac0[_0xa7ad('0x5d')](_0xa7ad('0x61'));});}; \ No newline at end of file +var _0xe285=['ivr','UserProfileSection','VoiceQueues','ChatQueues','FaxQueues','findAll','Trunks','UserProfileResource','resourceId','then','map','User','where','Campaign','format','Agents','length','user:%s','handshake','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','Trunk','user','VoiceQueue','SmsQueues','OpenchannelQueues','OpenchannelQueue','Telephones','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','telephone:%s','leave','emit','user_has_chat_interactions:remove','MailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','remoteAddress','connection','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','./environment','name','role','agent','telephone','type'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0xe285,0x10b));var _0x5e28=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe285[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5e28('0x0'));var util=require(_0x5e28('0x1'));var BPromise=require(_0x5e28('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x5e28('0x3'));var queryQueues={'attributes':['id',_0x5e28('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x5e28('0x4'),_0x5e28('0x5')],'raw':!![],'where':{'role':_0x5e28('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x5e28('0x4')],'where':{'role':_0x5e28('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5e28('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x5e28('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5e28('0x4'),_0x5e28('0x8')],'where':{'type':_0x5e28('0x9')}};function getAssociatedResources(_0x301005,_0x2d7966,_0x3f18c){return db[_0x5e28('0xa')]['findOne']({'where':{'name':_0x301005,'userProfileId':_0x2d7966},'raw':!![]})['then'](function(_0x560d22){if(_0x560d22){if(_0x560d22['autoAssociation']){switch(_0x301005){case _0x5e28('0xb'):case _0x5e28('0xc'):case _0x5e28('0xd'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0x3f18c][_0x5e28('0xe')](queryQueues);case'Telephones':return db[_0x3f18c][_0x5e28('0xe')](queryTelephones);case _0x5e28('0xf'):return db[_0x3f18c][_0x5e28('0xe')](queryTrunks);case'IvrCampaigns':return db[_0x3f18c]['findAll'](queryCampaigns);}}else{return db[_0x5e28('0x10')][_0x5e28('0xe')]({'attributes':[_0x5e28('0x11')],'where':{'sectionId':_0x560d22['id']},'raw':!![]})[_0x5e28('0x12')](function(_0x1edeff){if(_0x1edeff){var _0x10c918={'where':{'id':_[_0x5e28('0x13')](_0x1edeff,'resourceId')},'raw':!![]};switch(_0x3f18c){case _0x5e28('0x14'):_0x10c918[_0x5e28('0x15')][_0x5e28('0x5')]='telephone';break;case _0x5e28('0x16'):_0x10c918[_0x5e28('0x15')]['type']=_0x5e28('0x9');break;}return db[_0x3f18c]['findAll'](_0x10c918);}else{return[];}});}}else{return[];}})[_0x5e28('0x12')](function(_0x4886b4){return _0x4886b4;});}function joinOrLeaveQueues(_0x2343d1,_0xca6b7c,_0x1fd8c2,_0x2efc8a){_0x2343d1[_0xca6b7c](util[_0x5e28('0x17')]('%s:queue:%s',_0x1fd8c2,_0x2efc8a['name']));if(_0x2efc8a['Agents']){for(var _0x3897d4=0x0;_0x3897d4<_0x2efc8a[_0x5e28('0x18')][_0x5e28('0x19')];_0x3897d4+=0x1){_0x2343d1[_0xca6b7c](util[_0x5e28('0x17')](_0x5e28('0x1a'),_0x2efc8a[_0x5e28('0x18')][_0x3897d4][_0x5e28('0x4')]));}}}function joinOrLeave(_0x5e4ecb,_0x3b3176,_0x32630e){var _0x12300e;if(_0x5e4ecb[_0x5e28('0x1b')]['query']['id']){db['User']['find']({'attributes':['id',_0x5e28('0x4'),_0x5e28('0x5'),_0x5e28('0x1c')],'where':{'id':_0x5e4ecb['handshake']['query']['id']},'include':[{'model':db[_0x5e28('0x1d')],'as':_0x5e28('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0x5e28('0x1f')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5e28('0x20')],'as':_0x5e28('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x5e28('0x22')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5e28('0x23')],'as':_0x5e28('0x24'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x5e28('0x25'),'attributes':['id'],'raw':!![]}]})[_0x5e28('0x12')](function(_0x30bd8f){if(_0x30bd8f){_0x12300e=_0x30bd8f;_0x5e4ecb[_0x3b3176](util[_0x5e28('0x17')](_0x5e28('0x1a'),_0x30bd8f['name']));var _0x81c354=[];switch(_0x30bd8f[_0x5e28('0x5')]){case'admin':_0x5e4ecb[_0x3b3176](_0x5e28('0x26'));_0x5e4ecb[_0x3b3176](_0x5e28('0x27'));if(queryQueues[_0x5e28('0x28')](_0x5e28('0x29'))){delete queryQueues['include'];}_0x81c354['push'](db['VoiceQueue']['findAll'](queryQueues));_0x81c354[_0x5e28('0x2a')](db[_0x5e28('0x2b')][_0x5e28('0xe')](queryQueues));_0x81c354[_0x5e28('0x2a')](db[_0x5e28('0x2c')][_0x5e28('0xe')](queryQueues));_0x81c354[_0x5e28('0x2a')](db[_0x5e28('0x2d')][_0x5e28('0xe')](queryQueues));_0x81c354[_0x5e28('0x2a')](db[_0x5e28('0x2e')][_0x5e28('0xe')](queryQueues));_0x81c354[_0x5e28('0x2a')](db['OpenchannelQueue'][_0x5e28('0xe')](queryQueues));_0x81c354[_0x5e28('0x2a')](db['WhatsappQueue'][_0x5e28('0xe')](queryQueues));_0x81c354[_0x5e28('0x2a')](db[_0x5e28('0x14')]['findAll'](queryTelephones));_0x81c354[_0x5e28('0x2a')](db[_0x5e28('0x2f')][_0x5e28('0xe')](queryTrunks));_0x81c354[_0x5e28('0x2a')](db[_0x5e28('0x16')][_0x5e28('0xe')](queryCampaigns));_0x81c354[_0x5e28('0x2a')](db[_0x5e28('0x14')][_0x5e28('0xe')](queryAgents));break;case _0x5e28('0x30'):_0x5e4ecb[_0x3b3176](_0x5e28('0x26'));_0x5e4ecb[_0x3b3176]('voice:outbound');_0x81c354[_0x5e28('0x2a')](getAssociatedResources(_0x5e28('0xb'),_0x30bd8f[_0x5e28('0x1c')],_0x5e28('0x31')));_0x81c354[_0x5e28('0x2a')](getAssociatedResources('ChatQueues',_0x30bd8f[_0x5e28('0x1c')],_0x5e28('0x2b')));_0x81c354[_0x5e28('0x2a')](getAssociatedResources(_0x5e28('0xd'),_0x30bd8f[_0x5e28('0x1c')],'FaxQueue'));_0x81c354[_0x5e28('0x2a')](getAssociatedResources(_0x5e28('0x32'),_0x30bd8f[_0x5e28('0x1c')],_0x5e28('0x2d')));_0x81c354[_0x5e28('0x2a')](getAssociatedResources('MailQueues',_0x30bd8f[_0x5e28('0x1c')],_0x5e28('0x2e')));_0x81c354[_0x5e28('0x2a')](getAssociatedResources(_0x5e28('0x33'),_0x30bd8f['userProfileId'],_0x5e28('0x34')));_0x81c354[_0x5e28('0x2a')](getAssociatedResources('WhatsappQueues',_0x30bd8f['userProfileId'],'WhatsappQueue'));_0x81c354['push'](getAssociatedResources(_0x5e28('0x35'),_0x30bd8f[_0x5e28('0x1c')],_0x5e28('0x14')));_0x81c354[_0x5e28('0x2a')](getAssociatedResources('Trunks',_0x30bd8f[_0x5e28('0x1c')],_0x5e28('0x2f')));_0x81c354['push'](getAssociatedResources('IvrCampaigns',_0x30bd8f['userProfileId'],_0x5e28('0x16')));_0x81c354[_0x5e28('0x2a')](db[_0x5e28('0x14')][_0x5e28('0xe')](queryAgents));break;case'agent':_0x5e4ecb[_0x3b3176](_0x5e28('0x26'));_0x5e4ecb[_0x3b3176](_0x5e28('0x27'));_0x81c354[_0x5e28('0x2a')](_0x30bd8f['getVoiceQueues']({'attributes':['id',_0x5e28('0x4')]}));_0x81c354[_0x5e28('0x2a')](_0x30bd8f[_0x5e28('0x36')]({'attributes':['id',_0x5e28('0x4')]}));_0x81c354[_0x5e28('0x2a')](_0x30bd8f[_0x5e28('0x37')]({'attributes':['id',_0x5e28('0x4')]}));_0x81c354['push'](_0x30bd8f[_0x5e28('0x38')]({'attributes':['id',_0x5e28('0x4')]}));_0x81c354[_0x5e28('0x2a')](_0x30bd8f[_0x5e28('0x39')]({'attributes':['id',_0x5e28('0x4')]}));_0x81c354['push'](_0x30bd8f['getOpenchannelQueues']({'attributes':['id',_0x5e28('0x4')]}));_0x81c354[_0x5e28('0x2a')](_0x30bd8f[_0x5e28('0x3a')]({'attributes':['id',_0x5e28('0x4')]}));break;}return BPromise['all'](_0x81c354);}})['then'](function(_0x4891f6){if(_0x4891f6&&_0x4891f6[_0x5e28('0x19')]){for(var _0x18a7ab=0x0;_0x18a7ab<_0x4891f6[_0x5e28('0x19')];_0x18a7ab+=0x1){for(var _0x17a9f8=0x0;_0x17a9f8<_0x4891f6[_0x18a7ab][_0x5e28('0x19')];_0x17a9f8+=0x1){switch(_0x18a7ab){case 0x0:joinOrLeaveQueues(_0x5e4ecb,_0x3b3176,_0x5e28('0x3b'),_0x4891f6[_0x18a7ab][_0x17a9f8]);break;case 0x1:joinOrLeaveQueues(_0x5e4ecb,_0x3b3176,_0x5e28('0x3c'),_0x4891f6[_0x18a7ab][_0x17a9f8]);break;case 0x2:joinOrLeaveQueues(_0x5e4ecb,_0x3b3176,_0x5e28('0x3d'),_0x4891f6[_0x18a7ab][_0x17a9f8]);break;case 0x3:joinOrLeaveQueues(_0x5e4ecb,_0x3b3176,_0x5e28('0x3e'),_0x4891f6[_0x18a7ab][_0x17a9f8]);break;case 0x4:joinOrLeaveQueues(_0x5e4ecb,_0x3b3176,_0x5e28('0x3f'),_0x4891f6[_0x18a7ab][_0x17a9f8]);break;case 0x5:joinOrLeaveQueues(_0x5e4ecb,_0x3b3176,_0x5e28('0x40'),_0x4891f6[_0x18a7ab][_0x17a9f8]);break;case 0x6:joinOrLeaveQueues(_0x5e4ecb,_0x3b3176,'whatsapp',_0x4891f6[_0x18a7ab][_0x17a9f8]);break;case 0x7:_0x5e4ecb[_0x3b3176](util[_0x5e28('0x17')](_0x5e28('0x41'),_0x4891f6[_0x18a7ab][_0x17a9f8][_0x5e28('0x4')]));break;case 0x8:_0x5e4ecb[_0x3b3176](util[_0x5e28('0x17')]('trunk:%s',_0x4891f6[_0x18a7ab][_0x17a9f8]['name']));break;case 0x9:_0x5e4ecb[_0x3b3176](util[_0x5e28('0x17')]('campaign:%s:%s',_0x4891f6[_0x18a7ab][_0x17a9f8]['type'],_0x4891f6[_0x18a7ab][_0x17a9f8][_0x5e28('0x4')]));break;case 0xa:_0x5e4ecb[_0x3b3176](util[_0x5e28('0x17')](_0x5e28('0x1a'),_0x4891f6[_0x18a7ab][_0x17a9f8]['name']));break;}}}}})[_0x5e28('0x12')](function(){if(_0x3b3176===_0x5e28('0x42')){var _0x5bb86f=_['map'](_0x12300e['ChatInteractions'],'id');return _0x12300e['removeChatInteractions'](_0x5bb86f)[_0x5e28('0x12')](function(){for(var _0x1e0d83=0x0;_0x1e0d83<_0x5bb86f[_0x5e28('0x19')];_0x1e0d83+=0x1){_0x32630e[_0x5e28('0x43')](_0x5e28('0x44'),{'ChatInteractionId':Number(_0x5bb86f[_0x1e0d83]),'UserId':Number(_0x12300e['id'])});}});}})[_0x5e28('0x12')](function(){if(_0x3b3176===_0x5e28('0x42')){var _0x568015=_['map'](_0x12300e[_0x5e28('0x45')],'id');return _0x12300e['removeMailInteractions'](_0x568015)[_0x5e28('0x12')](function(){for(var _0x4afc08=0x0;_0x4afc08<_0x568015[_0x5e28('0x19')];_0x4afc08+=0x1){_0x32630e[_0x5e28('0x43')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x568015[_0x4afc08]),'UserId':Number(_0x12300e['id'])});}});}})[_0x5e28('0x12')](function(){if(_0x3b3176===_0x5e28('0x42')){var _0x2797ba=_[_0x5e28('0x13')](_0x12300e[_0x5e28('0x21')],'id');return _0x12300e[_0x5e28('0x46')](_0x2797ba)[_0x5e28('0x12')](function(){for(var _0x1e0831=0x0;_0x1e0831<_0x2797ba[_0x5e28('0x19')];_0x1e0831+=0x1){_0x32630e[_0x5e28('0x43')](_0x5e28('0x47'),{'FaxInteractionId':Number(_0x2797ba[_0x1e0831]),'UserId':Number(_0x12300e['id'])});}});}})[_0x5e28('0x12')](function(){if(_0x3b3176===_0x5e28('0x42')){var _0x5262b7=_[_0x5e28('0x13')](_0x12300e[_0x5e28('0x48')],'id');return _0x12300e[_0x5e28('0x49')](_0x5262b7)[_0x5e28('0x12')](function(){for(var _0x1365b2=0x0;_0x1365b2<_0x5262b7[_0x5e28('0x19')];_0x1365b2+=0x1){_0x32630e[_0x5e28('0x43')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x5262b7[_0x1365b2]),'UserId':Number(_0x12300e['id'])});}});}})[_0x5e28('0x12')](function(){if(_0x3b3176==='leave'){var _0x3eda4d=_[_0x5e28('0x13')](_0x12300e['OpenchannelInteractions'],'id');return _0x12300e[_0x5e28('0x4a')](_0x3eda4d)[_0x5e28('0x12')](function(){for(var _0x4fd54b=0x0;_0x4fd54b<_0x3eda4d[_0x5e28('0x19')];_0x4fd54b+=0x1){_0x32630e[_0x5e28('0x43')](_0x5e28('0x4b'),{'OpenchannelInteractionId':Number(_0x3eda4d[_0x4fd54b]),'UserId':Number(_0x12300e['id'])});}});}})[_0x5e28('0x12')](function(){if(_0x3b3176===_0x5e28('0x42')){var _0x3d625b=_['map'](_0x12300e[_0x5e28('0x25')],'id');return _0x12300e['removeWhatsappInteractions'](_0x3d625b)[_0x5e28('0x12')](function(){for(var _0x5e5d69=0x0;_0x5e5d69<_0x3d625b['length'];_0x5e5d69+=0x1){_0x32630e[_0x5e28('0x43')](_0x5e28('0x4c'),{'WhatsappInteractionId':Number(_0x3d625b[_0x5e5d69]),'UserId':Number(_0x12300e['id'])});}});}})[_0x5e28('0x4d')](function(_0x14ca18){_0x5e4ecb[_0x5e28('0x4e')](_0x14ca18);});}}function onDisconnect(_0x7a8a0f,_0x5ed8ad){joinOrLeave(_0x7a8a0f,_0x5e28('0x42'),_0x5ed8ad);}function onConnect(_0x4e816e){joinOrLeave(_0x4e816e,_0x5e28('0x4f'));}exports[_0x5e28('0x50')]=function(_0x56801e){_0x56801e['on']('connection',function(_0x2a5812){_0x2a5812[_0x5e28('0x51')](0x0);_0x2a5812[_0x5e28('0x52')]=_0x2a5812[_0x5e28('0x53')]['connection'][_0x5e28('0x54')]+':'+_0x2a5812['request'][_0x5e28('0x55')][_0x5e28('0x56')];_0x2a5812[_0x5e28('0x57')]=new Date();_0x2a5812['log']=function(_0x336fac){console['log'](_0x5e28('0x58')+_0x2a5812[_0x5e28('0x59')][_0x5e28('0x4')]+'['+_0x2a5812['address']+']',_0x336fac);};_0x2a5812['on'](_0x5e28('0x5a'),function(){onDisconnect(_0x2a5812,_0x56801e);_0x2a5812[_0x5e28('0x4e')]('DISCONNECTED');});onConnect(_0x2a5812);_0x2a5812[_0x5e28('0x4e')](_0x5e28('0x5b'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 9da6e48..1c0308a 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 _0xe96b=['OpenchannelMessage','request','EventManager','info','error','Trigger,\x20%s','catch','get','channel','event','direction','UserId','User','name','then','interface','format','incomingmessage','outgoingmessage','opened','closed','find','SIP/%s','default','hasOwnProperty','model','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','WhatsappInteraction','afterUpdate','Whatsapp','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xe96b,0xbb));var _0xbe96=function(_0x26052f,_0x5bc41e){_0x26052f=_0x26052f-0x0;var _0x3f30e4=_0xe96b[_0x26052f];return _0x3f30e4;};'use strict';var util=require(_0xbe96('0x0'));var db=require(_0xbe96('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xbe96('0x2'))(_0xbe96('0x3'));var client=jayson[_0xbe96('0x4')][_0xbe96('0x5')]({'port':0x232a});var triggers=[{'channel':_0xbe96('0x6'),'model':'ChatInteraction','event':_0xbe96('0x7'),'condition':_0xbe96('0x8'),'callback':afterCreate},{'channel':_0xbe96('0x6'),'model':_0xbe96('0x9'),'event':'afterUpdate','condition':_0xbe96('0xa'),'callback':afterUpdate},{'channel':_0xbe96('0x6'),'model':_0xbe96('0xb'),'event':_0xbe96('0x7'),'condition':_0xbe96('0xc'),'callback':afterCreateMessage},{'channel':_0xbe96('0xd'),'model':_0xbe96('0xe'),'event':_0xbe96('0x7'),'condition':_0xbe96('0x8'),'callback':afterCreate},{'channel':_0xbe96('0xd'),'model':'SmsInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbe96('0xd'),'model':'SmsMessage','event':_0xbe96('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':'afterCreate','condition':_0xbe96('0x8'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xbe96('0xf'),'event':_0xbe96('0x10'),'condition':_0xbe96('0xa'),'callback':afterUpdate},{'channel':_0xbe96('0x11'),'model':'WhatsappMessage','event':_0xbe96('0x7'),'condition':_0xbe96('0xc'),'callback':afterCreateMessage},{'channel':_0xbe96('0x12'),'model':_0xbe96('0x13'),'event':_0xbe96('0x7'),'condition':_0xbe96('0x8'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':_0xbe96('0x14'),'event':_0xbe96('0x7'),'condition':_0xbe96('0xc'),'callback':afterCreateMessage},{'channel':_0xbe96('0x15'),'model':_0xbe96('0x16'),'event':'afterCreate','condition':_0xbe96('0x8'),'callback':afterCreate},{'channel':_0xbe96('0x15'),'model':_0xbe96('0x16'),'event':_0xbe96('0x10'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0xbe96('0x17'),'event':'afterCreate','condition':_0xbe96('0xc'),'callback':afterCreateMessage},{'channel':_0xbe96('0x18'),'model':'OpenchannelInteraction','event':_0xbe96('0x7'),'condition':_0xbe96('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterUpdate','condition':_0xbe96('0xa'),'callback':afterUpdate},{'channel':_0xbe96('0x18'),'model':_0xbe96('0x19'),'event':_0xbe96('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x52b1ab){return client[_0xbe96('0x1a')](_0xbe96('0x1b'),_0x52b1ab)['then'](function(_0x5e817c){logger[_0xbe96('0x1c')]('Trigger,\x20%s','EventManager',_0x5e817c);if(_0x5e817c[_0xbe96('0x1d')]){if(_0x5e817c[_0xbe96('0x1d')]['code']===0x1f4){logger[_0xbe96('0x1d')](_0xbe96('0x1e'),_0xbe96('0x1b'),_0x5e817c[_0xbe96('0x1d')]);}}})[_0xbe96('0x1f')](function(_0x5bbd14){logger[_0xbe96('0x1d')]('Trigger,\x20%s',_0xbe96('0x1b'),_0x5bbd14);});}function afterCreateMessage(_0x10eb26,_0x58ff88){return function(_0x4c9a83,_0x1c4215){_0x4c9a83=_0x4c9a83[_0xbe96('0x20')]({'plain':!![]});_0x4c9a83[_0xbe96('0x21')]=_0x10eb26;_0x4c9a83[_0xbe96('0x22')]=_0x4c9a83[_0xbe96('0x23')];if(_0x4c9a83[_0xbe96('0x24')]){return db[_0xbe96('0x25')]['find']({'where':{'id':_0x4c9a83[_0xbe96('0x24')]},'attributes':['id',_0xbe96('0x26')],'raw':!![]})[_0xbe96('0x27')](function(_0x236417){_0x4c9a83[_0xbe96('0x28')]=util[_0xbe96('0x29')]('SIP/%s',_0x236417[_0xbe96('0x26')]);_0x4c9a83[_0xbe96('0x21')]=_0x10eb26;return request({'event':_0xbe96('0x2a'),'message':_0x4c9a83});})['catch'](function(_0x2396f7){console[_0xbe96('0x1d')](_0x2396f7);});}else{return request({'event':_0xbe96('0x2b'),'message':_0x4c9a83});}};}function afterCreate(_0x5ebc80,_0x514977){return function(_0x57a97b,_0x1a1b62){_0x57a97b=_0x57a97b[_0xbe96('0x20')]({'plain':!![]});_0x57a97b[_0xbe96('0x21')]=_0x5ebc80;_0x57a97b[_0xbe96('0x22')]=_0xbe96('0x2c');return request({'event':_0x514977,'message':_0x57a97b});};}function afterUpdate(_0xabbee5,_0xde8288){return function(_0x1f6233,_0x598e51){if(_0x1f6233['changed'](_0xbe96('0x2d'))&&_0x1f6233['closed']){_0x1f6233=_0x1f6233[_0xbe96('0x20')]({'plain':!![]});_0x1f6233[_0xbe96('0x21')]=_0xabbee5;_0x1f6233[_0xbe96('0x22')]=_0xbe96('0x2d');if(_0x1f6233[_0xbe96('0x24')]){return db['User'][_0xbe96('0x2e')]({'where':{'id':_0x1f6233[_0xbe96('0x24')]},'attributes':['id',_0xbe96('0x26')],'raw':!![]})[_0xbe96('0x27')](function(_0x97045e){_0x1f6233[_0xbe96('0x28')]=util[_0xbe96('0x29')](_0xbe96('0x2f'),_0x97045e['name']);return request({'event':_0xde8288,'message':_0x1f6233});})['catch'](function(_0x14e546){console['error'](_0x14e546);});}else{return request({'event':_0xde8288,'message':_0x1f6233});}}};}exports[_0xbe96('0x30')]=function(){for(var _0x258028=0x0;_0x258028=_0x1423bc[_0x1c39('0x13')]){throw Error(_0x1c39('0x14'));}_0x3a7e68(_0x3a959c);})[_0x1c39('0x15')](function(_0x4ca0da){_0x828609(_0x4ca0da);});});}; \ No newline at end of file +var _0x1eaf=['../mysqldb','./license/util','voice','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','updateAttributes','role','agent','User','getLicense','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash'];(function(_0x1ea08c,_0x1f3243){var _0x51bfca=function(_0x477561){while(--_0x477561){_0x1ea08c['push'](_0x1ea08c['shift']());}};_0x51bfca(++_0x1f3243);}(_0x1eaf,0x113));var _0xf1ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1eaf[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf1ea('0x0'));var BPromise=require('bluebird');var db=require(_0xf1ea('0x1'))['db'];var util=require(_0xf1ea('0x2'));var channels=[_0xf1ea('0x3'),'mail','chat',_0xf1ea('0x4'),_0xf1ea('0x5'),_0xf1ea('0x6'),_0xf1ea('0x7')];exports[_0xf1ea('0x8')]=function(){return channels;};exports[_0xf1ea('0x9')]=function(_0x31d0b9){_0x31d0b9=_0x31d0b9[_0xf1ea('0xa')]();return _[_0xf1ea('0xb')](channels,_0x31d0b9);};exports[_0xf1ea('0xc')]=function(_0x5b9bda,_0x22176d,_0xf69c76,_0x1608fe){var _0x2dd3bd={'loginAttempts':_0x22176d,'blocked':_0xf69c76};if(!_[_0xf1ea('0xd')](_0x1608fe)){_0x2dd3bd['blockedAt']=_0x1608fe;}return _0x5b9bda[_0xf1ea('0xe')](_0x2dd3bd);};exports['getLicense']=function(_0x183087){return new BPromise(function(_0xdfb536,_0x1f3120){var _0x456d59=0x0;if(_0x183087[_0xf1ea('0xf')]!==_0xf1ea('0x10')){_0xdfb536(_0x183087);}db[_0xf1ea('0x11')]['count']({'where':{'role':_0xf1ea('0x10'),'online':!![],'id':{'$ne':_0x183087['id']}}})['then'](function(_0x1174fd){_0x456d59=_0x1174fd;return util[_0xf1ea('0x12')]();})[_0xf1ea('0x13')](function(_0x577c4d){if(_0x577c4d&&_0x577c4d['agents']&&_0x456d59>=_0x577c4d[_0xf1ea('0x14')]){throw Error(_0xf1ea('0x15'));}_0xdfb536(_0x183087);})[_0xf1ea('0x16')](function(_0x306764){_0x1f3120(_0x306764);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index d56b512..668ccda 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cf4=['render','json','send','exports','404','status'];(function(_0x4b08be,_0xa3caac){var _0x30b817=function(_0x7624aa){while(--_0x7624aa){_0x4b08be['push'](_0x4b08be['shift']());}};_0x30b817(++_0xa3caac);}(_0x1cf4,0x195));var _0x41cf=function(_0x54f9af,_0x57f4c4){_0x54f9af=_0x54f9af-0x0;var _0x488b5d=_0x1cf4[_0x54f9af];return _0x488b5d;};'use strict';module[_0x41cf('0x0')][0x194]=function pageNotFound(_0x17d26d,_0x29b113){var _0x8f85a4=_0x41cf('0x1');var _0x5b0318=0x194;var _0x104355={'status':_0x5b0318};_0x29b113['status'](_0x104355[_0x41cf('0x2')]);_0x29b113[_0x41cf('0x3')](_0x8f85a4,{},function(_0x5836dd,_0x6f7240){if(_0x5836dd){return _0x29b113[_0x41cf('0x2')](_0x104355[_0x41cf('0x2')])[_0x41cf('0x4')](_0x104355);}_0x29b113[_0x41cf('0x5')](_0x6f7240);});}; \ No newline at end of file +var _0x7033=['json','send','404','status','render'];(function(_0x3e5bd7,_0x22ace9){var _0x1c8458=function(_0x2ab914){while(--_0x2ab914){_0x3e5bd7['push'](_0x3e5bd7['shift']());}};_0x1c8458(++_0x22ace9);}(_0x7033,0x1ba));var _0x3703=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7033[_0x199572];return _0x13cfa3;};'use strict';module['exports'][0x194]=function pageNotFound(_0x20e2c7,_0x11715f){var _0x3bc325=_0x3703('0x0');var _0x15c69c=0x194;var _0x29c817={'status':_0x15c69c};_0x11715f[_0x3703('0x1')](_0x29c817['status']);_0x11715f[_0x3703('0x2')](_0x3bc325,{},function(_0x9c5ad1,_0x32f70e){if(_0x9c5ad1){return _0x11715f['status'](_0x29c817['status'])[_0x3703('0x3')](_0x29c817);}_0x11715f[_0x3703('0x4')](_0x32f70e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index dcc2a4a..3d1fca3 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f02=['ChatWebsiteId','ProactiveActions','ChatMessage','OpenchannelQueueReport','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','CompanyId','Hoppers','Company','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','AnyConditions','TriggerAnyId','Actions','TriggerId','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','AccountId','Description','DescriptionId','Field','FieldId','VariableId','int_desk_configuration_has_tags','Subject','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Account','Dynamics365Configuration','FreshsalesField','ChatQueueReport','ToId','JscriptyQuestionReport','SessionId','ProjectId','team_has_voice_queues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','ToAgent','ToMailQueueId','ToQueue','FromAgent','ToUserId','ToChatQueueId','ToAccount','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','Extensions','userProfileId','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccount','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','path','jstz','determine','sequelize','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','sequelizeHistory','motion2','password','options','database','User','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','ChatApplication','../api/chatApplication/chatApplication.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/template/template.model','../api/trigger/trigger.model','Variable','../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','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','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','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','Campaign','Migration','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','hasOne','cascade','UserId','hasMany','VoiceRecording','Recordings','UserVoiceQueueRt','VoiceQueuesRt','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','Notification','Notifications','SenderId','belongsTo','belongsToMany','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_square_projects','SpiedAgents','Applications','Sound','moh_has_sounds','Members','VoiceQueueId','CmHopper','HopperHistories','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','restrict','TagId','MailQueueReport','DashboardItem','FaxAccountId','Exntensions','FaxInteractionId','Owner','fax_interaction_has_tags','user_has_fax_interactions','Interaction','AttachmentId','UserFaxQueue','team_has_fax_queues','SmsAccount','SmsMessage','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId'];(function(_0x118af5,_0x36caec){var _0x1486ae=function(_0x17dd31){while(--_0x17dd31){_0x118af5['push'](_0x118af5['shift']());}};_0x1486ae(++_0x36caec);}(_0x9f02,0x68));var _0x29f0=function(_0x4cad3d,_0x46ebc6){_0x4cad3d=_0x4cad3d-0x0;var _0x571285=_0x9f02[_0x4cad3d];return _0x571285;};'use strict';var path=require(_0x29f0('0x0'));var config=require('../config/environment');var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x29f0('0x1'));var timezone=jstz[_0x29f0('0x2')]();config[_0x29f0('0x3')]=_[_0x29f0('0x4')](config[_0x29f0('0x3')],{'database':'motion2','username':_0x29f0('0x5'),'password':'xC@LL1234','options':{'host':_0x29f0('0x6'),'port':0xcea,'dialect':_0x29f0('0x7'),'dialectOptions':{'charset':_0x29f0('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x29f0('0x9')]=_['defaultsDeep'](config[_0x29f0('0x9')],{'database':_0x29f0('0xa'),'username':_0x29f0('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x29f0('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x29f0('0x3')]['database'],config[_0x29f0('0x3')]['username'],config[_0x29f0('0x3')][_0x29f0('0xb')],config[_0x29f0('0x3')][_0x29f0('0xc')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x29f0('0xd')],config[_0x29f0('0x9')]['username'],config[_0x29f0('0x9')]['password'],config[_0x29f0('0x9')]['options'])};db[_0x29f0('0xe')]=db[_0x29f0('0x3')]['import']('../api/user/user.model');db['VoiceChanSpy']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x10'));db['VoiceContext']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x11'));db[_0x29f0('0x12')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x13'));db[_0x29f0('0x14')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x15'));db['VoiceQueue']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x16'));db['VoiceRecording']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x17'));db[_0x29f0('0x18')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x19'));db[_0x29f0('0x1a')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x1b'));db[_0x29f0('0x1c')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x1d'));db[_0x29f0('0x1e')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x1f'));db[_0x29f0('0x20')]=db['sequelize']['import'](_0x29f0('0x21'));db[_0x29f0('0x22')]=db['sequelize'][_0x29f0('0xf')](_0x29f0('0x23'));db[_0x29f0('0x24')]=db['sequelize']['import'](_0x29f0('0x25'));db[_0x29f0('0x26')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x27'));db['Trunk']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x28'));db[_0x29f0('0x29')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x2a'));db['UserVoiceQueueRt']=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x29f0('0x2b')]=db[_0x29f0('0x3')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x29f0('0x2c')]=db['sequelize'][_0x29f0('0xf')]('../api/userChatQueue/userChatQueue.model');db[_0x29f0('0x2d')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x2e'));db['UserFaxQueue']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x2f'));db[_0x29f0('0x30')]=db['sequelize'][_0x29f0('0xf')]('../api/userSmsQueue/userSmsQueue.model');db[_0x29f0('0x31')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x32'));db[_0x29f0('0x33')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x29f0('0x34')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/mailServerIn/mailServerIn.model');db[_0x29f0('0x35')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x36'));db[_0x29f0('0x37')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/mailAccount/mailAccount.model');db[_0x29f0('0x38')]=db[_0x29f0('0x3')]['import']('../api/mailQueue/mailQueue.model');db[_0x29f0('0x39')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x3a'));db[_0x29f0('0x3b')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x3c'));db[_0x29f0('0x3d')]=db[_0x29f0('0x3')]['import']('../api/mailMessage/mailMessage.model');db[_0x29f0('0x3e')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x3f'));db['MailQueueReport']=db[_0x29f0('0x3')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x29f0('0x40')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x41'));db['DashboardItem']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x42'));db[_0x29f0('0x43')]=db['sequelize'][_0x29f0('0xf')]('../api/faxAccount/faxAccount.model');db[_0x29f0('0x44')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/faxApplication/faxApplication.model');db[_0x29f0('0x45')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x46'));db[_0x29f0('0x47')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x48'));db[_0x29f0('0x49')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x4a'));db[_0x29f0('0x4b')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x4c'));db['SmsAccount']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x4d'));db['SmsApplication']=db['sequelize'][_0x29f0('0xf')](_0x29f0('0x4e'));db['SmsInteraction']=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x29f0('0x3')]['import']('../api/smsMessage/smsMessage.model');db[_0x29f0('0x4f')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/smsQueue/smsQueue.model');db[_0x29f0('0x50')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x51'));db[_0x29f0('0x52')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/openchannelApplication/openchannelApplication.model');db[_0x29f0('0x53')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x54'));db[_0x29f0('0x55')]=db['sequelize']['import'](_0x29f0('0x56'));db[_0x29f0('0x57')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/openchannelQueue/openchannelQueue.model');db[_0x29f0('0x58')]=db['sequelize'][_0x29f0('0xf')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x29f0('0x59')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x5a'));db['ChatInteraction']=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x29f0('0x3')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0x29f0('0xf')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize'][_0x29f0('0xf')]('../api/chatQueue/chatQueue.model');db[_0x29f0('0x5b')]=db['sequelize'][_0x29f0('0xf')]('../api/chatGroup/chatGroup.model');db[_0x29f0('0x5c')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x5d'));db[_0x29f0('0x5e')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x5f'));db['CmContact']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x60'));db['CmHopper']=db['sequelize'][_0x29f0('0xf')](_0x29f0('0x61'));db[_0x29f0('0x62')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x63'));db[_0x29f0('0x64')]=db['sequelize']['import']('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db['sequelize'][_0x29f0('0xf')](_0x29f0('0x65'));db[_0x29f0('0x66')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x67'));db[_0x29f0('0x68')]=db[_0x29f0('0x3')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x29f0('0x69')]=db['sequelize']['import']('../api/action/action.model');db[_0x29f0('0x6a')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x6b'));db[_0x29f0('0x6c')]=db['sequelize'][_0x29f0('0xf')](_0x29f0('0x6d'));db[_0x29f0('0x6e')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x6f'));db[_0x29f0('0x70')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x71'));db[_0x29f0('0x72')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/interval/interval.model');db['Pause']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x73'));db['Cdr']=db['sequelize']['import'](_0x29f0('0x74'));db[_0x29f0('0x75')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x76'));db[_0x29f0('0x77')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x78'));db['Sound']=db[_0x29f0('0x3')]['import'](_0x29f0('0x79'));db[_0x29f0('0x7a')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/tag/tag.model');db['Template']=db[_0x29f0('0x3')]['import'](_0x29f0('0x7b'));db['Trigger']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x7c'));db[_0x29f0('0x7d')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x7e'));db[_0x29f0('0x7f')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x80'));db['IntegrationReport']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x81'));db[_0x29f0('0x82')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x83'));db[_0x29f0('0x84')]=db[_0x29f0('0x3')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x29f0('0x85')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x86'));db[_0x29f0('0x87')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x88'));db[_0x29f0('0x89')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x8a'));db['AnalyticTreeReport']=db[_0x29f0('0x3')]['import'](_0x29f0('0x8b'));db[_0x29f0('0x8c')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x8d'));db[_0x29f0('0x8e')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x29f0('0x8f')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x90'));db[_0x29f0('0x91')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x92'));db[_0x29f0('0x93')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x94'));db[_0x29f0('0x95')]=db[_0x29f0('0x3')]['import'](_0x29f0('0x96'));db[_0x29f0('0x97')]=db['sequelize']['import'](_0x29f0('0x98'));db[_0x29f0('0x99')]=db['sequelize'][_0x29f0('0xf')](_0x29f0('0x9a'));db[_0x29f0('0x9b')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x9c'));db[_0x29f0('0x9d')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0x9e'));db[_0x29f0('0x9f')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x29f0('0xa0')]=db['sequelize'][_0x29f0('0xf')](_0x29f0('0xa1'));db[_0x29f0('0xa2')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xa3'));db[_0x29f0('0xa4')]=db[_0x29f0('0x3')]['import'](_0x29f0('0xa5'));db[_0x29f0('0xa6')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xa7'));db[_0x29f0('0xa8')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xa9'));db['FreshdeskConfiguration']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xaa'));db['FreshdeskField']=db['sequelize'][_0x29f0('0xf')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x29f0('0xab')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xac'));db[_0x29f0('0xad')]=db['sequelize']['import'](_0x29f0('0xae'));db[_0x29f0('0xaf')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xb0'));db['ServicenowAccount']=db[_0x29f0('0x3')]['import'](_0x29f0('0xb1'));db[_0x29f0('0xb2')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x29f0('0xb3')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xb4'));db['Dynamics365Account']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xb5'));db['Dynamics365Configuration']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xb6'));db[_0x29f0('0xb7')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xb8'));db[_0x29f0('0xb9')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xba'));db[_0x29f0('0xbb')]=db['sequelize'][_0x29f0('0xf')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xbc'));db['Integration']=db[_0x29f0('0x3')]['import'](_0x29f0('0x80'));db['Network']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xbd'));db['ChatQueueReport']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xbe'));db[_0x29f0('0xbf')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xc0'));db[_0x29f0('0xc1')]=db[_0x29f0('0x3')]['import'](_0x29f0('0xc2'));db['JscriptyQuestionReport']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xc3'));db[_0x29f0('0xc4')]=db['sequelize'][_0x29f0('0xf')](_0x29f0('0xc5'));db[_0x29f0('0xc6')]=db['sequelize']['import'](_0x29f0('0xc7'));db['SquareReport']=db['sequelize']['import'](_0x29f0('0xc8'));db[_0x29f0('0xc9')]=db[_0x29f0('0x3')]['import'](_0x29f0('0xca'));db[_0x29f0('0xcb')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xcc'));db[_0x29f0('0xcd')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xce'));db[_0x29f0('0xcf')]=db['sequelize'][_0x29f0('0xf')](_0x29f0('0xd0'));db[_0x29f0('0xd1')]=db['sequelize'][_0x29f0('0xf')](_0x29f0('0xd2'));db[_0x29f0('0xd3')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xd4'));db[_0x29f0('0xd5')]=db['sequelize']['import'](_0x29f0('0xd6'));db[_0x29f0('0xd7')]=db['sequelize'][_0x29f0('0xf')]('../api/team/team.model');db['License']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xd8'));db[_0x29f0('0xd9')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/campaign/campaign.model');db[_0x29f0('0xda')]=db['sequelize'][_0x29f0('0xf')]('../api/migration/migration.model');db[_0x29f0('0xdb')]=db[_0x29f0('0x3')]['import'](_0x29f0('0xdc'));db[_0x29f0('0xdd')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/plugin/plugin.model');db[_0x29f0('0xde')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xdf'));db[_0x29f0('0xe0')]=db[_0x29f0('0x3')]['import'](_0x29f0('0xe1'));db[_0x29f0('0xe2')]=db['sequelize'][_0x29f0('0xf')]('../api/faxTransferReport/faxTransferReport.model');db[_0x29f0('0xe3')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x29f0('0xe4')]=db[_0x29f0('0x3')]['import'](_0x29f0('0xe5'));db['CmList']=db['sequelize'][_0x29f0('0xf')](_0x29f0('0xe6'));db[_0x29f0('0xe7')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xe8'));db[_0x29f0('0xe9')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xea'));db['UserProfileSection']=db['sequelize'][_0x29f0('0xf')](_0x29f0('0xeb'));db['UserProfileResource']=db['sequelize'][_0x29f0('0xf')](_0x29f0('0xec'));db['Notification']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xed'));db['WhatsappAccount']=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xee'));db[_0x29f0('0xef')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xf0'));db[_0x29f0('0xf1')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x29f0('0xf2')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xf3'));db['WhatsappQueueReport']=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x29f0('0xf4')]=db[_0x29f0('0x3')][_0x29f0('0xf')](_0x29f0('0xf5'));db['WhatsappQueue']=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/whatsappQueue/whatsappQueue.model');db[_0x29f0('0xf6')]=db[_0x29f0('0x3')][_0x29f0('0xf')]('../api/cloudProvider/cloudProvider.model');db[_0x29f0('0xe')][_0x29f0('0xf7')](db[_0x29f0('0x1a')],{'as':_0x29f0('0x1a'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0xe')][_0x29f0('0xfa')](db[_0x29f0('0xfb')],{'as':_0x29f0('0xfc'),'foreignKey':'UserId'});db['User'][_0x29f0('0xfa')](db[_0x29f0('0xfd')],{'as':_0x29f0('0xfe'),'foreignKey':'UserId'});db[_0x29f0('0xe')][_0x29f0('0xfa')](db[_0x29f0('0x12')],{'as':'Extensions','onDelete':_0x29f0('0xf8'),'hooks':!![]});db[_0x29f0('0xe')][_0x29f0('0xfa')](db[_0x29f0('0x64')],{'as':_0x29f0('0xff'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0xe')][_0x29f0('0xfa')](db[_0x29f0('0x100')],{'as':_0x29f0('0x101'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0xe')][_0x29f0('0xfa')](db[_0x29f0('0x66')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0x29f0('0xe')][_0x29f0('0xfa')](db[_0x29f0('0x53')],{'as':_0x29f0('0x102'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0xe')][_0x29f0('0xfa')](db[_0x29f0('0x103')],{'as':_0x29f0('0x104'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0xe')]['hasMany'](db[_0x29f0('0x105')],{'as':_0x29f0('0x106'),'foreignKey':'UserId'});db['User'][_0x29f0('0xfa')](db['FaxInteraction'],{'as':_0x29f0('0x107'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0xe')][_0x29f0('0xfa')](db[_0x29f0('0x3b')],{'as':'MailInteractions','foreignKey':_0x29f0('0xf9')});db[_0x29f0('0xe')]['hasMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x29f0('0xf9')});db[_0x29f0('0xe')][_0x29f0('0xfa')](db[_0x29f0('0x108')],{'as':_0x29f0('0x109'),'foreignKey':_0x29f0('0x10a')});db[_0x29f0('0xe')][_0x29f0('0x10b')](db[_0x29f0('0xe9')],{'as':_0x29f0('0xe9'),'foreignKey':'userProfileId'});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x5b')],{'as':'Groups','through':_0x29f0('0x10d')});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x10e')],{'as':_0x29f0('0x10f'),'through':_0x29f0('0x110')});db[_0x29f0('0xe')]['belongsToMany'](db[_0x29f0('0x111')],{'as':_0x29f0('0x112'),'through':_0x29f0('0x113')});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0xd7')],{'through':_0x29f0('0x114')});db[_0x29f0('0xe')][_0x29f0('0x10c')](db['MailInteraction'],{'as':_0x29f0('0x115'),'through':_0x29f0('0x116')});db['User'][_0x29f0('0x10c')](db['ChatInteraction'],{'as':_0x29f0('0x104'),'through':_0x29f0('0x117')});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x45')],{'as':_0x29f0('0x107'),'through':'user_has_fax_interactions'});db[_0x29f0('0xe')]['belongsToMany'](db[_0x29f0('0x105')],{'as':_0x29f0('0x106'),'through':_0x29f0('0x118')});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x53')],{'as':_0x29f0('0x102'),'through':_0x29f0('0x119')});db[_0x29f0('0xe')][_0x29f0('0x10c')](db['WhatsappInteraction'],{'as':_0x29f0('0x11a'),'through':_0x29f0('0x11b')});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x11c')],{'as':_0x29f0('0x11d'),'through':_0x29f0('0x2b'),'required':![]});db[_0x29f0('0xe')][_0x29f0('0x10c')](db['MailQueue'],{'as':_0x29f0('0x11e'),'through':_0x29f0('0x2d'),'required':![]});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x11f')],{'as':_0x29f0('0x120'),'through':_0x29f0('0x2c'),'required':![],'hooks':!![]});db[_0x29f0('0xe')]['belongsToMany'](db[_0x29f0('0x49')],{'as':_0x29f0('0x121'),'through':'UserFaxQueue','required':![]});db[_0x29f0('0xe')]['belongsToMany'](db['SmsQueue'],{'as':_0x29f0('0x122'),'through':_0x29f0('0x30'),'required':![]});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x57')],{'as':_0x29f0('0x123'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x29f0('0x10c')](db[_0x29f0('0x124')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x111')],{'through':_0x29f0('0x113')});db[_0x29f0('0xe')][_0x29f0('0x10c')](db['VoicePrefix'],{'as':_0x29f0('0x125'),'through':_0x29f0('0x126'),'required':![]});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x58')],{'as':_0x29f0('0x127'),'through':_0x29f0('0x128')});db[_0x29f0('0xe')]['belongsToMany'](db[_0x29f0('0x43')],{'as':_0x29f0('0x129'),'through':_0x29f0('0x12a')});db[_0x29f0('0xe')]['belongsToMany'](db[_0x29f0('0x37')],{'as':'MailAccounts','through':_0x29f0('0x12b')});db[_0x29f0('0xe')][_0x29f0('0x10c')](db[_0x29f0('0x50')],{'as':_0x29f0('0x12c'),'through':_0x29f0('0x12d')});db['User'][_0x29f0('0x10c')](db['SmsAccount'],{'as':_0x29f0('0x12e'),'through':_0x29f0('0x12f')});db['User'][_0x29f0('0x10c')](db['WhatsappAccount'],{'as':_0x29f0('0x130'),'through':'user_has_whatsapp_accounts'});db[_0x29f0('0xe')][_0x29f0('0x10c')](db['SquareProject'],{'as':'SquareProjects','through':_0x29f0('0x131')});db['VoiceChanSpy'][_0x29f0('0xfa')](db[_0x29f0('0x12')],{'as':_0x29f0('0x132'),'onDelete':_0x29f0('0xf8'),'foreignKey':'ChanSpyId'});db['VoiceContext']['hasMany'](db[_0x29f0('0x12')],{'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x12')]['hasMany'](db['VoiceExtension'],{'as':_0x29f0('0x133'),'onDelete':'cascade'});db[_0x29f0('0x14')][_0x29f0('0x10c')](db[_0x29f0('0x134')],{'as':'Sounds','through':_0x29f0('0x135')});db['VoiceQueue']['hasMany'](db['UserVoiceQueueRt'],{'as':_0x29f0('0x136'),'foreignKey':_0x29f0('0x137')});db[_0x29f0('0x11c')]['hasMany'](db[_0x29f0('0x138')],{'as':'Hoppers','foreignKey':_0x29f0('0x137')});db['VoiceQueue']['hasMany'](db[_0x29f0('0x64')],{'as':_0x29f0('0xff'),'foreignKey':_0x29f0('0x137')});db[_0x29f0('0x11c')][_0x29f0('0xfa')](db[_0x29f0('0x100')],{'as':_0x29f0('0x139'),'foreignKey':_0x29f0('0x137')});db[_0x29f0('0x11c')][_0x29f0('0xfa')](db[_0x29f0('0x66')],{'as':'ReportAgentPreview','foreignKey':_0x29f0('0x137')});db[_0x29f0('0x11c')][_0x29f0('0xfa')](db[_0x29f0('0x62')],{'as':'HopperBlacks','foreignKey':_0x29f0('0x137')});db[_0x29f0('0x11c')]['hasMany'](db['JscriptySessionReport'],{'as':_0x29f0('0x13a'),'foreignKey':_0x29f0('0x137')});db[_0x29f0('0x11c')][_0x29f0('0x10b')](db[_0x29f0('0x13b')],{'as':_0x29f0('0x13b'),'foreignKey':_0x29f0('0x13c')});db[_0x29f0('0x11c')][_0x29f0('0x10b')](db[_0x29f0('0x13b')],{'as':_0x29f0('0x13d'),'foreignKey':_0x29f0('0x13e')});db[_0x29f0('0x11c')]['belongsTo'](db[_0x29f0('0x72')],{'as':_0x29f0('0x72'),'foreignKey':_0x29f0('0x13f')});db['VoiceQueue'][_0x29f0('0x10b')](db[_0x29f0('0x140')],{'as':_0x29f0('0x141'),'foreignKey':_0x29f0('0x142')});db[_0x29f0('0x11c')][_0x29f0('0x10c')](db[_0x29f0('0x111')],{'as':_0x29f0('0x112'),'through':_0x29f0('0x143')});db[_0x29f0('0x11c')]['belongsToMany'](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':_0x29f0('0x2b')});db[_0x29f0('0x11c')][_0x29f0('0x10c')](db['Team'],{'as':_0x29f0('0x145'),'through':'team_has_voice_queues'});db[_0x29f0('0x11c')][_0x29f0('0x10c')](db[_0x29f0('0x111')],{'as':_0x29f0('0x146'),'through':_0x29f0('0x147')});db[_0x29f0('0xfb')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'as':_0x29f0('0xe'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0x18')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'as':'User','foreignKey':_0x29f0('0xf9')});db['VoiceMail'][_0x29f0('0xfa')](db[_0x29f0('0x1c')],{'as':_0x29f0('0x148'),'onDelete':_0x29f0('0xf8'),'foreignKey':'mailboxuser','sourceKey':_0x29f0('0x149')});db[_0x29f0('0x1c')][_0x29f0('0x10b')](db[_0x29f0('0x1a')],{'foreignKey':'mailboxuser','targetKey':_0x29f0('0x149')});db[_0x29f0('0x1e')][_0x29f0('0xfa')](db['VoiceQueueReport'],{'as':_0x29f0('0x14a'),'foreignKey':'uniqueid','constraints':![]});db[_0x29f0('0x1e')]['hasMany'](db[_0x29f0('0x22')],{'as':_0x29f0('0x14b'),'foreignKey':_0x29f0('0x14c'),'constraints':![]});db['VoiceCallReport'][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'as':_0x29f0('0xe'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0x1e')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db[_0x29f0('0x34')]['belongsTo'](db[_0x29f0('0x37')],{'as':_0x29f0('0x37'),'foreignKey':'MailAccountId'});db[_0x29f0('0x35')][_0x29f0('0x10b')](db[_0x29f0('0x37')],{'as':_0x29f0('0x37'),'foreignKey':_0x29f0('0x14f')});db[_0x29f0('0x37')][_0x29f0('0xf7')](db[_0x29f0('0x34')],{'as':_0x29f0('0x150'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x37')][_0x29f0('0xf7')](db[_0x29f0('0x35')],{'as':_0x29f0('0x151'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x37')][_0x29f0('0xfa')](db['Disposition'],{'as':_0x29f0('0x152'),'foreignKey':_0x29f0('0x14f')});db[_0x29f0('0x37')][_0x29f0('0xfa')](db['CannedAnswer'],{'as':_0x29f0('0x153'),'foreignKey':'MailAccountId'});db[_0x29f0('0x37')][_0x29f0('0xfa')](db[_0x29f0('0x3d')],{'as':_0x29f0('0x148'),'foreignKey':_0x29f0('0x14f')});db[_0x29f0('0x37')][_0x29f0('0xfa')](db['MailInteraction'],{'as':_0x29f0('0x154')});db[_0x29f0('0x37')][_0x29f0('0xfa')](db[_0x29f0('0x3e')],{'as':_0x29f0('0x133')});db[_0x29f0('0x37')][_0x29f0('0x10b')](db['CmList'],{'as':_0x29f0('0x155'),'foreignKey':_0x29f0('0x156')});db[_0x29f0('0x37')][_0x29f0('0x10b')](db[_0x29f0('0x157')],{'as':_0x29f0('0x157'),'foreignKey':_0x29f0('0x158')});db['MailAccount'][_0x29f0('0x10b')](db['Pause'],{'as':_0x29f0('0x141'),'foreignKey':_0x29f0('0x142')});db[_0x29f0('0x37')]['belongsToMany'](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':_0x29f0('0x12b')});db[_0x29f0('0x38')]['belongsToMany'](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':'UserMailQueue'});db[_0x29f0('0x38')][_0x29f0('0x10c')](db[_0x29f0('0xd7')],{'through':_0x29f0('0x159'),'as':_0x29f0('0x145')});db[_0x29f0('0x3b')][_0x29f0('0xfa')](db[_0x29f0('0x3d')],{'as':_0x29f0('0x148'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x15a')});db[_0x29f0('0x3b')][_0x29f0('0x10b')](db[_0x29f0('0x37')],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x14f')});db[_0x29f0('0x3b')]['belongsTo'](db[_0x29f0('0x10e')],{'as':'Contact','foreignKey':_0x29f0('0x14e')});db[_0x29f0('0x3b')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'as':'Owner','foreignKey':'UserId'});db[_0x29f0('0x3b')][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':_0x29f0('0x15c'),'as':_0x29f0('0x15d')});db[_0x29f0('0x3b')]['belongsToMany'](db[_0x29f0('0x7a')],{'through':_0x29f0('0x15c'),'as':_0x29f0('0x15e')});db['MailInteraction'][_0x29f0('0x10c')](db['User'],{'as':_0x29f0('0x15f'),'through':_0x29f0('0x116'),'foreignKey':_0x29f0('0x15a')});db['MailMessage'][_0x29f0('0xfa')](db[_0x29f0('0xdb')],{'as':_0x29f0('0x160'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x3d')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'as':'User'});db[_0x29f0('0x3d')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'onDelete':_0x29f0('0xf8'),'as':_0x29f0('0x14d')});db['MailMessage'][_0x29f0('0x10b')](db[_0x29f0('0x3b')],{'as':'Interaction','foreignKey':_0x29f0('0x15a')});db[_0x29f0('0x3d')]['belongsTo'](db[_0x29f0('0x37')],{'as':_0x29f0('0x15b'),'foreignKey':'MailAccountId'});db[_0x29f0('0x3e')]['belongsTo'](db[_0x29f0('0xe')],{'onDelete':'restrict'});db[_0x29f0('0x3e')]['belongsTo'](db[_0x29f0('0x38')],{'onDelete':_0x29f0('0x161')});db['MailApplication'][_0x29f0('0x10b')](db[_0x29f0('0x37')],{'onDelete':_0x29f0('0x161')});db[_0x29f0('0x3e')]['belongsTo'](db[_0x29f0('0x72')],{'onDelete':_0x29f0('0x161'),'foreignKey':'IntervalId'});db['MailApplication'][_0x29f0('0x10b')](db[_0x29f0('0x7a')],{'onDelete':_0x29f0('0x161'),'foreignKey':_0x29f0('0x162')});db['MailQueueReport']['belongsTo'](db[_0x29f0('0x37')],{});db['MailQueueReport'][_0x29f0('0x10b')](db[_0x29f0('0x111')],{'as':'List','foreignKey':_0x29f0('0x156')});db[_0x29f0('0x163')][_0x29f0('0x10b')](db['CmContact'],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db[_0x29f0('0x163')][_0x29f0('0x10b')](db[_0x29f0('0x3b')],{});db[_0x29f0('0x163')][_0x29f0('0x10b')](db[_0x29f0('0x3d')],{});db[_0x29f0('0x163')][_0x29f0('0x10b')](db['User'],{});db[_0x29f0('0x163')]['belongsTo'](db['MailQueue'],{});db['Dashboard']['hasMany'](db[_0x29f0('0x164')],{'as':'Items','onDelete':'cascade'});db[_0x29f0('0x43')][_0x29f0('0xfa')](db[_0x29f0('0x6e')],{'as':_0x29f0('0x152'),'foreignKey':_0x29f0('0x165')});db[_0x29f0('0x43')][_0x29f0('0xfa')](db[_0x29f0('0x6c')],{'as':'Answers','foreignKey':_0x29f0('0x165')});db[_0x29f0('0x43')]['hasMany'](db['FaxInteraction'],{'as':'Interactions'});db['FaxAccount'][_0x29f0('0xfa')](db[_0x29f0('0x44')],{'as':_0x29f0('0x133')});db['FaxAccount'][_0x29f0('0xfa')](db[_0x29f0('0x12')],{'as':_0x29f0('0x166'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x43')][_0x29f0('0xfa')](db['FaxMessage'],{'as':_0x29f0('0x148')});db[_0x29f0('0x43')]['belongsTo'](db[_0x29f0('0x13b')],{'as':_0x29f0('0x13b')});db['FaxAccount'][_0x29f0('0x10b')](db['CmList'],{'as':'List','foreignKey':_0x29f0('0x156')});db[_0x29f0('0x43')][_0x29f0('0x10b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x29f0('0x142')});db[_0x29f0('0x43')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'onDelete':_0x29f0('0x161')});db[_0x29f0('0x44')][_0x29f0('0x10b')](db[_0x29f0('0x49')],{'onDelete':'restrict'});db[_0x29f0('0x44')][_0x29f0('0x10b')](db[_0x29f0('0x43')],{'onDelete':_0x29f0('0x161')});db[_0x29f0('0x44')][_0x29f0('0x10b')](db[_0x29f0('0x7a')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x29f0('0x45')][_0x29f0('0xfa')](db['FaxMessage'],{'as':_0x29f0('0x148'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x167')});db[_0x29f0('0x45')][_0x29f0('0x10b')](db[_0x29f0('0x43')],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x165')});db[_0x29f0('0x45')]['belongsTo'](db[_0x29f0('0x10e')],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db[_0x29f0('0x45')]['belongsTo'](db[_0x29f0('0xe')],{'as':_0x29f0('0x168'),'foreignKey':'UserId'});db['FaxInteraction'][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':_0x29f0('0x169'),'as':_0x29f0('0x15d')});db[_0x29f0('0x45')][_0x29f0('0x10c')](db['Tag'],{'through':_0x29f0('0x169'),'as':_0x29f0('0x15e')});db[_0x29f0('0x45')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':'Users','through':_0x29f0('0x16a'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'onDelete':_0x29f0('0xf8'),'as':_0x29f0('0xe')});db[_0x29f0('0x47')][_0x29f0('0x10b')](db['FaxInteraction'],{'as':_0x29f0('0x16b'),'foreignKey':_0x29f0('0x167')});db['FaxMessage'][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'onDelete':_0x29f0('0xf8'),'as':_0x29f0('0x14d')});db[_0x29f0('0x47')]['belongsTo'](db[_0x29f0('0xdb')],{'as':'Attachment','foreignKey':_0x29f0('0x16c')});db['FaxMessage'][_0x29f0('0x10b')](db[_0x29f0('0x43')],{'as':'Account','foreignKey':_0x29f0('0x165')});db[_0x29f0('0x49')]['belongsToMany'](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':_0x29f0('0x16d')});db[_0x29f0('0x49')][_0x29f0('0x10c')](db[_0x29f0('0xd7')],{'through':_0x29f0('0x16e'),'as':'Teams'});db[_0x29f0('0x4b')][_0x29f0('0x10b')](db[_0x29f0('0x43')],{});db[_0x29f0('0x4b')][_0x29f0('0x10b')](db[_0x29f0('0x111')],{'as':_0x29f0('0x155'),'foreignKey':_0x29f0('0x156')});db[_0x29f0('0x4b')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db['FaxQueueReport'][_0x29f0('0x10b')](db[_0x29f0('0x45')],{});db[_0x29f0('0x4b')]['belongsTo'](db[_0x29f0('0x47')],{});db[_0x29f0('0x4b')]['belongsTo'](db[_0x29f0('0xe')],{});db[_0x29f0('0x4b')][_0x29f0('0x10b')](db['FaxQueue'],{});db[_0x29f0('0x16f')][_0x29f0('0xfa')](db[_0x29f0('0x6e')],{'as':_0x29f0('0x152'),'foreignKey':'SmsAccountId'});db[_0x29f0('0x16f')][_0x29f0('0xfa')](db[_0x29f0('0x6c')],{'as':_0x29f0('0x153'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x29f0('0xfa')](db[_0x29f0('0x170')],{'as':_0x29f0('0x148'),'foreignKey':_0x29f0('0x171')});db[_0x29f0('0x16f')][_0x29f0('0xfa')](db['SmsInteraction'],{'as':_0x29f0('0x154')});db[_0x29f0('0x16f')][_0x29f0('0xfa')](db['SmsApplication'],{'as':_0x29f0('0x133')});db[_0x29f0('0x16f')][_0x29f0('0x10b')](db[_0x29f0('0x111')],{'as':'List','foreignKey':_0x29f0('0x156')});db['SmsAccount'][_0x29f0('0x10b')](db[_0x29f0('0x140')],{'as':'mandatoryDispositionPause','foreignKey':_0x29f0('0x142')});db[_0x29f0('0x16f')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':'user_has_sms_accounts'});db[_0x29f0('0x172')]['belongsTo'](db[_0x29f0('0xe')],{'onDelete':'restrict'});db[_0x29f0('0x172')][_0x29f0('0x10b')](db[_0x29f0('0x4f')],{'onDelete':'restrict'});db[_0x29f0('0x172')][_0x29f0('0x10b')](db[_0x29f0('0x16f')],{'onDelete':'restrict'});db[_0x29f0('0x172')][_0x29f0('0x10b')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x29f0('0x172')][_0x29f0('0x10b')](db[_0x29f0('0x7a')],{'onDelete':_0x29f0('0x161'),'foreignKey':'TagId'});db['SmsInteraction'][_0x29f0('0xfa')](db['SmsMessage'],{'as':_0x29f0('0x148'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x173')});db[_0x29f0('0x105')][_0x29f0('0x10b')](db[_0x29f0('0x16f')],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x171')});db[_0x29f0('0x105')]['belongsTo'](db[_0x29f0('0x10e')],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db[_0x29f0('0x105')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'as':_0x29f0('0x168'),'foreignKey':'UserId'});db[_0x29f0('0x105')][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':_0x29f0('0x174'),'as':'Tags'});db[_0x29f0('0x105')][_0x29f0('0x10c')](db['Tag'],{'through':_0x29f0('0x174'),'as':'ThroughTags'});db['SmsInteraction'][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':_0x29f0('0x15f'),'through':_0x29f0('0x118'),'foreignKey':_0x29f0('0x173')});db[_0x29f0('0x170')]['belongsTo'](db[_0x29f0('0xe')],{'as':'User'});db['SmsMessage']['belongsTo'](db[_0x29f0('0x10e')],{'onDelete':_0x29f0('0xf8'),'as':_0x29f0('0x14d')});db[_0x29f0('0x170')][_0x29f0('0x10b')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x29f0('0x16b'),'foreignKey':_0x29f0('0x173')});db[_0x29f0('0x170')]['belongsTo'](db[_0x29f0('0x16f')],{'as':_0x29f0('0x15b'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':_0x29f0('0x30'),'foreignKey':_0x29f0('0x175')});db[_0x29f0('0x4f')][_0x29f0('0x10c')](db[_0x29f0('0xd7')],{'through':_0x29f0('0x176'),'as':_0x29f0('0x145')});db[_0x29f0('0x50')]['hasMany'](db[_0x29f0('0x6e')],{'as':_0x29f0('0x152'),'foreignKey':_0x29f0('0x177')});db[_0x29f0('0x50')][_0x29f0('0xfa')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x29f0('0x177')});db[_0x29f0('0x50')][_0x29f0('0xfa')](db[_0x29f0('0x53')],{'as':'Interactions','foreignKey':_0x29f0('0x177')});db[_0x29f0('0x50')][_0x29f0('0xfa')](db['OpenchannelMessage'],{'as':_0x29f0('0x148'),'foreignKey':'OpenchannelAccountId'});db[_0x29f0('0x50')]['hasMany'](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x29f0('0x177')});db['OpenchannelAccount'][_0x29f0('0x10b')](db[_0x29f0('0x111')],{'as':'List','foreignKey':_0x29f0('0x156')});db[_0x29f0('0x50')]['belongsTo'](db['Pause'],{'as':_0x29f0('0x141'),'foreignKey':_0x29f0('0x142')});db[_0x29f0('0x50')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':'Agents','through':_0x29f0('0x12d')});db[_0x29f0('0x52')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'onDelete':_0x29f0('0x161')});db[_0x29f0('0x52')][_0x29f0('0x10b')](db['OpenchannelQueue'],{'onDelete':_0x29f0('0x161'),'foreignKey':_0x29f0('0x178')});db[_0x29f0('0x52')][_0x29f0('0x10b')](db[_0x29f0('0x50')],{'onDelete':_0x29f0('0x161'),'foreignKey':_0x29f0('0x177')});db['OpenchannelApplication'][_0x29f0('0x10b')](db[_0x29f0('0x72')],{'onDelete':_0x29f0('0x161'),'foreignKey':_0x29f0('0x13f')});db[_0x29f0('0x52')][_0x29f0('0x10b')](db[_0x29f0('0x7a')],{'onDelete':_0x29f0('0x161'),'foreignKey':_0x29f0('0x162')});db[_0x29f0('0x53')][_0x29f0('0xfa')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x179')});db[_0x29f0('0x53')][_0x29f0('0x10b')](db[_0x29f0('0x50')],{'as':_0x29f0('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0x29f0('0x53')][_0x29f0('0x10b')](db['CmContact'],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db[_0x29f0('0x53')][_0x29f0('0x10b')](db['User'],{'as':_0x29f0('0x168'),'foreignKey':_0x29f0('0xf9')});db['OpenchannelInteraction'][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':'openchannel_interaction_has_tags','as':_0x29f0('0x15d')});db['OpenchannelInteraction'][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':'openchannel_interaction_has_tags','as':_0x29f0('0x15e')});db[_0x29f0('0x53')]['belongsToMany'](db[_0x29f0('0xe')],{'as':_0x29f0('0x15f'),'through':_0x29f0('0x119'),'foreignKey':'OpenchannelInteractionId'});db[_0x29f0('0x55')][_0x29f0('0x10b')](db['User'],{'onDelete':_0x29f0('0xf8'),'as':_0x29f0('0xe')});db[_0x29f0('0x55')][_0x29f0('0x10b')](db['CmContact'],{'onDelete':_0x29f0('0xf8'),'as':'Contact'});db[_0x29f0('0x55')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x29f0('0x16b'),'foreignKey':_0x29f0('0x179')});db[_0x29f0('0x55')][_0x29f0('0x10b')](db[_0x29f0('0xdb')],{'as':_0x29f0('0xdb'),'foreignKey':_0x29f0('0x16c')});db[_0x29f0('0x55')][_0x29f0('0x10b')](db[_0x29f0('0x50')],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x177')});db['OpenchannelQueue']['belongsToMany'](db[_0x29f0('0xe')],{'as':'Agents','through':_0x29f0('0x31'),'foreignKey':_0x29f0('0x178')});db[_0x29f0('0x57')][_0x29f0('0x10c')](db['Team'],{'through':'team_has_openchannel_queues','as':_0x29f0('0x145')});db[_0x29f0('0x58')][_0x29f0('0xfa')](db['Disposition'],{'as':_0x29f0('0x152'),'foreignKey':_0x29f0('0x17a')});db['ChatWebsite'][_0x29f0('0xfa')](db[_0x29f0('0x6c')],{'as':_0x29f0('0x153'),'foreignKey':_0x29f0('0x17a')});db[_0x29f0('0x58')][_0x29f0('0xfa')](db[_0x29f0('0x5c')],{'as':_0x29f0('0x17b')});db[_0x29f0('0x58')][_0x29f0('0xfa')](db['ChatInteraction'],{'as':_0x29f0('0x154')});db[_0x29f0('0x58')][_0x29f0('0xfa')](db[_0x29f0('0x59')],{'as':_0x29f0('0x133')});db[_0x29f0('0x58')][_0x29f0('0xfa')](db[_0x29f0('0x17c')],{'as':_0x29f0('0x148')});db[_0x29f0('0x58')][_0x29f0('0x10b')](db[_0x29f0('0x111')],{'as':'List','foreignKey':_0x29f0('0x156')});db[_0x29f0('0x58')][_0x29f0('0x10b')](db[_0x29f0('0x72')],{'as':_0x29f0('0x72'),'foreignKey':_0x29f0('0x13f')});db[_0x29f0('0x58')][_0x29f0('0x10b')](db[_0x29f0('0x140')],{'as':_0x29f0('0x141'),'foreignKey':_0x29f0('0x142')});db['ChatWebsite'][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':'Agents','through':_0x29f0('0x128')});db[_0x29f0('0x17d')][_0x29f0('0x10b')](db[_0x29f0('0x50')],{});db['OpenchannelQueueReport'][_0x29f0('0x10b')](db[_0x29f0('0x111')],{'as':_0x29f0('0x155'),'foreignKey':_0x29f0('0x156')});db[_0x29f0('0x17d')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x29f0('0x17d')][_0x29f0('0x10b')](db[_0x29f0('0x55')],{});db[_0x29f0('0x17d')][_0x29f0('0x10b')](db['User'],{});db['OpenchannelQueueReport'][_0x29f0('0x10b')](db[_0x29f0('0x57')],{});db['ChatApplication'][_0x29f0('0x10b')](db['User'],{'as':'Agent','foreignKey':_0x29f0('0xf9'),'onDelete':_0x29f0('0x161')});db['ChatApplication'][_0x29f0('0x10b')](db[_0x29f0('0x11f')],{'as':_0x29f0('0x17e'),'foreignKey':_0x29f0('0x17f'),'onDelete':_0x29f0('0x161')});db['ChatApplication'][_0x29f0('0x10b')](db[_0x29f0('0x58')],{'as':_0x29f0('0x180'),'foreignKey':_0x29f0('0x17a'),'onDelete':_0x29f0('0x161')});db[_0x29f0('0x59')]['belongsTo'](db['Tag'],{'onDelete':_0x29f0('0x161'),'foreignKey':_0x29f0('0x162')});db[_0x29f0('0x103')][_0x29f0('0xfa')](db[_0x29f0('0x17c')],{'as':_0x29f0('0x148'),'onDelete':'cascade','foreignKey':_0x29f0('0x181')});db[_0x29f0('0x103')][_0x29f0('0x10b')](db[_0x29f0('0x58')],{'as':'Account','foreignKey':_0x29f0('0x17a')});db['ChatInteraction'][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'as':'Contact','foreignKey':'ContactId'});db[_0x29f0('0x103')]['belongsTo'](db[_0x29f0('0xe')],{'as':_0x29f0('0x168'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0x103')][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':_0x29f0('0x182'),'as':_0x29f0('0x15d')});db[_0x29f0('0x103')][_0x29f0('0x10c')](db['Tag'],{'through':_0x29f0('0x182'),'as':_0x29f0('0x15e')});db[_0x29f0('0x103')][_0x29f0('0x10c')](db['User'],{'as':'Users','through':_0x29f0('0x117'),'foreignKey':'ChatInteractionId'});db[_0x29f0('0x17c')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'onDelete':_0x29f0('0xf8'),'as':'User'});db[_0x29f0('0x17c')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'onDelete':_0x29f0('0xf8'),'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db[_0x29f0('0x17c')][_0x29f0('0x10b')](db['ChatInteraction'],{'onDelete':_0x29f0('0xf8'),'as':_0x29f0('0x16b'),'foreignKey':_0x29f0('0x181')});db['ChatMessage'][_0x29f0('0x10b')](db['Attachment'],{'as':_0x29f0('0xdb'),'foreignKey':_0x29f0('0x16c')});db[_0x29f0('0x17c')][_0x29f0('0x10b')](db[_0x29f0('0x58')],{'as':_0x29f0('0x15b'),'foreignKey':'ChatWebsiteId'});db[_0x29f0('0x183')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0x29f0('0x183')][_0x29f0('0x10b')](db[_0x29f0('0x58')],{'as':'Account','foreignKey':_0x29f0('0x17a')});db[_0x29f0('0x11f')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x29f0('0x10c')](db[_0x29f0('0xd7')],{'through':_0x29f0('0x184'),'as':_0x29f0('0x145')});db[_0x29f0('0x5b')][_0x29f0('0xfa')](db[_0x29f0('0xbf')],{'as':_0x29f0('0x148'),'foreignKey':_0x29f0('0x185'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x5b')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':'Members','through':'chat_group_has_users'});db['ChatProactiveAction']['belongsTo'](db[_0x29f0('0x58')],{'as':_0x29f0('0x180'),'foreignKey':'ChatWebsiteId'});db[_0x29f0('0x5e')][_0x29f0('0xfa')](db[_0x29f0('0x10e')],{'as':_0x29f0('0x10f'),'foreignKey':_0x29f0('0x186')});db['CmContact'][_0x29f0('0xfa')](db[_0x29f0('0x138')],{'as':_0x29f0('0x187'),'foreignKey':'ContactId'});db['CmContact'][_0x29f0('0xfa')](db[_0x29f0('0x64')],{'as':_0x29f0('0xff'),'foreignKey':'ContactId'});db[_0x29f0('0x10e')]['hasMany'](db[_0x29f0('0x100')],{'as':'HopperHistories','foreignKey':_0x29f0('0x14e')});db['CmContact'][_0x29f0('0xfa')](db[_0x29f0('0x66')],{'as':'ReportAgentPreview','foreignKey':_0x29f0('0x14e')});db[_0x29f0('0x10e')]['hasMany'](db['JscriptySessionReport'],{'as':_0x29f0('0x13a'),'foreignKey':'ContactId'});db['CmContact'][_0x29f0('0xfa')](db[_0x29f0('0x53')],{'as':_0x29f0('0x102'),'foreignKey':'ContactId','onDelete':_0x29f0('0x161')});db[_0x29f0('0x10e')][_0x29f0('0xfa')](db[_0x29f0('0x103')],{'as':_0x29f0('0x104'),'foreignKey':_0x29f0('0x14e'),'onDelete':'restrict'});db['CmContact'][_0x29f0('0xfa')](db[_0x29f0('0x105')],{'as':_0x29f0('0x106'),'foreignKey':_0x29f0('0x14e'),'onDelete':_0x29f0('0x161')});db[_0x29f0('0x10e')][_0x29f0('0xfa')](db['FaxInteraction'],{'as':_0x29f0('0x107'),'foreignKey':_0x29f0('0x14e'),'onDelete':_0x29f0('0x161')});db[_0x29f0('0x10e')]['hasMany'](db[_0x29f0('0x3b')],{'as':'MailInteractions','foreignKey':_0x29f0('0x14e'),'onDelete':_0x29f0('0x161')});db['CmContact'][_0x29f0('0x10b')](db[_0x29f0('0x5e')],{'as':_0x29f0('0x188'),'foreignKey':'CompanyId'});db[_0x29f0('0x10e')][_0x29f0('0x10b')](db['CmList'],{'as':'List','foreignKey':_0x29f0('0x156'),'onDelete':'cascade'});db[_0x29f0('0x10e')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':_0x29f0('0x15f'),'through':_0x29f0('0x110')});db[_0x29f0('0x10e')][_0x29f0('0x10c')](db['Tag'],{'as':_0x29f0('0x15d'),'through':_0x29f0('0x189')});db[_0x29f0('0x10e')]['belongsToMany'](db[_0x29f0('0x7a')],{'through':'cm_contact_has_tags','as':_0x29f0('0x15e')});db[_0x29f0('0x138')]['belongsTo'](db['CmContact'],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x138')][_0x29f0('0x10b')](db[_0x29f0('0x111')],{'as':_0x29f0('0x155'),'foreignKey':_0x29f0('0x156'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x138')]['belongsTo'](db['User'],{'as':_0x29f0('0x18a'),'foreignKey':_0x29f0('0xf9')});db[_0x29f0('0x138')][_0x29f0('0x10b')](db['VoiceQueue'],{'as':_0x29f0('0x17e'),'foreignKey':'VoiceQueueId','onDelete':_0x29f0('0xf8')});db['CmHopper'][_0x29f0('0x10b')](db[_0x29f0('0xd9')],{'as':_0x29f0('0xd9'),'foreignKey':_0x29f0('0x18b'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x138')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'as':'Owner','foreignKey':_0x29f0('0x18c')});db[_0x29f0('0x62')][_0x29f0('0x10b')](db['CmContact'],{'as':_0x29f0('0x14d'),'foreignKey':'ContactId','onDelete':_0x29f0('0xf8')});db[_0x29f0('0x62')][_0x29f0('0x10b')](db[_0x29f0('0x111')],{'as':_0x29f0('0x155'),'foreignKey':_0x29f0('0x156'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x62')][_0x29f0('0x10b')](db[_0x29f0('0x11c')],{'as':_0x29f0('0x17e'),'foreignKey':_0x29f0('0x137'),'onDelete':'cascade'});db[_0x29f0('0x62')]['belongsTo'](db[_0x29f0('0xd9')],{'as':_0x29f0('0xd9'),'foreignKey':_0x29f0('0x18b'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x6a')][_0x29f0('0xfa')](db[_0x29f0('0x70')],{'as':{'plural':_0x29f0('0x18d'),'singular':_0x29f0('0x18e')},'foreignKey':_0x29f0('0x18f'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x29f0('0xfa')](db[_0x29f0('0x70')],{'as':{'plural':_0x29f0('0x190'),'singular':'OneAny'},'foreignKey':_0x29f0('0x191'),'onDelete':'cascade','hooks':!![]});db[_0x29f0('0x6a')]['hasMany'](db[_0x29f0('0x69')],{'as':'Actions','foreignKey':_0x29f0('0x192'),'onDelete':_0x29f0('0xf8'),'hooks':!![]});db[_0x29f0('0x72')][_0x29f0('0xfa')](db['Interval'],{'as':_0x29f0('0x193'),'foreignKey':_0x29f0('0x13f'),'onDelete':_0x29f0('0xf8'),'hooks':!![],'required':![]});db['Interval'][_0x29f0('0xfa')](db[_0x29f0('0x12')],{'as':'Extensions','foreignKey':_0x29f0('0x13f'),'onDelete':_0x29f0('0x161')});db[_0x29f0('0x72')][_0x29f0('0xfa')](db[_0x29f0('0x3e')],{'as':_0x29f0('0x194'),'foreignKey':_0x29f0('0x13f')});db[_0x29f0('0x72')][_0x29f0('0xfa')](db[_0x29f0('0x59')],{'as':_0x29f0('0x195'),'foreignKey':_0x29f0('0x13f')});db[_0x29f0('0x72')][_0x29f0('0xfa')](db[_0x29f0('0x44')],{'as':_0x29f0('0x196'),'foreignKey':_0x29f0('0x13f')});db[_0x29f0('0x72')][_0x29f0('0xfa')](db[_0x29f0('0x172')],{'as':_0x29f0('0x197'),'foreignKey':'IntervalId'});db['Schedule'][_0x29f0('0x10b')](db[_0x29f0('0x37')],{});db[_0x29f0('0x77')][_0x29f0('0x10b')](db[_0x29f0('0x84')],{'foreignKey':_0x29f0('0x198')});db[_0x29f0('0x77')][_0x29f0('0x10b')](db[_0x29f0('0x82')],{'foreignKey':_0x29f0('0x199')});db[_0x29f0('0x134')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x29f0('0x135'),'onDelete':_0x29f0('0x161')});db['Tag'][_0x29f0('0x10c')](db[_0x29f0('0x10e')],{'through':_0x29f0('0x189')});db[_0x29f0('0x7a')][_0x29f0('0x10c')](db[_0x29f0('0x103')],{'through':'chat_interaction_has_tags'});db[_0x29f0('0x7a')]['belongsToMany'](db[_0x29f0('0x3b')],{'through':_0x29f0('0x15c')});db[_0x29f0('0x7a')][_0x29f0('0x10c')](db[_0x29f0('0x105')],{'through':_0x29f0('0x174')});db[_0x29f0('0x7a')]['belongsToMany'](db[_0x29f0('0x45')],{'through':_0x29f0('0x169')});db['Tag']['belongsToMany'](db[_0x29f0('0x53')],{'through':_0x29f0('0x19a')});db[_0x29f0('0x7a')][_0x29f0('0x10c')](db['WhatsappInteraction'],{'through':_0x29f0('0x19b')});db[_0x29f0('0x19c')][_0x29f0('0xfa')](db[_0x29f0('0x70')],{'as':{'plural':_0x29f0('0x19d'),'singular':_0x29f0('0x19e')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x29f0('0x19c')]['hasMany'](db['Condition'],{'as':{'plural':_0x29f0('0x19f'),'singular':'AnyCondition'},'foreignKey':_0x29f0('0x1a0'),'onDelete':_0x29f0('0xf8'),'hooks':!![]});db['Trigger'][_0x29f0('0xfa')](db[_0x29f0('0x69')],{'as':_0x29f0('0x1a1'),'foreignKey':_0x29f0('0x1a2'),'onDelete':_0x29f0('0xf8'),'hooks':!![]});db[_0x29f0('0x82')][_0x29f0('0xfa')](db[_0x29f0('0x89')],{'as':_0x29f0('0x1a3'),'onDelete':'cascade','foreignKey':_0x29f0('0x199'),'hooks':!![]});db[_0x29f0('0x84')][_0x29f0('0xfa')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x29f0('0xf8'),'foreignKey':'DefaultReportId'});db[_0x29f0('0x87')]['hasMany'](db[_0x29f0('0x89')],{'as':_0x29f0('0x1a3'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a4')});db[_0x29f0('0x89')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x29f0('0x1a4')});db['SalesforceAccount']['hasMany'](db[_0x29f0('0x8e')],{'as':_0x29f0('0x1a5'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x29f0('0x8e')][_0x29f0('0xfa')](db['SalesforceField'],{'as':_0x29f0('0x1a6'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0x8e')][_0x29f0('0xfa')](db[_0x29f0('0x8f')],{'as':_0x29f0('0x1a8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x29f0('0x8e')]['hasMany'](db[_0x29f0('0x8f')],{'as':_0x29f0('0x1a3'),'onDelete':_0x29f0('0xf8'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db[_0x29f0('0x8c')],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0x8f')][_0x29f0('0xfa')](db[_0x29f0('0x8f')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x29f0('0x8f')][_0x29f0('0xfa')](db[_0x29f0('0x8f')],{'as':_0x29f0('0x1aa'),'foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0x8f')][_0x29f0('0xfa')](db[_0x29f0('0x8f')],{'as':_0x29f0('0x1ac'),'foreignKey':_0x29f0('0x1ad')});db['SalesforceField'][_0x29f0('0x10b')](db[_0x29f0('0x7d')],{'as':_0x29f0('0x7d'),'foreignKey':_0x29f0('0x1ae')});db[_0x29f0('0x91')][_0x29f0('0xfa')](db[_0x29f0('0x93')],{'as':_0x29f0('0x1a5'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0x93')]['hasMany'](db[_0x29f0('0x95')],{'as':_0x29f0('0x1a6'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0x93')][_0x29f0('0xfa')](db[_0x29f0('0x95')],{'as':_0x29f0('0x1a8'),'onDelete':'cascade','foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0x93')][_0x29f0('0xfa')](db[_0x29f0('0x95')],{'as':_0x29f0('0x1a3'),'onDelete':'cascade','foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0x93')][_0x29f0('0x10b')](db['SugarcrmAccount'],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0x95')][_0x29f0('0xfa')](db[_0x29f0('0x95')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x29f0('0x95')][_0x29f0('0xfa')](db[_0x29f0('0x95')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x29f0('0x95')][_0x29f0('0xfa')](db['SugarcrmField'],{'as':_0x29f0('0x1ac'),'foreignKey':_0x29f0('0x1ad')});db['SugarcrmField']['belongsTo'](db['Variable'],{'as':_0x29f0('0x7d'),'foreignKey':_0x29f0('0x1ae')});db['DeskAccount'][_0x29f0('0xfa')](db[_0x29f0('0x99')],{'as':_0x29f0('0x1a5'),'onDelete':_0x29f0('0xf8'),'foreignKey':'AccountId'});db[_0x29f0('0x99')]['hasMany'](db[_0x29f0('0x9b')],{'as':_0x29f0('0x1a6'),'onDelete':'cascade','foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0x99')]['hasMany'](db[_0x29f0('0x9b')],{'as':_0x29f0('0x1a8'),'onDelete':'cascade','foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0x99')][_0x29f0('0xfa')](db[_0x29f0('0x9b')],{'as':'Fields','onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0x99')][_0x29f0('0x10b')](db[_0x29f0('0x97')],{'as':_0x29f0('0x15b'),'foreignKey':'AccountId'});db[_0x29f0('0x99')][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':_0x29f0('0x1af')});db['DeskField'][_0x29f0('0xfa')](db['DeskField'],{'as':_0x29f0('0x1b0'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0x9b')][_0x29f0('0xfa')](db['DeskField'],{'as':_0x29f0('0x1aa'),'foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0x9b')]['hasMany'](db['DeskField'],{'as':_0x29f0('0x1ac'),'foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0x9b')]['belongsTo'](db[_0x29f0('0x7d')],{'as':_0x29f0('0x7d'),'foreignKey':'VariableId'});db[_0x29f0('0x9d')][_0x29f0('0xfa')](db[_0x29f0('0x9f')],{'as':_0x29f0('0x1a5'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0x9f')][_0x29f0('0xfa')](db[_0x29f0('0xa0')],{'as':_0x29f0('0x1a6'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0x9f')]['hasMany'](db[_0x29f0('0xa0')],{'as':_0x29f0('0x1a8'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0x9f')][_0x29f0('0xfa')](db[_0x29f0('0xa0')],{'as':_0x29f0('0x1a3'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0x9f')][_0x29f0('0x10b')](db[_0x29f0('0x9d')],{'as':'Account','foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0xa0')][_0x29f0('0xfa')](db[_0x29f0('0xa0')],{'as':_0x29f0('0x1b0'),'foreignKey':_0x29f0('0x1a7')});db['ZohoField'][_0x29f0('0xfa')](db[_0x29f0('0xa0')],{'as':_0x29f0('0x1aa'),'foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0xa0')][_0x29f0('0xfa')](db[_0x29f0('0xa0')],{'as':'Field','foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0xa0')][_0x29f0('0x10b')](db['Variable'],{'as':_0x29f0('0x7d'),'foreignKey':_0x29f0('0x1ae')});db[_0x29f0('0xa2')][_0x29f0('0xfa')](db[_0x29f0('0xa4')],{'as':_0x29f0('0x1a5'),'onDelete':'cascade','foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0xa4')][_0x29f0('0xfa')](db[_0x29f0('0xa6')],{'as':_0x29f0('0x1a6'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0xa4')][_0x29f0('0xfa')](db['ZendeskField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x29f0('0xfa')](db[_0x29f0('0xa6')],{'as':_0x29f0('0x1a3'),'foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0xa4')][_0x29f0('0x10b')](db[_0x29f0('0xa2')],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0xa4')][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':_0x29f0('0x1b1')});db['ZendeskField'][_0x29f0('0xfa')](db[_0x29f0('0xa6')],{'as':_0x29f0('0x1b0'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0xa6')][_0x29f0('0xfa')](db[_0x29f0('0xa6')],{'as':_0x29f0('0x1aa'),'foreignKey':'DescriptionId'});db[_0x29f0('0xa6')][_0x29f0('0xfa')](db['ZendeskField'],{'as':'Field','foreignKey':'FieldId'});db['ZendeskField']['belongsTo'](db[_0x29f0('0x7d')],{'as':_0x29f0('0x7d'),'foreignKey':_0x29f0('0x1ae')});db[_0x29f0('0xa8')][_0x29f0('0xfa')](db[_0x29f0('0x1b2')],{'as':_0x29f0('0x1a5'),'onDelete':'cascade','foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0x1b2')][_0x29f0('0xfa')](db['FreshdeskField'],{'as':_0x29f0('0x1a6'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0x1b2')][_0x29f0('0xfa')](db['FreshdeskField'],{'as':_0x29f0('0x1a8'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0x1b2')][_0x29f0('0xfa')](db[_0x29f0('0x1b3')],{'as':_0x29f0('0x1a3'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1ad')});db['FreshdeskConfiguration'][_0x29f0('0x10b')](db['FreshdeskAccount'],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x1a9')});db['FreshdeskConfiguration'][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':_0x29f0('0x1b4')});db[_0x29f0('0x1b3')][_0x29f0('0xfa')](db[_0x29f0('0x1b3')],{'as':_0x29f0('0x1b0'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0x1b3')][_0x29f0('0xfa')](db[_0x29f0('0x1b3')],{'as':_0x29f0('0x1aa'),'foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0x1b3')]['hasMany'](db[_0x29f0('0x1b3')],{'as':_0x29f0('0x1ac'),'foreignKey':_0x29f0('0x1ad')});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0x29f0('0x7d'),'foreignKey':'VariableId'});db[_0x29f0('0xab')][_0x29f0('0xfa')](db[_0x29f0('0xad')],{'as':_0x29f0('0x1a5'),'onDelete':'cascade','foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0xad')][_0x29f0('0xfa')](db[_0x29f0('0xaf')],{'as':_0x29f0('0x1a6'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0xad')][_0x29f0('0xfa')](db[_0x29f0('0xaf')],{'as':'Descriptions','foreignKey':_0x29f0('0x1ab')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0x29f0('0x1a3'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0x29f0('0x10b')](db[_0x29f0('0xab')],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0xaf')]['hasMany'](db[_0x29f0('0xaf')],{'as':_0x29f0('0x1b0'),'foreignKey':'SubjectId'});db[_0x29f0('0xaf')][_0x29f0('0xfa')](db[_0x29f0('0xaf')],{'as':_0x29f0('0x1aa'),'foreignKey':'DescriptionId'});db[_0x29f0('0xaf')][_0x29f0('0xfa')](db[_0x29f0('0xaf')],{'as':'Field','foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0xaf')][_0x29f0('0x10b')](db[_0x29f0('0x7d')],{'as':'Variable','foreignKey':'VariableId'});db['ServicenowAccount'][_0x29f0('0xfa')](db[_0x29f0('0xb2')],{'as':'Configurations','onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a9')});db['ServicenowConfiguration']['hasMany'](db[_0x29f0('0xb3')],{'as':_0x29f0('0x1a6'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0xb2')][_0x29f0('0xfa')](db[_0x29f0('0xb3')],{'as':'Descriptions','foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0xb2')][_0x29f0('0xfa')](db[_0x29f0('0xb3')],{'as':_0x29f0('0x1a3'),'foreignKey':'FieldId'});db[_0x29f0('0xb2')][_0x29f0('0x10b')](db[_0x29f0('0x1b5')],{'as':'Account','foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0xb3')]['hasMany'](db['ServicenowField'],{'as':_0x29f0('0x1b0'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0xb3')][_0x29f0('0xfa')](db[_0x29f0('0xb3')],{'as':_0x29f0('0x1aa'),'foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0xb3')][_0x29f0('0xfa')](db[_0x29f0('0xb3')],{'as':_0x29f0('0x1ac'),'foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0xb3')][_0x29f0('0x10b')](db[_0x29f0('0x7d')],{'as':_0x29f0('0x7d'),'foreignKey':_0x29f0('0x1ae')});db[_0x29f0('0x1b6')]['hasMany'](db[_0x29f0('0x1b7')],{'as':_0x29f0('0x1a5'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0x1b7')]['hasMany'](db[_0x29f0('0xb7')],{'as':_0x29f0('0x1a6'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0x1b7')][_0x29f0('0xfa')](db['Dynamics365Field'],{'as':_0x29f0('0x1a8'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0x1b7')][_0x29f0('0xfa')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x29f0('0xf8'),'foreignKey':'FieldId'});db[_0x29f0('0x1b7')][_0x29f0('0x10b')](db['Dynamics365Account'],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0xb7')][_0x29f0('0xfa')](db[_0x29f0('0xb7')],{'as':_0x29f0('0x1b0'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0xb7')][_0x29f0('0xfa')](db[_0x29f0('0xb7')],{'as':_0x29f0('0x1aa'),'foreignKey':'DescriptionId'});db[_0x29f0('0xb7')][_0x29f0('0xfa')](db['Dynamics365Field'],{'as':_0x29f0('0x1ac'),'foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0xb7')][_0x29f0('0x10b')](db[_0x29f0('0x7d')],{'as':_0x29f0('0x7d'),'foreignKey':_0x29f0('0x1ae')});db[_0x29f0('0xb9')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x29f0('0x1a5'),'onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x1a9')});db[_0x29f0('0xbb')][_0x29f0('0xfa')](db[_0x29f0('0x1b8')],{'as':_0x29f0('0x1a6'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0xbb')][_0x29f0('0xfa')](db['FreshsalesField'],{'as':_0x29f0('0x1a8'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0x29f0('0x1b8')],{'as':'Fields','foreignKey':'FieldId'});db[_0x29f0('0xbb')][_0x29f0('0x10b')](db['FreshsalesAccount'],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x1a9')});db['FreshsalesField'][_0x29f0('0xfa')](db[_0x29f0('0x1b8')],{'as':_0x29f0('0x1b0'),'foreignKey':_0x29f0('0x1a7')});db[_0x29f0('0x1b8')][_0x29f0('0xfa')](db['FreshsalesField'],{'as':_0x29f0('0x1aa'),'foreignKey':_0x29f0('0x1ab')});db[_0x29f0('0x1b8')][_0x29f0('0xfa')](db[_0x29f0('0x1b8')],{'as':_0x29f0('0x1ac'),'foreignKey':_0x29f0('0x1ad')});db[_0x29f0('0x1b8')]['belongsTo'](db[_0x29f0('0x7d')],{'as':_0x29f0('0x7d'),'foreignKey':_0x29f0('0x1ae')});db[_0x29f0('0x1b9')][_0x29f0('0x10b')](db[_0x29f0('0x58')],{});db['ChatQueueReport']['belongsTo'](db[_0x29f0('0x111')],{'as':'List','foreignKey':_0x29f0('0x156')});db[_0x29f0('0x1b9')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'as':'Contact','foreignKey':'ContactId'});db[_0x29f0('0x1b9')]['belongsTo'](db[_0x29f0('0x103')],{});db[_0x29f0('0x1b9')][_0x29f0('0x10b')](db[_0x29f0('0x17c')],{});db[_0x29f0('0x1b9')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{});db['ChatQueueReport']['belongsTo'](db[_0x29f0('0x11f')],{});db[_0x29f0('0xbf')]['belongsTo'](db[_0x29f0('0xe')],{'onDelete':_0x29f0('0xf8'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'onDelete':'cascade','foreignKey':_0x29f0('0x1ba')});db['JscriptySessionReport']['hasMany'](db[_0x29f0('0x1bb')],{'foreignKey':_0x29f0('0x1bc'),'onDelete':_0x29f0('0xf8')});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x29f0('0xc6')][_0x29f0('0x10b')](db[_0x29f0('0x16f')],{});db['SmsQueueReport']['belongsTo'](db[_0x29f0('0x111')],{'as':_0x29f0('0x155'),'foreignKey':_0x29f0('0x156')});db[_0x29f0('0xc6')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'as':'Contact','foreignKey':_0x29f0('0x14e')});db[_0x29f0('0xc6')][_0x29f0('0x10b')](db['SmsInteraction'],{});db[_0x29f0('0xc6')][_0x29f0('0x10b')](db[_0x29f0('0x170')],{});db[_0x29f0('0xc6')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{});db[_0x29f0('0xc6')][_0x29f0('0x10b')](db[_0x29f0('0x4f')],{});db[_0x29f0('0xcb')]['hasMany'](db[_0x29f0('0xc4')],{'foreignKey':_0x29f0('0x1bd')});db['JscriptyProject'][_0x29f0('0xfa')](db[_0x29f0('0x1bb')],{'foreignKey':_0x29f0('0x1bd')});db[_0x29f0('0xcb')][_0x29f0('0xfa')](db[_0x29f0('0xc1')],{'foreignKey':_0x29f0('0x1bd')});db[_0x29f0('0xd1')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':_0x29f0('0x15f'),'through':_0x29f0('0x131')});db[_0x29f0('0xd7')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':_0x29f0('0x114')});db[_0x29f0('0xd7')][_0x29f0('0x10c')](db['VoiceQueue'],{'through':_0x29f0('0x1be'),'as':_0x29f0('0x11d')});db['Team']['belongsToMany'](db[_0x29f0('0x38')],{'through':'team_has_mail_queues','as':_0x29f0('0x11e')});db[_0x29f0('0xd7')][_0x29f0('0x10c')](db['ChatQueue'],{'through':_0x29f0('0x184'),'as':_0x29f0('0x120')});db[_0x29f0('0xd7')][_0x29f0('0x10c')](db['FaxQueue'],{'through':_0x29f0('0x16e'),'as':'FaxQueues'});db['Team'][_0x29f0('0x10c')](db[_0x29f0('0x4f')],{'through':_0x29f0('0x176'),'as':_0x29f0('0x122')});db[_0x29f0('0xd7')]['belongsToMany'](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x29f0('0xd7')][_0x29f0('0x10c')](db[_0x29f0('0x124')],{'through':_0x29f0('0x1bf'),'as':_0x29f0('0x1c0')});db['Campaign'][_0x29f0('0xfa')](db['CmHopper'],{'as':_0x29f0('0x187'),'foreignKey':_0x29f0('0x18b')});db[_0x29f0('0xd9')][_0x29f0('0xfa')](db[_0x29f0('0x64')],{'as':_0x29f0('0xff'),'foreignKey':_0x29f0('0x18b')});db[_0x29f0('0xd9')][_0x29f0('0xfa')](db[_0x29f0('0x100')],{'as':_0x29f0('0x139'),'foreignKey':_0x29f0('0x18b')});db[_0x29f0('0xd9')]['hasMany'](db['CmHopperBlack'],{'as':_0x29f0('0x1c1'),'foreignKey':'CampaignId'});db[_0x29f0('0xd9')]['belongsTo'](db[_0x29f0('0x13b')],{'as':'Trunk','foreignKey':_0x29f0('0x13c')});db[_0x29f0('0xd9')][_0x29f0('0x10b')](db[_0x29f0('0x13b')],{'as':_0x29f0('0x13d'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x29f0('0x10b')](db[_0x29f0('0x72')],{'as':_0x29f0('0x72'),'foreignKey':_0x29f0('0x13f')});db['Campaign'][_0x29f0('0x10b')](db[_0x29f0('0xd1')],{'as':_0x29f0('0xd1'),'foreignKey':'SquareProjectId'});db[_0x29f0('0xd9')][_0x29f0('0x10c')](db[_0x29f0('0x111')],{'as':'Lists','through':_0x29f0('0x1c2')});db[_0x29f0('0xd9')][_0x29f0('0x10c')](db['CmList'],{'as':_0x29f0('0x146'),'through':_0x29f0('0x1c3')});db[_0x29f0('0xde')][_0x29f0('0x10b')](db[_0x29f0('0x3d')],{});db['MailTransferReport'][_0x29f0('0x10b')](db['MailInteraction'],{});db[_0x29f0('0xde')][_0x29f0('0x10b')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0x29f0('0x1c4')});db[_0x29f0('0xde')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'foreignKey':_0x29f0('0x1c5'),'as':'FromAgent'});db['MailTransferReport']['belongsTo'](db[_0x29f0('0xe')],{'foreignKey':'ToUserId','as':_0x29f0('0x1c6')});db['MailTransferReport']['belongsTo'](db[_0x29f0('0x38')],{'foreignKey':_0x29f0('0x1c7'),'as':_0x29f0('0x1c8')});db['MailTransferReport']['belongsTo'](db[_0x29f0('0x37')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db['ChatTransferReport']['belongsTo'](db['ChatMessage'],{});db[_0x29f0('0xe0')][_0x29f0('0x10b')](db[_0x29f0('0x103')],{});db['ChatTransferReport'][_0x29f0('0x10b')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x29f0('0x1c4')});db['ChatTransferReport'][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'foreignKey':_0x29f0('0x1c5'),'as':_0x29f0('0x1c9')});db[_0x29f0('0xe0')]['belongsTo'](db[_0x29f0('0xe')],{'foreignKey':_0x29f0('0x1ca'),'as':_0x29f0('0x1c6')});db[_0x29f0('0xe0')][_0x29f0('0x10b')](db[_0x29f0('0x11f')],{'foreignKey':_0x29f0('0x1cb'),'as':_0x29f0('0x1c8')});db[_0x29f0('0xe0')][_0x29f0('0x10b')](db[_0x29f0('0x58')],{'foreignKey':'ToChatWebsiteId','as':_0x29f0('0x1cc')});db['FaxTransferReport'][_0x29f0('0x10b')](db[_0x29f0('0x47')],{});db[_0x29f0('0xe2')]['belongsTo'](db[_0x29f0('0x45')],{});db[_0x29f0('0xe2')][_0x29f0('0x10b')](db[_0x29f0('0x43')],{'foreignKey':_0x29f0('0x1cd'),'as':_0x29f0('0x1c4')});db[_0x29f0('0xe2')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'foreignKey':_0x29f0('0x1c5'),'as':_0x29f0('0x1c9')});db[_0x29f0('0xe2')]['belongsTo'](db[_0x29f0('0xe')],{'foreignKey':_0x29f0('0x1ca'),'as':_0x29f0('0x1c6')});db['FaxTransferReport'][_0x29f0('0x10b')](db[_0x29f0('0x49')],{'foreignKey':'ToFaxQueueId','as':_0x29f0('0x1c8')});db[_0x29f0('0xe2')]['belongsTo'](db[_0x29f0('0x43')],{'foreignKey':_0x29f0('0x1ce'),'as':_0x29f0('0x1cc')});db[_0x29f0('0xe3')][_0x29f0('0x10b')](db[_0x29f0('0x55')],{});db[_0x29f0('0xe3')][_0x29f0('0x10b')](db[_0x29f0('0x53')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x29f0('0x1cf'),'as':_0x29f0('0x1c4')});db[_0x29f0('0xe3')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'foreignKey':_0x29f0('0x1c5'),'as':_0x29f0('0x1c9')});db[_0x29f0('0xe3')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport'][_0x29f0('0x10b')](db['OpenchannelQueue'],{'foreignKey':_0x29f0('0x1d0'),'as':_0x29f0('0x1c8')});db[_0x29f0('0xe3')]['belongsTo'](db[_0x29f0('0x50')],{'foreignKey':_0x29f0('0x1d1'),'as':'ToAccount'});db[_0x29f0('0xe4')]['belongsTo'](db[_0x29f0('0x170')],{});db[_0x29f0('0xe4')][_0x29f0('0x10b')](db[_0x29f0('0x105')],{});db[_0x29f0('0xe4')][_0x29f0('0x10b')](db[_0x29f0('0x16f')],{'foreignKey':_0x29f0('0x1d2'),'as':'FromAccount'});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x29f0('0x1c5'),'as':_0x29f0('0x1c9')});db[_0x29f0('0xe4')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'foreignKey':'ToUserId','as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db[_0x29f0('0x4f')],{'foreignKey':_0x29f0('0x1d3'),'as':_0x29f0('0x1c8')});db['SmsTransferReport'][_0x29f0('0x10b')](db[_0x29f0('0x16f')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x29f0('0x111')][_0x29f0('0xfa')](db['Disposition'],{'as':_0x29f0('0x152'),'foreignKey':_0x29f0('0x156')});db[_0x29f0('0x111')]['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x29f0('0x156')});db[_0x29f0('0x111')][_0x29f0('0xfa')](db['CmContact'],{'as':'Contacts','onDelete':_0x29f0('0xf8'),'foreignKey':_0x29f0('0x156')});db[_0x29f0('0x111')][_0x29f0('0xfa')](db[_0x29f0('0x64')],{'as':_0x29f0('0xff'),'foreignKey':_0x29f0('0x156')});db['CmList'][_0x29f0('0xfa')](db['CmHopperHistory'],{'as':_0x29f0('0x101'),'foreignKey':_0x29f0('0x156')});db['CmList'][_0x29f0('0xfa')](db[_0x29f0('0x66')],{'as':_0x29f0('0x66'),'foreignKey':_0x29f0('0x156')});db[_0x29f0('0x111')][_0x29f0('0x10c')](db[_0x29f0('0x11c')],{'as':'Queues','through':_0x29f0('0x143')});db[_0x29f0('0x111')][_0x29f0('0x10c')](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':_0x29f0('0x113')});db[_0x29f0('0xe7')][_0x29f0('0xfa')](db[_0x29f0('0x12')],{'as':_0x29f0('0x1d4'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0xe7')][_0x29f0('0x10c')](db['User'],{'as':_0x29f0('0x144'),'through':_0x29f0('0x126')});db[_0x29f0('0xe9')][_0x29f0('0xfa')](db[_0x29f0('0xe')],{'as':_0x29f0('0x15f'),'foreignKey':_0x29f0('0x1d5')});db[_0x29f0('0xe9')][_0x29f0('0xfa')](db[_0x29f0('0x1d6')],{'as':_0x29f0('0x1d7'),'foreignKey':_0x29f0('0x1d5'),'onDelete':_0x29f0('0xf8')});db[_0x29f0('0x1d6')][_0x29f0('0xfa')](db[_0x29f0('0x1d8')],{'as':_0x29f0('0x1d9'),'foreignKey':_0x29f0('0x1da'),'onDelete':'cascade'});db[_0x29f0('0x1db')][_0x29f0('0xfa')](db[_0x29f0('0x6e')],{'as':_0x29f0('0x152'),'foreignKey':'WhatsappAccountId'});db[_0x29f0('0x1db')][_0x29f0('0xfa')](db[_0x29f0('0x6c')],{'as':_0x29f0('0x153'),'foreignKey':_0x29f0('0x1dc')});db[_0x29f0('0x1db')][_0x29f0('0xfa')](db[_0x29f0('0xf2')],{'as':_0x29f0('0x148'),'foreignKey':_0x29f0('0x1dc')});db[_0x29f0('0x1db')][_0x29f0('0xfa')](db[_0x29f0('0xf1')],{'as':_0x29f0('0x154')});db[_0x29f0('0x1db')][_0x29f0('0xfa')](db[_0x29f0('0xef')],{'as':'Applications'});db['WhatsappAccount'][_0x29f0('0x10b')](db[_0x29f0('0x111')],{'as':'List','foreignKey':_0x29f0('0x156')});db[_0x29f0('0x1db')][_0x29f0('0x10b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x29f0('0x142')});db[_0x29f0('0x1db')]['belongsToMany'](db['User'],{'as':_0x29f0('0x144'),'through':_0x29f0('0x1dd')});db[_0x29f0('0xef')]['belongsTo'](db[_0x29f0('0xe')],{'onDelete':_0x29f0('0x161')});db['WhatsappApplication'][_0x29f0('0x10b')](db[_0x29f0('0x124')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x29f0('0x1db')],{'onDelete':_0x29f0('0x161')});db['WhatsappApplication'][_0x29f0('0x10b')](db[_0x29f0('0x72')],{'onDelete':'restrict','foreignKey':_0x29f0('0x13f')});db[_0x29f0('0xef')]['belongsTo'](db[_0x29f0('0x7a')],{'onDelete':_0x29f0('0x161'),'foreignKey':_0x29f0('0x162')});db[_0x29f0('0xf1')][_0x29f0('0xfa')](db[_0x29f0('0xf2')],{'as':'Messages','onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0x29f0('0xf1')]['belongsTo'](db[_0x29f0('0x1db')],{'as':_0x29f0('0x15b'),'foreignKey':_0x29f0('0x1dc')});db[_0x29f0('0xf1')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db[_0x29f0('0xf1')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'as':'Owner','foreignKey':'UserId'});db['WhatsappInteraction'][_0x29f0('0x10c')](db[_0x29f0('0x7a')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db['WhatsappInteraction']['belongsToMany'](db[_0x29f0('0x7a')],{'through':_0x29f0('0x19b'),'as':_0x29f0('0x15e')});db['WhatsappInteraction']['belongsToMany'](db[_0x29f0('0xe')],{'as':_0x29f0('0x15f'),'through':'user_has_whatsapp_interactions','foreignKey':_0x29f0('0x1de')});db[_0x29f0('0xf2')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'as':_0x29f0('0xe')});db[_0x29f0('0xf2')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'onDelete':_0x29f0('0xf8'),'as':_0x29f0('0x14d')});db['WhatsappMessage'][_0x29f0('0x10b')](db[_0x29f0('0xf1')],{'onDelete':_0x29f0('0xf8'),'as':'Interaction','foreignKey':_0x29f0('0x1de')});db[_0x29f0('0xf2')][_0x29f0('0x10b')](db[_0x29f0('0x1db')],{'as':_0x29f0('0x15b'),'foreignKey':'WhatsappAccountId'});db[_0x29f0('0x1df')][_0x29f0('0x10b')](db[_0x29f0('0x1db')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x29f0('0x111')],{'as':_0x29f0('0x155'),'foreignKey':_0x29f0('0x156')});db[_0x29f0('0x1df')][_0x29f0('0x10b')](db[_0x29f0('0x10e')],{'as':_0x29f0('0x14d'),'foreignKey':_0x29f0('0x14e')});db[_0x29f0('0x1df')][_0x29f0('0x10b')](db['WhatsappInteraction'],{});db[_0x29f0('0x1df')][_0x29f0('0x10b')](db[_0x29f0('0x124')],{});db[_0x29f0('0x1df')][_0x29f0('0x10b')](db[_0x29f0('0xf2')],{});db['WhatsappQueueReport'][_0x29f0('0x10b')](db[_0x29f0('0xe')],{});db['WhatsappTransferReport'][_0x29f0('0x10b')](db[_0x29f0('0xf2')],{});db[_0x29f0('0xf4')][_0x29f0('0x10b')](db[_0x29f0('0xf1')],{});db[_0x29f0('0xf4')][_0x29f0('0x10b')](db[_0x29f0('0x1db')],{'foreignKey':_0x29f0('0x1e0'),'as':'FromAccount'});db[_0x29f0('0xf4')][_0x29f0('0x10b')](db[_0x29f0('0x1db')],{'foreignKey':_0x29f0('0x1e1'),'as':_0x29f0('0x1cc')});db[_0x29f0('0xf4')][_0x29f0('0x10b')](db[_0x29f0('0x124')],{'foreignKey':'ToQueueId','as':_0x29f0('0x1c8')});db[_0x29f0('0xf4')]['belongsTo'](db['User'],{'foreignKey':_0x29f0('0x1c5'),'as':_0x29f0('0x1c9')});db[_0x29f0('0xf4')][_0x29f0('0x10b')](db[_0x29f0('0xe')],{'foreignKey':'ToUserId','as':_0x29f0('0x1c6')});db[_0x29f0('0x124')]['belongsToMany'](db[_0x29f0('0xe')],{'as':_0x29f0('0x144'),'through':_0x29f0('0x33'),'foreignKey':'WhatsappQueueId'});db[_0x29f0('0x124')][_0x29f0('0x10c')](db[_0x29f0('0xd7')],{'through':'team_has_whatsapp_queues','as':_0x29f0('0x145')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x9fc5=['SmsAccounts','user_has_sms_accounts','WhatsappAccount','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','VoiceQueue','Members','CmHopper','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Interactions','MailApplication','List','Template','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Interaction','restrict','ListId','FaxAccountId','Answers','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','Agent','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatInternalMessage','ChatGroupId','ChatProactiveAction','CompanyId','cm_contact_has_tags','Queue','Campaign','OwnerId','CampaignId','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','VoiceMusicOnHold','Mohs','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','AnalyticFieldReport','MetricId','SalesforceAccount','SalesforceConfiguration','AccountId','Subjects','Descriptions','DescriptionId','Subject','SubjectId','Description','Field','VariableId','SugarcrmConfiguration','FieldId','Configurations','DeskField','int_desk_configuration_has_tags','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','FreshsalesConfiguration','FreshsalesField','FromId','SessionId','JscriptyProject','ProjectId','MailQueues','team_has_fax_queues','team_has_whatsapp_queues','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','FromAgent','ToUserId','ToChatQueueId','FaxTransferReport','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','utf8','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','FaxInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','FaxInteraction','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fc5,0xb6));var _0x59fc=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x9fc5[_0x2cc8bb];return _0x140e40;};'use strict';var path=require('path');var config=require(_0x59fc('0x0'));var Sequelize=require(_0x59fc('0x1'));var _=require('lodash');var jstz=require(_0x59fc('0x2'));var timezone=jstz[_0x59fc('0x3')]();config[_0x59fc('0x1')]=_[_0x59fc('0x4')](config[_0x59fc('0x1')],{'database':_0x59fc('0x5'),'username':_0x59fc('0x6'),'password':_0x59fc('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x59fc('0x8'),'dialectOptions':{'charset':_0x59fc('0x9')},'logging':![],'timezone':timezone[_0x59fc('0xa')](),'define':{'charset':'utf8','collate':_0x59fc('0xb')}}});config[_0x59fc('0xc')]=_[_0x59fc('0x4')](config[_0x59fc('0xc')],{'database':_0x59fc('0x5'),'username':_0x59fc('0x6'),'password':_0x59fc('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x59fc('0x8'),'dialectOptions':{'charset':_0x59fc('0x9')},'logging':![],'timezone':timezone[_0x59fc('0xa')](),'define':{'charset':_0x59fc('0xd'),'collate':_0x59fc('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x59fc('0x1')][_0x59fc('0xe')],config['sequelize'][_0x59fc('0xf')],config[_0x59fc('0x1')][_0x59fc('0x10')],config[_0x59fc('0x1')][_0x59fc('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x59fc('0xc')][_0x59fc('0xe')],config[_0x59fc('0xc')][_0x59fc('0xf')],config[_0x59fc('0xc')][_0x59fc('0x10')],config['sequelizeHistory'][_0x59fc('0x11')])};db[_0x59fc('0x12')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x14'));db[_0x59fc('0x15')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x59fc('0x16')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x17'));db[_0x59fc('0x18')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x19'));db['VoiceMusicOnHold']=db[_0x59fc('0x1')]['import'](_0x59fc('0x1a'));db['VoiceQueue']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x1b'));db[_0x59fc('0x1c')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x59fc('0x1d')]=db[_0x59fc('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0x59fc('0x1e')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x1f'));db[_0x59fc('0x20')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x21'));db[_0x59fc('0x22')]=db['sequelize'][_0x59fc('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x59fc('0x23')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x24'));db['VoiceAgentReport']=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x59fc('0x25')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x26'));db[_0x59fc('0x27')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x28'));db[_0x59fc('0x29')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x2a'));db[_0x59fc('0x2b')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x2c'));db[_0x59fc('0x2d')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x2e'));db[_0x59fc('0x2f')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x30'));db['UserChatQueue']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x31'));db['UserMailQueue']=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x32'));db[_0x59fc('0x33')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x34'));db[_0x59fc('0x35')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x36'));db[_0x59fc('0x37')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x38'));db[_0x59fc('0x39')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x59fc('0x3a')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize']['import'](_0x59fc('0x3b'));db[_0x59fc('0x3c')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x3d'));db[_0x59fc('0x3e')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x3f'));db['MailSubstatus']=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x40'));db[_0x59fc('0x41')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x42'));db[_0x59fc('0x43')]=db['sequelize']['import'](_0x59fc('0x44'));db['MailApplication']=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x45'));db[_0x59fc('0x46')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x47'));db[_0x59fc('0x48')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x49'));db[_0x59fc('0x4a')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x4b'));db['FaxAccount']=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/faxAccount/faxAccount.model');db[_0x59fc('0x4c')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x4d'));db['FaxInteraction']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x4e'));db[_0x59fc('0x4f')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x50'));db[_0x59fc('0x51')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x52'));db[_0x59fc('0x53')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x54'));db[_0x59fc('0x55')]=db['sequelize'][_0x59fc('0x13')]('../api/smsAccount/smsAccount.model');db[_0x59fc('0x56')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x57'));db[_0x59fc('0x58')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x59'));db[_0x59fc('0x5a')]=db['sequelize'][_0x59fc('0x13')]('../api/smsMessage/smsMessage.model');db[_0x59fc('0x5b')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x5c'));db[_0x59fc('0x5d')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x5e'));db[_0x59fc('0x5f')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x60'));db['OpenchannelInteraction']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x61'));db[_0x59fc('0x62')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x63'));db['OpenchannelQueue']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x64'));db[_0x59fc('0x65')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x66'));db[_0x59fc('0x67')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x68'));db[_0x59fc('0x69')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/chatApplication/chatApplication.model');db[_0x59fc('0x6a')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x6b'));db[_0x59fc('0x6c')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x6d'));db[_0x59fc('0x6e')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x59fc('0x6f')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x70'));db['ChatGroup']=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x71'));db['ChatProactiveAction']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x72'));db[_0x59fc('0x73')]=db['sequelize'][_0x59fc('0x13')]('../api/cmCompany/cmCompany.model');db[_0x59fc('0x74')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x75'));db['CmHopper']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x76'));db[_0x59fc('0x77')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x78'));db[_0x59fc('0x79')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x7a'));db[_0x59fc('0x7b')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x7c'));db[_0x59fc('0x7d')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x7e'));db[_0x59fc('0x7f')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x59fc('0x80')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x81'));db[_0x59fc('0x82')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x83'));db[_0x59fc('0x84')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x85'));db[_0x59fc('0x86')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x87'));db[_0x59fc('0x88')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x89'));db[_0x59fc('0x8a')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x8b'));db[_0x59fc('0x8c')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x8d'));db['Cdr']=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/cdr/cdr.model');db[_0x59fc('0x8e')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x8f'));db[_0x59fc('0x90')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x91'));db[_0x59fc('0x92')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x93'));db[_0x59fc('0x94')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x95'));db['Template']=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/template/template.model');db[_0x59fc('0x96')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x97'));db[_0x59fc('0x98')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x99'));db[_0x59fc('0x9a')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x9b'));db['IntegrationReport']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x9c'));db['AnalyticCustomReport']=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x59fc('0x9d')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x9e'));db[_0x59fc('0x9f')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xa0'));db[_0x59fc('0xa1')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xa2'));db['AnalyticFieldReport']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xa3'));db[_0x59fc('0xa4')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xa5'));db['SalesforceAccount']=db['sequelize']['import'](_0x59fc('0xa6'));db['SalesforceConfiguration']=db[_0x59fc('0x1')]['import'](_0x59fc('0xa7'));db[_0x59fc('0xa8')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xa9'));db[_0x59fc('0xaa')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xab'));db['SugarcrmConfiguration']=db['sequelize']['import'](_0x59fc('0xac'));db[_0x59fc('0xad')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xae'));db[_0x59fc('0xaf')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xb0'));db[_0x59fc('0xb1')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xb2'));db['DeskField']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xb3'));db[_0x59fc('0xb4')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xb5'));db[_0x59fc('0xb6')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xb7'));db[_0x59fc('0xb8')]=db[_0x59fc('0x1')]['import'](_0x59fc('0xb9'));db[_0x59fc('0xba')]=db[_0x59fc('0x1')]['import'](_0x59fc('0xbb'));db['ZendeskField']=db['sequelize']['import'](_0x59fc('0xbc'));db[_0x59fc('0xbd')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x59fc('0xbe')]=db[_0x59fc('0x1')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x59fc('0xbf')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db['sequelize'][_0x59fc('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x59fc('0xc0')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xc1'));db[_0x59fc('0xc2')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xc3'));db[_0x59fc('0xc4')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xc5'));db[_0x59fc('0xc6')]=db[_0x59fc('0x1')]['import'](_0x59fc('0xc7'));db['ServicenowField']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xc8'));db[_0x59fc('0xc9')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xca'));db[_0x59fc('0xcb')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xcc'));db[_0x59fc('0xcd')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x59fc('0xce')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xcf'));db['FreshsalesConfiguration']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xd0'));db['FreshsalesField']=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xd1'));db['Integration']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x9b'));db[_0x59fc('0xd2')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xd3'));db[_0x59fc('0xd4')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xd5'));db['ChatInternalMessage']=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x59fc('0xd6')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xd7'));db[_0x59fc('0xd8')]=db[_0x59fc('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x59fc('0xd9')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xda'));db[_0x59fc('0xdb')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xdc'));db[_0x59fc('0xdd')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xde'));db[_0x59fc('0xdf')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xe0'));db['JscriptyProject']=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xe1'));db[_0x59fc('0xe2')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xe3'));db[_0x59fc('0xe4')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xe5'));db[_0x59fc('0xe6')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xe7'));db[_0x59fc('0xe8')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xe9'));db['Team']=db['sequelize']['import'](_0x59fc('0xea'));db[_0x59fc('0xeb')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/license/license.model');db['Campaign']=db['sequelize']['import'](_0x59fc('0xec'));db[_0x59fc('0xed')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xee'));db['Attachment']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xef'));db['Plugin']=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xf0'));db[_0x59fc('0xf1')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xf2'));db[_0x59fc('0xf3')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xf4'));db['FaxTransferReport']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xf5'));db['OpenchannelTransferReport']=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x59fc('0xf6')]=db[_0x59fc('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x59fc('0xf7')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0xf8'));db[_0x59fc('0xf9')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xfa'));db[_0x59fc('0xfb')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xfc'));db[_0x59fc('0xfd')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0xfe'));db[_0x59fc('0xff')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x100'));db[_0x59fc('0x101')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x102'));db['WhatsappAccount']=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x103'));db[_0x59fc('0x104')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0x59fc('0x105')]=db[_0x59fc('0x1')]['import'](_0x59fc('0x106'));db[_0x59fc('0x107')]=db[_0x59fc('0x1')][_0x59fc('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x59fc('0x108')]=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x109'));db['WhatsappTransferReport']=db['sequelize'][_0x59fc('0x13')](_0x59fc('0x10a'));db[_0x59fc('0x10b')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x10c'));db[_0x59fc('0x10d')]=db[_0x59fc('0x1')][_0x59fc('0x13')](_0x59fc('0x10e'));db[_0x59fc('0x12')][_0x59fc('0x10f')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x111')});db[_0x59fc('0x12')][_0x59fc('0x112')](db[_0x59fc('0x1c')],{'as':_0x59fc('0x113'),'foreignKey':_0x59fc('0x111')});db['User'][_0x59fc('0x112')](db[_0x59fc('0x2d')],{'as':_0x59fc('0x114'),'foreignKey':_0x59fc('0x111')});db['User'][_0x59fc('0x112')](db[_0x59fc('0x18')],{'as':_0x59fc('0x115'),'onDelete':'cascade','hooks':!![]});db[_0x59fc('0x12')][_0x59fc('0x112')](db[_0x59fc('0x79')],{'as':_0x59fc('0x116'),'foreignKey':'UserId'});db['User'][_0x59fc('0x112')](db[_0x59fc('0x7b')],{'as':_0x59fc('0x117'),'foreignKey':_0x59fc('0x111')});db['User'][_0x59fc('0x112')](db[_0x59fc('0x7d')],{'as':_0x59fc('0x7d'),'foreignKey':_0x59fc('0x111')});db[_0x59fc('0x12')][_0x59fc('0x112')](db[_0x59fc('0x118')],{'as':_0x59fc('0x119'),'foreignKey':_0x59fc('0x111')});db[_0x59fc('0x12')]['hasMany'](db[_0x59fc('0x6a')],{'as':_0x59fc('0x11a'),'foreignKey':_0x59fc('0x111')});db[_0x59fc('0x12')]['hasMany'](db[_0x59fc('0x58')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x59fc('0x12')][_0x59fc('0x112')](db['FaxInteraction'],{'as':_0x59fc('0x11b'),'foreignKey':_0x59fc('0x111')});db[_0x59fc('0x12')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x59fc('0x111')});db['User'][_0x59fc('0x112')](db[_0x59fc('0x105')],{'as':_0x59fc('0x11c'),'foreignKey':_0x59fc('0x111')});db[_0x59fc('0x12')][_0x59fc('0x112')](db['Notification'],{'as':_0x59fc('0x11d'),'foreignKey':_0x59fc('0x11e')});db[_0x59fc('0x12')][_0x59fc('0x11f')](db[_0x59fc('0xfb')],{'as':_0x59fc('0xfb'),'foreignKey':'userProfileId'});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0x121')],{'as':_0x59fc('0x122'),'through':_0x59fc('0x123')});db[_0x59fc('0x12')]['belongsToMany'](db[_0x59fc('0x74')],{'as':_0x59fc('0x124'),'through':_0x59fc('0x125')});db['User'][_0x59fc('0x120')](db[_0x59fc('0xf7')],{'as':_0x59fc('0x126'),'through':_0x59fc('0x127')});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0x128')],{'through':_0x59fc('0x129')});db['User'][_0x59fc('0x120')](db['MailInteraction'],{'as':_0x59fc('0x12a'),'through':_0x59fc('0x12b')});db['User']['belongsToMany'](db[_0x59fc('0x6a')],{'as':_0x59fc('0x11a'),'through':'user_has_chat_interactions'});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0x12c')],{'as':_0x59fc('0x11b'),'through':'user_has_fax_interactions'});db['User'][_0x59fc('0x120')](db[_0x59fc('0x58')],{'as':_0x59fc('0x12d'),'through':_0x59fc('0x12e')});db[_0x59fc('0x12')][_0x59fc('0x120')](db['OpenchannelInteraction'],{'as':_0x59fc('0x119'),'through':_0x59fc('0x12f')});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0x105')],{'as':_0x59fc('0x11c'),'through':_0x59fc('0x130')});db[_0x59fc('0x12')][_0x59fc('0x120')](db['VoiceQueue'],{'as':_0x59fc('0x131'),'through':_0x59fc('0x2f'),'required':![]});db[_0x59fc('0x12')]['belongsToMany'](db[_0x59fc('0x3e')],{'as':'MailQueues','through':_0x59fc('0x132'),'required':![]});db[_0x59fc('0x12')]['belongsToMany'](db['ChatQueue'],{'as':_0x59fc('0x133'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0x51')],{'as':_0x59fc('0x134'),'through':_0x59fc('0x33'),'required':![]});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0x5b')],{'as':_0x59fc('0x135'),'through':_0x59fc('0x35'),'required':![]});db['User'][_0x59fc('0x120')](db[_0x59fc('0x136')],{'as':_0x59fc('0x137'),'through':_0x59fc('0x37'),'required':![]});db['User'][_0x59fc('0x120')](db[_0x59fc('0x10b')],{'as':_0x59fc('0x138'),'through':'UserWhatsappQueue','required':![]});db[_0x59fc('0x12')]['belongsToMany'](db[_0x59fc('0xf7')],{'through':_0x59fc('0x127')});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0xf9')],{'as':_0x59fc('0x139'),'through':_0x59fc('0x13a'),'required':![]});db[_0x59fc('0x12')][_0x59fc('0x120')](db['ChatWebsite'],{'as':_0x59fc('0x13b'),'through':_0x59fc('0x13c')});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0x13d')],{'as':_0x59fc('0x13e'),'through':_0x59fc('0x13f')});db[_0x59fc('0x12')]['belongsToMany'](db[_0x59fc('0x3c')],{'as':_0x59fc('0x140'),'through':_0x59fc('0x141')});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0x5d')],{'as':_0x59fc('0x142'),'through':'user_has_openchannel_accounts'});db['User'][_0x59fc('0x120')](db[_0x59fc('0x55')],{'as':_0x59fc('0x143'),'through':_0x59fc('0x144')});db['User']['belongsToMany'](db[_0x59fc('0x145')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x59fc('0x12')][_0x59fc('0x120')](db[_0x59fc('0xe4')],{'as':_0x59fc('0x146'),'through':_0x59fc('0x147')});db[_0x59fc('0x15')][_0x59fc('0x112')](db[_0x59fc('0x18')],{'as':_0x59fc('0x148'),'onDelete':'cascade','foreignKey':_0x59fc('0x149')});db['VoiceContext'][_0x59fc('0x112')](db[_0x59fc('0x18')],{'onDelete':_0x59fc('0x110')});db[_0x59fc('0x18')][_0x59fc('0x112')](db[_0x59fc('0x18')],{'as':_0x59fc('0x14a'),'onDelete':_0x59fc('0x110')});db['VoiceMusicOnHold']['belongsToMany'](db[_0x59fc('0x92')],{'as':'Sounds','through':_0x59fc('0x14b')});db[_0x59fc('0x14c')][_0x59fc('0x112')](db[_0x59fc('0x2d')],{'as':_0x59fc('0x14d'),'foreignKey':'VoiceQueueId'});db[_0x59fc('0x14c')][_0x59fc('0x112')](db[_0x59fc('0x14e')],{'as':_0x59fc('0x14f'),'foreignKey':_0x59fc('0x150')});db[_0x59fc('0x14c')][_0x59fc('0x112')](db[_0x59fc('0x79')],{'as':_0x59fc('0x116'),'foreignKey':_0x59fc('0x150')});db[_0x59fc('0x14c')][_0x59fc('0x112')](db[_0x59fc('0x7b')],{'as':_0x59fc('0x151'),'foreignKey':_0x59fc('0x150')});db['VoiceQueue']['hasMany'](db[_0x59fc('0x7d')],{'as':_0x59fc('0x7d'),'foreignKey':'VoiceQueueId'});db[_0x59fc('0x14c')][_0x59fc('0x112')](db[_0x59fc('0x77')],{'as':_0x59fc('0x152'),'foreignKey':_0x59fc('0x150')});db[_0x59fc('0x14c')][_0x59fc('0x112')](db[_0x59fc('0xd9')],{'as':_0x59fc('0x153'),'foreignKey':_0x59fc('0x150')});db['VoiceQueue'][_0x59fc('0x11f')](db['Trunk'],{'as':_0x59fc('0x29'),'foreignKey':_0x59fc('0x154')});db[_0x59fc('0x14c')]['belongsTo'](db[_0x59fc('0x29')],{'as':_0x59fc('0x155'),'foreignKey':_0x59fc('0x156')});db[_0x59fc('0x14c')]['belongsTo'](db[_0x59fc('0x8a')],{'as':_0x59fc('0x8a'),'foreignKey':_0x59fc('0x157')});db[_0x59fc('0x14c')][_0x59fc('0x11f')](db[_0x59fc('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x59fc('0x158')});db[_0x59fc('0x14c')][_0x59fc('0x120')](db['CmList'],{'as':'Lists','through':_0x59fc('0x159')});db[_0x59fc('0x14c')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x2f')});db['VoiceQueue'][_0x59fc('0x120')](db[_0x59fc('0x128')],{'as':_0x59fc('0x15b'),'through':_0x59fc('0x15c')});db[_0x59fc('0x14c')]['belongsToMany'](db[_0x59fc('0xf7')],{'as':_0x59fc('0x15d'),'through':_0x59fc('0x15e')});db['VoiceRecording'][_0x59fc('0x11f')](db['User'],{'as':_0x59fc('0x12'),'foreignKey':_0x59fc('0x111')});db[_0x59fc('0x1d')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x59fc('0x111')});db[_0x59fc('0x1e')][_0x59fc('0x112')](db[_0x59fc('0x20')],{'as':_0x59fc('0x15f'),'onDelete':_0x59fc('0x110'),'foreignKey':'mailboxuser','sourceKey':_0x59fc('0x160')});db[_0x59fc('0x20')]['belongsTo'](db[_0x59fc('0x1e')],{'foreignKey':_0x59fc('0x161'),'targetKey':_0x59fc('0x160')});db[_0x59fc('0x22')][_0x59fc('0x112')](db[_0x59fc('0x25')],{'as':_0x59fc('0x162'),'foreignKey':_0x59fc('0x163'),'constraints':![]});db['VoiceCallReport'][_0x59fc('0x112')](db['VoiceAgentReport'],{'as':_0x59fc('0x164'),'foreignKey':'uniqueid','constraints':![]});db[_0x59fc('0x22')][_0x59fc('0x11f')](db['User'],{'as':_0x59fc('0x12'),'foreignKey':_0x59fc('0x111')});db['VoiceCallReport'][_0x59fc('0x11f')](db[_0x59fc('0x74')],{'as':_0x59fc('0x165'),'foreignKey':_0x59fc('0x166')});db['MailServerIn'][_0x59fc('0x11f')](db['MailAccount'],{'as':_0x59fc('0x3c'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0x59fc('0x11f')](db['MailAccount'],{'as':_0x59fc('0x3c'),'foreignKey':_0x59fc('0x167')});db[_0x59fc('0x3c')][_0x59fc('0x10f')](db[_0x59fc('0x3a')],{'as':_0x59fc('0x168'),'onDelete':_0x59fc('0x110')});db['MailAccount'][_0x59fc('0x10f')](db['MailServerOut'],{'as':_0x59fc('0x169'),'onDelete':'cascade'});db[_0x59fc('0x3c')][_0x59fc('0x112')](db[_0x59fc('0x86')],{'as':_0x59fc('0x16a'),'foreignKey':_0x59fc('0x167')});db[_0x59fc('0x3c')][_0x59fc('0x112')](db[_0x59fc('0x84')],{'as':'Answers','foreignKey':_0x59fc('0x167')});db[_0x59fc('0x3c')][_0x59fc('0x112')](db[_0x59fc('0x43')],{'as':_0x59fc('0x15f'),'foreignKey':_0x59fc('0x167')});db[_0x59fc('0x3c')][_0x59fc('0x112')](db[_0x59fc('0x41')],{'as':_0x59fc('0x16b')});db[_0x59fc('0x3c')][_0x59fc('0x112')](db[_0x59fc('0x16c')],{'as':_0x59fc('0x14a')});db[_0x59fc('0x3c')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':_0x59fc('0x16d'),'foreignKey':'ListId'});db[_0x59fc('0x3c')][_0x59fc('0x11f')](db[_0x59fc('0x16e')],{'as':'Template','foreignKey':_0x59fc('0x16f')});db[_0x59fc('0x3c')][_0x59fc('0x11f')](db[_0x59fc('0x8c')],{'as':_0x59fc('0x170'),'foreignKey':_0x59fc('0x158')});db[_0x59fc('0x3c')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x141')});db[_0x59fc('0x3e')][_0x59fc('0x120')](db['User'],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x132')});db[_0x59fc('0x3e')][_0x59fc('0x120')](db[_0x59fc('0x128')],{'through':_0x59fc('0x171'),'as':_0x59fc('0x15b')});db[_0x59fc('0x41')][_0x59fc('0x112')](db[_0x59fc('0x43')],{'as':_0x59fc('0x15f'),'onDelete':'cascade','foreignKey':_0x59fc('0x172')});db['MailInteraction'][_0x59fc('0x11f')](db[_0x59fc('0x3c')],{'as':_0x59fc('0x173'),'foreignKey':_0x59fc('0x167')});db[_0x59fc('0x41')][_0x59fc('0x11f')](db['CmContact'],{'as':_0x59fc('0x165'),'foreignKey':'ContactId'});db['MailInteraction']['belongsTo'](db[_0x59fc('0x12')],{'as':_0x59fc('0x174'),'foreignKey':_0x59fc('0x111')});db[_0x59fc('0x41')]['belongsToMany'](db['Tag'],{'through':_0x59fc('0x175'),'as':_0x59fc('0x176')});db[_0x59fc('0x41')][_0x59fc('0x120')](db['Tag'],{'through':_0x59fc('0x175'),'as':_0x59fc('0x177')});db['MailInteraction'][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x178'),'through':_0x59fc('0x12b'),'foreignKey':'MailInteractionId'});db[_0x59fc('0x43')][_0x59fc('0x112')](db[_0x59fc('0x179')],{'as':'Attachments','onDelete':_0x59fc('0x110')});db[_0x59fc('0x43')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'as':'User'});db[_0x59fc('0x43')][_0x59fc('0x11f')](db['CmContact'],{'onDelete':_0x59fc('0x110'),'as':_0x59fc('0x165')});db[_0x59fc('0x43')][_0x59fc('0x11f')](db[_0x59fc('0x41')],{'as':_0x59fc('0x17a'),'foreignKey':_0x59fc('0x172')});db['MailMessage']['belongsTo'](db[_0x59fc('0x3c')],{'as':_0x59fc('0x173'),'foreignKey':_0x59fc('0x167')});db[_0x59fc('0x16c')]['belongsTo'](db['User'],{'onDelete':_0x59fc('0x17b')});db['MailApplication'][_0x59fc('0x11f')](db[_0x59fc('0x3e')],{'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x16c')][_0x59fc('0x11f')](db[_0x59fc('0x3c')],{'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x16c')][_0x59fc('0x11f')](db[_0x59fc('0x8a')],{'onDelete':_0x59fc('0x17b'),'foreignKey':'IntervalId'});db['MailApplication'][_0x59fc('0x11f')](db['Tag'],{'onDelete':_0x59fc('0x17b'),'foreignKey':'TagId'});db[_0x59fc('0x46')]['belongsTo'](db[_0x59fc('0x3c')],{});db[_0x59fc('0x46')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':_0x59fc('0x16d'),'foreignKey':_0x59fc('0x17c')});db[_0x59fc('0x46')][_0x59fc('0x11f')](db[_0x59fc('0x74')],{'as':_0x59fc('0x165'),'foreignKey':_0x59fc('0x166')});db[_0x59fc('0x46')][_0x59fc('0x11f')](db['MailInteraction'],{});db[_0x59fc('0x46')][_0x59fc('0x11f')](db[_0x59fc('0x43')],{});db[_0x59fc('0x46')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{});db['MailQueueReport'][_0x59fc('0x11f')](db['MailQueue'],{});db['Dashboard'][_0x59fc('0x112')](db[_0x59fc('0x4a')],{'as':'Items','onDelete':'cascade'});db[_0x59fc('0x13d')][_0x59fc('0x112')](db['Disposition'],{'as':_0x59fc('0x16a'),'foreignKey':_0x59fc('0x17d')});db[_0x59fc('0x13d')][_0x59fc('0x112')](db[_0x59fc('0x84')],{'as':_0x59fc('0x17e'),'foreignKey':'FaxAccountId'});db[_0x59fc('0x13d')][_0x59fc('0x112')](db[_0x59fc('0x12c')],{'as':_0x59fc('0x16b')});db['FaxAccount'][_0x59fc('0x112')](db[_0x59fc('0x4c')],{'as':_0x59fc('0x14a')});db[_0x59fc('0x13d')]['hasMany'](db[_0x59fc('0x18')],{'as':_0x59fc('0x17f'),'onDelete':_0x59fc('0x110')});db['FaxAccount'][_0x59fc('0x112')](db['FaxMessage'],{'as':'Messages'});db[_0x59fc('0x13d')]['belongsTo'](db[_0x59fc('0x29')],{'as':'Trunk'});db['FaxAccount'][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':_0x59fc('0x16d'),'foreignKey':_0x59fc('0x17c')});db[_0x59fc('0x13d')][_0x59fc('0x11f')](db[_0x59fc('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount']['belongsToMany'](db[_0x59fc('0x12')],{'as':'Agents','through':_0x59fc('0x13f')});db[_0x59fc('0x4c')]['belongsTo'](db[_0x59fc('0x12')],{'onDelete':_0x59fc('0x17b')});db['FaxApplication'][_0x59fc('0x11f')](db[_0x59fc('0x51')],{'onDelete':_0x59fc('0x17b')});db['FaxApplication']['belongsTo'](db[_0x59fc('0x13d')],{'onDelete':_0x59fc('0x17b')});db['FaxApplication'][_0x59fc('0x11f')](db['Tag'],{'onDelete':_0x59fc('0x17b'),'foreignKey':_0x59fc('0x180')});db['FaxInteraction'][_0x59fc('0x112')](db['FaxMessage'],{'as':_0x59fc('0x15f'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x181')});db[_0x59fc('0x12c')][_0x59fc('0x11f')](db[_0x59fc('0x13d')],{'as':_0x59fc('0x173'),'foreignKey':'FaxAccountId'});db[_0x59fc('0x12c')][_0x59fc('0x11f')](db['CmContact'],{'as':_0x59fc('0x165'),'foreignKey':_0x59fc('0x166')});db['FaxInteraction']['belongsTo'](db[_0x59fc('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x59fc('0x12c')][_0x59fc('0x120')](db[_0x59fc('0x94')],{'through':_0x59fc('0x182'),'as':_0x59fc('0x176')});db[_0x59fc('0x12c')][_0x59fc('0x120')](db[_0x59fc('0x94')],{'through':_0x59fc('0x182'),'as':'ThroughTags'});db[_0x59fc('0x12c')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x178'),'through':_0x59fc('0x183'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'onDelete':_0x59fc('0x110'),'as':_0x59fc('0x12')});db[_0x59fc('0x4f')][_0x59fc('0x11f')](db['FaxInteraction'],{'as':_0x59fc('0x17a'),'foreignKey':_0x59fc('0x181')});db[_0x59fc('0x4f')]['belongsTo'](db[_0x59fc('0x74')],{'onDelete':_0x59fc('0x110'),'as':_0x59fc('0x165')});db['FaxMessage'][_0x59fc('0x11f')](db[_0x59fc('0x179')],{'as':_0x59fc('0x179'),'foreignKey':_0x59fc('0x184')});db[_0x59fc('0x4f')][_0x59fc('0x11f')](db['FaxAccount'],{'as':_0x59fc('0x173'),'foreignKey':_0x59fc('0x17d')});db[_0x59fc('0x51')][_0x59fc('0x120')](db['User'],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x33')});db[_0x59fc('0x51')][_0x59fc('0x120')](db['Team'],{'through':'team_has_fax_queues','as':_0x59fc('0x15b')});db[_0x59fc('0x53')][_0x59fc('0x11f')](db['FaxAccount'],{});db[_0x59fc('0x53')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':_0x59fc('0x16d'),'foreignKey':_0x59fc('0x17c')});db[_0x59fc('0x53')][_0x59fc('0x11f')](db[_0x59fc('0x74')],{'as':_0x59fc('0x165'),'foreignKey':_0x59fc('0x166')});db[_0x59fc('0x53')][_0x59fc('0x11f')](db[_0x59fc('0x12c')],{});db[_0x59fc('0x53')][_0x59fc('0x11f')](db[_0x59fc('0x4f')],{});db[_0x59fc('0x53')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{});db[_0x59fc('0x53')]['belongsTo'](db[_0x59fc('0x51')],{});db[_0x59fc('0x55')]['hasMany'](db[_0x59fc('0x86')],{'as':_0x59fc('0x16a'),'foreignKey':'SmsAccountId'});db[_0x59fc('0x55')][_0x59fc('0x112')](db[_0x59fc('0x84')],{'as':'Answers','foreignKey':_0x59fc('0x185')});db[_0x59fc('0x55')][_0x59fc('0x112')](db[_0x59fc('0x5a')],{'as':_0x59fc('0x15f'),'foreignKey':'SmsAccountId'});db[_0x59fc('0x55')][_0x59fc('0x112')](db[_0x59fc('0x58')],{'as':_0x59fc('0x16b')});db['SmsAccount']['hasMany'](db[_0x59fc('0x56')],{'as':_0x59fc('0x14a')});db[_0x59fc('0x55')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':_0x59fc('0x16d'),'foreignKey':_0x59fc('0x17c')});db[_0x59fc('0x55')][_0x59fc('0x11f')](db[_0x59fc('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x59fc('0x55')]['belongsToMany'](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x144')});db[_0x59fc('0x56')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x56')]['belongsTo'](db[_0x59fc('0x5b')],{'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x56')]['belongsTo'](db['SmsAccount'],{'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x56')][_0x59fc('0x11f')](db[_0x59fc('0x8a')],{'onDelete':_0x59fc('0x17b'),'foreignKey':_0x59fc('0x157')});db[_0x59fc('0x56')][_0x59fc('0x11f')](db['Tag'],{'onDelete':_0x59fc('0x17b'),'foreignKey':_0x59fc('0x180')});db[_0x59fc('0x58')]['hasMany'](db[_0x59fc('0x5a')],{'as':_0x59fc('0x15f'),'onDelete':'cascade','foreignKey':_0x59fc('0x186')});db[_0x59fc('0x58')][_0x59fc('0x11f')](db['SmsAccount'],{'as':_0x59fc('0x173'),'foreignKey':'SmsAccountId'});db[_0x59fc('0x58')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x59fc('0x166')});db[_0x59fc('0x58')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'as':_0x59fc('0x174'),'foreignKey':'UserId'});db[_0x59fc('0x58')][_0x59fc('0x120')](db[_0x59fc('0x94')],{'through':'sms_interaction_has_tags','as':_0x59fc('0x176')});db[_0x59fc('0x58')][_0x59fc('0x120')](db[_0x59fc('0x94')],{'through':_0x59fc('0x187'),'as':_0x59fc('0x177')});db['SmsInteraction'][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':'Users','through':_0x59fc('0x12e'),'foreignKey':_0x59fc('0x186')});db[_0x59fc('0x5a')]['belongsTo'](db['User'],{'as':'User'});db[_0x59fc('0x5a')]['belongsTo'](db[_0x59fc('0x74')],{'onDelete':_0x59fc('0x110'),'as':_0x59fc('0x165')});db[_0x59fc('0x5a')]['belongsTo'](db[_0x59fc('0x58')],{'onDelete':'cascade','as':_0x59fc('0x17a'),'foreignKey':_0x59fc('0x186')});db[_0x59fc('0x5a')][_0x59fc('0x11f')](db[_0x59fc('0x55')],{'as':_0x59fc('0x173'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x59fc('0x5b')][_0x59fc('0x120')](db['Team'],{'through':_0x59fc('0x188'),'as':_0x59fc('0x15b')});db['OpenchannelAccount']['hasMany'](db[_0x59fc('0x86')],{'as':'Dispositions','foreignKey':_0x59fc('0x189')});db[_0x59fc('0x5d')]['hasMany'](db[_0x59fc('0x84')],{'as':'Answers','foreignKey':_0x59fc('0x189')});db['OpenchannelAccount'][_0x59fc('0x112')](db[_0x59fc('0x118')],{'as':_0x59fc('0x16b'),'foreignKey':_0x59fc('0x189')});db[_0x59fc('0x5d')][_0x59fc('0x112')](db[_0x59fc('0x62')],{'as':_0x59fc('0x15f'),'foreignKey':_0x59fc('0x189')});db[_0x59fc('0x5d')]['hasMany'](db['OpenchannelApplication'],{'as':_0x59fc('0x14a'),'foreignKey':_0x59fc('0x189')});db[_0x59fc('0x5d')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':_0x59fc('0x16d'),'foreignKey':'ListId'});db[_0x59fc('0x5d')][_0x59fc('0x11f')](db[_0x59fc('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x59fc('0x158')});db[_0x59fc('0x5d')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x5f')][_0x59fc('0x11f')](db['OpenchannelQueue'],{'onDelete':_0x59fc('0x17b'),'foreignKey':'OpenchannelQueueId'});db[_0x59fc('0x5f')]['belongsTo'](db[_0x59fc('0x5d')],{'onDelete':_0x59fc('0x17b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x59fc('0x11f')](db['Interval'],{'onDelete':_0x59fc('0x17b'),'foreignKey':_0x59fc('0x157')});db[_0x59fc('0x5f')][_0x59fc('0x11f')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x59fc('0x180')});db['OpenchannelInteraction'][_0x59fc('0x112')](db['OpenchannelMessage'],{'as':_0x59fc('0x15f'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x18a')});db[_0x59fc('0x118')][_0x59fc('0x11f')](db[_0x59fc('0x5d')],{'as':_0x59fc('0x173'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x59fc('0x11f')](db[_0x59fc('0x74')],{'as':_0x59fc('0x165'),'foreignKey':_0x59fc('0x166')});db[_0x59fc('0x118')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'as':_0x59fc('0x174'),'foreignKey':'UserId'});db[_0x59fc('0x118')][_0x59fc('0x120')](db[_0x59fc('0x94')],{'through':_0x59fc('0x18b'),'as':_0x59fc('0x176')});db['OpenchannelInteraction']['belongsToMany'](db[_0x59fc('0x94')],{'through':_0x59fc('0x18b'),'as':_0x59fc('0x177')});db['OpenchannelInteraction'][_0x59fc('0x120')](db['User'],{'as':_0x59fc('0x178'),'through':_0x59fc('0x12f'),'foreignKey':_0x59fc('0x18a')});db[_0x59fc('0x62')]['belongsTo'](db[_0x59fc('0x12')],{'onDelete':_0x59fc('0x110'),'as':_0x59fc('0x12')});db['OpenchannelMessage'][_0x59fc('0x11f')](db[_0x59fc('0x74')],{'onDelete':_0x59fc('0x110'),'as':_0x59fc('0x165')});db[_0x59fc('0x62')][_0x59fc('0x11f')](db[_0x59fc('0x118')],{'onDelete':_0x59fc('0x110'),'as':_0x59fc('0x17a'),'foreignKey':'OpenchannelInteractionId'});db[_0x59fc('0x62')][_0x59fc('0x11f')](db[_0x59fc('0x179')],{'as':_0x59fc('0x179'),'foreignKey':_0x59fc('0x184')});db['OpenchannelMessage'][_0x59fc('0x11f')](db[_0x59fc('0x5d')],{'as':'Account','foreignKey':_0x59fc('0x189')});db[_0x59fc('0x136')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':'UserOpenchannelQueue','foreignKey':_0x59fc('0x18c')});db['OpenchannelQueue'][_0x59fc('0x120')](db[_0x59fc('0x128')],{'through':_0x59fc('0x18d'),'as':_0x59fc('0x15b')});db['ChatWebsite'][_0x59fc('0x112')](db[_0x59fc('0x86')],{'as':_0x59fc('0x16a'),'foreignKey':_0x59fc('0x18e')});db[_0x59fc('0x65')][_0x59fc('0x112')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x59fc('0x18e')});db[_0x59fc('0x65')][_0x59fc('0x112')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x59fc('0x65')][_0x59fc('0x112')](db['ChatInteraction'],{'as':_0x59fc('0x16b')});db[_0x59fc('0x65')][_0x59fc('0x112')](db['ChatApplication'],{'as':'Applications'});db[_0x59fc('0x65')][_0x59fc('0x112')](db[_0x59fc('0x6c')],{'as':_0x59fc('0x15f')});db[_0x59fc('0x65')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':'List','foreignKey':_0x59fc('0x17c')});db['ChatWebsite'][_0x59fc('0x11f')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x59fc('0x65')]['belongsTo'](db[_0x59fc('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x59fc('0x158')});db[_0x59fc('0x65')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x13c')});db['OpenchannelQueueReport'][_0x59fc('0x11f')](db['OpenchannelAccount'],{});db[_0x59fc('0x67')][_0x59fc('0x11f')](db['CmList'],{'as':_0x59fc('0x16d'),'foreignKey':_0x59fc('0x17c')});db[_0x59fc('0x67')][_0x59fc('0x11f')](db[_0x59fc('0x74')],{'as':_0x59fc('0x165'),'foreignKey':_0x59fc('0x166')});db[_0x59fc('0x67')][_0x59fc('0x11f')](db[_0x59fc('0x118')],{});db[_0x59fc('0x67')]['belongsTo'](db[_0x59fc('0x62')],{});db[_0x59fc('0x67')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{});db['OpenchannelQueueReport'][_0x59fc('0x11f')](db[_0x59fc('0x136')],{});db[_0x59fc('0x69')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'as':_0x59fc('0x18f'),'foreignKey':_0x59fc('0x111'),'onDelete':_0x59fc('0x17b')});db['ChatApplication'][_0x59fc('0x11f')](db[_0x59fc('0x6f')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x59fc('0x17b')});db[_0x59fc('0x69')][_0x59fc('0x11f')](db[_0x59fc('0x65')],{'as':_0x59fc('0x190'),'foreignKey':'ChatWebsiteId','onDelete':_0x59fc('0x17b')});db[_0x59fc('0x69')]['belongsTo'](db[_0x59fc('0x94')],{'onDelete':_0x59fc('0x17b'),'foreignKey':'TagId'});db[_0x59fc('0x6a')][_0x59fc('0x112')](db[_0x59fc('0x6c')],{'as':_0x59fc('0x15f'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x191')});db['ChatInteraction'][_0x59fc('0x11f')](db[_0x59fc('0x65')],{'as':_0x59fc('0x173'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x59fc('0x11f')](db[_0x59fc('0x74')],{'as':_0x59fc('0x165'),'foreignKey':_0x59fc('0x166')});db[_0x59fc('0x6a')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'as':_0x59fc('0x174'),'foreignKey':_0x59fc('0x111')});db[_0x59fc('0x6a')][_0x59fc('0x120')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x59fc('0x176')});db[_0x59fc('0x6a')][_0x59fc('0x120')](db[_0x59fc('0x94')],{'through':_0x59fc('0x192'),'as':'ThroughTags'});db[_0x59fc('0x6a')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x178'),'through':_0x59fc('0x193'),'foreignKey':_0x59fc('0x191')});db['ChatMessage'][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'onDelete':_0x59fc('0x110'),'as':_0x59fc('0x12')});db[_0x59fc('0x6c')]['belongsTo'](db[_0x59fc('0x74')],{'onDelete':_0x59fc('0x110'),'as':_0x59fc('0x165'),'foreignKey':_0x59fc('0x166')});db[_0x59fc('0x6c')][_0x59fc('0x11f')](db['ChatInteraction'],{'onDelete':_0x59fc('0x110'),'as':'Interaction','foreignKey':_0x59fc('0x191')});db['ChatMessage'][_0x59fc('0x11f')](db[_0x59fc('0x179')],{'as':_0x59fc('0x179'),'foreignKey':'AttachmentId'});db[_0x59fc('0x6c')]['belongsTo'](db[_0x59fc('0x65')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x59fc('0x6e')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x59fc('0x165'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x59fc('0x11f')](db['ChatWebsite'],{'as':_0x59fc('0x173'),'foreignKey':_0x59fc('0x18e')});db[_0x59fc('0x6f')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':'UserChatQueue','hooks':!![]});db[_0x59fc('0x6f')][_0x59fc('0x120')](db[_0x59fc('0x128')],{'through':_0x59fc('0x194'),'as':_0x59fc('0x15b')});db['ChatGroup']['hasMany'](db[_0x59fc('0x195')],{'as':'Messages','foreignKey':_0x59fc('0x196'),'onDelete':'cascade'});db['ChatGroup'][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x14d'),'through':'chat_group_has_users'});db[_0x59fc('0x197')]['belongsTo'](db[_0x59fc('0x65')],{'as':_0x59fc('0x190'),'foreignKey':'ChatWebsiteId'});db[_0x59fc('0x73')][_0x59fc('0x112')](db[_0x59fc('0x74')],{'as':_0x59fc('0x124'),'foreignKey':_0x59fc('0x198')});db[_0x59fc('0x74')][_0x59fc('0x112')](db[_0x59fc('0x14e')],{'as':_0x59fc('0x14f'),'foreignKey':'ContactId'});db[_0x59fc('0x74')][_0x59fc('0x112')](db[_0x59fc('0x79')],{'as':_0x59fc('0x116'),'foreignKey':_0x59fc('0x166')});db[_0x59fc('0x74')][_0x59fc('0x112')](db[_0x59fc('0x7b')],{'as':'HopperHistories','foreignKey':_0x59fc('0x166')});db[_0x59fc('0x74')][_0x59fc('0x112')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x59fc('0x166')});db['CmContact'][_0x59fc('0x112')](db[_0x59fc('0xd9')],{'as':_0x59fc('0x153'),'foreignKey':'ContactId'});db[_0x59fc('0x74')][_0x59fc('0x112')](db[_0x59fc('0x118')],{'as':_0x59fc('0x119'),'foreignKey':_0x59fc('0x166'),'onDelete':'restrict'});db[_0x59fc('0x74')]['hasMany'](db[_0x59fc('0x6a')],{'as':_0x59fc('0x11a'),'foreignKey':_0x59fc('0x166'),'onDelete':'restrict'});db['CmContact']['hasMany'](db['SmsInteraction'],{'as':_0x59fc('0x12d'),'foreignKey':_0x59fc('0x166'),'onDelete':'restrict'});db[_0x59fc('0x74')]['hasMany'](db['FaxInteraction'],{'as':_0x59fc('0x11b'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x59fc('0x112')](db[_0x59fc('0x41')],{'as':_0x59fc('0x12a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x59fc('0x74')][_0x59fc('0x11f')](db[_0x59fc('0x73')],{'as':'Company','foreignKey':_0x59fc('0x198')});db[_0x59fc('0x74')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0x59fc('0x74')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x178'),'through':_0x59fc('0x125')});db['CmContact'][_0x59fc('0x120')](db[_0x59fc('0x94')],{'as':'Tags','through':_0x59fc('0x199')});db['CmContact'][_0x59fc('0x120')](db[_0x59fc('0x94')],{'through':_0x59fc('0x199'),'as':_0x59fc('0x177')});db[_0x59fc('0x14e')]['belongsTo'](db[_0x59fc('0x74')],{'as':'Contact','foreignKey':_0x59fc('0x166'),'onDelete':_0x59fc('0x110')});db[_0x59fc('0x14e')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':'List','foreignKey':'ListId','onDelete':_0x59fc('0x110')});db[_0x59fc('0x14e')]['belongsTo'](db[_0x59fc('0x12')],{'as':'Agent','foreignKey':_0x59fc('0x111')});db['CmHopper'][_0x59fc('0x11f')](db[_0x59fc('0x14c')],{'as':_0x59fc('0x19a'),'foreignKey':_0x59fc('0x150'),'onDelete':'cascade'});db[_0x59fc('0x14e')]['belongsTo'](db[_0x59fc('0x19b')],{'as':_0x59fc('0x19b'),'foreignKey':'CampaignId','onDelete':_0x59fc('0x110')});db[_0x59fc('0x14e')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'as':'Owner','foreignKey':_0x59fc('0x19c')});db['CmHopperBlack'][_0x59fc('0x11f')](db['CmContact'],{'as':_0x59fc('0x165'),'foreignKey':'ContactId','onDelete':_0x59fc('0x110')});db[_0x59fc('0x77')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':_0x59fc('0x16d'),'foreignKey':_0x59fc('0x17c'),'onDelete':_0x59fc('0x110')});db[_0x59fc('0x77')][_0x59fc('0x11f')](db[_0x59fc('0x14c')],{'as':'Queue','foreignKey':_0x59fc('0x150'),'onDelete':'cascade'});db[_0x59fc('0x77')][_0x59fc('0x11f')](db[_0x59fc('0x19b')],{'as':_0x59fc('0x19b'),'foreignKey':_0x59fc('0x19d'),'onDelete':_0x59fc('0x110')});db[_0x59fc('0x82')]['hasMany'](db[_0x59fc('0x88')],{'as':{'plural':_0x59fc('0x19e'),'singular':_0x59fc('0x19f')},'foreignKey':'AutomationAllId','onDelete':_0x59fc('0x110'),'hooks':!![]});db[_0x59fc('0x82')][_0x59fc('0x112')](db[_0x59fc('0x88')],{'as':{'plural':_0x59fc('0x1a0'),'singular':_0x59fc('0x1a1')},'foreignKey':_0x59fc('0x1a2'),'onDelete':_0x59fc('0x110'),'hooks':!![]});db[_0x59fc('0x82')][_0x59fc('0x112')](db['Action'],{'as':_0x59fc('0x1a3'),'foreignKey':_0x59fc('0x1a4'),'onDelete':_0x59fc('0x110'),'hooks':!![]});db[_0x59fc('0x8a')][_0x59fc('0x112')](db['Interval'],{'as':_0x59fc('0x1a5'),'foreignKey':_0x59fc('0x157'),'onDelete':_0x59fc('0x110'),'hooks':!![],'required':![]});db['Interval'][_0x59fc('0x112')](db['VoiceExtension'],{'as':_0x59fc('0x115'),'foreignKey':_0x59fc('0x157'),'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x8a')][_0x59fc('0x112')](db[_0x59fc('0x16c')],{'as':_0x59fc('0x1a6'),'foreignKey':_0x59fc('0x157')});db[_0x59fc('0x8a')][_0x59fc('0x112')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x59fc('0x8a')]['hasMany'](db['FaxApplication'],{'as':_0x59fc('0x1a7'),'foreignKey':'IntervalId'});db[_0x59fc('0x8a')]['hasMany'](db[_0x59fc('0x56')],{'as':_0x59fc('0x1a8'),'foreignKey':'IntervalId'});db[_0x59fc('0x90')]['belongsTo'](db[_0x59fc('0x3c')],{});db[_0x59fc('0x90')][_0x59fc('0x11f')](db[_0x59fc('0x9d')],{'foreignKey':_0x59fc('0x1a9')});db[_0x59fc('0x90')][_0x59fc('0x11f')](db[_0x59fc('0x1aa')],{'foreignKey':_0x59fc('0x1ab')});db['Sound']['belongsToMany'](db[_0x59fc('0x1ac')],{'as':_0x59fc('0x1ad'),'through':_0x59fc('0x14b'),'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x94')][_0x59fc('0x120')](db[_0x59fc('0x74')],{'through':'cm_contact_has_tags'});db[_0x59fc('0x94')][_0x59fc('0x120')](db[_0x59fc('0x6a')],{'through':'chat_interaction_has_tags'});db[_0x59fc('0x94')][_0x59fc('0x120')](db[_0x59fc('0x41')],{'through':_0x59fc('0x175')});db[_0x59fc('0x94')][_0x59fc('0x120')](db[_0x59fc('0x58')],{'through':'sms_interaction_has_tags'});db[_0x59fc('0x94')][_0x59fc('0x120')](db[_0x59fc('0x12c')],{'through':'fax_interaction_has_tags'});db[_0x59fc('0x94')][_0x59fc('0x120')](db[_0x59fc('0x118')],{'through':_0x59fc('0x18b')});db[_0x59fc('0x94')][_0x59fc('0x120')](db[_0x59fc('0x105')],{'through':_0x59fc('0x1ae')});db[_0x59fc('0x96')][_0x59fc('0x112')](db[_0x59fc('0x88')],{'as':{'plural':_0x59fc('0x1af'),'singular':'AllCondition'},'foreignKey':_0x59fc('0x1b0'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0x59fc('0x88')],{'as':{'plural':_0x59fc('0x1b1'),'singular':'AnyCondition'},'foreignKey':_0x59fc('0x1b2'),'onDelete':_0x59fc('0x110'),'hooks':!![]});db[_0x59fc('0x96')][_0x59fc('0x112')](db[_0x59fc('0x80')],{'as':_0x59fc('0x1a3'),'foreignKey':_0x59fc('0x1b3'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0x59fc('0x112')](db['AnalyticFieldReport'],{'as':_0x59fc('0x1b4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1ab'),'hooks':!![]});db[_0x59fc('0x9d')][_0x59fc('0x112')](db['AnalyticFieldReport'],{'as':_0x59fc('0x1b4'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x59fc('0xa1')][_0x59fc('0x112')](db[_0x59fc('0x1b5')],{'as':_0x59fc('0x1b4'),'onDelete':'cascade','foreignKey':_0x59fc('0x1b6')});db[_0x59fc('0x1b5')][_0x59fc('0x11f')](db[_0x59fc('0xa1')],{'foreignKey':_0x59fc('0x1b6')});db[_0x59fc('0x1b7')][_0x59fc('0x112')](db[_0x59fc('0x1b8')],{'as':'Configurations','onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1b9')});db[_0x59fc('0x1b8')]['hasMany'](db[_0x59fc('0xa8')],{'as':_0x59fc('0x1ba'),'onDelete':_0x59fc('0x110'),'foreignKey':'SubjectId'});db[_0x59fc('0x1b8')][_0x59fc('0x112')](db[_0x59fc('0xa8')],{'as':_0x59fc('0x1bb'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1bc')});db[_0x59fc('0x1b8')]['hasMany'](db['SalesforceField'],{'as':_0x59fc('0x1b4'),'onDelete':_0x59fc('0x110'),'foreignKey':'FieldId'});db[_0x59fc('0x1b8')][_0x59fc('0x11f')](db[_0x59fc('0x1b7')],{'as':_0x59fc('0x173'),'foreignKey':_0x59fc('0x1b9')});db['SalesforceField'][_0x59fc('0x112')](db['SalesforceField'],{'as':_0x59fc('0x1bd'),'foreignKey':_0x59fc('0x1be')});db[_0x59fc('0xa8')][_0x59fc('0x112')](db['SalesforceField'],{'as':_0x59fc('0x1bf'),'foreignKey':_0x59fc('0x1bc')});db['SalesforceField'][_0x59fc('0x112')](db[_0x59fc('0xa8')],{'as':_0x59fc('0x1c0'),'foreignKey':'FieldId'});db[_0x59fc('0xa8')][_0x59fc('0x11f')](db[_0x59fc('0x98')],{'as':'Variable','foreignKey':_0x59fc('0x1c1')});db[_0x59fc('0xaa')][_0x59fc('0x112')](db[_0x59fc('0x1c2')],{'as':'Configurations','onDelete':_0x59fc('0x110'),'foreignKey':'AccountId'});db[_0x59fc('0x1c2')]['hasMany'](db[_0x59fc('0xad')],{'as':_0x59fc('0x1ba'),'onDelete':_0x59fc('0x110'),'foreignKey':'SubjectId'});db[_0x59fc('0x1c2')][_0x59fc('0x112')](db[_0x59fc('0xad')],{'as':_0x59fc('0x1bb'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1bc')});db[_0x59fc('0x1c2')][_0x59fc('0x112')](db[_0x59fc('0xad')],{'as':_0x59fc('0x1b4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1c3')});db['SugarcrmConfiguration'][_0x59fc('0x11f')](db['SugarcrmAccount'],{'as':_0x59fc('0x173'),'foreignKey':'AccountId'});db[_0x59fc('0xad')][_0x59fc('0x112')](db[_0x59fc('0xad')],{'as':_0x59fc('0x1bd'),'foreignKey':_0x59fc('0x1be')});db[_0x59fc('0xad')][_0x59fc('0x112')](db[_0x59fc('0xad')],{'as':_0x59fc('0x1bf'),'foreignKey':_0x59fc('0x1bc')});db[_0x59fc('0xad')][_0x59fc('0x112')](db['SugarcrmField'],{'as':_0x59fc('0x1c0'),'foreignKey':_0x59fc('0x1c3')});db[_0x59fc('0xad')][_0x59fc('0x11f')](db['Variable'],{'as':'Variable','foreignKey':_0x59fc('0x1c1')});db[_0x59fc('0xaf')][_0x59fc('0x112')](db[_0x59fc('0xb1')],{'as':_0x59fc('0x1c4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1b9')});db[_0x59fc('0xb1')][_0x59fc('0x112')](db['DeskField'],{'as':_0x59fc('0x1ba'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1be')});db['DeskConfiguration']['hasMany'](db[_0x59fc('0x1c5')],{'as':_0x59fc('0x1bb'),'onDelete':'cascade','foreignKey':_0x59fc('0x1bc')});db[_0x59fc('0xb1')][_0x59fc('0x112')](db['DeskField'],{'as':_0x59fc('0x1b4'),'onDelete':_0x59fc('0x110'),'foreignKey':'FieldId'});db[_0x59fc('0xb1')]['belongsTo'](db[_0x59fc('0xaf')],{'as':_0x59fc('0x173'),'foreignKey':_0x59fc('0x1b9')});db[_0x59fc('0xb1')][_0x59fc('0x120')](db['Tag'],{'through':_0x59fc('0x1c6')});db['DeskField'][_0x59fc('0x112')](db['DeskField'],{'as':_0x59fc('0x1bd'),'foreignKey':'SubjectId'});db[_0x59fc('0x1c5')]['hasMany'](db['DeskField'],{'as':'Description','foreignKey':_0x59fc('0x1bc')});db[_0x59fc('0x1c5')]['hasMany'](db[_0x59fc('0x1c5')],{'as':_0x59fc('0x1c0'),'foreignKey':_0x59fc('0x1c3')});db[_0x59fc('0x1c5')][_0x59fc('0x11f')](db[_0x59fc('0x98')],{'as':_0x59fc('0x98'),'foreignKey':_0x59fc('0x1c1')});db[_0x59fc('0xb4')]['hasMany'](db['ZohoConfiguration'],{'as':_0x59fc('0x1c4'),'onDelete':_0x59fc('0x110'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x59fc('0x112')](db[_0x59fc('0x1c7')],{'as':_0x59fc('0x1ba'),'onDelete':'cascade','foreignKey':_0x59fc('0x1be')});db['ZohoConfiguration'][_0x59fc('0x112')](db[_0x59fc('0x1c7')],{'as':_0x59fc('0x1bb'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1bc')});db[_0x59fc('0xb6')][_0x59fc('0x112')](db[_0x59fc('0x1c7')],{'as':_0x59fc('0x1b4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1c3')});db[_0x59fc('0xb6')][_0x59fc('0x11f')](db['ZohoAccount'],{'as':_0x59fc('0x173'),'foreignKey':_0x59fc('0x1b9')});db['ZohoField'][_0x59fc('0x112')](db[_0x59fc('0x1c7')],{'as':_0x59fc('0x1bd'),'foreignKey':_0x59fc('0x1be')});db[_0x59fc('0x1c7')][_0x59fc('0x112')](db[_0x59fc('0x1c7')],{'as':_0x59fc('0x1bf'),'foreignKey':_0x59fc('0x1bc')});db[_0x59fc('0x1c7')]['hasMany'](db[_0x59fc('0x1c7')],{'as':_0x59fc('0x1c0'),'foreignKey':_0x59fc('0x1c3')});db[_0x59fc('0x1c7')]['belongsTo'](db[_0x59fc('0x98')],{'as':_0x59fc('0x98'),'foreignKey':_0x59fc('0x1c1')});db[_0x59fc('0xb8')]['hasMany'](db[_0x59fc('0xba')],{'as':_0x59fc('0x1c4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1b9')});db[_0x59fc('0xba')][_0x59fc('0x112')](db[_0x59fc('0x1c8')],{'as':'Subjects','foreignKey':_0x59fc('0x1be')});db[_0x59fc('0xba')][_0x59fc('0x112')](db['ZendeskField'],{'as':_0x59fc('0x1bb'),'foreignKey':_0x59fc('0x1bc')});db[_0x59fc('0xba')][_0x59fc('0x112')](db[_0x59fc('0x1c8')],{'as':_0x59fc('0x1b4'),'foreignKey':_0x59fc('0x1c3')});db[_0x59fc('0xba')][_0x59fc('0x11f')](db[_0x59fc('0xb8')],{'as':'Account','foreignKey':'AccountId'});db[_0x59fc('0xba')]['belongsToMany'](db[_0x59fc('0x94')],{'through':_0x59fc('0x1c9')});db[_0x59fc('0x1c8')]['hasMany'](db['ZendeskField'],{'as':_0x59fc('0x1bd'),'foreignKey':'SubjectId'});db[_0x59fc('0x1c8')][_0x59fc('0x112')](db[_0x59fc('0x1c8')],{'as':'Description','foreignKey':_0x59fc('0x1bc')});db['ZendeskField']['hasMany'](db[_0x59fc('0x1c8')],{'as':'Field','foreignKey':'FieldId'});db[_0x59fc('0x1c8')][_0x59fc('0x11f')](db[_0x59fc('0x98')],{'as':_0x59fc('0x98'),'foreignKey':_0x59fc('0x1c1')});db['FreshdeskAccount'][_0x59fc('0x112')](db[_0x59fc('0xbe')],{'as':_0x59fc('0x1c4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1b9')});db[_0x59fc('0xbe')][_0x59fc('0x112')](db[_0x59fc('0xbf')],{'as':_0x59fc('0x1ba'),'onDelete':'cascade','foreignKey':_0x59fc('0x1be')});db[_0x59fc('0xbe')][_0x59fc('0x112')](db[_0x59fc('0xbf')],{'as':_0x59fc('0x1bb'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1bc')});db['FreshdeskConfiguration'][_0x59fc('0x112')](db[_0x59fc('0xbf')],{'as':_0x59fc('0x1b4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1c3')});db[_0x59fc('0xbe')]['belongsTo'](db[_0x59fc('0xbd')],{'as':'Account','foreignKey':'AccountId'});db[_0x59fc('0xbe')]['belongsToMany'](db[_0x59fc('0x94')],{'through':_0x59fc('0x1ca')});db['FreshdeskField'][_0x59fc('0x112')](db['FreshdeskField'],{'as':_0x59fc('0x1bd'),'foreignKey':'SubjectId'});db[_0x59fc('0xbf')][_0x59fc('0x112')](db[_0x59fc('0xbf')],{'as':_0x59fc('0x1bf'),'foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db[_0x59fc('0xbf')],{'as':'Field','foreignKey':'FieldId'});db[_0x59fc('0xbf')][_0x59fc('0x11f')](db['Variable'],{'as':'Variable','foreignKey':_0x59fc('0x1c1')});db[_0x59fc('0x1cb')]['hasMany'](db['VtigerConfiguration'],{'as':_0x59fc('0x1c4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1b9')});db[_0x59fc('0xc0')][_0x59fc('0x112')](db['VtigerField'],{'as':'Subjects','foreignKey':_0x59fc('0x1be')});db[_0x59fc('0xc0')][_0x59fc('0x112')](db[_0x59fc('0xc2')],{'as':_0x59fc('0x1bb'),'foreignKey':_0x59fc('0x1bc')});db['VtigerConfiguration']['hasMany'](db[_0x59fc('0xc2')],{'as':_0x59fc('0x1b4'),'foreignKey':_0x59fc('0x1c3')});db[_0x59fc('0xc0')][_0x59fc('0x11f')](db[_0x59fc('0x1cb')],{'as':'Account','foreignKey':_0x59fc('0x1b9')});db[_0x59fc('0xc2')][_0x59fc('0x112')](db[_0x59fc('0xc2')],{'as':_0x59fc('0x1bd'),'foreignKey':_0x59fc('0x1be')});db[_0x59fc('0xc2')]['hasMany'](db['VtigerField'],{'as':_0x59fc('0x1bf'),'foreignKey':_0x59fc('0x1bc')});db['VtigerField'][_0x59fc('0x112')](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db[_0x59fc('0xc2')][_0x59fc('0x11f')](db[_0x59fc('0x98')],{'as':_0x59fc('0x98'),'foreignKey':'VariableId'});db[_0x59fc('0xc4')][_0x59fc('0x112')](db[_0x59fc('0xc6')],{'as':_0x59fc('0x1c4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1b9')});db[_0x59fc('0xc6')][_0x59fc('0x112')](db[_0x59fc('0x1cc')],{'as':_0x59fc('0x1ba'),'foreignKey':_0x59fc('0x1be')});db[_0x59fc('0xc6')]['hasMany'](db[_0x59fc('0x1cc')],{'as':_0x59fc('0x1bb'),'foreignKey':'DescriptionId'});db[_0x59fc('0xc6')][_0x59fc('0x112')](db[_0x59fc('0x1cc')],{'as':_0x59fc('0x1b4'),'foreignKey':_0x59fc('0x1c3')});db[_0x59fc('0xc6')][_0x59fc('0x11f')](db[_0x59fc('0xc4')],{'as':_0x59fc('0x173'),'foreignKey':'AccountId'});db[_0x59fc('0x1cc')][_0x59fc('0x112')](db['ServicenowField'],{'as':_0x59fc('0x1bd'),'foreignKey':_0x59fc('0x1be')});db[_0x59fc('0x1cc')][_0x59fc('0x112')](db['ServicenowField'],{'as':_0x59fc('0x1bf'),'foreignKey':'DescriptionId'});db[_0x59fc('0x1cc')]['hasMany'](db[_0x59fc('0x1cc')],{'as':_0x59fc('0x1c0'),'foreignKey':_0x59fc('0x1c3')});db[_0x59fc('0x1cc')]['belongsTo'](db[_0x59fc('0x98')],{'as':_0x59fc('0x98'),'foreignKey':_0x59fc('0x1c1')});db[_0x59fc('0xc9')]['hasMany'](db[_0x59fc('0xcb')],{'as':_0x59fc('0x1c4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1b9')});db['Dynamics365Configuration'][_0x59fc('0x112')](db[_0x59fc('0xcd')],{'as':_0x59fc('0x1ba'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1be')});db['Dynamics365Configuration'][_0x59fc('0x112')](db[_0x59fc('0xcd')],{'as':_0x59fc('0x1bb'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1bc')});db[_0x59fc('0xcb')][_0x59fc('0x112')](db[_0x59fc('0xcd')],{'as':'Fields','onDelete':_0x59fc('0x110'),'foreignKey':'FieldId'});db[_0x59fc('0xcb')][_0x59fc('0x11f')](db[_0x59fc('0xc9')],{'as':_0x59fc('0x173'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x59fc('0x112')](db[_0x59fc('0xcd')],{'as':_0x59fc('0x1bd'),'foreignKey':_0x59fc('0x1be')});db[_0x59fc('0xcd')][_0x59fc('0x112')](db['Dynamics365Field'],{'as':_0x59fc('0x1bf'),'foreignKey':_0x59fc('0x1bc')});db['Dynamics365Field']['hasMany'](db[_0x59fc('0xcd')],{'as':'Field','foreignKey':'FieldId'});db[_0x59fc('0xcd')][_0x59fc('0x11f')](db[_0x59fc('0x98')],{'as':_0x59fc('0x98'),'foreignKey':_0x59fc('0x1c1')});db[_0x59fc('0xce')][_0x59fc('0x112')](db[_0x59fc('0x1cd')],{'as':_0x59fc('0x1c4'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1b9')});db['FreshsalesConfiguration'][_0x59fc('0x112')](db[_0x59fc('0x1ce')],{'as':_0x59fc('0x1ba'),'foreignKey':_0x59fc('0x1be')});db[_0x59fc('0x1cd')]['hasMany'](db['FreshsalesField'],{'as':_0x59fc('0x1bb'),'foreignKey':'DescriptionId'});db[_0x59fc('0x1cd')][_0x59fc('0x112')](db[_0x59fc('0x1ce')],{'as':_0x59fc('0x1b4'),'foreignKey':'FieldId'});db[_0x59fc('0x1cd')][_0x59fc('0x11f')](db[_0x59fc('0xce')],{'as':_0x59fc('0x173'),'foreignKey':'AccountId'});db[_0x59fc('0x1ce')][_0x59fc('0x112')](db[_0x59fc('0x1ce')],{'as':_0x59fc('0x1bd'),'foreignKey':_0x59fc('0x1be')});db[_0x59fc('0x1ce')][_0x59fc('0x112')](db[_0x59fc('0x1ce')],{'as':_0x59fc('0x1bf'),'foreignKey':_0x59fc('0x1bc')});db['FreshsalesField'][_0x59fc('0x112')](db[_0x59fc('0x1ce')],{'as':'Field','foreignKey':'FieldId'});db[_0x59fc('0x1ce')][_0x59fc('0x11f')](db[_0x59fc('0x98')],{'as':'Variable','foreignKey':'VariableId'});db[_0x59fc('0xd4')]['belongsTo'](db['ChatWebsite'],{});db[_0x59fc('0xd4')]['belongsTo'](db[_0x59fc('0xf7')],{'as':'List','foreignKey':_0x59fc('0x17c')});db[_0x59fc('0xd4')][_0x59fc('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':_0x59fc('0x166')});db[_0x59fc('0xd4')][_0x59fc('0x11f')](db[_0x59fc('0x6a')],{});db[_0x59fc('0xd4')][_0x59fc('0x11f')](db['ChatMessage'],{});db[_0x59fc('0xd4')]['belongsTo'](db[_0x59fc('0x12')],{});db[_0x59fc('0xd4')][_0x59fc('0x11f')](db['ChatQueue'],{});db[_0x59fc('0x195')][_0x59fc('0x11f')](db['User'],{'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1cf')});db[_0x59fc('0x195')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'onDelete':_0x59fc('0x110'),'foreignKey':'ToId'});db[_0x59fc('0xd9')]['hasMany'](db[_0x59fc('0xd8')],{'foreignKey':'SessionId','onDelete':_0x59fc('0x110')});db[_0x59fc('0xd9')]['hasMany'](db[_0x59fc('0xd6')],{'foreignKey':_0x59fc('0x1d0'),'onDelete':_0x59fc('0x110')});db['SmsQueueReport'][_0x59fc('0x11f')](db[_0x59fc('0x55')],{});db[_0x59fc('0xdb')][_0x59fc('0x11f')](db[_0x59fc('0xf7')],{'as':_0x59fc('0x16d'),'foreignKey':'ListId'});db[_0x59fc('0xdb')][_0x59fc('0x11f')](db['CmContact'],{'as':_0x59fc('0x165'),'foreignKey':'ContactId'});db[_0x59fc('0xdb')][_0x59fc('0x11f')](db[_0x59fc('0x58')],{});db[_0x59fc('0xdb')][_0x59fc('0x11f')](db[_0x59fc('0x5a')],{});db[_0x59fc('0xdb')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{});db['SmsQueueReport'][_0x59fc('0x11f')](db[_0x59fc('0x5b')],{});db[_0x59fc('0x1d1')][_0x59fc('0x112')](db[_0x59fc('0xd9')],{'foreignKey':_0x59fc('0x1d2')});db[_0x59fc('0x1d1')][_0x59fc('0x112')](db[_0x59fc('0xd8')],{'foreignKey':_0x59fc('0x1d2')});db[_0x59fc('0x1d1')][_0x59fc('0x112')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x59fc('0xe4')]['belongsToMany'](db[_0x59fc('0x12')],{'as':_0x59fc('0x178'),'through':_0x59fc('0x147')});db['Team'][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x129')});db[_0x59fc('0x128')][_0x59fc('0x120')](db[_0x59fc('0x14c')],{'through':_0x59fc('0x15c'),'as':'VoiceQueues'});db['Team'][_0x59fc('0x120')](db['MailQueue'],{'through':_0x59fc('0x171'),'as':_0x59fc('0x1d3')});db[_0x59fc('0x128')][_0x59fc('0x120')](db['ChatQueue'],{'through':_0x59fc('0x194'),'as':_0x59fc('0x133')});db[_0x59fc('0x128')][_0x59fc('0x120')](db[_0x59fc('0x51')],{'through':_0x59fc('0x1d4'),'as':_0x59fc('0x134')});db['Team']['belongsToMany'](db[_0x59fc('0x5b')],{'through':_0x59fc('0x188'),'as':_0x59fc('0x135')});db[_0x59fc('0x128')][_0x59fc('0x120')](db[_0x59fc('0x136')],{'through':_0x59fc('0x18d'),'as':_0x59fc('0x137')});db[_0x59fc('0x128')][_0x59fc('0x120')](db[_0x59fc('0x10b')],{'through':_0x59fc('0x1d5'),'as':'WhatsappQueues'});db['Campaign'][_0x59fc('0x112')](db[_0x59fc('0x14e')],{'as':_0x59fc('0x14f'),'foreignKey':'CampaignId'});db['Campaign'][_0x59fc('0x112')](db[_0x59fc('0x79')],{'as':_0x59fc('0x116'),'foreignKey':'CampaignId'});db[_0x59fc('0x19b')][_0x59fc('0x112')](db[_0x59fc('0x7b')],{'as':_0x59fc('0x151'),'foreignKey':'CampaignId'});db[_0x59fc('0x19b')][_0x59fc('0x112')](db['CmHopperBlack'],{'as':_0x59fc('0x152'),'foreignKey':_0x59fc('0x19d')});db['Campaign'][_0x59fc('0x11f')](db[_0x59fc('0x29')],{'as':_0x59fc('0x29'),'foreignKey':_0x59fc('0x154')});db[_0x59fc('0x19b')][_0x59fc('0x11f')](db[_0x59fc('0x29')],{'as':_0x59fc('0x155'),'foreignKey':_0x59fc('0x156')});db['Campaign']['belongsTo'](db[_0x59fc('0x8a')],{'as':_0x59fc('0x8a'),'foreignKey':'IntervalId'});db[_0x59fc('0x19b')]['belongsTo'](db[_0x59fc('0xe4')],{'as':_0x59fc('0xe4'),'foreignKey':'SquareProjectId'});db[_0x59fc('0x19b')]['belongsToMany'](db[_0x59fc('0xf7')],{'as':_0x59fc('0x126'),'through':'campaigns_has_cm_lists'});db[_0x59fc('0x19b')]['belongsToMany'](db[_0x59fc('0xf7')],{'as':'BlackLists','through':_0x59fc('0x1d6')});db[_0x59fc('0xf1')][_0x59fc('0x11f')](db[_0x59fc('0x43')],{});db[_0x59fc('0xf1')]['belongsTo'](db['MailInteraction'],{});db[_0x59fc('0xf1')]['belongsTo'](db[_0x59fc('0x3c')],{'foreignKey':_0x59fc('0x1d7'),'as':'FromAccount'});db[_0x59fc('0xf1')][_0x59fc('0x11f')](db['User'],{'foreignKey':_0x59fc('0x1d8'),'as':'FromAgent'});db[_0x59fc('0xf1')][_0x59fc('0x11f')](db['User'],{'foreignKey':'ToUserId','as':_0x59fc('0x1d9')});db[_0x59fc('0xf1')][_0x59fc('0x11f')](db[_0x59fc('0x3e')],{'foreignKey':_0x59fc('0x1da'),'as':_0x59fc('0x1db')});db[_0x59fc('0xf1')][_0x59fc('0x11f')](db[_0x59fc('0x3c')],{'foreignKey':_0x59fc('0x1dc'),'as':_0x59fc('0x1dd')});db[_0x59fc('0xf3')]['belongsTo'](db[_0x59fc('0x6c')],{});db['ChatTransferReport'][_0x59fc('0x11f')](db['ChatInteraction'],{});db[_0x59fc('0xf3')]['belongsTo'](db[_0x59fc('0x65')],{'foreignKey':_0x59fc('0x1de'),'as':_0x59fc('0x1df')});db['ChatTransferReport'][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'foreignKey':'FromUserId','as':_0x59fc('0x1e0')});db[_0x59fc('0xf3')]['belongsTo'](db[_0x59fc('0x12')],{'foreignKey':_0x59fc('0x1e1'),'as':_0x59fc('0x1d9')});db[_0x59fc('0xf3')][_0x59fc('0x11f')](db['ChatQueue'],{'foreignKey':_0x59fc('0x1e2'),'as':_0x59fc('0x1db')});db[_0x59fc('0xf3')][_0x59fc('0x11f')](db[_0x59fc('0x65')],{'foreignKey':'ToChatWebsiteId','as':_0x59fc('0x1dd')});db[_0x59fc('0x1e3')][_0x59fc('0x11f')](db[_0x59fc('0x4f')],{});db[_0x59fc('0x1e3')][_0x59fc('0x11f')](db[_0x59fc('0x12c')],{});db['FaxTransferReport'][_0x59fc('0x11f')](db[_0x59fc('0x13d')],{'foreignKey':'FromFaxAccountId','as':_0x59fc('0x1df')});db[_0x59fc('0x1e3')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'foreignKey':_0x59fc('0x1d8'),'as':_0x59fc('0x1e0')});db['FaxTransferReport']['belongsTo'](db[_0x59fc('0x12')],{'foreignKey':_0x59fc('0x1e1'),'as':_0x59fc('0x1d9')});db['FaxTransferReport']['belongsTo'](db['FaxQueue'],{'foreignKey':_0x59fc('0x1e4'),'as':_0x59fc('0x1db')});db[_0x59fc('0x1e3')][_0x59fc('0x11f')](db[_0x59fc('0x13d')],{'foreignKey':'ToFaxAccountId','as':_0x59fc('0x1dd')});db[_0x59fc('0x1e5')][_0x59fc('0x11f')](db['OpenchannelMessage'],{});db[_0x59fc('0x1e5')][_0x59fc('0x11f')](db['OpenchannelInteraction'],{});db[_0x59fc('0x1e5')][_0x59fc('0x11f')](db[_0x59fc('0x5d')],{'foreignKey':_0x59fc('0x1e6'),'as':_0x59fc('0x1df')});db[_0x59fc('0x1e5')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'foreignKey':_0x59fc('0x1d8'),'as':'FromAgent'});db[_0x59fc('0x1e5')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'foreignKey':_0x59fc('0x1e1'),'as':_0x59fc('0x1d9')});db[_0x59fc('0x1e5')][_0x59fc('0x11f')](db['OpenchannelQueue'],{'foreignKey':_0x59fc('0x1e7'),'as':_0x59fc('0x1db')});db['OpenchannelTransferReport'][_0x59fc('0x11f')](db[_0x59fc('0x5d')],{'foreignKey':_0x59fc('0x1e8'),'as':_0x59fc('0x1dd')});db[_0x59fc('0xf6')]['belongsTo'](db[_0x59fc('0x5a')],{});db[_0x59fc('0xf6')][_0x59fc('0x11f')](db[_0x59fc('0x58')],{});db[_0x59fc('0xf6')][_0x59fc('0x11f')](db[_0x59fc('0x55')],{'foreignKey':'FromSmsAccountId','as':_0x59fc('0x1df')});db[_0x59fc('0xf6')]['belongsTo'](db[_0x59fc('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db['SmsTransferReport'][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'foreignKey':_0x59fc('0x1e1'),'as':_0x59fc('0x1d9')});db[_0x59fc('0xf6')][_0x59fc('0x11f')](db[_0x59fc('0x5b')],{'foreignKey':_0x59fc('0x1e9'),'as':_0x59fc('0x1db')});db[_0x59fc('0xf6')][_0x59fc('0x11f')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x59fc('0x1dd')});db[_0x59fc('0xf7')][_0x59fc('0x112')](db[_0x59fc('0x86')],{'as':_0x59fc('0x16a'),'foreignKey':_0x59fc('0x17c')});db[_0x59fc('0xf7')][_0x59fc('0x112')](db[_0x59fc('0x7f')],{'as':_0x59fc('0x1ea'),'foreignKey':_0x59fc('0x17c')});db['CmList'][_0x59fc('0x112')](db[_0x59fc('0x74')],{'as':'Contacts','onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x17c')});db[_0x59fc('0xf7')][_0x59fc('0x112')](db['CmHopperFinal'],{'as':_0x59fc('0x116'),'foreignKey':_0x59fc('0x17c')});db[_0x59fc('0xf7')]['hasMany'](db[_0x59fc('0x7b')],{'as':_0x59fc('0x117'),'foreignKey':_0x59fc('0x17c')});db['CmList']['hasMany'](db[_0x59fc('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0x59fc('0x17c')});db[_0x59fc('0xf7')][_0x59fc('0x120')](db['VoiceQueue'],{'as':_0x59fc('0x1eb'),'through':_0x59fc('0x159')});db[_0x59fc('0xf7')][_0x59fc('0x120')](db['User'],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x127')});db[_0x59fc('0xf9')][_0x59fc('0x112')](db['VoiceExtension'],{'as':_0x59fc('0x115'),'onDelete':'cascade'});db[_0x59fc('0xf9')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x13a')});db[_0x59fc('0xfb')][_0x59fc('0x112')](db[_0x59fc('0x12')],{'as':_0x59fc('0x178'),'foreignKey':_0x59fc('0x1ec')});db[_0x59fc('0xfb')][_0x59fc('0x112')](db[_0x59fc('0xfd')],{'as':_0x59fc('0x1ed'),'foreignKey':_0x59fc('0x1ec'),'onDelete':_0x59fc('0x110')});db['UserProfileSection'][_0x59fc('0x112')](db[_0x59fc('0xff')],{'as':_0x59fc('0x1ee'),'foreignKey':_0x59fc('0x1ef'),'onDelete':'cascade'});db[_0x59fc('0x145')][_0x59fc('0x112')](db[_0x59fc('0x86')],{'as':_0x59fc('0x16a'),'foreignKey':_0x59fc('0x1f0')});db[_0x59fc('0x145')]['hasMany'](db['CannedAnswer'],{'as':_0x59fc('0x17e'),'foreignKey':_0x59fc('0x1f0')});db['WhatsappAccount'][_0x59fc('0x112')](db['WhatsappMessage'],{'as':_0x59fc('0x15f'),'foreignKey':_0x59fc('0x1f0')});db[_0x59fc('0x145')][_0x59fc('0x112')](db[_0x59fc('0x105')],{'as':'Interactions'});db[_0x59fc('0x145')][_0x59fc('0x112')](db[_0x59fc('0x104')],{'as':_0x59fc('0x14a')});db[_0x59fc('0x145')][_0x59fc('0x11f')](db['CmList'],{'as':'List','foreignKey':_0x59fc('0x17c')});db[_0x59fc('0x145')][_0x59fc('0x11f')](db[_0x59fc('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x59fc('0x158')});db[_0x59fc('0x145')][_0x59fc('0x120')](db['User'],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x1f1')});db['WhatsappApplication']['belongsTo'](db[_0x59fc('0x12')],{'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x104')][_0x59fc('0x11f')](db[_0x59fc('0x10b')],{'onDelete':_0x59fc('0x17b')});db[_0x59fc('0x104')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x59fc('0x17b')});db['WhatsappApplication'][_0x59fc('0x11f')](db[_0x59fc('0x8a')],{'onDelete':_0x59fc('0x17b'),'foreignKey':'IntervalId'});db[_0x59fc('0x104')][_0x59fc('0x11f')](db[_0x59fc('0x94')],{'onDelete':_0x59fc('0x17b'),'foreignKey':'TagId'});db[_0x59fc('0x105')][_0x59fc('0x112')](db[_0x59fc('0x107')],{'as':_0x59fc('0x15f'),'onDelete':_0x59fc('0x110'),'foreignKey':_0x59fc('0x1f2')});db[_0x59fc('0x105')][_0x59fc('0x11f')](db[_0x59fc('0x145')],{'as':'Account','foreignKey':_0x59fc('0x1f0')});db[_0x59fc('0x105')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x59fc('0x105')]['belongsTo'](db[_0x59fc('0x12')],{'as':'Owner','foreignKey':_0x59fc('0x111')});db['WhatsappInteraction'][_0x59fc('0x120')](db[_0x59fc('0x94')],{'through':'whatsapp_interaction_has_tags','as':_0x59fc('0x176')});db[_0x59fc('0x105')]['belongsToMany'](db[_0x59fc('0x94')],{'through':_0x59fc('0x1ae'),'as':_0x59fc('0x177')});db[_0x59fc('0x105')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':'Users','through':_0x59fc('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x59fc('0x107')][_0x59fc('0x11f')](db['User'],{'as':_0x59fc('0x12')});db[_0x59fc('0x107')][_0x59fc('0x11f')](db[_0x59fc('0x74')],{'onDelete':_0x59fc('0x110'),'as':'Contact'});db[_0x59fc('0x107')][_0x59fc('0x11f')](db[_0x59fc('0x105')],{'onDelete':'cascade','as':_0x59fc('0x17a'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db[_0x59fc('0x145')],{'as':_0x59fc('0x173'),'foreignKey':_0x59fc('0x1f0')});db['WhatsappQueueReport'][_0x59fc('0x11f')](db[_0x59fc('0x145')],{});db[_0x59fc('0x108')][_0x59fc('0x11f')](db['CmList'],{'as':_0x59fc('0x16d'),'foreignKey':_0x59fc('0x17c')});db[_0x59fc('0x108')][_0x59fc('0x11f')](db[_0x59fc('0x74')],{'as':_0x59fc('0x165'),'foreignKey':_0x59fc('0x166')});db['WhatsappQueueReport'][_0x59fc('0x11f')](db[_0x59fc('0x105')],{});db['WhatsappQueueReport'][_0x59fc('0x11f')](db[_0x59fc('0x10b')],{});db['WhatsappQueueReport'][_0x59fc('0x11f')](db[_0x59fc('0x107')],{});db[_0x59fc('0x108')][_0x59fc('0x11f')](db[_0x59fc('0x12')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x59fc('0x107')],{});db[_0x59fc('0x1f3')][_0x59fc('0x11f')](db[_0x59fc('0x105')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x59fc('0x145')],{'foreignKey':_0x59fc('0x1f4'),'as':_0x59fc('0x1df')});db[_0x59fc('0x1f3')][_0x59fc('0x11f')](db[_0x59fc('0x145')],{'foreignKey':_0x59fc('0x1f5'),'as':'ToAccount'});db[_0x59fc('0x1f3')][_0x59fc('0x11f')](db[_0x59fc('0x10b')],{'foreignKey':_0x59fc('0x1f6'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0x59fc('0x12')],{'foreignKey':'FromUserId','as':_0x59fc('0x1e0')});db['WhatsappTransferReport'][_0x59fc('0x11f')](db[_0x59fc('0x12')],{'foreignKey':_0x59fc('0x1e1'),'as':_0x59fc('0x1d9')});db[_0x59fc('0x10b')][_0x59fc('0x120')](db[_0x59fc('0x12')],{'as':_0x59fc('0x15a'),'through':_0x59fc('0x39'),'foreignKey':_0x59fc('0x1f7')});db['WhatsappQueue'][_0x59fc('0x120')](db[_0x59fc('0x128')],{'through':'team_has_whatsapp_queues','as':_0x59fc('0x15b')});module[_0x59fc('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ac71b41..0da67ab 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6c8=['/api/cm/custom_fields','./api/cmCustomField','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/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/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/notifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','/demo','/snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','/index.html','path','express-winston','util','./errors','./config/logger','api','auth','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','headers','x-forwarded-for','connection','remoteAddress','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','url','statusCode','other','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history'];(function(_0x5a3c8e,_0x2c97c2){var _0xddc192=function(_0x461e55){while(--_0x461e55){_0x5a3c8e['push'](_0x5a3c8e['shift']());}};_0xddc192(++_0x2c97c2);}(_0xb6c8,0x1b4));var _0x8b6c=function(_0x22e011,_0xff7e8d){_0x22e011=_0x22e011-0x0;var _0x209e2b=_0xb6c8[_0x22e011];return _0x209e2b;};'use strict';var path=require(_0x8b6c('0x0'));var express=require('express');var ewinston=require(_0x8b6c('0x1'));var util=require(_0x8b6c('0x2'));var errors=require(_0x8b6c('0x3'));var config=require('./config/environment');var logger=require(_0x8b6c('0x4'))(_0x8b6c('0x5'));var authLogger=require('./config/logger')(_0x8b6c('0x6'));exports['default']=function(_0x4b1f58){_0x4b1f58[_0x8b6c('0x7')](ewinston[_0x8b6c('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x143d36,_0x313812){return util[_0x8b6c('0x9')](_0x8b6c('0xa'),_0x143d36['method'],_0x143d36[_0x8b6c('0xb')][_0x8b6c('0xc')]?_0x143d36[_0x8b6c('0xb')]['x-forwarded-for']:_0x143d36[_0x8b6c('0xd')][_0x8b6c('0xe')]||_0x143d36['ip'],_0x143d36['url'],_0x313812['statusCode'],_0x313812[_0x8b6c('0xf')],_0x143d36['user']?_0x143d36['user']['id']:null,_0x143d36[_0x8b6c('0x10')]?_0x143d36[_0x8b6c('0x10')][_0x8b6c('0x11')]:null,_0x143d36[_0x8b6c('0x10')]?_0x143d36['user'][_0x8b6c('0x12')]:null);}}));_0x4b1f58['use'](ewinston[_0x8b6c('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2c56a1,_0x2ec73c){var _0x3fa37f=_0x8b6c('0x13');if(_0x2c56a1['body']&&_0x2c56a1[_0x8b6c('0x14')][_0x8b6c('0x15')]&&_0x2c56a1[_0x8b6c('0x14')][_0x8b6c('0x16')]){_0x3fa37f=_0x8b6c('0x17');}return util['format'](_0x3fa37f,_0x2c56a1[_0x8b6c('0x18')],_0x2c56a1['headers'][_0x8b6c('0xc')]?_0x2c56a1[_0x8b6c('0xb')][_0x8b6c('0xc')]:_0x2c56a1[_0x8b6c('0xd')]['remoteAddress']||_0x2c56a1['ip'],_0x2c56a1[_0x8b6c('0x19')],_0x2ec73c[_0x8b6c('0x1a')],_0x2ec73c[_0x8b6c('0xf')],_0x2c56a1['user']?_0x2c56a1[_0x8b6c('0x10')]['id']:null,_0x2c56a1[_0x8b6c('0x10')]?_0x2c56a1['user'][_0x8b6c('0x11')]:null,_0x2c56a1[_0x8b6c('0x10')]?_0x2c56a1[_0x8b6c('0x10')]['role']:null,_0x2c56a1[_0x8b6c('0x14')]&&_0x2c56a1[_0x8b6c('0x14')][_0x8b6c('0x15')]?_0x2c56a1[_0x8b6c('0x14')][_0x8b6c('0x15')]:_0x8b6c('0x1b'),_0x2c56a1[_0x8b6c('0x14')]&&_0x2c56a1['body'][_0x8b6c('0x16')]?_0x2c56a1[_0x8b6c('0x14')][_0x8b6c('0x16')]:'',_0x2c56a1[_0x8b6c('0x14')]&&_0x2c56a1[_0x8b6c('0x14')]['agent_name']?_0x2c56a1['body'][_0x8b6c('0x1c')]:'');},'ignoreRoute':function(_0x3b37a8){var _0x364956=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x364956[_0x8b6c('0x1d')](_0x3b37a8[_0x8b6c('0x19')]);}}));_0x4b1f58[_0x8b6c('0x7')]('/api/users',require(_0x8b6c('0x1e')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x1f'),require(_0x8b6c('0x20')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x21'),require(_0x8b6c('0x22')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x23'),require(_0x8b6c('0x24')));_0x4b1f58[_0x8b6c('0x7')]('/api/voice/mohs',require(_0x8b6c('0x25')));_0x4b1f58['use']('/api/voice/queues',require(_0x8b6c('0x26')));_0x4b1f58[_0x8b6c('0x7')]('/api/voice/recordings',require(_0x8b6c('0x27')));_0x4b1f58[_0x8b6c('0x7')]('/api/screen/recordings',require(_0x8b6c('0x28')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x29'),require(_0x8b6c('0x2a')));_0x4b1f58['use'](_0x8b6c('0x2b'),require(_0x8b6c('0x2c')));_0x4b1f58[_0x8b6c('0x7')]('/api/voice/calls/reports',require(_0x8b6c('0x2d')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x2e'),require(_0x8b6c('0x2f')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x30'),require(_0x8b6c('0x31')));_0x4b1f58['use'](_0x8b6c('0x32'),require('./api/voiceQueueReport'));_0x4b1f58['use'](_0x8b6c('0x33'),require(_0x8b6c('0x34')));_0x4b1f58[_0x8b6c('0x7')]('/api/trunks',require(_0x8b6c('0x35')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x36'),require(_0x8b6c('0x37')));_0x4b1f58[_0x8b6c('0x7')]('/api/mail/out_servers',require(_0x8b6c('0x38')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x39'),require(_0x8b6c('0x3a')));_0x4b1f58['use'](_0x8b6c('0x3b'),require(_0x8b6c('0x3c')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x3d'),require('./api/mailSubstatus'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x3e'),require(_0x8b6c('0x3f')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x40'),require(_0x8b6c('0x41')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x42'),require('./api/mailApplication'));_0x4b1f58[_0x8b6c('0x7')]('/api/mail/reports/queue',require(_0x8b6c('0x43')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x44'),require('./api/dashboard'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x45'),require(_0x8b6c('0x46')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x47'),require(_0x8b6c('0x48')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x49'),require(_0x8b6c('0x4a')));_0x4b1f58[_0x8b6c('0x7')]('/api/fax/interactions',require(_0x8b6c('0x4b')));_0x4b1f58['use'](_0x8b6c('0x4c'),require(_0x8b6c('0x4d')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x4e'),require(_0x8b6c('0x4f')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x50'),require(_0x8b6c('0x51')));_0x4b1f58['use'](_0x8b6c('0x52'),require('./api/smsAccount'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x53'),require('./api/smsApplication'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x54'),require(_0x8b6c('0x55')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x56'),require('./api/smsMessage'));_0x4b1f58['use'](_0x8b6c('0x57'),require(_0x8b6c('0x58')));_0x4b1f58[_0x8b6c('0x7')]('/api/openchannel/accounts',require(_0x8b6c('0x59')));_0x4b1f58['use'](_0x8b6c('0x5a'),require(_0x8b6c('0x5b')));_0x4b1f58['use'](_0x8b6c('0x5c'),require(_0x8b6c('0x5d')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x5e'),require(_0x8b6c('0x5f')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x60'),require('./api/openchannelQueue'));_0x4b1f58['use']('/api/chat/websites',require(_0x8b6c('0x61')));_0x4b1f58[_0x8b6c('0x7')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x62'),require('./api/chatApplication'));_0x4b1f58['use'](_0x8b6c('0x63'),require(_0x8b6c('0x64')));_0x4b1f58['use'](_0x8b6c('0x65'),require(_0x8b6c('0x66')));_0x4b1f58[_0x8b6c('0x7')]('/api/chat/offline_messages',require(_0x8b6c('0x67')));_0x4b1f58[_0x8b6c('0x7')]('/api/chat/queues',require(_0x8b6c('0x68')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x69'),require(_0x8b6c('0x6a')));_0x4b1f58[_0x8b6c('0x7')]('/api/chat/proactive_actions',require(_0x8b6c('0x6b')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x6c'),require(_0x8b6c('0x6d')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x6e'),require(_0x8b6c('0x6f')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x70'),require(_0x8b6c('0x71')));_0x4b1f58[_0x8b6c('0x7')]('/api/cm/hopper_black',require(_0x8b6c('0x72')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x73'),require(_0x8b6c('0x74')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x75'),require('./api/cmHopperHistory'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x76'),require(_0x8b6c('0x77')));_0x4b1f58['use']('/api/actions',require(_0x8b6c('0x78')));_0x4b1f58['use']('/api/automations',require(_0x8b6c('0x79')));_0x4b1f58['use'](_0x8b6c('0x7a'),require(_0x8b6c('0x7b')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x7c'),require(_0x8b6c('0x7d')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x7e'),require(_0x8b6c('0x7f')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x80'),require('./api/interval'));_0x4b1f58['use']('/api/pauses',require(_0x8b6c('0x81')));_0x4b1f58['use']('/api/cdr',require(_0x8b6c('0x82')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x83'),require(_0x8b6c('0x84')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x85'),require('./api/schedule'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x86'),require('./api/sound'));_0x4b1f58['use'](_0x8b6c('0x87'),require(_0x8b6c('0x88')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x89'),require(_0x8b6c('0x8a')));_0x4b1f58['use'](_0x8b6c('0x8b'),require(_0x8b6c('0x8c')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x8d'),require(_0x8b6c('0x8e')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x8f'),require('./api/integration'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x90'),require('./api/integrationReport'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x91'),require('./api/analyticCustomReport'));_0x4b1f58[_0x8b6c('0x7')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x4b1f58['use'](_0x8b6c('0x92'),require(_0x8b6c('0x93')));_0x4b1f58[_0x8b6c('0x7')]('/api/analytics/metrics',require(_0x8b6c('0x94')));_0x4b1f58[_0x8b6c('0x7')]('/api/analytics/field_reports',require(_0x8b6c('0x95')));_0x4b1f58[_0x8b6c('0x7')]('/api/analytics/tree_reports',require(_0x8b6c('0x96')));_0x4b1f58['use'](_0x8b6c('0x97'),require(_0x8b6c('0x98')));_0x4b1f58[_0x8b6c('0x7')]('/api/integrations/salesforce/configurations',require(_0x8b6c('0x99')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x9a'),require('./api/intSalesforceField'));_0x4b1f58[_0x8b6c('0x7')]('/api/integrations/sugarcrm/accounts',require(_0x8b6c('0x9b')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x9c'),require(_0x8b6c('0x9d')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x9e'),require(_0x8b6c('0x9f')));_0x4b1f58[_0x8b6c('0x7')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xa0'),require(_0x8b6c('0xa1')));_0x4b1f58[_0x8b6c('0x7')]('/api/integrations/desk/fields',require(_0x8b6c('0xa2')));_0x4b1f58['use']('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x4b1f58['use'](_0x8b6c('0xa3'),require(_0x8b6c('0xa4')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xa5'),require('./api/intZohoField'));_0x4b1f58[_0x8b6c('0x7')]('/api/integrations/zendesk/accounts',require(_0x8b6c('0xa6')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xa7'),require('./api/intZendeskConfiguration'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xa8'),require(_0x8b6c('0xa9')));_0x4b1f58[_0x8b6c('0x7')]('/api/integrations/freshdesk/accounts',require(_0x8b6c('0xaa')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xab'),require(_0x8b6c('0xac')));_0x4b1f58['use']('/api/integrations/freshdesk/fields',require(_0x8b6c('0xad')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xae'),require(_0x8b6c('0xaf')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xb0'),require(_0x8b6c('0xb1')));_0x4b1f58['use'](_0x8b6c('0xb2'),require(_0x8b6c('0xb3')));_0x4b1f58['use'](_0x8b6c('0xb4'),require(_0x8b6c('0xb5')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xb6'),require(_0x8b6c('0xb7')));_0x4b1f58[_0x8b6c('0x7')]('/api/integrations/servicenow/fields',require(_0x8b6c('0xb8')));_0x4b1f58['use'](_0x8b6c('0xb9'),require(_0x8b6c('0xba')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xbb'),require(_0x8b6c('0xbc')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xbd'),require(_0x8b6c('0xbe')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xbf'),require('./api/intFreshsalesAccount'));_0x4b1f58['use'](_0x8b6c('0xc0'),require(_0x8b6c('0xc1')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xc2'),require('./api/intFreshsalesField'));_0x4b1f58['use'](_0x8b6c('0xc3'),require(_0x8b6c('0xc4')));_0x4b1f58[_0x8b6c('0x7')]('/api/chat/reports/queue',require(_0x8b6c('0xc5')));_0x4b1f58[_0x8b6c('0x7')]('/api/chat/internal/messages',require(_0x8b6c('0xc6')));_0x4b1f58['use'](_0x8b6c('0xc7'),require(_0x8b6c('0xc8')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xc9'),require('./api/jscriptyQuestionReport'));_0x4b1f58['use']('/api/jscripty/sessions/reports',require(_0x8b6c('0xca')));_0x4b1f58[_0x8b6c('0x7')]('/api/sms/reports/queue',require(_0x8b6c('0xcb')));_0x4b1f58[_0x8b6c('0x7')]('/api/square/reports',require(_0x8b6c('0xcc')));_0x4b1f58['use'](_0x8b6c('0xcd'),require('./api/squareReportDetail'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xce'),require(_0x8b6c('0xcf')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xd0'),require('./api/setting'));_0x4b1f58['use'](_0x8b6c('0xd1'),require(_0x8b6c('0xd2')));_0x4b1f58['use'](_0x8b6c('0xd3'),require(_0x8b6c('0xd4')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xd5'),require(_0x8b6c('0xd6')));_0x4b1f58['use'](_0x8b6c('0xd7'),require(_0x8b6c('0xd8')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xd9'),require(_0x8b6c('0xda')));_0x4b1f58[_0x8b6c('0x7')]('/api/license',require(_0x8b6c('0xdb')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xdc'),require(_0x8b6c('0xdd')));_0x4b1f58[_0x8b6c('0x7')]('/api/migrations',require(_0x8b6c('0xde')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xdf'),require('./api/attachment'));_0x4b1f58['use'](_0x8b6c('0xe0'),require(_0x8b6c('0xe1')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xe2'),require('./api/mailTransferReport'));_0x4b1f58['use'](_0x8b6c('0xe3'),require(_0x8b6c('0xe4')));_0x4b1f58[_0x8b6c('0x7')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x4b1f58[_0x8b6c('0x7')]('/api/openchannel/reports/transfer',require(_0x8b6c('0xe5')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xe6'),require('./api/smsTransferReport'));_0x4b1f58[_0x8b6c('0x7')]('/api/cm/lists',require(_0x8b6c('0xe7')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xe8'),require('./api/voicePrefix'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xe9'),require(_0x8b6c('0xea')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xeb'),require(_0x8b6c('0xec')));_0x4b1f58[_0x8b6c('0x7')]('/api/userProfile/resources',require(_0x8b6c('0xed')));_0x4b1f58['use'](_0x8b6c('0xee'),require('./api/notification'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xef'),require(_0x8b6c('0xf0')));_0x4b1f58['use'](_0x8b6c('0xf1'),require('./api/whatsappApplication'));_0x4b1f58[_0x8b6c('0x7')]('/api/whatsapp/interactions',require(_0x8b6c('0xf2')));_0x4b1f58['use'](_0x8b6c('0xf3'),require(_0x8b6c('0xf4')));_0x4b1f58['use'](_0x8b6c('0xf5'),require(_0x8b6c('0xf6')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xf7'),require(_0x8b6c('0xf8')));_0x4b1f58[_0x8b6c('0x7')]('/api/whatsapp/queues',require(_0x8b6c('0xf9')));_0x4b1f58[_0x8b6c('0x7')]('/api/cloudProviders',require(_0x8b6c('0xfa')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xfb'),require('./api/authLocal'));_0x4b1f58['use']('/api/auth/google',require('./api/authGoogle'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0xfc'),require(_0x8b6c('0xfd')));_0x4b1f58['use']('/api/rpc',require(_0x8b6c('0xfe')));_0x4b1f58['use'](_0x8b6c('0xff'),require(_0x8b6c('0x100')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x101'),require(_0x8b6c('0x102')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x103'),require('./api/pm2'));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x104'),require(_0x8b6c('0x105')));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x106'),express[_0x8b6c('0x107')](path[_0x8b6c('0x108')](config['root'],_0x8b6c('0x106'))));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x109'),express['static'](path[_0x8b6c('0x108')](config[_0x8b6c('0x10a')],'/www')));_0x4b1f58['use']('/demo',express[_0x8b6c('0x107')](path[_0x8b6c('0x108')](config[_0x8b6c('0x10a')],_0x8b6c('0x10b'))));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x10c'),express[_0x8b6c('0x107')](path['join'](config[_0x8b6c('0x10a')],'snippet',_0x8b6c('0x10d'))));_0x4b1f58[_0x8b6c('0x7')](_0x8b6c('0x10e'),express[_0x8b6c('0x107')](path[_0x8b6c('0x108')](config[_0x8b6c('0x10a')],_0x8b6c('0x10f'))));_0x4b1f58[_0x8b6c('0x110')](_0x8b6c('0x111'))[_0x8b6c('0x112')](errors[0x194]);_0x4b1f58[_0x8b6c('0x110')]('/*')[_0x8b6c('0x112')](function(_0x3b01e7,_0x4d54c0){_0x4d54c0[_0x8b6c('0x113')](path['resolve'](_0x4b1f58[_0x8b6c('0x112')]('appPath')+_0x8b6c('0x114')));});}; \ No newline at end of file +var _0x4a4c=['./api/template','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/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/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','root','/www','join','/demo','/snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','util','./errors','./config/environment','./config/logger','auth','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','url','user','name','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)','remoteAddress','responseTime','role','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./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/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates'];(function(_0x77e3fd,_0x2d48c0){var _0x4e0079=function(_0x2939ea){while(--_0x2939ea){_0x77e3fd['push'](_0x77e3fd['shift']());}};_0x4e0079(++_0x2d48c0);}(_0x4a4c,0x93));var _0xc4a4=function(_0x19ec7c,_0x5765f1){_0x19ec7c=_0x19ec7c-0x0;var _0x435150=_0x4a4c[_0x19ec7c];return _0x435150;};'use strict';var path=require(_0xc4a4('0x0'));var express=require(_0xc4a4('0x1'));var ewinston=require('express-winston');var util=require(_0xc4a4('0x2'));var errors=require(_0xc4a4('0x3'));var config=require(_0xc4a4('0x4'));var logger=require('./config/logger')('api');var authLogger=require(_0xc4a4('0x5'))(_0xc4a4('0x6'));exports['default']=function(_0x39b3f4){_0x39b3f4[_0xc4a4('0x7')](ewinston[_0xc4a4('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x561e0b,_0x478e1a){return util[_0xc4a4('0x9')](_0xc4a4('0xa'),_0x561e0b[_0xc4a4('0xb')],_0x561e0b[_0xc4a4('0xc')]['x-forwarded-for']?_0x561e0b['headers'][_0xc4a4('0xd')]:_0x561e0b[_0xc4a4('0xe')]['remoteAddress']||_0x561e0b['ip'],_0x561e0b[_0xc4a4('0xf')],_0x478e1a['statusCode'],_0x478e1a['responseTime'],_0x561e0b[_0xc4a4('0x10')]?_0x561e0b[_0xc4a4('0x10')]['id']:null,_0x561e0b[_0xc4a4('0x10')]?_0x561e0b['user'][_0xc4a4('0x11')]:null,_0x561e0b['user']?_0x561e0b[_0xc4a4('0x10')]['role']:null);}}));_0x39b3f4[_0xc4a4('0x7')](ewinston[_0xc4a4('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xa4a23,_0x3507e0){var _0xf20605='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xa4a23['body']&&_0xa4a23[_0xc4a4('0x12')][_0xc4a4('0x13')]&&_0xa4a23[_0xc4a4('0x12')][_0xc4a4('0x14')]){_0xf20605=_0xc4a4('0x15');}return util[_0xc4a4('0x9')](_0xf20605,_0xa4a23[_0xc4a4('0xb')],_0xa4a23['headers'][_0xc4a4('0xd')]?_0xa4a23[_0xc4a4('0xc')]['x-forwarded-for']:_0xa4a23[_0xc4a4('0xe')][_0xc4a4('0x16')]||_0xa4a23['ip'],_0xa4a23[_0xc4a4('0xf')],_0x3507e0['statusCode'],_0x3507e0[_0xc4a4('0x17')],_0xa4a23['user']?_0xa4a23[_0xc4a4('0x10')]['id']:null,_0xa4a23[_0xc4a4('0x10')]?_0xa4a23[_0xc4a4('0x10')][_0xc4a4('0x11')]:null,_0xa4a23['user']?_0xa4a23[_0xc4a4('0x10')][_0xc4a4('0x18')]:null,_0xa4a23[_0xc4a4('0x12')]&&_0xa4a23[_0xc4a4('0x12')][_0xc4a4('0x13')]?_0xa4a23['body'][_0xc4a4('0x13')]:'other',_0xa4a23[_0xc4a4('0x12')]&&_0xa4a23[_0xc4a4('0x12')][_0xc4a4('0x14')]?_0xa4a23[_0xc4a4('0x12')]['agent_id']:'',_0xa4a23[_0xc4a4('0x12')]&&_0xa4a23[_0xc4a4('0x12')][_0xc4a4('0x19')]?_0xa4a23['body']['agent_name']:'');},'ignoreRoute':function(_0x54ab94){var _0x3fd998=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3fd998[_0xc4a4('0x1a')](_0x54ab94[_0xc4a4('0xf')]);}}));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x1b'),require(_0xc4a4('0x1c')));_0x39b3f4['use'](_0xc4a4('0x1d'),require(_0xc4a4('0x1e')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x1f'),require('./api/voiceContext'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x20'),require('./api/voiceExtension'));_0x39b3f4[_0xc4a4('0x7')]('/api/voice/mohs',require(_0xc4a4('0x21')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x22'),require(_0xc4a4('0x23')));_0x39b3f4['use']('/api/voice/recordings',require('./api/voiceRecording'));_0x39b3f4[_0xc4a4('0x7')]('/api/screen/recordings',require(_0xc4a4('0x24')));_0x39b3f4[_0xc4a4('0x7')]('/api/voice/mails',require(_0xc4a4('0x25')));_0x39b3f4[_0xc4a4('0x7')]('/api/voice/mails/messages',require(_0xc4a4('0x26')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x27'),require(_0xc4a4('0x28')));_0x39b3f4[_0xc4a4('0x7')]('/api/voice/dials/reports',require(_0xc4a4('0x29')));_0x39b3f4[_0xc4a4('0x7')]('/api/voice/agents/reports',require(_0xc4a4('0x2a')));_0x39b3f4[_0xc4a4('0x7')]('/api/voice/queues/reports',require(_0xc4a4('0x2b')));_0x39b3f4['use'](_0xc4a4('0x2c'),require(_0xc4a4('0x2d')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x2e'),require(_0xc4a4('0x2f')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x30'),require(_0xc4a4('0x31')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x32'),require(_0xc4a4('0x33')));_0x39b3f4[_0xc4a4('0x7')]('/api/mail/accounts',require('./api/mailAccount'));_0x39b3f4[_0xc4a4('0x7')]('/api/mail/queues',require(_0xc4a4('0x34')));_0x39b3f4[_0xc4a4('0x7')]('/api/mail/substatuses',require(_0xc4a4('0x35')));_0x39b3f4['use'](_0xc4a4('0x36'),require(_0xc4a4('0x37')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x38'),require(_0xc4a4('0x39')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x3a'),require(_0xc4a4('0x3b')));_0x39b3f4[_0xc4a4('0x7')]('/api/mail/reports/queue',require(_0xc4a4('0x3c')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x3d'),require(_0xc4a4('0x3e')));_0x39b3f4['use']('/api/dashboards/items',require(_0xc4a4('0x3f')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x40'),require(_0xc4a4('0x41')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x42'),require('./api/faxApplication'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x43'),require(_0xc4a4('0x44')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x45'),require('./api/faxMessage'));_0x39b3f4['use'](_0xc4a4('0x46'),require(_0xc4a4('0x47')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x48'),require('./api/faxQueueReport'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x49'),require('./api/smsAccount'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x4a'),require(_0xc4a4('0x4b')));_0x39b3f4['use'](_0xc4a4('0x4c'),require(_0xc4a4('0x4d')));_0x39b3f4['use'](_0xc4a4('0x4e'),require(_0xc4a4('0x4f')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x50'),require(_0xc4a4('0x51')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x52'),require(_0xc4a4('0x53')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x54'),require(_0xc4a4('0x55')));_0x39b3f4[_0xc4a4('0x7')]('/api/openchannel/interactions',require(_0xc4a4('0x56')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x57'),require('./api/openchannelMessage'));_0x39b3f4['use']('/api/openchannel/queues',require(_0xc4a4('0x58')));_0x39b3f4['use'](_0xc4a4('0x59'),require(_0xc4a4('0x5a')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x5b'),require('./api/openchannelQueueReport'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x5c'),require(_0xc4a4('0x5d')));_0x39b3f4[_0xc4a4('0x7')]('/api/chat/interactions',require(_0xc4a4('0x5e')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x5f'),require(_0xc4a4('0x60')));_0x39b3f4['use'](_0xc4a4('0x61'),require('./api/chatOfflineMessage'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x62'),require(_0xc4a4('0x63')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x64'),require(_0xc4a4('0x65')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x66'),require(_0xc4a4('0x67')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x68'),require(_0xc4a4('0x69')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x6a'),require(_0xc4a4('0x6b')));_0x39b3f4[_0xc4a4('0x7')]('/api/cm/hopper',require('./api/cmHopper'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x6c'),require(_0xc4a4('0x6d')));_0x39b3f4['use']('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x6e'),require(_0xc4a4('0x6f')));_0x39b3f4[_0xc4a4('0x7')]('/api/cm/custom_fields',require(_0xc4a4('0x70')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x71'),require(_0xc4a4('0x72')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x73'),require(_0xc4a4('0x74')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x75'),require(_0xc4a4('0x76')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x77'),require(_0xc4a4('0x78')));_0x39b3f4['use'](_0xc4a4('0x79'),require('./api/condition'));_0x39b3f4['use'](_0xc4a4('0x7a'),require('./api/interval'));_0x39b3f4[_0xc4a4('0x7')]('/api/pauses',require('./api/pause'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x7b'),require(_0xc4a4('0x7c')));_0x39b3f4['use'](_0xc4a4('0x7d'),require(_0xc4a4('0x7e')));_0x39b3f4['use'](_0xc4a4('0x7f'),require(_0xc4a4('0x80')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x81'),require(_0xc4a4('0x82')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x83'),require(_0xc4a4('0x84')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x85'),require(_0xc4a4('0x86')));_0x39b3f4['use']('/api/triggers',require(_0xc4a4('0x87')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x88'),require('./api/variable'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x89'),require(_0xc4a4('0x8a')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x8b'),require(_0xc4a4('0x8c')));_0x39b3f4['use'](_0xc4a4('0x8d'),require(_0xc4a4('0x8e')));_0x39b3f4['use']('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x39b3f4['use'](_0xc4a4('0x8f'),require(_0xc4a4('0x90')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x91'),require('./api/analyticMetric'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x92'),require(_0xc4a4('0x93')));_0x39b3f4['use'](_0xc4a4('0x94'),require(_0xc4a4('0x95')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x96'),require(_0xc4a4('0x97')));_0x39b3f4[_0xc4a4('0x7')]('/api/integrations/salesforce/configurations',require(_0xc4a4('0x98')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x99'),require(_0xc4a4('0x9a')));_0x39b3f4['use']('/api/integrations/sugarcrm/accounts',require(_0xc4a4('0x9b')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x9c'),require(_0xc4a4('0x9d')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x9e'),require(_0xc4a4('0x9f')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xa0'),require('./api/intDeskAccount'));_0x39b3f4[_0xc4a4('0x7')]('/api/integrations/desk/configurations',require(_0xc4a4('0xa1')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xa2'),require(_0xc4a4('0xa3')));_0x39b3f4['use'](_0xc4a4('0xa4'),require(_0xc4a4('0xa5')));_0x39b3f4['use'](_0xc4a4('0xa6'),require(_0xc4a4('0xa7')));_0x39b3f4[_0xc4a4('0x7')]('/api/integrations/zoho/fields',require(_0xc4a4('0xa8')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xa9'),require(_0xc4a4('0xaa')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xab'),require('./api/intZendeskConfiguration'));_0x39b3f4['use'](_0xc4a4('0xac'),require(_0xc4a4('0xad')));_0x39b3f4['use'](_0xc4a4('0xae'),require('./api/intFreshdeskAccount'));_0x39b3f4['use'](_0xc4a4('0xaf'),require('./api/intFreshdeskConfiguration'));_0x39b3f4['use'](_0xc4a4('0xb0'),require(_0xc4a4('0xb1')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xb2'),require('./api/intVtigerAccount'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xb3'),require(_0xc4a4('0xb4')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xb5'),require('./api/intVtigerField'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xb6'),require('./api/intServicenowAccount'));_0x39b3f4['use'](_0xc4a4('0xb7'),require('./api/intServicenowConfiguration'));_0x39b3f4[_0xc4a4('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xb8'),require(_0xc4a4('0xb9')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xba'),require(_0xc4a4('0xbb')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xbc'),require(_0xc4a4('0xbd')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xbe'),require(_0xc4a4('0xbf')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xc0'),require(_0xc4a4('0xc1')));_0x39b3f4[_0xc4a4('0x7')]('/api/integrations/freshsales/fields',require(_0xc4a4('0xc2')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xc3'),require(_0xc4a4('0xc4')));_0x39b3f4['use'](_0xc4a4('0xc5'),require(_0xc4a4('0xc6')));_0x39b3f4[_0xc4a4('0x7')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xc7'),require('./api/jscriptyAnswerReport'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xc8'),require(_0xc4a4('0xc9')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xca'),require(_0xc4a4('0xcb')));_0x39b3f4[_0xc4a4('0x7')]('/api/sms/reports/queue',require(_0xc4a4('0xcc')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xcd'),require('./api/squareReport'));_0x39b3f4[_0xc4a4('0x7')]('/api/square/details/reports',require(_0xc4a4('0xce')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xcf'),require(_0xc4a4('0xd0')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xd1'),require('./api/setting'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xd2'),require(_0xc4a4('0xd3')));_0x39b3f4['use'](_0xc4a4('0xd4'),require('./api/squareProject'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xd5'),require('./api/squareRecording'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xd6'),require('./api/squareMessage'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xd7'),require('./api/team'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xd8'),require(_0xc4a4('0xd9')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xda'),require(_0xc4a4('0xdb')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xdc'),require(_0xc4a4('0xdd')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xde'),require('./api/attachment'));_0x39b3f4['use'](_0xc4a4('0xdf'),require(_0xc4a4('0xe0')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xe1'),require(_0xc4a4('0xe2')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xe3'),require('./api/chatTransferReport'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xe4'),require(_0xc4a4('0xe5')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xe6'),require(_0xc4a4('0xe7')));_0x39b3f4['use']('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xe8'),require(_0xc4a4('0xe9')));_0x39b3f4[_0xc4a4('0x7')]('/api/voice/prefixes',require(_0xc4a4('0xea')));_0x39b3f4[_0xc4a4('0x7')]('/api/userProfiles',require(_0xc4a4('0xeb')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xec'),require(_0xc4a4('0xed')));_0x39b3f4[_0xc4a4('0x7')]('/api/userProfile/resources',require(_0xc4a4('0xee')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xef'),require(_0xc4a4('0xf0')));_0x39b3f4['use'](_0xc4a4('0xf1'),require('./api/whatsappAccount'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xf2'),require('./api/whatsappApplication'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xf3'),require(_0xc4a4('0xf4')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xf5'),require(_0xc4a4('0xf6')));_0x39b3f4[_0xc4a4('0x7')]('/api/whatsapp/reports/queue',require(_0xc4a4('0xf7')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xf8'),require('./api/whatsappTransferReport'));_0x39b3f4['use']('/api/whatsapp/queues',require(_0xc4a4('0xf9')));_0x39b3f4[_0xc4a4('0x7')]('/api/cloudProviders',require(_0xc4a4('0xfa')));_0x39b3f4['use'](_0xc4a4('0xfb'),require(_0xc4a4('0xfc')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0xfd'),require(_0xc4a4('0xfe')));_0x39b3f4['use'](_0xc4a4('0xff'),require(_0xc4a4('0x100')));_0x39b3f4['use'](_0xc4a4('0x101'),require(_0xc4a4('0x102')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x103'),require(_0xc4a4('0x104')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x105'),require('./api/system'));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x106'),require(_0xc4a4('0x107')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x108'),require(_0xc4a4('0x109')));_0x39b3f4[_0xc4a4('0x7')]('/apidoc',express[_0xc4a4('0x10a')](path['join'](config[_0xc4a4('0x10b')],'/apidoc')));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x10c'),express[_0xc4a4('0x10a')](path[_0xc4a4('0x10d')](config[_0xc4a4('0x10b')],_0xc4a4('0x10c'))));_0x39b3f4['use'](_0xc4a4('0x10e'),express[_0xc4a4('0x10a')](path[_0xc4a4('0x10d')](config['root'],_0xc4a4('0x10e'))));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x10f'),express['static'](path[_0xc4a4('0x10d')](config[_0xc4a4('0x10b')],'snippet',_0xc4a4('0x110'))));_0x39b3f4[_0xc4a4('0x7')](_0xc4a4('0x111'),express[_0xc4a4('0x10a')](path[_0xc4a4('0x10d')](config[_0xc4a4('0x10b')],'/server/files/plugins')));_0x39b3f4[_0xc4a4('0x112')](_0xc4a4('0x113'))[_0xc4a4('0x114')](errors[0x194]);_0x39b3f4[_0xc4a4('0x112')]('/*')['get'](function(_0x62245b,_0x2959d1){_0x2959d1[_0xc4a4('0x115')](path[_0xc4a4('0x116')](_0x39b3f4[_0xc4a4('0x114')](_0xc4a4('0x117'))+_0xc4a4('0x118')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 9781851..4b66696 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x690e=['../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.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/sound/sound.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0x690e,0xee));var _0xe690=function(_0x55c8fd,_0x369697){_0x55c8fd=_0x55c8fd-0x0;var _0x12fad7=_0x690e[_0x55c8fd];return _0x12fad7;};'use strict';var jayson=require(_0xe690('0x0'));var BPromise=require(_0xe690('0x1'));var _=require(_0xe690('0x2'));var config=require(_0xe690('0x3'));exports[_0xe690('0x4')]=function(){return new BPromise(function(_0x1d0443,_0x4b98d){var _0x553347={};_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x6')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x7')));_0x553347=_['merge'](_0x553347,require('../api/voiceQueue/voiceQueue.rpc'));_0x553347=_['merge'](_0x553347,require(_0xe690('0x8')));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x9')));_0x553347=_['merge'](_0x553347,require(_0xe690('0xa')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0xb')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0xc')));_0x553347=_['merge'](_0x553347,require(_0xe690('0xd')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0xe')));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0xf')));_0x553347=_['merge'](_0x553347,require(_0xe690('0x10')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x11')));_0x553347=_['merge'](_0x553347,require(_0xe690('0x12')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x13')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x14')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x15')));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/faxAccount/faxAccount.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x16')));_0x553347=_['merge'](_0x553347,require(_0xe690('0x17')));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/faxMessage/faxMessage.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x18')));_0x553347=_['merge'](_0x553347,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x553347=_['merge'](_0x553347,require(_0xe690('0x19')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x1a')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x1b')));_0x553347=_['merge'](_0x553347,require(_0xe690('0x1c')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x1d')));_0x553347=_['merge'](_0x553347,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x1e')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x1f')));_0x553347=_['merge'](_0x553347,require(_0xe690('0x20')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x21')));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/chatQueue/chatQueue.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/cmContact/cmContact.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/cmHopper/cmHopper.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x22')));_0x553347=_['merge'](_0x553347,require(_0xe690('0x23')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x24')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x25')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x26')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x27')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x28')));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/template/template.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x29')));_0x553347=_['merge'](_0x553347,require('../api/variable/variable.rpc'));_0x553347=_['merge'](_0x553347,require(_0xe690('0x2a')));_0x553347=_['merge'](_0x553347,require(_0xe690('0x2b')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x2c')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x2d')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x2e')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x2f')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x30')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x31')));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x553347=_['merge'](_0x553347,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x32')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x33')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x34')));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/squareOdbc/squareOdbc.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/squareProject/squareProject.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x35')));_0x553347=_['merge'](_0x553347,require(_0xe690('0x36')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x37')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x38')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x39')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x3a')));_0x553347=_[_0xe690('0x5')](_0x553347,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x3b')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x3c')));_0x553347=_[_0xe690('0x5')](_0x553347,require(_0xe690('0x3d')));var _0x5ba42b=jayson[_0xe690('0x3e')](_0x553347)[_0xe690('0x3f')]();var _0x53f2f3=config['rpc'][_0xe690('0x40')]||config['port']+0x1;var _0x39ece1=config[_0xe690('0x41')]['ip']||_0xe690('0x42');_0x5ba42b['on'](_0xe690('0x43'),function(_0x3d803d){return _0x4b98d(_0x3d803d);});_0x5ba42b[_0xe690('0x4')](_0x53f2f3,_0x39ece1,function(){console['log'](_0xe690('0x44'),_0x39ece1,_0x53f2f3);require(_0xe690('0x45'))['default']();return _0x1d0443(_0xe690('0x46')+_0x39ece1+':'+_0x53f2f3);});});}; \ No newline at end of file +var _0x16c4=['../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','bluebird','lodash','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.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/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16c4,0xa4));var _0x416c=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0x16c4[_0x456bd2];return _0x2218c1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x416c('0x0'));var _=require(_0x416c('0x1'));var config=require('../config/environment');exports[_0x416c('0x2')]=function(){return new BPromise(function(_0x276b70,_0x1b1d30){var _0xb1649f={};_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x3')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x5')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x6')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x7')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x8')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x9')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0xa')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0xb')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/memberReport/memberReport.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0xc')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0xd')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0xe')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0xf')));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x10')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x11')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x12')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x13')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x14')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x15')));_0xb1649f=_['merge'](_0xb1649f,require('../api/faxApplication/faxApplication.rpc'));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x16')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x17')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x18')));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x19')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x1a')));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x1b')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/smsMessage/smsMessage.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x1c')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x1d')));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x1e')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x1f')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x20')));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x21')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/chatInteraction/chatInteraction.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x22')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/chatQueue/chatQueue.rpc'));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x23')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/cmHopper/cmHopper.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x24')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x25')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x26')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x27')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x28')));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x29')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x2a')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x2b')));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x2c')));_0xb1649f=_['merge'](_0xb1649f,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x2d')));_0xb1649f=_['merge'](_0xb1649f,require('../api/intDeskAccount/intDeskAccount.rpc'));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x2e')));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x2f')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xb1649f=_['merge'](_0xb1649f,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x30')));_0xb1649f=_['merge'](_0xb1649f,require(_0x416c('0x31')));_0xb1649f=_['merge'](_0xb1649f,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x32')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x33')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x34')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x35')));_0xb1649f=_['merge'](_0xb1649f,require('../api/squareOdbc/squareOdbc.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/squareProject/squareProject.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x36')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x37')));_0xb1649f=_['merge'](_0xb1649f,require('../api/campaign/campaign.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x38')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x39')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/whatsappAccount/whatsappAccount.rpc'));_0xb1649f=_['merge'](_0xb1649f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require('../api/whatsappMessage/whatsappMessage.rpc'));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x3a')));_0xb1649f=_[_0x416c('0x4')](_0xb1649f,require(_0x416c('0x3b')));var _0x34ba45=jayson[_0x416c('0x3c')](_0xb1649f)[_0x416c('0x3d')]();var _0x29e99e=config['rpc']['port']||config[_0x416c('0x3e')]+0x1;var _0xe730f5=config[_0x416c('0x3f')]['ip']||'localhost';_0x34ba45['on'](_0x416c('0x40'),function(_0x51d9ee){return _0x1b1d30(_0x51d9ee);});_0x34ba45[_0x416c('0x2')](_0x29e99e,_0xe730f5,function(){console[_0x416c('0x41')](_0x416c('0x42'),_0xe730f5,_0x29e99e);require(_0x416c('0x43'))[_0x416c('0x44')]();return _0x276b70('RPC\x20listening\x20on\x20'+_0xe730f5+':'+_0x29e99e);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 18fb7c2..d6b1d72 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 _0x2814=['setTimeout','headers','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','emit','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','command','log','command=','write','destroy','prototype','sync','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','EventEmitter','./reply','./error','setEncoding','utf8'];(function(_0x5823f8,_0x48818a){var _0x38b09d=function(_0x352843){while(--_0x352843){_0x5823f8['push'](_0x5823f8['shift']());}};_0x38b09d(++_0x48818a);}(_0x2814,0x12a));var _0x4281=function(_0xbf7cbe,_0xfb3954){_0xbf7cbe=_0xbf7cbe-0x0;var _0x2e026=_0x2814[_0xbf7cbe];return _0x2e026;};'use strict';var util=require('util');var _=require(_0x4281('0x0'));var EventEmitter=require('events')[_0x4281('0x1')];var AGIReply=require(_0x4281('0x2'));var AGIError=require(_0x4281('0x3'));function AGIChannel(_0x3973da){var _0x50c333=this,_0x3b6471=new AGIReply(),_0xf3ba16=![],_0x3b0b1a={};EventEmitter['call'](_0x50c333);_0x3973da[_0x4281('0x4')](_0x4281('0x5'));_0x3973da[_0x4281('0x6')](0x8*0x3c*0x3c*0x3e8);_0x3b6471[_0x4281('0x4')](_0x4281('0x5'));_0x3b6471['on'](_0x4281('0x7'),function(_0x49b384){for(var _0xba09a8 in _0x49b384){_0x50c333[_0xba09a8]=_0x49b384[_0xba09a8];}_0x50c333['emit']('ready');});_0x3b6471['on']('line',function(_0x22b110){if(_0x22b110[_0x4281('0x8')]()=='hangup'){_0x50c333['emit'](_0x4281('0x9'));return;}if(_0x22b110['substring'](0x0,0xb)=='520-Invalid'){_0xf3ba16=!![];}if(_0xf3ba16){_0x3b0b1a['rx']+=_0x22b110+'\x0a';if(_0x22b110[_0x4281('0xa')](_0x4281('0xb'))!=-0x1){_0xf3ba16=![];}}else{_0x3b0b1a['rx']=_0x22b110;}if(_0xf3ba16){return;}if(typeof _0x3b0b1a['cb']==_0x4281('0xc')){var _0x5585b3=_0x3b0b1a['rx'][_0x4281('0xd')](0x0,0x3),_0x1cf0b0=null,_0x262482=null;_0x5585b3=parseInt(_0x5585b3);if(isNaN(_0x5585b3)){_0x3b0b1a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4281('0xe')});return;}if(_0x5585b3!=0xc8){_0x3b0b1a['cb'](null,{'code':_0x5585b3,'result':-0x1,'extra':'KO'});return;}_0x1cf0b0=_0x3b0b1a['rx'][_0x4281('0xd')](0x4)[_0x4281('0xf')](_0x4281('0x10'),'');if(_0x1cf0b0[_0x4281('0x11')]('\x20')!=-0x1){_0x1cf0b0=_0x1cf0b0[_0x4281('0x12')](0x0,_0x1cf0b0[_0x4281('0x11')]('\x20'));}if(_[_0x4281('0x13')](_0x1cf0b0,'-1')){_0x1cf0b0=parseInt(_0x1cf0b0);}_0x262482=_0x3b0b1a['rx']['split']('\x20');if(_0x262482[_0x4281('0x14')]==0x3){_0x262482=_0x262482[0x2]['substring'](0x1,_0x262482[0x2][_0x4281('0x14')]-0x1);}else if(_0x262482[_0x4281('0x14')]>0x3){var _0x53ab24=/\((.+)\)/;var _0x1510d0=_0x3b0b1a['rx'][_0x4281('0x15')](_0x53ab24);if(_0x1510d0){_0x262482=_0x1510d0[0x1];}else{_0x262482=null;}}else{_0x262482=null;}_0x3b0b1a['cb'](null,{'code':_0x5585b3,'result':_0x1cf0b0,'extra':_0x262482});}});_0x3973da['on'](_0x4281('0x16'),function(_0x23395a){_0x50c333[_0x4281('0x17')](_0x4281('0x16'),new AGIError(_0x4281('0x18'),_0x23395a[_0x4281('0x19')]));});_0x3973da['on'](_0x4281('0x1a'),function(){_0x50c333[_0x4281('0x17')](_0x4281('0x1a'),new AGIError(_0x4281('0x1b')));});_0x3973da['on'](_0x4281('0x1c'),function(){_0x50c333[_0x4281('0x17')](_0x4281('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x3973da['destroy']();});_0x3973da['pipe'](_0x3b6471);this[_0x4281('0x1d')]=function(_0x57766a,_0x57c435){console[_0x4281('0x1e')](_0x4281('0x1f'),_0x57766a);var _0x57766a=_0x57766a||'',_0x57c435=typeof _0x57c435==_0x4281('0xc')?_0x57c435:new Function();_0x3b0b1a={'tx':_0x57766a,'rx':'','cb':_0x57c435};_0x3973da[_0x4281('0x20')](_0x57766a+'\x0a');},this[_0x4281('0x1a')]=function(){_0x3973da[_0x4281('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x4281('0x22')]['sendRequest']=function(_0x3d660){return this['command'][_0x4281('0x23')](this,_0x3d660);};AGIChannel[_0x4281('0x22')]['answer']=function(){return this[_0x4281('0x24')](_0x4281('0x25'));};AGIChannel[_0x4281('0x22')][_0x4281('0x26')]=function(_0x1770b5,_0x34dc4f,_0x309a95){_0x1770b5=_0x1770b5===undefined?_0x4281('0x27'):_0x1770b5;_0x34dc4f=_0x34dc4f===undefined?'5':_0x34dc4f;_0x309a95=_0x309a95===undefined?'1':_0x309a95;return this[_0x4281('0x24')](util['format'](_0x4281('0x28'),_0x1770b5,_0x34dc4f*0x3e8,_0x309a95));};AGIChannel[_0x4281('0x22')]['noop']=function(_0x41d604){_0x41d604=_0x41d604||'NO\x20MESSAGE';return this['sendRequest'](util[_0x4281('0x29')](_0x4281('0x2a'),_0x41d604));};AGIChannel['prototype'][_0x4281('0x2b')]=function(_0x351ac0,_0x571847){if(_[_0x4281('0x2c')](_0x571847)){return this[_0x4281('0x24')](util[_0x4281('0x29')](_0x4281('0x2d'),_0x351ac0,_0x571847[_0x4281('0x2e')](',')));}return this['sendRequest'](util[_0x4281('0x29')](_0x4281('0x2d'),_0x351ac0,_0x571847));};AGIChannel['prototype'][_0x4281('0x2f')]=function(_0x38ac1){return this[_0x4281('0x24')](util[_0x4281('0x29')](_0x4281('0x30'),_0x38ac1));};AGIChannel[_0x4281('0x22')]['setExtension']=function(_0x308643){return this['sendRequest'](util[_0x4281('0x29')](_0x4281('0x31'),_0x308643));};AGIChannel[_0x4281('0x22')][_0x4281('0x32')]=function(_0x16bb8d){return this[_0x4281('0x24')](util[_0x4281('0x29')](_0x4281('0x33'),_0x16bb8d));};AGIChannel['prototype'][_0x4281('0x9')]=function(){return this[_0x4281('0x24')](_0x4281('0x34'));};AGIChannel[_0x4281('0x22')][_0x4281('0x35')]=function(_0x19bb19,_0x559533){var _0x58ac15=_['isBoolean'](_0x559533)||_['isNumber'](_0x559533)?_0x559533[_0x4281('0x36')]():_0x559533;return this[_0x4281('0x24')](util['format'](_0x4281('0x37'),_0x19bb19,_0x58ac15?_0x58ac15[_0x4281('0x36')]()[_0x4281('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4281('0x22')][_0x4281('0x38')]=function(_0x56dcde,_0xd61de1){return this['sendRequest'](util[_0x4281('0x29')](_0x4281('0x39'),_0x56dcde,_0xd61de1));};AGIChannel[_0x4281('0x22')][_0x4281('0x3a')]=function(_0x6662fb,_0x2b3b2a){return this[_0x4281('0x24')](util['format'](_0x4281('0x3b'),_0x6662fb,_0x2b3b2a));};AGIChannel[_0x4281('0x22')][_0x4281('0x3c')]=function(_0x27c81e,_0x3b6085){return this[_0x4281('0x24')](util[_0x4281('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x27c81e,_0x3b6085));};AGIChannel[_0x4281('0x22')]['continueAt']=function(_0x306d5e,_0x59e898,_0x4e870d){_0x59e898=_0x59e898||this[_0x4281('0x3d')];_0x4e870d=_0x4e870d||0x1;this[_0x4281('0x2f')](_0x306d5e);this[_0x4281('0x3e')](_0x59e898);this[_0x4281('0x32')](_0x4e870d);return this[_0x4281('0x3f')](util['format'](_0x4281('0x40'),_0x306d5e,_0x59e898,_0x4e870d));};AGIChannel[_0x4281('0x22')][_0x4281('0x41')]=function(_0x14dd5b){console[_0x4281('0x1e')](_0x4281('0x42'),_0x14dd5b);return this['sendRequest'](util[_0x4281('0x29')]('GET\x20VARIABLE\x20\x22%s\x22',_0x14dd5b));};AGIChannel['prototype'][_0x4281('0x43')]=function(_0x24552c,_0x224ab2,_0x1fa0c5,_0x382e94,_0xd22d60,_0x4e195c){_0x224ab2=_0x224ab2||_0x4281('0x44');_0x1fa0c5=_0x1fa0c5||'';_0x382e94=_0x382e94===undefined?-0x1:_0x382e94==='-1'?-0x1:_0x382e94*0x3e8;_0xd22d60=_0xd22d60===undefined?'':'s='+_0xd22d60;_0x4e195c=_0x4e195c?'BEEP':'';return this[_0x4281('0x24')](util['format'](_0x4281('0x45'),_0x24552c,_0x224ab2,_0x1fa0c5,_0x382e94,_0x4e195c,_0xd22d60));};AGIChannel[_0x4281('0x22')]['streamFile']=function(_0x47a206,_0x3ea805){_0x3ea805=_0x3ea805||'';return this[_0x4281('0x24')](util[_0x4281('0x29')](_0x4281('0x46'),_0x47a206,_0x3ea805));};AGIChannel[_0x4281('0x22')][_0x4281('0x47')]=function(_0x53eeaf){return this[_0x4281('0x2b')]('AGI',_0x53eeaf);};AGIChannel['prototype'][_0x4281('0x48')]=function(_0x38593e){return this[_0x4281('0x2b')]('WAIT',_0x38593e);};AGIChannel['prototype'][_0x4281('0x16')]=function(_0x5d04bb,_0x36aadc){this[_0x4281('0x3f')](util[_0x4281('0x29')](_0x4281('0x49'),_0x5d04bb['id'],_0x5d04bb[_0x4281('0x4a')],_0x36aadc));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4281('0x4b')]=AGIChannel; \ No newline at end of file +var _0x6610=['toString','replace','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','getvariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','result=','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','log','write','inherits','sendRequest','sync','prototype','answer','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber'];(function(_0x389da3,_0x1208ed){var _0x5a8e6c=function(_0x1387d5){while(--_0x1387d5){_0x389da3['push'](_0x389da3['shift']());}};_0x5a8e6c(++_0x1208ed);}(_0x6610,0xfb));var _0x0661=function(_0xbacfc2,_0x1f50bb){_0xbacfc2=_0xbacfc2-0x0;var _0x21c6c3=_0x6610[_0xbacfc2];return _0x21c6c3;};'use strict';var util=require(_0x0661('0x0'));var _=require(_0x0661('0x1'));var EventEmitter=require('events')[_0x0661('0x2')];var AGIReply=require(_0x0661('0x3'));var AGIError=require(_0x0661('0x4'));function AGIChannel(_0x1a736f){var _0x9912da=this,_0x1ff388=new AGIReply(),_0x545c4f=![],_0x8c0382={};EventEmitter[_0x0661('0x5')](_0x9912da);_0x1a736f[_0x0661('0x6')](_0x0661('0x7'));_0x1a736f['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1ff388['setEncoding'](_0x0661('0x7'));_0x1ff388['on']('headers',function(_0xe31352){for(var _0x3fa280 in _0xe31352){_0x9912da[_0x3fa280]=_0xe31352[_0x3fa280];}_0x9912da[_0x0661('0x8')](_0x0661('0x9'));});_0x1ff388['on'](_0x0661('0xa'),function(_0x3878f5){if(_0x3878f5[_0x0661('0xb')]()==_0x0661('0xc')){_0x9912da[_0x0661('0x8')](_0x0661('0xc'));return;}if(_0x3878f5['substring'](0x0,0xb)==_0x0661('0xd')){_0x545c4f=!![];}if(_0x545c4f){_0x8c0382['rx']+=_0x3878f5+'\x0a';if(_0x3878f5[_0x0661('0xe')](_0x0661('0xf'))!=-0x1){_0x545c4f=![];}}else{_0x8c0382['rx']=_0x3878f5;}if(_0x545c4f){return;}if(typeof _0x8c0382['cb']==_0x0661('0x10')){var _0x1f3542=_0x8c0382['rx'][_0x0661('0x11')](0x0,0x3),_0x1f09e7=null,_0xb80e35=null;_0x1f3542=parseInt(_0x1f3542);if(isNaN(_0x1f3542)){_0x8c0382['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x0661('0x12')});return;}if(_0x1f3542!=0xc8){_0x8c0382['cb'](null,{'code':_0x1f3542,'result':-0x1,'extra':'KO'});return;}_0x1f09e7=_0x8c0382['rx'][_0x0661('0x11')](0x4)['replace'](_0x0661('0x13'),'');if(_0x1f09e7[_0x0661('0x14')]('\x20')!=-0x1){_0x1f09e7=_0x1f09e7['substr'](0x0,_0x1f09e7[_0x0661('0x14')]('\x20'));}if(_[_0x0661('0x15')](_0x1f09e7,'-1')){_0x1f09e7=parseInt(_0x1f09e7);}_0xb80e35=_0x8c0382['rx'][_0x0661('0x16')]('\x20');if(_0xb80e35['length']==0x3){_0xb80e35=_0xb80e35[0x2][_0x0661('0x11')](0x1,_0xb80e35[0x2][_0x0661('0x17')]-0x1);}else if(_0xb80e35[_0x0661('0x17')]>0x3){var _0x1e8956=/\((.+)\)/;var _0x5d2d01=_0x8c0382['rx'][_0x0661('0x18')](_0x1e8956);if(_0x5d2d01){_0xb80e35=_0x5d2d01[0x1];}else{_0xb80e35=null;}}else{_0xb80e35=null;}_0x8c0382['cb'](null,{'code':_0x1f3542,'result':_0x1f09e7,'extra':_0xb80e35});}});_0x1a736f['on']('error',function(_0x3352cf){_0x9912da[_0x0661('0x8')](_0x0661('0x19'),new AGIError('E_AGI_SOCKET_ERROR',_0x3352cf[_0x0661('0x1a')]));});_0x1a736f['on'](_0x0661('0x1b'),function(){_0x9912da[_0x0661('0x8')](_0x0661('0x1b'),new AGIError(_0x0661('0x1c')));});_0x1a736f['on']('timeout',function(){_0x9912da[_0x0661('0x8')](_0x0661('0x1d'),new AGIError(_0x0661('0x1e')));_0x1a736f[_0x0661('0x1f')]();});_0x1a736f[_0x0661('0x20')](_0x1ff388);this[_0x0661('0x21')]=function(_0x27fcbc,_0x48164f){console[_0x0661('0x22')]('command=',_0x27fcbc);var _0x27fcbc=_0x27fcbc||'',_0x48164f=typeof _0x48164f==_0x0661('0x10')?_0x48164f:new Function();_0x8c0382={'tx':_0x27fcbc,'rx':'','cb':_0x48164f};_0x1a736f[_0x0661('0x23')](_0x27fcbc+'\x0a');},this[_0x0661('0x1b')]=function(){_0x1a736f['destroy']();};}util[_0x0661('0x24')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x0661('0x25')]=function(_0x2dd2e2){return this['command'][_0x0661('0x26')](this,_0x2dd2e2);};AGIChannel[_0x0661('0x27')][_0x0661('0x28')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x0661('0x27')]['getData']=function(_0x4b0211,_0x22f3ea,_0xb938a1){_0x4b0211=_0x4b0211===undefined?_0x0661('0x29'):_0x4b0211;_0x22f3ea=_0x22f3ea===undefined?'5':_0x22f3ea;_0xb938a1=_0xb938a1===undefined?'1':_0xb938a1;return this[_0x0661('0x25')](util['format'](_0x0661('0x2a'),_0x4b0211,_0x22f3ea*0x3e8,_0xb938a1));};AGIChannel[_0x0661('0x27')][_0x0661('0x2b')]=function(_0x35fe87){_0x35fe87=_0x35fe87||'NO\x20MESSAGE';return this['sendRequest'](util[_0x0661('0x2c')](_0x0661('0x2d'),_0x35fe87));};AGIChannel[_0x0661('0x27')][_0x0661('0x2e')]=function(_0x46ccba,_0x1437b4){if(_[_0x0661('0x2f')](_0x1437b4)){return this[_0x0661('0x25')](util[_0x0661('0x2c')](_0x0661('0x30'),_0x46ccba,_0x1437b4['join'](',')));}return this['sendRequest'](util['format'](_0x0661('0x30'),_0x46ccba,_0x1437b4));};AGIChannel[_0x0661('0x27')][_0x0661('0x31')]=function(_0x531dd3){return this[_0x0661('0x25')](util['format'](_0x0661('0x32'),_0x531dd3));};AGIChannel[_0x0661('0x27')][_0x0661('0x33')]=function(_0x4a8253){return this['sendRequest'](util[_0x0661('0x2c')](_0x0661('0x34'),_0x4a8253));};AGIChannel[_0x0661('0x27')][_0x0661('0x35')]=function(_0x52a19a){return this[_0x0661('0x25')](util[_0x0661('0x2c')](_0x0661('0x36'),_0x52a19a));};AGIChannel[_0x0661('0x27')][_0x0661('0xc')]=function(){return this[_0x0661('0x25')](_0x0661('0x37'));};AGIChannel['prototype']['setVariable']=function(_0x53124b,_0x31059d){var _0xe63015=_['isBoolean'](_0x31059d)||_[_0x0661('0x38')](_0x31059d)?_0x31059d[_0x0661('0x39')]():_0x31059d;return this[_0x0661('0x25')](util[_0x0661('0x2c')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x53124b,_0xe63015?_0xe63015[_0x0661('0x39')]()[_0x0661('0x3a')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0661('0x27')]['sayNumber']=function(_0x5055ff,_0x5610be){return this[_0x0661('0x25')](util[_0x0661('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0x5055ff,_0x5610be));};AGIChannel[_0x0661('0x27')][_0x0661('0x3b')]=function(_0x327338,_0x3f1dac){return this[_0x0661('0x25')](util['format'](_0x0661('0x3c'),_0x327338,_0x3f1dac));};AGIChannel[_0x0661('0x27')][_0x0661('0x3d')]=function(_0x55210d,_0x15b574){return this['sendRequest'](util[_0x0661('0x2c')](_0x0661('0x3e'),_0x55210d,_0x15b574));};AGIChannel[_0x0661('0x27')][_0x0661('0x3f')]=function(_0x4e48ce,_0x399429,_0x2e4463){_0x399429=_0x399429||this['extension'];_0x2e4463=_0x2e4463||0x1;this[_0x0661('0x31')](_0x4e48ce);this[_0x0661('0x33')](_0x399429);this[_0x0661('0x35')](_0x2e4463);return this[_0x0661('0x2b')](util[_0x0661('0x2c')]('GOTO\x20%s\x20%s\x20%s',_0x4e48ce,_0x399429,_0x2e4463));};AGIChannel[_0x0661('0x27')]['getVariable']=function(_0x566fc2){console[_0x0661('0x22')](_0x0661('0x40'),_0x566fc2);return this[_0x0661('0x25')](util['format'](_0x0661('0x41'),_0x566fc2));};AGIChannel['prototype'][_0x0661('0x42')]=function(_0x26db20,_0x1949dd,_0x385823,_0x1a33be,_0x31b1d5,_0x144c85){_0x1949dd=_0x1949dd||_0x0661('0x43');_0x385823=_0x385823||'';_0x1a33be=_0x1a33be===undefined?-0x1:_0x1a33be==='-1'?-0x1:_0x1a33be*0x3e8;_0x31b1d5=_0x31b1d5===undefined?'':'s='+_0x31b1d5;_0x144c85=_0x144c85?'BEEP':'';return this['sendRequest'](util[_0x0661('0x2c')](_0x0661('0x44'),_0x26db20,_0x1949dd,_0x385823,_0x1a33be,_0x144c85,_0x31b1d5));};AGIChannel['prototype'][_0x0661('0x45')]=function(_0x4bae36,_0x10ff31){_0x10ff31=_0x10ff31||'';return this[_0x0661('0x25')](util[_0x0661('0x2c')](_0x0661('0x46'),_0x4bae36,_0x10ff31));};AGIChannel[_0x0661('0x27')][_0x0661('0x47')]=function(_0x1594f3){return this[_0x0661('0x2e')](_0x0661('0x48'),_0x1594f3);};AGIChannel[_0x0661('0x27')][_0x0661('0x49')]=function(_0x5339cd){return this['exec'](_0x0661('0x4a'),_0x5339cd);};AGIChannel[_0x0661('0x27')][_0x0661('0x19')]=function(_0x29f3ee,_0x40c268){this['noop'](util[_0x0661('0x2c')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x29f3ee['id'],_0x29f3ee[_0x0661('0x4b')],_0x40c268));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0661('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 15d3000..a2a0265 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 _0xb35a=['Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','util','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.'];(function(_0x2a99e2,_0x1803e4){var _0x23fb5f=function(_0x568ec9){while(--_0x568ec9){_0x2a99e2['push'](_0x2a99e2['shift']());}};_0x23fb5f(++_0x1803e4);}(_0xb35a,0x1d7));var _0xab35=function(_0x3a10b6,_0x3181f0){_0x3a10b6=_0x3a10b6-0x0;var _0x463dc3=_0xb35a[_0x3a10b6];return _0x463dc3;};'use strict';var util=require(_0xab35('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xab35('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xab35('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0xab35('0x3'),'E_AGI_SOCKET_ERROR':_0xab35('0x4'),'E_AGI_SOCKET_CLOSE':_0xab35('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xab35('0x6'),'E_AGI_COMMAND_EMPTY':_0xab35('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xab35('0x8'),'E_AGI_IVR_ENTRY':_0xab35('0x9')};function AGIError(_0x2c3072){var _0x2c3072=_0x2c3072||null,_0x3672d9=_0x3672d9||[],_0x19bbe0=0x1,_0x6780db='';if(!error[_0x2c3072]){_0x2c3072='E_AGI_UNDEFINED';}_0x3672d9['push'](error[_0x2c3072]);while(arguments[_0x19bbe0]){_0x3672d9[_0xab35('0xa')](arguments[_0x19bbe0]);_0x19bbe0++;}_0x6780db=util[_0xab35('0xb')][_0xab35('0xc')](util,_0x3672d9);this[_0xab35('0xd')]=_0x6780db;this[_0xab35('0xe')]=_0x2c3072;}module[_0xab35('0xf')]=AGIError; \ No newline at end of file +var _0x074a=['E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0xea4811,_0x563cf8){var _0x2e583c=function(_0x4b6d78){while(--_0x4b6d78){_0xea4811['push'](_0xea4811['shift']());}};_0x2e583c(++_0x563cf8);}(_0x074a,0x97));var _0xa074=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x074a[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xa074('0x0'));var error={'E_AGI_UNDEFINED':_0xa074('0x1'),'E_AGI_ARGUMENT_PORT':_0xa074('0x2'),'E_AGI_SERVER_ERROR':_0xa074('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xa074('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xa074('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xa074('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa074('0x7'),'E_AGI_IVR_ENTRY':_0xa074('0x8')};function AGIError(_0x321e7d){var _0x321e7d=_0x321e7d||null,_0x5badb6=_0x5badb6||[],_0x3456aa=0x1,_0x1eee21='';if(!error[_0x321e7d]){_0x321e7d=_0xa074('0x9');}_0x5badb6[_0xa074('0xa')](error[_0x321e7d]);while(arguments[_0x3456aa]){_0x5badb6[_0xa074('0xa')](arguments[_0x3456aa]);_0x3456aa++;}_0x1eee21=util[_0xa074('0xb')][_0xa074('0xc')](util,_0x5badb6);this[_0xa074('0xd')]=_0x1eee21;this[_0xa074('0xe')]=_0x321e7d;}module[_0xa074('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a016c06..9d006f6 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 _0x26f9=['push','size','relations','numberOfEdges','traverseBFS','info','stop\x20traverse','no\x20edge/s\x20available','condition','split','length','agicommand','vswitch','target','invalid','includes','condition\x20not\x20found','lodash','../../../config/logger','menu','vertices','edges','prototype','addVertex','addEdge'];(function(_0x2c3a3d,_0x25ac70){var _0x409ead=function(_0x203fd2){while(--_0x203fd2){_0x2c3a3d['push'](_0x2c3a3d['shift']());}};_0x409ead(++_0x25ac70);}(_0x26f9,0x16f));var _0x926f=function(_0x447b23,_0x49c577){_0x447b23=_0x447b23-0x0;var _0x2f37c7=_0x26f9[_0x447b23];return _0x2f37c7;};'use strict';var _=require(_0x926f('0x0'));var logger=require(_0x926f('0x1'))('agi');var verticesWithRetry=[_0x926f('0x2'),'getdigits','getsecretdigits'];var Graph=function(){this[_0x926f('0x3')]={};this[_0x926f('0x4')]={};this['numberOfEdges']=0x0;};Graph[_0x926f('0x5')][_0x926f('0x6')]=function(_0x4232b5){this[_0x926f('0x3')][_0x4232b5['id']]=_0x4232b5;this[_0x926f('0x4')][_0x4232b5['id']]=[];};Graph[_0x926f('0x5')][_0x926f('0x7')]=function(_0x1e455d,_0x41a7ed,_0x2af11e){this['edges'][_0x1e455d][_0x926f('0x8')]({'target':_0x41a7ed,'condition':_0x2af11e});this['numberOfEdges']+=0x1;};Graph[_0x926f('0x5')][_0x926f('0x9')]=function(){return _['size'](this[_0x926f('0x3')]);};Graph[_0x926f('0x5')][_0x926f('0xa')]=function(){return this[_0x926f('0xb')];};Graph[_0x926f('0x5')]['getVertex']=function(_0x1e84e2){return this[_0x926f('0x3')][_0x1e84e2];};Graph[_0x926f('0x5')][_0x926f('0xc')]=function(_0x44f5da,_0x450b6e){if(!this[_0x926f('0x3')][_0x44f5da]){return logger['info']('no\x20vertex\x20found');}var _0x5e6fb1=_0x450b6e(this[_0x926f('0x3')][_0x44f5da]);if(!_0x5e6fb1){return logger[_0x926f('0xd')](_0x926f('0xe'));}if(this[_0x926f('0x4')][_0x44f5da]['length']===0x0){return logger[_0x926f('0xd')](_0x926f('0xf'));}for(var _0x5812cb=0x0,_0x20307b=[],_0x52865b=![];_0x5812cb\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','sync','production','SQUAREROOT','start','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','vertices','traverseBFS','vertex','VERTEX','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','code','result','isUndefined','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','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','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','lodash','syncho','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','retry','maxRetry','addVertex','omit'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xe330,0x96));var _0x0e33=function(_0x26a6ef,_0x406343){_0x26a6ef=_0x26a6ef-0x0;var _0x37eba3=_0xe330[_0x26a6ef];return _0x37eba3;};'use strict';var parser=require('xml2json');var _=require(_0x0e33('0x0'));var syncho=require(_0x0e33('0x1'));var util=require(_0x0e33('0x2'));var moment=require('moment');var config=require('../../config/environment');var logger=require(_0x0e33('0x3'))(_0x0e33('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x0e33('0x5'));var mailRpc=require(_0x0e33('0x6'));var Graph=require('./graph');var Vertices=require(_0x0e33('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0e33('0x4')]=_[_0x0e33('0x8')](config[_0x0e33('0x4')],{'ip':_0x0e33('0x9'),'port':0x11dd});function connectionHandler(_0x3e4028){process[_0x0e33('0xa')](function(){syncho(function(){try{setChannelVariables(_0x3e4028);agiHandler(_0x3e4028);}catch(_0x1edb09){logger[_0x0e33('0xb')](_0x1edb09[_0x0e33('0xc')]);}});});}function listeningHandler(){console[_0x0e33('0xd')](_0x0e33('0xe'),config['agi'][_0x0e33('0xf')]);logger[_0x0e33('0x10')](util[_0x0e33('0x11')](_0x0e33('0x12'),config['agi']['ip'],config[_0x0e33('0x4')][_0x0e33('0xf')]));}function errorHandler(_0x35526d){if(_0x35526d&&_0x35526d[_0x0e33('0x13')]&&_0x35526d['message']){logger[_0x0e33('0xb')](util[_0x0e33('0x11')]('[%s]\x20%s',_0x35526d[_0x0e33('0x13')],_0x35526d[_0x0e33('0x14')]));}else{logger[_0x0e33('0xb')](util[_0x0e33('0x11')](_0x0e33('0x15'),_0x35526d[_0x0e33('0xc')]));}}function closeHandler(){logger[_0x0e33('0x10')](util[_0x0e33('0x11')](_0x0e33('0x16'),this[_0x0e33('0x17')],this['calleridname'],this['callerid'],this[_0x0e33('0x18')],this[_0x0e33('0x19')]));try{createSquareReport(this);}catch(_0xa73fa5){logger[_0x0e33('0xb')](_0xa73fa5['stack']);}}function timeoutHandler(){logger[_0x0e33('0x10')](util[_0x0e33('0x11')](_0x0e33('0x1a'),this[_0x0e33('0x17')],this[_0x0e33('0x1b')],this[_0x0e33('0x1c')],this[_0x0e33('0x18')],this[_0x0e33('0x19')]));}function hangupHandler(){logger[_0x0e33('0x10')](util[_0x0e33('0x11')](_0x0e33('0x1d'),this['arg_1'],this['calleridname'],this[_0x0e33('0x1c')],this[_0x0e33('0x18')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x17c388){return parser['toJson'](_0x17c388,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x113707,_0x3d0853,_0x5497bb){_0x3d0853['agicommand']=_0x5497bb;if(_0x3d0853['hasOwnProperty'](_0x0e33('0x1e'))){_0x3d0853[_0x0e33('0x1f')]=parseInt(_0x3d0853[_0x0e33('0x1e')],0xa);}_0x113707[_0x0e33('0x20')](_[_0x0e33('0x21')](_0x3d0853,_0x0e33('0x22')));}function initGraph(_0xd1ba81,_0x15f179){var _0x5f3a6f=new Graph();for(var _0x3ed8c2 in _0xd1ba81){if(_0xd1ba81['hasOwnProperty'](_0x3ed8c2)){if(_[_0x0e33('0x23')](_0xd1ba81[_0x3ed8c2])){for(var _0x38a78a=0x0;_0x38a78a<_0xd1ba81[_0x3ed8c2][_0x0e33('0x24')];_0x38a78a+=0x1){addVertex(_0x5f3a6f,_0xd1ba81[_0x3ed8c2][_0x38a78a],_0x3ed8c2);}}else{addVertex(_0x5f3a6f,_0xd1ba81[_0x3ed8c2],_0x3ed8c2);}}}for(var _0x1a76e3=0x0;_0x1a76e3<_0x15f179[_0x0e33('0x24')];_0x1a76e3+=0x1){if(_0x15f179[_0x1a76e3][_0x0e33('0x25')]&&_0x15f179[_0x1a76e3][_0x0e33('0x26')]){_0x5f3a6f['addEdge'](_0x15f179[_0x1a76e3]['source'],_0x15f179[_0x1a76e3][_0x0e33('0x26')],_0x15f179[_0x1a76e3][_0x0e33('0x27')]);}}return _0x5f3a6f;}function getSquareProject(_0x5c6a4f,_0x54afc4){rpc[_0x0e33('0x28')](_0x5c6a4f)['then'](function(_0x4458ad){_0x54afc4(null,_0x4458ad);})[_0x0e33('0x29')](function(_0x220107){_0x54afc4(null,_0x220107);});}function createSquareReport(_0x11f181,_0x143241){rpc['createSquareReport'](_0x11f181)['then'](function(_0x5de4ee){if(_0x143241){_0x143241(null,_0x5de4ee);}})[_0x0e33('0x29')](function(_0xd57367){if(_0x143241){_0x143241(null,_0xd57367);}});}function setChannelVariables(_0x3925d7){for(var _0x4d58e0 in _0x3925d7){if(_0x3925d7[_0x0e33('0x2a')](_0x4d58e0)){if(_0x4d58e0[_0x0e33('0x2b')](_0x0e33('0x2c'))===0x0){_0x3925d7[_0x4d58e0['substring'](0x4)]=_0x3925d7[_0x4d58e0];delete _0x3925d7[_0x4d58e0];}}}}function getLogFromObject(_0x1c5596){return util[_0x0e33('0x2d')](_0x1c5596,{'showHidden':![],'depth':null});}function agiHandler(_0x11a9d6){var _0x3cec31,_0x26bb78,_0x1bdd54,_0x4014c8,_0x2e59ef;logger[_0x0e33('0x2e')](_0x0e33('0x2f'),JSON['stringify'](_0x11a9d6,null,0x2));logger['info'](util['format'](_0x0e33('0x30'),_0x11a9d6[_0x0e33('0x17')],_0x11a9d6[_0x0e33('0x1b')],_0x11a9d6[_0x0e33('0x1c')],_0x11a9d6['dnid'],_0x11a9d6[_0x0e33('0x19')]));_0x11a9d6['on'](_0x0e33('0xb'),errorHandler);_0x11a9d6['on']('close',closeHandler);_0x11a9d6['on'](_0x0e33('0x31'),timeoutHandler);_0x11a9d6[_0x0e33('0x32')]=![];_0x11a9d6['on'](_0x0e33('0x33'),hangupHandler);var _0xb57a6d=getSquareProject[_0x0e33('0x34')](null,_0x11a9d6['arg_1']);if(_0xb57a6d){if(_0xb57a6d[_0x0e33('0x35')]){_0x3cec31=getRoot(_0xb57a6d['production']);console[_0x0e33('0xd')](_0x0e33('0x36'),_0x3cec31);if(_0x3cec31&&_0x3cec31[_0x0e33('0x37')]){logger['debug'](_0x0e33('0x38'),JSON[_0x0e33('0x39')](_0x3cec31,null,0x2));_0x11a9d6[_0x0e33('0x3a')]=moment()['format'](_0x0e33('0x3b'));_0x26bb78=initGraph(_[_0x0e33('0x21')](_0x3cec31,_0x0e33('0x22')),_0x3cec31[_0x0e33('0x22')]);_0x1bdd54=new Vertices(_0x11a9d6,rpc,mailRpc);console[_0x0e33('0xd')](_0x0e33('0x3c'),_0x1bdd54);logger['info'](util[_0x0e33('0x11')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x11a9d6['arg_1'],_0x11a9d6[_0x0e33('0x1b')],_0x11a9d6['callerid'],_0x11a9d6['dnid'],_0x11a9d6[_0x0e33('0x19')]));console['log']('LOOP\x20through\x20graph');_0x26bb78[_0x0e33('0x3d')](_0x3cec31['start']['id'],function(_0x167f69){try{_0x167f69=_0x1bdd54['clear'](_0x167f69);logger['debug'](_0x0e33('0x3e'),JSON['stringify'](_0x167f69,null,0x2));console[_0x0e33('0xd')](_0x0e33('0x3f'),_0x167f69);if(_0x167f69[_0x0e33('0x40')]===_0x0e33('0x41')){logger['info'](_0x0e33('0x42'));_0x11a9d6['context']=_0x167f69[_0x0e33('0x43')]||_0x11a9d6[_0x0e33('0x43')];_0x11a9d6[_0x0e33('0x44')]=_0x167f69[_0x0e33('0x44')];_0x11a9d6[_0x0e33('0x45')]=_0x167f69[_0x0e33('0x45')]?_0x167f69[_0x0e33('0x45')]-0x1:0x1;return null;}else if(_0x167f69&&_0x1bdd54[_0x167f69[_0x0e33('0x40')]]){_0x2e59ef=_0x1bdd54[_0x167f69[_0x0e33('0x40')]](_0x167f69);console[_0x0e33('0xd')](_0x0e33('0x46'),_0x2e59ef);logger['info'](_0x0e33('0x47'),JSON['stringify'](_0x2e59ef,null,0x2));if(_0x2e59ef&&_0x2e59ef[_0x0e33('0x48')]===AGI_CODE_SUCCESS&&_0x2e59ef[_0x0e33('0x49')]!==AGI_RESULT_ERROR&&!_0x11a9d6[_0x0e33('0x32')]){logger[_0x0e33('0x2e')]('response',getLogFromObject(_0x2e59ef));return _[_0x0e33('0x4a')](_0x2e59ef[_0x0e33('0x49')])?null:_0x2e59ef[_0x0e33('0x49')][_0x0e33('0x4b')]();}else{logger[_0x0e33('0xb')](_0x0e33('0x47'),getLogFromObject(_0x2e59ef));return null;}}else{logger[_0x0e33('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x283985){logger[_0x0e33('0xb')](_0x283985[_0x0e33('0xc')]);return null;}});if(_0x3cec31['finally']){logger['info'](util[_0x0e33('0x11')](_0x0e33('0x4c'),_0x11a9d6[_0x0e33('0x17')],_0x11a9d6['calleridname'],_0x11a9d6[_0x0e33('0x1c')],_0x11a9d6[_0x0e33('0x18')],_0x11a9d6[_0x0e33('0x19')]));_0x26bb78[_0x0e33('0x3d')](_0x3cec31['finally']['id'],function(_0x3956b7){try{_0x3956b7=_0x1bdd54['clear'](_0x3956b7);logger[_0x0e33('0x2e')]('vertex',JSON['stringify'](_0x3956b7,null,0x2));if(_0x3956b7&&_0x1bdd54[_0x3956b7['agicommand']]){_0x2e59ef=_0x1bdd54[_0x3956b7['agicommand']](_0x3956b7);if(_0x2e59ef){logger[_0x0e33('0x2e')](_0x0e33('0x47'),getLogFromObject(_0x2e59ef));return _[_0x0e33('0x4a')](_0x2e59ef[_0x0e33('0x49')])?null:_0x2e59ef[_0x0e33('0x49')][_0x0e33('0x4b')]();}else{logger[_0x0e33('0xb')](_0x0e33('0x47'),getLogFromObject(_0x2e59ef));return null;}}else{logger['error'](_0x0e33('0x4d'));return null;}}catch(_0x42c80a){logger['error'](_0x42c80a['stack']);return null;}});}logger['info'](util[_0x0e33('0x11')](_0x0e33('0x4e'),_0x11a9d6[_0x0e33('0x17')],_0x11a9d6[_0x0e33('0x1b')],_0x11a9d6['callerid'],_0x11a9d6[_0x0e33('0x18')],_0x11a9d6[_0x0e33('0x19')]));logger[_0x0e33('0x10')](util[_0x0e33('0x11')](_0x0e33('0x4f'),_0x11a9d6['context'],_0x11a9d6['extension'],parseInt(_0x11a9d6[_0x0e33('0x45')],0xa)+0x1));_0x11a9d6[_0x0e33('0x50')](_0x11a9d6[_0x0e33('0x43')],_0x11a9d6[_0x0e33('0x44')],parseInt(_0x11a9d6['priority'],0xa)+0x1);_0x11a9d6[_0x0e33('0x51')]();}}else{logger[_0x0e33('0xb')](util['format'](_0x0e33('0x52'),_0x11a9d6[_0x0e33('0x17')]));_0x11a9d6[_0x0e33('0x50')](_0x11a9d6[_0x0e33('0x43')],_0x11a9d6['extension'],parseInt(_0x11a9d6['priority'],0xa)+0x1);_0x11a9d6[_0x0e33('0x51')]();}}else{logger[_0x0e33('0xb')](util[_0x0e33('0x11')](_0x0e33('0x53'),_0x11a9d6[_0x0e33('0x17')]));_0x11a9d6[_0x0e33('0x50')](_0x11a9d6[_0x0e33('0x43')],_0x11a9d6[_0x0e33('0x44')],parseInt(_0x11a9d6[_0x0e33('0x45')],0xa)+0x1);_0x11a9d6[_0x0e33('0x51')]();}}function main(){var _0x402878;return utilLicense[_0x0e33('0x54')]()[_0x0e33('0x55')](function(_0x1a59c1){if(_0x1a59c1){if(_0x1a59c1[_0x0e33('0x56')]){if(_0x1a59c1[_0x0e33('0x57')]&&_0x1a59c1[_0x0e33('0x57')]>0x0){logger[_0x0e33('0x10')](util[_0x0e33('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x1a59c1['callysquare']));_0x402878=_0x1a59c1['callysquare'];}else{logger[_0x0e33('0x10')](_0x0e33('0x58'));}}else{logger['info'](_0x0e33('0x59'));_0x402878=-0x1;}}})[_0x0e33('0x29')](function(_0x3584a2){logger['error'](_0x0e33('0x5a'),_0x3584a2[_0x0e33('0xc')]);})[_0x0e33('0x5b')](function(){var _0xf321b0=require('./server')(config[_0x0e33('0x4')][_0x0e33('0xf')],config['agi']['ip'],_0x402878);_0xf321b0['on'](_0x0e33('0xb'),errorHandler);_0xf321b0['on']('listening',listeningHandler);_0xf321b0['on']('connection',connectionHandler);_0xf321b0['on'](_0x0e33('0x51'),closeHandler);});}main(); \ No newline at end of file +var _0x0554=['extension','priority','response','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./graph','./vertices','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','error','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','toJson','mxGraphModel','root','agicommand','maxRetry','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','addEdge','source','target','value','getSquareProject','createSquareReport','then','catch','substring','inspect','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','sync','production','SQUAREROOT','start','debug','joinAt','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x0554,0x176));var _0x4055=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x0554[_0x14a0a0];return _0x56b651;};'use strict';var parser=require(_0x4055('0x0'));var _=require(_0x4055('0x1'));var syncho=require('syncho');var util=require(_0x4055('0x2'));var moment=require('moment');var config=require(_0x4055('0x3'));var logger=require(_0x4055('0x4'))(_0x4055('0x5'));var utilLicense=require(_0x4055('0x6'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x4055('0x7'));var Vertices=require(_0x4055('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_['defaults'](config[_0x4055('0x5')],{'ip':_0x4055('0x9'),'port':0x11dd});function connectionHandler(_0x509871){process[_0x4055('0xa')](function(){syncho(function(){try{setChannelVariables(_0x509871);agiHandler(_0x509871);}catch(_0x3829b4){logger['error'](_0x3829b4[_0x4055('0xb')]);}});});}function listeningHandler(){console[_0x4055('0xc')](_0x4055('0xd'),config['agi'][_0x4055('0xe')]);logger['info'](util[_0x4055('0xf')](_0x4055('0x10'),config[_0x4055('0x5')]['ip'],config[_0x4055('0x5')]['port']));}function errorHandler(_0x5dcc55){if(_0x5dcc55&&_0x5dcc55[_0x4055('0x11')]&&_0x5dcc55['message']){logger[_0x4055('0x12')](util['format'](_0x4055('0x13'),_0x5dcc55['name'],_0x5dcc55['message']));}else{logger[_0x4055('0x12')](util[_0x4055('0xf')](_0x4055('0x14'),_0x5dcc55[_0x4055('0xb')]));}}function closeHandler(){logger[_0x4055('0x15')](util['format'](_0x4055('0x16'),this[_0x4055('0x17')],this[_0x4055('0x18')],this['callerid'],this[_0x4055('0x19')],this[_0x4055('0x1a')]));try{createSquareReport(this);}catch(_0x3de065){logger[_0x4055('0x12')](_0x3de065[_0x4055('0xb')]);}}function timeoutHandler(){logger[_0x4055('0x15')](util['format'](_0x4055('0x1b'),this[_0x4055('0x17')],this[_0x4055('0x18')],this[_0x4055('0x1c')],this[_0x4055('0x19')],this['uniqueid']));}function hangupHandler(){logger[_0x4055('0x15')](util[_0x4055('0xf')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4055('0x17')],this[_0x4055('0x18')],this[_0x4055('0x1c')],this[_0x4055('0x19')],this[_0x4055('0x1a')]));this[_0x4055('0x1d')]=!![];}function getRoot(_0x779021){return parser[_0x4055('0x1e')](_0x779021,{'object':!![]})[_0x4055('0x1f')][_0x4055('0x20')];}function addVertex(_0x2182f4,_0x3c961e,_0x5838d1){_0x3c961e[_0x4055('0x21')]=_0x5838d1;if(_0x3c961e['hasOwnProperty']('retry')){_0x3c961e[_0x4055('0x22')]=parseInt(_0x3c961e[_0x4055('0x23')],0xa);}_0x2182f4[_0x4055('0x24')](_[_0x4055('0x25')](_0x3c961e,_0x4055('0x26')));}function initGraph(_0x31ac58,_0x50c85c){var _0x185f0b=new Graph();for(var _0x2df9bf in _0x31ac58){if(_0x31ac58[_0x4055('0x27')](_0x2df9bf)){if(_[_0x4055('0x28')](_0x31ac58[_0x2df9bf])){for(var _0x379f52=0x0;_0x379f52<_0x31ac58[_0x2df9bf][_0x4055('0x29')];_0x379f52+=0x1){addVertex(_0x185f0b,_0x31ac58[_0x2df9bf][_0x379f52],_0x2df9bf);}}else{addVertex(_0x185f0b,_0x31ac58[_0x2df9bf],_0x2df9bf);}}}for(var _0x1e71d7=0x0;_0x1e71d7<_0x50c85c[_0x4055('0x29')];_0x1e71d7+=0x1){if(_0x50c85c[_0x1e71d7]['source']&&_0x50c85c[_0x1e71d7]['target']){_0x185f0b[_0x4055('0x2a')](_0x50c85c[_0x1e71d7][_0x4055('0x2b')],_0x50c85c[_0x1e71d7][_0x4055('0x2c')],_0x50c85c[_0x1e71d7][_0x4055('0x2d')]);}}return _0x185f0b;}function getSquareProject(_0x31379b,_0x157b9a){rpc[_0x4055('0x2e')](_0x31379b)['then'](function(_0x3e3540){_0x157b9a(null,_0x3e3540);})['catch'](function(_0x422175){_0x157b9a(null,_0x422175);});}function createSquareReport(_0x16b719,_0x472244){rpc[_0x4055('0x2f')](_0x16b719)[_0x4055('0x30')](function(_0x3f557d){if(_0x472244){_0x472244(null,_0x3f557d);}})[_0x4055('0x31')](function(_0x2d87ce){if(_0x472244){_0x472244(null,_0x2d87ce);}});}function setChannelVariables(_0x52629e){for(var _0x30c3a9 in _0x52629e){if(_0x52629e[_0x4055('0x27')](_0x30c3a9)){if(_0x30c3a9['indexOf']('agi_')===0x0){_0x52629e[_0x30c3a9[_0x4055('0x32')](0x4)]=_0x52629e[_0x30c3a9];delete _0x52629e[_0x30c3a9];}}}}function getLogFromObject(_0x43e7a3){return util[_0x4055('0x33')](_0x43e7a3,{'showHidden':![],'depth':null});}function agiHandler(_0x111c9c){var _0x566bac,_0x1ee83b,_0x300fba,_0x49fbb1,_0x48210a;logger['debug']('variables',JSON[_0x4055('0x34')](_0x111c9c,null,0x2));logger[_0x4055('0x15')](util[_0x4055('0xf')](_0x4055('0x35'),_0x111c9c['arg_1'],_0x111c9c[_0x4055('0x18')],_0x111c9c[_0x4055('0x1c')],_0x111c9c[_0x4055('0x19')],_0x111c9c['uniqueid']));_0x111c9c['on']('error',errorHandler);_0x111c9c['on']('close',closeHandler);_0x111c9c['on'](_0x4055('0x36'),timeoutHandler);_0x111c9c['evtHangup']=![];_0x111c9c['on'](_0x4055('0x37'),hangupHandler);var _0x3e62ef=getSquareProject[_0x4055('0x38')](null,_0x111c9c['arg_1']);if(_0x3e62ef){if(_0x3e62ef[_0x4055('0x39')]){_0x566bac=getRoot(_0x3e62ef[_0x4055('0x39')]);console[_0x4055('0xc')](_0x4055('0x3a'),_0x566bac);if(_0x566bac&&_0x566bac[_0x4055('0x3b')]){logger[_0x4055('0x3c')](_0x4055('0x20'),JSON[_0x4055('0x34')](_0x566bac,null,0x2));_0x111c9c[_0x4055('0x3d')]=moment()[_0x4055('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ee83b=initGraph(_[_0x4055('0x25')](_0x566bac,_0x4055('0x26')),_0x566bac[_0x4055('0x26')]);_0x300fba=new Vertices(_0x111c9c,rpc,mailRpc);console['log']('vertices',_0x300fba);logger[_0x4055('0x15')](util[_0x4055('0xf')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x111c9c[_0x4055('0x17')],_0x111c9c['calleridname'],_0x111c9c[_0x4055('0x1c')],_0x111c9c[_0x4055('0x19')],_0x111c9c[_0x4055('0x1a')]));console['log']('LOOP\x20through\x20graph');_0x1ee83b[_0x4055('0x3e')](_0x566bac[_0x4055('0x3b')]['id'],function(_0x1c496e){try{_0x1c496e=_0x300fba[_0x4055('0x3f')](_0x1c496e);logger[_0x4055('0x3c')]('vertex',JSON[_0x4055('0x34')](_0x1c496e,null,0x2));console[_0x4055('0xc')]('VERTEX',_0x1c496e);if(_0x1c496e[_0x4055('0x21')]==='gotoc'){logger[_0x4055('0x15')](_0x4055('0x40'));_0x111c9c['context']=_0x1c496e[_0x4055('0x41')]||_0x111c9c[_0x4055('0x41')];_0x111c9c[_0x4055('0x42')]=_0x1c496e[_0x4055('0x42')];_0x111c9c[_0x4055('0x43')]=_0x1c496e['priority']?_0x1c496e[_0x4055('0x43')]-0x1:0x1;return null;}else if(_0x1c496e&&_0x300fba[_0x1c496e[_0x4055('0x21')]]){_0x48210a=_0x300fba[_0x1c496e[_0x4055('0x21')]](_0x1c496e);console[_0x4055('0xc')]('vresponse',_0x48210a);logger[_0x4055('0x15')](_0x4055('0x44'),JSON[_0x4055('0x34')](_0x48210a,null,0x2));if(_0x48210a&&_0x48210a['code']===AGI_CODE_SUCCESS&&_0x48210a[_0x4055('0x45')]!==AGI_RESULT_ERROR&&!_0x111c9c[_0x4055('0x1d')]){logger[_0x4055('0x3c')](_0x4055('0x44'),getLogFromObject(_0x48210a));return _[_0x4055('0x46')](_0x48210a['result'])?null:_0x48210a[_0x4055('0x45')][_0x4055('0x47')]();}else{logger['error']('response',getLogFromObject(_0x48210a));return null;}}else{logger[_0x4055('0x12')](_0x4055('0x48'));return null;}}catch(_0x19970e){logger['error'](_0x19970e[_0x4055('0xb')]);return null;}});if(_0x566bac[_0x4055('0x49')]){logger[_0x4055('0x15')](util[_0x4055('0xf')](_0x4055('0x4a'),_0x111c9c[_0x4055('0x17')],_0x111c9c[_0x4055('0x18')],_0x111c9c['callerid'],_0x111c9c['dnid'],_0x111c9c['uniqueid']));_0x1ee83b['traverseBFS'](_0x566bac[_0x4055('0x49')]['id'],function(_0x2ef34d){try{_0x2ef34d=_0x300fba[_0x4055('0x3f')](_0x2ef34d);logger[_0x4055('0x3c')](_0x4055('0x4b'),JSON[_0x4055('0x34')](_0x2ef34d,null,0x2));if(_0x2ef34d&&_0x300fba[_0x2ef34d[_0x4055('0x21')]]){_0x48210a=_0x300fba[_0x2ef34d[_0x4055('0x21')]](_0x2ef34d);if(_0x48210a){logger['debug'](_0x4055('0x44'),getLogFromObject(_0x48210a));return _[_0x4055('0x46')](_0x48210a[_0x4055('0x45')])?null:_0x48210a[_0x4055('0x45')]['toString']();}else{logger['error'](_0x4055('0x44'),getLogFromObject(_0x48210a));return null;}}else{logger[_0x4055('0x12')](_0x4055('0x48'));return null;}}catch(_0x56c39d){logger[_0x4055('0x12')](_0x56c39d[_0x4055('0xb')]);return null;}});}logger[_0x4055('0x15')](util[_0x4055('0xf')](_0x4055('0x4c'),_0x111c9c[_0x4055('0x17')],_0x111c9c[_0x4055('0x18')],_0x111c9c['callerid'],_0x111c9c[_0x4055('0x19')],_0x111c9c[_0x4055('0x1a')]));logger['info'](util[_0x4055('0xf')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x111c9c[_0x4055('0x41')],_0x111c9c[_0x4055('0x42')],parseInt(_0x111c9c[_0x4055('0x43')],0xa)+0x1));_0x111c9c[_0x4055('0x4d')](_0x111c9c[_0x4055('0x41')],_0x111c9c['extension'],parseInt(_0x111c9c[_0x4055('0x43')],0xa)+0x1);_0x111c9c[_0x4055('0x4e')]();}}else{logger['error'](util['format'](_0x4055('0x4f'),_0x111c9c['arg_1']));_0x111c9c[_0x4055('0x4d')](_0x111c9c[_0x4055('0x41')],_0x111c9c[_0x4055('0x42')],parseInt(_0x111c9c[_0x4055('0x43')],0xa)+0x1);_0x111c9c[_0x4055('0x4e')]();}}else{logger[_0x4055('0x12')](util[_0x4055('0xf')](_0x4055('0x50'),_0x111c9c[_0x4055('0x17')]));_0x111c9c[_0x4055('0x4d')](_0x111c9c['context'],_0x111c9c[_0x4055('0x42')],parseInt(_0x111c9c['priority'],0xa)+0x1);_0x111c9c['close']();}}function main(){var _0x4cde96;return utilLicense[_0x4055('0x51')]()[_0x4055('0x30')](function(_0xec3fcf){if(_0xec3fcf){if(_0xec3fcf['voice']){if(_0xec3fcf[_0x4055('0x52')]&&_0xec3fcf['callysquare']>0x0){logger[_0x4055('0x15')](util[_0x4055('0xf')](_0x4055('0x53'),_0xec3fcf[_0x4055('0x52')]));_0x4cde96=_0xec3fcf['callysquare'];}else{logger[_0x4055('0x15')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x4055('0x15')](_0x4055('0x54'));_0x4cde96=-0x1;}}})['catch'](function(_0x5c7b3e){logger[_0x4055('0x12')]('[LICENSE]',_0x5c7b3e[_0x4055('0xb')]);})[_0x4055('0x49')](function(){var _0xd68ea3=require(_0x4055('0x55'))(config[_0x4055('0x5')]['port'],config['agi']['ip'],_0x4cde96);_0xd68ea3['on'](_0x4055('0x12'),errorHandler);_0xd68ea3['on'](_0x4055('0x56'),listeningHandler);_0xd68ea3['on'](_0x4055('0x57'),connectionHandler);_0xd68ea3['on'](_0x4055('0x4e'),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 404ae6d..d4e5568 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(_0x2dea81,_0x3651a8){var _0x4534d7=function(_0x525ff0){while(--_0x525ff0){_0x2dea81['push'](_0x2dea81['shift']());}};_0x4534d7(++_0x3651a8);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x292f92,_0x1eb310){var _0x1f3493=function(_0xd6a465){while(--_0xd6a465){_0x292f92['push'](_0x292f92['shift']());}};_0x1f3493(++_0x1eb310);}(_0x814b,0x1a2));var _0xb814=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x814b[_0x1627ae];return _0x34b38f;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 8d44cde..c3e038c 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x528f23,_0x213659){var _0x556acd=function(_0x3770a2){while(--_0x3770a2){_0x528f23['push'](_0x528f23['shift']());}};_0x556acd(++_0x213659);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d15de,_0x4c9914){_0x4d15de=_0x4d15de-0x0;var _0x5896d6=_0x5f2f[_0x4d15de];return _0x5896d6;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x1af80e,_0x8a8525){var _0x347585=function(_0x462d98){while(--_0x462d98){_0x1af80e['push'](_0x1af80e['shift']());}};_0x347585(++_0x8a8525);}(_0x7a54,0x106));var _0x47a5=function(_0xa1c91e,_0x47ed34){_0xa1c91e=_0xa1c91e-0x0;var _0x4b1a14=_0x7a54[_0xa1c91e];return _0x4b1a14;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index ba85b7f..e39788e 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 _0xe0d4=['LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','then','error','message','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','dsn','ShowUser','log','rpcreq','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','ShowPause','agentPause','agentUnpause','agentLogout'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe0d4,0x1a1));var _0x4e0d=function(_0x489c1d,_0x15b612){_0x489c1d=_0x489c1d-0x0;var _0x80ca8f=_0xe0d4[_0x489c1d];return _0x80ca8f;};'use strict';var BPromise=require(_0x4e0d('0x0'));var moment=require(_0x4e0d('0x1'));var _=require(_0x4e0d('0x2'));var util=require(_0x4e0d('0x3'));var jayson=require(_0x4e0d('0x4'));var client=jayson[_0x4e0d('0x5')][_0x4e0d('0x6')]({'port':0x2329});function request(_0x34b72f,_0x4bde41){return new BPromise(function(_0x14c4e5,_0x2aff42){return client['request'](_0x34b72f,_0x4bde41)[_0x4e0d('0x7')](function(_0x1c1b9b){if(_0x1c1b9b[_0x4e0d('0x8')]){return _0x2aff42(_0x1c1b9b['error'][_0x4e0d('0x9')]);}else{return _0x14c4e5(_0x1c1b9b['result']);}})['catch'](function(_0x475e96){return _0x2aff42(_0x475e96);});});}exports['getSquareProject']=function(_0xa7a93e){return request(_0x4e0d('0xa'),{'options':{'raw':![],'where':{'name':_0xa7a93e},'attributes':[_0x4e0d('0xb')]}});};exports[_0x4e0d('0xc')]=function(_0x554841){return request(_0x4e0d('0xd'),{'options':{'raw':![],'where':{'id':_0x554841},'include':[{'model':_0x4e0d('0xe'),'as':_0x4e0d('0xf')}],'attributes':['id',_0x4e0d('0x10'),_0x4e0d('0x11')]}});};exports[_0x4e0d('0x12')]=function(_0x137f43){return request(_0x4e0d('0xa'),{'options':{'where':{'id':_0x137f43},'attributes':[_0x4e0d('0x10')]}});};exports[_0x4e0d('0x13')]=function(_0x4f8f40){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4f8f40},'attributes':[_0x4e0d('0x10')]}});};exports[_0x4e0d('0x14')]=function(_0x3a75f6){return request('ShowVariable',{'options':{'where':{'id':_0x3a75f6},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x3876ea){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3876ea},'attributes':[_0x4e0d('0x15')]}});};exports['getUserById']=function(_0x56ea91){return request(_0x4e0d('0x16'),{'options':{'where':{'id':_0x56ea91},'attributes':[_0x4e0d('0x10')]}});};exports['getContactByPhone']=function(_0x5a4dfd){console[_0x4e0d('0x17')](_0x4e0d('0x18'),_0x5a4dfd);return request(_0x4e0d('0x19'),{'options':{'where':{'phone':_0x5a4dfd[_0x4e0d('0x1a')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x15325b){return request(_0x4e0d('0x1b'),{'options':{'where':{'id':_0x15325b},'attributes':[_0x4e0d('0x10')]}});};exports[_0x4e0d('0x1c')]=function(_0x52c719){return request(_0x4e0d('0x1d'),{'options':{'where':{'id':_0x52c719},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x4bea96){return request(_0x4e0d('0x1e'),{'options':{'raw':![],'where':{'id':_0x4bea96},'include':[{'model':_0x4e0d('0x1f'),'as':'Intervals'}]}});};exports[_0x4e0d('0x20')]=function(_0x577d74){return request('ShowSmsAccount',{'options':{'where':{'id':_0x577d74},'attributes':['id',_0x4e0d('0x10')]}});};exports[_0x4e0d('0x21')]=function(_0x1a72e0){return request(_0x4e0d('0x22'),{'body':_0x1a72e0});};exports[_0x4e0d('0x23')]=function(_0x3822a2){return request(_0x4e0d('0x24'),{'body':_0x3822a2});};exports[_0x4e0d('0x25')]=function(_0x3ed040){return request(_0x4e0d('0x26'),{'body':_['merge'](_0x3ed040,{'project_name':_0x3ed040['arg_1'],'prev_project_name':_0x3ed040[_0x4e0d('0x27')]||'','is_subproject':_0x3ed040[_0x4e0d('0x27')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x4e0d('0x28')]=function(_0x204075){return request(_0x4e0d('0x29'),{'body':_0x204075});};exports[_0x4e0d('0x2a')]=function(_0x4fd90f){return request(_0x4e0d('0x2b'),{'body':_0x4fd90f});};exports[_0x4e0d('0x2c')]=function(_0x1d6cde){return request(_0x4e0d('0x2d'),{'options':{'raw':![],'where':{'phone':_0x1d6cde[_0x4e0d('0x1a')],'ListId':_0x1d6cde[_0x4e0d('0x2e')]}}})[_0x4e0d('0x7')](function(_0x423e5f){if(_0x423e5f){return _0x423e5f;}return request('CreateCmContact',{'body':_0x1d6cde});});};exports['getPauseById']=function(_0x2bf01c){return request(_0x4e0d('0x2f'),{'options':{'where':{'id':_0x2bf01c},'attributes':['name']}});};exports['agentLogin']=function(_0xbfb656,_0x385f85){return request('LoginUser',{'body':{'interface':_0x385f85},'options':{'where':_0xbfb656}});};exports[_0x4e0d('0x30')]=function(_0x260605,_0x2ed4a2,_0x9e7ee3){return request('PauseUser',{'body':{'type':_0x2ed4a2,'uniqueid':_0x9e7ee3},'options':{'where':_0x260605}});};exports[_0x4e0d('0x31')]=function(_0x1efc51){return request('UnpauseUser',{'body':{},'options':{'where':_0x1efc51}});};exports[_0x4e0d('0x32')]=function(_0x40c342){return request(_0x4e0d('0x33'),{'body':{},'options':{'where':_0x40c342}});}; \ No newline at end of file +var _0x6d20=['getContactByPhone','log','GetContactByPhone','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','then','error','message','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser'];(function(_0x5ab805,_0x74f5a9){var _0x177893=function(_0x185221){while(--_0x185221){_0x5ab805['push'](_0x5ab805['shift']());}};_0x177893(++_0x74f5a9);}(_0x6d20,0x10f));var _0x06d2=function(_0x5f170f,_0x553d8e){_0x5f170f=_0x5f170f-0x0;var _0x2419de=_0x6d20[_0x5f170f];return _0x2419de;};'use strict';var BPromise=require(_0x06d2('0x0'));var moment=require(_0x06d2('0x1'));var _=require(_0x06d2('0x2'));var util=require(_0x06d2('0x3'));var jayson=require(_0x06d2('0x4'));var client=jayson['client'][_0x06d2('0x5')]({'port':0x2329});function request(_0x3c7ef7,_0x30c70e){return new BPromise(function(_0x505c7f,_0x82e71){return client['request'](_0x3c7ef7,_0x30c70e)[_0x06d2('0x6')](function(_0x3cee76){if(_0x3cee76['error']){return _0x82e71(_0x3cee76[_0x06d2('0x7')][_0x06d2('0x8')]);}else{return _0x505c7f(_0x3cee76['result']);}})[_0x06d2('0x9')](function(_0x3206d2){return _0x82e71(_0x3206d2);});});}exports[_0x06d2('0xa')]=function(_0x78c1ae){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x78c1ae},'attributes':[_0x06d2('0xb')]}});};exports[_0x06d2('0xc')]=function(_0x2cfd66){return request(_0x06d2('0xd'),{'options':{'raw':![],'where':{'id':_0x2cfd66},'include':[{'model':_0x06d2('0xe'),'as':_0x06d2('0xf')}],'attributes':['id','name',_0x06d2('0x10')]}});};exports[_0x06d2('0x11')]=function(_0x27da14){return request(_0x06d2('0x12'),{'options':{'where':{'id':_0x27da14},'attributes':['name']}});};exports[_0x06d2('0x13')]=function(_0x3998d4){return request(_0x06d2('0x14'),{'options':{'where':{'id':_0x3998d4},'attributes':[_0x06d2('0x15')]}});};exports[_0x06d2('0x16')]=function(_0x14cffe){return request(_0x06d2('0x17'),{'options':{'where':{'id':_0x14cffe},'attributes':[_0x06d2('0x15')]}});};exports[_0x06d2('0x18')]=function(_0x3026ae){return request(_0x06d2('0x19'),{'options':{'where':{'id':_0x3026ae},'attributes':[_0x06d2('0x1a')]}});};exports[_0x06d2('0x1b')]=function(_0x293074){return request(_0x06d2('0x1c'),{'options':{'where':{'id':_0x293074},'attributes':[_0x06d2('0x15')]}});};exports[_0x06d2('0x1d')]=function(_0x17959e){console[_0x06d2('0x1e')]('rpcreq',_0x17959e);return request(_0x06d2('0x1f'),{'options':{'where':{'phone':_0x17959e['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x3ea83e){return request(_0x06d2('0x20'),{'options':{'where':{'id':_0x3ea83e},'attributes':[_0x06d2('0x15')]}});};exports[_0x06d2('0x21')]=function(_0x4aafdc){return request(_0x06d2('0x22'),{'options':{'where':{'id':_0x4aafdc},'attributes':['save_name']}});};exports[_0x06d2('0x23')]=function(_0x130988){return request(_0x06d2('0x24'),{'options':{'raw':![],'where':{'id':_0x130988},'include':[{'model':_0x06d2('0x25'),'as':_0x06d2('0x26')}]}});};exports['getSmsAccountById']=function(_0x2b902e){return request('ShowSmsAccount',{'options':{'where':{'id':_0x2b902e},'attributes':['id',_0x06d2('0x15')]}});};exports['createSmsMessage']=function(_0x5c78b8){return request(_0x06d2('0x27'),{'body':_0x5c78b8});};exports[_0x06d2('0x28')]=function(_0x1aced9){return request(_0x06d2('0x29'),{'body':_0x1aced9});};exports['createSquareReport']=function(_0x20046a){return request(_0x06d2('0x2a'),{'body':_['merge'](_0x20046a,{'project_name':_0x20046a['arg_1'],'prev_project_name':_0x20046a[_0x06d2('0x2b')]||'','is_subproject':_0x20046a[_0x06d2('0x2b')]?!![]:![],'leaveAt':moment()[_0x06d2('0x2c')](_0x06d2('0x2d'))})});};exports[_0x06d2('0x2e')]=function(_0xed3352){return request(_0x06d2('0x2f'),{'body':_0xed3352});};exports[_0x06d2('0x30')]=function(_0x8cd512){return request(_0x06d2('0x31'),{'body':_0x8cd512});};exports[_0x06d2('0x32')]=function(_0x4b210f){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4b210f['phone'],'ListId':_0x4b210f[_0x06d2('0x33')]}}})['then'](function(_0x4de744){if(_0x4de744){return _0x4de744;}return request('CreateCmContact',{'body':_0x4b210f});});};exports[_0x06d2('0x34')]=function(_0x92d623){return request('ShowPause',{'options':{'where':{'id':_0x92d623},'attributes':['name']}});};exports[_0x06d2('0x35')]=function(_0x1e3f89,_0x200245){return request(_0x06d2('0x36'),{'body':{'interface':_0x200245},'options':{'where':_0x1e3f89}});};exports[_0x06d2('0x37')]=function(_0x2c5d51,_0x417fb6,_0x236061){return request(_0x06d2('0x38'),{'body':{'type':_0x417fb6,'uniqueid':_0x236061},'options':{'where':_0x2c5d51}});};exports[_0x06d2('0x39')]=function(_0x10ffdc){return request(_0x06d2('0x3a'),{'body':{},'options':{'where':_0x10ffdc}});};exports['agentLogout']=function(_0x1c2d26){return request(_0x06d2('0x3b'),{'body':{},'options':{'where':_0x1c2d26}});}; \ 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 f2ed56d..370c1ed 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 _0x70e0=['exports','./polly','./lex'];(function(_0x22896b,_0x721d11){var _0x2ce27b=function(_0x5f3149){while(--_0x5f3149){_0x22896b['push'](_0x22896b['shift']());}};_0x2ce27b(++_0x721d11);}(_0x70e0,0x17b));var _0x070e=function(_0x1c775a,_0x55a744){_0x1c775a=_0x1c775a-0x0;var _0x195dd9=_0x70e0[_0x1c775a];return _0x195dd9;};var polly=require(_0x070e('0x0'));var lex=require(_0x070e('0x1'));module[_0x070e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x6737=['./lex','exports'];(function(_0x1cb783,_0x197145){var _0x4fae14=function(_0x2d9771){while(--_0x2d9771){_0x1cb783['push'](_0x1cb783['shift']());}};_0x4fae14(++_0x197145);}(_0x6737,0xe2));var _0x7673=function(_0x16c0fe,_0x38f056){_0x16c0fe=_0x16c0fe-0x0;var _0x4f7e0a=_0x6737[_0x16c0fe];return _0x4f7e0a;};var polly=require('./polly');var lex=require(_0x7673('0x0'));module[_0x7673('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 005fff9..5bfae52 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 _0xa588=['exports'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa588,0xe1));var _0x8a58=function(_0x2ae587,_0x44744c){_0x2ae587=_0x2ae587-0x0;var _0x121318=_0xa588[_0x2ae587];return _0x121318;};'use strict';var lex=require('./lib/api');module[_0x8a58('0x0')]=function(_0x3c5387,_0xd12c46,_0x11633d,_0x28a4e8,_0x2f8787,_0x40bfe3){return lex(_0x3c5387,_0xd12c46,_0x11633d,_0x28a4e8,_0x2f8787,_0x40bfe3);}; \ No newline at end of file +var _0x0e85=['./lib/api','exports'];(function(_0x5854a6,_0x4111dd){var _0x32c7ee=function(_0x4a28dd){while(--_0x4a28dd){_0x5854a6['push'](_0x5854a6['shift']());}};_0x32c7ee(++_0x4111dd);}(_0x0e85,0x7c));var _0x50e8=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x0e85[_0x4dc7b9];return _0x3ab114;};'use strict';var lex=require(_0x50e8('0x0'));module[_0x50e8('0x1')]=function(_0x5a568b,_0x11a13a,_0x682d10,_0x55e515,_0x55cba3,_0x4ce6cd){return lex(_0x5a568b,_0x11a13a,_0x682d10,_0x55e515,_0x55cba3,_0x4ce6cd);}; \ 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 2d06785..d424256 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 _0x9d3e=['postText','slots','slot_','exports','LexRuntime','$LATEST','aws-sdk'];(function(_0x44127a,_0x2bd9d3){var _0x2f827f=function(_0x4c2ca5){while(--_0x4c2ca5){_0x44127a['push'](_0x44127a['shift']());}};_0x2f827f(++_0x2bd9d3);}(_0x9d3e,0xd1));var _0xe9d3=function(_0x458f94,_0x308fc5){_0x458f94=_0x458f94-0x0;var _0x48dd3b=_0x9d3e[_0x458f94];return _0x48dd3b;};'use strict';var BPromise=require('bluebird');var AWS=require(_0xe9d3('0x0'));function lexResult(_0x2dd806,_0x2b53b4){return new BPromise(function(_0xd0a5f5,_0x352198){_0x2dd806[_0xe9d3('0x1')](_0x2b53b4,function(_0x32d6f8,_0x5848d0){if(_0x32d6f8){_0x352198(_0x32d6f8);}if(_0x5848d0[_0xe9d3('0x2')]){for(const _0x401fdd in _0x5848d0[_0xe9d3('0x2')]){if(_0x5848d0[_0xe9d3('0x2')]['hasOwnProperty'](_0x401fdd)){var _0x4e3cb6=_0x5848d0['slots'][_0x401fdd];_0x5848d0[_0xe9d3('0x3')+_0x401fdd]=_0x4e3cb6;}}}_0xd0a5f5(_0x5848d0);});});}module[_0xe9d3('0x4')]=function(_0x34faac,_0x36bc8e,_0x4f2147,_0xb236b5,_0x22b362,_0x1b2947){var _0x5c93f1=new AWS[(_0xe9d3('0x5'))]({'accessKeyId':_0x36bc8e,'secretAccessKey':_0x4f2147,'region':_0xb236b5});var _0xdfcfb5={'botAlias':_0xe9d3('0x6'),'botName':_0x1b2947,'inputText':_0x22b362,'userId':_0x34faac};return lexResult(_0x5c93f1,_0xdfcfb5);}; \ No newline at end of file +var _0x8f48=['bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_','exports'];(function(_0x579924,_0x3cec6d){var _0x44531c=function(_0x239c47){while(--_0x239c47){_0x579924['push'](_0x579924['shift']());}};_0x44531c(++_0x3cec6d);}(_0x8f48,0x18f));var _0x88f4=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x8f48[_0x4d2993];return _0x427374;};'use strict';var BPromise=require(_0x88f4('0x0'));var AWS=require(_0x88f4('0x1'));function lexResult(_0x17a294,_0x58696f){return new BPromise(function(_0xdaf327,_0x86af3){_0x17a294[_0x88f4('0x2')](_0x58696f,function(_0x5670c9,_0x18e4b9){if(_0x5670c9){_0x86af3(_0x5670c9);}if(_0x18e4b9['slots']){for(const _0x9d0485 in _0x18e4b9[_0x88f4('0x3')]){if(_0x18e4b9[_0x88f4('0x3')][_0x88f4('0x4')](_0x9d0485)){var _0x4242f5=_0x18e4b9[_0x88f4('0x3')][_0x9d0485];_0x18e4b9[_0x88f4('0x5')+_0x9d0485]=_0x4242f5;}}}_0xdaf327(_0x18e4b9);});});}module[_0x88f4('0x6')]=function(_0x16a851,_0x4d7cd7,_0x1a89b3,_0x5cfa58,_0xf792e0,_0x486dfc){var _0x20d3cd=new AWS['LexRuntime']({'accessKeyId':_0x4d7cd7,'secretAccessKey':_0x1a89b3,'region':_0x5cfa58});var _0x3527b0={'botAlias':'$LATEST','botName':_0x486dfc,'inputText':_0xf792e0,'userId':_0x16a851};return lexResult(_0x20d3cd,_0x3527b0);}; \ 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 a7d7a4f..f3f2303 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 _0x4534=['exports','./lib/api'];(function(_0x4fecba,_0x7d6438){var _0x1f0a44=function(_0x5c5e81){while(--_0x5c5e81){_0x4fecba['push'](_0x4fecba['shift']());}};_0x1f0a44(++_0x7d6438);}(_0x4534,0x141));var _0x4453=function(_0x1c4904,_0xbe307f){_0x1c4904=_0x1c4904-0x0;var _0xfbde31=_0x4534[_0x1c4904];return _0xfbde31;};'use strict';var polly=require(_0x4453('0x0'));module[_0x4453('0x1')]=function(_0x3097fc,_0x29f656,_0x516e12,_0x46eaf1,_0x2339f6,_0x3b1045,_0x26bdae){return polly(_0x3097fc,_0x29f656,_0x516e12,_0x46eaf1,_0x2339f6,_0x3b1045,_0x26bdae);}; \ No newline at end of file +var _0x8274=['./lib/api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8274,0x16d));var _0x4827=function(_0x47713a,_0xb8dc3a){_0x47713a=_0x47713a-0x0;var _0x345645=_0x8274[_0x47713a];return _0x345645;};'use strict';var polly=require(_0x4827('0x0'));module['exports']=function(_0x39c2e3,_0x287b76,_0x37b001,_0x24401b,_0x5e8391,_0x5559e0,_0x2871b9){return polly(_0x39c2e3,_0x287b76,_0x37b001,_0x24401b,_0x5e8391,_0x5559e0,_0x2871b9);}; \ 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 ff53057..8e0d1c7 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 _0x06a6=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x73b5d4,_0x529098){var _0x4a079f=function(_0x1abf16){while(--_0x1abf16){_0x73b5d4['push'](_0x73b5d4['shift']());}};_0x4a079f(++_0x529098);}(_0x06a6,0xff));var _0x606a=function(_0x5a685b,_0xa579c2){_0x5a685b=_0x5a685b-0x0;var _0x27178c=_0x06a6[_0x5a685b];return _0x27178c;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x606a('0x0'));var rs=require('randomstring');var AWS=require(_0x606a('0x1'));function pollyResult(_0x8e073e,_0x5e9fef,_0x5a36ca){return new BPromise(function(_0x3730cd,_0x5c75a5){_0x8e073e[_0x606a('0x2')](_0x5e9fef,function(_0x5487ad,_0x352dd4){if(_0x5487ad){_0x5c75a5(_0x5487ad);}else if(_0x352dd4){if(_0x352dd4[_0x606a('0x3')]instanceof Buffer){fs[_0x606a('0x4')](_0x5a36ca,_0x352dd4[_0x606a('0x3')],function(_0x4b19ed){if(_0x4b19ed){_0x5c75a5(_0x4b19ed);}else{_0x3730cd();}});}else{_0x5c75a5(new Error(_0x606a('0x5')));}}else{_0x5c75a5(new Error(_0x606a('0x6')));}});});}module['exports']=function(_0x25ec6b,_0x48d8e6,_0x476acf,_0x4fd5f0,_0x4e7903,_0x556ee1,_0x538ef9){var _0x5475fd=new AWS[(_0x606a('0x7'))]({'accessKeyId':_0x25ec6b,'secretAccessKey':_0x48d8e6,'region':_0x476acf});var _0xd46405={'Text':_0x4e7903,'TextType':_0x556ee1||_0x606a('0x8'),'OutputFormat':_0x606a('0x9'),'VoiceId':_0x4fd5f0};return pollyResult(_0x5475fd,_0xd46405,_0x538ef9);}; \ No newline at end of file +var _0x50e4=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0x50e4,0x1a0));var _0x450e=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x50e4[_0x2235bf];return _0x4c3a64;};'use strict';var fs=require('fs');var path=require(_0x450e('0x0'));var BPromise=require(_0x450e('0x1'));var rs=require(_0x450e('0x2'));var AWS=require(_0x450e('0x3'));function pollyResult(_0x535ccb,_0x3dbe12,_0x35ee8a){return new BPromise(function(_0x5c0984,_0x25921e){_0x535ccb['synthesizeSpeech'](_0x3dbe12,function(_0x59f41e,_0x91de7e){if(_0x59f41e){_0x25921e(_0x59f41e);}else if(_0x91de7e){if(_0x91de7e[_0x450e('0x4')]instanceof Buffer){fs[_0x450e('0x5')](_0x35ee8a,_0x91de7e[_0x450e('0x4')],function(_0x57b21b){if(_0x57b21b){_0x25921e(_0x57b21b);}else{_0x5c0984();}});}else{_0x25921e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x25921e(new Error(_0x450e('0x6')));}});});}module[_0x450e('0x7')]=function(_0x1452e9,_0x571fcc,_0x1bd31d,_0x3d96e9,_0x3a0c9e,_0x326ff0,_0x2fd067){var _0x117ca9=new AWS['Polly']({'accessKeyId':_0x1452e9,'secretAccessKey':_0x571fcc,'region':_0x1bd31d});var _0x3928b3={'Text':_0x3a0c9e,'TextType':_0x326ff0||_0x450e('0x8'),'OutputFormat':_0x450e('0x9'),'VoiceId':_0x3d96e9};return pollyResult(_0x117ca9,_0x3928b3,_0x2fd067);}; \ 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 cc0adbe..9a70b06 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 _0x9f20=['exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9f20,0x11a));var _0x09f2=function(_0x3b8050,_0x2ddb67){_0x3b8050=_0x3b8050-0x0;var _0x3c06f=_0x9f20[_0x3b8050];return _0x3c06f;};'use strict';var asr=require('./lib/api');module[_0x09f2('0x0')]=function(_0x38394f,_0x42fdf6,_0x151bf6,_0x5222ce){return asr(_0x38394f,_0x42fdf6,_0x151bf6);}; \ No newline at end of file +var _0xcba7=['exports','./lib/api'];(function(_0x4ff30f,_0x1647b4){var _0x27fd11=function(_0x1d4ed9){while(--_0x1d4ed9){_0x4ff30f['push'](_0x4ff30f['shift']());}};_0x27fd11(++_0x1647b4);}(_0xcba7,0x147));var _0x7cba=function(_0x40b13e,_0x2837ab){_0x40b13e=_0x40b13e-0x0;var _0x3a949a=_0xcba7[_0x40b13e];return _0x3a949a;};'use strict';var asr=require(_0x7cba('0x0'));module[_0x7cba('0x1')]=function(_0x5843d7,_0x5d2cad,_0x2aa945,_0xf0ccda){return asr(_0x5843d7,_0x5d2cad,_0x2aa945);}; \ 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 7ebb8cb..ef9bde3 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 _0x7fad=['string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports'];(function(_0x511b43,_0x5c2e15){var _0x33498c=function(_0x418498){while(--_0x418498){_0x511b43['push'](_0x511b43['shift']());}};_0x33498c(++_0x5c2e15);}(_0x7fad,0x123));var _0xd7fa=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x7fad[_0x382a62];return _0x490a25;};'use strict';var url=require('url');var BPromise=require(_0xd7fa('0x0'));var fs=require('fs');var host=_0xd7fa('0x1');module[_0xd7fa('0x2')]=function(_0x3d175a,_0x1492c6,_0x4747e5){return new BPromise(function(_0x4df6f0,_0x5eefb4){var _0x276819;if(typeof _0x3d175a!==_0xd7fa('0x3')||_0x3d175a['length']===0x0){return _0x5eefb4(_0xd7fa('0x4'));}if(typeof _0x1492c6!==_0xd7fa('0x3')||_0x1492c6[_0xd7fa('0x5')]===0x0){return _0x5eefb4(_0xd7fa('0x6'));}if(typeof _0x4747e5!=='undefined'&&(typeof _0x4747e5!==_0xd7fa('0x3')||_0x4747e5[_0xd7fa('0x5')]===0x0)){return _0x5eefb4('lang\x20should\x20be\x20a\x20string');}try{_0x276819=fs[_0xd7fa('0x7')](_0x3d175a)[_0xd7fa('0x8')](_0xd7fa('0x9'));}catch(_0x40df92){return _0x5eefb4(_0x40df92);}return _0x4df6f0({'method':_0xd7fa('0xa'),'uri':host+_0xd7fa('0xb')+_0x1492c6,'body':{'config':{'encoding':_0xd7fa('0xc'),'sampleRateHertz':_0xd7fa('0xd'),'languageCode':_0x4747e5},'audio':{'content':_0x276819}},'json':!![]});});}; \ No newline at end of file +var _0xc648=['LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','readFileSync','base64'];(function(_0x393365,_0x2b254e){var _0x58fb5=function(_0x46e5f1){while(--_0x46e5f1){_0x393365['push'](_0x393365['shift']());}};_0x58fb5(++_0x2b254e);}(_0xc648,0xb1));var _0x8c64=function(_0x9120d7,_0x481127){_0x9120d7=_0x9120d7-0x0;var _0x352601=_0xc648[_0x9120d7];return _0x352601;};'use strict';var url=require(_0x8c64('0x0'));var BPromise=require(_0x8c64('0x1'));var fs=require('fs');var host=_0x8c64('0x2');module[_0x8c64('0x3')]=function(_0x24ba55,_0x552700,_0x45921c){return new BPromise(function(_0x2120af,_0x5f3068){var _0x5d40cf;if(typeof _0x24ba55!==_0x8c64('0x4')||_0x24ba55[_0x8c64('0x5')]===0x0){return _0x5f3068(_0x8c64('0x6'));}if(typeof _0x552700!=='string'||_0x552700[_0x8c64('0x5')]===0x0){return _0x5f3068('key\x20should\x20be\x20a\x20string');}if(typeof _0x45921c!==_0x8c64('0x7')&&(typeof _0x45921c!==_0x8c64('0x4')||_0x45921c[_0x8c64('0x5')]===0x0)){return _0x5f3068('lang\x20should\x20be\x20a\x20string');}try{_0x5d40cf=fs[_0x8c64('0x8')](_0x24ba55)['toString'](_0x8c64('0x9'));}catch(_0x49b00f){return _0x5f3068(_0x49b00f);}return _0x2120af({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x552700,'body':{'config':{'encoding':_0x8c64('0xa'),'sampleRateHertz':'8000','languageCode':_0x45921c},'audio':{'content':_0x5d40cf}},'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 c448fd6..2160425 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 _0xdd34=['./asr'];(function(_0x376d80,_0x2ebcd3){var _0x2a47fe=function(_0x2fbb7c){while(--_0x2fbb7c){_0x376d80['push'](_0x376d80['shift']());}};_0x2a47fe(++_0x2ebcd3);}(_0xdd34,0x1db));var _0x4dd3=function(_0x2f53fc,_0x2a34d7){_0x2f53fc=_0x2f53fc-0x0;var _0xa911c2=_0xdd34[_0x2f53fc];return _0xa911c2;};var asr=require(_0x4dd3('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x1af1=['exports','./asr'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1af1,0x133));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};var asr=require(_0x11af('0x0'));module[_0x11af('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index f818723..206880c 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 _0x39a6=['path','http','https','url','parse','randomstring','util','querystring','google-tts-api','apiai-promise','./google','./aws','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:','get','data','transcode','wav','finish\x20to\x20convert','start','resolve','generate','.wav','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','.mp3','goggleTTS\x20path','asr','uri','results','map','alternatives','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','metadata','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','ispeechASR','format','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x39a6,0xd8));var _0x639a=function(_0x13ea34,_0x3a627e){_0x13ea34=_0x13ea34-0x0;var _0x1c4a8d=_0x39a6[_0x13ea34];return _0x1c4a8d;};'use strict';var fs=require('fs');var path=require(_0x639a('0x0'));var http=require(_0x639a('0x1'));var https=require(_0x639a('0x2'));var urlParse=require(_0x639a('0x3'))[_0x639a('0x4')];var BPromise=require('bluebird');var rs=require(_0x639a('0x5'));var sox=require('sox');var rp=require('request-promise');var util=require(_0x639a('0x6'));var querystring=require(_0x639a('0x7'));var tts=require(_0x639a('0x8'));var apiai=require(_0x639a('0x9'));var md5=require('md5');var google=require(_0x639a('0xa'));var aws=require(_0x639a('0xb'));var tilde=require('./tilde');var sestek=require(_0x639a('0xc'));var logger=require(_0x639a('0xd'))('agi');var ISPEECH_API=_0x639a('0xe');function downloadFile(_0x228889,_0x65deeb){return new BPromise(function(_0x4ee9e8,_0x261fe0){var _0x2e7f97=urlParse(_0x228889);var _0x35b90d=_0x2e7f97[_0x639a('0xf')]==='https:'?https:http;var _0x59d0e3={'host':_0x2e7f97[_0x639a('0x10')],'path':_0x2e7f97['path'],'headers':{'user-agent':_0x639a('0x11')}};_0x35b90d['get'](_0x59d0e3,function(_0x36097e){if(_0x36097e[_0x639a('0x12')]!==0xc8){logger[_0x639a('0x13')]('request\x20to\x20'+_0x228889+_0x639a('0x14')+_0x36097e[_0x639a('0x12')]+'\x20('+_0x36097e['statusMessage']+')');_0x261fe0(new Error(_0x639a('0x15')+_0x228889+_0x639a('0x14')+_0x36097e[_0x639a('0x12')]+'\x20('+_0x36097e[_0x639a('0x16')]+')'));return;}var _0x12fe95=fs[_0x639a('0x17')](_0x65deeb);_0x12fe95['on'](_0x639a('0x18'),function(){logger[_0x639a('0x19')](_0x639a('0x1a'));_0x12fe95[_0x639a('0x1b')](_0x4ee9e8);});_0x12fe95['on'](_0x639a('0x13'),function(_0x34ac6a){fs[_0x639a('0x1c')](_0x65deeb);logger['error'](_0x639a('0x1d'),_0x34ac6a);_0x261fe0(_0x34ac6a);});_0x36097e[_0x639a('0x1e')](_0x12fe95);})['on'](_0x639a('0x13'),function(_0x1c4daa){logger[_0x639a('0x13')](_0x1c4daa);_0x261fe0(_0x1c4daa);})[_0x639a('0x1f')]();});}function uploadFile(_0x1d6b6b){return new BPromise(function(_0x4c1853,_0x360e08){var _0x6ad517=urlParse(_0x1d6b6b);var _0x472ac1=_0x6ad517[_0x639a('0xf')]===_0x639a('0x20')?https:http;var _0x3e2518={'host':_0x6ad517[_0x639a('0x10')],'path':_0x6ad517[_0x639a('0x0')],'headers':{'user-agent':_0x639a('0x11')}};_0x472ac1[_0x639a('0x21')](_0x3e2518,function(_0x1d9469){if(_0x1d9469[_0x639a('0x12')]!==0xc8){_0x360e08(new Error(_0x639a('0x15')+_0x1d6b6b+'\x20failed,\x20status\x20code\x20=\x20'+_0x1d9469['statusCode']+'\x20('+_0x1d9469[_0x639a('0x16')]+')'));return;}var _0x1b6c6d='';_0x1d9469['on'](_0x639a('0x22'),function(_0x3537e6){_0x1b6c6d+=_0x3537e6;});_0x1d9469['on'](_0x639a('0x1f'),function(){_0x4c1853(_0x1b6c6d);});})['on'](_0x639a('0x13'),function(_0x16867b){_0x360e08(_0x16867b);})[_0x639a('0x1f')]();});}function convertFile(_0x532c5e,_0x29ed8c){return new BPromise(function(_0x54c9bb,_0x448bf3){var _0x37a679=sox[_0x639a('0x23')](_0x532c5e,_0x29ed8c,{'sampleRate':0x1f40,'format':_0x639a('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x37a679['on']('error',function(_0x32c885){logger[_0x639a('0x13')]('error\x20convert',_0x32c885);_0x448bf3(_0x32c885);});_0x37a679['on']('end',function(){logger['info'](_0x639a('0x25'));_0x54c9bb();});_0x37a679[_0x639a('0x26')]();});}function base64Decode(_0x3338c1,_0x5b07d4){var _0x11e358=path[_0x639a('0x27')](__dirname,'tmp',rs[_0x639a('0x28')](0x4)+_0x639a('0x29'));fs['writeFileSync'](_0x11e358,_0x3338c1,_0x639a('0x2a'));return convertFile(_0x11e358,_0x5b07d4)[_0x639a('0x2b')](function(){try{fs[_0x639a('0x1c')](_0x11e358);fs['chmodSync'](_0x5b07d4,_0x639a('0x2c'));}catch(_0x5b9c9a){logger[_0x639a('0x13')](_0x5b9c9a);}return _0x5b07d4[_0x639a('0x2d')]('.')[0x0];});}function base64Encode(_0x37e9a8){var _0xaad840=fs[_0x639a('0x2e')](_0x37e9a8);return new Buffer(_0xaad840)[_0x639a('0x2f')](_0x639a('0x2a'));}exports[_0x639a('0x30')]=function(_0x48c0bc,_0x41da8d,_0x1c1964,_0x48a4ac,_0x1d556b,_0x4f01b9){var _0x4dae0e,_0x377383;var _0x1983f5=_0x639a('0x31');var _0x274667=_0x639a('0x32')+_0x48c0bc;var _0x14838e={};if(_0x41da8d==='ssml'){_0x14838e[_0x639a('0x33')]={'ssml':_0x1c1964};}else{_0x14838e['input']={'text':_0x1c1964};};_0x14838e[_0x639a('0x34')]={'languageCode':_0x48a4ac,'ssmlGender':_0x1d556b};_0x14838e[_0x639a('0x35')]={'audioEncoding':_0x639a('0x36'),'sampleRateHertz':0x1f40};var _0x209129={'url':_0x1983f5+_0x639a('0x37')+_0x274667,'method':_0x639a('0x38'),'json':!![],'body':_0x14838e};return rp(_0x209129)[_0x639a('0x2b')](function(_0x3145fd){return new BPromise(function(_0x440ad5,_0x1d64e3){_0x4dae0e=path[_0x639a('0x27')](__dirname,_0x639a('0x39'),rs[_0x639a('0x28')](0x4)+'.mp3');var _0x491f1e=Buffer['from'](_0x3145fd['audioContent'],'base64');return fs[_0x639a('0x3a')](_0x4dae0e,_0x491f1e,function(_0xc806e8){_0x1d64e3(_0xc806e8);},function(_0x1efe80){fs[_0x639a('0x3b')](_0x4dae0e,_0x639a('0x2c'));_0x440ad5(_0x1efe80);});});})['then'](function(_0x4ff35d){_0x377383=path['resolve'](__dirname,_0x639a('0x39'),rs['generate'](0x4)+_0x639a('0x29'));return convertFile(_0x4dae0e,_0x377383);})[_0x639a('0x2b')](function(){try{fs[_0x639a('0x1c')](_0x4dae0e);fs[_0x639a('0x3b')](_0x377383,_0x639a('0x2c'));}catch(_0x3b156c){logger['error'](_0x3b156c);}logger[_0x639a('0x19')](_0x639a('0x3c'),_0x377383[_0x639a('0x2d')]('.')[0x0]);return _0x377383[_0x639a('0x2d')]('.')[0x0];});};exports[_0x639a('0x3d')]=function(_0x3026cd,_0x49c886){var _0x240f81,_0x5d12a1;return tts(_0x3026cd,_0x49c886||'en',0x1)[_0x639a('0x2b')](function(_0x548439){logger[_0x639a('0x19')](_0x548439);_0x240f81=path[_0x639a('0x27')](__dirname,'tmp',rs[_0x639a('0x28')](0x4)+_0x639a('0x3e'));return downloadFile(_0x548439,_0x240f81);})['then'](function(){_0x5d12a1=path[_0x639a('0x27')](__dirname,'tmp',rs[_0x639a('0x28')](0x4)+'.wav');return convertFile(_0x240f81,_0x5d12a1);})[_0x639a('0x2b')](function(){try{fs[_0x639a('0x1c')](_0x240f81);fs[_0x639a('0x3b')](_0x5d12a1,_0x639a('0x2c'));}catch(_0xa0f230){logger[_0x639a('0x13')](_0xa0f230);}logger[_0x639a('0x19')](_0x639a('0x3f'),_0x5d12a1[_0x639a('0x2d')]('.')[0x0]);return _0x5d12a1[_0x639a('0x2d')]('.')[0x0];});};exports['googleASR']=function(_0x43ee70,_0x8358dd,_0x38ab77){return google[_0x639a('0x40')](_0x43ee70,_0x8358dd,_0x38ab77)[_0x639a('0x2b')](function(_0x33af73){logger[_0x639a('0x19')](_0x33af73[_0x639a('0x41')]);return rp(_0x33af73);})['then'](function(_0x495d44){var _0x3c42ca='';var _0xa92d4a=0x0;try{fs['unlink'](_0x43ee70);}catch(_0x52e073){logger['error'](_0x52e073);}if(_0x495d44&&_0x495d44[_0x639a('0x42')]){_0x3c42ca=_0x495d44['results'][_0x639a('0x43')](function(_0x974a79){return _0x974a79&&_0x974a79[_0x639a('0x44')][0x0]&&_0x974a79['alternatives'][0x0]['transcript']?_0x974a79[_0x639a('0x44')][0x0]['transcript']:'';})[_0x639a('0x45')]('\x0a');_0xa92d4a=_0x495d44[_0x639a('0x42')]['map'](function(_0x46cb25){return _0x46cb25&&_0x46cb25[_0x639a('0x44')][0x0]&&_0x46cb25['alternatives'][0x0]['confidence']?_0x46cb25[_0x639a('0x44')][0x0][_0x639a('0x46')]:0x0;})[_0x639a('0x45')]('\x0a');}logger[_0x639a('0x19')](_0x639a('0x47'),_0x3c42ca);logger[_0x639a('0x19')]('googleASR\x20confidence',_0xa92d4a);return{'transcript':_0x3c42ca,'confidence':_0xa92d4a};})[_0x639a('0x48')](function(_0xb8c987){logger['error'](_0x639a('0x49'),_0xb8c987['statusCode'],_0xb8c987['name'],_0xb8c987['message']);});};exports[_0x639a('0x4a')]=function(_0x12c826,_0x5c3b55,_0xff3d7b,_0x7f8b65){var _0x32cf63=apiai(_0x5c3b55,{'language':_0x7f8b65||'en'});return _0x32cf63[_0x639a('0x4b')](_0xff3d7b,{'sessionId':md5(_0x12c826)})[_0x639a('0x2b')](function(_0x3bae6f){logger[_0x639a('0x19')](JSON[_0x639a('0x4c')](_0x3bae6f));return{'source':_0x3bae6f[_0x639a('0x4d')][_0x639a('0x4e')],'resolvedQuery':_0x3bae6f[_0x639a('0x4d')][_0x639a('0x4f')],'action':_0x3bae6f['result']['action'],'actionIncomplete':_0x3bae6f[_0x639a('0x4d')][_0x639a('0x50')],'speech':_0x3bae6f[_0x639a('0x4d')][_0x639a('0x51')][_0x639a('0x52')],'score':_0x3bae6f[_0x639a('0x4d')][_0x639a('0x53')],'statusCode':_0x3bae6f[_0x639a('0x54')]['code'],'endConversation':_0x3bae6f[_0x639a('0x4d')][_0x639a('0x55')]['endConversation']||![],'isFallbackIntent':_0x3bae6f[_0x639a('0x4d')]['metadata'][_0x639a('0x56')]};});};exports[_0x639a('0x57')]=function(_0x5f0193,_0x592dde,_0x1b4b09,_0x46012c){return tilde['asr'](_0x5f0193,_0x592dde,_0x1b4b09,_0x46012c)['then'](function(_0x3085aa){try{fs[_0x639a('0x1c')](_0x5f0193);}catch(_0x20e6bc){logger[_0x639a('0x13')](_0x20e6bc);}logger[_0x639a('0x19')](_0x639a('0x58'),_0x3085aa[_0x639a('0x59')]);logger[_0x639a('0x19')](_0x639a('0x5a'),_0x3085aa[_0x639a('0x46')]);return _0x3085aa;});};exports[_0x639a('0x5b')]=function(_0x138fcf,_0x8652bf,_0x59517d,_0x2a7330,_0x45dd49,_0xe09e27){var _0x1a52c3=path[_0x639a('0x27')](__dirname,_0x639a('0x39'),rs[_0x639a('0x28')](0x4)+_0x639a('0x3e'));var _0x13d86f;return aws[_0x639a('0x5c')](_0x138fcf,_0x8652bf,_0x59517d,_0x2a7330,_0x45dd49,_0xe09e27,_0x1a52c3)[_0x639a('0x2b')](function(){_0x13d86f=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x1a52c3,_0x13d86f);})[_0x639a('0x2b')](function(){try{fs[_0x639a('0x1c')](_0x1a52c3);fs[_0x639a('0x3b')](_0x13d86f,_0x639a('0x2c'));}catch(_0x13b115){logger[_0x639a('0x13')](_0x13b115);}return _0x13d86f[_0x639a('0x2d')]('.')[0x0];});};exports[_0x639a('0x5d')]=function(_0x37cc98,_0x505731,_0x42eec8,_0x2eefa4,_0x2abaa9,_0x375bb6){return aws['lex'](_0x37cc98,_0x505731,_0x42eec8,_0x2eefa4,_0x2abaa9,_0x375bb6)[_0x639a('0x2b')](function(_0x2f5319){logger[_0x639a('0x19')](JSON[_0x639a('0x4c')](_0x2f5319));return _0x2f5319;});};exports[_0x639a('0x5e')]=function(_0x467625,_0x39e3d6,_0x592c4b,_0x695453){var _0x50714e=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x467625,encodeURIComponent(_0x39e3d6),_0x592c4b,_0x695453);var _0x5beda2=path[_0x639a('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x639a('0x3e'));var _0x44e2ae;return downloadFile(_0x50714e,_0x5beda2)[_0x639a('0x2b')](function(){_0x44e2ae=path[_0x639a('0x27')](__dirname,_0x639a('0x39'),rs[_0x639a('0x28')](0x4)+_0x639a('0x29'));return convertFile(_0x5beda2,_0x44e2ae);})[_0x639a('0x2b')](function(){try{fs[_0x639a('0x1c')](_0x5beda2);fs[_0x639a('0x3b')](_0x44e2ae,_0x639a('0x2c'));}catch(_0x1700d1){logger[_0x639a('0x13')](_0x1700d1);}return _0x44e2ae[_0x639a('0x2d')]('.')[0x0];});};exports[_0x639a('0x5f')]=function(_0x348e3d,_0xa431e0,_0x257328,_0x5c39d9){var _0x5e4620=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xa431e0,_0x257328,base64Encode(_0x348e3d),_0x5c39d9?util[_0x639a('0x60')]('model=%s',encodeURIComponent(_0x5c39d9)):_0x639a('0x61'));return uploadFile(_0x5e4620)[_0x639a('0x2b')](function(_0x31b02b){return querystring['parse'](_0x31b02b);});};exports[_0x639a('0x62')]=function(_0x27dca8,_0x22dbd0){return sestek[_0x639a('0x63')](_0x27dca8,_0x22dbd0)[_0x639a('0x2b')](function(_0x5e493b){logger[_0x639a('0x19')](JSON[_0x639a('0x4c')](_0x5e493b));var _0x1dce81={'speech':_0x5e493b[_0x639a('0x64')],'action':_0x5e493b[_0x639a('0x65')]?_0x5e493b[_0x639a('0x65')][_0x639a('0x66')]:undefined,'actiondata':_0x5e493b[_0x639a('0x65')]?_0x5e493b[_0x639a('0x65')][_0x639a('0x67')]:undefined};if(_0x5e493b[_0x639a('0x65')]&&_0x5e493b['channelData'][_0x639a('0x68')]){return base64Decode(_0x5e493b[_0x639a('0x65')][_0x639a('0x68')][_0x639a('0x69')],path['resolve'](__dirname,'tmp',rs[_0x639a('0x28')](0x4)+'.wav'))[_0x639a('0x2b')](function(_0x361dbb){_0x1dce81[_0x639a('0x6a')]=_0x361dbb;return _0x1dce81;});}return _0x1dce81;});};exports[_0x639a('0x6b')]=function(){return __dirname;}; \ No newline at end of file +var _0x230e=['https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','writeFile','777','.wav','googleTTS','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','score','status','code','endConversation','metadata','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','path','http','https','randomstring','sox','request-promise','util','google-tts-api','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','https:','data','end','transcode','finish\x20to\x20convert','start','tmp','generate','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS'];(function(_0x37dd41,_0x48f9cc){var _0x4b01c0=function(_0x257133){while(--_0x257133){_0x37dd41['push'](_0x37dd41['shift']());}};_0x4b01c0(++_0x48f9cc);}(_0x230e,0xb6));var _0xe230=function(_0x5b6f6d,_0x35a6de){_0x5b6f6d=_0x5b6f6d-0x0;var _0x434b0c=_0x230e[_0x5b6f6d];return _0x434b0c;};'use strict';var fs=require('fs');var path=require(_0xe230('0x0'));var http=require(_0xe230('0x1'));var https=require(_0xe230('0x2'));var urlParse=require('url')['parse'];var BPromise=require('bluebird');var rs=require(_0xe230('0x3'));var sox=require(_0xe230('0x4'));var rp=require(_0xe230('0x5'));var util=require(_0xe230('0x6'));var querystring=require('querystring');var tts=require(_0xe230('0x7'));var apiai=require('apiai-promise');var md5=require(_0xe230('0x8'));var google=require(_0xe230('0x9'));var aws=require(_0xe230('0xa'));var tilde=require(_0xe230('0xb'));var sestek=require(_0xe230('0xc'));var logger=require(_0xe230('0xd'))(_0xe230('0xe'));var ISPEECH_API=_0xe230('0xf');function downloadFile(_0x1acf85,_0x124aa8){return new BPromise(function(_0x57c2e3,_0x11d534){var _0x458353=urlParse(_0x1acf85);var _0x25a4e6=_0x458353[_0xe230('0x10')]==='https:'?https:http;var _0x5d7909={'host':_0x458353[_0xe230('0x11')],'path':_0x458353[_0xe230('0x0')],'headers':{'user-agent':_0xe230('0x12')}};_0x25a4e6[_0xe230('0x13')](_0x5d7909,function(_0x3ed44e){if(_0x3ed44e[_0xe230('0x14')]!==0xc8){logger['error'](_0xe230('0x15')+_0x1acf85+_0xe230('0x16')+_0x3ed44e[_0xe230('0x14')]+'\x20('+_0x3ed44e[_0xe230('0x17')]+')');_0x11d534(new Error(_0xe230('0x15')+_0x1acf85+'\x20failed,\x20status\x20code\x20=\x20'+_0x3ed44e[_0xe230('0x14')]+'\x20('+_0x3ed44e[_0xe230('0x17')]+')'));return;}var _0x3eb314=fs['createWriteStream'](_0x124aa8);_0x3eb314['on'](_0xe230('0x18'),function(){logger[_0xe230('0x19')](_0xe230('0x1a'));_0x3eb314[_0xe230('0x1b')](_0x57c2e3);});_0x3eb314['on'](_0xe230('0x1c'),function(_0x454020){fs[_0xe230('0x1d')](_0x124aa8);logger[_0xe230('0x1c')](_0xe230('0x1e'),_0x454020);_0x11d534(_0x454020);});_0x3ed44e[_0xe230('0x1f')](_0x3eb314);})['on'](_0xe230('0x1c'),function(_0x57c1d2){logger[_0xe230('0x1c')](_0x57c1d2);_0x11d534(_0x57c1d2);})['end']();});}function uploadFile(_0x488b4a){return new BPromise(function(_0x1ef5a5,_0x5266e8){var _0xe95513=urlParse(_0x488b4a);var _0x15ce88=_0xe95513[_0xe230('0x10')]===_0xe230('0x20')?https:http;var _0x3b3c44={'host':_0xe95513[_0xe230('0x11')],'path':_0xe95513['path'],'headers':{'user-agent':_0xe230('0x12')}};_0x15ce88[_0xe230('0x13')](_0x3b3c44,function(_0x5bb15d){if(_0x5bb15d[_0xe230('0x14')]!==0xc8){_0x5266e8(new Error(_0xe230('0x15')+_0x488b4a+_0xe230('0x16')+_0x5bb15d['statusCode']+'\x20('+_0x5bb15d[_0xe230('0x17')]+')'));return;}var _0x4c3729='';_0x5bb15d['on'](_0xe230('0x21'),function(_0x195d33){_0x4c3729+=_0x195d33;});_0x5bb15d['on'](_0xe230('0x22'),function(){_0x1ef5a5(_0x4c3729);});})['on']('error',function(_0x43f268){_0x5266e8(_0x43f268);})[_0xe230('0x22')]();});}function convertFile(_0x17ef64,_0x1bb8cf){return new BPromise(function(_0x43143c,_0x218c36){var _0x2314f6=sox[_0xe230('0x23')](_0x17ef64,_0x1bb8cf,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2314f6['on'](_0xe230('0x1c'),function(_0x29c18c){logger[_0xe230('0x1c')]('error\x20convert',_0x29c18c);_0x218c36(_0x29c18c);});_0x2314f6['on'](_0xe230('0x22'),function(){logger['info'](_0xe230('0x24'));_0x43143c();});_0x2314f6[_0xe230('0x25')]();});}function base64Decode(_0x4b9fd1,_0xc4cfe3){var _0x2b8aa6=path['resolve'](__dirname,_0xe230('0x26'),rs[_0xe230('0x27')](0x4)+'.wav');fs[_0xe230('0x28')](_0x2b8aa6,_0x4b9fd1,_0xe230('0x29'));return convertFile(_0x2b8aa6,_0xc4cfe3)[_0xe230('0x2a')](function(){try{fs[_0xe230('0x1d')](_0x2b8aa6);fs[_0xe230('0x2b')](_0xc4cfe3,'777');}catch(_0x13098d){logger[_0xe230('0x1c')](_0x13098d);}return _0xc4cfe3[_0xe230('0x2c')]('.')[0x0];});}function base64Encode(_0x146815){var _0x4f1602=fs[_0xe230('0x2d')](_0x146815);return new Buffer(_0x4f1602)[_0xe230('0x2e')](_0xe230('0x29'));}exports[_0xe230('0x2f')]=function(_0x105b6d,_0x3a7c23,_0x532ab,_0x21ec47,_0x158632,_0x3d0ee2){var _0x5fbb28,_0x4fa960;var _0x4d8ad3=_0xe230('0x30');var _0x4dc84b='?key='+_0x105b6d;var _0x17bd5c={};if(_0x3a7c23===_0xe230('0x31')){_0x17bd5c['input']={'ssml':_0x532ab};}else{_0x17bd5c[_0xe230('0x32')]={'text':_0x532ab};};_0x17bd5c[_0xe230('0x33')]={'languageCode':_0x21ec47,'ssmlGender':_0x158632};_0x17bd5c[_0xe230('0x34')]={'audioEncoding':_0xe230('0x35'),'sampleRateHertz':0x1f40};var _0x445afb={'url':_0x4d8ad3+_0xe230('0x36')+_0x4dc84b,'method':_0xe230('0x37'),'json':!![],'body':_0x17bd5c};return rp(_0x445afb)[_0xe230('0x2a')](function(_0x2cbdc1){return new BPromise(function(_0x2019b4,_0x56eec8){_0x5fbb28=path[_0xe230('0x38')](__dirname,'tmp',rs[_0xe230('0x27')](0x4)+_0xe230('0x39'));var _0x379688=Buffer[_0xe230('0x3a')](_0x2cbdc1['audioContent'],'base64');return fs[_0xe230('0x3b')](_0x5fbb28,_0x379688,function(_0x42c77f){_0x56eec8(_0x42c77f);},function(_0x2b6877){fs[_0xe230('0x2b')](_0x5fbb28,_0xe230('0x3c'));_0x2019b4(_0x2b6877);});});})[_0xe230('0x2a')](function(_0x553f06){_0x4fa960=path[_0xe230('0x38')](__dirname,_0xe230('0x26'),rs[_0xe230('0x27')](0x4)+_0xe230('0x3d'));return convertFile(_0x5fbb28,_0x4fa960);})[_0xe230('0x2a')](function(){try{fs['unlink'](_0x5fbb28);fs[_0xe230('0x2b')](_0x4fa960,_0xe230('0x3c'));}catch(_0x425eb4){logger['error'](_0x425eb4);}logger[_0xe230('0x19')]('googleCloudTTS\x20path',_0x4fa960[_0xe230('0x2c')]('.')[0x0]);return _0x4fa960[_0xe230('0x2c')]('.')[0x0];});};exports[_0xe230('0x3e')]=function(_0x37149f,_0x491197){var _0x5b988a,_0x5871b7;return tts(_0x37149f,_0x491197||'en',0x1)['then'](function(_0x3afda2){logger['info'](_0x3afda2);_0x5b988a=path['resolve'](__dirname,_0xe230('0x26'),rs[_0xe230('0x27')](0x4)+_0xe230('0x39'));return downloadFile(_0x3afda2,_0x5b988a);})[_0xe230('0x2a')](function(){_0x5871b7=path[_0xe230('0x38')](__dirname,_0xe230('0x26'),rs[_0xe230('0x27')](0x4)+_0xe230('0x3d'));return convertFile(_0x5b988a,_0x5871b7);})[_0xe230('0x2a')](function(){try{fs['unlink'](_0x5b988a);fs['chmodSync'](_0x5871b7,_0xe230('0x3c'));}catch(_0x56e6eb){logger[_0xe230('0x1c')](_0x56e6eb);}logger['info'](_0xe230('0x3f'),_0x5871b7[_0xe230('0x2c')]('.')[0x0]);return _0x5871b7[_0xe230('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x4c19ae,_0x389481,_0x698e04){return google[_0xe230('0x40')](_0x4c19ae,_0x389481,_0x698e04)[_0xe230('0x2a')](function(_0x444119){logger[_0xe230('0x19')](_0x444119[_0xe230('0x41')]);return rp(_0x444119);})['then'](function(_0x59cd9b){var _0x5adf0a='';var _0x25baac=0x0;try{fs[_0xe230('0x1d')](_0x4c19ae);}catch(_0x540a94){logger[_0xe230('0x1c')](_0x540a94);}if(_0x59cd9b&&_0x59cd9b[_0xe230('0x42')]){_0x5adf0a=_0x59cd9b[_0xe230('0x42')][_0xe230('0x43')](function(_0x4c8d94){return _0x4c8d94&&_0x4c8d94[_0xe230('0x44')][0x0]&&_0x4c8d94['alternatives'][0x0][_0xe230('0x45')]?_0x4c8d94[_0xe230('0x44')][0x0][_0xe230('0x45')]:'';})['join']('\x0a');_0x25baac=_0x59cd9b['results'][_0xe230('0x43')](function(_0x486514){return _0x486514&&_0x486514[_0xe230('0x44')][0x0]&&_0x486514['alternatives'][0x0]['confidence']?_0x486514[_0xe230('0x44')][0x0][_0xe230('0x46')]:0x0;})[_0xe230('0x47')]('\x0a');}logger[_0xe230('0x19')](_0xe230('0x48'),_0x5adf0a);logger[_0xe230('0x19')](_0xe230('0x49'),_0x25baac);return{'transcript':_0x5adf0a,'confidence':_0x25baac};})[_0xe230('0x4a')](function(_0x424c0c){logger[_0xe230('0x1c')](_0xe230('0x4b'),_0x424c0c[_0xe230('0x14')],_0x424c0c[_0xe230('0x4c')],_0x424c0c[_0xe230('0x4d')]);});};exports[_0xe230('0x4e')]=function(_0x55a39a,_0x3959ff,_0x2efb61,_0x5d68f0){var _0x4f63b0=apiai(_0x3959ff,{'language':_0x5d68f0||'en'});return _0x4f63b0['textRequest'](_0x2efb61,{'sessionId':md5(_0x55a39a)})['then'](function(_0x2212ca){logger[_0xe230('0x19')](JSON[_0xe230('0x4f')](_0x2212ca));return{'source':_0x2212ca[_0xe230('0x50')][_0xe230('0x51')],'resolvedQuery':_0x2212ca['result'][_0xe230('0x52')],'action':_0x2212ca['result'][_0xe230('0x53')],'actionIncomplete':_0x2212ca[_0xe230('0x50')][_0xe230('0x54')],'speech':_0x2212ca[_0xe230('0x50')][_0xe230('0x55')]['speech'],'score':_0x2212ca['result'][_0xe230('0x56')],'statusCode':_0x2212ca[_0xe230('0x57')][_0xe230('0x58')],'endConversation':_0x2212ca[_0xe230('0x50')]['metadata'][_0xe230('0x59')]||![],'isFallbackIntent':_0x2212ca[_0xe230('0x50')][_0xe230('0x5a')][_0xe230('0x5b')]};});};exports['tildeASR']=function(_0x47bd6f,_0x2fe05b,_0x5d760d,_0x8d2512){return tilde[_0xe230('0x40')](_0x47bd6f,_0x2fe05b,_0x5d760d,_0x8d2512)[_0xe230('0x2a')](function(_0x1b711f){try{fs[_0xe230('0x1d')](_0x47bd6f);}catch(_0x460b8c){logger[_0xe230('0x1c')](_0x460b8c);}logger['info'](_0xe230('0x5c'),_0x1b711f[_0xe230('0x45')]);logger[_0xe230('0x19')](_0xe230('0x5d'),_0x1b711f[_0xe230('0x46')]);return _0x1b711f;});};exports[_0xe230('0x5e')]=function(_0x27f4f6,_0xade667,_0x1ecad6,_0x488b8c,_0x16411d,_0x38b816){var _0x531dc5=path[_0xe230('0x38')](__dirname,'tmp',rs[_0xe230('0x27')](0x4)+_0xe230('0x39'));var _0x11dc43;return aws[_0xe230('0x5f')](_0x27f4f6,_0xade667,_0x1ecad6,_0x488b8c,_0x16411d,_0x38b816,_0x531dc5)[_0xe230('0x2a')](function(){_0x11dc43=path[_0xe230('0x38')](__dirname,_0xe230('0x26'),rs[_0xe230('0x27')](0x4)+_0xe230('0x3d'));return convertFile(_0x531dc5,_0x11dc43);})[_0xe230('0x2a')](function(){try{fs[_0xe230('0x1d')](_0x531dc5);fs[_0xe230('0x2b')](_0x11dc43,_0xe230('0x3c'));}catch(_0x2964e1){logger[_0xe230('0x1c')](_0x2964e1);}return _0x11dc43['split']('.')[0x0];});};exports[_0xe230('0x60')]=function(_0x22d2ec,_0x49a05b,_0x54fe66,_0x514fab,_0xbb6c50,_0x61d134){return aws[_0xe230('0x61')](_0x22d2ec,_0x49a05b,_0x54fe66,_0x514fab,_0xbb6c50,_0x61d134)[_0xe230('0x2a')](function(_0x54d4b3){logger[_0xe230('0x19')](JSON[_0xe230('0x4f')](_0x54d4b3));return _0x54d4b3;});};exports[_0xe230('0x62')]=function(_0x314906,_0x417afd,_0x3459a0,_0x50f2a0){var _0x4f0a1b=util[_0xe230('0x63')](_0xe230('0x64'),ISPEECH_API,_0x314906,encodeURIComponent(_0x417afd),_0x3459a0,_0x50f2a0);var _0x25dfdd=path[_0xe230('0x38')](__dirname,_0xe230('0x26'),rs['generate'](0x4)+_0xe230('0x39'));var _0x4f745a;return downloadFile(_0x4f0a1b,_0x25dfdd)[_0xe230('0x2a')](function(){_0x4f745a=path[_0xe230('0x38')](__dirname,_0xe230('0x26'),rs['generate'](0x4)+'.wav');return convertFile(_0x25dfdd,_0x4f745a);})['then'](function(){try{fs[_0xe230('0x1d')](_0x25dfdd);fs[_0xe230('0x2b')](_0x4f745a,_0xe230('0x3c'));}catch(_0x5ae6eb){logger[_0xe230('0x1c')](_0x5ae6eb);}return _0x4f745a[_0xe230('0x2c')]('.')[0x0];});};exports[_0xe230('0x65')]=function(_0x4ff9f9,_0x494d7d,_0x41c55d,_0x2ffaa6){var _0x472612=util[_0xe230('0x63')](_0xe230('0x66'),ISPEECH_API,_0x494d7d,_0x41c55d,base64Encode(_0x4ff9f9),_0x2ffaa6?util['format'](_0xe230('0x67'),encodeURIComponent(_0x2ffaa6)):_0xe230('0x68'));return uploadFile(_0x472612)[_0xe230('0x2a')](function(_0x471530){return querystring[_0xe230('0x69')](_0x471530);});};exports[_0xe230('0x6a')]=function(_0x350b72,_0x23e2dc){return sestek[_0xe230('0x6b')](_0x350b72,_0x23e2dc)[_0xe230('0x2a')](function(_0x4de112){logger[_0xe230('0x19')](JSON['stringify'](_0x4de112));var _0x955280={'speech':_0x4de112[_0xe230('0x6c')],'action':_0x4de112[_0xe230('0x6d')]?_0x4de112[_0xe230('0x6d')][_0xe230('0x6e')]:undefined,'actiondata':_0x4de112[_0xe230('0x6d')]?_0x4de112[_0xe230('0x6d')]['CustomActionData']:undefined};if(_0x4de112[_0xe230('0x6d')]&&_0x4de112[_0xe230('0x6d')][_0xe230('0x6f')]){return base64Decode(_0x4de112[_0xe230('0x6d')][_0xe230('0x6f')][_0xe230('0x70')],path[_0xe230('0x38')](__dirname,_0xe230('0x26'),rs[_0xe230('0x27')](0x4)+'.wav'))[_0xe230('0x2a')](function(_0x279acd){_0x955280[_0xe230('0x71')]=_0x279acd;return _0x955280;});}return _0x955280;});};exports[_0xe230('0x72')]=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 423fa29..ca10aad 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 _0x238e=['./nda','exports'];(function(_0x54a5fe,_0x2f8352){var _0x49a747=function(_0x29d200){while(--_0x29d200){_0x54a5fe['push'](_0x54a5fe['shift']());}};_0x49a747(++_0x2f8352);}(_0x238e,0x16c));var _0xe238=function(_0x12f380,_0x59fdcf){_0x12f380=_0x12f380-0x0;var _0xf1f215=_0x238e[_0x12f380];return _0xf1f215;};var nda=require(_0xe238('0x0'));module[_0xe238('0x1')]={'nda':nda}; \ No newline at end of file +var _0x3caa=['./nda','exports'];(function(_0x7a93cc,_0x45615f){var _0x13a451=function(_0x497988){while(--_0x497988){_0x7a93cc['push'](_0x7a93cc['shift']());}};_0x13a451(++_0x45615f);}(_0x3caa,0x112));var _0xa3ca=function(_0x33609f,_0x571673){_0x33609f=_0x33609f-0x0;var _0x16d468=_0x3caa[_0x33609f];return _0x16d468;};var nda=require(_0xa3ca('0x0'));module[_0xa3ca('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 11d9414..f7107b7 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 _0x230d=['request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','dnid','text','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','custom_action_data','CustomActionData'];(function(_0x42118e,_0x4dfb3e){var _0x524646=function(_0x279674){while(--_0x279674){_0x42118e['push'](_0x42118e['shift']());}};_0x524646(++_0x4dfb3e);}(_0x230d,0x8c));var _0xd230=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x230d[_0x40a045];return _0x1a687c;};'use strict';var rp=require(_0xd230('0x0'));var url=require(_0xd230('0x1'));var logger=require(_0xd230('0x2'))(_0xd230('0x3'));module[_0xd230('0x4')]=function(_0x24c44d,_0x13863b){var _0x3c805b={'method':_0xd230('0x5'),'uri':url[_0xd230('0x6')](_0x13863b[_0xd230('0x7')],_0xd230('0x8')),'form':{'grant_type':_0xd230('0x9'),'username':_0x13863b[_0xd230('0xa')],'password':_0x13863b['password']},'json':!![]};return rp(_0x3c805b)[_0xd230('0xb')](function(_0x51382f){var _0x33d17f={'method':_0xd230('0x5'),'uri':url[_0xd230('0x6')](_0x13863b['ndassistant_url'],_0xd230('0xc')),'body':{'type':_0x13863b[_0xd230('0xd')]||'message','channelId':'Nda','conversation':{'id':_0x24c44d[_0xd230('0xe')]},'from':{'id':_0x24c44d[_0xd230('0xf')],'name':_0x24c44d[_0xd230('0x10')]},'recipient':{'id':_0x24c44d[_0xd230('0x11')],'name':_0x24c44d['extension']},'text':_0x13863b[_0xd230('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x51382f[_0xd230('0x13')]},'json':!![]};if(_0x13863b['project']){_0x33d17f[_0xd230('0x14')][_0xd230('0x15')][_0xd230('0x16')]=_0x13863b[_0xd230('0x17')];}if(_0x13863b[_0xd230('0x18')]=='1'){_0x33d17f[_0xd230('0x14')][_0xd230('0x15')][_0xd230('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x13863b['custom_action']){_0x33d17f[_0xd230('0x14')]['channelData']['CustomAction']=_0x13863b['custom_action'];if(_0x13863b[_0xd230('0x1a')]){_0x33d17f['body'][_0xd230('0x15')][_0xd230('0x1b')]=_0x13863b[_0xd230('0x1a')];}}logger['info'](JSON['stringify'](_0x33d17f));return rp(_0x33d17f);});}; \ No newline at end of file +var _0xd1d4=['text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','request-promise','url','../../../../../config/logger','POST','ndauth_url','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1d4,0x157));var _0x4d1d=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xd1d4[_0x68ee8b];return _0x5148f7;};'use strict';var rp=require(_0x4d1d('0x0'));var url=require(_0x4d1d('0x1'));var logger=require(_0x4d1d('0x2'))('agi');module['exports']=function(_0x2bd18f,_0x3b5e9a){var _0x49110d={'method':_0x4d1d('0x3'),'uri':url['resolve'](_0x3b5e9a[_0x4d1d('0x4')],'/token'),'form':{'grant_type':'password','username':_0x3b5e9a[_0x4d1d('0x5')],'password':_0x3b5e9a['password']},'json':!![]};return rp(_0x49110d)[_0x4d1d('0x6')](function(_0x55fa74){var _0x3b9853={'method':_0x4d1d('0x3'),'uri':url[_0x4d1d('0x7')](_0x3b5e9a[_0x4d1d('0x8')],_0x4d1d('0x9')),'body':{'type':_0x3b5e9a['ndaactivity_type']||_0x4d1d('0xa'),'channelId':_0x4d1d('0xb'),'conversation':{'id':_0x2bd18f[_0x4d1d('0xc')]},'from':{'id':_0x2bd18f[_0x4d1d('0xd')],'name':_0x2bd18f[_0x4d1d('0xe')]},'recipient':{'id':_0x2bd18f[_0x4d1d('0xf')],'name':_0x2bd18f[_0x4d1d('0x10')]},'text':_0x3b5e9a[_0x4d1d('0x11')],'channelData':{}},'headers':{'Authorization':_0x4d1d('0x12')+_0x55fa74[_0x4d1d('0x13')]},'json':!![]};if(_0x3b5e9a[_0x4d1d('0x14')]){_0x3b9853[_0x4d1d('0x15')][_0x4d1d('0x16')][_0x4d1d('0x17')]=_0x3b5e9a[_0x4d1d('0x14')];}if(_0x3b5e9a['ndagenerate_audio']=='1'){_0x3b9853[_0x4d1d('0x15')][_0x4d1d('0x16')][_0x4d1d('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4d1d('0x19')};}if(_0x3b5e9a['custom_action']){_0x3b9853[_0x4d1d('0x15')][_0x4d1d('0x16')][_0x4d1d('0x1a')]=_0x3b5e9a[_0x4d1d('0x1b')];if(_0x3b5e9a[_0x4d1d('0x1c')]){_0x3b9853[_0x4d1d('0x15')][_0x4d1d('0x16')][_0x4d1d('0x1d')]=_0x3b5e9a[_0x4d1d('0x1c')];}}logger['info'](JSON['stringify'](_0x3b9853));return rp(_0x3b9853);});}; \ 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 4e32d06..e0aad3e 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 _0x5e8f=['./lib/api'];(function(_0x7b8a87,_0x2f2523){var _0x2131a1=function(_0x856847){while(--_0x856847){_0x7b8a87['push'](_0x7b8a87['shift']());}};_0x2131a1(++_0x2f2523);}(_0x5e8f,0x140));var _0xf5e8=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x5e8f[_0x28e2cd];return _0x11fd46;};'use strict';var asr=require(_0xf5e8('0x0'));module['exports']=function(_0x25f170,_0x5f102a,_0x52cc83,_0x11bb43){return asr(_0x25f170,_0x5f102a,_0x52cc83,_0x11bb43);}; \ No newline at end of file +var _0x6cd7=['exports','./lib/api'];(function(_0x4d83fc,_0x3b415d){var _0x584078=function(_0x54c82f){while(--_0x54c82f){_0x4d83fc['push'](_0x4d83fc['shift']());}};_0x584078(++_0x3b415d);}(_0x6cd7,0xdb));var _0x76cd=function(_0x273f92,_0x5e6ea2){_0x273f92=_0x273f92-0x0;var _0x38b53c=_0x6cd7[_0x273f92];return _0x38b53c;};'use strict';var asr=require(_0x76cd('0x0'));module[_0x76cd('0x1')]=function(_0x303242,_0x47d113,_0x2102f1,_0x47a396){return asr(_0x303242,_0x47d113,_0x2102f1,_0x47a396);}; \ 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 7095b66..541d2e7 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 _0x3d6f=['createHash','sha1','digest','hex','stringify','data','send','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isNil','message','lodash','moment','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'];(function(_0x36acb3,_0x204e94){var _0x13976c=function(_0x4371dd){while(--_0x4371dd){_0x36acb3['push'](_0x36acb3['shift']());}};_0x13976c(++_0x204e94);}(_0x3d6f,0x155));var _0xf3d6=function(_0x36d8d9,_0x17b58a){_0x36d8d9=_0x36d8d9-0x0;var _0x1ac3a2=_0x3d6f[_0x36d8d9];return _0x1ac3a2;};'use strict';var BPromise=require('bluebird');var _=require(_0xf3d6('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf3d6('0x1'));var crypto=require(_0xf3d6('0x2'));var logger=require(_0xf3d6('0x3'))('agi');module[_0xf3d6('0x4')]=function(_0x19347b,_0xad2519,_0xab4801,_0x233052){return new BPromise(function(_0x5edb27,_0x2eda4a){logger[_0xf3d6('0x5')](_0xf3d6('0x6'),_0x233052||_0xf3d6('0x7'));var _0x47d839=new WebSocket(_0x233052||_0xf3d6('0x7'),{'perMessageDeflate':![]});var _0x2dc9bd='';var _0x46e0a0='0';var _0x4103d8='1';var _0x34f7d1=_0xf3d6('0x8');function _0x107413(_0x3219d3){var _0x438c63=crypto[_0xf3d6('0x9')](_0xf3d6('0xa'));_0x438c63['update'](_0x3219d3);return _0x438c63[_0xf3d6('0xb')](_0xf3d6('0xc'));}function _0x20d41c(){try{logger[_0xf3d6('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x14fc84=moment()['unix']();var _0x35eb59=_0x107413(_0x14fc84+_0xad2519+_0xab4801);_0x47d839['send'](JSON[_0xf3d6('0xd')]({'appID':_0xad2519,'timestamp':_0x14fc84,'appKey':_0x35eb59}));var _0x18ba27=fs['createReadStream'](_0x19347b);_0x18ba27['on'](_0xf3d6('0xe'),function(_0x10208d){_0x47d839[_0xf3d6('0xf')](_0x10208d);});_0x18ba27['on']('close',function(){_0x47d839['send'](_0xf3d6('0x10'));});}catch(_0x190b88){logger[_0xf3d6('0x11')](_0xf3d6('0x12'),JSON['stringify'](_0x190b88));_0x47d839[_0xf3d6('0x13')]();}}function _0x2b6e68(_0x417a49){try{if(_0x417a49){var _0x127f17=JSON[_0xf3d6('0x14')](_0x417a49);switch(_0x127f17[_0xf3d6('0x15')]){case 0x0:if(_0x127f17['result']){if(_0x127f17[_0xf3d6('0x16')][_0xf3d6('0x17')]){logger[_0xf3d6('0x5')](_0xf3d6('0x18'),JSON['stringify'](_0x127f17[_0xf3d6('0x16')][_0xf3d6('0x19')]));_0x2dc9bd=_0x127f17[_0xf3d6('0x16')][_0xf3d6('0x19')][0x0][_0xf3d6('0x1a')];_0x46e0a0=_0x127f17[_0xf3d6('0x16')][_0xf3d6('0x19')][0x0][_0xf3d6('0x1b')];_0x4103d8='0';_0x34f7d1='Success.';_0x47d839[_0xf3d6('0x13')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4103d8='1';_0x34f7d1='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xf3d6('0x5')](_0xf3d6('0x1c'));_0x4103d8='2';_0x34f7d1=_0xf3d6('0x1c');break;case 0x9:logger['info'](_0xf3d6('0x1d'));_0x4103d8='9';_0x34f7d1=_0xf3d6('0x1d');break;case 0xa:logger['info']('Authentication\x20failed.');_0x4103d8='10';_0x34f7d1=_0xf3d6('0x1e');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4103d8='11';_0x34f7d1=_0xf3d6('0x1f');}}}catch(_0xe803f3){logger['error'](_0xf3d6('0x20'),JSON[_0xf3d6('0xd')](_0xe803f3));_0x47d839[_0xf3d6('0x13')]();}}function _0x3985fb(){logger[_0xf3d6('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x5edb27({'transcript':_0x2dc9bd,'confidence':_0x46e0a0,'status':_0x4103d8,'status_message':_0x34f7d1});}function _0x2814e9(_0x360fd2){logger[_0xf3d6('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xf3d6('0x21')](_0x360fd2)){logger[_0xf3d6('0x11')](_['isObject'](_0x360fd2)?JSON[_0xf3d6('0xd')](_0x360fd2):_0x360fd2);}}_0x47d839['on']('open',_0x20d41c);_0x47d839['on'](_0xf3d6('0x22'),_0x2b6e68);_0x47d839['on']('close',_0x3985fb);_0x47d839['on'](_0xf3d6('0x11'),_0x2814e9);});}; \ No newline at end of file +var _0x0370=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','createReadStream','data','send','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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','stringify','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x5b2dd5,_0x12d45e){var _0xf79a8b=function(_0x2e13b7){while(--_0x2e13b7){_0x5b2dd5['push'](_0x5b2dd5['shift']());}};_0xf79a8b(++_0x12d45e);}(_0x0370,0x147));var _0x0037=function(_0x120c25,_0x42d8c2){_0x120c25=_0x120c25-0x0;var _0x162120=_0x0370[_0x120c25];return _0x162120;};'use strict';var BPromise=require('bluebird');var _=require(_0x0037('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0037('0x1'));var crypto=require(_0x0037('0x2'));var logger=require(_0x0037('0x3'))(_0x0037('0x4'));module[_0x0037('0x5')]=function(_0x296f73,_0x3c7ce9,_0x3702b5,_0x1df353){return new BPromise(function(_0x4f8552,_0x12e94d){logger[_0x0037('0x6')](_0x0037('0x7'),_0x1df353||_0x0037('0x8'));var _0x22738c=new WebSocket(_0x1df353||_0x0037('0x8'),{'perMessageDeflate':![]});var _0x1f8429='';var _0x2a898e='0';var _0x1d2a5f='1';var _0x30af09=_0x0037('0x9');function _0x325f0e(_0x89de8f){var _0x11685d=crypto[_0x0037('0xa')]('sha1');_0x11685d[_0x0037('0xb')](_0x89de8f);return _0x11685d[_0x0037('0xc')](_0x0037('0xd'));}function _0x5d08a2(){try{logger['info'](_0x0037('0xe'));var _0x1d0401=moment()['unix']();var _0x379314=_0x325f0e(_0x1d0401+_0x3c7ce9+_0x3702b5);_0x22738c['send'](JSON['stringify']({'appID':_0x3c7ce9,'timestamp':_0x1d0401,'appKey':_0x379314}));var _0x2c2fae=fs[_0x0037('0xf')](_0x296f73);_0x2c2fae['on'](_0x0037('0x10'),function(_0x43421b){_0x22738c[_0x0037('0x11')](_0x43421b);});_0x2c2fae['on'](_0x0037('0x12'),function(){_0x22738c[_0x0037('0x11')](_0x0037('0x13'));});}catch(_0x1e4e6a){logger['error'](_0x0037('0x14'),JSON['stringify'](_0x1e4e6a));_0x22738c[_0x0037('0x15')]();}}function _0x3cb269(_0x5e203a){try{if(_0x5e203a){var _0x1f076d=JSON[_0x0037('0x16')](_0x5e203a);switch(_0x1f076d[_0x0037('0x17')]){case 0x0:if(_0x1f076d['result']){if(_0x1f076d[_0x0037('0x18')][_0x0037('0x19')]){logger['info'](_0x0037('0x1a'),JSON['stringify'](_0x1f076d[_0x0037('0x18')][_0x0037('0x1b')]));_0x1f8429=_0x1f076d[_0x0037('0x18')]['hypotheses'][0x0][_0x0037('0x1c')];_0x2a898e=_0x1f076d[_0x0037('0x18')][_0x0037('0x1b')][0x0]['likelihood'];_0x1d2a5f='0';_0x30af09=_0x0037('0x1d');_0x22738c[_0x0037('0x15')]();}}break;case 0x1:logger[_0x0037('0x6')](_0x0037('0x9'));_0x1d2a5f='1';_0x30af09=_0x0037('0x9');break;case 0x2:logger[_0x0037('0x6')](_0x0037('0x1e'));_0x1d2a5f='2';_0x30af09=_0x0037('0x1e');break;case 0x9:logger['info'](_0x0037('0x1f'));_0x1d2a5f='9';_0x30af09=_0x0037('0x1f');break;case 0xa:logger[_0x0037('0x6')](_0x0037('0x20'));_0x1d2a5f='10';_0x30af09=_0x0037('0x20');break;case 0xb:logger[_0x0037('0x6')](_0x0037('0x21'));_0x1d2a5f='11';_0x30af09=_0x0037('0x21');}}}catch(_0x3556f0){logger[_0x0037('0x22')](_0x0037('0x23'),JSON[_0x0037('0x24')](_0x3556f0));_0x22738c['terminate']();}}function _0x11ddef(){logger['info'](_0x0037('0x25'));_0x4f8552({'transcript':_0x1f8429,'confidence':_0x2a898e,'status':_0x1d2a5f,'status_message':_0x30af09});}function _0x41a4db(_0xa7383a){logger['error'](_0x0037('0x26'));if(!_[_0x0037('0x27')](_0xa7383a)){logger[_0x0037('0x22')](_[_0x0037('0x28')](_0xa7383a)?JSON[_0x0037('0x24')](_0xa7383a):_0xa7383a);}}_0x22738c['on']('open',_0x5d08a2);_0x22738c['on'](_0x0037('0x29'),_0x3cb269);_0x22738c['on'](_0x0037('0x12'),_0x11ddef);_0x22738c['on'](_0x0037('0x22'),_0x41a4db);});}; \ 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 3b835f1..9807f30 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 _0x4c48=['exports','./asr'];(function(_0x5a82a5,_0x5a1dee){var _0x427d33=function(_0x7210aa){while(--_0x7210aa){_0x5a82a5['push'](_0x5a82a5['shift']());}};_0x427d33(++_0x5a1dee);}(_0x4c48,0x129));var _0x84c4=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0x4c48[_0x5aef17];return _0x43f9d0;};var asr=require(_0x84c4('0x0'));module[_0x84c4('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd00d=['./asr'];(function(_0xabbd65,_0x546d99){var _0x1d005a=function(_0x11694e){while(--_0x11694e){_0xabbd65['push'](_0xabbd65['shift']());}};_0x1d005a(++_0x546d99);}(_0xd00d,0xec));var _0xdd00=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xd00d[_0x597484];return _0x218e64;};var asr=require(_0xdd00('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index d4b170f..692a8ff 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 _0xbe02=['E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbe02,0x146));var _0x2be0=function(_0x11065f,_0x5aa1fe){_0x11065f=_0x11065f-0x0;var _0x2503ad=_0xbe02[_0x11065f];return _0x2503ad;};'use strict';var util=require(_0x2be0('0x0'));var net=require(_0x2be0('0x1'));var EventEmitter=require(_0x2be0('0x2'))[_0x2be0('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x2be0('0x4'));var AGIServer=function(_0x2b34c2,_0x9eb980,_0x364c99){var _0x22ed11=this,_0x2b34c2=_0x2b34c2||0x11dd,_0x9eb980=_0x9eb980||'127.0.0.1',_0x474a35=null,_0x39a2ca=0x0;EventEmitter['call'](_0x22ed11);function _0x176f12(){if(!_0x2b34c2){_0x22ed11[_0x2be0('0x5')](_0x2be0('0x6'),new AGIError(_0x2be0('0x7')));return![];}_0x474a35=net[_0x2be0('0x8')]();_0x474a35[_0x2be0('0x9')](_0x2b34c2,_0x9eb980);_0x474a35['on']('listening',function(){_0x22ed11['emit']('listening');});_0x474a35['on']('connection',function(_0x58795e){_0x474a35['getConnections'](function(_0x367444,_0x2a4a44){if(_0x367444){_0x22ed11['emit'](_0x2be0('0x6'),new AGIError(_0x2be0('0xa'),_0x367444));}else if(_0x364c99&&_0x364c99<0x0){_0x22ed11[_0x2be0('0x5')](_0x2be0('0x6'),new AGIError(_0x2be0('0xb')));_0x58795e[_0x2be0('0xc')]();}else if(_0x364c99&&_0x364c99>0x0&&_0x364c99<_0x2a4a44){_0x39a2ca+=0x1;_0x22ed11[_0x2be0('0x5')](_0x2be0('0x6'),new AGIError(_0x2be0('0xd'),_0x39a2ca));_0x58795e[_0x2be0('0xc')]();}else{var _0x54e9f2=new AGIChannel(_0x58795e);_0x54e9f2['on'](_0x2be0('0xe'),function(){_0x22ed11[_0x2be0('0x5')]('connection',_0x54e9f2);});}});});_0x474a35['on'](_0x2be0('0x6'),function(_0x1e0c27){_0x22ed11['emit'](_0x2be0('0x6'),new AGIError(_0x2be0('0xa'),_0x1e0c27[_0x2be0('0xf')]));});_0x474a35['on'](_0x2be0('0x10'),function(){_0x22ed11[_0x2be0('0x5')](_0x2be0('0x10'),new AGIError(_0x2be0('0x11')));});}process[_0x2be0('0x12')](function(){_0x176f12();});};util[_0x2be0('0x13')](AGIServer,EventEmitter);module[_0x2be0('0x14')]=function(_0x1aaeec,_0x1d4b00,_0x361f25){return new AGIServer(_0x1aaeec,_0x1d4b00,_0x361f25);}; \ No newline at end of file +var _0xcc73=['127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','./channel'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcc73[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require('util');var net=require(_0x3cc7('0x0'));var EventEmitter=require(_0x3cc7('0x1'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x3cc7('0x2'));var AGIServer=function(_0x571514,_0x445dce,_0x5054fb){var _0x5de4be=this,_0x571514=_0x571514||0x11dd,_0x445dce=_0x445dce||_0x3cc7('0x3'),_0x1ccad1=null,_0x10d0f9=0x0;EventEmitter['call'](_0x5de4be);function _0x416c48(){if(!_0x571514){_0x5de4be[_0x3cc7('0x4')](_0x3cc7('0x5'),new AGIError(_0x3cc7('0x6')));return![];}_0x1ccad1=net['createServer']();_0x1ccad1[_0x3cc7('0x7')](_0x571514,_0x445dce);_0x1ccad1['on'](_0x3cc7('0x8'),function(){_0x5de4be[_0x3cc7('0x4')](_0x3cc7('0x8'));});_0x1ccad1['on'](_0x3cc7('0x9'),function(_0xaa9aa1){_0x1ccad1[_0x3cc7('0xa')](function(_0x57d9de,_0x5390c7){if(_0x57d9de){_0x5de4be[_0x3cc7('0x4')]('error',new AGIError(_0x3cc7('0xb'),_0x57d9de));}else if(_0x5054fb&&_0x5054fb<0x0){_0x5de4be[_0x3cc7('0x4')](_0x3cc7('0x5'),new AGIError(_0x3cc7('0xc')));_0xaa9aa1[_0x3cc7('0xd')]();}else if(_0x5054fb&&_0x5054fb>0x0&&_0x5054fb<_0x5390c7){_0x10d0f9+=0x1;_0x5de4be[_0x3cc7('0x4')](_0x3cc7('0x5'),new AGIError(_0x3cc7('0xe'),_0x10d0f9));_0xaa9aa1[_0x3cc7('0xd')]();}else{var _0xab7f06=new AGIChannel(_0xaa9aa1);_0xab7f06['on'](_0x3cc7('0xf'),function(){_0x5de4be[_0x3cc7('0x4')](_0x3cc7('0x9'),_0xab7f06);});}});});_0x1ccad1['on'](_0x3cc7('0x5'),function(_0x1e7568){_0x5de4be[_0x3cc7('0x4')](_0x3cc7('0x5'),new AGIError(_0x3cc7('0xb'),_0x1e7568[_0x3cc7('0x10')]));});_0x1ccad1['on'](_0x3cc7('0x11'),function(){_0x5de4be[_0x3cc7('0x4')](_0x3cc7('0x11'),new AGIError(_0x3cc7('0x12')));});}process[_0x3cc7('0x13')](function(){_0x416c48();});};util[_0x3cc7('0x14')](AGIServer,EventEmitter);module[_0x3cc7('0x15')]=function(_0x1545a0,_0x2483c9,_0x382727){return new AGIServer(_0x1545a0,_0x2483c9,_0x382727);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 7970b33..071908c 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 _0x56bd=['query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','dialogflow','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','toUpperCase','audiofile','unlink','.wav','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getSound','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','awsPolly','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','bot','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','%s/recordings/%s','beep','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','wav','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','menu','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','sayphonetic','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','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','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','exports','util','lodash','shelljs','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isEmpty','isNil','random','lastName','phone','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','has','dialTimezone','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','RES1','dialtimezone','timezones','utcOffset','minutestoadd','scheduledat\x20before','scheduledat','minutes','insertContact','add','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','shellCommand','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','computedVariables','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','nextbracket','extra','toString','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured'];(function(_0x10595c,_0x115e16){var _0x29194d=function(_0x2b02f1){while(--_0x2b02f1){_0x10595c['push'](_0x10595c['shift']());}};_0x29194d(++_0x115e16);}(_0x56bd,0xe9));var _0xd56b=function(_0x34e330,_0x43c19e){_0x34e330=_0x34e330-0x0;var _0x2df2b7=_0x56bd[_0x34e330];return _0x2df2b7;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xd56b('0x0'));var _=require(_0xd56b('0x1'));var sh=require(_0xd56b('0x2'));var odbc=require('odbc')();var rs=require(_0xd56b('0x3'));var moment=require(_0xd56b('0x4'));var Mustache=require(_0xd56b('0x5'));var rp=require(_0xd56b('0x6'));var logger=require('../../config/logger')(_0xd56b('0x7'));var config=require(_0xd56b('0x8'));var shared=require(_0xd56b('0x9'));var scripts=require(_0xd56b('0xa'));var FILES_PATH=_0xd56b('0xb');var recursiveMapAttributes=[_0xd56b('0xc'),_0xd56b('0xd')];var verticesWithRetry=['menu',_0xd56b('0xe'),_0xd56b('0xf')];var AGIVertices=function(_0x6fde5d,_0x13447e,_0x53b856){this['channel']=_0x6fde5d;this[_0xd56b('0x10')]=_0x13447e;this[_0xd56b('0x11')]=_0x53b856;};AGIVertices['prototype'][_0xd56b('0x12')]=function(_0x1e6fcd,_0x3bfaf9){this[_0xd56b('0x10')][_0xd56b('0x13')](_0x1e6fcd)[_0xd56b('0x14')](function(_0x3fb7dd){_0x3bfaf9(null,_0x3fb7dd?_0x3fb7dd[_0xd56b('0x15')]:![]);})[_0xd56b('0x16')](function(_0x2bfff6){_0x3bfaf9(_0x2bfff6);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x18')]=function(_0x286e2b,_0x104dab){this[_0xd56b('0x10')]['getVoiceQueueById'](_0x286e2b)[_0xd56b('0x14')](function(_0x5a2886){_0x104dab(null,_0x5a2886?_0x5a2886[_0xd56b('0x15')]:![]);})[_0xd56b('0x16')](function(_0x3f8775){_0x104dab(_0x3f8775);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x19')]=function(_0x472e7e,_0x667877){this[_0xd56b('0x10')][_0xd56b('0x1a')](_0x472e7e)[_0xd56b('0x14')](function(_0x147e48){_0x667877(null,_0x147e48?_0x147e48['name']:![]);})['catch'](function(_0x5ccee5){_0x667877(_0x5ccee5);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x1b')]=function(_0xf32afd,_0x1ac90f){this[_0xd56b('0x10')][_0xd56b('0x1c')](_0xf32afd)[_0xd56b('0x14')](function(_0x547a7a){_0x1ac90f(null,_0x547a7a?_0x547a7a[_0xd56b('0x1d')]:![]);})[_0xd56b('0x16')](function(_0x36f903){_0x1ac90f(_0x36f903);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x1e')]=function(_0x32160b,_0x5498b0){this['rpc'][_0xd56b('0x1f')](_0x32160b)[_0xd56b('0x14')](function(_0x5bdf89){_0x5498b0(null,_0x5bdf89?_0x5bdf89[_0xd56b('0x15')]:![]);})['catch'](function(_0xdaf42a){_0x5498b0(_0xdaf42a);});};AGIVertices['prototype'][_0xd56b('0x20')]=function(_0x30e936,_0x1fa34b){this['rpc'][_0xd56b('0x21')](_0x30e936)[_0xd56b('0x14')](function(_0x1e3d6d){_0x1fa34b(null,_0x1e3d6d?_0x1e3d6d[_0xd56b('0x15')]:![]);})[_0xd56b('0x16')](function(_0x446c8a){_0x1fa34b(_0x446c8a);});};AGIVertices[_0xd56b('0x17')]['getSound']=function(_0x56cbcb,_0xaf08fb){var _0x4393a9=this;this[_0xd56b('0x10')][_0xd56b('0x22')](_0x56cbcb)[_0xd56b('0x14')](function(_0x3c76d6){_0xaf08fb(null,_0x3c76d6?_0x4393a9[_0xd56b('0x23')](_0x3c76d6[_0xd56b('0x24')]):![]);})[_0xd56b('0x16')](function(_0x65fb97){_0xaf08fb(_0x65fb97);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x25')]=function(_0x5f3d6c,_0x59674a){this[_0xd56b('0x10')]['getMailAccountById'](_0x5f3d6c)['then'](function(_0x3d18b6){_0x59674a(null,_0x3d18b6?_0x3d18b6:![]);})[_0xd56b('0x16')](function(_0x193c7f){_0x59674a(_0x193c7f);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x26')]=function(_0x3d9d62,_0x13900e,_0xbae998){this['mailRpc'][_0xd56b('0x26')](_0x3d9d62,_0x13900e)['then'](function(){_0xbae998(null);})[_0xd56b('0x16')](function(_0x333102){_0xbae998(_0x333102);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x27')]=function(_0xdea9ba,_0x4d8815){this[_0xd56b('0x10')][_0xd56b('0x28')](_0xdea9ba)['then'](function(_0xbc387e){if(_0xbc387e){if(_0xbc387e[_0xd56b('0x29')]){_0x4d8815(null,[_0xbc387e['interval']]);}else{_0x4d8815(null,_['map'](_0xbc387e[_0xd56b('0x2a')],'interval'));}}else{_0x4d8815(null,![]);}})[_0xd56b('0x16')](function(_0x2ca2bf){_0x4d8815(_0x2ca2bf);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x23')]=function(_0x2e3e39){return util[_0xd56b('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x2e3e39);};AGIVertices[_0xd56b('0x17')][_0xd56b('0x2c')]=function(_0x4d0fa5,_0x150d00,_0x8d3d6b){odbc[_0xd56b('0x2d')](_0x4d0fa5,function(_0x20891c){if(_0x20891c){logger[_0xd56b('0x2e')](_0xd56b('0x2f'),_0x20891c);_0x8d3d6b(_0x20891c);}else{logger[_0xd56b('0x30')]('ODBC\x20connection\x20successfully');odbc[_0xd56b('0x31')](_0x150d00,function(_0x3788bb,_0x332e38){if(_0x3788bb){logger[_0xd56b('0x30')]('Error\x20executing\x20query\x20%s',_0x150d00);_0x8d3d6b(_0x3788bb);}else{logger[_0xd56b('0x30')](_0xd56b('0x32'),_0x150d00);odbc[_0xd56b('0x33')](function(_0x8d9203){if(_0x8d9203){logger[_0xd56b('0x2e')](_0xd56b('0x34'),_0x8d9203);}_0x8d3d6b(null,_0x332e38);});}});}});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x35')]=function(_0x436c9e,_0x373fab){this[_0xd56b('0x10')][_0xd56b('0x36')](_0x436c9e)[_0xd56b('0x14')](function(_0x4581e6){_0x373fab(null,_0x4581e6?_0x4581e6:![]);})[_0xd56b('0x16')](function(_0x11a911){_0x373fab(_0x11a911);});};AGIVertices['prototype']['createSmsMessage']=function(_0xa718ee,_0x230bbc){this[_0xd56b('0x10')]['createSmsMessage'](_0xa718ee)[_0xd56b('0x14')](function(_0x52262e){_0x230bbc(null,_0x52262e);})[_0xd56b('0x16')](function(_0x62ba88){_0x230bbc(_0x62ba88);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x37')]=function(_0x2613e2,_0x5b0edf,_0x110f8f){this['rpc'][_0xd56b('0x37')]({'uniqueid':this[_0xd56b('0x38')][_0xd56b('0x39')],'node':_0x2613e2[_0xd56b('0x3a')],'application':_0x2613e2[_0xd56b('0x3b')],'data':_0x5b0edf||null,'project_name':this['channel'][_0xd56b('0x3c')],'callerid':this[_0xd56b('0x38')]['callerid']})[_0xd56b('0x14')](function(_0x44b1ad){if(_0x110f8f){_0x110f8f(null,_0x44b1ad);}})['catch'](function(_0x25d146){if(_0x110f8f){_0x110f8f(_0x25d146);}});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x3d')]=function(_0x292aea,_0x446790,_0x450e8e,_0x44ab0e){this[_0xd56b('0x10')][_0xd56b('0x3d')]({'uniqueid':this['channel'][_0xd56b('0x39')],'callerid':this[_0xd56b('0x38')][_0xd56b('0x3e')],'calleridname':this['channel'][_0xd56b('0x3f')],'context':this[_0xd56b('0x38')]['context'],'extension':this[_0xd56b('0x38')][_0xd56b('0x40')],'priority':this[_0xd56b('0x38')][_0xd56b('0x41')],'accountcode':this[_0xd56b('0x38')][_0xd56b('0x42')],'dnid':this['channel'][_0xd56b('0x43')],'projectName':this[_0xd56b('0x38')][_0xd56b('0x3c')],'saveName':_0x446790,'filename':_0x292aea['file']||_0x446790,'savePath':_0x450e8e})[_0xd56b('0x14')](function(_0xdd906b){_0x44ab0e(null,_0xdd906b);})[_0xd56b('0x16')](function(_0x40a69b){_0x44ab0e(_0x40a69b);});};AGIVertices[_0xd56b('0x17')]['createSquareMessage']=function(_0x1d4ebd,_0x7675c3,_0xd12bf0){this[_0xd56b('0x10')][_0xd56b('0x44')]({'uniqueid':this[_0xd56b('0x38')]['uniqueid'],'body':_0x1d4ebd,'direction':_0x7675c3})[_0xd56b('0x14')](function(_0x3dd378){if(_0xd12bf0){_0xd12bf0(null,_0x3dd378);}})[_0xd56b('0x16')](function(_0x4b31e6){if(_0xd12bf0){_0xd12bf0(_0x4b31e6);}});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x45')]=function(_0x1fda52,_0xde6424){console[_0xd56b('0x46')](_0xd56b('0x47'),_0x1fda52);console[_0xd56b('0x46')](_0xd56b('0x48'),_0xde6424);var _0xa58859=this;var _0x105aef=0x0;var _0x1900a9={'firstName':_[_0xd56b('0x49')](_0x1fda52['name'])||_[_0xd56b('0x4a')](_0x1fda52[_0xd56b('0x15')])?'callback_'+Math[_0xd56b('0x4b')]():_0x1fda52['name'],'lastName':_[_0xd56b('0x49')](_0x1fda52[_0xd56b('0x4c')])||_['isNil'](_0x1fda52[_0xd56b('0x4c')])?null:_0x1fda52['lastName'],'phone':_0x1fda52[_0xd56b('0x4d')],'ListId':_0x1fda52['list_id'],'scheduledat':_0x1fda52['scheduledAt'],'callbackUniqueid':this[_0xd56b('0x38')][_0xd56b('0x39')],'tags':'callback','description':_0xd56b('0x4e')+_0x1fda52[_0xd56b('0x4f')]['toString'](),'priority':_0x1fda52[_0xd56b('0x50')]};if(_[_0xd56b('0x51')](_0x1fda52,'dialTimezone')){if(!_[_0xd56b('0x4a')](_0x1fda52[_0xd56b('0x52')])){var _0x44a165=_0x1fda52[_0xd56b('0x52')];console['log'](_0xd56b('0x53'),_0x44a165);if(_0x1fda52['dialTimezone']==_0xd56b('0x54')){this[_0xd56b('0x10')][_0xd56b('0x55')]({'phone':_0x1fda52['phone']})[_0xd56b('0x14')](function(_0x286ba9){console['log'](_0xd56b('0x56'),_0x286ba9);var _0x1e5250=_0x286ba9['dialTimezone'];console[_0xd56b('0x46')](_0xd56b('0x57'),_0x1e5250);if(!_[_0xd56b('0x4a')](_0x1e5250)){var _0x21c582=shared[_0xd56b('0x58')][_0x1e5250];console[_0xd56b('0x46')]('tz',_0x21c582);if(!_['isNil'](_0x21c582)){var _0x5a44b9=-0x1*_0x21c582[_0xd56b('0x59')];console[_0xd56b('0x46')](_0xd56b('0x5a'),_0x5a44b9);console[_0xd56b('0x46')](_0xd56b('0x5b'),_0x1900a9[_0xd56b('0x5c')]);_0x1900a9[_0xd56b('0x5c')]=moment(_0x1fda52[_0xd56b('0x5c')])['add'](_0x5a44b9,_0xd56b('0x5d'));console[_0xd56b('0x46')]('scheduledat\x20after',_0x1900a9[_0xd56b('0x5c')]);_0xa58859[_0xd56b('0x5e')](_0x1900a9,_0x1fda52,_0xde6424);}else{_0xa58859[_0xd56b('0x5e')](_0x1900a9,_0x1fda52,_0xde6424);}}else{_0xa58859[_0xd56b('0x5e')](_0x1900a9,_0x1fda52,_0xde6424);}});}else{var _0x105aef=shared['timezones'][_0x44a165];if(!_[_0xd56b('0x4a')](_0x105aef)){var _0x298f16=-0x1*_0x105aef[_0xd56b('0x59')];_0x1900a9['scheduledat']=moment(_0x1fda52['scheduledat'])[_0xd56b('0x5f')](_0x298f16,'minutes');_0xa58859[_0xd56b('0x5e')](_0x1900a9,_0x1fda52,_0xde6424);}else{_0xa58859[_0xd56b('0x5e')](_0x1900a9,_0x1fda52,_0xde6424);}}}else{_0xa58859['insertContact'](_0x1900a9,_0x1fda52,_0xde6424);}}else{_0xa58859[_0xd56b('0x5e')](_0x1900a9,_0x1fda52,_0xde6424);}};AGIVertices['prototype']['insertContact']=function(_0xff2b6e,_0x1d73e4,_0x30fef3){this[_0xd56b('0x10')]['createCmContact'](_0xff2b6e)[_0xd56b('0x14')](function(_0x247a68){_0x30fef3(null,_0x247a68);})[_0xd56b('0x16')](function(_0x500e42){_0x30fef3(_0x500e42);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x60')]=function(_0x10c4d9,_0xbb4694){this['rpc'][_0xd56b('0x61')](_0x10c4d9)['then'](function(_0x1103e6){_0xbb4694(null,_0x1103e6?_0x1103e6[_0xd56b('0x15')]:![]);})[_0xd56b('0x16')](function(_0x4a9b55){_0xbb4694(_0x4a9b55);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x62')]=function(_0x47b4d7,_0x541950,_0x133877){var _0x3bd5fe={'role':_0xd56b('0x63')};_0x3bd5fe[_0x47b4d7]=this[_0xd56b('0x38')][_0xd56b('0x3e')];this['rpc']['agentPause'](_0x3bd5fe,_0x541950,this[_0xd56b('0x38')][_0xd56b('0x39')])[_0xd56b('0x14')](function(_0x36d1b8){_0x133877(null,_['isNil'](_0x36d1b8)?![]:!![]);})['catch'](function(_0x350cf5){logger[_0xd56b('0x2e')](_0x350cf5);_0x133877(null,![]);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x64')]=function(_0xb27028,_0x47a6ee){var _0x2c9d90={'role':_0xd56b('0x63')};_0x2c9d90[_0xb27028]=this[_0xd56b('0x38')]['callerid'];this[_0xd56b('0x10')]['agentUnpause'](_0x2c9d90)['then'](function(_0x458f2e){_0x47a6ee(null,_[_0xd56b('0x4a')](_0x458f2e)?![]:!![]);})[_0xd56b('0x16')](function(_0x32b18f){logger[_0xd56b('0x2e')](_0x32b18f);_0x47a6ee(null,![]);});};AGIVertices[_0xd56b('0x17')]['agentLogout']=function(_0x23b57c,_0x5b2933){var _0x6282dc={'role':'agent'};_0x6282dc[_0x23b57c]=this['channel'][_0xd56b('0x3e')];this[_0xd56b('0x10')][_0xd56b('0x65')](_0x6282dc)[_0xd56b('0x14')](function(_0x3eb7c6){_0x5b2933(null,_['isNil'](_0x3eb7c6)?![]:!![]);})[_0xd56b('0x16')](function(_0x2f755e){logger[_0xd56b('0x2e')](_0x2f755e);_0x5b2933(null,![]);});};AGIVertices['prototype'][_0xd56b('0x66')]=function(_0x50209d,_0x34e269){var _0x1c1765={'role':_0xd56b('0x63')};_0x1c1765[_0x50209d]=this[_0xd56b('0x38')][_0xd56b('0x3e')];var _0x2b4823=_0x50209d!='internal'?util[_0xd56b('0x2b')](_0xd56b('0x67'),'LOCAL',this[_0xd56b('0x38')][_0xd56b('0x3e')]):undefined;this[_0xd56b('0x10')][_0xd56b('0x66')](_0x1c1765,_0x2b4823)[_0xd56b('0x14')](function(_0x8af435){_0x34e269(null,_['isNil'](_0x8af435)?![]:!![]);})['catch'](function(_0x1c35bd){logger[_0xd56b('0x2e')](_0x1c35bd);_0x34e269(null,![]);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x68')]=function(_0x1df58d,_0x186a59){sh['exec'](_['trim'](_0x1df58d),function(_0x22b5ad,_0x4b36c2){var _0x55b55d=_0x4b36c2[_0xd56b('0x69')](/(\r\n|\n|\r)/gm,'');_0x186a59(null,_0x55b55d);});};AGIVertices[_0xd56b('0x17')]['googleCloudTTS']=function(_0x474545,_0x3a85f8){scripts[_0xd56b('0x6a')](_0x474545[_0xd56b('0x6b')],_0x474545['google_cloud_tts_text_type']||_0xd56b('0x6c'),_0x474545[_0xd56b('0x6c')],_0x474545[_0xd56b('0x6d')]||_0xd56b('0x6e'),_0x474545[_0xd56b('0x6f')]||_0xd56b('0x70'),_0x474545[_0xd56b('0x71')]||_0xd56b('0x72'))[_0xd56b('0x14')](function(_0x4233de){_0x3a85f8(null,_0x4233de);})[_0xd56b('0x16')](function(_0x2911d2){_0x3a85f8(_0x2911d2);});};AGIVertices[_0xd56b('0x17')]['googleTTS']=function(_0x13662e,_0x191ca8){scripts[_0xd56b('0x73')](_0x13662e[_0xd56b('0x6c')],_0x13662e[_0xd56b('0x74')]||'en',0x1)[_0xd56b('0x14')](function(_0x5f3e9a){_0x191ca8(null,_0x5f3e9a);})[_0xd56b('0x16')](function(_0x10bc95){_0x191ca8(_0x10bc95);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x75')]=function(_0x8cb5e1,_0x4fe83e){var _0x23f982={'uri':_0x8cb5e1[_0xd56b('0x76')],'method':_0x8cb5e1[_0xd56b('0x77')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x8cb5e1['timeout'])===_0xd56b('0x78')&&parseInt(_0x8cb5e1['timeout'])>=0x1?parseInt(_0x8cb5e1[_0xd56b('0x79')])*0x3e8:0x5*0x3e8};if(_[_0xd56b('0x7a')]([_0xd56b('0x7b'),'PUT'],_0x23f982[_0xd56b('0x77')]['toUpperCase']())){try{_0x23f982[_0xd56b('0x7c')]=_0x8cb5e1[_0xd56b('0xd')]?JSON['parse'](_0x8cb5e1[_0xd56b('0xd')]):{};}catch(_0x416eed){logger['error'](_0xd56b('0x7d'),_0x416eed);}}try{_0x23f982[_0xd56b('0x7e')]=_0x8cb5e1[_0xd56b('0xc')]?JSON[_0xd56b('0x7f')](_0x8cb5e1[_0xd56b('0xc')]):{};}catch(_0x4ce536){logger[_0xd56b('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4ce536);}if(_0x8cb5e1[_0xd56b('0x80')]){try{var _0x459237=require(_0x8cb5e1[_0xd56b('0x80')])['sync'](this,_0x23f982);_0x23f982[_0xd56b('0x81')]=Mustache[_0xd56b('0x82')](_0x8cb5e1[_0xd56b('0x76')],_0x459237,{},['$$','$$']);if(_0x23f982[_0xd56b('0x7e')]){_0x23f982['headers']=JSON[_0xd56b('0x7f')](Mustache[_0xd56b('0x82')](JSON[_0xd56b('0x83')](_0x23f982[_0xd56b('0x7e')]),_0x459237,{},['$$','$$']));}if(_0x23f982[_0xd56b('0x7c')]){_0x23f982['body']=JSON[_0xd56b('0x7f')](Mustache[_0xd56b('0x82')](JSON['stringify'](_0x23f982[_0xd56b('0x7c')]),_0x459237,{},['$$','$$']));}}catch(_0x2d37ad){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2d37ad);}}rp(_0x23f982)[_0xd56b('0x14')](function(_0x3cf088){var _0x41bcd9={'statusCode':_0x3cf088[_0xd56b('0x84')]||0xc8,'statusMessage':_0x3cf088[_0xd56b('0x85')]||'OK','headers':_0x3cf088[_0xd56b('0x7e')]||{},'body':_0x3cf088[_0xd56b('0x7c')]||{}};_0x4fe83e(null,_0x41bcd9);})[_0xd56b('0x16')](function(_0x67e973){var _0x4f6979={'statusCode':_0x67e973['statusCode']||0x1f4,'statusMessage':_0x67e973[_0xd56b('0x86')]||_0xd56b('0x87'),'headers':_0x67e973['options'][_0xd56b('0x7e')]||{},'body':_0x67e973[_0xd56b('0x88')][_0xd56b('0x7c')]||{}};_0x4fe83e(null,_0x4f6979);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x89')]=function(_0x351f8d,_0x2325d0){scripts['googleDialogflow'](this[_0xd56b('0x38')][_0xd56b('0x39')],_0x351f8d[_0xd56b('0x8a')],_0x351f8d[_0xd56b('0x6c')],_0x351f8d[_0xd56b('0x8b')]||'en')[_0xd56b('0x14')](function(_0x5c7e0d){_0x2325d0(null,_0x5c7e0d);})[_0xd56b('0x16')](function(_0x286e0f){_0x2325d0(_0x286e0f);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x8c')]=function(_0x1c5c38,_0x1b9861){scripts[_0xd56b('0x8c')](this['channel'],_0x1c5c38)[_0xd56b('0x14')](function(_0x366576){_0x1b9861(null,_0x366576);})[_0xd56b('0x16')](function(_0x226ece){_0x1b9861(_0x226ece);});};AGIVertices['prototype'][_0xd56b('0x8d')]=function(_0xe7edd6,_0x50723d){scripts[_0xd56b('0x8d')](_0xe7edd6['key'],_0xe7edd6[_0xd56b('0x6c')],_0xe7edd6[_0xd56b('0x8e')]||_0xd56b('0x6e'),_0xe7edd6[_0xd56b('0x8f')])['then'](function(_0xd770f2){_0x50723d(null,_0xd770f2);})[_0xd56b('0x16')](function(_0x1fbf15){_0x50723d(_0x1fbf15);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x90')]=function(_0x41d030,_0x23cc29,_0x36cffb){scripts['ispeechASR'](_0x23cc29,_0x41d030[_0xd56b('0x8a')],_0x41d030['ispeech_asr_language']||_0xd56b('0x6e'),this[_0xd56b('0x91')](_0x41d030[_0xd56b('0x92')])?_0x41d030['model']:undefined)['then'](function(_0x5c30de){_0x36cffb(null,_0x5c30de);})['catch'](function(_0x226be1){_0x36cffb(_0x226be1);});};AGIVertices[_0xd56b('0x17')]['awsPolly']=function(_0x3c4986,_0xf332d){scripts['awsPolly'](_0x3c4986[_0xd56b('0x93')],_0x3c4986[_0xd56b('0x94')],_0x3c4986[_0xd56b('0x95')],_0x3c4986[_0xd56b('0x96')]||'Amy',_0x3c4986[_0xd56b('0x6c')],_0x3c4986[_0xd56b('0x97')]||_0xd56b('0x6c'))[_0xd56b('0x14')](function(_0x5b2535){_0xf332d(null,_0x5b2535);})[_0xd56b('0x16')](function(_0x5cf690){_0xf332d(_0x5cf690);});};AGIVertices['prototype']['awsLex']=function(_0x1a8534,_0x1f157c){scripts[_0xd56b('0x98')](this[_0xd56b('0x38')][_0xd56b('0x39')],_0x1a8534[_0xd56b('0x93')],_0x1a8534[_0xd56b('0x94')],_0x1a8534[_0xd56b('0x99')],_0x1a8534[_0xd56b('0x6c')],_0x1a8534[_0xd56b('0x9a')])[_0xd56b('0x14')](function(_0x571523){_0x1f157c(null,_0x571523);})[_0xd56b('0x16')](function(_0x40eaa5){_0x1f157c(_0x40eaa5);});};AGIVertices[_0xd56b('0x17')]['googleASR']=function(_0x286a4b,_0x338e67,_0x23a9f8){scripts['googleASR'](_0x338e67,_0x286a4b[_0xd56b('0x8a')],_0x286a4b['google_asr_language']||_0xd56b('0x6e'))[_0xd56b('0x14')](function(_0x4910d5){_0x23a9f8(null,_0x4910d5);})['catch'](function(_0x3339ec){_0x23a9f8(_0x3339ec);});};AGIVertices[_0xd56b('0x17')]['tildeASR']=function(_0x55f3ef,_0x408103,_0xd49688){scripts[_0xd56b('0x9b')](_0x408103,_0x55f3ef['appid'],_0x55f3ef[_0xd56b('0x9c')],_0x55f3ef[_0xd56b('0x81')])[_0xd56b('0x14')](function(_0x1c6bb0){_0xd49688(null,_0x1c6bb0);})['catch'](function(_0x2f1f7b){_0xd49688(_0x2f1f7b);});};AGIVertices[_0xd56b('0x17')][_0xd56b('0x9d')]=function(_0x2820d7){var _0x3a1447=_[_0xd56b('0x7a')](verticesWithRetry,_0x2820d7[_0xd56b('0x3b')])?_0x2820d7:_[_0xd56b('0x9e')](_0x2820d7);for(var _0x4a731d in _0x3a1447){if(_0x3a1447[_0xd56b('0x9f')](_0x4a731d)){if(_0x3a1447[_0x4a731d]&&_[_0xd56b('0xa0')](_0x3a1447[_0x4a731d])){if(_[_0xd56b('0x7a')](recursiveMapAttributes,_0x4a731d)){_0x3a1447[_0x4a731d]=this[_0xd56b('0xa1')](_0x3a1447[_0x4a731d]);}else{_0x3a1447[_0x4a731d]=this[_0xd56b('0xa2')](_0x3a1447[_0x4a731d]);}}}}return _0x3a1447;};AGIVertices['prototype'][_0xd56b('0xa3')]=function(_0xb1f3a1){for(var _0x3fd88e in _0xb1f3a1){if(_0xb1f3a1[_0xd56b('0x9f')](_0x3fd88e)){if(_[_0xd56b('0xa4')](_0xb1f3a1[_0x3fd88e])){this[_0xd56b('0xa3')](_0xb1f3a1[_0x3fd88e]);}else if(_[_0xd56b('0xa5')](_0xb1f3a1[_0x3fd88e])){for(var _0x4948c0=0x0;_0x4948c0<_0xb1f3a1[_0x3fd88e][_0xd56b('0xa6')];_0x4948c0++){this[_0xd56b('0xa3')](_0xb1f3a1[_0x3fd88e][_0x4948c0]);}}else if(_[_0xd56b('0xa0')](_0xb1f3a1[_0x3fd88e])){_0xb1f3a1[_0x3fd88e]=this[_0xd56b('0xa2')](_0xb1f3a1[_0x3fd88e]);}}}};AGIVertices[_0xd56b('0x17')][_0xd56b('0xa7')]=function(_0x3437c2,_0x520da1){for(var _0x47fee3 in _0x3437c2){if(_0x3437c2[_0xd56b('0x9f')](_0x47fee3)){if(_[_0xd56b('0xa4')](_0x3437c2[_0x47fee3])){if(!_[_0xd56b('0x49')](_0x3437c2[_0x47fee3])){this['saveRestApiResult'](_0x3437c2[_0x47fee3],util[_0xd56b('0x2b')](_0xd56b('0xa8'),_0x520da1,_0x47fee3));}}else if(_['isArray'](_0x3437c2[_0x47fee3])){for(var _0x41b25a=0x0;_0x41b25a<_0x3437c2[_0x47fee3][_0xd56b('0xa6')];_0x41b25a++){this['saveRestApiResult'](_0x3437c2[_0x47fee3][_0x41b25a],util[_0xd56b('0x2b')]('%s.%s',_0x520da1,_0x47fee3+'['+_0x41b25a+']'));}}else{if(!_[_0xd56b('0x4a')](_0x3437c2[_0x47fee3])){this[_0xd56b('0x38')][_0xd56b('0xa9')](util[_0xd56b('0x2b')](_0xd56b('0xa8'),_0x520da1,_0x47fee3),_0x3437c2[_0x47fee3]);}}}}};AGIVertices[_0xd56b('0x17')][_0xd56b('0xa1')]=function(_0x238247){try{var _0x3ab7a9=JSON['parse'](_0x238247);this[_0xd56b('0xa3')](_0x3ab7a9);return JSON[_0xd56b('0x83')](_0x3ab7a9);}catch(_0xd597d6){return this['replaceAllVariables'](_0x238247);}};AGIVertices['prototype'][_0xd56b('0xa2')]=function(_0x4e7fcd){console[_0xd56b('0x46')]('replaceall\x20init',_0x4e7fcd);var _0x925bfa=_0x4e7fcd[_0xd56b('0xaa')]('{');for(var _0xeb3ede=0x1;_0xeb3ede<_0x925bfa[_0xd56b('0xa6')];_0xeb3ede+=0x1){var _0x3f7c1f=_0x925bfa[_0xeb3ede][_0xd56b('0xaa')]('}');console[_0xd56b('0x46')](_0xd56b('0xab'),_0x3f7c1f);if(_0x3f7c1f[_0xd56b('0xa6')]>0x1){_0x4e7fcd=_0x4e7fcd['replaceAll']('{'+_0x3f7c1f[0x0]+'}',this[_0xd56b('0x38')][_0xd56b('0x12')](_0x3f7c1f[0x0])[_0xd56b('0xac')]||_0x3f7c1f[0x0]);}}if(_0x925bfa[_0xd56b('0xa6')]===0x1){return _0x4e7fcd[_0xd56b('0xad')]();}console[_0xd56b('0x46')](_0xd56b('0xae'),_0x4e7fcd);return this[_0xd56b('0xa2')](_0x4e7fcd);};AGIVertices['prototype'][_0xd56b('0xaf')]=function(_0x1daa7a,_0x203ad6){var _0x3dc843=this[_0xd56b('0x38')][_0xd56b('0x12')](_0x1daa7a);if(_0x3dc843[_0xd56b('0xb0')]===-0x1){return _0x3dc843;}logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0xb1'),_0x203ad6,_0x3dc843[_0xd56b('0xac')]));return this[_0xd56b('0x38')][_0xd56b('0xa9')](_0x203ad6,_0x3dc843[_0xd56b('0xac')]);};AGIVertices[_0xd56b('0x17')]['isConfigured']=function(_0x1b5771){return _0x1b5771&&_0x1b5771!=='0'&&_0x1b5771!=='-1'&&_0x1b5771!=='';};AGIVertices[_0xd56b('0x17')][_0xd56b('0xb2')]=function(_0x3747a4){this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x3747a4,'-');_0x3747a4['retry']=_0x3747a4[_0xd56b('0xb2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd56b('0x17')][_0xd56b('0xb4')]=function(_0x12418e){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0xb5'),_0x12418e[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x12418e[_0xd56b('0x6c')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')]('no\x20text\x20configured');}var _0x1d2ba1='\x22'+_0x12418e[_0xd56b('0x6c')]+'\x22';if(this[_0xd56b('0x91')](_0x12418e[_0xd56b('0x88')])){_0x1d2ba1+=','+_0x12418e[_0xd56b('0x88')];}var _0x12754e=this[_0xd56b('0x38')][_0xd56b('0xb7')](_0xd56b('0xb8'),_0x1d2ba1);if(_0x12754e[_0xd56b('0xb0')]===-0x1){return _0x12754e;}return this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')](_0xd56b('0xb9'),_0x1d2ba1));};AGIVertices['prototype'][_0xd56b('0xba')]=function(_0x433cd9){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0xbb'),_0x433cd9[_0xd56b('0x3a')]));if(!this['isConfigured'](_0x433cd9[_0xd56b('0xbc')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0xbd'));}var _0x11f288=_0x433cd9[_0xd56b('0xbc')];if(this['isConfigured'](_0x433cd9[_0xd56b('0x88')])){_0x11f288+=','+_0x433cd9[_0xd56b('0x88')];}var _0x19e469=this[_0xd56b('0x38')][_0xd56b('0xb7')](_0xd56b('0xbe'),_0x11f288);if(_0x19e469[_0xd56b('0xb0')]===-0x1){return _0x19e469;}var _0x566ab4=this[_0xd56b('0xaf')](_0xd56b('0xbf'),_0xd56b('0xc0'));if(_0x566ab4[_0xd56b('0xb0')]===-0x1){return _0x566ab4;}var _0x516e84=this[_0xd56b('0xaf')](_0xd56b('0xc1'),_0xd56b('0xc2'));if(_0x516e84[_0xd56b('0xb0')]===-0x1){return _0x516e84;}var _0x4bd1b7=this[_0xd56b('0xaf')](_0xd56b('0xc3'),_0xd56b('0xc4'));if(_0x4bd1b7['result']===-0x1){return _0x4bd1b7;}return this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0xc5'),_0x11f288));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x7')]=function(_0x2d0d30){logger[_0xd56b('0x30')](util['format'](_0xd56b('0xc6'),_0x2d0d30['label']));return this['channel'][_0xd56b('0x7')]([_0x2d0d30['command'],_0x2d0d30['args']]);};AGIVertices['prototype'][_0xd56b('0xc7')]=function(_0x4a63c3){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0xc8'),_0x4a63c3[_0xd56b('0x3a')]));if(this['isConfigured'](_0x4a63c3[_0xd56b('0x79')])){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x4a63c3[_0xd56b('0x79')]));var _0x55171c=this['channel'][_0xd56b('0xc9')](_0x4a63c3[_0xd56b('0x79')]);if(_0x55171c[_0xd56b('0xb0')]===-0x1){return _0x55171c;}}return this['channel'][_0xd56b('0xc7')]();};AGIVertices[_0xd56b('0x17')][_0xd56b('0xca')]=function(_0x4b0649){console[_0xd56b('0x46')](_0xd56b('0xcb'),_0x4b0649);logger[_0xd56b('0x30')](util['format'](_0xd56b('0xcc'),_0x4b0649[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x4b0649[_0xd56b('0xcd')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x4b0649,_0xd56b('0xce'));}_0x4b0649[_0xd56b('0x4f')]=moment();if(this['isConfigured'](_0x4b0649[_0xd56b('0xcf')])){_0x4b0649[_0xd56b('0x4f')]=moment()[_0xd56b('0x5f')](_0x4b0649[_0xd56b('0xcf')],_0xd56b('0x5d'));}if(!this[_0xd56b('0x91')](_0x4b0649[_0xd56b('0x50')])){_0x4b0649[_0xd56b('0x50')]=0x2;}console['log'](_0xd56b('0xd0'),_0x4b0649);this[_0xd56b('0x45')][_0xd56b('0xb3')](this,_0x4b0649);return this[_0xd56b('0x38')][_0xd56b('0xb6')](util['format'](_0xd56b('0xd1'),_0x4b0649[_0xd56b('0x4d')],_0x4b0649['list_id'],_0x4b0649[_0xd56b('0x4f')]));};AGIVertices[_0xd56b('0x17')][_0xd56b('0xd2')]=function(_0x32a5c0){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0xd3'),_0x32a5c0[_0xd56b('0x3a')]));var _0x19e7d3=this[_0xd56b('0x38')][_0xd56b('0xb7')](_0x32a5c0[_0xd56b('0xd4')],_0x32a5c0[_0xd56b('0x88')]);if(_0x19e7d3['result']===-0x1){return _0x19e7d3;}return this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')](_0xd56b('0xd5'),_0x32a5c0[_0xd56b('0xd4')],_0x32a5c0[_0xd56b('0x88')]));};AGIVertices[_0xd56b('0x17')][_0xd56b('0xd6')]=function(_0x5bc97d){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0xd7'),_0x5bc97d[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x5bc97d[_0xd56b('0x6c')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0xd8'));}var _0x53b816='\x22'+_0x5bc97d[_0xd56b('0x6c')]+'\x22';if(this[_0xd56b('0x91')](_0x5bc97d[_0xd56b('0x88')])){_0x53b816+=','+_0x5bc97d[_0xd56b('0x88')];}var _0x24be27=this[_0xd56b('0x38')][_0xd56b('0xb7')](_0xd56b('0xb8'),_0x53b816);if(_0x24be27[_0xd56b('0xb0')]===-0x1){return _0x24be27;}return this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0xb9'),_0x53b816));};AGIVertices[_0xd56b('0x17')]['sestektts']=function(_0xd0f2d4){logger[_0xd56b('0x30')](util['format'](_0xd56b('0xd9'),_0xd0f2d4[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0xd0f2d4[_0xd56b('0x6c')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0xd8'));}var _0x19b8d0='\x22'+_0xd0f2d4[_0xd56b('0x6c')]+'\x22';if(this[_0xd56b('0x91')](_0xd0f2d4['options'])){_0x19b8d0+=','+_0xd0f2d4[_0xd56b('0x88')];}var _0x510347=this[_0xd56b('0x38')]['exec'](_0xd56b('0xb8'),_0x19b8d0);if(_0x510347[_0xd56b('0xb0')]===-0x1){return _0x510347;}return this['channel']['noop'](util[_0xd56b('0x2b')](_0xd56b('0xb9'),_0x19b8d0));};AGIVertices['prototype'][_0xd56b('0xda')]=function(_0x462825){logger[_0xd56b('0x30')](util['format'](_0xd56b('0xdb'),_0x462825[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x462825['grammar'])){return this['channel'][_0xd56b('0xb6')](_0xd56b('0xbd'));}var _0x4ec909=_0x462825[_0xd56b('0xbc')];if(this['isConfigured'](_0x462825[_0xd56b('0x88')])){_0x4ec909+=','+_0x462825['options'];}var _0x36e775=this[_0xd56b('0x38')][_0xd56b('0xb7')](_0xd56b('0xbe'),_0x4ec909);if(_0x36e775[_0xd56b('0xb0')]===-0x1){return _0x36e775;}var _0x530ef6=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xd56b('0xdc'));if(_0x530ef6[_0xd56b('0xb0')]===-0x1){return _0x530ef6;}var _0x3a08de=this[_0xd56b('0xaf')](_0xd56b('0xc1'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3a08de[_0xd56b('0xb0')]===-0x1){return _0x3a08de;}var _0x30770a=this['getAndSetVariable'](_0xd56b('0xc3'),_0xd56b('0xdd'));if(_0x30770a[_0xd56b('0xb0')]===-0x1){return _0x30770a;}return this[_0xd56b('0x38')][_0xd56b('0xb6')](util['format'](_0xd56b('0xc5'),_0x4ec909));};AGIVertices[_0xd56b('0x17')][_0xd56b('0xde')]=function(_0x185bb4){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0xdf'),_0x185bb4[_0xd56b('0x3a')]));if(!this['isConfigured'](_0x185bb4[_0xd56b('0xbc')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')]('no\x20grammar\x20configured');}var _0x243fef=_0x185bb4[_0xd56b('0xbc')];if(this[_0xd56b('0x91')](_0x185bb4[_0xd56b('0x88')])){_0x243fef+=','+_0x185bb4[_0xd56b('0x88')];}var _0x28294e=this[_0xd56b('0x38')][_0xd56b('0xb7')]('MRCPRecog',_0x243fef);if(_0x28294e[_0xd56b('0xb0')]===-0x1){return _0x28294e;}var _0x4cc1de=this[_0xd56b('0xaf')](_0xd56b('0xbf'),_0xd56b('0xe0'));if(_0x4cc1de['result']===-0x1){return _0x4cc1de;}var _0x53352c=this[_0xd56b('0xaf')](_0xd56b('0xc1'),_0xd56b('0xe1'));if(_0x53352c[_0xd56b('0xb0')]===-0x1){return _0x53352c;}var _0x4f1502=this[_0xd56b('0xaf')](_0xd56b('0xc3'),'SESTEK_ASR_INSTANCE');if(_0x4f1502[_0xd56b('0xb0')]===-0x1){return _0x4f1502;}return this['channel'][_0xd56b('0xb6')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x243fef));};AGIVertices['prototype']['database']=function(_0xdf237c){logger[_0xd56b('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0xdf237c[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0xdf237c['odbc_id'])){return this['channel'][_0xd56b('0x2e')](_0xdf237c,_0xd56b('0xe2'));}var _0x5b8d9e=this[_0xd56b('0x1b')]['sync'](this,_0xdf237c[_0xd56b('0xe3')]);if(!_0x5b8d9e){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0xdf237c,_0xd56b('0xe4'));}if(!this[_0xd56b('0x91')](_0xdf237c[_0xd56b('0x31')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0xdf237c,_0xd56b('0xe5'));}var _0x13cb31=_0xdf237c[_0xd56b('0x31')][_0xd56b('0x69')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd56b('0x38')][_0xd56b('0xb6')](util['format'](_0xd56b('0xe6'),_0x13cb31));var _0x558ea9=this[_0xd56b('0x2c')][_0xd56b('0xb3')](this,_0x5b8d9e,_0x13cb31);this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0xdf237c,_0x13cb31);if(!this['isConfigured'](_0xdf237c['variable_id'])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0xe7'));}var _0x5c2bec=this[_0xd56b('0x12')][_0xd56b('0xb3')](this,_0xdf237c[_0xd56b('0xe8')]);if(!_0x5c2bec){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0xdf237c,_0xd56b('0xe9'));}var _0x192478=this;_0x558ea9[_0xd56b('0xea')](function(_0x195f4c,_0x164318){Object[_0xd56b('0xeb')](_0x195f4c)['forEach'](function(_0x41d43d){_0x192478['channel']['setVariable'](util[_0xd56b('0x2b')](_0xd56b('0xec'),_0x5c2bec,_0x164318,_0x41d43d),_0x195f4c[_0x41d43d]);});});this['channel']['setVariable'](util[_0xd56b('0x2b')]('%s_ROWS_COUNT',_0x5c2bec),_0x558ea9[_0xd56b('0xa6')]);return this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0xed'),_0x5c2bec));};AGIVertices[_0xd56b('0x17')][_0xd56b('0xee')]=function(_0x431534){logger['debug'](util[_0xd56b('0x2b')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x431534[_0xd56b('0x3a')]));if(!this['isConfigured'](_0x431534['sip_id'])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x431534,_0xd56b('0xef'));}var _0x170fe2=this[_0xd56b('0x1e')][_0xd56b('0xb3')](this,_0x431534['sip_id']);if(!_0x170fe2){return this['channel'][_0xd56b('0x2e')](_0x431534,_0xd56b('0xf0'));}var _0x37fbe0=this['channel'][_0xd56b('0xb7')](_0xd56b('0xf1'),[util[_0xd56b('0x2b')]('SIP/%s',_0x170fe2),_0x431534[_0xd56b('0x79')],_0x431534[_0xd56b('0xf2')],_0x431534[_0xd56b('0x76')]]);if(_0x37fbe0[_0xd56b('0xb0')]===-0x1){return _0x37fbe0;}return this['channel'][_0xd56b('0xb6')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xd56b('0x17')][_0xd56b('0xf3')]=function(_0x2d8177){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2d8177[_0xd56b('0x3a')]));if(!this['isConfigured'](_0x2d8177[_0xd56b('0x8a')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')]('no\x20key\x20configured');}if(!this[_0xd56b('0x91')](_0x2d8177[_0xd56b('0x6c')])){return this['channel'][_0xd56b('0xb6')](_0xd56b('0xd8'));}this['channel']['bot']=!![];this[_0xd56b('0x37')](_0x2d8177);this['createSquareMessage'](_0x2d8177[_0xd56b('0x6c')],'in');this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0xf4'),_0x2d8177[_0xd56b('0x6c')]));var _0x37b7c7=this[_0xd56b('0x89')][_0xd56b('0xb3')](this,_0x2d8177);if(_0x37b7c7){for(var _0x316b55 in _0x37b7c7){if(_0x37b7c7[_0xd56b('0x9f')](_0x316b55)){this['channel'][_0xd56b('0xa9')](util[_0xd56b('0x2b')](_0xd56b('0xf5'),_0x316b55['toUpperCase']()),_0x37b7c7[_0x316b55]);}}this[_0xd56b('0x44')](_0x37b7c7[_0xd56b('0xf6')],_0xd56b('0xf7'));return this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('Dialogflow\x20Result\x20%s',_0x37b7c7['speech']));}return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x2d8177,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xd56b('0xf8')]=function(_0x40ddf2){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0xf9'),_0x40ddf2[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x40ddf2['ndauth_url'])){return this['channel'][_0xd56b('0xb6')](_0xd56b('0xfa'));}if(!this['isConfigured'](_0x40ddf2['username'])){return this['channel'][_0xd56b('0xb6')](_0xd56b('0xfb'));}if(!this[_0xd56b('0x91')](_0x40ddf2[_0xd56b('0xfc')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0xfd'));}if(!this['isConfigured'](_0x40ddf2[_0xd56b('0xfe')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0xd8'));}this[_0xd56b('0x38')]['bot']=!![];this[_0xd56b('0x37')](_0x40ddf2);this[_0xd56b('0x44')](_0x40ddf2[_0xd56b('0x6c')],'in');this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('Trying\x20SestekNDA:\x20%s',_0x40ddf2[_0xd56b('0x6c')]));var _0x17de1d=this[_0xd56b('0x8c')][_0xd56b('0xb3')](this,_0x40ddf2);if(_0x17de1d){for(var _0xd2536b in _0x17de1d){if(_0x17de1d[_0xd56b('0x9f')](_0xd2536b)){this[_0xd56b('0x38')][_0xd56b('0xa9')](util[_0xd56b('0x2b')](_0xd56b('0xff'),_0xd2536b[_0xd56b('0x100')]()),_0x17de1d[_0xd2536b]);}}this['createSquareMessage'](_0x17de1d[_0xd56b('0xf6')],_0xd56b('0xf7'));if(_0x17de1d[_0xd56b('0x101')]){this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x17de1d[_0xd56b('0x101')]));var _0x3e6e40=this[_0xd56b('0x38')]['streamFile'](_0x17de1d['audiofile']);try{fs[_0xd56b('0x102')](_0x17de1d['audiofile']+_0xd56b('0x103'));}catch(_0x4e642d){logger[_0xd56b('0x2e')](_0x4e642d);}return _0x3e6e40;}else{return this['channel']['noop'](util[_0xd56b('0x2b')]('SestekNDA\x20Result\x20%s',_0x17de1d[_0xd56b('0xf6')]));}}return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x40ddf2,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xd56b('0x17')][_0xd56b('0x104')]=function(_0x396d08){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x105'),_0x396d08['label']));return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0x104'));};AGIVertices['prototype'][_0xd56b('0x106')]=function(_0x3396b6){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x107'),_0x3396b6[_0xd56b('0x3a')]));var _0x546cd4='';if(_0x3396b6['trunk_id']){if(!this[_0xd56b('0x91')](_0x3396b6['trunk_id'])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x3396b6,'no\x20trunk\x20selected');}else{var _0x811504=parseInt(_0x3396b6[_0xd56b('0x108')],0xa);if(isNaN(_0x811504)){_0x546cd4=_0x3396b6[_0xd56b('0x108')];}else{_0x546cd4=this[_0xd56b('0x20')][_0xd56b('0xb3')](this,_0x3396b6['trunk_id']);if(!_0x546cd4){return this['channel'][_0xd56b('0x2e')](_0x3396b6,_0xd56b('0x109'));}}}}else if(_0x3396b6[_0xd56b('0x10a')]){_0x546cd4=_0x3396b6[_0xd56b('0x10a')];}else{return this[_0xd56b('0x38')]['error'](_0x3396b6,_0xd56b('0x10b'));}var _0x3903de=this['channel']['exec']('DIAL',[util[_0xd56b('0x2b')](_0xd56b('0x10c'),_0x546cd4,_0x3396b6['phone']),_0x3396b6[_0xd56b('0x79')],_0x3396b6['opts'],_0x3396b6[_0xd56b('0x76')]]);if(_0x3903de[_0xd56b('0xb0')]===-0x1){return _0x3903de;}return this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x10d'),_0xd56b('0xf1')));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x10e')]=function(_0x343d41){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x10f'),_0x343d41[_0xd56b('0x3a')]));return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0x10e'));};AGIVertices['prototype'][_0xd56b('0xe')]=function(_0x5d4d1f){logger['info'](util[_0xd56b('0x2b')](_0xd56b('0x110'),_0x5d4d1f[_0xd56b('0x3a')]));if(_0x5d4d1f[_0xd56b('0x111')]===0x0){return this[_0xd56b('0xb2')](_0x5d4d1f);}_0x5d4d1f[_0xd56b('0x111')]-=0x1;if(!this[_0xd56b('0x91')](_0x5d4d1f[_0xd56b('0x112')])){return this['channel'][_0xd56b('0x2e')](_0x5d4d1f,_0xd56b('0x113'));}var _0x4e4a71=this[_0xd56b('0x114')][_0xd56b('0xb3')](this,_0x5d4d1f[_0xd56b('0x112')]);if(!_0x4e4a71){return this[_0xd56b('0x38')]['error'](_0x5d4d1f,'no\x20file\x20audio\x20found');}if(!this[_0xd56b('0x91')](_0x5d4d1f[_0xd56b('0xe8')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0xd56b('0xe7'));}var _0x193a5c=this[_0xd56b('0x38')][_0xd56b('0x115')](_0x4e4a71,_0x5d4d1f['response'],_0x5d4d1f['maxdigit']);var _0x3fb369=_0x193a5c['result']?_0x193a5c[_0xd56b('0xb0')]['toString']():'';logger[_0xd56b('0x30')](_0xd56b('0x116'),JSON[_0xd56b('0x83')](_0x193a5c));if(_0x193a5c[_0xd56b('0xb0')]===-0x1){this['createSquareDetailsReport'][_0xd56b('0xb3')](this,_0x5d4d1f,_0x3fb369);return _0x193a5c;}else if(_0x193a5c['extra']==='timeout'){_0x193a5c[_0xd56b('0xb0')]=_0x3fb369[_0xd56b('0xa6')]>=parseInt(_0x5d4d1f['mindigit'])?'x':'i';}else{_0x193a5c[_0xd56b('0xb0')]=_0x3fb369[_0xd56b('0xa6')]>=parseInt(_0x5d4d1f[_0xd56b('0x117')])&&_0x3fb369['length']<=parseInt(_0x5d4d1f[_0xd56b('0x118')])?'x':'i';}var _0x237a42=this[_0xd56b('0x12')][_0xd56b('0xb3')](this,_0x5d4d1f[_0xd56b('0xe8')]);if(!_0x237a42){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x5d4d1f,_0xd56b('0xe9'));}this[_0xd56b('0x38')]['setVariable'](_0x237a42,_0x3fb369);if(this['isConfigured'](_0x5d4d1f[_0xd56b('0x119')])){var _0x28089c=parseInt(_0x5d4d1f[_0xd56b('0x119')],0xa);var _0x28816a=rs[_0xd56b('0x11a')]({'charset':'*','length':_0x28089c});var _0x226067=_0x3fb369[_0xd56b('0xa6')];if(_0x226067>0x0){if(_0x226067>_0x28089c){this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x5d4d1f,_0x5d4d1f[_0xd56b('0x11b')]===_0xd56b('0x11c')?_0x28816a+_0x3fb369[_0xd56b('0x11d')](_0x28089c):_0x3fb369[_0xd56b('0x11d')](0x0,_0x226067-_0x28089c)+_0x28816a);}else{this['createSquareDetailsReport'][_0xd56b('0xb3')](this,_0x5d4d1f,rs['generate']({'charset':'*','length':_0x226067}));}}else{this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x5d4d1f,'');}}else{this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x5d4d1f,_0x3fb369);}return _0x193a5c;};AGIVertices[_0xd56b('0x17')]['getsecretdigits']=function(_0x5f5ae7){logger['info'](util[_0xd56b('0x2b')](_0xd56b('0x11e'),_0x5f5ae7['label']));return this['getdigits'](_0x5f5ae7);};AGIVertices[_0xd56b('0x17')][_0xd56b('0x11f')]=function(_0x5d53e4){logger['info'](util['format'](_0xd56b('0x120'),_0x5d53e4[_0xd56b('0x3a')]));this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x5d53e4,_0x5d53e4[_0xd56b('0x121')]);return this[_0xd56b('0x38')][_0xd56b('0xb6')](util['format'](_0xd56b('0x122'),_0x5d53e4[_0xd56b('0x121')]));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x123')]=function(_0x3e3e2b){logger['info'](util[_0xd56b('0x2b')](_0xd56b('0x124'),_0x3e3e2b[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x3e3e2b['aws_access_key_id'])||!this[_0xd56b('0x91')](_0x3e3e2b[_0xd56b('0x94')])){return this['channel'][_0xd56b('0xb6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xd56b('0x91')](_0x3e3e2b[_0xd56b('0x6c')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')]('no\x20text\x20configured');}this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x3e3e2b[_0xd56b('0x6c')]));var _0x3289bf=this[_0xd56b('0x125')][_0xd56b('0xb3')](this,_0x3e3e2b);if(_0x3289bf){this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x3289bf));var _0x5b57c9=this[_0xd56b('0x38')][_0xd56b('0x126')](_0x3289bf);try{fs[_0xd56b('0x102')](_0x3289bf+_0xd56b('0x103'));}catch(_0xd18800){logger[_0xd56b('0x2e')](_0xd18800);}return _0x5b57c9;}return this[_0xd56b('0x38')]['error'](_0x3e3e2b,_0xd56b('0x127'));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x128')]=function(_0xa588d){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xa588d[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0xa588d['aws_access_key_id'])||!this[_0xd56b('0x91')](_0xa588d[_0xd56b('0x94')])){return this['channel'][_0xd56b('0xb6')](_0xd56b('0x129'));}if(!this[_0xd56b('0x91')](_0xa588d['aws_bot_name'])){return this[_0xd56b('0x38')]['noop'](_0xd56b('0x12a'));}if(!this[_0xd56b('0x91')](_0xa588d['text'])){return this[_0xd56b('0x38')]['noop']('no\x20text\x20configured');}this[_0xd56b('0x38')][_0xd56b('0x12b')]=!![];this['createSquareDetailsReport'](_0xa588d);this['createSquareMessage'](_0xa588d[_0xd56b('0x6c')],'in');this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x12c'),_0xa588d[_0xd56b('0x6c')]));var _0x151eb9=this[_0xd56b('0x98')][_0xd56b('0xb3')](this,_0xa588d);if(_0x151eb9){for(var _0x60bae2 in _0x151eb9){if(_0x151eb9[_0xd56b('0x9f')](_0x60bae2)&&_[_0xd56b('0xa0')](_0x151eb9[_0x60bae2])){this[_0xd56b('0x38')][_0xd56b('0xa9')](util['format'](_0xd56b('0x12d'),_0x60bae2[_0xd56b('0x100')]()),_0x151eb9[_0x60bae2]);}}if(_[_0xd56b('0x4a')](_0x151eb9[_0xd56b('0x86')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0x12e'));}else{this[_0xd56b('0x44')](_0x151eb9[_0xd56b('0x86')],'out');return this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')]('Amazon\x20Lex\x20Result\x20%s',_0x151eb9['message']));}}return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0xa588d,_0xd56b('0x12f'));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x130')]=function(_0x417582){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x131'),_0x417582['label'],_0x417582[_0xd56b('0x79')]));if(!this[_0xd56b('0x91')](_0x417582['key'])){return this[_0xd56b('0x38')]['noop'](_0xd56b('0x132'));}var _0x122676='wav';var _0x249814=util[_0xd56b('0x2b')](_0xd56b('0x133'),FILES_PATH,rs[_0xd56b('0x11a')](0x4));var _0x4c2982=util[_0xd56b('0x2b')](_0xd56b('0xa8'),_0x249814,_0x122676);var _0x1b4356=!![];if(_0x417582[_0xd56b('0x134')]==='NOBEEP'){_0x1b4356=![];}var _0x1d0539=this['channel']['recordFile'](_0x249814,_0x122676,_0x417582[_0xd56b('0x135')],_0x417582[_0xd56b('0x79')],undefined,_0x1b4356);if(_0x1d0539[_0xd56b('0xb0')]!==-0x1){this['channel'][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('google\x20%s\x20file\x20created',_0x4c2982));var _0x2cd72f=this[_0xd56b('0x136')]['sync'](this,_0x417582,_0x4c2982);if(_0x2cd72f){for(var _0x4c60db in _0x2cd72f){if(_0x2cd72f[_0xd56b('0x9f')](_0x4c60db)){this[_0xd56b('0x38')][_0xd56b('0xa9')](util[_0xd56b('0x2b')](_0xd56b('0x137'),_0x4c60db[_0xd56b('0x100')]()),_0x2cd72f[_0x4c60db]);}}return this['channel'][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x138'),JSON[_0xd56b('0x83')](_0x2cd72f)));}}return _0x1d0539;};AGIVertices[_0xd56b('0x17')][_0xd56b('0x139')]=function(_0x3ca965){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x13a'),_0x3ca965[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x3ca965[_0xd56b('0x13b')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0x13c'));}if(!this['isConfigured'](_0x3ca965[_0xd56b('0x9c')])){return this['channel'][_0xd56b('0xb6')]('no\x20appsecret\x20configured');}var _0x1c47d0=_0xd56b('0x13d');var _0x1c887f=util[_0xd56b('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0xd56b('0x11a')](0x4));var _0x46d5ce=util[_0xd56b('0x2b')](_0xd56b('0xa8'),_0x1c887f,_0x1c47d0);var _0x1fbc1d=!![];if(_0x3ca965[_0xd56b('0x134')]===_0xd56b('0x13e')){_0x1fbc1d=![];}var _0x58c8d6=this[_0xd56b('0x38')][_0xd56b('0x13f')](_0x1c887f,_0x1c47d0,_0x3ca965[_0xd56b('0x135')],_0x3ca965[_0xd56b('0x79')],undefined,_0x1fbc1d);if(_0x58c8d6[_0xd56b('0xb0')]!==-0x1){this['channel'][_0xd56b('0xb6')](util['format'](_0xd56b('0x140'),_0x46d5ce));var _0x6942ed=this['tildeASR'][_0xd56b('0xb3')](this,_0x3ca965,_0x46d5ce);if(_0x6942ed){for(var _0x1110f5 in _0x6942ed){if(_0x6942ed[_0xd56b('0x9f')](_0x1110f5)){this['channel'][_0xd56b('0xa9')](util['format'](_0xd56b('0x141'),_0x1110f5[_0xd56b('0x100')]()),_0x6942ed[_0x1110f5]);}}return this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x142'),JSON[_0xd56b('0x83')](_0x6942ed)));}}return _0x58c8d6;};AGIVertices[_0xd56b('0x17')]['gotoc']=function(_0x33f464){logger['info'](util['format'](_0xd56b('0x143'),_0x33f464[_0xd56b('0x3a')]));return this[_0xd56b('0x38')]['continueAt'](_0x33f464[_0xd56b('0x144')],_0x33f464[_0xd56b('0x40')],_0x33f464['priority']);};AGIVertices[_0xd56b('0x17')][_0xd56b('0x145')]=function(_0x2c20c6){logger['info'](util['format'](_0xd56b('0x146'),_0x2c20c6[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x2c20c6[_0xd56b('0x147')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x2c20c6,_0xd56b('0x148'));}try{var _0x431160=eval(_0x2c20c6[_0xd56b('0x147')])?_0xd56b('0x149'):_0xd56b('0x14a');this[_0xd56b('0x38')][_0xd56b('0xb6')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x2c20c6[_0xd56b('0x147')],_0x431160));return{'code':0xc8,'result':_0x431160};}catch(_0x24b895){return{'code':0xc8,'result':_0xd56b('0x14a')};}};AGIVertices[_0xd56b('0x17')]['gotoiftime']=function(_0x4c8aa){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x14b'),_0x4c8aa['label']));if(!this[_0xd56b('0x91')](_0x4c8aa['interval_id'])){return this['channel']['error'](_0x4c8aa,_0xd56b('0x14c'));}var _0x155249=this[_0xd56b('0x27')][_0xd56b('0xb3')](this,_0x4c8aa['interval_id']);if(!_0x155249){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x4c8aa,_0xd56b('0x14d'));}for(var _0x4ff27c=0x0;_0x4ff27c<_0x155249[_0xd56b('0xa6')];_0x4ff27c+=0x1){var _0x37fa27=this['channel'][_0xd56b('0x12')](util[_0xd56b('0x2b')](_0xd56b('0x14e'),_0x155249[_0x4ff27c]));if(_0x37fa27[_0xd56b('0xb0')]===-0x1){return _0x37fa27;}logger['info'](util[_0xd56b('0x2b')]('IFTIME\x20%s\x20%s',_0x155249[_0x4ff27c],_0x37fa27[_0xd56b('0xac')]));if(_0x37fa27[_0xd56b('0xac')]===_0xd56b('0x149')){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x14f'),_0x155249[_0x4ff27c],_0xd56b('0x149')));this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x14f'),_0x155249[_0x4ff27c],'true'));return{'code':0xc8,'result':_0xd56b('0x149')};}else{logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x14f'),_0x155249[_0x4ff27c],_0xd56b('0x14a')));this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x14f'),_0x155249[_0x4ff27c],_0xd56b('0x14a')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xd56b('0x17')][_0xd56b('0x150')]=function(_0x11bd74){logger[_0xd56b('0x30')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x11bd74[_0xd56b('0x3a')]));return this[_0xd56b('0x38')]['hangup']();};AGIVertices[_0xd56b('0x17')][_0xd56b('0x151')]=function(_0x5b42f5){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x152'),_0x5b42f5[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x5b42f5['key'])){return this['channel']['noop']('no\x20key\x20configured');}var _0x25116b='wav';var _0x4ed53e=util[_0xd56b('0x2b')](_0xd56b('0x133'),FILES_PATH,rs[_0xd56b('0x11a')](0x4));var _0x49ee15=util['format'](_0xd56b('0xa8'),_0x4ed53e,_0x25116b);var _0x1d9585=!![];if(_0x5b42f5['beep']==='NOBEEP'){_0x1d9585=![];}var _0x30c6f7=this[_0xd56b('0x38')]['recordFile'](_0x4ed53e,_0x25116b,_0x5b42f5[_0xd56b('0x135')],_0x5b42f5[_0xd56b('0x79')],undefined,_0x1d9585);if(_0x30c6f7[_0xd56b('0xb0')]!==-0x1){this['channel'][_0xd56b('0xb6')](util['format']('ispeech\x20%s\x20file\x20created',_0x49ee15));var _0x38b505=this['ispeechASR'][_0xd56b('0xb3')](this,_0x5b42f5,_0x49ee15);if(_0x38b505){for(var _0x582b51 in _0x38b505){if(_0x38b505[_0xd56b('0x9f')](_0x582b51)){this[_0xd56b('0x38')][_0xd56b('0xa9')](util[_0xd56b('0x2b')](_0xd56b('0x153'),_0x582b51[_0xd56b('0x100')]()),_0x38b505[_0x582b51]);}}return this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x38b505)));}}return _0x30c6f7;};AGIVertices[_0xd56b('0x17')][_0xd56b('0x154')]=function(_0x5159a6){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x155'),_0x5159a6[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x5159a6[_0xd56b('0x8a')])){return this[_0xd56b('0x38')]['noop'](_0xd56b('0x132'));}if(!this[_0xd56b('0x91')](_0x5159a6[_0xd56b('0x6c')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0xd8'));}this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x156'),_0x5159a6['text']));var _0x533fef=this['ispeechTTS'][_0xd56b('0xb3')](this,_0x5159a6);if(_0x533fef){this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')](_0xd56b('0x157'),_0x533fef));var _0x358879=this[_0xd56b('0x38')][_0xd56b('0x126')](_0x533fef,_0x5159a6[_0xd56b('0x135')]);try{fs[_0xd56b('0x102')](_0x533fef+_0xd56b('0x103'));}catch(_0x164344){logger[_0xd56b('0x2e')](_0x164344);}return _0x358879;}return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x5159a6,_0xd56b('0x158'));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x159')]=function(_0x1c460a){logger['info'](util[_0xd56b('0x2b')](_0xd56b('0x15a'),_0x1c460a[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x1c460a[_0xd56b('0x15b')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x1c460a,_0xd56b('0x15c'));}logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x15d'),this[_0xd56b('0x38')][_0xd56b('0x3e')],_0x1c460a[_0xd56b('0x15b')]));var _0x1a47c2=this['agentLogin'][_0xd56b('0xb3')](this,_0x1c460a[_0xd56b('0x15b')]);if(_0x1a47c2){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x15e'),this[_0xd56b('0x38')][_0xd56b('0x3e')],_0x1c460a[_0xd56b('0x15b')]));this['channel']['noop'](util['format'](_0xd56b('0x15e'),this['channel'][_0xd56b('0x3e')],_0x1c460a[_0xd56b('0x15b')]));return{'code':0xc8,'result':_0xd56b('0x15f')};}else{logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x160'),this[_0xd56b('0x38')][_0xd56b('0x3e')],_0x1c460a['findBy']));this['channel'][_0xd56b('0xb6')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd56b('0x38')][_0xd56b('0x3e')],_0x1c460a[_0xd56b('0x15b')]));return{'code':0xc8,'result':_0xd56b('0x161')};}};AGIVertices['prototype']['logout']=function(_0x5b86ef){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x162'),_0x5b86ef['label']));if(!this[_0xd56b('0x91')](_0x5b86ef[_0xd56b('0x15b')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x5b86ef,_0xd56b('0x15c'));}logger['info'](util['format'](_0xd56b('0x15d'),this[_0xd56b('0x38')][_0xd56b('0x3e')],_0x5b86ef[_0xd56b('0x15b')]));var _0x31a6b6=this[_0xd56b('0x65')][_0xd56b('0xb3')](this,_0x5b86ef[_0xd56b('0x15b')]);if(_0x31a6b6){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x15e'),this[_0xd56b('0x38')][_0xd56b('0x3e')],_0x5b86ef[_0xd56b('0x15b')]));this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')](_0xd56b('0x15e'),this[_0xd56b('0x38')]['callerid'],_0x5b86ef[_0xd56b('0x15b')]));return{'code':0xc8,'result':_0xd56b('0x15f')};}else{logger[_0xd56b('0x30')](util['format'](_0xd56b('0x160'),this[_0xd56b('0x38')]['callerid'],_0x5b86ef['findBy']));this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x160'),this[_0xd56b('0x38')][_0xd56b('0x3e')],_0x5b86ef[_0xd56b('0x15b')]));return{'code':0xc8,'result':_0xd56b('0x161')};}};AGIVertices['prototype'][_0xd56b('0x163')]=function(_0x22e0fe){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x22e0fe[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x22e0fe[_0xd56b('0x164')])){return this['channel'][_0xd56b('0x2e')](_0x22e0fe,_0xd56b('0x165'));}this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')]('math\x20%s',_0x22e0fe[_0xd56b('0x164')]));var _0x495376=eval(_0x22e0fe[_0xd56b('0x164')]);if(!this[_0xd56b('0x91')](_0x22e0fe[_0xd56b('0xe8')])){return this[_0xd56b('0x38')]['noop'](_0xd56b('0xe7'));}var _0x4196d1=this[_0xd56b('0x12')][_0xd56b('0xb3')](this,_0x22e0fe['variable_id']);if(!_0x4196d1){return this[_0xd56b('0x38')]['error'](_0x22e0fe,_0xd56b('0xe9'));}if(_[_0xd56b('0xa5')](_0x495376)){var _0x3d76c7=this;_0x495376[_0xd56b('0xea')](function(_0xe0dccb,_0x536e2c){_0x3d76c7[_0xd56b('0x38')][_0xd56b('0xa9')](util[_0xd56b('0x2b')]('%s[%s]',_0x4196d1,_0x536e2c),_0xe0dccb);});return this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')]('variable\x20%s[key]\x20set',_0x4196d1));}else{return this[_0xd56b('0x38')][_0xd56b('0xa9')](_0x4196d1,_0x495376);}};AGIVertices[_0xd56b('0x17')][_0xd56b('0x166')]=function(_0x540052){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x167'),_0x540052[_0xd56b('0x3a')]));if(_0x540052[_0xd56b('0x111')]===0x0){return this[_0xd56b('0xb2')](_0x540052);}_0x540052[_0xd56b('0x111')]-=0x1;if(!this[_0xd56b('0x91')](_0x540052[_0xd56b('0x112')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x540052,_0xd56b('0x113'));}var _0x480689=this[_0xd56b('0x114')][_0xd56b('0xb3')](this,_0x540052[_0xd56b('0x112')]);if(!_0x480689){return this['channel'][_0xd56b('0x2e')](_0x540052,'no\x20file\x20audio\x20found');}var _0x455f46=this[_0xd56b('0x38')][_0xd56b('0x115')](_0x480689,_0x540052[_0xd56b('0x168')],_0x540052['digit']);var _0x43bc9d=_0x455f46['result'];if(_0x455f46['result']===-0x1){this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x540052,'-1');return _0x455f46;}else if(_0x455f46[_0xd56b('0xac')]==='timeout'){_0x455f46[_0xd56b('0xb0')]=_0x455f46[_0xd56b('0xb0')][_0xd56b('0xa6')]>0x0?_0x455f46['result']:'t';}else if(_[_0xd56b('0x49')](_0x455f46[_0xd56b('0xb0')])){_0x455f46[_0xd56b('0xb0')]='#';_0x43bc9d='#';}if(!this[_0xd56b('0x91')](_0x540052[_0xd56b('0xe8')])){this[_0xd56b('0x38')][_0xd56b('0xb6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x22101a=this['getVariable'][_0xd56b('0xb3')](this,_0x540052[_0xd56b('0xe8')]);if(!_0x22101a){return this['channel']['error'](_0x540052,_0xd56b('0xe9'));}this[_0xd56b('0x38')][_0xd56b('0xa9')](_0x22101a,_0x43bc9d);}this[_0xd56b('0x37')]['sync'](this,_0x540052,_0x43bc9d);return _0x455f46;};AGIVertices[_0xd56b('0x17')][_0xd56b('0xb6')]=function(_0x5d6983){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x169'),_0x5d6983[_0xd56b('0x3a')]));return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0x5d6983[_0xd56b('0x16a')]||_0x5d6983[_0xd56b('0x3a')]);};AGIVertices['prototype']['pause']=function(_0xb7e9c2){logger[_0xd56b('0x30')](util['format'](_0xd56b('0x16b'),_0xb7e9c2['label']));if(!this[_0xd56b('0x91')](_0xb7e9c2[_0xd56b('0x15b')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0xb7e9c2,_0xd56b('0x15c'));}logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x15d'),this[_0xd56b('0x38')]['callerid'],_0xb7e9c2[_0xd56b('0x15b')]));var _0x18276b=this[_0xd56b('0x60')]['sync'](this,_0xb7e9c2[_0xd56b('0x16c')]);var _0x20ac51=this['agentPause'][_0xd56b('0xb3')](this,_0xb7e9c2[_0xd56b('0x15b')],_0x18276b);if(_0x20ac51){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x15e'),this['channel'][_0xd56b('0x3e')],_0xb7e9c2[_0xd56b('0x15b')]));this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd56b('0x38')][_0xd56b('0x3e')],_0xb7e9c2[_0xd56b('0x15b')]));return{'code':0xc8,'result':_0xd56b('0x15f')};}else{logger[_0xd56b('0x30')](util['format'](_0xd56b('0x160'),this['channel']['callerid'],_0xb7e9c2[_0xd56b('0x15b')]));this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd56b('0x38')]['callerid'],_0xb7e9c2['findBy']));return{'code':0xc8,'result':_0xd56b('0x161')};}};AGIVertices[_0xd56b('0x17')][_0xd56b('0x16d')]=function(_0x3aea37){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x16e'),_0x3aea37[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x3aea37['file_id'])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x3aea37,_0xd56b('0x113'));}var _0x2f9adb=this[_0xd56b('0x114')][_0xd56b('0xb3')](this,_0x3aea37[_0xd56b('0x112')]);if(!_0x2f9adb){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x3aea37,_0xd56b('0x16f'));}var _0x58e6c1=this[_0xd56b('0x38')][_0xd56b('0xb7')](_0xd56b('0x170'),[_0x2f9adb,_0x3aea37[_0xd56b('0xf2')]]);if(_0x58e6c1[_0xd56b('0xb0')]===-0x1){return _0x58e6c1;}return this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')](_0xd56b('0xd5'),_0xd56b('0x170'),_0x2f9adb));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x171')]=function(_0x49cbc4){logger['info'](util['format'](_0xd56b('0x172'),_0x49cbc4['label']));if(!this[_0xd56b('0x91')](_0x49cbc4[_0xd56b('0x173')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x49cbc4,_0xd56b('0x174'));}var _0x27c2d1='';var _0x31cf82=parseInt(_0x49cbc4[_0xd56b('0x173')],0xa);if(isNaN(_0x31cf82)){_0x27c2d1=_0x49cbc4['queue_id'];}else{_0x27c2d1=this[_0xd56b('0x18')][_0xd56b('0xb3')](this,_0x49cbc4[_0xd56b('0x173')]);if(!_0x27c2d1){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x49cbc4,_0xd56b('0x175'));}}var _0x2e0900='';if(this[_0xd56b('0x91')](_0x49cbc4[_0xd56b('0x112')])){var _0x2d56bf=this[_0xd56b('0x114')]['sync'](this,_0x49cbc4[_0xd56b('0x112')]);if(_0x2d56bf){_0x2e0900=_0x2d56bf;}}this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x49cbc4,_0x27c2d1);if(_0x49cbc4[_0xd56b('0xf2')][_0xd56b('0x176')]('x')<0x0){_0x49cbc4[_0xd56b('0xf2')]+='x';}if(_0x49cbc4[_0xd56b('0xf2')][_0xd56b('0x176')]('X')<0x0){_0x49cbc4['opts']+='X';}this[_0xd56b('0x38')][_0xd56b('0xa9')](_0xd56b('0x177'),_0x27c2d1?_0x27c2d1[_0xd56b('0x178')]():'');var _0x9dbf7=this[_0xd56b('0x38')]['exec']('QUEUE',[_0x27c2d1,_0x49cbc4[_0xd56b('0xf2')],_0x49cbc4[_0xd56b('0x76')],_0x2e0900,_0x49cbc4[_0xd56b('0x79')],_0x49cbc4[_0xd56b('0x7')],_0x49cbc4[_0xd56b('0x179')],_0x49cbc4[_0xd56b('0x17a')],'',_0x49cbc4['position']]);if(_0x9dbf7[_0xd56b('0xb0')]===-0x1){return _0x9dbf7;}return this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0xd5'),'QUEUE',_0x27c2d1));};AGIVertices['prototype'][_0xd56b('0x17b')]=function(_0x21237c){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x17c'),_0x21237c['label']));var _0x476190=_0x21237c['recordingFormat']||_0xd56b('0x13d');var _0x49f4fe=util[_0xd56b('0x2b')](_0xd56b('0x17d'),this[_0xd56b('0x38')][_0xd56b('0x39')],rs[_0xd56b('0x11a')](0x5));var _0x5f1586=util[_0xd56b('0x2b')](_0xd56b('0x17e'),FILES_PATH,_0x49f4fe,_0x476190);var _0x354eca=util['format'](_0xd56b('0x133'),FILES_PATH,_0x49f4fe);this[_0xd56b('0x3d')]['sync'](this,_0x21237c,_0x49f4fe,_0x5f1586);this[_0xd56b('0x38')][_0xd56b('0xa9')](_0xd56b('0x17f'),_0x49f4fe);logger[_0xd56b('0x30')](_0xd56b('0x180'),_0x354eca,_0x476190,_0x21237c[_0xd56b('0x181')],_0x21237c[_0xd56b('0x79')]);return this[_0xd56b('0x38')][_0xd56b('0x13f')](_0x354eca,_0x476190,_0x21237c[_0xd56b('0x181')],_0x21237c[_0xd56b('0x79')],undefined,!![]);};AGIVertices[_0xd56b('0x17')][_0xd56b('0x182')]=function(_0x437015){logger['info'](util['format'](_0xd56b('0x183'),_0x437015[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x437015['url'])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0x184'));}var _0x446a82=this[_0xd56b('0x75')][_0xd56b('0xb3')](this,_0x437015);logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x185'),util['inspect'](_0x446a82,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x437015[_0xd56b('0xe8')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5a3254=this[_0xd56b('0x12')]['sync'](this,_0x437015[_0xd56b('0xe8')]);if(!_0x5a3254){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x437015,_0xd56b('0xe9'));}this[_0xd56b('0x38')]['setVariable'](util['format'](_0xd56b('0x186'),_0x5a3254),_0x446a82[_0xd56b('0x84')]?_0x446a82['statusCode']:_0xd56b('0x187'));this['channel'][_0xd56b('0xa9')](util[_0xd56b('0x2b')](_0xd56b('0x188'),_0x5a3254),_0x446a82[_0xd56b('0x85')]?_0x446a82['statusMessage']:'OK');if(_0x446a82[_0xd56b('0x7c')]){try{this[_0xd56b('0xa7')](_0x446a82[_0xd56b('0x7c')],_0x5a3254);}catch(_0x1676a2){logger[_0xd56b('0x2e')](util[_0xd56b('0x2b')](_0xd56b('0x189'),_0x5a3254));}}return this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')](_0xd56b('0xed'),_0x5a3254));};AGIVertices[_0xd56b('0x17')]['saydigits']=function(_0x334bb6){logger['info'](util[_0xd56b('0x2b')](_0xd56b('0x18a'),_0x334bb6[_0xd56b('0x3a')]));return this[_0xd56b('0x38')]['sayDigits'](_0x334bb6[_0xd56b('0x18b')][_0xd56b('0x69')](/\s+/g,''),_0x334bb6[_0xd56b('0x181')]);};AGIVertices[_0xd56b('0x17')][_0xd56b('0x18c')]=function(_0x2691e8){logger['info'](util[_0xd56b('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2691e8[_0xd56b('0x3a')]));return this[_0xd56b('0x38')][_0xd56b('0x18d')](_0x2691e8[_0xd56b('0x78')][_0xd56b('0x69')](/\s+/g,''),_0x2691e8[_0xd56b('0x181')]);};AGIVertices['prototype'][_0xd56b('0x18e')]=function(_0x4ea05d){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4ea05d[_0xd56b('0x3a')]));return this[_0xd56b('0x38')][_0xd56b('0x18f')](_0x4ea05d['text'],_0x4ea05d['escape_digits']);};AGIVertices[_0xd56b('0x17')]['sendMail']=function(_0x128817){logger[_0xd56b('0x30')](util['format'](_0xd56b('0x190'),_0x128817['label']));if(!this[_0xd56b('0x91')](_0x128817['account_id'])){return this[_0xd56b('0x38')]['noop'](_0xd56b('0x191'));}var _0x3861c5=this[_0xd56b('0x25')][_0xd56b('0xb3')](this,_0x128817[_0xd56b('0x192')]);if(!_0x3861c5||!_0x3861c5[_0xd56b('0x193')]){return this[_0xd56b('0x38')]['error'](_0x128817,_0xd56b('0x194'));}var _0x56db29={'from':util[_0xd56b('0x2b')](_0xd56b('0x195'),_0x3861c5[_0xd56b('0x15')],_0x3861c5[_0xd56b('0x196')]||_0x3861c5['Smtp']['user']),'to':_0x128817['to']||'','cc':_0x128817['cc']||'','bcc':_0x128817[_0xd56b('0x197')]||'','subject':_0x128817[_0xd56b('0x198')],'html':_0x128817[_0xd56b('0x6c')],'text':_0x128817[_0xd56b('0x6c')]};var _0x403120={'tls':{'rejectUnauthorized':![]}};if(_0x3861c5[_0xd56b('0x193')][_0xd56b('0x199')]){_0x403120['service']=_0x3861c5[_0xd56b('0x193')]['service'];}else{_0x403120['host']=_0x3861c5[_0xd56b('0x193')][_0xd56b('0x19a')];_0x403120['port']=_0x3861c5['Smtp'][_0xd56b('0x19b')];_0x403120[_0xd56b('0x19c')]=_0x3861c5[_0xd56b('0x193')][_0xd56b('0x19c')];}if(_0x3861c5[_0xd56b('0x193')]['authentication']){_0x403120[_0xd56b('0x19d')]={'user':_0x3861c5['Smtp']['user'],'pass':_0x3861c5[_0xd56b('0x193')][_0xd56b('0x19e')]};}if(this[_0xd56b('0x91')](_0x128817[_0xd56b('0x19f')])){}logger['debug'](_0xd56b('0x1a0'),JSON['stringify'](_0x56db29));this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x128817,_0x128817[_0xd56b('0x192')]);this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x3861c5['name']));this[_0xd56b('0x26')][_0xd56b('0xb3')](this,_0x403120,_0x56db29);return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0x1a1'));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x1a2')]=function(_0xd41bb5){logger['info'](util[_0xd56b('0x2b')](_0xd56b('0x1a3'),_0xd41bb5[_0xd56b('0x3a')]));return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0x1a4'));};AGIVertices[_0xd56b('0x17')]['sendSMS']=function(_0x8e407c){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x1a5'),_0x8e407c[_0xd56b('0x3a')]));if(!this['isConfigured'](_0x8e407c[_0xd56b('0x1a6')])){return this['channel'][_0xd56b('0xb6')](_0xd56b('0x1a7'));}var _0x38274a=this[_0xd56b('0x35')][_0xd56b('0xb3')](this,_0x8e407c[_0xd56b('0x1a6')]);if(!_0x38274a){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x8e407c,_0xd56b('0x1a8'));}var _0x3c7144={'body':_0x8e407c[_0xd56b('0x1a9')],'phone':_0x8e407c['to']||'','SmsAccountId':_0x38274a['id']};logger['debug'](_0xd56b('0x1aa'),JSON[_0xd56b('0x83')](_0x3c7144));this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x8e407c,_0x8e407c[_0xd56b('0x1a6')]);this[_0xd56b('0x38')]['noop'](util[_0xd56b('0x2b')](_0xd56b('0x1ab'),_0x38274a[_0xd56b('0x15')]));this[_0xd56b('0x1ac')]['sync'](this,_0x3c7144);return this[_0xd56b('0x38')]['noop'](_0xd56b('0x1ad'));};AGIVertices['prototype'][_0xd56b('0x1ae')]=function(_0x451006){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x1af'),_0x451006[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x451006[_0xd56b('0xe8')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x451006,_0xd56b('0x1b0'));}var _0xa32b95=this[_0xd56b('0x12')]['sync'](this,_0x451006[_0xd56b('0xe8')]);if(!_0xa32b95){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x451006,'no\x20variable\x20found');}return this['channel'][_0xd56b('0xa9')](_0xa32b95,_0x451006['variable_value']);};AGIVertices['prototype']['start']=function(_0x2101b4){logger[_0xd56b('0x30')](util['format'](_0xd56b('0x1b1'),_0x2101b4['label']));this[_0xd56b('0x38')][_0xd56b('0xb6')]('START\x20CALLY\x20SQUARE');if(_0x2101b4[_0xd56b('0xc7')]===_0xd56b('0x1b2')){this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0x1b3'));return this[_0xd56b('0x38')]['answer']();}return this['channel'][_0xd56b('0xb6')](_0xd56b('0x1b4'));};AGIVertices[_0xd56b('0x17')]['subproject']=function(_0x1e3e7b){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x1b5'),_0x1e3e7b[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x1e3e7b[_0xd56b('0x1b6')])){return this['channel']['error'](_0x1e3e7b,_0xd56b('0x1b7'));}var _0x3d86c6=this[_0xd56b('0x19')][_0xd56b('0xb3')](this,_0x1e3e7b[_0xd56b('0x1b6')]);if(!this['isConfigured'](_0x3d86c6)){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x1e3e7b,util[_0xd56b('0x2b')](_0xd56b('0x1b8'),_0x1e3e7b['project_id']));}if(_0x3d86c6===this[_0xd56b('0x38')][_0xd56b('0x3c')]){return this['channel']['error'](_0x1e3e7b,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xd56b('0x37')][_0xd56b('0xb3')](this,_0x1e3e7b,_0x3d86c6);var _0x512b36=this['channel'][_0xd56b('0xb7')](_0xd56b('0x1b9'),util[_0xd56b('0x2b')](_0xd56b('0x1ba'),config[_0xd56b('0x7')][_0xd56b('0x19a')]||_0xd56b('0x1bb'),_0x3d86c6,this[_0xd56b('0x38')][_0xd56b('0x3c')]));if(_0x512b36['result']===-0x1){return _0x512b36;}return this[_0xd56b('0x38')][_0xd56b('0xb6')](util['format'](_0xd56b('0xd5'),_0xd56b('0x1b9'),_0x3d86c6));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x1bc')]=function(_0x5bf39a){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5bf39a[_0xd56b('0x3a')]));var _0x454385=this[_0xd56b('0x68')]['sync'](this,_0x5bf39a[_0xd56b('0x1bd')]);this[_0xd56b('0x37')]['sync'](this,_0x5bf39a,_0x5bf39a[_0xd56b('0x1bd')]);if(this[_0xd56b('0x91')](_0x5bf39a[_0xd56b('0xe8')])){var _0x42ab80=this[_0xd56b('0x12')][_0xd56b('0xb3')](this,_0x5bf39a[_0xd56b('0xe8')]);if(_0x42ab80){this[_0xd56b('0x38')][_0xd56b('0xa9')](_0x42ab80,_0x454385);return this['channel']['noop'](util[_0xd56b('0x2b')](_0xd56b('0x1be'),_0x5bf39a[_0xd56b('0x1bd')],_0x42ab80));}}return this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x5bf39a['command']));};AGIVertices['prototype'][_0xd56b('0x1bf')]=function(_0x1e2b4d){logger[_0xd56b('0x30')](util['format'](_0xd56b('0x1c0'),_0x1e2b4d[_0xd56b('0x3a')]));_0x1e2b4d['text']=_0x1e2b4d[_0xd56b('0x6c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd56b('0x91')](_0x1e2b4d[_0xd56b('0x6b')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')]('no\x20apiKey\x20configured');}if(!this[_0xd56b('0x91')](_0x1e2b4d[_0xd56b('0x6c')])){return this['channel']['noop'](_0xd56b('0xd8'));}this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x1c1'),_0x1e2b4d['text']));var _0x2db784=this['googleCloudTTS'][_0xd56b('0xb3')](this,_0x1e2b4d);if(_0x2db784){this['channel']['noop'](util[_0xd56b('0x2b')](_0xd56b('0x1c2'),_0x2db784));var _0x22c1ca=this['channel']['streamFile'](_0x2db784);try{fs[_0xd56b('0x102')](_0x2db784+_0xd56b('0x103'));}catch(_0x195312){logger[_0xd56b('0x2e')](_0x195312);}return _0x22c1ca;}return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x1e2b4d,_0xd56b('0x1c3'));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x1c4')]=function(_0x249aae){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x1c5'),_0x249aae[_0xd56b('0x3a')]));_0x249aae[_0xd56b('0x6c')]=_0x249aae[_0xd56b('0x6c')][_0xd56b('0x69')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd56b('0x91')](_0x249aae[_0xd56b('0x6c')])){return this[_0xd56b('0x38')][_0xd56b('0xb6')](_0xd56b('0xd8'));}this['channel'][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('Trying\x20Google\x20TTS\x20%s',_0x249aae['text']));var _0x36bfdf=this['googleTTS']['sync'](this,_0x249aae);if(_0x36bfdf){this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x1c6'),_0x36bfdf));var _0x1a56e1=this[_0xd56b('0x38')][_0xd56b('0x126')](_0x36bfdf);try{fs[_0xd56b('0x102')](_0x36bfdf+'.wav');}catch(_0x48390f){logger[_0xd56b('0x2e')](_0x48390f);}return _0x1a56e1;}return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x249aae,_0xd56b('0x1c7'));};AGIVertices[_0xd56b('0x17')]['unpause']=function(_0x2aac15){logger[_0xd56b('0x30')](util['format'](_0xd56b('0x1c8'),_0x2aac15[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x2aac15[_0xd56b('0x15b')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x2aac15,_0xd56b('0x15c'));}logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x15d'),this['channel'][_0xd56b('0x3e')],_0x2aac15[_0xd56b('0x15b')]));var _0xbbff75=this[_0xd56b('0x64')][_0xd56b('0xb3')](this,_0x2aac15[_0xd56b('0x15b')]);if(_0xbbff75){logger[_0xd56b('0x30')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd56b('0x38')]['callerid'],_0x2aac15['findBy']));this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd56b('0x38')][_0xd56b('0x3e')],_0x2aac15[_0xd56b('0x15b')]));return{'code':0xc8,'result':_0xd56b('0x15f')};}else{logger[_0xd56b('0x30')](util[_0xd56b('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd56b('0x38')]['callerid'],_0x2aac15[_0xd56b('0x15b')]));this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0x160'),this[_0xd56b('0x38')]['callerid'],_0x2aac15[_0xd56b('0x15b')]));return{'code':0xc8,'result':_0xd56b('0x161')};}};AGIVertices['prototype']['voicemail']=function(_0x4157f1){logger['info'](util[_0xd56b('0x2b')](_0xd56b('0x1c9'),_0x4157f1[_0xd56b('0x3a')]));var _0x5afb79=this[_0xd56b('0x38')][_0xd56b('0xb7')](_0xd56b('0x1ca'),[_0x4157f1['mailbox'],_0x4157f1[_0xd56b('0x88')]]);if(_0x5afb79[_0xd56b('0xb0')]===-0x1){return _0x5afb79;}return this[_0xd56b('0x38')][_0xd56b('0xb6')](util[_0xd56b('0x2b')](_0xd56b('0xd5'),_0xd56b('0x1ca'),_0x4157f1['mailbox']));};AGIVertices[_0xd56b('0x17')][_0xd56b('0x1cb')]=function(_0x46d8c7){logger[_0xd56b('0x30')](util[_0xd56b('0x2b')](_0xd56b('0x1cc'),_0x46d8c7[_0xd56b('0x3a')]));if(!this[_0xd56b('0x91')](_0x46d8c7[_0xd56b('0xe8')])){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x46d8c7,'no\x20variable\x20selected');}var _0x3b928b=this[_0xd56b('0x12')]['sync'](this,_0x46d8c7[_0xd56b('0xe8')]);if(!_0x3b928b){return this[_0xd56b('0x38')][_0xd56b('0x2e')](_0x46d8c7,_0xd56b('0xe9'));}var _0x2be79c=this[_0xd56b('0x38')]['getVariable'](_0x3b928b);return{'code':0xc8,'result':_0x2be79c[_0xd56b('0xac')]?_0x2be79c[_0xd56b('0xac')]:'-'};};String[_0xd56b('0x17')][_0xd56b('0x1cd')]=function(_0x1befcc,_0xdf15d6){return this[_0xd56b('0xaa')](_0x1befcc)['join'](_0xdf15d6);};module[_0xd56b('0x1ce')]=AGIVertices; \ No newline at end of file +var _0xbffa=['context','extension','priority','accountcode','dnid','createSquareMessage','log','in\x20createcmcontact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','RES1','timezones','minutestoadd','scheduledat\x20before','scheduledat','add','minutes','scheduledat\x20after','insertContact','utcOffset','createCmContact','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','format','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceall\x20init','split','nextbracket','replaceall\x20end','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','label','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','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','wait','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','odbc_id','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','appsecret','beep','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','QUEUE','gosub','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','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','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','join','exports','util','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','rpc','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording'];(function(_0x57b80f,_0x1c5b14){var _0x11b781=function(_0xda3c1d){while(--_0xda3c1d){_0x57b80f['push'](_0x57b80f['shift']());}};_0x11b781(++_0x1c5b14);}(_0xbffa,0x189));var _0xabff=function(_0x1d792f,_0x4cc4df){_0x1d792f=_0x1d792f-0x0;var _0x68ea73=_0xbffa[_0x1d792f];return _0x68ea73;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xabff('0x0'));var _=require('lodash');var sh=require(_0xabff('0x1'));var odbc=require('odbc')();var rs=require(_0xabff('0x2'));var moment=require(_0xabff('0x3'));var Mustache=require(_0xabff('0x4'));var rp=require(_0xabff('0x5'));var logger=require(_0xabff('0x6'))('agi');var config=require(_0xabff('0x7'));var shared=require(_0xabff('0x8'));var scripts=require(_0xabff('0x9'));var FILES_PATH=_0xabff('0xa');var recursiveMapAttributes=[_0xabff('0xb'),_0xabff('0xc')];var verticesWithRetry=[_0xabff('0xd'),_0xabff('0xe'),_0xabff('0xf')];var AGIVertices=function(_0x184a65,_0x16059e,_0x555e6c){this[_0xabff('0x10')]=_0x184a65;this['rpc']=_0x16059e;this[_0xabff('0x11')]=_0x555e6c;};AGIVertices[_0xabff('0x12')][_0xabff('0x13')]=function(_0x1e738c,_0x46856c){this['rpc']['getVariableById'](_0x1e738c)[_0xabff('0x14')](function(_0x1abc40){_0x46856c(null,_0x1abc40?_0x1abc40[_0xabff('0x15')]:![]);})[_0xabff('0x16')](function(_0x1d72ed){_0x46856c(_0x1d72ed);});};AGIVertices['prototype'][_0xabff('0x17')]=function(_0x5b54cc,_0x2a4d99){this[_0xabff('0x18')][_0xabff('0x19')](_0x5b54cc)[_0xabff('0x14')](function(_0x216612){_0x2a4d99(null,_0x216612?_0x216612[_0xabff('0x15')]:![]);})[_0xabff('0x16')](function(_0x25ebf6){_0x2a4d99(_0x25ebf6);});};AGIVertices[_0xabff('0x12')][_0xabff('0x1a')]=function(_0x9e1ba0,_0x5b9ae0){this[_0xabff('0x18')][_0xabff('0x1b')](_0x9e1ba0)[_0xabff('0x14')](function(_0x5e4174){_0x5b9ae0(null,_0x5e4174?_0x5e4174[_0xabff('0x15')]:![]);})[_0xabff('0x16')](function(_0x1d6ed1){_0x5b9ae0(_0x1d6ed1);});};AGIVertices['prototype'][_0xabff('0x1c')]=function(_0x440701,_0x448abe){this[_0xabff('0x18')][_0xabff('0x1d')](_0x440701)[_0xabff('0x14')](function(_0x7327be){_0x448abe(null,_0x7327be?_0x7327be[_0xabff('0x1e')]:![]);})[_0xabff('0x16')](function(_0x38e424){_0x448abe(_0x38e424);});};AGIVertices[_0xabff('0x12')][_0xabff('0x1f')]=function(_0xe0ca37,_0x40f60c){this['rpc'][_0xabff('0x20')](_0xe0ca37)[_0xabff('0x14')](function(_0x263078){_0x40f60c(null,_0x263078?_0x263078[_0xabff('0x15')]:![]);})['catch'](function(_0x1e2f5a){_0x40f60c(_0x1e2f5a);});};AGIVertices[_0xabff('0x12')]['getTrunk']=function(_0x1bd29e,_0x584ad2){this[_0xabff('0x18')][_0xabff('0x21')](_0x1bd29e)['then'](function(_0x3b5332){_0x584ad2(null,_0x3b5332?_0x3b5332[_0xabff('0x15')]:![]);})['catch'](function(_0x5b409b){_0x584ad2(_0x5b409b);});};AGIVertices[_0xabff('0x12')][_0xabff('0x22')]=function(_0x9871f6,_0x536f23){var _0x5ce0cd=this;this[_0xabff('0x18')][_0xabff('0x23')](_0x9871f6)[_0xabff('0x14')](function(_0x26040f){_0x536f23(null,_0x26040f?_0x5ce0cd['getSoundPath'](_0x26040f[_0xabff('0x24')]):![]);})[_0xabff('0x16')](function(_0x5e274a){_0x536f23(_0x5e274a);});};AGIVertices['prototype'][_0xabff('0x25')]=function(_0x245e40,_0x5bb14c){this[_0xabff('0x18')][_0xabff('0x26')](_0x245e40)[_0xabff('0x14')](function(_0x2790ce){_0x5bb14c(null,_0x2790ce?_0x2790ce:![]);})[_0xabff('0x16')](function(_0x3f95b6){_0x5bb14c(_0x3f95b6);});};AGIVertices['prototype'][_0xabff('0x27')]=function(_0x2b52e5,_0x4b8898,_0x118f99){this[_0xabff('0x11')]['sendMailMessage'](_0x2b52e5,_0x4b8898)[_0xabff('0x14')](function(){_0x118f99(null);})[_0xabff('0x16')](function(_0x2f9f8d){_0x118f99(_0x2f9f8d);});};AGIVertices['prototype'][_0xabff('0x28')]=function(_0x2a7248,_0x3a0595){this[_0xabff('0x18')]['getIntervalById'](_0x2a7248)[_0xabff('0x14')](function(_0x342252){if(_0x342252){if(_0x342252[_0xabff('0x29')]){_0x3a0595(null,[_0x342252['interval']]);}else{_0x3a0595(null,_[_0xabff('0x2a')](_0x342252[_0xabff('0x2b')],_0xabff('0x2c')));}}else{_0x3a0595(null,![]);}})['catch'](function(_0x5dc38e){_0x3a0595(_0x5dc38e);});};AGIVertices[_0xabff('0x12')]['getSoundPath']=function(_0x290711){return util['format'](_0xabff('0x2d'),FILES_PATH,_0x290711);};AGIVertices['prototype'][_0xabff('0x2e')]=function(_0x4d41d6,_0x512f03,_0x47a04b){odbc[_0xabff('0x2f')](_0x4d41d6,function(_0x581159){if(_0x581159){logger[_0xabff('0x30')](_0xabff('0x31'),_0x581159);_0x47a04b(_0x581159);}else{logger['info'](_0xabff('0x32'));odbc[_0xabff('0x33')](_0x512f03,function(_0xb79bcd,_0x472504){if(_0xb79bcd){logger[_0xabff('0x34')](_0xabff('0x35'),_0x512f03);_0x47a04b(_0xb79bcd);}else{logger[_0xabff('0x34')]('Query\x20executed\x20correctly\x20%s',_0x512f03);odbc['close'](function(_0x30144f){if(_0x30144f){logger[_0xabff('0x30')](_0xabff('0x36'),_0x30144f);}_0x47a04b(null,_0x472504);});}});}});};AGIVertices[_0xabff('0x12')][_0xabff('0x37')]=function(_0x31d816,_0x45c6a7){this[_0xabff('0x18')]['getSmsAccountById'](_0x31d816)['then'](function(_0x2d1826){_0x45c6a7(null,_0x2d1826?_0x2d1826:![]);})[_0xabff('0x16')](function(_0x383b57){_0x45c6a7(_0x383b57);});};AGIVertices[_0xabff('0x12')][_0xabff('0x38')]=function(_0x5c0b42,_0x580ffd){this[_0xabff('0x18')][_0xabff('0x38')](_0x5c0b42)[_0xabff('0x14')](function(_0x5d2c84){_0x580ffd(null,_0x5d2c84);})[_0xabff('0x16')](function(_0x1bb23f){_0x580ffd(_0x1bb23f);});};AGIVertices['prototype'][_0xabff('0x39')]=function(_0x4db709,_0x2c91cc,_0x16fbac){this['rpc'][_0xabff('0x39')]({'uniqueid':this[_0xabff('0x10')][_0xabff('0x3a')],'node':_0x4db709['label'],'application':_0x4db709[_0xabff('0x3b')],'data':_0x2c91cc||null,'project_name':this['channel'][_0xabff('0x3c')],'callerid':this[_0xabff('0x10')][_0xabff('0x3d')]})[_0xabff('0x14')](function(_0x56f458){if(_0x16fbac){_0x16fbac(null,_0x56f458);}})[_0xabff('0x16')](function(_0x2be524){if(_0x16fbac){_0x16fbac(_0x2be524);}});};AGIVertices[_0xabff('0x12')][_0xabff('0x3e')]=function(_0x2b1229,_0x29f3c5,_0x345202,_0x149e30){this[_0xabff('0x18')][_0xabff('0x3e')]({'uniqueid':this[_0xabff('0x10')][_0xabff('0x3a')],'callerid':this['channel'][_0xabff('0x3d')],'calleridname':this[_0xabff('0x10')]['calleridname'],'context':this['channel'][_0xabff('0x3f')],'extension':this[_0xabff('0x10')][_0xabff('0x40')],'priority':this[_0xabff('0x10')][_0xabff('0x41')],'accountcode':this[_0xabff('0x10')][_0xabff('0x42')],'dnid':this['channel'][_0xabff('0x43')],'projectName':this[_0xabff('0x10')]['arg_1'],'saveName':_0x29f3c5,'filename':_0x2b1229['file']||_0x29f3c5,'savePath':_0x345202})['then'](function(_0x218fb5){_0x149e30(null,_0x218fb5);})[_0xabff('0x16')](function(_0x14f3bd){_0x149e30(_0x14f3bd);});};AGIVertices[_0xabff('0x12')][_0xabff('0x44')]=function(_0x535aeb,_0x12d357,_0x26cba1){this[_0xabff('0x18')]['createSquareMessage']({'uniqueid':this[_0xabff('0x10')][_0xabff('0x3a')],'body':_0x535aeb,'direction':_0x12d357})['then'](function(_0x19be98){if(_0x26cba1){_0x26cba1(null,_0x19be98);}})[_0xabff('0x16')](function(_0x41729f){if(_0x26cba1){_0x26cba1(_0x41729f);}});};AGIVertices[_0xabff('0x12')]['createCmContact']=function(_0x286755,_0xc5ab8){console[_0xabff('0x45')](_0xabff('0x46'),_0x286755);console[_0xabff('0x45')]('in\x20createcmcontact\x20callback',_0xc5ab8);var _0xcf330f=this;var _0x2552da=0x0;var _0x176bd7={'firstName':_[_0xabff('0x47')](_0x286755[_0xabff('0x15')])||_[_0xabff('0x48')](_0x286755['name'])?_0xabff('0x49')+Math[_0xabff('0x4a')]():_0x286755[_0xabff('0x15')],'lastName':_['isEmpty'](_0x286755[_0xabff('0x4b')])||_[_0xabff('0x48')](_0x286755['lastName'])?null:_0x286755[_0xabff('0x4b')],'phone':_0x286755[_0xabff('0x4c')],'ListId':_0x286755[_0xabff('0x4d')],'scheduledat':_0x286755[_0xabff('0x4e')],'callbackUniqueid':this['channel'][_0xabff('0x3a')],'tags':_0xabff('0x4f'),'description':_0xabff('0x50')+_0x286755['scheduledAt'][_0xabff('0x51')](),'priority':_0x286755[_0xabff('0x52')]};if(_[_0xabff('0x53')](_0x286755,_0xabff('0x54'))){if(!_[_0xabff('0x48')](_0x286755['dialTimezone'])){var _0x528ad6=_0x286755[_0xabff('0x54')];console[_0xabff('0x45')]('VALUE\x20TZ',_0x528ad6);if(_0x286755['dialTimezone']==_0xabff('0x55')){this['rpc'][_0xabff('0x56')]({'phone':_0x286755[_0xabff('0x4c')]})[_0xabff('0x14')](function(_0x3a02d6){console[_0xabff('0x45')](_0xabff('0x57'),_0x3a02d6);if(!_['isNil'](_0x3a02d6)){var _0x51622d=_0x3a02d6[_0xabff('0x54')];console[_0xabff('0x45')]('dialtimezone',_0x51622d);if(!_[_0xabff('0x48')](_0x51622d)){var _0x506687=shared[_0xabff('0x58')][_0x51622d];console['log']('tz',_0x506687);if(!_['isNil'](_0x506687)){var _0x2c3fdd=-0x1*_0x506687['utcOffset'];console['log'](_0xabff('0x59'),_0x2c3fdd);console[_0xabff('0x45')](_0xabff('0x5a'),_0x176bd7['scheduledat']);_0x176bd7[_0xabff('0x5b')]=moment(_0x286755[_0xabff('0x5b')])[_0xabff('0x5c')](_0x2c3fdd,_0xabff('0x5d'));console[_0xabff('0x45')](_0xabff('0x5e'),_0x176bd7[_0xabff('0x5b')]);_0xcf330f[_0xabff('0x5f')](_0x176bd7,_0x286755,_0xc5ab8);}else{_0xcf330f[_0xabff('0x5f')](_0x176bd7,_0x286755,_0xc5ab8);}}else{_0xcf330f['insertContact'](_0x176bd7,_0x286755,_0xc5ab8);}}else{_0xcf330f[_0xabff('0x5f')](_0x176bd7,_0x286755,_0xc5ab8);}});}else{var _0x2552da=shared['timezones'][_0x528ad6];if(!_[_0xabff('0x48')](_0x2552da)){var _0x35f838=-0x1*_0x2552da[_0xabff('0x60')];_0x176bd7[_0xabff('0x5b')]=moment(_0x286755[_0xabff('0x5b')])['add'](_0x35f838,'minutes');_0xcf330f[_0xabff('0x5f')](_0x176bd7,_0x286755,_0xc5ab8);}else{_0xcf330f[_0xabff('0x5f')](_0x176bd7,_0x286755,_0xc5ab8);}}}else{_0xcf330f[_0xabff('0x5f')](_0x176bd7,_0x286755,_0xc5ab8);}}else{_0xcf330f['insertContact'](_0x176bd7,_0x286755,_0xc5ab8);}};AGIVertices[_0xabff('0x12')][_0xabff('0x5f')]=function(_0x26c832,_0x314fba,_0x2c8af5){this[_0xabff('0x18')][_0xabff('0x61')](_0x26c832)['then'](function(_0x50b9a3){_0x2c8af5(null,_0x50b9a3);})[_0xabff('0x16')](function(_0x2a9fb3){_0x2c8af5(_0x2a9fb3);});};AGIVertices[_0xabff('0x12')][_0xabff('0x62')]=function(_0x39914e,_0x451822){this[_0xabff('0x18')][_0xabff('0x63')](_0x39914e)[_0xabff('0x14')](function(_0x3856d8){_0x451822(null,_0x3856d8?_0x3856d8[_0xabff('0x15')]:![]);})[_0xabff('0x16')](function(_0x3a8858){_0x451822(_0x3a8858);});};AGIVertices[_0xabff('0x12')][_0xabff('0x64')]=function(_0x17ae44,_0x20c858,_0x4f4bd2){var _0x35de6d={'role':_0xabff('0x65')};_0x35de6d[_0x17ae44]=this[_0xabff('0x10')][_0xabff('0x3d')];this['rpc'][_0xabff('0x64')](_0x35de6d,_0x20c858,this[_0xabff('0x10')][_0xabff('0x3a')])[_0xabff('0x14')](function(_0x31e3de){_0x4f4bd2(null,_[_0xabff('0x48')](_0x31e3de)?![]:!![]);})['catch'](function(_0x5e1870){logger['error'](_0x5e1870);_0x4f4bd2(null,![]);});};AGIVertices[_0xabff('0x12')][_0xabff('0x66')]=function(_0x5d8e6d,_0x4bb4b2){var _0x1db830={'role':'agent'};_0x1db830[_0x5d8e6d]=this[_0xabff('0x10')][_0xabff('0x3d')];this[_0xabff('0x18')][_0xabff('0x66')](_0x1db830)['then'](function(_0x4fae68){_0x4bb4b2(null,_[_0xabff('0x48')](_0x4fae68)?![]:!![]);})[_0xabff('0x16')](function(_0x3811aa){logger[_0xabff('0x30')](_0x3811aa);_0x4bb4b2(null,![]);});};AGIVertices[_0xabff('0x12')][_0xabff('0x67')]=function(_0x219061,_0x5ba0cd){var _0x38fbe4={'role':'agent'};_0x38fbe4[_0x219061]=this['channel']['callerid'];this[_0xabff('0x18')][_0xabff('0x67')](_0x38fbe4)[_0xabff('0x14')](function(_0x4b826d){_0x5ba0cd(null,_[_0xabff('0x48')](_0x4b826d)?![]:!![]);})[_0xabff('0x16')](function(_0x2b1d91){logger[_0xabff('0x30')](_0x2b1d91);_0x5ba0cd(null,![]);});};AGIVertices[_0xabff('0x12')]['agentLogin']=function(_0x34d19e,_0x337d1f){var _0x1c219a={'role':_0xabff('0x65')};_0x1c219a[_0x34d19e]=this[_0xabff('0x10')][_0xabff('0x3d')];var _0x2bc72e=_0x34d19e!=_0xabff('0x68')?util[_0xabff('0x69')]('%s/%s@from-sip/n',_0xabff('0x6a'),this[_0xabff('0x10')]['callerid']):undefined;this[_0xabff('0x18')][_0xabff('0x6b')](_0x1c219a,_0x2bc72e)[_0xabff('0x14')](function(_0x5338b3){_0x337d1f(null,_['isNil'](_0x5338b3)?![]:!![]);})['catch'](function(_0x4a85b0){logger['error'](_0x4a85b0);_0x337d1f(null,![]);});};AGIVertices['prototype'][_0xabff('0x6c')]=function(_0x563d78,_0x2c9051){sh[_0xabff('0x6d')](_[_0xabff('0x6e')](_0x563d78),function(_0x2ee8c1,_0x2edf1e){var _0x3d6787=_0x2edf1e[_0xabff('0x6f')](/(\r\n|\n|\r)/gm,'');_0x2c9051(null,_0x3d6787);});};AGIVertices[_0xabff('0x12')][_0xabff('0x70')]=function(_0x50dc1c,_0x9cfc5b){scripts[_0xabff('0x70')](_0x50dc1c[_0xabff('0x71')],_0x50dc1c['google_cloud_tts_text_type']||_0xabff('0x72'),_0x50dc1c[_0xabff('0x72')],_0x50dc1c[_0xabff('0x73')]||'en-US',_0x50dc1c['ssmlGender']||_0xabff('0x74'),_0x50dc1c['audioEncoding']||'MP3')[_0xabff('0x14')](function(_0x4639f0){_0x9cfc5b(null,_0x4639f0);})[_0xabff('0x16')](function(_0xe25737){_0x9cfc5b(_0xe25737);});};AGIVertices[_0xabff('0x12')][_0xabff('0x75')]=function(_0x435331,_0x3c772a){scripts[_0xabff('0x75')](_0x435331['text'],_0x435331[_0xabff('0x76')]||'en',0x1)[_0xabff('0x14')](function(_0x739fbc){_0x3c772a(null,_0x739fbc);})[_0xabff('0x16')](function(_0x30f654){_0x3c772a(_0x30f654);});};AGIVertices[_0xabff('0x12')][_0xabff('0x77')]=function(_0x2f5966,_0x56cd66){var _0x424b8e={'uri':_0x2f5966[_0xabff('0x78')],'method':_0x2f5966[_0xabff('0x79')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2f5966[_0xabff('0x7a')])===_0xabff('0x7b')&&parseInt(_0x2f5966['timeout'])>=0x1?parseInt(_0x2f5966[_0xabff('0x7a')])*0x3e8:0x5*0x3e8};if(_[_0xabff('0x7c')]([_0xabff('0x7d'),'PUT'],_0x424b8e[_0xabff('0x79')][_0xabff('0x7e')]())){try{_0x424b8e[_0xabff('0x7f')]=_0x2f5966[_0xabff('0xc')]?JSON[_0xabff('0x80')](_0x2f5966[_0xabff('0xc')]):{};}catch(_0x3bdbde){logger[_0xabff('0x30')](_0xabff('0x81'),_0x3bdbde);}}try{_0x424b8e[_0xabff('0x82')]=_0x2f5966[_0xabff('0xb')]?JSON[_0xabff('0x80')](_0x2f5966['rawHeaders']):{};}catch(_0x136116){logger[_0xabff('0x30')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x136116);}if(_0x2f5966[_0xabff('0x83')]){try{var _0x2d84d1=require(_0x2f5966[_0xabff('0x83')])[_0xabff('0x84')](this,_0x424b8e);_0x424b8e[_0xabff('0x85')]=Mustache[_0xabff('0x86')](_0x2f5966[_0xabff('0x78')],_0x2d84d1,{},['$$','$$']);if(_0x424b8e['headers']){_0x424b8e[_0xabff('0x82')]=JSON[_0xabff('0x80')](Mustache[_0xabff('0x86')](JSON[_0xabff('0x87')](_0x424b8e[_0xabff('0x82')]),_0x2d84d1,{},['$$','$$']));}if(_0x424b8e[_0xabff('0x7f')]){_0x424b8e['body']=JSON[_0xabff('0x80')](Mustache[_0xabff('0x86')](JSON[_0xabff('0x87')](_0x424b8e[_0xabff('0x7f')]),_0x2d84d1,{},['$$','$$']));}}catch(_0x5c698a){logger['error'](_0xabff('0x88'),_0x5c698a);}}rp(_0x424b8e)[_0xabff('0x14')](function(_0x37ea46){var _0x1db997={'statusCode':_0x37ea46[_0xabff('0x89')]||0xc8,'statusMessage':_0x37ea46[_0xabff('0x8a')]||'OK','headers':_0x37ea46['headers']||{},'body':_0x37ea46[_0xabff('0x7f')]||{}};_0x56cd66(null,_0x1db997);})[_0xabff('0x16')](function(_0x4948f7){var _0x280fa9={'statusCode':_0x4948f7['statusCode']||0x1f4,'statusMessage':_0x4948f7[_0xabff('0x8b')]||_0xabff('0x8c'),'headers':_0x4948f7[_0xabff('0x8d')][_0xabff('0x82')]||{},'body':_0x4948f7['options']['body']||{}};_0x56cd66(null,_0x280fa9);});};AGIVertices[_0xabff('0x12')]['googleDialogflow']=function(_0xa2f6c,_0x24e238){scripts[_0xabff('0x8e')](this[_0xabff('0x10')]['uniqueid'],_0xa2f6c[_0xabff('0x8f')],_0xa2f6c[_0xabff('0x72')],_0xa2f6c[_0xabff('0x90')]||'en')[_0xabff('0x14')](function(_0x353614){_0x24e238(null,_0x353614);})[_0xabff('0x16')](function(_0x3b7ebf){_0x24e238(_0x3b7ebf);});};AGIVertices['prototype'][_0xabff('0x91')]=function(_0xa53a6e,_0x546fdd){scripts[_0xabff('0x91')](this['channel'],_0xa53a6e)[_0xabff('0x14')](function(_0x54c089){_0x546fdd(null,_0x54c089);})[_0xabff('0x16')](function(_0x266219){_0x546fdd(_0x266219);});};AGIVertices[_0xabff('0x12')][_0xabff('0x92')]=function(_0x2c0006,_0x2dcd49){scripts[_0xabff('0x92')](_0x2c0006['key'],_0x2c0006[_0xabff('0x72')],_0x2c0006['ispeech_tts_language']||_0xabff('0x93'),_0x2c0006[_0xabff('0x94')])['then'](function(_0x4e4825){_0x2dcd49(null,_0x4e4825);})[_0xabff('0x16')](function(_0x5e6232){_0x2dcd49(_0x5e6232);});};AGIVertices[_0xabff('0x12')][_0xabff('0x95')]=function(_0x1fe464,_0x27b495,_0x95e23f){scripts[_0xabff('0x95')](_0x27b495,_0x1fe464['key'],_0x1fe464[_0xabff('0x96')]||_0xabff('0x93'),this[_0xabff('0x97')](_0x1fe464[_0xabff('0x98')])?_0x1fe464['model']:undefined)[_0xabff('0x14')](function(_0x56359e){_0x95e23f(null,_0x56359e);})[_0xabff('0x16')](function(_0xb05d3c){_0x95e23f(_0xb05d3c);});};AGIVertices[_0xabff('0x12')][_0xabff('0x99')]=function(_0x91c11,_0x52e24a){scripts[_0xabff('0x99')](_0x91c11[_0xabff('0x9a')],_0x91c11[_0xabff('0x9b')],_0x91c11[_0xabff('0x9c')],_0x91c11[_0xabff('0x9d')]||'Amy',_0x91c11[_0xabff('0x72')],_0x91c11[_0xabff('0x9e')]||_0xabff('0x72'))[_0xabff('0x14')](function(_0x17c81c){_0x52e24a(null,_0x17c81c);})[_0xabff('0x16')](function(_0x368972){_0x52e24a(_0x368972);});};AGIVertices[_0xabff('0x12')][_0xabff('0x9f')]=function(_0x120779,_0x3fb7e7){scripts[_0xabff('0x9f')](this['channel'][_0xabff('0x3a')],_0x120779[_0xabff('0x9a')],_0x120779['aws_secret_access_key'],_0x120779[_0xabff('0xa0')],_0x120779['text'],_0x120779[_0xabff('0xa1')])[_0xabff('0x14')](function(_0x4fc77b){_0x3fb7e7(null,_0x4fc77b);})['catch'](function(_0xbd4c29){_0x3fb7e7(_0xbd4c29);});};AGIVertices[_0xabff('0x12')][_0xabff('0xa2')]=function(_0x5b6a90,_0x128259,_0x3fb94c){scripts['googleASR'](_0x128259,_0x5b6a90[_0xabff('0x8f')],_0x5b6a90[_0xabff('0xa3')]||_0xabff('0x93'))[_0xabff('0x14')](function(_0x33060e){_0x3fb94c(null,_0x33060e);})[_0xabff('0x16')](function(_0x19f8b3){_0x3fb94c(_0x19f8b3);});};AGIVertices[_0xabff('0x12')][_0xabff('0xa4')]=function(_0x34d66a,_0x2e0146,_0x257383){scripts[_0xabff('0xa4')](_0x2e0146,_0x34d66a[_0xabff('0xa5')],_0x34d66a['appsecret'],_0x34d66a[_0xabff('0x85')])['then'](function(_0x31a8ce){_0x257383(null,_0x31a8ce);})[_0xabff('0x16')](function(_0x532f3c){_0x257383(_0x532f3c);});};AGIVertices[_0xabff('0x12')][_0xabff('0xa6')]=function(_0x36bb5d){var _0x28ae3e=_[_0xabff('0x7c')](verticesWithRetry,_0x36bb5d[_0xabff('0x3b')])?_0x36bb5d:_[_0xabff('0xa7')](_0x36bb5d);for(var _0x257922 in _0x28ae3e){if(_0x28ae3e[_0xabff('0xa8')](_0x257922)){if(_0x28ae3e[_0x257922]&&_[_0xabff('0xa9')](_0x28ae3e[_0x257922])){if(_['includes'](recursiveMapAttributes,_0x257922)){_0x28ae3e[_0x257922]=this[_0xabff('0xaa')](_0x28ae3e[_0x257922]);}else{_0x28ae3e[_0x257922]=this[_0xabff('0xab')](_0x28ae3e[_0x257922]);}}}}return _0x28ae3e;};AGIVertices[_0xabff('0x12')][_0xabff('0xac')]=function(_0x39f72e){for(var _0x509631 in _0x39f72e){if(_0x39f72e['hasOwnProperty'](_0x509631)){if(_[_0xabff('0xad')](_0x39f72e[_0x509631])){this['recursiveNodeIndex'](_0x39f72e[_0x509631]);}else if(_[_0xabff('0xae')](_0x39f72e[_0x509631])){for(var _0x45a40f=0x0;_0x45a40f<_0x39f72e[_0x509631][_0xabff('0xaf')];_0x45a40f++){this['recursiveNodeIndex'](_0x39f72e[_0x509631][_0x45a40f]);}}else if(_['isString'](_0x39f72e[_0x509631])){_0x39f72e[_0x509631]=this[_0xabff('0xab')](_0x39f72e[_0x509631]);}}}};AGIVertices[_0xabff('0x12')]['saveRestApiResult']=function(_0xb9ce3b,_0x526802){for(var _0x335da7 in _0xb9ce3b){if(_0xb9ce3b[_0xabff('0xa8')](_0x335da7)){if(_['isPlainObject'](_0xb9ce3b[_0x335da7])){if(!_['isEmpty'](_0xb9ce3b[_0x335da7])){this[_0xabff('0xb0')](_0xb9ce3b[_0x335da7],util[_0xabff('0x69')](_0xabff('0xb1'),_0x526802,_0x335da7));}}else if(_[_0xabff('0xae')](_0xb9ce3b[_0x335da7])){for(var _0x236510=0x0;_0x236510<_0xb9ce3b[_0x335da7][_0xabff('0xaf')];_0x236510++){this[_0xabff('0xb0')](_0xb9ce3b[_0x335da7][_0x236510],util[_0xabff('0x69')]('%s.%s',_0x526802,_0x335da7+'['+_0x236510+']'));}}else{if(!_[_0xabff('0x48')](_0xb9ce3b[_0x335da7])){this['channel'][_0xabff('0xb2')](util[_0xabff('0x69')](_0xabff('0xb1'),_0x526802,_0x335da7),_0xb9ce3b[_0x335da7]);}}}}};AGIVertices[_0xabff('0x12')][_0xabff('0xaa')]=function(_0x4fec6c){try{var _0x129f8b=JSON[_0xabff('0x80')](_0x4fec6c);this['recursiveNodeIndex'](_0x129f8b);return JSON['stringify'](_0x129f8b);}catch(_0x2b18d2){return this['replaceAllVariables'](_0x4fec6c);}};AGIVertices['prototype'][_0xabff('0xab')]=function(_0x29f09c){console[_0xabff('0x45')](_0xabff('0xb3'),_0x29f09c);var _0x2abba8=_0x29f09c[_0xabff('0xb4')]('{');for(var _0x2e2155=0x1;_0x2e2155<_0x2abba8[_0xabff('0xaf')];_0x2e2155+=0x1){var _0x4327c1=_0x2abba8[_0x2e2155]['split']('}');console[_0xabff('0x45')](_0xabff('0xb5'),_0x4327c1);if(_0x4327c1[_0xabff('0xaf')]>0x1){_0x29f09c=_0x29f09c['replaceAll']('{'+_0x4327c1[0x0]+'}',this['channel']['getVariable'](_0x4327c1[0x0])['extra']||_0x4327c1[0x0]);}}if(_0x2abba8[_0xabff('0xaf')]===0x1){return _0x29f09c['toString']();}console[_0xabff('0x45')](_0xabff('0xb6'),_0x29f09c);return this[_0xabff('0xab')](_0x29f09c);};AGIVertices[_0xabff('0x12')]['getAndSetVariable']=function(_0x18f139,_0x324a1d){var _0x200c4d=this[_0xabff('0x10')][_0xabff('0x13')](_0x18f139);if(_0x200c4d[_0xabff('0xb7')]===-0x1){return _0x200c4d;}logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0xb8'),_0x324a1d,_0x200c4d[_0xabff('0xb9')]));return this[_0xabff('0x10')]['setVariable'](_0x324a1d,_0x200c4d[_0xabff('0xb9')]);};AGIVertices['prototype'][_0xabff('0x97')]=function(_0x67065b){return _0x67065b&&_0x67065b!=='0'&&_0x67065b!=='-1'&&_0x67065b!=='';};AGIVertices['prototype'][_0xabff('0xba')]=function(_0x206e26){this['createSquareDetailsReport'][_0xabff('0x84')](this,_0x206e26,'-');_0x206e26['retry']=_0x206e26[_0xabff('0xba')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x303a9d){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x303a9d[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x303a9d['text'])){return this['channel']['noop'](_0xabff('0xbc'));}var _0x1318c4='\x22'+_0x303a9d[_0xabff('0x72')]+'\x22';if(this['isConfigured'](_0x303a9d[_0xabff('0x8d')])){_0x1318c4+=','+_0x303a9d[_0xabff('0x8d')];}var _0x22e439=this['channel'][_0xabff('0x6d')](_0xabff('0xbd'),_0x1318c4);if(_0x22e439[_0xabff('0xb7')]===-0x1){return _0x22e439;}return this[_0xabff('0x10')]['noop'](util[_0xabff('0x69')](_0xabff('0xbe'),_0x1318c4));};AGIVertices[_0xabff('0x12')][_0xabff('0xbf')]=function(_0x2e0874){logger[_0xabff('0x34')](util['format'](_0xabff('0xc0'),_0x2e0874[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x2e0874[_0xabff('0xc1')])){return this['channel'][_0xabff('0xc2')]('no\x20grammar\x20configured');}var _0x5d3240=_0x2e0874[_0xabff('0xc1')];if(this[_0xabff('0x97')](_0x2e0874[_0xabff('0x8d')])){_0x5d3240+=','+_0x2e0874['options'];}var _0x7e22fa=this['channel'][_0xabff('0x6d')]('MRCPRecog',_0x5d3240);if(_0x7e22fa[_0xabff('0xb7')]===-0x1){return _0x7e22fa;}var _0x129168=this[_0xabff('0xc3')]('RECOG_CONFIDENCE()',_0xabff('0xc4'));if(_0x129168[_0xabff('0xb7')]===-0x1){return _0x129168;}var _0x175f7a=this[_0xabff('0xc3')](_0xabff('0xc5'),'MRCP_RECOG_TRANSCRIPT');if(_0x175f7a[_0xabff('0xb7')]===-0x1){return _0x175f7a;}var _0x365445=this['getAndSetVariable']('RECOG_INSTANCE()',_0xabff('0xc6'));if(_0x365445['result']===-0x1){return _0x365445;}return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0xc7'),_0x5d3240));};AGIVertices['prototype'][_0xabff('0xc8')]=function(_0x2dcc2d){logger[_0xabff('0x34')](util['format'](_0xabff('0xc9'),_0x2dcc2d[_0xabff('0xbb')]));return this[_0xabff('0x10')]['agi']([_0x2dcc2d[_0xabff('0xca')],_0x2dcc2d[_0xabff('0xcb')]]);};AGIVertices[_0xabff('0x12')][_0xabff('0xcc')]=function(_0x25c4a0){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0xcd'),_0x25c4a0['label']));if(this['isConfigured'](_0x25c4a0[_0xabff('0x7a')])){logger['info'](util[_0xabff('0x69')](_0xabff('0xce'),_0x25c4a0[_0xabff('0x7a')]));var _0x33c34f=this[_0xabff('0x10')][_0xabff('0xcf')](_0x25c4a0[_0xabff('0x7a')]);if(_0x33c34f[_0xabff('0xb7')]===-0x1){return _0x33c34f;}}return this[_0xabff('0x10')][_0xabff('0xcc')]();};AGIVertices[_0xabff('0x12')]['callback']=function(_0x39d93c){console['log'](_0xabff('0xd0'),_0x39d93c);logger['info'](util[_0xabff('0x69')](_0xabff('0xd1'),_0x39d93c[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x39d93c[_0xabff('0x4d')])){return this[_0xabff('0x10')]['error'](_0x39d93c,'no\x20list\x20selected');}_0x39d93c[_0xabff('0x4e')]=moment();if(this[_0xabff('0x97')](_0x39d93c[_0xabff('0xd2')])){_0x39d93c[_0xabff('0x4e')]=moment()[_0xabff('0x5c')](_0x39d93c['delay'],_0xabff('0x5d'));}if(!this[_0xabff('0x97')](_0x39d93c[_0xabff('0x52')])){_0x39d93c[_0xabff('0x52')]=0x2;}console['log'](_0xabff('0xd3'),_0x39d93c);this[_0xabff('0x61')]['sync'](this,_0x39d93c);return this[_0xabff('0x10')]['noop'](util[_0xabff('0x69')](_0xabff('0xd4'),_0x39d93c[_0xabff('0x4c')],_0x39d93c[_0xabff('0x4d')],_0x39d93c[_0xabff('0x4e')]));};AGIVertices[_0xabff('0x12')]['custom_app']=function(_0x12edde){logger[_0xabff('0x34')](util['format'](_0xabff('0xd5'),_0x12edde[_0xabff('0xbb')]));var _0x2e605d=this[_0xabff('0x10')][_0xabff('0x6d')](_0x12edde[_0xabff('0xd6')],_0x12edde['options']);if(_0x2e605d['result']===-0x1){return _0x2e605d;}return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0xd7'),_0x12edde[_0xabff('0xd6')],_0x12edde[_0xabff('0x8d')]));};AGIVertices[_0xabff('0x12')][_0xabff('0xd8')]=function(_0x23194b){logger['info'](util[_0xabff('0x69')](_0xabff('0xd9'),_0x23194b[_0xabff('0xbb')]));if(!this['isConfigured'](_0x23194b[_0xabff('0x72')])){return this[_0xabff('0x10')][_0xabff('0xc2')]('no\x20text\x20configured');}var _0x5ef3c9='\x22'+_0x23194b[_0xabff('0x72')]+'\x22';if(this['isConfigured'](_0x23194b['options'])){_0x5ef3c9+=','+_0x23194b[_0xabff('0x8d')];}var _0x5c6f21=this['channel'][_0xabff('0x6d')](_0xabff('0xbd'),_0x5ef3c9);if(_0x5c6f21['result']===-0x1){return _0x5c6f21;}return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5ef3c9));};AGIVertices[_0xabff('0x12')]['sestektts']=function(_0x4a77c8){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0xda'),_0x4a77c8[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x4a77c8['text'])){return this['channel'][_0xabff('0xc2')](_0xabff('0xbc'));}var _0x2d98a6='\x22'+_0x4a77c8[_0xabff('0x72')]+'\x22';if(this['isConfigured'](_0x4a77c8[_0xabff('0x8d')])){_0x2d98a6+=','+_0x4a77c8[_0xabff('0x8d')];}var _0x3f6d5d=this[_0xabff('0x10')]['exec'](_0xabff('0xbd'),_0x2d98a6);if(_0x3f6d5d[_0xabff('0xb7')]===-0x1){return _0x3f6d5d;}return this['channel'][_0xabff('0xc2')](util[_0xabff('0x69')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2d98a6));};AGIVertices[_0xabff('0x12')][_0xabff('0xdb')]=function(_0x5ede72){logger[_0xabff('0x34')](util['format'](_0xabff('0xdc'),_0x5ede72['label']));if(!this[_0xabff('0x97')](_0x5ede72[_0xabff('0xc1')])){return this[_0xabff('0x10')]['noop']('no\x20grammar\x20configured');}var _0x12d43d=_0x5ede72[_0xabff('0xc1')];if(this[_0xabff('0x97')](_0x5ede72['options'])){_0x12d43d+=','+_0x5ede72['options'];}var _0x339e7d=this[_0xabff('0x10')][_0xabff('0x6d')](_0xabff('0xdd'),_0x12d43d);if(_0x339e7d[_0xabff('0xb7')]===-0x1){return _0x339e7d;}var _0x31f505=this[_0xabff('0xc3')]('RECOG_CONFIDENCE()',_0xabff('0xde'));if(_0x31f505[_0xabff('0xb7')]===-0x1){return _0x31f505;}var _0x2d10a0=this[_0xabff('0xc3')](_0xabff('0xc5'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2d10a0[_0xabff('0xb7')]===-0x1){return _0x2d10a0;}var _0x19750f=this[_0xabff('0xc3')](_0xabff('0xdf'),_0xabff('0xe0'));if(_0x19750f[_0xabff('0xb7')]===-0x1){return _0x19750f;}return this[_0xabff('0x10')]['noop'](util['format'](_0xabff('0xc7'),_0x12d43d));};AGIVertices[_0xabff('0x12')]['sestekasr']=function(_0x18ef3a){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0xe1'),_0x18ef3a[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x18ef3a[_0xabff('0xc1')])){return this[_0xabff('0x10')]['noop']('no\x20grammar\x20configured');}var _0x810670=_0x18ef3a['grammar'];if(this[_0xabff('0x97')](_0x18ef3a[_0xabff('0x8d')])){_0x810670+=','+_0x18ef3a[_0xabff('0x8d')];}var _0x3886d0=this[_0xabff('0x10')]['exec'](_0xabff('0xdd'),_0x810670);if(_0x3886d0[_0xabff('0xb7')]===-0x1){return _0x3886d0;}var _0xb99ea6=this[_0xabff('0xc3')]('RECOG_CONFIDENCE()',_0xabff('0xe2'));if(_0xb99ea6[_0xabff('0xb7')]===-0x1){return _0xb99ea6;}var _0x5c8f29=this['getAndSetVariable'](_0xabff('0xc5'),_0xabff('0xe3'));if(_0x5c8f29['result']===-0x1){return _0x5c8f29;}var _0x388578=this[_0xabff('0xc3')](_0xabff('0xdf'),'SESTEK_ASR_INSTANCE');if(_0x388578['result']===-0x1){return _0x388578;}return this['channel']['noop'](util[_0xabff('0x69')](_0xabff('0xc7'),_0x810670));};AGIVertices['prototype'][_0xabff('0xe4')]=function(_0x316a4d){logger['info'](util[_0xabff('0x69')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x316a4d[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x316a4d[_0xabff('0xe5')])){return this['channel'][_0xabff('0x30')](_0x316a4d,'no\x20database\x20selected');}var _0x3dd83a=this[_0xabff('0x1c')][_0xabff('0x84')](this,_0x316a4d[_0xabff('0xe5')]);if(!_0x3dd83a){return this[_0xabff('0x10')]['error'](_0x316a4d,'no\x20odbc\x20database\x20found');}if(!this[_0xabff('0x97')](_0x316a4d[_0xabff('0x33')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x316a4d,_0xabff('0xe6'));}var _0x52ce25=_0x316a4d['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0xe7'),_0x52ce25));var _0x2aa351=this['getQueryOdbc']['sync'](this,_0x3dd83a,_0x52ce25);this[_0xabff('0x39')][_0xabff('0x84')](this,_0x316a4d,_0x52ce25);if(!this[_0xabff('0x97')](_0x316a4d[_0xabff('0xe8')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0xe9'));}var _0x14b71c=this[_0xabff('0x13')][_0xabff('0x84')](this,_0x316a4d[_0xabff('0xe8')]);if(!_0x14b71c){return this[_0xabff('0x10')]['error'](_0x316a4d,_0xabff('0xea'));}var _0x210fa5=this;_0x2aa351[_0xabff('0xeb')](function(_0x59bbc3,_0x560406){Object[_0xabff('0xec')](_0x59bbc3)['forEach'](function(_0x337af7){_0x210fa5[_0xabff('0x10')][_0xabff('0xb2')](util[_0xabff('0x69')]('%s[%s][%s]',_0x14b71c,_0x560406,_0x337af7),_0x59bbc3[_0x337af7]);});});this[_0xabff('0x10')][_0xabff('0xb2')](util['format'](_0xabff('0xed'),_0x14b71c),_0x2aa351[_0xabff('0xaf')]);return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')]('variable\x20%s\x20set',_0x14b71c));};AGIVertices[_0xabff('0x12')]['dial']=function(_0x554b60){logger[_0xabff('0xee')](util[_0xabff('0x69')](_0xabff('0xef'),_0x554b60[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x554b60[_0xabff('0xf0')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x554b60,_0xabff('0xf1'));}var _0x1436f1=this[_0xabff('0x1f')][_0xabff('0x84')](this,_0x554b60[_0xabff('0xf0')]);if(!_0x1436f1){return this[_0xabff('0x10')]['error'](_0x554b60,_0xabff('0xf2'));}var _0x46b569=this[_0xabff('0x10')]['exec'](_0xabff('0xf3'),[util['format']('SIP/%s',_0x1436f1),_0x554b60[_0xabff('0x7a')],_0x554b60[_0xabff('0xf4')],_0x554b60['url']]);if(_0x46b569[_0xabff('0xb7')]===-0x1){return _0x46b569;}return this[_0xabff('0x10')]['noop'](util[_0xabff('0x69')](_0xabff('0xf5'),_0xabff('0xf3')));};AGIVertices[_0xabff('0x12')][_0xabff('0xf6')]=function(_0x5d2428){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0xf7'),_0x5d2428[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x5d2428[_0xabff('0x8f')])){return this['channel'][_0xabff('0xc2')](_0xabff('0xf8'));}if(!this[_0xabff('0x97')](_0x5d2428['text'])){return this[_0xabff('0x10')][_0xabff('0xc2')]('no\x20text\x20configured');}this[_0xabff('0x10')][_0xabff('0xf9')]=!![];this[_0xabff('0x39')](_0x5d2428);this[_0xabff('0x44')](_0x5d2428[_0xabff('0x72')],'in');this['channel'][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0xfa'),_0x5d2428[_0xabff('0x72')]));var _0x5948da=this[_0xabff('0x8e')]['sync'](this,_0x5d2428);if(_0x5948da){for(var _0x2539d0 in _0x5948da){if(_0x5948da[_0xabff('0xa8')](_0x2539d0)){this['channel'][_0xabff('0xb2')](util[_0xabff('0x69')]('DIALOGFLOW_%s',_0x2539d0[_0xabff('0x7e')]()),_0x5948da[_0x2539d0]);}}this[_0xabff('0x44')](_0x5948da[_0xabff('0xfb')],_0xabff('0xfc'));return this['channel'][_0xabff('0xc2')](util[_0xabff('0x69')]('Dialogflow\x20Result\x20%s',_0x5948da[_0xabff('0xfb')]));}return this['channel'][_0xabff('0x30')](_0x5d2428,_0xabff('0xfd'));};AGIVertices['prototype']['sesteknda']=function(_0x122129){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0xfe'),_0x122129['label']));if(!this[_0xabff('0x97')](_0x122129[_0xabff('0xff')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x100'));}if(!this[_0xabff('0x97')](_0x122129[_0xabff('0x101')])){return this[_0xabff('0x10')]['noop'](_0xabff('0x102'));}if(!this[_0xabff('0x97')](_0x122129[_0xabff('0x103')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x104'));}if(!this['isConfigured'](_0x122129[_0xabff('0x105')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0xbc'));}this['channel'][_0xabff('0xf9')]=!![];this[_0xabff('0x39')](_0x122129);this['createSquareMessage'](_0x122129[_0xabff('0x72')],'in');this[_0xabff('0x10')]['noop'](util[_0xabff('0x69')]('Trying\x20SestekNDA:\x20%s',_0x122129['text']));var _0x1ef24e=this[_0xabff('0x91')][_0xabff('0x84')](this,_0x122129);if(_0x1ef24e){for(var _0x575551 in _0x1ef24e){if(_0x1ef24e[_0xabff('0xa8')](_0x575551)){this[_0xabff('0x10')][_0xabff('0xb2')](util[_0xabff('0x69')](_0xabff('0x106'),_0x575551[_0xabff('0x7e')]()),_0x1ef24e[_0x575551]);}}this[_0xabff('0x44')](_0x1ef24e[_0xabff('0xfb')],_0xabff('0xfc'));if(_0x1ef24e['audiofile']){this[_0xabff('0x10')]['noop'](util['format'](_0xabff('0x107'),_0x1ef24e[_0xabff('0x108')]));var _0x2ee3fd=this[_0xabff('0x10')][_0xabff('0x109')](_0x1ef24e[_0xabff('0x108')]);try{fs[_0xabff('0x10a')](_0x1ef24e['audiofile']+_0xabff('0x10b'));}catch(_0x3a60e7){logger['error'](_0x3a60e7);}return _0x2ee3fd;}else{return this[_0xabff('0x10')][_0xabff('0xc2')](util['format'](_0xabff('0x10c'),_0x1ef24e[_0xabff('0xfb')]));}}return this['channel'][_0xabff('0x30')](_0x122129,_0xabff('0x10d'));};AGIVertices['prototype'][_0xabff('0x10e')]=function(_0x3d2fba){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20END\x20(%s)\x20block',_0x3d2fba['label']));return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x10e'));};AGIVertices[_0xabff('0x12')][_0xabff('0x10f')]=function(_0x37e1f7){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x110'),_0x37e1f7[_0xabff('0xbb')]));var _0x3cfb38='';if(_0x37e1f7['trunk_id']){if(!this[_0xabff('0x97')](_0x37e1f7[_0xabff('0x111')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x37e1f7,_0xabff('0x112'));}else{var _0x33914e=parseInt(_0x37e1f7[_0xabff('0x111')],0xa);if(isNaN(_0x33914e)){_0x3cfb38=_0x37e1f7['trunk_id'];}else{_0x3cfb38=this[_0xabff('0x113')]['sync'](this,_0x37e1f7[_0xabff('0x111')]);if(!_0x3cfb38){return this['channel']['error'](_0x37e1f7,_0xabff('0x114'));}}}}else if(_0x37e1f7['trunk_name']){_0x3cfb38=_0x37e1f7['trunk_name'];}else{return this['channel']['error'](_0x37e1f7,_0xabff('0x112'));}var _0x4da2b8=this[_0xabff('0x10')][_0xabff('0x6d')]('DIAL',[util[_0xabff('0x69')]('SIP/%s/%s',_0x3cfb38,_0x37e1f7[_0xabff('0x4c')]),_0x37e1f7[_0xabff('0x7a')],_0x37e1f7['opts'],_0x37e1f7['url']]);if(_0x4da2b8[_0xabff('0xb7')]===-0x1){return _0x4da2b8;}return this[_0xabff('0x10')][_0xabff('0xc2')](util['format']('Executed\x20command\x20%s',_0xabff('0xf3')));};AGIVertices['prototype'][_0xabff('0x115')]=function(_0x214839){logger['info'](util[_0xabff('0x69')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x214839[_0xabff('0xbb')]));return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x115'));};AGIVertices[_0xabff('0x12')]['getdigits']=function(_0x4a8a13){logger['info'](util[_0xabff('0x69')](_0xabff('0x116'),_0x4a8a13['label']));if(_0x4a8a13[_0xabff('0x117')]===0x0){return this[_0xabff('0xba')](_0x4a8a13);}_0x4a8a13[_0xabff('0x117')]-=0x1;if(!this['isConfigured'](_0x4a8a13[_0xabff('0x118')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x4a8a13,_0xabff('0x119'));}var _0x4c2e68=this['getSound']['sync'](this,_0x4a8a13[_0xabff('0x118')]);if(!_0x4c2e68){return this[_0xabff('0x10')]['error'](_0x4a8a13,_0xabff('0x11a'));}if(!this[_0xabff('0x97')](_0x4a8a13[_0xabff('0xe8')])){return this[_0xabff('0x10')][_0xabff('0x30')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x6079fe=this[_0xabff('0x10')][_0xabff('0x11b')](_0x4c2e68,_0x4a8a13[_0xabff('0x11c')],_0x4a8a13[_0xabff('0x11d')]);var _0x4c7d26=_0x6079fe[_0xabff('0xb7')]?_0x6079fe[_0xabff('0xb7')]['toString']():'';logger[_0xabff('0x34')]('test',JSON[_0xabff('0x87')](_0x6079fe));if(_0x6079fe[_0xabff('0xb7')]===-0x1){this[_0xabff('0x39')][_0xabff('0x84')](this,_0x4a8a13,_0x4c7d26);return _0x6079fe;}else if(_0x6079fe[_0xabff('0xb9')]==='timeout'){_0x6079fe[_0xabff('0xb7')]=_0x4c7d26['length']>=parseInt(_0x4a8a13[_0xabff('0x11e')])?'x':'i';}else{_0x6079fe[_0xabff('0xb7')]=_0x4c7d26['length']>=parseInt(_0x4a8a13['mindigit'])&&_0x4c7d26['length']<=parseInt(_0x4a8a13['maxdigit'])?'x':'i';}var _0x58e9e5=this[_0xabff('0x13')][_0xabff('0x84')](this,_0x4a8a13[_0xabff('0xe8')]);if(!_0x58e9e5){return this[_0xabff('0x10')][_0xabff('0x30')](_0x4a8a13,_0xabff('0xea'));}this[_0xabff('0x10')][_0xabff('0xb2')](_0x58e9e5,_0x4c7d26);if(this[_0xabff('0x97')](_0x4a8a13[_0xabff('0x11f')])){var _0x1d39b7=parseInt(_0x4a8a13[_0xabff('0x11f')],0xa);var _0x38a95a=rs[_0xabff('0x120')]({'charset':'*','length':_0x1d39b7});var _0x58b041=_0x4c7d26[_0xabff('0xaf')];if(_0x58b041>0x0){if(_0x58b041>_0x1d39b7){this[_0xabff('0x39')][_0xabff('0x84')](this,_0x4a8a13,_0x4a8a13[_0xabff('0x121')]==='first'?_0x38a95a+_0x4c7d26[_0xabff('0x122')](_0x1d39b7):_0x4c7d26['substr'](0x0,_0x58b041-_0x1d39b7)+_0x38a95a);}else{this['createSquareDetailsReport'][_0xabff('0x84')](this,_0x4a8a13,rs[_0xabff('0x120')]({'charset':'*','length':_0x58b041}));}}else{this[_0xabff('0x39')]['sync'](this,_0x4a8a13,'');}}else{this['createSquareDetailsReport'][_0xabff('0x84')](this,_0x4a8a13,_0x4c7d26);}return _0x6079fe;};AGIVertices[_0xabff('0x12')][_0xabff('0xf')]=function(_0x371064){logger['info'](util['format'](_0xabff('0x123'),_0x371064[_0xabff('0xbb')]));return this[_0xabff('0xe')](_0x371064);};AGIVertices['prototype']['goal']=function(_0xdb7daf){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xdb7daf['label']));this[_0xabff('0x39')]['sync'](this,_0xdb7daf,_0xdb7daf[_0xabff('0x124')]);return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x125'),_0xdb7daf[_0xabff('0x124')]));};AGIVertices[_0xabff('0x12')][_0xabff('0x126')]=function(_0x2607dc){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x127'),_0x2607dc['label']));if(!this[_0xabff('0x97')](_0x2607dc[_0xabff('0x9a')])||!this[_0xabff('0x97')](_0x2607dc['aws_secret_access_key'])){return this[_0xabff('0x10')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xabff('0x97')](_0x2607dc[_0xabff('0x72')])){return this['channel']['noop'](_0xabff('0xbc'));}this[_0xabff('0x10')][_0xabff('0xc2')](util['format'](_0xabff('0x128'),_0x2607dc['text']));var _0x49aa1e=this['awsPolly'][_0xabff('0x84')](this,_0x2607dc);if(_0x49aa1e){this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')]('aws\x20Polly\x20%s\x20file\x20created',_0x49aa1e));var _0xc117a6=this[_0xabff('0x10')][_0xabff('0x109')](_0x49aa1e);try{fs['unlink'](_0x49aa1e+_0xabff('0x10b'));}catch(_0x5aac05){logger[_0xabff('0x30')](_0x5aac05);}return _0xc117a6;}return this[_0xabff('0x10')]['error'](_0x2607dc,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xabff('0x12')][_0xabff('0x129')]=function(_0x5bf0a5){logger['info'](util[_0xabff('0x69')](_0xabff('0x12a'),_0x5bf0a5[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x5bf0a5[_0xabff('0x9a')])||!this['isConfigured'](_0x5bf0a5[_0xabff('0x9b')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x12b'));}if(!this[_0xabff('0x97')](_0x5bf0a5[_0xabff('0xa1')])){return this['channel'][_0xabff('0xc2')](_0xabff('0x12c'));}if(!this['isConfigured'](_0x5bf0a5['text'])){return this['channel'][_0xabff('0xc2')](_0xabff('0xbc'));}this[_0xabff('0x10')]['bot']=!![];this[_0xabff('0x39')](_0x5bf0a5);this['createSquareMessage'](_0x5bf0a5[_0xabff('0x72')],'in');this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')]('Trying\x20Amazon\x20Lex:\x20%s',_0x5bf0a5[_0xabff('0x72')]));var _0x41cea9=this[_0xabff('0x9f')][_0xabff('0x84')](this,_0x5bf0a5);if(_0x41cea9){for(var _0x251fcb in _0x41cea9){if(_0x41cea9[_0xabff('0xa8')](_0x251fcb)&&_['isString'](_0x41cea9[_0x251fcb])){this[_0xabff('0x10')][_0xabff('0xb2')](util[_0xabff('0x69')](_0xabff('0x12d'),_0x251fcb[_0xabff('0x7e')]()),_0x41cea9[_0x251fcb]);}}if(_[_0xabff('0x48')](_0x41cea9[_0xabff('0x8b')])){return this[_0xabff('0x10')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x41cea9[_0xabff('0x8b')],_0xabff('0xfc'));return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')]('Amazon\x20Lex\x20Result\x20%s',_0x41cea9['message']));}}return this['channel'][_0xabff('0x30')](_0x5bf0a5,_0xabff('0x12e'));};AGIVertices['prototype'][_0xabff('0x12f')]=function(_0x12ce75){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x130'),_0x12ce75[_0xabff('0xbb')],_0x12ce75[_0xabff('0x7a')]));if(!this[_0xabff('0x97')](_0x12ce75[_0xabff('0x8f')])){return this[_0xabff('0x10')][_0xabff('0xc2')]('no\x20key\x20configured');}var _0x5e7624=_0xabff('0x131');var _0x1a66bb=util[_0xabff('0x69')]('%s/recordings/%s',FILES_PATH,rs[_0xabff('0x120')](0x4));var _0xd7f67c=util[_0xabff('0x69')](_0xabff('0xb1'),_0x1a66bb,_0x5e7624);var _0x279515=!![];if(_0x12ce75['beep']==='NOBEEP'){_0x279515=![];}var _0x40407b=this[_0xabff('0x10')][_0xabff('0x132')](_0x1a66bb,_0x5e7624,_0x12ce75[_0xabff('0x133')],_0x12ce75[_0xabff('0x7a')],undefined,_0x279515);if(_0x40407b[_0xabff('0xb7')]!==-0x1){this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x134'),_0xd7f67c));var _0x1cf1c3=this['googleASR'][_0xabff('0x84')](this,_0x12ce75,_0xd7f67c);if(_0x1cf1c3){for(var _0x5bc162 in _0x1cf1c3){if(_0x1cf1c3['hasOwnProperty'](_0x5bc162)){this[_0xabff('0x10')][_0xabff('0xb2')](util[_0xabff('0x69')](_0xabff('0x135'),_0x5bc162['toUpperCase']()),_0x1cf1c3[_0x5bc162]);}}return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x136'),JSON[_0xabff('0x87')](_0x1cf1c3)));}}return _0x40407b;};AGIVertices[_0xabff('0x12')][_0xabff('0x137')]=function(_0x5024a5){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x5024a5[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x5024a5[_0xabff('0xa5')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x138'));}if(!this[_0xabff('0x97')](_0x5024a5[_0xabff('0x139')])){return this[_0xabff('0x10')]['noop']('no\x20appsecret\x20configured');}var _0x199184=_0xabff('0x131');var _0x4173a7=util[_0xabff('0x69')]('%s/recordings/%s',FILES_PATH,rs[_0xabff('0x120')](0x4));var _0x44ad5a=util[_0xabff('0x69')](_0xabff('0xb1'),_0x4173a7,_0x199184);var _0x30181d=!![];if(_0x5024a5[_0xabff('0x13a')]===_0xabff('0x13b')){_0x30181d=![];}var _0x4289c1=this['channel'][_0xabff('0x132')](_0x4173a7,_0x199184,_0x5024a5[_0xabff('0x133')],_0x5024a5[_0xabff('0x7a')],undefined,_0x30181d);if(_0x4289c1[_0xabff('0xb7')]!==-0x1){this[_0xabff('0x10')][_0xabff('0xc2')](util['format'](_0xabff('0x13c'),_0x44ad5a));var _0x3452c3=this['tildeASR']['sync'](this,_0x5024a5,_0x44ad5a);if(_0x3452c3){for(var _0x562976 in _0x3452c3){if(_0x3452c3[_0xabff('0xa8')](_0x562976)){this[_0xabff('0x10')]['setVariable'](util[_0xabff('0x69')]('TILDE_ASR_%s',_0x562976['toUpperCase']()),_0x3452c3[_0x562976]);}}return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x13d'),JSON[_0xabff('0x87')](_0x3452c3)));}}return _0x4289c1;};AGIVertices[_0xabff('0x12')][_0xabff('0x13e')]=function(_0xc4a447){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0xc4a447[_0xabff('0xbb')]));return this[_0xabff('0x10')][_0xabff('0x13f')](_0xc4a447[_0xabff('0x3f')],_0xc4a447[_0xabff('0x40')],_0xc4a447[_0xabff('0x41')]);};AGIVertices[_0xabff('0x12')][_0xabff('0x140')]=function(_0x36666a){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x36666a[_0xabff('0xbb')]));if(!this['isConfigured'](_0x36666a[_0xabff('0x141')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x36666a,_0xabff('0x142'));}try{var _0x6ab883=eval(_0x36666a[_0xabff('0x141')])?_0xabff('0x143'):_0xabff('0x144');this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')]('EVAL\x20CONDITION\x20%s\x20%s',_0x36666a[_0xabff('0x141')],_0x6ab883));return{'code':0xc8,'result':_0x6ab883};}catch(_0x7a1f90){return{'code':0xc8,'result':_0xabff('0x144')};}};AGIVertices[_0xabff('0x12')]['gotoiftime']=function(_0x519f86){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x519f86[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x519f86[_0xabff('0x145')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x519f86,_0xabff('0x146'));}var _0x2f3e9c=this[_0xabff('0x28')][_0xabff('0x84')](this,_0x519f86[_0xabff('0x145')]);if(!_0x2f3e9c){return this[_0xabff('0x10')][_0xabff('0x30')](_0x519f86,_0xabff('0x147'));}for(var _0x379f4f=0x0;_0x379f4f<_0x2f3e9c[_0xabff('0xaf')];_0x379f4f+=0x1){var _0x5426ab=this['channel'][_0xabff('0x13')](util[_0xabff('0x69')](_0xabff('0x148'),_0x2f3e9c[_0x379f4f]));if(_0x5426ab[_0xabff('0xb7')]===-0x1){return _0x5426ab;}logger['info'](util[_0xabff('0x69')]('IFTIME\x20%s\x20%s',_0x2f3e9c[_0x379f4f],_0x5426ab['extra']));if(_0x5426ab[_0xabff('0xb9')]===_0xabff('0x143')){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x149'),_0x2f3e9c[_0x379f4f],'true'));this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x149'),_0x2f3e9c[_0x379f4f],_0xabff('0x143')));return{'code':0xc8,'result':'true'};}else{logger[_0xabff('0x34')](util['format'](_0xabff('0x149'),_0x2f3e9c[_0x379f4f],_0xabff('0x144')));this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x149'),_0x2f3e9c[_0x379f4f],_0xabff('0x144')));}}return{'code':0xc8,'result':_0xabff('0x144')};};AGIVertices[_0xabff('0x12')][_0xabff('0x14a')]=function(_0x50eb68){logger['info'](util[_0xabff('0x69')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x50eb68[_0xabff('0xbb')]));return this[_0xabff('0x10')][_0xabff('0x14a')]();};AGIVertices[_0xabff('0x12')]['ispeechasr']=function(_0x449f66){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x14b'),_0x449f66['label']));if(!this[_0xabff('0x97')](_0x449f66['key'])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0xf8'));}var _0x217cec='wav';var _0x188e74=util['format'](_0xabff('0x14c'),FILES_PATH,rs[_0xabff('0x120')](0x4));var _0x43e7e0=util['format'](_0xabff('0xb1'),_0x188e74,_0x217cec);var _0x26e91b=!![];if(_0x449f66['beep']===_0xabff('0x13b')){_0x26e91b=![];}var _0x4fba59=this[_0xabff('0x10')][_0xabff('0x132')](_0x188e74,_0x217cec,_0x449f66['intKey'],_0x449f66[_0xabff('0x7a')],undefined,_0x26e91b);if(_0x4fba59[_0xabff('0xb7')]!==-0x1){this[_0xabff('0x10')][_0xabff('0xc2')](util['format']('ispeech\x20%s\x20file\x20created',_0x43e7e0));var _0x5d775f=this[_0xabff('0x95')][_0xabff('0x84')](this,_0x449f66,_0x43e7e0);if(_0x5d775f){for(var _0x51bf9f in _0x5d775f){if(_0x5d775f[_0xabff('0xa8')](_0x51bf9f)){this[_0xabff('0x10')][_0xabff('0xb2')](util['format']('ISPEECH_ASR_%s',_0x51bf9f['toUpperCase']()),_0x5d775f[_0x51bf9f]);}}return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')]('IspeechASR\x20Result\x20%s',JSON[_0xabff('0x87')](_0x5d775f)));}}return _0x4fba59;};AGIVertices[_0xabff('0x12')]['ispeechtts']=function(_0x563707){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x14d'),_0x563707['label']));if(!this['isConfigured'](_0x563707['key'])){return this[_0xabff('0x10')]['noop'](_0xabff('0xf8'));}if(!this['isConfigured'](_0x563707['text'])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0xbc'));}this[_0xabff('0x10')][_0xabff('0xc2')](util['format'](_0xabff('0x14e'),_0x563707['text']));var _0x2e9e1b=this[_0xabff('0x92')][_0xabff('0x84')](this,_0x563707);if(_0x2e9e1b){this[_0xabff('0x10')][_0xabff('0xc2')](util['format']('ispeech\x20%s\x20file\x20created',_0x2e9e1b));var _0x329c22=this['channel'][_0xabff('0x109')](_0x2e9e1b,_0x563707[_0xabff('0x133')]);try{fs[_0xabff('0x10a')](_0x2e9e1b+_0xabff('0x10b'));}catch(_0x429893){logger['error'](_0x429893);}return _0x329c22;}return this['channel'][_0xabff('0x30')](_0x563707,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xabff('0x12')][_0xabff('0x14f')]=function(_0x52bdc2){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x150'),_0x52bdc2[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x52bdc2[_0xabff('0x151')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x52bdc2,_0xabff('0x152'));}logger['info'](util[_0xabff('0x69')](_0xabff('0x153'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x52bdc2[_0xabff('0x151')]));var _0x28c131=this[_0xabff('0x6b')][_0xabff('0x84')](this,_0x52bdc2['findBy']);if(_0x28c131){logger[_0xabff('0x34')](util['format'](_0xabff('0x154'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x52bdc2['findBy']));this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x154'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x52bdc2['findBy']));return{'code':0xc8,'result':_0xabff('0x155')};}else{logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x156'),this['channel'][_0xabff('0x3d')],_0x52bdc2[_0xabff('0x151')]));this['channel'][_0xabff('0xc2')](util['format'](_0xabff('0x156'),this[_0xabff('0x10')]['callerid'],_0x52bdc2[_0xabff('0x151')]));return{'code':0xc8,'result':_0xabff('0x157')};}};AGIVertices['prototype']['logout']=function(_0x44eb3b){logger['info'](util[_0xabff('0x69')](_0xabff('0x158'),_0x44eb3b['label']));if(!this[_0xabff('0x97')](_0x44eb3b['findBy'])){return this['channel'][_0xabff('0x30')](_0x44eb3b,_0xabff('0x152'));}logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x153'),this['channel']['callerid'],_0x44eb3b[_0xabff('0x151')]));var _0x328b2a=this[_0xabff('0x67')][_0xabff('0x84')](this,_0x44eb3b[_0xabff('0x151')]);if(_0x328b2a){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x154'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x44eb3b[_0xabff('0x151')]));this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x154'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x44eb3b['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x156'),this['channel'][_0xabff('0x3d')],_0x44eb3b[_0xabff('0x151')]));this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x156'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x44eb3b['findBy']));return{'code':0xc8,'result':_0xabff('0x157')};}};AGIVertices[_0xabff('0x12')][_0xabff('0x159')]=function(_0x22c8e0){logger[_0xabff('0x34')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x22c8e0[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x22c8e0[_0xabff('0x15a')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x22c8e0,'no\x20operation\x20configured');}this[_0xabff('0x10')][_0xabff('0xc2')](util['format'](_0xabff('0x15b'),_0x22c8e0['operation']));var _0x397d66=eval(_0x22c8e0[_0xabff('0x15a')]);if(!this[_0xabff('0x97')](_0x22c8e0['variable_id'])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0xe9'));}var _0x36d92c=this[_0xabff('0x13')][_0xabff('0x84')](this,_0x22c8e0[_0xabff('0xe8')]);if(!_0x36d92c){return this[_0xabff('0x10')][_0xabff('0x30')](_0x22c8e0,_0xabff('0xea'));}if(_[_0xabff('0xae')](_0x397d66)){var _0xf32446=this;_0x397d66['forEach'](function(_0x5d62b4,_0x573d30){_0xf32446[_0xabff('0x10')][_0xabff('0xb2')](util[_0xabff('0x69')](_0xabff('0x15c'),_0x36d92c,_0x573d30),_0x5d62b4);});return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x15d'),_0x36d92c));}else{return this[_0xabff('0x10')][_0xabff('0xb2')](_0x36d92c,_0x397d66);}};AGIVertices['prototype'][_0xabff('0xd')]=function(_0x112e19){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x112e19[_0xabff('0xbb')]));if(_0x112e19[_0xabff('0x117')]===0x0){return this[_0xabff('0xba')](_0x112e19);}_0x112e19[_0xabff('0x117')]-=0x1;if(!this[_0xabff('0x97')](_0x112e19[_0xabff('0x118')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x112e19,'no\x20file\x20audio\x20selected');}var _0x455b85=this[_0xabff('0x22')][_0xabff('0x84')](this,_0x112e19[_0xabff('0x118')]);if(!_0x455b85){return this['channel'][_0xabff('0x30')](_0x112e19,_0xabff('0x11a'));}var _0x44407a=this[_0xabff('0x10')]['getData'](_0x455b85,_0x112e19['response'],_0x112e19['digit']);var _0x29ee62=_0x44407a[_0xabff('0xb7')];if(_0x44407a['result']===-0x1){this[_0xabff('0x39')]['sync'](this,_0x112e19,'-1');return _0x44407a;}else if(_0x44407a['extra']===_0xabff('0x7a')){_0x44407a[_0xabff('0xb7')]=_0x44407a[_0xabff('0xb7')][_0xabff('0xaf')]>0x0?_0x44407a[_0xabff('0xb7')]:'t';}else if(_[_0xabff('0x47')](_0x44407a[_0xabff('0xb7')])){_0x44407a[_0xabff('0xb7')]='#';_0x29ee62='#';}if(!this[_0xabff('0x97')](_0x112e19['variable_id'])){this[_0xabff('0x10')][_0xabff('0xc2')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x518aab=this[_0xabff('0x13')][_0xabff('0x84')](this,_0x112e19['variable_id']);if(!_0x518aab){return this[_0xabff('0x10')][_0xabff('0x30')](_0x112e19,_0xabff('0xea'));}this['channel']['setVariable'](_0x518aab,_0x29ee62);}this['createSquareDetailsReport']['sync'](this,_0x112e19,_0x29ee62);return _0x44407a;};AGIVertices[_0xabff('0x12')][_0xabff('0xc2')]=function(_0x4405ea){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x15e'),_0x4405ea['label']));return this[_0xabff('0x10')][_0xabff('0xc2')](_0x4405ea[_0xabff('0x15f')]||_0x4405ea[_0xabff('0xbb')]);};AGIVertices[_0xabff('0x12')][_0xabff('0x160')]=function(_0x3ec6da){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3ec6da[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x3ec6da['findBy'])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x3ec6da,_0xabff('0x152'));}logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x153'),this['channel']['callerid'],_0x3ec6da[_0xabff('0x151')]));var _0x523ec5=this[_0xabff('0x62')][_0xabff('0x84')](this,_0x3ec6da[_0xabff('0x161')]);var _0x50ca1b=this[_0xabff('0x64')][_0xabff('0x84')](this,_0x3ec6da[_0xabff('0x151')],_0x523ec5);if(_0x50ca1b){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x154'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x3ec6da[_0xabff('0x151')]));this['channel']['noop'](util[_0xabff('0x69')](_0xabff('0x154'),this['channel'][_0xabff('0x3d')],_0x3ec6da[_0xabff('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x156'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x3ec6da['findBy']));this[_0xabff('0x10')][_0xabff('0xc2')](util['format'](_0xabff('0x154'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x3ec6da[_0xabff('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xabff('0x12')][_0xabff('0x162')]=function(_0x16b512){logger['info'](util['format'](_0xabff('0x163'),_0x16b512[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x16b512[_0xabff('0x118')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x16b512,_0xabff('0x119'));}var _0x2da914=this[_0xabff('0x22')][_0xabff('0x84')](this,_0x16b512[_0xabff('0x118')]);if(!_0x2da914){return this[_0xabff('0x10')][_0xabff('0x30')](_0x16b512,_0xabff('0x11a'));}var _0x56bbc9=this[_0xabff('0x10')][_0xabff('0x6d')](_0xabff('0x164'),[_0x2da914,_0x16b512[_0xabff('0xf4')]]);if(_0x56bbc9[_0xabff('0xb7')]===-0x1){return _0x56bbc9;}return this['channel'][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0xd7'),_0xabff('0x164'),_0x2da914));};AGIVertices[_0xabff('0x12')][_0xabff('0x165')]=function(_0x396c58){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x166'),_0x396c58[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x396c58[_0xabff('0x167')])){return this['channel']['error'](_0x396c58,_0xabff('0x168'));}var _0x232585='';var _0x3ad0d1=parseInt(_0x396c58['queue_id'],0xa);if(isNaN(_0x3ad0d1)){_0x232585=_0x396c58[_0xabff('0x167')];}else{_0x232585=this[_0xabff('0x17')][_0xabff('0x84')](this,_0x396c58[_0xabff('0x167')]);if(!_0x232585){return this[_0xabff('0x10')][_0xabff('0x30')](_0x396c58,'no\x20queue\x20found');}}var _0x102a8f='';if(this[_0xabff('0x97')](_0x396c58[_0xabff('0x118')])){var _0xfe9899=this[_0xabff('0x22')][_0xabff('0x84')](this,_0x396c58[_0xabff('0x118')]);if(_0xfe9899){_0x102a8f=_0xfe9899;}}this[_0xabff('0x39')][_0xabff('0x84')](this,_0x396c58,_0x232585);if(_0x396c58[_0xabff('0xf4')][_0xabff('0x169')]('x')<0x0){_0x396c58[_0xabff('0xf4')]+='x';}if(_0x396c58[_0xabff('0xf4')]['indexOf']('X')<0x0){_0x396c58[_0xabff('0xf4')]+='X';}this['channel'][_0xabff('0xb2')]('XMCS-QUEUE',_0x232585?_0x232585['toLowerCase']():'');var _0x13e3aa=this[_0xabff('0x10')][_0xabff('0x6d')](_0xabff('0x16a'),[_0x232585,_0x396c58['opts'],_0x396c58['url'],_0x102a8f,_0x396c58[_0xabff('0x7a')],_0x396c58[_0xabff('0xc8')],_0x396c58['macro'],_0x396c58[_0xabff('0x16b')],'',_0x396c58['position']]);if(_0x13e3aa[_0xabff('0xb7')]===-0x1){return _0x13e3aa;}return this[_0xabff('0x10')][_0xabff('0xc2')](util['format'](_0xabff('0xd7'),'QUEUE',_0x232585));};AGIVertices[_0xabff('0x12')]['record']=function(_0x424ed8){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x16c'),_0x424ed8['label']));var _0x47c5b5=_0x424ed8[_0xabff('0x16d')]||_0xabff('0x131');var _0x15fa98=util[_0xabff('0x69')](_0xabff('0x16e'),this[_0xabff('0x10')][_0xabff('0x3a')],rs[_0xabff('0x120')](0x5));var _0x12b45e=util['format'](_0xabff('0x16f'),FILES_PATH,_0x15fa98,_0x47c5b5);var _0x1c95e4=util[_0xabff('0x69')](_0xabff('0x14c'),FILES_PATH,_0x15fa98);this[_0xabff('0x3e')][_0xabff('0x84')](this,_0x424ed8,_0x15fa98,_0x12b45e);this[_0xabff('0x10')][_0xabff('0xb2')](_0xabff('0x170'),_0x15fa98);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x1c95e4,_0x47c5b5,_0x424ed8[_0xabff('0x171')],_0x424ed8[_0xabff('0x7a')]);return this[_0xabff('0x10')][_0xabff('0x132')](_0x1c95e4,_0x47c5b5,_0x424ed8[_0xabff('0x171')],_0x424ed8['timeout'],undefined,!![]);};AGIVertices[_0xabff('0x12')][_0xabff('0x172')]=function(_0x59e5f5){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x173'),_0x59e5f5['label']));if(!this[_0xabff('0x97')](_0x59e5f5[_0xabff('0x78')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x174'));}var _0x21163e=this[_0xabff('0x77')][_0xabff('0x84')](this,_0x59e5f5);logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x175'),util[_0xabff('0x176')](_0x21163e,{'showHidden':![],'depth':null})));if(!this[_0xabff('0x97')](_0x59e5f5[_0xabff('0xe8')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x177'));}var _0x57707a=this[_0xabff('0x13')][_0xabff('0x84')](this,_0x59e5f5[_0xabff('0xe8')]);if(!_0x57707a){return this['channel'][_0xabff('0x30')](_0x59e5f5,_0xabff('0xea'));}this[_0xabff('0x10')][_0xabff('0xb2')](util[_0xabff('0x69')](_0xabff('0x178'),_0x57707a),_0x21163e[_0xabff('0x89')]?_0x21163e[_0xabff('0x89')]:_0xabff('0x179'));this[_0xabff('0x10')][_0xabff('0xb2')](util[_0xabff('0x69')](_0xabff('0x17a'),_0x57707a),_0x21163e[_0xabff('0x8a')]?_0x21163e['statusMessage']:'OK');if(_0x21163e[_0xabff('0x7f')]){try{this[_0xabff('0xb0')](_0x21163e[_0xabff('0x7f')],_0x57707a);}catch(_0x19d995){logger[_0xabff('0x30')](util[_0xabff('0x69')](_0xabff('0x17b'),_0x57707a));}}return this['channel'][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x17c'),_0x57707a));};AGIVertices[_0xabff('0x12')][_0xabff('0x17d')]=function(_0x3ff22a){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x17e'),_0x3ff22a['label']));return this[_0xabff('0x10')][_0xabff('0x17f')](_0x3ff22a[_0xabff('0x180')][_0xabff('0x6f')](/\s+/g,''),_0x3ff22a[_0xabff('0x171')]);};AGIVertices[_0xabff('0x12')][_0xabff('0x181')]=function(_0x283ced){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x182'),_0x283ced[_0xabff('0xbb')]));return this[_0xabff('0x10')][_0xabff('0x183')](_0x283ced[_0xabff('0x7b')][_0xabff('0x6f')](/\s+/g,''),_0x283ced[_0xabff('0x171')]);};AGIVertices['prototype'][_0xabff('0x184')]=function(_0x40dd67){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x185'),_0x40dd67[_0xabff('0xbb')]));return this[_0xabff('0x10')][_0xabff('0x186')](_0x40dd67[_0xabff('0x72')],_0x40dd67[_0xabff('0x171')]);};AGIVertices[_0xabff('0x12')][_0xabff('0x187')]=function(_0x80be05){logger['info'](util[_0xabff('0x69')](_0xabff('0x188'),_0x80be05[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x80be05[_0xabff('0x189')])){return this[_0xabff('0x10')]['noop'](_0xabff('0x18a'));}var _0x53b402=this['getMailAccount'][_0xabff('0x84')](this,_0x80be05[_0xabff('0x189')]);if(!_0x53b402||!_0x53b402['Smtp']){return this[_0xabff('0x10')][_0xabff('0x30')](_0x80be05,'no\x20mail\x20account\x20found');}var _0x99dcb7={'from':util[_0xabff('0x69')](_0xabff('0x18b'),_0x53b402[_0xabff('0x15')],_0x53b402[_0xabff('0x18c')]||_0x53b402[_0xabff('0x18d')][_0xabff('0x18e')]),'to':_0x80be05['to']||'','cc':_0x80be05['cc']||'','bcc':_0x80be05[_0xabff('0x18f')]||'','subject':_0x80be05[_0xabff('0x190')],'html':_0x80be05['text'],'text':_0x80be05[_0xabff('0x72')]};var _0x906bf6={'tls':{'rejectUnauthorized':![]}};if(_0x53b402[_0xabff('0x18d')][_0xabff('0x191')]){_0x906bf6[_0xabff('0x191')]=_0x53b402[_0xabff('0x18d')][_0xabff('0x191')];}else{_0x906bf6[_0xabff('0x192')]=_0x53b402['Smtp'][_0xabff('0x192')];_0x906bf6[_0xabff('0x193')]=_0x53b402[_0xabff('0x18d')][_0xabff('0x193')];_0x906bf6['secure']=_0x53b402[_0xabff('0x18d')][_0xabff('0x194')];}if(_0x53b402['Smtp'][_0xabff('0x195')]){_0x906bf6[_0xabff('0x196')]={'user':_0x53b402[_0xabff('0x18d')][_0xabff('0x18e')],'pass':_0x53b402[_0xabff('0x18d')][_0xabff('0x197')]};}if(this[_0xabff('0x97')](_0x80be05[_0xabff('0x198')])){}logger[_0xabff('0xee')](_0xabff('0x199'),JSON[_0xabff('0x87')](_0x99dcb7));this[_0xabff('0x39')][_0xabff('0x84')](this,_0x80be05,_0x80be05[_0xabff('0x189')]);this['channel']['noop'](util[_0xabff('0x69')](_0xabff('0x19a'),_0x53b402[_0xabff('0x15')]));this[_0xabff('0x27')][_0xabff('0x84')](this,_0x906bf6,_0x99dcb7);return this[_0xabff('0x10')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xabff('0x12')][_0xabff('0x19b')]=function(_0x7c72e0){logger['info'](util['format'](_0xabff('0x19c'),_0x7c72e0[_0xabff('0xbb')]));return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x19d'));};AGIVertices['prototype'][_0xabff('0x19e')]=function(_0x17457d){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x19f'),_0x17457d[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x17457d['sms_account_id'])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x1a0'));}var _0x5d2967=this['getSmsAccount'][_0xabff('0x84')](this,_0x17457d[_0xabff('0x1a1')]);if(!_0x5d2967){return this[_0xabff('0x10')][_0xabff('0x30')](_0x17457d,_0xabff('0x1a2'));}var _0x57fbb8={'body':_0x17457d['sms_text'],'phone':_0x17457d['to']||'','SmsAccountId':_0x5d2967['id']};logger[_0xabff('0xee')](_0xabff('0x1a3'),JSON[_0xabff('0x87')](_0x57fbb8));this['createSquareDetailsReport'][_0xabff('0x84')](this,_0x17457d,_0x17457d[_0xabff('0x1a1')]);this['channel'][_0xabff('0xc2')](util[_0xabff('0x69')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5d2967[_0xabff('0x15')]));this[_0xabff('0x38')][_0xabff('0x84')](this,_0x57fbb8);return this[_0xabff('0x10')][_0xabff('0xc2')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xabff('0x12')][_0xabff('0x1a4')]=function(_0x10d36a){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x1a5'),_0x10d36a[_0xabff('0xbb')]));if(!this['isConfigured'](_0x10d36a[_0xabff('0xe8')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x10d36a,'no\x20variable\x20selected');}var _0x322d30=this[_0xabff('0x13')][_0xabff('0x84')](this,_0x10d36a[_0xabff('0xe8')]);if(!_0x322d30){return this[_0xabff('0x10')]['error'](_0x10d36a,_0xabff('0xea'));}return this['channel'][_0xabff('0xb2')](_0x322d30,_0x10d36a[_0xabff('0x1a6')]);};AGIVertices[_0xabff('0x12')][_0xabff('0x1a7')]=function(_0x2a7fb6){logger['info'](util[_0xabff('0x69')](_0xabff('0x1a8'),_0x2a7fb6[_0xabff('0xbb')]));this['channel'][_0xabff('0xc2')](_0xabff('0x1a9'));if(_0x2a7fb6[_0xabff('0xcc')]===_0xabff('0x1aa')){this[_0xabff('0x10')]['noop'](_0xabff('0x1ab'));return this[_0xabff('0x10')][_0xabff('0xcc')]();}return this['channel']['noop']('Skipped\x20Answer');};AGIVertices[_0xabff('0x12')]['subproject']=function(_0x13c2e9){logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x1ac'),_0x13c2e9[_0xabff('0xbb')]));if(!this['isConfigured'](_0x13c2e9[_0xabff('0x1ad')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x13c2e9,_0xabff('0x1ae'));}var _0x2aed84=this[_0xabff('0x1a')][_0xabff('0x84')](this,_0x13c2e9['project_id']);if(!this['isConfigured'](_0x2aed84)){return this['channel'][_0xabff('0x30')](_0x13c2e9,util[_0xabff('0x69')](_0xabff('0x1af'),_0x13c2e9['project_id']));}if(_0x2aed84===this[_0xabff('0x10')]['arg_1']){return this[_0xabff('0x10')][_0xabff('0x30')](_0x13c2e9,_0xabff('0x1b0'));}this[_0xabff('0x39')][_0xabff('0x84')](this,_0x13c2e9,_0x2aed84);var _0x1a5ab1=this[_0xabff('0x10')]['exec'](_0xabff('0x1b1'),util[_0xabff('0x69')](_0xabff('0x1b2'),config[_0xabff('0xc8')][_0xabff('0x192')]||_0xabff('0x1b3'),_0x2aed84,this[_0xabff('0x10')]['arg_1']));if(_0x1a5ab1['result']===-0x1){return _0x1a5ab1;}return this[_0xabff('0x10')]['noop'](util[_0xabff('0x69')](_0xabff('0xd7'),_0xabff('0x1b1'),_0x2aed84));};AGIVertices[_0xabff('0x12')][_0xabff('0x1b4')]=function(_0x48bc35){logger[_0xabff('0x34')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x48bc35['label']));var _0x4d8785=this[_0xabff('0x6c')][_0xabff('0x84')](this,_0x48bc35['command']);this['createSquareDetailsReport'][_0xabff('0x84')](this,_0x48bc35,_0x48bc35[_0xabff('0xca')]);if(this[_0xabff('0x97')](_0x48bc35['variable_id'])){var _0x2cd667=this[_0xabff('0x13')][_0xabff('0x84')](this,_0x48bc35['variable_id']);if(_0x2cd667){this['channel']['setVariable'](_0x2cd667,_0x4d8785);return this['channel'][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x1b5'),_0x48bc35['command'],_0x2cd667));}}return this['channel'][_0xabff('0xc2')](util[_0xabff('0x69')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x48bc35['command']));};AGIVertices[_0xabff('0x12')][_0xabff('0x1b6')]=function(_0x3ace67){logger['info'](util[_0xabff('0x69')](_0xabff('0x1b7'),_0x3ace67[_0xabff('0xbb')]));_0x3ace67['text']=_0x3ace67[_0xabff('0x72')][_0xabff('0x6f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3ace67[_0xabff('0x71')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0x1b8'));}if(!this[_0xabff('0x97')](_0x3ace67[_0xabff('0x72')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0xbc'));}this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x1b9'),_0x3ace67['text']));var _0x39a3d1=this[_0xabff('0x70')][_0xabff('0x84')](this,_0x3ace67);if(_0x39a3d1){this[_0xabff('0x10')][_0xabff('0xc2')](util['format'](_0xabff('0x1ba'),_0x39a3d1));var _0x1ecea5=this['channel']['streamFile'](_0x39a3d1);try{fs['unlink'](_0x39a3d1+_0xabff('0x10b'));}catch(_0x1170b4){logger[_0xabff('0x30')](_0x1170b4);}return _0x1ecea5;}return this[_0xabff('0x10')][_0xabff('0x30')](_0x3ace67,_0xabff('0x1bb'));};AGIVertices[_0xabff('0x12')][_0xabff('0x1bc')]=function(_0x3d97b6){logger['info'](util[_0xabff('0x69')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3d97b6[_0xabff('0xbb')]));_0x3d97b6[_0xabff('0x72')]=_0x3d97b6['text'][_0xabff('0x6f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xabff('0x97')](_0x3d97b6[_0xabff('0x72')])){return this[_0xabff('0x10')][_0xabff('0xc2')](_0xabff('0xbc'));}this['channel'][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x1bd'),_0x3d97b6[_0xabff('0x72')]));var _0x47463d=this[_0xabff('0x75')]['sync'](this,_0x3d97b6);if(_0x47463d){this['channel']['noop'](util[_0xabff('0x69')]('Google\x20TTS\x20%s\x20file\x20created',_0x47463d));var _0x3b2b3e=this[_0xabff('0x10')][_0xabff('0x109')](_0x47463d);try{fs[_0xabff('0x10a')](_0x47463d+_0xabff('0x10b'));}catch(_0x136c37){logger[_0xabff('0x30')](_0x136c37);}return _0x3b2b3e;}return this[_0xabff('0x10')][_0xabff('0x30')](_0x3d97b6,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xabff('0x12')][_0xabff('0x1be')]=function(_0x10d01d){logger['info'](util[_0xabff('0x69')](_0xabff('0x1bf'),_0x10d01d[_0xabff('0xbb')]));if(!this[_0xabff('0x97')](_0x10d01d[_0xabff('0x151')])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x10d01d,'no\x20find\x20by\x20configured');}logger['info'](util[_0xabff('0x69')](_0xabff('0x153'),this[_0xabff('0x10')]['callerid'],_0x10d01d[_0xabff('0x151')]));var _0x5d6a0a=this[_0xabff('0x66')][_0xabff('0x84')](this,_0x10d01d[_0xabff('0x151')]);if(_0x5d6a0a){logger[_0xabff('0x34')](util['format'](_0xabff('0x154'),this[_0xabff('0x10')]['callerid'],_0x10d01d[_0xabff('0x151')]));this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')](_0xabff('0x154'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x10d01d[_0xabff('0x151')]));return{'code':0xc8,'result':_0xabff('0x155')};}else{logger[_0xabff('0x34')](util[_0xabff('0x69')](_0xabff('0x156'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x10d01d[_0xabff('0x151')]));this[_0xabff('0x10')]['noop'](util[_0xabff('0x69')](_0xabff('0x156'),this[_0xabff('0x10')][_0xabff('0x3d')],_0x10d01d[_0xabff('0x151')]));return{'code':0xc8,'result':_0xabff('0x157')};}};AGIVertices[_0xabff('0x12')][_0xabff('0x1c0')]=function(_0x1cde11){logger[_0xabff('0x34')](util[_0xabff('0x69')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1cde11[_0xabff('0xbb')]));var _0x53aa1b=this[_0xabff('0x10')][_0xabff('0x6d')](_0xabff('0x1c1'),[_0x1cde11[_0xabff('0x1c2')],_0x1cde11[_0xabff('0x8d')]]);if(_0x53aa1b['result']===-0x1){return _0x53aa1b;}return this[_0xabff('0x10')][_0xabff('0xc2')](util[_0xabff('0x69')]('Executed\x20command\x20%s\x20%s',_0xabff('0x1c1'),_0x1cde11[_0xabff('0x1c2')]));};AGIVertices[_0xabff('0x12')]['vswitch']=function(_0x3bded2){logger['info'](util['format'](_0xabff('0x1c3'),_0x3bded2[_0xabff('0xbb')]));if(!this['isConfigured'](_0x3bded2['variable_id'])){return this[_0xabff('0x10')][_0xabff('0x30')](_0x3bded2,_0xabff('0x1c4'));}var _0x36dfe8=this['getVariable'][_0xabff('0x84')](this,_0x3bded2[_0xabff('0xe8')]);if(!_0x36dfe8){return this[_0xabff('0x10')][_0xabff('0x30')](_0x3bded2,_0xabff('0xea'));}var _0x4d55ca=this[_0xabff('0x10')][_0xabff('0x13')](_0x36dfe8);return{'code':0xc8,'result':_0x4d55ca[_0xabff('0xb9')]?_0x4d55ca['extra']:'-'};};String[_0xabff('0x12')][_0xabff('0x1c5')]=function(_0x345db5,_0x410271){return this['split'](_0x345db5)[_0xabff('0x1c6')](_0x410271);};module[_0xabff('0x1c7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 18aa63f..1023a7a 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 _0xf3cd=['../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','stopAcw','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0xf3cd[_0x24b477];return _0x4041a6;};'use strict';var util=require(_0xdf3c('0x0'));var _=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var ami=require(_0xdf3c('0x3'));var logger=require(_0xdf3c('0x4'))(_0xdf3c('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xdf3c('0x6'));function Acw(_0x71b446){this[_0xdf3c('0x7')]=_0x71b446['voiceQueues'];this[_0xdf3c('0x8')]=_0x71b446[_0xdf3c('0x8')];this[_0xdf3c('0x9')]=_0x71b446[_0xdf3c('0x9')];this[_0xdf3c('0xa')]={};ami['on'](_0xdf3c('0xb'),this['syncAgentConnect'][_0xdf3c('0xc')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xd'),this['syncHangup'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xe'),this[_0xdf3c('0xf')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x10'),this[_0xdf3c('0x11')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x12'),this['syncBlindTransfer'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x13'),this[_0xdf3c('0x14')][_0xdf3c('0xc')](this));}function getDiff(_0x59e431){var _0x2ae4ad=moment()[_0xdf3c('0x15')](0x0);var _0x13ea5f=moment(_0x59e431)['milliseconds'](0x0);return _0x2ae4ad[_0xdf3c('0x16')](_0x13ea5f,_0xdf3c('0x17'));}Acw[_0xdf3c('0x18')][_0xdf3c('0x19')]=function(_0x21e587){try{var _0x1a7a5a=this;var _0x305ea5=this[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x1a')];var _0x5d3991=this['channels'][_0x21e587][_0xdf3c('0x1b')];var _0x465e7d=this[_0xdf3c('0x7')][_0x5d3991];var _0x18d4ec=![];var _0x1e2690=_0xdf3c('0x1c');if(_0x465e7d[_0xdf3c('0x1d')]){if(_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')]){_0x18d4ec=!![];_0x1e2690=_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')];}}ami[_0xdf3c('0x20')]({'action':_0xdf3c('0x21'),'interface':_0x305ea5,'paused':!![],'reason':_0x1e2690})['then'](function(_0x4d620f){if(_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]){return RpcUser['getAgent'](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]['id'])[_0xdf3c('0x22')](function(_0x36552e){if(_0x36552e&&!_0x36552e[_0xdf3c('0x23')]){logger[_0xdf3c('0x24')](_0xdf3c('0x25'),_0x21e587,_0x305ea5,_0x5d3991);var _0x50d8ca=_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x26')]&&_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]?_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]:_0x21e587;return RpcUser[_0xdf3c('0x28')](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5],_0x1e2690,_0x50d8ca)[_0xdf3c('0x22')](function(_0x1adee4){if(!_0x18d4ec){_0x1a7a5a['timers'][_0x305ea5]={};logger[_0xdf3c('0x24')](_0xdf3c('0x29'),_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);_0x1a7a5a['timers'][_0x305ea5]['timer']=setTimeout(_0x1a7a5a['stopAcw'][_0xdf3c('0xc')](_0x1a7a5a,_0x305ea5),_0x1a7a5a[_0xdf3c('0x7')][_0x5d3991]['acwTimeout']*0x3e8);_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2b')]=moment()[_0xdf3c('0x2c')](_0xdf3c('0x2d'));_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5]['uniqueid']=_0x21e587;_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x1b')]=_0x5d3991;_0x1a7a5a['timers'][_0x305ea5]['updateAcw']=function(){var _0x1f1d8a=getDiff(_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2b')]);clearTimeout(_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2e')]);_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2e')]=![];RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1f1d8a},_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x30')],_0x305ea5)[_0xdf3c('0x22')](function(_0x522e5f){logger[_0xdf3c('0x24')](_0xdf3c('0x31'),_0x21e587,_0x1f1d8a,_0x522e5f);})[_0xdf3c('0x32')](function(_0x2287f){logger['error'](_0xdf3c('0x33'),_0x21e587,_0x2287f);});delete _0x1a7a5a[_0xdf3c('0x9')][_0x305ea5];};}});}else{logger[_0xdf3c('0x24')](_0xdf3c('0x34'),_0x21e587,_0x305ea5,_0x5d3991);}});}})['catch'](function(_0x474564){logger[_0xdf3c('0x35')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);})['finally'](function(){delete _0x1a7a5a[_0xdf3c('0xa')][_0x21e587];});}catch(_0x5e8130){logger['error']('[ACW][START]\x20%s',_0x5e8130[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x37')]=function(_0x29b5b7){try{var _0x54c25f=this;if(_0x54c25f['timers'][_0x29b5b7]){_0x54c25f[_0xdf3c('0x9')][_0x29b5b7]['timer']=![];var _0x46e40f=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x30')];var _0xcdd731=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x1b')];var _0x1c7335=_0x54c25f[_0xdf3c('0x7')][_0xcdd731][_0xdf3c('0x2a')];logger['info'](_0xdf3c('0x38'),_0x29b5b7);RpcUser['saveUnpause'](this['agents'][_0x29b5b7]);RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1c7335,'agentacw':!![]},_0x46e40f,_0x29b5b7)['then'](function(_0xccce51){logger['info'](_0xdf3c('0x31'),_0x46e40f,_0x1c7335,_0xccce51);})[_0xdf3c('0x32')](function(_0x1c6dee){logger[_0xdf3c('0x35')](_0xdf3c('0x33'),_0x46e40f,_0x1c6dee);});}else{logger[_0xdf3c('0x35')](_0xdf3c('0x39'),_0x29b5b7);if(_0x54c25f[_0xdf3c('0x9')]){logger[_0xdf3c('0x24')](_0xdf3c('0x3a'),JSON[_0xdf3c('0x3b')](_0x54c25f[_0xdf3c('0x9')]));}}}catch(_0x57e0ab){logger['error'](_0xdf3c('0x3c'),_0x57e0ab['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3d')]=function(_0x46194d){try{if(this[_0xdf3c('0x7')][_0x46194d['queue']]&&(this['voiceQueues'][_0x46194d[_0xdf3c('0x1b')]][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x46194d['queue']][_0xdf3c('0x1d')])){if(this[_0xdf3c('0x8')][_0x46194d[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x46194d['uniqueid']]={'queue':_0x46194d[_0xdf3c('0x1b')],'interface':_0x46194d[_0xdf3c('0x1a')],'destlinkedid':_0x46194d[_0xdf3c('0x27')]};}}}catch(_0x3f4d7f){logger[_0xdf3c('0x35')]('[ACW][syncAgentConnect]\x20%s',_0x3f4d7f[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x14')]=function(_0x2456cf){try{if(this[_0xdf3c('0x7')][_0x2456cf[_0xdf3c('0x1b')]]&&(this['voiceQueues'][_0x2456cf['queue']][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x2456cf['queue']]['mandatoryDisposition'])){if(this[_0xdf3c('0x8')][_0x2456cf[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x2456cf[_0xdf3c('0x30')]]={'queue':_0x2456cf[_0xdf3c('0x1b')],'interface':_0x2456cf[_0xdf3c('0x1a')]};}}}catch(_0x466ea1){logger[_0xdf3c('0x35')](_0xdf3c('0x3e'),_0x466ea1['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3f')]=function(_0x1c293d){try{if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x30')]]&&_[_0xdf3c('0x40')](this[_0xdf3c('0xa')][_0x1c293d['uniqueid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x41'),_0x1c293d['uniqueid']);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x42')]]&&_['isUndefined'](this['channels'][_0x1c293d['linkedid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x43'),_0x1c293d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x42')]);}}catch(_0x3b17d9){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x3b17d9[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')]['syncHangup']=function(_0x3b215d){try{if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3b215d['uniqueid']);this[_0xdf3c('0x19')](_0x3b215d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')](_0xdf3c('0x44'),_0x3b215d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x3b215d['linkedid']);}}catch(_0x1eebcf){logger['error']('[ACW][syncHangup]\x20%s',_0x1eebcf['message']);}};Acw['prototype']['syncAttendedTransfer']=function(_0x1afc6c){try{if(!_[_0xdf3c('0x45')](this['channels'][_0x1afc6c[_0xdf3c('0x46')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfereeuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]]){this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]]=this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];}}else if(!_['isNil'](this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfertargetuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]]){this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c['transfereeuniqueid']]=this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]];}}}catch(_0x163adc){logger[_0xdf3c('0x35')](_0xdf3c('0x4a'),_0x163adc[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x4b')]=function(_0x2922d8){try{if(this[_0xdf3c('0xa')][_0x2922d8[_0xdf3c('0x4c')]]){logger[_0xdf3c('0x24')](_0xdf3c('0x4d'),JSON[_0xdf3c('0x3b')](_0x2922d8[_0xdf3c('0x4c')]));this[_0xdf3c('0x19')](_0x2922d8[_0xdf3c('0x4c')]);}else if(this['channels'][_0x2922d8['transfererlinkedid']]){logger[_0xdf3c('0x24')](_0xdf3c('0x4e'),JSON[_0xdf3c('0x3b')](_0x2922d8['transfererlinkedid']));this[_0xdf3c('0x19')](_0x2922d8['transfererlinkedid']);}}catch(_0x574852){logger[_0xdf3c('0x35')](_0xdf3c('0x4f'),_0x574852[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0xf')]=function(_0x9b7034){try{if(this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]]&&this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]][_0xdf3c('0x50')]===_0xdf3c('0x51')){if(this[_0xdf3c('0x8')][_0x9b7034['interface']]){logger[_0xdf3c('0x24')](_0xdf3c('0x52'),_0x9b7034[_0xdf3c('0x30')],_0x9b7034[_0xdf3c('0x1a')],_0x9b7034[_0xdf3c('0x1b')]);return RpcUser['savePause'](this[_0xdf3c('0x8')][_0x9b7034[_0xdf3c('0x1a')]],_0xdf3c('0x53'),_0x9b7034[_0xdf3c('0x30')]);}}}catch(_0x1efa9c){logger[_0xdf3c('0x35')](_0xdf3c('0x54'),_0x1efa9c[_0xdf3c('0x36')]);}};module[_0xdf3c('0x55')]=Acw; \ No newline at end of file +var _0xa41a=['[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','interface','queue','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','attended','destlinkedid','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer'];(function(_0x4b4f5d,_0x22e3fb){var _0x4bfb64=function(_0xea48e9){while(--_0xea48e9){_0x4b4f5d['push'](_0x4b4f5d['shift']());}};_0x4bfb64(++_0x22e3fb);}(_0xa41a,0x6b));var _0xaa41=function(_0x5f287c,_0x12ae13){_0x5f287c=_0x5f287c-0x0;var _0xf41400=_0xa41a[_0x5f287c];return _0xf41400;};'use strict';var util=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));var moment=require('moment');var ami=require(_0xaa41('0x2'));var logger=require(_0xaa41('0x3'))(_0xaa41('0x4'));var RpcUser=require(_0xaa41('0x5'));var RpcVoiceAgentReport=require(_0xaa41('0x6'));function Acw(_0x3168be){this[_0xaa41('0x7')]=_0x3168be[_0xaa41('0x7')];this['agents']=_0x3168be[_0xaa41('0x8')];this[_0xaa41('0x9')]=_0x3168be['timers'];this['channels']={};ami['on'](_0xaa41('0xa'),this[_0xaa41('0xb')]['bind'](this));ami['on'](_0xaa41('0xc'),this[_0xaa41('0xd')][_0xaa41('0xe')](this));ami['on'](_0xaa41('0xf'),this[_0xaa41('0x10')][_0xaa41('0xe')](this));ami['on'](_0xaa41('0x11'),this[_0xaa41('0x12')][_0xaa41('0xe')](this));ami['on']('attendedtransfer',this[_0xaa41('0x13')][_0xaa41('0xe')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xaa41('0xe')](this));ami['on']('custom:agentConnectPreview',this[_0xaa41('0x14')][_0xaa41('0xe')](this));}function getDiff(_0x2f64bc){var _0x889d44=moment()[_0xaa41('0x15')](0x0);var _0x4eaf81=moment(_0x2f64bc)[_0xaa41('0x15')](0x0);return _0x889d44[_0xaa41('0x16')](_0x4eaf81,_0xaa41('0x17'));}Acw[_0xaa41('0x18')][_0xaa41('0x19')]=function(_0x2005ae){try{var _0x1e1e02=this;var _0x550ad5=this[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x1b')];var _0x4210fa=this[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x1c')];var _0xd20ddf=this[_0xaa41('0x7')][_0x4210fa];var _0x46e6d3=![];var _0x150ddf='ACW';if(_0xd20ddf['mandatoryDisposition']){if(_0xd20ddf[_0xaa41('0x1d')][_0xaa41('0x1e')]){_0x46e6d3=!![];_0x150ddf=_0xd20ddf[_0xaa41('0x1d')]['name'];}}ami[_0xaa41('0x1f')]({'action':_0xaa41('0x20'),'interface':_0x550ad5,'paused':!![],'reason':_0x150ddf})['then'](function(_0x513c61){if(_0x1e1e02[_0xaa41('0x8')][_0x550ad5]){return RpcUser['getAgent'](_0x1e1e02[_0xaa41('0x8')][_0x550ad5]['id'])[_0xaa41('0x21')](function(_0x3e2175){if(_0x3e2175&&!_0x3e2175[_0xaa41('0x22')]){logger[_0xaa41('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2005ae,_0x550ad5,_0x4210fa);var _0x43c430=_0x1e1e02[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x24')]&&_0x1e1e02[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x25')]?_0x1e1e02[_0xaa41('0x1a')][_0x2005ae]['destlinkedid']:_0x2005ae;return RpcUser['savePause'](_0x1e1e02[_0xaa41('0x8')][_0x550ad5],_0x150ddf,_0x43c430)['then'](function(_0x493a10){if(!_0x46e6d3){_0x1e1e02[_0xaa41('0x9')][_0x550ad5]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2005ae,_0x1e1e02[_0xaa41('0x7')][_0x4210fa][_0xaa41('0x26')],_0x550ad5,_0x4210fa);_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x27')]=setTimeout(_0x1e1e02[_0xaa41('0x28')][_0xaa41('0xe')](_0x1e1e02,_0x550ad5),_0x1e1e02['voiceQueues'][_0x4210fa][_0xaa41('0x26')]*0x3e8);_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x29')]=moment()[_0xaa41('0x2a')](_0xaa41('0x2b'));_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x2c')]=_0x2005ae;_0x1e1e02[_0xaa41('0x9')][_0x550ad5]['queue']=_0x4210fa;_0x1e1e02[_0xaa41('0x9')][_0x550ad5]['updateAcw']=function(){var _0x5dad80=getDiff(_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x29')]);clearTimeout(_0x1e1e02['timers'][_0x550ad5][_0xaa41('0x27')]);_0x1e1e02[_0xaa41('0x9')][_0x550ad5]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x5dad80},_0x1e1e02['timers'][_0x550ad5][_0xaa41('0x2c')],_0x550ad5)[_0xaa41('0x21')](function(_0x2a186e){logger[_0xaa41('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x2005ae,_0x5dad80,_0x2a186e);})[_0xaa41('0x2d')](function(_0x45c8fe){logger[_0xaa41('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x2005ae,_0x45c8fe);});delete _0x1e1e02[_0xaa41('0x9')][_0x550ad5];};}});}else{logger[_0xaa41('0x23')](_0xaa41('0x2f'),_0x2005ae,_0x550ad5,_0x4210fa);}});}})['catch'](function(_0x252c62){logger[_0xaa41('0x2e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2005ae,_0x1e1e02[_0xaa41('0x7')][_0x4210fa][_0xaa41('0x26')],_0x550ad5,_0x4210fa);})[_0xaa41('0x30')](function(){delete _0x1e1e02['channels'][_0x2005ae];});}catch(_0x22b272){logger['error'](_0xaa41('0x31'),_0x22b272[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')]['stopAcw']=function(_0x526377){try{var _0x4cdd42=this;if(_0x4cdd42[_0xaa41('0x9')][_0x526377]){_0x4cdd42[_0xaa41('0x9')][_0x526377][_0xaa41('0x27')]=![];var _0x224eb3=_0x4cdd42['timers'][_0x526377]['uniqueid'];var _0x267999=_0x4cdd42[_0xaa41('0x9')][_0x526377][_0xaa41('0x1c')];var _0x4e8d2e=_0x4cdd42[_0xaa41('0x7')][_0x267999][_0xaa41('0x26')];logger[_0xaa41('0x23')]('[TIMER][STOP][AGENT:%s]',_0x526377);RpcUser[_0xaa41('0x33')](this[_0xaa41('0x8')][_0x526377]);RpcVoiceAgentReport[_0xaa41('0x34')]({'acwtime':_0x4e8d2e,'agentacw':!![]},_0x224eb3,_0x526377)[_0xaa41('0x21')](function(_0x57f1bf){logger['info'](_0xaa41('0x35'),_0x224eb3,_0x4e8d2e,_0x57f1bf);})[_0xaa41('0x2d')](function(_0x5eae08){logger[_0xaa41('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x224eb3,_0x5eae08);});}else{logger[_0xaa41('0x2e')](_0xaa41('0x36'),_0x526377);if(_0x4cdd42[_0xaa41('0x9')]){logger[_0xaa41('0x23')](_0xaa41('0x37'),JSON[_0xaa41('0x38')](_0x4cdd42[_0xaa41('0x9')]));}}}catch(_0x21f204){logger['error'](_0xaa41('0x39'),_0x21f204[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')][_0xaa41('0xb')]=function(_0xc84fb8){try{if(this[_0xaa41('0x7')][_0xc84fb8['queue']]&&(this['voiceQueues'][_0xc84fb8[_0xaa41('0x1c')]]['acw']||this[_0xaa41('0x7')][_0xc84fb8[_0xaa41('0x1c')]][_0xaa41('0x3a')])){if(this[_0xaa41('0x8')][_0xc84fb8[_0xaa41('0x1b')]]){this[_0xaa41('0x1a')][_0xc84fb8[_0xaa41('0x2c')]]={'queue':_0xc84fb8['queue'],'interface':_0xc84fb8[_0xaa41('0x1b')],'destlinkedid':_0xc84fb8['destlinkedid']};}}}catch(_0x4dd842){logger[_0xaa41('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x4dd842['message']);}};Acw['prototype'][_0xaa41('0x14')]=function(_0x525b09){try{if(this[_0xaa41('0x7')][_0x525b09[_0xaa41('0x1c')]]&&(this['voiceQueues'][_0x525b09['queue']][_0xaa41('0x4')]||this[_0xaa41('0x7')][_0x525b09[_0xaa41('0x1c')]][_0xaa41('0x3a')])){if(this[_0xaa41('0x8')][_0x525b09[_0xaa41('0x1b')]]){this[_0xaa41('0x1a')][_0x525b09[_0xaa41('0x2c')]]={'queue':_0x525b09[_0xaa41('0x1c')],'interface':_0x525b09['interface']};}}}catch(_0x2eec35){logger[_0xaa41('0x2e')](_0xaa41('0x3b'),_0x2eec35[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')][_0xaa41('0xd')]=function(_0x538b12){try{if(this[_0xaa41('0x1a')][_0x538b12[_0xaa41('0x2c')]]&&_[_0xaa41('0x3c')](this[_0xaa41('0x1a')][_0x538b12['uniqueid']][_0xaa41('0x24')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x538b12[_0xaa41('0x2c')]);this[_0xaa41('0x19')](_0x538b12[_0xaa41('0x2c')]);}else if(this['channels'][_0x538b12[_0xaa41('0x3d')]]&&_[_0xaa41('0x3c')](this[_0xaa41('0x1a')][_0x538b12['linkedid']][_0xaa41('0x24')])){logger[_0xaa41('0x23')](_0xaa41('0x3e'),_0x538b12[_0xaa41('0x3d')]);this[_0xaa41('0x19')](_0x538b12[_0xaa41('0x3d')]);}}catch(_0x333a9f){logger[_0xaa41('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x333a9f[_0xaa41('0x32')]);}};Acw['prototype']['syncHangup']=function(_0x1bdcd6){try{if(this[_0xaa41('0x1a')][_0x1bdcd6[_0xaa41('0x2c')]]&&this[_0xaa41('0x1a')][_0x1bdcd6[_0xaa41('0x2c')]][_0xaa41('0x24')]){logger[_0xaa41('0x23')](_0xaa41('0x3f'),_0x1bdcd6['uniqueid']);this[_0xaa41('0x19')](_0x1bdcd6[_0xaa41('0x2c')]);}else if(this[_0xaa41('0x1a')][_0x1bdcd6['linkedid']]&&this[_0xaa41('0x1a')][_0x1bdcd6[_0xaa41('0x3d')]]['attended']){logger[_0xaa41('0x23')](_0xaa41('0x40'),_0x1bdcd6[_0xaa41('0x3d')]);this['startAcw'](_0x1bdcd6[_0xaa41('0x3d')]);}}catch(_0xc8e626){logger['error']('[ACW][syncHangup]\x20%s',_0xc8e626[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')][_0xaa41('0x13')]=function(_0x4d20c6){try{if(!_[_0xaa41('0x41')](this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x42')]])){this[_0xaa41('0x19')](_0x4d20c6[_0xaa41('0x42')]);if(this['channels'][_0x4d20c6[_0xaa41('0x43')]]){this['channels'][_0x4d20c6['secondtransfereruniqueid']][_0xaa41('0x24')]=!![];this['channels'][_0x4d20c6[_0xaa41('0x44')]]=this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x43')]];delete this['channels'][_0x4d20c6[_0xaa41('0x43')]];}}else if(!_[_0xaa41('0x41')](this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x44')]])){this[_0xaa41('0x19')](_0x4d20c6[_0xaa41('0x44')]);if(this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x45')]]){this[_0xaa41('0x1a')][_0x4d20c6['origtransfereruniqueid']][_0xaa41('0x24')]=!![];this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x42')]]=this['channels'][_0x4d20c6[_0xaa41('0x45')]];delete this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x45')]];}}}catch(_0x134579){logger[_0xaa41('0x2e')](_0xaa41('0x46'),_0x134579[_0xaa41('0x32')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x5cb34d){try{if(this['channels'][_0x5cb34d['transfereruniqueid']]){logger['info'](_0xaa41('0x47'),JSON['stringify'](_0x5cb34d['transfereruniqueid']));this[_0xaa41('0x19')](_0x5cb34d[_0xaa41('0x48')]);}else if(this[_0xaa41('0x1a')][_0x5cb34d[_0xaa41('0x49')]]){logger['info'](_0xaa41('0x4a'),JSON[_0xaa41('0x38')](_0x5cb34d[_0xaa41('0x49')]));this[_0xaa41('0x19')](_0x5cb34d[_0xaa41('0x49')]);}}catch(_0x41ca40){logger[_0xaa41('0x2e')](_0xaa41('0x4b'),_0x41ca40[_0xaa41('0x32')]);}};Acw['prototype'][_0xaa41('0x12')]=function(_0x2d2af8){try{if(this['voiceQueues'][_0x2d2af8['queue']]&&this['voiceQueues'][_0x2d2af8[_0xaa41('0x1c')]]['autopause']===_0xaa41('0x4c')){if(this['agents'][_0x2d2af8[_0xaa41('0x1b')]]){logger[_0xaa41('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x2d2af8[_0xaa41('0x2c')],_0x2d2af8[_0xaa41('0x1b')],_0x2d2af8[_0xaa41('0x1c')]);return RpcUser[_0xaa41('0x4d')](this['agents'][_0x2d2af8['interface']],_0xaa41('0x4e'),_0x2d2af8[_0xaa41('0x2c')]);}}}catch(_0x4d6d0c){logger['error'](_0xaa41('0x4f'),_0x4d6d0c[_0xaa41('0x32')]);}};module[_0xaa41('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 8859016..77d5894 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 _0x08d6=['inspect','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','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\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','../../config/environment','port','asterisk','username','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x366776,_0x48f0bf){var _0x34e2ad=function(_0xb7dfb0){while(--_0xb7dfb0){_0x366776['push'](_0x366776['shift']());}};_0x34e2ad(++_0x48f0bf);}(_0x08d6,0x1a9));var _0x608d=function(_0x1cc711,_0x4e2707){_0x1cc711=_0x1cc711-0x0;var _0x3acc03=_0x08d6[_0x1cc711];return _0x3acc03;};'use strict';var Manager=require(_0x608d('0x0'));var BPromise=require(_0x608d('0x1'));var moment=require(_0x608d('0x2'));var util=require(_0x608d('0x3'));var _=require(_0x608d('0x4'));var logger=require(_0x608d('0x5'))('ami');var config=require(_0x608d('0x6'));var ami=new Manager(config['asterisk'][_0x608d('0x7')],config[_0x608d('0x8')]['ip'],config[_0x608d('0x8')][_0x608d('0x9')],config[_0x608d('0x8')]['password'],!![]);ami[_0x608d('0xa')]();ami[_0x608d('0xb')]=BPromise[_0x608d('0xc')](ami[_0x608d('0xd')]);function error(_0x1fec98){logger[_0x608d('0xe')](util[_0x608d('0xf')](_0x608d('0x10'),config[_0x608d('0x8')][_0x608d('0x9')],config[_0x608d('0x8')]['ip'],config['asterisk'][_0x608d('0x7')],util[_0x608d('0x11')](_0x1fec98,![],null)));}function close(){logger[_0x608d('0xe')](util[_0x608d('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x608d('0x8')]['username'],config[_0x608d('0x8')]['ip'],config[_0x608d('0x8')]['port']));}ami[_0x608d('0x12')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x608d('0x13')]=function(){return function(){return ami[_0x608d('0xb')]({'action':'devicestatelist'});};};ami[_0x608d('0x14')]=function(){return function(){return ami[_0x608d('0xb')]({'action':'sippeerstatus'});};};ami[_0x608d('0x15')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0x608d('0x16')});};};function connect(_0x15699a){logger[_0x608d('0x17')](util[_0x608d('0xf')](_0x608d('0x18'),config['asterisk']['username'],config[_0x608d('0x8')]['ip'],config[_0x608d('0x8')][_0x608d('0x7')]));ami[_0x608d('0x19')](_0x608d('0xe'),error);ami[_0x608d('0x19')](_0x608d('0x1a'),close);}ami['on'](_0x608d('0x1b'),connect);ami['on'](_0x608d('0x1c'),function(_0x47d248){logger[_0x608d('0x17')](util[_0x608d('0xf')](_0x608d('0x1d'),config[_0x608d('0x8')][_0x608d('0x9')],config[_0x608d('0x8')]['ip'],config[_0x608d('0x8')]['port'],util[_0x608d('0x11')](_0x47d248,![],null)));});ami['on']('fullybooted',function(_0x126550){logger[_0x608d('0x17')](util[_0x608d('0xf')](_0x608d('0x1e'),config[_0x608d('0x8')][_0x608d('0x9')],config[_0x608d('0x8')]['ip'],config[_0x608d('0x8')][_0x608d('0x7')]));return BPromise[_0x608d('0x1f')]()[_0x608d('0x20')](ami[_0x608d('0x12')]())['then'](ami['actionDeviceStateList']())[_0x608d('0x20')](ami[_0x608d('0x14')]())['then'](ami[_0x608d('0x15')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x20433a){console[_0x608d('0x21')](_0x20433a);});});ami['once'](_0x608d('0xe'),error);ami[_0x608d('0x19')](_0x608d('0x1a'),close);module['exports']=ami; \ No newline at end of file +var _0xa2a8=['exports','asterisk-manager','moment','lodash','port','username','password','keepConnected','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','asterisk','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch'];(function(_0x37564b,_0x5b7e5b){var _0x12a817=function(_0x4cc01c){while(--_0x4cc01c){_0x37564b['push'](_0x37564b['shift']());}};_0x12a817(++_0x5b7e5b);}(_0xa2a8,0x1dd));var _0x8a2a=function(_0x243439,_0x89863d){_0x243439=_0x243439-0x0;var _0x48b04d=_0xa2a8[_0x243439];return _0x48b04d;};'use strict';var Manager=require(_0x8a2a('0x0'));var BPromise=require('bluebird');var moment=require(_0x8a2a('0x1'));var util=require('util');var _=require(_0x8a2a('0x2'));var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x8a2a('0x3')],config['asterisk']['ip'],config['asterisk'][_0x8a2a('0x4')],config['asterisk'][_0x8a2a('0x5')],!![]);ami[_0x8a2a('0x6')]();ami['Action']=BPromise['promisify'](ami['action']);function error(_0x58203e){logger[_0x8a2a('0x7')](util['format'](_0x8a2a('0x8'),config['asterisk'][_0x8a2a('0x4')],config[_0x8a2a('0x9')]['ip'],config[_0x8a2a('0x9')]['port'],util[_0x8a2a('0xa')](_0x58203e,![],null)));}function close(){logger[_0x8a2a('0x7')](util['format'](_0x8a2a('0xb'),config['asterisk'][_0x8a2a('0x4')],config['asterisk']['ip'],config[_0x8a2a('0x9')][_0x8a2a('0x3')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x8a2a('0xc')]({'action':_0x8a2a('0xd')});};};ami[_0x8a2a('0xe')]=function(){return function(){return ami[_0x8a2a('0xc')]({'action':_0x8a2a('0xf')});};};ami[_0x8a2a('0x10')]=function(){return function(){return ami[_0x8a2a('0xc')]({'action':_0x8a2a('0x11')});};};ami[_0x8a2a('0x12')]=function(){return function(){return ami[_0x8a2a('0xc')]({'action':'queuesummary'});};};ami[_0x8a2a('0x13')]=function(){return function(){return ami[_0x8a2a('0xc')]({'action':_0x8a2a('0x14')});};};function connect(_0x49b9cd){logger[_0x8a2a('0x15')](util[_0x8a2a('0x16')](_0x8a2a('0x17'),config[_0x8a2a('0x9')][_0x8a2a('0x4')],config[_0x8a2a('0x9')]['ip'],config[_0x8a2a('0x9')][_0x8a2a('0x3')]));ami['once'](_0x8a2a('0x7'),error);ami[_0x8a2a('0x18')](_0x8a2a('0x19'),close);}ami['on']('connect',connect);ami['on'](_0x8a2a('0x1a'),function(_0xe4e06e){logger[_0x8a2a('0x15')](util[_0x8a2a('0x16')](_0x8a2a('0x1b'),config[_0x8a2a('0x9')][_0x8a2a('0x4')],config[_0x8a2a('0x9')]['ip'],config[_0x8a2a('0x9')][_0x8a2a('0x3')],util[_0x8a2a('0xa')](_0xe4e06e,![],null)));});ami['on']('fullybooted',function(_0x35f621){logger[_0x8a2a('0x15')](util[_0x8a2a('0x16')](_0x8a2a('0x1c'),config[_0x8a2a('0x9')][_0x8a2a('0x4')],config[_0x8a2a('0x9')]['ip'],config[_0x8a2a('0x9')]['port']));return BPromise[_0x8a2a('0x1d')]()[_0x8a2a('0x1e')](ami[_0x8a2a('0x1f')]())[_0x8a2a('0x1e')](ami[_0x8a2a('0xe')]())[_0x8a2a('0x1e')](ami['actionSipPeerStatus']())[_0x8a2a('0x1e')](ami[_0x8a2a('0x12')]())[_0x8a2a('0x1e')](ami[_0x8a2a('0x13')]())[_0x8a2a('0x20')](function(_0xb3b506){console['log'](_0xb3b506);});});ami[_0x8a2a('0x18')](_0x8a2a('0x7'),error);ami['once'](_0x8a2a('0x19'),close);module[_0x8a2a('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index b30d54e..2c45a40 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 _0xd795=['../../config/logger','ami','client','http','Request','debug','memberReport','error','rpc','message','exports','jayson/promise'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd795,0x11f));var _0x5d79=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd795[_0x4fde08];return _0x12e725;};'use strict';var jayson=require(_0x5d79('0x0'));var BPromise=require('bluebird');var logger=require(_0x5d79('0x1'))(_0x5d79('0x2'));var client=jayson[_0x5d79('0x3')][_0x5d79('0x4')]({'port':0x2329});client[_0x5d79('0x5')]=function(_0x1e6a01,_0x4673ee){return new BPromise(function(_0x3958b8,_0x46ae64){return client['request'](_0x1e6a01,_0x4673ee)['then'](function(_0x3394c8){logger[_0x5d79('0x6')]('rpc',_0x5d79('0x7'),_0x1e6a01,_0x4673ee,_0x3394c8);if(_0x3394c8[_0x5d79('0x8')]){logger[_0x5d79('0x8')](_0x5d79('0x9'),_0x5d79('0x7'),_0x1e6a01,_0x3394c8[_0x5d79('0x8')][_0x5d79('0xa')],_0x4673ee);return _0x46ae64(_0x3394c8[_0x5d79('0x8')]['message']);}else{return _0x3958b8(_0x3394c8['result']);}})['catch'](function(_0x3a9e2c){logger[_0x5d79('0x8')]('rpc',_0x5d79('0x7'),_0x1e6a01,_0x3a9e2c,_0x4673ee);return _0x46ae64(_0x3a9e2c);});});};module[_0x5d79('0xb')]=client; \ No newline at end of file +var _0x9546=['../../config/logger','request','then','debug','rpc','error','memberReport','message','result','catch','exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x9546,0x1ef));var _0x6954=function(_0x3dc96c,_0x4b8246){_0x3dc96c=_0x3dc96c-0x0;var _0x1f3df7=_0x9546[_0x3dc96c];return _0x1f3df7;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x6954('0x0'))('ami');var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x311e5a,_0x15075e){return new BPromise(function(_0x4427a5,_0x5209f6){return client[_0x6954('0x1')](_0x311e5a,_0x15075e)[_0x6954('0x2')](function(_0x220cd8){logger[_0x6954('0x3')](_0x6954('0x4'),'memberReport',_0x311e5a,_0x15075e,_0x220cd8);if(_0x220cd8[_0x6954('0x5')]){logger[_0x6954('0x5')]('rpc',_0x6954('0x6'),_0x311e5a,_0x220cd8[_0x6954('0x5')]['message'],_0x15075e);return _0x5209f6(_0x220cd8[_0x6954('0x5')][_0x6954('0x7')]);}else{return _0x4427a5(_0x220cd8[_0x6954('0x8')]);}})[_0x6954('0x9')](function(_0x4f71d4){logger[_0x6954('0x5')](_0x6954('0x4'),_0x6954('0x6'),_0x311e5a,_0x4f71d4,_0x15075e);return _0x5209f6(_0x4f71d4);});});};module[_0x6954('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 062be8e..475e818 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 _0xb4f4=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','substring','dialCutDigit','getQueue','queue','util','lodash','string','isNil','voiceQueue','Contact','phone','firstName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0xb4f4,0xda));var _0x4b4f=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xb4f4[_0x2080a3];return _0x8d7d17;};'use strict';var util=require(_0x4b4f('0x0'));var _=require(_0x4b4f('0x1'));var moment=require('moment');function checkNameSurname(_0x42ab58,_0x2da113,_0x9d3e48){var _0x45d082='';if(!_['isNil'](_0x2da113)&&_0x4b4f('0x2')===typeof _0x2da113){_0x45d082+=_0x2da113;}if(!_[_0x4b4f('0x3')](_0x9d3e48)&&_0x4b4f('0x2')===typeof _0x9d3e48){_0x45d082+='\x20'+_0x9d3e48;}if(_0x45d082!==''){return _0x45d082;}return _0x42ab58;}function Action(_0x183a72,_0x1faad4,_0x15e02e){this[_0x4b4f('0x4')]=_0x183a72;this['uniqueid']=_0x15e02e||undefined;this['name']=checkNameSurname(_0x1faad4[_0x4b4f('0x5')][_0x4b4f('0x6')],_0x1faad4[_0x4b4f('0x5')][_0x4b4f('0x7')],_0x1faad4[_0x4b4f('0x5')]['lastName']);this[_0x4b4f('0x8')]=_0x1faad4[_0x4b4f('0x5')][_0x4b4f('0x6')];this['queue']=_0x183a72[_0x4b4f('0x9')];this[_0x4b4f('0xa')]=_0x1faad4['active']||![];this[_0x4b4f('0xb')]=_0x183a72[_0x4b4f('0xb')];this[_0x4b4f('0xc')]=_0x183a72[_0x4b4f('0xc')]||0x3;this[_0x4b4f('0xd')]=_0x1faad4[_0x4b4f('0xd')];this[_0x4b4f('0xe')]=_0x1faad4[_0x4b4f('0xe')];this['countcongestionretry']=_0x1faad4['countcongestionretry'];this[_0x4b4f('0xf')]=_0x1faad4[_0x4b4f('0xf')];this['countnosuchnumberretry']=_0x1faad4[_0x4b4f('0x10')];this[_0x4b4f('0x11')]=_0x1faad4[_0x4b4f('0x11')];this['countabandonedretry']=_0x1faad4[_0x4b4f('0x12')];this[_0x4b4f('0x13')]=_0x1faad4[_0x4b4f('0x13')];this['countagentrejectretry']=_0x1faad4[_0x4b4f('0x14')];this[_0x4b4f('0x15')]=_0x1faad4[_0x4b4f('0x15')];this[_0x4b4f('0x16')]=_0x1faad4[_0x4b4f('0x16')];this[_0x4b4f('0x17')]=_0x1faad4[_0x4b4f('0x17')];this[_0x4b4f('0x18')]=_0x1faad4[_0x4b4f('0x18')];this['CampaignId']=_0x1faad4[_0x4b4f('0x19')];this[_0x4b4f('0x1a')]=_0x1faad4['id'];this[_0x4b4f('0x1b')]=_0x1faad4[_0x4b4f('0x5')][_0x4b4f('0x7')]||'';this[_0x4b4f('0x1c')]=moment()[_0x4b4f('0x1d')](_0x4b4f('0x1e'));this[_0x4b4f('0x1f')]=_0x1faad4[_0x4b4f('0x1f')];this[_0x4b4f('0x20')]=_0x1faad4['callbackuniqueid'];this[_0x4b4f('0x21')]=_0x1faad4[_0x4b4f('0x21')];this[_0x4b4f('0x22')]=_0x1faad4['recallme'];this[_0x4b4f('0x23')]='';this['originatecalleridname']='';}Action[_0x4b4f('0x24')]['getCaller']=function(){return util[_0x4b4f('0x1d')]('\x22%s\x22\x20<%s>',this[_0x4b4f('0x9')],this[_0x4b4f('0x4')]['dialCutDigit']>0x0?this[_0x4b4f('0x8')][_0x4b4f('0x25')](this[_0x4b4f('0x4')][_0x4b4f('0x26')]):this[_0x4b4f('0x8')]);};Action[_0x4b4f('0x24')][_0x4b4f('0x27')]=function(){return this[_0x4b4f('0x28')];};module['exports']=Action; \ No newline at end of file +var _0x902b=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','voiceQueue','getQueue','util','moment','isNil','Contact','firstName','number','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x2557c8,_0x5edc43){var _0x585fc6=function(_0x573abb){while(--_0x573abb){_0x2557c8['push'](_0x2557c8['shift']());}};_0x585fc6(++_0x5edc43);}(_0x902b,0x6a));var _0xb902=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x902b[_0x243b59];return _0x3e1676;};'use strict';var util=require(_0xb902('0x0'));var _=require('lodash');var moment=require(_0xb902('0x1'));function checkNameSurname(_0x1dba3d,_0x26d7c7,_0x20a412){var _0xa2acb9='';if(!_[_0xb902('0x2')](_0x26d7c7)&&'string'===typeof _0x26d7c7){_0xa2acb9+=_0x26d7c7;}if(!_[_0xb902('0x2')](_0x20a412)&&'string'===typeof _0x20a412){_0xa2acb9+='\x20'+_0x20a412;}if(_0xa2acb9!==''){return _0xa2acb9;}return _0x1dba3d;}function Action(_0x98a793,_0x5d38bb,_0x157e14){this['voiceQueue']=_0x98a793;this['uniqueid']=_0x157e14||undefined;this['name']=checkNameSurname(_0x5d38bb['Contact']['phone'],_0x5d38bb[_0xb902('0x3')][_0xb902('0x4')],_0x5d38bb['Contact']['lastName']);this[_0xb902('0x5')]=_0x5d38bb[_0xb902('0x3')][_0xb902('0x6')];this[_0xb902('0x7')]=_0x98a793[_0xb902('0x8')];this[_0xb902('0x9')]=_0x5d38bb[_0xb902('0x9')]||![];this[_0xb902('0xa')]=_0x98a793['type'];this[_0xb902('0xb')]=_0x98a793[_0xb902('0xb')]||0x3;this[_0xb902('0xc')]=_0x5d38bb[_0xb902('0xc')];this['countbusyretry']=_0x5d38bb['countbusyretry'];this[_0xb902('0xd')]=_0x5d38bb[_0xb902('0xd')];this['countnoanswerretry']=_0x5d38bb[_0xb902('0xe')];this[_0xb902('0xf')]=_0x5d38bb[_0xb902('0xf')];this[_0xb902('0x10')]=_0x5d38bb[_0xb902('0x10')];this[_0xb902('0x11')]=_0x5d38bb['countabandonedretry'];this[_0xb902('0x12')]=_0x5d38bb[_0xb902('0x12')];this[_0xb902('0x13')]=_0x5d38bb[_0xb902('0x13')];this[_0xb902('0x14')]=_0x5d38bb['ContactId'];this[_0xb902('0x15')]=_0x5d38bb[_0xb902('0x15')];this[_0xb902('0x16')]=_0x5d38bb[_0xb902('0x16')];this['VoiceQueueId']=_0x5d38bb[_0xb902('0x17')];this['CampaignId']=_0x5d38bb[_0xb902('0x18')];this[_0xb902('0x19')]=_0x5d38bb['id'];this[_0xb902('0x1a')]=_0x5d38bb['Contact']['firstName']||'';this[_0xb902('0x1b')]=moment()[_0xb902('0x1c')](_0xb902('0x1d'));this['callback']=_0x5d38bb[_0xb902('0x1e')];this[_0xb902('0x1f')]=_0x5d38bb[_0xb902('0x1f')];this[_0xb902('0x20')]=_0x5d38bb[_0xb902('0x20')];this[_0xb902('0x21')]=_0x5d38bb[_0xb902('0x21')];this[_0xb902('0x22')]='';this[_0xb902('0x23')]='';}Action[_0xb902('0x24')]['getCaller']=function(){return util[_0xb902('0x1c')](_0xb902('0x25'),this[_0xb902('0x8')],this['voiceQueue'][_0xb902('0x26')]>0x0?this['number'][_0xb902('0x27')](this[_0xb902('0x28')]['dialCutDigit']):this[_0xb902('0x5')]);};Action[_0xb902('0x24')][_0xb902('0x29')]=function(){return this[_0xb902('0x7')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 37eedaa..4f97e9a 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 _0xd322=['countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x1ac80a,_0x436091){var _0x4e9b0d=function(_0x4ec89a){while(--_0x4ec89a){_0x1ac80a['push'](_0x1ac80a['shift']());}};_0x4e9b0d(++_0x436091);}(_0xd322,0x124));var _0x2d32=function(_0x327cef,_0x8b85a4){_0x327cef=_0x327cef-0x0;var _0x3c39f0=_0xd322[_0x327cef];return _0x3c39f0;};'use strict';var util=require(_0x2d32('0x0'));var _=require(_0x2d32('0x1'));var moment=require(_0x2d32('0x2'));function getSeconds(_0x9768d,_0x14aa7c){var _0xb1a2b2=moment(_0x9768d)[_0x2d32('0x3')](0x0);var _0x5383e3=moment(_0x14aa7c)['milliseconds'](0x0);return _0xb1a2b2['diff'](_0x5383e3,_0x2d32('0x4'));}function AdditionalPhone(_0x448280){this[_0x2d32('0x5')]=_0x448280[_0x2d32('0x5')];this[_0x2d32('0x6')]=_0x448280[_0x2d32('0x6')]||undefined;this['type']=_0x448280[_0x2d32('0x7')];this['campaigntype']=_0x448280[_0x2d32('0x7')]===_0x2d32('0x8')?'queue':_0x448280[_0x2d32('0x7')];this[_0x2d32('0x9')]=_0x448280[_0x2d32('0x9')];this[_0x2d32('0xa')]=_0x448280[_0x2d32('0xa')];this[_0x2d32('0xb')]=_0x448280[_0x2d32('0xb')];this['countglobal']=_0x448280[_0x2d32('0x9')]+_0x448280[_0x2d32('0xa')]+_0x448280[_0x2d32('0xb')]+_0x448280[_0x2d32('0xc')]+_0x448280['countdropretry']+_0x448280[_0x2d32('0xd')]+_0x448280[_0x2d32('0xe')]+_0x448280['countagentrejectretry'];this['countnosuchnumberretry']=_0x448280['countnosuchnumberretry'];this[_0x2d32('0xf')]=_0x448280[_0x2d32('0xf')];this[_0x2d32('0xd')]=_0x448280['countabandonedretry'];this[_0x2d32('0xe')]=_0x448280['countmachineretry'];this[_0x2d32('0x10')]=_0x448280['countagentrejectretry'];this[_0x2d32('0x11')]=_0x448280['queue'];this[_0x2d32('0x12')]=_0x448280[_0x2d32('0x13')];this[_0x2d32('0x14')]=_0x448280[_0x2d32('0x15')];this[_0x2d32('0x16')]=_0x448280[_0x2d32('0x16')];this[_0x2d32('0x17')]=_0x448280['responsetime'];this[_0x2d32('0x18')]=_0x448280[_0x2d32('0x17')];this[_0x2d32('0x19')]=getSeconds(_0x448280[_0x2d32('0x17')],_0x448280[_0x2d32('0x16')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x2d32('0x1a')]=_0x448280['callback'];this[_0x2d32('0x1b')]=_0x448280['callbackuniqueid'];this['callbackat']=_0x448280[_0x2d32('0x1c')];this[_0x2d32('0x1d')]=_0x448280['recallme'];this['ContactId']=_0x448280[_0x2d32('0x1e')];this[_0x2d32('0x1f')]=_0x448280[_0x2d32('0x1f')];this[_0x2d32('0x20')]=_0x448280[_0x2d32('0x20')];this[_0x2d32('0x21')]=_0x448280[_0x2d32('0x21')];this[_0x2d32('0x22')]=_0x448280[_0x2d32('0x22')];this[_0x2d32('0x23')]=_0x448280[_0x2d32('0x23')]||'';this[_0x2d32('0x24')]=_0x448280[_0x2d32('0x24')]||'';}module[_0x2d32('0x25')]=History; \ No newline at end of file +var _0x4bcb=['calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x4bcb,0x168));var _0xb4bc=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0x4bcb[_0x5534fe];return _0x3d1dc2;};'use strict';var util=require(_0xb4bc('0x0'));var _=require(_0xb4bc('0x1'));var moment=require(_0xb4bc('0x2'));function getSeconds(_0x441693,_0x18425d){var _0x3fe28e=moment(_0x441693)['milliseconds'](0x0);var _0x38e4f8=moment(_0x18425d)[_0xb4bc('0x3')](0x0);return _0x3fe28e[_0xb4bc('0x4')](_0x38e4f8,_0xb4bc('0x5'));}function AdditionalPhone(_0x5c430a){this[_0xb4bc('0x6')]=_0x5c430a[_0xb4bc('0x6')];this['scheduledat']=_0x5c430a['scheduledat']||undefined;this[_0xb4bc('0x7')]=_0x5c430a[_0xb4bc('0x7')];this[_0xb4bc('0x8')]=_0x5c430a[_0xb4bc('0x7')]===_0xb4bc('0x9')?_0xb4bc('0xa'):_0x5c430a[_0xb4bc('0x7')];this[_0xb4bc('0xb')]=_0x5c430a[_0xb4bc('0xb')];this[_0xb4bc('0xc')]=_0x5c430a[_0xb4bc('0xc')];this[_0xb4bc('0xd')]=_0x5c430a[_0xb4bc('0xd')];this[_0xb4bc('0xe')]=_0x5c430a[_0xb4bc('0xb')]+_0x5c430a[_0xb4bc('0xc')]+_0x5c430a[_0xb4bc('0xd')]+_0x5c430a[_0xb4bc('0xf')]+_0x5c430a[_0xb4bc('0x10')]+_0x5c430a[_0xb4bc('0x11')]+_0x5c430a[_0xb4bc('0x12')]+_0x5c430a[_0xb4bc('0x13')];this[_0xb4bc('0xf')]=_0x5c430a['countnosuchnumberretry'];this[_0xb4bc('0x10')]=_0x5c430a[_0xb4bc('0x10')];this[_0xb4bc('0x11')]=_0x5c430a['countabandonedretry'];this[_0xb4bc('0x12')]=_0x5c430a['countmachineretry'];this[_0xb4bc('0x13')]=_0x5c430a['countagentrejectretry'];this[_0xb4bc('0xa')]=_0x5c430a[_0xb4bc('0xa')];this[_0xb4bc('0x14')]=_0x5c430a[_0xb4bc('0x15')];this[_0xb4bc('0x16')]=_0x5c430a['number'];this[_0xb4bc('0x17')]=_0x5c430a[_0xb4bc('0x17')];this['responsetime']=_0x5c430a[_0xb4bc('0x18')];this[_0xb4bc('0x19')]=_0x5c430a['responsetime'];this[_0xb4bc('0x1a')]=getSeconds(_0x5c430a[_0xb4bc('0x18')],_0x5c430a[_0xb4bc('0x17')]);this[_0xb4bc('0x1b')]=0x0;this['talktime']=0x0;this[_0xb4bc('0x1c')]=_0x5c430a['callback'];this[_0xb4bc('0x1d')]=_0x5c430a[_0xb4bc('0x1d')];this[_0xb4bc('0x1e')]=_0x5c430a[_0xb4bc('0x1e')];this[_0xb4bc('0x1f')]=_0x5c430a[_0xb4bc('0x1f')];this['ContactId']=_0x5c430a[_0xb4bc('0x20')];this[_0xb4bc('0x21')]=_0x5c430a[_0xb4bc('0x21')];this[_0xb4bc('0x22')]=_0x5c430a[_0xb4bc('0x22')];this['VoiceQueueId']=_0x5c430a[_0xb4bc('0x23')];this[_0xb4bc('0x24')]=_0x5c430a['CampaignId'];this['originatecalleridnum']=_0x5c430a['originatecalleridnum']||'';this['originatecalleridname']=_0x5c430a[_0xb4bc('0x25')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index a3e8023..dd664bd 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 _0x7f50=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry'];(function(_0x4aac5d,_0x52c50a){var _0x1610e1=function(_0x20d2e9){while(--_0x20d2e9){_0x4aac5d['push'](_0x4aac5d['shift']());}};_0x1610e1(++_0x52c50a);}(_0x7f50,0x1c8));var _0x07f5=function(_0x684076,_0x315f4d){_0x684076=_0x684076-0x0;var _0xc8e750=_0x7f50[_0x684076];return _0xc8e750;};'use strict';var util=require(_0x07f5('0x0'));var _=require('lodash');var moment=require(_0x07f5('0x1'));function getSeconds(_0x40ca81,_0x2b48f1){var _0x4192e4=moment(_0x40ca81)[_0x07f5('0x2')](0x0);var _0x27fb45=moment(_0x2b48f1)['milliseconds'](0x0);return _0x4192e4[_0x07f5('0x3')](_0x27fb45,_0x07f5('0x4'));}function AgentComplete(_0x5061e5,_0x5d2dca){this[_0x07f5('0x5')]=0x4;this[_0x07f5('0x6')]=_0x07f5('0x7');this[_0x07f5('0x8')]=_0x5061e5['scheduledat'];this[_0x07f5('0x9')]=_0x5061e5[_0x07f5('0x9')];this[_0x07f5('0xa')]=_0x5061e5[_0x07f5('0x9')]===_0x07f5('0xb')?'queue':_0x5061e5[_0x07f5('0x9')];this[_0x07f5('0xc')]=_0x5061e5[_0x07f5('0xc')];this['countcongestionretry']=_0x5061e5[_0x07f5('0xd')];this[_0x07f5('0xe')]=_0x5061e5['countnoanswerretry'];this['countglobal']=_0x5061e5['countbusyretry']+_0x5061e5[_0x07f5('0xd')]+_0x5061e5[_0x07f5('0xe')]+_0x5061e5[_0x07f5('0xf')]+_0x5061e5[_0x07f5('0x10')]+_0x5061e5[_0x07f5('0x11')]+_0x5061e5[_0x07f5('0x12')]+_0x5061e5['countagentrejectretry'];this[_0x07f5('0xf')]=_0x5061e5[_0x07f5('0xf')];this[_0x07f5('0x10')]=_0x5061e5[_0x07f5('0x10')];this[_0x07f5('0x11')]=_0x5061e5[_0x07f5('0x11')];this[_0x07f5('0x12')]=_0x5061e5['countmachineretry'];this[_0x07f5('0x13')]=_0x5061e5['countagentrejectretry'];this[_0x07f5('0x14')]=_0x5d2dca['uniqueid'];this['calleridname']=_0x5061e5[_0x07f5('0x15')];this[_0x07f5('0x16')]=_0x5061e5[_0x07f5('0x17')];this[_0x07f5('0x18')]=_0x5061e5[_0x07f5('0x18')];this['responsetime']=_0x5061e5[_0x07f5('0x19')];this['answertime']=_0x5061e5[_0x07f5('0x1a')];this[_0x07f5('0x1b')]=moment()[_0x07f5('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x07f5('0x1d')]=getSeconds(_0x5061e5[_0x07f5('0x19')],_0x5061e5[_0x07f5('0x18')]);this[_0x07f5('0x1e')]=getSeconds(_0x5061e5[_0x07f5('0x1a')],_0x5061e5[_0x07f5('0x19')]);this[_0x07f5('0x1f')]=getSeconds(this[_0x07f5('0x1b')],_0x5061e5['answertime']);this[_0x07f5('0x20')]=_0x5d2dca[_0x07f5('0x20')];this[_0x07f5('0x21')]=_0x5d2dca['membername'];this[_0x07f5('0x22')]=_0x5d2dca[_0x07f5('0x22')];this[_0x07f5('0x23')]=_0x5061e5['callback'];this[_0x07f5('0x24')]=_0x5061e5['callbackuniqueid'];this[_0x07f5('0x25')]=_0x5061e5['callbackat'];this[_0x07f5('0x26')]=_0x5061e5[_0x07f5('0x26')];this['ContactId']=_0x5061e5[_0x07f5('0x27')];this[_0x07f5('0x28')]=_0x5061e5[_0x07f5('0x28')];this[_0x07f5('0x29')]=_0x5061e5['UserId'];this[_0x07f5('0x2a')]=_0x5061e5[_0x07f5('0x2a')];this[_0x07f5('0x2b')]=_0x5061e5[_0x07f5('0x2b')];this['originatecalleridnum']=_0x5061e5[_0x07f5('0x2c')]||'';this['originatecalleridname']=_0x5061e5[_0x07f5('0x2d')]||'';}module[_0x07f5('0x2e')]=AgentComplete; \ No newline at end of file +var _0xb47d=['type','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat'];(function(_0x23355e,_0x584a54){var _0x433468=function(_0x5d326b){while(--_0x5d326b){_0x23355e['push'](_0x23355e['shift']());}};_0x433468(++_0x584a54);}(_0xb47d,0x1e5));var _0xdb47=function(_0x15a11c,_0x2dec34){_0x15a11c=_0x15a11c-0x0;var _0x3041d2=_0xb47d[_0x15a11c];return _0x3041d2;};'use strict';var util=require(_0xdb47('0x0'));var _=require(_0xdb47('0x1'));var moment=require(_0xdb47('0x2'));function getSeconds(_0x472edf,_0x5316f0){var _0x596aeb=moment(_0x472edf)[_0xdb47('0x3')](0x0);var _0x19f5fd=moment(_0x5316f0)[_0xdb47('0x3')](0x0);return _0x596aeb[_0xdb47('0x4')](_0x19f5fd,_0xdb47('0x5'));}function AgentComplete(_0x620451,_0x2fcabf){this[_0xdb47('0x6')]=0x4;this[_0xdb47('0x7')]=_0xdb47('0x8');this[_0xdb47('0x9')]=_0x620451[_0xdb47('0x9')];this['type']=_0x620451[_0xdb47('0xa')];this['campaigntype']=_0x620451['type']===_0xdb47('0xb')?_0xdb47('0xc'):_0x620451[_0xdb47('0xa')];this[_0xdb47('0xd')]=_0x620451['countbusyretry'];this['countcongestionretry']=_0x620451['countcongestionretry'];this[_0xdb47('0xe')]=_0x620451['countnoanswerretry'];this['countglobal']=_0x620451[_0xdb47('0xd')]+_0x620451[_0xdb47('0xf')]+_0x620451[_0xdb47('0xe')]+_0x620451[_0xdb47('0x10')]+_0x620451[_0xdb47('0x11')]+_0x620451[_0xdb47('0x12')]+_0x620451[_0xdb47('0x13')]+_0x620451[_0xdb47('0x14')];this['countnosuchnumberretry']=_0x620451[_0xdb47('0x10')];this[_0xdb47('0x11')]=_0x620451[_0xdb47('0x11')];this[_0xdb47('0x12')]=_0x620451['countabandonedretry'];this[_0xdb47('0x13')]=_0x620451[_0xdb47('0x13')];this[_0xdb47('0x14')]=_0x620451['countagentrejectretry'];this[_0xdb47('0x15')]=_0x2fcabf[_0xdb47('0x15')];this['calleridname']=_0x620451[_0xdb47('0x16')];this[_0xdb47('0x17')]=_0x620451[_0xdb47('0x18')];this[_0xdb47('0x19')]=_0x620451['starttime'];this[_0xdb47('0x1a')]=_0x620451[_0xdb47('0x1a')];this[_0xdb47('0x1b')]=_0x620451[_0xdb47('0x1b')];this[_0xdb47('0x1c')]=moment()[_0xdb47('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xdb47('0x1e')]=getSeconds(_0x620451[_0xdb47('0x1a')],_0x620451[_0xdb47('0x19')]);this[_0xdb47('0x1f')]=getSeconds(_0x620451['answertime'],_0x620451[_0xdb47('0x1a')]);this[_0xdb47('0x20')]=getSeconds(this[_0xdb47('0x1c')],_0x620451[_0xdb47('0x1b')]);this[_0xdb47('0xc')]=_0x2fcabf[_0xdb47('0xc')];this[_0xdb47('0x21')]=_0x2fcabf[_0xdb47('0x21')];this[_0xdb47('0x22')]=_0x2fcabf['reason'];this[_0xdb47('0x23')]=_0x620451['callback'];this[_0xdb47('0x24')]=_0x620451[_0xdb47('0x24')];this['callbackat']=_0x620451['callbackat'];this[_0xdb47('0x25')]=_0x620451[_0xdb47('0x25')];this[_0xdb47('0x26')]=_0x620451[_0xdb47('0x26')];this[_0xdb47('0x27')]=_0x620451['ListId'];this[_0xdb47('0x28')]=_0x620451[_0xdb47('0x28')];this[_0xdb47('0x29')]=_0x620451[_0xdb47('0x29')];this['CampaignId']=_0x620451['CampaignId'];this[_0xdb47('0x2a')]=_0x620451[_0xdb47('0x2a')]||'';this[_0xdb47('0x2b')]=_0x620451[_0xdb47('0x2b')]||'';}module[_0xdb47('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 a89a292..1348c96 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 _0x3d83=['countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x49c69c,_0x2e6150){var _0x55cdd2=function(_0x12afe3){while(--_0x12afe3){_0x49c69c['push'](_0x49c69c['shift']());}};_0x55cdd2(++_0x2e6150);}(_0x3d83,0x197));var _0x33d8=function(_0x50cf06,_0x3bb225){_0x50cf06=_0x50cf06-0x0;var _0x49f577=_0x3d83[_0x50cf06];return _0x49f577;};'use strict';var util=require('util');var _=require(_0x33d8('0x0'));var moment=require(_0x33d8('0x1'));function getSeconds(_0x467699,_0x1d47e6){var _0x39b1ce=moment(_0x467699)[_0x33d8('0x2')](0x0);var _0x1f2be2=moment(_0x1d47e6)[_0x33d8('0x2')](0x0);return _0x39b1ce['diff'](_0x1f2be2,_0x33d8('0x3'));}function Final(_0x4711e8){this[_0x33d8('0x4')]=_0x4711e8[_0x33d8('0x4')];this[_0x33d8('0x5')]=_0x4711e8[_0x33d8('0x5')];this[_0x33d8('0x6')]=_0x4711e8[_0x33d8('0x6')];this[_0x33d8('0x7')]=_0x4711e8[_0x33d8('0x6')]===_0x33d8('0x8')?_0x33d8('0x9'):_0x4711e8[_0x33d8('0x6')];this[_0x33d8('0xa')]=_0x4711e8[_0x33d8('0xa')];this['countcongestionretry']=_0x4711e8['countcongestionretry'];this[_0x33d8('0xb')]=_0x4711e8[_0x33d8('0xb')];this['countglobal']=_0x4711e8[_0x33d8('0xa')]+_0x4711e8[_0x33d8('0xc')]+_0x4711e8[_0x33d8('0xb')]+_0x4711e8[_0x33d8('0xd')]+_0x4711e8[_0x33d8('0xe')]+_0x4711e8[_0x33d8('0xf')]+_0x4711e8[_0x33d8('0x10')]+_0x4711e8[_0x33d8('0x11')];this[_0x33d8('0xd')]=_0x4711e8[_0x33d8('0xd')];this[_0x33d8('0xe')]=_0x4711e8[_0x33d8('0xe')];this['countabandonedretry']=_0x4711e8[_0x33d8('0xf')];this[_0x33d8('0x10')]=_0x4711e8['countmachineretry'];this[_0x33d8('0x11')]=_0x4711e8[_0x33d8('0x11')];this['queue']=_0x4711e8[_0x33d8('0x9')];this['calleridname']=_0x4711e8[_0x33d8('0x12')];this[_0x33d8('0x13')]=_0x4711e8[_0x33d8('0x13')];this[_0x33d8('0x14')]=_0x4711e8['starttime'];this[_0x33d8('0x15')]=_0x4711e8['responsetime'];this[_0x33d8('0x16')]=_0x4711e8[_0x33d8('0x15')];this[_0x33d8('0x17')]=_0x4711e8[_0x33d8('0x17')]||0x0;this[_0x33d8('0x18')]=_0x4711e8[_0x33d8('0x18')]||0x0;this[_0x33d8('0x19')]=_0x4711e8[_0x33d8('0x19')]||0x0;this[_0x33d8('0x1a')]=_0x4711e8[_0x33d8('0x1a')];this[_0x33d8('0x1b')]=_0x4711e8[_0x33d8('0x1b')];this[_0x33d8('0x1c')]=_0x4711e8[_0x33d8('0x1c')];this['recallme']=_0x4711e8[_0x33d8('0x1d')];this['ContactId']=_0x4711e8[_0x33d8('0x1e')];this[_0x33d8('0x1f')]=_0x4711e8[_0x33d8('0x1f')];this[_0x33d8('0x20')]=_0x4711e8[_0x33d8('0x20')];this[_0x33d8('0x21')]=_0x4711e8[_0x33d8('0x21')];this['CampaignId']=_0x4711e8[_0x33d8('0x22')];this['originatecalleridnum']=_0x4711e8[_0x33d8('0x23')]||'';this[_0x33d8('0x24')]=_0x4711e8[_0x33d8('0x24')]||'';}module[_0x33d8('0x25')]=Final; \ No newline at end of file +var _0xde33=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x4e6605,_0x507557){var _0x12067c=function(_0x6154c){while(--_0x6154c){_0x4e6605['push'](_0x4e6605['shift']());}};_0x12067c(++_0x507557);}(_0xde33,0x1d3));var _0x3de3=function(_0x387ea0,_0x142434){_0x387ea0=_0x387ea0-0x0;var _0x53c083=_0xde33[_0x387ea0];return _0x53c083;};'use strict';var util=require(_0x3de3('0x0'));var _=require('lodash');var moment=require(_0x3de3('0x1'));function getSeconds(_0x6d351b,_0x357486){var _0x3a08c2=moment(_0x6d351b)['milliseconds'](0x0);var _0x36b60f=moment(_0x357486)['milliseconds'](0x0);return _0x3a08c2['diff'](_0x36b60f,_0x3de3('0x2'));}function Final(_0x1d3def){this['uniqueid']=_0x1d3def['uniqueid'];this[_0x3de3('0x3')]=_0x1d3def[_0x3de3('0x3')];this['type']=_0x1d3def[_0x3de3('0x4')];this[_0x3de3('0x5')]=_0x1d3def[_0x3de3('0x4')]===_0x3de3('0x6')?_0x3de3('0x7'):_0x1d3def['type'];this[_0x3de3('0x8')]=_0x1d3def['countbusyretry'];this['countcongestionretry']=_0x1d3def['countcongestionretry'];this[_0x3de3('0x9')]=_0x1d3def[_0x3de3('0x9')];this[_0x3de3('0xa')]=_0x1d3def[_0x3de3('0x8')]+_0x1d3def['countcongestionretry']+_0x1d3def[_0x3de3('0x9')]+_0x1d3def[_0x3de3('0xb')]+_0x1d3def[_0x3de3('0xc')]+_0x1d3def[_0x3de3('0xd')]+_0x1d3def['countmachineretry']+_0x1d3def[_0x3de3('0xe')];this[_0x3de3('0xb')]=_0x1d3def[_0x3de3('0xb')];this[_0x3de3('0xc')]=_0x1d3def[_0x3de3('0xc')];this[_0x3de3('0xd')]=_0x1d3def[_0x3de3('0xd')];this[_0x3de3('0xf')]=_0x1d3def[_0x3de3('0xf')];this['countagentrejectretry']=_0x1d3def['countagentrejectretry'];this[_0x3de3('0x7')]=_0x1d3def[_0x3de3('0x7')];this[_0x3de3('0x10')]=_0x1d3def[_0x3de3('0x10')];this[_0x3de3('0x11')]=_0x1d3def[_0x3de3('0x11')];this[_0x3de3('0x12')]=_0x1d3def[_0x3de3('0x12')];this[_0x3de3('0x13')]=_0x1d3def[_0x3de3('0x13')];this[_0x3de3('0x14')]=_0x1d3def[_0x3de3('0x13')];this['ringtime']=_0x1d3def[_0x3de3('0x15')]||0x0;this[_0x3de3('0x16')]=_0x1d3def['holdtime']||0x0;this[_0x3de3('0x17')]=_0x1d3def[_0x3de3('0x17')]||0x0;this[_0x3de3('0x18')]=_0x1d3def[_0x3de3('0x18')];this[_0x3de3('0x19')]=_0x1d3def[_0x3de3('0x19')];this[_0x3de3('0x1a')]=_0x1d3def[_0x3de3('0x1a')];this[_0x3de3('0x1b')]=_0x1d3def[_0x3de3('0x1b')];this['ContactId']=_0x1d3def[_0x3de3('0x1c')];this[_0x3de3('0x1d')]=_0x1d3def['ListId'];this[_0x3de3('0x1e')]=_0x1d3def[_0x3de3('0x1e')];this['VoiceQueueId']=_0x1d3def[_0x3de3('0x1f')];this[_0x3de3('0x20')]=_0x1d3def['CampaignId'];this[_0x3de3('0x21')]=_0x1d3def['originatecalleridnum']||'';this[_0x3de3('0x22')]=_0x1d3def[_0x3de3('0x22')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 6d3aaa6..570b84c 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 _0xf988=['queue','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime'];(function(_0x127f00,_0x58e241){var _0x1b38e7=function(_0x3e8822){while(--_0x3e8822){_0x127f00['push'](_0x127f00['shift']());}};_0x1b38e7(++_0x58e241);}(_0xf988,0x14d));var _0x8f98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf988[_0x122ef9];return _0x42fba0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8f98('0x0'));function getSeconds(_0x184caa,_0x4342fc){var _0x2f6900=moment(_0x184caa)[_0x8f98('0x1')](0x0);var _0x21fd46=moment(_0x4342fc)[_0x8f98('0x1')](0x0);return _0x2f6900[_0x8f98('0x2')](_0x21fd46,_0x8f98('0x3'));}function Hangup(_0x1052c4,_0x1ba9d9){this[_0x8f98('0x4')]=0x4;this[_0x8f98('0x5')]=_0x8f98('0x6');this[_0x8f98('0x7')]=_0x1052c4[_0x8f98('0x7')];this[_0x8f98('0x8')]=_0x1052c4[_0x8f98('0x8')];this['campaigntype']=_0x1052c4['type']==='outbound'?'queue':_0x1052c4['type'];this[_0x8f98('0x9')]=_0x1052c4['countbusyretry'];this['countcongestionretry']=_0x1052c4[_0x8f98('0xa')];this[_0x8f98('0xb')]=_0x1052c4[_0x8f98('0xb')];this[_0x8f98('0xc')]=_0x1052c4[_0x8f98('0x9')]+_0x1052c4[_0x8f98('0xa')]+_0x1052c4['countnoanswerretry']+_0x1052c4['countnosuchnumberretry']+_0x1052c4[_0x8f98('0xd')]+_0x1052c4['countabandonedretry']+_0x1052c4[_0x8f98('0xe')]+_0x1052c4[_0x8f98('0xf')];this['countnosuchnumberretry']=_0x1052c4[_0x8f98('0x10')];this[_0x8f98('0xd')]=_0x1052c4['countdropretry'];this[_0x8f98('0x11')]=_0x1052c4['countabandonedretry'];this[_0x8f98('0xe')]=_0x1052c4[_0x8f98('0xe')];this[_0x8f98('0xf')]=_0x1052c4[_0x8f98('0xf')];this[_0x8f98('0x12')]=_0x1ba9d9['uniqueid'];this[_0x8f98('0x13')]=_0x1052c4[_0x8f98('0x14')];this['calleridnum']=_0x1052c4[_0x8f98('0x15')];this[_0x8f98('0x16')]=_0x1052c4[_0x8f98('0x16')];this['responsetime']=_0x1052c4[_0x8f98('0x17')];this[_0x8f98('0x18')]=moment()['format'](_0x8f98('0x19'));this['ringtime']=getSeconds(_0x1052c4['responsetime'],_0x1052c4[_0x8f98('0x16')]);this[_0x8f98('0x1a')]=0x0;this['talktime']=getSeconds(this[_0x8f98('0x18')],_0x1052c4[_0x8f98('0x17')]);this[_0x8f98('0x1b')]=_0x1052c4[_0x8f98('0x1b')];this['membername']=_0x8f98('0x1c');this[_0x8f98('0x1d')]=_0x1ba9d9['cause-txt'];this['callback']=_0x1052c4[_0x8f98('0x1e')];this[_0x8f98('0x1f')]=_0x1052c4['callbackuniqueid'];this[_0x8f98('0x20')]=_0x1052c4[_0x8f98('0x20')];this[_0x8f98('0x21')]=_0x1052c4[_0x8f98('0x21')];this[_0x8f98('0x22')]=_0x1052c4[_0x8f98('0x22')];this[_0x8f98('0x23')]=_0x1052c4[_0x8f98('0x23')];this[_0x8f98('0x24')]=_0x1052c4['UserId'];this['VoiceQueueId']=_0x1052c4[_0x8f98('0x25')];this[_0x8f98('0x26')]=_0x1052c4[_0x8f98('0x26')];}module[_0x8f98('0x27')]=Hangup; \ No newline at end of file +var _0xe52f=['reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername'];(function(_0x4508c7,_0x5ed41a){var _0x335e9e=function(_0x1cbc91){while(--_0x1cbc91){_0x4508c7['push'](_0x4508c7['shift']());}};_0x335e9e(++_0x5ed41a);}(_0xe52f,0x15b));var _0xfe52=function(_0x349cf5,_0x36cd79){_0x349cf5=_0x349cf5-0x0;var _0x1754af=_0xe52f[_0x349cf5];return _0x1754af;};'use strict';var util=require(_0xfe52('0x0'));var _=require('lodash');var moment=require(_0xfe52('0x1'));function getSeconds(_0x5dbde6,_0x231bd1){var _0x1ca5b9=moment(_0x5dbde6)[_0xfe52('0x2')](0x0);var _0x2bc282=moment(_0x231bd1)['milliseconds'](0x0);return _0x1ca5b9[_0xfe52('0x3')](_0x2bc282,_0xfe52('0x4'));}function Hangup(_0x1c522c,_0xea9a03){this['state']=0x4;this[_0xfe52('0x5')]=_0xfe52('0x6');this['scheduledat']=_0x1c522c[_0xfe52('0x7')];this[_0xfe52('0x8')]=_0x1c522c[_0xfe52('0x8')];this['campaigntype']=_0x1c522c[_0xfe52('0x8')]===_0xfe52('0x9')?_0xfe52('0xa'):_0x1c522c['type'];this['countbusyretry']=_0x1c522c[_0xfe52('0xb')];this['countcongestionretry']=_0x1c522c['countcongestionretry'];this['countnoanswerretry']=_0x1c522c[_0xfe52('0xc')];this[_0xfe52('0xd')]=_0x1c522c[_0xfe52('0xb')]+_0x1c522c[_0xfe52('0xe')]+_0x1c522c[_0xfe52('0xc')]+_0x1c522c[_0xfe52('0xf')]+_0x1c522c[_0xfe52('0x10')]+_0x1c522c[_0xfe52('0x11')]+_0x1c522c[_0xfe52('0x12')]+_0x1c522c['countagentrejectretry'];this[_0xfe52('0xf')]=_0x1c522c[_0xfe52('0xf')];this[_0xfe52('0x10')]=_0x1c522c[_0xfe52('0x10')];this[_0xfe52('0x11')]=_0x1c522c[_0xfe52('0x11')];this[_0xfe52('0x12')]=_0x1c522c['countmachineretry'];this[_0xfe52('0x13')]=_0x1c522c['countagentrejectretry'];this[_0xfe52('0x14')]=_0xea9a03[_0xfe52('0x14')];this[_0xfe52('0x15')]=_0x1c522c['name'];this['calleridnum']=_0x1c522c[_0xfe52('0x16')];this[_0xfe52('0x17')]=_0x1c522c['starttime'];this[_0xfe52('0x18')]=_0x1c522c[_0xfe52('0x18')];this['endtime']=moment()['format'](_0xfe52('0x19'));this[_0xfe52('0x1a')]=getSeconds(_0x1c522c[_0xfe52('0x18')],_0x1c522c[_0xfe52('0x17')]);this[_0xfe52('0x1b')]=0x0;this[_0xfe52('0x1c')]=getSeconds(this[_0xfe52('0x1d')],_0x1c522c[_0xfe52('0x18')]);this[_0xfe52('0xa')]=_0x1c522c[_0xfe52('0xa')];this[_0xfe52('0x1e')]='IVR';this[_0xfe52('0x1f')]=_0xea9a03[_0xfe52('0x20')];this[_0xfe52('0x21')]=_0x1c522c['callback'];this[_0xfe52('0x22')]=_0x1c522c[_0xfe52('0x22')];this['callbackat']=_0x1c522c[_0xfe52('0x23')];this[_0xfe52('0x24')]=_0x1c522c[_0xfe52('0x24')];this[_0xfe52('0x25')]=_0x1c522c[_0xfe52('0x25')];this[_0xfe52('0x26')]=_0x1c522c[_0xfe52('0x26')];this['UserId']=_0x1c522c['UserId'];this[_0xfe52('0x27')]=_0x1c522c[_0xfe52('0x27')];this[_0xfe52('0x28')]=_0x1c522c['CampaignId'];}module[_0xfe52('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 ce63874..f5f5d56 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 _0x4f17=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime'];(function(_0x1b49ae,_0x4326a6){var _0x29c4a1=function(_0x1e7598){while(--_0x1e7598){_0x1b49ae['push'](_0x1b49ae['shift']());}};_0x29c4a1(++_0x4326a6);}(_0x4f17,0x9e));var _0x74f1=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0x4f17[_0x2e249d];return _0x1faa37;};'use strict';var util=require(_0x74f1('0x0'));var _=require('lodash');var moment=require(_0x74f1('0x1'));function getSeconds(_0xfcf99c,_0x589695){var _0x3c2d69=moment(_0xfcf99c)[_0x74f1('0x2')](0x0);var _0x3f16b2=moment(_0x589695)[_0x74f1('0x2')](0x0);return _0x3c2d69[_0x74f1('0x3')](_0x3f16b2,'seconds');}function History(_0x5e67b0){this[_0x74f1('0x4')]=_0x5e67b0['uniqueid'];this[_0x74f1('0x5')]=_0x5e67b0['scheduledat']||undefined;this[_0x74f1('0x6')]=_0x5e67b0[_0x74f1('0x6')];this[_0x74f1('0x7')]=_0x5e67b0['type']===_0x74f1('0x8')?'queue':_0x5e67b0[_0x74f1('0x6')];this['countbusyretry']=_0x5e67b0[_0x74f1('0x9')];this[_0x74f1('0xa')]=_0x5e67b0['countcongestionretry'];this['countnoanswerretry']=_0x5e67b0[_0x74f1('0xb')];this[_0x74f1('0xc')]=_0x5e67b0[_0x74f1('0x9')]+_0x5e67b0[_0x74f1('0xa')]+_0x5e67b0[_0x74f1('0xb')]+_0x5e67b0[_0x74f1('0xd')]+_0x5e67b0[_0x74f1('0xe')]+_0x5e67b0[_0x74f1('0xf')]+_0x5e67b0[_0x74f1('0x10')]+_0x5e67b0[_0x74f1('0x11')];this['countnosuchnumberretry']=_0x5e67b0[_0x74f1('0xd')];this['countdropretry']=_0x5e67b0[_0x74f1('0xe')];this['countabandonedretry']=_0x5e67b0[_0x74f1('0xf')];this[_0x74f1('0x10')]=_0x5e67b0[_0x74f1('0x10')];this[_0x74f1('0x11')]=_0x5e67b0[_0x74f1('0x11')];this['queue']=_0x5e67b0[_0x74f1('0x12')];this[_0x74f1('0x13')]=_0x5e67b0['name'];this[_0x74f1('0x14')]=_0x5e67b0[_0x74f1('0x15')];this['starttime']=_0x5e67b0[_0x74f1('0x16')];this[_0x74f1('0x17')]=_0x5e67b0[_0x74f1('0x17')];this[_0x74f1('0x18')]=_0x5e67b0[_0x74f1('0x17')];this['ringtime']=getSeconds(_0x5e67b0[_0x74f1('0x17')],_0x5e67b0[_0x74f1('0x16')]);this[_0x74f1('0x19')]=0x0;this[_0x74f1('0x1a')]=0x0;this[_0x74f1('0x1b')]=_0x5e67b0[_0x74f1('0x1b')];this['callbackuniqueid']=_0x5e67b0['callbackuniqueid'];this['callbackat']=_0x5e67b0[_0x74f1('0x1c')];this[_0x74f1('0x1d')]=_0x5e67b0[_0x74f1('0x1d')];this[_0x74f1('0x1e')]=_0x5e67b0[_0x74f1('0x1e')];this[_0x74f1('0x1f')]=_0x5e67b0[_0x74f1('0x1f')];this[_0x74f1('0x20')]=_0x5e67b0[_0x74f1('0x20')];this[_0x74f1('0x21')]=_0x5e67b0[_0x74f1('0x21')];this['CampaignId']=_0x5e67b0['CampaignId'];this[_0x74f1('0x22')]=_0x5e67b0[_0x74f1('0x22')]||'';this[_0x74f1('0x23')]=_0x5e67b0[_0x74f1('0x23')]||'';}module[_0x74f1('0x24')]=History; \ No newline at end of file +var _0xd93c=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','name','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x23a8b9,_0x5923a2){var _0x21fe72=function(_0x4d3380){while(--_0x4d3380){_0x23a8b9['push'](_0x23a8b9['shift']());}};_0x21fe72(++_0x5923a2);}(_0xd93c,0x1bd));var _0xcd93=function(_0x4560e4,_0x37b712){_0x4560e4=_0x4560e4-0x0;var _0x1d1227=_0xd93c[_0x4560e4];return _0x1d1227;};'use strict';var util=require(_0xcd93('0x0'));var _=require(_0xcd93('0x1'));var moment=require(_0xcd93('0x2'));function getSeconds(_0x338a12,_0x5e7022){var _0x22dbbc=moment(_0x338a12)[_0xcd93('0x3')](0x0);var _0xecb4f2=moment(_0x5e7022)[_0xcd93('0x3')](0x0);return _0x22dbbc['diff'](_0xecb4f2,_0xcd93('0x4'));}function History(_0x5d7990){this['uniqueid']=_0x5d7990[_0xcd93('0x5')];this[_0xcd93('0x6')]=_0x5d7990[_0xcd93('0x6')]||undefined;this[_0xcd93('0x7')]=_0x5d7990[_0xcd93('0x7')];this[_0xcd93('0x8')]=_0x5d7990['type']===_0xcd93('0x9')?_0xcd93('0xa'):_0x5d7990[_0xcd93('0x7')];this[_0xcd93('0xb')]=_0x5d7990[_0xcd93('0xb')];this[_0xcd93('0xc')]=_0x5d7990[_0xcd93('0xc')];this['countnoanswerretry']=_0x5d7990[_0xcd93('0xd')];this[_0xcd93('0xe')]=_0x5d7990[_0xcd93('0xb')]+_0x5d7990[_0xcd93('0xc')]+_0x5d7990[_0xcd93('0xd')]+_0x5d7990['countnosuchnumberretry']+_0x5d7990[_0xcd93('0xf')]+_0x5d7990[_0xcd93('0x10')]+_0x5d7990[_0xcd93('0x11')]+_0x5d7990['countagentrejectretry'];this[_0xcd93('0x12')]=_0x5d7990[_0xcd93('0x12')];this['countdropretry']=_0x5d7990['countdropretry'];this[_0xcd93('0x10')]=_0x5d7990[_0xcd93('0x10')];this[_0xcd93('0x11')]=_0x5d7990[_0xcd93('0x11')];this[_0xcd93('0x13')]=_0x5d7990[_0xcd93('0x13')];this[_0xcd93('0xa')]=_0x5d7990[_0xcd93('0xa')];this['calleridname']=_0x5d7990[_0xcd93('0x14')];this['calleridnum']=_0x5d7990['number'];this[_0xcd93('0x15')]=_0x5d7990[_0xcd93('0x15')];this[_0xcd93('0x16')]=_0x5d7990[_0xcd93('0x16')];this['endtime']=_0x5d7990[_0xcd93('0x16')];this[_0xcd93('0x17')]=getSeconds(_0x5d7990[_0xcd93('0x16')],_0x5d7990[_0xcd93('0x15')]);this[_0xcd93('0x18')]=0x0;this[_0xcd93('0x19')]=0x0;this[_0xcd93('0x1a')]=_0x5d7990[_0xcd93('0x1a')];this[_0xcd93('0x1b')]=_0x5d7990[_0xcd93('0x1b')];this[_0xcd93('0x1c')]=_0x5d7990['callbackat'];this[_0xcd93('0x1d')]=_0x5d7990[_0xcd93('0x1d')];this[_0xcd93('0x1e')]=_0x5d7990[_0xcd93('0x1e')];this[_0xcd93('0x1f')]=_0x5d7990[_0xcd93('0x1f')];this[_0xcd93('0x20')]=_0x5d7990['UserId'];this[_0xcd93('0x21')]=_0x5d7990[_0xcd93('0x21')];this[_0xcd93('0x22')]=_0x5d7990[_0xcd93('0x22')];this[_0xcd93('0x23')]=_0x5d7990[_0xcd93('0x23')]||'';this[_0xcd93('0x24')]=_0x5d7990[_0xcd93('0x24')]||'';}module[_0xcd93('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 2d0bf16..1eeff2c 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 _0xf37d=['minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countglobal','[syncAgentComplete][createHistory][0]','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','syncAgentComplete','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','Drop','dropreason','dialDropMaxRetry','dialDropRetryFrequency','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','strategy','locked','paused','stateinterface','push','pick','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','Action','command','iftime\x20%s,%s','indexOf','true','content','all','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','power','handlePower','dialPowerLevel','Queue','launchHandleIvr','dialGlobalInterval','checkDialMethod','[syncQueueSummary]','syncCampaigns','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originate','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','Error','originate\x20action\x20Error','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','buildObj','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','getVoiceQueueRtPauses','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','dialRecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','ACTIVE','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','../ami','defaults','redis','localhost','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startPredictive','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','startProgressive','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','uniqueId','clearZombieChannels','[actions]','sequence','enqueue','isNil','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[getContactDialer]\x20','getContactDialerIvr','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','reachable','SIP/%s','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','state','HangupInAMD','membername','MACHINE','AMD','countmachineretry','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency'];(function(_0x2f072d,_0x4edc14){var _0x53a102=function(_0x599b2a){while(--_0x599b2a){_0x2f072d['push'](_0x2f072d['shift']());}};_0x53a102(++_0x4edc14);}(_0xf37d,0x11c));var _0xdf37=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0xf37d[_0x1b25c1];return _0x1e4447;};'use strict';var util=require(_0xdf37('0x0'));var _=require(_0xdf37('0x1'));var BPromise=require(_0xdf37('0x2'));var uuid=require(_0xdf37('0x3'));var moment=require(_0xdf37('0x4'));var rr=require('rr');var md5=require(_0xdf37('0x5'));var Redis=require(_0xdf37('0x6'));var ut=require('../preview/util/util');var config=require(_0xdf37('0x7'));var logger=require(_0xdf37('0x8'))(_0xdf37('0x9'));var loggerBooked=require('../../../config/logger')(_0xdf37('0xa'));var loggerPredictive=require(_0xdf37('0x8'))(_0xdf37('0xb'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0xdf37('0xc'));config['redis']=_[_0xdf37('0xd')](config[_0xdf37('0xe')],{'host':_0xdf37('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdf37('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xdf37('0x10'));var cmHopperHistory=require(_0xdf37('0x11'));var cmHopperBlack=require(_0xdf37('0x12'));var voiceQueueRt=require(_0xdf37('0x13'));var Action=require(_0xdf37('0x14'));var History=require(_0xdf37('0x15'));var Final=require('./final');var AgentComplete=require(_0xdf37('0x16'));var QueueCallerAbandon=require(_0xdf37('0x17'));var Hangup=require(_0xdf37('0x18'));var ipAgi=process['env'][_0xdf37('0x19')]||_0xdf37('0x1a');var strategy={'rrmemory':_0xdf37('0x1b'),'roundrobin':_0xdf37('0x1c')};var Sequence=function(){};Sequence[_0xdf37('0x1d')]['enqueue']=function(_0x299b04){this[_0xdf37('0x1e')]=this[_0xdf37('0x1e')]?this[_0xdf37('0x1e')][_0xdf37('0x1f')](_0x299b04):_0x299b04();};function Dialer(_0x5f1dd0,_0x3b6dce){this['sequence']=new Sequence();this[_0xdf37('0x20')]=_0x3b6dce;this[_0xdf37('0x21')]=_0x5f1dd0[_0xdf37('0x21')];this['campaigns']=_0x5f1dd0[_0xdf37('0x22')];this[_0xdf37('0x23')]=_0x5f1dd0[_0xdf37('0x23')];this[_0xdf37('0x24')]=_0x5f1dd0[_0xdf37('0x24')];this[_0xdf37('0x25')]=config[_0xdf37('0x25')]||0x2;this[_0xdf37('0x26')]={};this[_0xdf37('0x27')]={};this[_0xdf37('0x28')]={};this['uniqueId']={};this['optionPredictive']={};this[_0xdf37('0x29')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xdf37('0x2a')]={};this[_0xdf37('0x2b')]={};ami['on']('agentconnect',this[_0xdf37('0x2c')][_0xdf37('0x2d')](this));ami['on'](_0xdf37('0x2e'),this[_0xdf37('0x2f')][_0xdf37('0x2d')](this));ami['on'](_0xdf37('0x30'),this[_0xdf37('0x31')][_0xdf37('0x2d')](this));ami['on'](_0xdf37('0x32'),this['syncAgentComplete'][_0xdf37('0x2d')](this));ami['on'](_0xdf37('0x33'),this[_0xdf37('0x34')][_0xdf37('0x2d')](this));ami['on'](_0xdf37('0x35'),this[_0xdf37('0x36')][_0xdf37('0x2d')](this));ami['on'](_0xdf37('0x37'),this['syncNewExten'][_0xdf37('0x2d')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0xdf37('0x38'),this[_0xdf37('0x39')][_0xdf37('0x2d')](this));ami['on'](_0xdf37('0x3a'),this['syncQueueStatusComplete'][_0xdf37('0x2d')](this));this['loopCampaigns']();this[_0xdf37('0x3b')]();}function isNotNull(_0x3e238b){return _0x3e238b!==null&&!_[_0xdf37('0x3c')](_0x3e238b);}function checkIsLoggedIn(_0x356d26,_0x4cffee){return function(){if(_0x4cffee<=0x0){_0x356d26[_0xdf37('0x3d')]=_0xdf37('0x3e');throw _0x356d26[_0xdf37('0x3f')]+_0xdf37('0x40');}};}function isActive(_0x143a7f){return _0x143a7f;}function checkIsActive(_0x1a179b,_0x4b0b27){return function(){if(!isActive(_0x4b0b27)){_0x1a179b[_0xdf37('0x3d')]=_0xdf37('0x41');throw _0x1a179b[_0xdf37('0x3f')]+_0xdf37('0x42');}};}function checkInterval(_0x14377b){return function(){if(!isNotNull(_0x14377b[_0xdf37('0x43')])){_0x14377b['message']='INTERVAL_IS_NULL';throw _0x14377b[_0xdf37('0x3f')]+_0xdf37('0x44');}if(!isNotNull(_0x14377b[_0xdf37('0x43')][_0xdf37('0x45')])){_0x14377b[_0xdf37('0x3d')]=_0xdf37('0x46');throw _0x14377b[_0xdf37('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xdf37('0x47')](_0x14377b['Interval'][_0xdf37('0x45')]))){_0x14377b[_0xdf37('0x3d')]=_0xdf37('0x46');throw _0x14377b[_0xdf37('0x3f')]+_0xdf37('0x44');}};}function msgResponse(_0x3f8ea0,_0x2cd5f6,_0x27eac6){return{'action':_0x3f8ea0,'response':_0x2cd5f6,'message':_0x27eac6,'stack':_0x27eac6};}function myreject(_0xf690ce){return function(_0x2dc63e){return _0xf690ce(msgResponse(_0xdf37('0x48'),'Error',JSON[_0xdf37('0x49')](_0x2dc63e)));};}function getSeconds(_0x25ae93,_0x40f663){var _0x5da0df=moment(_0x25ae93)[_0xdf37('0x4a')](0x0);var _0x122d4c=moment(_0x40f663)[_0xdf37('0x4a')](0x0);return _0x5da0df[_0xdf37('0x4b')](_0x122d4c,_0xdf37('0x4c'));}function emit(_0x391f64,_0x79cfbe,_0x1d5534){io['to'](_0x391f64)[_0xdf37('0x4d')](_0x79cfbe,_0x1d5534);}function emitVoiceQueueSummary(_0x34e759){if(_0x34e759[_0xdf37('0x4e')]==='outbound'){var _0x456135={'id':_0x34e759['id'],'name':_0x34e759[_0xdf37('0x3f')],'strategy':_0x34e759['strategy'],'answered':_0x34e759[_0xdf37('0x4f')],'available':_0x34e759[_0xdf37('0x50')],'loggedIn':_0x34e759[_0xdf37('0x51')],'pTalking':_0x34e759[_0xdf37('0x52')],'sumBillable':_0x34e759['sumBillable'],'sumDuration':_0x34e759[_0xdf37('0x53')],'sumHoldTime':_0x34e759[_0xdf37('0x54')]||0x0,'talking':_0x34e759[_0xdf37('0x55')],'total':_0x34e759[_0xdf37('0x56')],'type':_0x34e759[_0xdf37('0x4e')],'unmanaged':_0x34e759[_0xdf37('0x57')],'abandoned':_0x34e759[_0xdf37('0x58')],'waiting':_0x34e759[_0xdf37('0x59')],'loggedInDb':_0x34e759[_0xdf37('0x5a')],'dialActive':_0x34e759[_0xdf37('0x5b')],'dialMethod':_0x34e759[_0xdf37('0x5c')],'dialOriginateCallerIdName':_0x34e759[_0xdf37('0x5d')],'dialOriginateCallerIdNumber':_0x34e759[_0xdf37('0x5e')],'dialOriginateTimeout':_0x34e759[_0xdf37('0x5f')],'dialPrefix':_0x34e759[_0xdf37('0x60')],'outboundAnswerAgiCallsDay':_0x34e759[_0xdf37('0x61')],'outboundAnswerCallsDay':_0x34e759['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x34e759['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x34e759[_0xdf37('0x62')],'outboundCongestionCallsDay':_0x34e759['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x34e759[_0xdf37('0x63')],'outboundDropCallsDayCallersExit':_0x34e759[_0xdf37('0x64')],'outboundDropCallsDayTimeout':_0x34e759[_0xdf37('0x65')],'outboundNoAnswerCallsDay':_0x34e759[_0xdf37('0x66')],'outboundNoSuchCallsDay':_0x34e759[_0xdf37('0x67')],'outboundOriginateFailureCallsDay':_0x34e759[_0xdf37('0x68')],'outboundReCallsDay':_0x34e759[_0xdf37('0x69')],'outboundRejectCallsDay':_0x34e759['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x34e759['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x34e759['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x34e759[_0xdf37('0x6a')],'predictiveIntervalAvgTalktime':_0x34e759[_0xdf37('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x34e759[_0xdf37('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x34e759[_0xdf37('0x6d')],'predictiveIntervalErlangCalls':_0x34e759[_0xdf37('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x34e759[_0xdf37('0x6f')],'predictiveIntervalHitRate':_0x34e759[_0xdf37('0x70')],'predictiveIntervalMultiplicativeFactor':_0x34e759['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x34e759[_0xdf37('0x71')],'predictiveIntervalAvailable':_0x34e759[_0xdf37('0x72')],'predictiveIntervalTotalCalls':_0x34e759[_0xdf37('0x73')],'message':_0x34e759[_0xdf37('0x3d')],'originated':_0x34e759[_0xdf37('0x74')],'erlangCalls':_0x34e759[_0xdf37('0x75')],'erlangCallToSecond':_0x34e759[_0xdf37('0x76')],'erlangAbandonmentRate':_0x34e759[_0xdf37('0x77')],'erlangBusyFactor':_0x34e759[_0xdf37('0x78')],'startPredictive':_0x34e759[_0xdf37('0x29')],'startProgressive':_0x34e759['startProgressive']};if(_0x34e759[_0xdf37('0x79')]){_0x456135[_0xdf37('0x79')]={'id':_0x34e759['Trunk']['id'],'name':_0x34e759[_0xdf37('0x79')][_0xdf37('0x3f')],'active':_0x34e759[_0xdf37('0x79')]['active'],'callerid':_0x34e759[_0xdf37('0x79')]['callerid']};}if(_0x34e759[_0xdf37('0x43')]){_0x456135[_0xdf37('0x43')]={'id':_0x34e759[_0xdf37('0x43')]['id'],'name':_0x34e759[_0xdf37('0x43')][_0xdf37('0x3f')]};}var _0x5ebcbe=md5(JSON[_0xdf37('0x49')](_0x456135));if(_0x34e759[_0xdf37('0x5')]!==_0x5ebcbe){_0x34e759['md5']=_0x5ebcbe;emit(util[_0xdf37('0x7a')](_0xdf37('0x7b'),_0x456135['name']),_0xdf37('0x7c'),_0x456135);}}}function emitCampaignSummary(_0x29b2d3){if(_0x29b2d3['type']===_0xdf37('0x7d')){emit(util['format'](_0xdf37('0x7e'),_0x29b2d3[_0xdf37('0x3f')]),'campaign:save',_0x29b2d3);}}function checkGetDataPredictive(_0x5bb515){if(isNotNull(_0x5bb515)){if(!_[_0xdf37('0x47')](_0x5bb515)){loggerPredictive[_0xdf37('0x7f')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x80'),_0x5bb515['predictiveIntervalTotalCalls']);loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x81'),_0x5bb515['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xdf37('0x7f')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bb515[_0xdf37('0x6d')]);loggerPredictive[_0xdf37('0x7f')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bb515['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xdf37('0x7f')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bb515['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bb515[_0xdf37('0x6b')]);loggerPredictive['info']('---------------------------');if(_0x5bb515['predictiveIntervalTotalCalls']>0x0){if(!_[_0xdf37('0x3c')](_0x5bb515[_0xdf37('0x6b')])&&_0x5bb515['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0xdf37('0x3c')](_0x5bb515[_0xdf37('0x6a')])&&_0x5bb515[_0xdf37('0x6a')]>0x0){return!![];}else{loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x82'));}}else{loggerPredictive[_0xdf37('0x7f')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x83'));}}else{loggerPredictive['info'](_0xdf37('0x83'));}return![];}function mergeDataErlangB(_0x300db2){return function(_0x11e50a){loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x84'));loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x85'),_0x11e50a[_0xdf37('0x75')]);loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x86'),_0x11e50a['erlangCallToSecond']);loggerPredictive[_0xdf37('0x7f')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x11e50a[_0xdf37('0x77')]);loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x87'),_0x11e50a['erlangBusyFactor']);loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x88'),_0x11e50a[_0xdf37('0x77')]);loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x89'));_[_0xdf37('0x8a')](_0x300db2,_0x11e50a);};}function getDiff(_0xb688e0){var _0x2cdfd0=moment()[_0xdf37('0x4a')](0x0);var _0xf72f0=moment(_0xb688e0)[_0xdf37('0x4a')](0x0);return _0x2cdfd0[_0xdf37('0x4b')](_0xf72f0,_0xdf37('0x4c'));}function ifInterval(_0x37cc2b,_0x3558f1){if(_[_0xdf37('0x3c')](_0x3558f1)){return![];}if(getDiff(_0x3558f1)<_0x37cc2b*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x1a21bc){if(isNotNull(_0x1a21bc)){if(!_['isUndefined'](_0x1a21bc[_0xdf37('0x8b')])){_0x1a21bc['startProgressive']=undefined;loggerPredictive[_0xdf37('0x7f')](_0x1a21bc[_0xdf37('0x3f')],_0xdf37('0x8c'));}if(!_[_0xdf37('0x3c')](_0x1a21bc[_0xdf37('0x29')])){_0x1a21bc[_0xdf37('0x29')]=undefined;loggerPredictive['info'](_0x1a21bc[_0xdf37('0x3f')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xdf37('0x3c')](_0x1a21bc['handlePredictive'])){clearInterval(_0x1a21bc['handlePredictive']);_0x1a21bc[_0xdf37('0x8d')]=undefined;loggerPredictive['info'](_0x1a21bc[_0xdf37('0x3f')],_0xdf37('0x8e'));}}}function erlangb(_0x383bab,_0x549b05){if(_0x549b05===0x0){return 0x0;}var _0x3c0b5c=0x1;for(var _0x28400e=0x1;_0x28400e<=_0x549b05;_0x28400e+=0x1){_0x3c0b5c=0x1+_0x3c0b5c*_0x28400e/_0x383bab;}return 0x1/_0x3c0b5c;}function isVoiceQueueOutbound(_0x2b588f){return _0x2b588f===_0xdf37('0x8f');}function isNotPreview(_0x2deae1){return _0x2deae1!==_0xdf37('0x20');}function isCampaignIvr(_0x37c641){return _0x37c641===_0xdf37('0x7d');}function getCallerId(_0x481fd0,_0x148450,_0x586c8c){if(!_[_0xdf37('0x3c')](_0x586c8c)&&_0xdf37('0x90')===typeof _0x586c8c&&!_[_0xdf37('0x47')](_0x586c8c)){if(!_[_0xdf37('0x3c')](_0x148450)&&_0xdf37('0x90')===typeof _0x148450&&!_[_0xdf37('0x47')](_0x148450)){return util[_0xdf37('0x7a')](_0xdf37('0x91'),_0x148450,_0x586c8c);}return util[_0xdf37('0x7a')]('\x22%s\x22\x20<%s>',_0x586c8c,_0x586c8c);}if(!_[_0xdf37('0x3c')](_0x481fd0)&&_0xdf37('0x90')===typeof _0x481fd0&&!_['isEmpty'](_0x481fd0)){return _0x481fd0;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x2f82fa,_0xde59f4){return function(_0x6f51db){freeVariablesPredictive(_0xde59f4);emitVoiceQueueSummary(_0xde59f4);emitCampaignSummary(_0xde59f4);loggerSyncQueueSummary[_0xdf37('0x92')](_0x2f82fa,util[_0xdf37('0x93')](_0x6f51db,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x26a461,_0x34bf6d){return function(_0x1503cb){loggerPredictive[_0xdf37('0x92')](_0x34bf6d['name'],_0x26a461);loggerPredictive[_0xdf37('0x92')](_0x1503cb[_0xdf37('0x94')]);freeVariablesPredictive(_0x34bf6d);};}function loggerCatch(_0xf966fb){return function(_0x35755a){logger[_0xdf37('0x92')](_0xf966fb,util[_0xdf37('0x93')](_0x35755a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x520c8a){return _0x520c8a&&!_['isUndefined'](_0x520c8a)&&_0x520c8a[_0xdf37('0x95')]>0x0;}function decremetOriginate(_0x46b6af){if(!_[_0xdf37('0x3c')](_0x46b6af)&&_0x46b6af!==null){if(_0x46b6af[_0xdf37('0x96')](_0xdf37('0x74'))){if(_0x46b6af[_0xdf37('0x74')]>0x0){_0x46b6af[_0xdf37('0x74')]-=0x1;}else{logger['error'](_0xdf37('0x97'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x5bc921,_0x3837a7,_0x5a6cab){if(_0x3837a7>_0x5a6cab){for(var _0x14c3c1=0x0;_0x14c3c1<_0x3837a7-_0x5a6cab;_0x14c3c1+=0x1){decremetOriginate(_0x5bc921);}}}function loggerGetContactDialer(_0xd03122,_0x124579,_0x2a24b6){return function(_0x704627){checkContactLowerLimitOriginate(_0x124579,_0x2a24b6,0x0);logger[_0xdf37('0x92')](_0xd03122,util[_0xdf37('0x93')](_0x704627,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3204f3){return function(_0x5ded61){if(isNotNull(_0x5ded61)&&isNotNull(_0x5ded61[0x0])){if(_0x5ded61[0x0][_0xdf37('0x98')]>0x0){_0x3204f3[_0xdf37('0x3d')]=_0xdf37('0x99');logger['info'](_0xdf37('0x9a')+_0x3204f3[_0xdf37('0x3f')],_0x5ded61[0x0]['contactsRescheduled'],_0xdf37('0x9b'));}else{_0x3204f3[_0xdf37('0x3d')]=_0xdf37('0x9c');logger[_0xdf37('0x7f')](_0xdf37('0x9d')+_0x3204f3['name']);}}};}function notSendMessagesQueue(_0x4e636d){if(_0x4e636d[_0xdf37('0x9e')]){freeVariablesPredictive(_0x4e636d);if(_0x4e636d[_0xdf37('0x74')]===0x0&&_0x4e636d[_0xdf37('0x55')]===0x0&&_0x4e636d[_0xdf37('0x59')]===0x0&&(_0x4e636d[_0xdf37('0x52')]||0x0)===0x0){_0x4e636d['sendMessageOneNotActive']=![];_0x4e636d['available']=0x0;_0x4e636d['message']='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xdf37('0x9f'),_0x4e636d[_0xdf37('0x3f')],_0xdf37('0xa0'));}else{_0x4e636d[_0xdf37('0x3d')]=_0xdf37('0xa1');loggerSyncQueueSummary['error'](_0xdf37('0x9f'),_0x4e636d[_0xdf37('0x3f')],_0xdf37('0xa2'));}emitVoiceQueueSummary(_0x4e636d);}}function notSendMessagesCampaign(_0x2076c2){if(_0x2076c2[_0xdf37('0x9e')]){if(_0x2076c2['originated']===0x0){_0x2076c2['sendMessageOneNotActive']=![];_0x2076c2[_0xdf37('0x3d')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xdf37('0x92')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2076c2[_0xdf37('0x3f')],_0xdf37('0xa0'));}else{_0x2076c2['message']=_0xdf37('0xa1');loggerSyncQueueSummary[_0xdf37('0x92')](_0xdf37('0xa3'),_0x2076c2['name'],'is\x20disactive');}emitCampaignSummary(_0x2076c2);}}function createObjHistory(_0x4fe1a0,_0x64fdd0,_0x595f6c,_0x97a279,_0x202aa3){_0x4fe1a0[_0xdf37('0x3d')]=_0x595f6c;var _0x1727d3=new Action(_0x4fe1a0,_0x64fdd0);var _0x32274a=new History(_0x1727d3);_0x32274a['state']=_0x97a279;_0x32274a[_0xdf37('0xa4')]=_0x202aa3;_0x32274a[_0xdf37('0xa5')]=_0x1727d3[_0xdf37('0xa6')];return _0x32274a;}Dialer[_0xdf37('0x1d')][_0xdf37('0x3b')]=function(){var _0x441447=this;setInterval(function(){_0x441447['clearZombieChannels'](_0x441447[_0xdf37('0xa7')],'[uniqueid]');_0x441447[_0xdf37('0xa8')](_0x441447[_0xdf37('0x27')],_0xdf37('0xa9'));},0x32c8);};Dialer[_0xdf37('0x1d')][_0xdf37('0xa8')]=function(_0x1d4635,_0x44936f){var _0x4a7f7b=this;for(var _0x4e291a in _0x1d4635){if(_0x1d4635[_0xdf37('0x96')](_0x4e291a)){this[_0xdf37('0xaa')][_0xdf37('0xab')](function(){if(!_[_0xdf37('0xac')](_0x1d4635[_0x4e291a])){return ami['Action']({'action':_0xdf37('0xad'),'channel':_0x1d4635[_0x4e291a][_0xdf37('0xae')]})['catch'](function(_0x1a52fa){if(_0x1a52fa['message']===_0xdf37('0xaf')){setTimeout(function(){if(_0x1d4635[_0x4e291a]&&_0x1d4635[_0x4e291a][_0xdf37('0x4e')]!==_0xdf37('0x7d')){_0x4a7f7b[_0xdf37('0xb0')](_0x4a7f7b['voiceQueues'][_0x1d4635[_0x4e291a][_0xdf37('0xb1')]]);logger['error']('[Dialer][checkChannel]',_0x44936f,_0x4e291a,_0x1d4635[_0x4e291a][_0xdf37('0xb1')]);delete _0x1d4635[_0x4e291a];}if(_0x1d4635[_0x4e291a]&&_0x1d4635[_0x4e291a]['type']===_0xdf37('0x7d')){_0x4a7f7b[_0xdf37('0xb0')](_0x4a7f7b['campaigns'][_0x1d4635[_0x4e291a]['queue']]);logger[_0xdf37('0x92')](_0xdf37('0xb2'),_0x44936f,_0x4e291a,_0x1d4635[_0x4e291a][_0xdf37('0xb1')]);delete _0x1d4635[_0x4e291a];}},0x2328);}});}});}}};Dialer[_0xdf37('0x1d')][_0xdf37('0xb3')]=function(_0x5c5170){return BPromise[_0xdf37('0xb4')]()[_0xdf37('0xb5')](cmHopper['countReScheduled'](_0x5c5170))[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xb7')));};Dialer[_0xdf37('0x1d')][_0xdf37('0xb8')]=function(_0x2a5660){return BPromise[_0xdf37('0xb4')]()[_0xdf37('0xb5')](cmHopperBlack[_0xdf37('0xb8')](_0x2a5660))[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xb9')));};Dialer[_0xdf37('0x1d')][_0xdf37('0xba')]=function(_0x43202f){return BPromise[_0xdf37('0xb4')]()['then'](cmHopperBlack[_0xdf37('0xba')](_0x43202f))[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xbb')));};Dialer[_0xdf37('0x1d')][_0xdf37('0xbc')]=function(_0x510ed6){return BPromise[_0xdf37('0xb4')]()[_0xdf37('0xb5')](cmHopperHistory['avgHandleTime'](_0x510ed6))['catch'](loggerCatch(_0xdf37('0xbd')));};Dialer[_0xdf37('0x1d')][_0xdf37('0xbe')]=function(_0x26c86b){return BPromise[_0xdf37('0xb4')]()[_0xdf37('0xb5')](cmHopper['rescheduleContact'](_0x26c86b))['catch'](loggerCatch(_0xdf37('0xbf')));};Dialer[_0xdf37('0x1d')][_0xdf37('0xc0')]=function(_0x48918f,_0x14e9d5,_0x1df52d){return BPromise[_0xdf37('0xb4')]()[_0xdf37('0xb5')](cmHopper[_0xdf37('0xc0')](_0x48918f,_0x14e9d5,_0x1df52d))[_0xdf37('0xb6')](loggerCatch('[unlockContact]\x20'));};Dialer['prototype']['getContactDialer']=function(_0x4e96fe,_0x210f6e,_0x178adc,_0x1b30a4){return BPromise[_0xdf37('0xb4')]()[_0xdf37('0xb5')](cmHopper['getContactDialer'](_0x4e96fe,_0x210f6e,_0x178adc,_0x1b30a4))[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xc1')));};Dialer[_0xdf37('0x1d')][_0xdf37('0xc2')]=function(_0x61925e,_0x431fa4,_0x3696fc){return BPromise[_0xdf37('0xb4')]()[_0xdf37('0xb5')](cmHopper[_0xdf37('0xc2')](_0x61925e,_0x431fa4,_0x3696fc))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xdf37('0x1d')]['getVoiceQueueRtPauses']=function(_0x34a440){return BPromise[_0xdf37('0xb4')]()[_0xdf37('0xb5')](voiceQueueRt['getVoiceQueueRtPauses'](_0x34a440))[_0xdf37('0xb6')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xdf37('0xc3')]=function(_0x469084){return BPromise[_0xdf37('0xb4')]()['then'](cmHopper[_0xdf37('0xc3')](_0x469084))[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xc4')));};Dialer[_0xdf37('0x1d')][_0xdf37('0xc5')]=function(_0x272678){return BPromise[_0xdf37('0xb4')]()['then'](cmHopperHistory['createHistory'](_0x272678))[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xc6')));};Dialer['prototype'][_0xdf37('0xb0')]=function(_0x1be2c8){if(!_[_0xdf37('0x3c')](_0x1be2c8)&&_0x1be2c8!==null){if(_0x1be2c8['hasOwnProperty'](_0xdf37('0x74'))){if(_0x1be2c8['originated']>0x0){_0x1be2c8[_0xdf37('0x74')]-=0x1;}else{logger['error'](_0xdf37('0xc7'));}}}else{logger[_0xdf37('0x92')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0xdf37('0xc8')]=function(_0x468bb6,_0x5c8d69){var _0x3df3c2=this;return function(_0x642c3){_0x3df3c2[_0xdf37('0xb0')](_0x5c8d69);logger[_0xdf37('0x92')](_0x468bb6,util['inspect'](_0x642c3,{'showHidden':![],'depth':null}));};};Dialer[_0xdf37('0x1d')][_0xdf37('0xc9')]=function(_0x4c34d0,_0x412b7f,_0x24997b){var _0x4ed704={'state':0x19,'statedesc':'notFound'};this[_0xdf37('0xb0')](_0x412b7f);this[_0xdf37('0xca')](_[_0xdf37('0x8a')](_0x4ed704,_['pick'](_0x24997b,[_0xdf37('0xcb'),_0xdf37('0xcc'),_0xdf37('0xcd'),_0xdf37('0xce'),_0xdf37('0xcf')])),_0xdf37('0xd0'),_0xdf37('0xd1'));logger[_0xdf37('0x92')](_0x4c34d0);};Dialer['prototype'][_0xdf37('0xd2')]=function(_0x715600){return _0x715600===_0xdf37('0xd3');};Dialer[_0xdf37('0x1d')][_0xdf37('0xd4')]=function(_0x465039){return!_['isUndefined'](_0x465039)&&_0x465039&&!_[_0xdf37('0x3c')](_0x465039[_0xdf37('0x3f')])&&!_[_0xdf37('0x3c')](_0x465039[_0xdf37('0xd5')])&&_0x465039['active']&&(this[_0xdf37('0x24')][util['format']('SIP/%s',_0x465039['name'])][_0xdf37('0xad')]===_0xdf37('0xd6')||this[_0xdf37('0x24')][util[_0xdf37('0x7a')](_0xdf37('0xd7'),_0x465039[_0xdf37('0x3f')])][_0xdf37('0xad')]===_0xdf37('0xd8'));};Dialer[_0xdf37('0x1d')]['saveInDb']=function(_0x17072d,_0xb0694a,_0x2a7ef0){this[_0xdf37('0xc5')](_0x17072d)['catch'](loggerCatch(_0xb0694a));this['moveContactManagedDialer'](_0x17072d)[_0xdf37('0xb6')](loggerCatch(_0x2a7ef0));};Dialer['prototype'][_0xdf37('0xd9')]=function(_0x31af59){var _0xb5681d=this[_0xdf37('0xa7')][_0x31af59[_0xdf37('0xda')]];var _0xb4a728;if(!_[_0xdf37('0xac')](_0x31af59)&&!_[_0xdf37('0xac')](_0x31af59['variable'])&&!_[_0xdf37('0xac')](_0x31af59[_0xdf37('0xdb')][_0xdf37('0xdc')])&&_0x31af59[_0xdf37('0xdd')]===_0xdf37('0xde')&&_0xb5681d){if(_0xb5681d['type']!==_0xdf37('0x7d')&&this[_0xdf37('0x21')][_0xb5681d[_0xdf37('0xb1')]][_0xdf37('0xdf')]&&_0x31af59[_0xdf37('0xe0')]===_0xdf37('0xe1')){delete this[_0xdf37('0xa7')][_0x31af59[_0xdf37('0xda')]];this[_0xdf37('0xb0')](this[_0xdf37('0x21')][_0xb5681d[_0xdf37('0xb1')]]);this['voiceQueues'][_0xb5681d[_0xdf37('0xb1')]][_0xdf37('0xe2')]+=0x1;this[_0xdf37('0x21')][_0xb5681d[_0xdf37('0xb1')]][_0xdf37('0x61')]+=0x1;_0xb4a728=new Hangup(_0xb5681d,_0x31af59);_0xb4a728[_0xdf37('0xe3')]=0x12;_0xb4a728[_0xdf37('0xa4')]=_0xdf37('0xe4');_0xb4a728[_0xdf37('0xe5')]='AMD';this[_0xdf37('0xca')](_0xb4a728,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0xb5681d['type']!=='ivr'&&this[_0xdf37('0x21')][_0xb5681d['queue']][_0xdf37('0xdf')]&&_0x31af59[_0xdf37('0xe0')]===_0xdf37('0xe6')){var _0x35fcb3=this;return new BPromise(function(_0x51ad01,_0x598967){delete _0x35fcb3['uniqueId'][_0x31af59[_0xdf37('0xda')]];_0x35fcb3[_0xdf37('0xb0')](_0x35fcb3[_0xdf37('0x21')][_0xb5681d[_0xdf37('0xb1')]]);_0x35fcb3[_0xdf37('0x21')][_0xb5681d[_0xdf37('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x35fcb3[_0xdf37('0x21')][_0xb5681d['queue']][_0xdf37('0x61')]+=0x1;var _0x23b698=_0x35fcb3[_0xdf37('0x21')][_0xb5681d['queue']];var _0x4933e0=new Hangup(_0xb5681d,_0x31af59);_0x4933e0[_0xdf37('0xe3')]=0x13;_0x4933e0[_0xdf37('0xa4')]='Machine';_0x4933e0[_0xdf37('0xe5')]=_0xdf37('0xe7');_0x4933e0[_0xdf37('0xe8')]+=0x1;_0x4933e0['countglobal']+=0x1;_0x4933e0[_0xdf37('0xe9')]=!![];_0x35fcb3[_0xdf37('0xc5')](_0x4933e0)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4933e0[_0xdf37('0xea')]+_0x4933e0[_0xdf37('0xeb')]+_0x4933e0[_0xdf37('0xec')]+_0x4933e0[_0xdf37('0xed')]+_0x4933e0[_0xdf37('0xee')]+_0x4933e0[_0xdf37('0xef')]+_0x4933e0[_0xdf37('0xe8')]+_0x4933e0[_0xdf37('0xf0')]>=_0x23b698['dialGlobalMaxRetry']){_0x35fcb3['stateGlobal'](_0x4933e0,_0x51ad01,_0x598967,'reason19\x20machine....');}else{if(_0x4933e0['countmachineretry']>=_0x23b698[_0xdf37('0xf1')]){_0x35fcb3[_0xdf37('0xf2')](_0x4933e0,_0x51ad01,_0x598967,_0xdf37('0xf3'));}else{_0x35fcb3['rescheduleContact']({'active':![],'countmachineretry':_0x4933e0[_0xdf37('0xe8')],'scheduledat':moment()[_0xdf37('0xf4')](_0x23b698[_0xdf37('0xf5')],_0xdf37('0xf6'))[_0xdf37('0x7a')](_0xdf37('0xf7')),'ContactId':_0x4933e0['ContactId'],'ListId':_0x4933e0[_0xdf37('0xcc')],'VoiceQueueId':_0x4933e0[_0xdf37('0xce')]||undefined,'CampaignId':_0x4933e0[_0xdf37('0xcf')]||undefined})['catch'](loggerCatch(_0xdf37('0xf8')));_0x51ad01({'reschedule':0x1});}}});}if(_0xb5681d[_0xdf37('0x4e')]==='ivr'&&this['campaigns'][_0xb5681d[_0xdf37('0xb1')]][_0xdf37('0xdf')]&&_0x31af59[_0xdf37('0xe0')]===_0xdf37('0xe1')){delete this[_0xdf37('0xa7')][_0x31af59[_0xdf37('0xda')]];this['updateOriginated'](this['campaigns'][_0xb5681d[_0xdf37('0xb1')]]);_0xb4a728=new Hangup(_0xb5681d,_0x31af59);_0xb4a728['state']=0x12;_0xb4a728[_0xdf37('0xa4')]='HangupInAMD';_0xb4a728[_0xdf37('0xe5')]=_0xdf37('0xe7');this[_0xdf37('0xca')](_0xb4a728,_0xdf37('0xf9'),_0xdf37('0xfa'));}if(_0xb5681d['type']==='ivr'&&this[_0xdf37('0x22')][_0xb5681d[_0xdf37('0xb1')]][_0xdf37('0xdf')]&&_0x31af59[_0xdf37('0xe0')]===_0xdf37('0xe6')){var _0x35fcb3=this;return new BPromise(function(_0x48b668,_0xfd866a){delete _0x35fcb3[_0xdf37('0xa7')][_0x31af59[_0xdf37('0xda')]];_0x35fcb3['updateOriginated'](_0x35fcb3[_0xdf37('0x22')][_0xb5681d[_0xdf37('0xb1')]]);_0x35fcb3['campaigns'][_0xb5681d[_0xdf37('0xb1')]][_0xdf37('0xe2')]+=0x1;_0x35fcb3['campaigns'][_0xb5681d[_0xdf37('0xb1')]][_0xdf37('0x61')]+=0x1;var _0x1bd0e6=_0x35fcb3[_0xdf37('0x22')][_0xb5681d['queue']];var _0x2851c1=new Hangup(_0xb5681d,_0x31af59);_0x2851c1['state']=0x13;_0x2851c1[_0xdf37('0xa4')]=_0xdf37('0xfb');_0x2851c1[_0xdf37('0xe5')]=_0xdf37('0xe7');_0x2851c1['countmachineretry']+=0x1;_0x2851c1[_0xdf37('0xfc')]+=0x1;_0x2851c1[_0xdf37('0xe9')]=!![];_0x35fcb3[_0xdf37('0xc5')](_0x2851c1)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xfd')));if(_0x2851c1[_0xdf37('0xea')]+_0x2851c1[_0xdf37('0xeb')]+_0x2851c1['countnoanswerretry']+_0x2851c1[_0xdf37('0xed')]+_0x2851c1[_0xdf37('0xee')]+_0x2851c1[_0xdf37('0xef')]+_0x2851c1[_0xdf37('0xe8')]+_0x2851c1['countagentrejectretry']>=_0x1bd0e6['dialGlobalMaxRetry']){_0x35fcb3[_0xdf37('0xfe')](_0x2851c1,_0x48b668,_0xfd866a,'reason19\x20machine....');}else{if(_0x2851c1[_0xdf37('0xe8')]>=_0x1bd0e6[_0xdf37('0xf1')]){_0x35fcb3[_0xdf37('0xf2')](_0x2851c1,_0x48b668,_0xfd866a,'reason\x2019\x20machine....');}else{_0x35fcb3[_0xdf37('0xbe')]({'active':![],'countmachineretry':_0x2851c1[_0xdf37('0xe8')],'scheduledat':moment()[_0xdf37('0xf4')](_0x1bd0e6[_0xdf37('0xf5')],_0xdf37('0xf6'))[_0xdf37('0x7a')](_0xdf37('0xf7')),'ContactId':_0x2851c1[_0xdf37('0xcb')],'ListId':_0x2851c1[_0xdf37('0xcc')],'VoiceQueueId':_0x2851c1['VoiceQueueId']||undefined,'CampaignId':_0x2851c1['CampaignId']||undefined})[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xf8')));_0x48b668({'reschedule':0x1});}}});}}};Dialer[_0xdf37('0x1d')]['syncHangup']=function(_0x4557bb){var _0x7995d0=this[_0xdf37('0xa7')][_0x4557bb[_0xdf37('0xda')]];var _0x4109ce=this;var _0x54e462;if(_0x7995d0&&_0x7995d0[_0xdf37('0x4e')]===_0xdf37('0x7d')){delete this[_0xdf37('0xa7')][_0x4557bb['uniqueid']];this['updateOriginated'](this['campaigns'][_0x7995d0[_0xdf37('0xb1')]]);this['campaigns'][_0x7995d0[_0xdf37('0xb1')]][_0xdf37('0xff')]+=0x1;_0x54e462=new Hangup(_0x7995d0,_0x4557bb);this[_0xdf37('0xc5')](_0x54e462)['catch'](loggerCatch(_0xdf37('0x100')));this['moveContactManagedDialer'](_0x54e462)['catch'](loggerCatch(_0xdf37('0x101')));}if(_0x7995d0&&_0x7995d0[_0xdf37('0x4e')]!==_0xdf37('0x7d')&&isNotNull(this[_0xdf37('0x21')][_0x7995d0[_0xdf37('0xb1')]][_0xdf37('0x102')])){delete this[_0xdf37('0xa7')][_0x4557bb[_0xdf37('0xda')]];this['updateOriginated'](this[_0xdf37('0x21')][_0x7995d0[_0xdf37('0xb1')]]);this['voiceQueues'][_0x7995d0[_0xdf37('0xb1')]][_0xdf37('0xe2')]+=0x1;this[_0xdf37('0x21')][_0x7995d0[_0xdf37('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x54e462=new Hangup(_0x7995d0,_0x4557bb);_0x54e462[_0xdf37('0xe3')]=0x10;_0x54e462[_0xdf37('0xa4')]=_0xdf37('0x103');_0x54e462['membername']=_0xdf37('0x104');this[_0xdf37('0xc5')](_0x54e462)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x100')));this['moveContactManagedDialer'](_0x54e462)[_0xdf37('0xb6')](loggerCatch('[syncHangupIvr]'));}if(_0x7995d0&&_0x7995d0[_0xdf37('0x4e')]!==_0xdf37('0x7d')&&!isNotNull(this[_0xdf37('0x21')][_0x7995d0[_0xdf37('0xb1')]][_0xdf37('0x102')])){delete this[_0xdf37('0xa7')][_0x4557bb[_0xdf37('0xda')]];this[_0xdf37('0xb0')](this[_0xdf37('0x21')][_0x7995d0['queue']]);this[_0xdf37('0x21')][_0x7995d0[_0xdf37('0xb1')]][_0xdf37('0x105')]+=0x1;_0x54e462=new Hangup(_0x7995d0,_0x4557bb);_0x54e462[_0xdf37('0xe3')]=0xc;_0x54e462[_0xdf37('0xa4')]=_0x4557bb[_0xdf37('0x106')];_0x54e462[_0xdf37('0xe5')]='Unknow';this[_0xdf37('0xc5')](_0x54e462)['catch'](loggerCatch(_0xdf37('0x100')));this[_0xdf37('0xc3')](_0x54e462)[_0xdf37('0xb6')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0xdf37('0x107')]=function(_0x351d64){var _0x59d1da=this[_0xdf37('0xa7')][_0x351d64[_0xdf37('0xda')]];var _0x463ff3=this;if(this[_0xdf37('0x21')][_0x351d64[_0xdf37('0xb1')]]){if(_0x59d1da&&_0x59d1da[_0xdf37('0x4e')]!==_0xdf37('0x7d')){delete this['uniqueId'][_0x351d64[_0xdf37('0xda')]];this['voiceQueues'][_0x351d64[_0xdf37('0xb1')]][_0xdf37('0xe2')]+=0x1;var _0x53aeca=new AgentComplete(_0x59d1da,_0x351d64);if(_0x351d64[_0xdf37('0x108')]===_0xdf37('0x109')){_0x53aeca['agiafterat']=this['voiceQueues'][_0x351d64[_0xdf37('0xb1')]][_0xdf37('0x10a')]&&this['voiceQueues'][_0x351d64['queue']][_0xdf37('0x10b')]?moment()[_0xdf37('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xdf37('0xc5')](_0x53aeca)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x10c')));this[_0xdf37('0xc3')](_0x53aeca)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x10d')));}}};Dialer[_0xdf37('0x1d')]['syncAgentConnect']=function(_0x2eb374){if(this[_0xdf37('0x21')][_0x2eb374['queue']]){if(this['uniqueId'][_0x2eb374[_0xdf37('0xda')]]&&this[_0xdf37('0xa7')][_0x2eb374[_0xdf37('0xda')]][_0xdf37('0x4e')]!==_0xdf37('0x7d')){this['updateOriginated'](this[_0xdf37('0x21')][_0x2eb374[_0xdf37('0xb1')]]);this[_0xdf37('0xa7')][_0x2eb374['uniqueid']][_0xdf37('0x10e')]=moment()[_0xdf37('0x7a')](_0xdf37('0xf7'));}}};Dialer[_0xdf37('0x1d')][_0xdf37('0x10f')]=function(_0xafdc66){this[_0xdf37('0xc5')](_0xafdc66)[_0xdf37('0xb6')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xdf37('0xc3')](_0xafdc66)[_0xdf37('0xb6')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xdf37('0x1d')][_0xdf37('0x2f')]=function(_0x121969){var _0x7a8e=this['uniqueId'][_0x121969['uniqueid']];var _0x47fc8a=this;if(this[_0xdf37('0x21')][_0x121969[_0xdf37('0xb1')]]){if(_0x7a8e&&_0x7a8e[_0xdf37('0x4e')]!=='ivr'){delete this['uniqueId'][_0x121969[_0xdf37('0xda')]];this[_0xdf37('0xb0')](this[_0xdf37('0x21')][_0x121969['queue']]);_0x7a8e[_0xdf37('0x110')]=moment()[_0xdf37('0x7a')](_0xdf37('0xf7'));var _0x5c2c04=new QueueCallerAbandon(_0x7a8e,_0x121969);if(getSeconds(_0x7a8e[_0xdf37('0x110')],_0x7a8e['responsetime'])>=_0x7a8e['dialQueueTimeout']){this[_0xdf37('0x21')][_0x121969['queue']][_0xdf37('0x6d')]+=0x1;this[_0xdf37('0x21')][_0x121969[_0xdf37('0xb1')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xdf37('0x21')][_0x121969['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5c2c04[_0xdf37('0xe3')]=0xa;_0x5c2c04[_0xdf37('0xa4')]=_0xdf37('0x111');_0x5c2c04[_0xdf37('0x112')]='TIMEOUT';_0x5c2c04['agiafterat']=this[_0xdf37('0x21')][_0x121969[_0xdf37('0xb1')]]['dialQueueProject2']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5c2c04['countdropretry']+=0x1;_0x5c2c04[_0xdf37('0xfc')]+=0x1;if(_0x5c2c04[_0xdf37('0xee')]>=this[_0xdf37('0x21')][_0x121969[_0xdf37('0xb1')]][_0xdf37('0x113')]){this['queueCallerAbandonCreateState'](_0x5c2c04);}else{this[_0xdf37('0xbe')]({'active':![],'countdropretry':_0x5c2c04[_0xdf37('0xee')],'scheduledat':moment()[_0xdf37('0xf4')](this['voiceQueues'][_0x121969[_0xdf37('0xb1')]][_0xdf37('0x114')],'minutes')['format'](_0xdf37('0xf7')),'ContactId':_0x7a8e[_0xdf37('0xcb')],'ListId':_0x7a8e['ListId'],'VoiceQueueId':_0x7a8e[_0xdf37('0xce')]||undefined,'CampaignId':_0x7a8e[_0xdf37('0xcf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x160f49=new History(_0x5c2c04);_0x160f49[_0xdf37('0xe3')]=0xa;_0x160f49[_0xdf37('0xa4')]=_0xdf37('0x111');_0x160f49[_0xdf37('0xa6')]=moment()[_0xdf37('0x7a')](_0xdf37('0xf7'));_0x160f49['endtime']=_0x160f49[_0xdf37('0xa6')];_0x160f49['calleridname']=_0x5c2c04['calleridname'];_0x160f49[_0xdf37('0x115')]=_0x5c2c04[_0xdf37('0x115')];this['createHistory'](_0x160f49)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x116')));}}else{this[_0xdf37('0x21')][_0x121969['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xdf37('0x21')][_0x121969['queue']][_0xdf37('0x64')]+=0x1;_0x5c2c04[_0xdf37('0xe3')]=0xb;_0x5c2c04[_0xdf37('0xa4')]=_0xdf37('0x117');_0x5c2c04[_0xdf37('0x112')]=_0xdf37('0x118');_0x5c2c04[_0xdf37('0xef')]+=0x1;_0x5c2c04['countglobal']+=0x1;if(_0x5c2c04[_0xdf37('0xef')]>=this[_0xdf37('0x21')][_0x121969[_0xdf37('0xb1')]]['dialAbandonedMaxRetry']){this[_0xdf37('0x10f')](_0x5c2c04);}else{this[_0xdf37('0xbe')]({'active':![],'countabandonedretry':_0x5c2c04[_0xdf37('0xef')],'scheduledat':moment()[_0xdf37('0xf4')](this[_0xdf37('0x21')][_0x121969[_0xdf37('0xb1')]][_0xdf37('0x119')],_0xdf37('0xf6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x7a8e[_0xdf37('0xcb')],'ListId':_0x7a8e[_0xdf37('0xcc')],'VoiceQueueId':_0x7a8e['VoiceQueueId']||undefined,'CampaignId':_0x7a8e[_0xdf37('0xcf')]||undefined})[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x11a')));var _0x160f49=new History(_0x5c2c04);_0x160f49['state']=0xb;_0x160f49[_0xdf37('0xa4')]=_0xdf37('0x117');_0x160f49[_0xdf37('0xa6')]=moment()[_0xdf37('0x7a')](_0xdf37('0xf7'));_0x160f49[_0xdf37('0xa5')]=_0x160f49[_0xdf37('0xa6')];_0x160f49[_0xdf37('0x11b')]=_0x5c2c04[_0xdf37('0x11b')];_0x160f49['calleridnum']=_0x5c2c04[_0xdf37('0x115')];this['createHistory'](_0x160f49)['catch'](loggerCatch(_0xdf37('0x11c')));}}}}};Dialer[_0xdf37('0x1d')][_0xdf37('0x11d')]=function(_0x3fc862){if(this[_0xdf37('0x27')][_0x3fc862[_0xdf37('0xda')]]){this[_0xdf37('0x27')][_0x3fc862[_0xdf37('0xda')]][_0xdf37('0xae')]=_0x3fc862['channel'];}if(this[_0xdf37('0xa7')][_0x3fc862[_0xdf37('0xda')]]){this[_0xdf37('0xa7')][_0x3fc862[_0xdf37('0xda')]][_0xdf37('0xae')]=_0x3fc862['channel'];}};Dialer[_0xdf37('0x1d')][_0xdf37('0x39')]=function(_0x2a8fa1){if(strategy[this[_0xdf37('0x21')][this[_0xdf37('0x27')][_0x2a8fa1[_0xdf37('0x11e')]][_0xdf37('0xb1')]][_0xdf37('0x11f')]]==='roundrobin'){if(this[_0xdf37('0x27')][_0x2a8fa1['actionid']]&&_[_0xdf37('0xac')](this['actions'][_0x2a8fa1['actionid']][_0xdf37('0x120')])&&_0x2a8fa1[_0xdf37('0xad')]==='1'&&_0x2a8fa1[_0xdf37('0x121')]==='0'){if(this['agents'][_0x2a8fa1[_0xdf37('0x122')]]){if(!this['agents'][_0x2a8fa1[_0xdf37('0x122')]]['locked']){this['agents'][_0x2a8fa1['stateinterface']][_0xdf37('0x120')]=!![];this['actions'][_0x2a8fa1[_0xdf37('0x11e')]][_0xdf37('0x120')]=!![];this[_0xdf37('0x27')][_0x2a8fa1[_0xdf37('0x11e')]][_0xdf37('0x122')]=_0x2a8fa1[_0xdf37('0x122')];}}}}else if((strategy[this['voiceQueues'][this[_0xdf37('0x27')][_0x2a8fa1[_0xdf37('0x11e')]][_0xdf37('0xb1')]][_0xdf37('0x11f')]]||_0xdf37('0x1b'))==='rrmemory'){if(this[_0xdf37('0x27')][_0x2a8fa1[_0xdf37('0x11e')]]){if(this[_0xdf37('0x23')][_0x2a8fa1['stateinterface']]){this[_0xdf37('0x27')][_0x2a8fa1['actionid']]['stateinterface']=_0x2a8fa1[_0xdf37('0x122')];if(_['isNil'](this[_0xdf37('0x2a')][this[_0xdf37('0x27')][_0x2a8fa1['actionid']]['queue']])){this[_0xdf37('0x2a')][this['actions'][_0x2a8fa1[_0xdf37('0x11e')]][_0xdf37('0xb1')]]=[];}this[_0xdf37('0x2a')][this['actions'][_0x2a8fa1['actionid']]['queue']][_0xdf37('0x123')](_[_0xdf37('0x8a')](_[_0xdf37('0x124')](this[_0xdf37('0x27')][_0x2a8fa1[_0xdf37('0x11e')]],[_0xdf37('0x125'),_0xdf37('0x122')]),{'status':_0x2a8fa1[_0xdf37('0xad')],'paused':_0x2a8fa1['paused']}));}}}};function unlockQueueStatus(_0x1d8929,_0x3f2166){setTimeout(function(){if(_[_0xdf37('0x3c')](_0x1d8929[_0xdf37('0x126')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x3f2166);}_0x1d8929[_0xdf37('0x126')]=!![];loggerBooked[_0xdf37('0x7f')](_0xdf37('0x127'),_0x3f2166,JSON[_0xdf37('0x49')](_['pick'](_0x1d8929,[_0xdf37('0x3f'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xdf37('0x1d')][_0xdf37('0x128')]=function(_0x425d39){var _0x31ec53=this;var _0x5d05e5=_0x31ec53[_0xdf37('0x21')][_0x31ec53[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]][_0xdf37('0xb1')]];if(strategy[this[_0xdf37('0x21')][this['actions'][_0x425d39[_0xdf37('0x11e')]][_0xdf37('0xb1')]][_0xdf37('0x11f')]]===_0xdf37('0x1c')){if(this[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]]&&this[_0xdf37('0x27')][_0x425d39['actionid']][_0xdf37('0x122')]){this[_0xdf37('0x20')][_0xdf37('0x129')](this[_0xdf37('0x27')][_0x425d39['actionid']]['idHopper'],this[_0xdf37('0x27')][_0x425d39['actionid']][_0xdf37('0x122')])['catch'](function(_0x537806){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0xdf37('0x93')](_0x537806,{'showHidden':![],'depth':null}));})[_0xdf37('0x1f')](function(){_0x31ec53[_0xdf37('0xb0')](_0x31ec53[_0xdf37('0x21')][_0x31ec53[_0xdf37('0x27')][_0x425d39['actionid']][_0xdf37('0xb1')]]);_0x31ec53['agents'][_0x31ec53[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]]['stateinterface']]['locked']=![];delete _0x31ec53['actions'][_0x425d39[_0xdf37('0x11e')]];unlockQueueStatus(_0x5d05e5);});}else{this['updateOriginated'](this[_0xdf37('0x21')][this[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]][_0xdf37('0xb1')]]);this[_0xdf37('0xbe')]({'active':![],'ContactId':this[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]][_0xdf37('0xcb')],'ListId':this[_0xdf37('0x27')][_0x425d39['actionid']][_0xdf37('0xcc')],'VoiceQueueId':this[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]][_0xdf37('0xce')]||undefined,'CampaignId':this[_0xdf37('0x27')][_0x425d39['actionid']][_0xdf37('0xcf')]||undefined})['catch'](loggerCatch(_0xdf37('0x12a')));delete this['actions'][_0x425d39[_0xdf37('0x11e')]];unlockQueueStatus(_0x5d05e5);}}else if((strategy[this[_0xdf37('0x21')][this[_0xdf37('0x27')][_0x425d39['actionid']]['queue']][_0xdf37('0x11f')]]||_0xdf37('0x1b'))===_0xdf37('0x1b')){var _0x684e0e;if(this[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]]&&!_[_0xdf37('0x47')](this[_0xdf37('0x2a')][this[_0xdf37('0x27')][_0x425d39['actionid']][_0xdf37('0xb1')]])){if(this[_0xdf37('0x2b')][_0x31ec53[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]]['queue']]){this['queueBookedRR'][_0x31ec53[_0xdf37('0x27')][_0x425d39['actionid']][_0xdf37('0xb1')]]=this[_0xdf37('0x2b')][this[_0xdf37('0x27')][_0x425d39['actionid']]['queue']]?this['queueBookedRR'][this[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]]['queue']]:this['queueBooked'][this[_0xdf37('0x27')][_0x425d39['actionid']]['queue']]?this[_0xdf37('0x2a')][this[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]][_0xdf37('0xb1')]][_0xdf37('0x12b')]||0x0:0x0;}this[_0xdf37('0x2a')][this['actions'][_0x425d39[_0xdf37('0x11e')]][_0xdf37('0xb1')]][_0xdf37('0x12b')]=this[_0xdf37('0x2b')][this[_0xdf37('0x27')][_0x425d39[_0xdf37('0x11e')]][_0xdf37('0xb1')]];for(var _0x51eed5=0x0;_0x51eed5=0x0?!![]:![];})[_0xdf37('0xb6')](myreject(_0x29a63a)));}}else{_0x803e82[_0xdf37('0x123')](ami['Action']({'action':_0xdf37('0x146'),'command':util[_0xdf37('0x7a')](_0xdf37('0x147'),_0x967e3c,!_[_0xdf37('0x3c')](config['timezones'][_0x38cb8b])?_0x38cb8b:'')})[_0xdf37('0xb5')](function(_0x25fd92){return _0x25fd92[_0xdf37('0x14a')][_0xdf37('0x148')](_0xdf37('0x149'))>=0x0?!![]:![];})[_0xdf37('0xb6')](myreject(_0x29a63a)));}BPromise[_0xdf37('0x14b')](_0x803e82)[_0xdf37('0xb5')](function(_0x301fc0){var _0x9f3800=_['some'](_0x301fc0);if(_0x9f3800){return _0x126e2f(_0x9f3800);}else{_0x140430['message']=_0x17d7d1?'GLOBAL_INTERVAL_IS_OVERTIME':_0xdf37('0x14c');return _0x29a63a(msgResponse(_0xdf37('0x14d'),'Failure',_0xdf37('0x14e')+_0x17d7d1+'\x20'+_0x181820+'\x20Interval\x20is\x20overtime:\x20'+util[_0xdf37('0x93')](_0x967e3c,{'showHidden':![],'depth':null})+_0xdf37('0x14f')+_0x38cb8b));}})[_0xdf37('0xb6')](function(_0x198b2b){return _0x29a63a(msgResponse(_0xdf37('0x13c'),'Failure',JSON[_0xdf37('0x49')](_0x198b2b)));});});};Dialer[_0xdf37('0x1d')]['checkDialMethod']=function(_0x1ccc60){var _0x25b825=this;return function(){switch(_0x1ccc60['dialMethod']){case'progressive':freeVariablesPredictive(_0x1ccc60);_0x25b825['handlePower'](_0x1ccc60,0x1);break;case _0xdf37('0x150'):freeVariablesPredictive(_0x1ccc60);_0x25b825[_0xdf37('0x151')](_0x1ccc60,_0x1ccc60[_0xdf37('0x152')]);break;case _0xdf37('0xb'):_0x25b825[_0xdf37('0xb')](_0x1ccc60);break;case _0xdf37('0xa'):freeVariablesPredictive(_0x1ccc60);_0x25b825[_0xdf37('0x151')](_0x1ccc60,0x1);break;default:freeVariablesPredictive(_0x1ccc60);logger['error'](_0xdf37('0x153'),_0x1ccc60[_0xdf37('0x3f')],'method\x20not\x20recognized');}};};Dialer[_0xdf37('0x1d')][_0xdf37('0x154')]=function(_0x4059be){var _0x2fe0b5=this;return function(){_0x2fe0b5['handleIvr'](_0x4059be);};};Dialer[_0xdf37('0x1d')]['syncQueueSummary']=function(_0x24ee3a){var _0x7c41b6=this;if(isNotPreview(_0x24ee3a[_0xdf37('0x5c')])){if(isVoiceQueueOutbound(_0x24ee3a[_0xdf37('0x4e')])&&isActive(_0x24ee3a[_0xdf37('0x5b')])){_0x24ee3a[_0xdf37('0x9e')]=!![];BPromise['resolve']()[_0xdf37('0xb5')](checkIsLoggedIn(_0x24ee3a,_0x24ee3a[_0xdf37('0x51')]))[_0xdf37('0xb5')](checkIsActive(_0x24ee3a,_0x24ee3a['dialActive']))['then'](checkInterval(_0x24ee3a))[_0xdf37('0xb5')](_0x7c41b6[_0xdf37('0x137')](_0x24ee3a))['then'](_0x7c41b6[_0xdf37('0x13b')](_0x24ee3a[_0xdf37('0x155')],_0x24ee3a['dialTimezone'],_0x24ee3a[_0xdf37('0x3f')],_0x24ee3a))[_0xdf37('0xb5')](_0x7c41b6['checkIfTimeIntervals'](_0x24ee3a['Interval'],_0x24ee3a['dialTimezone'],_0x24ee3a[_0xdf37('0x3f')],_0x24ee3a))[_0xdf37('0xb5')](_0x7c41b6[_0xdf37('0x156')](_0x24ee3a))['catch'](loggerCatchQueueSummary(_0xdf37('0x157'),_0x24ee3a));}else{notSendMessagesQueue(_0x24ee3a);}}else{freeVariablesPredictive(_0x24ee3a);}};Dialer[_0xdf37('0x1d')][_0xdf37('0x158')]=function(){var _0x43ed83=this;var _0x2d6b7a;for(var _0x1a6226 in this[_0xdf37('0x22')]){if(this[_0xdf37('0x22')][_0xdf37('0x96')](_0x1a6226)){_0x2d6b7a=this['campaigns'][_0x1a6226];if(isCampaignIvr(_0x2d6b7a[_0xdf37('0x4e')])&&isActive(_0x2d6b7a[_0xdf37('0xd5')])){_0x2d6b7a[_0xdf37('0x9e')]=!![];BPromise['resolve']()['then'](checkIsActive(_0x2d6b7a,_0x2d6b7a['active']))[_0xdf37('0xb5')](checkInterval(_0x2d6b7a))[_0xdf37('0xb5')](_0x43ed83[_0xdf37('0x137')](_0x2d6b7a))[_0xdf37('0xb5')](_0x43ed83[_0xdf37('0x13b')](_0x2d6b7a[_0xdf37('0x155')],_0x2d6b7a['dialTimezone'],_0x2d6b7a[_0xdf37('0x3f')],_0x2d6b7a))[_0xdf37('0xb5')](_0x43ed83[_0xdf37('0x13d')](_0x2d6b7a[_0xdf37('0x43')],_0x2d6b7a[_0xdf37('0x159')],_0x2d6b7a[_0xdf37('0x3f')],_0x2d6b7a))['then'](_0x43ed83[_0xdf37('0x154')](_0x2d6b7a))[_0xdf37('0xb6')](loggerCatchQueueSummary(_0xdf37('0x15a'),_0x2d6b7a));}else{notSendMessagesCampaign(_0x2d6b7a);}}}};function getCallerIdRandom(_0x2dd495,_0x13dedf){var _0x220d18,_0x41eb6f,_0x18c63e;if(_0x13dedf<=0x0){_0x13dedf=0x1;}_0x220d18=new RegExp(_0xdf37('0x15b')+_0x13dedf+'}$');_0x41eb6f=Math[_0xdf37('0x15c')](0xa,_0x13dedf-0x1);_0x18c63e=Math[_0xdf37('0x15c')](0xa,_0x13dedf)-0x1;return util['format']('%s',_['replace'](_0x2dd495,_0x220d18,_['random'](_0x41eb6f,_0x18c63e)));}function extractCalleridName(_0x58e76a){var _0x3f5e69=_0x58e76a[_0xdf37('0x15d')](/"(.*?)"/);return _0x3f5e69?_0x3f5e69[0x1]:_0x58e76a;}function extractCalleridNumber(_0x4bf03c){var _0x45d53c=_0x4bf03c[_0xdf37('0x15d')](/<(.*?)>/);return _0x45d53c?_0x45d53c[0x1]:_0x4bf03c;}Dialer[_0xdf37('0x1d')][_0xdf37('0x15e')]=function(_0x95315,_0x5ead1b){var _0x5edd26=this;var _0x515686=uuid['v4']();this['actions'][_0x515686]=new Action(_0x95315,_0x5ead1b,_0x515686);return new BPromise(function(_0x254025,_0x1b2470){if(_[_0xdf37('0x3c')](_0x95315)&&_0xdf37('0x15f')!==typeof _0x95315){return _0x1b2470(msgResponse('originate','Failure',_0xdf37('0x160')));}if(_[_0xdf37('0x3c')](_0x5ead1b['Contact'][_0xdf37('0x161')])||_0x5ead1b[_0xdf37('0x162')][_0xdf37('0x161')]===null){return _0x1b2470(msgResponse('originate',_0xdf37('0x13e'),_0xdf37('0x163')));}var _0x1512ba={'XMD-CALLERID':_0x5edd26[_0xdf37('0x27')][_0x515686]['getCaller'](),'XMD-AGI':_0x95315[_0xdf37('0x102')]?util['format'](_0xdf37('0x164'),ipAgi,_0x95315[_0xdf37('0x102')]):'NONE','XMD-AGIAFTER':_0x95315[_0xdf37('0x10a')]?util[_0xdf37('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x95315[_0xdf37('0x10a')]):'NONE','XMD-QUEUE':_0x95315['type']===_0xdf37('0x8f')?util[_0xdf37('0x7a')](_0xdf37('0x165'),_0x95315[_0xdf37('0x3f')],_0x95315[_0xdf37('0x166')]||'',_0x95315[_0xdf37('0x10b')]?'c':'',_0x95315['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x5ead1b['ContactId'],'XMD-CDRTYPE':_0xdf37('0x9'),'CALLERID(all)':_0x5edd26[_0xdf37('0x27')][_0x515686][_0xdf37('0x167')](),'XMD-AMD':_0x95315[_0xdf37('0xdf')]?'ACTIVE':'NONE','XMD-DESTINATION':_0xdf37('0xde')};if(_0x95315[_0xdf37('0xdf')]){_0x1512ba['XMD-AMDINITIALSILENCE']=_0x95315[_0xdf37('0x168')]||0x9c4;_0x1512ba[_0xdf37('0x169')]=_0x95315['dialAMDGreeting']||0x5dc;_0x1512ba['XMD-AMDAFTERGREETINGSILENCE']=_0x95315[_0xdf37('0x16a')]||0x320;_0x1512ba[_0xdf37('0x16b')]=_0x95315[_0xdf37('0x16c')]||0x1388;_0x1512ba[_0xdf37('0x16d')]=_0x95315[_0xdf37('0x16e')]||0x64;_0x1512ba[_0xdf37('0x16f')]=_0x95315[_0xdf37('0x170')]||0x32;_0x1512ba[_0xdf37('0x171')]=_0x95315[_0xdf37('0x172')]||0x3;_0x1512ba[_0xdf37('0x173')]=_0x95315[_0xdf37('0x174')]||0x100;_0x1512ba[_0xdf37('0x175')]=_0x95315['dialAMDMaximumWordLength']||0x1388;}if(_0x95315[_0xdf37('0x4e')]===_0xdf37('0x8f')){_0x1512ba[_0xdf37('0x176')]=_0x5ead1b[_0xdf37('0xce')];}else{_0x1512ba['XMD-CAMPAIGNID']=_0x5ead1b[_0xdf37('0xcf')];}for(var _0x30b364 in _0x5ead1b['Contact']){if(_0x5ead1b['Contact'][_0xdf37('0x96')](_0x30b364)){if(isNotNull(_0x5ead1b[_0xdf37('0x162')][_0x30b364])&&_0x30b364!=='id'&&_0x30b364!==_0xdf37('0x177')&&_0x30b364!==_0xdf37('0x178')&&_0x30b364!==_0xdf37('0x179')){_0x1512ba[util[_0xdf37('0x7a')](_0xdf37('0x17a'),_0xdf37('0x17b'),_[_0xdf37('0x17c')](_0x30b364))]=_0x5ead1b[_0xdf37('0x162')][_0x30b364];}}}var _0x222d93=_0x5edd26[_0xdf37('0xd4')](_0x95315[_0xdf37('0x79')])?getCallerId(_0x95315[_0xdf37('0x79')][_0xdf37('0x17d')],_0x95315[_0xdf37('0x5d')],_0x95315[_0xdf37('0x17e')]>0x0?getCallerIdRandom(_0x95315[_0xdf37('0x5e')],_0x95315['dialRandomLastDigitCallerIdNumber']):_0x95315[_0xdf37('0x5e')]):getCallerId(_['isNil'](_0x95315['TrunkBackup'])?_0x95315[_0xdf37('0x79')][_0xdf37('0x17d')]:_0x95315['TrunkBackup']['callerid'],_0x95315[_0xdf37('0x5d')],_0x95315[_0xdf37('0x17e')]>0x0?getCallerIdRandom(_0x95315[_0xdf37('0x5e')],_0x95315[_0xdf37('0x17e')]):_0x95315[_0xdf37('0x5e')]);if(_0x222d93){_0x1512ba[_0xdf37('0x17f')]=_0x5edd26[_0xdf37('0x27')][_0x515686][_0xdf37('0x180')]=extractCalleridName(_0x222d93);_0x1512ba[_0xdf37('0x181')]=_0x5edd26['actions'][_0x515686]['originatecalleridnum']=extractCalleridNumber(_0x222d93);}return ami[_0xdf37('0x145')]({'actionid':_0x515686,'action':_0xdf37('0x182'),'channel':_0x5edd26[_0xdf37('0xd4')](_0x95315[_0xdf37('0x79')])?util[_0xdf37('0x7a')](_0xdf37('0x183'),_0x95315[_0xdf37('0x79')][_0xdf37('0x3f')],isNotNull(_0x95315[_0xdf37('0x60')])?_0x95315[_0xdf37('0x60')][_0xdf37('0x184')]()||'':'',_0x95315[_0xdf37('0x185')]>0x0?_0x5ead1b[_0xdf37('0x162')][_0xdf37('0x161')][_0xdf37('0x186')](_0x95315[_0xdf37('0x185')]):_0x5ead1b['Contact'][_0xdf37('0x161')]):util[_0xdf37('0x7a')](_0xdf37('0x183'),_['isNil'](_0x95315['TrunkBackup'])?_0x95315['Trunk']['name']:_0x95315[_0xdf37('0x138')][_0xdf37('0x3f')],isNotNull(_0x95315[_0xdf37('0x60')])?_0x95315[_0xdf37('0x60')][_0xdf37('0x184')]()||'':'',_0x95315[_0xdf37('0x185')]>0x0?_0x5ead1b['Contact']['phone'][_0xdf37('0x186')](_0x95315[_0xdf37('0x185')]):_0x5ead1b[_0xdf37('0x162')][_0xdf37('0x161')]),'callerid':_0x222d93,'Exten':_0xdf37('0xde'),'Context':_0xdf37('0x187'),'Priority':'1','variable':_0x1512ba,'timeout':(_0x95315[_0xdf37('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x515686})[_0xdf37('0xb5')](function(_0x585ad5){return _0x254025(_0x585ad5);})[_0xdf37('0xb6')](function(_0x125469){_0x95315[_0xdf37('0x68')]+=0x1;var _0x21160f=new History(_0x5edd26['actions'][_0x515686]);logger[_0xdf37('0x92')](util[_0xdf37('0x7a')]('[originateError]:\x20%s',JSON['stringify'](_0x125469)));_0x21160f[_0xdf37('0xe3')]=0xe;_0x21160f[_0xdf37('0xa4')]=_0xdf37('0x188');_0x21160f[_0xdf37('0xa6')]=moment()['format'](_0xdf37('0xf7'));_0x21160f[_0xdf37('0xa5')]=_0x21160f[_0xdf37('0xa6')];_0x5edd26[_0xdf37('0xc5')](_0x21160f)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x189')));_0x5edd26[_0xdf37('0xc3')](_0x21160f)['catch'](loggerCatch(_0xdf37('0x189')))['finally'](function(){delete _0x5edd26['actions'][_0x515686];return _0x1b2470(msgResponse(_0xdf37('0x182'),_0xdf37('0x18a'),_0xdf37('0x18b')));});});});};Dialer['prototype'][_0xdf37('0x31')]=function(_0x31726b){var _0x4501da=this[_0xdf37('0x27')][_0x31726b['actionid']];var _0xeae72b=this;if(_0x4501da){delete this[_0xdf37('0x27')][_0x31726b[_0xdf37('0x11e')]];_0x4501da[_0xdf37('0x18c')]=moment()['format'](_0xdf37('0xf7'));var _0x31c639=_0x4501da['type']===_0xdf37('0x7d')?this[_0xdf37('0x22')][_0x4501da[_0xdf37('0xb1')]]:this['voiceQueues'][_0x4501da[_0xdf37('0x18d')]()];if(!this[_0xdf37('0xd2')](_0x31726b[_0xdf37('0x18e')])){this['updateOriginated'](_0x31c639);return this[_0xdf37('0x18f')](_0x4501da,_0x31c639,_0x31726b)[_0xdf37('0xb5')](function(_0x2551ca){})[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x190')));}else{this['uniqueId'][_0x31726b[_0xdf37('0xda')]]=_0x4501da;}}};Dialer[_0xdf37('0x1d')]['checkRetriveMax']=function(_0x224338,_0x574984,_0x118f58){var _0xf0de1=new History(_0x574984);if(_0xf0de1[_0xdf37('0xea')]+_0xf0de1[_0xdf37('0xeb')]+_0xf0de1[_0xdf37('0xec')]+_0xf0de1[_0xdf37('0xed')]+_0xf0de1[_0xdf37('0xee')]+_0xf0de1[_0xdf37('0xef')]+_0xf0de1['countmachineretry']+_0xf0de1[_0xdf37('0xf0')]>=_0x118f58[_0xdf37('0x191')]-0x1){return!![];}switch(_0x224338){case 0x3:if(_0xf0de1['countnoanswerretry']>=_0x118f58[_0xdf37('0x192')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0xf0de1[_0xdf37('0xec')]+=0x1,'scheduledat':moment()[_0xdf37('0xf4')](_0x118f58['dialNoAnswerRetryFrequency'],_0xdf37('0xf6'))[_0xdf37('0x7a')](_0xdf37('0xf7')),'ContactId':_0xf0de1[_0xdf37('0xcb')],'ListId':_0xf0de1[_0xdf37('0xcc')],'VoiceQueueId':_0xf0de1[_0xdf37('0xce')]||undefined,'CampaignId':_0xf0de1[_0xdf37('0xcf')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0xf0de1[_0xdf37('0xea')]>=_0x118f58[_0xdf37('0x193')]-0x1){return!![];}else{this[_0xdf37('0xbe')]({'active':![],'countbusyretry':_0xf0de1['countbusyretry']+=0x1,'scheduledat':moment()[_0xdf37('0xf4')](_0x118f58[_0xdf37('0x194')],_0xdf37('0xf6'))[_0xdf37('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xf0de1[_0xdf37('0xcb')],'ListId':_0xf0de1[_0xdf37('0xcc')],'VoiceQueueId':_0xf0de1[_0xdf37('0xce')]||undefined,'CampaignId':_0xf0de1[_0xdf37('0xcf')]||undefined})[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x195')));}break;case 0x8:if(_0xf0de1[_0xdf37('0xeb')]>=_0x118f58[_0xdf37('0x196')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0xf0de1[_0xdf37('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x118f58[_0xdf37('0x197')],'minutes')[_0xdf37('0x7a')](_0xdf37('0xf7')),'ContactId':_0xf0de1[_0xdf37('0xcb')],'ListId':_0xf0de1[_0xdf37('0xcc')],'VoiceQueueId':_0xf0de1[_0xdf37('0xce')]||undefined,'CampaignId':_0xf0de1[_0xdf37('0xcf')]||undefined})[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x198')));}break;case 0x0:if(_0xf0de1[_0xdf37('0xed')]>=_0x118f58[_0xdf37('0x199')]-0x1){return!![];}else{this[_0xdf37('0xbe')]({'active':![],'countnosuchnumberretry':_0xf0de1[_0xdf37('0xed')]+=0x1,'scheduledat':moment()[_0xdf37('0xf4')](_0x118f58[_0xdf37('0x19a')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xf0de1[_0xdf37('0xcb')],'ListId':_0xf0de1[_0xdf37('0xcc')],'VoiceQueueId':_0xf0de1['VoiceQueueId']||undefined,'CampaignId':_0xf0de1[_0xdf37('0xcf')]||undefined})[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x19b')));}break;case 0xa:if(_0xf0de1['countdropretry']>=_0x118f58[_0xdf37('0x113')]-0x1){return!![];}else{this[_0xdf37('0xbe')]({'active':![],'countdropretry':_0xf0de1[_0xdf37('0xee')]+=0x1,'scheduledat':moment()['add'](_0x118f58[_0xdf37('0x114')],_0xdf37('0xf6'))[_0xdf37('0x7a')](_0xdf37('0xf7')),'ContactId':_0xf0de1[_0xdf37('0xcb')],'ListId':_0xf0de1[_0xdf37('0xcc')],'VoiceQueueId':_0xf0de1[_0xdf37('0xce')]||undefined,'CampaignId':_0xf0de1[_0xdf37('0xcf')]||undefined})['catch'](loggerCatch(_0xdf37('0x19c')));}break;case 0xb:if(_0xf0de1[_0xdf37('0xef')]>=_0x118f58['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0xdf37('0xbe')]({'active':![],'countabandonedretry':_0xf0de1[_0xdf37('0xef')]+=0x1,'scheduledat':moment()[_0xdf37('0xf4')](_0x118f58[_0xdf37('0x119')],_0xdf37('0xf6'))['format'](_0xdf37('0xf7')),'ContactId':_0xf0de1[_0xdf37('0xcb')],'ListId':_0xf0de1[_0xdf37('0xcc')],'VoiceQueueId':_0xf0de1[_0xdf37('0xce')]||undefined,'CampaignId':_0xf0de1[_0xdf37('0xcf')]||undefined})[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x11a')));}break;case 0x13:if(_0xf0de1[_0xdf37('0xe8')]>=_0x118f58[_0xdf37('0xf1')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0xf0de1[_0xdf37('0xe8')]+=0x1,'scheduledat':moment()[_0xdf37('0xf4')](_0x118f58[_0xdf37('0xf5')],_0xdf37('0xf6'))[_0xdf37('0x7a')](_0xdf37('0xf7')),'ContactId':_0xf0de1[_0xdf37('0xcb')],'ListId':_0xf0de1[_0xdf37('0xcc')],'VoiceQueueId':_0xf0de1[_0xdf37('0xce')]||undefined,'CampaignId':_0xf0de1[_0xdf37('0xcf')]||undefined})[_0xdf37('0xb6')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0xf0de1[_0xdf37('0xf0')]>=_0x118f58[_0xdf37('0x19d')]-0x1){return!![];}else{this[_0xdf37('0xbe')]({'active':![],'countagentrejectretry':_0xf0de1['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x118f58[_0xdf37('0x19e')],'minutes')[_0xdf37('0x7a')](_0xdf37('0xf7')),'ContactId':_0xf0de1[_0xdf37('0xcb')],'ListId':_0xf0de1['ListId'],'VoiceQueueId':_0xf0de1['VoiceQueueId']||undefined,'CampaignId':_0xf0de1[_0xdf37('0xcf')]||undefined})['catch'](loggerCatch(_0xdf37('0x19f')));}break;default:return!![];}};Dialer[_0xdf37('0x1d')][_0xdf37('0x18f')]=function(_0x52a3de,_0x57bd3e,_0x344528){var _0x3b5863=this;var _0x51eab9=new History(_0x52a3de);return new BPromise(function(_0x3c8439,_0x5b7088){if(_[_0xdf37('0x3c')](_0x57bd3e)&&'object'!==typeof _0x57bd3e){return _0x5b7088(msgResponse(_0xdf37('0x1a0'),_0xdf37('0x13e'),_0xdf37('0x1a1')));}if(_['isUndefined'](_0x344528)&&_0xdf37('0x15f')!==typeof _0x344528){return _0x5b7088(msgResponse(_0xdf37('0x1a0'),'Failure',_0xdf37('0x1a2')));}switch(_0x344528[_0xdf37('0x108')]){case'0':_0x57bd3e[_0xdf37('0x67')]+=0x1;_0x51eab9[_0xdf37('0xe3')]=0x0;_0x51eab9[_0xdf37('0xa4')]=_0xdf37('0x1a3');_0x51eab9[_0xdf37('0xed')]+=0x1;_0x51eab9['countglobal']+=0x1;ami[_0xdf37('0x4d')]('custom:agentnosuchnumber',ut[_0xdf37('0x1a4')](_0x52a3de,'nosuchnumber'));_0x3b5863[_0xdf37('0xc5')](_0x51eab9)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xfd')));if(_0x3b5863[_0xdf37('0x1a5')](0x0,_0x52a3de,_0x57bd3e)){if(_0x51eab9[_0xdf37('0xed')]>=_0x57bd3e['dialNoSuchNumberMaxRetry']){_0x3b5863[_0xdf37('0xf2')](_0x51eab9,_0x3c8439,_0x5b7088,'reason\x200\x20no\x20such\x20number....');}else{_0x3b5863[_0xdf37('0xfe')](_0x51eab9,_0x3c8439,_0x5b7088,_0xdf37('0x1a6'));}}break;case'3':_0x57bd3e[_0xdf37('0x66')]+=0x1;_0x51eab9[_0xdf37('0xe3')]=0x3;_0x51eab9[_0xdf37('0xa4')]=_0xdf37('0x1a7');_0x51eab9[_0xdf37('0xec')]+=0x1;_0x51eab9[_0xdf37('0xfc')]+=0x1;ami[_0xdf37('0x4d')](_0xdf37('0x1a8'),ut['buildObj'](_0x52a3de,_0xdf37('0x1a9')));_0x3b5863[_0xdf37('0xc5')](_0x51eab9)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x1aa')));if(_0x3b5863[_0xdf37('0x1a5')](0x3,_0x52a3de,_0x57bd3e)){if(_0x51eab9[_0xdf37('0xec')]>=_0x57bd3e['dialNoAnswerMaxRetry']){_0x3b5863[_0xdf37('0xf2')](_0x51eab9,_0x3c8439,_0x5b7088,_0xdf37('0x1ab'));}else{_0x3b5863['stateGlobal'](_0x51eab9,_0x3c8439,_0x5b7088,_0xdf37('0x1ab'));}}break;case'5':_0x57bd3e[_0xdf37('0x62')]+=0x1;_0x51eab9[_0xdf37('0xe3')]=0x5;_0x51eab9[_0xdf37('0xa4')]='Busy';_0x51eab9['countbusyretry']+=0x1;_0x51eab9[_0xdf37('0xfc')]+=0x1;ami[_0xdf37('0x4d')](_0xdf37('0x1ac'),ut[_0xdf37('0x1a4')](_0x52a3de,_0xdf37('0x1ad')));_0x3b5863[_0xdf37('0xc5')](_0x51eab9)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x1ae')));if(_0x3b5863['checkRetriveMax'](0x5,_0x52a3de,_0x57bd3e)){if(_0x51eab9[_0xdf37('0xea')]>=_0x57bd3e[_0xdf37('0x193')]){_0x3b5863[_0xdf37('0xf2')](_0x51eab9,_0x3c8439,_0x5b7088,'reason\x205\x20busy');}else{_0x3b5863['stateGlobal'](_0x51eab9,_0x3c8439,_0x5b7088,_0xdf37('0x1af'));}}break;case'8':_0x57bd3e[_0xdf37('0x1b0')]+=0x1;_0x51eab9['state']=0x8;_0x51eab9['statedesc']='Congestion';_0x51eab9[_0xdf37('0xeb')]+=0x1;_0x51eab9['countglobal']+=0x1;ami[_0xdf37('0x4d')](_0xdf37('0x1b1'),ut[_0xdf37('0x1a4')](_0x52a3de,_0xdf37('0x1b2')));_0x3b5863['createHistory'](_0x51eab9)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x1b3')));if(_0x3b5863[_0xdf37('0x1a5')](0x8,_0x52a3de,_0x57bd3e)){if(_0x51eab9[_0xdf37('0xeb')]>=_0x57bd3e[_0xdf37('0x196')]){_0x3b5863[_0xdf37('0xf2')](_0x51eab9,_0x3c8439,_0x5b7088,_0xdf37('0x1b4'));}else{_0x3b5863[_0xdf37('0xfe')](_0x51eab9,_0x3c8439,_0x5b7088,'reason\x208\x20congestion');}}break;case'11':_0x57bd3e['outboundAbandonedCallsDay']+=0x1;_0x51eab9[_0xdf37('0xe3')]=0xb;_0x51eab9[_0xdf37('0xa4')]='Abandoned';_0x51eab9['countabandonedretry']+=0x1;_0x51eab9[_0xdf37('0xfc')]+=0x1;_0x3b5863[_0xdf37('0xc5')](_0x51eab9)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x11c')));if(_0x3b5863['checkRetriveMax'](0xb,_0x52a3de,_0x57bd3e)){if(_0x51eab9[_0xdf37('0xef')]>=_0x57bd3e[_0xdf37('0x1b5')]){_0x3b5863[_0xdf37('0xf2')](_0x51eab9,_0x3c8439,_0x5b7088,_0xdf37('0x1b6'));}else{_0x3b5863[_0xdf37('0xfe')](_0x51eab9,_0x3c8439,_0x5b7088,_0xdf37('0x1b6'));}}break;case'20':_0x57bd3e[_0xdf37('0x1b7')]+=0x1;_0x51eab9[_0xdf37('0xe3')]=0x14;_0x51eab9['statedesc']='AgentReject';_0x51eab9[_0xdf37('0xf0')]+=0x1;_0x51eab9['countglobal']+=0x1;ami[_0xdf37('0x4d')](_0xdf37('0x1b8'),ut[_0xdf37('0x1a4')](_0x52a3de,_0xdf37('0x1b9')));_0x3b5863[_0xdf37('0xc5')](_0x51eab9)[_0xdf37('0xb6')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x3b5863[_0xdf37('0x1a5')](0x14,_0x52a3de,_0x57bd3e)){if(_0x51eab9[_0xdf37('0xf0')]>=_0x57bd3e[_0xdf37('0x19d')]){_0x3b5863[_0xdf37('0xf2')](_0x51eab9,_0x3c8439,_0x5b7088,_0xdf37('0x1ba'));}else{_0x3b5863[_0xdf37('0xfe')](_0x51eab9,_0x3c8439,_0x5b7088,'reason\x2020\x20agentreject');}}break;default:_0x57bd3e[_0xdf37('0x105')]+=0x1;_0x51eab9['state']=0xc;_0x51eab9['statedesc']=_0x344528['reason'];_0x3b5863[_0xdf37('0xc5')](_0x51eab9)[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x1bb')));if(_0x3b5863[_0xdf37('0x1a5')](_0x344528[_0xdf37('0x108')],_0x52a3de,_0x57bd3e)){if(_0x51eab9[_0xdf37('0xea')]+_0x51eab9[_0xdf37('0xeb')]+_0x51eab9[_0xdf37('0xec')]+_0x51eab9[_0xdf37('0xed')]+_0x51eab9[_0xdf37('0xee')]+_0x51eab9[_0xdf37('0xef')]+_0x51eab9[_0xdf37('0xe8')]+_0x51eab9[_0xdf37('0xf0')]>=_0x57bd3e[_0xdf37('0x191')]){_0x3b5863['stateGlobal'](_0x51eab9,_0x3c8439,_0x5b7088,_0x344528[_0xdf37('0x108')]);}else{_0x3b5863[_0xdf37('0xf2')](_0x51eab9,_0x3c8439,_0x5b7088,_0x344528[_0xdf37('0x108')]);}}}});};Dialer[_0xdf37('0x1d')][_0xdf37('0xfe')]=function(_0x5c67fc,_0xe313e8,_0x40c84b,_0x292e5e){var _0x596ce1=new Final(_0x5c67fc);_0x596ce1['state']=0xf;_0x596ce1[_0xdf37('0xa4')]=_0xdf37('0x1bc');this[_0xdf37('0xf2')](_0x596ce1,_0xe313e8,_0x40c84b,_0x292e5e);};Dialer[_0xdf37('0x1d')][_0xdf37('0xf2')]=function(_0x568561,_0x199124,_0x5061be,_0x71325f){this[_0xdf37('0xc3')](_0x568561)[_0xdf37('0xb5')](function(_0x5479ac){return _0x199124(msgResponse(_0xdf37('0x1a0'),_0xdf37('0xd3'),_0x71325f));})['catch'](function(_0x254c7c){return _0x5061be(msgResponse('[moveContactManagedDialer][0]',_0xdf37('0x13e'),'contact\x20not\x20moved'));});};Dialer[_0xdf37('0x1d')][_0xdf37('0xb')]=function(_0x22059e){var _0x2c6cc2=this;var _0x31ddde=_0x22059e[_0xdf37('0x1bd')]/0x64;var _0x2a11ef=_0x22059e[_0xdf37('0x65')]/(_0x22059e[_0xdf37('0x65')]+_0x22059e['outboundAnswerCallsDay']);var _0x1cf3e8=Math[_0xdf37('0x1be')](_0x22059e[_0xdf37('0x72')]*(_0x22059e[_0xdf37('0x1bf')]/0x64));var _0x39cf92=Math[_0xdf37('0x1be')](_0x22059e[_0xdf37('0x72')]*(_0x22059e['predictiveIntervalMinThreshold']/0x64));var _0x5def01=_0x22059e[_0xdf37('0x50')]+_0x22059e[_0xdf37('0x55')];var _0x320a3c=Math[_0xdf37('0x1c0')](_0x22059e[_0xdf37('0x75')]*_0x22059e['erlangAbandonmentRate']*_0x22059e[_0xdf37('0x70')]*_0x22059e[_0xdf37('0x1c1')]);if(_[_0xdf37('0x3c')](_0x22059e['startProgressive'])){if(!_[_0xdf37('0x3c')](_0x22059e[_0xdf37('0x29')])){_0x22059e['startPredictive']=undefined;loggerPredictive[_0xdf37('0x92')](_0xdf37('0x1c2'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xdf37('0x3c')](_0x22059e[_0xdf37('0x8d')])){loggerPredictive[_0xdf37('0x92')](_0xdf37('0x1c2'),_0xdf37('0x1c3'));clearInterval(_0x22059e[_0xdf37('0x8d')]);_0x22059e[_0xdf37('0x8d')]=undefined;}_0x22059e[_0xdf37('0x8b')]=moment()[_0xdf37('0x7a')](_0xdf37('0xf7'));loggerPredictive[_0xdf37('0x7f')](_0x22059e[_0xdf37('0x3f')],_0xdf37('0x1c4'),_0x22059e['startProgressive']);this[_0xdf37('0x151')](_0x22059e,0x1);}else if(ifInterval(_0x22059e[_0xdf37('0x1c5')],_0x22059e[_0xdf37('0x8b')])){this[_0xdf37('0x151')](_0x22059e,0x1);loggerPredictiveCalls[_0xdf37('0x7f')](_0xdf37('0x1c6'),_0x22059e[_0xdf37('0x8b')],_0x22059e['name']);_0x22059e[_0xdf37('0x75')]=0x0;_0x22059e[_0xdf37('0x6f')]=0x0;}else if(_0x31ddde<_0x2a11ef&&_0x22059e[_0xdf37('0x1c7')]==='dropRate'){freeVariablesPredictive(_0x22059e);loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x1c8'),_0xdf37('0x1c9'),_0x2a11ef,_0xdf37('0x8b'),_0x22059e[_0xdf37('0x3f')]);}else if(_0x320a3c<_0x22059e[_0xdf37('0x6f')]&&_0x22059e[_0xdf37('0x1c7')]===_0xdf37('0x1ca')){freeVariablesPredictive(_0x22059e);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xdf37('0x1cb'),_0x320a3c,_0xdf37('0x1cc'),_0x22059e[_0xdf37('0x6f')],_0xdf37('0x8b'),_0x22059e[_0xdf37('0x3f')]);}else if(!ifInterval(_0x22059e[_0xdf37('0x1c5')],_0x22059e[_0xdf37('0x8b')])&&_[_0xdf37('0x3c')](_0x22059e['startPredictive'])&&!_['isUndefined'](_0x22059e['startProgressive'])){_0x22059e[_0xdf37('0x29')]=moment()[_0xdf37('0x7a')](_0xdf37('0xf7'));loggerPredictive[_0xdf37('0x7f')](_0x22059e[_0xdf37('0x3f')],_0xdf37('0x1cd'),_0x22059e[_0xdf37('0x29')]);this[_0xdf37('0xbc')](_0x22059e[_0xdf37('0x1c5')])[_0xdf37('0xb5')](this[_0xdf37('0x1ce')](_0x22059e))[_0xdf37('0xb5')](mergeDataErlangB(_0x22059e))[_0xdf37('0xb5')](this[_0xdf37('0x1cf')](_0x22059e))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x22059e));}else if(!ifInterval(_0x22059e[_0xdf37('0x1c5')],_0x22059e[_0xdf37('0x29')])){_0x22059e[_0xdf37('0x6f')]=0x0;_0x22059e[_0xdf37('0x29')]=moment()[_0xdf37('0x7a')](_0xdf37('0xf7'));loggerPredictive['info'](_0x22059e[_0xdf37('0x3f')],_0xdf37('0x1d0'),_0x22059e[_0xdf37('0x29')]);clearInterval(_0x22059e[_0xdf37('0x8d')]);_0x22059e[_0xdf37('0x8d')]=undefined;this[_0xdf37('0xbc')](_0x22059e['dialPredictiveInterval'])[_0xdf37('0xb5')](this[_0xdf37('0x1ce')](_0x22059e))[_0xdf37('0xb5')](mergeDataErlangB(_0x22059e))[_0xdf37('0xb5')](this[_0xdf37('0x1cf')](_0x22059e))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x22059e));}else if(_0x22059e[_0xdf37('0x72')]&&_0x5def01<_0x22059e['predictiveIntervalAvailable']-_0x39cf92){freeVariablesPredictive(_0x22059e);loggerPredictive[_0xdf37('0x7f')](_0x22059e[_0xdf37('0x3f')],_0xdf37('0x1d1'),_0x5def01,_0xdf37('0x1d2'),_0x22059e[_0xdf37('0x72')],'-',_0x39cf92,'=',_0x22059e[_0xdf37('0x72')]-_0x39cf92,')');}else if(_0x22059e[_0xdf37('0x72')]&&_0x5def01>_0x22059e[_0xdf37('0x72')]+_0x1cf3e8){freeVariablesPredictive(_0x22059e);loggerPredictive['info'](_0x22059e['name'],_0xdf37('0x1d1'),_0x5def01,')\x20are\x20more\x20than\x20threshold\x20(',_0x22059e[_0xdf37('0x72')],'+',_0x1cf3e8,'=',_0x22059e['predictiveIntervalAvailable']+_0x1cf3e8,')');}};Dialer[_0xdf37('0x1d')]['getDataPredictive']=function(_0x35da49){var _0x34b438=this;return function(_0x5b9a67){return new BPromise(function(_0x180de2,_0x5164bf){_[_0xdf37('0x8a')](_0x35da49,_0x5b9a67[0x0]);if(checkGetDataPredictive(_0x5b9a67[0x0])){var _0x49fe2d=_0x35da49[_0xdf37('0x72')]=_0x35da49[_0xdf37('0x55')]+_0x35da49[_0xdf37('0x50')];var _0x36df44=_0x35da49[_0xdf37('0x1c5')]*0x3c;var _0x92b6d0=_0x5b9a67[0x0][_0xdf37('0x6b')]+_0x5b9a67[0x0][_0xdf37('0x6a')];var _0x1c37c7=(_0x5b9a67[0x0]['predictiveIntervalAnsweredCalls']+_0x5b9a67[0x0][_0xdf37('0x6d')]+_0x5b9a67[0x0][_0xdf37('0x6c')])/_0x5b9a67[0x0][_0xdf37('0x73')];_0x35da49[_0xdf37('0x70')]=_0x1c37c7>0x0?_0x1c37c7:0x1;switch(_0x35da49[_0xdf37('0x1c7')]){case _0xdf37('0x1ca'):var _0x189c1f=_0x35da49['dialPredictiveOptimizationPercentage']/0x64;return _0x34b438[_0xdf37('0x1d3')](_0x49fe2d,_0x36df44,_0x92b6d0,_0x1c37c7,_0x189c1f)['then'](function(_0x58b6b1){return _0x180de2(_0x58b6b1);});case _0xdf37('0x1d4'):var _0x5b40f6=_0x35da49[_0xdf37('0x1bd')]/0x64;return _0x34b438[_0xdf37('0x1d5')](_0x49fe2d,_0x36df44,_0x92b6d0,_0x1c37c7,_0x5b40f6)[_0xdf37('0xb5')](function(_0x2141a3){return _0x180de2(_0x2141a3);});default:return _0x5164bf(msgResponse(_0xdf37('0x1d6'),'Failure',_0xdf37('0x1d7')));}}else{return _0x5164bf(msgResponse('[getDataPredictive]',_0xdf37('0x13e'),_0xdf37('0x1d8')));}});};};Dialer[_0xdf37('0x1d')][_0xdf37('0x1d9')]=function(_0x3d3354){var _0x27ea6d=this;return function(_0x48ff97){return new BPromise(function(_0x542d3d,_0x21b2d6){_[_0xdf37('0x8a')](_0x3d3354,_0x48ff97[0x0]);if(checkGetDataPredictive(_0x48ff97[0x0])){loggerPredictive['info'](JSON[_0xdf37('0x49')](_0x48ff97[0x0]));if(_0x3d3354[_0xdf37('0x1c7')]===_0xdf37('0x1ca')){return _0x27ea6d[_0xdf37('0x1da')](_0x3d3354['id'])[_0xdf37('0xb5')](function(_0x21048c){var _0x218f37=_0x3d3354['loggedIn']-_0x21048c[0x0][_0xdf37('0x1db')];var _0xa127ae=_0x3d3354[_0xdf37('0x1c5')]*0x3c;var _0x4ec102=_0x48ff97[0x0][_0xdf37('0x6b')]+_0x48ff97[0x0]['predictiveIntervalAvgHoldtime'];var _0x21db00=(_0x48ff97[0x0]['predictiveIntervalAnsweredCalls']+_0x48ff97[0x0][_0xdf37('0x6d')]+_0x48ff97[0x0][_0xdf37('0x6c')])/_0x48ff97[0x0][_0xdf37('0x73')];var _0x41ad17=_0x3d3354['dialPredictiveOptimizationPercentage']/0x64;_0x3d3354['predictiveIntervalPauses']=_0x21048c[0x0]['outboundQueuePauses']||0x0;_0x3d3354[_0xdf37('0x70')]=_0x21db00>0x0?_0x21db00:0x1;return _0x27ea6d['abandonmentRate'](_0x218f37,_0xa127ae,_0x4ec102,_0x21db00,_0x41ad17);})[_0xdf37('0xb5')](function(_0x4b8477){return _0x542d3d(_0x4b8477);})[_0xdf37('0xb6')](function(_0x2be04a){return _0x21b2d6(msgResponse(_0xdf37('0x1dc'),_0xdf37('0x13e'),JSON[_0xdf37('0x49')](_0x2be04a)));});}if(_0x3d3354['dialPredictiveOptimization']===_0xdf37('0x1d4')){return _0x27ea6d[_0xdf37('0x1da')](_0x3d3354['id'])['then'](function(_0x5ce914){var _0x2738c4=_0x3d3354['loggedIn']-_0x5ce914[0x0][_0xdf37('0x1db')];var _0x3c0a33=_0x3d3354[_0xdf37('0x1c5')]*0x3c;var _0x204362=_0x48ff97[0x0][_0xdf37('0x6b')]+_0x48ff97[0x0]['predictiveIntervalAvgHoldtime'];var _0x2f915c=(_0x48ff97[0x0]['predictiveIntervalAnsweredCalls']+_0x48ff97[0x0][_0xdf37('0x6d')]+_0x48ff97[0x0][_0xdf37('0x6c')])/_0x48ff97[0x0][_0xdf37('0x73')];var _0x935dfd=_0x3d3354[_0xdf37('0x1bd')]/0x64;_0x3d3354[_0xdf37('0x71')]=_0x5ce914[0x0][_0xdf37('0x1db')]||0x0;_0x3d3354[_0xdf37('0x70')]=_0x2f915c>0x0?_0x2f915c:0x1;return _0x27ea6d[_0xdf37('0x1d5')](_0x2738c4,_0x3c0a33,_0x204362,_0x2f915c,_0x935dfd);})[_0xdf37('0xb5')](function(_0x19c1c6){return _0x542d3d(_0x19c1c6);})[_0xdf37('0xb6')](function(_0x2d1b9d){return _0x21b2d6(msgResponse('[CatchErlangB]',_0xdf37('0x13e'),JSON['stringify'](_0x2d1b9d)));});}}else{return _0x21b2d6(msgResponse(_0xdf37('0x1d6'),_0xdf37('0x13e'),_0xdf37('0x1d8')));}});};};Dialer[_0xdf37('0x1d')][_0xdf37('0x1cf')]=function(_0x5e7b7c){var _0x516b31=this;return function(){var _0x435e7b=0x0;var _0x3c19f0=Math[_0xdf37('0x1c0')](_0x5e7b7c[_0xdf37('0x76')]*0x3e8);if(_0x3c19f0>0x0){_0x3c19f0=_0x3c19f0<0x64?0x64:_0x3c19f0;loggerPredictive[_0xdf37('0x7f')](_0x5e7b7c[_0xdf37('0x3f')],_0xdf37('0x1dd'),_0x3c19f0,_0xdf37('0x4a'));_0x5e7b7c[_0xdf37('0x8d')]=setInterval(function(){_0x516b31[_0xdf37('0x8d')](_0x5e7b7c);loggerPredictiveCalls[_0xdf37('0x7f')](_0xdf37('0x1de'),_0x435e7b+=0x1);},_0x3c19f0);}else{loggerPredictive[_0xdf37('0x7f')](_0x5e7b7c[_0xdf37('0x3f')],_0xdf37('0x1df'));}};};Dialer['prototype'][_0xdf37('0x1e0')]=function(_0x3919f2,_0x5a40ee){var _0x313fb0=this;return function(_0x37dabe){if(_[_0xdf37('0x47')](_0x37dabe)){if(_['isNil'](_0x5a40ee[_0xdf37('0xcd')])||!_0x5a40ee['recallme']){if(_0x3919f2[_0xdf37('0x5c')]===_0xdf37('0xa')){_0x3919f2[_0xdf37('0x126')]=_[_0xdf37('0x3c')](_0x3919f2[_0xdf37('0x126')])?!![]:_0x3919f2['queueStatusComplete'];var _0x5b5336=uuid['v4']();_0x313fb0[_0xdf37('0x27')][_0x5b5336]=new Action(_0x3919f2,_0x5a40ee,_0x5b5336);loggerBooked[_0xdf37('0x7f')](_0xdf37('0x1e1'),_0x5b5336,'queueStatusComplete:\x20',JSON[_0xdf37('0x49')](_0x3919f2[_0xdf37('0x126')]),_0xdf37('0x1e2'),_0x3919f2[_0xdf37('0x3f')]);if(_0x3919f2[_0xdf37('0x126')]){_0x3919f2[_0xdf37('0x126')]=![];_0x313fb0[_0xdf37('0x2a')][_0x313fb0[_0xdf37('0x27')][_0x5b5336][_0xdf37('0xb1')]]=[];ami['Action']({'actionid':_0x5b5336,'action':'queuestatus','queue':_0x3919f2[_0xdf37('0x3f')]})[_0xdf37('0xb6')](function(_0x33462b){_0x313fb0[_0xdf37('0xb0')](_0x3919f2);_0x313fb0[_0xdf37('0xbe')]({'active':![],'ContactId':_0x313fb0[_0xdf37('0x27')][_0x5b5336][_0xdf37('0xcb')],'ListId':_0x313fb0[_0xdf37('0x27')][_0x5b5336][_0xdf37('0xcc')],'VoiceQueueId':_0x313fb0[_0xdf37('0x27')][_0x5b5336][_0xdf37('0xce')]||undefined,'CampaignId':_0x313fb0['actions'][_0x5b5336][_0xdf37('0xcf')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x313fb0[_0xdf37('0x27')][_0x5b5336];});}else{loggerBooked[_0xdf37('0x7f')](_0xdf37('0x1e3'),JSON[_0xdf37('0x49')](_0x3919f2[_0xdf37('0x126')]),_0xdf37('0x1e2'),_0x3919f2[_0xdf37('0x3f')]);_0x313fb0[_0xdf37('0xb0')](_0x3919f2);_0x313fb0['rescheduleContact']({'active':![],'ContactId':_0x313fb0[_0xdf37('0x27')][_0x5b5336][_0xdf37('0xcb')],'ListId':_0x313fb0[_0xdf37('0x27')][_0x5b5336][_0xdf37('0xcc')],'VoiceQueueId':_0x313fb0['actions'][_0x5b5336]['VoiceQueueId']||undefined,'CampaignId':_0x313fb0[_0xdf37('0x27')][_0x5b5336][_0xdf37('0xcf')]||undefined})[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x1e4')));delete _0x313fb0[_0xdf37('0x27')][_0x5b5336];}}else{return _0x313fb0[_0xdf37('0x15e')](_0x3919f2,_0x5a40ee);}}else{if(getDiff(_0x5a40ee[_0xdf37('0x1e5')])<_0x3919f2[_0xdf37('0x1e6')]*0x3c){if(_0x5a40ee[_0xdf37('0x1e7')]&&!_0x5a40ee[_0xdf37('0x1e7')][_0xdf37('0x1e8')]){_0x313fb0[_0xdf37('0x20')]['run'](_0x5a40ee['id'])[_0xdf37('0x1f')](function(){_0x313fb0[_0xdf37('0xb0')](_0x3919f2);});}else{_0x313fb0[_0xdf37('0xc0')]({'active':![]},_0x5a40ee['id'],0x1)[_0xdf37('0x1f')](function(){console['log'](_0xdf37('0x1e9'));_0x313fb0[_0xdf37('0xb0')](_0x3919f2);});}}else{_0x3919f2['outboundReCallsDay']+=0x1;_0x313fb0[_0xdf37('0xb0')](_0x3919f2);if(_0x3919f2[_0xdf37('0x1ea')]){_0x313fb0['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5a40ee[_0xdf37('0xcb')],'ListId':_0x5a40ee[_0xdf37('0xcc')],'VoiceQueueId':_0x5a40ee['VoiceQueueId']||undefined,'CampaignId':_0x5a40ee[_0xdf37('0xcf')]||undefined})[_0xdf37('0xb6')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x313fb0[_0xdf37('0xc5')](createObjHistory(_0x3919f2,_0x5a40ee,'RECALLINQUEUE',0x17,'RecallInQueue'))[_0xdf37('0xb6')](loggerCatch(_0xdf37('0x1eb')));}else{_0x313fb0['saveInDb'](createObjHistory(_0x3919f2,_0x5a40ee,_0xdf37('0x1ec'),0x16,_0xdf37('0x1ed')),'[Originate][HistoryRecallClose][historyCatch]',_0xdf37('0x1ee'));}}}}else{_0x3919f2[_0xdf37('0x1ef')]+=0x1;_0x313fb0[_0xdf37('0xca')](createObjHistory(_0x3919f2,_0x5a40ee,_0xdf37('0x1f0'),0xd,'Blacklist'),_0xdf37('0x1f1'),_0xdf37('0x1f2'));throw _0xdf37('0x1f3');}};};Dialer[_0xdf37('0x1d')]['handleIvr']=function(_0xcd6be3){var _0x892e3e=this;var _0x187875=[];var _0x333643=_0xcd6be3[_0xdf37('0x1f4')]-_0xcd6be3[_0xdf37('0x74')]-_0xcd6be3[_0xdf37('0x1f5')];emitCampaignSummary(_0xcd6be3);if(_0x333643>0x0){if(_0x333643>this['maxNumberOriginate']){_0x333643=this[_0xdf37('0x25')];}_0xcd6be3[_0xdf37('0x1f5')]+=_0x333643;this[_0xdf37('0xc2')](_0xcd6be3['id'],_0x333643,_0xcd6be3[_0xdf37('0x1f6')])[_0xdf37('0xb5')](function(_0x5767e7){_0xcd6be3[_0xdf37('0x1f5')]-=_0x333643;_0xcd6be3['temp']=_0xcd6be3[_0xdf37('0x1f5')]>0x0?_0xcd6be3[_0xdf37('0x1f5')]:0x0;if(!checkContactEmpty(_0x5767e7)){_0xcd6be3['message']=_0xdf37('0x9c');logger['info']('[getContactCampaign2][Empty]'+_0xcd6be3['name']);}else{_0xcd6be3[_0xdf37('0x74')]+=_0x5767e7[_0xdf37('0x95')];_0xcd6be3['message']=_0xdf37('0x1f7');for(var _0x942b6=0x0;_0x942b6<_0x5767e7['length'];_0x942b6+=0x1){_0xcd6be3[_0xdf37('0x1f8')]+=0x1;if(_['isNil'](_0x5767e7[_0x942b6])||_[_0xdf37('0xac')](_0x5767e7[_0x942b6]['Contact'])||_[_0xdf37('0xac')](_0x5767e7[_0x942b6][_0xdf37('0x162')][_0xdf37('0x161')])){_0x892e3e[_0xdf37('0xc9')](_0xdf37('0x1f9'),_0xcd6be3,_0x5767e7[_0x942b6]);}else{_0x892e3e[_0xdf37('0xba')](_[_0xdf37('0x124')](_0x5767e7[_0x942b6],[_0xdf37('0xcf'),_0xdf37('0x1fa')]))[_0xdf37('0xb5')](_0x892e3e[_0xdf37('0x1e0')](_0xcd6be3,_0x5767e7[_0x942b6]))[_0xdf37('0xb6')](_0x892e3e[_0xdf37('0xc8')](_0xdf37('0x1fb'),_0xcd6be3));}}}})[_0xdf37('0xb6')](loggerGetContactDialer('[getContactCampaign2]',_0xcd6be3,_0x333643));}};Dialer[_0xdf37('0x1d')]['handlePower']=function(_0x5324e4,_0x288fab){var _0x22164a=this;var _0x32362c=[];var _0x4b17b9=_0x288fab>=0x1?_0x288fab:0x1;var _0x2482eb=[];if(_0x5324e4['dialMethod']===_0xdf37('0xa')){_0x4b17b9=0x1;}var _0x115020=Math[_0xdf37('0x1c0')](_0x5324e4[_0xdf37('0x50')]*_0x4b17b9)-_0x5324e4[_0xdf37('0x74')]-_0x5324e4['temp'];emitVoiceQueueSummary(_0x5324e4);if(_0x5324e4[_0xdf37('0x1fc')]>0x0){var _0x4c06c5=_0x5324e4[_0xdf37('0x1fc')]-_0x5324e4[_0xdf37('0x74')]-_0x5324e4['talking']-_0x5324e4[_0xdf37('0x1f5')]-_0x5324e4['pTalking'];if(_0x115020>_0x4c06c5){_0x115020=_0x4c06c5;}}if(_0x115020>0x0){if(_0x5324e4['dialMethod']===_0xdf37('0xa')){_0x115020=0x1;}if(_0x115020>this['maxNumberOriginate']){_0x115020=this[_0xdf37('0x25')];}_0x5324e4[_0xdf37('0x1f5')]+=_0x115020;for(var _0xc461bf in this[_0xdf37('0x23')]){if(this[_0xdf37('0x23')][_0xdf37('0x96')](_0xc461bf)){if(this[_0xdf37('0x23')][_0xc461bf]['state']===_0xdf37('0x1fd')&&this[_0xdf37('0x23')][_0xc461bf][_0xdf37('0xad')]===_0xdf37('0xd6')){_0x32362c[_0xdf37('0x123')](this[_0xdf37('0x23')][_0xc461bf]['id']);}}}this[_0xdf37('0x1fe')](_0x5324e4['id'],_0x32362c,_0x115020,_0x5324e4[_0xdf37('0x1f6')])[_0xdf37('0xb5')](function(_0x10df0f){_0x5324e4['temp']-=_0x115020;_0x5324e4[_0xdf37('0x1f5')]=_0x5324e4[_0xdf37('0x1f5')]>0x0?_0x5324e4[_0xdf37('0x1f5')]:0x0;if(!checkContactEmpty(_0x10df0f)){_0x22164a[_0xdf37('0xb3')](_0x5324e4)[_0xdf37('0xb5')](sendMessageReschedule(_0x5324e4))[_0xdf37('0xb6')](loggerCatch(_0xdf37('0xb7')));}else{_0x5324e4[_0xdf37('0x74')]+=_0x10df0f[_0xdf37('0x95')];_0x5324e4[_0xdf37('0x3d')]=_0x5324e4[_0xdf37('0x5c')]===_0xdf37('0xa')?_0xdf37('0x1ff'):_0xdf37('0x1f7');for(var _0x4c3f5e=0x0;_0x4c3f5e<_0x10df0f[_0xdf37('0x95')];_0x4c3f5e+=0x1){if(_[_0xdf37('0xac')](_0x10df0f[_0x4c3f5e])||_[_0xdf37('0xac')](_0x10df0f[_0x4c3f5e][_0xdf37('0x162')])||_[_0xdf37('0xac')](_0x10df0f[_0x4c3f5e][_0xdf37('0x162')][_0xdf37('0x161')])){_0x22164a[_0xdf37('0xc9')]('[actionOriginate]\x20',_0x5324e4,_0x10df0f[_0x4c3f5e]);}else{_0x22164a[_0xdf37('0xb8')](_[_0xdf37('0x124')](_0x10df0f[_0x4c3f5e],[_0xdf37('0xce'),_0xdf37('0x1fa')]))[_0xdf37('0xb5')](_0x22164a[_0xdf37('0x1e0')](_0x5324e4,_0x10df0f[_0x4c3f5e]))[_0xdf37('0xb6')](_0x22164a[_0xdf37('0xc8')](_0xdf37('0x1f9'),_0x5324e4));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x5324e4,_0x115020));}};Dialer[_0xdf37('0x1d')][_0xdf37('0x8d')]=function(_0x2eb666){var _0x4ca92d=this;if(_0x2eb666[_0xdf37('0x1fc')]>0x0){var _0x5b4be5=_0x2eb666[_0xdf37('0x1fc')]-_0x2eb666[_0xdf37('0x74')]-_0x2eb666[_0xdf37('0x55')];if(_0x5b4be5>0x0){this[_0xdf37('0x200')](_0x2eb666);}else{loggerPredictiveCalls[_0xdf37('0x7f')]('[handlePredictive][limitChannel]');}}else{this[_0xdf37('0x200')](_0x2eb666);}};Dialer['prototype'][_0xdf37('0x200')]=function(_0x221f88){var _0xfd4035=this;var _0x22afd8=[];_0x221f88[_0xdf37('0x74')]+=0x1;for(var _0x366140 in this[_0xdf37('0x23')]){if(this[_0xdf37('0x23')]['hasOwnProperty'](_0x366140)){if(this[_0xdf37('0x23')][_0x366140][_0xdf37('0xe3')]===_0xdf37('0x1fd')&&this['agents'][_0x366140][_0xdf37('0xad')]===_0xdf37('0xd6')){_0x22afd8[_0xdf37('0x123')](this['agents'][_0x366140]['id']);}}}this[_0xdf37('0x1fe')](_0x221f88['id'],_0x22afd8,0x1,_0x221f88[_0xdf37('0x1f6')])['then'](function(_0x404b10){if(!checkContactEmpty(_0x404b10)){checkContactLowerLimitOriginate(_0x221f88,0x1,0x0);_0xfd4035[_0xdf37('0xb3')](_0x221f88)[_0xdf37('0xb5')](sendMessageReschedule(_0x221f88))[_0xdf37('0xb6')](loggerCatch('[countReScheduled]\x20'));}else{_0x221f88[_0xdf37('0x3d')]=_0xdf37('0x1f7');if(_[_0xdf37('0xac')](_0x404b10[0x0])||_[_0xdf37('0xac')](_0x404b10[0x0][_0xdf37('0x162')])||_['isNil'](_0x404b10[0x0][_0xdf37('0x162')][_0xdf37('0x161')])){_0xfd4035[_0xdf37('0xc9')](_0xdf37('0x1f9'),_0x221f88,_0x404b10[0x0]);}else{_0xfd4035[_0xdf37('0xb8')](_['pick'](_0x404b10[0x0],[_0xdf37('0xce'),_0xdf37('0x1fa')]))[_0xdf37('0xb5')](_0xfd4035[_0xdf37('0x1e0')](_0x221f88,_0x404b10[0x0]))[_0xdf37('0xb6')](_0xfd4035[_0xdf37('0xc8')](_0xdf37('0x201'),_0x221f88));}}})['catch'](loggerGetContactDialer(_0xdf37('0x202'),_0x221f88,0x1));emitVoiceQueueSummary(_0x221f88);};Dialer['prototype'][_0xdf37('0x1d3')]=function(_0x314254,_0x4ddc2b,_0x2f7cf8,_0x4973ec,_0x293bdf,_0x17a823){loggerPredictive[_0xdf37('0x7f')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xdf37('0x203'),_0x314254);loggerPredictive['info'](_0xdf37('0x204'),_0x4ddc2b);loggerPredictive['info'](_0xdf37('0x205'),_0x2f7cf8);loggerPredictive['info'](_0xdf37('0x206'),_0x4973ec);loggerPredictive[_0xdf37('0x7f')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x293bdf);loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x89'));return new BPromise(function(_0x34e1c4,_0x5d4bc4){if(_0x314254<=0x0||isNaN(_0x314254)){return _0x5d4bc4(msgResponse(_0xdf37('0x207'),_0xdf37('0x18a'),_0xdf37('0x208')+_0x314254));}if(_0x2f7cf8<=0x0||isNaN(_0x2f7cf8)){return _0x5d4bc4(msgResponse('[abandonmentRate]',_0xdf37('0x18a'),_0xdf37('0x209')+_0x2f7cf8));}if(_0x4973ec<=0x0||isNaN(_0x4973ec)){return _0x5d4bc4(msgResponse(_0xdf37('0x207'),_0xdf37('0x18a'),_0xdf37('0x20a')+_0x4973ec));}if(_0x4ddc2b<=0x0||isNaN(_0x4ddc2b)){return _0x5d4bc4(msgResponse(_0xdf37('0x207'),'Error',_0xdf37('0x20b')+_0x4ddc2b));}if(_0x293bdf<=0x0||isNaN(_0x293bdf)){return _0x5d4bc4(msgResponse('[abandonmentRate]',_0xdf37('0x18a'),_0xdf37('0x20c')+_0x293bdf));}_0x17a823=_0x17a823||0x0;var _0x4a9bbe=0x1/_0x2f7cf8;var _0x40d8c2=0x0;var _0x190e8f=0x0;var _0x4bd884=0x0;var _0x2eadc3=0x0;for(var _0xe79abd=0x0;_0x4bd884<_0x293bdf;_0xe79abd+=0x1){_0x190e8f=_0xe79abd/_0x4ddc2b;_0x40d8c2=(_0x4973ec*_0x190e8f+_0x17a823)/_0x4a9bbe;_0x4bd884=erlangb(_0x40d8c2,_0x314254);_0x2eadc3=_0x40d8c2/_0x314254*(0x1-erlangb(_0x40d8c2,_0x314254));}return _0x34e1c4({'erlangCalls':_0xe79abd,'erlangCallToSecond':_0x4ddc2b/_0xe79abd,'erlangAbandonmentRate':_0x4bd884,'erlangBusyFactor':_0x2eadc3});});};Dialer[_0xdf37('0x1d')][_0xdf37('0x1d5')]=function(_0x4e264d,_0x339fa2,_0x4da2fb,_0x10e9e2,_0x1a6e9d,_0x567ace){loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x20d'));loggerPredictive[_0xdf37('0x7f')]('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',_0x4e264d);loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x204'),_0x339fa2);loggerPredictive['info'](_0xdf37('0x205'),_0x4da2fb);loggerPredictive[_0xdf37('0x7f')]('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',_0x10e9e2);loggerPredictive['info'](_0xdf37('0x20e'),_0x1a6e9d);loggerPredictive[_0xdf37('0x7f')](_0xdf37('0x89'));return new BPromise(function(_0xc55a65,_0x3d0336){if(_0x4e264d<=0x0||isNaN(_0x4e264d)){return _0x3d0336(msgResponse(_0xdf37('0x20f'),_0xdf37('0x18a'),_0xdf37('0x208')+_0x4e264d));}if(_0x4da2fb<=0x0||isNaN(_0x4da2fb)){return _0x3d0336(msgResponse(_0xdf37('0x20f'),_0xdf37('0x18a'),_0xdf37('0x209')+_0x4da2fb));}if(_0x10e9e2<=0x0||isNaN(_0x10e9e2)){return _0x3d0336(msgResponse('[busyFactor]','Error',_0xdf37('0x20a')+_0x10e9e2));}if(_0x339fa2<=0x0||isNaN(_0x339fa2)){return _0x3d0336(msgResponse(_0xdf37('0x20f'),_0xdf37('0x18a'),_0xdf37('0x20b')+_0x339fa2));}if(_0x1a6e9d<=0x0||isNaN(_0x1a6e9d)){return _0x3d0336(msgResponse(_0xdf37('0x20f'),'Error',_0xdf37('0x210')+_0x1a6e9d));}_0x567ace=_0x567ace||0x0;var _0x1afa13=0x1/_0x4da2fb;var _0x303419=0x0;var _0x3309a5=0x0;var _0x4e1e9c=0x0;var _0x1707e7=0x0;for(var _0x18d44e=0x0;_0x1707e7<_0x1a6e9d;_0x18d44e+=0x1){_0x3309a5=_0x18d44e/_0x339fa2;_0x303419=(_0x10e9e2*_0x3309a5+_0x567ace)/_0x1afa13;_0x4e1e9c=erlangb(_0x303419,_0x4e264d);_0x1707e7=_0x303419/_0x4e264d*(0x1-erlangb(_0x303419,_0x4e264d));}return _0xc55a65({'erlangCalls':_0x18d44e,'erlangCallToSecond':_0x339fa2/_0x18d44e,'erlangAbandonmentRate':_0x4e1e9c,'erlangBusyFactor':_0x1707e7});});};module[_0xdf37('0x211')]=Dialer; \ No newline at end of file +var _0x81cb=['outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','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','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','pTalking','sendMessageOneNotActive','NOT_ACTIVE','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','loopClearZombieChannels','[uniqueid]','actions','[actions]','clearZombieChannels','hasOwnProperty','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','queue','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','reachable','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','state','statedesc','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countcongestionretry','stateGlobal','dialMachineMaxRetry','minutes','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','syncQueueCallerAbandon','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','strategy','locked','stateinterface','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','iftime\x20%s,%s','interval','content','indexOf','true','timezones','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','checkIfTime','dialTimezone','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','pow','replace','match','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','dialPrefix','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','syncOriginateResponse','responsetime','getQueue','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','createStateFinal','reason\x203\x20ringing\x20no\x20answer','buildObj','busy','dialBusyMaxRetry','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','predictiveIntervalPauses','check\x20failure','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','log','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','dialLimitQueue','ACTIVE','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[countReScheduled]\x20','[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]','m\x20=\x20','Error','Ts\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','./history','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','originateresponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','name','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','sumBillable','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay'];(function(_0x35a441,_0x3a2ec6){var _0x571ce3=function(_0x161827){while(--_0x161827){_0x35a441['push'](_0x35a441['shift']());}};_0x571ce3(++_0x3a2ec6);}(_0x81cb,0x1c4));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xb81c('0x0'));var uuid=require(_0xb81c('0x1'));var moment=require('moment');var rr=require('rr');var md5=require(_0xb81c('0x2'));var Redis=require(_0xb81c('0x3'));var ut=require(_0xb81c('0x4'));var config=require(_0xb81c('0x5'));var logger=require(_0xb81c('0x6'))(_0xb81c('0x7'));var loggerBooked=require(_0xb81c('0x6'))(_0xb81c('0x8'));var loggerPredictive=require(_0xb81c('0x6'))('predictive');var loggerPredictiveCalls=require(_0xb81c('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xb81c('0x6'))('syncQueueSummary');var ami=require(_0xb81c('0x9'));config['redis']=_[_0xb81c('0xa')](config[_0xb81c('0xb')],{'host':_0xb81c('0xc'),'port':0x18eb});var io=require(_0xb81c('0xd'))(new Redis(config[_0xb81c('0xb')]));var cmHopper=require(_0xb81c('0xe'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0xb81c('0xf'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xb81c('0x10'));var Hangup=require(_0xb81c('0x11'));var ipAgi=process[_0xb81c('0x12')]['XCALLY_IP_AGI']||_0xb81c('0x13');var strategy={'rrmemory':_0xb81c('0x14'),'roundrobin':_0xb81c('0x15')};var Sequence=function(){};Sequence[_0xb81c('0x16')][_0xb81c('0x17')]=function(_0x194281){this['tail']=this[_0xb81c('0x18')]?this[_0xb81c('0x18')][_0xb81c('0x19')](_0x194281):_0x194281();};function Dialer(_0x292a13,_0x2be89c){this['sequence']=new Sequence();this[_0xb81c('0x1a')]=_0x2be89c;this[_0xb81c('0x1b')]=_0x292a13[_0xb81c('0x1b')];this[_0xb81c('0x1c')]=_0x292a13['campaigns'];this[_0xb81c('0x1d')]=_0x292a13[_0xb81c('0x1d')];this[_0xb81c('0x1e')]=_0x292a13[_0xb81c('0x1e')];this['maxNumberOriginate']=config[_0xb81c('0x1f')]||0x2;this['channels']={};this['actions']={};this['contactsId']={};this[_0xb81c('0x20')]={};this[_0xb81c('0x21')]={};this[_0xb81c('0x22')]={};this[_0xb81c('0x23')]={};this['ivrOriginated']={};this[_0xb81c('0x24')]={};this[_0xb81c('0x25')]={};ami['on'](_0xb81c('0x26'),this[_0xb81c('0x27')]['bind'](this));ami['on'](_0xb81c('0x28'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xb81c('0x29'),this['syncOriginateResponse'][_0xb81c('0x2a')](this));ami['on'](_0xb81c('0x2b'),this[_0xb81c('0x2c')][_0xb81c('0x2a')](this));ami['on'](_0xb81c('0x2d'),this[_0xb81c('0x2e')][_0xb81c('0x2a')](this));ami['on'](_0xb81c('0x2f'),this[_0xb81c('0x30')][_0xb81c('0x2a')](this));ami['on'](_0xb81c('0x31'),this[_0xb81c('0x32')]['bind'](this));ami['on']('varset',this[_0xb81c('0x33')][_0xb81c('0x2a')](this));ami['on'](_0xb81c('0x34'),this['syncQueueMember'][_0xb81c('0x2a')](this));ami['on'](_0xb81c('0x35'),this[_0xb81c('0x36')]['bind'](this));this[_0xb81c('0x37')]();this['loopClearZombieChannels']();}function isNotNull(_0x65a45d){return _0x65a45d!==null&&!_[_0xb81c('0x38')](_0x65a45d);}function checkIsLoggedIn(_0x3ca734,_0x4a47ca){return function(){if(_0x4a47ca<=0x0){_0x3ca734[_0xb81c('0x39')]=_0xb81c('0x3a');throw _0x3ca734['name']+_0xb81c('0x3b');}};}function isActive(_0x3e0cf4){return _0x3e0cf4;}function checkIsActive(_0x2f66be,_0x47eb21){return function(){if(!isActive(_0x47eb21)){_0x2f66be['message']='NOT_ACTIVE';throw _0x2f66be[_0xb81c('0x3c')]+_0xb81c('0x3d');}};}function checkInterval(_0x571413){return function(){if(!isNotNull(_0x571413[_0xb81c('0x3e')])){_0x571413[_0xb81c('0x39')]='INTERVAL_IS_NULL';throw _0x571413[_0xb81c('0x3c')]+_0xb81c('0x3f');}if(!isNotNull(_0x571413[_0xb81c('0x3e')][_0xb81c('0x40')])){_0x571413[_0xb81c('0x39')]='INTERVAL_IS_NULL';throw _0x571413[_0xb81c('0x3c')]+_0xb81c('0x3f');}if(!isNotNull(_['isEmpty'](_0x571413['Interval']['Intervals']))){_0x571413['message']=_0xb81c('0x41');throw _0x571413[_0xb81c('0x3c')]+_0xb81c('0x3f');}};}function msgResponse(_0x52553d,_0x37d50a,_0xf5fe67){return{'action':_0x52553d,'response':_0x37d50a,'message':_0xf5fe67,'stack':_0xf5fe67};}function myreject(_0x24afb3){return function(_0x3a32d8){return _0x24afb3(msgResponse(_0xb81c('0x42'),'Error',JSON['stringify'](_0x3a32d8)));};}function getSeconds(_0x2ca953,_0x6d4aec){var _0x3ff6b5=moment(_0x2ca953)[_0xb81c('0x43')](0x0);var _0x1f3ed6=moment(_0x6d4aec)[_0xb81c('0x43')](0x0);return _0x3ff6b5[_0xb81c('0x44')](_0x1f3ed6,_0xb81c('0x45'));}function emit(_0xd8f54f,_0x47e82d,_0x132568){io['to'](_0xd8f54f)[_0xb81c('0x46')](_0x47e82d,_0x132568);}function emitVoiceQueueSummary(_0xc452fa){if(_0xc452fa[_0xb81c('0x47')]===_0xb81c('0x48')){var _0x46f886={'id':_0xc452fa['id'],'name':_0xc452fa[_0xb81c('0x3c')],'strategy':_0xc452fa['strategy'],'answered':_0xc452fa[_0xb81c('0x49')],'available':_0xc452fa[_0xb81c('0x4a')],'loggedIn':_0xc452fa[_0xb81c('0x4b')],'pTalking':_0xc452fa['pTalking'],'sumBillable':_0xc452fa[_0xb81c('0x4c')],'sumDuration':_0xc452fa['sumDuration'],'sumHoldTime':_0xc452fa['sumHoldTime']||0x0,'talking':_0xc452fa[_0xb81c('0x4d')],'total':_0xc452fa[_0xb81c('0x4e')],'type':_0xc452fa[_0xb81c('0x47')],'unmanaged':_0xc452fa[_0xb81c('0x4f')],'abandoned':_0xc452fa[_0xb81c('0x50')],'waiting':_0xc452fa[_0xb81c('0x51')],'loggedInDb':_0xc452fa[_0xb81c('0x52')],'dialActive':_0xc452fa[_0xb81c('0x53')],'dialMethod':_0xc452fa[_0xb81c('0x54')],'dialOriginateCallerIdName':_0xc452fa[_0xb81c('0x55')],'dialOriginateCallerIdNumber':_0xc452fa[_0xb81c('0x56')],'dialOriginateTimeout':_0xc452fa[_0xb81c('0x57')],'dialPrefix':_0xc452fa['dialPrefix'],'outboundAnswerAgiCallsDay':_0xc452fa[_0xb81c('0x58')],'outboundAnswerCallsDay':_0xc452fa[_0xb81c('0x59')],'outboundBlacklistCallsDay':_0xc452fa[_0xb81c('0x5a')],'outboundBusyCallsDay':_0xc452fa[_0xb81c('0x5b')],'outboundCongestionCallsDay':_0xc452fa[_0xb81c('0x5c')],'outboundDropCallsDayACS':_0xc452fa[_0xb81c('0x5d')],'outboundDropCallsDayCallersExit':_0xc452fa[_0xb81c('0x5e')],'outboundDropCallsDayTimeout':_0xc452fa['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0xc452fa[_0xb81c('0x5f')],'outboundNoSuchCallsDay':_0xc452fa['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0xc452fa[_0xb81c('0x60')],'outboundReCallsDay':_0xc452fa[_0xb81c('0x61')],'outboundRejectCallsDay':_0xc452fa[_0xb81c('0x62')],'outboundUnknownCallsDay':_0xc452fa['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0xc452fa[_0xb81c('0x63')],'predictiveIntervalAvgHoldtime':_0xc452fa[_0xb81c('0x64')],'predictiveIntervalAvgTalktime':_0xc452fa[_0xb81c('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0xc452fa[_0xb81c('0x66')],'predictiveIntervalDroppedCallsTimeout':_0xc452fa[_0xb81c('0x67')],'predictiveIntervalErlangCalls':_0xc452fa[_0xb81c('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0xc452fa[_0xb81c('0x69')],'predictiveIntervalHitRate':_0xc452fa[_0xb81c('0x6a')],'predictiveIntervalMultiplicativeFactor':_0xc452fa[_0xb81c('0x6b')],'predictiveIntervalPauses':_0xc452fa['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xc452fa[_0xb81c('0x6c')],'predictiveIntervalTotalCalls':_0xc452fa[_0xb81c('0x6d')],'message':_0xc452fa[_0xb81c('0x39')],'originated':_0xc452fa['originated'],'erlangCalls':_0xc452fa[_0xb81c('0x6e')],'erlangCallToSecond':_0xc452fa[_0xb81c('0x6f')],'erlangAbandonmentRate':_0xc452fa['erlangAbandonmentRate'],'erlangBusyFactor':_0xc452fa[_0xb81c('0x70')],'startPredictive':_0xc452fa[_0xb81c('0x22')],'startProgressive':_0xc452fa[_0xb81c('0x23')]};if(_0xc452fa[_0xb81c('0x71')]){_0x46f886['Trunk']={'id':_0xc452fa[_0xb81c('0x71')]['id'],'name':_0xc452fa[_0xb81c('0x71')][_0xb81c('0x3c')],'active':_0xc452fa['Trunk'][_0xb81c('0x72')],'callerid':_0xc452fa[_0xb81c('0x71')][_0xb81c('0x73')]};}if(_0xc452fa[_0xb81c('0x3e')]){_0x46f886[_0xb81c('0x3e')]={'id':_0xc452fa[_0xb81c('0x3e')]['id'],'name':_0xc452fa[_0xb81c('0x3e')][_0xb81c('0x3c')]};}var _0x544c0f=md5(JSON[_0xb81c('0x74')](_0x46f886));if(_0xc452fa['md5']!==_0x544c0f){_0xc452fa[_0xb81c('0x2')]=_0x544c0f;emit(util[_0xb81c('0x75')](_0xb81c('0x76'),_0x46f886[_0xb81c('0x3c')]),_0xb81c('0x77'),_0x46f886);}}}function emitCampaignSummary(_0x5dc586){if(_0x5dc586['type']===_0xb81c('0x78')){emit(util[_0xb81c('0x75')](_0xb81c('0x79'),_0x5dc586[_0xb81c('0x3c')]),'campaign:save',_0x5dc586);}}function checkGetDataPredictive(_0x32930f){if(isNotNull(_0x32930f)){if(!_[_0xb81c('0x7a')](_0x32930f)){loggerPredictive['info'](_0xb81c('0x7b'));loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x7d'),_0x32930f[_0xb81c('0x6d')]);loggerPredictive['info'](_0xb81c('0x7e'),_0x32930f[_0xb81c('0x63')]);loggerPredictive['info'](_0xb81c('0x7f'),_0x32930f[_0xb81c('0x67')]);loggerPredictive[_0xb81c('0x7c')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x32930f[_0xb81c('0x66')]);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x80'),_0x32930f[_0xb81c('0x64')]);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x81'),_0x32930f['predictiveIntervalAvgTalktime']);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x82'));if(_0x32930f[_0xb81c('0x6d')]>0x0){if(!_[_0xb81c('0x38')](_0x32930f[_0xb81c('0x65')])&&_0x32930f[_0xb81c('0x65')]>0x0){return!![];}else{loggerPredictive[_0xb81c('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_['isUndefined'](_0x32930f[_0xb81c('0x64')])&&_0x32930f[_0xb81c('0x64')]>0x0){return!![];}else{loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x83'));}}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x84'));}}else{loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x84'));}return![];}function mergeDataErlangB(_0x2812cc){return function(_0x398524){loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x85'));loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x86'),_0x398524[_0xb81c('0x6e')]);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x87'),_0x398524[_0xb81c('0x6f')]);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x88'),_0x398524[_0xb81c('0x89')]);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x8a'),_0x398524[_0xb81c('0x70')]);loggerPredictive['info'](_0xb81c('0x88'),_0x398524[_0xb81c('0x89')]);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x82'));_['merge'](_0x2812cc,_0x398524);};}function getDiff(_0x36a105){var _0x569b00=moment()['milliseconds'](0x0);var _0xc83524=moment(_0x36a105)[_0xb81c('0x43')](0x0);return _0x569b00[_0xb81c('0x44')](_0xc83524,_0xb81c('0x45'));}function ifInterval(_0xc1d9e8,_0x24b193){if(_[_0xb81c('0x38')](_0x24b193)){return![];}if(getDiff(_0x24b193)<_0xc1d9e8*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3d4335){if(isNotNull(_0x3d4335)){if(!_[_0xb81c('0x38')](_0x3d4335[_0xb81c('0x23')])){_0x3d4335[_0xb81c('0x23')]=undefined;loggerPredictive[_0xb81c('0x7c')](_0x3d4335[_0xb81c('0x3c')],_0xb81c('0x8b'));}if(!_[_0xb81c('0x38')](_0x3d4335[_0xb81c('0x22')])){_0x3d4335['startPredictive']=undefined;loggerPredictive[_0xb81c('0x7c')](_0x3d4335[_0xb81c('0x3c')],_0xb81c('0x8c'));}if(!_['isUndefined'](_0x3d4335[_0xb81c('0x8d')])){clearInterval(_0x3d4335[_0xb81c('0x8d')]);_0x3d4335[_0xb81c('0x8d')]=undefined;loggerPredictive[_0xb81c('0x7c')](_0x3d4335['name'],_0xb81c('0x8e'));}}}function erlangb(_0x2dbbfb,_0x12851a){if(_0x12851a===0x0){return 0x0;}var _0x4621c9=0x1;for(var _0x40d9e0=0x1;_0x40d9e0<=_0x12851a;_0x40d9e0+=0x1){_0x4621c9=0x1+_0x4621c9*_0x40d9e0/_0x2dbbfb;}return 0x1/_0x4621c9;}function isVoiceQueueOutbound(_0x241cac){return _0x241cac==='outbound';}function isNotPreview(_0x1f7967){return _0x1f7967!==_0xb81c('0x1a');}function isCampaignIvr(_0x28799e){return _0x28799e==='ivr';}function getCallerId(_0x239891,_0x787e8,_0x4a1915){if(!_[_0xb81c('0x38')](_0x4a1915)&&'string'===typeof _0x4a1915&&!_[_0xb81c('0x7a')](_0x4a1915)){if(!_[_0xb81c('0x38')](_0x787e8)&&'string'===typeof _0x787e8&&!_[_0xb81c('0x7a')](_0x787e8)){return util[_0xb81c('0x75')]('\x22%s\x22\x20<%s>',_0x787e8,_0x4a1915);}return util[_0xb81c('0x75')](_0xb81c('0x8f'),_0x4a1915,_0x4a1915);}if(!_['isUndefined'](_0x239891)&&'string'===typeof _0x239891&&!_[_0xb81c('0x7a')](_0x239891)){return _0x239891;}return _0xb81c('0x90');}function loggerCatchQueueSummary(_0x3c1c56,_0x429651){return function(_0x1517be){freeVariablesPredictive(_0x429651);emitVoiceQueueSummary(_0x429651);emitCampaignSummary(_0x429651);loggerSyncQueueSummary[_0xb81c('0x91')](_0x3c1c56,util[_0xb81c('0x92')](_0x1517be,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4f70f2,_0xf8a7a2){return function(_0xeb699b){loggerPredictive[_0xb81c('0x91')](_0xf8a7a2['name'],_0x4f70f2);loggerPredictive[_0xb81c('0x91')](_0xeb699b[_0xb81c('0x93')]);freeVariablesPredictive(_0xf8a7a2);};}function loggerCatch(_0x1bfd6e){return function(_0x574fac){logger[_0xb81c('0x91')](_0x1bfd6e,util[_0xb81c('0x92')](_0x574fac,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5d2707){return _0x5d2707&&!_[_0xb81c('0x38')](_0x5d2707)&&_0x5d2707[_0xb81c('0x94')]>0x0;}function decremetOriginate(_0x35bb9f){if(!_[_0xb81c('0x38')](_0x35bb9f)&&_0x35bb9f!==null){if(_0x35bb9f['hasOwnProperty']('originated')){if(_0x35bb9f[_0xb81c('0x95')]>0x0){_0x35bb9f[_0xb81c('0x95')]-=0x1;}else{logger[_0xb81c('0x91')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xb81c('0x91')](_0xb81c('0x96'));}}function checkContactLowerLimitOriginate(_0x14e774,_0x5dda35,_0x4b21db){if(_0x5dda35>_0x4b21db){for(var _0x5ced74=0x0;_0x5ced74<_0x5dda35-_0x4b21db;_0x5ced74+=0x1){decremetOriginate(_0x14e774);}}}function loggerGetContactDialer(_0x4f34e1,_0x375154,_0xd40af2){return function(_0x35f975){checkContactLowerLimitOriginate(_0x375154,_0xd40af2,0x0);logger['error'](_0x4f34e1,util[_0xb81c('0x92')](_0x35f975,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x504e18){return function(_0x348d33){if(isNotNull(_0x348d33)&&isNotNull(_0x348d33[0x0])){if(_0x348d33[0x0][_0xb81c('0x97')]>0x0){_0x504e18[_0xb81c('0x39')]=_0xb81c('0x98');logger[_0xb81c('0x7c')](_0xb81c('0x99')+_0x504e18[_0xb81c('0x3c')],_0x348d33[0x0][_0xb81c('0x97')],_0xb81c('0x9a'));}else{_0x504e18['message']=_0xb81c('0x9b');logger[_0xb81c('0x7c')](_0xb81c('0x9c')+_0x504e18[_0xb81c('0x3c')]);}}};}function notSendMessagesQueue(_0x416e67){if(_0x416e67['sendMessageOneNotActive']){freeVariablesPredictive(_0x416e67);if(_0x416e67[_0xb81c('0x95')]===0x0&&_0x416e67[_0xb81c('0x4d')]===0x0&&_0x416e67[_0xb81c('0x51')]===0x0&&(_0x416e67[_0xb81c('0x9d')]||0x0)===0x0){_0x416e67[_0xb81c('0x9e')]=![];_0x416e67[_0xb81c('0x4a')]=0x0;_0x416e67[_0xb81c('0x39')]=_0xb81c('0x9f');loggerSyncQueueSummary[_0xb81c('0x91')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x416e67['name'],_0xb81c('0xa0'));}else{_0x416e67[_0xb81c('0x39')]=_0xb81c('0xa1');loggerSyncQueueSummary[_0xb81c('0x91')](_0xb81c('0xa2'),_0x416e67['name'],_0xb81c('0xa3'));}emitVoiceQueueSummary(_0x416e67);}}function notSendMessagesCampaign(_0x55ec7f){if(_0x55ec7f['sendMessageOneNotActive']){if(_0x55ec7f[_0xb81c('0x95')]===0x0){_0x55ec7f['sendMessageOneNotActive']=![];_0x55ec7f[_0xb81c('0x39')]=_0xb81c('0x9f');loggerSyncQueueSummary[_0xb81c('0x91')](_0xb81c('0xa4'),_0x55ec7f[_0xb81c('0x3c')],_0xb81c('0xa0'));}else{_0x55ec7f[_0xb81c('0x39')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0xb81c('0xa4'),_0x55ec7f['name'],_0xb81c('0xa3'));}emitCampaignSummary(_0x55ec7f);}}function createObjHistory(_0xba2d7,_0x433bdb,_0x3c0f0e,_0x18b8c8,_0x4e3559){_0xba2d7[_0xb81c('0x39')]=_0x3c0f0e;var _0x57faf3=new Action(_0xba2d7,_0x433bdb);var _0x56b601=new History(_0x57faf3);_0x56b601['state']=_0x18b8c8;_0x56b601['statedesc']=_0x4e3559;_0x56b601[_0xb81c('0xa5')]=_0x57faf3['starttime'];return _0x56b601;}Dialer['prototype'][_0xb81c('0xa6')]=function(){var _0x369835=this;setInterval(function(){_0x369835['clearZombieChannels'](_0x369835[_0xb81c('0x20')],_0xb81c('0xa7'));_0x369835['clearZombieChannels'](_0x369835[_0xb81c('0xa8')],_0xb81c('0xa9'));},0x32c8);};Dialer[_0xb81c('0x16')][_0xb81c('0xaa')]=function(_0x28907e,_0xb96be4){var _0xc499ea=this;for(var _0x18f44b in _0x28907e){if(_0x28907e[_0xb81c('0xab')](_0x18f44b)){this[_0xb81c('0xac')][_0xb81c('0x17')](function(){if(!_[_0xb81c('0xad')](_0x28907e[_0x18f44b])){return ami[_0xb81c('0xae')]({'action':_0xb81c('0xaf'),'channel':_0x28907e[_0x18f44b][_0xb81c('0xb0')]})[_0xb81c('0xb1')](function(_0x4245c1){if(_0x4245c1['message']===_0xb81c('0xb2')){setTimeout(function(){if(_0x28907e[_0x18f44b]&&_0x28907e[_0x18f44b][_0xb81c('0x47')]!==_0xb81c('0x78')){_0xc499ea['updateOriginated'](_0xc499ea[_0xb81c('0x1b')][_0x28907e[_0x18f44b][_0xb81c('0xb3')]]);logger[_0xb81c('0x91')]('[Dialer][checkChannel]',_0xb96be4,_0x18f44b,_0x28907e[_0x18f44b]['queue']);delete _0x28907e[_0x18f44b];}if(_0x28907e[_0x18f44b]&&_0x28907e[_0x18f44b][_0xb81c('0x47')]===_0xb81c('0x78')){_0xc499ea[_0xb81c('0xb4')](_0xc499ea[_0xb81c('0x1c')][_0x28907e[_0x18f44b][_0xb81c('0xb3')]]);logger[_0xb81c('0x91')](_0xb81c('0xb5'),_0xb96be4,_0x18f44b,_0x28907e[_0x18f44b][_0xb81c('0xb3')]);delete _0x28907e[_0x18f44b];}},0x2328);}});}});}}};Dialer[_0xb81c('0x16')][_0xb81c('0xb6')]=function(_0x1cfceb){return BPromise[_0xb81c('0xb7')]()[_0xb81c('0xb8')](cmHopper[_0xb81c('0xb6')](_0x1cfceb))[_0xb81c('0xb1')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xb81c('0x16')][_0xb81c('0xb9')]=function(_0x4d6bf6){return BPromise[_0xb81c('0xb7')]()['then'](cmHopperBlack[_0xb81c('0xb9')](_0x4d6bf6))[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xba')));};Dialer['prototype'][_0xb81c('0xbb')]=function(_0x3ded57){return BPromise[_0xb81c('0xb7')]()['then'](cmHopperBlack[_0xb81c('0xbb')](_0x3ded57))[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xbc')));};Dialer[_0xb81c('0x16')][_0xb81c('0xbd')]=function(_0x1516b4){return BPromise[_0xb81c('0xb7')]()[_0xb81c('0xb8')](cmHopperHistory[_0xb81c('0xbe')](_0x1516b4))[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xbf')));};Dialer[_0xb81c('0x16')][_0xb81c('0xc0')]=function(_0x5ac4cf){return BPromise['resolve']()['then'](cmHopper[_0xb81c('0xc0')](_0x5ac4cf))[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xc1')));};Dialer[_0xb81c('0x16')][_0xb81c('0xc2')]=function(_0x4650a8,_0x147a71,_0x579f28){return BPromise[_0xb81c('0xb7')]()[_0xb81c('0xb8')](cmHopper[_0xb81c('0xc2')](_0x4650a8,_0x147a71,_0x579f28))['catch'](loggerCatch(_0xb81c('0xc3')));};Dialer['prototype'][_0xb81c('0xc4')]=function(_0x18c588,_0x5cf0c3,_0xdc71a5,_0x59ad4f){return BPromise['resolve']()[_0xb81c('0xb8')](cmHopper[_0xb81c('0xc4')](_0x18c588,_0x5cf0c3,_0xdc71a5,_0x59ad4f))[_0xb81c('0xb1')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xb81c('0x16')][_0xb81c('0xc5')]=function(_0xd79665,_0x503137,_0x24ae7c){return BPromise['resolve']()['then'](cmHopper[_0xb81c('0xc5')](_0xd79665,_0x503137,_0x24ae7c))[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xc6')));};Dialer[_0xb81c('0x16')][_0xb81c('0xc7')]=function(_0x37d3d8){return BPromise[_0xb81c('0xb7')]()[_0xb81c('0xb8')](voiceQueueRt['getVoiceQueueRtPauses'](_0x37d3d8))['catch'](loggerCatch(_0xb81c('0xc8')));};Dialer[_0xb81c('0x16')][_0xb81c('0xc9')]=function(_0x2538f7){return BPromise[_0xb81c('0xb7')]()[_0xb81c('0xb8')](cmHopper[_0xb81c('0xc9')](_0x2538f7))[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xca')));};Dialer[_0xb81c('0x16')][_0xb81c('0xcb')]=function(_0x263a7a){return BPromise[_0xb81c('0xb7')]()['then'](cmHopperHistory[_0xb81c('0xcb')](_0x263a7a))[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xcc')));};Dialer[_0xb81c('0x16')][_0xb81c('0xb4')]=function(_0x52d092){if(!_['isUndefined'](_0x52d092)&&_0x52d092!==null){if(_0x52d092[_0xb81c('0xab')](_0xb81c('0x95'))){if(_0x52d092[_0xb81c('0x95')]>0x0){_0x52d092[_0xb81c('0x95')]-=0x1;}else{logger[_0xb81c('0x91')](_0xb81c('0xcd'));}}}else{logger[_0xb81c('0x91')](_0xb81c('0xce'));}};Dialer[_0xb81c('0x16')][_0xb81c('0xcf')]=function(_0x45fdb2,_0x117c2){var _0x4f852a=this;return function(_0x1bb857){_0x4f852a[_0xb81c('0xb4')](_0x117c2);logger[_0xb81c('0x91')](_0x45fdb2,util[_0xb81c('0x92')](_0x1bb857,{'showHidden':![],'depth':null}));};};Dialer[_0xb81c('0x16')]['emptyContact']=function(_0x2f57ef,_0xfb44cb,_0xba056d){var _0x2c821a={'state':0x19,'statedesc':_0xb81c('0xd0')};this[_0xb81c('0xb4')](_0xfb44cb);this['saveInDb'](_[_0xb81c('0xd1')](_0x2c821a,_[_0xb81c('0xd2')](_0xba056d,[_0xb81c('0xd3'),_0xb81c('0xd4'),_0xb81c('0xd5'),_0xb81c('0xd6'),_0xb81c('0xd7')])),_0xb81c('0xd8'),_0xb81c('0xd9'));logger[_0xb81c('0x91')](_0x2f57ef);};Dialer[_0xb81c('0x16')][_0xb81c('0xda')]=function(_0x8848b6){return _0x8848b6===_0xb81c('0xdb');};Dialer[_0xb81c('0x16')]['isTrunkReachable']=function(_0x48b235){return!_[_0xb81c('0x38')](_0x48b235)&&_0x48b235&&!_[_0xb81c('0x38')](_0x48b235['name'])&&!_[_0xb81c('0x38')](_0x48b235[_0xb81c('0x72')])&&_0x48b235['active']&&(this['trunks'][util[_0xb81c('0x75')](_0xb81c('0xdc'),_0x48b235[_0xb81c('0x3c')])]['status']===_0xb81c('0xdd')||this[_0xb81c('0x1e')][util[_0xb81c('0x75')]('SIP/%s',_0x48b235['name'])][_0xb81c('0xaf')]==='unmonitored');};Dialer[_0xb81c('0x16')][_0xb81c('0xde')]=function(_0x4a8485,_0xa22aa4,_0x20098d){this[_0xb81c('0xcb')](_0x4a8485)['catch'](loggerCatch(_0xa22aa4));this[_0xb81c('0xc9')](_0x4a8485)[_0xb81c('0xb1')](loggerCatch(_0x20098d));};Dialer['prototype'][_0xb81c('0x33')]=function(_0x2723e9){var _0x3f7df1=this[_0xb81c('0x20')][_0x2723e9[_0xb81c('0xdf')]];var _0x5d41c9;if(!_[_0xb81c('0xad')](_0x2723e9)&&!_[_0xb81c('0xad')](_0x2723e9['variable'])&&!_[_0xb81c('0xad')](_0x2723e9[_0xb81c('0xe0')][_0xb81c('0xe1')])&&_0x2723e9[_0xb81c('0xe2')]===_0xb81c('0xe3')&&_0x3f7df1){if(_0x3f7df1['type']!==_0xb81c('0x78')&&this[_0xb81c('0x1b')][_0x3f7df1[_0xb81c('0xb3')]][_0xb81c('0xe4')]&&_0x2723e9[_0xb81c('0xe5')]==='HANGUP'){delete this[_0xb81c('0x20')][_0x2723e9['uniqueid']];this['updateOriginated'](this[_0xb81c('0x1b')][_0x3f7df1[_0xb81c('0xb3')]]);this[_0xb81c('0x1b')][_0x3f7df1['queue']][_0xb81c('0x59')]+=0x1;this[_0xb81c('0x1b')][_0x3f7df1[_0xb81c('0xb3')]][_0xb81c('0x58')]+=0x1;_0x5d41c9=new Hangup(_0x3f7df1,_0x2723e9);_0x5d41c9[_0xb81c('0xe6')]=0x12;_0x5d41c9[_0xb81c('0xe7')]=_0xb81c('0xe8');_0x5d41c9[_0xb81c('0xe9')]=_0xb81c('0xea');this['saveInDb'](_0x5d41c9,_0xb81c('0xeb'),_0xb81c('0xec'));}if(_0x3f7df1[_0xb81c('0x47')]!==_0xb81c('0x78')&&this[_0xb81c('0x1b')][_0x3f7df1['queue']][_0xb81c('0xe4')]&&_0x2723e9[_0xb81c('0xe5')]==='MACHINE'){var _0x248c87=this;return new BPromise(function(_0x4d9310,_0x5202fa){delete _0x248c87[_0xb81c('0x20')][_0x2723e9[_0xb81c('0xdf')]];_0x248c87['updateOriginated'](_0x248c87[_0xb81c('0x1b')][_0x3f7df1[_0xb81c('0xb3')]]);_0x248c87[_0xb81c('0x1b')][_0x3f7df1[_0xb81c('0xb3')]][_0xb81c('0x59')]+=0x1;_0x248c87[_0xb81c('0x1b')][_0x3f7df1['queue']][_0xb81c('0x58')]+=0x1;var _0x2624a9=_0x248c87[_0xb81c('0x1b')][_0x3f7df1[_0xb81c('0xb3')]];var _0xf47e58=new Hangup(_0x3f7df1,_0x2723e9);_0xf47e58['state']=0x13;_0xf47e58[_0xb81c('0xe7')]='Machine';_0xf47e58[_0xb81c('0xe9')]=_0xb81c('0xea');_0xf47e58[_0xb81c('0xed')]+=0x1;_0xf47e58[_0xb81c('0xee')]+=0x1;_0xf47e58[_0xb81c('0xef')]=!![];_0x248c87['createHistory'](_0xf47e58)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xf0')));if(_0xf47e58[_0xb81c('0xf1')]+_0xf47e58['countcongestionretry']+_0xf47e58[_0xb81c('0xf2')]+_0xf47e58[_0xb81c('0xf3')]+_0xf47e58[_0xb81c('0xf4')]+_0xf47e58[_0xb81c('0xf5')]+_0xf47e58[_0xb81c('0xed')]+_0xf47e58[_0xb81c('0xf6')]>=_0x2624a9[_0xb81c('0xf7')]){_0x248c87['stateGlobal'](_0xf47e58,_0x4d9310,_0x5202fa,_0xb81c('0xf8'));}else{if(_0xf47e58[_0xb81c('0xed')]>=_0x2624a9['dialMachineMaxRetry']){_0x248c87['createStateFinal'](_0xf47e58,_0x4d9310,_0x5202fa,_0xb81c('0xf9'));}else{_0x248c87[_0xb81c('0xc0')]({'active':![],'countmachineretry':_0xf47e58['countmachineretry'],'scheduledat':moment()[_0xb81c('0xfa')](_0x2624a9[_0xb81c('0xfb')],'minutes')['format'](_0xb81c('0xfc')),'ContactId':_0xf47e58[_0xb81c('0xd3')],'ListId':_0xf47e58[_0xb81c('0xd4')],'VoiceQueueId':_0xf47e58['VoiceQueueId']||undefined,'CampaignId':_0xf47e58[_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xfd')));_0x4d9310({'reschedule':0x1});}}});}if(_0x3f7df1[_0xb81c('0x47')]===_0xb81c('0x78')&&this[_0xb81c('0x1c')][_0x3f7df1[_0xb81c('0xb3')]][_0xb81c('0xe4')]&&_0x2723e9['value']===_0xb81c('0xfe')){delete this[_0xb81c('0x20')][_0x2723e9[_0xb81c('0xdf')]];this[_0xb81c('0xb4')](this[_0xb81c('0x1c')][_0x3f7df1[_0xb81c('0xb3')]]);_0x5d41c9=new Hangup(_0x3f7df1,_0x2723e9);_0x5d41c9[_0xb81c('0xe6')]=0x12;_0x5d41c9['statedesc']='HangupInAMD';_0x5d41c9[_0xb81c('0xe9')]=_0xb81c('0xea');this[_0xb81c('0xde')](_0x5d41c9,_0xb81c('0xff'),_0xb81c('0x100'));}if(_0x3f7df1[_0xb81c('0x47')]===_0xb81c('0x78')&&this['campaigns'][_0x3f7df1[_0xb81c('0xb3')]]['dialAMDActive']&&_0x2723e9[_0xb81c('0xe5')]===_0xb81c('0x101')){var _0x248c87=this;return new BPromise(function(_0x3e8f56,_0x52c927){delete _0x248c87[_0xb81c('0x20')][_0x2723e9['uniqueid']];_0x248c87[_0xb81c('0xb4')](_0x248c87['campaigns'][_0x3f7df1[_0xb81c('0xb3')]]);_0x248c87['campaigns'][_0x3f7df1[_0xb81c('0xb3')]][_0xb81c('0x59')]+=0x1;_0x248c87['campaigns'][_0x3f7df1[_0xb81c('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x28db18=_0x248c87[_0xb81c('0x1c')][_0x3f7df1[_0xb81c('0xb3')]];var _0x4bd25e=new Hangup(_0x3f7df1,_0x2723e9);_0x4bd25e['state']=0x13;_0x4bd25e[_0xb81c('0xe7')]=_0xb81c('0x102');_0x4bd25e[_0xb81c('0xe9')]='AMD';_0x4bd25e['countmachineretry']+=0x1;_0x4bd25e['countglobal']+=0x1;_0x4bd25e['amd']=!![];_0x248c87[_0xb81c('0xcb')](_0x4bd25e)['catch'](loggerCatch(_0xb81c('0xf0')));if(_0x4bd25e['countbusyretry']+_0x4bd25e[_0xb81c('0x103')]+_0x4bd25e[_0xb81c('0xf2')]+_0x4bd25e[_0xb81c('0xf3')]+_0x4bd25e[_0xb81c('0xf4')]+_0x4bd25e[_0xb81c('0xf5')]+_0x4bd25e[_0xb81c('0xed')]+_0x4bd25e[_0xb81c('0xf6')]>=_0x28db18[_0xb81c('0xf7')]){_0x248c87[_0xb81c('0x104')](_0x4bd25e,_0x3e8f56,_0x52c927,_0xb81c('0xf8'));}else{if(_0x4bd25e['countmachineretry']>=_0x28db18[_0xb81c('0x105')]){_0x248c87['createStateFinal'](_0x4bd25e,_0x3e8f56,_0x52c927,_0xb81c('0xf9'));}else{_0x248c87[_0xb81c('0xc0')]({'active':![],'countmachineretry':_0x4bd25e[_0xb81c('0xed')],'scheduledat':moment()[_0xb81c('0xfa')](_0x28db18['dialMachineRetryFrequency'],_0xb81c('0x106'))['format'](_0xb81c('0xfc')),'ContactId':_0x4bd25e['ContactId'],'ListId':_0x4bd25e['ListId'],'VoiceQueueId':_0x4bd25e['VoiceQueueId']||undefined,'CampaignId':_0x4bd25e['CampaignId']||undefined})['catch'](loggerCatch(_0xb81c('0xfd')));_0x3e8f56({'reschedule':0x1});}}});}}};Dialer[_0xb81c('0x16')][_0xb81c('0x30')]=function(_0x27822e){var _0xfeb3f5=this[_0xb81c('0x20')][_0x27822e['uniqueid']];var _0x17e6a0=this;var _0x39a211;if(_0xfeb3f5&&_0xfeb3f5[_0xb81c('0x47')]===_0xb81c('0x78')){delete this[_0xb81c('0x20')][_0x27822e[_0xb81c('0xdf')]];this[_0xb81c('0xb4')](this[_0xb81c('0x1c')][_0xfeb3f5[_0xb81c('0xb3')]]);this[_0xb81c('0x1c')][_0xfeb3f5[_0xb81c('0xb3')]][_0xb81c('0x107')]+=0x1;_0x39a211=new Hangup(_0xfeb3f5,_0x27822e);this[_0xb81c('0xcb')](_0x39a211)[_0xb81c('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xb81c('0xc9')](_0x39a211)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x108')));}if(_0xfeb3f5&&_0xfeb3f5[_0xb81c('0x47')]!==_0xb81c('0x78')&&isNotNull(this[_0xb81c('0x1b')][_0xfeb3f5[_0xb81c('0xb3')]][_0xb81c('0x109')])){delete this[_0xb81c('0x20')][_0x27822e['uniqueid']];this['updateOriginated'](this[_0xb81c('0x1b')][_0xfeb3f5[_0xb81c('0xb3')]]);this['voiceQueues'][_0xfeb3f5[_0xb81c('0xb3')]][_0xb81c('0x59')]+=0x1;this[_0xb81c('0x1b')][_0xfeb3f5[_0xb81c('0xb3')]][_0xb81c('0x58')]+=0x1;_0x39a211=new Hangup(_0xfeb3f5,_0x27822e);_0x39a211[_0xb81c('0xe6')]=0x10;_0x39a211[_0xb81c('0xe7')]='AnswerAGI';_0x39a211[_0xb81c('0xe9')]=_0xb81c('0x10a');this[_0xb81c('0xcb')](_0x39a211)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x10b')));this['moveContactManagedDialer'](_0x39a211)['catch'](loggerCatch(_0xb81c('0x108')));}if(_0xfeb3f5&&_0xfeb3f5[_0xb81c('0x47')]!==_0xb81c('0x78')&&!isNotNull(this['voiceQueues'][_0xfeb3f5[_0xb81c('0xb3')]][_0xb81c('0x109')])){delete this[_0xb81c('0x20')][_0x27822e['uniqueid']];this[_0xb81c('0xb4')](this[_0xb81c('0x1b')][_0xfeb3f5[_0xb81c('0xb3')]]);this[_0xb81c('0x1b')][_0xfeb3f5[_0xb81c('0xb3')]][_0xb81c('0x10c')]+=0x1;_0x39a211=new Hangup(_0xfeb3f5,_0x27822e);_0x39a211['state']=0xc;_0x39a211['statedesc']=_0x27822e[_0xb81c('0x10d')];_0x39a211[_0xb81c('0xe9')]=_0xb81c('0x10e');this[_0xb81c('0xcb')](_0x39a211)[_0xb81c('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xb81c('0xc9')](_0x39a211)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x108')));}};Dialer['prototype'][_0xb81c('0x2c')]=function(_0x16b509){var _0x250978=this['uniqueId'][_0x16b509[_0xb81c('0xdf')]];var _0x41f46c=this;if(this[_0xb81c('0x1b')][_0x16b509[_0xb81c('0xb3')]]){if(_0x250978&&_0x250978[_0xb81c('0x47')]!==_0xb81c('0x78')){delete this[_0xb81c('0x20')][_0x16b509[_0xb81c('0xdf')]];this[_0xb81c('0x1b')][_0x16b509['queue']][_0xb81c('0x59')]+=0x1;var _0x336fb9=new AgentComplete(_0x250978,_0x16b509);if(_0x16b509[_0xb81c('0x10f')]===_0xb81c('0x110')){_0x336fb9[_0xb81c('0x111')]=this[_0xb81c('0x1b')][_0x16b509[_0xb81c('0xb3')]]['dialQueueProject2']&&this[_0xb81c('0x1b')][_0x16b509[_0xb81c('0xb3')]][_0xb81c('0x112')]?moment()['format'](_0xb81c('0xfc')):undefined;}this[_0xb81c('0xcb')](_0x336fb9)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x113')));this['moveContactManagedDialer'](_0x336fb9)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xb81c('0x16')][_0xb81c('0x27')]=function(_0xe3d361){if(this['voiceQueues'][_0xe3d361['queue']]){if(this[_0xb81c('0x20')][_0xe3d361['uniqueid']]&&this[_0xb81c('0x20')][_0xe3d361['uniqueid']]['type']!==_0xb81c('0x78')){this[_0xb81c('0xb4')](this[_0xb81c('0x1b')][_0xe3d361[_0xb81c('0xb3')]]);this[_0xb81c('0x20')][_0xe3d361[_0xb81c('0xdf')]][_0xb81c('0x114')]=moment()['format'](_0xb81c('0xfc'));}}};Dialer[_0xb81c('0x16')][_0xb81c('0x115')]=function(_0x259cad){this[_0xb81c('0xcb')](_0x259cad)[_0xb81c('0xb1')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xb81c('0xc9')](_0x259cad)[_0xb81c('0xb1')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xb81c('0x16')][_0xb81c('0x116')]=function(_0x272e1c){var _0xafc124=this[_0xb81c('0x20')][_0x272e1c[_0xb81c('0xdf')]];var _0x5180f6=this;if(this[_0xb81c('0x1b')][_0x272e1c[_0xb81c('0xb3')]]){if(_0xafc124&&_0xafc124[_0xb81c('0x47')]!=='ivr'){delete this[_0xb81c('0x20')][_0x272e1c[_0xb81c('0xdf')]];this[_0xb81c('0xb4')](this['voiceQueues'][_0x272e1c[_0xb81c('0xb3')]]);_0xafc124[_0xb81c('0x117')]=moment()['format'](_0xb81c('0xfc'));var _0x217b20=new QueueCallerAbandon(_0xafc124,_0x272e1c);if(getSeconds(_0xafc124[_0xb81c('0x117')],_0xafc124['responsetime'])>=_0xafc124[_0xb81c('0x118')]){this[_0xb81c('0x1b')][_0x272e1c[_0xb81c('0xb3')]][_0xb81c('0x67')]+=0x1;this['voiceQueues'][_0x272e1c[_0xb81c('0xb3')]][_0xb81c('0x119')]+=0x1;this[_0xb81c('0x1b')][_0x272e1c[_0xb81c('0xb3')]][_0xb81c('0x69')]+=0x1;_0x217b20[_0xb81c('0xe6')]=0xa;_0x217b20[_0xb81c('0xe7')]=_0xb81c('0x11a');_0x217b20['dropreason']=_0xb81c('0x11b');_0x217b20['agiafterat']=this[_0xb81c('0x1b')][_0x272e1c[_0xb81c('0xb3')]]['dialQueueProject2']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x217b20['countdropretry']+=0x1;_0x217b20[_0xb81c('0xee')]+=0x1;if(_0x217b20['countdropretry']>=this['voiceQueues'][_0x272e1c['queue']][_0xb81c('0x11c')]){this[_0xb81c('0x115')](_0x217b20);}else{this[_0xb81c('0xc0')]({'active':![],'countdropretry':_0x217b20[_0xb81c('0xf4')],'scheduledat':moment()[_0xb81c('0xfa')](this[_0xb81c('0x1b')][_0x272e1c['queue']][_0xb81c('0x11d')],_0xb81c('0x106'))[_0xb81c('0x75')](_0xb81c('0xfc')),'ContactId':_0xafc124[_0xb81c('0xd3')],'ListId':_0xafc124[_0xb81c('0xd4')],'VoiceQueueId':_0xafc124[_0xb81c('0xd6')]||undefined,'CampaignId':_0xafc124[_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x11e')));var _0x2f85d0=new History(_0x217b20);_0x2f85d0['state']=0xa;_0x2f85d0['statedesc']='Drop';_0x2f85d0[_0xb81c('0x11f')]=moment()[_0xb81c('0x75')](_0xb81c('0xfc'));_0x2f85d0[_0xb81c('0xa5')]=_0x2f85d0[_0xb81c('0x11f')];_0x2f85d0[_0xb81c('0x120')]=_0x217b20[_0xb81c('0x120')];_0x2f85d0[_0xb81c('0x121')]=_0x217b20[_0xb81c('0x121')];this[_0xb81c('0xcb')](_0x2f85d0)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x122')));}}else{this[_0xb81c('0x1b')][_0x272e1c[_0xb81c('0xb3')]][_0xb81c('0x66')]+=0x1;this[_0xb81c('0x1b')][_0x272e1c['queue']][_0xb81c('0x5e')]+=0x1;_0x217b20[_0xb81c('0xe6')]=0xb;_0x217b20[_0xb81c('0xe7')]=_0xb81c('0x123');_0x217b20[_0xb81c('0x124')]=_0xb81c('0x125');_0x217b20['countabandonedretry']+=0x1;_0x217b20[_0xb81c('0xee')]+=0x1;if(_0x217b20[_0xb81c('0xf5')]>=this['voiceQueues'][_0x272e1c[_0xb81c('0xb3')]][_0xb81c('0x126')]){this[_0xb81c('0x115')](_0x217b20);}else{this[_0xb81c('0xc0')]({'active':![],'countabandonedretry':_0x217b20[_0xb81c('0xf5')],'scheduledat':moment()[_0xb81c('0xfa')](this[_0xb81c('0x1b')][_0x272e1c[_0xb81c('0xb3')]][_0xb81c('0x127')],_0xb81c('0x106'))['format'](_0xb81c('0xfc')),'ContactId':_0xafc124[_0xb81c('0xd3')],'ListId':_0xafc124[_0xb81c('0xd4')],'VoiceQueueId':_0xafc124[_0xb81c('0xd6')]||undefined,'CampaignId':_0xafc124[_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x128')));var _0x2f85d0=new History(_0x217b20);_0x2f85d0[_0xb81c('0xe6')]=0xb;_0x2f85d0['statedesc']=_0xb81c('0x123');_0x2f85d0['starttime']=moment()[_0xb81c('0x75')](_0xb81c('0xfc'));_0x2f85d0[_0xb81c('0xa5')]=_0x2f85d0[_0xb81c('0x11f')];_0x2f85d0[_0xb81c('0x120')]=_0x217b20['calleridname'];_0x2f85d0[_0xb81c('0x121')]=_0x217b20[_0xb81c('0x121')];this['createHistory'](_0x2f85d0)[_0xb81c('0xb1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xb81c('0x16')]['syncNewExten']=function(_0xa7beaf){if(this[_0xb81c('0xa8')][_0xa7beaf[_0xb81c('0xdf')]]){this[_0xb81c('0xa8')][_0xa7beaf['uniqueid']]['channel']=_0xa7beaf[_0xb81c('0xb0')];}if(this['uniqueId'][_0xa7beaf[_0xb81c('0xdf')]]){this[_0xb81c('0x20')][_0xa7beaf[_0xb81c('0xdf')]][_0xb81c('0xb0')]=_0xa7beaf['channel'];}};Dialer[_0xb81c('0x16')][_0xb81c('0x129')]=function(_0x38d7ad){if(strategy[this[_0xb81c('0x1b')][this[_0xb81c('0xa8')][_0x38d7ad[_0xb81c('0x12a')]][_0xb81c('0xb3')]][_0xb81c('0x12b')]]===_0xb81c('0x15')){if(this[_0xb81c('0xa8')][_0x38d7ad[_0xb81c('0x12a')]]&&_[_0xb81c('0xad')](this['actions'][_0x38d7ad[_0xb81c('0x12a')]][_0xb81c('0x12c')])&&_0x38d7ad['status']==='1'&&_0x38d7ad['paused']==='0'){if(this[_0xb81c('0x1d')][_0x38d7ad[_0xb81c('0x12d')]]){if(!this[_0xb81c('0x1d')][_0x38d7ad[_0xb81c('0x12d')]][_0xb81c('0x12c')]){this[_0xb81c('0x1d')][_0x38d7ad[_0xb81c('0x12d')]][_0xb81c('0x12c')]=!![];this['actions'][_0x38d7ad[_0xb81c('0x12a')]][_0xb81c('0x12c')]=!![];this[_0xb81c('0xa8')][_0x38d7ad[_0xb81c('0x12a')]][_0xb81c('0x12d')]=_0x38d7ad[_0xb81c('0x12d')];}}}}else if((strategy[this[_0xb81c('0x1b')][this['actions'][_0x38d7ad[_0xb81c('0x12a')]][_0xb81c('0xb3')]][_0xb81c('0x12b')]]||_0xb81c('0x14'))===_0xb81c('0x14')){if(this[_0xb81c('0xa8')][_0x38d7ad[_0xb81c('0x12a')]]){if(this[_0xb81c('0x1d')][_0x38d7ad[_0xb81c('0x12d')]]){this[_0xb81c('0xa8')][_0x38d7ad['actionid']]['stateinterface']=_0x38d7ad[_0xb81c('0x12d')];if(_[_0xb81c('0xad')](this[_0xb81c('0x24')][this['actions'][_0x38d7ad[_0xb81c('0x12a')]][_0xb81c('0xb3')]])){this[_0xb81c('0x24')][this[_0xb81c('0xa8')][_0x38d7ad[_0xb81c('0x12a')]][_0xb81c('0xb3')]]=[];}this[_0xb81c('0x24')][this[_0xb81c('0xa8')][_0x38d7ad[_0xb81c('0x12a')]]['queue']]['push'](_[_0xb81c('0xd1')](_['pick'](this[_0xb81c('0xa8')][_0x38d7ad[_0xb81c('0x12a')]],[_0xb81c('0x12e'),_0xb81c('0x12d')]),{'status':_0x38d7ad[_0xb81c('0xaf')],'paused':_0x38d7ad[_0xb81c('0x12f')]}));}}}};function unlockQueueStatus(_0x134955,_0x515858){setTimeout(function(){if(_[_0xb81c('0x38')](_0x134955[_0xb81c('0x130')])){loggerBooked['error'](_0xb81c('0x131'),_0x515858);}_0x134955[_0xb81c('0x130')]=!![];loggerBooked['info'](_0xb81c('0x132'),_0x515858,JSON[_0xb81c('0x74')](_[_0xb81c('0xd2')](_0x134955,['name',_0xb81c('0x130')])));},0x1f3);}Dialer[_0xb81c('0x16')]['syncQueueStatusComplete']=function(_0x43e46b){var _0x17b744=this;var _0x169a6c=_0x17b744['voiceQueues'][_0x17b744[_0xb81c('0xa8')][_0x43e46b['actionid']][_0xb81c('0xb3')]];if(strategy[this[_0xb81c('0x1b')][this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xb3')]]['strategy']]===_0xb81c('0x15')){if(this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]]&&this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0x12d')]){this[_0xb81c('0x1a')]['run'](this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0x12e')],this[_0xb81c('0xa8')][_0x43e46b['actionid']][_0xb81c('0x12d')])['catch'](function(_0x2ac8e5){logger[_0xb81c('0x91')](_0xb81c('0x133'),util[_0xb81c('0x92')](_0x2ac8e5,{'showHidden':![],'depth':null}));})['finally'](function(){_0x17b744[_0xb81c('0xb4')](_0x17b744[_0xb81c('0x1b')][_0x17b744[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xb3')]]);_0x17b744['agents'][_0x17b744['actions'][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0x12d')]]['locked']=![];delete _0x17b744['actions'][_0x43e46b['actionid']];unlockQueueStatus(_0x169a6c);});}else{this[_0xb81c('0xb4')](this[_0xb81c('0x1b')][this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]]['ContactId'],'ListId':this['actions'][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xd4')],'VoiceQueueId':this['actions'][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xd6')]||undefined,'CampaignId':this[_0xb81c('0xa8')][_0x43e46b['actionid']][_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x134')));delete this[_0xb81c('0xa8')][_0x43e46b['actionid']];unlockQueueStatus(_0x169a6c);}}else if((strategy[this[_0xb81c('0x1b')][this['actions'][_0x43e46b[_0xb81c('0x12a')]]['queue']][_0xb81c('0x12b')]]||_0xb81c('0x14'))===_0xb81c('0x14')){var _0x259947;if(this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]]&&!_[_0xb81c('0x7a')](this['queueBooked'][this[_0xb81c('0xa8')][_0x43e46b['actionid']][_0xb81c('0xb3')]])){if(this[_0xb81c('0x25')][_0x17b744[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xb3')]]){this['queueBookedRR'][_0x17b744['actions'][_0x43e46b[_0xb81c('0x12a')]]['queue']]=this[_0xb81c('0x25')][this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xb3')]]?this[_0xb81c('0x25')][this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xb3')]]:this[_0xb81c('0x24')][this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xb3')]]?this[_0xb81c('0x24')][this['actions'][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xb3')]][_0xb81c('0x135')]||0x0:0x0;}this[_0xb81c('0x24')][this['actions'][_0x43e46b[_0xb81c('0x12a')]][_0xb81c('0xb3')]]['_rr']=this[_0xb81c('0x25')][this[_0xb81c('0xa8')][_0x43e46b[_0xb81c('0x12a')]]['queue']];for(var _0x21b491=0x0;_0x21b491=0x0?!![]:![];})[_0xb81c('0xb1')](myreject(_0x99295e)));}}else{_0x6c436e[_0xb81c('0x14c')](ami[_0xb81c('0xae')]({'action':'command','command':util[_0xb81c('0x75')](_0xb81c('0x14d'),_0x4a19,!_[_0xb81c('0x38')](config[_0xb81c('0x152')][_0x1d3abc])?_0x1d3abc:'')})[_0xb81c('0xb8')](function(_0x372911){return _0x372911[_0xb81c('0x14f')][_0xb81c('0x150')](_0xb81c('0x151'))>=0x0?!![]:![];})['catch'](myreject(_0x99295e)));}BPromise[_0xb81c('0x153')](_0x6c436e)[_0xb81c('0xb8')](function(_0x3f597e){var _0x2a6958=_[_0xb81c('0x154')](_0x3f597e);if(_0x2a6958){return _0xb0a765(_0x2a6958);}else{_0x3a402a['message']=_0x54657a?'GLOBAL_INTERVAL_IS_OVERTIME':_0xb81c('0x155');return _0x99295e(msgResponse(_0xb81c('0x156'),_0xb81c('0x146'),'Global:\x20'+_0x54657a+'\x20'+_0x310c62+_0xb81c('0x157')+util[_0xb81c('0x92')](_0x4a19,{'showHidden':![],'depth':null})+_0xb81c('0x158')+_0x1d3abc));}})['catch'](function(_0x14b106){return _0x99295e(msgResponse(_0xb81c('0x144'),'Failure',JSON['stringify'](_0x14b106)));});});};Dialer['prototype'][_0xb81c('0x159')]=function(_0x44221a){var _0x386e20=this;return function(){switch(_0x44221a['dialMethod']){case'progressive':freeVariablesPredictive(_0x44221a);_0x386e20[_0xb81c('0x15a')](_0x44221a,0x1);break;case _0xb81c('0x15b'):freeVariablesPredictive(_0x44221a);_0x386e20['handlePower'](_0x44221a,_0x44221a['dialPowerLevel']);break;case _0xb81c('0x15c'):_0x386e20[_0xb81c('0x15c')](_0x44221a);break;case _0xb81c('0x8'):freeVariablesPredictive(_0x44221a);_0x386e20[_0xb81c('0x15a')](_0x44221a,0x1);break;default:freeVariablesPredictive(_0x44221a);logger['error'](_0xb81c('0x15d'),_0x44221a[_0xb81c('0x3c')],_0xb81c('0x15e'));}};};Dialer['prototype'][_0xb81c('0x15f')]=function(_0x4332b2){var _0x4c1e66=this;return function(){_0x4c1e66['handleIvr'](_0x4332b2);};};Dialer[_0xb81c('0x16')]['syncQueueSummary']=function(_0xad7643){var _0x384c4a=this;if(isNotPreview(_0xad7643[_0xb81c('0x54')])){if(isVoiceQueueOutbound(_0xad7643[_0xb81c('0x47')])&&isActive(_0xad7643['dialActive'])){_0xad7643['sendMessageOneNotActive']=!![];BPromise[_0xb81c('0xb7')]()[_0xb81c('0xb8')](checkIsLoggedIn(_0xad7643,_0xad7643[_0xb81c('0x4b')]))[_0xb81c('0xb8')](checkIsActive(_0xad7643,_0xad7643[_0xb81c('0x53')]))[_0xb81c('0xb8')](checkInterval(_0xad7643))[_0xb81c('0xb8')](_0x384c4a['checkIsTrunkReachable'](_0xad7643))[_0xb81c('0xb8')](_0x384c4a[_0xb81c('0x160')](_0xad7643['dialGlobalInterval'],_0xad7643[_0xb81c('0x161')],_0xad7643['name'],_0xad7643))[_0xb81c('0xb8')](_0x384c4a[_0xb81c('0x145')](_0xad7643[_0xb81c('0x3e')],_0xad7643[_0xb81c('0x161')],_0xad7643['name'],_0xad7643))[_0xb81c('0xb8')](_0x384c4a['checkDialMethod'](_0xad7643))['catch'](loggerCatchQueueSummary(_0xb81c('0x162'),_0xad7643));}else{notSendMessagesQueue(_0xad7643);}}else{freeVariablesPredictive(_0xad7643);}};Dialer[_0xb81c('0x16')][_0xb81c('0x13e')]=function(){var _0x4325ea=this;var _0x16436d;for(var _0x5e741c in this[_0xb81c('0x1c')]){if(this['campaigns'][_0xb81c('0xab')](_0x5e741c)){_0x16436d=this[_0xb81c('0x1c')][_0x5e741c];if(isCampaignIvr(_0x16436d[_0xb81c('0x47')])&&isActive(_0x16436d[_0xb81c('0x72')])){_0x16436d[_0xb81c('0x9e')]=!![];BPromise[_0xb81c('0xb7')]()[_0xb81c('0xb8')](checkIsActive(_0x16436d,_0x16436d[_0xb81c('0x72')]))['then'](checkInterval(_0x16436d))[_0xb81c('0xb8')](_0x4325ea[_0xb81c('0x13f')](_0x16436d))[_0xb81c('0xb8')](_0x4325ea[_0xb81c('0x160')](_0x16436d[_0xb81c('0x163')],_0x16436d['dialTimezone'],_0x16436d[_0xb81c('0x3c')],_0x16436d))[_0xb81c('0xb8')](_0x4325ea['checkIfTimeIntervals'](_0x16436d[_0xb81c('0x3e')],_0x16436d['dialTimezone'],_0x16436d['name'],_0x16436d))[_0xb81c('0xb8')](_0x4325ea['launchHandleIvr'](_0x16436d))[_0xb81c('0xb1')](loggerCatchQueueSummary(_0xb81c('0x164'),_0x16436d));}else{notSendMessagesCampaign(_0x16436d);}}}};function getCallerIdRandom(_0x1947b8,_0x22c63f){var _0x51e10e,_0x2f75b4,_0x3d856b;if(_0x22c63f<=0x0){_0x22c63f=0x1;}_0x51e10e=new RegExp('\x5cw{0,'+_0x22c63f+'}$');_0x2f75b4=Math['pow'](0xa,_0x22c63f-0x1);_0x3d856b=Math[_0xb81c('0x165')](0xa,_0x22c63f)-0x1;return util[_0xb81c('0x75')]('%s',_[_0xb81c('0x166')](_0x1947b8,_0x51e10e,_['random'](_0x2f75b4,_0x3d856b)));}function extractCalleridName(_0x15d3dd){var _0x503815=_0x15d3dd[_0xb81c('0x167')](/"(.*?)"/);return _0x503815?_0x503815[0x1]:_0x15d3dd;}function extractCalleridNumber(_0x55d281){var _0x3090e7=_0x55d281[_0xb81c('0x167')](/<(.*?)>/);return _0x3090e7?_0x3090e7[0x1]:_0x55d281;}Dialer[_0xb81c('0x16')]['actionOriginate']=function(_0x3ae7ba,_0x5bd280){var _0x1089a1=this;var _0x1fd7c8=uuid['v4']();this[_0xb81c('0xa8')][_0x1fd7c8]=new Action(_0x3ae7ba,_0x5bd280,_0x1fd7c8);return new BPromise(function(_0xee2ecd,_0x22e5d8){if(_['isUndefined'](_0x3ae7ba)&&'object'!==typeof _0x3ae7ba){return _0x22e5d8(msgResponse('originate',_0xb81c('0x146'),'voiceQueue\x20is\x20undefine'));}if(_[_0xb81c('0x38')](_0x5bd280[_0xb81c('0x168')][_0xb81c('0x169')])||_0x5bd280[_0xb81c('0x168')]['phone']===null){return _0x22e5d8(msgResponse(_0xb81c('0x16a'),_0xb81c('0x146'),_0xb81c('0x16b')));}var _0x10b2ea={'XMD-CALLERID':_0x1089a1[_0xb81c('0xa8')][_0x1fd7c8][_0xb81c('0x16c')](),'XMD-AGI':_0x3ae7ba[_0xb81c('0x109')]?util[_0xb81c('0x75')](_0xb81c('0x16d'),ipAgi,_0x3ae7ba[_0xb81c('0x109')]):_0xb81c('0x16e'),'XMD-AGIAFTER':_0x3ae7ba[_0xb81c('0x16f')]?util[_0xb81c('0x75')](_0xb81c('0x16d'),ipAgi,_0x3ae7ba[_0xb81c('0x16f')]):_0xb81c('0x16e'),'XMD-QUEUE':_0x3ae7ba['type']===_0xb81c('0x48')?util[_0xb81c('0x75')](_0xb81c('0x170'),_0x3ae7ba[_0xb81c('0x3c')],_0x3ae7ba[_0xb81c('0x171')]||'',_0x3ae7ba[_0xb81c('0x112')]?'c':'',_0x3ae7ba['dialQueueTimeout']||0x3):_0xb81c('0x16e'),'XMD-CONTACTID':_0x5bd280[_0xb81c('0xd3')],'XMD-CDRTYPE':_0xb81c('0x7'),'CALLERID(all)':_0x1089a1[_0xb81c('0xa8')][_0x1fd7c8][_0xb81c('0x16c')](),'XMD-AMD':_0x3ae7ba[_0xb81c('0xe4')]?'ACTIVE':_0xb81c('0x16e'),'XMD-DESTINATION':_0xb81c('0xe3')};if(_0x3ae7ba[_0xb81c('0xe4')]){_0x10b2ea[_0xb81c('0x172')]=_0x3ae7ba[_0xb81c('0x173')]||0x9c4;_0x10b2ea[_0xb81c('0x174')]=_0x3ae7ba[_0xb81c('0x175')]||0x5dc;_0x10b2ea[_0xb81c('0x176')]=_0x3ae7ba[_0xb81c('0x177')]||0x320;_0x10b2ea[_0xb81c('0x178')]=_0x3ae7ba['dialAMDTotalAnalysisTime']||0x1388;_0x10b2ea[_0xb81c('0x179')]=_0x3ae7ba[_0xb81c('0x17a')]||0x64;_0x10b2ea[_0xb81c('0x17b')]=_0x3ae7ba[_0xb81c('0x17c')]||0x32;_0x10b2ea[_0xb81c('0x17d')]=_0x3ae7ba['dialAMDMaximumNumberOfWords']||0x3;_0x10b2ea[_0xb81c('0x17e')]=_0x3ae7ba[_0xb81c('0x17f')]||0x100;_0x10b2ea[_0xb81c('0x180')]=_0x3ae7ba['dialAMDMaximumWordLength']||0x1388;}if(_0x3ae7ba[_0xb81c('0x47')]===_0xb81c('0x48')){_0x10b2ea[_0xb81c('0x181')]=_0x5bd280[_0xb81c('0xd6')];}else{_0x10b2ea[_0xb81c('0x182')]=_0x5bd280[_0xb81c('0xd7')];}for(var _0xe2cdf9 in _0x5bd280[_0xb81c('0x168')]){if(_0x5bd280['Contact']['hasOwnProperty'](_0xe2cdf9)){if(isNotNull(_0x5bd280[_0xb81c('0x168')][_0xe2cdf9])&&_0xe2cdf9!=='id'&&_0xe2cdf9!==_0xb81c('0x183')&&_0xe2cdf9!==_0xb81c('0x184')&&_0xe2cdf9!==_0xb81c('0x185')){_0x10b2ea[util[_0xb81c('0x75')](_0xb81c('0x186'),_0xb81c('0x187'),_[_0xb81c('0x188')](_0xe2cdf9))]=_0x5bd280[_0xb81c('0x168')][_0xe2cdf9];}}}var _0x2fea05=_0x1089a1[_0xb81c('0x140')](_0x3ae7ba[_0xb81c('0x71')])?getCallerId(_0x3ae7ba[_0xb81c('0x71')][_0xb81c('0x73')],_0x3ae7ba[_0xb81c('0x55')],_0x3ae7ba[_0xb81c('0x189')]>0x0?getCallerIdRandom(_0x3ae7ba['dialOriginateCallerIdNumber'],_0x3ae7ba[_0xb81c('0x189')]):_0x3ae7ba['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x3ae7ba[_0xb81c('0x141')])?_0x3ae7ba[_0xb81c('0x71')][_0xb81c('0x73')]:_0x3ae7ba['TrunkBackup'][_0xb81c('0x73')],_0x3ae7ba[_0xb81c('0x55')],_0x3ae7ba[_0xb81c('0x189')]>0x0?getCallerIdRandom(_0x3ae7ba[_0xb81c('0x56')],_0x3ae7ba[_0xb81c('0x189')]):_0x3ae7ba[_0xb81c('0x56')]);if(_0x2fea05){_0x10b2ea[_0xb81c('0x18a')]=_0x1089a1[_0xb81c('0xa8')][_0x1fd7c8][_0xb81c('0x18b')]=extractCalleridName(_0x2fea05);_0x10b2ea[_0xb81c('0x18c')]=_0x1089a1[_0xb81c('0xa8')][_0x1fd7c8][_0xb81c('0x18d')]=extractCalleridNumber(_0x2fea05);}return ami[_0xb81c('0xae')]({'actionid':_0x1fd7c8,'action':'originate','channel':_0x1089a1[_0xb81c('0x140')](_0x3ae7ba[_0xb81c('0x71')])?util[_0xb81c('0x75')](_0xb81c('0x18e'),_0x3ae7ba[_0xb81c('0x71')][_0xb81c('0x3c')],isNotNull(_0x3ae7ba['dialPrefix'])?_0x3ae7ba['dialPrefix'][_0xb81c('0x18f')]()||'':'',_0x3ae7ba[_0xb81c('0x190')]>0x0?_0x5bd280[_0xb81c('0x168')]['phone'][_0xb81c('0x191')](_0x3ae7ba['dialCutDigit']):_0x5bd280[_0xb81c('0x168')][_0xb81c('0x169')]):util[_0xb81c('0x75')]('SIP/%s/%s%s',_['isNil'](_0x3ae7ba[_0xb81c('0x141')])?_0x3ae7ba[_0xb81c('0x71')][_0xb81c('0x3c')]:_0x3ae7ba[_0xb81c('0x141')]['name'],isNotNull(_0x3ae7ba[_0xb81c('0x192')])?_0x3ae7ba['dialPrefix']['trim']()||'':'',_0x3ae7ba[_0xb81c('0x190')]>0x0?_0x5bd280['Contact'][_0xb81c('0x169')][_0xb81c('0x191')](_0x3ae7ba[_0xb81c('0x190')]):_0x5bd280[_0xb81c('0x168')][_0xb81c('0x169')]),'callerid':_0x2fea05,'Exten':_0xb81c('0xe3'),'Context':_0xb81c('0x193'),'Priority':'1','variable':_0x10b2ea,'timeout':(_0x3ae7ba['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1fd7c8})[_0xb81c('0xb8')](function(_0x38b4ca){return _0xee2ecd(_0x38b4ca);})['catch'](function(_0x5d80f6){_0x3ae7ba[_0xb81c('0x60')]+=0x1;var _0xc01b2f=new History(_0x1089a1['actions'][_0x1fd7c8]);logger[_0xb81c('0x91')](util[_0xb81c('0x75')](_0xb81c('0x194'),JSON[_0xb81c('0x74')](_0x5d80f6)));_0xc01b2f[_0xb81c('0xe6')]=0xe;_0xc01b2f[_0xb81c('0xe7')]=_0xb81c('0x195');_0xc01b2f['starttime']=moment()[_0xb81c('0x75')]('YYYY-MM-DD\x20HH:mm:ss');_0xc01b2f[_0xb81c('0xa5')]=_0xc01b2f[_0xb81c('0x11f')];_0x1089a1[_0xb81c('0xcb')](_0xc01b2f)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x196')));_0x1089a1[_0xb81c('0xc9')](_0xc01b2f)['catch'](loggerCatch(_0xb81c('0x196')))[_0xb81c('0x19')](function(){delete _0x1089a1[_0xb81c('0xa8')][_0x1fd7c8];return _0x22e5d8(msgResponse('originate','Error','originate\x20action\x20Error'));});});});};Dialer['prototype'][_0xb81c('0x197')]=function(_0x1fbdb2){var _0x2b3d52=this[_0xb81c('0xa8')][_0x1fbdb2['actionid']];var _0x4ecdf3=this;if(_0x2b3d52){delete this['actions'][_0x1fbdb2[_0xb81c('0x12a')]];_0x2b3d52[_0xb81c('0x198')]=moment()['format'](_0xb81c('0xfc'));var _0x50cfc2=_0x2b3d52[_0xb81c('0x47')]===_0xb81c('0x78')?this[_0xb81c('0x1c')][_0x2b3d52['queue']]:this[_0xb81c('0x1b')][_0x2b3d52[_0xb81c('0x199')]()];if(!this['isSuccess'](_0x1fbdb2['response'])){this[_0xb81c('0xb4')](_0x50cfc2);return this[_0xb81c('0x19a')](_0x2b3d52,_0x50cfc2,_0x1fbdb2)[_0xb81c('0xb8')](function(_0x579028){})[_0xb81c('0xb1')](loggerCatch('[callProgressDetecting]\x20'));}else{this['uniqueId'][_0x1fbdb2['uniqueid']]=_0x2b3d52;}}};Dialer[_0xb81c('0x16')]['checkRetriveMax']=function(_0x4a8951,_0x46715d,_0x192ce0){var _0x1804a6=new History(_0x46715d);if(_0x1804a6[_0xb81c('0xf1')]+_0x1804a6[_0xb81c('0x103')]+_0x1804a6[_0xb81c('0xf2')]+_0x1804a6[_0xb81c('0xf3')]+_0x1804a6[_0xb81c('0xf4')]+_0x1804a6[_0xb81c('0xf5')]+_0x1804a6[_0xb81c('0xed')]+_0x1804a6[_0xb81c('0xf6')]>=_0x192ce0[_0xb81c('0xf7')]-0x1){return!![];}switch(_0x4a8951){case 0x3:if(_0x1804a6[_0xb81c('0xf2')]>=_0x192ce0[_0xb81c('0x19b')]-0x1){return!![];}else{this[_0xb81c('0xc0')]({'active':![],'countnoanswerretry':_0x1804a6['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xb81c('0xfa')](_0x192ce0[_0xb81c('0x19c')],_0xb81c('0x106'))[_0xb81c('0x75')](_0xb81c('0xfc')),'ContactId':_0x1804a6[_0xb81c('0xd3')],'ListId':_0x1804a6[_0xb81c('0xd4')],'VoiceQueueId':_0x1804a6[_0xb81c('0xd6')]||undefined,'CampaignId':_0x1804a6[_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x1804a6[_0xb81c('0xf1')]>=_0x192ce0['dialBusyMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x1804a6[_0xb81c('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x192ce0['dialBusyRetryFrequency'],_0xb81c('0x106'))[_0xb81c('0x75')](_0xb81c('0xfc')),'ContactId':_0x1804a6[_0xb81c('0xd3')],'ListId':_0x1804a6[_0xb81c('0xd4')],'VoiceQueueId':_0x1804a6[_0xb81c('0xd6')]||undefined,'CampaignId':_0x1804a6[_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x19d')));}break;case 0x8:if(_0x1804a6[_0xb81c('0x103')]>=_0x192ce0[_0xb81c('0x19e')]-0x1){return!![];}else{this[_0xb81c('0xc0')]({'active':![],'countcongestionretry':_0x1804a6[_0xb81c('0x103')]+=0x1,'scheduledat':moment()[_0xb81c('0xfa')](_0x192ce0['dialCongestionRetryFrequency'],_0xb81c('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1804a6[_0xb81c('0xd3')],'ListId':_0x1804a6['ListId'],'VoiceQueueId':_0x1804a6[_0xb81c('0xd6')]||undefined,'CampaignId':_0x1804a6[_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x19f')));}break;case 0x0:if(_0x1804a6['countnosuchnumberretry']>=_0x192ce0[_0xb81c('0x1a0')]-0x1){return!![];}else{this[_0xb81c('0xc0')]({'active':![],'countnosuchnumberretry':_0x1804a6[_0xb81c('0xf3')]+=0x1,'scheduledat':moment()[_0xb81c('0xfa')](_0x192ce0[_0xb81c('0x1a1')],_0xb81c('0x106'))[_0xb81c('0x75')](_0xb81c('0xfc')),'ContactId':_0x1804a6[_0xb81c('0xd3')],'ListId':_0x1804a6[_0xb81c('0xd4')],'VoiceQueueId':_0x1804a6[_0xb81c('0xd6')]||undefined,'CampaignId':_0x1804a6['CampaignId']||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x1a2')));}break;case 0xa:if(_0x1804a6['countdropretry']>=_0x192ce0['dialDropMaxRetry']-0x1){return!![];}else{this[_0xb81c('0xc0')]({'active':![],'countdropretry':_0x1804a6['countdropretry']+=0x1,'scheduledat':moment()[_0xb81c('0xfa')](_0x192ce0['dialDropRetryFrequency'],_0xb81c('0x106'))[_0xb81c('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1804a6[_0xb81c('0xd3')],'ListId':_0x1804a6[_0xb81c('0xd4')],'VoiceQueueId':_0x1804a6[_0xb81c('0xd6')]||undefined,'CampaignId':_0x1804a6['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x1804a6['countabandonedretry']>=_0x192ce0[_0xb81c('0x126')]-0x1){return!![];}else{this[_0xb81c('0xc0')]({'active':![],'countabandonedretry':_0x1804a6[_0xb81c('0xf5')]+=0x1,'scheduledat':moment()[_0xb81c('0xfa')](_0x192ce0[_0xb81c('0x127')],'minutes')[_0xb81c('0x75')](_0xb81c('0xfc')),'ContactId':_0x1804a6['ContactId'],'ListId':_0x1804a6[_0xb81c('0xd4')],'VoiceQueueId':_0x1804a6[_0xb81c('0xd6')]||undefined,'CampaignId':_0x1804a6['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x1804a6[_0xb81c('0xed')]>=_0x192ce0[_0xb81c('0x105')]-0x1){return!![];}else{this[_0xb81c('0xc0')]({'active':![],'countmachineretry':_0x1804a6['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x192ce0[_0xb81c('0xfb')],_0xb81c('0x106'))['format'](_0xb81c('0xfc')),'ContactId':_0x1804a6[_0xb81c('0xd3')],'ListId':_0x1804a6[_0xb81c('0xd4')],'VoiceQueueId':_0x1804a6[_0xb81c('0xd6')]||undefined,'CampaignId':_0x1804a6['CampaignId']||undefined})[_0xb81c('0xb1')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x1804a6[_0xb81c('0xf6')]>=_0x192ce0[_0xb81c('0x1a3')]-0x1){return!![];}else{this[_0xb81c('0xc0')]({'active':![],'countagentrejectretry':_0x1804a6['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xb81c('0xfa')](_0x192ce0[_0xb81c('0x1a4')],_0xb81c('0x106'))[_0xb81c('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1804a6['ContactId'],'ListId':_0x1804a6[_0xb81c('0xd4')],'VoiceQueueId':_0x1804a6[_0xb81c('0xd6')]||undefined,'CampaignId':_0x1804a6[_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x1a5')));}break;default:return!![];}};Dialer[_0xb81c('0x16')]['callProgressDetecting']=function(_0x30a6b6,_0x148aa5,_0xa4ba25){var _0x4fd670=this;var _0x3a3a9a=new History(_0x30a6b6);return new BPromise(function(_0x427b89,_0x3d4b45){if(_['isUndefined'](_0x148aa5)&&_0xb81c('0x1a6')!==typeof _0x148aa5){return _0x3d4b45(msgResponse(_0xb81c('0x1a7'),'Failure','entity\x20is\x20undefine'));}if(_[_0xb81c('0x38')](_0xa4ba25)&&_0xb81c('0x1a6')!==typeof _0xa4ba25){return _0x3d4b45(msgResponse(_0xb81c('0x1a7'),_0xb81c('0x146'),_0xb81c('0x1a8')));}switch(_0xa4ba25[_0xb81c('0x10f')]){case'0':_0x148aa5[_0xb81c('0x1a9')]+=0x1;_0x3a3a9a['state']=0x0;_0x3a3a9a[_0xb81c('0xe7')]=_0xb81c('0x1aa');_0x3a3a9a[_0xb81c('0xf3')]+=0x1;_0x3a3a9a[_0xb81c('0xee')]+=0x1;ami[_0xb81c('0x46')](_0xb81c('0x1ab'),ut['buildObj'](_0x30a6b6,'nosuchnumber'));_0x4fd670[_0xb81c('0xcb')](_0x3a3a9a)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0xf0')));if(_0x4fd670[_0xb81c('0x1ac')](0x0,_0x30a6b6,_0x148aa5)){if(_0x3a3a9a['countnosuchnumberretry']>=_0x148aa5['dialNoSuchNumberMaxRetry']){_0x4fd670['createStateFinal'](_0x3a3a9a,_0x427b89,_0x3d4b45,'reason\x200\x20no\x20such\x20number....');}else{_0x4fd670[_0xb81c('0x104')](_0x3a3a9a,_0x427b89,_0x3d4b45,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x148aa5[_0xb81c('0x5f')]+=0x1;_0x3a3a9a[_0xb81c('0xe6')]=0x3;_0x3a3a9a[_0xb81c('0xe7')]='NoAnswer';_0x3a3a9a[_0xb81c('0xf2')]+=0x1;_0x3a3a9a[_0xb81c('0xee')]+=0x1;ami[_0xb81c('0x46')](_0xb81c('0x1ad'),ut['buildObj'](_0x30a6b6,_0xb81c('0x1ae')));_0x4fd670[_0xb81c('0xcb')](_0x3a3a9a)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x1af')));if(_0x4fd670[_0xb81c('0x1ac')](0x3,_0x30a6b6,_0x148aa5)){if(_0x3a3a9a['countnoanswerretry']>=_0x148aa5[_0xb81c('0x19b')]){_0x4fd670[_0xb81c('0x1b0')](_0x3a3a9a,_0x427b89,_0x3d4b45,_0xb81c('0x1b1'));}else{_0x4fd670['stateGlobal'](_0x3a3a9a,_0x427b89,_0x3d4b45,_0xb81c('0x1b1'));}}break;case'5':_0x148aa5[_0xb81c('0x5b')]+=0x1;_0x3a3a9a['state']=0x5;_0x3a3a9a[_0xb81c('0xe7')]='Busy';_0x3a3a9a[_0xb81c('0xf1')]+=0x1;_0x3a3a9a[_0xb81c('0xee')]+=0x1;ami[_0xb81c('0x46')]('custom:agentbusy',ut[_0xb81c('0x1b2')](_0x30a6b6,_0xb81c('0x1b3')));_0x4fd670['createHistory'](_0x3a3a9a)[_0xb81c('0xb1')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4fd670[_0xb81c('0x1ac')](0x5,_0x30a6b6,_0x148aa5)){if(_0x3a3a9a['countbusyretry']>=_0x148aa5[_0xb81c('0x1b4')]){_0x4fd670[_0xb81c('0x1b0')](_0x3a3a9a,_0x427b89,_0x3d4b45,'reason\x205\x20busy');}else{_0x4fd670['stateGlobal'](_0x3a3a9a,_0x427b89,_0x3d4b45,'reason\x205\x20busy');}}break;case'8':_0x148aa5[_0xb81c('0x5c')]+=0x1;_0x3a3a9a['state']=0x8;_0x3a3a9a[_0xb81c('0xe7')]=_0xb81c('0x1b5');_0x3a3a9a[_0xb81c('0x103')]+=0x1;_0x3a3a9a[_0xb81c('0xee')]+=0x1;ami[_0xb81c('0x46')](_0xb81c('0x1b6'),ut[_0xb81c('0x1b2')](_0x30a6b6,_0xb81c('0x1b7')));_0x4fd670['createHistory'](_0x3a3a9a)[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x1b8')));if(_0x4fd670[_0xb81c('0x1ac')](0x8,_0x30a6b6,_0x148aa5)){if(_0x3a3a9a['countcongestionretry']>=_0x148aa5[_0xb81c('0x19e')]){_0x4fd670['createStateFinal'](_0x3a3a9a,_0x427b89,_0x3d4b45,_0xb81c('0x1b9'));}else{_0x4fd670[_0xb81c('0x104')](_0x3a3a9a,_0x427b89,_0x3d4b45,_0xb81c('0x1b9'));}}break;case'11':_0x148aa5[_0xb81c('0x1ba')]+=0x1;_0x3a3a9a[_0xb81c('0xe6')]=0xb;_0x3a3a9a['statedesc']=_0xb81c('0x123');_0x3a3a9a['countabandonedretry']+=0x1;_0x3a3a9a[_0xb81c('0xee')]+=0x1;_0x4fd670[_0xb81c('0xcb')](_0x3a3a9a)[_0xb81c('0xb1')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4fd670[_0xb81c('0x1ac')](0xb,_0x30a6b6,_0x148aa5)){if(_0x3a3a9a[_0xb81c('0xf5')]>=_0x148aa5[_0xb81c('0x126')]){_0x4fd670[_0xb81c('0x1b0')](_0x3a3a9a,_0x427b89,_0x3d4b45,'reason\x2011\x20abandoned');}else{_0x4fd670[_0xb81c('0x104')](_0x3a3a9a,_0x427b89,_0x3d4b45,'reason\x2011\x20abandoned');}}break;case'20':_0x148aa5[_0xb81c('0x62')]+=0x1;_0x3a3a9a[_0xb81c('0xe6')]=0x14;_0x3a3a9a['statedesc']='AgentReject';_0x3a3a9a[_0xb81c('0xf6')]+=0x1;_0x3a3a9a[_0xb81c('0xee')]+=0x1;ami[_0xb81c('0x46')](_0xb81c('0x1bb'),ut[_0xb81c('0x1b2')](_0x30a6b6,_0xb81c('0x1bc')));_0x4fd670[_0xb81c('0xcb')](_0x3a3a9a)['catch'](loggerCatch(_0xb81c('0x1bd')));if(_0x4fd670['checkRetriveMax'](0x14,_0x30a6b6,_0x148aa5)){if(_0x3a3a9a[_0xb81c('0xf6')]>=_0x148aa5['dialAgentRejectMaxRetry']){_0x4fd670[_0xb81c('0x1b0')](_0x3a3a9a,_0x427b89,_0x3d4b45,_0xb81c('0x1be'));}else{_0x4fd670['stateGlobal'](_0x3a3a9a,_0x427b89,_0x3d4b45,_0xb81c('0x1be'));}}break;default:_0x148aa5[_0xb81c('0x10c')]+=0x1;_0x3a3a9a['state']=0xc;_0x3a3a9a[_0xb81c('0xe7')]=_0xa4ba25['reason'];_0x4fd670['createHistory'](_0x3a3a9a)['catch'](loggerCatch(_0xb81c('0x1bf')));if(_0x4fd670['checkRetriveMax'](_0xa4ba25[_0xb81c('0x10f')],_0x30a6b6,_0x148aa5)){if(_0x3a3a9a[_0xb81c('0xf1')]+_0x3a3a9a[_0xb81c('0x103')]+_0x3a3a9a[_0xb81c('0xf2')]+_0x3a3a9a[_0xb81c('0xf3')]+_0x3a3a9a[_0xb81c('0xf4')]+_0x3a3a9a[_0xb81c('0xf5')]+_0x3a3a9a['countmachineretry']+_0x3a3a9a['countagentrejectretry']>=_0x148aa5['dialGlobalMaxRetry']){_0x4fd670[_0xb81c('0x104')](_0x3a3a9a,_0x427b89,_0x3d4b45,_0xa4ba25[_0xb81c('0x10f')]);}else{_0x4fd670[_0xb81c('0x1b0')](_0x3a3a9a,_0x427b89,_0x3d4b45,_0xa4ba25[_0xb81c('0x10f')]);}}}});};Dialer[_0xb81c('0x16')]['stateGlobal']=function(_0x4feae8,_0x1caed3,_0x2fbc32,_0x1c1889){var _0x55e3cb=new Final(_0x4feae8);_0x55e3cb[_0xb81c('0xe6')]=0xf;_0x55e3cb[_0xb81c('0xe7')]=_0xb81c('0x1c0');this['createStateFinal'](_0x55e3cb,_0x1caed3,_0x2fbc32,_0x1c1889);};Dialer[_0xb81c('0x16')][_0xb81c('0x1b0')]=function(_0x68246c,_0x36b50c,_0x469457,_0x58bdfa){this['moveContactManagedDialer'](_0x68246c)[_0xb81c('0xb8')](function(_0x3b5061){return _0x36b50c(msgResponse(_0xb81c('0x1a7'),_0xb81c('0xdb'),_0x58bdfa));})[_0xb81c('0xb1')](function(_0x58f291){return _0x469457(msgResponse('[moveContactManagedDialer][0]','Failure',_0xb81c('0x1c1')));});};Dialer['prototype']['predictive']=function(_0x50d3ef){var _0xb4b0f0=this;var _0x40efa2=_0x50d3ef[_0xb81c('0x1c2')]/0x64;var _0x5853b9=_0x50d3ef['outboundDropCallsDayTimeout']/(_0x50d3ef[_0xb81c('0x119')]+_0x50d3ef[_0xb81c('0x59')]);var _0x3bdbe6=Math[_0xb81c('0x1c3')](_0x50d3ef[_0xb81c('0x6c')]*(_0x50d3ef[_0xb81c('0x1c4')]/0x64));var _0x21ec05=Math[_0xb81c('0x1c3')](_0x50d3ef[_0xb81c('0x6c')]*(_0x50d3ef[_0xb81c('0x1c5')]/0x64));var _0x56638f=_0x50d3ef[_0xb81c('0x4a')]+_0x50d3ef[_0xb81c('0x4d')];var _0x2310ed=Math['floor'](_0x50d3ef[_0xb81c('0x6e')]*_0x50d3ef[_0xb81c('0x89')]*_0x50d3ef[_0xb81c('0x6a')]*_0x50d3ef[_0xb81c('0x6b')]);if(_[_0xb81c('0x38')](_0x50d3ef[_0xb81c('0x23')])){if(!_[_0xb81c('0x38')](_0x50d3ef[_0xb81c('0x22')])){_0x50d3ef[_0xb81c('0x22')]=undefined;loggerPredictive['error'](_0xb81c('0x1c6'),_0xb81c('0x1c7'));}if(!_['isUndefined'](_0x50d3ef['handlePredictive'])){loggerPredictive[_0xb81c('0x91')](_0xb81c('0x1c6'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x50d3ef[_0xb81c('0x8d')]);_0x50d3ef['handlePredictive']=undefined;}_0x50d3ef[_0xb81c('0x23')]=moment()[_0xb81c('0x75')](_0xb81c('0xfc'));loggerPredictive[_0xb81c('0x7c')](_0x50d3ef[_0xb81c('0x3c')],_0xb81c('0x1c8'),_0x50d3ef['startProgressive']);this['handlePower'](_0x50d3ef,0x1);}else if(ifInterval(_0x50d3ef[_0xb81c('0x1c9')],_0x50d3ef[_0xb81c('0x23')])){this[_0xb81c('0x15a')](_0x50d3ef,0x1);loggerPredictiveCalls[_0xb81c('0x7c')](_0xb81c('0x1ca'),_0x50d3ef[_0xb81c('0x23')],_0x50d3ef[_0xb81c('0x3c')]);_0x50d3ef['erlangCalls']=0x0;_0x50d3ef[_0xb81c('0x69')]=0x0;}else if(_0x40efa2<_0x5853b9&&_0x50d3ef[_0xb81c('0x1cb')]===_0xb81c('0x1cc')){freeVariablesPredictive(_0x50d3ef);loggerPredictive[_0xb81c('0x7c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xb81c('0x1cd'),_0x5853b9,'startProgressive',_0x50d3ef[_0xb81c('0x3c')]);}else if(_0x2310ed<_0x50d3ef[_0xb81c('0x69')]&&_0x50d3ef[_0xb81c('0x1cb')]===_0xb81c('0x1cc')){freeVariablesPredictive(_0x50d3ef);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x1ce'),'Max\x20Drop\x20',_0x2310ed,_0xb81c('0x1cf'),_0x50d3ef[_0xb81c('0x69')],_0xb81c('0x23'),_0x50d3ef[_0xb81c('0x3c')]);}else if(!ifInterval(_0x50d3ef[_0xb81c('0x1c9')],_0x50d3ef['startProgressive'])&&_[_0xb81c('0x38')](_0x50d3ef['startPredictive'])&&!_[_0xb81c('0x38')](_0x50d3ef['startProgressive'])){_0x50d3ef[_0xb81c('0x22')]=moment()[_0xb81c('0x75')](_0xb81c('0xfc'));loggerPredictive[_0xb81c('0x7c')](_0x50d3ef[_0xb81c('0x3c')],_0xb81c('0x1d0'),_0x50d3ef[_0xb81c('0x22')]);this[_0xb81c('0xbd')](_0x50d3ef[_0xb81c('0x1c9')])['then'](this['getDataPredictive'](_0x50d3ef))[_0xb81c('0xb8')](mergeDataErlangB(_0x50d3ef))[_0xb81c('0xb8')](this[_0xb81c('0x1d1')](_0x50d3ef))[_0xb81c('0xb1')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x50d3ef));}else if(!ifInterval(_0x50d3ef['dialPredictiveInterval'],_0x50d3ef['startPredictive'])){_0x50d3ef[_0xb81c('0x69')]=0x0;_0x50d3ef[_0xb81c('0x22')]=moment()[_0xb81c('0x75')](_0xb81c('0xfc'));loggerPredictive['info'](_0x50d3ef[_0xb81c('0x3c')],_0xb81c('0x1d2'),_0x50d3ef[_0xb81c('0x22')]);clearInterval(_0x50d3ef[_0xb81c('0x8d')]);_0x50d3ef[_0xb81c('0x8d')]=undefined;this[_0xb81c('0xbd')](_0x50d3ef['dialPredictiveInterval'])[_0xb81c('0xb8')](this['getDataPredictive'](_0x50d3ef))[_0xb81c('0xb8')](mergeDataErlangB(_0x50d3ef))[_0xb81c('0xb8')](this[_0xb81c('0x1d1')](_0x50d3ef))['catch'](loggerCatchPredictive(_0xb81c('0x1d3'),_0x50d3ef));}else if(_0x50d3ef[_0xb81c('0x6c')]&&_0x56638f<_0x50d3ef['predictiveIntervalAvailable']-_0x21ec05){freeVariablesPredictive(_0x50d3ef);loggerPredictive['info'](_0x50d3ef['name'],_0xb81c('0x1d4'),_0x56638f,_0xb81c('0x1d5'),_0x50d3ef['predictiveIntervalAvailable'],'-',_0x21ec05,'=',_0x50d3ef['predictiveIntervalAvailable']-_0x21ec05,')');}else if(_0x50d3ef[_0xb81c('0x6c')]&&_0x56638f>_0x50d3ef[_0xb81c('0x6c')]+_0x3bdbe6){freeVariablesPredictive(_0x50d3ef);loggerPredictive[_0xb81c('0x7c')](_0x50d3ef['name'],_0xb81c('0x1d4'),_0x56638f,_0xb81c('0x1d6'),_0x50d3ef['predictiveIntervalAvailable'],'+',_0x3bdbe6,'=',_0x50d3ef[_0xb81c('0x6c')]+_0x3bdbe6,')');}};Dialer[_0xb81c('0x16')]['getDataPredictive']=function(_0x48c911){var _0x4a25aa=this;return function(_0x5b41c4){return new BPromise(function(_0x4f13b6,_0x3d7f47){_[_0xb81c('0xd1')](_0x48c911,_0x5b41c4[0x0]);if(checkGetDataPredictive(_0x5b41c4[0x0])){var _0x3e4df0=_0x48c911[_0xb81c('0x6c')]=_0x48c911[_0xb81c('0x4d')]+_0x48c911[_0xb81c('0x4a')];var _0x1c6443=_0x48c911[_0xb81c('0x1c9')]*0x3c;var _0x196b0a=_0x5b41c4[0x0][_0xb81c('0x65')]+_0x5b41c4[0x0]['predictiveIntervalAvgHoldtime'];var _0x1ace28=(_0x5b41c4[0x0][_0xb81c('0x63')]+_0x5b41c4[0x0][_0xb81c('0x67')]+_0x5b41c4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5b41c4[0x0][_0xb81c('0x6d')];_0x48c911[_0xb81c('0x6a')]=_0x1ace28>0x0?_0x1ace28:0x1;switch(_0x48c911['dialPredictiveOptimization']){case _0xb81c('0x1cc'):var _0x5aa151=_0x48c911[_0xb81c('0x1c2')]/0x64;return _0x4a25aa[_0xb81c('0x1d7')](_0x3e4df0,_0x1c6443,_0x196b0a,_0x1ace28,_0x5aa151)['then'](function(_0x266074){return _0x4f13b6(_0x266074);});case'agentBusyFactor':var _0x428db7=_0x48c911['dialPredictiveOptimizationPercentage']/0x64;return _0x4a25aa[_0xb81c('0x1d8')](_0x3e4df0,_0x1c6443,_0x196b0a,_0x1ace28,_0x428db7)[_0xb81c('0xb8')](function(_0x32b9ee){return _0x4f13b6(_0x32b9ee);});default:return _0x3d7f47(msgResponse(_0xb81c('0x1d9'),_0xb81c('0x146'),_0xb81c('0x1da')));}}else{return _0x3d7f47(msgResponse(_0xb81c('0x1d9'),_0xb81c('0x146'),'check\x20failure'));}});};};Dialer[_0xb81c('0x16')]['getDataPredictiveOld']=function(_0x8329f1){var _0x20703f=this;return function(_0x508cae){return new BPromise(function(_0x3f0cf1,_0x3bb1a4){_[_0xb81c('0xd1')](_0x8329f1,_0x508cae[0x0]);if(checkGetDataPredictive(_0x508cae[0x0])){loggerPredictive[_0xb81c('0x7c')](JSON[_0xb81c('0x74')](_0x508cae[0x0]));if(_0x8329f1[_0xb81c('0x1cb')]===_0xb81c('0x1cc')){return _0x20703f[_0xb81c('0xc7')](_0x8329f1['id'])[_0xb81c('0xb8')](function(_0x4eb5c9){var _0x2a5057=_0x8329f1[_0xb81c('0x4b')]-_0x4eb5c9[0x0][_0xb81c('0x1db')];var _0x1dd423=_0x8329f1['dialPredictiveInterval']*0x3c;var _0x4d2f44=_0x508cae[0x0][_0xb81c('0x65')]+_0x508cae[0x0][_0xb81c('0x64')];var _0x5f59a1=(_0x508cae[0x0]['predictiveIntervalAnsweredCalls']+_0x508cae[0x0][_0xb81c('0x67')]+_0x508cae[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x508cae[0x0][_0xb81c('0x6d')];var _0x5646b5=_0x8329f1[_0xb81c('0x1c2')]/0x64;_0x8329f1['predictiveIntervalPauses']=_0x4eb5c9[0x0][_0xb81c('0x1db')]||0x0;_0x8329f1['predictiveIntervalHitRate']=_0x5f59a1>0x0?_0x5f59a1:0x1;return _0x20703f[_0xb81c('0x1d7')](_0x2a5057,_0x1dd423,_0x4d2f44,_0x5f59a1,_0x5646b5);})[_0xb81c('0xb8')](function(_0x531023){return _0x3f0cf1(_0x531023);})['catch'](function(_0x3cf0c9){return _0x3bb1a4(msgResponse(_0xb81c('0x1dc'),_0xb81c('0x146'),JSON[_0xb81c('0x74')](_0x3cf0c9)));});}if(_0x8329f1[_0xb81c('0x1cb')]===_0xb81c('0x1dd')){return _0x20703f[_0xb81c('0xc7')](_0x8329f1['id'])['then'](function(_0x54c047){var _0x44eb5b=_0x8329f1['loggedIn']-_0x54c047[0x0][_0xb81c('0x1db')];var _0x2865d4=_0x8329f1['dialPredictiveInterval']*0x3c;var _0xce399d=_0x508cae[0x0][_0xb81c('0x65')]+_0x508cae[0x0][_0xb81c('0x64')];var _0x1eea97=(_0x508cae[0x0][_0xb81c('0x63')]+_0x508cae[0x0][_0xb81c('0x67')]+_0x508cae[0x0][_0xb81c('0x66')])/_0x508cae[0x0]['predictiveIntervalTotalCalls'];var _0x49a50c=_0x8329f1['dialPredictiveOptimizationPercentage']/0x64;_0x8329f1[_0xb81c('0x1de')]=_0x54c047[0x0][_0xb81c('0x1db')]||0x0;_0x8329f1[_0xb81c('0x6a')]=_0x1eea97>0x0?_0x1eea97:0x1;return _0x20703f[_0xb81c('0x1d8')](_0x44eb5b,_0x2865d4,_0xce399d,_0x1eea97,_0x49a50c);})[_0xb81c('0xb8')](function(_0xcd553){return _0x3f0cf1(_0xcd553);})[_0xb81c('0xb1')](function(_0x398cf4){return _0x3bb1a4(msgResponse(_0xb81c('0x1dc'),'Failure',JSON[_0xb81c('0x74')](_0x398cf4)));});}}else{return _0x3bb1a4(msgResponse(_0xb81c('0x1d9'),_0xb81c('0x146'),_0xb81c('0x1df')));}});};};Dialer['prototype'][_0xb81c('0x1d1')]=function(_0xaf947b){var _0x4b372f=this;return function(){var _0x315e98=0x0;var _0x1f1b1e=Math[_0xb81c('0x1e0')](_0xaf947b[_0xb81c('0x6f')]*0x3e8);if(_0x1f1b1e>0x0){_0x1f1b1e=_0x1f1b1e<0x64?0x64:_0x1f1b1e;loggerPredictive[_0xb81c('0x7c')](_0xaf947b[_0xb81c('0x3c')],_0xb81c('0x1e1'),_0x1f1b1e,_0xb81c('0x43'));_0xaf947b[_0xb81c('0x8d')]=setInterval(function(){_0x4b372f[_0xb81c('0x8d')](_0xaf947b);loggerPredictiveCalls[_0xb81c('0x7c')](_0xb81c('0x1e2'),_0x315e98+=0x1);},_0x1f1b1e);}else{loggerPredictive[_0xb81c('0x7c')](_0xaf947b[_0xb81c('0x3c')],_0xb81c('0x1e3'));}};};Dialer[_0xb81c('0x16')][_0xb81c('0x1e4')]=function(_0x48e387,_0x1a28e0){var _0x145d61=this;return function(_0x19b5c1){if(_[_0xb81c('0x7a')](_0x19b5c1)){if(_[_0xb81c('0xad')](_0x1a28e0[_0xb81c('0xd5')])||!_0x1a28e0[_0xb81c('0x1e5')]){if(_0x48e387['dialMethod']===_0xb81c('0x8')){_0x48e387[_0xb81c('0x130')]=_['isUndefined'](_0x48e387['queueStatusComplete'])?!![]:_0x48e387[_0xb81c('0x130')];var _0x277f33=uuid['v4']();_0x145d61[_0xb81c('0xa8')][_0x277f33]=new Action(_0x48e387,_0x1a28e0,_0x277f33);loggerBooked['info'](_0xb81c('0x1e6'),_0x277f33,_0xb81c('0x1e7'),JSON[_0xb81c('0x74')](_0x48e387[_0xb81c('0x130')]),'Queue:\x20',_0x48e387[_0xb81c('0x3c')]);if(_0x48e387[_0xb81c('0x130')]){_0x48e387['queueStatusComplete']=![];_0x145d61[_0xb81c('0x24')][_0x145d61[_0xb81c('0xa8')][_0x277f33][_0xb81c('0xb3')]]=[];ami[_0xb81c('0xae')]({'actionid':_0x277f33,'action':_0xb81c('0x1e8'),'queue':_0x48e387[_0xb81c('0x3c')]})[_0xb81c('0xb1')](function(_0x48c2fe){_0x145d61[_0xb81c('0xb4')](_0x48e387);_0x145d61[_0xb81c('0xc0')]({'active':![],'ContactId':_0x145d61['actions'][_0x277f33]['ContactId'],'ListId':_0x145d61[_0xb81c('0xa8')][_0x277f33][_0xb81c('0xd4')],'VoiceQueueId':_0x145d61['actions'][_0x277f33][_0xb81c('0xd6')]||undefined,'CampaignId':_0x145d61[_0xb81c('0xa8')][_0x277f33][_0xb81c('0xd7')]||undefined})['catch'](loggerCatch(_0xb81c('0x1e9')));delete _0x145d61[_0xb81c('0xa8')][_0x277f33];});}else{loggerBooked[_0xb81c('0x7c')](_0xb81c('0x1ea'),JSON['stringify'](_0x48e387[_0xb81c('0x130')]),_0xb81c('0x1eb'),_0x48e387[_0xb81c('0x3c')]);_0x145d61[_0xb81c('0xb4')](_0x48e387);_0x145d61[_0xb81c('0xc0')]({'active':![],'ContactId':_0x145d61['actions'][_0x277f33][_0xb81c('0xd3')],'ListId':_0x145d61['actions'][_0x277f33][_0xb81c('0xd4')],'VoiceQueueId':_0x145d61[_0xb81c('0xa8')][_0x277f33][_0xb81c('0xd6')]||undefined,'CampaignId':_0x145d61[_0xb81c('0xa8')][_0x277f33][_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x1e9')));delete _0x145d61[_0xb81c('0xa8')][_0x277f33];}}else{return _0x145d61[_0xb81c('0x1ec')](_0x48e387,_0x1a28e0);}}else{if(getDiff(_0x1a28e0[_0xb81c('0x1ed')])<_0x48e387[_0xb81c('0x1ee')]*0x3c){if(_0x1a28e0[_0xb81c('0x1ef')]&&!_0x1a28e0[_0xb81c('0x1ef')][_0xb81c('0x1f0')]){_0x145d61[_0xb81c('0x1a')][_0xb81c('0x1f1')](_0x1a28e0['id'])[_0xb81c('0x19')](function(){_0x145d61[_0xb81c('0xb4')](_0x48e387);});}else{_0x145d61['unlockContact']({'active':![]},_0x1a28e0['id'],0x1)[_0xb81c('0x19')](function(){console[_0xb81c('0x1f2')]('Contact\x20updated');_0x145d61[_0xb81c('0xb4')](_0x48e387);});}}else{_0x48e387[_0xb81c('0x61')]+=0x1;_0x145d61[_0xb81c('0xb4')](_0x48e387);if(_0x48e387[_0xb81c('0x1f3')]){_0x145d61[_0xb81c('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1a28e0[_0xb81c('0xd3')],'ListId':_0x1a28e0[_0xb81c('0xd4')],'VoiceQueueId':_0x1a28e0[_0xb81c('0xd6')]||undefined,'CampaignId':_0x1a28e0[_0xb81c('0xd7')]||undefined})[_0xb81c('0xb1')](loggerCatch(_0xb81c('0x1f4')));_0x145d61[_0xb81c('0xcb')](createObjHistory(_0x48e387,_0x1a28e0,'RECALLINQUEUE',0x17,_0xb81c('0x1f5')))[_0xb81c('0xb1')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x145d61[_0xb81c('0xde')](createObjHistory(_0x48e387,_0x1a28e0,_0xb81c('0x1f6'),0x16,'RecallFailedTimeout'),_0xb81c('0x1f7'),_0xb81c('0x1f8'));}}}}else{_0x48e387['outboundBlacklistCallsDay']+=0x1;_0x145d61['saveInDb'](createObjHistory(_0x48e387,_0x1a28e0,_0xb81c('0x1f9'),0xd,_0xb81c('0x1fa')),'[Originate][historyBlacklist]',_0xb81c('0x1fb'));throw _0xb81c('0x1fc');}};};Dialer[_0xb81c('0x16')][_0xb81c('0x1fd')]=function(_0x283884){var _0x283b54=this;var _0x58bc37=[];var _0x41833a=_0x283884['limitCalls']-_0x283884[_0xb81c('0x95')]-_0x283884[_0xb81c('0x1fe')];emitCampaignSummary(_0x283884);if(_0x41833a>0x0){if(_0x41833a>this[_0xb81c('0x1f')]){_0x41833a=this[_0xb81c('0x1f')];}_0x283884[_0xb81c('0x1fe')]+=_0x41833a;this['getContactDialerIvr'](_0x283884['id'],_0x41833a,_0x283884[_0xb81c('0x1ff')])[_0xb81c('0xb8')](function(_0x2bf121){_0x283884[_0xb81c('0x1fe')]-=_0x41833a;_0x283884['temp']=_0x283884[_0xb81c('0x1fe')]>0x0?_0x283884['temp']:0x0;if(!checkContactEmpty(_0x2bf121)){_0x283884[_0xb81c('0x39')]=_0xb81c('0x9b');logger[_0xb81c('0x7c')](_0xb81c('0x200')+_0x283884[_0xb81c('0x3c')]);}else{_0x283884[_0xb81c('0x95')]+=_0x2bf121['length'];_0x283884[_0xb81c('0x39')]=_0xb81c('0x201');for(var _0x34670f=0x0;_0x34670f<_0x2bf121['length'];_0x34670f+=0x1){_0x283884[_0xb81c('0x202')]+=0x1;if(_[_0xb81c('0xad')](_0x2bf121[_0x34670f])||_[_0xb81c('0xad')](_0x2bf121[_0x34670f][_0xb81c('0x168')])||_[_0xb81c('0xad')](_0x2bf121[_0x34670f][_0xb81c('0x168')][_0xb81c('0x169')])){_0x283b54[_0xb81c('0x203')](_0xb81c('0x204'),_0x283884,_0x2bf121[_0x34670f]);}else{_0x283b54[_0xb81c('0xbb')](_[_0xb81c('0xd2')](_0x2bf121[_0x34670f],['CampaignId',_0xb81c('0x205')]))[_0xb81c('0xb8')](_0x283b54[_0xb81c('0x1e4')](_0x283884,_0x2bf121[_0x34670f]))['catch'](_0x283b54['loggerHandler']('[actionOriginateIvr]\x20',_0x283884));}}}})[_0xb81c('0xb1')](loggerGetContactDialer('[getContactCampaign2]',_0x283884,_0x41833a));}};Dialer['prototype']['handlePower']=function(_0x10a86a,_0xac28fc){var _0x24fce1=this;var _0x14807f=[];var _0x4bed02=_0xac28fc>=0x1?_0xac28fc:0x1;var _0x387e77=[];if(_0x10a86a[_0xb81c('0x54')]===_0xb81c('0x8')){_0x4bed02=0x1;}var _0x33c9fe=Math[_0xb81c('0x1e0')](_0x10a86a[_0xb81c('0x4a')]*_0x4bed02)-_0x10a86a[_0xb81c('0x95')]-_0x10a86a[_0xb81c('0x1fe')];emitVoiceQueueSummary(_0x10a86a);if(_0x10a86a[_0xb81c('0x206')]>0x0){var _0x2b686a=_0x10a86a['dialLimitQueue']-_0x10a86a['originated']-_0x10a86a[_0xb81c('0x4d')]-_0x10a86a[_0xb81c('0x1fe')]-_0x10a86a[_0xb81c('0x9d')];if(_0x33c9fe>_0x2b686a){_0x33c9fe=_0x2b686a;}}if(_0x33c9fe>0x0){if(_0x10a86a[_0xb81c('0x54')]==='booked'){_0x33c9fe=0x1;}if(_0x33c9fe>this[_0xb81c('0x1f')]){_0x33c9fe=this['maxNumberOriginate'];}_0x10a86a['temp']+=_0x33c9fe;for(var _0x135f7c in this[_0xb81c('0x1d')]){if(this[_0xb81c('0x1d')][_0xb81c('0xab')](_0x135f7c)){if(this[_0xb81c('0x1d')][_0x135f7c][_0xb81c('0xe6')]==='not_inuse'&&this[_0xb81c('0x1d')][_0x135f7c][_0xb81c('0xaf')]===_0xb81c('0xdd')){_0x14807f['push'](this[_0xb81c('0x1d')][_0x135f7c]['id']);}}}this[_0xb81c('0xc4')](_0x10a86a['id'],_0x14807f,_0x33c9fe,_0x10a86a[_0xb81c('0x1ff')])[_0xb81c('0xb8')](function(_0x257893){_0x10a86a[_0xb81c('0x1fe')]-=_0x33c9fe;_0x10a86a[_0xb81c('0x1fe')]=_0x10a86a[_0xb81c('0x1fe')]>0x0?_0x10a86a[_0xb81c('0x1fe')]:0x0;if(!checkContactEmpty(_0x257893)){_0x24fce1[_0xb81c('0xb6')](_0x10a86a)[_0xb81c('0xb8')](sendMessageReschedule(_0x10a86a))[_0xb81c('0xb1')](loggerCatch('[countReScheduled]\x20'));}else{_0x10a86a[_0xb81c('0x95')]+=_0x257893['length'];_0x10a86a[_0xb81c('0x39')]=_0x10a86a['dialMethod']===_0xb81c('0x8')?_0xb81c('0x207'):'RUNNING';for(var _0x408856=0x0;_0x408856<_0x257893[_0xb81c('0x94')];_0x408856+=0x1){if(_[_0xb81c('0xad')](_0x257893[_0x408856])||_['isNil'](_0x257893[_0x408856]['Contact'])||_[_0xb81c('0xad')](_0x257893[_0x408856][_0xb81c('0x168')][_0xb81c('0x169')])){_0x24fce1[_0xb81c('0x203')](_0xb81c('0x204'),_0x10a86a,_0x257893[_0x408856]);}else{_0x24fce1[_0xb81c('0xb9')](_[_0xb81c('0xd2')](_0x257893[_0x408856],[_0xb81c('0xd6'),_0xb81c('0x205')]))[_0xb81c('0xb8')](_0x24fce1[_0xb81c('0x1e4')](_0x10a86a,_0x257893[_0x408856]))['catch'](_0x24fce1[_0xb81c('0xcf')]('[actionOriginate]\x20',_0x10a86a));}}}})[_0xb81c('0xb1')](loggerGetContactDialer('[getContactDialer2]',_0x10a86a,_0x33c9fe));}};Dialer[_0xb81c('0x16')][_0xb81c('0x8d')]=function(_0x874212){var _0x34444f=this;if(_0x874212[_0xb81c('0x206')]>0x0){var _0x5027e1=_0x874212['dialLimitQueue']-_0x874212['originated']-_0x874212[_0xb81c('0x4d')];if(_0x5027e1>0x0){this[_0xb81c('0x208')](_0x874212);}else{loggerPredictiveCalls['info'](_0xb81c('0x209'));}}else{this['tryOriginatePredictive'](_0x874212);}};Dialer[_0xb81c('0x16')][_0xb81c('0x208')]=function(_0x4c12bb){var _0x15810e=this;var _0x10c84a=[];_0x4c12bb[_0xb81c('0x95')]+=0x1;for(var _0x47e0bc in this[_0xb81c('0x1d')]){if(this[_0xb81c('0x1d')][_0xb81c('0xab')](_0x47e0bc)){if(this[_0xb81c('0x1d')][_0x47e0bc][_0xb81c('0xe6')]===_0xb81c('0x20a')&&this[_0xb81c('0x1d')][_0x47e0bc][_0xb81c('0xaf')]===_0xb81c('0xdd')){_0x10c84a[_0xb81c('0x14c')](this[_0xb81c('0x1d')][_0x47e0bc]['id']);}}}this[_0xb81c('0xc4')](_0x4c12bb['id'],_0x10c84a,0x1,_0x4c12bb[_0xb81c('0x1ff')])[_0xb81c('0xb8')](function(_0x46f32d){if(!checkContactEmpty(_0x46f32d)){checkContactLowerLimitOriginate(_0x4c12bb,0x1,0x0);_0x15810e[_0xb81c('0xb6')](_0x4c12bb)[_0xb81c('0xb8')](sendMessageReschedule(_0x4c12bb))['catch'](loggerCatch(_0xb81c('0x20b')));}else{_0x4c12bb[_0xb81c('0x39')]=_0xb81c('0x201');if(_[_0xb81c('0xad')](_0x46f32d[0x0])||_[_0xb81c('0xad')](_0x46f32d[0x0]['Contact'])||_[_0xb81c('0xad')](_0x46f32d[0x0][_0xb81c('0x168')]['phone'])){_0x15810e[_0xb81c('0x203')](_0xb81c('0x204'),_0x4c12bb,_0x46f32d[0x0]);}else{_0x15810e[_0xb81c('0xb9')](_[_0xb81c('0xd2')](_0x46f32d[0x0],[_0xb81c('0xd6'),_0xb81c('0x205')]))['then'](_0x15810e['checkContactBlack'](_0x4c12bb,_0x46f32d[0x0]))[_0xb81c('0xb1')](_0x15810e['loggerHandler'](_0xb81c('0x20c'),_0x4c12bb));}}})[_0xb81c('0xb1')](loggerGetContactDialer(_0xb81c('0x20d'),_0x4c12bb,0x1));emitVoiceQueueSummary(_0x4c12bb);};Dialer[_0xb81c('0x16')][_0xb81c('0x1d7')]=function(_0xd47b40,_0x10497c,_0x477db9,_0x40711f,_0x4b90da,_0x4c520b){loggerPredictive['info'](_0xb81c('0x20e'));loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x20f'),_0xd47b40);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x210'),_0x10497c);loggerPredictive['info'](_0xb81c('0x211'),_0x477db9);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x212'),_0x40711f);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x213'),_0x4b90da);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x82'));return new BPromise(function(_0x15f16e,_0x197d73){if(_0xd47b40<=0x0||isNaN(_0xd47b40)){return _0x197d73(msgResponse(_0xb81c('0x214'),'Error',_0xb81c('0x215')+_0xd47b40));}if(_0x477db9<=0x0||isNaN(_0x477db9)){return _0x197d73(msgResponse(_0xb81c('0x214'),_0xb81c('0x216'),_0xb81c('0x217')+_0x477db9));}if(_0x40711f<=0x0||isNaN(_0x40711f)){return _0x197d73(msgResponse(_0xb81c('0x214'),_0xb81c('0x216'),'p\x20=\x20'+_0x40711f));}if(_0x10497c<=0x0||isNaN(_0x10497c)){return _0x197d73(msgResponse(_0xb81c('0x214'),'Error','interval\x20=\x20'+_0x10497c));}if(_0x4b90da<=0x0||isNaN(_0x4b90da)){return _0x197d73(msgResponse(_0xb81c('0x214'),_0xb81c('0x216'),_0xb81c('0x218')+_0x4b90da));}_0x4c520b=_0x4c520b||0x0;var _0x353bad=0x1/_0x477db9;var _0x305237=0x0;var _0x4875cb=0x0;var _0x3ef5ae=0x0;var _0x26f994=0x0;for(var _0x2aa2f7=0x0;_0x3ef5ae<_0x4b90da;_0x2aa2f7+=0x1){_0x4875cb=_0x2aa2f7/_0x10497c;_0x305237=(_0x40711f*_0x4875cb+_0x4c520b)/_0x353bad;_0x3ef5ae=erlangb(_0x305237,_0xd47b40);_0x26f994=_0x305237/_0xd47b40*(0x1-erlangb(_0x305237,_0xd47b40));}return _0x15f16e({'erlangCalls':_0x2aa2f7,'erlangCallToSecond':_0x10497c/_0x2aa2f7,'erlangAbandonmentRate':_0x3ef5ae,'erlangBusyFactor':_0x26f994});});};Dialer[_0xb81c('0x16')]['busyFactor']=function(_0x1edce6,_0x50f700,_0x251615,_0x45e628,_0x5ea4,_0x5d6b4b){loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x219'));loggerPredictive['info'](_0xb81c('0x20f'),_0x1edce6);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x210'),_0x50f700);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x211'),_0x251615);loggerPredictive['info']('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',_0x45e628);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ea4);loggerPredictive[_0xb81c('0x7c')](_0xb81c('0x82'));return new BPromise(function(_0x431167,_0x11ff3b){if(_0x1edce6<=0x0||isNaN(_0x1edce6)){return _0x11ff3b(msgResponse(_0xb81c('0x21a'),_0xb81c('0x216'),_0xb81c('0x215')+_0x1edce6));}if(_0x251615<=0x0||isNaN(_0x251615)){return _0x11ff3b(msgResponse(_0xb81c('0x21a'),_0xb81c('0x216'),_0xb81c('0x217')+_0x251615));}if(_0x45e628<=0x0||isNaN(_0x45e628)){return _0x11ff3b(msgResponse(_0xb81c('0x21a'),_0xb81c('0x216'),_0xb81c('0x21b')+_0x45e628));}if(_0x50f700<=0x0||isNaN(_0x50f700)){return _0x11ff3b(msgResponse(_0xb81c('0x21a'),'Error',_0xb81c('0x21c')+_0x50f700));}if(_0x5ea4<=0x0||isNaN(_0x5ea4)){return _0x11ff3b(msgResponse('[busyFactor]',_0xb81c('0x216'),_0xb81c('0x21d')+_0x5ea4));}_0x5d6b4b=_0x5d6b4b||0x0;var _0x40103d=0x1/_0x251615;var _0x49159b=0x0;var _0x3cb8e4=0x0;var _0x20611=0x0;var _0x51457f=0x0;for(var _0x50f307=0x0;_0x51457f<_0x5ea4;_0x50f307+=0x1){_0x3cb8e4=_0x50f307/_0x50f700;_0x49159b=(_0x45e628*_0x3cb8e4+_0x5d6b4b)/_0x40103d;_0x20611=erlangb(_0x49159b,_0x1edce6);_0x51457f=_0x49159b/_0x1edce6*(0x1-erlangb(_0x49159b,_0x1edce6));}return _0x431167({'erlangCalls':_0x50f307,'erlangCallToSecond':_0x50f700/_0x50f307,'erlangAbandonmentRate':_0x20611,'erlangBusyFactor':_0x51457f});});};module[_0xb81c('0x21e')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index acfd7f4..46f5a13 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 _0x11b8=['countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11b8,0x14e));var _0x811b=function(_0x4cbd35,_0x3fd034){_0x4cbd35=_0x4cbd35-0x0;var _0x41961e=_0x11b8[_0x4cbd35];return _0x41961e;};'use strict';var util=require('util');var _=require(_0x811b('0x0'));var moment=require('moment');function getSeconds(_0x11bf44,_0x254684){var _0x208b30=moment(_0x11bf44)[_0x811b('0x1')](0x0);var _0x248179=moment(_0x254684)[_0x811b('0x1')](0x0);return _0x208b30[_0x811b('0x2')](_0x248179,_0x811b('0x3'));}function QueueCallerAbandon(_0x48360a,_0x4699db){this[_0x811b('0x4')]=_0x48360a[_0x811b('0x4')];this['type']=_0x48360a[_0x811b('0x5')];this[_0x811b('0x6')]=_0x48360a[_0x811b('0x5')]===_0x811b('0x7')?_0x811b('0x8'):_0x48360a[_0x811b('0x5')];this['countbusyretry']=_0x48360a[_0x811b('0x9')];this[_0x811b('0xa')]=_0x48360a[_0x811b('0xa')];this['countnoanswerretry']=_0x48360a[_0x811b('0xb')];this[_0x811b('0xc')]=_0x48360a['countbusyretry']+_0x48360a[_0x811b('0xa')]+_0x48360a[_0x811b('0xb')]+_0x48360a['countnosuchnumberretry']+_0x48360a['countdropretry']+_0x48360a[_0x811b('0xd')]+_0x48360a[_0x811b('0xe')]+_0x48360a['countagentrejectretry'];this[_0x811b('0xf')]=_0x48360a[_0x811b('0xf')];this['countdropretry']=_0x48360a['countdropretry'];this[_0x811b('0xd')]=_0x48360a[_0x811b('0xd')];this['countmachineretry']=_0x48360a['countmachineretry'];this[_0x811b('0x10')]=_0x48360a['countagentrejectretry'];this[_0x811b('0x11')]=_0x4699db['uniqueid'];this[_0x811b('0x12')]=_0x48360a[_0x811b('0x13')];this[_0x811b('0x14')]=_0x48360a[_0x811b('0x15')];this[_0x811b('0x16')]=_0x48360a[_0x811b('0x16')];this[_0x811b('0x17')]=_0x48360a[_0x811b('0x17')];this['droptime']=_0x48360a[_0x811b('0x18')];this[_0x811b('0x19')]=this[_0x811b('0x18')];this[_0x811b('0x1a')]=getSeconds(_0x48360a[_0x811b('0x17')],_0x48360a['starttime']);this[_0x811b('0x1b')]=getSeconds(this[_0x811b('0x18')],_0x48360a[_0x811b('0x17')]);this[_0x811b('0x1c')]=0x0;this[_0x811b('0x8')]=_0x4699db[_0x811b('0x8')];this[_0x811b('0x1d')]=_0x4699db['connectedlinename'];this['reason']=_0x4699db[_0x811b('0x1e')];this[_0x811b('0x1f')]=_0x48360a[_0x811b('0x1f')];this[_0x811b('0x20')]=_0x48360a[_0x811b('0x20')];this[_0x811b('0x21')]=_0x48360a[_0x811b('0x21')];this['recallme']=_0x48360a[_0x811b('0x22')];this[_0x811b('0x23')]=_0x48360a['ContactId'];this[_0x811b('0x24')]=_0x48360a[_0x811b('0x24')];this['UserId']=_0x48360a[_0x811b('0x25')];this['VoiceQueueId']=_0x48360a[_0x811b('0x26')];this[_0x811b('0x27')]=_0x48360a['CampaignId'];this[_0x811b('0x28')]=_0x48360a[_0x811b('0x28')]||'';this[_0x811b('0x29')]=_0x48360a[_0x811b('0x29')]||'';}module[_0x811b('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xaabe=['connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','number','responsetime','droptime','endtime','ringtime','starttime','holdtime','membername'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xaabe,0x8f));var _0xeaab=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xaabe[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require('util');var _=require(_0xeaab('0x0'));var moment=require('moment');function getSeconds(_0x3f6110,_0x23b99c){var _0x81235e=moment(_0x3f6110)[_0xeaab('0x1')](0x0);var _0x3dc2a4=moment(_0x23b99c)['milliseconds'](0x0);return _0x81235e[_0xeaab('0x2')](_0x3dc2a4,_0xeaab('0x3'));}function QueueCallerAbandon(_0x1ff8b2,_0x374d35){this[_0xeaab('0x4')]=_0x1ff8b2['scheduledat'];this[_0xeaab('0x5')]=_0x1ff8b2[_0xeaab('0x5')];this[_0xeaab('0x6')]=_0x1ff8b2[_0xeaab('0x5')]===_0xeaab('0x7')?_0xeaab('0x8'):_0x1ff8b2['type'];this[_0xeaab('0x9')]=_0x1ff8b2['countbusyretry'];this[_0xeaab('0xa')]=_0x1ff8b2['countcongestionretry'];this[_0xeaab('0xb')]=_0x1ff8b2[_0xeaab('0xb')];this[_0xeaab('0xc')]=_0x1ff8b2[_0xeaab('0x9')]+_0x1ff8b2[_0xeaab('0xa')]+_0x1ff8b2['countnoanswerretry']+_0x1ff8b2['countnosuchnumberretry']+_0x1ff8b2[_0xeaab('0xd')]+_0x1ff8b2[_0xeaab('0xe')]+_0x1ff8b2['countmachineretry']+_0x1ff8b2[_0xeaab('0xf')];this['countnosuchnumberretry']=_0x1ff8b2[_0xeaab('0x10')];this[_0xeaab('0xd')]=_0x1ff8b2[_0xeaab('0xd')];this[_0xeaab('0xe')]=_0x1ff8b2[_0xeaab('0xe')];this[_0xeaab('0x11')]=_0x1ff8b2[_0xeaab('0x11')];this['countagentrejectretry']=_0x1ff8b2[_0xeaab('0xf')];this[_0xeaab('0x12')]=_0x374d35[_0xeaab('0x12')];this[_0xeaab('0x13')]=_0x1ff8b2[_0xeaab('0x14')];this['calleridnum']=_0x1ff8b2[_0xeaab('0x15')];this['starttime']=_0x1ff8b2['starttime'];this[_0xeaab('0x16')]=_0x1ff8b2['responsetime'];this[_0xeaab('0x17')]=_0x1ff8b2[_0xeaab('0x17')];this[_0xeaab('0x18')]=this[_0xeaab('0x17')];this[_0xeaab('0x19')]=getSeconds(_0x1ff8b2[_0xeaab('0x16')],_0x1ff8b2[_0xeaab('0x1a')]);this[_0xeaab('0x1b')]=getSeconds(this[_0xeaab('0x17')],_0x1ff8b2[_0xeaab('0x16')]);this['talktime']=0x0;this[_0xeaab('0x8')]=_0x374d35[_0xeaab('0x8')];this[_0xeaab('0x1c')]=_0x374d35[_0xeaab('0x1d')];this[_0xeaab('0x1e')]=_0x374d35[_0xeaab('0x1e')];this['callback']=_0x1ff8b2[_0xeaab('0x1f')];this[_0xeaab('0x20')]=_0x1ff8b2[_0xeaab('0x20')];this[_0xeaab('0x21')]=_0x1ff8b2[_0xeaab('0x21')];this['recallme']=_0x1ff8b2[_0xeaab('0x22')];this[_0xeaab('0x23')]=_0x1ff8b2['ContactId'];this[_0xeaab('0x24')]=_0x1ff8b2[_0xeaab('0x24')];this[_0xeaab('0x25')]=_0x1ff8b2[_0xeaab('0x25')];this[_0xeaab('0x26')]=_0x1ff8b2[_0xeaab('0x26')];this['CampaignId']=_0x1ff8b2[_0xeaab('0x27')];this[_0xeaab('0x28')]=_0x1ff8b2[_0xeaab('0x28')]||'';this[_0xeaab('0x29')]=_0x1ff8b2[_0xeaab('0x29')]||'';}module[_0xeaab('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index b12ca87..8e5d408 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 _0xb75f=['exports','util','moment','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xb75f,0x1f0));var _0xfb75=function(_0x4ae0f8,_0x481211){_0x4ae0f8=_0x4ae0f8-0x0;var _0xcd39f7=_0xb75f[_0x4ae0f8];return _0xcd39f7;};'use strict';var util=require(_0xfb75('0x0'));var _=require('lodash');var moment=require(_0xfb75('0x1'));function Action(_0x38b7fe,_0x631e23,_0x353fcd){this[_0xfb75('0x2')]=_0x38b7fe||undefined;this[_0xfb75('0x3')]=util[_0xfb75('0x4')](_0xfb75('0x5'),_0x631e23[_0xfb75('0x6')],_0x631e23[_0xfb75('0x7')][_0xfb75('0x8')],_0x353fcd[_0xfb75('0x9')]);this[_0xfb75('0xa')]=_0x631e23[_0xfb75('0xa')];this[_0xfb75('0xb')]=_0x631e23[_0xfb75('0xb')];this['path']=_0x353fcd[_0xfb75('0xc')];this[_0xfb75('0xd')]=_0x353fcd[_0xfb75('0xd')];}module[_0xfb75('0xe')]=Action; \ No newline at end of file +var _0xea2f=['channel','format','%s/%s/%s','tech','Trunk','fax','localstationid','headerinfo','path','lodash','uniqueid'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xea2f,0x17f));var _0xfea2=function(_0x585d7b,_0x1ee816){_0x585d7b=_0x585d7b-0x0;var _0x4adfc9=_0xea2f[_0x585d7b];return _0x4adfc9;};'use strict';var util=require('util');var _=require(_0xfea2('0x0'));var moment=require('moment');function Action(_0x18fe5a,_0x597118,_0x56c9c6){this[_0xfea2('0x1')]=_0x18fe5a||undefined;this[_0xfea2('0x2')]=util[_0xfea2('0x3')](_0xfea2('0x4'),_0x597118[_0xfea2('0x5')],_0x597118[_0xfea2('0x6')]['name'],_0x56c9c6[_0xfea2('0x7')]);this[_0xfea2('0x8')]=_0x597118[_0xfea2('0x8')];this[_0xfea2('0x9')]=_0x597118['headerinfo'];this['path']=_0x56c9c6[_0xfea2('0xa')];this['AttachmentId']=_0x56c9c6['AttachmentId'];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 2e62140..2fa9f0a 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 _0xa7e6=['fax','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','moment','path','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','varset','syncVarSet','bind','newstate','newexten','faxstatus','hangup','syncHangup','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf'];(function(_0x166ec1,_0x5ea555){var _0x5208e6=function(_0x48659a){while(--_0x48659a){_0x166ec1['push'](_0x166ec1['shift']());}};_0x5208e6(++_0x5ea555);}(_0xa7e6,0xab));var _0x6a7e=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0xa7e6[_0x1034ee];return _0x2922af;};'use strict';var util=require('util');var _=require(_0x6a7e('0x0'));var BPromise=require(_0x6a7e('0x1'));var uuid=require('uuid');var moment=require(_0x6a7e('0x2'));var path=require(_0x6a7e('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x6a7e('0x4'))('fax');var ami=require(_0x6a7e('0x5'));var rpcDb=require(_0x6a7e('0x6'));var Channel=require(_0x6a7e('0x7'));var ut=require(_0x6a7e('0x8'));var Action=require(_0x6a7e('0x9'));var faxAccount=require(_0x6a7e('0xa'));var attachment=require(_0x6a7e('0xb'));var faxMessage=require(_0x6a7e('0xc'));function Fax(_0x21813c){this[_0x6a7e('0xd')]={};this[_0x6a7e('0xe')]=_0x21813c[_0x6a7e('0xe')];this[_0x6a7e('0xf')]=_0x21813c[_0x6a7e('0xf')];this[_0x6a7e('0x10')]={};ami['on'](_0x6a7e('0x11'),this['syncNewchannel']['bind'](this));ami['on'](_0x6a7e('0x12'),this[_0x6a7e('0x13')][_0x6a7e('0x14')](this));ami['on'](_0x6a7e('0x15'),this['syncNewState'][_0x6a7e('0x14')](this));ami['on'](_0x6a7e('0x16'),this['syncNewExten']['bind'](this));ami['on'](_0x6a7e('0x17'),this['syncFaxStatus'][_0x6a7e('0x14')](this));ami['on']('receivefax',this['syncReceiveFax'][_0x6a7e('0x14')](this));ami['on'](_0x6a7e('0x18'),this[_0x6a7e('0x19')][_0x6a7e('0x14')](this));ami['on']('originateresponse',this[_0x6a7e('0x1a')][_0x6a7e('0x14')](this));}Fax[_0x6a7e('0x1b')][_0x6a7e('0x1c')]=function(_0x5e0885){if(_0x5e0885[_0x6a7e('0x1d')]===_0x6a7e('0x1e')){for(var _0x374a12 in this[_0x6a7e('0xe')]){if(this[_0x6a7e('0xe')]['hasOwnProperty'](_0x374a12)){if(_0x5e0885[_0x6a7e('0x1f')]===this[_0x6a7e('0xe')][_0x374a12]['localstationid']){this[_0x6a7e('0xd')][_0x5e0885[_0x6a7e('0x20')]]={};this[_0x6a7e('0xd')][_0x5e0885[_0x6a7e('0x20')]][_0x6a7e('0x21')]=_0x5e0885[_0x6a7e('0x21')];this[_0x6a7e('0xd')][_0x5e0885['uniqueid']]['id']=this[_0x6a7e('0xe')][_0x374a12]['id'];this[_0x6a7e('0xd')][_0x5e0885[_0x6a7e('0x20')]][_0x6a7e('0x22')]=this[_0x6a7e('0xe')][_0x374a12][_0x6a7e('0x22')];logger[_0x6a7e('0x23')](_0x5e0885[_0x6a7e('0x20')],_0x6a7e('0x24'));}}}}if(this[_0x6a7e('0x10')][_0x5e0885[_0x6a7e('0x20')]]){this['channels'][_0x5e0885[_0x6a7e('0x20')]]={};this[_0x6a7e('0xd')][_0x5e0885[_0x6a7e('0x20')]][_0x6a7e('0x21')]=_0x5e0885[_0x6a7e('0x21')];logger[_0x6a7e('0x23')](_0x5e0885[_0x6a7e('0x20')],_0x6a7e('0x24'));}};Fax[_0x6a7e('0x1b')]['syncVarSet']=function(_0x17e34c){if(this['channels'][_0x17e34c['uniqueid']]){for(var _0x584d6b in _0x17e34c[_0x6a7e('0x25')]){if(_0x17e34c['variable'][_0x6a7e('0x26')](_0x584d6b)){this[_0x6a7e('0xd')][_0x17e34c[_0x6a7e('0x20')]][_0x584d6b]=_0x17e34c[_0x6a7e('0x27')];}}}};Fax['prototype'][_0x6a7e('0x28')]=function(_0x5512ec){if(this['channels'][_0x5512ec[_0x6a7e('0x20')]]){this[_0x6a7e('0xd')][_0x5512ec['uniqueid']][_0x6a7e('0x29')]=_0x5512ec[_0x6a7e('0x29')];this[_0x6a7e('0xd')][_0x5512ec['uniqueid']]['channelstatedesc']=_0x5512ec[_0x6a7e('0x2a')];}};Fax['prototype'][_0x6a7e('0x2b')]=function(_0x275c52){if(this['channels'][_0x275c52[_0x6a7e('0x20')]]){for(var _0x4dfee5 in _0x275c52[_0x6a7e('0x25')]){if(_0x275c52[_0x6a7e('0x25')][_0x6a7e('0x26')](_0x4dfee5)){this[_0x6a7e('0xd')][_0x275c52[_0x6a7e('0x20')]][_0x4dfee5]=_0x275c52['value'];}}}};Fax[_0x6a7e('0x1b')][_0x6a7e('0x2c')]=function(_0x370ca8){if(this[_0x6a7e('0xd')][_0x370ca8['uniqueid']]){this[_0x6a7e('0xd')][_0x370ca8[_0x6a7e('0x20')]]['operation']=_0x370ca8[_0x6a7e('0x2d')];this['channels'][_0x370ca8['uniqueid']][_0x6a7e('0x2e')]=_0x370ca8[_0x6a7e('0x2e')];this[_0x6a7e('0xd')][_0x370ca8['uniqueid']][_0x6a7e('0x2f')]=_0x370ca8[_0x6a7e('0x2f')];this[_0x6a7e('0xd')][_0x370ca8[_0x6a7e('0x20')]][_0x6a7e('0x30')]=_0x370ca8[_0x6a7e('0x30')];logger['info'](_0x370ca8[_0x6a7e('0x20')],_0x6a7e('0x31'));}};Fax['prototype']['syncReceiveFax']=function(_0x34b719){var _0x2dcc61=this;if(this[_0x6a7e('0xd')][_0x34b719[_0x6a7e('0x20')]]){var _0x3f0990=this[_0x6a7e('0xd')][_0x34b719['uniqueid']]['id'];this['channels'][_0x34b719[_0x6a7e('0x20')]][_0x6a7e('0x32')]=_0x34b719[_0x6a7e('0x32')];this['channels'][_0x34b719[_0x6a7e('0x20')]][_0x6a7e('0x33')]=_0x34b719[_0x6a7e('0x33')];this[_0x6a7e('0xd')][_0x34b719[_0x6a7e('0x20')]]['localstationid']=_0x34b719[_0x6a7e('0x2f')];this[_0x6a7e('0xd')][_0x34b719[_0x6a7e('0x20')]]['resolution']=_0x34b719['resolution'];this[_0x6a7e('0xd')][_0x34b719[_0x6a7e('0x20')]][_0x6a7e('0x34')]=_0x34b719[_0x6a7e('0x34')];this[_0x6a7e('0xd')][_0x34b719[_0x6a7e('0x20')]][_0x6a7e('0x30')]=_0x34b719[_0x6a7e('0x30')];this[_0x6a7e('0xd')][_0x34b719[_0x6a7e('0x20')]][_0x6a7e('0x35')]=_0x34b719[_0x6a7e('0x35')];if(this[_0x6a7e('0xd')][_0x34b719[_0x6a7e('0x20')]][_0x6a7e('0x33')]>0x0){tiff2pdf(_0x34b719[_0x6a7e('0x30')],_0x6a7e('0x36'),function(_0x536439){logger[_0x6a7e('0x23')](_0x34b719[_0x6a7e('0x20')],_0x6a7e('0x37'),_0x536439[_0x6a7e('0x38')]);attachment[_0x6a7e('0x39')]({'name':path[_0x6a7e('0x3a')](_0x34b719[_0x6a7e('0x30')])['name'],'basename':path[_0x6a7e('0x3a')](_0x34b719[_0x6a7e('0x30')])[_0x6a7e('0x22')]+_0x6a7e('0x3b'),'type':_0x6a7e('0x3c')})['then'](function(_0x43521c){faxAccount['notify'](_0x3f0990,{'from':_0x34b719[_0x6a7e('0x35')],'mapKey':_0x6a7e('0x3d'),'body':path[_0x6a7e('0x3a')](_0x34b719[_0x6a7e('0x30')])[_0x6a7e('0x22')]+_0x6a7e('0x3b'),'AttachmentId':_0x43521c['id']})[_0x6a7e('0x3e')](function(_0x5f550c){logger[_0x6a7e('0x3f')](_0x34b719['uniqueid'],'\x20notify\x20',JSON[_0x6a7e('0x40')](_0x5f550c));});})[_0x6a7e('0x3e')](function(_0x1df7c0){logger[_0x6a7e('0x3f')](_0x34b719[_0x6a7e('0x20')],_0x6a7e('0x41'),JSON[_0x6a7e('0x40')](_0x1df7c0));});});}logger[_0x6a7e('0x23')](_0x34b719['uniqueid'],_0x6a7e('0x41'));}};Fax[_0x6a7e('0x1b')][_0x6a7e('0x1a')]=function(_0xb39fec){if(this['actions'][_0xb39fec[_0x6a7e('0x20')]]){_[_0x6a7e('0x42')](this[_0x6a7e('0xd')][_0xb39fec['uniqueid']],_[_0x6a7e('0x43')](_0xb39fec,[_0x6a7e('0x44'),_0x6a7e('0x45')]));}};function updateStatus(_0x3ed54d){if(_0x3ed54d['AttachmentId']){faxMessage[_0x6a7e('0x46')](_0x3ed54d[_0x6a7e('0x47')],{'failMessage':_0x6a7e('0x48')})[_0x6a7e('0x49')](function(_0x37e41f){ut[_0x6a7e('0x4a')](_0x6a7e('0x4b'),_0x37e41f);})[_0x6a7e('0x3e')](function(_0x53b53e){ut['logger'](_0x6a7e('0x4c'),_0x53b53e);});}else{ut['logger'](_0x6a7e('0x4d'));}}Fax[_0x6a7e('0x1b')]['updateStatus']=function(_0x22f8b8,_0x1d0a94,_0xbea30e){var _0x5652b5=this;var _0x1eed52={};if(_0x1d0a94){_0x1eed52={'read':_0x1d0a94};}else{_0x1eed52={'failMessage':_0xbea30e};}if(this[_0x6a7e('0x10')][_0x22f8b8][_0x6a7e('0x47')]){faxMessage[_0x6a7e('0x46')](this[_0x6a7e('0x10')][_0x22f8b8][_0x6a7e('0x47')],_0x1eed52)[_0x6a7e('0x49')](function(_0xf52efd){ut[_0x6a7e('0x4a')](_0x6a7e('0x4e'),_0xf52efd);})[_0x6a7e('0x3e')](function(_0x4243a5){ut[_0x6a7e('0x4a')](_0x6a7e('0x4f'),_0x4243a5);})[_0x6a7e('0x50')](function(){delete _0x5652b5[_0x6a7e('0xd')][_0x22f8b8];delete _0x5652b5[_0x6a7e('0x10')][_0x22f8b8];});}else{ut[_0x6a7e('0x4a')](_0x6a7e('0x51'));delete this[_0x6a7e('0xd')][_0x22f8b8];delete this[_0x6a7e('0x10')][_0x22f8b8];}};Fax['prototype'][_0x6a7e('0x19')]=function(_0x273c88){var _0x1e37c0=this;if(this[_0x6a7e('0xd')][_0x273c88[_0x6a7e('0x20')]]){if(this['actions'][_0x273c88['uniqueid']]){this[_0x6a7e('0xd')][_0x273c88[_0x6a7e('0x20')]]['id']=this[_0x6a7e('0x10')][_0x273c88['uniqueid']]['id'];this[_0x6a7e('0xd')][_0x273c88[_0x6a7e('0x20')]]['name']=this[_0x6a7e('0x10')][_0x273c88['uniqueid']]['name'];}logger['info'](_0x273c88[_0x6a7e('0x20')],this[_0x6a7e('0x10')][_0x273c88[_0x6a7e('0x20')]]?_0x6a7e('0x52'):'\x20hangup\x20faxRiceive\x20',JSON[_0x6a7e('0x40')](this[_0x6a7e('0xd')][_0x273c88[_0x6a7e('0x20')]]));if(this[_0x6a7e('0x10')][_0x273c88['uniqueid']]){if(this['channels'][_0x273c88['uniqueid']]['faxpages']>0x0&&this[_0x6a7e('0xd')][_0x273c88[_0x6a7e('0x20')]][_0x6a7e('0x17')]===_0x6a7e('0x53')){this['updateStatus'](_0x273c88[_0x6a7e('0x20')],!![]);}else{this[_0x6a7e('0x54')](_0x273c88[_0x6a7e('0x20')],![],this[_0x6a7e('0xd')][_0x273c88['uniqueid']]['faxstatusstring']?_0x6a7e('0x55')+this[_0x6a7e('0xd')][_0x273c88['uniqueid']][_0x6a7e('0x56')]:_0x6a7e('0x57'));}}}};Fax[_0x6a7e('0x1b')][_0x6a7e('0x58')]=function(_0x2aec4d){var _0x585b1a=this;return new BPromise(function(_0x544a14,_0x21c74d){_0x585b1a['execOriginate'](_0x2aec4d,_0x585b1a[_0x6a7e('0xe')][_0x2aec4d[_0x6a7e('0x59')]])[_0x6a7e('0x49')](function(_0x326ea5){ut[_0x6a7e('0x4a')]('[Fax][execOriginate][success]',_0x326ea5);_0x544a14(ut[_0x6a7e('0x38')]('Fax\x20received'));})['catch'](function(_0x502d10){ut[_0x6a7e('0x4a')](_0x6a7e('0x5a'),_0x502d10);updateStatus(_0x2aec4d);_0x21c74d(ut[_0x6a7e('0x38')](_0x6a7e('0x5b')));});});};Fax[_0x6a7e('0x1b')]['checkAfterSend']=function(_0x132f26){var _0x17b533=this;return new BPromise(function(_0x356729,_0x54f9d4){var _0x3803a9=_0x17b533[_0x6a7e('0x5c')](_0x17b533['faxAccounts'][_0x132f26['FaxAccountId']]['Trunk'],_0x132f26);if(_0x3803a9[_0x6a7e('0x5d')]){_0x356729(ut['message'](_0x6a7e('0x5e')));}else{_0x54f9d4(ut['message'](_0x3803a9['message']));}});};function originate(_0x440352,_0xa4ecc3,_0x402f87){return new BPromise(function(_0x4d688c,_0x1123f3){if(_0x402f87){var _0x420cc0=util[_0x6a7e('0x5f')](_0x6a7e('0x60'),path[_0x6a7e('0x3a')](_0x440352['path'])['name'],_0x440352[_0x6a7e('0x3')]);gs['execute'](_0x420cc0)[_0x6a7e('0x49')](function(){_0x440352[_0x6a7e('0x3')]=util[_0x6a7e('0x5f')](_0x6a7e('0x61'),path[_0x6a7e('0x3a')](_0x440352[_0x6a7e('0x3')])['dir'],path[_0x6a7e('0x3a')](_0x440352[_0x6a7e('0x3')])['name']);_0xa4ecc3['XMF-PATH']=_0x440352[_0x6a7e('0x3')];ut[_0x6a7e('0x4a')](_0x6a7e('0x62'),'');ami[_0x6a7e('0x63')](ut[_0x6a7e('0x64')](_0x440352,_0xa4ecc3))[_0x6a7e('0x49')](function(_0x1ba6d5){_0x4d688c(_0x1ba6d5);})[_0x6a7e('0x3e')](function(_0x94ec32){_0x1123f3(_0x94ec32);});})[_0x6a7e('0x3e')](function(_0x4d7a68){_0x1123f3(_0x4d7a68);});}else{ami['Action'](ut[_0x6a7e('0x64')](_0x440352,_0xa4ecc3))['then'](function(_0x5aceb6){_0x4d688c(_0x5aceb6);})['catch'](function(_0x43bb18){_0x1123f3(_0x43bb18);});}});}Fax['prototype'][_0x6a7e('0x65')]=function(_0x5c58a4,_0x59d931){var _0x44bcfe=this;return new BPromise(function(_0x443788,_0x1dd341){var _0x4a1b26=uuid['v4']();var _0x4d4ac3=ut[_0x6a7e('0x66')](_0x5c58a4,_0x59d931);_0x44bcfe['actions'][_0x4a1b26]=new Action(_0x4a1b26,_0x59d931,_0x5c58a4);var _0x431a92=_0x44bcfe['actions'][_0x4a1b26];if(path['parse'](_0x5c58a4[_0x6a7e('0x3')])['ext']===_0x6a7e('0x3b')){originate(_0x431a92,_0x4d4ac3,!![])[_0x6a7e('0x49')](function(_0x5efb9e){_0x443788(_0x5efb9e);})[_0x6a7e('0x3e')](function(_0x4e2c24){_0x1dd341(_0x4e2c24);});}else{originate(_0x431a92,_0x4d4ac3,![])[_0x6a7e('0x49')](function(_0x1d2432){_0x443788(_0x1d2432);})['catch'](function(_0x26d044){_0x1dd341(_0x26d044);});}});};Fax[_0x6a7e('0x1b')][_0x6a7e('0x67')]=function(_0x1048cb){return!_[_0x6a7e('0x68')](_0x1048cb)&&!_[_0x6a7e('0x68')](_0x1048cb[_0x6a7e('0x22')])&&!_[_0x6a7e('0x68')](_0x1048cb[_0x6a7e('0x69')])&&_0x1048cb['active']&&!_['isNil'](this[_0x6a7e('0xf')][util[_0x6a7e('0x5f')]('SIP/%s',_0x1048cb['name'])])&&!_[_0x6a7e('0x68')](this[_0x6a7e('0xf')][util[_0x6a7e('0x5f')](_0x6a7e('0x6a'),_0x1048cb['name'])]['status'])&&(this['trunks'][util[_0x6a7e('0x5f')](_0x6a7e('0x6a'),_0x1048cb['name'])][_0x6a7e('0x2e')]===_0x6a7e('0x6b')||this[_0x6a7e('0xf')][util['format']('SIP/%s',_0x1048cb[_0x6a7e('0x22')])][_0x6a7e('0x2e')]==='unmonitored');};Fax['prototype'][_0x6a7e('0x5c')]=function(_0x3abafe,_0x11f55f){if(!this['isTrunkReachable'](_0x3abafe)){ut[_0x6a7e('0x4a')](_0x6a7e('0x6c'),_['isNil'](_0x3abafe)?'':_0x3abafe[_0x6a7e('0x22')]+_0x6a7e('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x6a7e('0x68')](_0x11f55f['fax'])){ut['logger'](_0x6a7e('0x6e'),JSON['stringify'](_0x11f55f));return{'isValid':![],'message':_0x6a7e('0x6f')};}if(_[_0x6a7e('0x68')](_0x11f55f['path'])){ut[_0x6a7e('0x4a')](_0x6a7e('0x70'),JSON[_0x6a7e('0x40')](_0x11f55f));return{'isValid':![],'message':_0x6a7e('0x71')};}return{'isValid':!![],'message':_0x6a7e('0x72')};};module[_0x6a7e('0x73')]=Fax; \ No newline at end of file +var _0x37cf=['send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','catch','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring'];(function(_0x169f51,_0x1d4cd1){var _0x1cfe54=function(_0x55e1cb){while(--_0x55e1cb){_0x169f51['push'](_0x169f51['shift']());}};_0x1cfe54(++_0x1d4cd1);}(_0x37cf,0x1f0));var _0xf37c=function(_0x192eee,_0x5c6d10){_0x192eee=_0x192eee-0x0;var _0xacfcd2=_0x37cf[_0x192eee];return _0xacfcd2;};'use strict';var util=require(_0xf37c('0x0'));var _=require(_0xf37c('0x1'));var BPromise=require('bluebird');var uuid=require(_0xf37c('0x2'));var moment=require(_0xf37c('0x3'));var path=require(_0xf37c('0x4'));var tiff2pdf=require(_0xf37c('0x5'));var gs=require(_0xf37c('0x6'));var logger=require(_0xf37c('0x7'))(_0xf37c('0x8'));var ami=require(_0xf37c('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xf37c('0xa'));var ut=require(_0xf37c('0xb'));var Action=require(_0xf37c('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xf37c('0xd'));function Fax(_0x351796){this[_0xf37c('0xe')]={};this['faxAccounts']=_0x351796[_0xf37c('0xf')];this[_0xf37c('0x10')]=_0x351796['trunks'];this[_0xf37c('0x11')]={};ami['on'](_0xf37c('0x12'),this['syncNewchannel'][_0xf37c('0x13')](this));ami['on'](_0xf37c('0x14'),this[_0xf37c('0x15')][_0xf37c('0x13')](this));ami['on'](_0xf37c('0x16'),this[_0xf37c('0x17')][_0xf37c('0x13')](this));ami['on'](_0xf37c('0x18'),this['syncNewExten'][_0xf37c('0x13')](this));ami['on'](_0xf37c('0x19'),this[_0xf37c('0x1a')][_0xf37c('0x13')](this));ami['on'](_0xf37c('0x1b'),this[_0xf37c('0x1c')][_0xf37c('0x13')](this));ami['on'](_0xf37c('0x1d'),this[_0xf37c('0x1e')]['bind'](this));ami['on'](_0xf37c('0x1f'),this['syncOriginateResponse'][_0xf37c('0x13')](this));}Fax[_0xf37c('0x20')]['syncNewchannel']=function(_0x1f7591){if(_0x1f7591[_0xf37c('0x21')]===_0xf37c('0x22')){for(var _0x1b4b45 in this[_0xf37c('0xf')]){if(this[_0xf37c('0xf')][_0xf37c('0x23')](_0x1b4b45)){if(_0x1f7591[_0xf37c('0x24')]===this[_0xf37c('0xf')][_0x1b4b45]['localstationid']){this[_0xf37c('0xe')][_0x1f7591[_0xf37c('0x25')]]={};this['channels'][_0x1f7591[_0xf37c('0x25')]][_0xf37c('0x26')]=_0x1f7591[_0xf37c('0x26')];this[_0xf37c('0xe')][_0x1f7591[_0xf37c('0x25')]]['id']=this[_0xf37c('0xf')][_0x1b4b45]['id'];this['channels'][_0x1f7591[_0xf37c('0x25')]][_0xf37c('0x27')]=this[_0xf37c('0xf')][_0x1b4b45][_0xf37c('0x27')];logger[_0xf37c('0x28')](_0x1f7591['uniqueid'],_0xf37c('0x29'));}}}}if(this['actions'][_0x1f7591[_0xf37c('0x25')]]){this[_0xf37c('0xe')][_0x1f7591[_0xf37c('0x25')]]={};this['channels'][_0x1f7591[_0xf37c('0x25')]][_0xf37c('0x26')]=_0x1f7591['channel'];logger[_0xf37c('0x28')](_0x1f7591['uniqueid'],_0xf37c('0x29'));}};Fax['prototype'][_0xf37c('0x15')]=function(_0x4b1a18){if(this[_0xf37c('0xe')][_0x4b1a18[_0xf37c('0x25')]]){for(var _0x3d1a72 in _0x4b1a18[_0xf37c('0x2a')]){if(_0x4b1a18['variable'][_0xf37c('0x23')](_0x3d1a72)){this[_0xf37c('0xe')][_0x4b1a18[_0xf37c('0x25')]][_0x3d1a72]=_0x4b1a18['value'];}}}};Fax[_0xf37c('0x20')][_0xf37c('0x17')]=function(_0x2ab974){if(this[_0xf37c('0xe')][_0x2ab974[_0xf37c('0x25')]]){this[_0xf37c('0xe')][_0x2ab974[_0xf37c('0x25')]][_0xf37c('0x2b')]=_0x2ab974[_0xf37c('0x2b')];this[_0xf37c('0xe')][_0x2ab974[_0xf37c('0x25')]][_0xf37c('0x2c')]=_0x2ab974[_0xf37c('0x2c')];}};Fax[_0xf37c('0x20')]['syncNewExten']=function(_0xdf45f){if(this[_0xf37c('0xe')][_0xdf45f['uniqueid']]){for(var _0xf32f6d in _0xdf45f[_0xf37c('0x2a')]){if(_0xdf45f['variable'][_0xf37c('0x23')](_0xf32f6d)){this[_0xf37c('0xe')][_0xdf45f[_0xf37c('0x25')]][_0xf32f6d]=_0xdf45f[_0xf37c('0x2d')];}}}};Fax[_0xf37c('0x20')]['syncFaxStatus']=function(_0x411af3){if(this[_0xf37c('0xe')][_0x411af3[_0xf37c('0x25')]]){this[_0xf37c('0xe')][_0x411af3[_0xf37c('0x25')]][_0xf37c('0x2e')]=_0x411af3['operation'];this[_0xf37c('0xe')][_0x411af3[_0xf37c('0x25')]]['status']=_0x411af3[_0xf37c('0x2f')];this['channels'][_0x411af3[_0xf37c('0x25')]][_0xf37c('0x30')]=_0x411af3['localstationid'];this[_0xf37c('0xe')][_0x411af3[_0xf37c('0x25')]][_0xf37c('0x31')]=_0x411af3[_0xf37c('0x31')];logger[_0xf37c('0x28')](_0x411af3['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0xf37c('0x20')]['syncReceiveFax']=function(_0x199e4e){var _0x27cb2b=this;if(this[_0xf37c('0xe')][_0x199e4e[_0xf37c('0x25')]]){var _0x4b848b=this['channels'][_0x199e4e['uniqueid']]['id'];this[_0xf37c('0xe')][_0x199e4e[_0xf37c('0x25')]][_0xf37c('0x32')]=_0x199e4e[_0xf37c('0x32')];this['channels'][_0x199e4e[_0xf37c('0x25')]][_0xf37c('0x33')]=_0x199e4e['pagestransferred'];this[_0xf37c('0xe')][_0x199e4e['uniqueid']]['localstationid']=_0x199e4e[_0xf37c('0x30')];this['channels'][_0x199e4e[_0xf37c('0x25')]]['resolution']=_0x199e4e[_0xf37c('0x34')];this[_0xf37c('0xe')][_0x199e4e[_0xf37c('0x25')]][_0xf37c('0x35')]=_0x199e4e[_0xf37c('0x35')];this[_0xf37c('0xe')][_0x199e4e[_0xf37c('0x25')]]['filename']=_0x199e4e[_0xf37c('0x31')];this['channels'][_0x199e4e[_0xf37c('0x25')]][_0xf37c('0x36')]=_0x199e4e[_0xf37c('0x36')];if(this[_0xf37c('0xe')][_0x199e4e[_0xf37c('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x199e4e['filename'],_0xf37c('0x37'),function(_0x3f99e6){logger[_0xf37c('0x28')](_0x199e4e['uniqueid'],_0xf37c('0x38'),_0x3f99e6[_0xf37c('0x39')]);attachment['create']({'name':path[_0xf37c('0x3a')](_0x199e4e[_0xf37c('0x31')])[_0xf37c('0x27')],'basename':path['parse'](_0x199e4e[_0xf37c('0x31')])[_0xf37c('0x27')]+_0xf37c('0x3b'),'type':'application/pdf'})[_0xf37c('0x3c')](function(_0x53806f){faxAccount['notify'](_0x4b848b,{'from':_0x199e4e[_0xf37c('0x36')],'mapKey':_0xf37c('0x8'),'body':path[_0xf37c('0x3a')](_0x199e4e[_0xf37c('0x31')])[_0xf37c('0x27')]+_0xf37c('0x3b'),'AttachmentId':_0x53806f['id']})[_0xf37c('0x3d')](function(_0x331562){logger['error'](_0x199e4e[_0xf37c('0x25')],'\x20notify\x20',JSON[_0xf37c('0x3e')](_0x331562));});})[_0xf37c('0x3d')](function(_0x40aeda){logger['error'](_0x199e4e[_0xf37c('0x25')],_0xf37c('0x3f'),JSON[_0xf37c('0x3e')](_0x40aeda));});});}logger['info'](_0x199e4e[_0xf37c('0x25')],_0xf37c('0x3f'));}};Fax['prototype'][_0xf37c('0x40')]=function(_0xf65943){if(this[_0xf37c('0x11')][_0xf65943[_0xf37c('0x25')]]){_[_0xf37c('0x41')](this[_0xf37c('0xe')][_0xf65943['uniqueid']],_[_0xf37c('0x42')](_0xf65943,['response',_0xf37c('0x43')]));}};function updateStatus(_0x42e668){if(_0x42e668[_0xf37c('0x44')]){faxMessage[_0xf37c('0x45')](_0x42e668[_0xf37c('0x44')],{'failMessage':_0xf37c('0x46')})['then'](function(_0x3bc079){ut[_0xf37c('0x47')](_0xf37c('0x48'),_0x3bc079);})['catch'](function(_0x30ddb3){ut['logger'](_0xf37c('0x49'),_0x30ddb3);});}else{ut[_0xf37c('0x47')](_0xf37c('0x4a'));}}Fax[_0xf37c('0x20')]['updateStatus']=function(_0x5b9b9f,_0x57e5ad,_0x575a4c){var _0x4ef10d=this;var _0x184d84={};if(_0x57e5ad){_0x184d84={'read':_0x57e5ad};}else{_0x184d84={'failMessage':_0x575a4c};}if(this[_0xf37c('0x11')][_0x5b9b9f][_0xf37c('0x44')]){faxMessage['update'](this[_0xf37c('0x11')][_0x5b9b9f]['AttachmentId'],_0x184d84)['then'](function(_0xf2e6dd){ut[_0xf37c('0x47')](_0xf37c('0x4b'),_0xf2e6dd);})[_0xf37c('0x3d')](function(_0x1a27db){ut[_0xf37c('0x47')](_0xf37c('0x4c'),_0x1a27db);})[_0xf37c('0x4d')](function(){delete _0x4ef10d['channels'][_0x5b9b9f];delete _0x4ef10d[_0xf37c('0x11')][_0x5b9b9f];});}else{ut[_0xf37c('0x47')](_0xf37c('0x4e'));delete this[_0xf37c('0xe')][_0x5b9b9f];delete this['actions'][_0x5b9b9f];}};Fax[_0xf37c('0x20')][_0xf37c('0x1e')]=function(_0x387839){var _0xea371f=this;if(this[_0xf37c('0xe')][_0x387839[_0xf37c('0x25')]]){if(this[_0xf37c('0x11')][_0x387839[_0xf37c('0x25')]]){this[_0xf37c('0xe')][_0x387839[_0xf37c('0x25')]]['id']=this[_0xf37c('0x11')][_0x387839['uniqueid']]['id'];this[_0xf37c('0xe')][_0x387839[_0xf37c('0x25')]][_0xf37c('0x27')]=this[_0xf37c('0x11')][_0x387839[_0xf37c('0x25')]]['name'];}logger[_0xf37c('0x28')](_0x387839[_0xf37c('0x25')],this[_0xf37c('0x11')][_0x387839['uniqueid']]?_0xf37c('0x4f'):_0xf37c('0x50'),JSON[_0xf37c('0x3e')](this['channels'][_0x387839['uniqueid']]));if(this[_0xf37c('0x11')][_0x387839['uniqueid']]){if(this['channels'][_0x387839['uniqueid']]['faxpages']>0x0&&this[_0xf37c('0xe')][_0x387839['uniqueid']][_0xf37c('0x19')]===_0xf37c('0x51')){this['updateStatus'](_0x387839[_0xf37c('0x25')],!![]);}else{this[_0xf37c('0x52')](_0x387839[_0xf37c('0x25')],![],this[_0xf37c('0xe')][_0x387839['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0xf37c('0xe')][_0x387839[_0xf37c('0x25')]][_0xf37c('0x53')]:'SENDING\x20FAILED');}}}};Fax[_0xf37c('0x20')][_0xf37c('0x54')]=function(_0x1258f9){var _0x104eaa=this;return new BPromise(function(_0x259f0c,_0xcca2e1){_0x104eaa[_0xf37c('0x55')](_0x1258f9,_0x104eaa['faxAccounts'][_0x1258f9[_0xf37c('0x56')]])[_0xf37c('0x3c')](function(_0x38aa21){ut[_0xf37c('0x47')]('[Fax][execOriginate][success]',_0x38aa21);_0x259f0c(ut[_0xf37c('0x39')]('Fax\x20received'));})[_0xf37c('0x3d')](function(_0x1f4f00){ut[_0xf37c('0x47')](_0xf37c('0x57'),_0x1f4f00);updateStatus(_0x1258f9);_0xcca2e1(ut[_0xf37c('0x39')](_0xf37c('0x58')));});});};Fax[_0xf37c('0x20')][_0xf37c('0x59')]=function(_0x5b36e0){var _0x43088c=this;return new BPromise(function(_0x1b8c9c,_0x2c2cfb){var _0x4dd372=_0x43088c[_0xf37c('0x5a')](_0x43088c[_0xf37c('0xf')][_0x5b36e0[_0xf37c('0x56')]][_0xf37c('0x5b')],_0x5b36e0);if(_0x4dd372[_0xf37c('0x5c')]){_0x1b8c9c(ut[_0xf37c('0x39')](_0xf37c('0x5d')));}else{_0x2c2cfb(ut[_0xf37c('0x39')](_0x4dd372[_0xf37c('0x39')]));}});};function originate(_0x1c2062,_0x32f504,_0x902973){return new BPromise(function(_0x508966,_0x5c9760){if(_0x902973){var _0x46c442=util[_0xf37c('0x5e')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xf37c('0x3a')](_0x1c2062[_0xf37c('0x4')])[_0xf37c('0x27')],_0x1c2062[_0xf37c('0x4')]);gs['execute'](_0x46c442)['then'](function(){_0x1c2062[_0xf37c('0x4')]=util[_0xf37c('0x5e')](_0xf37c('0x5f'),path[_0xf37c('0x3a')](_0x1c2062[_0xf37c('0x4')])[_0xf37c('0x60')],path['parse'](_0x1c2062[_0xf37c('0x4')])['name']);_0x32f504[_0xf37c('0x61')]=_0x1c2062['path'];ut[_0xf37c('0x47')](_0xf37c('0x62'),'');ami[_0xf37c('0x63')](ut[_0xf37c('0x64')](_0x1c2062,_0x32f504))[_0xf37c('0x3c')](function(_0x36b7de){_0x508966(_0x36b7de);})['catch'](function(_0x317f3a){_0x5c9760(_0x317f3a);});})['catch'](function(_0x347b3c){_0x5c9760(_0x347b3c);});}else{ami[_0xf37c('0x63')](ut[_0xf37c('0x64')](_0x1c2062,_0x32f504))[_0xf37c('0x3c')](function(_0x4d91ef){_0x508966(_0x4d91ef);})['catch'](function(_0x39576a){_0x5c9760(_0x39576a);});}});}Fax[_0xf37c('0x20')][_0xf37c('0x55')]=function(_0x14f4a2,_0x37c3de){var _0x1d57ad=this;return new BPromise(function(_0x1e9f95,_0xc9a2a2){var _0x3e4114=uuid['v4']();var _0x2a6802=ut[_0xf37c('0x65')](_0x14f4a2,_0x37c3de);_0x1d57ad['actions'][_0x3e4114]=new Action(_0x3e4114,_0x37c3de,_0x14f4a2);var _0x2fa39b=_0x1d57ad[_0xf37c('0x11')][_0x3e4114];if(path[_0xf37c('0x3a')](_0x14f4a2[_0xf37c('0x4')])['ext']===_0xf37c('0x3b')){originate(_0x2fa39b,_0x2a6802,!![])[_0xf37c('0x3c')](function(_0x460fe2){_0x1e9f95(_0x460fe2);})[_0xf37c('0x3d')](function(_0x5cdf9e){_0xc9a2a2(_0x5cdf9e);});}else{originate(_0x2fa39b,_0x2a6802,![])[_0xf37c('0x3c')](function(_0x4dcdc9){_0x1e9f95(_0x4dcdc9);})[_0xf37c('0x3d')](function(_0x14829c){_0xc9a2a2(_0x14829c);});}});};Fax[_0xf37c('0x20')][_0xf37c('0x66')]=function(_0x5dd08e){return!_[_0xf37c('0x67')](_0x5dd08e)&&!_['isNil'](_0x5dd08e['name'])&&!_[_0xf37c('0x67')](_0x5dd08e['active'])&&_0x5dd08e[_0xf37c('0x68')]&&!_[_0xf37c('0x67')](this[_0xf37c('0x10')][util[_0xf37c('0x5e')](_0xf37c('0x69'),_0x5dd08e[_0xf37c('0x27')])])&&!_[_0xf37c('0x67')](this[_0xf37c('0x10')][util[_0xf37c('0x5e')](_0xf37c('0x69'),_0x5dd08e[_0xf37c('0x27')])][_0xf37c('0x2f')])&&(this[_0xf37c('0x10')][util[_0xf37c('0x5e')](_0xf37c('0x69'),_0x5dd08e[_0xf37c('0x27')])][_0xf37c('0x2f')]===_0xf37c('0x6a')||this[_0xf37c('0x10')][util['format']('SIP/%s',_0x5dd08e['name'])][_0xf37c('0x2f')]===_0xf37c('0x6b'));};Fax['prototype'][_0xf37c('0x5a')]=function(_0x3204cb,_0x4c0935){if(!this[_0xf37c('0x66')](_0x3204cb)){ut['logger'](_0xf37c('0x6c'),_[_0xf37c('0x67')](_0x3204cb)?'':_0x3204cb[_0xf37c('0x27')]+_0xf37c('0x6d'));return{'isValid':![],'message':_0xf37c('0x6e')};}if(_['isNil'](_0x4c0935[_0xf37c('0x8')])){ut[_0xf37c('0x47')](_0xf37c('0x6f'),JSON['stringify'](_0x4c0935));return{'isValid':![],'message':_0xf37c('0x70')};}if(_[_0xf37c('0x67')](_0x4c0935[_0xf37c('0x4')])){ut[_0xf37c('0x47')](_0xf37c('0x71'),JSON['stringify'](_0x4c0935));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xf37c('0x72')};};module[_0xf37c('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 9ce4318..d62c824 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 _0x9588=['inspect','notify','resolve','then','catch','[Notify]\x20','util','preview','../rpc/faxAccount','error'];(function(_0x24b33c,_0x33cb97){var _0x33becf=function(_0x4d8a9c){while(--_0x4d8a9c){_0x24b33c['push'](_0x24b33c['shift']());}};_0x33becf(++_0x33cb97);}(_0x9588,0xc4));var _0x8958=function(_0x3f4a93,_0x202f25){_0x3f4a93=_0x3f4a93-0x0;var _0x182847=_0x9588[_0x3f4a93];return _0x182847;};'use strict';var util=require(_0x8958('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x8958('0x1'));var _=require('lodash');var faxAccount=require(_0x8958('0x2'));function loggerCatch(_0xfa7199){return function(_0x2bf8c8){logger[_0x8958('0x3')](_0xfa7199,util[_0x8958('0x4')](_0x2bf8c8,{'showHidden':![],'depth':null}));};}exports[_0x8958('0x5')]=function(_0x5bb81d,_0x45e022){return BPromise[_0x8958('0x6')]()[_0x8958('0x7')](faxAccount[_0x8958('0x5')](_0x5bb81d,_0x45e022))[_0x8958('0x8')](loggerCatch(_0x8958('0x9')));}; \ No newline at end of file +var _0xff2d=['resolve','then','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','inspect'];(function(_0x38ecda,_0x3b551e){var _0x3fa8f3=function(_0x4e196c){while(--_0x4e196c){_0x38ecda['push'](_0x38ecda['shift']());}};_0x3fa8f3(++_0x3b551e);}(_0xff2d,0x1a9));var _0xdff2=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xff2d[_0x4b2436];return _0x4f5ab2;};'use strict';var util=require(_0xdff2('0x0'));var BPromise=require(_0xdff2('0x1'));var logger=require(_0xdff2('0x2'))(_0xdff2('0x3'));var _=require(_0xdff2('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x3b09a9){return function(_0x1089d0){logger[_0xdff2('0x5')](_0x3b09a9,util[_0xdff2('0x6')](_0x1089d0,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x31963d,_0x25d26e){return BPromise[_0xdff2('0x7')]()[_0xdff2('0x8')](faxAccount[_0xdff2('0x9')](_0x31963d,_0x25d26e))[_0xdff2('0xa')](loggerCatch(_0xdff2('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index ba47f4f..48fd227 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 _0xc23e=['../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x375f52,_0x44deef){var _0x483be6=function(_0x3991e6){while(--_0x3991e6){_0x375f52['push'](_0x375f52['shift']());}};_0x483be6(++_0x44deef);}(_0xc23e,0xbd));var _0xec23=function(_0x4536cd,_0x3064c7){_0x4536cd=_0x4536cd-0x0;var _0x3ab9f8=_0xc23e[_0x4536cd];return _0x3ab9f8;};'use strict';var util=require('util');var logger=require(_0xec23('0x0'))(_0xec23('0x1'));var BPromise=require(_0xec23('0x2'));var exec=require('child_process')[_0xec23('0x3')];exports[_0xec23('0x4')]=function(_0xe25dd7){return new BPromise(function(_0x1accba,_0x4194c3){exec(_0xe25dd7,function(_0x4fcb24,_0x1cf930,_0x513a96){logger['info']('Exec\x20gs',_0x1cf930);if(_0x4fcb24){logger[_0xec23('0x5')](_0xec23('0x6'),_0xec23('0x7'),util[_0xec23('0x8')](_0x4fcb24,{'showHidden':![],'depth':null}),_0x1cf930,_0x513a96);_0x4194c3(_0x4fcb24);}_0x1accba(_0x1cf930);});});}; \ No newline at end of file +var _0x2dab=['inspect','../../../../config/logger','fax','bluebird','child_process','execute','Exec\x20gs','info','\x20Error\x20:'];(function(_0x70504d,_0x34e810){var _0x47e29b=function(_0x119dfe){while(--_0x119dfe){_0x70504d['push'](_0x70504d['shift']());}};_0x47e29b(++_0x34e810);}(_0x2dab,0x1b1));var _0xb2da=function(_0x23828f,_0x11d022){_0x23828f=_0x23828f-0x0;var _0x543a34=_0x2dab[_0x23828f];return _0x543a34;};'use strict';var util=require('util');var logger=require(_0xb2da('0x0'))(_0xb2da('0x1'));var BPromise=require(_0xb2da('0x2'));var exec=require(_0xb2da('0x3'))['exec'];exports[_0xb2da('0x4')]=function(_0x1dce47){return new BPromise(function(_0x1389ab,_0x919051){exec(_0x1dce47,function(_0x1fe4c3,_0xe6e27f,_0x29b90c){logger['info'](_0xb2da('0x5'),_0xe6e27f);if(_0x1fe4c3){logger[_0xb2da('0x6')]('Exec\x20gs',_0xb2da('0x7'),util[_0xb2da('0x8')](_0x1fe4c3,{'showHidden':![],'depth':null}),_0xe6e27f,_0x29b90c);_0x919051(_0x1fe4c3);}_0x1389ab(_0xe6e27f);});});}; \ 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 d02c8c9..60ac6a9 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 _0x04b8=['variablesAction','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','fax','logger','info','inspect','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x04b8,0x159));var _0x804b=function(_0x398277,_0x286034){_0x398277=_0x398277-0x0;var _0xd99f9f=_0x04b8[_0x398277];return _0xd99f9f;};'use strict';var util=require('util');var _=require(_0x804b('0x0'));var moment=require('moment');var logger=require(_0x804b('0x1'))(_0x804b('0x2'));exports['message']=function(_0x1a52ec){return{'message':_0x1a52ec};};exports[_0x804b('0x3')]=function(_0x5857dc,_0x3530f6){logger[_0x804b('0x4')](_0x5857dc,util[_0x804b('0x5')](_0x3530f6,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2c22e3,_0x3c5404){var _0x476262={'XMF-ECM':_0x3c5404['ecm'],'XMF-HEADERINFO':_0x3c5404[_0x804b('0x6')],'XMF-MINRATE':_0x3c5404[_0x804b('0x7')],'XMF-MAXRATE':_0x3c5404['maxrate'],'XMF-MODEM':util[_0x804b('0x8')](_0x804b('0x9'),_0x3c5404[_0x804b('0xa')]),'XMF-GATEWAY':_0x3c5404[_0x804b('0xb')],'XMF-FAXDETECT':_0x3c5404[_0x804b('0xc')],'XMF-T38TIMEOUT':_0x3c5404['t38timeout'],'XMF-LOCALSTATIONID':_0x3c5404[_0x804b('0xd')],'XMF-PATH':_0x2c22e3[_0x804b('0xe')]};return _0x476262;};exports[_0x804b('0xf')]=function(_0x7029e7,_0x2d13ba){return{'actionid':_0x7029e7[_0x804b('0x10')],'action':'originate','channel':_0x7029e7[_0x804b('0x11')],'Exten':'xcally-motion-fax','Context':_0x804b('0x12'),'Priority':'1','callerid':util[_0x804b('0x8')](_0x804b('0x13'),_0x7029e7[_0x804b('0x6')]?_0x7029e7['headerinfo']:'',_0x7029e7[_0x804b('0xd')]),'variable':_0x2d13ba,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x7029e7[_0x804b('0x10')]};}; \ No newline at end of file +var _0x34e5=['logger','info','inspect','addVariables','headerinfo','minrate','maxrate','modem','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','format','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','fax','message'];(function(_0x54349c,_0x5252d0){var _0x50fea9=function(_0x3fefa0){while(--_0x3fefa0){_0x54349c['push'](_0x54349c['shift']());}};_0x50fea9(++_0x5252d0);}(_0x34e5,0x172));var _0x534e=function(_0x2c5b4f,_0x4c1d02){_0x2c5b4f=_0x2c5b4f-0x0;var _0x56cbcb=_0x34e5[_0x2c5b4f];return _0x56cbcb;};'use strict';var util=require('util');var _=require(_0x534e('0x0'));var moment=require('moment');var logger=require(_0x534e('0x1'))(_0x534e('0x2'));exports[_0x534e('0x3')]=function(_0x246650){return{'message':_0x246650};};exports[_0x534e('0x4')]=function(_0x50b790,_0x11a158){logger[_0x534e('0x5')](_0x50b790,util[_0x534e('0x6')](_0x11a158,{'showHidden':![],'depth':null}));};exports[_0x534e('0x7')]=function(_0x436a92,_0x2d0370){var _0x2760e7={'XMF-ECM':_0x2d0370['ecm'],'XMF-HEADERINFO':_0x2d0370[_0x534e('0x8')],'XMF-MINRATE':_0x2d0370[_0x534e('0x9')],'XMF-MAXRATE':_0x2d0370[_0x534e('0xa')],'XMF-MODEM':util['format']('\x22%s\x22',_0x2d0370[_0x534e('0xb')]),'XMF-GATEWAY':_0x2d0370['gateway'],'XMF-FAXDETECT':_0x2d0370[_0x534e('0xc')],'XMF-T38TIMEOUT':_0x2d0370['t38timeout'],'XMF-LOCALSTATIONID':_0x2d0370[_0x534e('0xd')],'XMF-PATH':_0x436a92[_0x534e('0xe')]};return _0x2760e7;};exports[_0x534e('0xf')]=function(_0x529726,_0x1b7a5a){return{'actionid':_0x529726[_0x534e('0x10')],'action':_0x534e('0x11'),'channel':_0x529726[_0x534e('0x12')],'Exten':_0x534e('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x534e('0x14')](_0x534e('0x15'),_0x529726[_0x534e('0x8')]?_0x529726[_0x534e('0x8')]:'',_0x529726[_0x534e('0xd')]),'variable':_0x1b7a5a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x529726[_0x534e('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 142555b..ec73914 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 _0x1b94=['initFaxAccounts','resolve','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','log','bluebird','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0x3860d2,_0x4931fc){var _0x48c1df=function(_0x3fea2c){while(--_0x3fea2c){_0x3860d2['push'](_0x3860d2['shift']());}};_0x48c1df(++_0x4931fc);}(_0x1b94,0x169));var _0x41b9=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x1b94[_0x476bf4];return _0x788ffe;};'use strict';var BPromise=require(_0x41b9('0x0'));var util=require(_0x41b9('0x1'));var moment=require('moment');var server=require(_0x41b9('0x2'));var Realtime=require(_0x41b9('0x3'));var Report=require(_0x41b9('0x4'));var Acw=require(_0x41b9('0x5'));var Trigger=require(_0x41b9('0x6'));var Dialer=require(_0x41b9('0x7'));var Preview=require(_0x41b9('0x8'));var Fax=require('./fax');var user=require(_0x41b9('0x9'));var voiceQueue=require(_0x41b9('0xa'));var voiceQueueReport=require(_0x41b9('0xb'));var voiceCallReport=require(_0x41b9('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0x41b9('0xd'));var template=require(_0x41b9('0xe'));var cmHopperHistory=require(_0x41b9('0xf'));var campaign=require(_0x41b9('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x41b9('0x11'));var zendesk=require(_0x41b9('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x41b9('0x13'));var freshdesk=require(_0x41b9('0x14'));var desk=require(_0x41b9('0x15'));var zoho=require(_0x41b9('0x16'));var vtiger=require(_0x41b9('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x41b9('0x18'));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()[_0x41b9('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x41b9('0x19')](_0x41b9('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x41b9('0x1b')](user[_0x41b9('0x1c')]())['then'](realtime[_0x41b9('0x1d')]())[_0x41b9('0x1b')](user[_0x41b9('0x1e')]())['then'](realtime[_0x41b9('0x1f')]())[_0x41b9('0x1b')](trunk['getTrunks']())[_0x41b9('0x1b')](realtime[_0x41b9('0x20')]())['then'](voiceQueue[_0x41b9('0x21')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x22')]())['then'](trigger[_0x41b9('0x23')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x24')]())['then'](template[_0x41b9('0x25')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x26')]())[_0x41b9('0x1b')](zendesk[_0x41b9('0x27')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x28')]())[_0x41b9('0x1b')](salesforce[_0x41b9('0x29')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x2a')]())[_0x41b9('0x1b')](sugarcrm[_0x41b9('0x2b')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x2c')]())[_0x41b9('0x1b')](freshdesk[_0x41b9('0x2d')]())[_0x41b9('0x1b')](realtime['initFreshdeskAccounts']())[_0x41b9('0x1b')](desk[_0x41b9('0x2e')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x2f')]())[_0x41b9('0x1b')](zoho['getZohoAccounts']())[_0x41b9('0x1b')](realtime[_0x41b9('0x30')]())[_0x41b9('0x1b')](vtiger[_0x41b9('0x31')]())['then'](realtime[_0x41b9('0x32')]())[_0x41b9('0x1b')](freshsales[_0x41b9('0x33')]())['then'](realtime[_0x41b9('0x34')]())[_0x41b9('0x1b')](servicenow['getServicenowAccounts']())['then'](realtime[_0x41b9('0x35')]())['then'](dynamics365[_0x41b9('0x36')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x37')]())[_0x41b9('0x1b')](campaign['getCampaigns']())[_0x41b9('0x1b')](realtime[_0x41b9('0x38')]())[_0x41b9('0x1b')](voiceExtension[_0x41b9('0x39')]())['then'](realtime[_0x41b9('0x3a')]())['then'](faxAccount['getFaxAccounts']())[_0x41b9('0x1b')](realtime[_0x41b9('0x3b')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x41b9('0x3c')]()[_0x41b9('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0x41b9('0x1b')](realtime[_0x41b9('0x3d')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x41b9('0x1b')](realtime['initVoiceQueueHopperHistory']())[_0x41b9('0x1b')](cmHopperHistory[_0x41b9('0x3e')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x3f')]())['then'](voiceCallReport[_0x41b9('0x40')]())[_0x41b9('0x1b')](realtime[_0x41b9('0x41')]())[_0x41b9('0x1b')](function(_0x29a9bb){})[_0x41b9('0x42')](function(_0x1b2148){console['log'](_0x1b2148);});}function main(){return server[_0x41b9('0x43')](realtime,preview,fax)[_0x41b9('0x1b')](function(_0x25055b){return initRealtime();})[_0x41b9('0x1b')](function(){return initParams();})[_0x41b9('0x1b')](function(){report[_0x41b9('0x44')]();setInterval(initRealtime,0x1388);})[_0x41b9('0x42')](function(_0x5ca5fa){console[_0x41b9('0x45')](_0x5ca5fa);});}main(); \ No newline at end of file +var _0x03d0=['getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','get','hour','getAgents','then','getTelephones','initTelephones'];(function(_0x4456de,_0x1c23f9){var _0x17e180=function(_0xa404ad){while(--_0xa404ad){_0x4456de['push'](_0x4456de['shift']());}};_0x17e180(++_0x1c23f9);}(_0x03d0,0x1bd));var _0x003d=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x03d0[_0x13ea00];return _0x1f7347;};'use strict';var BPromise=require(_0x003d('0x0'));var util=require('util');var moment=require(_0x003d('0x1'));var server=require(_0x003d('0x2'));var Realtime=require(_0x003d('0x3'));var Report=require(_0x003d('0x4'));var Acw=require(_0x003d('0x5'));var Trigger=require(_0x003d('0x6'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x003d('0x7'));var user=require(_0x003d('0x8'));var voiceQueue=require(_0x003d('0x9'));var voiceQueueReport=require(_0x003d('0xa'));var voiceCallReport=require(_0x003d('0xb'));var trunk=require(_0x003d('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x003d('0xd'));var cmHopperHistory=require(_0x003d('0xe'));var campaign=require(_0x003d('0xf'));var voiceExtension=require(_0x003d('0x10'));var faxAccount=require(_0x003d('0x11'));var zendesk=require(_0x003d('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x003d('0x13'));var freshdesk=require(_0x003d('0x14'));var desk=require(_0x003d('0x15'));var zoho=require(_0x003d('0x16'));var vtiger=require(_0x003d('0x17'));var freshsales=require(_0x003d('0x18'));var servicenow=require('./rpc/integrations/servicenow');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()[_0x003d('0x19')](_0x003d('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x003d('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0x003d('0x1b')]())['then'](realtime['initAgents']())[_0x003d('0x1c')](user[_0x003d('0x1d')]())[_0x003d('0x1c')](realtime[_0x003d('0x1e')]())[_0x003d('0x1c')](trunk[_0x003d('0x1f')]())['then'](realtime[_0x003d('0x20')]())[_0x003d('0x1c')](voiceQueue['getVoiceQueues']())[_0x003d('0x1c')](realtime[_0x003d('0x21')]())[_0x003d('0x1c')](trigger[_0x003d('0x22')]())['then'](realtime[_0x003d('0x23')]())['then'](template['getTemplates']())['then'](realtime['initTemplates']())[_0x003d('0x1c')](zendesk[_0x003d('0x24')]())[_0x003d('0x1c')](realtime[_0x003d('0x25')]())[_0x003d('0x1c')](salesforce[_0x003d('0x26')]())[_0x003d('0x1c')](realtime[_0x003d('0x27')]())[_0x003d('0x1c')](sugarcrm[_0x003d('0x28')]())[_0x003d('0x1c')](realtime[_0x003d('0x29')]())[_0x003d('0x1c')](freshdesk[_0x003d('0x2a')]())[_0x003d('0x1c')](realtime[_0x003d('0x2b')]())[_0x003d('0x1c')](desk['getDeskAccounts']())[_0x003d('0x1c')](realtime[_0x003d('0x2c')]())[_0x003d('0x1c')](zoho[_0x003d('0x2d')]())[_0x003d('0x1c')](realtime[_0x003d('0x2e')]())['then'](vtiger[_0x003d('0x2f')]())[_0x003d('0x1c')](realtime[_0x003d('0x30')]())['then'](freshsales[_0x003d('0x31')]())['then'](realtime[_0x003d('0x32')]())[_0x003d('0x1c')](servicenow['getServicenowAccounts']())[_0x003d('0x1c')](realtime[_0x003d('0x33')]())[_0x003d('0x1c')](dynamics365[_0x003d('0x34')]())['then'](realtime[_0x003d('0x35')]())[_0x003d('0x1c')](campaign[_0x003d('0x36')]())[_0x003d('0x1c')](realtime[_0x003d('0x37')]())['then'](voiceExtension[_0x003d('0x38')]())[_0x003d('0x1c')](realtime['initVoiceExtensions']())[_0x003d('0x1c')](faxAccount[_0x003d('0x39')]())[_0x003d('0x1c')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x003d('0x3a')]()['then'](voiceQueueReport[_0x003d('0x3b')]())[_0x003d('0x1c')](realtime['initVoiceQueueReports']())[_0x003d('0x1c')](cmHopperHistory[_0x003d('0x3c')]())[_0x003d('0x1c')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x003d('0x3d')]())['then'](realtime['initCampaignHopperHistory']())[_0x003d('0x1c')](voiceCallReport[_0x003d('0x3e')]())['then'](realtime[_0x003d('0x3f')]())[_0x003d('0x1c')](function(_0x561790){})[_0x003d('0x40')](function(_0x554b98){console[_0x003d('0x41')](_0x554b98);});}function main(){return server[_0x003d('0x42')](realtime,preview,fax)['then'](function(_0x20201f){return initRealtime();})[_0x003d('0x1c')](function(){return initParams();})['then'](function(){report[_0x003d('0x43')]();setInterval(initRealtime,0x1388);})[_0x003d('0x40')](function(_0x3dabb9){console[_0x003d('0x41')](_0x3dabb9);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 7051f65..cbf5709 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 _0x2eb9=['stateTime','status','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','address','voiceStatusQueue','stringify','emit','exports','util','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown'];(function(_0x42b6da,_0x83945d){var _0x4eb021=function(_0x211bec){while(--_0x211bec){_0x42b6da['push'](_0x42b6da['shift']());}};_0x4eb021(++_0x83945d);}(_0x2eb9,0x8f));var _0x92eb=function(_0x5a5ac5,_0x501a95){_0x5a5ac5=_0x5a5ac5-0x0;var _0x534d8c=_0x2eb9[_0x5a5ac5];return _0x534d8c;};'use strict';var _=require('lodash');var util=require(_0x92eb('0x0'));var moment=require(_0x92eb('0x1'));var md5=require(_0x92eb('0x2'));var Redis=require(_0x92eb('0x3'));var config=require(_0x92eb('0x4'));config[_0x92eb('0x5')]=_['defaults'](config[_0x92eb('0x5')],{'host':_0x92eb('0x6'),'port':0x18eb});var io=require(_0x92eb('0x7'))(new Redis(config['redis']));function Agent(_0x1d733c){this['id']=_0x1d733c['id']||0x0;this[_0x92eb('0x8')]=_0x1d733c[_0x92eb('0x8')]||'';this[_0x92eb('0x9')]=_0x1d733c[_0x92eb('0x9')]||'';this[_0x92eb('0xa')]=_0x1d733c[_0x92eb('0xa')]||'';this[_0x92eb('0xb')]=_0x1d733c[_0x92eb('0xb')]||'';this['state']=_0x92eb('0xc');this[_0x92eb('0xd')]=0x0;this[_0x92eb('0xe')]=_0x92eb('0xc');this['address']='';this[_0x92eb('0xf')]='';this[_0x92eb('0x10')]='';this[_0x92eb('0x11')]='';this[_0x92eb('0x12')]=_0x1d733c[_0x92eb('0x12')]||![];this[_0x92eb('0x13')]=_0x92eb('0xc');this[_0x92eb('0x14')]=0x0;this[_0x92eb('0x15')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x92eb('0x16')]=![];this[_0x92eb('0x2')]='';}Agent[_0x92eb('0x17')][_0x92eb('0x18')]=function(_0x4de8c9){var _0x2e64d4;if(_0x4de8c9&&_0x4de8c9[_0x92eb('0x19')]){_0x2e64d4=_0x4de8c9[_0x92eb('0x19')][_0x92eb('0x1a')]();switch(_0x2e64d4){case _0x92eb('0x1b'):_0x2e64d4=_0x92eb('0x1c');break;case _0x92eb('0x1d'):_0x2e64d4=_0x92eb('0x1e');break;}}if(_0x2e64d4&&this[_0x92eb('0x13')]!==_0x2e64d4||_0x4de8c9[_0x92eb('0x1f')]){this[_0x92eb('0x14')]=_[_0x92eb('0x20')](moment()[_0x92eb('0x21')]('x'));}if(_0x2e64d4){this[_0x92eb('0x13')]=_0x2e64d4;}var _0x453c2d={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x92eb('0xb')],'state':this[_0x92eb('0x19')],'stateTime':this[_0x92eb('0xd')],'status':this[_0x92eb('0xe')],'address':this[_0x92eb('0x22')],'online':this['online'],'voiceStatus':this[_0x92eb('0x13')],'voiceStatusTime':this[_0x92eb('0x14')],'voiceStatusCallerIdNumber':this[_0x92eb('0x15')],'voiceStatusQueue':this[_0x92eb('0x23')],'interface':this['interface'],'onhold':this['onhold']};var _0xda511f=md5(JSON[_0x92eb('0x24')](_0x453c2d));if(this[_0x92eb('0x2')]!==_0xda511f){this[_0x92eb('0x2')]=_0xda511f;io['to'](util[_0x92eb('0x21')]('user:%s',_0x453c2d[_0x92eb('0x8')]))[_0x92eb('0x25')]('user:save',_0x453c2d);}};module[_0x92eb('0x26')]=Agent; \ No newline at end of file +var _0x76ad=['onhold','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','format','interface','user:%s','lodash','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x76ad,0x1bd));var _0xd76a=function(_0x33e48a,_0x33be28){_0x33e48a=_0x33e48a-0x0;var _0x219368=_0x76ad[_0x33e48a];return _0x219368;};'use strict';var _=require(_0xd76a('0x0'));var util=require('util');var moment=require(_0xd76a('0x1'));var md5=require('md5');var Redis=require(_0xd76a('0x2'));var config=require(_0xd76a('0x3'));config[_0xd76a('0x4')]=_[_0xd76a('0x5')](config[_0xd76a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd76a('0x6'))(new Redis(config['redis']));function Agent(_0x2f93c0){this['id']=_0x2f93c0['id']||0x0;this[_0xd76a('0x7')]=_0x2f93c0['name']||'';this[_0xd76a('0x8')]=_0x2f93c0[_0xd76a('0x8')]||'';this[_0xd76a('0x9')]=_0x2f93c0['accountcode']||'';this[_0xd76a('0xa')]=_0x2f93c0[_0xd76a('0xa')]||'';this[_0xd76a('0xb')]=_0xd76a('0xc');this[_0xd76a('0xd')]=0x0;this[_0xd76a('0xe')]=_0xd76a('0xc');this[_0xd76a('0xf')]='';this[_0xd76a('0x10')]='';this[_0xd76a('0x11')]='';this['interface']='';this[_0xd76a('0x12')]=_0x2f93c0[_0xd76a('0x12')]||![];this[_0xd76a('0x13')]=_0xd76a('0xc');this[_0xd76a('0x14')]=0x0;this[_0xd76a('0x15')]='';this[_0xd76a('0x16')]='';this[_0xd76a('0x17')]=![];this['local']=![];this[_0xd76a('0x18')]='';}Agent[_0xd76a('0x19')][_0xd76a('0x1a')]=function(_0x5ea5ea){var _0x5c8e72;if(_0x5ea5ea&&_0x5ea5ea['state']){_0x5c8e72=_0x5ea5ea[_0xd76a('0xb')][_0xd76a('0x1b')]();switch(_0x5c8e72){case _0xd76a('0x1c'):_0x5c8e72=_0xd76a('0x1d');break;case _0xd76a('0x1e'):_0x5c8e72=_0xd76a('0x1f');break;}}if(_0x5c8e72&&this[_0xd76a('0x13')]!==_0x5c8e72||_0x5ea5ea[_0xd76a('0x20')]){this[_0xd76a('0x14')]=_['toNumber'](moment()[_0xd76a('0x21')]('x'));}if(_0x5c8e72){this[_0xd76a('0x13')]=_0x5c8e72;}var _0x565ef7={'id':this['id'],'name':this[_0xd76a('0x7')],'email':this[_0xd76a('0x8')],'accountcode':this[_0xd76a('0x9')],'fullname':this[_0xd76a('0xa')],'state':this[_0xd76a('0xb')],'stateTime':this[_0xd76a('0xd')],'status':this[_0xd76a('0xe')],'address':this[_0xd76a('0xf')],'online':this[_0xd76a('0x12')],'voiceStatus':this[_0xd76a('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xd76a('0x22')],'onhold':this['onhold']};var _0x4b6d37=md5(JSON['stringify'](_0x565ef7));if(this['md5']!==_0x4b6d37){this[_0xd76a('0x18')]=_0x4b6d37;io['to'](util[_0xd76a('0x21')](_0xd76a('0x23'),_0x565ef7[_0xd76a('0x7')]))['emit']('user:save',_0x565ef7);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 73dfa06..64884b5 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 _0x2b39=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x5fc04b,_0x4e9503){var _0x3d5e75=function(_0x1daf4a){while(--_0x1daf4a){_0x5fc04b['push'](_0x5fc04b['shift']());}};_0x3d5e75(++_0x4e9503);}(_0x2b39,0x11c));var _0x92b3=function(_0x1b281b,_0x369210){_0x1b281b=_0x1b281b-0x0;var _0x59aa59=_0x2b39[_0x1b281b];return _0x59aa59;};'use strict';function Campaign(_0x316335){this['id']=_0x316335['id']||0x0;this[_0x92b3('0x0')]=_0x316335[_0x92b3('0x0')]||'';this[_0x92b3('0x1')]=_0x316335[_0x92b3('0x1')]||'campaign';this[_0x92b3('0x2')]=0x0;this[_0x92b3('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x92b3('0x4')]=0x0;this[_0x92b3('0x5')]='';this[_0x92b3('0x6')]=!![];this[_0x92b3('0x7')]=_0x316335[_0x92b3('0x7')];this[_0x92b3('0x8')]=_0x316335[_0x92b3('0x8')];this[_0x92b3('0x9')]=_0x316335[_0x92b3('0x9')]||null;this[_0x92b3('0xa')]=_0x316335['dialGlobalInterval']?_0x316335[_0x92b3('0xa')]:null;this[_0x92b3('0xb')]=_0x316335[_0x92b3('0xb')];this[_0x92b3('0xc')]=_0x316335[_0x92b3('0xc')];this[_0x92b3('0xd')]=_0x316335[_0x92b3('0xd')]||0x1e;this[_0x92b3('0xe')]=_0x316335[_0x92b3('0xe')];this[_0x92b3('0xf')]=_0x316335[_0x92b3('0xf')];this[_0x92b3('0x10')]=_0x316335['dialBusyMaxRetry'];this[_0x92b3('0x11')]=_0x316335[_0x92b3('0x11')];this[_0x92b3('0x12')]=_0x316335['dialNoAnswerMaxRetry'];this[_0x92b3('0x13')]=_0x316335[_0x92b3('0x13')];this[_0x92b3('0x14')]=_0x316335[_0x92b3('0x14')];this[_0x92b3('0x15')]=_0x316335[_0x92b3('0x15')]||0x3;this[_0x92b3('0x16')]=_0x316335['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x316335[_0x92b3('0x17')]||0x3;this[_0x92b3('0x18')]=_0x316335['dialDropRetryFrequency']||0x96;this[_0x92b3('0x19')]=_0x316335[_0x92b3('0x19')]||0x3;this[_0x92b3('0x1a')]=_0x316335[_0x92b3('0x1a')]||0x96;this[_0x92b3('0x1b')]=_0x316335[_0x92b3('0x1b')]||0x3;this[_0x92b3('0x1c')]=_0x316335[_0x92b3('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x316335[_0x92b3('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x316335[_0x92b3('0x1e')]||0x96;this[_0x92b3('0x1f')]=_0x316335[_0x92b3('0x1f')]||_0x92b3('0x20');this[_0x92b3('0x21')]=_0x316335[_0x92b3('0x21')]||undefined;this[_0x92b3('0x22')]=_0x316335[_0x92b3('0x22')]||undefined;this[_0x92b3('0x23')]=_0x316335[_0x92b3('0x23')]||undefined;this['TrunkBackup']=_0x316335[_0x92b3('0x24')]?_0x316335['TrunkBackup']:undefined;this['Trunk']=_0x316335['Trunk']?_0x316335[_0x92b3('0x25')]:undefined;this[_0x92b3('0x26')]=_0x316335[_0x92b3('0x26')]?_0x316335[_0x92b3('0x26')]:undefined;this[_0x92b3('0x27')]=_0x316335[_0x92b3('0x27')]?_0x316335['SquareProject']:undefined;this['dialQueueProject']=_0x316335['SquareProject']?_0x316335[_0x92b3('0x27')][_0x92b3('0x0')]:undefined;this[_0x92b3('0x28')]=_0x316335['dialAMDActive']||![];this[_0x92b3('0x29')]=_0x316335[_0x92b3('0x29')];this[_0x92b3('0x2a')]=_0x316335['dialAMDGreeting'];this[_0x92b3('0x2b')]=_0x316335[_0x92b3('0x2b')];this[_0x92b3('0x2c')]=_0x316335[_0x92b3('0x2c')];this[_0x92b3('0x2d')]=_0x316335[_0x92b3('0x2d')];this[_0x92b3('0x2e')]=_0x316335[_0x92b3('0x2e')];this[_0x92b3('0x2f')]=_0x316335[_0x92b3('0x2f')];this[_0x92b3('0x30')]=_0x316335[_0x92b3('0x30')];this[_0x92b3('0x31')]=_0x316335[_0x92b3('0x31')];}module[_0x92b3('0x32')]=Campaign; \ No newline at end of file +var _0x672d=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','temp','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x372528,_0x5dfd79){var _0x133add=function(_0x5b7b62){while(--_0x5b7b62){_0x372528['push'](_0x372528['shift']());}};_0x133add(++_0x5dfd79);}(_0x672d,0x191));var _0xd672=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x672d[_0x565ed7];return _0x183ad7;};'use strict';function Campaign(_0x37a394){this['id']=_0x37a394['id']||0x0;this[_0xd672('0x0')]=_0x37a394[_0xd672('0x0')]||'';this[_0xd672('0x1')]=_0x37a394[_0xd672('0x1')]||'campaign';this[_0xd672('0x2')]=0x0;this[_0xd672('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xd672('0x4')]=0x0;this['message']='';this[_0xd672('0x5')]=!![];this['active']=_0x37a394[_0xd672('0x6')];this['limitCalls']=_0x37a394[_0xd672('0x7')];this['dialTimezone']=_0x37a394['dialTimezone']||null;this[_0xd672('0x8')]=_0x37a394[_0xd672('0x8')]?_0x37a394[_0xd672('0x8')]:null;this['dialOriginateCallerIdName']=_0x37a394['dialOriginateCallerIdName'];this[_0xd672('0x9')]=_0x37a394[_0xd672('0x9')];this[_0xd672('0xa')]=_0x37a394[_0xd672('0xa')]||0x1e;this[_0xd672('0xb')]=_0x37a394[_0xd672('0xb')];this[_0xd672('0xc')]=_0x37a394['dialCongestionRetryFrequency'];this[_0xd672('0xd')]=_0x37a394[_0xd672('0xd')];this['dialBusyRetryFrequency']=_0x37a394[_0xd672('0xe')];this[_0xd672('0xf')]=_0x37a394[_0xd672('0xf')];this[_0xd672('0x10')]=_0x37a394[_0xd672('0x10')];this['dialGlobalMaxRetry']=_0x37a394[_0xd672('0x11')];this['dialNoSuchNumberMaxRetry']=_0x37a394['dialNoSuchNumberMaxRetry']||0x3;this[_0xd672('0x12')]=_0x37a394[_0xd672('0x12')]||0x96;this[_0xd672('0x13')]=_0x37a394[_0xd672('0x13')]||0x3;this['dialDropRetryFrequency']=_0x37a394[_0xd672('0x14')]||0x96;this['dialAbandonedMaxRetry']=_0x37a394[_0xd672('0x15')]||0x3;this[_0xd672('0x16')]=_0x37a394[_0xd672('0x16')]||0x96;this[_0xd672('0x17')]=_0x37a394[_0xd672('0x17')]||0x3;this[_0xd672('0x18')]=_0x37a394[_0xd672('0x18')]||0x96;this['dialAgentRejectMaxRetry']=_0x37a394[_0xd672('0x19')]||0x3;this[_0xd672('0x1a')]=_0x37a394[_0xd672('0x1a')]||0x96;this[_0xd672('0x1b')]=_0x37a394['dialOrderByScheduledAt']||_0xd672('0x1c');this[_0xd672('0x1d')]=_0x37a394[_0xd672('0x1d')]||undefined;this[_0xd672('0x1e')]=_0x37a394['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x37a394[_0xd672('0x1f')]||undefined;this['TrunkBackup']=_0x37a394[_0xd672('0x20')]?_0x37a394['TrunkBackup']:undefined;this[_0xd672('0x21')]=_0x37a394[_0xd672('0x21')]?_0x37a394[_0xd672('0x21')]:undefined;this['Interval']=_0x37a394[_0xd672('0x22')]?_0x37a394['Interval']:undefined;this[_0xd672('0x23')]=_0x37a394[_0xd672('0x23')]?_0x37a394[_0xd672('0x23')]:undefined;this['dialQueueProject']=_0x37a394['SquareProject']?_0x37a394[_0xd672('0x23')][_0xd672('0x0')]:undefined;this[_0xd672('0x24')]=_0x37a394[_0xd672('0x24')]||![];this[_0xd672('0x25')]=_0x37a394[_0xd672('0x25')];this[_0xd672('0x26')]=_0x37a394[_0xd672('0x26')];this[_0xd672('0x27')]=_0x37a394['dialAMDAfterGreetingSilence'];this[_0xd672('0x28')]=_0x37a394[_0xd672('0x28')];this['dialAMDMinWordLength']=_0x37a394[_0xd672('0x29')];this[_0xd672('0x2a')]=_0x37a394[_0xd672('0x2a')];this[_0xd672('0x2b')]=_0x37a394[_0xd672('0x2b')];this[_0xd672('0x2c')]=_0x37a394[_0xd672('0x2c')];this[_0xd672('0x2d')]=_0x37a394[_0xd672('0x2d')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6267b1e..809ac88 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 _0x58ea=['lastdata','duration','billableseconds','holdtime','type','tag','disposition','queue','monitors','transfercalleridnum','mohtime','starttime','destinationchannel','connectedlinenum','connectedlinename','context','exten','answertime','endtime','unmanaged','abandoned','lastapplication'];(function(_0x10586b,_0x3fdebd){var _0x20f3d0=function(_0x1847e0){while(--_0x1847e0){_0x10586b['push'](_0x10586b['shift']());}};_0x20f3d0(++_0x3fdebd);}(_0x58ea,0xe7));var _0xa58e=function(_0x7cbc97,_0x233b6f){_0x7cbc97=_0x7cbc97-0x0;var _0x20628d=_0x58ea[_0x7cbc97];return _0x20628d;};'use strict';function Channel(){this[_0xa58e('0x0')]=null;this['channel']='';this[_0xa58e('0x1')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0xa58e('0x2')]=undefined;this[_0xa58e('0x3')]=undefined;this['accountcode']=0x0;this[_0xa58e('0x4')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0xa58e('0x5')]=0x0;this['answered']=![];this[_0xa58e('0x6')]=null;this[_0xa58e('0x7')]=null;this[_0xa58e('0x8')]=![];this[_0xa58e('0x9')]=![];this[_0xa58e('0xa')]='';this[_0xa58e('0xb')]='';this[_0xa58e('0xc')]=0x0;this[_0xa58e('0xd')]=0x0;this[_0xa58e('0xe')]=0x0;this[_0xa58e('0xf')]=null;this[_0xa58e('0x10')]=null;this[_0xa58e('0x11')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0xa58e('0x12')]=null;this[_0xa58e('0x13')]=[];this[_0xa58e('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xa58e('0x15')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x500c=['transferconnectedlinenum','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','monitor','queue'];(function(_0x14d673,_0x239860){var _0x556ef4=function(_0x57650c){while(--_0x57650c){_0x14d673['push'](_0x14d673['shift']());}};_0x556ef4(++_0x239860);}(_0x500c,0x188));var _0xc500=function(_0x39b1b0,_0xe83400){_0x39b1b0=_0x39b1b0-0x0;var _0x5eab07=_0x500c[_0x39b1b0];return _0x5eab07;};'use strict';function Channel(){this[_0xc500('0x0')]=null;this[_0xc500('0x1')]='';this[_0xc500('0x2')]='';this[_0xc500('0x3')]=0x0;this[_0xc500('0x4')]='';this[_0xc500('0x5')]=undefined;this[_0xc500('0x6')]=undefined;this[_0xc500('0x7')]=0x0;this[_0xc500('0x8')]='';this[_0xc500('0x9')]=0x0;this[_0xc500('0xa')]=0x0;this[_0xc500('0xb')]=0x0;this[_0xc500('0xc')]=![];this[_0xc500('0xd')]=null;this[_0xc500('0xe')]=null;this['unmanaged']=![];this[_0xc500('0xf')]=![];this['lastapplication']='';this[_0xc500('0x10')]='';this[_0xc500('0x11')]=0x0;this[_0xc500('0x12')]=0x0;this[_0xc500('0x13')]=0x0;this[_0xc500('0x14')]=null;this[_0xc500('0x15')]=null;this['disposition']=null;this[_0xc500('0x16')]=![];this['monitorFilename']=null;this[_0xc500('0x17')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0xc500('0x18')]=undefined;this[_0xc500('0x19')]=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 067aa4d..518fa49 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 _0x7c8e=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x46f7f0,_0x4ef418){_0x46f7f0=_0x46f7f0-0x0;var _0x783786=_0x7c8e[_0x46f7f0];return _0x783786;};'use strict';function DeskAccount(_0x3aa870){this['id']=_0x3aa870['id']||0x0;this[_0xe7c8('0x0')]=_0x3aa870[_0xe7c8('0x0')]||'';this[_0xe7c8('0x1')]=_0x3aa870[_0xe7c8('0x1')]||'';this[_0xe7c8('0x2')]=_0x3aa870[_0xe7c8('0x2')]||'';this[_0xe7c8('0x3')]=_0x3aa870[_0xe7c8('0x3')]||'';this[_0xe7c8('0x4')]=_0x3aa870[_0xe7c8('0x4')]||'';this[_0xe7c8('0x5')]=_0x3aa870[_0xe7c8('0x5')]||'';this[_0xe7c8('0x6')]=_0x3aa870[_0xe7c8('0x6')]||'';this[_0xe7c8('0x7')]=_0x3aa870[_0xe7c8('0x7')]||'';this[_0xe7c8('0x8')]=_0x3aa870[_0xe7c8('0x8')]||'';this['type']=_0x3aa870[_0xe7c8('0x9')]||'';this[_0xe7c8('0xa')]=_0x3aa870[_0xe7c8('0xa')]||'';this['Configurations']=_0x3aa870[_0xe7c8('0xb')]||{};}module[_0xe7c8('0xc')]=DeskAccount; \ No newline at end of file +var _0x746f=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x47b15d,_0x5586ec){var _0x54a269=function(_0x3d2477){while(--_0x3d2477){_0x47b15d['push'](_0x47b15d['shift']());}};_0x54a269(++_0x5586ec);}(_0x746f,0x9c));var _0xf746=function(_0x456ef3,_0x22bc37){_0x456ef3=_0x456ef3-0x0;var _0xbc980b=_0x746f[_0x456ef3];return _0xbc980b;};'use strict';function DeskAccount(_0x55867e){this['id']=_0x55867e['id']||0x0;this[_0xf746('0x0')]=_0x55867e[_0xf746('0x0')]||'';this[_0xf746('0x1')]=_0x55867e[_0xf746('0x1')]||'';this[_0xf746('0x2')]=_0x55867e[_0xf746('0x2')]||'';this[_0xf746('0x3')]=_0x55867e[_0xf746('0x3')]||'';this[_0xf746('0x4')]=_0x55867e[_0xf746('0x4')]||'';this[_0xf746('0x5')]=_0x55867e[_0xf746('0x5')]||'';this[_0xf746('0x6')]=_0x55867e[_0xf746('0x6')]||'';this[_0xf746('0x7')]=_0x55867e[_0xf746('0x7')]||'';this[_0xf746('0x8')]=_0x55867e[_0xf746('0x8')]||'';this[_0xf746('0x9')]=_0x55867e[_0xf746('0x9')]||'';this[_0xf746('0xa')]=_0x55867e[_0xf746('0xa')]||'';this[_0xf746('0xb')]=_0x55867e[_0xf746('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0cf8e41..96ff8b4 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 _0x1fec=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x5d8453,_0x199108){var _0x288c2e=function(_0x396426){while(--_0x396426){_0x5d8453['push'](_0x5d8453['shift']());}};_0x288c2e(++_0x199108);}(_0x1fec,0x66));var _0xc1fe=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x1fec[_0x2f5ac5];return _0x37c9a8;};'use strict';function Dynamics365Account(_0x4d0206){this['id']=_0x4d0206['id']||0x0;this[_0xc1fe('0x0')]=_0x4d0206[_0xc1fe('0x0')]||'';this[_0xc1fe('0x1')]=_0x4d0206[_0xc1fe('0x1')]||'';this[_0xc1fe('0x2')]=_0x4d0206[_0xc1fe('0x2')]||'';this['remoteUri']=_0x4d0206[_0xc1fe('0x3')]||'';this['tenantId']=_0x4d0206[_0xc1fe('0x4')]||'';this[_0xc1fe('0x5')]=_0x4d0206[_0xc1fe('0x5')]||'';this[_0xc1fe('0x6')]=_0x4d0206[_0xc1fe('0x6')]||{};this[_0xc1fe('0x7')]=_0x4d0206[_0xc1fe('0x7')]||'';this[_0xc1fe('0x8')]=_0x4d0206[_0xc1fe('0x8')]||{};}module[_0xc1fe('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x2e69=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','serverUrl'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0x2e69,0x1df));var _0x92e6=function(_0x392cc9,_0x4fe2c0){_0x392cc9=_0x392cc9-0x0;var _0x46195e=_0x2e69[_0x392cc9];return _0x46195e;};'use strict';function Dynamics365Account(_0x4d3c00){this['id']=_0x4d3c00['id']||0x0;this[_0x92e6('0x0')]=_0x4d3c00[_0x92e6('0x0')]||'';this[_0x92e6('0x1')]=_0x4d3c00['username']||'';this[_0x92e6('0x2')]=_0x4d3c00[_0x92e6('0x2')]||'';this['remoteUri']=_0x4d3c00[_0x92e6('0x3')]||'';this[_0x92e6('0x4')]=_0x4d3c00[_0x92e6('0x4')]||'';this[_0x92e6('0x5')]=_0x4d3c00['clientId']||'';this['clientSecret']=_0x4d3c00['clientSecret']||{};this[_0x92e6('0x6')]=_0x4d3c00[_0x92e6('0x6')]||'';this[_0x92e6('0x7')]=_0x4d3c00[_0x92e6('0x7')]||{};}module[_0x92e6('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 7d7cb1d..d235ea3 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 _0xba6f=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech'];(function(_0x36a5b3,_0x5ae569){var _0x2d851c=function(_0x5e9cb2){while(--_0x5e9cb2){_0x36a5b3['push'](_0x36a5b3['shift']());}};_0x2d851c(++_0x5ae569);}(_0xba6f,0x1d0));var _0xfba6=function(_0x185133,_0x29a472){_0x185133=_0x185133-0x0;var _0x862f7f=_0xba6f[_0x185133];return _0x862f7f;};'use strict';function FaxAccount(_0x59c9be){this['id']=_0x59c9be['id']||0x0;this['name']=_0x59c9be[_0xfba6('0x0')]||'';this[_0xfba6('0x1')]=_0x59c9be[_0xfba6('0x1')];this[_0xfba6('0x2')]=_0x59c9be[_0xfba6('0x2')];this[_0xfba6('0x3')]=_0x59c9be[_0xfba6('0x3')];this[_0xfba6('0x4')]=_0x59c9be[_0xfba6('0x4')];this[_0xfba6('0x5')]=_0x59c9be[_0xfba6('0x5')]||0x960;this[_0xfba6('0x6')]=_0x59c9be[_0xfba6('0x6')]||0x3840;this['modem']=_0x59c9be[_0xfba6('0x7')]||_0xfba6('0x8');this['gateway']=_0x59c9be['gateway']||'no';this['faxdetect']=_0x59c9be[_0xfba6('0x9')]||'no';this[_0xfba6('0xa')]=_0x59c9be[_0xfba6('0xa')]||0x1388;this[_0xfba6('0xb')]=_0x59c9be[_0xfba6('0xb')]||_0xfba6('0xc');this[_0xfba6('0xd')]=_0x59c9be[_0xfba6('0xd')]?_0x59c9be[_0xfba6('0xd')]:undefined;this[_0xfba6('0xe')]=_0x59c9be[_0xfba6('0xe')];this['key']=_0x59c9be[_0xfba6('0xf')];}module[_0xfba6('0x10')]=FaxAccount; \ No newline at end of file +var _0x16e0=['key','exports','name','description','ecm','headerinfo','localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0xcdaf9c,_0x9c5eb9){var _0x5a30cb=function(_0xaf2f64){while(--_0xaf2f64){_0xcdaf9c['push'](_0xcdaf9c['shift']());}};_0x5a30cb(++_0x9c5eb9);}(_0x16e0,0x1b2));var _0x016e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x16e0[_0x20a584];return _0x4b41a8;};'use strict';function FaxAccount(_0x184d90){this['id']=_0x184d90['id']||0x0;this['name']=_0x184d90[_0x016e('0x0')]||'';this[_0x016e('0x1')]=_0x184d90['description'];this['ecm']=_0x184d90[_0x016e('0x2')];this[_0x016e('0x3')]=_0x184d90[_0x016e('0x3')];this['localstationid']=_0x184d90[_0x016e('0x4')];this['minrate']=_0x184d90[_0x016e('0x5')]||0x960;this['maxrate']=_0x184d90['maxrate']||0x3840;this[_0x016e('0x6')]=_0x184d90[_0x016e('0x6')]||_0x016e('0x7');this['gateway']=_0x184d90[_0x016e('0x8')]||'no';this['faxdetect']=_0x184d90[_0x016e('0x9')]||'no';this[_0x016e('0xa')]=_0x184d90[_0x016e('0xa')]||0x1388;this[_0x016e('0xb')]=_0x184d90[_0x016e('0xb')]||_0x016e('0xc');this['Trunk']=_0x184d90[_0x016e('0xd')]?_0x184d90[_0x016e('0xd')]:undefined;this['ListId']=_0x184d90['ListId'];this[_0x016e('0xe')]=_0x184d90['key'];}module[_0x016e('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 8b6191c..b047157 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 _0xe34d=['Configurations','exports','name','apiKey','token','remoteUri','serverUrl'];(function(_0x3b4515,_0x319930){var _0x22c8e7=function(_0x36091d){while(--_0x36091d){_0x3b4515['push'](_0x3b4515['shift']());}};_0x22c8e7(++_0x319930);}(_0xe34d,0x1bb));var _0xde34=function(_0x3dfbed,_0x41c02b){_0x3dfbed=_0x3dfbed-0x0;var _0x18f5a3=_0xe34d[_0x3dfbed];return _0x18f5a3;};'use strict';function FreshdeskAccount(_0x1af682){this['id']=_0x1af682['id']||0x0;this['name']=_0x1af682[_0xde34('0x0')]||'';this['username']=_0x1af682['username']||'';this[_0xde34('0x1')]=_0x1af682[_0xde34('0x2')]||'';this['remoteUri']=_0x1af682[_0xde34('0x3')]||'';this[_0xde34('0x4')]=_0x1af682[_0xde34('0x4')]||'';this['Configurations']=_0x1af682[_0xde34('0x5')]||{};}module[_0xde34('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xd3be=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x25e184,_0x4b4f16){var _0x5b14f6=function(_0x3efa19){while(--_0x3efa19){_0x25e184['push'](_0x25e184['shift']());}};_0x5b14f6(++_0x4b4f16);}(_0xd3be,0x194));var _0xed3b=function(_0x1dc8ce,_0x46f0a2){_0x1dc8ce=_0x1dc8ce-0x0;var _0xc1fadd=_0xd3be[_0x1dc8ce];return _0xc1fadd;};'use strict';function FreshdeskAccount(_0x3f297a){this['id']=_0x3f297a['id']||0x0;this['name']=_0x3f297a[_0xed3b('0x0')]||'';this[_0xed3b('0x1')]=_0x3f297a[_0xed3b('0x1')]||'';this['apiKey']=_0x3f297a[_0xed3b('0x2')]||'';this[_0xed3b('0x3')]=_0x3f297a[_0xed3b('0x3')]||'';this[_0xed3b('0x4')]=_0x3f297a[_0xed3b('0x4')]||'';this[_0xed3b('0x5')]=_0x3f297a[_0xed3b('0x5')]||{};}module[_0xed3b('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f76a4a3..6ba54e4 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 _0xcccb=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xcccb,0x70));var _0xbccc=function(_0x468f16,_0x5c8555){_0x468f16=_0x468f16-0x0;var _0x4a0872=_0xcccb[_0x468f16];return _0x4a0872;};'use strict';function FreshsalesAccount(_0x26c2d4){this['id']=_0x26c2d4['id']||0x0;this[_0xbccc('0x0')]=_0x26c2d4[_0xbccc('0x0')]||'';this[_0xbccc('0x1')]=_0x26c2d4[_0xbccc('0x1')]||'';this['apiKey']=_0x26c2d4[_0xbccc('0x2')]||'';this[_0xbccc('0x3')]=_0x26c2d4[_0xbccc('0x3')]||'';this[_0xbccc('0x4')]=_0x26c2d4[_0xbccc('0x4')]||'';this[_0xbccc('0x5')]=_0x26c2d4[_0xbccc('0x5')]||{};}module[_0xbccc('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xe3ed=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x2ebb0b,_0x38b95c){var _0x36a67e=function(_0x338914){while(--_0x338914){_0x2ebb0b['push'](_0x2ebb0b['shift']());}};_0x36a67e(++_0x38b95c);}(_0xe3ed,0x1d5));var _0xde3e=function(_0x3673d8,_0x204546){_0x3673d8=_0x3673d8-0x0;var _0x475a5b=_0xe3ed[_0x3673d8];return _0x475a5b;};'use strict';function FreshsalesAccount(_0x399b60){this['id']=_0x399b60['id']||0x0;this['name']=_0x399b60[_0xde3e('0x0')]||'';this[_0xde3e('0x1')]=_0x399b60[_0xde3e('0x1')]||'';this['apiKey']=_0x399b60[_0xde3e('0x2')]||'';this[_0xde3e('0x3')]=_0x399b60[_0xde3e('0x3')]||'';this[_0xde3e('0x4')]=_0x399b60[_0xde3e('0x4')]||'';this['Configurations']=_0x399b60[_0xde3e('0x5')]||{};}module[_0xde3e('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 91a1fce..ce4b85a 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 _0x47a1=['queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon'];(function(_0x1008d5,_0x5e4e5a){var _0x1d1746=function(_0x26f3c4){while(--_0x26f3c4){_0x1008d5['push'](_0x1008d5['shift']());}};_0x1d1746(++_0x5e4e5a);}(_0x47a1,0x179));var _0x147a=function(_0x140075,_0x4bed72){_0x140075=_0x140075-0x0;var _0x20035a=_0x47a1[_0x140075];return _0x20035a;};'use strict';function QueueReport(){this['type']=_0x147a('0x0');this[_0x147a('0x1')]='';this['calleridnum']='';this[_0x147a('0x2')]='';this['queue']='';this[_0x147a('0x3')]=null;this[_0x147a('0x4')]=null;this['position']=0x1;this[_0x147a('0x5')]=0x1;this[_0x147a('0x6')]=![];this[_0x147a('0x7')]=null;this[_0x147a('0x8')]=![];this[_0x147a('0x9')]=null;this['queuecallerexit']=![];this[_0x147a('0xa')]=null;this[_0x147a('0xb')]=0x1;this[_0x147a('0xc')]='';this['connectedlinenum']='';this[_0x147a('0xd')]='';this[_0x147a('0xe')]='';this[_0x147a('0xf')]='';this[_0x147a('0x10')]='';this[_0x147a('0x11')]='';this[_0x147a('0x12')]=0x0;this[_0x147a('0x13')]=![];this[_0x147a('0x14')]='';this[_0x147a('0x15')]=0x0;this[_0x147a('0x16')]={};}module[_0x147a('0x17')]=QueueReport; \ No newline at end of file +var _0x60f6=['mohtime','variables','exports','inbound','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','context','priority','holdtime','assigned'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x60f6,0x1bb));var _0x660f=function(_0x3f3529,_0x45a8ca){_0x3f3529=_0x3f3529-0x0;var _0x2271fc=_0x60f6[_0x3f3529];return _0x2271fc;};'use strict';function QueueReport(){this['type']=_0x660f('0x0');this[_0x660f('0x1')]='';this['calleridnum']='';this['calleridname']='';this[_0x660f('0x2')]='';this[_0x660f('0x3')]=null;this[_0x660f('0x4')]=null;this[_0x660f('0x5')]=0x1;this[_0x660f('0x6')]=0x1;this[_0x660f('0x7')]=![];this[_0x660f('0x8')]=null;this[_0x660f('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x660f('0xa')]=![];this['queuecallerexitAt']=null;this[_0x660f('0xb')]=0x1;this[_0x660f('0xc')]='';this[_0x660f('0xd')]='';this[_0x660f('0xe')]='';this['accountcode']='';this[_0x660f('0xf')]='';this['exten']='';this[_0x660f('0x10')]='';this[_0x660f('0x11')]=0x0;this[_0x660f('0x12')]=![];this['lastAssignedTo']='';this[_0x660f('0x13')]=0x0;this[_0x660f('0x14')]={};}module[_0x660f('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 0799166..161ffc8 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 _0xa772=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x439ae5,_0x1ef09d){var _0x339f87=function(_0x24b9e6){while(--_0x24b9e6){_0x439ae5['push'](_0x439ae5['shift']());}};_0x339f87(++_0x1ef09d);}(_0xa772,0x1b2));var _0x2a77=function(_0x6f041d,_0x4029b4){_0x6f041d=_0x6f041d-0x0;var _0x4609b8=_0xa772[_0x6f041d];return _0x4609b8;};'use strict';function SalesforceAccount(_0x3c12f2){this['id']=_0x3c12f2['id']||0x0;this[_0x2a77('0x0')]=_0x3c12f2[_0x2a77('0x0')]||'';this[_0x2a77('0x1')]=_0x3c12f2[_0x2a77('0x1')]||'';this[_0x2a77('0x2')]=_0x3c12f2[_0x2a77('0x2')]||'';this[_0x2a77('0x3')]=_0x3c12f2['password']||'';this[_0x2a77('0x4')]=_0x3c12f2[_0x2a77('0x4')]||'';this[_0x2a77('0x5')]=_0x3c12f2['clientSecret']||'';this[_0x2a77('0x6')]=_0x3c12f2[_0x2a77('0x6')]||'';this[_0x2a77('0x7')]=_0x3c12f2['type']||'integrationTab';this[_0x2a77('0x8')]=_0x3c12f2[_0x2a77('0x8')]||'';this[_0x2a77('0x9')]=_0x3c12f2[_0x2a77('0x9')]||{};}module[_0x2a77('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x3003=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3003,0x1c1));var _0x3300=function(_0x1a7d4f,_0x124139){_0x1a7d4f=_0x1a7d4f-0x0;var _0x540608=_0x3003[_0x1a7d4f];return _0x540608;};'use strict';function SalesforceAccount(_0x16f04e){this['id']=_0x16f04e['id']||0x0;this[_0x3300('0x0')]=_0x16f04e[_0x3300('0x0')]||'';this[_0x3300('0x1')]=_0x16f04e[_0x3300('0x1')]||'';this[_0x3300('0x2')]=_0x16f04e[_0x3300('0x2')]||'';this[_0x3300('0x3')]=_0x16f04e['password']||'';this[_0x3300('0x4')]=_0x16f04e[_0x3300('0x4')]||'';this[_0x3300('0x5')]=_0x16f04e['clientSecret']||'';this[_0x3300('0x6')]=_0x16f04e['securityToken']||'';this['type']=_0x16f04e[_0x3300('0x7')]||_0x3300('0x8');this['serverUrl']=_0x16f04e[_0x3300('0x9')]||'';this[_0x3300('0xa')]=_0x16f04e[_0x3300('0xa')]||{};}module[_0x3300('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 3e77965..03e3ca4 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 _0x7647=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x7647,0x95));var _0x7764=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7647[_0x19950b];return _0x3c6b41;};'use strict';function ServicenowAccount(_0x27d17c){this['id']=_0x27d17c['id']||0x0;this[_0x7764('0x0')]=_0x27d17c[_0x7764('0x0')]||'';this[_0x7764('0x1')]=_0x27d17c[_0x7764('0x1')]||'';this['password']=_0x27d17c[_0x7764('0x2')]||'';this[_0x7764('0x3')]=_0x27d17c[_0x7764('0x3')]||'';this[_0x7764('0x4')]=_0x27d17c[_0x7764('0x4')]||'';this[_0x7764('0x5')]=_0x27d17c[_0x7764('0x5')]||{};}module[_0x7764('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x66af=['exports','name','username','password','remoteUri','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66af,0x18d));var _0xf66a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x66af[_0x19e35c];return _0x3e1fe8;};'use strict';function ServicenowAccount(_0x53ef3d){this['id']=_0x53ef3d['id']||0x0;this['name']=_0x53ef3d[_0xf66a('0x0')]||'';this[_0xf66a('0x1')]=_0x53ef3d['username']||'';this[_0xf66a('0x2')]=_0x53ef3d[_0xf66a('0x2')]||'';this[_0xf66a('0x3')]=_0x53ef3d[_0xf66a('0x3')]||'';this['serverUrl']=_0x53ef3d['serverUrl']||'';this[_0xf66a('0x4')]=_0x53ef3d[_0xf66a('0x4')]||{};}module[_0xf66a('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 5ffc23a..ef74ea5 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 _0x8866=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x4346cf,_0x5bee50){var _0x36beac=function(_0x129373){while(--_0x129373){_0x4346cf['push'](_0x4346cf['shift']());}};_0x36beac(++_0x5bee50);}(_0x8866,0x95));var _0x6886=function(_0x5c135e,_0x44f70a){_0x5c135e=_0x5c135e-0x0;var _0x3011d5=_0x8866[_0x5c135e];return _0x3011d5;};'use strict';function SugarcrmAccount(_0xc5f6e3){this['id']=_0xc5f6e3['id']||0x0;this[_0x6886('0x0')]=_0xc5f6e3['name']||'';this[_0x6886('0x1')]=_0xc5f6e3['username']||'';this[_0x6886('0x2')]=_0xc5f6e3[_0x6886('0x2')]||'';this[_0x6886('0x3')]=_0xc5f6e3[_0x6886('0x3')]||'';this[_0x6886('0x4')]=_0xc5f6e3[_0x6886('0x4')]||'';this[_0x6886('0x5')]=_0xc5f6e3['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xdcf6=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x3c9d09,_0x1dedb7){var _0x3a452c=function(_0x475999){while(--_0x475999){_0x3c9d09['push'](_0x3c9d09['shift']());}};_0x3a452c(++_0x1dedb7);}(_0xdcf6,0xab));var _0x6dcf=function(_0x3a28e2,_0x58325a){_0x3a28e2=_0x3a28e2-0x0;var _0xfd325a=_0xdcf6[_0x3a28e2];return _0xfd325a;};'use strict';function SugarcrmAccount(_0x4fa53e){this['id']=_0x4fa53e['id']||0x0;this[_0x6dcf('0x0')]=_0x4fa53e[_0x6dcf('0x0')]||'';this[_0x6dcf('0x1')]=_0x4fa53e[_0x6dcf('0x1')]||'';this[_0x6dcf('0x2')]=_0x4fa53e[_0x6dcf('0x2')]||'';this[_0x6dcf('0x3')]=_0x4fa53e[_0x6dcf('0x3')]||'';this[_0x6dcf('0x4')]=_0x4fa53e[_0x6dcf('0x4')]||'';this[_0x6dcf('0x5')]=_0x4fa53e['Configurations']||{};}module[_0x6dcf('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 6978b81..adec3e0 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 _0x8b58=['status','unknown','address','exports','name','accountcode','state'];(function(_0x4bab5b,_0x3a4a53){var _0x1be846=function(_0x3ef895){while(--_0x3ef895){_0x4bab5b['push'](_0x4bab5b['shift']());}};_0x1be846(++_0x3a4a53);}(_0x8b58,0x100));var _0x88b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b58[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x273f35){this['id']=_0x273f35['id']||0x0;this[_0x88b5('0x0')]=_0x273f35['name']||'';this['accountcode']=_0x273f35[_0x88b5('0x1')]||'';this[_0x88b5('0x2')]='unknown';this['stateTime']=0x0;this[_0x88b5('0x3')]=_0x88b5('0x4');this[_0x88b5('0x5')]='';}module[_0x88b5('0x6')]=Telephone; \ No newline at end of file +var _0x67d7=['accountcode','state','unknown','status','address','exports','name'];(function(_0x46ea9b,_0x305af0){var _0x10d2c5=function(_0x2a81c8){while(--_0x2a81c8){_0x46ea9b['push'](_0x46ea9b['shift']());}};_0x10d2c5(++_0x305af0);}(_0x67d7,0x117));var _0x767d=function(_0x5e452c,_0x3b33c9){_0x5e452c=_0x5e452c-0x0;var _0x3f2356=_0x67d7[_0x5e452c];return _0x3f2356;};'use strict';function Telephone(_0x29438d){this['id']=_0x29438d['id']||0x0;this[_0x767d('0x0')]=_0x29438d[_0x767d('0x0')]||'';this['accountcode']=_0x29438d[_0x767d('0x1')]||'';this[_0x767d('0x2')]=_0x767d('0x3');this['stateTime']=0x0;this[_0x767d('0x4')]='unknown';this[_0x767d('0x5')]='';}module[_0x767d('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 8a64342..c80b233 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 _0xe10c=['name','html'];(function(_0x28705e,_0xb3b9ba){var _0x39064a=function(_0x652f4){while(--_0x652f4){_0x28705e['push'](_0x28705e['shift']());}};_0x39064a(++_0xb3b9ba);}(_0xe10c,0x1f0));var _0xce10=function(_0x4b2ed4,_0x570c3f){_0x4b2ed4=_0x4b2ed4-0x0;var _0x40a714=_0xe10c[_0x4b2ed4];return _0x40a714;};'use strict';function template(_0x562c9b){this['id']=_0x562c9b['id']||0x0;this[_0xce10('0x0')]=_0x562c9b['name']||'';this[_0xce10('0x1')]=_0x562c9b[_0xce10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xe4cd=['name','html'];(function(_0xe814b9,_0x1391b3){var _0x4c2760=function(_0x3eda48){while(--_0x3eda48){_0xe814b9['push'](_0xe814b9['shift']());}};_0x4c2760(++_0x1391b3);}(_0xe4cd,0x84));var _0xde4c=function(_0x2feb2c,_0x57a0a9){_0x2feb2c=_0x2feb2c-0x0;var _0x5ebb67=_0xe4cd[_0x2feb2c];return _0x5ebb67;};'use strict';function template(_0x48f7a7){this['id']=_0x48f7a7['id']||0x0;this['name']=_0x48f7a7[_0xde4c('0x0')]||'';this[_0xde4c('0x1')]=_0x48f7a7['html']||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 25745ac..327483f 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0xedd9=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x5c62a4,_0x54fcb6){var _0x3d98b0=function(_0x30253b){while(--_0x30253b){_0x5c62a4['push'](_0x5c62a4['shift']());}};_0x3d98b0(++_0x54fcb6);}(_0xedd9,0xfc));var _0x9edd=function(_0x2966ea,_0x5ef657){_0x2966ea=_0x2966ea-0x0;var _0x255bf5=_0xedd9[_0x2966ea];return _0x255bf5;};'use strict';function Trigger(_0x265eb8){this['id']=_0x265eb8['id']||0x0;this[_0x9edd('0x0')]=_0x265eb8[_0x9edd('0x0')]||'';this[_0x9edd('0x1')]=_0x265eb8[_0x9edd('0x1')]||_0x9edd('0x2');this[_0x9edd('0x3')]=_0x265eb8[_0x9edd('0x3')]||![];this[_0x9edd('0x4')]=_0x265eb8['AllConditions']||[];this[_0x9edd('0x5')]=_0x265eb8[_0x9edd('0x5')]||[];this[_0x9edd('0x6')]=_0x265eb8[_0x9edd('0x6')]||[];}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 cd636a9..a781c5e 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 _0xb3bf=['unknown','status','registry','indexOf','split','host','port','domainport','address','active','name','state'];(function(_0x35181c,_0x82694a){var _0xe14bf9=function(_0x2be9b7){while(--_0x2be9b7){_0x35181c['push'](_0x35181c['shift']());}};_0xe14bf9(++_0x82694a);}(_0xb3bf,0x135));var _0xfb3b=function(_0x482e4b,_0x30b54d){_0x482e4b=_0x482e4b-0x0;var _0x5a3901=_0xb3bf[_0x482e4b];return _0x5a3901;};'use strict';function Trunk(_0x3fdde1){this['id']=_0x3fdde1['id']||0x0;this[_0xfb3b('0x0')]=_0x3fdde1[_0xfb3b('0x0')]||![];this['name']=_0x3fdde1[_0xfb3b('0x1')]||'';this[_0xfb3b('0x2')]=_0xfb3b('0x3');this['stateTime']=0x0;this[_0xfb3b('0x4')]=_0xfb3b('0x3');this[_0xfb3b('0x5')]=_0x3fdde1[_0xfb3b('0x5')]&&_0x3fdde1[_0xfb3b('0x5')][_0xfb3b('0x6')](':')?_0x3fdde1[_0xfb3b('0x5')][_0xfb3b('0x7')](':')[0x0]:'';this[_0xfb3b('0x8')]='';this[_0xfb3b('0x9')]='';this['domain']='';this[_0xfb3b('0xa')]='';this['refresh']='';this['stateRegistry']='unknown';this['registrationtime']='';this[_0xfb3b('0xb')]='';}module['exports']=Trunk; \ No newline at end of file +var _0x055d=['domain','domainport','refresh','stateRegistry','registrationtime','exports','active','name','state','unknown','stateTime','registry','indexOf','split','host','port'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0x055d,0x1b6));var _0xd055=function(_0x2e0ced,_0xfca909){_0x2e0ced=_0x2e0ced-0x0;var _0x2a4ea0=_0x055d[_0x2e0ced];return _0x2a4ea0;};'use strict';function Trunk(_0x537cad){this['id']=_0x537cad['id']||0x0;this[_0xd055('0x0')]=_0x537cad[_0xd055('0x0')]||![];this[_0xd055('0x1')]=_0x537cad[_0xd055('0x1')]||'';this[_0xd055('0x2')]=_0xd055('0x3');this[_0xd055('0x4')]=0x0;this['status']=_0xd055('0x3');this[_0xd055('0x5')]=_0x537cad['registry']&&_0x537cad[_0xd055('0x5')][_0xd055('0x6')](':')?_0x537cad[_0xd055('0x5')][_0xd055('0x7')](':')[0x0]:'';this[_0xd055('0x8')]='';this[_0xd055('0x9')]='';this[_0xd055('0xa')]='';this[_0xd055('0xb')]='';this[_0xd055('0xc')]='';this[_0xd055('0xd')]=_0xd055('0x3');this[_0xd055('0xe')]='';this['address']='';}module[_0xd055('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0d619fc..9fb4109 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 _0x2766=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x2766,0x14d));var _0x6276=function(_0x5ea94c,_0x19937b){_0x5ea94c=_0x5ea94c-0x0;var _0xededd7=_0x2766[_0x5ea94c];return _0xededd7;};'use strict';function voiceExtension(_0x322048){this['id']=_0x322048['id']||0x0;this[_0x6276('0x0')]=_0x322048[_0x6276('0x0')]||'';this['recordingFormat']=_0x322048[_0x6276('0x1')]||_0x6276('0x2');this[_0x6276('0x3')]=_0x322048[_0x6276('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x42fc=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x54c12e,_0x21335b){var _0xef9441=function(_0x1df81b){while(--_0x1df81b){_0x54c12e['push'](_0x54c12e['shift']());}};_0xef9441(++_0x21335b);}(_0x42fc,0xb9));var _0xc42f=function(_0x4472c1,_0x135b58){_0x4472c1=_0x4472c1-0x0;var _0x18aba7=_0x42fc[_0x4472c1];return _0x18aba7;};'use strict';function voiceExtension(_0x142f7b){this['id']=_0x142f7b['id']||0x0;this[_0xc42f('0x0')]=_0x142f7b['exten']||'';this[_0xc42f('0x1')]=_0x142f7b['recordingFormat']||_0xc42f('0x2');this[_0xc42f('0x3')]=_0x142f7b[_0xc42f('0x3')]||![];}module[_0xc42f('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 ebe2af2..b089558 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 _0x9ec3=['dialPowerLevel','dialPredictiveOptimization','dropRate','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','onhold','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','abandoned','loggedIn','available','acw','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue'];(function(_0x1d486a,_0x249817){var _0x44ca73=function(_0x3a2903){while(--_0x3a2903){_0x1d486a['push'](_0x1d486a['shift']());}};_0x44ca73(++_0x249817);}(_0x9ec3,0xc2));var _0x39ec=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x9ec3[_0x307086];return _0x699043;};'use strict';var statusDesc=[_0x39ec('0x0'),_0x39ec('0x1'),_0x39ec('0x2'),_0x39ec('0x3'),_0x39ec('0x4'),'unavailable','ringing','ringinuse',_0x39ec('0x5')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0x39ec('0x6'),'roundrobin':_0x39ec('0x7')};function VoiceQueue(_0x5f8253){this['id']=_0x5f8253['id']||0x0;this[_0x39ec('0x8')]=_0x5f8253[_0x39ec('0x8')]||'';this['monitor_format']=_0x5f8253[_0x39ec('0x9')]||'';this[_0x39ec('0xa')]=_0x5f8253['type']||_0x39ec('0xb');this[_0x39ec('0xc')]=0x0;this['talking']=0x0;this[_0x39ec('0xd')]=0x0;this[_0x39ec('0xe')]=0x0;this[_0x39ec('0xf')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x39ec('0x10')]=0x0;this[_0x39ec('0x11')]=0x0;this[_0x39ec('0x12')]=0x0;this[_0x39ec('0x13')]=_0x5f8253['acw']||![];this['acwTimeout']=_0x5f8253['acwTimeout']||0xa;this[_0x39ec('0x14')]=_0x5f8253['autopause']||'no';this[_0x39ec('0x15')]=!![];this[_0x39ec('0x16')]='';this[_0x39ec('0x17')]=0x0;this['temp']=0x0;this[_0x39ec('0x18')]=_0x5f8253['dialTimezone']||null;this[_0x39ec('0x19')]=_0x5f8253[_0x39ec('0x19')]?_0x5f8253[_0x39ec('0x19')]:null;this['dialActive']=_0x5f8253[_0x39ec('0x1a')];this['dialMethod']=_0x5f8253['dialMethod']||_0x39ec('0x1b');this[_0x39ec('0x1c')]=_0x5f8253[_0x39ec('0x1c')]||0x0;this[_0x39ec('0x1d')]=_0x5f8253[_0x39ec('0x1d')]||0x0;this[_0x39ec('0x1e')]=_0x5f8253['dialPowerLevel']||0x1;this[_0x39ec('0x1f')]=_0x5f8253[_0x39ec('0x1f')]||_0x39ec('0x20');this['dialPredictiveOptimizationPercentage']=_0x5f8253['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x5f8253['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x5f8253[_0x39ec('0x21')]||_0x39ec('0x22');this[_0x39ec('0x23')]=_0x5f8253[_0x39ec('0x23')]||_0x39ec('0x22');this[_0x39ec('0x24')]=_0x5f8253[_0x39ec('0x24')]||0x1e;this['dialQueueOptions']=_0x5f8253['dialQueueOptions']||_0x39ec('0x25');this[_0x39ec('0x26')]=_0x5f8253[_0x39ec('0x26')]||0x3;this['dialQueueProject']=_0x5f8253[_0x39ec('0x27')]||undefined;this[_0x39ec('0x28')]=_0x5f8253['dialCongestionMaxRetry']||0x3;this[_0x39ec('0x29')]=_0x5f8253[_0x39ec('0x29')]||0x96;this[_0x39ec('0x2a')]=_0x5f8253[_0x39ec('0x2a')]||0x3;this[_0x39ec('0x2b')]=_0x5f8253[_0x39ec('0x2b')]||0x96;this[_0x39ec('0x2c')]=_0x5f8253[_0x39ec('0x2c')]||0x3;this['dialNoAnswerRetryFrequency']=_0x5f8253[_0x39ec('0x2d')]||0x96;this[_0x39ec('0x2e')]=_0x5f8253[_0x39ec('0x2e')]||0x3;this[_0x39ec('0x2f')]=_0x5f8253[_0x39ec('0x2f')]||0x96;this['dialDropMaxRetry']=_0x5f8253[_0x39ec('0x30')]||0x3;this[_0x39ec('0x31')]=_0x5f8253[_0x39ec('0x31')]||0x96;this[_0x39ec('0x32')]=_0x5f8253[_0x39ec('0x32')]||0x3;this['dialAbandonedRetryFrequency']=_0x5f8253['dialAbandonedRetryFrequency']||0x96;this[_0x39ec('0x33')]=_0x5f8253[_0x39ec('0x33')]||0x3;this[_0x39ec('0x34')]=_0x5f8253[_0x39ec('0x34')]||0x96;this[_0x39ec('0x35')]=_0x5f8253[_0x39ec('0x35')]||0x3;this[_0x39ec('0x36')]=_0x5f8253[_0x39ec('0x36')]||0x96;this['dialGlobalMaxRetry']=_0x5f8253[_0x39ec('0x37')]||0x4;this[_0x39ec('0x38')]=_0x5f8253['Trunk']?_0x5f8253[_0x39ec('0x38')]:undefined;this['TrunkBackup']=_0x5f8253['TrunkBackup']?_0x5f8253[_0x39ec('0x39')]:undefined;this[_0x39ec('0x3a')]=_0x5f8253[_0x39ec('0x3a')]||undefined;this[_0x39ec('0x3b')]=_0x5f8253[_0x39ec('0x3b')]?_0x5f8253[_0x39ec('0x3b')]:undefined;this[_0x39ec('0x3c')]=_0x5f8253[_0x39ec('0x3c')]||_0x39ec('0x3d');this[_0x39ec('0x3e')]=_0x5f8253[_0x39ec('0x3e')]||undefined;this[_0x39ec('0x3f')]=_0x5f8253[_0x39ec('0x3f')]||undefined;this[_0x39ec('0x40')]=strategy[_0x5f8253[_0x39ec('0x40')]]||_0x39ec('0x6');this[_0x39ec('0x41')]=!![];this['dialAMDActive']=_0x5f8253['dialAMDActive']||![];this[_0x39ec('0x42')]=_0x5f8253[_0x39ec('0x42')];this[_0x39ec('0x43')]=_0x5f8253[_0x39ec('0x43')];this[_0x39ec('0x44')]=_0x5f8253[_0x39ec('0x44')];this['dialAMDTotalAnalysisTime']=_0x5f8253[_0x39ec('0x45')];this[_0x39ec('0x46')]=_0x5f8253[_0x39ec('0x46')];this[_0x39ec('0x47')]=_0x5f8253[_0x39ec('0x47')];this[_0x39ec('0x48')]=_0x5f8253['dialAMDMaximumNumberOfWords'];this[_0x39ec('0x49')]=_0x5f8253[_0x39ec('0x49')];this[_0x39ec('0x4a')]=_0x5f8253['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x39ec('0x4b')]=0x0;this[_0x39ec('0x4c')]=_0x5f8253['timeout'];this[_0x39ec('0x4d')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x39ec('0x4e')]=0x0;this[_0x39ec('0x4f')]=0x0;this[_0x39ec('0x50')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x39ec('0x51')]=0x0;this[_0x39ec('0x52')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x39ec('0x53')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x39ec('0x54')]=0x0;this[_0x39ec('0x55')]=0x0;this[_0x39ec('0x56')]=undefined;this[_0x39ec('0x57')]=undefined;this[_0x39ec('0x58')]=undefined;this[_0x39ec('0x59')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x39ec('0x5a')]=0x0;this[_0x39ec('0x5b')]=0x0;this[_0x39ec('0x5c')]=0x0;this[_0x39ec('0x5d')]=0x0;this[_0x39ec('0x5e')]=0x0;this[_0x39ec('0x5f')]=0x0;this[_0x39ec('0x60')]=0x0;this['predictiveIntervalMaxThreshold']=_0x5f8253[_0x39ec('0x61')]||0x14;this[_0x39ec('0x62')]=_0x5f8253[_0x39ec('0x61')]||0xa;this[_0x39ec('0x63')]=0x0;this[_0x39ec('0x64')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x39ec('0x65')]=0x0;this[_0x39ec('0x66')]=0x0;this[_0x39ec('0x67')]=0x0;this[_0x39ec('0x68')]=0x0;this[_0x39ec('0x69')]=_0x5f8253[_0x39ec('0x69')]||0x1e;this[_0x39ec('0x6a')]=_0x5f8253['dialRecallInQueue']||![];this['dialQueueProject2']=_0x5f8253['dialQueueProject2']||undefined;this[_0x39ec('0x6b')]=_0x5f8253[_0x39ec('0x6b')]||![];this[_0x39ec('0x6c')]=_0x5f8253['dialAgiAfterHangupAgent']||![];this[_0x39ec('0x9')]=monitorFormat[_0x5f8253[_0x39ec('0x9')]]?monitorFormat[_0x5f8253[_0x39ec('0x9')]]:undefined;this[_0x39ec('0x6d')]=_0x5f8253[_0x39ec('0x6d')]||![];this[_0x39ec('0x6e')]=_0x5f8253[_0x39ec('0x6e')]?_0x5f8253[_0x39ec('0x6e')]:undefined;}module[_0x39ec('0x6f')]=VoiceQueue; \ No newline at end of file +var _0x9b75=['roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','ringing','ringinuse','onhold','wav','wav49','gsm'];(function(_0x2ec9e4,_0x1403a5){var _0x348e27=function(_0x50bb82){while(--_0x50bb82){_0x2ec9e4['push'](_0x2ec9e4['shift']());}};_0x348e27(++_0x1403a5);}(_0x9b75,0x1ea));var _0x59b7=function(_0x25c95b,_0x364526){_0x25c95b=_0x25c95b-0x0;var _0x462e87=_0x9b75[_0x25c95b];return _0x462e87;};'use strict';var statusDesc=[_0x59b7('0x0'),_0x59b7('0x1'),_0x59b7('0x2'),'busy',_0x59b7('0x3'),'unavailable',_0x59b7('0x4'),_0x59b7('0x5'),_0x59b7('0x6')];var monitorFormat={'wav':_0x59b7('0x7'),'wav49':_0x59b7('0x8'),'gsm':_0x59b7('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x59b7('0xa')};function VoiceQueue(_0x1734c7){this['id']=_0x1734c7['id']||0x0;this[_0x59b7('0xb')]=_0x1734c7['name']||'';this[_0x59b7('0xc')]=_0x1734c7['monitor_format']||'';this['type']=_0x1734c7[_0x59b7('0xd')]||_0x59b7('0xe');this[_0x59b7('0xf')]=0x0;this[_0x59b7('0x10')]=0x0;this[_0x59b7('0x11')]=0x0;this[_0x59b7('0x12')]=0x0;this['sumDuration']=0x0;this[_0x59b7('0x13')]=0x0;this[_0x59b7('0x14')]=0x0;this[_0x59b7('0x15')]=0x0;this[_0x59b7('0x16')]=0x0;this[_0x59b7('0x17')]=0x0;this[_0x59b7('0x18')]=0x0;this[_0x59b7('0x19')]=_0x1734c7[_0x59b7('0x19')]||![];this[_0x59b7('0x1a')]=_0x1734c7[_0x59b7('0x1a')]||0xa;this[_0x59b7('0x1b')]=_0x1734c7[_0x59b7('0x1b')]||'no';this[_0x59b7('0x1c')]=!![];this['message']='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x1734c7[_0x59b7('0x1d')]||null;this[_0x59b7('0x1e')]=_0x1734c7[_0x59b7('0x1e')]?_0x1734c7[_0x59b7('0x1e')]:null;this[_0x59b7('0x1f')]=_0x1734c7['dialActive'];this['dialMethod']=_0x1734c7[_0x59b7('0x20')]||_0x59b7('0x21');this['dialLimitChannel']=_0x1734c7[_0x59b7('0x22')]||0x0;this[_0x59b7('0x23')]=_0x1734c7[_0x59b7('0x23')]||0x0;this[_0x59b7('0x24')]=_0x1734c7['dialPowerLevel']||0x1;this[_0x59b7('0x25')]=_0x1734c7['dialPredictiveOptimization']||_0x59b7('0x26');this[_0x59b7('0x27')]=_0x1734c7[_0x59b7('0x27')]||0.03;this[_0x59b7('0x28')]=_0x1734c7[_0x59b7('0x28')]||0x258;this[_0x59b7('0x29')]=_0x1734c7[_0x59b7('0x29')]||_0x59b7('0x2a');this['dialOriginateCallerIdNumber']=_0x1734c7[_0x59b7('0x2b')]||_0x59b7('0x2a');this[_0x59b7('0x2c')]=_0x1734c7[_0x59b7('0x2c')]||0x1e;this[_0x59b7('0x2d')]=_0x1734c7['dialQueueOptions']||_0x59b7('0x2e');this[_0x59b7('0x2f')]=_0x1734c7[_0x59b7('0x2f')]||0x3;this[_0x59b7('0x30')]=_0x1734c7[_0x59b7('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x1734c7[_0x59b7('0x31')]||0x3;this[_0x59b7('0x32')]=_0x1734c7[_0x59b7('0x32')]||0x96;this[_0x59b7('0x33')]=_0x1734c7[_0x59b7('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x1734c7[_0x59b7('0x34')]||0x96;this[_0x59b7('0x35')]=_0x1734c7[_0x59b7('0x35')]||0x3;this[_0x59b7('0x36')]=_0x1734c7[_0x59b7('0x36')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x1734c7[_0x59b7('0x37')]||0x3;this[_0x59b7('0x38')]=_0x1734c7['dialNoSuchNumberRetryFrequency']||0x96;this[_0x59b7('0x39')]=_0x1734c7[_0x59b7('0x39')]||0x3;this['dialDropRetryFrequency']=_0x1734c7[_0x59b7('0x3a')]||0x96;this[_0x59b7('0x3b')]=_0x1734c7['dialAbandonedMaxRetry']||0x3;this[_0x59b7('0x3c')]=_0x1734c7[_0x59b7('0x3c')]||0x96;this[_0x59b7('0x3d')]=_0x1734c7['dialMachineMaxRetry']||0x3;this[_0x59b7('0x3e')]=_0x1734c7[_0x59b7('0x3e')]||0x96;this[_0x59b7('0x3f')]=_0x1734c7['dialAgentRejectMaxRetry']||0x3;this[_0x59b7('0x40')]=_0x1734c7[_0x59b7('0x40')]||0x96;this[_0x59b7('0x41')]=_0x1734c7[_0x59b7('0x41')]||0x4;this[_0x59b7('0x42')]=_0x1734c7[_0x59b7('0x42')]?_0x1734c7[_0x59b7('0x42')]:undefined;this[_0x59b7('0x43')]=_0x1734c7[_0x59b7('0x43')]?_0x1734c7[_0x59b7('0x43')]:undefined;this[_0x59b7('0x44')]=_0x1734c7[_0x59b7('0x44')]||undefined;this['Interval']=_0x1734c7[_0x59b7('0x45')]?_0x1734c7[_0x59b7('0x45')]:undefined;this[_0x59b7('0x46')]=_0x1734c7[_0x59b7('0x46')]||_0x59b7('0x47');this[_0x59b7('0x48')]=_0x1734c7[_0x59b7('0x48')]||undefined;this[_0x59b7('0x49')]=_0x1734c7[_0x59b7('0x49')]||undefined;this[_0x59b7('0x4a')]=strategy[_0x1734c7[_0x59b7('0x4a')]]||_0x59b7('0x4b');this[_0x59b7('0x4c')]=!![];this[_0x59b7('0x4d')]=_0x1734c7[_0x59b7('0x4d')]||![];this[_0x59b7('0x4e')]=_0x1734c7[_0x59b7('0x4e')];this['dialAMDGreeting']=_0x1734c7[_0x59b7('0x4f')];this['dialAMDAfterGreetingSilence']=_0x1734c7[_0x59b7('0x50')];this[_0x59b7('0x51')]=_0x1734c7[_0x59b7('0x51')];this[_0x59b7('0x52')]=_0x1734c7['dialAMDMinWordLength'];this[_0x59b7('0x53')]=_0x1734c7[_0x59b7('0x53')];this['dialAMDMaximumNumberOfWords']=_0x1734c7['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x1734c7[_0x59b7('0x54')];this[_0x59b7('0x55')]=_0x1734c7[_0x59b7('0x55')];this[_0x59b7('0x56')]=0x0;this[_0x59b7('0x57')]=0x0;this[_0x59b7('0x58')]=_0x1734c7[_0x59b7('0x58')];this[_0x59b7('0x59')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x59b7('0x5a')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x59b7('0x5b')]=0x0;this[_0x59b7('0x5c')]=0x0;this[_0x59b7('0x5d')]=0x0;this[_0x59b7('0x5e')]=0x0;this[_0x59b7('0x5f')]=0x0;this[_0x59b7('0x60')]=0x0;this[_0x59b7('0x61')]=0x0;this[_0x59b7('0x62')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x59b7('0x63')]=undefined;this['startPredictive']=undefined;this[_0x59b7('0x64')]=undefined;this[_0x59b7('0x65')]=1.05;this[_0x59b7('0x66')]=0x0;this[_0x59b7('0x67')]=0x0;this[_0x59b7('0x68')]=0x0;this[_0x59b7('0x69')]=0x0;this[_0x59b7('0x6a')]=0x0;this[_0x59b7('0x6b')]=0x0;this[_0x59b7('0x6c')]=0x0;this[_0x59b7('0x6d')]=0x0;this[_0x59b7('0x6e')]=_0x1734c7[_0x59b7('0x6f')]||0x14;this[_0x59b7('0x70')]=_0x1734c7[_0x59b7('0x6f')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x59b7('0x71')]=0x1;this[_0x59b7('0x72')]=0x0;this[_0x59b7('0x73')]=0x0;this[_0x59b7('0x74')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x1734c7[_0x59b7('0x75')]||0x1e;this[_0x59b7('0x76')]=_0x1734c7['dialRecallInQueue']||![];this[_0x59b7('0x77')]=_0x1734c7[_0x59b7('0x77')]||undefined;this[_0x59b7('0x78')]=_0x1734c7[_0x59b7('0x78')]||![];this[_0x59b7('0x79')]=_0x1734c7['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1734c7[_0x59b7('0xc')]]?monitorFormat[_0x1734c7[_0x59b7('0xc')]]:undefined;this['mandatoryDisposition']=_0x1734c7[_0x59b7('0x7a')]||![];this[_0x59b7('0x7b')]=_0x1734c7['mandatoryDispositionPause']?_0x1734c7[_0x59b7('0x7b')]:undefined;}module[_0x59b7('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index b9dfc19..b375b4c 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 _0xab64=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x4be3d3,_0x635c8d){var _0x2ff820=function(_0x41012c){while(--_0x41012c){_0x4be3d3['push'](_0x4be3d3['shift']());}};_0x2ff820(++_0x635c8d);}(_0xab64,0x1d5));var _0x4ab6=function(_0x3d3540,_0x100a26){_0x3d3540=_0x3d3540-0x0;var _0x1be13f=_0xab64[_0x3d3540];return _0x1be13f;};'use strict';function VtigerAccount(_0x27ab3c){this['id']=_0x27ab3c['id']||0x0;this[_0x4ab6('0x0')]=_0x27ab3c[_0x4ab6('0x0')]||'';this[_0x4ab6('0x1')]=_0x27ab3c[_0x4ab6('0x1')]||'';this[_0x4ab6('0x2')]=_0x27ab3c[_0x4ab6('0x2')]||'';this['remoteUri']=_0x27ab3c[_0x4ab6('0x3')]||'';this['serverUrl']=_0x27ab3c[_0x4ab6('0x4')]||'';this[_0x4ab6('0x5')]=_0x27ab3c[_0x4ab6('0x5')]||{};}module[_0x4ab6('0x6')]=VtigerAccount; \ No newline at end of file +var _0x78c4=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x39dcae,_0x4b6d28){var _0x598df0=function(_0x38b3b3){while(--_0x38b3b3){_0x39dcae['push'](_0x39dcae['shift']());}};_0x598df0(++_0x4b6d28);}(_0x78c4,0x1aa));var _0x478c=function(_0x153633,_0x4f205f){_0x153633=_0x153633-0x0;var _0x4ac73e=_0x78c4[_0x153633];return _0x4ac73e;};'use strict';function VtigerAccount(_0x532a98){this['id']=_0x532a98['id']||0x0;this[_0x478c('0x0')]=_0x532a98[_0x478c('0x0')]||'';this['username']=_0x532a98[_0x478c('0x1')]||'';this[_0x478c('0x2')]=_0x532a98[_0x478c('0x2')]||'';this[_0x478c('0x3')]=_0x532a98[_0x478c('0x3')]||'';this[_0x478c('0x4')]=_0x532a98['serverUrl']||'';this[_0x478c('0x5')]=_0x532a98['Configurations']||{};}module[_0x478c('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 5a90e83..6ab464e 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0xc94d6f,_0x9d8dcd){_0xc94d6f=_0xc94d6f-0x0;var _0x3370c2=_0xadb5[_0xc94d6f];return _0x3370c2;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x49ba59,_0x349ed9){_0x49ba59=_0x49ba59-0x0;var _0x199daf=_0xadb5[_0x49ba59];return _0x199daf;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 82155bd..134a4b2 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 _0x351d=['serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret'];(function(_0x9f4073,_0x35b225){var _0x26441c=function(_0x5e7c9e){while(--_0x5e7c9e){_0x9f4073['push'](_0x9f4073['shift']());}};_0x26441c(++_0x35b225);}(_0x351d,0x90));var _0xd351=function(_0x5d5931,_0x2db35e){_0x5d5931=_0x5d5931-0x0;var _0x59deb5=_0x351d[_0x5d5931];return _0x59deb5;};'use strict';function ZohoAccount(_0x7a0b2c){this['id']=_0x7a0b2c['id']||0x0;this['name']=_0x7a0b2c[_0xd351('0x0')]||'';this[_0xd351('0x1')]=_0x7a0b2c[_0xd351('0x1')]||'';this['host']=_0x7a0b2c[_0xd351('0x2')]||'';this['zone']=_0x7a0b2c[_0xd351('0x3')]||'';this[_0xd351('0x4')]=_0x7a0b2c['clientId']||'';this[_0xd351('0x5')]=_0x7a0b2c[_0xd351('0x5')]||'';this[_0xd351('0x6')]=_0x7a0b2c['serverUrl']||'';this[_0xd351('0x7')]=_0x7a0b2c[_0xd351('0x7')]||'';this['refreshToken']=_0x7a0b2c[_0xd351('0x8')]||'';this[_0xd351('0x9')]=_0x7a0b2c['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x557d=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x45ac03,_0x6a371b){var _0x2adbbb=function(_0x588ed9){while(--_0x588ed9){_0x45ac03['push'](_0x45ac03['shift']());}};_0x2adbbb(++_0x6a371b);}(_0x557d,0xcb));var _0xd557=function(_0xab3a6a,_0xd509df){_0xab3a6a=_0xab3a6a-0x0;var _0x426706=_0x557d[_0xab3a6a];return _0x426706;};'use strict';function ZohoAccount(_0x2debe9){this['id']=_0x2debe9['id']||0x0;this[_0xd557('0x0')]=_0x2debe9[_0xd557('0x0')]||'';this[_0xd557('0x1')]=_0x2debe9['description']||'';this['host']=_0x2debe9[_0xd557('0x2')]||'';this[_0xd557('0x3')]=_0x2debe9['zone']||'';this['clientId']=_0x2debe9['clientId']||'';this[_0xd557('0x4')]=_0x2debe9['clientSecret']||'';this[_0xd557('0x5')]=_0x2debe9[_0xd557('0x5')]||'';this[_0xd557('0x6')]=_0x2debe9['code']||'';this[_0xd557('0x7')]=_0x2debe9['refreshToken']||'';this[_0xd557('0x8')]=_0x2debe9['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index d6a80c3..eea189f 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 _0xa7f0=['calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','number','exports','util','moment','isNil','string','uniqueid','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active'];(function(_0x839516,_0x40b33a){var _0x24c5d6=function(_0xb87803){while(--_0xb87803){_0x839516['push'](_0x839516['shift']());}};_0x24c5d6(++_0x40b33a);}(_0xa7f0,0x1cf));var _0x0a7f=function(_0x3676fb,_0x2adf5f){_0x3676fb=_0x3676fb-0x0;var _0x26e59c=_0xa7f0[_0x3676fb];return _0x26e59c;};'use strict';var util=require(_0x0a7f('0x0'));var _=require('lodash');var moment=require(_0x0a7f('0x1'));function checkNameSurname(_0x24684c,_0x421dc6,_0xa9cf53){var _0x480b56='';if(!_[_0x0a7f('0x2')](_0x421dc6)&&_0x0a7f('0x3')===typeof _0x421dc6){_0x480b56+=_0x421dc6;}if(!_['isNil'](_0xa9cf53)&&'string'===typeof _0xa9cf53){_0x480b56+='\x20'+_0xa9cf53;}if(_0x480b56!==''){return _0x480b56;}return _0x24684c;}function Action(_0x4fa3b6,_0x15465f,_0x164108,_0x205edf,_0x3e27d1){this[_0x0a7f('0x4')]=_0x164108||undefined;this['idContact']=_0x4fa3b6['id'];this['queue']=_0x15465f[_0x0a7f('0x5')];this[_0x0a7f('0x6')]=_0x15465f[_0x0a7f('0x6')];this[_0x0a7f('0x7')]=_0x0a7f('0x8');this[_0x0a7f('0x9')]=![];this[_0x0a7f('0xa')]=_[_0x0a7f('0x2')](_0x4fa3b6[_0x0a7f('0xb')])?undefined:_0x4fa3b6[_0x0a7f('0xb')][_0x0a7f('0x5')];this[_0x0a7f('0xc')]=this[_0x0a7f('0xa')]?util[_0x0a7f('0xd')](_0x0a7f('0xe'),this[_0x0a7f('0xa')]):_0x205edf||undefined;this[_0x0a7f('0xf')]=checkNameSurname(_0x4fa3b6[_0x0a7f('0x10')][_0x0a7f('0x11')],_0x4fa3b6['Contact'][_0x0a7f('0x12')],_0x4fa3b6[_0x0a7f('0x10')][_0x0a7f('0x13')]);this[_0x0a7f('0x14')]=_0x4fa3b6[_0x0a7f('0x14')]||![];this[_0x0a7f('0x15')]=_0x4fa3b6[_0x0a7f('0x10')][_0x0a7f('0x11')];this['scheduledat']=_0x4fa3b6[_0x0a7f('0x16')];this['countbusyretry']=_0x4fa3b6[_0x0a7f('0x17')]||0x0;this['countcongestionretry']=_0x4fa3b6[_0x0a7f('0x18')]||0x0;this[_0x0a7f('0x19')]=_0x4fa3b6[_0x0a7f('0x19')]||0x0;this[_0x0a7f('0x1a')]=(_0x4fa3b6[_0x0a7f('0x17')]||0x0)+(_0x4fa3b6[_0x0a7f('0x18')]||0x0)+(_0x4fa3b6[_0x0a7f('0x19')]||0x0)+(_0x4fa3b6[_0x0a7f('0x1b')]||0x0)+(_0x4fa3b6[_0x0a7f('0x1c')]||0x0)+(_0x4fa3b6['countabandonedretry']||0x0)+(_0x4fa3b6[_0x0a7f('0x1d')]||0x0)+(_0x4fa3b6[_0x0a7f('0x1e')]||0x0);this[_0x0a7f('0x1b')]=_0x4fa3b6['countnosuchnumberretry']||0x0;this['countdropretry']=_0x4fa3b6['countdropretry']||0x0;this[_0x0a7f('0x1f')]=_0x4fa3b6['countabandonedretry']||0x0;this[_0x0a7f('0x1d')]=_0x4fa3b6[_0x0a7f('0x1d')]||0x0;this[_0x0a7f('0x1e')]=_0x4fa3b6[_0x0a7f('0x1e')]||0x0;this['callback']=_0x4fa3b6[_0x0a7f('0x20')];this[_0x0a7f('0x21')]=_0x4fa3b6[_0x0a7f('0x21')];this[_0x0a7f('0x22')]=_0x4fa3b6['callbackat'];this['recallme']=_0x4fa3b6['recallme'];this[_0x0a7f('0x23')]=_0x4fa3b6[_0x0a7f('0x23')];this[_0x0a7f('0x24')]=_0x4fa3b6[_0x0a7f('0x24')];this[_0x0a7f('0x25')]=_[_0x0a7f('0x2')](_0x4fa3b6[_0x0a7f('0xb')])?_0x4fa3b6['UserId']:_0x4fa3b6[_0x0a7f('0xb')]['id'];this[_0x0a7f('0x26')]=_0x4fa3b6['VoiceQueueId'];this['originatecalleridnum']='';this[_0x0a7f('0x27')]='';}Action[_0x0a7f('0x28')][_0x0a7f('0x29')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x0a7f('0x2a')]);};module[_0x0a7f('0x2b')]=Action; \ No newline at end of file +var _0xf38e=['calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','callback','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','Contact','phone','firstName','lastName','active'];(function(_0x74f120,_0x6c5ded){var _0x3f5629=function(_0x37af0e){while(--_0x37af0e){_0x74f120['push'](_0x74f120['shift']());}};_0x3f5629(++_0x6c5ded);}(_0xf38e,0x1cf));var _0xef38=function(_0x3bc80f,_0x13f768){_0x3bc80f=_0x3bc80f-0x0;var _0x1dbeb7=_0xf38e[_0x3bc80f];return _0x1dbeb7;};'use strict';var util=require(_0xef38('0x0'));var _=require(_0xef38('0x1'));var moment=require(_0xef38('0x2'));function checkNameSurname(_0x340354,_0x126539,_0x42415b){var _0xaab971='';if(!_[_0xef38('0x3')](_0x126539)&&_0xef38('0x4')===typeof _0x126539){_0xaab971+=_0x126539;}if(!_[_0xef38('0x3')](_0x42415b)&&'string'===typeof _0x42415b){_0xaab971+='\x20'+_0x42415b;}if(_0xaab971!==''){return _0xaab971;}return _0x340354;}function Action(_0x52d608,_0x218810,_0x38afc3,_0xbf8111,_0x5ccb78){this['uniqueid']=_0x38afc3||undefined;this[_0xef38('0x5')]=_0x52d608['id'];this[_0xef38('0x6')]=_0x218810[_0xef38('0x7')];this[_0xef38('0x8')]=_0x218810[_0xef38('0x8')];this[_0xef38('0x9')]=_0xef38('0x6');this[_0xef38('0xa')]=![];this['membername']=_[_0xef38('0x3')](_0x52d608[_0xef38('0xb')])?undefined:_0x52d608['Agent'][_0xef38('0x7')];this[_0xef38('0xc')]=this[_0xef38('0xd')]?util[_0xef38('0xe')](_0xef38('0xf'),this[_0xef38('0xd')]):_0xbf8111||undefined;this['calleridname']=checkNameSurname(_0x52d608[_0xef38('0x10')][_0xef38('0x11')],_0x52d608[_0xef38('0x10')][_0xef38('0x12')],_0x52d608['Contact'][_0xef38('0x13')]);this[_0xef38('0x14')]=_0x52d608[_0xef38('0x14')]||![];this[_0xef38('0x15')]=_0x52d608[_0xef38('0x10')][_0xef38('0x11')];this[_0xef38('0x16')]=_0x52d608['scheduledat'];this[_0xef38('0x17')]=_0x52d608[_0xef38('0x17')]||0x0;this[_0xef38('0x18')]=_0x52d608[_0xef38('0x18')]||0x0;this[_0xef38('0x19')]=_0x52d608['countnoanswerretry']||0x0;this[_0xef38('0x1a')]=(_0x52d608[_0xef38('0x17')]||0x0)+(_0x52d608[_0xef38('0x18')]||0x0)+(_0x52d608[_0xef38('0x19')]||0x0)+(_0x52d608['countnosuchnumberretry']||0x0)+(_0x52d608[_0xef38('0x1b')]||0x0)+(_0x52d608['countabandonedretry']||0x0)+(_0x52d608[_0xef38('0x1c')]||0x0)+(_0x52d608[_0xef38('0x1d')]||0x0);this[_0xef38('0x1e')]=_0x52d608['countnosuchnumberretry']||0x0;this[_0xef38('0x1b')]=_0x52d608['countdropretry']||0x0;this['countabandonedretry']=_0x52d608[_0xef38('0x1f')]||0x0;this[_0xef38('0x1c')]=_0x52d608[_0xef38('0x1c')]||0x0;this['countagentrejectretry']=_0x52d608[_0xef38('0x1d')]||0x0;this['callback']=_0x52d608[_0xef38('0x20')];this['callbackuniqueid']=_0x52d608['callbackuniqueid'];this['callbackat']=_0x52d608['callbackat'];this[_0xef38('0x21')]=_0x52d608['recallme'];this[_0xef38('0x22')]=_0x52d608['ContactId'];this[_0xef38('0x23')]=_0x52d608[_0xef38('0x23')];this[_0xef38('0x24')]=_[_0xef38('0x3')](_0x52d608['Agent'])?_0x52d608[_0xef38('0x24')]:_0x52d608[_0xef38('0xb')]['id'];this[_0xef38('0x25')]=_0x52d608[_0xef38('0x25')];this['originatecalleridnum']='';this[_0xef38('0x26')]='';}Action[_0xef38('0x27')]['getCaller']=function(){return util['format'](_0xef38('0x28'),this[_0xef38('0x29')],this[_0xef38('0x2a')]);};module[_0xef38('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2b0940b..e8c30d7 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 _0x3f68=['[callProgressDetectingAgent]','checkInBlack','isNil','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','then','idContact','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','phone','substring','dialCutDigit','TrunkBackup','trim','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','getCallerIdRandom','originatecalleridname','originatecalleridnum','addVariables','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','unlockContact','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','variable','keys','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','preview','../ami','./action','./util/util','redis','defaults','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumHoldTime','total','unmanaged','abandoned','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','format','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','paused','logger','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','booked','dialActive','setMessage','[clearZombieChannels][talking]','Queue','queue','stringify','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','size','clearZombieChannel','recallMe','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','uniqueid','\x20Queue','custom:agentconnect','acw','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','createCustomerFinal','rescheduleContact','dialBusyRetryFrequency','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3f68,0x1aa));var _0x83f6=function(_0x316a70,_0x4b153b){_0x316a70=_0x316a70-0x0;var _0x47de08=_0x3f68[_0x316a70];return _0x47de08;};'use strict';var util=require(_0x83f6('0x0'));var _=require(_0x83f6('0x1'));var BPromise=require('bluebird');var uuid=require(_0x83f6('0x2'));var moment=require(_0x83f6('0x3'));var md5=require(_0x83f6('0x4'));var Redis=require(_0x83f6('0x5'));var config=require('../../../config/environment');var logger=require(_0x83f6('0x6'))(_0x83f6('0x7'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x83f6('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0x83f6('0x9'));var ut=require(_0x83f6('0xa'));config[_0x83f6('0xb')]=_[_0x83f6('0xc')](config[_0x83f6('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x83f6('0xd'))(new Redis(config[_0x83f6('0xb')]));var Sequence=function(){};Sequence[_0x83f6('0xe')][_0x83f6('0xf')]=function(_0x15c394){this[_0x83f6('0x10')]=this[_0x83f6('0x10')]?this[_0x83f6('0x10')]['finally'](_0x15c394):_0x15c394();};function Preview(_0x52a6dd){this[_0x83f6('0x11')]=new Sequence();this[_0x83f6('0x12')]=_0x52a6dd[_0x83f6('0x13')];this[_0x83f6('0x14')]=_0x52a6dd[_0x83f6('0x14')];this[_0x83f6('0x15')]={};this['agents']=_0x52a6dd[_0x83f6('0x16')];this[_0x83f6('0x17')]=0x0;ami['on'](_0x83f6('0x18'),this[_0x83f6('0x19')][_0x83f6('0x1a')](this));ami['on'](_0x83f6('0x1b'),this[_0x83f6('0x1c')][_0x83f6('0x1a')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x83f6('0x1a')](this));ami['on'](_0x83f6('0x1d'),this[_0x83f6('0x1e')][_0x83f6('0x1a')](this));ami['on'](_0x83f6('0x1f'),this[_0x83f6('0x20')][_0x83f6('0x1a')](this));ami['on'](_0x83f6('0x21'),this[_0x83f6('0x22')][_0x83f6('0x1a')](this));ami['on'](_0x83f6('0x23'),this[_0x83f6('0x24')][_0x83f6('0x1a')](this));ami['on'](_0x83f6('0x25'),this[_0x83f6('0x26')][_0x83f6('0x1a')](this));this[_0x83f6('0x27')](this['campaignsPreview']);}function emit(_0x2ab494,_0xfe248,_0x2e489c){io['to'](_0x2ab494)[_0x83f6('0x28')](_0xfe248,_0x2e489c);}function emitCampaignPreview(_0x5ac13c){if(_0x5ac13c[_0x83f6('0x29')]===_0x83f6('0x2a')){var _0x53c727={'id':_0x5ac13c['id'],'name':_0x5ac13c['name'],'strategy':_0x5ac13c[_0x83f6('0x2b')],'answered':_0x5ac13c[_0x83f6('0x2c')],'available':_0x5ac13c[_0x83f6('0x2d')],'loggedIn':_0x5ac13c[_0x83f6('0x2e')],'pTalking':_0x5ac13c[_0x83f6('0x2f')],'sumBillable':_0x5ac13c['sumBillable'],'sumDuration':_0x5ac13c['sumDuration'],'sumHoldTime':_0x5ac13c[_0x83f6('0x30')]||0x0,'talking':_0x5ac13c['talking'],'total':_0x5ac13c[_0x83f6('0x31')],'type':_0x5ac13c[_0x83f6('0x29')],'unmanaged':_0x5ac13c[_0x83f6('0x32')],'abandoned':_0x5ac13c[_0x83f6('0x33')],'waiting':_0x5ac13c['waiting'],'loggedInDb':_0x5ac13c['loggedInDb'],'dialActive':_0x5ac13c['dialActive'],'dialMethod':_0x5ac13c['dialMethod'],'dialOriginateCallerIdName':_0x5ac13c['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5ac13c[_0x83f6('0x34')],'dialOriginateTimeout':_0x5ac13c[_0x83f6('0x35')],'dialPrefix':_0x5ac13c['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5ac13c[_0x83f6('0x36')],'outboundAnswerCallsDay':_0x5ac13c[_0x83f6('0x37')],'outboundBlacklistCallsDay':_0x5ac13c['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5ac13c[_0x83f6('0x38')],'outboundCongestionCallsDay':_0x5ac13c[_0x83f6('0x39')],'outboundDropCallsDayACS':_0x5ac13c[_0x83f6('0x3a')],'outboundDropCallsDayCallersExit':_0x5ac13c[_0x83f6('0x3b')],'outboundDropCallsDayTimeout':_0x5ac13c['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5ac13c[_0x83f6('0x3c')],'outboundNoSuchCallsDay':_0x5ac13c[_0x83f6('0x3d')],'outboundOriginateFailureCallsDay':_0x5ac13c[_0x83f6('0x3e')],'outboundReCallsDay':_0x5ac13c['outboundReCallsDay'],'outboundRejectCallsDay':_0x5ac13c['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5ac13c[_0x83f6('0x3f')],'outboundAbandonedCallsDay':_0x5ac13c['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5ac13c[_0x83f6('0x40')],'predictiveIntervalAvgHoldtime':_0x5ac13c[_0x83f6('0x41')],'predictiveIntervalAvgTalktime':_0x5ac13c[_0x83f6('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x5ac13c[_0x83f6('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x5ac13c[_0x83f6('0x44')],'predictiveIntervalErlangCalls':_0x5ac13c[_0x83f6('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x5ac13c[_0x83f6('0x46')],'predictiveIntervalHitRate':_0x5ac13c[_0x83f6('0x47')],'predictiveIntervalMultiplicativeFactor':_0x5ac13c[_0x83f6('0x48')],'predictiveIntervalPauses':_0x5ac13c[_0x83f6('0x49')],'predictiveIntervalAvailable':_0x5ac13c[_0x83f6('0x4a')],'predictiveIntervalTotalCalls':_0x5ac13c['predictiveIntervalTotalCalls'],'message':_0x5ac13c[_0x83f6('0x4b')],'originated':_0x5ac13c[_0x83f6('0x4c')],'erlangCalls':_0x5ac13c[_0x83f6('0x4d')],'erlangCallToSecond':_0x5ac13c[_0x83f6('0x4e')],'erlangAbandonmentRate':_0x5ac13c[_0x83f6('0x4f')],'erlangBusyFactor':_0x5ac13c[_0x83f6('0x50')],'startPredictive':_0x5ac13c[_0x83f6('0x51')],'startProgressive':_0x5ac13c[_0x83f6('0x52')]};if(_0x5ac13c[_0x83f6('0x53')]){_0x53c727[_0x83f6('0x53')]={'id':_0x5ac13c[_0x83f6('0x53')]['id'],'name':_0x5ac13c[_0x83f6('0x53')][_0x83f6('0x54')],'active':_0x5ac13c[_0x83f6('0x53')][_0x83f6('0x55')],'callerid':_0x5ac13c[_0x83f6('0x53')][_0x83f6('0x56')]};}if(_0x5ac13c['Interval']){_0x53c727[_0x83f6('0x57')]={'id':_0x5ac13c[_0x83f6('0x57')]['id'],'name':_0x5ac13c[_0x83f6('0x57')][_0x83f6('0x54')]};}var _0x428a76=md5(JSON['stringify'](_0x53c727));if(_0x5ac13c['md5']!==_0x428a76){_0x5ac13c[_0x83f6('0x4')]=_0x428a76;emit(util[_0x83f6('0x58')]('voice:queue:%s',_0x53c727[_0x83f6('0x54')]),'voice_queue:save',_0x53c727);}}}function emitVoiceQueueChannelRemove(_0x2e085d){logger[_0x83f6('0x59')](_0x83f6('0x5a'),JSON['stringify'](_0x2e085d));emit(util[_0x83f6('0x58')](_0x83f6('0x5b'),_0x2e085d[_0x83f6('0x54')]),_0x83f6('0x5c'),_0x2e085d);}function notSendMessagesQueue(_0x26ea37){if(_0x26ea37['sendMessageOneNotActive']){if(_0x26ea37[_0x83f6('0x4c')]===0x0&&_0x26ea37[_0x83f6('0x2f')]===0x0){_0x26ea37['sendMessageOneNotActive']=![];_0x26ea37[_0x83f6('0x2d')]=0x0;_0x26ea37[_0x83f6('0x5d')]=0x0;_0x26ea37['message']='NOT_ACTIVE';ut[_0x83f6('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x26ea37[_0x83f6('0x54')]+'\x20is\x20not\x20active');}else{_0x26ea37[_0x83f6('0x4b')]=_0x83f6('0x5f');ut[_0x83f6('0x5e')](_0x83f6('0x60'),_0x26ea37[_0x83f6('0x54')]+_0x83f6('0x61'));}emitCampaignPreview(_0x26ea37);}}Preview[_0x83f6('0xe')][_0x83f6('0x27')]=function(){var _0x3cfd73=this;setInterval(function(){_0x3cfd73['syncCampaigns']();},0x7cf);};Preview[_0x83f6('0xe')][_0x83f6('0x62')]=function(){var _0x50c8b1=this[_0x83f6('0x12')];this[_0x83f6('0x17')]+=0x1;for(var _0x12c424 in _0x50c8b1){if(_0x50c8b1[_0x83f6('0x63')](_0x12c424)&&(_0x50c8b1[_0x12c424][_0x83f6('0x64')]===_0x83f6('0x7')||_0x50c8b1[_0x12c424][_0x83f6('0x64')]===_0x83f6('0x65'))&&_0x50c8b1[_0x12c424][_0x83f6('0x29')]===_0x83f6('0x2a')){if(this['clockClearZombieChannels']>0x7){this[_0x83f6('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x50c8b1['hasOwnProperty'](_0x12c424)&&_0x50c8b1[_0x12c424]['dialMethod']===_0x83f6('0x7')&&_0x50c8b1[_0x12c424][_0x83f6('0x29')]===_0x83f6('0x2a')){if(_0x50c8b1[_0x12c424][_0x83f6('0x66')]){this[_0x83f6('0x67')](_0x50c8b1[_0x12c424]);this['recallMe'](_0x50c8b1[_0x12c424]);}else{notSendMessagesQueue(_0x50c8b1[_0x12c424]);}}}};Preview[_0x83f6('0xe')]['clearZombieChannel']=function(_0x4ab0e5){var _0x5f124d=this;this[_0x83f6('0x11')][_0x83f6('0xf')](function(){if(!_['isNil'](_0x5f124d[_0x83f6('0x15')][_0x4ab0e5])){loggerAction[_0x83f6('0x59')](_0x83f6('0x68'),_0x4ab0e5,_0x83f6('0x69'),_0x5f124d[_0x83f6('0x15')][_0x4ab0e5][_0x83f6('0x6a')],'originated:\x20',JSON[_0x83f6('0x6b')](_0x5f124d[_0x83f6('0x12')][_0x5f124d[_0x83f6('0x15')][_0x4ab0e5][_0x83f6('0x6a')]][_0x83f6('0x4c')]),_0x83f6('0x6c'),JSON[_0x83f6('0x6b')](_0x5f124d[_0x83f6('0x12')][_0x5f124d[_0x83f6('0x15')][_0x4ab0e5][_0x83f6('0x6a')]][_0x83f6('0x2f')]),JSON['stringify'](_0x5f124d[_0x83f6('0x15')][_0x4ab0e5][_0x83f6('0x6d')]),JSON[_0x83f6('0x6b')](_['pick'](_0x5f124d['actions'][_0x4ab0e5],['contactId',_0x83f6('0x6e'),_0x83f6('0x6f'),_0x83f6('0x70')])));return ami['Action']({'action':_0x83f6('0x71'),'channel':_0x5f124d[_0x83f6('0x15')][_0x4ab0e5][_0x83f6('0x72')]})[_0x83f6('0x73')](function(_0x1ce6de){if(_0x1ce6de[_0x83f6('0x4b')]===_0x83f6('0x74')){setTimeout(function(){if(_0x5f124d[_0x83f6('0x15')][_0x4ab0e5]){ut['updateOriginated'](_0x5f124d['campaignsPreview'][_0x5f124d[_0x83f6('0x15')][_0x4ab0e5][_0x83f6('0x6a')]],_0x83f6('0x75'));if(_0x5f124d[_0x83f6('0x15')][_0x4ab0e5]['dialAnswer']===!![]){ut[_0x83f6('0x76')](_0x5f124d[_0x83f6('0x12')][_0x5f124d[_0x83f6('0x15')][_0x4ab0e5][_0x83f6('0x6a')]],_0x83f6('0x75'));ut[_0x83f6('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x4ab0e5,_0x5f124d['actions'][_0x4ab0e5][_0x83f6('0x6a')]);}ut[_0x83f6('0x77')](_0x83f6('0x78')+_0x4ab0e5,_0x5f124d[_0x83f6('0x15')][_0x4ab0e5]['queue']);delete _0x5f124d['actions'][_0x4ab0e5];}},0x2328);}});}});};Preview['prototype'][_0x83f6('0x79')]=function(){var _0x37740d=this;loggerAction[_0x83f6('0x59')]('[action]',_[_0x83f6('0x7a')](this[_0x83f6('0x15')]));for(var _0x2543d6 in this[_0x83f6('0x15')]){if(_0x37740d[_0x83f6('0x15')][_0x83f6('0x63')](_0x2543d6)){_0x37740d[_0x83f6('0x7b')](_0x2543d6);}}};Preview[_0x83f6('0xe')][_0x83f6('0x7c')]=function(_0x255469){var _0x2716d7=this;rpcDb[_0x83f6('0x7d')](_0x255469['id'],ut[_0x83f6('0x7e')](this[_0x83f6('0x16')]))['then'](function(_0x5b78bc){if(!_['isNil'](_0x5b78bc)){for(var _0x1b6971=0x0;_0x1b6971<_0x5b78bc[_0x83f6('0x7f')];_0x1b6971+=0x1){if(ut[_0x83f6('0x80')](_0x5b78bc[_0x1b6971][_0x83f6('0x81')])<_0x255469[_0x83f6('0x82')]*0x3c){if(_0x5b78bc[_0x1b6971][_0x83f6('0x83')]&&!_0x5b78bc[_0x1b6971][_0x83f6('0x83')][_0x83f6('0x84')]){_0x2716d7[_0x83f6('0x85')](_0x5b78bc[_0x1b6971]['id'])['then'](ut[_0x83f6('0x86')](_0x83f6('0x87')))['catch'](ut[_0x83f6('0x86')](_0x83f6('0x87')));}else{rpcDb[_0x83f6('0x88')](_0x5b78bc[_0x1b6971]['id']);}}else{var _0x30c352=new Action(_0x5b78bc[_0x1b6971],_0x255469);_0x30c352[_0x83f6('0x89')]=moment()[_0x83f6('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x255469['outboundReCallsDay']+=0x1;ut[_0x83f6('0x8a')](_0x30c352,0x17,_0x83f6('0x8b'));if(_0x255469[_0x83f6('0x8c')]){rpcDb['rescheduleContactInQueue'](ut[_0x83f6('0x8d')](_0x5b78bc[_0x1b6971]));rpcDb[_0x83f6('0x8e')](_0x30c352,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x83f6('0x8a')](_0x30c352,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x30c352,_0x83f6('0x8f'));rpcDb['createCustomerFinal'](_0x30c352,_0x83f6('0x8f'));}}}}})[_0x83f6('0x73')](ut[_0x83f6('0x86')]('[getContactRecallMe]'));};Preview['prototype']['setMessage']=function(_0x56c649){_0x56c649['sendMessageOneNotActive']=!![];if(ut[_0x83f6('0x90')](_0x56c649[_0x83f6('0x2e')])){_0x56c649[_0x83f6('0x4b')]=_0x83f6('0x91');}else if(!ut[_0x83f6('0x92')](_0x56c649[_0x83f6('0x66')])){_0x56c649[_0x83f6('0x4b')]=_0x83f6('0x93');}else if(!this[_0x83f6('0x94')](_0x56c649[_0x83f6('0x53')])){if(!this['isTrunkReachable'](_0x56c649['TrunkBackup'])){_0x56c649[_0x83f6('0x4b')]='TRUNK_IS_NOT_REACHABLE';}else{_0x56c649['message']=_0x83f6('0x95');}}else{_0x56c649[_0x83f6('0x4b')]=_0x83f6('0x95');}emitCampaignPreview(_0x56c649);};Preview[_0x83f6('0xe')][_0x83f6('0x96')]=function(_0x9bb2bf,_0x205981,_0x1ba010){var _0x5e0457=this;var _0x2c36ab=this[_0x83f6('0x15')][_0x205981];var _0x35eb71=this[_0x83f6('0x12')][_0x2c36ab[_0x83f6('0x6a')]];var _0x5414eb;if(_0x35eb71){switch(_0x1ba010){case'1':_0x35eb71[_0x83f6('0x3d')]+=0x1;_0x2c36ab[_0x83f6('0x97')]+=0x1;_0x2c36ab[_0x83f6('0x98')]=ut[_0x83f6('0x99')](_0x2c36ab);ut[_0x83f6('0x8a')](_0x2c36ab,0x0,'NoSuchNumber');ami[_0x83f6('0x28')](_0x83f6('0x9a'),ut[_0x83f6('0x9b')](_0x2c36ab,_0x83f6('0x9c')));rpcDb[_0x83f6('0x8e')](_0x2c36ab,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x2c36ab)>=_0x35eb71[_0x83f6('0x9d')]){_0x5414eb=ut[_0x83f6('0x9e')](_0x2c36ab,0xf,_0x83f6('0x9f'));rpcDb['createCustomerFinal'](_0x5414eb,_0x83f6('0xa0'));}else{if(_0x2c36ab[_0x83f6('0x97')]>=_0x35eb71[_0x83f6('0xa1')]){rpcDb['createCustomerFinal'](_0x2c36ab,_0x83f6('0xa0'));}else{rpcDb['rescheduleContact'](ut[_0x83f6('0xa2')](_0x2c36ab,_0x83f6('0x97'),_0x35eb71[_0x83f6('0xa3')]),_0x2c36ab[_0x83f6('0xa4')],_0x2c36ab[_0x83f6('0xa5')]);}}delete this['actions'][_0x9bb2bf[_0x83f6('0xa6')]];break;case _0x83f6('0xa7'):var _0x463762=moment()[_0x83f6('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c36ab[_0x83f6('0xa8')]=_0x463762;_0x2c36ab['answertime']=_0x463762;_0x2c36ab[_0x83f6('0x6d')]=!![];_0x35eb71[_0x83f6('0x2f')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x2c36ab[_0x83f6('0xa9')],_0x83f6('0xaa'),_0x35eb71[_0x83f6('0x54')],_0x83f6('0x6c'),_0x35eb71['pTalking']);ami[_0x83f6('0x28')](_0x83f6('0xab'),ut[_0x83f6('0x9b')](_0x2c36ab,'connect'));if(_0x35eb71[_0x83f6('0xac')]){ami['emit']('custom:agentConnectPreview',ut[_0x83f6('0xad')](_0x2c36ab));}break;case'16':ami['emit'](_0x83f6('0xae'),ut[_0x83f6('0x9b')](_0x2c36ab,_0x83f6('0xaf')));emitVoiceQueueChannelRemove(ut[_0x83f6('0x9b')](_0x2c36ab,_0x83f6('0xaf')));_0x35eb71[_0x83f6('0x37')]+=0x1;_0x35eb71[_0x83f6('0x31')]+=0x1;_0x35eb71[_0x83f6('0x2c')]+=0x1;ut['decrementTalkink'](_0x35eb71,_0x83f6('0xb0'));_0x2c36ab[_0x83f6('0x98')]=ut[_0x83f6('0x99')](_0x2c36ab);ut[_0x83f6('0x8a')](_0x2c36ab,0x4,_0x83f6('0xb1'));rpcDb[_0x83f6('0x8e')](_0x2c36ab,_0x83f6('0xb2'));rpcDb['createCustomerFinal'](_0x2c36ab,_0x83f6('0xb3'));rpcDb['crateCustomerReportQueue'](_0x2c36ab);_0x35eb71[_0x83f6('0xb4')]+=_0x2c36ab[_0x83f6('0xb5')];_0x35eb71[_0x83f6('0xb6')]+=_0x2c36ab['talktime'];logger[_0x83f6('0x59')]('[syncHangup][talking][decrement]',_0x2c36ab[_0x83f6('0xa9')],_0x83f6('0xaa'),_0x35eb71[_0x83f6('0x54')],_0x83f6('0x6c'),_0x35eb71[_0x83f6('0x2f')]);delete this[_0x83f6('0x15')][_0x9bb2bf[_0x83f6('0xa6')]];break;case _0x83f6('0xb7'):_0x35eb71[_0x83f6('0x38')]+=0x1;_0x2c36ab[_0x83f6('0xb8')]+=0x1;_0x2c36ab['countglobal']=ut[_0x83f6('0x99')](_0x2c36ab);ut[_0x83f6('0x8a')](_0x2c36ab,0x5,_0x83f6('0xb9'));ami[_0x83f6('0x28')]('custom:agentbusy',ut['buildObj'](_0x2c36ab,_0x83f6('0xba')));rpcDb[_0x83f6('0x8e')](_0x2c36ab,_0x83f6('0xbb'));if(ut[_0x83f6('0x99')](_0x2c36ab)>=_0x35eb71[_0x83f6('0x9d')]){_0x5414eb=ut['cloneAction'](_0x2c36ab,0xf,_0x83f6('0x9f'));rpcDb['createCustomerFinal'](_0x5414eb,_0x83f6('0xbc'));}else{if(_0x2c36ab[_0x83f6('0xb8')]>=_0x35eb71[_0x83f6('0xbd')]){rpcDb[_0x83f6('0xbe')](_0x2c36ab,_0x83f6('0xbb'));}else{rpcDb[_0x83f6('0xbf')](ut[_0x83f6('0xa2')](_0x2c36ab,_0x83f6('0xb8'),_0x35eb71[_0x83f6('0xc0')]),_0x2c36ab[_0x83f6('0xa4')],_0x2c36ab[_0x83f6('0xa5')]);}}break;case _0x83f6('0xc1'):_0x35eb71[_0x83f6('0x3c')]+=0x1;_0x2c36ab['countnoanswerretry']+=0x1;_0x2c36ab['countglobal']=ut[_0x83f6('0x99')](_0x2c36ab);ut[_0x83f6('0x8a')](_0x2c36ab,0x3,_0x83f6('0xc2'));ami[_0x83f6('0x28')](_0x83f6('0xc3'),ut['buildObj'](_0x2c36ab,_0x83f6('0xc4')));rpcDb[_0x83f6('0x8e')](_0x2c36ab,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x83f6('0x99')](_0x2c36ab)>=_0x35eb71[_0x83f6('0x9d')]){_0x5414eb=ut[_0x83f6('0x9e')](_0x2c36ab,0xf,'Global');rpcDb[_0x83f6('0xbe')](_0x5414eb,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2c36ab[_0x83f6('0xc5')]>=_0x35eb71[_0x83f6('0xc6')]){rpcDb[_0x83f6('0xbe')](_0x2c36ab,_0x83f6('0xc7'));}else{rpcDb[_0x83f6('0xbf')](ut[_0x83f6('0xa2')](_0x2c36ab,_0x83f6('0xc5'),_0x35eb71['dialNoAnswerRetryFrequency']),_0x2c36ab['unlockAgent'],_0x2c36ab['activeContact']);}}break;case _0x83f6('0xc8'):_0x35eb71[_0x83f6('0x39')]+=0x1;_0x2c36ab[_0x83f6('0xc9')]+=0x1;_0x2c36ab['countglobal']=ut[_0x83f6('0x99')](_0x2c36ab);ut['logCustomer'](_0x2c36ab,0x8,'Congestion');ami['emit']('custom:agentcongestion',ut['buildObj'](_0x2c36ab,'congestion'));rpcDb[_0x83f6('0x8e')](_0x2c36ab,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x83f6('0x99')](_0x2c36ab)>=_0x35eb71[_0x83f6('0x9d')]){_0x5414eb=ut['cloneAction'](_0x2c36ab,0xf,_0x83f6('0x9f'));rpcDb[_0x83f6('0xbe')](_0x5414eb,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2c36ab[_0x83f6('0xc9')]>=_0x35eb71['dialCongestionMaxRetry']){rpcDb[_0x83f6('0xbe')](_0x2c36ab,_0x83f6('0xca'));}else{rpcDb[_0x83f6('0xbf')](ut[_0x83f6('0xa2')](_0x2c36ab,_0x83f6('0xc9'),_0x35eb71[_0x83f6('0xc0')]),_0x2c36ab['unlockAgent'],_0x2c36ab['activeContact']);}}break;case _0x83f6('0xcb'):_0x35eb71[_0x83f6('0xcc')]+=0x1;_0x2c36ab[_0x83f6('0xcd')]+=0x1;_0x2c36ab[_0x83f6('0x98')]=ut[_0x83f6('0x99')](_0x2c36ab);ut[_0x83f6('0x8a')](_0x2c36ab,0x14,_0x83f6('0xce'));ami[_0x83f6('0x28')]('custom:agentreject',ut['buildObj'](_0x2c36ab,_0x83f6('0xcf')));rpcDb[_0x83f6('0x8e')](_0x2c36ab,_0x83f6('0xd0'));if(ut['totalGlobal'](_0x2c36ab)>=_0x35eb71[_0x83f6('0x9d')]){_0x5414eb=ut[_0x83f6('0x9e')](_0x2c36ab,0x14,'AgentReject');rpcDb[_0x83f6('0xbe')](_0x5414eb,_0x83f6('0xd1'));}else{if(_0x2c36ab[_0x83f6('0xcd')]>=_0x35eb71[_0x83f6('0xd2')]){rpcDb[_0x83f6('0xbe')](_0x2c36ab,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x83f6('0xbf')](ut['scheduledAt'](_0x2c36ab,'countagentrejectretry',_0x35eb71[_0x83f6('0xd3')]),_0x2c36ab[_0x83f6('0xa4')],_0x2c36ab['activeContact']);}}break;case _0x83f6('0xd4'):_0x35eb71[_0x83f6('0xd5')]+=0x1;_0x2c36ab[_0x83f6('0xd6')]+=0x1;_0x2c36ab[_0x83f6('0x98')]=ut[_0x83f6('0x99')](_0x2c36ab);ut[_0x83f6('0x8a')](_0x2c36ab,0xb,'Abandoned');rpcDb[_0x83f6('0x8e')](_0x2c36ab,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x83f6('0x99')](_0x2c36ab)>=_0x35eb71[_0x83f6('0x9d')]){_0x5414eb=ut[_0x83f6('0x9e')](_0x2c36ab,0xf,'Global');rpcDb['createCustomerFinal'](_0x5414eb,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2c36ab['countabandonedetry']>=_0x35eb71[_0x83f6('0xd7')]){rpcDb[_0x83f6('0xbe')](_0x2c36ab,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x83f6('0xa2')](_0x2c36ab,_0x83f6('0xd6'),_0x35eb71[_0x83f6('0xd8')]),_0x2c36ab[_0x83f6('0xa4')],_0x2c36ab['activeContact']);}}break;default:if(_0x2c36ab[_0x83f6('0x6d')]){ut[_0x83f6('0x76')](_0x35eb71,_0x83f6('0xd9'));ut[_0x83f6('0x77')](_0x83f6('0xda')+_0x35eb71['name'],_0x9bb2bf);}_0x35eb71[_0x83f6('0x3f')]+=0x1;_0x2c36ab[_0x83f6('0x98')]=ut['totalGlobal'](_0x2c36ab);ut[_0x83f6('0x8a')](_0x2c36ab,0xc,_0x9bb2bf[_0x83f6('0xdb')]||_0x9bb2bf[_0x83f6('0xdc')]);rpcDb[_0x83f6('0x8e')](_0x2c36ab,_0x83f6('0xdd'));if(ut[_0x83f6('0x99')](_0x2c36ab)>=_0x35eb71[_0x83f6('0x9d')]){_0x5414eb=ut[_0x83f6('0x9e')](_0x2c36ab,0xf,'Global');rpcDb[_0x83f6('0xbe')](_0x5414eb,_0x83f6('0xde'));}else{rpcDb[_0x83f6('0xbe')](_0x2c36ab,_0x83f6('0xde'));}delete this['actions'][_0x9bb2bf['linkedid']];}if(!(_0x2c36ab[_0x83f6('0x6d')]&&_0x1ba010==='16')){ut[_0x83f6('0xdf')](_0x35eb71,_0x83f6('0xe0'));logger[_0x83f6('0x59')](_0x83f6('0xe1'),_0x2c36ab[_0x83f6('0xa9')],_0x83f6('0xaa'),_0x35eb71[_0x83f6('0x54')],_0x83f6('0xe2'),_0x35eb71[_0x83f6('0x4c')]);}if(_0x1ba010!==_0x83f6('0xa7')){delete this[_0x83f6('0x15')][_0x9bb2bf[_0x83f6('0xa6')]];delete this[_0x83f6('0x15')][_0x9bb2bf[_0x83f6('0xe3')]];}}};Preview[_0x83f6('0xe')]['callProgressDetectingAgent']=function(_0x2757a4,_0x53e898,_0x368c13){if(_[_0x83f6('0xe4')](_0x53e898)&&_0x83f6('0xe5')!==typeof _0x53e898){return;}if(_['isUndefined'](_0x368c13)&&_0x83f6('0xe5')!==typeof _0x368c13){return;}switch(_0x368c13[_0x83f6('0xe6')]){case'0':ut[_0x83f6('0xe7')](_0x2757a4,0x0,_0x83f6('0xe8'));rpcDb[_0x83f6('0xe9')](_0x2757a4,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x83f6('0xe7')](_0x2757a4,0x3,_0x83f6('0xc2'));rpcDb[_0x83f6('0xe9')](_0x2757a4,_0x83f6('0xea'));break;case'5':ut['logAgent'](_0x2757a4,0x5,_0x83f6('0xb9'));rpcDb['createAgentHistory'](_0x2757a4,_0x83f6('0xeb'));break;case'8':ut['logAgent'](_0x2757a4,0x8,_0x83f6('0xec'));rpcDb[_0x83f6('0xe9')](_0x2757a4,_0x83f6('0xed'));break;case'22':ut[_0x83f6('0xe7')](_0x2757a4,0x16,_0x83f6('0xee'));rpcDb[_0x83f6('0xe9')](_0x2757a4,_0x83f6('0xef'));break;default:ut[_0x83f6('0xe7')](_0x2757a4,0xc,_0x368c13[_0x83f6('0xe6')]);rpcDb['createAgentHistory'](_0x2757a4,_0x83f6('0xed'));}ut[_0x83f6('0xdf')](_0x53e898,_0x83f6('0xf0'));logger[_0x83f6('0x59')]('[originated][decrement][callProgressDetectingAgent]',_0x2757a4['uniqueid'],_0x83f6('0xaa'),_0x53e898[_0x83f6('0x54')],_0x83f6('0xe2'),_0x53e898[_0x83f6('0x4c')]);delete this[_0x83f6('0x15')][_0x2757a4[_0x83f6('0xa9')]];};Preview[_0x83f6('0xe')][_0x83f6('0xf1')]=function(_0x468330,_0x27e3e9,_0x590358,_0xb5f356,_0x4a3e8b){var _0x4fd2b0=this;return new BPromise(function(_0x2a46e4,_0x54d02f){if(_[_0x83f6('0xf2')](_0x27e3e9)||_[_0x83f6('0xf2')](_0x27e3e9[_0x83f6('0xf3')])||_['isNil'](_0x27e3e9[_0x83f6('0xf3')]['phone'])||_[_0x83f6('0xf2')](_0x27e3e9[_0x83f6('0x6f')])){_0x54d02f(ut[_0x83f6('0x4b')](_0x83f6('0xf4'),_0xb5f356,_0x4a3e8b));return;}var _0x1a9f1b=uuid['v4']();var _0x557ae9=_0x4fd2b0[_0x83f6('0x12')][_0x27e3e9[_0x83f6('0x69')][_0x83f6('0x54')]];var _0x5dfa84=_0x590358?_0x4fd2b0[_0x83f6('0x16')][_0x590358]['id']:undefined;_0x4fd2b0[_0x83f6('0x15')][_0x1a9f1b]=new Action(_0x27e3e9,_0x557ae9,_0x1a9f1b,_0x590358,_0x5dfa84);var _0x11cd6c=_0x4fd2b0['actions'][_0x1a9f1b];_0x11cd6c[_0x83f6('0xa4')]=_0xb5f356;_0x11cd6c[_0x83f6('0xa5')]=_0x4a3e8b;_0x11cd6c[_0x83f6('0xf5')]=_0x590358;if(_[_0x83f6('0xf6')](_0x468330)){_0x4fd2b0[_0x83f6('0xf7')](_0x11cd6c,_0x557ae9,_0x27e3e9,_0x590358)[_0x83f6('0xf8')](function(_0xef1591){logger['info']('[Preview][execCall][success]','Queue:\x20'+_0x11cd6c['queue']+'\x20IdHopper:\x20'+_0x11cd6c[_0x83f6('0xf9')],JSON[_0x83f6('0x6b')](_0xef1591));ami[_0x83f6('0x28')]('custom:agentcalled',ut[_0x83f6('0x9b')](_0x11cd6c,_0x83f6('0xfa')));_0x2a46e4(ut[_0x83f6('0x4b')](_0x83f6('0xfb')));})[_0x83f6('0x73')](function(_0x5d3b1a){ut[_0x83f6('0x5e')](_0x83f6('0xfc'),_0x5d3b1a);_0x54d02f(ut[_0x83f6('0x4b')](_0x83f6('0xfd'),_0xb5f356,_0x4a3e8b));});}else{_0x557ae9[_0x83f6('0xfe')]+=0x1;ut[_0x83f6('0xff')](_0x11cd6c);rpcDb[_0x83f6('0x100')](_0x11cd6c,'[Blacklist][error]');delete _0x4fd2b0[_0x83f6('0x15')][_0x1a9f1b];_0x54d02f(ut[_0x83f6('0x4b')](_0x83f6('0x101'),_0xb5f356,_0x4a3e8b));}});};Preview[_0x83f6('0xe')][_0x83f6('0x94')]=function(_0x2556d7){return!_['isNil'](_0x2556d7)&&!_['isNil'](_0x2556d7['name'])&&!_['isNil'](_0x2556d7[_0x83f6('0x55')])&&_0x2556d7[_0x83f6('0x55')]&&!_['isNil'](this[_0x83f6('0x14')][util[_0x83f6('0x58')](_0x83f6('0x102'),_0x2556d7[_0x83f6('0x54')])])&&!_[_0x83f6('0xf2')](this[_0x83f6('0x14')][util[_0x83f6('0x58')](_0x83f6('0x102'),_0x2556d7[_0x83f6('0x54')])][_0x83f6('0x71')])&&(this['trunks'][util[_0x83f6('0x58')](_0x83f6('0x102'),_0x2556d7['name'])][_0x83f6('0x71')]===_0x83f6('0x103')||this[_0x83f6('0x14')][util[_0x83f6('0x58')](_0x83f6('0x102'),_0x2556d7['name'])][_0x83f6('0x71')]===_0x83f6('0x104'));};Preview[_0x83f6('0xe')][_0x83f6('0x85')]=function(_0x10ad7f,_0x41c360){var _0x85cf1e=this;return new BPromise(function(_0x23a439,_0x5ca0d4){_0x85cf1e[_0x83f6('0x105')](_0x10ad7f,_0x41c360)[_0x83f6('0xf8')](function(_0x574418){_0x23a439(_['pick'](_0x574418,['message']));})[_0x83f6('0x73')](function(_0x1b1b69){if(_0x1b1b69[_0x83f6('0x106')]){rpcDb['unlockContact'](_0x10ad7f);}if(_0x1b1b69['active']){rpcDb['disableContact'](_0x10ad7f);}_0x5ca0d4(_[_0x83f6('0x107')](_0x1b1b69,['message']));});});};Preview['prototype'][_0x83f6('0x105')]=function(_0x364fa,_0x7395e4){var _0x3f0fac=this;return new BPromise(function(_0x3aa20a,_0x49cb90){var _0x3a72c7,_0x4113df;rpcDb[_0x83f6('0x108')](_0x364fa)[_0x83f6('0xf8')](function(_0x512ed6){if(!_['isNil'](_0x512ed6[0x0])){_0x4113df=_0x512ed6[0x0]['recallme']?![]:!![];_0x3a72c7=_0x512ed6[0x0][_0x83f6('0x109')]?!![]:![];_0x3a72c7=_0x7395e4?!![]:_0x3a72c7;}var _0x2ab545=_0x3f0fac[_0x83f6('0x10a')](_0x512ed6);if(_0x2ab545[_0x83f6('0x10b')]){rpcDb[_0x83f6('0x10c')](_[_0x83f6('0x107')](_0x512ed6[0x0],[_0x83f6('0x6f'),_0x83f6('0x10d')]))[_0x83f6('0xf8')](function(_0x1d7c70){_0x3f0fac[_0x83f6('0xf1')](_0x1d7c70,_0x512ed6[0x0],_0x7395e4,_0x4113df,_0x3a72c7)[_0x83f6('0xf8')](function(_0x4ac82c){_0x3aa20a(_0x4ac82c);})[_0x83f6('0x73')](function(_0x3a3da3){_0x49cb90(_0x3a3da3);});})[_0x83f6('0x73')](function(_0x761253){ut['logger'](_0x83f6('0x10e'),_0x761253);_0x49cb90(ut[_0x83f6('0x4b')]('Call\x20unsuccessful',_0x4113df,_0x3a72c7));});}else{_0x49cb90(ut[_0x83f6('0x4b')](_0x2ab545['message'],_0x4113df,_0x3a72c7));}})['catch'](function(_0x6864e1){ut['logger'](_0x83f6('0x10f'),_0x6864e1);_0x49cb90(ut[_0x83f6('0x4b')]('Call\x20unsuccessful',![],!![]));});});};Preview['prototype']['validateContact']=function(_0x38f5f7){if(_['isNil'](_0x38f5f7)||_['isEmpty'](_0x38f5f7)||!_[_0x83f6('0xf2')](_0x38f5f7[0x0][_0x83f6('0x83')])&&_[_0x83f6('0xf2')](_0x38f5f7[0x0]['Agent']['name'])){ut[_0x83f6('0x5e')](_0x83f6('0x110'),_0x38f5f7);return{'isValid':![],'message':_0x83f6('0x111')};}var _0x1b1536=this['campaignsPreview'][_0x38f5f7[0x0][_0x83f6('0x69')][_0x83f6('0x54')]];_0x1b1536[_0x83f6('0x4b')]=_0x83f6('0x95');if(_[_0x83f6('0xf2')](_0x1b1536)){ut['logger'](_0x83f6('0x112'),_0x1b1536);return{'isValid':![],'message':_0x83f6('0x113')};}if(!this[_0x83f6('0x94')](_0x1b1536[_0x83f6('0x53')])){ut[_0x83f6('0x5e')](_0x83f6('0x114'),_0x83f6('0x115')+_0x1b1536[_0x83f6('0x54')]+_0x83f6('0x116'));if(!this[_0x83f6('0x94')](_0x1b1536['TrunkBackup'])){ut[_0x83f6('0x5e')](_0x83f6('0x114'),_0x1b1536[_0x83f6('0x54')]+_0x83f6('0x117'));return{'isValid':![],'message':_0x83f6('0x118')};}}if(!ut[_0x83f6('0x92')](_0x1b1536['dialActive'])){ut[_0x83f6('0x5e')](_0x83f6('0x119'),_0x1b1536[_0x83f6('0x54')]+_0x83f6('0x11a'));return{'isValid':![],'message':_0x83f6('0x115')+_0x1b1536[_0x83f6('0x54')]+_0x83f6('0x11a')};}return{'isValid':!![],'message':_0x83f6('0x11b')};};Preview[_0x83f6('0xe')][_0x83f6('0xf7')]=function(_0x507c56,_0x2cd848,_0x53c793,_0x5ca92c){var _0x15725a=this;return new BPromise(function(_0x39ab0e,_0x413975){var _0x2473a9=_0x507c56[_0x83f6('0xa9')];var _0x131525=_0x15725a[_0x83f6('0x94')](_0x2cd848[_0x83f6('0x53')])?util['format'](_0x83f6('0x11c'),_0x2cd848[_0x83f6('0x53')][_0x83f6('0x54')],_[_0x83f6('0xf2')](_0x2cd848[_0x83f6('0x11d')])?'':_0x2cd848[_0x83f6('0x11d')]['trim']()||'',_0x2cd848['dialCutDigit']>0x0?_0x53c793[_0x83f6('0xf3')][_0x83f6('0x11e')][_0x83f6('0x11f')](_0x2cd848[_0x83f6('0x120')]):_0x53c793[_0x83f6('0xf3')][_0x83f6('0x11e')]):util[_0x83f6('0x58')](_0x83f6('0x11c'),_[_0x83f6('0xf2')](_0x2cd848[_0x83f6('0x121')])?_0x2cd848[_0x83f6('0x53')]['name']:_0x2cd848[_0x83f6('0x121')][_0x83f6('0x54')],_[_0x83f6('0xf2')](_0x2cd848[_0x83f6('0x11d')])?'':_0x2cd848[_0x83f6('0x11d')][_0x83f6('0x122')]()||'',_0x2cd848[_0x83f6('0x120')]>0x0?_0x53c793[_0x83f6('0xf3')][_0x83f6('0x11e')][_0x83f6('0x11f')](_0x2cd848[_0x83f6('0x120')]):_0x53c793[_0x83f6('0xf3')]['phone']);var _0x4d091b=_0x15725a[_0x83f6('0x94')](_0x2cd848[_0x83f6('0x53')])?ut[_0x83f6('0x123')](_0x2cd848['Trunk'][_0x83f6('0x56')],_0x2cd848['dialOriginateCallerIdName'],_0x2cd848['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x2cd848[_0x83f6('0x34')],_0x2cd848[_0x83f6('0x124')]):_0x2cd848[_0x83f6('0x34')]):ut[_0x83f6('0x123')](_[_0x83f6('0xf2')](_0x2cd848[_0x83f6('0x121')])?_0x2cd848[_0x83f6('0x53')]['callerid']:_0x2cd848[_0x83f6('0x121')]['callerid'],_0x2cd848[_0x83f6('0x125')],_0x2cd848['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x83f6('0x126')](_0x2cd848[_0x83f6('0x34')],_0x2cd848[_0x83f6('0x124')]):_0x2cd848[_0x83f6('0x34')]);if(_0x4d091b){_0x507c56[_0x83f6('0x127')]=ut['extractCalleridName'](_0x4d091b);_0x507c56[_0x83f6('0x128')]=ut['extractCalleridNumber'](_0x4d091b);}var _0x79402f=ut[_0x83f6('0x129')](_0x2cd848,_0x53c793,_0x131525,_0x4d091b,_0x2473a9,_0x507c56);_[_0x83f6('0x12a')](_0x507c56,ut[_0x83f6('0x12b')](_0x79402f));_0x507c56['starttime']=moment()[_0x83f6('0x58')](_0x83f6('0x12c'));ami['Action'](ut['variablesAction'](_0x507c56,_0x2cd848,_0x79402f,_0x507c56['activeContact'],_0x5ca92c))[_0x83f6('0xf8')](function(_0x53f15c){_0x2cd848[_0x83f6('0x4c')]+=0x1;logger[_0x83f6('0x59')](_0x83f6('0x12d'),_0x2473a9,_0x83f6('0xaa'),_0x2cd848[_0x83f6('0x54')],'originated:\x20',_0x2cd848[_0x83f6('0x4c')]);_0x39ab0e(_0x53f15c);})['catch'](function(_0x3f6a21){ut['logAgent'](_0x507c56,0xe,_0x83f6('0x12e'));rpcDb[_0x83f6('0xe9')](_0x507c56,_0x83f6('0x12f'));_0x413975(_0x3f6a21);});});};Preview[_0x83f6('0xe')][_0x83f6('0x20')]=function(_0x48e4a0){if(this[_0x83f6('0x15')][_0x48e4a0['linkedid']]){this[_0x83f6('0x15')][_0x48e4a0[_0x83f6('0xa6')]][_0x83f6('0x72')]=_0x48e4a0[_0x83f6('0x72')];}};Preview[_0x83f6('0xe')]['syncOriginateResponse']=function(_0x26a5d4){var _0x6f0be2=this;var _0x295777=this[_0x83f6('0x15')][_0x26a5d4[_0x83f6('0x130')]];if(_0x295777){if(_0x295777['lookAgent']&&this[_0x83f6('0x16')][_0x295777['lookAgent']]){ut[_0x83f6('0x131')](_0x295777,this['agents'][_0x295777[_0x83f6('0xf5')]][_0x83f6('0x54')],this[_0x83f6('0x16')][_0x295777[_0x83f6('0xf5')]]['id']);}var _0x244828=_[_0x83f6('0x132')](_0x295777);_0x244828[_0x83f6('0xa8')]=moment()['format'](_0x83f6('0x12c'));var _0x485477=_0x6f0be2[_0x83f6('0x12')][_0x295777[_0x83f6('0x6a')]];if(ut[_0x83f6('0x133')](_0x26a5d4[_0x83f6('0x134')])){if(_0x295777[_0x83f6('0xa4')]){rpcDb['unlockContact'](_0x295777[_0x83f6('0xf9')]);}if(_0x295777['activeContact']){rpcDb[_0x83f6('0x88')](_0x295777[_0x83f6('0xf9')]);}ami['emit']('custom:agentringnoanswer',ut[_0x83f6('0x9b')](_0x295777,_0x83f6('0x135')));this[_0x83f6('0x136')](_0x244828,_0x485477,_0x26a5d4);}else{_0x295777[_0x83f6('0x89')]=moment()[_0x83f6('0x58')](_0x83f6('0x12c'));ut[_0x83f6('0xe7')](_0x244828,0x4,_0x83f6('0xb1'));rpcDb[_0x83f6('0xe9')](_0x244828,_0x83f6('0x137'));}}};Preview[_0x83f6('0xe')][_0x83f6('0x1c')]=function(_0x4c2438){var _0x358af3=this;var _0x3f7df2=this[_0x83f6('0x15')][_0x4c2438['linkedid']];var _0x1d804c;if(_0x3f7df2){_0x1d804c=this[_0x83f6('0x12')][_0x3f7df2[_0x83f6('0x6a')]];logger[_0x83f6('0x59')](_0x83f6('0x138'),_0x4c2438['linkedid'],'\x20Queue',_0x1d804c[_0x83f6('0x54')],_0x83f6('0x6c'),_0x1d804c[_0x83f6('0x2f')]);}if(this[_0x83f6('0x15')][_0x4c2438[_0x83f6('0xa6')]]&&_0x4c2438[_0x83f6('0xa6')]!==_0x4c2438[_0x83f6('0xa9')]){if(_0x4c2438['cause']==='16'&&this[_0x83f6('0x15')][_0x4c2438[_0x83f6('0xa6')]][_0x83f6('0x6d')]){this[_0x83f6('0x96')](_0x4c2438,_0x4c2438['linkedid'],_0x4c2438[_0x83f6('0x139')]);}else if(this[_0x83f6('0x15')][_0x4c2438[_0x83f6('0xa6')]]['dialAnswer']){logger['info'](_0x83f6('0x13a'),_0x4c2438[_0x83f6('0xa6')],_0x4c2438[_0x83f6('0x139')],_0x83f6('0xaa'),_0x1d804c[_0x83f6('0x54')],_0x83f6('0x6c'),_0x1d804c['pTalking']);this[_0x83f6('0x96')](_0x4c2438,_0x4c2438[_0x83f6('0xa6')],_0x4c2438[_0x83f6('0x139')]);}}else if(_0x3f7df2&&_[_0x83f6('0xf2')](_0x3f7df2[_0x83f6('0x13b')])&&_0x1d804c[_0x83f6('0x13c')]&&_0x4c2438['linkedid']===_0x4c2438[_0x83f6('0xa9')]&&_[_0x83f6('0xf2')](_0x4c2438['reason'])&&_0x4c2438[_0x83f6('0x139')]==='16'&&_0x4c2438[_0x83f6('0x13d')]==='6'&&_[_0x83f6('0xe4')](_0x3f7df2[_0x83f6('0x13e')])){if(_0x3f7df2[_0x83f6('0xa4')]){rpcDb[_0x83f6('0x13f')](_0x3f7df2[_0x83f6('0xf9')]);}if(_0x3f7df2[_0x83f6('0xa5')]){rpcDb[_0x83f6('0x88')](_0x3f7df2[_0x83f6('0xf9')]);}_0x4c2438[_0x83f6('0xe6')]='22';this[_0x83f6('0x136')](_0x3f7df2,_0x1d804c,_0x4c2438);}else if(_0x3f7df2&&_0x3f7df2['transfer']){if(_0x4c2438[_0x83f6('0x139')]==='16'&&this[_0x83f6('0x15')][_0x4c2438[_0x83f6('0xa6')]][_0x83f6('0x6d')]){logger[_0x83f6('0x59')](_0x83f6('0x140'),_0x4c2438[_0x83f6('0xa6')],_0x4c2438['cause'],_0x83f6('0xaa'),_0x1d804c[_0x83f6('0x54')],_0x83f6('0x6c'),_0x1d804c[_0x83f6('0x2f')]);this[_0x83f6('0x96')](_0x4c2438,_0x4c2438['linkedid'],_0x4c2438[_0x83f6('0x139')]);}else if(this[_0x83f6('0x15')][_0x4c2438['linkedid']]['dialAnswer']){logger[_0x83f6('0x59')](_0x83f6('0x13a'),_0x4c2438[_0x83f6('0xa6')],_0x4c2438['cause'],'\x20Queue',_0x1d804c[_0x83f6('0x54')],_0x83f6('0x6c'),_0x1d804c[_0x83f6('0x2f')]);this['callProgressDetectingCustomer'](_0x4c2438,_0x4c2438[_0x83f6('0xa6')],_0x4c2438['cause']);}}};Preview[_0x83f6('0xe')][_0x83f6('0x1e')]=function(_0x2a71ba){if(this[_0x83f6('0x15')][_0x2a71ba[_0x83f6('0xe3')]]&&_0x2a71ba[_0x83f6('0xe3')]!==_0x2a71ba[_0x83f6('0x141')]){this[_0x83f6('0x96')](_0x2a71ba,_0x2a71ba['destlinkedid'],_0x2a71ba[_0x83f6('0xdc')]);}};Preview[_0x83f6('0xe')]['syncHangupRequest']=function(_0x42b7aa){if(this[_0x83f6('0x15')][_0x42b7aa[_0x83f6('0xa6')]]&&_0x42b7aa[_0x83f6('0xa6')]!==_0x42b7aa['uniqueid']&&!this['actions'][_0x42b7aa[_0x83f6('0xa6')]][_0x83f6('0x6d')]){if(_0x42b7aa[_0x83f6('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x42b7aa,_0x42b7aa[_0x83f6('0xa6')],_0x42b7aa[_0x83f6('0x139')]);}}};Preview['prototype'][_0x83f6('0x142')]=function(_0x22c1b8,_0x444bb5,_0x232cfa){if(this['actions'][_0x22c1b8]){if(_[_0x83f6('0xf2')](this[_0x83f6('0x15')][_0x22c1b8]['variables'])){this[_0x83f6('0x15')][_0x22c1b8][_0x83f6('0x143')]={};}this[_0x83f6('0x15')][_0x22c1b8]['variables'][_0x444bb5]=_0x232cfa;}};Preview[_0x83f6('0xe')][_0x83f6('0x22')]=function(_0x281e68){try{if(!_[_0x83f6('0xf2')](_0x281e68)){if(ut[_0x83f6('0x144')](_['keys'](_0x281e68[_0x83f6('0x145')])[0x0])){this[_0x83f6('0x142')](_0x281e68[_0x83f6('0xa9')],_[_0x83f6('0x146')](_0x281e68[_0x83f6('0x145')])[0x0],_0x281e68[_0x83f6('0x147')]);}}}catch(_0x147932){logger['error'](_0x83f6('0x148'),util[_0x83f6('0x149')](_0x147932,{'showHidden':![],'depth':null}));}};Preview[_0x83f6('0xe')][_0x83f6('0x24')]=function(_0x101208){if(_0x101208){if(this[_0x83f6('0x15')][_0x101208[_0x83f6('0x14a')]]){this['actions'][_0x101208['transfertargetlinkedid']][_0x83f6('0x13e')]=!![];}}};Preview[_0x83f6('0xe')][_0x83f6('0x26')]=function(_0x41e90e){if(_0x41e90e){if(this[_0x83f6('0x15')][_0x41e90e[_0x83f6('0x14b')]]){this[_0x83f6('0x15')][_0x41e90e[_0x83f6('0x14b')]][_0x83f6('0x13e')]=!![];}}};module[_0x83f6('0x14c')]=Preview; \ No newline at end of file +var _0xfa90=['originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','syncNewExten','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','Trunk','active','callerid','Interval','stringify','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','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','clearZombieChannels','dialActive','setMessage','recallMe','enqueue','info','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','clearZombieChannel','then','isNil','length','getDiff','scheduledat','Agent','logger2','[RecallMe]','starttime','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','\x20Queue','linkedid','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','dialBusyMaxRetry','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','scheduledAt','countnoanswerretry','countcongestionretry','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Queue','lookAgent','[Preview][execCall][success]','Queue:\x20','idContact','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','run','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','dialPrefix','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdName','originatecalleridname','extractCalleridName'];(function(_0x164c0f,_0x551d06){var _0xee3f29=function(_0x30741f){while(--_0x30741f){_0x164c0f['push'](_0x164c0f['shift']());}};_0xee3f29(++_0x551d06);}(_0xfa90,0x16e));var _0x0fa9=function(_0x338b0c,_0x30bfa3){_0x338b0c=_0x338b0c-0x0;var _0x48e837=_0xfa90[_0x338b0c];return _0x48e837;};'use strict';var util=require(_0x0fa9('0x0'));var _=require(_0x0fa9('0x1'));var BPromise=require(_0x0fa9('0x2'));var uuid=require(_0x0fa9('0x3'));var moment=require(_0x0fa9('0x4'));var md5=require(_0x0fa9('0x5'));var Redis=require(_0x0fa9('0x6'));var config=require(_0x0fa9('0x7'));var logger=require(_0x0fa9('0x8'))(_0x0fa9('0x9'));var loggerAction=require('../../../config/logger')(_0x0fa9('0xa'));var ami=require(_0x0fa9('0xb'));var rpcDb=require('./rpcDb');var Action=require(_0x0fa9('0xc'));var ut=require(_0x0fa9('0xd'));config[_0x0fa9('0xe')]=_[_0x0fa9('0xf')](config[_0x0fa9('0xe')],{'host':_0x0fa9('0x10'),'port':0x18eb});var io=require(_0x0fa9('0x11'))(new Redis(config[_0x0fa9('0xe')]));var Sequence=function(){};Sequence[_0x0fa9('0x12')]['enqueue']=function(_0x5cde0d){this[_0x0fa9('0x13')]=this[_0x0fa9('0x13')]?this[_0x0fa9('0x13')][_0x0fa9('0x14')](_0x5cde0d):_0x5cde0d();};function Preview(_0x140040){this[_0x0fa9('0x15')]=new Sequence();this[_0x0fa9('0x16')]=_0x140040[_0x0fa9('0x17')];this['trunks']=_0x140040[_0x0fa9('0x18')];this[_0x0fa9('0x19')]={};this[_0x0fa9('0x1a')]=_0x140040['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x0fa9('0x1b')][_0x0fa9('0x1c')](this));ami['on'](_0x0fa9('0x1d'),this[_0x0fa9('0x1e')][_0x0fa9('0x1c')](this));ami['on'](_0x0fa9('0x1f'),this[_0x0fa9('0x20')][_0x0fa9('0x1c')](this));ami['on']('dialend',this[_0x0fa9('0x21')][_0x0fa9('0x1c')](this));ami['on'](_0x0fa9('0x22'),this['syncNewExten']['bind'](this));ami['on'](_0x0fa9('0x23'),this[_0x0fa9('0x24')][_0x0fa9('0x1c')](this));ami['on'](_0x0fa9('0x25'),this[_0x0fa9('0x26')][_0x0fa9('0x1c')](this));ami['on']('blindtransfer',this[_0x0fa9('0x27')]['bind'](this));this[_0x0fa9('0x28')](this[_0x0fa9('0x16')]);}function emit(_0x56568a,_0x53f93f,_0x5b6149){io['to'](_0x56568a)[_0x0fa9('0x29')](_0x53f93f,_0x5b6149);}function emitCampaignPreview(_0x4b4a1f){if(_0x4b4a1f[_0x0fa9('0x2a')]===_0x0fa9('0x2b')){var _0x14386e={'id':_0x4b4a1f['id'],'name':_0x4b4a1f[_0x0fa9('0x2c')],'strategy':_0x4b4a1f[_0x0fa9('0x2d')],'answered':_0x4b4a1f[_0x0fa9('0x2e')],'available':_0x4b4a1f['available'],'loggedIn':_0x4b4a1f[_0x0fa9('0x2f')],'pTalking':_0x4b4a1f[_0x0fa9('0x30')],'sumBillable':_0x4b4a1f[_0x0fa9('0x31')],'sumDuration':_0x4b4a1f[_0x0fa9('0x32')],'sumHoldTime':_0x4b4a1f[_0x0fa9('0x33')]||0x0,'talking':_0x4b4a1f['talking'],'total':_0x4b4a1f[_0x0fa9('0x34')],'type':_0x4b4a1f[_0x0fa9('0x2a')],'unmanaged':_0x4b4a1f[_0x0fa9('0x35')],'abandoned':_0x4b4a1f['abandoned'],'waiting':_0x4b4a1f[_0x0fa9('0x36')],'loggedInDb':_0x4b4a1f[_0x0fa9('0x37')],'dialActive':_0x4b4a1f['dialActive'],'dialMethod':_0x4b4a1f['dialMethod'],'dialOriginateCallerIdName':_0x4b4a1f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4b4a1f[_0x0fa9('0x38')],'dialOriginateTimeout':_0x4b4a1f[_0x0fa9('0x39')],'dialPrefix':_0x4b4a1f['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4b4a1f[_0x0fa9('0x3a')],'outboundAnswerCallsDay':_0x4b4a1f[_0x0fa9('0x3b')],'outboundBlacklistCallsDay':_0x4b4a1f[_0x0fa9('0x3c')],'outboundBusyCallsDay':_0x4b4a1f[_0x0fa9('0x3d')],'outboundCongestionCallsDay':_0x4b4a1f[_0x0fa9('0x3e')],'outboundDropCallsDayACS':_0x4b4a1f[_0x0fa9('0x3f')],'outboundDropCallsDayCallersExit':_0x4b4a1f[_0x0fa9('0x40')],'outboundDropCallsDayTimeout':_0x4b4a1f[_0x0fa9('0x41')],'outboundNoAnswerCallsDay':_0x4b4a1f[_0x0fa9('0x42')],'outboundNoSuchCallsDay':_0x4b4a1f[_0x0fa9('0x43')],'outboundOriginateFailureCallsDay':_0x4b4a1f[_0x0fa9('0x44')],'outboundReCallsDay':_0x4b4a1f[_0x0fa9('0x45')],'outboundRejectCallsDay':_0x4b4a1f[_0x0fa9('0x46')],'outboundUnknownCallsDay':_0x4b4a1f[_0x0fa9('0x47')],'outboundAbandonedCallsDay':_0x4b4a1f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4b4a1f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4b4a1f[_0x0fa9('0x48')],'predictiveIntervalAvgTalktime':_0x4b4a1f[_0x0fa9('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x4b4a1f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4b4a1f[_0x0fa9('0x4a')],'predictiveIntervalErlangCalls':_0x4b4a1f[_0x0fa9('0x4b')],'predictiveIntervalErlangCallsDroppedCalls':_0x4b4a1f[_0x0fa9('0x4c')],'predictiveIntervalHitRate':_0x4b4a1f['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4b4a1f[_0x0fa9('0x4d')],'predictiveIntervalPauses':_0x4b4a1f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4b4a1f[_0x0fa9('0x4e')],'predictiveIntervalTotalCalls':_0x4b4a1f[_0x0fa9('0x4f')],'message':_0x4b4a1f[_0x0fa9('0x50')],'originated':_0x4b4a1f[_0x0fa9('0x51')],'erlangCalls':_0x4b4a1f[_0x0fa9('0x52')],'erlangCallToSecond':_0x4b4a1f[_0x0fa9('0x53')],'erlangAbandonmentRate':_0x4b4a1f[_0x0fa9('0x54')],'erlangBusyFactor':_0x4b4a1f['erlangBusyFactor'],'startPredictive':_0x4b4a1f[_0x0fa9('0x55')],'startProgressive':_0x4b4a1f['startProgressive']};if(_0x4b4a1f[_0x0fa9('0x56')]){_0x14386e[_0x0fa9('0x56')]={'id':_0x4b4a1f[_0x0fa9('0x56')]['id'],'name':_0x4b4a1f[_0x0fa9('0x56')][_0x0fa9('0x2c')],'active':_0x4b4a1f[_0x0fa9('0x56')][_0x0fa9('0x57')],'callerid':_0x4b4a1f[_0x0fa9('0x56')][_0x0fa9('0x58')]};}if(_0x4b4a1f['Interval']){_0x14386e['Interval']={'id':_0x4b4a1f['Interval']['id'],'name':_0x4b4a1f[_0x0fa9('0x59')][_0x0fa9('0x2c')]};}var _0x5e8044=md5(JSON[_0x0fa9('0x5a')](_0x14386e));if(_0x4b4a1f[_0x0fa9('0x5')]!==_0x5e8044){_0x4b4a1f[_0x0fa9('0x5')]=_0x5e8044;emit(util[_0x0fa9('0x5b')](_0x0fa9('0x5c'),_0x14386e['name']),_0x0fa9('0x5d'),_0x14386e);}}}function emitVoiceQueueChannelRemove(_0x3fe731){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x3fe731));emit(util[_0x0fa9('0x5b')](_0x0fa9('0x5c'),_0x3fe731[_0x0fa9('0x2c')]),_0x0fa9('0x5e'),_0x3fe731);}function notSendMessagesQueue(_0x4754ff){if(_0x4754ff['sendMessageOneNotActive']){if(_0x4754ff[_0x0fa9('0x51')]===0x0&&_0x4754ff[_0x0fa9('0x30')]===0x0){_0x4754ff[_0x0fa9('0x5f')]=![];_0x4754ff[_0x0fa9('0x60')]=0x0;_0x4754ff[_0x0fa9('0x61')]=0x0;_0x4754ff[_0x0fa9('0x50')]=_0x0fa9('0x62');ut[_0x0fa9('0x63')](_0x0fa9('0x64'),_0x4754ff[_0x0fa9('0x2c')]+_0x0fa9('0x65'));}else{_0x4754ff['message']=_0x0fa9('0x66');ut[_0x0fa9('0x63')](_0x0fa9('0x64'),_0x4754ff['name']+_0x0fa9('0x67'));}emitCampaignPreview(_0x4754ff);}}Preview[_0x0fa9('0x12')][_0x0fa9('0x28')]=function(){var _0x2e12ef=this;setInterval(function(){_0x2e12ef['syncCampaigns']();},0x7cf);};Preview[_0x0fa9('0x12')][_0x0fa9('0x68')]=function(){var _0x22a001=this[_0x0fa9('0x16')];this[_0x0fa9('0x69')]+=0x1;for(var _0x1625ab in _0x22a001){if(_0x22a001[_0x0fa9('0x6a')](_0x1625ab)&&(_0x22a001[_0x1625ab][_0x0fa9('0x6b')]===_0x0fa9('0x9')||_0x22a001[_0x1625ab][_0x0fa9('0x6b')]==='booked')&&_0x22a001[_0x1625ab][_0x0fa9('0x2a')]===_0x0fa9('0x2b')){if(this[_0x0fa9('0x69')]>0x7){this[_0x0fa9('0x69')]=0x0;this[_0x0fa9('0x6c')]();}}if(_0x22a001[_0x0fa9('0x6a')](_0x1625ab)&&_0x22a001[_0x1625ab]['dialMethod']===_0x0fa9('0x9')&&_0x22a001[_0x1625ab][_0x0fa9('0x2a')]===_0x0fa9('0x2b')){if(_0x22a001[_0x1625ab][_0x0fa9('0x6d')]){this[_0x0fa9('0x6e')](_0x22a001[_0x1625ab]);this[_0x0fa9('0x6f')](_0x22a001[_0x1625ab]);}else{notSendMessagesQueue(_0x22a001[_0x1625ab]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x55a09f){var _0x404a39=this;this[_0x0fa9('0x15')][_0x0fa9('0x70')](function(){if(!_['isNil'](_0x404a39[_0x0fa9('0x19')][_0x55a09f])){loggerAction[_0x0fa9('0x71')]('[clearZombieChannels][talking]',_0x55a09f,'Queue',_0x404a39[_0x0fa9('0x19')][_0x55a09f]['queue'],_0x0fa9('0x72'),JSON['stringify'](_0x404a39['campaignsPreview'][_0x404a39[_0x0fa9('0x19')][_0x55a09f][_0x0fa9('0x73')]][_0x0fa9('0x51')]),_0x0fa9('0x74'),JSON[_0x0fa9('0x5a')](_0x404a39[_0x0fa9('0x16')][_0x404a39['actions'][_0x55a09f][_0x0fa9('0x73')]][_0x0fa9('0x30')]),JSON[_0x0fa9('0x5a')](_0x404a39[_0x0fa9('0x19')][_0x55a09f][_0x0fa9('0x75')]),JSON[_0x0fa9('0x5a')](_[_0x0fa9('0x76')](_0x404a39[_0x0fa9('0x19')][_0x55a09f],[_0x0fa9('0x77'),_0x0fa9('0x78'),_0x0fa9('0x79'),_0x0fa9('0x7a')])));return ami[_0x0fa9('0x7b')]({'action':_0x0fa9('0x7c'),'channel':_0x404a39[_0x0fa9('0x19')][_0x55a09f][_0x0fa9('0x7d')]})[_0x0fa9('0x7e')](function(_0x3d475e){if(_0x3d475e[_0x0fa9('0x50')]===_0x0fa9('0x7f')){setTimeout(function(){if(_0x404a39[_0x0fa9('0x19')][_0x55a09f]){ut[_0x0fa9('0x80')](_0x404a39['campaignsPreview'][_0x404a39[_0x0fa9('0x19')][_0x55a09f][_0x0fa9('0x73')]],_0x0fa9('0x81'));if(_0x404a39[_0x0fa9('0x19')][_0x55a09f]['dialAnswer']===!![]){ut['decrementTalkink'](_0x404a39[_0x0fa9('0x16')][_0x404a39[_0x0fa9('0x19')][_0x55a09f][_0x0fa9('0x73')]],_0x0fa9('0x81'));ut[_0x0fa9('0x82')](_0x0fa9('0x83')+_0x55a09f,_0x404a39['actions'][_0x55a09f]['queue']);}ut[_0x0fa9('0x82')](_0x0fa9('0x84')+_0x55a09f,_0x404a39[_0x0fa9('0x19')][_0x55a09f][_0x0fa9('0x73')]);delete _0x404a39['actions'][_0x55a09f];}},0x2328);}});}});};Preview[_0x0fa9('0x12')][_0x0fa9('0x6c')]=function(){var _0x5d2f5b=this;loggerAction[_0x0fa9('0x71')]('[action]',_[_0x0fa9('0x85')](this[_0x0fa9('0x19')]));for(var _0x38ef68 in this['actions']){if(_0x5d2f5b[_0x0fa9('0x19')]['hasOwnProperty'](_0x38ef68)){_0x5d2f5b[_0x0fa9('0x86')](_0x38ef68);}}};Preview[_0x0fa9('0x12')][_0x0fa9('0x6f')]=function(_0x3a5bcc){var _0x41e39d=this;rpcDb['getContactRecallMe'](_0x3a5bcc['id'],ut['agentReadyId'](this['agents']))[_0x0fa9('0x87')](function(_0x2d3a24){if(!_[_0x0fa9('0x88')](_0x2d3a24)){for(var _0x1d98e8=0x0;_0x1d98e8<_0x2d3a24[_0x0fa9('0x89')];_0x1d98e8+=0x1){if(ut[_0x0fa9('0x8a')](_0x2d3a24[_0x1d98e8][_0x0fa9('0x8b')])<_0x3a5bcc['dialRecallMeTimeout']*0x3c){if(_0x2d3a24[_0x1d98e8][_0x0fa9('0x8c')]&&!_0x2d3a24[_0x1d98e8][_0x0fa9('0x8c')]['voicePause']){_0x41e39d['run'](_0x2d3a24[_0x1d98e8]['id'])[_0x0fa9('0x87')](ut[_0x0fa9('0x8d')](_0x0fa9('0x8e')))[_0x0fa9('0x7e')](ut[_0x0fa9('0x8d')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x2d3a24[_0x1d98e8]['id']);}}else{var _0x2ff69f=new Action(_0x2d3a24[_0x1d98e8],_0x3a5bcc);_0x2ff69f[_0x0fa9('0x8f')]=moment()[_0x0fa9('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a5bcc[_0x0fa9('0x45')]+=0x1;ut['logCustomer'](_0x2ff69f,0x17,_0x0fa9('0x90'));if(_0x3a5bcc[_0x0fa9('0x91')]){rpcDb['rescheduleContactInQueue'](ut[_0x0fa9('0x92')](_0x2d3a24[_0x1d98e8]));rpcDb[_0x0fa9('0x93')](_0x2ff69f,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x0fa9('0x94')](_0x2ff69f,0x16,'RecallFailedTimeout');rpcDb[_0x0fa9('0x93')](_0x2ff69f,_0x0fa9('0x95'));rpcDb[_0x0fa9('0x96')](_0x2ff69f,_0x0fa9('0x95'));}}}}})['catch'](ut[_0x0fa9('0x8d')](_0x0fa9('0x97')));};Preview['prototype']['setMessage']=function(_0x114c66){_0x114c66['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x114c66['loggedIn'])){_0x114c66['message']=_0x0fa9('0x98');}else if(!ut[_0x0fa9('0x99')](_0x114c66[_0x0fa9('0x6d')])){_0x114c66[_0x0fa9('0x50')]=_0x0fa9('0x62');}else if(!this[_0x0fa9('0x9a')](_0x114c66[_0x0fa9('0x56')])){if(!this[_0x0fa9('0x9a')](_0x114c66[_0x0fa9('0x9b')])){_0x114c66['message']=_0x0fa9('0x9c');}else{_0x114c66[_0x0fa9('0x50')]='ACTIVE';}}else{_0x114c66[_0x0fa9('0x50')]='ACTIVE';}emitCampaignPreview(_0x114c66);};Preview[_0x0fa9('0x12')]['callProgressDetectingCustomer']=function(_0x3db612,_0xafb075,_0x3a6533){var _0x5914be=this;var _0x2aaacf=this[_0x0fa9('0x19')][_0xafb075];var _0xa885ad=this['campaignsPreview'][_0x2aaacf[_0x0fa9('0x73')]];var _0x5375e9;if(_0xa885ad){switch(_0x3a6533){case'1':_0xa885ad['outboundNoSuchCallsDay']+=0x1;_0x2aaacf[_0x0fa9('0x9d')]+=0x1;_0x2aaacf[_0x0fa9('0x9e')]=ut[_0x0fa9('0x9f')](_0x2aaacf);ut[_0x0fa9('0x94')](_0x2aaacf,0x0,_0x0fa9('0xa0'));ami[_0x0fa9('0x29')](_0x0fa9('0xa1'),ut[_0x0fa9('0xa2')](_0x2aaacf,_0x0fa9('0xa3')));rpcDb[_0x0fa9('0x93')](_0x2aaacf,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x2aaacf)>=_0xa885ad[_0x0fa9('0xa4')]){_0x5375e9=ut['cloneAction'](_0x2aaacf,0xf,_0x0fa9('0xa5'));rpcDb[_0x0fa9('0x96')](_0x5375e9,_0x0fa9('0xa6'));}else{if(_0x2aaacf[_0x0fa9('0x9d')]>=_0xa885ad[_0x0fa9('0xa7')]){rpcDb[_0x0fa9('0x96')](_0x2aaacf,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x0fa9('0xa8')](ut['scheduledAt'](_0x2aaacf,_0x0fa9('0x9d'),_0xa885ad['dialNoSuchNumberRetryFrequency']),_0x2aaacf[_0x0fa9('0xa9')],_0x2aaacf[_0x0fa9('0xaa')]);}}delete this['actions'][_0x3db612['linkedid']];break;case _0x0fa9('0xab'):var _0x41a1db=moment()[_0x0fa9('0x5b')](_0x0fa9('0xac'));_0x2aaacf[_0x0fa9('0xad')]=_0x41a1db;_0x2aaacf[_0x0fa9('0xae')]=_0x41a1db;_0x2aaacf['dialAnswer']=!![];_0xa885ad[_0x0fa9('0x30')]+=0x1;logger[_0x0fa9('0x71')](_0x0fa9('0xaf'),_0x2aaacf[_0x0fa9('0xb0')],'\x20Queue',_0xa885ad[_0x0fa9('0x2c')],_0x0fa9('0x74'),_0xa885ad[_0x0fa9('0x30')]);ami[_0x0fa9('0x29')](_0x0fa9('0xb1'),ut[_0x0fa9('0xa2')](_0x2aaacf,'connect'));if(_0xa885ad['acw']){ami[_0x0fa9('0x29')](_0x0fa9('0xb2'),ut[_0x0fa9('0xb3')](_0x2aaacf));}break;case'16':ami[_0x0fa9('0x29')](_0x0fa9('0xb4'),ut[_0x0fa9('0xa2')](_0x2aaacf,_0x0fa9('0xb5')));emitVoiceQueueChannelRemove(ut[_0x0fa9('0xa2')](_0x2aaacf,'complete'));_0xa885ad[_0x0fa9('0x3b')]+=0x1;_0xa885ad[_0x0fa9('0x34')]+=0x1;_0xa885ad['answered']+=0x1;ut['decrementTalkink'](_0xa885ad,_0x0fa9('0xb6'));_0x2aaacf[_0x0fa9('0x9e')]=ut[_0x0fa9('0x9f')](_0x2aaacf);ut['logCustomer'](_0x2aaacf,0x4,_0x0fa9('0xb7'));rpcDb[_0x0fa9('0x93')](_0x2aaacf,_0x0fa9('0xb8'));rpcDb[_0x0fa9('0x96')](_0x2aaacf,_0x0fa9('0xb9'));rpcDb['crateCustomerReportQueue'](_0x2aaacf);_0xa885ad['sumDuration']+=_0x2aaacf[_0x0fa9('0xba')];_0xa885ad[_0x0fa9('0x31')]+=_0x2aaacf['talktime'];logger[_0x0fa9('0x71')](_0x0fa9('0xbb'),_0x2aaacf[_0x0fa9('0xb0')],_0x0fa9('0xbc'),_0xa885ad['name'],'pTalking:\x20',_0xa885ad[_0x0fa9('0x30')]);delete this[_0x0fa9('0x19')][_0x3db612[_0x0fa9('0xbd')]];break;case'BUSY':_0xa885ad[_0x0fa9('0x3d')]+=0x1;_0x2aaacf[_0x0fa9('0xbe')]+=0x1;_0x2aaacf[_0x0fa9('0x9e')]=ut['totalGlobal'](_0x2aaacf);ut[_0x0fa9('0x94')](_0x2aaacf,0x5,'Busy');ami[_0x0fa9('0x29')](_0x0fa9('0xbf'),ut[_0x0fa9('0xa2')](_0x2aaacf,_0x0fa9('0xc0')));rpcDb[_0x0fa9('0x93')](_0x2aaacf,_0x0fa9('0xc1'));if(ut[_0x0fa9('0x9f')](_0x2aaacf)>=_0xa885ad[_0x0fa9('0xa4')]){_0x5375e9=ut[_0x0fa9('0xc2')](_0x2aaacf,0xf,_0x0fa9('0xa5'));rpcDb['createCustomerFinal'](_0x5375e9,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2aaacf[_0x0fa9('0xbe')]>=_0xa885ad[_0x0fa9('0xc3')]){rpcDb[_0x0fa9('0x96')](_0x2aaacf,_0x0fa9('0xc1'));}else{rpcDb[_0x0fa9('0xa8')](ut['scheduledAt'](_0x2aaacf,'countbusyretry',_0xa885ad['dialBusyRetryFrequency']),_0x2aaacf['unlockAgent'],_0x2aaacf[_0x0fa9('0xaa')]);}}break;case _0x0fa9('0xc4'):_0xa885ad[_0x0fa9('0x42')]+=0x1;_0x2aaacf['countnoanswerretry']+=0x1;_0x2aaacf[_0x0fa9('0x9e')]=ut[_0x0fa9('0x9f')](_0x2aaacf);ut['logCustomer'](_0x2aaacf,0x3,_0x0fa9('0xc5'));ami['emit'](_0x0fa9('0xc6'),ut[_0x0fa9('0xa2')](_0x2aaacf,_0x0fa9('0xc7')));rpcDb[_0x0fa9('0x93')](_0x2aaacf,_0x0fa9('0xc8'));if(ut[_0x0fa9('0x9f')](_0x2aaacf)>=_0xa885ad[_0x0fa9('0xa4')]){_0x5375e9=ut[_0x0fa9('0xc2')](_0x2aaacf,0xf,_0x0fa9('0xa5'));rpcDb[_0x0fa9('0x96')](_0x5375e9,_0x0fa9('0xc9'));}else{if(_0x2aaacf['countnoanswerretry']>=_0xa885ad[_0x0fa9('0xca')]){rpcDb['createCustomerFinal'](_0x2aaacf,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x0fa9('0xa8')](ut[_0x0fa9('0xcb')](_0x2aaacf,_0x0fa9('0xcc'),_0xa885ad['dialNoAnswerRetryFrequency']),_0x2aaacf[_0x0fa9('0xa9')],_0x2aaacf['activeContact']);}}break;case'CONGESTION':_0xa885ad['outboundCongestionCallsDay']+=0x1;_0x2aaacf[_0x0fa9('0xcd')]+=0x1;_0x2aaacf[_0x0fa9('0x9e')]=ut[_0x0fa9('0x9f')](_0x2aaacf);ut['logCustomer'](_0x2aaacf,0x8,_0x0fa9('0xce'));ami['emit'](_0x0fa9('0xcf'),ut[_0x0fa9('0xa2')](_0x2aaacf,_0x0fa9('0xd0')));rpcDb[_0x0fa9('0x93')](_0x2aaacf,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x0fa9('0x9f')](_0x2aaacf)>=_0xa885ad[_0x0fa9('0xa4')]){_0x5375e9=ut[_0x0fa9('0xc2')](_0x2aaacf,0xf,_0x0fa9('0xa5'));rpcDb['createCustomerFinal'](_0x5375e9,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2aaacf[_0x0fa9('0xcd')]>=_0xa885ad[_0x0fa9('0xd1')]){rpcDb[_0x0fa9('0x96')](_0x2aaacf,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0fa9('0xa8')](ut[_0x0fa9('0xcb')](_0x2aaacf,_0x0fa9('0xcd'),_0xa885ad[_0x0fa9('0xd2')]),_0x2aaacf[_0x0fa9('0xa9')],_0x2aaacf[_0x0fa9('0xaa')]);}}break;case _0x0fa9('0xd3'):_0xa885ad[_0x0fa9('0x46')]+=0x1;_0x2aaacf[_0x0fa9('0xd4')]+=0x1;_0x2aaacf['countglobal']=ut[_0x0fa9('0x9f')](_0x2aaacf);ut[_0x0fa9('0x94')](_0x2aaacf,0x14,_0x0fa9('0xd5'));ami['emit'](_0x0fa9('0xd6'),ut['buildObj'](_0x2aaacf,_0x0fa9('0xd7')));rpcDb[_0x0fa9('0x93')](_0x2aaacf,'[syncHangupRequest][logAgentReject]');if(ut[_0x0fa9('0x9f')](_0x2aaacf)>=_0xa885ad[_0x0fa9('0xa4')]){_0x5375e9=ut[_0x0fa9('0xc2')](_0x2aaacf,0x14,_0x0fa9('0xd5'));rpcDb[_0x0fa9('0x96')](_0x5375e9,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2aaacf['countagentrejectretry']>=_0xa885ad[_0x0fa9('0xd8')]){rpcDb[_0x0fa9('0x96')](_0x2aaacf,_0x0fa9('0xd9'));}else{rpcDb['rescheduleContact'](ut[_0x0fa9('0xcb')](_0x2aaacf,'countagentrejectretry',_0xa885ad['dialAgentRejectRetryFrequency']),_0x2aaacf[_0x0fa9('0xa9')],_0x2aaacf['activeContact']);}}break;case _0x0fa9('0xda'):_0xa885ad[_0x0fa9('0xdb')]+=0x1;_0x2aaacf['countabandonedretry']+=0x1;_0x2aaacf['countglobal']=ut['totalGlobal'](_0x2aaacf);ut['logCustomer'](_0x2aaacf,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x2aaacf,_0x0fa9('0xdc'));if(ut[_0x0fa9('0x9f')](_0x2aaacf)>=_0xa885ad[_0x0fa9('0xa4')]){_0x5375e9=ut[_0x0fa9('0xc2')](_0x2aaacf,0xf,_0x0fa9('0xa5'));rpcDb[_0x0fa9('0x96')](_0x5375e9,_0x0fa9('0xdc'));}else{if(_0x2aaacf[_0x0fa9('0xdd')]>=_0xa885ad['dialAbandonedMaxRety']){rpcDb[_0x0fa9('0x96')](_0x2aaacf,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x0fa9('0xa8')](ut['scheduledAt'](_0x2aaacf,_0x0fa9('0xde'),_0xa885ad['dialAbandonedRetryFrequency']),_0x2aaacf[_0x0fa9('0xa9')],_0x2aaacf[_0x0fa9('0xaa')]);}}break;default:if(_0x2aaacf[_0x0fa9('0x75')]){ut['decrementTalkink'](_0xa885ad,_0x0fa9('0xdf'));ut[_0x0fa9('0x82')](_0x0fa9('0xe0')+_0xa885ad['name'],_0x3db612);}_0xa885ad[_0x0fa9('0x47')]+=0x1;_0x2aaacf[_0x0fa9('0x9e')]=ut['totalGlobal'](_0x2aaacf);ut[_0x0fa9('0x94')](_0x2aaacf,0xc,_0x3db612[_0x0fa9('0xe1')]||_0x3db612[_0x0fa9('0xe2')]);rpcDb[_0x0fa9('0x93')](_0x2aaacf,_0x0fa9('0xe3'));if(ut[_0x0fa9('0x9f')](_0x2aaacf)>=_0xa885ad[_0x0fa9('0xa4')]){_0x5375e9=ut[_0x0fa9('0xc2')](_0x2aaacf,0xf,_0x0fa9('0xa5'));rpcDb[_0x0fa9('0x96')](_0x5375e9,_0x0fa9('0xe4'));}else{rpcDb[_0x0fa9('0x96')](_0x2aaacf,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x0fa9('0x19')][_0x3db612['linkedid']];}if(!(_0x2aaacf[_0x0fa9('0x75')]&&_0x3a6533==='16')){ut[_0x0fa9('0x80')](_0xa885ad,_0x0fa9('0xe5'));logger[_0x0fa9('0x71')](_0x0fa9('0xe6'),_0x2aaacf['uniqueid'],_0x0fa9('0xbc'),_0xa885ad[_0x0fa9('0x2c')],_0x0fa9('0x72'),_0xa885ad['originated']);}if(_0x3a6533!==_0x0fa9('0xab')){delete this[_0x0fa9('0x19')][_0x3db612[_0x0fa9('0xbd')]];delete this[_0x0fa9('0x19')][_0x3db612[_0x0fa9('0xe7')]];}}};Preview[_0x0fa9('0x12')][_0x0fa9('0xe8')]=function(_0x37a2cd,_0x2a827d,_0x301999){if(_[_0x0fa9('0xe9')](_0x2a827d)&&_0x0fa9('0xea')!==typeof _0x2a827d){return;}if(_[_0x0fa9('0xe9')](_0x301999)&&_0x0fa9('0xea')!==typeof _0x301999){return;}switch(_0x301999['reason']){case'0':ut['logAgent'](_0x37a2cd,0x0,'NoSuchNumber');rpcDb[_0x0fa9('0xeb')](_0x37a2cd,_0x0fa9('0xec'));break;case'3':ut['logAgent'](_0x37a2cd,0x3,_0x0fa9('0xc5'));rpcDb[_0x0fa9('0xeb')](_0x37a2cd,_0x0fa9('0xed'));break;case'5':ut[_0x0fa9('0xee')](_0x37a2cd,0x5,'Busy');rpcDb['createAgentHistory'](_0x37a2cd,_0x0fa9('0xef'));break;case'8':ut[_0x0fa9('0xee')](_0x37a2cd,0x8,_0x0fa9('0xce'));rpcDb[_0x0fa9('0xeb')](_0x37a2cd,_0x0fa9('0xf0'));break;case'22':ut[_0x0fa9('0xee')](_0x37a2cd,0x16,_0x0fa9('0xf1'));rpcDb[_0x0fa9('0xeb')](_0x37a2cd,_0x0fa9('0xf2'));break;default:ut[_0x0fa9('0xee')](_0x37a2cd,0xc,_0x301999[_0x0fa9('0xf3')]);rpcDb[_0x0fa9('0xeb')](_0x37a2cd,_0x0fa9('0xf0'));}ut[_0x0fa9('0x80')](_0x2a827d,_0x0fa9('0xf4'));logger['info'](_0x0fa9('0xf5'),_0x37a2cd['uniqueid'],_0x0fa9('0xbc'),_0x2a827d[_0x0fa9('0x2c')],_0x0fa9('0x72'),_0x2a827d[_0x0fa9('0x51')]);delete this['actions'][_0x37a2cd['uniqueid']];};Preview[_0x0fa9('0x12')]['checkInBlack']=function(_0x3833fc,_0x17219d,_0x1ed00e,_0xed6e76,_0x859721){var _0x36b318=this;return new BPromise(function(_0x22164c,_0x6dd175){if(_[_0x0fa9('0x88')](_0x17219d)||_['isNil'](_0x17219d['Contact'])||_[_0x0fa9('0x88')](_0x17219d[_0x0fa9('0xf6')][_0x0fa9('0xf7')])||_['isNil'](_0x17219d[_0x0fa9('0x79')])){_0x6dd175(ut[_0x0fa9('0x50')]('Contact\x20is\x20undefined',_0xed6e76,_0x859721));return;}var _0x34e5a3=uuid['v4']();var _0x156a97=_0x36b318[_0x0fa9('0x16')][_0x17219d[_0x0fa9('0xf8')][_0x0fa9('0x2c')]];var _0x1d1d4b=_0x1ed00e?_0x36b318[_0x0fa9('0x1a')][_0x1ed00e]['id']:undefined;_0x36b318['actions'][_0x34e5a3]=new Action(_0x17219d,_0x156a97,_0x34e5a3,_0x1ed00e,_0x1d1d4b);var _0xf8707b=_0x36b318['actions'][_0x34e5a3];_0xf8707b[_0x0fa9('0xa9')]=_0xed6e76;_0xf8707b[_0x0fa9('0xaa')]=_0x859721;_0xf8707b[_0x0fa9('0xf9')]=_0x1ed00e;if(_['isEmpty'](_0x3833fc)){_0x36b318['execCall'](_0xf8707b,_0x156a97,_0x17219d,_0x1ed00e)[_0x0fa9('0x87')](function(_0xce2219){logger[_0x0fa9('0x71')](_0x0fa9('0xfa'),_0x0fa9('0xfb')+_0xf8707b['queue']+'\x20IdHopper:\x20'+_0xf8707b[_0x0fa9('0xfc')],JSON[_0x0fa9('0x5a')](_0xce2219));ami[_0x0fa9('0x29')]('custom:agentcalled',ut[_0x0fa9('0xa2')](_0xf8707b,'called'));_0x22164c(ut['message'](_0x0fa9('0xfd')));})['catch'](function(_0x4a264b){ut[_0x0fa9('0x63')](_0x0fa9('0xfe'),_0x4a264b);_0x6dd175(ut[_0x0fa9('0x50')](_0x0fa9('0xff'),_0xed6e76,_0x859721));});}else{_0x156a97[_0x0fa9('0x3c')]+=0x1;ut[_0x0fa9('0x100')](_0xf8707b);rpcDb[_0x0fa9('0x101')](_0xf8707b,'[Blacklist][error]');delete _0x36b318['actions'][_0x34e5a3];_0x6dd175(ut[_0x0fa9('0x50')](_0x0fa9('0x102'),_0xed6e76,_0x859721));}});};Preview[_0x0fa9('0x12')]['isTrunkReachable']=function(_0x4cb2ea){return!_[_0x0fa9('0x88')](_0x4cb2ea)&&!_[_0x0fa9('0x88')](_0x4cb2ea[_0x0fa9('0x2c')])&&!_[_0x0fa9('0x88')](_0x4cb2ea['active'])&&_0x4cb2ea['active']&&!_['isNil'](this['trunks'][util['format'](_0x0fa9('0x103'),_0x4cb2ea[_0x0fa9('0x2c')])])&&!_[_0x0fa9('0x88')](this[_0x0fa9('0x18')][util[_0x0fa9('0x5b')]('SIP/%s',_0x4cb2ea[_0x0fa9('0x2c')])][_0x0fa9('0x7c')])&&(this[_0x0fa9('0x18')][util[_0x0fa9('0x5b')]('SIP/%s',_0x4cb2ea[_0x0fa9('0x2c')])][_0x0fa9('0x7c')]===_0x0fa9('0x104')||this[_0x0fa9('0x18')][util[_0x0fa9('0x5b')](_0x0fa9('0x103'),_0x4cb2ea[_0x0fa9('0x2c')])][_0x0fa9('0x7c')]===_0x0fa9('0x105'));};Preview['prototype'][_0x0fa9('0x106')]=function(_0x14520f,_0x1b7f91){var _0x344bb6=this;return new BPromise(function(_0x7fc20d,_0x45cdb8){_0x344bb6['execRun'](_0x14520f,_0x1b7f91)[_0x0fa9('0x87')](function(_0x3eafad){_0x7fc20d(_[_0x0fa9('0x76')](_0x3eafad,[_0x0fa9('0x50')]));})[_0x0fa9('0x7e')](function(_0x29d739){if(_0x29d739['unlock']){rpcDb[_0x0fa9('0x107')](_0x14520f);}if(_0x29d739['active']){rpcDb[_0x0fa9('0x108')](_0x14520f);}_0x45cdb8(_[_0x0fa9('0x76')](_0x29d739,['message']));});});};Preview[_0x0fa9('0x12')][_0x0fa9('0x109')]=function(_0x52fc26,_0x4d893b){var _0x557946=this;return new BPromise(function(_0x126a59,_0x4133fa){var _0x269c30,_0x3568c9;rpcDb[_0x0fa9('0x10a')](_0x52fc26)['then'](function(_0x3ecb83){if(!_['isNil'](_0x3ecb83[0x0])){_0x3568c9=_0x3ecb83[0x0][_0x0fa9('0x10b')]?![]:!![];_0x269c30=_0x3ecb83[0x0][_0x0fa9('0x10b')]?!![]:![];_0x269c30=_0x4d893b?!![]:_0x269c30;}var _0xe33cf6=_0x557946[_0x0fa9('0x10c')](_0x3ecb83);if(_0xe33cf6[_0x0fa9('0x10d')]){rpcDb[_0x0fa9('0x10e')](_[_0x0fa9('0x76')](_0x3ecb83[0x0],['VoiceQueueId','Contact.phone']))['then'](function(_0x1ca29e){_0x557946[_0x0fa9('0x10f')](_0x1ca29e,_0x3ecb83[0x0],_0x4d893b,_0x3568c9,_0x269c30)[_0x0fa9('0x87')](function(_0x551254){_0x126a59(_0x551254);})[_0x0fa9('0x7e')](function(_0x4b9ad3){_0x4133fa(_0x4b9ad3);});})[_0x0fa9('0x7e')](function(_0x143ab5){ut[_0x0fa9('0x63')](_0x0fa9('0x110'),_0x143ab5);_0x4133fa(ut[_0x0fa9('0x50')](_0x0fa9('0x111'),_0x3568c9,_0x269c30));});}else{_0x4133fa(ut[_0x0fa9('0x50')](_0xe33cf6[_0x0fa9('0x50')],_0x3568c9,_0x269c30));}})[_0x0fa9('0x7e')](function(_0x1c465c){ut[_0x0fa9('0x63')]('[Preview][getContactPreview]',_0x1c465c);_0x4133fa(ut[_0x0fa9('0x50')](_0x0fa9('0x111'),![],!![]));});});};Preview['prototype'][_0x0fa9('0x10c')]=function(_0x69d6fb){if(_['isNil'](_0x69d6fb)||_['isEmpty'](_0x69d6fb)||!_[_0x0fa9('0x88')](_0x69d6fb[0x0][_0x0fa9('0x8c')])&&_[_0x0fa9('0x88')](_0x69d6fb[0x0][_0x0fa9('0x8c')][_0x0fa9('0x2c')])){ut[_0x0fa9('0x63')](_0x0fa9('0x112'),_0x69d6fb);return{'isValid':![],'message':_0x0fa9('0x113')};}var _0xab2e90=this['campaignsPreview'][_0x69d6fb[0x0][_0x0fa9('0xf8')][_0x0fa9('0x2c')]];_0xab2e90['message']=_0x0fa9('0x114');if(_[_0x0fa9('0x88')](_0xab2e90)){ut[_0x0fa9('0x63')](_0x0fa9('0x115'),_0xab2e90);return{'isValid':![],'message':_0x0fa9('0x116')};}if(!this[_0x0fa9('0x9a')](_0xab2e90['Trunk'])){ut[_0x0fa9('0x63')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0fa9('0x117')+_0xab2e90[_0x0fa9('0x2c')]+_0x0fa9('0x118'));if(!this[_0x0fa9('0x9a')](_0xab2e90[_0x0fa9('0x9b')])){ut['logger'](_0x0fa9('0x119'),_0xab2e90[_0x0fa9('0x2c')]+_0x0fa9('0x11a'));return{'isValid':![],'message':_0x0fa9('0x11b')};}}if(!ut[_0x0fa9('0x99')](_0xab2e90[_0x0fa9('0x6d')])){ut['logger'](_0x0fa9('0x11c'),_0xab2e90[_0x0fa9('0x2c')]+_0x0fa9('0x11d'));return{'isValid':![],'message':_0x0fa9('0x117')+_0xab2e90[_0x0fa9('0x2c')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x0fa9('0x11e')};};Preview[_0x0fa9('0x12')]['execCall']=function(_0x32666f,_0x4f1ddf,_0x5231f4,_0x290275){var _0x1fde04=this;return new BPromise(function(_0xcd3f16,_0x4085c1){var _0x23c82e=_0x32666f[_0x0fa9('0xb0')];var _0x3bf87c=_0x1fde04['isTrunkReachable'](_0x4f1ddf[_0x0fa9('0x56')])?util[_0x0fa9('0x5b')](_0x0fa9('0x11f'),_0x4f1ddf[_0x0fa9('0x56')][_0x0fa9('0x2c')],_[_0x0fa9('0x88')](_0x4f1ddf['dialPrefix'])?'':_0x4f1ddf['dialPrefix'][_0x0fa9('0x120')]()||'',_0x4f1ddf['dialCutDigit']>0x0?_0x5231f4['Contact'][_0x0fa9('0xf7')][_0x0fa9('0x121')](_0x4f1ddf[_0x0fa9('0x122')]):_0x5231f4[_0x0fa9('0xf6')]['phone']):util[_0x0fa9('0x5b')](_0x0fa9('0x11f'),_['isNil'](_0x4f1ddf[_0x0fa9('0x9b')])?_0x4f1ddf['Trunk']['name']:_0x4f1ddf[_0x0fa9('0x9b')][_0x0fa9('0x2c')],_[_0x0fa9('0x88')](_0x4f1ddf[_0x0fa9('0x123')])?'':_0x4f1ddf[_0x0fa9('0x123')][_0x0fa9('0x120')]()||'',_0x4f1ddf[_0x0fa9('0x122')]>0x0?_0x5231f4['Contact'][_0x0fa9('0xf7')][_0x0fa9('0x121')](_0x4f1ddf[_0x0fa9('0x122')]):_0x5231f4[_0x0fa9('0xf6')][_0x0fa9('0xf7')]);var _0x52f1f0=_0x1fde04[_0x0fa9('0x9a')](_0x4f1ddf[_0x0fa9('0x56')])?ut[_0x0fa9('0x124')](_0x4f1ddf[_0x0fa9('0x56')][_0x0fa9('0x58')],_0x4f1ddf['dialOriginateCallerIdName'],_0x4f1ddf[_0x0fa9('0x125')]>0x0?ut[_0x0fa9('0x126')](_0x4f1ddf[_0x0fa9('0x38')],_0x4f1ddf[_0x0fa9('0x125')]):_0x4f1ddf[_0x0fa9('0x38')]):ut[_0x0fa9('0x124')](_[_0x0fa9('0x88')](_0x4f1ddf['TrunkBackup'])?_0x4f1ddf[_0x0fa9('0x56')][_0x0fa9('0x58')]:_0x4f1ddf[_0x0fa9('0x9b')][_0x0fa9('0x58')],_0x4f1ddf[_0x0fa9('0x127')],_0x4f1ddf[_0x0fa9('0x125')]>0x0?ut['getCallerIdRandom'](_0x4f1ddf[_0x0fa9('0x38')],_0x4f1ddf[_0x0fa9('0x125')]):_0x4f1ddf[_0x0fa9('0x38')]);if(_0x52f1f0){_0x32666f[_0x0fa9('0x128')]=ut[_0x0fa9('0x129')](_0x52f1f0);_0x32666f[_0x0fa9('0x12a')]=ut['extractCalleridNumber'](_0x52f1f0);}var _0x4aa879=ut[_0x0fa9('0x12b')](_0x4f1ddf,_0x5231f4,_0x3bf87c,_0x52f1f0,_0x23c82e,_0x32666f);_[_0x0fa9('0x12c')](_0x32666f,ut[_0x0fa9('0x12d')](_0x4aa879));_0x32666f[_0x0fa9('0x8f')]=moment()[_0x0fa9('0x5b')](_0x0fa9('0xac'));ami[_0x0fa9('0x7b')](ut[_0x0fa9('0x12e')](_0x32666f,_0x4f1ddf,_0x4aa879,_0x32666f[_0x0fa9('0xaa')],_0x290275))['then'](function(_0x261b68){_0x4f1ddf[_0x0fa9('0x51')]+=0x1;logger[_0x0fa9('0x71')](_0x0fa9('0x12f'),_0x23c82e,_0x0fa9('0xbc'),_0x4f1ddf['name'],'originated:\x20',_0x4f1ddf['originated']);_0xcd3f16(_0x261b68);})['catch'](function(_0x1a672a){ut[_0x0fa9('0xee')](_0x32666f,0xe,_0x0fa9('0x130'));rpcDb['createAgentHistory'](_0x32666f,'[originateFailure][logOriginateFailure]');_0x4085c1(_0x1a672a);});});};Preview[_0x0fa9('0x12')][_0x0fa9('0x131')]=function(_0x16582e){if(this[_0x0fa9('0x19')][_0x16582e[_0x0fa9('0xbd')]]){this[_0x0fa9('0x19')][_0x16582e[_0x0fa9('0xbd')]][_0x0fa9('0x7d')]=_0x16582e[_0x0fa9('0x7d')];}};Preview[_0x0fa9('0x12')]['syncOriginateResponse']=function(_0x5d52dd){var _0x9f21b1=this;var _0x4e4f74=this[_0x0fa9('0x19')][_0x5d52dd[_0x0fa9('0x132')]];if(_0x4e4f74){if(_0x4e4f74[_0x0fa9('0xf9')]&&this[_0x0fa9('0x1a')][_0x4e4f74[_0x0fa9('0xf9')]]){ut[_0x0fa9('0x133')](_0x4e4f74,this[_0x0fa9('0x1a')][_0x4e4f74[_0x0fa9('0xf9')]][_0x0fa9('0x2c')],this[_0x0fa9('0x1a')][_0x4e4f74[_0x0fa9('0xf9')]]['id']);}var _0x5c5861=_[_0x0fa9('0x134')](_0x4e4f74);_0x5c5861[_0x0fa9('0xad')]=moment()[_0x0fa9('0x5b')](_0x0fa9('0xac'));var _0x574fba=_0x9f21b1['campaignsPreview'][_0x4e4f74[_0x0fa9('0x73')]];if(ut[_0x0fa9('0x135')](_0x5d52dd[_0x0fa9('0x136')])){if(_0x4e4f74['unlockAgent']){rpcDb[_0x0fa9('0x107')](_0x4e4f74['idContact']);}if(_0x4e4f74['activeContact']){rpcDb['disableContact'](_0x4e4f74['idContact']);}ami[_0x0fa9('0x29')](_0x0fa9('0x137'),ut['buildObj'](_0x4e4f74,_0x0fa9('0x138')));this[_0x0fa9('0xe8')](_0x5c5861,_0x574fba,_0x5d52dd);}else{_0x4e4f74['starttime']=moment()[_0x0fa9('0x5b')](_0x0fa9('0xac'));ut[_0x0fa9('0xee')](_0x5c5861,0x4,_0x0fa9('0xb7'));rpcDb[_0x0fa9('0xeb')](_0x5c5861,_0x0fa9('0x139'));}}};Preview['prototype'][_0x0fa9('0x1e')]=function(_0x3f4130){var _0x253a19=this;var _0x478cf2=this[_0x0fa9('0x19')][_0x3f4130[_0x0fa9('0xbd')]];var _0x103fe5;if(_0x478cf2){_0x103fe5=this[_0x0fa9('0x16')][_0x478cf2[_0x0fa9('0x73')]];logger[_0x0fa9('0x71')](_0x0fa9('0x13a'),_0x3f4130[_0x0fa9('0xbd')],'\x20Queue',_0x103fe5[_0x0fa9('0x2c')],_0x0fa9('0x74'),_0x103fe5[_0x0fa9('0x30')]);}if(this[_0x0fa9('0x19')][_0x3f4130[_0x0fa9('0xbd')]]&&_0x3f4130['linkedid']!==_0x3f4130[_0x0fa9('0xb0')]){if(_0x3f4130['cause']==='16'&&this['actions'][_0x3f4130[_0x0fa9('0xbd')]]['dialAnswer']){this[_0x0fa9('0x13b')](_0x3f4130,_0x3f4130[_0x0fa9('0xbd')],_0x3f4130['cause']);}else if(this['actions'][_0x3f4130[_0x0fa9('0xbd')]]['dialAnswer']){logger['info'](_0x0fa9('0x13c'),_0x3f4130[_0x0fa9('0xbd')],_0x3f4130[_0x0fa9('0x13d')],'\x20Queue',_0x103fe5[_0x0fa9('0x2c')],_0x0fa9('0x74'),_0x103fe5[_0x0fa9('0x30')]);this[_0x0fa9('0x13b')](_0x3f4130,_0x3f4130[_0x0fa9('0xbd')],_0x3f4130[_0x0fa9('0x13d')]);}}else if(_0x478cf2&&_[_0x0fa9('0x88')](_0x478cf2['statedesc'])&&_0x103fe5[_0x0fa9('0x13e')]&&_0x3f4130[_0x0fa9('0xbd')]===_0x3f4130[_0x0fa9('0xb0')]&&_[_0x0fa9('0x88')](_0x3f4130[_0x0fa9('0xf3')])&&_0x3f4130['cause']==='16'&&_0x3f4130[_0x0fa9('0x13f')]==='6'&&_['isUndefined'](_0x478cf2[_0x0fa9('0x140')])){if(_0x478cf2['unlockAgent']){rpcDb[_0x0fa9('0x107')](_0x478cf2[_0x0fa9('0xfc')]);}if(_0x478cf2['activeContact']){rpcDb[_0x0fa9('0x108')](_0x478cf2['idContact']);}_0x3f4130[_0x0fa9('0xf3')]='22';this[_0x0fa9('0xe8')](_0x478cf2,_0x103fe5,_0x3f4130);}else if(_0x478cf2&&_0x478cf2['transfer']){if(_0x3f4130[_0x0fa9('0x13d')]==='16'&&this[_0x0fa9('0x19')][_0x3f4130['linkedid']][_0x0fa9('0x75')]){logger[_0x0fa9('0x71')](_0x0fa9('0x141'),_0x3f4130[_0x0fa9('0xbd')],_0x3f4130[_0x0fa9('0x13d')],'\x20Queue',_0x103fe5['name'],_0x0fa9('0x74'),_0x103fe5['pTalking']);this[_0x0fa9('0x13b')](_0x3f4130,_0x3f4130[_0x0fa9('0xbd')],_0x3f4130['cause']);}else if(this[_0x0fa9('0x19')][_0x3f4130[_0x0fa9('0xbd')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x3f4130[_0x0fa9('0xbd')],_0x3f4130[_0x0fa9('0x13d')],_0x0fa9('0xbc'),_0x103fe5[_0x0fa9('0x2c')],_0x0fa9('0x74'),_0x103fe5[_0x0fa9('0x30')]);this['callProgressDetectingCustomer'](_0x3f4130,_0x3f4130[_0x0fa9('0xbd')],_0x3f4130[_0x0fa9('0x13d')]);}}};Preview[_0x0fa9('0x12')]['syncDialEnd']=function(_0x4f98bc){if(this[_0x0fa9('0x19')][_0x4f98bc[_0x0fa9('0xe7')]]&&_0x4f98bc[_0x0fa9('0xe7')]!==_0x4f98bc[_0x0fa9('0x142')]){this[_0x0fa9('0x13b')](_0x4f98bc,_0x4f98bc[_0x0fa9('0xe7')],_0x4f98bc[_0x0fa9('0xe2')]);}};Preview[_0x0fa9('0x12')][_0x0fa9('0x20')]=function(_0x564a4e){if(this['actions'][_0x564a4e[_0x0fa9('0xbd')]]&&_0x564a4e[_0x0fa9('0xbd')]!==_0x564a4e[_0x0fa9('0xb0')]&&!this[_0x0fa9('0x19')][_0x564a4e['linkedid']][_0x0fa9('0x75')]){if(_0x564a4e[_0x0fa9('0x13d')]==='1'){this[_0x0fa9('0x13b')](_0x564a4e,_0x564a4e[_0x0fa9('0xbd')],_0x564a4e['cause']);}}};Preview[_0x0fa9('0x12')]['addVariable']=function(_0x204b8b,_0x45d4d6,_0x3ad20e){if(this[_0x0fa9('0x19')][_0x204b8b]){if(_[_0x0fa9('0x88')](this[_0x0fa9('0x19')][_0x204b8b][_0x0fa9('0x143')])){this[_0x0fa9('0x19')][_0x204b8b]['variables']={};}this[_0x0fa9('0x19')][_0x204b8b][_0x0fa9('0x143')][_0x45d4d6]=_0x3ad20e;}};Preview['prototype'][_0x0fa9('0x24')]=function(_0x406bc0){try{if(!_[_0x0fa9('0x88')](_0x406bc0)){if(ut[_0x0fa9('0x144')](_[_0x0fa9('0x145')](_0x406bc0[_0x0fa9('0x146')])[0x0])){this['addVariable'](_0x406bc0[_0x0fa9('0xb0')],_['keys'](_0x406bc0[_0x0fa9('0x146')])[0x0],_0x406bc0[_0x0fa9('0x147')]);}}}catch(_0x17c7af){logger[_0x0fa9('0x148')](_0x0fa9('0x149'),util['inspect'](_0x17c7af,{'showHidden':![],'depth':null}));}};Preview[_0x0fa9('0x12')][_0x0fa9('0x26')]=function(_0x3bb379){if(_0x3bb379){if(this[_0x0fa9('0x19')][_0x3bb379[_0x0fa9('0x14a')]]){this['actions'][_0x3bb379[_0x0fa9('0x14a')]][_0x0fa9('0x140')]=!![];}}};Preview[_0x0fa9('0x12')][_0x0fa9('0x27')]=function(_0x211068){if(_0x211068){if(this[_0x0fa9('0x19')][_0x211068[_0x0fa9('0x14b')]]){this[_0x0fa9('0x19')][_0x211068[_0x0fa9('0x14b')]][_0x0fa9('0x140')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 325a818..268d5fe 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 _0x25fa=['util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x25fa,0x109));var _0xa25f=function(_0xf89597,_0x3a8e6b){_0xf89597=_0xf89597-0x0;var _0x46ba86=_0x25fa[_0xf89597];return _0x46ba86;};'use strict';var util=require(_0xa25f('0x0'));var BPromise=require('bluebird');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var _=require('lodash');var cmHopper=require(_0xa25f('0x3'));var cmHopperFinal=require(_0xa25f('0x4'));var cmHopperHistory=require(_0xa25f('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xa25f('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2ea9ea){return function(_0x3ab530){logger[_0xa25f('0x7')](_0x2ea9ea,util[_0xa25f('0x8')](_0x3ab530,{'showHidden':![],'depth':null}));};}function create(_0x22982b){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopperHistory[_0xa25f('0xb')](_0x22982b))[_0xa25f('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1bca18){return BPromise[_0xa25f('0x9')]()['then'](agentReportPreview[_0xa25f('0xb')](_0x1bca18))[_0xa25f('0xc')](loggerCatch(_0xa25f('0xd')));}function moveContact(_0x22df56){return BPromise['resolve']()[_0xa25f('0xa')](cmHopper[_0xa25f('0xe')](_0x22df56,!![]))['catch'](loggerCatch(_0xa25f('0xf')));}exports[_0xa25f('0x10')]=function(_0x50bb78){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopperBlack[_0xa25f('0x10')](_0x50bb78))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x11')));};exports[_0xa25f('0x12')]=function(_0x46cd8c){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper[_0xa25f('0x12')](_0x46cd8c))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x13')));};exports['createHistory']=function(_0x2d4f0f,_0x471679){create(_0x2d4f0f)[_0xa25f('0xc')](loggerCatch(_0x471679));moveContact(_0x2d4f0f)[_0xa25f('0xc')](loggerCatch(_0x471679));};exports[_0xa25f('0x14')]=function(_0x427105,_0x4a4805){createAgent(_0x427105)[_0xa25f('0xc')](loggerCatch(_0x4a4805));};exports['createCustomerHistory']=function(_0x32b868,_0x562573){create(_0x32b868)['catch'](loggerCatch(_0x562573));};exports[_0xa25f('0x15')]=function(_0x489c83,_0x46bb31){moveContact(_0x489c83)[_0xa25f('0xc')](loggerCatch(_0x46bb31));};exports[_0xa25f('0x16')]=function(_0x3c2665,_0x21d035,_0x504135){if(_0x21d035){_0x3c2665[_0xa25f('0x17')]=null;}if(_0x504135){_0x3c2665[_0xa25f('0x18')]=![];}return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper['rescheduleContact'](_0x3c2665))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x19')));};exports[_0xa25f('0x1a')]=function(_0x3675b5){return BPromise['resolve']()[_0xa25f('0xa')](cmHopper[_0xa25f('0x1a')](_0x3675b5))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x1b')));};exports['unlockContact']=function(_0x2812d7){return BPromise[_0xa25f('0x9')]()['then'](cmHopper[_0xa25f('0x1c')]({'UserId':null},_0x2812d7,0x1))['catch'](loggerCatch(_0xa25f('0x1d')));};exports['disableContact']=function(_0x1e1fbd){return BPromise[_0xa25f('0x9')]()['then'](cmHopper[_0xa25f('0x1c')]({'active':![]},_0x1e1fbd,0x1))[_0xa25f('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xa25f('0x1e')]=function(_0x5d39c7){var _0x1030c4={};_0x1030c4[_0xa25f('0x1f')]=_0x5d39c7[_0xa25f('0x1f')];_0x1030c4[_0xa25f('0x20')]=_0x5d39c7[_0xa25f('0x20')];_0x1030c4['calleridnum']=_0x5d39c7[_0xa25f('0x21')];_0x1030c4[_0xa25f('0x22')]=_0x5d39c7[_0xa25f('0x22')];_0x1030c4[_0xa25f('0x23')]=_0x5d39c7[_0xa25f('0x23')];_0x1030c4['queuecallerjoinAt']=_0x5d39c7[_0xa25f('0x24')];_0x1030c4[_0xa25f('0x25')]=_0x5d39c7[_0xa25f('0x24')];_0x1030c4[_0xa25f('0x26')]=0x1;_0x1030c4[_0xa25f('0x27')]=_0x5d39c7[_0xa25f('0x28')];_0x1030c4[_0xa25f('0x29')]=_0x5d39c7[_0xa25f('0x2a')];_0x1030c4[_0xa25f('0x2b')]='from-sip';_0x1030c4['exten']='xcally-motion-preview';_0x1030c4[_0xa25f('0x2c')]=0x0;_0x1030c4[_0xa25f('0x2d')]=0x1;_0x1030c4[_0xa25f('0x2e')]=_0x5d39c7[_0xa25f('0x2a')];_0x1030c4[_0xa25f('0x2f')]=_0xa25f('0x30');return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](voiceQueueReport[_0xa25f('0x31')](_0x1030c4))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x32')));};exports['getContactRecallMe']=function(_0x58ee76,_0xeb44b1){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper['getContactRecallMe'](_0x58ee76,_0xeb44b1))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xa25f('0x33')]=function(_0x25952d){return BPromise[_0xa25f('0x9')]()['then'](cmHopper['rescheduleContact'](_0x25952d,!![],!![]))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x34')));}; \ No newline at end of file +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(_0x251a9e,_0x5dfd0e){var _0x25e399=function(_0x114eae){while(--_0x114eae){_0x251a9e['push'](_0x251a9e['shift']());}};_0x25e399(++_0x5dfd0e);}(_0x0faf,0x132));var _0xf0fa=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0x0faf[_0x51a6d6];return _0x5ef1a8;};'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 diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 14fc9bb..1ac9b84 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 _0x676c=['logger2','message','getCallerId','string','isEmpty','\x22%s\x22\x20<%s>','format','isUndefined','isActive','addVariables','calleridname','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','logAgent','responsetime','ringtime','starttime','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','BOOKED','uniqueid','channelAgent','calleridnum','from-sip','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','buildAcw','interface','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','countglobal','callback','callbackuniqueid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','match','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','inspect','logger','info','loggerError','error'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc676('0x0'));var _=require(_0xc676('0x1'));var moment=require(_0xc676('0x2'));var logger=require('../../../../config/logger')(_0xc676('0x3'));var ipAgi=process[_0xc676('0x4')][_0xc676('0x5')]||_0xc676('0x6');function getSeconds(_0x22b173,_0x2802bf){var _0x4e82ea=moment(_0x22b173)[_0xc676('0x7')](0x0);var _0x228e07=moment(_0x2802bf)[_0xc676('0x7')](0x0);return _0x4e82ea[_0xc676('0x8')](_0x228e07,_0xc676('0x9'));}exports['loggerCatch']=function(_0x26ad9c){return function(_0x5e8ad4){logger['error'](_0x26ad9c,util[_0xc676('0xa')](_0x5e8ad4,{'showHidden':![],'depth':null}));};};exports[_0xc676('0xb')]=function(_0x4aa733,_0x5085b6){logger[_0xc676('0xc')](_0x4aa733,util[_0xc676('0xa')](_0x5085b6,{'showHidden':![],'depth':null}));};exports[_0xc676('0xd')]=function(_0x4e72ff,_0x5c9329){logger[_0xc676('0xe')](_0x4e72ff,util[_0xc676('0xa')](_0x5c9329,{'showHidden':![],'depth':null}));};exports[_0xc676('0xf')]=function(_0x1e06ec){return function(_0x5e8565){logger[_0xc676('0xc')](_0x1e06ec,util[_0xc676('0xa')](_0x5e8565,{'showHidden':![],'depth':null}));};};exports[_0xc676('0x10')]=function(_0x23184f,_0x47adff,_0xcee1c5){return{'message':_0x23184f,'unlock':_0x47adff,'active':_0xcee1c5};};exports[_0xc676('0x11')]=function(_0x4f8832,_0x274463,_0x4fbfb7){if(!_['isUndefined'](_0x4fbfb7)&&_0xc676('0x12')===typeof _0x4fbfb7&&!_['isEmpty'](_0x4fbfb7)){if(!_['isUndefined'](_0x274463)&&'string'===typeof _0x274463&&!_[_0xc676('0x13')](_0x274463)){return util['format'](_0xc676('0x14'),_0x274463,_0x4fbfb7);}return util[_0xc676('0x15')](_0xc676('0x14'),_0x4fbfb7,_0x4fbfb7);}if(!_[_0xc676('0x16')](_0x4f8832)&&_0xc676('0x12')===typeof _0x4f8832&&!_[_0xc676('0x13')](_0x4f8832)){return _0x4f8832;}return'\x22\x22\x20<>';};exports[_0xc676('0x17')]=function(_0x289ed9){if(_['isNil'](_0x289ed9)){return![];}return _0x289ed9;};exports[_0xc676('0x18')]=function(_0xfc64cb,_0x1bd9d9,_0x27afd,_0x26a00b,_0x87b27d,_0x474ad2){var _0xc533a9={'XMD-QUEUE':_0x1bd9d9['Queue']?_0x1bd9d9['Queue']['name']:'','XMD-CALLERID':_0x26a00b,'XMD-CALLERID-PREVIEW':_0x474ad2?util[_0xc676('0x15')]('\x22%s\x22\x20<%s>',_0x474ad2[_0xc676('0x19')],_0x474ad2['calleridnum']):_0x26a00b,'XMD-DIALID':_0x87b27d,'XMD-CONTACTID':_0x1bd9d9['ContactId'],'XMD-CDRTYPE':_0xc676('0x1a'),'CALLERID(all)':_0x26a00b,'XMD-VOICEQUEUEID':_0x1bd9d9['VoiceQueueId'],'XMD-DIALCHANNEL':_0x27afd,'XMD-DIALTIMEOUT':_0xfc64cb[_0xc676('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xc676('0x15')](_0xc676('0x1c'),_0xfc64cb[_0xc676('0x1d')]?'g':'',_[_0xc676('0x13')](_0xfc64cb['monitor_format'])?'':_0xc676('0x1e')),'XMD-DIALURL':_0xfc64cb[_0xc676('0x1f')]||'','XMD-AGI':_0xfc64cb[_0xc676('0x20')]?util['format'](_0xc676('0x21'),ipAgi,_0xfc64cb['dialQueueProject']):_0xc676('0x22'),'XMD-AGIAFTER':_0xfc64cb[_0xc676('0x1d')]?util['format'](_0xc676('0x21'),ipAgi,_0xfc64cb[_0xc676('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x474ad2?_0x474ad2[_0xc676('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x474ad2?_0x474ad2[_0xc676('0x24')]:'','XMD-DESTINATION':_0xc676('0x25')};if(!_['isEmpty'](_0xfc64cb[_0xc676('0x26')])){_0xc533a9[util[_0xc676('0x15')]('%s',_0xc676('0x27'))]=_0xfc64cb[_0xc676('0x26')];_0xc533a9[util[_0xc676('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x87b27d;}if(_0x1bd9d9&&_0x1bd9d9[_0xc676('0x28')]){for(var _0x19338b in _0x1bd9d9[_0xc676('0x28')]){if(_0x1bd9d9[_0xc676('0x28')][_0xc676('0x29')](_0x19338b)){if(!_['isNil'](_0x1bd9d9[_0xc676('0x28')][_0x19338b])&&_0x19338b!=='id'&&_0x19338b!==_0xc676('0x2a')&&_0x19338b!==_0xc676('0x2b')&&_0x19338b!==_0xc676('0x2c')){_0xc533a9[util['format'](_0xc676('0x2d'),_0xc676('0x2e'),_[_0xc676('0x2f')](_0x19338b))]=_0x1bd9d9[_0xc676('0x28')][_0x19338b];}}}}return _0xc533a9;};exports[_0xc676('0x30')]=function(_0x3a38e0){var _0x1662c5={};for(var _0x30b018 in _0x3a38e0){if(_0x3a38e0[_0xc676('0x29')](_0x30b018)){_0x1662c5[util['format']('%s',_['toLower'](_0x30b018))]=_0x3a38e0[_0x30b018];}}return{'variables':_0x1662c5};};exports['updateOriginated']=function(_0x1c4120,_0x3cd065){if(!_[_0xc676('0x31')](_0x1c4120)){if(_0x1c4120[_0xc676('0x29')]('originated')){if(_0x1c4120[_0xc676('0x32')]>0x0){_0x1c4120[_0xc676('0x32')]-=0x1;}else{logger[_0xc676('0xe')](_0xc676('0x33'),_0x3cd065);}}}else{logger[_0xc676('0xe')](_0xc676('0x34'),_0x3cd065);}};exports['logBlacklist']=function(_0x51d533){var _0x41a3d8=moment()['format'](_0xc676('0x35'));_0x51d533[_0xc676('0x36')]=0xd;_0x51d533[_0xc676('0x37')]=_0xc676('0x38');_0x51d533['starttime']=_0x41a3d8;_0x51d533['responsetime']=_0x41a3d8;_0x51d533['endtime']=_0x41a3d8;};exports[_0xc676('0x39')]=function(_0x25e35f,_0xde0c55,_0x2704b1){var _0x2d40bc=moment()[_0xc676('0x15')](_0xc676('0x35'));_0x25e35f[_0xc676('0x36')]=_0xde0c55;_0x25e35f[_0xc676('0x37')]=_0x2704b1;_0x25e35f[_0xc676('0x3a')]=_0x2d40bc;_0x25e35f[_0xc676('0x3b')]=getSeconds(_0x25e35f[_0xc676('0x3a')],_0x25e35f[_0xc676('0x3c')]);};exports[_0xc676('0x3d')]=function(_0x455c7a,_0x2cba1a,_0x2b23a5){_0x455c7a['membername']=_0x2cba1a;_0x455c7a[_0xc676('0x3e')]=_0x2b23a5;};exports[_0xc676('0x3f')]=function(_0x2020d7,_0x584058,_0x2ce4a2){var _0x1373b6=moment()[_0xc676('0x15')](_0xc676('0x35'));_0x2020d7[_0xc676('0x36')]=_0x584058;_0x2020d7[_0xc676('0x37')]=_0x2ce4a2;_0x2020d7[_0xc676('0x3a')]=_0x2020d7['responsetime']?_0x2020d7[_0xc676('0x3a')]:_0x1373b6;_0x2020d7['endtime']=_0x2020d7[_0xc676('0x40')]?_0x2020d7[_0xc676('0x40')]:_0x1373b6;_0x2020d7['ringtime']=getSeconds(_0x2020d7[_0xc676('0x3a')]||0x0,_0x2020d7[_0xc676('0x3c')]||0x0);_0x2020d7[_0xc676('0x41')]=_0x2020d7[_0xc676('0x42')]?getSeconds(_0x2020d7[_0xc676('0x40')],_0x2020d7['answertime']):0x0;};exports[_0xc676('0x43')]=function(_0x2a5be2){return _0x2a5be2===_0xc676('0x44');};exports['variablesAction']=function(_0x78dbea,_0x3c3b91,_0xf3fbd1,_0x40cbeb,_0x488087){var _0x138f11=_0x40cbeb?'RECALL':_0x78dbea[_0xc676('0x19')];_0x138f11=_0x488087?_0xc676('0x45'):_0x138f11;return{'actionid':_0x78dbea[_0xc676('0x46')],'action':'originate','channel':_0x78dbea[_0xc676('0x47')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x138f11,_0x78dbea[_0xc676('0x48')]),'Exten':'xcally-motion-preview','Context':_0xc676('0x49'),'Priority':'1','variable':_0xf3fbd1,'timeout':(_0x3c3b91['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x78dbea['uniqueid']};};exports[_0xc676('0x4a')]=function(_0x55bbdf){return _0x55bbdf[_0xc676('0x4b')]+_0x55bbdf['countcongestionretry']+_0x55bbdf[_0xc676('0x4c')]+_0x55bbdf[_0xc676('0x4d')]+_0x55bbdf[_0xc676('0x4e')];};exports[_0xc676('0x4f')]=function(_0x4d8d1d){var _0x4e3329=_[_0xc676('0x50')](_0x4d8d1d);_0x4e3329[_0xc676('0x36')]=0xf;_0x4e3329['statedesc']=_0xc676('0x51');return _0x4e3329;};exports[_0xc676('0x52')]=function(_0x59be1a,_0x38d1bc,_0x28d937){var _0xa9b988={};_0xa9b988[_0x38d1bc]=_0x59be1a[_0x38d1bc];_0xa9b988[_0xc676('0x53')]=![];_0xa9b988[_0xc676('0x54')]=moment()['add'](_0x28d937,_0xc676('0x55'))[_0xc676('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0xa9b988[_0xc676('0x56')]=_0x59be1a[_0xc676('0x56')];_0xa9b988[_0xc676('0x57')]=_0x59be1a[_0xc676('0x57')];_0xa9b988['VoiceQueueId']=_0x59be1a[_0xc676('0x58')]||undefined;return _0xa9b988;};exports[_0xc676('0x59')]=function(_0x3e0e1d,_0x42ea7a){if(!_['isNil'](_0x3e0e1d)){if(_0x3e0e1d[_0xc676('0x5a')]>0x0){_0x3e0e1d[_0xc676('0x5a')]-=0x1;}else{logger[_0xc676('0xe')](_0x42ea7a,_0xc676('0x5b'));}}else{logger[_0xc676('0xe')](_0x42ea7a,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xc676('0x5c')]=function(_0x25c3f8){if(_0x25c3f8<=0x0){return!![];}return![];};exports[_0xc676('0x5d')]=function(_0x4b8ede,_0x447311){_0x4b8ede[_0xc676('0x5e')]=_0x447311;_0x4b8ede['name']=_0x4b8ede[_0xc676('0x5f')];_0x4b8ede['interface']=_0x4b8ede[_0xc676('0x47')];return _0x4b8ede;};exports[_0xc676('0x60')]=function(_0x3ac42f){var _0x2c2b1a={};_0x2c2b1a[_0xc676('0x5f')]=_0x3ac42f[_0xc676('0x5f')];_0x2c2b1a[_0xc676('0x61')]=_0x3ac42f[_0xc676('0x47')];_0x2c2b1a[_0xc676('0x46')]=_0x3ac42f['uniqueid'];return _0x2c2b1a;};exports['agentReadyId']=function(_0x365dd3){var _0x1b4a16=[];for(var _0x7e6447 in _0x365dd3){if(_0x365dd3['hasOwnProperty'](_0x7e6447)){if(!_[_0xc676('0x31')](_0x365dd3[_0x7e6447])&&_0x365dd3[_0x7e6447]['state']===_0xc676('0x62')&&_0x365dd3[_0x7e6447][_0xc676('0x63')]===_0xc676('0x64')){_0x1b4a16[_0xc676('0x65')](_0x365dd3[_0x7e6447]['id']);}}}return _0x1b4a16;};exports[_0xc676('0x66')]=function(_0x2f3c5d){var _0xd9eead=moment()[_0xc676('0x7')](0x0);var _0x2a1025=moment(_0x2f3c5d)[_0xc676('0x7')](0x0);return _0xd9eead[_0xc676('0x8')](_0x2a1025,_0xc676('0x9'));};exports[_0xc676('0x67')]=function(_0x4fadac){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4fadac['ContactId'],'ListId':_0x4fadac['ListId'],'VoiceQueueId':_0x4fadac[_0xc676('0x58')]||undefined,'CampaignId':_0x4fadac[_0xc676('0x68')]||undefined};};exports[_0xc676('0x69')]=function(_0x3f4f17){if(_0x3f4f17===_0xc676('0x46')||_0x3f4f17===_0xc676('0x6a')||_0x3f4f17==='queue'||_0x3f4f17==='type'||_0x3f4f17===_0xc676('0x6b')||_0x3f4f17===_0xc676('0x6c')||_0x3f4f17===_0xc676('0x6d')||_0x3f4f17===_0xc676('0x47')||_0x3f4f17===_0xc676('0x19')||_0x3f4f17===_0xc676('0x53')||_0x3f4f17===_0xc676('0x48')||_0x3f4f17===_0xc676('0x54')||_0x3f4f17===_0xc676('0x4b')||_0x3f4f17==='countcongestionretry'||_0x3f4f17===_0xc676('0x4c')||_0x3f4f17===_0xc676('0x6e')||_0x3f4f17===_0xc676('0x6f')||_0x3f4f17===_0xc676('0x70')||_0x3f4f17==='callbackat'||_0x3f4f17==='recallme'||_0x3f4f17===_0xc676('0x56')||_0x3f4f17===_0xc676('0x57')||_0x3f4f17===_0xc676('0x3e')||_0x3f4f17===_0xc676('0x58')||_0x3f4f17==='sipcallid'||_0x3f4f17===_0xc676('0x71')||_0x3f4f17===_0xc676('0x72')||_0x3f4f17===_0xc676('0x73')||_0x3f4f17===_0xc676('0x74')||_0x3f4f17===_0xc676('0x75')||_0x3f4f17===_0xc676('0x76')||_0x3f4f17===_0xc676('0x77')||_0x3f4f17===_0xc676('0x78')||_0x3f4f17==='xmd-dialchannel'||_0x3f4f17===_0xc676('0x79')||_0x3f4f17===_0xc676('0x7a')||_0x3f4f17===_0xc676('0x7b')||_0x3f4f17===_0xc676('0x7c')||_0x3f4f17===_0xc676('0x7d')||_0x3f4f17===_0xc676('0x7e')||_0x3f4f17===_0xc676('0x7f')||_0x3f4f17===_0xc676('0x80')||_0x3f4f17===_0xc676('0x81')||_0x3f4f17===_0xc676('0x82')||_0x3f4f17===_0xc676('0x83')||_0x3f4f17===_0xc676('0x84')||_0x3f4f17===_0xc676('0x85')||_0x3f4f17==='rtpaudioqos'||_0x3f4f17==='rtpaudioqosbridged'||_0x3f4f17===_0xc676('0x80')||_0x3f4f17==='rtpaudioqosjitterbridged'||_0x3f4f17===_0xc676('0x82')||_0x3f4f17===_0xc676('0x83')||_0x3f4f17===_0xc676('0x84')||_0x3f4f17===_0xc676('0x85')||_0x3f4f17===_0xc676('0x86')||_0x3f4f17===_0xc676('0x87')||_0x3f4f17===_0xc676('0x36')||_0x3f4f17===_0xc676('0x37')){return![];}return!![];};exports[_0xc676('0x88')]=function(_0x409a18,_0x18219d){var _0x4ab37a,_0x1c6699,_0x4c3d34;if(_0x18219d<=0x0){_0x18219d=0x1;}_0x4ab37a=new RegExp(_0xc676('0x89')+_0x18219d+'}$');_0x1c6699=Math[_0xc676('0x8a')](0xa,_0x18219d-0x1);_0x4c3d34=Math['pow'](0xa,_0x18219d)-0x1;return util[_0xc676('0x15')]('%s',_['replace'](_0x409a18,_0x4ab37a,_['random'](_0x1c6699,_0x4c3d34)));};exports[_0xc676('0x8b')]=function(_0x38f9ac){var _0x387c57=_0x38f9ac[_0xc676('0x8c')](/"(.*?)"/);return _0x387c57?_0x387c57[0x1]:_0x38f9ac;};exports['extractCalleridNumber']=function(_0x21b860){var _0x51fdec=_0x21b860[_0xc676('0x8c')](/<(.*?)>/);return _0x51fdec?_0x51fdec[0x1]:_0x21b860;}; \ No newline at end of file +var _0x01d9=['NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','buildAcw','queue','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22'];(function(_0x411727,_0x16b412){var _0x73913b=function(_0x208c2b){while(--_0x208c2b){_0x411727['push'](_0x411727['shift']());}};_0x73913b(++_0x16b412);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x901d('0x0'));var _=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var logger=require(_0x901d('0x3'))('preview');var ipAgi=process[_0x901d('0x4')][_0x901d('0x5')]||_0x901d('0x6');function getSeconds(_0x8f7b4,_0x214f38){var _0x456f31=moment(_0x8f7b4)[_0x901d('0x7')](0x0);var _0x4e7842=moment(_0x214f38)[_0x901d('0x7')](0x0);return _0x456f31[_0x901d('0x8')](_0x4e7842,_0x901d('0x9'));}exports[_0x901d('0xa')]=function(_0x313f85){return function(_0x39fc94){logger[_0x901d('0xb')](_0x313f85,util[_0x901d('0xc')](_0x39fc94,{'showHidden':![],'depth':null}));};};exports[_0x901d('0xd')]=function(_0xacff40,_0x440fb0){logger[_0x901d('0xe')](_0xacff40,util[_0x901d('0xc')](_0x440fb0,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x439f17,_0x5ba100){logger[_0x901d('0xb')](_0x439f17,util[_0x901d('0xc')](_0x5ba100,{'showHidden':![],'depth':null}));};exports[_0x901d('0xf')]=function(_0x42ce79){return function(_0x15ebaf){logger['info'](_0x42ce79,util[_0x901d('0xc')](_0x15ebaf,{'showHidden':![],'depth':null}));};};exports[_0x901d('0x10')]=function(_0x3d00e4,_0x1618a8,_0xb8869a){return{'message':_0x3d00e4,'unlock':_0x1618a8,'active':_0xb8869a};};exports[_0x901d('0x11')]=function(_0x530a2b,_0x991ee2,_0x13903c){if(!_[_0x901d('0x12')](_0x13903c)&&_0x901d('0x13')===typeof _0x13903c&&!_[_0x901d('0x14')](_0x13903c)){if(!_[_0x901d('0x12')](_0x991ee2)&&_0x901d('0x13')===typeof _0x991ee2&&!_[_0x901d('0x14')](_0x991ee2)){return util[_0x901d('0x15')](_0x901d('0x16'),_0x991ee2,_0x13903c);}return util[_0x901d('0x15')](_0x901d('0x16'),_0x13903c,_0x13903c);}if(!_[_0x901d('0x12')](_0x530a2b)&&_0x901d('0x13')===typeof _0x530a2b&&!_[_0x901d('0x14')](_0x530a2b)){return _0x530a2b;}return _0x901d('0x17');};exports[_0x901d('0x18')]=function(_0x31e1f7){if(_['isNil'](_0x31e1f7)){return![];}return _0x31e1f7;};exports[_0x901d('0x19')]=function(_0x2f32f8,_0x4d27db,_0x5bdff4,_0x496a06,_0x53f8ae,_0x316a9f){var _0x44ea6f={'XMD-QUEUE':_0x4d27db['Queue']?_0x4d27db[_0x901d('0x1a')][_0x901d('0x1b')]:'','XMD-CALLERID':_0x496a06,'XMD-CALLERID-PREVIEW':_0x316a9f?util['format'](_0x901d('0x16'),_0x316a9f[_0x901d('0x1c')],_0x316a9f[_0x901d('0x1d')]):_0x496a06,'XMD-DIALID':_0x53f8ae,'XMD-CONTACTID':_0x4d27db[_0x901d('0x1e')],'XMD-CDRTYPE':_0x901d('0x1f'),'CALLERID(all)':_0x496a06,'XMD-VOICEQUEUEID':_0x4d27db[_0x901d('0x20')],'XMD-DIALCHANNEL':_0x5bdff4,'XMD-DIALTIMEOUT':_0x2f32f8[_0x901d('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0x901d('0x15')]('\x22rtTxX%s%s\x22',_0x2f32f8[_0x901d('0x22')]?'g':'',_[_0x901d('0x14')](_0x2f32f8[_0x901d('0x23')])?'':_0x901d('0x24')),'XMD-DIALURL':_0x2f32f8['dialPreviewUrl']||'','XMD-AGI':_0x2f32f8[_0x901d('0x25')]?util[_0x901d('0x15')](_0x901d('0x26'),ipAgi,_0x2f32f8[_0x901d('0x25')]):_0x901d('0x27'),'XMD-AGIAFTER':_0x2f32f8['dialQueueProject2']?util[_0x901d('0x15')](_0x901d('0x26'),ipAgi,_0x2f32f8[_0x901d('0x22')]):_0x901d('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x316a9f?_0x316a9f[_0x901d('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x316a9f?_0x316a9f[_0x901d('0x29')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x901d('0x14')](_0x2f32f8['monitor_format'])){_0x44ea6f[util[_0x901d('0x15')]('%s',_0x901d('0x2a'))]=_0x2f32f8[_0x901d('0x23')];_0x44ea6f[util[_0x901d('0x15')]('%s',_0x901d('0x2b'))]=_0x53f8ae;}if(_0x4d27db&&_0x4d27db[_0x901d('0x2c')]){for(var _0x4137b7 in _0x4d27db[_0x901d('0x2c')]){if(_0x4d27db[_0x901d('0x2c')][_0x901d('0x2d')](_0x4137b7)){if(!_[_0x901d('0x2e')](_0x4d27db[_0x901d('0x2c')][_0x4137b7])&&_0x4137b7!=='id'&&_0x4137b7!==_0x901d('0x2f')&&_0x4137b7!==_0x901d('0x30')&&_0x4137b7!==_0x901d('0x31')){_0x44ea6f[util['format'](_0x901d('0x32'),_0x901d('0x33'),_[_0x901d('0x34')](_0x4137b7))]=_0x4d27db['Contact'][_0x4137b7];}}}}return _0x44ea6f;};exports[_0x901d('0x35')]=function(_0x1c6e1c){var _0x339235={};for(var _0x410ef4 in _0x1c6e1c){if(_0x1c6e1c[_0x901d('0x2d')](_0x410ef4)){_0x339235[util[_0x901d('0x15')]('%s',_[_0x901d('0x36')](_0x410ef4))]=_0x1c6e1c[_0x410ef4];}}return{'variables':_0x339235};};exports[_0x901d('0x37')]=function(_0x3d8421,_0x20a58d){if(!_['isNil'](_0x3d8421)){if(_0x3d8421['hasOwnProperty'](_0x901d('0x38'))){if(_0x3d8421['originated']>0x0){_0x3d8421[_0x901d('0x38')]-=0x1;}else{logger[_0x901d('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x20a58d);}}}else{logger[_0x901d('0xb')](_0x901d('0x39'),_0x20a58d);}};exports[_0x901d('0x3a')]=function(_0x508ac6){var _0x1a1be6=moment()[_0x901d('0x15')](_0x901d('0x3b'));_0x508ac6[_0x901d('0x3c')]=0xd;_0x508ac6[_0x901d('0x3d')]=_0x901d('0x3e');_0x508ac6[_0x901d('0x3f')]=_0x1a1be6;_0x508ac6[_0x901d('0x40')]=_0x1a1be6;_0x508ac6[_0x901d('0x41')]=_0x1a1be6;};exports[_0x901d('0x42')]=function(_0x30adcd,_0x3d4f8b,_0x27b101){var _0x3a6b5f=moment()[_0x901d('0x15')](_0x901d('0x3b'));_0x30adcd['state']=_0x3d4f8b;_0x30adcd[_0x901d('0x3d')]=_0x27b101;_0x30adcd[_0x901d('0x40')]=_0x3a6b5f;_0x30adcd['ringtime']=getSeconds(_0x30adcd['responsetime'],_0x30adcd[_0x901d('0x3f')]);};exports['logLookAgent']=function(_0x2a5057,_0x3d0556,_0x4bebe){_0x2a5057[_0x901d('0x43')]=_0x3d0556;_0x2a5057[_0x901d('0x44')]=_0x4bebe;};exports[_0x901d('0x45')]=function(_0x5df4cb,_0x4ce6e4,_0x4ee804){var _0x4c4fd0=moment()[_0x901d('0x15')](_0x901d('0x3b'));_0x5df4cb['state']=_0x4ce6e4;_0x5df4cb[_0x901d('0x3d')]=_0x4ee804;_0x5df4cb[_0x901d('0x40')]=_0x5df4cb['responsetime']?_0x5df4cb[_0x901d('0x40')]:_0x4c4fd0;_0x5df4cb[_0x901d('0x41')]=_0x5df4cb[_0x901d('0x41')]?_0x5df4cb[_0x901d('0x41')]:_0x4c4fd0;_0x5df4cb['ringtime']=getSeconds(_0x5df4cb['responsetime']||0x0,_0x5df4cb[_0x901d('0x3f')]||0x0);_0x5df4cb[_0x901d('0x46')]=_0x5df4cb[_0x901d('0x47')]?getSeconds(_0x5df4cb[_0x901d('0x41')],_0x5df4cb[_0x901d('0x47')]):0x0;};exports[_0x901d('0x48')]=function(_0x88bb50){return _0x88bb50===_0x901d('0x49');};exports[_0x901d('0x4a')]=function(_0x2b23bc,_0x31be2d,_0x50a0c5,_0x276803,_0x4d2b1c){var _0x2b28a7=_0x276803?'RECALL':_0x2b23bc[_0x901d('0x1c')];_0x2b28a7=_0x4d2b1c?'BOOKED':_0x2b28a7;return{'actionid':_0x2b23bc[_0x901d('0x4b')],'action':_0x901d('0x4c'),'channel':_0x2b23bc[_0x901d('0x4d')],'callerid':util[_0x901d('0x15')](_0x901d('0x16'),_0x2b28a7,_0x2b23bc[_0x901d('0x1d')]),'Exten':_0x901d('0x4e'),'Context':_0x901d('0x4f'),'Priority':'1','variable':_0x50a0c5,'timeout':(_0x31be2d[_0x901d('0x50')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2b23bc[_0x901d('0x4b')]};};exports[_0x901d('0x51')]=function(_0x54fc19){return _0x54fc19[_0x901d('0x52')]+_0x54fc19[_0x901d('0x53')]+_0x54fc19[_0x901d('0x54')]+_0x54fc19[_0x901d('0x55')]+_0x54fc19[_0x901d('0x56')];};exports[_0x901d('0x57')]=function(_0x27459b){var _0x43135c=_[_0x901d('0x58')](_0x27459b);_0x43135c[_0x901d('0x3c')]=0xf;_0x43135c[_0x901d('0x3d')]=_0x901d('0x59');return _0x43135c;};exports[_0x901d('0x5a')]=function(_0x23f2a9,_0x4888e8,_0x505965){var _0x3b85e3={};_0x3b85e3[_0x4888e8]=_0x23f2a9[_0x4888e8];_0x3b85e3[_0x901d('0x5b')]=![];_0x3b85e3[_0x901d('0x5c')]=moment()[_0x901d('0x5d')](_0x505965,_0x901d('0x5e'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3b85e3[_0x901d('0x1e')]=_0x23f2a9[_0x901d('0x1e')];_0x3b85e3['ListId']=_0x23f2a9[_0x901d('0x5f')];_0x3b85e3[_0x901d('0x20')]=_0x23f2a9['VoiceQueueId']||undefined;return _0x3b85e3;};exports[_0x901d('0x60')]=function(_0x53dc43,_0x3d7c00){if(!_[_0x901d('0x2e')](_0x53dc43)){if(_0x53dc43[_0x901d('0x61')]>0x0){_0x53dc43[_0x901d('0x61')]-=0x1;}else{logger['error'](_0x3d7c00,_0x901d('0x62'));}}else{logger[_0x901d('0xb')](_0x3d7c00,_0x901d('0x63'));}};exports[_0x901d('0x64')]=function(_0x10c51c){if(_0x10c51c<=0x0){return!![];}return![];};exports[_0x901d('0x65')]=function(_0x17c716,_0x42ddd){_0x17c716[_0x901d('0x66')]=_0x42ddd;_0x17c716[_0x901d('0x1b')]=_0x17c716['queue'];_0x17c716[_0x901d('0x67')]=_0x17c716['channelAgent'];return _0x17c716;};exports[_0x901d('0x68')]=function(_0x26e6a2){var _0xaa7394={};_0xaa7394[_0x901d('0x69')]=_0x26e6a2[_0x901d('0x69')];_0xaa7394[_0x901d('0x67')]=_0x26e6a2[_0x901d('0x4d')];_0xaa7394[_0x901d('0x4b')]=_0x26e6a2['uniqueid'];return _0xaa7394;};exports[_0x901d('0x6a')]=function(_0x3eeca4){var _0x226b81=[];for(var _0x4b7e88 in _0x3eeca4){if(_0x3eeca4[_0x901d('0x2d')](_0x4b7e88)){if(!_['isNil'](_0x3eeca4[_0x4b7e88])&&_0x3eeca4[_0x4b7e88][_0x901d('0x3c')]===_0x901d('0x6b')&&_0x3eeca4[_0x4b7e88][_0x901d('0x6c')]==='reachable'){_0x226b81[_0x901d('0x6d')](_0x3eeca4[_0x4b7e88]['id']);}}}return _0x226b81;};exports[_0x901d('0x6e')]=function(_0x3740a3){var _0x45e4d5=moment()[_0x901d('0x7')](0x0);var _0x74cfc=moment(_0x3740a3)['milliseconds'](0x0);return _0x45e4d5[_0x901d('0x8')](_0x74cfc,_0x901d('0x9'));};exports[_0x901d('0x6f')]=function(_0x3229ae){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3229ae[_0x901d('0x1e')],'ListId':_0x3229ae[_0x901d('0x5f')],'VoiceQueueId':_0x3229ae['VoiceQueueId']||undefined,'CampaignId':_0x3229ae[_0x901d('0x70')]||undefined};};exports['filterKey']=function(_0x54cac2){if(_0x54cac2==='uniqueid'||_0x54cac2==='idContact'||_0x54cac2===_0x901d('0x69')||_0x54cac2===_0x901d('0x71')||_0x54cac2===_0x901d('0x72')||_0x54cac2==='dialAnswer'||_0x54cac2===_0x901d('0x43')||_0x54cac2==='channelAgent'||_0x54cac2===_0x901d('0x1c')||_0x54cac2===_0x901d('0x5b')||_0x54cac2===_0x901d('0x1d')||_0x54cac2===_0x901d('0x5c')||_0x54cac2===_0x901d('0x52')||_0x54cac2===_0x901d('0x53')||_0x54cac2===_0x901d('0x54')||_0x54cac2===_0x901d('0x73')||_0x54cac2===_0x901d('0x74')||_0x54cac2===_0x901d('0x75')||_0x54cac2===_0x901d('0x76')||_0x54cac2===_0x901d('0x77')||_0x54cac2===_0x901d('0x1e')||_0x54cac2===_0x901d('0x5f')||_0x54cac2==='UserId'||_0x54cac2==='VoiceQueueId'||_0x54cac2===_0x901d('0x78')||_0x54cac2===_0x901d('0x79')||_0x54cac2===_0x901d('0x7a')||_0x54cac2===_0x901d('0x7b')||_0x54cac2===_0x901d('0x7c')||_0x54cac2===_0x901d('0x7d')||_0x54cac2===_0x901d('0x7e')||_0x54cac2==='xmd-dialoptions'||_0x54cac2==='xmd-dialid'||_0x54cac2==='xmd-dialchannel'||_0x54cac2===_0x901d('0x7f')||_0x54cac2===_0x901d('0x80')||_0x54cac2===_0x901d('0x81')||_0x54cac2===_0x901d('0x82')||_0x54cac2===_0x901d('0x83')||_0x54cac2===_0x901d('0x84')||_0x54cac2===_0x901d('0x85')||_0x54cac2===_0x901d('0x86')||_0x54cac2===_0x901d('0x87')||_0x54cac2==='rtpaudioqosloss'||_0x54cac2==='rtpaudioqoslossbridged'||_0x54cac2===_0x901d('0x88')||_0x54cac2===_0x901d('0x89')||_0x54cac2===_0x901d('0x84')||_0x54cac2===_0x901d('0x85')||_0x54cac2===_0x901d('0x86')||_0x54cac2===_0x901d('0x87')||_0x54cac2===_0x901d('0x8a')||_0x54cac2===_0x901d('0x8b')||_0x54cac2===_0x901d('0x88')||_0x54cac2===_0x901d('0x89')||_0x54cac2==='bridgepeer'||_0x54cac2===_0x901d('0x8c')||_0x54cac2===_0x901d('0x3c')||_0x54cac2==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2a422d,_0x3cfd0c){var _0x4b156c,_0x242954,_0x16b025;if(_0x3cfd0c<=0x0){_0x3cfd0c=0x1;}_0x4b156c=new RegExp(_0x901d('0x8d')+_0x3cfd0c+'}$');_0x242954=Math[_0x901d('0x8e')](0xa,_0x3cfd0c-0x1);_0x16b025=Math['pow'](0xa,_0x3cfd0c)-0x1;return util[_0x901d('0x15')]('%s',_[_0x901d('0x8f')](_0x2a422d,_0x4b156c,_[_0x901d('0x90')](_0x242954,_0x16b025)));};exports[_0x901d('0x91')]=function(_0x25b089){var _0x11088a=_0x25b089['match'](/"(.*?)"/);return _0x11088a?_0x11088a[0x1]:_0x25b089;};exports[_0x901d('0x92')]=function(_0x302049){var _0x26b498=_0x302049['match'](/<(.*?)>/);return _0x26b498?_0x26b498[0x1]:_0x302049;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a8296d5..f343fe7 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x4766d2,_0x1c832c){var _0xa8f44b=function(_0x59a101){while(--_0x59a101){_0x4766d2['push'](_0x4766d2['shift']());}};_0xa8f44b(++_0x1c832c);}(_0x5f2f,0x73));var _0xf5f2=function(_0xd6e799,_0x253932){_0xd6e799=_0xd6e799-0x0;var _0x1ce8cf=_0x5f2f[_0xd6e799];return _0x1ce8cf;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x32d2e3,_0x447277){var _0x5116db=function(_0x3f8f9c){while(--_0x3f8f9c){_0x32d2e3['push'](_0x32d2e3['shift']());}};_0x5116db(++_0x447277);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e375,_0xdc0dde){_0x20e375=_0x20e375-0x0;var _0x55ac5d=_0xb10b[_0x20e375];return _0x55ac5d;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1ff59c3..7e3b3fd 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 _0xcad9=['freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','sumDuration','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','mergeFromDatabase','prototype','initAgents','length','isUndefined','SIP/%s','name','initTrunks','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','diff','queuecallerjoinAt','seconds','queuecallerexitAt','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','disposition','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts'];(function(_0x32fc1b,_0x42aba0){var _0x4937b7=function(_0x2f9042){while(--_0x2f9042){_0x32fc1b['push'](_0x32fc1b['shift']());}};_0x4937b7(++_0x42aba0);}(_0xcad9,0x1e1));var _0x9cad=function(_0x5e1535,_0x40409c){_0x5e1535=_0x5e1535-0x0;var _0x3399c9=_0xcad9[_0x5e1535];return _0x3399c9;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x9cad('0x0'));var moment=require(_0x9cad('0x1'));var Agent=require(_0x9cad('0x2'));var Telephone=require(_0x9cad('0x3'));var Trunk=require(_0x9cad('0x4'));var VoiceQueue=require(_0x9cad('0x5'));var Trigger=require(_0x9cad('0x6'));var Template=require('../model/template');var Campaign=require(_0x9cad('0x7'));var VoiceExtension=require(_0x9cad('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x9cad('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x9cad('0xa'));var DeskAccount=require(_0x9cad('0xb'));var VtigerAccount=require(_0x9cad('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x9cad('0xd'));var FreshsalesAccount=require(_0x9cad('0xe'));var FaxAccount=require(_0x9cad('0xf'));var Realtime=function(){this[_0x9cad('0x10')]={};this[_0x9cad('0x11')]={};this[_0x9cad('0x12')]={};this[_0x9cad('0x13')]={};this[_0x9cad('0x14')]={};this['campaigns']={};this[_0x9cad('0x15')]={};this[_0x9cad('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x9cad('0x17')]={};this['channels']={};this['queueChannels']={};this[_0x9cad('0x18')]={};this[_0x9cad('0x19')]={};this[_0x9cad('0x1a')]={};this[_0x9cad('0x1b')]={};this[_0x9cad('0x1c')]={};this[_0x9cad('0x1d')]={};this[_0x9cad('0x1e')]={};this[_0x9cad('0x1f')]={};this[_0x9cad('0x20')]={};this[_0x9cad('0x21')]={};this['dynamics365Accounts']={};this[_0x9cad('0x22')]={};this[_0x9cad('0x23')]={};};function freeIsNotKey(_0x2729e6,_0x5c4f48,_0x534e7a){var _0x270df1=_['mapKeys'](_0x2729e6,function(_0x5dac62,_0x2f5726){return _0x5dac62[_0x534e7a];});for(var _0x4db3f8 in _0x5c4f48){if(_0x5c4f48[_0x9cad('0x24')](_0x4db3f8)){if(!_0x270df1[_0x4db3f8]){delete _0x5c4f48[_0x4db3f8];}}}}function freeIsNotKeySip(_0x29c498,_0x2e6eb6){var _0x551d35=_[_0x9cad('0x25')](_0x29c498,function(_0x242e7e,_0x5441ef){return util[_0x9cad('0x26')]('SIP/%s',_0x242e7e['name']);});for(var _0x9b2b93 in _0x2e6eb6){if(_0x2e6eb6[_0x9cad('0x24')](_0x9b2b93)){if(!_0x551d35[_0x9b2b93]){delete _0x2e6eb6[_0x9b2b93];}}}}function freeIsNotKeyAgent(_0x5c4ba8,_0xce03b6){var _0x525075=_[_0x9cad('0x25')](_0x5c4ba8,function(_0x265e3b,_0x3b8724){var _0x48d91e=_[_0x9cad('0x27')](_0x265e3b[_0x9cad('0x28')])?util[_0x9cad('0x26')]('SIP/%s',_0x265e3b['name']):_0x265e3b[_0x9cad('0x28')];return _0x48d91e;});for(var _0x374dcc in _0xce03b6){if(_0xce03b6[_0x9cad('0x24')](_0x374dcc)){if(!_0x525075[_0x374dcc]){delete _0xce03b6[_0x374dcc];}}}}function clearVoiceCallReports(_0x43f12a){_0x43f12a[_0x9cad('0x29')]=0x0;_0x43f12a[_0x9cad('0x2a')]=0x0;_0x43f12a[_0x9cad('0x2b')]=0x0;_0x43f12a['sumDuration']=0x0;_0x43f12a[_0x9cad('0x2c')]=0x0;}function clearCampaigns(_0x3d4090){if(!_[_0x9cad('0x2d')](_0x3d4090)){for(var _0x11533e in _0x3d4090){if(_0x3d4090[_0x9cad('0x24')](_0x11533e)){_0x3d4090[_0x11533e][_0x9cad('0x2e')]=0x0;_0x3d4090[_0x11533e]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x448950){if(!_[_0x9cad('0x2d')](_0x448950)){for(var _0x15a6a9 in _0x448950){if(_0x448950[_0x9cad('0x24')](_0x15a6a9)){_0x448950[_0x15a6a9][_0x9cad('0x29')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x2a')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x2f')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x30')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x2b')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x31')]=0x0;_0x448950[_0x15a6a9]['sumBillable']=0x0;_0x448950[_0x15a6a9]['outboundAnswerAgiCallsDay']=0x0;_0x448950[_0x15a6a9][_0x9cad('0x32')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x33')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x34')]=0x0;_0x448950[_0x15a6a9]['outboundNoSuchCallsDay']=0x0;_0x448950[_0x15a6a9][_0x9cad('0x35')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x36')]=0x0;_0x448950[_0x15a6a9]['outboundDropCallsDayCallersExit']=0x0;_0x448950[_0x15a6a9]['outboundBlacklistCallsDay']=0x0;_0x448950[_0x15a6a9]['outboundOriginateFailureCallsDay']=0x0;_0x448950[_0x15a6a9][_0x9cad('0x37')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x38')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x39')]=0x0;_0x448950[_0x15a6a9][_0x9cad('0x3a')]=0x0;_0x448950[_0x15a6a9]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0x9cad('0x3b')]=function(_0x369546,_0x2e6991){for(var _0x2db643 in _0x2e6991){if(_0x369546[_0x9cad('0x24')](_0x2db643)){_0x369546[_0x2db643]=_0x2e6991[_0x2db643];}}};Realtime[_0x9cad('0x3c')][_0x9cad('0x3d')]=function(){var _0x3783ab=this;return function(_0x5eb298){if(_0x5eb298){freeIsNotKeyAgent(_0x5eb298,_0x3783ab[_0x9cad('0x10')]);for(var _0x49b1c2=0x0,_0x32b9eb={},_0x2702ba={};_0x49b1c2<_0x5eb298[_0x9cad('0x3e')];_0x49b1c2+=0x1){_0x32b9eb=_0x5eb298[_0x49b1c2];var _0x4f17d3=_[_0x9cad('0x27')](_0x32b9eb['interface'])?util[_0x9cad('0x26')]('SIP/%s',_0x32b9eb['name']):_0x32b9eb[_0x9cad('0x28')];if(_[_0x9cad('0x3f')](_0x3783ab['agents'][_0x4f17d3])){_0x3783ab[_0x9cad('0x10')][_0x4f17d3]=new Agent(_0x32b9eb);}else{_0x3783ab['mergeFromDatabase'](_0x3783ab[_0x9cad('0x10')][_0x4f17d3],_0x32b9eb);}}}return _0x3783ab['agents'];};};Realtime[_0x9cad('0x3c')]['initTelephones']=function(){var _0x4b25cb=this;return function(_0xa552be){if(_0xa552be){freeIsNotKeySip(_0xa552be,_0x4b25cb['telephones']);for(var _0x254ff1=0x0,_0x5f3e98={},_0x4dd18c={};_0x254ff1<_0xa552be['length'];_0x254ff1+=0x1){_0x5f3e98=_0xa552be[_0x254ff1];if(_[_0x9cad('0x3f')](_0x4b25cb[_0x9cad('0x11')][util[_0x9cad('0x26')](_0x9cad('0x40'),_0x5f3e98[_0x9cad('0x41')])])){_0x4b25cb[_0x9cad('0x11')][util['format'](_0x9cad('0x40'),_0x5f3e98[_0x9cad('0x41')])]=new Telephone(_0x5f3e98);}else{_0x4b25cb['mergeFromDatabase'](_0x4b25cb[_0x9cad('0x11')][util[_0x9cad('0x26')](_0x9cad('0x40'),_0x5f3e98[_0x9cad('0x41')])],_0x5f3e98);}}}return _0x4b25cb['telephones'];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x42')]=function(){var _0x46d3bf=this;return function(_0x1fb380){if(_0x1fb380){freeIsNotKeySip(_0x1fb380,_0x46d3bf[_0x9cad('0x12')]);for(var _0x4670eb=0x0,_0x136686={},_0x5e38e3={};_0x4670eb<_0x1fb380['length'];_0x4670eb+=0x1){_0x136686=_0x1fb380[_0x4670eb];if(_['isUndefined'](_0x46d3bf[_0x9cad('0x12')][util[_0x9cad('0x26')]('SIP/%s',_0x136686[_0x9cad('0x41')])])){_0x46d3bf[_0x9cad('0x12')][util[_0x9cad('0x26')](_0x9cad('0x40'),_0x136686[_0x9cad('0x41')])]=new Trunk(_0x136686);}else{_0x46d3bf[_0x9cad('0x3b')](_0x46d3bf[_0x9cad('0x12')][util[_0x9cad('0x26')]('SIP/%s',_0x136686[_0x9cad('0x41')])],_0x136686);}}}return _0x46d3bf[_0x9cad('0x12')];};};Realtime[_0x9cad('0x3c')]['initVoiceQueues']=function(){var _0x4d4a50=this;return function(_0x1ff71a){if(_0x1ff71a){freeIsNotKey(_0x1ff71a,_0x4d4a50['voiceQueues'],_0x9cad('0x41'));for(var _0x4173b8=0x0,_0x28bc7b={},_0x13a74d={};_0x4173b8<_0x1ff71a['length'];_0x4173b8+=0x1){_0x28bc7b=_0x1ff71a[_0x4173b8];if(_[_0x9cad('0x3f')](_0x4d4a50[_0x9cad('0x13')][_0x28bc7b[_0x9cad('0x41')]])){_0x4d4a50[_0x9cad('0x13')][_0x28bc7b[_0x9cad('0x41')]]=new VoiceQueue(_0x28bc7b);}else{_0x4d4a50['mergeFromDatabase'](_0x4d4a50['voiceQueues'][_0x28bc7b[_0x9cad('0x41')]],_0x28bc7b);}}}return _0x4d4a50[_0x9cad('0x13')];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x43')]=function(){var _0x389d2e=this;return function(_0x5a63e0){if(_0x5a63e0){freeIsNotKey(_0x5a63e0,_0x389d2e['triggers'],'id');for(var _0x1fa7d6=0x0,_0xc07e7f={},_0x4c62f5={};_0x1fa7d6<_0x5a63e0['length'];_0x1fa7d6+=0x1){_0xc07e7f=_0x5a63e0[_0x1fa7d6];if(_[_0x9cad('0x3f')](_0x389d2e['triggers'][_0xc07e7f['id']])){_0x389d2e['triggers'][_0xc07e7f['id']]=new Trigger(_0xc07e7f);}else{_0x389d2e[_0x9cad('0x3b')](_0x389d2e[_0x9cad('0x14')][_0xc07e7f['id']],_0xc07e7f);}}}return _0x389d2e['triggers'];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x44')]=function(){var _0x4f95a0=this;return function(_0x3de893){if(_0x3de893){freeIsNotKey(_0x3de893,_0x4f95a0['templates'],'id');for(var _0x1afb9f=0x0,_0x3eba2d={},_0x349eea={};_0x1afb9f<_0x3de893['length'];_0x1afb9f+=0x1){_0x3eba2d=_0x3de893[_0x1afb9f];if(_['isUndefined'](_0x4f95a0[_0x9cad('0x15')][_0x3eba2d['id']])){_0x4f95a0[_0x9cad('0x15')][_0x3eba2d['id']]=new Template(_0x3eba2d);}else{_0x4f95a0[_0x9cad('0x3b')](_0x4f95a0['templates'][_0x3eba2d['id']],_0x3eba2d);}}}return _0x4f95a0['templates'];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x45')]=function(){var _0x8476e2=this;return function(_0x349b89){if(_0x349b89){freeIsNotKey(_0x349b89,_0x8476e2[_0x9cad('0x1a')],'id');for(var _0x52a5f3=0x0,_0x3d87ab={},_0x24a01c={};_0x52a5f3<_0x349b89[_0x9cad('0x3e')];_0x52a5f3+=0x1){_0x3d87ab=_0x349b89[_0x52a5f3];if(_[_0x9cad('0x3f')](_0x8476e2[_0x9cad('0x1a')][_0x3d87ab['id']])){_0x8476e2[_0x9cad('0x1a')][_0x3d87ab['id']]=new ZendeskAccount(_0x3d87ab);}else{_0x8476e2['mergeFromDatabase'](_0x8476e2[_0x9cad('0x1a')][_0x3d87ab['id']],_0x3d87ab);}}}return _0x8476e2[_0x9cad('0x1a')];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x46')]=function(){var _0x44e72c=this;return function(_0x2936bb){if(_0x2936bb){freeIsNotKey(_0x2936bb,_0x44e72c[_0x9cad('0x1b')],'id');for(var _0x5c92fb=0x0,_0xa6aa24={},_0x32afe5={};_0x5c92fb<_0x2936bb['length'];_0x5c92fb+=0x1){_0xa6aa24=_0x2936bb[_0x5c92fb];if(_[_0x9cad('0x3f')](_0x44e72c['salesforceAccounts'][_0xa6aa24['id']])){_0x44e72c[_0x9cad('0x1b')][_0xa6aa24['id']]=new SalesforceAccount(_0xa6aa24);}else{_0x44e72c[_0x9cad('0x3b')](_0x44e72c[_0x9cad('0x1b')][_0xa6aa24['id']],_0xa6aa24);}}}return _0x44e72c[_0x9cad('0x1b')];};};Realtime['prototype'][_0x9cad('0x47')]=function(){var _0x2546bb=this;return function(_0x2e8898){if(_0x2e8898){freeIsNotKey(_0x2e8898,_0x2546bb['freshdeskAccounts'],'id');for(var _0x558e4a=0x0,_0x75c38b={},_0x257d1f={};_0x558e4a<_0x2e8898[_0x9cad('0x3e')];_0x558e4a+=0x1){_0x75c38b=_0x2e8898[_0x558e4a];if(_[_0x9cad('0x3f')](_0x2546bb[_0x9cad('0x1d')][_0x75c38b['id']])){_0x2546bb['freshdeskAccounts'][_0x75c38b['id']]=new FreshdeskAccount(_0x75c38b);}else{_0x2546bb[_0x9cad('0x3b')](_0x2546bb['freshdeskAccounts'][_0x75c38b['id']],_0x75c38b);}}}return _0x2546bb[_0x9cad('0x1d')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x31dd6a=this;return function(_0x29a119){if(_0x29a119){freeIsNotKey(_0x29a119,_0x31dd6a[_0x9cad('0x1e')],'id');for(var _0x4491e0=0x0,_0x2dd7c1={},_0xc0e2b3={};_0x4491e0<_0x29a119[_0x9cad('0x3e')];_0x4491e0+=0x1){_0x2dd7c1=_0x29a119[_0x4491e0];if(_[_0x9cad('0x3f')](_0x31dd6a['zohoAccounts'][_0x2dd7c1['id']])){_0x31dd6a['zohoAccounts'][_0x2dd7c1['id']]=new ZohoAccount(_0x2dd7c1);}else{_0x31dd6a[_0x9cad('0x3b')](_0x31dd6a[_0x9cad('0x1e')][_0x2dd7c1['id']],_0x2dd7c1);}}}return _0x31dd6a[_0x9cad('0x1e')];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x48')]=function(){var _0x12bca2=this;return function(_0x42c062){if(_0x42c062){freeIsNotKey(_0x42c062,_0x12bca2[_0x9cad('0x1f')],'id');for(var _0x514fb3=0x0,_0x4603fb={},_0x353e20={};_0x514fb3<_0x42c062['length'];_0x514fb3+=0x1){_0x4603fb=_0x42c062[_0x514fb3];if(_[_0x9cad('0x3f')](_0x12bca2[_0x9cad('0x1f')][_0x4603fb['id']])){_0x12bca2[_0x9cad('0x1f')][_0x4603fb['id']]=new DeskAccount(_0x4603fb);}else{_0x12bca2['mergeFromDatabase'](_0x12bca2[_0x9cad('0x1f')][_0x4603fb['id']],_0x4603fb);}}}return _0x12bca2['deskAccounts'];};};Realtime['prototype'][_0x9cad('0x49')]=function(){var _0x3dc05e=this;return function(_0x57513d){if(_0x57513d){freeIsNotKey(_0x57513d,_0x3dc05e['sugarcrmAccounts'],'id');for(var _0x49ce3c=0x0,_0x7c74be={},_0x318a5a={};_0x49ce3c<_0x57513d[_0x9cad('0x3e')];_0x49ce3c+=0x1){_0x7c74be=_0x57513d[_0x49ce3c];if(_['isUndefined'](_0x3dc05e['sugarcrmAccounts'][_0x7c74be['id']])){_0x3dc05e['sugarcrmAccounts'][_0x7c74be['id']]=new SugarcrmAccount(_0x7c74be);}else{_0x3dc05e[_0x9cad('0x3b')](_0x3dc05e[_0x9cad('0x1c')][_0x7c74be['id']],_0x7c74be);}}}return _0x3dc05e['sugarcrmAccounts'];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x4a')]=function(){var _0x160947=this;return function(_0x577c7d){if(_0x577c7d){freeIsNotKey(_0x577c7d,_0x160947[_0x9cad('0x20')],'id');for(var _0x446743=0x0,_0x21c5f3={},_0x18a6be={};_0x446743<_0x577c7d['length'];_0x446743+=0x1){_0x21c5f3=_0x577c7d[_0x446743];if(_[_0x9cad('0x3f')](_0x160947[_0x9cad('0x20')][_0x21c5f3['id']])){_0x160947[_0x9cad('0x20')][_0x21c5f3['id']]=new VtigerAccount(_0x21c5f3);}else{_0x160947[_0x9cad('0x3b')](_0x160947[_0x9cad('0x20')][_0x21c5f3['id']],_0x21c5f3);}}}return _0x160947[_0x9cad('0x20')];};};Realtime['prototype'][_0x9cad('0x4b')]=function(){var _0x3d4ff5=this;return function(_0x4cdfda){if(_0x4cdfda){freeIsNotKey(_0x4cdfda,_0x3d4ff5[_0x9cad('0x21')],'id');for(var _0x27e0ed=0x0,_0xa7407a={},_0x205c0b={};_0x27e0ed<_0x4cdfda[_0x9cad('0x3e')];_0x27e0ed+=0x1){_0xa7407a=_0x4cdfda[_0x27e0ed];if(_[_0x9cad('0x3f')](_0x3d4ff5[_0x9cad('0x21')][_0xa7407a['id']])){_0x3d4ff5[_0x9cad('0x21')][_0xa7407a['id']]=new ServicenowAccount(_0xa7407a);}else{_0x3d4ff5[_0x9cad('0x3b')](_0x3d4ff5['servicenowAccounts'][_0xa7407a['id']],_0xa7407a);}}}return _0x3d4ff5[_0x9cad('0x21')];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x4c')]=function(){var _0x4d9a72=this;return function(_0x2e44b8){if(_0x2e44b8){freeIsNotKey(_0x2e44b8,_0x4d9a72['dynamics365Accounts'],'id');for(var _0x27da2f=0x0,_0x544bd6={},_0x48409b={};_0x27da2f<_0x2e44b8[_0x9cad('0x3e')];_0x27da2f+=0x1){_0x544bd6=_0x2e44b8[_0x27da2f];if(_[_0x9cad('0x3f')](_0x4d9a72[_0x9cad('0x4d')][_0x544bd6['id']])){_0x4d9a72[_0x9cad('0x4d')][_0x544bd6['id']]=new Dynamics365Account(_0x544bd6);}else{_0x4d9a72['mergeFromDatabase'](_0x4d9a72[_0x9cad('0x4d')][_0x544bd6['id']],_0x544bd6);}}}return _0x4d9a72['dynamics365Accounts'];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x4e')]=function(){var _0x1db936=this;return function(_0x413db7){if(_0x413db7){freeIsNotKey(_0x413db7,_0x1db936[_0x9cad('0x22')],'id');for(var _0x5b165d=0x0,_0x2fa807={},_0x4875ca={};_0x5b165d<_0x413db7['length'];_0x5b165d+=0x1){_0x2fa807=_0x413db7[_0x5b165d];if(_['isUndefined'](_0x1db936[_0x9cad('0x22')][_0x2fa807['id']])){_0x1db936['freshsalesAccounts'][_0x2fa807['id']]=new FreshsalesAccount(_0x2fa807);}else{_0x1db936['mergeFromDatabase'](_0x1db936['freshsalesAccounts'][_0x2fa807['id']],_0x2fa807);}}}return _0x1db936[_0x9cad('0x22')];};};Realtime[_0x9cad('0x3c')]['initVoiceQueueHopperHistory']=function(){var _0x25e1a5=this;return function(_0x1d5972){for(var _0x3a0b09=0x0;_0x3a0b09<_0x1d5972[_0x9cad('0x3e')];_0x3a0b09+=0x1){_[_0x9cad('0x4f')](_0x25e1a5['voiceQueues'][_0x1d5972[_0x3a0b09]['name']],_0x1d5972[_0x3a0b09]);}return _0x25e1a5[_0x9cad('0x13')];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x50')]=function(){var _0x55719c=this;return function(_0x43bdba){clearVoiceQueues(_0x55719c[_0x9cad('0x13')]);if(_0x43bdba){_0x43bdba=_[_0x9cad('0x51')](_0x43bdba,_0x9cad('0x52'));for(var _0x311a5d in _0x43bdba){if(_0x43bdba['hasOwnProperty'](_0x311a5d)){var _0x555587={};for(var _0x1b377a=0x0;_0x1b377a<_0x43bdba[_0x311a5d]['length'];_0x1b377a+=0x1){var _0x6d8c2f=_0x43bdba[_0x311a5d][_0x1b377a][_0x9cad('0x53')];if(_0x55719c['voiceQueues'][_0x6d8c2f]){if(_0x43bdba[_0x311a5d][_0x1b377a][_0x9cad('0x54')]){_0x55719c[_0x9cad('0x13')][_0x6d8c2f][_0x9cad('0x2f')]+=0x1;}if(_0x43bdba[_0x311a5d][_0x1b377a]['queuecallerabandon']){_0x55719c['voiceQueues'][_0x6d8c2f][_0x9cad('0x30')]+=0x1;}_0x55719c[_0x9cad('0x13')][_0x6d8c2f]['sumHoldTime']+=moment(_0x43bdba[_0x311a5d][_0x1b377a]['queuecallerleaveAt'])[_0x9cad('0x55')](moment(_0x43bdba[_0x311a5d][_0x1b377a][_0x9cad('0x56')]),_0x9cad('0x57'))||0x0;if(_0x1b377a===_0x43bdba[_0x311a5d][_0x9cad('0x3e')]-0x1){_0x55719c['voiceQueues'][_0x6d8c2f]['sumDuration']+=moment(_0x43bdba[_0x311a5d][_0x1b377a]['queuecallercompleteAt']||_0x43bdba[_0x311a5d][_0x1b377a]['queuecallerabandonAt']||_0x43bdba[_0x311a5d][_0x1b377a][_0x9cad('0x58')])[_0x9cad('0x55')](moment(_0x43bdba[_0x311a5d][_0x1b377a][_0x9cad('0x56')]),'seconds')||0x0;_0x55719c['voiceQueues'][_0x6d8c2f]['total']+=0x1;if(_0x43bdba[_0x311a5d][_0x1b377a]['queuecallercomplete']){_0x55719c[_0x9cad('0x13')][_0x6d8c2f][_0x9cad('0x2a')]+=0x1;_0x55719c[_0x9cad('0x13')][_0x6d8c2f][_0x9cad('0x2c')]+=moment(_0x43bdba[_0x311a5d][_0x1b377a][_0x9cad('0x59')])['diff'](moment(_0x43bdba[_0x311a5d][_0x1b377a][_0x9cad('0x5a')]),_0x9cad('0x57'))||0x0;}}else{_0x55719c[_0x9cad('0x13')][_0x6d8c2f]['sumDuration']+=_0x55719c[_0x9cad('0x13')][_0x6d8c2f][_0x9cad('0x2b')]||0x0;}}}}}}return _0x55719c['voiceQueues'];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x5b')]=function(){var _0x44642b=this;return function(_0x3be576){clearVoiceCallReports(_0x44642b[_0x9cad('0x16')]);if(_0x3be576){for(var _0x55cb82=0x0;_0x55cb82<_0x3be576[_0x9cad('0x3e')];_0x55cb82+=0x1){_0x44642b[_0x9cad('0x16')][_0x9cad('0x29')]+=0x1;_0x44642b[_0x9cad('0x16')][_0x9cad('0x31')]+=_0x3be576[_0x55cb82]['duration'];if(_0x3be576[_0x55cb82][_0x9cad('0x5c')]==='ANSWERED'){_0x44642b[_0x9cad('0x16')]['answered']+=0x1;_0x44642b[_0x9cad('0x16')]['sumHoldTime']+=_0x3be576[_0x55cb82][_0x9cad('0x5d')]-_0x3be576[_0x55cb82]['billableseconds']||0x0;_0x44642b[_0x9cad('0x16')][_0x9cad('0x2c')]+=_0x3be576[_0x55cb82][_0x9cad('0x5e')];}}}return _0x44642b['outbound'];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x5f')]=function(){var _0x584c45=this;return function(_0x5c1590){if(_0x5c1590){freeIsNotKey(_0x5c1590,_0x584c45[_0x9cad('0x60')],'name');for(var _0x238ca7=0x0,_0x516867={};_0x238ca7<_0x5c1590[_0x9cad('0x3e')];_0x238ca7+=0x1){_0x516867=_0x5c1590[_0x238ca7];if(_[_0x9cad('0x3f')](_0x584c45[_0x9cad('0x60')][_0x516867[_0x9cad('0x41')]])){_0x584c45['campaigns'][_0x516867[_0x9cad('0x41')]]=new Campaign(_0x516867);}else{_0x584c45[_0x9cad('0x3b')](_0x584c45['campaigns'][_0x516867[_0x9cad('0x41')]],_0x516867);_0x584c45[_0x9cad('0x60')][_0x516867[_0x9cad('0x41')]][_0x9cad('0x61')]=_0x516867[_0x9cad('0x62')]?_0x516867['SquareProject']['name']:undefined;}}}return _0x584c45[_0x9cad('0x60')];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x63')]=function(){var _0x743df4=this;return function(_0x183e55){if(_0x183e55){freeIsNotKey(_0x183e55,_0x743df4[_0x9cad('0x17')],'id');for(var _0x11d0c2=0x0,_0x4f8ffa={};_0x11d0c2<_0x183e55[_0x9cad('0x3e')];_0x11d0c2+=0x1){_0x4f8ffa=_0x183e55[_0x11d0c2];if(_['isUndefined'](_0x743df4['voiceExtensions'][_0x4f8ffa['id']])){_0x743df4['voiceExtensions'][_0x4f8ffa['id']]=new VoiceExtension(_0x4f8ffa);}else{_0x743df4['mergeFromDatabase'](_0x743df4[_0x9cad('0x17')][_0x4f8ffa['id']],_0x4f8ffa);}}}return _0x743df4[_0x9cad('0x17')];};};Realtime[_0x9cad('0x3c')][_0x9cad('0x64')]=function(){var _0x1255ec=this;return function(_0x291693){clearCampaigns(_0x1255ec[_0x9cad('0x60')]);for(var _0x59673e=0x0;_0x59673e<_0x291693['length'];_0x59673e+=0x1){_['merge'](_0x1255ec[_0x9cad('0x60')][_0x291693[_0x59673e]['name']],_0x291693[_0x59673e]);}return _0x1255ec[_0x9cad('0x60')];};};Realtime['prototype'][_0x9cad('0x65')]=function(){var _0x33ad1f=this;return function(_0x1a1dc6){if(_0x1a1dc6){freeIsNotKey(_0x1a1dc6,_0x33ad1f['faxAccounts'],'id');for(var _0x1ee031=0x0,_0x5b8a50={},_0x336c54={};_0x1ee031<_0x1a1dc6[_0x9cad('0x3e')];_0x1ee031+=0x1){_0x5b8a50=_0x1a1dc6[_0x1ee031];if(_[_0x9cad('0x3f')](_0x33ad1f[_0x9cad('0x23')][_0x5b8a50['id']])){_0x33ad1f[_0x9cad('0x23')][_0x5b8a50['id']]=new FaxAccount(_0x5b8a50);}else{_0x33ad1f['mergeFromDatabase'](_0x33ad1f[_0x9cad('0x23')][_0x5b8a50['id']],_0x5b8a50);}}}return _0x33ad1f[_0x9cad('0x23')];};};module[_0x9cad('0x66')]=Realtime; \ No newline at end of file +var _0xbaf6=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','mergeFromDatabase','prototype','length','isUndefined','initTelephones','initTrunks','initTriggers','initTemplates','initSalesforceAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','outbound','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xbaf6,0xd0));var _0x6baf=function(_0x1846e2,_0xe66a3a){_0x1846e2=_0x1846e2-0x0;var _0x626282=_0xbaf6[_0x1846e2];return _0x626282;};'use strict';var BPromise=require(_0x6baf('0x0'));var util=require(_0x6baf('0x1'));var _=require(_0x6baf('0x2'));var moment=require(_0x6baf('0x3'));var Agent=require(_0x6baf('0x4'));var Telephone=require(_0x6baf('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x6baf('0x6'));var Trigger=require(_0x6baf('0x7'));var Template=require(_0x6baf('0x8'));var Campaign=require(_0x6baf('0x9'));var VoiceExtension=require(_0x6baf('0xa'));var ZendeskAccount=require(_0x6baf('0xb'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x6baf('0xc'));var SugarcrmAccount=require(_0x6baf('0xd'));var ZohoAccount=require(_0x6baf('0xe'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x6baf('0xf'));var ServicenowAccount=require(_0x6baf('0x10'));var Dynamics365Account=require(_0x6baf('0x11'));var FreshsalesAccount=require(_0x6baf('0x12'));var FaxAccount=require(_0x6baf('0x13'));var Realtime=function(){this[_0x6baf('0x14')]={};this[_0x6baf('0x15')]={};this[_0x6baf('0x16')]={};this[_0x6baf('0x17')]={};this[_0x6baf('0x18')]={};this[_0x6baf('0x19')]={};this[_0x6baf('0x1a')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x6baf('0x1b')]={};this['channels']={};this['queueChannels']={};this[_0x6baf('0x1c')]={};this[_0x6baf('0x1d')]={};this[_0x6baf('0x1e')]={};this[_0x6baf('0x1f')]={};this[_0x6baf('0x20')]={};this[_0x6baf('0x21')]={};this[_0x6baf('0x22')]={};this['deskAccounts']={};this[_0x6baf('0x23')]={};this[_0x6baf('0x24')]={};this[_0x6baf('0x25')]={};this[_0x6baf('0x26')]={};this[_0x6baf('0x27')]={};};function freeIsNotKey(_0x523dbc,_0x33eba6,_0x4442f1){var _0x189184=_[_0x6baf('0x28')](_0x523dbc,function(_0x412bab,_0xddd21f){return _0x412bab[_0x4442f1];});for(var _0x3fd87d in _0x33eba6){if(_0x33eba6['hasOwnProperty'](_0x3fd87d)){if(!_0x189184[_0x3fd87d]){delete _0x33eba6[_0x3fd87d];}}}}function freeIsNotKeySip(_0x352b7a,_0x526d1d){var _0x9ec939=_[_0x6baf('0x28')](_0x352b7a,function(_0x845c8c,_0x458b40){return util[_0x6baf('0x29')](_0x6baf('0x2a'),_0x845c8c[_0x6baf('0x2b')]);});for(var _0x4ec0bf in _0x526d1d){if(_0x526d1d[_0x6baf('0x2c')](_0x4ec0bf)){if(!_0x9ec939[_0x4ec0bf]){delete _0x526d1d[_0x4ec0bf];}}}}function freeIsNotKeyAgent(_0x45f4c5,_0x38d63c){var _0x21d5c9=_[_0x6baf('0x28')](_0x45f4c5,function(_0x457196,_0x170b6e){var _0x5006c8=_[_0x6baf('0x2d')](_0x457196[_0x6baf('0x2e')])?util[_0x6baf('0x29')](_0x6baf('0x2a'),_0x457196[_0x6baf('0x2b')]):_0x457196['interface'];return _0x5006c8;});for(var _0x10bda2 in _0x38d63c){if(_0x38d63c['hasOwnProperty'](_0x10bda2)){if(!_0x21d5c9[_0x10bda2]){delete _0x38d63c[_0x10bda2];}}}}function clearVoiceCallReports(_0x380e2b){_0x380e2b[_0x6baf('0x2f')]=0x0;_0x380e2b['answered']=0x0;_0x380e2b[_0x6baf('0x30')]=0x0;_0x380e2b[_0x6baf('0x31')]=0x0;_0x380e2b[_0x6baf('0x32')]=0x0;}function clearCampaigns(_0x586003){if(!_[_0x6baf('0x33')](_0x586003)){for(var _0x48347c in _0x586003){if(_0x586003['hasOwnProperty'](_0x48347c)){_0x586003[_0x48347c][_0x6baf('0x34')]=0x0;_0x586003[_0x48347c][_0x6baf('0x35')]=0x0;}}}}function clearVoiceQueues(_0x180721){if(!_[_0x6baf('0x33')](_0x180721)){for(var _0x6c5f29 in _0x180721){if(_0x180721[_0x6baf('0x2c')](_0x6c5f29)){_0x180721[_0x6c5f29][_0x6baf('0x2f')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x36')]=0x0;_0x180721[_0x6c5f29]['unmanaged']=0x0;_0x180721[_0x6c5f29]['abandoned']=0x0;_0x180721[_0x6c5f29][_0x6baf('0x30')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x31')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x32')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x37')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x38')]=0x0;_0x180721[_0x6c5f29]['outboundBusyCallsDay']=0x0;_0x180721[_0x6c5f29][_0x6baf('0x39')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x3a')]=0x0;_0x180721[_0x6c5f29]['outboundUnknownCallsDay']=0x0;_0x180721[_0x6c5f29][_0x6baf('0x3b')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x3c')]=0x0;_0x180721[_0x6c5f29]['outboundBlacklistCallsDay']=0x0;_0x180721[_0x6c5f29][_0x6baf('0x3d')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x3e')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x3f')]=0x0;_0x180721[_0x6c5f29][_0x6baf('0x37')]=0x0;_0x180721[_0x6c5f29]['outboundAnswerCallsDay']=0x0;_0x180721[_0x6c5f29]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0x6baf('0x40')]=function(_0x1da9c0,_0x2dc2d1){for(var _0x27df87 in _0x2dc2d1){if(_0x1da9c0[_0x6baf('0x2c')](_0x27df87)){_0x1da9c0[_0x27df87]=_0x2dc2d1[_0x27df87];}}};Realtime[_0x6baf('0x41')]['initAgents']=function(){var _0x5ad03a=this;return function(_0x79dd1c){if(_0x79dd1c){freeIsNotKeyAgent(_0x79dd1c,_0x5ad03a[_0x6baf('0x14')]);for(var _0x57684b=0x0,_0x22997e={},_0x216cd9={};_0x57684b<_0x79dd1c[_0x6baf('0x42')];_0x57684b+=0x1){_0x22997e=_0x79dd1c[_0x57684b];var _0x24c783=_[_0x6baf('0x2d')](_0x22997e[_0x6baf('0x2e')])?util[_0x6baf('0x29')](_0x6baf('0x2a'),_0x22997e[_0x6baf('0x2b')]):_0x22997e[_0x6baf('0x2e')];if(_[_0x6baf('0x43')](_0x5ad03a[_0x6baf('0x14')][_0x24c783])){_0x5ad03a[_0x6baf('0x14')][_0x24c783]=new Agent(_0x22997e);}else{_0x5ad03a[_0x6baf('0x40')](_0x5ad03a['agents'][_0x24c783],_0x22997e);}}}return _0x5ad03a[_0x6baf('0x14')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x44')]=function(){var _0x864603=this;return function(_0x5a43a1){if(_0x5a43a1){freeIsNotKeySip(_0x5a43a1,_0x864603['telephones']);for(var _0x10e507=0x0,_0x5e74a6={},_0x434d30={};_0x10e507<_0x5a43a1[_0x6baf('0x42')];_0x10e507+=0x1){_0x5e74a6=_0x5a43a1[_0x10e507];if(_[_0x6baf('0x43')](_0x864603[_0x6baf('0x15')][util[_0x6baf('0x29')]('SIP/%s',_0x5e74a6[_0x6baf('0x2b')])])){_0x864603[_0x6baf('0x15')][util[_0x6baf('0x29')](_0x6baf('0x2a'),_0x5e74a6['name'])]=new Telephone(_0x5e74a6);}else{_0x864603['mergeFromDatabase'](_0x864603[_0x6baf('0x15')][util[_0x6baf('0x29')](_0x6baf('0x2a'),_0x5e74a6[_0x6baf('0x2b')])],_0x5e74a6);}}}return _0x864603[_0x6baf('0x15')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x45')]=function(){var _0x422201=this;return function(_0x47ef8d){if(_0x47ef8d){freeIsNotKeySip(_0x47ef8d,_0x422201['trunks']);for(var _0x2b8909=0x0,_0x2d2390={},_0x3565f2={};_0x2b8909<_0x47ef8d['length'];_0x2b8909+=0x1){_0x2d2390=_0x47ef8d[_0x2b8909];if(_[_0x6baf('0x43')](_0x422201[_0x6baf('0x16')][util[_0x6baf('0x29')]('SIP/%s',_0x2d2390[_0x6baf('0x2b')])])){_0x422201[_0x6baf('0x16')][util[_0x6baf('0x29')]('SIP/%s',_0x2d2390[_0x6baf('0x2b')])]=new Trunk(_0x2d2390);}else{_0x422201[_0x6baf('0x40')](_0x422201[_0x6baf('0x16')][util[_0x6baf('0x29')](_0x6baf('0x2a'),_0x2d2390['name'])],_0x2d2390);}}}return _0x422201[_0x6baf('0x16')];};};Realtime[_0x6baf('0x41')]['initVoiceQueues']=function(){var _0x629d97=this;return function(_0x48386e){if(_0x48386e){freeIsNotKey(_0x48386e,_0x629d97[_0x6baf('0x17')],_0x6baf('0x2b'));for(var _0x59f007=0x0,_0x435dd6={},_0x1ce7b3={};_0x59f007<_0x48386e['length'];_0x59f007+=0x1){_0x435dd6=_0x48386e[_0x59f007];if(_['isUndefined'](_0x629d97['voiceQueues'][_0x435dd6[_0x6baf('0x2b')]])){_0x629d97[_0x6baf('0x17')][_0x435dd6[_0x6baf('0x2b')]]=new VoiceQueue(_0x435dd6);}else{_0x629d97['mergeFromDatabase'](_0x629d97[_0x6baf('0x17')][_0x435dd6[_0x6baf('0x2b')]],_0x435dd6);}}}return _0x629d97[_0x6baf('0x17')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x46')]=function(){var _0x2533e6=this;return function(_0x57c0bc){if(_0x57c0bc){freeIsNotKey(_0x57c0bc,_0x2533e6[_0x6baf('0x18')],'id');for(var _0x4f94a2=0x0,_0x4065cf={},_0x3e8bdd={};_0x4f94a2<_0x57c0bc[_0x6baf('0x42')];_0x4f94a2+=0x1){_0x4065cf=_0x57c0bc[_0x4f94a2];if(_[_0x6baf('0x43')](_0x2533e6[_0x6baf('0x18')][_0x4065cf['id']])){_0x2533e6[_0x6baf('0x18')][_0x4065cf['id']]=new Trigger(_0x4065cf);}else{_0x2533e6[_0x6baf('0x40')](_0x2533e6[_0x6baf('0x18')][_0x4065cf['id']],_0x4065cf);}}}return _0x2533e6[_0x6baf('0x18')];};};Realtime['prototype'][_0x6baf('0x47')]=function(){var _0x5e2219=this;return function(_0x57d1f7){if(_0x57d1f7){freeIsNotKey(_0x57d1f7,_0x5e2219[_0x6baf('0x1a')],'id');for(var _0x1b455d=0x0,_0x22939c={},_0x3dd8f8={};_0x1b455d<_0x57d1f7[_0x6baf('0x42')];_0x1b455d+=0x1){_0x22939c=_0x57d1f7[_0x1b455d];if(_[_0x6baf('0x43')](_0x5e2219[_0x6baf('0x1a')][_0x22939c['id']])){_0x5e2219[_0x6baf('0x1a')][_0x22939c['id']]=new Template(_0x22939c);}else{_0x5e2219['mergeFromDatabase'](_0x5e2219[_0x6baf('0x1a')][_0x22939c['id']],_0x22939c);}}}return _0x5e2219[_0x6baf('0x1a')];};};Realtime[_0x6baf('0x41')]['initZendeskAccounts']=function(){var _0x4488cf=this;return function(_0x11ac09){if(_0x11ac09){freeIsNotKey(_0x11ac09,_0x4488cf[_0x6baf('0x1e')],'id');for(var _0xf9d085=0x0,_0x4b709b={},_0x1c660f={};_0xf9d085<_0x11ac09[_0x6baf('0x42')];_0xf9d085+=0x1){_0x4b709b=_0x11ac09[_0xf9d085];if(_[_0x6baf('0x43')](_0x4488cf[_0x6baf('0x1e')][_0x4b709b['id']])){_0x4488cf[_0x6baf('0x1e')][_0x4b709b['id']]=new ZendeskAccount(_0x4b709b);}else{_0x4488cf[_0x6baf('0x40')](_0x4488cf['zendeskAccounts'][_0x4b709b['id']],_0x4b709b);}}}return _0x4488cf['zendeskAccounts'];};};Realtime[_0x6baf('0x41')][_0x6baf('0x48')]=function(){var _0x95ee8b=this;return function(_0x1066cd){if(_0x1066cd){freeIsNotKey(_0x1066cd,_0x95ee8b[_0x6baf('0x1f')],'id');for(var _0xd64152=0x0,_0x122e11={},_0x6243c4={};_0xd64152<_0x1066cd[_0x6baf('0x42')];_0xd64152+=0x1){_0x122e11=_0x1066cd[_0xd64152];if(_['isUndefined'](_0x95ee8b[_0x6baf('0x1f')][_0x122e11['id']])){_0x95ee8b[_0x6baf('0x1f')][_0x122e11['id']]=new SalesforceAccount(_0x122e11);}else{_0x95ee8b[_0x6baf('0x40')](_0x95ee8b[_0x6baf('0x1f')][_0x122e11['id']],_0x122e11);}}}return _0x95ee8b[_0x6baf('0x1f')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x1cde7b=this;return function(_0x19709d){if(_0x19709d){freeIsNotKey(_0x19709d,_0x1cde7b['freshdeskAccounts'],'id');for(var _0x327145=0x0,_0x536ef9={},_0x2c9f46={};_0x327145<_0x19709d[_0x6baf('0x42')];_0x327145+=0x1){_0x536ef9=_0x19709d[_0x327145];if(_[_0x6baf('0x43')](_0x1cde7b[_0x6baf('0x21')][_0x536ef9['id']])){_0x1cde7b[_0x6baf('0x21')][_0x536ef9['id']]=new FreshdeskAccount(_0x536ef9);}else{_0x1cde7b[_0x6baf('0x40')](_0x1cde7b[_0x6baf('0x21')][_0x536ef9['id']],_0x536ef9);}}}return _0x1cde7b[_0x6baf('0x21')];};};Realtime[_0x6baf('0x41')]['initZohoAccounts']=function(){var _0x2c3b40=this;return function(_0x125027){if(_0x125027){freeIsNotKey(_0x125027,_0x2c3b40['zohoAccounts'],'id');for(var _0x32fece=0x0,_0x18ac5d={},_0x4baa08={};_0x32fece<_0x125027['length'];_0x32fece+=0x1){_0x18ac5d=_0x125027[_0x32fece];if(_[_0x6baf('0x43')](_0x2c3b40['zohoAccounts'][_0x18ac5d['id']])){_0x2c3b40[_0x6baf('0x22')][_0x18ac5d['id']]=new ZohoAccount(_0x18ac5d);}else{_0x2c3b40['mergeFromDatabase'](_0x2c3b40[_0x6baf('0x22')][_0x18ac5d['id']],_0x18ac5d);}}}return _0x2c3b40[_0x6baf('0x22')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x49')]=function(){var _0x29e1ab=this;return function(_0x1f2a7b){if(_0x1f2a7b){freeIsNotKey(_0x1f2a7b,_0x29e1ab[_0x6baf('0x4a')],'id');for(var _0x496326=0x0,_0x258741={},_0x1d35e9={};_0x496326<_0x1f2a7b[_0x6baf('0x42')];_0x496326+=0x1){_0x258741=_0x1f2a7b[_0x496326];if(_[_0x6baf('0x43')](_0x29e1ab[_0x6baf('0x4a')][_0x258741['id']])){_0x29e1ab[_0x6baf('0x4a')][_0x258741['id']]=new DeskAccount(_0x258741);}else{_0x29e1ab['mergeFromDatabase'](_0x29e1ab['deskAccounts'][_0x258741['id']],_0x258741);}}}return _0x29e1ab[_0x6baf('0x4a')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x4b')]=function(){var _0x58807a=this;return function(_0x4d4245){if(_0x4d4245){freeIsNotKey(_0x4d4245,_0x58807a[_0x6baf('0x20')],'id');for(var _0x1912cb=0x0,_0x388eee={},_0x3be676={};_0x1912cb<_0x4d4245['length'];_0x1912cb+=0x1){_0x388eee=_0x4d4245[_0x1912cb];if(_[_0x6baf('0x43')](_0x58807a[_0x6baf('0x20')][_0x388eee['id']])){_0x58807a[_0x6baf('0x20')][_0x388eee['id']]=new SugarcrmAccount(_0x388eee);}else{_0x58807a[_0x6baf('0x40')](_0x58807a[_0x6baf('0x20')][_0x388eee['id']],_0x388eee);}}}return _0x58807a[_0x6baf('0x20')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x4c')]=function(){var _0x1037b9=this;return function(_0x54ca10){if(_0x54ca10){freeIsNotKey(_0x54ca10,_0x1037b9[_0x6baf('0x23')],'id');for(var _0x115d69=0x0,_0x352b59={},_0x7812f5={};_0x115d69<_0x54ca10['length'];_0x115d69+=0x1){_0x352b59=_0x54ca10[_0x115d69];if(_[_0x6baf('0x43')](_0x1037b9['vtigerAccounts'][_0x352b59['id']])){_0x1037b9[_0x6baf('0x23')][_0x352b59['id']]=new VtigerAccount(_0x352b59);}else{_0x1037b9[_0x6baf('0x40')](_0x1037b9[_0x6baf('0x23')][_0x352b59['id']],_0x352b59);}}}return _0x1037b9[_0x6baf('0x23')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x4d')]=function(){var _0x40148a=this;return function(_0x3268f7){if(_0x3268f7){freeIsNotKey(_0x3268f7,_0x40148a['servicenowAccounts'],'id');for(var _0x224286=0x0,_0x38ec33={},_0x3f1561={};_0x224286<_0x3268f7[_0x6baf('0x42')];_0x224286+=0x1){_0x38ec33=_0x3268f7[_0x224286];if(_[_0x6baf('0x43')](_0x40148a[_0x6baf('0x24')][_0x38ec33['id']])){_0x40148a[_0x6baf('0x24')][_0x38ec33['id']]=new ServicenowAccount(_0x38ec33);}else{_0x40148a[_0x6baf('0x40')](_0x40148a[_0x6baf('0x24')][_0x38ec33['id']],_0x38ec33);}}}return _0x40148a[_0x6baf('0x24')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x4e')]=function(){var _0x511caf=this;return function(_0x2a77cc){if(_0x2a77cc){freeIsNotKey(_0x2a77cc,_0x511caf[_0x6baf('0x25')],'id');for(var _0x33396b=0x0,_0x43fb2a={},_0x66f270={};_0x33396b<_0x2a77cc[_0x6baf('0x42')];_0x33396b+=0x1){_0x43fb2a=_0x2a77cc[_0x33396b];if(_['isUndefined'](_0x511caf[_0x6baf('0x25')][_0x43fb2a['id']])){_0x511caf[_0x6baf('0x25')][_0x43fb2a['id']]=new Dynamics365Account(_0x43fb2a);}else{_0x511caf['mergeFromDatabase'](_0x511caf['dynamics365Accounts'][_0x43fb2a['id']],_0x43fb2a);}}}return _0x511caf[_0x6baf('0x25')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x4f')]=function(){var _0x5d1434=this;return function(_0x4f8771){if(_0x4f8771){freeIsNotKey(_0x4f8771,_0x5d1434[_0x6baf('0x26')],'id');for(var _0x16fe2b=0x0,_0xe2ffc2={},_0xd71ce={};_0x16fe2b<_0x4f8771[_0x6baf('0x42')];_0x16fe2b+=0x1){_0xe2ffc2=_0x4f8771[_0x16fe2b];if(_[_0x6baf('0x43')](_0x5d1434[_0x6baf('0x26')][_0xe2ffc2['id']])){_0x5d1434[_0x6baf('0x26')][_0xe2ffc2['id']]=new FreshsalesAccount(_0xe2ffc2);}else{_0x5d1434[_0x6baf('0x40')](_0x5d1434[_0x6baf('0x26')][_0xe2ffc2['id']],_0xe2ffc2);}}}return _0x5d1434['freshsalesAccounts'];};};Realtime['prototype'][_0x6baf('0x50')]=function(){var _0x38f3db=this;return function(_0x5bf6aa){for(var _0x5ac04a=0x0;_0x5ac04a<_0x5bf6aa[_0x6baf('0x42')];_0x5ac04a+=0x1){_[_0x6baf('0x51')](_0x38f3db['voiceQueues'][_0x5bf6aa[_0x5ac04a][_0x6baf('0x2b')]],_0x5bf6aa[_0x5ac04a]);}return _0x38f3db['voiceQueues'];};};Realtime[_0x6baf('0x41')][_0x6baf('0x52')]=function(){var _0x514e01=this;return function(_0x5b1eb){clearVoiceQueues(_0x514e01[_0x6baf('0x17')]);if(_0x5b1eb){_0x5b1eb=_[_0x6baf('0x53')](_0x5b1eb,_0x6baf('0x54'));for(var _0x249561 in _0x5b1eb){if(_0x5b1eb[_0x6baf('0x2c')](_0x249561)){var _0x596ad2={};for(var _0x4075b9=0x0;_0x4075b9<_0x5b1eb[_0x249561][_0x6baf('0x42')];_0x4075b9+=0x1){var _0xea179d=_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x55')];if(_0x514e01['voiceQueues'][_0xea179d]){if(_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x56')]){_0x514e01[_0x6baf('0x17')][_0xea179d][_0x6baf('0x57')]+=0x1;}if(_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x58')]){_0x514e01['voiceQueues'][_0xea179d]['abandoned']+=0x1;}_0x514e01[_0x6baf('0x17')][_0xea179d][_0x6baf('0x30')]+=moment(_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x59')])[_0x6baf('0x5a')](moment(_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x5b')]),_0x6baf('0x5c'))||0x0;if(_0x4075b9===_0x5b1eb[_0x249561][_0x6baf('0x42')]-0x1){_0x514e01['voiceQueues'][_0xea179d]['sumDuration']+=moment(_0x5b1eb[_0x249561][_0x4075b9]['queuecallercompleteAt']||_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x5d')]||_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x5e')])[_0x6baf('0x5a')](moment(_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x5b')]),_0x6baf('0x5c'))||0x0;_0x514e01['voiceQueues'][_0xea179d][_0x6baf('0x2f')]+=0x1;if(_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x5f')]){_0x514e01[_0x6baf('0x17')][_0xea179d][_0x6baf('0x36')]+=0x1;_0x514e01['voiceQueues'][_0xea179d][_0x6baf('0x32')]+=moment(_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x60')])[_0x6baf('0x5a')](moment(_0x5b1eb[_0x249561][_0x4075b9][_0x6baf('0x59')]),_0x6baf('0x5c'))||0x0;}}else{_0x514e01[_0x6baf('0x17')][_0xea179d]['sumDuration']+=_0x514e01[_0x6baf('0x17')][_0xea179d]['sumHoldTime']||0x0;}}}}}}return _0x514e01[_0x6baf('0x17')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x61')]=function(){var _0x430196=this;return function(_0x22afea){clearVoiceCallReports(_0x430196[_0x6baf('0x62')]);if(_0x22afea){for(var _0x558733=0x0;_0x558733<_0x22afea[_0x6baf('0x42')];_0x558733+=0x1){_0x430196[_0x6baf('0x62')][_0x6baf('0x2f')]+=0x1;_0x430196[_0x6baf('0x62')][_0x6baf('0x31')]+=_0x22afea[_0x558733]['duration'];if(_0x22afea[_0x558733][_0x6baf('0x63')]===_0x6baf('0x64')){_0x430196[_0x6baf('0x62')][_0x6baf('0x36')]+=0x1;_0x430196['outbound'][_0x6baf('0x30')]+=_0x22afea[_0x558733][_0x6baf('0x65')]-_0x22afea[_0x558733][_0x6baf('0x66')]||0x0;_0x430196[_0x6baf('0x62')][_0x6baf('0x32')]+=_0x22afea[_0x558733][_0x6baf('0x66')];}}}return _0x430196[_0x6baf('0x62')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x67')]=function(){var _0x61d902=this;return function(_0x56955){if(_0x56955){freeIsNotKey(_0x56955,_0x61d902[_0x6baf('0x19')],_0x6baf('0x2b'));for(var _0x500a87=0x0,_0x412363={};_0x500a87<_0x56955[_0x6baf('0x42')];_0x500a87+=0x1){_0x412363=_0x56955[_0x500a87];if(_[_0x6baf('0x43')](_0x61d902[_0x6baf('0x19')][_0x412363['name']])){_0x61d902['campaigns'][_0x412363[_0x6baf('0x2b')]]=new Campaign(_0x412363);}else{_0x61d902['mergeFromDatabase'](_0x61d902[_0x6baf('0x19')][_0x412363[_0x6baf('0x2b')]],_0x412363);_0x61d902['campaigns'][_0x412363['name']][_0x6baf('0x68')]=_0x412363[_0x6baf('0x69')]?_0x412363[_0x6baf('0x69')][_0x6baf('0x2b')]:undefined;}}}return _0x61d902[_0x6baf('0x19')];};};Realtime[_0x6baf('0x41')][_0x6baf('0x6a')]=function(){var _0x5d3841=this;return function(_0x295072){if(_0x295072){freeIsNotKey(_0x295072,_0x5d3841['voiceExtensions'],'id');for(var _0x4493be=0x0,_0x436123={};_0x4493be<_0x295072[_0x6baf('0x42')];_0x4493be+=0x1){_0x436123=_0x295072[_0x4493be];if(_[_0x6baf('0x43')](_0x5d3841['voiceExtensions'][_0x436123['id']])){_0x5d3841[_0x6baf('0x1b')][_0x436123['id']]=new VoiceExtension(_0x436123);}else{_0x5d3841['mergeFromDatabase'](_0x5d3841['voiceExtensions'][_0x436123['id']],_0x436123);}}}return _0x5d3841['voiceExtensions'];};};Realtime['prototype'][_0x6baf('0x6b')]=function(){var _0x565925=this;return function(_0x3afb78){clearCampaigns(_0x565925[_0x6baf('0x19')]);for(var _0x5bcf4c=0x0;_0x5bcf4c<_0x3afb78[_0x6baf('0x42')];_0x5bcf4c+=0x1){_['merge'](_0x565925['campaigns'][_0x3afb78[_0x5bcf4c][_0x6baf('0x2b')]],_0x3afb78[_0x5bcf4c]);}return _0x565925['campaigns'];};};Realtime[_0x6baf('0x41')]['initFaxAccounts']=function(){var _0x308625=this;return function(_0x1735f3){if(_0x1735f3){freeIsNotKey(_0x1735f3,_0x308625[_0x6baf('0x27')],'id');for(var _0x278ce0=0x0,_0x25edfc={},_0x3da0be={};_0x278ce0<_0x1735f3[_0x6baf('0x42')];_0x278ce0+=0x1){_0x25edfc=_0x1735f3[_0x278ce0];if(_[_0x6baf('0x43')](_0x308625[_0x6baf('0x27')][_0x25edfc['id']])){_0x308625[_0x6baf('0x27')][_0x25edfc['id']]=new FaxAccount(_0x25edfc);}else{_0x308625['mergeFromDatabase'](_0x308625[_0x6baf('0x27')][_0x25edfc['id']],_0x25edfc);}}}return _0x308625[_0x6baf('0x27')];};};module[_0x6baf('0x6c')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 5337737..caea519 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 _0x79a6=['lastapplication','queue','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','channel','callerid','calleridnum','ANSWERED','calleridname','monitor','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','substring','indexOf','mobile','phone','membername','attendedTransfer','exports','bluebird','lodash','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','telephones','prototype','realtime','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','accountcode','name','isNil','find','agents','interface','format','length','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','exten','type'];(function(_0x1dfb1c,_0xd25122){var _0x360949=function(_0x14054b){while(--_0x14054b){_0x1dfb1c['push'](_0x1dfb1c['shift']());}};_0x360949(++_0xd25122);}(_0x79a6,0x1a1));var _0x679a=function(_0x3bc298,_0x583d14){_0x3bc298=_0x3bc298-0x0;var _0x31bf58=_0x79a6[_0x3bc298];return _0x31bf58;};'use strict';var BPromise=require(_0x679a('0x0'));var _=require(_0x679a('0x1'));var moment=require('moment');var util=require('util');var config=require(_0x679a('0x2'));var logger=require('../../../config/logger')('ami');var ami=require(_0x679a('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x679a('0x4'));var RpcVoiceDialReport=require(_0x679a('0x5'));var RpcMemberReport=require(_0x679a('0x6'));var RpcVoiceQueueReport=require(_0x679a('0x7'));var RpcVoiceRecording=require(_0x679a('0x8'));var RpcVoiceTransferReport=require(_0x679a('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x679a('0xa'));var VoiceAgentReport=require(_0x679a('0xb'));var VoiceDialReport=require(_0x679a('0xc'));var UserReport=require(_0x679a('0xd'));function Report(_0x1aa508){this['realtime']=_0x1aa508;this['agents']=_0x1aa508['agents'];this[_0x679a('0xe')]=_0x1aa508[_0x679a('0xe')];}Report[_0x679a('0xf')]['sync']=function(_0x152992){var _0x2da363=new VoiceQueueReport(this[_0x679a('0x10')]);var _0x42df0d=new VoiceAgentReport(this[_0x679a('0x10')]);var _0xd1ab16=new VoiceDialReport(this[_0x679a('0x10')]);var _0x165edb=new VoiceCallReport(this['realtime']);var _0x48da79=new UserReport(this[_0x679a('0x10')]);if(config[_0x679a('0x11')]&&config[_0x679a('0x11')]['disabled']){ami['on'](_0x679a('0x12'),this[_0x679a('0x13')][_0x679a('0x14')](this));ami['on'](_0x679a('0x15'),this[_0x679a('0x16')][_0x679a('0x14')](this));ami['on'](_0x679a('0x17'),this[_0x679a('0x18')][_0x679a('0x14')](this));ami['on'](_0x679a('0x19'),this[_0x679a('0x1a')][_0x679a('0x14')](this));ami['on'](_0x679a('0x1b'),this[_0x679a('0x1c')][_0x679a('0x14')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x679a('0x14')](this));}};Report['prototype'][_0x679a('0x1d')]=function(_0x1b75a1){var _0x3ab6e8=undefined;_0x3ab6e8=_['find'](this['agents'],function(_0x888ee5){return _0x888ee5[_0x679a('0x1e')]==_0x1b75a1||_0x888ee5[_0x679a('0x1f')]==_0x1b75a1;});if(_[_0x679a('0x20')](_0x3ab6e8)){var _0x5d2807=_[_0x679a('0x21')](this[_0x679a('0xe')],function(_0x8b48dc){return _0x8b48dc[_0x679a('0x1e')]==_0x1b75a1||_0x8b48dc[_0x679a('0x1f')]==_0x1b75a1;});if(_0x5d2807){_0x3ab6e8=_[_0x679a('0x21')](this[_0x679a('0x22')],function(_0x51fb1c){return _0x51fb1c[_0x679a('0x23')]==util[_0x679a('0x24')]('SIP/%s',_0x5d2807[_0x679a('0x1f')]);});}}return _0x3ab6e8;};Report[_0x679a('0xf')][_0x679a('0x13')]=function(_0x4349a5){for(var _0x2d4aa4=0x0;_0x2d4aa4<_0x4349a5[_0x679a('0x25')];_0x2d4aa4+=0x1){var _0x32ba5d=this['findAgent'](_0x4349a5[_0x2d4aa4][_0x679a('0x26')]);if(_0x32ba5d){_0x4349a5[_0x2d4aa4][_0x679a('0x1e')]=_0x32ba5d[_0x679a('0x1e')];_0x4349a5[_0x2d4aa4][_0x679a('0x27')]=!![];_0x4349a5[_0x2d4aa4][_0x679a('0x28')]=_0x32ba5d[_0x679a('0x1f')];_0x4349a5[_0x2d4aa4][_0x679a('0x23')]=_[_0x679a('0x20')](_0x32ba5d[_0x679a('0x23')])?util['format'](_0x679a('0x29'),_0x32ba5d[_0x679a('0x1f')]):_0x32ba5d[_0x679a('0x23')];if(_0x4349a5[_0x2d4aa4][_0x679a('0x2a')]){_0x4349a5[_0x2d4aa4][_0x679a('0x2b')]=moment()[_0x679a('0x24')](_0x679a('0x2c'));}if(_0x4349a5[_0x2d4aa4][_0x679a('0x2d')]){_0x4349a5[_0x2d4aa4][_0x679a('0x2e')]=moment()[_0x679a('0x24')](_0x679a('0x2c'));}RpcMemberReport[_0x679a('0x13')](_0x4349a5[_0x2d4aa4]);}RpcVoiceQueueReport[_0x679a('0x2f')](_0x4349a5[_0x2d4aa4]);}};function extractCalleridNumber(_0x2347ec){var _0x2888cf=_0x2347ec['match'](/<(.*?)>/);return _0x2888cf?_0x2888cf[0x1]:_0x2347ec;}Report[_0x679a('0xf')][_0x679a('0x16')]=function(_0x263fc1){_0x263fc1[_0x679a('0x30')]=_0x263fc1['destination']||_0x263fc1[_0x679a('0x31')];if(_0x263fc1[_0x679a('0x32')]=='dialer'){_0x263fc1[_0x679a('0x33')]='queue';_0x263fc1['lastdata']=_0x263fc1[_0x679a('0x34')];if(_0x263fc1[_0x679a('0x35')]==_0x679a('0x36')){_0x263fc1[_0x679a('0x1e')]='';_0x263fc1[_0x679a('0x30')]=extractCalleridNumber(_0x263fc1['callerid']);}else if(_0x263fc1[_0x679a('0x35')]==_0x679a('0x37')){if(_0x263fc1[_0x679a('0x30')]==_0x679a('0x38')){_0x263fc1[_0x679a('0x30')]=extractCalleridNumber(_0x263fc1[_0x679a('0x39')]);_0x263fc1['calleridnum']=_0x263fc1[_0x679a('0x3a')];_0x263fc1['destinationchannel']=[_0x263fc1[_0x679a('0x3b')],_0x263fc1[_0x679a('0x3b')]=_0x263fc1['destinationchannel']][0x0];_0x263fc1[_0x679a('0x3c')]=_0x263fc1[_0x679a('0x39')];}else{_0x263fc1[_0x679a('0x30')]=_0x263fc1[_0x679a('0x3d')];_0x263fc1['calleridnum']=_0x263fc1['originatecalleridnum'];if(_0x263fc1['disposition']==_0x679a('0x3e')){_0x263fc1[_0x679a('0x1e')]=_0x263fc1[_0x679a('0x26')];}else{_0x263fc1['accountcode']='';}}}}else{_0x263fc1[_0x679a('0x3c')]=util['format']('\x22%s\x22\x20<%s>',_0x263fc1[_0x679a('0x3f')],_0x263fc1[_0x679a('0x3d')]);}RpcVoiceCallReport[_0x679a('0x2f')](_0x263fc1);if(_0x263fc1[_0x679a('0x40')]){for(var _0x32d514=0x0;_0x32d514<_0x263fc1[_0x679a('0x41')][_0x679a('0x25')];_0x32d514+=0x1){_0x263fc1['monitorFilename']=_0x263fc1[_0x679a('0x41')][_0x32d514][_0x679a('0x42')];_0x263fc1[_0x679a('0x43')]=_0x263fc1[_0x679a('0x41')][_0x32d514][_0x679a('0x43')];if(_0x263fc1[_0x679a('0x31')]==_0x679a('0x38')){_0x263fc1['calleridnum']=_0x263fc1[_0x679a('0x26')];_0x263fc1[_0x679a('0x3f')]=_0x263fc1[_0x679a('0x44')];_0x263fc1[_0x679a('0x26')]=_0x263fc1[_0x679a('0x1e')];_0x263fc1[_0x679a('0x44')]=_0x263fc1['membername'];_0x263fc1[_0x679a('0x31')]=_0x263fc1[_0x679a('0x3a')];}else if(_0x263fc1['exten']==_0x679a('0x45')){_0x263fc1['calleridnum']=_0x263fc1[_0x679a('0x30')];_0x263fc1['exten']=_0x263fc1['originatecalleridnum'];}RpcVoiceRecording[_0x679a('0x2f')](_0x263fc1);}}};Report[_0x679a('0xf')][_0x679a('0x18')]=function(_0x234f0e){if(_[_0x679a('0x46')](_0x234f0e)){_0x234f0e['forEach'](function(_0x1629ed){RpcVoiceAgentReport[_0x679a('0x2f')](_0x1629ed);});}else{RpcVoiceAgentReport[_0x679a('0x2f')](_0x234f0e);}};Report['prototype'][_0x679a('0x1a')]=function(_0x4174c5){RpcVoiceDialReport[_0x679a('0x2f')](_0x4174c5);var _0x1170f0=undefined;var _0x4e3e1a=_0x4174c5['channel'];if(_['startsWith'](_0x4e3e1a,'Local')){var _0x4be5d5=_0x4e3e1a[_0x679a('0x47')](_0x4e3e1a[_0x679a('0x48')]('/')+0x1,_0x4e3e1a['indexOf']('@'));_0x1170f0=_[_0x679a('0x21')](this[_0x679a('0x22')],function(_0x212bb4){return _0x212bb4[_0x679a('0x49')]==_0x4be5d5||_0x212bb4[_0x679a('0x4a')]==_0x4be5d5||_0x212bb4[_0x679a('0x1e')]==_0x4be5d5;});}else{var _0x4be5d5=_0x4e3e1a[_0x679a('0x47')](_0x4e3e1a['indexOf']('/')+0x1,_0x4e3e1a['lastIndexOf']('-'));_0x1170f0=this[_0x679a('0x1d')](_0x4be5d5);}if(_0x1170f0){_0x4174c5[_0x679a('0x23')]=_[_0x679a('0x20')](_0x1170f0[_0x679a('0x23')])?util[_0x679a('0x24')](_0x679a('0x29'),_0x1170f0[_0x679a('0x1f')]):_0x1170f0[_0x679a('0x23')];_0x4174c5[_0x679a('0x4b')]=_0x1170f0[_0x679a('0x1f')];_0x4174c5['accountcode']=_0x1170f0['accountcode'];RpcMemberReport[_0x679a('0x1a')](_0x4174c5);}};Report['prototype'][_0x679a('0x1c')]=function(_0x2aef7a){RpcVoiceTransferReport['blindTransfer'](_0x2aef7a);};Report[_0x679a('0xf')]['attendedTransfer']=function(_0x4887d3){RpcVoiceTransferReport[_0x679a('0x4c')](_0x4887d3);};module[_0x679a('0x4d')]=Report; \ No newline at end of file +var _0x7dcd=['connectedlinename','membername','voiceAgentReport','forEach','startsWith','Local','indexOf','mobile','phone','lastIndexOf','exports','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','voiceQueueReport','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitors','length','monitorFilename','filename','createdAt'];(function(_0x2f236e,_0x3f463d){var _0x580a2b=function(_0x1cdb8b){while(--_0x1cdb8b){_0x2f236e['push'](_0x2f236e['shift']());}};_0x580a2b(++_0x3f463d);}(_0x7dcd,0x153));var _0xd7dc=function(_0x26cd05,_0x1f7d74){_0x26cd05=_0x26cd05-0x0;var _0x3e13b9=_0x7dcd[_0x26cd05];return _0x3e13b9;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0xd7dc('0x0'));var util=require(_0xd7dc('0x1'));var config=require(_0xd7dc('0x2'));var logger=require(_0xd7dc('0x3'))(_0xd7dc('0x4'));var ami=require(_0xd7dc('0x5'));var RpcVoiceAgentReport=require(_0xd7dc('0x6'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xd7dc('0x7'));var RpcMemberReport=require(_0xd7dc('0x8'));var RpcVoiceQueueReport=require(_0xd7dc('0x9'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xd7dc('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xd7dc('0xb'));function Report(_0x945434){this['realtime']=_0x945434;this[_0xd7dc('0xc')]=_0x945434['agents'];this[_0xd7dc('0xd')]=_0x945434[_0xd7dc('0xd')];}Report[_0xd7dc('0xe')][_0xd7dc('0xf')]=function(_0x866a78){var _0x4b2d27=new VoiceQueueReport(this[_0xd7dc('0x10')]);var _0x59a617=new VoiceAgentReport(this[_0xd7dc('0x10')]);var _0x524974=new VoiceDialReport(this['realtime']);var _0x1de593=new VoiceCallReport(this[_0xd7dc('0x10')]);var _0xa44f3a=new UserReport(this[_0xd7dc('0x10')]);if(config[_0xd7dc('0x11')]&&config[_0xd7dc('0x11')][_0xd7dc('0x12')]){ami['on'](_0xd7dc('0x13'),this['voiceQueueReport'][_0xd7dc('0x14')](this));ami['on'](_0xd7dc('0x15'),this['voiceCallReport']['bind'](this));ami['on'](_0xd7dc('0x16'),this['voiceAgentReport'][_0xd7dc('0x14')](this));ami['on'](_0xd7dc('0x17'),this[_0xd7dc('0x18')][_0xd7dc('0x14')](this));ami['on'](_0xd7dc('0x19'),this[_0xd7dc('0x1a')]['bind'](this));ami['on'](_0xd7dc('0x1b'),this[_0xd7dc('0x1c')][_0xd7dc('0x14')](this));}};Report[_0xd7dc('0xe')][_0xd7dc('0x1d')]=function(_0x1e07c6){var _0x3d881f=undefined;_0x3d881f=_[_0xd7dc('0x1e')](this['agents'],function(_0x1470b1){return _0x1470b1[_0xd7dc('0x1f')]==_0x1e07c6||_0x1470b1[_0xd7dc('0x20')]==_0x1e07c6;});if(_[_0xd7dc('0x21')](_0x3d881f)){var _0x3a3d58=_[_0xd7dc('0x1e')](this[_0xd7dc('0xd')],function(_0x13c1c0){return _0x13c1c0[_0xd7dc('0x1f')]==_0x1e07c6||_0x13c1c0[_0xd7dc('0x20')]==_0x1e07c6;});if(_0x3a3d58){_0x3d881f=_[_0xd7dc('0x1e')](this[_0xd7dc('0xc')],function(_0x468318){return _0x468318[_0xd7dc('0x22')]==util[_0xd7dc('0x23')]('SIP/%s',_0x3a3d58[_0xd7dc('0x20')]);});}}return _0x3d881f;};Report['prototype'][_0xd7dc('0x24')]=function(_0x3e680d){for(var _0x2c76f5=0x0;_0x2c76f5<_0x3e680d['length'];_0x2c76f5+=0x1){var _0x390127=this[_0xd7dc('0x1d')](_0x3e680d[_0x2c76f5][_0xd7dc('0x25')]);if(_0x390127){_0x3e680d[_0x2c76f5]['accountcode']=_0x390127[_0xd7dc('0x1f')];_0x3e680d[_0x2c76f5][_0xd7dc('0x26')]=!![];_0x3e680d[_0x2c76f5][_0xd7dc('0x27')]=_0x390127[_0xd7dc('0x20')];_0x3e680d[_0x2c76f5][_0xd7dc('0x22')]=_[_0xd7dc('0x21')](_0x390127[_0xd7dc('0x22')])?util[_0xd7dc('0x23')](_0xd7dc('0x28'),_0x390127[_0xd7dc('0x20')]):_0x390127[_0xd7dc('0x22')];if(_0x3e680d[_0x2c76f5]['queuecallercomplete']){_0x3e680d[_0x2c76f5]['queuecallercompleteAt']=moment()[_0xd7dc('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3e680d[_0x2c76f5][_0xd7dc('0x29')]){_0x3e680d[_0x2c76f5][_0xd7dc('0x2a')]=moment()['format'](_0xd7dc('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x3e680d[_0x2c76f5]);}RpcVoiceQueueReport[_0xd7dc('0x2c')](_0x3e680d[_0x2c76f5]);}};function extractCalleridNumber(_0x7f6c58){var _0x1d45db=_0x7f6c58[_0xd7dc('0x2d')](/<(.*?)>/);return _0x1d45db?_0x1d45db[0x1]:_0x7f6c58;}Report[_0xd7dc('0xe')]['voiceCallReport']=function(_0x34f1fb){_0x34f1fb[_0xd7dc('0x2e')]=_0x34f1fb['destination']||_0x34f1fb[_0xd7dc('0x2f')];if(_0x34f1fb[_0xd7dc('0x30')]==_0xd7dc('0x31')){_0x34f1fb[_0xd7dc('0x32')]=_0xd7dc('0x33');_0x34f1fb[_0xd7dc('0x34')]=_0x34f1fb[_0xd7dc('0x33')];if(_0x34f1fb[_0xd7dc('0x35')]=='from-voip-provider'){_0x34f1fb['accountcode']='';_0x34f1fb[_0xd7dc('0x2e')]=extractCalleridNumber(_0x34f1fb[_0xd7dc('0x36')]);}else if(_0x34f1fb[_0xd7dc('0x35')]==_0xd7dc('0x37')){if(_0x34f1fb[_0xd7dc('0x2e')]==_0xd7dc('0x38')){_0x34f1fb[_0xd7dc('0x2e')]=extractCalleridNumber(_0x34f1fb[_0xd7dc('0x39')]);_0x34f1fb[_0xd7dc('0x3a')]=_0x34f1fb[_0xd7dc('0x3b')];_0x34f1fb['destinationchannel']=[_0x34f1fb[_0xd7dc('0x3c')],_0x34f1fb[_0xd7dc('0x3c')]=_0x34f1fb[_0xd7dc('0x3d')]][0x0];_0x34f1fb['callerid']=_0x34f1fb[_0xd7dc('0x39')];}else{_0x34f1fb['destination']=_0x34f1fb[_0xd7dc('0x3a')];_0x34f1fb[_0xd7dc('0x3a')]=_0x34f1fb[_0xd7dc('0x3b')];if(_0x34f1fb[_0xd7dc('0x3e')]==_0xd7dc('0x3f')){_0x34f1fb[_0xd7dc('0x1f')]=_0x34f1fb[_0xd7dc('0x25')];}else{_0x34f1fb[_0xd7dc('0x1f')]='';}}}}else{_0x34f1fb[_0xd7dc('0x36')]=util[_0xd7dc('0x23')](_0xd7dc('0x40'),_0x34f1fb['calleridname'],_0x34f1fb['calleridnum']);}RpcVoiceCallReport[_0xd7dc('0x2c')](_0x34f1fb);if(_0x34f1fb[_0xd7dc('0x41')]){for(var _0x1c18b3=0x0;_0x1c18b3<_0x34f1fb[_0xd7dc('0x42')][_0xd7dc('0x43')];_0x1c18b3+=0x1){_0x34f1fb[_0xd7dc('0x44')]=_0x34f1fb[_0xd7dc('0x42')][_0x1c18b3][_0xd7dc('0x45')];_0x34f1fb['createdAt']=_0x34f1fb['monitors'][_0x1c18b3][_0xd7dc('0x46')];if(_0x34f1fb[_0xd7dc('0x2f')]==_0xd7dc('0x38')){_0x34f1fb['calleridnum']=_0x34f1fb['connectedlinenum'];_0x34f1fb['calleridname']=_0x34f1fb[_0xd7dc('0x47')];_0x34f1fb[_0xd7dc('0x25')]=_0x34f1fb['accountcode'];_0x34f1fb['connectedlinename']=_0x34f1fb[_0xd7dc('0x48')];_0x34f1fb['exten']=_0x34f1fb['originatecalleridnum'];}else if(_0x34f1fb['exten']=='xcally-motion-dialer'){_0x34f1fb[_0xd7dc('0x3a')]=_0x34f1fb['destination'];_0x34f1fb[_0xd7dc('0x2f')]=_0x34f1fb[_0xd7dc('0x3b')];}RpcVoiceRecording[_0xd7dc('0x2c')](_0x34f1fb);}}};Report[_0xd7dc('0xe')][_0xd7dc('0x49')]=function(_0x120bf1){if(_['isArray'](_0x120bf1)){_0x120bf1[_0xd7dc('0x4a')](function(_0x4b76bf){RpcVoiceAgentReport[_0xd7dc('0x2c')](_0x4b76bf);});}else{RpcVoiceAgentReport[_0xd7dc('0x2c')](_0x120bf1);}};Report[_0xd7dc('0xe')][_0xd7dc('0x18')]=function(_0x3f3097){RpcVoiceDialReport[_0xd7dc('0x2c')](_0x3f3097);var _0x55d332=undefined;var _0x47a92b=_0x3f3097[_0xd7dc('0x3c')];if(_[_0xd7dc('0x4b')](_0x47a92b,_0xd7dc('0x4c'))){var _0x3bd032=_0x47a92b['substring'](_0x47a92b[_0xd7dc('0x4d')]('/')+0x1,_0x47a92b[_0xd7dc('0x4d')]('@'));_0x55d332=_[_0xd7dc('0x1e')](this['agents'],function(_0x323592){return _0x323592[_0xd7dc('0x4e')]==_0x3bd032||_0x323592[_0xd7dc('0x4f')]==_0x3bd032||_0x323592['accountcode']==_0x3bd032;});}else{var _0x3bd032=_0x47a92b['substring'](_0x47a92b['indexOf']('/')+0x1,_0x47a92b[_0xd7dc('0x50')]('-'));_0x55d332=this[_0xd7dc('0x1d')](_0x3bd032);}if(_0x55d332){_0x3f3097['interface']=_[_0xd7dc('0x21')](_0x55d332['interface'])?util[_0xd7dc('0x23')]('SIP/%s',_0x55d332[_0xd7dc('0x20')]):_0x55d332[_0xd7dc('0x22')];_0x3f3097[_0xd7dc('0x48')]=_0x55d332[_0xd7dc('0x20')];_0x3f3097[_0xd7dc('0x1f')]=_0x55d332[_0xd7dc('0x1f')];RpcMemberReport[_0xd7dc('0x18')](_0x3f3097);}};Report[_0xd7dc('0xe')][_0xd7dc('0x1a')]=function(_0x53d605){RpcVoiceTransferReport['blindTransfer'](_0x53d605);};Report[_0xd7dc('0xe')][_0xd7dc('0x1c')]=function(_0x7c2971){RpcVoiceTransferReport[_0xd7dc('0x1c')](_0x7c2971);};module[_0xd7dc('0x51')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index d1d2b52..91d7fa7 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 _0x4a51=['catch','[loopSyncRealTimeShow]','error','inspect','prototype','isUndefined','emit','isNotNull','find','username','state','merge','omit','event','format','[syncRegistry][UserReport]','device','local','inuse','toLowerCase','stateTime','updateStatusRealtime','toNumber','telephone:%s','telephone:save','trunk:%s','name','startsWith','Queue','Local','substring','indexOf','phone','[syncDeviceState][UserReport]','peerstatus','peer','address','status','trunk:save','[syncPeerStatus][UserReport]','exports','lodash','moment','ioredis','../../../config/logger','ami','redis','localhost','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus'];(function(_0x2b044e,_0x31fe2c){var _0x3b9a84=function(_0x775ea0){while(--_0x775ea0){_0x2b044e['push'](_0x2b044e['shift']());}};_0x3b9a84(++_0x31fe2c);}(_0x4a51,0x19d));var _0x14a5=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x4a51[_0x279d37];return _0x530173;};'use strict';var _=require(_0x14a5('0x0'));var moment=require(_0x14a5('0x1'));var BPromise=require('bluebird');var util=require('util');var Redis=require(_0x14a5('0x2'));var config=require('../../../config/environment');var logger=require(_0x14a5('0x3'))(_0x14a5('0x4'));var ami=require('../ami');config[_0x14a5('0x5')]=_['defaults'](config['redis'],{'host':_0x14a5('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x14a5('0x5')]));function UserReport(_0x303f39){this['trunks']=_0x303f39[_0x14a5('0x7')];this[_0x14a5('0x8')]=_0x303f39[_0x14a5('0x8')];this[_0x14a5('0x9')]=_0x303f39[_0x14a5('0x9')];ami['on']('registryentry',this[_0x14a5('0xa')]['bind'](this));ami['on']('registry',this[_0x14a5('0xa')][_0x14a5('0xb')](this));ami['on'](_0x14a5('0xc'),this[_0x14a5('0xd')][_0x14a5('0xb')](this));ami['on']('peerstatus',this[_0x14a5('0xe')][_0x14a5('0xb')](this));this[_0x14a5('0xf')]();return BPromise[_0x14a5('0x10')]()['then'](ami[_0x14a5('0x11')]())[_0x14a5('0x12')](ami[_0x14a5('0x13')]())[_0x14a5('0x12')](ami[_0x14a5('0x14')]())[_0x14a5('0x15')](loggerCatch(_0x14a5('0x16')));}function loggerCatch(_0x1374c5){return function(_0x4285ee){logger[_0x14a5('0x17')](_0x1374c5,util[_0x14a5('0x18')](_0x4285ee,{'showHidden':![],'depth':null}));};}UserReport[_0x14a5('0x19')][_0x14a5('0xf')]=function(){setInterval(function(){BPromise[_0x14a5('0x10')]()[_0x14a5('0x12')](ami[_0x14a5('0x11')]())[_0x14a5('0x12')](ami[_0x14a5('0x13')]())['then'](ami['actionSipPeerStatus']())[_0x14a5('0x15')](loggerCatch(_0x14a5('0x16')));},0x32c8);};UserReport[_0x14a5('0x19')]['isNotNull']=function(_0x4a6c5f){return _0x4a6c5f!==null&&!_[_0x14a5('0x1a')](_0x4a6c5f);};UserReport['prototype'][_0x14a5('0x1b')]=function(_0x1f03e8,_0x236579,_0x1158ab){io['to'](_0x1f03e8)[_0x14a5('0x1b')](_0x236579,_0x1158ab);};UserReport['prototype'][_0x14a5('0xa')]=function(_0x1518c7){try{if(this[_0x14a5('0x1c')](_0x1518c7)){var _0x463a71=_[_0x14a5('0x1d')](this[_0x14a5('0x7')],{'registry':_0x1518c7[_0x14a5('0x1e')]});if(_0x463a71){_0x1518c7['stateRegistry']=_0x1518c7[_0x14a5('0x1f')];_[_0x14a5('0x20')](_0x463a71,_[_0x14a5('0x21')](_0x1518c7,[_0x14a5('0x22'),'actionid',_0x14a5('0x1e'),'state']));this[_0x14a5('0x1b')](util[_0x14a5('0x23')]('trunk:%s',_0x463a71['name']),'trunk:save',_0x463a71);}}}catch(_0x19a9d4){logger[_0x14a5('0x17')](_0x14a5('0x24'),util[_0x14a5('0x18')](_0x19a9d4,{'showHidden':![],'depth':null}));}};UserReport[_0x14a5('0x19')][_0x14a5('0xd')]=function(_0x7abd3b){try{if(this['isNotNull'](_0x7abd3b)){if(this[_0x14a5('0x8')][_0x7abd3b[_0x14a5('0x25')]]){if(!this[_0x14a5('0x8')][_0x7abd3b[_0x14a5('0x25')]][_0x14a5('0x26')]||_0x7abd3b[_0x14a5('0x1f')]['toLowerCase']()==_0x14a5('0x27')){this[_0x14a5('0x8')][_0x7abd3b[_0x14a5('0x25')]][_0x14a5('0x26')]=![];if(this[_0x14a5('0x8')][_0x7abd3b[_0x14a5('0x25')]][_0x14a5('0x1f')]!==_0x7abd3b[_0x14a5('0x1f')][_0x14a5('0x28')]()){this['agents'][_0x7abd3b[_0x14a5('0x25')]][_0x14a5('0x29')]=_['toNumber'](moment()[_0x14a5('0x23')]('x'));}this['agents'][_0x7abd3b[_0x14a5('0x25')]][_0x14a5('0x1f')]=_0x7abd3b['state'][_0x14a5('0x28')]();this[_0x14a5('0x8')][_0x7abd3b['device']][_0x14a5('0x2a')](_0x7abd3b);}}else if(this[_0x14a5('0x9')][_0x7abd3b[_0x14a5('0x25')]]){if(this[_0x14a5('0x9')][_0x7abd3b['device']]['state']!==_0x7abd3b['state'][_0x14a5('0x28')]()){this[_0x14a5('0x9')][_0x7abd3b['device']]['stateTime']=_[_0x14a5('0x2b')](moment()[_0x14a5('0x23')]('x'));}this[_0x14a5('0x9')][_0x7abd3b['device']]['state']=_0x7abd3b[_0x14a5('0x1f')][_0x14a5('0x28')]();this[_0x14a5('0x1b')](util['format'](_0x14a5('0x2c'),this[_0x14a5('0x9')][_0x7abd3b[_0x14a5('0x25')]]['name']),_0x14a5('0x2d'),this[_0x14a5('0x9')][_0x7abd3b[_0x14a5('0x25')]]);}else if(this[_0x14a5('0x7')][_0x7abd3b[_0x14a5('0x25')]]){if(this['trunks'][_0x7abd3b[_0x14a5('0x25')]][_0x14a5('0x1f')]!==_0x7abd3b['state'][_0x14a5('0x28')]()){this[_0x14a5('0x7')][_0x7abd3b[_0x14a5('0x25')]]['stateTime']=_[_0x14a5('0x2b')](moment()[_0x14a5('0x23')]('x'));}this[_0x14a5('0x7')][_0x7abd3b[_0x14a5('0x25')]][_0x14a5('0x1f')]=_0x7abd3b[_0x14a5('0x1f')][_0x14a5('0x28')]();this[_0x14a5('0x1b')](util[_0x14a5('0x23')](_0x14a5('0x2e'),this['trunks'][_0x7abd3b[_0x14a5('0x25')]][_0x14a5('0x2f')]),'trunk:save',this[_0x14a5('0x7')][_0x7abd3b['device']]);}else if(_[_0x14a5('0x30')](_0x7abd3b[_0x14a5('0x25')],_0x14a5('0x31'))){}else if(_['startsWith'](_0x7abd3b[_0x14a5('0x25')],_0x14a5('0x32'))){var _0x1eccef=_0x7abd3b[_0x14a5('0x25')];var _0x3153f=_0x1eccef[_0x14a5('0x33')](_0x1eccef[_0x14a5('0x34')]('/')+0x1,_0x1eccef[_0x14a5('0x34')]('@'));var _0x27ff13=_[_0x14a5('0x1d')](this['agents'],function(_0x4a6f6d){return _0x4a6f6d['mobile']==_0x3153f||_0x4a6f6d[_0x14a5('0x35')]==_0x3153f||_0x4a6f6d['accountcode']==_0x3153f;});if(_0x27ff13){if(_0x27ff13['state']!==_0x7abd3b['state'][_0x14a5('0x28')]()){_0x27ff13[_0x14a5('0x29')]=_[_0x14a5('0x2b')](moment()[_0x14a5('0x23')]('x'));}_0x27ff13[_0x14a5('0x1f')]=_0x7abd3b[_0x14a5('0x1f')][_0x14a5('0x28')]();_0x27ff13[_0x14a5('0x26')]=!![];_0x27ff13[_0x14a5('0x2a')](_0x7abd3b);}}else{}}}catch(_0x165346){logger[_0x14a5('0x17')](_0x14a5('0x36'),util[_0x14a5('0x18')](_0x165346,{'showHidden':![],'depth':null}));}};UserReport[_0x14a5('0x19')][_0x14a5('0xe')]=function(_0x49d96e){try{if(this[_0x14a5('0x1c')](_0x49d96e)&&this['isNotNull'](_0x49d96e[_0x14a5('0x37')])){if(this[_0x14a5('0x8')][_0x49d96e[_0x14a5('0x38')]]){if(!this[_0x14a5('0x8')][_0x49d96e[_0x14a5('0x38')]][_0x14a5('0x26')]||_0x49d96e[_0x14a5('0x37')][_0x14a5('0x28')]()=='registered'){this[_0x14a5('0x8')][_0x49d96e[_0x14a5('0x38')]]['local']=![];this[_0x14a5('0x8')][_0x49d96e[_0x14a5('0x38')]]['status']=_0x49d96e['peerstatus'][_0x14a5('0x28')]();this[_0x14a5('0x8')][_0x49d96e['peer']][_0x14a5('0x39')]=_0x49d96e['address'];this[_0x14a5('0x8')][_0x49d96e['peer']][_0x14a5('0x2a')](_0x49d96e);}}else if(this[_0x14a5('0x9')][_0x49d96e[_0x14a5('0x38')]]){this[_0x14a5('0x9')][_0x49d96e[_0x14a5('0x38')]][_0x14a5('0x3a')]=_0x49d96e[_0x14a5('0x37')][_0x14a5('0x28')]();this['telephones'][_0x49d96e[_0x14a5('0x38')]][_0x14a5('0x39')]=_0x49d96e[_0x14a5('0x39')];this[_0x14a5('0x1b')](util[_0x14a5('0x23')](_0x14a5('0x2c'),this[_0x14a5('0x9')][_0x49d96e['peer']][_0x14a5('0x2f')]),'telephone:save',this['telephones'][_0x49d96e[_0x14a5('0x38')]]);}else if(this[_0x14a5('0x7')][_0x49d96e[_0x14a5('0x38')]]){this[_0x14a5('0x7')][_0x49d96e['peer']][_0x14a5('0x3a')]=_0x49d96e[_0x14a5('0x37')]['toLowerCase']();this[_0x14a5('0x7')][_0x49d96e['peer']][_0x14a5('0x39')]=_0x49d96e[_0x14a5('0x39')];this[_0x14a5('0x1b')](util[_0x14a5('0x23')](_0x14a5('0x2e'),this['trunks'][_0x49d96e['peer']][_0x14a5('0x2f')]),_0x14a5('0x3b'),this['trunks'][_0x49d96e[_0x14a5('0x38')]]);}else{}}}catch(_0x402428){logger[_0x14a5('0x17')](_0x14a5('0x3c'),util[_0x14a5('0x18')](_0x402428,{'showHidden':![],'depth':null}));}};module[_0x14a5('0x3d')]=UserReport; \ No newline at end of file +var _0x5bd1=['registryentry','syncRegistry','bind','registry','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','actionDeviceStateList','then','catch','[loopSyncRealTimeShow]','inspect','prototype','isNotNull','emit','username','stateRegistry','state','merge','actionid','format','trunk:%s','error','[syncRegistry][UserReport]','syncDeviceState','device','local','toLowerCase','inuse','stateTime','toNumber','telephone:%s','name','trunk:save','startsWith','Queue','Local','substring','indexOf','find','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','updateStatusRealtime','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','socket.io-emitter','trunks','agents','telephones'];(function(_0x2658c5,_0x21732f){var _0x51c2e2=function(_0x2f0d36){while(--_0x2f0d36){_0x2658c5['push'](_0x2658c5['shift']());}};_0x51c2e2(++_0x21732f);}(_0x5bd1,0x1f2));var _0x15bd=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x5bd1[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0x15bd('0x0'));var moment=require(_0x15bd('0x1'));var BPromise=require(_0x15bd('0x2'));var util=require(_0x15bd('0x3'));var Redis=require(_0x15bd('0x4'));var config=require(_0x15bd('0x5'));var logger=require(_0x15bd('0x6'))(_0x15bd('0x7'));var ami=require(_0x15bd('0x8'));config['redis']=_[_0x15bd('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x15bd('0xa'))(new Redis(config['redis']));function UserReport(_0x58ac27){this['trunks']=_0x58ac27[_0x15bd('0xb')];this[_0x15bd('0xc')]=_0x58ac27['agents'];this[_0x15bd('0xd')]=_0x58ac27[_0x15bd('0xd')];ami['on'](_0x15bd('0xe'),this[_0x15bd('0xf')][_0x15bd('0x10')](this));ami['on'](_0x15bd('0x11'),this['syncRegistry'][_0x15bd('0x10')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x15bd('0x10')](this));ami['on'](_0x15bd('0x12'),this[_0x15bd('0x13')][_0x15bd('0x10')](this));this[_0x15bd('0x14')]();return BPromise[_0x15bd('0x15')]()['then'](ami[_0x15bd('0x16')]())['then'](ami[_0x15bd('0x17')]())[_0x15bd('0x18')](ami['actionSipPeerStatus']())[_0x15bd('0x19')](loggerCatch(_0x15bd('0x1a')));}function loggerCatch(_0x215b78){return function(_0x21dc66){logger['error'](_0x215b78,util[_0x15bd('0x1b')](_0x21dc66,{'showHidden':![],'depth':null}));};}UserReport[_0x15bd('0x1c')][_0x15bd('0x14')]=function(){setInterval(function(){BPromise['resolve']()[_0x15bd('0x18')](ami[_0x15bd('0x16')]())[_0x15bd('0x18')](ami[_0x15bd('0x17')]())[_0x15bd('0x18')](ami['actionSipPeerStatus']())[_0x15bd('0x19')](loggerCatch(_0x15bd('0x1a')));},0x32c8);};UserReport[_0x15bd('0x1c')][_0x15bd('0x1d')]=function(_0x296032){return _0x296032!==null&&!_['isUndefined'](_0x296032);};UserReport[_0x15bd('0x1c')][_0x15bd('0x1e')]=function(_0x301560,_0x7999c6,_0x32ce21){io['to'](_0x301560)[_0x15bd('0x1e')](_0x7999c6,_0x32ce21);};UserReport[_0x15bd('0x1c')][_0x15bd('0xf')]=function(_0x3a55f9){try{if(this['isNotNull'](_0x3a55f9)){var _0x5831af=_['find'](this[_0x15bd('0xb')],{'registry':_0x3a55f9[_0x15bd('0x1f')]});if(_0x5831af){_0x3a55f9[_0x15bd('0x20')]=_0x3a55f9[_0x15bd('0x21')];_[_0x15bd('0x22')](_0x5831af,_['omit'](_0x3a55f9,['event',_0x15bd('0x23'),_0x15bd('0x1f'),_0x15bd('0x21')]));this[_0x15bd('0x1e')](util[_0x15bd('0x24')](_0x15bd('0x25'),_0x5831af['name']),'trunk:save',_0x5831af);}}}catch(_0xaf73f6){logger[_0x15bd('0x26')](_0x15bd('0x27'),util[_0x15bd('0x1b')](_0xaf73f6,{'showHidden':![],'depth':null}));}};UserReport[_0x15bd('0x1c')][_0x15bd('0x28')]=function(_0x3e0b1a){try{if(this[_0x15bd('0x1d')](_0x3e0b1a)){if(this['agents'][_0x3e0b1a[_0x15bd('0x29')]]){if(!this['agents'][_0x3e0b1a[_0x15bd('0x29')]][_0x15bd('0x2a')]||_0x3e0b1a[_0x15bd('0x21')][_0x15bd('0x2b')]()==_0x15bd('0x2c')){this['agents'][_0x3e0b1a['device']][_0x15bd('0x2a')]=![];if(this[_0x15bd('0xc')][_0x3e0b1a['device']][_0x15bd('0x21')]!==_0x3e0b1a[_0x15bd('0x21')][_0x15bd('0x2b')]()){this[_0x15bd('0xc')][_0x3e0b1a[_0x15bd('0x29')]][_0x15bd('0x2d')]=_[_0x15bd('0x2e')](moment()[_0x15bd('0x24')]('x'));}this['agents'][_0x3e0b1a['device']]['state']=_0x3e0b1a['state'][_0x15bd('0x2b')]();this[_0x15bd('0xc')][_0x3e0b1a[_0x15bd('0x29')]]['updateStatusRealtime'](_0x3e0b1a);}}else if(this[_0x15bd('0xd')][_0x3e0b1a['device']]){if(this[_0x15bd('0xd')][_0x3e0b1a['device']][_0x15bd('0x21')]!==_0x3e0b1a[_0x15bd('0x21')][_0x15bd('0x2b')]()){this[_0x15bd('0xd')][_0x3e0b1a[_0x15bd('0x29')]][_0x15bd('0x2d')]=_[_0x15bd('0x2e')](moment()[_0x15bd('0x24')]('x'));}this[_0x15bd('0xd')][_0x3e0b1a['device']][_0x15bd('0x21')]=_0x3e0b1a[_0x15bd('0x21')][_0x15bd('0x2b')]();this[_0x15bd('0x1e')](util[_0x15bd('0x24')](_0x15bd('0x2f'),this[_0x15bd('0xd')][_0x3e0b1a[_0x15bd('0x29')]][_0x15bd('0x30')]),'telephone:save',this['telephones'][_0x3e0b1a['device']]);}else if(this[_0x15bd('0xb')][_0x3e0b1a['device']]){if(this[_0x15bd('0xb')][_0x3e0b1a[_0x15bd('0x29')]][_0x15bd('0x21')]!==_0x3e0b1a[_0x15bd('0x21')][_0x15bd('0x2b')]()){this[_0x15bd('0xb')][_0x3e0b1a[_0x15bd('0x29')]]['stateTime']=_[_0x15bd('0x2e')](moment()['format']('x'));}this[_0x15bd('0xb')][_0x3e0b1a['device']][_0x15bd('0x21')]=_0x3e0b1a[_0x15bd('0x21')][_0x15bd('0x2b')]();this[_0x15bd('0x1e')](util[_0x15bd('0x24')](_0x15bd('0x25'),this[_0x15bd('0xb')][_0x3e0b1a[_0x15bd('0x29')]][_0x15bd('0x30')]),_0x15bd('0x31'),this['trunks'][_0x3e0b1a['device']]);}else if(_[_0x15bd('0x32')](_0x3e0b1a[_0x15bd('0x29')],_0x15bd('0x33'))){}else if(_[_0x15bd('0x32')](_0x3e0b1a[_0x15bd('0x29')],_0x15bd('0x34'))){var _0x3cf1f2=_0x3e0b1a[_0x15bd('0x29')];var _0x2a0a92=_0x3cf1f2[_0x15bd('0x35')](_0x3cf1f2[_0x15bd('0x36')]('/')+0x1,_0x3cf1f2[_0x15bd('0x36')]('@'));var _0x40e0d9=_[_0x15bd('0x37')](this['agents'],function(_0x2acf2c){return _0x2acf2c['mobile']==_0x2a0a92||_0x2acf2c[_0x15bd('0x38')]==_0x2a0a92||_0x2acf2c[_0x15bd('0x39')]==_0x2a0a92;});if(_0x40e0d9){if(_0x40e0d9['state']!==_0x3e0b1a[_0x15bd('0x21')]['toLowerCase']()){_0x40e0d9[_0x15bd('0x2d')]=_['toNumber'](moment()[_0x15bd('0x24')]('x'));}_0x40e0d9[_0x15bd('0x21')]=_0x3e0b1a[_0x15bd('0x21')][_0x15bd('0x2b')]();_0x40e0d9['local']=!![];_0x40e0d9['updateStatusRealtime'](_0x3e0b1a);}}else{}}}catch(_0x1008cd){logger['error'](_0x15bd('0x3a'),util[_0x15bd('0x1b')](_0x1008cd,{'showHidden':![],'depth':null}));}};UserReport[_0x15bd('0x1c')][_0x15bd('0x13')]=function(_0x218b87){try{if(this['isNotNull'](_0x218b87)&&this['isNotNull'](_0x218b87[_0x15bd('0x12')])){if(this[_0x15bd('0xc')][_0x218b87['peer']]){if(!this['agents'][_0x218b87[_0x15bd('0x3b')]]['local']||_0x218b87['peerstatus']['toLowerCase']()==_0x15bd('0x3c')){this[_0x15bd('0xc')][_0x218b87['peer']]['local']=![];this[_0x15bd('0xc')][_0x218b87[_0x15bd('0x3b')]][_0x15bd('0x3d')]=_0x218b87[_0x15bd('0x12')]['toLowerCase']();this[_0x15bd('0xc')][_0x218b87[_0x15bd('0x3b')]][_0x15bd('0x3e')]=_0x218b87[_0x15bd('0x3e')];this['agents'][_0x218b87[_0x15bd('0x3b')]][_0x15bd('0x3f')](_0x218b87);}}else if(this[_0x15bd('0xd')][_0x218b87[_0x15bd('0x3b')]]){this[_0x15bd('0xd')][_0x218b87['peer']]['status']=_0x218b87[_0x15bd('0x12')][_0x15bd('0x2b')]();this['telephones'][_0x218b87[_0x15bd('0x3b')]][_0x15bd('0x3e')]=_0x218b87[_0x15bd('0x3e')];this[_0x15bd('0x1e')](util[_0x15bd('0x24')](_0x15bd('0x2f'),this['telephones'][_0x218b87[_0x15bd('0x3b')]][_0x15bd('0x30')]),'telephone:save',this[_0x15bd('0xd')][_0x218b87[_0x15bd('0x3b')]]);}else if(this[_0x15bd('0xb')][_0x218b87[_0x15bd('0x3b')]]){this[_0x15bd('0xb')][_0x218b87[_0x15bd('0x3b')]][_0x15bd('0x3d')]=_0x218b87['peerstatus'][_0x15bd('0x2b')]();this['trunks'][_0x218b87[_0x15bd('0x3b')]][_0x15bd('0x3e')]=_0x218b87['address'];this['emit'](util['format'](_0x15bd('0x25'),this[_0x15bd('0xb')][_0x218b87[_0x15bd('0x3b')]][_0x15bd('0x30')]),'trunk:save',this[_0x15bd('0xb')][_0x218b87[_0x15bd('0x3b')]]);}else{}}}catch(_0x2a4eb7){logger[_0x15bd('0x26')]('[syncPeerStatus][UserReport]',util[_0x15bd('0x1b')](_0x2a4eb7,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 3906706..8d35af8 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 _0xdaf4=['voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','variables','type','inbound','merge','omit','event','custom:agentcalled','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','format','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','queue','destconnectedlinenum','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','acw','agentacw','interface','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberrealtime','isNil','transfer','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels'];(function(_0x708606,_0x1c1aa0){var _0x8e52b9=function(_0x4c6eea){while(--_0x4c6eea){_0x708606['push'](_0x708606['shift']());}};_0x8e52b9(++_0x1c1aa0);}(_0xdaf4,0x6f));var _0x4daf=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xdaf4[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0x4daf('0x0'));var moment=require(_0x4daf('0x1'));var util=require(_0x4daf('0x2'));var Redis=require(_0x4daf('0x3'));var config=require(_0x4daf('0x4'));var logger=require(_0x4daf('0x5'))(_0x4daf('0x6'));var ami=require(_0x4daf('0x7'));config[_0x4daf('0x8')]=_[_0x4daf('0x9')](config[_0x4daf('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x4daf('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x5d0cfb){this[_0x4daf('0xb')]={};this[_0x4daf('0xc')]=_0x5d0cfb[_0x4daf('0xc')];this[_0x4daf('0xd')]=_0x5d0cfb['agents'];this['variables']={};ami['on'](_0x4daf('0xe'),this[_0x4daf('0xf')][_0x4daf('0x10')](this));ami['on'](_0x4daf('0x11'),this[_0x4daf('0x12')][_0x4daf('0x10')](this));ami['on'](_0x4daf('0x13'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x4daf('0x14'),this['syncQueueCallerAbandon'][_0x4daf('0x10')](this));ami['on'](_0x4daf('0x15'),this[_0x4daf('0x16')]['bind'](this));ami['on'](_0x4daf('0x17'),this[_0x4daf('0x18')][_0x4daf('0x10')](this));ami['on'](_0x4daf('0x19'),this[_0x4daf('0x1a')][_0x4daf('0x10')](this));ami['on'](_0x4daf('0x1b'),this['syncMusicOnHoldStart'][_0x4daf('0x10')](this));ami['on'](_0x4daf('0x1c'),this['syncMusicOnHoldStop'][_0x4daf('0x10')](this));ami['on'](_0x4daf('0x1d'),this[_0x4daf('0x1e')][_0x4daf('0x10')](this));ami['on']('blindtransfer',this[_0x4daf('0x1f')][_0x4daf('0x10')](this));}VoiceAgentReport['prototype'][_0x4daf('0x20')]=function(_0x1c3a73,_0x17686d,_0x168540){io['to'](_0x1c3a73)[_0x4daf('0x20')](_0x17686d,_0x168540);};VoiceAgentReport[_0x4daf('0x21')][_0x4daf('0x22')]=function(_0x16c58c){return _0x16c58c!==null&&!_[_0x4daf('0x23')](_0x16c58c);};VoiceAgentReport[_0x4daf('0x21')][_0x4daf('0xf')]=function(_0x179d08){try{if(this[_0x4daf('0x22')](_0x179d08)){if(_[_0x4daf('0x23')](this[_0x4daf('0xb')][_0x179d08[_0x4daf('0x24')]])){this['channels'][_0x179d08['uniqueid']]={};}if(_['isUndefined'](this[_0x4daf('0xb')][_0x179d08[_0x4daf('0x24')]][_0x179d08['destuniqueid']])){this[_0x4daf('0xb')][_0x179d08[_0x4daf('0x24')]][_0x179d08[_0x4daf('0x25')]]={'agentcalledAt':moment()['format'](_0x4daf('0x26')),'lastevent':_0x4daf('0x27'),'variables':this[_0x4daf('0x28')][_0x179d08['uniqueid']],'type':this[_0x4daf('0xc')][_0x179d08['queue']]?this[_0x4daf('0xc')][_0x179d08['queue']][_0x4daf('0x29')]||'inbound':_0x4daf('0x2a')};}_[_0x4daf('0x2b')](this[_0x4daf('0xb')][_0x179d08['uniqueid']][_0x179d08['destuniqueid']],_[_0x4daf('0x2c')](_0x179d08,[_0x4daf('0x2d'),'privilege']));ami[_0x4daf('0x20')](_0x4daf('0x2e'),this[_0x4daf('0xb')][_0x179d08[_0x4daf('0x24')]][_0x179d08[_0x4daf('0x25')]]);this['emit'](util['format'](_0x4daf('0x2f'),_0x179d08[_0x4daf('0x30')]),_0x4daf('0x31'),this[_0x4daf('0xb')][_0x179d08['uniqueid']][_0x179d08[_0x4daf('0x25')]]);}}catch(_0x456d32){logger[_0x4daf('0x32')](_0x4daf('0x33'),util[_0x4daf('0x34')](_0x456d32,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4daf('0x21')][_0x4daf('0x12')]=function(_0x3f7b8e){try{if(this['isNotNull'](_0x3f7b8e)){if(this[_0x4daf('0xb')][_0x3f7b8e[_0x4daf('0x24')]]){for(var _0x5e8bb9 in this['channels'][_0x3f7b8e['uniqueid']]){if(this[_0x4daf('0xb')][_0x3f7b8e[_0x4daf('0x24')]][_0x4daf('0x35')](_0x5e8bb9)){if(_0x3f7b8e[_0x4daf('0x25')]===_0x5e8bb9){this[_0x4daf('0xb')][_0x3f7b8e['uniqueid']][_0x5e8bb9]['agentconnectAt']=moment()[_0x4daf('0x36')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9][_0x4daf('0x37')]=_0x4daf('0x38');this[_0x4daf('0xb')][_0x3f7b8e['uniqueid']][_0x5e8bb9][_0x4daf('0x39')]=_0x3f7b8e[_0x4daf('0x39')];this[_0x4daf('0xb')][_0x3f7b8e['uniqueid']][_0x5e8bb9][_0x4daf('0x3a')]=_0x3f7b8e[_0x4daf('0x3a')];this[_0x4daf('0xb')][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9][_0x4daf('0x3b')]=_0x3f7b8e['connectedlinename'];this[_0x4daf('0xb')][_0x3f7b8e['uniqueid']][_0x5e8bb9][_0x4daf('0x3c')]=_0x3f7b8e[_0x4daf('0x3c')];this['channels'][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9][_0x4daf('0x3d')]=_0x3f7b8e[_0x4daf('0x3d')];_[_0x4daf('0x2b')](this[_0x4daf('0xd')][_0x3f7b8e['interface']],_['pick'](_0x3f7b8e,[_0x4daf('0x3e'),_0x4daf('0x3f')]));this[_0x4daf('0x20')](util[_0x4daf('0x36')](_0x4daf('0x2f'),_0x3f7b8e['membername']),_0x4daf('0x40'),this[_0x4daf('0xb')][_0x3f7b8e[_0x4daf('0x24')]][_0x3f7b8e[_0x4daf('0x25')]]);ami[_0x4daf('0x20')]('custom:agentconnect',this['channels'][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9]);}else if(!this[_0x4daf('0xb')][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9][_0x4daf('0x13')]&&!this[_0x4daf('0xb')][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9][_0x4daf('0x15')]){this[_0x4daf('0xb')][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9]['agentringnoanswer']=!![];this['channels'][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9][_0x4daf('0x41')]=moment()['format'](_0x4daf('0x26'));this['channels'][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9][_0x4daf('0x42')]=_0x4daf('0x43');this[_0x4daf('0xb')][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9]['lastevent']='answered_elsewhere';this[_0x4daf('0xb')][_0x3f7b8e['uniqueid']][_0x5e8bb9][_0x4daf('0x44')]=_0x3f7b8e[_0x4daf('0x25')];this[_0x4daf('0xb')][_0x3f7b8e[_0x4daf('0x24')]][_0x5e8bb9]['answeredelsewheremembername']=_0x3f7b8e[_0x4daf('0x30')];ami[_0x4daf('0x20')](_0x4daf('0x45'),this[_0x4daf('0xb')][_0x3f7b8e['uniqueid']][_0x5e8bb9]);}}}}}}catch(_0x4b21ab){logger['error'](_0x4daf('0x46'),util[_0x4daf('0x34')](_0x4b21ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4daf('0x21')][_0x4daf('0x47')]=function(_0xffe290){try{if(this['isNotNull'](_0xffe290)){if(this[_0x4daf('0xb')][_0xffe290['uniqueid']]&&this[_0x4daf('0xb')][_0xffe290['uniqueid']][_0xffe290[_0x4daf('0x25')]]){this[_0x4daf('0xb')][_0xffe290[_0x4daf('0x24')]][_0xffe290['destuniqueid']][_0x4daf('0x13')]=!![];this[_0x4daf('0xb')][_0xffe290[_0x4daf('0x24')]][_0xffe290[_0x4daf('0x25')]][_0x4daf('0x41')]=moment()[_0x4daf('0x36')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4daf('0xb')][_0xffe290[_0x4daf('0x24')]][_0xffe290[_0x4daf('0x25')]][_0x4daf('0x42')]=_0x4daf('0x48');this[_0x4daf('0xb')][_0xffe290[_0x4daf('0x24')]][_0xffe290[_0x4daf('0x25')]][_0x4daf('0x37')]=_0x4daf('0x48');ami[_0x4daf('0x20')](_0x4daf('0x49'),this[_0x4daf('0xb')][_0xffe290[_0x4daf('0x24')]][_0xffe290[_0x4daf('0x25')]]);}}}catch(_0x2079a5){logger['error'](_0x4daf('0x4a'),util['inspect'](_0x2079a5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4daf('0x21')][_0x4daf('0x4b')]=function(_0x23acb8){try{if(this[_0x4daf('0x22')](_0x23acb8)){if(this[_0x4daf('0xb')][_0x23acb8['uniqueid']]){for(var _0x84cb8 in this[_0x4daf('0xb')][_0x23acb8[_0x4daf('0x24')]]){if(this[_0x4daf('0xb')][_0x23acb8[_0x4daf('0x24')]][_0x4daf('0x35')](_0x84cb8)&&!this[_0x4daf('0xb')][_0x23acb8[_0x4daf('0x24')]][_0x84cb8][_0x4daf('0x13')]&&!this[_0x4daf('0xb')][_0x23acb8[_0x4daf('0x24')]][_0x84cb8][_0x4daf('0x15')]){this[_0x4daf('0xb')][_0x23acb8[_0x4daf('0x24')]][_0x84cb8][_0x4daf('0x13')]=!![];this[_0x4daf('0xb')][_0x23acb8['uniqueid']][_0x84cb8][_0x4daf('0x41')]=moment()[_0x4daf('0x36')](_0x4daf('0x26'));this[_0x4daf('0xb')][_0x23acb8[_0x4daf('0x24')]][_0x84cb8][_0x4daf('0x42')]=_0x4daf('0x4c');this[_0x4daf('0xb')][_0x23acb8[_0x4daf('0x24')]][_0x84cb8]['lastevent']=_0x4daf('0x4c');ami[_0x4daf('0x20')](_0x4daf('0x4d'),this['channels'][_0x23acb8[_0x4daf('0x24')]][_0x84cb8]);}}}}}catch(_0x31bb24){logger[_0x4daf('0x32')](_0x4daf('0x4e'),util[_0x4daf('0x34')](_0x31bb24,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4daf('0x21')][_0x4daf('0x16')]=function(_0x23004a){try{if(this[_0x4daf('0x22')](_0x23004a)){if(this[_0x4daf('0xb')][_0x23004a[_0x4daf('0x24')]]){for(var _0x3981bb in this['channels'][_0x23004a[_0x4daf('0x24')]]){if(this[_0x4daf('0xb')][_0x23004a[_0x4daf('0x24')]][_0x4daf('0x35')](_0x3981bb)){if(this[_0x4daf('0xb')][_0x23004a[_0x4daf('0x24')]][_0x3981bb]['agentconnectAt']&&!this[_0x4daf('0xb')][_0x23004a[_0x4daf('0x24')]][_0x3981bb][_0x4daf('0x15')]){this[_0x4daf('0xb')][_0x23004a['uniqueid']][_0x3981bb][_0x4daf('0x15')]=!![];this[_0x4daf('0xb')][_0x23004a['uniqueid']][_0x3981bb][_0x4daf('0x4f')]=moment()[_0x4daf('0x36')](_0x4daf('0x26'));this['channels'][_0x23004a[_0x4daf('0x24')]][_0x3981bb][_0x4daf('0x37')]=_0x4daf('0x50');this[_0x4daf('0xb')][_0x23004a['uniqueid']][_0x3981bb][_0x4daf('0x51')]=_0x23004a[_0x4daf('0x51')];this['channels'][_0x23004a['uniqueid']][_0x3981bb][_0x4daf('0x42')]=_0x23004a['reason']=='transfer'?'agent':_0x23004a[_0x4daf('0x42')];if(this[_0x4daf('0xc')][_0x23004a['queue']]&&this[_0x4daf('0xc')][_0x23004a['queue']][_0x4daf('0x52')]){this[_0x4daf('0xb')][_0x23004a[_0x4daf('0x24')]][_0x3981bb][_0x4daf('0x53')]=!![];this[_0x4daf('0xb')][_0x23004a[_0x4daf('0x24')]][_0x3981bb]['acwtime']=this['voiceQueues'][_0x23004a[_0x4daf('0x3e')]]['acwTimeout'];}this[_0x4daf('0xd')][_0x23004a[_0x4daf('0x54')]]=_[_0x4daf('0x2c')](this['agents'][_0x23004a[_0x4daf('0x54')]],[_0x4daf('0x3e'),_0x4daf('0x3f')]);this[_0x4daf('0x20')](util[_0x4daf('0x36')]('user:%s',_0x23004a[_0x4daf('0x30')]),_0x4daf('0x55'),this[_0x4daf('0xb')][_0x23004a[_0x4daf('0x24')]][_0x3981bb]);ami[_0x4daf('0x20')](_0x4daf('0x56'),this['channels'][_0x23004a[_0x4daf('0x24')]][_0x3981bb]);}}}}}}catch(_0x41cc7b){logger[_0x4daf('0x32')](_0x4daf('0x57'),util[_0x4daf('0x34')](_0x41cc7b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4daf('0x18')]=function(_0x1dcea5){try{if(this['isNotNull'](_0x1dcea5)){this[_0x4daf('0x58')](_0x1dcea5[_0x4daf('0x24')],_['keys'](_0x1dcea5[_0x4daf('0x59')])[0x0],_0x1dcea5[_0x4daf('0x5a')]);if(this[_0x4daf('0xb')][_0x1dcea5[_0x4daf('0x24')]]){for(var _0x5312da in this[_0x4daf('0xb')][_0x1dcea5[_0x4daf('0x24')]]){if(this[_0x4daf('0xb')][_0x1dcea5['uniqueid']]['hasOwnProperty'](_0x5312da)){if(_[_0x4daf('0x23')](this[_0x4daf('0xb')][_0x1dcea5['uniqueid']][_0x5312da]['variables'])){this['channels'][_0x1dcea5['uniqueid']][_0x5312da][_0x4daf('0x28')]={};}this['channels'][_0x1dcea5[_0x4daf('0x24')]][_0x5312da][_0x4daf('0x28')]=this[_0x4daf('0x28')][_0x1dcea5[_0x4daf('0x24')]];}}}}}catch(_0x5d1eef){logger[_0x4daf('0x32')](_0x4daf('0x5b'),util[_0x4daf('0x34')](_0x5d1eef,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4daf('0x21')]['addVariable']=function(_0x1ff37a,_0x19b446,_0x35f19d){var _0x2615ca=[_0x4daf('0x5c'),'rtpaudioqosbridged',_0x4daf('0x5d'),_0x4daf('0x5e'),_0x4daf('0x5f'),_0x4daf('0x60'),_0x4daf('0x61'),_0x4daf('0x62'),_0x4daf('0x63'),'sipuri',_0x4daf('0x64'),_0x4daf('0x65'),_0x4daf('0x66'),_0x4daf('0x67'),'memberinterface',_0x4daf('0x68'),_0x4daf('0x30'),'memberpenalty',_0x4daf('0x69')];if(!_[_0x4daf('0x6a')](_0x19b446)&&!_['includes'](_0x2615ca,_0x19b446)){if(_[_0x4daf('0x23')](this['variables'][_0x1ff37a])){this[_0x4daf('0x28')][_0x1ff37a]={};}this[_0x4daf('0x28')][_0x1ff37a][_0x19b446]=_0x35f19d;}};VoiceAgentReport[_0x4daf('0x21')][_0x4daf('0x1a')]=function(_0x46f892){try{if(this[_0x4daf('0x22')](_0x46f892)){if(this[_0x4daf('0xb')][_0x46f892[_0x4daf('0x24')]]){for(var _0xa11d9 in this[_0x4daf('0xb')][_0x46f892[_0x4daf('0x24')]]){if(this['channels'][_0x46f892[_0x4daf('0x24')]][_0x4daf('0x35')](_0xa11d9)){if(this['channels'][_0x46f892[_0x4daf('0x24')]][_0xa11d9]['reason']==_0x4daf('0x6b')&&this['channels'][_0x46f892[_0x4daf('0x24')]][_0xa11d9]['agentcomplete']){this[_0x4daf('0xb')][_0x46f892['uniqueid']][_0xa11d9][_0x4daf('0x4f')]=moment()[_0x4daf('0x36')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0x4daf('0x20')]('custom:voiceAgentReport',_['values'](this[_0x4daf('0xb')][_0x46f892[_0x4daf('0x24')]]));delete this[_0x4daf('0xb')][_0x46f892['uniqueid']];}if(this[_0x4daf('0x28')][_0x46f892[_0x4daf('0x24')]]){delete this[_0x4daf('0x28')][_0x46f892[_0x4daf('0x24')]];}}}catch(_0x5eed0f){logger[_0x4daf('0x32')](_0x4daf('0x6c'),util[_0x4daf('0x34')](_0x5eed0f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4daf('0x21')][_0x4daf('0x1e')]=function(_0x2b0451){try{if(this[_0x4daf('0x22')](_0x2b0451)){if(this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x6d')]]){for(var _0x17440a in this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x6d')]]){if(this[_0x4daf('0xb')][_0x2b0451['transfereeuniqueid']][_0x4daf('0x35')](_0x17440a)){if(_0x2b0451[_0x4daf('0x6e')]===_0x17440a){var _0x1cde07=moment();this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x6d')]][_0x17440a]['agentcomplete']=!![];this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x6d')]][_0x17440a][_0x4daf('0x4f')]=moment()[_0x4daf('0x36')](_0x4daf('0x26'));this['channels'][_0x2b0451[_0x4daf('0x6d')]][_0x17440a][_0x4daf('0x42')]=_0x4daf('0x6b');this['channels'][_0x2b0451['transfereeuniqueid']][_0x17440a][_0x4daf('0x37')]=_0x4daf('0x50');this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x6d')]][_0x17440a][_0x4daf('0x51')]=_0x1cde07[_0x4daf('0x6f')](this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x6d')]][_0x17440a]['agentconnectAt'],'seconds');}}}}if(this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x70')]]){var _0x440378=this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x70')]];this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x70')]]=this[_0x4daf('0xb')][_0x2b0451['transfereeuniqueid']];this[_0x4daf('0xb')][_0x2b0451[_0x4daf('0x6d')]]=_0x440378;}}}catch(_0x4b4974){logger[_0x4daf('0x32')](_0x4daf('0x71'),util[_0x4daf('0x34')](_0x4b4974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4daf('0x21')][_0x4daf('0x1f')]=function(_0x16bfbb){try{if(this['isNotNull'](_0x16bfbb)){if(this[_0x4daf('0xb')][_0x16bfbb[_0x4daf('0x6d')]]){for(var _0xa7d00d in this[_0x4daf('0xb')][_0x16bfbb[_0x4daf('0x6d')]]){if(this[_0x4daf('0xb')][_0x16bfbb[_0x4daf('0x6d')]][_0x4daf('0x35')](_0xa7d00d)){if(_0x16bfbb[_0x4daf('0x72')]===_0xa7d00d){var _0x2a9108=moment();this[_0x4daf('0xb')][_0x16bfbb[_0x4daf('0x6d')]][_0xa7d00d][_0x4daf('0x15')]=!![];this[_0x4daf('0xb')][_0x16bfbb[_0x4daf('0x6d')]][_0xa7d00d][_0x4daf('0x4f')]=_0x2a9108;this['channels'][_0x16bfbb[_0x4daf('0x6d')]][_0xa7d00d][_0x4daf('0x42')]=_0x4daf('0x6b');this[_0x4daf('0xb')][_0x16bfbb['transfereeuniqueid']][_0xa7d00d][_0x4daf('0x37')]=_0x4daf('0x50');this[_0x4daf('0xb')][_0x16bfbb[_0x4daf('0x6d')]][_0xa7d00d][_0x4daf('0x51')]=_0x2a9108[_0x4daf('0x6f')](this[_0x4daf('0xb')][_0x16bfbb[_0x4daf('0x6d')]][_0xa7d00d]['agentconnectAt'],'seconds');}}}}}}catch(_0x4f3084){logger['error'](_0x4daf('0x73'),util['inspect'](_0x4f3084,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x4f7d3c){var _0x372dde='';try{if(this[_0x4daf('0x22')](_0x4f7d3c)){if(_0x4f7d3c[_0x4daf('0x74')]){_0x372dde=_0x4f7d3c[_0x4daf('0x74')][_0x4daf('0x75')](0x0,_0x4f7d3c[_0x4daf('0x74')][_0x4daf('0x76')]('-'));if(this[_0x4daf('0xd')][_0x372dde]){this['agents'][_0x372dde][_0x4daf('0x77')]=!![];}}}}catch(_0x25b438){logger['error'](_0x4daf('0x78'),util[_0x4daf('0x34')](_0x25b438,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4daf('0x21')]['syncMusicOnHoldStop']=function(_0x377424){var _0x47b89c='';try{if(this[_0x4daf('0x22')](_0x377424)){if(_0x377424[_0x4daf('0x74')]){_0x47b89c=_0x377424[_0x4daf('0x74')][_0x4daf('0x75')](0x0,_0x377424[_0x4daf('0x74')][_0x4daf('0x76')]('-'));if(this['agents'][_0x47b89c]){this[_0x4daf('0xd')][_0x47b89c][_0x4daf('0x77')]=![];}}}}catch(_0x346dab){logger[_0x4daf('0x32')](_0x4daf('0x79'),util['inspect'](_0x346dab,{'showHidden':![],'depth':null}));}};module[_0x4daf('0x7a')]=VoiceAgentReport; \ No newline at end of file +var _0x4698=['custom:agentcalled','user:called','error','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','user:%s','membername','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','transfer','agent','acwtime','acwTimeout','omit','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','value','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','custom:voiceAgentReport','values','transfereeuniqueid','origtransfereruniqueid','talktime','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','syncMusicOnHoldStart','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','privilege'];(function(_0x5e78e0,_0x2ee185){var _0x583070=function(_0x3f9697){while(--_0x3f9697){_0x5e78e0['push'](_0x5e78e0['shift']());}};_0x583070(++_0x2ee185);}(_0x4698,0x1c4));var _0x8469=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x4698[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x8469('0x0'));var moment=require(_0x8469('0x1'));var util=require(_0x8469('0x2'));var Redis=require(_0x8469('0x3'));var config=require(_0x8469('0x4'));var logger=require(_0x8469('0x5'))(_0x8469('0x6'));var ami=require(_0x8469('0x7'));config[_0x8469('0x8')]=_[_0x8469('0x9')](config[_0x8469('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x8469('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x3dca33){this[_0x8469('0xb')]={};this['voiceQueues']=_0x3dca33[_0x8469('0xc')];this[_0x8469('0xd')]=_0x3dca33[_0x8469('0xd')];this[_0x8469('0xe')]={};ami['on'](_0x8469('0xf'),this[_0x8469('0x10')][_0x8469('0x11')](this));ami['on'](_0x8469('0x12'),this['syncAgentConnect'][_0x8469('0x11')](this));ami['on'](_0x8469('0x13'),this[_0x8469('0x14')]['bind'](this));ami['on']('queuecallerabandon',this[_0x8469('0x15')][_0x8469('0x11')](this));ami['on'](_0x8469('0x16'),this[_0x8469('0x17')][_0x8469('0x11')](this));ami['on'](_0x8469('0x18'),this['syncVarSet']['bind'](this));ami['on'](_0x8469('0x19'),this[_0x8469('0x1a')][_0x8469('0x11')](this));ami['on'](_0x8469('0x1b'),this['syncMusicOnHoldStart'][_0x8469('0x11')](this));ami['on'](_0x8469('0x1c'),this[_0x8469('0x1d')][_0x8469('0x11')](this));ami['on'](_0x8469('0x1e'),this[_0x8469('0x1f')][_0x8469('0x11')](this));ami['on'](_0x8469('0x20'),this[_0x8469('0x21')]['bind'](this));}VoiceAgentReport[_0x8469('0x22')][_0x8469('0x23')]=function(_0x4186f2,_0x3933d7,_0x53b6ef){io['to'](_0x4186f2)[_0x8469('0x23')](_0x3933d7,_0x53b6ef);};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x24')]=function(_0x5515ed){return _0x5515ed!==null&&!_[_0x8469('0x25')](_0x5515ed);};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x10')]=function(_0x286afb){try{if(this[_0x8469('0x24')](_0x286afb)){if(_[_0x8469('0x25')](this[_0x8469('0xb')][_0x286afb[_0x8469('0x26')]])){this[_0x8469('0xb')][_0x286afb['uniqueid']]={};}if(_[_0x8469('0x25')](this[_0x8469('0xb')][_0x286afb['uniqueid']][_0x286afb[_0x8469('0x27')]])){this[_0x8469('0xb')][_0x286afb[_0x8469('0x26')]][_0x286afb[_0x8469('0x27')]]={'agentcalledAt':moment()[_0x8469('0x28')](_0x8469('0x29')),'lastevent':_0x8469('0x2a'),'variables':this[_0x8469('0xe')][_0x286afb[_0x8469('0x26')]],'type':this[_0x8469('0xc')][_0x286afb[_0x8469('0x2b')]]?this[_0x8469('0xc')][_0x286afb[_0x8469('0x2b')]][_0x8469('0x2c')]||_0x8469('0x2d'):_0x8469('0x2d')};}_[_0x8469('0x2e')](this['channels'][_0x286afb['uniqueid']][_0x286afb['destuniqueid']],_['omit'](_0x286afb,['event',_0x8469('0x2f')]));ami[_0x8469('0x23')](_0x8469('0x30'),this['channels'][_0x286afb[_0x8469('0x26')]][_0x286afb[_0x8469('0x27')]]);this[_0x8469('0x23')](util[_0x8469('0x28')]('user:%s',_0x286afb['membername']),_0x8469('0x31'),this[_0x8469('0xb')][_0x286afb['uniqueid']][_0x286afb[_0x8469('0x27')]]);}}catch(_0x34d863){logger[_0x8469('0x32')](_0x8469('0x33'),util['inspect'](_0x34d863,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8469('0x22')]['syncAgentConnect']=function(_0x565ba5){try{if(this[_0x8469('0x24')](_0x565ba5)){if(this['channels'][_0x565ba5['uniqueid']]){for(var _0x5d44bb in this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]]){if(this['channels'][_0x565ba5[_0x8469('0x26')]][_0x8469('0x34')](_0x5d44bb)){if(_0x565ba5[_0x8469('0x27')]===_0x5d44bb){this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x35')]=moment()[_0x8469('0x28')](_0x8469('0x29'));this['channels'][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x36')]=_0x8469('0x37');this['channels'][_0x565ba5['uniqueid']][_0x5d44bb][_0x8469('0x38')]=_0x565ba5[_0x8469('0x38')];this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x39')]=_0x565ba5[_0x8469('0x39')];this[_0x8469('0xb')][_0x565ba5['uniqueid']][_0x5d44bb][_0x8469('0x3a')]=_0x565ba5[_0x8469('0x3a')];this[_0x8469('0xb')][_0x565ba5['uniqueid']][_0x5d44bb][_0x8469('0x3b')]=_0x565ba5[_0x8469('0x3b')];this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x3c')]=_0x565ba5['destchannelstatedesc'];_[_0x8469('0x2e')](this[_0x8469('0xd')][_0x565ba5[_0x8469('0x3d')]],_['pick'](_0x565ba5,[_0x8469('0x2b'),'destconnectedlinenum']));this[_0x8469('0x23')](util[_0x8469('0x28')](_0x8469('0x3e'),_0x565ba5[_0x8469('0x3f')]),_0x8469('0x40'),this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x565ba5[_0x8469('0x27')]]);ami[_0x8469('0x23')]('custom:agentconnect',this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb]);}else if(!this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x13')]&&!this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x16')]){this['channels'][_0x565ba5[_0x8469('0x26')]][_0x5d44bb]['agentringnoanswer']=!![];this['channels'][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x41')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x42')]=_0x8469('0x43');this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x36')]='answered_elsewhere';this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb]['answeredelsewheredestinationuniqueid']=_0x565ba5[_0x8469('0x27')];this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb][_0x8469('0x44')]=_0x565ba5[_0x8469('0x3f')];ami[_0x8469('0x23')](_0x8469('0x45'),this[_0x8469('0xb')][_0x565ba5[_0x8469('0x26')]][_0x5d44bb]);}}}}}}catch(_0x30373d){logger['error'](_0x8469('0x46'),util[_0x8469('0x47')](_0x30373d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x14')]=function(_0x5c2338){try{if(this[_0x8469('0x24')](_0x5c2338)){if(this[_0x8469('0xb')][_0x5c2338[_0x8469('0x26')]]&&this['channels'][_0x5c2338[_0x8469('0x26')]][_0x5c2338[_0x8469('0x27')]]){this['channels'][_0x5c2338[_0x8469('0x26')]][_0x5c2338[_0x8469('0x27')]][_0x8469('0x13')]=!![];this['channels'][_0x5c2338[_0x8469('0x26')]][_0x5c2338['destuniqueid']][_0x8469('0x41')]=moment()[_0x8469('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8469('0xb')][_0x5c2338['uniqueid']][_0x5c2338[_0x8469('0x27')]][_0x8469('0x42')]=_0x8469('0x48');this['channels'][_0x5c2338[_0x8469('0x26')]][_0x5c2338[_0x8469('0x27')]][_0x8469('0x36')]=_0x8469('0x48');ami[_0x8469('0x23')](_0x8469('0x49'),this[_0x8469('0xb')][_0x5c2338[_0x8469('0x26')]][_0x5c2338[_0x8469('0x27')]]);}}}catch(_0x3c7591){logger['error'](_0x8469('0x4a'),util[_0x8469('0x47')](_0x3c7591,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x15')]=function(_0x48f36c){try{if(this[_0x8469('0x24')](_0x48f36c)){if(this[_0x8469('0xb')][_0x48f36c[_0x8469('0x26')]]){for(var _0xb38c52 in this[_0x8469('0xb')][_0x48f36c[_0x8469('0x26')]]){if(this[_0x8469('0xb')][_0x48f36c['uniqueid']][_0x8469('0x34')](_0xb38c52)&&!this[_0x8469('0xb')][_0x48f36c[_0x8469('0x26')]][_0xb38c52][_0x8469('0x13')]&&!this[_0x8469('0xb')][_0x48f36c[_0x8469('0x26')]][_0xb38c52][_0x8469('0x16')]){this[_0x8469('0xb')][_0x48f36c['uniqueid']][_0xb38c52]['agentringnoanswer']=!![];this[_0x8469('0xb')][_0x48f36c[_0x8469('0x26')]][_0xb38c52][_0x8469('0x41')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x48f36c[_0x8469('0x26')]][_0xb38c52]['reason']='abandoned';this['channels'][_0x48f36c[_0x8469('0x26')]][_0xb38c52]['lastevent']=_0x8469('0x4b');ami[_0x8469('0x23')](_0x8469('0x4c'),this['channels'][_0x48f36c['uniqueid']][_0xb38c52]);}}}}}catch(_0x2ae02a){logger[_0x8469('0x32')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x8469('0x47')](_0x2ae02a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8469('0x22')]['syncAgentComplete']=function(_0x688a25){try{if(this[_0x8469('0x24')](_0x688a25)){if(this['channels'][_0x688a25[_0x8469('0x26')]]){for(var _0x170539 in this[_0x8469('0xb')][_0x688a25['uniqueid']]){if(this[_0x8469('0xb')][_0x688a25[_0x8469('0x26')]]['hasOwnProperty'](_0x170539)){if(this[_0x8469('0xb')][_0x688a25[_0x8469('0x26')]][_0x170539][_0x8469('0x35')]&&!this[_0x8469('0xb')][_0x688a25['uniqueid']][_0x170539][_0x8469('0x16')]){this['channels'][_0x688a25[_0x8469('0x26')]][_0x170539][_0x8469('0x16')]=!![];this[_0x8469('0xb')][_0x688a25[_0x8469('0x26')]][_0x170539][_0x8469('0x4d')]=moment()[_0x8469('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8469('0xb')][_0x688a25[_0x8469('0x26')]][_0x170539][_0x8469('0x36')]=_0x8469('0x4e');this[_0x8469('0xb')][_0x688a25['uniqueid']][_0x170539]['talktime']=_0x688a25['talktime'];this['channels'][_0x688a25['uniqueid']][_0x170539]['reason']=_0x688a25[_0x8469('0x42')]==_0x8469('0x4f')?_0x8469('0x50'):_0x688a25[_0x8469('0x42')];if(this['voiceQueues'][_0x688a25[_0x8469('0x2b')]]&&this[_0x8469('0xc')][_0x688a25[_0x8469('0x2b')]]['acw']){this[_0x8469('0xb')][_0x688a25[_0x8469('0x26')]][_0x170539]['agentacw']=!![];this[_0x8469('0xb')][_0x688a25['uniqueid']][_0x170539][_0x8469('0x51')]=this[_0x8469('0xc')][_0x688a25[_0x8469('0x2b')]][_0x8469('0x52')];}this[_0x8469('0xd')][_0x688a25['interface']]=_[_0x8469('0x53')](this[_0x8469('0xd')][_0x688a25[_0x8469('0x3d')]],['queue','destconnectedlinenum']);this[_0x8469('0x23')](util[_0x8469('0x28')]('user:%s',_0x688a25[_0x8469('0x3f')]),_0x8469('0x54'),this['channels'][_0x688a25[_0x8469('0x26')]][_0x170539]);ami['emit'](_0x8469('0x55'),this[_0x8469('0xb')][_0x688a25['uniqueid']][_0x170539]);}}}}}}catch(_0x5ec369){logger['error'](_0x8469('0x56'),util['inspect'](_0x5ec369,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8469('0x57')]=function(_0x231b4a){try{if(this['isNotNull'](_0x231b4a)){this[_0x8469('0x58')](_0x231b4a[_0x8469('0x26')],_[_0x8469('0x59')](_0x231b4a[_0x8469('0x5a')])[0x0],_0x231b4a[_0x8469('0x5b')]);if(this[_0x8469('0xb')][_0x231b4a['uniqueid']]){for(var _0x23f7ff in this[_0x8469('0xb')][_0x231b4a[_0x8469('0x26')]]){if(this['channels'][_0x231b4a[_0x8469('0x26')]][_0x8469('0x34')](_0x23f7ff)){if(_[_0x8469('0x25')](this[_0x8469('0xb')][_0x231b4a[_0x8469('0x26')]][_0x23f7ff][_0x8469('0xe')])){this[_0x8469('0xb')][_0x231b4a['uniqueid']][_0x23f7ff]['variables']={};}this['channels'][_0x231b4a['uniqueid']][_0x23f7ff][_0x8469('0xe')]=this[_0x8469('0xe')][_0x231b4a[_0x8469('0x26')]];}}}}}catch(_0x493ede){logger['error']('[syncVarSet][VoiceAgentReport]',util['inspect'](_0x493ede,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x58')]=function(_0x25d6e0,_0x2d347b,_0x422703){var _0x211a96=[_0x8469('0x5c'),_0x8469('0x5d'),_0x8469('0x5e'),_0x8469('0x5f'),'rtpaudioqosloss',_0x8469('0x60'),_0x8469('0x61'),'rtpaudioqosrttbridged',_0x8469('0x62'),_0x8469('0x63'),'bridgepeer',_0x8469('0x64'),'membercalls',_0x8469('0x65'),_0x8469('0x66'),_0x8469('0x67'),'membername',_0x8469('0x68'),'memberrealtime'];if(!_[_0x8469('0x69')](_0x2d347b)&&!_[_0x8469('0x6a')](_0x211a96,_0x2d347b)){if(_[_0x8469('0x25')](this[_0x8469('0xe')][_0x25d6e0])){this[_0x8469('0xe')][_0x25d6e0]={};}this[_0x8469('0xe')][_0x25d6e0][_0x2d347b]=_0x422703;}};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x1a')]=function(_0x58f472){try{if(this[_0x8469('0x24')](_0x58f472)){if(this[_0x8469('0xb')][_0x58f472[_0x8469('0x26')]]){for(var _0x4986b2 in this[_0x8469('0xb')][_0x58f472[_0x8469('0x26')]]){if(this[_0x8469('0xb')][_0x58f472[_0x8469('0x26')]][_0x8469('0x34')](_0x4986b2)){if(this['channels'][_0x58f472[_0x8469('0x26')]][_0x4986b2][_0x8469('0x42')]==_0x8469('0x4f')&&this['channels'][_0x58f472['uniqueid']][_0x4986b2]['agentcomplete']){this[_0x8469('0xb')][_0x58f472[_0x8469('0x26')]][_0x4986b2]['agentcompleteAt']=moment()[_0x8469('0x28')](_0x8469('0x29'));}}}ami[_0x8469('0x23')](_0x8469('0x6b'),_[_0x8469('0x6c')](this['channels'][_0x58f472['uniqueid']]));delete this[_0x8469('0xb')][_0x58f472['uniqueid']];}if(this[_0x8469('0xe')][_0x58f472[_0x8469('0x26')]]){delete this[_0x8469('0xe')][_0x58f472['uniqueid']];}}}catch(_0x44727c){logger[_0x8469('0x32')]('[syncHangup][VoiceAgentReport]',util[_0x8469('0x47')](_0x44727c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x1f')]=function(_0x349d8a){try{if(this[_0x8469('0x24')](_0x349d8a)){if(this[_0x8469('0xb')][_0x349d8a[_0x8469('0x6d')]]){for(var _0x1efafa in this['channels'][_0x349d8a[_0x8469('0x6d')]]){if(this[_0x8469('0xb')][_0x349d8a['transfereeuniqueid']][_0x8469('0x34')](_0x1efafa)){if(_0x349d8a[_0x8469('0x6e')]===_0x1efafa){var _0x556f12=moment();this[_0x8469('0xb')][_0x349d8a[_0x8469('0x6d')]][_0x1efafa][_0x8469('0x16')]=!![];this[_0x8469('0xb')][_0x349d8a['transfereeuniqueid']][_0x1efafa]['agentcompleteAt']=moment()['format'](_0x8469('0x29'));this[_0x8469('0xb')][_0x349d8a[_0x8469('0x6d')]][_0x1efafa][_0x8469('0x42')]=_0x8469('0x4f');this[_0x8469('0xb')][_0x349d8a['transfereeuniqueid']][_0x1efafa][_0x8469('0x36')]=_0x8469('0x4e');this['channels'][_0x349d8a['transfereeuniqueid']][_0x1efafa][_0x8469('0x6f')]=_0x556f12[_0x8469('0x70')](this[_0x8469('0xb')][_0x349d8a[_0x8469('0x6d')]][_0x1efafa][_0x8469('0x35')],_0x8469('0x71'));}}}}if(this['channels'][_0x349d8a[_0x8469('0x72')]]){var _0x5a91e7=this[_0x8469('0xb')][_0x349d8a['secondtransfereruniqueid']];this[_0x8469('0xb')][_0x349d8a['secondtransfereruniqueid']]=this[_0x8469('0xb')][_0x349d8a[_0x8469('0x6d')]];this['channels'][_0x349d8a[_0x8469('0x6d')]]=_0x5a91e7;}}}catch(_0x1c6931){logger[_0x8469('0x32')](_0x8469('0x73'),util['inspect'](_0x1c6931,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x21')]=function(_0x1acd12){try{if(this['isNotNull'](_0x1acd12)){if(this[_0x8469('0xb')][_0x1acd12[_0x8469('0x6d')]]){for(var _0x14bbad in this['channels'][_0x1acd12[_0x8469('0x6d')]]){if(this[_0x8469('0xb')][_0x1acd12[_0x8469('0x6d')]][_0x8469('0x34')](_0x14bbad)){if(_0x1acd12[_0x8469('0x74')]===_0x14bbad){var _0x507551=moment();this['channels'][_0x1acd12['transfereeuniqueid']][_0x14bbad][_0x8469('0x16')]=!![];this[_0x8469('0xb')][_0x1acd12[_0x8469('0x6d')]][_0x14bbad][_0x8469('0x4d')]=_0x507551;this[_0x8469('0xb')][_0x1acd12['transfereeuniqueid']][_0x14bbad][_0x8469('0x42')]=_0x8469('0x4f');this['channels'][_0x1acd12['transfereeuniqueid']][_0x14bbad][_0x8469('0x36')]='complete';this['channels'][_0x1acd12['transfereeuniqueid']][_0x14bbad][_0x8469('0x6f')]=_0x507551[_0x8469('0x70')](this[_0x8469('0xb')][_0x1acd12['transfereeuniqueid']][_0x14bbad][_0x8469('0x35')],_0x8469('0x71'));}}}}}}catch(_0x562a48){logger[_0x8469('0x32')](_0x8469('0x75'),util[_0x8469('0x47')](_0x562a48,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x76')]=function(_0x474c81){var _0x40c87f='';try{if(this['isNotNull'](_0x474c81)){if(_0x474c81['channel']){_0x40c87f=_0x474c81[_0x8469('0x77')][_0x8469('0x78')](0x0,_0x474c81[_0x8469('0x77')][_0x8469('0x79')]('-'));if(this['agents'][_0x40c87f]){this[_0x8469('0xd')][_0x40c87f][_0x8469('0x7a')]=!![];}}}}catch(_0x152b31){logger[_0x8469('0x32')](_0x8469('0x7b'),util[_0x8469('0x47')](_0x152b31,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8469('0x22')][_0x8469('0x1d')]=function(_0x527159){var _0x480270='';try{if(this['isNotNull'](_0x527159)){if(_0x527159[_0x8469('0x77')]){_0x480270=_0x527159['channel'][_0x8469('0x78')](0x0,_0x527159[_0x8469('0x77')][_0x8469('0x79')]('-'));if(this[_0x8469('0xd')][_0x480270]){this[_0x8469('0xd')][_0x480270]['onhold']=![];}}}}catch(_0x342fd8){logger[_0x8469('0x32')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x8469('0x47')](_0x342fd8,{'showHidden':![],'depth':null}));}};module[_0x8469('0x7c')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 919dc76..3bc4dce 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 _0x0c48=['emit','uniqueid','merge','pick','keys','error','inspect','linkedid','channel','OutgoingSpoolFailed','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','exten','format','user:%s','name','user:agentconnect','[syncNewChannel][VoiceCallReport]','application','applicationdata','appdata','toLowerCase','duration','seconds','disposition','cdr(','match','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','starttime','calleridnum','xcally-motion-preview','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','replace','monitors','isNil','push','syncVarSet','variable','mixmonitor_filename','value','callerid','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcalluniqueid','parse','sipcalllinkedid','syncHangup','billableseconds','answertime','omit','user:agentcomplete','accountcode','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','transfereecalleridnum','BlindTransfer','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','milliseconds','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','newexten','bind','syncNewChannel','newstate','syncNewState','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','catch','log','prototype','isNotNull','isUndefined'];(function(_0x38f248,_0x17113e){var _0x5dd9b5=function(_0x48aad7){while(--_0x48aad7){_0x38f248['push'](_0x38f248['shift']());}};_0x5dd9b5(++_0x17113e);}(_0x0c48,0xed));var _0x80c4=function(_0x510f93,_0x5c1bbc){_0x510f93=_0x510f93-0x0;var _0x2536e4=_0x0c48[_0x510f93];return _0x2536e4;};'use strict';var BPromise=require(_0x80c4('0x0'));var _=require(_0x80c4('0x1'));var moment=require(_0x80c4('0x2'));var util=require(_0x80c4('0x3'));var path=require(_0x80c4('0x4'));var Redis=require(_0x80c4('0x5'));var config=require(_0x80c4('0x6'));var logger=require(_0x80c4('0x7'))(_0x80c4('0x8'));var ami=require(_0x80c4('0x9'));var Channel=require(_0x80c4('0xa'));var statusDesc=[_0x80c4('0xb'),_0x80c4('0xc'),_0x80c4('0xd'),_0x80c4('0xe'),_0x80c4('0xf'),'unavailable',_0x80c4('0x10'),_0x80c4('0x11'),_0x80c4('0x12')];var applications=[_0x80c4('0x13'),_0x80c4('0x14'),_0x80c4('0x15'),_0x80c4('0x16'),_0x80c4('0x17'),_0x80c4('0x18')];var dispositions=['NO\x20ANSWER','FAILED',_0x80c4('0x19'),'NO\x20ANSWER',_0x80c4('0x1a'),_0x80c4('0x1a'),_0x80c4('0x1b'),_0x80c4('0x1c'),_0x80c4('0x19'),'FAILED',_0x80c4('0x19')];var actions={};config[_0x80c4('0x1d')]=_[_0x80c4('0x1e')](config[_0x80c4('0x1d')],{'host':'localhost','port':0x18eb});var io=require(_0x80c4('0x1f'))(new Redis(config[_0x80c4('0x1d')]));function VoiceCallReport(_0x47f108){this[_0x80c4('0x20')]=_0x47f108[_0x80c4('0x20')];this['agents']=_0x47f108[_0x80c4('0x21')];ami['on'](_0x80c4('0x22'),this[_0x80c4('0x23')]['bind'](this));ami['on'](_0x80c4('0x24'),this[_0x80c4('0x23')][_0x80c4('0x25')](this));ami['on']('newchannel',this[_0x80c4('0x26')]['bind'](this));ami['on'](_0x80c4('0x27'),this[_0x80c4('0x28')][_0x80c4('0x25')](this));ami['on']('varset',this['syncVarSet'][_0x80c4('0x25')](this));ami['on'](_0x80c4('0x29'),this['syncHangup'][_0x80c4('0x25')](this));ami['on'](_0x80c4('0x2a'),this[_0x80c4('0x2b')][_0x80c4('0x25')](this));ami['on'](_0x80c4('0x2c'),this[_0x80c4('0x2d')][_0x80c4('0x25')](this));ami['on'](_0x80c4('0x2e'),this['syncBlindTransfer'][_0x80c4('0x25')](this));ami['on'](_0x80c4('0x2f'),this[_0x80c4('0x30')][_0x80c4('0x25')](this));ami['on'](_0x80c4('0x31'),this[_0x80c4('0x32')][_0x80c4('0x25')](this));return BPromise['resolve']()[_0x80c4('0x33')](ami['actionCoreShowChannels']())[_0x80c4('0x34')](function(_0x5b9bd){console[_0x80c4('0x35')](_0x5b9bd);});}VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x37')]=function(_0x132aee){return _0x132aee!==null&&!_[_0x80c4('0x38')](_0x132aee);};VoiceCallReport[_0x80c4('0x36')]['emit']=function(_0x76b610,_0x4bc391,_0x306aec){io['to'](_0x76b610)[_0x80c4('0x39')](_0x4bc391,_0x306aec);};VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x2b')]=function(_0x3c084b){try{if(this[_0x80c4('0x37')](_0x3c084b)){if(_0x3c084b[_0x80c4('0x3a')]===_0x3c084b['linkedid']){if(!_['isUndefined'](this[_0x80c4('0x20')][_0x3c084b['uniqueid']])){_[_0x80c4('0x3b')](this[_0x80c4('0x20')][_0x3c084b[_0x80c4('0x3a')]],_[_0x80c4('0x3c')](_0x3c084b,_[_0x80c4('0x3d')](this[_0x80c4('0x20')][_0x3c084b['uniqueid']])));}}}}catch(_0x1aedfd){logger[_0x80c4('0x3e')]('[syncNewCallerId][VoiceCallReport]',util[_0x80c4('0x3f')](_0x1aedfd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x26')]=function(_0x1a4cc){try{if(this[_0x80c4('0x37')](_0x1a4cc)){if(_0x1a4cc[_0x80c4('0x3a')]===_0x1a4cc[_0x80c4('0x40')]&&_0x1a4cc[_0x80c4('0x41')]!=_0x80c4('0x42')){if(_[_0x80c4('0x38')](this['channels'][_0x1a4cc[_0x80c4('0x3a')]])){this['channels'][_0x1a4cc[_0x80c4('0x3a')]]=new Channel();this[_0x80c4('0x20')][_0x1a4cc[_0x80c4('0x3a')]]['starttime']=moment()['format'](_0x80c4('0x43'));this['channels'][_0x1a4cc[_0x80c4('0x3a')]]['disposition']=dispositions[_[_0x80c4('0x44')](_0x1a4cc[_0x80c4('0x45')])];_[_0x80c4('0x3b')](this[_0x80c4('0x20')][_0x1a4cc[_0x80c4('0x3a')]],_[_0x80c4('0x3c')](_0x1a4cc,_[_0x80c4('0x3d')](this[_0x80c4('0x20')][_0x1a4cc['uniqueid']])));if(_0x1a4cc[_0x80c4('0x46')]===_0x80c4('0x47')){if(this[_0x80c4('0x21')][_0x1a4cc[_0x80c4('0x41')][_0x80c4('0x48')]('-')[0x0]]){this[_0x80c4('0x21')][_0x1a4cc[_0x80c4('0x41')][_0x80c4('0x48')]('-')[0x0]][_0x80c4('0x49')]=_0x1a4cc[_0x80c4('0x4a')];this[_0x80c4('0x39')](util[_0x80c4('0x4b')](_0x80c4('0x4c'),this['agents'][_0x1a4cc[_0x80c4('0x41')][_0x80c4('0x48')]('-')[0x0]][_0x80c4('0x4d')]),_0x80c4('0x4e'),{'destaccountcode':this[_0x80c4('0x21')][_0x1a4cc[_0x80c4('0x41')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1a4cc[_0x80c4('0x4a')]});}}}}}}catch(_0x570104){logger['error'](_0x80c4('0x4f'),util[_0x80c4('0x3f')](_0x570104,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x23')]=function(_0x35323f){try{if(this[_0x80c4('0x37')](_0x35323f)){if(_0x35323f[_0x80c4('0x3a')]===_0x35323f[_0x80c4('0x40')]&&_0x35323f[_0x80c4('0x4a')]!='h'&&_0x35323f[_0x80c4('0x41')]!=_0x80c4('0x42')){_0x35323f['application']=_0x35323f[_0x80c4('0x50')]['toLowerCase']();_0x35323f[_0x80c4('0x51')]=(_0x35323f[_0x80c4('0x52')]||_0x35323f[_0x80c4('0x51')])[_0x80c4('0x53')]();if(_[_0x80c4('0x38')](this[_0x80c4('0x20')][_0x35323f[_0x80c4('0x3a')]])){this[_0x80c4('0x20')][_0x35323f['uniqueid']]=new Channel();this[_0x80c4('0x20')][_0x35323f['uniqueid']]['starttime']=_0x35323f[_0x80c4('0x54')]?moment()['subtract'](moment['duration'](_0x35323f[_0x80c4('0x54')])[_0x80c4('0x55')](),'seconds')[_0x80c4('0x4b')](_0x80c4('0x43')):moment()[_0x80c4('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x80c4('0x20')][_0x35323f['uniqueid']][_0x80c4('0x56')]=_0x80c4('0x1a');}_['merge'](this['channels'][_0x35323f[_0x80c4('0x3a')]],_['pick'](_0x35323f,_[_0x80c4('0x3d')](this['channels'][_0x35323f['uniqueid']])));if(_['includes'](applications,_0x35323f['application'])){this[_0x80c4('0x20')][_0x35323f['uniqueid']]['lastapplication']=_0x35323f[_0x80c4('0x50')];this[_0x80c4('0x20')][_0x35323f['uniqueid']]['lastdata']=_0x35323f[_0x80c4('0x51')];if(_0x35323f[_0x80c4('0x50')]===_0x80c4('0x13')&&_['startsWith'](_0x35323f['applicationdata'],_0x80c4('0x57'))){var _0x12bb24=_0x35323f[_0x80c4('0x51')][_0x80c4('0x48')]('=');var _0x37bf30=_0x12bb24[0x0][_0x80c4('0x58')](/cdr\((.*)\)/);if(_0x37bf30){this[_0x80c4('0x20')][_0x35323f[_0x80c4('0x3a')]][_0x37bf30[0x1]]=_0x12bb24[0x1];}}else if(_0x35323f[_0x80c4('0x50')]===_0x80c4('0x14')){this[_0x80c4('0x20')][_0x35323f[_0x80c4('0x3a')]][_0x80c4('0x14')]=_0x35323f['applicationdata'][_0x80c4('0x48')](',')[0x0];}}}}}catch(_0x32af07){logger[_0x80c4('0x3e')](_0x80c4('0x59'),util[_0x80c4('0x3f')](_0x32af07,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x28')]=function(_0x2347cc){try{if(this[_0x80c4('0x37')](_0x2347cc)){if(_0x2347cc[_0x80c4('0x3a')]!==_0x2347cc[_0x80c4('0x40')]){if(this['channels'][_0x2347cc['linkedid']]){if(_0x2347cc[_0x80c4('0x45')]==='6'){if(!this[_0x80c4('0x20')][_0x2347cc['linkedid']]['answered']){var _0x1094d2=moment();this[_0x80c4('0x20')][_0x2347cc[_0x80c4('0x40')]][_0x80c4('0x5a')]=!![];this[_0x80c4('0x20')][_0x2347cc[_0x80c4('0x40')]]['answertime']=_0x1094d2[_0x80c4('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x80c4('0x20')][_0x2347cc[_0x80c4('0x40')]]['starttime']){this[_0x80c4('0x20')][_0x2347cc[_0x80c4('0x40')]][_0x80c4('0x5b')]=_0x1094d2[_0x80c4('0x5c')](this[_0x80c4('0x20')][_0x2347cc['linkedid']][_0x80c4('0x5d')],_0x80c4('0x55'));}}this[_0x80c4('0x20')][_0x2347cc[_0x80c4('0x40')]][_0x80c4('0x40')]=_0x2347cc[_0x80c4('0x3a')];if(_0x2347cc[_0x80c4('0x5e')]!==_0x80c4('0x5f')){this[_0x80c4('0x20')][_0x2347cc[_0x80c4('0x40')]]['connectedlinenum']=_0x2347cc['calleridnum'];}this[_0x80c4('0x20')][_0x2347cc[_0x80c4('0x40')]]['connectedlinename']=_0x2347cc['calleridname'];this[_0x80c4('0x20')][_0x2347cc[_0x80c4('0x40')]][_0x80c4('0x60')]=_0x2347cc[_0x80c4('0x41')];this[_0x80c4('0x20')][_0x2347cc[_0x80c4('0x40')]]['disposition']=dispositions[_['toNumber'](_0x2347cc['channelstate'])];if(this[_0x80c4('0x21')][_0x2347cc[_0x80c4('0x41')]['split']('-')[0x0]]){this['channels'][_0x2347cc[_0x80c4('0x40')]][_0x80c4('0x61')]=this[_0x80c4('0x21')][_0x2347cc['channel'][_0x80c4('0x48')]('-')[0x0]]['id'];this['channels'][_0x2347cc['linkedid']]['membername']=this[_0x80c4('0x21')][_0x2347cc[_0x80c4('0x41')]['split']('-')[0x0]][_0x80c4('0x4d')];}}}}else{if(this['channels'][_0x2347cc['uniqueid']]){if(_0x2347cc[_0x80c4('0x45')]==='6'){if(this[_0x80c4('0x21')][_0x2347cc['channel'][_0x80c4('0x48')]('-')[0x0]]){this['channels'][_0x2347cc[_0x80c4('0x3a')]][_0x80c4('0x61')]=this[_0x80c4('0x21')][_0x2347cc[_0x80c4('0x41')][_0x80c4('0x48')]('-')[0x0]]['id'];this['channels'][_0x2347cc[_0x80c4('0x3a')]][_0x80c4('0x62')]=this[_0x80c4('0x21')][_0x2347cc['channel'][_0x80c4('0x48')]('-')[0x0]][_0x80c4('0x4d')];}}}}}}catch(_0xba662f){logger[_0x80c4('0x3e')](_0x80c4('0x63'),util[_0x80c4('0x3f')](_0xba662f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x80c4('0x64')]=function(_0x53e9e4,_0x2465c0){if(this['channels'][_0x53e9e4]){this['channels'][_0x53e9e4][_0x80c4('0x65')]=!![];if(_['endsWith'](_0x2465c0,'.wav49')){_0x2465c0=_0x2465c0[_0x80c4('0x66')]('.wav49','.WAV');}this[_0x80c4('0x20')][_0x53e9e4]['monitorFilename']=_0x2465c0;var _0x8a84d3=_['find'](this[_0x80c4('0x20')][_0x53e9e4][_0x80c4('0x67')],{'filename':_0x2465c0});if(_[_0x80c4('0x68')](_0x8a84d3)){this[_0x80c4('0x20')][_0x53e9e4][_0x80c4('0x67')][_0x80c4('0x69')]({'filename':_0x2465c0,'createdAt':moment()[_0x80c4('0x4b')](_0x80c4('0x43')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x6a')]=function(_0xc63293){try{if(this[_0x80c4('0x37')](_0xc63293)){if(this[_0x80c4('0x20')][_0xc63293['uniqueid']]&&_0xc63293[_0x80c4('0x41')]!=_0x80c4('0x42')){if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')])){if(this[_0x80c4('0x37')](_0xc63293['variable'][_0x80c4('0x6c')])){this[_0x80c4('0x64')](_0xc63293['uniqueid'],_0xc63293[_0x80c4('0x6d')]);}else if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')]['xmd-phone'])){this['channels'][_0xc63293[_0x80c4('0x3a')]][_0x80c4('0x5e')]=_0xc63293['value'];}else if(this['isNotNull'](_0xc63293[_0x80c4('0x6b')]['xmd-callerid'])){this['channels'][_0xc63293[_0x80c4('0x3a')]][_0x80c4('0x6e')]=_0xc63293[_0x80c4('0x6d')];}else if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')]['xmd-cdrtype'])){this[_0x80c4('0x20')][_0xc63293[_0x80c4('0x3a')]][_0x80c4('0x6f')]=_0xc63293[_0x80c4('0x6d')];}else if(this[_0x80c4('0x37')](_0xc63293['variable'][_0x80c4('0x70')])){this[_0x80c4('0x20')][_0xc63293['uniqueid']][_0x80c4('0x14')]=_0xc63293[_0x80c4('0x6d')][_0x80c4('0x48')](',')[0x0];}else if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')][_0x80c4('0x71')])){this[_0x80c4('0x20')][_0xc63293[_0x80c4('0x3a')]][_0x80c4('0x72')]=_0xc63293['value'];}else if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')]['xmd-destination'])){this['channels'][_0xc63293['uniqueid']][_0x80c4('0x73')]=_0xc63293[_0x80c4('0x6d')];}else if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')][_0x80c4('0x74')])){this['channels'][_0xc63293['uniqueid']][_0x80c4('0x75')]=_0xc63293[_0x80c4('0x6d')];}else if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')][_0x80c4('0x76')])){this[_0x80c4('0x20')][_0xc63293[_0x80c4('0x3a')]][_0x80c4('0x14')]=_0xc63293[_0x80c4('0x6d')];}else if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')]['sipcallid'])){this[_0x80c4('0x20')][_0xc63293[_0x80c4('0x3a')]][_0x80c4('0x77')]=_0xc63293['value'];}}}else if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')][_0x80c4('0x6c')])){if(_0xc63293[_0x80c4('0x6d')]){var _0x151622=path[_0x80c4('0x78')](_0xc63293[_0x80c4('0x6d')])[_0x80c4('0x4d')];this[_0x80c4('0x64')](_0x151622,_0xc63293[_0x80c4('0x6d')]);}}else if(this[_0x80c4('0x20')][_0xc63293[_0x80c4('0x40')]]){if(this['isNotNull'](_0xc63293[_0x80c4('0x6b')])){if(this[_0x80c4('0x37')](_0xc63293[_0x80c4('0x6b')]['sipcallid'])){this[_0x80c4('0x20')][_0xc63293['linkedid']][_0x80c4('0x79')]=_0xc63293[_0x80c4('0x6d')];}}}}}catch(_0x5567d2){logger['error']('[syncVarSet][VoiceCallReport]',util[_0x80c4('0x3f')](_0x5567d2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x80c4('0x7a')]=function(_0x9ac6ba){try{if(this['isNotNull'](_0x9ac6ba)){if(this[_0x80c4('0x20')][_0x9ac6ba['uniqueid']]){var _0x572325=moment();this[_0x80c4('0x20')][_0x9ac6ba[_0x80c4('0x3a')]]['endtime']=_0x572325[_0x80c4('0x4b')](_0x80c4('0x43'));this[_0x80c4('0x20')][_0x9ac6ba[_0x80c4('0x3a')]][_0x80c4('0x54')]=_0x572325[_0x80c4('0x5c')](this[_0x80c4('0x20')][_0x9ac6ba[_0x80c4('0x3a')]][_0x80c4('0x5d')],_0x80c4('0x55'));if(this['channels'][_0x9ac6ba[_0x80c4('0x3a')]][_0x80c4('0x5a')]){this[_0x80c4('0x20')][_0x9ac6ba[_0x80c4('0x3a')]][_0x80c4('0x7b')]=_0x572325[_0x80c4('0x5c')](this[_0x80c4('0x20')][_0x9ac6ba[_0x80c4('0x3a')]][_0x80c4('0x7c')],_0x80c4('0x55'));this[_0x80c4('0x20')][_0x9ac6ba[_0x80c4('0x3a')]][_0x80c4('0x5b')]=this[_0x80c4('0x20')][_0x9ac6ba[_0x80c4('0x3a')]][_0x80c4('0x54')]-this['channels'][_0x9ac6ba[_0x80c4('0x3a')]][_0x80c4('0x7b')];}if(_0x9ac6ba[_0x80c4('0x46')]===_0x80c4('0x47')){if(this[_0x80c4('0x21')][_0x9ac6ba['channel'][_0x80c4('0x48')]('-')[0x0]]){this[_0x80c4('0x21')][_0x9ac6ba[_0x80c4('0x41')][_0x80c4('0x48')]('-')[0x0]]=_[_0x80c4('0x7d')](this[_0x80c4('0x21')][_0x9ac6ba[_0x80c4('0x41')][_0x80c4('0x48')]('-')[0x0]],[_0x80c4('0x49')]);this[_0x80c4('0x39')](util[_0x80c4('0x4b')](_0x80c4('0x4c'),this[_0x80c4('0x21')][_0x9ac6ba[_0x80c4('0x41')][_0x80c4('0x48')]('-')[0x0]][_0x80c4('0x4d')]),_0x80c4('0x7e'),{'destaccountcode':this[_0x80c4('0x21')][_0x9ac6ba[_0x80c4('0x41')]['split']('-')[0x0]][_0x80c4('0x7f')]});}}ami[_0x80c4('0x39')](_0x80c4('0x80'),this['channels'][_0x9ac6ba[_0x80c4('0x3a')]]);delete this[_0x80c4('0x20')][_0x9ac6ba[_0x80c4('0x3a')]];}}}catch(_0x5e5a5e){logger[_0x80c4('0x3e')](_0x80c4('0x81'),util[_0x80c4('0x3f')](_0x5e5a5e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x2d')]=function(_0x157b98){try{if(this[_0x80c4('0x37')](_0x157b98)){if(this[_0x80c4('0x20')][_0x157b98[_0x80c4('0x82')]]){this[_0x80c4('0x20')][_0x157b98['transfereeuniqueid']][_0x80c4('0x83')]=_0x157b98[_0x80c4('0x84')];this[_0x80c4('0x20')][_0x157b98[_0x80c4('0x82')]][_0x80c4('0x85')]=_0x157b98[_0x80c4('0x86')];if(this[_0x80c4('0x20')][_0x157b98[_0x80c4('0x87')]]){var _0x28a074=this[_0x80c4('0x20')][_0x157b98['secondtransfereruniqueid']];this[_0x80c4('0x20')][_0x157b98['secondtransfereruniqueid']]=this[_0x80c4('0x20')][_0x157b98['transfereeuniqueid']];this['channels'][_0x157b98[_0x80c4('0x82')]]=_0x28a074;}}else if(this[_0x80c4('0x20')][_0x157b98[_0x80c4('0x88')]]){this[_0x80c4('0x20')][_0x157b98[_0x80c4('0x88')]][_0x80c4('0x83')]=_0x157b98[_0x80c4('0x84')];this[_0x80c4('0x20')][_0x157b98['transfertargetuniqueid']][_0x80c4('0x85')]=_0x157b98[_0x80c4('0x86')];if(this[_0x80c4('0x20')][_0x157b98['origtransfereruniqueid']]){var _0x28a074=this[_0x80c4('0x20')][_0x157b98[_0x80c4('0x89')]];this[_0x80c4('0x20')][_0x157b98['origtransfereruniqueid']]=this[_0x80c4('0x20')][_0x157b98[_0x80c4('0x88')]];this[_0x80c4('0x20')][_0x157b98[_0x80c4('0x88')]]=_0x28a074;}}}}catch(_0x2c5aa9){logger['error'](_0x80c4('0x8a'),util[_0x80c4('0x3f')](_0x2c5aa9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x8b')]=function(_0x2839d4){try{if(this[_0x80c4('0x37')](_0x2839d4)){if(this[_0x80c4('0x20')][_0x2839d4[_0x80c4('0x82')]]){this[_0x80c4('0x20')][_0x2839d4['transfereeuniqueid']][_0x80c4('0x83')]=_0x2839d4[_0x80c4('0x8c')];this[_0x80c4('0x20')][_0x2839d4[_0x80c4('0x82')]]['transferconnectedlinenum']=_0x2839d4['extension'];this[_0x80c4('0x7a')]({'event':_0x80c4('0x8d'),'uniqueid':_0x2839d4[_0x80c4('0x82')],'context':_0x2839d4[_0x80c4('0x46')],'channel':_0x2839d4['transfererchannel']});}}}catch(_0x3bbfb9){logger[_0x80c4('0x3e')]('[syncBlindTransfer][VoiceCallReport]',util[_0x80c4('0x3f')](_0x3bbfb9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x30')]=function(_0x142b6d){try{if(this['isNotNull'](_0x142b6d)){if(this[_0x80c4('0x20')][_0x142b6d[_0x80c4('0x3a')]]){if(!_[_0x80c4('0x68')](this['channels'][_0x142b6d[_0x80c4('0x3a')]]['answertime'])){this[_0x80c4('0x20')][_0x142b6d[_0x80c4('0x3a')]]['mohstarttime']=moment()[_0x80c4('0x4b')](_0x80c4('0x43'));}}}}catch(_0x1fe627){logger['error'](_0x80c4('0x8e'),util[_0x80c4('0x3f')](_0x1fe627,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80c4('0x36')][_0x80c4('0x32')]=function(_0xc0a432){try{if(this[_0x80c4('0x37')](_0xc0a432)){if(this['channels'][_0xc0a432[_0x80c4('0x3a')]]){if(!_['isNil'](this[_0x80c4('0x20')][_0xc0a432[_0x80c4('0x3a')]][_0x80c4('0x8f')])){this[_0x80c4('0x20')][_0xc0a432['uniqueid']][_0x80c4('0x90')]+=moment()[_0x80c4('0x91')](0x0)[_0x80c4('0x5c')](this['channels'][_0xc0a432[_0x80c4('0x3a')]]['mohstarttime'],_0x80c4('0x55'));delete this[_0x80c4('0x20')][_0xc0a432[_0x80c4('0x3a')]][_0x80c4('0x8f')];}}}}catch(_0x811a3a){logger['error']('[syncMusicOnHoldStop][VoiceCallReport]',util['inspect'](_0x811a3a,{'showHidden':![],'depth':null}));}};module[_0x80c4('0x92')]=VoiceCallReport; \ No newline at end of file +var _0xc19f=['value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','originatecalleridnum','xmd-destination','xmd-callerid-preview','calleridpreview','xmcs-queue','parse','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','syncHangup','endtime','diff','answertime','billableseconds','context','destconnectedlinenum','user:agentcomplete','custom:voiceCallReport','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','mohstarttime','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','unavailable','ringing','onhold','queue','agi','dial','playback','NO\x20ANSWER','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','syncNewState','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','actionCoreShowChannels','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','starttime','format','disposition','toNumber','channelstate','pick','from-sip','split','exten','user:%s','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','applicationdata','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','holdtime','calleridnum','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','variable','mixmonitor_filename'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0xc19f,0xbc));var _0xfc19=function(_0x1573d9,_0x3c39b4){_0x1573d9=_0x1573d9-0x0;var _0x5bd6af=_0xc19f[_0x1573d9];return _0x5bd6af;};'use strict';var BPromise=require(_0xfc19('0x0'));var _=require('lodash');var moment=require(_0xfc19('0x1'));var util=require(_0xfc19('0x2'));var path=require(_0xfc19('0x3'));var Redis=require(_0xfc19('0x4'));var config=require(_0xfc19('0x5'));var logger=require(_0xfc19('0x6'))(_0xfc19('0x7'));var ami=require(_0xfc19('0x8'));var Channel=require(_0xfc19('0x9'));var statusDesc=[_0xfc19('0xa'),_0xfc19('0xb'),_0xfc19('0xc'),_0xfc19('0xd'),'invalid',_0xfc19('0xe'),_0xfc19('0xf'),'ringinuse',_0xfc19('0x10')];var applications=['set',_0xfc19('0x11'),_0xfc19('0x12'),_0xfc19('0x13'),_0xfc19('0x14'),'voicemail'];var dispositions=[_0xfc19('0x15'),'FAILED',_0xfc19('0x16'),'NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER','ANSWERED','BUSY',_0xfc19('0x16'),_0xfc19('0x16'),_0xfc19('0x16')];var actions={};config[_0xfc19('0x17')]=_[_0xfc19('0x18')](config['redis'],{'host':_0xfc19('0x19'),'port':0x18eb});var io=require(_0xfc19('0x1a'))(new Redis(config['redis']));function VoiceCallReport(_0x20f708){this[_0xfc19('0x1b')]=_0x20f708['channels'];this['agents']=_0x20f708[_0xfc19('0x1c')];ami['on'](_0xfc19('0x1d'),this['syncNewExten'][_0xfc19('0x1e')](this));ami['on'](_0xfc19('0x1f'),this[_0xfc19('0x20')]['bind'](this));ami['on'](_0xfc19('0x21'),this[_0xfc19('0x22')]['bind'](this));ami['on']('newstate',this[_0xfc19('0x23')][_0xfc19('0x1e')](this));ami['on']('varset',this[_0xfc19('0x24')][_0xfc19('0x1e')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xfc19('0x25'),this[_0xfc19('0x26')][_0xfc19('0x1e')](this));ami['on'](_0xfc19('0x27'),this[_0xfc19('0x28')][_0xfc19('0x1e')](this));ami['on'](_0xfc19('0x29'),this[_0xfc19('0x2a')][_0xfc19('0x1e')](this));ami['on'](_0xfc19('0x2b'),this[_0xfc19('0x2c')][_0xfc19('0x1e')](this));ami['on'](_0xfc19('0x2d'),this[_0xfc19('0x2e')][_0xfc19('0x1e')](this));return BPromise['resolve']()['then'](ami[_0xfc19('0x2f')]())['catch'](function(_0xa7172b){console[_0xfc19('0x30')](_0xa7172b);});}VoiceCallReport[_0xfc19('0x31')][_0xfc19('0x32')]=function(_0x1ece6d){return _0x1ece6d!==null&&!_[_0xfc19('0x33')](_0x1ece6d);};VoiceCallReport[_0xfc19('0x31')]['emit']=function(_0x2f359e,_0x63063c,_0x462fd8){io['to'](_0x2f359e)[_0xfc19('0x34')](_0x63063c,_0x462fd8);};VoiceCallReport[_0xfc19('0x31')]['syncNewCallerId']=function(_0x16c07c){try{if(this[_0xfc19('0x32')](_0x16c07c)){if(_0x16c07c[_0xfc19('0x35')]===_0x16c07c[_0xfc19('0x36')]){if(!_[_0xfc19('0x33')](this[_0xfc19('0x1b')][_0x16c07c['uniqueid']])){_[_0xfc19('0x37')](this['channels'][_0x16c07c['uniqueid']],_['pick'](_0x16c07c,_[_0xfc19('0x38')](this[_0xfc19('0x1b')][_0x16c07c[_0xfc19('0x35')]])));}}}}catch(_0x5a9829){logger[_0xfc19('0x39')](_0xfc19('0x3a'),util[_0xfc19('0x3b')](_0x5a9829,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfc19('0x31')][_0xfc19('0x22')]=function(_0x2a4bc6){try{if(this[_0xfc19('0x32')](_0x2a4bc6)){if(_0x2a4bc6['uniqueid']===_0x2a4bc6[_0xfc19('0x36')]&&_0x2a4bc6[_0xfc19('0x3c')]!=_0xfc19('0x3d')){if(_[_0xfc19('0x33')](this[_0xfc19('0x1b')][_0x2a4bc6['uniqueid']])){this['channels'][_0x2a4bc6['uniqueid']]=new Channel();this[_0xfc19('0x1b')][_0x2a4bc6[_0xfc19('0x35')]][_0xfc19('0x3e')]=moment()[_0xfc19('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2a4bc6[_0xfc19('0x35')]][_0xfc19('0x40')]=dispositions[_[_0xfc19('0x41')](_0x2a4bc6[_0xfc19('0x42')])];_[_0xfc19('0x37')](this[_0xfc19('0x1b')][_0x2a4bc6[_0xfc19('0x35')]],_[_0xfc19('0x43')](_0x2a4bc6,_[_0xfc19('0x38')](this[_0xfc19('0x1b')][_0x2a4bc6[_0xfc19('0x35')]])));if(_0x2a4bc6['context']===_0xfc19('0x44')){if(this[_0xfc19('0x1c')][_0x2a4bc6[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]]){this[_0xfc19('0x1c')][_0x2a4bc6[_0xfc19('0x3c')]['split']('-')[0x0]]['destconnectedlinenum']=_0x2a4bc6[_0xfc19('0x46')];this['emit'](util[_0xfc19('0x3f')](_0xfc19('0x47'),this['agents'][_0x2a4bc6[_0xfc19('0x3c')]['split']('-')[0x0]][_0xfc19('0x48')]),_0xfc19('0x49'),{'destaccountcode':this[_0xfc19('0x1c')][_0x2a4bc6[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]][_0xfc19('0x4a')],'destconnectedlinenum':_0x2a4bc6[_0xfc19('0x46')]});}}}}}}catch(_0x118e50){logger[_0xfc19('0x39')](_0xfc19('0x4b'),util[_0xfc19('0x3b')](_0x118e50,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfc19('0x20')]=function(_0x3b44d5){try{if(this[_0xfc19('0x32')](_0x3b44d5)){if(_0x3b44d5[_0xfc19('0x35')]===_0x3b44d5[_0xfc19('0x36')]&&_0x3b44d5[_0xfc19('0x46')]!='h'&&_0x3b44d5['channel']!=_0xfc19('0x3d')){_0x3b44d5[_0xfc19('0x4c')]=_0x3b44d5[_0xfc19('0x4c')][_0xfc19('0x4d')]();_0x3b44d5['applicationdata']=(_0x3b44d5[_0xfc19('0x4e')]||_0x3b44d5[_0xfc19('0x4f')])['toLowerCase']();if(_['isUndefined'](this[_0xfc19('0x1b')][_0x3b44d5['uniqueid']])){this[_0xfc19('0x1b')][_0x3b44d5[_0xfc19('0x35')]]=new Channel();this[_0xfc19('0x1b')][_0x3b44d5[_0xfc19('0x35')]][_0xfc19('0x3e')]=_0x3b44d5['duration']?moment()[_0xfc19('0x50')](moment[_0xfc19('0x51')](_0x3b44d5[_0xfc19('0x51')])[_0xfc19('0x52')](),_0xfc19('0x52'))[_0xfc19('0x3f')](_0xfc19('0x53')):moment()[_0xfc19('0x3f')](_0xfc19('0x53'));this[_0xfc19('0x1b')][_0x3b44d5['uniqueid']][_0xfc19('0x40')]=_0xfc19('0x15');}_[_0xfc19('0x37')](this[_0xfc19('0x1b')][_0x3b44d5[_0xfc19('0x35')]],_[_0xfc19('0x43')](_0x3b44d5,_[_0xfc19('0x38')](this['channels'][_0x3b44d5[_0xfc19('0x35')]])));if(_['includes'](applications,_0x3b44d5[_0xfc19('0x4c')])){this[_0xfc19('0x1b')][_0x3b44d5[_0xfc19('0x35')]]['lastapplication']=_0x3b44d5[_0xfc19('0x4c')];this[_0xfc19('0x1b')][_0x3b44d5['uniqueid']]['lastdata']=_0x3b44d5[_0xfc19('0x4f')];if(_0x3b44d5[_0xfc19('0x4c')]==='set'&&_[_0xfc19('0x54')](_0x3b44d5[_0xfc19('0x4f')],_0xfc19('0x55'))){var _0x59513e=_0x3b44d5[_0xfc19('0x4f')][_0xfc19('0x45')]('=');var _0x5bd99e=_0x59513e[0x0][_0xfc19('0x56')](/cdr\((.*)\)/);if(_0x5bd99e){this[_0xfc19('0x1b')][_0x3b44d5[_0xfc19('0x35')]][_0x5bd99e[0x1]]=_0x59513e[0x1];}}else if(_0x3b44d5[_0xfc19('0x4c')]===_0xfc19('0x11')){this['channels'][_0x3b44d5[_0xfc19('0x35')]]['queue']=_0x3b44d5[_0xfc19('0x4f')][_0xfc19('0x45')](',')[0x0];}}}}}catch(_0x2e59d4){logger[_0xfc19('0x39')](_0xfc19('0x57'),util['inspect'](_0x2e59d4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfc19('0x31')][_0xfc19('0x23')]=function(_0x599e47){try{if(this[_0xfc19('0x32')](_0x599e47)){if(_0x599e47[_0xfc19('0x35')]!==_0x599e47[_0xfc19('0x36')]){if(this['channels'][_0x599e47['linkedid']]){if(_0x599e47[_0xfc19('0x42')]==='6'){if(!this[_0xfc19('0x1b')][_0x599e47[_0xfc19('0x36')]]['answered']){var _0x3a2d9c=moment();this[_0xfc19('0x1b')][_0x599e47[_0xfc19('0x36')]][_0xfc19('0x58')]=!![];this['channels'][_0x599e47[_0xfc19('0x36')]]['answertime']=_0x3a2d9c[_0xfc19('0x3f')](_0xfc19('0x53'));if(this[_0xfc19('0x1b')][_0x599e47[_0xfc19('0x36')]][_0xfc19('0x3e')]){this[_0xfc19('0x1b')][_0x599e47['linkedid']][_0xfc19('0x59')]=_0x3a2d9c['diff'](this[_0xfc19('0x1b')][_0x599e47[_0xfc19('0x36')]]['starttime'],'seconds');}}this[_0xfc19('0x1b')][_0x599e47[_0xfc19('0x36')]]['linkedid']=_0x599e47[_0xfc19('0x35')];if(_0x599e47[_0xfc19('0x5a')]!=='xcally-motion-preview'){this['channels'][_0x599e47[_0xfc19('0x36')]][_0xfc19('0x5b')]=_0x599e47['calleridnum'];}this[_0xfc19('0x1b')][_0x599e47[_0xfc19('0x36')]][_0xfc19('0x5c')]=_0x599e47[_0xfc19('0x5d')];this['channels'][_0x599e47[_0xfc19('0x36')]][_0xfc19('0x5e')]=_0x599e47[_0xfc19('0x3c')];this[_0xfc19('0x1b')][_0x599e47['linkedid']][_0xfc19('0x40')]=dispositions[_['toNumber'](_0x599e47['channelstate'])];if(this[_0xfc19('0x1c')][_0x599e47[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]]){this['channels'][_0x599e47['linkedid']][_0xfc19('0x5f')]=this['agents'][_0x599e47[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]]['id'];this[_0xfc19('0x1b')][_0x599e47[_0xfc19('0x36')]][_0xfc19('0x60')]=this[_0xfc19('0x1c')][_0x599e47['channel']['split']('-')[0x0]][_0xfc19('0x48')];}}}}else{if(this['channels'][_0x599e47[_0xfc19('0x35')]]){if(_0x599e47[_0xfc19('0x42')]==='6'){if(this['agents'][_0x599e47[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]]){this[_0xfc19('0x1b')][_0x599e47[_0xfc19('0x35')]]['UserId']=this[_0xfc19('0x1c')][_0x599e47[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]]['id'];this[_0xfc19('0x1b')][_0x599e47['uniqueid']]['membername']=this['agents'][_0x599e47[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]][_0xfc19('0x48')];}}}}}}catch(_0x2569d6){logger['error'](_0xfc19('0x61'),util[_0xfc19('0x3b')](_0x2569d6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfc19('0x31')][_0xfc19('0x62')]=function(_0x3c9ce7,_0x17ee93){if(this['channels'][_0x3c9ce7]){this[_0xfc19('0x1b')][_0x3c9ce7][_0xfc19('0x63')]=!![];if(_[_0xfc19('0x64')](_0x17ee93,_0xfc19('0x65'))){_0x17ee93=_0x17ee93[_0xfc19('0x66')](_0xfc19('0x65'),_0xfc19('0x67'));}this[_0xfc19('0x1b')][_0x3c9ce7][_0xfc19('0x68')]=_0x17ee93;var _0x43e840=_[_0xfc19('0x69')](this['channels'][_0x3c9ce7][_0xfc19('0x6a')],{'filename':_0x17ee93});if(_[_0xfc19('0x6b')](_0x43e840)){this[_0xfc19('0x1b')][_0x3c9ce7]['monitors']['push']({'filename':_0x17ee93,'createdAt':moment()[_0xfc19('0x3f')](_0xfc19('0x53')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0xfc19('0x31')]['syncVarSet']=function(_0x1ffcd4){try{if(this['isNotNull'](_0x1ffcd4)){if(this[_0xfc19('0x1b')][_0x1ffcd4['uniqueid']]&&_0x1ffcd4[_0xfc19('0x3c')]!='OutgoingSpoolFailed'){if(this[_0xfc19('0x32')](_0x1ffcd4[_0xfc19('0x6c')])){if(this[_0xfc19('0x32')](_0x1ffcd4[_0xfc19('0x6c')][_0xfc19('0x6d')])){this[_0xfc19('0x62')](_0x1ffcd4[_0xfc19('0x35')],_0x1ffcd4[_0xfc19('0x6e')]);}else if(this[_0xfc19('0x32')](_0x1ffcd4[_0xfc19('0x6c')][_0xfc19('0x6f')])){this[_0xfc19('0x1b')][_0x1ffcd4[_0xfc19('0x35')]][_0xfc19('0x5a')]=_0x1ffcd4[_0xfc19('0x6e')];}else if(this['isNotNull'](_0x1ffcd4[_0xfc19('0x6c')][_0xfc19('0x70')])){this[_0xfc19('0x1b')][_0x1ffcd4[_0xfc19('0x35')]][_0xfc19('0x71')]=_0x1ffcd4['value'];}else if(this[_0xfc19('0x32')](_0x1ffcd4[_0xfc19('0x6c')][_0xfc19('0x72')])){this[_0xfc19('0x1b')][_0x1ffcd4[_0xfc19('0x35')]][_0xfc19('0x73')]=_0x1ffcd4['value'];}else if(this['isNotNull'](_0x1ffcd4['variable'][_0xfc19('0x74')])){this[_0xfc19('0x1b')][_0x1ffcd4[_0xfc19('0x35')]]['queue']=_0x1ffcd4[_0xfc19('0x6e')][_0xfc19('0x45')](',')[0x0];}else if(this[_0xfc19('0x32')](_0x1ffcd4[_0xfc19('0x6c')]['xmd-originatecalleridnum'])){this[_0xfc19('0x1b')][_0x1ffcd4[_0xfc19('0x35')]][_0xfc19('0x75')]=_0x1ffcd4[_0xfc19('0x6e')];}else if(this[_0xfc19('0x32')](_0x1ffcd4['variable'][_0xfc19('0x76')])){this[_0xfc19('0x1b')][_0x1ffcd4['uniqueid']]['destination']=_0x1ffcd4[_0xfc19('0x6e')];}else if(this[_0xfc19('0x32')](_0x1ffcd4['variable'][_0xfc19('0x77')])){this[_0xfc19('0x1b')][_0x1ffcd4['uniqueid']][_0xfc19('0x78')]=_0x1ffcd4[_0xfc19('0x6e')];}else if(this[_0xfc19('0x32')](_0x1ffcd4[_0xfc19('0x6c')][_0xfc19('0x79')])){this[_0xfc19('0x1b')][_0x1ffcd4[_0xfc19('0x35')]][_0xfc19('0x11')]=_0x1ffcd4['value'];}else if(this[_0xfc19('0x32')](_0x1ffcd4[_0xfc19('0x6c')]['sipcallid'])){this['channels'][_0x1ffcd4[_0xfc19('0x35')]]['sipcalluniqueid']=_0x1ffcd4[_0xfc19('0x6e')];}}}else if(this[_0xfc19('0x32')](_0x1ffcd4[_0xfc19('0x6c')][_0xfc19('0x6d')])){if(_0x1ffcd4[_0xfc19('0x6e')]){var _0x3476f0=path[_0xfc19('0x7a')](_0x1ffcd4[_0xfc19('0x6e')])[_0xfc19('0x48')];this[_0xfc19('0x62')](_0x3476f0,_0x1ffcd4[_0xfc19('0x6e')]);}}else if(this[_0xfc19('0x1b')][_0x1ffcd4[_0xfc19('0x36')]]){if(this['isNotNull'](_0x1ffcd4[_0xfc19('0x6c')])){if(this[_0xfc19('0x32')](_0x1ffcd4['variable'][_0xfc19('0x7b')])){this[_0xfc19('0x1b')][_0x1ffcd4[_0xfc19('0x36')]][_0xfc19('0x7c')]=_0x1ffcd4[_0xfc19('0x6e')];}}}}}catch(_0x336d78){logger[_0xfc19('0x39')](_0xfc19('0x7d'),util[_0xfc19('0x3b')](_0x336d78,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfc19('0x31')][_0xfc19('0x7e')]=function(_0x231c87){try{if(this[_0xfc19('0x32')](_0x231c87)){if(this['channels'][_0x231c87[_0xfc19('0x35')]]){var _0x341bcf=moment();this[_0xfc19('0x1b')][_0x231c87[_0xfc19('0x35')]][_0xfc19('0x7f')]=_0x341bcf['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xfc19('0x1b')][_0x231c87[_0xfc19('0x35')]]['duration']=_0x341bcf['diff'](this[_0xfc19('0x1b')][_0x231c87[_0xfc19('0x35')]][_0xfc19('0x3e')],_0xfc19('0x52'));if(this[_0xfc19('0x1b')][_0x231c87['uniqueid']][_0xfc19('0x58')]){this[_0xfc19('0x1b')][_0x231c87[_0xfc19('0x35')]]['billableseconds']=_0x341bcf[_0xfc19('0x80')](this[_0xfc19('0x1b')][_0x231c87[_0xfc19('0x35')]][_0xfc19('0x81')],_0xfc19('0x52'));this[_0xfc19('0x1b')][_0x231c87['uniqueid']][_0xfc19('0x59')]=this[_0xfc19('0x1b')][_0x231c87[_0xfc19('0x35')]]['duration']-this[_0xfc19('0x1b')][_0x231c87[_0xfc19('0x35')]][_0xfc19('0x82')];}if(_0x231c87[_0xfc19('0x83')]===_0xfc19('0x44')){if(this['agents'][_0x231c87['channel']['split']('-')[0x0]]){this['agents'][_0x231c87[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]]=_['omit'](this[_0xfc19('0x1c')][_0x231c87[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]],[_0xfc19('0x84')]);this['emit'](util['format'](_0xfc19('0x47'),this[_0xfc19('0x1c')][_0x231c87['channel'][_0xfc19('0x45')]('-')[0x0]][_0xfc19('0x48')]),_0xfc19('0x85'),{'destaccountcode':this[_0xfc19('0x1c')][_0x231c87[_0xfc19('0x3c')][_0xfc19('0x45')]('-')[0x0]]['accountcode']});}}ami[_0xfc19('0x34')](_0xfc19('0x86'),this[_0xfc19('0x1b')][_0x231c87[_0xfc19('0x35')]]);delete this[_0xfc19('0x1b')][_0x231c87[_0xfc19('0x35')]];}}}catch(_0x49d226){logger['error']('[syncHangup][VoiceCallReport]',util['inspect'](_0x49d226,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfc19('0x31')][_0xfc19('0x28')]=function(_0xfb9a60){try{if(this['isNotNull'](_0xfb9a60)){if(this['channels'][_0xfb9a60[_0xfc19('0x87')]]){this['channels'][_0xfb9a60[_0xfc19('0x87')]][_0xfc19('0x88')]=_0xfb9a60[_0xfc19('0x89')];this[_0xfc19('0x1b')][_0xfb9a60[_0xfc19('0x87')]]['transferconnectedlinenum']=_0xfb9a60[_0xfc19('0x8a')];if(this[_0xfc19('0x1b')][_0xfb9a60[_0xfc19('0x8b')]]){var _0x1e3419=this[_0xfc19('0x1b')][_0xfb9a60[_0xfc19('0x8b')]];this['channels'][_0xfb9a60[_0xfc19('0x8b')]]=this['channels'][_0xfb9a60[_0xfc19('0x87')]];this['channels'][_0xfb9a60[_0xfc19('0x87')]]=_0x1e3419;}}else if(this['channels'][_0xfb9a60['transfertargetuniqueid']]){this['channels'][_0xfb9a60[_0xfc19('0x8c')]]['transfercalleridnum']=_0xfb9a60[_0xfc19('0x89')];this[_0xfc19('0x1b')][_0xfb9a60[_0xfc19('0x8c')]][_0xfc19('0x8d')]=_0xfb9a60[_0xfc19('0x8a')];if(this[_0xfc19('0x1b')][_0xfb9a60[_0xfc19('0x8e')]]){var _0x1e3419=this['channels'][_0xfb9a60[_0xfc19('0x8e')]];this[_0xfc19('0x1b')][_0xfb9a60[_0xfc19('0x8e')]]=this[_0xfc19('0x1b')][_0xfb9a60[_0xfc19('0x8c')]];this[_0xfc19('0x1b')][_0xfb9a60[_0xfc19('0x8c')]]=_0x1e3419;}}}}catch(_0x276577){logger['error'](_0xfc19('0x8f'),util[_0xfc19('0x3b')](_0x276577,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfc19('0x31')][_0xfc19('0x2a')]=function(_0x685a21){try{if(this['isNotNull'](_0x685a21)){if(this[_0xfc19('0x1b')][_0x685a21[_0xfc19('0x87')]]){this[_0xfc19('0x1b')][_0x685a21[_0xfc19('0x87')]][_0xfc19('0x88')]=_0x685a21[_0xfc19('0x90')];this[_0xfc19('0x1b')][_0x685a21['transfereeuniqueid']][_0xfc19('0x8d')]=_0x685a21[_0xfc19('0x91')];this[_0xfc19('0x7e')]({'event':_0xfc19('0x92'),'uniqueid':_0x685a21['transfereeuniqueid'],'context':_0x685a21[_0xfc19('0x83')],'channel':_0x685a21['transfererchannel']});}}}catch(_0x331a0a){logger[_0xfc19('0x39')]('[syncBlindTransfer][VoiceCallReport]',util[_0xfc19('0x3b')](_0x331a0a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfc19('0x31')][_0xfc19('0x2c')]=function(_0x2b22cb){try{if(this[_0xfc19('0x32')](_0x2b22cb)){if(this[_0xfc19('0x1b')][_0x2b22cb[_0xfc19('0x35')]]){if(!_['isNil'](this[_0xfc19('0x1b')][_0x2b22cb['uniqueid']][_0xfc19('0x81')])){this['channels'][_0x2b22cb[_0xfc19('0x35')]][_0xfc19('0x93')]=moment()['format'](_0xfc19('0x53'));}}}}catch(_0x133bff){logger[_0xfc19('0x39')]('[syncMusicOnHoldStart][VoiceCallReport]',util['inspect'](_0x133bff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfc19('0x31')][_0xfc19('0x2e')]=function(_0x2da313){try{if(this[_0xfc19('0x32')](_0x2da313)){if(this['channels'][_0x2da313[_0xfc19('0x35')]]){if(!_[_0xfc19('0x6b')](this[_0xfc19('0x1b')][_0x2da313['uniqueid']]['mohstarttime'])){this[_0xfc19('0x1b')][_0x2da313['uniqueid']]['mohtime']+=moment()['milliseconds'](0x0)[_0xfc19('0x80')](this[_0xfc19('0x1b')][_0x2da313[_0xfc19('0x35')]]['mohstarttime'],_0xfc19('0x52'));delete this[_0xfc19('0x1b')][_0x2da313[_0xfc19('0x35')]]['mohstarttime'];}}}}catch(_0x557ce1){logger[_0xfc19('0x39')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0xfc19('0x3b')](_0x557ce1,{'showHidden':![],'depth':null}));}};module[_0xfc19('0x94')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 25748ee..47b95db 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 _0xc92f=['privilege','voice:outbound','voice_outbound_channel:save','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','error','[syncDialEnd][VoiceDialReport]','inspect','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','endtime','seconds','complete','total','answertime','holdtime','diff','starttime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','channels','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','event'];(function(_0x5309f0,_0x381caf){var _0x3c5ff0=function(_0x119250){while(--_0x119250){_0x5309f0['push'](_0x5309f0['shift']());}};_0x3c5ff0(++_0x381caf);}(_0xc92f,0xf3));var _0xfc92=function(_0x3b4b1f,_0x298528){_0x3b4b1f=_0x3b4b1f-0x0;var _0x4c8667=_0xc92f[_0x3b4b1f];return _0x4c8667;};'use strict';var _=require(_0xfc92('0x0'));var moment=require(_0xfc92('0x1'));var util=require('util');var Redis=require(_0xfc92('0x2'));var config=require(_0xfc92('0x3'));var logger=require(_0xfc92('0x4'))('ami');var ami=require(_0xfc92('0x5'));config[_0xfc92('0x6')]=_[_0xfc92('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfc92('0x8'))(new Redis(config['redis']));function VoiceDialReport(_0x394026){this['channels']=_0x394026[_0xfc92('0x9')];this['outbound']=_0x394026[_0xfc92('0xa')];this[_0xfc92('0xb')]={};ami['on'](_0xfc92('0xc'),this['syncDialBegin'][_0xfc92('0xd')](this));ami['on'](_0xfc92('0xe'),this[_0xfc92('0xf')]['bind'](this));ami['on'](_0xfc92('0x10'),this[_0xfc92('0x11')][_0xfc92('0xd')](this));ami['on'](_0xfc92('0x12'),this[_0xfc92('0x13')][_0xfc92('0xd')](this));}VoiceDialReport[_0xfc92('0x14')][_0xfc92('0x15')]=function(_0x115a0f){return _0x115a0f!==null&&!_[_0xfc92('0x16')](_0x115a0f);};VoiceDialReport[_0xfc92('0x14')][_0xfc92('0x17')]=function(_0x53d174,_0x55d532,_0x4bb1ca){io['to'](_0x53d174)[_0xfc92('0x17')](_0x55d532,_0x4bb1ca);};VoiceDialReport[_0xfc92('0x14')]['syncDialBegin']=function(_0x213025){try{if(this[_0xfc92('0x15')](_0x213025)){if(this[_0xfc92('0x18')][_0x213025[_0xfc92('0x19')]]){_[_0xfc92('0x1a')](this[_0xfc92('0x18')][_0x213025['uniqueid']],{'starttime':moment()[_0xfc92('0x1b')](_0xfc92('0x1c')),'lastevent':_0xfc92('0x1d'),'interface':_0x213025[_0xfc92('0x1e')]['substring'](0x0,_0x213025['channel'][_0xfc92('0x1f')]('-')),'membername':_0x213025[_0xfc92('0x1e')]['substring'](_0x213025[_0xfc92('0x1e')][_0xfc92('0x1f')]('/')+0x1,_0x213025['channel'][_0xfc92('0x1f')]('-'))},_['omit'](_0x213025,[_0xfc92('0x20'),_0xfc92('0x21')]));this[_0xfc92('0x17')](_0xfc92('0x22'),_0xfc92('0x23'),this[_0xfc92('0x18')][_0x213025['uniqueid']]);ami[_0xfc92('0x17')]('custom:dialbegin',this[_0xfc92('0x18')][_0x213025[_0xfc92('0x19')]]);}}}catch(_0x3aa7f6){logger['error']('[syncDialBegin][VoiceDialReport]',util['inspect'](_0x3aa7f6,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xfc92('0xf')]=function(_0xbc3d98){try{if(this[_0xfc92('0x15')](_0xbc3d98)){if(this[_0xfc92('0x18')][_0xbc3d98[_0xfc92('0x19')]]){this[_0xfc92('0x18')][_0xbc3d98[_0xfc92('0x19')]][_0xfc92('0x24')]=_0xbc3d98['dialstatus'];if(_0xbc3d98[_0xfc92('0x24')]===_0xfc92('0x25')){this[_0xfc92('0x18')][_0xbc3d98['uniqueid']][_0xfc92('0x26')]=_0xbc3d98[_0xfc92('0x26')];this['channels'][_0xbc3d98['uniqueid']][_0xfc92('0x27')]=_0xbc3d98[_0xfc92('0x27')];this['channels'][_0xbc3d98[_0xfc92('0x19')]]['answertime']=moment()[_0xfc92('0x1b')](_0xfc92('0x1c'));this['channels'][_0xbc3d98[_0xfc92('0x19')]][_0xfc92('0x28')]=_0xfc92('0x29');ami[_0xfc92('0x17')](_0xfc92('0x2a'),this[_0xfc92('0x18')][_0xbc3d98[_0xfc92('0x19')]]);}this[_0xfc92('0x17')](_0xfc92('0x22'),'voice_outbound_channel:save',this['channels'][_0xbc3d98[_0xfc92('0x19')]]);}}}catch(_0x4ee477){logger[_0xfc92('0x2b')](_0xfc92('0x2c'),util[_0xfc92('0x2d')](_0x4ee477,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfc92('0x14')]['syncVarSet']=function(_0x47facc){try{if(this[_0xfc92('0x15')](_0x47facc)){this[_0xfc92('0x2e')](_0x47facc[_0xfc92('0x19')],_[_0xfc92('0x2f')](_0x47facc[_0xfc92('0x30')])[0x0],_0x47facc[_0xfc92('0x31')]);if(this[_0xfc92('0x15')](_0x47facc['variable'])&&this[_0xfc92('0x15')](_0x47facc[_0xfc92('0x30')][_0xfc92('0x32')])){if(_[_0xfc92('0x16')](this['channels'][_0x47facc[_0xfc92('0x19')]])){this['channels'][_0x47facc['uniqueid']]={'routeId':_0x47facc[_0xfc92('0x31')],'variables':this[_0xfc92('0xb')][_0x47facc[_0xfc92('0x19')]]};this['emit'](_0xfc92('0x22'),'voice_outbound_channel:save',this[_0xfc92('0x18')][_0x47facc[_0xfc92('0x19')]]);}}}}catch(_0x587124){logger[_0xfc92('0x2b')](_0xfc92('0x33'),util['inspect'](_0x587124,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfc92('0x14')][_0xfc92('0x2e')]=function(_0x24a3a7,_0xd0493c,_0x5d3a14){var _0x57dfe2=[_0xfc92('0x34'),_0xfc92('0x35'),_0xfc92('0x36'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xfc92('0x37'),_0xfc92('0x38'),_0xfc92('0x39'),_0xfc92('0x3a'),_0xfc92('0x3b'),_0xfc92('0x3c'),_0xfc92('0x3d'),_0xfc92('0x3e'),_0xfc92('0x3f'),'memberinterface',_0xfc92('0x40'),_0xfc92('0x41'),_0xfc92('0x42'),_0xfc92('0x43')];if(!_[_0xfc92('0x44')](_0xd0493c)&&!_[_0xfc92('0x45')](_0x57dfe2,_0xd0493c)){if(_[_0xfc92('0x16')](this[_0xfc92('0xb')][_0x24a3a7])){this[_0xfc92('0xb')][_0x24a3a7]={};}this['variables'][_0x24a3a7][_0xd0493c]=_0x5d3a14;}};VoiceDialReport[_0xfc92('0x14')]['syncHangup']=function(_0x2fbb3c){try{if(this[_0xfc92('0x15')](_0x2fbb3c)){if(this['channels'][_0x2fbb3c['uniqueid']]){this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]][_0xfc92('0x46')]=moment()[_0xfc92('0x1b')](_0xfc92('0x1c'));this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]]['duration']=moment(this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]][_0xfc92('0x46')])['diff'](this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]]['starttime'],_0xfc92('0x47'));this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]]['lastevent']=_0xfc92('0x48');this[_0xfc92('0xa')][_0xfc92('0x49')]+=0x1;if(this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]][_0xfc92('0x4a')]){this['outbound']['answered']+=0x1;this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]][_0xfc92('0x4b')]=moment(this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]][_0xfc92('0x4a')])[_0xfc92('0x4c')](this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]][_0xfc92('0x4d')],_0xfc92('0x47'));this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]][_0xfc92('0x4e')]=moment(this[_0xfc92('0x18')][_0x2fbb3c['uniqueid']]['endtime'])['diff'](this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]]['answertime'],_0xfc92('0x47'));this[_0xfc92('0xa')][_0xfc92('0x4f')]+=this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]]['holdtime']||0x0;this['outbound'][_0xfc92('0x50')]+=this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]][_0xfc92('0x4e')];}this['outbound'][_0xfc92('0x51')]+=this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]][_0xfc92('0x52')];ami[_0xfc92('0x17')](_0xfc92('0x53'),this[_0xfc92('0x18')][_0x2fbb3c[_0xfc92('0x19')]]);ami[_0xfc92('0x17')](_0xfc92('0x54'),this['channels'][_0x2fbb3c['uniqueid']]);this[_0xfc92('0x17')](_0xfc92('0x22'),_0xfc92('0x55'),this['outbound']);logger[_0xfc92('0x56')](_0xfc92('0x57'),JSON[_0xfc92('0x58')](this['channels'][_0x2fbb3c['uniqueid']]));this[_0xfc92('0x17')](_0xfc92('0x22'),_0xfc92('0x59'),this[_0xfc92('0x18')][_0x2fbb3c['uniqueid']]);delete this['channels'][_0x2fbb3c[_0xfc92('0x19')]];}if(this[_0xfc92('0xb')][_0x2fbb3c['uniqueid']]){delete this[_0xfc92('0xb')][_0x2fbb3c[_0xfc92('0x19')]];}}}catch(_0x47525a){logger[_0xfc92('0x2b')](_0xfc92('0x5a'),util[_0xfc92('0x2d')](_0x47525a,{'showHidden':![],'depth':null}));}};module[_0xfc92('0x5b')]=VoiceDialReport; \ No newline at end of file +var _0xdbbe=['substring','lastIndexOf','omit','event','privilege','voice_outbound_channel:save','channels','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinename','answertime','connect','custom:dialconnect','voice:outbound','addVariable','keys','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','endtime','diff','starttime','seconds','lastevent','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumDuration','duration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','variables','syncDialBegin','bind','dialend','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xdbbe,0x148));var _0xedbb=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0xdbbe[_0x45d1fd];return _0xd0e542;};'use strict';var _=require('lodash');var moment=require(_0xedbb('0x0'));var util=require(_0xedbb('0x1'));var Redis=require(_0xedbb('0x2'));var config=require(_0xedbb('0x3'));var logger=require(_0xedbb('0x4'))(_0xedbb('0x5'));var ami=require('../ami');config[_0xedbb('0x6')]=_[_0xedbb('0x7')](config[_0xedbb('0x6')],{'host':_0xedbb('0x8'),'port':0x18eb});var io=require(_0xedbb('0x9'))(new Redis(config[_0xedbb('0x6')]));function VoiceDialReport(_0x2bb3dd){this['channels']=_0x2bb3dd[_0xedbb('0xa')];this[_0xedbb('0xb')]=_0x2bb3dd['outbound'];this[_0xedbb('0xc')]={};ami['on']('dialbegin',this[_0xedbb('0xd')][_0xedbb('0xe')](this));ami['on'](_0xedbb('0xf'),this['syncDialEnd'][_0xedbb('0xe')](this));ami['on']('varset',this[_0xedbb('0x10')][_0xedbb('0xe')](this));ami['on'](_0xedbb('0x11'),this[_0xedbb('0x12')]['bind'](this));}VoiceDialReport[_0xedbb('0x13')][_0xedbb('0x14')]=function(_0x420003){return _0x420003!==null&&!_[_0xedbb('0x15')](_0x420003);};VoiceDialReport[_0xedbb('0x13')][_0xedbb('0x16')]=function(_0x47fe18,_0x20c895,_0xaee7ac){io['to'](_0x47fe18)[_0xedbb('0x16')](_0x20c895,_0xaee7ac);};VoiceDialReport[_0xedbb('0x13')][_0xedbb('0xd')]=function(_0x3612d8){try{if(this['isNotNull'](_0x3612d8)){if(this['channels'][_0x3612d8[_0xedbb('0x17')]]){_[_0xedbb('0x18')](this['channels'][_0x3612d8[_0xedbb('0x17')]],{'starttime':moment()[_0xedbb('0x19')](_0xedbb('0x1a')),'lastevent':'called','interface':_0x3612d8[_0xedbb('0x1b')]['substring'](0x0,_0x3612d8['channel']['lastIndexOf']('-')),'membername':_0x3612d8['channel'][_0xedbb('0x1c')](_0x3612d8['channel']['lastIndexOf']('/')+0x1,_0x3612d8[_0xedbb('0x1b')][_0xedbb('0x1d')]('-'))},_[_0xedbb('0x1e')](_0x3612d8,[_0xedbb('0x1f'),_0xedbb('0x20')]));this[_0xedbb('0x16')]('voice:outbound',_0xedbb('0x21'),this[_0xedbb('0x22')][_0x3612d8[_0xedbb('0x17')]]);ami['emit'](_0xedbb('0x23'),this[_0xedbb('0x22')][_0x3612d8[_0xedbb('0x17')]]);}}}catch(_0x4f277e){logger[_0xedbb('0x24')](_0xedbb('0x25'),util[_0xedbb('0x26')](_0x4f277e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xedbb('0x13')][_0xedbb('0x27')]=function(_0x12af1c){try{if(this[_0xedbb('0x14')](_0x12af1c)){if(this[_0xedbb('0x22')][_0x12af1c[_0xedbb('0x17')]]){this['channels'][_0x12af1c[_0xedbb('0x17')]][_0xedbb('0x28')]=_0x12af1c[_0xedbb('0x28')];if(_0x12af1c['dialstatus']===_0xedbb('0x29')){this[_0xedbb('0x22')][_0x12af1c['uniqueid']]['connectedlinenum']=_0x12af1c['connectedlinenum'];this[_0xedbb('0x22')][_0x12af1c[_0xedbb('0x17')]][_0xedbb('0x2a')]=_0x12af1c[_0xedbb('0x2a')];this[_0xedbb('0x22')][_0x12af1c['uniqueid']][_0xedbb('0x2b')]=moment()[_0xedbb('0x19')](_0xedbb('0x1a'));this[_0xedbb('0x22')][_0x12af1c[_0xedbb('0x17')]]['lastevent']=_0xedbb('0x2c');ami[_0xedbb('0x16')](_0xedbb('0x2d'),this[_0xedbb('0x22')][_0x12af1c[_0xedbb('0x17')]]);}this[_0xedbb('0x16')](_0xedbb('0x2e'),'voice_outbound_channel:save',this[_0xedbb('0x22')][_0x12af1c[_0xedbb('0x17')]]);}}}catch(_0x1daa2a){logger['error']('[syncDialEnd][VoiceDialReport]',util[_0xedbb('0x26')](_0x1daa2a,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xedbb('0x10')]=function(_0x2f6862){try{if(this[_0xedbb('0x14')](_0x2f6862)){this[_0xedbb('0x2f')](_0x2f6862['uniqueid'],_[_0xedbb('0x30')](_0x2f6862[_0xedbb('0x31')])[0x0],_0x2f6862['value']);if(this[_0xedbb('0x14')](_0x2f6862[_0xedbb('0x31')])&&this['isNotNull'](_0x2f6862[_0xedbb('0x31')]['outboundrouteid'])){if(_[_0xedbb('0x15')](this[_0xedbb('0x22')][_0x2f6862['uniqueid']])){this['channels'][_0x2f6862['uniqueid']]={'routeId':_0x2f6862[_0xedbb('0x32')],'variables':this['variables'][_0x2f6862[_0xedbb('0x17')]]};this[_0xedbb('0x16')](_0xedbb('0x2e'),'voice_outbound_channel:save',this[_0xedbb('0x22')][_0x2f6862[_0xedbb('0x17')]]);}}}}catch(_0x1c2d6f){logger[_0xedbb('0x24')](_0xedbb('0x33'),util[_0xedbb('0x26')](_0x1c2d6f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xedbb('0x13')][_0xedbb('0x2f')]=function(_0x4d0b51,_0x14ef16,_0x1b0d0f){var _0x53bee6=['rtpaudioqos',_0xedbb('0x34'),_0xedbb('0x35'),_0xedbb('0x36'),_0xedbb('0x37'),_0xedbb('0x38'),_0xedbb('0x39'),'rtpaudioqosrttbridged',_0xedbb('0x3a'),_0xedbb('0x3b'),_0xedbb('0x3c'),_0xedbb('0x3d'),'membercalls',_0xedbb('0x3e'),_0xedbb('0x3f'),_0xedbb('0x40'),'membername','memberpenalty',_0xedbb('0x41')];if(!_[_0xedbb('0x42')](_0x14ef16)&&!_['includes'](_0x53bee6,_0x14ef16)){if(_[_0xedbb('0x15')](this[_0xedbb('0xc')][_0x4d0b51])){this[_0xedbb('0xc')][_0x4d0b51]={};}this[_0xedbb('0xc')][_0x4d0b51][_0x14ef16]=_0x1b0d0f;}};VoiceDialReport[_0xedbb('0x13')][_0xedbb('0x12')]=function(_0x42598d){try{if(this['isNotNull'](_0x42598d)){if(this[_0xedbb('0x22')][_0x42598d['uniqueid']]){this[_0xedbb('0x22')][_0x42598d['uniqueid']][_0xedbb('0x43')]=moment()[_0xedbb('0x19')](_0xedbb('0x1a'));this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]]['duration']=moment(this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]][_0xedbb('0x43')])[_0xedbb('0x44')](this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]][_0xedbb('0x45')],_0xedbb('0x46'));this['channels'][_0x42598d[_0xedbb('0x17')]][_0xedbb('0x47')]=_0xedbb('0x48');this[_0xedbb('0xb')][_0xedbb('0x49')]+=0x1;if(this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]]['answertime']){this[_0xedbb('0xb')][_0xedbb('0x4a')]+=0x1;this['channels'][_0x42598d['uniqueid']][_0xedbb('0x4b')]=moment(this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]][_0xedbb('0x2b')])[_0xedbb('0x44')](this['channels'][_0x42598d[_0xedbb('0x17')]]['starttime'],_0xedbb('0x46'));this[_0xedbb('0x22')][_0x42598d['uniqueid']][_0xedbb('0x4c')]=moment(this['channels'][_0x42598d['uniqueid']][_0xedbb('0x43')])[_0xedbb('0x44')](this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]][_0xedbb('0x2b')],'seconds');this[_0xedbb('0xb')][_0xedbb('0x4d')]+=this['channels'][_0x42598d[_0xedbb('0x17')]]['holdtime']||0x0;this[_0xedbb('0xb')]['sumBillable']+=this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]][_0xedbb('0x4c')];}this[_0xedbb('0xb')][_0xedbb('0x4e')]+=this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]][_0xedbb('0x4f')];ami[_0xedbb('0x16')](_0xedbb('0x50'),this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]]);ami[_0xedbb('0x16')](_0xedbb('0x51'),this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]]);this[_0xedbb('0x16')]('voice:outbound',_0xedbb('0x52'),this[_0xedbb('0xb')]);logger[_0xedbb('0x53')](_0xedbb('0x54'),JSON[_0xedbb('0x55')](this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]]));this[_0xedbb('0x16')]('voice:outbound',_0xedbb('0x56'),this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]]);delete this[_0xedbb('0x22')][_0x42598d[_0xedbb('0x17')]];}if(this['variables'][_0x42598d[_0xedbb('0x17')]]){delete this[_0xedbb('0xc')][_0x42598d[_0xedbb('0x17')]];}}}catch(_0x387756){logger[_0xedbb('0x24')](_0xedbb('0x57'),util[_0xedbb('0x26')](_0x387756,{'showHidden':![],'depth':null}));}};module[_0xedbb('0x58')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 32d240b..63d47e2 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 _0x657e=['context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStart','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../model/queueReport','redis','defaults','localhost','prototype','enqueue','tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','variables','syncQueueSummary','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','hangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','hasOwnProperty','isEmpty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','sequence','isNil','Action','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','name','voice_queue_channel:save','info','stringify','voice:queue:%s','voice_queue_channel:remove','inbound','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','type','unmanaged','abandoned','Trunk','callerid','Interval','queues','[queues]','flagQueueSummary','queuesummary','then','[queuesummary]','isNotNull','countBy','queue','callers','toNumber','loggedin','available','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','queuecallerjoinAt','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','assigned','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','reason','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','transferuniqueid','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','timeout','custom:timeout','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','syncHangup','length','diff','milliseconds','total','lastevent','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','ATTENDEDTRANSFER','ATTENDED','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','transferexten','extension','BlindTransfer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x657e,0x1a4));var _0xe657=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x657e[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xe657('0x0'));var moment=require(_0xe657('0x1'));var BPromise=require(_0xe657('0x2'));var util=require(_0xe657('0x3'));var md5=require(_0xe657('0x4'));var Redis=require(_0xe657('0x5'));var config=require(_0xe657('0x6'));var logger=require(_0xe657('0x7'))(_0xe657('0x8'));var ami=require('../ami');var QueueReport=require(_0xe657('0x9'));config[_0xe657('0xa')]=_[_0xe657('0xb')](config[_0xe657('0xa')],{'host':_0xe657('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe657('0xa')]));var Sequence=function(){};Sequence[_0xe657('0xd')][_0xe657('0xe')]=function(_0x46a80e){this[_0xe657('0xf')]=this[_0xe657('0xf')]?this['tail'][_0xe657('0x10')](_0x46a80e):_0x46a80e();};function VoiceQueueReport(_0x1aecfd){this['sequence']=new Sequence();this[_0xe657('0x11')]={};this['agents']=_0x1aecfd[_0xe657('0x12')];this[_0xe657('0x13')]=_0x1aecfd[_0xe657('0x14')];this[_0xe657('0x15')]=_0x1aecfd[_0xe657('0x15')];this['flagQueueSummary']=!![];this[_0xe657('0x16')]=_0x1aecfd[_0xe657('0x16')];this[_0xe657('0x17')]={};ami['on']('queuesummary',this[_0xe657('0x18')]['bind'](this));ami['on']('queuesummarycomplete',this[_0xe657('0x19')][_0xe657('0x1a')](this));ami['on'](_0xe657('0x1b'),this[_0xe657('0x1c')][_0xe657('0x1a')](this));ami['on'](_0xe657('0x1d'),this['syncQueueCallerAbandon'][_0xe657('0x1a')](this));ami['on'](_0xe657('0x1e'),this[_0xe657('0x1f')][_0xe657('0x1a')](this));ami['on'](_0xe657('0x20'),this[_0xe657('0x21')][_0xe657('0x1a')](this));ami['on']('agentconnect',this[_0xe657('0x22')][_0xe657('0x1a')](this));ami['on']('varset',this['syncVarSet'][_0xe657('0x1a')](this));ami['on'](_0xe657('0x23'),this['syncHangup'][_0xe657('0x1a')](this));ami['on'](_0xe657('0x24'),this[_0xe657('0x25')][_0xe657('0x1a')](this));ami['on'](_0xe657('0x26'),this['syncMusicOnHoldStart'][_0xe657('0x1a')](this));ami['on'](_0xe657('0x27'),this['syncMusicOnHoldStop']['bind'](this));ami['on']('attendedtransfer',this[_0xe657('0x28')][_0xe657('0x1a')](this));ami['on'](_0xe657('0x29'),this[_0xe657('0x2a')][_0xe657('0x1a')](this));this[_0xe657('0x2b')]();this[_0xe657('0x2c')]();}function isNotNull(_0x2b6b2e){return _0x2b6b2e!==null&&!_[_0xe657('0x2d')](_0x2b6b2e);}function clearChannels(_0x2cc6ba){if(!_['isEmpty'](_0x2cc6ba)){for(var _0x103f0e in _0x2cc6ba){if(_0x2cc6ba[_0xe657('0x2e')](_0x103f0e)){delete _0x2cc6ba[_0x103f0e];}}}}function clearCampaigns(_0x5ae76a){if(!_[_0xe657('0x2f')](_0x5ae76a)){for(var _0x3ef679 in _0x5ae76a){if(_0x5ae76a[_0xe657('0x2e')](_0x3ef679)){_0x5ae76a[_0x3ef679]['originated']=0x0;}}}}function clearVoiceQueues(_0x5e19bb){if(!_[_0xe657('0x2f')](_0x5e19bb)){for(var _0x3266b6 in _0x5e19bb){if(_0x5e19bb['hasOwnProperty'](_0x3266b6)){_0x5e19bb[_0x3266b6][_0xe657('0x30')]=0x0;_0x5e19bb[_0x3266b6][_0xe657('0x31')]=0x0;_0x5e19bb[_0x3266b6][_0xe657('0x32')]=0x0;_0x5e19bb[_0x3266b6][_0xe657('0x33')]=0x0;_0x5e19bb[_0x3266b6][_0xe657('0x34')]=!![];}}}}function clearAgentBooked(_0x265dc2){if(!_[_0xe657('0x2f')](_0x265dc2)){for(var _0x29c699 in _0x265dc2){if(_0x265dc2[_0xe657('0x2e')](_0x29c699)){_0x265dc2[_0x29c699][_0xe657('0x35')]=!![];}}}}VoiceQueueReport[_0xe657('0xd')][_0xe657('0x36')]=function(){var _0x3c368a=this;for(var _0x38a9a9 in this[_0xe657('0x13')]){if(this[_0xe657('0x13')][_0xe657('0x2e')](_0x38a9a9)&&!this[_0xe657('0x13')][_0x38a9a9][_0xe657('0x37')]){this[_0xe657('0x38')][_0xe657('0xe')](function(){if(!_[_0xe657('0x39')](_0x3c368a[_0xe657('0x13')][_0x38a9a9])){return ami[_0xe657('0x3a')]({'action':'status','channel':_0x3c368a[_0xe657('0x13')][_0x38a9a9][_0xe657('0x3b')]})[_0xe657('0x3c')](function(_0x2d2685){if(_0x2d2685[_0xe657('0x3d')]===_0xe657('0x3e')){setTimeout(function(){if(_0x3c368a['channels'][_0x38a9a9]){delete _0x3c368a['channels'][_0x38a9a9];logger[_0xe657('0x3f')](_0xe657('0x40'),_0x38a9a9);}if(_0x3c368a[_0xe657('0x11')][_0x38a9a9]){delete _0x3c368a[_0xe657('0x11')][_0x38a9a9];logger[_0xe657('0x3f')](_0xe657('0x41'),_0x38a9a9);}if(_0x3c368a[_0xe657('0x17')][_0x38a9a9]){delete _0x3c368a[_0xe657('0x17')][_0x38a9a9];logger['error'](_0xe657('0x42'),_0x38a9a9);}},0x1f40);}});}});}}};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x25')]=function(){logger['error'](_0xe657('0x43'));clearChannels(this[_0xe657('0x13')]);this[_0xe657('0x44')](this[_0xe657('0x11')]);clearAgentBooked(this[_0xe657('0x12')]);clearVoiceQueues(this[_0xe657('0x15')]);clearCampaigns(this[_0xe657('0x16')]);};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x44')]=function(_0x101146){var _0x52560b=this;if(!_[_0xe657('0x2f')](_0x101146)){for(var _0x3bdd8a in _0x101146){if(_0x101146[_0xe657('0x2e')](_0x3bdd8a)){_0x52560b[_0xe657('0x45')](_0x101146[_0x3bdd8a]);delete _0x101146[_0x3bdd8a];}}}};function loggerCatch(_0x880062){return function(_0x181277){logger[_0xe657('0x3f')](_0x880062,util[_0xe657('0x46')](_0x181277,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xe657('0xd')][_0xe657('0x47')]=function(_0x35a2af,_0x3ab005,_0x1b173c){io['to'](_0x35a2af)[_0xe657('0x47')](_0x3ab005,_0x1b173c);};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x48')]=function(_0x1d2fac){this[_0xe657('0x47')](util[_0xe657('0x49')]('voice:queue:%s',_0x1d2fac[_0xe657('0x4a')]),_0xe657('0x4b'),_0x1d2fac);};VoiceQueueReport['prototype'][_0xe657('0x45')]=function(_0x4087f4){logger[_0xe657('0x4c')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xe657('0x4d')](_0x4087f4));this[_0xe657('0x47')](util['format'](_0xe657('0x4e'),_0x4087f4[_0xe657('0x4a')]),_0xe657('0x4f'),_0x4087f4);};VoiceQueueReport[_0xe657('0xd')]['emitVoiceQueueSummary']=function(_0xc2feeb){if(_0xc2feeb['type']===_0xe657('0x50')){var _0x563b69={'id':_0xc2feeb['id'],'name':_0xc2feeb[_0xe657('0x4a')],'strategy':_0xc2feeb['strategy'],'answered':_0xc2feeb[_0xe657('0x51')],'available':_0xc2feeb['available'],'loggedIn':_0xc2feeb[_0xe657('0x52')],'pTalking':_0xc2feeb[_0xe657('0x32')],'sumBillable':_0xc2feeb[_0xe657('0x53')],'sumDuration':_0xc2feeb[_0xe657('0x54')],'sumHoldTime':_0xc2feeb[_0xe657('0x55')]||0x0,'talking':_0xc2feeb[_0xe657('0x31')],'total':_0xc2feeb['total'],'type':_0xc2feeb[_0xe657('0x56')],'unmanaged':_0xc2feeb[_0xe657('0x57')],'abandoned':_0xc2feeb[_0xe657('0x58')],'waiting':_0xc2feeb[_0xe657('0x33')]};if(_0xc2feeb[_0xe657('0x59')]){_0x563b69['Trunk']={'id':_0xc2feeb[_0xe657('0x59')]['id'],'name':_0xc2feeb[_0xe657('0x59')][_0xe657('0x4a')],'active':_0xc2feeb[_0xe657('0x59')]['active'],'callerid':_0xc2feeb[_0xe657('0x59')][_0xe657('0x5a')]};}if(_0xc2feeb[_0xe657('0x5b')]){_0x563b69[_0xe657('0x5b')]={'id':_0xc2feeb[_0xe657('0x5b')]['id'],'name':_0xc2feeb[_0xe657('0x5b')][_0xe657('0x4a')]};}var _0x2d8dad=md5(JSON['stringify'](_0x563b69));if(_0xc2feeb[_0xe657('0x4')]!==_0x2d8dad){_0xc2feeb[_0xe657('0x4')]=_0x2d8dad;this['emit'](util[_0xe657('0x49')](_0xe657('0x4e'),_0x563b69[_0xe657('0x4a')]),'voice_queue:save',_0x563b69);}}};VoiceQueueReport[_0xe657('0xd')]['isNotNull']=function(_0x1e0b42){return _0x1e0b42!==null&&!_[_0xe657('0x2d')](_0x1e0b42);};VoiceQueueReport[_0xe657('0xd')]['loopQueueShow']=function(){var _0x316a95=this;setInterval(function(){_0x316a95[_0xe657('0x36')]();ami['Action']({'action':_0xe657('0x5c')})[_0xe657('0x3c')](loggerCatch(_0xe657('0x5d')));},0x2710);};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x2b')]=function(){var _0x3ac528=this;setInterval(function(){if(_0x3ac528[_0xe657('0x5e')]){return ami[_0xe657('0x3a')]({'action':_0xe657('0x5f')})[_0xe657('0x60')](function(_0x20d980){_0x3ac528[_0xe657('0x5e')]=![];})[_0xe657('0x3c')](loggerCatch(_0xe657('0x61')));}},0x3e8);};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x18')]=function(_0x45aa92){try{if(this['isNotNull'](_0x45aa92)&&this[_0xe657('0x62')](_0x45aa92['queue'])){if(this[_0xe657('0x15')][_0x45aa92['queue']]){var _0x5aff4a=_[_0xe657('0x63')](this['channels'],_0xe657('0x64'))[_0x45aa92[_0xe657('0x64')]]||0x0;var _0x29069e=_0x5aff4a-_0x45aa92[_0xe657('0x65')];if(this[_0xe657('0x15')][_0x45aa92[_0xe657('0x64')]][_0xe657('0x33')]!==_[_0xe657('0x66')](_0x45aa92[_0xe657('0x65')])||this['voiceQueues'][_0x45aa92[_0xe657('0x64')]][_0xe657('0x52')]!==_[_0xe657('0x66')](_0x45aa92['loggedin'])||this[_0xe657('0x15')][_0x45aa92['queue']]['available']!==_[_0xe657('0x66')](_0x45aa92['available'])||this[_0xe657('0x15')][_0x45aa92[_0xe657('0x64')]]['talking']!==_0x29069e){this[_0xe657('0x15')][_0x45aa92[_0xe657('0x64')]][_0xe657('0x33')]=_['toNumber'](_0x45aa92[_0xe657('0x65')]);this['voiceQueues'][_0x45aa92['queue']][_0xe657('0x52')]=_['toNumber'](_0x45aa92[_0xe657('0x67')]);this[_0xe657('0x15')][_0x45aa92['queue']][_0xe657('0x68')]=_[_0xe657('0x66')](_0x45aa92[_0xe657('0x68')]);this[_0xe657('0x15')][_0x45aa92[_0xe657('0x64')]][_0xe657('0x31')]=_0x29069e>0x0?_0x29069e:0x0;this[_0xe657('0x15')][_0x45aa92[_0xe657('0x64')]]['talking']=this[_0xe657('0x15')][_0x45aa92[_0xe657('0x64')]][_0xe657('0x31')]>_['toNumber'](_0x45aa92[_0xe657('0x67')])?_['toNumber'](_0x45aa92[_0xe657('0x67')]):this['voiceQueues'][_0x45aa92[_0xe657('0x64')]]['talking'];this[_0xe657('0x69')](this['voiceQueues'][_0x45aa92[_0xe657('0x64')]]);}ami[_0xe657('0x47')](_0xe657('0x6a'),this[_0xe657('0x15')][_0x45aa92[_0xe657('0x64')]]);}}}catch(_0x254823){logger[_0xe657('0x3f')](_0xe657('0x6b'),util['inspect'](_0x254823,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x19')]=function(_0x3c9657){this[_0xe657('0x5e')]=!![];};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x6c')]=function(_0x51d4e6){};VoiceQueueReport[_0xe657('0xd')]['syncQueueCallerJoin']=function(_0x3f9577){try{if(this['isNotNull'](_0x3f9577)){if(_[_0xe657('0x2d')](this['queueReports'][_0x3f9577[_0xe657('0x6d')]])){this['queueReports'][_0x3f9577[_0xe657('0x6d')]]=[];this[_0xe657('0x13')][_0x3f9577[_0xe657('0x6d')]]={};}var _0x303f1a=new QueueReport();_0x303f1a[_0xe657('0x4a')]=_0x3f9577[_0xe657('0x64')];_0x303f1a[_0xe657('0x56')]=this['voiceQueues'][_0x303f1a['name']]&&this['voiceQueues'][_0x303f1a[_0xe657('0x4a')]][_0xe657('0x56')]?this[_0xe657('0x15')][_0x303f1a[_0xe657('0x4a')]][_0xe657('0x56')]||'inbound':_0xe657('0x50');_0x303f1a[_0xe657('0x64')]=_0x3f9577[_0xe657('0x64')];_0x303f1a[_0xe657('0x6e')]=moment()[_0xe657('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x303f1a[_0xe657('0x6f')]=_0x3f9577[_0xe657('0x6f')];_0x303f1a[_0xe657('0x70')]=_0x3f9577['count'];_[_0xe657('0x71')](_0x303f1a,_[_0xe657('0x72')](_0x3f9577,_[_0xe657('0x73')](_0x303f1a)));this[_0xe657('0x11')][_0x3f9577[_0xe657('0x6d')]][_0xe657('0x74')](_0x303f1a);this[_0xe657('0x13')][_0x3f9577['uniqueid']]=_0x303f1a;this[_0xe657('0x48')](_0x303f1a);}}catch(_0x275286){logger['error'](_0xe657('0x75'),util['inspect'](_0x275286,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x76')]=function(_0xead820){try{if(this[_0xe657('0x62')](_0xead820)){if(this[_0xe657('0x11')][_0xead820[_0xe657('0x6d')]]){var _0x509dcb=_[_0xe657('0x77')](this[_0xe657('0x11')][_0xead820[_0xe657('0x6d')]]);_0x509dcb[_0xe657('0x78')]=![];_0x509dcb[_0xe657('0x79')]=null;_0x509dcb[_0xe657('0x7a')]=_0xead820[_0xe657('0x7a')];_0x509dcb[_0xe657('0x7b')]=_0xead820[_0xe657('0x7b')];_0x509dcb[_0xe657('0x1d')]=!![];_0x509dcb[_0xe657('0x7c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x509dcb[_0xe657('0x7d')]=_0xe657('0x7e');_0x509dcb['lastAssignedTo']=null;this[_0xe657('0x13')][_0xead820[_0xe657('0x6d')]]=_0x509dcb;this['emitVoiceQueueChannelRemove'](_0x509dcb);}}}catch(_0x39944f){logger[_0xe657('0x3f')](_0xe657('0x7f'),util[_0xe657('0x46')](_0x39944f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x1f')]=function(_0x36697d){try{if(this[_0xe657('0x62')](_0x36697d)){if(this[_0xe657('0x11')][_0x36697d['uniqueid']]){var _0x1cb22f=_[_0xe657('0x77')](this['queueReports'][_0x36697d[_0xe657('0x6d')]]);_0x1cb22f[_0xe657('0x80')]=moment()[_0xe657('0x49')](_0xe657('0x81'));_0x1cb22f[_0xe657('0x82')]=_0x36697d[_0xe657('0x82')];_0x1cb22f[_0xe657('0x83')]=_0x36697d['connectedlinename'];this[_0xe657('0x13')][_0x36697d[_0xe657('0x6d')]]=_0x1cb22f;this[_0xe657('0x48')](_0x1cb22f);}}}catch(_0x27abca){logger[_0xe657('0x3f')](_0xe657('0x84'),util[_0xe657('0x46')](_0x27abca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe657('0xd')]['syncAgentConnect']=function(_0x9604d){try{if(this[_0xe657('0x62')](_0x9604d)){if(this[_0xe657('0x11')][_0x9604d['uniqueid']]){var _0x39d06c=_[_0xe657('0x77')](this[_0xe657('0x11')][_0x9604d['uniqueid']]);_0x39d06c['queuecallercomplete']=!![];_0x39d06c['queuecallerexitreason']=_0xe657('0x85');}}}catch(_0x18734e){logger[_0xe657('0x3f')]('[syncAgentConnect][VoiceQueueReport]',util[_0xe657('0x46')](_0x18734e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe657('0xd')][_0xe657('0x21')]=function(_0x3daea7){try{if(this[_0xe657('0x62')](_0x3daea7)){if(this['queueReports'][_0x3daea7[_0xe657('0x6d')]]){var _0x383a46=_[_0xe657('0x77')](this[_0xe657('0x11')][_0x3daea7[_0xe657('0x6d')]]);_0x383a46['queuecallerabandon']=![];_0x383a46['queuecallerabandonAt']=null;_0x383a46[_0xe657('0x86')]=!![];_0x383a46[_0xe657('0x87')]=_0x3daea7[_0xe657('0x88')];_0x383a46[_0xe657('0x7a')]=_0x3daea7[_0xe657('0x7a')];_0x383a46[_0xe657('0x78')]=!![];_0x383a46[_0xe657('0x89')]=![];_0x383a46[_0xe657('0x8a')]=null;if(!_0x383a46[_0xe657('0x8b')]){if(_0x3daea7[_0xe657('0x8c')]=='transfer'){_0x383a46[_0xe657('0x7d')]='COMPLETED';}else{if(_[_0xe657('0x8d')](_0x3daea7[_0xe657('0x3b')][_0xe657('0x8e')](),_0xe657('0x8f'))){if(this['queueReports'][_0x3daea7[_0xe657('0x90')]]){var _0xd8ca84=_[_0xe657('0x77')](this[_0xe657('0x11')][_0x3daea7[_0xe657('0x90')]]);_0xd8ca84[_0xe657('0x78')]=![];_0xd8ca84[_0xe657('0x89')]=!![];_0xd8ca84[_0xe657('0x8a')]=moment(_0x383a46[_0xe657('0x6e')])[_0xe657('0x91')](_0x3daea7['holdtime'],_0xe657('0x92'))[_0xe657('0x49')](_0xe657('0x81'));_0xd8ca84['queuecallerexitreason']=_0xe657('0x93');_0xd8ca84[_0xe657('0x8b')]=!![];_0xd8ca84[_0xe657('0x94')]='FORWARD';_0xd8ca84['transferexten']=_0x3daea7['destexten'];_0xd8ca84[_0xe657('0x95')]=_0x3daea7[_0xe657('0x6d')];var _0x38fd2c=this[_0xe657('0x11')][_0x3daea7['linkedid']];this[_0xe657('0x11')][_0x3daea7[_0xe657('0x90')]]=this[_0xe657('0x11')][_0x3daea7[_0xe657('0x6d')]];this[_0xe657('0x11')][_0x3daea7[_0xe657('0x6d')]]=_0x38fd2c;}}else{_0x383a46[_0xe657('0x7d')]='COMPLETEDBY'+_0x3daea7[_0xe657('0x8c')]['toUpperCase']();}}}this[_0xe657('0x13')][_0x3daea7[_0xe657('0x6d')]]=_0x383a46;this[_0xe657('0x45')](_0x383a46);}}}catch(_0x404f96){logger[_0xe657('0x3f')](_0xe657('0x96'),util['inspect'](_0x404f96,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x2cd52c){try{if(this[_0xe657('0x62')](_0x2cd52c)){this[_0xe657('0x97')](_0x2cd52c[_0xe657('0x6d')],_['keys'](_0x2cd52c[_0xe657('0x98')])[0x0],_0x2cd52c[_0xe657('0x99')]);if(this[_0xe657('0x11')][_0x2cd52c[_0xe657('0x6d')]]){var _0x7423ed=_[_0xe657('0x77')](this[_0xe657('0x11')][_0x2cd52c['uniqueid']]);if(_0x7423ed){if(this[_0xe657('0x62')](_0x2cd52c[_0xe657('0x98')])&&this[_0xe657('0x62')](_0x2cd52c[_0xe657('0x98')][_0xe657('0x9a')])){switch(_0x2cd52c[_0xe657('0x99')]){case _0xe657('0x9b'):_0x7423ed[_0xe657('0x89')]=![];_0x7423ed[_0xe657('0x8a')]=null;break;case _0xe657('0x9c'):_0x7423ed['lastevent']=_0xe657('0x9d');ami['emit'](_0xe657('0x9e'),_0x7423ed);break;default:_0x7423ed[_0xe657('0x89')]=!![];_0x7423ed['queuecallerexitAt']=moment()[_0xe657('0x49')](_0xe657('0x81'));_0x7423ed[_0xe657('0x80')]=moment()['format'](_0xe657('0x81'));}_0x7423ed[_0xe657('0x1d')]=![];_0x7423ed[_0xe657('0x7c')]=null;_0x7423ed[_0xe657('0x7d')]=_0x2cd52c['value'];this[_0xe657('0x13')][_0x2cd52c[_0xe657('0x6d')]]=_0x7423ed;this[_0xe657('0x45')](_0x7423ed);}else if(this[_0xe657('0x62')](_0x2cd52c['variable'])&&this[_0xe657('0x62')](_0x2cd52c[_0xe657('0x98')]['queueposition'])){if(!_0x7423ed[_0xe657('0x1d')]){_0x7423ed[_0xe657('0x89')]=!![];_0x7423ed[_0xe657('0x8a')]=moment()[_0xe657('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x7423ed['queuecallerexitreason']=_0xe657('0x9f');_0x7423ed['queuecallerleaveAt']=moment()[_0xe657('0x49')](_0xe657('0x81'));this['channels'][_0x2cd52c[_0xe657('0x6d')]]=_0x7423ed;}}_0x7423ed[_0xe657('0x17')]=this['variables'][_0x2cd52c[_0xe657('0x6d')]];}}}}catch(_0x15bdf1){logger[_0xe657('0x3f')](_0xe657('0xa0'),util['inspect'](_0x15bdf1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe657('0xd')]['addVariable']=function(_0x5c0f71,_0x1bd665,_0x2be1c5){var _0x56202d=['rtpaudioqos',_0xe657('0xa1'),_0xe657('0xa2'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xe657('0xa3'),_0xe657('0xa4'),_0xe657('0xa5'),_0xe657('0xa6'),_0xe657('0xa7'),_0xe657('0xa8'),_0xe657('0xa9'),_0xe657('0xaa'),_0xe657('0xab'),_0xe657('0xac'),_0xe657('0xad'),'membername','memberpenalty',_0xe657('0xae')];if(!_['isNil'](_0x1bd665)&&!_[_0xe657('0xaf')](_0x56202d,_0x1bd665)){if(_[_0xe657('0x2d')](this[_0xe657('0x17')][_0x5c0f71])){this[_0xe657('0x17')][_0x5c0f71]={};}this[_0xe657('0x17')][_0x5c0f71][_0x1bd665]=_0x2be1c5;}};VoiceQueueReport[_0xe657('0xd')][_0xe657('0xb0')]=function(_0x5597ae){try{if(this[_0xe657('0x62')](_0x5597ae)){if(this[_0xe657('0x11')][_0x5597ae[_0xe657('0x6d')]]){for(var _0x307d0d=0x0,_0x3bba3b={};_0x307d0d0x0?_0x38c8d2:0x0;this['voiceQueues'][_0xfa1931['queue']]['talking']=this[_0xa53b('0x13')][_0xfa1931[_0xa53b('0x61')]]['talking']>_[_0xa53b('0x64')](_0xfa1931[_0xa53b('0x65')])?_['toNumber'](_0xfa1931[_0xa53b('0x65')]):this[_0xa53b('0x13')][_0xfa1931[_0xa53b('0x61')]][_0xa53b('0x2f')];this[_0xa53b('0x47')](this[_0xa53b('0x13')][_0xfa1931['queue']]);}ami[_0xa53b('0x3f')](_0xa53b('0x66'),this[_0xa53b('0x13')][_0xfa1931[_0xa53b('0x61')]]);}}}catch(_0x5a93e0){logger[_0xa53b('0x39')]('[syncQueueSummary][VoiceQueueReport]',util['inspect'](_0x5a93e0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa53b('0xc')][_0xa53b('0x18')]=function(_0xdbe62d){this[_0xa53b('0x5b')]=!![];};VoiceQueueReport[_0xa53b('0xc')][_0xa53b('0x67')]=function(_0x175427){};VoiceQueueReport[_0xa53b('0xc')][_0xa53b('0x68')]=function(_0x14347f){try{if(this[_0xa53b('0x60')](_0x14347f)){if(_[_0xa53b('0x55')](this[_0xa53b('0x10')][_0x14347f[_0xa53b('0x69')]])){this['queueReports'][_0x14347f[_0xa53b('0x69')]]=[];this[_0xa53b('0x12')][_0x14347f[_0xa53b('0x69')]]={};}var _0x38e55f=new QueueReport();_0x38e55f['name']=_0x14347f[_0xa53b('0x61')];_0x38e55f['type']=this['voiceQueues'][_0x38e55f['name']]&&this[_0xa53b('0x13')][_0x38e55f[_0xa53b('0x41')]]['type']?this[_0xa53b('0x13')][_0x38e55f[_0xa53b('0x41')]]['type']||'inbound':_0xa53b('0x49');_0x38e55f[_0xa53b('0x61')]=_0x14347f[_0xa53b('0x61')];_0x38e55f['queuecallerjoinAt']=moment()[_0xa53b('0x40')](_0xa53b('0x6a'));_0x38e55f[_0xa53b('0x6b')]=_0x14347f[_0xa53b('0x6b')];_0x38e55f['count']=_0x14347f['count'];_[_0xa53b('0x6c')](_0x38e55f,_[_0xa53b('0x6d')](_0x14347f,_[_0xa53b('0x6e')](_0x38e55f)));this[_0xa53b('0x10')][_0x14347f[_0xa53b('0x69')]][_0xa53b('0x6f')](_0x38e55f);this[_0xa53b('0x12')][_0x14347f['uniqueid']]=_0x38e55f;this['emitVoiceQueueChannelSave'](_0x38e55f);}}catch(_0x422568){logger[_0xa53b('0x39')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xa53b('0x70')](_0x422568,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa53b('0xc')][_0xa53b('0x1a')]=function(_0x175b62){try{if(this[_0xa53b('0x60')](_0x175b62)){if(this[_0xa53b('0x10')][_0x175b62[_0xa53b('0x69')]]){var _0x2ac188=_[_0xa53b('0x71')](this[_0xa53b('0x10')][_0x175b62[_0xa53b('0x69')]]);_0x2ac188[_0xa53b('0x72')]=![];_0x2ac188[_0xa53b('0x73')]=null;_0x2ac188[_0xa53b('0x74')]=_0x175b62[_0xa53b('0x74')];_0x2ac188['originalposition']=_0x175b62[_0xa53b('0x75')];_0x2ac188['queuecallerabandon']=!![];_0x2ac188['queuecallerabandonAt']=moment()[_0xa53b('0x40')](_0xa53b('0x6a'));_0x2ac188[_0xa53b('0x76')]='ABANDONED';_0x2ac188[_0xa53b('0x77')]=null;this[_0xa53b('0x12')][_0x175b62['uniqueid']]=_0x2ac188;this[_0xa53b('0x3e')](_0x2ac188);}}}catch(_0x21eb90){logger[_0xa53b('0x39')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0xa53b('0x70')](_0x21eb90,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa53b('0x1c')]=function(_0x4711a9){try{if(this[_0xa53b('0x60')](_0x4711a9)){if(this[_0xa53b('0x10')][_0x4711a9[_0xa53b('0x69')]]){var _0x88f6cb=_[_0xa53b('0x71')](this[_0xa53b('0x10')][_0x4711a9['uniqueid']]);_0x88f6cb[_0xa53b('0x78')]=moment()[_0xa53b('0x40')](_0xa53b('0x6a'));_0x88f6cb[_0xa53b('0x79')]=_0x4711a9[_0xa53b('0x79')];_0x88f6cb[_0xa53b('0x7a')]=_0x4711a9['connectedlinename'];this[_0xa53b('0x12')][_0x4711a9[_0xa53b('0x69')]]=_0x88f6cb;this[_0xa53b('0x7b')](_0x88f6cb);}}}catch(_0x53a5c0){logger[_0xa53b('0x39')](_0xa53b('0x7c'),util[_0xa53b('0x70')](_0x53a5c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa53b('0xc')][_0xa53b('0x1f')]=function(_0x386d6f){try{if(this[_0xa53b('0x60')](_0x386d6f)){if(this['queueReports'][_0x386d6f['uniqueid']]){var _0x430fac=_[_0xa53b('0x71')](this[_0xa53b('0x10')][_0x386d6f['uniqueid']]);_0x430fac[_0xa53b('0x72')]=!![];_0x430fac[_0xa53b('0x76')]=_0xa53b('0x7d');}}}catch(_0x40b4a6){logger[_0xa53b('0x39')](_0xa53b('0x7e'),util[_0xa53b('0x70')](_0x40b4a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa53b('0xc')][_0xa53b('0x1d')]=function(_0x20d1ec){try{if(this[_0xa53b('0x60')](_0x20d1ec)){if(this[_0xa53b('0x10')][_0x20d1ec[_0xa53b('0x69')]]){var _0x1e7466=_[_0xa53b('0x71')](this[_0xa53b('0x10')][_0x20d1ec[_0xa53b('0x69')]]);_0x1e7466[_0xa53b('0x7f')]=![];_0x1e7466[_0xa53b('0x80')]=null;_0x1e7466[_0xa53b('0x81')]=!![];_0x1e7466[_0xa53b('0x77')]=_0x20d1ec[_0xa53b('0x82')];_0x1e7466['holdtime']=_0x20d1ec[_0xa53b('0x74')];_0x1e7466[_0xa53b('0x72')]=!![];_0x1e7466['queuecallerexit']=![];_0x1e7466['queuecallerexitAt']=null;if(!_0x1e7466['transfer']){if(_0x20d1ec[_0xa53b('0x83')]=='transfer'){_0x1e7466[_0xa53b('0x76')]='COMPLETED';}else{if(_['startsWith'](_0x20d1ec[_0xa53b('0x35')][_0xa53b('0x84')](),_0xa53b('0x85'))){if(this[_0xa53b('0x10')][_0x20d1ec['linkedid']]){var _0x398c71=_['last'](this[_0xa53b('0x10')][_0x20d1ec[_0xa53b('0x86')]]);_0x398c71[_0xa53b('0x72')]=![];_0x398c71[_0xa53b('0x87')]=!![];_0x398c71[_0xa53b('0x88')]=moment(_0x1e7466['queuecallerjoinAt'])['add'](_0x20d1ec[_0xa53b('0x74')],_0xa53b('0x89'))['format'](_0xa53b('0x6a'));_0x398c71['queuecallerexitreason']=_0xa53b('0x8a');_0x398c71['transfer']=!![];_0x398c71[_0xa53b('0x8b')]='FORWARD';_0x398c71['transferexten']=_0x20d1ec[_0xa53b('0x8c')];_0x398c71['transferuniqueid']=_0x20d1ec[_0xa53b('0x69')];var _0x808ad2=this[_0xa53b('0x10')][_0x20d1ec[_0xa53b('0x86')]];this[_0xa53b('0x10')][_0x20d1ec[_0xa53b('0x86')]]=this[_0xa53b('0x10')][_0x20d1ec[_0xa53b('0x69')]];this[_0xa53b('0x10')][_0x20d1ec['uniqueid']]=_0x808ad2;}}else{_0x1e7466[_0xa53b('0x76')]='COMPLETEDBY'+_0x20d1ec[_0xa53b('0x83')][_0xa53b('0x8d')]();}}}this[_0xa53b('0x12')][_0x20d1ec[_0xa53b('0x69')]]=_0x1e7466;this[_0xa53b('0x3e')](_0x1e7466);}}}catch(_0x1f3f51){logger[_0xa53b('0x39')]('[syncAgentComplete][VoiceQueueReport]',util['inspect'](_0x1f3f51,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa53b('0x8e')]=function(_0x1547b2){try{if(this[_0xa53b('0x60')](_0x1547b2)){this[_0xa53b('0x8f')](_0x1547b2[_0xa53b('0x69')],_[_0xa53b('0x6e')](_0x1547b2[_0xa53b('0x90')])[0x0],_0x1547b2[_0xa53b('0x91')]);if(this[_0xa53b('0x10')][_0x1547b2['uniqueid']]){var _0x54519a=_[_0xa53b('0x71')](this[_0xa53b('0x10')][_0x1547b2[_0xa53b('0x69')]]);if(_0x54519a){if(this[_0xa53b('0x60')](_0x1547b2[_0xa53b('0x90')])&&this[_0xa53b('0x60')](_0x1547b2[_0xa53b('0x90')][_0xa53b('0x92')])){switch(_0x1547b2[_0xa53b('0x91')]){case _0xa53b('0x93'):_0x54519a[_0xa53b('0x87')]=![];_0x54519a['queuecallerexitAt']=null;break;case _0xa53b('0x94'):_0x54519a[_0xa53b('0x95')]=_0xa53b('0x96');ami[_0xa53b('0x3f')]('custom:timeout',_0x54519a);break;default:_0x54519a[_0xa53b('0x87')]=!![];_0x54519a['queuecallerexitAt']=moment()[_0xa53b('0x40')]('YYYY-MM-DD\x20HH:mm:ss');_0x54519a[_0xa53b('0x78')]=moment()[_0xa53b('0x40')](_0xa53b('0x6a'));}_0x54519a[_0xa53b('0x7f')]=![];_0x54519a['queuecallerabandonAt']=null;_0x54519a[_0xa53b('0x76')]=_0x1547b2[_0xa53b('0x91')];this['channels'][_0x1547b2['uniqueid']]=_0x54519a;this['emitVoiceQueueChannelRemove'](_0x54519a);}else if(this[_0xa53b('0x60')](_0x1547b2[_0xa53b('0x90')])&&this[_0xa53b('0x60')](_0x1547b2[_0xa53b('0x90')][_0xa53b('0x97')])){if(!_0x54519a[_0xa53b('0x7f')]){_0x54519a[_0xa53b('0x87')]=!![];_0x54519a[_0xa53b('0x88')]=moment()[_0xa53b('0x40')](_0xa53b('0x6a'));_0x54519a['queuecallerexitreason']=_0xa53b('0x98');_0x54519a[_0xa53b('0x78')]=moment()[_0xa53b('0x40')](_0xa53b('0x6a'));this[_0xa53b('0x12')][_0x1547b2[_0xa53b('0x69')]]=_0x54519a;}}_0x54519a[_0xa53b('0x15')]=this['variables'][_0x1547b2[_0xa53b('0x69')]];}}}}catch(_0x915438){logger['error'](_0xa53b('0x99'),util[_0xa53b('0x70')](_0x915438,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa53b('0x8f')]=function(_0x43520e,_0xa7f0d3,_0x4abddc){var _0x2b8fd4=[_0xa53b('0x9a'),_0xa53b('0x9b'),_0xa53b('0x9c'),'rtpaudioqosjitterbridged',_0xa53b('0x9d'),'rtpaudioqoslossbridged',_0xa53b('0x9e'),_0xa53b('0x9f'),'sipcallid',_0xa53b('0xa0'),_0xa53b('0xa1'),'bridgepvtcallid',_0xa53b('0xa2'),'memberdynamic','memberinterface',_0xa53b('0xa3'),_0xa53b('0x82'),_0xa53b('0xa4'),_0xa53b('0xa5')];if(!_[_0xa53b('0xa6')](_0xa7f0d3)&&!_[_0xa53b('0xa7')](_0x2b8fd4,_0xa7f0d3)){if(_[_0xa53b('0x55')](this[_0xa53b('0x15')][_0x43520e])){this['variables'][_0x43520e]={};}this[_0xa53b('0x15')][_0x43520e][_0xa7f0d3]=_0x4abddc;}};VoiceQueueReport['prototype']['syncHangup']=function(_0xaa34fe){try{if(this['isNotNull'](_0xaa34fe)){if(this['queueReports'][_0xaa34fe[_0xa53b('0x69')]]){for(var _0x5143d6=0x0,_0x325559={};_0x5143d6=0x0?moment(_0x1a9712[_0xeb96('0x18')])['diff'](_0x1a9712[_0xeb96('0x17')],_0xeb96('0x19')):null,'data1':_0xeb96('0x1a'),'data2':_0x1a9712[_0xeb96('0x12')],'data3':_0x1a9712['exten'],'data4':_0x1a9712['dialstring']||null,'role':_0xeb96('0x11'),'internal':_0x1a9712['accountcode']?_[_0xeb96('0x13')](_0x1a9712[_0xeb96('0x12')]):undefined,'uniqueid':_0x1a9712[_0xeb96('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x7f8f=['isNil','interface','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','exten','dialstring','toNumber','lodash','../client','queuecallercompleteAt','Request','CreateMemberReport'];(function(_0x377252,_0x3d4fdc){var _0x5c2e82=function(_0x50c958){while(--_0x50c958){_0x377252['push'](_0x377252['shift']());}};_0x5c2e82(++_0x3d4fdc);}(_0x7f8f,0x199));var _0xf7f8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f8f[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var _=require(_0xf7f8('0x0'));var util=require('util');var client=require(_0xf7f8('0x1'));exports['voiceQueueReport']=function(_0x4c4a66){var _0x4de6dd=_0x4c4a66[_0xf7f8('0x2')]||_0x4c4a66['queuecallerexitAt'];return client[_0xf7f8('0x3')](_0xf7f8('0x4'),{'body':{'channel':'voice','membername':_0x4c4a66['lastAssignedTo'],'interface':_[_0xf7f8('0x5')](_0x4c4a66[_0xf7f8('0x6')])?util['format']('SIP/%s',_0x4c4a66[_0xf7f8('0x7')]):_0x4c4a66['interface'],'type':_0xf7f8('0x8'),'enterAt':_0x4c4a66[_0xf7f8('0x9')],'exitAt':_0x4de6dd,'duration':moment(_0x4de6dd)[_0xf7f8('0xa')](_0x4c4a66['queuecallerleaveAt'],_0xf7f8('0xb')),'data1':_0xf7f8('0xc'),'data2':_0x4c4a66[_0xf7f8('0xd')],'data3':_0x4c4a66['exten'],'data4':null,'data5':_0x4c4a66['queue'],'role':'agent','internal':_0x4c4a66[_0xf7f8('0xe')]?_['toNumber'](_0x4c4a66[_0xf7f8('0xe')]):undefined,'uniqueid':_0x4c4a66[_0xf7f8('0xf')]},'log':_0xf7f8('0x4')});};exports[_0xf7f8('0x10')]=function(_0x1c1f34){return client[_0xf7f8('0x3')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x1c1f34[_0xf7f8('0x11')],'interface':_0x1c1f34[_0xf7f8('0x6')],'type':_0xf7f8('0x8'),'enterAt':_0x1c1f34[_0xf7f8('0x12')],'exitAt':_0x1c1f34[_0xf7f8('0x13')],'duration':moment(_0x1c1f34['endtime'])[_0xf7f8('0xa')](_0x1c1f34[_0xf7f8('0x12')],_0xf7f8('0xb'))>=0x0?moment(_0x1c1f34[_0xf7f8('0x13')])[_0xf7f8('0xa')](_0x1c1f34[_0xf7f8('0x12')],_0xf7f8('0xb')):null,'data1':'outbound','data2':_0x1c1f34[_0xf7f8('0xe')],'data3':_0x1c1f34[_0xf7f8('0x14')],'data4':_0x1c1f34[_0xf7f8('0x15')]||null,'role':'agent','internal':_0x1c1f34[_0xf7f8('0xe')]?_[_0xf7f8('0x16')](_0x1c1f34[_0xf7f8('0xe')]):undefined,'uniqueid':_0x1c1f34[_0xf7f8('0xf')]},'log':_0xf7f8('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 503797a..ff777f7 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 _0x593e=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x593e,0xcb));var _0xe593=function(_0x1b5bc7,_0x5b6007){_0x1b5bc7=_0x1b5bc7-0x0;var _0x4b87ac=_0x593e[_0x1b5bc7];return _0x4b87ac;};'use strict';var client=require(_0xe593('0x0'));exports[_0xe593('0x1')]=function(_0x12f6de){return function(_0x28f28c){return client[_0xe593('0x2')](_0xe593('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe593('0x4'),_0xe593('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x2750=['../client','Request','GetTemplate','name','html'];(function(_0x35b4fb,_0x35459d){var _0x422af3=function(_0x2721ae){while(--_0x2721ae){_0x35b4fb['push'](_0x35b4fb['shift']());}};_0x422af3(++_0x35459d);}(_0x2750,0x13b));var _0x0275=function(_0x37aba2,_0x5ef575){_0x37aba2=_0x37aba2-0x0;var _0x5b28c4=_0x2750[_0x37aba2];return _0x5b28c4;};'use strict';var client=require(_0x0275('0x0'));exports['getTemplates']=function(_0xf4568){return function(_0xf2ae71){return client[_0x0275('0x1')](_0x0275('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0275('0x3'),_0x0275('0x4')]},'log':_0x0275('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index f172dd0..7f63cff 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 _0xc7b2=['getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','action','data1','data2','data3','data4','data7'];(function(_0x2cdde8,_0x22e82f){var _0x460210=function(_0x331cf2){while(--_0x331cf2){_0x2cdde8['push'](_0x2cdde8['shift']());}};_0x460210(++_0x22e82f);}(_0xc7b2,0x1ee));var _0x2c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x2c7b('0x0')]=function(_0xc88579){return function(_0x419e3a){return client[_0x2c7b('0x1')](_0x2c7b('0x2'),{'options':{'raw':![],'attributes':['id',_0x2c7b('0x3'),_0x2c7b('0x4'),_0x2c7b('0x5')],'include':[{'model':_0x2c7b('0x6'),'as':_0x2c7b('0x7'),'attributes':['id',_0x2c7b('0x8'),_0x2c7b('0x9'),_0x2c7b('0xa')]},{'model':'Condition','as':_0x2c7b('0xb'),'attributes':['id',_0x2c7b('0x8'),_0x2c7b('0x9'),_0x2c7b('0xa')]},{'model':_0x2c7b('0xc'),'as':'Actions','attributes':['id',_0x2c7b('0xd'),_0x2c7b('0xe'),_0x2c7b('0xf'),_0x2c7b('0x10'),_0x2c7b('0x11'),'data5','data6',_0x2c7b('0x12')]}]},'log':_0x2c7b('0x2')});};}; \ No newline at end of file +var _0x018c=['AnyConditions','field','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','operator','value'];(function(_0x4ff093,_0x5d1a19){var _0x5360e0=function(_0x131a75){while(--_0x131a75){_0x4ff093['push'](_0x4ff093['shift']());}};_0x5360e0(++_0x5d1a19);}(_0x018c,0x1c5));var _0xc018=function(_0x36078f,_0x4d706b){_0x36078f=_0x36078f-0x0;var _0xa41d86=_0x018c[_0x36078f];return _0xa41d86;};'use strict';var client=require(_0xc018('0x0'));exports[_0xc018('0x1')]=function(_0xf3cac5){return function(_0xac4fc4){return client[_0xc018('0x2')](_0xc018('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xc018('0x4'),_0xc018('0x5')],'include':[{'model':_0xc018('0x6'),'as':'AllConditions','attributes':['id','field',_0xc018('0x7'),_0xc018('0x8')]},{'model':_0xc018('0x6'),'as':_0xc018('0x9'),'attributes':['id',_0xc018('0xa'),_0xc018('0x7'),_0xc018('0x8')]},{'model':_0xc018('0xb'),'as':_0xc018('0xc'),'attributes':['id',_0xc018('0xd'),_0xc018('0xe'),_0xc018('0xf'),_0xc018('0x10'),_0xc018('0x11'),_0xc018('0x12'),_0xc018('0x13'),_0xc018('0x14')]}]},'log':_0xc018('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5375571..7e4cf6b 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 _0xc439=['../client','registry'];(function(_0x23b70b,_0x827be7){var _0x69d657=function(_0x49decf){while(--_0x49decf){_0x23b70b['push'](_0x23b70b['shift']());}};_0x69d657(++_0x827be7);}(_0xc439,0x1ae));var _0x9c43=function(_0x524207,_0x472f6f){_0x524207=_0x524207-0x0;var _0x2ca475=_0xc439[_0x524207];return _0x2ca475;};'use strict';var client=require(_0x9c43('0x0'));exports['getTrunks']=function(_0x3231f2){return function(_0x1ec87d){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x9c43('0x1')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x5ee2=['name','registry','../client','getTrunks','Request','GetTrunk'];(function(_0x5f36fb,_0x562c4f){var _0x2e9f8a=function(_0x473b4a){while(--_0x473b4a){_0x5f36fb['push'](_0x5f36fb['shift']());}};_0x2e9f8a(++_0x562c4f);}(_0x5ee2,0x6e));var _0x25ee=function(_0x15498a,_0x2a85c9){_0x15498a=_0x15498a-0x0;var _0x4560f7=_0x5ee2[_0x15498a];return _0x4560f7;};'use strict';var client=require(_0x25ee('0x0'));exports[_0x25ee('0x1')]=function(_0x90595d){return function(_0x371729){return client[_0x25ee('0x2')](_0x25ee('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x25ee('0x4'),_0x25ee('0x5')]},'log':_0x25ee('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 856f961..4985ca0 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 _0xd9fb=['voicePause','phone','mobile','GetUser','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','lastPauseAt','../client','getAgents','Request','name','email','accountcode','fullname','online','lastLoginAt','pauseType'];(function(_0x18fa31,_0x484e09){var _0x331c2f=function(_0x4a66c0){while(--_0x4a66c0){_0x18fa31['push'](_0x18fa31['shift']());}};_0x331c2f(++_0x484e09);}(_0xd9fb,0x182));var _0xbd9f=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xd9fb[_0x376b45];return _0x2341b3;};'use strict';var client=require(_0xbd9f('0x0'));exports[_0xbd9f('0x1')]=function(){return function(){return client[_0xbd9f('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xbd9f('0x3'),_0xbd9f('0x4'),_0xbd9f('0x5'),_0xbd9f('0x6'),_0xbd9f('0x7'),_0xbd9f('0x8'),_0xbd9f('0x9'),'lastPauseAt',_0xbd9f('0xa'),_0xbd9f('0xb'),_0xbd9f('0xc'),'interface']},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0xbd9f('0x2')](_0xbd9f('0xd'),{'options':{'raw':!![],'where':{'role':_0xbd9f('0xe')},'attributes':['id',_0xbd9f('0x3'),_0xbd9f('0x5'),_0xbd9f('0xf')]},'log':'getTelephones'});};};exports[_0xbd9f('0x10')]=function(_0x3bbbc0,_0x19ef67,_0x12b4b8){return client[_0xbd9f('0x2')](_0xbd9f('0x11'),{'body':{'type':_0x19ef67,'uniqueid':_0x12b4b8},'options':{'where':{'id':_0x3bbbc0['id']}},'log':_0xbd9f('0x10')});};exports[_0xbd9f('0x12')]=function(_0x339564){return client[_0xbd9f('0x2')](_0xbd9f('0x13'),{'body':{},'options':{'where':{'id':_0x339564['id']}},'log':'savePause'});};exports[_0xbd9f('0x14')]=function(_0xae5813){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0xae5813},'attributes':['id',_0xbd9f('0x3'),_0xbd9f('0x4'),_0xbd9f('0x5'),_0xbd9f('0x6'),_0xbd9f('0x7'),'lastLoginAt','pauseType',_0xbd9f('0x15'),_0xbd9f('0xa'),'interface']},'log':'getAgent'});}; \ No newline at end of file +var _0xa219=['savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','pauseType','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','lastLoginAt','lastPauseAt','voicePause','mobile','interface','telephone','internal','getTelephones'];(function(_0x236673,_0x11daf2){var _0x44e60a=function(_0x10f2a5){while(--_0x10f2a5){_0x236673['push'](_0x236673['shift']());}};_0x44e60a(++_0x11daf2);}(_0xa219,0x11a));var _0x9a21=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xa219[_0xb833b1];return _0x1ab87a;};'use strict';var client=require('../client');exports[_0x9a21('0x0')]=function(){return function(){return client[_0x9a21('0x1')](_0x9a21('0x2'),{'options':{'raw':![],'where':{'role':_0x9a21('0x3')},'attributes':['id',_0x9a21('0x4'),_0x9a21('0x5'),_0x9a21('0x6'),_0x9a21('0x7'),_0x9a21('0x8'),_0x9a21('0x9'),'pauseType',_0x9a21('0xa'),_0x9a21('0xb'),'phone',_0x9a21('0xc'),_0x9a21('0xd')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client['Request'](_0x9a21('0x2'),{'options':{'raw':!![],'where':{'role':_0x9a21('0xe')},'attributes':['id',_0x9a21('0x4'),_0x9a21('0x6'),_0x9a21('0xf')]},'log':_0x9a21('0x10')});};};exports[_0x9a21('0x11')]=function(_0xe73511,_0x49fb08,_0x518e10){return client[_0x9a21('0x1')](_0x9a21('0x12'),{'body':{'type':_0x49fb08,'uniqueid':_0x518e10},'options':{'where':{'id':_0xe73511['id']}},'log':_0x9a21('0x11')});};exports[_0x9a21('0x13')]=function(_0x256922){return client[_0x9a21('0x1')](_0x9a21('0x14'),{'body':{},'options':{'where':{'id':_0x256922['id']}},'log':'savePause'});};exports[_0x9a21('0x15')]=function(_0x3a32c8){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x9a21('0x3'),'id':_0x3a32c8},'attributes':['id',_0x9a21('0x4'),_0x9a21('0x5'),_0x9a21('0x6'),_0x9a21('0x7'),'online','lastLoginAt',_0x9a21('0x16'),'lastPauseAt',_0x9a21('0xb'),_0x9a21('0xd')]},'log':_0x9a21('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index a4d6d3f..ee19255 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 _0x7ea8=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x3f69c2,_0x332698){var _0x52f1be=function(_0x1582c0){while(--_0x1582c0){_0x3f69c2['push'](_0x3f69c2['shift']());}};_0x52f1be(++_0x332698);}(_0x7ea8,0x1d1));var _0x87ea=function(_0x15ab4e,_0x2d2b5c){_0x15ab4e=_0x15ab4e-0x0;var _0x7ca3fa=_0x7ea8[_0x15ab4e];return _0x7ca3fa;};'use strict';var client=require(_0x87ea('0x0'));exports[_0x87ea('0x1')]=function(_0x12f3aa){return client[_0x87ea('0x2')](_0x87ea('0x3'),{'body':_0x12f3aa,'log':'CreateVoiceAgentReport'});};exports[_0x87ea('0x4')]=function(_0x13d857,_0x3580b3,_0x5586af){return client['Request'](_0x87ea('0x5'),{'body':_0x13d857,'options':{'where':{'uniqueid':_0x3580b3,'interface':_0x5586af,'agentcomplete':!![]}},'log':_0x87ea('0x5')});}; \ No newline at end of file +var _0x34ec=['update','Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x34ec,0x129));var _0xc34e=function(_0x5979f3,_0x924533){_0x5979f3=_0x5979f3-0x0;var _0x39927e=_0x34ec[_0x5979f3];return _0x39927e;};'use strict';var client=require(_0xc34e('0x0'));exports[_0xc34e('0x1')]=function(_0x5a03e3){return client['Request'](_0xc34e('0x2'),{'body':_0x5a03e3,'log':'CreateVoiceAgentReport'});};exports[_0xc34e('0x3')]=function(_0xeacd9b,_0x3711e3,_0x31b2bb){return client[_0xc34e('0x4')]('UpdateVoiceAgentReport',{'body':_0xeacd9b,'options':{'where':{'uniqueid':_0x3711e3,'interface':_0x31b2bb,'agentcomplete':!![]}},'log':_0xc34e('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index c915d89..e14c078 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 _0xe113=['merge','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe113,0x1f1));var _0x3e11=function(_0x50a07c,_0x416d7a){_0x50a07c=_0x50a07c-0x0;var _0xdf8e4c=_0xe113[_0x50a07c];return _0xdf8e4c;};'use strict';var moment=require(_0x3e11('0x0'));var util=require(_0x3e11('0x1'));var _=require(_0x3e11('0x2'));var client=require(_0x3e11('0x3'));exports[_0x3e11('0x4')]=function(_0x589590){return client[_0x3e11('0x5')](_0x3e11('0x6'),{'body':_[_0x3e11('0x7')](_0x589590,{'source':_0x589590['calleridnum'],'destinationcontext':_0x589590[_0x3e11('0x8')],'callerid':_0x589590[_0x3e11('0x9')],'amaflags':_0x3e11('0xa')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x3e11('0x5')](_0x3e11('0xb'),{'options':{'where':{'type':[_0x3e11('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x3e11('0xd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x3e11('0xe')]('day')[_0x3e11('0xf')](_0x3e11('0x10'))]}},'attributes':[_0x3e11('0x11'),_0x3e11('0x12'),'duration',_0x3e11('0x13')]},'log':_0x3e11('0x14')});};}; \ No newline at end of file +var _0x0908=['calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','create','CreateVoiceCallReport'];(function(_0x5857bb,_0x45bbfa){var _0x490455=function(_0x577524){while(--_0x577524){_0x5857bb['push'](_0x5857bb['shift']());}};_0x490455(++_0x45bbfa);}(_0x0908,0x160));var _0x8090=function(_0x34b21c,_0x30f6a2){_0x34b21c=_0x34b21c-0x0;var _0x11b2c1=_0x0908[_0x34b21c];return _0x11b2c1;};'use strict';var moment=require(_0x8090('0x0'));var util=require(_0x8090('0x1'));var _=require(_0x8090('0x2'));var client=require('../client');exports[_0x8090('0x3')]=function(_0x23195d){return client['Request'](_0x8090('0x4'),{'body':_['merge'](_0x23195d,{'source':_0x23195d[_0x8090('0x5')],'destinationcontext':_0x23195d[_0x8090('0x6')],'callerid':_0x23195d[_0x8090('0x7')],'amaflags':_0x8090('0x8')}),'log':_0x8090('0x4')});};exports[_0x8090('0x9')]=function(){return function(){return client[_0x8090('0xa')](_0x8090('0xb'),{'options':{'where':{'type':[_0x8090('0xc')],'createdAt':{'$between':[moment()[_0x8090('0xd')](_0x8090('0xe'))[_0x8090('0xf')](_0x8090('0x10')),moment()[_0x8090('0x11')](_0x8090('0xe'))[_0x8090('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x8090('0x12'),'duration',_0x8090('0x13')]},'log':_0x8090('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a57940c..dc49f47 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 _0xbd64=['Request','CreateVoiceDialReport','../client','create'];(function(_0xe0a974,_0x421f81){var _0xf3deff=function(_0x9578cb){while(--_0x9578cb){_0xe0a974['push'](_0xe0a974['shift']());}};_0xf3deff(++_0x421f81);}(_0xbd64,0xb6));var _0x4bd6=function(_0x40337e,_0x40abfb){_0x40337e=_0x40337e-0x0;var _0x3abe5b=_0xbd64[_0x40337e];return _0x3abe5b;};'use strict';var client=require(_0x4bd6('0x0'));exports[_0x4bd6('0x1')]=function(_0x240a78){return client[_0x4bd6('0x2')](_0x4bd6('0x3'),{'body':_0x240a78,'log':_0x4bd6('0x3')});}; \ No newline at end of file +var _0xfaa6=['CreateVoiceDialReport','../client','create','Request'];(function(_0x25c06f,_0x2e45a2){var _0x5657f2=function(_0x579264){while(--_0x579264){_0x25c06f['push'](_0x25c06f['shift']());}};_0x5657f2(++_0x2e45a2);}(_0xfaa6,0x17d));var _0x6faa=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0xfaa6[_0x4fda88];return _0xe37511;};'use strict';var client=require(_0x6faa('0x0'));exports[_0x6faa('0x1')]=function(_0x114110){return client[_0x6faa('0x2')]('CreateVoiceDialReport',{'body':_0x114110,'log':_0x6faa('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 90c9880..56d862e 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 _0x3c66=['exten','recordingFormat','getVoiceExtensions','GetVoiceExtension'];(function(_0xcd4d8e,_0x1fc2fd){var _0x1c3c61=function(_0x293f3c){while(--_0x293f3c){_0xcd4d8e['push'](_0xcd4d8e['shift']());}};_0x1c3c61(++_0x1fc2fd);}(_0x3c66,0x8b));var _0x63c6=function(_0x51a8b4,_0xbf4897){_0x51a8b4=_0x51a8b4-0x0;var _0x587c09=_0x3c66[_0x51a8b4];return _0x587c09;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x63c6('0x0'),{'options':{'raw':!![],'attributes':['id',_0x63c6('0x1'),_0x63c6('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x63c6('0x3')});};}; \ No newline at end of file +var _0xf84a=['GetVoiceExtension','exten','recordingFormat','Request'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf84a,0x97));var _0xaf84=function(_0x323414,_0x36eece){_0x323414=_0x323414-0x0;var _0xdb5790=_0xf84a[_0x323414];return _0xdb5790;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xaf84('0x0')](_0xaf84('0x1'),{'options':{'raw':!![],'attributes':['id',_0xaf84('0x2'),_0xaf84('0x3')],'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 592cf62..23df6f3 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 _0x11ac=['Request','GetVoiceQueue','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','Trunk','name','callerid','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues'];(function(_0x9da4a0,_0xf70b53){var _0x505857=function(_0x516ffc){while(--_0x516ffc){_0x9da4a0['push'](_0x9da4a0['shift']());}};_0x505857(++_0xf70b53);}(_0x11ac,0x1a2));var _0xc11a=function(_0xf4a280,_0xdeedbc){_0xf4a280=_0xf4a280-0x0;var _0x15cbcc=_0x11ac[_0xf4a280];return _0x15cbcc;};'use strict';var client=require(_0xc11a('0x0'));exports[_0xc11a('0x1')]=function(){return function(){return client[_0xc11a('0x2')](_0xc11a('0x3'),{'options':{'raw':![],'attributes':['id','name','acw','acwTimeout',_0xc11a('0x4'),_0xc11a('0x5'),_0xc11a('0x6'),_0xc11a('0x7'),_0xc11a('0x8'),_0xc11a('0x9'),_0xc11a('0xa'),'dialPowerLevel',_0xc11a('0xb'),_0xc11a('0xc'),_0xc11a('0xd'),_0xc11a('0xe'),_0xc11a('0xf'),_0xc11a('0x10'),_0xc11a('0x11'),_0xc11a('0x12'),'dialQueueProject',_0xc11a('0x13'),_0xc11a('0x14'),'dialBusyMaxRetry',_0xc11a('0x15'),_0xc11a('0x16'),_0xc11a('0x17'),_0xc11a('0x18'),'dialTimezone',_0xc11a('0x19'),_0xc11a('0x1a'),_0xc11a('0x1b'),_0xc11a('0x1c'),_0xc11a('0x1d'),_0xc11a('0x1e'),_0xc11a('0x1f'),_0xc11a('0x20'),_0xc11a('0x21'),_0xc11a('0x22'),_0xc11a('0x23'),_0xc11a('0x24'),_0xc11a('0x25'),_0xc11a('0x26'),'dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt',_0xc11a('0x27'),_0xc11a('0x28'),_0xc11a('0x29'),_0xc11a('0x5'),'strategy',_0xc11a('0x2a'),_0xc11a('0x2b'),_0xc11a('0x2c'),_0xc11a('0x2d'),_0xc11a('0x2e'),'dialDropRetryFrequency',_0xc11a('0x2f'),_0xc11a('0x30'),_0xc11a('0x31'),'dialMachineRetryFrequency',_0xc11a('0x32'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0xc11a('0x33'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0xc11a('0x34'),'attributes':['id',_0xc11a('0x35'),_0xc11a('0x36'),'active']},{'model':'Pause','as':_0xc11a('0x37'),'attributes':['id',_0xc11a('0x35')]},{'model':_0xc11a('0x34'),'as':_0xc11a('0x38'),'attributes':['id',_0xc11a('0x35'),_0xc11a('0x36'),'active']},{'model':'Interval','as':_0xc11a('0x39'),'attributes':['id',_0xc11a('0x35')],'include':[{'model':_0xc11a('0x39'),'as':_0xc11a('0x3a'),'attributes':['id',_0xc11a('0x35'),_0xc11a('0x3b')]}]}]},'log':_0xc11a('0x1')});};}; \ No newline at end of file +var _0x349f=['dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel'];(function(_0x173902,_0x4566cb){var _0x51b113=function(_0x50aae9){while(--_0x50aae9){_0x173902['push'](_0x173902['shift']());}};_0x51b113(++_0x4566cb);}(_0x349f,0xa8));var _0xf349=function(_0x1fd5a6,_0x377a8a){_0x1fd5a6=_0x1fd5a6-0x0;var _0x5af876=_0x349f[_0x1fd5a6];return _0x5af876;};'use strict';var client=require(_0xf349('0x0'));exports[_0xf349('0x1')]=function(){return function(){return client[_0xf349('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xf349('0x3'),_0xf349('0x4'),_0xf349('0x5'),_0xf349('0x6'),_0xf349('0x7'),_0xf349('0x8'),_0xf349('0x9'),_0xf349('0xa'),_0xf349('0xb'),_0xf349('0xc'),'dialPowerLevel',_0xf349('0xd'),_0xf349('0xe'),_0xf349('0xf'),_0xf349('0x10'),_0xf349('0x11'),_0xf349('0x12'),_0xf349('0x13'),'dialQueueTimeout','dialQueueProject',_0xf349('0x14'),_0xf349('0x15'),_0xf349('0x16'),_0xf349('0x17'),_0xf349('0x18'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0xf349('0x19'),_0xf349('0x1a'),_0xf349('0x1b'),_0xf349('0x1c'),_0xf349('0x1d'),'dialAMDGreeting',_0xf349('0x1e'),_0xf349('0x1f'),'dialAMDMinWordLength',_0xf349('0x20'),_0xf349('0x21'),'dialAMDSilenceThreshold',_0xf349('0x22'),'timeout',_0xf349('0x23'),_0xf349('0x24'),_0xf349('0x25'),_0xf349('0x26'),_0xf349('0x27'),_0xf349('0x28'),_0xf349('0x7'),'strategy',_0xf349('0x29'),'dialCutDigit',_0xf349('0x2a'),_0xf349('0x2b'),_0xf349('0x2c'),_0xf349('0x2d'),_0xf349('0x2e'),_0xf349('0x2f'),_0xf349('0x30'),_0xf349('0x31'),'dialAgentRejectMaxRetry',_0xf349('0x32'),'mandatoryDisposition',_0xf349('0x33'),_0xf349('0x34')],'include':[{'model':_0xf349('0x35'),'as':'Trunk','attributes':['id',_0xf349('0x3'),_0xf349('0x36'),_0xf349('0x37')]},{'model':'Pause','as':_0xf349('0x38'),'attributes':['id',_0xf349('0x3')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id','name',_0xf349('0x36'),_0xf349('0x37')]},{'model':_0xf349('0x39'),'as':'Interval','attributes':['id',_0xf349('0x3')],'include':[{'model':_0xf349('0x39'),'as':_0xf349('0x3a'),'attributes':['id',_0xf349('0x3'),_0xf349('0x3b')]}]}]},'log':_0xf349('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1c6637b..71d4e41 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 _0x176a=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandon','queuecallerabandonAt','moment','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf'];(function(_0x9c5ebe,_0x19884c){var _0x39a068=function(_0x9a0fd6){while(--_0x9a0fd6){_0x9c5ebe['push'](_0x9c5ebe['shift']());}};_0x39a068(++_0x19884c);}(_0x176a,0x8a));var _0xa176=function(_0x2c43e0,_0x1b7d5c){_0x2c43e0=_0x2c43e0-0x0;var _0x30f3e5=_0x176a[_0x2c43e0];return _0x30f3e5;};'use strict';var moment=require(_0xa176('0x0'));var _=require('lodash');var client=require('../client');exports['create']=function(_0x2f4d2d){return client[_0xa176('0x1')]('CreateVoiceQueueReport',{'body':_0x2f4d2d,'log':_0xa176('0x2')});};exports[_0xa176('0x3')]=function(){return function(){return client[_0xa176('0x1')](_0xa176('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xa176('0x5')](_0xa176('0x6'))[_0xa176('0x7')](_0xa176('0x8')),moment()[_0xa176('0x9')](_0xa176('0x6'))[_0xa176('0x7')](_0xa176('0x8'))]}},'attributes':[_0xa176('0xa'),_0xa176('0xb'),'queuecallerjoinAt',_0xa176('0xc'),_0xa176('0xd'),_0xa176('0xe'),_0xa176('0xf'),'queuecallerexitAt',_0xa176('0x10'),_0xa176('0x11')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x0413=['GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','../client','create','Request','getVoiceQueueReports'];(function(_0x1622a0,_0x2b55a9){var _0x2a2308=function(_0x38d05b){while(--_0x38d05b){_0x1622a0['push'](_0x1622a0['shift']());}};_0x2a2308(++_0x2b55a9);}(_0x0413,0xc3));var _0x3041=function(_0xc8cf1b,_0x6d738f){_0xc8cf1b=_0xc8cf1b-0x0;var _0x191604=_0x0413[_0xc8cf1b];return _0x191604;};'use strict';var moment=require(_0x3041('0x0'));var _=require('lodash');var client=require(_0x3041('0x1'));exports[_0x3041('0x2')]=function(_0x22fcc4){return client[_0x3041('0x3')]('CreateVoiceQueueReport',{'body':_0x22fcc4,'log':'CreateVoiceQueueReport'});};exports[_0x3041('0x4')]=function(){return function(){return client[_0x3041('0x3')](_0x3041('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x3041('0x6')](_0x3041('0x7'))[_0x3041('0x8')](_0x3041('0x9')),moment()[_0x3041('0xa')]('day')[_0x3041('0x8')](_0x3041('0x9'))]}},'attributes':[_0x3041('0xb'),_0x3041('0xc'),_0x3041('0xd'),_0x3041('0xe'),_0x3041('0xf'),_0x3041('0x10'),'queuecallerexit',_0x3041('0x11'),'queuecallerabandon',_0x3041('0x12')]},'log':_0x3041('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 9aa6d17..69f15e8 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 _0x8b06=['Request','../client','getVoiceQueueRtPauses'];(function(_0x54ad5e,_0x5eeeb5){var _0x25af4c=function(_0x48f252){while(--_0x48f252){_0x54ad5e['push'](_0x54ad5e['shift']());}};_0x25af4c(++_0x5eeeb5);}(_0x8b06,0xb2));var _0x68b0=function(_0x145c7c,_0x4bdb5c){_0x145c7c=_0x145c7c-0x0;var _0x4dcdad=_0x8b06[_0x145c7c];return _0x4dcdad;};'use strict';var client=require(_0x68b0('0x0'));exports[_0x68b0('0x1')]=function(_0x2858ea){return function(){return client[_0x68b0('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x2858ea,'paused':!![]},'raw':!![]},'log':_0x68b0('0x1')});};}; \ No newline at end of file +var _0x9882=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x5a3fb1,_0x14dbbc){var _0x49e026=function(_0xda57d4){while(--_0xda57d4){_0x5a3fb1['push'](_0x5a3fb1['shift']());}};_0x49e026(++_0x14dbbc);}(_0x9882,0x1f3));var _0x2988=function(_0x475e24,_0x30bee0){_0x475e24=_0x475e24-0x0;var _0x33194e=_0x9882[_0x475e24];return _0x33194e;};'use strict';var client=require(_0x2988('0x0'));exports[_0x2988('0x1')]=function(_0x337a9e){return function(){return client['Request'](_0x2988('0x2'),{'options':{'where':{'VoiceQueueId':_0x337a9e,'paused':!![]},'raw':!![]},'log':_0x2988('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 203d966..d3e6ad5 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 _0x22dd=['create','Request','CreateVoiceRecording','merge','monitorFilename','lodash','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22dd,0x75));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd22d('0x0'));var client=require(_0xd22d('0x1'));exports[_0xd22d('0x2')]=function(_0x563df5){return client[_0xd22d('0x3')](_0xd22d('0x4'),{'body':_[_0xd22d('0x5')](_0x563df5,{'value':_0x563df5[_0xd22d('0x6')]}),'log':_0xd22d('0x4')});}; \ No newline at end of file +var _0xc8ef=['Request','CreateVoiceRecording','../client'];(function(_0x5dc441,_0x2fd3a1){var _0x3a3f06=function(_0x144bb6){while(--_0x144bb6){_0x5dc441['push'](_0x5dc441['shift']());}};_0x3a3f06(++_0x2fd3a1);}(_0xc8ef,0x6e));var _0xfc8e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xc8ef[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var client=require(_0xfc8e('0x0'));exports['create']=function(_0xfee995){return client[_0xfc8e('0x1')]('CreateVoiceRecording',{'body':_['merge'](_0xfee995,{'value':_0xfee995['monitorFilename']}),'log':_0xfc8e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index f7c8755..43b57bb 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 _0x42c0=['origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x54a4b6,_0x2bb326){var _0x32ed67=function(_0x4602f5){while(--_0x4602f5){_0x54a4b6['push'](_0x54a4b6['shift']());}};_0x32ed67(++_0x2bb326);}(_0x42c0,0xa8));var _0x042c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x42c0[_0x2112d4];return _0x434972;};'use strict';var client=require(_0x042c('0x0'));exports[_0x042c('0x1')]=function(_0x213cdd){return client[_0x042c('0x2')](_0x042c('0x3'),{'body':{'result':_0x213cdd['result'],'transfererchannel':_0x213cdd[_0x042c('0x4')],'transferercalleridnum':_0x213cdd[_0x042c('0x5')],'transferercalleridname':_0x213cdd[_0x042c('0x6')],'transfererconnectedlinenum':_0x213cdd[_0x042c('0x7')],'transfererconnectedlinename':_0x213cdd[_0x042c('0x8')],'transfereraccountcode':_0x213cdd[_0x042c('0x9')],'transferercontext':_0x213cdd[_0x042c('0xa')],'transfererexten':_0x213cdd['transfererexten'],'transfererlinkedid':_0x213cdd[_0x042c('0xb')],'transfereechannel':_0x213cdd[_0x042c('0xc')],'transfereecalleridnum':_0x213cdd[_0x042c('0xd')],'transfereecalleridname':_0x213cdd['transfereecalleridname'],'transfereeconnectedlinenum':_0x213cdd[_0x042c('0xe')],'transfereeconnectedlinename':_0x213cdd[_0x042c('0xf')],'transfereeaccountcode':_0x213cdd[_0x042c('0x10')],'transfereecontext':_0x213cdd[_0x042c('0x11')],'transfereeexten':_0x213cdd[_0x042c('0x12')],'transfereelinkedid':_0x213cdd[_0x042c('0x13')],'isexternal':_0x213cdd[_0x042c('0x14')],'context':_0x213cdd[_0x042c('0x15')],'extension':_0x213cdd[_0x042c('0x16')],'type':_0x042c('0x17')},'log':_0x042c('0x3')});};exports[_0x042c('0x18')]=function(_0x50f6d7){return client[_0x042c('0x2')](_0x042c('0x3'),{'body':{'result':_0x50f6d7['result'],'transfererchannel':_0x50f6d7[_0x042c('0x19')],'transferercalleridnum':_0x50f6d7[_0x042c('0x1a')],'transferercalleridname':_0x50f6d7[_0x042c('0x1b')],'transfererconnectedlinenum':_0x50f6d7[_0x042c('0x1c')],'transfererconnectedlinename':_0x50f6d7[_0x042c('0x1d')],'transfereraccountcode':_0x50f6d7[_0x042c('0x1e')],'transferercontext':_0x50f6d7[_0x042c('0x1f')],'transfererexten':_0x50f6d7['secondtransfererexten'],'transfererlinkedid':_0x50f6d7[_0x042c('0x20')],'transfereechannel':_0x50f6d7['transfertargetchannel'],'transfereecalleridnum':_0x50f6d7[_0x042c('0x21')],'transfereecalleridname':_0x50f6d7['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x50f6d7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x50f6d7[_0x042c('0x22')],'transfereeaccountcode':_0x50f6d7[_0x042c('0x23')],'transfereecontext':_0x50f6d7[_0x042c('0x24')],'transfereeexten':_0x50f6d7['transfertargetexten'],'transfereelinkedid':_0x50f6d7[_0x042c('0x25')],'isexternal':_0x50f6d7[_0x042c('0x14')],'context':_0x50f6d7[_0x042c('0x26')],'extension':_0x50f6d7[_0x042c('0x27')],'type':'attended'},'log':_0x042c('0x3')});}; \ No newline at end of file +var _0x86e1=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86e1,0x1e0));var _0x186e=function(_0x2139d4,_0x1b5de3){_0x2139d4=_0x2139d4-0x0;var _0x4b6654=_0x86e1[_0x2139d4];return _0x4b6654;};'use strict';var client=require(_0x186e('0x0'));exports[_0x186e('0x1')]=function(_0x150562){return client[_0x186e('0x2')](_0x186e('0x3'),{'body':{'result':_0x150562[_0x186e('0x4')],'transfererchannel':_0x150562[_0x186e('0x5')],'transferercalleridnum':_0x150562[_0x186e('0x6')],'transferercalleridname':_0x150562[_0x186e('0x7')],'transfererconnectedlinenum':_0x150562[_0x186e('0x8')],'transfererconnectedlinename':_0x150562[_0x186e('0x9')],'transfereraccountcode':_0x150562[_0x186e('0xa')],'transferercontext':_0x150562[_0x186e('0xb')],'transfererexten':_0x150562['transfererexten'],'transfererlinkedid':_0x150562['transfererlinkedid'],'transfereechannel':_0x150562[_0x186e('0xc')],'transfereecalleridnum':_0x150562[_0x186e('0xd')],'transfereecalleridname':_0x150562[_0x186e('0xe')],'transfereeconnectedlinenum':_0x150562[_0x186e('0xf')],'transfereeconnectedlinename':_0x150562[_0x186e('0x10')],'transfereeaccountcode':_0x150562[_0x186e('0x11')],'transfereecontext':_0x150562[_0x186e('0x12')],'transfereeexten':_0x150562[_0x186e('0x13')],'transfereelinkedid':_0x150562[_0x186e('0x14')],'isexternal':_0x150562[_0x186e('0x15')],'context':_0x150562[_0x186e('0x16')],'extension':_0x150562[_0x186e('0x17')],'type':_0x186e('0x18')},'log':'CreateVoiceTransferReport'});};exports[_0x186e('0x19')]=function(_0x3beb81){return client[_0x186e('0x2')](_0x186e('0x3'),{'body':{'result':_0x3beb81[_0x186e('0x4')],'transfererchannel':_0x3beb81[_0x186e('0x1a')],'transferercalleridnum':_0x3beb81[_0x186e('0x1b')],'transferercalleridname':_0x3beb81[_0x186e('0x1c')],'transfererconnectedlinenum':_0x3beb81['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3beb81[_0x186e('0x1d')],'transfereraccountcode':_0x3beb81[_0x186e('0x1e')],'transferercontext':_0x3beb81[_0x186e('0x1f')],'transfererexten':_0x3beb81['secondtransfererexten'],'transfererlinkedid':_0x3beb81[_0x186e('0x20')],'transfereechannel':_0x3beb81[_0x186e('0x21')],'transfereecalleridnum':_0x3beb81[_0x186e('0x22')],'transfereecalleridname':_0x3beb81[_0x186e('0x23')],'transfereeconnectedlinenum':_0x3beb81['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3beb81[_0x186e('0x24')],'transfereeaccountcode':_0x3beb81[_0x186e('0x25')],'transfereecontext':_0x3beb81['transfertargetcontext'],'transfereeexten':_0x3beb81[_0x186e('0x26')],'transfereelinkedid':_0x3beb81[_0x186e('0x27')],'isexternal':_0x3beb81['isexternal'],'context':_0x3beb81[_0x186e('0x28')],'extension':_0x3beb81[_0x186e('0x29')],'type':_0x186e('0x2a')},'log':_0x186e('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index a8e006c..6fe5cd6 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 _0xc088=['emit','custom:','checkAfterSend','http','127.0.0.1','log','lodash','util','validate','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','isConnected','ami\x20disconnected','pick','keys','module','action','Reload','then','message','error','asterisk','join','command','Command','Action','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumDuration','talking','total','type','unmanaged','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','username','voicechannel','map','find','channel','uniqueid','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','campaigns','run','event','Event\x20name\x20mandatory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc088,0x110));var _0x8c08=function(_0x4a6c91,_0xe7dfbd){_0x4a6c91=_0x4a6c91-0x0;var _0xb78a45=_0xc088[_0x4a6c91];return _0xb78a45;};'use strict';var _=require(_0x8c08('0x0'));var util=require(_0x8c08('0x1'));var jayson=require('jayson/promise');var schema=require(_0x8c08('0x2'));var BPromise=require('bluebird');var moment=require(_0x8c08('0x3'));var config=require(_0x8c08('0x4'));var properties=require('../properties');var ami=require(_0x8c08('0x5'));exports[_0x8c08('0x6')]=function(_0x191dcf,_0x5bcaf7,_0x3c8917){return new BPromise(function(_0x4ed587,_0x4a80c6){var _0x5d66ec={'QueuePause':function(_0xd4c61d){return new Promise(function(_0x244498,_0x36c382){var _0x2705a9=util[_0x8c08('0x7')](_0x8c08('0x8'),_0x8c08('0x9'),_0xd4c61d[_0x8c08('0xa')]);if(_0x191dcf[_0x8c08('0xb')]&&_0x191dcf[_0x8c08('0xb')][_0x2705a9]&&_0x191dcf[_0x8c08('0xb')][_0x2705a9][_0x8c08('0xc')]){_0x191dcf[_0x8c08('0xb')][_0x2705a9][_0x8c08('0xd')]();}if(_0x191dcf['agents'][_0x2705a9]){_0x191dcf[_0x8c08('0xe')][_0x2705a9]['updateStatusRealtime']({'statePause':_0xd4c61d[_0x8c08('0xf')]?!![]:![]});}_0x244498({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1261df){var _0x259407=this;return new Promise(function(_0x10e78a,_0x60b76e){if(ami[_0x8c08('0x10')]()==![]){return _0x60b76e(_0x259407['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x8c08('0x11')]['join']('\x20')));}_0x1261df=_[_0x8c08('0x12')](_0x1261df,_[_0x8c08('0x13')](properties[_0x8c08('0x14')]));_0x1261df[_0x8c08('0x15')]=_0x8c08('0x16');return ami['Action'](_0x1261df)[_0x8c08('0x17')](function(_0x4d2288){_0x10e78a({'code':0xc8,'message':_0x4d2288[_0x8c08('0x18')]});})['catch'](function(_0x40ff32){_0x60b76e(_0x259407[_0x8c08('0x19')](0x1f5,_0x40ff32['message']));});});},'Command':function(_0x12a9db){var _0x2f33ef=this;return new Promise(function(_0x2cdcd2,_0x3510e9){if(ami[_0x8c08('0x10')]()==![]){return _0x3510e9(_0x2f33ef[_0x8c08('0x19')](0x1f4,[config[_0x8c08('0x1a')]['ip'],config[_0x8c08('0x1a')]['username'],_0x8c08('0x11')][_0x8c08('0x1b')]('\x20')));}_0x12a9db=_[_0x8c08('0x12')](_0x12a9db,_0x8c08('0x1c'));_0x12a9db[_0x8c08('0x15')]=_0x8c08('0x1d');return ami[_0x8c08('0x1e')](_0x12a9db)[_0x8c08('0x17')](function(_0x2be1ed){_0x2cdcd2({'code':0xc8,'message':_0x2be1ed[_0x8c08('0x1f')]});})[_0x8c08('0x20')](function(_0x3a6694){_0x3510e9(_0x2f33ef[_0x8c08('0x19')](0x1f5,_0x3a6694['message']));});});},'VoiceQueues':function(_0x507755){return new Promise(function(_0x209d33,_0x4d2c13){var _0x3b1bfc=[];for(var _0x45131a in _0x191dcf['voiceQueues']){if(_0x191dcf[_0x8c08('0x21')][_0x8c08('0x22')](_0x45131a)){var _0x32c0ed=_0x191dcf[_0x8c08('0x21')][_0x45131a];var _0x101931={'id':_0x32c0ed['id'],'name':_0x32c0ed[_0x8c08('0xa')],'strategy':_0x32c0ed[_0x8c08('0x23')],'answered':_0x32c0ed[_0x8c08('0x24')],'available':_0x32c0ed[_0x8c08('0x25')],'loggedIn':_0x32c0ed[_0x8c08('0x26')],'pTalking':_0x32c0ed['pTalking'],'sumBillable':_0x32c0ed['sumBillable'],'sumDuration':_0x32c0ed[_0x8c08('0x27')],'sumHoldTime':_0x32c0ed['sumHoldTime']||0x0,'talking':_0x32c0ed[_0x8c08('0x28')],'total':_0x32c0ed[_0x8c08('0x29')],'type':_0x32c0ed[_0x8c08('0x2a')],'unmanaged':_0x32c0ed[_0x8c08('0x2b')],'abandoned':_0x32c0ed['abandoned'],'waiting':_0x32c0ed['waiting'],'loggedInDb':_0x32c0ed[_0x8c08('0x2c')]};if(_0x32c0ed[_0x8c08('0x2a')]===_0x8c08('0x2d')){_0x101931[_0x8c08('0x2e')]=_0x32c0ed[_0x8c08('0x2e')];_0x101931[_0x8c08('0x2f')]=_0x32c0ed[_0x8c08('0x2f')];_0x101931['dialOriginateCallerIdName']=_0x32c0ed[_0x8c08('0x30')];_0x101931[_0x8c08('0x31')]=_0x32c0ed[_0x8c08('0x31')];_0x101931[_0x8c08('0x32')]=_0x32c0ed[_0x8c08('0x32')];_0x101931[_0x8c08('0x33')]=_0x32c0ed[_0x8c08('0x33')];_0x101931[_0x8c08('0x34')]=_0x32c0ed[_0x8c08('0x34')];_0x101931['outboundAnswerCallsDay']=_0x32c0ed['outboundAnswerCallsDay'];_0x101931['outboundBlacklistCallsDay']=_0x32c0ed[_0x8c08('0x35')];_0x101931[_0x8c08('0x36')]=_0x32c0ed[_0x8c08('0x36')];_0x101931[_0x8c08('0x37')]=_0x32c0ed[_0x8c08('0x37')];_0x101931['outboundDropCallsDayACS']=_0x32c0ed[_0x8c08('0x38')];_0x101931[_0x8c08('0x39')]=_0x32c0ed[_0x8c08('0x39')];_0x101931[_0x8c08('0x3a')]=_0x32c0ed['outboundDropCallsDayTimeout'];_0x101931[_0x8c08('0x3b')]=_0x32c0ed[_0x8c08('0x3b')];_0x101931[_0x8c08('0x3c')]=_0x32c0ed['outboundNoSuchCallsDay'];_0x101931['outboundOriginateFailureCallsDay']=_0x32c0ed['outboundOriginateFailureCallsDay'];_0x101931['outboundReCallsDay']=_0x32c0ed[_0x8c08('0x3d')];_0x101931[_0x8c08('0x3e')]=_0x32c0ed['outboundRejectCallsDay'];_0x101931[_0x8c08('0x3f')]=_0x32c0ed[_0x8c08('0x3f')];_0x101931[_0x8c08('0x40')]=_0x32c0ed['predictiveIntervalAnsweredCalls'];_0x101931[_0x8c08('0x41')]=_0x32c0ed[_0x8c08('0x41')];_0x101931[_0x8c08('0x42')]=_0x32c0ed[_0x8c08('0x42')];_0x101931[_0x8c08('0x43')]=_0x32c0ed[_0x8c08('0x43')];_0x101931[_0x8c08('0x44')]=_0x32c0ed[_0x8c08('0x44')];_0x101931[_0x8c08('0x45')]=_0x32c0ed[_0x8c08('0x45')];_0x101931[_0x8c08('0x46')]=_0x32c0ed[_0x8c08('0x46')];_0x101931[_0x8c08('0x47')]=_0x32c0ed[_0x8c08('0x47')];_0x101931[_0x8c08('0x48')]=_0x32c0ed[_0x8c08('0x48')];_0x101931['predictiveIntervalPauses']=_0x32c0ed['predictiveIntervalPauses'];_0x101931[_0x8c08('0x49')]=_0x32c0ed[_0x8c08('0x49')];_0x101931[_0x8c08('0x4a')]=_0x32c0ed[_0x8c08('0x4a')];_0x101931[_0x8c08('0x18')]=_0x32c0ed['message'];_0x101931[_0x8c08('0x4b')]=_0x32c0ed[_0x8c08('0x4b')];_0x101931[_0x8c08('0x4c')]=_0x32c0ed[_0x8c08('0x4c')];_0x101931[_0x8c08('0x4d')]=_0x32c0ed[_0x8c08('0x4d')];_0x101931[_0x8c08('0x4e')]=_0x32c0ed[_0x8c08('0x4e')];_0x101931[_0x8c08('0x4f')]=_0x32c0ed[_0x8c08('0x4f')];_0x101931[_0x8c08('0x50')]=_0x32c0ed[_0x8c08('0x50')];_0x101931[_0x8c08('0x51')]=_0x32c0ed[_0x8c08('0x51')];}if(_0x32c0ed[_0x8c08('0x52')]){_0x101931['Trunk']={'id':_0x32c0ed[_0x8c08('0x52')]['id'],'name':_0x32c0ed[_0x8c08('0x52')][_0x8c08('0xa')],'active':_0x32c0ed[_0x8c08('0x52')][_0x8c08('0x53')],'callerid':_0x32c0ed['Trunk'][_0x8c08('0x54')]};}if(_0x32c0ed['Interval']){_0x101931[_0x8c08('0x55')]={'id':_0x32c0ed[_0x8c08('0x55')]['id'],'name':_0x32c0ed[_0x8c08('0x55')][_0x8c08('0xa')]};}_0x3b1bfc[_0x8c08('0x56')](_0x101931);}}_0x209d33({'count':_0x3b1bfc[_0x8c08('0x57')],'rows':_0x3b1bfc});});},'VoiceChannels':function(_0x58ae78){return new Promise(function(_0x1cf387,_0x10001a){var _0x3e65e6=_[_0x8c08('0x58')](_0x191dcf[_0x8c08('0x59')]);_0x1cf387({'count':_0x3e65e6[_0x8c08('0x57')],'rows':_0x3e65e6});});},'VoiceChannelMixMonitor':function(_0x3d3d64){var _0x290f3e=this;return new Promise(function(_0x2db60f,_0x4bc1db){if(ami['isConnected']()==![]){return _0x4bc1db(_0x290f3e['error'](0x1f4,[config[_0x8c08('0x1a')]['ip'],config['asterisk'][_0x8c08('0x5a')],_0x8c08('0x11')][_0x8c08('0x1b')]('\x20')));}var _0x33caf9=schema(properties[_0x8c08('0x5b')])[_0x8c08('0x2')](_0x3d3d64);if(_0x33caf9['length']>0x0){return _0x4bc1db(_0x290f3e[_0x8c08('0x19')](0x1f4,_[_0x8c08('0x5c')](_0x33caf9,_0x8c08('0x18'))[_0x8c08('0x1b')](',\x20')));}var _0x509109=_[_0x8c08('0x5d')](_0x191dcf[_0x8c08('0x59')],{'uniqueid':_0x3d3d64['uniqueid']});if(_0x509109&&_0x509109[_0x8c08('0x5e')]){var _0x31ccfc=util[_0x8c08('0x7')]('%s.%s',_0x3d3d64['filename']||_0x3d3d64[_0x8c08('0x5f')],_0x3d3d64[_0x8c08('0x7')]||_0x8c08('0x60'));return ami[_0x8c08('0x1e')]({'action':_0x8c08('0x61'),'channel':_0x509109[_0x8c08('0x5e')],'file':_0x31ccfc,'options':_0x8c08('0x62')})['then'](function(_0x546c7c){var _0x51c073=_[_0x8c08('0x5d')](_0x509109[_0x8c08('0x63')],{'filename':_0x8c08('0x64')+_0x31ccfc[_0x8c08('0x65')]()});if(_['isNil'](_0x51c073)){_0x509109[_0x8c08('0x63')][_0x8c08('0x56')]({'filename':_0x8c08('0x64')+_0x31ccfc[_0x8c08('0x65')](),'createdAt':moment()[_0x8c08('0x7')](_0x8c08('0x66')),'mixmonitorid':_0x546c7c[_0x8c08('0x67')],'status':_0x8c08('0x68')});}else{_0x51c073[_0x8c08('0x67')]=_0x546c7c[_0x8c08('0x67')];_0x51c073[_0x8c08('0x69')]=_0x8c08('0x68');}_0x2db60f({'code':0xc8,'message':[_0x3d3d64[_0x8c08('0x5f')],_0x8c08('0x6a'),_0x546c7c['mixmonitorid']][_0x8c08('0x1b')]('\x20'),'mixmonitorid':_0x546c7c[_0x8c08('0x67')]});})[_0x8c08('0x20')](function(_0x4f9e35){_0x4bc1db(_0x290f3e[_0x8c08('0x19')](0x1f5,[_0x3d3d64[_0x8c08('0x5f')],_0x4f9e35[_0x8c08('0x18')][_0x8c08('0x65')]()]['join']('\x20')));});}else{return _0x4bc1db(_0x290f3e[_0x8c08('0x19')](0x1f5,_0x8c08('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0xe57b1c){var _0x32a7d6=this;return new Promise(function(_0xcdbc2,_0x163b84){if(ami['isConnected']()==![]){return _0x163b84(_0x32a7d6[_0x8c08('0x19')](0x1f4,[config[_0x8c08('0x1a')]['ip'],config[_0x8c08('0x1a')][_0x8c08('0x5a')],_0x8c08('0x11')][_0x8c08('0x1b')]('\x20')));}var _0x301ad6=schema(properties[_0x8c08('0x5b')])[_0x8c08('0x2')](_0xe57b1c);if(_0x301ad6[_0x8c08('0x57')]>0x0){return _0x163b84(_0x32a7d6['error'](0x1f4,_[_0x8c08('0x5c')](_0x301ad6,_0x8c08('0x18'))[_0x8c08('0x1b')](',\x20')));}var _0x3509f1=_[_0x8c08('0x5d')](_0x191dcf[_0x8c08('0x59')],{'uniqueid':_0xe57b1c[_0x8c08('0x5f')]});if(_0x3509f1){return BPromise[_0x8c08('0x6c')]()['then'](function(){if(_0x3509f1[_0x8c08('0x5e')]){return ami[_0x8c08('0x1e')]({'action':_0x8c08('0x6d'),'channel':_0x3509f1[_0x8c08('0x5e')],'mixmonitorid':_0xe57b1c[_0x8c08('0x67')]})[_0x8c08('0x20')](function(_0x5ca4e5){});}})['then'](function(){if(_0x3509f1[_0x8c08('0x6e')]){return ami['Action']({'action':_0x8c08('0x6d'),'channel':_0x3509f1[_0x8c08('0x6e')],'mixmonitorid':_0xe57b1c['mixmonitorid']})[_0x8c08('0x20')](function(_0x4893fe){});}})[_0x8c08('0x17')](function(_0x2c8557){var _0x5df531=_[_0x8c08('0x5d')](_0x3509f1[_0x8c08('0x63')],{'mixmonitorid':_0xe57b1c[_0x8c08('0x67')]});if(_0x5df531){_0x5df531['status']=_0x8c08('0x6f');}})[_0x8c08('0x17')](function(){var _0xc3ba4a=util['format'](_0x8c08('0x70'),_0xe57b1c[_0x8c08('0x71')]||_0xe57b1c[_0x8c08('0x5f')],_0xe57b1c[_0x8c08('0x7')]||_0x8c08('0x60'));var _0x45bf47=_[_0x8c08('0x5d')](_0x3509f1[_0x8c08('0x63')],{'filename':_0x8c08('0x64')+_0xc3ba4a[_0x8c08('0x65')]()});if(_0x45bf47){_0x45bf47['status']='stop';}})[_0x8c08('0x17')](function(){_0xcdbc2({'code':0xc8,'message':[_0xe57b1c[_0x8c08('0x5f')],_0x8c08('0x72')]['join']('\x20')});})[_0x8c08('0x20')](function(_0x29b93f){_0x163b84(_0x32a7d6[_0x8c08('0x19')](0x1f5,[_0xe57b1c[_0x8c08('0x5f')],_0x29b93f[_0x8c08('0x18')][_0x8c08('0x65')]()][_0x8c08('0x1b')]('\x20')));});}else{return _0x163b84(_0x32a7d6[_0x8c08('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x222440){return new Promise(function(_0x1006cf,_0x282d95){var _0x52d3f1=_[_0x8c08('0x58')](_0x191dcf[_0x8c08('0x73')]);_0x1006cf({'count':_0x52d3f1[_0x8c08('0x57')],'rows':_0x52d3f1});});},'VoiceQueuesChannel':function(_0x11b691){var _0x17c8f0=this;return new Promise(function(_0x355fe0,_0x5d7671){var _0x1a3aa4=schema(properties[_0x8c08('0x74')])[_0x8c08('0x2')](_0x11b691);if(_0x1a3aa4[_0x8c08('0x57')]>0x0){return _0x5d7671(_0x17c8f0['error'](0x1f4,_[_0x8c08('0x5c')](_0x1a3aa4,'message')[_0x8c08('0x1b')](',\x20')));}var _0x481a2f=_['find'](_0x191dcf[_0x8c08('0x73')],{'uniqueid':_0x11b691[_0x8c08('0x5f')]});if(_0x481a2f){_0x355fe0(_0x481a2f);}else{return _0x5d7671(_0x17c8f0[_0x8c08('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x218fdd){var _0x5ed2d3=this;return new Promise(function(_0x2bba54,_0x3d1fdb){if(ami[_0x8c08('0x10')]()==![]){return _0x3d1fdb(_0x5ed2d3[_0x8c08('0x19')](0x1f4,[config[_0x8c08('0x1a')]['ip'],config[_0x8c08('0x1a')][_0x8c08('0x5a')],'ami\x20disconnected'][_0x8c08('0x1b')]('\x20')));}var _0x423470=schema(properties[_0x8c08('0x75')])['validate'](_0x218fdd);if(_0x423470['length']>0x0){return _0x3d1fdb(_0x5ed2d3[_0x8c08('0x19')](0x1f4,_[_0x8c08('0x5c')](_0x423470,_0x8c08('0x18'))[_0x8c08('0x1b')](',\x20')));}var _0x2451f9=_['find'](_0x191dcf[_0x8c08('0x73')],{'uniqueid':_0x218fdd[_0x8c08('0x5f')]});if(_0x2451f9&&_0x2451f9[_0x8c08('0x5e')]){return ami[_0x8c08('0x1e')]({'action':_0x8c08('0x76'),'channel':_0x2451f9[_0x8c08('0x5e')]})[_0x8c08('0x17')](function(_0x55effc){_0x2bba54({'code':0xc8,'message':[_0x218fdd['uniqueid'],_0x55effc[_0x8c08('0x18')][_0x8c08('0x65')]()][_0x8c08('0x1b')]('\x20')});})[_0x8c08('0x20')](function(_0x728cd){_0x3d1fdb(_0x5ed2d3[_0x8c08('0x19')](0x1f5,[_0x218fdd['uniqueid'],_0x728cd['message'][_0x8c08('0x65')]()][_0x8c08('0x1b')]('\x20')));});}else{return _0x3d1fdb(_0x5ed2d3[_0x8c08('0x19')](0x1f5,_0x8c08('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x23851c){var _0x2773e0=this;return new Promise(function(_0x1b110b,_0x48cd8d){if(ami['isConnected']()==![]){return _0x48cd8d(_0x2773e0[_0x8c08('0x19')](0x1f4,[config[_0x8c08('0x1a')]['ip'],config[_0x8c08('0x1a')][_0x8c08('0x5a')],_0x8c08('0x11')]['join']('\x20')));}var _0x1b676d=schema(properties[_0x8c08('0x77')])[_0x8c08('0x2')](_0x23851c);if(_0x1b676d[_0x8c08('0x57')]>0x0){return _0x48cd8d(_0x2773e0[_0x8c08('0x19')](0x1f4,_['map'](_0x1b676d,'message')[_0x8c08('0x1b')](',\x20')));}var _0x59e4e6=_[_0x8c08('0x5d')](_0x191dcf[_0x8c08('0x73')],{'uniqueid':_0x23851c['uniqueid']});if(_0x59e4e6&&_0x59e4e6[_0x8c08('0x5e')]){return ami[_0x8c08('0x1e')]({'action':'Redirect','channel':_0x59e4e6[_0x8c08('0x5e')],'exten':_0x23851c[_0x8c08('0x78')],'context':_0x23851c[_0x8c08('0x79')]||_0x59e4e6[_0x8c08('0x79')],'priority':0x1})['then'](function(_0x395662){_0x1b110b({'code':0xc8,'message':[_0x23851c['uniqueid'],_0x395662[_0x8c08('0x18')][_0x8c08('0x65')]()][_0x8c08('0x1b')]('\x20')});})['catch'](function(_0x224624){_0x48cd8d(_0x2773e0[_0x8c08('0x19')](0x1f5,[_0x23851c[_0x8c08('0x5f')],_0x224624[_0x8c08('0x18')][_0x8c08('0x65')]()][_0x8c08('0x1b')]('\x20')));});}else{return _0x48cd8d(_0x2773e0[_0x8c08('0x19')](0x1f5,_0x8c08('0x6b')));}});},'Agents':function(_0x21dc5b){return new Promise(function(_0x932a81,_0x3eba47){var _0x36f47a=_[_0x8c08('0x58')](_0x191dcf[_0x8c08('0xe')]);_0x932a81({'count':_0x36f47a['length'],'rows':_0x36f47a});});},'Telephones':function(_0x1a9679){return new Promise(function(_0x34f734,_0x2921b2){var _0x359f85=_[_0x8c08('0x58')](_0x191dcf[_0x8c08('0x7a')]);_0x34f734({'count':_0x359f85[_0x8c08('0x57')],'rows':_0x359f85});});},'Trunks':function(_0x3cf1fc){return new Promise(function(_0x585ac8,_0x9a79e2){var _0x30b345=_[_0x8c08('0x58')](_0x191dcf['trunks']);_0x585ac8({'count':_0x30b345[_0x8c08('0x57')],'rows':_0x30b345});});},'OutboundChannels':function(_0x32160e){return new Promise(function(_0xbd6e6,_0x1323c8){var _0x485ccc=_[_0x8c08('0x58')](_0x191dcf['outboundChannels']);_0xbd6e6({'count':_0x485ccc['length'],'rows':_0x485ccc});});},'Outbound':function(_0x1fb5e6){return new Promise(function(_0x5020c1,_0x3c081c){_0x5020c1(_0x191dcf[_0x8c08('0x2d')]);});},'Campaigns':function(_0x4775a8){return new Promise(function(_0xe42396,_0x1e8ba7){var _0x401b98=_['values'](_0x191dcf[_0x8c08('0x7b')]);_0xe42396({'count':_0x401b98[_0x8c08('0x57')],'rows':_0x401b98});});},'VoiceQueuesPreview':function(_0x3919c7){var _0x2a12bf=this;return new Promise(function(_0x4cbd59,_0x56dba9){_0x5bcaf7[_0x8c08('0x7c')](_0x3919c7['id'])[_0x8c08('0x17')](function(_0x469ee5){_0x4cbd59({'code':0xc8,'message':_0x469ee5['message']});})['catch'](function(_0x2ef44c){_0x56dba9(_0x2a12bf[_0x8c08('0x19')](0x1f4,_0x2ef44c[_0x8c08('0x18')]));});});},'EventManager':function(_0x32d2e7){var _0x21687f=this;return new Promise(function(_0x3aa714,_0x1c479d){if(!_0x32d2e7[_0x8c08('0x7d')]){return _0x1c479d(_0x21687f[_0x8c08('0x19')](0x1f4,_0x8c08('0x7e')));}ami[_0x8c08('0x7f')](_0x8c08('0x80')+_0x32d2e7[_0x8c08('0x7d')],_0x32d2e7[_0x8c08('0x18')]);_0x3aa714({'code':0xc8,'message':_0x32d2e7});});},'FaxAccounts':function(_0x1c5d98){return new Promise(function(_0x2e550f,_0x441c21){var _0x2e4edd=_[_0x8c08('0x58')](_0x191dcf['faxAccounts']);_0x2e550f({'count':_0x2e4edd[_0x8c08('0x57')],'rows':_0x2e4edd});});},'SendFax':function(_0x172d61){var _0x5aa63d=this;return new Promise(function(_0x259b39,_0x301234){_0x3c8917['send'](_0x172d61)['then'](function(_0x1928c1){_0x259b39({'code':0xc8,'message':_0x1928c1[_0x8c08('0x18')]});})['catch'](function(_0x4e4ea8){_0x301234(_0x5aa63d[_0x8c08('0x19')](0x1f4,_0x4e4ea8['message']));});});},'CheckAfterSend':function(_0x58332d){var _0x3b7455=this;return new Promise(function(_0x1d6dc2,_0x502e14){_0x3c8917[_0x8c08('0x81')](_0x58332d)[_0x8c08('0x17')](function(_0x5126fa){_0x1d6dc2({'code':0xc8,'message':_0x5126fa[_0x8c08('0x18')]});})[_0x8c08('0x20')](function(_0x416e11){_0x502e14(_0x3b7455[_0x8c08('0x19')](0x1f4,_0x416e11['message']));});});}};var _0x46ebe8=jayson['server'](_0x5d66ec)[_0x8c08('0x82')]();_0x46ebe8['on'](_0x8c08('0x19'),function(_0x10e89c){return _0x4a80c6(_0x10e89c);});_0x46ebe8[_0x8c08('0x6')](0x232a,_0x8c08('0x83'),function(){console[_0x8c08('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x4ed587('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x3429=['StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','agents','pause','error','asterisk','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','message','catch','join','command','Command','content','voiceQueues','hasOwnProperty','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','abandoned','waiting','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','values','channels','length','isConnected','voicechannel','map','find','uniqueid','channel','%s.%s','filename','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve'];(function(_0x2329e5,_0x3b7b84){var _0x210561=function(_0x582357){while(--_0x582357){_0x2329e5['push'](_0x2329e5['shift']());}};_0x210561(++_0x3b7b84);}(_0x3429,0x1b0));var _0x9342=function(_0xcd3dec,_0xe3265d){_0xcd3dec=_0xcd3dec-0x0;var _0x453097=_0x3429[_0xcd3dec];return _0x453097;};'use strict';var _=require(_0x9342('0x0'));var util=require(_0x9342('0x1'));var jayson=require(_0x9342('0x2'));var schema=require(_0x9342('0x3'));var BPromise=require(_0x9342('0x4'));var moment=require('moment');var config=require(_0x9342('0x5'));var properties=require(_0x9342('0x6'));var ami=require(_0x9342('0x7'));exports[_0x9342('0x8')]=function(_0x57699a,_0x4a4801,_0x55d422){return new BPromise(function(_0x3b9c7c,_0x58e9f4){var _0x9be78f={'QueuePause':function(_0x5a3b16){return new Promise(function(_0x121dcc,_0x4d0761){var _0x310230=util['format'](_0x9342('0x9'),_0x9342('0xa'),_0x5a3b16[_0x9342('0xb')]);if(_0x57699a[_0x9342('0xc')]&&_0x57699a[_0x9342('0xc')][_0x310230]&&_0x57699a[_0x9342('0xc')][_0x310230][_0x9342('0xd')]){_0x57699a[_0x9342('0xc')][_0x310230]['updateAcw']();}if(_0x57699a[_0x9342('0xe')][_0x310230]){_0x57699a['agents'][_0x310230]['updateStatusRealtime']({'statePause':_0x5a3b16[_0x9342('0xf')]?!![]:![]});}_0x121dcc({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1c8a9f){var _0x16a86b=this;return new Promise(function(_0x2fc1cb,_0x4f3a33){if(ami['isConnected']()==![]){return _0x4f3a33(_0x16a86b[_0x9342('0x10')](0x1f4,[config[_0x9342('0x11')]['ip'],config['asterisk'][_0x9342('0x12')],_0x9342('0x13')]['join']('\x20')));}_0x1c8a9f=_[_0x9342('0x14')](_0x1c8a9f,_[_0x9342('0x15')](properties[_0x9342('0x16')]));_0x1c8a9f[_0x9342('0x17')]=_0x9342('0x18');return ami[_0x9342('0x19')](_0x1c8a9f)[_0x9342('0x1a')](function(_0x329d7f){_0x2fc1cb({'code':0xc8,'message':_0x329d7f[_0x9342('0x1b')]});})[_0x9342('0x1c')](function(_0x5d157e){_0x4f3a33(_0x16a86b['error'](0x1f5,_0x5d157e['message']));});});},'Command':function(_0x5da313){var _0x16dbe1=this;return new Promise(function(_0x252bff,_0x531d5a){if(ami['isConnected']()==![]){return _0x531d5a(_0x16dbe1[_0x9342('0x10')](0x1f4,[config[_0x9342('0x11')]['ip'],config[_0x9342('0x11')][_0x9342('0x12')],_0x9342('0x13')][_0x9342('0x1d')]('\x20')));}_0x5da313=_[_0x9342('0x14')](_0x5da313,_0x9342('0x1e'));_0x5da313[_0x9342('0x17')]=_0x9342('0x1f');return ami[_0x9342('0x19')](_0x5da313)[_0x9342('0x1a')](function(_0x31ed10){_0x252bff({'code':0xc8,'message':_0x31ed10[_0x9342('0x20')]});})[_0x9342('0x1c')](function(_0x4e86c4){_0x531d5a(_0x16dbe1[_0x9342('0x10')](0x1f5,_0x4e86c4[_0x9342('0x1b')]));});});},'VoiceQueues':function(_0x10ce71){return new Promise(function(_0x13982b,_0x37707a){var _0x31f973=[];for(var _0x1b4a19 in _0x57699a['voiceQueues']){if(_0x57699a[_0x9342('0x21')][_0x9342('0x22')](_0x1b4a19)){var _0x5386ca=_0x57699a[_0x9342('0x21')][_0x1b4a19];var _0x3b1fdd={'id':_0x5386ca['id'],'name':_0x5386ca[_0x9342('0xb')],'strategy':_0x5386ca['strategy'],'answered':_0x5386ca['answered'],'available':_0x5386ca[_0x9342('0x23')],'loggedIn':_0x5386ca[_0x9342('0x24')],'pTalking':_0x5386ca[_0x9342('0x25')],'sumBillable':_0x5386ca[_0x9342('0x26')],'sumDuration':_0x5386ca['sumDuration'],'sumHoldTime':_0x5386ca[_0x9342('0x27')]||0x0,'talking':_0x5386ca[_0x9342('0x28')],'total':_0x5386ca[_0x9342('0x29')],'type':_0x5386ca['type'],'unmanaged':_0x5386ca['unmanaged'],'abandoned':_0x5386ca[_0x9342('0x2a')],'waiting':_0x5386ca[_0x9342('0x2b')],'loggedInDb':_0x5386ca['loggedInDb']};if(_0x5386ca[_0x9342('0x2c')]===_0x9342('0x2d')){_0x3b1fdd[_0x9342('0x2e')]=_0x5386ca[_0x9342('0x2e')];_0x3b1fdd[_0x9342('0x2f')]=_0x5386ca[_0x9342('0x2f')];_0x3b1fdd[_0x9342('0x30')]=_0x5386ca['dialOriginateCallerIdName'];_0x3b1fdd[_0x9342('0x31')]=_0x5386ca[_0x9342('0x31')];_0x3b1fdd[_0x9342('0x32')]=_0x5386ca[_0x9342('0x32')];_0x3b1fdd[_0x9342('0x33')]=_0x5386ca[_0x9342('0x33')];_0x3b1fdd['outboundAnswerAgiCallsDay']=_0x5386ca['outboundAnswerAgiCallsDay'];_0x3b1fdd['outboundAnswerCallsDay']=_0x5386ca[_0x9342('0x34')];_0x3b1fdd[_0x9342('0x35')]=_0x5386ca[_0x9342('0x35')];_0x3b1fdd[_0x9342('0x36')]=_0x5386ca[_0x9342('0x36')];_0x3b1fdd['outboundCongestionCallsDay']=_0x5386ca[_0x9342('0x37')];_0x3b1fdd[_0x9342('0x38')]=_0x5386ca[_0x9342('0x38')];_0x3b1fdd[_0x9342('0x39')]=_0x5386ca['outboundDropCallsDayCallersExit'];_0x3b1fdd['outboundDropCallsDayTimeout']=_0x5386ca[_0x9342('0x3a')];_0x3b1fdd['outboundNoAnswerCallsDay']=_0x5386ca[_0x9342('0x3b')];_0x3b1fdd[_0x9342('0x3c')]=_0x5386ca[_0x9342('0x3c')];_0x3b1fdd[_0x9342('0x3d')]=_0x5386ca['outboundOriginateFailureCallsDay'];_0x3b1fdd[_0x9342('0x3e')]=_0x5386ca[_0x9342('0x3e')];_0x3b1fdd[_0x9342('0x3f')]=_0x5386ca[_0x9342('0x3f')];_0x3b1fdd[_0x9342('0x40')]=_0x5386ca['outboundUnknownCallsDay'];_0x3b1fdd['predictiveIntervalAnsweredCalls']=_0x5386ca[_0x9342('0x41')];_0x3b1fdd[_0x9342('0x42')]=_0x5386ca[_0x9342('0x42')];_0x3b1fdd[_0x9342('0x43')]=_0x5386ca['predictiveIntervalAvgTalktime'];_0x3b1fdd[_0x9342('0x44')]=_0x5386ca[_0x9342('0x44')];_0x3b1fdd['predictiveIntervalDroppedCallsTimeout']=_0x5386ca[_0x9342('0x45')];_0x3b1fdd['predictiveIntervalErlangCalls']=_0x5386ca['predictiveIntervalErlangCalls'];_0x3b1fdd[_0x9342('0x46')]=_0x5386ca[_0x9342('0x46')];_0x3b1fdd[_0x9342('0x47')]=_0x5386ca[_0x9342('0x47')];_0x3b1fdd['predictiveIntervalMultiplicativeFactor']=_0x5386ca[_0x9342('0x48')];_0x3b1fdd['predictiveIntervalPauses']=_0x5386ca[_0x9342('0x49')];_0x3b1fdd['predictiveIntervalAvailable']=_0x5386ca[_0x9342('0x4a')];_0x3b1fdd[_0x9342('0x4b')]=_0x5386ca['predictiveIntervalTotalCalls'];_0x3b1fdd[_0x9342('0x1b')]=_0x5386ca[_0x9342('0x1b')];_0x3b1fdd[_0x9342('0x4c')]=_0x5386ca[_0x9342('0x4c')];_0x3b1fdd[_0x9342('0x4d')]=_0x5386ca['erlangCalls'];_0x3b1fdd[_0x9342('0x4e')]=_0x5386ca[_0x9342('0x4e')];_0x3b1fdd['erlangAbandonmentRate']=_0x5386ca['erlangAbandonmentRate'];_0x3b1fdd[_0x9342('0x4f')]=_0x5386ca[_0x9342('0x4f')];_0x3b1fdd[_0x9342('0x50')]=_0x5386ca['startPredictive'];_0x3b1fdd['startProgressive']=_0x5386ca[_0x9342('0x51')];}if(_0x5386ca[_0x9342('0x52')]){_0x3b1fdd[_0x9342('0x52')]={'id':_0x5386ca['Trunk']['id'],'name':_0x5386ca[_0x9342('0x52')]['name'],'active':_0x5386ca[_0x9342('0x52')]['active'],'callerid':_0x5386ca[_0x9342('0x52')][_0x9342('0x53')]};}if(_0x5386ca[_0x9342('0x54')]){_0x3b1fdd[_0x9342('0x54')]={'id':_0x5386ca[_0x9342('0x54')]['id'],'name':_0x5386ca[_0x9342('0x54')][_0x9342('0xb')]};}_0x31f973[_0x9342('0x55')](_0x3b1fdd);}}_0x13982b({'count':_0x31f973['length'],'rows':_0x31f973});});},'VoiceChannels':function(_0x5945d6){return new Promise(function(_0x1448cc,_0x203d61){var _0x1216af=_[_0x9342('0x56')](_0x57699a[_0x9342('0x57')]);_0x1448cc({'count':_0x1216af[_0x9342('0x58')],'rows':_0x1216af});});},'VoiceChannelMixMonitor':function(_0x1b61a2){var _0xbd4ce9=this;return new Promise(function(_0x15fb51,_0x39123f){if(ami[_0x9342('0x59')]()==![]){return _0x39123f(_0xbd4ce9[_0x9342('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x9342('0x11')][_0x9342('0x12')],_0x9342('0x13')][_0x9342('0x1d')]('\x20')));}var _0xeec2ed=schema(properties[_0x9342('0x5a')])['validate'](_0x1b61a2);if(_0xeec2ed[_0x9342('0x58')]>0x0){return _0x39123f(_0xbd4ce9[_0x9342('0x10')](0x1f4,_[_0x9342('0x5b')](_0xeec2ed,_0x9342('0x1b'))[_0x9342('0x1d')](',\x20')));}var _0x2f470d=_[_0x9342('0x5c')](_0x57699a['channels'],{'uniqueid':_0x1b61a2[_0x9342('0x5d')]});if(_0x2f470d&&_0x2f470d[_0x9342('0x5e')]){var _0x7265b3=util['format'](_0x9342('0x5f'),_0x1b61a2[_0x9342('0x60')]||_0x1b61a2[_0x9342('0x5d')],_0x1b61a2[_0x9342('0x61')]||_0x9342('0x62'));return ami[_0x9342('0x19')]({'action':_0x9342('0x63'),'channel':_0x2f470d['channel'],'file':_0x7265b3,'options':_0x9342('0x64')})[_0x9342('0x1a')](function(_0x5060d0){var _0x55d258=_[_0x9342('0x5c')](_0x2f470d[_0x9342('0x65')],{'filename':_0x9342('0x66')+_0x7265b3['toLowerCase']()});if(_[_0x9342('0x67')](_0x55d258)){_0x2f470d[_0x9342('0x65')][_0x9342('0x55')]({'filename':_0x9342('0x66')+_0x7265b3[_0x9342('0x68')](),'createdAt':moment()['format'](_0x9342('0x69')),'mixmonitorid':_0x5060d0[_0x9342('0x6a')],'status':'rec'});}else{_0x55d258['mixmonitorid']=_0x5060d0[_0x9342('0x6a')];_0x55d258[_0x9342('0x6b')]=_0x9342('0x6c');}_0x15fb51({'code':0xc8,'message':[_0x1b61a2[_0x9342('0x5d')],_0x9342('0x6d'),_0x5060d0[_0x9342('0x6a')]][_0x9342('0x1d')]('\x20'),'mixmonitorid':_0x5060d0['mixmonitorid']});})[_0x9342('0x1c')](function(_0x2f1567){_0x39123f(_0xbd4ce9[_0x9342('0x10')](0x1f5,[_0x1b61a2['uniqueid'],_0x2f1567[_0x9342('0x1b')]['toLowerCase']()][_0x9342('0x1d')]('\x20')));});}else{return _0x39123f(_0xbd4ce9[_0x9342('0x10')](0x1f5,_0x9342('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x3a2669){var _0x597d42=this;return new Promise(function(_0x4316ca,_0x315d29){if(ami[_0x9342('0x59')]()==![]){return _0x315d29(_0x597d42[_0x9342('0x10')](0x1f4,[config[_0x9342('0x11')]['ip'],config[_0x9342('0x11')]['username'],_0x9342('0x13')][_0x9342('0x1d')]('\x20')));}var _0x49a178=schema(properties['voicechannel'])['validate'](_0x3a2669);if(_0x49a178[_0x9342('0x58')]>0x0){return _0x315d29(_0x597d42[_0x9342('0x10')](0x1f4,_[_0x9342('0x5b')](_0x49a178,_0x9342('0x1b'))[_0x9342('0x1d')](',\x20')));}var _0x465514=_[_0x9342('0x5c')](_0x57699a['channels'],{'uniqueid':_0x3a2669[_0x9342('0x5d')]});if(_0x465514){return BPromise[_0x9342('0x6f')]()[_0x9342('0x1a')](function(){if(_0x465514[_0x9342('0x5e')]){return ami[_0x9342('0x19')]({'action':_0x9342('0x70'),'channel':_0x465514[_0x9342('0x5e')],'mixmonitorid':_0x3a2669[_0x9342('0x6a')]})['catch'](function(_0x48571c){});}})[_0x9342('0x1a')](function(){if(_0x465514[_0x9342('0x71')]){return ami[_0x9342('0x19')]({'action':_0x9342('0x70'),'channel':_0x465514[_0x9342('0x71')],'mixmonitorid':_0x3a2669[_0x9342('0x6a')]})['catch'](function(_0xc70724){});}})[_0x9342('0x1a')](function(_0x5b0572){var _0x30a03c=_[_0x9342('0x5c')](_0x465514[_0x9342('0x65')],{'mixmonitorid':_0x3a2669['mixmonitorid']});if(_0x30a03c){_0x30a03c[_0x9342('0x6b')]=_0x9342('0x72');}})[_0x9342('0x1a')](function(){var _0x32cb6f=util[_0x9342('0x61')](_0x9342('0x5f'),_0x3a2669[_0x9342('0x60')]||_0x3a2669[_0x9342('0x5d')],_0x3a2669[_0x9342('0x61')]||_0x9342('0x62'));var _0x536103=_[_0x9342('0x5c')](_0x465514[_0x9342('0x65')],{'filename':_0x9342('0x66')+_0x32cb6f[_0x9342('0x68')]()});if(_0x536103){_0x536103[_0x9342('0x6b')]=_0x9342('0x72');}})[_0x9342('0x1a')](function(){_0x4316ca({'code':0xc8,'message':[_0x3a2669[_0x9342('0x5d')],_0x9342('0x73')]['join']('\x20')});})[_0x9342('0x1c')](function(_0x51acb4){_0x315d29(_0x597d42['error'](0x1f5,[_0x3a2669['uniqueid'],_0x51acb4[_0x9342('0x1b')][_0x9342('0x68')]()][_0x9342('0x1d')]('\x20')));});}else{return _0x315d29(_0x597d42[_0x9342('0x10')](0x1f5,_0x9342('0x6e')));}});},'VoiceQueuesChannels':function(_0x29fd46){return new Promise(function(_0x24b79b,_0x2154a4){var _0x185126=_[_0x9342('0x56')](_0x57699a[_0x9342('0x74')]);_0x24b79b({'count':_0x185126[_0x9342('0x58')],'rows':_0x185126});});},'VoiceQueuesChannel':function(_0x5b4842){var _0x11404f=this;return new Promise(function(_0x5c1531,_0x5e4dea){var _0x957238=schema(properties[_0x9342('0x75')])[_0x9342('0x3')](_0x5b4842);if(_0x957238['length']>0x0){return _0x5e4dea(_0x11404f['error'](0x1f4,_[_0x9342('0x5b')](_0x957238,_0x9342('0x1b'))['join'](',\x20')));}var _0x250682=_[_0x9342('0x5c')](_0x57699a[_0x9342('0x74')],{'uniqueid':_0x5b4842['uniqueid']});if(_0x250682){_0x5c1531(_0x250682);}else{return _0x5e4dea(_0x11404f[_0x9342('0x10')](0x1f5,_0x9342('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x1306df){var _0x10a534=this;return new Promise(function(_0xe55acd,_0x2a1899){if(ami[_0x9342('0x59')]()==![]){return _0x2a1899(_0x10a534[_0x9342('0x10')](0x1f4,[config[_0x9342('0x11')]['ip'],config[_0x9342('0x11')][_0x9342('0x12')],_0x9342('0x13')][_0x9342('0x1d')]('\x20')));}var _0x1775a2=schema(properties[_0x9342('0x76')])[_0x9342('0x3')](_0x1306df);if(_0x1775a2[_0x9342('0x58')]>0x0){return _0x2a1899(_0x10a534[_0x9342('0x10')](0x1f4,_[_0x9342('0x5b')](_0x1775a2,_0x9342('0x1b'))['join'](',\x20')));}var _0x32e74a=_[_0x9342('0x5c')](_0x57699a['queueChannels'],{'uniqueid':_0x1306df[_0x9342('0x5d')]});if(_0x32e74a&&_0x32e74a['channel']){return ami[_0x9342('0x19')]({'action':_0x9342('0x77'),'channel':_0x32e74a[_0x9342('0x5e')]})[_0x9342('0x1a')](function(_0x1da116){_0xe55acd({'code':0xc8,'message':[_0x1306df[_0x9342('0x5d')],_0x1da116[_0x9342('0x1b')][_0x9342('0x68')]()]['join']('\x20')});})[_0x9342('0x1c')](function(_0x587181){_0x2a1899(_0x10a534[_0x9342('0x10')](0x1f5,[_0x1306df[_0x9342('0x5d')],_0x587181[_0x9342('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x2a1899(_0x10a534[_0x9342('0x10')](0x1f5,_0x9342('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x5a65d9){var _0x489349=this;return new Promise(function(_0x5b5e8f,_0x40a5b){if(ami[_0x9342('0x59')]()==![]){return _0x40a5b(_0x489349[_0x9342('0x10')](0x1f4,[config[_0x9342('0x11')]['ip'],config[_0x9342('0x11')][_0x9342('0x12')],'ami\x20disconnected'][_0x9342('0x1d')]('\x20')));}var _0x596bbb=schema(properties[_0x9342('0x78')])['validate'](_0x5a65d9);if(_0x596bbb[_0x9342('0x58')]>0x0){return _0x40a5b(_0x489349['error'](0x1f4,_[_0x9342('0x5b')](_0x596bbb,'message')[_0x9342('0x1d')](',\x20')));}var _0x46adf9=_['find'](_0x57699a['queueChannels'],{'uniqueid':_0x5a65d9[_0x9342('0x5d')]});if(_0x46adf9&&_0x46adf9[_0x9342('0x5e')]){return ami[_0x9342('0x19')]({'action':'Redirect','channel':_0x46adf9[_0x9342('0x5e')],'exten':_0x5a65d9[_0x9342('0x79')],'context':_0x5a65d9[_0x9342('0x7a')]||_0x46adf9[_0x9342('0x7a')],'priority':0x1})[_0x9342('0x1a')](function(_0x3fc2f0){_0x5b5e8f({'code':0xc8,'message':[_0x5a65d9[_0x9342('0x5d')],_0x3fc2f0['message'][_0x9342('0x68')]()][_0x9342('0x1d')]('\x20')});})[_0x9342('0x1c')](function(_0x109321){_0x40a5b(_0x489349[_0x9342('0x10')](0x1f5,[_0x5a65d9[_0x9342('0x5d')],_0x109321['message'][_0x9342('0x68')]()]['join']('\x20')));});}else{return _0x40a5b(_0x489349[_0x9342('0x10')](0x1f5,_0x9342('0x6e')));}});},'Agents':function(_0x1c8558){return new Promise(function(_0x573927,_0x215e5c){var _0x21f5fe=_[_0x9342('0x56')](_0x57699a['agents']);_0x573927({'count':_0x21f5fe['length'],'rows':_0x21f5fe});});},'Telephones':function(_0x2d43e1){return new Promise(function(_0xaddf03,_0x59431c){var _0x4735b0=_['values'](_0x57699a[_0x9342('0x7b')]);_0xaddf03({'count':_0x4735b0[_0x9342('0x58')],'rows':_0x4735b0});});},'Trunks':function(_0x530814){return new Promise(function(_0x2d38e6,_0xe2694a){var _0x13afde=_[_0x9342('0x56')](_0x57699a[_0x9342('0x7c')]);_0x2d38e6({'count':_0x13afde['length'],'rows':_0x13afde});});},'OutboundChannels':function(_0x28ad42){return new Promise(function(_0x49520a,_0x24f1bc){var _0x1cb7bd=_[_0x9342('0x56')](_0x57699a[_0x9342('0x7d')]);_0x49520a({'count':_0x1cb7bd[_0x9342('0x58')],'rows':_0x1cb7bd});});},'Outbound':function(_0x7e5e44){return new Promise(function(_0x1516b2,_0x15527e){_0x1516b2(_0x57699a['outbound']);});},'Campaigns':function(_0x29eecc){return new Promise(function(_0x2ee74f,_0x289631){var _0x58725f=_[_0x9342('0x56')](_0x57699a[_0x9342('0x7e')]);_0x2ee74f({'count':_0x58725f[_0x9342('0x58')],'rows':_0x58725f});});},'VoiceQueuesPreview':function(_0x2c7e4c){var _0x2ef0d7=this;return new Promise(function(_0x1b0f92,_0x3f7253){_0x4a4801[_0x9342('0x7f')](_0x2c7e4c['id'])[_0x9342('0x1a')](function(_0x4abf50){_0x1b0f92({'code':0xc8,'message':_0x4abf50[_0x9342('0x1b')]});})['catch'](function(_0x7cf44a){_0x3f7253(_0x2ef0d7[_0x9342('0x10')](0x1f4,_0x7cf44a['message']));});});},'EventManager':function(_0x29ba46){var _0x3d1ab7=this;return new Promise(function(_0x442980,_0x1e4405){if(!_0x29ba46[_0x9342('0x80')]){return _0x1e4405(_0x3d1ab7[_0x9342('0x10')](0x1f4,_0x9342('0x81')));}ami[_0x9342('0x82')](_0x9342('0x83')+_0x29ba46[_0x9342('0x80')],_0x29ba46[_0x9342('0x1b')]);_0x442980({'code':0xc8,'message':_0x29ba46});});},'FaxAccounts':function(_0x400192){return new Promise(function(_0x4ee3fd,_0xc9d10a){var _0x30f7b7=_[_0x9342('0x56')](_0x57699a['faxAccounts']);_0x4ee3fd({'count':_0x30f7b7[_0x9342('0x58')],'rows':_0x30f7b7});});},'SendFax':function(_0x37f093){var _0x48eb59=this;return new Promise(function(_0x48c79f,_0x4137a1){_0x55d422['send'](_0x37f093)[_0x9342('0x1a')](function(_0x1315e2){_0x48c79f({'code':0xc8,'message':_0x1315e2['message']});})['catch'](function(_0x11faad){_0x4137a1(_0x48eb59[_0x9342('0x10')](0x1f4,_0x11faad['message']));});});},'CheckAfterSend':function(_0x59aa36){var _0x2266a2=this;return new Promise(function(_0x3b733a,_0x2d5503){_0x55d422['checkAfterSend'](_0x59aa36)[_0x9342('0x1a')](function(_0x793b6d){_0x3b733a({'code':0xc8,'message':_0x793b6d[_0x9342('0x1b')]});})[_0x9342('0x1c')](function(_0x271b0d){_0x2d5503(_0x2266a2[_0x9342('0x10')](0x1f4,_0x271b0d[_0x9342('0x1b')]));});});}};var _0x16e350=jayson[_0x9342('0x84')](_0x9be78f)[_0x9342('0x85')]();_0x16e350['on'](_0x9342('0x10'),function(_0x45dd2d){return _0x58e9f4(_0x45dd2d);});_0x16e350[_0x9342('0x8')](0x232a,_0x9342('0x86'),function(){console['log'](_0x9342('0x87'),0x232a);return _0x3b9c7c('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 18380f8..b1332e2 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 _0x9db7=['data1','calleridnum','calleridname','','uniqueid','firstName','destcalleridname','destcalleridnum','phone','resolve','then','showContact','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format','user:%s','name','trigger:%s','action','toLowerCase','merge','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','bluebird','util','lodash','ioredis','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[%s][%s]','stringify','emit','autoCreate','data2'];(function(_0x380cb4,_0x295f49){var _0x3e3a98=function(_0x733f79){while(--_0x733f79){_0x380cb4['push'](_0x380cb4['shift']());}};_0x3e3a98(++_0x295f49);}(_0x9db7,0x1bf));var _0x79db=function(_0x3698db,_0x33b3c5){_0x3698db=_0x3698db-0x0;var _0x65c056=_0x9db7[_0x3698db];return _0x65c056;};'use strict';var BPromise=require(_0x79db('0x0'));var util=require(_0x79db('0x1'));var _=require(_0x79db('0x2'));var Redis=require(_0x79db('0x3'));var config=require('../../../../config/environment');var logger=require(_0x79db('0x4'))('trigger');var cmContactRpc=require(_0x79db('0x5'));config[_0x79db('0x6')]=_['defaults'](config[_0x79db('0x6')],{'host':_0x79db('0x7'),'port':0x18eb});var io=require(_0x79db('0x8'))(new Redis(config[_0x79db('0x6')]));function emit(_0x7980b1,_0x395883,_0x214bf9,_0x792510){logger[_0x79db('0x9')](_0x79db('0xa'),_0x7980b1,'',_0x395883,_0x214bf9,JSON[_0x79db('0xb')](_0x792510));io['to'](_0x395883)[_0x79db('0xc')](_0x214bf9,_0x792510);}exports['exec']=function(_0x37a537,_0x1d277f,_0x5e7ac7){_0x5e7ac7[_0x79db('0xd')]=0x0;if(_0x1d277f[_0x79db('0xe')]&&parseInt(_0x1d277f[_0x79db('0xe')],0xa)){var _0x1030c0={'ListId':parseInt(_0x1d277f[_0x79db('0xf')],0xa),'phone':_0x5e7ac7[_0x79db('0x10')]};if(_['isNil'](_0x5e7ac7['routeId'])){_0x1030c0['firstName']=_0x5e7ac7[_0x79db('0x11')]&&_0x5e7ac7['calleridname']!==_0x79db('0x12')?_0x5e7ac7['calleridname']:_0x5e7ac7[_0x79db('0x10')]||_0x5e7ac7[_0x79db('0x13')];}else{_0x1030c0[_0x79db('0x14')]=_0x5e7ac7[_0x79db('0x15')]&&_0x5e7ac7[_0x79db('0x15')]!==_0x79db('0x12')?_0x5e7ac7[_0x79db('0x15')]:_0x5e7ac7[_0x79db('0x16')]||_0x5e7ac7[_0x79db('0x13')];_0x1030c0[_0x79db('0x17')]=_0x5e7ac7[_0x79db('0x15')]&&_0x5e7ac7[_0x79db('0x15')]!==_0x79db('0x12')?_0x5e7ac7['destcalleridname']:_0x5e7ac7[_0x79db('0x16')]||_0x5e7ac7[_0x79db('0x13')];}BPromise[_0x79db('0x18')]()[_0x79db('0x19')](cmContactRpc[_0x79db('0x1a')]({'where':_['omit'](_0x1030c0,[_0x79db('0x14')])}))[_0x79db('0x19')](function(_0x4cd9f4){if(_0x4cd9f4){logger[_0x79db('0x9')](_0x79db('0x1b'),_0x5e7ac7['uniqueid'],'',_0x4cd9f4['id']);if(_0x37a537){_0x5e7ac7[_0x79db('0x1c')]=_0x4cd9f4['id'];emit(_0x5e7ac7[_0x79db('0x13')],util[_0x79db('0x1d')](_0x79db('0x1e'),_0x37a537[_0x79db('0x1f')]),util[_0x79db('0x1d')](_0x79db('0x20'),_0x1d277f[_0x79db('0x21')][_0x79db('0x22')]()),_[_0x79db('0x23')](_0x5e7ac7,{'ListId':parseInt(_0x1d277f[_0x79db('0xf')],0xa)}));}return;}else{logger[_0x79db('0x9')](_0x79db('0x24'),_0x5e7ac7[_0x79db('0x13')],'');return BPromise[_0x79db('0x18')]()['then'](cmContactRpc[_0x79db('0x25')](_0x1030c0));}})[_0x79db('0x19')](function(_0x592c38){if(_0x592c38){logger['info'](_0x79db('0x26'),_0x5e7ac7[_0x79db('0x13')],'',_0x592c38['id']);if(_0x37a537){_0x5e7ac7[_0x79db('0x1c')]=_0x592c38['id'];emit(_0x5e7ac7[_0x79db('0x13')],util[_0x79db('0x1d')](_0x79db('0x1e'),_0x37a537[_0x79db('0x1f')]),util[_0x79db('0x1d')](_0x79db('0x20'),_0x1d277f[_0x79db('0x21')][_0x79db('0x22')]()),_['merge'](_0x5e7ac7,{'ListId':parseInt(_0x1d277f[_0x79db('0xf')],0xa)}));}}})['catch'](function(_0x5de0b7){logger[_0x79db('0x27')](_0x79db('0x28'),_0x5e7ac7['uniqueid'],'',JSON[_0x79db('0xb')](_0x5de0b7));});}else{if(_0x37a537){logger[_0x79db('0x9')](_0x79db('0x29'),_0x5e7ac7['uniqueid'],'');emit(_0x5e7ac7[_0x79db('0x13')],util[_0x79db('0x1d')]('user:%s',_0x37a537[_0x79db('0x1f')]),util[_0x79db('0x1d')](_0x79db('0x20'),_0x1d277f[_0x79db('0x21')]['toLowerCase']()),_[_0x79db('0x23')]({'ListId':parseInt(_0x1d277f['data1'],0xa)},_0x5e7ac7));}}}; \ No newline at end of file +var _0x883b=['action','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','util','lodash','ioredis','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','calleridname','','uniqueid','firstName','destcalleridname','destcalleridnum','phone','resolve','then','showContact','format','user:%s','name','trigger:%s','toLowerCase','merge','[%s][%s]\x20Contact\x20not\x20found','xmd-contactid2'];(function(_0xfd0a86,_0x11bf5d){var _0x180539=function(_0x31dce8){while(--_0x31dce8){_0xfd0a86['push'](_0xfd0a86['shift']());}};_0x180539(++_0x11bf5d);}(_0x883b,0x15d));var _0xb883=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x883b[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require('bluebird');var util=require(_0xb883('0x0'));var _=require(_0xb883('0x1'));var Redis=require(_0xb883('0x2'));var config=require('../../../../config/environment');var logger=require(_0xb883('0x3'))('trigger');var cmContactRpc=require(_0xb883('0x4'));config[_0xb883('0x5')]=_[_0xb883('0x6')](config[_0xb883('0x5')],{'host':_0xb883('0x7'),'port':0x18eb});var io=require(_0xb883('0x8'))(new Redis(config[_0xb883('0x5')]));function emit(_0x37c207,_0x1d7f9e,_0x3495c7,_0x32674d){logger[_0xb883('0x9')](_0xb883('0xa'),_0x37c207,'',_0x1d7f9e,_0x3495c7,JSON[_0xb883('0xb')](_0x32674d));io['to'](_0x1d7f9e)[_0xb883('0xc')](_0x3495c7,_0x32674d);}exports[_0xb883('0xd')]=function(_0x5aa802,_0x3e212a,_0x520d0d){_0x520d0d[_0xb883('0xe')]=0x0;if(_0x3e212a['data2']&&parseInt(_0x3e212a[_0xb883('0xf')],0xa)){var _0x3b6c3b={'ListId':parseInt(_0x3e212a[_0xb883('0x10')],0xa),'phone':_0x520d0d[_0xb883('0x11')]};if(_[_0xb883('0x12')](_0x520d0d[_0xb883('0x13')])){_0x3b6c3b['firstName']=_0x520d0d[_0xb883('0x14')]&&_0x520d0d['calleridname']!==_0xb883('0x15')?_0x520d0d[_0xb883('0x14')]:_0x520d0d[_0xb883('0x11')]||_0x520d0d[_0xb883('0x16')];}else{_0x3b6c3b[_0xb883('0x17')]=_0x520d0d[_0xb883('0x18')]&&_0x520d0d[_0xb883('0x18')]!==_0xb883('0x15')?_0x520d0d[_0xb883('0x18')]:_0x520d0d[_0xb883('0x19')]||_0x520d0d['uniqueid'];_0x3b6c3b[_0xb883('0x1a')]=_0x520d0d[_0xb883('0x18')]&&_0x520d0d[_0xb883('0x18')]!==''?_0x520d0d[_0xb883('0x18')]:_0x520d0d['destcalleridnum']||_0x520d0d[_0xb883('0x16')];}BPromise[_0xb883('0x1b')]()[_0xb883('0x1c')](cmContactRpc[_0xb883('0x1d')]({'where':_['omit'](_0x3b6c3b,['firstName'])}))[_0xb883('0x1c')](function(_0x11e448){if(_0x11e448){logger[_0xb883('0x9')]('[%s][%s]\x20Contact\x20found:%s',_0x520d0d[_0xb883('0x16')],'',_0x11e448['id']);if(_0x5aa802){_0x520d0d['xmd-contactid2']=_0x11e448['id'];emit(_0x520d0d['uniqueid'],util[_0xb883('0x1e')](_0xb883('0x1f'),_0x5aa802[_0xb883('0x20')]),util[_0xb883('0x1e')](_0xb883('0x21'),_0x3e212a['action'][_0xb883('0x22')]()),_[_0xb883('0x23')](_0x520d0d,{'ListId':parseInt(_0x3e212a[_0xb883('0x10')],0xa)}));}return;}else{logger[_0xb883('0x9')](_0xb883('0x24'),_0x520d0d[_0xb883('0x16')],'');return BPromise[_0xb883('0x1b')]()[_0xb883('0x1c')](cmContactRpc['createContact'](_0x3b6c3b));}})[_0xb883('0x1c')](function(_0x12208e){if(_0x12208e){logger['info']('[%s][%s]\x20Contact\x20created:%s',_0x520d0d[_0xb883('0x16')],'',_0x12208e['id']);if(_0x5aa802){_0x520d0d[_0xb883('0x25')]=_0x12208e['id'];emit(_0x520d0d[_0xb883('0x16')],util[_0xb883('0x1e')](_0xb883('0x1f'),_0x5aa802[_0xb883('0x20')]),util[_0xb883('0x1e')](_0xb883('0x21'),_0x3e212a[_0xb883('0x26')][_0xb883('0x22')]()),_[_0xb883('0x23')](_0x520d0d,{'ListId':parseInt(_0x3e212a['data1'],0xa)}));}}})[_0xb883('0x27')](function(_0x5e61f0){logger[_0xb883('0x28')](_0xb883('0x29'),_0x520d0d[_0xb883('0x16')],'',JSON[_0xb883('0xb')](_0x5e61f0));});}else{if(_0x5aa802){logger[_0xb883('0x9')](_0xb883('0x2a'),_0x520d0d[_0xb883('0x16')],'');emit(_0x520d0d[_0xb883('0x16')],util['format'](_0xb883('0x1f'),_0x5aa802['name']),util[_0xb883('0x1e')](_0xb883('0x21'),_0x3e212a[_0xb883('0x26')][_0xb883('0x22')]()),_['merge']({'ListId':parseInt(_0x3e212a['data1'],0xa)},_0x520d0d));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ad55fa5..06d416e 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 _0xaf73=['dynamics365Accounts','accounts','sugarcrmAccounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','stringify','emit','clone','interface','checkTriggers','triggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','toLowerCase','contactmanager','browser','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','data5','data6','600','winArguments','format','user:%s','name','trigger:%s:%s','data1','jscripty','trigger:%s','action','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','AllConditions','every','checkConditions','channel','length','some','AnyConditions','field','account','chat','ChatWebsiteId','value','interaction','event','operator','agent','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts'];(function(_0x50ccd1,_0x5cd5a0){var _0x151ece=function(_0x136dce){while(--_0x136dce){_0x50ccd1['push'](_0x50ccd1['shift']());}};_0x151ece(++_0x5cd5a0);}(_0xaf73,0x149));var _0x3af7=function(_0x557568,_0x10338c){_0x557568=_0x557568-0x0;var _0x34271a=_0xaf73[_0x557568];return _0x34271a;};'use strict';var util=require(_0x3af7('0x0'));var _=require(_0x3af7('0x1'));var url=require(_0x3af7('0x2'));var Mustache=require(_0x3af7('0x3'));var Redis=require(_0x3af7('0x4'));var urlforward=require(_0x3af7('0x5'));var integration=require(_0x3af7('0x6'));var cmContact=require(_0x3af7('0x7'));var script=require(_0x3af7('0x8'));var cmContactRpc=require(_0x3af7('0x9'));var config=require(_0x3af7('0xa'));var logger=require(_0x3af7('0xb'))(_0x3af7('0xc'));var ami=require(_0x3af7('0xd'));config[_0x3af7('0xe')]=_[_0x3af7('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3af7('0xe')]));var operators={'equals':function(_0x463cf8,_0x16ec70){return _0x463cf8==_0x16ec70;},'not_equals':function(_0x1592b9,_0x5e0d7e){return _0x1592b9!=_0x5e0d7e;}};var barAndWebActions=['popup',_0x3af7('0x2'),_0x3af7('0x10')];function Trigger(_0x185582){this['triggers']=_0x185582['triggers'];this[_0x3af7('0x11')]=_0x185582[_0x3af7('0x11')];this['voiceQueues']=_0x185582[_0x3af7('0x12')];this[_0x3af7('0x13')]=_0x185582['templates'];this[_0x3af7('0x14')]=_0x185582['voiceExtensions'];this[_0x3af7('0x15')]=_0x185582[_0x3af7('0x15')];this[_0x3af7('0x16')]=_0x185582[_0x3af7('0x16')];this[_0x3af7('0x17')]=_0x185582[_0x3af7('0x17')];this['sugarcrmAccounts']=_0x185582['sugarcrmAccounts'];this[_0x3af7('0x18')]=_0x185582[_0x3af7('0x18')];this[_0x3af7('0x19')]=_0x185582['deskAccounts'];this[_0x3af7('0x1a')]=_0x185582[_0x3af7('0x1a')];this[_0x3af7('0x1b')]=_0x185582[_0x3af7('0x1b')];this['dynamics365Accounts']=_0x185582[_0x3af7('0x1c')];this['freshsalesAccounts']=_0x185582['freshsalesAccounts'];this[_0x3af7('0x1d')]={'zendesk':this[_0x3af7('0x15')],'salesforce':this[_0x3af7('0x17')],'freshdesk':this[_0x3af7('0x16')],'sugarcrm':this[_0x3af7('0x1e')],'zoho':this[_0x3af7('0x18')],'desk':this[_0x3af7('0x19')],'vtiger':this[_0x3af7('0x1a')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x3af7('0x1f')],'servicenow':this[_0x3af7('0x1b')]};ami['on'](_0x3af7('0x20'),this[_0x3af7('0x21')][_0x3af7('0x22')](this));ami['on'](_0x3af7('0x23'),this[_0x3af7('0x21')]['bind'](this));ami['on'](_0x3af7('0x24'),this['syncCustomEvent'][_0x3af7('0x22')](this));ami['on']('custom:agentcomplete',this[_0x3af7('0x21')][_0x3af7('0x22')](this));ami['on']('custom:agentnosuchnumber',this[_0x3af7('0x21')][_0x3af7('0x22')](this));ami['on'](_0x3af7('0x25'),this[_0x3af7('0x21')]['bind'](this));ami['on'](_0x3af7('0x26'),this[_0x3af7('0x21')][_0x3af7('0x22')](this));ami['on'](_0x3af7('0x27'),this[_0x3af7('0x21')]['bind'](this));ami['on'](_0x3af7('0x28'),this[_0x3af7('0x21')][_0x3af7('0x22')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x3af7('0x22')](this));ami['on'](_0x3af7('0x29'),this[_0x3af7('0x21')]['bind'](this));ami['on'](_0x3af7('0x2a'),this[_0x3af7('0x2b')][_0x3af7('0x22')](this));ami['on']('custom:dialconnect',this[_0x3af7('0x2b')]['bind'](this));ami['on']('custom:dialend',this['syncAgentDial'][_0x3af7('0x22')](this));ami['on'](_0x3af7('0x2c'),this[_0x3af7('0x21')][_0x3af7('0x22')](this));ami['on'](_0x3af7('0x2d'),this[_0x3af7('0x21')][_0x3af7('0x22')](this));ami['on'](_0x3af7('0x2e'),this[_0x3af7('0x21')][_0x3af7('0x22')](this));ami['on']('custom:outgoingmessage',this[_0x3af7('0x21')]['bind'](this));ami['on'](_0x3af7('0x2f'),this[_0x3af7('0x21')][_0x3af7('0x22')](this));ami['on'](_0x3af7('0x30'),this['syncCustomEvent']['bind'](this));}Trigger[_0x3af7('0x31')]['emit']=function(_0xe8b94,_0x5c5234,_0x1731ed){logger[_0x3af7('0x32')](_0xe8b94,_0x5c5234,JSON[_0x3af7('0x33')](_0x1731ed));io['to'](_0xe8b94)[_0x3af7('0x34')](_0x5c5234,_0x1731ed);};Trigger[_0x3af7('0x31')][_0x3af7('0x21')]=function(_0x12d42c){var _0x30273c=_[_0x3af7('0x35')](_0x12d42c);this['checkTriggers'](_0x30273c);};Trigger[_0x3af7('0x31')][_0x3af7('0x2b')]=function(_0x2dc44e){if(this['agents'][_0x2dc44e[_0x3af7('0x36')]]){this[_0x3af7('0x21')](_0x2dc44e);}};Trigger[_0x3af7('0x31')][_0x3af7('0x37')]=function(_0x4993d3){var _0x24eeac;for(var _0x1ec1f2 in this[_0x3af7('0x38')]){if(this['triggers'][_0x3af7('0x39')](_0x1ec1f2)){if(this['triggers'][_0x1ec1f2][_0x3af7('0x3a')]){_0x24eeac=this[_0x3af7('0x3b')](this[_0x3af7('0x38')][_0x1ec1f2],_0x4993d3);if(_0x24eeac){_[_0x3af7('0x3c')](_0x4993d3,_0x4993d3[_0x3af7('0x3d')]);for(var _0xff1ede=0x0,_0x4f9587,_0x37c034,_0x631c69;_0xff1ede0x0){_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(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 1a70ea0..f267b12 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 _0xdfa5=['content','incident','incidents','assign','getString','Subjects','Descriptions','Fields','ticketType','phonecalls','callDirection','/contacts(','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','remoteUri','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','outbound','telephone1','contactid',']\x20Enduser\x20created!','forEach','string','customField','idField','indexOf'];(function(_0x48413c,_0x152292){var _0x5c33e1=function(_0x2f09ad){while(--_0x2f09ad){_0x48413c['push'](_0x48413c['shift']());}};_0x5c33e1(++_0x152292);}(_0xdfa5,0x82));var _0x5dfa=function(_0xa477e5,_0x4350b0){_0xa477e5=_0xa477e5-0x0;var _0x69f958=_0xdfa5[_0xa477e5];return _0x69f958;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x5dfa('0x0'));var util=require(_0x5dfa('0x1'));var intUtil=require(_0x5dfa('0x2'));var md5=require(_0x5dfa('0x3'));var Redis=require(_0x5dfa('0x4'));var logger=require(_0x5dfa('0x5'))(_0x5dfa('0x6'));var config=require(_0x5dfa('0x7'));config[_0x5dfa('0x8')]=_[_0x5dfa('0x9')](config[_0x5dfa('0x8')],{'host':_0x5dfa('0xa'),'port':0x18eb});var io=require(_0x5dfa('0xb'))(new Redis(config[_0x5dfa('0x8')]));function getAuthToken(_0x471059,_0x434b93,_0x40f76c){var _0x14f2bd={'method':_0x5dfa('0xc'),'uri':_0x434b93,'form':{'client_id':_0x471059[_0x5dfa('0xd')],'resource':_0x471059['remoteUri'],'username':_0x471059[_0x5dfa('0xe')],'password':_0x471059[_0x5dfa('0xf')],'grant_type':'password','client_secret':_0x471059[_0x5dfa('0x10')]},'json':!![]};return rp(_0x14f2bd)[_0x5dfa('0x11')](function(_0x3f453d){return _0x3f453d[_0x5dfa('0x12')];})[_0x5dfa('0x13')](function(_0x3c5832){logger[_0x5dfa('0x14')]('['+[_0x40f76c[_0x5dfa('0x15')]()]+']\x20Wrong\x20credentials!');return _0x3c5832[_0x5dfa('0x16')];});}function getUser(_0x507891,_0x16518e,_0x3ea914,_0x32790e,_0x58b1b7,_0x34c034){return new BPromise(function(_0x10de34,_0x3ffadd){return getAuthToken(_0x16518e,_0x32790e,_0x34c034)[_0x5dfa('0x11')](function(_0x5afd7f){var _0x1ed87d={'method':'GET','uri':_0x58b1b7+_0x5dfa('0x17'),'headers':{'Authorization':_0x5dfa('0x18')+_0x5afd7f,'OData-Version':_0x5dfa('0x19')},'json':!![]};return rp(_0x1ed87d);})[_0x5dfa('0x11')](function(_0xa3e081){var _0x129a1a=_0xa3e081[_0x5dfa('0x1a')];var _0xce3972=![];var _0x4f04ef=null;if(!_['isNil'](_0x3ea914)){if(intUtil[_0x5dfa('0x1b')](_0x3ea914[_0x5dfa('0x1c')])){_0x507891['userEmail']=_0x3ea914[_0x5dfa('0x1c')];for(_0x4f04ef=0x0;_0x4f04ef<_0x129a1a[_0x5dfa('0x1d')];_0x4f04ef++){if(_0x129a1a[_0x4f04ef][_0x5dfa('0x1e')]===_0x3ea914['email']&&!_0x129a1a[_0x4f04ef][_0x5dfa('0x1f')]){_0xce3972=!![];logger[_0x5dfa('0x20')]('['+[_0x34c034[_0x5dfa('0x15')]()]+_0x5dfa('0x21')+_0x129a1a[_0x4f04ef]['systemuserid']+'!');_0x507891[_0x5dfa('0x22')]=_0x129a1a[_0x4f04ef][_0x5dfa('0x23')];}}}}if(!_0xce3972){logger[_0x5dfa('0x20')]('['+[_0x34c034[_0x5dfa('0x15')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x507891['userEmail']=_0x16518e['username'];for(_0x4f04ef=0x0;_0x4f04ef<_0x129a1a[_0x5dfa('0x1d')];_0x4f04ef++){if(_0x129a1a[_0x4f04ef]['internalemailaddress']===_0x16518e[_0x5dfa('0xe')]){_0x507891[_0x5dfa('0x22')]=_0x129a1a[_0x4f04ef][_0x5dfa('0x23')];}}}_0x10de34(_0x507891);})['catch'](function(_0x7b169){_0x3ffadd(_0x7b169[_0x5dfa('0x16')]);});});}function createEndUser(_0x5a1d06,_0x2ac709,_0x5ec725,_0x532f0d,_0x53334b,_0x46a363){return new BPromise(function(_0x40c156,_0x4ee632){return getAuthToken(_0x2ac709,_0x5ec725,_0x46a363)['then'](function(_0x554415){var _0x5a311c=_0x46a363[_0x5dfa('0x24')]()==='outbound'?_0x53334b[_0x5dfa('0x25')]:_0x53334b[_0x5dfa('0x26')];var _0x27a5e6={'method':'POST','uri':_0x532f0d+_0x5dfa('0x27'),'body':{'telephone1':_0x5a311c,'fullname':_0x5a311c,'firstname':_0x5a311c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5dfa('0x28')+_0x5a1d06[_0x5dfa('0x22')]+')'},'headers':{'Authorization':_0x5dfa('0x18')+_0x554415,'OData-Version':_0x5dfa('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x27a5e6);})['then'](function(_0x553a95){var _0x3caa47=_0x553a95[_0x5dfa('0x29')][_0x5dfa('0x2a')];var _0xfaac46=_0x3caa47[_0x5dfa('0x2b')](_0x3caa47[_0x5dfa('0x2c')]('(')+0x1,_0x3caa47['lastIndexOf'](')'));_0x5a1d06[_0x5dfa('0x2d')]=_0xfaac46;_0x40c156(_0x5a1d06);})[_0x5dfa('0x13')](function(_0x17142d){_0x4ee632(_0x17142d['message']);});});}function getEndUser(_0x87b9ab,_0x3db761,_0x463fe9,_0x1e4ddf,_0x338fab,_0x2ab8c3){return new BPromise(function(_0x5f207b,_0x869411){return getAuthToken(_0x3db761,_0x463fe9,_0x2ab8c3)[_0x5dfa('0x11')](function(_0x4fc98e){var _0x5d5483={'method':_0x5dfa('0x2e'),'uri':_0x1e4ddf+'contacts?$select=telephone1','headers':{'Authorization':_0x5dfa('0x18')+_0x4fc98e,'If-None-Match':null,'OData-Version':_0x5dfa('0x19')},'json':!![]};return rp(_0x5d5483);})[_0x5dfa('0x11')](function(_0x3e9a18){var _0x292664=null;if(_0x3e9a18){var _0x51c86b=_0x3e9a18['value'];var _0x1d044a=![];for(_0x292664=0x0;_0x292664<_0x51c86b[_0x5dfa('0x1d')];_0x292664++){var _0x28b547=_0x2ab8c3[_0x5dfa('0x24')]()===_0x5dfa('0x2f')?_0x338fab['destcalleridnum']:_0x338fab[_0x5dfa('0x26')];if(_0x51c86b[_0x292664][_0x5dfa('0x30')]===_0x28b547){_0x1d044a=!![];_0x87b9ab[_0x5dfa('0x2d')]=_0x51c86b[_0x292664][_0x5dfa('0x31')];}}if(_0x1d044a){_0x5f207b(_0x87b9ab);}else{return createEndUser(_0x87b9ab,_0x3db761,_0x463fe9,_0x1e4ddf,_0x338fab,_0x2ab8c3)[_0x5dfa('0x11')](function(_0x2d0aa3){logger[_0x5dfa('0x20')]('['+[_0x2ab8c3[_0x5dfa('0x15')]()]+_0x5dfa('0x32'),_0x2d0aa3[_0x5dfa('0x2d')]);_0x5f207b(_0x2d0aa3);});}}else{return createEndUser(_0x87b9ab,_0x3db761,_0x463fe9,_0x1e4ddf,_0x338fab,_0x2ab8c3)[_0x5dfa('0x11')](function(_0x4478c5){logger[_0x5dfa('0x20')]('['+[_0x2ab8c3[_0x5dfa('0x15')]()]+']\x20Enduser\x20Created!',_0x4478c5['enduserId']);_0x5f207b(_0x4478c5);});}});});}function getCustomFields(_0xecaaad,_0x2a822c,_0x3c26c3){var _0x1acde2={};if(_0xecaaad[_0x5dfa('0x1d')]>0x0){_[_0x5dfa('0x33')](_0xecaaad,function(_0x1cb7ba){if(_0x1cb7ba['type']===_0x5dfa('0x34')&&_0x1cb7ba['nameField']&&!_0x1cb7ba[_0x5dfa('0x35')]){var _0x4e73dc=_0x1cb7ba[_0x5dfa('0x36')]['toLowerCase']();var _0x133d25=_0x4e73dc[_0x5dfa('0x2b')](0x0,_0x4e73dc[_0x5dfa('0x37')]('_'));var _0x68d57d=_0x4e73dc[_0x5dfa('0x2b')](_0x4e73dc[_0x5dfa('0x37')]('_')+0x1);if(_0x133d25===_0x3c26c3){_0x1acde2[_0x68d57d]=_0x1cb7ba[_0x5dfa('0x38')];}}});}return _0x1acde2;}function getTicket(_0xe7c7f9,_0x341873,_0x552aaa,_0x3a7629,_0x310d15,_0x371404,_0x9f84f){return new BPromise(function(_0x2debd5,_0x204f49){var _0x4df4f8;return getAuthToken(_0x341873,_0x552aaa,_0x9f84f)['then'](function(_0x12a801){if(_0x371404['ticketType']===_0x5dfa('0x39')){_0x4df4f8={'method':_0x5dfa('0xc'),'uri':_0x3a7629+_0x5dfa('0x3a'),'body':Object[_0x5dfa('0x3b')]({},{'title':intUtil[_0x5dfa('0x3c')](_0x371404[_0x5dfa('0x3d')],_0x310d15,'\x20'),'description':intUtil[_0x5dfa('0x3c')](_0x371404[_0x5dfa('0x3e')],_0x310d15,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0xe7c7f9['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0xe7c7f9[_0x5dfa('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x371404[_0x5dfa('0x3f')],_0x310d15,_0x371404[_0x5dfa('0x40')])),'headers':{'Authorization':_0x5dfa('0x18')+_0x12a801,'OData-Version':_0x5dfa('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x371404[_0x5dfa('0x40')]==='phonecall'){_0x4df4f8={'method':'POST','uri':_0x3a7629+_0x5dfa('0x41'),'body':Object[_0x5dfa('0x3b')]({},{'subject':intUtil[_0x5dfa('0x3c')](_0x371404['Subjects'],_0x310d15,'\x20'),'phonenumber':String(_0x310d15[_0x5dfa('0x26')]),'description':intUtil['getString'](_0x371404[_0x5dfa('0x3e')],_0x310d15,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0xe7c7f9[_0x5dfa('0x2d')]+')','ownerid@odata.bind':_0x5dfa('0x28')+_0xe7c7f9['userId']+')','directioncode':_0xe7c7f9[_0x5dfa('0x42')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5dfa('0x28')+_0xe7c7f9['userId']+')','participationtypemask':_0xe7c7f9[_0x5dfa('0x42')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x5dfa('0x43')+_0xe7c7f9[_0x5dfa('0x2d')]+')','participationtypemask':_0xe7c7f9[_0x5dfa('0x42')]===_0x5dfa('0x44')?0x1:0x2}]},getCustomFields(_0x371404[_0x5dfa('0x3f')],_0x310d15,_0x371404['ticketType'])),'headers':{'Authorization':_0x5dfa('0x18')+_0x12a801,'OData-Version':_0x5dfa('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4df4f8);})[_0x5dfa('0x11')](function(_0x240446){var _0x34003f=_0x240446[_0x5dfa('0x29')][_0x5dfa('0x2a')];var _0x39f6b5=_0x34003f['substring'](_0x34003f['lastIndexOf']('(')+0x1,_0x34003f[_0x5dfa('0x2c')](')'));_0xe7c7f9['ticketId']=_0x39f6b5;_0x2debd5(_0xe7c7f9);})[_0x5dfa('0x13')](function(_0x1b59fb){_0x204f49(_0x1b59fb[_0x5dfa('0x16')]);});});}function emit(_0x4bed9e,_0x4319cd,_0x32f1e7,_0x3fa892){var _0x5d1a2c={'uri':util[_0x5dfa('0x45')](_0x5dfa('0x46'),_0x4bed9e,_0x32f1e7,_0x3fa892)};io['to'](util[_0x5dfa('0x45')]('user:%s',_0x4319cd))[_0x5dfa('0x47')]('trigger:browser:url',_0x5d1a2c);}exports['cs']=function(_0x1195ba,_0x943efb,_0x6745b5,_0x2c65fe,_0x2cce6c,_0x205140,_0x35c547,_0x2181d4){var _0x5b23bb={};_0x205140[_0x5dfa('0x48')]=intUtil[_0x5dfa('0x49')](_0x205140[_0x5dfa('0x48')]);_0x205140[_0x5dfa('0x4a')]=intUtil[_0x5dfa('0x49')](_0x205140['serverUrl']);_0x5b23bb[_0x5dfa('0x42')]=_0x2181d4==='queue'||_0x2181d4==='unmanaged'?'queue':_0x5dfa('0x2f');var _0x5cadfb=util[_0x5dfa('0x45')]('%s/api/data/v9.0/',_0x205140[_0x5dfa('0x48')]);var _0x215082=util[_0x5dfa('0x45')](_0x5dfa('0x4b'),_0x205140[_0x5dfa('0x4c')]);var _0x19a25f=util[_0x5dfa('0x45')](_0x5dfa('0x4d'),_0x205140[_0x5dfa('0x4a')],_0x943efb[_0x5dfa('0x4e')],md5(_0x943efb[_0x5dfa('0x4e')]));if(_0x2cce6c&&_0x2cce6c[_0x5dfa('0x4f')]){logger[_0x5dfa('0x20')](_0x5dfa('0x50'),_0x5dfa('0x51'));_0x943efb[_0x5dfa('0x52')]=_0x19a25f;}else if(_0x35c547&&_0x35c547[_0x5dfa('0x53')]&&_0x35c547[_0x5dfa('0x53')]!==_0x5dfa('0x54')){logger[_0x5dfa('0x20')](_0x5dfa('0x55'),_0x5dfa('0x51'));_0x943efb[_0x5dfa('0x52')]=_0x19a25f;}else{_0x943efb['recordingURL']='';}return getUser(_0x5b23bb,_0x205140,_0x2c65fe,_0x215082,_0x5cadfb,_0x2181d4)[_0x5dfa('0x11')](function(_0x4590b1){logger[_0x5dfa('0x20')]('['+_0x2181d4[_0x5dfa('0x15')]()+_0x5dfa('0x56'),_0x4590b1[_0x5dfa('0x22')]);logger[_0x5dfa('0x20')]('['+_0x2181d4[_0x5dfa('0x15')]()+_0x5dfa('0x57'),_0x4590b1[_0x5dfa('0x58')]);return getEndUser(_0x4590b1,_0x205140,_0x215082,_0x5cadfb,_0x943efb,_0x2181d4);})[_0x5dfa('0x11')](function(_0x376c51){logger[_0x5dfa('0x20')]('['+_0x2181d4['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x376c51[_0x5dfa('0x2d')]);logger[_0x5dfa('0x20')]('['+_0x2181d4['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x943efb[_0x5dfa('0x26')]);return getTicket(_0x376c51,_0x205140,_0x215082,_0x5cadfb,_0x943efb,_0x6745b5,_0x2181d4);})[_0x5dfa('0x11')](function(_0x5397a8){logger[_0x5dfa('0x20')](util[_0x5dfa('0x45')]('['+_0x2181d4['toUpperCase']()+_0x5dfa('0x59'),_0x6745b5[_0x5dfa('0x40')],_0x5397a8['ticketId']));logger[_0x5dfa('0x20')](util['format']('['+_0x2181d4[_0x5dfa('0x15')]()+_0x5dfa('0x5a'),_0x2181d4));if(_0x2181d4!=='unmanaged'){logger[_0x5dfa('0x20')]('['+_0x2181d4[_0x5dfa('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x205140['remoteUri'],_0x2c65fe['name'],_0x6745b5['ticketType'],_0x5397a8['ticketId']);}})[_0x5dfa('0x13')](function(_0x452032){logger[_0x5dfa('0x14')]('['+_0x2181d4[_0x5dfa('0x15')]()+_0x5dfa('0x5b'),util[_0x5dfa('0x5c')](_0x452032,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1e01=['systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','userId','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','string','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','/contacts(','phonecall','phonecalls','Descriptions','callDirection','queue','Fields','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','remoteUri','serverUrl','stripTrailingSlash','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','bluebird','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','then','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','info','toUpperCase',']\x20Agent\x20found\x20'];(function(_0x855b1c,_0x131bc8){var _0x5b4c9e=function(_0x44a9a8){while(--_0x44a9a8){_0x855b1c['push'](_0x855b1c['shift']());}};_0x5b4c9e(++_0x131bc8);}(_0x1e01,0x169));var _0x11e0=function(_0x3c26f7,_0x24eeca){_0x3c26f7=_0x3c26f7-0x0;var _0x2acf85=_0x1e01[_0x3c26f7];return _0x2acf85;};'use strict';var _=require(_0x11e0('0x0'));var BPromise=require(_0x11e0('0x1'));var rp=require('request-promise');var util=require(_0x11e0('0x2'));var intUtil=require(_0x11e0('0x3'));var md5=require(_0x11e0('0x4'));var Redis=require(_0x11e0('0x5'));var logger=require(_0x11e0('0x6'))(_0x11e0('0x7'));var config=require(_0x11e0('0x8'));config[_0x11e0('0x9')]=_[_0x11e0('0xa')](config['redis'],{'host':_0x11e0('0xb'),'port':0x18eb});var io=require(_0x11e0('0xc'))(new Redis(config[_0x11e0('0x9')]));function getAuthToken(_0x9072f7,_0x19abac,_0x1218fc){var _0x2f0475={'method':_0x11e0('0xd'),'uri':_0x19abac,'form':{'client_id':_0x9072f7[_0x11e0('0xe')],'resource':_0x9072f7['remoteUri'],'username':_0x9072f7[_0x11e0('0xf')],'password':_0x9072f7['password'],'grant_type':_0x11e0('0x10'),'client_secret':_0x9072f7[_0x11e0('0x11')]},'json':!![]};return rp(_0x2f0475)[_0x11e0('0x12')](function(_0x26d75d){return _0x26d75d['access_token'];})['catch'](function(_0x35435d){logger[_0x11e0('0x13')]('['+[_0x1218fc['toUpperCase']()]+_0x11e0('0x14'));return _0x35435d[_0x11e0('0x15')];});}function getUser(_0x563f3e,_0x5f10d7,_0x302939,_0x19e02f,_0x10d4cf,_0x41c2f0){return new BPromise(function(_0x19a22b,_0x1be035){return getAuthToken(_0x5f10d7,_0x19e02f,_0x41c2f0)[_0x11e0('0x12')](function(_0x371b29){var _0x921604={'method':_0x11e0('0x16'),'uri':_0x10d4cf+_0x11e0('0x17'),'headers':{'Authorization':_0x11e0('0x18')+_0x371b29,'OData-Version':_0x11e0('0x19')},'json':!![]};return rp(_0x921604);})[_0x11e0('0x12')](function(_0x5633d1){var _0x286d4e=_0x5633d1[_0x11e0('0x1a')];var _0x143368=![];var _0x2863fe=null;if(!_[_0x11e0('0x1b')](_0x302939)){if(intUtil[_0x11e0('0x1c')](_0x302939[_0x11e0('0x1d')])){_0x563f3e[_0x11e0('0x1e')]=_0x302939[_0x11e0('0x1d')];for(_0x2863fe=0x0;_0x2863fe<_0x286d4e[_0x11e0('0x1f')];_0x2863fe++){if(_0x286d4e[_0x2863fe]['internalemailaddress']===_0x302939[_0x11e0('0x1d')]&&!_0x286d4e[_0x2863fe]['isdisabled']){_0x143368=!![];logger[_0x11e0('0x20')]('['+[_0x41c2f0[_0x11e0('0x21')]()]+_0x11e0('0x22')+_0x286d4e[_0x2863fe][_0x11e0('0x23')]+'!');_0x563f3e['userId']=_0x286d4e[_0x2863fe][_0x11e0('0x23')];}}}}if(!_0x143368){logger['info']('['+[_0x41c2f0[_0x11e0('0x21')]()]+_0x11e0('0x24'));_0x563f3e[_0x11e0('0x1e')]=_0x5f10d7[_0x11e0('0xf')];for(_0x2863fe=0x0;_0x2863fe<_0x286d4e[_0x11e0('0x1f')];_0x2863fe++){if(_0x286d4e[_0x2863fe][_0x11e0('0x25')]===_0x5f10d7[_0x11e0('0xf')]){_0x563f3e[_0x11e0('0x26')]=_0x286d4e[_0x2863fe]['systemuserid'];}}}_0x19a22b(_0x563f3e);})[_0x11e0('0x27')](function(_0x5e5099){_0x1be035(_0x5e5099['message']);});});}function createEndUser(_0x5b7ea6,_0x56d6a1,_0x131647,_0x4de6f4,_0xe6f457,_0x3b3c67){return new BPromise(function(_0x3ca31b,_0x2b3358){return getAuthToken(_0x56d6a1,_0x131647,_0x3b3c67)[_0x11e0('0x12')](function(_0x2bc2bf){var _0x4f639f=_0x3b3c67[_0x11e0('0x28')]()===_0x11e0('0x29')?_0xe6f457[_0x11e0('0x2a')]:_0xe6f457[_0x11e0('0x2b')];var _0x3f77bd={'method':_0x11e0('0xd'),'uri':_0x4de6f4+_0x11e0('0x2c'),'body':{'telephone1':_0x4f639f,'fullname':_0x4f639f,'firstname':_0x4f639f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x11e0('0x2d')+_0x5b7ea6[_0x11e0('0x26')]+')'},'headers':{'Authorization':_0x11e0('0x18')+_0x2bc2bf,'OData-Version':_0x11e0('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3f77bd);})['then'](function(_0xb3dbef){var _0x3ea733=_0xb3dbef[_0x11e0('0x2e')][_0x11e0('0x2f')];var _0x37be95=_0x3ea733[_0x11e0('0x30')](_0x3ea733[_0x11e0('0x31')]('(')+0x1,_0x3ea733[_0x11e0('0x31')](')'));_0x5b7ea6[_0x11e0('0x32')]=_0x37be95;_0x3ca31b(_0x5b7ea6);})[_0x11e0('0x27')](function(_0x3c77c3){_0x2b3358(_0x3c77c3[_0x11e0('0x15')]);});});}function getEndUser(_0x180754,_0x1be745,_0x331534,_0x3e8580,_0x832917,_0x427e41){return new BPromise(function(_0x2d5e16,_0x5ad881){return getAuthToken(_0x1be745,_0x331534,_0x427e41)[_0x11e0('0x12')](function(_0xa56621){var _0x55cf4e={'method':_0x11e0('0x16'),'uri':_0x3e8580+_0x11e0('0x33'),'headers':{'Authorization':_0x11e0('0x18')+_0xa56621,'If-None-Match':null,'OData-Version':_0x11e0('0x19')},'json':!![]};return rp(_0x55cf4e);})[_0x11e0('0x12')](function(_0x425b6b){var _0x4772ab=null;if(_0x425b6b){var _0x478acf=_0x425b6b['value'];var _0x3a90f9=![];for(_0x4772ab=0x0;_0x4772ab<_0x478acf[_0x11e0('0x1f')];_0x4772ab++){var _0xf25c6b=_0x427e41[_0x11e0('0x28')]()===_0x11e0('0x29')?_0x832917[_0x11e0('0x2a')]:_0x832917[_0x11e0('0x2b')];if(_0x478acf[_0x4772ab][_0x11e0('0x34')]===_0xf25c6b){_0x3a90f9=!![];_0x180754[_0x11e0('0x32')]=_0x478acf[_0x4772ab]['contactid'];}}if(_0x3a90f9){_0x2d5e16(_0x180754);}else{return createEndUser(_0x180754,_0x1be745,_0x331534,_0x3e8580,_0x832917,_0x427e41)[_0x11e0('0x12')](function(_0x20cb20){logger['info']('['+[_0x427e41['toUpperCase']()]+_0x11e0('0x35'),_0x20cb20[_0x11e0('0x32')]);_0x2d5e16(_0x20cb20);});}}else{return createEndUser(_0x180754,_0x1be745,_0x331534,_0x3e8580,_0x832917,_0x427e41)[_0x11e0('0x12')](function(_0x3099c8){logger[_0x11e0('0x20')]('['+[_0x427e41['toUpperCase']()]+_0x11e0('0x36'),_0x3099c8[_0x11e0('0x32')]);_0x2d5e16(_0x3099c8);});}});});}function getCustomFields(_0x2eaf60,_0x3afb67,_0x1c66b3){var _0x2bff92={};if(_0x2eaf60['length']>0x0){_['forEach'](_0x2eaf60,function(_0x14e3bc){if(_0x14e3bc[_0x11e0('0x37')]===_0x11e0('0x38')&&_0x14e3bc['nameField']&&!_0x14e3bc[_0x11e0('0x39')]){var _0x4e2caf=_0x14e3bc[_0x11e0('0x3a')][_0x11e0('0x28')]();var _0x382337=_0x4e2caf[_0x11e0('0x30')](0x0,_0x4e2caf[_0x11e0('0x3b')]('_'));var _0x534225=_0x4e2caf[_0x11e0('0x30')](_0x4e2caf[_0x11e0('0x3b')]('_')+0x1);if(_0x382337===_0x1c66b3){_0x2bff92[_0x534225]=_0x14e3bc[_0x11e0('0x3c')];}}});}return _0x2bff92;}function getTicket(_0x201944,_0x1b663a,_0x50cba,_0x46f6ef,_0x3e6ff1,_0x27f6b9,_0x3682ed){return new BPromise(function(_0x598387,_0x2410a0){var _0x340a45;return getAuthToken(_0x1b663a,_0x50cba,_0x3682ed)['then'](function(_0x1d625f){if(_0x27f6b9[_0x11e0('0x3d')]==='incident'){_0x340a45={'method':'POST','uri':_0x46f6ef+_0x11e0('0x3e'),'body':Object[_0x11e0('0x3f')]({},{'title':intUtil[_0x11e0('0x40')](_0x27f6b9[_0x11e0('0x41')],_0x3e6ff1,'\x20'),'description':intUtil[_0x11e0('0x40')](_0x27f6b9['Descriptions'],_0x3e6ff1,'\x0a'),'customerid_contact@odata.bind':_0x11e0('0x42')+_0x201944[_0x11e0('0x32')]+')','ownerid@odata.bind':_0x11e0('0x2d')+_0x201944['userId']+')','caseorigincode':'1'},getCustomFields(_0x27f6b9['Fields'],_0x3e6ff1,_0x27f6b9[_0x11e0('0x3d')])),'headers':{'Authorization':_0x11e0('0x18')+_0x1d625f,'OData-Version':_0x11e0('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x27f6b9['ticketType']===_0x11e0('0x43')){_0x340a45={'method':_0x11e0('0xd'),'uri':_0x46f6ef+_0x11e0('0x44'),'body':Object[_0x11e0('0x3f')]({},{'subject':intUtil[_0x11e0('0x40')](_0x27f6b9[_0x11e0('0x41')],_0x3e6ff1,'\x20'),'phonenumber':String(_0x3e6ff1[_0x11e0('0x2b')]),'description':intUtil[_0x11e0('0x40')](_0x27f6b9[_0x11e0('0x45')],_0x3e6ff1,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x201944[_0x11e0('0x32')]+')','ownerid@odata.bind':_0x11e0('0x2d')+_0x201944[_0x11e0('0x26')]+')','directioncode':_0x201944['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x11e0('0x2d')+_0x201944[_0x11e0('0x26')]+')','participationtypemask':_0x201944[_0x11e0('0x46')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x11e0('0x42')+_0x201944[_0x11e0('0x32')]+')','participationtypemask':_0x201944[_0x11e0('0x46')]===_0x11e0('0x47')?0x1:0x2}]},getCustomFields(_0x27f6b9[_0x11e0('0x48')],_0x3e6ff1,_0x27f6b9['ticketType'])),'headers':{'Authorization':_0x11e0('0x18')+_0x1d625f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x340a45);})[_0x11e0('0x12')](function(_0x1b2ec4){var _0xedcd99=_0x1b2ec4[_0x11e0('0x2e')]['odata-entityid'];var _0x3e9ced=_0xedcd99[_0x11e0('0x30')](_0xedcd99['lastIndexOf']('(')+0x1,_0xedcd99[_0x11e0('0x31')](')'));_0x201944[_0x11e0('0x49')]=_0x3e9ced;_0x598387(_0x201944);})[_0x11e0('0x27')](function(_0x580352){_0x2410a0(_0x580352[_0x11e0('0x15')]);});});}function emit(_0x396ede,_0x39ea22,_0x517f6d,_0x49ddab){var _0x1537e9={'uri':util['format'](_0x11e0('0x4a'),_0x396ede,_0x517f6d,_0x49ddab)};io['to'](util[_0x11e0('0x4b')](_0x11e0('0x4c'),_0x39ea22))['emit'](_0x11e0('0x4d'),_0x1537e9);}exports['cs']=function(_0x2d3a9f,_0xe1c2e5,_0x5ee00f,_0x3e947e,_0x4d51e8,_0x4a4724,_0x4ac51b,_0x35590d){var _0x40f2a3={};_0x4a4724['remoteUri']=intUtil['stripTrailingSlash'](_0x4a4724[_0x11e0('0x4e')]);_0x4a4724[_0x11e0('0x4f')]=intUtil[_0x11e0('0x50')](_0x4a4724[_0x11e0('0x4f')]);_0x40f2a3[_0x11e0('0x46')]=_0x35590d==='queue'||_0x35590d==='unmanaged'?_0x11e0('0x47'):_0x11e0('0x29');var _0x3c2302=util['format'](_0x11e0('0x51'),_0x4a4724[_0x11e0('0x4e')]);var _0x564a78=util[_0x11e0('0x4b')](_0x11e0('0x52'),_0x4a4724[_0x11e0('0x53')]);var _0x4446f8=util[_0x11e0('0x4b')](_0x11e0('0x54'),_0x4a4724[_0x11e0('0x4f')],_0xe1c2e5['uniqueid'],md5(_0xe1c2e5[_0x11e0('0x55')]));if(_0x4d51e8&&_0x4d51e8[_0x11e0('0x56')]){logger[_0x11e0('0x20')]('[QUEUE]',_0x11e0('0x57'));_0xe1c2e5[_0x11e0('0x58')]=_0x4446f8;}else if(_0x4ac51b&&_0x4ac51b[_0x11e0('0x59')]&&_0x4ac51b[_0x11e0('0x59')]!==_0x11e0('0x5a')){logger[_0x11e0('0x20')](_0x11e0('0x5b'),_0x11e0('0x57'));_0xe1c2e5['recordingURL']=_0x4446f8;}else{_0xe1c2e5[_0x11e0('0x58')]='';}return getUser(_0x40f2a3,_0x4a4724,_0x3e947e,_0x564a78,_0x3c2302,_0x35590d)[_0x11e0('0x12')](function(_0x31982b){logger[_0x11e0('0x20')]('['+_0x35590d[_0x11e0('0x21')]()+_0x11e0('0x5c'),_0x31982b[_0x11e0('0x26')]);logger[_0x11e0('0x20')]('['+_0x35590d[_0x11e0('0x21')]()+']\x20The\x20User\x20email\x20is:',_0x31982b[_0x11e0('0x1e')]);return getEndUser(_0x31982b,_0x4a4724,_0x564a78,_0x3c2302,_0xe1c2e5,_0x35590d);})[_0x11e0('0x12')](function(_0x1f79a7){logger[_0x11e0('0x20')]('['+_0x35590d['toUpperCase']()+_0x11e0('0x5d'),_0x1f79a7[_0x11e0('0x32')]);logger[_0x11e0('0x20')]('['+_0x35590d[_0x11e0('0x21')]()+_0x11e0('0x5e'),_0xe1c2e5[_0x11e0('0x2b')]);return getTicket(_0x1f79a7,_0x4a4724,_0x564a78,_0x3c2302,_0xe1c2e5,_0x5ee00f,_0x35590d);})[_0x11e0('0x12')](function(_0xb22ede){logger['info'](util['format']('['+_0x35590d[_0x11e0('0x21')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x5ee00f['ticketType'],_0xb22ede['ticketId']));logger[_0x11e0('0x20')](util['format']('['+_0x35590d[_0x11e0('0x21')]()+']\x20Call\x20direction:\x20%s',_0x35590d));if(_0x35590d!==_0x11e0('0x5f')){logger[_0x11e0('0x20')]('['+_0x35590d[_0x11e0('0x21')]()+']',_0x11e0('0x60'));emit(_0x4a4724['remoteUri'],_0x3e947e[_0x11e0('0x61')],_0x5ee00f['ticketType'],_0xb22ede[_0x11e0('0x49')]);}})[_0x11e0('0x27')](function(_0x54de29){logger[_0x11e0('0x13')]('['+_0x35590d['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x11e0('0x62')](_0x54de29,{'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 687ba45..51445dc 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 _0x4ad4=['recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','%s/helpdesk/tickets/%d','catch','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','request-promise','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','remoteUri','then','Ticket\x20created!','format','%s/api/v2/agents','length','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','nameField','customField','toLowerCase','content','string','push','idField','variable','variableName','customVariable','name','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x4fd959,_0x4b9077){var _0x1a474d=function(_0x3683cf){while(--_0x3683cf){_0x4fd959['push'](_0x4fd959['shift']());}};_0x1a474d(++_0x4b9077);}(_0x4ad4,0xd1));var _0x44ad=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x4ad4[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var rp=require(_0x44ad('0x0'));var md5=require(_0x44ad('0x1'));var util=require(_0x44ad('0x2'));var Redis=require(_0x44ad('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x44ad('0x4'))('freshdesk');config[_0x44ad('0x5')]=_[_0x44ad('0x6')](config[_0x44ad('0x5')],{'host':_0x44ad('0x7'),'port':0x18eb});var io=require(_0x44ad('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x44ad('0x9'),'Accept':'application/json'};function emit(_0x4f8dec,_0x595403,_0x46848f){io['to'](_0x4f8dec)[_0x44ad('0xa')](_0x595403,_0x46848f);}function getTicket(_0x551845,_0x25a88f,_0x4e6c0b,_0x3a48fd,_0x27e5e4){logger[_0x44ad('0xb')](_0x44ad('0xc'));var _0x5b90b0=_[_0x44ad('0xd')]({'responder_id':_0x25a88f['id'],'requester_id':_0x4e6c0b['id'],'name':util['format'](_0x44ad('0xe'),_0x27e5e4[_0x44ad('0xf')]),'phone':_0x27e5e4[_0x44ad('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x44ad('0x11')](_0x3a48fd[_0x44ad('0x12')],_0x27e5e4,'\x20'),'description':intUtil[_0x44ad('0x11')](_0x3a48fd[_0x44ad('0x13')],_0x27e5e4,_0x44ad('0x14')),'tags':getTags(_0x3a48fd[_0x44ad('0x15')],'name')},getCustomFields(_0x3a48fd[_0x44ad('0x16')],_0x27e5e4));_0x5b90b0[_0x44ad('0x17')]=_[_0x44ad('0x18')](_[_0x44ad('0x19')](_0x5b90b0['custom_fields'],'id'),_0x44ad('0x1a'));return request({'uri':util['format']('%s/api/v2/tickets',_0x551845[_0x44ad('0x1b')]),'method':'POST','body':_0x5b90b0})[_0x44ad('0x1c')](function(_0x24092f){logger['info'](_0x44ad('0x1d'));return _0x24092f;});}function getUser(_0x47e254,_0x4c981d){if(intUtil['validateEmail'](_0x4c981d)){return request({'uri':util[_0x44ad('0x1e')](_0x44ad('0x1f'),_0x47e254[_0x44ad('0x1b')]),'qs':{'email':_0x4c981d}})[_0x44ad('0x1c')](function(_0x499af8){if(_0x499af8[_0x44ad('0x20')]){logger[_0x44ad('0xb')](_0x44ad('0x21'));return _[_0x44ad('0x22')](_0x499af8,function(_0x3c425b){return _0x3c425b['contact']['email']===_0x4c981d;});}else{logger[_0x44ad('0xb')](_0x44ad('0x23'));return request({'uri':util['format'](_0x44ad('0x24'),_0x47e254[_0x44ad('0x1b')])})[_0x44ad('0x1c')](function(_0x415fe9){logger['info'](_0x44ad('0x25'));return _0x415fe9;});}});}else{logger['info'](_0x44ad('0x26'));return request({'uri':util['format'](_0x44ad('0x24'),_0x47e254[_0x44ad('0x1b')])})[_0x44ad('0x1c')](function(_0xafb35a){logger[_0x44ad('0xb')](_0x44ad('0x25'));return _0xafb35a;});}}function getEndUser(_0x369725,_0x3bde6a,_0x127888){logger['info']('Searching\x20enduser\x20with\x20phone',_0x127888);return request({'uri':util[_0x44ad('0x1e')](_0x44ad('0x27'),_0x369725[_0x44ad('0x1b')]),'qs':{'phone':_0x127888}})[_0x44ad('0x1c')](function(_0x406ed9){if(_0x406ed9[_0x44ad('0x20')]){logger[_0x44ad('0xb')](_0x44ad('0x28'));return _['find'](_0x406ed9,{'phone':_0x127888});}else{logger[_0x44ad('0xb')](_0x44ad('0x29'));return request({'uri':util['format']('%s/api/v2/contacts',_0x369725[_0x44ad('0x1b')]),'method':'POST','body':{'name':_0x3bde6a,'phone':_0x127888}})[_0x44ad('0x1c')](function(_0x4e2117){logger[_0x44ad('0xb')](_0x44ad('0x2a'));return _0x4e2117;});}});}function getAuth(_0x33aff6){return util[_0x44ad('0x1e')]('Basic\x20%s',new Buffer(_0x33aff6[_0x44ad('0x2b')]+':X')[_0x44ad('0x2c')](_0x44ad('0x2d')));}function request(_0x4d1930){logger[_0x44ad('0x2e')](_0x44ad('0x2f'),JSON[_0x44ad('0x30')](_0x4d1930));return rp(_[_0x44ad('0x6')](_0x4d1930,{'method':_0x44ad('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1ec97c,_0x11145b){var _0x365329=[];if(_0x1ec97c&&_0x1ec97c[_0x44ad('0x20')]>0x0){_0x365329=_[_0x44ad('0x32')](_0x1ec97c,_0x11145b);}return _0x365329;}function getCustomFields(_0x376a1c,_0x17d87c){var _0x380e5c=[];var _0x1d054b={'custom_fields':[]};if(_0x376a1c['length']>0x0){_[_0x44ad('0x33')](_0x376a1c,function(_0x4e75e9){if(_0x4e75e9[_0x44ad('0x34')]==='string'&&_0x4e75e9[_0x44ad('0x35')]&&!_0x4e75e9[_0x44ad('0x36')]){_0x1d054b[_0x4e75e9[_0x44ad('0x35')][_0x44ad('0x37')]()]=_0x4e75e9[_0x44ad('0x38')][_0x44ad('0x2c')]();}else if(_0x4e75e9[_0x44ad('0x34')]===_0x44ad('0x39')&&_0x4e75e9['idField']&&_0x4e75e9[_0x44ad('0x36')]){_0x1d054b['custom_fields'][_0x44ad('0x3a')]({'id':_0x4e75e9[_0x44ad('0x3b')],'value':_0x4e75e9['content']['toString']()});}else if(_0x4e75e9[_0x44ad('0x34')]===_0x44ad('0x3c')&&_0x4e75e9['variableName']&&_0x4e75e9[_0x44ad('0x3b')]&&_0x4e75e9['customField']){_0x17d87c[_0x4e75e9[_0x44ad('0x3d')]]&&_0x1d054b['custom_fields'][_0x44ad('0x3a')]({'id':_0x4e75e9[_0x44ad('0x3b')],'value':_0x17d87c[_0x4e75e9[_0x44ad('0x3d')]][_0x44ad('0x2c')]()});}else if(_0x4e75e9['type']===_0x44ad('0x3e')&&_0x4e75e9['Variable']&&_0x4e75e9['Variable'][_0x44ad('0x3f')]&&_0x4e75e9[_0x44ad('0x3b')]&&_0x4e75e9[_0x44ad('0x36')]){_0x17d87c[_0x4e75e9[_0x44ad('0x40')][_0x44ad('0x3f')][_0x44ad('0x37')]()]&&_0x1d054b[_0x44ad('0x17')][_0x44ad('0x3a')]({'id':_0x4e75e9['idField'],'value':_0x17d87c[_0x4e75e9['Variable'][_0x44ad('0x3f')][_0x44ad('0x37')]()][_0x44ad('0x2c')]()});}});}return _0x1d054b;}exports[_0x44ad('0x41')]=function(_0x47ca69,_0x8ecda2,_0x26ee9b,_0x6bfd01,_0x469fcc,_0x5dc924){var _0x1016f8,_0x49fe23;_0x5dc924[_0x44ad('0x1b')]=intUtil[_0x44ad('0x42')](_0x5dc924[_0x44ad('0x1b')]);_0x5dc924[_0x44ad('0x43')]=intUtil['stripTrailingSlash'](_0x5dc924[_0x44ad('0x43')]);if(_0x469fcc&&_0x469fcc[_0x44ad('0x44')]){logger[_0x44ad('0xb')](_0x44ad('0x45'),'Recording\x20is\x20enabled!');_0x8ecda2[_0x44ad('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5dc924[_0x44ad('0x43')],_0x8ecda2[_0x44ad('0x47')],md5(_0x8ecda2['uniqueid']));}else{_0x8ecda2[_0x44ad('0x46')]='';}headers[_0x44ad('0x48')]=getAuth(_0x5dc924);return getUser(_0x5dc924,_0x6bfd01['email'])[_0x44ad('0x1c')](function(_0x10d66a){_0x1016f8=_0x10d66a;logger[_0x44ad('0xb')](_0x44ad('0x49'),_0x1016f8['id']);return getEndUser(_0x5dc924,_0x8ecda2[_0x44ad('0xf')],_0x8ecda2[_0x44ad('0x10')]);})[_0x44ad('0x1c')](function(_0x2f544c){_0x49fe23=_0x2f544c;logger['info'](_0x44ad('0x4a'),_0x49fe23['id']);return getTicket(_0x5dc924,_0x1016f8,_0x49fe23,_0x26ee9b,_0x8ecda2);})[_0x44ad('0x1c')](function(_0x46bc2a){if(_0x46bc2a&&_0x46bc2a['id']){logger[_0x44ad('0xb')]('Ticket\x20created!');logger['info'](_0x44ad('0x4b'),_0x46bc2a['id']);logger[_0x44ad('0xb')](_0x44ad('0x45'),_0x44ad('0x4c'));emit(util[_0x44ad('0x1e')](_0x44ad('0x4d'),_0x6bfd01[_0x44ad('0x3f')]),_0x44ad('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x5dc924[_0x44ad('0x1b')],_0x46bc2a['id'])});}})['catch'](function(_0x516e8b){logger[_0x44ad('0x4f')](_0x44ad('0x45'),JSON['stringify'](_0x516e8b));});};exports[_0x44ad('0x50')]=function(_0x3d8b80,_0x3de1db,_0x16ecf2,_0x1130dc,_0x11e742,_0x5b8b66,_0x45889e){var _0x334683,_0x3e2694;_0x5b8b66[_0x44ad('0x1b')]=intUtil[_0x44ad('0x42')](_0x5b8b66[_0x44ad('0x1b')]);_0x5b8b66[_0x44ad('0x43')]=intUtil[_0x44ad('0x42')](_0x5b8b66[_0x44ad('0x43')]);if(_0x45889e&&_0x45889e[_0x44ad('0x51')]&&_0x45889e[_0x44ad('0x51')]!==_0x44ad('0x52')){logger[_0x44ad('0xb')](_0x44ad('0x53'),'Recording\x20is\x20enabled!');_0x3de1db[_0x44ad('0x46')]=util[_0x44ad('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b8b66[_0x44ad('0x43')],_0x3de1db[_0x44ad('0x47')],md5(_0x3de1db[_0x44ad('0x47')]));}headers[_0x44ad('0x48')]=getAuth(_0x5b8b66);return getUser(_0x5b8b66,_0x1130dc[_0x44ad('0x54')])['then'](function(_0x2e649c){_0x334683=_0x2e649c;logger[_0x44ad('0xb')](_0x44ad('0x49'),_0x334683['id']);return getEndUser(_0x5b8b66,_0x3de1db[_0x44ad('0x55')],_0x3de1db['destcalleridnum']);})['then'](function(_0x58199f){_0x3e2694=_0x58199f;logger[_0x44ad('0xb')](_0x44ad('0x4a'),_0x3e2694['id']);return getTicket(_0x5b8b66,_0x334683,_0x3e2694,_0x16ecf2,_0x3de1db);})[_0x44ad('0x1c')](function(_0x26bc8e){if(_0x26bc8e&&_0x26bc8e['id']){logger[_0x44ad('0xb')](_0x44ad('0x1d'));logger[_0x44ad('0xb')]('The\x20Ticket\x20ID\x20is:',_0x26bc8e['id']);logger[_0x44ad('0xb')](_0x44ad('0x53'),_0x44ad('0x4c'));emit(util['format'](_0x44ad('0x4d'),_0x1130dc[_0x44ad('0x3f')]),_0x44ad('0x4e'),{'uri':util[_0x44ad('0x1e')](_0x44ad('0x56'),_0x5b8b66['remoteUri'],_0x26bc8e['id'])});}})[_0x44ad('0x57')](function(_0x32c6a2){logger[_0x44ad('0x4f')](_0x44ad('0x53'),JSON['stringify'](_0x32c6a2));});};exports[_0x44ad('0x58')]=function(_0x303787,_0x538c19,_0x228f24,_0x53ba63,_0xa3a62d,_0x356398){var _0x38a2a5,_0xaa2ed5;_0x356398[_0x44ad('0x1b')]=intUtil[_0x44ad('0x42')](_0x356398[_0x44ad('0x1b')]);_0x356398[_0x44ad('0x43')]=intUtil[_0x44ad('0x42')](_0x356398[_0x44ad('0x43')]);if(_0xa3a62d&&_0xa3a62d['monitor_format']){logger[_0x44ad('0xb')]('['+_0x538c19[_0x44ad('0x59')][_0x44ad('0x5a')]()+']',_0x44ad('0x5b'));_0x538c19[_0x44ad('0x46')]=util[_0x44ad('0x1e')](_0x44ad('0x5c'),_0x356398[_0x44ad('0x43')],_0x538c19[_0x44ad('0x47')],md5(_0x538c19[_0x44ad('0x47')]));}else{_0x538c19[_0x44ad('0x46')]='';}headers[_0x44ad('0x48')]=getAuth(_0x356398);return getUser(_0x356398,'')[_0x44ad('0x1c')](function(_0x4166a3){_0x38a2a5=_0x4166a3;logger[_0x44ad('0xb')](_0x44ad('0x49'),_0x38a2a5['id']);return getEndUser(_0x356398,_0x538c19['calleridname'],_0x538c19[_0x44ad('0x10')]);})[_0x44ad('0x1c')](function(_0x3fcc12){_0xaa2ed5=_0x3fcc12;logger[_0x44ad('0xb')](_0x44ad('0x4a'),_0xaa2ed5['id']);return getTicket(_0x356398,_0x38a2a5,_0xaa2ed5,_0x228f24,_0x538c19);})['then'](function(_0x1b41c5){if(_0x1b41c5){logger[_0x44ad('0xb')](_0x44ad('0x1d'));logger[_0x44ad('0xb')](_0x44ad('0x4b'),_0x1b41c5['id']);}})[_0x44ad('0x57')](function(_0x407b68){logger[_0x44ad('0x4f')]('['+_0x538c19[_0x44ad('0x59')][_0x44ad('0x5a')]()+']',JSON[_0x44ad('0x30')](_0x407b68));});}; \ No newline at end of file +var _0x4db3=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','md5','ioredis','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','then','validateEmail','%s/api/v2/agents','length','find','contact','email','%s/api/v2/agents/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','base64','debug','GET','map','forEach','type','string','customField','nameField','toLowerCase','content','push','toString','variableName','idField','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x11d92a,_0x1fc6d7){var _0x5739df=function(_0x4fe90a){while(--_0x4fe90a){_0x11d92a['push'](_0x11d92a['shift']());}};_0x5739df(++_0x1fc6d7);}(_0x4db3,0x17a));var _0x34db=function(_0x42b7e1,_0x28ba63){_0x42b7e1=_0x42b7e1-0x0;var _0x1b7eee=_0x4db3[_0x42b7e1];return _0x1b7eee;};'use strict';var _=require(_0x34db('0x0'));var rp=require('request-promise');var md5=require(_0x34db('0x1'));var util=require('util');var Redis=require(_0x34db('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x34db('0x3'))(_0x34db('0x4'));config[_0x34db('0x5')]=_[_0x34db('0x6')](config[_0x34db('0x5')],{'host':_0x34db('0x7'),'port':0x18eb});var io=require(_0x34db('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x34db('0x9'),'Accept':_0x34db('0x9')};function emit(_0x1ebcf4,_0x5d623f,_0x26b56e){io['to'](_0x1ebcf4)[_0x34db('0xa')](_0x5d623f,_0x26b56e);}function getTicket(_0x1eb310,_0x5112f3,_0x496caf,_0x289a1b,_0x13e2a4){logger[_0x34db('0xb')](_0x34db('0xc'));var _0x138dc7=_[_0x34db('0xd')]({'responder_id':_0x5112f3['id'],'requester_id':_0x496caf['id'],'name':util['format'](_0x34db('0xe'),_0x13e2a4[_0x34db('0xf')]),'phone':_0x13e2a4[_0x34db('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x34db('0x11')](_0x289a1b[_0x34db('0x12')],_0x13e2a4,'\x20'),'description':intUtil[_0x34db('0x11')](_0x289a1b[_0x34db('0x13')],_0x13e2a4,_0x34db('0x14')),'tags':getTags(_0x289a1b['Tags'],_0x34db('0x15'))},getCustomFields(_0x289a1b[_0x34db('0x16')],_0x13e2a4));_0x138dc7[_0x34db('0x17')]=_[_0x34db('0x18')](_[_0x34db('0x19')](_0x138dc7['custom_fields'],'id'),_0x34db('0x1a'));return request({'uri':util[_0x34db('0x1b')](_0x34db('0x1c'),_0x1eb310['remoteUri']),'method':'POST','body':_0x138dc7})[_0x34db('0x1d')](function(_0x460fef){logger[_0x34db('0xb')]('Ticket\x20created!');return _0x460fef;});}function getUser(_0x53a591,_0x53b851){if(intUtil[_0x34db('0x1e')](_0x53b851)){return request({'uri':util[_0x34db('0x1b')](_0x34db('0x1f'),_0x53a591['remoteUri']),'qs':{'email':_0x53b851}})['then'](function(_0x7a6669){if(_0x7a6669[_0x34db('0x20')]){logger[_0x34db('0xb')]('Agent\x20found!');return _[_0x34db('0x21')](_0x7a6669,function(_0x5297c5){return _0x5297c5[_0x34db('0x22')][_0x34db('0x23')]===_0x53b851;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x34db('0x1b')](_0x34db('0x24'),_0x53a591[_0x34db('0x25')])})['then'](function(_0x3f61e4){logger[_0x34db('0xb')]('Admin\x20account\x20selected.');return _0x3f61e4;});}});}else{logger[_0x34db('0xb')](_0x34db('0x26'));return request({'uri':util[_0x34db('0x1b')](_0x34db('0x24'),_0x53a591[_0x34db('0x25')])})[_0x34db('0x1d')](function(_0x5c136f){logger[_0x34db('0xb')](_0x34db('0x27'));return _0x5c136f;});}}function getEndUser(_0x20bd15,_0x2230c1,_0x1bfe9a){logger[_0x34db('0xb')](_0x34db('0x28'),_0x1bfe9a);return request({'uri':util[_0x34db('0x1b')](_0x34db('0x29'),_0x20bd15[_0x34db('0x25')]),'qs':{'phone':_0x1bfe9a}})[_0x34db('0x1d')](function(_0x1cb28e){if(_0x1cb28e[_0x34db('0x20')]){logger[_0x34db('0xb')](_0x34db('0x2a'));return _[_0x34db('0x21')](_0x1cb28e,{'phone':_0x1bfe9a});}else{logger['info'](_0x34db('0x2b'));return request({'uri':util[_0x34db('0x1b')](_0x34db('0x29'),_0x20bd15[_0x34db('0x25')]),'method':'POST','body':{'name':_0x2230c1,'phone':_0x1bfe9a}})['then'](function(_0x57fe0b){logger[_0x34db('0xb')](_0x34db('0x2c'));return _0x57fe0b;});}});}function getAuth(_0x36e4fc){return util['format']('Basic\x20%s',new Buffer(_0x36e4fc[_0x34db('0x2d')]+':X')['toString'](_0x34db('0x2e')));}function request(_0xe1e06a){logger[_0x34db('0x2f')]('[HTTP]',JSON['stringify'](_0xe1e06a));return rp(_['defaults'](_0xe1e06a,{'method':_0x34db('0x30'),'headers':headers,'json':!![]}));}function getTags(_0xf040a4,_0x32d08c){var _0x55cb09=[];if(_0xf040a4&&_0xf040a4[_0x34db('0x20')]>0x0){_0x55cb09=_[_0x34db('0x31')](_0xf040a4,_0x32d08c);}return _0x55cb09;}function getCustomFields(_0x4c76ec,_0xc384c6){var _0x4485c9=[];var _0x62f72={'custom_fields':[]};if(_0x4c76ec[_0x34db('0x20')]>0x0){_[_0x34db('0x32')](_0x4c76ec,function(_0xd417fa){if(_0xd417fa[_0x34db('0x33')]===_0x34db('0x34')&&_0xd417fa['nameField']&&!_0xd417fa[_0x34db('0x35')]){_0x62f72[_0xd417fa[_0x34db('0x36')][_0x34db('0x37')]()]=_0xd417fa[_0x34db('0x38')]['toString']();}else if(_0xd417fa[_0x34db('0x33')]==='string'&&_0xd417fa['idField']&&_0xd417fa[_0x34db('0x35')]){_0x62f72[_0x34db('0x17')][_0x34db('0x39')]({'id':_0xd417fa['idField'],'value':_0xd417fa[_0x34db('0x38')][_0x34db('0x3a')]()});}else if(_0xd417fa['type']==='variable'&&_0xd417fa[_0x34db('0x3b')]&&_0xd417fa[_0x34db('0x3c')]&&_0xd417fa['customField']){_0xc384c6[_0xd417fa['variableName']]&&_0x62f72[_0x34db('0x17')][_0x34db('0x39')]({'id':_0xd417fa[_0x34db('0x3c')],'value':_0xc384c6[_0xd417fa[_0x34db('0x3b')]][_0x34db('0x3a')]()});}else if(_0xd417fa['type']===_0x34db('0x3d')&&_0xd417fa[_0x34db('0x3e')]&&_0xd417fa[_0x34db('0x3e')][_0x34db('0x15')]&&_0xd417fa[_0x34db('0x3c')]&&_0xd417fa[_0x34db('0x35')]){_0xc384c6[_0xd417fa[_0x34db('0x3e')][_0x34db('0x15')][_0x34db('0x37')]()]&&_0x62f72[_0x34db('0x17')]['push']({'id':_0xd417fa[_0x34db('0x3c')],'value':_0xc384c6[_0xd417fa[_0x34db('0x3e')][_0x34db('0x15')][_0x34db('0x37')]()][_0x34db('0x3a')]()});}});}return _0x62f72;}exports['queue']=function(_0x4e9809,_0x4a69da,_0x28d719,_0x4406f8,_0x20919c,_0x4e2815){var _0x2e0812,_0x253a55;_0x4e2815[_0x34db('0x25')]=intUtil[_0x34db('0x3f')](_0x4e2815['remoteUri']);_0x4e2815[_0x34db('0x40')]=intUtil[_0x34db('0x3f')](_0x4e2815[_0x34db('0x40')]);if(_0x20919c&&_0x20919c[_0x34db('0x41')]){logger[_0x34db('0xb')](_0x34db('0x42'),_0x34db('0x43'));_0x4a69da[_0x34db('0x44')]=util[_0x34db('0x1b')](_0x34db('0x45'),_0x4e2815[_0x34db('0x40')],_0x4a69da[_0x34db('0x46')],md5(_0x4a69da['uniqueid']));}else{_0x4a69da[_0x34db('0x44')]='';}headers[_0x34db('0x47')]=getAuth(_0x4e2815);return getUser(_0x4e2815,_0x4406f8[_0x34db('0x23')])['then'](function(_0x474b72){_0x2e0812=_0x474b72;logger[_0x34db('0xb')]('The\x20User\x20ID\x20is:',_0x2e0812['id']);return getEndUser(_0x4e2815,_0x4a69da['calleridname'],_0x4a69da[_0x34db('0x10')]);})[_0x34db('0x1d')](function(_0x3f17d6){_0x253a55=_0x3f17d6;logger['info'](_0x34db('0x48'),_0x253a55['id']);return getTicket(_0x4e2815,_0x2e0812,_0x253a55,_0x28d719,_0x4a69da);})[_0x34db('0x1d')](function(_0x3dd33c){if(_0x3dd33c&&_0x3dd33c['id']){logger[_0x34db('0xb')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3dd33c['id']);logger[_0x34db('0xb')](_0x34db('0x42'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x34db('0x49'),_0x4406f8[_0x34db('0x15')]),_0x34db('0x4a'),{'uri':util[_0x34db('0x1b')](_0x34db('0x4b'),_0x4e2815[_0x34db('0x25')],_0x3dd33c['id'])});}})['catch'](function(_0x3aeff5){logger[_0x34db('0x4c')](_0x34db('0x42'),JSON[_0x34db('0x4d')](_0x3aeff5));});};exports[_0x34db('0x4e')]=function(_0x57df6c,_0x15a9cb,_0x3996cb,_0x419500,_0x9245f8,_0x4455dd,_0x143031){var _0x28900a,_0x557893;_0x4455dd[_0x34db('0x25')]=intUtil[_0x34db('0x3f')](_0x4455dd[_0x34db('0x25')]);_0x4455dd['serverUrl']=intUtil[_0x34db('0x3f')](_0x4455dd['serverUrl']);if(_0x143031&&_0x143031[_0x34db('0x4f')]&&_0x143031[_0x34db('0x4f')]!=='none'){logger[_0x34db('0xb')](_0x34db('0x50'),_0x34db('0x43'));_0x15a9cb[_0x34db('0x44')]=util[_0x34db('0x1b')](_0x34db('0x45'),_0x4455dd[_0x34db('0x40')],_0x15a9cb[_0x34db('0x46')],md5(_0x15a9cb['uniqueid']));}headers[_0x34db('0x47')]=getAuth(_0x4455dd);return getUser(_0x4455dd,_0x419500[_0x34db('0x23')])['then'](function(_0x53280b){_0x28900a=_0x53280b;logger['info']('The\x20User\x20ID\x20is:',_0x28900a['id']);return getEndUser(_0x4455dd,_0x15a9cb[_0x34db('0x51')],_0x15a9cb[_0x34db('0x52')]);})['then'](function(_0x437e50){_0x557893=_0x437e50;logger[_0x34db('0xb')](_0x34db('0x48'),_0x557893['id']);return getTicket(_0x4455dd,_0x28900a,_0x557893,_0x3996cb,_0x15a9cb);})['then'](function(_0x132680){if(_0x132680&&_0x132680['id']){logger[_0x34db('0xb')](_0x34db('0x53'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x132680['id']);logger[_0x34db('0xb')](_0x34db('0x50'),_0x34db('0x54'));emit(util[_0x34db('0x1b')](_0x34db('0x49'),_0x419500[_0x34db('0x15')]),_0x34db('0x4a'),{'uri':util['format'](_0x34db('0x4b'),_0x4455dd['remoteUri'],_0x132680['id'])});}})[_0x34db('0x55')](function(_0x6d03c7){logger['error'](_0x34db('0x50'),JSON[_0x34db('0x4d')](_0x6d03c7));});};exports['unmanaged']=function(_0xf1b823,_0xcd994c,_0x4a7b03,_0x3ca3f1,_0x44a439,_0x313d27){var _0x1734a5,_0x4e19c8;_0x313d27[_0x34db('0x25')]=intUtil[_0x34db('0x3f')](_0x313d27[_0x34db('0x25')]);_0x313d27[_0x34db('0x40')]=intUtil[_0x34db('0x3f')](_0x313d27['serverUrl']);if(_0x44a439&&_0x44a439[_0x34db('0x41')]){logger[_0x34db('0xb')]('['+_0xcd994c[_0x34db('0x56')][_0x34db('0x57')]()+']','Recording\x20is\x20enabled!');_0xcd994c[_0x34db('0x44')]=util[_0x34db('0x1b')](_0x34db('0x45'),_0x313d27['serverUrl'],_0xcd994c[_0x34db('0x46')],md5(_0xcd994c[_0x34db('0x46')]));}else{_0xcd994c['recordingURL']='';}headers[_0x34db('0x47')]=getAuth(_0x313d27);return getUser(_0x313d27,'')[_0x34db('0x1d')](function(_0x24401b){_0x1734a5=_0x24401b;logger[_0x34db('0xb')](_0x34db('0x58'),_0x1734a5['id']);return getEndUser(_0x313d27,_0xcd994c[_0x34db('0xf')],_0xcd994c[_0x34db('0x10')]);})[_0x34db('0x1d')](function(_0x132a12){_0x4e19c8=_0x132a12;logger['info'](_0x34db('0x48'),_0x4e19c8['id']);return getTicket(_0x313d27,_0x1734a5,_0x4e19c8,_0x4a7b03,_0xcd994c);})[_0x34db('0x1d')](function(_0x315959){if(_0x315959){logger['info'](_0x34db('0x53'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x315959['id']);}})[_0x34db('0x55')](function(_0x43d947){logger[_0x34db('0x4c')]('['+_0xcd994c['lastevent'][_0x34db('0x57')]()+']',JSON['stringify'](_0x43d947));});}; \ 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 6c552a4..aeec8fc 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 _0x9684=['Subjects','getString','Descriptions','Contact','add','ticketId','task','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','toUpperCase',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','info','users','length','email','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','GET','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','adminId','message','/api/contacts/filters','Getting\x20contacts\x20filter','filters','name','All\x20Contacts','then','Getting\x20contact\x20list','headers','contactNumber','contacts','Contact\x20found:','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks'];(function(_0x9f48e6,_0x8f87aa){var _0x45fc5c=function(_0xab1f4e){while(--_0xab1f4e){_0x9f48e6['push'](_0x9f48e6['shift']());}};_0x45fc5c(++_0x8f87aa);}(_0x9684,0x1bb));var _0x4968=function(_0x3ae4ae,_0x4a0ed0){_0x3ae4ae=_0x3ae4ae-0x0;var _0x4da684=_0x9684[_0x3ae4ae];return _0x4da684;};'use strict';var _=require(_0x4968('0x0'));var rp=require(_0x4968('0x1'));var md5=require(_0x4968('0x2'));var util=require(_0x4968('0x3'));var moment=require(_0x4968('0x4'));var Promise=require(_0x4968('0x5'));var Redis=require(_0x4968('0x6'));var intUtil=require(_0x4968('0x7'));var config=require(_0x4968('0x8'));var logger=require(_0x4968('0x9'))('freshsales');config[_0x4968('0xa')]=_[_0x4968('0xb')](config[_0x4968('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x4968('0xc'))(new Redis(config[_0x4968('0xa')]));function getAdminId(_0x33c006,_0x58dc97,_0x7e7cb4,_0x186b12){return new Promise(function(_0x5ca375,_0x1dc19a){var _0x5e056e=![];var _0x40f66e={'method':'GET','uri':_0x186b12+'/api/selector/owners','json':!![]};_0x40f66e['headers']=_0x7e7cb4;logger[_0x4968('0xd')]('Getting\x20admin\x20information');return rp(_0x40f66e)['then'](function(_0x31e40c){if(_0x31e40c){var _0x237951=_0x31e40c[_0x4968('0xe')];var _0x5711c3=null;for(_0x5711c3=0x0;_0x5711c3<_0x237951[_0x4968('0xf')];_0x5711c3++){if(_0x237951[_0x5711c3][_0x4968('0x10')]===_0x33c006['adminEmail']){_0x33c006['adminId']=_0x237951[_0x5711c3]['id'];_0x5e056e=!![];}}if(_0x5e056e){logger[_0x4968('0xd')](_0x4968('0x11'),_0x33c006['adminId']);_0x5ca375(_0x33c006);}else{_0x1dc19a({'statusCode':0x194,'message':_0x4968('0x12')});}}else{_0x1dc19a({'statusCode':0x194,'message':_0x4968('0x12')});}})[_0x4968('0x13')](function(_0x21a90a){logger[_0x4968('0x14')]('['+[_0x58dc97['toUpperCase']()]+']',_0x21a90a['message']);_0x1dc19a(_0x21a90a);});});}function getUser(_0x1954db,_0x5760e6,_0x4bab20){return function(_0x5c7919){return new Promise(function(_0x316b50,_0x26a9f6){var _0x450e8a={'method':_0x4968('0x15'),'uri':_0x4bab20+'/api/selector/owners','json':!![]};_0x450e8a['headers']=_0x5760e6;logger[_0x4968('0xd')]('Getting\x20user\x20list');return rp(_0x450e8a)['then'](function(_0x228cc6){if(_0x228cc6){var _0x50d692=_0x228cc6[_0x4968('0xe')];var _0x2e5bfd=![];var _0x1b13ad=null;if(_0x5c7919[_0x4968('0x16')]!==null){logger['info'](_0x4968('0x17'),_0x5c7919[_0x4968('0x16')]);_0x5c7919['userEmail']=_0x5c7919[_0x4968('0x16')];for(_0x1b13ad=0x0;_0x1b13ad<_0x50d692[_0x4968('0xf')];_0x1b13ad++){if(_0x50d692[_0x1b13ad][_0x4968('0x10')]===_0x5c7919[_0x4968('0x16')]){_0x2e5bfd=!![];_0x5c7919[_0x4968('0x18')]=_0x50d692[_0x1b13ad]['id'];logger[_0x4968('0xd')](_0x4968('0x19'),_0x5c7919[_0x4968('0x18')]);}}}if(!_0x2e5bfd){logger[_0x4968('0xd')]('Admin\x20selected');_0x5c7919['userEmail']=_0x5c7919['adminEmail'];_0x5c7919[_0x4968('0x18')]=_0x5c7919[_0x4968('0x1a')];_0x2e5bfd=!![];}if(_0x2e5bfd){_0x316b50(_0x5c7919);}else{_0x26a9f6({'statusCode':0x194,'message':_0x4968('0x12')});}}else{_0x26a9f6({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x4968('0x13')](function(_0x18e75c){logger[_0x4968('0x14')]('['+[_0x1954db['toUpperCase']()]+']',_0x18e75c[_0x4968('0x1b')]);_0x26a9f6(_0x18e75c);});});};}function getEndUser(_0x1fa665,_0x364fa7,_0x31ecbc){return function(_0x268439){return new Promise(function(_0x395f56,_0x4e089e){var _0x175bc2=0x0;var _0x99f1a={'method':_0x4968('0x15'),'uri':_0x31ecbc+_0x4968('0x1c'),'json':!![]};_0x99f1a['headers']=_0x364fa7;logger['info'](_0x4968('0x1d'));return rp(_0x99f1a)['then'](function(_0x491e1b){_0x491e1b[_0x4968('0x1e')]['forEach'](function(_0x22a44a){if(_0x22a44a[_0x4968('0x1f')]===_0x4968('0x20')){_0x175bc2=_0x22a44a['id'];}});})[_0x4968('0x21')](function(){logger[_0x4968('0xd')](_0x4968('0x22'));var _0x4aa3e6={'method':'GET','uri':_0x31ecbc+'/api/contacts/view/'+_0x175bc2,'json':!![]};_0x4aa3e6[_0x4968('0x23')]=_0x364fa7;return rp(_0x4aa3e6);})[_0x4968('0x21')](function(_0x13857e){logger[_0x4968('0xd')]('Searching\x20contact\x20with\x20phone',_0x268439[_0x4968('0x24')]);if(_0x13857e[_0x4968('0x25')][_0x4968('0xf')]>0x0){var _0x14755f=_['find'](_0x13857e[_0x4968('0x25')],function(_0x34d0a5){if(_0x34d0a5['work_number']===_0x268439[_0x4968('0x24')]||_0x34d0a5['mobile_number']===_0x268439['contactNumber']){return _0x34d0a5;}});if(_0x14755f){_0x268439['endUserId']=_0x14755f['id'];logger[_0x4968('0xd')](_0x4968('0x26'),_0x268439[_0x4968('0x27')]);_0x395f56(_0x268439);}else{return createEndUser(_0x268439,_0x1fa665,_0x364fa7,_0x31ecbc)[_0x4968('0x21')](function(_0x1c1bb6){logger[_0x4968('0xd')](_0x4968('0x28'),_0x268439['endUserId']);_0x395f56(_0x1c1bb6);});}}else{return createEndUser(_0x268439,_0x1fa665,_0x364fa7,_0x31ecbc)[_0x4968('0x21')](function(_0x3bab10){logger['info'](_0x4968('0x28'),_0x268439[_0x4968('0x27')]);_0x395f56(_0x3bab10);});}})[_0x4968('0x13')](function(_0x5c65a9){throw new Error(_0x5c65a9[_0x4968('0x1b')]);});});};}function createEndUser(_0xe1be84,_0x5a2097,_0x28b7d8,_0x54a3c9){return new Promise(function(_0x497fd4,_0x599b5f){var _0xb76546=moment();var _0x33ccc2={'method':_0x4968('0x29'),'uri':_0x54a3c9+_0x4968('0x2a'),'body':{'contact':{'last_name':_0xe1be84[_0x4968('0x24')],'work_number':_0xe1be84[_0x4968('0x24')],'mobile_number':_0xe1be84[_0x4968('0x24')],'owner_id':_0xe1be84[_0x4968('0x18')],'created_at':_0xb76546[_0x4968('0x2b')](_0x4968('0x2c'))}},'json':!![]};_0x33ccc2[_0x4968('0x23')]=_0x28b7d8;logger[_0x4968('0xd')](_0x4968('0x2d'));return rp(_0x33ccc2)[_0x4968('0x21')](function(_0x16653d){_0xe1be84[_0x4968('0x27')]=_0x16653d[_0x4968('0x2e')]['id'];_0x497fd4(_0xe1be84);})[_0x4968('0x13')](function(_0x576997){logger[_0x4968('0x14')]('['+[_0x5a2097['toUpperCase']()]+']',_0x576997[_0x4968('0x1b')]);_0x599b5f(_0x576997[_0x4968('0x1b')]);});});}function getTicket(_0x370abb,_0x35e0ab,_0xc62202,_0x472c97,_0xe6d90b){return function(_0x309317){logger['info'](_0x4968('0x2f'));return new Promise(function(_0x49fea9,_0x4f8f0c){var _0x2be532=moment();var _0x420a89={'method':_0x4968('0x29'),'uri':_0xc62202+_0x4968('0x30'),'body':{'title':intUtil['getString'](_0x472c97[_0x4968('0x31')],_0xe6d90b,'\x20'),'description':intUtil[_0x4968('0x32')](_0x472c97[_0x4968('0x33')],_0xe6d90b,'\x0a'),'owner_id':_0x309317[_0x4968('0x18')],'creater_id':_0x309317[_0x4968('0x1a')],'targetable_id':_0x309317[_0x4968('0x27')],'targetable_type':_0x4968('0x34'),'created_at':_0x2be532[_0x4968('0x2b')](_0x4968('0x2c')),'due_date':_0x2be532[_0x4968('0x35')](0x1e,'m')[_0x4968('0x2b')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x420a89[_0x4968('0x23')]=_0x35e0ab;return rp(_0x420a89)[_0x4968('0x21')](function(_0x13ae91){_0x309317[_0x4968('0x36')]=_0x13ae91[_0x4968('0x37')]['id'];logger[_0x4968('0xd')]('Task\x20created:',_0x309317[_0x4968('0x36')]);_0x49fea9(_0x309317);})[_0x4968('0x13')](function(_0xec4ac3){logger[_0x4968('0x14')]('['+[_0x370abb['toUpperCase']()]+']',_0xec4ac3[_0x4968('0x1b')]);_0x4f8f0c(_0xec4ac3[_0x4968('0x1b')]);});});};}function emit(_0x50568a,_0x3ea3f3,_0x2f3a93){var _0x5e3a6b={'uri':_0x50568a+'/contacts/'+_0x2f3a93};io['to'](util[_0x4968('0x2b')](_0x4968('0x38'),_0x3ea3f3))['emit']('trigger:browser:url',_0x5e3a6b);}exports['cs']=function(_0x253599,_0x1b44d7,_0x287a6e,_0x96d90,_0xdaca16,_0x222cfe,_0xfb238e,_0x57d641){var _0x4b1188={};var _0x202096={'Authorization':_0x4968('0x39')+_0x222cfe[_0x4968('0x3a')]};_0x222cfe[_0x4968('0x3b')]=intUtil[_0x4968('0x3c')](_0x222cfe[_0x4968('0x3b')]);_0x222cfe[_0x4968('0x3d')]=intUtil[_0x4968('0x3c')](_0x222cfe[_0x4968('0x3d')]);var _0x2af366=_0x222cfe[_0x4968('0x3b')];_0x4b1188[_0x4968('0x3e')]=_0x222cfe[_0x4968('0x3f')];_0x4b1188[_0x4968('0x24')]=_0x57d641[_0x4968('0x40')]()==='outbound'?_0x1b44d7[_0x4968('0x41')]:_0x1b44d7[_0x4968('0x42')];_0x4b1188[_0x4968('0x43')]=_0x57d641===_0x4968('0x44')||_0x57d641==='unmanaged'?'queue':'outbound';if(_0x96d90){_0x4b1188[_0x4968('0x16')]=_0x96d90[_0x4968('0x10')];}var _0x24dde6=util['format'](_0x4968('0x45'),_0x222cfe['serverUrl'],_0x1b44d7[_0x4968('0x46')],md5(_0x1b44d7[_0x4968('0x46')]));if(_0xdaca16&&_0xdaca16['monitor_format']){logger[_0x4968('0xd')]('[QUEUE]',_0x4968('0x47'));_0x1b44d7['recordingURL']=_0x24dde6;}else if(_0xfb238e&&_0xfb238e[_0x4968('0x48')]&&_0xfb238e[_0x4968('0x48')]!==_0x4968('0x49')){logger[_0x4968('0xd')](_0x4968('0x4a'),_0x4968('0x47'));_0x1b44d7[_0x4968('0x4b')]=_0x24dde6;}else{_0x1b44d7[_0x4968('0x4b')]='';}return getAdminId(_0x4b1188,_0x57d641,_0x202096,_0x2af366)[_0x4968('0x21')](getUser(_0x57d641,_0x202096,_0x2af366))[_0x4968('0x21')](getEndUser(_0x57d641,_0x202096,_0x2af366))[_0x4968('0x21')](getTicket(_0x57d641,_0x202096,_0x2af366,_0x287a6e,_0x1b44d7))['then'](function(_0x2eab17){logger[_0x4968('0xd')](util[_0x4968('0x2b')](_0x4968('0x4c'),_0x2eab17[_0x4968('0x36')]));if(_0x57d641!==_0x4968('0x4d')){logger[_0x4968('0xd')]('['+[_0x57d641['toUpperCase']()]+']',_0x4968('0x4e'));emit(_0x2af366,_0x96d90[_0x4968('0x1f')],_0x2eab17[_0x4968('0x27')]);}})[_0x4968('0x13')](function(_0x33c994){logger[_0x4968('0x14')]('['+[_0x57d641[_0x4968('0x4f')]()]+_0x4968('0x50'),util[_0x4968('0x51')](_0x33c994,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6a9a=['/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','userId','User\x20found:','Admin\x20selected','error','/api/contacts/filters','filters','forEach','All\x20Contacts','/api/contacts/view/','contacts','find','work_number','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','POST','/api/contacts','contactNumber','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Subjects','Descriptions','Contact','format','add','ticketId','task','Task\x20created:'];(function(_0x43cb07,_0x4efb96){var _0x54d9f8=function(_0x23fcd4){while(--_0x23fcd4){_0x43cb07['push'](_0x43cb07['shift']());}};_0x54d9f8(++_0x4efb96);}(_0x6a9a,0x1bd));var _0xa6a9=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x6a9a[_0xa4c85];return _0x172c1f;};'use strict';var _=require(_0xa6a9('0x0'));var rp=require(_0xa6a9('0x1'));var md5=require('md5');var util=require(_0xa6a9('0x2'));var moment=require(_0xa6a9('0x3'));var Promise=require('bluebird');var Redis=require(_0xa6a9('0x4'));var intUtil=require('./util');var config=require(_0xa6a9('0x5'));var logger=require(_0xa6a9('0x6'))('freshsales');config[_0xa6a9('0x7')]=_[_0xa6a9('0x8')](config[_0xa6a9('0x7')],{'host':_0xa6a9('0x9'),'port':0x18eb});var io=require(_0xa6a9('0xa'))(new Redis(config[_0xa6a9('0x7')]));function getAdminId(_0x36823e,_0x21ecf2,_0x3c44e3,_0x173f79){return new Promise(function(_0x51a48b,_0x4eb380){var _0x2c140c=![];var _0xf898cb={'method':_0xa6a9('0xb'),'uri':_0x173f79+_0xa6a9('0xc'),'json':!![]};_0xf898cb[_0xa6a9('0xd')]=_0x3c44e3;logger[_0xa6a9('0xe')](_0xa6a9('0xf'));return rp(_0xf898cb)[_0xa6a9('0x10')](function(_0xd4e7e9){if(_0xd4e7e9){var _0x1c1d53=_0xd4e7e9[_0xa6a9('0x11')];var _0x4646d6=null;for(_0x4646d6=0x0;_0x4646d6<_0x1c1d53[_0xa6a9('0x12')];_0x4646d6++){if(_0x1c1d53[_0x4646d6][_0xa6a9('0x13')]===_0x36823e[_0xa6a9('0x14')]){_0x36823e[_0xa6a9('0x15')]=_0x1c1d53[_0x4646d6]['id'];_0x2c140c=!![];}}if(_0x2c140c){logger[_0xa6a9('0xe')](_0xa6a9('0x16'),_0x36823e[_0xa6a9('0x15')]);_0x51a48b(_0x36823e);}else{_0x4eb380({'statusCode':0x194,'message':_0xa6a9('0x17')});}}else{_0x4eb380({'statusCode':0x194,'message':_0xa6a9('0x17')});}})[_0xa6a9('0x18')](function(_0x4e26ea){logger['error']('['+[_0x21ecf2[_0xa6a9('0x19')]()]+']',_0x4e26ea[_0xa6a9('0x1a')]);_0x4eb380(_0x4e26ea);});});}function getUser(_0x2e676b,_0x82b9d,_0x523872){return function(_0x45037a){return new Promise(function(_0x5c46a5,_0x5415c7){var _0x36964d={'method':_0xa6a9('0xb'),'uri':_0x523872+_0xa6a9('0xc'),'json':!![]};_0x36964d[_0xa6a9('0xd')]=_0x82b9d;logger[_0xa6a9('0xe')](_0xa6a9('0x1b'));return rp(_0x36964d)['then'](function(_0x2a1f5f){if(_0x2a1f5f){var _0x21aa36=_0x2a1f5f[_0xa6a9('0x11')];var _0x4a4cc7=![];var _0x591347=null;if(_0x45037a[_0xa6a9('0x1c')]!==null){logger[_0xa6a9('0xe')]('Getting\x20user\x20with\x20email',_0x45037a[_0xa6a9('0x1c')]);_0x45037a['userEmail']=_0x45037a['agentEmail'];for(_0x591347=0x0;_0x591347<_0x21aa36[_0xa6a9('0x12')];_0x591347++){if(_0x21aa36[_0x591347][_0xa6a9('0x13')]===_0x45037a['agentEmail']){_0x4a4cc7=!![];_0x45037a[_0xa6a9('0x1d')]=_0x21aa36[_0x591347]['id'];logger[_0xa6a9('0xe')](_0xa6a9('0x1e'),_0x45037a[_0xa6a9('0x1d')]);}}}if(!_0x4a4cc7){logger[_0xa6a9('0xe')](_0xa6a9('0x1f'));_0x45037a['userEmail']=_0x45037a[_0xa6a9('0x14')];_0x45037a['userId']=_0x45037a['adminId'];_0x4a4cc7=!![];}if(_0x4a4cc7){_0x5c46a5(_0x45037a);}else{_0x5415c7({'statusCode':0x194,'message':_0xa6a9('0x17')});}}else{_0x5415c7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xa6a9('0x18')](function(_0x40bb9e){logger[_0xa6a9('0x20')]('['+[_0x2e676b[_0xa6a9('0x19')]()]+']',_0x40bb9e[_0xa6a9('0x1a')]);_0x5415c7(_0x40bb9e);});});};}function getEndUser(_0x2f4835,_0x2fb9e7,_0x142628){return function(_0x474f35){return new Promise(function(_0x304ef6,_0x568ad8){var _0x30c843=0x0;var _0x59a42f={'method':_0xa6a9('0xb'),'uri':_0x142628+_0xa6a9('0x21'),'json':!![]};_0x59a42f[_0xa6a9('0xd')]=_0x2fb9e7;logger[_0xa6a9('0xe')]('Getting\x20contacts\x20filter');return rp(_0x59a42f)[_0xa6a9('0x10')](function(_0x2fd0cf){_0x2fd0cf[_0xa6a9('0x22')][_0xa6a9('0x23')](function(_0x237b8c){if(_0x237b8c['name']===_0xa6a9('0x24')){_0x30c843=_0x237b8c['id'];}});})[_0xa6a9('0x10')](function(){logger['info']('Getting\x20contact\x20list');var _0x1b7bd7={'method':_0xa6a9('0xb'),'uri':_0x142628+_0xa6a9('0x25')+_0x30c843,'json':!![]};_0x1b7bd7[_0xa6a9('0xd')]=_0x2fb9e7;return rp(_0x1b7bd7);})[_0xa6a9('0x10')](function(_0x56f756){logger[_0xa6a9('0xe')]('Searching\x20contact\x20with\x20phone',_0x474f35['contactNumber']);if(_0x56f756[_0xa6a9('0x26')][_0xa6a9('0x12')]>0x0){var _0x4bb289=_[_0xa6a9('0x27')](_0x56f756['contacts'],function(_0x1232f6){if(_0x1232f6[_0xa6a9('0x28')]===_0x474f35['contactNumber']||_0x1232f6[_0xa6a9('0x29')]===_0x474f35['contactNumber']){return _0x1232f6;}});if(_0x4bb289){_0x474f35[_0xa6a9('0x2a')]=_0x4bb289['id'];logger['info'](_0xa6a9('0x2b'),_0x474f35[_0xa6a9('0x2a')]);_0x304ef6(_0x474f35);}else{return createEndUser(_0x474f35,_0x2f4835,_0x2fb9e7,_0x142628)['then'](function(_0x582b55){logger[_0xa6a9('0xe')](_0xa6a9('0x2c'),_0x474f35[_0xa6a9('0x2a')]);_0x304ef6(_0x582b55);});}}else{return createEndUser(_0x474f35,_0x2f4835,_0x2fb9e7,_0x142628)[_0xa6a9('0x10')](function(_0x35a1e3){logger[_0xa6a9('0xe')](_0xa6a9('0x2c'),_0x474f35[_0xa6a9('0x2a')]);_0x304ef6(_0x35a1e3);});}})[_0xa6a9('0x18')](function(_0x491eba){throw new Error(_0x491eba[_0xa6a9('0x1a')]);});});};}function createEndUser(_0x674a51,_0x5b8728,_0x36187d,_0x20377b){return new Promise(function(_0x1494f1,_0x5a4207){var _0x117cc3=moment();var _0x801aa6={'method':_0xa6a9('0x2d'),'uri':_0x20377b+_0xa6a9('0x2e'),'body':{'contact':{'last_name':_0x674a51[_0xa6a9('0x2f')],'work_number':_0x674a51[_0xa6a9('0x2f')],'mobile_number':_0x674a51['contactNumber'],'owner_id':_0x674a51[_0xa6a9('0x1d')],'created_at':_0x117cc3['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x801aa6[_0xa6a9('0xd')]=_0x36187d;logger[_0xa6a9('0xe')](_0xa6a9('0x30'));return rp(_0x801aa6)['then'](function(_0x57fbc2){_0x674a51['endUserId']=_0x57fbc2['contact']['id'];_0x1494f1(_0x674a51);})[_0xa6a9('0x18')](function(_0x58a8cb){logger[_0xa6a9('0x20')]('['+[_0x5b8728[_0xa6a9('0x19')]()]+']',_0x58a8cb['message']);_0x5a4207(_0x58a8cb[_0xa6a9('0x1a')]);});});}function getTicket(_0x118947,_0x5e8d49,_0x3f8561,_0x1b7ae7,_0x4997ff){return function(_0x31bdc2){logger[_0xa6a9('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x47027e,_0x16c326){var _0x526cea=moment();var _0x5c554e={'method':_0xa6a9('0x2d'),'uri':_0x3f8561+_0xa6a9('0x31'),'body':{'title':intUtil[_0xa6a9('0x32')](_0x1b7ae7[_0xa6a9('0x33')],_0x4997ff,'\x20'),'description':intUtil['getString'](_0x1b7ae7[_0xa6a9('0x34')],_0x4997ff,'\x0a'),'owner_id':_0x31bdc2[_0xa6a9('0x1d')],'creater_id':_0x31bdc2[_0xa6a9('0x15')],'targetable_id':_0x31bdc2['endUserId'],'targetable_type':_0xa6a9('0x35'),'created_at':_0x526cea[_0xa6a9('0x36')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x526cea[_0xa6a9('0x37')](0x1e,'m')[_0xa6a9('0x36')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5c554e[_0xa6a9('0xd')]=_0x5e8d49;return rp(_0x5c554e)[_0xa6a9('0x10')](function(_0x406940){_0x31bdc2[_0xa6a9('0x38')]=_0x406940[_0xa6a9('0x39')]['id'];logger[_0xa6a9('0xe')](_0xa6a9('0x3a'),_0x31bdc2['ticketId']);_0x47027e(_0x31bdc2);})[_0xa6a9('0x18')](function(_0x444708){logger[_0xa6a9('0x20')]('['+[_0x118947[_0xa6a9('0x19')]()]+']',_0x444708[_0xa6a9('0x1a')]);_0x16c326(_0x444708['message']);});});};}function emit(_0x48b75b,_0x105cd0,_0x2599e0){var _0x1395b9={'uri':_0x48b75b+_0xa6a9('0x3b')+_0x2599e0};io['to'](util[_0xa6a9('0x36')](_0xa6a9('0x3c'),_0x105cd0))[_0xa6a9('0x3d')]('trigger:browser:url',_0x1395b9);}exports['cs']=function(_0x3e59ba,_0x58dbe2,_0x3187e2,_0x44074a,_0xc4a54e,_0x42f59d,_0x159ff6,_0x47e54b){var _0x2f08ab={};var _0x3c082b={'Authorization':_0xa6a9('0x3e')+_0x42f59d[_0xa6a9('0x3f')]};_0x42f59d[_0xa6a9('0x40')]=intUtil[_0xa6a9('0x41')](_0x42f59d[_0xa6a9('0x40')]);_0x42f59d['serverUrl']=intUtil[_0xa6a9('0x41')](_0x42f59d[_0xa6a9('0x42')]);var _0x6fa535=_0x42f59d[_0xa6a9('0x40')];_0x2f08ab['adminEmail']=_0x42f59d[_0xa6a9('0x43')];_0x2f08ab['contactNumber']=_0x47e54b['toLowerCase']()===_0xa6a9('0x44')?_0x58dbe2[_0xa6a9('0x45')]:_0x58dbe2[_0xa6a9('0x46')];_0x2f08ab[_0xa6a9('0x47')]=_0x47e54b===_0xa6a9('0x48')||_0x47e54b===_0xa6a9('0x49')?_0xa6a9('0x48'):_0xa6a9('0x44');if(_0x44074a){_0x2f08ab['agentEmail']=_0x44074a['email'];}var _0x18153a=util[_0xa6a9('0x36')](_0xa6a9('0x4a'),_0x42f59d[_0xa6a9('0x42')],_0x58dbe2[_0xa6a9('0x4b')],md5(_0x58dbe2[_0xa6a9('0x4b')]));if(_0xc4a54e&&_0xc4a54e['monitor_format']){logger[_0xa6a9('0xe')](_0xa6a9('0x4c'),_0xa6a9('0x4d'));_0x58dbe2[_0xa6a9('0x4e')]=_0x18153a;}else if(_0x159ff6&&_0x159ff6[_0xa6a9('0x4f')]&&_0x159ff6['recordingFormat']!==_0xa6a9('0x50')){logger['info']('[OUTBOUND]',_0xa6a9('0x4d'));_0x58dbe2['recordingURL']=_0x18153a;}else{_0x58dbe2['recordingURL']='';}return getAdminId(_0x2f08ab,_0x47e54b,_0x3c082b,_0x6fa535)[_0xa6a9('0x10')](getUser(_0x47e54b,_0x3c082b,_0x6fa535))['then'](getEndUser(_0x47e54b,_0x3c082b,_0x6fa535))[_0xa6a9('0x10')](getTicket(_0x47e54b,_0x3c082b,_0x6fa535,_0x3187e2,_0x58dbe2))[_0xa6a9('0x10')](function(_0x141d3e){logger[_0xa6a9('0xe')](util[_0xa6a9('0x36')](_0xa6a9('0x51'),_0x141d3e[_0xa6a9('0x38')]));if(_0x47e54b!=='unmanaged'){logger[_0xa6a9('0xe')]('['+[_0x47e54b['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x6fa535,_0x44074a[_0xa6a9('0x52')],_0x141d3e['endUserId']);}})[_0xa6a9('0x18')](function(_0x4ba0d2){logger[_0xa6a9('0x20')]('['+[_0x47e54b[_0xa6a9('0x19')]()]+_0xa6a9('0x53'),util['inspect'](_0x4ba0d2,{'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 65689f7..7b1f5e5 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 _0x80ed=['[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','unknown\x20integration','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found'];(function(_0x51fce0,_0x36e4f2){var _0xe01f2c=function(_0x13eea0){while(--_0x13eea0){_0x51fce0['push'](_0x51fce0['shift']());}};_0xe01f2c(++_0x36e4f2);}(_0x80ed,0x11c));var _0xd80e=function(_0x448011,_0x161984){_0x448011=_0x448011-0x0;var _0x2579cd=_0x80ed[_0x448011];return _0x2579cd;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var zendesk=require(_0xd80e('0x1'));var salesforce=require(_0xd80e('0x2'));var sugarcrm=require(_0xd80e('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0xd80e('0x4'));var desk=require(_0xd80e('0x5'));var vtiger=require(_0xd80e('0x6'));var servicenow=require(_0xd80e('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xd80e('0x8'));var integrations=[_0xd80e('0x9'),_0xd80e('0xa'),'sugarcrm',_0xd80e('0xb'),_0xd80e('0xc'),_0xd80e('0xd'),_0xd80e('0xe'),_0xd80e('0xf'),_0xd80e('0x10'),_0xd80e('0x11')];exports[_0xd80e('0x12')]=function(_0x68625,_0x7f93b4,_0x4eee08,_0x450b44,_0x16dbb6,_0xa50f0f){if(_0x4eee08){if(_[_0xd80e('0x13')](integrations,_0x68625[_0xd80e('0x14')][_0xd80e('0x15')]())){try{var _0x1a9024=null;var _0x118f53='';var _0x1d3fcf=_0x4eee08[_0x68625['data1']['toLowerCase']()];if(_0x1d3fcf){var _0x5eb3b2=_0x1d3fcf[_0x68625['data2']];if(_0x5eb3b2){var _0x145766=_[_0xd80e('0x16')](_0x5eb3b2[_0xd80e('0x17')],{'id':parseInt(_0x68625[_0xd80e('0x18')],0xa)});if(_0x145766){if(_0x450b44){if(_0x16dbb6&&_0x7f93b4[_0xd80e('0x19')]){_0x118f53='queue';}else if(_0x7f93b4[_0xd80e('0x1a')]){_0x118f53=_0xd80e('0x1b');}else{console[_0xd80e('0x1c')](_0xd80e('0x1d'),_0x7f93b4);}}else{_0x118f53=_0xd80e('0x1e');}switch(_0x68625[_0xd80e('0x14')][_0xd80e('0x15')]()){case _0xd80e('0x9'):zendesk[_0x118f53](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f);break;case'salesforce':salesforce[_0x118f53](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f);break;case _0xd80e('0x1f'):sugarcrm[_0x118f53](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f);break;case _0xd80e('0xb'):freshdesk[_0x118f53](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f);break;case _0xd80e('0xc'):zoho[_0x118f53](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f);break;case _0xd80e('0xd'):desk[_0x118f53](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f);break;case'vtiger':vtiger[_0x118f53](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f);break;case _0xd80e('0x10'):freshsales['cs'](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f,_0x118f53);break;case _0xd80e('0x11'):servicenow['cs'](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f,_0x118f53);break;case _0xd80e('0xf'):dynamics365['cs'](_0x68625,_0x7f93b4,_0x145766,_0x450b44,_0x16dbb6,_0x5eb3b2,_0xa50f0f,_0x118f53);break;default:console['log'](_0xd80e('0x20'));}}else{_0x1a9024=require(_0xd80e('0x21'))(_0x68625[_0xd80e('0x14')][_0xd80e('0x15')]());_0x1a9024[_0xd80e('0x22')]('[EXEC]',util['format'](_0xd80e('0x23'),_0x68625[_0xd80e('0x14')][_0xd80e('0x15')](),_0x68625[_0xd80e('0x18')]));}}else{_0x1a9024=require(_0xd80e('0x21'))(_0x68625[_0xd80e('0x14')][_0xd80e('0x15')]());_0x1a9024['error'](_0xd80e('0x24'),util[_0xd80e('0x25')](_0xd80e('0x26'),_0x68625['data1'][_0xd80e('0x15')](),_0x68625[_0xd80e('0x27')]));}}else{}}catch(_0xe9bb59){console['error'](_0xe9bb59);}}}}; \ No newline at end of file +var _0xea28=['error','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','../../../../config/logger','[EXEC]','format'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xea28,0x13a));var _0x8ea2=function(_0xe8ec19,_0x5dd614){_0xe8ec19=_0xe8ec19-0x0;var _0x232c53=_0xea28[_0xe8ec19];return _0x232c53;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var zendesk=require(_0x8ea2('0x2'));var salesforce=require(_0x8ea2('0x3'));var sugarcrm=require(_0x8ea2('0x4'));var freshdesk=require(_0x8ea2('0x5'));var zoho=require(_0x8ea2('0x6'));var desk=require(_0x8ea2('0x7'));var vtiger=require('./vtiger');var servicenow=require(_0x8ea2('0x8'));var dynamics365=require(_0x8ea2('0x9'));var freshsales=require(_0x8ea2('0xa'));var integrations=['zendesk',_0x8ea2('0xb'),_0x8ea2('0xc'),_0x8ea2('0xd'),_0x8ea2('0xe'),_0x8ea2('0xf'),_0x8ea2('0x10'),_0x8ea2('0x11'),_0x8ea2('0x12'),_0x8ea2('0x13')];exports[_0x8ea2('0x14')]=function(_0x3d0b35,_0x21ae3d,_0x500b82,_0x4da3b1,_0x4722f3,_0x2ac9be){if(_0x500b82){if(_[_0x8ea2('0x15')](integrations,_0x3d0b35['data1'][_0x8ea2('0x16')]())){try{var _0x101a15=null;var _0x1dfb6e='';var _0x10aead=_0x500b82[_0x3d0b35[_0x8ea2('0x17')]['toLowerCase']()];if(_0x10aead){var _0x2879d6=_0x10aead[_0x3d0b35['data2']];if(_0x2879d6){var _0x4b2192=_[_0x8ea2('0x18')](_0x2879d6[_0x8ea2('0x19')],{'id':parseInt(_0x3d0b35[_0x8ea2('0x1a')],0xa)});if(_0x4b2192){if(_0x4da3b1){if(_0x4722f3&&_0x21ae3d[_0x8ea2('0x1b')]){_0x1dfb6e=_0x8ea2('0x1b');}else if(_0x21ae3d[_0x8ea2('0x1c')]){_0x1dfb6e=_0x8ea2('0x1d');}else{console[_0x8ea2('0x1e')](_0x8ea2('0x1f'),_0x21ae3d);}}else{_0x1dfb6e=_0x8ea2('0x20');}switch(_0x3d0b35[_0x8ea2('0x17')][_0x8ea2('0x16')]()){case _0x8ea2('0x21'):zendesk[_0x1dfb6e](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be);break;case _0x8ea2('0xb'):salesforce[_0x1dfb6e](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be);break;case _0x8ea2('0xc'):sugarcrm[_0x1dfb6e](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be);break;case _0x8ea2('0xd'):freshdesk[_0x1dfb6e](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be);break;case _0x8ea2('0xe'):zoho[_0x1dfb6e](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be);break;case _0x8ea2('0xf'):desk[_0x1dfb6e](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be);break;case _0x8ea2('0x10'):vtiger[_0x1dfb6e](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be);break;case _0x8ea2('0x12'):freshsales['cs'](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be,_0x1dfb6e);break;case _0x8ea2('0x13'):servicenow['cs'](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be,_0x1dfb6e);break;case _0x8ea2('0x11'):dynamics365['cs'](_0x3d0b35,_0x21ae3d,_0x4b2192,_0x4da3b1,_0x4722f3,_0x2879d6,_0x2ac9be,_0x1dfb6e);break;default:console['log']('unknown\x20integration');}}else{_0x101a15=require(_0x8ea2('0x22'))(_0x3d0b35[_0x8ea2('0x17')][_0x8ea2('0x16')]());_0x101a15['error'](_0x8ea2('0x23'),util[_0x8ea2('0x24')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3d0b35[_0x8ea2('0x17')][_0x8ea2('0x16')](),_0x3d0b35[_0x8ea2('0x1a')]));}}else{_0x101a15=require(_0x8ea2('0x22'))(_0x3d0b35[_0x8ea2('0x17')][_0x8ea2('0x16')]());_0x101a15[_0x8ea2('0x25')](_0x8ea2('0x23'),util[_0x8ea2('0x24')]('%s\x20account\x20#%s\x20not\x20found',_0x3d0b35[_0x8ea2('0x17')]['toLowerCase'](),_0x3d0b35[_0x8ea2('0x26')]));}}else{}}catch(_0x42bec8){console[_0x8ea2('0x25')](_0x42bec8);}}}}; \ 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 be2d77b..916a830 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 _0x78ca=['password','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','remoteUri','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','stringify','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','user:%s','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.','lodash','request-promise','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','emit','ticketType','utc','getString','Subjects','Descriptions','WhoId','Case','assign','sobject','create','validateEmail','User','find','execute','then','length','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Lead','contact','Contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x10509b,_0x2a89fc){var _0x4db814=function(_0x2049e1){while(--_0x2049e1){_0x10509b['push'](_0x10509b['shift']());}};_0x4db814(++_0x2a89fc);}(_0x78ca,0x108));var _0xa78c=function(_0x17709b,_0x86bf58){_0x17709b=_0x17709b-0x0;var _0x2bbf51=_0x78ca[_0x17709b];return _0x2bbf51;};'use strict';var _=require(_0xa78c('0x0'));var rp=require(_0xa78c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xa78c('0x2'));var jsforce=require(_0xa78c('0x3'));var util=require(_0xa78c('0x4'));var Redis=require(_0xa78c('0x5'));var intUtil=require(_0xa78c('0x6'));var config=require('../../../../config/environment');var logger=require(_0xa78c('0x7'))(_0xa78c('0x8'));config[_0xa78c('0x9')]=_[_0xa78c('0xa')](config[_0xa78c('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa78c('0x9')]));function emit(_0x4f897c,_0x333675,_0x21898f){io['to'](_0x4f897c)[_0xa78c('0xb')](_0x333675,_0x21898f);}function getTicket(_0x44ed0f,_0x427928,_0x1a82b9,_0xc2b01d,_0x3d9243,_0x37c7b8,_0xf23b95,_0x1179c1){var _0x3de5cd={};if(_0xc2b01d[_0xa78c('0xc')]==='Task'){_0x3de5cd=Object['assign']({},{'OwnerId':_0x427928['id'],'ActivityDate':moment[_0xa78c('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xa78c('0xe')](_0xc2b01d[_0xa78c('0xf')],_0x3d9243,'\x20'),'Description':intUtil[_0xa78c('0xe')](_0xc2b01d[_0xa78c('0x10')],_0x3d9243,'\x0a')},getCustomFields(_0x37c7b8,_0x3d9243));if(_0x1a82b9){_0x3de5cd[_0xa78c('0x11')]=_0x1a82b9['id'];}}else if(_0xc2b01d[_0xa78c('0xc')]===_0xa78c('0x12')){_0x3de5cd=Object[_0xa78c('0x13')]({},{'OwnerId':_0x427928['id'],'Subject':intUtil[_0xa78c('0xe')](_0xc2b01d['Subjects'],_0x3d9243,'\x20'),'Description':intUtil[_0xa78c('0xe')](_0xc2b01d[_0xa78c('0x10')],_0x3d9243,'\x0a')},getCustomFields(_0x37c7b8,_0x3d9243));if(_0x1a82b9){_0x3de5cd['ContactId']=_0x1a82b9['id'];}}return _0xf23b95[_0xa78c('0x14')](_0xc2b01d[_0xa78c('0xc')])[_0xa78c('0x15')](_0x3de5cd);}function getUser(_0x3569b9,_0x49290d,_0xb20a89){if(!_['isNil'](_0x49290d)&&intUtil[_0xa78c('0x16')](_0x49290d)){var _0x370ab6={'Email':_0x49290d};var _0x3ee01c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xb20a89['sobject'](_0xa78c('0x17'))[_0xa78c('0x18')](_0x370ab6,_0x3ee01c)[_0xa78c('0x19')]()[_0xa78c('0x1a')](function(_0x26c8db){if(_0x26c8db[_0xa78c('0x1b')]){var _0x5a19b6=_['find'](_0x26c8db,function(_0x5d9874){return _0x5d9874['Email']===_0x49290d;});if(_0x5a19b6){logger[_0xa78c('0x1c')](_0xa78c('0x1d'),_0x49290d);return BPromise[_0xa78c('0x1e')]({'id':_0x5a19b6['Id'],'name':_0x5a19b6[_0xa78c('0x1f')]});}}else{logger[_0xa78c('0x1c')](_0xa78c('0x20'),_0x49290d);return _0xb20a89[_0xa78c('0x21')]()[_0xa78c('0x1a')](function(_0x15840e){return BPromise[_0xa78c('0x1e')]({'id':_0x15840e[_0xa78c('0x22')],'name':_0x15840e['display_name']});});}});}else{logger[_0xa78c('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x49290d);return _0xb20a89[_0xa78c('0x21')]()['then'](function(_0xfa3ee1){return BPromise[_0xa78c('0x1e')]({'id':_0xfa3ee1[_0xa78c('0x22')],'name':_0xfa3ee1[_0xa78c('0x23')]});});}}function getEndUser(_0x120ad7,_0x2e1a2d,_0x1a9929,_0x3324a3,_0x821b94){var _0x11f749={'Phone':_0x3324a3};var _0x1aa2d3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa78c('0x1e')]()[_0xa78c('0x1a')](function(){if(_0x2e1a2d['ticketType']===_0xa78c('0x24')){logger[_0xa78c('0x1c')](_0xa78c('0x25'),_0x3324a3,_0x2e1a2d[_0xa78c('0x26')]);switch(_0x2e1a2d[_0xa78c('0x26')]){case _0xa78c('0x27'):return _0x821b94[_0xa78c('0x14')]('Contact')[_0xa78c('0x18')](_0x11f749,_0x1aa2d3)[_0xa78c('0x19')]()['then'](function(_0x44f640){if(_0x44f640&&_0x44f640[_0xa78c('0x1b')]){return _0x44f640;}else{return _0x821b94[_0xa78c('0x14')](_0xa78c('0x28'))[_0xa78c('0x18')](_0x11f749,_0x1aa2d3);}});case _0xa78c('0x29'):return _0x821b94['sobject'](_0xa78c('0x2a'))[_0xa78c('0x18')](_0x11f749,_0x1aa2d3)[_0xa78c('0x19')]();case _0xa78c('0x2b'):return _0x821b94[_0xa78c('0x14')](_0xa78c('0x28'))[_0xa78c('0x18')](_0x11f749,_0x1aa2d3);default:return null;}}else if(_0x2e1a2d[_0xa78c('0xc')]===_0xa78c('0x12')){logger[_0xa78c('0x1c')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3324a3,_0xa78c('0x29'));return _0x821b94['sobject'](_0xa78c('0x2a'))[_0xa78c('0x18')](_0x11f749,_0x1aa2d3)[_0xa78c('0x19')]();}})[_0xa78c('0x1a')](function(_0x57c83c){if(_0x57c83c&&_0x57c83c[_0xa78c('0x1b')]){var _0x5141e6=_[_0xa78c('0x18')](_0x57c83c,function(_0x23739e){return _0x23739e[_0xa78c('0x2c')]===_0x3324a3;});if(_0x5141e6){return BPromise[_0xa78c('0x1e')]({'id':_0x5141e6['Id'],'name':_0x5141e6['Name'],'phone':_0x5141e6[_0xa78c('0x2c')]});}}})[_0xa78c('0x1a')](function(_0x5ea5b6){if(_0x5ea5b6){logger[_0xa78c('0x1c')](_0xa78c('0x2d'),_0x3324a3);return BPromise[_0xa78c('0x1e')](_0x5ea5b6);}else{logger[_0xa78c('0x1c')](_0xa78c('0x2e'),_0x3324a3);var _0x1a8376={'LastName':_0x1a9929!==_0xa78c('0x2f')?_0x1a9929:util[_0xa78c('0x30')](_0xa78c('0x31'),_0x3324a3),'Phone':_0x3324a3};if(_0x2e1a2d[_0xa78c('0x32')]){if(_0x2e1a2d[_0xa78c('0x32')]==='contact'){logger['info'](_0xa78c('0x33'),_0x3324a3,_0x2e1a2d[_0xa78c('0x32')]);}else if(_0x2e1a2d['moduleCreate']==='lead'&&_0x2e1a2d[_0xa78c('0xc')]===_0xa78c('0x24')){logger[_0xa78c('0x1c')](_0xa78c('0x33'),_0x3324a3,_0x2e1a2d[_0xa78c('0x32')]);_0x1a8376[_0xa78c('0x34')]=_0xa78c('0x35');}else{return null;}}return _0x821b94[_0xa78c('0x14')](_[_0xa78c('0x36')](_0x2e1a2d['moduleCreate']))[_0xa78c('0x15')](_0x1a8376);}});}function getCustomFields(_0x52dad2,_0x80135a){var _0x15439c={};if(_0x52dad2[_0xa78c('0x1b')]>0x0){_[_0xa78c('0x37')](_0x52dad2,function(_0x11c760){if(_0x11c760[_0xa78c('0x38')]===_0xa78c('0x39')&&_0x11c760[_0xa78c('0x3a')]){_0x15439c[_0x11c760[_0xa78c('0x3a')]]=_0x11c760[_0xa78c('0x3b')][_0xa78c('0x3c')]();}else if(_0x11c760['type']==='variable'&&_0x11c760[_0xa78c('0x3d')]&&_0x11c760[_0xa78c('0x3a')]){_0x80135a[_0x11c760['variableName']]&&(_0x15439c[_0x11c760[_0xa78c('0x3a')]]=_0x80135a[_0x11c760[_0xa78c('0x3d')]][_0xa78c('0x3c')]());}else if(_0x11c760[_0xa78c('0x38')]===_0xa78c('0x3e')&&_0x11c760[_0xa78c('0x3f')]&&_0x11c760[_0xa78c('0x3f')][_0xa78c('0x40')]&&_0x11c760['idField']){_0x80135a[_0x11c760['Variable']['name']['toLowerCase']()]&&(_0x15439c[_0x11c760['idField']]=_0x80135a[_0x11c760[_0xa78c('0x3f')][_0xa78c('0x40')][_0xa78c('0x41')]()]['toString']());}});}return _0x15439c;}function getConnection(_0x13948a){var _0x3bea21=_0x13948a[_0xa78c('0x42')]['concat'](_0x13948a[_0xa78c('0x43')]);var _0x2d8160=new jsforce[(_0xa78c('0x44'))]({'oauth2':{'loginUrl':_0x13948a['remoteUri']||_0xa78c('0x45'),'clientId':_0x13948a[_0xa78c('0x46')],'clientSecret':_0x13948a[_0xa78c('0x47')]}});return _0x2d8160[_0xa78c('0x48')](_0x13948a[_0xa78c('0x49')],_0x3bea21)[_0xa78c('0x1a')](function(){logger[_0xa78c('0x1c')](_0xa78c('0x4a'));return _0x2d8160;});}exports['queue']=function(_0x123ab3,_0x5578fd,_0x5493e5,_0x1c2ce0,_0x384eae,_0x4ec2a8){var _0x28e003,_0x1c1f0e,_0x2e4408,_0x354642;_0x4ec2a8['serverUrl']=intUtil['stripTrailingSlash'](_0x4ec2a8[_0xa78c('0x4b')]);_0x4ec2a8[_0xa78c('0x4c')]=intUtil['stripTrailingSlash'](_0x4ec2a8[_0xa78c('0x4c')]);if(_0x384eae&&_0x384eae[_0xa78c('0x4d')]){logger[_0xa78c('0x1c')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5578fd[_0xa78c('0x4e')]=util['format'](_0xa78c('0x4f'),_0x4ec2a8[_0xa78c('0x4b')],_0x5578fd['uniqueid'],md5(_0x5578fd[_0xa78c('0x50')]));}else{_0x5578fd['recordingURL']='';}return getConnection(_0x4ec2a8)['then'](function(_0x2b17d7){_0x354642=_0x2b17d7;return getUser(_0x4ec2a8,_0x1c2ce0['email'],_0x354642);})[_0xa78c('0x1a')](function(_0x48d2ca){_0x28e003=_0x48d2ca;return getEndUser(_0x4ec2a8,_0x5493e5,_0x5578fd['calleridname'],_0x5578fd['calleridnum'],_0x354642);})['then'](function(_0x40dbf6){_0x1c1f0e=_0x40dbf6;return getTicket(_0x4ec2a8,_0x28e003,_0x1c1f0e,_0x5493e5,_0x5578fd,_0x5493e5[_0xa78c('0x51')],_0x354642,_0xa78c('0x52'));})[_0xa78c('0x1a')](function(_0x108873){_0x2e4408=_0x108873;logger[_0xa78c('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x2e4408['id']);logger[_0xa78c('0x1c')](_0xa78c('0x53'),_0x2e4408['id'],_0x1c2ce0[_0xa78c('0x40')],_0x4ec2a8['type']);switch(_0x4ec2a8['type']){case _0xa78c('0x54'):emit(util[_0xa78c('0x30')]('user:%s',_0x1c2ce0[_0xa78c('0x40')]),_0xa78c('0x55'),{'recordId':_0x2e4408['id']});break;case _0xa78c('0x56'):emit(util['format']('user:%s',_0x1c2ce0[_0xa78c('0x40')]),_0xa78c('0x57'),{'uri':util[_0xa78c('0x30')](_0xa78c('0x58'),_0x354642[_0xa78c('0x59')],_0x2e4408['id'])});break;default:logger[_0xa78c('0x5a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xa78c('0x5b')](function(_0x303455){logger[_0xa78c('0x5a')]('[QUEUE]',JSON[_0xa78c('0x5c')](_0x303455));});};exports[_0xa78c('0x5d')]=function(_0x185e75,_0x3034ca,_0x5c3d3f,_0xa75094,_0x2d17ed,_0x4d931f,_0x38b887){var _0x4c46c2,_0x1dd036,_0x37655e,_0x3331fa;_0x4d931f[_0xa78c('0x4b')]=intUtil[_0xa78c('0x5e')](_0x4d931f[_0xa78c('0x4b')]);_0x4d931f[_0xa78c('0x4c')]=intUtil[_0xa78c('0x5e')](_0x4d931f[_0xa78c('0x4c')]);if(_0x38b887&&_0x38b887[_0xa78c('0x5f')]&&_0x38b887[_0xa78c('0x5f')]!==_0xa78c('0x60')){logger[_0xa78c('0x1c')](_0xa78c('0x61'),_0xa78c('0x62'));_0x3034ca[_0xa78c('0x4e')]=util['format'](_0xa78c('0x4f'),_0x4d931f[_0xa78c('0x4b')],_0x3034ca[_0xa78c('0x50')],md5(_0x3034ca[_0xa78c('0x50')]));}return getConnection(_0x4d931f)[_0xa78c('0x1a')](function(_0x5c208b){_0x3331fa=_0x5c208b;return getUser(_0x4d931f,_0xa75094['email'],_0x3331fa);})[_0xa78c('0x1a')](function(_0x176bea){_0x4c46c2=_0x176bea;return getEndUser(_0x4d931f,_0x5c3d3f,_0x3034ca[_0xa78c('0x63')],_0x3034ca[_0xa78c('0x64')],_0x3331fa);})[_0xa78c('0x1a')](function(_0x511213){_0x1dd036=_0x511213;return getTicket(_0x4d931f,_0x4c46c2,_0x1dd036,_0x5c3d3f,_0x3034ca,_0x5c3d3f[_0xa78c('0x51')],_0x3331fa,_0xa78c('0x5d'));})['then'](function(_0x4db0bf){_0x37655e=_0x4db0bf;logger[_0xa78c('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x37655e['id']);logger[_0xa78c('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x37655e['id'],_0xa75094['name'],_0x4d931f[_0xa78c('0x38')]);switch(_0x4d931f['type']){case _0xa78c('0x54'):emit(util[_0xa78c('0x30')](_0xa78c('0x65'),_0xa75094[_0xa78c('0x40')]),_0xa78c('0x55'),{'recordId':_0x37655e['id']});break;case _0xa78c('0x56'):emit(util['format']('user:%s',_0xa75094[_0xa78c('0x40')]),_0xa78c('0x57'),{'uri':util[_0xa78c('0x30')](_0xa78c('0x58'),_0x3331fa['instanceUrl'],_0x37655e['id'])});break;default:logger[_0xa78c('0x5a')](_0xa78c('0x61'),_0xa78c('0x66'));}})[_0xa78c('0x5b')](function(_0x191925){logger['error'](_0xa78c('0x61'),JSON['stringify'](_0x191925));});};exports[_0xa78c('0x67')]=function(_0x43c346,_0x53d3da,_0x37445c,_0x5caede,_0x213672,_0x2a2293){var _0x581b6e,_0x2b3773,_0x1206d3,_0x257565;_0x2a2293['serverUrl']=intUtil[_0xa78c('0x5e')](_0x2a2293[_0xa78c('0x4b')]);_0x2a2293[_0xa78c('0x4c')]=intUtil['stripTrailingSlash'](_0x2a2293[_0xa78c('0x4c')]);if(_0x213672&&_0x213672['monitor_format']){logger[_0xa78c('0x1c')]('['+_0x53d3da[_0xa78c('0x68')][_0xa78c('0x69')]()+']',_0xa78c('0x62'));_0x53d3da[_0xa78c('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a2293['serverUrl'],_0x53d3da[_0xa78c('0x50')],md5(_0x53d3da['uniqueid']));}else{_0x53d3da[_0xa78c('0x4e')]='';}return getConnection(_0x2a2293)['then'](function(_0x35d8d2){_0x257565=_0x35d8d2;if(!_[_0xa78c('0x6a')](_0x5caede)){return getUser(_0x2a2293,_0x5caede[_0xa78c('0x40')],_0x257565);}else{return getUser(_0x2a2293,null,_0x257565);}})['then'](function(_0x5c8912){_0x581b6e=_0x5c8912;return getEndUser(_0x2a2293,_0x37445c,_0x53d3da[_0xa78c('0x6b')],_0x53d3da[_0xa78c('0x6c')],_0x257565);})[_0xa78c('0x1a')](function(_0x5a9350){_0x2b3773=_0x5a9350;return getTicket(_0x2a2293,_0x581b6e,_0x2b3773,_0x37445c,_0x53d3da,_0x37445c[_0xa78c('0x51')],_0x257565);})[_0xa78c('0x1a')](function(_0x46e9c6){_0x1206d3=_0x46e9c6;logger[_0xa78c('0x1c')]('['+_0x53d3da[_0xa78c('0x68')]['toUpperCase']()+_0xa78c('0x6d'),_0x1206d3['id']);logger[_0xa78c('0x1c')]('['+_0x53d3da['lastevent'][_0xa78c('0x69')]()+']\x20Integration\x20account\x20type\x20%s.',_0x2a2293[_0xa78c('0x38')]);})[_0xa78c('0x5b')](function(_0x593966){logger['error']('['+_0x53d3da['lastevent'][_0xa78c('0x69')]()+']',JSON['stringify'](_0x593966));});}; \ No newline at end of file +var _0xc3f6=['[QUEUE]','stringify','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','ticketType','assign','getString','Case','Subjects','Descriptions','ContactId','sobject','isNil','validateEmail','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','Contact','contact','lead','Enduser\x20with\x20phone\x20%s\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','type','string','idField','content','variable','variableName','name','Variable','toLowerCase','toString','password','concat','securityToken','Connection','clientSecret','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','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','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch'];(function(_0x27f7ca,_0x218bf1){var _0x3275b3=function(_0x2b08f7){while(--_0x2b08f7){_0x27f7ca['push'](_0x27f7ca['shift']());}};_0x3275b3(++_0x218bf1);}(_0xc3f6,0xdf));var _0x6c3f=function(_0x50b14d,_0x5f27d6){_0x50b14d=_0x50b14d-0x0;var _0x29ed0a=_0xc3f6[_0x50b14d];return _0x29ed0a;};'use strict';var _=require(_0x6c3f('0x0'));var rp=require('request-promise');var moment=require(_0x6c3f('0x1'));var BPromise=require(_0x6c3f('0x2'));var md5=require(_0x6c3f('0x3'));var jsforce=require(_0x6c3f('0x4'));var util=require(_0x6c3f('0x5'));var Redis=require(_0x6c3f('0x6'));var intUtil=require(_0x6c3f('0x7'));var config=require('../../../../config/environment');var logger=require(_0x6c3f('0x8'))(_0x6c3f('0x9'));config[_0x6c3f('0xa')]=_[_0x6c3f('0xb')](config[_0x6c3f('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x6c3f('0xc'))(new Redis(config[_0x6c3f('0xa')]));function emit(_0xde54b8,_0x21e57f,_0x3bbb84){io['to'](_0xde54b8)['emit'](_0x21e57f,_0x3bbb84);}function getTicket(_0x376028,_0xa63a1b,_0x1917f5,_0x296591,_0x1a174a,_0x4cb297,_0x45eb3c,_0x3e7305){var _0x4e4d7d={};if(_0x296591[_0x6c3f('0xd')]==='Task'){_0x4e4d7d=Object[_0x6c3f('0xe')]({},{'OwnerId':_0xa63a1b['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x6c3f('0xf')](_0x296591['Subjects'],_0x1a174a,'\x20'),'Description':intUtil[_0x6c3f('0xf')](_0x296591['Descriptions'],_0x1a174a,'\x0a')},getCustomFields(_0x4cb297,_0x1a174a));if(_0x1917f5){_0x4e4d7d['WhoId']=_0x1917f5['id'];}}else if(_0x296591[_0x6c3f('0xd')]===_0x6c3f('0x10')){_0x4e4d7d=Object[_0x6c3f('0xe')]({},{'OwnerId':_0xa63a1b['id'],'Subject':intUtil[_0x6c3f('0xf')](_0x296591[_0x6c3f('0x11')],_0x1a174a,'\x20'),'Description':intUtil[_0x6c3f('0xf')](_0x296591[_0x6c3f('0x12')],_0x1a174a,'\x0a')},getCustomFields(_0x4cb297,_0x1a174a));if(_0x1917f5){_0x4e4d7d[_0x6c3f('0x13')]=_0x1917f5['id'];}}return _0x45eb3c[_0x6c3f('0x14')](_0x296591[_0x6c3f('0xd')])['create'](_0x4e4d7d);}function getUser(_0x319f48,_0x34542b,_0x1c7e55){if(!_[_0x6c3f('0x15')](_0x34542b)&&intUtil[_0x6c3f('0x16')](_0x34542b)){var _0x1d7339={'Email':_0x34542b};var _0x12e2ad={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1c7e55[_0x6c3f('0x14')]('User')[_0x6c3f('0x17')](_0x1d7339,_0x12e2ad)[_0x6c3f('0x18')]()[_0x6c3f('0x19')](function(_0xaa2d07){if(_0xaa2d07[_0x6c3f('0x1a')]){var _0x568ae8=_[_0x6c3f('0x17')](_0xaa2d07,function(_0x38f45d){return _0x38f45d[_0x6c3f('0x1b')]===_0x34542b;});if(_0x568ae8){logger['info'](_0x6c3f('0x1c'),_0x34542b);return BPromise[_0x6c3f('0x1d')]({'id':_0x568ae8['Id'],'name':_0x568ae8[_0x6c3f('0x1e')]});}}else{logger[_0x6c3f('0x1f')](_0x6c3f('0x20'),_0x34542b);return _0x1c7e55['identity']()[_0x6c3f('0x19')](function(_0x646593){return BPromise[_0x6c3f('0x1d')]({'id':_0x646593[_0x6c3f('0x21')],'name':_0x646593[_0x6c3f('0x22')]});});}});}else{logger['info'](_0x6c3f('0x20'),_0x34542b);return _0x1c7e55[_0x6c3f('0x23')]()[_0x6c3f('0x19')](function(_0x2eace5){return BPromise[_0x6c3f('0x1d')]({'id':_0x2eace5[_0x6c3f('0x21')],'name':_0x2eace5[_0x6c3f('0x22')]});});}}function getEndUser(_0x45d856,_0x446466,_0x4e802a,_0x4bfecb,_0x4a70e7){var _0x3147ba={'Phone':_0x4bfecb};var _0x26f873={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6c3f('0x1d')]()['then'](function(){if(_0x446466[_0x6c3f('0xd')]===_0x6c3f('0x24')){logger['info'](_0x6c3f('0x25'),_0x4bfecb,_0x446466['moduleSearch']);switch(_0x446466['moduleSearch']){case _0x6c3f('0x26'):return _0x4a70e7[_0x6c3f('0x14')](_0x6c3f('0x27'))[_0x6c3f('0x17')](_0x3147ba,_0x26f873)[_0x6c3f('0x18')]()[_0x6c3f('0x19')](function(_0x2fb524){if(_0x2fb524&&_0x2fb524[_0x6c3f('0x1a')]){return _0x2fb524;}else{return _0x4a70e7[_0x6c3f('0x14')]('Lead')['find'](_0x3147ba,_0x26f873);}});case _0x6c3f('0x28'):return _0x4a70e7[_0x6c3f('0x14')](_0x6c3f('0x27'))[_0x6c3f('0x17')](_0x3147ba,_0x26f873)[_0x6c3f('0x18')]();case _0x6c3f('0x29'):return _0x4a70e7[_0x6c3f('0x14')]('Lead')['find'](_0x3147ba,_0x26f873);default:return null;}}else if(_0x446466[_0x6c3f('0xd')]==='Case'){logger[_0x6c3f('0x1f')](_0x6c3f('0x25'),_0x4bfecb,_0x6c3f('0x28'));return _0x4a70e7[_0x6c3f('0x14')]('Contact')[_0x6c3f('0x17')](_0x3147ba,_0x26f873)[_0x6c3f('0x18')]();}})[_0x6c3f('0x19')](function(_0x5b97da){if(_0x5b97da&&_0x5b97da[_0x6c3f('0x1a')]){var _0x4192c9=_['find'](_0x5b97da,function(_0x15b67c){return _0x15b67c['Phone']===_0x4bfecb;});if(_0x4192c9){return BPromise[_0x6c3f('0x1d')]({'id':_0x4192c9['Id'],'name':_0x4192c9[_0x6c3f('0x1e')],'phone':_0x4192c9['Phone']});}}})['then'](function(_0x498383){if(_0x498383){logger[_0x6c3f('0x1f')](_0x6c3f('0x2a'),_0x4bfecb);return BPromise['resolve'](_0x498383);}else{logger[_0x6c3f('0x1f')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x4bfecb);var _0x1e6548={'LastName':_0x4e802a!==_0x6c3f('0x2b')?_0x4e802a:util[_0x6c3f('0x2c')](_0x6c3f('0x2d'),_0x4bfecb),'Phone':_0x4bfecb};if(_0x446466[_0x6c3f('0x2e')]){if(_0x446466[_0x6c3f('0x2e')]===_0x6c3f('0x28')){logger[_0x6c3f('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4bfecb,_0x446466[_0x6c3f('0x2e')]);}else if(_0x446466['moduleCreate']===_0x6c3f('0x29')&&_0x446466['ticketType']===_0x6c3f('0x24')){logger['info'](_0x6c3f('0x2f'),_0x4bfecb,_0x446466['moduleCreate']);_0x1e6548[_0x6c3f('0x30')]=_0x6c3f('0x31');}else{return null;}}return _0x4a70e7[_0x6c3f('0x14')](_[_0x6c3f('0x32')](_0x446466[_0x6c3f('0x2e')]))[_0x6c3f('0x33')](_0x1e6548);}});}function getCustomFields(_0x27cdb1,_0x47cb71){var _0x192cc0={};if(_0x27cdb1[_0x6c3f('0x1a')]>0x0){_['forEach'](_0x27cdb1,function(_0xeba194){if(_0xeba194[_0x6c3f('0x34')]===_0x6c3f('0x35')&&_0xeba194['idField']){_0x192cc0[_0xeba194[_0x6c3f('0x36')]]=_0xeba194[_0x6c3f('0x37')]['toString']();}else if(_0xeba194[_0x6c3f('0x34')]===_0x6c3f('0x38')&&_0xeba194[_0x6c3f('0x39')]&&_0xeba194[_0x6c3f('0x36')]){_0x47cb71[_0xeba194[_0x6c3f('0x39')]]&&(_0x192cc0[_0xeba194[_0x6c3f('0x36')]]=_0x47cb71[_0xeba194['variableName']]['toString']());}else if(_0xeba194[_0x6c3f('0x34')]==='customVariable'&&_0xeba194['Variable']&&_0xeba194['Variable'][_0x6c3f('0x3a')]&&_0xeba194[_0x6c3f('0x36')]){_0x47cb71[_0xeba194[_0x6c3f('0x3b')]['name'][_0x6c3f('0x3c')]()]&&(_0x192cc0[_0xeba194['idField']]=_0x47cb71[_0xeba194[_0x6c3f('0x3b')]['name'][_0x6c3f('0x3c')]()][_0x6c3f('0x3d')]());}});}return _0x192cc0;}function getConnection(_0x55c55a){var _0x30793e=_0x55c55a[_0x6c3f('0x3e')][_0x6c3f('0x3f')](_0x55c55a[_0x6c3f('0x40')]);var _0xa4a0a8=new jsforce[(_0x6c3f('0x41'))]({'oauth2':{'loginUrl':_0x55c55a['remoteUri']||'https://login.salesforce.com','clientId':_0x55c55a['clientId'],'clientSecret':_0x55c55a[_0x6c3f('0x42')]}});return _0xa4a0a8['login'](_0x55c55a['username'],_0x30793e)[_0x6c3f('0x19')](function(){logger[_0x6c3f('0x1f')]('Connection\x20established.');return _0xa4a0a8;});}exports[_0x6c3f('0x43')]=function(_0x12cfa0,_0x55cbad,_0x3ddc1b,_0x11e7ff,_0x5ee4fd,_0x65edf1){var _0xc6e803,_0x692eb8,_0x5f38fd,_0x18ffe1;_0x65edf1[_0x6c3f('0x44')]=intUtil[_0x6c3f('0x45')](_0x65edf1['serverUrl']);_0x65edf1[_0x6c3f('0x46')]=intUtil[_0x6c3f('0x45')](_0x65edf1['remoteUri']);if(_0x5ee4fd&&_0x5ee4fd[_0x6c3f('0x47')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x55cbad[_0x6c3f('0x48')]=util['format'](_0x6c3f('0x49'),_0x65edf1['serverUrl'],_0x55cbad[_0x6c3f('0x4a')],md5(_0x55cbad[_0x6c3f('0x4a')]));}else{_0x55cbad['recordingURL']='';}return getConnection(_0x65edf1)[_0x6c3f('0x19')](function(_0x266354){_0x18ffe1=_0x266354;return getUser(_0x65edf1,_0x11e7ff[_0x6c3f('0x4b')],_0x18ffe1);})[_0x6c3f('0x19')](function(_0x47952c){_0xc6e803=_0x47952c;return getEndUser(_0x65edf1,_0x3ddc1b,_0x55cbad[_0x6c3f('0x4c')],_0x55cbad[_0x6c3f('0x4d')],_0x18ffe1);})['then'](function(_0x3bdc84){_0x692eb8=_0x3bdc84;return getTicket(_0x65edf1,_0xc6e803,_0x692eb8,_0x3ddc1b,_0x55cbad,_0x3ddc1b[_0x6c3f('0x4e')],_0x18ffe1,_0x6c3f('0x43'));})[_0x6c3f('0x19')](function(_0x3caa69){_0x5f38fd=_0x3caa69;logger['info'](_0x6c3f('0x4f'),_0x5f38fd['id']);logger[_0x6c3f('0x1f')](_0x6c3f('0x50'),_0x5f38fd['id'],_0x11e7ff[_0x6c3f('0x3a')],_0x65edf1[_0x6c3f('0x34')]);switch(_0x65edf1[_0x6c3f('0x34')]){case _0x6c3f('0x51'):emit(util[_0x6c3f('0x2c')](_0x6c3f('0x52'),_0x11e7ff[_0x6c3f('0x3a')]),'trigger:salesforce:display',{'recordId':_0x5f38fd['id']});break;case _0x6c3f('0x53'):emit(util[_0x6c3f('0x2c')](_0x6c3f('0x52'),_0x11e7ff[_0x6c3f('0x3a')]),_0x6c3f('0x54'),{'uri':util[_0x6c3f('0x2c')]('%s/%s/e',_0x18ffe1[_0x6c3f('0x55')],_0x5f38fd['id'])});break;default:logger[_0x6c3f('0x56')](_0x6c3f('0x57'));}})[_0x6c3f('0x58')](function(_0x2cb81d){logger[_0x6c3f('0x56')](_0x6c3f('0x59'),JSON[_0x6c3f('0x5a')](_0x2cb81d));});};exports['outbound']=function(_0x513aa6,_0x280a33,_0x4fc6e1,_0x4b315f,_0x2f6e4a,_0xc6616a,_0x2dfc28){var _0x46b72a,_0x266241,_0x130410,_0x1587ff;_0xc6616a['serverUrl']=intUtil[_0x6c3f('0x45')](_0xc6616a[_0x6c3f('0x44')]);_0xc6616a[_0x6c3f('0x46')]=intUtil[_0x6c3f('0x45')](_0xc6616a[_0x6c3f('0x46')]);if(_0x2dfc28&&_0x2dfc28[_0x6c3f('0x5b')]&&_0x2dfc28[_0x6c3f('0x5b')]!==_0x6c3f('0x5c')){logger[_0x6c3f('0x1f')](_0x6c3f('0x5d'),_0x6c3f('0x5e'));_0x280a33['recordingURL']=util['format'](_0x6c3f('0x49'),_0xc6616a[_0x6c3f('0x44')],_0x280a33['uniqueid'],md5(_0x280a33[_0x6c3f('0x4a')]));}return getConnection(_0xc6616a)[_0x6c3f('0x19')](function(_0x41a3e3){_0x1587ff=_0x41a3e3;return getUser(_0xc6616a,_0x4b315f[_0x6c3f('0x4b')],_0x1587ff);})[_0x6c3f('0x19')](function(_0x10b118){_0x46b72a=_0x10b118;return getEndUser(_0xc6616a,_0x4fc6e1,_0x280a33[_0x6c3f('0x5f')],_0x280a33[_0x6c3f('0x60')],_0x1587ff);})[_0x6c3f('0x19')](function(_0x20e1fb){_0x266241=_0x20e1fb;return getTicket(_0xc6616a,_0x46b72a,_0x266241,_0x4fc6e1,_0x280a33,_0x4fc6e1[_0x6c3f('0x4e')],_0x1587ff,'outbound');})[_0x6c3f('0x19')](function(_0x4fbc1f){_0x130410=_0x4fbc1f;logger[_0x6c3f('0x1f')](_0x6c3f('0x61'),_0x130410['id']);logger[_0x6c3f('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x130410['id'],_0x4b315f[_0x6c3f('0x3a')],_0xc6616a[_0x6c3f('0x34')]);switch(_0xc6616a['type']){case _0x6c3f('0x51'):emit(util[_0x6c3f('0x2c')](_0x6c3f('0x52'),_0x4b315f[_0x6c3f('0x3a')]),'trigger:salesforce:display',{'recordId':_0x130410['id']});break;case _0x6c3f('0x53'):emit(util[_0x6c3f('0x2c')]('user:%s',_0x4b315f[_0x6c3f('0x3a')]),_0x6c3f('0x54'),{'uri':util['format'](_0x6c3f('0x62'),_0x1587ff[_0x6c3f('0x55')],_0x130410['id'])});break;default:logger[_0x6c3f('0x56')]('[OUTBOUND]',_0x6c3f('0x63'));}})[_0x6c3f('0x58')](function(_0x4460c8){logger[_0x6c3f('0x56')](_0x6c3f('0x5d'),JSON[_0x6c3f('0x5a')](_0x4460c8));});};exports[_0x6c3f('0x64')]=function(_0x56193e,_0x4f6a2e,_0x1449ca,_0x490daf,_0x5ad2f4,_0x597c2a){var _0x563bf2,_0x5adbb1,_0xd69eb8,_0x59f4fc;_0x597c2a['serverUrl']=intUtil[_0x6c3f('0x45')](_0x597c2a[_0x6c3f('0x44')]);_0x597c2a[_0x6c3f('0x46')]=intUtil[_0x6c3f('0x45')](_0x597c2a[_0x6c3f('0x46')]);if(_0x5ad2f4&&_0x5ad2f4[_0x6c3f('0x47')]){logger[_0x6c3f('0x1f')]('['+_0x4f6a2e[_0x6c3f('0x65')][_0x6c3f('0x66')]()+']',_0x6c3f('0x5e'));_0x4f6a2e[_0x6c3f('0x48')]=util[_0x6c3f('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x597c2a['serverUrl'],_0x4f6a2e[_0x6c3f('0x4a')],md5(_0x4f6a2e['uniqueid']));}else{_0x4f6a2e[_0x6c3f('0x48')]='';}return getConnection(_0x597c2a)['then'](function(_0x38b77e){_0x59f4fc=_0x38b77e;if(!_[_0x6c3f('0x15')](_0x490daf)){return getUser(_0x597c2a,_0x490daf[_0x6c3f('0x3a')],_0x59f4fc);}else{return getUser(_0x597c2a,null,_0x59f4fc);}})[_0x6c3f('0x19')](function(_0x564a66){_0x563bf2=_0x564a66;return getEndUser(_0x597c2a,_0x1449ca,_0x4f6a2e[_0x6c3f('0x4c')],_0x4f6a2e[_0x6c3f('0x4d')],_0x59f4fc);})[_0x6c3f('0x19')](function(_0x2f2fbf){_0x5adbb1=_0x2f2fbf;return getTicket(_0x597c2a,_0x563bf2,_0x5adbb1,_0x1449ca,_0x4f6a2e,_0x1449ca['Fields'],_0x59f4fc);})[_0x6c3f('0x19')](function(_0x381605){_0xd69eb8=_0x381605;logger[_0x6c3f('0x1f')]('['+_0x4f6a2e[_0x6c3f('0x65')][_0x6c3f('0x66')]()+']\x20Ticket\x20%s\x20created.',_0xd69eb8['id']);logger[_0x6c3f('0x1f')]('['+_0x4f6a2e[_0x6c3f('0x65')][_0x6c3f('0x66')]()+_0x6c3f('0x67'),_0x597c2a[_0x6c3f('0x34')]);})['catch'](function(_0x2fd71c){logger[_0x6c3f('0x56')]('['+_0x4f6a2e['lastevent'][_0x6c3f('0x66')]()+']',JSON[_0x6c3f('0x5a')](_0x2fd71c));});}; \ 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 a8fb7b0..8605dcf 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x5cc63c,_0x53dbd2){var _0x333675=function(_0x517bc1){while(--_0x517bc1){_0x5cc63c['push'](_0x5cc63c['shift']());}};_0x333675(++_0x53dbd2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x5fc3[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7a54=['getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x1f3280,_0xec6845){var _0x50770f=function(_0x3edb5b){while(--_0x3edb5b){_0x1f3280['push'](_0x1f3280['shift']());}};_0x50770f(++_0xec6845);}(_0x7a54,0x106));var _0x47a5=function(_0x82739a,_0x38e782){_0x82739a=_0x82739a-0x0;var _0x43b2aa=_0x7a54[_0x82739a];return _0x43b2aa;};'use strict';var _=require(_0x47a5('0x0'));var Promise=require(_0x47a5('0x1'));var rp=require(_0x47a5('0x2'));var util=require('util');var md5=require(_0x47a5('0x3'));var Redis=require(_0x47a5('0x4'));var intUtil=require('./util');var config=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));function getAdminUser(_0x30e405,_0x506eda,_0x194fb0,_0x5077f3,_0x5d90b3,_0x582352){return new Promise(function(_0x2a0e98,_0x2baee7){var _0x5e31dd={'method':_0x47a5('0xb'),'uri':_0x5077f3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5d90b3+'&'+_0x582352,'auth':_0x506eda,'json':!![]};return rp(_0x5e31dd)['then'](function(_0x1f47f4){if(_0x1f47f4[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x194fb0[_0x47a5('0xe')]=_0x1f47f4[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}logger[_0x47a5('0x10')]('['+[_0x30e405['toUpperCase']()]+_0x47a5('0x11'),_0x194fb0);_0x2a0e98(_0x194fb0);})[_0x47a5('0x12')](function(_0x1cf309){logger[_0x47a5('0x13')]('['+[_0x30e405[_0x47a5('0x14')]()]+']',_0x1cf309[_0x47a5('0x15')]);_0x2baee7(_0x1cf309[_0x47a5('0x15')]);});});}function getUser(_0x190faa,_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return function(_0x2a2cbb){logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x2a2cbb);return new Promise(function(_0x138bc0,_0x4b966e){if(intUtil['validateEmail'](_0x2a2cbb[_0x47a5('0x16')])){var _0xaf70a6={'method':_0x47a5('0xb'),'uri':_0x362359+_0x47a5('0x17')+_0x2a2cbb[_0x47a5('0x16')]+'&'+_0x11faf5+'&'+_0x3b001e,'auth':_0x4e99a8,'json':!![]};logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x18'),_0xaf70a6);return rp(_0xaf70a6)[_0x47a5('0x19')](function(_0x4a9fcb){logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+'],\x20getUser\x20entity',_0x4a9fcb);if(_0x4a9fcb[_0x47a5('0xc')][_0x47a5('0xd')]>0x0&&String(_0x4a9fcb[_0x47a5('0xc')][0x0]['active'])===_0x47a5('0x1a')){_0x2a2cbb[_0x47a5('0x1b')]=_0x4a9fcb[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}else{_0x2a2cbb['userId']=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb['adminEmail'];}logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x1c'),_0x2a2cbb);_0x138bc0(_0x2a2cbb);})[_0x47a5('0x12')](function(_0x3abd6a){logger['error']('['+[_0x190faa['toUpperCase']()]+']',_0x3abd6a[_0x47a5('0x15')]);_0x4b966e(_0x3abd6a['message']);});}else{logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+_0x47a5('0x1d'));_0x2a2cbb[_0x47a5('0x1b')]=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb[_0x47a5('0x1e')];_0x138bc0(_0x2a2cbb);}});};}function createEndUser(_0x3ba0b7,_0x24b162,_0x136b14,_0x16631f,_0x361bfa){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+_0x47a5('0x1f'),_0x136b14);return new Promise(function(_0x528582,_0x243210){var _0x51833b={'method':_0x47a5('0x20'),'uri':_0x16631f+_0x47a5('0x21')+_0x361bfa,'body':{'user_name':_0x136b14[_0x47a5('0x22')],'roles':'user','first_name':_0x136b14[_0x47a5('0x22')],'active':_0x47a5('0x1a'),'date_format':_0x47a5('0x23'),'phone':_0x136b14[_0x47a5('0x22')]},'auth':_0x24b162,'json':!![]};return rp(_0x51833b)['then'](function(_0x50d875){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+'],\x20EndUser\x20schema',_0x50d875['result']);_0x136b14[_0x47a5('0x24')]=_0x50d875[_0x47a5('0xc')]['sys_id'];_0x528582(_0x136b14);})[_0x47a5('0x12')](function(_0x53119b){logger[_0x47a5('0x13')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+']',_0x53119b['message']);_0x243210(_0x53119b['message']);});});}function getEndUser(_0x274e34,_0x5910bb,_0x403028,_0x87e4c9,_0xf269a8){return function(_0x52749b){logger[_0x47a5('0x10')]('['+[_0x274e34['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x52749b);return new Promise(function(_0x65542e,_0x5a8a7c){var _0x25cce0={'method':'GET','uri':_0x403028+_0x47a5('0x25')+_0x52749b[_0x47a5('0x22')]+'&'+_0x87e4c9+'&'+_0xf269a8,'auth':_0x5910bb,'json':!![]};return rp(_0x25cce0)[_0x47a5('0x19')](function(_0x199698){if(_0x199698[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x52749b[_0x47a5('0x24')]=_0x199698[_0x47a5('0xc')][0x0][_0x47a5('0xf')];logger['info']('['+[_0x274e34[_0x47a5('0x14')]()]+_0x47a5('0x26'),_0x52749b);_0x65542e(_0x52749b);}else{return createEndUser(_0x274e34,_0x5910bb,_0x52749b,_0x403028,_0x87e4c9)['then'](function(_0x2c50d6){logger[_0x47a5('0x10')]('['+[_0x274e34[_0x47a5('0x14')]()]+'],\x20createEndUser\x20crm',_0x2c50d6);_0x65542e(_0x2c50d6);});}})[_0x47a5('0x12')](function(_0x10f660){logger['error']('['+[_0x274e34[_0x47a5('0x14')]()]+']',_0x10f660[_0x47a5('0x15')]);_0x5a8a7c(_0x10f660['message']);});});};}function getCustomFields(_0x55c5eb,_0x5ebd8c){var _0x12d9f2={};if(_0x55c5eb['length']>0x0){_[_0x47a5('0x27')](_0x55c5eb,function(_0x1f9631){if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2a')]&&!_0x1f9631[_0x47a5('0x2b')]){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2c')]&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631['type']===_0x47a5('0x30')&&_0x1f9631['variableName']&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631['idField'][_0x47a5('0x2d')]()]=_0x5ebd8c[_0x1f9631['variableName']][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x31')&&_0x1f9631['Variable']&&_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')]&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')]['toLowerCase']()]=_0x5ebd8c[_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')][_0x47a5('0x2d')]()][_0x47a5('0x2f')]();}});}return _0x12d9f2;}function getTicket(_0x34a9ae,_0xf0edbb,_0x434227,_0x17cc42,_0xac9c15,_0x162fa0){return function(_0x24ecb1){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+_0x47a5('0x34'),_0x24ecb1);return new Promise(function(_0x4e5e7,_0x3a2b38){var _0x512e65=_0x34a9ae[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x24ecb1['userId']:_0x24ecb1['endUserId'];var _0x3d0a88={'method':'POST','uri':_0x434227+_0x47a5('0x36')+'?'+_0x162fa0,'body':Object[_0x47a5('0x37')]({},{'active':'true','caller_id':_0x512e65,'assigned_to':_0x24ecb1['userId'],'short_description':intUtil[_0x47a5('0x38')](_0x17cc42['Subjects'],_0xac9c15,'\x20'),'description':intUtil[_0x47a5('0x38')](_0x17cc42[_0x47a5('0x39')],_0xac9c15,'\x0a')},getCustomFields(_0x17cc42[_0x47a5('0x3a')],_0xac9c15)),'auth':_0xf0edbb,'json':!![]};return rp(_0x3d0a88)[_0x47a5('0x19')](function(_0x44fe8a){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x44fe8a['result']);_0x24ecb1[_0x47a5('0x3b')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0xf')];_0x24ecb1[_0x47a5('0x3c')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0x3d')];logger[_0x47a5('0x10')]('['+[_0x34a9ae['toUpperCase']()]+_0x47a5('0x3e'),_0x24ecb1);_0x4e5e7(_0x24ecb1);})[_0x47a5('0x12')](function(_0x5f6a){logger['error']('['+[_0x34a9ae[_0x47a5('0x14')]()]+']',_0x5f6a['message']);_0x3a2b38(_0x5f6a[_0x47a5('0x15')]);});});};}function createRemoteTag(_0xe31817,_0x46e90b,_0xf03bd5,_0x588551){return new Promise(function(_0x3adf14,_0x1e6de3){var _0x2f66e9={'method':_0x47a5('0x20'),'uri':_0xf03bd5+_0x47a5('0x3f')+'?'+_0x588551,'body':{'short_description':_0xe31817,'global':!![],'active':!![],'name':_0xe31817},'auth':_0x46e90b,'json':!![]};return rp(_0x2f66e9)[_0x47a5('0x19')](function(_0x24e9f4){var _0x481089=_0x24e9f4[_0x47a5('0xc')][_0x47a5('0xf')];_0x3adf14(_0x481089);});});}function getRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf,_0x572233){return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581={'method':'GET','uri':_0x3329aa+_0x47a5('0x3f')+_0x47a5('0x40')+_0x187d7e+'&'+_0x1ab0bf,'auth':_0x8da9fb,'json':!![]};return rp(_0x1aa581)[_0x47a5('0x19')](function(_0x5d8d4a){if(_0x5d8d4a['result'][_0x47a5('0xd')]>0x0){var _0x376e1d=_0x5d8d4a['result'][0x0]['sys_id'];_0x1ad6a9(_0x376e1d);}else{return createRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf)[_0x47a5('0x19')](function(_0x4d6a82){_0x1ad6a9(_0x4d6a82);});}});});}function assignTagToIncident(_0x16bb8a,_0x5d383d,_0x482de6,_0x389ed9,_0x46d2d3){return new Promise(function(_0x53eedf,_0x1b958b){var _0x72fe={'method':'POST','uri':_0x482de6+'label_entry'+'?'+_0x46d2d3,'body':{'label':_0x16bb8a,'table':_0x47a5('0x36'),'id_type':_0x47a5('0x41'),'table_key':_0x389ed9[_0x47a5('0x3b')],'title':_0x47a5('0x42')+_0x389ed9['ticketNumber'],'id_display':_0x389ed9[_0x47a5('0x3c')]},'auth':_0x5d383d,'json':!![]};return rp(_0x72fe)[_0x47a5('0x19')](function(_0x1af800){_0x53eedf();})['catch'](function(){_0x53eedf();});});}function manageTags(_0x30ea7a,_0x4db625,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b,_0x3603b7){return new Promise(function(_0x4966af,_0x144af9){var _0x5d1550=[];_0x4db625['forEach'](function(_0x5eb150){_0x5d1550['push'](getRemoteTag(_0x5eb150,_0x485e3c,_0x470da6,_0x1c485b,_0x3603b7));});return Promise[_0x47a5('0x43')](_0x5d1550)[_0x47a5('0x19')](function(_0x1e2bb4){if(_0x1e2bb4['length']){logger['info']('['+[_0x30ea7a[_0x47a5('0x14')]()]+_0x47a5('0x44'),_0x1e2bb4);var _0x45d4b6=[];_0x1e2bb4[_0x47a5('0x27')](function(_0xc45e25){_0x45d4b6['push'](assignTagToIncident(_0xc45e25,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b));});return Promise[_0x47a5('0x43')](_0x45d4b6)['then'](function(){_0x4966af();})[_0x47a5('0x12')](function(){_0x4966af();});}else{_0x4966af();}});});}function getTags(_0x274d31,_0x4d545f,_0x32b4de,_0x345104,_0x132854,_0x3e8274){return function(_0x2d6494){return new Promise(function(_0x215634,_0x35cca8){var _0x3ac38c=[];var _0x57ed0a=_0x345104[_0x47a5('0x45')];if(_0x57ed0a&&_0x57ed0a[_0x47a5('0xd')]>0x0){_0x3ac38c=_[_0x47a5('0x46')](_0x57ed0a,_0x47a5('0x33'));}if(_0x3ac38c[_0x47a5('0xd')]>0x0){return manageTags(_0x274d31,_0x3ac38c,_0x4d545f,_0x32b4de,_0x2d6494,_0x132854,_0x3e8274)['then'](function(){_0x215634(_0x2d6494);});}else{_0x215634(_0x2d6494);}});};}function emit(_0xbec033,_0xdfcecc,_0x1224bc){var _0x144aaa=_0x47a5('0x47')+_0x47a5('0x48')+_0x47a5('0x49')+_0x47a5('0x4a');var _0x350af8={'uri':_0xbec033+_0x47a5('0x4b')+_0x1224bc+_0x144aaa};io['to'](util[_0x47a5('0x4c')](_0x47a5('0x4d'),_0xdfcecc))[_0x47a5('0x4e')](_0x47a5('0x4f'),_0x350af8);}exports['cs']=function(_0x3edd17,_0x5a6161,_0x42dd7d,_0x284fb8,_0x30504e,_0x4b42f3,_0x37ac59,_0x2e46af){var _0x36c67={};var _0x26f1ac={'user':_0x4b42f3['username'],'pass':_0x4b42f3[_0x47a5('0x50')]};var _0x522ccf=_0x47a5('0x51');var _0x487e21=_0x47a5('0x52');_0x4b42f3['remoteUri']=intUtil[_0x47a5('0x53')](_0x4b42f3[_0x47a5('0x54')]);_0x4b42f3[_0x47a5('0x55')]=intUtil['stripTrailingSlash'](_0x4b42f3['serverUrl']);var _0x4b8084=util[_0x47a5('0x4c')](_0x47a5('0x56'),_0x4b42f3[_0x47a5('0x54')]);_0x36c67[_0x47a5('0x16')]=!_['isNil'](_0x284fb8)?_0x284fb8[_0x47a5('0x57')]:null;_0x36c67[_0x47a5('0x1e')]=_0x4b42f3[_0x47a5('0x57')];_0x36c67[_0x47a5('0x22')]=_0x2e46af[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x5a6161[_0x47a5('0x58')]:_0x5a6161[_0x47a5('0x59')];_0x36c67[_0x47a5('0x5a')]=_0x2e46af===_0x47a5('0x5b')||_0x2e46af===_0x47a5('0x5c')?_0x47a5('0x5b'):'outbound';var _0x1e3212=util['format'](_0x47a5('0x5d'),_0x4b42f3[_0x47a5('0x55')],_0x5a6161[_0x47a5('0x5e')],md5(_0x5a6161[_0x47a5('0x5e')]));if(_0x30504e&&_0x30504e[_0x47a5('0x5f')]){logger[_0x47a5('0x10')](_0x47a5('0x60'),_0x47a5('0x61'));_0x5a6161[_0x47a5('0x62')]=_0x1e3212;}else if(_0x37ac59&&_0x37ac59[_0x47a5('0x63')]&&_0x37ac59[_0x47a5('0x63')]!==_0x47a5('0x64')){logger[_0x47a5('0x10')](_0x47a5('0x65'),_0x47a5('0x61'));_0x5a6161['recordingURL']=_0x1e3212;}else{_0x5a6161['recordingURL']='';}return getAdminUser(_0x2e46af,_0x26f1ac,_0x36c67,_0x4b8084,_0x487e21,_0x522ccf)['then'](getUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))['then'](getEndUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))[_0x47a5('0x19')](getTicket(_0x2e46af,_0x26f1ac,_0x4b8084,_0x42dd7d,_0x5a6161,_0x487e21))[_0x47a5('0x19')](function(_0x5d6916){logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x66'),_0x5d6916[_0x47a5('0x3b')]));logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x67'),_0x2e46af));if(_0x2e46af!==_0x47a5('0x5c')){logger[_0x47a5('0x10')]('['+[_0x2e46af[_0x47a5('0x14')]()]+']',_0x47a5('0x68'));emit(_0x4b42f3['remoteUri'],_0x284fb8[_0x47a5('0x33')],_0x5d6916[_0x47a5('0x3b')]);}})[_0x47a5('0x12')](function(_0x4f35ff){logger[_0x47a5('0x13')]('['+[_0x2e46af[_0x47a5('0x14')]()]+_0x47a5('0x69'),util['inspect'](_0x4f35ff,{'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 d7765bb..fbc1a02 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 _0x7eff=['../../../../config/logger','defaults','redis','localhost','socket.io-emitter','POST','emit','assigned_user_id','created_by','description','getString','date_start','slice','replace','duration_minutes','parent_type','Contacts','parent_name','name','direction','length','forEach','idField','set_entry','JSON','stringify','Calls','toString','base64','get_server_info','isNil','info','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','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','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','variable','variableName','Variable','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','unmanaged','monitor_format','lastevent','toUpperCase','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xf7ef('0x0'));var BPromise=require(_0xf7ef('0x1'));var md5=require(_0xf7ef('0x2'));var util=require('util');var Redis=require(_0xf7ef('0x3'));var intUtil=require(_0xf7ef('0x4'));var config=require(_0xf7ef('0x5'));var logger=require(_0xf7ef('0x6'))('sugarcrm');config['redis']=_[_0xf7ef('0x7')](config[_0xf7ef('0x8')],{'host':_0xf7ef('0x9'),'port':0x18eb});var io=require(_0xf7ef('0xa'))(new Redis(config[_0xf7ef('0x8')]));var def={'method':_0xf7ef('0xb'),'json':!![]};function emit(_0x1022af,_0xd8bc8d,_0x540131){io['to'](_0x1022af)[_0xf7ef('0xc')](_0xd8bc8d,_0x540131);}function getTicket(_0x116448,_0x48c84f,_0x25c6c5,_0x5bbb90,_0x5044c4,_0x598fc5,_0x4d7b14,_0x926f7){logger['info']('Creating\x20new\x20ticket...');var _0x4ed444=new Date();var _0xecbdcb=[{'name':'name','value':intUtil['getString'](_0x5bbb90['Subjects'],_0x5044c4,'\x20')},{'name':_0xf7ef('0xd'),'value':_0x48c84f['id']},{'name':_0xf7ef('0xe'),'value':_0x48c84f['id']},{'name':_0xf7ef('0xf'),'value':intUtil[_0xf7ef('0x10')](_0x5bbb90['Descriptions'],_0x5044c4,'\x0a')},{'name':_0xf7ef('0x11'),'value':_0x4ed444['toISOString']()[_0xf7ef('0x12')](0x0,0x13)[_0xf7ef('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xf7ef('0x14'),'value':'15'},{'name':'parent_id','value':_0x25c6c5['id']},{'name':_0xf7ef('0x15'),'value':_0xf7ef('0x16')},{'name':_0xf7ef('0x17'),'value':_0x25c6c5[_0xf7ef('0x18')]},{'name':_0xf7ef('0x19'),'value':_0x926f7}];if(_0x598fc5[_0xf7ef('0x1a')]){_[_0xf7ef('0x1b')](_0x598fc5,function(_0x514e73){if(_0x5044c4[_0x514e73['variableName']]){_0xecbdcb['push']({'name':_0x514e73[_0xf7ef('0x1c')],'value':_0x5044c4[_0x514e73['variableName']]});}});}return request({'form':{'method':_0xf7ef('0x1d'),'input_type':_0xf7ef('0x1e'),'response_type':_0xf7ef('0x1e'),'rest_data':JSON[_0xf7ef('0x1f')]({'session':_0x4d7b14['id'],'module_name':_0xf7ef('0x20'),'name_value_list':_0xecbdcb})}});}function getAuth(_0x29cbf1){return util['format']('Basic\x20%s',new Buffer(_0x29cbf1['apiKey']+':X')[_0xf7ef('0x21')](_0xf7ef('0x22')));}function getServerInfo(_0x1a95c6){return request({'form':{'method':_0xf7ef('0x23'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf7ef('0x1f')]({'session':_0x1a95c6['id']})}});}function getUser(_0x36c8c8,_0x5e1c75,_0x168da4){if(!_[_0xf7ef('0x24')](_0x5e1c75)){logger[_0xf7ef('0x25')]('Getting\x20agent\x20with\x20name',_0x5e1c75);return request({'form':{'method':_0xf7ef('0x26'),'input_type':_0xf7ef('0x1e'),'response_type':'JSON','rest_data':JSON[_0xf7ef('0x1f')]({'session':_0x168da4['id'],'module_name':_0xf7ef('0x27'),'query':util[_0xf7ef('0x28')](_0xf7ef('0x29'),_0x5e1c75),'order_by':'','offset':'0','select_fields':['id',_0xf7ef('0x18'),_0xf7ef('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf7ef('0x2b')](function(_0x31db15){if(_0x31db15[_0xf7ef('0x2c')]['length']){var _0x13a364=_[_0xf7ef('0x2d')](_0x31db15[_0xf7ef('0x2c')],function(_0x3a9292){return _0x3a9292['name_value_list'][_0xf7ef('0x2a')][_0xf7ef('0x2e')]===_0x5e1c75;});if(_0x13a364){logger[_0xf7ef('0x25')]('Agent\x20found!');return BPromise[_0xf7ef('0x2f')]({'id':_0x13a364['name_value_list']['id'][_0xf7ef('0x2e')],'name':_0x13a364[_0xf7ef('0x30')][_0xf7ef('0x18')][_0xf7ef('0x2e')]});}}logger['info'](_0xf7ef('0x31'));return BPromise[_0xf7ef('0x2f')]({'id':_0x168da4[_0xf7ef('0x30')]['user_id'][_0xf7ef('0x2e')],'name':_0x168da4[_0xf7ef('0x30')][_0xf7ef('0x2a')][_0xf7ef('0x2e')]});});}else{logger[_0xf7ef('0x25')](_0xf7ef('0x32'));return BPromise[_0xf7ef('0x2f')]({'id':_0x168da4[_0xf7ef('0x30')][_0xf7ef('0x33')]['value'],'name':_0x168da4[_0xf7ef('0x30')][_0xf7ef('0x2a')][_0xf7ef('0x2e')]});}}function getEndUser(_0x445964,_0x34fc2c,_0x233ae2,_0x90e4a1){logger[_0xf7ef('0x25')](_0xf7ef('0x34'),_0x233ae2);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xf7ef('0x1e'),'rest_data':JSON[_0xf7ef('0x1f')]({'session':_0x90e4a1['id'],'module_name':_0xf7ef('0x16'),'query':util[_0xf7ef('0x28')](_0xf7ef('0x35'),_0x233ae2),'order_by':'','offset':'0','select_fields':['id',_0xf7ef('0x18'),_0xf7ef('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf7ef('0x2b')](function(_0x5449c1){if(_0x5449c1[_0xf7ef('0x2c')][_0xf7ef('0x1a')]){var _0x55721c=_['find'](_0x5449c1[_0xf7ef('0x2c')],function(_0x3ea37f){return _0x3ea37f[_0xf7ef('0x30')][_0xf7ef('0x36')][_0xf7ef('0x2e')]===_0x233ae2;});if(_0x55721c){logger[_0xf7ef('0x25')](_0xf7ef('0x37'));return BPromise[_0xf7ef('0x2f')]({'id':_0x55721c['name_value_list']['id']['value'],'name':_0x55721c[_0xf7ef('0x30')]['name'][_0xf7ef('0x2e')],'phone':_0x55721c[_0xf7ef('0x30')][_0xf7ef('0x36')][_0xf7ef('0x2e')]});}}else{logger[_0xf7ef('0x25')](_0xf7ef('0x38'));return request({'form':{'method':_0xf7ef('0x1d'),'input_type':_0xf7ef('0x1e'),'response_type':_0xf7ef('0x1e'),'rest_data':JSON['stringify']({'session':_0x90e4a1['id'],'module_name':_0xf7ef('0x16'),'name_value_list':[{'name':_0xf7ef('0x39'),'value':_0x34fc2c!==''?_0x34fc2c:util[_0xf7ef('0x28')](_0xf7ef('0x3a'),_0x233ae2)},{'name':_0xf7ef('0x36'),'value':_0x233ae2}]})}})[_0xf7ef('0x2b')](function(_0x69d4c7){logger[_0xf7ef('0x25')](_0xf7ef('0x3b'));return BPromise[_0xf7ef('0x2f')]({'id':_0x69d4c7['id'],'name':_0x69d4c7[_0xf7ef('0x2c')][_0xf7ef('0x39')]['value'],'phone':_0x69d4c7['entry_list']['phone_home'][_0xf7ef('0x2e')]});});}});}function request(_0x540783){logger[_0xf7ef('0x3c')](_0xf7ef('0x3d'),JSON[_0xf7ef('0x1f')](_0x540783));return rp(_['merge'](def,_0x540783));}function getTags(_0x123ec4,_0x55eb48){var _0x25141f=[];if(_0x123ec4&&_0x123ec4[_0xf7ef('0x1a')]>0x0){_0x25141f=_[_0xf7ef('0x3e')](_0x123ec4,_0x55eb48);}return _0x25141f;}function getCustomFields(_0x30e539,_0x156e3b){var _0x437f00=[];var _0x1c5974={'custom_fields':[]};if(_0x30e539[_0xf7ef('0x1a')]>0x0){_[_0xf7ef('0x1b')](_0x30e539,function(_0x1f504f){if(_0x1f504f[_0xf7ef('0x3f')]===_0xf7ef('0x40')&&_0x1f504f[_0xf7ef('0x41')]&&!_0x1f504f[_0xf7ef('0x42')]){_0x1c5974[_0x1f504f[_0xf7ef('0x41')][_0xf7ef('0x43')]()]=_0x1f504f[_0xf7ef('0x44')][_0xf7ef('0x21')]();}else if(_0x1f504f[_0xf7ef('0x3f')]===_0xf7ef('0x40')&&_0x1f504f[_0xf7ef('0x1c')]&&_0x1f504f['customField']){_0x1c5974[_0xf7ef('0x45')][_0xf7ef('0x46')]({'id':_0x1f504f[_0xf7ef('0x1c')],'value':_0x1f504f['content'][_0xf7ef('0x21')]()});}else if(_0x1f504f[_0xf7ef('0x3f')]===_0xf7ef('0x47')&&_0x1f504f[_0xf7ef('0x48')]&&_0x1f504f[_0xf7ef('0x1c')]&&_0x1f504f[_0xf7ef('0x42')]){_0x156e3b[_0x1f504f[_0xf7ef('0x48')]]&&_0x1c5974[_0xf7ef('0x45')][_0xf7ef('0x46')]({'id':_0x1f504f[_0xf7ef('0x1c')],'value':_0x156e3b[_0x1f504f[_0xf7ef('0x48')]][_0xf7ef('0x21')]()});}else if(_0x1f504f['type']==='customVariable'&&_0x1f504f[_0xf7ef('0x49')]&&_0x1f504f['Variable'][_0xf7ef('0x18')]&&_0x1f504f[_0xf7ef('0x1c')]&&_0x1f504f[_0xf7ef('0x42')]){_0x156e3b[_0x1f504f[_0xf7ef('0x49')][_0xf7ef('0x18')]['toLowerCase']()]&&_0x1c5974['custom_fields'][_0xf7ef('0x46')]({'id':_0x1f504f[_0xf7ef('0x1c')],'value':_0x156e3b[_0x1f504f[_0xf7ef('0x49')][_0xf7ef('0x18')][_0xf7ef('0x43')]()]['toString']()});}});}return _0x1c5974;}function getConnection(_0xca3d3c){return request({'method':_0xf7ef('0xb'),'form':{'method':'login','input_type':_0xf7ef('0x1e'),'response_type':_0xf7ef('0x1e'),'rest_data':JSON[_0xf7ef('0x1f')]({'user_auth':{'user_name':_0xca3d3c[_0xf7ef('0x4a')],'password':_0xca3d3c[_0xf7ef('0x4b')],'encryption':'PLAIN'},'application':_0xf7ef('0x4c')})}})[_0xf7ef('0x2b')](function(_0x4a0924){var _0x3f71df=_0x4a0924;if(_0x3f71df['id']){def[_0xf7ef('0x4d')]=_0x3f71df['id'];return BPromise['resolve'](_0x3f71df);}else{throw new Error(util[_0xf7ef('0x28')](_0xf7ef('0x4e'),_0xca3d3c['id']));}});}function setRelationship(_0x320a24,_0x2a8c11,_0x3deb9f,_0x4fb7b2){return request({'form':{'method':_0xf7ef('0x4f'),'input_type':_0xf7ef('0x1e'),'response_type':_0xf7ef('0x1e'),'rest_data':JSON[_0xf7ef('0x1f')]({'session':_0x320a24['id'],'module_name':_0xf7ef('0x20'),'module_id':_0x3deb9f['id'],'link_field_name':_0x4fb7b2,'related_ids':[_0x2a8c11['id']]})}});}exports[_0xf7ef('0x50')]=function(_0x30153b,_0x32ae73,_0x32a786,_0x206bfc,_0x80a9fb,_0x30392e){var _0x3beef0,_0xb8faa2,_0x57488b,_0x473463;_0x30392e[_0xf7ef('0x51')]=intUtil[_0xf7ef('0x52')](_0x30392e[_0xf7ef('0x51')]);_0x30392e[_0xf7ef('0x53')]=intUtil['stripTrailingSlash'](_0x30392e[_0xf7ef('0x53')]);def[_0xf7ef('0x54')]=util[_0xf7ef('0x28')](_0xf7ef('0x55'),_0x30392e[_0xf7ef('0x51')]);if(_0x80a9fb&&_0x80a9fb['monitor_format']){logger['info'](_0xf7ef('0x56'),_0xf7ef('0x57'));_0x32ae73[_0xf7ef('0x58')]=util[_0xf7ef('0x28')](_0xf7ef('0x59'),_0x30392e[_0xf7ef('0x53')],_0x32ae73[_0xf7ef('0x5a')],md5(_0x32ae73[_0xf7ef('0x5a')]));}else{_0x32ae73['recordingURL']='';}return getConnection(_0x30392e)[_0xf7ef('0x2b')](function(_0x1ab330){_0x473463=_0x1ab330;return getUser(_0x30392e,_0x206bfc[_0xf7ef('0x18')],_0x473463);})[_0xf7ef('0x2b')](function(_0x26e9f6){_0x3beef0=_0x26e9f6;logger['info'](_0xf7ef('0x5b'),_0x3beef0['id']);return getEndUser(_0x30392e,_0x32ae73[_0xf7ef('0x5c')],_0x32ae73[_0xf7ef('0x5d')],_0x473463);})['then'](function(_0x4e4ba7){_0xb8faa2=_0x4e4ba7;logger[_0xf7ef('0x25')](_0xf7ef('0x5e'),_0xb8faa2['id']);return getTicket(_0x30392e,_0x3beef0,_0xb8faa2,_0x32a786,_0x32ae73,_0x32a786[_0xf7ef('0x5f')],_0x473463,_0xf7ef('0x60'));})['then'](function(_0x6daf30){_0x57488b=_0x6daf30;logger[_0xf7ef('0x25')]('Ticket\x20created!');logger[_0xf7ef('0x25')](_0xf7ef('0x61'),_0x57488b['id']);return setRelationship(_0x473463,_0x3beef0,_0x57488b,_0xf7ef('0x62'));})[_0xf7ef('0x2b')](function(){return setRelationship(_0x473463,_0xb8faa2,_0x57488b,_0xf7ef('0x63'));})['then'](function(){return getServerInfo(_0x473463);})[_0xf7ef('0x2b')](function(_0x4c7f92){var _0x1dfcad=parseInt(_0x4c7f92[_0xf7ef('0x64')][_0xf7ef('0x65')](0x0));var _0x3947a0=util['format'](_0xf7ef('0x66'),_0x30392e[_0xf7ef('0x51')],_0x57488b['id']);if(_0x1dfcad>0x6){_0x3947a0=util[_0xf7ef('0x28')](_0xf7ef('0x67'),_0x30392e[_0xf7ef('0x51')],_0x57488b['id']);}logger[_0xf7ef('0x25')](_0xf7ef('0x56'),_0xf7ef('0x68'));emit(util[_0xf7ef('0x28')](_0xf7ef('0x69'),_0x206bfc[_0xf7ef('0x18')]),_0xf7ef('0x6a'),{'uri':_0x3947a0});})[_0xf7ef('0x6b')](function(_0xe4bffe){logger[_0xf7ef('0x6c')](_0xf7ef('0x56'),JSON['stringify'](_0xe4bffe));});};exports[_0xf7ef('0x6d')]=function(_0xed77fe,_0x3b227e,_0x10b96b,_0x873d4d,_0x19086c,_0x26bf75,_0x4dc9a6){var _0x557b04,_0x47158f,_0x494ba3,_0x54f64f;_0x26bf75[_0xf7ef('0x51')]=intUtil['stripTrailingSlash'](_0x26bf75[_0xf7ef('0x51')]);_0x26bf75[_0xf7ef('0x53')]=intUtil[_0xf7ef('0x52')](_0x26bf75[_0xf7ef('0x53')]);def[_0xf7ef('0x54')]=util['format'](_0xf7ef('0x55'),_0x26bf75[_0xf7ef('0x51')]);if(_0x4dc9a6&&_0x4dc9a6['recordingFormat']&&_0x4dc9a6['recordingFormat']!==_0xf7ef('0x6e')){logger['info'](_0xf7ef('0x6f'),_0xf7ef('0x57'));_0x3b227e[_0xf7ef('0x58')]=util[_0xf7ef('0x28')](_0xf7ef('0x59'),_0x26bf75['serverUrl'],_0x3b227e['uniqueid'],md5(_0x3b227e[_0xf7ef('0x5a')]));}return getConnection(_0x26bf75)['then'](function(_0x53480e){_0x54f64f=_0x53480e;return getUser(_0x26bf75,_0x873d4d['name'],_0x54f64f);})[_0xf7ef('0x2b')](function(_0x54742d){_0x557b04=_0x54742d;logger[_0xf7ef('0x25')](_0xf7ef('0x5b'),_0x557b04['id']);return getEndUser(_0x26bf75,_0x3b227e[_0xf7ef('0x70')],_0x3b227e[_0xf7ef('0x71')],_0x54f64f);})[_0xf7ef('0x2b')](function(_0x1530a3){_0x47158f=_0x1530a3;logger['info'](_0xf7ef('0x5e'),_0x47158f['id']);return getTicket(_0x26bf75,_0x557b04,_0x47158f,_0x10b96b,_0x3b227e,_0x10b96b[_0xf7ef('0x5f')],_0x54f64f,_0xf7ef('0x72'));})['then'](function(_0x5cf8f5){_0x494ba3=_0x5cf8f5;logger[_0xf7ef('0x25')](_0xf7ef('0x73'));logger[_0xf7ef('0x25')](_0xf7ef('0x61'),_0x494ba3['id']);return setRelationship(_0x54f64f,_0x557b04,_0x494ba3,'users');})[_0xf7ef('0x2b')](function(){return setRelationship(_0x54f64f,_0x47158f,_0x494ba3,_0xf7ef('0x63'));})[_0xf7ef('0x2b')](function(){return getServerInfo(_0x54f64f);})[_0xf7ef('0x2b')](function(_0x49b0e3){var _0x170540=parseInt(_0x49b0e3[_0xf7ef('0x64')][_0xf7ef('0x65')](0x0));var _0x2f2a0a=util['format'](_0xf7ef('0x66'),_0x26bf75[_0xf7ef('0x51')],_0x494ba3['id']);if(_0x170540>0x6){_0x2f2a0a=util[_0xf7ef('0x28')](_0xf7ef('0x67'),_0x26bf75[_0xf7ef('0x51')],_0x494ba3['id']);}logger[_0xf7ef('0x25')](_0xf7ef('0x6f'),_0xf7ef('0x68'));emit(util[_0xf7ef('0x28')]('user:%s',_0x873d4d[_0xf7ef('0x18')]),_0xf7ef('0x6a'),{'uri':_0x2f2a0a});})[_0xf7ef('0x6b')](function(_0x5808b8){logger[_0xf7ef('0x6c')](_0xf7ef('0x6f'),JSON['stringify'](_0x5808b8));});};exports[_0xf7ef('0x74')]=function(_0x1c722,_0x259246,_0x2e314b,_0x5ba83a,_0x1acf79,_0x8cacaf){var _0x195840,_0x161d91,_0x4279fb,_0x12b731;_0x8cacaf['remoteUri']=intUtil[_0xf7ef('0x52')](_0x8cacaf[_0xf7ef('0x51')]);_0x8cacaf['serverUrl']=intUtil[_0xf7ef('0x52')](_0x8cacaf[_0xf7ef('0x53')]);def[_0xf7ef('0x54')]=util[_0xf7ef('0x28')](_0xf7ef('0x55'),_0x8cacaf[_0xf7ef('0x51')]);if(_0x1acf79&&_0x1acf79[_0xf7ef('0x75')]){logger['info']('['+_0x259246[_0xf7ef('0x76')][_0xf7ef('0x77')]()+']',_0xf7ef('0x57'));_0x259246[_0xf7ef('0x58')]=util[_0xf7ef('0x28')](_0xf7ef('0x59'),_0x8cacaf[_0xf7ef('0x53')],_0x259246[_0xf7ef('0x5a')],md5(_0x259246['uniqueid']));}else{_0x259246[_0xf7ef('0x58')]='';}return getConnection(_0x8cacaf)[_0xf7ef('0x2b')](function(_0xf2a34c){_0x12b731=_0xf2a34c;if(!_[_0xf7ef('0x24')](_0x5ba83a)){return getUser(_0x8cacaf,_0x5ba83a['name'],_0x12b731);}else{return getUser(_0x8cacaf,null,_0x12b731);}})[_0xf7ef('0x2b')](function(_0x3b2186){_0x195840=_0x3b2186;logger[_0xf7ef('0x25')](_0xf7ef('0x5b'),_0x195840['id']);return getEndUser(_0x8cacaf,_0x259246[_0xf7ef('0x5c')],_0x259246[_0xf7ef('0x5d')],_0x12b731);})[_0xf7ef('0x2b')](function(_0x216d26){_0x161d91=_0x216d26;logger[_0xf7ef('0x25')](_0xf7ef('0x5e'),_0x161d91['id']);return getTicket(_0x8cacaf,_0x195840,_0x161d91,_0x2e314b,_0x259246,_0x2e314b[_0xf7ef('0x5f')],_0x12b731,_0xf7ef('0x60'));})[_0xf7ef('0x2b')](function(_0x109c94){_0x4279fb=_0x109c94;logger[_0xf7ef('0x25')](_0xf7ef('0x73'));logger[_0xf7ef('0x25')](_0xf7ef('0x61'),_0x4279fb['id']);return setRelationship(_0x12b731,_0x195840,_0x4279fb,_0xf7ef('0x62'));})[_0xf7ef('0x2b')](function(){return setRelationship(_0x12b731,_0x161d91,_0x4279fb,_0xf7ef('0x63'));})[_0xf7ef('0x2b')](function(){return getServerInfo(_0x12b731);})[_0xf7ef('0x6b')](function(_0x264c35){logger[_0xf7ef('0x6c')]('['+_0x259246[_0xf7ef('0x76')][_0xf7ef('0x77')]()+']',JSON[_0xf7ef('0x1f')](_0x264c35));});}; \ No newline at end of file +var _0xe558=['defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','assigned_user_id','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','toString','base64','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','Agent\x20found!','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','length','Enduser\x20found!','first_name','','Caller\x20-\x20%s','[HTTP]','merge','map','type','string','nameField','customField','content','idField','variable','customVariable','Variable','toLowerCase','POST','login','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','Outbound','error','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','calleridname','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xe558,0x70));var _0x8e55=function(_0x4f5501,_0xfed08e){_0x4f5501=_0x4f5501-0x0;var _0x240024=_0xe558[_0x4f5501];return _0x240024;};'use strict';var _=require(_0x8e55('0x0'));var rp=require(_0x8e55('0x1'));var BPromise=require(_0x8e55('0x2'));var md5=require(_0x8e55('0x3'));var util=require(_0x8e55('0x4'));var Redis=require(_0x8e55('0x5'));var intUtil=require(_0x8e55('0x6'));var config=require(_0x8e55('0x7'));var logger=require(_0x8e55('0x8'))('sugarcrm');config[_0x8e55('0x9')]=_[_0x8e55('0xa')](config[_0x8e55('0x9')],{'host':_0x8e55('0xb'),'port':0x18eb});var io=require(_0x8e55('0xc'))(new Redis(config[_0x8e55('0x9')]));var def={'method':'POST','json':!![]};function emit(_0xe27f09,_0x429679,_0x59e61d){io['to'](_0xe27f09)[_0x8e55('0xd')](_0x429679,_0x59e61d);}function getTicket(_0x578110,_0x570b31,_0x50966f,_0x531361,_0x5a6168,_0x527ad3,_0x3d07f8,_0x39fa76){logger[_0x8e55('0xe')](_0x8e55('0xf'));var _0x5867c7=new Date();var _0x3b42e5=[{'name':'name','value':intUtil['getString'](_0x531361['Subjects'],_0x5a6168,'\x20')},{'name':_0x8e55('0x10'),'value':_0x570b31['id']},{'name':'created_by','value':_0x570b31['id']},{'name':_0x8e55('0x11'),'value':intUtil[_0x8e55('0x12')](_0x531361[_0x8e55('0x13')],_0x5a6168,'\x0a')},{'name':_0x8e55('0x14'),'value':_0x5867c7[_0x8e55('0x15')]()[_0x8e55('0x16')](0x0,0x13)[_0x8e55('0x17')]('T','\x20')},{'name':_0x8e55('0x18'),'value':'0'},{'name':_0x8e55('0x19'),'value':'15'},{'name':_0x8e55('0x1a'),'value':_0x50966f['id']},{'name':_0x8e55('0x1b'),'value':_0x8e55('0x1c')},{'name':_0x8e55('0x1d'),'value':_0x50966f[_0x8e55('0x1e')]},{'name':_0x8e55('0x1f'),'value':_0x39fa76}];if(_0x527ad3['length']){_[_0x8e55('0x20')](_0x527ad3,function(_0x1e5d1f){if(_0x5a6168[_0x1e5d1f[_0x8e55('0x21')]]){_0x3b42e5[_0x8e55('0x22')]({'name':_0x1e5d1f['idField'],'value':_0x5a6168[_0x1e5d1f[_0x8e55('0x21')]]});}});}return request({'form':{'method':_0x8e55('0x23'),'input_type':_0x8e55('0x24'),'response_type':_0x8e55('0x24'),'rest_data':JSON[_0x8e55('0x25')]({'session':_0x3d07f8['id'],'module_name':_0x8e55('0x26'),'name_value_list':_0x3b42e5})}});}function getAuth(_0x2b7e2e){return util[_0x8e55('0x27')]('Basic\x20%s',new Buffer(_0x2b7e2e['apiKey']+':X')[_0x8e55('0x28')](_0x8e55('0x29')));}function getServerInfo(_0x69d8a7){return request({'form':{'method':'get_server_info','input_type':_0x8e55('0x24'),'response_type':_0x8e55('0x24'),'rest_data':JSON[_0x8e55('0x25')]({'session':_0x69d8a7['id']})}});}function getUser(_0xa9484f,_0x12816e,_0x25a8f3){if(!_['isNil'](_0x12816e)){logger[_0x8e55('0xe')](_0x8e55('0x2a'),_0x12816e);return request({'form':{'method':'get_entry_list','input_type':_0x8e55('0x24'),'response_type':_0x8e55('0x24'),'rest_data':JSON[_0x8e55('0x25')]({'session':_0x25a8f3['id'],'module_name':_0x8e55('0x2b'),'query':util[_0x8e55('0x27')](_0x8e55('0x2c'),_0x12816e),'order_by':'','offset':'0','select_fields':['id',_0x8e55('0x1e'),_0x8e55('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8e55('0x2e')](function(_0x45fedf){if(_0x45fedf[_0x8e55('0x2f')]['length']){var _0xffe6cb=_[_0x8e55('0x30')](_0x45fedf[_0x8e55('0x2f')],function(_0x2a8ccb){return _0x2a8ccb['name_value_list'][_0x8e55('0x2d')]['value']===_0x12816e;});if(_0xffe6cb){logger[_0x8e55('0xe')](_0x8e55('0x31'));return BPromise['resolve']({'id':_0xffe6cb[_0x8e55('0x32')]['id'][_0x8e55('0x33')],'name':_0xffe6cb[_0x8e55('0x32')]['name'][_0x8e55('0x33')]});}}logger[_0x8e55('0xe')](_0x8e55('0x34'));return BPromise[_0x8e55('0x35')]({'id':_0x25a8f3[_0x8e55('0x32')][_0x8e55('0x36')][_0x8e55('0x33')],'name':_0x25a8f3[_0x8e55('0x32')]['user_name']['value']});});}else{logger['info'](_0x8e55('0x37'));return BPromise[_0x8e55('0x35')]({'id':_0x25a8f3[_0x8e55('0x32')]['user_id'][_0x8e55('0x33')],'name':_0x25a8f3['name_value_list']['user_name'][_0x8e55('0x33')]});}}function getEndUser(_0x33c44c,_0x519a3f,_0x260ca1,_0x1a33f1){logger[_0x8e55('0xe')](_0x8e55('0x38'),_0x260ca1);return request({'form':{'method':_0x8e55('0x39'),'input_type':'JSON','response_type':_0x8e55('0x24'),'rest_data':JSON[_0x8e55('0x25')]({'session':_0x1a33f1['id'],'module_name':_0x8e55('0x1c'),'query':util[_0x8e55('0x27')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x260ca1),'order_by':'','offset':'0','select_fields':['id',_0x8e55('0x1e'),_0x8e55('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8e55('0x2e')](function(_0x517048){if(_0x517048[_0x8e55('0x2f')][_0x8e55('0x3b')]){var _0x3690a1=_[_0x8e55('0x30')](_0x517048[_0x8e55('0x2f')],function(_0x117eb8){return _0x117eb8['name_value_list'][_0x8e55('0x3a')][_0x8e55('0x33')]===_0x260ca1;});if(_0x3690a1){logger[_0x8e55('0xe')](_0x8e55('0x3c'));return BPromise[_0x8e55('0x35')]({'id':_0x3690a1[_0x8e55('0x32')]['id']['value'],'name':_0x3690a1[_0x8e55('0x32')][_0x8e55('0x1e')][_0x8e55('0x33')],'phone':_0x3690a1[_0x8e55('0x32')][_0x8e55('0x3a')][_0x8e55('0x33')]});}}else{logger[_0x8e55('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x8e55('0x24'),'response_type':_0x8e55('0x24'),'rest_data':JSON[_0x8e55('0x25')]({'session':_0x1a33f1['id'],'module_name':_0x8e55('0x1c'),'name_value_list':[{'name':_0x8e55('0x3d'),'value':_0x519a3f!==_0x8e55('0x3e')?_0x519a3f:util['format'](_0x8e55('0x3f'),_0x260ca1)},{'name':_0x8e55('0x3a'),'value':_0x260ca1}]})}})[_0x8e55('0x2e')](function(_0x1cd125){logger[_0x8e55('0xe')]('Enduser\x20created.');return BPromise[_0x8e55('0x35')]({'id':_0x1cd125['id'],'name':_0x1cd125['entry_list'][_0x8e55('0x3d')][_0x8e55('0x33')],'phone':_0x1cd125['entry_list'][_0x8e55('0x3a')][_0x8e55('0x33')]});});}});}function request(_0x57b688){logger['debug'](_0x8e55('0x40'),JSON[_0x8e55('0x25')](_0x57b688));return rp(_[_0x8e55('0x41')](def,_0x57b688));}function getTags(_0x1ed422,_0xab4ec5){var _0x20f27f=[];if(_0x1ed422&&_0x1ed422[_0x8e55('0x3b')]>0x0){_0x20f27f=_[_0x8e55('0x42')](_0x1ed422,_0xab4ec5);}return _0x20f27f;}function getCustomFields(_0x1d54b8,_0x18be24){var _0x4bef48=[];var _0x601618={'custom_fields':[]};if(_0x1d54b8[_0x8e55('0x3b')]>0x0){_['forEach'](_0x1d54b8,function(_0x46c0da){if(_0x46c0da[_0x8e55('0x43')]===_0x8e55('0x44')&&_0x46c0da[_0x8e55('0x45')]&&!_0x46c0da[_0x8e55('0x46')]){_0x601618[_0x46c0da['nameField']['toLowerCase']()]=_0x46c0da[_0x8e55('0x47')][_0x8e55('0x28')]();}else if(_0x46c0da[_0x8e55('0x43')]==='string'&&_0x46c0da[_0x8e55('0x48')]&&_0x46c0da['customField']){_0x601618['custom_fields'][_0x8e55('0x22')]({'id':_0x46c0da[_0x8e55('0x48')],'value':_0x46c0da[_0x8e55('0x47')][_0x8e55('0x28')]()});}else if(_0x46c0da[_0x8e55('0x43')]===_0x8e55('0x49')&&_0x46c0da[_0x8e55('0x21')]&&_0x46c0da[_0x8e55('0x48')]&&_0x46c0da['customField']){_0x18be24[_0x46c0da[_0x8e55('0x21')]]&&_0x601618['custom_fields']['push']({'id':_0x46c0da[_0x8e55('0x48')],'value':_0x18be24[_0x46c0da[_0x8e55('0x21')]][_0x8e55('0x28')]()});}else if(_0x46c0da[_0x8e55('0x43')]===_0x8e55('0x4a')&&_0x46c0da[_0x8e55('0x4b')]&&_0x46c0da[_0x8e55('0x4b')][_0x8e55('0x1e')]&&_0x46c0da[_0x8e55('0x48')]&&_0x46c0da[_0x8e55('0x46')]){_0x18be24[_0x46c0da[_0x8e55('0x4b')][_0x8e55('0x1e')][_0x8e55('0x4c')]()]&&_0x601618['custom_fields']['push']({'id':_0x46c0da[_0x8e55('0x48')],'value':_0x18be24[_0x46c0da[_0x8e55('0x4b')][_0x8e55('0x1e')]['toLowerCase']()][_0x8e55('0x28')]()});}});}return _0x601618;}function getConnection(_0x42e2fb){return request({'method':_0x8e55('0x4d'),'form':{'method':_0x8e55('0x4e'),'input_type':_0x8e55('0x24'),'response_type':_0x8e55('0x24'),'rest_data':JSON[_0x8e55('0x25')]({'user_auth':{'user_name':_0x42e2fb[_0x8e55('0x4f')],'password':_0x42e2fb[_0x8e55('0x50')],'encryption':'PLAIN'},'application':_0x8e55('0x51')})}})[_0x8e55('0x2e')](function(_0x329e76){var _0x289ee4=_0x329e76;if(_0x289ee4['id']){def['sessionID']=_0x289ee4['id'];return BPromise[_0x8e55('0x35')](_0x289ee4);}else{throw new Error(util[_0x8e55('0x27')](_0x8e55('0x52'),_0x42e2fb['id']));}});}function setRelationship(_0x474df9,_0x2e2098,_0x47778e,_0x1fbf99){return request({'form':{'method':_0x8e55('0x53'),'input_type':'JSON','response_type':_0x8e55('0x24'),'rest_data':JSON[_0x8e55('0x25')]({'session':_0x474df9['id'],'module_name':'Calls','module_id':_0x47778e['id'],'link_field_name':_0x1fbf99,'related_ids':[_0x2e2098['id']]})}});}exports['queue']=function(_0x9867fa,_0x4e7728,_0x20dabd,_0x3bbf28,_0x3677c4,_0xab6a2a){var _0x193e5a,_0x591f4c,_0x64f2f6,_0x324551;_0xab6a2a[_0x8e55('0x54')]=intUtil[_0x8e55('0x55')](_0xab6a2a[_0x8e55('0x54')]);_0xab6a2a[_0x8e55('0x56')]=intUtil['stripTrailingSlash'](_0xab6a2a[_0x8e55('0x56')]);def[_0x8e55('0x57')]=util['format'](_0x8e55('0x58'),_0xab6a2a['remoteUri']);if(_0x3677c4&&_0x3677c4[_0x8e55('0x59')]){logger[_0x8e55('0xe')](_0x8e55('0x5a'),_0x8e55('0x5b'));_0x4e7728[_0x8e55('0x5c')]=util[_0x8e55('0x27')](_0x8e55('0x5d'),_0xab6a2a[_0x8e55('0x56')],_0x4e7728[_0x8e55('0x5e')],md5(_0x4e7728[_0x8e55('0x5e')]));}else{_0x4e7728[_0x8e55('0x5c')]='';}return getConnection(_0xab6a2a)['then'](function(_0x3d76bd){_0x324551=_0x3d76bd;return getUser(_0xab6a2a,_0x3bbf28['name'],_0x324551);})[_0x8e55('0x2e')](function(_0xecb51c){_0x193e5a=_0xecb51c;logger[_0x8e55('0xe')]('The\x20User\x20ID\x20is:',_0x193e5a['id']);return getEndUser(_0xab6a2a,_0x4e7728['calleridname'],_0x4e7728[_0x8e55('0x5f')],_0x324551);})[_0x8e55('0x2e')](function(_0x194d9f){_0x591f4c=_0x194d9f;logger[_0x8e55('0xe')](_0x8e55('0x60'),_0x591f4c['id']);return getTicket(_0xab6a2a,_0x193e5a,_0x591f4c,_0x20dabd,_0x4e7728,_0x20dabd['Fields'],_0x324551,_0x8e55('0x61'));})[_0x8e55('0x2e')](function(_0x3b3ed4){_0x64f2f6=_0x3b3ed4;logger['info'](_0x8e55('0x62'));logger[_0x8e55('0xe')](_0x8e55('0x63'),_0x64f2f6['id']);return setRelationship(_0x324551,_0x193e5a,_0x64f2f6,_0x8e55('0x64'));})[_0x8e55('0x2e')](function(){return setRelationship(_0x324551,_0x591f4c,_0x64f2f6,_0x8e55('0x65'));})[_0x8e55('0x2e')](function(){return getServerInfo(_0x324551);})['then'](function(_0xb9f1ec){var _0x23d681=parseInt(_0xb9f1ec[_0x8e55('0x66')][_0x8e55('0x67')](0x0));var _0x5f25fd=util[_0x8e55('0x27')](_0x8e55('0x68'),_0xab6a2a['remoteUri'],_0x64f2f6['id']);if(_0x23d681>0x6){_0x5f25fd=util[_0x8e55('0x27')](_0x8e55('0x69'),_0xab6a2a[_0x8e55('0x54')],_0x64f2f6['id']);}logger[_0x8e55('0xe')]('[QUEUE]',_0x8e55('0x6a'));emit(util['format'](_0x8e55('0x6b'),_0x3bbf28[_0x8e55('0x1e')]),_0x8e55('0x6c'),{'uri':_0x5f25fd});})[_0x8e55('0x6d')](function(_0x28da47){logger['error'](_0x8e55('0x5a'),JSON[_0x8e55('0x25')](_0x28da47));});};exports['outbound']=function(_0x5cba04,_0x10f82b,_0x40bc32,_0x3fd1c3,_0x28efd2,_0x4b5bb2,_0x506353){var _0x6dafa7,_0x3de159,_0x5e99e7,_0x21f361;_0x4b5bb2[_0x8e55('0x54')]=intUtil['stripTrailingSlash'](_0x4b5bb2[_0x8e55('0x54')]);_0x4b5bb2[_0x8e55('0x56')]=intUtil[_0x8e55('0x55')](_0x4b5bb2[_0x8e55('0x56')]);def[_0x8e55('0x57')]=util[_0x8e55('0x27')](_0x8e55('0x58'),_0x4b5bb2[_0x8e55('0x54')]);if(_0x506353&&_0x506353[_0x8e55('0x6e')]&&_0x506353[_0x8e55('0x6e')]!==_0x8e55('0x6f')){logger[_0x8e55('0xe')](_0x8e55('0x70'),_0x8e55('0x5b'));_0x10f82b[_0x8e55('0x5c')]=util[_0x8e55('0x27')](_0x8e55('0x5d'),_0x4b5bb2['serverUrl'],_0x10f82b[_0x8e55('0x5e')],md5(_0x10f82b['uniqueid']));}return getConnection(_0x4b5bb2)['then'](function(_0xa1693e){_0x21f361=_0xa1693e;return getUser(_0x4b5bb2,_0x3fd1c3[_0x8e55('0x1e')],_0x21f361);})[_0x8e55('0x2e')](function(_0x30fc1a){_0x6dafa7=_0x30fc1a;logger[_0x8e55('0xe')]('The\x20User\x20ID\x20is:',_0x6dafa7['id']);return getEndUser(_0x4b5bb2,_0x10f82b[_0x8e55('0x71')],_0x10f82b['destcalleridnum'],_0x21f361);})[_0x8e55('0x2e')](function(_0x3026a8){_0x3de159=_0x3026a8;logger[_0x8e55('0xe')](_0x8e55('0x60'),_0x3de159['id']);return getTicket(_0x4b5bb2,_0x6dafa7,_0x3de159,_0x40bc32,_0x10f82b,_0x40bc32[_0x8e55('0x72')],_0x21f361,_0x8e55('0x73'));})['then'](function(_0x231b62){_0x5e99e7=_0x231b62;logger['info'](_0x8e55('0x62'));logger[_0x8e55('0xe')](_0x8e55('0x63'),_0x5e99e7['id']);return setRelationship(_0x21f361,_0x6dafa7,_0x5e99e7,'users');})[_0x8e55('0x2e')](function(){return setRelationship(_0x21f361,_0x3de159,_0x5e99e7,_0x8e55('0x65'));})['then'](function(){return getServerInfo(_0x21f361);})['then'](function(_0x15b756){var _0x3c6fab=parseInt(_0x15b756[_0x8e55('0x66')][_0x8e55('0x67')](0x0));var _0x3f97ac=util[_0x8e55('0x27')](_0x8e55('0x68'),_0x4b5bb2[_0x8e55('0x54')],_0x5e99e7['id']);if(_0x3c6fab>0x6){_0x3f97ac=util[_0x8e55('0x27')](_0x8e55('0x69'),_0x4b5bb2[_0x8e55('0x54')],_0x5e99e7['id']);}logger[_0x8e55('0xe')](_0x8e55('0x70'),_0x8e55('0x6a'));emit(util['format'](_0x8e55('0x6b'),_0x3fd1c3['name']),_0x8e55('0x6c'),{'uri':_0x3f97ac});})[_0x8e55('0x6d')](function(_0x1c7a76){logger[_0x8e55('0x74')]('[OUTBOUND]',JSON[_0x8e55('0x25')](_0x1c7a76));});};exports[_0x8e55('0x75')]=function(_0xb752dc,_0x32720d,_0x4ffaea,_0x2d5a90,_0x40466,_0x2bcab2){var _0x1d705d,_0x59110b,_0xf9e173,_0x2ae7ac;_0x2bcab2['remoteUri']=intUtil[_0x8e55('0x55')](_0x2bcab2['remoteUri']);_0x2bcab2[_0x8e55('0x56')]=intUtil[_0x8e55('0x55')](_0x2bcab2[_0x8e55('0x56')]);def[_0x8e55('0x57')]=util[_0x8e55('0x27')]('%s/service/v4_1/rest.php',_0x2bcab2['remoteUri']);if(_0x40466&&_0x40466[_0x8e55('0x59')]){logger[_0x8e55('0xe')]('['+_0x32720d[_0x8e55('0x76')][_0x8e55('0x77')]()+']',_0x8e55('0x5b'));_0x32720d[_0x8e55('0x5c')]=util[_0x8e55('0x27')](_0x8e55('0x5d'),_0x2bcab2[_0x8e55('0x56')],_0x32720d[_0x8e55('0x5e')],md5(_0x32720d[_0x8e55('0x5e')]));}else{_0x32720d[_0x8e55('0x5c')]='';}return getConnection(_0x2bcab2)[_0x8e55('0x2e')](function(_0xea70c1){_0x2ae7ac=_0xea70c1;if(!_['isNil'](_0x2d5a90)){return getUser(_0x2bcab2,_0x2d5a90[_0x8e55('0x1e')],_0x2ae7ac);}else{return getUser(_0x2bcab2,null,_0x2ae7ac);}})[_0x8e55('0x2e')](function(_0x27ddcd){_0x1d705d=_0x27ddcd;logger['info'](_0x8e55('0x78'),_0x1d705d['id']);return getEndUser(_0x2bcab2,_0x32720d[_0x8e55('0x79')],_0x32720d['calleridnum'],_0x2ae7ac);})['then'](function(_0xf6ec92){_0x59110b=_0xf6ec92;logger[_0x8e55('0xe')](_0x8e55('0x60'),_0x59110b['id']);return getTicket(_0x2bcab2,_0x1d705d,_0x59110b,_0x4ffaea,_0x32720d,_0x4ffaea[_0x8e55('0x72')],_0x2ae7ac,_0x8e55('0x61'));})[_0x8e55('0x2e')](function(_0x5a8004){_0xf9e173=_0x5a8004;logger[_0x8e55('0xe')](_0x8e55('0x62'));logger['info'](_0x8e55('0x63'),_0xf9e173['id']);return setRelationship(_0x2ae7ac,_0x1d705d,_0xf9e173,_0x8e55('0x64'));})['then'](function(){return setRelationship(_0x2ae7ac,_0x59110b,_0xf9e173,_0x8e55('0x65'));})[_0x8e55('0x2e')](function(){return getServerInfo(_0x2ae7ac);})[_0x8e55('0x6d')](function(_0x337ca5){logger[_0x8e55('0x74')]('['+_0x32720d['lastevent'][_0x8e55('0x77')]()+']',JSON[_0x8e55('0x25')](_0x337ca5));});}; \ 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 a4d76a9..be728c0 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 _0xcf77=['lodash','util','getString','length','type','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test'];(function(_0x4bd301,_0x258b94){var _0x3931b3=function(_0x1ed2b0){while(--_0x1ed2b0){_0x4bd301['push'](_0x4bd301['shift']());}};_0x3931b3(++_0x258b94);}(_0xcf77,0xd8));var _0x7cf7=function(_0x380573,_0x5f2c44){_0x380573=_0x380573-0x0;var _0x2c5653=_0xcf77[_0x380573];return _0x2c5653;};'use strict';var _=require(_0x7cf7('0x0'));var util=require(_0x7cf7('0x1'));exports[_0x7cf7('0x2')]=function(_0x4ee8b8,_0xc748a7,_0x58fea1){var _0x7c7c78=[];if(_0x4ee8b8[_0x7cf7('0x3')]>0x0){var _0x4bd725=_['sortBy'](_0x4ee8b8,['id']);for(var _0x1c6282=0x0;_0x1c6282<_0x4bd725[_0x7cf7('0x3')];_0x1c6282++){var _0x28fd04=_0x4bd725[_0x1c6282];if(_0x28fd04[_0x7cf7('0x4')]==='string'){_0x7c7c78[_0x7cf7('0x5')](_0x28fd04[_0x7cf7('0x6')]);}else if(_0x28fd04['type']===_0x7cf7('0x7')&&_0x28fd04[_0x7cf7('0x8')]){_0xc748a7[_0x28fd04[_0x7cf7('0x8')]]&&_0x7c7c78[_0x7cf7('0x5')](_0xc748a7[_0x28fd04[_0x7cf7('0x8')]]['toString']());}else if(_0x28fd04[_0x7cf7('0x4')]===_0x7cf7('0x9')&&_0x28fd04[_0x7cf7('0xa')]&&_0x28fd04['Variable'][_0x7cf7('0xb')]){_0xc748a7[_0x28fd04[_0x7cf7('0xa')]['name']['toLowerCase']()]&&_0x7c7c78['push'](_0xc748a7[_0x28fd04['Variable'][_0x7cf7('0xb')][_0x7cf7('0xc')]()]['toString']());}else if(_0x28fd04[_0x7cf7('0x4')]===_0x7cf7('0xd')){if(_0x28fd04[_0x7cf7('0xe')]===_0x7cf7('0xf')&&_0x28fd04[_0x7cf7('0x10')]){_0x7c7c78[_0x7cf7('0x5')](util[_0x7cf7('0x11')](_0x7cf7('0x12'),_0x28fd04['key'],_0x28fd04[_0x7cf7('0x13')]));}else if(_0x28fd04[_0x7cf7('0xe')]==='variable'&&_0x28fd04[_0x7cf7('0x8')]&&_0x28fd04[_0x7cf7('0x10')]){_0xc748a7[_0x28fd04[_0x7cf7('0x8')]]&&_0x7c7c78[_0x7cf7('0x5')](util[_0x7cf7('0x11')](_0x7cf7('0x12'),_0x28fd04['key'],_0xc748a7[_0x28fd04['variableName']]));}else if(_0x28fd04['keyType']==='customVariable'&&_0x28fd04[_0x7cf7('0xa')]&&_0x28fd04[_0x7cf7('0xa')]['name']&&_0x28fd04[_0x7cf7('0x10')]){_0xc748a7[_0x28fd04['Variable'][_0x7cf7('0xb')][_0x7cf7('0xc')]()]&&_0x7c7c78[_0x7cf7('0x5')](util['format'](_0x7cf7('0x12'),_0x28fd04[_0x7cf7('0x10')],_0xc748a7[_0x28fd04[_0x7cf7('0xa')]['name']['toLowerCase']()]));}}}}return _0x7c7c78[_0x7cf7('0x14')](_0x58fea1);};exports[_0x7cf7('0x15')]=function(_0x2bd7d3){var _0x318c66=_0x2bd7d3[_0x7cf7('0x16')](-0x1);if(_0x318c66==='/'){_0x2bd7d3=_0x2bd7d3[_0x7cf7('0x17')](0x0,_0x2bd7d3[_0x7cf7('0x18')](_0x318c66));}return _0x2bd7d3;};exports['validateEmail']=function(_0x1f608d){if(!_[_0x7cf7('0x19')](_0x1f608d)&&_0x1f608d!==''){var _0x456ee0=/^(([^<>()\[\]\\.,;:\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 _0x456ee0[_0x7cf7('0x1a')](String(_0x1f608d)[_0x7cf7('0xc')]());}else{return![];}}; \ No newline at end of file +var _0xb022=['lastIndexOf','validateEmail','util','getString','length','string','push','content','variable','variableName','type','customVariable','Variable','name','toLowerCase','toString','keyValue','key','format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','slice'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xb022,0x192));var _0x2b02=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb022[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x2b02('0x0'));exports[_0x2b02('0x1')]=function(_0x3fc520,_0x23b7f9,_0x1e04a3){var _0x16af78=[];if(_0x3fc520[_0x2b02('0x2')]>0x0){var _0x54f87d=_['sortBy'](_0x3fc520,['id']);for(var _0x39dbe5=0x0;_0x39dbe5<_0x54f87d['length'];_0x39dbe5++){var _0x52ca9f=_0x54f87d[_0x39dbe5];if(_0x52ca9f['type']===_0x2b02('0x3')){_0x16af78[_0x2b02('0x4')](_0x52ca9f[_0x2b02('0x5')]);}else if(_0x52ca9f['type']===_0x2b02('0x6')&&_0x52ca9f[_0x2b02('0x7')]){_0x23b7f9[_0x52ca9f[_0x2b02('0x7')]]&&_0x16af78[_0x2b02('0x4')](_0x23b7f9[_0x52ca9f['variableName']]['toString']());}else if(_0x52ca9f[_0x2b02('0x8')]===_0x2b02('0x9')&&_0x52ca9f[_0x2b02('0xa')]&&_0x52ca9f[_0x2b02('0xa')][_0x2b02('0xb')]){_0x23b7f9[_0x52ca9f[_0x2b02('0xa')]['name']['toLowerCase']()]&&_0x16af78[_0x2b02('0x4')](_0x23b7f9[_0x52ca9f[_0x2b02('0xa')]['name'][_0x2b02('0xc')]()][_0x2b02('0xd')]());}else if(_0x52ca9f[_0x2b02('0x8')]===_0x2b02('0xe')){if(_0x52ca9f['keyType']===_0x2b02('0x3')&&_0x52ca9f[_0x2b02('0xf')]){_0x16af78[_0x2b02('0x4')](util[_0x2b02('0x10')](_0x2b02('0x11'),_0x52ca9f[_0x2b02('0xf')],_0x52ca9f[_0x2b02('0x12')]));}else if(_0x52ca9f[_0x2b02('0x13')]===_0x2b02('0x6')&&_0x52ca9f[_0x2b02('0x7')]&&_0x52ca9f['key']){_0x23b7f9[_0x52ca9f[_0x2b02('0x7')]]&&_0x16af78[_0x2b02('0x4')](util[_0x2b02('0x10')](_0x2b02('0x11'),_0x52ca9f[_0x2b02('0xf')],_0x23b7f9[_0x52ca9f[_0x2b02('0x7')]]));}else if(_0x52ca9f[_0x2b02('0x13')]==='customVariable'&&_0x52ca9f[_0x2b02('0xa')]&&_0x52ca9f[_0x2b02('0xa')][_0x2b02('0xb')]&&_0x52ca9f[_0x2b02('0xf')]){_0x23b7f9[_0x52ca9f['Variable'][_0x2b02('0xb')][_0x2b02('0xc')]()]&&_0x16af78[_0x2b02('0x4')](util[_0x2b02('0x10')](_0x2b02('0x11'),_0x52ca9f['key'],_0x23b7f9[_0x52ca9f['Variable'][_0x2b02('0xb')][_0x2b02('0xc')]()]));}}}}return _0x16af78[_0x2b02('0x14')](_0x1e04a3);};exports[_0x2b02('0x15')]=function(_0x163ed5){var _0x4ee9b2=_0x163ed5[_0x2b02('0x16')](-0x1);if(_0x4ee9b2==='/'){_0x163ed5=_0x163ed5['substring'](0x0,_0x163ed5[_0x2b02('0x17')](_0x4ee9b2));}return _0x163ed5;};exports[_0x2b02('0x18')]=function(_0x4e7a36){if(!_['isNil'](_0x4e7a36)&&_0x4e7a36!==''){var _0x5d8b62=/^(([^<>()\[\]\\.,;:\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 _0x5d8b62['test'](String(_0x4e7a36)['toLowerCase']());}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 9b719dc..1d4ff6b 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 _0x3999=['query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','error','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','success','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','GET','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','split','unmanaged','monitor_format','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','idField','toString','variableName','name','Variable','toLowerCase','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','create','sessionName','HelpDesk','stringify','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','info','Getting\x20agent\x20with\x20email'];(function(_0x1aab71,_0x1f6360){var _0x3018e2=function(_0x2003bd){while(--_0x2003bd){_0x1aab71['push'](_0x1aab71['shift']());}};_0x3018e2(++_0x1f6360);}(_0x3999,0x109));var _0x9399=function(_0x2105fc,_0x161754){_0x2105fc=_0x2105fc-0x0;var _0x2e1971=_0x3999[_0x2105fc];return _0x2e1971;};'use strict';var _=require(_0x9399('0x0'));var rp=require(_0x9399('0x1'));var BPromise=require(_0x9399('0x2'));var md5=require(_0x9399('0x3'));var util=require(_0x9399('0x4'));var Redis=require(_0x9399('0x5'));var intUtil=require('./util');var config=require(_0x9399('0x6'));var logger=require('../../../../config/logger')(_0x9399('0x7'));config[_0x9399('0x8')]=_[_0x9399('0x9')](config[_0x9399('0x8')],{'host':_0x9399('0xa'),'port':0x18eb});var io=require(_0x9399('0xb'))(new Redis(config['redis']));function emit(_0x100a3d,_0x30bf92,_0x11f03c){io['to'](_0x100a3d)[_0x9399('0xc')](_0x30bf92,_0x11f03c);}function getCustomFields(_0x3a3c9a,_0x49239e){var _0x594cc6={};if(_0x3a3c9a[_0x9399('0xd')]>0x0){_[_0x9399('0xe')](_0x3a3c9a,function(_0x59b20c){if(_0x59b20c[_0x9399('0xf')]==='string'&&_0x59b20c[_0x9399('0x10')]){_0x594cc6[_0x59b20c[_0x9399('0x10')]]=_0x59b20c['content'][_0x9399('0x11')]();}else if(_0x59b20c[_0x9399('0xf')]==='variable'&&_0x59b20c[_0x9399('0x12')]&&_0x59b20c[_0x9399('0x10')]&&_0x49239e[_0x59b20c[_0x9399('0x12')]]){_0x594cc6[_0x59b20c[_0x9399('0x10')]]=_0x49239e[_0x59b20c['variableName']][_0x9399('0x11')]();}else if(_0x59b20c['type']==='customVariable'&&_0x59b20c['Variable']&&_0x59b20c['Variable'][_0x9399('0x13')]&&_0x59b20c[_0x9399('0x10')]&&_0x49239e[_0x59b20c[_0x9399('0x14')]['name'][_0x9399('0x15')]()]){_0x594cc6[_0x59b20c[_0x9399('0x10')]]=_0x49239e[_0x59b20c['Variable'][_0x9399('0x13')][_0x9399('0x15')]()]['toString']();}});}return _0x594cc6;}function createTicket(_0x4ee48f,_0x488bd0,_0x1187a1,_0x68226d,_0x8d687b,_0x4fb0f9,_0x29a042){logger['info'](_0x9399('0x16'));var _0x46ebcf=_[_0x9399('0x17')]({'parent_id':'','assigned_user_id':_0x488bd0['id'],'ticketpriorities':_0x9399('0x18'),'ticketstatus':_0x9399('0x19'),'ticket_title':intUtil[_0x9399('0x1a')](_0x68226d[_0x9399('0x1b')],_0x8d687b,'\x20'),'description':intUtil[_0x9399('0x1a')](_0x68226d[_0x9399('0x1c')],_0x8d687b,'\x0a'),'contact_id':_0x1187a1['id']},getCustomFields(_0x4fb0f9,_0x8d687b));var _0xf2dd1b={'method':_0x9399('0x1d'),'uri':util[_0x9399('0x1e')](_0x9399('0x1f'),_0x4ee48f[_0x9399('0x20')]),'form':{'operation':_0x9399('0x21'),'username':_0x4ee48f['username'],'sessionName':_0x29a042[_0x9399('0x22')],'elementType':_0x9399('0x23'),'element':JSON[_0x9399('0x24')](_0x46ebcf)},'json':!![]};return request(_0xf2dd1b)[_0x9399('0x25')](function(_0x5cd9fc){if(_0x5cd9fc['success']){return BPromise[_0x9399('0x26')]({'id':_0x5cd9fc[_0x9399('0x27')]['id']});}else{throw new Error(util[_0x9399('0x1e')](_0x9399('0x28'),JSON[_0x9399('0x24')](_0x5cd9fc['error'])));}})[_0x9399('0x29')](function(_0x28406c){var _0x15f2d1=_0x28406c[_0x9399('0x2a')]||0x1f4;logger['error'](_0x9399('0x2b'),'createTicket',_0x15f2d1,JSON['stringify'](_0x28406c));});}function getUser(_0x1290fe,_0x2fcc15,_0x42b468){if(intUtil[_0x9399('0x2c')](_0x2fcc15)){logger[_0x9399('0x2d')](_0x9399('0x2e'),_0x2fcc15);return request({'method':'GET','uri':util['format'](_0x9399('0x1f'),_0x1290fe[_0x9399('0x20')]),'qs':{'operation':_0x9399('0x2f'),'username':_0x1290fe[_0x9399('0x30')],'sessionName':_0x42b468[_0x9399('0x22')],'query':util[_0x9399('0x1e')](_0x9399('0x31'),_0x2fcc15)},'json':!![]})['then'](function(_0x5927dc){if(_0x5927dc['success']&&_0x5927dc[_0x9399('0x27')][_0x9399('0xd')]){logger[_0x9399('0x2d')](_0x9399('0x32'));return BPromise[_0x9399('0x26')]({'id':_0x5927dc[_0x9399('0x27')][0x0]['id'],'email':_0x5927dc[_0x9399('0x27')][0x0]['email1'],'name':_0x5927dc['result'][0x0][_0x9399('0x33')]+'\x20'+_0x5927dc[_0x9399('0x27')][_0x9399('0x34')]});}else{logger[_0x9399('0x2d')](_0x9399('0x35'));return BPromise['resolve']({'id':_0x42b468[_0x9399('0x36')],'email':_0x1290fe[_0x9399('0x30')],'name':_0x9399('0x37')});}})[_0x9399('0x29')](function(_0x3d9dc9){var _0x5f1b91=_0x3d9dc9[_0x9399('0x2a')]||0x1f4;logger['error'](_0x9399('0x2b'),_0x9399('0x38'),_0x5f1b91,JSON['stringify'](_0x3d9dc9));});}else{logger[_0x9399('0x2d')](_0x9399('0x35'));return BPromise[_0x9399('0x26')]({'id':_0x42b468[_0x9399('0x36')],'email':_0x1290fe[_0x9399('0x30')],'name':_0x9399('0x37')})[_0x9399('0x29')](function(_0x5e1861){var _0xce2341=_0x5e1861['statusCode']||0x1f4;logger[_0x9399('0x39')](_0x9399('0x2b'),'getUser',_0xce2341,JSON[_0x9399('0x24')](_0x5e1861));});}}function getEndUser(_0x1b174f,_0x20c312,_0x2d1668,_0x3638ce){logger[_0x9399('0x2d')]('Searching\x20end\x20user\x20with\x20phone',_0x2d1668);return request({'method':'GET','uri':util[_0x9399('0x1e')]('%s/webservice.php',_0x1b174f[_0x9399('0x20')]),'qs':{'operation':_0x9399('0x2f'),'username':_0x1b174f[_0x9399('0x30')],'sessionName':_0x3638ce[_0x9399('0x22')],'query':util[_0x9399('0x1e')](_0x9399('0x3a'),_0x2d1668,_0x2d1668,_0x2d1668,_0x2d1668,_0x2d1668)},'json':!![]})[_0x9399('0x25')](function(_0x4cd012){if(_0x4cd012[_0x9399('0x3b')]&&_0x4cd012[_0x9399('0x27')][_0x9399('0xd')]){logger[_0x9399('0x2d')]('Enduser\x20found!');return BPromise[_0x9399('0x26')]({'id':_0x4cd012['result'][0x0]['id'],'name':_0x4cd012[_0x9399('0x27')][0x0][_0x9399('0x3c')]+'\x20'+_0x4cd012[_0x9399('0x27')][0x0][_0x9399('0x3d')],'phone':_0x2d1668});}else{logger['info'](_0x9399('0x3e'));return request({'method':'POST','uri':util[_0x9399('0x1e')](_0x9399('0x1f'),_0x1b174f['remoteUri']),'form':{'operation':_0x9399('0x21'),'sessionName':_0x3638ce[_0x9399('0x22')],'elementType':_0x9399('0x3f'),'element':JSON[_0x9399('0x24')]({'lastname':_0x20c312,'phone':_0x2d1668,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x5e2338){logger[_0x9399('0x2d')](_0x9399('0x40'));return BPromise[_0x9399('0x26')]({'id':_0x5e2338[_0x9399('0x27')]['id'],'name':_0x5e2338[_0x9399('0x27')][_0x9399('0x3d')],'phone':_0x5e2338['result'][_0x9399('0x41')]});})[_0x9399('0x29')](function(_0x468e32){var _0x475bf7=_0x468e32[_0x9399('0x2a')]||0x1f4;logger['error'](_0x9399('0x2b'),_0x9399('0x42'),_0x475bf7,JSON[_0x9399('0x24')](_0x468e32));});}});}function getConnection(_0x3a2496){var _0x361b10=_0x3a2496['username'];var _0xb60e73=_0x3a2496[_0x9399('0x43')];return request({'method':_0x9399('0x44'),'uri':util[_0x9399('0x1e')](_0x9399('0x1f'),_0x3a2496[_0x9399('0x20')]),'qs':{'operation':_0x9399('0x45'),'username':_0x361b10},'json':!![]})[_0x9399('0x25')](function(_0x4f14e6){if(_0x4f14e6[_0x9399('0x3b')]){return request({'method':'POST','uri':util['format'](_0x9399('0x1f'),_0x3a2496['remoteUri']),'form':{'operation':_0x9399('0x46'),'username':_0x361b10,'accessKey':md5(_0x4f14e6[_0x9399('0x27')][_0x9399('0x47')]+_0xb60e73)},'json':!![]});}})[_0x9399('0x25')](function(_0x30ad56){if(_0x30ad56['success']){return BPromise['resolve'](_0x30ad56[_0x9399('0x27')]);}else{throw new Error(util[_0x9399('0x1e')](_0x9399('0x48'),_0x3a2496['id']));}})[_0x9399('0x29')](function(_0x4acd77){var _0x5764dd=_0x4acd77[_0x9399('0x2a')]||0x1f4;logger[_0x9399('0x39')](_0x9399('0x2b'),_0x9399('0x49'),_0x5764dd,JSON[_0x9399('0x24')](_0x4acd77));});}function request(_0x6073d0){logger['info']('[HTTP]',JSON[_0x9399('0x24')](_0x6073d0));return rp(_0x6073d0);}exports[_0x9399('0x4a')]=function(_0x55f3d9,_0x141c0e,_0x3c2605,_0x184d15,_0x16e450,_0x2b044c){var _0xe5faae,_0x2eb190,_0x2d12a6,_0x5d352c;_0x2b044c[_0x9399('0x20')]=intUtil['stripTrailingSlash'](_0x2b044c[_0x9399('0x20')]);if(_0x16e450&&_0x16e450['monitor_format']){logger[_0x9399('0x2d')](_0x9399('0x4b'),_0x9399('0x4c'));_0x141c0e[_0x9399('0x4d')]=util[_0x9399('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b044c['serverUrl'],_0x141c0e['uniqueid'],md5(_0x141c0e[_0x9399('0x4e')]));}else{_0x141c0e[_0x9399('0x4d')]='';}return getConnection(_0x2b044c)[_0x9399('0x25')](function(_0x3a4bb0){_0x5d352c=_0x3a4bb0;return getUser(_0x2b044c,_0x184d15[_0x9399('0x4f')],_0x5d352c);})['then'](function(_0x475441){_0xe5faae=_0x475441;logger[_0x9399('0x2d')](_0x9399('0x50'),_0xe5faae['id']);return getEndUser(_0x2b044c,_0x141c0e[_0x9399('0x51')],_0x141c0e['calleridnum'],_0x5d352c);})[_0x9399('0x25')](function(_0x272054){_0x2eb190=_0x272054;logger['info'](_0x9399('0x52'),_0x2eb190['id']);return createTicket(_0x2b044c,_0xe5faae,_0x2eb190,_0x3c2605,_0x141c0e,_0x3c2605[_0x9399('0x53')],_0x5d352c);})[_0x9399('0x25')](function(_0x3ab33c){_0x2d12a6=_0x3ab33c;logger[_0x9399('0x2d')](_0x9399('0x54'));logger[_0x9399('0x2d')](_0x9399('0x55'),_0x2d12a6['id']);var _0x5dda2f=util[_0x9399('0x1e')](_0x9399('0x56'),_0x2b044c[_0x9399('0x20')],_['split'](_0x2d12a6['id'],'x')[0x1]);logger['info'](_0x9399('0x4b'),_0x9399('0x57'));emit(util[_0x9399('0x1e')](_0x9399('0x58'),_0x184d15[_0x9399('0x13')]),_0x9399('0x59'),{'uri':_0x5dda2f});})[_0x9399('0x29')](function(_0x2df132){logger[_0x9399('0x39')](_0x9399('0x4b'),JSON[_0x9399('0x24')](_0x2df132));});};exports['outbound']=function(_0x1b7db8,_0x51564f,_0x3175f6,_0xc30cea,_0x4e7a94,_0xec811e,_0x35676d){var _0x4e8b97,_0x333eeb,_0x497e83,_0x265db7;_0xec811e['remoteUri']=intUtil[_0x9399('0x5a')](_0xec811e[_0x9399('0x20')]);_0xec811e['serverUrl']=intUtil[_0x9399('0x5a')](_0xec811e[_0x9399('0x5b')]);if(_0x35676d&&_0x35676d[_0x9399('0x5c')]&&_0x35676d[_0x9399('0x5c')]!==_0x9399('0x5d')){logger[_0x9399('0x2d')](_0x9399('0x5e'),'Recording\x20is\x20enabled!');_0x51564f[_0x9399('0x4d')]=util[_0x9399('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xec811e[_0x9399('0x5b')],_0x51564f[_0x9399('0x4e')],md5(_0x51564f[_0x9399('0x4e')]));}return getConnection(_0xec811e)[_0x9399('0x25')](function(_0x3dd204){_0x265db7=_0x3dd204;return getUser(_0xec811e,_0xc30cea[_0x9399('0x4f')],_0x265db7);})[_0x9399('0x25')](function(_0x41beb3){_0x4e8b97=_0x41beb3;logger[_0x9399('0x2d')](_0x9399('0x50'),_0x4e8b97['id']);return getEndUser(_0xec811e,_0x51564f[_0x9399('0x5f')],_0x51564f[_0x9399('0x60')],_0x265db7);})['then'](function(_0x2735a2){_0x333eeb=_0x2735a2;logger['info'](_0x9399('0x52'),_0x333eeb['id']);return createTicket(_0xec811e,_0x4e8b97,_0x333eeb,_0x3175f6,_0x51564f,_0x3175f6[_0x9399('0x53')],_0x265db7);})[_0x9399('0x25')](function(_0x531d39){_0x497e83=_0x531d39;logger['info']('Ticket\x20created!');logger[_0x9399('0x2d')](_0x9399('0x55'),_0x497e83['id']);var _0x452e24=util['format'](_0x9399('0x56'),_0xec811e[_0x9399('0x20')],_[_0x9399('0x61')](_0x497e83['id'],'x')[0x1]);logger[_0x9399('0x2d')](_0x9399('0x5e'),_0x9399('0x57'));emit(util[_0x9399('0x1e')]('user:%s',_0xc30cea[_0x9399('0x13')]),_0x9399('0x59'),{'uri':_0x452e24});})[_0x9399('0x29')](function(_0x2a62c2){logger[_0x9399('0x39')](_0x9399('0x5e'),JSON['stringify'](_0x2a62c2));});};exports[_0x9399('0x62')]=function(_0x32b6f8,_0x9ae64c,_0x2ac1a0,_0xa70b93,_0x598c8c,_0x2c1316){var _0x3a2b27,_0x37f455,_0x3e6bcf,_0x463ec7;_0x2c1316[_0x9399('0x20')]=intUtil['stripTrailingSlash'](_0x2c1316[_0x9399('0x20')]);_0x2c1316['serverUrl']=intUtil[_0x9399('0x5a')](_0x2c1316[_0x9399('0x5b')]);if(_0x598c8c&&_0x598c8c[_0x9399('0x63')]){logger[_0x9399('0x2d')]('['+_0x9ae64c[_0x9399('0x64')][_0x9399('0x65')]()+']',_0x9399('0x4c'));_0x9ae64c[_0x9399('0x4d')]=util[_0x9399('0x1e')](_0x9399('0x66'),_0x2c1316[_0x9399('0x5b')],_0x9ae64c['uniqueid'],md5(_0x9ae64c[_0x9399('0x4e')]));}else{_0x9ae64c['recordingURL']='';}return getConnection(_0x2c1316)[_0x9399('0x25')](function(_0xf7caf7){_0x463ec7=_0xf7caf7;return getUser(_0x2c1316,'',_0x463ec7);})['then'](function(_0x56d4ee){_0x3a2b27=_0x56d4ee;logger[_0x9399('0x2d')](_0x9399('0x50'),_0x3a2b27['id']);return getEndUser(_0x2c1316,_0x9ae64c[_0x9399('0x51')],_0x9ae64c[_0x9399('0x67')],_0x463ec7);})['then'](function(_0x26aa35){_0x37f455=_0x26aa35;logger[_0x9399('0x2d')]('The\x20Enduser\x20ID\x20is:',_0x37f455['id']);return createTicket(_0x2c1316,_0x3a2b27,_0x37f455,_0x2ac1a0,_0x9ae64c,_0x2ac1a0[_0x9399('0x53')],_0x463ec7);})['then'](function(_0x5851e0){_0x3e6bcf=_0x5851e0;logger[_0x9399('0x2d')](_0x9399('0x54'));logger['info'](_0x9399('0x55'),_0x3e6bcf['id']);})[_0x9399('0x29')](function(_0x12e504){logger[_0x9399('0x39')]('['+_0x9ae64c[_0x9399('0x64')][_0x9399('0x65')]()+']',JSON[_0x9399('0x24')](_0x12e504));});}; \ No newline at end of file +var _0xbccb=['then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','email1','first_name','admin','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','getUser','GET','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','lodash','request-promise','bluebird','ioredis','./util','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','string','idField','content','toString','variable','variableName','type','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','username','HelpDesk','stringify'];(function(_0x22f50a,_0x293bae){var _0xc90790=function(_0x16d718){while(--_0x16d718){_0x22f50a['push'](_0x22f50a['shift']());}};_0xc90790(++_0x293bae);}(_0xbccb,0x1d1));var _0xbbcc=function(_0x3480e9,_0x1ce980){_0x3480e9=_0x3480e9-0x0;var _0x389aad=_0xbccb[_0x3480e9];return _0x389aad;};'use strict';var _=require(_0xbbcc('0x0'));var rp=require(_0xbbcc('0x1'));var BPromise=require(_0xbbcc('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0xbbcc('0x3'));var intUtil=require(_0xbbcc('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('vTiger');config[_0xbbcc('0x5')]=_[_0xbbcc('0x6')](config['redis'],{'host':_0xbbcc('0x7'),'port':0x18eb});var io=require(_0xbbcc('0x8'))(new Redis(config[_0xbbcc('0x5')]));function emit(_0x1cdaf9,_0x3340cd,_0x547555){io['to'](_0x1cdaf9)[_0xbbcc('0x9')](_0x3340cd,_0x547555);}function getCustomFields(_0x1f2149,_0x18a8cd){var _0x4baae9={};if(_0x1f2149[_0xbbcc('0xa')]>0x0){_[_0xbbcc('0xb')](_0x1f2149,function(_0x325243){if(_0x325243['type']===_0xbbcc('0xc')&&_0x325243[_0xbbcc('0xd')]){_0x4baae9[_0x325243[_0xbbcc('0xd')]]=_0x325243[_0xbbcc('0xe')][_0xbbcc('0xf')]();}else if(_0x325243['type']===_0xbbcc('0x10')&&_0x325243['variableName']&&_0x325243[_0xbbcc('0xd')]&&_0x18a8cd[_0x325243['variableName']]){_0x4baae9[_0x325243[_0xbbcc('0xd')]]=_0x18a8cd[_0x325243[_0xbbcc('0x11')]][_0xbbcc('0xf')]();}else if(_0x325243[_0xbbcc('0x12')]===_0xbbcc('0x13')&&_0x325243['Variable']&&_0x325243[_0xbbcc('0x14')][_0xbbcc('0x15')]&&_0x325243['idField']&&_0x18a8cd[_0x325243['Variable'][_0xbbcc('0x15')][_0xbbcc('0x16')]()]){_0x4baae9[_0x325243['idField']]=_0x18a8cd[_0x325243[_0xbbcc('0x14')][_0xbbcc('0x15')][_0xbbcc('0x16')]()]['toString']();}});}return _0x4baae9;}function createTicket(_0x2e5231,_0x32a52e,_0x3493ef,_0x240562,_0x436ff4,_0x1c1be4,_0x47bf32){logger['info'](_0xbbcc('0x17'));var _0x5eea02=_[_0xbbcc('0x18')]({'parent_id':'','assigned_user_id':_0x32a52e['id'],'ticketpriorities':'Normal','ticketstatus':_0xbbcc('0x19'),'ticket_title':intUtil[_0xbbcc('0x1a')](_0x240562[_0xbbcc('0x1b')],_0x436ff4,'\x20'),'description':intUtil['getString'](_0x240562[_0xbbcc('0x1c')],_0x436ff4,'\x0a'),'contact_id':_0x3493ef['id']},getCustomFields(_0x1c1be4,_0x436ff4));var _0x352242={'method':_0xbbcc('0x1d'),'uri':util[_0xbbcc('0x1e')](_0xbbcc('0x1f'),_0x2e5231['remoteUri']),'form':{'operation':'create','username':_0x2e5231[_0xbbcc('0x20')],'sessionName':_0x47bf32['sessionName'],'elementType':_0xbbcc('0x21'),'element':JSON[_0xbbcc('0x22')](_0x5eea02)},'json':!![]};return request(_0x352242)[_0xbbcc('0x23')](function(_0x29e20b){if(_0x29e20b[_0xbbcc('0x24')]){return BPromise[_0xbbcc('0x25')]({'id':_0x29e20b['result']['id']});}else{throw new Error(util[_0xbbcc('0x1e')](_0xbbcc('0x26'),JSON['stringify'](_0x29e20b['error'])));}})[_0xbbcc('0x27')](function(_0x258592){var _0x5561ed=_0x258592[_0xbbcc('0x28')]||0x1f4;logger[_0xbbcc('0x29')](_0xbbcc('0x2a'),_0xbbcc('0x2b'),_0x5561ed,JSON[_0xbbcc('0x22')](_0x258592));});}function getUser(_0x3498e0,_0x38451e,_0x57249d){if(intUtil[_0xbbcc('0x2c')](_0x38451e)){logger[_0xbbcc('0x2d')](_0xbbcc('0x2e'),_0x38451e);return request({'method':'GET','uri':util[_0xbbcc('0x1e')]('%s/webservice.php',_0x3498e0['remoteUri']),'qs':{'operation':_0xbbcc('0x2f'),'username':_0x3498e0['username'],'sessionName':_0x57249d[_0xbbcc('0x30')],'query':util['format'](_0xbbcc('0x31'),_0x38451e)},'json':!![]})[_0xbbcc('0x23')](function(_0x5c18dc){if(_0x5c18dc['success']&&_0x5c18dc['result']['length']){logger[_0xbbcc('0x2d')]('Agent\x20found!');return BPromise['resolve']({'id':_0x5c18dc[_0xbbcc('0x32')][0x0]['id'],'email':_0x5c18dc['result'][0x0][_0xbbcc('0x33')],'name':_0x5c18dc[_0xbbcc('0x32')][0x0][_0xbbcc('0x34')]+'\x20'+_0x5c18dc[_0xbbcc('0x32')]['last_name']});}else{logger[_0xbbcc('0x2d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x57249d['userId'],'email':_0x3498e0['username'],'name':_0xbbcc('0x35')});}})[_0xbbcc('0x27')](function(_0x35b379){var _0x6acde0=_0x35b379[_0xbbcc('0x28')]||0x1f4;logger['error'](_0xbbcc('0x2a'),'getUser',_0x6acde0,JSON['stringify'](_0x35b379));});}else{logger['info'](_0xbbcc('0x36'));return BPromise['resolve']({'id':_0x57249d['userId'],'email':_0x3498e0['username'],'name':_0xbbcc('0x35')})[_0xbbcc('0x27')](function(_0x2e8a2e){var _0x140a94=_0x2e8a2e[_0xbbcc('0x28')]||0x1f4;logger[_0xbbcc('0x29')](_0xbbcc('0x2a'),_0xbbcc('0x37'),_0x140a94,JSON[_0xbbcc('0x22')](_0x2e8a2e));});}}function getEndUser(_0xea4772,_0x264b36,_0x317785,_0x203b0b){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x317785);return request({'method':_0xbbcc('0x38'),'uri':util['format'](_0xbbcc('0x1f'),_0xea4772[_0xbbcc('0x39')]),'qs':{'operation':_0xbbcc('0x2f'),'username':_0xea4772[_0xbbcc('0x20')],'sessionName':_0x203b0b[_0xbbcc('0x30')],'query':util['format'](_0xbbcc('0x3a'),_0x317785,_0x317785,_0x317785,_0x317785,_0x317785)},'json':!![]})[_0xbbcc('0x23')](function(_0x5e6041){if(_0x5e6041[_0xbbcc('0x24')]&&_0x5e6041[_0xbbcc('0x32')][_0xbbcc('0xa')]){logger[_0xbbcc('0x2d')](_0xbbcc('0x3b'));return BPromise[_0xbbcc('0x25')]({'id':_0x5e6041[_0xbbcc('0x32')][0x0]['id'],'name':_0x5e6041[_0xbbcc('0x32')][0x0][_0xbbcc('0x3c')]+'\x20'+_0x5e6041['result'][0x0][_0xbbcc('0x3d')],'phone':_0x317785});}else{logger[_0xbbcc('0x2d')](_0xbbcc('0x3e'));return request({'method':'POST','uri':util[_0xbbcc('0x1e')]('%s/webservice.php',_0xea4772[_0xbbcc('0x39')]),'form':{'operation':'create','sessionName':_0x203b0b[_0xbbcc('0x30')],'elementType':'Contacts','element':JSON[_0xbbcc('0x22')]({'lastname':_0x264b36,'phone':_0x317785,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x14d45c){logger[_0xbbcc('0x2d')](_0xbbcc('0x3f'));return BPromise[_0xbbcc('0x25')]({'id':_0x14d45c[_0xbbcc('0x32')]['id'],'name':_0x14d45c[_0xbbcc('0x32')][_0xbbcc('0x3d')],'phone':_0x14d45c['result'][_0xbbcc('0x40')]});})[_0xbbcc('0x27')](function(_0x30ca9d){var _0x1bcb9f=_0x30ca9d[_0xbbcc('0x28')]||0x1f4;logger['error'](_0xbbcc('0x2a'),_0xbbcc('0x41'),_0x1bcb9f,JSON[_0xbbcc('0x22')](_0x30ca9d));});}});}function getConnection(_0x2626b1){var _0x15c83c=_0x2626b1[_0xbbcc('0x20')];var _0x19e86f=_0x2626b1[_0xbbcc('0x42')];return request({'method':_0xbbcc('0x38'),'uri':util['format'](_0xbbcc('0x1f'),_0x2626b1[_0xbbcc('0x39')]),'qs':{'operation':_0xbbcc('0x43'),'username':_0x15c83c},'json':!![]})['then'](function(_0x3d2ec7){if(_0x3d2ec7[_0xbbcc('0x24')]){return request({'method':_0xbbcc('0x1d'),'uri':util[_0xbbcc('0x1e')](_0xbbcc('0x1f'),_0x2626b1[_0xbbcc('0x39')]),'form':{'operation':_0xbbcc('0x44'),'username':_0x15c83c,'accessKey':md5(_0x3d2ec7[_0xbbcc('0x32')][_0xbbcc('0x45')]+_0x19e86f)},'json':!![]});}})[_0xbbcc('0x23')](function(_0x148e48){if(_0x148e48[_0xbbcc('0x24')]){return BPromise[_0xbbcc('0x25')](_0x148e48[_0xbbcc('0x32')]);}else{throw new Error(util['format'](_0xbbcc('0x46'),_0x2626b1['id']));}})[_0xbbcc('0x27')](function(_0x30e904){var _0x2aa3ff=_0x30e904[_0xbbcc('0x28')]||0x1f4;logger[_0xbbcc('0x29')](_0xbbcc('0x2a'),'getConnection',_0x2aa3ff,JSON[_0xbbcc('0x22')](_0x30e904));});}function request(_0x5a58cf){logger['info'](_0xbbcc('0x47'),JSON['stringify'](_0x5a58cf));return rp(_0x5a58cf);}exports[_0xbbcc('0x48')]=function(_0x57c965,_0x11aae2,_0x4a7038,_0x6c27fa,_0x13b48d,_0x4a10c1){var _0x278639,_0x353a86,_0x2724c3,_0x44d0d3;_0x4a10c1[_0xbbcc('0x39')]=intUtil['stripTrailingSlash'](_0x4a10c1[_0xbbcc('0x39')]);if(_0x13b48d&&_0x13b48d[_0xbbcc('0x49')]){logger['info'](_0xbbcc('0x4a'),_0xbbcc('0x4b'));_0x11aae2[_0xbbcc('0x4c')]=util[_0xbbcc('0x1e')](_0xbbcc('0x4d'),_0x4a10c1[_0xbbcc('0x4e')],_0x11aae2[_0xbbcc('0x4f')],md5(_0x11aae2['uniqueid']));}else{_0x11aae2['recordingURL']='';}return getConnection(_0x4a10c1)['then'](function(_0x2d1ac7){_0x44d0d3=_0x2d1ac7;return getUser(_0x4a10c1,_0x6c27fa[_0xbbcc('0x50')],_0x44d0d3);})[_0xbbcc('0x23')](function(_0x1e1d0b){_0x278639=_0x1e1d0b;logger[_0xbbcc('0x2d')](_0xbbcc('0x51'),_0x278639['id']);return getEndUser(_0x4a10c1,_0x11aae2[_0xbbcc('0x52')],_0x11aae2[_0xbbcc('0x53')],_0x44d0d3);})[_0xbbcc('0x23')](function(_0x2c2777){_0x353a86=_0x2c2777;logger['info'](_0xbbcc('0x54'),_0x353a86['id']);return createTicket(_0x4a10c1,_0x278639,_0x353a86,_0x4a7038,_0x11aae2,_0x4a7038[_0xbbcc('0x55')],_0x44d0d3);})[_0xbbcc('0x23')](function(_0x47d065){_0x2724c3=_0x47d065;logger[_0xbbcc('0x2d')](_0xbbcc('0x56'));logger[_0xbbcc('0x2d')]('The\x20Ticket\x20ID\x20is:',_0x2724c3['id']);var _0x13c9fe=util[_0xbbcc('0x1e')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4a10c1[_0xbbcc('0x39')],_['split'](_0x2724c3['id'],'x')[0x1]);logger[_0xbbcc('0x2d')](_0xbbcc('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xbbcc('0x57'),_0x6c27fa[_0xbbcc('0x15')]),_0xbbcc('0x58'),{'uri':_0x13c9fe});})[_0xbbcc('0x27')](function(_0x48fce4){logger['error'](_0xbbcc('0x4a'),JSON[_0xbbcc('0x22')](_0x48fce4));});};exports['outbound']=function(_0x5f51a1,_0x335e3f,_0x111742,_0x47cb5e,_0x577d55,_0x57f6b5,_0xd5f054){var _0x5c3af6,_0x5ef775,_0x1ad839,_0x19040b;_0x57f6b5[_0xbbcc('0x39')]=intUtil[_0xbbcc('0x59')](_0x57f6b5['remoteUri']);_0x57f6b5[_0xbbcc('0x4e')]=intUtil[_0xbbcc('0x59')](_0x57f6b5[_0xbbcc('0x4e')]);if(_0xd5f054&&_0xd5f054['recordingFormat']&&_0xd5f054[_0xbbcc('0x5a')]!==_0xbbcc('0x5b')){logger[_0xbbcc('0x2d')](_0xbbcc('0x5c'),_0xbbcc('0x4b'));_0x335e3f['recordingURL']=util[_0xbbcc('0x1e')](_0xbbcc('0x4d'),_0x57f6b5[_0xbbcc('0x4e')],_0x335e3f['uniqueid'],md5(_0x335e3f[_0xbbcc('0x4f')]));}return getConnection(_0x57f6b5)['then'](function(_0x3a6f9d){_0x19040b=_0x3a6f9d;return getUser(_0x57f6b5,_0x47cb5e[_0xbbcc('0x50')],_0x19040b);})[_0xbbcc('0x23')](function(_0x5333bf){_0x5c3af6=_0x5333bf;logger['info'](_0xbbcc('0x51'),_0x5c3af6['id']);return getEndUser(_0x57f6b5,_0x335e3f['destcalleridname'],_0x335e3f[_0xbbcc('0x5d')],_0x19040b);})[_0xbbcc('0x23')](function(_0x5ddd14){_0x5ef775=_0x5ddd14;logger[_0xbbcc('0x2d')](_0xbbcc('0x54'),_0x5ef775['id']);return createTicket(_0x57f6b5,_0x5c3af6,_0x5ef775,_0x111742,_0x335e3f,_0x111742[_0xbbcc('0x55')],_0x19040b);})[_0xbbcc('0x23')](function(_0x424d2a){_0x1ad839=_0x424d2a;logger['info']('Ticket\x20created!');logger[_0xbbcc('0x2d')](_0xbbcc('0x5e'),_0x1ad839['id']);var _0x217b92=util['format'](_0xbbcc('0x5f'),_0x57f6b5['remoteUri'],_[_0xbbcc('0x60')](_0x1ad839['id'],'x')[0x1]);logger[_0xbbcc('0x2d')]('[OUTBOUND]',_0xbbcc('0x61'));emit(util[_0xbbcc('0x1e')]('user:%s',_0x47cb5e[_0xbbcc('0x15')]),_0xbbcc('0x58'),{'uri':_0x217b92});})['catch'](function(_0x42274b){logger[_0xbbcc('0x29')]('[OUTBOUND]',JSON[_0xbbcc('0x22')](_0x42274b));});};exports['unmanaged']=function(_0x5d7849,_0x4ad99a,_0x54ef7f,_0x285fcd,_0x241261,_0xde426b){var _0x4509dc,_0x34445a,_0x524239,_0x3d3406;_0xde426b[_0xbbcc('0x39')]=intUtil[_0xbbcc('0x59')](_0xde426b[_0xbbcc('0x39')]);_0xde426b[_0xbbcc('0x4e')]=intUtil[_0xbbcc('0x59')](_0xde426b[_0xbbcc('0x4e')]);if(_0x241261&&_0x241261[_0xbbcc('0x49')]){logger[_0xbbcc('0x2d')]('['+_0x4ad99a[_0xbbcc('0x62')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4ad99a[_0xbbcc('0x4c')]=util[_0xbbcc('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xde426b[_0xbbcc('0x4e')],_0x4ad99a[_0xbbcc('0x4f')],md5(_0x4ad99a[_0xbbcc('0x4f')]));}else{_0x4ad99a[_0xbbcc('0x4c')]='';}return getConnection(_0xde426b)[_0xbbcc('0x23')](function(_0xa77a1){_0x3d3406=_0xa77a1;return getUser(_0xde426b,'',_0x3d3406);})[_0xbbcc('0x23')](function(_0x32d033){_0x4509dc=_0x32d033;logger[_0xbbcc('0x2d')](_0xbbcc('0x51'),_0x4509dc['id']);return getEndUser(_0xde426b,_0x4ad99a[_0xbbcc('0x52')],_0x4ad99a[_0xbbcc('0x53')],_0x3d3406);})['then'](function(_0x4fade6){_0x34445a=_0x4fade6;logger[_0xbbcc('0x2d')](_0xbbcc('0x54'),_0x34445a['id']);return createTicket(_0xde426b,_0x4509dc,_0x34445a,_0x54ef7f,_0x4ad99a,_0x54ef7f[_0xbbcc('0x55')],_0x3d3406);})[_0xbbcc('0x23')](function(_0x3af235){_0x524239=_0x3af235;logger['info'](_0xbbcc('0x56'));logger[_0xbbcc('0x2d')]('The\x20Ticket\x20ID\x20is:',_0x524239['id']);})[_0xbbcc('0x27')](function(_0x13a6da){logger[_0xbbcc('0x29')]('['+_0x4ad99a['lastevent'][_0xbbcc('0x63')]()+']',JSON[_0xbbcc('0x22')](_0x13a6da));});}; \ 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 c81ac04..30cff20 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 _0x00b3=['[HTTP]','stringify','GET','map','forEach','type','string','customField','nameField','content','idField','custom_fields','push','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]','newTab','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','zendesk','defaults','redis','localhost','socket.io-emitter','application/json','info','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','user','authType','password','%s:%s','token','username','Basic\x20%s','toString','base64','debug'];(function(_0xe34971,_0x3b35e3){var _0x58694=function(_0x5c3c78){while(--_0x5c3c78){_0xe34971['push'](_0xe34971['shift']());}};_0x58694(++_0x3b35e3);}(_0x00b3,0x17a));var _0x300b=function(_0x3630bb,_0x131ccb){_0x3630bb=_0x3630bb-0x0;var _0x532530=_0x00b3[_0x3630bb];return _0x532530;};'use strict';var _=require('lodash');var rp=require(_0x300b('0x0'));var md5=require(_0x300b('0x1'));var util=require(_0x300b('0x2'));var Redis=require(_0x300b('0x3'));var intUtil=require('./util');var config=require(_0x300b('0x4'));var logger=require('../../../../config/logger')(_0x300b('0x5'));config['redis']=_[_0x300b('0x6')](config[_0x300b('0x7')],{'host':_0x300b('0x8'),'port':0x18eb});var io=require(_0x300b('0x9'))(new Redis(config['redis']));function emit(_0x5dabb9,_0x30b3fe,_0x590c4d){io['to'](_0x5dabb9)['emit'](_0x30b3fe,_0x590c4d);}var headers={'Content-Type':_0x300b('0xa'),'Accept':_0x300b('0xa')};function getTicket(_0x457aa3,_0x4d8d78,_0x42e5a5,_0x3d907e,_0x243abf){logger[_0x300b('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x300b('0xc')](_0x300b('0xd'),_0x457aa3[_0x300b('0xe')]),'method':'POST','body':{'ticket':_[_0x300b('0xf')]({'requester_id':_0x42e5a5['id'],'submitter_id':_0x4d8d78?_0x4d8d78['id']:undefined,'assignee_id':_0x4d8d78?_0x4d8d78['id']:undefined,'tags':getTags(_0x3d907e[_0x300b('0x10')],_0x300b('0x11')),'subject':intUtil[_0x300b('0x12')](_0x3d907e[_0x300b('0x13')],_0x243abf,'\x20'),'description':intUtil[_0x300b('0x12')](_0x3d907e[_0x300b('0x14')],_0x243abf,'\x0a'),'comment':{'public':![],'body':intUtil[_0x300b('0x12')](_0x3d907e['Descriptions'],_0x243abf,'\x0a')}},getCustomFields(_0x3d907e['Fields'],_0x243abf))}})['then'](function(_0x4ef5bc){logger[_0x300b('0xb')](_0x300b('0x15'));return _0x4ef5bc[_0x300b('0x16')];});}function getUser(_0xd252fa,_0x51186d){if(intUtil['validateEmail'](_0x51186d)){logger[_0x300b('0xb')](_0x300b('0x17'),_0x51186d);return request({'uri':util[_0x300b('0xc')](_0x300b('0x18'),_0xd252fa['remoteUri']),'qs':{'query':util[_0x300b('0xc')](_0x300b('0x19'),_0x51186d)}})[_0x300b('0x1a')](function(_0x5cba7c){if(_0x5cba7c[_0x300b('0x1b')]){logger[_0x300b('0xb')](_0x300b('0x1c'));return _[_0x300b('0x1d')](_0x5cba7c['results'],{'email':_0x51186d,'role':_0x300b('0x1e')});}else{logger[_0x300b('0xb')](_0x300b('0x1f'));return request({'uri':util['format'](_0x300b('0x20'),_0xd252fa[_0x300b('0xe')])})[_0x300b('0x1a')](function(_0x502c5f){logger[_0x300b('0xb')]('Admin\x20account\x20selected.');return _0x502c5f['user'];});}});}else{logger[_0x300b('0xb')](_0x300b('0x1f'));return request({'uri':util[_0x300b('0xc')](_0x300b('0x20'),_0xd252fa[_0x300b('0xe')])})[_0x300b('0x1a')](function(_0x36b66b){logger[_0x300b('0xb')](_0x300b('0x21'));return _0x36b66b['user'];});}}function getEndUser(_0x3d62b1,_0x152048,_0x260bdc){logger[_0x300b('0xb')]('Searching\x20enduser\x20with\x20phone',_0x260bdc);return request({'uri':util['format']('%s/search.json',_0x3d62b1[_0x300b('0xe')]),'qs':{'query':util['format'](_0x300b('0x22'),_0x260bdc)}})[_0x300b('0x1a')](function(_0x60bb0c){var _0x30b260;if(_0x60bb0c[_0x300b('0x23')][_0x300b('0x24')]){_0x60bb0c[_0x300b('0x23')]=_[_0x300b('0x25')](_0x60bb0c[_0x300b('0x23')],{'suspended':![],'role':_0x300b('0x26')});if(_0x60bb0c['results']['length']){_0x30b260=_[_0x300b('0x27')](_0x60bb0c[_0x300b('0x23')]);}}if(_0x30b260){logger[_0x300b('0xb')](_0x300b('0x28'));return _0x30b260;}else{logger['info'](_0x300b('0x29'));return request({'uri':util['format']('%s/users.json',_0x3d62b1['remoteUri']),'method':_0x300b('0x2a'),'body':{'user':{'role':_0x300b('0x26'),'name':util['format'](_0x300b('0x2b'),_0x152048||_0x260bdc),'phone':_0x260bdc}}})[_0x300b('0x1a')](function(_0x4f3cbf){logger[_0x300b('0xb')]('Enduser\x20created.');return _0x4f3cbf[_0x300b('0x2c')];});}});}function getAuth(_0x2572c7){var _0xdad35f;if(_0x2572c7[_0x300b('0x2d')]===_0x300b('0x2e')){_0xdad35f=util[_0x300b('0xc')](_0x300b('0x2f'),_0x2572c7['username'],_0x2572c7[_0x300b('0x2e')]);}else if(_0x2572c7['authType']===_0x300b('0x30')){_0xdad35f=util[_0x300b('0xc')]('%s/token:%s',_0x2572c7[_0x300b('0x31')],_0x2572c7[_0x300b('0x30')]);}return util['format'](_0x300b('0x32'),new Buffer(_0xdad35f)[_0x300b('0x33')](_0x300b('0x34')));}function request(_0x534874){logger[_0x300b('0x35')](_0x300b('0x36'),JSON[_0x300b('0x37')](_0x534874));return rp(_[_0x300b('0x6')](_0x534874,{'method':_0x300b('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x2c2d06,_0x2004ae){var _0x56ee6b=[];if(_0x2c2d06&&_0x2c2d06[_0x300b('0x24')]>0x0){_0x56ee6b=_[_0x300b('0x39')](_0x2c2d06,_0x2004ae);}return _0x56ee6b;}function getCustomFields(_0x5a4d5a,_0x3364e5){var _0x5dc5e2=[];var _0x5987da={'custom_fields':[]};if(_0x5a4d5a[_0x300b('0x24')]>0x0){_[_0x300b('0x3a')](_0x5a4d5a,function(_0x295789){if(_0x295789[_0x300b('0x3b')]===_0x300b('0x3c')&&_0x295789['nameField']&&!_0x295789[_0x300b('0x3d')]){_0x5987da[_0x295789[_0x300b('0x3e')]['toLowerCase']()]=_0x295789[_0x300b('0x3f')]['toString']();}else if(_0x295789[_0x300b('0x3b')]===_0x300b('0x3c')&&_0x295789[_0x300b('0x40')]&&_0x295789[_0x300b('0x3d')]){_0x5987da[_0x300b('0x41')][_0x300b('0x42')]({'id':_0x295789[_0x300b('0x40')],'value':_0x295789[_0x300b('0x3f')][_0x300b('0x33')]()});}else if(_0x295789[_0x300b('0x3b')]===_0x300b('0x43')&&_0x295789['variableName']&&_0x295789['idField']&&_0x295789[_0x300b('0x3d')]){_0x3364e5[_0x295789['variableName']]&&_0x5987da['custom_fields'][_0x300b('0x42')]({'id':_0x295789[_0x300b('0x40')],'value':_0x3364e5[_0x295789[_0x300b('0x44')]]['toString']()});}else if(_0x295789[_0x300b('0x3b')]==='customVariable'&&_0x295789['Variable']&&_0x295789[_0x300b('0x45')][_0x300b('0x11')]&&_0x295789['idField']&&_0x295789[_0x300b('0x3d')]){_0x3364e5[_0x295789[_0x300b('0x45')]['name'][_0x300b('0x46')]()]&&_0x5987da[_0x300b('0x41')]['push']({'id':_0x295789[_0x300b('0x40')],'value':_0x3364e5[_0x295789[_0x300b('0x45')][_0x300b('0x11')][_0x300b('0x46')]()][_0x300b('0x33')]()});}});}return _0x5987da;}exports[_0x300b('0x47')]=function(_0x219a24,_0x3c6897,_0x4ee62f,_0x5a1fdf,_0x1b38ee,_0x58aa0b){var _0x554130,_0x3379cb;_0x58aa0b[_0x300b('0xe')]=intUtil[_0x300b('0x48')](_0x58aa0b[_0x300b('0xe')]);_0x58aa0b[_0x300b('0x49')]=intUtil[_0x300b('0x48')](_0x58aa0b['serverUrl']);if(_0x1b38ee&&_0x1b38ee[_0x300b('0x4a')]){logger['info']('[QUEUE]',_0x300b('0x4b'));_0x3c6897[_0x300b('0x4c')]=util['format'](_0x300b('0x4d'),_0x58aa0b[_0x300b('0x49')],_0x3c6897[_0x300b('0x4e')],md5(_0x3c6897[_0x300b('0x4e')]));}else{_0x3c6897['recordingURL']='';}headers[_0x300b('0x4f')]=getAuth(_0x58aa0b);return getUser(_0x58aa0b,_0x5a1fdf[_0x300b('0x50')])['then'](function(_0x4279f4){_0x554130=_0x4279f4;logger[_0x300b('0xb')](_0x300b('0x51'),_0x554130['id']);return getEndUser(_0x58aa0b,_0x3c6897['calleridname'],_0x3c6897[_0x300b('0x52')]);})[_0x300b('0x1a')](function(_0x22a1a9){_0x3379cb=_0x22a1a9;logger[_0x300b('0xb')](_0x300b('0x53'),_0x3379cb['id']);return getTicket(_0x58aa0b,_0x554130,_0x3379cb,_0x4ee62f,_0x3c6897);})[_0x300b('0x1a')](function(_0x418ac3){if(_0x418ac3){logger[_0x300b('0xb')](_0x300b('0x54'),_0x418ac3['id']);switch(_0x58aa0b[_0x300b('0x3b')]){case _0x300b('0x55'):logger[_0x300b('0xb')](_0x300b('0x56'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x300b('0x57'),_0x58aa0b[_0x300b('0xe')],_0x554130['id'],_0x418ac3['id']),'method':_0x300b('0x2a')});case'newTab':logger[_0x300b('0xb')]('[QUEUE]',_0x300b('0x58'));emit(util[_0x300b('0xc')]('user:%s',_0x5a1fdf[_0x300b('0x11')]),_0x300b('0x59'),{'uri':util[_0x300b('0xc')](_0x300b('0x5a'),_0x58aa0b['remoteUri'],_0x418ac3['id'])});break;default:logger[_0x300b('0x5b')]('[QUEUE]',_0x300b('0x5c'));}}})[_0x300b('0x5d')](function(_0x1307ef){logger[_0x300b('0x5b')](_0x300b('0x5e'),util[_0x300b('0x5f')](_0x1307ef,{'showHidden':!![],'depth':null}));});};exports[_0x300b('0x60')]=function(_0x178f82,_0x101acb,_0x1927a7,_0x873b9a,_0x1d6672,_0x24822b,_0x26235c){var _0x545255,_0x35c20d;_0x24822b[_0x300b('0xe')]=intUtil['stripTrailingSlash'](_0x24822b['remoteUri']);_0x24822b[_0x300b('0x49')]=intUtil[_0x300b('0x48')](_0x24822b[_0x300b('0x49')]);if(_0x26235c&&_0x26235c[_0x300b('0x61')]&&_0x26235c[_0x300b('0x61')]!==_0x300b('0x62')){logger[_0x300b('0xb')]('[OUTBOUND]',_0x300b('0x4b'));_0x101acb[_0x300b('0x4c')]=util['format'](_0x300b('0x4d'),_0x24822b['serverUrl'],_0x101acb[_0x300b('0x4e')],md5(_0x101acb[_0x300b('0x4e')]));}headers[_0x300b('0x4f')]=getAuth(_0x24822b);return getUser(_0x24822b,_0x873b9a['email'])[_0x300b('0x1a')](function(_0x3abd98){_0x545255=_0x3abd98;logger[_0x300b('0xb')](_0x300b('0x51'),_0x545255['id']);return getEndUser(_0x24822b,_0x101acb['destcalleridname'],_0x101acb[_0x300b('0x63')]);})['then'](function(_0x18b763){_0x35c20d=_0x18b763;logger[_0x300b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x35c20d['id']);return getTicket(_0x24822b,_0x545255,_0x35c20d,_0x1927a7,_0x101acb);})[_0x300b('0x1a')](function(_0x3f8b6b){if(_0x3f8b6b){logger[_0x300b('0xb')]('The\x20Ticket\x20ID\x20is:',_0x3f8b6b['id']);switch(_0x24822b[_0x300b('0x3b')]){case _0x300b('0x55'):logger['info'](_0x300b('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x300b('0xc')](_0x300b('0x57'),_0x24822b[_0x300b('0xe')],_0x545255['id'],_0x3f8b6b['id']),'method':_0x300b('0x2a')});case _0x300b('0x65'):logger[_0x300b('0xb')](_0x300b('0x64'),_0x300b('0x58'));emit(util[_0x300b('0xc')](_0x300b('0x66'),_0x873b9a[_0x300b('0x11')]),_0x300b('0x59'),{'uri':util[_0x300b('0xc')](_0x300b('0x5a'),_0x24822b[_0x300b('0xe')],_0x3f8b6b['id'])});break;default:logger[_0x300b('0x5b')](_0x300b('0x64'),_0x300b('0x5c'));}}})[_0x300b('0x5d')](function(_0x105e1e){logger[_0x300b('0x5b')](_0x300b('0x67'),util[_0x300b('0x5f')](_0x105e1e,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x260a85,_0x5022d5,_0x1db494,_0x157d8e,_0x2680e0,_0x44d9e2){var _0x3757be,_0x267c39;_0x44d9e2[_0x300b('0xe')]=intUtil[_0x300b('0x48')](_0x44d9e2['remoteUri']);_0x44d9e2[_0x300b('0x49')]=intUtil['stripTrailingSlash'](_0x44d9e2['serverUrl']);if(_0x2680e0&&_0x2680e0[_0x300b('0x4a')]){logger[_0x300b('0xb')]('['+_0x5022d5[_0x300b('0x68')][_0x300b('0x69')]()+']',_0x300b('0x4b'));_0x5022d5['recordingURL']=util[_0x300b('0xc')](_0x300b('0x4d'),_0x44d9e2[_0x300b('0x49')],_0x5022d5[_0x300b('0x4e')],md5(_0x5022d5[_0x300b('0x4e')]));}else{_0x5022d5[_0x300b('0x4c')]='';}headers[_0x300b('0x4f')]=getAuth(_0x44d9e2);return getUser(_0x44d9e2)['then'](function(_0x26b055){_0x3757be=_0x26b055;logger[_0x300b('0xb')](_0x300b('0x51'),_0x3757be['id']);return getEndUser(_0x44d9e2,_0x5022d5[_0x300b('0x6a')],_0x5022d5[_0x300b('0x52')]);})[_0x300b('0x1a')](function(_0x1be4e1){_0x267c39=_0x1be4e1;logger[_0x300b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x267c39['id']);return getTicket(_0x44d9e2,_0x3757be,_0x267c39,_0x1db494,_0x5022d5);})['then'](function(_0xd9b444){if(_0xd9b444){logger[_0x300b('0xb')](_0x300b('0x54'),_0xd9b444['id']);}})[_0x300b('0x5d')](function(_0x132eea){logger[_0x300b('0x5b')]('['+_0x5022d5[_0x300b('0x68')][_0x300b('0x69')]()+']'+_0x300b('0x6b'),util[_0x300b('0x5f')](_0x132eea,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf109=['error','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','Ticket\x20created!','validateEmail','format','%s/search.json','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','toString','base64','debug','stringify','GET','map','forEach','string','nameField','customField','content','type','idField','custom_fields','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','[OUTBOUND]','email','destcalleridnum','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase'];(function(_0x4e6a81,_0x589ac5){var _0x1041dd=function(_0x13efad){while(--_0x13efad){_0x4e6a81['push'](_0x4e6a81['shift']());}};_0x1041dd(++_0x589ac5);}(_0xf109,0xce));var _0x9f10=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xf109[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x9f10('0x0'));var rp=require(_0x9f10('0x1'));var md5=require(_0x9f10('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x9f10('0x3'));var logger=require(_0x9f10('0x4'))(_0x9f10('0x5'));config[_0x9f10('0x6')]=_[_0x9f10('0x7')](config[_0x9f10('0x6')],{'host':_0x9f10('0x8'),'port':0x18eb});var io=require(_0x9f10('0x9'))(new Redis(config[_0x9f10('0x6')]));function emit(_0x2a877e,_0x3fd82f,_0x5c8719){io['to'](_0x2a877e)[_0x9f10('0xa')](_0x3fd82f,_0x5c8719);}var headers={'Content-Type':_0x9f10('0xb'),'Accept':_0x9f10('0xb')};function getTicket(_0x1bde2e,_0x325f22,_0x5d5f53,_0x318776,_0x18995b){logger[_0x9f10('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x9f10('0xd'),_0x1bde2e[_0x9f10('0xe')]),'method':_0x9f10('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x5d5f53['id'],'submitter_id':_0x325f22?_0x325f22['id']:undefined,'assignee_id':_0x325f22?_0x325f22['id']:undefined,'tags':getTags(_0x318776[_0x9f10('0x10')],_0x9f10('0x11')),'subject':intUtil[_0x9f10('0x12')](_0x318776['Subjects'],_0x18995b,'\x20'),'description':intUtil[_0x9f10('0x12')](_0x318776[_0x9f10('0x13')],_0x18995b,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x318776[_0x9f10('0x13')],_0x18995b,'\x0a')}},getCustomFields(_0x318776[_0x9f10('0x14')],_0x18995b))}})['then'](function(_0x59bcad){logger[_0x9f10('0xc')](_0x9f10('0x15'));return _0x59bcad['ticket'];});}function getUser(_0x11154b,_0x5ae255){if(intUtil[_0x9f10('0x16')](_0x5ae255)){logger[_0x9f10('0xc')]('Getting\x20agent\x20with\x20email',_0x5ae255);return request({'uri':util[_0x9f10('0x17')](_0x9f10('0x18'),_0x11154b['remoteUri']),'qs':{'query':util[_0x9f10('0x17')]('type:user\x20role:agent\x20email:%s',_0x5ae255)}})[_0x9f10('0x19')](function(_0x51ce03){if(_0x51ce03[_0x9f10('0x1a')]){logger['info']('Agent\x20found!');return _[_0x9f10('0x1b')](_0x51ce03[_0x9f10('0x1c')],{'email':_0x5ae255,'role':_0x9f10('0x1d')});}else{logger[_0x9f10('0xc')](_0x9f10('0x1e'));return request({'uri':util[_0x9f10('0x17')](_0x9f10('0x1f'),_0x11154b['remoteUri'])})[_0x9f10('0x19')](function(_0x58e6ba){logger[_0x9f10('0xc')](_0x9f10('0x20'));return _0x58e6ba[_0x9f10('0x21')];});}});}else{logger['info'](_0x9f10('0x1e'));return request({'uri':util[_0x9f10('0x17')](_0x9f10('0x1f'),_0x11154b['remoteUri'])})[_0x9f10('0x19')](function(_0x37e9ac){logger[_0x9f10('0xc')]('Admin\x20account\x20selected.');return _0x37e9ac[_0x9f10('0x21')];});}}function getEndUser(_0x23c2e7,_0x11cae7,_0x1647c0){logger['info']('Searching\x20enduser\x20with\x20phone',_0x1647c0);return request({'uri':util['format'](_0x9f10('0x18'),_0x23c2e7['remoteUri']),'qs':{'query':util[_0x9f10('0x17')](_0x9f10('0x22'),_0x1647c0)}})[_0x9f10('0x19')](function(_0x2ed95b){var _0x2e11b1;if(_0x2ed95b['results'][_0x9f10('0x23')]){_0x2ed95b[_0x9f10('0x1c')]=_[_0x9f10('0x24')](_0x2ed95b[_0x9f10('0x1c')],{'suspended':![],'role':_0x9f10('0x25')});if(_0x2ed95b[_0x9f10('0x1c')]['length']){_0x2e11b1=_[_0x9f10('0x26')](_0x2ed95b[_0x9f10('0x1c')]);}}if(_0x2e11b1){logger[_0x9f10('0xc')](_0x9f10('0x27'));return _0x2e11b1;}else{logger['info'](_0x9f10('0x28'));return request({'uri':util[_0x9f10('0x17')](_0x9f10('0x29'),_0x23c2e7['remoteUri']),'method':_0x9f10('0xf'),'body':{'user':{'role':'end-user','name':util[_0x9f10('0x17')](_0x9f10('0x2a'),_0x11cae7||_0x1647c0),'phone':_0x1647c0}}})[_0x9f10('0x19')](function(_0x5944e5){logger[_0x9f10('0xc')](_0x9f10('0x2b'));return _0x5944e5[_0x9f10('0x21')];});}});}function getAuth(_0x11f128){var _0x148a5b;if(_0x11f128['authType']===_0x9f10('0x2c')){_0x148a5b=util['format'](_0x9f10('0x2d'),_0x11f128[_0x9f10('0x2e')],_0x11f128[_0x9f10('0x2c')]);}else if(_0x11f128[_0x9f10('0x2f')]===_0x9f10('0x30')){_0x148a5b=util[_0x9f10('0x17')]('%s/token:%s',_0x11f128[_0x9f10('0x2e')],_0x11f128[_0x9f10('0x30')]);}return util[_0x9f10('0x17')]('Basic\x20%s',new Buffer(_0x148a5b)[_0x9f10('0x31')](_0x9f10('0x32')));}function request(_0x4c89fd){logger[_0x9f10('0x33')]('[HTTP]',JSON[_0x9f10('0x34')](_0x4c89fd));return rp(_[_0x9f10('0x7')](_0x4c89fd,{'method':_0x9f10('0x35'),'headers':headers,'json':!![]}));}function getTags(_0xc17ea2,_0x20605a){var _0x1ba4be=[];if(_0xc17ea2&&_0xc17ea2[_0x9f10('0x23')]>0x0){_0x1ba4be=_[_0x9f10('0x36')](_0xc17ea2,_0x20605a);}return _0x1ba4be;}function getCustomFields(_0x536841,_0x36b1e2){var _0x622030=[];var _0x2fa4bf={'custom_fields':[]};if(_0x536841['length']>0x0){_[_0x9f10('0x37')](_0x536841,function(_0x193b59){if(_0x193b59['type']===_0x9f10('0x38')&&_0x193b59[_0x9f10('0x39')]&&!_0x193b59[_0x9f10('0x3a')]){_0x2fa4bf[_0x193b59['nameField']['toLowerCase']()]=_0x193b59[_0x9f10('0x3b')][_0x9f10('0x31')]();}else if(_0x193b59[_0x9f10('0x3c')]===_0x9f10('0x38')&&_0x193b59[_0x9f10('0x3d')]&&_0x193b59[_0x9f10('0x3a')]){_0x2fa4bf[_0x9f10('0x3e')][_0x9f10('0x3f')]({'id':_0x193b59[_0x9f10('0x3d')],'value':_0x193b59[_0x9f10('0x3b')][_0x9f10('0x31')]()});}else if(_0x193b59[_0x9f10('0x3c')]==='variable'&&_0x193b59['variableName']&&_0x193b59['idField']&&_0x193b59[_0x9f10('0x3a')]){_0x36b1e2[_0x193b59['variableName']]&&_0x2fa4bf[_0x9f10('0x3e')][_0x9f10('0x3f')]({'id':_0x193b59[_0x9f10('0x3d')],'value':_0x36b1e2[_0x193b59['variableName']][_0x9f10('0x31')]()});}else if(_0x193b59[_0x9f10('0x3c')]===_0x9f10('0x40')&&_0x193b59[_0x9f10('0x41')]&&_0x193b59[_0x9f10('0x41')]['name']&&_0x193b59['idField']&&_0x193b59['customField']){_0x36b1e2[_0x193b59[_0x9f10('0x41')]['name'][_0x9f10('0x42')]()]&&_0x2fa4bf['custom_fields'][_0x9f10('0x3f')]({'id':_0x193b59[_0x9f10('0x3d')],'value':_0x36b1e2[_0x193b59[_0x9f10('0x41')][_0x9f10('0x11')]['toLowerCase']()][_0x9f10('0x31')]()});}});}return _0x2fa4bf;}exports[_0x9f10('0x43')]=function(_0x571101,_0x3a5705,_0x2a7d5e,_0x3c64a9,_0x1bd37c,_0x1b3529){var _0x3b3002,_0x4bedbe;_0x1b3529[_0x9f10('0xe')]=intUtil[_0x9f10('0x44')](_0x1b3529[_0x9f10('0xe')]);_0x1b3529['serverUrl']=intUtil[_0x9f10('0x44')](_0x1b3529[_0x9f10('0x45')]);if(_0x1bd37c&&_0x1bd37c['monitor_format']){logger[_0x9f10('0xc')](_0x9f10('0x46'),_0x9f10('0x47'));_0x3a5705[_0x9f10('0x48')]=util['format'](_0x9f10('0x49'),_0x1b3529[_0x9f10('0x45')],_0x3a5705[_0x9f10('0x4a')],md5(_0x3a5705[_0x9f10('0x4a')]));}else{_0x3a5705[_0x9f10('0x48')]='';}headers[_0x9f10('0x4b')]=getAuth(_0x1b3529);return getUser(_0x1b3529,_0x3c64a9['email'])[_0x9f10('0x19')](function(_0x3760d0){_0x3b3002=_0x3760d0;logger[_0x9f10('0xc')](_0x9f10('0x4c'),_0x3b3002['id']);return getEndUser(_0x1b3529,_0x3a5705[_0x9f10('0x4d')],_0x3a5705[_0x9f10('0x4e')]);})['then'](function(_0x3ec147){_0x4bedbe=_0x3ec147;logger[_0x9f10('0xc')](_0x9f10('0x4f'),_0x4bedbe['id']);return getTicket(_0x1b3529,_0x3b3002,_0x4bedbe,_0x2a7d5e,_0x3a5705);})[_0x9f10('0x19')](function(_0x39dae3){if(_0x39dae3){logger[_0x9f10('0xc')](_0x9f10('0x50'),_0x39dae3['id']);switch(_0x1b3529[_0x9f10('0x3c')]){case'integrationTab':logger[_0x9f10('0xc')]('[QUEUE]',_0x9f10('0x51'));return request({'uri':util['format'](_0x9f10('0x52'),_0x1b3529[_0x9f10('0xe')],_0x3b3002['id'],_0x39dae3['id']),'method':_0x9f10('0xf')});case _0x9f10('0x53'):logger[_0x9f10('0xc')]('[QUEUE]',_0x9f10('0x54'));emit(util[_0x9f10('0x17')](_0x9f10('0x55'),_0x3c64a9[_0x9f10('0x11')]),'trigger:browser:url',{'uri':util['format'](_0x9f10('0x56'),_0x1b3529[_0x9f10('0xe')],_0x39dae3['id'])});break;default:logger['error']('[QUEUE]',_0x9f10('0x57'));}}})[_0x9f10('0x58')](function(_0x23369b){logger['error'](_0x9f10('0x59'),util[_0x9f10('0x5a')](_0x23369b,{'showHidden':!![],'depth':null}));});};exports[_0x9f10('0x5b')]=function(_0x4c3d18,_0x37ae9c,_0x2adb6c,_0xe18852,_0x48a76e,_0x229671,_0x401623){var _0x5f180f,_0x2a99fa;_0x229671[_0x9f10('0xe')]=intUtil[_0x9f10('0x44')](_0x229671[_0x9f10('0xe')]);_0x229671[_0x9f10('0x45')]=intUtil['stripTrailingSlash'](_0x229671[_0x9f10('0x45')]);if(_0x401623&&_0x401623['recordingFormat']&&_0x401623['recordingFormat']!==_0x9f10('0x5c')){logger[_0x9f10('0xc')](_0x9f10('0x5d'),_0x9f10('0x47'));_0x37ae9c[_0x9f10('0x48')]=util[_0x9f10('0x17')](_0x9f10('0x49'),_0x229671['serverUrl'],_0x37ae9c['uniqueid'],md5(_0x37ae9c[_0x9f10('0x4a')]));}headers[_0x9f10('0x4b')]=getAuth(_0x229671);return getUser(_0x229671,_0xe18852[_0x9f10('0x5e')])[_0x9f10('0x19')](function(_0x2625ca){_0x5f180f=_0x2625ca;logger[_0x9f10('0xc')](_0x9f10('0x4c'),_0x5f180f['id']);return getEndUser(_0x229671,_0x37ae9c['destcalleridname'],_0x37ae9c[_0x9f10('0x5f')]);})[_0x9f10('0x19')](function(_0x5a777a){_0x2a99fa=_0x5a777a;logger[_0x9f10('0xc')](_0x9f10('0x4f'),_0x2a99fa['id']);return getTicket(_0x229671,_0x5f180f,_0x2a99fa,_0x2adb6c,_0x37ae9c);})['then'](function(_0x407c4d){if(_0x407c4d){logger[_0x9f10('0xc')]('The\x20Ticket\x20ID\x20is:',_0x407c4d['id']);switch(_0x229671[_0x9f10('0x3c')]){case'integrationTab':logger[_0x9f10('0xc')](_0x9f10('0x5d'),_0x9f10('0x51'));return request({'uri':util[_0x9f10('0x17')](_0x9f10('0x52'),_0x229671['remoteUri'],_0x5f180f['id'],_0x407c4d['id']),'method':_0x9f10('0xf')});case _0x9f10('0x53'):logger[_0x9f10('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9f10('0x17')](_0x9f10('0x55'),_0xe18852[_0x9f10('0x11')]),_0x9f10('0x60'),{'uri':util[_0x9f10('0x17')](_0x9f10('0x56'),_0x229671[_0x9f10('0xe')],_0x407c4d['id'])});break;default:logger['error'](_0x9f10('0x5d'),_0x9f10('0x57'));}}})['catch'](function(_0xb0f5e9){logger['error'](_0x9f10('0x61'),util[_0x9f10('0x5a')](_0xb0f5e9,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3f669c,_0x4cbe80,_0x24a518,_0x25b3e2,_0x163165,_0x58e266){var _0x35bfbd,_0x53e320;_0x58e266[_0x9f10('0xe')]=intUtil[_0x9f10('0x44')](_0x58e266[_0x9f10('0xe')]);_0x58e266['serverUrl']=intUtil[_0x9f10('0x44')](_0x58e266['serverUrl']);if(_0x163165&&_0x163165['monitor_format']){logger[_0x9f10('0xc')]('['+_0x4cbe80[_0x9f10('0x62')][_0x9f10('0x63')]()+']','Recording\x20is\x20enabled!');_0x4cbe80[_0x9f10('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58e266[_0x9f10('0x45')],_0x4cbe80['uniqueid'],md5(_0x4cbe80['uniqueid']));}else{_0x4cbe80[_0x9f10('0x48')]='';}headers['Authorization']=getAuth(_0x58e266);return getUser(_0x58e266)[_0x9f10('0x19')](function(_0x9f6f4b){_0x35bfbd=_0x9f6f4b;logger[_0x9f10('0xc')]('The\x20User\x20ID\x20is:',_0x35bfbd['id']);return getEndUser(_0x58e266,_0x4cbe80[_0x9f10('0x4d')],_0x4cbe80[_0x9f10('0x4e')]);})['then'](function(_0x2941dc){_0x53e320=_0x2941dc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x53e320['id']);return getTicket(_0x58e266,_0x35bfbd,_0x53e320,_0x24a518,_0x4cbe80);})[_0x9f10('0x19')](function(_0x3a5032){if(_0x3a5032){logger[_0x9f10('0xc')](_0x9f10('0x50'),_0x3a5032['id']);}})[_0x9f10('0x58')](function(_0x9688a7){logger[_0x9f10('0x64')]('['+_0x4cbe80['lastevent'][_0x9f10('0x63')]()+']'+_0x9f10('0x65'),util[_0x9f10('0x5a')](_0x9688a7,{'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 6a9e7b7..6208708 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 _0x928c=['outbound','agentcalledAt','Call_Type','merge','/crm/v2/Calls','data','SUCCESS','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','user:%s','unmanaged','toUpperCase','lastevent','lodash','util','./util','moment','bluebird','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','variableName','toString','name','toLowerCase','Variable','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','then','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','GET','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','info','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','https://www.zohoapis.','moduleCreate','role','first_name','last_name','code','startCase','Error:\x20','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time'];(function(_0x3e18a2,_0x13f7d3){var _0xf40647=function(_0x1e69f3){while(--_0x1e69f3){_0x3e18a2['push'](_0x3e18a2['shift']());}};_0xf40647(++_0x13f7d3);}(_0x928c,0x157));var _0xc928=function(_0xf8f265,_0x55bff6){_0xf8f265=_0xf8f265-0x0;var _0x23065e=_0x928c[_0xf8f265];return _0x23065e;};'use strict';var _=require(_0xc928('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xc928('0x1'));var intUtil=require(_0xc928('0x2'));var moment=require(_0xc928('0x3'));var Redis=require('ioredis');var BPromise=require(_0xc928('0x4'));var config=require('../../../../config/environment');var logger=require(_0xc928('0x5'))('zoho');config[_0xc928('0x6')]=_[_0xc928('0x7')](config[_0xc928('0x6')],{'host':_0xc928('0x8'),'port':0x18eb});var io=require(_0xc928('0x9'))(new Redis(config[_0xc928('0x6')]));function emit(_0x19ec0a,_0x37a526,_0x324647){io['to'](_0x19ec0a)['emit'](_0x37a526,_0x324647);}function request(_0x470b11){logger[_0xc928('0xa')](_0xc928('0xb'),JSON[_0xc928('0xc')](_0x470b11));return rp(_0x470b11);}function getCustomFields(_0x271c64,_0x5f1a87){var _0x36d82a={};if(_0x271c64[_0xc928('0xd')]>0x0){_[_0xc928('0xe')](_0x271c64,function(_0x49d3d1){if(_0x49d3d1[_0xc928('0xf')]===_0xc928('0x10')&&_0x49d3d1[_0xc928('0x11')]){_0x36d82a[_0x49d3d1['idField']]=_0x49d3d1[_0xc928('0x12')]['toString']();}else if(_0x49d3d1[_0xc928('0xf')]==='variable'&&_0x49d3d1[_0xc928('0x13')]&&_0x49d3d1['idField']&&_0x5f1a87[_0x49d3d1[_0xc928('0x13')]]){_0x36d82a[_0x49d3d1[_0xc928('0x11')]]=_0x5f1a87[_0x49d3d1['variableName']][_0xc928('0x14')]();}else if(_0x49d3d1[_0xc928('0xf')]==='customVariable'&&_0x49d3d1['Variable']&&_0x49d3d1['Variable'][_0xc928('0x15')]&&_0x49d3d1[_0xc928('0x11')]&&_0x5f1a87[_0x49d3d1['Variable'][_0xc928('0x15')][_0xc928('0x16')]()]){_0x36d82a[_0x49d3d1[_0xc928('0x11')]]=_0x5f1a87[_0x49d3d1[_0xc928('0x17')][_0xc928('0x15')]['toLowerCase']()][_0xc928('0x14')]();}});}return _0x36d82a;}function getName(_0x25915f){if(_0x25915f[_0xc928('0x18')]('\x20')>0x0){var _0x382260=_0x25915f[_0xc928('0x19')](/ (.+)/);if(_0x382260[0x1]){return _0x382260;}}return[_0x25915f,_0x25915f];}var accountsTokens={};function getAccessToken(_0x45bba7){return new Promise(function(_0x115a2d,_0x5914e7){if(!_[_0xc928('0x1a')](accountsTokens[_0x45bba7['id']])&&!_[_0xc928('0x1a')](accountsTokens[_0x45bba7['id']][_0xc928('0x1b')])){if(moment()[_0xc928('0x1c')](accountsTokens[_0x45bba7['id']]['expires_in'])){_0x115a2d(accountsTokens[_0x45bba7['id']][_0xc928('0x1b')]);}}var _0x71b3c6;switch(_0x45bba7[_0xc928('0x1d')]){case'US':_0x71b3c6=_0xc928('0x1e');break;case'AU':_0x71b3c6=_0xc928('0x1f');break;case'EU':_0x71b3c6=_0xc928('0x20');break;case'IN':_0x71b3c6=_0xc928('0x21');break;case'CN':_0x71b3c6='https://accounts.zoho.com.cn';break;default:_0x71b3c6=_0xc928('0x20');break;}var _0x4c62ca={'method':'POST','uri':_0x71b3c6+_0xc928('0x22'),'qs':{'refresh_token':_0x45bba7['refreshToken'],'client_id':_0x45bba7['clientId'],'client_secret':_0x45bba7['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4c62ca)[_0xc928('0x23')](function(_0x2fa322){accountsTokens[_0x45bba7['id']]={'access_token':_0x2fa322[_0xc928('0x1b')],'expires_in':moment()['add'](_0x2fa322[_0xc928('0x24')],_0xc928('0x25'))};_0x115a2d(_0x2fa322[_0xc928('0x1b')]);})[_0xc928('0x26')](function(_0x4aefcd){logger[_0xc928('0x27')](_0xc928('0x28'),_0x4aefcd[_0xc928('0x29')]);_0x5914e7(_0x4aefcd);});});}function getUser(_0xe972f8,_0x5e8d90,_0x470fe6,_0x346c0b){logger['info']('Search\x20user');return request({'method':_0xc928('0x2a'),'uri':util[_0xc928('0x2b')]('https://www.zohoapis.%s/crm/v2/users',_0x5e8d90),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xc928('0x2c')+_0xe972f8},'json':!![]})[_0xc928('0x23')](function(_0x1fd467){if(_0x1fd467[_0xc928('0x2d')]){var _0x543407=-0x1;if(_[_0xc928('0x2e')](_0x1fd467[_0xc928('0x2d')])){if(!_[_0xc928('0x1a')](_0x346c0b)){_0x543407=_[_0xc928('0x2f')](_0x1fd467[_0xc928('0x2d')],function(_0x33291f){return _0x33291f[_0xc928('0x30')]===_0x346c0b;});}if(_0x543407>=0x0){logger['info'](_0xc928('0x31'));}else{logger[_0xc928('0x32')](_0xc928('0x33'));_0x543407=_[_0xc928('0x2f')](_0x1fd467[_0xc928('0x2d')],function(_0x2439c0){return _0x2439c0['profile'][_0xc928('0x15')]==='Administrator';});}return _0x1fd467[_0xc928('0x2d')][_0x543407];}else{if(_0x1fd467['user']['profile'][_0xc928('0x15')]===_0xc928('0x34')){logger[_0xc928('0x32')](_0xc928('0x33'));user=_0x1fd467[_0xc928('0x35')];return user;}else{logger[_0xc928('0x27')](_0xc928('0x36'),JSON[_0xc928('0xc')](_0x1fd467));throw new Error(_0xc928('0x37')+JSON[_0xc928('0xc')](_0x1fd467));}}}else{logger['error'](_0xc928('0x36'),JSON[_0xc928('0xc')](_0x1fd467));throw new Error(_0xc928('0x37')+JSON[_0xc928('0xc')](_0x1fd467));}})[_0xc928('0x26')](function(_0x461fb3){console[_0xc928('0x27')](_0x461fb3);});}function getZohoUser(_0x2f3f69,_0x3da9b4){return new BPromise(function(_0x4f9346,_0xe13bba){request(_0x2f3f69)[_0xc928('0x23')](function(_0x7ce9dd){var _0x8fdf73=null;if(_0x7ce9dd){_0x8fdf73=_0x7ce9dd['data'][0x0];_0x8fdf73[_0xc928('0x38')]=_0x3da9b4;}_0x4f9346(_0x8fdf73);})[_0xc928('0x26')](function(_0x3600f5){_0xe13bba(_0x3600f5);});});}function createEndUser(_0x1c104a,_0x26dc40,_0x4f0d6b,_0x5c9a72,_0x1f7d37,_0x5aafcb){var _0x4f0d6b=getName(_0x4f0d6b);return request({'method':_0xc928('0x39'),'uri':_0xc928('0x3a')+_0x26dc40+'/crm/v2/'+_['startCase'](_0x5aafcb[_0xc928('0x3b')])+'s','body':{'data':[{'Last_Name':_0x4f0d6b[0x1],'First_Name':_0x4f0d6b[0x0],'Phone':_0x5c9a72,'Owner':{'name':!_[_0xc928('0x1a')](_0x1f7d37[_0xc928('0x3c')][_0xc928('0x15')])?_0x1f7d37[_0xc928('0x3c')][_0xc928('0x15')]:!_[_0xc928('0x1a')](_0x1f7d37[_0xc928('0x3d')])?_0x1f7d37[_0xc928('0x3d')]+'\x20'+_0x1f7d37['last_name']:_0x1f7d37[_0xc928('0x3e')],'id':_0x1f7d37['id']}}]},'headers':{'Authorization':_0xc928('0x2c')+_0x1c104a},'json':!![]})[_0xc928('0x23')](function(_0x191978){if(_0x191978&&_0x191978['data'][0x0][_0xc928('0x3f')]==='SUCCESS'){var _0x47cf52=_0x191978['data'][0x0]['details'];_0x47cf52['enduserType']=_[_0xc928('0x40')](_0x5aafcb[_0xc928('0x3b')])+'s';return _0x47cf52;}logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xc928('0x41')+JSON[_0xc928('0xc')](data));})['catch'](function(_0x4a5e83){console['log']('CREATE\x20ERROR',_0x4a5e83);});}function getEndUser(_0x2fc074,_0x52a13a,_0x4cc620,_0x498bef,_0x31ef73,_0x16fccf,_0x2a5c04){var _0x5b47b7={'method':_0xc928('0x2a'),'uri':'','headers':{'Authorization':_0xc928('0x2c')+_0x2fc074},'json':!![]};switch(_0x2a5c04[_0xc928('0x42')]){case _0xc928('0x43'):_0x5b47b7[_0xc928('0x44')]='https://www.zohoapis.'+_0x52a13a+_0xc928('0x45')+_0x31ef73+'))';return getZohoUser(_0x5b47b7,'Contacts')['then'](function(_0xce28e){if(_0xce28e)return _0xce28e;_0x5b47b7[_0xc928('0x44')]=_0xc928('0x3a')+_0x52a13a+_0xc928('0x46')+_0x31ef73+'))';return getZohoUser(_0x5b47b7,_0xc928('0x47'))[_0xc928('0x23')](function(_0x64c1a){if(_0x64c1a)return _0x64c1a;if(_0x2a5c04[_0xc928('0x3b')]!=_0xc928('0x48')){return createEndUser(_0x2fc074,_0x52a13a,_0x498bef,_0x31ef73,_0x16fccf,_0x2a5c04);}else{return{};}});});break;case _0xc928('0x49'):_0x5b47b7['uri']=_0xc928('0x3a')+_0x52a13a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x31ef73+'))';return getZohoUser(_0x5b47b7,_0xc928('0x4a'))[_0xc928('0x23')](function(_0x59a9b8){if(_0x59a9b8)return _0x59a9b8;if(_0x2a5c04['moduleCreate']!=_0xc928('0x48')){return createEndUser(_0x2fc074,_0x52a13a,_0x498bef,_0x31ef73,_0x16fccf,_0x2a5c04);}else{return{};}});break;case _0xc928('0x4b'):_0x5b47b7[_0xc928('0x44')]=_0xc928('0x3a')+_0x52a13a+_0xc928('0x46')+_0x31ef73+'))';return getZohoUser(_0x5b47b7,'Leads')[_0xc928('0x23')](function(_0x42d32e){if(_0x42d32e)return _0x42d32e;if(_0x2a5c04[_0xc928('0x3b')]!=_0xc928('0x48')){return createEndUser(_0x2fc074,_0x52a13a,_0x498bef,_0x31ef73,_0x16fccf,_0x2a5c04);}else{return{};}});break;}}function getCall(_0x10a8c2,_0x1590a2,_0x325a82,_0x461b48,_0x5b8c9a,_0x2ca473,_0x17ac77,_0x1fe1c7){logger[_0xc928('0x32')](_0xc928('0x4c'));var _0x21f189={};_0x21f189[_0xc928('0x4d')]={'name':!_[_0xc928('0x1a')](_0x461b48[_0xc928('0x3c')]['name'])&&!_[_0xc928('0x1a')](_0x461b48[_0xc928('0x4e')][_0xc928('0x15')])&&_0x461b48[_0xc928('0x4e')][_0xc928('0x15')]===_0xc928('0x4f')?_0x461b48[_0xc928('0x3c')]['name']:!_[_0xc928('0x1a')](_0x461b48[_0xc928('0x3d')])?_0x461b48[_0xc928('0x3d')]+'\x20'+_0x461b48['last_name']:_0x461b48[_0xc928('0x3e')],'id':_0x461b48['id']};_0x21f189[_0xc928('0x50')]=intUtil[_0xc928('0x51')](_0x2ca473[_0xc928('0x52')],_0x17ac77,'\x20');_0x21f189[_0xc928('0x53')]=intUtil[_0xc928('0x51')](_0x2ca473[_0xc928('0x54')],_0x17ac77,'\x0a');if(_0x5b8c9a[_0xc928('0x38')]===_0xc928('0x4a')){_0x21f189[_0xc928('0x55')]={'name':!_['isNil'](_0x5b8c9a[_0xc928('0x56')])?_0x5b8c9a[_0xc928('0x56')]:!_['isNil'](_0x5b8c9a[_0xc928('0x57')])?_0x5b8c9a[_0xc928('0x57')]+'\x20'+_0x5b8c9a[_0xc928('0x58')]:_0x5b8c9a['Last_Name'],'id':_0x5b8c9a['id']};}if(_0x5b8c9a[_0xc928('0x38')]===_0xc928('0x47')){_0x21f189[_0xc928('0x59')]={'name':!_[_0xc928('0x1a')](_0x5b8c9a[_0xc928('0x56')])?_0x5b8c9a[_0xc928('0x56')]:!_[_0xc928('0x1a')](_0x5b8c9a[_0xc928('0x57')])?_0x5b8c9a[_0xc928('0x57')]+'\x20'+_0x5b8c9a[_0xc928('0x58')]:_0x5b8c9a[_0xc928('0x58')],'id':_0x5b8c9a['id']};_0x21f189[_0xc928('0x5a')]=_[_0xc928('0x40')](_0x5b8c9a[_0xc928('0x38')]);}if(_0x17ac77[_0xc928('0x5b')]){_0x21f189[_0xc928('0x5c')]=moment[_0xc928('0x5d')](parseInt(_0x17ac77['talktime'])*0x3e8)[_0xc928('0x2b')](_0xc928('0x5e'));}else if(_0x17ac77[_0xc928('0x5f')]&&_0x17ac77[_0xc928('0x60')]){_0x21f189[_0xc928('0x5c')]=moment[_0xc928('0x5d')](moment(_0x17ac77['endtime'],_0xc928('0x61'))[_0xc928('0x62')](moment(_0x17ac77[_0xc928('0x63')],_0xc928('0x61'))))[_0xc928('0x2b')]('mm:ss');}switch(_0x17ac77['lastevent']){case _0xc928('0x64'):_0x21f189[_0xc928('0x65')]='Called';break;case'complete':case _0xc928('0x66'):_0x21f189[_0xc928('0x65')]='Answered';break;case _0xc928('0x67'):_0x21f189[_0xc928('0x65')]=_0xc928('0x68');break;case _0xc928('0x69'):_0x21f189[_0xc928('0x65')]=_0xc928('0x6a');break;case _0xc928('0x6b'):_0x21f189[_0xc928('0x65')]=_0xc928('0x6c');default:}_0x21f189[_0xc928('0x6d')]=(_0x1fe1c7===_0xc928('0x6e')?moment(_0x17ac77['starttime'])[_0xc928('0x2b')](_0xc928('0x61')):moment(_0x17ac77[_0xc928('0x6f')])['format'](_0xc928('0x61')))||moment()[_0xc928('0x2b')]('YYYY-MM-DDTHH:mm:ss');_0x21f189[_0xc928('0x70')]=_0x1fe1c7||'Inbound';_0x21f189=_[_0xc928('0x71')](_0x21f189,getCustomFields(_0x2ca473['Fields'],_0x17ac77));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x1590a2+_0xc928('0x72'),'headers':{'Authorization':_0xc928('0x2c')+_0x10a8c2},'body':{'data':[_0x21f189]},'json':!![]})[_0xc928('0x23')](function(_0x3c9902){if(_0x3c9902&&_0x3c9902[_0xc928('0x73')][0x0][_0xc928('0x3f')]===_0xc928('0x74')){logger[_0xc928('0x32')]('Call\x20created!');return{'id':_0x3c9902[_0xc928('0x73')][0x0]['details']['id']};}})['catch'](function(_0xb28164){logger['info'](_0xc928('0x75'),_0xb28164[_0xc928('0x29')]);console[_0xc928('0x76')](_0xc928('0x75'),_0xb28164);});}exports[_0xc928('0x77')]=function(_0x3a028d,_0x4ce645,_0x52294d,_0x5e5dcf,_0x4afb3c,_0x231c70){var _0x56eec4,_0x465951,_0x57d19c;_0x231c70[_0xc928('0x78')]=intUtil[_0xc928('0x79')](_0x231c70[_0xc928('0x78')]);_0x231c70[_0xc928('0x7a')]=intUtil['stripTrailingSlash'](_0x231c70['serverUrl']);if(_0x4afb3c&&_0x4afb3c[_0xc928('0x7b')]){logger[_0xc928('0x32')]('[QUEUE]',_0xc928('0x7c'));_0x4ce645['recordingURL']=_0x231c70['serverUrl']+_0xc928('0x7d')+_0x4ce645[_0xc928('0x7e')]+_0xc928('0x7f')+md5(_0x4ce645[_0xc928('0x7e')]);}else{_0x4ce645[_0xc928('0x80')]='';}var _0x4e3d96=_0x231c70[_0xc928('0x78')]===_0xc928('0x81')?'eu':'com';return getAccessToken(_0x231c70)[_0xc928('0x23')](function(_0x3d0ca6){_0x57d19c=_0x3d0ca6;return getUser(_0x57d19c,_0x4e3d96,_0x231c70,_0x5e5dcf[_0xc928('0x30')]);})[_0xc928('0x23')](function(_0x485f78){_0x56eec4=_0x485f78;logger[_0xc928('0x32')]('The\x20User\x20ID\x20is:',_0x56eec4['id']);return getEndUser(_0x57d19c,_0x4e3d96,_0x231c70,_0x4ce645[_0xc928('0x82')],_0x4ce645[_0xc928('0x83')],_0x56eec4,_0x52294d);})[_0xc928('0x23')](function(_0x4a0c76){_0x465951=_0x4a0c76;return getCall(_0x57d19c,_0x4e3d96,_0x231c70,_0x56eec4,_0x465951,_0x52294d,_0x4ce645,_0xc928('0x84'));})[_0xc928('0x23')](function(_0x2aa3d8){if(_0x2aa3d8){logger[_0xc928('0x32')](_0xc928('0x85'),_0x2aa3d8['id']);logger[_0xc928('0x32')](_0xc928('0x86'),_0xc928('0x87'));emit(util[_0xc928('0x2b')]('user:%s',_0x5e5dcf[_0xc928('0x15')]),_0xc928('0x88'),{'uri':_0xc928('0x89')+_0x231c70['host']+_0xc928('0x8a')+_0x2aa3d8['id']});}})['catch'](function(_0x22aa61){logger[_0xc928('0x27')](_0xc928('0x86'),JSON['stringify'](_0x22aa61));});};exports[_0xc928('0x6e')]=function(_0x585375,_0xd0c81b,_0x3f0d19,_0x1b894c,_0x58440b,_0x56a194,_0x6e21a6){var _0xb72194,_0x4bee9c,_0x2b0589;_0x56a194['host']=intUtil[_0xc928('0x79')](_0x56a194[_0xc928('0x78')]);_0x56a194['serverUrl']=intUtil[_0xc928('0x79')](_0x56a194[_0xc928('0x7a')]);if(_0x6e21a6&&_0x6e21a6['recordingFormat']&&_0x6e21a6[_0xc928('0x8b')]!==_0xc928('0x8c')){logger[_0xc928('0x32')](_0xc928('0x8d'),'Recording\x20is\x20enabled!');_0xd0c81b[_0xc928('0x80')]=_0x56a194['serverUrl']+_0xc928('0x7d')+_0xd0c81b['uniqueid']+_0xc928('0x7f')+md5(_0xd0c81b[_0xc928('0x7e')]);}var _0x3212e4=_0x56a194[_0xc928('0x78')]==='zoho.eu'?'eu':_0xc928('0x8e');return getAccessToken(_0x56a194)[_0xc928('0x23')](function(_0x1e8309){_0x2b0589=_0x1e8309;return getUser(_0x2b0589,_0x3212e4,_0x56a194,_0x1b894c[_0xc928('0x30')]);})[_0xc928('0x23')](function(_0x34b9a1){_0xb72194=_0x34b9a1;logger[_0xc928('0x32')](_0xc928('0x8f'),_0xb72194['id']);return getEndUser(_0x2b0589,_0x3212e4,_0x56a194,_0xd0c81b[_0xc928('0x90')],_0xd0c81b[_0xc928('0x91')],_0xb72194,_0x3f0d19);})[_0xc928('0x23')](function(_0x457920){_0x4bee9c=_0x457920;return getCall(_0x2b0589,_0x3212e4,_0x56a194,_0xb72194,_0x4bee9c,_0x3f0d19,_0xd0c81b,_0xc928('0x92'));})['then'](function(_0x151931){if(_0x151931){logger[_0xc928('0x32')](_0xc928('0x85'),_0x151931['id']);logger[_0xc928('0x32')]('[OUTBOUND]',_0xc928('0x87'));emit(util[_0xc928('0x2b')](_0xc928('0x93'),_0x1b894c[_0xc928('0x15')]),'trigger:browser:url',{'uri':_0xc928('0x89')+_0x56a194['host']+_0xc928('0x8a')+_0x151931['id']});}})['catch'](function(_0x46f0ee){logger[_0xc928('0x27')]('[OUTBOUND]',JSON['stringify'](_0x46f0ee));});};exports[_0xc928('0x94')]=function(_0x1783ed,_0x4f696b,_0xb44c,_0x584699,_0x99c792,_0x359827){var _0x3bcca9,_0x5811fc,_0x51b34d;_0x359827[_0xc928('0x78')]=intUtil[_0xc928('0x79')](_0x359827['host']);_0x359827[_0xc928('0x7a')]=intUtil['stripTrailingSlash'](_0x359827[_0xc928('0x7a')]);if(_0x99c792&&_0x99c792[_0xc928('0x7b')]){logger[_0xc928('0x32')]('['+_0x4f696b['lastevent'][_0xc928('0x95')]()+']',_0xc928('0x7c'));_0x4f696b[_0xc928('0x80')]=_0x359827[_0xc928('0x7a')]+_0xc928('0x7d')+_0x4f696b['uniqueid']+_0xc928('0x7f')+md5(_0x4f696b[_0xc928('0x7e')]);}else{_0x4f696b[_0xc928('0x80')]='';}var _0x1cc64b=_0x359827[_0xc928('0x78')]===_0xc928('0x81')?'eu':_0xc928('0x8e');return getAccessToken(_0x359827)[_0xc928('0x23')](function(_0x5943a1){_0x51b34d=_0x5943a1;return getUser(_0x51b34d,_0x1cc64b,_0x359827);})[_0xc928('0x23')](function(_0x469700){_0x3bcca9=_0x469700;logger[_0xc928('0x32')]('The\x20User\x20ID\x20is:',_0x3bcca9['id']);return getEndUser(_0x51b34d,_0x1cc64b,_0x359827,_0x4f696b[_0xc928('0x82')],_0x4f696b[_0xc928('0x83')],_0x3bcca9,_0xb44c);})['then'](function(_0x2966c5){_0x5811fc=_0x2966c5;return getCall(_0x51b34d,_0x1cc64b,_0x359827,_0x3bcca9,_0x5811fc,_0xb44c,_0x4f696b,_0xc928('0x84'));})[_0xc928('0x23')](function(_0x1af69d){if(_0x1af69d){logger[_0xc928('0x32')](_0xc928('0x85'),_0x1af69d['id']);}})[_0xc928('0x26')](function(_0x851ba5){logger[_0xc928('0x27')]('['+_0x4f696b[_0xc928('0x96')][_0xc928('0x95')]()+']',JSON[_0xc928('0xc')](_0x851ba5));});}; \ No newline at end of file +var _0x707d=['stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','email','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','uri','Leads','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','talktime','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','complete','Call_Result','Answered','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','Inbound','merge','Fields','code','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','com','destcalleridname','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','zoho.eu','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','emit','[HTTP]','stringify','length','forEach','type','string','idField','toString','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x707d,0x18b));var _0xd707=function(_0x51ae4e,_0x425f1c){_0x51ae4e=_0x51ae4e-0x0;var _0x4b2274=_0x707d[_0x51ae4e];return _0x4b2274;};'use strict';var _=require(_0xd707('0x0'));var rp=require(_0xd707('0x1'));var md5=require(_0xd707('0x2'));var util=require(_0xd707('0x3'));var intUtil=require(_0xd707('0x4'));var moment=require(_0xd707('0x5'));var Redis=require(_0xd707('0x6'));var BPromise=require('bluebird');var config=require(_0xd707('0x7'));var logger=require(_0xd707('0x8'))(_0xd707('0x9'));config[_0xd707('0xa')]=_['defaults'](config[_0xd707('0xa')],{'host':_0xd707('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd707('0xa')]));function emit(_0xf596b4,_0x11edc8,_0x5d95fa){io['to'](_0xf596b4)[_0xd707('0xc')](_0x11edc8,_0x5d95fa);}function request(_0x249b0d){logger['debug'](_0xd707('0xd'),JSON[_0xd707('0xe')](_0x249b0d));return rp(_0x249b0d);}function getCustomFields(_0x588b55,_0x5af991){var _0x238856={};if(_0x588b55[_0xd707('0xf')]>0x0){_[_0xd707('0x10')](_0x588b55,function(_0x53a412){if(_0x53a412[_0xd707('0x11')]===_0xd707('0x12')&&_0x53a412[_0xd707('0x13')]){_0x238856[_0x53a412['idField']]=_0x53a412['content'][_0xd707('0x14')]();}else if(_0x53a412[_0xd707('0x11')]==='variable'&&_0x53a412[_0xd707('0x15')]&&_0x53a412[_0xd707('0x13')]&&_0x5af991[_0x53a412['variableName']]){_0x238856[_0x53a412[_0xd707('0x13')]]=_0x5af991[_0x53a412[_0xd707('0x15')]]['toString']();}else if(_0x53a412['type']===_0xd707('0x16')&&_0x53a412['Variable']&&_0x53a412[_0xd707('0x17')][_0xd707('0x18')]&&_0x53a412['idField']&&_0x5af991[_0x53a412[_0xd707('0x17')][_0xd707('0x18')][_0xd707('0x19')]()]){_0x238856[_0x53a412[_0xd707('0x13')]]=_0x5af991[_0x53a412[_0xd707('0x17')][_0xd707('0x18')]['toLowerCase']()]['toString']();}});}return _0x238856;}function getName(_0x3d3dc5){if(_0x3d3dc5['indexOf']('\x20')>0x0){var _0x2307db=_0x3d3dc5[_0xd707('0x1a')](/ (.+)/);if(_0x2307db[0x1]){return _0x2307db;}}return[_0x3d3dc5,_0x3d3dc5];}var accountsTokens={};function getAccessToken(_0x1c5aba){return new Promise(function(_0x4c2e25,_0x5f152e){if(!_[_0xd707('0x1b')](accountsTokens[_0x1c5aba['id']])&&!_[_0xd707('0x1b')](accountsTokens[_0x1c5aba['id']][_0xd707('0x1c')])){if(moment()[_0xd707('0x1d')](accountsTokens[_0x1c5aba['id']][_0xd707('0x1e')])){_0x4c2e25(accountsTokens[_0x1c5aba['id']][_0xd707('0x1c')]);}}var _0x45c504;switch(_0x1c5aba['zone']){case'US':_0x45c504=_0xd707('0x1f');break;case'AU':_0x45c504='https://accounts.zoho.com.au';break;case'EU':_0x45c504=_0xd707('0x20');break;case'IN':_0x45c504='https://accounts.zoho.in';break;case'CN':_0x45c504=_0xd707('0x21');break;default:_0x45c504=_0xd707('0x20');break;}var _0x370dfd={'method':'POST','uri':_0x45c504+_0xd707('0x22'),'qs':{'refresh_token':_0x1c5aba[_0xd707('0x23')],'client_id':_0x1c5aba['clientId'],'client_secret':_0x1c5aba[_0xd707('0x24')],'grant_type':_0xd707('0x25')},'json':!![]};return rp(_0x370dfd)[_0xd707('0x26')](function(_0xdc96a5){accountsTokens[_0x1c5aba['id']]={'access_token':_0xdc96a5[_0xd707('0x1c')],'expires_in':moment()[_0xd707('0x27')](_0xdc96a5[_0xd707('0x1e')],_0xd707('0x28'))};_0x4c2e25(_0xdc96a5[_0xd707('0x1c')]);})[_0xd707('0x29')](function(_0x27d15b){logger['error'](_0xd707('0x2a'),_0x27d15b[_0xd707('0x2b')]);_0x5f152e(_0x27d15b);});});}function getUser(_0x17145b,_0x2cf61d,_0x47029e,_0x5c0310){logger[_0xd707('0x2c')](_0xd707('0x2d'));return request({'method':_0xd707('0x2e'),'uri':util[_0xd707('0x2f')](_0xd707('0x30'),_0x2cf61d),'qs':{'type':_0xd707('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x17145b},'json':!![]})[_0xd707('0x26')](function(_0x94486d){if(_0x94486d[_0xd707('0x32')]){var _0x4eb43c=-0x1;if(_['isArrayLikeObject'](_0x94486d[_0xd707('0x32')])){if(!_[_0xd707('0x1b')](_0x5c0310)){_0x4eb43c=_['findIndex'](_0x94486d[_0xd707('0x32')],function(_0x11b05b){return _0x11b05b[_0xd707('0x33')]===_0x5c0310;});}if(_0x4eb43c>=0x0){logger[_0xd707('0x2c')]('Agent\x20found!');}else{logger['info'](_0xd707('0x34'));_0x4eb43c=_[_0xd707('0x35')](_0x94486d['users'],function(_0x385378){return _0x385378[_0xd707('0x36')]['name']==='Administrator';});}return _0x94486d[_0xd707('0x32')][_0x4eb43c];}else{if(_0x94486d['user'][_0xd707('0x36')]['name']===_0xd707('0x37')){logger[_0xd707('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x94486d[_0xd707('0x38')];return user;}else{logger[_0xd707('0x39')](_0xd707('0x3a'),JSON[_0xd707('0xe')](_0x94486d));throw new Error(_0xd707('0x3b')+JSON[_0xd707('0xe')](_0x94486d));}}}else{logger['error'](_0xd707('0x3a'),JSON[_0xd707('0xe')](_0x94486d));throw new Error(_0xd707('0x3b')+JSON[_0xd707('0xe')](_0x94486d));}})[_0xd707('0x29')](function(_0x15a45d){console[_0xd707('0x39')](_0x15a45d);});}function getZohoUser(_0x5e4237,_0x5beb41){return new BPromise(function(_0x5ecc38,_0x495c2a){request(_0x5e4237)[_0xd707('0x26')](function(_0x2db9ae){var _0x29fdf6=null;if(_0x2db9ae){_0x29fdf6=_0x2db9ae[_0xd707('0x3c')][0x0];_0x29fdf6[_0xd707('0x3d')]=_0x5beb41;}_0x5ecc38(_0x29fdf6);})['catch'](function(_0x511e16){_0x495c2a(_0x511e16);});});}function createEndUser(_0x998655,_0x21c473,_0x2ccada,_0x418d07,_0x3b728,_0x26ed13){var _0x2ccada=getName(_0x2ccada);return request({'method':'POST','uri':_0xd707('0x3e')+_0x21c473+'/crm/v2/'+_[_0xd707('0x3f')](_0x26ed13[_0xd707('0x40')])+'s','body':{'data':[{'Last_Name':_0x2ccada[0x1],'First_Name':_0x2ccada[0x0],'Phone':_0x418d07,'Owner':{'name':!_[_0xd707('0x1b')](_0x3b728[_0xd707('0x41')]['name'])?_0x3b728[_0xd707('0x41')][_0xd707('0x18')]:!_[_0xd707('0x1b')](_0x3b728[_0xd707('0x42')])?_0x3b728[_0xd707('0x42')]+'\x20'+_0x3b728[_0xd707('0x43')]:_0x3b728[_0xd707('0x43')],'id':_0x3b728['id']}}]},'headers':{'Authorization':_0xd707('0x44')+_0x998655},'json':!![]})[_0xd707('0x26')](function(_0x168359){if(_0x168359&&_0x168359[_0xd707('0x3c')][0x0]['code']===_0xd707('0x45')){var _0x5635b9=_0x168359[_0xd707('0x3c')][0x0][_0xd707('0x46')];_0x5635b9['enduserType']=_['startCase'](_0x26ed13['moduleCreate'])+'s';return _0x5635b9;}logger[_0xd707('0x39')](_0xd707('0x3a'),JSON[_0xd707('0xe')](data));throw new Error(_0xd707('0x47')+JSON[_0xd707('0xe')](data));})['catch'](function(_0x4c4932){console[_0xd707('0x48')](_0xd707('0x49'),_0x4c4932);});}function getEndUser(_0x3285eb,_0x15b120,_0x59523b,_0x34fb1a,_0xebff35,_0x3684ef,_0x26c7ff){var _0x2d4c52={'method':_0xd707('0x2e'),'uri':'','headers':{'Authorization':_0xd707('0x44')+_0x3285eb},'json':!![]};switch(_0x26c7ff[_0xd707('0x4a')]){case _0xd707('0x4b'):_0x2d4c52['uri']=_0xd707('0x3e')+_0x15b120+_0xd707('0x4c')+_0xebff35+'))';return getZohoUser(_0x2d4c52,_0xd707('0x4d'))['then'](function(_0x198d79){if(_0x198d79)return _0x198d79;_0x2d4c52['uri']='https://www.zohoapis.'+_0x15b120+_0xd707('0x4e')+_0xebff35+'))';return getZohoUser(_0x2d4c52,'Leads')[_0xd707('0x26')](function(_0x199f7d){if(_0x199f7d)return _0x199f7d;if(_0x26c7ff['moduleCreate']!=_0xd707('0x4f')){return createEndUser(_0x3285eb,_0x15b120,_0x34fb1a,_0xebff35,_0x3684ef,_0x26c7ff);}else{return{};}});});break;case _0xd707('0x50'):_0x2d4c52['uri']=_0xd707('0x3e')+_0x15b120+_0xd707('0x4c')+_0xebff35+'))';return getZohoUser(_0x2d4c52,_0xd707('0x4d'))[_0xd707('0x26')](function(_0x132302){if(_0x132302)return _0x132302;if(_0x26c7ff[_0xd707('0x40')]!=_0xd707('0x4f')){return createEndUser(_0x3285eb,_0x15b120,_0x34fb1a,_0xebff35,_0x3684ef,_0x26c7ff);}else{return{};}});break;case'lead':_0x2d4c52[_0xd707('0x51')]=_0xd707('0x3e')+_0x15b120+_0xd707('0x4e')+_0xebff35+'))';return getZohoUser(_0x2d4c52,_0xd707('0x52'))[_0xd707('0x26')](function(_0x209168){if(_0x209168)return _0x209168;if(_0x26c7ff['moduleCreate']!=_0xd707('0x4f')){return createEndUser(_0x3285eb,_0x15b120,_0x34fb1a,_0xebff35,_0x3684ef,_0x26c7ff);}else{return{};}});break;}}function getCall(_0x2d9736,_0x260c0a,_0x481a34,_0x462e46,_0x5afe37,_0x28bf15,_0x1ffc7e,_0x5b8c02){logger[_0xd707('0x2c')](_0xd707('0x53'));var _0x56d431={};_0x56d431[_0xd707('0x54')]={'name':!_[_0xd707('0x1b')](_0x462e46[_0xd707('0x41')]['name'])&&!_[_0xd707('0x1b')](_0x462e46[_0xd707('0x36')][_0xd707('0x18')])&&_0x462e46[_0xd707('0x36')][_0xd707('0x18')]==='administrator'?_0x462e46[_0xd707('0x41')][_0xd707('0x18')]:!_[_0xd707('0x1b')](_0x462e46['first_name'])?_0x462e46[_0xd707('0x42')]+'\x20'+_0x462e46['last_name']:_0x462e46[_0xd707('0x43')],'id':_0x462e46['id']};_0x56d431[_0xd707('0x55')]=intUtil[_0xd707('0x56')](_0x28bf15[_0xd707('0x57')],_0x1ffc7e,'\x20');_0x56d431[_0xd707('0x58')]=intUtil[_0xd707('0x56')](_0x28bf15[_0xd707('0x59')],_0x1ffc7e,'\x0a');if(_0x5afe37[_0xd707('0x3d')]===_0xd707('0x4d')){_0x56d431[_0xd707('0x5a')]={'name':!_[_0xd707('0x1b')](_0x5afe37[_0xd707('0x5b')])?_0x5afe37['Full_Name']:!_[_0xd707('0x1b')](_0x5afe37[_0xd707('0x5c')])?_0x5afe37['First_Name']+'\x20'+_0x5afe37[_0xd707('0x5d')]:_0x5afe37[_0xd707('0x5d')],'id':_0x5afe37['id']};}if(_0x5afe37[_0xd707('0x3d')]==='Leads'){_0x56d431['What_Id']={'name':!_['isNil'](_0x5afe37[_0xd707('0x5b')])?_0x5afe37['Full_Name']:!_[_0xd707('0x1b')](_0x5afe37[_0xd707('0x5c')])?_0x5afe37[_0xd707('0x5c')]+'\x20'+_0x5afe37[_0xd707('0x5d')]:_0x5afe37[_0xd707('0x5d')],'id':_0x5afe37['id']};_0x56d431['$se_module']=_['startCase'](_0x5afe37[_0xd707('0x3d')]);}if(_0x1ffc7e[_0xd707('0x5e')]){_0x56d431['Call_Duration']=moment[_0xd707('0x5f')](parseInt(_0x1ffc7e['talktime'])*0x3e8)[_0xd707('0x2f')](_0xd707('0x60'));}else if(_0x1ffc7e[_0xd707('0x61')]&&_0x1ffc7e[_0xd707('0x62')]){_0x56d431['Call_Duration']=moment[_0xd707('0x5f')](moment(_0x1ffc7e[_0xd707('0x62')],_0xd707('0x63'))[_0xd707('0x64')](moment(_0x1ffc7e[_0xd707('0x65')],_0xd707('0x63'))))['format'](_0xd707('0x60'));}switch(_0x1ffc7e[_0xd707('0x66')]){case _0xd707('0x67'):_0x56d431['Call_Result']=_0xd707('0x68');break;case _0xd707('0x69'):case'connect':_0x56d431[_0xd707('0x6a')]=_0xd707('0x6b');break;case'rejected':_0x56d431['Call_Result']=_0xd707('0x6c');break;case _0xd707('0x6d'):_0x56d431['Call_Result']='Abandoned';break;case _0xd707('0x6e'):_0x56d431[_0xd707('0x6a')]=_0xd707('0x6f');default:}_0x56d431[_0xd707('0x70')]=(_0x5b8c02===_0xd707('0x71')?moment(_0x1ffc7e['starttime'])[_0xd707('0x2f')](_0xd707('0x63')):moment(_0x1ffc7e['agentcalledAt'])[_0xd707('0x2f')](_0xd707('0x63')))||moment()[_0xd707('0x2f')](_0xd707('0x63'));_0x56d431['Call_Type']=_0x5b8c02||_0xd707('0x72');_0x56d431=_[_0xd707('0x73')](_0x56d431,getCustomFields(_0x28bf15[_0xd707('0x74')],_0x1ffc7e));return request({'method':'POST','uri':_0xd707('0x3e')+_0x260c0a+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2d9736},'body':{'data':[_0x56d431]},'json':!![]})['then'](function(_0x1ffd86){if(_0x1ffd86&&_0x1ffd86[_0xd707('0x3c')][0x0][_0xd707('0x75')]===_0xd707('0x45')){logger['info']('Call\x20created!');return{'id':_0x1ffd86[_0xd707('0x3c')][0x0][_0xd707('0x46')]['id']};}})[_0xd707('0x29')](function(_0x1f7d06){logger[_0xd707('0x2c')](_0xd707('0x76'),_0x1f7d06['stack']);console[_0xd707('0x48')]('err',_0x1f7d06);});}exports['queue']=function(_0x4eb2ec,_0x4731f8,_0x47d153,_0xd5c89b,_0x3cf38a,_0x372c83){var _0x1bea45,_0x10de5c,_0x380acc;_0x372c83[_0xd707('0x77')]=intUtil[_0xd707('0x78')](_0x372c83[_0xd707('0x77')]);_0x372c83[_0xd707('0x79')]=intUtil[_0xd707('0x78')](_0x372c83[_0xd707('0x79')]);if(_0x3cf38a&&_0x3cf38a[_0xd707('0x7a')]){logger['info'](_0xd707('0x7b'),_0xd707('0x7c'));_0x4731f8['recordingURL']=_0x372c83[_0xd707('0x79')]+_0xd707('0x7d')+_0x4731f8[_0xd707('0x7e')]+_0xd707('0x7f')+md5(_0x4731f8['uniqueid']);}else{_0x4731f8[_0xd707('0x80')]='';}var _0x36dabd=_0x372c83[_0xd707('0x77')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x372c83)['then'](function(_0x10fb2f){_0x380acc=_0x10fb2f;return getUser(_0x380acc,_0x36dabd,_0x372c83,_0xd5c89b[_0xd707('0x33')]);})[_0xd707('0x26')](function(_0x341173){_0x1bea45=_0x341173;logger[_0xd707('0x2c')](_0xd707('0x81'),_0x1bea45['id']);return getEndUser(_0x380acc,_0x36dabd,_0x372c83,_0x4731f8[_0xd707('0x82')],_0x4731f8[_0xd707('0x83')],_0x1bea45,_0x47d153);})[_0xd707('0x26')](function(_0x1a8868){_0x10de5c=_0x1a8868;return getCall(_0x380acc,_0x36dabd,_0x372c83,_0x1bea45,_0x10de5c,_0x47d153,_0x4731f8,_0xd707('0x72'));})[_0xd707('0x26')](function(_0x451bc2){if(_0x451bc2){logger[_0xd707('0x2c')](_0xd707('0x84'),_0x451bc2['id']);logger[_0xd707('0x2c')]('[QUEUE]',_0xd707('0x85'));emit(util[_0xd707('0x2f')](_0xd707('0x86'),_0xd5c89b[_0xd707('0x18')]),_0xd707('0x87'),{'uri':'https://crm.'+_0x372c83[_0xd707('0x77')]+'/crm/EntityInfo.do?module=Calls&id='+_0x451bc2['id']});}})['catch'](function(_0x14c278){logger[_0xd707('0x39')](_0xd707('0x7b'),JSON['stringify'](_0x14c278));});};exports['outbound']=function(_0x5deff0,_0x3fa0a2,_0x39e5f1,_0x910ff2,_0x44a7a5,_0x3b39ce,_0x4e7a7f){var _0x54115d,_0x55361f,_0x44317d;_0x3b39ce['host']=intUtil[_0xd707('0x78')](_0x3b39ce[_0xd707('0x77')]);_0x3b39ce[_0xd707('0x79')]=intUtil['stripTrailingSlash'](_0x3b39ce[_0xd707('0x79')]);if(_0x4e7a7f&&_0x4e7a7f['recordingFormat']&&_0x4e7a7f[_0xd707('0x88')]!==_0xd707('0x89')){logger[_0xd707('0x2c')](_0xd707('0x8a'),'Recording\x20is\x20enabled!');_0x3fa0a2[_0xd707('0x80')]=_0x3b39ce['serverUrl']+_0xd707('0x7d')+_0x3fa0a2[_0xd707('0x7e')]+_0xd707('0x7f')+md5(_0x3fa0a2[_0xd707('0x7e')]);}var _0x1ff17c=_0x3b39ce[_0xd707('0x77')]==='zoho.eu'?'eu':_0xd707('0x8b');return getAccessToken(_0x3b39ce)[_0xd707('0x26')](function(_0x2a451c){_0x44317d=_0x2a451c;return getUser(_0x44317d,_0x1ff17c,_0x3b39ce,_0x910ff2[_0xd707('0x33')]);})['then'](function(_0x3d1c3c){_0x54115d=_0x3d1c3c;logger['info']('The\x20User\x20ID\x20is:',_0x54115d['id']);return getEndUser(_0x44317d,_0x1ff17c,_0x3b39ce,_0x3fa0a2[_0xd707('0x8c')],_0x3fa0a2['destcalleridnum'],_0x54115d,_0x39e5f1);})[_0xd707('0x26')](function(_0x1b8306){_0x55361f=_0x1b8306;return getCall(_0x44317d,_0x1ff17c,_0x3b39ce,_0x54115d,_0x55361f,_0x39e5f1,_0x3fa0a2,'Outbound');})[_0xd707('0x26')](function(_0x5926b2){if(_0x5926b2){logger[_0xd707('0x2c')](_0xd707('0x84'),_0x5926b2['id']);logger[_0xd707('0x2c')](_0xd707('0x8a'),_0xd707('0x85'));emit(util[_0xd707('0x2f')](_0xd707('0x86'),_0x910ff2[_0xd707('0x18')]),'trigger:browser:url',{'uri':_0xd707('0x8d')+_0x3b39ce['host']+_0xd707('0x8e')+_0x5926b2['id']});}})[_0xd707('0x29')](function(_0x3724d8){logger['error'](_0xd707('0x8a'),JSON[_0xd707('0xe')](_0x3724d8));});};exports[_0xd707('0x8f')]=function(_0x26d2c1,_0x1c6da2,_0x5f515f,_0x3caf96,_0x38400b,_0x41afe4){var _0x3cc69f,_0x545acf,_0x22d34d;_0x41afe4[_0xd707('0x77')]=intUtil[_0xd707('0x78')](_0x41afe4[_0xd707('0x77')]);_0x41afe4[_0xd707('0x79')]=intUtil[_0xd707('0x78')](_0x41afe4['serverUrl']);if(_0x38400b&&_0x38400b[_0xd707('0x7a')]){logger[_0xd707('0x2c')]('['+_0x1c6da2['lastevent'][_0xd707('0x90')]()+']',_0xd707('0x7c'));_0x1c6da2[_0xd707('0x80')]=_0x41afe4[_0xd707('0x79')]+_0xd707('0x7d')+_0x1c6da2['uniqueid']+_0xd707('0x7f')+md5(_0x1c6da2[_0xd707('0x7e')]);}else{_0x1c6da2[_0xd707('0x80')]='';}var _0x51d956=_0x41afe4['host']===_0xd707('0x91')?'eu':_0xd707('0x8b');return getAccessToken(_0x41afe4)[_0xd707('0x26')](function(_0xfdab1e){_0x22d34d=_0xfdab1e;return getUser(_0x22d34d,_0x51d956,_0x41afe4);})[_0xd707('0x26')](function(_0x54d1cc){_0x3cc69f=_0x54d1cc;logger['info'](_0xd707('0x81'),_0x3cc69f['id']);return getEndUser(_0x22d34d,_0x51d956,_0x41afe4,_0x1c6da2[_0xd707('0x82')],_0x1c6da2[_0xd707('0x83')],_0x3cc69f,_0x5f515f);})[_0xd707('0x26')](function(_0x419ca1){_0x545acf=_0x419ca1;return getCall(_0x22d34d,_0x51d956,_0x41afe4,_0x3cc69f,_0x545acf,_0x5f515f,_0x1c6da2,_0xd707('0x72'));})[_0xd707('0x26')](function(_0xf43e73){if(_0xf43e73){logger[_0xd707('0x2c')](_0xd707('0x84'),_0xf43e73['id']);}})[_0xd707('0x29')](function(_0x357289){logger[_0xd707('0x39')]('['+_0x1c6da2[_0xd707('0x66')][_0xd707('0x90')]()+']',JSON[_0xd707('0xe')](_0x357289));});}; \ 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 8bce10a..0548509 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(_0x252c09,_0x59dd39){var _0x2b0bf1=function(_0x43a3b5){while(--_0x43a3b5){_0x252c09['push'](_0x252c09['shift']());}};_0x2b0bf1(++_0x59dd39);}(_0x7a54,0x106));var _0x47a5=function(_0x5ab479,_0x28058d){_0x5ab479=_0x5ab479-0x0;var _0x5af334=_0x7a54[_0x5ab479];return _0x5af334;};'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(_0x5e3ebc,_0x1d193b){var _0x360cd8=function(_0x569f69){while(--_0x569f69){_0x5e3ebc['push'](_0x5e3ebc['shift']());}};_0x360cd8(++_0x1d193b);}(_0x7a54,0x106));var _0x47a5=function(_0x243b8f,_0x51ad29){_0x243b8f=_0x243b8f-0x0;var _0x285c51=_0x7a54[_0x243b8f];return _0x285c51;};'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 daf2ec5..cc41859 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x28b2cd,_0x1e386d){var _0x4046e8=function(_0x49cfd2){while(--_0x49cfd2){_0x28b2cd['push'](_0x28b2cd['shift']());}};_0x4046e8(++_0x1e386d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1df236,_0x2fa2e1){_0x1df236=_0x1df236-0x0;var _0x3f3215=_0x5f2f[_0x1df236];return _0x3f3215;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _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(_0x43c57b,_0x333d9c){var _0x58bcba=function(_0x3f3654){while(--_0x3f3654){_0x43c57b['push'](_0x43c57b['shift']());}};_0x58bcba(++_0x333d9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x9be508,_0x10c8ba){_0x9be508=_0x9be508-0x0;var _0x16f3c3=_0xb10b[_0x9be508];return _0x16f3c3;};'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 04e4997..7f6dd5f 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 _0x5a52=['catch','jayson/promise','client','http','Request','request','rpc','routing','error','message','result'];(function(_0x4c21e7,_0x4951bb){var _0xed2a31=function(_0x5e38e0){while(--_0x5e38e0){_0x4c21e7['push'](_0x4c21e7['shift']());}};_0xed2a31(++_0x4951bb);}(_0x5a52,0x18d));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x25a5('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x25a5('0x1')][_0x25a5('0x2')]({'port':0x2329});client[_0x25a5('0x3')]=function(_0x2f17d9,_0x2fc1db){return new BPromise(function(_0x407636,_0x1d9132){return client[_0x25a5('0x4')](_0x2f17d9,_0x2fc1db)['then'](function(_0x2c210a){logger['debug'](_0x25a5('0x5'),_0x25a5('0x6'),_0x2f17d9,_0x2fc1db,_0x2c210a);if(_0x2c210a[_0x25a5('0x7')]){logger[_0x25a5('0x7')](_0x25a5('0x5'),_0x25a5('0x6'),_0x2f17d9,_0x2c210a['error']['message'],_0x2fc1db);return _0x1d9132(_0x2c210a[_0x25a5('0x7')][_0x25a5('0x8')]);}else{return _0x407636(_0x2c210a[_0x25a5('0x9')]);}})[_0x25a5('0xa')](function(_0x191c46){logger[_0x25a5('0x7')](_0x25a5('0x5'),_0x25a5('0x6'),_0x2f17d9,_0x191c46,_0x2fc1db);return _0x1d9132(_0x191c46);});});};module['exports']=client; \ No newline at end of file +var _0x891b=['routing','http','Request','request','error','rpc','message','result','catch','exports','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x891b,0xc5));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xb891('0x0'))(_0xb891('0x1'));var client=jayson['client'][_0xb891('0x2')]({'port':0x2329});client[_0xb891('0x3')]=function(_0x1c519f,_0x467558){return new BPromise(function(_0x587bf1,_0x379509){return client[_0xb891('0x4')](_0x1c519f,_0x467558)['then'](function(_0x3635be){logger['debug']('rpc','routing',_0x1c519f,_0x467558,_0x3635be);if(_0x3635be[_0xb891('0x5')]){logger[_0xb891('0x5')](_0xb891('0x6'),_0xb891('0x1'),_0x1c519f,_0x3635be[_0xb891('0x5')][_0xb891('0x7')],_0x467558);return _0x379509(_0x3635be[_0xb891('0x5')]['message']);}else{return _0x587bf1(_0x3635be[_0xb891('0x8')]);}})[_0xb891('0x9')](function(_0x2dd7d4){logger[_0xb891('0x5')](_0xb891('0x6'),_0xb891('0x1'),_0x1c519f,_0x2dd7d4,_0x467558);return _0x379509(_0x2dd7d4);});});};module[_0xb891('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 378a0ea..035e763 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 _0x4351=['../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x48e697,_0x3d43d3){var _0x3a6f5f=function(_0x209597){while(--_0x209597){_0x48e697['push'](_0x48e697['shift']());}};_0x3a6f5f(++_0x3d43d3);}(_0x4351,0x1b5));var _0x1435=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x4351[_0x4e9628];return _0x27bc8c;};'use strict';var BPromise=require(_0x1435('0x0'));var server=require(_0x1435('0x1'));var Realtime=require(_0x1435('0x2'));var EmailChannel=require(_0x1435('0x3'));var mailAccount=require(_0x1435('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x1435('0x5'))['db'];function initRealtime(){return BPromise[_0x1435('0x6')]()[_0x1435('0x7')](mailAccount[_0x1435('0x8')]())[_0x1435('0x7')](realtime[_0x1435('0x9')]())[_0x1435('0x7')](function(){email[_0x1435('0xa')](realtime[_0x1435('0xb')]);return realtime;});}function main(){return server[_0x1435('0xc')](realtime,email)['then'](function(_0x10760d){return initRealtime();})['then'](function(_0x4d04c7){return db[_0x1435('0xd')][_0x1435('0xe')]({'attributes':['id',_0x1435('0xf')],'raw':!![]});})[_0x1435('0x7')](function(_0xade491){return setInterval(initRealtime,_0xade491['loginMailFrequency']*0x3e8);})[_0x1435('0x10')](function(_0x3aafce){console['log'](_0x3aafce);});}main(); \ No newline at end of file +var _0x2086=['loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x2086,0x124));var _0x6208=function(_0x345ea9,_0x4b4198){_0x345ea9=_0x345ea9-0x0;var _0x1cf2d8=_0x2086[_0x345ea9];return _0x1cf2d8;};'use strict';var BPromise=require(_0x6208('0x0'));var server=require(_0x6208('0x1'));var Realtime=require(_0x6208('0x2'));var EmailChannel=require(_0x6208('0x3'));var mailAccount=require(_0x6208('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x6208('0x5'))['db'];function initRealtime(){return BPromise['resolve']()[_0x6208('0x6')](mailAccount[_0x6208('0x7')]())['then'](realtime[_0x6208('0x8')]())[_0x6208('0x6')](function(){email[_0x6208('0x9')](realtime[_0x6208('0xa')]);return realtime;});}function main(){return server[_0x6208('0xb')](realtime,email)['then'](function(_0x8f32fc){return initRealtime();})['then'](function(_0x58a6c1){return db[_0x6208('0xc')][_0x6208('0xd')]({'attributes':['id',_0x6208('0xe')],'raw':!![]});})[_0x6208('0x6')](function(_0x89fad2){return setInterval(initRealtime,_0x89fad2[_0x6208('0xe')]*0x3e8);})[_0x6208('0xf')](function(_0x4f1bfa){console[_0x6208('0x10')](_0x4f1bfa);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 9b47bde..f331040 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 _0x4c0b=['emit','mailAccount:update','active','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','verifySmtp','Smtp','verified','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','key','Imap','status','messageStatus','isNil'];(function(_0x4e5ab4,_0x2a8463){var _0x4f6be8=function(_0x158b42){while(--_0x158b42){_0x4e5ab4['push'](_0x4e5ab4['shift']());}};_0x4f6be8(++_0x2a8463);}(_0x4c0b,0x14e));var _0xb4c0=function(_0x18f129,_0x4db6b1){_0x18f129=_0x18f129-0x0;var _0x5de23d=_0x4c0b[_0x18f129];return _0x5de23d;};'use strict';var _=require(_0xb4c0('0x0'));var moment=require(_0xb4c0('0x1'));var BPromise=require(_0xb4c0('0x2'));var md5=require(_0xb4c0('0x3'));var Redis=require(_0xb4c0('0x4'));var config=require(_0xb4c0('0x5'));var logger=require('../../../config/logger')(_0xb4c0('0x6'));config[_0xb4c0('0x7')]=_[_0xb4c0('0x8')](config[_0xb4c0('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xb4c0('0x9'))(new Redis(config[_0xb4c0('0x7')]));var EmailImap=require(_0xb4c0('0xa'));var EmailSmtp=require(_0xb4c0('0xb'));var mailAccount=require(_0xb4c0('0xc'));var md5Accounts={};function EmailChannel(_0x17fab5){logger[_0xb4c0('0xd')]('start\x20email\x20channel');this[_0xb4c0('0xe')]=_0x17fab5[_0xb4c0('0xe')];this[_0xb4c0('0xf')]={};this[_0xb4c0('0x10')]=new EmailSmtp();}EmailChannel[_0xb4c0('0x11')]['emit']=function(_0x5558d2){var _0x2c0140=this['mailAccounts'][_0x5558d2];var _0x27421b={'id':_0x2c0140['id'],'name':_0x2c0140['name'],'key':_0x2c0140[_0xb4c0('0x12')],'active':_0x2c0140['active'],'Imap':{'status':_0x2c0140[_0xb4c0('0x13')][_0xb4c0('0x14')],'messageStatus':_0x2c0140[_0xb4c0('0x13')][_0xb4c0('0x15')],'total':_0x2c0140['Imap']['total']}};if(_[_0xb4c0('0x16')](md5Accounts[_0x5558d2])){md5Accounts[_0x5558d2]={};}var _0x1aca55=md5(JSON['stringify'](_0x27421b));if(md5Accounts[_0x5558d2][_0xb4c0('0x3')]!==_0x1aca55){md5Accounts[_0x5558d2]['md5']=_0x1aca55;io[_0xb4c0('0x17')](_0xb4c0('0x18'),_0x27421b);}};EmailChannel[_0xb4c0('0x11')]['refresh']=function(_0x499601){for(var _0x46591c in _0x499601){if(_0x499601['hasOwnProperty'](_0x46591c)){if(_0x499601[_0x46591c]['Imap']&&_0x499601[_0x46591c][_0xb4c0('0x19')]){var _0x1bf7bf=_0x499601[_0x46591c][_0xb4c0('0x13')];if(!this[_0xb4c0('0xf')][_0xb4c0('0x1a')](_0x1bf7bf['id'])){this[_0xb4c0('0xf')][_0x1bf7bf['id']]=new EmailImap(_0x1bf7bf,_0x499601[_0x46591c][_0xb4c0('0x6')]);this['imapAccounts'][_0x1bf7bf['id']]['on'](_0xb4c0('0x1b'),this[_0xb4c0('0x1c')][_0xb4c0('0x1d')](this,_0x46591c));this[_0xb4c0('0xf')][_0x1bf7bf['id']]['on'](_0xb4c0('0x6'),this[_0xb4c0('0x1e')][_0xb4c0('0x1d')](this,_0x46591c));this[_0xb4c0('0xf')][_0x1bf7bf['id']]['on'](_0xb4c0('0x1f'),this[_0xb4c0('0x20')][_0xb4c0('0x1d')](this,_0x46591c));this[_0xb4c0('0xf')][_0x1bf7bf['id']]['on'](_0xb4c0('0x21'),this[_0xb4c0('0x22')][_0xb4c0('0x1d')](this,_0x46591c));}}else{if(_[_0xb4c0('0x16')](this[_0xb4c0('0xe')][_0x46591c][_0xb4c0('0x13')])){this[_0xb4c0('0xe')][_0x46591c][_0xb4c0('0x13')]={};}this[_0xb4c0('0xe')][_0x46591c][_0xb4c0('0x13')][_0xb4c0('0x14')]=_0xb4c0('0x23');this[_0xb4c0('0xe')][_0x46591c][_0xb4c0('0x13')][_0xb4c0('0x15')]='';this[_0xb4c0('0x17')](_0x46591c);}}}};EmailChannel[_0xb4c0('0x11')][_0xb4c0('0x1c')]=function(_0x7c01bb,_0x1a4412){if(this[_0xb4c0('0xe')][_0x7c01bb]){this['mailAccounts'][_0x7c01bb][_0xb4c0('0x13')]['status']='connected';this[_0xb4c0('0xe')][_0x7c01bb][_0xb4c0('0x13')][_0xb4c0('0x15')]=_0x1a4412['name'];if(_0x1a4412['messages']){this[_0xb4c0('0xe')][_0x7c01bb][_0xb4c0('0x13')]['total']=_0x1a4412['messages'][_0xb4c0('0x24')];}return this[_0xb4c0('0x17')](_0x7c01bb);}};EmailChannel['prototype'][_0xb4c0('0x1e')]=function(_0x5383bc,_0x42f787){logger[_0xb4c0('0xd')](_0xb4c0('0x25'),_0x42f787[_0xb4c0('0x26')],_0x42f787['lastName'],_0x42f787['from'],_0x5383bc);if(this[_0xb4c0('0xe')][_0x5383bc]){return mailAccount['notify'](_0x5383bc,_0x42f787)[_0xb4c0('0x27')](function(_0x387f6f){if(_0x387f6f){logger['info'](_0xb4c0('0x28'));}})[_0xb4c0('0x29')](function(_0x39a287){logger['error'](_0xb4c0('0x2a'),JSON[_0xb4c0('0x2b')](_0x39a287));});}};EmailChannel[_0xb4c0('0x11')][_0xb4c0('0x20')]=function(_0x1dcfa){if(this[_0xb4c0('0xe')][_0x1dcfa]&&this[_0xb4c0('0xe')][_0x1dcfa][_0xb4c0('0x13')]){if(this[_0xb4c0('0xf')][this[_0xb4c0('0xe')][_0x1dcfa][_0xb4c0('0x13')]['id']]){delete this[_0xb4c0('0xf')][this[_0xb4c0('0xe')][_0x1dcfa][_0xb4c0('0x13')]['id']];}this[_0xb4c0('0xe')][_0x1dcfa][_0xb4c0('0x13')][_0xb4c0('0x2c')]=moment();this[_0xb4c0('0x17')](_0x1dcfa);}};EmailChannel[_0xb4c0('0x11')][_0xb4c0('0x22')]=function(_0x183536,_0x7a004c){if(this['mailAccounts'][_0x183536]){this['mailAccounts'][_0x183536][_0xb4c0('0x13')]['status']='error';this[_0xb4c0('0xe')][_0x183536][_0xb4c0('0x13')][_0xb4c0('0x15')]=_0x7a004c;return this[_0xb4c0('0x17')](_0x183536);}};EmailChannel['prototype'][_0xb4c0('0x2d')]=function(_0x437488,_0x1844fa){return this[_0xb4c0('0x10')]['send'](_0x437488,_0x1844fa);};EmailChannel['prototype'][_0xb4c0('0x2e')]=function(_0x497717){var _0x7c93b8=this;if(this['mailAccounts'][_0x497717['id']]){if(_[_0xb4c0('0x16')](this['mailAccounts'][_0x497717['id']]['Smtp'])){this[_0xb4c0('0xe')][_0x497717['id']]['Smtp']={};}this[_0xb4c0('0xe')][_0x497717['id']]['Smtp'][_0xb4c0('0x2c')]=moment();return new BPromise(function(_0x3cfe3c,_0x594211){return _0x7c93b8[_0xb4c0('0x10')]['verify'](_0x497717)[_0xb4c0('0x27')](function(_0x1e905e){_0x7c93b8[_0xb4c0('0xe')][_0x497717['id']][_0xb4c0('0x2f')][_0xb4c0('0x14')]=_0xb4c0('0x30');_0x7c93b8[_0xb4c0('0xe')][_0x497717['id']][_0xb4c0('0x2f')][_0xb4c0('0x15')]='';_0x7c93b8['emit'](_0x497717['id']);_0x3cfe3c(_0x1e905e);})[_0xb4c0('0x29')](function(_0x32a305){_0x7c93b8[_0xb4c0('0xe')][_0x497717['id']][_0xb4c0('0x2f')][_0xb4c0('0x14')]='error';_0x7c93b8[_0xb4c0('0xe')][_0x497717['id']][_0xb4c0('0x2f')][_0xb4c0('0x15')]=_0x32a305;_0x7c93b8[_0xb4c0('0x17')](_0x497717['id']);_0x594211(_0x32a305);});});}return this[_0xb4c0('0x10')][_0xb4c0('0x31')](_0x497717);};module[_0xb4c0('0x32')]=EmailChannel; \ No newline at end of file +var _0x58ba=['../../../config/logger','email','redis','localhost','socket.io-emitter','mailAccounts','imapAccounts','prototype','emit','name','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','smtp','send','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment'];(function(_0x355cb7,_0x2d1450){var _0x173aaf=function(_0x3232c6){while(--_0x3232c6){_0x355cb7['push'](_0x355cb7['shift']());}};_0x173aaf(++_0x2d1450);}(_0x58ba,0x192));var _0xa58b=function(_0x307049,_0x1e9968){_0x307049=_0x307049-0x0;var _0x2d3015=_0x58ba[_0x307049];return _0x2d3015;};'use strict';var _=require(_0xa58b('0x0'));var moment=require(_0xa58b('0x1'));var BPromise=require(_0xa58b('0x2'));var md5=require(_0xa58b('0x3'));var Redis=require(_0xa58b('0x4'));var config=require(_0xa58b('0x5'));var logger=require(_0xa58b('0x6'))(_0xa58b('0x7'));config['redis']=_['defaults'](config[_0xa58b('0x8')],{'host':_0xa58b('0x9'),'port':0x18eb});var io=require(_0xa58b('0xa'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x52b94b){logger['info']('start\x20email\x20channel');this[_0xa58b('0xb')]=_0x52b94b[_0xa58b('0xb')];this[_0xa58b('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xa58b('0xd')][_0xa58b('0xe')]=function(_0x552025){var _0x346873=this[_0xa58b('0xb')][_0x552025];var _0x599a54={'id':_0x346873['id'],'name':_0x346873[_0xa58b('0xf')],'key':_0x346873['key'],'active':_0x346873[_0xa58b('0x10')],'Imap':{'status':_0x346873['Imap'][_0xa58b('0x11')],'messageStatus':_0x346873[_0xa58b('0x12')][_0xa58b('0x13')],'total':_0x346873[_0xa58b('0x12')][_0xa58b('0x14')]}};if(_[_0xa58b('0x15')](md5Accounts[_0x552025])){md5Accounts[_0x552025]={};}var _0x5ea931=md5(JSON[_0xa58b('0x16')](_0x599a54));if(md5Accounts[_0x552025]['md5']!==_0x5ea931){md5Accounts[_0x552025][_0xa58b('0x3')]=_0x5ea931;io[_0xa58b('0xe')](_0xa58b('0x17'),_0x599a54);}};EmailChannel[_0xa58b('0xd')][_0xa58b('0x18')]=function(_0x3e974b){for(var _0x38db7d in _0x3e974b){if(_0x3e974b['hasOwnProperty'](_0x38db7d)){if(_0x3e974b[_0x38db7d][_0xa58b('0x12')]&&_0x3e974b[_0x38db7d][_0xa58b('0x10')]){var _0x41cbb5=_0x3e974b[_0x38db7d]['Imap'];if(!this['imapAccounts'][_0xa58b('0x19')](_0x41cbb5['id'])){this[_0xa58b('0xc')][_0x41cbb5['id']]=new EmailImap(_0x41cbb5,_0x3e974b[_0x38db7d][_0xa58b('0x7')]);this['imapAccounts'][_0x41cbb5['id']]['on'](_0xa58b('0x1a'),this[_0xa58b('0x1b')][_0xa58b('0x1c')](this,_0x38db7d));this[_0xa58b('0xc')][_0x41cbb5['id']]['on'](_0xa58b('0x7'),this[_0xa58b('0x1d')][_0xa58b('0x1c')](this,_0x38db7d));this[_0xa58b('0xc')][_0x41cbb5['id']]['on'](_0xa58b('0x1e'),this[_0xa58b('0x1f')]['bind'](this,_0x38db7d));this['imapAccounts'][_0x41cbb5['id']]['on'](_0xa58b('0x20'),this[_0xa58b('0x21')][_0xa58b('0x1c')](this,_0x38db7d));}}else{if(_['isNil'](this[_0xa58b('0xb')][_0x38db7d]['Imap'])){this['mailAccounts'][_0x38db7d][_0xa58b('0x12')]={};}this[_0xa58b('0xb')][_0x38db7d][_0xa58b('0x12')]['status']=_0xa58b('0x22');this['mailAccounts'][_0x38db7d][_0xa58b('0x12')][_0xa58b('0x13')]='';this[_0xa58b('0xe')](_0x38db7d);}}}};EmailChannel['prototype'][_0xa58b('0x1b')]=function(_0x512cb2,_0x1ef8f6){if(this[_0xa58b('0xb')][_0x512cb2]){this['mailAccounts'][_0x512cb2][_0xa58b('0x12')][_0xa58b('0x11')]='connected';this[_0xa58b('0xb')][_0x512cb2][_0xa58b('0x12')]['messageStatus']=_0x1ef8f6['name'];if(_0x1ef8f6[_0xa58b('0x23')]){this[_0xa58b('0xb')][_0x512cb2]['Imap'][_0xa58b('0x14')]=_0x1ef8f6[_0xa58b('0x23')][_0xa58b('0x14')];}return this['emit'](_0x512cb2);}};EmailChannel[_0xa58b('0xd')][_0xa58b('0x1d')]=function(_0x1fe24e,_0xff69c9){logger[_0xa58b('0x24')](_0xa58b('0x25'),_0xff69c9['firstName'],_0xff69c9[_0xa58b('0x26')],_0xff69c9[_0xa58b('0x27')],_0x1fe24e);if(this[_0xa58b('0xb')][_0x1fe24e]){return mailAccount['notify'](_0x1fe24e,_0xff69c9)[_0xa58b('0x28')](function(_0x4ae3b9){if(_0x4ae3b9){logger[_0xa58b('0x24')](_0xa58b('0x29'));}})[_0xa58b('0x2a')](function(_0x95a41b){logger[_0xa58b('0x20')](_0xa58b('0x2b'),JSON[_0xa58b('0x16')](_0x95a41b));});}};EmailChannel[_0xa58b('0xd')]['handleImapEnd']=function(_0x50aaae){if(this['mailAccounts'][_0x50aaae]&&this[_0xa58b('0xb')][_0x50aaae][_0xa58b('0x12')]){if(this[_0xa58b('0xc')][this[_0xa58b('0xb')][_0x50aaae][_0xa58b('0x12')]['id']]){delete this[_0xa58b('0xc')][this[_0xa58b('0xb')][_0x50aaae]['Imap']['id']];}this['mailAccounts'][_0x50aaae][_0xa58b('0x12')][_0xa58b('0x2c')]=moment();this['emit'](_0x50aaae);}};EmailChannel[_0xa58b('0xd')][_0xa58b('0x21')]=function(_0x5cbb1e,_0x2e1af6){if(this[_0xa58b('0xb')][_0x5cbb1e]){this[_0xa58b('0xb')][_0x5cbb1e][_0xa58b('0x12')]['status']=_0xa58b('0x20');this[_0xa58b('0xb')][_0x5cbb1e][_0xa58b('0x12')]['messageStatus']=_0x2e1af6;return this[_0xa58b('0xe')](_0x5cbb1e);}};EmailChannel['prototype']['sendMail']=function(_0x4824a3,_0x581ea9){return this[_0xa58b('0x2d')][_0xa58b('0x2e')](_0x4824a3,_0x581ea9);};EmailChannel['prototype']['verifySmtp']=function(_0x225b9f){var _0x527ab9=this;if(this[_0xa58b('0xb')][_0x225b9f['id']]){if(_[_0xa58b('0x15')](this[_0xa58b('0xb')][_0x225b9f['id']][_0xa58b('0x2f')])){this['mailAccounts'][_0x225b9f['id']][_0xa58b('0x2f')]={};}this[_0xa58b('0xb')][_0x225b9f['id']][_0xa58b('0x2f')][_0xa58b('0x2c')]=moment();return new BPromise(function(_0x23d80f,_0x58d310){return _0x527ab9[_0xa58b('0x2d')][_0xa58b('0x30')](_0x225b9f)[_0xa58b('0x28')](function(_0x3d57b0){_0x527ab9[_0xa58b('0xb')][_0x225b9f['id']]['Smtp'][_0xa58b('0x11')]=_0xa58b('0x31');_0x527ab9[_0xa58b('0xb')][_0x225b9f['id']][_0xa58b('0x2f')]['messageStatus']='';_0x527ab9['emit'](_0x225b9f['id']);_0x23d80f(_0x3d57b0);})[_0xa58b('0x2a')](function(_0x1528d2){_0x527ab9['mailAccounts'][_0x225b9f['id']]['Smtp'][_0xa58b('0x11')]=_0xa58b('0x20');_0x527ab9[_0xa58b('0xb')][_0x225b9f['id']][_0xa58b('0x2f')]['messageStatus']=_0x1528d2;_0x527ab9[_0xa58b('0xe')](_0x225b9f['id']);_0x58d310(_0x1528d2);});});}return this[_0xa58b('0x2d')][_0xa58b('0x30')](_0x225b9f);};module[_0xa58b('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 6efdadb..52a6b1a 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 _0x4a4f=['util','imap','lodash','randomstring','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','bind','once','end','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','handleReady','handleOpenBox','emit','box','readUnseen','prototype','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path'];(function(_0x1bd106,_0x29dcbe){var _0x231dbb=function(_0x3638d7){while(--_0x3638d7){_0x1bd106['push'](_0x1bd106['shift']());}};_0x231dbb(++_0x29dcbe);}(_0x4a4f,0xc2));var _0xf4a4=function(_0x216849,_0x594806){_0x216849=_0x216849-0x0;var _0x4359b6=_0x4a4f[_0x216849];return _0x4359b6;};'use strict';var fs=require('fs');var path=require(_0xf4a4('0x0'));var util=require(_0xf4a4('0x1'));var Imap=require(_0xf4a4('0x2'));var _=require(_0xf4a4('0x3'));var rs=require(_0xf4a4('0x4'));var simpleParser=require(_0xf4a4('0x5'))[_0xf4a4('0x6')];var Iconv=require(_0xf4a4('0x7'))['Iconv'];var EventEmitter=require(_0xf4a4('0x8'))['EventEmitter'];var utils=require(_0xf4a4('0x9'));var logger=require(_0xf4a4('0xa'))(_0xf4a4('0xb'));function EmailImap(_0x2b6d2b,_0x2a4503){this[_0xf4a4('0xc')]=_0xf4a4('0xd');this[_0xf4a4('0xe')]=this[_0xf4a4('0xf')](_0x2b6d2b,_0x2a4503);this[_0xf4a4('0x2')]=new Imap(this[_0xf4a4('0xe')]);this['imap']['once']('ready',this['handleReady'][_0xf4a4('0x10')](this));this[_0xf4a4('0x2')][_0xf4a4('0x11')](_0xf4a4('0x12'),this[_0xf4a4('0x13')][_0xf4a4('0x10')](this));this['imap']['on'](_0xf4a4('0x14'),this[_0xf4a4('0x15')][_0xf4a4('0x10')](this));this[_0xf4a4('0x2')][_0xf4a4('0x16')]();}util[_0xf4a4('0x17')](EmailImap,EventEmitter);EmailImap['prototype'][_0xf4a4('0xf')]=function(_0x185761,_0x52ef02){var _0x1542b5={'connTimeout':_0x185761['connTimeout']?_0x185761[_0xf4a4('0x18')]*0x3e8:0x2710,'authTimeout':_0x185761['authTimeout']?_0x185761[_0xf4a4('0x19')]*0x3e8:0x1388};if(_[_0xf4a4('0x1a')](_0x185761[_0xf4a4('0x1b')])){if(_0x185761[_0xf4a4('0x1c')]){_0x1542b5[_0xf4a4('0x1d')]=_0x185761[_0xf4a4('0x1d')];_0x1542b5[_0xf4a4('0x1e')]=_0x185761[_0xf4a4('0x1e')];}_0x1542b5['host']=_0x185761[_0xf4a4('0x1f')];_0x1542b5[_0xf4a4('0x20')]=_0x185761[_0xf4a4('0x20')]||0x3e1;if(_0x185761[_0xf4a4('0x21')]){_0x1542b5[_0xf4a4('0x21')]=!![];}else{_0x1542b5[_0xf4a4('0x21')]=![];_0x1542b5[_0xf4a4('0x22')]=_0xf4a4('0x23');}}else{_0x1542b5['user']=_0x185761[_0xf4a4('0x1d')];_0x1542b5['password']=_0x185761[_0xf4a4('0x1e')];_0x1542b5['host']=utils[_0xf4a4('0x24')](_0x185761['service']);_0x1542b5[_0xf4a4('0x20')]=0x3e1;_0x1542b5[_0xf4a4('0x21')]=!![];}_0x1542b5[_0xf4a4('0xb')]=_0x52ef02||_0x185761[_0xf4a4('0x1d')]||_0xf4a4('0x25');return _0x1542b5;};EmailImap['prototype'][_0xf4a4('0x26')]=function(){this[_0xf4a4('0x2')]['openBox'](this[_0xf4a4('0xc')],![],this['handleOpenBox'][_0xf4a4('0x10')](this));};EmailImap['prototype'][_0xf4a4('0x27')]=function(_0xff3b32,_0x403d58){if(_0xff3b32){this['handleError'](_0xff3b32,!![]);}else{this[_0xf4a4('0x28')](_0xf4a4('0x29'),_0x403d58);this[_0xf4a4('0x2a')]();}};EmailImap[_0xf4a4('0x2b')][_0xf4a4('0x2c')]=function(_0x124e47){if(_0x124e47){this[_0xf4a4('0x15')](_0x124e47,!![]);}else{this[_0xf4a4('0x2')][_0xf4a4('0x12')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xf4a4('0x2')][_0xf4a4('0x2d')]([_0xf4a4('0x2e')],this[_0xf4a4('0x2f')][_0xf4a4('0x10')](this));};EmailImap[_0xf4a4('0x2b')]['handleReadUnseen']=function(_0x522cbe,_0x3d257b){if(_0x522cbe){this[_0xf4a4('0x15')](_0x522cbe,!![]);}else{if(_0x3d257b[_0xf4a4('0x30')]){try{var _0x2c584d=this[_0xf4a4('0x2')]['fetch'](_0x3d257b,{'bodies':'','markSeen':!![]});_0x2c584d['on'](_0xf4a4('0x31'),this[_0xf4a4('0x32')][_0xf4a4('0x10')](this));_0x2c584d['once'](_0xf4a4('0x14'),this['handleFetchError']['bind'](this));_0x2c584d[_0xf4a4('0x11')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x402c12){logger[_0xf4a4('0x14')](_0x402c12);}}else{this[_0xf4a4('0x2')][_0xf4a4('0x33')](!![],this[_0xf4a4('0x2c')][_0xf4a4('0x10')](this));}}};EmailImap[_0xf4a4('0x2b')][_0xf4a4('0x32')]=function(_0x372250,_0x1a74da){_0x372250['on'](_0xf4a4('0x34'),this['handleMessageBody']['bind'](this));_0x372250[_0xf4a4('0x11')](_0xf4a4('0x35'),this['handleMessageAttributes']['bind'](this));_0x372250[_0xf4a4('0x11')](_0xf4a4('0x12'),this[_0xf4a4('0x36')][_0xf4a4('0x10')](this));};EmailImap[_0xf4a4('0x2b')][_0xf4a4('0x37')]=function(_0x45987c,_0x5546fd){simpleParser(_0x45987c,{'Iconv':Iconv},this[_0xf4a4('0x38')]['bind'](this));};EmailImap[_0xf4a4('0x2b')][_0xf4a4('0x39')]=function(_0x408ba0){};EmailImap['prototype'][_0xf4a4('0x36')]=function(){};EmailImap['prototype'][_0xf4a4('0x38')]=function(_0x541b8c,_0x465b69){if(_0x541b8c){logger[_0xf4a4('0x14')](_0x541b8c);}else{var _0x58fd0a=this;utils[_0xf4a4('0x3a')](this[_0xf4a4('0xe')],_0x465b69,function(_0x22b154){_0x58fd0a['emit']('email',_0x22b154);});}};EmailImap[_0xf4a4('0x2b')][_0xf4a4('0x3b')]=function(){this[_0xf4a4('0x2')][_0xf4a4('0x33')](!![],this[_0xf4a4('0x2c')][_0xf4a4('0x10')](this));};EmailImap[_0xf4a4('0x2b')]['handleFetchError']=function(_0x559cf2){this[_0xf4a4('0x15')](_0x559cf2);this['imap'][_0xf4a4('0x33')](!![],this[_0xf4a4('0x2c')]['bind'](this));};EmailImap[_0xf4a4('0x2b')][_0xf4a4('0x13')]=function(){this['emit']('end');};EmailImap[_0xf4a4('0x2b')][_0xf4a4('0x15')]=function(_0x18f2fa,_0x4dc023){logger['error'](_0xf4a4('0x15'),this[_0xf4a4('0xe')][_0xf4a4('0xb')],JSON[_0xf4a4('0x3c')](_0x18f2fa));var _0x1d7f85='';if(_0x18f2fa){if(_0x18f2fa[_0xf4a4('0x3d')]){_0x1d7f85=_0x18f2fa[_0xf4a4('0x3d')];}else{for(var _0x540b9a in _0x18f2fa){if(_0x18f2fa[_0xf4a4('0x3e')](_0x540b9a)){_0x1d7f85+=_[_0xf4a4('0x3f')](_0x540b9a)+':\x20'+_0x18f2fa[_0x540b9a]+'\x0a';}}}}if(_0x4dc023){this[_0xf4a4('0x2')][_0xf4a4('0x12')]();}else{this[_0xf4a4('0x28')]('error',_0x1d7f85);this['emit'](_0xf4a4('0x12'));}};module[_0xf4a4('0x40')]=EmailImap; \ No newline at end of file +var _0x31c7=['email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls','required','anonymous@xcally.com','prototype','handleOpenBox','handleError','emit','handleCloseBox','readUnseen','search','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleFetchEnd','closeBox','stringify','textCode','upperFirst','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils'];(function(_0xf329b9,_0x926c36){var _0x2c2b0f=function(_0x2b0a85){while(--_0x2b0a85){_0xf329b9['push'](_0xf329b9['shift']());}};_0x2c2b0f(++_0x926c36);}(_0x31c7,0xd2));var _0x731c=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x31c7[_0x2070da];return _0x4f9fe1;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x731c('0x0'));var Imap=require(_0x731c('0x1'));var _=require(_0x731c('0x2'));var rs=require(_0x731c('0x3'));var simpleParser=require(_0x731c('0x4'))[_0x731c('0x5')];var Iconv=require(_0x731c('0x6'))[_0x731c('0x7')];var EventEmitter=require(_0x731c('0x8'))['EventEmitter'];var utils=require(_0x731c('0x9'));var logger=require('../../../config/logger')(_0x731c('0xa'));function EmailImap(_0x54ee93,_0x4be2b0){this[_0x731c('0xb')]='INBOX';this[_0x731c('0xc')]=this[_0x731c('0xd')](_0x54ee93,_0x4be2b0);this[_0x731c('0x1')]=new Imap(this[_0x731c('0xc')]);this[_0x731c('0x1')][_0x731c('0xe')](_0x731c('0xf'),this[_0x731c('0x10')][_0x731c('0x11')](this));this[_0x731c('0x1')][_0x731c('0xe')](_0x731c('0x12'),this[_0x731c('0x13')][_0x731c('0x11')](this));this[_0x731c('0x1')]['on'](_0x731c('0x14'),this['handleError'][_0x731c('0x11')](this));this[_0x731c('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x731c('0xd')]=function(_0x2ab877,_0x202df0){var _0x462f14={'connTimeout':_0x2ab877[_0x731c('0x15')]?_0x2ab877[_0x731c('0x15')]*0x3e8:0x2710,'authTimeout':_0x2ab877['authTimeout']?_0x2ab877[_0x731c('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x2ab877[_0x731c('0x17')])){if(_0x2ab877[_0x731c('0x18')]){_0x462f14[_0x731c('0x19')]=_0x2ab877['user'];_0x462f14['password']=_0x2ab877[_0x731c('0x1a')];}_0x462f14[_0x731c('0x1b')]=_0x2ab877[_0x731c('0x1b')];_0x462f14[_0x731c('0x1c')]=_0x2ab877[_0x731c('0x1c')]||0x3e1;if(_0x2ab877[_0x731c('0x1d')]){_0x462f14[_0x731c('0x1d')]=!![];}else{_0x462f14['tls']=![];_0x462f14[_0x731c('0x1e')]=_0x731c('0x1f');}}else{_0x462f14[_0x731c('0x19')]=_0x2ab877[_0x731c('0x19')];_0x462f14[_0x731c('0x1a')]=_0x2ab877['password'];_0x462f14[_0x731c('0x1b')]=utils['getHost'](_0x2ab877[_0x731c('0x17')]);_0x462f14[_0x731c('0x1c')]=0x3e1;_0x462f14[_0x731c('0x1d')]=!![];}_0x462f14[_0x731c('0xa')]=_0x202df0||_0x2ab877[_0x731c('0x19')]||_0x731c('0x20');return _0x462f14;};EmailImap[_0x731c('0x21')]['handleReady']=function(){this['imap']['openBox'](this['mailbox'],![],this[_0x731c('0x22')][_0x731c('0x11')](this));};EmailImap[_0x731c('0x21')][_0x731c('0x22')]=function(_0x21ee1e,_0x25dda0){if(_0x21ee1e){this[_0x731c('0x23')](_0x21ee1e,!![]);}else{this[_0x731c('0x24')]('box',_0x25dda0);this['readUnseen']();}};EmailImap[_0x731c('0x21')][_0x731c('0x25')]=function(_0x2978cd){if(_0x2978cd){this[_0x731c('0x23')](_0x2978cd,!![]);}else{this[_0x731c('0x1')][_0x731c('0x12')]();}};EmailImap[_0x731c('0x21')][_0x731c('0x26')]=function(){this['imap'][_0x731c('0x27')](['UNSEEN'],this[_0x731c('0x28')][_0x731c('0x11')](this));};EmailImap[_0x731c('0x21')][_0x731c('0x28')]=function(_0x1432d8,_0x12e6e4){if(_0x1432d8){this['handleError'](_0x1432d8,!![]);}else{if(_0x12e6e4[_0x731c('0x29')]){try{var _0x49c65d=this[_0x731c('0x1')][_0x731c('0x2a')](_0x12e6e4,{'bodies':'','markSeen':!![]});_0x49c65d['on']('message',this[_0x731c('0x2b')]['bind'](this));_0x49c65d[_0x731c('0xe')]('error',this[_0x731c('0x2c')]['bind'](this));_0x49c65d['once'](_0x731c('0x12'),this['handleFetchEnd'][_0x731c('0x11')](this));}catch(_0x4d457d){logger[_0x731c('0x14')](_0x4d457d);}}else{this['imap']['closeBox'](!![],this['handleCloseBox']['bind'](this));}}};EmailImap['prototype'][_0x731c('0x2b')]=function(_0x196a4f,_0x3d1710){_0x196a4f['on'](_0x731c('0x2d'),this[_0x731c('0x2e')][_0x731c('0x11')](this));_0x196a4f[_0x731c('0xe')](_0x731c('0x2f'),this[_0x731c('0x30')][_0x731c('0x11')](this));_0x196a4f[_0x731c('0xe')](_0x731c('0x12'),this[_0x731c('0x31')]['bind'](this));};EmailImap[_0x731c('0x21')][_0x731c('0x2e')]=function(_0x457e51,_0x40b23b){simpleParser(_0x457e51,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x731c('0x21')][_0x731c('0x30')]=function(_0x3907e3){};EmailImap[_0x731c('0x21')]['handleMessageEnd']=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x1a699d,_0x148073){if(_0x1a699d){logger[_0x731c('0x14')](_0x1a699d);}else{var _0xa3602=this;utils['parser'](this['account'],_0x148073,function(_0x49d361){_0xa3602['emit'](_0x731c('0xa'),_0x49d361);});}};EmailImap[_0x731c('0x21')][_0x731c('0x32')]=function(){this[_0x731c('0x1')][_0x731c('0x33')](!![],this[_0x731c('0x25')]['bind'](this));};EmailImap[_0x731c('0x21')][_0x731c('0x2c')]=function(_0x3c25c7){this['handleError'](_0x3c25c7);this[_0x731c('0x1')][_0x731c('0x33')](!![],this[_0x731c('0x25')][_0x731c('0x11')](this));};EmailImap[_0x731c('0x21')][_0x731c('0x13')]=function(){this[_0x731c('0x24')](_0x731c('0x12'));};EmailImap['prototype']['handleError']=function(_0x229a8e,_0x452366){logger[_0x731c('0x14')]('handleError',this[_0x731c('0xc')]['email'],JSON[_0x731c('0x34')](_0x229a8e));var _0x4aa3a6='';if(_0x229a8e){if(_0x229a8e[_0x731c('0x35')]){_0x4aa3a6=_0x229a8e[_0x731c('0x35')];}else{for(var _0xba67b in _0x229a8e){if(_0x229a8e['hasOwnProperty'](_0xba67b)){_0x4aa3a6+=_[_0x731c('0x36')](_0xba67b)+':\x20'+_0x229a8e[_0xba67b]+'\x0a';}}}}if(_0x452366){this[_0x731c('0x1')][_0x731c('0x12')]();}else{this[_0x731c('0x24')](_0x731c('0x14'),_0x4aa3a6);this[_0x731c('0x24')](_0x731c('0x12'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4bea161..aa8696e 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 _0xf79b=['createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x34cc65,_0x1afeea){var _0x25674a=function(_0x4e7206){while(--_0x4e7206){_0x34cc65['push'](_0x34cc65['shift']());}};_0x25674a(++_0x1afeea);}(_0xf79b,0x10c));var _0xbf79=function(_0x4be337,_0x1209a5){_0x4be337=_0x4be337-0x0;var _0x2871f8=_0xf79b[_0x4be337];return _0x2871f8;};'use strict';var nodemailer=require(_0xbf79('0x0'));var BPromise=require(_0xbf79('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x2b70b0,_0x54dada){return new BPromise(function(_0x43fd91,_0x31bcfc){var _0x1e998d=nodemailer[_0xbf79('0x2')](_0x2b70b0);_0x1e998d['use'](_0xbf79('0x3'),inlineBase64());_0x1e998d[_0xbf79('0x4')](_0x54dada,function(_0x40ad4b,_0x5bf228){if(_0x40ad4b){_0x31bcfc(_0x40ad4b[_0xbf79('0x5')]());}else{_0x43fd91(_0x5bf228);}});});};EmailSmtp['prototype'][_0xbf79('0x6')]=function(_0x290e87){return new BPromise(function(_0x40b39c,_0x3c6c39){var _0x2c4b65=nodemailer[_0xbf79('0x2')](_0x290e87);_0x2c4b65[_0xbf79('0x6')](function(_0x379375,_0x5d4158){if(_0x379375){_0x3c6c39(_0x379375['toString']());}else{if(_0x5d4158){_0x40b39c(_0x5d4158);}else{_0x3c6c39(_0xbf79('0x7'));}}});});};module[_0xbf79('0x8')]=EmailSmtp; \ No newline at end of file +var _0x765c=['nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString','verify','createTransport','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x3888e3,_0x13e153){var _0x47bdfd=function(_0x403ebd){while(--_0x403ebd){_0x3888e3['push'](_0x3888e3['shift']());}};_0x47bdfd(++_0x13e153);}(_0x765c,0x1ab));var _0xc765=function(_0x5df728,_0x55f5a4){_0x5df728=_0x5df728-0x0;var _0x34176f=_0x765c[_0x5df728];return _0x34176f;};'use strict';var nodemailer=require(_0xc765('0x0'));var BPromise=require(_0xc765('0x1'));var inlineBase64=require(_0xc765('0x2'));function EmailSmtp(){}EmailSmtp[_0xc765('0x3')][_0xc765('0x4')]=function(_0x139ad0,_0x4c2b91){return new BPromise(function(_0x39c05c,_0x56a687){var _0x123256=nodemailer['createTransport'](_0x139ad0);_0x123256[_0xc765('0x5')](_0xc765('0x6'),inlineBase64());_0x123256[_0xc765('0x7')](_0x4c2b91,function(_0x114253,_0x349c14){if(_0x114253){_0x56a687(_0x114253[_0xc765('0x8')]());}else{_0x39c05c(_0x349c14);}});});};EmailSmtp[_0xc765('0x3')][_0xc765('0x9')]=function(_0x283870){return new BPromise(function(_0x24c1e0,_0x24e1e9){var _0x471a84=nodemailer[_0xc765('0xa')](_0x283870);_0x471a84[_0xc765('0x9')](function(_0x2e105d,_0x2b6c49){if(_0x2e105d){_0x24e1e9(_0x2e105d['toString']());}else{if(_0x2b6c49){_0x24c1e0(_0x2b6c49);}else{_0x24e1e9(_0xc765('0xb'));}}});});};module[_0xc765('0xc')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 25e4a40..570062f 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 _0x08d5=['textAsHtml','Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','path','util','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','join','Anonymous','pop','html','test','replace','body'];(function(_0x296699,_0x1e962f){var _0x160e52=function(_0x571d72){while(--_0x571d72){_0x296699['push'](_0x296699['shift']());}};_0x160e52(++_0x1e962f);}(_0x08d5,0xa8));var _0x508d=function(_0x45e47a,_0x2e0b37){_0x45e47a=_0x45e47a-0x0;var _0x5b0492=_0x08d5[_0x45e47a];return _0x5b0492;};'use strict';var _=require('lodash');var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0x508d('0x0'));var util=require(_0x508d('0x1'));var tnef=require('node-tnef');var logger=require(_0x508d('0x2'))(_0x508d('0x3'));var config=require('../../../config/environment');function getAddress(_0x1c7537){var _0x263f86=_[_0x508d('0x4')](_0x1c7537[_0x508d('0x5')]);return _0x263f86&&_0x263f86[_0x508d('0x6')]?_0x263f86['address']:_0x508d('0x7')+random[_0x508d('0x8')](0x6)+_0x508d('0x9');}function getFirstName(_0x542d22){var _0x5331c8=_[_0x508d('0x4')](_0x542d22['value']);if(_0x5331c8&&_0x5331c8[_0x508d('0xa')]){var _0x928838=_0x5331c8['name'][_0x508d('0xb')](/\s+/);return _0x928838[_0x508d('0xc')]?_0x928838[_0x508d('0xd')](0x0,-0x1)[_0x508d('0xe')]('\x20'):_0x5331c8['name'];}return _0x508d('0xf');}function getLastName(_0x19af01){var _0x1fa66d=_['head'](_0x19af01[_0x508d('0x5')]);if(_0x1fa66d&&_0x1fa66d[_0x508d('0xa')]){var _0x3eab93=_0x1fa66d[_0x508d('0xa')][_0x508d('0xb')](/\s+/);return _0x3eab93[_0x508d('0xc')]>0x1?_0x3eab93[_0x508d('0x10')]():'';}return'';}function getMails(_0xdfe234,_0x4f9dc3){var _0x12d24f='';for(var _0x1faa82=0x0;_0x1faa82<_0x4f9dc3['value'][_0x508d('0xc')];_0x1faa82+=0x1){if(_0x4f9dc3[_0x508d('0x5')][_0x1faa82][_0x508d('0x6')]!==_0xdfe234){if(!_['isEmpty'](_0x12d24f)){_0x12d24f+=',';}_0x12d24f+=_0x4f9dc3['value'][_0x1faa82]['name']||_0x4f9dc3[_0x508d('0x5')][_0x1faa82][_0x508d('0x6')]||'';_0x12d24f+='\x20<';_0x12d24f+=_0x4f9dc3[_0x508d('0x5')][_0x1faa82][_0x508d('0x6')]?_0x4f9dc3[_0x508d('0x5')][_0x1faa82][_0x508d('0x6')]:_0x508d('0x7')+random[_0x508d('0x8')](0x6)+_0x508d('0x9');_0x12d24f+='>';}}return _0x12d24f;}function parseEmail(_0x17d477,_0x398235,_0x3beec8){if(_0x398235[_0x508d('0x11')]){var _0x547234=/)<[^<]*)*<\/script>/gi;while(_0x547234[_0x508d('0x12')](_0x398235[_0x508d('0x11')])){_0x398235[_0x508d('0x11')]=_0x398235[_0x508d('0x11')][_0x508d('0x13')](_0x547234,'');}_0x3beec8[_0x508d('0x14')]=_0x398235[_0x508d('0x11')];}else{_0x3beec8['body']=_0x398235[_0x508d('0x15')];}if(_0x3beec8[_0x508d('0x14')]){_0x3beec8[_0x508d('0x14')]=_0x3beec8['body'][_0x508d('0x13')](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','pop','isEmpty','html','test','replace'];(function(_0x27c867,_0x4c5547){var _0x2349cd=function(_0x5f202f){while(--_0x5f202f){_0x27c867['push'](_0x27c867['shift']());}};_0x2349cd(++_0x4c5547);}(_0xcc25,0x67));var _0x5cc2=function(_0x1c69ef,_0x4f0157){_0x1c69ef=_0x1c69ef-0x0;var _0x28d848=_0xcc25[_0x1c69ef];return _0x28d848;};'use strict';var _=require('lodash');var moment=require(_0x5cc2('0x0'));var random=require(_0x5cc2('0x1'));var fs=require('fs');var path=require(_0x5cc2('0x2'));var util=require(_0x5cc2('0x3'));var tnef=require(_0x5cc2('0x4'));var logger=require(_0x5cc2('0x5'))(_0x5cc2('0x6'));var config=require(_0x5cc2('0x7'));function getAddress(_0x17de01){var _0x2d0e18=_[_0x5cc2('0x8')](_0x17de01[_0x5cc2('0x9')]);return _0x2d0e18&&_0x2d0e18[_0x5cc2('0xa')]?_0x2d0e18[_0x5cc2('0xa')]:_0x5cc2('0xb')+random[_0x5cc2('0xc')](0x6)+_0x5cc2('0xd');}function getFirstName(_0xa4f973){var _0x4f54e8=_['head'](_0xa4f973[_0x5cc2('0x9')]);if(_0x4f54e8&&_0x4f54e8[_0x5cc2('0xe')]){var _0x135bdb=_0x4f54e8[_0x5cc2('0xe')][_0x5cc2('0xf')](/\s+/);return _0x135bdb[_0x5cc2('0x10')]?_0x135bdb[_0x5cc2('0x11')](0x0,-0x1)['join']('\x20'):_0x4f54e8['name'];}return'Anonymous';}function getLastName(_0x46ec20){var _0x41d1ad=_[_0x5cc2('0x8')](_0x46ec20[_0x5cc2('0x9')]);if(_0x41d1ad&&_0x41d1ad[_0x5cc2('0xe')]){var _0x12d4b4=_0x41d1ad[_0x5cc2('0xe')][_0x5cc2('0xf')](/\s+/);return _0x12d4b4[_0x5cc2('0x10')]>0x1?_0x12d4b4[_0x5cc2('0x12')]():'';}return'';}function getMails(_0x4605b7,_0x1e751b){var _0x4b2f82='';for(var _0x25b5f0=0x0;_0x25b5f0<_0x1e751b['value'][_0x5cc2('0x10')];_0x25b5f0+=0x1){if(_0x1e751b[_0x5cc2('0x9')][_0x25b5f0][_0x5cc2('0xa')]!==_0x4605b7){if(!_[_0x5cc2('0x13')](_0x4b2f82)){_0x4b2f82+=',';}_0x4b2f82+=_0x1e751b[_0x5cc2('0x9')][_0x25b5f0][_0x5cc2('0xe')]||_0x1e751b['value'][_0x25b5f0]['address']||'';_0x4b2f82+='\x20<';_0x4b2f82+=_0x1e751b[_0x5cc2('0x9')][_0x25b5f0]['address']?_0x1e751b[_0x5cc2('0x9')][_0x25b5f0][_0x5cc2('0xa')]:_0x5cc2('0xb')+random['generate'](0x6)+_0x5cc2('0xd');_0x4b2f82+='>';}}return _0x4b2f82;}function parseEmail(_0x11525,_0x4d2a1d,_0x5431ef){if(_0x4d2a1d[_0x5cc2('0x14')]){var _0x1e8d5c=/)<[^<]*)*<\/script>/gi;while(_0x1e8d5c[_0x5cc2('0x15')](_0x4d2a1d['html'])){_0x4d2a1d[_0x5cc2('0x14')]=_0x4d2a1d[_0x5cc2('0x14')][_0x5cc2('0x16')](_0x1e8d5c,'');}_0x5431ef[_0x5cc2('0x17')]=_0x4d2a1d[_0x5cc2('0x14')];}else{_0x5431ef[_0x5cc2('0x17')]=_0x4d2a1d['textAsHtml'];}if(_0x5431ef[_0x5cc2('0x17')]){_0x5431ef[_0x5cc2('0x17')]=_0x5431ef[_0x5cc2('0x17')][_0x5cc2('0x16')](/0x0){if(this[_0x10d944+_0x5b87('0x20')]>0x0&&this[_0x10d944+_0x5b87('0x21')]>=this[_0x10d944+_0x5b87('0x20')]){return _0x5b87('0x22');}else{return _0x5b87('0x23');}}else{return _0x5b87('0x24');}};Agent[_0x5b87('0x25')][_0x5b87('0x26')]=function(){var _0x1dcaf4=[_0x5b87('0x27'),'chat',_0x5b87('0x28'),_0x5b87('0x29'),_0x5b87('0x2a'),_0x5b87('0x2b')];for(var _0x1cfb4b=0x0;_0x1cfb4b<_0x1dcaf4[_0x5b87('0x2c')];_0x1cfb4b+=0x1){var _0x2d8edf=this[_0x5b87('0x1f')](_0x1dcaf4[_0x1cfb4b]);if(this[_0x1dcaf4[_0x1cfb4b]+_0x5b87('0x2d')]!==_0x2d8edf){this[_0x1dcaf4[_0x1cfb4b]+_0x5b87('0x2e')]=_[_0x5b87('0x2f')](moment()['format']('x'));}this[_0x1dcaf4[_0x1cfb4b]+'Status']=_0x2d8edf;}var _0x1ca037={'id':this['id'],'name':this['name'],'online':this[_0x5b87('0x6')],'voicePause':this[_0x5b87('0x7')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x5b87('0xb')],'faxPause':this[_0x5b87('0xa')],'openchannelPause':this[_0x5b87('0x30')],'chatStatus':this[_0x5b87('0xc')],'chatStatusTime':this[_0x5b87('0x31')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x5b87('0xf')],'mailStatus':this[_0x5b87('0x10')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x5b87('0x12')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x5b87('0x32')],'faxStatusTime':this[_0x5b87('0x33')],'faxCapacity':this[_0x5b87('0x14')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x5b87('0x34')],'smsStatusTime':this[_0x5b87('0x35')],'smsCapacity':this[_0x5b87('0x15')],'smsCurrentCapacity':this[_0x5b87('0x16')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x5b87('0x36')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x5b87('0x1a')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x5b87('0x1c')],'busy':this[_0x5b87('0x1d')],'busyQueue':this['busyQueue']};var _0x2b9a2a=md5(JSON[_0x5b87('0x37')](_0x1ca037));if(this[_0x5b87('0x1e')]!==_0x2b9a2a){this[_0x5b87('0x1e')]=_0x2b9a2a;io['emit'](_0x5b87('0x38'),_0x1ca037);}};module[_0x5b87('0x39')]=Agent; \ No newline at end of file +var _0xbc9d=['lodash','moment','md5','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','CurrentCapacity','Capacity','working','idle','prototype','updateRealtime','mail','chat','openchannel','fax','whatsapp','length','getChannelStatus','StatusTime','toNumber','faxCurrentCapacity','smsStatusTime','busy','emit','user:save','exports'];(function(_0x28f323,_0x162d30){var _0x166aa5=function(_0x4fe808){while(--_0x4fe808){_0x28f323['push'](_0x28f323['shift']());}};_0x166aa5(++_0x162d30);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x231d9b,_0xcdd962){_0x231d9b=_0x231d9b-0x0;var _0x21a682=_0xbc9d[_0x231d9b];return _0x21a682;};'use strict';var _=require(_0xdbc9('0x0'));var moment=require(_0xdbc9('0x1'));var md5=require(_0xdbc9('0x2'));var Redis=require(_0xdbc9('0x3'));var config=require(_0xdbc9('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0xdbc9('0x5'),'port':0x18eb});var io=require(_0xdbc9('0x6'))(new Redis(config[_0xdbc9('0x7')]));function Agent(_0x4a32b4){this['id']=_0x4a32b4['id']||0x0;this[_0xdbc9('0x8')]=_0x4a32b4[_0xdbc9('0x8')]||'';this[_0xdbc9('0x9')]=_0x4a32b4['online']||!![];this[_0xdbc9('0xa')]=_0x4a32b4[_0xdbc9('0xa')]||![];this[_0xdbc9('0xb')]=_0x4a32b4['chatPause']||![];this[_0xdbc9('0xc')]=_0x4a32b4['mailPause']||![];this['faxPause']=_0x4a32b4[_0xdbc9('0xd')]||![];this[_0xdbc9('0xe')]=_0x4a32b4[_0xdbc9('0xe')]||![];this[_0xdbc9('0xf')]=_0x4a32b4['openchannelPause']||![];this[_0xdbc9('0x10')]=_0xdbc9('0x11');this[_0xdbc9('0x12')]=0x0;this[_0xdbc9('0x13')]=_0x4a32b4[_0xdbc9('0x13')]||0x0;this[_0xdbc9('0x14')]=0x0;this['mailStatus']='unknown';this[_0xdbc9('0x15')]=0x0;this[_0xdbc9('0x16')]=_0x4a32b4[_0xdbc9('0x16')]||0x0;this[_0xdbc9('0x17')]=0x0;this[_0xdbc9('0x18')]='unknown';this[_0xdbc9('0x19')]=0x0;this[_0xdbc9('0x1a')]=_0x4a32b4[_0xdbc9('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xdbc9('0x1b')]=_0xdbc9('0x11');this['smsStatusTime']=0x0;this[_0xdbc9('0x1c')]=_0x4a32b4[_0xdbc9('0x1c')]||0x0;this[_0xdbc9('0x1d')]=0x0;this[_0xdbc9('0x1e')]=_0xdbc9('0x11');this[_0xdbc9('0x1f')]=0x0;this[_0xdbc9('0x20')]=_0x4a32b4[_0xdbc9('0x20')]||0x0;this[_0xdbc9('0x21')]=0x0;this[_0xdbc9('0x22')]='unknown';this[_0xdbc9('0x23')]=0x0;this['openchannelCapacity']=_0x4a32b4[_0xdbc9('0x24')]||0x0;this[_0xdbc9('0x25')]=0x0;this['busy']=![];this[_0xdbc9('0x26')]=undefined;this['md5']='';this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x2f229c){if(this[_0x2f229c+_0xdbc9('0x27')]>0x0){if(this[_0x2f229c+'Capacity']>0x0&&this[_0x2f229c+_0xdbc9('0x27')]>=this[_0x2f229c+_0xdbc9('0x28')]){return'maxcapacity';}else{return _0xdbc9('0x29');}}else{return _0xdbc9('0x2a');}};Agent[_0xdbc9('0x2b')][_0xdbc9('0x2c')]=function(){var _0x3400e7=[_0xdbc9('0x2d'),_0xdbc9('0x2e'),_0xdbc9('0x2f'),_0xdbc9('0x30'),'sms',_0xdbc9('0x31')];for(var _0xe309ae=0x0;_0xe309ae<_0x3400e7[_0xdbc9('0x32')];_0xe309ae+=0x1){var _0x1053ca=this[_0xdbc9('0x33')](_0x3400e7[_0xe309ae]);if(this[_0x3400e7[_0xe309ae]+'Status']!==_0x1053ca){this[_0x3400e7[_0xe309ae]+_0xdbc9('0x34')]=_[_0xdbc9('0x35')](moment()['format']('x'));}this[_0x3400e7[_0xe309ae]+'Status']=_0x1053ca;}var _0x45aebe={'id':this['id'],'name':this[_0xdbc9('0x8')],'online':this[_0xdbc9('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0xdbc9('0xb')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xdbc9('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xdbc9('0x12')],'chatCapacity':this[_0xdbc9('0x13')],'chatCurrentCapacity':this[_0xdbc9('0x14')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xdbc9('0x15')],'mailCapacity':this[_0xdbc9('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xdbc9('0x19')],'faxCapacity':this[_0xdbc9('0x1a')],'faxCurrentCapacity':this[_0xdbc9('0x36')],'smsStatus':this[_0xdbc9('0x1b')],'smsStatusTime':this[_0xdbc9('0x37')],'smsCapacity':this[_0xdbc9('0x1c')],'smsCurrentCapacity':this[_0xdbc9('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xdbc9('0x1f')],'whatsappCapacity':this[_0xdbc9('0x20')],'whatsappCurrentCapacity':this[_0xdbc9('0x21')],'openchannelStatus':this[_0xdbc9('0x22')],'openchannelStatusTime':this[_0xdbc9('0x23')],'openchannelCapacity':this[_0xdbc9('0x24')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xdbc9('0x38')],'busyQueue':this['busyQueue']};var _0x4b0a16=md5(JSON['stringify'](_0x45aebe));if(this['md5']!==_0x4b0a16){this['md5']=_0x4b0a16;io[_0xdbc9('0x39')](_0xdbc9('0x3a'),_0x45aebe);}};module[_0xdbc9('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 3806ff9..71b0146 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 _0x8f3b=['waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','emit','exports','lodash','md5','util','ioredis','redis','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId'];(function(_0x4c5708,_0x34b1f9){var _0x37fa9b=function(_0x534dc4){while(--_0x534dc4){_0x4c5708['push'](_0x4c5708['shift']());}};_0x37fa9b(++_0x34b1f9);}(_0x8f3b,0x113));var _0xb8f3=function(_0x58a8a9,_0x343311){_0x58a8a9=_0x58a8a9-0x0;var _0x3f4ca1=_0x8f3b[_0x58a8a9];return _0x3f4ca1;};'use strict';var _=require(_0xb8f3('0x0'));var md5=require(_0xb8f3('0x1'));var util=require(_0xb8f3('0x2'));var Redis=require(_0xb8f3('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xb8f3('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xb8f3('0x5'))(new Redis(config[_0xb8f3('0x4')]));function ChatQueue(_0x4f6a3d){this['id']=_0x4f6a3d['id']||0x0;this[_0xb8f3('0x6')]=_0x4f6a3d['name']||'';this['timeout']=_0x4f6a3d['timeout']||0xa;this[_0xb8f3('0x7')]=_0x4f6a3d['strategy']||_0xb8f3('0x8');this[_0xb8f3('0x9')]=_0x4f6a3d[_0xb8f3('0x9')];this[_0xb8f3('0xa')]={};this[_0xb8f3('0xb')]=0x0;this[_0xb8f3('0x1')]='';this[_0xb8f3('0xc')]();this[_0xb8f3('0xd')]();}ChatQueue[_0xb8f3('0xe')][_0xb8f3('0xc')]=function(){var _0x1949e0=this[_0xb8f3('0xa')][_0xb8f3('0xf')];this[_0xb8f3('0xa')]=_['map'](this[_0xb8f3('0x9')],'id');this[_0xb8f3('0xa')][_0xb8f3('0xf')]=_0x1949e0;};ChatQueue[_0xb8f3('0xe')][_0xb8f3('0xd')]=function(){this[_0xb8f3('0x10')]=0x0;this[_0xb8f3('0x11')]=0x0;for(var _0x4dc5f8=0x0;_0x4dc5f8=0x0?this['available']:0x0;var _0x3c708d={'id':this['id'],'available':this[_0xb8f3('0x15')],'loggedIn':this[_0xb8f3('0x10')],'name':this['name'],'paused':this[_0xb8f3('0x11')],'waiting':this['waiting']};var _0x313853=md5(JSON[_0xb8f3('0x16')](_0x3c708d));if(this['md5']!==_0x313853){this[_0xb8f3('0x1')]=_0x313853;io['to'](util[_0xb8f3('0x17')]('chat:queue:%s',_0x3c708d[_0xb8f3('0x6')]))[_0xb8f3('0x18')]('chat_queue:save',_0x3c708d);}};module[_0xb8f3('0x19')]=ChatQueue; \ No newline at end of file +var _0xdc02=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','chatPause','available','format','emit','chat_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x1cb4ad,_0x43db46){var _0x1f3593=function(_0x2ecfcc){while(--_0x2ecfcc){_0x1cb4ad['push'](_0x1cb4ad['shift']());}};_0x1f3593(++_0x43db46);}(_0xdc02,0x118));var _0x2dc0=function(_0x2ee974,_0x1cceb5){_0x2ee974=_0x2ee974-0x0;var _0x20c5fb=_0xdc02[_0x2ee974];return _0x20c5fb;};'use strict';var _=require(_0x2dc0('0x0'));var md5=require(_0x2dc0('0x1'));var util=require('util');var Redis=require(_0x2dc0('0x2'));var config=require(_0x2dc0('0x3'));config[_0x2dc0('0x4')]=_[_0x2dc0('0x5')](config['redis'],{'host':_0x2dc0('0x6'),'port':0x18eb});var io=require(_0x2dc0('0x7'))(new Redis(config[_0x2dc0('0x4')]));function ChatQueue(_0x29a1b0){this['id']=_0x29a1b0['id']||0x0;this[_0x2dc0('0x8')]=_0x29a1b0[_0x2dc0('0x8')]||'';this[_0x2dc0('0x9')]=_0x29a1b0[_0x2dc0('0x9')]||0xa;this['strategy']=_0x29a1b0[_0x2dc0('0xa')]||_0x2dc0('0xb');this[_0x2dc0('0xc')]=_0x29a1b0[_0x2dc0('0xc')];this[_0x2dc0('0xd')]={};this[_0x2dc0('0xe')]=0x0;this['md5']='';this[_0x2dc0('0xf')]();this[_0x2dc0('0x10')]();}ChatQueue['prototype'][_0x2dc0('0xf')]=function(){var _0x8ca389=this[_0x2dc0('0xd')][_0x2dc0('0x11')];this[_0x2dc0('0xd')]=_[_0x2dc0('0x12')](this[_0x2dc0('0xc')],'id');this[_0x2dc0('0xd')][_0x2dc0('0x11')]=_0x8ca389;};ChatQueue[_0x2dc0('0x13')][_0x2dc0('0x10')]=function(){this[_0x2dc0('0x14')]=0x0;this[_0x2dc0('0x15')]=0x0;for(var _0x1f941d=0x0;_0x1f941d=0x0?this[_0x2dc0('0x19')]:0x0;var _0x3ea85d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2dc0('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x2dc0('0xe')]};var _0x35fef5=md5(JSON['stringify'](_0x3ea85d));if(this['md5']!==_0x35fef5){this[_0x2dc0('0x1')]=_0x35fef5;io['to'](util[_0x2dc0('0x1a')]('chat:queue:%s',_0x3ea85d[_0x2dc0('0x8')]))[_0x2dc0('0x1b')](_0x2dc0('0x1c'),_0x3ea85d);}};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 97ace39..733553b 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(_0xf57d07,_0x1a966b){var _0x1eabb0=function(_0xe0e574){while(--_0xe0e574){_0xf57d07['push'](_0xf57d07['shift']());}};_0x1eabb0(++_0x1a966b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x4a092a,_0xe64422){var _0x2df711=function(_0x137c1c){while(--_0x137c1c){_0x4a092a['push'](_0x4a092a['shift']());}};_0x2df711(++_0xe64422);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 a64f86d..5da18a2 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 _0x2b6c=['exports','name','Intervals'];(function(_0x3a6d5c,_0x3070c2){var _0x32dff9=function(_0x115619){while(--_0x115619){_0x3a6d5c['push'](_0x3a6d5c['shift']());}};_0x32dff9(++_0x3070c2);}(_0x2b6c,0x178));var _0xc2b6=function(_0x2ece52,_0x538ee5){_0x2ece52=_0x2ece52-0x0;var _0x585ea8=_0x2b6c[_0x2ece52];return _0x585ea8;};'use strict';function Interval(_0x2ef900){this['id']=_0x2ef900['id']||0x0;this[_0xc2b6('0x0')]=_0x2ef900[_0xc2b6('0x0')]||'';this[_0xc2b6('0x1')]=_0x2ef900[_0xc2b6('0x1')]||{};}module[_0xc2b6('0x2')]=Interval; \ No newline at end of file +var _0x1e22=['name','Intervals'];(function(_0x1b04ab,_0x2b45e6){var _0x499606=function(_0xf2cac9){while(--_0xf2cac9){_0x1b04ab['push'](_0x1b04ab['shift']());}};_0x499606(++_0x2b45e6);}(_0x1e22,0x1aa));var _0x21e2=function(_0x50eab9,_0x1a6d00){_0x50eab9=_0x50eab9-0x0;var _0x102a2f=_0x1e22[_0x50eab9];return _0x102a2f;};'use strict';function Interval(_0x1f4b7d){this['id']=_0x1f4b7d['id']||0x0;this[_0x21e2('0x0')]=_0x1f4b7d[_0x21e2('0x0')]||'';this[_0x21e2('0x1')]=_0x1f4b7d[_0x21e2('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 3951211..ca51b2a 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 _0xf604=['loggedIn','paused','online','available','waiting','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x245bd2,_0x1c5a6f){var _0x35c770=function(_0x360818){while(--_0x360818){_0x245bd2['push'](_0x245bd2['shift']());}};_0x35c770(++_0x1c5a6f);}(_0xf604,0x122));var _0x4f60=function(_0x46bec2,_0x36cde0){_0x46bec2=_0x46bec2-0x0;var _0x39b857=_0xf604[_0x46bec2];return _0x39b857;};'use strict';var _=require(_0x4f60('0x0'));var md5=require(_0x4f60('0x1'));var util=require(_0x4f60('0x2'));var Redis=require(_0x4f60('0x3'));var config=require(_0x4f60('0x4'));config['redis']=_[_0x4f60('0x5')](config[_0x4f60('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f60('0x6')]));function MailQueue(_0x5a37dc){this['id']=_0x5a37dc['id']||0x0;this[_0x4f60('0x7')]=_0x5a37dc[_0x4f60('0x7')]||'';this[_0x4f60('0x8')]=_0x5a37dc[_0x4f60('0x8')]||0xa;this[_0x4f60('0x9')]=_0x5a37dc[_0x4f60('0x9')]||_0x4f60('0xa');this[_0x4f60('0xb')]=_0x5a37dc[_0x4f60('0xb')];this[_0x4f60('0xc')]={};this['waiting']=0x0;this[_0x4f60('0x1')]='';this[_0x4f60('0xd')]();this[_0x4f60('0xe')]();}MailQueue[_0x4f60('0xf')][_0x4f60('0xd')]=function(){var _0x171f37=this['mapAgentsId'][_0x4f60('0x10')];this['mapAgentsId']=_[_0x4f60('0x11')](this[_0x4f60('0xb')],'id');this[_0x4f60('0xc')][_0x4f60('0x10')]=_0x171f37;};MailQueue['prototype'][_0x4f60('0xe')]=function(){this[_0x4f60('0x12')]=0x0;this[_0x4f60('0x13')]=0x0;for(var _0x40332f=0x0;_0x40332f=0x0?this[_0x4f60('0x15')]:0x0;var _0x43c357={'id':this['id'],'available':this[_0x4f60('0x15')],'loggedIn':this[_0x4f60('0x12')],'name':this['name'],'paused':this[_0x4f60('0x13')],'waiting':this[_0x4f60('0x16')]};var _0x4ba26d=md5(JSON[_0x4f60('0x17')](_0x43c357));if(this['md5']!==_0x4ba26d){this[_0x4f60('0x1')]=_0x4ba26d;io['to'](util[_0x4f60('0x18')](_0x4f60('0x19'),_0x43c357[_0x4f60('0x7')]))['emit'](_0x4f60('0x1a'),_0x43c357);}};module[_0x4f60('0x1b')]=MailQueue; \ No newline at end of file +var _0x6546=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','mailPause','available','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','timeout','strategy','beepall'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6546,0x139));var _0x6654=function(_0x143737,_0x3f5145){_0x143737=_0x143737-0x0;var _0x1e153b=_0x6546[_0x143737];return _0x1e153b;};'use strict';var _=require(_0x6654('0x0'));var md5=require(_0x6654('0x1'));var util=require(_0x6654('0x2'));var Redis=require(_0x6654('0x3'));var config=require(_0x6654('0x4'));config[_0x6654('0x5')]=_['defaults'](config[_0x6654('0x5')],{'host':_0x6654('0x6'),'port':0x18eb});var io=require(_0x6654('0x7'))(new Redis(config[_0x6654('0x5')]));function MailQueue(_0x29aa8f){this['id']=_0x29aa8f['id']||0x0;this['name']=_0x29aa8f['name']||'';this[_0x6654('0x8')]=_0x29aa8f[_0x6654('0x8')]||0xa;this['strategy']=_0x29aa8f[_0x6654('0x9')]||_0x6654('0xa');this[_0x6654('0xb')]=_0x29aa8f[_0x6654('0xb')];this[_0x6654('0xc')]={};this[_0x6654('0xd')]=0x0;this[_0x6654('0x1')]='';this[_0x6654('0xe')]();this[_0x6654('0xf')]();}MailQueue[_0x6654('0x10')][_0x6654('0xe')]=function(){var _0x4037c1=this[_0x6654('0xc')][_0x6654('0x11')];this['mapAgentsId']=_[_0x6654('0x12')](this['Agents'],'id');this['mapAgentsId'][_0x6654('0x11')]=_0x4037c1;};MailQueue['prototype'][_0x6654('0xf')]=function(){this[_0x6654('0x13')]=0x0;this[_0x6654('0x14')]=0x0;for(var _0x361693=0x0;_0x361693=0x0?this[_0x6654('0x16')]:0x0;var _0x26e0e3={'id':this['id'],'available':this[_0x6654('0x16')],'loggedIn':this[_0x6654('0x13')],'name':this['name'],'paused':this[_0x6654('0x14')],'waiting':this[_0x6654('0xd')]};var _0x34e131=md5(JSON['stringify'](_0x26e0e3));if(this[_0x6654('0x1')]!==_0x34e131){this['md5']=_0x34e131;io['to'](util[_0x6654('0x17')](_0x6654('0x18'),_0x26e0e3['name']))['emit'](_0x6654('0x19'),_0x26e0e3);}};module[_0x6654('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 cb8fa98..61cfe2e 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 _0xa60d=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','format','emit','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x3531b3,_0x5c54ea){var _0x338e11=function(_0x15d999){while(--_0x15d999){_0x3531b3['push'](_0x3531b3['shift']());}};_0x338e11(++_0x5c54ea);}(_0xa60d,0x1d8));var _0xda60=function(_0x122afc,_0x2b77e8){_0x122afc=_0x122afc-0x0;var _0x2041d0=_0xa60d[_0x122afc];return _0x2041d0;};'use strict';var _=require('lodash');var md5=require(_0xda60('0x0'));var util=require(_0xda60('0x1'));var Redis=require(_0xda60('0x2'));var config=require(_0xda60('0x3'));config[_0xda60('0x4')]=_[_0xda60('0x5')](config[_0xda60('0x4')],{'host':_0xda60('0x6'),'port':0x18eb});var io=require(_0xda60('0x7'))(new Redis(config[_0xda60('0x4')]));function OpenchannelQueue(_0x5acb31){this['id']=_0x5acb31['id']||0x0;this[_0xda60('0x8')]=_0x5acb31['name']||'';this['timeout']=_0x5acb31[_0xda60('0x9')]||0xa;this[_0xda60('0xa')]=_0x5acb31[_0xda60('0xa')]||_0xda60('0xb');this[_0xda60('0xc')]=_0x5acb31[_0xda60('0xc')];this[_0xda60('0xd')]={};this[_0xda60('0xe')]=0x0;this[_0xda60('0x0')]='';this['updateRouting']();this[_0xda60('0xf')]();}OpenchannelQueue[_0xda60('0x10')]['updateRouting']=function(){var _0x47d89d=this[_0xda60('0xd')][_0xda60('0x11')];this[_0xda60('0xd')]=_[_0xda60('0x12')](this[_0xda60('0xc')],'id');this[_0xda60('0xd')][_0xda60('0x11')]=_0x47d89d;};OpenchannelQueue[_0xda60('0x10')][_0xda60('0xf')]=function(){this[_0xda60('0x13')]=0x0;this[_0xda60('0x14')]=0x0;for(var _0x59ac4a=0x0;_0x59ac4a=0x0?this[_0xda60('0x18')]:0x0;var _0x240ba6={'id':this['id'],'available':this[_0xda60('0x18')],'loggedIn':this[_0xda60('0x13')],'name':this[_0xda60('0x8')],'paused':this['paused'],'waiting':this[_0xda60('0xe')]};var _0x56bbe0=md5(JSON[_0xda60('0x19')](_0x240ba6));if(this[_0xda60('0x0')]!==_0x56bbe0){this['md5']=_0x56bbe0;io['to'](util[_0xda60('0x1a')]('openchannel:queue:%s',_0x240ba6[_0xda60('0x8')]))[_0xda60('0x1b')](_0xda60('0x1c'),_0x240ba6);}};module[_0xda60('0x1d')]=OpenchannelQueue; \ No newline at end of file +var _0x1ad1=['beepall','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','length','online','openchannelPause','available','paused','waiting','stringify','openchannel:queue:%s','emit','openchannel_queue:save','exports','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy'];(function(_0x55fc73,_0x39fb89){var _0x1490e4=function(_0x363d00){while(--_0x363d00){_0x55fc73['push'](_0x55fc73['shift']());}};_0x1490e4(++_0x39fb89);}(_0x1ad1,0x111));var _0x11ad=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x1ad1[_0x39096d];return _0x13da4f;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x11ad('0x0'));var config=require(_0x11ad('0x1'));config['redis']=_['defaults'](config[_0x11ad('0x2')],{'host':_0x11ad('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x11ad('0x2')]));function OpenchannelQueue(_0x18b6e6){this['id']=_0x18b6e6['id']||0x0;this['name']=_0x18b6e6[_0x11ad('0x4')]||'';this[_0x11ad('0x5')]=_0x18b6e6[_0x11ad('0x5')]||0xa;this[_0x11ad('0x6')]=_0x18b6e6[_0x11ad('0x6')]||_0x11ad('0x7');this['Agents']=_0x18b6e6['Agents'];this[_0x11ad('0x8')]={};this['waiting']=0x0;this[_0x11ad('0x9')]='';this[_0x11ad('0xa')]();this[_0x11ad('0xb')]();}OpenchannelQueue[_0x11ad('0xc')][_0x11ad('0xa')]=function(){var _0x1737c5=this[_0x11ad('0x8')][_0x11ad('0xd')];this['mapAgentsId']=_[_0x11ad('0xe')](this[_0x11ad('0xf')],'id');this[_0x11ad('0x8')]['_rr']=_0x1737c5;};OpenchannelQueue[_0x11ad('0xc')][_0x11ad('0xb')]=function(){this[_0x11ad('0x10')]=0x0;this['paused']=0x0;for(var _0x5047c7=0x0;_0x5047c7=0x0?this[_0x11ad('0x14')]:0x0;var _0x344ad5={'id':this['id'],'available':this[_0x11ad('0x14')],'loggedIn':this[_0x11ad('0x10')],'name':this[_0x11ad('0x4')],'paused':this[_0x11ad('0x15')],'waiting':this[_0x11ad('0x16')]};var _0x1eb5e1=md5(JSON[_0x11ad('0x17')](_0x344ad5));if(this[_0x11ad('0x9')]!==_0x1eb5e1){this[_0x11ad('0x9')]=_0x1eb5e1;io['to'](util['format'](_0x11ad('0x18'),_0x344ad5[_0x11ad('0x4')]))[_0x11ad('0x19')](_0x11ad('0x1a'),_0x344ad5);}};module[_0x11ad('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 63eeeb9..d6e6a93 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0xe706,0xa3));var _0x6e70=function(_0x4297af,_0x2882f5){_0x4297af=_0x4297af-0x0;var _0x10ad5d=_0xe706[_0x4297af];return _0x10ad5d;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file +var _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(_0x465f6f,_0x93b1c9){var _0x4eeda4=function(_0x56ebf0){while(--_0x56ebf0){_0x465f6f['push'](_0x465f6f['shift']());}};_0x4eeda4(++_0x93b1c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 fd8d414..b36384e 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 _0x917a=['prototype','loggedIn','paused','online','whatsappPause','available','stringify','format','emit','lodash','md5','util','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','_rr','mapAgentsId','map'];(function(_0x19937c,_0x3f84c4){var _0x1b1f5a=function(_0x2a9e0c){while(--_0x2a9e0c){_0x19937c['push'](_0x19937c['shift']());}};_0x1b1f5a(++_0x3f84c4);}(_0x917a,0x1e5));var _0xa917=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x917a[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xa917('0x0'));var md5=require(_0xa917('0x1'));var util=require(_0xa917('0x2'));var Redis=require(_0xa917('0x3'));var config=require(_0xa917('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0xa917('0x5'),'port':0x18eb});var io=require(_0xa917('0x6'))(new Redis(config[_0xa917('0x7')]));function WhatsappQueue(_0x51fa81){this['id']=_0x51fa81['id']||0x0;this['name']=_0x51fa81[_0xa917('0x8')]||'';this['timeout']=_0x51fa81[_0xa917('0x9')]||0xa;this['strategy']=_0x51fa81[_0xa917('0xa')]||_0xa917('0xb');this[_0xa917('0xc')]=_0x51fa81[_0xa917('0xc')];this['mapAgentsId']={};this[_0xa917('0xd')]=0x0;this['md5']='';this[_0xa917('0xe')]();this[_0xa917('0xf')]();}WhatsappQueue['prototype'][_0xa917('0xe')]=function(){var _0x2bbc94=this['mapAgentsId'][_0xa917('0x10')];this[_0xa917('0x11')]=_[_0xa917('0x12')](this[_0xa917('0xc')],'id');this[_0xa917('0x11')][_0xa917('0x10')]=_0x2bbc94;};WhatsappQueue[_0xa917('0x13')][_0xa917('0xf')]=function(){this[_0xa917('0x14')]=0x0;this[_0xa917('0x15')]=0x0;for(var _0xba2059=0x0;_0xba2059=0x0?this[_0xa917('0x18')]:0x0;var _0x56aaa5={'id':this['id'],'available':this[_0xa917('0x18')],'loggedIn':this[_0xa917('0x14')],'name':this['name'],'paused':this[_0xa917('0x15')],'waiting':this['waiting']};var _0xa8a9da=md5(JSON[_0xa917('0x19')](_0x56aaa5));if(this[_0xa917('0x1')]!==_0xa8a9da){this[_0xa917('0x1')]=_0xa8a9da;io['to'](util[_0xa917('0x1a')]('whatsapp:queue:%s',_0x56aaa5[_0xa917('0x8')]))[_0xa917('0x1b')]('whatsapp_queue:save',_0x56aaa5);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x1093=['strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','whatsappPause','available','stringify','emit','whatsapp_queue:save','exports','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x1235a8,_0x2db48e){var _0x41a2cf=function(_0x2c30df){while(--_0x2c30df){_0x1235a8['push'](_0x1235a8['shift']());}};_0x41a2cf(++_0x2db48e);}(_0x1093,0x157));var _0x3109=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x1093[_0x9aada2];return _0x196dff;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3109('0x0'));var Redis=require('ioredis');var config=require(_0x3109('0x1'));config[_0x3109('0x2')]=_[_0x3109('0x3')](config[_0x3109('0x2')],{'host':_0x3109('0x4'),'port':0x18eb});var io=require(_0x3109('0x5'))(new Redis(config[_0x3109('0x2')]));function WhatsappQueue(_0x5a1c3b){this['id']=_0x5a1c3b['id']||0x0;this[_0x3109('0x6')]=_0x5a1c3b[_0x3109('0x6')]||'';this[_0x3109('0x7')]=_0x5a1c3b[_0x3109('0x7')]||0xa;this['strategy']=_0x5a1c3b[_0x3109('0x8')]||'beepall';this[_0x3109('0x9')]=_0x5a1c3b[_0x3109('0x9')];this[_0x3109('0xa')]={};this[_0x3109('0xb')]=0x0;this[_0x3109('0xc')]='';this[_0x3109('0xd')]();this[_0x3109('0xe')]();}WhatsappQueue[_0x3109('0xf')][_0x3109('0xd')]=function(){var _0x2ae952=this[_0x3109('0xa')][_0x3109('0x10')];this[_0x3109('0xa')]=_[_0x3109('0x11')](this['Agents'],'id');this[_0x3109('0xa')][_0x3109('0x10')]=_0x2ae952;};WhatsappQueue[_0x3109('0xf')]['updateRealtime']=function(){this[_0x3109('0x12')]=0x0;this[_0x3109('0x13')]=0x0;for(var _0x3da4ae=0x0;_0x3da4ae=0x0?this[_0x3109('0x16')]:0x0;var _0x4b77fe={'id':this['id'],'available':this[_0x3109('0x16')],'loggedIn':this[_0x3109('0x12')],'name':this[_0x3109('0x6')],'paused':this['paused'],'waiting':this[_0x3109('0xb')]};var _0x3f6874=md5(JSON[_0x3109('0x17')](_0x4b77fe));if(this[_0x3109('0xc')]!==_0x3f6874){this['md5']=_0x3f6874;io['to'](util['format']('whatsapp:queue:%s',_0x4b77fe[_0x3109('0x6')]))[_0x3109('0x18')](_0x3109('0x19'),_0x4b77fe);}};module[_0x3109('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1ad8a7f..26ce253 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7217[_0x29b609];return _0x54c952;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x4b8bd4,_0x8e2477){var _0x40274b=function(_0x5ab710){while(--_0x5ab710){_0x4b8bd4['push'](_0x4b8bd4['shift']());}};_0x40274b(++_0x8e2477);}(_0x008c,0x188));var _0xc008=function(_0x4d45fd,_0x16b74c){_0x4d45fd=_0x4d45fd-0x0;var _0x2b5aa5=_0x008c[_0x4d45fd];return _0x2b5aa5;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 5a2f80f..4c56168 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 _0x09ab=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x263659,_0x22be35){var _0xad3b8a=function(_0x3ea15b){while(--_0x3ea15b){_0x263659['push'](_0x263659['shift']());}};_0xad3b8a(++_0x22be35);}(_0x09ab,0x1c5));var _0xb09a=function(_0x51ef40,_0x48a870){_0x51ef40=_0x51ef40-0x0;var _0x3ff060=_0x09ab[_0x51ef40];return _0x3ff060;};'use strict';var client=require(_0xb09a('0x0'));exports[_0xb09a('0x1')]=function(_0x3a7a28,_0xd285b4){return client['Request'](_0xb09a('0x2'),{'body':_0xd285b4,'options':{'where':{'id':_0x3a7a28}},'log':_0xb09a('0x3')});};exports[_0xb09a('0x4')]=function(_0x282374,_0x56adff){return client[_0xb09a('0x5')](_0xb09a('0x6'),{'body':_0x56adff,'options':{'where':{'id':_0x282374}},'log':_0xb09a('0x7')});}; \ No newline at end of file +var _0x2145=['addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','updateChatInteraction'];(function(_0x580d1b,_0x71036b){var _0x4c8a6f=function(_0x4ed635){while(--_0x4ed635){_0x580d1b['push'](_0x580d1b['shift']());}};_0x4c8a6f(++_0x71036b);}(_0x2145,0x1a8));var _0x5214=function(_0x36795b,_0x9fd0a2){_0x36795b=_0x36795b-0x0;var _0x395595=_0x2145[_0x36795b];return _0x395595;};'use strict';var client=require(_0x5214('0x0'));exports[_0x5214('0x1')]=function(_0x4d9878,_0x3a0283){return client['Request']('UpdateChatInteraction',{'body':_0x3a0283,'options':{'where':{'id':_0x4d9878}},'log':_0x5214('0x2')});};exports[_0x5214('0x3')]=function(_0x3df215,_0x1b995c){return client[_0x5214('0x4')](_0x5214('0x5'),{'body':_0x1b995c,'options':{'where':{'id':_0x3df215}},'log':_0x5214('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2c3746f..ea27786 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 _0xd9d3=['createChatMessage','../client','create','Request'];(function(_0x1d740d,_0x2682b6){var _0x34711f=function(_0xe17698){while(--_0xe17698){_0x1d740d['push'](_0x1d740d['shift']());}};_0x34711f(++_0x2682b6);}(_0xd9d3,0xd1));var _0x3d9d=function(_0x1cab1f,_0x17dac7){_0x1cab1f=_0x1cab1f-0x0;var _0x27d1f3=_0xd9d3[_0x1cab1f];return _0x27d1f3;};'use strict';var client=require(_0x3d9d('0x0'));exports[_0x3d9d('0x1')]=function(_0x5a3b6f){return client[_0x3d9d('0x2')]('CreateChatMessage',{'body':_0x5a3b6f,'log':_0x3d9d('0x3')});}; \ No newline at end of file +var _0xbd2f=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x1b24cb,_0x26e0fe){var _0x4160b2=function(_0x129733){while(--_0x129733){_0x1b24cb['push'](_0x1b24cb['shift']());}};_0x4160b2(++_0x26e0fe);}(_0xbd2f,0x1d2));var _0xfbd2=function(_0x29d618,_0x459034){_0x29d618=_0x29d618-0x0;var _0xb8ef40=_0xbd2f[_0x29d618];return _0xb8ef40;};'use strict';var client=require(_0xfbd2('0x0'));exports['create']=function(_0x28e748){return client[_0xfbd2('0x1')](_0xfbd2('0x2'),{'body':_0x28e748,'log':_0xfbd2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 7feccea..9124c88 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 _0x4ef0=['getChatQueues','GetChatQueue','strategy','name','online','chatPause'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x4ef0,0x1bc));var _0x04ef=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x4ef0[_0x59c301];return _0x3866b9;};'use strict';var client=require('../client');exports[_0x04ef('0x0')]=function(){return function(){return client['Request'](_0x04ef('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x04ef('0x2')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x04ef('0x3'),_0x04ef('0x4'),_0x04ef('0x5')]}]},'log':_0x04ef('0x0')});};}; \ No newline at end of file +var _0xd997=['chatPause','getChatQueues','GetChatQueue','name','timeout','User','Agents','online'];(function(_0x2ffee8,_0x126cdd){var _0x432ebf=function(_0x521355){while(--_0x521355){_0x2ffee8['push'](_0x2ffee8['shift']());}};_0x432ebf(++_0x126cdd);}(_0xd997,0x1f2));var _0x7d99=function(_0x58df0d,_0x35089d){_0x58df0d=_0x58df0d-0x0;var _0x3f3afe=_0xd997[_0x58df0d];return _0x3f3afe;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request'](_0x7d99('0x0'),{'options':{'raw':![],'attributes':['id',_0x7d99('0x1'),_0x7d99('0x2'),'strategy'],'include':[{'model':_0x7d99('0x3'),'as':_0x7d99('0x4'),'attributes':['id','name',_0x7d99('0x5'),_0x7d99('0x6')]}]},'log':_0x7d99('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 3bc76cc..e275b88 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 _0x57d4=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x1befc5,_0xcb6328){var _0x20eb2c=function(_0x82d9f7){while(--_0x82d9f7){_0x1befc5['push'](_0x1befc5['shift']());}};_0x20eb2c(++_0xcb6328);}(_0x57d4,0x78));var _0x457d=function(_0x2a73e6,_0x12c318){_0x2a73e6=_0x2a73e6-0x0;var _0x58cea6=_0x57d4[_0x2a73e6];return _0x58cea6;};'use strict';var client=require(_0x457d('0x0'));exports[_0x457d('0x1')]=function(_0x47a573){return client[_0x457d('0x2')](_0x457d('0x3'),{'body':_0x47a573,'log':_0x457d('0x3')});};exports[_0x457d('0x4')]=function(_0x1219e1,_0x3c89b2){return client[_0x457d('0x2')](_0x457d('0x5'),{'body':_0x3c89b2,'options':{'where':{'uniqueid':_0x1219e1},'order':[['id',_0x457d('0x6')]],'limit':0x1},'log':_0x457d('0x5')});}; \ No newline at end of file +var _0x8ebf=['../client','create','CreateChatQueueReport','Request','DESC','UpdateChatQueueReport'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x8ebf[_0x1cb18a];return _0x22442e;};'use strict';var client=require(_0xf8eb('0x0'));exports[_0xf8eb('0x1')]=function(_0x226e1d){return client['Request'](_0xf8eb('0x2'),{'body':_0x226e1d,'log':_0xf8eb('0x2')});};exports['update']=function(_0x311ae9,_0x59d6a7){return client[_0xf8eb('0x3')]('UpdateChatQueueReport',{'body':_0x59d6a7,'options':{'where':{'uniqueid':_0x311ae9},'order':[['id',_0xf8eb('0x4')]],'limit':0x1},'log':_0xf8eb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c39b254..9ade943 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 _0x46a0=['UpdateFaxInteraction','updateFaxInteraction','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x46a0,0x74));var _0x046a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46a0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x046a('0x0'));exports[_0x046a('0x1')]=function(_0x120a5f,_0x118360){return client[_0x046a('0x2')](_0x046a('0x3'),{'body':_0x118360,'options':{'where':{'id':_0x120a5f}},'log':_0x046a('0x4')});};exports['addTags']=function(_0x229714,_0x5922d6){return client[_0x046a('0x2')](_0x046a('0x5'),{'body':_0x5922d6,'options':{'where':{'id':_0x229714}},'log':_0x046a('0x6')});}; \ No newline at end of file +var _0x4344=['../client','update','Request','updateFaxInteraction','addTags','addTagsToFaxInteraction'];(function(_0x48234e,_0x4b7445){var _0x2b0096=function(_0x4ec178){while(--_0x4ec178){_0x48234e['push'](_0x48234e['shift']());}};_0x2b0096(++_0x4b7445);}(_0x4344,0xde));var _0x4434=function(_0x1e40d9,_0x5d81b0){_0x1e40d9=_0x1e40d9-0x0;var _0xe50709=_0x4344[_0x1e40d9];return _0xe50709;};'use strict';var client=require(_0x4434('0x0'));exports[_0x4434('0x1')]=function(_0x1b60b7,_0x5d0157){return client[_0x4434('0x2')]('UpdateFaxInteraction',{'body':_0x5d0157,'options':{'where':{'id':_0x1b60b7}},'log':_0x4434('0x3')});};exports[_0x4434('0x4')]=function(_0xbd97f2,_0x500149){return client[_0x4434('0x2')]('AddTagsToFaxInteraction',{'body':_0x500149,'options':{'where':{'id':_0xbd97f2}},'log':_0x4434('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2c6e7aa..bf23eef 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 _0x33d3=['../client','createFaxMessage'];(function(_0x3244e0,_0x5450b7){var _0xff534c=function(_0x8518b1){while(--_0x8518b1){_0x3244e0['push'](_0x3244e0['shift']());}};_0xff534c(++_0x5450b7);}(_0x33d3,0x196));var _0x333d=function(_0x21481c,_0x1b51ba){_0x21481c=_0x21481c-0x0;var _0x5dd77a=_0x33d3[_0x21481c];return _0x5dd77a;};'use strict';var client=require(_0x333d('0x0'));exports['create']=function(_0x152e4d){return client['Request']('CreateFaxMessage',{'body':_0x152e4d,'log':_0x333d('0x1')});}; \ No newline at end of file +var _0x0c1e=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x20254b,_0x2da289){var _0x540963=function(_0x265a16){while(--_0x265a16){_0x20254b['push'](_0x20254b['shift']());}};_0x540963(++_0x2da289);}(_0x0c1e,0x111));var _0xe0c1=function(_0x5688a3,_0x48702f){_0x5688a3=_0x5688a3-0x0;var _0x11db27=_0x0c1e[_0x5688a3];return _0x11db27;};'use strict';var client=require('../client');exports[_0xe0c1('0x0')]=function(_0xc24d90){return client[_0xe0c1('0x1')](_0xe0c1('0x2'),{'body':_0xc24d90,'log':_0xe0c1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d5b334b..d93af0a 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 _0x992d=['name','timeout','strategy','User','Agents','online','faxPause','../client','Request'];(function(_0x4da4ac,_0x16767f){var _0x2e757d=function(_0x1c8449){while(--_0x1c8449){_0x4da4ac['push'](_0x4da4ac['shift']());}};_0x2e757d(++_0x16767f);}(_0x992d,0xa9));var _0xd992=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x992d[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0xd992('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xd992('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xd992('0x2'),_0xd992('0x3'),_0xd992('0x4')],'include':[{'model':_0xd992('0x5'),'as':_0xd992('0x6'),'attributes':['id','name',_0xd992('0x7'),_0xd992('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xd7c5=['name','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0xb2f885,_0x581b93){var _0x33b676=function(_0x2a53ab){while(--_0x2a53ab){_0xb2f885['push'](_0xb2f885['shift']());}};_0x33b676(++_0x581b93);}(_0xd7c5,0x1ac));var _0x5d7c=function(_0x3e3606,_0x2d26a7){_0x3e3606=_0x3e3606-0x0;var _0x1557fd=_0xd7c5[_0x3e3606];return _0x1557fd;};'use strict';var client=require(_0x5d7c('0x0'));exports[_0x5d7c('0x1')]=function(){return function(){return client[_0x5d7c('0x2')](_0x5d7c('0x3'),{'options':{'raw':![],'attributes':['id',_0x5d7c('0x4'),'timeout','strategy'],'include':[{'model':_0x5d7c('0x5'),'as':_0x5d7c('0x6'),'attributes':['id',_0x5d7c('0x4'),_0x5d7c('0x7'),_0x5d7c('0x8')]}]},'log':_0x5d7c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index fc0d765..8d628d8 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 _0x5419=['DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0xa43518,_0x2a4c6b){var _0x5e9b94=function(_0x3d3c7f){while(--_0x3d3c7f){_0xa43518['push'](_0xa43518['shift']());}};_0x5e9b94(++_0x2a4c6b);}(_0x5419,0x175));var _0x9541=function(_0x124269,_0x161b31){_0x124269=_0x124269-0x0;var _0x231ac3=_0x5419[_0x124269];return _0x231ac3;};'use strict';var client=require(_0x9541('0x0'));exports[_0x9541('0x1')]=function(_0x313f1e){return client[_0x9541('0x2')](_0x9541('0x3'),{'body':_0x313f1e,'log':_0x9541('0x3')});};exports[_0x9541('0x4')]=function(_0x317e1e,_0x307a35){return client[_0x9541('0x2')]('UpdateFaxQueueReport',{'body':_0x307a35,'options':{'where':{'uniqueid':_0x317e1e},'order':[['id',_0x9541('0x5')]],'limit':0x1},'log':_0x9541('0x6')});}; \ No newline at end of file +var _0x75dd=['../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x22c415,_0x273b84){var _0x3ef055=function(_0x5ef923){while(--_0x5ef923){_0x22c415['push'](_0x22c415['shift']());}};_0x3ef055(++_0x273b84);}(_0x75dd,0x6e));var _0xd75d=function(_0x5620b1,_0x1107b1){_0x5620b1=_0x5620b1-0x0;var _0x357957=_0x75dd[_0x5620b1];return _0x357957;};'use strict';var client=require(_0xd75d('0x0'));exports['create']=function(_0x54fce4){return client[_0xd75d('0x1')](_0xd75d('0x2'),{'body':_0x54fce4,'log':_0xd75d('0x2')});};exports[_0xd75d('0x3')]=function(_0xd4e8e0,_0x3f9892){return client['Request'](_0xd75d('0x4'),{'body':_0x3f9892,'options':{'where':{'uniqueid':_0xd4e8e0},'order':[['id','DESC']],'limit':0x1},'log':_0xd75d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 0da7ad9..6a65a99 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 _0x93e6=['Interval','name','interval','getIntervals','../client','GetInterval'];(function(_0x446836,_0x19becf){var _0x4f0793=function(_0x5cc460){while(--_0x5cc460){_0x446836['push'](_0x446836['shift']());}};_0x4f0793(++_0x19becf);}(_0x93e6,0x11e));var _0x693e=function(_0x54ca4e,_0x3a5fe0){_0x54ca4e=_0x54ca4e-0x0;var _0x2a8924=_0x93e6[_0x54ca4e];return _0x2a8924;};'use strict';var client=require(_0x693e('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0x693e('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x693e('0x2'),'as':'Intervals','attributes':['id',_0x693e('0x3'),_0x693e('0x4')]}]},'log':_0x693e('0x5')});};}; \ No newline at end of file +var _0xb9a7=['name','interval','getIntervals','Interval'];(function(_0x51841c,_0x4667bd){var _0x48bbf3=function(_0x5d7a85){while(--_0x5d7a85){_0x51841c['push'](_0x51841c['shift']());}};_0x48bbf3(++_0x4667bd);}(_0xb9a7,0x112));var _0x7b9a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb9a7[_0x199572];return _0x13cfa3;};'use strict';var client=require('../client');exports[_0x7b9a('0x0')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x7b9a('0x1'),'as':'Intervals','attributes':['id',_0x7b9a('0x2'),_0x7b9a('0x3')]}]},'log':_0x7b9a('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b427fe2..12652ff 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 _0x9f14=['UpdateMailInteraction','updateMailInteraction','addTags','../client','update','Request'];(function(_0x8f05e5,_0x2eeff3){var _0x681366=function(_0x4b73d2){while(--_0x4b73d2){_0x8f05e5['push'](_0x8f05e5['shift']());}};_0x681366(++_0x2eeff3);}(_0x9f14,0xff));var _0x49f1=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9f14[_0x1cc8fe];return _0x230054;};'use strict';var client=require(_0x49f1('0x0'));exports[_0x49f1('0x1')]=function(_0x4e7e3f,_0xeabec4){return client[_0x49f1('0x2')](_0x49f1('0x3'),{'body':_0xeabec4,'options':{'where':{'id':_0x4e7e3f}},'log':_0x49f1('0x4')});};exports[_0x49f1('0x5')]=function(_0x41aac3,_0x49b20b){return client[_0x49f1('0x2')]('AddTagsToMailInteraction',{'body':_0x49b20b,'options':{'where':{'id':_0x41aac3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6d2a=['addTags','AddTagsToMailInteraction','../client','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0xa353b5,_0x36d146){var _0x48231c=function(_0x7a12a){while(--_0x7a12a){_0xa353b5['push'](_0xa353b5['shift']());}};_0x48231c(++_0x36d146);}(_0x6d2a,0x11c));var _0xa6d2=function(_0x7d261d,_0x4e1d2f){_0x7d261d=_0x7d261d-0x0;var _0x1a992a=_0x6d2a[_0x7d261d];return _0x1a992a;};'use strict';var client=require(_0xa6d2('0x0'));exports['update']=function(_0x43556f,_0x27af54){return client[_0xa6d2('0x1')](_0xa6d2('0x2'),{'body':_0x27af54,'options':{'where':{'id':_0x43556f}},'log':_0xa6d2('0x3')});};exports[_0xa6d2('0x4')]=function(_0x25b38b,_0x136304){return client[_0xa6d2('0x1')](_0xa6d2('0x5'),{'body':_0x136304,'options':{'where':{'id':_0x25b38b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 09f21be..cc68f43 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 _0x44b2=['createMailMessage','create','Request'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x44b2,0x1ea));var _0x244b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x44b2[_0x5b644e];return _0x49c6bf;};'use strict';var client=require('../client');exports[_0x244b('0x0')]=function(_0x28e19f){return client[_0x244b('0x1')]('CreateMailMessage',{'body':_0x28e19f,'log':_0x244b('0x2')});}; \ No newline at end of file +var _0x7351=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0xb2d17c,_0x487d49){var _0x576b82=function(_0x2df26d){while(--_0x2df26d){_0xb2d17c['push'](_0xb2d17c['shift']());}};_0x576b82(++_0x487d49);}(_0x7351,0xab));var _0x1735=function(_0x50b7e1,_0x23dd26){_0x50b7e1=_0x50b7e1-0x0;var _0x2af4fc=_0x7351[_0x50b7e1];return _0x2af4fc;};'use strict';var client=require(_0x1735('0x0'));exports['create']=function(_0x45d967){return client[_0x1735('0x1')](_0x1735('0x2'),{'body':_0x45d967,'log':_0x1735('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index ae3439d..c8309be 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 _0xbcb6=['getMailQueues','GetMailQueue','name','timeout','strategy','User','Agents','online','../client'];(function(_0x2e89d5,_0x59778b){var _0x7c83a9=function(_0x396955){while(--_0x396955){_0x2e89d5['push'](_0x2e89d5['shift']());}};_0x7c83a9(++_0x59778b);}(_0xbcb6,0x1ca));var _0x6bcb=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0xbcb6[_0x28578d];return _0x524826;};'use strict';var client=require(_0x6bcb('0x0'));exports[_0x6bcb('0x1')]=function(){return function(){return client['Request'](_0x6bcb('0x2'),{'options':{'raw':![],'attributes':['id',_0x6bcb('0x3'),_0x6bcb('0x4'),_0x6bcb('0x5')],'include':[{'model':_0x6bcb('0x6'),'as':_0x6bcb('0x7'),'attributes':['id',_0x6bcb('0x3'),_0x6bcb('0x8'),'mailPause']}]},'log':_0x6bcb('0x1')});};}; \ No newline at end of file +var _0x19f5=['name','timeout','User','Agents','online','mailPause','../client','GetMailQueue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x19f5,0x96));var _0x519f=function(_0xb056b0,_0x35a666){_0xb056b0=_0xb056b0-0x0;var _0x41d831=_0x19f5[_0xb056b0];return _0x41d831;};'use strict';var client=require(_0x519f('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x519f('0x1'),{'options':{'raw':![],'attributes':['id',_0x519f('0x2'),_0x519f('0x3'),'strategy'],'include':[{'model':_0x519f('0x4'),'as':_0x519f('0x5'),'attributes':['id','name',_0x519f('0x6'),_0x519f('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index fbcfa8b..069736e 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 _0xe04a=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x216e72,_0x5cd161){var _0x2ff28d=function(_0x29a533){while(--_0x29a533){_0x216e72['push'](_0x216e72['shift']());}};_0x2ff28d(++_0x5cd161);}(_0xe04a,0x1f2));var _0xae04=function(_0x4833c5,_0x3518e5){_0x4833c5=_0x4833c5-0x0;var _0x3f2ee5=_0xe04a[_0x4833c5];return _0x3f2ee5;};'use strict';var client=require(_0xae04('0x0'));exports[_0xae04('0x1')]=function(_0xd1ab64){return client[_0xae04('0x2')](_0xae04('0x3'),{'body':_0xd1ab64,'log':_0xae04('0x3')});};exports[_0xae04('0x4')]=function(_0x421fc8,_0x295b1c){return client[_0xae04('0x2')](_0xae04('0x5'),{'body':_0x295b1c,'options':{'where':{'uniqueid':_0x421fc8},'order':[['id',_0xae04('0x6')]],'limit':0x1},'log':_0xae04('0x5')});}; \ No newline at end of file +var _0xca9a=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0xc4feb4,_0x1c6f3c){var _0x446500=function(_0x4acfae){while(--_0x4acfae){_0xc4feb4['push'](_0xc4feb4['shift']());}};_0x446500(++_0x1c6f3c);}(_0xca9a,0x77));var _0xaca9=function(_0x4b4d05,_0x307617){_0x4b4d05=_0x4b4d05-0x0;var _0x3ac46a=_0xca9a[_0x4b4d05];return _0x3ac46a;};'use strict';var client=require(_0xaca9('0x0'));exports[_0xaca9('0x1')]=function(_0x27ab29){return client[_0xaca9('0x2')](_0xaca9('0x3'),{'body':_0x27ab29,'log':_0xaca9('0x3')});};exports[_0xaca9('0x4')]=function(_0xb338e9,_0x3c9273){return client[_0xaca9('0x2')](_0xaca9('0x5'),{'body':_0x3c9273,'options':{'where':{'uniqueid':_0xb338e9},'order':[['id','DESC']],'limit':0x1},'log':_0xaca9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e58394f..89b27d3 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 _0xf360=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x38a49b,_0xb368f3){var _0x3dafdb=function(_0x82f373){while(--_0x82f373){_0x38a49b['push'](_0x38a49b['shift']());}};_0x3dafdb(++_0xb368f3);}(_0xf360,0xce));var _0x0f36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf360[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0f36('0x0'));exports[_0x0f36('0x1')]=function(_0x3380c9,_0x11538c){return client[_0x0f36('0x2')](_0x0f36('0x3'),{'body':_0x11538c,'options':{'where':{'id':_0x3380c9}},'log':_0x0f36('0x4')});};exports[_0x0f36('0x5')]=function(_0x40dc55,_0x4a97b7){return client[_0x0f36('0x2')](_0x0f36('0x6'),{'body':_0x4a97b7,'options':{'where':{'id':_0x40dc55}},'log':_0x0f36('0x7')});}; \ No newline at end of file +var _0xde76=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x23dac2,_0x503821){var _0x2deffa=function(_0x3e8dbb){while(--_0x3e8dbb){_0x23dac2['push'](_0x23dac2['shift']());}};_0x2deffa(++_0x503821);}(_0xde76,0x18f));var _0x6de7=function(_0x25c3ac,_0x94bbfc){_0x25c3ac=_0x25c3ac-0x0;var _0x15657d=_0xde76[_0x25c3ac];return _0x15657d;};'use strict';var client=require(_0x6de7('0x0'));exports['update']=function(_0x2968e9,_0xedd2e7){return client[_0x6de7('0x1')](_0x6de7('0x2'),{'body':_0xedd2e7,'options':{'where':{'id':_0x2968e9}},'log':'updateOpenchannelInteraction'});};exports[_0x6de7('0x3')]=function(_0x7220a4,_0x1d64f0){return client[_0x6de7('0x1')](_0x6de7('0x4'),{'body':_0x1d64f0,'options':{'where':{'id':_0x7220a4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index d865661..f619c68 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 _0xb43b=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x34ea27,_0x4296e7){_0x34ea27=_0x34ea27-0x0;var _0x47b73e=_0xb43b[_0x34ea27];return _0x47b73e;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(_0x5c45dd){return client[_0xbb43('0x2')](_0xbb43('0x3'),{'body':_0x5c45dd,'log':_0xbb43('0x4')});}; \ No newline at end of file +var _0xf3cd=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x2f8316,_0x461097){var _0x3044ab=function(_0x12ace4){while(--_0x12ace4){_0x2f8316['push'](_0x2f8316['shift']());}};_0x3044ab(++_0x461097);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5dafd0,_0x3bcbb6){_0x5dafd0=_0x5dafd0-0x0;var _0x364354=_0xf3cd[_0x5dafd0];return _0x364354;};'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 diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ce9a48c..bf50c9e 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 _0xef31=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents','online','openchannelPause','../client'];(function(_0x197f55,_0x329d90){var _0x43830e=function(_0x3efd19){while(--_0x3efd19){_0x197f55['push'](_0x197f55['shift']());}};_0x43830e(++_0x329d90);}(_0xef31,0x8b));var _0x1ef3=function(_0x12f9e6,_0x2e62cd){_0x12f9e6=_0x12f9e6-0x0;var _0x5e52f3=_0xef31[_0x12f9e6];return _0x5e52f3;};'use strict';var client=require(_0x1ef3('0x0'));exports[_0x1ef3('0x1')]=function(){return function(){return client[_0x1ef3('0x2')](_0x1ef3('0x3'),{'options':{'raw':![],'attributes':['id',_0x1ef3('0x4'),_0x1ef3('0x5'),_0x1ef3('0x6')],'include':[{'model':'User','as':_0x1ef3('0x7'),'attributes':['id',_0x1ef3('0x4'),_0x1ef3('0x8'),_0x1ef3('0x9')]}]},'log':_0x1ef3('0x1')});};}; \ No newline at end of file +var _0x41ca=['../client','getOpenchannelQueues','GetOpenchannelQueue','timeout','User','online','openchannelPause'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x41ca,0x17a));var _0xa41c=function(_0x3d822c,_0x11cc25){_0x3d822c=_0x3d822c-0x0;var _0x5789a2=_0x41ca[_0x3d822c];return _0x5789a2;};'use strict';var client=require(_0xa41c('0x0'));exports[_0xa41c('0x1')]=function(){return function(){return client['Request'](_0xa41c('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xa41c('0x3'),'strategy'],'include':[{'model':_0xa41c('0x4'),'as':'Agents','attributes':['id','name',_0xa41c('0x5'),_0xa41c('0x6')]}]},'log':_0xa41c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1d4e210..b42bf61 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 _0xcd75=['Request','DESC','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport','update'];(function(_0x31dc9b,_0x1902a8){var _0x17f235=function(_0x595ca4){while(--_0x595ca4){_0x31dc9b['push'](_0x31dc9b['shift']());}};_0x17f235(++_0x1902a8);}(_0xcd75,0x17d));var _0x5cd7=function(_0x52ed11,_0x22b7d0){_0x52ed11=_0x52ed11-0x0;var _0x10da54=_0xcd75[_0x52ed11];return _0x10da54;};'use strict';var client=require(_0x5cd7('0x0'));exports[_0x5cd7('0x1')]=function(_0x17d76e){return client['Request'](_0x5cd7('0x2'),{'body':_0x17d76e,'log':_0x5cd7('0x2')});};exports[_0x5cd7('0x3')]=function(_0x45f863,_0x448468){return client[_0x5cd7('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x448468,'options':{'where':{'uniqueid':_0x45f863},'order':[['id',_0x5cd7('0x5')]],'limit':0x1},'log':_0x5cd7('0x6')});}; \ No newline at end of file +var _0x2e3c=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2e3c,0x1f4));var _0xc2e3=function(_0x3d3eb7,_0x52203e){_0x3d3eb7=_0x3d3eb7-0x0;var _0x25324e=_0x2e3c[_0x3d3eb7];return _0x25324e;};'use strict';var client=require(_0xc2e3('0x0'));exports[_0xc2e3('0x1')]=function(_0x563a72){return client[_0xc2e3('0x2')](_0xc2e3('0x3'),{'body':_0x563a72,'log':_0xc2e3('0x3')});};exports['update']=function(_0x1f4855,_0x36749b){return client['Request'](_0xc2e3('0x4'),{'body':_0x36749b,'options':{'where':{'uniqueid':_0x1f4855},'order':[['id',_0xc2e3('0x5')]],'limit':0x1},'log':_0xc2e3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 11c384f..96423e6 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 _0x089c=['updateSmsInteraction','Request','addTagsToSmsInteraction','../client','UpdateSmsInteraction'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x089c,0x7b));var _0xc089=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x089c[_0x4b055c];return _0x4b62bb;};'use strict';var client=require(_0xc089('0x0'));exports['update']=function(_0x2510f2,_0x32e414){return client['Request'](_0xc089('0x1'),{'body':_0x32e414,'options':{'where':{'id':_0x2510f2}},'log':_0xc089('0x2')});};exports['addTags']=function(_0x226363,_0x45d962){return client[_0xc089('0x3')]('AddTagsToSmsInteraction',{'body':_0x45d962,'options':{'where':{'id':_0x226363}},'log':_0xc089('0x4')});}; \ No newline at end of file +var _0xba74=['Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','../client','update'];(function(_0x4f0191,_0x31a995){var _0x38b830=function(_0x38e278){while(--_0x38e278){_0x4f0191['push'](_0x4f0191['shift']());}};_0x38b830(++_0x31a995);}(_0xba74,0x130));var _0x4ba7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xba74[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x4ba7('0x0'));exports[_0x4ba7('0x1')]=function(_0x461c39,_0x3c267a){return client[_0x4ba7('0x2')](_0x4ba7('0x3'),{'body':_0x3c267a,'options':{'where':{'id':_0x461c39}},'log':_0x4ba7('0x4')});};exports['addTags']=function(_0x2cb709,_0x4d20f0){return client[_0x4ba7('0x2')](_0x4ba7('0x5'),{'body':_0x4d20f0,'options':{'where':{'id':_0x2cb709}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3cb9b29..e2b6fb0 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 _0xcd89=['CreateSmsMessage','../client','create','Request'];(function(_0xf8222d,_0x1091ab){var _0x35cce5=function(_0x296f29){while(--_0x296f29){_0xf8222d['push'](_0xf8222d['shift']());}};_0x35cce5(++_0x1091ab);}(_0xcd89,0xe1));var _0x9cd8=function(_0x351d8c,_0x544fe4){_0x351d8c=_0x351d8c-0x0;var _0x110c05=_0xcd89[_0x351d8c];return _0x110c05;};'use strict';var client=require(_0x9cd8('0x0'));exports[_0x9cd8('0x1')]=function(_0x76ced1){return client[_0x9cd8('0x2')](_0x9cd8('0x3'),{'body':_0x76ced1,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x9874=['Request','CreateSmsMessage','create'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x9874,0x155));var _0x4987=function(_0x41ff72,_0x48f1f7){_0x41ff72=_0x41ff72-0x0;var _0x2d1cd5=_0x9874[_0x41ff72];return _0x2d1cd5;};'use strict';var client=require('../client');exports[_0x4987('0x0')]=function(_0x5854d9){return client[_0x4987('0x1')](_0x4987('0x2'),{'body':_0x5854d9,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 6157b43..76fd333 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 _0xb33b=['online','smsPause','getSmsQueues','Request','GetSmsQueue','name','timeout','User'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb33b,0x1a2));var _0xbb33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb33b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xbb33('0x0')]=function(){return function(){return client[_0xbb33('0x1')](_0xbb33('0x2'),{'options':{'raw':![],'attributes':['id',_0xbb33('0x3'),_0xbb33('0x4'),'strategy'],'include':[{'model':_0xbb33('0x5'),'as':'Agents','attributes':['id',_0xbb33('0x3'),_0xbb33('0x6'),_0xbb33('0x7')]}]},'log':_0xbb33('0x0')});};}; \ No newline at end of file +var _0xda0c=['Request','GetSmsQueue','name','User','online','smsPause','../client','getSmsQueues'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0xda0c,0x16e));var _0xcda0=function(_0x56a180,_0x3ec6c5){_0x56a180=_0x56a180-0x0;var _0x240029=_0xda0c[_0x56a180];return _0x240029;};'use strict';var client=require(_0xcda0('0x0'));exports[_0xcda0('0x1')]=function(){return function(){return client[_0xcda0('0x2')](_0xcda0('0x3'),{'options':{'raw':![],'attributes':['id',_0xcda0('0x4'),'timeout','strategy'],'include':[{'model':_0xcda0('0x5'),'as':'Agents','attributes':['id','name',_0xcda0('0x6'),_0xcda0('0x7')]}]},'log':_0xcda0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 04dde25..429c383 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 _0x1280=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x5586ca,_0x4910fc){var _0x4befc2=function(_0x14b4bd){while(--_0x14b4bd){_0x5586ca['push'](_0x5586ca['shift']());}};_0x4befc2(++_0x4910fc);}(_0x1280,0xac));var _0x0128=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0x1280[_0x3eb4a9];return _0x48dbad;};'use strict';var client=require(_0x0128('0x0'));exports['create']=function(_0x204c30){return client[_0x0128('0x1')](_0x0128('0x2'),{'body':_0x204c30,'log':_0x0128('0x2')});};exports[_0x0128('0x3')]=function(_0x33b978,_0x4bd1f3){return client[_0x0128('0x1')](_0x0128('0x4'),{'body':_0x4bd1f3,'options':{'where':{'uniqueid':_0x33b978},'order':[['id',_0x0128('0x5')]],'limit':0x1},'log':_0x0128('0x4')});}; \ No newline at end of file +var _0xb44f=['CreateSmsQueueReport','update','UpdateSmsQueueReport','../client','create','Request'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb44f,0x165));var _0xfb44=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb44f[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0xfb44('0x0'));exports[_0xfb44('0x1')]=function(_0x2e2124){return client[_0xfb44('0x2')](_0xfb44('0x3'),{'body':_0x2e2124,'log':_0xfb44('0x3')});};exports[_0xfb44('0x4')]=function(_0x179ac2,_0x3969c4){return client[_0xfb44('0x2')](_0xfb44('0x5'),{'body':_0x3969c4,'options':{'where':{'uniqueid':_0x179ac2},'order':[['id','DESC']],'limit':0x1},'log':_0xfb44('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2c9dde4..a95fd3a 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 _0x52c4=['smsCapacity','whatsappCapacity','../client','getAgents','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x52c4,0xb6));var _0x452c=function(_0xa26138,_0x3563c9){_0xa26138=_0xa26138-0x0;var _0x13a8bd=_0x52c4[_0xa26138];return _0x13a8bd;};'use strict';var client=require(_0x452c('0x0'));exports[_0x452c('0x1')]=function(){return function(){return client['Request'](_0x452c('0x2'),{'options':{'raw':!![],'where':{'role':_0x452c('0x3')},'attributes':['id',_0x452c('0x4'),'online',_0x452c('0x5'),_0x452c('0x6'),_0x452c('0x7'),_0x452c('0x8'),_0x452c('0x9'),'faxPause',_0x452c('0xa'),_0x452c('0xb'),_0x452c('0xc'),_0x452c('0xd'),_0x452c('0xe'),_0x452c('0xf'),_0x452c('0x10'),_0x452c('0x11'),'openchannelCapacity']},'log':_0x452c('0x1')});};}; \ No newline at end of file +var _0xf334=['name','lastPauseAt','voicePause','chatPause','smsPause','openchannelPause','mailCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser'];(function(_0x1e93fa,_0x210f48){var _0xd4e1e6=function(_0x3149da){while(--_0x3149da){_0x1e93fa['push'](_0x1e93fa['shift']());}};_0xd4e1e6(++_0x210f48);}(_0xf334,0x14c));var _0x4f33=function(_0x10df56,_0x5da45e){_0x10df56=_0x10df56-0x0;var _0x3d200e=_0xf334[_0x10df56];return _0x3d200e;};'use strict';var client=require(_0x4f33('0x0'));exports[_0x4f33('0x1')]=function(){return function(){return client[_0x4f33('0x2')](_0x4f33('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x4f33('0x4'),'online','pauseType',_0x4f33('0x5'),_0x4f33('0x6'),_0x4f33('0x7'),'mailPause','faxPause',_0x4f33('0x8'),'whatsappPause',_0x4f33('0x9'),'chatCapacity',_0x4f33('0xa'),'faxCapacity',_0x4f33('0xb'),_0x4f33('0xc'),_0x4f33('0xd')]},'log':_0x4f33('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index ed74c1d..04a8348 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 _0x59c3=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x59c3,0x133));var _0x359c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x59c3[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x359c('0x0'));exports[_0x359c('0x1')]=function(_0x3f470b,_0x26f8f6){return client[_0x359c('0x2')](_0x359c('0x3'),{'body':_0x26f8f6,'options':{'where':{'id':_0x3f470b}},'log':'updateWhatsappInteraction'});};exports[_0x359c('0x4')]=function(_0x225098,_0x61333a){return client[_0x359c('0x2')](_0x359c('0x5'),{'body':_0x61333a,'options':{'where':{'id':_0x225098}},'log':_0x359c('0x6')});}; \ No newline at end of file +var _0x37a4=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x2f0244,_0x5c752b){var _0x1699a1=function(_0x32d4f9){while(--_0x32d4f9){_0x2f0244['push'](_0x2f0244['shift']());}};_0x1699a1(++_0x5c752b);}(_0x37a4,0xcb));var _0x437a=function(_0x2157bf,_0x1cc3ea){_0x2157bf=_0x2157bf-0x0;var _0x44b4df=_0x37a4[_0x2157bf];return _0x44b4df;};'use strict';var client=require(_0x437a('0x0'));exports['update']=function(_0x222222,_0x55fda8){return client[_0x437a('0x1')](_0x437a('0x2'),{'body':_0x55fda8,'options':{'where':{'id':_0x222222}},'log':_0x437a('0x3')});};exports['addTags']=function(_0x5f2883,_0xf52f1a){return client[_0x437a('0x1')](_0x437a('0x4'),{'body':_0xf52f1a,'options':{'where':{'id':_0x5f2883}},'log':_0x437a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b7d9985..f9da548 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 _0x7d9c=['create','Request','createWhatsappMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d9c,0x1c7));var _0xc7d9=function(_0x1c018e,_0xf39aaa){_0x1c018e=_0x1c018e-0x0;var _0x41c05b=_0x7d9c[_0x1c018e];return _0x41c05b;};'use strict';var client=require(_0xc7d9('0x0'));exports[_0xc7d9('0x1')]=function(_0x475cba){return client[_0xc7d9('0x2')]('CreateWhatsappMessage',{'body':_0x475cba,'log':_0xc7d9('0x3')});}; \ No newline at end of file +var _0x13f0=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x279f32,_0x19a015){var _0x42e7d1=function(_0x440ff6){while(--_0x440ff6){_0x279f32['push'](_0x279f32['shift']());}};_0x42e7d1(++_0x19a015);}(_0x13f0,0x1be));var _0x013f=function(_0x40da45,_0x29029f){_0x40da45=_0x40da45-0x0;var _0x29f717=_0x13f0[_0x40da45];return _0x29f717;};'use strict';var client=require(_0x013f('0x0'));exports[_0x013f('0x1')]=function(_0x138683){return client[_0x013f('0x2')](_0x013f('0x3'),{'body':_0x138683,'log':_0x013f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 511d71a..0c2d451 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 _0x4b0f=['name','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','Agents'];(function(_0x5cc9bb,_0x5967d0){var _0x12623c=function(_0x2fe03c){while(--_0x2fe03c){_0x5cc9bb['push'](_0x5cc9bb['shift']());}};_0x12623c(++_0x5967d0);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x4d745e,_0x508b76){_0x4d745e=_0x4d745e-0x0;var _0x4b759a=_0x4b0f[_0x4d745e];return _0x4b759a;};'use strict';var client=require('../client');exports[_0xf4b0('0x0')]=function(){return function(){return client[_0xf4b0('0x1')](_0xf4b0('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf4b0('0x3'),_0xf4b0('0x4')],'include':[{'model':_0xf4b0('0x5'),'as':_0xf4b0('0x6'),'attributes':['id',_0xf4b0('0x7'),_0xf4b0('0x8'),_0xf4b0('0x9')]}]},'log':_0xf4b0('0x0')});};}; \ No newline at end of file +var _0x422f=['GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x4a745e,_0x468df6){var _0x150784=function(_0x2f0740){while(--_0x2f0740){_0x4a745e['push'](_0x4a745e['shift']());}};_0x150784(++_0x468df6);}(_0x422f,0x1c7));var _0xf422=function(_0x5c596a,_0x1af4f6){_0x5c596a=_0x5c596a-0x0;var _0x557977=_0x422f[_0x5c596a];return _0x557977;};'use strict';var client=require('../client');exports[_0xf422('0x0')]=function(){return function(){return client['Request'](_0xf422('0x1'),{'options':{'raw':![],'attributes':['id',_0xf422('0x2'),'timeout',_0xf422('0x3')],'include':[{'model':_0xf422('0x4'),'as':_0xf422('0x5'),'attributes':['id',_0xf422('0x2'),_0xf422('0x6'),_0xf422('0x7')]}]},'log':_0xf422('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 78212ac..56b8075 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 _0xa593=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x48adf4,_0x41ffe1){var _0x503de5=function(_0xf0de6d){while(--_0xf0de6d){_0x48adf4['push'](_0x48adf4['shift']());}};_0x503de5(++_0x41ffe1);}(_0xa593,0x137));var _0x3a59=function(_0x42c29c,_0x53600d){_0x42c29c=_0x42c29c-0x0;var _0x141694=_0xa593[_0x42c29c];return _0x141694;};'use strict';var client=require(_0x3a59('0x0'));exports[_0x3a59('0x1')]=function(_0x2034b0){return client[_0x3a59('0x2')](_0x3a59('0x3'),{'body':_0x2034b0,'log':_0x3a59('0x3')});};exports[_0x3a59('0x4')]=function(_0x36d13a,_0x1d90d8){return client[_0x3a59('0x2')](_0x3a59('0x5'),{'body':_0x1d90d8,'options':{'where':{'uniqueid':_0x36d13a},'order':[['id',_0x3a59('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xe86a=['CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x4c62be,_0x4d408d){var _0x362bd6=function(_0x58909f){while(--_0x58909f){_0x4c62be['push'](_0x4c62be['shift']());}};_0x362bd6(++_0x4d408d);}(_0xe86a,0xf9));var _0xae86=function(_0x2f3e0b,_0xf31f13){_0x2f3e0b=_0x2f3e0b-0x0;var _0x460132=_0xe86a[_0x2f3e0b];return _0x460132;};'use strict';var client=require(_0xae86('0x0'));exports[_0xae86('0x1')]=function(_0x31829f){return client[_0xae86('0x2')]('CreateWhatsappQueueReport',{'body':_0x31829f,'log':_0xae86('0x3')});};exports[_0xae86('0x4')]=function(_0x557121,_0x4280e6){return client[_0xae86('0x2')]('UpdateWhatsappQueueReport',{'body':_0x4280e6,'options':{'where':{'uniqueid':_0x557121},'order':[['id',_0xae86('0x5')]],'limit':0x1},'log':_0xae86('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 d95c025..941458b 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 _0x803d=['error','[%s][AGENT]\x20%s','message','join','stop','find','timeout','atimeout','channel','START:%s','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','name','toLowerCase','consequence','length'];(function(_0xf5b44a,_0x4338c8){var _0x22484e=function(_0x59bc72){while(--_0x59bc72){_0xf5b44a['push'](_0xf5b44a['shift']());}};_0x22484e(++_0x4338c8);}(_0x803d,0x185));var _0xd803=function(_0x41a62d,_0x1059a8){_0x41a62d=_0x41a62d-0x0;var _0x2448e2=_0x803d[_0x41a62d];return _0x2448e2;};'use strict';var schema=require(_0xd803('0x0'));var _=require(_0xd803('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xd803('0x2'))(_0xd803('0x3'));var strategy=require(_0xd803('0x4'));var queue=schema({'name':{'type':_0xd803('0x5'),'required':!![],'message':_0xd803('0x6')},'timeout':{'type':_0xd803('0x7'),'message':_0xd803('0x8')}});function writeLog(_0x562219,_0x22c527,_0x483759){return logger['info'](util[_0xd803('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x562219,_0x22c527[_0xd803('0xa')],_0x483759));}function handleFindAgent(_0xedbe29){return function(_0x3dc801){return _0x3dc801[_0xd803('0xa')][_0xd803('0xb')]()===_0xedbe29['toLowerCase']();};}exports[_0xd803('0xc')]=function(_0x4c2f34,_0x246ef3,_0x460ef6,_0x55eaec){return function(_0x54a949){try{var _0x49af9e={'name':_0x246ef3[0x0],'timeout':_0x246ef3[0x1]};var _0x3b93f2=queue[_0xd803('0x0')](_0x49af9e,{'typecast':!![]});if(_0x3b93f2[_0xd803('0xd')]){logger[_0xd803('0xe')](_0xd803('0xf'),_0x4c2f34,_['map'](_0x3b93f2,_0xd803('0x10'))[_0xd803('0x11')](',\x20'));_0x54a949[_0xd803('0x12')]();}else{var _0x32a873=_[_0xd803('0x13')](_0x460ef6['agents'],handleFindAgent(_0x49af9e[_0xd803('0xa')]));if(_0x32a873){var _0x2c6261=(_0x49af9e[_0xd803('0x14')]||0xa)*0x3e8;var _0x414f26,_0xba716e;var _0x19046a=seqqueue['createQueue'](_0x2c6261);_0x19046a['id']=_0x4c2f34;_0x19046a[_0xd803('0x15')]=_0x2c6261;_0x19046a[_0xd803('0x16')]=_0x55eaec[_0xd803('0x16')];writeLog(_0x4c2f34,_0x32a873,util[_0xd803('0x9')](_0xd803('0x17'),_0x2c6261));_0x460ef6[_0xd803('0x18')][_0x4c2f34]['on']('end',function(){logger[_0xd803('0x19')](_0xd803('0x1a'),_0x4c2f34);clearTimeout(_0xba716e);_0xba716e=undefined;_0x19046a['close']();if(_0x460ef6['rules'][_0x4c2f34]){delete _0x460ef6[_0xd803('0x18')][_0x4c2f34];}_0x54a949[_0xd803('0x12')]();});_0x460ef6[_0xd803('0x18')][_0x4c2f34]['on'](_0xd803('0x1b'),function(){if(_0x460ef6[_0xd803('0x18')][_0x4c2f34]){delete _0x460ef6[_0xd803('0x18')][_0x4c2f34];}});_0xba716e=setTimeout(function(){logger[_0xd803('0x19')]('[%s][AGENT]\x20ROUTING\x20END',_0x4c2f34);clearTimeout(_0xba716e);_0x19046a[_0xd803('0x1c')]();_0x54a949['next']();},_0x2c6261);strategy['agent'](_0x19046a,_0x32a873,_0x460ef6,_0x55eaec);}else{logger[_0xd803('0xe')](_0xd803('0x1d'),_0x4c2f34,_0x49af9e[_0xd803('0xa')]);_0x54a949['stop']();}}}catch(_0x5f37f1){console['log'](_0x5f37f1);logger[_0xd803('0xe')]('[%s][QUEUE]\x20%s',_0x4c2f34,_0x5f37f1[_0xd803('0x1e')]);_0x54a949[_0xd803('0x12')]();}};}; \ No newline at end of file +var _0x58ac=['message','join','find','createQueue','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x58ac,0x121));var _0xc58a=function(_0x52a497,_0xc4c062){_0x52a497=_0x52a497-0x0;var _0x36d05f=_0x58ac[_0x52a497];return _0x36d05f;};'use strict';var schema=require(_0xc58a('0x0'));var _=require(_0xc58a('0x1'));var util=require('util');var seqqueue=require(_0xc58a('0x2'));var logger=require(_0xc58a('0x3'))(_0xc58a('0x4'));var strategy=require(_0xc58a('0x5'));var queue=schema({'name':{'type':_0xc58a('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xc58a('0x7'),'message':_0xc58a('0x8')}});function writeLog(_0x84ddfa,_0x151413,_0x320af5){return logger[_0xc58a('0x9')](util[_0xc58a('0xa')](_0xc58a('0xb'),_0x84ddfa,_0x151413[_0xc58a('0xc')],_0x320af5));}function handleFindAgent(_0x78a348){return function(_0x2e0cc6){return _0x2e0cc6['name'][_0xc58a('0xd')]()===_0x78a348['toLowerCase']();};}exports[_0xc58a('0xe')]=function(_0x1c7bca,_0x27fa14,_0x113dd8,_0x590128){return function(_0x1f7fb8){try{var _0x1139cb={'name':_0x27fa14[0x0],'timeout':_0x27fa14[0x1]};var _0xa00710=queue[_0xc58a('0x0')](_0x1139cb,{'typecast':!![]});if(_0xa00710['length']){logger['error'](_0xc58a('0xf'),_0x1c7bca,_[_0xc58a('0x10')](_0xa00710,_0xc58a('0x11'))[_0xc58a('0x12')](',\x20'));_0x1f7fb8['stop']();}else{var _0x16d114=_[_0xc58a('0x13')](_0x113dd8['agents'],handleFindAgent(_0x1139cb[_0xc58a('0xc')]));if(_0x16d114){var _0x1492f0=(_0x1139cb['timeout']||0xa)*0x3e8;var _0x5be539,_0xcc5c41;var _0x3dc902=seqqueue[_0xc58a('0x14')](_0x1492f0);_0x3dc902['id']=_0x1c7bca;_0x3dc902['atimeout']=_0x1492f0;_0x3dc902[_0xc58a('0x15')]=_0x590128[_0xc58a('0x15')];writeLog(_0x1c7bca,_0x16d114,util[_0xc58a('0xa')]('START:%s',_0x1492f0));_0x113dd8[_0xc58a('0x16')][_0x1c7bca]['on'](_0xc58a('0x17'),function(){logger[_0xc58a('0x9')](_0xc58a('0x18'),_0x1c7bca);clearTimeout(_0xcc5c41);_0xcc5c41=undefined;_0x3dc902[_0xc58a('0x19')]();if(_0x113dd8['rules'][_0x1c7bca]){delete _0x113dd8[_0xc58a('0x16')][_0x1c7bca];}_0x1f7fb8[_0xc58a('0x1a')]();});_0x113dd8[_0xc58a('0x16')][_0x1c7bca]['on']('complete',function(){if(_0x113dd8[_0xc58a('0x16')][_0x1c7bca]){delete _0x113dd8[_0xc58a('0x16')][_0x1c7bca];}});_0xcc5c41=setTimeout(function(){logger[_0xc58a('0x9')](_0xc58a('0x1b'),_0x1c7bca);clearTimeout(_0xcc5c41);_0x3dc902['close']();_0x1f7fb8[_0xc58a('0x1c')]();},_0x1492f0);strategy[_0xc58a('0x1d')](_0x3dc902,_0x16d114,_0x113dd8,_0x590128);}else{logger[_0xc58a('0x1e')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x1c7bca,_0x1139cb['name']);_0x1f7fb8['stop']();}}}catch(_0x23cb9d){console[_0xc58a('0x1f')](_0x23cb9d);logger[_0xc58a('0x1e')](_0xc58a('0x20'),_0x1c7bca,_0x23cb9d[_0xc58a('0x21')]);_0x1f7fb8[_0xc58a('0x1a')]();}};}; \ 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 aad63a0..95c9d2a 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 _0x5fab=['message','toString','postText','next','amazonlex','Message','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','body','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x45d4f3,_0x2fa12b){var _0x4deec2=function(_0x405794){while(--_0x405794){_0x45d4f3['push'](_0x45d4f3['shift']());}};_0x4deec2(++_0x2fa12b);}(_0x5fab,0x177));var _0xb5fa=function(_0x1a2d37,_0x19cd85){_0x1a2d37=_0x1a2d37-0x0;var _0x4d5e76=_0x5fab[_0x1a2d37];return _0x4d5e76;};'use strict';var _=require(_0xb5fa('0x0'));var moment=require(_0xb5fa('0x1'));var AWS=require('aws-sdk');var utils=require(_0xb5fa('0x2'));var logger=require(_0xb5fa('0x3'))(_0xb5fa('0x4'));var rpc={'chatMessage':require(_0xb5fa('0x5')),'openchannelMessage':require(_0xb5fa('0x6')),'mailMessage':require(_0xb5fa('0x7')),'smsMessage':require(_0xb5fa('0x8')),'faxMessage':require(_0xb5fa('0x9')),'whatsappMessage':require(_0xb5fa('0xa'))};exports[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return function(_0x2e3804){try{if(!_[_0xb5fa('0xc')](this[_0xb5fa('0xd')]['UserId'])){logger[_0xb5fa('0xe')](_0xb5fa('0xf'),_0x4a0249,_0xb5fa('0x10'));return _0x2e3804['next']();}var _0x5b5ea8={'ContactId':this[_0xb5fa('0x11')]['id'],'sentAt':moment()[_0xb5fa('0x12')](_0xb5fa('0x13')),'direction':_0xb5fa('0x14')};var _0x35ad13=this[_0xb5fa('0x15')];if(_0x35ad13===_0xb5fa('0x16')){_0x5b5ea8[_0xb5fa('0x17')]=this[_0xb5fa('0x18')]['id'];}else{_0x5b5ea8[_['upperFirst'](_0x35ad13)+_0xb5fa('0x19')]=this[_0xb5fa('0x18')]['id'];}_0x5b5ea8[_['upperFirst'](_0x35ad13)+_0xb5fa('0x1a')]=this['interaction']['id'];if(this[_0xb5fa('0xd')][_0xb5fa('0x1b')]){var _0x40c914=_0x5d70f6[0x4];if(!_[_0xb5fa('0x1c')](_0x40c914)){_0x5b5ea8[_0xb5fa('0x1d')]=utils['getMustacheRender'](_0x40c914,this);return rpc[_0x35ad13+'Message'][_0xb5fa('0x1e')](_0x5b5ea8)[_0xb5fa('0x1f')](function(_0x31f252){logger[_0xb5fa('0xe')]('[%s][AMAZONLEX]\x20%s',_0x4a0249,_0x5b5ea8['body']);})[_0xb5fa('0x20')](function(_0x1f7f05){logger[_0xb5fa('0x21')](_0xb5fa('0xf'),_0x4a0249,JSON[_0xb5fa('0x22')](_0x1f7f05));})[_0xb5fa('0x23')](function(){logger[_0xb5fa('0xe')](_0xb5fa('0x24'),_0x4a0249);_0x2e3804[_0xb5fa('0x25')]();});}else{logger[_0xb5fa('0xe')](_0xb5fa('0x26'),_0x4a0249);_0x2e3804[_0xb5fa('0x25')]();}}else{var _0x5cd822=this;var _0x432bfa=new AWS['LexRuntime']({'accessKeyId':_0x5d70f6[0x0],'secretAccessKey':_0x5d70f6[0x1],'region':_0x5d70f6[0x2]});var _0x37ae06={'botAlias':'$LATEST','botName':_0x5d70f6[0x3],'inputText':this[_0xb5fa('0x27')][_0xb5fa('0x1d')],'userId':this['channel']+':'+this[_0xb5fa('0xd')]['id'][_0xb5fa('0x28')]()};_0x432bfa[_0xb5fa('0x29')](_0x37ae06,function(_0x47f71a,_0x32a85c){if(_0x47f71a){logger[_0xb5fa('0x21')](_0xb5fa('0xf'),_0x4a0249,_0x47f71a['message']);_0x2e3804[_0xb5fa('0x2a')]();}else if(_0x32a85c&&_0x32a85c['message']){_0x5cd822[_0xb5fa('0x1d')][_0xb5fa('0x2b')]=_0x32a85c;_0x5b5ea8[_0xb5fa('0x1d')]=_0x32a85c[_0xb5fa('0x27')];return rpc[_0x35ad13+_0xb5fa('0x2c')][_0xb5fa('0x1e')](_0x5b5ea8)[_0xb5fa('0x1f')](function(_0x20d649){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4a0249,_0x5b5ea8['body']);if(_0x32a85c['dialogState']==_0xb5fa('0x2d')){_0x2e3804[_0xb5fa('0x2a')]();}else{_0x2e3804[_0xb5fa('0x25')]();}})[_0xb5fa('0x20')](function(_0x534884){logger[_0xb5fa('0x21')](_0xb5fa('0xf'),_0x4a0249,JSON[_0xb5fa('0x22')](_0x534884));_0x2e3804[_0xb5fa('0x2a')]();});}else{_0x2e3804[_0xb5fa('0x2a')]();}});}}catch(_0x142bfa){logger[_0xb5fa('0x21')](_0xb5fa('0xf'),_0x4a0249,JSON[_0xb5fa('0x22')](_0x142bfa));_0x2e3804[_0xb5fa('0x25')]();}};}; \ No newline at end of file +var _0xabce=['YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','then','catch','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','Message','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format'];(function(_0x218341,_0x4d44ea){var _0x2093d8=function(_0x3ffa0b){while(--_0x3ffa0b){_0x218341['push'](_0x218341['shift']());}};_0x2093d8(++_0x4d44ea);}(_0xabce,0x103));var _0xeabc=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xabce[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0xeabc('0x0'));var moment=require(_0xeabc('0x1'));var AWS=require(_0xeabc('0x2'));var utils=require(_0xeabc('0x3'));var logger=require(_0xeabc('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xeabc('0x5')),'mailMessage':require(_0xeabc('0x6')),'smsMessage':require(_0xeabc('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return function(_0x52ede8){try{if(!_[_0xeabc('0x9')](this[_0xeabc('0xa')][_0xeabc('0xb')])){logger['info'](_0xeabc('0xc'),_0x52a4d7,_0xeabc('0xd'));return _0x52ede8[_0xeabc('0xe')]();}var _0x1b4d1b={'ContactId':this[_0xeabc('0xf')]['id'],'sentAt':moment()[_0xeabc('0x10')](_0xeabc('0x11')),'direction':_0xeabc('0x12')};var _0xdb5022=this[_0xeabc('0x13')];if(_0xdb5022===_0xeabc('0x14')){_0x1b4d1b[_0xeabc('0x15')]=this[_0xeabc('0x16')]['id'];}else{_0x1b4d1b[_[_0xeabc('0x17')](_0xdb5022)+_0xeabc('0x18')]=this[_0xeabc('0x16')]['id'];}_0x1b4d1b[_['upperFirst'](_0xdb5022)+_0xeabc('0x19')]=this[_0xeabc('0xa')]['id'];if(this[_0xeabc('0xa')]['created']){var _0x5f4ee8=_0x229ba4[0x4];if(!_[_0xeabc('0x1a')](_0x5f4ee8)){_0x1b4d1b[_0xeabc('0x1b')]=utils[_0xeabc('0x1c')](_0x5f4ee8,this);return rpc[_0xdb5022+'Message'][_0xeabc('0x1d')](_0x1b4d1b)[_0xeabc('0x1e')](function(_0x49f2d8){logger['info'](_0xeabc('0xc'),_0x52a4d7,_0x1b4d1b['body']);})[_0xeabc('0x1f')](function(_0x1b64b9){logger[_0xeabc('0x20')](_0xeabc('0xc'),_0x52a4d7,JSON[_0xeabc('0x21')](_0x1b64b9));})[_0xeabc('0x22')](function(){logger[_0xeabc('0x23')](_0xeabc('0x24'),_0x52a4d7);_0x52ede8['stop']();});}else{logger[_0xeabc('0x23')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x52a4d7);_0x52ede8[_0xeabc('0x25')]();}}else{var _0x16530c=this;var _0x502947=new AWS[(_0xeabc('0x26'))]({'accessKeyId':_0x229ba4[0x0],'secretAccessKey':_0x229ba4[0x1],'region':_0x229ba4[0x2]});var _0x41d67a={'botAlias':_0xeabc('0x27'),'botName':_0x229ba4[0x3],'inputText':this[_0xeabc('0x28')][_0xeabc('0x1b')],'userId':this['channel']+':'+this[_0xeabc('0xa')]['id'][_0xeabc('0x29')]()};_0x502947[_0xeabc('0x2a')](_0x41d67a,function(_0x5bdd57,_0x457f27){if(_0x5bdd57){logger[_0xeabc('0x20')](_0xeabc('0xc'),_0x52a4d7,_0x5bdd57[_0xeabc('0x28')]);_0x52ede8['next']();}else if(_0x457f27&&_0x457f27[_0xeabc('0x28')]){_0x16530c['body'][_0xeabc('0x2b')]=_0x457f27;_0x1b4d1b['body']=_0x457f27[_0xeabc('0x28')];return rpc[_0xdb5022+_0xeabc('0x2c')][_0xeabc('0x1d')](_0x1b4d1b)[_0xeabc('0x1e')](function(_0x3a1a04){logger[_0xeabc('0x23')](_0xeabc('0xc'),_0x52a4d7,_0x1b4d1b['body']);if(_0x457f27['dialogState']==_0xeabc('0x2d')){_0x52ede8['next']();}else{_0x52ede8[_0xeabc('0x25')]();}})[_0xeabc('0x1f')](function(_0x48fb52){logger[_0xeabc('0x20')](_0xeabc('0xc'),_0x52a4d7,JSON[_0xeabc('0x21')](_0x48fb52));_0x52ede8[_0xeabc('0xe')]();});}else{_0x52ede8[_0xeabc('0xe')]();}});}}catch(_0x481ee1){logger[_0xeabc('0x20')](_0xeabc('0xc'),_0x52a4d7,JSON[_0xeabc('0x21')](_0x481ee1));_0x52ede8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 6676245..13e07a3 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 _0xc5b5=['../../rpc/whatsappMessage','../../mailRpc','consequence','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','getMustacheRender','contact','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','channel','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','html','','','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','[RPC][%s][AUTOREPLY]\x20%s','finally','catch','error','stringify','stop','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x2805bd,_0x5f4cea){var _0x421381=function(_0x32af17){while(--_0x32af17){_0x2805bd['push'](_0x2805bd['shift']());}};_0x421381(++_0x5f4cea);}(_0xc5b5,0x1b2));var _0x5c5b=function(_0x137e04,_0x3c0799){_0x137e04=_0x137e04-0x0;var _0x4c6762=_0xc5b5[_0x137e04];return _0x4c6762;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x5c5b('0x0'));var logger=require(_0x5c5b('0x1'))('routing');var rpc={'chatMessage':require(_0x5c5b('0x2')),'openchannelMessage':require(_0x5c5b('0x3')),'mailMessage':require(_0x5c5b('0x4')),'smsMessage':require(_0x5c5b('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5c5b('0x6'))};var mailRpc=require(_0x5c5b('0x7'));exports[_0x5c5b('0x8')]=function(_0x6cb181,_0x1e4ffd){return function(_0x15bc02){try{if(_0x1e4ffd[0x0]==='1'&&(_['isNil'](this[_0x5c5b('0x9')][_0x5c5b('0xa')])||!this['interaction'][_0x5c5b('0xa')])){logger['info'](_0x5c5b('0xb'),_0x6cb181,_0x5c5b('0xc'));return _0x15bc02[_0x5c5b('0xd')]();}var _0x484f47=this['channel'];var _0xe8a979={'body':utils[_0x5c5b('0xe')](_0x1e4ffd[0x1],this),'ContactId':this[_0x5c5b('0xf')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x5c5b('0x10')]){_0xe8a979['to']=this[_0x5c5b('0x10')][_0x5c5b('0x11')]||'';_0xe8a979['cc']=this[_0x5c5b('0x10')]['cc']||'';_0xe8a979[_0x5c5b('0x11')]=this['message']['to']||'';_0xe8a979[_0x5c5b('0x12')]=this[_0x5c5b('0x10')][_0x5c5b('0x12')]||'';_0xe8a979[_0x5c5b('0x13')]=!![];if(this[_0x5c5b('0x10')][_0x5c5b('0x14')]){_0xe8a979[_0x5c5b('0x14')]='';_0xe8a979[_0x5c5b('0x14')]+=_[_0x5c5b('0x15')](this['message'][_0x5c5b('0x14')],_0x5c5b('0x16'))?'':_0x5c5b('0x17');_0xe8a979[_0x5c5b('0x14')]+=this[_0x5c5b('0x10')][_0x5c5b('0x14')];}}if(this['channel']===_0x5c5b('0x18')){_0xe8a979[_0x5c5b('0x19')]=this[_0x5c5b('0x1a')]['id'];}else{_0xe8a979[_['upperFirst'](this[_0x5c5b('0x1b')])+'AccountId']=this['account']['id'];}_0xe8a979[_['upperFirst'](this['channel'])+_0x5c5b('0x1c')]=this[_0x5c5b('0x9')]['id'];if(rpc[this[_0x5c5b('0x1b')]+_0x5c5b('0x1d')]){if(this[_0x5c5b('0x1b')]==='mail'){var _0x517e5c={'tls':{'rejectUnauthorized':![]}};if(this[_0x5c5b('0x1a')][_0x5c5b('0x1e')][_0x5c5b('0x1f')]){_0x517e5c[_0x5c5b('0x1f')]=this[_0x5c5b('0x1a')][_0x5c5b('0x1e')][_0x5c5b('0x1f')];}else{_0x517e5c[_0x5c5b('0x20')]=this[_0x5c5b('0x1a')]['Smtp']['host'];_0x517e5c[_0x5c5b('0x21')]=this[_0x5c5b('0x1a')][_0x5c5b('0x1e')]['port'];_0x517e5c[_0x5c5b('0x22')]=this[_0x5c5b('0x1a')][_0x5c5b('0x1e')][_0x5c5b('0x22')];}if(this['account'][_0x5c5b('0x1e')][_0x5c5b('0x23')]){_0x517e5c[_0x5c5b('0x24')]={'user':this[_0x5c5b('0x1a')][_0x5c5b('0x1e')][_0x5c5b('0x25')],'pass':this['account'][_0x5c5b('0x1e')][_0x5c5b('0x26')]};}_0xe8a979[_0x5c5b('0x27')]=this[_0x5c5b('0x10')]['messageId'];_0xe8a979[_0x5c5b('0x28')]=_0x5c5b('0x29')+_['replace'](_0xe8a979['body'],'','replace','body','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','routing','../../rpc/openchannelMessage'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x6ff5,0xab));var _0x56ff=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6ff5[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x56ff('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x56ff('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x56ff('0x2')),'mailMessage':require(_0x56ff('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x56ff('0x4'))};var mailRpc=require(_0x56ff('0x5'));exports[_0x56ff('0x6')]=function(_0x3f06be,_0x1f7c30){return function(_0x308195){try{if(_0x1f7c30[0x0]==='1'&&(_[_0x56ff('0x7')](this[_0x56ff('0x8')][_0x56ff('0x9')])||!this[_0x56ff('0x8')][_0x56ff('0x9')])){logger[_0x56ff('0xa')](_0x56ff('0xb'),_0x3f06be,_0x56ff('0xc'));return _0x308195[_0x56ff('0xd')]();}var _0x2ea094=this[_0x56ff('0xe')];var _0x27a815={'body':utils[_0x56ff('0xf')](_0x1f7c30[0x1],this),'ContactId':this[_0x56ff('0x10')]['id'],'sentAt':moment()[_0x56ff('0x11')](_0x56ff('0x12')),'direction':_0x56ff('0x13')};if(this[_0x56ff('0x14')]){_0x27a815['to']=this[_0x56ff('0x14')][_0x56ff('0x15')]||'';_0x27a815['cc']=this[_0x56ff('0x14')]['cc']||'';_0x27a815[_0x56ff('0x15')]=this[_0x56ff('0x14')]['to']||'';_0x27a815[_0x56ff('0x16')]=this[_0x56ff('0x14')][_0x56ff('0x16')]||'';_0x27a815[_0x56ff('0x17')]=!![];if(this['message'][_0x56ff('0x18')]){_0x27a815[_0x56ff('0x18')]='';_0x27a815[_0x56ff('0x18')]+=_[_0x56ff('0x19')](this[_0x56ff('0x14')]['subject'],'Re:')?'':_0x56ff('0x1a');_0x27a815[_0x56ff('0x18')]+=this['message'][_0x56ff('0x18')];}}if(this[_0x56ff('0xe')]===_0x56ff('0x1b')){_0x27a815[_0x56ff('0x1c')]=this['account']['id'];}else{_0x27a815[_[_0x56ff('0x1d')](this['channel'])+_0x56ff('0x1e')]=this[_0x56ff('0x1f')]['id'];}_0x27a815[_[_0x56ff('0x1d')](this['channel'])+_0x56ff('0x20')]=this[_0x56ff('0x8')]['id'];if(rpc[this[_0x56ff('0xe')]+_0x56ff('0x21')]){if(this[_0x56ff('0xe')]===_0x56ff('0x22')){var _0x365fb4={'tls':{'rejectUnauthorized':![]}};if(this[_0x56ff('0x1f')][_0x56ff('0x23')][_0x56ff('0x24')]){_0x365fb4[_0x56ff('0x24')]=this[_0x56ff('0x1f')][_0x56ff('0x23')]['service'];}else{_0x365fb4[_0x56ff('0x25')]=this['account']['Smtp']['host'];_0x365fb4['port']=this[_0x56ff('0x1f')][_0x56ff('0x23')][_0x56ff('0x26')];_0x365fb4[_0x56ff('0x27')]=this[_0x56ff('0x1f')][_0x56ff('0x23')]['secure'];}if(this[_0x56ff('0x1f')][_0x56ff('0x23')][_0x56ff('0x28')]){_0x365fb4[_0x56ff('0x29')]={'user':this[_0x56ff('0x1f')][_0x56ff('0x23')][_0x56ff('0x2a')],'pass':this[_0x56ff('0x1f')][_0x56ff('0x23')]['pass']};}_0x27a815[_0x56ff('0x2b')]=this[_0x56ff('0x14')][_0x56ff('0x2c')];_0x27a815[_0x56ff('0x2d')]=_0x56ff('0x2e')+_[_0x56ff('0x2f')](_0x27a815[_0x56ff('0x30')],'';return mailRpc['sendMailMessage'](_0x365fb4,_0x27a815)[_0x56ff('0x31')](function(_0x4d604f){logger[_0x56ff('0xa')](_0x56ff('0x32'),_0x3f06be);_0x27a815[_0x56ff('0x2c')]=_0x4d604f['message'][_0x56ff('0x2c')];return rpc[_0x2ea094+_0x56ff('0x21')][_0x56ff('0x33')](_0x27a815);})['then'](function(_0x1287a6){logger[_0x56ff('0xa')]('[%s][AUTOREPLY]\x20%s',_0x3f06be,JSON[_0x56ff('0x34')](_0x1287a6));})[_0x56ff('0x35')](function(_0x186748){logger[_0x56ff('0x36')](_0x56ff('0x37'),_0x3f06be,JSON[_0x56ff('0x34')](_0x186748));})[_0x56ff('0x38')](function(){_0x308195[_0x56ff('0xd')]();});}else{return rpc[this['channel']+_0x56ff('0x21')][_0x56ff('0x33')](_0x27a815)[_0x56ff('0x31')](function(_0x4d7baf){logger[_0x56ff('0xa')](_0x56ff('0xb'),_0x3f06be,_0x27a815[_0x56ff('0x30')]);})[_0x56ff('0x35')](function(_0x4a2093){logger[_0x56ff('0x36')]('[%s][AUTOREPLY]\x20%s',_0x3f06be,JSON[_0x56ff('0x34')](_0x4a2093));})[_0x56ff('0x38')](function(){_0x308195[_0x56ff('0xd')]();});}}}catch(_0x3ce820){logger['error'](_0x56ff('0xb'),_0x3f06be,JSON[_0x56ff('0x34')](_0x3ce820));_0x308195[_0x56ff('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 5b9aadf..5b70151 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 _0xdbb9=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x357a01,_0x1e57d0){var _0x252c1f=function(_0x53c71f){while(--_0x53c71f){_0x357a01['push'](_0x357a01['shift']());}};_0x252c1f(++_0x1e57d0);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x1057c7,_0x2021c1){_0x1057c7=_0x1057c7-0x0;var _0x3a8ee2=_0xdbb9[_0x1057c7];return _0x3a8ee2;};'use strict';var moment=require('moment');var logger=require(_0x9dbb('0x0'))(_0x9dbb('0x1'));var rpc={'chatInteraction':require(_0x9dbb('0x2')),'openchannelInteraction':require(_0x9dbb('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x9dbb('0x4')),'faxInteraction':require(_0x9dbb('0x5')),'whatsappInteraction':require(_0x9dbb('0x6'))};exports[_0x9dbb('0x7')]=function(_0xb960a5,_0x398f78,_0x4c7cb2,_0x4f1eec){return function(_0x523a5e){try{logger[_0x9dbb('0x8')](_0x9dbb('0x9'),_0xb960a5,_0x398f78[0x0]);var _0x203da3={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x9dbb('0xa'),'disposition':_0x398f78[0x0]};if(rpc[_0x4f1eec[_0x9dbb('0xb')]+_0x9dbb('0xc')]){rpc[_0x4f1eec['channel']+_0x9dbb('0xc')][_0x9dbb('0xd')](_0x4f1eec[_0x9dbb('0xe')]['id'],_0x203da3)[_0x9dbb('0xf')](function(_0x4c493e){logger[_0x9dbb('0x8')](_0x9dbb('0x10'),_0xb960a5,_0x4f1eec[_0x9dbb('0xe')]['id']);})[_0x9dbb('0x11')](function(_0x3fe0bd){logger[_0x9dbb('0x12')](_0x9dbb('0x13'),_0xb960a5,JSON[_0x9dbb('0x14')](_0x3fe0bd));})[_0x9dbb('0x15')](function(){_0x523a5e[_0x9dbb('0x16')]();});}}catch(_0x293028){logger[_0x9dbb('0x12')](_0x9dbb('0x13'),_0xb960a5,JSON[_0x9dbb('0x14')](_0x293028));_0x523a5e[_0x9dbb('0x16')]();}};}; \ No newline at end of file +var _0x4e47=['Interaction','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel'];(function(_0x138d5f,_0x182a7f){var _0x4d8a0a=function(_0x5eaf9d){while(--_0x5eaf9d){_0x138d5f['push'](_0x138d5f['shift']());}};_0x4d8a0a(++_0x182a7f);}(_0x4e47,0x17f));var _0x74e4=function(_0x4680f9,_0x31837e){_0x4680f9=_0x4680f9-0x0;var _0x3e38dc=_0x4e47[_0x4680f9];return _0x3e38dc;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0x74e4('0x0'));var rpc={'chatInteraction':require(_0x74e4('0x1')),'openchannelInteraction':require(_0x74e4('0x2')),'smsInteraction':require(_0x74e4('0x3')),'mailInteraction':require(_0x74e4('0x4')),'faxInteraction':require(_0x74e4('0x5')),'whatsappInteraction':require(_0x74e4('0x6'))};exports[_0x74e4('0x7')]=function(_0x5d03b8,_0x28055c,_0x19ec88,_0x504519){return function(_0x15f9e1){try{logger[_0x74e4('0x8')](_0x74e4('0x9'),_0x5d03b8,_0x28055c[0x0]);var _0x2e61b6={'closed':0x1,'closedAt':moment()[_0x74e4('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x74e4('0xb'),'disposition':_0x28055c[0x0]};if(rpc[_0x504519[_0x74e4('0xc')]+_0x74e4('0xd')]){rpc[_0x504519[_0x74e4('0xc')]+_0x74e4('0xd')]['update'](_0x504519[_0x74e4('0xe')]['id'],_0x2e61b6)[_0x74e4('0xf')](function(_0x55ef15){logger[_0x74e4('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5d03b8,_0x504519[_0x74e4('0xe')]['id']);})[_0x74e4('0x10')](function(_0x1c55cd){logger[_0x74e4('0x11')](_0x74e4('0x12'),_0x5d03b8,JSON[_0x74e4('0x13')](_0x1c55cd));})[_0x74e4('0x14')](function(){_0x15f9e1[_0x74e4('0x15')]();});}}catch(_0x1dda27){logger[_0x74e4('0x11')](_0x74e4('0x12'),_0x5d03b8,JSON['stringify'](_0x1dda27));_0x15f9e1['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 f4e8fc9..013d62e 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 _0x04dd=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','upperFirst','AccountId','account','body','getMustacheRender','Message','create','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','then','result','speech','next','error','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x12cfed,_0x7c5ed3){var _0x17e0fa=function(_0x2f0d88){while(--_0x2f0d88){_0x12cfed['push'](_0x12cfed['shift']());}};_0x17e0fa(++_0x7c5ed3);}(_0x04dd,0xdd));var _0xd04d=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x04dd[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0xd04d('0x0'));var moment=require(_0xd04d('0x1'));var apiai=require('apiai-promise');var md5=require(_0xd04d('0x2'));var utils=require(_0xd04d('0x3'));var logger=require(_0xd04d('0x4'))(_0xd04d('0x5'));var rpc={'chatMessage':require(_0xd04d('0x6')),'openchannelMessage':require(_0xd04d('0x7')),'mailMessage':require(_0xd04d('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd04d('0x9')),'whatsappMessage':require(_0xd04d('0xa'))};exports['consequence']=function(_0x3ffc76,_0x428ad8){return function(_0x1ce774){try{if(!_[_0xd04d('0xb')](this[_0xd04d('0xc')]['UserId'])){logger[_0xd04d('0xd')](_0xd04d('0xe'),_0x3ffc76,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1ce774['next']();}var _0x58de42={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd04d('0xf')](_0xd04d('0x10')),'direction':_0xd04d('0x11')};var _0x5d887a=this['channel'];if(_0x5d887a===_0xd04d('0x12')){_0x58de42['ChatWebsiteId']=this['account']['id'];}else{_0x58de42[_[_0xd04d('0x13')](_0x5d887a)+_0xd04d('0x14')]=this[_0xd04d('0x15')]['id'];}_0x58de42[_['upperFirst'](_0x5d887a)+'InteractionId']=this[_0xd04d('0xc')]['id'];if(this[_0xd04d('0xc')]['created']){var _0x5d66ea=_0x428ad8[0x2];if(!_['isEmpty'](_0x5d66ea)){_0x58de42[_0xd04d('0x16')]=utils[_0xd04d('0x17')](_0x5d66ea,this);return rpc[_0x5d887a+_0xd04d('0x18')][_0xd04d('0x19')](_0x58de42)['then'](function(_0x4d7000){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x3ffc76,_0x58de42[_0xd04d('0x16')]);})[_0xd04d('0x1a')](function(_0x3630d4){logger['error'](_0xd04d('0xe'),_0x3ffc76,JSON[_0xd04d('0x1b')](_0x3630d4));})[_0xd04d('0x1c')](function(){logger[_0xd04d('0xd')](_0xd04d('0x1d'),_0x3ffc76);_0x1ce774['stop']();});}else{logger[_0xd04d('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3ffc76);_0x1ce774[_0xd04d('0x1e')]();}}else{var _0x57dc9c=this;var _0x21ee7c=apiai(_0x428ad8[0x0],{'language':_0x428ad8[0x1]||'en'});return _0x21ee7c[_0xd04d('0x1f')](this[_0xd04d('0x20')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0xd04d('0x21')](function(_0x1ba2ac){_0x57dc9c['body']['dialogflow']=_0x1ba2ac;_0x58de42[_0xd04d('0x16')]=_0x1ba2ac[_0xd04d('0x22')]['fulfillment'][_0xd04d('0x23')];return rpc[_0x5d887a+_0xd04d('0x18')]['create'](_0x58de42)['then'](function(_0x35e66b){logger[_0xd04d('0xd')](_0xd04d('0xe'),_0x3ffc76,_0x58de42[_0xd04d('0x16')]);if(_0x1ba2ac[_0xd04d('0x22')]['metadata']['endConversation']){_0x1ce774[_0xd04d('0x24')]();}else{_0x1ce774[_0xd04d('0x1e')]();}})['catch'](function(_0x366048){logger[_0xd04d('0x25')](_0xd04d('0xe'),_0x3ffc76,JSON[_0xd04d('0x1b')](_0x366048));_0x1ce774['next']();});})['catch'](function(_0x4e85d8){logger[_0xd04d('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x3ffc76,_0x4e85d8[_0xd04d('0x20')]);_0x1ce774[_0xd04d('0x24')]();});}}catch(_0x2fb661){logger[_0xd04d('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x3ffc76,JSON[_0xd04d('0x1b')](_0x2fb661));_0x1ce774['stop']();}};}; \ No newline at end of file +var _0xa0fc=['stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','metadata','catch','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','upperFirst','InteractionId','created','body','getMustacheRender','Message','create','then','error'];(function(_0x2c7514,_0x3c0178){var _0xb80c34=function(_0x1ff3ea){while(--_0x1ff3ea){_0x2c7514['push'](_0x2c7514['shift']());}};_0xb80c34(++_0x3c0178);}(_0xa0fc,0x107));var _0xca0f=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0xa0fc[_0x5a7112];return _0x3147f7;};'use strict';var _=require(_0xca0f('0x0'));var moment=require('moment');var apiai=require(_0xca0f('0x1'));var md5=require(_0xca0f('0x2'));var utils=require(_0xca0f('0x3'));var logger=require(_0xca0f('0x4'))(_0xca0f('0x5'));var rpc={'chatMessage':require(_0xca0f('0x6')),'openchannelMessage':require(_0xca0f('0x7')),'mailMessage':require(_0xca0f('0x8')),'smsMessage':require(_0xca0f('0x9')),'faxMessage':require(_0xca0f('0xa')),'whatsappMessage':require(_0xca0f('0xb'))};exports[_0xca0f('0xc')]=function(_0x266f94,_0x188d7a){return function(_0x5c63a8){try{if(!_[_0xca0f('0xd')](this[_0xca0f('0xe')][_0xca0f('0xf')])){logger[_0xca0f('0x10')](_0xca0f('0x11'),_0x266f94,_0xca0f('0x12'));return _0x5c63a8[_0xca0f('0x13')]();}var _0xca2113={'ContactId':this[_0xca0f('0x14')]['id'],'sentAt':moment()[_0xca0f('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x33185e=this['channel'];if(_0x33185e==='chat'){_0xca2113['ChatWebsiteId']=this['account']['id'];}else{_0xca2113[_[_0xca0f('0x16')](_0x33185e)+'AccountId']=this['account']['id'];}_0xca2113[_[_0xca0f('0x16')](_0x33185e)+_0xca0f('0x17')]=this[_0xca0f('0xe')]['id'];if(this['interaction'][_0xca0f('0x18')]){var _0x482a60=_0x188d7a[0x2];if(!_['isEmpty'](_0x482a60)){_0xca2113[_0xca0f('0x19')]=utils[_0xca0f('0x1a')](_0x482a60,this);return rpc[_0x33185e+_0xca0f('0x1b')][_0xca0f('0x1c')](_0xca2113)[_0xca0f('0x1d')](function(_0x5aa9ba){logger['info'](_0xca0f('0x11'),_0x266f94,_0xca2113[_0xca0f('0x19')]);})['catch'](function(_0x22861d){logger[_0xca0f('0x1e')](_0xca0f('0x11'),_0x266f94,JSON[_0xca0f('0x1f')](_0x22861d));})[_0xca0f('0x20')](function(){logger[_0xca0f('0x10')](_0xca0f('0x21'),_0x266f94);_0x5c63a8[_0xca0f('0x22')]();});}else{logger['info'](_0xca0f('0x23'),_0x266f94);_0x5c63a8['stop']();}}else{var _0x46245b=this;var _0x129d80=apiai(_0x188d7a[0x0],{'language':_0x188d7a[0x1]||'en'});return _0x129d80[_0xca0f('0x24')](this[_0xca0f('0x25')][_0xca0f('0x19')],{'sessionId':md5(this[_0xca0f('0xe')]['id'])})[_0xca0f('0x1d')](function(_0x1b6619){_0x46245b[_0xca0f('0x19')]['dialogflow']=_0x1b6619;_0xca2113[_0xca0f('0x19')]=_0x1b6619[_0xca0f('0x26')][_0xca0f('0x27')]['speech'];return rpc[_0x33185e+_0xca0f('0x1b')][_0xca0f('0x1c')](_0xca2113)[_0xca0f('0x1d')](function(_0x5257f3){logger['info'](_0xca0f('0x11'),_0x266f94,_0xca2113[_0xca0f('0x19')]);if(_0x1b6619[_0xca0f('0x26')][_0xca0f('0x28')]['endConversation']){_0x5c63a8['next']();}else{_0x5c63a8[_0xca0f('0x22')]();}})['catch'](function(_0x1f3e02){logger[_0xca0f('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x266f94,JSON[_0xca0f('0x1f')](_0x1f3e02));_0x5c63a8[_0xca0f('0x13')]();});})[_0xca0f('0x29')](function(_0x3ab93d){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x266f94,_0x3ab93d['message']);_0x5c63a8[_0xca0f('0x13')]();});}}catch(_0x3b31a1){logger[_0xca0f('0x1e')](_0xca0f('0x11'),_0x266f94,JSON[_0xca0f('0x1f')](_0x3b31a1));_0x5c63a8['stop']();}};}; \ 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 3a67536..10fa676 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 _0x06d5=['fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x27067b,_0x2ff538){var _0x27b611=function(_0x19507c){while(--_0x19507c){_0x27067b['push'](_0x27067b['shift']());}};_0x27b611(++_0x2ff538);}(_0x06d5,0x1e3));var _0x506d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x06d5[_0x59ee6f];return _0x4c0979;};'use strict';var schema=require('validate');var _=require(_0x506d('0x0'));var htmlToText=require(_0x506d('0x1'));var utils=require(_0x506d('0x2'));var logger=require(_0x506d('0x3'))(_0x506d('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x506d('0x5')},'priorityTrue':{'type':_0x506d('0x6'),'message':_0x506d('0x7')},'priorityFalse':{'type':'number','message':_0x506d('0x8')}});exports[_0x506d('0x9')]=function(_0x1cf40c,_0x5d0f9e){return function(_0x4ada47){try{var _0x3c966a={'condition':htmlToText[_0x506d('0xa')](utils[_0x506d('0xb')](_0x5d0f9e[0x0],this),{'wordwrap':![]})[_0x506d('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5d0f9e[0x1],'priorityFalse':_0x5d0f9e[0x2]};var _0x1ad6d6=gotoif['validate'](_0x3c966a,{'typecast':!![]});if(_0x1ad6d6[_0x506d('0xd')]){logger[_0x506d('0xe')](_0x506d('0xf'),_0x1cf40c,_[_0x506d('0x10')](_0x1ad6d6,_0x506d('0x11'))['join'](',\x20'));_0x4ada47[_0x506d('0x12')]();}else{try{var _0x3c8194=eval('('+_0x3c966a[_0x506d('0x13')]+')');var _0x145fe4=_0x3c8194?_0x3c966a[_0x506d('0x14')]:_0x3c966a[_0x506d('0x15')];logger[_0x506d('0x16')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1cf40c,_0x3c966a[_0x506d('0x13')],_0x3c8194,_0x145fe4||_0x506d('0x17'));if(_0x145fe4){var _0x5b0fa7=_[_0x506d('0x18')](_0x4ada47['rules'](),{'p':_0x145fe4});if(_0x5b0fa7>=0x0){logger['info'](_0x506d('0x19'),_0x1cf40c,_0x145fe4||_0x506d('0x17'),_0x5b0fa7);_0x4ada47[_0x506d('0x17')](_0x5b0fa7);}else{logger[_0x506d('0x16')](_0x506d('0x1a'),_0x1cf40c,_0x145fe4||_0x506d('0x17'));_0x4ada47[_0x506d('0x12')]();}}else{_0x4ada47[_0x506d('0x17')]();}}catch(_0x4f17ea){logger[_0x506d('0xe')](_0x506d('0x1b'),_0x1cf40c,_0x4f17ea[_0x506d('0x11')]);_0x4ada47['stop']();}}}catch(_0x4a28ae){logger[_0x506d('0xe')](_0x506d('0xf'),_0x1cf40c,JSON[_0x506d('0x1c')](_0x4a28ae));_0x4ada47[_0x506d('0x12')]();}};}; \ No newline at end of file +var _0xf320=['[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error'];(function(_0xa6ce28,_0x1f98da){var _0x40798a=function(_0x378aa7){while(--_0x378aa7){_0xa6ce28['push'](_0xa6ce28['shift']());}};_0x40798a(++_0x1f98da);}(_0xf320,0x11d));var _0x0f32=function(_0x34db17,_0x51dff0){_0x34db17=_0x34db17-0x0;var _0x5ba6b2=_0xf320[_0x34db17];return _0x5ba6b2;};'use strict';var schema=require(_0x0f32('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x0f32('0x1'));var logger=require(_0x0f32('0x2'))(_0x0f32('0x3'));var gotoif=schema({'condition':{'type':_0x0f32('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x0f32('0x5'),'message':_0x0f32('0x6')},'priorityFalse':{'type':'number','message':_0x0f32('0x7')}});exports['consequence']=function(_0x4952f4,_0xdb5d19){return function(_0x17289e){try{var _0x4dd99a={'condition':htmlToText['fromString'](utils[_0x0f32('0x8')](_0xdb5d19[0x0],this),{'wordwrap':![]})[_0x0f32('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xdb5d19[0x1],'priorityFalse':_0xdb5d19[0x2]};var _0x3fed11=gotoif['validate'](_0x4dd99a,{'typecast':!![]});if(_0x3fed11[_0x0f32('0xa')]){logger[_0x0f32('0xb')](_0x0f32('0xc'),_0x4952f4,_[_0x0f32('0xd')](_0x3fed11,_0x0f32('0xe'))[_0x0f32('0xf')](',\x20'));_0x17289e[_0x0f32('0x10')]();}else{try{var _0x5eead8=eval('('+_0x4dd99a[_0x0f32('0x11')]+')');var _0x2eac4f=_0x5eead8?_0x4dd99a[_0x0f32('0x12')]:_0x4dd99a[_0x0f32('0x13')];logger['info'](_0x0f32('0x14'),_0x4952f4,_0x4dd99a['condition'],_0x5eead8,_0x2eac4f||_0x0f32('0x15'));if(_0x2eac4f){var _0x2d961a=_[_0x0f32('0x16')](_0x17289e[_0x0f32('0x17')](),{'p':_0x2eac4f});if(_0x2d961a>=0x0){logger[_0x0f32('0x18')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4952f4,_0x2eac4f||_0x0f32('0x15'),_0x2d961a);_0x17289e['next'](_0x2d961a);}else{logger[_0x0f32('0x18')](_0x0f32('0x19'),_0x4952f4,_0x2eac4f||'next');_0x17289e[_0x0f32('0x10')]();}}else{_0x17289e[_0x0f32('0x15')]();}}catch(_0x516220){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4952f4,_0x516220[_0x0f32('0xe')]);_0x17289e[_0x0f32('0x10')]();}}}catch(_0x326e56){logger['error'](_0x0f32('0xc'),_0x4952f4,JSON[_0x0f32('0x1a')](_0x326e56));_0x17289e[_0x0f32('0x10')]();}};}; \ 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 c904a28..ef7ae04 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 _0x9683=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][GOTOP]\x20%s','map','message','stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing'];(function(_0x27062d,_0x2e90f9){var _0x166d7d=function(_0x33b9d8){while(--_0x33b9d8){_0x27062d['push'](_0x27062d['shift']());}};_0x166d7d(++_0x2e90f9);}(_0x9683,0xe1));var _0x3968=function(_0x53f04f,_0x141d6c){_0x53f04f=_0x53f04f-0x0;var _0x1c0457=_0x9683[_0x53f04f];return _0x1c0457;};'use strict';var schema=require('validate');var _=require(_0x3968('0x0'));var logger=require(_0x3968('0x1'))(_0x3968('0x2'));var gotop=schema({'priority':{'type':_0x3968('0x3'),'required':!![],'message':_0x3968('0x4')}});exports[_0x3968('0x5')]=function(_0x278e7d,_0x438770){return function(_0x3b042d){try{var _0x49455e={'priority':_0x438770[0x0]};var _0x1d0543=gotop[_0x3968('0x6')](_0x49455e,{'typecast':!![]});if(_0x1d0543['length']){logger[_0x3968('0x7')](_0x3968('0x8'),_0x278e7d,_[_0x3968('0x9')](_0x1d0543,_0x3968('0xa'))['join'](',\x20'));_0x3b042d[_0x3968('0xb')]();}else{logger[_0x3968('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x278e7d,_0x49455e['priority']);if(_0x49455e[_0x3968('0xd')]){var _0x17a145=_['findIndex'](_0x3b042d[_0x3968('0xe')](),{'p':_0x49455e[_0x3968('0xd')]});if(_0x17a145>=0x0){logger[_0x3968('0xc')](_0x3968('0xf'),_0x278e7d,_0x49455e[_0x3968('0xd')]||'next',_0x17a145);_0x3b042d[_0x3968('0x10')](_0x17a145);}else{logger[_0x3968('0xc')](_0x3968('0x11'),_0x278e7d,_0x49455e[_0x3968('0xd')]||_0x3968('0x10'));_0x3b042d['stop']();}}else{_0x3b042d[_0x3968('0x10')]();}}}catch(_0x423a6e){logger[_0x3968('0x7')](_0x3968('0x8'),_0x278e7d,JSON[_0x3968('0x12')](_0x423a6e));_0x3b042d[_0x3968('0xb')]();}};}; \ No newline at end of file +var _0x5a80=['routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','lodash','../../../../config/logger'];(function(_0x43d9f0,_0x48f6d5){var _0x114ba9=function(_0x4eeab6){while(--_0x4eeab6){_0x43d9f0['push'](_0x43d9f0['shift']());}};_0x114ba9(++_0x48f6d5);}(_0x5a80,0x12f));var _0x05a8=function(_0x189102,_0x5f4493){_0x189102=_0x189102-0x0;var _0xf6e074=_0x5a80[_0x189102];return _0xf6e074;};'use strict';var schema=require(_0x05a8('0x0'));var _=require(_0x05a8('0x1'));var logger=require(_0x05a8('0x2'))(_0x05a8('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x05a8('0x4')}});exports['consequence']=function(_0x169a47,_0x24f546){return function(_0x14e594){try{var _0x2eb746={'priority':_0x24f546[0x0]};var _0x145fc6=gotop['validate'](_0x2eb746,{'typecast':!![]});if(_0x145fc6[_0x05a8('0x5')]){logger[_0x05a8('0x6')](_0x05a8('0x7'),_0x169a47,_[_0x05a8('0x8')](_0x145fc6,_0x05a8('0x9'))[_0x05a8('0xa')](',\x20'));_0x14e594[_0x05a8('0xb')]();}else{logger[_0x05a8('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x169a47,_0x2eb746[_0x05a8('0xd')]);if(_0x2eb746[_0x05a8('0xd')]){var _0x28e383=_[_0x05a8('0xe')](_0x14e594[_0x05a8('0xf')](),{'p':_0x2eb746[_0x05a8('0xd')]});if(_0x28e383>=0x0){logger[_0x05a8('0xc')](_0x05a8('0x10'),_0x169a47,_0x2eb746[_0x05a8('0xd')]||'next',_0x28e383);_0x14e594[_0x05a8('0x11')](_0x28e383);}else{logger[_0x05a8('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x169a47,_0x2eb746['priority']||_0x05a8('0x11'));_0x14e594[_0x05a8('0xb')]();}}else{_0x14e594[_0x05a8('0x11')]();}}}catch(_0x4f7046){logger[_0x05a8('0x6')](_0x05a8('0x7'),_0x169a47,JSON['stringify'](_0x4f7046));_0x14e594['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 8260b15..4a358dc 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 _0xdaf5=['next','catch','error','lodash','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','ChatWebsiteId','upperFirst','AccountId','account','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body'];(function(_0x2e4a1c,_0x4bf96f){var _0x8c2c74=function(_0x28a35f){while(--_0x28a35f){_0x2e4a1c['push'](_0x2e4a1c['shift']());}};_0x8c2c74(++_0x4bf96f);}(_0xdaf5,0xb2));var _0x5daf=function(_0x22b005,_0x2a6515){_0x22b005=_0x22b005-0x0;var _0x58bd11=_0xdaf5[_0x22b005];return _0x58bd11;};'use strict';var _=require(_0x5daf('0x0'));var utils=require(_0x5daf('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x5daf('0x2')),'openchannelMessage':require(_0x5daf('0x3')),'mailMessage':require(_0x5daf('0x4')),'smsMessage':require(_0x5daf('0x5')),'faxMessage':require(_0x5daf('0x6')),'whatsappMessage':require(_0x5daf('0x7'))};exports[_0x5daf('0x8')]=function(_0x3f2622,_0x5c6dba){return function(_0x2e946e){try{var _0x4186fc={'body':utils[_0x5daf('0x9')](_0x5c6dba[0x0],this),'ContactId':this['contact']['id']};if(this[_0x5daf('0xa')]==='chat'){_0x4186fc[_0x5daf('0xb')]=this['account']['id'];}else{_0x4186fc[_[_0x5daf('0xc')](this[_0x5daf('0xa')])+_0x5daf('0xd')]=this[_0x5daf('0xe')]['id'];}_0x4186fc[_[_0x5daf('0xc')](this['channel'])+'InteractionId']=this[_0x5daf('0xf')]['id'];if(rpc[this[_0x5daf('0xa')]+_0x5daf('0x10')]){return rpc[this[_0x5daf('0xa')]+_0x5daf('0x10')][_0x5daf('0x11')](_0x4186fc)[_0x5daf('0x12')](function(_0x4d2e41){logger[_0x5daf('0x13')](_0x5daf('0x14'),_0x3f2622,_0x4186fc[_0x5daf('0x15')]);_0x2e946e[_0x5daf('0x16')]();})[_0x5daf('0x17')](function(_0x51ab78){logger[_0x5daf('0x18')](_0x5daf('0x14'),_0x3f2622,JSON['stringify'](_0x51ab78));_0x2e946e['stop']();});}}catch(_0x5ad1e5){logger[_0x5daf('0x18')](_0x5daf('0x14'),_0x3f2622,JSON['stringify'](_0x5ad1e5));_0x2e946e['stop']();}};}; \ No newline at end of file +var _0x52b0=['stop','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','channel','AccountId','upperFirst','InteractionId','interaction','Message','create','then','body','catch','error','[%s][MESSAGE]\x20%s','stringify'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x52b0,0x160));var _0x052b=function(_0x53745a,_0x3eb8d6){_0x53745a=_0x53745a-0x0;var _0x34abf2=_0x52b0[_0x53745a];return _0x34abf2;};'use strict';var _=require('lodash');var utils=require(_0x052b('0x0'));var logger=require('../../../../config/logger')(_0x052b('0x1'));var rpc={'chatMessage':require(_0x052b('0x2')),'openchannelMessage':require(_0x052b('0x3')),'mailMessage':require(_0x052b('0x4')),'smsMessage':require(_0x052b('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x052b('0x6'))};exports[_0x052b('0x7')]=function(_0x1fed93,_0x42d01b){return function(_0x1980ef){try{var _0x2132e4={'body':utils[_0x052b('0x8')](_0x42d01b[0x0],this),'ContactId':this[_0x052b('0x9')]['id']};if(this['channel']===_0x052b('0xa')){_0x2132e4[_0x052b('0xb')]=this[_0x052b('0xc')]['id'];}else{_0x2132e4[_['upperFirst'](this[_0x052b('0xd')])+_0x052b('0xe')]=this['account']['id'];}_0x2132e4[_[_0x052b('0xf')](this['channel'])+_0x052b('0x10')]=this[_0x052b('0x11')]['id'];if(rpc[this['channel']+_0x052b('0x12')]){return rpc[this['channel']+'Message'][_0x052b('0x13')](_0x2132e4)[_0x052b('0x14')](function(_0x52c59f){logger['info']('[%s][MESSAGE]\x20%s',_0x1fed93,_0x2132e4[_0x052b('0x15')]);_0x1980ef['next']();})[_0x052b('0x16')](function(_0x21753a){logger[_0x052b('0x17')](_0x052b('0x18'),_0x1fed93,JSON[_0x052b('0x19')](_0x21753a));_0x1980ef[_0x052b('0x1a')]();});}}catch(_0x174713){logger[_0x052b('0x17')]('[%s][MESSAGE]\x20%s',_0x1fed93,JSON[_0x052b('0x19')](_0x174713));_0x1980ef[_0x052b('0x1a')]();}};}; \ 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 e660adb..c335177 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 _0x6075=['./utils','../../../../config/logger','consequence','info','next','error','stringify'];(function(_0x2f79a1,_0x490ba0){var _0x425a33=function(_0x2fd979){while(--_0x2fd979){_0x2f79a1['push'](_0x2f79a1['shift']());}};_0x425a33(++_0x490ba0);}(_0x6075,0x142));var _0x5607=function(_0xced35,_0x3221ff){_0xced35=_0xced35-0x0;var _0x2500e6=_0x6075[_0xced35];return _0x2500e6;};'use strict';var utils=require(_0x5607('0x0'));var logger=require(_0x5607('0x1'))('routing');exports[_0x5607('0x2')]=function(_0x10b0a4,_0x5ab30d){return function(_0x48cde9){try{logger[_0x5607('0x3')]('[%s][NOOP]\x20%s',_0x10b0a4,utils['getMustacheRender'](_0x5ab30d[0x0],this));_0x48cde9[_0x5607('0x4')]();}catch(_0x48abca){logger[_0x5607('0x5')]('[%s][NOOP]\x20%s',_0x10b0a4,JSON[_0x5607('0x6')](_0x48abca));_0x48cde9['stop']();}};}; \ No newline at end of file +var _0xa1fd=['[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','consequence'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0xa1fd,0xad));var _0xda1f=function(_0x83487c,_0x1104d8){_0x83487c=_0x83487c-0x0;var _0x25ce18=_0xa1fd[_0x83487c];return _0x25ce18;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')('routing');exports[_0xda1f('0x0')]=function(_0x591d8e,_0x444c9c){return function(_0x2b52ec){try{logger['info'](_0xda1f('0x1'),_0x591d8e,utils[_0xda1f('0x2')](_0x444c9c[0x0],this));_0x2b52ec[_0xda1f('0x3')]();}catch(_0x4e32ab){logger['error'](_0xda1f('0x1'),_0x591d8e,JSON[_0xda1f('0x4')](_0x4e32ab));_0x2b52ec[_0xda1f('0x5')]();}};}; \ 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 a2d8773..4d934db 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x3e74,0x175));var _0x43e7=function(_0x4c26b0,_0x1d5025){_0x4c26b0=_0x4c26b0-0x0;var _0x35dc17=_0x3e74[_0x4c26b0];return _0x35dc17;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file +var _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x3dcac7,_0x1a47b0){var _0x13fee2=function(_0x25a187){while(--_0x25a187){_0x3dcac7['push'](_0x3dcac7['shift']());}};_0x13fee2(++_0x1a47b0);}(_0x55ca,0x126));var _0xa55c=function(_0x5bc95c,_0xfed759){_0x5bc95c=_0x5bc95c-0x0;var _0x3721fc=_0x55ca[_0x5bc95c];return _0x3721fc;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('0x46')]();}};}; \ 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 24c3665..19850f7 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 _0x4092=['notificationId','agent','realtime','push','handleRun','bind','handleTimeout','squeue','timeout','drained','prototype','isNil','agents','forcedOwnership','isAgentAvailable','busyQueue','showNotification','writeLog',':FORCED','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4092,0x1af));var _0x2409=function(_0x43d0dd,_0x1bd3d2){_0x43d0dd=_0x43d0dd-0x0;var _0x233879=_0x4092[_0x43d0dd];return _0x233879;};'use strict';var _=require('lodash');var uuid=require(_0x2409('0x0'));var util=require(_0x2409('0x1'));var logger=require(_0x2409('0x2'))(_0x2409('0x3'));var Agent=function(_0x3e4609,_0x33f295,_0x312b2f,_0x3e6991){this[_0x2409('0x4')]=uuid['v4']();this['squeue']=_0x3e4609;this[_0x2409('0x5')]=_0x33f295;this[_0x2409('0x6')]=_0x312b2f;this[_0x2409('0x3')]=_0x3e6991;this['squeue'][_0x2409('0x7')](this[_0x2409('0x8')][_0x2409('0x9')](this),this[_0x2409('0xa')][_0x2409('0x9')](this));this[_0x2409('0xb')]['on'](_0x2409('0xc'),this['handleTimeout']['bind'](this));this[_0x2409('0xb')]['on'](_0x2409('0xd'),this['handleDrained']['bind'](this));};Agent[_0x2409('0xe')]['push']=function(){this[_0x2409('0xb')][_0x2409('0x7')](this[_0x2409('0x8')]['bind'](this),this['handleTimeout'][_0x2409('0x9')](this));};Agent[_0x2409('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x2409('0xe')][_0x2409('0x8')]=function(_0x5873d3){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x2409('0xb')]['id'],this[_0x2409('0x5')]['id']);if(_[_0x2409('0xf')](this[_0x2409('0x6')][_0x2409('0x10')][this[_0x2409('0x5')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x2409('0x5')]['id']);setTimeout(this[_0x2409('0x7')][_0x2409('0x9')](this),0x3e8);}else{if(this[_0x2409('0x3')][_0x2409('0x11')]||util[_0x2409('0x12')](this['squeue']['id'],this['realtime'][_0x2409('0x10')][this[_0x2409('0x5')]['id']],this['squeue']['channel'],![])){this[_0x2409('0x6')][_0x2409('0x10')][this['agent']['id']]['busy']=!![];this[_0x2409('0x6')][_0x2409('0x10')][this[_0x2409('0x5')]['id']][_0x2409('0x13')]=undefined;util[_0x2409('0x14')](this[_0x2409('0x4')],this[_0x2409('0xb')]['id'],this['realtime']['agents'][this[_0x2409('0x5')]['id']],null,this['routing']);util[_0x2409('0x15')](this[_0x2409('0xb')]['id'],this['realtime'][_0x2409('0x10')][this[_0x2409('0x5')]['id']],'RINGING'+(this[_0x2409('0x3')][_0x2409('0x11')]?_0x2409('0x16'):''));}else{logger[_0x2409('0x17')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x2409('0xb')]['id'],this[_0x2409('0x5')]['id']);setTimeout(this[_0x2409('0x7')]['bind'](this),0x3e8);}}};Agent[_0x2409('0xe')][_0x2409('0xa')]=function(_0x5b4291){if(_[_0x2409('0xf')](this[_0x2409('0x6')][_0x2409('0x10')][this['agent']['id']])){return logger[_0x2409('0x17')](_0x2409('0x18'),this['squeue']['id'],this[_0x2409('0x5')]['id']);}else{logger[_0x2409('0x17')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x2409('0xb')]['id'],this[_0x2409('0x5')]['id']);util[_0x2409('0x19')](this[_0x2409('0x4')],this['squeue']['id'],this['realtime'][_0x2409('0x10')][this[_0x2409('0x5')]['id']],null,this[_0x2409('0x3')]);this[_0x2409('0x6')][_0x2409('0x10')][this[_0x2409('0x5')]['id']][_0x2409('0x1a')]=![];this['realtime'][_0x2409('0x10')][this[_0x2409('0x5')]['id']][_0x2409('0x13')]=undefined;util[_0x2409('0x15')](this[_0x2409('0xb')]['id'],this['realtime'][_0x2409('0x10')][this[_0x2409('0x5')]['id']],_0x5b4291?'STOP':_0x2409('0x1b'));}if(!_0x5b4291){setTimeout(this[_0x2409('0x7')]['bind'](this),0x3e8);}};function agent(_0x3ef828,_0x46cc87,_0x231849,_0x471ad2){return new Agent(_0x3ef828,_0x46cc87,_0x231849,_0x471ad2);}module[_0x2409('0x1c')]=agent; \ No newline at end of file +var _0x65c7=['busy','showNotification','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','handleTimeout','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x65c7,0x137));var _0x765c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x65c7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var uuid=require(_0x765c('0x0'));var util=require(_0x765c('0x1'));var logger=require(_0x765c('0x2'))(_0x765c('0x3'));var Agent=function(_0x4edee3,_0x1cd45a,_0x4f1b68,_0x46860b){this[_0x765c('0x4')]=uuid['v4']();this[_0x765c('0x5')]=_0x4edee3;this[_0x765c('0x6')]=_0x1cd45a;this[_0x765c('0x7')]=_0x4f1b68;this[_0x765c('0x3')]=_0x46860b;this['squeue'][_0x765c('0x8')](this[_0x765c('0x9')][_0x765c('0xa')](this),this['handleTimeout']['bind'](this));this[_0x765c('0x5')]['on'](_0x765c('0xb'),this[_0x765c('0xc')]['bind'](this));this[_0x765c('0x5')]['on']('drained',this['handleDrained']['bind'](this));};Agent['prototype'][_0x765c('0x8')]=function(){this['squeue'][_0x765c('0x8')](this[_0x765c('0x9')]['bind'](this),this['handleTimeout'][_0x765c('0xa')](this));};Agent[_0x765c('0xd')][_0x765c('0xe')]=function(){this[_0x765c('0xc')](!![]);};Agent['prototype'][_0x765c('0x9')]=function(_0x35ab53){logger[_0x765c('0xf')](_0x765c('0x10'),this[_0x765c('0x5')]['id'],this[_0x765c('0x6')]['id']);if(_['isNil'](this[_0x765c('0x7')][_0x765c('0x11')][this[_0x765c('0x6')]['id']])){logger[_0x765c('0xf')](_0x765c('0x12'),this['squeue']['id'],this[_0x765c('0x6')]['id']);setTimeout(this[_0x765c('0x8')][_0x765c('0xa')](this),0x3e8);}else{if(this[_0x765c('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0x765c('0x5')]['id'],this[_0x765c('0x7')][_0x765c('0x11')][this[_0x765c('0x6')]['id']],this['squeue']['channel'],![])){this[_0x765c('0x7')][_0x765c('0x11')][this[_0x765c('0x6')]['id']][_0x765c('0x13')]=!![];this[_0x765c('0x7')][_0x765c('0x11')][this['agent']['id']]['busyQueue']=undefined;util[_0x765c('0x14')](this[_0x765c('0x4')],this['squeue']['id'],this[_0x765c('0x7')][_0x765c('0x11')][this[_0x765c('0x6')]['id']],null,this[_0x765c('0x3')]);util['writeLog'](this[_0x765c('0x5')]['id'],this[_0x765c('0x7')]['agents'][this['agent']['id']],_0x765c('0x15')+(this[_0x765c('0x3')][_0x765c('0x16')]?_0x765c('0x17'):''));}else{logger[_0x765c('0xf')](_0x765c('0x18'),this[_0x765c('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x765c('0x8')][_0x765c('0xa')](this),0x3e8);}}};Agent[_0x765c('0xd')]['handleTimeout']=function(_0x114df8){if(_[_0x765c('0x19')](this[_0x765c('0x7')]['agents'][this['agent']['id']])){return logger['info'](_0x765c('0x12'),this[_0x765c('0x5')]['id'],this[_0x765c('0x6')]['id']);}else{logger[_0x765c('0xf')](_0x765c('0x1a'),this['squeue']['id'],this[_0x765c('0x6')]['id']);util[_0x765c('0x1b')](this[_0x765c('0x4')],this['squeue']['id'],this[_0x765c('0x7')][_0x765c('0x11')][this[_0x765c('0x6')]['id']],null,this[_0x765c('0x3')]);this[_0x765c('0x7')][_0x765c('0x11')][this['agent']['id']][_0x765c('0x13')]=![];this[_0x765c('0x7')][_0x765c('0x11')][this[_0x765c('0x6')]['id']][_0x765c('0x1c')]=undefined;util[_0x765c('0x1d')](this['squeue']['id'],this['realtime'][_0x765c('0x11')][this[_0x765c('0x6')]['id']],_0x114df8?_0x765c('0x1e'):_0x765c('0x1f'));}if(!_0x114df8){setTimeout(this[_0x765c('0x8')][_0x765c('0xa')](this),0x3e8);}};function agent(_0x5191b9,_0x3ae1b0,_0x4c00ba,_0x15b732){return new Agent(_0x5191b9,_0x3ae1b0,_0x4c00ba,_0x15b732);}module[_0x765c('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 58838dd..839cf2e 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 _0x726a=['length','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','busy','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','queue','realtime','routing','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','writeLog','agents','RINGING','busyQueue','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY'];(function(_0x1273ab,_0x81378d){var _0x123679=function(_0x46189e){while(--_0x46189e){_0x1273ab['push'](_0x1273ab['shift']());}};_0x123679(++_0x81378d);}(_0x726a,0x142));var _0xa726=function(_0x54de79,_0x4b19cc){_0x54de79=_0x54de79-0x0;var _0x26cbbd=_0x726a[_0x54de79];return _0x26cbbd;};'use strict';var _=require(_0xa726('0x0'));var uuid=require(_0xa726('0x1'));var util=require(_0xa726('0x2'));var logger=require(_0xa726('0x3'))('routing');var Beepall=function(_0x7a9723,_0x1f46ea,_0x279ec2,_0x56d29a){this[_0xa726('0x4')]=uuid['v4']();this['squeue']=_0x7a9723;this[_0xa726('0x5')]=_0x1f46ea;this[_0xa726('0x6')]=_0x279ec2;this[_0xa726('0x7')]=_0x56d29a;this[_0xa726('0x8')][_0xa726('0x9')](this[_0xa726('0xa')][_0xa726('0xb')](this),this[_0xa726('0xc')][_0xa726('0xb')](this));this[_0xa726('0x8')]['on'](_0xa726('0xd'),this[_0xa726('0xc')][_0xa726('0xb')](this));this[_0xa726('0x8')]['on'](_0xa726('0xe'),this[_0xa726('0xf')][_0xa726('0xb')](this));};Beepall[_0xa726('0x10')][_0xa726('0x9')]=function(){this[_0xa726('0x8')][_0xa726('0x9')](this[_0xa726('0xa')][_0xa726('0xb')](this),this[_0xa726('0xc')][_0xa726('0xb')](this));};Beepall['prototype'][_0xa726('0xf')]=function(_0x3cab11){this[_0xa726('0xc')](!![]);};Beepall['prototype'][_0xa726('0xa')]=function(_0x54c882){var _0x53b5c5=!![];if(!_[_0xa726('0x11')](this[_0xa726('0x5')])&&!_[_0xa726('0x11')](this[_0xa726('0x5')][_0xa726('0x12')])&&this[_0xa726('0x5')]['Agents']['length']>0x0){for(var _0x525d07=0x0,_0x4ab7ab;_0x525d070x0){for(var _0x43a477=0x0,_0x1dca4d;_0x43a4770x0&&_0x5c9895[_0x5491d5+_0x85eb('0x24')]>=_0x5c9895[_0x5491d5+'Capacity']){writeLog(_0x3fc6da,_0x5c9895,_0x5491d5[_0x85eb('0x25')]()+_0x85eb('0x26'));return![];}}return!![];};exports[_0x85eb('0x27')]=function(_0x3e7eb9,_0x40f13e,_0x29d262,_0x50541a,_0x562792){return sendNotification(!![],_0x3e7eb9,_0x40f13e,_0x29d262,_0x50541a,_0x562792);};exports[_0x85eb('0x28')]=function(_0x585f2a,_0xa9b14f,_0x5255eb,_0x4229e9,_0x3570f7){return sendNotification(![],_0x585f2a,_0xa9b14f,_0x5255eb,_0x4229e9,_0x3570f7);};exports[_0x85eb('0x29')]=writeLog; \ No newline at end of file +var _0xd3a0=['hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','lodash','util','../utils','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','user:%s','name','user:save','split','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','format','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','Pause','PAUSE'];(function(_0x2214e7,_0xea4953){var _0x1cd07b=function(_0x5ebcbf){while(--_0x5ebcbf){_0x2214e7['push'](_0x2214e7['shift']());}};_0x1cd07b(++_0xea4953);}(_0xd3a0,0xaa));var _0x0d3a=function(_0x4adfcc,_0x4ef91a){_0x4adfcc=_0x4adfcc-0x0;var _0x566c4e=_0xd3a0[_0x4adfcc];return _0x566c4e;};'use strict';var _=require(_0x0d3a('0x0'));var util=require(_0x0d3a('0x1'));var utils=require(_0x0d3a('0x2'));var Mustache=require(_0x0d3a('0x3'));var Redis=require('ioredis');var config=require(_0x0d3a('0x4'));var logger=require(_0x0d3a('0x5'))(_0x0d3a('0x6'));config[_0x0d3a('0x7')]=_[_0x0d3a('0x8')](config['redis'],{'host':_0x0d3a('0x9'),'port':0x18eb});var io=require(_0x0d3a('0xa'))(new Redis(config[_0x0d3a('0x7')]));function emit(_0x437b06,_0x46b328,_0x50d6bb){io['to'](_0x437b06)[_0x0d3a('0xb')](_0x46b328,_0x50d6bb);}function sendNotification(_0x262ce7,_0x2b7d16,_0xa10301,_0x66d9b,_0x263571,_0x2c2496){io['to'](util['format'](_0x0d3a('0xc'),_0x66d9b[_0x0d3a('0xd')]))['emit'](_0x0d3a('0xe'),_0x66d9b);var _0x6388e6=_0x2c2496||{};var _0x17246d=_0xa10301[_0x0d3a('0xf')]('.');var _0x58625a={'uniqueid':_0x2b7d16,'channel':_0x17246d[0x0],'id':_0x17246d[0x1],'title':_0x17246d[0x0]+'\x20interaction','interactionId':_0x17246d[0x2],'queue':_0x263571?_0x263571[_0x0d3a('0xd')]:null,'sound':_0x6388e6[_0x0d3a('0x10')][_0x0d3a('0x11')],'shake':_0x6388e6[_0x0d3a('0x10')][_0x0d3a('0x12')]};try{if(!_0x6388e6[_0x0d3a('0x13')]){_0x6388e6[_0x0d3a('0x13')]={};}if(_0x263571){_0x6388e6[_0x0d3a('0x13')][_0x0d3a('0x14')]=_0x263571;}else if(_0x6388e6[_0x0d3a('0x13')][_0x0d3a('0x14')]){delete _0x6388e6['body']['queue'];}_0x58625a[_0x0d3a('0x15')]=utils[_0x0d3a('0x16')](_0x6388e6[_0x0d3a('0x10')][_0x0d3a('0x17')],_0x6388e6);}catch(_0x3b7350){_0x58625a[_0x0d3a('0x15')]=_0x0d3a('0x18');logger[_0x0d3a('0x19')](util['format'](_0x0d3a('0x1a'),_0x2b7d16,_0x3b7350['message']));}io['to'](util[_0x0d3a('0x1b')](_0x0d3a('0xc'),_0x66d9b[_0x0d3a('0xd')]))['emit'](util[_0x0d3a('0x1b')]('notification:%s',_0x262ce7?'save':_0x0d3a('0x1c')),_0x58625a);}function writeLog(_0x4b9ca4,_0x1a913c,_0x34278e){return logger[_0x0d3a('0x1d')](util[_0x0d3a('0x1b')](_0x0d3a('0x1e'),_0x4b9ca4,_0x1a913c[_0x0d3a('0xd')],_0x34278e));}exports[_0x0d3a('0x1f')]=function(_0x37728a,_0x2e82e8,_0x69e26d,_0x4c54f9){if(_0x2e82e8['busy']){writeLog(_0x37728a,_0x2e82e8,_0x0d3a('0x20'));return![];}if(!_0x2e82e8['online']){writeLog(_0x37728a,_0x2e82e8,'OFFLINE');return![];}if(_0x2e82e8[_0x69e26d+_0x0d3a('0x21')]){writeLog(_0x37728a,_0x2e82e8,_0x0d3a('0x22'));return![];}if(_0x4c54f9&&_0x2e82e8[_0x0d3a('0x23')](_0x69e26d+_0x0d3a('0x24'))&&_0x2e82e8[_0x0d3a('0x23')](_0x69e26d+_0x0d3a('0x25'))){if(_0x2e82e8[_0x69e26d+_0x0d3a('0x24')]>0x0&&_0x2e82e8[_0x69e26d+_0x0d3a('0x25')]>=_0x2e82e8[_0x69e26d+_0x0d3a('0x24')]){writeLog(_0x37728a,_0x2e82e8,_0x69e26d['toUpperCase']()+_0x0d3a('0x26'));return![];}}return!![];};exports[_0x0d3a('0x27')]=function(_0x5356bc,_0x1128a2,_0x45e1de,_0x2abf71,_0x19ada3){return sendNotification(!![],_0x5356bc,_0x1128a2,_0x45e1de,_0x2abf71,_0x19ada3);};exports[_0x0d3a('0x28')]=function(_0x4ab37b,_0x3b1875,_0x2d40d8,_0x1d54dc,_0x4910bb){return sendNotification(![],_0x4ab37b,_0x3b1875,_0x2d40d8,_0x1d54dc,_0x4910bb);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 624afff..5f03597 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 _0x1956=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','next','info','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x4d26dc,_0x2777e3){var _0x5d2dd5=function(_0x1ed5c1){while(--_0x1ed5c1){_0x4d26dc['push'](_0x4d26dc['shift']());}};_0x5d2dd5(++_0x2777e3);}(_0x1956,0xec));var _0x6195=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0x1956[_0x207d2f];return _0x3c3498;};'use strict';var schema=require(_0x6195('0x0'));var sh=require(_0x6195('0x1'));var _=require(_0x6195('0x2'));var utils=require(_0x6195('0x3'));var logger=require(_0x6195('0x4'))(_0x6195('0x5'));var system=schema({'command':{'type':_0x6195('0x6'),'required':!![],'message':_0x6195('0x7')}});exports[_0x6195('0x8')]=function(_0x9f8acf,_0x4d301f){return function(_0x3f0371){try{var _0x21dc09={'command':_0x4d301f[0x0]};var _0x7bcd26=system[_0x6195('0x0')](_0x21dc09,{'typecast':!![]});if(_0x7bcd26[_0x6195('0x9')]){logger[_0x6195('0xa')](_0x6195('0xb'),_0x9f8acf,_[_0x6195('0xc')](_0x7bcd26,_0x6195('0xd'))[_0x6195('0xe')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x9f8acf);_0x3f0371[_0x6195('0xf')]();}else{var _0x18ef65=this;var _0x3451fc=utils['getMustacheRender'](_0x4d301f[0x0],this);logger[_0x6195('0x10')](_0x6195('0x11'),_0x9f8acf,_0x3451fc);sh['exec'](_[_0x6195('0x12')](_0x3451fc),function(_0x2e5d85,_0x2a7304){logger[_0x6195('0x10')](_0x6195('0x13'),_0x9f8acf,_0x2e5d85);if(_0x2e5d85==0x0){var _0x162047=_0x2a7304[_0x6195('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x6195('0x15')](_0x4d301f[0x1])||_[_0x6195('0x16')](_0x4d301f[0x1])){logger[_0x6195('0x10')](_0x6195('0x17'),_0x9f8acf);_0x18ef65[_0x6195('0x18')][_0x4d301f[0x1]]=_0x162047;}else{logger[_0x6195('0x10')](_0x6195('0x19'),_0x9f8acf,_0x4d301f[0x1],_0x162047);_0x18ef65['body'][_0x4d301f[0x1]]=_0x162047;}}_0x3f0371[_0x6195('0xf')]();});}}catch(_0x5481ac){logger[_0x6195('0xa')](_0x6195('0xb'),_0x9f8acf,_[_0x6195('0x1a')](_0x5481ac)?JSON[_0x6195('0x1b')](_0x5481ac):_0x5481ac);logger[_0x6195('0x10')](_0x6195('0x1c'),_0x9f8acf);_0x3f0371[_0x6195('0xf')]();}};}; \ No newline at end of file +var _0xacdf=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty'];(function(_0x494c37,_0x59f21c){var _0x5deef7=function(_0x1d34bf){while(--_0x1d34bf){_0x494c37['push'](_0x494c37['shift']());}};_0x5deef7(++_0x59f21c);}(_0xacdf,0xee));var _0xfacd=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xacdf[_0xbf8ebe];return _0x1e25e8;};'use strict';var schema=require(_0xfacd('0x0'));var sh=require(_0xfacd('0x1'));var _=require(_0xfacd('0x2'));var utils=require(_0xfacd('0x3'));var logger=require(_0xfacd('0x4'))(_0xfacd('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0xfacd('0x6')}});exports[_0xfacd('0x7')]=function(_0x29ad4f,_0x19ea16){return function(_0x27cc54){try{var _0x14f970={'command':_0x19ea16[0x0]};var _0x7665f=system[_0xfacd('0x0')](_0x14f970,{'typecast':!![]});if(_0x7665f[_0xfacd('0x8')]){logger[_0xfacd('0x9')](_0xfacd('0xa'),_0x29ad4f,_[_0xfacd('0xb')](_0x7665f,_0xfacd('0xc'))[_0xfacd('0xd')](',\x20'));logger[_0xfacd('0xe')](_0xfacd('0xf'),_0x29ad4f);_0x27cc54['next']();}else{var _0x1d705c=this;var _0x383eb3=utils[_0xfacd('0x10')](_0x19ea16[0x0],this);logger[_0xfacd('0xe')](_0xfacd('0x11'),_0x29ad4f,_0x383eb3);sh[_0xfacd('0x12')](_[_0xfacd('0x13')](_0x383eb3),function(_0x2a9c04,_0x37314c){logger[_0xfacd('0xe')](_0xfacd('0x14'),_0x29ad4f,_0x2a9c04);if(_0x2a9c04==0x0){var _0x3de564=_0x37314c[_0xfacd('0x15')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x19ea16[0x1])||_[_0xfacd('0x16')](_0x19ea16[0x1])){logger[_0xfacd('0xe')](_0xfacd('0x17'),_0x29ad4f);_0x1d705c[_0xfacd('0x18')][_0x19ea16[0x1]]=_0x3de564;}else{logger[_0xfacd('0xe')](_0xfacd('0x19'),_0x29ad4f,_0x19ea16[0x1],_0x3de564);_0x1d705c['body'][_0x19ea16[0x1]]=_0x3de564;}}_0x27cc54[_0xfacd('0x1a')]();});}}catch(_0x304411){logger[_0xfacd('0x9')](_0xfacd('0xa'),_0x29ad4f,_[_0xfacd('0x1b')](_0x304411)?JSON[_0xfacd('0x1c')](_0x304411):_0x304411);logger[_0xfacd('0xe')](_0xfacd('0xf'),_0x29ad4f);_0x27cc54['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 188b081..8a95073 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 _0x0707=['routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x5da604,_0x58e6d7){var _0x5c6d64=function(_0x33f789){while(--_0x33f789){_0x5da604['push'](_0x5da604['shift']());}};_0x5c6d64(++_0x58e6d7);}(_0x0707,0x87));var _0x7070=function(_0x1827f7,_0x70fe6a){_0x1827f7=_0x1827f7-0x0;var _0x11a927=_0x0707[_0x1827f7];return _0x11a927;};'use strict';var schema=require('validate');var _=require(_0x7070('0x0'));var rpc={'chatInteraction':require(_0x7070('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x7070('0x2')),'mailInteraction':require(_0x7070('0x3')),'faxInteraction':require(_0x7070('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x7070('0x5'));var tag=schema({'tag':{'type':_0x7070('0x6'),'required':!![],'message':_0x7070('0x7')}});exports[_0x7070('0x8')]=function(_0x4ec673,_0x120f6c,_0x11522f,_0x58d3ba){return function(_0x36ed5e){try{var _0x40ab2c={'tag':_0x120f6c[0x0]};var _0x3a2f46=tag[_0x7070('0x9')](_0x40ab2c,{'typecast':!![]});if(_0x3a2f46[_0x7070('0xa')]){logger[_0x7070('0xb')]('[%s][TAG]\x20%s',_0x4ec673,_['map'](_0x3a2f46,_0x7070('0xc'))[_0x7070('0xd')](',\x20'));logger[_0x7070('0xe')](_0x7070('0xf'),_0x4ec673);_0x36ed5e[_0x7070('0x10')]();}else{var _0x3aea5={'ids':[_0x120f6c[0x0]]};if(rpc[_0x58d3ba[_0x7070('0x11')]+_0x7070('0x12')]){rpc[_0x58d3ba[_0x7070('0x11')]+_0x7070('0x12')][_0x7070('0x13')](_0x58d3ba[_0x7070('0x14')]['id'],_0x3aea5)[_0x7070('0x15')](function(_0x2f8e8b){logger[_0x7070('0xe')](_0x7070('0x16'),_0x4ec673,_0x120f6c[0x1],_0x58d3ba[_0x7070('0x11')],_0x58d3ba['interaction']['id']);})[_0x7070('0x17')](function(_0x2a4149){logger['error'](_0x7070('0x18'),_0x4ec673,JSON[_0x7070('0x19')](_0x2a4149));logger[_0x7070('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4ec673);})[_0x7070('0x1a')](function(){_0x36ed5e[_0x7070('0x10')]();});}}}catch(_0x41fb32){logger[_0x7070('0xb')](_0x7070('0x18'),_0x4ec673,_[_0x7070('0x1b')](_0x41fb32)?JSON[_0x7070('0x19')](_0x41fb32):_0x41fb32);logger[_0x7070('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4ec673);_0x36ed5e[_0x7070('0x10')]();}};}; \ No newline at end of file +var _0x3662=['[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','[%s][TAG]\x20%s','stringify','finally','next','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','error','map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','info'];(function(_0x35b929,_0x57d9b9){var _0x22ea0b=function(_0x59d459){while(--_0x59d459){_0x35b929['push'](_0x35b929['shift']());}};_0x22ea0b(++_0x57d9b9);}(_0x3662,0xde));var _0x2366=function(_0x35fb94,_0x34811e){_0x35fb94=_0x35fb94-0x0;var _0x3da0ee=_0x3662[_0x35fb94];return _0x3da0ee;};'use strict';var schema=require('validate');var _=require(_0x2366('0x0'));var rpc={'chatInteraction':require(_0x2366('0x1')),'openchannelInteraction':require(_0x2366('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x2366('0x3')),'faxInteraction':require(_0x2366('0x4')),'whatsappInteraction':require(_0x2366('0x5'))};var logger=require(_0x2366('0x6'))(_0x2366('0x7'));var tag=schema({'tag':{'type':_0x2366('0x8'),'required':!![],'message':_0x2366('0x9')}});exports['consequence']=function(_0x2c0438,_0x156a24,_0x4944d9,_0x3b677c){return function(_0xca4306){try{var _0x53e578={'tag':_0x156a24[0x0]};var _0x20b5ed=tag[_0x2366('0xa')](_0x53e578,{'typecast':!![]});if(_0x20b5ed['length']){logger[_0x2366('0xb')]('[%s][TAG]\x20%s',_0x2c0438,_[_0x2366('0xc')](_0x20b5ed,'message')[_0x2366('0xd')](',\x20'));logger['info'](_0x2366('0xe'),_0x2c0438);_0xca4306['next']();}else{var _0x2bdc77={'ids':[_0x156a24[0x0]]};if(rpc[_0x3b677c[_0x2366('0xf')]+_0x2366('0x10')]){rpc[_0x3b677c[_0x2366('0xf')]+_0x2366('0x10')]['addTags'](_0x3b677c['interaction']['id'],_0x2bdc77)['then'](function(_0x3203e9){logger[_0x2366('0x11')](_0x2366('0x12'),_0x2c0438,_0x156a24[0x1],_0x3b677c[_0x2366('0xf')],_0x3b677c[_0x2366('0x13')]['id']);})['catch'](function(_0x24262d){logger[_0x2366('0xb')](_0x2366('0x14'),_0x2c0438,JSON[_0x2366('0x15')](_0x24262d));logger[_0x2366('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2c0438);})[_0x2366('0x16')](function(){_0xca4306[_0x2366('0x17')]();});}}}catch(_0x52f6d3){logger[_0x2366('0xb')](_0x2366('0x14'),_0x2c0438,_['isObject'](_0x52f6d3)?JSON['stringify'](_0x52f6d3):_0x52f6d3);logger['info'](_0x2366('0xe'),_0x2c0438);_0xca4306[_0x2366('0x17')]();}};}; \ 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 dfa4218..130ca79 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 _0xf452=['contact','message','account','interaction','list','mustache','lodash','render','merge','body'];(function(_0x493ced,_0x2f3713){var _0x12a5c7=function(_0x3a59b1){while(--_0x3a59b1){_0x493ced['push'](_0x493ced['shift']());}};_0x12a5c7(++_0x2f3713);}(_0xf452,0x13b));var _0x2f45=function(_0x2da14a,_0x9f8c31){_0x2da14a=_0x2da14a-0x0;var _0x3bfa79=_0xf452[_0x2da14a];return _0x3bfa79;};'use strict';var Mustache=require(_0x2f45('0x0'));var _=require(_0x2f45('0x1'));module['exports']={'getMustacheRender':function(_0x3b13d3,_0x17a6c7){return Mustache[_0x2f45('0x2')](_0x3b13d3,_[_0x2f45('0x3')](_0x17a6c7[_0x2f45('0x4')],{'contact':_0x17a6c7[_0x2f45('0x5')],'message':_0x17a6c7[_0x2f45('0x6')],'account':_0x17a6c7[_0x2f45('0x7')],'interaction':_0x17a6c7[_0x2f45('0x8')],'list':_0x17a6c7[_0x2f45('0x9')]}))||'';}}; \ No newline at end of file +var _0x4746=['mustache','lodash','render','merge','body','contact','message','interaction','list'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4746,0xc6));var _0x6474=function(_0x86662c,_0x57ebb7){_0x86662c=_0x86662c-0x0;var _0x5be00e=_0x4746[_0x86662c];return _0x5be00e;};'use strict';var Mustache=require(_0x6474('0x0'));var _=require(_0x6474('0x1'));module['exports']={'getMustacheRender':function(_0x20751a,_0x59b95a){return Mustache[_0x6474('0x2')](_0x20751a,_[_0x6474('0x3')](_0x59b95a[_0x6474('0x4')],{'contact':_0x59b95a[_0x6474('0x5')],'message':_0x59b95a[_0x6474('0x6')],'account':_0x59b95a['account'],'interaction':_0x59b95a[_0x6474('0x7')],'list':_0x59b95a[_0x6474('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index e6c3049..2f57929 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 _0xf2c0=['message','interaction','applications','isArray','length','existsSync','app','.js','autoreply','appdata','split','push','slice','join','dialogflow','amazonlex','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','emit','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','channel','end','QueueReport','UserId','catch','agent','agents','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules'];(function(_0x41617e,_0x17da0f){var _0x11c7f3=function(_0x4722f2){while(--_0x4722f2){_0x41617e['push'](_0x41617e['shift']());}};_0x11c7f3(++_0x17da0f);}(_0xf2c0,0x15b));var _0x0f2c=function(_0x34098e,_0xaec523){_0x34098e=_0x34098e-0x0;var _0x3dcfdd=_0xf2c0[_0x34098e];return _0x3dcfdd;};'use strict';var _=require(_0x0f2c('0x0'));var util=require(_0x0f2c('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x0f2c('0x2'));var config=require(_0x0f2c('0x3'));var logger=require(_0x0f2c('0x4'))(_0x0f2c('0x5'));var rpc={'openchannelQueueReport':require(_0x0f2c('0x6')),'mailQueueReport':require(_0x0f2c('0x7')),'chatQueueReport':require(_0x0f2c('0x8')),'smsQueueReport':require(_0x0f2c('0x9')),'faxQueueReport':require(_0x0f2c('0xa')),'whatsappQueueReport':require(_0x0f2c('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x519732,_0x23da42,_0x2b21c0){return util[_0x0f2c('0xc')](_0x0f2c('0xd'),_0x519732,_0x23da42||0x0,_0x2b21c0||0x0);}function getIntervals(_0x315084,_0x22d42f){var _0x3970ba=[];if(!_['isNil'](_0x22d42f[_0x0f2c('0xe')])&&!_[_0x0f2c('0xf')](_0x315084[_0x22d42f['IntervalId']])&&!_[_0x0f2c('0xf')](_0x315084[_0x22d42f[_0x0f2c('0xe')]][_0x0f2c('0x10')])){_0x3970ba=_[_0x0f2c('0x11')](_0x315084[_0x22d42f[_0x0f2c('0xe')]][_0x0f2c('0x10')],_0x0f2c('0x12'));}else if(!_[_0x0f2c('0xf')](_0x22d42f[_0x0f2c('0x12')])){_0x3970ba=[_0x22d42f['interval']];}return _0x3970ba;}exports[_0x0f2c('0x13')]=function(_0x2602d1){_0x2602d1[_0x0f2c('0x14')]={};return new BPromise(function(_0x19cc70,_0x547e10){var _0x4ffe9d={'Start':function(_0x14e3d3){var _0x23bda9=this;return new Promise(function(_0xee690e,_0x31cee1){if(_0x14e3d3){try{var _0x3bed1c=[];var _0x32e728=getId(_0x14e3d3['channel'],_0x14e3d3[_0x0f2c('0x15')]?_0x14e3d3[_0x0f2c('0x15')]['id']:0x0,_0x14e3d3[_0x0f2c('0x16')]?_0x14e3d3[_0x0f2c('0x16')]['id']:0x0);if(_0x14e3d3[_0x0f2c('0x17')]&&_[_0x0f2c('0x18')](_0x14e3d3[_0x0f2c('0x17')])&&_0x14e3d3[_0x0f2c('0x17')][_0x0f2c('0x19')]){for(var _0x15cb05=0x0;_0x15cb05<_0x14e3d3[_0x0f2c('0x17')]['length'];_0x15cb05+=0x1){var _0x4d223c=_0x14e3d3['applications'][_0x15cb05];if(fs[_0x0f2c('0x1a')](path['join'](__dirname,_0x0f2c('0x17'),_0x4d223c[_0x0f2c('0x1b')]+_0x0f2c('0x1c')))){var _0x5eddd2=[];switch(_0x4d223c[_0x0f2c('0x1b')]['toLowerCase']()){case _0x0f2c('0x1d'):var _0x4f78c4=_0x4d223c[_0x0f2c('0x1e')][_0x0f2c('0x1f')](',');_0x5eddd2['push'](_0x4f78c4[0x0]);_0x5eddd2[_0x0f2c('0x20')](_0x4f78c4[_0x0f2c('0x21')](0x1,_0x4f78c4['length'])[_0x0f2c('0x22')](','));break;case _0x0f2c('0x23'):var _0x3e38f6=_0x4d223c[_0x0f2c('0x1e')][_0x0f2c('0x1f')](',');_0x5eddd2[_0x0f2c('0x20')](_0x3e38f6[0x0]);_0x5eddd2[_0x0f2c('0x20')](_0x3e38f6[0x1]);_0x5eddd2[_0x0f2c('0x20')](_0x3e38f6['slice'](0x2,_0x3e38f6[_0x0f2c('0x19')])[_0x0f2c('0x22')](','));break;case _0x0f2c('0x24'):var _0x16863d=_0x4d223c[_0x0f2c('0x1e')]['split'](',');_0x5eddd2[_0x0f2c('0x20')](_0x16863d[0x0]);_0x5eddd2[_0x0f2c('0x20')](_0x16863d[0x1]);_0x5eddd2['push'](_0x16863d[0x2]);_0x5eddd2['push'](_0x16863d[0x3]);_0x5eddd2['push'](_0x16863d[_0x0f2c('0x21')](0x4,_0x16863d[_0x0f2c('0x19')])['join'](','));break;case'message':_0x5eddd2['push'](_0x4d223c[_0x0f2c('0x1e')]);break;case'tag':_0x5eddd2['push'](_0x4d223c[_0x0f2c('0x25')]);_0x5eddd2[_0x0f2c('0x20')](_0x4d223c[_0x0f2c('0x1e')]);break;default:_0x5eddd2=_[_0x0f2c('0xf')](_0x4d223c['appdata'])?[]:_0x4d223c[_0x0f2c('0x1e')]['split'](',');}var _0xccdbaa={'id':util[_0x0f2c('0xc')](_0x0f2c('0x26'),_0x32e728,_0x4d223c['id'],_0x4d223c[_0x0f2c('0x1b')]),'condition':require(_0x0f2c('0x27'))[_0x0f2c('0x28')](_0x32e728,getIntervals(_0x2602d1[_0x0f2c('0x29')],_0x4d223c),_0x2602d1),'consequence':require(_0x0f2c('0x2a')+_0x4d223c[_0x0f2c('0x1b')])[_0x0f2c('0x2b')](_0x32e728,_0x5eddd2,_0x2602d1,_0x14e3d3),'p':_0x4d223c[_0x0f2c('0x2c')]||0x0};logger['info'](_0x0f2c('0x2d'),_0xccdbaa['id'],_0x0f2c('0x2e'),getIntervals(_0x2602d1['intervals'],_0x4d223c)[_0x0f2c('0x22')](_0x0f2c('0x2f')));_0x3bed1c[_0x0f2c('0x20')](_0xccdbaa);}else{logger['error'](_0x0f2c('0x30'),path['join'](__dirname,_0x0f2c('0x17'),_0x4d223c[_0x0f2c('0x1b')]+_0x0f2c('0x1c')));}}_0x2602d1['rules'][_0x32e728]=new RuleEngine(_0x3bed1c);_0x2602d1['rules'][_0x32e728][_0x0f2c('0x31')](_0x14e3d3,function(_0x5edb7a){logger[_0x0f2c('0x32')]('Applications\x20executed',JSON[_0x0f2c('0x33')](_0x5edb7a[_0x0f2c('0x34')]));if(_0x2602d1[_0x0f2c('0x14')][_0x32e728]){_0x2602d1[_0x0f2c('0x14')][_0x32e728][_0x0f2c('0x35')]('complete');}});return _0xee690e({'code':0xc8,'message':_0x14e3d3});}else{logger['info'](_0x0f2c('0x36'));return _0xee690e({'code':0xc8,'message':_0x14e3d3});}}catch(_0x4d626e){logger[_0x0f2c('0x37')](_0x4d626e[_0x0f2c('0x38')]);return _0x31cee1(_0x23bda9[_0x0f2c('0x37')](0x1f4,_0x4d626e));}}return _0x31cee1(_0x0f2c('0x39'));});},'AcceptMessage':function(_0x39f6f2){var _0x46795e=this;return new Promise(function(_0x14b968,_0xfc3b5b){if(_0x39f6f2[_0x0f2c('0x15')]&&_0x39f6f2[_0x0f2c('0x15')]['id']){try{var _0x3869f7=getId(_0x39f6f2[_0x0f2c('0x3a')],_0x39f6f2[_0x0f2c('0x15')]?_0x39f6f2[_0x0f2c('0x15')]['id']:0x0,_0x39f6f2[_0x0f2c('0x16')]?_0x39f6f2[_0x0f2c('0x16')]['id']:0x0);if(_0x2602d1[_0x0f2c('0x14')][_0x3869f7]){_0x2602d1['rules'][_0x3869f7][_0x0f2c('0x35')](_0x0f2c('0x3b'));if(rpc[_0x39f6f2[_0x0f2c('0x3a')]+_0x0f2c('0x3c')]){rpc[_0x39f6f2['channel']+_0x0f2c('0x3c')]['update'](_0x3869f7,{'UserId':_0x39f6f2[_0x0f2c('0x15')][_0x0f2c('0x3d')]})[_0x0f2c('0x3e')](function(_0x294cf5){logger[_0x0f2c('0x37')]('error\x20update\x20queue\x20report');});}}return _0x14b968({'code':0xc8,'message':_0x39f6f2});}catch(_0x953cf6){logger[_0x0f2c('0x37')](_0x953cf6[_0x0f2c('0x38')]);return _0xfc3b5b(_0x46795e[_0x0f2c('0x37')](0x1f4,_0x953cf6));}}logger[_0x0f2c('0x37')]('message\x20is\x20empty');return _0xfc3b5b(_0x46795e[_0x0f2c('0x37')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x498617){var _0x1db102=this;return new Promise(function(_0x1e8fca,_0x517953){if(_0x498617[_0x0f2c('0x3f')]&&_0x498617[_0x0f2c('0x3f')]['id']){try{if(_0x2602d1[_0x0f2c('0x40')][_0x498617[_0x0f2c('0x3f')]['id']]){_0x2602d1[_0x0f2c('0x40')][_0x498617[_0x0f2c('0x3f')]['id']]['busy']=![];_0x2602d1[_0x0f2c('0x40')][_0x498617[_0x0f2c('0x3f')]['id']]['busyQueue']=undefined;}return _0x1e8fca({'code':0xc8,'message':_0x498617});}catch(_0x4b2dc9){logger['error'](_0x4b2dc9[_0x0f2c('0x38')]);return _0x517953(_0x1db102[_0x0f2c('0x37')](0x1f4,_0x4b2dc9));}}logger[_0x0f2c('0x37')](_0x0f2c('0x41'));return _0x517953(_0x1db102[_0x0f2c('0x37')](0x1f4,_0x0f2c('0x41')));});},'AbandonInteraction':function(_0x30ba9a){var _0x3c0169=this;return new Promise(function(_0x506301,_0x1470a1){if(_0x30ba9a[_0x0f2c('0x3a')]&&_0x30ba9a[_0x0f2c('0x16')]&&_0x30ba9a[_0x0f2c('0x16')]['id']){try{var _0x46ea6d=getId(_0x30ba9a[_0x0f2c('0x3a')],_0x30ba9a['message']?_0x30ba9a['message']['id']:0x0,_0x30ba9a[_0x0f2c('0x16')]?_0x30ba9a['interaction']['id']:0x0);if(_0x2602d1[_0x0f2c('0x14')][_0x46ea6d]){_0x2602d1[_0x0f2c('0x14')][_0x46ea6d][_0x0f2c('0x35')](_0x0f2c('0x3b'));}return _0x506301({'code':0xc8,'message':_0x30ba9a});}catch(_0x39c081){logger[_0x0f2c('0x37')](_0x39c081[_0x0f2c('0x38')]);return _0x1470a1(_0x3c0169['error'](0x1f4,_0x39c081));}}logger[_0x0f2c('0x37')]('message\x20is\x20empty');return _0x1470a1(_0x3c0169['error'](0x1f4,_0x0f2c('0x41')));});},'AgentCapacity':function(_0x14b5d1){var _0x21e7a7=this;return new Promise(function(_0x1abf6c,_0x22a40f){if(_0x2602d1[_0x0f2c('0x40')][_0x0f2c('0x42')](_0x14b5d1['id'])){for(var _0x1f7202 in _0x14b5d1[_0x0f2c('0x43')]){if(_0x14b5d1[_0x0f2c('0x43')][_0x0f2c('0x42')](_0x1f7202)){if(_0x2602d1[_0x0f2c('0x40')][_0x14b5d1['id']][_0x0f2c('0x42')](_0x1f7202+_0x0f2c('0x44'))){_0x2602d1[_0x0f2c('0x40')][_0x14b5d1['id']][_0x1f7202+_0x0f2c('0x44')]=parseInt(_0x14b5d1['capacity'][_0x1f7202],0xa);}}}_0x2602d1[_0x0f2c('0x40')][_0x14b5d1['id']][_0x0f2c('0x45')]();return _0x1abf6c({'code':0xc8,'message':_0x2602d1[_0x0f2c('0x40')][_0x14b5d1['id']]});}else{return _0x22a40f(_0x21e7a7[_0x0f2c('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2d5e75){return new Promise(function(_0x2cf958,_0x6e12eb){var _0x54fd40=_[_0x0f2c('0x46')](_0x2602d1['agents']);_0x2cf958({'count':_0x54fd40[_0x0f2c('0x19')],'rows':_0x54fd40});});},'ChatQueues':function(_0x1878e8){return new Promise(function(_0x53b11c,_0x289c5a){var _0x5fee83=[];for(var _0x99f83d in _0x2602d1[_0x0f2c('0x47')]){if(_0x2602d1[_0x0f2c('0x47')][_0x0f2c('0x42')](_0x99f83d)){var _0x5a5d53=_0x2602d1[_0x0f2c('0x47')][_0x99f83d];var _0xef127c={'id':_0x5a5d53['id'],'available':_0x5a5d53[_0x0f2c('0x48')],'loggedIn':_0x5a5d53[_0x0f2c('0x49')],'name':_0x5a5d53[_0x0f2c('0x4a')],'paused':_0x5a5d53[_0x0f2c('0x4b')],'waiting':_0x5a5d53[_0x0f2c('0x4c')]};_0x5fee83[_0x0f2c('0x20')](_0xef127c);}}_0x53b11c({'count':_0x5fee83[_0x0f2c('0x19')],'rows':_0x5fee83});});},'MailQueues':function(_0x5ee606){return new Promise(function(_0x54449c,_0xc66a40){var _0x2e6f8c=[];for(var _0x5e09d0 in _0x2602d1[_0x0f2c('0x4d')]){if(_0x2602d1['mailQueues'][_0x0f2c('0x42')](_0x5e09d0)){var _0x46a841=_0x2602d1[_0x0f2c('0x4d')][_0x5e09d0];var _0x4b3a28={'id':_0x46a841['id'],'available':_0x46a841[_0x0f2c('0x48')],'loggedIn':_0x46a841[_0x0f2c('0x49')],'name':_0x46a841[_0x0f2c('0x4a')],'paused':_0x46a841[_0x0f2c('0x4b')],'waiting':_0x46a841[_0x0f2c('0x4c')]};_0x2e6f8c[_0x0f2c('0x20')](_0x4b3a28);}}_0x54449c({'count':_0x2e6f8c[_0x0f2c('0x19')],'rows':_0x2e6f8c});});},'OpenchannelQueues':function(_0xf4a204){return new Promise(function(_0x31a7ab,_0x50b06b){var _0xa1a6d2=[];for(var _0x3cd4be in _0x2602d1[_0x0f2c('0x4e')]){if(_0x2602d1[_0x0f2c('0x4e')][_0x0f2c('0x42')](_0x3cd4be)){var _0x8c5d91=_0x2602d1[_0x0f2c('0x4e')][_0x3cd4be];var _0x55ec2d={'id':_0x8c5d91['id'],'available':_0x8c5d91['available'],'loggedIn':_0x8c5d91[_0x0f2c('0x49')],'name':_0x8c5d91['name'],'paused':_0x8c5d91[_0x0f2c('0x4b')],'waiting':_0x8c5d91[_0x0f2c('0x4c')]};_0xa1a6d2[_0x0f2c('0x20')](_0x55ec2d);}}_0x31a7ab({'count':_0xa1a6d2[_0x0f2c('0x19')],'rows':_0xa1a6d2});});},'SmsQueues':function(_0x32ba87){return new Promise(function(_0xc096cd,_0x3a7ba5){var _0x544aeb=[];for(var _0x160c73 in _0x2602d1[_0x0f2c('0x4f')]){if(_0x2602d1['smsQueues'][_0x0f2c('0x42')](_0x160c73)){var _0x431c59=_0x2602d1[_0x0f2c('0x4f')][_0x160c73];var _0xf41e38={'id':_0x431c59['id'],'available':_0x431c59[_0x0f2c('0x48')],'loggedIn':_0x431c59['loggedIn'],'name':_0x431c59[_0x0f2c('0x4a')],'paused':_0x431c59['paused'],'waiting':_0x431c59[_0x0f2c('0x4c')]};_0x544aeb[_0x0f2c('0x20')](_0xf41e38);}}_0xc096cd({'count':_0x544aeb[_0x0f2c('0x19')],'rows':_0x544aeb});});},'FaxQueues':function(_0x1b85b4){return new Promise(function(_0x40f86d,_0x269782){var _0x231fb=[];for(var _0x2c5d16 in _0x2602d1['faxQueues']){if(_0x2602d1[_0x0f2c('0x50')]['hasOwnProperty'](_0x2c5d16)){var _0x25e5a9=_0x2602d1[_0x0f2c('0x50')][_0x2c5d16];var _0x3a42eb={'id':_0x25e5a9['id'],'available':_0x25e5a9[_0x0f2c('0x48')],'loggedIn':_0x25e5a9['loggedIn'],'name':_0x25e5a9['name'],'paused':_0x25e5a9[_0x0f2c('0x4b')],'waiting':_0x25e5a9[_0x0f2c('0x4c')]};_0x231fb[_0x0f2c('0x20')](_0x3a42eb);}}_0x40f86d({'count':_0x231fb[_0x0f2c('0x19')],'rows':_0x231fb});});},'WhatsappQueues':function(_0x435106){return new Promise(function(_0x5a6d7f,_0xd34ad){var _0x17f954=[];for(var _0x1fa3d1 in _0x2602d1['whatsappQueues']){if(_0x2602d1[_0x0f2c('0x51')][_0x0f2c('0x42')](_0x1fa3d1)){var _0x23cbc5=_0x2602d1[_0x0f2c('0x51')][_0x1fa3d1];var _0x2f54f1={'id':_0x23cbc5['id'],'available':_0x23cbc5['available'],'loggedIn':_0x23cbc5['loggedIn'],'name':_0x23cbc5[_0x0f2c('0x4a')],'paused':_0x23cbc5[_0x0f2c('0x4b')],'waiting':_0x23cbc5[_0x0f2c('0x4c')]};_0x17f954[_0x0f2c('0x20')](_0x2f54f1);}}_0x5a6d7f({'count':_0x17f954[_0x0f2c('0x19')],'rows':_0x17f954});});},'ChatQueuesWaitingInteractions':function(_0x51b5c6){return new Promise(function(_0x297a60,_0x4be65f){var _0x4a4d91=_[_0x0f2c('0x46')](_0x2602d1[_0x0f2c('0x52')]);_0x297a60({'count':_0x4a4d91[_0x0f2c('0x19')],'rows':_0x4a4d91});});},'MailQueuesWaitingInteractions':function(_0x53346c){return new Promise(function(_0xd7e11,_0x106588){var _0x563f87=_[_0x0f2c('0x46')](_0x2602d1[_0x0f2c('0x53')]);_0xd7e11({'count':_0x563f87['length'],'rows':_0x563f87});});},'OpenchannelQueuesWaitingInteractions':function(_0x1c98e9){return new Promise(function(_0x45ea21,_0x27f26a){var _0x279055=_[_0x0f2c('0x46')](_0x2602d1['openchannelQueuesWaitingInteractions']);_0x45ea21({'count':_0x279055[_0x0f2c('0x19')],'rows':_0x279055});});},'SmsQueuesWaitingInteractions':function(_0x164392){return new Promise(function(_0x1d5e40,_0x51ccd0){var _0x1cef8b=_[_0x0f2c('0x46')](_0x2602d1[_0x0f2c('0x54')]);_0x1d5e40({'count':_0x1cef8b[_0x0f2c('0x19')],'rows':_0x1cef8b});});},'FaxQueuesWaitingInteractions':function(_0x4e5a88){return new Promise(function(_0x5a951f,_0x18818e){var _0x26f05d=_['values'](_0x2602d1[_0x0f2c('0x55')]);_0x5a951f({'count':_0x26f05d[_0x0f2c('0x19')],'rows':_0x26f05d});});},'WhatsappQueuesWaitingInteractions':function(_0x5dc1ef){return new Promise(function(_0x2b297e,_0x128dad){var _0x2721cb=_['values'](_0x2602d1[_0x0f2c('0x56')]);_0x2b297e({'count':_0x2721cb[_0x0f2c('0x19')],'rows':_0x2721cb});});}};var _0x4e9163=jayson[_0x0f2c('0x57')](_0x4ffe9d)[_0x0f2c('0x58')]();_0x4e9163['on'](_0x0f2c('0x37'),function(_0x31a89c){logger['error'](JSON[_0x0f2c('0x33')](_0x31a89c));return _0x547e10(_0x31a89c);});_0x4e9163[_0x0f2c('0x13')](0x232c,_0x0f2c('0x59'),function(){console[_0x0f2c('0x5a')](_0x0f2c('0x5b'),0x232c);return _0x19cc70('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xb2e5=['%s:%s:%s','condition','intervals','./applications/','consequence','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','stack','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','path','jayson/promise','bluebird','uuid','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','channel','message','interaction','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','push','dialogflow','split','slice'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb2e5,0x1d6));var _0x5b2e=function(_0x5e92c2,_0x184382){_0x5e92c2=_0x5e92c2-0x0;var _0xbc40b6=_0xb2e5[_0x5e92c2];return _0xbc40b6;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x5b2e('0x0'));var fs=require('fs');var jayson=require(_0x5b2e('0x1'));var BPromise=require(_0x5b2e('0x2'));var uuid=require(_0x5b2e('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x5b2e('0x4'));var rpc={'openchannelQueueReport':require(_0x5b2e('0x5')),'mailQueueReport':require(_0x5b2e('0x6')),'chatQueueReport':require(_0x5b2e('0x7')),'smsQueueReport':require(_0x5b2e('0x8')),'faxQueueReport':require(_0x5b2e('0x9')),'whatsappQueueReport':require(_0x5b2e('0xa'))};var RuleEngine=require(_0x5b2e('0xb'));function getId(_0x5a0903,_0x478436,_0x3346ff){return util['format'](_0x5b2e('0xc'),_0x5a0903,_0x478436||0x0,_0x3346ff||0x0);}function getIntervals(_0x5b6b6d,_0x2de981){var _0x15ea97=[];if(!_[_0x5b2e('0xd')](_0x2de981[_0x5b2e('0xe')])&&!_[_0x5b2e('0xd')](_0x5b6b6d[_0x2de981[_0x5b2e('0xe')]])&&!_[_0x5b2e('0xd')](_0x5b6b6d[_0x2de981['IntervalId']]['Intervals'])){_0x15ea97=_[_0x5b2e('0xf')](_0x5b6b6d[_0x2de981[_0x5b2e('0xe')]][_0x5b2e('0x10')],_0x5b2e('0x11'));}else if(!_[_0x5b2e('0xd')](_0x2de981[_0x5b2e('0x11')])){_0x15ea97=[_0x2de981['interval']];}return _0x15ea97;}exports[_0x5b2e('0x12')]=function(_0x5c16f5){_0x5c16f5['rules']={};return new BPromise(function(_0x4e3972,_0x681d18){var _0x43f741={'Start':function(_0x3746c2){var _0x54e9bd=this;return new Promise(function(_0x546c0e,_0x298932){if(_0x3746c2){try{var _0x4bffe9=[];var _0x1d187f=getId(_0x3746c2[_0x5b2e('0x13')],_0x3746c2['message']?_0x3746c2[_0x5b2e('0x14')]['id']:0x0,_0x3746c2['interaction']?_0x3746c2[_0x5b2e('0x15')]['id']:0x0);if(_0x3746c2['applications']&&_['isArray'](_0x3746c2[_0x5b2e('0x16')])&&_0x3746c2[_0x5b2e('0x16')][_0x5b2e('0x17')]){for(var _0xdcb561=0x0;_0xdcb561<_0x3746c2[_0x5b2e('0x16')][_0x5b2e('0x17')];_0xdcb561+=0x1){var _0x4aa197=_0x3746c2[_0x5b2e('0x16')][_0xdcb561];if(fs[_0x5b2e('0x18')](path[_0x5b2e('0x19')](__dirname,_0x5b2e('0x16'),_0x4aa197[_0x5b2e('0x1a')]+'.js'))){var _0x35ad73=[];switch(_0x4aa197[_0x5b2e('0x1a')][_0x5b2e('0x1b')]()){case _0x5b2e('0x1c'):var _0x3d118a=_0x4aa197[_0x5b2e('0x1d')]['split'](',');_0x35ad73[_0x5b2e('0x1e')](_0x3d118a[0x0]);_0x35ad73[_0x5b2e('0x1e')](_0x3d118a['slice'](0x1,_0x3d118a[_0x5b2e('0x17')])[_0x5b2e('0x19')](','));break;case _0x5b2e('0x1f'):var _0x19fc22=_0x4aa197[_0x5b2e('0x1d')][_0x5b2e('0x20')](',');_0x35ad73[_0x5b2e('0x1e')](_0x19fc22[0x0]);_0x35ad73[_0x5b2e('0x1e')](_0x19fc22[0x1]);_0x35ad73[_0x5b2e('0x1e')](_0x19fc22['slice'](0x2,_0x19fc22[_0x5b2e('0x17')])[_0x5b2e('0x19')](','));break;case'amazonlex':var _0x52393e=_0x4aa197[_0x5b2e('0x1d')][_0x5b2e('0x20')](',');_0x35ad73[_0x5b2e('0x1e')](_0x52393e[0x0]);_0x35ad73[_0x5b2e('0x1e')](_0x52393e[0x1]);_0x35ad73[_0x5b2e('0x1e')](_0x52393e[0x2]);_0x35ad73[_0x5b2e('0x1e')](_0x52393e[0x3]);_0x35ad73[_0x5b2e('0x1e')](_0x52393e[_0x5b2e('0x21')](0x4,_0x52393e[_0x5b2e('0x17')])[_0x5b2e('0x19')](','));break;case _0x5b2e('0x14'):_0x35ad73[_0x5b2e('0x1e')](_0x4aa197[_0x5b2e('0x1d')]);break;case'tag':_0x35ad73['push'](_0x4aa197['TagId']);_0x35ad73[_0x5b2e('0x1e')](_0x4aa197[_0x5b2e('0x1d')]);break;default:_0x35ad73=_[_0x5b2e('0xd')](_0x4aa197[_0x5b2e('0x1d')])?[]:_0x4aa197[_0x5b2e('0x1d')]['split'](',');}var _0x18ec09={'id':util['format'](_0x5b2e('0x22'),_0x1d187f,_0x4aa197['id'],_0x4aa197[_0x5b2e('0x1a')]),'condition':require('./interval')[_0x5b2e('0x23')](_0x1d187f,getIntervals(_0x5c16f5[_0x5b2e('0x24')],_0x4aa197),_0x5c16f5),'consequence':require(_0x5b2e('0x25')+_0x4aa197['app'])[_0x5b2e('0x26')](_0x1d187f,_0x35ad73,_0x5c16f5,_0x3746c2),'p':_0x4aa197['priority']||0x0};logger['info'](_0x5b2e('0x27'),_0x18ec09['id'],_0x5b2e('0x28'),getIntervals(_0x5c16f5[_0x5b2e('0x24')],_0x4aa197)[_0x5b2e('0x19')]('\x20|\x20'));_0x4bffe9['push'](_0x18ec09);}else{logger[_0x5b2e('0x29')](_0x5b2e('0x2a'),path[_0x5b2e('0x19')](__dirname,_0x5b2e('0x16'),_0x4aa197[_0x5b2e('0x1a')]+'.js'));}}_0x5c16f5['rules'][_0x1d187f]=new RuleEngine(_0x4bffe9);_0x5c16f5[_0x5b2e('0x2b')][_0x1d187f][_0x5b2e('0x2c')](_0x3746c2,function(_0x1f2cd7){logger[_0x5b2e('0x2d')](_0x5b2e('0x2e'),JSON[_0x5b2e('0x2f')](_0x1f2cd7[_0x5b2e('0x30')]));if(_0x5c16f5['rules'][_0x1d187f]){_0x5c16f5[_0x5b2e('0x2b')][_0x1d187f][_0x5b2e('0x31')](_0x5b2e('0x32'));}});return _0x546c0e({'code':0xc8,'message':_0x3746c2});}else{logger[_0x5b2e('0x2d')]('No\x20applications\x20to\x20execute');return _0x546c0e({'code':0xc8,'message':_0x3746c2});}}catch(_0x4a97f7){logger[_0x5b2e('0x29')](_0x4a97f7[_0x5b2e('0x33')]);return _0x298932(_0x54e9bd[_0x5b2e('0x29')](0x1f4,_0x4a97f7));}}return _0x298932('routing\x20is\x20empty');});},'AcceptMessage':function(_0x132d39){var _0x4b2907=this;return new Promise(function(_0xf92062,_0x740436){if(_0x132d39[_0x5b2e('0x14')]&&_0x132d39[_0x5b2e('0x14')]['id']){try{var _0x11d1b8=getId(_0x132d39[_0x5b2e('0x13')],_0x132d39['message']?_0x132d39[_0x5b2e('0x14')]['id']:0x0,_0x132d39['interaction']?_0x132d39[_0x5b2e('0x15')]['id']:0x0);if(_0x5c16f5[_0x5b2e('0x2b')][_0x11d1b8]){_0x5c16f5[_0x5b2e('0x2b')][_0x11d1b8][_0x5b2e('0x31')]('end');if(rpc[_0x132d39[_0x5b2e('0x13')]+_0x5b2e('0x34')]){rpc[_0x132d39['channel']+_0x5b2e('0x34')]['update'](_0x11d1b8,{'UserId':_0x132d39['message'][_0x5b2e('0x35')]})['catch'](function(_0x1c88cc){logger[_0x5b2e('0x29')](_0x5b2e('0x36'));});}}return _0xf92062({'code':0xc8,'message':_0x132d39});}catch(_0x2f84b0){logger['error'](_0x2f84b0[_0x5b2e('0x33')]);return _0x740436(_0x4b2907[_0x5b2e('0x29')](0x1f4,_0x2f84b0));}}logger['error'](_0x5b2e('0x37'));return _0x740436(_0x4b2907[_0x5b2e('0x29')](0x1f4,_0x5b2e('0x37')));});},'RejectMessage':function(_0x2069c5){var _0x3ed9a2=this;return new Promise(function(_0x53fdb9,_0x979994){if(_0x2069c5[_0x5b2e('0x38')]&&_0x2069c5['agent']['id']){try{if(_0x5c16f5['agents'][_0x2069c5[_0x5b2e('0x38')]['id']]){_0x5c16f5[_0x5b2e('0x39')][_0x2069c5[_0x5b2e('0x38')]['id']]['busy']=![];_0x5c16f5[_0x5b2e('0x39')][_0x2069c5[_0x5b2e('0x38')]['id']]['busyQueue']=undefined;}return _0x53fdb9({'code':0xc8,'message':_0x2069c5});}catch(_0x2fa95e){logger[_0x5b2e('0x29')](_0x2fa95e[_0x5b2e('0x33')]);return _0x979994(_0x3ed9a2[_0x5b2e('0x29')](0x1f4,_0x2fa95e));}}logger[_0x5b2e('0x29')](_0x5b2e('0x37'));return _0x979994(_0x3ed9a2[_0x5b2e('0x29')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x46707f){var _0x3a4527=this;return new Promise(function(_0x1863ef,_0xaea4ba){if(_0x46707f[_0x5b2e('0x13')]&&_0x46707f[_0x5b2e('0x15')]&&_0x46707f[_0x5b2e('0x15')]['id']){try{var _0x1897b3=getId(_0x46707f[_0x5b2e('0x13')],_0x46707f['message']?_0x46707f[_0x5b2e('0x14')]['id']:0x0,_0x46707f['interaction']?_0x46707f[_0x5b2e('0x15')]['id']:0x0);if(_0x5c16f5[_0x5b2e('0x2b')][_0x1897b3]){_0x5c16f5[_0x5b2e('0x2b')][_0x1897b3][_0x5b2e('0x31')](_0x5b2e('0x3a'));}return _0x1863ef({'code':0xc8,'message':_0x46707f});}catch(_0x566fce){logger[_0x5b2e('0x29')](_0x566fce[_0x5b2e('0x33')]);return _0xaea4ba(_0x3a4527[_0x5b2e('0x29')](0x1f4,_0x566fce));}}logger['error'](_0x5b2e('0x37'));return _0xaea4ba(_0x3a4527[_0x5b2e('0x29')](0x1f4,_0x5b2e('0x37')));});},'AgentCapacity':function(_0x295477){var _0x4ee8f8=this;return new Promise(function(_0x2fbeaf,_0x33f373){if(_0x5c16f5['agents']['hasOwnProperty'](_0x295477['id'])){for(var _0x983fb4 in _0x295477['capacity']){if(_0x295477[_0x5b2e('0x3b')][_0x5b2e('0x3c')](_0x983fb4)){if(_0x5c16f5[_0x5b2e('0x39')][_0x295477['id']][_0x5b2e('0x3c')](_0x983fb4+_0x5b2e('0x3d'))){_0x5c16f5[_0x5b2e('0x39')][_0x295477['id']][_0x983fb4+_0x5b2e('0x3d')]=parseInt(_0x295477[_0x5b2e('0x3b')][_0x983fb4],0xa);}}}_0x5c16f5['agents'][_0x295477['id']][_0x5b2e('0x3e')]();return _0x2fbeaf({'code':0xc8,'message':_0x5c16f5[_0x5b2e('0x39')][_0x295477['id']]});}else{return _0x33f373(_0x4ee8f8['error'](0x1f4,_0x5b2e('0x3f')));}});},'Agents':function(_0x355626){return new Promise(function(_0x5df645,_0x4abc87){var _0x39a797=_['values'](_0x5c16f5[_0x5b2e('0x39')]);_0x5df645({'count':_0x39a797[_0x5b2e('0x17')],'rows':_0x39a797});});},'ChatQueues':function(_0x13f15b){return new Promise(function(_0x126ce2,_0x18268c){var _0x3111c3=[];for(var _0x23a66e in _0x5c16f5[_0x5b2e('0x40')]){if(_0x5c16f5[_0x5b2e('0x40')][_0x5b2e('0x3c')](_0x23a66e)){var _0xcb3f6f=_0x5c16f5[_0x5b2e('0x40')][_0x23a66e];var _0x85407={'id':_0xcb3f6f['id'],'available':_0xcb3f6f[_0x5b2e('0x41')],'loggedIn':_0xcb3f6f[_0x5b2e('0x42')],'name':_0xcb3f6f[_0x5b2e('0x43')],'paused':_0xcb3f6f[_0x5b2e('0x44')],'waiting':_0xcb3f6f[_0x5b2e('0x45')]};_0x3111c3[_0x5b2e('0x1e')](_0x85407);}}_0x126ce2({'count':_0x3111c3['length'],'rows':_0x3111c3});});},'MailQueues':function(_0x25d83a){return new Promise(function(_0x76d8f5,_0x456cd4){var _0x1979ba=[];for(var _0x5df9bc in _0x5c16f5[_0x5b2e('0x46')]){if(_0x5c16f5[_0x5b2e('0x46')][_0x5b2e('0x3c')](_0x5df9bc)){var _0x1b8ba4=_0x5c16f5[_0x5b2e('0x46')][_0x5df9bc];var _0x4a6c63={'id':_0x1b8ba4['id'],'available':_0x1b8ba4[_0x5b2e('0x41')],'loggedIn':_0x1b8ba4['loggedIn'],'name':_0x1b8ba4[_0x5b2e('0x43')],'paused':_0x1b8ba4[_0x5b2e('0x44')],'waiting':_0x1b8ba4['waiting']};_0x1979ba[_0x5b2e('0x1e')](_0x4a6c63);}}_0x76d8f5({'count':_0x1979ba[_0x5b2e('0x17')],'rows':_0x1979ba});});},'OpenchannelQueues':function(_0x12856b){return new Promise(function(_0x49d042,_0x84c654){var _0xe8e3fd=[];for(var _0x30fce1 in _0x5c16f5[_0x5b2e('0x47')]){if(_0x5c16f5[_0x5b2e('0x47')]['hasOwnProperty'](_0x30fce1)){var _0x203c09=_0x5c16f5[_0x5b2e('0x47')][_0x30fce1];var _0x4d593b={'id':_0x203c09['id'],'available':_0x203c09[_0x5b2e('0x41')],'loggedIn':_0x203c09[_0x5b2e('0x42')],'name':_0x203c09[_0x5b2e('0x43')],'paused':_0x203c09['paused'],'waiting':_0x203c09['waiting']};_0xe8e3fd[_0x5b2e('0x1e')](_0x4d593b);}}_0x49d042({'count':_0xe8e3fd['length'],'rows':_0xe8e3fd});});},'SmsQueues':function(_0x43cf5){return new Promise(function(_0x51db7f,_0x486753){var _0x23bcb3=[];for(var _0x2d102b in _0x5c16f5['smsQueues']){if(_0x5c16f5[_0x5b2e('0x48')][_0x5b2e('0x3c')](_0x2d102b)){var _0x4c9a6d=_0x5c16f5[_0x5b2e('0x48')][_0x2d102b];var _0x3360ba={'id':_0x4c9a6d['id'],'available':_0x4c9a6d[_0x5b2e('0x41')],'loggedIn':_0x4c9a6d[_0x5b2e('0x42')],'name':_0x4c9a6d[_0x5b2e('0x43')],'paused':_0x4c9a6d[_0x5b2e('0x44')],'waiting':_0x4c9a6d[_0x5b2e('0x45')]};_0x23bcb3[_0x5b2e('0x1e')](_0x3360ba);}}_0x51db7f({'count':_0x23bcb3[_0x5b2e('0x17')],'rows':_0x23bcb3});});},'FaxQueues':function(_0x59469b){return new Promise(function(_0x1de755,_0x3afcf7){var _0x16507e=[];for(var _0x2b6927 in _0x5c16f5[_0x5b2e('0x49')]){if(_0x5c16f5['faxQueues'][_0x5b2e('0x3c')](_0x2b6927)){var _0x2d4df3=_0x5c16f5[_0x5b2e('0x49')][_0x2b6927];var _0x1a85c1={'id':_0x2d4df3['id'],'available':_0x2d4df3[_0x5b2e('0x41')],'loggedIn':_0x2d4df3['loggedIn'],'name':_0x2d4df3['name'],'paused':_0x2d4df3[_0x5b2e('0x44')],'waiting':_0x2d4df3['waiting']};_0x16507e[_0x5b2e('0x1e')](_0x1a85c1);}}_0x1de755({'count':_0x16507e['length'],'rows':_0x16507e});});},'WhatsappQueues':function(_0x34610d){return new Promise(function(_0x2a3278,_0xf272eb){var _0x58b3dc=[];for(var _0x8b50e9 in _0x5c16f5[_0x5b2e('0x4a')]){if(_0x5c16f5['whatsappQueues']['hasOwnProperty'](_0x8b50e9)){var _0xaf0ac3=_0x5c16f5[_0x5b2e('0x4a')][_0x8b50e9];var _0x298f57={'id':_0xaf0ac3['id'],'available':_0xaf0ac3[_0x5b2e('0x41')],'loggedIn':_0xaf0ac3[_0x5b2e('0x42')],'name':_0xaf0ac3[_0x5b2e('0x43')],'paused':_0xaf0ac3['paused'],'waiting':_0xaf0ac3[_0x5b2e('0x45')]};_0x58b3dc[_0x5b2e('0x1e')](_0x298f57);}}_0x2a3278({'count':_0x58b3dc['length'],'rows':_0x58b3dc});});},'ChatQueuesWaitingInteractions':function(_0x208257){return new Promise(function(_0x1b03c8,_0x155c58){var _0x5bbc7b=_[_0x5b2e('0x4b')](_0x5c16f5[_0x5b2e('0x4c')]);_0x1b03c8({'count':_0x5bbc7b[_0x5b2e('0x17')],'rows':_0x5bbc7b});});},'MailQueuesWaitingInteractions':function(_0x37d0de){return new Promise(function(_0x3c42ae,_0x1cfc94){var _0x223ffc=_[_0x5b2e('0x4b')](_0x5c16f5['mailQueuesWaitingInteractions']);_0x3c42ae({'count':_0x223ffc['length'],'rows':_0x223ffc});});},'OpenchannelQueuesWaitingInteractions':function(_0x5bacf4){return new Promise(function(_0x179ec6,_0x1f24d0){var _0x19c79a=_[_0x5b2e('0x4b')](_0x5c16f5[_0x5b2e('0x4d')]);_0x179ec6({'count':_0x19c79a[_0x5b2e('0x17')],'rows':_0x19c79a});});},'SmsQueuesWaitingInteractions':function(_0x152faf){return new Promise(function(_0x394385,_0x1c8977){var _0x427624=_[_0x5b2e('0x4b')](_0x5c16f5[_0x5b2e('0x4e')]);_0x394385({'count':_0x427624[_0x5b2e('0x17')],'rows':_0x427624});});},'FaxQueuesWaitingInteractions':function(_0x204531){return new Promise(function(_0x728e44,_0xdf69ea){var _0x4fa4c3=_[_0x5b2e('0x4b')](_0x5c16f5[_0x5b2e('0x4f')]);_0x728e44({'count':_0x4fa4c3['length'],'rows':_0x4fa4c3});});},'WhatsappQueuesWaitingInteractions':function(_0x2ccc94){return new Promise(function(_0x33d41f,_0x8ddf1b){var _0x1e25e5=_['values'](_0x5c16f5[_0x5b2e('0x50')]);_0x33d41f({'count':_0x1e25e5[_0x5b2e('0x17')],'rows':_0x1e25e5});});}};var _0x3f525f=jayson[_0x5b2e('0x51')](_0x43f741)['http']();_0x3f525f['on'](_0x5b2e('0x29'),function(_0x4ac4f4){logger[_0x5b2e('0x29')](JSON[_0x5b2e('0x2f')](_0x4ac4f4));return _0x681d18(_0x4ac4f4);});_0x3f525f['listen'](0x232c,'127.0.0.1',function(){console[_0x5b2e('0x52')](_0x5b2e('0x53'),0x232c);return _0x4e3972('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ef8bc7b..048aa75 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 _0x9ec4=['catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','util','bluebird','jayson/promise','lodash','routing','client','http','request','error','message','result'];(function(_0x101d46,_0x26bf97){var _0xc38e4e=function(_0x4ef76b){while(--_0x4ef76b){_0x101d46['push'](_0x101d46['shift']());}};_0xc38e4e(++_0x26bf97);}(_0x9ec4,0x17b));var _0x49ec=function(_0x101e8e,_0x3bf76e){_0x101e8e=_0x101e8e-0x0;var _0x26c65d=_0x9ec4[_0x101e8e];return _0x26c65d;};'use strict';var util=require(_0x49ec('0x0'));var BPromise=require(_0x49ec('0x1'));var jayson=require(_0x49ec('0x2'));var _=require(_0x49ec('0x3'));var logger=require('../../../config/logger')(_0x49ec('0x4'));var client=jayson[_0x49ec('0x5')][_0x49ec('0x6')]({'port':0x232a});function request(_0x5f15f0,_0x19ffb9){return new BPromise(function(_0x3b96b8,_0x48ddc2){return client[_0x49ec('0x7')](_0x5f15f0,_0x19ffb9)['then'](function(_0x1d4a3f){if(_0x1d4a3f['error']){return _0x48ddc2(_0x1d4a3f[_0x49ec('0x8')][_0x49ec('0x9')]);}else{return _0x3b96b8(_0x1d4a3f[_0x49ec('0xa')]);}})[_0x49ec('0xb')](function(_0x2bfd52){return _0x48ddc2(_0x2bfd52);});});}exports[_0x49ec('0xc')]=function(_0x2989f6,_0x5275db,_0x5192da){return function(_0x5805ca){if(_0x5192da['rules']&&!_0x5192da['rules'][_0x2989f6]){logger[_0x49ec('0xd')](_0x49ec('0xe'),_0x2989f6);return _0x5805ca[_0x49ec('0xf')]();}var _0x288c4e=[];for(var _0xba10c3=0x0;_0xba10c3<_0x5275db[_0x49ec('0x10')];_0xba10c3+=0x1){_0x288c4e[_0x49ec('0x11')](request('Command',{'command':util[_0x49ec('0x12')](_0x49ec('0x13'),_0x5275db[_0xba10c3])})[_0x49ec('0x14')](function(_0x16d9f5){return _0x16d9f5&&_0x16d9f5[_0x49ec('0x9')]&&_0x16d9f5[_0x49ec('0x9')][_0x49ec('0x15')](_0x49ec('0x16'))>=0x0?!![]:![];})['catch'](function(_0x152be9){logger[_0x49ec('0x8')](_0x49ec('0x17'),_0x2989f6,_0x5275db[_0xba10c3]);}));}BPromise[_0x49ec('0x18')](_0x288c4e)[_0x49ec('0x14')](function(_0x2c56e1){var _0x14dbae=_[_0x49ec('0x19')](_0x2c56e1);logger[_0x49ec('0xd')](_0x49ec('0x1a'),_0x2989f6,_0x5275db[_0x49ec('0x1b')]('\x20|\x20'),_0x14dbae);_0x5805ca[_0x49ec('0x1c')](_0x14dbae);})[_0x49ec('0xb')](function(_0x3e812d){console[_0x49ec('0x1d')](_0x3e812d);logger[_0x49ec('0x8')](_0x49ec('0x1a'),_0x2989f6,_0x5275db[_0x49ec('0x1b')]('\x20|\x20'),_0x3e812d['stack']);_0x5805ca[_0x49ec('0xf')]();});};}; \ No newline at end of file +var _0xafc2=['[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','lodash','../../../config/logger','routing','client','http','request','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','then','true'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xafc2,0x1bb));var _0x2afc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xafc2[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x2afc('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x2afc('0x1'));var logger=require(_0x2afc('0x2'))(_0x2afc('0x3'));var client=jayson[_0x2afc('0x4')][_0x2afc('0x5')]({'port':0x232a});function request(_0x1ef028,_0x164718){return new BPromise(function(_0x1a343e,_0x1a1a61){return client[_0x2afc('0x6')](_0x1ef028,_0x164718)['then'](function(_0xd9ccaa){if(_0xd9ccaa['error']){return _0x1a1a61(_0xd9ccaa['error'][_0x2afc('0x7')]);}else{return _0x1a343e(_0xd9ccaa[_0x2afc('0x8')]);}})[_0x2afc('0x9')](function(_0xd04ec1){return _0x1a1a61(_0xd04ec1);});});}exports[_0x2afc('0xa')]=function(_0x46cfa4,_0xc8f7d6,_0x309559){return function(_0x25d579){if(_0x309559[_0x2afc('0xb')]&&!_0x309559['rules'][_0x46cfa4]){logger[_0x2afc('0xc')](_0x2afc('0xd'),_0x46cfa4);return _0x25d579[_0x2afc('0xe')]();}var _0x4a909b=[];for(var _0x1aab3e=0x0;_0x1aab3e<_0xc8f7d6[_0x2afc('0xf')];_0x1aab3e+=0x1){_0x4a909b[_0x2afc('0x10')](request(_0x2afc('0x11'),{'command':util[_0x2afc('0x12')](_0x2afc('0x13'),_0xc8f7d6[_0x1aab3e])})[_0x2afc('0x14')](function(_0xc6a9f7){return _0xc6a9f7&&_0xc6a9f7[_0x2afc('0x7')]&&_0xc6a9f7[_0x2afc('0x7')]['indexOf'](_0x2afc('0x15'))>=0x0?!![]:![];})['catch'](function(_0x20d01f){logger['error'](_0x2afc('0x16'),_0x46cfa4,_0xc8f7d6[_0x1aab3e]);}));}BPromise[_0x2afc('0x17')](_0x4a909b)[_0x2afc('0x14')](function(_0x981f7f){var _0xe281f9=_[_0x2afc('0x18')](_0x981f7f);logger[_0x2afc('0xc')](_0x2afc('0x19'),_0x46cfa4,_0xc8f7d6[_0x2afc('0x1a')](_0x2afc('0x1b')),_0xe281f9);_0x25d579[_0x2afc('0x1c')](_0xe281f9);})['catch'](function(_0x1f18ef){console[_0x2afc('0x1d')](_0x1f18ef);logger['error'](_0x2afc('0x19'),_0x46cfa4,_0xc8f7d6['join'](_0x2afc('0x1b')),_0x1f18ef[_0x2afc('0x1e')]);_0x25d579[_0x2afc('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 722787e..0fd6f33 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 _0x196a=['indexOf','splice','agent','util','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','error','queuecallerabandon','forIn','abandoned','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','membername','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','origtransfereruniqueid','secondtransfereruniqueid','origtransfererexten','transferuniqueid','transfereeuniqueid','calleridname','agententerreason','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','rejected'];(function(_0x13966b,_0x455870){var _0x2ac845=function(_0x5452f4){while(--_0x5452f4){_0x13966b['push'](_0x13966b['shift']());}};_0x2ac845(++_0x455870);}(_0x196a,0x1a1));var _0xa196=function(_0x38e736,_0x419810){_0x38e736=_0x38e736-0x0;var _0x475651=_0x196a[_0x38e736];return _0x475651;};'use strict';var _=require('lodash');var util=require(_0xa196('0x0'));var utils=require(_0xa196('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1174c6,_0x179a62){utils[_0xa196('0x2')](util[_0xa196('0x3')](_0xa196('0x4'),_0x1174c6['uniqueid'],_0x1174c6[_0xa196('0x5')],_0x1174c6[_0xa196('0x6')],_0x1174c6['membername'],_0x1174c6[_0xa196('0x7')],_0x1174c6[_0xa196('0x8')],_0x1174c6[_0xa196('0x9')],_0x1174c6[_0xa196('0xa')]));if(_0x1174c6['queue']){utils[_0xa196('0xb')](_0x1174c6['queue'])['then'](function(_0x37e6dd){if(_0x37e6dd){_0x1174c6['type']=_0x37e6dd[_0xa196('0xc')];_0x1174c6['agentacw']=_0x1174c6[_0xa196('0xd')]?_0x37e6dd['acw']:![];_0x1174c6[_0xa196('0xe')]=_0x1174c6[_0xa196('0xf')]?_0x37e6dd[_0xa196('0x10')]:0x0;}utils[_0xa196('0x11')]('CreateVoiceAgentReport',_0x1174c6);});}else{utils[_0xa196('0x11')](_0xa196('0x12'),_0x1174c6);}if(_0x179a62){delete transfers[_0x1174c6[_0xa196('0x13')]];}else{delete agents[_0x1174c6[_0xa196('0x14')]];}}exports[_0xa196('0x15')]=function(_0x244a1b){try{agents[_0x244a1b['destuniqueid']]=_0x244a1b;agents[_0x244a1b['destuniqueid']][_0xa196('0x16')]=utils[_0xa196('0x17')]();agents[_0x244a1b[_0xa196('0x14')]][_0xa196('0xa')]=_0xa196('0x18');agents[_0x244a1b[_0xa196('0x14')]][_0xa196('0x9')]=null;agents[_0x244a1b[_0xa196('0x14')]][_0xa196('0x19')]=null;}catch(_0x208fac){utils['error'](_0x208fac[_0xa196('0x1a')]);}};exports[_0xa196('0x1b')]=function(_0x114b53){try{if(!_[_0xa196('0x1c')](agents[_0x114b53[_0xa196('0x14')]])){agents[_0x114b53[_0xa196('0x14')]][_0xa196('0x1b')]=!![];agents[_0x114b53[_0xa196('0x14')]][_0xa196('0x1d')]=utils[_0xa196('0x17')]();agents[_0x114b53[_0xa196('0x14')]]['lastevent']=_0xa196('0x1e');agents[_0x114b53[_0xa196('0x14')]][_0xa196('0x1f')]=_0xa196('0x1e');agents[_0x114b53[_0xa196('0x14')]][_0xa196('0x20')]=_0x114b53[_0xa196('0x21')]?parseInt(_0x114b53['ringtime'])/0x3e8:0x0;agents[_0x114b53['destuniqueid']]['talktime']=0x0;unanswered[_0xa196('0x22')](_0x114b53['destuniqueid']);}}catch(_0x2263a6){utils[_0xa196('0x23')](_0x2263a6[_0xa196('0x1a')]);}};exports[_0xa196('0x24')]=function(_0x41f72a){try{_[_0xa196('0x25')](agents,function(_0x496f26,_0x6a421d){if(_0x496f26[_0xa196('0x13')]==_0x41f72a[_0xa196('0x13')]&&!_['includes'](unanswered,_0x496f26[_0xa196('0x14')])){_0x496f26[_0xa196('0x1b')]=!![];_0x496f26['agentringnoanswerAt']=utils[_0xa196('0x17')]();_0x496f26['lastevent']=_0xa196('0x26');_0x496f26[_0xa196('0x1f')]=_0xa196('0x26');_0x496f26[_0xa196('0x20')]=_0x41f72a[_0xa196('0x20')];_0x496f26['talktime']=0x0;writeDB(_0x496f26);}});}catch(_0x3bf0ba){utils[_0xa196('0x23')](_0x3bf0ba[_0xa196('0x1a')]);}};exports['agentconnect']=function(_0x372f00){try{if(agents[_0x372f00[_0xa196('0x14')]]){agents[_0x372f00['destuniqueid']]['agentconnectAt']=utils[_0xa196('0x17')]();agents[_0x372f00[_0xa196('0x14')]][_0xa196('0x9')]=_0x372f00['connectedlinenum'];agents[_0x372f00[_0xa196('0x14')]][_0xa196('0x19')]=_0x372f00[_0xa196('0x19')];agents[_0x372f00['destuniqueid']][_0xa196('0x20')]=_0x372f00[_0xa196('0x21')];agents[_0x372f00['destuniqueid']][_0xa196('0xa')]='connect';_[_0xa196('0x25')](agents,function(_0x4135e7,_0x3a1d34){if(_0x4135e7[_0xa196('0x14')]!=_0x372f00['destuniqueid']&&_0x4135e7[_0xa196('0x13')]==_0x372f00[_0xa196('0x13')]){_0x4135e7[_0xa196('0x27')]=0x0;_0x4135e7[_0xa196('0x20')]=_0x372f00['ringtime'];_0x4135e7['agentringnoanswer']=!![];_0x4135e7['agentringnoanswerAt']=utils[_0xa196('0x17')]();_0x4135e7[_0xa196('0xa')]=_0xa196('0x28');_0x4135e7[_0xa196('0x1f')]=_0xa196('0x28');_0x4135e7[_0xa196('0x29')]=_0x372f00[_0xa196('0x14')];_0x4135e7[_0xa196('0x2a')]=_0x372f00[_0xa196('0x2b')];writeDB(_0x4135e7);}});}}catch(_0x16f77d){utils[_0xa196('0x23')](_0x16f77d['stack']);}};exports['agentcomplete']=function(_0x3c0ce){try{if(!_[_0xa196('0x1c')](agents[_0x3c0ce[_0xa196('0x14')]])){agents[_0x3c0ce[_0xa196('0x14')]][_0xa196('0xd')]=!![];agents[_0x3c0ce[_0xa196('0x14')]][_0xa196('0x2c')]=utils['now']();agents[_0x3c0ce['destuniqueid']][_0xa196('0x27')]=utils[_0xa196('0x2d')](agents[_0x3c0ce[_0xa196('0x14')]][_0xa196('0x2c')],agents[_0x3c0ce[_0xa196('0x14')]][_0xa196('0x2e')]);agents[_0x3c0ce['destuniqueid']]['reason']=_0x3c0ce['reason'];agents[_0x3c0ce[_0xa196('0x14')]][_0xa196('0xa')]=_0xa196('0x2f');writeDB(agents[_0x3c0ce[_0xa196('0x14')]]);}}catch(_0x948d6){utils[_0xa196('0x23')](_0x948d6[_0xa196('0x1a')]);}};exports[_0xa196('0x30')]=function(_0x2fcb74){try{if(!_[_0xa196('0x1c')](agents[_0x2fcb74['transfereruniqueid']])){agents[_0x2fcb74[_0xa196('0x31')]][_0xa196('0x32')]=!![];agents[_0x2fcb74[_0xa196('0x31')]][_0xa196('0x33')]=_0xa196('0x34');agents[_0x2fcb74['transfereruniqueid']][_0xa196('0x35')]=_0x2fcb74['extension'];agents[_0x2fcb74[_0xa196('0x31')]]['transferuniqueid']=agents[_0x2fcb74[_0xa196('0x31')]][_0xa196('0x13')];}}catch(_0x32d92a){utils[_0xa196('0x23')](_0x32d92a[_0xa196('0x1a')]);}};exports['attendedtransfer']=function(_0x196bf0){try{if(_0x196bf0[_0xa196('0x36')]==_0x196bf0['origtransfererlinkedid']){if(!_[_0xa196('0x1c')](agents[_0x196bf0[_0xa196('0x37')]])){agents[_0x196bf0['secondtransfereruniqueid']][_0xa196('0x32')]=!![];agents[_0x196bf0[_0xa196('0x37')]][_0xa196('0x33')]='ATTENDED';agents[_0x196bf0[_0xa196('0x37')]][_0xa196('0x35')]=_0x196bf0[_0xa196('0x38')];agents[_0x196bf0['secondtransfereruniqueid']][_0xa196('0x39')]=_0x196bf0['origtransfereruniqueid'];}if(_0x196bf0[_0xa196('0x3a')]&&agents[_0x196bf0['transfereeuniqueid']]){agents[_0x196bf0['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x196bf0['transfereeuniqueid']]=_['clone'](agents[_0x196bf0['transfereeuniqueid']]);transfers[_0x196bf0[_0xa196('0x3a')]]['calleridnum']=agents[_0x196bf0[_0xa196('0x37')]][_0xa196('0x8')];transfers[_0x196bf0[_0xa196('0x3a')]]['calleridname']=agents[_0x196bf0[_0xa196('0x37')]][_0xa196('0x3b')];transfers[_0x196bf0[_0xa196('0x3a')]][_0xa196('0x16')]=utils[_0xa196('0x17')]();transfers[_0x196bf0[_0xa196('0x3a')]]['agentconnectAt']=utils['now']();transfers[_0x196bf0['transfereeuniqueid']][_0xa196('0x20')]=0x0;transfers[_0x196bf0[_0xa196('0x3a')]][_0xa196('0x3c')]=0x2;}}else if(_0x196bf0[_0xa196('0x37')]==_0x196bf0['secondtransfererlinkedid']){if(!_[_0xa196('0x1c')](agents[_0x196bf0[_0xa196('0x36')]])){agents[_0x196bf0[_0xa196('0x36')]][_0xa196('0x32')]=!![];agents[_0x196bf0[_0xa196('0x36')]][_0xa196('0x33')]=_0xa196('0x3d');agents[_0x196bf0['origtransfereruniqueid']][_0xa196('0x35')]=_0x196bf0[_0xa196('0x3e')];agents[_0x196bf0[_0xa196('0x36')]][_0xa196('0x39')]=_0x196bf0['secondtransfereruniqueid'];}if(_0x196bf0[_0xa196('0x3f')]&&agents[_0x196bf0[_0xa196('0x3f')]]){agents[_0x196bf0[_0xa196('0x3f')]]['agententerreason']=0x1;transfers[_0x196bf0['transfertargetuniqueid']]=_[_0xa196('0x40')](agents[_0x196bf0[_0xa196('0x3f')]]);transfers[_0x196bf0[_0xa196('0x3f')]][_0xa196('0x8')]=agents[_0x196bf0[_0xa196('0x36')]][_0xa196('0x8')];transfers[_0x196bf0[_0xa196('0x3f')]][_0xa196('0x3b')]=agents[_0x196bf0['origtransfereruniqueid']]['calleridname'];transfers[_0x196bf0['transfertargetuniqueid']][_0xa196('0x16')]=utils[_0xa196('0x17')]();transfers[_0x196bf0[_0xa196('0x3f')]][_0xa196('0x2e')]=utils[_0xa196('0x17')]();transfers[_0x196bf0[_0xa196('0x3f')]][_0xa196('0x20')]=0x0;transfers[_0x196bf0[_0xa196('0x3f')]][_0xa196('0x3c')]=0x2;}}}catch(_0x1672ae){utils[_0xa196('0x23')](_0x1672ae[_0xa196('0x1a')]);}};exports['hangup']=function(_0x3c528e){try{if(agents[_0x3c528e['uniqueid']]&&agents[_0x3c528e[_0xa196('0x13')]]['reason']===_0xa196('0x1e')){if(_0x3c528e['cause']==='21'){agents[_0x3c528e[_0xa196('0x13')]][_0xa196('0x1f')]=_0xa196('0x41');agents[_0x3c528e[_0xa196('0x13')]][_0xa196('0xa')]=_0xa196('0x41');}writeDB(agents[_0x3c528e['uniqueid']]);var _0x117f18=unanswered[_0xa196('0x42')](_0x3c528e['uniqueid']);if(_0x117f18>-0x1)unanswered[_0xa196('0x43')](_0x117f18,0x1);}if(transfers[_0x3c528e[_0xa196('0x13')]]){transfers[_0x3c528e['uniqueid']][_0xa196('0xd')]=!![];transfers[_0x3c528e[_0xa196('0x13')]]['agentcompleteAt']=utils[_0xa196('0x17')]();transfers[_0x3c528e[_0xa196('0x13')]][_0xa196('0x27')]=utils[_0xa196('0x2d')](transfers[_0x3c528e['uniqueid']][_0xa196('0x2c')],transfers[_0x3c528e['uniqueid']]['agentconnectAt']);transfers[_0x3c528e[_0xa196('0x13')]][_0xa196('0x1f')]=_0xa196('0x44');transfers[_0x3c528e[_0xa196('0x13')]][_0xa196('0xa')]=_0xa196('0x2f');writeDB(transfers[_0x3c528e[_0xa196('0x13')]],!![]);}if(agents[_0x3c528e[_0xa196('0x13')]]&&agents[_0x3c528e[_0xa196('0x13')]][_0xa196('0x2e')]){agents[_0x3c528e[_0xa196('0x13')]][_0xa196('0xd')]=!![];agents[_0x3c528e[_0xa196('0x13')]][_0xa196('0x2c')]=utils[_0xa196('0x17')]();agents[_0x3c528e[_0xa196('0x13')]][_0xa196('0x27')]=utils[_0xa196('0x2d')](agents[_0x3c528e[_0xa196('0x13')]][_0xa196('0x2c')],agents[_0x3c528e['uniqueid']][_0xa196('0x2e')]);agents[_0x3c528e['uniqueid']][_0xa196('0x1f')]=agents[_0x3c528e[_0xa196('0x13')]][_0xa196('0x32')]?_0xa196('0x32'):_0xa196('0x44');agents[_0x3c528e[_0xa196('0x13')]][_0xa196('0xa')]=_0xa196('0x2f');writeDB(agents[_0x3c528e['uniqueid']]);}}catch(_0x5bb38d){utils[_0xa196('0x23')](_0x5bb38d[_0xa196('0x1a')]);}}; \ No newline at end of file +var _0x9025=['attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','agentcalledAt','secondtransfererlinkedid','transfertargetuniqueid','hangup','cause','rejected','diffTime','agent','lodash','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','lastevent','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','request','agentcalled','destuniqueid','now','called','connectedlinenum','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','queuecallerabandon','forIn','includes','abandoned','talktime','agentconnect','connect','answered_elsewhere','agentcompleteAt','agentconnectAt','complete','blindtransfer','transfereruniqueid','transfertype','transferexten','extension','transferuniqueid'];(function(_0x4678fd,_0x431892){var _0xfef9c0=function(_0x43afe){while(--_0x43afe){_0x4678fd['push'](_0x4678fd['shift']());}};_0xfef9c0(++_0x431892);}(_0x9025,0x1bd));var _0x5902=function(_0x4ea2a0,_0x4a39b4){_0x4ea2a0=_0x4ea2a0-0x0;var _0x3ec1b1=_0x9025[_0x4ea2a0];return _0x3ec1b1;};'use strict';var _=require(_0x5902('0x0'));var util=require(_0x5902('0x1'));var utils=require(_0x5902('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x12fcac,_0x389e52){utils['info'](util[_0x5902('0x3')](_0x5902('0x4'),_0x12fcac[_0x5902('0x5')],_0x12fcac[_0x5902('0x6')],_0x12fcac[_0x5902('0x7')],_0x12fcac[_0x5902('0x8')],_0x12fcac[_0x5902('0x9')],_0x12fcac['calleridnum'],_0x12fcac['connectedlinenum'],_0x12fcac[_0x5902('0xa')]));if(_0x12fcac[_0x5902('0x7')]){utils['getVoiceQueueByName'](_0x12fcac['queue'])[_0x5902('0xb')](function(_0x38fc4d){if(_0x38fc4d){_0x12fcac[_0x5902('0xc')]=_0x38fc4d['type'];_0x12fcac['agentacw']=_0x12fcac[_0x5902('0xd')]?_0x38fc4d[_0x5902('0xe')]:![];_0x12fcac['acwtime']=_0x12fcac[_0x5902('0xf')]?_0x38fc4d[_0x5902('0x10')]:0x0;}utils['request'](_0x5902('0x11'),_0x12fcac);});}else{utils[_0x5902('0x12')](_0x5902('0x11'),_0x12fcac);}if(_0x389e52){delete transfers[_0x12fcac['uniqueid']];}else{delete agents[_0x12fcac['destuniqueid']];}}exports[_0x5902('0x13')]=function(_0xacb590){try{agents[_0xacb590[_0x5902('0x14')]]=_0xacb590;agents[_0xacb590[_0x5902('0x14')]]['agentcalledAt']=utils[_0x5902('0x15')]();agents[_0xacb590[_0x5902('0x14')]][_0x5902('0xa')]=_0x5902('0x16');agents[_0xacb590['destuniqueid']][_0x5902('0x17')]=null;agents[_0xacb590['destuniqueid']][_0x5902('0x18')]=null;}catch(_0x168669){utils[_0x5902('0x19')](_0x168669[_0x5902('0x1a')]);}};exports[_0x5902('0x1b')]=function(_0x4a121f){try{if(!_[_0x5902('0x1c')](agents[_0x4a121f[_0x5902('0x14')]])){agents[_0x4a121f[_0x5902('0x14')]]['agentringnoanswer']=!![];agents[_0x4a121f[_0x5902('0x14')]][_0x5902('0x1d')]=utils[_0x5902('0x15')]();agents[_0x4a121f[_0x5902('0x14')]][_0x5902('0xa')]=_0x5902('0x1e');agents[_0x4a121f[_0x5902('0x14')]][_0x5902('0x1f')]=_0x5902('0x1e');agents[_0x4a121f[_0x5902('0x14')]][_0x5902('0x20')]=_0x4a121f[_0x5902('0x21')]?parseInt(_0x4a121f[_0x5902('0x21')])/0x3e8:0x0;agents[_0x4a121f[_0x5902('0x14')]]['talktime']=0x0;unanswered[_0x5902('0x22')](_0x4a121f[_0x5902('0x14')]);}}catch(_0x47e8f6){utils[_0x5902('0x19')](_0x47e8f6[_0x5902('0x1a')]);}};exports[_0x5902('0x23')]=function(_0x418ba7){try{_[_0x5902('0x24')](agents,function(_0x1300af,_0xc614ff){if(_0x1300af[_0x5902('0x5')]==_0x418ba7[_0x5902('0x5')]&&!_[_0x5902('0x25')](unanswered,_0x1300af['destuniqueid'])){_0x1300af['agentringnoanswer']=!![];_0x1300af[_0x5902('0x1d')]=utils[_0x5902('0x15')]();_0x1300af[_0x5902('0xa')]=_0x5902('0x26');_0x1300af[_0x5902('0x1f')]=_0x5902('0x26');_0x1300af[_0x5902('0x20')]=_0x418ba7[_0x5902('0x20')];_0x1300af[_0x5902('0x27')]=0x0;writeDB(_0x1300af);}});}catch(_0x32baf3){utils[_0x5902('0x19')](_0x32baf3[_0x5902('0x1a')]);}};exports[_0x5902('0x28')]=function(_0x4894fd){try{if(agents[_0x4894fd[_0x5902('0x14')]]){agents[_0x4894fd['destuniqueid']]['agentconnectAt']=utils[_0x5902('0x15')]();agents[_0x4894fd[_0x5902('0x14')]][_0x5902('0x17')]=_0x4894fd[_0x5902('0x17')];agents[_0x4894fd['destuniqueid']][_0x5902('0x18')]=_0x4894fd[_0x5902('0x18')];agents[_0x4894fd[_0x5902('0x14')]][_0x5902('0x20')]=_0x4894fd[_0x5902('0x21')];agents[_0x4894fd[_0x5902('0x14')]][_0x5902('0xa')]=_0x5902('0x29');_['forIn'](agents,function(_0xead5aa,_0x21e4a1){if(_0xead5aa[_0x5902('0x14')]!=_0x4894fd['destuniqueid']&&_0xead5aa['uniqueid']==_0x4894fd[_0x5902('0x5')]){_0xead5aa[_0x5902('0x27')]=0x0;_0xead5aa[_0x5902('0x20')]=_0x4894fd[_0x5902('0x21')];_0xead5aa[_0x5902('0x1b')]=!![];_0xead5aa[_0x5902('0x1d')]=utils[_0x5902('0x15')]();_0xead5aa[_0x5902('0xa')]=_0x5902('0x2a');_0xead5aa['reason']=_0x5902('0x2a');_0xead5aa['answeredelsewheredestinationuniqueid']=_0x4894fd[_0x5902('0x14')];_0xead5aa['answeredelsewheremembername']=_0x4894fd[_0x5902('0x8')];writeDB(_0xead5aa);}});}}catch(_0x4a9b4a){utils[_0x5902('0x19')](_0x4a9b4a[_0x5902('0x1a')]);}};exports[_0x5902('0xd')]=function(_0x2f8248){try{if(!_[_0x5902('0x1c')](agents[_0x2f8248[_0x5902('0x14')]])){agents[_0x2f8248[_0x5902('0x14')]][_0x5902('0xd')]=!![];agents[_0x2f8248[_0x5902('0x14')]][_0x5902('0x2b')]=utils[_0x5902('0x15')]();agents[_0x2f8248['destuniqueid']][_0x5902('0x27')]=utils['diffTime'](agents[_0x2f8248[_0x5902('0x14')]][_0x5902('0x2b')],agents[_0x2f8248[_0x5902('0x14')]][_0x5902('0x2c')]);agents[_0x2f8248[_0x5902('0x14')]][_0x5902('0x1f')]=_0x2f8248[_0x5902('0x1f')];agents[_0x2f8248['destuniqueid']][_0x5902('0xa')]=_0x5902('0x2d');writeDB(agents[_0x2f8248[_0x5902('0x14')]]);}}catch(_0x56138f){utils['error'](_0x56138f[_0x5902('0x1a')]);}};exports[_0x5902('0x2e')]=function(_0x56aab7){try{if(!_[_0x5902('0x1c')](agents[_0x56aab7[_0x5902('0x2f')]])){agents[_0x56aab7['transfereruniqueid']]['transfer']=!![];agents[_0x56aab7[_0x5902('0x2f')]][_0x5902('0x30')]='blind';agents[_0x56aab7[_0x5902('0x2f')]][_0x5902('0x31')]=_0x56aab7[_0x5902('0x32')];agents[_0x56aab7[_0x5902('0x2f')]][_0x5902('0x33')]=agents[_0x56aab7['transfereruniqueid']][_0x5902('0x5')];}}catch(_0x2d9b1e){utils[_0x5902('0x19')](_0x2d9b1e['stack']);}};exports[_0x5902('0x34')]=function(_0x8982f0){try{if(_0x8982f0[_0x5902('0x35')]==_0x8982f0[_0x5902('0x36')]){if(!_[_0x5902('0x1c')](agents[_0x8982f0[_0x5902('0x37')]])){agents[_0x8982f0[_0x5902('0x37')]][_0x5902('0x38')]=!![];agents[_0x8982f0[_0x5902('0x37')]]['transfertype']=_0x5902('0x39');agents[_0x8982f0[_0x5902('0x37')]][_0x5902('0x31')]=_0x8982f0['origtransfererexten'];agents[_0x8982f0['secondtransfereruniqueid']]['transferuniqueid']=_0x8982f0[_0x5902('0x35')];}if(_0x8982f0[_0x5902('0x3a')]&&agents[_0x8982f0[_0x5902('0x3a')]]){agents[_0x8982f0[_0x5902('0x3a')]][_0x5902('0x3b')]=0x1;transfers[_0x8982f0[_0x5902('0x3a')]]=_[_0x5902('0x3c')](agents[_0x8982f0['transfereeuniqueid']]);transfers[_0x8982f0[_0x5902('0x3a')]][_0x5902('0x3d')]=agents[_0x8982f0[_0x5902('0x37')]][_0x5902('0x3d')];transfers[_0x8982f0['transfereeuniqueid']][_0x5902('0x3e')]=agents[_0x8982f0[_0x5902('0x37')]][_0x5902('0x3e')];transfers[_0x8982f0['transfereeuniqueid']][_0x5902('0x3f')]=utils[_0x5902('0x15')]();transfers[_0x8982f0['transfereeuniqueid']][_0x5902('0x2c')]=utils[_0x5902('0x15')]();transfers[_0x8982f0['transfereeuniqueid']][_0x5902('0x20')]=0x0;transfers[_0x8982f0[_0x5902('0x3a')]][_0x5902('0x3b')]=0x2;}}else if(_0x8982f0[_0x5902('0x37')]==_0x8982f0[_0x5902('0x40')]){if(!_[_0x5902('0x1c')](agents[_0x8982f0[_0x5902('0x35')]])){agents[_0x8982f0['origtransfereruniqueid']][_0x5902('0x38')]=!![];agents[_0x8982f0['origtransfereruniqueid']][_0x5902('0x30')]=_0x5902('0x39');agents[_0x8982f0['origtransfereruniqueid']][_0x5902('0x31')]=_0x8982f0['secondtransfererexten'];agents[_0x8982f0['origtransfereruniqueid']][_0x5902('0x33')]=_0x8982f0[_0x5902('0x37')];}if(_0x8982f0['transfertargetuniqueid']&&agents[_0x8982f0[_0x5902('0x41')]]){agents[_0x8982f0[_0x5902('0x41')]][_0x5902('0x3b')]=0x1;transfers[_0x8982f0[_0x5902('0x41')]]=_[_0x5902('0x3c')](agents[_0x8982f0['transfertargetuniqueid']]);transfers[_0x8982f0[_0x5902('0x41')]][_0x5902('0x3d')]=agents[_0x8982f0['origtransfereruniqueid']]['calleridnum'];transfers[_0x8982f0['transfertargetuniqueid']][_0x5902('0x3e')]=agents[_0x8982f0['origtransfereruniqueid']][_0x5902('0x3e')];transfers[_0x8982f0['transfertargetuniqueid']]['agentcalledAt']=utils[_0x5902('0x15')]();transfers[_0x8982f0[_0x5902('0x41')]][_0x5902('0x2c')]=utils[_0x5902('0x15')]();transfers[_0x8982f0[_0x5902('0x41')]][_0x5902('0x20')]=0x0;transfers[_0x8982f0[_0x5902('0x41')]]['agententerreason']=0x2;}}}catch(_0x561ce5){utils[_0x5902('0x19')](_0x561ce5['stack']);}};exports[_0x5902('0x42')]=function(_0x1083ef){try{if(agents[_0x1083ef[_0x5902('0x5')]]&&agents[_0x1083ef[_0x5902('0x5')]]['reason']===_0x5902('0x1e')){if(_0x1083ef[_0x5902('0x43')]==='21'){agents[_0x1083ef['uniqueid']][_0x5902('0x1f')]=_0x5902('0x44');agents[_0x1083ef[_0x5902('0x5')]]['lastevent']='rejected';}writeDB(agents[_0x1083ef['uniqueid']]);var _0x2cb674=unanswered['indexOf'](_0x1083ef['uniqueid']);if(_0x2cb674>-0x1)unanswered['splice'](_0x2cb674,0x1);}if(transfers[_0x1083ef['uniqueid']]){transfers[_0x1083ef[_0x5902('0x5')]][_0x5902('0xd')]=!![];transfers[_0x1083ef[_0x5902('0x5')]][_0x5902('0x2b')]=utils[_0x5902('0x15')]();transfers[_0x1083ef[_0x5902('0x5')]][_0x5902('0x27')]=utils[_0x5902('0x45')](transfers[_0x1083ef['uniqueid']][_0x5902('0x2b')],transfers[_0x1083ef[_0x5902('0x5')]]['agentconnectAt']);transfers[_0x1083ef[_0x5902('0x5')]]['reason']=_0x5902('0x46');transfers[_0x1083ef[_0x5902('0x5')]]['lastevent']=_0x5902('0x2d');writeDB(transfers[_0x1083ef[_0x5902('0x5')]],!![]);}if(agents[_0x1083ef['uniqueid']]&&agents[_0x1083ef[_0x5902('0x5')]][_0x5902('0x2c')]){agents[_0x1083ef[_0x5902('0x5')]][_0x5902('0xd')]=!![];agents[_0x1083ef[_0x5902('0x5')]]['agentcompleteAt']=utils['now']();agents[_0x1083ef[_0x5902('0x5')]]['talktime']=utils[_0x5902('0x45')](agents[_0x1083ef[_0x5902('0x5')]][_0x5902('0x2b')],agents[_0x1083ef[_0x5902('0x5')]][_0x5902('0x2c')]);agents[_0x1083ef[_0x5902('0x5')]][_0x5902('0x1f')]=agents[_0x1083ef['uniqueid']][_0x5902('0x38')]?_0x5902('0x38'):'agent';agents[_0x1083ef[_0x5902('0x5')]][_0x5902('0xa')]=_0x5902('0x2d');writeDB(agents[_0x1083ef['uniqueid']]);}}catch(_0x57be51){utils[_0x5902('0x19')](_0x57be51[_0x5902('0x1a')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 025926c..d7ffb09 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 _0xad20=['info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','type','accountcode','source','destination','callerid','disposition','then','UserId','CreateVoiceCallReport','request','uniqueid','newchannel','linkedid','channel','calleridnum','exten','now','error','stack','newstate','channelstate','isNil','systemanswertime','transfer','destinationchannel','answertime','ANSWERED','hangup','calleridname','endtime','duration','diffTime','localtwolinkedid','transfereechannel','secondtransfererchannel','origtransfererchannel','userfield','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','xmd-originatecalleridnum','xmd-phone','value','variable','xmd-callerid','xmcs-queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lodash','util','./utils','FAILED','NO\x20ANSWER','BUSY'];(function(_0x474f1e,_0x5f26e5){var _0x483f21=function(_0x3364b4){while(--_0x3364b4){_0x474f1e['push'](_0x474f1e['shift']());}};_0x483f21(++_0x5f26e5);}(_0xad20,0x18a));var _0x0ad2=function(_0x46d750,_0x4beee0){_0x46d750=_0x46d750-0x0;var _0x5345d7=_0xad20[_0x46d750];return _0x5345d7;};'use strict';var _=require(_0x0ad2('0x0'));var util=require(_0x0ad2('0x1'));var utils=require(_0x0ad2('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0x0ad2('0x3'),_0x0ad2('0x4'),_0x0ad2('0x4'),_0x0ad2('0x4'),'ANSWERED',_0x0ad2('0x5'),_0x0ad2('0x3'),_0x0ad2('0x3'),'FAILED'];var channels={};function writeDB(_0x143d0d){utils[_0x0ad2('0x6')](util[_0x0ad2('0x7')](_0x0ad2('0x8'),_0x143d0d['uniqueid'],_0x143d0d['channel'],_0x143d0d[_0x0ad2('0x9')],_0x143d0d[_0x0ad2('0xa')],_0x143d0d[_0x0ad2('0xb')],_0x143d0d[_0x0ad2('0xc')],_0x143d0d[_0x0ad2('0xd')],_0x143d0d[_0x0ad2('0xe')]));if(_0x143d0d[_0x0ad2('0xa')]){utils['getUserByInternal'](_0x143d0d[_0x0ad2('0xa')])[_0x0ad2('0xf')](function(_0x120a45){if(_0x120a45){_0x143d0d[_0x0ad2('0x10')]=_0x120a45['id'];}utils['request'](_0x0ad2('0x11'),_0x143d0d);});}else{utils[_0x0ad2('0x12')](_0x0ad2('0x11'),_0x143d0d);}if(channels[_0x143d0d[_0x0ad2('0x13')]]){delete channels[_0x143d0d[_0x0ad2('0x13')]];}}exports[_0x0ad2('0x14')]=function(_0x543151){try{if(_0x543151[_0x0ad2('0x13')]==_0x543151[_0x0ad2('0x15')]&&_0x543151[_0x0ad2('0x16')]!='OutgoingSpoolFailed'){channels[_0x543151[_0x0ad2('0x13')]]={'uniqueid':_0x543151[_0x0ad2('0x13')],'accountcode':_0x543151[_0x0ad2('0xa')],'source':_0x543151[_0x0ad2('0x17')],'destination':_0x543151[_0x0ad2('0x18')],'destinationcontext':_0x543151['context'],'channel':_0x543151[_0x0ad2('0x16')],'starttime':utils[_0x0ad2('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x228933){utils[_0x0ad2('0x1a')](_0x228933[_0x0ad2('0x1b')]);}};exports[_0x0ad2('0x1c')]=function(_0x5bb255){try{if(!_['isNil'](channels[_0x5bb255[_0x0ad2('0x13')]])&&_0x5bb255[_0x0ad2('0x1d')]==0x6){if(_[_0x0ad2('0x1e')](channels[_0x5bb255['uniqueid']]['systemanswertime'])){channels[_0x5bb255[_0x0ad2('0x13')]][_0x0ad2('0x1f')]=utils['now']();}}else if(!_[_0x0ad2('0x1e')](channels[_0x5bb255['linkedid']])&&_0x5bb255[_0x0ad2('0x1d')]==0x6&&_0x5bb255['context']!=_0x0ad2('0x20')){channels[_0x5bb255[_0x0ad2('0x15')]][_0x0ad2('0xa')]=_0x5bb255['accountcode'];channels[_0x5bb255[_0x0ad2('0x15')]][_0x0ad2('0x21')]=_0x5bb255[_0x0ad2('0x16')];if(_[_0x0ad2('0x1e')](channels[_0x5bb255[_0x0ad2('0x15')]][_0x0ad2('0x22')])){channels[_0x5bb255[_0x0ad2('0x15')]][_0x0ad2('0x22')]=utils[_0x0ad2('0x19')]();}channels[_0x5bb255['linkedid']][_0x0ad2('0xe')]=dispositions[_['toNumber'](_0x5bb255['channelstate'])]||_0x0ad2('0x23');}}catch(_0x93eed2){utils[_0x0ad2('0x1a')](_0x93eed2[_0x0ad2('0x1b')]);}};exports[_0x0ad2('0x24')]=function(_0x361e8f){try{if(!_[_0x0ad2('0x1e')](channels[_0x361e8f[_0x0ad2('0x13')]])){if(_[_0x0ad2('0x1e')](channels[_0x361e8f[_0x0ad2('0x13')]][_0x0ad2('0xd')])){channels[_0x361e8f[_0x0ad2('0x13')]][_0x0ad2('0xd')]=_0x361e8f[_0x0ad2('0x25')]+'\x20<'+_0x361e8f[_0x0ad2('0x17')]+'>';}channels[_0x361e8f['uniqueid']][_0x0ad2('0x26')]=utils[_0x0ad2('0x19')]();channels[_0x361e8f[_0x0ad2('0x13')]][_0x0ad2('0x27')]=utils[_0x0ad2('0x28')](channels[_0x361e8f[_0x0ad2('0x13')]][_0x0ad2('0x26')],channels[_0x361e8f[_0x0ad2('0x13')]]['starttime']);channels[_0x361e8f[_0x0ad2('0x13')]]['billableseconds']=channels[_0x361e8f[_0x0ad2('0x13')]]['answertime']?utils[_0x0ad2('0x28')](channels[_0x361e8f['uniqueid']][_0x0ad2('0x26')],channels[_0x361e8f[_0x0ad2('0x13')]][_0x0ad2('0x22')]):0x0;writeDB(channels[_0x361e8f[_0x0ad2('0x13')]]);}}catch(_0x1dc3bb){utils[_0x0ad2('0x1a')](_0x1dc3bb[_0x0ad2('0x1b')]);}};exports['attendedtransfer']=function(_0x3de24f){try{if(!_[_0x0ad2('0x1e')](channels[_0x3de24f[_0x0ad2('0x29')]])){if(channels[_0x3de24f['localtwolinkedid']]['channel']==_0x3de24f[_0x0ad2('0x2a')]){channels[_0x3de24f[_0x0ad2('0x29')]]['destinationchannel']=_0x3de24f[_0x0ad2('0x2b')];channels[_0x3de24f['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x3de24f['localtwolinkedid']]['channel']=_0x3de24f['transfertargetchannel']){channels[_0x3de24f[_0x0ad2('0x29')]][_0x0ad2('0x21')]=_0x3de24f[_0x0ad2('0x2c')];channels[_0x3de24f[_0x0ad2('0x29')]][_0x0ad2('0x2d')]='_attended';}}}catch(_0x5d8ded){utils[_0x0ad2('0x1a')](_0x5d8ded[_0x0ad2('0x1b')]);}};exports[_0x0ad2('0x2e')]=function(_0x4e06bd){try{if(!_[_0x0ad2('0x1e')](channels[_0x4e06bd[_0x0ad2('0x13')]])){channels[_0x4e06bd[_0x0ad2('0x13')]][_0x0ad2('0x2f')]=utils[_0x0ad2('0x19')]();}}catch(_0x2eba97){utils[_0x0ad2('0x1a')](_0x2eba97['stack']);}};exports[_0x0ad2('0x30')]=function(_0x550284){try{if(!_[_0x0ad2('0x1e')](channels[_0x550284['uniqueid']])){if(!_['isNil'](channels[_0x550284['uniqueid']]['musiconholdstartAt'])){channels[_0x550284['uniqueid']][_0x0ad2('0x31')]+=utils[_0x0ad2('0x28')](utils['now'](),channels[_0x550284['uniqueid']][_0x0ad2('0x2f')]);delete channels[_0x550284[_0x0ad2('0x13')]][_0x0ad2('0x2f')];}}}catch(_0x4156c2){utils['error'](_0x4156c2['stack']);}};exports[_0x0ad2('0x32')]=function(_0x45e281){try{if(!_[_0x0ad2('0x1e')](channels[_0x45e281[_0x0ad2('0x13')]])){if(!_[_0x0ad2('0x1e')](_0x45e281['variable'][_0x0ad2('0x33')])){channels[_0x45e281['uniqueid']][_0x0ad2('0xb')]=_0x45e281['value'];}if(!_[_0x0ad2('0x1e')](_0x45e281['variable'][_0x0ad2('0x34')])){channels[_0x45e281[_0x0ad2('0x13')]]['destination']=_0x45e281[_0x0ad2('0x35')];channels[_0x45e281[_0x0ad2('0x13')]]['callerid']='\x22'+_0x45e281['value']+'\x22\x20<'+_0x45e281[_0x0ad2('0x35')]+'>';}if(!_[_0x0ad2('0x1e')](_0x45e281[_0x0ad2('0x36')]['xmd-callerid-preview'])||!_['isNil'](_0x45e281['variable'][_0x0ad2('0x37')])){channels[_0x45e281['uniqueid']][_0x0ad2('0xd')]=_0x45e281['value'];}if(!_[_0x0ad2('0x1e')](_0x45e281[_0x0ad2('0x36')]['xmd-queue'])||!_[_0x0ad2('0x1e')](_0x45e281[_0x0ad2('0x36')][_0x0ad2('0x38')])){channels[_0x45e281['uniqueid']]['lastapplication']='Queue';channels[_0x45e281[_0x0ad2('0x13')]][_0x0ad2('0x39')]=_0x45e281[_0x0ad2('0x35')];channels[_0x45e281[_0x0ad2('0x13')]][_0x0ad2('0x3a')]=!![];}if(!_['isNil'](_0x45e281[_0x0ad2('0x36')][_0x0ad2('0x3b')])){channels[_0x45e281[_0x0ad2('0x13')]][_0x0ad2('0x3c')]=_0x45e281[_0x0ad2('0x35')];}if(!_[_0x0ad2('0x1e')](_0x45e281[_0x0ad2('0x36')][_0x0ad2('0x3d')])){channels[_0x45e281['uniqueid']][_0x0ad2('0x9')]=_0x45e281[_0x0ad2('0x35')];}if(!_[_0x0ad2('0x1e')](_0x45e281[_0x0ad2('0x36')][_0x0ad2('0x3e')])){channels[_0x45e281[_0x0ad2('0x13')]][_0x0ad2('0x3f')]=_0x45e281[_0x0ad2('0x35')];}if(!_[_0x0ad2('0x1e')](_0x45e281[_0x0ad2('0x36')][_0x0ad2('0x40')])){channels[_0x45e281['uniqueid']][_0x0ad2('0x40')]=_0x45e281[_0x0ad2('0x35')];}}}catch(_0x130115){utils[_0x0ad2('0x1a')](_0x130115[_0x0ad2('0x1b')]);}};exports[_0x0ad2('0x41')]=function(_0x39db42){try{if(!_[_0x0ad2('0x1e')](channels[_0x39db42[_0x0ad2('0x13')]])){if(_0x39db42[_0x0ad2('0x42')][_0x0ad2('0x43')]()==_0x0ad2('0x44')&&_[_0x0ad2('0x45')](_0x39db42['appdata']['toLowerCase'](),_0x0ad2('0x46'))){var _0x2f2571=_0x39db42[_0x0ad2('0x47')][_0x0ad2('0x48')]('=');var _0x40e897=_0x2f2571[0x0][_0x0ad2('0x49')](_0x2f2571[0x0]['lastIndexOf']('(')+0x1,_0x2f2571[0x0][_0x0ad2('0x4a')](')'));var _0xb5fe74=_0x2f2571[0x1];channels[_0x39db42[_0x0ad2('0x13')]][_0x40e897]=_0xb5fe74;}if(!_[_0x0ad2('0x4b')](['hangup',_0x0ad2('0x4c'),_0x0ad2('0x4d'),'set',_0x0ad2('0x4e')],_0x39db42[_0x0ad2('0x42')]['toLowerCase']())){channels[_0x39db42['uniqueid']][_0x0ad2('0x4f')]=_0x39db42[_0x0ad2('0x42')];channels[_0x39db42[_0x0ad2('0x13')]][_0x0ad2('0x39')]=_0x39db42[_0x0ad2('0x47')];}}}catch(_0x15284b){utils['error'](_0x15284b[_0x0ad2('0x1b')]);}}; \ No newline at end of file +var _0xb417=['xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','sipcallid','newexten','application','set','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','type','accountcode','source','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','OutgoingSpoolFailed','calleridnum','exten','context','DOCUMENTATION','newstate','channelstate','isNil','systemanswertime','now','linkedid','destinationchannel','answertime','toNumber','error','calleridname','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','transfereechannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','variable','xmd-originatecalleridnum','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue'];(function(_0x24b55f,_0x2d9432){var _0x489e82=function(_0x586141){while(--_0x586141){_0x24b55f['push'](_0x24b55f['shift']());}};_0x489e82(++_0x2d9432);}(_0xb417,0x11d));var _0x7b41=function(_0x2c830d,_0x1f9b85){_0x2c830d=_0x2c830d-0x0;var _0x1adc02=_0xb417[_0x2c830d];return _0x1adc02;};'use strict';var _=require(_0x7b41('0x0'));var util=require(_0x7b41('0x1'));var utils=require(_0x7b41('0x2'));var dispositions=[_0x7b41('0x3'),_0x7b41('0x4'),_0x7b41('0x4'),_0x7b41('0x3'),_0x7b41('0x3'),'NO\x20ANSWER',_0x7b41('0x5'),_0x7b41('0x6'),'FAILED',_0x7b41('0x4'),_0x7b41('0x4')];var channels={};function writeDB(_0x4c69c6){utils[_0x7b41('0x7')](util[_0x7b41('0x8')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x4c69c6[_0x7b41('0x9')],_0x4c69c6[_0x7b41('0xa')],_0x4c69c6[_0x7b41('0xb')],_0x4c69c6[_0x7b41('0xc')],_0x4c69c6[_0x7b41('0xd')],_0x4c69c6[_0x7b41('0xe')],_0x4c69c6[_0x7b41('0xf')],_0x4c69c6[_0x7b41('0x10')]));if(_0x4c69c6[_0x7b41('0xc')]){utils[_0x7b41('0x11')](_0x4c69c6['accountcode'])[_0x7b41('0x12')](function(_0x7940e6){if(_0x7940e6){_0x4c69c6[_0x7b41('0x13')]=_0x7940e6['id'];}utils[_0x7b41('0x14')](_0x7b41('0x15'),_0x4c69c6);});}else{utils[_0x7b41('0x14')]('CreateVoiceCallReport',_0x4c69c6);}if(channels[_0x4c69c6[_0x7b41('0x9')]]){delete channels[_0x4c69c6[_0x7b41('0x9')]];}}exports['newchannel']=function(_0x266cfa){try{if(_0x266cfa['uniqueid']==_0x266cfa['linkedid']&&_0x266cfa[_0x7b41('0xa')]!=_0x7b41('0x16')){channels[_0x266cfa['uniqueid']]={'uniqueid':_0x266cfa[_0x7b41('0x9')],'accountcode':_0x266cfa[_0x7b41('0xc')],'source':_0x266cfa[_0x7b41('0x17')],'destination':_0x266cfa[_0x7b41('0x18')],'destinationcontext':_0x266cfa[_0x7b41('0x19')],'channel':_0x266cfa[_0x7b41('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7b41('0x3'),'amaflags':_0x7b41('0x1a')};}}catch(_0x2aa22e){utils['error'](_0x2aa22e['stack']);}};exports[_0x7b41('0x1b')]=function(_0x193489){try{if(!_['isNil'](channels[_0x193489[_0x7b41('0x9')]])&&_0x193489[_0x7b41('0x1c')]==0x6){if(_[_0x7b41('0x1d')](channels[_0x193489[_0x7b41('0x9')]]['systemanswertime'])){channels[_0x193489[_0x7b41('0x9')]][_0x7b41('0x1e')]=utils[_0x7b41('0x1f')]();}}else if(!_[_0x7b41('0x1d')](channels[_0x193489[_0x7b41('0x20')]])&&_0x193489[_0x7b41('0x1c')]==0x6&&_0x193489[_0x7b41('0x19')]!='transfer'){channels[_0x193489[_0x7b41('0x20')]][_0x7b41('0xc')]=_0x193489[_0x7b41('0xc')];channels[_0x193489['linkedid']][_0x7b41('0x21')]=_0x193489[_0x7b41('0xa')];if(_[_0x7b41('0x1d')](channels[_0x193489[_0x7b41('0x20')]][_0x7b41('0x22')])){channels[_0x193489[_0x7b41('0x20')]][_0x7b41('0x22')]=utils['now']();}channels[_0x193489[_0x7b41('0x20')]]['disposition']=dispositions[_[_0x7b41('0x23')](_0x193489[_0x7b41('0x1c')])]||'ANSWERED';}}catch(_0x4e0bbf){utils[_0x7b41('0x24')](_0x4e0bbf['stack']);}};exports['hangup']=function(_0x472068){try{if(!_[_0x7b41('0x1d')](channels[_0x472068['uniqueid']])){if(_['isNil'](channels[_0x472068[_0x7b41('0x9')]][_0x7b41('0xf')])){channels[_0x472068[_0x7b41('0x9')]][_0x7b41('0xf')]=_0x472068[_0x7b41('0x25')]+'\x20<'+_0x472068['calleridnum']+'>';}channels[_0x472068[_0x7b41('0x9')]][_0x7b41('0x26')]=utils['now']();channels[_0x472068[_0x7b41('0x9')]][_0x7b41('0x27')]=utils[_0x7b41('0x28')](channels[_0x472068[_0x7b41('0x9')]][_0x7b41('0x26')],channels[_0x472068[_0x7b41('0x9')]][_0x7b41('0x29')]);channels[_0x472068[_0x7b41('0x9')]][_0x7b41('0x2a')]=channels[_0x472068[_0x7b41('0x9')]][_0x7b41('0x22')]?utils['diffTime'](channels[_0x472068[_0x7b41('0x9')]]['endtime'],channels[_0x472068[_0x7b41('0x9')]]['answertime']):0x0;writeDB(channels[_0x472068[_0x7b41('0x9')]]);}}catch(_0x557bd1){utils[_0x7b41('0x24')](_0x557bd1['stack']);}};exports['attendedtransfer']=function(_0x43553f){try{if(!_['isNil'](channels[_0x43553f[_0x7b41('0x2b')]])){if(channels[_0x43553f[_0x7b41('0x2b')]][_0x7b41('0xa')]==_0x43553f[_0x7b41('0x2c')]){channels[_0x43553f[_0x7b41('0x2b')]][_0x7b41('0x21')]=_0x43553f[_0x7b41('0x2d')];channels[_0x43553f[_0x7b41('0x2b')]]['userfield']=_0x7b41('0x2e');}else if(channels[_0x43553f[_0x7b41('0x2b')]][_0x7b41('0xa')]=_0x43553f[_0x7b41('0x2f')]){channels[_0x43553f[_0x7b41('0x2b')]][_0x7b41('0x21')]=_0x43553f[_0x7b41('0x30')];channels[_0x43553f['localtwolinkedid']][_0x7b41('0x31')]=_0x7b41('0x2e');}}}catch(_0x205cb5){utils[_0x7b41('0x24')](_0x205cb5[_0x7b41('0x32')]);}};exports[_0x7b41('0x33')]=function(_0x17e054){try{if(!_[_0x7b41('0x1d')](channels[_0x17e054['uniqueid']])){channels[_0x17e054[_0x7b41('0x9')]][_0x7b41('0x34')]=utils['now']();}}catch(_0x3ddc1c){utils[_0x7b41('0x24')](_0x3ddc1c['stack']);}};exports[_0x7b41('0x35')]=function(_0x26adc9){try{if(!_[_0x7b41('0x1d')](channels[_0x26adc9[_0x7b41('0x9')]])){if(!_['isNil'](channels[_0x26adc9[_0x7b41('0x9')]][_0x7b41('0x34')])){channels[_0x26adc9[_0x7b41('0x9')]][_0x7b41('0x36')]+=utils[_0x7b41('0x28')](utils[_0x7b41('0x1f')](),channels[_0x26adc9['uniqueid']][_0x7b41('0x34')]);delete channels[_0x26adc9[_0x7b41('0x9')]][_0x7b41('0x34')];}}}catch(_0x5887fd){utils[_0x7b41('0x24')](_0x5887fd['stack']);}};exports[_0x7b41('0x37')]=function(_0xa8c6a1){try{if(!_[_0x7b41('0x1d')](channels[_0xa8c6a1[_0x7b41('0x9')]])){if(!_['isNil'](_0xa8c6a1[_0x7b41('0x38')][_0x7b41('0x39')])){channels[_0xa8c6a1[_0x7b41('0x9')]][_0x7b41('0xd')]=_0xa8c6a1[_0x7b41('0x3a')];}if(!_[_0x7b41('0x1d')](_0xa8c6a1['variable']['xmd-phone'])){channels[_0xa8c6a1[_0x7b41('0x9')]]['destination']=_0xa8c6a1[_0x7b41('0x3a')];channels[_0xa8c6a1['uniqueid']][_0x7b41('0xf')]='\x22'+_0xa8c6a1[_0x7b41('0x3a')]+_0x7b41('0x3b')+_0xa8c6a1[_0x7b41('0x3a')]+'>';}if(!_[_0x7b41('0x1d')](_0xa8c6a1[_0x7b41('0x38')][_0x7b41('0x3c')])||!_[_0x7b41('0x1d')](_0xa8c6a1[_0x7b41('0x38')][_0x7b41('0x3d')])){channels[_0xa8c6a1[_0x7b41('0x9')]][_0x7b41('0xf')]=_0xa8c6a1['value'];}if(!_[_0x7b41('0x1d')](_0xa8c6a1[_0x7b41('0x38')][_0x7b41('0x3e')])||!_[_0x7b41('0x1d')](_0xa8c6a1[_0x7b41('0x38')][_0x7b41('0x3f')])){channels[_0xa8c6a1[_0x7b41('0x9')]][_0x7b41('0x40')]=_0x7b41('0x41');channels[_0xa8c6a1[_0x7b41('0x9')]][_0x7b41('0x42')]=_0xa8c6a1['value'];channels[_0xa8c6a1[_0x7b41('0x9')]][_0x7b41('0x43')]=!![];}if(!_['isNil'](_0xa8c6a1[_0x7b41('0x38')][_0x7b41('0x44')])){channels[_0xa8c6a1[_0x7b41('0x9')]][_0x7b41('0x45')]=_0xa8c6a1[_0x7b41('0x3a')];}if(!_[_0x7b41('0x1d')](_0xa8c6a1[_0x7b41('0x38')][_0x7b41('0x46')])){channels[_0xa8c6a1['uniqueid']][_0x7b41('0xb')]=_0xa8c6a1['value'];}if(!_['isNil'](_0xa8c6a1['variable'][_0x7b41('0x47')])){channels[_0xa8c6a1[_0x7b41('0x9')]]['routeid']=_0xa8c6a1[_0x7b41('0x3a')];}if(!_[_0x7b41('0x1d')](_0xa8c6a1['variable'][_0x7b41('0x48')])){channels[_0xa8c6a1['uniqueid']][_0x7b41('0x48')]=_0xa8c6a1[_0x7b41('0x3a')];}}}catch(_0x4c0701){utils[_0x7b41('0x24')](_0x4c0701[_0x7b41('0x32')]);}};exports[_0x7b41('0x49')]=function(_0x3ce12f){try{if(!_[_0x7b41('0x1d')](channels[_0x3ce12f[_0x7b41('0x9')]])){if(_0x3ce12f[_0x7b41('0x4a')]['toLowerCase']()==_0x7b41('0x4b')&&_['startsWith'](_0x3ce12f[_0x7b41('0x4c')][_0x7b41('0x4d')](),_0x7b41('0x4e'))){var _0x3c0e7c=_0x3ce12f[_0x7b41('0x4c')][_0x7b41('0x4f')]('=');var _0xf05ff1=_0x3c0e7c[0x0][_0x7b41('0x50')](_0x3c0e7c[0x0][_0x7b41('0x51')]('(')+0x1,_0x3c0e7c[0x0][_0x7b41('0x51')](')'));var _0x30a947=_0x3c0e7c[0x1];channels[_0x3ce12f['uniqueid']][_0xf05ff1]=_0x30a947;}if(!_[_0x7b41('0x52')]([_0x7b41('0x53'),_0x7b41('0x54'),_0x7b41('0x55'),_0x7b41('0x4b'),_0x7b41('0x56')],_0x3ce12f[_0x7b41('0x4a')]['toLowerCase']())){channels[_0x3ce12f[_0x7b41('0x9')]][_0x7b41('0x40')]=_0x3ce12f['application'];channels[_0x3ce12f[_0x7b41('0x9')]][_0x7b41('0x42')]=_0x3ce12f[_0x7b41('0x4c')];}}}catch(_0x3ffcb1){utils['error'](_0x3ffcb1[_0x7b41('0x32')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d8d9093..f52a92f 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 _0xb4c7=['connect','info','CONNECTED','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','./utils','lodash'];(function(_0x11fbb7,_0x51b3e5){var _0x5d52c7=function(_0x164f1c){while(--_0x164f1c){_0x11fbb7['push'](_0x11fbb7['shift']());}};_0x5d52c7(++_0x51b3e5);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1b5a30,_0x5991a7){_0x1b5a30=_0x1b5a30-0x0;var _0x53936a=_0xb4c7[_0x1b5a30];return _0x53936a;};'use strict';var utils=require(_0x7b4c('0x0'));var _=require(_0x7b4c('0x1'));exports[_0x7b4c('0x2')]=function(){utils[_0x7b4c('0x3')](_0x7b4c('0x4'));};exports['shutdown']=function(){utils[_0x7b4c('0x3')](_0x7b4c('0x5'));};exports[_0x7b4c('0x6')]=function(){utils[_0x7b4c('0x3')](_0x7b4c('0x7'));};exports['error']=function(_0x1b0f57){utils[_0x7b4c('0x8')](_0x1b0f57);};exports[_0x7b4c('0x9')]=function(){utils['info'](_0x7b4c('0xa'));};exports[_0x7b4c('0xb')]=function(_0x570daa){}; \ No newline at end of file +var _0x741c=['lodash','connect','info','CONNECTED','shutdown','fullybooted','FULLYBOOTED','error','close','CLOSE','./utils'];(function(_0xeaab61,_0xacb028){var _0x3ff9b3=function(_0x550c43){while(--_0x550c43){_0xeaab61['push'](_0xeaab61['shift']());}};_0x3ff9b3(++_0xacb028);}(_0x741c,0x196));var _0xc741=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x741c[_0x40a045];return _0x1a687c;};'use strict';var utils=require(_0xc741('0x0'));var _=require(_0xc741('0x1'));exports[_0xc741('0x2')]=function(){utils[_0xc741('0x3')](_0xc741('0x4'));};exports[_0xc741('0x5')]=function(){utils['info']('SHUTDOWN');};exports[_0xc741('0x6')]=function(){utils['info'](_0xc741('0x7'));};exports[_0xc741('0x8')]=function(_0x3708ae){utils[_0xc741('0x8')](_0x3708ae);};exports[_0xc741('0x9')]=function(){utils[_0xc741('0x3')](_0xc741('0xa'));};exports['managerevent']=function(_0x1ad6d9){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 014b069..7efefe6 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 _0x6f88=['variable','outboundrouteid','dialbegin','assign','starttime','now','lastevent','connect','hangup','complete','diffTime','endtime','billableseconds','answertime','util','info','format','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','stack','varset','isNil'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x6f88,0x96));var _0x86f8=function(_0x20f322,_0x26c8dc){_0x20f322=_0x20f322-0x0;var _0x5661b4=_0x6f88[_0x20f322];return _0x5661b4;};'use strict';var _=require('lodash');var util=require(_0x86f8('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x381b06){utils[_0x86f8('0x1')](util[_0x86f8('0x2')]('DIAL|%s|%s|%s|%s|%s|%s',_0x381b06[_0x86f8('0x3')],_0x381b06[_0x86f8('0x4')],_0x381b06[_0x86f8('0x5')],_0x381b06['calleridnum'],_0x381b06[_0x86f8('0x6')],_0x381b06[_0x86f8('0x7')]));utils[_0x86f8('0x8')](_0x86f8('0x9'),_0x381b06);delete dials[_0x381b06[_0x86f8('0x3')]];}exports['newexten']=function(_0x3eff95){try{if(_0x3eff95[_0x86f8('0xa')][_0x86f8('0xb')]()==_0x86f8('0xc')&&_[_0x86f8('0xd')](_0x3eff95[_0x86f8('0xe')][_0x86f8('0xb')](),_0x86f8('0xf'))){var _0x2e4c8c=_0x3eff95[_0x86f8('0xe')]['split']('=');dials[_0x3eff95['uniqueid']]={'routeId':_0x2e4c8c[0x1]};}}catch(_0x21baba){utils[_0x86f8('0x10')](_0x21baba[_0x86f8('0x11')]);}};exports[_0x86f8('0x12')]=function(_0x4e5a20){try{if(!_[_0x86f8('0x13')](_0x4e5a20[_0x86f8('0x14')][_0x86f8('0x15')])){dials[_0x4e5a20[_0x86f8('0x3')]]={'routeId':_0x4e5a20['value']};}}catch(_0x2a5da5){utils['error'](_0x2a5da5[_0x86f8('0x11')]);}};exports[_0x86f8('0x16')]=function(_0x2d3d45){try{if(!_[_0x86f8('0x13')](dials[_0x2d3d45[_0x86f8('0x3')]])){dials[_0x2d3d45[_0x86f8('0x3')]]=_[_0x86f8('0x17')](dials[_0x2d3d45[_0x86f8('0x3')]],_0x2d3d45);dials[_0x2d3d45[_0x86f8('0x3')]][_0x86f8('0x18')]=utils[_0x86f8('0x19')]();dials[_0x2d3d45[_0x86f8('0x3')]]['lastevent']='called';}}catch(_0xa8400c){utils[_0x86f8('0x10')](_0xa8400c['stack']);}};exports['dialend']=function(_0x14a741){try{if(!_[_0x86f8('0x13')](dials[_0x14a741[_0x86f8('0x3')]])){dials[_0x14a741[_0x86f8('0x3')]][_0x86f8('0x7')]=_0x14a741[_0x86f8('0x7')];if(_0x14a741[_0x86f8('0x7')]=='ANSWER'){dials[_0x14a741[_0x86f8('0x3')]]=_['assign'](dials[_0x14a741[_0x86f8('0x3')]],_0x14a741);dials[_0x14a741[_0x86f8('0x3')]]['answertime']=utils[_0x86f8('0x19')]();dials[_0x14a741[_0x86f8('0x3')]][_0x86f8('0x1a')]=_0x86f8('0x1b');}}}catch(_0x4a4e36){utils[_0x86f8('0x10')](_0x4a4e36[_0x86f8('0x11')]);}};exports[_0x86f8('0x1c')]=function(_0x592bd2){try{if(!_[_0x86f8('0x13')](dials[_0x592bd2[_0x86f8('0x3')]])){dials[_0x592bd2[_0x86f8('0x3')]]=_[_0x86f8('0x17')](dials[_0x592bd2['uniqueid']],{'endtime':utils[_0x86f8('0x19')](),'lastevent':_0x86f8('0x1d')});dials[_0x592bd2['uniqueid']]['duration']=utils[_0x86f8('0x1e')](dials[_0x592bd2[_0x86f8('0x3')]][_0x86f8('0x1f')],dials[_0x592bd2[_0x86f8('0x3')]][_0x86f8('0x18')]);dials[_0x592bd2[_0x86f8('0x3')]]['holdtime']=utils[_0x86f8('0x1e')](dials[_0x592bd2[_0x86f8('0x3')]]['answertime']||dials[_0x592bd2['uniqueid']][_0x86f8('0x1f')],dials[_0x592bd2[_0x86f8('0x3')]]['starttime']);dials[_0x592bd2[_0x86f8('0x3')]][_0x86f8('0x20')]=dials[_0x592bd2[_0x86f8('0x3')]][_0x86f8('0x21')]?utils[_0x86f8('0x1e')](dials[_0x592bd2[_0x86f8('0x3')]][_0x86f8('0x1f')],dials[_0x592bd2[_0x86f8('0x3')]][_0x86f8('0x21')]):0x0;writeDB(dials[_0x592bd2[_0x86f8('0x3')]]);}}catch(_0x440b47){utils[_0x86f8('0x10')](_0x440b47[_0x86f8('0x11')]);}}; \ No newline at end of file +var _0xc540=['uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','stack','varset','isNil','variable','outboundrouteid','error','starttime','now','lastevent','called','dialend','ANSWER','assign','connect','hangup','complete','duration','diffTime','endtime','holdtime','answertime','billableseconds','format','DIAL|%s|%s|%s|%s|%s|%s'];(function(_0x32ad38,_0x199916){var _0x518e14=function(_0x508b49){while(--_0x508b49){_0x32ad38['push'](_0x32ad38['shift']());}};_0x518e14(++_0x199916);}(_0xc540,0x184));var _0x0c54=function(_0x53b57d,_0xde9609){_0x53b57d=_0x53b57d-0x0;var _0x106f76=_0xc540[_0x53b57d];return _0x106f76;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x352f45){utils['info'](util[_0x0c54('0x0')](_0x0c54('0x1'),_0x352f45[_0x0c54('0x2')],_0x352f45[_0x0c54('0x3')],_0x352f45[_0x0c54('0x4')],_0x352f45['calleridnum'],_0x352f45[_0x0c54('0x5')],_0x352f45[_0x0c54('0x6')]));utils[_0x0c54('0x7')](_0x0c54('0x8'),_0x352f45);delete dials[_0x352f45[_0x0c54('0x2')]];}exports[_0x0c54('0x9')]=function(_0x4067ac){try{if(_0x4067ac[_0x0c54('0xa')][_0x0c54('0xb')]()==_0x0c54('0xc')&&_[_0x0c54('0xd')](_0x4067ac[_0x0c54('0xe')]['toLowerCase'](),_0x0c54('0xf'))){var _0x4fd69a=_0x4067ac[_0x0c54('0xe')][_0x0c54('0x10')]('=');dials[_0x4067ac[_0x0c54('0x2')]]={'routeId':_0x4fd69a[0x1]};}}catch(_0x4884f9){utils['error'](_0x4884f9[_0x0c54('0x11')]);}};exports[_0x0c54('0x12')]=function(_0x186dde){try{if(!_[_0x0c54('0x13')](_0x186dde[_0x0c54('0x14')][_0x0c54('0x15')])){dials[_0x186dde['uniqueid']]={'routeId':_0x186dde['value']};}}catch(_0x42ab12){utils[_0x0c54('0x16')](_0x42ab12['stack']);}};exports['dialbegin']=function(_0x23d370){try{if(!_[_0x0c54('0x13')](dials[_0x23d370[_0x0c54('0x2')]])){dials[_0x23d370[_0x0c54('0x2')]]=_['assign'](dials[_0x23d370[_0x0c54('0x2')]],_0x23d370);dials[_0x23d370['uniqueid']][_0x0c54('0x17')]=utils[_0x0c54('0x18')]();dials[_0x23d370['uniqueid']][_0x0c54('0x19')]=_0x0c54('0x1a');}}catch(_0x3d18b9){utils['error'](_0x3d18b9[_0x0c54('0x11')]);}};exports[_0x0c54('0x1b')]=function(_0x5e18c0){try{if(!_[_0x0c54('0x13')](dials[_0x5e18c0[_0x0c54('0x2')]])){dials[_0x5e18c0[_0x0c54('0x2')]][_0x0c54('0x6')]=_0x5e18c0['dialstatus'];if(_0x5e18c0['dialstatus']==_0x0c54('0x1c')){dials[_0x5e18c0[_0x0c54('0x2')]]=_[_0x0c54('0x1d')](dials[_0x5e18c0['uniqueid']],_0x5e18c0);dials[_0x5e18c0['uniqueid']]['answertime']=utils[_0x0c54('0x18')]();dials[_0x5e18c0[_0x0c54('0x2')]][_0x0c54('0x19')]=_0x0c54('0x1e');}}}catch(_0x5765f9){utils[_0x0c54('0x16')](_0x5765f9[_0x0c54('0x11')]);}};exports[_0x0c54('0x1f')]=function(_0x4448f5){try{if(!_['isNil'](dials[_0x4448f5[_0x0c54('0x2')]])){dials[_0x4448f5[_0x0c54('0x2')]]=_[_0x0c54('0x1d')](dials[_0x4448f5[_0x0c54('0x2')]],{'endtime':utils[_0x0c54('0x18')](),'lastevent':_0x0c54('0x20')});dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x21')]=utils[_0x0c54('0x22')](dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x23')],dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x17')]);dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x24')]=utils[_0x0c54('0x22')](dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x25')]||dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x23')],dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x17')]);dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x26')]=dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x25')]?utils[_0x0c54('0x22')](dials[_0x4448f5[_0x0c54('0x2')]]['endtime'],dials[_0x4448f5[_0x0c54('0x2')]][_0x0c54('0x25')]):0x0;writeDB(dials[_0x4448f5[_0x0c54('0x2')]]);}}catch(_0x4e3924){utils[_0x0c54('0x16')](_0x4e3924[_0x0c54('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6ba4943..9b5633c 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 _0xe7c8=['agentcomplete','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','asterisk','password','keepConnected','xdr','info','./agents.controller','./calls.controller','./members.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect'];(function(_0x305a95,_0x3b5db7){var _0xdcebf3=function(_0x2296ea){while(--_0x2296ea){_0x305a95['push'](_0x305a95['shift']());}};_0xdcebf3(++_0x3b5db7);}(_0xe7c8,0x153));var _0x8e7c=function(_0x6e44a,_0x59d32e){_0x6e44a=_0x6e44a-0x0;var _0x60a105=_0xe7c8[_0x6e44a];return _0x60a105;};var AsteriskManager=require('asterisk-manager');var config=require(_0x8e7c('0x0'));var utils=require(_0x8e7c('0x1'));var ami=new AsteriskManager(config[_0x8e7c('0x2')]['port'],config[_0x8e7c('0x2')]['ip'],config['asterisk']['username'],config[_0x8e7c('0x2')][_0x8e7c('0x3')],!![]);ami[_0x8e7c('0x4')]();if(config[_0x8e7c('0x5')]&&config[_0x8e7c('0x5')]['disabled']){utils[_0x8e7c('0x6')]('XDR\x20DISABLED');}else{var agents=require(_0x8e7c('0x7'));var calls=require(_0x8e7c('0x8'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x8e7c('0x9'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x8e7c('0xa'));ami['on'](_0x8e7c('0xb'),core['connect']);ami['on'](_0x8e7c('0xc'),core['shutdown']);ami['on'](_0x8e7c('0xd'),core['fullybooted']);ami['on']('error',core[_0x8e7c('0xe')]);ami['on'](_0x8e7c('0xf'),core['close']);ami['on']('managerevent',core[_0x8e7c('0x10')]);ami['on'](_0x8e7c('0x11'),function(_0x532414){try{members['devicestatechange'](_0x532414);}catch(_0xdc7083){utils[_0x8e7c('0xe')](_0xdc7083);}});ami['on'](_0x8e7c('0x12'),function(_0x27ae75){try{agents[_0x8e7c('0x12')](_0x27ae75);}catch(_0x5e6cc1){utils['error'](_0x5e6cc1);}});ami['on'](_0x8e7c('0x13'),function(_0x358e17){try{agents[_0x8e7c('0x13')](_0x358e17);}catch(_0x59b032){utils[_0x8e7c('0xe')](_0x59b032);}});ami['on'](_0x8e7c('0x14'),function(_0x4655e4){try{agents[_0x8e7c('0x14')](_0x4655e4);queues['agentconnect'](_0x4655e4);}catch(_0x4e03c8){utils[_0x8e7c('0xe')](_0x4e03c8);}});ami['on']('agentcomplete',function(_0xfde131){try{agents['agentcomplete'](_0xfde131);queues[_0x8e7c('0x15')](_0xfde131);members[_0x8e7c('0x15')](_0xfde131);}catch(_0x84f3df){utils[_0x8e7c('0xe')](_0x84f3df);}});ami['on']('queuecallerabandon',function(_0x3b7f0c){try{agents['queuecallerabandon'](_0x3b7f0c);queues['queuecallerabandon'](_0x3b7f0c);}catch(_0x2a4cd2){utils[_0x8e7c('0xe')](_0x2a4cd2);}});ami['on'](_0x8e7c('0x16'),function(_0x56d340){try{queues[_0x8e7c('0x16')](_0x56d340);recordings[_0x8e7c('0x16')](_0x56d340);}catch(_0x46a39e){utils[_0x8e7c('0xe')](_0x46a39e);}});ami['on'](_0x8e7c('0x17'),function(_0x59243e){try{queues[_0x8e7c('0x17')](_0x59243e);}catch(_0x151902){utils[_0x8e7c('0xe')](_0x151902);}});ami['on'](_0x8e7c('0x18'),function(_0x3800cf){try{queues[_0x8e7c('0x18')](_0x3800cf);calls[_0x8e7c('0x18')](_0x3800cf);}catch(_0x34c4f7){utils[_0x8e7c('0xe')](_0x34c4f7);}});ami['on'](_0x8e7c('0x19'),function(_0x376424){try{queues['musiconholdstop'](_0x376424);calls[_0x8e7c('0x19')](_0x376424);}catch(_0x46a81a){utils[_0x8e7c('0xe')](_0x46a81a);}});ami['on'](_0x8e7c('0x1a'),function(_0x263f2b){try{calls[_0x8e7c('0x1a')](_0x263f2b);recordings[_0x8e7c('0x1a')](_0x263f2b);}catch(_0x1dfce5){utils[_0x8e7c('0xe')](_0x1dfce5);}});ami['on'](_0x8e7c('0x1b'),function(_0x3f2c3e){try{calls[_0x8e7c('0x1b')](_0x3f2c3e);recordings[_0x8e7c('0x1b')](_0x3f2c3e);dials[_0x8e7c('0x1b')](_0x3f2c3e);agents[_0x8e7c('0x1b')](_0x3f2c3e);queues['hangup'](_0x3f2c3e);}catch(_0x221d5f){utils[_0x8e7c('0xe')](_0x221d5f);}});ami['on']('cdr',function(_0xda46f7){try{members[_0x8e7c('0x1c')](_0xda46f7);}catch(_0x59c535){utils[_0x8e7c('0xe')](_0x59c535);}});ami['on'](_0x8e7c('0x1d'),function(_0x67f5c3){try{queues[_0x8e7c('0x1d')](_0x67f5c3);agents[_0x8e7c('0x1d')](_0x67f5c3);transfers['blindtransfer'](_0x67f5c3);}catch(_0x3cd818){utils[_0x8e7c('0xe')](_0x3cd818);}});ami['on'](_0x8e7c('0x1e'),function(_0x39a5a3){try{queues[_0x8e7c('0x1e')](_0x39a5a3);transfers['attendedtransfer'](_0x39a5a3);agents[_0x8e7c('0x1e')](_0x39a5a3);calls[_0x8e7c('0x1e')](_0x39a5a3);}catch(_0x37b567){utils[_0x8e7c('0xe')](_0x37b567);}});ami['on'](_0x8e7c('0x1f'),function(_0x66ee25){try{queues[_0x8e7c('0x1f')](_0x66ee25);recordings[_0x8e7c('0x1f')](_0x66ee25);calls[_0x8e7c('0x1f')](_0x66ee25);dials[_0x8e7c('0x1f')](_0x66ee25);}catch(_0x571831){utils[_0x8e7c('0xe')](_0x571831);}});ami['on'](_0x8e7c('0x20'),function(_0x313fc6){try{calls[_0x8e7c('0x20')](_0x313fc6);recordings[_0x8e7c('0x20')](_0x313fc6);dials[_0x8e7c('0x20')](_0x313fc6);}catch(_0x4c6628){utils['error'](_0x4c6628);}});ami['on']('newchannel',function(_0x51f402){try{calls[_0x8e7c('0x21')](_0x51f402);recordings[_0x8e7c('0x21')](_0x51f402);}catch(_0x22935b){utils[_0x8e7c('0xe')](_0x22935b);}});ami['on'](_0x8e7c('0x22'),function(_0x208c2e){try{dials[_0x8e7c('0x22')](_0x208c2e);}catch(_0x3f61a8){utils[_0x8e7c('0xe')](_0x3f61a8);}});ami['on'](_0x8e7c('0x23'),function(_0x9ad246){try{dials[_0x8e7c('0x23')](_0x9ad246);}catch(_0xb45881){utils['error'](_0xb45881);}});} \ No newline at end of file +var _0x1016=['keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','asterisk','port'];(function(_0x467ef6,_0x932cef){var _0x3e4aa2=function(_0xb56bb5){while(--_0xb56bb5){_0x467ef6['push'](_0x467ef6['shift']());}};_0x3e4aa2(++_0x932cef);}(_0x1016,0x1bf));var _0x6101=function(_0x191fa4,_0x20805b){_0x191fa4=_0x191fa4-0x0;var _0x2d70d1=_0x1016[_0x191fa4];return _0x2d70d1;};var AsteriskManager=require('asterisk-manager');var config=require(_0x6101('0x0'));var utils=require(_0x6101('0x1'));var ami=new AsteriskManager(config[_0x6101('0x2')][_0x6101('0x3')],config[_0x6101('0x2')]['ip'],config[_0x6101('0x2')]['username'],config[_0x6101('0x2')]['password'],!![]);ami[_0x6101('0x4')]();if(config[_0x6101('0x5')]&&config[_0x6101('0x5')][_0x6101('0x6')]){utils['info'](_0x6101('0x7'));}else{var agents=require(_0x6101('0x8'));var calls=require(_0x6101('0x9'));var queues=require(_0x6101('0xa'));var recordings=require(_0x6101('0xb'));var members=require(_0x6101('0xc'));var dials=require('./dials.controller');var transfers=require(_0x6101('0xd'));var core=require(_0x6101('0xe'));ami['on'](_0x6101('0xf'),core['connect']);ami['on'](_0x6101('0x10'),core[_0x6101('0x10')]);ami['on'](_0x6101('0x11'),core[_0x6101('0x11')]);ami['on'](_0x6101('0x12'),core[_0x6101('0x12')]);ami['on']('close',core[_0x6101('0x13')]);ami['on'](_0x6101('0x14'),core[_0x6101('0x14')]);ami['on'](_0x6101('0x15'),function(_0xf2ff05){try{members[_0x6101('0x15')](_0xf2ff05);}catch(_0x3b0652){utils[_0x6101('0x12')](_0x3b0652);}});ami['on'](_0x6101('0x16'),function(_0x2c6e50){try{agents[_0x6101('0x16')](_0x2c6e50);}catch(_0x2209e4){utils[_0x6101('0x12')](_0x2209e4);}});ami['on'](_0x6101('0x17'),function(_0x4456f2){try{agents[_0x6101('0x17')](_0x4456f2);}catch(_0x1a5fde){utils[_0x6101('0x12')](_0x1a5fde);}});ami['on']('agentconnect',function(_0x379d3c){try{agents[_0x6101('0x18')](_0x379d3c);queues[_0x6101('0x18')](_0x379d3c);}catch(_0x5b613d){utils[_0x6101('0x12')](_0x5b613d);}});ami['on'](_0x6101('0x19'),function(_0xcb7569){try{agents[_0x6101('0x19')](_0xcb7569);queues[_0x6101('0x19')](_0xcb7569);members[_0x6101('0x19')](_0xcb7569);}catch(_0x1603b2){utils['error'](_0x1603b2);}});ami['on'](_0x6101('0x1a'),function(_0x59621d){try{agents[_0x6101('0x1a')](_0x59621d);queues[_0x6101('0x1a')](_0x59621d);}catch(_0xdb6505){utils[_0x6101('0x12')](_0xdb6505);}});ami['on'](_0x6101('0x1b'),function(_0x7e9182){try{queues[_0x6101('0x1b')](_0x7e9182);recordings[_0x6101('0x1b')](_0x7e9182);}catch(_0x242ae0){utils[_0x6101('0x12')](_0x242ae0);}});ami['on'](_0x6101('0x1c'),function(_0x37822f){try{queues[_0x6101('0x1c')](_0x37822f);}catch(_0x1881aa){utils[_0x6101('0x12')](_0x1881aa);}});ami['on']('musiconholdstart',function(_0x173017){try{queues[_0x6101('0x1d')](_0x173017);calls[_0x6101('0x1d')](_0x173017);}catch(_0x3db975){utils['error'](_0x3db975);}});ami['on'](_0x6101('0x1e'),function(_0x18628a){try{queues['musiconholdstop'](_0x18628a);calls['musiconholdstop'](_0x18628a);}catch(_0x213ea3){utils[_0x6101('0x12')](_0x213ea3);}});ami['on'](_0x6101('0x1f'),function(_0x73fe9){try{calls[_0x6101('0x1f')](_0x73fe9);recordings[_0x6101('0x1f')](_0x73fe9);}catch(_0x12d9a1){utils[_0x6101('0x12')](_0x12d9a1);}});ami['on'](_0x6101('0x20'),function(_0x112473){try{calls[_0x6101('0x20')](_0x112473);recordings[_0x6101('0x20')](_0x112473);dials['hangup'](_0x112473);agents[_0x6101('0x20')](_0x112473);queues[_0x6101('0x20')](_0x112473);}catch(_0x178f5a){utils[_0x6101('0x12')](_0x178f5a);}});ami['on'](_0x6101('0x21'),function(_0x1ab368){try{members[_0x6101('0x21')](_0x1ab368);}catch(_0x25b7a3){utils[_0x6101('0x12')](_0x25b7a3);}});ami['on']('blindtransfer',function(_0xb79dc0){try{queues[_0x6101('0x22')](_0xb79dc0);agents[_0x6101('0x22')](_0xb79dc0);transfers['blindtransfer'](_0xb79dc0);}catch(_0x548e75){utils[_0x6101('0x12')](_0x548e75);}});ami['on']('attendedtransfer',function(_0x622fc1){try{queues[_0x6101('0x23')](_0x622fc1);transfers[_0x6101('0x23')](_0x622fc1);agents[_0x6101('0x23')](_0x622fc1);calls[_0x6101('0x23')](_0x622fc1);}catch(_0x45355c){utils[_0x6101('0x12')](_0x45355c);}});ami['on'](_0x6101('0x24'),function(_0x483e67){try{queues['varset'](_0x483e67);recordings['varset'](_0x483e67);calls['varset'](_0x483e67);dials[_0x6101('0x24')](_0x483e67);}catch(_0x5e0406){utils[_0x6101('0x12')](_0x5e0406);}});ami['on']('newexten',function(_0x3f54c6){try{calls[_0x6101('0x25')](_0x3f54c6);recordings[_0x6101('0x25')](_0x3f54c6);dials[_0x6101('0x25')](_0x3f54c6);}catch(_0x3e0a5e){utils['error'](_0x3e0a5e);}});ami['on'](_0x6101('0x26'),function(_0x4e1d14){try{calls[_0x6101('0x26')](_0x4e1d14);recordings['newchannel'](_0x4e1d14);}catch(_0x4c918c){utils[_0x6101('0x12')](_0x4c918c);}});ami['on'](_0x6101('0x27'),function(_0x5325f9){try{dials['dialbegin'](_0x5325f9);}catch(_0x31c021){utils['error'](_0x31c021);}});ami['on'](_0x6101('0x28'),function(_0x4e4c17){try{dials[_0x6101('0x28')](_0x4e4c17);}catch(_0x371933){utils[_0x6101('0x12')](_0x371933);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 7233582..8581f3d 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 _0xdc5f=['Queue:','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','some','startsWith','devicestatechange','state','INUSE','BUSY','device','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','agentcomplete','assign','cdr','data1','data3','lodash','./utils','Local/_attended@transfer'];(function(_0x240eee,_0x249118){var _0x411632=function(_0x99d99f){while(--_0x99d99f){_0x240eee['push'](_0x240eee['shift']());}};_0x411632(++_0x249118);}(_0xdc5f,0x9d));var _0xfdc5=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xdc5f[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xfdc5('0x0'));var util=require('util');var utils=require(_0xfdc5('0x1'));var members={};var exclude=[_0xfdc5('0x2'),_0xfdc5('0x3')];function writeDB(_0x489942){utils['info'](util[_0xfdc5('0x4')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x489942[_0xfdc5('0x5')],_0x489942[_0xfdc5('0x6')],_0x489942[_0xfdc5('0x7')],_0x489942[_0xfdc5('0x8')],_0x489942[_0xfdc5('0x9')],_0x489942[_0xfdc5('0xa')]));if(_0x489942[_0xfdc5('0x6')]){utils[_0xfdc5('0xb')](_0x489942['interface'])['then'](function(_0x246077){if(_0x246077){_0x489942[_0xfdc5('0x9')]=_0x246077[_0xfdc5('0xc')];_0x489942[_0xfdc5('0xd')]=_0x246077[_0xfdc5('0xd')];utils[_0xfdc5('0xe')](_0xfdc5('0xf'),_0x489942);}else{utils[_0xfdc5('0x10')](_0x489942[_0xfdc5('0x6')][_0xfdc5('0x11')]('/')[0x1])[_0xfdc5('0x12')](function(_0x2b5180){if(_0x2b5180){_0x489942[_0xfdc5('0x9')]=_0x2b5180[_0xfdc5('0xc')];_0x489942[_0xfdc5('0xd')]=_0x2b5180[_0xfdc5('0xd')];utils[_0xfdc5('0xe')](_0xfdc5('0xf'),_0x489942);}});}})[_0xfdc5('0x13')](function(_0x490bba){utils[_0xfdc5('0x14')](_0x490bba);});}delete members[_0x489942['interface']];}function startsWith(_0x1efb10,_0x3106ea){return _[_0xfdc5('0x15')](_0x1efb10,function(_0x5a931e){return _[_0xfdc5('0x16')](_0x3106ea,_0x5a931e);});}exports[_0xfdc5('0x17')]=function(_0x354197){switch(_0x354197[_0xfdc5('0x18')]){case _0xfdc5('0x19'):case _0xfdc5('0x1a'):if(!startsWith(exclude,_0x354197[_0xfdc5('0x1b')])){members[_0x354197[_0xfdc5('0x1b')]]={'channel':'voice','interface':_0x354197[_0xfdc5('0x1b')],'type':'TALKING','enterAt':utils[_0xfdc5('0x1c')](),'role':_0xfdc5('0x1d')};}break;case _0xfdc5('0x1e'):if(!_[_0xfdc5('0x1f')](members[_0x354197[_0xfdc5('0x1b')]])){members[_0x354197[_0xfdc5('0x1b')]]['exitAt']=utils[_0xfdc5('0x1c')]();members[_0x354197['device']][_0xfdc5('0x20')]=utils[_0xfdc5('0x21')](members[_0x354197[_0xfdc5('0x1b')]][_0xfdc5('0x22')],members[_0x354197[_0xfdc5('0x1b')]]['enterAt']);if(members[_0x354197[_0xfdc5('0x1b')]][_0xfdc5('0x5')]){writeDB(members[_0x354197['device']]);}}default:break;}};exports[_0xfdc5('0x23')]=function(_0x162ac2){if(!_[_0xfdc5('0x1f')](members[_0x162ac2['interface']])){members[_0x162ac2[_0xfdc5('0x6')]]=_[_0xfdc5('0x24')](members[_0x162ac2[_0xfdc5('0x6')]],{'data4':_0x162ac2['queue'],'uniqueid':_0x162ac2['uniqueid']});}};exports[_0xfdc5('0x25')]=function(_0x296079){if(_0x296079[_0xfdc5('0x7')]){var _0x36e589=_0x296079[_0xfdc5('0x7')][_0xfdc5('0x11')]('-')[0x0];if(!_[_0xfdc5('0x1f')](members[_0x36e589])){members[_0x36e589]=_[_0xfdc5('0x24')](members[_0x36e589],{'data1':members[_0x36e589][_0xfdc5('0x26')]||_0x296079[_0xfdc5('0xa')],'data2':members[_0x36e589][_0xfdc5('0x8')]||_0x296079['source'],'data3':members[_0x36e589]['data3']||_0x296079['destination'],'uniqueid':members[_0x36e589][_0xfdc5('0x5')]||_0x296079[_0xfdc5('0x5')]});if(members[_0x36e589][_0xfdc5('0x22')]){writeDB(members[_0x36e589]);}}}if(_0x296079['destinationchannel']){var _0x593c56=_0x296079['destinationchannel']['split']('-')[0x0];if(!_[_0xfdc5('0x1f')](members[_0x593c56])){members[_0x593c56]=_['assign'](members[_0x593c56],{'data1':members[_0x593c56][_0xfdc5('0x26')]||_0x296079[_0xfdc5('0xa')],'data2':members[_0x593c56]['data2']||_0x296079['source'],'data3':members[_0x593c56][_0xfdc5('0x27')]||_0x296079['destination'],'uniqueid':members[_0x593c56][_0xfdc5('0x5')]||_0x296079['uniqueid']});if(members[_0x593c56][_0xfdc5('0x22')]){writeDB(members[_0x593c56]);}}}}; \ No newline at end of file +var _0x545f=['devicestatechange','state','INUSE','device','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','assign','queue','split','source','data3','destinationchannel','data1','destination','lodash','util','./utils','Local/_attended@transfer','info','format','uniqueid','channel','data2','type','interface','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','catch','error','some','startsWith'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x545f,0x70));var _0xf545=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x545f[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0xf545('0x0'));var util=require(_0xf545('0x1'));var utils=require(_0xf545('0x2'));var members={};var exclude=[_0xf545('0x3'),'Queue:'];function writeDB(_0x187dae){utils[_0xf545('0x4')](util[_0xf545('0x5')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x187dae[_0xf545('0x6')],_0x187dae['interface'],_0x187dae[_0xf545('0x7')],_0x187dae[_0xf545('0x8')],_0x187dae['membername'],_0x187dae[_0xf545('0x9')]));if(_0x187dae[_0xf545('0xa')]){utils[_0xf545('0xb')](_0x187dae[_0xf545('0xa')])[_0xf545('0xc')](function(_0x45516a){if(_0x45516a){_0x187dae[_0xf545('0xd')]=_0x45516a[_0xf545('0xe')];_0x187dae[_0xf545('0xf')]=_0x45516a['internal'];utils[_0xf545('0x10')](_0xf545('0x11'),_0x187dae);}else{utils[_0xf545('0x12')](_0x187dae['interface']['split']('/')[0x1])['then'](function(_0x20b671){if(_0x20b671){_0x187dae[_0xf545('0xd')]=_0x20b671[_0xf545('0xe')];_0x187dae[_0xf545('0xf')]=_0x20b671[_0xf545('0xf')];utils[_0xf545('0x10')](_0xf545('0x11'),_0x187dae);}});}})[_0xf545('0x13')](function(_0x27ae2b){utils[_0xf545('0x14')](_0x27ae2b);});}delete members[_0x187dae[_0xf545('0xa')]];}function startsWith(_0x37493a,_0x8f6867){return _[_0xf545('0x15')](_0x37493a,function(_0x120105){return _[_0xf545('0x16')](_0x8f6867,_0x120105);});}exports[_0xf545('0x17')]=function(_0x12682a){switch(_0x12682a[_0xf545('0x18')]){case _0xf545('0x19'):case'BUSY':if(!startsWith(exclude,_0x12682a[_0xf545('0x1a')])){members[_0x12682a[_0xf545('0x1a')]]={'channel':_0xf545('0x1b'),'interface':_0x12682a['device'],'type':_0xf545('0x1c'),'enterAt':utils[_0xf545('0x1d')](),'role':_0xf545('0x1e')};}break;case _0xf545('0x1f'):if(!_[_0xf545('0x20')](members[_0x12682a[_0xf545('0x1a')]])){members[_0x12682a[_0xf545('0x1a')]][_0xf545('0x21')]=utils[_0xf545('0x1d')]();members[_0x12682a[_0xf545('0x1a')]][_0xf545('0x22')]=utils[_0xf545('0x23')](members[_0x12682a[_0xf545('0x1a')]][_0xf545('0x21')],members[_0x12682a[_0xf545('0x1a')]]['enterAt']);if(members[_0x12682a[_0xf545('0x1a')]][_0xf545('0x6')]){writeDB(members[_0x12682a[_0xf545('0x1a')]]);}}default:break;}};exports[_0xf545('0x24')]=function(_0x5b318b){if(!_['isNil'](members[_0x5b318b['interface']])){members[_0x5b318b[_0xf545('0xa')]]=_[_0xf545('0x25')](members[_0x5b318b[_0xf545('0xa')]],{'data4':_0x5b318b[_0xf545('0x26')],'uniqueid':_0x5b318b[_0xf545('0x6')]});}};exports['cdr']=function(_0x1885d4){if(_0x1885d4[_0xf545('0x7')]){var _0x33c721=_0x1885d4[_0xf545('0x7')][_0xf545('0x27')]('-')[0x0];if(!_[_0xf545('0x20')](members[_0x33c721])){members[_0x33c721]=_[_0xf545('0x25')](members[_0x33c721],{'data1':members[_0x33c721]['data1']||_0x1885d4['type'],'data2':members[_0x33c721][_0xf545('0x8')]||_0x1885d4[_0xf545('0x28')],'data3':members[_0x33c721][_0xf545('0x29')]||_0x1885d4['destination'],'uniqueid':members[_0x33c721]['uniqueid']||_0x1885d4['uniqueid']});if(members[_0x33c721][_0xf545('0x21')]){writeDB(members[_0x33c721]);}}}if(_0x1885d4[_0xf545('0x2a')]){var _0x36ffbd=_0x1885d4['destinationchannel'][_0xf545('0x27')]('-')[0x0];if(!_['isNil'](members[_0x36ffbd])){members[_0x36ffbd]=_[_0xf545('0x25')](members[_0x36ffbd],{'data1':members[_0x36ffbd][_0xf545('0x2b')]||_0x1885d4['type'],'data2':members[_0x36ffbd][_0xf545('0x8')]||_0x1885d4[_0xf545('0x28')],'data3':members[_0x36ffbd][_0xf545('0x29')]||_0x1885d4[_0xf545('0x2c')],'uniqueid':members[_0x36ffbd][_0xf545('0x6')]||_0x1885d4[_0xf545('0x6')]});if(members[_0x36ffbd]['exitAt']){writeDB(members[_0x36ffbd]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index d59d37b..0da588e 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 _0xa63c=['connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','lastAssignedTo','membername','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','mohtime','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','calleridname','queuecallerjoinAt','error','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','uniqueid','channel','queue','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','isNil','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','varset','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','variable','queueposition','EXITWITHKEY','ABANDONED','queuecallerleaveAt','holdtime','diffTime','count'];(function(_0x4b5986,_0x4eba46){var _0x864a63=function(_0x15288a){while(--_0x15288a){_0x4b5986['push'](_0x4b5986['shift']());}};_0x864a63(++_0x4eba46);}(_0xa63c,0xbf));var _0xca63=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa63c[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xca63('0x0'));var util=require(_0xca63('0x1'));var utils=require(_0xca63('0x2'));var queues={};function writeDB(_0x2b568b){utils['info'](util['format']('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x2b568b[_0xca63('0x3')],_0x2b568b[_0xca63('0x4')],_0x2b568b[_0xca63('0x5')],_0x2b568b['lastAssignedTo'],_0x2b568b[_0xca63('0x6')],_0x2b568b['accountcode'],_0x2b568b[_0xca63('0x7')]));if(_0x2b568b['queue']){utils[_0xca63('0x8')](_0x2b568b[_0xca63('0x5')])['then'](function(_0x125d42){if(_0x125d42){_0x2b568b[_0xca63('0x9')]=_0x125d42[_0xca63('0x9')];}utils[_0xca63('0xa')](_0xca63('0xb'),_0x2b568b);});}else{utils[_0xca63('0xa')](_0xca63('0xb'),_0x2b568b);}if(_0x2b568b[_0xca63('0xc')]){delete queues[_0x2b568b[_0xca63('0xc')]];}else{delete queues[_0x2b568b['uniqueid']];}}exports[_0xca63('0xd')]=function(_0x8329f4){queues[_0x8329f4[_0xca63('0x3')]]=_[_0xca63('0xe')](_0x8329f4,{'originalposition':_0x8329f4[_0xca63('0xf')],'queuecallerjoinAt':utils[_0xca63('0x10')](),'mohtime':0x0});};exports['hangup']=function(_0x41cf7e){if(!_[_0xca63('0x11')](queues[_0x41cf7e['uniqueid']])){if(queues[_0x41cf7e[_0xca63('0x3')]]['queuecallerleaveAt']){if(!queues[_0x41cf7e[_0xca63('0x3')]][_0xca63('0x12')]&&!queues[_0x41cf7e['uniqueid']]['queuecallerexit']){queues[_0x41cf7e[_0xca63('0x3')]][_0xca63('0x13')]=!![];queues[_0x41cf7e['uniqueid']][_0xca63('0x14')]=utils[_0xca63('0x10')]();queues[_0x41cf7e[_0xca63('0x3')]][_0xca63('0x7')]=_0xca63('0x15');}writeDB(queues[_0x41cf7e[_0xca63('0x3')]]);}else{if(queues[_0x41cf7e[_0xca63('0x3')]][_0xca63('0xc')]){queues[queues[_0x41cf7e[_0xca63('0x3')]][_0xca63('0xc')]]=queues[_0x41cf7e[_0xca63('0x3')]];queues[queues[_0x41cf7e[_0xca63('0x3')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x41cf7e[_0xca63('0x3')]];}}}};exports[_0xca63('0x16')]=function(_0x2e1f9c){if(!_[_0xca63('0x11')](_0x2e1f9c['variable'][_0xca63('0x17')])&&_0x2e1f9c['value'][_0xca63('0x18')]()!==_0xca63('0x19')){if(!_[_0xca63('0x11')](queues[_0x2e1f9c['uniqueid']])){queues[_0x2e1f9c['uniqueid']][_0xca63('0x12')]=![];queues[_0x2e1f9c[_0xca63('0x3')]][_0xca63('0x1a')]=null;queues[_0x2e1f9c[_0xca63('0x3')]][_0xca63('0x1b')]=!![];queues[_0x2e1f9c[_0xca63('0x3')]][_0xca63('0x1c')]=utils['now']();queues[_0x2e1f9c['uniqueid']]['queuecallerexitreason']=_0x2e1f9c['value']['toUpperCase']();writeDB(queues[_0x2e1f9c[_0xca63('0x3')]]);}}else if(!_[_0xca63('0x11')](_0x2e1f9c[_0xca63('0x1d')][_0xca63('0x1e')])){if(!_['isNil'](queues[_0x2e1f9c[_0xca63('0x3')]])&&!queues[_0x2e1f9c[_0xca63('0x3')]][_0xca63('0x12')]){queues[_0x2e1f9c[_0xca63('0x3')]][_0xca63('0x12')]=![];queues[_0x2e1f9c['uniqueid']][_0xca63('0x1a')]=null;queues[_0x2e1f9c[_0xca63('0x3')]][_0xca63('0x1b')]=!![];queues[_0x2e1f9c[_0xca63('0x3')]]['queuecallerexitAt']=utils[_0xca63('0x10')]();queues[_0x2e1f9c[_0xca63('0x3')]][_0xca63('0x7')]=_0xca63('0x1f');}}};exports[_0xca63('0x12')]=function(_0x426e3c){if(!_[_0xca63('0x11')](queues[_0x426e3c[_0xca63('0x3')]])){queues[_0x426e3c['uniqueid']][_0xca63('0x1b')]=![];queues[_0x426e3c[_0xca63('0x3')]][_0xca63('0x1c')]=null;queues[_0x426e3c[_0xca63('0x3')]][_0xca63('0x12')]=!![];queues[_0x426e3c['uniqueid']][_0xca63('0x1a')]=utils[_0xca63('0x10')]();queues[_0x426e3c[_0xca63('0x3')]][_0xca63('0x7')]=_0xca63('0x20');}};exports['queuecallerleave']=function(_0x248c58){if(!_['isNil'](queues[_0x248c58[_0xca63('0x3')]])){queues[_0x248c58[_0xca63('0x3')]]['queuecallerleave']=!![];queues[_0x248c58[_0xca63('0x3')]][_0xca63('0x21')]=utils[_0xca63('0x10')]();queues[_0x248c58[_0xca63('0x3')]][_0xca63('0x22')]=utils[_0xca63('0x23')](queues[_0x248c58[_0xca63('0x3')]][_0xca63('0x21')],queues[_0x248c58['uniqueid']]['queuecallerjoinAt']);queues[_0x248c58[_0xca63('0x3')]]['position']=_0x248c58[_0xca63('0xf')];queues[_0x248c58['uniqueid']][_0xca63('0x24')]=_0x248c58[_0xca63('0x24')];queues[_0x248c58[_0xca63('0x3')]][_0xca63('0x25')]=_0x248c58['connectedlinenum'];queues[_0x248c58[_0xca63('0x3')]]['connectedlinename']=_0x248c58[_0xca63('0x26')];}};exports[_0xca63('0x27')]=function(_0x528ea9){if(!_[_0xca63('0x11')](queues[_0x528ea9[_0xca63('0x3')]])){queues[_0x528ea9[_0xca63('0x3')]]['queuecallerabandon']=![];queues[_0x528ea9['uniqueid']][_0xca63('0x12')]=![];queues[_0x528ea9[_0xca63('0x3')]]['queuecallerabandonAt']=null;queues[_0x528ea9[_0xca63('0x3')]][_0xca63('0x1b')]=![];queues[_0x528ea9[_0xca63('0x3')]][_0xca63('0x7')]=null;queues[_0x528ea9[_0xca63('0x3')]]['queuecallerexitAt']=null;queues[_0x528ea9[_0xca63('0x3')]][_0xca63('0x28')]=!![];queues[_0x528ea9['uniqueid']][_0xca63('0x29')]=_0x528ea9[_0xca63('0x2a')];queues[_0x528ea9['uniqueid']][_0xca63('0x2b')]=_0x528ea9[_0xca63('0x2c')];}};exports['agentcomplete']=function(_0x172805){if(!_[_0xca63('0x11')](queues[_0x172805[_0xca63('0x3')]])){if(queues[_0x172805[_0xca63('0x3')]][_0xca63('0x21')]){queues[_0x172805[_0xca63('0x3')]][_0xca63('0x12')]=![];queues[_0x172805['uniqueid']][_0xca63('0x12')]=![];queues[_0x172805['uniqueid']][_0xca63('0x1a')]=null;queues[_0x172805[_0xca63('0x3')]][_0xca63('0x1b')]=![];queues[_0x172805[_0xca63('0x3')]]['queuecallerexitAt']=null;queues[_0x172805[_0xca63('0x3')]]['assigned']=!![];queues[_0x172805[_0xca63('0x3')]][_0xca63('0x2b')]=_0x172805[_0xca63('0x2c')];queues[_0x172805['uniqueid']][_0xca63('0x13')]=!![];queues[_0x172805[_0xca63('0x3')]][_0xca63('0x14')]=utils[_0xca63('0x10')]();if(_0x172805[_0xca63('0x2d')]==_0xca63('0x2e')){if(!queues[_0x172805[_0xca63('0x3')]][_0xca63('0x2e')]){queues[_0x172805[_0xca63('0x3')]][_0xca63('0x7')]='TRANSFER';}}else{queues[_0x172805['uniqueid']][_0xca63('0x7')]=_0xca63('0x2f')+_0x172805[_0xca63('0x2d')]['toUpperCase']();}writeDB(queues[_0x172805[_0xca63('0x3')]]);}}};exports[_0xca63('0x30')]=function(_0x5431d7){if(!_[_0xca63('0x11')](queues[_0x5431d7[_0xca63('0x31')]])){queues[_0x5431d7[_0xca63('0x31')]][_0xca63('0x2e')]=!![];queues[_0x5431d7[_0xca63('0x31')]][_0xca63('0x32')]=_0xca63('0x33');queues[_0x5431d7[_0xca63('0x31')]][_0xca63('0x34')]=_0x5431d7[_0xca63('0x35')];queues[_0x5431d7[_0xca63('0x31')]]['transferuniqueid']=_0x5431d7['transfereeuniqueid'];queues[_0x5431d7['transfereeuniqueid']][_0xca63('0x7')]=_0xca63('0x36');}};exports['attendedtransfer']=function(_0x20455f){try{if(_0x20455f[_0xca63('0x37')]==_0x20455f[_0xca63('0x38')]){if(!_[_0xca63('0x11')](queues[_0x20455f['secondtransfererlinkedid']])){queues[_0x20455f[_0xca63('0x39')]][_0xca63('0x2e')]=!![];queues[_0x20455f['secondtransfererlinkedid']][_0xca63('0x32')]=_0xca63('0x3a');queues[_0x20455f[_0xca63('0x39')]][_0xca63('0x34')]=_0x20455f[_0xca63('0x3b')];queues[_0x20455f[_0xca63('0x39')]][_0xca63('0x3c')]=_0x20455f[_0xca63('0x37')];queues[_0x20455f[_0xca63('0x39')]]['queuecallerexitreason']=_0xca63('0x3d');}if(!_[_0xca63('0x11')](queues[_0x20455f[_0xca63('0x38')]])){if(_0x20455f[_0xca63('0x3e')]&&queues[_0x20455f[_0xca63('0x3e')]]){queues[_0x20455f[_0xca63('0x3e')]][_0xca63('0x3f')]=0x1;queues[_0x20455f['transfereeuniqueid']]=_[_0xca63('0x40')](queues[_0x20455f['transfereelinkedid']]);queues[_0x20455f[_0xca63('0x31')]][_0xca63('0xc')]=_0x20455f[_0xca63('0x41')];queues[_0x20455f[_0xca63('0x31')]][_0xca63('0x3f')]=0x2;queues[_0x20455f[_0xca63('0x31')]][_0xca63('0x6')]=queues[_0x20455f[_0xca63('0x39')]][_0xca63('0x6')];queues[_0x20455f['transfereeuniqueid']]['calleridname']=queues[_0x20455f['secondtransfererlinkedid']]['calleridname'];queues[_0x20455f[_0xca63('0x31')]]['queuecallerjoinAt']=utils[_0xca63('0x10')]();queues[_0x20455f['transfereeuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x20455f[_0xca63('0x31')]][_0xca63('0x22')]=0x0;queues[_0x20455f[_0xca63('0x31')]][_0xca63('0x42')]=0x0;}else{queues[_0x20455f[_0xca63('0x38')]]['transfereduniqueid']=_0x20455f[_0xca63('0x39')];}}}else if(_0x20455f['secondtransfereruniqueid']==_0x20455f[_0xca63('0x39')]){if(!_[_0xca63('0x11')](queues[_0x20455f[_0xca63('0x38')]])){queues[_0x20455f[_0xca63('0x38')]][_0xca63('0x2e')]=!![];queues[_0x20455f[_0xca63('0x38')]][_0xca63('0x32')]='ATTENDED';queues[_0x20455f[_0xca63('0x38')]][_0xca63('0x34')]=_0x20455f[_0xca63('0x43')];queues[_0x20455f[_0xca63('0x38')]]['transferuniqueid']=_0x20455f[_0xca63('0x44')];queues[_0x20455f[_0xca63('0x38')]][_0xca63('0x7')]=_0xca63('0x3d');}if(!_[_0xca63('0x11')](queues[_0x20455f[_0xca63('0x39')]])){if(_0x20455f[_0xca63('0x45')]&&queues[_0x20455f[_0xca63('0x45')]]){queues[_0x20455f['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x20455f[_0xca63('0x41')]]=_[_0xca63('0x40')](queues[_0x20455f['transfertargetlinkedid']]);queues[_0x20455f[_0xca63('0x41')]]['transfereduniqueid']=_0x20455f[_0xca63('0x41')];queues[_0x20455f['transfertargetuniqueid']][_0xca63('0x3f')]=0x2;queues[_0x20455f[_0xca63('0x41')]][_0xca63('0x6')]=queues[_0x20455f['origtransfererlinkedid']]['calleridnum'];queues[_0x20455f[_0xca63('0x41')]][_0xca63('0x46')]=queues[_0x20455f[_0xca63('0x38')]][_0xca63('0x46')];queues[_0x20455f['transfertargetuniqueid']][_0xca63('0x47')]=utils['now']();queues[_0x20455f[_0xca63('0x41')]][_0xca63('0x21')]=utils[_0xca63('0x10')]();queues[_0x20455f['transfertargetuniqueid']][_0xca63('0x22')]=0x0;queues[_0x20455f[_0xca63('0x41')]]['mohtime']=0x0;}else{queues[_0x20455f['secondtransfererlinkedid']][_0xca63('0xc')]=_0x20455f['origtransfererlinkedid'];}}}}catch(_0x3da874){utils[_0xca63('0x48')](_0x3da874['stack']);}};exports[_0xca63('0x49')]=function(_0x1083d8){if(!_[_0xca63('0x11')](queues[_0x1083d8['uniqueid']])){queues[_0x1083d8[_0xca63('0x3')]][_0xca63('0x4a')]=utils['now']();}};exports[_0xca63('0x4b')]=function(_0x58b8b1){if(!_[_0xca63('0x11')](queues[_0x58b8b1['uniqueid']])){if(!_[_0xca63('0x11')](queues[_0x58b8b1['uniqueid']][_0xca63('0x4a')])){queues[_0x58b8b1[_0xca63('0x3')]]['mohtime']+=utils['diffTime'](utils[_0xca63('0x10')](),queues[_0x58b8b1[_0xca63('0x3')]][_0xca63('0x4a')]);delete queues[_0x58b8b1[_0xca63('0x3')]]['musiconholdstartAt'];}}}; \ No newline at end of file +var _0x467f=['BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','stack','musiconholdstart','musiconholdstop','musiconholdstartAt','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queueposition','queuecallerexitAt','EXITWITHKEY','queuecallerleave','holdtime','diffTime','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','agentcomplete','queuecallercompleteAt','reason','transfer','COMPLETEDBY','transfereeuniqueid','transfertype','transferexten'];(function(_0x31701d,_0x25897a){var _0x422109=function(_0x3ca953){while(--_0x3ca953){_0x31701d['push'](_0x31701d['shift']());}};_0x422109(++_0x25897a);}(_0x467f,0x144));var _0xf467=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x467f[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0xf467('0x0'));var util=require('util');var utils=require(_0xf467('0x1'));var queues={};function writeDB(_0x1dcdeb){utils[_0xf467('0x2')](util[_0xf467('0x3')](_0xf467('0x4'),_0x1dcdeb[_0xf467('0x5')],_0x1dcdeb[_0xf467('0x6')],_0x1dcdeb[_0xf467('0x7')],_0x1dcdeb[_0xf467('0x8')],_0x1dcdeb[_0xf467('0x9')],_0x1dcdeb[_0xf467('0xa')],_0x1dcdeb[_0xf467('0xb')]));if(_0x1dcdeb[_0xf467('0x7')]){utils[_0xf467('0xc')](_0x1dcdeb[_0xf467('0x7')])[_0xf467('0xd')](function(_0x439a75){if(_0x439a75){_0x1dcdeb['type']=_0x439a75[_0xf467('0xe')];}utils[_0xf467('0xf')](_0xf467('0x10'),_0x1dcdeb);});}else{utils[_0xf467('0xf')](_0xf467('0x10'),_0x1dcdeb);}if(_0x1dcdeb[_0xf467('0x11')]){delete queues[_0x1dcdeb['transfereduniqueid']];}else{delete queues[_0x1dcdeb[_0xf467('0x5')]];}}exports[_0xf467('0x12')]=function(_0x4731f9){queues[_0x4731f9[_0xf467('0x5')]]=_[_0xf467('0x13')](_0x4731f9,{'originalposition':_0x4731f9[_0xf467('0x14')],'queuecallerjoinAt':utils[_0xf467('0x15')](),'mohtime':0x0});};exports[_0xf467('0x16')]=function(_0x9e2a1b){if(!_['isNil'](queues[_0x9e2a1b[_0xf467('0x5')]])){if(queues[_0x9e2a1b[_0xf467('0x5')]][_0xf467('0x17')]){if(!queues[_0x9e2a1b['uniqueid']][_0xf467('0x18')]&&!queues[_0x9e2a1b['uniqueid']][_0xf467('0x19')]){queues[_0x9e2a1b[_0xf467('0x5')]][_0xf467('0x1a')]=!![];queues[_0x9e2a1b[_0xf467('0x5')]]['queuecallercompleteAt']=utils[_0xf467('0x15')]();queues[_0x9e2a1b[_0xf467('0x5')]][_0xf467('0xb')]=_0xf467('0x1b');}writeDB(queues[_0x9e2a1b[_0xf467('0x5')]]);}else{if(queues[_0x9e2a1b[_0xf467('0x5')]][_0xf467('0x11')]){queues[queues[_0x9e2a1b[_0xf467('0x5')]][_0xf467('0x11')]]=queues[_0x9e2a1b[_0xf467('0x5')]];queues[queues[_0x9e2a1b[_0xf467('0x5')]][_0xf467('0x11')]][_0xf467('0x1c')]=0x2;delete queues[_0x9e2a1b[_0xf467('0x5')]];}}}};exports['varset']=function(_0x4b79c3){if(!_[_0xf467('0x1d')](_0x4b79c3[_0xf467('0x1e')][_0xf467('0x1f')])&&_0x4b79c3[_0xf467('0x20')][_0xf467('0x21')]()!==_0xf467('0x22')){if(!_[_0xf467('0x1d')](queues[_0x4b79c3[_0xf467('0x5')]])){queues[_0x4b79c3[_0xf467('0x5')]][_0xf467('0x18')]=![];queues[_0x4b79c3['uniqueid']][_0xf467('0x23')]=null;queues[_0x4b79c3['uniqueid']][_0xf467('0x19')]=!![];queues[_0x4b79c3[_0xf467('0x5')]]['queuecallerexitAt']=utils['now']();queues[_0x4b79c3[_0xf467('0x5')]]['queuecallerexitreason']=_0x4b79c3[_0xf467('0x20')][_0xf467('0x21')]();writeDB(queues[_0x4b79c3[_0xf467('0x5')]]);}}else if(!_[_0xf467('0x1d')](_0x4b79c3[_0xf467('0x1e')][_0xf467('0x24')])){if(!_[_0xf467('0x1d')](queues[_0x4b79c3[_0xf467('0x5')]])&&!queues[_0x4b79c3[_0xf467('0x5')]][_0xf467('0x18')]){queues[_0x4b79c3[_0xf467('0x5')]]['queuecallerabandon']=![];queues[_0x4b79c3[_0xf467('0x5')]][_0xf467('0x23')]=null;queues[_0x4b79c3['uniqueid']][_0xf467('0x19')]=!![];queues[_0x4b79c3[_0xf467('0x5')]][_0xf467('0x25')]=utils['now']();queues[_0x4b79c3['uniqueid']]['queuecallerexitreason']=_0xf467('0x26');}}};exports[_0xf467('0x18')]=function(_0x1a15f0){if(!_['isNil'](queues[_0x1a15f0['uniqueid']])){queues[_0x1a15f0[_0xf467('0x5')]][_0xf467('0x19')]=![];queues[_0x1a15f0['uniqueid']][_0xf467('0x25')]=null;queues[_0x1a15f0[_0xf467('0x5')]]['queuecallerabandon']=!![];queues[_0x1a15f0['uniqueid']][_0xf467('0x23')]=utils['now']();queues[_0x1a15f0[_0xf467('0x5')]][_0xf467('0xb')]='ABANDONED';}};exports[_0xf467('0x27')]=function(_0xe93e63){if(!_[_0xf467('0x1d')](queues[_0xe93e63[_0xf467('0x5')]])){queues[_0xe93e63[_0xf467('0x5')]][_0xf467('0x27')]=!![];queues[_0xe93e63[_0xf467('0x5')]][_0xf467('0x17')]=utils[_0xf467('0x15')]();queues[_0xe93e63['uniqueid']][_0xf467('0x28')]=utils[_0xf467('0x29')](queues[_0xe93e63['uniqueid']][_0xf467('0x17')],queues[_0xe93e63[_0xf467('0x5')]]['queuecallerjoinAt']);queues[_0xe93e63[_0xf467('0x5')]][_0xf467('0x14')]=_0xe93e63[_0xf467('0x14')];queues[_0xe93e63[_0xf467('0x5')]][_0xf467('0x2a')]=_0xe93e63[_0xf467('0x2a')];queues[_0xe93e63[_0xf467('0x5')]][_0xf467('0x2b')]=_0xe93e63[_0xf467('0x2b')];queues[_0xe93e63[_0xf467('0x5')]][_0xf467('0x2c')]=_0xe93e63[_0xf467('0x2c')];}};exports[_0xf467('0x2d')]=function(_0x213da0){if(!_['isNil'](queues[_0x213da0[_0xf467('0x5')]])){queues[_0x213da0[_0xf467('0x5')]]['queuecallerabandon']=![];queues[_0x213da0[_0xf467('0x5')]][_0xf467('0x18')]=![];queues[_0x213da0[_0xf467('0x5')]]['queuecallerabandonAt']=null;queues[_0x213da0[_0xf467('0x5')]]['queuecallerexit']=![];queues[_0x213da0[_0xf467('0x5')]][_0xf467('0xb')]=null;queues[_0x213da0['uniqueid']][_0xf467('0x25')]=null;queues[_0x213da0['uniqueid']][_0xf467('0x2e')]=!![];queues[_0x213da0[_0xf467('0x5')]]['accountcode']=_0x213da0[_0xf467('0x2f')];queues[_0x213da0[_0xf467('0x5')]]['lastAssignedTo']=_0x213da0['membername'];}};exports[_0xf467('0x30')]=function(_0x170c66){if(!_['isNil'](queues[_0x170c66[_0xf467('0x5')]])){if(queues[_0x170c66['uniqueid']]['queuecallerleaveAt']){queues[_0x170c66[_0xf467('0x5')]][_0xf467('0x18')]=![];queues[_0x170c66[_0xf467('0x5')]][_0xf467('0x18')]=![];queues[_0x170c66['uniqueid']]['queuecallerabandonAt']=null;queues[_0x170c66[_0xf467('0x5')]]['queuecallerexit']=![];queues[_0x170c66[_0xf467('0x5')]][_0xf467('0x25')]=null;queues[_0x170c66[_0xf467('0x5')]][_0xf467('0x2e')]=!![];queues[_0x170c66[_0xf467('0x5')]][_0xf467('0x8')]=_0x170c66['membername'];queues[_0x170c66[_0xf467('0x5')]][_0xf467('0x1a')]=!![];queues[_0x170c66[_0xf467('0x5')]][_0xf467('0x31')]=utils[_0xf467('0x15')]();if(_0x170c66[_0xf467('0x32')]==_0xf467('0x33')){if(!queues[_0x170c66[_0xf467('0x5')]][_0xf467('0x33')]){queues[_0x170c66[_0xf467('0x5')]][_0xf467('0xb')]='TRANSFER';}}else{queues[_0x170c66[_0xf467('0x5')]][_0xf467('0xb')]=_0xf467('0x34')+_0x170c66[_0xf467('0x32')][_0xf467('0x21')]();}writeDB(queues[_0x170c66[_0xf467('0x5')]]);}}};exports['blindtransfer']=function(_0x2c0674){if(!_[_0xf467('0x1d')](queues[_0x2c0674[_0xf467('0x35')]])){queues[_0x2c0674[_0xf467('0x35')]]['transfer']=!![];queues[_0x2c0674[_0xf467('0x35')]][_0xf467('0x36')]='BLIND';queues[_0x2c0674['transfereeuniqueid']][_0xf467('0x37')]=_0x2c0674['extension'];queues[_0x2c0674[_0xf467('0x35')]]['transferuniqueid']=_0x2c0674[_0xf467('0x35')];queues[_0x2c0674['transfereeuniqueid']]['queuecallerexitreason']=_0xf467('0x38');}};exports['attendedtransfer']=function(_0x424de0){try{if(_0x424de0[_0xf467('0x39')]==_0x424de0[_0xf467('0x3a')]){if(!_[_0xf467('0x1d')](queues[_0x424de0['secondtransfererlinkedid']])){queues[_0x424de0[_0xf467('0x3b')]][_0xf467('0x33')]=!![];queues[_0x424de0['secondtransfererlinkedid']][_0xf467('0x36')]=_0xf467('0x3c');queues[_0x424de0[_0xf467('0x3b')]][_0xf467('0x37')]=_0x424de0[_0xf467('0x3d')];queues[_0x424de0[_0xf467('0x3b')]]['transferuniqueid']=_0x424de0['origtransfereruniqueid'];queues[_0x424de0['secondtransfererlinkedid']][_0xf467('0xb')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x424de0[_0xf467('0x3a')]])){if(_0x424de0[_0xf467('0x3e')]&&queues[_0x424de0[_0xf467('0x3e')]]){queues[_0x424de0[_0xf467('0x3e')]]['queuecallerenterreason']=0x1;queues[_0x424de0[_0xf467('0x35')]]=_['clone'](queues[_0x424de0[_0xf467('0x3e')]]);queues[_0x424de0['transfereeuniqueid']][_0xf467('0x11')]=_0x424de0[_0xf467('0x3f')];queues[_0x424de0[_0xf467('0x35')]][_0xf467('0x1c')]=0x2;queues[_0x424de0[_0xf467('0x35')]][_0xf467('0x9')]=queues[_0x424de0['secondtransfererlinkedid']][_0xf467('0x9')];queues[_0x424de0[_0xf467('0x35')]]['calleridname']=queues[_0x424de0['secondtransfererlinkedid']][_0xf467('0x40')];queues[_0x424de0['transfereeuniqueid']][_0xf467('0x41')]=utils[_0xf467('0x15')]();queues[_0x424de0['transfereeuniqueid']][_0xf467('0x17')]=utils[_0xf467('0x15')]();queues[_0x424de0[_0xf467('0x35')]][_0xf467('0x28')]=0x0;queues[_0x424de0['transfereeuniqueid']][_0xf467('0x42')]=0x0;}else{queues[_0x424de0['origtransfererlinkedid']][_0xf467('0x11')]=_0x424de0[_0xf467('0x3b')];}}}else if(_0x424de0[_0xf467('0x43')]==_0x424de0[_0xf467('0x3b')]){if(!_[_0xf467('0x1d')](queues[_0x424de0[_0xf467('0x3a')]])){queues[_0x424de0[_0xf467('0x3a')]][_0xf467('0x33')]=!![];queues[_0x424de0[_0xf467('0x3a')]][_0xf467('0x36')]='ATTENDED';queues[_0x424de0['origtransfererlinkedid']]['transferexten']=_0x424de0[_0xf467('0x44')];queues[_0x424de0[_0xf467('0x3a')]]['transferuniqueid']=_0x424de0[_0xf467('0x43')];queues[_0x424de0[_0xf467('0x3a')]][_0xf467('0xb')]=_0xf467('0x45');}if(!_[_0xf467('0x1d')](queues[_0x424de0[_0xf467('0x3b')]])){if(_0x424de0[_0xf467('0x46')]&&queues[_0x424de0[_0xf467('0x46')]]){queues[_0x424de0[_0xf467('0x46')]]['queuecallerenterreason']=0x1;queues[_0x424de0[_0xf467('0x3f')]]=_[_0xf467('0x47')](queues[_0x424de0['transfertargetlinkedid']]);queues[_0x424de0[_0xf467('0x3f')]][_0xf467('0x11')]=_0x424de0[_0xf467('0x3f')];queues[_0x424de0['transfertargetuniqueid']][_0xf467('0x1c')]=0x2;queues[_0x424de0['transfertargetuniqueid']]['calleridnum']=queues[_0x424de0['origtransfererlinkedid']][_0xf467('0x9')];queues[_0x424de0[_0xf467('0x3f')]][_0xf467('0x40')]=queues[_0x424de0[_0xf467('0x3a')]]['calleridname'];queues[_0x424de0[_0xf467('0x3f')]]['queuecallerjoinAt']=utils[_0xf467('0x15')]();queues[_0x424de0[_0xf467('0x3f')]][_0xf467('0x17')]=utils[_0xf467('0x15')]();queues[_0x424de0[_0xf467('0x3f')]]['holdtime']=0x0;queues[_0x424de0[_0xf467('0x3f')]][_0xf467('0x42')]=0x0;}else{queues[_0x424de0[_0xf467('0x3b')]][_0xf467('0x11')]=_0x424de0[_0xf467('0x3a')];}}}}catch(_0x5ec447){utils['error'](_0x5ec447[_0xf467('0x48')]);}};exports[_0xf467('0x49')]=function(_0x13abf6){if(!_[_0xf467('0x1d')](queues[_0x13abf6[_0xf467('0x5')]])){queues[_0x13abf6['uniqueid']]['musiconholdstartAt']=utils['now']();}};exports[_0xf467('0x4a')]=function(_0x399a19){if(!_[_0xf467('0x1d')](queues[_0x399a19['uniqueid']])){if(!_[_0xf467('0x1d')](queues[_0x399a19[_0xf467('0x5')]]['musiconholdstartAt'])){queues[_0x399a19[_0xf467('0x5')]][_0xf467('0x42')]+=utils['diffTime'](utils[_0xf467('0x15')](),queues[_0x399a19['uniqueid']]['musiconholdstartAt']);delete queues[_0x399a19[_0xf467('0x5')]][_0xf467('0x4b')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 776dbb3..995c6dc 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(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x4586d9,_0x40009d){var _0xb3c27d=function(_0x530793){while(--_0x530793){_0x4586d9['push'](_0x4586d9['shift']());}};_0xb3c27d(++_0x40009d);}(_0xe706,0xa3));var _0x6e70=function(_0x4c9191,_0xe10c76){_0x4c9191=_0x4c9191-0x0;var _0x593642=_0xe706[_0x4c9191];return _0x593642;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 943646a..a6b0f76 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 _0x01ab=['lodash','util','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','error','stack','attendedtransfer','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid'];(function(_0x41a3ab,_0x4bb061){var _0x3c9da9=function(_0x37c124){while(--_0x37c124){_0x41a3ab['push'](_0x41a3ab['shift']());}};_0x3c9da9(++_0x4bb061);}(_0x01ab,0xaa));var _0xb01a=function(_0x16dfee,_0x1dba0b){_0x16dfee=_0x16dfee-0x0;var _0x3ced82=_0x01ab[_0x16dfee];return _0x3ced82;};'use strict';var _=require(_0xb01a('0x0'));var util=require(_0xb01a('0x1'));var utils=require(_0xb01a('0x2'));function writeDB(_0x4d7b62){utils[_0xb01a('0x3')](util[_0xb01a('0x4')](_0xb01a('0x5'),_0x4d7b62[_0xb01a('0x6')]));utils[_0xb01a('0x7')](_0xb01a('0x8'),_0x4d7b62);}exports[_0xb01a('0x9')]=function(_0x1fb27a){try{_0x1fb27a[_0xb01a('0x6')]=_0xb01a('0xa');writeDB(_0x1fb27a);}catch(_0x3e4e7d){utils[_0xb01a('0xb')](_0x3e4e7d[_0xb01a('0xc')]);}};exports[_0xb01a('0xd')]=function(_0x3ae6eb){try{_0x3ae6eb=_[_0xb01a('0xe')](_0x3ae6eb,{'transfererchannel':_0x3ae6eb['origtransfererchannel'],'transferercalleridnum':_0x3ae6eb[_0xb01a('0xf')],'transferercalleridname':_0x3ae6eb[_0xb01a('0x10')],'transfererconnectedlinenum':_0x3ae6eb[_0xb01a('0x11')],'transfererconnectedlinename':_0x3ae6eb[_0xb01a('0x12')],'transfereraccountcode':_0x3ae6eb[_0xb01a('0x13')],'transferercontext':_0x3ae6eb[_0xb01a('0x14')],'transfererexten':_0x3ae6eb[_0xb01a('0x15')],'transfererlinkedid':_0x3ae6eb[_0xb01a('0x16')],'context':_0x3ae6eb[_0xb01a('0x17')],'extension':_0x3ae6eb[_0xb01a('0x18')],'type':'attended'});if(_[_0xb01a('0x19')](_0x3ae6eb[_0xb01a('0x1a')])){_0x3ae6eb=_[_0xb01a('0xe')](_0x3ae6eb,{'transfereechannel':_0x3ae6eb[_0xb01a('0x1b')],'transfereecalleridnum':_0x3ae6eb['transfertargetcalleridnum'],'transfereecalleridname':_0x3ae6eb[_0xb01a('0x1c')],'transfereeconnectedlinenum':_0x3ae6eb[_0xb01a('0x1d')],'transfereeconnectedlinename':_0x3ae6eb[_0xb01a('0x1e')],'transfereeaccountcode':_0x3ae6eb[_0xb01a('0x1f')],'transfereecontext':_0x3ae6eb['transfertargetcontext'],'transfereeexten':_0x3ae6eb[_0xb01a('0x20')],'transfereelinkedid':_0x3ae6eb[_0xb01a('0x21')]});}writeDB(_0x3ae6eb);}catch(_0x37e367){utils['error'](_0x37e367['stack']);}}; \ No newline at end of file +var _0xde94=['transfereechannel','assign','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','lodash','util','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blind','error','stack','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','attended','isNil'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0xde94,0x134));var _0x4de9=function(_0x2f0c87,_0x1eefb3){_0x2f0c87=_0x2f0c87-0x0;var _0x45c260=_0xde94[_0x2f0c87];return _0x45c260;};'use strict';var _=require(_0x4de9('0x0'));var util=require(_0x4de9('0x1'));var utils=require(_0x4de9('0x2'));function writeDB(_0x20fb77){utils[_0x4de9('0x3')](util[_0x4de9('0x4')](_0x4de9('0x5'),_0x20fb77[_0x4de9('0x6')]));utils[_0x4de9('0x7')](_0x4de9('0x8'),_0x20fb77);}exports['blindtransfer']=function(_0x391b21){try{_0x391b21[_0x4de9('0x6')]=_0x4de9('0x9');writeDB(_0x391b21);}catch(_0x4d08ab){utils[_0x4de9('0xa')](_0x4d08ab[_0x4de9('0xb')]);}};exports['attendedtransfer']=function(_0x38a351){try{_0x38a351=_['assign'](_0x38a351,{'transfererchannel':_0x38a351[_0x4de9('0xc')],'transferercalleridnum':_0x38a351[_0x4de9('0xd')],'transferercalleridname':_0x38a351['origtransferercalleridname'],'transfererconnectedlinenum':_0x38a351[_0x4de9('0xe')],'transfererconnectedlinename':_0x38a351[_0x4de9('0xf')],'transfereraccountcode':_0x38a351[_0x4de9('0x10')],'transferercontext':_0x38a351[_0x4de9('0x11')],'transfererexten':_0x38a351[_0x4de9('0x12')],'transfererlinkedid':_0x38a351[_0x4de9('0x13')],'context':_0x38a351['origtransferercontext'],'extension':_0x38a351['origtransfererexten'],'type':_0x4de9('0x14')});if(_[_0x4de9('0x15')](_0x38a351[_0x4de9('0x16')])){_0x38a351=_[_0x4de9('0x17')](_0x38a351,{'transfereechannel':_0x38a351['transfertargetchannel'],'transfereecalleridnum':_0x38a351[_0x4de9('0x18')],'transfereecalleridname':_0x38a351[_0x4de9('0x19')],'transfereeconnectedlinenum':_0x38a351[_0x4de9('0x1a')],'transfereeconnectedlinename':_0x38a351[_0x4de9('0x1b')],'transfereeaccountcode':_0x38a351[_0x4de9('0x1c')],'transfereecontext':_0x38a351[_0x4de9('0x1d')],'transfereeexten':_0x38a351['transfertargetexten'],'transfereelinkedid':_0x38a351['transfertargetlinkedid']});}writeDB(_0x38a351);}catch(_0xa3dd05){utils[_0x4de9('0xa')](_0xa3dd05[_0x4de9('0xb')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 40cd9f7..9e7334f 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 _0x3824=['isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','request','then','catch','stack','GetUser','internal','interface','GETUSER|','FOUND','NOTFOUND','result','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','GETVOICEQUEUEBYNAME|','length','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','sumTime','now','isAfter'];(function(_0x21f3f5,_0x1c1c35){var _0x2bfb15=function(_0x48176d){while(--_0x48176d){_0x21f3f5['push'](_0x21f3f5['shift']());}};_0x2bfb15(++_0x1c1c35);}(_0x3824,0xd3));var _0x4382=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x3824[_0x2ff4bd];return _0x28edc6;};'use strict';var jayson=require(_0x4382('0x0'));var moment=require(_0x4382('0x1'));var BPromise=require(_0x4382('0x2'));var client=jayson[_0x4382('0x3')][_0x4382('0x4')]({'port':0x2329});var logger=require(_0x4382('0x5'))(_0x4382('0x6'));exports[_0x4382('0x7')]=function(_0x2c2068){logger[_0x4382('0x7')](_0x2c2068);};exports[_0x4382('0x8')]=function(_0x56fac8){logger['debug'](JSON[_0x4382('0x9')](_0x56fac8));};exports[_0x4382('0xa')]=function(_0x1816c9){logger[_0x4382('0xa')](_0x1816c9['stack']);};exports[_0x4382('0xb')]=function(_0x18b9e6,_0x25b405){return client[_0x4382('0xb')](_0x18b9e6,{'body':_0x25b405})[_0x4382('0xc')](function(_0x4780ea){logger[_0x4382('0x8')](JSON['stringify'](_0x4780ea));})[_0x4382('0xd')](function(_0x51c03e){logger[_0x4382('0xa')](_0x51c03e[_0x4382('0xe')]);});};function getUser(_0x1f6037){return client['request'](_0x4382('0xf'),{'options':{'raw':!![],'attributes':['id',_0x4382('0x10'),'name',_0x4382('0x11')],'where':_0x1f6037,'limit':0x1}})[_0x4382('0xc')](function(_0x318315){logger[_0x4382('0x7')](_0x4382('0x12')+JSON['stringify'](_0x1f6037)+'|'+(_0x318315['result']['length']?_0x4382('0x13'):_0x4382('0x14')));return _0x318315[_0x4382('0x15')]['length']?_0x318315[_0x4382('0x15')][0x0]:null;});}exports[_0x4382('0x16')]=function(_0x1161ab){return new BPromise(function(_0x3533eb,_0x2ef892){if(_0x1161ab){return getUser({'internal':_0x1161ab})[_0x4382('0xc')](function(_0x3b67f0){return _0x3533eb(_0x3b67f0);})[_0x4382('0xd')](function(_0x3d09ba){logger[_0x4382('0xa')](_0x3d09ba[_0x4382('0xe')]);return _0x3533eb(null);});}else{return _0x3533eb(null);}});};exports[_0x4382('0x17')]=function(_0x14fe10){return new BPromise(function(_0x350093,_0x7e058c){if(_0x14fe10){return getUser({'interface':_0x14fe10})[_0x4382('0xc')](function(_0x234ea5){return _0x350093(_0x234ea5);})['catch'](function(_0x4a9fca){logger[_0x4382('0xa')](_0x4a9fca[_0x4382('0xe')]);return _0x350093(null);});}else{return _0x350093(null);}});};exports[_0x4382('0x18')]=function(_0x406c4a){return new BPromise(function(_0x9234c5,_0xe02fae){if(_0x406c4a){return getUser({'name':_0x406c4a})[_0x4382('0xc')](function(_0x149505){return _0x9234c5(_0x149505);})[_0x4382('0xd')](function(_0x3a322b){logger[_0x4382('0xa')](_0x3a322b[_0x4382('0xe')]);return _0x9234c5(null);});}else{return _0x9234c5(null);}});};exports[_0x4382('0x19')]=function(_0x3b1348){return new BPromise(function(_0x1b6e8b,_0x335c09){if(_0x3b1348){return client[_0x4382('0xb')](_0x4382('0x1a'),{'options':{'raw':!![],'attributes':['id',_0x4382('0x1b'),'type',_0x4382('0x1c'),_0x4382('0x1d')],'where':{'name':_0x3b1348},'limit':0x1}})['then'](function(_0x522fd3){logger[_0x4382('0x7')](_0x4382('0x1e')+_0x3b1348+'|'+(_0x522fd3[_0x4382('0x15')][_0x4382('0x1f')]?_0x4382('0x13'):_0x4382('0x14')));return _0x1b6e8b(_0x522fd3[_0x4382('0x15')][_0x4382('0x1f')]?_0x522fd3[_0x4382('0x15')][0x0]:null);})[_0x4382('0xd')](function(_0x3d35e8){logger[_0x4382('0xa')](_0x3d35e8['stack']);return _0x1b6e8b(null);});}else{return _0x1b6e8b(null);}});};exports['addTime']=function(_0x43270b,_0x5a982f){return moment(_0x43270b)[_0x4382('0x20')](_0x5a982f,_0x4382('0x21'))[_0x4382('0x22')](_0x4382('0x23'));};exports['subtractTime']=function(_0x397b4f,_0x4b92ae){return moment(_0x397b4f)[_0x4382('0x24')](_0x4b92ae,'seconds')[_0x4382('0x22')](_0x4382('0x23'));};exports['diffTime']=function(_0x57d184,_0x4d03b2){return moment(_0x57d184)[_0x4382('0x25')](moment(_0x4d03b2),_0x4382('0x21'));};exports[_0x4382('0x26')]=function(_0x14b22b,_0x5349ef){return parseInt(_0x14b22b,0xa)+parseInt(_0x5349ef,0xa);};exports[_0x4382('0x27')]=function(){return moment()[_0x4382('0x22')](_0x4382('0x23'));};exports[_0x4382('0x28')]=function(_0xe0fc8d,_0x4d7904){if(_0x4d7904){return moment(_0xe0fc8d)[_0x4382('0x28')](_0x4d7904);}else{return!![];}};exports[_0x4382('0x29')]=function(_0x2fe183,_0x1deb33){if(_0x1deb33){return moment(_0x2fe183)[_0x4382('0x29')](_0x1deb33);}else if(_0x2fe183){return!![];}else{return![];}}; \ No newline at end of file +var _0xc695=['../../config/logger','debug','stringify','error','request','then','catch','stack','GetUser','internal','name','interface','result','FOUND','length','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','info','GETVOICEQUEUEBYNAME|','NOTFOUND','addTime','add','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','http'];(function(_0x55e5a4,_0x38cdee){var _0x54bb29=function(_0x39c55a){while(--_0x39c55a){_0x55e5a4['push'](_0x55e5a4['shift']());}};_0x54bb29(++_0x38cdee);}(_0xc695,0x154));var _0x5c69=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xc695[_0x5179a5];return _0x15c8ce;};'use strict';var jayson=require(_0x5c69('0x0'));var moment=require(_0x5c69('0x1'));var BPromise=require(_0x5c69('0x2'));var client=jayson['client'][_0x5c69('0x3')]({'port':0x2329});var logger=require(_0x5c69('0x4'))('xdr');exports['info']=function(_0x28e593){logger['info'](_0x28e593);};exports[_0x5c69('0x5')]=function(_0x4570a1){logger[_0x5c69('0x5')](JSON[_0x5c69('0x6')](_0x4570a1));};exports[_0x5c69('0x7')]=function(_0x43c023){logger[_0x5c69('0x7')](_0x43c023['stack']);};exports[_0x5c69('0x8')]=function(_0x20696c,_0x48fe27){return client[_0x5c69('0x8')](_0x20696c,{'body':_0x48fe27})[_0x5c69('0x9')](function(_0x18b2b7){logger[_0x5c69('0x5')](JSON['stringify'](_0x18b2b7));})[_0x5c69('0xa')](function(_0x2251c4){logger[_0x5c69('0x7')](_0x2251c4[_0x5c69('0xb')]);});};function getUser(_0xeada58){return client[_0x5c69('0x8')](_0x5c69('0xc'),{'options':{'raw':!![],'attributes':['id',_0x5c69('0xd'),_0x5c69('0xe'),_0x5c69('0xf')],'where':_0xeada58,'limit':0x1}})['then'](function(_0x50b2cb){logger['info']('GETUSER|'+JSON[_0x5c69('0x6')](_0xeada58)+'|'+(_0x50b2cb[_0x5c69('0x10')]['length']?_0x5c69('0x11'):'NOTFOUND'));return _0x50b2cb[_0x5c69('0x10')][_0x5c69('0x12')]?_0x50b2cb[_0x5c69('0x10')][0x0]:null;});}exports[_0x5c69('0x13')]=function(_0x1e7aef){return new BPromise(function(_0x510aaf,_0x331924){if(_0x1e7aef){return getUser({'internal':_0x1e7aef})[_0x5c69('0x9')](function(_0x18b31c){return _0x510aaf(_0x18b31c);})[_0x5c69('0xa')](function(_0x1da5fd){logger[_0x5c69('0x7')](_0x1da5fd[_0x5c69('0xb')]);return _0x510aaf(null);});}else{return _0x510aaf(null);}});};exports[_0x5c69('0x14')]=function(_0x2c37fc){return new BPromise(function(_0x4db144,_0x888176){if(_0x2c37fc){return getUser({'interface':_0x2c37fc})[_0x5c69('0x9')](function(_0x4ea0fc){return _0x4db144(_0x4ea0fc);})['catch'](function(_0x158174){logger['error'](_0x158174[_0x5c69('0xb')]);return _0x4db144(null);});}else{return _0x4db144(null);}});};exports[_0x5c69('0x15')]=function(_0x3082c7){return new BPromise(function(_0x507d50,_0x1e5599){if(_0x3082c7){return getUser({'name':_0x3082c7})[_0x5c69('0x9')](function(_0x32583f){return _0x507d50(_0x32583f);})[_0x5c69('0xa')](function(_0xa64b92){logger[_0x5c69('0x7')](_0xa64b92[_0x5c69('0xb')]);return _0x507d50(null);});}else{return _0x507d50(null);}});};exports[_0x5c69('0x16')]=function(_0x2d5cea){return new BPromise(function(_0xa6f52b,_0x4ee28e){if(_0x2d5cea){return client['request'](_0x5c69('0x17'),{'options':{'raw':!![],'attributes':['id',_0x5c69('0xe'),_0x5c69('0x18'),_0x5c69('0x19'),_0x5c69('0x1a')],'where':{'name':_0x2d5cea},'limit':0x1}})[_0x5c69('0x9')](function(_0x5b2fc2){logger[_0x5c69('0x1b')](_0x5c69('0x1c')+_0x2d5cea+'|'+(_0x5b2fc2[_0x5c69('0x10')]['length']?_0x5c69('0x11'):_0x5c69('0x1d')));return _0xa6f52b(_0x5b2fc2[_0x5c69('0x10')][_0x5c69('0x12')]?_0x5b2fc2['result'][0x0]:null);})[_0x5c69('0xa')](function(_0x2bafc0){logger[_0x5c69('0x7')](_0x2bafc0[_0x5c69('0xb')]);return _0xa6f52b(null);});}else{return _0xa6f52b(null);}});};exports[_0x5c69('0x1e')]=function(_0x5a827b,_0x4dcafc){return moment(_0x5a827b)[_0x5c69('0x1f')](_0x4dcafc,_0x5c69('0x20'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5c69('0x21')]=function(_0x4245cd,_0x4adb99){return moment(_0x4245cd)[_0x5c69('0x22')](_0x4adb99,'seconds')[_0x5c69('0x23')](_0x5c69('0x24'));};exports[_0x5c69('0x25')]=function(_0x24b0f3,_0x188bb7){return moment(_0x24b0f3)[_0x5c69('0x26')](moment(_0x188bb7),_0x5c69('0x20'));};exports[_0x5c69('0x27')]=function(_0x936378,_0x19beee){return parseInt(_0x936378,0xa)+parseInt(_0x19beee,0xa);};exports[_0x5c69('0x28')]=function(){return moment()['format'](_0x5c69('0x24'));};exports[_0x5c69('0x29')]=function(_0x28fdb1,_0x1560f7){if(_0x1560f7){return moment(_0x28fdb1)[_0x5c69('0x29')](_0x1560f7);}else{return!![];}};exports[_0x5c69('0x2a')]=function(_0x10e475,_0x2b1055){if(_0x2b1055){return moment(_0x10e475)['isBefore'](_0x2b1055);}else if(_0x10e475){return!![];}else{return![];}}; \ No newline at end of file